@configdirector/react-native-sdk 0.9.2 → 0.10.0

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.
@@ -809,12 +809,15 @@ var PollingTransport = class extends AbstractPollingTransport {
809
809
  }
810
810
  async connect(context, timeout) {
811
811
  this.clearPollingInterval();
812
- await this.fetchConfigs(context, timeout);
813
- this.schedulePollingInterval(() => {
814
- this.fetchConfigs(context, timeout).catch((error) => {
815
- this.logger.error("[PollingTransport] Error during polling:", error);
812
+ try {
813
+ await this.fetchConfigs(context, timeout);
814
+ } finally {
815
+ if (!this.fatalError) this.schedulePollingInterval(() => {
816
+ this.fetchConfigs(context, timeout).catch((error) => {
817
+ this.logger.error("[PollingTransport] Error during polling:", error);
818
+ });
816
819
  });
817
- });
820
+ }
818
821
  return this;
819
822
  }
820
823
  async fetchConfigs(context, timeout) {
@@ -1208,11 +1211,13 @@ const isDroppedEventsEmpty = (droppedEvents) => {
1208
1211
  var ClientEventReporter = class {
1209
1212
  constructor(options) {
1210
1213
  _defineProperty(this, "sdkKey", void 0);
1214
+ _defineProperty(this, "sdkIdentity", void 0);
1211
1215
  _defineProperty(this, "logger", void 0);
1212
1216
  _defineProperty(this, "url", void 0);
1213
1217
  _defineProperty(this, "executeRequests", true);
1214
1218
  this.sdkKey = options.sdkKey;
1215
1219
  this.logger = options.logger;
1220
+ this.sdkIdentity = options.sdkIdentity;
1216
1221
  this.url = options.urlFactory("client/telemetry/v1", options.baseUrl);
1217
1222
  }
1218
1223
  async report({ context, discreteEvents, aggregatedEvents, droppedEvents }) {
@@ -1222,6 +1227,10 @@ var ClientEventReporter = class {
1222
1227
  };
1223
1228
  const eventReport = {
1224
1229
  clientSdkKey: this.sdkKey,
1230
+ metaContext: {
1231
+ sdkName: this.sdkIdentity.sdkName,
1232
+ sdkVersion: this.sdkIdentity.sdkVersion
1233
+ },
1225
1234
  context,
1226
1235
  discreteEvents,
1227
1236
  aggregatedEvents,
@@ -1588,13 +1597,10 @@ const generateValueId = (v) => {
1588
1597
  //#endregion
1589
1598
  //#region src/ReactNativeTelemetryClient.ts
1590
1599
  var ReactNativeTelemetryClient = class {
1591
- constructor(sdkKey, baseUrl, logger, urlFactory) {
1600
+ constructor(options) {
1592
1601
  _defineProperty(this, "collector", void 0);
1593
1602
  this.collector = new ClientTelemetryEventCollector({
1594
- sdkKey,
1595
- logger,
1596
- baseUrl,
1597
- urlFactory,
1603
+ ...options,
1598
1604
  valueIdGenerator: async (v) => generateValueId(v)
1599
1605
  });
1600
1606
  }
@@ -1641,11 +1647,18 @@ const urlFactory = (input, base) => new MinimalUrl(input, base);
1641
1647
  //#region src/client.ts
1642
1648
  const createClient = (clientSdkKey, clientOptions) => {
1643
1649
  var _clientOptions$logger, _clientOptions$connec;
1644
- const logger = (_clientOptions$logger = clientOptions === null || clientOptions === void 0 ? void 0 : clientOptions.logger) !== null && _clientOptions$logger !== void 0 ? _clientOptions$logger : createConsoleLogger("warn");
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, {
1650
+ const sdkIdentity = {
1646
1651
  sdkName: "react-native-sdk",
1647
- sdkVersion: "0.9.2"
1648
- }, {
1652
+ sdkVersion: "0.10.0"
1653
+ };
1654
+ const logger = (_clientOptions$logger = clientOptions === null || clientOptions === void 0 ? void 0 : clientOptions.logger) !== null && _clientOptions$logger !== void 0 ? _clientOptions$logger : createConsoleLogger("warn");
1655
+ return new DefaultConfigDirectorClient(new ReactNativeTelemetryClient({
1656
+ sdkKey: clientSdkKey,
1657
+ sdkIdentity,
1658
+ baseUrl: (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,
1659
+ logger,
1660
+ urlFactory
1661
+ }), clientSdkKey, sdkIdentity, {
1649
1662
  ...clientOptions,
1650
1663
  logger
1651
1664
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@configdirector/react-native-sdk",
3
- "version": "0.9.2",
3
+ "version": "0.10.0",
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",
@@ -41,13 +41,14 @@
41
41
  "example": "yarn workspace @configdirector/react-native-sdk-example",
42
42
  "clean": "rm -fr dist",
43
43
  "build": "tsdown",
44
+ "verify:dist": "node ../../scripts/verify-dist-version.mjs",
44
45
  "prepare": "yarn build",
45
46
  "typecheck": "tsc",
46
47
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
47
48
  "test": "jest --watchAll",
48
49
  "ci:test": "jest --ci",
49
50
  "coverage": "jest --ci --coverage",
50
- "release": "yarn clean && yarn lint && yarn ci:test && yarn build && npm publish --access public"
51
+ "release": "yarn clean && yarn lint && yarn ci:test && yarn build && yarn verify:dist && npm publish --access public"
51
52
  },
52
53
  "publishConfig": {
53
54
  "registry": "https://registry.npmjs.org/"