@uniformdev/next-app-router 20.63.0 → 20.63.1-alpha.17
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-d7_93l3F.d.ts → UniformComposition-BV6YnA2a.d.ts} +2 -2
- package/dist/{UniformComposition-hhRIBHmn.d.mts → UniformComposition-scIgVvIH.d.mts} +2 -2
- package/dist/cache.d.mts +2 -2
- package/dist/cache.d.ts +2 -2
- package/dist/cache.js +53 -4
- package/dist/cache.mjs +53 -4
- package/dist/{client-BCGVjYM-.d.mts → client-BlKZeE6C.d.mts} +1 -1
- package/dist/{client-BCGVjYM-.d.ts → client-BlKZeE6C.d.ts} +1 -1
- package/dist/compat.d.mts +3 -3
- package/dist/compat.d.ts +3 -3
- package/dist/component.js +50 -3
- package/dist/component.mjs +50 -3
- package/dist/handler.js +60 -6
- package/dist/handler.mjs +60 -6
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.esm.js +103 -44
- package/dist/index.js +103 -44
- package/dist/index.mjs +103 -44
- package/dist/middleware.d.mts +2 -2
- package/dist/middleware.d.ts +2 -2
- package/dist/middleware.js +103 -44
- package/dist/middleware.mjs +103 -44
- package/dist/{resolveRouteFromCode-DgTsfMK8.d.ts → resolveRouteFromCode-3u61IwOW.d.ts} +1 -1
- package/dist/{resolveRouteFromCode-CKaYNXte.d.mts → resolveRouteFromCode-_CdAMtVM.d.mts} +1 -1
- package/package.json +9 -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-BlKZeE6C.js';
|
|
5
|
+
import { a as ResolvedRouteResult, R as ResolveRouteFunction } from './resolveRouteFromCode-3u61IwOW.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-BlKZeE6C.mjs';
|
|
5
|
+
import { a as ResolvedRouteResult, R as ResolveRouteFunction } from './resolveRouteFromCode-_CdAMtVM.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-_CdAMtVM.mjs';
|
|
2
2
|
import '@uniformdev/canvas';
|
|
3
3
|
import '@uniformdev/next-app-router-shared';
|
|
4
|
-
import './client-
|
|
4
|
+
import './client-BlKZeE6C.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-3u61IwOW.js';
|
|
2
2
|
import '@uniformdev/canvas';
|
|
3
3
|
import '@uniformdev/next-app-router-shared';
|
|
4
|
-
import './client-
|
|
4
|
+
import './client-BlKZeE6C.js';
|
|
5
5
|
import '@uniformdev/context';
|
|
6
6
|
|
|
7
7
|
declare const resolveRouteFromCode: ResolveRouteFunction;
|
package/dist/cache.js
CHANGED
|
@@ -1132,6 +1132,47 @@ function createLimitPolicy({
|
|
|
1132
1132
|
return currentFunc();
|
|
1133
1133
|
};
|
|
1134
1134
|
}
|
|
1135
|
+
var SELECT_QUERY_PREFIX = "select.";
|
|
1136
|
+
function appendCsv(out, key, values) {
|
|
1137
|
+
if (values === void 0) {
|
|
1138
|
+
return;
|
|
1139
|
+
}
|
|
1140
|
+
out[key] = values.join(",");
|
|
1141
|
+
}
|
|
1142
|
+
function projectionToQuery(spec) {
|
|
1143
|
+
const out = {};
|
|
1144
|
+
if (!spec) {
|
|
1145
|
+
return out;
|
|
1146
|
+
}
|
|
1147
|
+
const { fields, fieldTypes, slots } = spec;
|
|
1148
|
+
const p = SELECT_QUERY_PREFIX;
|
|
1149
|
+
if (fields) {
|
|
1150
|
+
appendCsv(out, `${p}fields[only]`, fields.only);
|
|
1151
|
+
appendCsv(out, `${p}fields[except]`, fields.except);
|
|
1152
|
+
appendCsv(out, `${p}fields[locales]`, fields.locales);
|
|
1153
|
+
}
|
|
1154
|
+
if (fieldTypes) {
|
|
1155
|
+
appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
|
|
1156
|
+
appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
|
|
1157
|
+
}
|
|
1158
|
+
if (slots) {
|
|
1159
|
+
appendCsv(out, `${p}slots[only]`, slots.only);
|
|
1160
|
+
appendCsv(out, `${p}slots[except]`, slots.except);
|
|
1161
|
+
if (typeof slots.depth === "number") {
|
|
1162
|
+
out[`${p}slots[depth]`] = String(slots.depth);
|
|
1163
|
+
}
|
|
1164
|
+
if (slots.named) {
|
|
1165
|
+
const slotNames = Object.keys(slots.named).sort();
|
|
1166
|
+
for (const slotName of slotNames) {
|
|
1167
|
+
const named = slots.named[slotName];
|
|
1168
|
+
if (named && typeof named.depth === "number") {
|
|
1169
|
+
out[`${p}slots.${slotName}[depth]`] = String(named.depth);
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
return out;
|
|
1175
|
+
}
|
|
1135
1176
|
var _contentTypesUrl;
|
|
1136
1177
|
var _entriesUrl;
|
|
1137
1178
|
var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
@@ -1147,15 +1188,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1147
1188
|
}
|
|
1148
1189
|
getEntries(options) {
|
|
1149
1190
|
const { projectId } = this.options;
|
|
1150
|
-
const { skipDataResolution, filters, ...params } = options;
|
|
1191
|
+
const { skipDataResolution, filters, select, ...params } = options;
|
|
1151
1192
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1193
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1152
1194
|
if (skipDataResolution) {
|
|
1153
|
-
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
|
|
1195
|
+
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
|
|
1196
|
+
...params,
|
|
1197
|
+
...rewrittenFilters,
|
|
1198
|
+
...rewrittenSelect,
|
|
1199
|
+
projectId
|
|
1200
|
+
});
|
|
1154
1201
|
return this.apiClient(url);
|
|
1155
1202
|
}
|
|
1156
1203
|
const edgeUrl = this.createUrl(
|
|
1157
1204
|
__privateGet2(_ContentClient2, _entriesUrl),
|
|
1158
|
-
{ ...this.getEdgeOptions(params), ...rewrittenFilters },
|
|
1205
|
+
{ ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
|
|
1159
1206
|
this.edgeApiHost
|
|
1160
1207
|
);
|
|
1161
1208
|
return this.apiClient(
|
|
@@ -1363,7 +1410,9 @@ var RouteClient = class extends ApiClient {
|
|
|
1363
1410
|
/** Fetches lists of Canvas compositions, optionally by type */
|
|
1364
1411
|
async getRoute(options) {
|
|
1365
1412
|
const { projectId } = this.options;
|
|
1366
|
-
const
|
|
1413
|
+
const { select, ...rest } = options != null ? options : {};
|
|
1414
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1415
|
+
const fetchUri = this.createUrl(ROUTE_URL, { ...rest, projectId, ...rewrittenSelect }, this.edgeApiHost);
|
|
1367
1416
|
return await this.apiClient(
|
|
1368
1417
|
fetchUri,
|
|
1369
1418
|
this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
|
package/dist/cache.mjs
CHANGED
|
@@ -1119,6 +1119,47 @@ function createLimitPolicy({
|
|
|
1119
1119
|
return currentFunc();
|
|
1120
1120
|
};
|
|
1121
1121
|
}
|
|
1122
|
+
var SELECT_QUERY_PREFIX = "select.";
|
|
1123
|
+
function appendCsv(out, key, values) {
|
|
1124
|
+
if (values === void 0) {
|
|
1125
|
+
return;
|
|
1126
|
+
}
|
|
1127
|
+
out[key] = values.join(",");
|
|
1128
|
+
}
|
|
1129
|
+
function projectionToQuery(spec) {
|
|
1130
|
+
const out = {};
|
|
1131
|
+
if (!spec) {
|
|
1132
|
+
return out;
|
|
1133
|
+
}
|
|
1134
|
+
const { fields, fieldTypes, slots } = spec;
|
|
1135
|
+
const p = SELECT_QUERY_PREFIX;
|
|
1136
|
+
if (fields) {
|
|
1137
|
+
appendCsv(out, `${p}fields[only]`, fields.only);
|
|
1138
|
+
appendCsv(out, `${p}fields[except]`, fields.except);
|
|
1139
|
+
appendCsv(out, `${p}fields[locales]`, fields.locales);
|
|
1140
|
+
}
|
|
1141
|
+
if (fieldTypes) {
|
|
1142
|
+
appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
|
|
1143
|
+
appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
|
|
1144
|
+
}
|
|
1145
|
+
if (slots) {
|
|
1146
|
+
appendCsv(out, `${p}slots[only]`, slots.only);
|
|
1147
|
+
appendCsv(out, `${p}slots[except]`, slots.except);
|
|
1148
|
+
if (typeof slots.depth === "number") {
|
|
1149
|
+
out[`${p}slots[depth]`] = String(slots.depth);
|
|
1150
|
+
}
|
|
1151
|
+
if (slots.named) {
|
|
1152
|
+
const slotNames = Object.keys(slots.named).sort();
|
|
1153
|
+
for (const slotName of slotNames) {
|
|
1154
|
+
const named = slots.named[slotName];
|
|
1155
|
+
if (named && typeof named.depth === "number") {
|
|
1156
|
+
out[`${p}slots.${slotName}[depth]`] = String(named.depth);
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
return out;
|
|
1162
|
+
}
|
|
1122
1163
|
var _contentTypesUrl;
|
|
1123
1164
|
var _entriesUrl;
|
|
1124
1165
|
var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
@@ -1134,15 +1175,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1134
1175
|
}
|
|
1135
1176
|
getEntries(options) {
|
|
1136
1177
|
const { projectId } = this.options;
|
|
1137
|
-
const { skipDataResolution, filters, ...params } = options;
|
|
1178
|
+
const { skipDataResolution, filters, select, ...params } = options;
|
|
1138
1179
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1180
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1139
1181
|
if (skipDataResolution) {
|
|
1140
|
-
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
|
|
1182
|
+
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
|
|
1183
|
+
...params,
|
|
1184
|
+
...rewrittenFilters,
|
|
1185
|
+
...rewrittenSelect,
|
|
1186
|
+
projectId
|
|
1187
|
+
});
|
|
1141
1188
|
return this.apiClient(url);
|
|
1142
1189
|
}
|
|
1143
1190
|
const edgeUrl = this.createUrl(
|
|
1144
1191
|
__privateGet2(_ContentClient2, _entriesUrl),
|
|
1145
|
-
{ ...this.getEdgeOptions(params), ...rewrittenFilters },
|
|
1192
|
+
{ ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
|
|
1146
1193
|
this.edgeApiHost
|
|
1147
1194
|
);
|
|
1148
1195
|
return this.apiClient(
|
|
@@ -1350,7 +1397,9 @@ var RouteClient = class extends ApiClient {
|
|
|
1350
1397
|
/** Fetches lists of Canvas compositions, optionally by type */
|
|
1351
1398
|
async getRoute(options) {
|
|
1352
1399
|
const { projectId } = this.options;
|
|
1353
|
-
const
|
|
1400
|
+
const { select, ...rest } = options != null ? options : {};
|
|
1401
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1402
|
+
const fetchUri = this.createUrl(ROUTE_URL, { ...rest, projectId, ...rewrittenSelect }, this.edgeApiHost);
|
|
1354
1403
|
return await this.apiClient(
|
|
1355
1404
|
fetchUri,
|
|
1356
1405
|
this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RouteGetParameters,
|
|
1
|
+
import { RouteGetParameters, RouteGetResponse, RouteClient, RouteGetResponseEdgehancedComposition } from '@uniformdev/canvas';
|
|
2
2
|
import { ManifestV2 } from '@uniformdev/context';
|
|
3
3
|
import { PageState } from '@uniformdev/next-app-router-shared';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RouteGetParameters,
|
|
1
|
+
import { RouteGetParameters, RouteGetResponse, RouteClient, RouteGetResponseEdgehancedComposition } from '@uniformdev/canvas';
|
|
2
2
|
import { ManifestV2 } from '@uniformdev/context';
|
|
3
3
|
import { PageState } from '@uniformdev/next-app-router-shared';
|
|
4
4
|
|
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-scIgVvIH.mjs';
|
|
5
5
|
import '@uniformdev/next-app-router-client';
|
|
6
6
|
import '@uniformdev/canvas';
|
|
7
|
-
import './client-
|
|
7
|
+
import './client-BlKZeE6C.mjs';
|
|
8
8
|
import '@uniformdev/context';
|
|
9
|
-
import './resolveRouteFromCode-
|
|
9
|
+
import './resolveRouteFromCode-_CdAMtVM.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-BV6YnA2a.js';
|
|
5
5
|
import '@uniformdev/next-app-router-client';
|
|
6
6
|
import '@uniformdev/canvas';
|
|
7
|
-
import './client-
|
|
7
|
+
import './client-BlKZeE6C.js';
|
|
8
8
|
import '@uniformdev/context';
|
|
9
|
-
import './resolveRouteFromCode-
|
|
9
|
+
import './resolveRouteFromCode-3u61IwOW.js';
|
|
10
10
|
|
|
11
11
|
type ComponentContext = ComponentProps$1['component'] & {
|
|
12
12
|
parameters: Record<string, ComponentParameter>;
|
package/dist/component.js
CHANGED
|
@@ -996,6 +996,47 @@ var require_retry2 = __commonJS2({
|
|
|
996
996
|
});
|
|
997
997
|
var import_p_limit2 = __toESM2(require_p_limit2());
|
|
998
998
|
var import_retry = __toESM2(require_retry2(), 1);
|
|
999
|
+
var SELECT_QUERY_PREFIX = "select.";
|
|
1000
|
+
function appendCsv(out, key, values) {
|
|
1001
|
+
if (values === void 0) {
|
|
1002
|
+
return;
|
|
1003
|
+
}
|
|
1004
|
+
out[key] = values.join(",");
|
|
1005
|
+
}
|
|
1006
|
+
function projectionToQuery(spec) {
|
|
1007
|
+
const out = {};
|
|
1008
|
+
if (!spec) {
|
|
1009
|
+
return out;
|
|
1010
|
+
}
|
|
1011
|
+
const { fields, fieldTypes, slots } = spec;
|
|
1012
|
+
const p = SELECT_QUERY_PREFIX;
|
|
1013
|
+
if (fields) {
|
|
1014
|
+
appendCsv(out, `${p}fields[only]`, fields.only);
|
|
1015
|
+
appendCsv(out, `${p}fields[except]`, fields.except);
|
|
1016
|
+
appendCsv(out, `${p}fields[locales]`, fields.locales);
|
|
1017
|
+
}
|
|
1018
|
+
if (fieldTypes) {
|
|
1019
|
+
appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
|
|
1020
|
+
appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
|
|
1021
|
+
}
|
|
1022
|
+
if (slots) {
|
|
1023
|
+
appendCsv(out, `${p}slots[only]`, slots.only);
|
|
1024
|
+
appendCsv(out, `${p}slots[except]`, slots.except);
|
|
1025
|
+
if (typeof slots.depth === "number") {
|
|
1026
|
+
out[`${p}slots[depth]`] = String(slots.depth);
|
|
1027
|
+
}
|
|
1028
|
+
if (slots.named) {
|
|
1029
|
+
const slotNames = Object.keys(slots.named).sort();
|
|
1030
|
+
for (const slotName of slotNames) {
|
|
1031
|
+
const named = slots.named[slotName];
|
|
1032
|
+
if (named && typeof named.depth === "number") {
|
|
1033
|
+
out[`${p}slots.${slotName}[depth]`] = String(named.depth);
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
return out;
|
|
1039
|
+
}
|
|
999
1040
|
var _contentTypesUrl;
|
|
1000
1041
|
var _entriesUrl;
|
|
1001
1042
|
var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
@@ -1011,15 +1052,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1011
1052
|
}
|
|
1012
1053
|
getEntries(options) {
|
|
1013
1054
|
const { projectId } = this.options;
|
|
1014
|
-
const { skipDataResolution, filters, ...params } = options;
|
|
1055
|
+
const { skipDataResolution, filters, select, ...params } = options;
|
|
1015
1056
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1057
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1016
1058
|
if (skipDataResolution) {
|
|
1017
|
-
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
|
|
1059
|
+
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
|
|
1060
|
+
...params,
|
|
1061
|
+
...rewrittenFilters,
|
|
1062
|
+
...rewrittenSelect,
|
|
1063
|
+
projectId
|
|
1064
|
+
});
|
|
1018
1065
|
return this.apiClient(url);
|
|
1019
1066
|
}
|
|
1020
1067
|
const edgeUrl = this.createUrl(
|
|
1021
1068
|
__privateGet2(_ContentClient2, _entriesUrl),
|
|
1022
|
-
{ ...this.getEdgeOptions(params), ...rewrittenFilters },
|
|
1069
|
+
{ ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
|
|
1023
1070
|
this.edgeApiHost
|
|
1024
1071
|
);
|
|
1025
1072
|
return this.apiClient(
|
package/dist/component.mjs
CHANGED
|
@@ -981,6 +981,47 @@ var require_retry2 = __commonJS2({
|
|
|
981
981
|
});
|
|
982
982
|
var import_p_limit2 = __toESM2(require_p_limit2());
|
|
983
983
|
var import_retry = __toESM2(require_retry2(), 1);
|
|
984
|
+
var SELECT_QUERY_PREFIX = "select.";
|
|
985
|
+
function appendCsv(out, key, values) {
|
|
986
|
+
if (values === void 0) {
|
|
987
|
+
return;
|
|
988
|
+
}
|
|
989
|
+
out[key] = values.join(",");
|
|
990
|
+
}
|
|
991
|
+
function projectionToQuery(spec) {
|
|
992
|
+
const out = {};
|
|
993
|
+
if (!spec) {
|
|
994
|
+
return out;
|
|
995
|
+
}
|
|
996
|
+
const { fields, fieldTypes, slots } = spec;
|
|
997
|
+
const p = SELECT_QUERY_PREFIX;
|
|
998
|
+
if (fields) {
|
|
999
|
+
appendCsv(out, `${p}fields[only]`, fields.only);
|
|
1000
|
+
appendCsv(out, `${p}fields[except]`, fields.except);
|
|
1001
|
+
appendCsv(out, `${p}fields[locales]`, fields.locales);
|
|
1002
|
+
}
|
|
1003
|
+
if (fieldTypes) {
|
|
1004
|
+
appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
|
|
1005
|
+
appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
|
|
1006
|
+
}
|
|
1007
|
+
if (slots) {
|
|
1008
|
+
appendCsv(out, `${p}slots[only]`, slots.only);
|
|
1009
|
+
appendCsv(out, `${p}slots[except]`, slots.except);
|
|
1010
|
+
if (typeof slots.depth === "number") {
|
|
1011
|
+
out[`${p}slots[depth]`] = String(slots.depth);
|
|
1012
|
+
}
|
|
1013
|
+
if (slots.named) {
|
|
1014
|
+
const slotNames = Object.keys(slots.named).sort();
|
|
1015
|
+
for (const slotName of slotNames) {
|
|
1016
|
+
const named = slots.named[slotName];
|
|
1017
|
+
if (named && typeof named.depth === "number") {
|
|
1018
|
+
out[`${p}slots.${slotName}[depth]`] = String(named.depth);
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
return out;
|
|
1024
|
+
}
|
|
984
1025
|
var _contentTypesUrl;
|
|
985
1026
|
var _entriesUrl;
|
|
986
1027
|
var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
@@ -996,15 +1037,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
996
1037
|
}
|
|
997
1038
|
getEntries(options) {
|
|
998
1039
|
const { projectId } = this.options;
|
|
999
|
-
const { skipDataResolution, filters, ...params } = options;
|
|
1040
|
+
const { skipDataResolution, filters, select, ...params } = options;
|
|
1000
1041
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1042
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1001
1043
|
if (skipDataResolution) {
|
|
1002
|
-
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
|
|
1044
|
+
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
|
|
1045
|
+
...params,
|
|
1046
|
+
...rewrittenFilters,
|
|
1047
|
+
...rewrittenSelect,
|
|
1048
|
+
projectId
|
|
1049
|
+
});
|
|
1003
1050
|
return this.apiClient(url);
|
|
1004
1051
|
}
|
|
1005
1052
|
const edgeUrl = this.createUrl(
|
|
1006
1053
|
__privateGet2(_ContentClient2, _entriesUrl),
|
|
1007
|
-
{ ...this.getEdgeOptions(params), ...rewrittenFilters },
|
|
1054
|
+
{ ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
|
|
1008
1055
|
this.edgeApiHost
|
|
1009
1056
|
);
|
|
1010
1057
|
return this.apiClient(
|
package/dist/handler.js
CHANGED
|
@@ -1130,6 +1130,47 @@ function createLimitPolicy({
|
|
|
1130
1130
|
return currentFunc();
|
|
1131
1131
|
};
|
|
1132
1132
|
}
|
|
1133
|
+
var SELECT_QUERY_PREFIX = "select.";
|
|
1134
|
+
function appendCsv(out, key, values) {
|
|
1135
|
+
if (values === void 0) {
|
|
1136
|
+
return;
|
|
1137
|
+
}
|
|
1138
|
+
out[key] = values.join(",");
|
|
1139
|
+
}
|
|
1140
|
+
function projectionToQuery(spec) {
|
|
1141
|
+
const out = {};
|
|
1142
|
+
if (!spec) {
|
|
1143
|
+
return out;
|
|
1144
|
+
}
|
|
1145
|
+
const { fields, fieldTypes, slots } = spec;
|
|
1146
|
+
const p = SELECT_QUERY_PREFIX;
|
|
1147
|
+
if (fields) {
|
|
1148
|
+
appendCsv(out, `${p}fields[only]`, fields.only);
|
|
1149
|
+
appendCsv(out, `${p}fields[except]`, fields.except);
|
|
1150
|
+
appendCsv(out, `${p}fields[locales]`, fields.locales);
|
|
1151
|
+
}
|
|
1152
|
+
if (fieldTypes) {
|
|
1153
|
+
appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
|
|
1154
|
+
appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
|
|
1155
|
+
}
|
|
1156
|
+
if (slots) {
|
|
1157
|
+
appendCsv(out, `${p}slots[only]`, slots.only);
|
|
1158
|
+
appendCsv(out, `${p}slots[except]`, slots.except);
|
|
1159
|
+
if (typeof slots.depth === "number") {
|
|
1160
|
+
out[`${p}slots[depth]`] = String(slots.depth);
|
|
1161
|
+
}
|
|
1162
|
+
if (slots.named) {
|
|
1163
|
+
const slotNames = Object.keys(slots.named).sort();
|
|
1164
|
+
for (const slotName of slotNames) {
|
|
1165
|
+
const named = slots.named[slotName];
|
|
1166
|
+
if (named && typeof named.depth === "number") {
|
|
1167
|
+
out[`${p}slots.${slotName}[depth]`] = String(named.depth);
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
return out;
|
|
1173
|
+
}
|
|
1133
1174
|
var CANVAS_URL = "/api/v1/canvas";
|
|
1134
1175
|
var CanvasClient = class extends ApiClient {
|
|
1135
1176
|
constructor(options) {
|
|
@@ -1144,17 +1185,24 @@ var CanvasClient = class extends ApiClient {
|
|
|
1144
1185
|
/** Fetches lists of Canvas compositions, optionally by type */
|
|
1145
1186
|
async getCompositionList(params = {}) {
|
|
1146
1187
|
const { projectId } = this.options;
|
|
1147
|
-
const { resolveData, filters, ...originParams } = params;
|
|
1188
|
+
const { resolveData, filters, select, ...originParams } = params;
|
|
1148
1189
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1190
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1149
1191
|
if (!resolveData) {
|
|
1150
|
-
const fetchUri = this.createUrl(CANVAS_URL, {
|
|
1192
|
+
const fetchUri = this.createUrl(CANVAS_URL, {
|
|
1193
|
+
...originParams,
|
|
1194
|
+
projectId,
|
|
1195
|
+
...rewrittenFilters,
|
|
1196
|
+
...rewrittenSelect
|
|
1197
|
+
});
|
|
1151
1198
|
return this.apiClient(fetchUri);
|
|
1152
1199
|
}
|
|
1153
1200
|
const edgeParams = {
|
|
1154
1201
|
...originParams,
|
|
1155
1202
|
projectId,
|
|
1156
1203
|
diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
|
|
1157
|
-
...rewrittenFilters
|
|
1204
|
+
...rewrittenFilters,
|
|
1205
|
+
...rewrittenSelect
|
|
1158
1206
|
};
|
|
1159
1207
|
const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
|
|
1160
1208
|
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
@@ -1264,15 +1312,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1264
1312
|
}
|
|
1265
1313
|
getEntries(options) {
|
|
1266
1314
|
const { projectId } = this.options;
|
|
1267
|
-
const { skipDataResolution, filters, ...params } = options;
|
|
1315
|
+
const { skipDataResolution, filters, select, ...params } = options;
|
|
1268
1316
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1317
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1269
1318
|
if (skipDataResolution) {
|
|
1270
|
-
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
|
|
1319
|
+
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
|
|
1320
|
+
...params,
|
|
1321
|
+
...rewrittenFilters,
|
|
1322
|
+
...rewrittenSelect,
|
|
1323
|
+
projectId
|
|
1324
|
+
});
|
|
1271
1325
|
return this.apiClient(url);
|
|
1272
1326
|
}
|
|
1273
1327
|
const edgeUrl = this.createUrl(
|
|
1274
1328
|
__privateGet2(_ContentClient2, _entriesUrl),
|
|
1275
|
-
{ ...this.getEdgeOptions(params), ...rewrittenFilters },
|
|
1329
|
+
{ ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
|
|
1276
1330
|
this.edgeApiHost
|
|
1277
1331
|
);
|
|
1278
1332
|
return this.apiClient(
|
package/dist/handler.mjs
CHANGED
|
@@ -1115,6 +1115,47 @@ function createLimitPolicy({
|
|
|
1115
1115
|
return currentFunc();
|
|
1116
1116
|
};
|
|
1117
1117
|
}
|
|
1118
|
+
var SELECT_QUERY_PREFIX = "select.";
|
|
1119
|
+
function appendCsv(out, key, values) {
|
|
1120
|
+
if (values === void 0) {
|
|
1121
|
+
return;
|
|
1122
|
+
}
|
|
1123
|
+
out[key] = values.join(",");
|
|
1124
|
+
}
|
|
1125
|
+
function projectionToQuery(spec) {
|
|
1126
|
+
const out = {};
|
|
1127
|
+
if (!spec) {
|
|
1128
|
+
return out;
|
|
1129
|
+
}
|
|
1130
|
+
const { fields, fieldTypes, slots } = spec;
|
|
1131
|
+
const p = SELECT_QUERY_PREFIX;
|
|
1132
|
+
if (fields) {
|
|
1133
|
+
appendCsv(out, `${p}fields[only]`, fields.only);
|
|
1134
|
+
appendCsv(out, `${p}fields[except]`, fields.except);
|
|
1135
|
+
appendCsv(out, `${p}fields[locales]`, fields.locales);
|
|
1136
|
+
}
|
|
1137
|
+
if (fieldTypes) {
|
|
1138
|
+
appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
|
|
1139
|
+
appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
|
|
1140
|
+
}
|
|
1141
|
+
if (slots) {
|
|
1142
|
+
appendCsv(out, `${p}slots[only]`, slots.only);
|
|
1143
|
+
appendCsv(out, `${p}slots[except]`, slots.except);
|
|
1144
|
+
if (typeof slots.depth === "number") {
|
|
1145
|
+
out[`${p}slots[depth]`] = String(slots.depth);
|
|
1146
|
+
}
|
|
1147
|
+
if (slots.named) {
|
|
1148
|
+
const slotNames = Object.keys(slots.named).sort();
|
|
1149
|
+
for (const slotName of slotNames) {
|
|
1150
|
+
const named = slots.named[slotName];
|
|
1151
|
+
if (named && typeof named.depth === "number") {
|
|
1152
|
+
out[`${p}slots.${slotName}[depth]`] = String(named.depth);
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
return out;
|
|
1158
|
+
}
|
|
1118
1159
|
var CANVAS_URL = "/api/v1/canvas";
|
|
1119
1160
|
var CanvasClient = class extends ApiClient {
|
|
1120
1161
|
constructor(options) {
|
|
@@ -1129,17 +1170,24 @@ var CanvasClient = class extends ApiClient {
|
|
|
1129
1170
|
/** Fetches lists of Canvas compositions, optionally by type */
|
|
1130
1171
|
async getCompositionList(params = {}) {
|
|
1131
1172
|
const { projectId } = this.options;
|
|
1132
|
-
const { resolveData, filters, ...originParams } = params;
|
|
1173
|
+
const { resolveData, filters, select, ...originParams } = params;
|
|
1133
1174
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1175
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1134
1176
|
if (!resolveData) {
|
|
1135
|
-
const fetchUri = this.createUrl(CANVAS_URL, {
|
|
1177
|
+
const fetchUri = this.createUrl(CANVAS_URL, {
|
|
1178
|
+
...originParams,
|
|
1179
|
+
projectId,
|
|
1180
|
+
...rewrittenFilters,
|
|
1181
|
+
...rewrittenSelect
|
|
1182
|
+
});
|
|
1136
1183
|
return this.apiClient(fetchUri);
|
|
1137
1184
|
}
|
|
1138
1185
|
const edgeParams = {
|
|
1139
1186
|
...originParams,
|
|
1140
1187
|
projectId,
|
|
1141
1188
|
diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
|
|
1142
|
-
...rewrittenFilters
|
|
1189
|
+
...rewrittenFilters,
|
|
1190
|
+
...rewrittenSelect
|
|
1143
1191
|
};
|
|
1144
1192
|
const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
|
|
1145
1193
|
return this.apiClient(edgeUrl, this.edgeApiRequestInit);
|
|
@@ -1249,15 +1297,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
|
|
|
1249
1297
|
}
|
|
1250
1298
|
getEntries(options) {
|
|
1251
1299
|
const { projectId } = this.options;
|
|
1252
|
-
const { skipDataResolution, filters, ...params } = options;
|
|
1300
|
+
const { skipDataResolution, filters, select, ...params } = options;
|
|
1253
1301
|
const rewrittenFilters = rewriteFiltersForApi(filters);
|
|
1302
|
+
const rewrittenSelect = projectionToQuery(select);
|
|
1254
1303
|
if (skipDataResolution) {
|
|
1255
|
-
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
|
|
1304
|
+
const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
|
|
1305
|
+
...params,
|
|
1306
|
+
...rewrittenFilters,
|
|
1307
|
+
...rewrittenSelect,
|
|
1308
|
+
projectId
|
|
1309
|
+
});
|
|
1256
1310
|
return this.apiClient(url);
|
|
1257
1311
|
}
|
|
1258
1312
|
const edgeUrl = this.createUrl(
|
|
1259
1313
|
__privateGet2(_ContentClient2, _entriesUrl),
|
|
1260
|
-
{ ...this.getEdgeOptions(params), ...rewrittenFilters },
|
|
1314
|
+
{ ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
|
|
1261
1315
|
this.edgeApiHost
|
|
1262
1316
|
);
|
|
1263
1317
|
return this.apiClient(
|
package/dist/index.d.mts
CHANGED
|
@@ -2,12 +2,12 @@ import { CanvasClient, RouteClient, ComponentInstance } from '@uniformdev/canvas
|
|
|
2
2
|
import { CacheMode, CanvasCacheMode, ManifestCacheMode, ProjectMapCacheMode, RewriteRequestPathResult } from '@uniformdev/next-app-router-shared';
|
|
3
3
|
import { ManifestClient } from '@uniformdev/context/api';
|
|
4
4
|
import { ProjectMapClient } from '@uniformdev/project-map';
|
|
5
|
-
import { U as UniformCompositionProps } from './UniformComposition-
|
|
6
|
-
export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-
|
|
5
|
+
import { U as UniformCompositionProps } from './UniformComposition-scIgVvIH.mjs';
|
|
6
|
+
export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-scIgVvIH.mjs';
|
|
7
7
|
import React from 'react';
|
|
8
|
-
export { D as DataClient, a as DefaultDataClient, E as EnhanceRouteOptions, G as GetRouteFromMiddlewareOptions, b as GetRouteFromPageStateOptions, c as GetRouteOptions, R as RewriteRouteOptions, d as RewriteRouteResult, e as expireMiddlewareCacheTag } from './client-
|
|
9
|
-
import { a as ResolvedRouteResult } from './resolveRouteFromCode-
|
|
10
|
-
export { R as ResolveRouteFunction, r as resolveRouteFromCode } from './resolveRouteFromCode-
|
|
8
|
+
export { D as DataClient, a as DefaultDataClient, E as EnhanceRouteOptions, G as GetRouteFromMiddlewareOptions, b as GetRouteFromPageStateOptions, c as GetRouteOptions, R as RewriteRouteOptions, d as RewriteRouteResult, e as expireMiddlewareCacheTag } from './client-BlKZeE6C.mjs';
|
|
9
|
+
import { a as ResolvedRouteResult } from './resolveRouteFromCode-_CdAMtVM.mjs';
|
|
10
|
+
export { R as ResolveRouteFunction, r as resolveRouteFromCode } from './resolveRouteFromCode-_CdAMtVM.mjs';
|
|
11
11
|
import '@uniformdev/next-app-router-client';
|
|
12
12
|
import '@uniformdev/context';
|
|
13
13
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ import { CanvasClient, RouteClient, ComponentInstance } from '@uniformdev/canvas
|
|
|
2
2
|
import { CacheMode, CanvasCacheMode, ManifestCacheMode, ProjectMapCacheMode, RewriteRequestPathResult } from '@uniformdev/next-app-router-shared';
|
|
3
3
|
import { ManifestClient } from '@uniformdev/context/api';
|
|
4
4
|
import { ProjectMapClient } from '@uniformdev/project-map';
|
|
5
|
-
import { U as UniformCompositionProps } from './UniformComposition-
|
|
6
|
-
export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-
|
|
5
|
+
import { U as UniformCompositionProps } from './UniformComposition-BV6YnA2a.js';
|
|
6
|
+
export { C as CompositionCache, a as ResolveComponentFunction, R as ResolveComponentResult, b as UniformComposition, c as createCompositionCache } from './UniformComposition-BV6YnA2a.js';
|
|
7
7
|
import React from 'react';
|
|
8
|
-
export { D as DataClient, a as DefaultDataClient, E as EnhanceRouteOptions, G as GetRouteFromMiddlewareOptions, b as GetRouteFromPageStateOptions, c as GetRouteOptions, R as RewriteRouteOptions, d as RewriteRouteResult, e as expireMiddlewareCacheTag } from './client-
|
|
9
|
-
import { a as ResolvedRouteResult } from './resolveRouteFromCode-
|
|
10
|
-
export { R as ResolveRouteFunction, r as resolveRouteFromCode } from './resolveRouteFromCode-
|
|
8
|
+
export { D as DataClient, a as DefaultDataClient, E as EnhanceRouteOptions, G as GetRouteFromMiddlewareOptions, b as GetRouteFromPageStateOptions, c as GetRouteOptions, R as RewriteRouteOptions, d as RewriteRouteResult, e as expireMiddlewareCacheTag } from './client-BlKZeE6C.js';
|
|
9
|
+
import { a as ResolvedRouteResult } from './resolveRouteFromCode-3u61IwOW.js';
|
|
10
|
+
export { R as ResolveRouteFunction, r as resolveRouteFromCode } from './resolveRouteFromCode-3u61IwOW.js';
|
|
11
11
|
import '@uniformdev/next-app-router-client';
|
|
12
12
|
import '@uniformdev/context';
|
|
13
13
|
|