@uniformdev/next-app-router 20.71.0 → 20.71.2-alpha.10

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 CHANGED
@@ -1208,6 +1208,47 @@ function createLimitPolicy({
1208
1208
  return currentFunc();
1209
1209
  };
1210
1210
  }
1211
+ var SELECT_QUERY_PREFIX = "select.";
1212
+ function appendCsv(out, key, values) {
1213
+ if (values === void 0) {
1214
+ return;
1215
+ }
1216
+ out[key] = values.join(",");
1217
+ }
1218
+ function projectionToQuery(spec) {
1219
+ const out = {};
1220
+ if (!spec) {
1221
+ return out;
1222
+ }
1223
+ const { fields, fieldTypes, slots } = spec;
1224
+ const p = SELECT_QUERY_PREFIX;
1225
+ if (fields) {
1226
+ appendCsv(out, `${p}fields[only]`, fields.only);
1227
+ appendCsv(out, `${p}fields[except]`, fields.except);
1228
+ appendCsv(out, `${p}fields[locales]`, fields.locales);
1229
+ }
1230
+ if (fieldTypes) {
1231
+ appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
1232
+ appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
1233
+ }
1234
+ if (slots) {
1235
+ appendCsv(out, `${p}slots[only]`, slots.only);
1236
+ appendCsv(out, `${p}slots[except]`, slots.except);
1237
+ if (typeof slots.depth === "number") {
1238
+ out[`${p}slots[depth]`] = String(slots.depth);
1239
+ }
1240
+ if (slots.named) {
1241
+ const slotNames = Object.keys(slots.named).sort();
1242
+ for (const slotName of slotNames) {
1243
+ const named = slots.named[slotName];
1244
+ if (named && typeof named.depth === "number") {
1245
+ out[`${p}slots.${slotName}[depth]`] = String(named.depth);
1246
+ }
1247
+ }
1248
+ }
1249
+ }
1250
+ return out;
1251
+ }
1211
1252
  var _contentTypesUrl;
1212
1253
  var _entriesUrl;
1213
1254
  var _ContentClient = class _ContentClient2 extends ApiClient {
@@ -1223,15 +1264,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1223
1264
  }
1224
1265
  getEntries(options) {
1225
1266
  const { projectId } = this.options;
1226
- const { skipDataResolution, filters, ...params } = options;
1267
+ const { skipDataResolution, filters, select, ...params } = options;
1227
1268
  const rewrittenFilters = rewriteFiltersForApi(filters);
1269
+ const rewrittenSelect = projectionToQuery(select);
1228
1270
  if (skipDataResolution) {
1229
- const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
1271
+ const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
1272
+ ...params,
1273
+ ...rewrittenFilters,
1274
+ ...rewrittenSelect,
1275
+ projectId
1276
+ });
1230
1277
  return this.apiClient(url);
1231
1278
  }
