@uniformdev/next-app-router 20.7.1-alpha.123 → 20.7.1-alpha.136
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/LICENSE.txt +1 -1
- package/dist/{UniformComposition-r8a9xGZn.d.ts → UniformComposition-d7_93l3F.d.ts} +5 -0
- package/dist/{UniformComposition-CHUPULqc.d.mts → UniformComposition-hhRIBHmn.d.mts} +5 -0
- package/dist/cache.js +78 -75
- package/dist/cache.mjs +78 -77
- package/dist/compat.d.mts +2 -2
- package/dist/compat.d.ts +2 -2
- package/dist/component.js +3 -0
- package/dist/component.mjs +3 -0
- package/dist/config/default.d.mts +5 -0
- package/dist/config/default.d.ts +5 -0
- package/dist/config/default.js +32 -0
- package/dist/config/default.mjs +11 -0
- package/dist/config.d.mts +6 -1
- package/dist/config.d.ts +6 -1
- package/dist/config.js +12 -21
- package/dist/config.mjs +12 -21
- package/dist/handler.js +33 -21
- package/dist/handler.mjs +33 -21
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +73 -43
- package/dist/index.js +73 -43
- package/dist/index.mjs +73 -43
- package/dist/middleware.js +130 -94
- package/dist/middleware.mjs +130 -94
- package/package.json +23 -10
package/LICENSE.txt
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
©
|
|
1
|
+
© 2026 Uniform Systems, Inc. All Rights Reserved.
|
|
2
2
|
See details of Uniform Systems, Inc. Master Subscription Agreement here: https://uniform.dev/eula
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RootComponentInstance, ComponentInstance } from '@uniformdev/canvas';
|
|
2
2
|
import { ComponentProps } from '@uniformdev/next-app-router-shared';
|
|
3
3
|
import React, { ComponentType } from 'react';
|
|
4
|
+
import { D as DataClient } from './client-BCGVjYM-.js';
|
|
4
5
|
import { a as ResolvedRouteResult, R as ResolveRouteFunction } from './resolveRouteFromCode-DgTsfMK8.js';
|
|
5
6
|
import { ClientContextComponent } from '@uniformdev/next-app-router-client';
|
|
6
7
|
|
|
@@ -60,6 +61,10 @@ type UniformCompositionProps = {
|
|
|
60
61
|
* Function to map composition components to React components.
|
|
61
62
|
*/
|
|
62
63
|
resolveComponent: ResolveComponentFunction;
|
|
64
|
+
/**
|
|
65
|
+
* If provided, the composition will use the data client to retrieve data.
|
|
66
|
+
*/
|
|
67
|
+
dataClient?: DataClient;
|
|
63
68
|
/**
|
|
64
69
|
* Function to map empty placeholders to React components.
|
|
65
70
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RootComponentInstance, ComponentInstance } from '@uniformdev/canvas';
|
|
2
2
|
import { ComponentProps } from '@uniformdev/next-app-router-shared';
|
|
3
3
|
import React, { ComponentType } from 'react';
|
|
4
|
+
import { D as DataClient } from './client-BCGVjYM-.mjs';
|
|
4
5
|
import { a as ResolvedRouteResult, R as ResolveRouteFunction } from './resolveRouteFromCode-CKaYNXte.mjs';
|
|
5
6
|
import { ClientContextComponent } from '@uniformdev/next-app-router-client';
|
|
6
7
|
|
|
@@ -60,6 +61,10 @@ type UniformCompositionProps = {
|
|
|
60
61
|
* Function to map composition components to React components.
|
|
61
62
|
*/
|
|
62
63
|
resolveComponent: ResolveComponentFunction;
|
|
64
|
+
/**
|
|
65
|
+
* If provided, the composition will use the data client to retrieve data.
|
|
66
|
+
*/
|
|
67
|
+
dataClient?: DataClient;
|
|
63
68
|
/**
|
|
64
69
|
* Function to map empty placeholders to React components.
|
|
65
70
|
*/
|
package/dist/cache.js
CHANGED
|
@@ -154,7 +154,6 @@ __export(cache_exports, {
|
|
|
154
154
|
resolveRouteFromCode: () => resolveRouteFromCode2
|
|
155
155
|
});
|
|
156
156
|
module.exports = __toCommonJS(cache_exports);
|
|
157
|
-
var import_cache4 = require("next/cache");
|
|
158
157
|
|
|
159
158
|
// src/data/resolveRouteFromCode.ts
|
|
160
159
|
var import_next_app_router_shared = require("@uniformdev/next-app-router-shared");
|
|
@@ -1263,6 +1262,9 @@ __privateAdd2(_DataTypeClient, _url8, "/api/v1/data-types");
|
|
|
1263
1262
|
var CANVAS_DRAFT_STATE = 0;
|
|
1264
1263
|
var CANVAS_PUBLISHED_STATE = 64;
|
|
1265
1264
|
var CANVAS_EDITOR_STATE = 63;
|
|
1265
|
+
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1266
|
+
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1267
|
+
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1266
1268
|
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1267
1269
|
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1268
1270
|
var _baseUrl;
|
|
@@ -1360,7 +1362,7 @@ var RouteClient = class extends ApiClient {
|
|
|
1360
1362
|
// src/data/client.ts
|
|
1361
1363
|
var import_functions = require("@vercel/functions");
|
|
1362
1364
|
|
|
1363
|
-
// src/clients/
|
|
1365
|
+
// src/clients/manifest.ts
|
|
1364
1366
|
var import_server_only = require("server-only");
|
|
1365
1367
|
|
|
1366
1368
|
// src/utils/env.ts
|
|
@@ -1379,19 +1381,19 @@ var env = {
|
|
|
1379
1381
|
}
|
|
1380
1382
|
};
|
|
1381
1383
|
|
|
1382
|
-
// src/config/helpers.ts
|
|
1383
|
-
var import_uniform_server = __toESM(require("uniform.server.config"));
|
|
1384
|
-
var getServerConfig = () => {
|
|
1385
|
-
return import_uniform_server.default;
|
|
1386
|
-
};
|
|
1387
|
-
|
|
1388
1384
|
// src/utils/draft.ts
|
|
1389
1385
|
var isDraftModeEnabled = ({
|
|
1390
1386
|
draftModeEnabled
|
|
1391
1387
|
}) => {
|
|
1392
1388
|
return draftModeEnabled;
|
|
1393
1389
|
};
|
|
1394
|
-
var isIncontextEditingEnabled = ({
|
|
1390
|
+
var isIncontextEditingEnabled = ({
|
|
1391
|
+
isDraftModeEnabled: isDraftModeEnabled2,
|
|
1392
|
+
searchParams
|
|
1393
|
+
}) => {
|
|
1394
|
+
if (!isDraftModeEnabled2) {
|
|
1395
|
+
return false;
|
|
1396
|
+
}
|
|
1395
1397
|
const containsKey = searchParams.has(IN_CONTEXT_EDITOR_QUERY_STRING_PARAM);
|
|
1396
1398
|
return containsKey;
|
|
1397
1399
|
};
|
|
@@ -1400,9 +1402,6 @@ var isDevelopmentEnvironment = () => {
|
|
|
1400
1402
|
};
|
|
1401
1403
|
|
|
1402
1404
|
// src/clients/cache.ts
|
|
1403
|
-
var isSpecificCacheMode = (options) => {
|
|
1404
|
-
return "cache" in options;
|
|
1405
|
-
};
|
|
1406
1405
|
var isStateCacheMode = (options) => {
|
|
1407
1406
|
return "state" in options;
|
|
1408
1407
|
};
|
|
@@ -1411,25 +1410,20 @@ var isDetectCacheMode = (options) => {
|
|
|
1411
1410
|
};
|
|
1412
1411
|
var resolveManifestCache = (options) => {
|
|
1413
1412
|
return resolveCache({
|
|
1414
|
-
options
|
|
1415
|
-
defaultCache: getServerConfig().manifestCache
|
|
1413
|
+
options
|
|
1416
1414
|
});
|
|
1417
1415
|
};
|
|
1418
1416
|
var resolveCanvasCache = (options) => {
|
|
1419
1417
|
return resolveCache({
|
|
1420
|
-
options
|
|
1421
|
-
defaultCache: getServerConfig().canvasCache
|
|
1418
|
+
options
|
|
1422
1419
|
});
|
|
1423
1420
|
};
|
|
1424
1421
|
var resolveCache = ({
|
|
1425
|
-
options
|
|
1426
|
-
defaultCache
|
|
1422
|
+
options
|
|
1427
1423
|
}) => {
|
|
1428
|
-
let cache =
|
|
1424
|
+
let cache = void 0;
|
|
1429
1425
|
if (options) {
|
|
1430
|
-
if (
|
|
1431
|
-
cache = options.cache;
|
|
1432
|
-
} else if (isStateCacheMode(options)) {
|
|
1426
|
+
if (isStateCacheMode(options)) {
|
|
1433
1427
|
if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
|
|
1434
1428
|
cache = {
|
|
1435
1429
|
type: "no-cache",
|
|
@@ -1454,7 +1448,10 @@ var shouldCacheBeDisabled = (options) => {
|
|
|
1454
1448
|
if (isDraftModeEnabled(options)) {
|
|
1455
1449
|
return { disabled: true, reason: "DRAFT" };
|
|
1456
1450
|
}
|
|
1457
|
-
if (isIncontextEditingEnabled(
|
|
1451
|
+
if (isIncontextEditingEnabled({
|
|
1452
|
+
isDraftModeEnabled: options.draftModeEnabled,
|
|
1453
|
+
searchParams: options.searchParams
|
|
1454
|
+
})) {
|
|
1458
1455
|
return { disabled: true, reason: "INCONTEXT" };
|
|
1459
1456
|
}
|
|
1460
1457
|
if (isDevelopmentEnvironment()) {
|
|
@@ -1625,7 +1622,47 @@ var generateManifestCacheTags = () => {
|
|
|
1625
1622
|
return ["manifest"];
|
|
1626
1623
|
};
|
|
1627
1624
|
|
|
1625
|
+
// src/clients/manifest.ts
|
|
1626
|
+
var getManifestClient = (options) => {
|
|
1627
|
+
const cache = resolveManifestCache(options);
|
|
1628
|
+
const manifestClient = new ManifestClient({
|
|
1629
|
+
apiHost: env.getApiHost(),
|
|
1630
|
+
apiKey: env.getApiKey(),
|
|
1631
|
+
projectId: env.getProjectId(),
|
|
1632
|
+
limitPolicy: createLimitPolicy2({
|
|
1633
|
+
limit: 6
|
|
1634
|
+
}),
|
|
1635
|
+
fetch: (req, init) => {
|
|
1636
|
+
const { cache: fetchCache, revalidate } = determineFetchCacheOptions(cache);
|
|
1637
|
+
return fetch(req, {
|
|
1638
|
+
...init,
|
|
1639
|
+
headers: {
|
|
1640
|
+
...init == null ? void 0 : init.headers,
|
|
1641
|
+
"x-bypass-cache": typeof cache.bypassCache !== "undefined" ? cache.bypassCache.toString() : "false"
|
|
1642
|
+
},
|
|
1643
|
+
cache: fetchCache,
|
|
1644
|
+
next: {
|
|
1645
|
+
revalidate,
|
|
1646
|
+
tags: generateManifestCacheTags()
|
|
1647
|
+
}
|
|
1648
|
+
});
|
|
1649
|
+
}
|
|
1650
|
+
});
|
|
1651
|
+
return manifestClient;
|
|
1652
|
+
};
|
|
1653
|
+
var getManifest = async (options) => {
|
|
1654
|
+
let preview = false;
|
|
1655
|
+
if (options && isStateCacheMode(options)) {
|
|
1656
|
+
preview = options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE;
|
|
1657
|
+
}
|
|
1658
|
+
const manifestClient = getManifestClient(options);
|
|
1659
|
+
return manifestClient.get({
|
|
1660
|
+
preview
|
|
1661
|
+
});
|
|
1662
|
+
};
|
|
1663
|
+
|
|
1628
1664
|
// src/clients/route.ts
|
|
1665
|
+
var import_server_only2 = require("server-only");
|
|
1629
1666
|
var getRouteCacheTags = (requestedUrl) => {
|
|
1630
1667
|
const tags = ["route"];
|
|
1631
1668
|
if (requestedUrl) {
|
|
@@ -1675,52 +1712,27 @@ var getRouteClient = (options) => {
|
|
|
1675
1712
|
return client;
|
|
1676
1713
|
};
|
|
1677
1714
|
|
|
1678
|
-
// src/
|
|
1679
|
-
var
|
|
1680
|
-
var
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
projectId: env.getProjectId(),
|
|
1686
|
-
limitPolicy: createLimitPolicy2({
|
|
1687
|
-
limit: 6
|
|
1688
|
-
}),
|
|
1689
|
-
fetch: (req, init) => {
|
|
1690
|
-
const { cache: fetchCache, revalidate } = determineFetchCacheOptions(cache);
|
|
1691
|
-
return fetch(req, {
|
|
1692
|
-
...init,
|
|
1693
|
-
headers: {
|
|
1694
|
-
...init == null ? void 0 : init.headers,
|
|
1695
|
-
"x-bypass-cache": typeof cache.bypassCache !== "undefined" ? cache.bypassCache.toString() : "false"
|
|
1696
|
-
},
|
|
1697
|
-
cache: fetchCache,
|
|
1698
|
-
next: {
|
|
1699
|
-
revalidate,
|
|
1700
|
-
tags: generateManifestCacheTags()
|
|
1701
|
-
}
|
|
1702
|
-
});
|
|
1703
|
-
}
|
|
1704
|
-
});
|
|
1705
|
-
return manifestClient;
|
|
1715
|
+
// src/config/helpers.ts
|
|
1716
|
+
var import_resolved = __toESM(require("@uniformdev/next-app-router/config/resolved"));
|
|
1717
|
+
var getMiddlewareRuntimeCache = () => {
|
|
1718
|
+
if (typeof import_resolved.default.middlewareRuntimeCache === "boolean") {
|
|
1719
|
+
return import_resolved.default.middlewareRuntimeCache;
|
|
1720
|
+
}
|
|
1721
|
+
return true;
|
|
1706
1722
|
};
|
|
1707
|
-
var
|
|
1708
|
-
|
|
1709
|
-
if (
|
|
1710
|
-
|
|
1723
|
+
var getDisableSwrMiddlewareCache = () => {
|
|
1724
|
+
var _a;
|
|
1725
|
+
if (typeof ((_a = import_resolved.default.experimental) == null ? void 0 : _a.disableSwrMiddlewareCache) === "boolean") {
|
|
1726
|
+
return import_resolved.default.experimental.disableSwrMiddlewareCache;
|
|
1711
1727
|
}
|
|
1712
|
-
|
|
1713
|
-
return manifestClient.get({
|
|
1714
|
-
preview
|
|
1715
|
-
});
|
|
1728
|
+
return false;
|
|
1716
1729
|
};
|
|
1717
1730
|
|
|
1718
1731
|
// src/data/client.ts
|
|
1719
1732
|
var MANIFEST_CACHE_KEY = "uniform-manifest";
|
|
1720
1733
|
var DefaultDataClient = class {
|
|
1721
1734
|
async getManifest(options) {
|
|
1722
|
-
|
|
1723
|
-
const cache = options.source === "middleware" && ((_b = (_a = getServerConfig().experimental) == null ? void 0 : _a.middlewareRuntimeCache) != null ? _b : false) ? (0, import_functions.getCache)() : null;
|
|
1735
|
+
const cache = options.source === "middleware" && getMiddlewareRuntimeCache() ? (0, import_functions.getCache)() : null;
|
|
1724
1736
|
if (cache) {
|
|
1725
1737
|
const cachedManifest = await cache.get(MANIFEST_CACHE_KEY);
|
|
1726
1738
|
if (cachedManifest) {
|
|
@@ -1806,18 +1818,16 @@ var DefaultDataClient = class {
|
|
|
1806
1818
|
async enhanceRoute(_options) {
|
|
1807
1819
|
}
|
|
1808
1820
|
async getRouteMiddleware(options) {
|
|
1809
|
-
var _a, _b, _c, _d;
|
|
1810
1821
|
const routeClient = getRouteClient({
|
|
1811
1822
|
searchParams: options.searchParams,
|
|
1812
1823
|
draftModeEnabled: options.draftModeEnabled
|
|
1813
1824
|
});
|
|
1814
|
-
const config = getServerConfig();
|
|
1815
1825
|
const resolvedRoute = await this.getRouteFromApi({
|
|
1816
1826
|
source: "middleware",
|
|
1817
1827
|
route: options.route,
|
|
1818
1828
|
routeClient,
|
|
1819
|
-
enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && (
|
|
1820
|
-
disableSwrCache: (
|
|
1829
|
+
enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && getMiddlewareRuntimeCache(),
|
|
1830
|
+
disableSwrCache: getDisableSwrMiddlewareCache()
|
|
1821
1831
|
});
|
|
1822
1832
|
if (resolvedRoute.type === "composition") {
|
|
1823
1833
|
await this.enhanceRoute({
|
|
@@ -1833,12 +1843,12 @@ var DefaultDataClient = class {
|
|
|
1833
1843
|
};
|
|
1834
1844
|
}
|
|
1835
1845
|
async getRoutePageState(options) {
|
|
1836
|
-
var _a;
|
|
1837
1846
|
const routeClient = getRouteClient({
|
|
1838
|
-
cache: options.pageState.compositionState === CANVAS_PUBLISHED_STATE ?
|
|
1847
|
+
cache: options.pageState.compositionState === CANVAS_PUBLISHED_STATE ? {
|
|
1839
1848
|
type: "force-cache"
|
|
1840
1849
|
} : {
|
|
1841
|
-
type: "no-cache"
|
|
1850
|
+
type: "no-cache",
|
|
1851
|
+
bypassCache: true
|
|
1842
1852
|
}
|
|
1843
1853
|
});
|
|
1844
1854
|
const originalRoute = {
|
|
@@ -1900,13 +1910,6 @@ var resolveRouteFromCode2 = async ({
|
|
|
1900
1910
|
code,
|
|
1901
1911
|
dataClient: providedDataClient
|
|
1902
1912
|
});
|
|
1903
|
-
if (process.env.NODE_ENV === "development") {
|
|
1904
|
-
(0, import_cache4.cacheLife)({
|
|
1905
|
-
expire: 0,
|
|
1906
|
-
revalidate: 0,
|
|
1907
|
-
stale: 0
|
|
1908
|
-
});
|
|
1909
|
-
}
|
|
1910
1913
|
return result;
|
|
1911
1914
|
};
|
|
1912
1915
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/cache.mjs
CHANGED
|
@@ -142,9 +142,6 @@ var require_p_limit = __commonJS({
|
|
|
142
142
|
}
|
|
143
143
|
});
|
|
144
144
|
|
|
145
|
-
// src/cache.ts
|
|
146
|
-
import { cacheLife } from "next/cache";
|
|
147
|
-
|
|
148
145
|
// src/data/resolveRouteFromCode.ts
|
|
149
146
|
import { deserializeEvaluationResult } from "@uniformdev/next-app-router-shared";
|
|
150
147
|
|
|
@@ -1252,6 +1249,9 @@ __privateAdd2(_DataTypeClient, _url8, "/api/v1/data-types");
|
|
|
1252
1249
|
var CANVAS_DRAFT_STATE = 0;
|
|
1253
1250
|
var CANVAS_PUBLISHED_STATE = 64;
|
|
1254
1251
|
var CANVAS_EDITOR_STATE = 63;
|
|
1252
|
+
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1253
|
+
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1254
|
+
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1255
1255
|
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1256
1256
|
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1257
1257
|
var _baseUrl;
|
|
@@ -1349,7 +1349,7 @@ var RouteClient = class extends ApiClient {
|
|
|
1349
1349
|
// src/data/client.ts
|
|
1350
1350
|
import { getCache, waitUntil } from "@vercel/functions";
|
|
1351
1351
|
|
|
1352
|
-
// src/clients/
|
|
1352
|
+
// src/clients/manifest.ts
|
|
1353
1353
|
import "server-only";
|
|
1354
1354
|
|
|
1355
1355
|
// src/utils/env.ts
|
|
@@ -1368,19 +1368,19 @@ var env = {
|
|
|
1368
1368
|
}
|
|
1369
1369
|
};
|
|
1370
1370
|
|
|
1371
|
-
// src/config/helpers.ts
|
|
1372
|
-
import serverConfig from "uniform.server.config";
|
|
1373
|
-
var getServerConfig = () => {
|
|
1374
|
-
return serverConfig;
|
|
1375
|
-
};
|
|
1376
|
-
|
|
1377
1371
|
// src/utils/draft.ts
|
|
1378
1372
|
var isDraftModeEnabled = ({
|
|
1379
1373
|
draftModeEnabled
|
|
1380
1374
|
}) => {
|
|
1381
1375
|
return draftModeEnabled;
|
|
1382
1376
|
};
|
|
1383
|
-
var isIncontextEditingEnabled = ({
|
|
1377
|
+
var isIncontextEditingEnabled = ({
|
|
1378
|
+
isDraftModeEnabled: isDraftModeEnabled2,
|
|
1379
|
+
searchParams
|
|
1380
|
+
}) => {
|
|
1381
|
+
if (!isDraftModeEnabled2) {
|
|
1382
|
+
return false;
|
|
1383
|
+
}
|
|
1384
1384
|
const containsKey = searchParams.has(IN_CONTEXT_EDITOR_QUERY_STRING_PARAM);
|
|
1385
1385
|
return containsKey;
|
|
1386
1386
|
};
|
|
@@ -1389,9 +1389,6 @@ var isDevelopmentEnvironment = () => {
|
|
|
1389
1389
|
};
|
|
1390
1390
|
|
|
1391
1391
|
// src/clients/cache.ts
|
|
1392
|
-
var isSpecificCacheMode = (options) => {
|
|
1393
|
-
return "cache" in options;
|
|
1394
|
-
};
|
|
1395
1392
|
var isStateCacheMode = (options) => {
|
|
1396
1393
|
return "state" in options;
|
|
1397
1394
|
};
|
|
@@ -1400,25 +1397,20 @@ var isDetectCacheMode = (options) => {
|
|
|
1400
1397
|
};
|
|
1401
1398
|
var resolveManifestCache = (options) => {
|
|
1402
1399
|
return resolveCache({
|
|
1403
|
-
options
|
|
1404
|
-
defaultCache: getServerConfig().manifestCache
|
|
1400
|
+
options
|
|
1405
1401
|
});
|
|
1406
1402
|
};
|
|
1407
1403
|
var resolveCanvasCache = (options) => {
|
|
1408
1404
|
return resolveCache({
|
|
1409
|
-
options
|
|
1410
|
-
defaultCache: getServerConfig().canvasCache
|
|
1405
|
+
options
|
|
1411
1406
|
});
|
|
1412
1407
|
};
|
|
1413
1408
|
var resolveCache = ({
|
|
1414
|
-
options
|
|
1415
|
-
defaultCache
|
|
1409
|
+
options
|
|
1416
1410
|
}) => {
|
|
1417
|
-
let cache =
|
|
1411
|
+
let cache = void 0;
|
|
1418
1412
|
if (options) {
|
|
1419
|
-
if (
|
|
1420
|
-
cache = options.cache;
|
|
1421
|
-
} else if (isStateCacheMode(options)) {
|
|
1413
|
+
if (isStateCacheMode(options)) {
|
|
1422
1414
|
if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
|
|
1423
1415
|
cache = {
|
|
1424
1416
|
type: "no-cache",
|
|
@@ -1443,7 +1435,10 @@ var shouldCacheBeDisabled = (options) => {
|
|
|
1443
1435
|
if (isDraftModeEnabled(options)) {
|
|
1444
1436
|
return { disabled: true, reason: "DRAFT" };
|
|
1445
1437
|
}
|
|
1446
|
-
if (isIncontextEditingEnabled(
|
|
1438
|
+
if (isIncontextEditingEnabled({
|
|
1439
|
+
isDraftModeEnabled: options.draftModeEnabled,
|
|
1440
|
+
searchParams: options.searchParams
|
|
1441
|
+
})) {
|
|
1447
1442
|
return { disabled: true, reason: "INCONTEXT" };
|
|
1448
1443
|
}
|
|
1449
1444
|
if (isDevelopmentEnvironment()) {
|
|
@@ -1614,7 +1609,47 @@ var generateManifestCacheTags = () => {
|
|
|
1614
1609
|
return ["manifest"];
|
|
1615
1610
|
};
|
|
1616
1611
|
|
|
1612
|
+
// src/clients/manifest.ts
|
|
1613
|
+
var getManifestClient = (options) => {
|
|
1614
|
+
const cache = resolveManifestCache(options);
|
|
1615
|
+
const manifestClient = new ManifestClient({
|
|
1616
|
+
apiHost: env.getApiHost(),
|
|
1617
|
+
apiKey: env.getApiKey(),
|
|
1618
|
+
projectId: env.getProjectId(),
|
|
1619
|
+
limitPolicy: createLimitPolicy2({
|
|
1620
|
+
limit: 6
|
|
1621
|
+
}),
|
|
1622
|
+
fetch: (req, init) => {
|
|
1623
|
+
const { cache: fetchCache, revalidate } = determineFetchCacheOptions(cache);
|
|
1624
|
+
return fetch(req, {
|
|
1625
|
+
...init,
|
|
1626
|
+
headers: {
|
|
1627
|
+
...init == null ? void 0 : init.headers,
|
|
1628
|
+
"x-bypass-cache": typeof cache.bypassCache !== "undefined" ? cache.bypassCache.toString() : "false"
|
|
1629
|
+
},
|
|
1630
|
+
cache: fetchCache,
|
|
1631
|
+
next: {
|
|
1632
|
+
revalidate,
|
|
1633
|
+
tags: generateManifestCacheTags()
|
|
1634
|
+
}
|
|
1635
|
+
});
|
|
1636
|
+
}
|
|
1637
|
+
});
|
|
1638
|
+
return manifestClient;
|
|
1639
|
+
};
|
|
1640
|
+
var getManifest = async (options) => {
|
|
1641
|
+
let preview = false;
|
|
1642
|
+
if (options && isStateCacheMode(options)) {
|
|
1643
|
+
preview = options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE;
|
|
1644
|
+
}
|
|
1645
|
+
const manifestClient = getManifestClient(options);
|
|
1646
|
+
return manifestClient.get({
|
|
1647
|
+
preview
|
|
1648
|
+
});
|
|
1649
|
+
};
|
|
1650
|
+
|
|
1617
1651
|
// src/clients/route.ts
|
|
1652
|
+
import "server-only";
|
|
1618
1653
|
var getRouteCacheTags = (requestedUrl) => {
|
|
1619
1654
|
const tags = ["route"];
|
|
1620
1655
|
if (requestedUrl) {
|
|
@@ -1664,52 +1699,27 @@ var getRouteClient = (options) => {
|
|
|
1664
1699
|
return client;
|
|
1665
1700
|
};
|
|
1666
1701
|
|
|
1667
|
-
// src/
|
|
1668
|
-
import "
|
|
1669
|
-
var
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
projectId: env.getProjectId(),
|
|
1675
|
-
limitPolicy: createLimitPolicy2({
|
|
1676
|
-
limit: 6
|
|
1677
|
-
}),
|
|
1678
|
-
fetch: (req, init) => {
|
|
1679
|
-
const { cache: fetchCache, revalidate } = determineFetchCacheOptions(cache);
|
|
1680
|
-
return fetch(req, {
|
|
1681
|
-
...init,
|
|
1682
|
-
headers: {
|
|
1683
|
-
...init == null ? void 0 : init.headers,
|
|
1684
|
-
"x-bypass-cache": typeof cache.bypassCache !== "undefined" ? cache.bypassCache.toString() : "false"
|
|
1685
|
-
},
|
|
1686
|
-
cache: fetchCache,
|
|
1687
|
-
next: {
|
|
1688
|
-
revalidate,
|
|
1689
|
-
tags: generateManifestCacheTags()
|
|
1690
|
-
}
|
|
1691
|
-
});
|
|
1692
|
-
}
|
|
1693
|
-
});
|
|
1694
|
-
return manifestClient;
|
|
1702
|
+
// src/config/helpers.ts
|
|
1703
|
+
import config from "@uniformdev/next-app-router/config/resolved";
|
|
1704
|
+
var getMiddlewareRuntimeCache = () => {
|
|
1705
|
+
if (typeof config.middlewareRuntimeCache === "boolean") {
|
|
1706
|
+
return config.middlewareRuntimeCache;
|
|
1707
|
+
}
|
|
1708
|
+
return true;
|
|
1695
1709
|
};
|
|
1696
|
-
var
|
|
1697
|
-
|
|
1698
|
-
if (
|
|
1699
|
-
|
|
1710
|
+
var getDisableSwrMiddlewareCache = () => {
|
|
1711
|
+
var _a;
|
|
1712
|
+
if (typeof ((_a = config.experimental) == null ? void 0 : _a.disableSwrMiddlewareCache) === "boolean") {
|
|
1713
|
+
return config.experimental.disableSwrMiddlewareCache;
|
|
1700
1714
|
}
|
|
1701
|
-
|
|
1702
|
-
return manifestClient.get({
|
|
1703
|
-
preview
|
|
1704
|
-
});
|
|
1715
|
+
return false;
|
|
1705
1716
|
};
|
|
1706
1717
|
|
|
1707
1718
|
// src/data/client.ts
|
|
1708
1719
|
var MANIFEST_CACHE_KEY = "uniform-manifest";
|
|
1709
1720
|
var DefaultDataClient = class {
|
|
1710
1721
|
async getManifest(options) {
|
|
1711
|
-
|
|
1712
|
-
const cache = options.source === "middleware" && ((_b = (_a = getServerConfig().experimental) == null ? void 0 : _a.middlewareRuntimeCache) != null ? _b : false) ? getCache() : null;
|
|
1722
|
+
const cache = options.source === "middleware" && getMiddlewareRuntimeCache() ? getCache() : null;
|
|
1713
1723
|
if (cache) {
|
|
1714
1724
|
const cachedManifest = await cache.get(MANIFEST_CACHE_KEY);
|
|
1715
1725
|
if (cachedManifest) {
|
|
@@ -1795,18 +1805,16 @@ var DefaultDataClient = class {
|
|
|
1795
1805
|
async enhanceRoute(_options) {
|
|
1796
1806
|
}
|
|
1797
1807
|
async getRouteMiddleware(options) {
|
|
1798
|
-
var _a, _b, _c, _d;
|
|
1799
1808
|
const routeClient = getRouteClient({
|
|
1800
1809
|
searchParams: options.searchParams,
|
|
1801
1810
|
draftModeEnabled: options.draftModeEnabled
|
|
1802
1811
|
});
|
|
1803
|
-
const config = getServerConfig();
|
|
1804
1812
|
const resolvedRoute = await this.getRouteFromApi({
|
|
1805
1813
|
source: "middleware",
|
|
1806
1814
|
route: options.route,
|
|
1807
1815
|
routeClient,
|
|
1808
|
-
enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && (
|
|
1809
|
-
disableSwrCache: (
|
|
1816
|
+
enableRuntimeCache: options.route.state === CANVAS_PUBLISHED_STATE && getMiddlewareRuntimeCache(),
|
|
1817
|
+
disableSwrCache: getDisableSwrMiddlewareCache()
|
|
1810
1818
|
});
|
|
1811
1819
|
if (resolvedRoute.type === "composition") {
|
|
1812
1820
|
await this.enhanceRoute({
|
|
@@ -1822,12 +1830,12 @@ var DefaultDataClient = class {
|
|
|
1822
1830
|
};
|
|
1823
1831
|
}
|
|
1824
1832
|
async getRoutePageState(options) {
|
|
1825
|
-
var _a;
|
|
1826
1833
|
const routeClient = getRouteClient({
|
|
1827
|
-
cache: options.pageState.compositionState === CANVAS_PUBLISHED_STATE ?
|
|
1834
|
+
cache: options.pageState.compositionState === CANVAS_PUBLISHED_STATE ? {
|
|
1828
1835
|
type: "force-cache"
|
|
1829
1836
|
} : {
|
|
1830
|
-
type: "no-cache"
|
|
1837
|
+
type: "no-cache",
|
|
1838
|
+
bypassCache: true
|
|
1831
1839
|
}
|
|
1832
1840
|
});
|
|
1833
1841
|
const originalRoute = {
|
|
@@ -1889,13 +1897,6 @@ var resolveRouteFromCode2 = async ({
|
|
|
1889
1897
|
code,
|
|
1890
1898
|
dataClient: providedDataClient
|
|
1891
1899
|
});
|
|
1892
|
-
if (process.env.NODE_ENV === "development") {
|
|
1893
|
-
cacheLife({
|
|
1894
|
-
expire: 0,
|
|
1895
|
-
revalidate: 0,
|
|
1896
|
-
stale: 0
|
|
1897
|
-
});
|
|
1898
|
-
}
|
|
1899
1900
|
return result;
|
|
1900
1901
|
};
|
|
1901
1902
|
export {
|
package/dist/compat.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { ComponentType } from 'react';
|
|
2
2
|
import { ComponentProps as ComponentProps$1, ComponentParameter } from '@uniformdev/next-app-router-shared';
|
|
3
3
|
import { U as UniformTextProps$1 } from './UniformText-ChMwHBw4.mjs';
|
|
4
|
-
import { R as ResolveComponentResult, a as ResolveComponentFunction } from './UniformComposition-
|
|
4
|
+
import { R as ResolveComponentResult, a as ResolveComponentFunction } from './UniformComposition-hhRIBHmn.mjs';
|
|
5
5
|
import '@uniformdev/next-app-router-client';
|
|
6
6
|
import '@uniformdev/canvas';
|
|
7
|
-
import './resolveRouteFromCode-CKaYNXte.mjs';
|
|
8
7
|
import './client-BCGVjYM-.mjs';
|
|
9
8
|
import '@uniformdev/context';
|
|
9
|
+
import './resolveRouteFromCode-CKaYNXte.mjs';
|
|
10
10
|
|
|
11
11
|
type ComponentContext = ComponentProps$1['component'] & {
|
|
12
12
|
parameters: Record<string, ComponentParameter>;
|
package/dist/compat.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { ComponentType } from 'react';
|
|
2
2
|
import { ComponentProps as ComponentProps$1, ComponentParameter } from '@uniformdev/next-app-router-shared';
|
|
3
3
|
import { U as UniformTextProps$1 } from './UniformText-ChMwHBw4.js';
|
|
4
|
-
import { R as ResolveComponentResult, a as ResolveComponentFunction } from './UniformComposition-
|
|
4
|
+
import { R as ResolveComponentResult, a as ResolveComponentFunction } from './UniformComposition-d7_93l3F.js';
|
|
5
5
|
import '@uniformdev/next-app-router-client';
|
|
6
6
|
import '@uniformdev/canvas';
|
|
7
|
-
import './resolveRouteFromCode-DgTsfMK8.js';
|
|
8
7
|
import './client-BCGVjYM-.js';
|
|
9
8
|
import '@uniformdev/context';
|
|
9
|
+
import './resolveRouteFromCode-DgTsfMK8.js';
|
|
10
10
|
|
|
11
11
|
type ComponentContext = ComponentProps$1['component'] & {
|
|
12
12
|
parameters: Record<string, ComponentParameter>;
|
package/dist/component.js
CHANGED
|
@@ -1123,6 +1123,9 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1123
1123
|
};
|
|
1124
1124
|
_url8 = /* @__PURE__ */ new WeakMap();
|
|
1125
1125
|
__privateAdd2(_DataTypeClient, _url8, "/api/v1/data-types");
|
|
1126
|
+
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1127
|
+
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1128
|
+
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1126
1129
|
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1127
1130
|
var _baseUrl;
|
|
1128
1131
|
var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2 extends ApiClient {
|
package/dist/component.mjs
CHANGED
|
@@ -1108,6 +1108,9 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1108
1108
|
};
|
|
1109
1109
|
_url8 = /* @__PURE__ */ new WeakMap();
|
|
1110
1110
|
__privateAdd2(_DataTypeClient, _url8, "/api/v1/data-types");
|
|
1111
|
+
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1112
|
+
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1113
|
+
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1111
1114
|
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1112
1115
|
var _baseUrl;
|
|
1113
1116
|
var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2 extends ApiClient {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/config/default.ts
|
|
21
|
+
var default_exports = {};
|
|
22
|
+
__export(default_exports, {
|
|
23
|
+
default: () => default_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(default_exports);
|
|
26
|
+
var config = {
|
|
27
|
+
defaultConsent: true,
|
|
28
|
+
quirkSerialization: true,
|
|
29
|
+
middlewareRuntimeCache: true,
|
|
30
|
+
playgroundPath: "/uniform/playground"
|
|
31
|
+
};
|
|
32
|
+
var default_default = config;
|