Skip to content

Commit 630d1d5

Browse files
authored
Prepare v9.0.0 (Catnip) release (#87)
* Update configcat-common v9.0.0 * Fix dependency vulnerabilities * Bump version * Update samples
1 parent 10d0c51 commit 630d1d5

File tree

7 files changed

+155
-150
lines changed

7 files changed

+155
-150
lines changed

package-lock.json

Lines changed: 137 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-js",
3-
"version": "8.1.1",
3+
"version": "9.0.0",
44
"description": "ConfigCat is a configuration as a service that lets you manage your features and configurations without actually deploying new code.",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",
@@ -33,7 +33,7 @@
3333
"license": "MIT",
3434
"homepage": "https://configcat.com",
3535
"dependencies": {
36-
"configcat-common": "^8.1.1",
36+
"configcat-common": "^9.0.0",
3737
"tslib": "^2.4.1"
3838
},
3939
"devDependencies": {

samples/html/index.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@
2020
console.log("isAwesomeFeatureEnabled: " + value);
2121
});
2222

23-
var userObject = {
24-
identifier: "#SOME-USER-ID#",
25-
email: "configcat@example.com"
26-
};
23+
var userObject = new configcat.User("#SOME-USER-ID#", "configcat@example.com");
2724
// Read more about the User Object: https://configcat.com/docs/sdk-reference/js/#user-object
2825
configCatClient.getValueAsync("isPOCFeatureEnabled", false, userObject).then(function (value) {
2926
console.log("isPOCFeatureEnabled: " + value);

samples/react-sample/src/Demo.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { User } from 'configcat-js';
12
import React, { Component } from 'react';
23
import './App.css';
34

@@ -19,7 +20,7 @@ class Demo extends Component {
1920
}
2021

2122
async checkProofOfConcept() {
22-
const userObject = { identifier: '#SOME-USER-ID#', email: this.state.userEmail };
23+
const userObject = new User('#SOME-USER-ID#', this.state.userEmail);
2324
// Read more about the User Object: https://configcat.com/docs/advanced/user-object
2425
const value = await this.client.getValueAsync('isPOCFeatureEnabled', false, userObject)
2526
this.setState({ isPOCEnabled: value })

src/index.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,28 +93,31 @@ export { FormattableLogMessage } from "configcat-common";
9393

9494
export type { IConfigCatCache } from "configcat-common";
9595

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

98-
export { SettingType, Comparator } from "configcat-common";
101+
export { SettingType, UserComparator, PrerequisiteFlagComparator, SegmentComparator } from "configcat-common";
99102

100103
export type { IConfigCatClient, IConfigCatClientSnapshot } from "configcat-common";
101104

102105
export { SettingKeyValue } from "configcat-common";
103106

104107
export type { IEvaluationDetails, SettingTypeOf } from "configcat-common";
105108

109+
export type { UserAttributeValue } from "configcat-common";
110+
106111
export { User } from "configcat-common";
107112

108113
export type { FlagOverrides } from "configcat-common";
109114

110115
export { OverrideBehaviour } from "configcat-common";
111116

112-
export { RefreshResult } from "configcat-common";
117+
export { ClientCacheState, RefreshResult } from "configcat-common";
113118

114119
export type { IProvidesHooks, HookEvents } from "configcat-common";
115120

116-
export { ClientReadyState } from "configcat-common";
117-
118121
/* Default export */
119122

120123
export default function(sdkKey: string, options?: IJSAutoPollOptions): IConfigCatClient {

test/IndexTests.ts

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

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

1111
assert.isDefined(client);
1212

test/IntegrationTests.ts

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

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

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

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

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

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

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

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

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

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

0 commit comments

Comments
 (0)