@uniformdev/canvas 19.36.0 → 19.36.1-alpha.7

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/index.esm.js CHANGED
@@ -271,6 +271,9 @@ var require_retry2 = __commonJS({
271
271
  // src/CanvasClient.ts
272
272
  import { ApiClient } from "@uniformdev/context/api";
273
273
 
274
+ // src/enhancement/createLimitPolicy.ts
275
+ import { ApiClientError } from "@uniformdev/context/api";
276
+
274
277
  // ../../node_modules/.pnpm/p-retry@5.1.2/node_modules/p-retry/index.js
275
278
  var import_retry = __toESM(require_retry2(), 1);
276
279
  var networkErrorMsgs = /* @__PURE__ */ new Set([
@@ -446,7 +449,17 @@ function createLimitPolicy({
446
449
  }
447
450
  if (retry2) {
448
451
  const retryFunc = currentFunc;
449
- currentFunc = () => pRetry(retryFunc, retry2);
452
+ currentFunc = () => pRetry(retryFunc, {
453
+ ...retry2,
454
+ onFailedAttempt: async (error) => {
455
+ if (retry2.onFailedAttempt) {
456
+ await retry2.onFailedAttempt(error);
457
+ }
458
+ if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode.toString().startsWith("4")) {
459
+ throw error;
460
+ }
461
+ }
462
+ });
450
463
  }
451
464
  return currentFunc();
452
465
  };
@@ -1806,8 +1819,8 @@ function mapSlotToTestVariations(slot) {
1806
1819
  }
1807
1820
 
1808
1821
  // src/index.ts
1809
- import { ApiClientError } from "@uniformdev/context/api";
1810
- var CanvasClientError = ApiClientError;
1822
+ import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
1823
+ var CanvasClientError = ApiClientError2;
1811
1824
  export {
1812
1825
  ATTRIBUTE_COMPONENT_ID,
1813
1826
  ATTRIBUTE_MULTILINE,
@@ -1815,7 +1828,7 @@ export {
1815
1828
  ATTRIBUTE_PARAMETER_TYPE,
1816
1829
  ATTRIBUTE_PARAMETER_VALUE,
1817
1830
  ATTRIBUTE_PLACEHOLDER,
1818
- ApiClientError,
1831
+ ApiClientError2 as ApiClientError,
1819
1832
  BatchEntry,
1820
1833
  CANVAS_DRAFT_STATE,
1821
1834
  CANVAS_ENRICHMENT_TAG_PARAM,
package/dist/index.js CHANGED
@@ -283,7 +283,7 @@ __export(src_exports, {
283
283
  ATTRIBUTE_PARAMETER_TYPE: () => ATTRIBUTE_PARAMETER_TYPE,
284
284
  ATTRIBUTE_PARAMETER_VALUE: () => ATTRIBUTE_PARAMETER_VALUE,
285
285
  ATTRIBUTE_PLACEHOLDER: () => ATTRIBUTE_PLACEHOLDER,
286
- ApiClientError: () => import_api7.ApiClientError,
286
+ ApiClientError: () => import_api8.ApiClientError,
287
287
  BatchEntry: () => BatchEntry,
288
288
  CANVAS_DRAFT_STATE: () => CANVAS_DRAFT_STATE,
289
289
  CANVAS_ENRICHMENT_TAG_PARAM: () => CANVAS_ENRICHMENT_TAG_PARAM,
@@ -363,6 +363,9 @@ __export(src_exports, {
363
363
  module.exports = __toCommonJS(src_exports);
364
364
 
365
365
  // src/CanvasClient.ts
366
+ var import_api2 = require("@uniformdev/context/api");
367
+
368
+ // src/enhancement/createLimitPolicy.ts
366
369
  var import_api = require("@uniformdev/context/api");
367
370
 
368
371
  // ../../node_modules/.pnpm/p-retry@5.1.2/node_modules/p-retry/index.js
@@ -540,7 +543,17 @@ function createLimitPolicy({
540
543
  }
541
544
  if (retry2) {
542
545
  const retryFunc = currentFunc;
543
- currentFunc = () => pRetry(retryFunc, retry2);
546
+ currentFunc = () => pRetry(retryFunc, {
547
+ ...retry2,
548
+ onFailedAttempt: async (error) => {
549
+ if (retry2.onFailedAttempt) {
550
+ await retry2.onFailedAttempt(error);
551
+ }
552
+ if (error instanceof import_api.ApiClientError && typeof error.statusCode === "number" && error.statusCode.toString().startsWith("4")) {
553
+ throw error;
554
+ }
555
+ }
556
+ });
544
557
  }
545
558
  return currentFunc();
546
559
  };
@@ -549,7 +562,7 @@ var nullLimitPolicy = async (func) => await func();
549
562
 
550
563
  // src/CanvasClient.ts
551
564
  var CANVAS_URL = "/api/v1/canvas";
552
- var CanvasClient = class extends import_api.ApiClient {
565
+ var CanvasClient = class extends import_api2.ApiClient {
553
566
  constructor(options) {
554
567
  var _a;
555
568
  if (!options.limitPolicy) {
@@ -652,9 +665,9 @@ var UncachedCanvasClient = class extends CanvasClient {
652
665
  };
653
666
 
654
667
  // src/CategoryClient.ts
655
- var import_api2 = require("@uniformdev/context/api");
668
+ var import_api3 = require("@uniformdev/context/api");
656
669
  var CATEGORIES_URL = "/api/v1/categories";
657
- var CategoryClient = class extends import_api2.ApiClient {
670
+ var CategoryClient = class extends import_api3.ApiClient {
658
671
  constructor(options) {
659
672
  if (!options.limitPolicy) {
660
673
  options.limitPolicy = createLimitPolicy({});
@@ -695,9 +708,9 @@ var UncachedCategoryClient = class extends CategoryClient {
695
708
  };
696
709
 
697
710
  // src/CompositionRelationshipClient.ts
698
- var import_api3 = require("@uniformdev/context/api");
711
+ var import_api4 = require("@uniformdev/context/api");
699
712
  var COMPOSITION_RELATIONSHIP_URL = "/api/v1/composition-relationships";
700
- var unstable_CompositionRelationshipClient = class extends import_api3.ApiClient {
713
+ var unstable_CompositionRelationshipClient = class extends import_api4.ApiClient {
701
714
  constructor(options) {
702
715
  super(options);
703
716
  this.getDefinitionsRelationships = async ({
@@ -758,10 +771,10 @@ var unstable_CompositionRelationshipClient = class extends import_api3.ApiClient
758
771
  };
759
772
 
760
773
  // src/DataSourceClient.ts
761
- var import_api4 = require("@uniformdev/context/api");
774
+ var import_api5 = require("@uniformdev/context/api");
762
775
  var dataSourceUrl = "/api/v1/data-source";
763
776
  var dataSourcesUrl = "/api/v1/data-sources";
764
- var DataSourceClient = class extends import_api4.ApiClient {
777
+ var DataSourceClient = class extends import_api5.ApiClient {
765
778
  constructor(options) {
766
779
  super(options);
767
780
  }
@@ -798,9 +811,9 @@ var DataSourceClient = class extends import_api4.ApiClient {
798
811
  };
799
812
 
800
813
  // src/DataTypeClient.ts
801
- var import_api5 = require("@uniformdev/context/api");
814
+ var import_api6 = require("@uniformdev/context/api");
802
815
  var _url;
803
- var _DataTypeClient = class _DataTypeClient extends import_api5.ApiClient {
816
+ var _DataTypeClient = class _DataTypeClient extends import_api6.ApiClient {
804
817
  constructor(options) {
805
818
  super(options);
806
819
  }
@@ -1717,9 +1730,9 @@ function subscribeToComposition({
1717
1730
  }
1718
1731
 
1719
1732
  // src/RouteClient.ts
1720
- var import_api6 = require("@uniformdev/context/api");
1733
+ var import_api7 = require("@uniformdev/context/api");
1721
1734
  var ROUTE_URL = "/api/v1/route";
1722
- var RouteClient = class extends import_api6.ApiClient {
1735
+ var RouteClient = class extends import_api7.ApiClient {
1723
1736
  constructor(options) {
1724
1737
  var _a;
1725
1738
  if (!options.limitPolicy) {
@@ -1900,8 +1913,8 @@ function mapSlotToTestVariations(slot) {
1900
1913
  }
1901
1914
 
1902
1915
  // src/index.ts
1903
- var import_api7 = require("@uniformdev/context/api");
1904
- var CanvasClientError = import_api7.ApiClientError;
1916
+ var import_api8 = require("@uniformdev/context/api");
1917
+ var CanvasClientError = import_api8.ApiClientError;
1905
1918
  // Annotate the CommonJS export names for ESM import in node:
1906
1919
  0 && (module.exports = {
1907
1920
  ATTRIBUTE_COMPONENT_ID,
package/dist/index.mjs CHANGED
@@ -271,6 +271,9 @@ var require_retry2 = __commonJS({
271
271
  // src/CanvasClient.ts
272
272
  import { ApiClient } from "@uniformdev/context/api";
273
273
 
274
+ // src/enhancement/createLimitPolicy.ts
275
+ import { ApiClientError } from "@uniformdev/context/api";
276
+
274
277
  // ../../node_modules/.pnpm/p-retry@5.1.2/node_modules/p-retry/index.js
275
278
  var import_retry = __toESM(require_retry2(), 1);
276
279
  var networkErrorMsgs = /* @__PURE__ */ new Set([
@@ -446,7 +449,17 @@ function createLimitPolicy({
446
449
  }
447
450
  if (retry2) {
448
451
  const retryFunc = currentFunc;
449
- currentFunc = () => pRetry(retryFunc, retry2);
452
+ currentFunc = () => pRetry(retryFunc, {
453
+ ...retry2,
454
+ onFailedAttempt: async (error) => {
455
+ if (retry2.onFailedAttempt) {
456
+ await retry2.onFailedAttempt(error);
457
+ }
458
+ if (error instanceof ApiClientError && typeof error.statusCode === "number" && error.statusCode.toString().startsWith("4")) {
459
+ throw error;
460
+ }
461
+ }
462
+ });
450
463
  }
451
464
  return currentFunc();
452
465
  };
@@ -1806,8 +1819,8 @@ function mapSlotToTestVariations(slot) {
1806
1819
  }
1807
1820
 
1808
1821
  // src/index.ts
1809
- import { ApiClientError } from "@uniformdev/context/api";
1810
- var CanvasClientError = ApiClientError;
1822
+ import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
1823
+ var CanvasClientError = ApiClientError2;
1811
1824
  export {
1812
1825
  ATTRIBUTE_COMPONENT_ID,
1813
1826
  ATTRIBUTE_MULTILINE,
@@ -1815,7 +1828,7 @@ export {
1815
1828
  ATTRIBUTE_PARAMETER_TYPE,
1816
1829
  ATTRIBUTE_PARAMETER_VALUE,
1817
1830
  ATTRIBUTE_PLACEHOLDER,
1818
- ApiClientError,
1831
+ ApiClientError2 as ApiClientError,
1819
1832
  BatchEntry,
1820
1833
  CANVAS_DRAFT_STATE,
1821
1834
  CANVAS_ENRICHMENT_TAG_PARAM,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas",
3
- "version": "19.36.0",
3
+ "version": "19.36.1-alpha.7+859ce3f29",
4
4
  "description": "Common functionality and types for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -38,7 +38,7 @@
38
38
  "pusher-js": "8.2.0"
39
39
  },
40
40
  "dependencies": {
41
- "@uniformdev/context": "19.36.0",
41
+ "@uniformdev/context": "19.36.1-alpha.7+859ce3f29",
42
42
  "immer": "9.0.21"
43
43
  },
44
44
  "files": [
@@ -47,5 +47,5 @@
47
47
  "publishConfig": {
48
48
  "access": "public"
49
49
  },
50
- "gitHead": "3ae246a7f0f39adeaf04ecba4c7e48c478c019ad"
50
+ "gitHead": "859ce3f295642c78d0308620f988a51ce933bd64"
51
51
  }