@configdirector/nuxt-sdk 0.9.1 → 0.9.3

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.
package/dist/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=4.0.0"
6
6
  },
7
- "version": "0.9.1"
7
+ "version": "0.9.3"
8
8
  }
@@ -532,12 +532,15 @@ var PollingTransport = class extends AbstractPollingTransport {
532
532
  }
533
533
  async connect(timeout) {
534
534
  this.clearPollingInterval();
535
- await this.fetchConfigs(timeout);
536
- this.schedulePollingInterval(() => {
537
- this.fetchConfigs(timeout).catch((error) => {
538
- this.logger.error("[PollingTransport] Error during polling:", error);
535
+ try {
536
+ await this.fetchConfigs(timeout);
537
+ } finally {
538
+ if (!this.fatalError) this.schedulePollingInterval(() => {
539
+ this.fetchConfigs(timeout).catch((error) => {
540
+ this.logger.error("[PollingTransport] Error during polling:", error);
541
+ });
539
542
  });
540
- });
543
+ }
541
544
  return this;
542
545
  }
543
546
  async fetchConfigs(timeout) {
@@ -1640,7 +1643,7 @@ var plugin_default = defineNitroPlugin((nitroApp) => {
1640
1643
  const { serverSdkKey, baseUrl } = runtimeConfig.configdirector;
1641
1644
  const client = new DefaultConfigDirectorClient(serverSdkKey, {
1642
1645
  sdkName: "nuxt-sdk",
1643
- sdkVersion: "0.9.1"
1646
+ sdkVersion: "0.9.3"
1644
1647
  }, {
1645
1648
  logger,
1646
1649
  ...baseUrl ? { connection: { url: baseUrl } } : {}
@@ -753,12 +753,15 @@ var PollingTransport = class extends AbstractPollingTransport {
753
753
  }
754
754
  async connect(context, timeout) {
755
755
  this.clearPollingInterval();
756
- await this.fetchConfigs(context, timeout);
757
- this.schedulePollingInterval(() => {
758
- this.fetchConfigs(context, timeout).catch((error) => {
759
- this.logger.error("[PollingTransport] Error during polling:", error);
756
+ try {
757
+ await this.fetchConfigs(context, timeout);
758
+ } finally {
759
+ if (!this.fatalError) this.schedulePollingInterval(() => {
760
+ this.fetchConfigs(context, timeout).catch((error) => {
761
+ this.logger.error("[PollingTransport] Error during polling:", error);
762
+ });
760
763
  });
761
- });
764
+ }
762
765
  return this;
763
766
  }
764
767
  async fetchConfigs(context, timeout) {
@@ -818,6 +821,15 @@ const parseUrl = (url) => {
818
821
  }
819
822
  };
820
823
  //#endregion
824
+ //#region ../shared/src/instance-id.ts
825
+ const generateInstanceId = () => {
826
+ if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") return crypto.randomUUID();
827
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (placeholder) => {
828
+ const random = Math.random() * 16 | 0;
829
+ return (placeholder === "x" ? random : random & 3 | 8).toString(16);
830
+ });
831
+ };
832
+ //#endregion
821
833
  //#region ../js-client-core/src/DefaultConfigDirectorClient.ts
822
834
  const MAX_EXPONENTIAL_DELAY = 9;
823
835
  var DefaultConfigDirectorClient = class {
@@ -837,7 +849,7 @@ var DefaultConfigDirectorClient = class {
837
849
  connectionMode;
838
850
  instanceId;
839
851
  constructor(telemetryClient, clientSdkKey, sdkOptions, clientOptions, internalClientOptions) {
840
- this.instanceId = crypto.randomUUID();
852
+ this.instanceId = generateInstanceId();
841
853
  this.logger = clientOptions?.logger ?? createDefaultLogger$1();
842
854
  this.timeout = clientOptions?.connection?.timeout ?? 3e3;
843
855
  this.validateSdkKeyPresence(clientSdkKey);
@@ -1299,7 +1311,7 @@ var plugin_client_default = defineNuxtPlugin((nuxtApp) => {
1299
1311
  const { clientSdkKey, appName, appVersion, baseUrl } = runtimeConfig.public.configdirector;
1300
1312
  const client = createBrowserClient(clientSdkKey, {
1301
1313
  sdkName: "nuxt-sdk",
1302
- sdkVersion: "0.9.1"
1314
+ sdkVersion: "0.9.3"
1303
1315
  }, {
1304
1316
  metadata: {
1305
1317
  appName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@configdirector/nuxt-sdk",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "description": "Nuxt SDK for ConfigDirector. ConfigDirector is a remote configuration and feature flag service.",
5
5
  "license": "MIT",
6
6
  "author": "ConfigDirector",