@relyio/sdk 0.11.0 → 0.12.0
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/CHANGELOG.md +88 -0
- package/dist/chunk-3DRDHXLY.js +680 -0
- package/dist/{chunk-PO7CUR5U.cjs → chunk-3MSFWXQL.cjs} +37 -65
- package/dist/{chunk-4HTIU5YE.cjs → chunk-DXCVO6M5.cjs} +46 -59
- package/dist/chunk-FI5VIF4M.cjs +686 -0
- package/dist/{chunk-7GLDVHIH.js → chunk-FRJEUAAF.js} +46 -59
- package/dist/{chunk-2TIJLV2X.js → chunk-POEEDYFM.js} +38 -65
- package/dist/client/index.cjs +3 -3
- package/dist/client/index.d.cts +5 -4
- package/dist/client/index.d.ts +5 -4
- package/dist/client/index.js +1 -1
- package/dist/{define-schema-CVi8nwc7.d.ts → define-schema-DgctHlI2.d.cts} +35 -220
- package/dist/{define-schema-DqpipEHv.d.cts → define-schema-mrEZbY1h.d.ts} +35 -220
- package/dist/{define-content-type-ENAod5Ve.d.cts → include-paths-CL4gHv6I.d.cts} +1673 -734
- package/dist/{define-content-type-ENAod5Ve.d.ts → include-paths-CrJNTsMl.d.ts} +1673 -734
- package/dist/{index-C73cK2Tt.d.ts → index-B9RfZVF1.d.ts} +3 -2
- package/dist/{index-MLAFUuco.d.cts → index-BrvEg6-A.d.cts} +107 -46
- package/dist/{index-BKEAYvvz.d.ts → index-Pw0onkJe.d.ts} +107 -46
- package/dist/{index-BM42r4yg.d.cts → index-b-AkfTUv.d.cts} +3 -2
- package/dist/index.cjs +102 -85
- package/dist/index.d.cts +14 -10
- package/dist/index.d.ts +14 -10
- package/dist/index.js +4 -3
- package/dist/rich-text/index.cjs +29 -0
- package/dist/rich-text/index.d.cts +148 -0
- package/dist/rich-text/index.d.ts +148 -0
- package/dist/rich-text/index.js +4 -0
- package/dist/rich-text.d-rKmpgdGd.d.cts +200 -0
- package/dist/rich-text.d-rKmpgdGd.d.ts +200 -0
- package/dist/schema/index.cjs +34 -38
- package/dist/schema/index.d.cts +84 -37
- package/dist/schema/index.d.ts +84 -37
- package/dist/schema/index.js +1 -1
- package/dist/types/index.d.cts +3 -2
- package/dist/types/index.d.ts +3 -2
- package/package.json +8 -2
- package/dist/.tsbuildinfo +0 -1
|
@@ -97,7 +97,6 @@ function defineSchema(config) {
|
|
|
97
97
|
_tag: "schema",
|
|
98
98
|
...config.locales !== void 0 && { locales: config.locales },
|
|
99
99
|
contentTypes: config.contentTypes,
|
|
100
|
-
components: config.components ?? {},
|
|
101
100
|
singletonContentTypes: config.singletonContentTypes ?? {},
|
|
102
101
|
queries: config.queries ?? {},
|
|
103
102
|
settingsGroups: config.settingsGroups,
|
|
@@ -111,30 +110,30 @@ chunkMWMSFIWN_cjs.__name(defineSchema, "defineSchema");
|
|
|
111
110
|
|
|
112
111
|
// src/schema/define-locale.ts
|
|
113
112
|
var BCP47_PATTERN = /^[a-z]{2}(-[A-Z]{2})?$/;
|
|
114
|
-
function defineLocale(
|
|
115
|
-
if (!BCP47_PATTERN.test(
|
|
113
|
+
function defineLocale(code2, options) {
|
|
114
|
+
if (!BCP47_PATTERN.test(code2)) {
|
|
116
115
|
throw new Error(
|
|
117
|
-
`Invalid locale code '${
|
|
116
|
+
`Invalid locale code '${code2}'. Expected BCP 47 format: 'xx' or 'xx-XX' (e.g., 'en', 'en-US', 'fr-FR')`
|
|
118
117
|
);
|
|
119
118
|
}
|
|
120
119
|
if (!options.displayName || options.displayName.trim().length === 0) {
|
|
121
|
-
throw new Error(`Locale '${
|
|
120
|
+
throw new Error(`Locale '${code2}' requires a displayName`);
|
|
122
121
|
}
|
|
123
122
|
if (options.fallback) {
|
|
124
123
|
for (const fallbackCode of options.fallback) {
|
|
125
124
|
if (typeof fallbackCode !== "string" || !BCP47_PATTERN.test(fallbackCode)) {
|
|
126
125
|
throw new Error(
|
|
127
|
-
`Invalid fallback locale code '${fallbackCode}' in locale '${
|
|
126
|
+
`Invalid fallback locale code '${fallbackCode}' in locale '${code2}'. Expected BCP 47 format.`
|
|
128
127
|
);
|
|
129
128
|
}
|
|
130
|
-
if (fallbackCode ===
|
|
131
|
-
throw new Error(`Locale '${
|
|
129
|
+
if (fallbackCode === code2) {
|
|
130
|
+
throw new Error(`Locale '${code2}' cannot reference itself in fallback chain`);
|
|
132
131
|
}
|
|
133
132
|
}
|
|
134
133
|
}
|
|
135
134
|
return {
|
|
136
135
|
_tag: "locale",
|
|
137
|
-
code,
|
|
136
|
+
code: code2,
|
|
138
137
|
displayName: options.displayName,
|
|
139
138
|
...options.default !== void 0 && { default: options.default },
|
|
140
139
|
...options.fallback !== void 0 && { fallback: options.fallback },
|
|
@@ -163,11 +162,11 @@ function buildFallbackChain(localeCode, locales, maxDepth = 10) {
|
|
|
163
162
|
const localeMap = new Map(locales.map((l) => [l.code, l]));
|
|
164
163
|
const chain = [];
|
|
165
164
|
const visited = /* @__PURE__ */ new Set();
|
|
166
|
-
function addFallbacks(
|
|
167
|
-
if (depth > maxDepth || visited.has(
|
|
168
|
-
const locale = localeMap.get(
|
|
165
|
+
function addFallbacks(code2, depth) {
|
|
166
|
+
if (depth > maxDepth || visited.has(code2)) return;
|
|
167
|
+
const locale = localeMap.get(code2);
|
|
169
168
|
if (!locale?.fallback) return;
|
|
170
|
-
visited.add(
|
|
169
|
+
visited.add(code2);
|
|
171
170
|
for (const fallbackCode of locale.fallback) {
|
|
172
171
|
if (!chain.includes(fallbackCode) && fallbackCode !== localeCode) {
|
|
173
172
|
chain.push(fallbackCode);
|
|
@@ -196,7 +195,7 @@ function fieldset(id, config) {
|
|
|
196
195
|
}
|
|
197
196
|
chunkMWMSFIWN_cjs.__name(fieldset, "fieldset");
|
|
198
197
|
function defineContentType(name, config) {
|
|
199
|
-
|
|
198
|
+
return {
|
|
200
199
|
_tag: "contentType",
|
|
201
200
|
name,
|
|
202
201
|
displayName: config.displayName,
|
|
@@ -208,21 +207,15 @@ function defineContentType(name, config) {
|
|
|
208
207
|
// definition from YAML and another from TypeScript, with a different schemaHash (REL-1458)
|
|
209
208
|
...config.hierarchical !== void 0 && { hierarchical: config.hierarchical },
|
|
210
209
|
...config.accessTags !== void 0 && { accessTags: config.accessTags },
|
|
211
|
-
...config.workflow !== void 0 && { workflow: config.workflow }
|
|
210
|
+
...config.workflow !== void 0 && { workflow: config.workflow },
|
|
211
|
+
fields: config.fields
|
|
212
212
|
};
|
|
213
|
-
if ("fields" in config && config.fields) {
|
|
214
|
-
return { ...base, fields: config.fields };
|
|
215
|
-
}
|
|
216
|
-
if ("fieldsets" in config && config.fieldsets) {
|
|
217
|
-
return { ...base, fieldsets: config.fieldsets };
|
|
218
|
-
}
|
|
219
|
-
throw new Error("Content type must have either fields or fieldsets");
|
|
220
213
|
}
|
|
221
214
|
chunkMWMSFIWN_cjs.__name(defineContentType, "defineContentType");
|
|
222
215
|
|
|
223
216
|
// src/schema/define-singleton.ts
|
|
224
217
|
function defineSingletonContentType(name, config) {
|
|
225
|
-
|
|
218
|
+
return {
|
|
226
219
|
_tag: "singletonContentType",
|
|
227
220
|
name,
|
|
228
221
|
displayName: config.displayName,
|
|
@@ -234,36 +227,13 @@ function defineSingletonContentType(name, config) {
|
|
|
234
227
|
...config.hierarchical !== void 0 && { hierarchical: config.hierarchical },
|
|
235
228
|
...config.accessTags !== void 0 && { accessTags: config.accessTags },
|
|
236
229
|
// Its config type took `workflow` and this dropped it, so a singleton's workflow never deployed
|
|
237
|
-
...config.workflow !== void 0 && { workflow: config.workflow }
|
|
230
|
+
...config.workflow !== void 0 && { workflow: config.workflow },
|
|
231
|
+
fields: config.fields
|
|
238
232
|
};
|
|
239
|
-
if ("fields" in config && config.fields) {
|
|
240
|
-
return { ...base, fields: config.fields };
|
|
241
|
-
}
|
|
242
|
-
if ("fieldsets" in config && config.fieldsets) {
|
|
243
|
-
return { ...base, fieldsets: config.fieldsets };
|
|
244
|
-
}
|
|
245
|
-
throw new Error("Singleton content type must have either fields or fieldsets");
|
|
246
233
|
}
|
|
247
234
|
chunkMWMSFIWN_cjs.__name(defineSingletonContentType, "defineSingletonContentType");
|
|
248
235
|
var defineSingleton = defineSingletonContentType;
|
|
249
236
|
|
|
250
|
-
// src/schema/define-component.ts
|
|
251
|
-
function defineComponent(name, config) {
|
|
252
|
-
return {
|
|
253
|
-
_tag: "component",
|
|
254
|
-
name,
|
|
255
|
-
displayName: config.displayName,
|
|
256
|
-
description: config.description,
|
|
257
|
-
ai: config.ai,
|
|
258
|
-
// Written only when given: `false` whenever not made a YAML and a TypeScript component two
|
|
259
|
-
// definitions (REL-1458)
|
|
260
|
-
...config.deprecated !== void 0 && { deprecated: config.deprecated },
|
|
261
|
-
fields: config.fields,
|
|
262
|
-
metadata: config.metadata
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
chunkMWMSFIWN_cjs.__name(defineComponent, "defineComponent");
|
|
266
|
-
|
|
267
237
|
// src/schema/define-settings-group.ts
|
|
268
238
|
function defineSettingsGroup(name, config) {
|
|
269
239
|
return {
|
|
@@ -289,7 +259,7 @@ function defineAssetType(name, config) {
|
|
|
289
259
|
`Asset type '${name}' declares multiple kind keys (${kindKeys.join(", ")}); exactly one is allowed`
|
|
290
260
|
);
|
|
291
261
|
}
|
|
292
|
-
|
|
262
|
+
return {
|
|
293
263
|
_tag: "assetType",
|
|
294
264
|
name,
|
|
295
265
|
displayName: config.displayName,
|
|
@@ -302,15 +272,9 @@ function defineAssetType(name, config) {
|
|
|
302
272
|
...config.workflow !== void 0 && { workflow: config.workflow },
|
|
303
273
|
...config.image !== void 0 && { image: config.image },
|
|
304
274
|
...config.video !== void 0 && { video: config.video },
|
|
305
|
-
...config.file !== void 0 && { file: config.file }
|
|
275
|
+
...config.file !== void 0 && { file: config.file },
|
|
276
|
+
...config.fields !== void 0 && { fields: config.fields }
|
|
306
277
|
};
|
|
307
|
-
if ("fields" in config && config.fields) {
|
|
308
|
-
return { ...base, fields: config.fields };
|
|
309
|
-
}
|
|
310
|
-
if ("fieldsets" in config && config.fieldsets) {
|
|
311
|
-
return { ...base, fieldsets: config.fieldsets };
|
|
312
|
-
}
|
|
313
|
-
return base;
|
|
314
278
|
}
|
|
315
279
|
chunkMWMSFIWN_cjs.__name(defineAssetType, "defineAssetType");
|
|
316
280
|
|
|
@@ -589,7 +553,7 @@ chunkMWMSFIWN_cjs.__name(defineQuery, "defineQuery");
|
|
|
589
553
|
var fields_exports = {};
|
|
590
554
|
chunkMWMSFIWN_cjs.__export(fields_exports, {
|
|
591
555
|
boolean: () => boolean,
|
|
592
|
-
|
|
556
|
+
code: () => code,
|
|
593
557
|
date: () => date,
|
|
594
558
|
dateTime: () => dateTime,
|
|
595
559
|
decimal: () => decimal,
|
|
@@ -598,10 +562,12 @@ chunkMWMSFIWN_cjs.__export(fields_exports, {
|
|
|
598
562
|
integer: () => integer,
|
|
599
563
|
list: () => list,
|
|
600
564
|
longText: () => longText,
|
|
565
|
+
object: () => object,
|
|
601
566
|
reference: () => reference,
|
|
602
567
|
richText: () => richText,
|
|
603
568
|
shortText: () => shortText,
|
|
604
569
|
slug: () => slug,
|
|
570
|
+
table: () => table,
|
|
605
571
|
tags: () => tags,
|
|
606
572
|
url: () => url
|
|
607
573
|
});
|
|
@@ -634,6 +600,14 @@ function richText(id, options = {}) {
|
|
|
634
600
|
return createField(id, "richText", options);
|
|
635
601
|
}
|
|
636
602
|
chunkMWMSFIWN_cjs.__name(richText, "richText");
|
|
603
|
+
function table(id, options = {}) {
|
|
604
|
+
return createField(id, "table", options);
|
|
605
|
+
}
|
|
606
|
+
chunkMWMSFIWN_cjs.__name(table, "table");
|
|
607
|
+
function code(id, options = {}) {
|
|
608
|
+
return createField(id, "code", options);
|
|
609
|
+
}
|
|
610
|
+
chunkMWMSFIWN_cjs.__name(code, "code");
|
|
637
611
|
function slug(id, options = {}) {
|
|
638
612
|
return createField(id, "slug", options);
|
|
639
613
|
}
|
|
@@ -682,11 +656,10 @@ function list(id, options = {}) {
|
|
|
682
656
|
return createField(id, "list", options);
|
|
683
657
|
}
|
|
684
658
|
chunkMWMSFIWN_cjs.__name(list, "list");
|
|
685
|
-
function
|
|
686
|
-
|
|
687
|
-
return createField(id, type, options);
|
|
659
|
+
function object(id, options) {
|
|
660
|
+
return createField(id, "object", options);
|
|
688
661
|
}
|
|
689
|
-
chunkMWMSFIWN_cjs.__name(
|
|
662
|
+
chunkMWMSFIWN_cjs.__name(object, "object");
|
|
690
663
|
|
|
691
664
|
// src/schema/index.ts
|
|
692
665
|
var fields = fields_exports;
|
|
@@ -696,7 +669,6 @@ exports.BUILT_IN_ROLE_ACTIONS = BUILT_IN_ROLE_ACTIONS;
|
|
|
696
669
|
exports.ROLE_ACTIONS = ROLE_ACTIONS;
|
|
697
670
|
exports.buildFallbackChain = buildFallbackChain;
|
|
698
671
|
exports.defineAssetType = defineAssetType;
|
|
699
|
-
exports.defineComponent = defineComponent;
|
|
700
672
|
exports.defineContentType = defineContentType;
|
|
701
673
|
exports.defineContentTypeWorkflow = defineContentTypeWorkflow;
|
|
702
674
|
exports.defineLocale = defineLocale;
|
|
@@ -725,5 +697,5 @@ exports.isLocaleDefinition = isLocaleDefinition;
|
|
|
725
697
|
exports.isRoleDefinition = isRoleDefinition;
|
|
726
698
|
exports.isWorkflowDefinition = isWorkflowDefinition;
|
|
727
699
|
exports.isWorkflowStageDefinition = isWorkflowStageDefinition;
|
|
728
|
-
//# sourceMappingURL=chunk-
|
|
729
|
-
//# sourceMappingURL=chunk-
|
|
700
|
+
//# sourceMappingURL=chunk-3MSFWXQL.cjs.map
|
|
701
|
+
//# sourceMappingURL=chunk-3MSFWXQL.cjs.map
|
|
@@ -1683,10 +1683,18 @@ var _ContentQueryBuilder = class _ContentQueryBuilder {
|
|
|
1683
1683
|
return this;
|
|
1684
1684
|
}
|
|
1685
1685
|
/**
|
|
1686
|
-
*
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1686
|
+
* Expand references into the entries they point at: one include path per element (REL-1801).
|
|
1687
|
+
* A path names fields through lists, page builders, objects and references —
|
|
1688
|
+
* `'sections.features'`, `'sections.customers.logo'` — and may pick the fields each entry returns,
|
|
1689
|
+
* `'sections.features(name,slug)'`. Each is checked against the schema: a path that holds no
|
|
1690
|
+
* reference does not compile, and the read's type follows the paths — an expanded reference is the
|
|
1691
|
+
* entry, every other one its id.
|
|
1692
|
+
*/
|
|
1693
|
+
include(paths) {
|
|
1694
|
+
this.queryOptions.include = [
|
|
1695
|
+
...this.queryOptions.include ?? [],
|
|
1696
|
+
...paths
|
|
1697
|
+
];
|
|
1690
1698
|
return this;
|
|
1691
1699
|
}
|
|
1692
1700
|
sort(fieldOrOptions, direction) {
|
|
@@ -2071,10 +2079,15 @@ var _ContentByIdBuilder = class _ContentByIdBuilder {
|
|
|
2071
2079
|
return this;
|
|
2072
2080
|
}
|
|
2073
2081
|
/**
|
|
2074
|
-
*
|
|
2082
|
+
* Expand references into the entries they point at: one include path per element (REL-1801).
|
|
2083
|
+
* A path names fields through lists, page builders, objects and references —
|
|
2084
|
+
* `'sections.features'`, `'sections.customers.logo'` — and may pick the fields each entry returns,
|
|
2085
|
+
* `'sections.features(name,slug)'`. Each is checked against the schema: a path that holds no
|
|
2086
|
+
* reference does not compile, and the read's type follows the paths — an expanded reference is the
|
|
2087
|
+
* entry, every other one its id. A second call adds to the first.
|
|
2075
2088
|
*/
|
|
2076
|
-
include(
|
|
2077
|
-
this.includeRelations =
|
|
2089
|
+
include(paths) {
|
|
2090
|
+
this.includeRelations = [...this.includeRelations ?? [], ...paths];
|
|
2078
2091
|
return this;
|
|
2079
2092
|
}
|
|
2080
2093
|
/**
|
|
@@ -2248,9 +2261,6 @@ var _ContentClient = class _ContentClient {
|
|
|
2248
2261
|
}
|
|
2249
2262
|
return builder.execute();
|
|
2250
2263
|
}
|
|
2251
|
-
/**
|
|
2252
|
-
* Fetch content with query options
|
|
2253
|
-
*/
|
|
2254
2264
|
async fetch(options) {
|
|
2255
2265
|
const builder = this.query();
|
|
2256
2266
|
if (options?.where) {
|
|
@@ -2266,7 +2276,7 @@ var _ContentClient = class _ContentClient {
|
|
|
2266
2276
|
builder.sort(options.sort);
|
|
2267
2277
|
}
|
|
2268
2278
|
if (options?.include) {
|
|
2269
|
-
builder.include(options.include);
|
|
2279
|
+
builder.include([...options.include]);
|
|
2270
2280
|
}
|
|
2271
2281
|
if (options?.locale != null && options.locale !== "") {
|
|
2272
2282
|
builder.locale(options.locale);
|
|
@@ -2279,16 +2289,10 @@ var _ContentClient = class _ContentClient {
|
|
|
2279
2289
|
}
|
|
2280
2290
|
return builder.execute();
|
|
2281
2291
|
}
|
|
2282
|
-
/**
|
|
2283
|
-
* Fetch a single content item by ID
|
|
2284
|
-
* @param id - Entry ID or slug
|
|
2285
|
-
* @param options - Fetch options (include, locale, and `headers` this one request adds — e.g.
|
|
2286
|
-
* `{ 'X-RelyIO-Dataset': 'staging' }` to read a dataset other than the client's)
|
|
2287
|
-
*/
|
|
2288
2292
|
async fetchOne(id, options) {
|
|
2289
2293
|
const builder = this.findById(id);
|
|
2290
2294
|
if (options?.include != null) {
|
|
2291
|
-
builder.include(options.include);
|
|
2295
|
+
builder.include([...options.include]);
|
|
2292
2296
|
}
|
|
2293
2297
|
if (options?.locale != null && options.locale !== "") {
|
|
2294
2298
|
builder.locale(options.locale);
|
|
@@ -2298,27 +2302,11 @@ var _ContentClient = class _ContentClient {
|
|
|
2298
2302
|
}
|
|
2299
2303
|
return builder.execute();
|
|
2300
2304
|
}
|
|
2301
|
-
/**
|
|
2302
|
-
* Fetch one entry **and the entity tag that read served**.
|
|
2303
|
-
*
|
|
2304
|
-
* This is the read half of a conditional write. `X-Entity-Tag` is minted from
|
|
2305
|
-
* `(entryUid, locale, localeVersion)` and is exactly what `If-Match` takes,
|
|
2306
|
-
* so a caller reads here, edits, and hands the same string back to `update`
|
|
2307
|
-
* — with nothing to assemble in between
|
|
2308
|
-
* (`INV-API-CONDITIONAL-WRITE-IS-REACHABLE`).
|
|
2309
|
-
*
|
|
2310
|
-
* `entityTag` is `undefined` when the response came from the cache: a cached
|
|
2311
|
-
* body cannot know the current version, and an absent tag beats a stale one
|
|
2312
|
-
* that would refuse the next write.
|
|
2313
|
-
*
|
|
2314
|
-
* Unlike {@link fetchOne}, a missing entry is not `null`: the service's
|
|
2315
|
-
* `RESOURCE_NOT_FOUND` is thrown as it arrived, with the `kind` that says
|
|
2316
|
-
* whether the entry, the content type or the schema was missing. `headers`
|
|
2317
|
-
* are the ones this read adds, as for `fetchOne`.
|
|
2318
|
-
*/
|
|
2319
2305
|
async fetchOneWithTag(id, options) {
|
|
2320
2306
|
const query = {};
|
|
2321
|
-
if (options?.include != null)
|
|
2307
|
+
if (options?.include != null) {
|
|
2308
|
+
query.include = options.include.join(",");
|
|
2309
|
+
}
|
|
2322
2310
|
const locale = options?.locale ?? this.clientLocale();
|
|
2323
2311
|
if (locale != null && locale !== "") query.locale = locale;
|
|
2324
2312
|
const response = await this.httpClient.send(
|
|
@@ -3181,10 +3169,9 @@ var _AssetClient = class _AssetClient {
|
|
|
3181
3169
|
this.clientLocale
|
|
3182
3170
|
);
|
|
3183
3171
|
}
|
|
3184
|
-
/** Fetch a single asset entry by id (or slug), or `null` if not found. */
|
|
3185
3172
|
async fetchOne(id, options) {
|
|
3186
3173
|
const builder = this.findById(id);
|
|
3187
|
-
if (options?.include != null) builder.include(options.include);
|
|
3174
|
+
if (options?.include != null) builder.include([...options.include]);
|
|
3188
3175
|
if (options?.locale != null && options.locale !== "") builder.locale(options.locale);
|
|
3189
3176
|
return builder.execute();
|
|
3190
3177
|
}
|
|
@@ -3287,11 +3274,15 @@ var _SingletonClient = class _SingletonClient {
|
|
|
3287
3274
|
this.clientLocale = readClientLocale(locale);
|
|
3288
3275
|
}
|
|
3289
3276
|
/**
|
|
3290
|
-
*
|
|
3291
|
-
*
|
|
3277
|
+
* Expand references into the entries they point at: one include path per element (REL-1801).
|
|
3278
|
+
* A path names fields through lists, objects and references — `'hero.media.image'`,
|
|
3279
|
+
* `'featured.author'` — and may pick the fields each entry returns, `'featured(title,slug)'`.
|
|
3280
|
+
* Each is checked against the schema: a path that holds no reference does not compile, and the
|
|
3281
|
+
* read's type follows the paths — an expanded reference is the entry, every other one its id. A
|
|
3282
|
+
* second call adds to the first.
|
|
3292
3283
|
*/
|
|
3293
|
-
include(
|
|
3294
|
-
this.includeFields =
|
|
3284
|
+
include(paths) {
|
|
3285
|
+
this.includeFields = [...this.includeFields ?? [], ...paths];
|
|
3295
3286
|
return this;
|
|
3296
3287
|
}
|
|
3297
3288
|
/**
|
|
@@ -3302,10 +3293,6 @@ var _SingletonClient = class _SingletonClient {
|
|
|
3302
3293
|
this.localeValue = locale;
|
|
3303
3294
|
return this;
|
|
3304
3295
|
}
|
|
3305
|
-
/**
|
|
3306
|
-
* Fetch the singleton content
|
|
3307
|
-
* @param options - Optional fetch options (alternative to fluent methods)
|
|
3308
|
-
*/
|
|
3309
3296
|
async fetch(options) {
|
|
3310
3297
|
try {
|
|
3311
3298
|
return (await this.fetchWithTag(options)).content;
|
|
@@ -3323,7 +3310,7 @@ var _SingletonClient = class _SingletonClient {
|
|
|
3323
3310
|
*/
|
|
3324
3311
|
async fetchWithTag(options) {
|
|
3325
3312
|
const query = {};
|
|
3326
|
-
const includeValue = options?.include
|
|
3313
|
+
const includeValue = this.includeFields === void 0 && options?.include === void 0 ? void 0 : [...this.includeFields ?? [], ...options?.include ?? []];
|
|
3327
3314
|
const localeValueFinal = options?.locale ?? this.localeValue ?? this.clientLocale();
|
|
3328
3315
|
if (includeValue) query.include = includeValue.join(",");
|
|
3329
3316
|
if (localeValueFinal != null && localeValueFinal !== "") query.locale = localeValueFinal;
|
|
@@ -3444,11 +3431,15 @@ var _SettingsClient = class _SettingsClient {
|
|
|
3444
3431
|
this.clientLocale = readClientLocale(locale);
|
|
3445
3432
|
}
|
|
3446
3433
|
/**
|
|
3447
|
-
*
|
|
3448
|
-
*
|
|
3434
|
+
* Expand references into the entries they point at: one include path per element (REL-1801).
|
|
3435
|
+
* A path names fields through lists, objects and references — `'hero.media.image'`,
|
|
3436
|
+
* `'featured.author'` — and may pick the fields each entry returns, `'featured(title,slug)'`.
|
|
3437
|
+
* Each is checked against the schema: a path that holds no reference does not compile, and the
|
|
3438
|
+
* read's type follows the paths — an expanded reference is the entry, every other one its id. A
|
|
3439
|
+
* second call adds to the first.
|
|
3449
3440
|
*/
|
|
3450
|
-
include(
|
|
3451
|
-
this.includeFields =
|
|
3441
|
+
include(paths) {
|
|
3442
|
+
this.includeFields = [...this.includeFields ?? [], ...paths];
|
|
3452
3443
|
return this;
|
|
3453
3444
|
}
|
|
3454
3445
|
/**
|
|
@@ -3459,10 +3450,6 @@ var _SettingsClient = class _SettingsClient {
|
|
|
3459
3450
|
this.localeValue = locale;
|
|
3460
3451
|
return this;
|
|
3461
3452
|
}
|
|
3462
|
-
/**
|
|
3463
|
-
* Fetch the settings group
|
|
3464
|
-
* @param options - Optional fetch options (alternative to fluent methods)
|
|
3465
|
-
*/
|
|
3466
3453
|
async fetch(options) {
|
|
3467
3454
|
try {
|
|
3468
3455
|
return (await this.fetchWithTag(options)).settings;
|
|
@@ -3500,7 +3487,7 @@ var _SettingsClient = class _SettingsClient {
|
|
|
3500
3487
|
*/
|
|
3501
3488
|
async fetchWithTag(options) {
|
|
3502
3489
|
const query = {};
|
|
3503
|
-
const includeValue = options?.include
|
|
3490
|
+
const includeValue = this.includeFields === void 0 && options?.include === void 0 ? void 0 : [...this.includeFields ?? [], ...options?.include ?? []];
|
|
3504
3491
|
const localeValueFinal = options?.locale ?? this.localeValue ?? this.clientLocale();
|
|
3505
3492
|
if (includeValue) query.include = includeValue.join(",");
|
|
3506
3493
|
if (localeValueFinal != null && localeValueFinal !== "") query.locale = localeValueFinal;
|
|
@@ -6346,5 +6333,5 @@ exports.matchRoute = matchRoute;
|
|
|
6346
6333
|
exports.serviceInstructedDelayMs = serviceInstructedDelayMs;
|
|
6347
6334
|
exports.sleep = sleep;
|
|
6348
6335
|
exports.validateFile = validateFile;
|
|
6349
|
-
//# sourceMappingURL=chunk-
|
|
6350
|
-
//# sourceMappingURL=chunk-
|
|
6336
|
+
//# sourceMappingURL=chunk-DXCVO6M5.cjs.map
|
|
6337
|
+
//# sourceMappingURL=chunk-DXCVO6M5.cjs.map
|