@uniformdev/next-app-router 20.49.3-alpha.9 → 20.49.4-alpha.102
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 +19 -16
- package/dist/cache.mjs +19 -16
- package/dist/component.js +16 -16
- package/dist/component.mjs +16 -16
- package/dist/handler.js +20 -17
- package/dist/handler.mjs +20 -17
- package/dist/index.esm.js +38 -19
- package/dist/index.js +46 -27
- package/dist/index.mjs +38 -19
- package/dist/middleware.js +66 -25
- package/dist/middleware.mjs +66 -25
- package/package.json +8 -8
package/dist/cache.js
CHANGED
|
@@ -330,11 +330,25 @@ async function handleRateLimits(callApi) {
|
|
|
330
330
|
}
|
|
331
331
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
332
332
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
333
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
333
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
334
334
|
backoffRetriesLeft -= 1;
|
|
335
335
|
}
|
|
336
336
|
return response;
|
|
337
337
|
}
|
|
338
|
+
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
339
|
+
function rewriteFiltersForApi(filters) {
|
|
340
|
+
return Object.entries(filters != null ? filters : {}).reduce(
|
|
341
|
+
(acc, [key, value]) => {
|
|
342
|
+
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
343
|
+
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
344
|
+
return {
|
|
345
|
+
...acc,
|
|
346
|
+
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
347
|
+
};
|
|
348
|
+
},
|
|
349
|
+
{}
|
|
350
|
+
);
|
|
351
|
+
}
|
|
338
352
|
var _url;
|
|
339
353
|
var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
340
354
|
constructor(options) {
|
|
@@ -1118,20 +1132,6 @@ function createLimitPolicy({
|
|
|
1118
1132
|
return currentFunc();
|
|
1119
1133
|
};
|
|
1120
1134
|
}
|
|
1121
|
-
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
1122
|
-
function rewriteFilters(filters) {
|
|
1123
|
-
return Object.entries(filters != null ? filters : {}).reduce(
|
|
1124
|
-
(acc, [key, value]) => {
|
|
1125
|
-
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
1126
|
-
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
1127
|
-
return {
|
|
1128
|
-
...acc,
|
|
1129
|
-
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
1130
|
-
};
|
|
1131
|
-
},
|
|
1132
|
-
{}
|
|
1133
|
-
);
|
|
1134
|
-
}
|
|
1135
1135
|
var _contentTypesUrl;
|
|
1136
1136
|
var _entriesUrl;
|
|
1137
1137
|
var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
@@ -1148,7 +1148,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1148
1148
|
getEntries(options) {
|
|
1149
1149
|
const { projectId } = this.options;
|
|
1150
1150
|
const { skipDataResolution, filters, ...params } = options;
|
|
1151
|
-
const rewrittenFilters =
|
|
1151
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1152
1152
|
if (skipDataResolution) {
|
|
1153
1153
|
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
|
|
1154
1154
|
return this.apiClient(url);
|
|
@@ -1715,6 +1715,9 @@ var getRouteClient = (options) => {
|
|
|
1715
1715
|
// src/config/helpers.ts
|
|
1716
1716
|
var import_resolved = __toESM(require("@uniformdev/next-app-router/config/resolved"));
|
|
1717
1717
|
var getMiddlewareRuntimeCache = () => {
|
|
1718
|
+
if (process.env.NODE_ENV === "development" && !process.env.RUNTIME_CACHE_ENDPOINT) {
|
|
1719
|
+
return false;
|
|
1720
|
+
}
|
|
1718
1721
|
if (typeof import_resolved.default.middlewareRuntimeCache === "boolean") {
|
|
1719
1722
|
return import_resolved.default.middlewareRuntimeCache;
|
|
1720
1723
|
}
|
package/dist/cache.mjs
CHANGED
|
@@ -317,11 +317,25 @@ async function handleRateLimits(callApi) {
|
|
|
317
317
|
}
|
|
318
318
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
319
319
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
320
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
320
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
321
321
|
backoffRetriesLeft -= 1;
|
|
322
322
|
}
|
|
323
323
|
return response;
|
|
324
324
|
}
|
|
325
|
+
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
326
|
+
function rewriteFiltersForApi(filters) {
|
|
327
|
+
return Object.entries(filters != null ? filters : {}).reduce(
|
|
328
|
+
(acc, [key, value]) => {
|
|
329
|
+
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
330
|
+
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
331
|
+
return {
|
|
332
|
+
...acc,
|
|
333
|
+
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
334
|
+
};
|
|
335
|
+
},
|
|
336
|
+
{}
|
|
337
|
+
);
|
|
338
|
+
}
|
|
325
339
|
var _url;
|
|
326
340
|
var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
327
341
|
constructor(options) {
|
|
@@ -1105,20 +1119,6 @@ function createLimitPolicy({
|
|
|
1105
1119
|
return currentFunc();
|
|
1106
1120
|
};
|
|
1107
1121
|
}
|
|
1108
|
-
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
1109
|
-
function rewriteFilters(filters) {
|
|
1110
|
-
return Object.entries(filters != null ? filters : {}).reduce(
|
|
1111
|
-
(acc, [key, value]) => {
|
|
1112
|
-
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
1113
|
-
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
1114
|
-
return {
|
|
1115
|
-
...acc,
|
|
1116
|
-
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
1117
|
-
};
|
|
1118
|
-
},
|
|
1119
|
-
{}
|
|
1120
|
-
);
|
|
1121
|
-
}
|
|
1122
1122
|
var _contentTypesUrl;
|
|
1123
1123
|
var _entriesUrl;
|
|
1124
1124
|
var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
@@ -1135,7 +1135,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1135
1135
|
getEntries(options) {
|
|
1136
1136
|
const { projectId } = this.options;
|
|
1137
1137
|
const { skipDataResolution, filters, ...params } = options;
|
|
1138
|
-
const rewrittenFilters =
|
|
1138
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1139
1139
|
if (skipDataResolution) {
|
|
1140
1140
|
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
|
|
1141
1141
|
return this.apiClient(url);
|
|
@@ -1702,6 +1702,9 @@ var getRouteClient = (options) => {
|
|
|
1702
1702
|
// src/config/helpers.ts
|
|
1703
1703
|
import config from "@uniformdev/next-app-router/config/resolved";
|
|
1704
1704
|
var getMiddlewareRuntimeCache = () => {
|
|
1705
|
+
if (process.env.NODE_ENV === "development" && !process.env.RUNTIME_CACHE_ENDPOINT) {
|
|
1706
|
+
return false;
|
|
1707
|
+
}
|
|
1705
1708
|
if (typeof config.middlewareRuntimeCache === "boolean") {
|
|
1706
1709
|
return config.middlewareRuntimeCache;
|
|
1707
1710
|
}
|
package/dist/component.js
CHANGED
|
@@ -385,11 +385,25 @@ async function handleRateLimits(callApi) {
|
|
|
385
385
|
}
|
|
386
386
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
387
387
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
388
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
388
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
389
389
|
backoffRetriesLeft -= 1;
|
|
390
390
|
}
|
|
391
391
|
return response;
|
|
392
392
|
}
|
|
393
|
+
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
394
|
+
function rewriteFiltersForApi(filters) {
|
|
395
|
+
return Object.entries(filters != null ? filters : {}).reduce(
|
|
396
|
+
(acc, [key, value]) => {
|
|
397
|
+
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
398
|
+
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
399
|
+
return {
|
|
400
|
+
...acc,
|
|
401
|
+
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
402
|
+
};
|
|
403
|
+
},
|
|
404
|
+
{}
|
|
405
|
+
);
|
|
406
|
+
}
|
|
393
407
|
var _url;
|
|
394
408
|
var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
395
409
|
constructor(options) {
|
|
@@ -982,20 +996,6 @@ var require_retry2 = __commonJS2({
|
|
|
982
996
|
});
|
|
983
997
|
var import_p_limit2 = __toESM2(require_p_limit2());
|
|
984
998
|
var import_retry = __toESM2(require_retry2(), 1);
|
|
985
|
-
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
986
|
-
function rewriteFilters(filters) {
|
|
987
|
-
return Object.entries(filters != null ? filters : {}).reduce(
|
|
988
|
-
(acc, [key, value]) => {
|
|
989
|
-
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
990
|
-
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
991
|
-
return {
|
|
992
|
-
...acc,
|
|
993
|
-
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
994
|
-
};
|
|
995
|
-
},
|
|
996
|
-
{}
|
|
997
|
-
);
|
|
998
|
-
}
|
|
999
999
|
var _contentTypesUrl;
|
|
1000
1000
|
var _entriesUrl;
|
|
1001
1001
|
var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
@@ -1012,7 +1012,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1012
1012
|
getEntries(options) {
|
|
1013
1013
|
const { projectId } = this.options;
|
|
1014
1014
|
const { skipDataResolution, filters, ...params } = options;
|
|
1015
|
-
const rewrittenFilters =
|
|
1015
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1016
1016
|
if (skipDataResolution) {
|
|
1017
1017
|
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
|
|
1018
1018
|
return this.apiClient(url);
|
package/dist/component.mjs
CHANGED
|
@@ -370,11 +370,25 @@ async function handleRateLimits(callApi) {
|
|
|
370
370
|
}
|
|
371
371
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
372
372
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
373
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
373
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
374
374
|
backoffRetriesLeft -= 1;
|
|
375
375
|
}
|
|
376
376
|
return response;
|
|
377
377
|
}
|
|
378
|
+
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
379
|
+
function rewriteFiltersForApi(filters) {
|
|
380
|
+
return Object.entries(filters != null ? filters : {}).reduce(
|
|
381
|
+
(acc, [key, value]) => {
|
|
382
|
+
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
383
|
+
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
384
|
+
return {
|
|
385
|
+
...acc,
|
|
386
|
+
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
387
|
+
};
|
|
388
|
+
},
|
|
389
|
+
{}
|
|
390
|
+
);
|
|
391
|
+
}
|
|
378
392
|
var _url;
|
|
379
393
|
var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
380
394
|
constructor(options) {
|
|
@@ -967,20 +981,6 @@ var require_retry2 = __commonJS2({
|
|
|
967
981
|
});
|
|
968
982
|
var import_p_limit2 = __toESM2(require_p_limit2());
|
|
969
983
|
var import_retry = __toESM2(require_retry2(), 1);
|
|
970
|
-
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
971
|
-
function rewriteFilters(filters) {
|
|
972
|
-
return Object.entries(filters != null ? filters : {}).reduce(
|
|
973
|
-
(acc, [key, value]) => {
|
|
974
|
-
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
975
|
-
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
976
|
-
return {
|
|
977
|
-
...acc,
|
|
978
|
-
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
979
|
-
};
|
|
980
|
-
},
|
|
981
|
-
{}
|
|
982
|
-
);
|
|
983
|
-
}
|
|
984
984
|
var _contentTypesUrl;
|
|
985
985
|
var _entriesUrl;
|
|
986
986
|
var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
@@ -997,7 +997,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
997
997
|
getEntries(options) {
|
|
998
998
|
const { projectId } = this.options;
|
|
999
999
|
const { skipDataResolution, filters, ...params } = options;
|
|
1000
|
-
const rewrittenFilters =
|
|
1000
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1001
1001
|
if (skipDataResolution) {
|
|
1002
1002
|
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
|
|
1003
1003
|
return this.apiClient(url);
|
package/dist/handler.js
CHANGED
|
@@ -329,11 +329,25 @@ async function handleRateLimits(callApi) {
|
|
|
329
329
|
}
|
|
330
330
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
331
331
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
332
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
332
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
333
333
|
backoffRetriesLeft -= 1;
|
|
334
334
|
}
|
|
335
335
|
return response;
|
|
336
336
|
}
|
|
337
|
+
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
338
|
+
function rewriteFiltersForApi(filters) {
|
|
339
|
+
return Object.entries(filters != null ? filters : {}).reduce(
|
|
340
|
+
(acc, [key, value]) => {
|
|
341
|
+
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
342
|
+
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
343
|
+
return {
|
|
344
|
+
...acc,
|
|
345
|
+
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
346
|
+
};
|
|
347
|
+
},
|
|
348
|
+
{}
|
|
349
|
+
);
|
|
350
|
+
}
|
|
337
351
|
var _url;
|
|
338
352
|
var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
339
353
|
constructor(options) {
|
|
@@ -1116,20 +1130,6 @@ function createLimitPolicy({
|
|
|
1116
1130
|
return currentFunc();
|
|
1117
1131
|
};
|
|
1118
1132
|
}
|
|
1119
|
-
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
1120
|
-
function rewriteFilters(filters) {
|
|
1121
|
-
return Object.entries(filters != null ? filters : {}).reduce(
|
|
1122
|
-
(acc, [key, value]) => {
|
|
1123
|
-
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
1124
|
-
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
1125
|
-
return {
|
|
1126
|
-
...acc,
|
|
1127
|
-
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
1128
|
-
};
|
|
1129
|
-
},
|
|
1130
|
-
{}
|
|
1131
|
-
);
|
|
1132
|
-
}
|
|
1133
1133
|
var CANVAS_URL = "/api/v1/canvas";
|
|
1134
1134
|
var CanvasClient = class extends ApiClient {
|
|
1135
1135
|
constructor(options) {
|
|
@@ -1145,7 +1145,7 @@ var CanvasClient = class extends ApiClient {
|
|
|
1145
1145
|
async getCompositionList(params = {}) {
|
|
1146
1146
|
const { projectId } = this.options;
|
|
1147
1147
|
const { resolveData, filters, ...originParams } = params;
|
|
1148
|
-
const rewrittenFilters =
|
|
1148
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1149
1149
|
if (!resolveData) {
|
|
1150
1150
|
const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
|
|
1151
1151
|
return this.apiClient(fetchUri);
|
|
@@ -1265,7 +1265,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1265
1265
|
getEntries(options) {
|
|
1266
1266
|
const { projectId } = this.options;
|
|
1267
1267
|
const { skipDataResolution, filters, ...params } = options;
|
|
1268
|
-
const rewrittenFilters =
|
|
1268
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1269
1269
|
if (skipDataResolution) {
|
|
1270
1270
|
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
|
|
1271
1271
|
return this.apiClient(url);
|
|
@@ -1544,6 +1544,9 @@ var import_server = require("next/server");
|
|
|
1544
1544
|
// src/config/helpers.ts
|
|
1545
1545
|
var import_resolved = __toESM(require("@uniformdev/next-app-router/config/resolved"));
|
|
1546
1546
|
var getMiddlewareRuntimeCache = () => {
|
|
1547
|
+
if (process.env.NODE_ENV === "development" && !process.env.RUNTIME_CACHE_ENDPOINT) {
|
|
1548
|
+
return false;
|
|
1549
|
+
}
|
|
1547
1550
|
if (typeof import_resolved.default.middlewareRuntimeCache === "boolean") {
|
|
1548
1551
|
return import_resolved.default.middlewareRuntimeCache;
|
|
1549
1552
|
}
|
package/dist/handler.mjs
CHANGED
|
@@ -314,11 +314,25 @@ async function handleRateLimits(callApi) {
|
|
|
314
314
|
}
|
|
315
315
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
316
316
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
317
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
317
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
318
318
|
backoffRetriesLeft -= 1;
|
|
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);
|
|
@@ -1529,6 +1529,9 @@ import { NextResponse } from "next/server";
|
|
|
1529
1529
|
// src/config/helpers.ts
|
|
1530
1530
|
import config from "@uniformdev/next-app-router/config/resolved";
|
|
1531
1531
|
var getMiddlewareRuntimeCache = () => {
|
|
1532
|
+
if (process.env.NODE_ENV === "development" && !process.env.RUNTIME_CACHE_ENDPOINT) {
|
|
1533
|
+
return false;
|
|
1534
|
+
}
|
|
1532
1535
|
if (typeof config.middlewareRuntimeCache === "boolean") {
|
|
1533
1536
|
return config.middlewareRuntimeCache;
|
|
1534
1537
|
}
|
package/dist/index.esm.js
CHANGED
|
@@ -320,11 +320,25 @@ async function handleRateLimits(callApi) {
|
|
|
320
320
|
}
|
|
321
321
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
322
322
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
323
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
323
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
324
324
|
backoffRetriesLeft -= 1;
|
|
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);
|
|
@@ -2749,6 +2749,13 @@ var createTestComponentProps = ({
|
|
|
2749
2749
|
test
|
|
2750
2750
|
}) => {
|
|
2751
2751
|
var _a;
|
|
2752
|
+
if (pageState.isPrefetch) {
|
|
2753
|
+
return {
|
|
2754
|
+
...common,
|
|
2755
|
+
index: void 0,
|
|
2756
|
+
test
|
|
2757
|
+
};
|
|
2758
|
+
}
|
|
2752
2759
|
const component = resolveComponentFromPageState({
|
|
2753
2760
|
pageState,
|
|
2754
2761
|
componentId
|
|
@@ -2787,6 +2794,7 @@ var applyEditableParameters = ({
|
|
|
2787
2794
|
};
|
|
2788
2795
|
|
|
2789
2796
|
// src/components/Test.tsx
|
|
2797
|
+
import { ClientTest } from "@uniformdev/next-app-router-client";
|
|
2790
2798
|
import { createElement, Fragment } from "react";
|
|
2791
2799
|
|
|
2792
2800
|
// src/components/ContextTestTransfer.tsx
|
|
@@ -2799,7 +2807,14 @@ var ContextTestTransfer = ({ event }) => {
|
|
|
2799
2807
|
// src/components/Test.tsx
|
|
2800
2808
|
var Test = ({ index, slots, test, component, context: compositionContext }) => {
|
|
2801
2809
|
var _a, _b, _c, _d, _e, _f;
|
|
2802
|
-
|
|
2810
|
+
if (typeof index !== "number") {
|
|
2811
|
+
return createElement(ClientTest, {
|
|
2812
|
+
slots,
|
|
2813
|
+
test,
|
|
2814
|
+
context: compositionContext
|
|
2815
|
+
});
|
|
2816
|
+
}
|
|
2817
|
+
const indexToShow = (_b = (_a = slots == null ? void 0 : slots[CANVAS_TEST_SLOT]) == null ? void 0 : _a.items[index]) != null ? _b : null;
|
|
2803
2818
|
const event = {
|
|
2804
2819
|
name: test.name,
|
|
2805
2820
|
control: (_d = (_c = test.variations[index]) == null ? void 0 : _c.control) != null ? _d : false,
|
|
@@ -2856,6 +2871,9 @@ var getQuirkSerialization = () => {
|
|
|
2856
2871
|
return true;
|
|
2857
2872
|
};
|
|
2858
2873
|
var getMiddlewareRuntimeCache = () => {
|
|
2874
|
+
if (process.env.NODE_ENV === "development" && !process.env.RUNTIME_CACHE_ENDPOINT) {
|
|
2875
|
+
return false;
|
|
2876
|
+
}
|
|
2859
2877
|
if (typeof config.middlewareRuntimeCache === "boolean") {
|
|
2860
2878
|
return config.middlewareRuntimeCache;
|
|
2861
2879
|
}
|
|
@@ -3577,7 +3595,8 @@ var generatePossiblePageStates = ({
|
|
|
3577
3595
|
defaultConsent: void 0,
|
|
3578
3596
|
previewMode: void 0,
|
|
3579
3597
|
rules: void 0,
|
|
3580
|
-
locale
|
|
3598
|
+
locale,
|
|
3599
|
+
isPrefetch: void 0
|
|
3581
3600
|
};
|
|
3582
3601
|
const allStates = generateStatesRecursively(dependencyMap, void 0, initialState);
|
|
3583
3602
|
return allStates.map((payload) => serializeEvaluationResult({ payload }));
|
package/dist/index.js
CHANGED
|
@@ -347,11 +347,25 @@ async function handleRateLimits(callApi) {
|
|
|
347
347
|
}
|
|
348
348
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
349
349
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
350
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
350
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
351
351
|
backoffRetriesLeft -= 1;
|
|
352
352
|
}
|
|
353
353
|
return response;
|
|
354
354
|
}
|
|
355
|
+
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
356
|
+
function rewriteFiltersForApi(filters) {
|
|
357
|
+
return Object.entries(filters != null ? filters : {}).reduce(
|
|
358
|
+
(acc, [key, value]) => {
|
|
359
|
+
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
360
|
+
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
361
|
+
return {
|
|
362
|
+
...acc,
|
|
363
|
+
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
364
|
+
};
|
|
365
|
+
},
|
|
366
|
+
{}
|
|
367
|
+
);
|
|
368
|
+
}
|
|
355
369
|
var _url;
|
|
356
370
|
var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
357
371
|
constructor(options) {
|
|
@@ -1135,20 +1149,6 @@ function createLimitPolicy({
|
|
|
1135
1149
|
return currentFunc();
|
|
1136
1150
|
};
|
|
1137
1151
|
}
|
|
1138
|
-
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
1139
|
-
function rewriteFilters(filters) {
|
|
1140
|
-
return Object.entries(filters != null ? filters : {}).reduce(
|
|
1141
|
-
(acc, [key, value]) => {
|
|
1142
|
-
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
1143
|
-
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
1144
|
-
return {
|
|
1145
|
-
...acc,
|
|
1146
|
-
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
1147
|
-
};
|
|
1148
|
-
},
|
|
1149
|
-
{}
|
|
1150
|
-
);
|
|
1151
|
-
}
|
|
1152
1152
|
var CANVAS_URL = "/api/v1/canvas";
|
|
1153
1153
|
var CanvasClient = class extends ApiClient {
|
|
1154
1154
|
constructor(options) {
|
|
@@ -1164,7 +1164,7 @@ var CanvasClient = class extends ApiClient {
|
|
|
1164
1164
|
async getCompositionList(params = {}) {
|
|
1165
1165
|
const { projectId } = this.options;
|
|
1166
1166
|
const { resolveData, filters, ...originParams } = params;
|
|
1167
|
-
const rewrittenFilters =
|
|
1167
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1168
1168
|
if (!resolveData) {
|
|
1169
1169
|
const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
|
|
1170
1170
|
return this.apiClient(fetchUri);
|
|
@@ -1284,7 +1284,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1284
1284
|
getEntries(options) {
|
|
1285
1285
|
const { projectId } = this.options;
|
|
1286
1286
|
const { skipDataResolution, filters, ...params } = options;
|
|
1287
|
-
const rewrittenFilters =
|
|
1287
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1288
1288
|
if (skipDataResolution) {
|
|
1289
1289
|
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
|
|
1290
1290
|
return this.apiClient(url);
|
|
@@ -2678,7 +2678,7 @@ var getRouteClient = (options) => {
|
|
|
2678
2678
|
|
|
2679
2679
|
// src/components/UniformComposition.tsx
|
|
2680
2680
|
var import_core = require("@uniformdev/canvas-react/core");
|
|
2681
|
-
var
|
|
2681
|
+
var import_next_app_router_client5 = require("@uniformdev/next-app-router-client");
|
|
2682
2682
|
var import_next_app_router_shared4 = require("@uniformdev/next-app-router-shared");
|
|
2683
2683
|
var import_navigation = require("next/navigation");
|
|
2684
2684
|
var import_react6 = __toESM(require("react"));
|
|
@@ -2772,6 +2772,13 @@ var createTestComponentProps = ({
|
|
|
2772
2772
|
test
|
|
2773
2773
|
}) => {
|
|
2774
2774
|
var _a;
|
|
2775
|
+
if (pageState.isPrefetch) {
|
|
2776
|
+
return {
|
|
2777
|
+
...common,
|
|
2778
|
+
index: void 0,
|
|
2779
|
+
test
|
|
2780
|
+
};
|
|
2781
|
+
}
|
|
2775
2782
|
const component = (0, import_next_app_router_shared2.resolveComponentFromPageState)({
|
|
2776
2783
|
pageState,
|
|
2777
2784
|
componentId
|
|
@@ -2810,6 +2817,7 @@ var applyEditableParameters = ({
|
|
|
2810
2817
|
};
|
|
2811
2818
|
|
|
2812
2819
|
// src/components/Test.tsx
|
|
2820
|
+
var import_next_app_router_client2 = require("@uniformdev/next-app-router-client");
|
|
2813
2821
|
var import_react2 = require("react");
|
|
2814
2822
|
|
|
2815
2823
|
// src/components/ContextTestTransfer.tsx
|
|
@@ -2822,7 +2830,14 @@ var ContextTestTransfer = ({ event }) => {
|
|
|
2822
2830
|
// src/components/Test.tsx
|
|
2823
2831
|
var Test = ({ index, slots, test, component, context: compositionContext }) => {
|
|
2824
2832
|
var _a, _b, _c, _d, _e, _f;
|
|
2825
|
-
|
|
2833
|
+
if (typeof index !== "number") {
|
|
2834
|
+
return (0, import_react2.createElement)(import_next_app_router_client2.ClientTest, {
|
|
2835
|
+
slots,
|
|
2836
|
+
test,
|
|
2837
|
+
context: compositionContext
|
|
2838
|
+
});
|
|
2839
|
+
}
|
|
2840
|
+
const indexToShow = (_b = (_a = slots == null ? void 0 : slots[CANVAS_TEST_SLOT]) == null ? void 0 : _a.items[index]) != null ? _b : null;
|
|
2826
2841
|
const event = {
|
|
2827
2842
|
name: test.name,
|
|
2828
2843
|
control: (_d = (_c = test.variations[index]) == null ? void 0 : _c.control) != null ? _d : false,
|
|
@@ -2854,7 +2869,7 @@ var UniformCompositionWrapper = ({
|
|
|
2854
2869
|
};
|
|
2855
2870
|
|
|
2856
2871
|
// src/components/UniformContext.tsx
|
|
2857
|
-
var
|
|
2872
|
+
var import_next_app_router_client3 = require("@uniformdev/next-app-router-client");
|
|
2858
2873
|
var import_react4 = __toESM(require("react"));
|
|
2859
2874
|
|
|
2860
2875
|
// src/config/helpers.ts
|
|
@@ -2879,6 +2894,9 @@ var getQuirkSerialization = () => {
|
|
|
2879
2894
|
return true;
|
|
2880
2895
|
};
|
|
2881
2896
|
var getMiddlewareRuntimeCache = () => {
|
|
2897
|
+
if (process.env.NODE_ENV === "development" && !process.env.RUNTIME_CACHE_ENDPOINT) {
|
|
2898
|
+
return false;
|
|
2899
|
+
}
|
|
2882
2900
|
if (typeof import_resolved.default.middlewareRuntimeCache === "boolean") {
|
|
2883
2901
|
return import_resolved.default.middlewareRuntimeCache;
|
|
2884
2902
|
}
|
|
@@ -2904,7 +2922,7 @@ var UniformContext = async ({ clientContextComponent, result }) => {
|
|
|
2904
2922
|
dynamicInputs: route.dynamicInputs,
|
|
2905
2923
|
matchedRoute: route.matchedRoute
|
|
2906
2924
|
} : void 0;
|
|
2907
|
-
const ContextComponent = clientContextComponent ||
|
|
2925
|
+
const ContextComponent = clientContextComponent || import_next_app_router_client3.DefaultUniformClientContext;
|
|
2908
2926
|
const disableDevTools = getDisabledDevTools();
|
|
2909
2927
|
const defaultConsent = (_a = result == null ? void 0 : result.pageState.defaultConsent) != null ? _a : getDefaultConsent();
|
|
2910
2928
|
const experimentalQuirkSerialization = getQuirkSerialization();
|
|
@@ -2921,14 +2939,14 @@ var UniformContext = async ({ clientContextComponent, result }) => {
|
|
|
2921
2939
|
};
|
|
2922
2940
|
|
|
2923
2941
|
// src/components/VisibilityRulesWrapper.tsx
|
|
2924
|
-
var
|
|
2942
|
+
var import_next_app_router_client4 = require("@uniformdev/next-app-router-client");
|
|
2925
2943
|
var import_react5 = __toESM(require("react"));
|
|
2926
2944
|
var VisibilityRulesWrapper = ({
|
|
2927
2945
|
parameter,
|
|
2928
2946
|
initialIsVisible,
|
|
2929
2947
|
children
|
|
2930
2948
|
}) => {
|
|
2931
|
-
return /* @__PURE__ */ import_react5.default.createElement(
|
|
2949
|
+
return /* @__PURE__ */ import_react5.default.createElement(import_next_app_router_client4.VisibilityRulesWrapperClient, { parameter, initialIsVisible }, children);
|
|
2932
2950
|
};
|
|
2933
2951
|
|
|
2934
2952
|
// src/components/UniformComposition.tsx
|
|
@@ -2991,7 +3009,7 @@ async function UniformCompositionInner({
|
|
|
2991
3009
|
route
|
|
2992
3010
|
}
|
|
2993
3011
|
}
|
|
2994
|
-
)), (pageState.compositionState === CANVAS_EDITOR_STATE || pageState.compositionState === CANVAS_DRAFT_STATE) && /* @__PURE__ */ import_react6.default.createElement(
|
|
3012
|
+
)), (pageState.compositionState === CANVAS_EDITOR_STATE || pageState.compositionState === CANVAS_DRAFT_STATE) && /* @__PURE__ */ import_react6.default.createElement(import_next_app_router_client5.UniformScript, null));
|
|
2995
3013
|
}
|
|
2996
3014
|
var resolveComponents = ({
|
|
2997
3015
|
target,
|
|
@@ -3087,7 +3105,7 @@ var resolveComponents = ({
|
|
|
3087
3105
|
}
|
|
3088
3106
|
let tagElement = null;
|
|
3089
3107
|
if (enrichmentTags == null ? void 0 : enrichmentTags.length) {
|
|
3090
|
-
tagElement = (0, import_react6.createElement)(
|
|
3108
|
+
tagElement = (0, import_react6.createElement)(import_next_app_router_client5.ContextUpdateTransfer, {
|
|
3091
3109
|
key: `${slotName}-${componentIndex}-tags`,
|
|
3092
3110
|
update: {
|
|
3093
3111
|
enrichments: enrichmentTags
|
|
@@ -3162,7 +3180,7 @@ var createResolvedComponent = ({
|
|
|
3162
3180
|
componentId: component._id,
|
|
3163
3181
|
pageState
|
|
3164
3182
|
});
|
|
3165
|
-
return (0, import_react6.createElement)(
|
|
3183
|
+
return (0, import_react6.createElement)(import_next_app_router_client5.Personalize, { ...personalizeProps, key });
|
|
3166
3184
|
}
|
|
3167
3185
|
if (component.type === CANVAS_TEST_TYPE) {
|
|
3168
3186
|
const extractedTest = extractTest({
|
|
@@ -3598,7 +3616,8 @@ var generatePossiblePageStates = ({
|
|
|
3598
3616
|
defaultConsent: void 0,
|
|
3599
3617
|
previewMode: void 0,
|
|
3600
3618
|
rules: void 0,
|
|
3601
|
-
locale
|
|
3619
|
+
locale,
|
|
3620
|
+
isPrefetch: void 0
|
|
3602
3621
|
};
|
|
3603
3622
|
const allStates = generateStatesRecursively(dependencyMap, void 0, initialState);
|
|
3604
3623
|
return allStates.map((payload) => (0, import_next_app_router_shared8.serializeEvaluationResult)({ payload }));
|
package/dist/index.mjs
CHANGED
|
@@ -320,11 +320,25 @@ async function handleRateLimits(callApi) {
|
|
|
320
320
|
}
|
|
321
321
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
322
322
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
323
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
323
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
324
324
|
backoffRetriesLeft -= 1;
|
|
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);
|
|
@@ -2749,6 +2749,13 @@ var createTestComponentProps = ({
|
|
|
2749
2749
|
test
|
|
2750
2750
|
}) => {
|
|
2751
2751
|
var _a;
|
|
2752
|
+
if (pageState.isPrefetch) {
|
|
2753
|
+
return {
|
|
2754
|
+
...common,
|
|
2755
|
+
index: void 0,
|
|
2756
|
+
test
|
|
2757
|
+
};
|
|
2758
|
+
}
|
|
2752
2759
|
const component = resolveComponentFromPageState({
|
|
2753
2760
|
pageState,
|
|
2754
2761
|
componentId
|
|
@@ -2787,6 +2794,7 @@ var applyEditableParameters = ({
|
|
|
2787
2794
|
};
|
|
2788
2795
|
|
|
2789
2796
|
// src/components/Test.tsx
|
|
2797
|
+
import { ClientTest } from "@uniformdev/next-app-router-client";
|
|
2790
2798
|
import { createElement, Fragment } from "react";
|
|
2791
2799
|
|
|
2792
2800
|
// src/components/ContextTestTransfer.tsx
|
|
@@ -2799,7 +2807,14 @@ var ContextTestTransfer = ({ event }) => {
|
|
|
2799
2807
|
// src/components/Test.tsx
|
|
2800
2808
|
var Test = ({ index, slots, test, component, context: compositionContext }) => {
|
|
2801
2809
|
var _a, _b, _c, _d, _e, _f;
|
|
2802
|
-
|
|
2810
|
+
if (typeof index !== "number") {
|
|
2811
|
+
return createElement(ClientTest, {
|
|
2812
|
+
slots,
|
|
2813
|
+
test,
|
|
2814
|
+
context: compositionContext
|
|
2815
|
+
});
|
|
2816
|
+
}
|
|
2817
|
+
const indexToShow = (_b = (_a = slots == null ? void 0 : slots[CANVAS_TEST_SLOT]) == null ? void 0 : _a.items[index]) != null ? _b : null;
|
|
2803
2818
|
const event = {
|
|
2804
2819
|
name: test.name,
|
|
2805
2820
|
control: (_d = (_c = test.variations[index]) == null ? void 0 : _c.control) != null ? _d : false,
|
|
@@ -2856,6 +2871,9 @@ var getQuirkSerialization = () => {
|
|
|
2856
2871
|
return true;
|
|
2857
2872
|
};
|
|
2858
2873
|
var getMiddlewareRuntimeCache = () => {
|
|
2874
|
+
if (process.env.NODE_ENV === "development" && !process.env.RUNTIME_CACHE_ENDPOINT) {
|
|
2875
|
+
return false;
|
|
2876
|
+
}
|
|
2859
2877
|
if (typeof config.middlewareRuntimeCache === "boolean") {
|
|
2860
2878
|
return config.middlewareRuntimeCache;
|
|
2861
2879
|
}
|
|
@@ -3577,7 +3595,8 @@ var generatePossiblePageStates = ({
|
|
|
3577
3595
|
defaultConsent: void 0,
|
|
3578
3596
|
previewMode: void 0,
|
|
3579
3597
|
rules: void 0,
|
|
3580
|
-
locale
|
|
3598
|
+
locale,
|
|
3599
|
+
isPrefetch: void 0
|
|
3581
3600
|
};
|
|
3582
3601
|
const allStates = generateStatesRecursively(dependencyMap, void 0, initialState);
|
|
3583
3602
|
return allStates.map((payload) => serializeEvaluationResult({ payload }));
|
package/dist/middleware.js
CHANGED
|
@@ -525,11 +525,25 @@ async function handleRateLimits(callApi) {
|
|
|
525
525
|
}
|
|
526
526
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
527
527
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
528
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
528
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
529
529
|
backoffRetriesLeft -= 1;
|
|
530
530
|
}
|
|
531
531
|
return response;
|
|
532
532
|
}
|
|
533
|
+
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
534
|
+
function rewriteFiltersForApi(filters) {
|
|
535
|
+
return Object.entries(filters != null ? filters : {}).reduce(
|
|
536
|
+
(acc, [key, value]) => {
|
|
537
|
+
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
538
|
+
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
539
|
+
return {
|
|
540
|
+
...acc,
|
|
541
|
+
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
542
|
+
};
|
|
543
|
+
},
|
|
544
|
+
{}
|
|
545
|
+
);
|
|
546
|
+
}
|
|
533
547
|
var _url;
|
|
534
548
|
var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
535
549
|
constructor(options) {
|
|
@@ -1313,20 +1327,6 @@ function createLimitPolicy({
|
|
|
1313
1327
|
return currentFunc();
|
|
1314
1328
|
};
|
|
1315
1329
|
}
|
|
1316
|
-
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
1317
|
-
function rewriteFilters(filters) {
|
|
1318
|
-
return Object.entries(filters != null ? filters : {}).reduce(
|
|
1319
|
-
(acc, [key, value]) => {
|
|
1320
|
-
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
1321
|
-
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
1322
|
-
return {
|
|
1323
|
-
...acc,
|
|
1324
|
-
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
1325
|
-
};
|
|
1326
|
-
},
|
|
1327
|
-
{}
|
|
1328
|
-
);
|
|
1329
|
-
}
|
|
1330
1330
|
var CANVAS_URL = "/api/v1/canvas";
|
|
1331
1331
|
var CanvasClient = class extends ApiClient {
|
|
1332
1332
|
constructor(options) {
|
|
@@ -1342,7 +1342,7 @@ var CanvasClient = class extends ApiClient {
|
|
|
1342
1342
|
async getCompositionList(params = {}) {
|
|
1343
1343
|
const { projectId } = this.options;
|
|
1344
1344
|
const { resolveData, filters, ...originParams } = params;
|
|
1345
|
-
const rewrittenFilters =
|
|
1345
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1346
1346
|
if (!resolveData) {
|
|
1347
1347
|
const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
|
|
1348
1348
|
return this.apiClient(fetchUri);
|
|
@@ -1462,7 +1462,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1462
1462
|
getEntries(options) {
|
|
1463
1463
|
const { projectId } = this.options;
|
|
1464
1464
|
const { skipDataResolution, filters, ...params } = options;
|
|
1465
|
-
const rewrittenFilters =
|
|
1465
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1466
1466
|
if (skipDataResolution) {
|
|
1467
1467
|
const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
|
|
1468
1468
|
return this.apiClient(url);
|
|
@@ -2093,11 +2093,34 @@ var stringOperatorEvaluators = {
|
|
|
2093
2093
|
endswith: endsWithEvaluator,
|
|
2094
2094
|
empty: emptyEvaluator
|
|
2095
2095
|
};
|
|
2096
|
+
var numericOperatorEvaluators = {
|
|
2097
|
+
gt: (left, right) => left > right,
|
|
2098
|
+
lt: (left, right) => left < right
|
|
2099
|
+
};
|
|
2100
|
+
function evaluateNumericOperator(criteria, matchValue) {
|
|
2101
|
+
const { op, value } = criteria;
|
|
2102
|
+
const evaluator = numericOperatorEvaluators[op];
|
|
2103
|
+
if (!evaluator) {
|
|
2104
|
+
return null;
|
|
2105
|
+
}
|
|
2106
|
+
if (typeof matchValue === "string" && matchValue.trim() === "" || typeof value === "string" && value.trim() === "") {
|
|
2107
|
+
return false;
|
|
2108
|
+
}
|
|
2109
|
+
const leftNum = Number(matchValue);
|
|
2110
|
+
const rightNum = Number(value);
|
|
2111
|
+
if (isNaN(leftNum) || isNaN(rightNum)) {
|
|
2112
|
+
return false;
|
|
2113
|
+
}
|
|
2114
|
+
return evaluator(leftNum, rightNum);
|
|
2115
|
+
}
|
|
2096
2116
|
function evaluateStringMatch(criteria, matchValue, allow) {
|
|
2097
2117
|
const { op, value } = criteria;
|
|
2098
2118
|
if (allow && !allow.has(op)) {
|
|
2099
2119
|
return null;
|
|
2100
2120
|
}
|
|
2121
|
+
if (op in numericOperatorEvaluators) {
|
|
2122
|
+
return evaluateNumericOperator(criteria, matchValue);
|
|
2123
|
+
}
|
|
2101
2124
|
let opMatch = op;
|
|
2102
2125
|
const negation = op.startsWith("!");
|
|
2103
2126
|
if (negation) {
|
|
@@ -2586,6 +2609,9 @@ var getQuirkSerialization = () => {
|
|
|
2586
2609
|
return true;
|
|
2587
2610
|
};
|
|
2588
2611
|
var getMiddlewareRuntimeCache = () => {
|
|
2612
|
+
if (process.env.NODE_ENV === "development" && !process.env.RUNTIME_CACHE_ENDPOINT) {
|
|
2613
|
+
return false;
|
|
2614
|
+
}
|
|
2589
2615
|
if (typeof import_resolved.default.middlewareRuntimeCache === "boolean") {
|
|
2590
2616
|
return import_resolved.default.middlewareRuntimeCache;
|
|
2591
2617
|
}
|
|
@@ -3021,7 +3047,8 @@ var import_next_app_router_shared4 = require("@uniformdev/next-app-router-shared
|
|
|
3021
3047
|
var evaluateRunnables = async ({
|
|
3022
3048
|
runnables,
|
|
3023
3049
|
context,
|
|
3024
|
-
compositionContext
|
|
3050
|
+
compositionContext,
|
|
3051
|
+
isPrefetch
|
|
3025
3052
|
}) => {
|
|
3026
3053
|
var _a;
|
|
3027
3054
|
const result = {
|
|
@@ -3031,6 +3058,9 @@ var evaluateRunnables = async ({
|
|
|
3031
3058
|
const runnablesToProcess = runnables.filter((item2) => item2.variantId === void 0);
|
|
3032
3059
|
let item;
|
|
3033
3060
|
while (item = runnablesToProcess.shift()) {
|
|
3061
|
+
if (item.type === "test" && isPrefetch) {
|
|
3062
|
+
continue;
|
|
3063
|
+
}
|
|
3034
3064
|
if (item.type === "test") {
|
|
3035
3065
|
const testResult = (0, import_next_app_router_shared4.evaluateTest)({
|
|
3036
3066
|
context,
|
|
@@ -5536,7 +5566,8 @@ var handlePlaygroundRequest = async ({
|
|
|
5536
5566
|
searchParams: request.nextUrl.searchParams,
|
|
5537
5567
|
isDraftModeEnabled: true
|
|
5538
5568
|
// this is checked above
|
|
5539
|
-
})
|
|
5569
|
+
}),
|
|
5570
|
+
isPrefetch: false
|
|
5540
5571
|
});
|
|
5541
5572
|
const pageState = {
|
|
5542
5573
|
routePath: id,
|
|
@@ -5554,7 +5585,8 @@ var handlePlaygroundRequest = async ({
|
|
|
5554
5585
|
// this is checked above
|
|
5555
5586
|
}),
|
|
5556
5587
|
rules,
|
|
5557
|
-
locale: options.locale
|
|
5588
|
+
locale: options.locale,
|
|
5589
|
+
isPrefetch: void 0
|
|
5558
5590
|
};
|
|
5559
5591
|
const code = (0, import_next_app_router_shared5.serializeEvaluationResult)({
|
|
5560
5592
|
payload: pageState
|
|
@@ -5603,7 +5635,7 @@ var handleRouteRequest = async ({
|
|
|
5603
5635
|
})
|
|
5604
5636
|
]);
|
|
5605
5637
|
if (!(routeResult == null ? void 0 : routeResult.route) || ((_d = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _d.type) === "notFound") {
|
|
5606
|
-
return import_server.NextResponse.
|
|
5638
|
+
return import_server.NextResponse.rewrite(new URL("/404", request.url));
|
|
5607
5639
|
}
|
|
5608
5640
|
if (((_e = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _e.type) === "redirect") {
|
|
5609
5641
|
return handleRedirect({ request, route: routeResult.route });
|
|
@@ -5638,6 +5670,7 @@ var handleRouteRequest = async ({
|
|
|
5638
5670
|
searchParams: request.nextUrl.searchParams,
|
|
5639
5671
|
isDraftModeEnabled: draftModeEnabled
|
|
5640
5672
|
});
|
|
5673
|
+
const isPrefetch = isPrefetchRequest(request);
|
|
5641
5674
|
const { components, rules } = await extractAndEvaluateRunnables({
|
|
5642
5675
|
composition: route.compositionApiResponse.composition,
|
|
5643
5676
|
routePath,
|
|
@@ -5655,7 +5688,8 @@ var handleRouteRequest = async ({
|
|
|
5655
5688
|
searchParams: request.nextUrl.searchParams,
|
|
5656
5689
|
isDraftModeEnabled: true
|
|
5657
5690
|
// this is checked above
|
|
5658
|
-
})
|
|
5691
|
+
}),
|
|
5692
|
+
isPrefetch
|
|
5659
5693
|
});
|
|
5660
5694
|
const pageState = {
|
|
5661
5695
|
routePath,
|
|
@@ -5669,7 +5703,8 @@ var handleRouteRequest = async ({
|
|
|
5669
5703
|
}),
|
|
5670
5704
|
previewMode,
|
|
5671
5705
|
rules,
|
|
5672
|
-
locale: options.locale
|
|
5706
|
+
locale: options.locale,
|
|
5707
|
+
isPrefetch: isPrefetch || void 0
|
|
5673
5708
|
};
|
|
5674
5709
|
const code = (0, import_next_app_router_shared5.serializeEvaluationResult)({
|
|
5675
5710
|
payload: pageState
|
|
@@ -5689,6 +5724,9 @@ var handleRouteRequest = async ({
|
|
|
5689
5724
|
headers
|
|
5690
5725
|
});
|
|
5691
5726
|
};
|
|
5727
|
+
var isPrefetchRequest = (request) => {
|
|
5728
|
+
return request.headers.has("next-url");
|
|
5729
|
+
};
|
|
5692
5730
|
var extractAndEvaluateRunnables = async ({
|
|
5693
5731
|
composition,
|
|
5694
5732
|
routePath,
|
|
@@ -5699,12 +5737,14 @@ var extractAndEvaluateRunnables = async ({
|
|
|
5699
5737
|
releaseId,
|
|
5700
5738
|
defaultConsent,
|
|
5701
5739
|
keys,
|
|
5702
|
-
previewMode
|
|
5740
|
+
previewMode,
|
|
5741
|
+
isPrefetch
|
|
5703
5742
|
}) => {
|
|
5704
5743
|
const extracted = extractRunnables(composition);
|
|
5705
5744
|
const result = await evaluateRunnables({
|
|
5706
5745
|
runnables: extracted,
|
|
5707
5746
|
context,
|
|
5747
|
+
isPrefetch,
|
|
5708
5748
|
compositionContext: {
|
|
5709
5749
|
_id: composition._id,
|
|
5710
5750
|
type: composition.type,
|
|
@@ -5722,7 +5762,8 @@ var extractAndEvaluateRunnables = async ({
|
|
|
5722
5762
|
defaultConsent,
|
|
5723
5763
|
previewMode,
|
|
5724
5764
|
rules: void 0,
|
|
5725
|
-
locale: void 0
|
|
5765
|
+
locale: void 0,
|
|
5766
|
+
isPrefetch: isPrefetch || void 0
|
|
5726
5767
|
}
|
|
5727
5768
|
}
|
|
5728
5769
|
});
|
package/dist/middleware.mjs
CHANGED
|
@@ -510,11 +510,25 @@ async function handleRateLimits(callApi) {
|
|
|
510
510
|
}
|
|
511
511
|
const base = Math.pow(2, backoffRetries - backoffRetriesLeft) * 333;
|
|
512
512
|
const backoffWait = base + Math.round(Math.random() * (base / 2)) * (Math.random() > 0.5 ? 1 : -1);
|
|
513
|
-
await new Promise((resolve) => setTimeout(resolve, resetWait + backoffWait));
|
|
513
|
+
await new Promise((resolve) => setTimeout(resolve, Math.max(0, resetWait + backoffWait)));
|
|
514
514
|
backoffRetriesLeft -= 1;
|
|
515
515
|
}
|
|
516
516
|
return response;
|
|
517
517
|
}
|
|
518
|
+
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
519
|
+
function rewriteFiltersForApi(filters) {
|
|
520
|
+
return Object.entries(filters != null ? filters : {}).reduce(
|
|
521
|
+
(acc, [key, value]) => {
|
|
522
|
+
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
523
|
+
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
524
|
+
return {
|
|
525
|
+
...acc,
|
|
526
|
+
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
527
|
+
};
|
|
528
|
+
},
|
|
529
|
+
{}
|
|
530
|
+
);
|
|
531
|
+
}
|
|
518
532
|
var _url;
|
|
519
533
|
var _AggregateClient = class _AggregateClient2 extends ApiClient {
|
|
520
534
|
constructor(options) {
|
|
@@ -1298,20 +1312,6 @@ function createLimitPolicy({
|
|
|
1298
1312
|
return currentFunc();
|
|
1299
1313
|
};
|
|
1300
1314
|
}
|
|
1301
|
-
var isPlainObject = (obj) => typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
1302
|
-
function rewriteFilters(filters) {
|
|
1303
|
-
return Object.entries(filters != null ? filters : {}).reduce(
|
|
1304
|
-
(acc, [key, value]) => {
|
|
1305
|
-
const lhs = `filters.${key}` + (isPlainObject(value) ? `[${Object.keys(value)[0]}]` : "");
|
|
1306
|
-
const rhs = isPlainObject(value) ? Object.values(value)[0] : value;
|
|
1307
|
-
return {
|
|
1308
|
-
...acc,
|
|
1309
|
-
[lhs]: Array.isArray(rhs) ? rhs.map((v) => `${v}`.trim()).join(",") : `${rhs}`.trim()
|
|
1310
|
-
};
|
|
1311
|
-
},
|
|
1312
|
-
{}
|
|
1313
|
-
);
|
|
1314
|
-
}
|
|
1315
1315
|
var CANVAS_URL = "/api/v1/canvas";
|
|
1316
1316
|
var CanvasClient = class extends ApiClient {
|
|
1317
1317
|
constructor(options) {
|
|
@@ -1327,7 +1327,7 @@ var CanvasClient = class extends ApiClient {
|
|
|
1327
1327
|
async getCompositionList(params = {}) {
|
|
1328
1328
|
const { projectId } = this.options;
|
|
1329
1329
|
const { resolveData, filters, ...originParams } = params;
|
|
1330
|
-
const rewrittenFilters =
|
|
1330
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1331
1331
|
if (!resolveData) {
|
|
1332
1332
|
const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
|
|
1333
1333
|
return this.apiClient(fetchUri);
|
|
@@ -1447,7 +1447,7 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1447
1447
|
getEntries(options) {
|
|
1448
1448
|
const { projectId } = this.options;
|
|
1449
1449
|
const { skipDataResolution, filters, ...params } = options;
|
|
1450
|
-
const rewrittenFilters =
|
|
1450
|
+
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1451
1451
|
if (skipDataResolution) {
|
|
1452
1452
|
const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
|
|
1453
1453
|
return this.apiClient(url);
|
|
@@ -2078,11 +2078,34 @@ var stringOperatorEvaluators = {
|
|
|
2078
2078
|
endswith: endsWithEvaluator,
|
|
2079
2079
|
empty: emptyEvaluator
|
|
2080
2080
|
};
|
|
2081
|
+
var numericOperatorEvaluators = {
|
|
2082
|
+
gt: (left, right) => left > right,
|
|
2083
|
+
lt: (left, right) => left < right
|
|
2084
|
+
};
|
|
2085
|
+
function evaluateNumericOperator(criteria, matchValue) {
|
|
2086
|
+
const { op, value } = criteria;
|
|
2087
|
+
const evaluator = numericOperatorEvaluators[op];
|
|
2088
|
+
if (!evaluator) {
|
|
2089
|
+
return null;
|
|
2090
|
+
}
|
|
2091
|
+
if (typeof matchValue === "string" && matchValue.trim() === "" || typeof value === "string" && value.trim() === "") {
|
|
2092
|
+
return false;
|
|
2093
|
+
}
|
|
2094
|
+
const leftNum = Number(matchValue);
|
|
2095
|
+
const rightNum = Number(value);
|
|
2096
|
+
if (isNaN(leftNum) || isNaN(rightNum)) {
|
|
2097
|
+
return false;
|
|
2098
|
+
}
|
|
2099
|
+
return evaluator(leftNum, rightNum);
|
|
2100
|
+
}
|
|
2081
2101
|
function evaluateStringMatch(criteria, matchValue, allow) {
|
|
2082
2102
|
const { op, value } = criteria;
|
|
2083
2103
|
if (allow && !allow.has(op)) {
|
|
2084
2104
|
return null;
|
|
2085
2105
|
}
|
|
2106
|
+
if (op in numericOperatorEvaluators) {
|
|
2107
|
+
return evaluateNumericOperator(criteria, matchValue);
|
|
2108
|
+
}
|
|
2086
2109
|
let opMatch = op;
|
|
2087
2110
|
const negation = op.startsWith("!");
|
|
2088
2111
|
if (negation) {
|
|
@@ -2573,6 +2596,9 @@ var getQuirkSerialization = () => {
|
|
|
2573
2596
|
return true;
|
|
2574
2597
|
};
|
|
2575
2598
|
var getMiddlewareRuntimeCache = () => {
|
|
2599
|
+
if (process.env.NODE_ENV === "development" && !process.env.RUNTIME_CACHE_ENDPOINT) {
|
|
2600
|
+
return false;
|
|
2601
|
+
}
|
|
2576
2602
|
if (typeof config.middlewareRuntimeCache === "boolean") {
|
|
2577
2603
|
return config.middlewareRuntimeCache;
|
|
2578
2604
|
}
|
|
@@ -3013,7 +3039,8 @@ import {
|
|
|
3013
3039
|
var evaluateRunnables = async ({
|
|
3014
3040
|
runnables,
|
|
3015
3041
|
context,
|
|
3016
|
-
compositionContext
|
|
3042
|
+
compositionContext,
|
|
3043
|
+
isPrefetch
|
|
3017
3044
|
}) => {
|
|
3018
3045
|
var _a;
|
|
3019
3046
|
const result = {
|
|
@@ -3023,6 +3050,9 @@ var evaluateRunnables = async ({
|
|
|
3023
3050
|
const runnablesToProcess = runnables.filter((item2) => item2.variantId === void 0);
|
|
3024
3051
|
let item;
|
|
3025
3052
|
while (item = runnablesToProcess.shift()) {
|
|
3053
|
+
if (item.type === "test" && isPrefetch) {
|
|
3054
|
+
continue;
|
|
3055
|
+
}
|
|
3026
3056
|
if (item.type === "test") {
|
|
3027
3057
|
const testResult = evaluateTest({
|
|
3028
3058
|
context,
|
|
@@ -5528,7 +5558,8 @@ var handlePlaygroundRequest = async ({
|
|
|
5528
5558
|
searchParams: request.nextUrl.searchParams,
|
|
5529
5559
|
isDraftModeEnabled: true
|
|
5530
5560
|
// this is checked above
|
|
5531
|
-
})
|
|
5561
|
+
}),
|
|
5562
|
+
isPrefetch: false
|
|
5532
5563
|
});
|
|
5533
5564
|
const pageState = {
|
|
5534
5565
|
routePath: id,
|
|
@@ -5546,7 +5577,8 @@ var handlePlaygroundRequest = async ({
|
|
|
5546
5577
|
// this is checked above
|
|
5547
5578
|
}),
|
|
5548
5579
|
rules,
|
|
5549
|
-
locale: options.locale
|
|
5580
|
+
locale: options.locale,
|
|
5581
|
+
isPrefetch: void 0
|
|
5550
5582
|
};
|
|
5551
5583
|
const code = serializeEvaluationResult({
|
|
5552
5584
|
payload: pageState
|
|
@@ -5595,7 +5627,7 @@ var handleRouteRequest = async ({
|
|
|
5595
5627
|
})
|
|
5596
5628
|
]);
|
|
5597
5629
|
if (!(routeResult == null ? void 0 : routeResult.route) || ((_d = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _d.type) === "notFound") {
|
|
5598
|
-
return NextResponse.
|
|
5630
|
+
return NextResponse.rewrite(new URL("/404", request.url));
|
|
5599
5631
|
}
|
|
5600
5632
|
if (((_e = routeResult == null ? void 0 : routeResult.route) == null ? void 0 : _e.type) === "redirect") {
|
|
5601
5633
|
return handleRedirect({ request, route: routeResult.route });
|
|
@@ -5630,6 +5662,7 @@ var handleRouteRequest = async ({
|
|
|
5630
5662
|
searchParams: request.nextUrl.searchParams,
|
|
5631
5663
|
isDraftModeEnabled: draftModeEnabled
|
|
5632
5664
|
});
|
|
5665
|
+
const isPrefetch = isPrefetchRequest(request);
|
|
5633
5666
|
const { components, rules } = await extractAndEvaluateRunnables({
|
|
5634
5667
|
composition: route.compositionApiResponse.composition,
|
|
5635
5668
|
routePath,
|
|
@@ -5647,7 +5680,8 @@ var handleRouteRequest = async ({
|
|
|
5647
5680
|
searchParams: request.nextUrl.searchParams,
|
|
5648
5681
|
isDraftModeEnabled: true
|
|
5649
5682
|
// this is checked above
|
|
5650
|
-
})
|
|
5683
|
+
}),
|
|
5684
|
+
isPrefetch
|
|
5651
5685
|
});
|
|
5652
5686
|
const pageState = {
|
|
5653
5687
|
routePath,
|
|
@@ -5661,7 +5695,8 @@ var handleRouteRequest = async ({
|
|
|
5661
5695
|
}),
|
|
5662
5696
|
previewMode,
|
|
5663
5697
|
rules,
|
|
5664
|
-
locale: options.locale
|
|
5698
|
+
locale: options.locale,
|
|
5699
|
+
isPrefetch: isPrefetch || void 0
|
|
5665
5700
|
};
|
|
5666
5701
|
const code = serializeEvaluationResult({
|
|
5667
5702
|
payload: pageState
|
|
@@ -5681,6 +5716,9 @@ var handleRouteRequest = async ({
|
|
|
5681
5716
|
headers
|
|
5682
5717
|
});
|
|
5683
5718
|
};
|
|
5719
|
+
var isPrefetchRequest = (request) => {
|
|
5720
|
+
return request.headers.has("next-url");
|
|
5721
|
+
};
|
|
5684
5722
|
var extractAndEvaluateRunnables = async ({
|
|
5685
5723
|
composition,
|
|
5686
5724
|
routePath,
|
|
@@ -5691,12 +5729,14 @@ var extractAndEvaluateRunnables = async ({
|
|
|
5691
5729
|
releaseId,
|
|
5692
5730
|
defaultConsent,
|
|
5693
5731
|
keys,
|
|
5694
|
-
previewMode
|
|
5732
|
+
previewMode,
|
|
5733
|
+
isPrefetch
|
|
5695
5734
|
}) => {
|
|
5696
5735
|
const extracted = extractRunnables(composition);
|
|
5697
5736
|
const result = await evaluateRunnables({
|
|
5698
5737
|
runnables: extracted,
|
|
5699
5738
|
context,
|
|
5739
|
+
isPrefetch,
|
|
5700
5740
|
compositionContext: {
|
|
5701
5741
|
_id: composition._id,
|
|
5702
5742
|
type: composition.type,
|
|
@@ -5714,7 +5754,8 @@ var extractAndEvaluateRunnables = async ({
|
|
|
5714
5754
|
defaultConsent,
|
|
5715
5755
|
previewMode,
|
|
5716
5756
|
rules: void 0,
|
|
5717
|
-
locale: void 0
|
|
5757
|
+
locale: void 0,
|
|
5758
|
+
isPrefetch: isPrefetch || void 0
|
|
5718
5759
|
}
|
|
5719
5760
|
}
|
|
5720
5761
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uniformdev/next-app-router",
|
|
3
|
-
"version": "20.49.
|
|
3
|
+
"version": "20.49.4-alpha.102+140d1a56b4",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup",
|
|
@@ -99,12 +99,12 @@
|
|
|
99
99
|
"vitest": "3.2.4"
|
|
100
100
|
},
|
|
101
101
|
"dependencies": {
|
|
102
|
-
"@uniformdev/canvas-react": "20.49.
|
|
103
|
-
"@uniformdev/next-app-router-client": "20.49.
|
|
104
|
-
"@uniformdev/next-app-router-shared": "20.49.
|
|
105
|
-
"@uniformdev/redirect": "20.49.
|
|
106
|
-
"@uniformdev/richtext": "20.49.
|
|
107
|
-
"@uniformdev/webhooks": "20.49.
|
|
102
|
+
"@uniformdev/canvas-react": "20.49.4-alpha.102+140d1a56b4",
|
|
103
|
+
"@uniformdev/next-app-router-client": "20.49.4-alpha.102+140d1a56b4",
|
|
104
|
+
"@uniformdev/next-app-router-shared": "20.49.4-alpha.102+140d1a56b4",
|
|
105
|
+
"@uniformdev/redirect": "20.49.4-alpha.102+140d1a56b4",
|
|
106
|
+
"@uniformdev/richtext": "20.49.4-alpha.102+140d1a56b4",
|
|
107
|
+
"@uniformdev/webhooks": "20.49.4-alpha.102+140d1a56b4",
|
|
108
108
|
"@vercel/functions": "^2.2.2",
|
|
109
109
|
"encoding": "^0.1.13",
|
|
110
110
|
"server-only": "^0.0.1",
|
|
@@ -121,5 +121,5 @@
|
|
|
121
121
|
"publishConfig": {
|
|
122
122
|
"access": "public"
|
|
123
123
|
},
|
|
124
|
-
"gitHead": "
|
|
124
|
+
"gitHead": "140d1a56b4b45021216a166bcaf7ebe629681b0b"
|
|
125
125
|
}
|