From 6fe664c354de223fe7f3337e37fc2abeaa829d32 Mon Sep 17 00:00:00 2001 From: Robert Grassian Date: Tue, 3 Jun 2025 15:42:06 -0400 Subject: [PATCH 1/8] update sdk versions --- CHANGES.txt | 5 ++++- README.md | 4 ++-- package.json | 10 +++++----- src/__tests__/nodeSuites/client.spec.js | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index dd8f5e6..f0a64e5 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -11,4 +11,7 @@ - Up to date with spec 0.4.0 and @openfeature/js-sdk 0.4.0 1.0.4 - Fixes issue with TS build -- Up to date with spec 0.5.0 and @openfeature/js-sdk 0.5.0 \ No newline at end of file +- Up to date with spec 0.5.0 and @openfeature/js-sdk 0.5.0 +1.1.0 +- Uses renamed @openfeature/js-sdk to @openfeature/server-sdk +- Up to date with spec 0.8.0 and @openfeature/server-sdk 1.18.0 \ No newline at end of file diff --git a/README.md b/README.md index 4f1d77e..16471f2 100644 --- a/README.md +++ b/README.md @@ -19,12 +19,12 @@ npm install @splitsoftware/openfeature-js-split-provider ### Confirm peer dependencies are installed ```sh npm install @splitsoftware/splitio -npm install @openfeature/js-sdk +npm install @openfeature/server-sdk ``` ### Register the Split provider with OpenFeature ```js -const OpenFeature = require('@openfeature/js-sdk').OpenFeature; +const OpenFeature = require('@openfeature/server-sdk').OpenFeature; const SplitFactory = require('@splitsoftware/splitio').SplitFactory; const OpenFeatureSplitProvider = require('@splitsoftware/openfeature-js-split-provider').OpenFeatureSplitProvider; diff --git a/package.json b/package.json index 9866777..0c3635f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@splitsoftware/openfeature-js-split-provider", - "version": "1.0.6", + "version": "1.1.0", "description": "Split OpenFeature Provider", "files": [ "README.md", @@ -25,12 +25,12 @@ }, "dependencies": {}, "peerDependencies": { - "@openfeature/js-sdk": "^1.0.0", - "@splitsoftware/splitio": "^10.22.1" + "@openfeature/server-sdk": "^1.18.0", + "@splitsoftware/splitio": "^11.4.1" }, "devDependencies": { - "@openfeature/js-sdk": "^1.0.0", - "@splitsoftware/splitio": "^10.22.1", + "@openfeature/server-sdk": "^1.18.0", + "@splitsoftware/splitio": "^11.4.1", "copyfiles": "^2.4.1", "cross-env": "^7.0.3", "replace": "^1.2.1", diff --git a/src/__tests__/nodeSuites/client.spec.js b/src/__tests__/nodeSuites/client.spec.js index 53b3184..e134e64 100644 --- a/src/__tests__/nodeSuites/client.spec.js +++ b/src/__tests__/nodeSuites/client.spec.js @@ -1,4 +1,4 @@ -const OpenFeature = require('@openfeature/js-sdk').OpenFeature; +const OpenFeature = require('@openfeature/server-sdk').OpenFeature; const SplitFactory = require('@splitsoftware/splitio').SplitFactory; import { OpenFeatureSplitProvider } from '../..'; From ef841c01db86ca5a185f7791965bd1921898425d Mon Sep 17 00:00:00 2001 From: Robert Grassian Date: Tue, 3 Jun 2025 16:35:15 -0400 Subject: [PATCH 2/8] update ts version --- package.json | 14 +++++++++----- src/lib/js-split-provider.ts | 2 +- tsconfig.json | 5 +++-- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 0c3635f..0911f1c 100644 --- a/package.json +++ b/package.json @@ -26,11 +26,11 @@ "dependencies": {}, "peerDependencies": { "@openfeature/server-sdk": "^1.18.0", - "@splitsoftware/splitio": "^11.4.1" + "@splitsoftware/splitio": "^11.4.0" }, "devDependencies": { "@openfeature/server-sdk": "^1.18.0", - "@splitsoftware/splitio": "^11.4.1", + "@splitsoftware/splitio": "^11.4.0", "copyfiles": "^2.4.1", "cross-env": "^7.0.3", "replace": "^1.2.1", @@ -39,12 +39,13 @@ "tape": "4.13.2", "tape-catch": "1.0.6", "ts-node": "^10.5.0", - "typescript": "4.4.4" + "typescript": "^4.9.5", + "@types/node": "16.11.7" }, "scripts": { - "build-esm": "rimraf es && tsc -outDir es", + "build-esm": "rimraf es && npx tsc --project tsconfig.json -outDir es", "postbuild-esm": "cross-env NODE_ENV=es node scripts/copy.packages.json.js && ./scripts/build_esm_replace_imports.sh", - "build-cjs": "rimraf lib && tsc -outDir lib -m CommonJS", + "build-cjs": "rimraf lib && npx tsc --project tsconfig.json -outDir lib -m CommonJS", "postbuild-cjs": "cross-env NODE_ENV=cjs node scripts/copy.packages.json.js && ./scripts/build_cjs_replace_imports.sh", "build": "rimraf lib es && npm run build-cjs && npm run build-esm", "check": "npm run check:version", @@ -62,5 +63,8 @@ "karma-tap", "karma-webpack" ] + }, + "overrides": { + "@types/node": "16.11.7" } } diff --git a/src/lib/js-split-provider.ts b/src/lib/js-split-provider.ts index c38d3b4..774c796 100644 --- a/src/lib/js-split-provider.ts +++ b/src/lib/js-split-provider.ts @@ -7,7 +7,7 @@ import { JsonValue, TargetingKeyMissingError, StandardResolutionReasons, -} from "@openfeature/js-sdk"; +} from "@openfeature/server-sdk"; import type SplitIO from "@splitsoftware/splitio/types/splitio"; export interface SplitProviderOptions { diff --git a/tsconfig.json b/tsconfig.json index df0cd75..f5eba40 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,7 @@ // "incremental": true, /* Enable incremental compilation */ "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "es2015", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - // "lib": [], /* Specify library files to be included in the compilation. */ + "lib": ["ES2020"], /* Specify library files to be included in the compilation. */ "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ @@ -48,7 +48,8 @@ // "typeRoots": [], /* List of folders to include type definitions from. */ // "types": [], /* Type declaration files to be included in compilation. */ "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + "skipLibCheck": true /* Skip type checking of declaration files. */ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ From 00f804a5ba172ddd6f7d0e2e925de5b5e1df2465 Mon Sep 17 00:00:00 2001 From: Robert Grassian Date: Tue, 3 Jun 2025 16:36:39 -0400 Subject: [PATCH 3/8] split sdk version in changes --- CHANGES.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index f0a64e5..4f1f780 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -14,4 +14,5 @@ - Up to date with spec 0.5.0 and @openfeature/js-sdk 0.5.0 1.1.0 - Uses renamed @openfeature/js-sdk to @openfeature/server-sdk -- Up to date with spec 0.8.0 and @openfeature/server-sdk 1.18.0 \ No newline at end of file +- Up to date with spec 0.8.0 and @openfeature/server-sdk 1.18.0 +- Uses split sdk 11.4.0 \ No newline at end of file From 55f91c3c99cd35be16a42e30b76030e59d3e0402 Mon Sep 17 00:00:00 2001 From: Robert Grassian Date: Tue, 3 Jun 2025 16:41:10 -0400 Subject: [PATCH 4/8] simplify --- package.json | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 0911f1c..5a0ba98 100644 --- a/package.json +++ b/package.json @@ -39,13 +39,12 @@ "tape": "4.13.2", "tape-catch": "1.0.6", "ts-node": "^10.5.0", - "typescript": "^4.9.5", - "@types/node": "16.11.7" + "typescript": "^4.9.5" }, "scripts": { - "build-esm": "rimraf es && npx tsc --project tsconfig.json -outDir es", + "build-esm": "rimraf es && tsc -outDir es", "postbuild-esm": "cross-env NODE_ENV=es node scripts/copy.packages.json.js && ./scripts/build_esm_replace_imports.sh", - "build-cjs": "rimraf lib && npx tsc --project tsconfig.json -outDir lib -m CommonJS", + "build-cjs": "rimraf lib && tsc -outDir lib -m CommonJS", "postbuild-cjs": "cross-env NODE_ENV=cjs node scripts/copy.packages.json.js && ./scripts/build_cjs_replace_imports.sh", "build": "rimraf lib es && npm run build-cjs && npm run build-esm", "check": "npm run check:version", @@ -63,8 +62,5 @@ "karma-tap", "karma-webpack" ] - }, - "overrides": { - "@types/node": "16.11.7" } } From 2cb584230324449a70d1354e1f1df60c882cf2c0 Mon Sep 17 00:00:00 2001 From: Robert Grassian Date: Tue, 3 Jun 2025 16:41:37 -0400 Subject: [PATCH 5/8] simplify --- tsconfig.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index f5eba40..df0cd75 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,7 @@ // "incremental": true, /* Enable incremental compilation */ "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ "module": "es2015", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "lib": ["ES2020"], /* Specify library files to be included in the compilation. */ + // "lib": [], /* Specify library files to be included in the compilation. */ "allowJs": true, /* Allow javascript files to be compiled. */ // "checkJs": true, /* Report errors in .js files. */ // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ @@ -48,8 +48,7 @@ // "typeRoots": [], /* List of folders to include type definitions from. */ // "types": [], /* Type declaration files to be included in compilation. */ "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - "skipLibCheck": true /* Skip type checking of declaration files. */ + "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ From 07ddb78f3cddc83bdae904a49f06adf52a99ed58 Mon Sep 17 00:00:00 2001 From: Robert Grassian Date: Tue, 3 Jun 2025 16:43:31 -0400 Subject: [PATCH 6/8] add back the lib changes --- tsconfig.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index df0cd75..e0d54cb 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -48,7 +48,8 @@ // "typeRoots": [], /* List of folders to include type definitions from. */ // "types": [], /* Type declaration files to be included in compilation. */ "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + "skipLibCheck": true /* Skip type checking of declaration files. */ // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ From 438eaad27f3e0a6216ad9b08deecd8fcf6d6dabe Mon Sep 17 00:00:00 2001 From: Robert Grassian Date: Mon, 16 Jun 2025 10:48:22 -0400 Subject: [PATCH 7/8] fix changes.txt --- CHANGES.txt | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 4f1f780..d4571ce 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,18 +1,18 @@ -1.0.0 -- First release. Up to date with spec 0.4.0, and @openfeature/nodejs-sdk v0.2.0 -1.0.1 -- Fixes issues with flag details and error codes in negative cases, adds unit tests -- Up to date with spec 0.4.0 and @openfeature/nodejs-sdk v0.3.2 -1.0.2 -- Changes name from Node-specific implementation to generic JSON -- Up to date with spec 0.4.0 and @openfeature/js-sdk 0.4.0 -1.0.3 -- Adds types definitions for TypeScript -- Up to date with spec 0.4.0 and @openfeature/js-sdk 0.4.0 +1.1.0 (June 16, 2025) +- Uses renamed @openfeature/js-sdk to @openfeature/server-sdk +- Up to date with spec 0.8.0 and @openfeature/server-sdk 1.18.0 +- Uses split sdk 11.4.0 1.0.4 - Fixes issue with TS build - Up to date with spec 0.5.0 and @openfeature/js-sdk 0.5.0 -1.1.0 -- Uses renamed @openfeature/js-sdk to @openfeature/server-sdk -- Up to date with spec 0.8.0 and @openfeature/server-sdk 1.18.0 -- Uses split sdk 11.4.0 \ No newline at end of file +1.0.3 +- Adds types definitions for TypeScript +- Up to date with spec 0.4.0 and @openfeature/js-sdk 0.4.0 +1.0.2 +- Changes name from Node-specific implementation to generic JSON +- Up to date with spec 0.4.0 and @openfeature/js-sdk 0.4.0 +1.0.1 +- Fixes issues with flag details and error codes in negative cases, adds unit tests +- Up to date with spec 0.4.0 and @openfeature/nodejs-sdk v0.3.2 +1.0.0 +- First release. Up to date with spec 0.4.0, and @openfeature/nodejs-sdk v0.2.0 From 69af314bbb365486a3c558ef393c9c6b59630e92 Mon Sep 17 00:00:00 2001 From: Robert Grassian Date: Mon, 16 Jun 2025 10:49:49 -0400 Subject: [PATCH 8/8] update constructor in case already emitted SDK_READY event --- src/lib/js-split-provider.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib/js-split-provider.ts b/src/lib/js-split-provider.ts index 774c796..6fdaf55 100644 --- a/src/lib/js-split-provider.ts +++ b/src/lib/js-split-provider.ts @@ -31,10 +31,15 @@ export class OpenFeatureSplitProvider implements Provider { constructor(options: SplitProviderOptions) { this.client = options.splitClient; this.initialized = new Promise((resolve) => { - this.client.on(this.client.Event.SDK_READY, () => { + if ((this.client as any).__getStatus().isReady) { console.log(`${this.metadata.name} provider initialized`); resolve(); - }); + } else { + this.client.on(this.client.Event.SDK_READY, () => { + console.log(`${this.metadata.name} provider initialized`); + resolve(); + }); + } }); }