@configdirector/react-native-sdk 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -869,6 +869,15 @@ const defaultUrlFactory = (input, base) => new URL(input, base === null || base
|
|
|
869
869
|
//#region ../shared/src/constants.ts
|
|
870
870
|
const CLIENT_BASE_URL = "https://client-sdk-api.configdirector.com";
|
|
871
871
|
//#endregion
|
|
872
|
+
//#region ../shared/src/instance-id.ts
|
|
873
|
+
const generateInstanceId = () => {
|
|
874
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") return crypto.randomUUID();
|
|
875
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (placeholder) => {
|
|
876
|
+
const random = Math.random() * 16 | 0;
|
|
877
|
+
return (placeholder === "x" ? random : random & 3 | 8).toString(16);
|
|
878
|
+
});
|
|
879
|
+
};
|
|
880
|
+
//#endregion
|
|
872
881
|
//#region ../js-client-core/src/DefaultConfigDirectorClient.ts
|
|
873
882
|
const MAX_EXPONENTIAL_DELAY = 9;
|
|
874
883
|
var DefaultConfigDirectorClient = class {
|
|
@@ -889,9 +898,10 @@ var DefaultConfigDirectorClient = class {
|
|
|
889
898
|
_defineProperty(this, "currentContext", void 0);
|
|
890
899
|
_defineProperty(this, "connectionMode", void 0);
|
|
891
900
|
_defineProperty(this, "instanceId", void 0);
|
|
892
|
-
this.instanceId =
|
|
901
|
+
this.instanceId = generateInstanceId();
|
|
893
902
|
this.logger = (_clientOptions$logger = clientOptions === null || clientOptions === void 0 ? void 0 : clientOptions.logger) !== null && _clientOptions$logger !== void 0 ? _clientOptions$logger : createDefaultLogger();
|
|
894
903
|
this.timeout = (_clientOptions$connec = clientOptions === null || clientOptions === void 0 || (_clientOptions$connec2 = clientOptions.connection) === null || _clientOptions$connec2 === void 0 ? void 0 : _clientOptions$connec2.timeout) !== null && _clientOptions$connec !== void 0 ? _clientOptions$connec : 3e3;
|
|
904
|
+
this.validateSdkKeyPresence(clientSdkKey);
|
|
895
905
|
const urlFactory = (_internalClientOption = internalClientOptions === null || internalClientOptions === void 0 ? void 0 : internalClientOptions.urlFactory) !== null && _internalClientOption !== void 0 ? _internalClientOption : defaultUrlFactory;
|
|
896
906
|
const baseUrl = (_this$parseUrl = this.parseUrl(clientOptions === null || clientOptions === void 0 || (_clientOptions$connec3 = clientOptions.connection) === null || _clientOptions$connec3 === void 0 ? void 0 : _clientOptions$connec3.url, urlFactory)) !== null && _this$parseUrl !== void 0 ? _this$parseUrl : CLIENT_BASE_URL;
|
|
897
907
|
this.connectionMode = (_clientOptions$connec4 = clientOptions === null || clientOptions === void 0 || (_clientOptions$connec5 = clientOptions.connection) === null || _clientOptions$connec5 === void 0 ? void 0 : _clientOptions$connec5.mode) !== null && _clientOptions$connec4 !== void 0 ? _clientOptions$connec4 : "streaming";
|
|
@@ -1089,6 +1099,9 @@ var DefaultConfigDirectorClient = class {
|
|
|
1089
1099
|
throw new ConfigDirectorValidationError(`Invalid base URL '${url}'. Parsing failed: ${error}`);
|
|
1090
1100
|
}
|
|
1091
1101
|
}
|
|
1102
|
+
validateSdkKeyPresence(sdkKey) {
|
|
1103
|
+
if (!sdkKey || sdkKey.trim().length == 0) throw new ConfigDirectorValidationError("No client SDK key was provided, the client cannot be instantiated without a valid client SDK key");
|
|
1104
|
+
}
|
|
1092
1105
|
validateDefaultValue(defaultValue) {
|
|
1093
1106
|
if (defaultValue === void 0 || defaultValue === null) throw new ConfigDirectorValidationError("Invalid default value. The default value for a config must be defined and non-null.");
|
|
1094
1107
|
if (typeof defaultValue === "function") throw new ConfigDirectorValidationError("Invalid default value. The default value for a config cannot be a function.");
|
|
@@ -1631,7 +1644,7 @@ const createClient = (clientSdkKey, clientOptions) => {
|
|
|
1631
1644
|
const logger = (_clientOptions$logger = clientOptions === null || clientOptions === void 0 ? void 0 : clientOptions.logger) !== null && _clientOptions$logger !== void 0 ? _clientOptions$logger : createConsoleLogger("warn");
|
|
1632
1645
|
return new DefaultConfigDirectorClient(new ReactNativeTelemetryClient(clientSdkKey, (clientOptions === null || clientOptions === void 0 || (_clientOptions$connec = clientOptions.connection) === null || _clientOptions$connec === void 0 ? void 0 : _clientOptions$connec.url) ? urlFactory(clientOptions.connection.url) : CLIENT_BASE_URL, logger, urlFactory), clientSdkKey, {
|
|
1633
1646
|
sdkName: "react-native-sdk",
|
|
1634
|
-
sdkVersion: "0.9.
|
|
1647
|
+
sdkVersion: "0.9.2"
|
|
1635
1648
|
}, {
|
|
1636
1649
|
...clientOptions,
|
|
1637
1650
|
logger
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@configdirector/react-native-sdk",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"description": "React Native client SDK for ConfigDirector. ConfigDirector is a remote configuration and feature flag service.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ConfigDirector",
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"@babel/core": "^7.29.0",
|
|
60
60
|
"@eslint/js": "^10.0.1",
|
|
61
61
|
"@react-native/babel-preset": "^0.85.0",
|
|
62
|
+
"@react-native/jest-preset": "^0.86.2",
|
|
62
63
|
"@rollup/plugin-replace": "^6.0.3",
|
|
63
64
|
"@testing-library/react-native": "^13.3.3",
|
|
64
65
|
"@types/babel__core": "^7",
|
|
@@ -68,12 +69,12 @@
|
|
|
68
69
|
"@types/wtfnode": "^0",
|
|
69
70
|
"babel-jest": "^30.3.0",
|
|
70
71
|
"del-cli": "^7.0.0",
|
|
71
|
-
"eslint": "^10.
|
|
72
|
+
"eslint": "^10.7.0",
|
|
72
73
|
"jest": "^30.3.0",
|
|
73
74
|
"prettier": "^3.8.2",
|
|
74
|
-
"react": "19.
|
|
75
|
-
"react-native": "0.
|
|
76
|
-
"react-test-renderer": "19.
|
|
75
|
+
"react": "^19.2.8",
|
|
76
|
+
"react-native": "^0.86.2",
|
|
77
|
+
"react-test-renderer": "^19.2.8",
|
|
77
78
|
"tsdown": "^0.21.7",
|
|
78
79
|
"turbo": "^2.9.16",
|
|
79
80
|
"typescript": "^5.9.3",
|