@uniformdev/next-app-router 20.50.2-alpha.9 → 20.50.2-alpha.96
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/{UniformComposition-d7_93l3F.d.ts → UniformComposition-BV6YnA2a.d.ts} +2 -2
- package/dist/{UniformComposition-hhRIBHmn.d.mts → UniformComposition-scIgVvIH.d.mts} +2 -2
- package/dist/cache.d.mts +2 -2
- package/dist/cache.d.ts +2 -2
- package/dist/cache.js +47 -21
- package/dist/cache.mjs +47 -21
- package/dist/{client-BCGVjYM-.d.mts → client-BlKZeE6C.d.mts} +1 -1
- package/dist/{client-BCGVjYM-.d.ts → client-BlKZeE6C.d.ts} +1 -1
- package/dist/compat.d.mts +3 -3
- package/dist/compat.d.ts +3 -3
- package/dist/component.js +27 -15
- package/dist/component.mjs +27 -15
- package/dist/handler.js +34 -17
- package/dist/handler.mjs +34 -17
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.esm.js +91 -61
- package/dist/index.js +91 -61
- package/dist/index.mjs +91 -61
- package/dist/middleware.d.mts +2 -2
- package/dist/middleware.d.ts +2 -2
- package/dist/middleware.js +108 -75
- package/dist/middleware.mjs +108 -75
- package/dist/{resolveRouteFromCode-DgTsfMK8.d.ts → resolveRouteFromCode-3u61IwOW.d.ts} +1 -1
- package/dist/{resolveRouteFromCode-CKaYNXte.d.mts → resolveRouteFromCode-_CdAMtVM.d.mts} +1 -1
- package/package.json +10 -10
package/dist/handler.mjs
CHANGED
|
@@ -319,6 +319,20 @@ async function handleRateLimits(callApi) {
|
|
|
319
319
|
}
|
|
320
320
|
return response;
|
|
321
321
|
}
|
|
322
|
+
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
323
|
+
function rewriteFiltersForApi(filters) {
|
|
324
|
+
return Object.entries(filters != null ? filters : {}).reduce(
|
|
325
|
+
(acc, [key, value]) => {
|
|
326
|
+
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
327
|
+
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
328
|
+
return {
|
|
329
|
+
...acc,
|
|
330
|
+
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
331
|
+
};
|
|
332
|
+
},
|
|
333
|
+
{}
|
|
334
|
+
);
|
|
335
|
+
}
|
|
322
336
|
var _url;
|
|
323
337
|
var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
324
338
|
constructor(options) {
|
|
@@ -1101,20 +1115,6 @@ function createLimitPolicy({
|
|
|
1101
1115
|
return currentFunc();
|
|
1102
1116
|
};
|
|
1103
1117
|
}
|
|
1104
|
-
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
1105
|
-
function rewriteFilters(filters) {
|
|
1106
|
-
return Object.entries(filters != null ? filters : {}).reduce(
|
|
1107
|
-
(acc, [key, value]) => {
|
|
1108
|
-
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
1109
|
-
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
1110
|
-
return {
|
|
1111
|
-
...acc,
|
|
1112
|
-
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
1113
|
-
};
|
|
1114
|
-
},
|
|
1115
|
-
{}
|
|
1116
|
-
);
|
|
1117
|
-
}
|
|
1118
1118
|
var CANVAS_URL = "/api/v1/canvas";
|
|
1119
1119
|
var CanvasClient = class extends ApiClient {
|
|
1120
1120
|
constructor(options) {
|
|
@@ -1130,7 +1130,7 @@ var CanvasClient = class extends ApiClient {
|
|
|
1130
1130
|
async getCompositionList(params = {}) {
|
|
1131
1131
|
const { projectId } = this.options;
|
|
1132
1132
|
const { resolveData, filters, ...originParams } = params;
|
|
1133
|
-
const rewrittenFilters =
|
|
1133
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1134
1134
|
if (!resolveData) {
|
|
1135
1135
|
const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
|
|
1136
1136
|
return this.apiClient(fetchUri);
|
|
@@ -1250,7 +1250,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1250
1250
|
getEntries(options) {
|
|
1251
1251
|
const { projectId } = this.options;
|
|
1252
1252
|
const { skipDataResolution, filters, ...params } = options;
|
|
1253
|
-
const rewrittenFilters =
|
|
1253
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1254
1254
|
if (skipDataResolution) {
|
|
1255
1255
|
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
|
|
1256
1256
|
return this.apiClient(url);
|
|
@@ -1488,6 +1488,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1488
1488
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
1489
1489
|
__privateAdd2(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
1490
1490
|
var _url22;
|
|
1491
|
+
var _projectsUrl;
|
|
1491
1492
|
var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
1492
1493
|
constructor(options) {
|
|
1493
1494
|
super({ ...options, bypassCache: true });
|
|
@@ -1497,6 +1498,15 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1497
1498
|
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22), { ...options });
|
|
1498
1499
|
return await this.apiClient(fetchUri);
|
|
1499
1500
|
}
|
|
1501
|
+
/**
|
|
1502
|
+
* Fetches projects grouped by team.
|
|
1503
|
+
* When teamId is provided, returns a single team with its projects.
|
|
1504
|
+
* When omitted, returns all accessible teams and their projects.
|
|
1505
|
+
*/
|
|
1506
|
+
async getProjects(options) {
|
|
1507
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
1508
|
+
return await this.apiClient(fetchUri);
|
|
1509
|
+
}
|
|
1500
1510
|
/** Updates or creates (based on id) a Project */
|
|
1501
1511
|
async upsert(body) {
|
|
1502
1512
|
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
|
|
@@ -1516,7 +1526,9 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1516
1526
|
}
|
|
1517
1527
|
};
|
|
1518
1528
|
_url22 = /* @__PURE__ */ new WeakMap();
|
|
1529
|
+
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
1519
1530
|
__privateAdd2(_ProjectClient, _url22, "/api/v1/project");
|
|
1531
|
+
__privateAdd2(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
1520
1532
|
var isAllowedReferrer = (referrer) => {
|
|
1521
1533
|
return Boolean(referrer == null ? void 0 : referrer.match(/(^https:\/\/|\.)(uniform.app|uniform.wtf|localhost:\d{4})\//));
|
|
1522
1534
|
};
|
|
@@ -1759,6 +1771,9 @@ var isDevelopmentEnvironment = () => {
|
|
|
1759
1771
|
};
|
|
1760
1772
|
|
|
1761
1773
|
// src/clients/cache.ts
|
|
1774
|
+
var isSpecificCacheMode = (options) => {
|
|
1775
|
+
return "cache" in options;
|
|
1776
|
+
};
|
|
1762
1777
|
var isStateCacheMode = (options) => {
|
|
1763
1778
|
return "state" in options;
|
|
1764
1779
|
};
|
|
@@ -1780,7 +1795,9 @@ var resolveCache = ({
|
|
|
1780
1795
|
}) => {
|
|
1781
1796
|
let cache = void 0;
|
|
1782
1797
|
if (options) {
|
|
1783
|
-
if (
|
|
1798
|
+
if (isSpecificCacheMode(options)) {
|
|
1799
|
+
cache = options.cache;
|
|
1800
|
+
} else if (isStateCacheMode(options)) {
|
|
1784
1801
|
if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
|
|
1785
1802
|
cache = {
|
|
1786
1803
|
type: "no-cache",
|
package/dist/index.d.mts
CHANGED
|
@@ -2,12 +2,12 @@ import { CanvasClient, RouteClient, ComponentInstance } from '@uniformdev/canvas
|
|
|
2
2
|
import { CacheMode, CanvasCacheMode, ManifestCacheMode, ProjectMapCacheMode, RewriteRequestPathResult } from '@uniformdev/next-app-router-shared';
|
|
3
3
|
import { ManifestClient } from '@uniformdev/context/api';
|
|
4
4
|
import { ProjectMapClient } from '@uniformdev/project-map';
|
|
5
|
-
import { U as UniformCompositionProps } from './UniformComposition-
|
|
6
|
-
export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-
|
|
5
|
+
import { U as UniformCompositionProps } from './UniformComposition-scIgVvIH.mjs';
|
|
6
|
+
export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-scIgVvIH.mjs';
|
|
7
7
|
import React from 'react';
|
|
8
|
-
export { D as DataClient, a as DefaultDataClient, E as EnhanceRouteOptions, G as GetRouteFromMiddlewareOptions, b as GetRouteFromPageStateOptions, c as GetRouteOptions, R as RewriteRouteOptions, d as RewriteRouteResult, e as expireMiddlewareCacheTag } from './client-
|
|
9
|
-
import { a as ResolvedRouteResult } from './resolveRouteFromCode-
|
|
10
|
-
export { R as ResolveRouteFunction, r as resolveRouteFromCode } from './resolveRouteFromCode-
|
|
8
|
+
export { D as DataClient, a as DefaultDataClient, E as EnhanceRouteOptions, G as GetRouteFromMiddlewareOptions, b as GetRouteFromPageStateOptions, c as GetRouteOptions, R as RewriteRouteOptions, d as RewriteRouteResult, e as expireMiddlewareCacheTag } from './client-BlKZeE6C.mjs';
|
|
9
|
+
import { a as ResolvedRouteResult } from './resolveRouteFromCode-_CdAMtVM.mjs';
|
|
10
|
+
export { R as ResolveRouteFunction, r as resolveRouteFromCode } from './resolveRouteFromCode-_CdAMtVM.mjs';
|
|
11
11
|
import '@uniformdev/next-app-router-client';
|
|
12
12
|
import '@uniformdev/context';
|
|
13
13
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ import { CanvasClient, RouteClient, ComponentInstance } from '@uniformdev/canvas
|
|
|
2
2
|
import { CacheMode, CanvasCacheMode, ManifestCacheMode, ProjectMapCacheMode, RewriteRequestPathResult } from '@uniformdev/next-app-router-shared';
|
|
3
3
|
import { ManifestClient } from '@uniformdev/context/api';
|
|
4
4
|
import { ProjectMapClient } from '@uniformdev/project-map';
|
|
5
|
-
import { U as UniformCompositionProps } from './UniformComposition-
|
|
6
|
-
export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-
|
|
5
|
+
import { U as UniformCompositionProps } from './UniformComposition-BV6YnA2a.js';
|
|
6
|
+
export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-BV6YnA2a.js';
|
|
7
7
|
import React from 'react';
|
|
8
|
-
export { D as DataClient, a as DefaultDataClient, E as EnhanceRouteOptions, G as GetRouteFromMiddlewareOptions, b as GetRouteFromPageStateOptions, c as GetRouteOptions, R as RewriteRouteOptions, d as RewriteRouteResult, e as expireMiddlewareCacheTag } from './client-
|
|
9
|
-
import { a as ResolvedRouteResult } from './resolveRouteFromCode-
|
|
10
|
-
export { R as ResolveRouteFunction, r as resolveRouteFromCode } from './resolveRouteFromCode-
|
|
8
|
+
export { D as DataClient, a as DefaultDataClient, E as EnhanceRouteOptions, G as GetRouteFromMiddlewareOptions, b as GetRouteFromPageStateOptions, c as GetRouteOptions, R as RewriteRouteOptions, d as RewriteRouteResult, e as expireMiddlewareCacheTag } from './client-BlKZeE6C.js';
|
|
9
|
+
import { a as ResolvedRouteResult } from './resolveRouteFromCode-3u61IwOW.js';
|
|
10
|
+
export { R as ResolveRouteFunction, r as resolveRouteFromCode } from './resolveRouteFromCode-3u61IwOW.js';
|
|
11
11
|
import '@uniformdev/next-app-router-client';
|
|
12
12
|
import '@uniformdev/context';
|
|
13
13
|
|
package/dist/index.esm.js
CHANGED
|
@@ -325,6 +325,20 @@ async function handleRateLimits(callApi) {
|
|
|
325
325
|
}
|
|
326
326
|
return response;
|
|
327
327
|
}
|
|
328
|
+
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
329
|
+
function rewriteFiltersForApi(filters) {
|
|
330
|
+
return Object.entries(filters != null ? filters : {}).reduce(
|
|
331
|
+
(acc, [key, value]) => {
|
|
332
|
+
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
333
|
+
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
334
|
+
return {
|
|
335
|
+
...acc,
|
|
336
|
+
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
337
|
+
};
|
|
338
|
+
},
|
|
339
|
+
{}
|
|
340
|
+
);
|
|
341
|
+
}
|
|
328
342
|
var _url;
|
|
329
343
|
var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
330
344
|
constructor(options) {
|
|
@@ -1108,20 +1122,6 @@ function createLimitPolicy({
|
|
|
1108
1122
|
return currentFunc();
|
|
1109
1123
|
};
|
|
1110
1124
|
}
|
|
1111
|
-
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
1112
|
-
function rewriteFilters(filters) {
|
|
1113
|
-
return Object.entries(filters != null ? filters : {}).reduce(
|
|
1114
|
-
(acc, [key, value]) => {
|
|
1115
|
-
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
1116
|
-
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
1117
|
-
return {
|
|
1118
|
-
...acc,
|
|
1119
|
-
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
1120
|
-
};
|
|
1121
|
-
},
|
|
1122
|
-
{}
|
|
1123
|
-
);
|
|
1124
|
-
}
|
|
1125
1125
|
var CANVAS_URL = "/api/v1/canvas";
|
|
1126
1126
|
var CanvasClient = class extends ApiClient {
|
|
1127
1127
|
constructor(options) {
|
|
@@ -1137,7 +1137,7 @@ var CanvasClient = class extends ApiClient {
|
|
|
1137
1137
|
async getCompositionList(params = {}) {
|
|
1138
1138
|
const { projectId } = this.options;
|
|
1139
1139
|
const { resolveData, filters, ...originParams } = params;
|
|
1140
|
-
const rewrittenFilters =
|
|
1140
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1141
1141
|
if (!resolveData) {
|
|
1142
1142
|
const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
|
|
1143
1143
|
return this.apiClient(fetchUri);
|
|
@@ -1257,7 +1257,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1257
1257
|
getEntries(options) {
|
|
1258
1258
|
const { projectId } = this.options;
|
|
1259
1259
|
const { skipDataResolution, filters, ...params } = options;
|
|
1260
|
-
const rewrittenFilters =
|
|
1260
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1261
1261
|
if (skipDataResolution) {
|
|
1262
1262
|
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
|
|
1263
1263
|
return this.apiClient(url);
|
|
@@ -1506,7 +1506,7 @@ function hasReferencedVariables(value) {
|
|
|
1506
1506
|
return variableTokenCount;
|
|
1507
1507
|
}
|
|
1508
1508
|
function walkNodeTree(node, visitor, options) {
|
|
1509
|
-
var _a, _b;
|
|
1509
|
+
var _a, _b, _c;
|
|
1510
1510
|
const componentQueue = [
|
|
1511
1511
|
{
|
|
1512
1512
|
ancestorsAndSelf: Array.isArray(node) ? node : [{ node, type: "root" }],
|
|
@@ -1514,12 +1514,14 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1514
1514
|
}
|
|
1515
1515
|
];
|
|
1516
1516
|
const childContexts = /* @__PURE__ */ new Map();
|
|
1517
|
+
const order = (_a = options == null ? void 0 : options.order) != null ? _a : "dfs";
|
|
1518
|
+
const takeNext = () => order === "bfs" ? componentQueue.shift() : componentQueue.pop();
|
|
1517
1519
|
do {
|
|
1518
|
-
const currentQueueEntry =
|
|
1520
|
+
const currentQueueEntry = takeNext();
|
|
1519
1521
|
if (!currentQueueEntry) continue;
|
|
1520
1522
|
const currentComponent = currentQueueEntry.ancestorsAndSelf[0];
|
|
1521
1523
|
let visitDescendants = true;
|
|
1522
|
-
let descendantContext = (
|
|
1524
|
+
let descendantContext = (_b = childContexts.get(currentComponent.node)) != null ? _b : currentQueueEntry.context;
|
|
1523
1525
|
let visitorInfo;
|
|
1524
1526
|
if (currentComponent.type === "root" && isRootEntryReference(currentComponent) || currentComponent.type === "block") {
|
|
1525
1527
|
visitorInfo = {
|
|
@@ -1706,39 +1708,11 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1706
1708
|
continue;
|
|
1707
1709
|
}
|
|
1708
1710
|
const slots = "slots" in currentComponent.node && currentComponent.node.slots;
|
|
1709
|
-
|
|
1710
|
-
const slotKeys = Object.keys(slots);
|
|
1711
|
-
for (let slotIndex = slotKeys.length - 1; slotIndex >= 0; slotIndex--) {
|
|
1712
|
-
const slotKey = slotKeys[slotIndex];
|
|
1713
|
-
const components = slots[slotKey];
|
|
1714
|
-
for (let componentIndex = components.length - 1; componentIndex >= 0; componentIndex--) {
|
|
1715
|
-
const enqueueingComponent = components[componentIndex];
|
|
1716
|
-
const parentSlotIndexFn = () => {
|
|
1717
|
-
const result = currentComponent.node.slots[slotKey].findIndex(
|
|
1718
|
-
(x) => x === enqueueingComponent
|
|
1719
|
-
);
|
|
1720
|
-
return result;
|
|
1721
|
-
};
|
|
1722
|
-
componentQueue.push({
|
|
1723
|
-
ancestorsAndSelf: [
|
|
1724
|
-
{
|
|
1725
|
-
type: "slot",
|
|
1726
|
-
node: enqueueingComponent,
|
|
1727
|
-
parentSlot: slotKey,
|
|
1728
|
-
parentSlotIndexFn
|
|
1729
|
-
},
|
|
1730
|
-
...currentQueueEntry.ancestorsAndSelf
|
|
1731
|
-
],
|
|
1732
|
-
context: descendantContext
|
|
1733
|
-
});
|
|
1734
|
-
}
|
|
1735
|
-
}
|
|
1736
|
-
}
|
|
1711
|
+
const childEntries = [];
|
|
1737
1712
|
const properties = getPropertiesValue(currentComponent.node);
|
|
1738
1713
|
if (properties) {
|
|
1739
1714
|
const propertyEntries = Object.entries(properties);
|
|
1740
|
-
for (
|
|
1741
|
-
const [propKey, propObject] = propertyEntries[propIndex];
|
|
1715
|
+
for (const [propKey, propObject] of propertyEntries) {
|
|
1742
1716
|
if (!isNestedNodeType(propObject.type)) {
|
|
1743
1717
|
continue;
|
|
1744
1718
|
}
|
|
@@ -1758,13 +1732,12 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1758
1732
|
continue;
|
|
1759
1733
|
}
|
|
1760
1734
|
}
|
|
1761
|
-
const blocks = (
|
|
1762
|
-
for (
|
|
1763
|
-
const enqueueingBlock = blocks[blockIndex];
|
|
1735
|
+
const blocks = (_c = propObject.value) != null ? _c : [];
|
|
1736
|
+
for (const enqueueingBlock of blocks) {
|
|
1764
1737
|
const blockIndexFn = () => {
|
|
1765
1738
|
return getBlockValue(currentComponent.node, propKey).findIndex((x) => x === enqueueingBlock);
|
|
1766
1739
|
};
|
|
1767
|
-
|
|
1740
|
+
childEntries.push({
|
|
1768
1741
|
ancestorsAndSelf: [
|
|
1769
1742
|
{
|
|
1770
1743
|
type: "block",
|
|
@@ -1779,6 +1752,36 @@ function walkNodeTree(node, visitor, options) {
|
|
|
1779
1752
|
}
|
|
1780
1753
|
}
|
|
1781
1754
|
}
|
|
1755
|
+
if (slots) {
|
|
1756
|
+
const slotKeys = Object.keys(slots);
|
|
1757
|
+
for (const slotKey of slotKeys) {
|
|
1758
|
+
const components = slots[slotKey];
|
|
1759
|
+
for (const enqueueingComponent of components) {
|
|
1760
|
+
const parentSlotIndexFn = () => {
|
|
1761
|
+
const result = currentComponent.node.slots[slotKey].findIndex(
|
|
1762
|
+
(x) => x === enqueueingComponent
|
|
1763
|
+
);
|
|
1764
|
+
return result;
|
|
1765
|
+
};
|
|
1766
|
+
childEntries.push({
|
|
1767
|
+
ancestorsAndSelf: [
|
|
1768
|
+
{
|
|
1769
|
+
type: "slot",
|
|
1770
|
+
node: enqueueingComponent,
|
|
1771
|
+
parentSlot: slotKey,
|
|
1772
|
+
parentSlotIndexFn
|
|
1773
|
+
},
|
|
1774
|
+
...currentQueueEntry.ancestorsAndSelf
|
|
1775
|
+
],
|
|
1776
|
+
context: descendantContext
|
|
1777
|
+
});
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
if (order === "dfs") {
|
|
1782
|
+
childEntries.reverse();
|
|
1783
|
+
}
|
|
1784
|
+
componentQueue.push(...childEntries);
|
|
1782
1785
|
} while (componentQueue.length > 0);
|
|
1783
1786
|
}
|
|
1784
1787
|
function isNestedNodeType(type) {
|
|
@@ -1849,6 +1852,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1849
1852
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
1850
1853
|
__privateAdd2(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
1851
1854
|
var _url22;
|
|
1855
|
+
var _projectsUrl;
|
|
1852
1856
|
var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
1853
1857
|
constructor(options) {
|
|
1854
1858
|
super({ ...options, bypassCache: true });
|
|
@@ -1858,6 +1862,15 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1858
1862
|
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22), { ...options });
|
|
1859
1863
|
return await this.apiClient(fetchUri);
|
|
1860
1864
|
}
|
|
1865
|
+
/**
|
|
1866
|
+
* Fetches projects grouped by team.
|
|
1867
|
+
* When teamId is provided, returns a single team with its projects.
|
|
1868
|
+
* When omitted, returns all accessible teams and their projects.
|
|
1869
|
+
*/
|
|
1870
|
+
async getProjects(options) {
|
|
1871
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
1872
|
+
return await this.apiClient(fetchUri);
|
|
1873
|
+
}
|
|
1861
1874
|
/** Updates or creates (based on id) a Project */
|
|
1862
1875
|
async upsert(body) {
|
|
1863
1876
|
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
|
|
@@ -1877,7 +1890,9 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1877
1890
|
}
|
|
1878
1891
|
};
|
|
1879
1892
|
_url22 = /* @__PURE__ */ new WeakMap();
|
|
1893
|
+
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
1880
1894
|
__privateAdd2(_ProjectClient, _url22, "/api/v1/project");
|
|
1895
|
+
__privateAdd2(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
1881
1896
|
var ROUTE_URL = "/api/v1/route";
|
|
1882
1897
|
var RouteClient = class extends ApiClient {
|
|
1883
1898
|
constructor(options) {
|
|
@@ -1979,8 +1994,15 @@ var isIncontextEditingEnabled = ({
|
|
|
1979
1994
|
var isDevelopmentEnvironment = () => {
|
|
1980
1995
|
return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
1981
1996
|
};
|
|
1997
|
+
var shouldIgnoreRedirects = ({ state }) => {
|
|
1998
|
+
const isNotPublished = state !== CANVAS_PUBLISHED_STATE;
|
|
1999
|
+
return isNotPublished ? true : void 0;
|
|
2000
|
+
};
|
|
1982
2001
|
|
|
1983
2002
|
// src/clients/cache.ts
|
|
2003
|
+
var isSpecificCacheMode = (options) => {
|
|
2004
|
+
return "cache" in options;
|
|
2005
|
+
};
|
|
1984
2006
|
var isStateCacheMode = (options) => {
|
|
1985
2007
|
return "state" in options;
|
|
1986
2008
|
};
|
|
@@ -2007,7 +2029,9 @@ var resolveCache = ({
|
|
|
2007
2029
|
}) => {
|
|
2008
2030
|
let cache2 = void 0;
|
|
2009
2031
|
if (options) {
|
|
2010
|
-
if (
|
|
2032
|
+
if (isSpecificCacheMode(options)) {
|
|
2033
|
+
cache2 = options.cache;
|
|
2034
|
+
} else if (isStateCacheMode(options)) {
|
|
2011
2035
|
if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
|
|
2012
2036
|
cache2 = {
|
|
2013
2037
|
type: "no-cache",
|
|
@@ -2763,7 +2787,7 @@ var createTestComponentProps = ({
|
|
|
2763
2787
|
const [testIndex] = (_a = component == null ? void 0 : component.indexes) != null ? _a : [];
|
|
2764
2788
|
return {
|
|
2765
2789
|
...common,
|
|
2766
|
-
index: testIndex
|
|
2790
|
+
index: testIndex,
|
|
2767
2791
|
test
|
|
2768
2792
|
};
|
|
2769
2793
|
};
|
|
@@ -3598,8 +3622,9 @@ var generatePossiblePageStates = ({
|
|
|
3598
3622
|
locale,
|
|
3599
3623
|
isPrefetch: void 0
|
|
3600
3624
|
};
|
|
3625
|
+
const allComponentIds = runnables.filter((r) => r.type === "test" || r.type === "personalization").map((r) => r._id);
|
|
3601
3626
|
const allStates = generateStatesRecursively(dependencyMap, void 0, initialState);
|
|
3602
|
-
return allStates.map((payload) => serializeEvaluationResult({ payload }));
|
|
3627
|
+
return allStates.map((payload) => serializeEvaluationResult({ payload, allComponentIds }));
|
|
3603
3628
|
};
|
|
3604
3629
|
function permutationsWithoutRepetition(options, k) {
|
|
3605
3630
|
if (k === 0) return [[]];
|
|
@@ -3648,7 +3673,10 @@ var DefaultDataClient = class {
|
|
|
3648
3673
|
}
|
|
3649
3674
|
}
|
|
3650
3675
|
const manifest = await getManifest({
|
|
3651
|
-
cache: {
|
|
3676
|
+
cache: isDevelopmentEnvironment() ? {
|
|
3677
|
+
type: "no-cache",
|
|
3678
|
+
bypassCache: true
|
|
3679
|
+
} : {
|
|
3652
3680
|
type: "force-cache"
|
|
3653
3681
|
}
|
|
3654
3682
|
});
|
|
@@ -3751,12 +3779,13 @@ var DefaultDataClient = class {
|
|
|
3751
3779
|
};
|
|
3752
3780
|
}
|
|
3753
3781
|
async getRoutePageState(options) {
|
|
3782
|
+
const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
|
|
3754
3783
|
const routeClient = getRouteClient({
|
|
3755
|
-
cache:
|
|
3756
|
-
type: "force-cache"
|
|
3757
|
-
} : {
|
|
3784
|
+
cache: shouldBypassCache ? {
|
|
3758
3785
|
type: "no-cache",
|
|
3759
3786
|
bypassCache: true
|
|
3787
|
+
} : {
|
|
3788
|
+
type: "force-cache"
|
|
3760
3789
|
}
|
|
3761
3790
|
});
|
|
3762
3791
|
const originalRoute = {
|
|
@@ -3764,7 +3793,8 @@ var DefaultDataClient = class {
|
|
|
3764
3793
|
state: options.pageState.compositionState,
|
|
3765
3794
|
withComponentIDs: true,
|
|
3766
3795
|
releaseId: options.pageState.releaseId,
|
|
3767
|
-
locale: options.pageState.locale
|
|
3796
|
+
locale: options.pageState.locale,
|
|
3797
|
+
ignoreRedirects: shouldIgnoreRedirects({ state: options.pageState.compositionState })
|
|
3768
3798
|
};
|
|
3769
3799
|
const resolvedRoute = await this.getRouteFromApi({
|
|
3770
3800
|
source: "pageState",
|