@uniformdev/next-app-router 20.72.2-alpha.3 → 20.72.3-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cache.js +95 -23
- package/dist/cache.mjs +95 -23
- package/dist/component.js +78 -16
- package/dist/component.mjs +79 -17
- package/dist/handler.js +209 -150
- package/dist/handler.mjs +209 -150
- package/dist/index.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.esm.js +250 -52
- package/dist/index.js +251 -52
- package/dist/index.mjs +250 -52
- package/dist/middleware.js +200 -163
- package/dist/middleware.mjs +200 -163
- package/package.json +8 -8
package/dist/handler.js
CHANGED
|
@@ -1206,6 +1206,16 @@ function createLimitPolicy({
|
|
|
1206
1206
|
return currentFunc();
|
|
1207
1207
|
};
|
|
1208
1208
|
}
|
|
1209
|
+
var ContentClientBase = class extends ApiClient {
|
|
1210
|
+
constructor(options, defaultBypassCache) {
|
|
1211
|
+
var _a, _b;
|
|
1212
|
+
super({
|
|
1213
|
+
...options,
|
|
1214
|
+
limitPolicy: (_a = options.limitPolicy) != null ? _a : createLimitPolicy({}),
|
|
1215
|
+
bypassCache: (_b = options.bypassCache) != null ? _b : defaultBypassCache
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
};
|
|
1209
1219
|
var SELECT_QUERY_PREFIX = "select.";
|
|
1210
1220
|
function appendCsv(out, key, values) {
|
|
1211
1221
|
if (values === void 0) {
|
|
@@ -1250,130 +1260,94 @@ function projectionToQuery(spec) {
|
|
|
1250
1260
|
}
|
|
1251
1261
|
return out;
|
|
1252
1262
|
}
|
|
1253
|
-
var
|
|
1254
|
-
var
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
projectId,
|
|
1274
|
-
...rewrittenFilters,
|
|
1275
|
-
...rewrittenSelect
|
|
1276
|
-
});
|
|
1277
|
-
return this.apiClient(fetchUri);
|
|
1278
|
-
}
|
|
1279
|
-
const edgeParams = {
|
|
1280
|
-
...originParams,
|
|
1281
|
-
projectId,
|
|
1282
|
-
diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
|
|
1283
|
-
...rewrittenFilters,
|
|
1284
|
-
...rewrittenSelect
|
|
1285
|
-
};
|
|
1286
|
-
const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
|
|
1287
|
-
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
1288
|
-
}
|
|
1289
|
-
getCompositionByNodePath(options) {
|
|
1290
|
-
return this.getOneComposition(options);
|
|
1291
|
-
}
|
|
1292
|
-
getCompositionByNodeId(options) {
|
|
1293
|
-
return this.getOneComposition(options);
|
|
1294
|
-
}
|
|
1295
|
-
getCompositionBySlug(options) {
|
|
1296
|
-
return this.getOneComposition(options);
|
|
1297
|
-
}
|
|
1298
|
-
getCompositionById(options) {
|
|
1299
|
-
return this.getOneComposition(options);
|
|
1300
|
-
}
|
|
1301
|
-
getCompositionDefaults(options) {
|
|
1302
|
-
return this.getOneComposition(options);
|
|
1303
|
-
}
|
|
1304
|
-
/** Fetches historical versions of a composition or pattern */
|
|
1305
|
-
async getCompositionHistory(options) {
|
|
1306
|
-
const historyUrl = this.createUrl("/api/v1/canvas-history", {
|
|
1307
|
-
...options,
|
|
1308
|
-
projectId: this.options.projectId
|
|
1309
|
-
});
|
|
1310
|
-
return this.apiClient(historyUrl);
|
|
1311
|
-
}
|
|
1312
|
-
getOneComposition({
|
|
1313
|
-
skipDataResolution,
|
|
1314
|
-
diagnostics,
|
|
1315
|
-
...params
|
|
1316
|
-
}) {
|
|
1317
|
-
const { projectId } = this.options;
|
|
1318
|
-
if (skipDataResolution) {
|
|
1319
|
-
return this.apiClient(this.createUrl(CANVAS_URL, { ...params, projectId }));
|
|
1320
|
-
}
|
|
1321
|
-
const edgeParams = {
|
|
1322
|
-
...params,
|
|
1323
|
-
projectId,
|
|
1324
|
-
diagnostics: typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0
|
|
1263
|
+
var CANVAS_DRAFT_STATE = 0;
|
|
1264
|
+
var CANVAS_PUBLISHED_STATE = 64;
|
|
1265
|
+
var CANVAS_EDITOR_STATE = 63;
|
|
1266
|
+
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1267
|
+
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1268
|
+
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1269
|
+
var SECRET_QUERY_STRING_PARAM = "secret";
|
|
1270
|
+
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1271
|
+
var IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM = "is_incontext_editing_playground";
|
|
1272
|
+
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1273
|
+
function resolveCompositionSelector(args) {
|
|
1274
|
+
if ("compositionId" in args) {
|
|
1275
|
+
const { compositionId, editionId, versionId, ...readOptions } = args;
|
|
1276
|
+
return {
|
|
1277
|
+
readOptions,
|
|
1278
|
+
// raw mode matches on composition OR edition id via the compositionId param
|
|
1279
|
+
compositionId: editionId != null ? editionId : compositionId,
|
|
1280
|
+
versionId,
|
|
1281
|
+
hasCompositionId: true,
|
|
1282
|
+
pinnedEdition: editionId !== void 0
|
|
1325
1283
|
};
|
|
1326
|
-
const edgeUrl = this.createUrl("/api/v1/composition", edgeParams, this.edgeApiHost);
|
|
1327
|
-
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
1328
1284
|
}
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
}
|
|
1342
|
-
return { modified: response.headers.get("x-modified-at") };
|
|
1285
|
+
return { readOptions: args, hasCompositionId: false, pinnedEdition: false };
|
|
1286
|
+
}
|
|
1287
|
+
var DEFAULT_EDGE_API_HOST = "https://uniform.global";
|
|
1288
|
+
var DeliveryClientBase = class extends ContentClientBase {
|
|
1289
|
+
constructor(options) {
|
|
1290
|
+
var _a;
|
|
1291
|
+
super(
|
|
1292
|
+
options,
|
|
1293
|
+
/* defaultBypassCache */
|
|
1294
|
+
false
|
|
1295
|
+
);
|
|
1296
|
+
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : DEFAULT_EDGE_API_HOST;
|
|
1297
|
+
this.edgeRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
|
|
1343
1298
|
}
|
|
1344
|
-
/**
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
const { projectId } = this.options;
|
|
1348
|
-
await this.apiClient(fetchUri, {
|
|
1349
|
-
method: "DELETE",
|
|
1350
|
-
body: JSON.stringify({ ...body, projectId }),
|
|
1351
|
-
expectNoContent: true
|
|
1352
|
-
});
|
|
1299
|
+
/** Coerces the `diagnostics` option into the shape the edge endpoints accept. */
|
|
1300
|
+
coerceDiagnostics(diagnostics) {
|
|
1301
|
+
return typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0;
|
|
1353
1302
|
}
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1303
|
+
};
|
|
1304
|
+
var EDGE_SINGLE_URL = "/api/v1/composition";
|
|
1305
|
+
var EDGE_LIST_URL = "/api/v1/compositions";
|
|
1306
|
+
var CompositionDeliveryClient = class extends DeliveryClientBase {
|
|
1307
|
+
constructor(options) {
|
|
1308
|
+
super(options);
|
|
1359
1309
|
}
|
|
1360
|
-
/**
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1310
|
+
/** Fetches exactly one composition (throws `ApiClientError(404)` if absent). */
|
|
1311
|
+
get(args) {
|
|
1312
|
+
var _a;
|
|
1313
|
+
const { diagnostics, select, ...rest } = args;
|
|
1314
|
+
const { readOptions, compositionId, versionId, pinnedEdition } = resolveCompositionSelector(rest);
|
|
1315
|
+
const url = this.createUrl(
|
|
1316
|
+
EDGE_SINGLE_URL,
|
|
1317
|
+
{
|
|
1318
|
+
...readOptions,
|
|
1319
|
+
...projectionToQuery(select),
|
|
1320
|
+
// A pinned edition is folded into compositionId (raw matches edition or
|
|
1321
|
+
// composition id); there is no editionId query param on this endpoint.
|
|
1322
|
+
compositionId,
|
|
1323
|
+
versionId,
|
|
1324
|
+
projectId: this.options.projectId,
|
|
1325
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
1326
|
+
// editionId pins a specific edition for preview; otherwise locale-best.
|
|
1327
|
+
editions: pinnedEdition ? "raw" : "auto",
|
|
1328
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
1329
|
+
},
|
|
1330
|
+
this.edgeApiHost
|
|
1331
|
+
);
|
|
1332
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
1368
1333
|
}
|
|
1369
|
-
/**
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1334
|
+
/** Fetches a list of compositions, optionally filtered. */
|
|
1335
|
+
list(args = {}) {
|
|
1336
|
+
var _a;
|
|
1337
|
+
const { diagnostics, filters, select, ...rest } = args;
|
|
1338
|
+
const url = this.createUrl(
|
|
1339
|
+
EDGE_LIST_URL,
|
|
1340
|
+
{
|
|
1341
|
+
...rest,
|
|
1342
|
+
...rewriteFiltersForApi(filters),
|
|
1343
|
+
...projectionToQuery(select),
|
|
1344
|
+
projectId: this.options.projectId,
|
|
1345
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
1346
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
1347
|
+
},
|
|
1348
|
+
this.edgeApiHost
|
|
1349
|
+
);
|
|
1350
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
1377
1351
|
}
|
|
1378
1352
|
};
|
|
1379
1353
|
var _contentTypesUrl;
|
|
@@ -1482,14 +1456,18 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1482
1456
|
constructor(options) {
|
|
1483
1457
|
super(options);
|
|
1484
1458
|
}
|
|
1485
|
-
/** Fetches
|
|
1486
|
-
async
|
|
1459
|
+
/** Fetches a list of DataTypes for a project */
|
|
1460
|
+
async list(options) {
|
|
1487
1461
|
const { projectId } = this.options;
|
|
1488
1462
|
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8), { ...options, projectId });
|
|
1489
1463
|
return await this.apiClient(fetchUri);
|
|
1490
1464
|
}
|
|
1465
|
+
/** @deprecated Use {@link list} instead. */
|
|
1466
|
+
async get(options) {
|
|
1467
|
+
return this.list(options);
|
|
1468
|
+
}
|
|
1491
1469
|
/** Updates or creates (based on id) a DataType */
|
|
1492
|
-
async
|
|
1470
|
+
async save(body) {
|
|
1493
1471
|
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
1494
1472
|
await this.apiClient(fetchUri, {
|
|
1495
1473
|
method: "PUT",
|
|
@@ -1497,6 +1475,10 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1497
1475
|
expectNoContent: true
|
|
1498
1476
|
});
|
|
1499
1477
|
}
|
|
1478
|
+
/** @deprecated Use {@link save} instead. */
|
|
1479
|
+
async upsert(body) {
|
|
1480
|
+
return this.save(body);
|
|
1481
|
+
}
|
|
1500
1482
|
/** Deletes a DataType */
|
|
1501
1483
|
async remove(body) {
|
|
1502
1484
|
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
@@ -1509,15 +1491,6 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1509
1491
|
};
|
|
1510
1492
|
_url8 = /* @__PURE__ */ new WeakMap();
|
|
1511
1493
|
__privateAdd3(_DataTypeClient, _url8, "/api/v1/data-types");
|
|
1512
|
-
var CANVAS_DRAFT_STATE = 0;
|
|
1513
|
-
var CANVAS_EDITOR_STATE = 63;
|
|
1514
|
-
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1515
|
-
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1516
|
-
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1517
|
-
var SECRET_QUERY_STRING_PARAM = "secret";
|
|
1518
|
-
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1519
|
-
var IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM = "is_incontext_editing_playground";
|
|
1520
|
-
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1521
1494
|
var escapeCharacter = "\\";
|
|
1522
1495
|
var variablePrefix = "${";
|
|
1523
1496
|
var variableSuffix = "}";
|
|
@@ -1528,9 +1501,9 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1528
1501
|
let bufferStartIndex = 0;
|
|
1529
1502
|
let bufferEndIndex = 0;
|
|
1530
1503
|
let tokenCount = 0;
|
|
1531
|
-
const handleToken = (token, type) => {
|
|
1504
|
+
const handleToken = (token, type, offset) => {
|
|
1532
1505
|
tokenCount++;
|
|
1533
|
-
return onToken == null ? void 0 : onToken(token, type);
|
|
1506
|
+
return onToken == null ? void 0 : onToken(token, type, offset);
|
|
1534
1507
|
};
|
|
1535
1508
|
let state = "text";
|
|
1536
1509
|
for (let index = 0; index < serialized.length; index++) {
|
|
@@ -1541,7 +1514,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1541
1514
|
if (char === variablePrefix[0] && serialized[index + 1] === variablePrefix[1]) {
|
|
1542
1515
|
if (serialized[index - 1] === escapeCharacter) {
|
|
1543
1516
|
bufferEndIndex -= escapeCharacter.length;
|
|
1544
|
-
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
|
1517
|
+
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text", bufferStartIndex) === false) {
|
|
1545
1518
|
return tokenCount;
|
|
1546
1519
|
}
|
|
1547
1520
|
bufferStartIndex = index;
|
|
@@ -1550,12 +1523,12 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1550
1523
|
}
|
|
1551
1524
|
if (state === "variable") {
|
|
1552
1525
|
const textStart = bufferStartIndex - variablePrefix.length;
|
|
1553
|
-
if (handleToken(serialized.substring(textStart, bufferEndIndex), "text") === false) {
|
|
1526
|
+
if (handleToken(serialized.substring(textStart, bufferEndIndex), "text", textStart) === false) {
|
|
1554
1527
|
return tokenCount;
|
|
1555
1528
|
}
|
|
1556
1529
|
bufferStartIndex = bufferEndIndex;
|
|
1557
1530
|
} else if (bufferEndIndex > bufferStartIndex) {
|
|
1558
|
-
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
|
1531
|
+
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text", bufferStartIndex) === false) {
|
|
1559
1532
|
return tokenCount;
|
|
1560
1533
|
}
|
|
1561
1534
|
bufferStartIndex = bufferEndIndex;
|
|
@@ -1573,7 +1546,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1573
1546
|
state = "text";
|
|
1574
1547
|
if (bufferEndIndex > bufferStartIndex) {
|
|
1575
1548
|
const unescapedVariableName = serialized.substring(bufferStartIndex, bufferEndIndex).replace(/\\([${}])/g, "$1");
|
|
1576
|
-
if (handleToken(unescapedVariableName, "variable") === false) {
|
|
1549
|
+
if (handleToken(unescapedVariableName, "variable", bufferStartIndex) === false) {
|
|
1577
1550
|
return tokenCount;
|
|
1578
1551
|
}
|
|
1579
1552
|
bufferStartIndex = bufferEndIndex + variableSuffix.length;
|
|
@@ -1587,7 +1560,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1587
1560
|
bufferStartIndex -= variablePrefix.length;
|
|
1588
1561
|
}
|
|
1589
1562
|
if (bufferStartIndex < serialized.length) {
|
|
1590
|
-
handleToken(serialized.substring(bufferStartIndex), state);
|
|
1563
|
+
handleToken(serialized.substring(bufferStartIndex), state, bufferStartIndex);
|
|
1591
1564
|
}
|
|
1592
1565
|
return tokenCount;
|
|
1593
1566
|
}
|
|
@@ -1636,6 +1609,48 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1636
1609
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
1637
1610
|
__privateAdd3(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
1638
1611
|
var _url22;
|
|
1612
|
+
var _NotificationsClient = class _NotificationsClient2 extends ApiClient {
|
|
1613
|
+
constructor(options) {
|
|
1614
|
+
super(options);
|
|
1615
|
+
}
|
|
1616
|
+
/**
|
|
1617
|
+
* Lists notifications for the current user.
|
|
1618
|
+
*
|
|
1619
|
+
* @deprecated This API is experimental and may change without notice.
|
|
1620
|
+
*/
|
|
1621
|
+
async list(options) {
|
|
1622
|
+
const fetchUri = this.createUrl(__privateGet3(_NotificationsClient2, _url22), options);
|
|
1623
|
+
return await this.apiClient(fetchUri);
|
|
1624
|
+
}
|
|
1625
|
+
/**
|
|
1626
|
+
* Creates a notification for one or more recipients.
|
|
1627
|
+
*
|
|
1628
|
+
* @deprecated This API is experimental and may change without notice.
|
|
1629
|
+
*/
|
|
1630
|
+
async create(body) {
|
|
1631
|
+
const fetchUri = this.createUrl(__privateGet3(_NotificationsClient2, _url22));
|
|
1632
|
+
return await this.apiClient(fetchUri, {
|
|
1633
|
+
method: "POST",
|
|
1634
|
+
body: JSON.stringify(body)
|
|
1635
|
+
});
|
|
1636
|
+
}
|
|
1637
|
+
/**
|
|
1638
|
+
* Updates the read state of the current user's notifications.
|
|
1639
|
+
*
|
|
1640
|
+
* @deprecated This API is experimental and may change without notice.
|
|
1641
|
+
*/
|
|
1642
|
+
async setReadState(body) {
|
|
1643
|
+
const fetchUri = this.createUrl(__privateGet3(_NotificationsClient2, _url22));
|
|
1644
|
+
await this.apiClient(fetchUri, {
|
|
1645
|
+
method: "PATCH",
|
|
1646
|
+
body: JSON.stringify(body),
|
|
1647
|
+
expectNoContent: true
|
|
1648
|
+
});
|
|
1649
|
+
}
|
|
1650
|
+
};
|
|
1651
|
+
_url22 = /* @__PURE__ */ new WeakMap();
|
|
1652
|
+
__privateAdd3(_NotificationsClient, _url22, "/api/v1/notifications");
|
|
1653
|
+
var _url32;
|
|
1639
1654
|
var _projectsUrl;
|
|
1640
1655
|
var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
1641
1656
|
constructor(options) {
|
|
@@ -1643,7 +1658,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1643
1658
|
}
|
|
1644
1659
|
/** Fetches single Project */
|
|
1645
1660
|
async get(options) {
|
|
1646
|
-
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2,
|
|
1661
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url32), { ...options });
|
|
1647
1662
|
return await this.apiClient(fetchUri);
|
|
1648
1663
|
}
|
|
1649
1664
|
/**
|
|
@@ -1651,31 +1666,43 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1651
1666
|
* When teamId is provided, returns a single team with its projects.
|
|
1652
1667
|
* When omitted, returns all accessible teams and their projects.
|
|
1653
1668
|
*/
|
|
1654
|
-
async
|
|
1669
|
+
async list(options) {
|
|
1655
1670
|
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
1656
1671
|
return await this.apiClient(fetchUri);
|
|
1657
1672
|
}
|
|
1673
|
+
/** @deprecated Use {@link list} instead. */
|
|
1674
|
+
async getProjects(options) {
|
|
1675
|
+
return this.list(options);
|
|
1676
|
+
}
|
|
1658
1677
|
/** Updates or creates (based on id) a Project */
|
|
1659
|
-
async
|
|
1660
|
-
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2,
|
|
1678
|
+
async save(body) {
|
|
1679
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url32));
|
|
1661
1680
|
return await this.apiClient(fetchUri, {
|
|
1662
1681
|
method: "PUT",
|
|
1663
1682
|
body: JSON.stringify({ ...body })
|
|
1664
1683
|
});
|
|
1665
1684
|
}
|
|
1685
|
+
/** @deprecated Use {@link save} instead. */
|
|
1686
|
+
async upsert(body) {
|
|
1687
|
+
return this.save(body);
|
|
1688
|
+
}
|
|
1666
1689
|
/** Deletes a Project */
|
|
1667
|
-
async
|
|
1668
|
-
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2,
|
|
1690
|
+
async remove(body) {
|
|
1691
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url32));
|
|
1669
1692
|
await this.apiClient(fetchUri, {
|
|
1670
1693
|
method: "DELETE",
|
|
1671
1694
|
body: JSON.stringify({ ...body }),
|
|
1672
1695
|
expectNoContent: true
|
|
1673
1696
|
});
|
|
1674
1697
|
}
|
|
1698
|
+
/** @deprecated Use {@link remove} instead. */
|
|
1699
|
+
async delete(body) {
|
|
1700
|
+
return this.remove(body);
|
|
1701
|
+
}
|
|
1675
1702
|
};
|
|
1676
|
-
|
|
1703
|
+
_url32 = /* @__PURE__ */ new WeakMap();
|
|
1677
1704
|
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
1678
|
-
__privateAdd3(_ProjectClient,
|
|
1705
|
+
__privateAdd3(_ProjectClient, _url32, "/api/v1/project");
|
|
1679
1706
|
__privateAdd3(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
1680
1707
|
var isAllowedReferrer = (referrer) => {
|
|
1681
1708
|
return Boolean(referrer == null ? void 0 : referrer.match(/(^https:\/\/|\.)(uniform.app|uniform.wtf|localhost:\d{4})\//));
|
|
@@ -2130,9 +2157,9 @@ function createLimitPolicy2({
|
|
|
2130
2157
|
}
|
|
2131
2158
|
|
|
2132
2159
|
// src/clients/canvas.ts
|
|
2133
|
-
var
|
|
2160
|
+
var buildCanvasClientOptions = (options) => {
|
|
2134
2161
|
const cache = resolveCanvasCache(options);
|
|
2135
|
-
return
|
|
2162
|
+
return {
|
|
2136
2163
|
projectId: env.getProjectId(),
|
|
2137
2164
|
apiHost: env.getApiHost(),
|
|
2138
2165
|
apiKey: env.getApiKey(),
|
|
@@ -2180,7 +2207,10 @@ var getCanvasClient = (options) => {
|
|
|
2180
2207
|
}
|
|
2181
2208
|
});
|
|
2182
2209
|
}
|
|
2183
|
-
}
|
|
2210
|
+
};
|
|
2211
|
+
};
|
|
2212
|
+
var getCompositionDeliveryClient = (options) => {
|
|
2213
|
+
return new CompositionDeliveryClient(buildCanvasClientOptions(options));
|
|
2184
2214
|
};
|
|
2185
2215
|
|
|
2186
2216
|
// src/clients/projectMap.ts
|
|
@@ -2419,6 +2449,35 @@ var _Route = class _Route2 {
|
|
|
2419
2449
|
}
|
|
2420
2450
|
return segment.slice(_Route2.dynamicSegmentPrefix.length);
|
|
2421
2451
|
}
|
|
2452
|
+
/**
|
|
2453
|
+
* Splits a path into the path portion and an optional `#fragment`
|
|
2454
|
+
* (everything after the first `#`).
|
|
2455
|
+
*
|
|
2456
|
+
* Variable expressions (`${...}`) may legitimately contain `#` characters
|
|
2457
|
+
* (e.g. JSON-pointer tokens like `${#jptr:/foo/_slug}`), so the fragment
|
|
2458
|
+
* delimiter is the first `#` that falls outside of a variable expression.
|
|
2459
|
+
*/
|
|
2460
|
+
static splitFragment(path) {
|
|
2461
|
+
let fragmentIndex = -1;
|
|
2462
|
+
parseVariableExpression(path, (token, type, offset) => {
|
|
2463
|
+
if (type === "variable") {
|
|
2464
|
+
return;
|
|
2465
|
+
}
|
|
2466
|
+
const hashOffset = token.indexOf("#");
|
|
2467
|
+
if (hashOffset === -1) {
|
|
2468
|
+
return;
|
|
2469
|
+
}
|
|
2470
|
+
fragmentIndex = offset + hashOffset;
|
|
2471
|
+
return false;
|
|
2472
|
+
});
|
|
2473
|
+
if (fragmentIndex === -1) {
|
|
2474
|
+
return { path, fragment: void 0 };
|
|
2475
|
+
}
|
|
2476
|
+
return {
|
|
2477
|
+
path: path.slice(0, fragmentIndex),
|
|
2478
|
+
fragment: path.slice(fragmentIndex + 1)
|
|
2479
|
+
};
|
|
2480
|
+
}
|
|
2422
2481
|
};
|
|
2423
2482
|
_routeInfo = /* @__PURE__ */ new WeakMap();
|
|
2424
2483
|
_Route_static = /* @__PURE__ */ new WeakSet();
|
|
@@ -2547,13 +2606,13 @@ var processCompositionChange = async (compositionId) => {
|
|
|
2547
2606
|
};
|
|
2548
2607
|
};
|
|
2549
2608
|
var getComposition = async ({ compositionId }) => {
|
|
2550
|
-
const canvasClient =
|
|
2609
|
+
const canvasClient = getCompositionDeliveryClient({
|
|
2551
2610
|
cache: {
|
|
2552
2611
|
type: "no-cache"
|
|
2553
2612
|
}
|
|
2554
2613
|
});
|
|
2555
2614
|
try {
|
|
2556
|
-
const composition = await canvasClient.
|
|
2615
|
+
const composition = await canvasClient.get({
|
|
2557
2616
|
compositionId
|
|
2558
2617
|
});
|
|
2559
2618
|
return composition;
|