@uniformdev/next-app-router 20.72.3-alpha.5 → 20.72.3-alpha.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{UniformComposition-BV6YnA2a.d.ts → UniformComposition-BWxMuY7i.d.ts} +2 -2
- package/dist/{UniformComposition-scIgVvIH.d.mts → UniformComposition-Bo6UsTDC.d.mts} +2 -2
- package/dist/cache.d.mts +2 -2
- package/dist/cache.d.ts +2 -2
- package/dist/cache.js +67 -20
- package/dist/cache.mjs +67 -20
- package/dist/{client-BlKZeE6C.d.mts → client-DRMp2gpi.d.mts} +1 -0
- package/dist/{client-BlKZeE6C.d.ts → client-DRMp2gpi.d.ts} +1 -0
- package/dist/compat.d.mts +3 -3
- package/dist/compat.d.ts +3 -3
- package/dist/component.js +49 -12
- package/dist/component.mjs +49 -12
- package/dist/handler.js +157 -153
- package/dist/handler.mjs +157 -153
- package/dist/index.d.mts +12 -7
- package/dist/index.d.ts +12 -7
- package/dist/index.esm.js +195 -54
- package/dist/index.js +196 -54
- package/dist/index.mjs +195 -54
- package/dist/middleware.d.mts +1 -1
- package/dist/middleware.d.ts +1 -1
- package/dist/middleware.js +172 -160
- package/dist/middleware.mjs +172 -160
- package/dist/{resolveRouteFromCode-3u61IwOW.d.ts → resolveRouteFromCode-Bhz8EJBu.d.ts} +1 -1
- package/dist/{resolveRouteFromCode-_CdAMtVM.d.mts → resolveRouteFromCode-C0dkUV2T.d.mts} +1 -1
- package/package.json +11 -9
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RootComponentInstance, ComponentInstance } from '@uniformdev/canvas';
|
|
2
2
|
import { ComponentProps } from '@uniformdev/next-app-router-shared';
|
|
3
3
|
import React, { ComponentType } from 'react';
|
|
4
|
-
import { D as DataClient } from './client-
|
|
5
|
-
import { a as ResolvedRouteResult, R as ResolveRouteFunction } from './resolveRouteFromCode-
|
|
4
|
+
import { D as DataClient } from './client-DRMp2gpi.js';
|
|
5
|
+
import { a as ResolvedRouteResult, R as ResolveRouteFunction } from './resolveRouteFromCode-Bhz8EJBu.js';
|
|
6
6
|
import { ClientContextComponent } from '@uniformdev/next-app-router-client';
|
|
7
7
|
|
|
8
8
|
type CompositionCache = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RootComponentInstance, ComponentInstance } from '@uniformdev/canvas';
|
|
2
2
|
import { ComponentProps } from '@uniformdev/next-app-router-shared';
|
|
3
3
|
import React, { ComponentType } from 'react';
|
|
4
|
-
import { D as DataClient } from './client-
|
|
5
|
-
import { a as ResolvedRouteResult, R as ResolveRouteFunction } from './resolveRouteFromCode-
|
|
4
|
+
import { D as DataClient } from './client-DRMp2gpi.mjs';
|
|
5
|
+
import { a as ResolvedRouteResult, R as ResolveRouteFunction } from './resolveRouteFromCode-C0dkUV2T.mjs';
|
|
6
6
|
import { ClientContextComponent } from '@uniformdev/next-app-router-client';
|
|
7
7
|
|
|
8
8
|
type CompositionCache = {
|
package/dist/cache.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { R as ResolveRouteFunction } from './resolveRouteFromCode-
|
|
1
|
+
import { R as ResolveRouteFunction } from './resolveRouteFromCode-C0dkUV2T.mjs';
|
|
2
2
|
import '@uniformdev/canvas';
|
|
3
3
|
import '@uniformdev/next-app-router-shared';
|
|
4
|
-
import './client-
|
|
4
|
+
import './client-DRMp2gpi.mjs';
|
|
5
5
|
import '@uniformdev/context';
|
|
6
6
|
|
|
7
7
|
declare const resolveRouteFromCode: ResolveRouteFunction;
|
package/dist/cache.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { R as ResolveRouteFunction } from './resolveRouteFromCode-
|
|
1
|
+
import { R as ResolveRouteFunction } from './resolveRouteFromCode-Bhz8EJBu.js';
|
|
2
2
|
import '@uniformdev/canvas';
|
|
3
3
|
import '@uniformdev/next-app-router-shared';
|
|
4
|
-
import './client-
|
|
4
|
+
import './client-DRMp2gpi.js';
|
|
5
5
|
import '@uniformdev/context';
|
|
6
6
|
|
|
7
7
|
declare const resolveRouteFromCode: ResolveRouteFunction;
|
package/dist/cache.js
CHANGED
|
@@ -418,6 +418,7 @@ var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cann
|
|
|
418
418
|
var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
419
419
|
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);
|
|
420
420
|
var defaultLimitPolicy = (0, import_p_limit.default)(6);
|
|
421
|
+
var UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE = "Bearer token not valid or expired";
|
|
421
422
|
var ApiClientError = class _ApiClientError extends Error {
|
|
422
423
|
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
423
424
|
super(
|
|
@@ -433,6 +434,12 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
433
434
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
434
435
|
}
|
|
435
436
|
};
|
|
437
|
+
var BearerTokenNotValidOrExpiredError = class _BearerTokenNotValidOrExpiredError extends ApiClientError {
|
|
438
|
+
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
439
|
+
super(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId);
|
|
440
|
+
Object.setPrototypeOf(this, _BearerTokenNotValidOrExpiredError.prototype);
|
|
441
|
+
}
|
|
442
|
+
};
|
|
436
443
|
var ApiClient = class _ApiClient {
|
|
437
444
|
constructor(options) {
|
|
438
445
|
__publicField2(this, "options");
|
|
@@ -466,7 +473,7 @@ var ApiClient = class _ApiClient {
|
|
|
466
473
|
}
|
|
467
474
|
async apiClientWithResponse(fetchUri, options) {
|
|
468
475
|
return this.options.limitPolicy(async () => {
|
|
469
|
-
var _a;
|
|
476
|
+
var _a, _b;
|
|
470
477
|
const coreHeaders = this.options.apiKey ? {
|
|
471
478
|
"x-api-key": this.options.apiKey
|
|
472
479
|
} : {
|
|
@@ -502,9 +509,19 @@ var ApiClient = class _ApiClient {
|
|
|
502
509
|
} catch (e) {
|
|
503
510
|
message = `General error`;
|
|
504
511
|
}
|
|
512
|
+
if (apiResponse.status === 401 && message === UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE) {
|
|
513
|
+
throw new BearerTokenNotValidOrExpiredError(
|
|
514
|
+
message,
|
|
515
|
+
(_a = options == null ? void 0 : options.method) != null ? _a : "GET",
|
|
516
|
+
fetchUri.toString(),
|
|
517
|
+
apiResponse.status,
|
|
518
|
+
apiResponse.statusText,
|
|
519
|
+
_ApiClient.getRequestId(apiResponse)
|
|
520
|
+
);
|
|
521
|
+
}
|
|
505
522
|
throw new ApiClientError(
|
|
506
523
|
message,
|
|
507
|
-
(
|
|
524
|
+
(_b = options == null ? void 0 : options.method) != null ? _b : "GET",
|
|
508
525
|
fetchUri.toString(),
|
|
509
526
|
apiResponse.status,
|
|
510
527
|
apiResponse.statusText,
|
|
@@ -1252,6 +1269,14 @@ function projectionToQuery(spec) {
|
|
|
1252
1269
|
}
|
|
1253
1270
|
return out;
|
|
1254
1271
|
}
|
|
1272
|
+
var CANVAS_DRAFT_STATE = 0;
|
|
1273
|
+
var CANVAS_PUBLISHED_STATE = 64;
|
|
1274
|
+
var CANVAS_EDITOR_STATE = 63;
|
|
1275
|
+
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1276
|
+
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1277
|
+
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1278
|
+
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1279
|
+
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1255
1280
|
var _contentTypesUrl;
|
|
1256
1281
|
var _entriesUrl;
|
|
1257
1282
|
var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
@@ -1358,14 +1383,18 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1358
1383
|
constructor(options) {
|
|
1359
1384
|
super(options);
|
|
1360
1385
|
}
|
|
1361
|
-
/** Fetches
|
|
1362
|
-
async
|
|
1386
|
+
/** Fetches a list of DataTypes for a project */
|
|
1387
|
+
async list(options) {
|
|
1363
1388
|
const { projectId } = this.options;
|
|
1364
1389
|
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8), { ...options, projectId });
|
|
1365
1390
|
return await this.apiClient(fetchUri);
|
|
1366
1391
|
}
|
|
1392
|
+
/** @deprecated Use {@link list} instead. */
|
|
1393
|
+
async get(options) {
|
|
1394
|
+
return this.list(options);
|
|
1395
|
+
}
|
|
1367
1396
|
/** Updates or creates (based on id) a DataType */
|
|
1368
|
-
async
|
|
1397
|
+
async save(body) {
|
|
1369
1398
|
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
1370
1399
|
await this.apiClient(fetchUri, {
|
|
1371
1400
|
method: "PUT",
|
|
@@ -1373,6 +1402,10 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1373
1402
|
expectNoContent: true
|
|
1374
1403
|
});
|
|
1375
1404
|
}
|
|
1405
|
+
/** @deprecated Use {@link save} instead. */
|
|
1406
|
+
async upsert(body) {
|
|
1407
|
+
return this.save(body);
|
|
1408
|
+
}
|
|
1376
1409
|
/** Deletes a DataType */
|
|
1377
1410
|
async remove(body) {
|
|
1378
1411
|
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
@@ -1385,14 +1418,6 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1385
1418
|
};
|
|
1386
1419
|
_url8 = /* @__PURE__ */ new WeakMap();
|
|
1387
1420
|
__privateAdd3(_DataTypeClient, _url8, "/api/v1/data-types");
|
|
1388
|
-
var CANVAS_DRAFT_STATE = 0;
|
|
1389
|
-
var CANVAS_PUBLISHED_STATE = 64;
|
|
1390
|
-
var CANVAS_EDITOR_STATE = 63;
|
|
1391
|
-
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1392
|
-
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1393
|
-
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1394
|
-
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1395
|
-
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1396
1421
|
var _baseUrl;
|
|
1397
1422
|
var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2 extends ApiClient {
|
|
1398
1423
|
constructor(options) {
|
|
@@ -1450,20 +1475,28 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1450
1475
|
* When teamId is provided, returns a single team with its projects.
|
|
1451
1476
|
* When omitted, returns all accessible teams and their projects.
|
|
1452
1477
|
*/
|
|
1453
|
-
async
|
|
1478
|
+
async list(options) {
|
|
1454
1479
|
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
1455
1480
|
return await this.apiClient(fetchUri);
|
|
1456
1481
|
}
|
|
1482
|
+
/** @deprecated Use {@link list} instead. */
|
|
1483
|
+
async getProjects(options) {
|
|
1484
|
+
return this.list(options);
|
|
1485
|
+
}
|
|
1457
1486
|
/** Updates or creates (based on id) a Project */
|
|
1458
|
-
async
|
|
1487
|
+
async save(body) {
|
|
1459
1488
|
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
|
|
1460
1489
|
return await this.apiClient(fetchUri, {
|
|
1461
1490
|
method: "PUT",
|
|
1462
1491
|
body: JSON.stringify({ ...body })
|
|
1463
1492
|
});
|
|
1464
1493
|
}
|
|
1494
|
+
/** @deprecated Use {@link save} instead. */
|
|
1495
|
+
async upsert(body) {
|
|
1496
|
+
return this.save(body);
|
|
1497
|
+
}
|
|
1465
1498
|
/** Deletes a Project */
|
|
1466
|
-
async
|
|
1499
|
+
async remove(body) {
|
|
1467
1500
|
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
|
|
1468
1501
|
await this.apiClient(fetchUri, {
|
|
1469
1502
|
method: "DELETE",
|
|
@@ -1471,6 +1504,10 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1471
1504
|
expectNoContent: true
|
|
1472
1505
|
});
|
|
1473
1506
|
}
|
|
1507
|
+
/** @deprecated Use {@link remove} instead. */
|
|
1508
|
+
async delete(body) {
|
|
1509
|
+
return this.remove(body);
|
|
1510
|
+
}
|
|
1474
1511
|
};
|
|
1475
1512
|
_url22 = /* @__PURE__ */ new WeakMap();
|
|
1476
1513
|
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
@@ -1486,8 +1523,14 @@ var RouteClient = class extends ApiClient {
|
|
|
1486
1523
|
super(options);
|
|
1487
1524
|
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
|
|
1488
1525
|
}
|
|
1489
|
-
/**
|
|
1490
|
-
|
|
1526
|
+
/**
|
|
1527
|
+
* Resolves a route to a composition, redirect, or not-found result.
|
|
1528
|
+
*
|
|
1529
|
+
* An optional `select` projection applies to the resolved composition when
|
|
1530
|
+
* the route matches one; redirect / notFound responses pass through
|
|
1531
|
+
* untouched.
|
|
1532
|
+
*/
|
|
1533
|
+
async get(options) {
|
|
1491
1534
|
const { projectId } = this.options;
|
|
1492
1535
|
const { select, ...rest } = options != null ? options : {};
|
|
1493
1536
|
const rewrittenSelect = projectionToQuery(select);
|
|
@@ -1497,6 +1540,10 @@ var RouteClient = class extends ApiClient {
|
|
|
1497
1540
|
this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
|
|
1498
1541
|
);
|
|
1499
1542
|
}
|
|
1543
|
+
/** @deprecated use {@link RouteClient.get} instead (renamed). */
|
|
1544
|
+
async getRoute(options) {
|
|
1545
|
+
return this.get(options);
|
|
1546
|
+
}
|
|
1500
1547
|
};
|
|
1501
1548
|
var getDataSourceVariantFromRouteGetParams = (params, defaultPreviewState) => {
|
|
1502
1549
|
var _a, _b;
|
|
@@ -1957,14 +2004,14 @@ var DefaultDataClient = class {
|
|
|
1957
2004
|
if (oldCachedRoute) {
|
|
1958
2005
|
(0, import_functions.waitUntil)(
|
|
1959
2006
|
(async () => {
|
|
1960
|
-
const result2 = await routeClient.
|
|
2007
|
+
const result2 = await routeClient.get(route);
|
|
1961
2008
|
await cacheNewRoute(result2);
|
|
1962
2009
|
})()
|
|
1963
2010
|
);
|
|
1964
2011
|
return oldCachedRoute;
|
|
1965
2012
|
}
|
|
1966
2013
|
}
|
|
1967
|
-
const result = await routeClient.
|
|
2014
|
+
const result = await routeClient.get(route);
|
|
1968
2015
|
(0, import_functions.waitUntil)(
|
|
1969
2016
|
(async () => {
|
|
1970
2017
|
await Promise.all([
|
package/dist/cache.mjs
CHANGED
|
@@ -405,6 +405,7 @@ var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cann
|
|
|
405
405
|
var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
406
406
|
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);
|
|
407
407
|
var defaultLimitPolicy = (0, import_p_limit.default)(6);
|
|
408
|
+
var UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE = "Bearer token not valid or expired";
|
|
408
409
|
var ApiClientError = class _ApiClientError extends Error {
|
|
409
410
|
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
410
411
|
super(
|
|
@@ -420,6 +421,12 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
420
421
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
421
422
|
}
|
|
422
423
|
};
|
|
424
|
+
var BearerTokenNotValidOrExpiredError = class _BearerTokenNotValidOrExpiredError extends ApiClientError {
|
|
425
|
+
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
426
|
+
super(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId);
|
|
427
|
+
Object.setPrototypeOf(this, _BearerTokenNotValidOrExpiredError.prototype);
|
|
428
|
+
}
|
|
429
|
+
};
|
|
423
430
|
var ApiClient = class _ApiClient {
|
|
424
431
|
constructor(options) {
|
|
425
432
|
__publicField2(this, "options");
|
|
@@ -453,7 +460,7 @@ var ApiClient = class _ApiClient {
|
|
|
453
460
|
}
|
|
454
461
|
async apiClientWithResponse(fetchUri, options) {
|
|
455
462
|
return this.options.limitPolicy(async () => {
|
|
456
|
-
var _a;
|
|
463
|
+
var _a, _b;
|
|
457
464
|
const coreHeaders = this.options.apiKey ? {
|
|
458
465
|
"x-api-key": this.options.apiKey
|
|
459
466
|
} : {
|
|
@@ -489,9 +496,19 @@ var ApiClient = class _ApiClient {
|
|
|
489
496
|
} catch (e) {
|
|
490
497
|
message = `General error`;
|
|
491
498
|
}
|
|
499
|
+
if (apiResponse.status === 401 && message === UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE) {
|
|
500
|
+
throw new BearerTokenNotValidOrExpiredError(
|
|
501
|
+
message,
|
|
502
|
+
(_a = options == null ? void 0 : options.method) != null ? _a : "GET",
|
|
503
|
+
fetchUri.toString(),
|
|
504
|
+
apiResponse.status,
|
|
505
|
+
apiResponse.statusText,
|
|
506
|
+
_ApiClient.getRequestId(apiResponse)
|
|
507
|
+
);
|
|
508
|
+
}
|
|
492
509
|
throw new ApiClientError(
|
|
493
510
|
message,
|
|
494
|
-
(
|
|
511
|
+
(_b = options == null ? void 0 : options.method) != null ? _b : "GET",
|
|
495
512
|
fetchUri.toString(),
|
|
496
513
|
apiResponse.status,
|
|
497
514
|
apiResponse.statusText,
|
|
@@ -1239,6 +1256,14 @@ function projectionToQuery(spec) {
|
|
|
1239
1256
|
}
|
|
1240
1257
|
return out;
|
|
1241
1258
|
}
|
|
1259
|
+
var CANVAS_DRAFT_STATE = 0;
|
|
1260
|
+
var CANVAS_PUBLISHED_STATE = 64;
|
|
1261
|
+
var CANVAS_EDITOR_STATE = 63;
|
|
1262
|
+
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1263
|
+
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1264
|
+
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1265
|
+
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1266
|
+
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1242
1267
|
var _contentTypesUrl;
|
|
1243
1268
|
var _entriesUrl;
|
|
1244
1269
|
var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
@@ -1345,14 +1370,18 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1345
1370
|
constructor(options) {
|
|
1346
1371
|
super(options);
|
|
1347
1372
|
}
|
|
1348
|
-
/** Fetches
|
|
1349
|
-
async
|
|
1373
|
+
/** Fetches a list of DataTypes for a project */
|
|
1374
|
+
async list(options) {
|
|
1350
1375
|
const { projectId } = this.options;
|
|
1351
1376
|
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8), { ...options, projectId });
|
|
1352
1377
|
return await this.apiClient(fetchUri);
|
|
1353
1378
|
}
|
|
1379
|
+
/** @deprecated Use {@link list} instead. */
|
|
1380
|
+
async get(options) {
|
|
1381
|
+
return this.list(options);
|
|
1382
|
+
}
|
|
1354
1383
|
/** Updates or creates (based on id) a DataType */
|
|
1355
|
-
async
|
|
1384
|
+
async save(body) {
|
|
1356
1385
|
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
1357
1386
|
await this.apiClient(fetchUri, {
|
|
1358
1387
|
method: "PUT",
|
|
@@ -1360,6 +1389,10 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1360
1389
|
expectNoContent: true
|
|
1361
1390
|
});
|
|
1362
1391
|
}
|
|
1392
|
+
/** @deprecated Use {@link save} instead. */
|
|
1393
|
+
async upsert(body) {
|
|
1394
|
+
return this.save(body);
|
|
1395
|
+
}
|
|
1363
1396
|
/** Deletes a DataType */
|
|
1364
1397
|
async remove(body) {
|
|
1365
1398
|
const fetchUri = this.createUrl(__privateGet3(_DataTypeClient2, _url8));
|
|
@@ -1372,14 +1405,6 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
1372
1405
|
};
|
|
1373
1406
|
_url8 = /* @__PURE__ */ new WeakMap();
|
|
1374
1407
|
__privateAdd3(_DataTypeClient, _url8, "/api/v1/data-types");
|
|
1375
|
-
var CANVAS_DRAFT_STATE = 0;
|
|
1376
|
-
var CANVAS_PUBLISHED_STATE = 64;
|
|
1377
|
-
var CANVAS_EDITOR_STATE = 63;
|
|
1378
|
-
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
1379
|
-
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
1380
|
-
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
1381
|
-
var IN_CONTEXT_EDITOR_QUERY_STRING_PARAM = "is_incontext_editing_mode";
|
|
1382
|
-
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
1383
1408
|
var _baseUrl;
|
|
1384
1409
|
var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2 extends ApiClient {
|
|
1385
1410
|
constructor(options) {
|
|
@@ -1437,20 +1462,28 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1437
1462
|
* When teamId is provided, returns a single team with its projects.
|
|
1438
1463
|
* When omitted, returns all accessible teams and their projects.
|
|
1439
1464
|
*/
|
|
1440
|
-
async
|
|
1465
|
+
async list(options) {
|
|
1441
1466
|
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
1442
1467
|
return await this.apiClient(fetchUri);
|
|
1443
1468
|
}
|
|
1469
|
+
/** @deprecated Use {@link list} instead. */
|
|
1470
|
+
async getProjects(options) {
|
|
1471
|
+
return this.list(options);
|
|
1472
|
+
}
|
|
1444
1473
|
/** Updates or creates (based on id) a Project */
|
|
1445
|
-
async
|
|
1474
|
+
async save(body) {
|
|
1446
1475
|
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
|
|
1447
1476
|
return await this.apiClient(fetchUri, {
|
|
1448
1477
|
method: "PUT",
|
|
1449
1478
|
body: JSON.stringify({ ...body })
|
|
1450
1479
|
});
|
|
1451
1480
|
}
|
|
1481
|
+
/** @deprecated Use {@link save} instead. */
|
|
1482
|
+
async upsert(body) {
|
|
1483
|
+
return this.save(body);
|
|
1484
|
+
}
|
|
1452
1485
|
/** Deletes a Project */
|
|
1453
|
-
async
|
|
1486
|
+
async remove(body) {
|
|
1454
1487
|
const fetchUri = this.createUrl(__privateGet3(_ProjectClient2, _url22));
|
|
1455
1488
|
await this.apiClient(fetchUri, {
|
|
1456
1489
|
method: "DELETE",
|
|
@@ -1458,6 +1491,10 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
1458
1491
|
expectNoContent: true
|
|
1459
1492
|
});
|
|
1460
1493
|
}
|
|
1494
|
+
/** @deprecated Use {@link remove} instead. */
|
|
1495
|
+
async delete(body) {
|
|
1496
|
+
return this.remove(body);
|
|
1497
|
+
}
|
|
1461
1498
|
};
|
|
1462
1499
|
_url22 = /* @__PURE__ */ new WeakMap();
|
|
1463
1500
|
_projectsUrl = /* @__PURE__ */ new WeakMap();
|
|
@@ -1473,8 +1510,14 @@ var RouteClient = class extends ApiClient {
|
|
|
1473
1510
|
super(options);
|
|
1474
1511
|
this.edgeApiHost = (_a = options.edgeApiHost) != null ? _a : "https://uniform.global";
|
|
1475
1512
|
}
|
|
1476
|
-
/**
|
|
1477
|
-
|
|
1513
|
+
/**
|
|
1514
|
+
* Resolves a route to a composition, redirect, or not-found result.
|
|
1515
|
+
*
|
|
1516
|
+
* An optional `select` projection applies to the resolved composition when
|
|
1517
|
+
* the route matches one; redirect / notFound responses pass through
|
|
1518
|
+
* untouched.
|
|
1519
|
+
*/
|
|
1520
|
+
async get(options) {
|
|
1478
1521
|
const { projectId } = this.options;
|
|
1479
1522
|
const { select, ...rest } = options != null ? options : {};
|
|
1480
1523
|
const rewrittenSelect = projectionToQuery(select);
|
|
@@ -1484,6 +1527,10 @@ var RouteClient = class extends ApiClient {
|
|
|
1484
1527
|
this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
|
|
1485
1528
|
);
|
|
1486
1529
|
}
|
|
1530
|
+
/** @deprecated use {@link RouteClient.get} instead (renamed). */
|
|
1531
|
+
async getRoute(options) {
|
|
1532
|
+
return this.get(options);
|
|
1533
|
+
}
|
|
1487
1534
|
};
|
|
1488
1535
|
var getDataSourceVariantFromRouteGetParams = (params, defaultPreviewState) => {
|
|
1489
1536
|
var _a, _b;
|
|
@@ -1944,14 +1991,14 @@ var DefaultDataClient = class {
|
|
|
1944
1991
|
if (oldCachedRoute) {
|
|
1945
1992
|
waitUntil(
|
|
1946
1993
|
(async () => {
|
|
1947
|
-
const result2 = await routeClient.
|
|
1994
|
+
const result2 = await routeClient.get(route);
|
|
1948
1995
|
await cacheNewRoute(result2);
|
|
1949
1996
|
})()
|
|
1950
1997
|
);
|
|
1951
1998
|
return oldCachedRoute;
|
|
1952
1999
|
}
|
|
1953
2000
|
}
|
|
1954
|
-
const result = await routeClient.
|
|
2001
|
+
const result = await routeClient.get(route);
|
|
1955
2002
|
waitUntil(
|
|
1956
2003
|
(async () => {
|
|
1957
2004
|
await Promise.all([
|
package/dist/compat.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { ComponentType } from 'react';
|
|
2
2
|
import { ComponentProps as ComponentProps$1, ComponentParameter } from '@uniformdev/next-app-router-shared';
|
|
3
3
|
import { U as UniformTextProps$1 } from './UniformText-ChMwHBw4.mjs';
|
|
4
|
-
import { R as ResolveComponentResult, a as ResolveComponentFunction } from './UniformComposition-
|
|
4
|
+
import { R as ResolveComponentResult, a as ResolveComponentFunction } from './UniformComposition-Bo6UsTDC.mjs';
|
|
5
5
|
import '@uniformdev/next-app-router-client';
|
|
6
6
|
import '@uniformdev/canvas';
|
|
7
|
-
import './client-
|
|
7
|
+
import './client-DRMp2gpi.mjs';
|
|
8
8
|
import '@uniformdev/context';
|
|
9
|
-
import './resolveRouteFromCode-
|
|
9
|
+
import './resolveRouteFromCode-C0dkUV2T.mjs';
|
|
10
10
|
|
|
11
11
|
type ComponentContext = ComponentProps$1['component'] & {
|
|
12
12
|
parameters: Record<string, ComponentParameter>;
|
package/dist/compat.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React, { ComponentType } from 'react';
|
|
2
2
|
import { ComponentProps as ComponentProps$1, ComponentParameter } from '@uniformdev/next-app-router-shared';
|
|
3
3
|
import { U as UniformTextProps$1 } from './UniformText-ChMwHBw4.js';
|
|
4
|
-
import { R as ResolveComponentResult, a as ResolveComponentFunction } from './UniformComposition-
|
|
4
|
+
import { R as ResolveComponentResult, a as ResolveComponentFunction } from './UniformComposition-BWxMuY7i.js';
|
|
5
5
|
import '@uniformdev/next-app-router-client';
|
|
6
6
|
import '@uniformdev/canvas';
|
|
7
|
-
import './client-
|
|
7
|
+
import './client-DRMp2gpi.js';
|
|
8
8
|
import '@uniformdev/context';
|
|
9
|
-
import './resolveRouteFromCode-
|
|
9
|
+
import './resolveRouteFromCode-Bhz8EJBu.js';
|
|
10
10
|
|
|
11
11
|
type ComponentContext = ComponentProps$1['component'] & {
|
|
12
12
|
parameters: Record<string, ComponentParameter>;
|
package/dist/component.js
CHANGED
|
@@ -225,6 +225,7 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
|
|
|
225
225
|
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
226
226
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
227
227
|
var defaultLimitPolicy = (0, import_p_limit.default)(6);
|
|
228
|
+
var UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE = "Bearer token not valid or expired";
|
|
228
229
|
var ApiClientError = class _ApiClientError extends Error {
|
|
229
230
|
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
230
231
|
super(
|
|
@@ -240,6 +241,12 @@ var ApiClientError = class _ApiClientError extends Error {
|
|
|
240
241
|
Object.setPrototypeOf(this, _ApiClientError.prototype);
|
|
241
242
|
}
|
|
242
243
|
};
|
|
244
|
+
var BearerTokenNotValidOrExpiredError = class _BearerTokenNotValidOrExpiredError extends ApiClientError {
|
|
245
|
+
constructor(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId) {
|
|
246
|
+
super(errorMessage, fetchMethod, fetchUri, statusCode, statusText, requestId);
|
|
247
|
+
Object.setPrototypeOf(this, _BearerTokenNotValidOrExpiredError.prototype);
|
|
248
|
+
}
|
|
249
|
+
};
|
|
243
250
|
var ApiClient = class _ApiClient {
|
|
244
251
|
constructor(options) {
|
|
245
252
|
__publicField(this, "options");
|
|
@@ -273,7 +280,7 @@ var ApiClient = class _ApiClient {
|
|
|
273
280
|
}
|
|
274
281
|
async apiClientWithResponse(fetchUri, options) {
|
|
275
282
|
return this.options.limitPolicy(async () => {
|
|
276
|
-
var _a;
|
|
283
|
+
var _a, _b;
|
|
277
284
|
const coreHeaders = this.options.apiKey ? {
|
|
278
285
|
"x-api-key": this.options.apiKey
|
|
279
286
|
} : {
|
|
@@ -309,9 +316,19 @@ var ApiClient = class _ApiClient {
|
|
|
309
316
|
} catch (e) {
|
|
310
317
|
message = `General error`;
|
|
311
318
|
}
|
|
319
|
+
if (apiResponse.status === 401 && message === UNIFORM_BEARER_TOKEN_NOT_VALID_OR_EXPIRED_MESSAGE) {
|
|
320
|
+
throw new BearerTokenNotValidOrExpiredError(
|
|
321
|
+
message,
|
|
322
|
+
(_a = options == null ? void 0 : options.method) != null ? _a : "GET",
|
|
323
|
+
fetchUri.toString(),
|
|
324
|
+
apiResponse.status,
|
|
325
|
+
apiResponse.statusText,
|
|
326
|
+
_ApiClient.getRequestId(apiResponse)
|
|
327
|
+
);
|
|
328
|
+
}
|
|
312
329
|
throw new ApiClientError(
|
|
313
330
|
message,
|
|
314
|
-
(
|
|
331
|
+
(_b = options == null ? void 0 : options.method) != null ? _b : "GET",
|
|
315
332
|
fetchUri.toString(),
|
|
316
333
|
apiResponse.status,
|
|
317
334
|
apiResponse.statusText,
|
|
@@ -674,6 +691,10 @@ function projectionToQuery(spec) {
|
|
|
674
691
|
}
|
|
675
692
|
return out;
|
|
676
693
|
}
|
|
694
|
+
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
695
|
+
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
696
|
+
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
697
|
+
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
677
698
|
var _contentTypesUrl;
|
|
678
699
|
var _entriesUrl;
|
|
679
700
|
var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
@@ -780,14 +801,18 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
780
801
|
constructor(options) {
|
|
781
802
|
super(options);
|
|
782
803
|
}
|
|
783
|
-
/** Fetches
|
|
784
|
-
async
|
|
804
|
+
/** Fetches a list of DataTypes for a project */
|
|
805
|
+
async list(options) {
|
|
785
806
|
const { projectId } = this.options;
|
|
786
807
|
const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8), { ...options, projectId });
|
|
787
808
|
return await this.apiClient(fetchUri);
|
|
788
809
|
}
|
|
810
|
+
/** @deprecated Use {@link list} instead. */
|
|
811
|
+
async get(options) {
|
|
812
|
+
return this.list(options);
|
|
813
|
+
}
|
|
789
814
|
/** Updates or creates (based on id) a DataType */
|
|
790
|
-
async
|
|
815
|
+
async save(body) {
|
|
791
816
|
const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8));
|
|
792
817
|
await this.apiClient(fetchUri, {
|
|
793
818
|
method: "PUT",
|
|
@@ -795,6 +820,10 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
795
820
|
expectNoContent: true
|
|
796
821
|
});
|
|
797
822
|
}
|
|
823
|
+
/** @deprecated Use {@link save} instead. */
|
|
824
|
+
async upsert(body) {
|
|
825
|
+
return this.save(body);
|
|
826
|
+
}
|
|
798
827
|
/** Deletes a DataType */
|
|
799
828
|
async remove(body) {
|
|
800
829
|
const fetchUri = this.createUrl(__privateGet2(_DataTypeClient2, _url8));
|
|
@@ -807,10 +836,6 @@ var _DataTypeClient = class _DataTypeClient2 extends ApiClient {
|
|
|
807
836
|
};
|
|
808
837
|
_url8 = /* @__PURE__ */ new WeakMap();
|
|
809
838
|
__privateAdd2(_DataTypeClient, _url8, "/api/v1/data-types");
|
|
810
|
-
var CANVAS_INTERNAL_PARAM_PREFIX = "$internal_";
|
|
811
|
-
var CANVAS_COMPONENT_DISPLAY_NAME_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}displayName`;
|
|
812
|
-
var CANVAS_HYPOTHESIS_PARAM = `${CANVAS_INTERNAL_PARAM_PREFIX}hypothesis`;
|
|
813
|
-
var EDGE_MAX_CACHE_TTL = 24 * 60 * 60;
|
|
814
839
|
var _baseUrl;
|
|
815
840
|
var _IntegrationPropertyEditorsClient = class _IntegrationPropertyEditorsClient2 extends ApiClient {
|
|
816
841
|
constructor(options) {
|
|
@@ -868,20 +893,28 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
868
893
|
* When teamId is provided, returns a single team with its projects.
|
|
869
894
|
* When omitted, returns all accessible teams and their projects.
|
|
870
895
|
*/
|
|
871
|
-
async
|
|
896
|
+
async list(options) {
|
|
872
897
|
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _projectsUrl), options ? { ...options } : {});
|
|
873
898
|
return await this.apiClient(fetchUri);
|
|
874
899
|
}
|
|
900
|
+
/** @deprecated Use {@link list} instead. */
|
|
901
|
+
async getProjects(options) {
|
|
902
|
+
return this.list(options);
|
|
903
|
+
}
|
|
875
904
|
/** Updates or creates (based on id) a Project */
|
|
876
|
-
async
|
|
905
|
+
async save(body) {
|
|
877
906
|
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
|
|
878
907
|
return await this.apiClient(fetchUri, {
|
|
879
908
|
method: "PUT",
|
|
880
909
|
body: JSON.stringify({ ...body })
|
|
881
910
|
});
|
|
882
911
|
}
|
|
912
|
+
/** @deprecated Use {@link save} instead. */
|
|
913
|
+
async upsert(body) {
|
|
914
|
+
return this.save(body);
|
|
915
|
+
}
|
|
883
916
|
/** Deletes a Project */
|
|
884
|
-
async
|
|
917
|
+
async remove(body) {
|
|
885
918
|
const fetchUri = this.createUrl(__privateGet2(_ProjectClient2, _url22));
|
|
886
919
|
await this.apiClient(fetchUri, {
|
|
887
920
|
method: "DELETE",
|
|
@@ -889,6 +922,10 @@ var _ProjectClient = class _ProjectClient2 extends ApiClient {
|
|
|
889
922
|
expectNoContent: true
|
|
890
923
|
});
|
|
891
924
|
}
|
|
925
|
+
/** @deprecated Use {@link remove} instead. */
|
|
926
|
+
async delete(body) {
|
|
927
|
+
return this.remove(body);
|
|
928
|
+
}
|
|
892
929
|
};
|
|
893
930
|
_url22 = /* @__PURE__ */ new WeakMap();
|
|
894
931
|
_projectsUrl = /* @__PURE__ */ new WeakMap();
|