@uniformdev/next-app-router 20.72.3-alpha.2 → 20.72.3-alpha.25
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 +114 -25
- package/dist/cache.mjs +114 -25
- package/dist/component.js +111 -32
- package/dist/component.mjs +97 -18
- package/dist/handler.js +204 -158
- package/dist/handler.mjs +204 -158
- package/dist/index.d.mts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.esm.js +242 -59
- package/dist/index.js +243 -59
- package/dist/index.mjs +242 -59
- package/dist/middleware.js +219 -165
- package/dist/middleware.mjs +219 -165
- package/package.json +8 -8
package/dist/handler.js
CHANGED
|
@@ -417,6 +417,7 @@ var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cann
|
|
|
417
417
|
var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
418
418
|
var __privateAdd2 = (obj, member, value) => member.has(obj) ? __typeError2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
419
419
|
var defaultLimitPolicy = (0, import_p_limit.default)(6);
|
|
420
|
+
var UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE = "Bearer token not valid or expired";
|
|
420
421
|
var ApiClientError = class _ApiClientError extends Error {
|
|
421
422
|
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
422
423
|
super(
|
|
@@ -432,6 +433,12 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
432
433
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
433
434
|
}
|
|
434
435
|
};
|
|
436
|
+
var BearerTokenNotValidOrExpiredError = class _BearerTokenNotValidOrExpiredError extends ApiClientError {
|
|
437
|
+
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
438
|
+
super(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId);
|
|
439
|
+
Object.setPrototypeOf(this, _BearerTokenNotValidOrExpiredError.prototype);
|
|
440
|
+
}
|
|
441
|
+
};
|
|
435
442
|
var ApiClient = class _ApiClient {
|
|
436
443
|
constructor(options) {
|
|
437
444
|
__publicField2(this, "options");
|
|
@@ -465,7 +472,7 @@ var ApiClient = class _ApiClient {
|
|
|
465
472
|
}
|
|
466
473
|
async apiClientWithResponse(fetchUri, options) {
|
|
467
474
|
return this.options.limitPolicy(async () => {
|
|
468
|
-
var _a;
|
|
475
|
+
var _a, _b;
|
|
469
476
|
const coreHeaders = this.options.apiKey ? {
|
|
470
477
|
"x-api-key": this.options.apiKey
|
|
471
478
|
} : {
|
|
@@ -501,9 +508,19 @@ var ApiClient = class _ApiClient {
|
|
|
501
508
|
} catch (e) {
|
|
502
509
|
message = `General error`;
|
|
503
510
|
}
|
|
511
|
+
if (apiResponse.status === 401 && message === UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE) {
|
|
512
|
+
throw new BearerTokenNotValidOrExpiredError(
|
|
513
|
+
message,
|
|
514
|
+
(_a = options == null ? void 0 : options.method) != null ? _a : "GET",
|
|
515
|
+
fetchUri.toString(),
|
|
516
|
+
apiResponse.status,
|
|
517
|
+
apiResponse.statusText,
|
|
518
|
+
_ApiClient.getRequestId(apiResponse)
|
|
519
|
+
);
|
|
520
|
+
}
|
|
504
521
|
throw new ApiClientError(
|
|
505
522
|
message,
|
|
506
|
-
(
|
|
523
|
+
(_b = options == null ? void 0 : options.method) != null ? _b : "GET",
|
|
507
524
|
fetchUri.toString(),
|
|
508
525
|
apiResponse.status,
|
|
509
526
|
apiResponse.statusText,
|
|
@@ -1206,6 +1223,16 @@ function createLimitPolicy({
|
|
|
1206
1223
|
return currentFunc();
|
|
1207
1224
|
};
|
|
1208
1225
|
}
|
|
1226
|
+
var ContentClientBase = class extends ApiClient {
|
|
1227
|
+
constructor(options, defaultBypassCache) {
|
|
1228
|
+
var _a, _b;
|
|
1229
|
+
super({
|
|
1230
|
+
...options,
|
|
1231
|
+
limitPolicy: (_a = options.limitPolicy) != null ? _a : createLimitPolicy({}),
|
|
1232
|
+
bypassCache: (_b = options.bypassCache) != null ? _b : defaultBypassCache
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
};
|
|
1209
1236
|
var SELECT_QUERY_PREFIX = "select.";
|
|
1210
1237
|
function appendCsv(out, key, values) {
|
|
1211
1238
|
if (values === void 0) {
|
|
@@ -1250,130 +1277,94 @@ function projectionToQuery(spec) {
|
|
|
1250
1277
|
}
|
|
1251
1278
|
return out;
|
|
1252
1279
|
}
|
|
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
|
|
1280
|
+
var CANVAS_DRAFT_STATE = 0;
|
|
1281
|
+
var CANVAS_PUBLISHED_STATE = 64;
|
|
1282
|
+
var CANVAS_EDITOR_STATE = 63;
|
|
1283
|
+
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1284
|
+
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1285
|
+
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1286
|
+
var SECRET_QUERY_STRING_PARAM = "secret";
|
|
1287
|
+
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1288
|
+
var IN_CONTEXT_EDITOR_PLAYGROUND_QUERY_STRING_PARAM = "is_incontext_editing_playground";
|
|
1289
|
+
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1290
|
+
function resolveCompositionSelector(args) {
|
|
1291
|
+
if ("compositionId" in args) {
|
|
1292
|
+
const { compositionId, editionId, versionId, ...readOptions } = args;
|
|
1293
|
+
return {
|
|
1294
|
+
readOptions,
|
|
1295
|
+
// raw mode matches on composition OR edition id via the compositionId param
|
|
1296
|
+
compositionId: editionId != null ? editionId : compositionId,
|
|
1297
|
+
versionId,
|
|
1298
|
+
hasCompositionId: true,
|
|
1299
|
+
pinnedEdition: editionId !== void 0
|
|
1325
1300
|
};
|
|
1326
|
-
const edgeUrl = this.createUrl("/api/v1/composition", edgeParams, this.edgeApiHost);
|
|
1327
|
-
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
1328
1301
|
}
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
}
|
|
1342
|
-
return { modified: response.headers.get("x-modified-at") };
|
|
1302
|
+
return { readOptions: args, hasCompositionId: false, pinnedEdition: false };
|
|
1303
|
+
}
|
|
1304
|
+
var DEFAULT_EDGE_API_HOST = "https://uniform.global";
|
|
1305
|
+
var DeliveryClientBase = class extends ContentClientBase {
|
|
1306
|
+
constructor(options) {
|
|
1307
|
+
var _a;
|
|
1308
|
+
super(
|
|
1309
|
+
options,
|
|
1310
|
+
/* defaultBypassCache */
|
|
1311
|
+
false
|
|
1312
|
+
);
|
|
1313
|
+
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : DEFAULT_EDGE_API_HOST;
|
|
1314
|
+
this.edgeRequestInit = options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0;
|
|
1343
1315
|
}
|
|
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
|
-
});
|
|
1316
|
+
/** Coerces the `diagnostics` option into the shape the edge endpoints accept. */
|
|
1317
|
+
coerceDiagnostics(diagnostics) {
|
|
1318
|
+
return typeof diagnostics === "boolean" ? diagnostics : diagnostics === "no-data" ? "no-data" : void 0;
|
|
1353
1319
|
}
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1320
|
+
};
|
|
1321
|
+
var EDGE_SINGLE_URL = "/api/v1/composition";
|
|
1322
|
+
var EDGE_LIST_URL = "/api/v1/compositions";
|
|
1323
|
+
var CompositionDeliveryClient = class extends DeliveryClientBase {
|
|
1324
|
+
constructor(options) {
|
|
1325
|
+
super(options);
|
|
1359
1326
|
}
|
|
1360
|
-
/**
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1327
|
+
/** Fetches exactly one composition (throws `ApiClientError(404)` if absent). */
|
|
1328
|
+
get(args) {
|
|
1329
|
+
var _a;
|
|
1330
|
+
const { diagnostics, select, ...rest } = args;
|
|
1331
|
+
const { readOptions, compositionId, versionId, pinnedEdition } = resolveCompositionSelector(rest);
|
|
1332
|
+
const url = this.createUrl(
|
|
1333
|
+
EDGE_SINGLE_URL,
|
|
1334
|
+
{
|
|
1335
|
+
...readOptions,
|
|
1336
|
+
...projectionToQuery(select),
|
|
1337
|
+
// A pinned edition is folded into compositionId (raw matches edition or
|
|
1338
|
+
// composition id); there is no editionId query param on this endpoint.
|
|
1339
|
+
compositionId,
|
|
1340
|
+
versionId,
|
|
1341
|
+
projectId: this.options.projectId,
|
|
1342
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
1343
|
+
// editionId pins a specific edition for preview; otherwise locale-best.
|
|
1344
|
+
editions: pinnedEdition ? "raw" : "auto",
|
|
1345
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
1346
|
+
},
|
|
1347
|
+
this.edgeApiHost
|
|
1348
|
+
);
|
|
1349
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
1368
1350
|
}
|
|
1369
|
-
/**
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1351
|
+
/** Fetches a list of compositions, optionally filtered. */
|
|
1352
|
+
list(args = {}) {
|
|
1353
|
+
var _a;
|
|
1354
|
+
const { diagnostics, filters, select, ...rest } = args;
|
|
1355
|
+
const url = this.createUrl(
|
|
1356
|
+
EDGE_LIST_URL,
|
|
1357
|
+
{
|
|
1358
|
+
...rest,
|
|
1359
|
+
...rewriteFiltersForApi(filters),
|
|
1360
|
+
...projectionToQuery(select),
|
|
1361
|
+
projectId: this.options.projectId,
|
|
1362
|
+
state: (_a = args.state) != null ? _a : CANVAS_PUBLISHED_STATE,
|
|
1363
|
+
diagnostics: this.coerceDiagnostics(diagnostics)
|
|
1364
|
+
},
|
|
1365
|
+
this.edgeApiHost
|
|
1366
|
+
);
|
|
1367
|
+
return this.apiClient(url, this.edgeRequestInit);
|
|
1377
1368
|
}
|
|
1378
1369
|
};
|
|
1379
1370
|
var _contentTypesUrl;
|
|
@@ -1482,14 +1473,18 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1482
1473
|
constructor(options) {
|
|
1483
1474
|
super(options);
|
|
1484
1475
|
}
|
|
1485
|
-
/** Fetches
|
|
1486
|
-
async
|
|
1476
|
+
/** Fetches a list of DataTypes for a project */
|
|
1477
|
+
async list(options) {
|
|
1487
1478
|
const { projectId } = this.options;
|
|
1488
1479
|
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8), { ...options, projectId });
|
|
1489
1480
|
return await this.apiClient(fetchUri);
|
|
1490
1481
|
}
|
|
1482
|
+
/** @deprecated Use {@link list} instead. */
|
|
1483
|
+
async get(options) {
|
|
1484
|
+
return this.list(options);
|
|
1485
|
+
}
|
|
1491
1486
|
/** Updates or creates (based on id) a DataType */
|
|
1492
|
-
async
|
|
1487
|
+
async save(body) {
|
|
1493
1488
|
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
1494
1489
|
await this.apiClient(fetchUri, {
|
|
1495
1490
|
method: "PUT",
|
|
@@ -1497,6 +1492,10 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1497
1492
|
expectNoContent: true
|
|
1498
1493
|
});
|
|
1499
1494
|
}
|
|
1495
|
+
/** @deprecated Use {@link save} instead. */
|
|
1496
|
+
async upsert(body) {
|
|
1497
|
+
return this.save(body);
|
|
1498
|
+
}
|
|
1500
1499
|
/** Deletes a DataType */
|
|
1501
1500
|
async remove(body) {
|
|
1502
1501
|
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
@@ -1509,15 +1508,6 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1509
1508
|
};
|
|
1510
1509
|
_url8 = /* @__PURE__ */ new WeakMap();
|
|
1511
1510
|
__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
1511
|
var escapeCharacter = "\\";
|
|
1522
1512
|
var variablePrefix = "${";
|
|
1523
1513
|
var variableSuffix = "}";
|
|
@@ -1528,9 +1518,9 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1528
1518
|
let bufferStartIndex = 0;
|
|
1529
1519
|
let bufferEndIndex = 0;
|
|
1530
1520
|
let tokenCount = 0;
|
|
1531
|
-
const handleToken = (token, type) => {
|
|
1521
|
+
const handleToken = (token, type, offset) => {
|
|
1532
1522
|
tokenCount++;
|
|
1533
|
-
return onToken == null ? void 0 : onToken(token, type);
|
|
1523
|
+
return onToken == null ? void 0 : onToken(token, type, offset);
|
|
1534
1524
|
};
|
|
1535
1525
|
let state = "text";
|
|
1536
1526
|
for (let index = 0; index < serialized.length; index++) {
|
|
@@ -1541,7 +1531,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1541
1531
|
if (char === variablePrefix[0] && serialized[index + 1] === variablePrefix[1]) {
|
|
1542
1532
|
if (serialized[index - 1] === escapeCharacter) {
|
|
1543
1533
|
bufferEndIndex -= escapeCharacter.length;
|
|
1544
|
-
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
|
1534
|
+
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text", bufferStartIndex) === false) {
|
|
1545
1535
|
return tokenCount;
|
|
1546
1536
|
}
|
|
1547
1537
|
bufferStartIndex = index;
|
|
@@ -1550,12 +1540,12 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1550
1540
|
}
|
|
1551
1541
|
if (state === "variable") {
|
|
1552
1542
|
const textStart = bufferStartIndex - variablePrefix.length;
|
|
1553
|
-
if (handleToken(serialized.substring(textStart, bufferEndIndex), "text") === false) {
|
|
1543
|
+
if (handleToken(serialized.substring(textStart, bufferEndIndex), "text", textStart) === false) {
|
|
1554
1544
|
return tokenCount;
|
|
1555
1545
|
}
|
|
1556
1546
|
bufferStartIndex = bufferEndIndex;
|
|
1557
1547
|
} else if (bufferEndIndex > bufferStartIndex) {
|
|
1558
|
-
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text") === false) {
|
|
1548
|
+
if (handleToken(serialized.substring(bufferStartIndex, bufferEndIndex), "text", bufferStartIndex) === false) {
|
|
1559
1549
|
return tokenCount;
|
|
1560
1550
|
}
|
|
1561
1551
|
bufferStartIndex = bufferEndIndex;
|
|
@@ -1573,7 +1563,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1573
1563
|
state = "text";
|
|
1574
1564
|
if (bufferEndIndex > bufferStartIndex) {
|
|
1575
1565
|
const unescapedVariableName = serialized.substring(bufferStartIndex, bufferEndIndex).replace(/\\([${}])/g, "$1");
|
|
1576
|
-
if (handleToken(unescapedVariableName, "variable") === false) {
|
|
1566
|
+
if (handleToken(unescapedVariableName, "variable", bufferStartIndex) === false) {
|
|
1577
1567
|
return tokenCount;
|
|
1578
1568
|
}
|
|
1579
1569
|
bufferStartIndex = bufferEndIndex + variableSuffix.length;
|
|
@@ -1587,7 +1577,7 @@ function parseVariableExpression(serialized, onToken) {
|
|
|
1587
1577
|
bufferStartIndex -= variablePrefix.length;
|
|
1588
1578
|
}
|
|
1589
1579
|
if (bufferStartIndex < serialized.length) {
|
|
1590
|
-
handleToken(serialized.substring(bufferStartIndex), state);
|
|
1580
|
+
handleToken(serialized.substring(bufferStartIndex), state, bufferStartIndex);
|
|
1591
1581
|
}
|
|
1592
1582
|
return tokenCount;
|
|
1593
1583
|
}
|
|
@@ -1636,6 +1626,48 @@ var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2
|
|
|
1636
1626
|
_baseUrl = /* @__PURE__ */ new WeakMap();
|
|
1637
1627
|
__privateAdd3(_IntegrationPropertyEditorsClient, _baseUrl, "/api/v1/integration-property-editors");
|
|
1638
1628
|
var _url22;
|
|
1629
|
+
var _NotificationsClient = class _NotificationsClient2 extends ApiClient {
|
|
1630
|
+
constructor(options) {
|
|
1631
|
+
super(options);
|
|
1632
|
+
}
|
|
1633
|
+
/**
|
|
1634
|
+
* Lists notifications for the current user.
|
|
1635
|
+
*
|
|
1636
|
+
* @deprecated This API is experimental and may change without notice.
|
|
1637
|
+
*/
|
|
1638
|
+
async list(options) {
|
|
1639
|
+
const fetchUri = this.createUrl(__privateGet3(_NotificationsClient2, _url22), options);
|
|
1640
|
+
return await this.apiClient(fetchUri);
|
|
1641
|
+
}
|
|
1642
|
+
/**
|
|
1643
|
+
* Creates a notification for one or more recipients.
|
|
1644
|
+
*
|
|
1645
|
+
* @deprecated This API is experimental and may change without notice.
|
|
1646
|
+
*/
|
|
1647
|
+
async create(body) {
|
|
1648
|
+
const fetchUri = this.createUrl(__privateGet3(_NotificationsClient2, _url22));
|
|
1649
|
+
return await this.apiClient(fetchUri, {
|
|
1650
|
+
method: "POST",
|
|
1651
|
+
body: JSON.stringify(body)
|
|
1652
|
+
});
|
|
1653
|
+
}
|
|
1654
|
+
/**
|
|
1655
|
+
* Updates the read state of the current user's notifications.
|
|
1656
|
+
*
|
|
1657
|
+
* @deprecated This API is experimental and may change without notice.
|
|
1658
|
+
*/
|
|
1659
|
+
async setReadState(body) {
|
|
1660
|
+
const fetchUri = this.createUrl(__privateGet3(_NotificationsClient2, _url22));
|
|
1661
|
+
await this.apiClient(fetchUri, {
|
|
1662
|
+
method: "PATCH",
|
|
1663
|
+
body: JSON.stringify(body),
|
|
1664
|
+
expectNoContent: true
|
|
1665
|
+
});
|
|
1666
|
+
}
|
|
1667
|
+
};
|
|
1668
|
+
_url22 = /* @__PURE__ */ new WeakMap();
|
|
1669
|
+
__privateAdd3(_NotificationsClient, _url22, "/api/v1/notifications");
|
|
1670
|
+
var _url32;
|
|
1639
1671
|
var _projectsUrl;
|
|
1640
1672
|
var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
1641
1673
|
constructor(options) {
|
|
@@ -1643,7 +1675,7 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1643
1675
|
}
|
|
1644
1676
|
/** Fetches single Project */
|
|
1645
1677
|
async get(options) {
|
|
1646
|
-
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2,
|
|
1678
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url32), { ...options });
|
|
1647
1679
|
return await this.apiClient(fetchUri);
|
|
1648
1680
|
}
|
|
1649
1681
|
/**
|
|
@@ -1651,34 +1683,48 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1651
1683
|
* When teamId is provided, returns a single team with its projects.
|
|
1652
1684
|
* When omitted, returns all accessible teams and their projects.
|
|
1653
1685
|
*/
|
|
1654
|
-
async
|
|
1686
|
+
async list(options) {
|
|
1655
1687
|
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
1656
1688
|
return await this.apiClient(fetchUri);
|
|
1657
1689
|
}
|
|
1690
|
+
/** @deprecated Use {@link list} instead. */
|
|
1691
|
+
async getProjects(options) {
|
|
1692
|
+
return this.list(options);
|
|
1693
|
+
}
|
|
1658
1694
|
/** Updates or creates (based on id) a Project */
|
|
1659
|
-
async
|
|
1660
|
-
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2,
|
|
1695
|
+
async save(body) {
|
|
1696
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url32));
|
|
1661
1697
|
return await this.apiClient(fetchUri, {
|
|
1662
1698
|
method: "PUT",
|
|
1663
1699
|
body: JSON.stringify({ ...body })
|
|
1664
1700
|
});
|
|
1665
1701
|
}
|
|
1702
|
+
/** @deprecated Use {@link save} instead. */
|
|
1703
|
+
async upsert(body) {
|
|
1704
|
+
return this.save(body);
|
|
1705
|
+
}
|
|
1666
1706
|
/** Deletes a Project */
|
|
1667
|
-
async
|
|
1668
|
-
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2,
|
|
1707
|
+
async remove(body) {
|
|
1708
|
+
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url32));
|
|
1669
1709
|
await this.apiClient(fetchUri, {
|
|
1670
1710
|
method: "DELETE",
|
|
1671
1711
|
body: JSON.stringify({ ...body }),
|
|
1672
1712
|
expectNoContent: true
|
|
1673
1713
|
});
|
|
1674
1714
|
}
|
|
1715
|
+
/** @deprecated Use {@link remove} instead. */
|
|
1716
|
+
async delete(body) {
|
|
1717
|
+
return this.remove(body);
|
|
1718
|
+
}
|
|
1675
1719
|
};
|
|
1676
|
-
|
|
1720
|
+
_url32 = /* @__PURE__ */ new WeakMap();
|
|
1677
1721
|
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
1678
|
-
__privateAdd3(_ProjectClient,
|
|
1722
|
+
__privateAdd3(_ProjectClient, _url32, "/api/v1/project");
|
|
1679
1723
|
__privateAdd3(_ProjectClient, _projectsUrl, "/api/v1/projects");
|
|
1680
1724
|
var isAllowedReferrer = (referrer) => {
|
|
1681
|
-
return Boolean(
|
|
1725
|
+
return Boolean(
|
|
1726
|
+
referrer == null ? void 0 : referrer.match(/(^https:\/\/|\.)(uniform.app|uniform.wtf|uniformcode.ai|localhost:\d{4})\//)
|
|
1727
|
+
);
|
|
1682
1728
|
};
|
|
1683
1729
|
|
|
1684
1730
|
// src/handler/createPreviewGETRouteHandler.ts
|
|
@@ -2130,9 +2176,9 @@ function createLimitPolicy2({
|
|
|
2130
2176
|
}
|
|
2131
2177
|
|
|
2132
2178
|
// src/clients/canvas.ts
|
|
2133
|
-
var
|
|
2179
|
+
var buildCanvasClientOptions = (options) => {
|
|
2134
2180
|
const cache = resolveCanvasCache(options);
|
|
2135
|
-
return
|
|
2181
|
+
return {
|
|
2136
2182
|
projectId: env.getProjectId(),
|
|
2137
2183
|
apiHost: env.getApiHost(),
|
|
2138
2184
|
apiKey: env.getApiKey(),
|
|
@@ -2180,7 +2226,10 @@ var getCanvasClient = (options) => {
|
|
|
2180
2226
|
}
|
|
2181
2227
|
});
|
|
2182
2228
|
}
|
|
2183
|
-
}
|
|
2229
|
+
};
|
|
2230
|
+
};
|
|
2231
|
+
var getCompositionDeliveryClient = (options) => {
|
|
2232
|
+
return new CompositionDeliveryClient(buildCanvasClientOptions(options));
|
|
2184
2233
|
};
|
|
2185
2234
|
|
|
2186
2235
|
// src/clients/projectMap.ts
|
|
@@ -2429,18 +2478,15 @@ var _Route = class _Route2 {
|
|
|
2429
2478
|
*/
|
|
2430
2479
|
static splitFragment(path) {
|
|
2431
2480
|
let fragmentIndex = -1;
|
|
2432
|
-
|
|
2433
|
-
parseVariableExpression(path, (token, type) => {
|
|
2481
|
+
parseVariableExpression(path, (token, type, offset) => {
|
|
2434
2482
|
if (type === "variable") {
|
|
2435
|
-
length += createVariableReference(token).length;
|
|
2436
2483
|
return;
|
|
2437
2484
|
}
|
|
2438
2485
|
const hashOffset = token.indexOf("#");
|
|
2439
2486
|
if (hashOffset === -1) {
|
|
2440
|
-
length += token.length;
|
|
2441
2487
|
return;
|
|
2442
2488
|
}
|
|
2443
|
-
fragmentIndex =
|
|
2489
|
+
fragmentIndex = offset + hashOffset;
|
|
2444
2490
|
return false;
|
|
2445
2491
|
});
|
|
2446
2492
|
if (fragmentIndex === -1) {
|
|
@@ -2579,13 +2625,13 @@ var processCompositionChange = async (compositionId) => {
|
|
|
2579
2625
|
};
|
|
2580
2626
|
};
|
|
2581
2627
|
var getComposition = async ({ compositionId }) => {
|
|
2582
|
-
const canvasClient =
|
|
2628
|
+
const canvasClient = getCompositionDeliveryClient({
|
|
2583
2629
|
cache: {
|
|
2584
2630
|
type: "no-cache"
|
|
2585
2631
|
}
|
|
2586
2632
|
});
|
|
2587
2633
|
try {
|
|
2588
|
-
const composition = await canvasClient.
|
|
2634
|
+
const composition = await canvasClient.get({
|
|
2589
2635
|
compositionId
|
|
2590
2636
|
});
|
|
2591
2637
|
return composition;
|