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

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
  }
@@ -2311,6 +2300,48 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
2311
2300
  _baseUrl = /* @__PURE__ */ new WeakMap();
2312
2301
  __privateAdd3(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
2313
2302
  var _url22;
2303
+ var _NotificationsClient = class _NotificationsClient2 extends ApiClient {
2304
+ constructor(options) {
2305
+ super(options);
2306
+ }
2307
+ /**
2308
+ * Lists notifications for the current user.
2309
+ *
2310
+ * @deprecated This API is experimental and may change without notice.
2311
+ */
2312
+ async list(options) {
2313
+ const fetchUri = this.createUrl(__privateGet3(_NotificationsClient2, _url22), options);
2314
+ return await this.apiClient(fetchUri);
2315
+ }
2316
+ /**
2317
+ * Creates a notification for one or more recipients.
2318
+ *
2319
+ * @deprecated This API is experimental and may change without notice.
2320
+ */
2321
+ async create(body) {
2322
+ const fetchUri = this.createUrl(__privateGet3(_NotificationsClient2, _url22));
2323
+ return await this.apiClient(fetchUri, {
2324
+ method: "POST",
2325
+ body: JSON.stringify(body)
2326
+ });
2327
+ }
2328
+ /**
2329
+ * Updates the read state of the current user's notifications.
2330
+ *
2331
+ * @deprecated This API is experimental and may change without notice.
2332
+ */
2333
+ async setReadState(body) {
2334
+ const fetchUri = this.createUrl(__privateGet3(_NotificationsClient2, _url22));
2335
+ await this.apiClient(fetchUri, {
2336
+ method: "PATCH",
2337
+ body: JSON.stringify(body),
2338
+ expectNoContent: true
2339
+ });
2340
+ }
2341
+ };
2342
+ _url22 = /* @__PURE__ */ new WeakMap();
2343
+ __privateAdd3(_NotificationsClient, _url22, "/api/v1/notifications");
2344
+ var _url32;
2314
2345
  var _projectsUrl;
2315
2346
  var _ProjectClient = class _ProjectClient2 extends ApiClient {
2316
2347
  constructor(options) {
@@ -2318,7 +2349,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
2318
2349
  }
2319
2350
  /** Fetches single Project */
2320
2351
  async get(options) {
2321
- const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22), { ...options });
2352
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url32), { ...options });
2322
2353
  return await this.apiClient(fetchUri);
2323
2354
  }
2324
2355
  /**
@@ -2326,31 +2357,43 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
2326
2357
  * When teamId is provided, returns a single team with its projects.
2327
2358
  * When omitted, returns all accessible teams and their projects.
2328
2359
  */
2329
- async getProjects(options) {
2360
+ async list(options) {
2330
2361
  const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
2331
2362
  return await this.apiClient(fetchUri);
2332
2363
  }
2364
+ /** @deprecated Use {@link list} instead. */
2365
+ async getProjects(options) {
2366
+ return this.list(options);
2367
+ }
2333
2368
  /** Updates or creates (based on id) a Project */
2334
- async upsert(body) {
2335
- const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
2369
+ async save(body) {
2370
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url32));
2336
2371
  return await this.apiClient(fetchUri, {
2337
2372
  method: "PUT",
2338
2373
  body: JSON.stringify({ ...body })
2339
2374
  });
2340
2375
  }
2376
+ /** @deprecated Use {@link save} instead. */
2377
+ async upsert(body) {
2378
+ return this.save(body);
2379
+ }
2341
2380
  /** Deletes a Project */
2342
- async delete(body) {
2343
- const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
2381
+ async remove(body) {
2382
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url32));
2344
2383
  await this.apiClient(fetchUri, {
2345
2384
  method: "DELETE",
2346
2385
  body: JSON.stringify({ ...body }),
2347
2386
  expectNoContent: true
2348
2387
  });
2349
2388
  }
2389
+ /** @deprecated Use {@link remove} instead. */
2390
+ async delete(body) {
2391
+ return this.remove(body);
2392
+ }
2350
2393
  };
2351
- _url22 = /* @__PURE__ */ new WeakMap();
2394
+ _url32 = /* @__PURE__ */ new WeakMap();
2352
2395
  _projectsUrl = /* @__PURE__ */ new WeakMap();
2353
- __privateAdd3(_ProjectClient, _url22, "/api/v1/project");
2396
+ __privateAdd3(_ProjectClient, _url32, "/api/v1/project");
2354
2397
  __privateAdd3(_ProjectClient, _projectsUrl, "/api/v1/projects");
2355
2398
  var ROUTE_URL = "/api/v1/route";
