diff --git a/package-lock.json b/package-lock.json index ea1e079..e096fe1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,16 +1,16 @@ { "name": "configcat-js-ssr", - "version": "7.1.2", + "version": "8.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "configcat-js-ssr", - "version": "7.1.2", + "version": "8.0.0", "license": "MIT", "dependencies": { "axios": "^1.6.2", - "configcat-common": "^8.1.1", + "configcat-common": "^9.0.0", "tslib": "^2.4.1" }, "devDependencies": { @@ -2287,9 +2287,9 @@ } }, "node_modules/configcat-common": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/configcat-common/-/configcat-common-8.1.1.tgz", - "integrity": "sha512-2bHaW389wxO9A59GX7q0/bVZHVGabviSpT7zBMMrZqBA9bwMbRjmAyKYqM8Nk2V0E8vSliOxyZLrxNv5o6I6FA==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/configcat-common/-/configcat-common-9.0.0.tgz", + "integrity": "sha512-kLI7PSkysn7pks/QsESX0lRkvL/vVc6CL2LlIk2XAd2PazPN/FaaOO/3hU4IbGG+kT3dwggDvGbioiMaYW1YHw==", "dependencies": { "tslib": "^2.4.1" } @@ -11899,9 +11899,9 @@ } }, "configcat-common": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/configcat-common/-/configcat-common-8.1.1.tgz", - "integrity": "sha512-2bHaW389wxO9A59GX7q0/bVZHVGabviSpT7zBMMrZqBA9bwMbRjmAyKYqM8Nk2V0E8vSliOxyZLrxNv5o6I6FA==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/configcat-common/-/configcat-common-9.0.0.tgz", + "integrity": "sha512-kLI7PSkysn7pks/QsESX0lRkvL/vVc6CL2LlIk2XAd2PazPN/FaaOO/3hU4IbGG+kT3dwggDvGbioiMaYW1YHw==", "requires": { "tslib": "^2.4.1" } diff --git a/package.json b/package.json index b735a8e..edc4b1c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "configcat-js-ssr", - "version": "7.1.2", + "version": "8.0.0", "description": "ConfigCat Feature Flags for Server Side Rendered apps like NuxtJS. Official ConfigCat SDK for Server Side Rendered to easily access feature flags.", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -46,7 +46,7 @@ }, "dependencies": { "axios": "^1.6.2", - "configcat-common": "^8.1.1", + "configcat-common": "^9.0.0", "tslib": "^2.4.1" }, "devDependencies": { diff --git a/samples/nuxt-ssr/pages/index.vue b/samples/nuxt-ssr/pages/index.vue index 023db2e..47f65d2 100644 --- a/samples/nuxt-ssr/pages/index.vue +++ b/samples/nuxt-ssr/pages/index.vue @@ -21,7 +21,7 @@ import Vue from "vue"; import Logo from "~/components/Logo.vue"; import * as ConfigCat from "configcat-js-ssr"; -import { IConfigCatClient, LogLevel, PollingMode } from 'configcat-js-ssr'; +import { LogLevel, PollingMode, User } from 'configcat-js-ssr'; import { log } from "util"; // Setting log level to Info to show detailed feature flag evaluation @@ -55,10 +55,7 @@ export default Vue.extend({ }, checkPOC() { // Read more about the User Object: https://configcat.com/docs/sdk-reference/node/#user-object - const userObject = { - identifier: "#SOME-USER-ID#", - email: this.user - }; + const userObject = new User("#SOME-USER-ID#", this.user); client.getValueAsync("isPOCFeatureEnabled", false, userObject).then(value => { this.isPOCFeatureEnabled = value; }); diff --git a/src/index.ts b/src/index.ts index 4c7ffa7..10497c4 100644 --- a/src/index.ts +++ b/src/index.ts @@ -93,9 +93,12 @@ export { FormattableLogMessage } from "configcat-common"; export type { IConfigCatCache } from "configcat-common"; -export type { IConfig, ISetting, ITargetingRule, IPercentageOption, SettingValue, VariationIdValue } from "configcat-common"; +export type { + IConfig, ISegment, SettingTypeMap, SettingValue, VariationIdValue, ISettingValueContainer, ISettingUnion, ISetting, ITargetingRule, IPercentageOption, + ConditionTypeMap, IConditionUnion, ICondition, UserConditionComparisonValueTypeMap, IUserConditionUnion, IUserCondition, IPrerequisiteFlagCondition, ISegmentCondition +} from "configcat-common"; -export { SettingType, Comparator } from "configcat-common"; +export { SettingType, UserComparator, PrerequisiteFlagComparator, SegmentComparator } from "configcat-common"; export type { IConfigCatClient, IConfigCatClientSnapshot } from "configcat-common"; @@ -103,14 +106,14 @@ export { SettingKeyValue } from "configcat-common"; export type { IEvaluationDetails, SettingTypeOf } from "configcat-common"; +export type { UserAttributeValue } from "configcat-common"; + export { User } from "configcat-common"; export type { FlagOverrides } from "configcat-common"; export { OverrideBehaviour } from "configcat-common"; -export { RefreshResult } from "configcat-common"; +export { ClientCacheState, RefreshResult } from "configcat-common"; export type { IProvidesHooks, HookEvents } from "configcat-common"; - -export { ClientReadyState } from "configcat-common"; diff --git a/test/IndexTests.ts b/test/IndexTests.ts index 30e0450..fe42a27 100644 --- a/test/IndexTests.ts +++ b/test/IndexTests.ts @@ -6,7 +6,7 @@ describe("ConfigCatClient index (main)", () => { for (const pollingMode of [PollingMode.AutoPoll, PollingMode.LazyLoad, PollingMode.ManualPoll]) { it(`getClient() should createInstance with ${PollingMode[pollingMode]}`, () => { - const client: IConfigCatClient = configcatClient.getClient("SDKKEY", pollingMode); + const client: IConfigCatClient = configcatClient.getClient("SDKKEY-890123456789012/1234567890123456789012", pollingMode); assert.isDefined(client); diff --git a/test/IntegrationTests.ts b/test/IntegrationTests.ts index c273db7..d48b56e 100644 --- a/test/IntegrationTests.ts +++ b/test/IntegrationTests.ts @@ -200,7 +200,7 @@ describe("Integration tests - Wrong SDK key", () => { it("Auto poll with wrong SDK Key - getValueAsync() should return default value", async () => { const defaultValue = "NOT_CAT"; - const client: IConfigCatClient = configcatClient.getClient("WRONG_SDK_KEY", PollingMode.AutoPoll, + const client: IConfigCatClient = configcatClient.getClient("WRONG_SDK_KEY-56789012/1234567890123456789012", PollingMode.AutoPoll, { requestTimeoutMs: 500, maxInitWaitTimeSeconds: 1 }); const actual: string = await client.getValueAsync("stringDefaultCat", defaultValue); @@ -212,7 +212,7 @@ describe("Integration tests - Wrong SDK key", () => { it("Manual poll with wrong SDK Key - getValueAsync() should return default value", async () => { const defaultValue = "NOT_CAT"; - const client: IConfigCatClient = configcatClient.getClient("WRONG_SDK_KEY", PollingMode.ManualPoll, { requestTimeoutMs: 500 }); + const client: IConfigCatClient = configcatClient.getClient("WRONG_SDK_KEY-56789012/1234567890123456789012", PollingMode.ManualPoll, { requestTimeoutMs: 500 }); const actual: string = await client.getValueAsync("stringDefaultCat", defaultValue); assert.strictEqual(actual, defaultValue); @@ -226,7 +226,7 @@ describe("Integration tests - Wrong SDK key", () => { it("Lazy load with wrong SDK Key - getValueAsync() should return default value", async () => { const defaultValue = "NOT_CAT"; - const client: IConfigCatClient = configcatClient.getClient("WRONG_SDK_KEY", PollingMode.LazyLoad, { requestTimeoutMs: 500 }); + const client: IConfigCatClient = configcatClient.getClient("WRONG_SDK_KEY-56789012/1234567890123456789012", PollingMode.LazyLoad, { requestTimeoutMs: 500 }); const actual: string = await client.getValueAsync("stringDefaultCat", defaultValue); assert.strictEqual(actual, defaultValue); @@ -236,7 +236,7 @@ describe("Integration tests - Wrong SDK key", () => { it("getAllKeysAsync() should not crash with wrong SDK Key", async () => { - const client: IConfigCatClient = configcatClient.getClient("WRONG_SDK_KEY", PollingMode.ManualPoll, { requestTimeoutMs: 500 }); + const client: IConfigCatClient = configcatClient.getClient("WRONG_SDK_KEY-56789012/1234567890123456789012", PollingMode.ManualPoll, { requestTimeoutMs: 500 }); const keys: string[] = await client.getAllKeysAsync(); assert.equal(keys.length, 0);