1232
1279
  const edgeUrl = this.createUrl(
1233
1280
  __privateGet3(_ContentClient2, _entriesUrl),
1234
- { ...this.getEdgeOptions(params), ...rewrittenFilters },
1281
+ { ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
1235
1282
  this.edgeApiHost
1236
1283
  );
1237
1284
  return this.apiClient(
@@ -1439,7 +1486,9 @@ var RouteClient = class extends ApiClient {
1439
1486
  /** Fetches lists of Canvas compositions, optionally by type */
1440
1487
  async getRoute(options) {
1441
1488
  const { projectId } = this.options;
1442
- const fetchUri = this.createUrl(ROUTE_URL, { ...options, projectId }, this.edgeApiHost);
1489
+ const { select, ...rest } = options != null ? options : {};
1490
+ const rewrittenSelect = projectionToQuery(select);
1491
+ const fetchUri = this.createUrl(ROUTE_URL, { ...rest, projectId, ...rewrittenSelect }, this.edgeApiHost);
1443
1492
  return await this.apiClient(
1444
1493
  fetchUri,
1445
1494
  this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
package/dist/cache.mjs CHANGED
@@ -1195,6 +1195,47 @@ function createLimitPolicy({
1195
1195
  return currentFunc();
1196
1196
  };
1197
1197
  }
1198
+ var SELECT_QUERY_PREFIX = "select.";
1199
+ function appendCsv(out, key, values) {
1200
+ if (values === void 0) {
1201
+ return;
1202
+ }
1203
+ out[key] = values.join(",");
1204
+ }
1205
+ function projectionToQuery(spec) {
1206
+ const out = {};
1207
+ if (!spec) {
1208
+ return out;
1209
+ }
1210
+ const { fields, fieldTypes, slots } = spec;
1211
+ const p = SELECT_QUERY_PREFIX;
1212
+ if (fields) {
1213
+ appendCsv(out, `${p}fields[only]`, fields.only);
1214
+ appendCsv(out, `${p}fields[except]`, fields.except);
1215
+ appendCsv(out, `${p}fields[locales]`, fields.locales);
1216
+ }
1217
+ if (fieldTypes) {
1218
+ appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
1219
+ appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
1220
+ }
1221
+ if (slots) {
1222
+ appendCsv(out, `${p}slots[only]`, slots.only);
1223
+ appendCsv(out, `${p}slots[except]`, slots.except);
1224
+ if (typeof slots.depth === "number") {
1225
+ out[`${p}slots[depth]`] = String(slots.depth);
1226
+ }
1227
+ if (slots.named) {
1228
+ const slotNames = Object.keys(slots.named).sort();
1229
+ for (const slotName of slotNames) {
1230
+ const named = slots.named[slotName];
1231
+ if (named && typeof named.depth === "number") {
1232
+ out[`${p}slots.${slotName}[depth]`] = String(named.depth);
1233
+ }
1234
+ }
1235
+ }
1236
+ }
1237
+ return out;
1238
+ }
1198
1239
  var _contentTypesUrl;
1199
1240
  var _entriesUrl;
1200
1241
  var _ContentClient = class _ContentClient2 extends ApiClient {
@@ -1210,15 +1251,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1210
1251
  }
1211
1252
  getEntries(options) {
1212
1253
  const { projectId } = this.options;
1213
- const { skipDataResolution, filters, ...params } = options;
1254
+ const { skipDataResolution, filters, select, ...params } = options;
1214
1255
  const rewrittenFilters = rewriteFiltersForApi(filters);
1256
+ const rewrittenSelect = projectionToQuery(select);
1215
1257
  if (skipDataResolution) {
1216
- const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
1258
+ const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
1259
+ ...params,
1260
+ ...rewrittenFilters,
1261
+ ...rewrittenSelect,
1262
+ projectId
1263
+ });
1217
1264
  return this.apiClient(url);
1218
1265
  }
1219
1266
  const edgeUrl = this.createUrl(
1220
1267
  __privateGet3(_ContentClient2, _entriesUrl),
1221
- { ...this.getEdgeOptions(params), ...rewrittenFilters },
1268
+ { ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
1222
1269
  this.edgeApiHost
1223
1270
  );
1224
1271
  return this.apiClient(
@@ -1426,7 +1473,9 @@ var RouteClient = class extends ApiClient {
1426
1473
  /** Fetches lists of Canvas compositions, optionally by type */
1427
1474
  async getRoute(options) {
1428
1475
  const { projectId } = this.options;
1429
- const fetchUri = this.createUrl(ROUTE_URL, { ...options, projectId }, this.edgeApiHost);
1476
+ const { select, ...rest } = options != null ? options : {};
1477
+ const rewrittenSelect = projectionToQuery(select);
1478
+ const fetchUri = this.createUrl(ROUTE_URL, { ...rest, projectId, ...rewrittenSelect }, this.edgeApiHost);
1430
1479
  return await this.apiClient(
1431
1480
  fetchUri,
1432
1481
  this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
package/dist/component.js CHANGED
@@ -630,6 +630,47 @@ var __typeError2 = (msg) => {
630
630
  var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
631
631
  var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
632
632
  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);
633
+ var SELECT_QUERY_PREFIX = "select.";
634
+ function appendCsv(out, key, values) {
635
+ if (values === void 0) {
636
+ return;
637
+ }
638
+ out[key] = values.join(",");
639
+ }
640
+ function projectionToQuery(spec) {
641
+ const out = {};
642
+ if (!spec) {
643
+ return out;
644
+ }
645
+ const { fields, fieldTypes, slots } = spec;
646
+ const p = SELECT_QUERY_PREFIX;
647
+ if (fields) {
648
+ appendCsv(out, `${p}fields[only]`, fields.only);
649
+ appendCsv(out, `${p}fields[except]`, fields.except);
650
+ appendCsv(out, `${p}fields[locales]`, fields.locales);
651
+ }
652
+ if (fieldTypes) {
653
+ appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
654
+ appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
655
+ }
656
+ if (slots) {
657
+ appendCsv(out, `${p}slots[only]`, slots.only);
658
+ appendCsv(out, `${p}slots[except]`, slots.except);
659
+ if (typeof slots.depth === "number") {
660
+ out[`${p}slots[depth]`] = String(slots.depth);
661
+ }
662
+ if (slots.named) {
663
+ const slotNames = Object.keys(slots.named).sort();
664
+ for (const slotName of slotNames) {
665
+ const named = slots.named[slotName];
666
+ if (named && typeof named.depth === "number") {
667
+ out[`${p}slots.${slotName}[depth]`] = String(named.depth);
668
+ }
669
+ }
670
+ }
671
+ }
672
+ return out;
673
+ }
633
674
  var _contentTypesUrl;
634
675
  var _entriesUrl;
635
676
  var _ContentClient = class _ContentClient2 extends ApiClient {
@@ -645,15 +686,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
645
686
  }
646
687
  getEntries(options) {
647
688
  const { projectId } = this.options;
648
- const { skipDataResolution, filters, ...params } = options;
689
+ const { skipDataResolution, filters, select, ...params } = options;
649
690
  const rewrittenFilters = rewriteFiltersForApi(filters);
691
+ const rewrittenSelect = projectionToQuery(select);
650
692
  if (skipDataResolution) {
651
- const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
693
+ const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
694
+ ...params,
695
+ ...rewrittenFilters,
696
+ ...rewrittenSelect,
697
+ projectId
698
+ });
652
699
  return this.apiClient(url);
653
700
  }
654
701
  const edgeUrl = this.createUrl(
655
702
  __privateGet2(_ContentClient2, _entriesUrl),
656
- { ...this.getEdgeOptions(params), ...rewrittenFilters },
703
+ { ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
657
704
  this.edgeApiHost
658
705
  );
659
706
  return this.apiClient(
@@ -615,6 +615,47 @@ var __typeError2 = (msg) => {
615
615
  var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
616
616
  var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
617
617
  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);
618
+ var SELECT_QUERY_PREFIX = "select.";
619
+ function appendCsv(out, key, values) {
620
+ if (values === void 0) {
621
+ return;
622
+ }
623
+ out[key] = values.join(",");
624
+ }
625
+ function projectionToQuery(spec) {
626
+ const out = {};
627
+ if (!spec) {
628
+ return out;
629
+ }
630
+ const { fields, fieldTypes, slots } = spec;
631
+ const p = SELECT_QUERY_PREFIX;
632
+ if (fields) {
633
+ appendCsv(out, `${p}fields[only]`, fields.only);
634
+ appendCsv(out, `${p}fields[except]`, fields.except);
635
+ appendCsv(out, `${p}fields[locales]`, fields.locales);
636
+ }
637
+ if (fieldTypes) {
638
+ appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
639
+ appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
640
+ }
641
+ if (slots) {
642
+ appendCsv(out, `${p}slots[only]`, slots.only);
643
+ appendCsv(out, `${p}slots[except]`, slots.except);
644
+ if (typeof slots.depth === "number") {
645
+ out[`${p}slots[depth]`] = String(slots.depth);
646
+ }
647
+ if (slots.named) {
648
+ const slotNames = Object.keys(slots.named).sort();
649
+ for (const slotName of slotNames) {
650
+ const named = slots.named[slotName];
651
+ if (named && typeof named.depth === "number") {
652
+ out[`${p}slots.${slotName}[depth]`] = String(named.depth);
653
+ }
654
+ }
655
+ }
656
+ }
657
+ return out;
658
+ }
618
659
  var _contentTypesUrl;
619
660
  var _entriesUrl;
620
661
  var _ContentClient = class _ContentClient2 extends ApiClient {
@@ -630,15 +671,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
630
671
  }
631
672
  getEntries(options) {
632
673
  const { projectId } = this.options;
633
- const { skipDataResolution, filters, ...params } = options;
674
+ const { skipDataResolution, filters, select, ...params } = options;
634
675
  const rewrittenFilters = rewriteFiltersForApi(filters);
676
+ const rewrittenSelect = projectionToQuery(select);
635
677
  if (skipDataResolution) {
636
- const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
678
+ const url = this.createUrl(__privateGet2(_ContentClient2, _entriesUrl), {
679
+ ...params,
680
+ ...rewrittenFilters,
681
+ ...rewrittenSelect,
682
+ projectId
683
+ });
637
684
  return this.apiClient(url);
638
685
  }
639
686
  const edgeUrl = this.createUrl(
640
687
  __privateGet2(_ContentClient2, _entriesUrl),
641
- { ...this.getEdgeOptions(params), ...rewrittenFilters },
688
+ { ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
642
689
  this.edgeApiHost
643
690
  );
644
691
  return this.apiClient(
package/dist/handler.js CHANGED
@@ -1206,6 +1206,47 @@ function createLimitPolicy({
1206
1206
  return currentFunc();
1207
1207
  };
1208
1208
  }
1209
+ var SELECT_QUERY_PREFIX = "select.";
1210
+ function appendCsv(out, key, values) {
1211
+ if (values === void 0) {
1212
+ return;
1213
+ }
1214
+ out[key] = values.join(",");
1215
+ }
1216
+ function projectionToQuery(spec) {
1217
+ const out = {};
1218
+ if (!spec) {
1219
+ return out;
1220
+ }
1221
+ const { fields, fieldTypes, slots } = spec;
1222
+ const p = SELECT_QUERY_PREFIX;
1223
+ if (fields) {
1224
+ appendCsv(out, `${p}fields[only]`, fields.only);
1225
+ appendCsv(out, `${p}fields[except]`, fields.except);
1226
+ appendCsv(out, `${p}fields[locales]`, fields.locales);
1227
+ }
1228
+ if (fieldTypes) {
1229
+ appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
1230
+ appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
1231
+ }
1232
+ if (slots) {
1233
+ appendCsv(out, `${p}slots[only]`, slots.only);
1234
+ appendCsv(out, `${p}slots[except]`, slots.except);
1235
+ if (typeof slots.depth === "number") {
1236
+ out[`${p}slots[depth]`] = String(slots.depth);
1237
+ }
1238
+ if (slots.named) {
1239
+ const slotNames = Object.keys(slots.named).sort();
1240
+ for (const slotName of slotNames) {
1241
+ const named = slots.named[slotName];
1242
+ if (named && typeof named.depth === "number") {
1243
+ out[`${p}slots.${slotName}[depth]`] = String(named.depth);
1244
+ }
1245
+ }
1246
+ }
1247
+ }
1248
+ return out;
1249
+ }
1209
1250
  var CANVAS_URL = "/api/v1/canvas";
1210
1251
  var CanvasClient = class extends ApiClient {
1211
1252
  constructor(options) {
@@ -1220,17 +1261,24 @@ var CanvasClient = class extends ApiClient {
1220
1261
  /** Fetches lists of Canvas compositions, optionally by type */
1221
1262
  async getCompositionList(params = {}) {
1222
1263
  const { projectId } = this.options;
1223
- const { resolveData, filters, ...originParams } = params;
1264
+ const { resolveData, filters, select, ...originParams } = params;
1224
1265
  const rewrittenFilters = rewriteFiltersForApi(filters);
1266
+ const rewrittenSelect = projectionToQuery(select);
1225
1267
  if (!resolveData) {
1226
- const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
1268
+ const fetchUri = this.createUrl(CANVAS_URL, {
1269
+ ...originParams,
1270
+ projectId,
1271
+ ...rewrittenFilters,
1272
+ ...rewrittenSelect
1273
+ });
1227
1274
  return this.apiClient(fetchUri);
1228
1275
  }
1229
1276
  const edgeParams = {
1230
1277
  ...originParams,
1231
1278
  projectId,
1232
1279
  diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
1233
- ...rewrittenFilters
1280
+ ...rewrittenFilters,
1281
+ ...rewrittenSelect
1234
1282
  };
1235
1283
  const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
1236
1284
  return this.apiClient(edgeUrl, this.edgeApiRequestInit);
@@ -1340,15 +1388,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1340
1388
  }
1341
1389
  getEntries(options) {
1342
1390
  const { projectId } = this.options;
1343
- const { skipDataResolution, filters, ...params } = options;
1391
+ const { skipDataResolution, filters, select, ...params } = options;
1344
1392
  const rewrittenFilters = rewriteFiltersForApi(filters);
1393
+ const rewrittenSelect = projectionToQuery(select);
1345
1394
  if (skipDataResolution) {
1346
- const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
1395
+ const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
1396
+ ...params,
1397
+ ...rewrittenFilters,
1398
+ ...rewrittenSelect,
1399
+ projectId
1400
+ });
1347
1401
  return this.apiClient(url);
1348
1402
  }
1349
1403
  const edgeUrl = this.createUrl(
1350
1404
  __privateGet3(_ContentClient2, _entriesUrl),
1351
- { ...this.getEdgeOptions(params), ...rewrittenFilters },
1405
+ { ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
1352
1406
  this.edgeApiHost
1353
1407
  );
1354
1408
  return this.apiClient(
package/dist/handler.mjs CHANGED
@@ -1191,6 +1191,47 @@ function createLimitPolicy({
1191
1191
  return currentFunc();
1192
1192
  };
1193
1193
  }
1194
+ var SELECT_QUERY_PREFIX = "select.";
1195
+ function appendCsv(out, key, values) {
1196
+ if (values === void 0) {
1197
+ return;
1198
+ }
1199
+ out[key] = values.join(",");
1200
+ }
1201
+ function projectionToQuery(spec) {
1202
+ const out = {};
1203
+ if (!spec) {
1204
+ return out;
1205
+ }
1206
+ const { fields, fieldTypes, slots } = spec;
1207
+ const p = SELECT_QUERY_PREFIX;
1208
+ if (fields) {
1209
+ appendCsv(out, `${p}fields[only]`, fields.only);
1210
+ appendCsv(out, `${p}fields[except]`, fields.except);
1211
+ appendCsv(out, `${p}fields[locales]`, fields.locales);
1212
+ }
1213
+ if (fieldTypes) {
1214
+ appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
1215
+ appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
1216
+ }
1217
+ if (slots) {
1218
+ appendCsv(out, `${p}slots[only]`, slots.only);
1219
+ appendCsv(out, `${p}slots[except]`, slots.except);
1220
+ if (typeof slots.depth === "number") {
1221
+ out[`${p}slots[depth]`] = String(slots.depth);
1222
+ }
1223
+ if (slots.named) {
1224
+ const slotNames = Object.keys(slots.named).sort();
1225
+ for (const slotName of slotNames) {
1226
+ const named = slots.named[slotName];
1227
+ if (named && typeof named.depth === "number") {
1228
+ out[`${p}slots.${slotName}[depth]`] = String(named.depth);
1229
+ }
1230
+ }
1231
+ }
1232
+ }
1233
+ return out;
1234
+ }
1194
1235
  var CANVAS_URL = "/api/v1/canvas";
1195
1236
  var CanvasClient = class extends ApiClient {
1196
1237
  constructor(options) {
@@ -1205,17 +1246,24 @@ var CanvasClient = class extends ApiClient {
1205
1246
  /** Fetches lists of Canvas compositions, optionally by type */
1206
1247
  async getCompositionList(params = {}) {
1207
1248
  const { projectId } = this.options;
1208
- const { resolveData, filters, ...originParams } = params;
1249
+ const { resolveData, filters, select, ...originParams } = params;
1209
1250
  const rewrittenFilters = rewriteFiltersForApi(filters);
1251
+ const rewrittenSelect = projectionToQuery(select);
1210
1252
  if (!resolveData) {
1211
- const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
1253
+ const fetchUri = this.createUrl(CANVAS_URL, {
1254
+ ...originParams,
1255
+ projectId,
1256
+ ...rewrittenFilters,
1257
+ ...rewrittenSelect
1258
+ });
1212
1259
  return this.apiClient(fetchUri);
1213
1260
  }
1214
1261
  const edgeParams = {
1215
1262
  ...originParams,
1216
1263
  projectId,
1217
1264
  diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
1218
- ...rewrittenFilters
1265
+ ...rewrittenFilters,
1266
+ ...rewrittenSelect
1219
1267
  };
1220
1268
  const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
1221
1269
  return this.apiClient(edgeUrl, this.edgeApiRequestInit);
@@ -1325,15 +1373,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1325
1373
  }
1326
1374
  getEntries(options) {
1327
1375
  const { projectId } = this.options;
1328
- const { skipDataResolution, filters, ...params } = options;
1376
+ const { skipDataResolution, filters, select, ...params } = options;
1329
1377
  const rewrittenFilters = rewriteFiltersForApi(filters);
1378
+ const rewrittenSelect = projectionToQuery(select);
1330
1379
  if (skipDataResolution) {
1331
- const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
1380
+ const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
1381
+ ...params,
1382
+ ...rewrittenFilters,
1383
+ ...rewrittenSelect,
1384
+ projectId
1385
+ });
1332
1386
  return this.apiClient(url);
1333
1387
  }
1334
1388
  const edgeUrl = this.createUrl(
1335
1389
  __privateGet3(_ContentClient2, _entriesUrl),
1336
- { ...this.getEdgeOptions(params), ...rewrittenFilters },
1390
+ { ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
1337
1391
  this.edgeApiHost
1338
1392
  );
1339
1393
  return this.apiClient(
package/dist/index.esm.js CHANGED
@@ -1198,6 +1198,47 @@ function createLimitPolicy({
1198
1198
  return currentFunc();
1199
1199
  };
1200
1200
  }
1201
+ var SELECT_QUERY_PREFIX = "select.";
1202
+ function appendCsv(out, key, values) {
1203
+ if (values === void 0) {
1204
+ return;
1205
+ }
1206
+ out[key] = values.join(",");
1207
+ }
1208
+ function projectionToQuery(spec) {
1209
+ const out = {};
1210
+ if (!spec) {
1211
+ return out;
1212
+ }
1213
+ const { fields, fieldTypes, slots } = spec;
1214
+ const p = SELECT_QUERY_PREFIX;
1215
+ if (fields) {
1216
+ appendCsv(out, `${p}fields[only]`, fields.only);
1217
+ appendCsv(out, `${p}fields[except]`, fields.except);
1218
+ appendCsv(out, `${p}fields[locales]`, fields.locales);
1219
+ }
1220
+ if (fieldTypes) {
1221
+ appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
1222
+ appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
1223
+ }
1224
+ if (slots) {
1225
+ appendCsv(out, `${p}slots[only]`, slots.only);
1226
+ appendCsv(out, `${p}slots[except]`, slots.except);
1227
+ if (typeof slots.depth === "number") {
1228
+ out[`${p}slots[depth]`] = String(slots.depth);
1229
+ }
1230
+ if (slots.named) {
1231
+ const slotNames = Object.keys(slots.named).sort();
1232
+ for (const slotName of slotNames) {
1233
+ const named = slots.named[slotName];
1234
+ if (named && typeof named.depth === "number") {
1235
+ out[`${p}slots.${slotName}[depth]`] = String(named.depth);
1236
+ }
1237
+ }
1238
+ }
1239
+ }
1240
+ return out;
1241
+ }
1201
1242
  var CANVAS_URL = "/api/v1/canvas";
1202
1243
  var CanvasClient = class extends ApiClient {
1203
1244
  constructor(options) {
@@ -1212,17 +1253,24 @@ var CanvasClient = class extends ApiClient {
1212
1253
  /** Fetches lists of Canvas compositions, optionally by type */
1213
1254
  async getCompositionList(params = {}) {
1214
1255
  const { projectId } = this.options;
1215
- const { resolveData, filters, ...originParams } = params;
1256
+ const { resolveData, filters, select, ...originParams } = params;
1216
1257
  const rewrittenFilters = rewriteFiltersForApi(filters);
1258
+ const rewrittenSelect = projectionToQuery(select);
1217
1259
  if (!resolveData) {
1218
- const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
1260
+ const fetchUri = this.createUrl(CANVAS_URL, {
1261
+ ...originParams,
1262
+ projectId,
1263
+ ...rewrittenFilters,
1264
+ ...rewrittenSelect
1265
+ });
1219
1266
  return this.apiClient(fetchUri);
1220
1267
  }
1221
1268
  const edgeParams = {
1222
1269
  ...originParams,
1223
1270
  projectId,
1224
1271
  diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
1225
- ...rewrittenFilters
1272
+ ...rewrittenFilters,
1273
+ ...rewrittenSelect
1226
1274
  };
1227
1275
  const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
1228
1276
  return this.apiClient(edgeUrl, this.edgeApiRequestInit);
@@ -1332,15 +1380,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1332
1380
  }
1333
1381
  getEntries(options) {
1334
1382
  const { projectId } = this.options;
1335
- const { skipDataResolution, filters, ...params } = options;
1383
+ const { skipDataResolution, filters, select, ...params } = options;
1336
1384
  const rewrittenFilters = rewriteFiltersForApi(filters);
1385
+ const rewrittenSelect = projectionToQuery(select);
1337
1386
  if (skipDataResolution) {
1338
- const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
1387
+ const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
1388
+ ...params,
1389
+ ...rewrittenFilters,
1390
+ ...rewrittenSelect,
1391
+ projectId
1392
+ });
1339
1393
  return this.apiClient(url);
1340
1394
  }
1341
1395
  const edgeUrl = this.createUrl(
1342
1396
  __privateGet3(_ContentClient2, _entriesUrl),
1343
- { ...this.getEdgeOptions(params), ...rewrittenFilters },
1397
+ { ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
1344
1398
  this.edgeApiHost
1345
1399
  );
1346
1400
  return this.apiClient(
@@ -1982,7 +2036,9 @@ var RouteClient = class extends ApiClient {
1982
2036
  /** Fetches lists of Canvas compositions, optionally by type */
1983
2037
  async getRoute(options) {
1984
2038
  const { projectId } = this.options;
1985
- const fetchUri = this.createUrl(ROUTE_URL, { ...options, projectId }, this.edgeApiHost);
2039
+ const { select, ...rest } = options != null ? options : {};
2040
+ const rewrittenSelect = projectionToQuery(select);
2041
+ const fetchUri = this.createUrl(ROUTE_URL, { ...rest, projectId, ...rewrittenSelect }, this.edgeApiHost);
1986
2042
  return await this.apiClient(
1987
2043
  fetchUri,
1988
2044
  this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
package/dist/index.js CHANGED
@@ -1225,6 +1225,47 @@ function createLimitPolicy({
1225
1225
  return currentFunc();
1226
1226
  };
1227
1227
  }
1228
+ var SELECT_QUERY_PREFIX = "select.";
1229
+ function appendCsv(out, key, values) {
1230
+ if (values === void 0) {
1231
+ return;
1232
+ }
1233
+ out[key] = values.join(",");
1234
+ }
1235
+ function projectionToQuery(spec) {
1236
+ const out = {};
1237
+ if (!spec) {
1238
+ return out;
1239
+ }
1240
+ const { fields, fieldTypes, slots } = spec;
1241
+ const p = SELECT_QUERY_PREFIX;
1242
+ if (fields) {
1243
+ appendCsv(out, `${p}fields[only]`, fields.only);
1244
+ appendCsv(out, `${p}fields[except]`, fields.except);
1245
+ appendCsv(out, `${p}fields[locales]`, fields.locales);
1246
+ }
1247
+ if (fieldTypes) {
1248
+ appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
1249
+ appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
1250
+ }
1251
+ if (slots) {
1252
+ appendCsv(out, `${p}slots[only]`, slots.only);
1253
+ appendCsv(out, `${p}slots[except]`, slots.except);
1254
+ if (typeof slots.depth === "number") {
1255
+ out[`${p}slots[depth]`] = String(slots.depth);
1256
+ }
1257
+ if (slots.named) {
1258
+ const slotNames = Object.keys(slots.named).sort();
1259
+ for (const slotName of slotNames) {
1260
+ const named = slots.named[slotName];
1261
+ if (named && typeof named.depth === "number") {
1262
+ out[`${p}slots.${slotName}[depth]`] = String(named.depth);
1263
+ }
1264
+ }
1265
+ }
1266
+ }
1267
+ return out;
1268
+ }
1228
1269
  var CANVAS_URL = "/api/v1/canvas";
1229
1270
  var CanvasClient = class extends ApiClient {
1230
1271
  constructor(options) {
@@ -1239,17 +1280,24 @@ var CanvasClient = class extends ApiClient {
1239
1280
  /** Fetches lists of Canvas compositions, optionally by type */
1240
1281
  async getCompositionList(params = {}) {
1241
1282
  const { projectId } = this.options;
1242
- const { resolveData, filters, ...originParams } = params;
1283
+ const { resolveData, filters, select, ...originParams } = params;
1243
1284
  const rewrittenFilters = rewriteFiltersForApi(filters);
1285
+ const rewrittenSelect = projectionToQuery(select);
1244
1286
  if (!resolveData) {
1245
- const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
1287
+ const fetchUri = this.createUrl(CANVAS_URL, {
1288
+ ...originParams,
1289
+ projectId,
1290
+ ...rewrittenFilters,
1291
+ ...rewrittenSelect
1292
+ });
1246
1293
  return this.apiClient(fetchUri);
1247
1294
  }
1248
1295
  const edgeParams = {
1249
1296
  ...originParams,
1250
1297
  projectId,
1251
1298
  diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
1252
- ...rewrittenFilters
1299
+ ...rewrittenFilters,
1300
+ ...rewrittenSelect
1253
1301
  };
1254
1302
  const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
1255
1303
  return this.apiClient(edgeUrl, this.edgeApiRequestInit);
@@ -1359,15 +1407,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1359
1407
  }
1360
1408
  getEntries(options) {
1361
1409
  const { projectId } = this.options;
1362
- const { skipDataResolution, filters, ...params } = options;
1410
+ const { skipDataResolution, filters, select, ...params } = options;
1363
1411
  const rewrittenFilters = rewriteFiltersForApi(filters);
1412
+ const rewrittenSelect = projectionToQuery(select);
1364
1413
  if (skipDataResolution) {
1365
- const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
1414
+ const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
1415
+ ...params,
1416
+ ...rewrittenFilters,
1417
+ ...rewrittenSelect,
1418
+ projectId
1419
+ });
1366
1420
  return this.apiClient(url);
1367
1421
  }
1368
1422
  const edgeUrl = this.createUrl(
1369
1423
  __privateGet3(_ContentClient2, _entriesUrl),
1370
- { ...this.getEdgeOptions(params), ...rewrittenFilters },
1424
+ { ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
1371
1425
  this.edgeApiHost
1372
1426
  );
1373
1427
  return this.apiClient(
@@ -2009,7 +2063,9 @@ var RouteClient = class extends ApiClient {
2009
2063
  /** Fetches lists of Canvas compositions, optionally by type */
2010
2064
  async getRoute(options) {
2011
2065
  const { projectId } = this.options;
2012
- const fetchUri = this.createUrl(ROUTE_URL, { ...options, projectId }, this.edgeApiHost);
2066
+ const { select, ...rest } = options != null ? options : {};
2067
+ const rewrittenSelect = projectionToQuery(select);
2068
+ const fetchUri = this.createUrl(ROUTE_URL, { ...rest, projectId, ...rewrittenSelect }, this.edgeApiHost);
2013
2069
  return await this.apiClient(
2014
2070
  fetchUri,
2015
2071
  this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
package/dist/index.mjs CHANGED
@@ -1198,6 +1198,47 @@ function createLimitPolicy({
1198
1198
  return currentFunc();
1199
1199
  };
1200
1200
  }
1201
+ var SELECT_QUERY_PREFIX = "select.";
1202
+ function appendCsv(out, key, values) {
1203
+ if (values === void 0) {
1204
+ return;
1205
+ }
1206
+ out[key] = values.join(",");
1207
+ }
1208
+ function projectionToQuery(spec) {
1209
+ const out = {};
1210
+ if (!spec) {
1211
+ return out;
1212
+ }
1213
+ const { fields, fieldTypes, slots } = spec;
1214
+ const p = SELECT_QUERY_PREFIX;
1215
+ if (fields) {
1216
+ appendCsv(out, `${p}fields[only]`, fields.only);
1217
+ appendCsv(out, `${p}fields[except]`, fields.except);
1218
+ appendCsv(out, `${p}fields[locales]`, fields.locales);
1219
+ }
1220
+ if (fieldTypes) {
1221
+ appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
1222
+ appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
1223
+ }
1224
+ if (slots) {
1225
+ appendCsv(out, `${p}slots[only]`, slots.only);
1226
+ appendCsv(out, `${p}slots[except]`, slots.except);
1227
+ if (typeof slots.depth === "number") {
1228
+ out[`${p}slots[depth]`] = String(slots.depth);
1229
+ }
1230
+ if (slots.named) {
1231
+ const slotNames = Object.keys(slots.named).sort();
1232
+ for (const slotName of slotNames) {
1233
+ const named = slots.named[slotName];
1234
+ if (named && typeof named.depth === "number") {
1235
+ out[`${p}slots.${slotName}[depth]`] = String(named.depth);
1236
+ }
1237
+ }
1238
+ }
1239
+ }
1240
+ return out;
1241
+ }
1201
1242
  var CANVAS_URL = "/api/v1/canvas";
1202
1243
  var CanvasClient = class extends ApiClient {
1203
1244
  constructor(options) {
@@ -1212,17 +1253,24 @@ var CanvasClient = class extends ApiClient {
1212
1253
  /** Fetches lists of Canvas compositions, optionally by type */
1213
1254
  async getCompositionList(params = {}) {
1214
1255
  const { projectId } = this.options;
1215
- const { resolveData, filters, ...originParams } = params;
1256
+ const { resolveData, filters, select, ...originParams } = params;
1216
1257
  const rewrittenFilters = rewriteFiltersForApi(filters);
1258
+ const rewrittenSelect = projectionToQuery(select);
1217
1259
  if (!resolveData) {
1218
- const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
1260
+ const fetchUri = this.createUrl(CANVAS_URL, {
1261
+ ...originParams,
1262
+ projectId,
1263
+ ...rewrittenFilters,
1264
+ ...rewrittenSelect
1265
+ });
1219
1266
  return this.apiClient(fetchUri);
1220
1267
  }
1221
1268
  const edgeParams = {
1222
1269
  ...originParams,
1223
1270
  projectId,
1224
1271
  diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
1225
- ...rewrittenFilters
1272
+ ...rewrittenFilters,
1273
+ ...rewrittenSelect
1226
1274
  };
1227
1275
  const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
1228
1276
  return this.apiClient(edgeUrl, this.edgeApiRequestInit);
@@ -1332,15 +1380,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1332
1380
  }
1333
1381
  getEntries(options) {
1334
1382
  const { projectId } = this.options;
1335
- const { skipDataResolution, filters, ...params } = options;
1383
+ const { skipDataResolution, filters, select, ...params } = options;
1336
1384
  const rewrittenFilters = rewriteFiltersForApi(filters);
1385
+ const rewrittenSelect = projectionToQuery(select);
1337
1386
  if (skipDataResolution) {
1338
- const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
1387
+ const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
1388
+ ...params,
1389
+ ...rewrittenFilters,
1390
+ ...rewrittenSelect,
1391
+ projectId
1392
+ });
1339
1393
  return this.apiClient(url);
1340
1394
  }
1341
1395
  const edgeUrl = this.createUrl(
1342
1396
  __privateGet3(_ContentClient2, _entriesUrl),
1343
- { ...this.getEdgeOptions(params), ...rewrittenFilters },
1397
+ { ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
1344
1398
  this.edgeApiHost
1345
1399
  );
1346
1400
  return this.apiClient(
@@ -1982,7 +2036,9 @@ var RouteClient = class extends ApiClient {
1982
2036
  /** Fetches lists of Canvas compositions, optionally by type */
1983
2037
  async getRoute(options) {
1984
2038
  const { projectId } = this.options;
1985
- const fetchUri = this.createUrl(ROUTE_URL, { ...options, projectId }, this.edgeApiHost);
2039
+ const { select, ...rest } = options != null ? options : {};
2040
+ const rewrittenSelect = projectionToQuery(select);
2041
+ const fetchUri = this.createUrl(ROUTE_URL, { ...rest, projectId, ...rewrittenSelect }, this.edgeApiHost);
1986
2042
  return await this.apiClient(
1987
2043
  fetchUri,
1988
2044
  this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
@@ -1396,6 +1396,47 @@ function createLimitPolicy({
1396
1396
  return currentFunc();
1397
1397
  };
1398
1398
  }
1399
+ var SELECT_QUERY_PREFIX = "select.";
1400
+ function appendCsv(out, key, values) {
1401
+ if (values === void 0) {
1402
+ return;
1403
+ }
1404
+ out[key] = values.join(",");
1405
+ }
1406
+ function projectionToQuery(spec) {
1407
+ const out = {};
1408
+ if (!spec) {
1409
+ return out;
1410
+ }
1411
+ const { fields, fieldTypes, slots } = spec;
1412
+ const p = SELECT_QUERY_PREFIX;
1413
+ if (fields) {
1414
+ appendCsv(out, `${p}fields[only]`, fields.only);
1415
+ appendCsv(out, `${p}fields[except]`, fields.except);
1416
+ appendCsv(out, `${p}fields[locales]`, fields.locales);
1417
+ }
1418
+ if (fieldTypes) {
1419
+ appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
1420
+ appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
1421
+ }
1422
+ if (slots) {
1423
+ appendCsv(out, `${p}slots[only]`, slots.only);
1424
+ appendCsv(out, `${p}slots[except]`, slots.except);
1425
+ if (typeof slots.depth === "number") {
1426
+ out[`${p}slots[depth]`] = String(slots.depth);
1427
+ }
1428
+ if (slots.named) {
1429
+ const slotNames = Object.keys(slots.named).sort();
1430
+ for (const slotName of slotNames) {
1431
+ const named = slots.named[slotName];
1432
+ if (named && typeof named.depth === "number") {
1433
+ out[`${p}slots.${slotName}[depth]`] = String(named.depth);
1434
+ }
1435
+ }
1436
+ }
1437
+ }
1438
+ return out;
1439
+ }
1399
1440
  var CANVAS_URL = "/api/v1/canvas";
1400
1441
  var CanvasClient = class extends ApiClient {
1401
1442
  constructor(options) {
@@ -1410,17 +1451,24 @@ var CanvasClient = class extends ApiClient {
1410
1451
  /** Fetches lists of Canvas compositions, optionally by type */
1411
1452
  async getCompositionList(params = {}) {
1412
1453
  const { projectId } = this.options;
1413
- const { resolveData, filters, ...originParams } = params;
1454
+ const { resolveData, filters, select, ...originParams } = params;
1414
1455
  const rewrittenFilters = rewriteFiltersForApi(filters);
1456
+ const rewrittenSelect = projectionToQuery(select);
1415
1457
  if (!resolveData) {
1416
- const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
1458
+ const fetchUri = this.createUrl(CANVAS_URL, {
1459
+ ...originParams,
1460
+ projectId,
1461
+ ...rewrittenFilters,
1462
+ ...rewrittenSelect
1463
+ });
1417
1464
  return this.apiClient(fetchUri);
1418
1465
  }
1419
1466
  const edgeParams = {
1420
1467
  ...originParams,
1421
1468
  projectId,
1422
1469
  diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
1423
- ...rewrittenFilters
1470
+ ...rewrittenFilters,
1471
+ ...rewrittenSelect
1424
1472
  };
1425
1473
  const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
1426
1474
  return this.apiClient(edgeUrl, this.edgeApiRequestInit);
@@ -1530,15 +1578,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1530
1578
  }
1531
1579
  getEntries(options) {
1532
1580
  const { projectId } = this.options;
1533
- const { skipDataResolution, filters, ...params } = options;
1581
+ const { skipDataResolution, filters, select, ...params } = options;
1534
1582
  const rewrittenFilters = rewriteFiltersForApi(filters);
1583
+ const rewrittenSelect = projectionToQuery(select);
1535
1584
  if (skipDataResolution) {
1536
- const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
1585
+ const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
1586
+ ...params,
1587
+ ...rewrittenFilters,
1588
+ ...rewrittenSelect,
1589
+ projectId
1590
+ });
1537
1591
  return this.apiClient(url);
1538
1592
  }
1539
1593
  const edgeUrl = this.createUrl(
1540
1594
  __privateGet3(_ContentClient2, _entriesUrl),
1541
- { ...this.getEdgeOptions(params), ...rewrittenFilters },
1595
+ { ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
1542
1596
  this.edgeApiHost
1543
1597
  );
1544
1598
  return this.apiClient(
@@ -2323,7 +2377,9 @@ var RouteClient = class extends ApiClient {
2323
2377
  /** Fetches lists of Canvas compositions, optionally by type */
2324
2378
  async getRoute(options) {
2325
2379
  const { projectId } = this.options;
2326
- const fetchUri = this.createUrl(ROUTE_URL, { ...options, projectId }, this.edgeApiHost);
2380
+ const { select, ...rest } = options != null ? options : {};
2381
+ const rewrittenSelect = projectionToQuery(select);
2382
+ const fetchUri = this.createUrl(ROUTE_URL, { ...rest, projectId, ...rewrittenSelect }, this.edgeApiHost);
2327
2383
  return await this.apiClient(
2328
2384
  fetchUri,
2329
2385
  this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
@@ -1381,6 +1381,47 @@ function createLimitPolicy({
1381
1381
  return currentFunc();
1382
1382
  };
1383
1383
  }
1384
+ var SELECT_QUERY_PREFIX = "select.";
1385
+ function appendCsv(out, key, values) {
1386
+ if (values === void 0) {
1387
+ return;
1388
+ }
1389
+ out[key] = values.join(",");
1390
+ }
1391
+ function projectionToQuery(spec) {
1392
+ const out = {};
1393
+ if (!spec) {
1394
+ return out;
1395
+ }
1396
+ const { fields, fieldTypes, slots } = spec;
1397
+ const p = SELECT_QUERY_PREFIX;
1398
+ if (fields) {
1399
+ appendCsv(out, `${p}fields[only]`, fields.only);
1400
+ appendCsv(out, `${p}fields[except]`, fields.except);
1401
+ appendCsv(out, `${p}fields[locales]`, fields.locales);
1402
+ }
1403
+ if (fieldTypes) {
1404
+ appendCsv(out, `${p}fieldTypes[only]`, fieldTypes.only);
1405
+ appendCsv(out, `${p}fieldTypes[except]`, fieldTypes.except);
1406
+ }
1407
+ if (slots) {
1408
+ appendCsv(out, `${p}slots[only]`, slots.only);
1409
+ appendCsv(out, `${p}slots[except]`, slots.except);
1410
+ if (typeof slots.depth === "number") {
1411
+ out[`${p}slots[depth]`] = String(slots.depth);
1412
+ }
1413
+ if (slots.named) {
1414
+ const slotNames = Object.keys(slots.named).sort();
1415
+ for (const slotName of slotNames) {
1416
+ const named = slots.named[slotName];
1417
+ if (named && typeof named.depth === "number") {
1418
+ out[`${p}slots.${slotName}[depth]`] = String(named.depth);
1419
+ }
1420
+ }
1421
+ }
1422
+ }
1423
+ return out;
1424
+ }
1384
1425
  var CANVAS_URL = "/api/v1/canvas";
1385
1426
  var CanvasClient = class extends ApiClient {
1386
1427
  constructor(options) {
@@ -1395,17 +1436,24 @@ var CanvasClient = class extends ApiClient {
1395
1436
  /** Fetches lists of Canvas compositions, optionally by type */
1396
1437
  async getCompositionList(params = {}) {
1397
1438
  const { projectId } = this.options;
1398
- const { resolveData, filters, ...originParams } = params;
1439
+ const { resolveData, filters, select, ...originParams } = params;
1399
1440
  const rewrittenFilters = rewriteFiltersForApi(filters);
1441
+ const rewrittenSelect = projectionToQuery(select);
1400
1442
  if (!resolveData) {
1401
- const fetchUri = this.createUrl(CANVAS_URL, { ...originParams, projectId, ...rewrittenFilters });
1443
+ const fetchUri = this.createUrl(CANVAS_URL, {
1444
+ ...originParams,
1445
+ projectId,
1446
+ ...rewrittenFilters,
1447
+ ...rewrittenSelect
1448
+ });
1402
1449
  return this.apiClient(fetchUri);
1403
1450
  }
1404
1451
  const edgeParams = {
1405
1452
  ...originParams,
1406
1453
  projectId,
1407
1454
  diagnostics: typeof params.diagnostics === "boolean" ? params.diagnostics : params.diagnostics === "no-data" ? "no-data" : void 0,
1408
- ...rewrittenFilters
1455
+ ...rewrittenFilters,
1456
+ ...rewrittenSelect
1409
1457
  };
1410
1458
  const edgeUrl = this.createUrl("/api/v1/compositions", edgeParams, this.edgeApiHost);
1411
1459
  return this.apiClient(edgeUrl, this.edgeApiRequestInit);
@@ -1515,15 +1563,21 @@ var _ContentClient = class _ContentClient2 extends ApiClient {
1515
1563
  }
1516
1564
  getEntries(options) {
1517
1565
  const { projectId } = this.options;
1518
- const { skipDataResolution, filters, ...params } = options;
1566
+ const { skipDataResolution, filters, select, ...params } = options;
1519
1567
  const rewrittenFilters = rewriteFiltersForApi(filters);
1568
+ const rewrittenSelect = projectionToQuery(select);
1520
1569
  if (skipDataResolution) {
1521
- const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), { ...params, ...rewrittenFilters, projectId });
1570
+ const url = this.createUrl(__privateGet3(_ContentClient2, _entriesUrl), {
1571
+ ...params,
1572
+ ...rewrittenFilters,
1573
+ ...rewrittenSelect,
1574
+ projectId
1575
+ });
1522
1576
  return this.apiClient(url);
1523
1577
  }
1524
1578
  const edgeUrl = this.createUrl(
1525
1579
  __privateGet3(_ContentClient2, _entriesUrl),
1526
- { ...this.getEdgeOptions(params), ...rewrittenFilters },
1580
+ { ...this.getEdgeOptions(params), ...rewrittenFilters, ...rewrittenSelect },
1527
1581
  this.edgeApiHost
1528
1582
  );
1529
1583
  return this.apiClient(
@@ -2308,7 +2362,9 @@ var RouteClient = class extends ApiClient {
2308
2362
  /** Fetches lists of Canvas compositions, optionally by type */
2309
2363
  async getRoute(options) {
2310
2364
  const { projectId } = this.options;
2311
- const fetchUri = this.createUrl(ROUTE_URL, { ...options, projectId }, this.edgeApiHost);
2365
+ const { select, ...rest } = options != null ? options : {};
2366
+ const rewrittenSelect = projectionToQuery(select);
2367
+ const fetchUri = this.createUrl(ROUTE_URL, { ...rest, projectId, ...rewrittenSelect }, this.edgeApiHost);
2312
2368
  return await this.apiClient(
2313
2369
  fetchUri,
2314
2370
  this.options.disableSWR ? { headers: { "x-disable-swr": "true" } } : void 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/next-app-router",
3
- "version": "20.71.0",
3
+ "version": "20.71.2-alpha.10+f05c79f825",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "scripts": {
6
6
  "build": "tsup",
@@ -98,12 +98,12 @@
98
98
  "vitest": "4.1.9"
99
99
  },
100
100
  "dependencies": {
101
- "@uniformdev/canvas-react": "20.71.0",
102
- "@uniformdev/next-app-router-client": "20.71.0",
103
- "@uniformdev/next-app-router-shared": "20.71.0",
104
- "@uniformdev/redirect": "20.71.0",
105
- "@uniformdev/richtext": "20.71.0",
106
- "@uniformdev/webhooks": "20.71.0",
101
+ "@uniformdev/canvas-react": "20.71.2-alpha.10+f05c79f825",
102
+ "@uniformdev/next-app-router-client": "20.71.2-alpha.10+f05c79f825",
103
+ "@uniformdev/next-app-router-shared": "20.71.2-alpha.10+f05c79f825",
104
+ "@uniformdev/redirect": "20.71.2-alpha.10+f05c79f825",
105
+ "@uniformdev/richtext": "20.71.2-alpha.10+f05c79f825",
106
+ "@uniformdev/webhooks": "20.71.2-alpha.10+f05c79f825",
107
107
  "@vercel/functions": "^3.7.2",
108
108
  "encoding": "^0.1.13",
109
109
  "server-only": "^0.0.1",
@@ -120,5 +120,5 @@
120
120
  "publishConfig": {
121
121
  "access": "public"
122
122
  },
123
- "gitHead": "9b3f5e3fa27b275c00cc252da7ed72913464cce6"
123
+ "gitHead": "f05c79f825aea4df577b9ac100ff186a5a582a37"
124
124
  }