@uniformdev/next-app-router 20.72.3-alpha.2 → 20.72.3-alpha.23

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.
@@ -591,6 +591,7 @@ var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cann
591
591
  var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
592
592
  var __privateAdd2 = (obj, member, value) => member.has(obj) ? __typeError2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
593
593
  var defaultLimitPolicy = (0, import_p_limit.default)(6);
594
+ var UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE = "Bearer token not valid or expired";
594
595
  var ApiClientError = class _ApiClientError extends Error {
595
596
  constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
596
597
  super(
@@ -606,6 +607,12 @@ var ApiClientError = class _ApiClientError extends Error {
606
607
  Object.setPrototypeOf(this, _ApiClientError.prototype);
607
608
  }
608
609
  };
610
+ var BearerTokenNotValidOrExpiredError = class _BearerTokenNotValidOrExpiredError extends ApiClientError {
611
+ constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
612
+ super(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId);
613
+ Object.setPrototypeOf(this, _BearerTokenNotValidOrExpiredError.prototype);
614
+ }
615
+ };
609
616
  var ApiClient = class _ApiClient {
610
617
  constructor(options) {
611
618
  __publicField2(this, "options");
@@ -639,7 +646,7 @@ var ApiClient = class _ApiClient {
639
646
  }
640
647
  async apiClientWithResponse(fetchUri, options) {
641
648
  return this.options.limitPolicy(async () => {
642
- var _a;
649
+ var _a, _b;
643
650
  const coreHeaders = this.options.apiKey ? {
644
651
  "x-api-key": this.options.apiKey
645
652
  } : {
@@ -675,9 +682,19 @@ var ApiClient = class _ApiClient {
675
682
  } catch (e) {
676
683
  message = `General error`;
677
684
  }
685
+ if (apiResponse.status === 401 && message === UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE) {
686
+ throw new BearerTokenNotValidOrExpiredError(
687
+ message,
688
+ (_a = options == null ? void 0 : options.method) != null ? _a : "GET",
689
+ fetchUri.toString(),
690
+ apiResponse.status,
691
+ apiResponse.statusText,
692
+ _ApiClient.getRequestId(apiResponse)
693
+ );
694
+ }
678
695
  throw new ApiClientError(
679
696
  message,
680
- (_a = options == null ? void 0 : options.method) != null ? _a : "GET",
697
+ (_b = options == null ? void 0 : options.method) != null ? _b : "GET",
681
698
  fetchUri.toString(),
682
699
  apiResponse.status,
683
700
  apiResponse.statusText,
@@ -1381,6 +1398,16 @@ function createLimitPolicy({
1381
1398
  return currentFunc();
1382
1399
  };
1383
1400
  }
1401
+ var ContentClientBase = class extends ApiClient {
1402
+ constructor(options, defaultBypassCache) {
1403
+ var _a, _b;
1404
+ super({
1405
+ ...options,
1406
+ limitPolicy: (_a = options.limitPolicy) != null ? _a : createLimitPolicy({}),
1407
+ bypassCache: (_b = options.bypassCache) != null ? _b : defaultBypassCache
1408
+ });
1409
+ }
1410
+ };
1384
1411
  var SELECT_QUERY_PREFIX = "select.";
1385
1412
  function appendCsv(out, key, values) {
1386
1413
  if (values === void 0) {
@@ -1425,130 +1452,100 @@ function projectionToQuery(spec) {
1425
1452
  }
1426
1453
  return out;
1427
1454
  }
1428
- var CANVAS_URL = "/api/v1/canvas";
1429
- var CanvasClient = class extends ApiClient {
1430
- constructor(options) {
1431
- var _a;
1432
- if (!options.limitPolicy) {
1433
- options.limitPolicy = createLimitPolicy({});
1434
- }
1435
- super(options);
1436
- this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
1437
- this.edgeApiRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
1438
- }
1439
- /** Fetches lists of Canvas compositions, optionally by type */
1440
- async getCompositionList(params = {}) {
1441
- const { projectId } = this.options;
1442
- const { resolveData, filters, select, ...originParams } = params;
1443
- const rewrittenFilters = rewriteFiltersForApi(filters);
1444
- const rewrittenSelect = projectionToQuery(select);
1445
- if (!resolveData) {
1446
- const fetchUri = this.createUrl(CANVAS_URL, {
1447
- ...originParams,
1448
- projectId,
1449
- ...rewrittenFilters,
1450
- ...rewrittenSelect
1451
- });
1452
- return this.apiClient(fetchUri);
1453
- }
1454
- const edgeParams = {
1455
- ...originParams,
1456
- projectId,
1457
- diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
1458
- ...rewrittenFilters,
1459
- ...rewrittenSelect
1460
- };
1461
- const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
1462
- return this.apiClient(edgeUrl, this.edgeApiRequestInit);
1463
- }
1464
- getCompositionByNodePath(options) {
1465
- return this.getOneComposition(options);
1466
- }
1467
- getCompositionByNodeId(options) {
1468
- return this.getOneComposition(options);
1469
- }
1470
- getCompositionBySlug(options) {
1471
- return this.getOneComposition(options);
1472
- }
1473
- getCompositionById(options) {
1474
- return this.getOneComposition(options);
1475
- }
1476
- getCompositionDefaults(options) {
1477
- return this.getOneComposition(options);
1478
- }
1479
- /** Fetches historical versions of a composition or pattern */
1480
- async getCompositionHistory(options) {
1481
- const historyUrl = this.createUrl("/api/v1/canvas-history", {
1482
- ...options,
1483
- projectId: this.options.projectId
1484
- });
1485
- return this.apiClient(historyUrl);
1486
- }
1487
- getOneComposition({
1488
- skipDataResolution,
1489
- diagnostics,
1490
- ...params
1491
- }) {
1492
- const { projectId } = this.options;
1493
- if (skipDataResolution) {
1494
- return this.apiClient(this.createUrl(CANVAS_URL, { ...params, projectId }));
1495
- }
1496
- const edgeParams = {
1497
- ...params,
1498
- projectId,
1499
- diagnostics: typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0
1455
+ var CANVAS_PERSONALIZE_TYPE = "$personalization";
1456
+ var CANVAS_TEST_TYPE = "$test";
1457
+ var CANVAS_BLOCK_PARAM_TYPE = "$block";
1458
+ var CANVAS_PERSONALIZE_SLOT = "pz";
1459
+ var CANVAS_TEST_SLOT = "test";
1460
+ var CANVAS_DRAFT_STATE = 0;
1461
+ var CANVAS_PUBLISHED_STATE = 64;
1462
+ var CANVAS_EDITOR_STATE = 63;
1463
+ var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
1464
+ var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
1465
+ var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
1466
+ var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
1467
+ var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
1468
+ var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
1469
+ var IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM = "is_incontext_editing_forced_settings";
1470
+ var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
1471
+ function resolveCompositionSelector(args) {
1472
+ if ("compositionId" in args) {
1473
+ const { compositionId, editionId, versionId, ...readOptions } = args;
1474
+ return {
1475
+ readOptions,
1476
+ // raw mode matches on composition OR edition id via the compositionId param
1477
+ compositionId: editionId != null ? editionId : compositionId,
1478
+ versionId,
1479
+ hasCompositionId: true,
1480
+ pinnedEdition: editionId !== void 0
1500
1481
  };
1501
- const edgeUrl = this.createUrl("/api/v1/composition", edgeParams, this.edgeApiHost);
1502
- return this.apiClient(edgeUrl, this.edgeApiRequestInit);
1503
1482
  }
1504
- /** Updates or creates a Canvas component definition */
1505
- async updateComposition(body, options) {
1506
- const fetchUri = this.createUrl(CANVAS_URL);
1507
- const headers = {};
1508
- if (options == null ? void 0 : options.ifUnmodifiedSince) {
1509
- headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
1510
- }
1511
- const { response } = await this.apiClientWithResponse(fetchUri, {
1512
- method: "PUT",
1513
- body: JSON.stringify({ ...body, projectId: this.options.projectId }),
1514
- expectNoContent: true,
1515
- headers
1516
- });
1517
- return { modified: response.headers.get("x-modified-at") };
1483
+ return { readOptions: args, hasCompositionId: false, pinnedEdition: false };
1484
+ }
1485
+ var DEFAULT_EDGE_API_HOST = "https://uniform.global";
1486
+ var DeliveryClientBase = class extends ContentClientBase {
1487
+ constructor(options) {
1488
+ var _a;
1489
+ super(
1490
+ options,
1491
+ /* defaultBypassCache */
1492
+ false
1493
+ );
1494
+ this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : DEFAULT_EDGE_API_HOST;
1495
+ this.edgeRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
1518
1496
  }
1519
- /** Deletes a Canvas component definition */
1520
- async removeComposition(body) {
1521
- const fetchUri = this.createUrl(CANVAS_URL);
1522
- const { projectId } = this.options;
1523
- await this.apiClient(fetchUri, {
1524
- method: "DELETE",
1525
- body: JSON.stringify({ ...body, projectId }),
1526
- expectNoContent: true
1527
- });
1497
+ /** Coerces the `diagnostics` option into the shape the edge endpoints accept. */
1498
+ coerceDiagnostics(diagnostics) {
1499
+ return typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0;
1528
1500
  }
1529
- /** Fetches all Canvas component definitions */
1530
- async getComponentDefinitions(options) {
1531
- const { projectId } = this.options;
1532
- const fetchUri = this.createUrl("/api/v1/canvas-definitions", { ...options, projectId });
1533
- return this.apiClient(fetchUri);
1501
+ };
1502
+ var EDGE_SINGLE_URL = "/api/v1/composition";
1503
+ var EDGE_LIST_URL = "/api/v1/compositions";
1504
+ var CompositionDeliveryClient = class extends DeliveryClientBase {
1505
+ constructor(options) {
1506
+ super(options);
1534
1507
  }
1535
- /** Updates or creates a Canvas component definition */
1536
- async updateComponentDefinition(body) {
1537
- const fetchUri = this.createUrl("/api/v1/canvas-definitions");
1538
- await this.apiClient(fetchUri, {
1539
- method: "PUT",
1540
- body: JSON.stringify({ ...body, projectId: this.options.projectId }),
1541
- expectNoContent: true
1542
- });
1508
+ /** Fetches exactly one composition (throws `ApiClientError(404)` if absent). */
1509
+ get(args) {
1510
+ var _a;
1511
+ const { diagnostics, select, ...rest } = args;
1512
+ const { readOptions, compositionId, versionId, pinnedEdition } = resolveCompositionSelector(rest);
1513
+ const url = this.createUrl(
1514
+ EDGE_SINGLE_URL,
1515
+ {
1516
+ ...readOptions,
1517
+ ...projectionToQuery(select),
1518
+ // A pinned edition is folded into compositionId (raw matches edition or
1519
+ // composition id); there is no editionId query param on this endpoint.
1520
+ compositionId,
1521
+ versionId,
1522
+ projectId: this.options.projectId,
1523
+ state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
1524
+ // editionId pins a specific edition for preview; otherwise locale-best.
1525
+ editions: pinnedEdition ? "raw" : "auto",
1526
+ diagnostics: this.coerceDiagnostics(diagnostics)
1527
+ },
1528
+ this.edgeApiHost
1529
+ );
1530
+ return this.apiClient(url, this.edgeRequestInit);
1543
1531
  }
1544
- /** Deletes a Canvas component definition */
1545
- async removeComponentDefinition(body) {
1546
- const fetchUri = this.createUrl("/api/v1/canvas-definitions");
1547
- await this.apiClient(fetchUri, {
1548
- method: "DELETE",
1549
- body: JSON.stringify({ ...body, projectId: this.options.projectId }),
1550
- expectNoContent: true
1551
- });
1532
+ /** Fetches a list of compositions, optionally filtered. */
1533
+ list(args = {}) {
1534
+ var _a;
1535
+ const { diagnostics, filters, select, ...rest } = args;
1536
+ const url = this.createUrl(
1537
+ EDGE_LIST_URL,
1538
+ {
1539
+ ...rest,
1540
+ ...rewriteFiltersForApi(filters),
1541
+ ...projectionToQuery(select),
1542
+ projectId: this.options.projectId,
1543
+ state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
1544
+ diagnostics: this.coerceDiagnostics(diagnostics)
1545
+ },
1546
+ this.edgeApiHost
1547
+ );
1548
+ return this.apiClient(url, this.edgeRequestInit);
1552
1549
  }
1553
1550
  };
1554
1551
  var _contentTypesUrl;
@@ -1657,14 +1654,18 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
1657
1654
  constructor(options) {
1658
1655
  super(options);
1659
1656
  }
1660
- /** Fetches all DataTypes for a project */
1661
- async get(options) {
1657
+ /** Fetches a list of DataTypes for a project */
1658
+ async list(options) {
1662
1659
  const { projectId } = this.options;
1663
1660
  const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8), { ...options, projectId });
1664
1661
  return await this.apiClient(fetchUri);
1665
1662
  }
1663
+ /** @deprecated Use {@link list} instead. */
1664
+ async get(options) {
1665
+ return this.list(options);
1666
+ }
1666
1667
  /** Updates or creates (based on id) a DataType */
1667
- async upsert(body) {
1668
+ async save(body) {
1668
1669
  const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
1669
1670
  await this.apiClient(fetchUri, {
1670
1671
  method: "PUT",
@@ -1672,6 +1673,10 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
1672
1673
  expectNoContent: true
1673
1674
  });
1674
1675
  }
1676
+ /** @deprecated Use {@link save} instead. */
1677
+ async upsert(body) {
1678
+ return this.save(body);
1679
+ }
1675
1680
  /** Deletes a DataType */
1676
1681
  async remove(body) {
1677
1682
  const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
@@ -1709,22 +1714,6 @@ function getComponentPath(ancestorsAndSelf) {
1709
1714
  }
1710
1715
  return `.${path.join(".")}`;
1711
1716
  }
1712
- var CANVAS_PERSONALIZE_TYPE = "$personalization";
1713
- var CANVAS_TEST_TYPE = "$test";
1714
- var CANVAS_BLOCK_PARAM_TYPE = "$block";
1715
- var CANVAS_PERSONALIZE_SLOT = "pz";
1716
- var CANVAS_TEST_SLOT = "test";
1717
- var CANVAS_DRAFT_STATE = 0;
1718
- var CANVAS_PUBLISHED_STATE = 64;
1719
- var CANVAS_EDITOR_STATE = 63;
1720
- var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
1721
- var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
1722
- var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
1723
- var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
1724
- var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
1725
- var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
1726
- var IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM = "is_incontext_editing_forced_settings";
1727
- var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
1728
1717
  function isRootEntryReference(root) {
1729
1718
  return root.type === "root" && isEntryData(root.node);
1730
1719
  }
@@ -1744,9 +1733,9 @@ function parseVariableExpression(serialized, onToken) {
1744
1733
  let bufferStartIndex = 0;
1745
1734
  let bufferEndIndex = 0;
1746
1735
  let tokenCount = 0;
1747
- const handleToken = (token, type) => {
1736
+ const handleToken = (token, type, offset) => {
1748
1737
  tokenCount++;
1749
- return onToken == null ? void 0 : onToken(token, type);
1738
+ return onToken == null ? void 0 : onToken(token, type, offset);
1750
1739
  };
1751
1740
  let state = "text";
1752
1741
  for (let index = 0; index < serialized.length; index++) {
@@ -1757,7 +1746,7 @@ function parseVariableExpression(serialized, onToken) {
1757
1746
  if (char === variablePrefix[0] && serialized[index + 1] === variablePrefix[1]) {
1758
1747
  if (serialized[index - 1] === escapeCharacter) {
1759
1748
  bufferEndIndex -= escapeCharacter.length;
1760
- if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
1749
+ if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text", bufferStartIndex) === false) {
1761
1750
  return tokenCount;
1762
1751
  }
1763
1752
  bufferStartIndex = index;
@@ -1766,12 +1755,12 @@ function parseVariableExpression(serialized, onToken) {
1766
1755
  }
1767
1756
  if (state === "variable") {
1768
1757
  const textStart = bufferStartIndex - variablePrefix.length;
1769
- if (handleToken(serialized.substring(textStart, bufferEndIndex), "text") === false) {
1758
+ if (handleToken(serialized.substring(textStart, bufferEndIndex), "text", textStart) === false) {
1770
1759
  return tokenCount;
1771
1760
  }
1772
1761
  bufferStartIndex = bufferEndIndex;
1773
1762
  } else if (bufferEndIndex > bufferStartIndex) {
1774
- if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
1763
+ if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text", bufferStartIndex) === false) {
1775
1764
  return tokenCount;
1776
1765
  }
1777
1766
  bufferStartIndex = bufferEndIndex;
@@ -1789,7 +1778,7 @@ function parseVariableExpression(serialized, onToken) {
1789
1778
  state = "text";
1790
1779
  if (bufferEndIndex > bufferStartIndex) {
1791
1780
  const unescapedVariableName = serialized.substring(bufferStartIndex, bufferEndIndex).replace(/\\([${}])/g, "$1");
1792
- if (handleToken(unescapedVariableName, "variable") === false) {
1781
+ if (handleToken(unescapedVariableName, "variable", bufferStartIndex) === false) {
1793
1782
  return tokenCount;
1794
1783
  }
1795
1784
  bufferStartIndex = bufferEndIndex + variableSuffix.length;
@@ -1803,7 +1792,7 @@ function parseVariableExpression(serialized, onToken) {
1803
1792
  bufferStartIndex -= variablePrefix.length;
1804
1793
  }
1805
1794
  if (bufferStartIndex < serialized.length) {
1806
- handleToken(serialized.substring(bufferStartIndex), state);
1795
+ handleToken(serialized.substring(bufferStartIndex), state, bufferStartIndex);
1807
1796
  }
1808
1797
  return tokenCount;
1809
1798
  }
@@ -2326,20 +2315,28 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
2326
2315
  * When teamId is provided, returns a single team with its projects.
2327
2316
  * When omitted, returns all accessible teams and their projects.
2328
2317
  */
2329
- async getProjects(options) {
2318
+ async list(options) {
2330
2319
  const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
2331
2320
  return await this.apiClient(fetchUri);
2332
2321
  }
2322
+ /** @deprecated Use {@link list} instead. */
2323
+ async getProjects(options) {
2324
+ return this.list(options);
2325
+ }
2333
2326
  /** Updates or creates (based on id) a Project */
2334
- async upsert(body) {
2327
+ async save(body) {
2335
2328
  const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
2336
2329
  return await this.apiClient(fetchUri, {
2337
2330
  method: "PUT",
2338
2331
  body: JSON.stringify({ ...body })
2339
2332
  });
2340
2333
  }
2334
+ /** @deprecated Use {@link save} instead. */
2335
+ async upsert(body) {
2336
+ return this.save(body);
2337
+ }
2341
2338
  /** Deletes a Project */
2342
- async delete(body) {
2339
+ async remove(body) {
2343
2340
  const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
2344
2341
  await this.apiClient(fetchUri, {
2345
2342
  method: "DELETE",
@@ -2347,6 +2344,10 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
2347
2344
  expectNoContent: true
2348
2345
  });
2349
2346
  }
2347
+ /** @deprecated Use {@link remove} instead. */
2348
+ async delete(body) {
2349
+ return this.remove(body);
2350
+ }
2350
2351
  };
2351
2352
  _url22 = /* @__PURE__ */ new WeakMap();
2352
2353
  _projectsUrl = /* @__PURE__ */ new WeakMap();
@@ -2362,8 +2363,14 @@ var RouteClient = class extends ApiClient {
2362
2363
  super(options);
2363
2364
  this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
2364
2365
  }
2365
- /** Fetches lists of Canvas compositions, optionally by type */
2366
- async getRoute(options) {
2366
+ /**
2367
+ * Resolves a route to a composition, redirect, or not-found result.
2368
+ *
2369
+ * An optional `select` projection applies to the resolved composition when
2370
+ * the route matches one; redirect / notFound responses pass through
2371
+ * untouched.
2372
+ */
2373
+ async get(options) {
2367
2374
  const { projectId } = this.options;
2368
2375
  const { select, ...rest } = options != null ? options : {};
2369
2376
  const rewrittenSelect = projectionToQuery(select);
@@ -2373,6 +2380,10 @@ var RouteClient = class extends ApiClient {
2373
2380
  this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
2374
2381
  );
2375
2382
  }
2383
+ /** @deprecated use {@link RouteClient.get} instead (renamed). */
2384
+ async getRoute(options) {
2385
+ return this.get(options);
2386
+ }
2376
2387
  };
2377
2388
  var getDataSourceVariantFromRouteGetParams = (params, defaultPreviewState) => {
2378
2389
  var _a, _b;
@@ -2677,9 +2688,9 @@ function createLimitPolicy2({
2677
2688
  }
2678
2689
 
2679
2690
  // src/clients/canvas.ts
2680
- var getCanvasClient = (options) => {
2691
+ var buildCanvasClientOptions = (options) => {
2681
2692
  const cache = resolveCanvasCache(options);
2682
- return new CanvasClient({
2693
+ return {
2683
2694
  projectId: env.getProjectId(),
2684
2695
  apiHost: env.getApiHost(),
2685
2696
  apiKey: env.getApiKey(),
@@ -2727,7 +2738,10 @@ var getCanvasClient = (options) => {
2727
2738
  }
2728
2739
  });
2729
2740
  }
2730
- });
2741
+ };
2742
+ };
2743
+ var getCompositionDeliveryClient = (options) => {
2744
+ return new CompositionDeliveryClient(buildCanvasClientOptions(options));
2731
2745
  };
2732
2746
 
2733
2747
  // src/config/helpers.ts
@@ -2950,14 +2964,14 @@ var DefaultDataClient = class {
2950
2964
  if (oldCachedRoute) {
2951
2965
  waitUntil(
2952
2966
  (async () => {
2953
- const result2 = await routeClient.getRoute(route);
2967
+ const result2 = await routeClient.get(route);
2954
2968
  await cacheNewRoute(result2);
2955
2969
  })()
2956
2970
  );
2957
2971
  return oldCachedRoute;
2958
2972
  }
2959
2973
  }
2960
- const result = await routeClient.getRoute(route);
2974
+ const result = await routeClient.get(route);
2961
2975
  waitUntil(
2962
2976
  (async () => {
2963
2977
  await Promise.all([
@@ -5560,7 +5574,6 @@ var retrieveRouteByPath = async ({
5560
5574
  releaseId,
5561
5575
  locale
5562
5576
  }) => {
5563
- var _a;
5564
5577
  return await dataClient.getRoute({
5565
5578
  source: "middleware",
5566
5579
  searchParams,
@@ -5570,7 +5583,6 @@ var retrieveRouteByPath = async ({
5570
5583
  state,
5571
5584
  dataSourceVariant: getDataSourceVariantFromRouteGetParams({}, state),
5572
5585
  withComponentIDs: true,
5573
- withContentSourceMap: (_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing,
5574
5586
  releaseId,
5575
5587
  locale,
5576
5588
  ignoreRedirects: shouldIgnoreRedirects({ state })
@@ -5659,7 +5671,7 @@ var handlePlaygroundRequest = async ({
5659
5671
  { status: 400 }
5660
5672
  );
5661
5673
  }
5662
- const canvasClient = getCanvasClient({
5674
+ const canvasClient = getCompositionDeliveryClient({
5663
5675
  cache: {
5664
5676
  type: "no-cache"
5665
5677
  }
@@ -5669,7 +5681,7 @@ var handlePlaygroundRequest = async ({
5669
5681
  for (let i = 0; i < possibleStates.length; i++) {
5670
5682
  const state = possibleStates[i];
5671
5683
  try {
5672
- composition = await canvasClient.getCompositionById({
5684
+ composition = await canvasClient.get({
5673
5685
  compositionId: id,
5674
5686
  state,
5675
5687
  withComponentIDs: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/next-app-router",
3
- "version": "20.72.3-alpha.2+36e92d30ab",
3
+ "version": "20.72.3-alpha.23+cbe06f1e8a",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "scripts": {
6
6
  "build": "tsup",
@@ -98,12 +98,12 @@
98
98
  "vitest": "4.1.9"
99
99
  },
100
100
  "dependencies": {
101
- "@uniformdev/canvas-react": "20.72.3-alpha.2+36e92d30ab",
102
- "@uniformdev/next-app-router-client": "20.72.3-alpha.2+36e92d30ab",
103
- "@uniformdev/next-app-router-shared": "20.72.3-alpha.2+36e92d30ab",
104
- "@uniformdev/redirect": "20.72.3-alpha.2+36e92d30ab",
105
- "@uniformdev/richtext": "20.72.3-alpha.2+36e92d30ab",
106
- "@uniformdev/webhooks": "20.72.3-alpha.2+36e92d30ab",
101
+ "@uniformdev/canvas-react": "20.72.3-alpha.23+cbe06f1e8a",
102
+ "@uniformdev/next-app-router-client": "20.72.3-alpha.23+cbe06f1e8a",
103
+ "@uniformdev/next-app-router-shared": "20.72.3-alpha.23+cbe06f1e8a",
104
+ "@uniformdev/redirect": "20.72.3-alpha.23+cbe06f1e8a",
105
+ "@uniformdev/richtext": "20.72.3-alpha.23+cbe06f1e8a",
106
+ "@uniformdev/webhooks": "20.72.3-alpha.23+cbe06f1e8a",
107
107
  "@vercel/functions": "^3.7.2",
108
108
  "encoding": "^0.1.13",
109
109
  "server-only": "^0.0.1",
@@ -120,5 +120,5 @@
120
120
  "publishConfig": {
121
121
  "access": "public"
122
122
  },
123
- "gitHead": "36e92d30ab1b97fc68cf16fc22c6f7865ac8ba97"
123
+ "gitHead": "cbe06f1e8a5bb93b0e3cae6b1c8774f21c10506e"
124
124
  }