@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.js
CHANGED
|
@@ -1396,6 +1396,16 @@ function createLimitPolicy({
|
|
|
1396
1396
|
return currentFunc();
|
|
1397
1397
|
};
|
|
1398
1398
|
}
|
|
1399
|
+
var ContentClientBase = class extends ApiClient {
|
|
1400
|
+
constructor(options, defaultBypassCache) {
|
|
1401
|
+
var _a, _b;
|
|
1402
|
+
super({
|
|
1403
|
+
...options,
|
|
1404
|
+
limitPolicy: (_a = options.limitPolicy) != null ? _a : createLimitPolicy({}),
|
|
1405
|
+
bypassCache: (_b = options.bypassCache) != null ? _b : defaultBypassCache
|
|
1406
|
+
});
|
|
1407
|
+
}
|
|
1408
|
+
};
|
|
1399
1409
|
var SELECT_QUERY_PREFIX = "select.";
|
|
1400
1410
|
function appendCsv(out, key, values) {
|
|
1401
1411
|
if (values === void 0) {
|
|
@@ -1440,130 +1450,100 @@ function projectionToQuery(spec) {
|
|
|
1440
1450
|
}
|
|
1441
1451
|
return out;
|
|
1442
1452
|
}
|
|
1443
|
-
var
|
|
1444
|
-
var
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
const edgeParams = {
|
|
1470
|
-
...originParams,
|
|
1471
|
-
projectId,
|
|
1472
|
-
diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
|
|
1473
|
-
...rewrittenFilters,
|
|
1474
|
-
...rewrittenSelect
|
|
1475
|
-
};
|
|
1476
|
-
const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
|
|
1477
|
-
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
1478
|
-
}
|
|
1479
|
-
getCompositionByNodePath(options) {
|
|
1480
|
-
return this.getOneComposition(options);
|
|
1481
|
-
}
|
|
1482
|
-
getCompositionByNodeId(options) {
|
|
1483
|
-
return this.getOneComposition(options);
|
|
1484
|
-
}
|
|
1485
|
-
getCompositionBySlug(options) {
|
|
1486
|
-
return this.getOneComposition(options);
|
|
1487
|
-
}
|
|
1488
|
-
getCompositionById(options) {
|
|
1489
|
-
return this.getOneComposition(options);
|
|
1490
|
-
}
|
|
1491
|
-
getCompositionDefaults(options) {
|
|
1492
|
-
return this.getOneComposition(options);
|
|
1493
|
-
}
|
|
1494
|
-
/** Fetches historical versions of a composition or pattern */
|
|
1495
|
-
async getCompositionHistory(options) {
|
|
1496
|
-
const historyUrl = this.createUrl("/api/v1/canvas-history", {
|
|
1497
|
-
...options,
|
|
1498
|
-
projectId: this.options.projectId
|
|
1499
|
-
});
|
|
1500
|
-
return this.apiClient(historyUrl);
|
|
1501
|
-
}
|
|
1502
|
-
getOneComposition({
|
|
1503
|
-
skipDataResolution,
|
|
1504
|
-
diagnostics,
|
|
1505
|
-
...params
|
|
1506
|
-
}) {
|
|
1507
|
-
const { projectId } = this.options;
|
|
1508
|
-
if (skipDataResolution) {
|
|
1509
|
-
return this.apiClient(this.createUrl(CANVAS_URL, { ...params, projectId }));
|
|
1510
|
-
}
|
|
1511
|
-
const edgeParams = {
|
|
1512
|
-
...params,
|
|
1513
|
-
projectId,
|
|
1514
|
-
diagnostics: typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0
|
|
1453
|
+
var CANVAS_PERSONALIZE_TYPE = "$personalization";
|
|
1454
|
+
var CANVAS_TEST_TYPE = "$test";
|
|
1455
|
+
var CANVAS_BLOCK_PARAM_TYPE = "$block";
|
|
1456
|
+
var CANVAS_PERSONALIZE_SLOT = "pz";
|
|
1457
|
+
var CANVAS_TEST_SLOT = "test";
|
|
1458
|
+
var CANVAS_DRAFT_STATE = 0;
|
|
1459
|
+
var CANVAS_PUBLISHED_STATE = 64;
|
|
1460
|
+
var CANVAS_EDITOR_STATE = 63;
|
|
1461
|
+
var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
|
|
1462
|
+
var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
|
|
1463
|
+
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1464
|
+
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1465
|
+
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1466
|
+
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1467
|
+
var IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM = "is_incontext_editing_forced_settings";
|
|
1468
|
+
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1469
|
+
function resolveCompositionSelector(args) {
|
|
1470
|
+
if ("compositionId" in args) {
|
|
1471
|
+
const { compositionId, editionId, versionId, ...readOptions } = args;
|
|
1472
|
+
return {
|
|
1473
|
+
readOptions,
|
|
1474
|
+
// raw mode matches on composition OR edition id via the compositionId param
|
|
1475
|
+
compositionId: editionId != null ? editionId : compositionId,
|
|
1476
|
+
versionId,
|
|
1477
|
+
hasCompositionId: true,
|
|
1478
|
+
pinnedEdition: editionId !== void 0
|
|
1515
1479
|
};
|
|
1516
|
-
const edgeUrl = this.createUrl("/api/v1/composition", edgeParams, this.edgeApiHost);
|
|
1517
|
-
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
1518
1480
|
}
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
}
|
|
1532
|
-
return { modified: response.headers.get("x-modified-at") };
|
|
1481
|
+
return { readOptions: args, hasCompositionId: false, pinnedEdition: false };
|
|
1482
|
+
}
|
|
1483
|
+
var DEFAULT_EDGE_API_HOST = "https://uniform.global";
|
|
1484
|
+
var DeliveryClientBase = class extends ContentClientBase {
|
|
1485
|
+
constructor(options) {
|
|
1486
|
+
var _a;
|
|
1487
|
+
super(
|
|
1488
|
+
options,
|
|
1489
|
+
/* defaultBypassCache */
|
|
1490
|
+
false
|
|
1491
|
+
);
|
|
1492
|
+
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : DEFAULT_EDGE_API_HOST;
|
|
1493
|
+
this.edgeRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
|
|
1533
1494
|
}
|
|
1534
|
-
/**
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
const { projectId } = this.options;
|
|
1538
|
-
await this.apiClient(fetchUri, {
|
|
1539
|
-
method: "DELETE",
|
|
1540
|
-
body: JSON.stringify({ ...body, projectId }),
|
|
1541
|
-
expectNoContent: true
|
|
1542
|
-
});
|
|
1495
|
+
/** Coerces the `diagnostics` option into the shape the edge endpoints accept. */
|
|
1496
|
+
coerceDiagnostics(diagnostics) {
|
|
1497
|
+
return typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0;
|
|
1543
1498
|
}
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1499
|
+
};
|
|
1500
|
+
var EDGE_SINGLE_URL = "/api/v1/composition";
|
|
1501
|
+
var EDGE_LIST_URL = "/api/v1/compositions";
|
|
1502
|
+
var CompositionDeliveryClient = class extends DeliveryClientBase {
|
|
1503
|
+
constructor(options) {
|
|
1504
|
+
super(options);
|
|
1549
1505
|
}
|
|
1550
|
-
/**
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1506
|
+
/** Fetches exactly one composition (throws `ApiClientError(404)` if absent). */
|
|
1507
|
+
get(args) {
|
|
1508
|
+
var _a;
|
|
1509
|
+
const { diagnostics, select, ...rest } = args;
|
|
1510
|
+
const { readOptions, compositionId, versionId, pinnedEdition } = resolveCompositionSelector(rest);
|
|
1511
|
+
const url = this.createUrl(
|
|
1512
|
+
EDGE_SINGLE_URL,
|
|
1513
|
+
{
|
|
1514
|
+
...readOptions,
|
|
1515
|
+
...projectionToQuery(select),
|
|
1516
|
+
// A pinned edition is folded into compositionId (raw matches edition or
|
|
1517
|
+
// composition id); there is no editionId query param on this endpoint.
|
|
1518
|
+
compositionId,
|
|
1519
|
+
versionId,
|
|
1520
|
+
projectId: this.options.projectId,
|
|
1521
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
1522
|
+
// editionId pins a specific edition for preview; otherwise locale-best.
|
|
1523
|
+
editions: pinnedEdition ? "raw" : "auto",
|
|
1524
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
1525
|
+
},
|
|
1526
|
+
this.edgeApiHost
|
|
1527
|
+
);
|
|
1528
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
1558
1529
|
}
|
|
1559
|
-
/**
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1530
|
+
/** Fetches a list of compositions, optionally filtered. */
|
|
1531
|
+
list(args = {}) {
|
|
1532
|
+
var _a;
|
|
1533
|
+
const { diagnostics, filters, select, ...rest } = args;
|
|
1534
|
+
const url = this.createUrl(
|
|
1535
|
+
EDGE_LIST_URL,
|
|
1536
|
+
{
|
|
1537
|
+
...rest,
|
|
1538
|
+
...rewriteFiltersForApi(filters),
|
|
1539
|
+
...projectionToQuery(select),
|
|
1540
|
+
projectId: this.options.projectId,
|
|
1541
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
1542
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
1543
|
+
},
|
|
1544
|
+
this.edgeApiHost
|
|
1545
|
+
);
|
|
1546
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
1567
1547
|
}
|
|
1568
1548
|
};
|
|
1569
1549
|
var _contentTypesUrl;
|
|
@@ -1672,14 +1652,18 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1672
1652
|
constructor(options) {
|
|
1673
1653
|
super(options);
|
|
1674
1654
|
}
|
|
1675
|
-
/** Fetches
|
|
1676
|
-
async
|
|
1655
|
+
/** Fetches a list of DataTypes for a project */
|
|
1656
|
+
async list(options) {
|
|
1677
1657
|
const { projectId } = this.options;
|
|
1678
1658
|
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8), { ...options, projectId });
|
|
1679
1659
|
return await this.apiClient(fetchUri);
|
|
1680
1660
|
}
|
|
1661
|
+
/** @deprecated Use {@link list} instead. */
|
|
1662
|
+
async get(options) {
|
|
1663
|
+
return this.list(options);
|
|
1664
|
+
}
|
|
1681
1665
|
/** Updates or creates (based on id) a DataType */
|
|
1682
|
-
async
|
|
1666
|
+
async save(body) {
|
|
1683
1667
|
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
1684
1668
|
await this.apiClient(fetchUri, {
|
|
1685
1669
|
method: "PUT",
|
|
@@ -1687,6 +1671,10 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1687
1671
|
expectNoContent: true
|
|
1688
1672
|
});
|
|
1689
1673
|
}
|
|
1674
|
+
/** @deprecated Use {@link save} instead. */
|
|
1675
|
+
async upsert(body) {
|
|
1676
|
+
return this.save(body);
|
|
1677
|
+
}
|
|
1690
1678
|
/** Deletes a DataType */
|
|
1691
1679
|
async remove(body) {
|
|
1692
1680
|
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
@@ -1724,22 +1712,6 @@ function getComponentPath(ancestorsAndSelf) {
|
|
|
1724
1712
|
}
|
|
1725
1713
|
return `.${path.join(".")}`;
|
|
1726
1714
|
}
|
|
1727
|
-
var CANVAS_PERSONALIZE_TYPE = "$personalization";
|
|
1728
|
-
var CANVAS_TEST_TYPE = "$test";
|
|
1729
|
-
var CANVAS_BLOCK_PARAM_TYPE = "$block";
|
|
1730
|
-
var CANVAS_PERSONALIZE_SLOT = "pz";
|
|
1731
|
-
var CANVAS_TEST_SLOT = "test";
|
|
1732
|
-
var CANVAS_DRAFT_STATE = 0;
|
|
1733
|
-
var CANVAS_PUBLISHED_STATE = 64;
|
|
1734
|
-
var CANVAS_EDITOR_STATE = 63;
|
|
1735
|
-
var CANVAS_PERSONALIZATION_PARAM = "$pzCrit";
|
|
1736
|
-
var CANVAS_TEST_VARIANT_PARAM = "$tstVrnt";
|
|
1737
|
-
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1738
|
-
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1739
|
-
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1740
|
-
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1741
|
-
var IN_CONTEXT_EDITOR_FORCED_SETTINGS_QUERY_STRING_PARAM = "is_incontext_editing_forced_settings";
|
|
1742
|
-
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1743
1715
|
function isRootEntryReference(root) {
|
|
1744
1716
|
return root.type === "root" && isEntryData(root.node);
|
|
1745
1717
|
}
|
|
@@ -1759,9 +1731,9 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1759
1731
|
let bufferStartIndex = 0;
|
|
1760
1732
|
let bufferEndIndex = 0;
|
|
1761
1733
|
let tokenCount = 0;
|
|
1762
|
-
const handleToken = (token, type) => {
|
|
1734
|
+
const handleToken = (token, type, offset) => {
|
|
1763
1735
|
tokenCount++;
|
|
1764
|
-
return onToken == null ? void 0 : onToken(token, type);
|
|
1736
|
+
return onToken == null ? void 0 : onToken(token, type, offset);
|
|
1765
1737
|
};
|
|
1766
1738
|
let state = "text";
|
|
1767
1739
|
for (let index = 0; index < serialized.length; index++) {
|
|
@@ -1772,7 +1744,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1772
1744
|
if (char === variablePrefix[0] && serialized[index + 1] === variablePrefix[1]) {
|
|
1773
1745
|
if (serialized[index - 1] === escapeCharacter) {
|
|
1774
1746
|
bufferEndIndex -= escapeCharacter.length;
|
|
1775
|
-
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
|
1747
|
+
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text", bufferStartIndex) === false) {
|
|
1776
1748
|
return tokenCount;
|
|
1777
1749
|
}
|
|
1778
1750
|
bufferStartIndex = index;
|
|
@@ -1781,12 +1753,12 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1781
1753
|
}
|
|
1782
1754
|
if (state === "variable") {
|
|
1783
1755
|
const textStart = bufferStartIndex - variablePrefix.length;
|
|
1784
|
-
if (handleToken(serialized.substring(textStart, bufferEndIndex), "text") === false) {
|
|
1756
|
+
if (handleToken(serialized.substring(textStart, bufferEndIndex), "text", textStart) === false) {
|
|
1785
1757
|
return tokenCount;
|
|
1786
1758
|
}
|
|
1787
1759
|
bufferStartIndex = bufferEndIndex;
|
|
1788
1760
|
} else if (bufferEndIndex > bufferStartIndex) {
|
|
1789
|
-
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
|
1761
|
+
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text", bufferStartIndex) === false) {
|
|
1790
1762
|
return tokenCount;
|
|
1791
1763
|
}
|
|
1792
1764
|
bufferStartIndex = bufferEndIndex;
|
|
@@ -1804,7 +1776,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1804
1776
|
state = "text";
|
|
1805
1777
|
if (bufferEndIndex > bufferStartIndex) {
|
|
1806
1778
|
const unescapedVariableName = serialized.substring(bufferStartIndex, bufferEndIndex).replace(/\\([${}])/g, "$1");
|
|
1807
|
-
if (handleToken(unescapedVariableName, "variable") === false) {
|
|
1779
|
+
if (handleToken(unescapedVariableName, "variable", bufferStartIndex) === false) {
|
|
1808
1780
|
return tokenCount;
|
|
1809
1781
|
}
|
|
1810
1782
|
bufferStartIndex = bufferEndIndex + variableSuffix.length;
|
|
@@ -1818,7 +1790,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1818
1790
|
bufferStartIndex -= variablePrefix.length;
|
|
1819
1791
|
}
|
|
1820
1792
|
if (bufferStartIndex < serialized.length) {
|
|
1821
|
-
handleToken(serialized.substring(bufferStartIndex), state);
|
|
1793
|
+
handleToken(serialized.substring(bufferStartIndex), state, bufferStartIndex);
|
|
1822
1794
|
}
|
|
1823
1795
|
return tokenCount;
|
|
1824
1796
|
}
|
|
@@ -2326,6 +2298,48 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
2326
2298
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
2327
2299
|
__privateAdd3(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
2328
2300
|
var _url22;
|
|
2301
|
+
var _NotificationsClient = class _NotificationsClient2 extends ApiClient {
|
|
2302
|
+
constructor(options) {
|
|
2303
|
+
super(options);
|
|
2304
|
+
}
|
|
2305
|
+
/**
|
|
2306
|
+
* Lists notifications for the current user.
|
|
2307
|
+
*
|
|
2308
|
+
* @deprecated This API is experimental and may change without notice.
|
|
2309
|
+
*/
|
|
2310
|
+
async list(options) {
|
|
2311
|
+
const fetchUri = this.createUrl(__privateGet3(_NotificationsClient2, _url22), options);
|
|
2312
|
+
return await this.apiClient(fetchUri);
|
|
2313
|
+
}
|
|
2314
|
+
/**
|
|
2315
|
+
* Creates a notification for one or more recipients.
|
|
2316
|
+
*
|
|
2317
|
+
* @deprecated This API is experimental and may change without notice.
|
|
2318
|
+
*/
|
|
2319
|
+
async create(body) {
|
|
2320
|
+
const fetchUri = this.createUrl(__privateGet3(_NotificationsClient2, _url22));
|
|
2321
|
+
return await this.apiClient(fetchUri, {
|
|
2322
|
+
method: "POST",
|
|
2323
|
+
body: JSON.stringify(body)
|
|
2324
|
+
});
|
|
2325
|
+
}
|
|
2326
|
+
/**
|
|
2327
|
+
* Updates the read state of the current user's notifications.
|
|
2328
|
+
*
|
|
2329
|
+
* @deprecated This API is experimental and may change without notice.
|
|
2330
|
+
*/
|
|
2331
|
+
async setReadState(body) {
|
|
2332
|
+
const fetchUri = this.createUrl(__privateGet3(_NotificationsClient2, _url22));
|
|
2333
|
+
await this.apiClient(fetchUri, {
|
|
2334
|
+
method: "PATCH",
|
|
2335
|
+
body: JSON.stringify(body),
|
|
2336
|
+
expectNoContent: true
|
|
2337
|
+
});
|
|
2338
|
+
}
|
|
2339
|
+
};
|
|
2340
|
+
_url22 = /* @__PURE__ */ new WeakMap();
|
|
2341
|
+
__privateAdd3(_NotificationsClient, _url22, "/api/v1/notifications");
|
|
2342
|
+
var _url32;
|
|
2329
2343
|
var _projectsUrl;
|
|
2330
2344
|
var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
2331
2345
|
constructor(options) {
|
|
@@ -2333,7 +2347,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
2333
2347
|
}
|
|
2334
2348
|
/** Fetches single Project */
|
|
2335
2349
|
async get(options) {
|
|
2336
|
-
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2,
|
|
2350
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url32), { ...options });
|
|
2337
2351
|
return await this.apiClient(fetchUri);
|
|
2338
2352
|
}
|
|
2339
2353
|
/**
|
|
@@ -2341,31 +2355,43 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
2341
2355
|
* When teamId is provided, returns a single team with its projects.
|
|
2342
2356
|
* When omitted, returns all accessible teams and their projects.
|
|
2343
2357
|
*/
|
|
2344
|
-
async
|
|
2358
|
+
async list(options) {
|
|
2345
2359
|
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
2346
2360
|
return await this.apiClient(fetchUri);
|
|
2347
2361
|
}
|
|
2362
|
+
/** @deprecated Use {@link list} instead. */
|
|
2363
|
+
async getProjects(options) {
|
|
2364
|
+
return this.list(options);
|
|
2365
|
+
}
|
|
2348
2366
|
/** Updates or creates (based on id) a Project */
|
|
2349
|
-
async
|
|
2350
|
-
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2,
|
|
2367
|
+
async save(body) {
|
|
2368
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url32));
|
|
2351
2369
|
return await this.apiClient(fetchUri, {
|
|
2352
2370
|
method: "PUT",
|
|
2353
2371
|
body: JSON.stringify({ ...body })
|
|
2354
2372
|
});
|
|
2355
2373
|
}
|
|
2374
|
+
/** @deprecated Use {@link save} instead. */
|
|
2375
|
+
async upsert(body) {
|
|
2376
|
+
return this.save(body);
|
|
2377
|
+
}
|
|
2356
2378
|
/** Deletes a Project */
|
|
2357
|
-
async
|
|
2358
|
-
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2,
|
|
2379
|
+
async remove(body) {
|
|
2380
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url32));
|
|
2359
2381
|
await this.apiClient(fetchUri, {
|
|
2360
2382
|
method: "DELETE",
|
|
2361
2383
|
body: JSON.stringify({ ...body }),
|
|
2362
2384
|
expectNoContent: true
|
|
2363
2385
|
});
|
|
2364
2386
|
}
|
|
2387
|
+
/** @deprecated Use {@link remove} instead. */
|
|
2388
|
+
async delete(body) {
|
|
2389
|
+
return this.remove(body);
|
|
2390
|
+
}
|
|
2365
2391
|
};
|
|
2366
|
-
|
|
2392
|
+
_url32 = /* @__PURE__ */ new WeakMap();
|
|
2367
2393
|
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
2368
|
-
__privateAdd3(_ProjectClient,
|
|
2394
|
+
__privateAdd3(_ProjectClient, _url32, "/api/v1/project");
|
|
2369
2395
|
__privateAdd3(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
2370
2396
|
var ROUTE_URL = "/api/v1/route";
|
|
2371
2397
|
var RouteClient = class extends ApiClient {
|
|
@@ -2377,8 +2403,14 @@ var RouteClient = class extends ApiClient {
|
|
|
2377
2403
|
super(options);
|
|
2378
2404
|
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
|
|
2379
2405
|
}
|
|
2380
|
-
/**
|
|
2381
|
-
|
|
2406
|
+
/**
|
|
2407
|
+
* Resolves a route to a composition, redirect, or not-found result.
|
|
2408
|
+
*
|
|
2409
|
+
* An optional `select` projection applies to the resolved composition when
|
|
2410
|
+
* the route matches one; redirect / notFound responses pass through
|
|
2411
|
+
* untouched.
|
|
2412
|
+
*/
|
|
2413
|
+
async get(options) {
|
|
2382
2414
|
const { projectId } = this.options;
|
|
2383
2415
|
const { select, ...rest } = options != null ? options : {};
|
|
2384
2416
|
const rewrittenSelect = projectionToQuery(select);
|
|
@@ -2388,6 +2420,10 @@ var RouteClient = class extends ApiClient {
|
|
|
2388
2420
|
this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
|
|
2389
2421
|
);
|
|
2390
2422
|
}
|
|
2423
|
+
/** @deprecated use {@link RouteClient.get} instead (renamed). */
|
|
2424
|
+
async getRoute(options) {
|
|
2425
|
+
return this.get(options);
|
|
2426
|
+
}
|
|
2391
2427
|
};
|
|
2392
2428
|
var getDataSourceVariantFromRouteGetParams = (params, defaultPreviewState) => {
|
|
2393
2429
|
var _a, _b;
|
|
@@ -2690,9 +2726,9 @@ function createLimitPolicy2({
|
|
|
2690
2726
|
}
|
|
2691
2727
|
|
|
2692
2728
|
// src/clients/canvas.ts
|
|
2693
|
-
var
|
|
2729
|
+
var buildCanvasClientOptions = (options) => {
|
|
2694
2730
|
const cache = resolveCanvasCache(options);
|
|
2695
|
-
return
|
|
2731
|
+
return {
|
|
2696
2732
|
projectId: env.getProjectId(),
|
|
2697
2733
|
apiHost: env.getApiHost(),
|
|
2698
2734
|
apiKey: env.getApiKey(),
|
|
@@ -2740,7 +2776,10 @@ var getCanvasClient = (options) => {
|
|
|
2740
2776
|
}
|
|
2741
2777
|
});
|
|
2742
2778
|
}
|
|
2743
|
-
}
|
|
2779
|
+
};
|
|
2780
|
+
};
|
|
2781
|
+
var getCompositionDeliveryClient = (options) => {
|
|
2782
|
+
return new CompositionDeliveryClient(buildCanvasClientOptions(options));
|
|
2744
2783
|
};
|
|
2745
2784
|
|
|
2746
2785
|
// src/config/helpers.ts
|
|
@@ -2963,14 +3002,14 @@ var DefaultDataClient = class {
|
|
|
2963
3002
|
if (oldCachedRoute) {
|
|
2964
3003
|
(0, import_functions.waitUntil)(
|
|
2965
3004
|
(async () => {
|
|
2966
|
-
const result2 = await routeClient.
|
|
3005
|
+
const result2 = await routeClient.get(route);
|
|
2967
3006
|
await cacheNewRoute(result2);
|
|
2968
3007
|
})()
|
|
2969
3008
|
);
|
|
2970
3009
|
return oldCachedRoute;
|
|
2971
3010
|
}
|
|
2972
3011
|
}
|
|
2973
|
-
const result = await routeClient.
|
|
3012
|
+
const result = await routeClient.get(route);
|
|
2974
3013
|
(0, import_functions.waitUntil)(
|
|
2975
3014
|
(async () => {
|
|
2976
3015
|
await Promise.all([
|
|
@@ -5568,7 +5607,6 @@ var retrieveRouteByPath = async ({
|
|
|
5568
5607
|
releaseId,
|
|
5569
5608
|
locale
|
|
5570
5609
|
}) => {
|
|
5571
|
-
var _a;
|
|
5572
5610
|
return await dataClient.getRoute({
|
|
5573
5611
|
source: "middleware",
|
|
5574
5612
|
searchParams,
|
|
@@ -5578,7 +5616,6 @@ var retrieveRouteByPath = async ({
|
|
|
5578
5616
|
state,
|
|
5579
5617
|
dataSourceVariant: getDataSourceVariantFromRouteGetParams({}, state),
|
|
5580
5618
|
withComponentIDs: true,
|
|
5581
|
-
withContentSourceMap: (_a = getServerConfig().experimental) == null ? void 0 : _a.vercelVisualEditing,
|
|
5582
5619
|
releaseId,
|
|
5583
5620
|
locale,
|
|
5584
5621
|
ignoreRedirects: shouldIgnoreRedirects({ state })
|
|
@@ -5667,7 +5704,7 @@ var handlePlaygroundRequest = async ({
|
|
|
5667
5704
|
{ status: 400 }
|
|
5668
5705
|
);
|
|
5669
5706
|
}
|
|
5670
|
-
const canvasClient =
|
|
5707
|
+
const canvasClient = getCompositionDeliveryClient({
|
|
5671
5708
|
cache: {
|
|
5672
5709
|
type: "no-cache"
|
|
5673
5710
|
}
|
|
@@ -5677,7 +5714,7 @@ var handlePlaygroundRequest = async ({
|
|
|
5677
5714
|
for (let i = 0; i < possibleStates.length; i++) {
|
|
5678
5715
|
const state = possibleStates[i];
|
|
5679
5716
|
try {
|
|
5680
|
-
composition = await canvasClient.
|
|
5717
|
+
composition = await canvasClient.get({
|
|
5681
5718
|
compositionId: id,
|
|
5682
5719
|
state,
|
|
5683
5720
|
withComponentIDs: true
|