2356
2399
  var RouteClient = class extends ApiClient {
@@ -2362,8 +2405,14 @@ var RouteClient = class extends ApiClient {
2362
2405
  super(options);
2363
2406
  this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
2364
2407
  }
2365
- /** Fetches lists of Canvas compositions, optionally by type */
2366
- async getRoute(options) {
2408
+ /**
2409
+ * Resolves a route to a composition, redirect, or not-found result.
2410
+ *
2411
+ * An optional `select` projection applies to the resolved composition when
2412
+ * the route matches one; redirect / notFound responses pass through
2413
+ * untouched.
2414
+ */
2415
+ async get(options) {
2367
2416
  const { projectId } = this.options;
2368
2417
  const { select, ...rest } = options != null ? options : {};
2369
2418
  const rewrittenSelect = projectionToQuery(select);
@@ -2373,6 +2422,10 @@ var RouteClient = class extends ApiClient {
2373
2422
  this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
2374
2423
  );
2375
2424
  }
2425
+ /** @deprecated use {@link RouteClient.get} instead (renamed). */
2426
+ async getRoute(options) {
2427
+ return this.get(options);
2428
+ }
2376
2429
  };
2377
2430
  var getDataSourceVariantFromRouteGetParams = (params, defaultPreviewState) => {
2378
2431
  var _a, _b;
@@ -2677,9 +2730,9 @@ function createLimitPolicy2({
2677
2730
  }
2678
2731
 
2679
2732
  // src/clients/canvas.ts
2680
- var getCanvasClient = (options) => {
2733
+ var buildCanvasClientOptions = (options) => {
2681
2734
  const cache = resolveCanvasCache(options);
2682
- return new CanvasClient({
2735
+ return {
2683
2736
  projectId: env.getProjectId(),
2684
2737
  apiHost: env.getApiHost(),
2685
2738
  apiKey: env.getApiKey(),
@@ -2727,7 +2780,10 @@ var getCanvasClient = (options) => {
2727
2780
  }
2728
2781
  });
2729
2782
  }
2730
- });
2783
+ };
2784
+ };
2785
+ var getCompositionDeliveryClient = (options) => {
2786
+ return new CompositionDeliveryClient(buildCanvasClientOptions(options));
2731
2787
  };
2732
2788
 
2733
2789
  // src/config/helpers.ts
@@ -2950,14 +3006,14 @@ var DefaultDataClient = class {
2950
3006
  if (oldCachedRoute) {
2951
3007
  waitUntil(
2952
3008
  (async () => {
2953
- const result2 = await routeClient.getRoute(route);
3009
+ const result2 = await routeClient.get(route);
2954
3010
  await cacheNewRoute(result2);
2955
3011
  })()
2956
3012
  );
2957
3013
  return oldCachedRoute;
2958
3014
  }
2959
3015
  }
2960
- const result = await routeClient.getRoute(route);
3016
+ const result = await routeClient.get(route);
2961
3017
  waitUntil(
2962
3018
  (async () => {
2963
3019
  await Promise.all([
@@ -5560,7 +5616,6 @@ var retrieveRouteByPath = async ({
5560
5616
  releaseId,
5561
5617
  locale
5562
5618
  }) => {
5563
- var _a;
5564
5619
  return await dataClient.getRoute({
5565
5620
  source: "middleware",
5566
5621
  searchParams,
@@ -5570,7 +5625,6 @@ var retrieveRouteByPath = async ({
5570
5625
  state,
5571
5626
  dataSourceVariant: getDataSourceVariantFromRouteGetParams({}, state),
5572
5627
  withComponentIDs: true,
5573
- withContentSourceMap: (_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing,
5574
5628
  releaseId,
5575
5629
  locale,
5576
5630
  ignoreRedirects: shouldIgnoreRedirects({ state })
@@ -5659,7 +5713,7 @@ var handlePlaygroundRequest = async ({
5659
5713
  { status: 400 }
5660
5714
  );
5661
5715
  }
5662
- const canvasClient = getCanvasClient({
5716
+ const canvasClient = getCompositionDeliveryClient({
5663
5717
  cache: {
5664
5718
  type: "no-cache"
5665
5719
  }
@@ -5669,7 +5723,7 @@ var handlePlaygroundRequest = async ({
5669
5723
  for (let i = 0; i < possibleStates.length; i++) {
5670
5724
  const state = possibleStates[i];
5671
5725
  try {
5672
- composition = await canvasClient.getCompositionById({
5726
+ composition = await canvasClient.get({
5673
5727
  compositionId: id,
5674
5728
  state,
5675
5729
  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.25+cd10fe6e1e",
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.25+cd10fe6e1e",
102
+ "@uniformdev/next-app-router-client": "20.72.3-alpha.25+cd10fe6e1e",
103
+ "@uniformdev/next-app-router-shared": "20.72.3-alpha.25+cd10fe6e1e",
104
+ "@uniformdev/redirect": "20.72.3-alpha.25+cd10fe6e1e",
105
+ "@uniformdev/richtext": "20.72.3-alpha.25+cd10fe6e1e",
106
+ "@uniformdev/webhooks": "20.72.3-alpha.25+cd10fe6e1e",
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": "cd10fe6e1e8877ed1ec45290d74ac160d597e84e"
124
124
  }