@uniformdev/next-app-router 20.50.2-alpha.1 → 20.50.2-alpha.39
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 +47 -21
- package/dist/cache.mjs +47 -21
- 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.esm.js +51 -24
- package/dist/index.js +51 -24
- package/dist/index.mjs +51 -24
- package/dist/middleware.js +68 -37
- package/dist/middleware.mjs +68 -37
- package/package.json +8 -8
package/dist/cache.js
CHANGED
|
@@ -335,6 +335,20 @@ async function handleRateLimits(callApi) {
|
|
|
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);
|
|
@@ -1309,6 +1309,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1309
1309
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
1310
1310
|
__privateAdd2(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
1311
1311
|
var _url22;
|
|
1312
|
+
var _projectsUrl;
|
|
1312
1313
|
var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
1313
1314
|
constructor(options) {
|
|
1314
1315
|
super({ ...options, bypassCache: true });
|
|
@@ -1318,6 +1319,15 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1318
1319
|
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22), { ...options });
|
|
1319
1320
|
return await this.apiClient(fetchUri);
|
|
1320
1321
|
}
|
|
1322
|
+
/**
|
|
1323
|
+
* Fetches projects grouped by team.
|
|
1324
|
+
* When teamId is provided, returns a single team with its projects.
|
|
1325
|
+
* When omitted, returns all accessible teams and their projects.
|
|
1326
|
+
*/
|
|
1327
|
+
async getProjects(options) {
|
|
1328
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
1329
|
+
return await this.apiClient(fetchUri);
|
|
1330
|
+
}
|
|
1321
1331
|
/** Updates or creates (based on id) a Project */
|
|
1322
1332
|
async upsert(body) {
|
|
1323
1333
|
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
|
|
@@ -1337,7 +1347,9 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1337
1347
|
}
|
|
1338
1348
|
};
|
|
1339
1349
|
_url22 = /* @__PURE__ */ new WeakMap();
|
|
1350
|
+
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
1340
1351
|
__privateAdd2(_ProjectClient, _url22, "/api/v1/project");
|
|
1352
|
+
__privateAdd2(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
1341
1353
|
var ROUTE_URL = "/api/v1/route";
|
|
1342
1354
|
var RouteClient = class extends ApiClient {
|
|
1343
1355
|
constructor(options) {
|
|
@@ -1400,8 +1412,15 @@ var isIncontextEditingEnabled = ({
|
|
|
1400
1412
|
var isDevelopmentEnvironment = () => {
|
|
1401
1413
|
return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
1402
1414
|
};
|
|
1415
|
+
var shouldIgnoreRedirects = ({ state }) => {
|
|
1416
|
+
const isNotPublished = state !== CANVAS_PUBLISHED_STATE;
|
|
1417
|
+
return isNotPublished ? true : void 0;
|
|
1418
|
+
};
|
|
1403
1419
|
|
|
1404
1420
|
// src/clients/cache.ts
|
|
1421
|
+
var isSpecificCacheMode = (options) => {
|
|
1422
|
+
return "cache" in options;
|
|
1423
|
+
};
|
|
1405
1424
|
var isStateCacheMode = (options) => {
|
|
1406
1425
|
return "state" in options;
|
|
1407
1426
|
};
|
|
@@ -1423,7 +1442,9 @@ var resolveCache = ({
|
|
|
1423
1442
|
}) => {
|
|
1424
1443
|
let cache = void 0;
|
|
1425
1444
|
if (options) {
|
|
1426
|
-
if (
|
|
1445
|
+
if (isSpecificCacheMode(options)) {
|
|
1446
|
+
cache = options.cache;
|
|
1447
|
+
} else if (isStateCacheMode(options)) {
|
|
1427
1448
|
if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
|
|
1428
1449
|
cache = {
|
|
1429
1450
|
type: "no-cache",
|
|
@@ -1743,7 +1764,10 @@ var DefaultDataClient = class {
|
|
|
1743
1764
|
}
|
|
1744
1765
|
}
|
|
1745
1766
|
const manifest = await getManifest({
|
|
1746
|
-
cache: {
|
|
1767
|
+
cache: isDevelopmentEnvironment() ? {
|
|
1768
|
+
type: "no-cache",
|
|
1769
|
+
bypassCache: true
|
|
1770
|
+
} : {
|
|
1747
1771
|
type: "force-cache"
|
|
1748
1772
|
}
|
|
1749
1773
|
});
|
|
@@ -1846,12 +1870,13 @@ var DefaultDataClient = class {
|
|
|
1846
1870
|
};
|
|
1847
1871
|
}
|
|
1848
1872
|
async getRoutePageState(options) {
|
|
1873
|
+
const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
|
|
1849
1874
|
const routeClient = getRouteClient({
|
|
1850
|
-
cache:
|
|
1851
|
-
type: "force-cache"
|
|
1852
|
-
} : {
|
|
1875
|
+
cache: shouldBypassCache ? {
|
|
1853
1876
|
type: "no-cache",
|
|
1854
1877
|
bypassCache: true
|
|
1878
|
+
} : {
|
|
1879
|
+
type: "force-cache"
|
|
1855
1880
|
}
|
|
1856
1881
|
});
|
|
1857
1882
|
const originalRoute = {
|
|
@@ -1859,7 +1884,8 @@ var DefaultDataClient = class {
|
|
|
1859
1884
|
state: options.pageState.compositionState,
|
|
1860
1885
|
withComponentIDs: true,
|
|
1861
1886
|
releaseId: options.pageState.releaseId,
|
|
1862
|
-
locale: options.pageState.locale
|
|
1887
|
+
locale: options.pageState.locale,
|
|
1888
|
+
ignoreRedirects: shouldIgnoreRedirects({ state: options.pageState.compositionState })
|
|
1863
1889
|
};
|
|
1864
1890
|
const resolvedRoute = await this.getRouteFromApi({
|
|
1865
1891
|
source: "pageState",
|
package/dist/cache.mjs
CHANGED
|
@@ -322,6 +322,20 @@ async function handleRateLimits(callApi) {
|
|
|
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);
|
|
@@ -1296,6 +1296,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1296
1296
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
1297
1297
|
__privateAdd2(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
1298
1298
|
var _url22;
|
|
1299
|
+
var _projectsUrl;
|
|
1299
1300
|
var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
1300
1301
|
constructor(options) {
|
|
1301
1302
|
super({ ...options, bypassCache: true });
|
|
@@ -1305,6 +1306,15 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1305
1306
|
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22), { ...options });
|
|
1306
1307
|
return await this.apiClient(fetchUri);
|
|
1307
1308
|
}
|
|
1309
|
+
/**
|
|
1310
|
+
* Fetches projects grouped by team.
|
|
1311
|
+
* When teamId is provided, returns a single team with its projects.
|
|
1312
|
+
* When omitted, returns all accessible teams and their projects.
|
|
1313
|
+
*/
|
|
1314
|
+
async getProjects(options) {
|
|
1315
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
1316
|
+
return await this.apiClient(fetchUri);
|
|
1317
|
+
}
|
|
1308
1318
|
/** Updates or creates (based on id) a Project */
|
|
1309
1319
|
async upsert(body) {
|
|
1310
1320
|
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
|
|
@@ -1324,7 +1334,9 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1324
1334
|
}
|
|
1325
1335
|
};
|
|
1326
1336
|
_url22 = /* @__PURE__ */ new WeakMap();
|
|
1337
|
+
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
1327
1338
|
__privateAdd2(_ProjectClient, _url22, "/api/v1/project");
|
|
1339
|
+
__privateAdd2(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
1328
1340
|
var ROUTE_URL = "/api/v1/route";
|
|
1329
1341
|
var RouteClient = class extends ApiClient {
|
|
1330
1342
|
constructor(options) {
|
|
@@ -1387,8 +1399,15 @@ var isIncontextEditingEnabled = ({
|
|
|
1387
1399
|
var isDevelopmentEnvironment = () => {
|
|
1388
1400
|
return process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
|
1389
1401
|
};
|
|
1402
|
+
var shouldIgnoreRedirects = ({ state }) => {
|
|
1403
|
+
const isNotPublished = state !== CANVAS_PUBLISHED_STATE;
|
|
1404
|
+
return isNotPublished ? true : void 0;
|
|
1405
|
+
};
|
|
1390
1406
|
|
|
1391
1407
|
// src/clients/cache.ts
|
|
1408
|
+
var isSpecificCacheMode = (options) => {
|
|
1409
|
+
return "cache" in options;
|
|
1410
|
+
};
|
|
1392
1411
|
var isStateCacheMode = (options) => {
|
|
1393
1412
|
return "state" in options;
|
|
1394
1413
|
};
|
|
@@ -1410,7 +1429,9 @@ var resolveCache = ({
|
|
|
1410
1429
|
}) => {
|
|
1411
1430
|
let cache = void 0;
|
|
1412
1431
|
if (options) {
|
|
1413
|
-
if (
|
|
1432
|
+
if (isSpecificCacheMode(options)) {
|
|
1433
|
+
cache = options.cache;
|
|
1434
|
+
} else if (isStateCacheMode(options)) {
|
|
1414
1435
|
if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
|
|
1415
1436
|
cache = {
|
|
1416
1437
|
type: "no-cache",
|
|
@@ -1730,7 +1751,10 @@ var DefaultDataClient = class {
|
|
|
1730
1751
|
}
|
|
1731
1752
|
}
|
|
1732
1753
|
const manifest = await getManifest({
|
|
1733
|
-
cache: {
|
|
1754
|
+
cache: isDevelopmentEnvironment() ? {
|
|
1755
|
+
type: "no-cache",
|
|
1756
|
+
bypassCache: true
|
|
1757
|
+
} : {
|
|
1734
1758
|
type: "force-cache"
|
|
1735
1759
|
}
|
|
1736
1760
|
});
|
|
@@ -1833,12 +1857,13 @@ var DefaultDataClient = class {
|
|
|
1833
1857
|
};
|
|
1834
1858
|
}
|
|
1835
1859
|
async getRoutePageState(options) {
|
|
1860
|
+
const shouldBypassCache = options.pageState.compositionState !== CANVAS_PUBLISHED_STATE || isDevelopmentEnvironment();
|
|
1836
1861
|
const routeClient = getRouteClient({
|
|
1837
|
-
cache:
|
|
1838
|
-
type: "force-cache"
|
|
1839
|
-
} : {
|
|
1862
|
+
cache: shouldBypassCache ? {
|
|
1840
1863
|
type: "no-cache",
|
|
1841
1864
|
bypassCache: true
|
|
1865
|
+
} : {
|
|
1866
|
+
type: "force-cache"
|
|
1842
1867
|
}
|
|
1843
1868
|
});
|
|
1844
1869
|
const originalRoute = {
|
|
@@ -1846,7 +1871,8 @@ var DefaultDataClient = class {
|
|
|
1846
1871
|
state: options.pageState.compositionState,
|
|
1847
1872
|
withComponentIDs: true,
|
|
1848
1873
|
releaseId: options.pageState.releaseId,
|
|
1849
|
-
locale: options.pageState.locale
|
|
1874
|
+
locale: options.pageState.locale,
|
|
1875
|
+
ignoreRedirects: shouldIgnoreRedirects({ state: options.pageState.compositionState })
|
|
1850
1876
|
};
|
|
1851
1877
|
const resolvedRoute = await this.getRouteFromApi({
|
|
1852
1878
|
source: "pageState",
|
package/dist/component.js
CHANGED
|
@@ -390,6 +390,20 @@ async function handleRateLimits(callApi) {
|
|
|
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);
|
|
@@ -1169,6 +1169,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1169
1169
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
1170
1170
|
__privateAdd2(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
1171
1171
|
var _url22;
|
|
1172
|
+
var _projectsUrl;
|
|
1172
1173
|
var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
1173
1174
|
constructor(options) {
|
|
1174
1175
|
super({ ...options, bypassCache: true });
|
|
@@ -1178,6 +1179,15 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1178
1179
|
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22), { ...options });
|
|
1179
1180
|
return await this.apiClient(fetchUri);
|
|
1180
1181
|
}
|
|
1182
|
+
/**
|
|
1183
|
+
* Fetches projects grouped by team.
|
|
1184
|
+
* When teamId is provided, returns a single team with its projects.
|
|
1185
|
+
* When omitted, returns all accessible teams and their projects.
|
|
1186
|
+
*/
|
|
1187
|
+
async getProjects(options) {
|
|
1188
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
1189
|
+
return await this.apiClient(fetchUri);
|
|
1190
|
+
}
|
|
1181
1191
|
/** Updates or creates (based on id) a Project */
|
|
1182
1192
|
async upsert(body) {
|
|
1183
1193
|
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
|
|
@@ -1197,7 +1207,9 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1197
1207
|
}
|
|
1198
1208
|
};
|
|
1199
1209
|
_url22 = /* @__PURE__ */ new WeakMap();
|
|
1210
|
+
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
1200
1211
|
__privateAdd2(_ProjectClient, _url22, "/api/v1/project");
|
|
1212
|
+
__privateAdd2(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
1201
1213
|
var ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
|
1202
1214
|
var ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
|
1203
1215
|
var ATTRIBUTE_PARAMETER_TYPE = "data-uniform-parameter-type";
|
package/dist/component.mjs
CHANGED
|
@@ -375,6 +375,20 @@ async function handleRateLimits(callApi) {
|
|
|
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);
|
|
@@ -1154,6 +1154,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1154
1154
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
1155
1155
|
__privateAdd2(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
1156
1156
|
var _url22;
|
|
1157
|
+
var _projectsUrl;
|
|
1157
1158
|
var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
1158
1159
|
constructor(options) {
|
|
1159
1160
|
super({ ...options, bypassCache: true });
|
|
@@ -1163,6 +1164,15 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1163
1164
|
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22), { ...options });
|
|
1164
1165
|
return await this.apiClient(fetchUri);
|
|
1165
1166
|
}
|
|
1167
|
+
/**
|
|
1168
|
+
* Fetches projects grouped by team.
|
|
1169
|
+
* When teamId is provided, returns a single team with its projects.
|
|
1170
|
+
* When omitted, returns all accessible teams and their projects.
|
|
1171
|
+
*/
|
|
1172
|
+
async getProjects(options) {
|
|
1173
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
1174
|
+
return await this.apiClient(fetchUri);
|
|
1175
|
+
}
|
|
1166
1176
|
/** Updates or creates (based on id) a Project */
|
|
1167
1177
|
async upsert(body) {
|
|
1168
1178
|
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
|
|
@@ -1182,7 +1192,9 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1182
1192
|
}
|
|
1183
1193
|
};
|
|
1184
1194
|
_url22 = /* @__PURE__ */ new WeakMap();
|
|
1195
|
+
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
1185
1196
|
__privateAdd2(_ProjectClient, _url22, "/api/v1/project");
|
|
1197
|
+
__privateAdd2(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
1186
1198
|
var ATTRIBUTE_COMPONENT_ID = "data-uniform-component-id";
|
|
1187
1199
|
var ATTRIBUTE_PARAMETER_ID = "data-uniform-parameter-id";
|
|
1188
1200
|
var ATTRIBUTE_PARAMETER_TYPE = "data-uniform-parameter-type";
|
package/dist/handler.js
CHANGED
|
@@ -334,6 +334,20 @@ async function handleRateLimits(callApi) {
|
|
|
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);
|
|
@@ -1503,6 +1503,7 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1503
1503
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
1504
1504
|
__privateAdd2(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
1505
1505
|
var _url22;
|
|
1506
|
+
var _projectsUrl;
|
|
1506
1507
|
var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
1507
1508
|
constructor(options) {
|
|
1508
1509
|
super({ ...options, bypassCache: true });
|
|
@@ -1512,6 +1513,15 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1512
1513
|
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22), { ...options });
|
|
1513
1514
|
return await this.apiClient(fetchUri);
|
|
1514
1515
|
}
|
|
1516
|
+
/**
|
|
1517
|
+
* Fetches projects grouped by team.
|
|
1518
|
+
* When teamId is provided, returns a single team with its projects.
|
|
1519
|
+
* When omitted, returns all accessible teams and their projects.
|
|
1520
|
+
*/
|
|
1521
|
+
async getProjects(options) {
|
|
1522
|
+
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
1523
|
+
return await this.apiClient(fetchUri);
|
|
1524
|
+
}
|
|
1515
1525
|
/** Updates or creates (based on id) a Project */
|
|
1516
1526
|
async upsert(body) {
|
|
1517
1527
|
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
|
|
@@ -1531,7 +1541,9 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1531
1541
|
}
|
|
1532
1542
|
};
|
|
1533
1543
|
_url22 = /* @__PURE__ */ new WeakMap();
|
|
1544
|
+
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
1534
1545
|
__privateAdd2(_ProjectClient, _url22, "/api/v1/project");
|
|
1546
|
+
__privateAdd2(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
1535
1547
|
var isAllowedReferrer = (referrer) => {
|
|
1536
1548
|
return Boolean(referrer == null ? void 0 : referrer.match(/(^https:\/\/|\.)(uniform.app|uniform.wtf|localhost:\d{4})\//));
|
|
1537
1549
|
};
|
|
@@ -1774,6 +1786,9 @@ var isDevelopmentEnvironment = () => {
|
|
|
1774
1786
|
};
|
|
1775
1787
|
|
|
1776
1788
|
// src/clients/cache.ts
|
|
1789
|
+
var isSpecificCacheMode = (options) => {
|
|
1790
|
+
return "cache" in options;
|
|
1791
|
+
};
|
|
1777
1792
|
var isStateCacheMode = (options) => {
|
|
1778
1793
|
return "state" in options;
|
|
1779
1794
|
};
|
|
@@ -1795,7 +1810,9 @@ var resolveCache = ({
|
|
|
1795
1810
|
}) => {
|
|
1796
1811
|
let cache = void 0;
|
|
1797
1812
|
if (options) {
|
|
1798
|
-
if (
|
|
1813
|
+
if (isSpecificCacheMode(options)) {
|
|
1814
|
+
cache = options.cache;
|
|
1815
|
+
} else if (isStateCacheMode(options)) {
|
|
1799
1816
|
if (options.state === CANVAS_DRAFT_STATE || options.state === CANVAS_EDITOR_STATE) {
|
|
1800
1817
|
cache = {
|
|
1801
1818
|
type: "no-cache",
|
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",
|