Skip to content

Commit

Permalink
Prepare v11.0.0 (Catnip) release (#68)
Browse files Browse the repository at this point in the history
* Update configcat-common v9.0.0

* Fix dependency vulnerabilities

* Bump version

* Update samples

* Run tests on Node.js 20
  • Loading branch information
adams85 authored Nov 24, 2023
1 parent 5b251a0 commit 918c283
Show file tree
Hide file tree
Showing 9 changed files with 285 additions and 149 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [14.x, 16.x, 18.x, 20.x]
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
Expand Down
399 changes: 266 additions & 133 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "configcat-node",
"version": "10.1.1",
"version": "11.0.0",
"description": "Official ConfigCat SDK to help you access your feature flags from a Node.js application.",
"main": "lib/client.js",
"types": "lib/client.d.ts",
Expand Down Expand Up @@ -32,7 +32,7 @@
},
"engine-strict": true,
"dependencies": {
"configcat-common": "^8.1.1",
"configcat-common": "^9.0.0",
"tslib": "^2.4.1",
"tunnel": "0.0.6"
},
Expand Down
2 changes: 1 addition & 1 deletion samples/console-esm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const value = await configCatClient.getValueAsync("isAwesomeFeatureEnabled", fal
console.log("isAwesomeFeatureEnabled: " + value);

// Read more about the User Object: https://configcat.com/docs/sdk-reference/node/#user-object
const userObject = { identifier: "#SOME-USER-ID#", email: "[email protected]" };
const userObject = new configcat.User("#SOME-USER-ID#", "[email protected]");

const value2 = await configCatClient.getValueAsync("isPOCFeatureEnabled", false, userObject);
console.log("isPOCFeatureEnabled: " + value2);
Expand Down
2 changes: 1 addition & 1 deletion samples/console/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var configcat = require("configcat-node");
console.log("isAwesomeFeatureEnabled: " + value);

// Read more about the User Object: https://configcat.com/docs/sdk-reference/node/#user-object
const userObject = { identifier: "#SOME-USER-ID#", email: "[email protected]" };
const userObject = new configcat.User("#SOME-USER-ID#", "[email protected]");

const value2 = await configCatClient.getValueAsync("isPOCFeatureEnabled", false, userObject);
console.log("isPOCFeatureEnabled: " + value2);
Expand Down
2 changes: 1 addition & 1 deletion samples/customcache/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const configCatClient = configcat.getClient("PKDVCLf-Hq-h-kCzMp-L7Q/HhOWfwVtZ0mb
});

setInterval(() => {
configCatClient.getValueAsync("isPOCFeatureEnabled", false, { email: "[email protected]" }).then(value => {
configCatClient.getValueAsync("isPOCFeatureEnabled", false, new configcat.User("", "[email protected]")).then(value => {
console.log(new Date().toTimeString() + " isPOCFeatureEnabled: " + value);
});
}, 5000);
13 changes: 8 additions & 5 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,27 @@ 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";

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";
2 changes: 1 addition & 1 deletion test/client-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe("ConfigCatClient tests", () => {
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);

Expand Down
8 changes: 4 additions & 4 deletions test/integration-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,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);
Expand All @@ -213,7 +213,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);
Expand All @@ -227,7 +227,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);
Expand All @@ -237,7 +237,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);
Expand Down

0 comments on commit 918c283

Please sign in to comment.