@uniformdev/next-app-router 20.72.2 → 20.72.3-alpha.14
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/cache.js +95 -23
- package/dist/cache.mjs +95 -23
- package/dist/component.js +92 -30
- package/dist/component.mjs +78 -16
- package/dist/handler.js +182 -155
- package/dist/handler.mjs +182 -155
- package/dist/index.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.esm.js +223 -57
- package/dist/index.js +224 -57
- package/dist/index.mjs +223 -57
- package/dist/middleware.js +200 -163
- package/dist/middleware.mjs +200 -163
- package/package.json +8 -8
package/dist/middleware.mjs
CHANGED
|
@@ -1381,6 +1381,16 @@ function createLimitPolicy({
|
|
|
1381
1381
|
return currentFunc();
|
|
1382
1382
|
};
|
|
1383
1383
|
}
|
|
1384
|
+
var ContentClientBase = class extends ApiClient {
|
|
1385
|
+
constructor(options, defaultBypassCache) {
|
|
1386
|
+
var _a, _b;
|
|
1387
|
+
super({
|
|
1388
|
+
...options,
|
|
1389
|
+
limitPolicy: (_a = options.limitPolicy) != null ? _a : createLimitPolicy({}),
|
|
1390
|
+
bypassCache: (_b = options.bypassCache) != null ? _b : defaultBypassCache
|
|
1391
|
+
});
|
|
1392
|
+
}
|
|
1393
|
+
};
|
|
1384
1394
|
var SELECT_QUERY_PREFIX = "select.";
|
|
1385
1395
|
function appendCsv(out, key, values) {
|
|
1386
1396
|
if (values === void 0) {
|
|
@@ -1425,130 +1435,100 @@ function projectionToQuery(spec) {
|
|
|
1425
1435
|
}
|
|
1426
1436
|
return out;
|
|
1427
1437
|
}
|
|
1428
|
-
var
|
|
1429
|
-
var
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
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
|
|
1438
|
+
var CANVAS_PERSONALIZE_TYPE = "$personalization";
|
|
1439
|
+
var CANVAS_TEST_TYPE = "$test";
|
|
1440
|
+
var CANVAS_BLOCK_PARAM_TYPE = "$block";
|
|
1441
|
+
var CANVAS_PERSONALIZE_SLOT = "pz";
|
|
1442
|
+
var CANVAS_TEST_SLOT = "test";
|
|
1443
|
+
var CANVAS_DRAFT_STATE = 0;
|
|
1444
|
+
var CANVAS_PUBLISHED_STATE = 64;
|
|
1445
|
+
var CANVAS_EDITOR_STATE = 63;
|
|
1446
|
+
var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
|
|
1447
|
+
var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
|
|
1448
|
+
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1449
|
+
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1450
|
+
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1451
|
+
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1452
|
+
var IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM = "is_incontext_editing_forced_settings";
|
|
1453
|
+
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1454
|
+
function resolveCompositionSelector(args) {
|
|
1455
|
+
if ("compositionId" in args) {
|
|
1456
|
+
const { compositionId, editionId, versionId, ...readOptions } = args;
|
|
1457
|
+
return {
|
|
1458
|
+
readOptions,
|
|
1459
|
+
// raw mode matches on composition OR edition id via the compositionId param
|
|
1460
|
+
compositionId: editionId != null ? editionId : compositionId,
|
|
1461
|
+
versionId,
|
|
1462
|
+
hasCompositionId: true,
|
|
1463
|
+
pinnedEdition: editionId !== void 0
|
|
1500
1464
|
};
|
|
1501
|
-
const edgeUrl = this.createUrl("/api/v1/composition", edgeParams, this.edgeApiHost);
|
|
1502
|
-
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
1503
1465
|
}
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
}
|
|
1517
|
-
return { modified: response.headers.get("x-modified-at") };
|
|
1466
|
+
return { readOptions: args, hasCompositionId: false, pinnedEdition: false };
|
|
1467
|
+
}
|
|
1468
|
+
var DEFAULT_EDGE_API_HOST = "https://uniform.global";
|
|
1469
|
+
var DeliveryClientBase = class extends ContentClientBase {
|
|
1470
|
+
constructor(options) {
|
|
1471
|
+
var _a;
|
|
1472
|
+
super(
|
|
1473
|
+
options,
|
|
1474
|
+
/* defaultBypassCache */
|
|
1475
|
+
false
|
|
1476
|
+
);
|
|
1477
|
+
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : DEFAULT_EDGE_API_HOST;
|
|
1478
|
+
this.edgeRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
|
|
1518
1479
|
}
|
|
1519
|
-
/**
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
const { projectId } = this.options;
|
|
1523
|
-
await this.apiClient(fetchUri, {
|
|
1524
|
-
method: "DELETE",
|
|
1525
|
-
body: JSON.stringify({ ...body, projectId }),
|
|
1526
|
-
expectNoContent: true
|
|
1527
|
-
});
|
|
1480
|
+
/** Coerces the `diagnostics` option into the shape the edge endpoints accept. */
|
|
1481
|
+
coerceDiagnostics(diagnostics) {
|
|
1482
|
+
return typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0;
|
|
1528
1483
|
}
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1484
|
+
};
|
|
1485
|
+
var EDGE_SINGLE_URL = "/api/v1/composition";
|
|
1486
|
+
var EDGE_LIST_URL = "/api/v1/compositions";
|
|
1487
|
+
var CompositionDeliveryClient = class extends DeliveryClientBase {
|
|
1488
|
+
constructor(options) {
|
|
1489
|
+
super(options);
|
|
1534
1490
|
}
|
|
1535
|
-
/**
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1491
|
+
/** Fetches exactly one composition (throws `ApiClientError(404)` if absent). */
|
|
1492
|
+
get(args) {
|
|
1493
|
+
var _a;
|
|
1494
|
+
const { diagnostics, select, ...rest } = args;
|
|
1495
|
+
const { readOptions, compositionId, versionId, pinnedEdition } = resolveCompositionSelector(rest);
|
|
1496
|
+
const url = this.createUrl(
|
|
1497
|
+
EDGE_SINGLE_URL,
|
|
1498
|
+
{
|
|
1499
|
+
...readOptions,
|
|
1500
|
+
...projectionToQuery(select),
|
|
1501
|
+
// A pinned edition is folded into compositionId (raw matches edition or
|
|
1502
|
+
// composition id); there is no editionId query param on this endpoint.
|
|
1503
|
+
compositionId,
|
|
1504
|
+
versionId,
|
|
1505
|
+
projectId: this.options.projectId,
|
|
1506
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
1507
|
+
// editionId pins a specific edition for preview; otherwise locale-best.
|
|
1508
|
+
editions: pinnedEdition ? "raw" : "auto",
|
|
1509
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
1510
|
+
},
|
|
1511
|
+
this.edgeApiHost
|
|
1512
|
+
);
|
|
1513
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
1543
1514
|
}
|
|
1544
|
-
/**
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1515
|
+
/** Fetches a list of compositions, optionally filtered. */
|
|
1516
|
+
list(args = {}) {
|
|
1517
|
+
var _a;
|
|
1518
|
+
const { diagnostics, filters, select, ...rest } = args;
|
|
1519
|
+
const url = this.createUrl(
|
|
1520
|
+
EDGE_LIST_URL,
|
|
1521
|
+
{
|
|
1522
|
+
...rest,
|
|
1523
|
+
...rewriteFiltersForApi(filters),
|
|
1524
|
+
...projectionToQuery(select),
|
|
1525
|
+
projectId: this.options.projectId,
|
|
1526
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
1527
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
1528
|
+
},
|
|
1529
|
+
this.edgeApiHost
|
|
1530
|
+
);
|
|
1531
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
1552
1532
|
}
|
|
1553
1533
|
};
|
|
1554
1534
|
var _contentTypesUrl;
|
|
@@ -1657,14 +1637,18 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1657
1637
|
constructor(options) {
|
|
1658
1638
|
super(options);
|
|
1659
1639
|
}
|
|
1660
|
-
/** Fetches
|
|
1661
|
-
async
|
|
1640
|
+
/** Fetches a list of DataTypes for a project */
|
|
1641
|
+
async list(options) {
|
|
1662
1642
|
const { projectId } = this.options;
|
|
1663
1643
|
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8), { ...options, projectId });
|
|
1664
1644
|
return await this.apiClient(fetchUri);
|
|
1665
1645
|
}
|
|
1646
|
+
/** @deprecated Use {@link list} instead. */
|
|
1647
|
+
async get(options) {
|
|
1648
|
+
return this.list(options);
|
|
1649
|
+
}
|
|
1666
1650
|
/** Updates or creates (based on id) a DataType */
|
|
1667
|
-
async
|
|
1651
|
+
async save(body) {
|
|
1668
1652
|
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
1669
1653
|
await this.apiClient(fetchUri, {
|
|
1670
1654
|
method: "PUT",
|
|
@@ -1672,6 +1656,10 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1672
1656
|
expectNoContent: true
|
|
1673
1657
|
});
|
|
1674
1658
|
}
|
|
1659
|
+
/** @deprecated Use {@link save} instead. */
|
|
1660
|
+
async upsert(body) {
|
|
1661
|
+
return this.save(body);
|
|
1662
|
+
}
|
|
1675
1663
|
/** Deletes a DataType */
|
|
1676
1664
|
async remove(body) {
|
|
1677
1665
|
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
@@ -1709,22 +1697,6 @@ function getComponentPath(ancestorsAndSelf) {
|
|
|
1709
1697
|
}
|
|
1710
1698
|
return `.${path.join(".")}`;
|
|
1711
1699
|
}
|
|
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
1700
|
function isRootEntryReference(root) {
|
|
1729
1701
|
return root.type === "root" && isEntryData(root.node);
|
|
1730
1702
|
}
|
|
@@ -1744,9 +1716,9 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1744
1716
|
let bufferStartIndex = 0;
|
|
1745
1717
|
let bufferEndIndex = 0;
|
|
1746
1718
|
let tokenCount = 0;
|
|
1747
|
-
const handleToken = (token, type) => {
|
|
1719
|
+
const handleToken = (token, type, offset) => {
|
|
1748
1720
|
tokenCount++;
|
|
1749
|
-
return onToken == null ? void 0 : onToken(token, type);
|
|
1721
|
+
return onToken == null ? void 0 : onToken(token, type, offset);
|
|
1750
1722
|
};
|
|
1751
1723
|
let state = "text";
|
|
1752
1724
|
for (let index = 0; index < serialized.length; index++) {
|
|
@@ -1757,7 +1729,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1757
1729
|
if (char === variablePrefix[0] && serialized[index + 1] === variablePrefix[1]) {
|
|
1758
1730
|
if (serialized[index - 1] === escapeCharacter) {
|
|
1759
1731
|
bufferEndIndex -= escapeCharacter.length;
|
|
1760
|
-
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
|
1732
|
+
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text", bufferStartIndex) === false) {
|
|
1761
1733
|
return tokenCount;
|
|
1762
1734
|
}
|
|
1763
1735
|
bufferStartIndex = index;
|
|
@@ -1766,12 +1738,12 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1766
1738
|
}
|
|
1767
1739
|
if (state === "variable") {
|
|
1768
1740
|
const textStart = bufferStartIndex - variablePrefix.length;
|
|
1769
|
-
if (handleToken(serialized.substring(textStart, bufferEndIndex), "text") === false) {
|
|
1741
|
+
if (handleToken(serialized.substring(textStart, bufferEndIndex), "text", textStart) === false) {
|
|
1770
1742
|
return tokenCount;
|
|
1771
1743
|
}
|
|
1772
1744
|
bufferStartIndex = bufferEndIndex;
|
|
1773
1745
|
} else if (bufferEndIndex > bufferStartIndex) {
|
|
1774
|
-
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
|
1746
|
+
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text", bufferStartIndex) === false) {
|
|
1775
1747
|
return tokenCount;
|
|
1776
1748
|
}
|
|
1777
1749
|
bufferStartIndex = bufferEndIndex;
|
|
@@ -1789,7 +1761,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1789
1761
|
state = "text";
|
|
1790
1762
|
if (bufferEndIndex > bufferStartIndex) {
|
|
1791
1763
|
const unescapedVariableName = serialized.substring(bufferStartIndex, bufferEndIndex).replace(/\\([${}])/g, "$1");
|
|
1792
|
-
if (handleToken(unescapedVariableName, "variable") === false) {
|
|
1764
|
+
if (handleToken(unescapedVariableName, "variable", bufferStartIndex) === false) {
|
|
1793
1765
|
return tokenCount;
|
|
1794
1766
|
}
|
|
1795
1767
|
bufferStartIndex = bufferEndIndex + variableSuffix.length;
|
|
@@ -1803,7 +1775,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1803
1775
|
bufferStartIndex -= variablePrefix.length;
|
|
1804
1776
|
}
|
|
1805
1777
|
if (bufferStartIndex < serialized.length) {
|
|
1806
|
-
handleToken(serialized.substring(bufferStartIndex), state);
|
|
1778
|
+
handleToken(serialized.substring(bufferStartIndex), state, bufferStartIndex);
|
|
1807
1779
|
}
|
|
1808
1780
|
return tokenCount;
|
|
1809
1781
|
}
|
|
@@ -2311,6 +2283,48 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
2311
2283
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
2312
2284
|
__privateAdd3(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
2313
2285
|
var _url22;
|
|
2286
|
+
var _NotificationsClient = class _NotificationsClient2 extends ApiClient {
|
|
2287
|
+
constructor(options) {
|
|
2288
|
+
super(options);
|
|
2289
|
+
}
|
|
2290
|
+
/**
|
|
2291
|
+
* Lists notifications for the current user.
|
|
2292
|
+
*
|
|
2293
|
+
* @deprecated This API is experimental and may change without notice.
|
|
2294
|
+
*/
|
|
2295
|
+
async list(options) {
|
|
2296
|
+
const fetchUri = this.createUrl(__privateGet3(_NotificationsClient2, _url22), options);
|
|
2297
|
+
return await this.apiClient(fetchUri);
|
|
2298
|
+
}
|
|
2299
|
+
/**
|
|
2300
|
+
* Creates a notification for one or more recipients.
|
|
2301
|
+
*
|
|
2302
|
+
* @deprecated This API is experimental and may change without notice.
|
|
2303
|
+
*/
|
|
2304
|
+
async create(body) {
|
|
2305
|
+
const fetchUri = this.createUrl(__privateGet3(_NotificationsClient2, _url22));
|
|
2306
|
+
return await this.apiClient(fetchUri, {
|
|
2307
|
+
method: "POST",
|
|
2308
|
+
body: JSON.stringify(body)
|
|
2309
|
+
});
|
|
2310
|
+
}
|
|
2311
|
+
/**
|
|
2312
|
+
* Updates the read state of the current user's notifications.
|
|
2313
|
+
*
|
|
2314
|
+
* @deprecated This API is experimental and may change without notice.
|
|
2315
|
+
*/
|
|
2316
|
+
async setReadState(body) {
|
|
2317
|
+
const fetchUri = this.createUrl(__privateGet3(_NotificationsClient2, _url22));
|
|
2318
|
+
await this.apiClient(fetchUri, {
|
|
2319
|
+
method: "PATCH",
|
|
2320
|
+
body: JSON.stringify(body),
|
|
2321
|
+
expectNoContent: true
|
|
2322
|
+
});
|
|
2323
|
+
}
|
|
2324
|
+
};
|
|
2325
|
+
_url22 = /* @__PURE__ */ new WeakMap();
|
|
2326
|
+
__privateAdd3(_NotificationsClient, _url22, "/api/v1/notifications");
|
|
2327
|
+
var _url32;
|
|
2314
2328
|
var _projectsUrl;
|
|
2315
2329
|
var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
2316
2330
|
constructor(options) {
|
|
@@ -2318,7 +2332,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
2318
2332
|
}
|
|
2319
2333
|
/** Fetches single Project */
|
|
2320
2334
|
async get(options) {
|
|
2321
|
-
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2,
|
|
2335
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url32), { ...options });
|
|
2322
2336
|
return await this.apiClient(fetchUri);
|
|
2323
2337
|
}
|
|
2324
2338
|
/**
|
|
@@ -2326,31 +2340,43 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
2326
2340
|
* When teamId is provided, returns a single team with its projects.
|
|
2327
2341
|
* When omitted, returns all accessible teams and their projects.
|
|
2328
2342
|
*/
|
|
2329
|
-
async
|
|
2343
|
+
async list(options) {
|
|
2330
2344
|
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
2331
2345
|
return await this.apiClient(fetchUri);
|
|
2332
2346
|
}
|
|
2347
|
+
/** @deprecated Use {@link list} instead. */
|
|
2348
|
+
async getProjects(options) {
|
|
2349
|
+
return this.list(options);
|
|
2350
|
+
}
|
|
2333
2351
|
/** Updates or creates (based on id) a Project */
|
|
2334
|
-
async
|
|
2335
|
-
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2,
|
|
2352
|
+
async save(body) {
|
|
2353
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url32));
|
|
2336
2354
|
return await this.apiClient(fetchUri, {
|
|
2337
2355
|
method: "PUT",
|
|
2338
2356
|
body: JSON.stringify({ ...body })
|
|
2339
2357
|
});
|
|
2340
2358
|
}
|
|
2359
|
+
/** @deprecated Use {@link save} instead. */
|
|
2360
|
+
async upsert(body) {
|
|
2361
|
+
return this.save(body);
|
|
2362
|
+
}
|
|
2341
2363
|
/** Deletes a Project */
|
|
2342
|
-
async
|
|
2343
|
-
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2,
|
|
2364
|
+
async remove(body) {
|
|
2365
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url32));
|
|
2344
2366
|
await this.apiClient(fetchUri, {
|
|
2345
2367
|
method: "DELETE",
|
|
2346
2368
|
body: JSON.stringify({ ...body }),
|
|
2347
2369
|
expectNoContent: true
|
|
2348
2370
|
});
|
|
2349
2371
|
}
|
|
2372
|
+
/** @deprecated Use {@link remove} instead. */
|
|
2373
|
+
async delete(body) {
|
|
2374
|
+
return this.remove(body);
|
|
2375
|
+
}
|
|
2350
2376
|
};
|
|
2351
|
-
|
|
2377
|
+
_url32 = /* @__PURE__ */ new WeakMap();
|
|
2352
2378
|
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
2353
|
-
__privateAdd3(_ProjectClient,
|
|
2379
|
+
__privateAdd3(_ProjectClient, _url32, "/api/v1/project");
|
|
2354
2380
|
__privateAdd3(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
2355
2381
|
var ROUTE_URL = "/api/v1/route";
|
|
2356
2382
|
var RouteClient = class extends ApiClient {
|
|
@@ -2362,8 +2388,14 @@ var RouteClient = class extends ApiClient {
|
|
|
2362
2388
|
super(options);
|
|
2363
2389
|
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
|
|
2364
2390
|
}
|
|
2365
|
-
/**
|
|
2366
|
-
|
|
2391
|
+
/**
|
|
2392
|
+
* Resolves a route to a composition, redirect, or not-found result.
|
|
2393
|
+
*
|
|
2394
|
+
* An optional `select` projection applies to the resolved composition when
|
|
2395
|
+
* the route matches one; redirect / notFound responses pass through
|
|
2396
|
+
* untouched.
|
|
2397
|
+
*/
|
|
2398
|
+
async get(options) {
|
|
2367
2399
|
const { projectId } = this.options;
|
|
2368
2400
|
const { select, ...rest } = options != null ? options : {};
|
|
2369
2401
|
const rewrittenSelect = projectionToQuery(select);
|
|
@@ -2373,6 +2405,10 @@ var RouteClient = class extends ApiClient {
|
|
|
2373
2405
|
this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
|
|
2374
2406
|
);
|
|
2375
2407
|
}
|
|
2408
|
+
/** @deprecated use {@link RouteClient.get} instead (renamed). */
|
|
2409
|
+
async getRoute(options) {
|
|
2410
|
+
return this.get(options);
|
|
2411
|
+
}
|
|
2376
2412
|
};
|
|
2377
2413
|
var getDataSourceVariantFromRouteGetParams = (params, defaultPreviewState) => {
|
|
2378
2414
|
var _a, _b;
|
|
@@ -2677,9 +2713,9 @@ function createLimitPolicy2({
|
|
|
2677
2713
|
}
|
|
2678
2714
|
|
|
2679
2715
|
// src/clients/canvas.ts
|
|
2680
|
-
var
|
|
2716
|
+
var buildCanvasClientOptions = (options) => {
|
|
2681
2717
|
const cache = resolveCanvasCache(options);
|
|
2682
|
-
return
|
|
2718
|
+
return {
|
|
2683
2719
|
projectId: env.getProjectId(),
|
|
2684
2720
|
apiHost: env.getApiHost(),
|
|
2685
2721
|
apiKey: env.getApiKey(),
|
|
@@ -2727,7 +2763,10 @@ var getCanvasClient = (options) => {
|
|
|
2727
2763
|
}
|
|
2728
2764
|
});
|
|
2729
2765
|
}
|
|
2730
|
-
}
|
|
2766
|
+
};
|
|
2767
|
+
};
|
|
2768
|
+
var getCompositionDeliveryClient = (options) => {
|
|
2769
|
+
return new CompositionDeliveryClient(buildCanvasClientOptions(options));
|
|
2731
2770
|
};
|
|
2732
2771
|
|
|
2733
2772
|
// src/config/helpers.ts
|
|
@@ -2950,14 +2989,14 @@ var DefaultDataClient = class {
|
|
|
2950
2989
|
if (oldCachedRoute) {
|
|
2951
2990
|
waitUntil(
|
|
2952
2991
|
(async () => {
|
|
2953
|
-
const result2 = await routeClient.
|
|
2992
|
+
const result2 = await routeClient.get(route);
|
|
2954
2993
|
await cacheNewRoute(result2);
|
|
2955
2994
|
})()
|
|
2956
2995
|
);
|
|
2957
2996
|
return oldCachedRoute;
|
|
2958
2997
|
}
|
|
2959
2998
|
}
|
|
2960
|
-
const result = await routeClient.
|
|
2999
|
+
const result = await routeClient.get(route);
|
|
2961
3000
|
waitUntil(
|
|
2962
3001
|
(async () => {
|
|
2963
3002
|
await Promise.all([
|
|
@@ -5560,7 +5599,6 @@ var retrieveRouteByPath = async ({
|
|
|
5560
5599
|
releaseId,
|
|
5561
5600
|
locale
|
|
5562
5601
|
}) => {
|
|
5563
|
-
var _a;
|
|
5564
5602
|
return await dataClient.getRoute({
|
|
5565
5603
|
source: "middleware",
|
|
5566
5604
|
searchParams,
|
|
@@ -5570,7 +5608,6 @@ var retrieveRouteByPath = async ({
|
|
|
5570
5608
|
state,
|
|
5571
5609
|
dataSourceVariant: getDataSourceVariantFromRouteGetParams({}, state),
|
|
5572
5610
|
withComponentIDs: true,
|
|
5573
|
-
withContentSourceMap: (_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing,
|
|
5574
5611
|
releaseId,
|
|
5575
5612
|
locale,
|
|
5576
5613
|
ignoreRedirects: shouldIgnoreRedirects({ state })
|
|
@@ -5659,7 +5696,7 @@ var handlePlaygroundRequest = async ({
|
|
|
5659
5696
|
{ status: 400 }
|
|
5660
5697
|
);
|
|
5661
5698
|
}
|
|
5662
|
-
const canvasClient =
|
|
5699
|
+
const canvasClient = getCompositionDeliveryClient({
|
|
5663
5700
|
cache: {
|
|
5664
5701
|
type: "no-cache"
|
|
5665
5702
|
}
|
|
@@ -5669,7 +5706,7 @@ var handlePlaygroundRequest = async ({
|
|
|
5669
5706
|
for (let i = 0; i < possibleStates.length; i++) {
|
|
5670
5707
|
const state = possibleStates[i];
|
|
5671
5708
|
try {
|
|
5672
|
-
composition = await canvasClient.
|
|
5709
|
+
composition = await canvasClient.get({
|
|
5673
5710
|
compositionId: id,
|
|
5674
5711
|
state,
|
|
5675
5712
|
withComponentIDs: true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/next-app-router",
|
|
3
|
-
"version": "20.72.
|
|
3
|
+
"version": "20.72.3-alpha.14+1e232e59cd",
|
|
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.
|
|
102
|
-
"@uniformdev/next-app-router-client": "20.72.
|
|
103
|
-
"@uniformdev/next-app-router-shared": "20.72.
|
|
104
|
-
"@uniformdev/redirect": "20.72.
|
|
105
|
-
"@uniformdev/richtext": "20.72.
|
|
106
|
-
"@uniformdev/webhooks": "20.72.
|
|
101
|
+
"@uniformdev/canvas-react": "20.72.3-alpha.14+1e232e59cd",
|
|
102
|
+
"@uniformdev/next-app-router-client": "20.72.3-alpha.14+1e232e59cd",
|
|
103
|
+
"@uniformdev/next-app-router-shared": "20.72.3-alpha.14+1e232e59cd",
|
|
104
|
+
"@uniformdev/redirect": "20.72.3-alpha.14+1e232e59cd",
|
|
105
|
+
"@uniformdev/richtext": "20.72.3-alpha.14+1e232e59cd",
|
|
106
|
+
"@uniformdev/webhooks": "20.72.3-alpha.14+1e232e59cd",
|
|
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": "
|
|
123
|
+
"gitHead": "1e232e59cd3ded97b85b063986cc95e954b8c937"
|
|
124
124
|
}
|