Skip to content

Commit 918c283

Browse files
authored
Prepare v11.0.0 (Catnip) release (#68)
* Update configcat-common v9.0.0 * Fix dependency vulnerabilities * Bump version * Update samples * Run tests on Node.js 20
1 parent 5b251a0 commit 918c283

File tree

9 files changed

+285
-149
lines changed

9 files changed

+285
-149
lines changed

.github/workflows/node-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

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

2323
steps:

package-lock.json

Lines changed: 266 additions & 133 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "configcat-node",
3-
"version": "10.1.1",
3+
"version": "11.0.0",
44
"description": "Official ConfigCat SDK to help you access your feature flags from a Node.js application.",
55
"main": "lib/client.js",
66
"types": "lib/client.d.ts",
@@ -32,7 +32,7 @@
3232
},
3333
"engine-strict": true,
3434
"dependencies": {
35-
"configcat-common": "^8.1.1",
35+
"configcat-common": "^9.0.0",
3636
"tslib": "^2.4.1",
3737
"tunnel": "0.0.6"
3838
},

samples/console-esm/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const value = await configCatClient.getValueAsync("isAwesomeFeatureEnabled", fal
99
console.log("isAwesomeFeatureEnabled: " + value);
1010

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

1414
const value2 = await configCatClient.getValueAsync("isPOCFeatureEnabled", false, userObject);
1515
console.log("isPOCFeatureEnabled: " + value2);

samples/console/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var configcat = require("configcat-node");
1010
console.log("isAwesomeFeatureEnabled: " + value);
1111

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

1515
const value2 = await configCatClient.getValueAsync("isPOCFeatureEnabled", false, userObject);
1616
console.log("isPOCFeatureEnabled: " + value2);

samples/customcache/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const configCatClient = configcat.getClient("PKDVCLf-Hq-h-kCzMp-L7Q/HhOWfwVtZ0mb
1010
});
1111

1212
setInterval(() => {
13-
configCatClient.getValueAsync("isPOCFeatureEnabled", false, { email: "[email protected]" }).then(value => {
13+
configCatClient.getValueAsync("isPOCFeatureEnabled", false, new configcat.User("", "[email protected]")).then(value => {
1414
console.log(new Date().toTimeString() + " isPOCFeatureEnabled: " + value);
1515
});
1616
}, 5000);

src/client.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,24 +91,27 @@ export { FormattableLogMessage } from "configcat-common";
9191

9292
export type { IConfigCatCache } from "configcat-common";
9393

94-
export type { IConfig, ISetting, ITargetingRule, IPercentageOption, SettingValue, VariationIdValue } from "configcat-common";
94+
export type {
95+
IConfig, ISegment, SettingTypeMap, SettingValue, VariationIdValue, ISettingValueContainer, ISettingUnion, ISetting, ITargetingRule, IPercentageOption,
96+
ConditionTypeMap, IConditionUnion, ICondition, UserConditionComparisonValueTypeMap, IUserConditionUnion, IUserCondition, IPrerequisiteFlagCondition, ISegmentCondition
97+
} from "configcat-common";
9598

96-
export { SettingType, Comparator } from "configcat-common";
99+
export { SettingType, UserComparator, PrerequisiteFlagComparator, SegmentComparator } from "configcat-common";
97100

98101
export type { IConfigCatClient, IConfigCatClientSnapshot } from "configcat-common";
99102

100103
export { SettingKeyValue } from "configcat-common";
101104

102105
export type { IEvaluationDetails, SettingTypeOf } from "configcat-common";
103106

107+
export type { UserAttributeValue } from "configcat-common";
108+
104109
export { User } from "configcat-common";
105110

106111
export type { FlagOverrides } from "configcat-common";
107112

108113
export { OverrideBehaviour } from "configcat-common";
109114

110-
export { RefreshResult } from "configcat-common";
115+
export { ClientCacheState, RefreshResult } from "configcat-common";
111116

112117
export type { IProvidesHooks, HookEvents } from "configcat-common";
113-
114-
export { ClientReadyState } from "configcat-common";

test/client-tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe("ConfigCatClient tests", () => {
88
for (const pollingMode of [PollingMode.AutoPoll, PollingMode.LazyLoad, PollingMode.ManualPoll]) {
99
it(`getClient() should createInstance with ${PollingMode[pollingMode]}`, () => {
1010

11-
const client: IConfigCatClient = configcatClient.getClient("SDKKEY", pollingMode);
11+
const client: IConfigCatClient = configcatClient.getClient("SDKKEY-890123456789012/1234567890123456789012", pollingMode);
1212

1313
assert.isDefined(client);
1414

test/integration-tests.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ describe("Integration tests - Wrong SDK key", () => {
201201
it("Auto poll with wrong SDK Key - getValueAsync() should return default value", async () => {
202202

203203
const defaultValue = "NOT_CAT";
204-
const client: IConfigCatClient = configcatClient.getClient("WRONG_SDK_KEY", PollingMode.AutoPoll,
204+
const client: IConfigCatClient = configcatClient.getClient("WRONG_SDK_KEY-56789012/1234567890123456789012", PollingMode.AutoPoll,
205205
{ requestTimeoutMs: 500, maxInitWaitTimeSeconds: 1 });
206206

207207
const actual: string = await client.getValueAsync("stringDefaultCat", defaultValue);
@@ -213,7 +213,7 @@ describe("Integration tests - Wrong SDK key", () => {
213213
it("Manual poll with wrong SDK Key - getValueAsync() should return default value", async () => {
214214

215215
const defaultValue = "NOT_CAT";
216-
const client: IConfigCatClient = configcatClient.getClient("WRONG_SDK_KEY", PollingMode.ManualPoll, { requestTimeoutMs: 500 });
216+
const client: IConfigCatClient = configcatClient.getClient("WRONG_SDK_KEY-56789012/1234567890123456789012", PollingMode.ManualPoll, { requestTimeoutMs: 500 });
217217

218218
const actual: string = await client.getValueAsync("stringDefaultCat", defaultValue);
219219
assert.strictEqual(actual, defaultValue);
@@ -227,7 +227,7 @@ describe("Integration tests - Wrong SDK key", () => {
227227
it("Lazy load with wrong SDK Key - getValueAsync() should return default value", async () => {
228228

229229
const defaultValue = "NOT_CAT";
230-
const client: IConfigCatClient = configcatClient.getClient("WRONG_SDK_KEY", PollingMode.LazyLoad, { requestTimeoutMs: 500 });
230+
const client: IConfigCatClient = configcatClient.getClient("WRONG_SDK_KEY-56789012/1234567890123456789012", PollingMode.LazyLoad, { requestTimeoutMs: 500 });
231231

232232
const actual: string = await client.getValueAsync("stringDefaultCat", defaultValue);
233233
assert.strictEqual(actual, defaultValue);
@@ -237,7 +237,7 @@ describe("Integration tests - Wrong SDK key", () => {
237237

238238
it("getAllKeysAsync() should not crash with wrong SDK Key", async () => {
239239

240-
const client: IConfigCatClient = configcatClient.getClient("WRONG_SDK_KEY", PollingMode.ManualPoll, { requestTimeoutMs: 500 });
240+
const client: IConfigCatClient = configcatClient.getClient("WRONG_SDK_KEY-56789012/1234567890123456789012", PollingMode.ManualPoll, { requestTimeoutMs: 500 });
241241

242242
const keys: string[] = await client.getAllKeysAsync();
243243
assert.equal(keys.length, 0);

0 commit comments

Comments
 (0)