@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.
package/dist/index.js CHANGED
@@ -408,6 +408,7 @@ __export(index_exports, {
408
408
  expireMiddlewareCacheTag: () => expireMiddlewareCacheTag,
409
409
  findRouteMatch: () => findRouteMatch,
410
410
  getCanvasClient: () => getCanvasClient,
411
+ getCompositionDeliveryClient: () => getCompositionDeliveryClient,
411
412
  getManifest: () => getManifest,
412
413
  getManifestClient: () => getManifestClient,
413
414
  getProjectMapClient: () => getProjectMapClient,
@@ -435,6 +436,7 @@ var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cann
435
436
  var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
436
437
  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);
437
438
  var defaultLimitPolicy = (0, import_p_limit.default)(6);
439
+ var UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE = "Bearer token not valid or expired";
438
440
  var ApiClientError = class _ApiClientError extends Error {
439
441
  constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
440
442
  super(
@@ -450,6 +452,12 @@ var ApiClientError = class _ApiClientError extends Error {
450
452
  Object.setPrototypeOf(this, _ApiClientError.prototype);
451
453
  }
452
454
  };
455
+ var BearerTokenNotValidOrExpiredError = class _BearerTokenNotValidOrExpiredError extends ApiClientError {
456
+ constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
457
+ super(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId);
458
+ Object.setPrototypeOf(this, _BearerTokenNotValidOrExpiredError.prototype);
459
+ }
460
+ };
453
461
  var ApiClient = class _ApiClient {
454
462
  constructor(options) {
455
463
  __publicField2(this, "options");
@@ -483,7 +491,7 @@ var ApiClient = class _ApiClient {
483
491
  }
484
492
  async apiClientWithResponse(fetchUri, options) {
485
493
  return this.options.limitPolicy(async () => {
486
- var _a;
494
+ var _a, _b;
487
495
  const coreHeaders = this.options.apiKey ? {
488
496
  "x-api-key": this.options.apiKey
489
497
  } : {
@@ -519,9 +527,19 @@ var ApiClient = class _ApiClient {
519
527
  } catch (e) {
520
528
  message = `General error`;
521
529
  }
530
+ if (apiResponse.status === 401 && message === UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE) {
531
+ throw new BearerTokenNotValidOrExpiredError(
532
+ message,
533
+ (_a = options == null ? void 0 : options.method) != null ? _a : "GET",
534
+ fetchUri.toString(),
535
+ apiResponse.status,
536
+ apiResponse.statusText,
537
+ _ApiClient.getRequestId(apiResponse)
538
+ );
539
+ }
522
540
  throw new ApiClientError(
523
541
  message,
524
- (_a = options == null ? void 0 : options.method) != null ? _a : "GET",
542
+ (_b = options == null ? void 0 : options.method) != null ? _b : "GET",
525
543
  fetchUri.toString(),
526
544
  apiResponse.status,
527
545
  apiResponse.statusText,
@@ -1225,6 +1243,16 @@ function createLimitPolicy({
1225
1243
  return currentFunc();
1226
1244
  };
1227
1245
  }
1246
+ var ContentClientBase = class extends ApiClient {
1247
+ constructor(options, defaultBypassCache) {
1248
+ var _a, _b;
1249
+ super({
1250
+ ...options,
1251
+ limitPolicy: (_a = options.limitPolicy) != null ? _a : createLimitPolicy({}),
1252
+ bypassCache: (_b = options.bypassCache) != null ? _b : defaultBypassCache
1253
+ });
1254
+ }
1255
+ };
1228
1256
  var SELECT_QUERY_PREFIX = "select.";
1229
1257
  function appendCsv(out, key, values) {
1230
1258
  if (values === void 0) {
@@ -1269,7 +1297,105 @@ function projectionToQuery(spec) {
1269
1297
  }
1270
1298
  return out;
1271
1299
  }
1272
- var CANVAS_URL = "/api/v1/canvas";
1300
+ var CANVAS_PERSONALIZE_TYPE = "$personalization";
1301
+ var CANVAS_TEST_TYPE = "$test";
1302
+ var CANVAS_BLOCK_PARAM_TYPE = "$block";
1303
+ var CANVAS_PERSONALIZE_SLOT = "pz";
1304
+ var CANVAS_TEST_SLOT = "test";
1305
+ var CANVAS_DRAFT_STATE = 0;
1306
+ var CANVAS_PUBLISHED_STATE = 64;
1307
+ var CANVAS_EDITOR_STATE = 63;
1308
+ var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
1309
+ var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
1310
+ var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
1311
+ var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
1312
+ var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
1313
+ var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
1314
+ var CANVAS_CONTEXTUAL_EDITING_PARAM = "$contextualEditing";
1315
+ var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
1316
+ var PLACEHOLDER_ID = "placeholder";
1317
+ var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
1318
+ function resolveCompositionSelector(args) {
1319
+ if ("compositionId" in args) {
1320
+ const { compositionId, editionId, versionId, ...readOptions } = args;
1321
+ return {
1322
+ readOptions,
1323
+ // raw mode matches on composition OR edition id via the compositionId param
1324
+ compositionId: editionId != null ? editionId : compositionId,
1325
+ versionId,
1326
+ hasCompositionId: true,
1327
+ pinnedEdition: editionId !== void 0
1328
+ };
1329
+ }
1330
+ return { readOptions: args, hasCompositionId: false, pinnedEdition: false };
1331
+ }
1332
+ var DEFAULT_EDGE_API_HOST = "https://uniform.global";
1333
+ var DeliveryClientBase = class extends ContentClientBase {
1334
+ constructor(options) {
1335
+ var _a;
1336
+ super(
1337
+ options,
1338
+ /* defaultBypassCache */
1339
+ false
1340
+ );
1341
+ this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : DEFAULT_EDGE_API_HOST;
1342
+ this.edgeRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
1343
+ }
1344
+ /** Coerces the `diagnostics` option into the shape the edge endpoints accept. */
1345
+ coerceDiagnostics(diagnostics) {
1346
+ return typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0;
1347
+ }
1348
+ };
1349
+ var EDGE_SINGLE_URL = "/api/v1/composition";
1350
+ var EDGE_LIST_URL = "/api/v1/compositions";
1351
+ var CompositionDeliveryClient = class extends DeliveryClientBase {
1352
+ constructor(options) {
1353
+ super(options);
1354
+ }
1355
+ /** Fetches exactly one composition (throws `ApiClientError(404)` if absent). */
1356
+ get(args) {
1357
+ var _a;
1358
+ const { diagnostics, select, ...rest } = args;
1359
+ const { readOptions, compositionId, versionId, pinnedEdition } = resolveCompositionSelector(rest);
1360
+ const url = this.createUrl(
1361
+ EDGE_SINGLE_URL,
1362
+ {
1363
+ ...readOptions,
1364
+ ...projectionToQuery(select),
1365
+ // A pinned edition is folded into compositionId (raw matches edition or
1366
+ // composition id); there is no editionId query param on this endpoint.
1367
+ compositionId,
1368
+ versionId,
1369
+ projectId: this.options.projectId,
1370
+ state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
1371
+ // editionId pins a specific edition for preview; otherwise locale-best.
1372
+ editions: pinnedEdition ? "raw" : "auto",
1373
+ diagnostics: this.coerceDiagnostics(diagnostics)
1374
+ },
1375
+ this.edgeApiHost
1376
+ );
1377
+ return this.apiClient(url, this.edgeRequestInit);
1378
+ }
1379
+ /** Fetches a list of compositions, optionally filtered. */
1380
+ list(args = {}) {
1381
+ var _a;
1382
+ const { diagnostics, filters, select, ...rest } = args;
1383
+ const url = this.createUrl(
1384
+ EDGE_LIST_URL,
1385
+ {
1386
+ ...rest,
1387
+ ...rewriteFiltersForApi(filters),
1388
+ ...projectionToQuery(select),
1389
+ projectId: this.options.projectId,
1390
+ state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
1391
+ diagnostics: this.coerceDiagnostics(diagnostics)
1392
+ },
1393
+ this.edgeApiHost
1394
+ );
1395
+ return this.apiClient(url, this.edgeRequestInit);
1396
+ }
1397
+ };
1398
+ var CANVAS_URL2 = "/api/v1/canvas";
1273
1399
  var CanvasClient = class extends ApiClient {
1274
1400
  constructor(options) {
1275
1401
  var _a;
@@ -1287,7 +1413,7 @@ var CanvasClient = class extends ApiClient {
1287
1413
  const rewrittenFilters = rewriteFiltersForApi(filters);
1288
1414
  const rewrittenSelect = projectionToQuery(select);
1289
1415
  if (!resolveData) {
1290
- const fetchUri = this.createUrl(CANVAS_URL, {
1416
+ const fetchUri = this.createUrl(CANVAS_URL2, {
1291
1417
  ...originParams,
1292
1418
  projectId,
1293
1419
  ...rewrittenFilters,
@@ -1335,7 +1461,7 @@ var CanvasClient = class extends ApiClient {
1335
1461
  }) {
1336
1462
  const { projectId } = this.options;
1337
1463
  if (skipDataResolution) {
1338
- return this.apiClient(this.createUrl(CANVAS_URL, { ...params, projectId }));
1464
+ return this.apiClient(this.createUrl(CANVAS_URL2, { ...params, projectId }));
1339
1465
  }
1340
1466
  const edgeParams = {
1341
1467
  ...params,
@@ -1347,7 +1473,7 @@ var CanvasClient = class extends ApiClient {
1347
1473
  }
1348
1474
  /** Updates or creates a Canvas component definition */
1349
1475
  async updateComposition(body, options) {
1350
- const fetchUri = this.createUrl(CANVAS_URL);
1476
+ const fetchUri = this.createUrl(CANVAS_URL2);
1351
1477
  const headers = {};
1352
1478
  if (options == null ? void 0 : options.ifUnmodifiedSince) {
1353
1479
  headers["x-if-unmodified-since"] = options.ifUnmodifiedSince;
@@ -1362,7 +1488,7 @@ var CanvasClient = class extends ApiClient {
1362
1488
  }
1363
1489
  /** Deletes a Canvas component definition */
1364
1490
  async removeComposition(body) {
1365
- const fetchUri = this.createUrl(CANVAS_URL);
1491
+ const fetchUri = this.createUrl(CANVAS_URL2);
1366
1492
  const { projectId } = this.options;
1367
1493
  await this.apiClient(fetchUri, {
1368
1494
  method: "DELETE",
@@ -1501,14 +1627,18 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
1501
1627
  constructor(options) {
1502
1628
  super(options);
1503
1629
  }
1504
- /** Fetches all DataTypes for a project */
1505
- async get(options) {
1630
+ /** Fetches a list of DataTypes for a project */
1631
+ async list(options) {
1506
1632
  const { projectId } = this.options;
1507
1633
  const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8), { ...options, projectId });
1508
1634
  return await this.apiClient(fetchUri);
1509
1635
  }
1636
+ /** @deprecated Use {@link list} instead. */
1637
+ async get(options) {
1638
+ return this.list(options);
1639
+ }
1510
1640
  /** Updates or creates (based on id) a DataType */
1511
- async upsert(body) {
1641
+ async save(body) {
1512
1642
  const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
1513
1643
  await this.apiClient(fetchUri, {
1514
1644
  method: "PUT",
@@ -1516,6 +1646,10 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
1516
1646
  expectNoContent: true
1517
1647
  });
1518
1648
  }
1649
+ /** @deprecated Use {@link save} instead. */
1650
+ async upsert(body) {
1651
+ return this.save(body);
1652
+ }
1519
1653
  /** Deletes a DataType */
1520
1654
  async remove(body) {
1521
1655
  const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
@@ -1553,24 +1687,6 @@ function getComponentPath(ancestorsAndSelf) {
1553
1687
  }
1554
1688
  return `.${path.join(".")}`;
1555
1689
  }
1556
- var CANVAS_PERSONALIZE_TYPE = "$personalization";
1557
- var CANVAS_TEST_TYPE = "$test";
1558
- var CANVAS_BLOCK_PARAM_TYPE = "$block";
1559
- var CANVAS_PERSONALIZE_SLOT = "pz";
1560
- var CANVAS_TEST_SLOT = "test";
1561
- var CANVAS_DRAFT_STATE = 0;
1562
- var CANVAS_PUBLISHED_STATE = 64;
1563
- var CANVAS_EDITOR_STATE = 63;
1564
- var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
1565
- var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
1566
- var CANVAS_ENRICHMENT_TAG_PARAM = "$enr";
1567
- var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
1568
- var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
1569
- var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
1570
- var CANVAS_CONTEXTUAL_EDITING_PARAM = "$contextualEditing";
1571
- var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
1572
- var PLACEHOLDER_ID = "placeholder";
1573
- var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
1574
1690
  function isRootEntryReference(root) {
1575
1691
  return root.type === "root" && isEntryData(root.node);
1576
1692
  }
@@ -1590,9 +1706,9 @@ function parseVariableExpression(serialized, onToken) {
1590
1706
  let bufferStartIndex = 0;
1591
1707
  let bufferEndIndex = 0;
1592
1708
  let tokenCount = 0;
1593
- const handleToken = (token, type) => {
1709
+ const handleToken = (token, type, offset) => {
1594
1710
  tokenCount++;
1595
- return onToken == null ? void 0 : onToken(token, type);
1711
+ return onToken == null ? void 0 : onToken(token, type, offset);
1596
1712
  };
1597
1713
  let state = "text";
1598
1714
  for (let index = 0; index < serialized.length; index++) {
@@ -1603,7 +1719,7 @@ function parseVariableExpression(serialized, onToken) {
1603
1719
  if (char === variablePrefix[0] && serialized[index + 1] === variablePrefix[1]) {
1604
1720
  if (serialized[index - 1] === escapeCharacter) {
1605
1721
  bufferEndIndex -= escapeCharacter.length;
1606
- if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
1722
+ if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text", bufferStartIndex) === false) {
1607
1723
  return tokenCount;
1608
1724
  }
1609
1725
  bufferStartIndex = index;
@@ -1612,12 +1728,12 @@ function parseVariableExpression(serialized, onToken) {
1612
1728
  }
1613
1729
  if (state === "variable") {
1614
1730
  const textStart = bufferStartIndex - variablePrefix.length;
1615
- if (handleToken(serialized.substring(textStart, bufferEndIndex), "text") === false) {
1731
+ if (handleToken(serialized.substring(textStart, bufferEndIndex), "text", textStart) === false) {
1616
1732
  return tokenCount;
1617
1733
  }
1618
1734
  bufferStartIndex = bufferEndIndex;
1619
1735
  } else if (bufferEndIndex > bufferStartIndex) {
1620
- if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
1736
+ if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text", bufferStartIndex) === false) {
1621
1737
  return tokenCount;
1622
1738
  }
1623
1739
  bufferStartIndex = bufferEndIndex;
@@ -1635,7 +1751,7 @@ function parseVariableExpression(serialized, onToken) {
1635
1751
  state = "text";
1636
1752
  if (bufferEndIndex > bufferStartIndex) {
1637
1753
  const unescapedVariableName = serialized.substring(bufferStartIndex, bufferEndIndex).replace(/\\([${}])/g, "$1");
1638
- if (handleToken(unescapedVariableName, "variable") === false) {
1754
+ if (handleToken(unescapedVariableName, "variable", bufferStartIndex) === false) {
1639
1755
  return tokenCount;
1640
1756
  }
1641
1757
  bufferStartIndex = bufferEndIndex + variableSuffix.length;
@@ -1649,7 +1765,7 @@ function parseVariableExpression(serialized, onToken) {
1649
1765
  bufferStartIndex -= variablePrefix.length;
1650
1766
  }
1651
1767
  if (bufferStartIndex < serialized.length) {
1652
- handleToken(serialized.substring(bufferStartIndex), state);
1768
+ handleToken(serialized.substring(bufferStartIndex), state, bufferStartIndex);
1653
1769
  }
1654
1770
  return tokenCount;
1655
1771
  }
@@ -2012,6 +2128,48 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
2012
2128
  _baseUrl = /* @__PURE__ */ new WeakMap();
2013
2129
  __privateAdd3(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
2014
2130
  var _url22;
2131
+ var _NotificationsClient = class _NotificationsClient2 extends ApiClient {
2132
+ constructor(options) {
2133
+ super(options);
2134
+ }
2135
+ /**
2136
+ * Lists notifications for the current user.
2137
+ *
2138
+ * @deprecated This API is experimental and may change without notice.
2139
+ */
2140
+ async list(options) {
2141
+ const fetchUri = this.createUrl(__privateGet3(_NotificationsClient2, _url22), options);
2142
+ return await this.apiClient(fetchUri);
2143
+ }
2144
+ /**
2145
+ * Creates a notification for one or more recipients.
2146
+ *
2147
+ * @deprecated This API is experimental and may change without notice.
2148
+ */
2149
+ async create(body) {
2150
+ const fetchUri = this.createUrl(__privateGet3(_NotificationsClient2, _url22));
2151
+ return await this.apiClient(fetchUri, {
2152
+ method: "POST",
2153
+ body: JSON.stringify(body)
2154
+ });
2155
+ }
2156
+ /**
2157
+ * Updates the read state of the current user's notifications.
2158
+ *
2159
+ * @deprecated This API is experimental and may change without notice.
2160
+ */
2161
+ async setReadState(body) {
2162
+ const fetchUri = this.createUrl(__privateGet3(_NotificationsClient2, _url22));
2163
+ await this.apiClient(fetchUri, {
2164
+ method: "PATCH",
2165
+ body: JSON.stringify(body),
2166
+ expectNoContent: true
2167
+ });
2168
+ }
2169
+ };
2170
+ _url22 = /* @__PURE__ */ new WeakMap();
2171
+ __privateAdd3(_NotificationsClient, _url22, "/api/v1/notifications");
2172
+ var _url32;
2015
2173
  var _projectsUrl;
2016
2174
  var _ProjectClient = class _ProjectClient2 extends ApiClient {
2017
2175
  constructor(options) {
@@ -2019,7 +2177,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
2019
2177
  }
2020
2178
  /** Fetches single Project */
2021
2179
  async get(options) {
2022
- const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22), { ...options });
2180
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url32), { ...options });
2023
2181
  return await this.apiClient(fetchUri);
2024
2182
  }
2025
2183
  /**
@@ -2027,31 +2185,43 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
2027
2185
  * When teamId is provided, returns a single team with its projects.
2028
2186
  * When omitted, returns all accessible teams and their projects.
2029
2187
  */
2030
- async getProjects(options) {
2188
+ async list(options) {
2031
2189
  const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
2032
2190
  return await this.apiClient(fetchUri);
2033
2191
  }
2192
+ /** @deprecated Use {@link list} instead. */
2193
+ async getProjects(options) {
2194
+ return this.list(options);
2195
+ }
2034
2196
  /** Updates or creates (based on id) a Project */
2035
- async upsert(body) {
2036
- const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
2197
+ async save(body) {
2198
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url32));
2037
2199
  return await this.apiClient(fetchUri, {
2038
2200
  method: "PUT",
2039
2201
  body: JSON.stringify({ ...body })
2040
2202
  });
2041
2203
  }
2204
+ /** @deprecated Use {@link save} instead. */
2205
+ async upsert(body) {
2206
+ return this.save(body);
2207
+ }
2042
2208
  /** Deletes a Project */
2043
- async delete(body) {
2044
- const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
2209
+ async remove(body) {
2210
+ const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url32));
2045
2211
  await this.apiClient(fetchUri, {
2046
2212
  method: "DELETE",
2047
2213
  body: JSON.stringify({ ...body }),
2048
2214
  expectNoContent: true
2049
2215
  });
2050
2216
  }
2217
+ /** @deprecated Use {@link remove} instead. */
2218
+ async delete(body) {
2219
+ return this.remove(body);
2220
+ }
2051
2221
  };
2052
- _url22 = /* @__PURE__ */ new WeakMap();
2222
+ _url32 = /* @__PURE__ */ new WeakMap();
2053
2223
  _projectsUrl = /* @__PURE__ */ new WeakMap();
2054
- __privateAdd3(_ProjectClient, _url22, "/api/v1/project");
2224
+ __privateAdd3(_ProjectClient, _url32, "/api/v1/project");
2055
2225
  __privateAdd3(_ProjectClient, _projectsUrl, "/api/v1/projects");
2056
2226
  var ROUTE_URL = "/api/v1/route";
2057
2227
  var RouteClient = class extends ApiClient {
@@ -2063,8 +2233,14 @@ var RouteClient = class extends ApiClient {
2063
2233
  super(options);
2064
2234
  this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
2065
2235
  }
2066
- /** Fetches lists of Canvas compositions, optionally by type */
2067
- async getRoute(options) {
2236
+ /**
2237
+ * Resolves a route to a composition, redirect, or not-found result.
2238
+ *
2239
+ * An optional `select` projection applies to the resolved composition when
2240
+ * the route matches one; redirect / notFound responses pass through
2241
+ * untouched.
2242
+ */
2243
+ async get(options) {
2068
2244
  const { projectId } = this.options;
2069
2245
  const { select, ...rest } = options != null ? options : {};
2070
2246
  const rewrittenSelect = projectionToQuery(select);
@@ -2074,6 +2250,10 @@ var RouteClient = class extends ApiClient {
2074
2250
  this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
2075
2251
  );
2076
2252
  }
2253
+ /** @deprecated use {@link RouteClient.get} instead (renamed). */
2254
+ async getRoute(options) {
2255
+ return this.get(options);
2256
+ }
2077
2257
  };
2078
2258
  var getDataSourceVariantFromRouteGetParams = (params, defaultPreviewState) => {
2079
2259
  var _a, _b;
@@ -2380,9 +2560,9 @@ function createLimitPolicy2({
2380
2560
  }
2381
2561
 
2382
2562
  // src/clients/canvas.ts
2383
- var getCanvasClient = (options) => {
2563
+ var buildCanvasClientOptions = (options) => {
2384
2564
  const cache2 = resolveCanvasCache(options);
2385
- return new CanvasClient({
2565
+ return {
2386
2566
  projectId: env.getProjectId(),
2387
2567
  apiHost: env.getApiHost(),
2388
2568
  apiKey: env.getApiKey(),
@@ -2430,7 +2610,13 @@ var getCanvasClient = (options) => {
2430
2610
  }
2431
2611
  });
2432
2612
  }
2433
- });
2613
+ };
2614
+ };
2615
+ var getCanvasClient = (options) => {
2616
+ return new CanvasClient(buildCanvasClientOptions(options));
2617
+ };
2618
+ var getCompositionDeliveryClient = (options) => {
2619
+ return new CompositionDeliveryClient(buildCanvasClientOptions(options));
2434
2620
  };
2435
2621
 
2436
2622
  // src/clients/manifest.ts
@@ -2739,18 +2925,15 @@ var _Route = class _Route2 {
2739
2925
  */
2740
2926
  static splitFragment(path) {
2741
2927
  let fragmentIndex = -1;
2742
- let length = 0;
2743
- parseVariableExpression(path, (token, type) => {
2928
+ parseVariableExpression(path, (token, type, offset) => {
2744
2929
  if (type === "variable") {
2745
- length += createVariableReference(token).length;
2746
2930
  return;
2747
2931
  }
2748
2932
  const hashOffset = token.indexOf("#");
2749
2933
  if (hashOffset === -1) {
2750
- length += token.length;
2751
2934
  return;
2752
2935
  }
2753
- fragmentIndex = length + hashOffset;
2936
+ fragmentIndex = offset + hashOffset;
2754
2937
  return false;
2755
2938
  });
2756
2939
  if (fragmentIndex === -1) {
@@ -3467,14 +3650,14 @@ var import_react7 = __toESM(require("react"));
3467
3650
  var import_next_app_router_shared5 = require("@uniformdev/next-app-router-shared");
3468
3651
  var resolvePlaygroundRoute = async ({ code }) => {
3469
3652
  const pageState = (0, import_next_app_router_shared5.deserializeEvaluationResult)({ input: code });
3470
- const canvasClient = getCanvasClient({
3653
+ const canvasClient = getCompositionDeliveryClient({
3471
3654
  cache: {
3472
3655
  type: "no-cache"
3473
3656
  }
3474
3657
  });
3475
3658
  let composition = void 0;
3476
3659
  try {
3477
- composition = await canvasClient.getCompositionById({
3660
+ composition = await canvasClient.get({
3478
3661
  compositionId: pageState.routePath,
3479
3662
  state: pageState.compositionState,
3480
3663
  withComponentIDs: true
@@ -3620,7 +3803,7 @@ var createUniformPlaygroundStaticParams = async (options) => {
3620
3803
  const routeClient = getRouteClient({
3621
3804
  state
3622
3805
  });
3623
- route = await routeClient.getRoute({
3806
+ route = await routeClient.get({
3624
3807
  path: firstPath,
3625
3808
  withComponentIDs: true,
3626
3809
  state: CANVAS_DRAFT_STATE
@@ -3673,7 +3856,7 @@ async function processRoutePath({
3673
3856
  });
3674
3857
  const rewrittenPath = await (rewrite == null ? void 0 : rewrite({ path }));
3675
3858
  const resolvedPath = (_a = rewrittenPath == null ? void 0 : rewrittenPath.path) != null ? _a : path;
3676
- const route = await routeClient.getRoute({
3859
+ const route = await routeClient.get({
3677
3860
  path: resolvedPath,
3678
3861
  withComponentIDs: true,
3679
3862
  state: CANVAS_PUBLISHED_STATE
@@ -3926,14 +4109,14 @@ var DefaultDataClient = class {
3926
4109
  if (oldCachedRoute) {
3927
4110
  (0, import_functions.waitUntil)(
3928
4111
  (async () => {
3929
- const result2 = await routeClient.getRoute(route);
4112
+ const result2 = await routeClient.get(route);
3930
4113
  await cacheNewRoute(result2);
3931
4114
  })()
3932
4115
  );
3933
4116
  return oldCachedRoute;
3934
4117
  }
3935
4118
  }
3936
- const result = await routeClient.getRoute(route);
4119
+ const result = await routeClient.get(route);
3937
4120
  (0, import_functions.waitUntil)(
3938
4121
  (async () => {
3939
4122
  await Promise.all([
@@ -4203,6 +4386,7 @@ var createCompositionCache = () => {
4203
4386
  expireMiddlewareCacheTag,
4204
4387
  findRouteMatch,
4205
4388
  getCanvasClient,
4389
+ getCompositionDeliveryClient,
4206
4390
  getManifest,
4207
4391
  getManifestClient,
4208
4392
  getProjectMapClient,