@relyio/sdk 0.11.0 → 0.13.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 +172 -0
- package/dist/chunk-3NPPMGB6.js +1092 -0
- package/dist/{chunk-7GLDVHIH.js → chunk-6NGJXLOR.js} +65 -67
- package/dist/{chunk-4HTIU5YE.cjs → chunk-DEDIJKHY.cjs} +65 -67
- package/dist/{chunk-2TIJLV2X.js → chunk-EW23SZPX.js} +43 -65
- package/dist/{chunk-PO7CUR5U.cjs → chunk-FOSM4LMM.cjs} +42 -65
- package/dist/chunk-Z6GLWSSD.cjs +1106 -0
- package/dist/client/index.cjs +3 -3
- package/dist/client/index.d.cts +4 -4
- package/dist/client/index.d.ts +4 -4
- package/dist/client/index.js +1 -1
- package/dist/{define-schema-CVi8nwc7.d.ts → define-schema-UHViXKiv.d.ts} +33 -435
- package/dist/{define-schema-DqpipEHv.d.cts → define-schema-sWJ8Zn7C.d.cts} +33 -435
- package/dist/{define-content-type-ENAod5Ve.d.cts → include-paths-Bs5FhNw2.d.cts} +3505 -483
- package/dist/{define-content-type-ENAod5Ve.d.ts → include-paths-Cb7iPCW2.d.ts} +3505 -483
- package/dist/index--_u1nPHv.d.cts +507 -0
- package/dist/index-8DozAWsA.d.ts +507 -0
- package/dist/{index-MLAFUuco.d.cts → index-BT0L8xJj.d.cts} +139 -90
- package/dist/{index-BKEAYvvz.d.ts → index-CPjJ25R4.d.ts} +139 -90
- package/dist/index.cjs +134 -110
- package/dist/index.d.cts +44 -71
- package/dist/index.d.ts +44 -71
- package/dist/index.js +5 -28
- package/dist/markdown/index.cjs +13750 -0
- package/dist/markdown/index.d.cts +111 -0
- package/dist/markdown/index.d.ts +111 -0
- package/dist/markdown/index.js +13742 -0
- package/dist/rich-text/index.cjs +49 -0
- package/dist/rich-text/index.d.cts +3 -0
- package/dist/rich-text/index.d.ts +3 -0
- package/dist/rich-text/index.js +4 -0
- package/dist/rich-text.d-BWc-5gX1.d.cts +326 -0
- package/dist/rich-text.d-BWc-5gX1.d.ts +326 -0
- package/dist/schema/index.cjs +34 -38
- package/dist/schema/index.d.cts +15 -137
- package/dist/schema/index.d.ts +15 -137
- package/dist/schema/index.js +1 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/package.json +19 -2
- package/dist/.tsbuildinfo +0 -1
- package/dist/index-BM42r4yg.d.cts +0 -860
- package/dist/index-C73cK2Tt.d.ts +0 -860
|
@@ -1662,13 +1662,19 @@ var _ContentQueryBuilder = class _ContentQueryBuilder {
|
|
|
1662
1662
|
return this;
|
|
1663
1663
|
}
|
|
1664
1664
|
/**
|
|
1665
|
-
* Add where conditions to the query
|
|
1666
|
-
*
|
|
1665
|
+
* Add where conditions to the query, each naming a value by its path: a field the content type
|
|
1666
|
+
* declares, a field inside an object (`'pricing.basePrice'`), a reference inside its blocks —
|
|
1667
|
+
* `{ 'sections.features': featureId }` keeps the entries some block of which holds that feature
|
|
1668
|
+
* (REL-1810) — and rich text that can point at an entry, by the entries it points at. A typed read
|
|
1669
|
+
* takes exactly the paths the API filters by (`FilterPaths`, REL-2136). A condition on `_metadata`
|
|
1670
|
+
* is refused here, before anything is sent (`refuseMetadataConditions`).
|
|
1667
1671
|
*/
|
|
1668
1672
|
where(conditions) {
|
|
1669
1673
|
refuseMetadataConditions(conditions);
|
|
1670
1674
|
this.queryOptions.where = {
|
|
1671
1675
|
...this.queryOptions.where,
|
|
1676
|
+
// Sent as written: a path into an object or a block, or a rich-text field's condition, rides
|
|
1677
|
+
// beside the fields', which `QueryOptions` types by the record's own keys alone
|
|
1672
1678
|
...conditions
|
|
1673
1679
|
};
|
|
1674
1680
|
return this;
|
|
@@ -1681,10 +1687,18 @@ var _ContentQueryBuilder = class _ContentQueryBuilder {
|
|
|
1681
1687
|
return this;
|
|
1682
1688
|
}
|
|
1683
1689
|
/**
|
|
1684
|
-
*
|
|
1690
|
+
* Expand references into the entries they point at: one include path per element (REL-1801).
|
|
1691
|
+
* A path names fields through lists, page builders, objects and references —
|
|
1692
|
+
* `'sections.features'`, `'sections.customers.logo'` — and may pick the fields each entry returns,
|
|
1693
|
+
* `'sections.features(name,slug)'`. Each is checked against the schema: a path that holds no
|
|
1694
|
+
* reference does not compile, and the read's type follows the paths — an expanded reference is the
|
|
1695
|
+
* entry, every other one its id.
|
|
1685
1696
|
*/
|
|
1686
|
-
include(
|
|
1687
|
-
this.queryOptions.include = [
|
|
1697
|
+
include(paths) {
|
|
1698
|
+
this.queryOptions.include = [
|
|
1699
|
+
...this.queryOptions.include ?? [],
|
|
1700
|
+
...paths
|
|
1701
|
+
];
|
|
1688
1702
|
return this;
|
|
1689
1703
|
}
|
|
1690
1704
|
sort(fieldOrOptions, direction) {
|
|
@@ -2069,10 +2083,15 @@ var _ContentByIdBuilder = class _ContentByIdBuilder {
|
|
|
2069
2083
|
return this;
|
|
2070
2084
|
}
|
|
2071
2085
|
/**
|
|
2072
|
-
*
|
|
2086
|
+
* Expand references into the entries they point at: one include path per element (REL-1801).
|
|
2087
|
+
* A path names fields through lists, page builders, objects and references —
|
|
2088
|
+
* `'sections.features'`, `'sections.customers.logo'` — and may pick the fields each entry returns,
|
|
2089
|
+
* `'sections.features(name,slug)'`. Each is checked against the schema: a path that holds no
|
|
2090
|
+
* reference does not compile, and the read's type follows the paths — an expanded reference is the
|
|
2091
|
+
* entry, every other one its id. A second call adds to the first.
|
|
2073
2092
|
*/
|
|
2074
|
-
include(
|
|
2075
|
-
this.includeRelations =
|
|
2093
|
+
include(paths) {
|
|
2094
|
+
this.includeRelations = [...this.includeRelations ?? [], ...paths];
|
|
2076
2095
|
return this;
|
|
2077
2096
|
}
|
|
2078
2097
|
/**
|
|
@@ -2246,14 +2265,12 @@ var _ContentClient = class _ContentClient {
|
|
|
2246
2265
|
}
|
|
2247
2266
|
return builder.execute();
|
|
2248
2267
|
}
|
|
2249
|
-
/**
|
|
2250
|
-
* Fetch content with query options
|
|
2251
|
-
*/
|
|
2252
2268
|
async fetch(options) {
|
|
2253
|
-
const
|
|
2269
|
+
const query = this.query();
|
|
2254
2270
|
if (options?.where) {
|
|
2255
|
-
|
|
2271
|
+
query.where(options.where);
|
|
2256
2272
|
}
|
|
2273
|
+
const builder = query;
|
|
2257
2274
|
if (options?.limit != null) {
|
|
2258
2275
|
builder.limit(options.limit);
|
|
2259
2276
|
}
|
|
@@ -2264,7 +2281,7 @@ var _ContentClient = class _ContentClient {
|
|
|
2264
2281
|
builder.sort(options.sort);
|
|
2265
2282
|
}
|
|
2266
2283
|
if (options?.include) {
|
|
2267
|
-
builder.include(options.include);
|
|
2284
|
+
builder.include([...options.include]);
|
|
2268
2285
|
}
|
|
2269
2286
|
if (options?.locale != null && options.locale !== "") {
|
|
2270
2287
|
builder.locale(options.locale);
|
|
@@ -2277,16 +2294,10 @@ var _ContentClient = class _ContentClient {
|
|
|
2277
2294
|
}
|
|
2278
2295
|
return builder.execute();
|
|
2279
2296
|
}
|
|
2280
|
-
/**
|
|
2281
|
-
* Fetch a single content item by ID
|
|
2282
|
-
* @param id - Entry ID or slug
|
|
2283
|
-
* @param options - Fetch options (include, locale, and `headers` this one request adds — e.g.
|
|
2284
|
-
* `{ 'X-RelyIO-Dataset': 'staging' }` to read a dataset other than the client's)
|
|
2285
|
-
*/
|
|
2286
2297
|
async fetchOne(id, options) {
|
|
2287
2298
|
const builder = this.findById(id);
|
|
2288
2299
|
if (options?.include != null) {
|
|
2289
|
-
builder.include(options.include);
|
|
2300
|
+
builder.include([...options.include]);
|
|
2290
2301
|
}
|
|
2291
2302
|
if (options?.locale != null && options.locale !== "") {
|
|
2292
2303
|
builder.locale(options.locale);
|
|
@@ -2296,27 +2307,11 @@ var _ContentClient = class _ContentClient {
|
|
|
2296
2307
|
}
|
|
2297
2308
|
return builder.execute();
|
|
2298
2309
|
}
|
|
2299
|
-
/**
|
|
2300
|
-
* Fetch one entry **and the entity tag that read served**.
|
|
2301
|
-
*
|
|
2302
|
-
* This is the read half of a conditional write. `X-Entity-Tag` is minted from
|
|
2303
|
-
* `(entryUid, locale, localeVersion)` and is exactly what `If-Match` takes,
|
|
2304
|
-
* so a caller reads here, edits, and hands the same string back to `update`
|
|
2305
|
-
* — with nothing to assemble in between
|
|
2306
|
-
* (`INV-API-CONDITIONAL-WRITE-IS-REACHABLE`).
|
|
2307
|
-
*
|
|
2308
|
-
* `entityTag` is `undefined` when the response came from the cache: a cached
|
|
2309
|
-
* body cannot know the current version, and an absent tag beats a stale one
|
|
2310
|
-
* that would refuse the next write.
|
|
2311
|
-
*
|
|
2312
|
-
* Unlike {@link fetchOne}, a missing entry is not `null`: the service's
|
|
2313
|
-
* `RESOURCE_NOT_FOUND` is thrown as it arrived, with the `kind` that says
|
|
2314
|
-
* whether the entry, the content type or the schema was missing. `headers`
|
|
2315
|
-
* are the ones this read adds, as for `fetchOne`.
|
|
2316
|
-
*/
|
|
2317
2310
|
async fetchOneWithTag(id, options) {
|
|
2318
2311
|
const query = {};
|
|
2319
|
-
if (options?.include != null)
|
|
2312
|
+
if (options?.include != null) {
|
|
2313
|
+
query.include = options.include.join(",");
|
|
2314
|
+
}
|
|
2320
2315
|
const locale = options?.locale ?? this.clientLocale();
|
|
2321
2316
|
if (locale != null && locale !== "") query.locale = locale;
|
|
2322
2317
|
const response = await this.httpClient.send(
|
|
@@ -2370,6 +2365,8 @@ var _ContentClient = class _ContentClient {
|
|
|
2370
2365
|
* request adds, as for {@link create}. `ifMatch` and `idempotencyKey` win over the same
|
|
2371
2366
|
* header among them. `locale` defaults to the client's own, the locale whose entity tag
|
|
2372
2367
|
* {@link fetchOneWithTag} reads, so the tag it hands back is checked against the same locale.
|
|
2368
|
+
* @returns The entry, its `_metadata.brokenLinks` naming each entry link another entry publishes
|
|
2369
|
+
* that this revision left pointing nowhere — empty when it took no heading away.
|
|
2373
2370
|
*/
|
|
2374
2371
|
async update(id, data, options) {
|
|
2375
2372
|
const { idempotencyKey, ifMatch, headers, locale, ...body } = options ?? {};
|
|
@@ -2453,6 +2450,9 @@ var _ContentClient = class _ContentClient {
|
|
|
2453
2450
|
* The restore is validated as strictly as a publish, so it cannot publish invalid content, and it
|
|
2454
2451
|
* records a new version of its own rather than rewinding the counter — so the revert is auditable
|
|
2455
2452
|
* and itself reversible.
|
|
2453
|
+
*
|
|
2454
|
+
* @returns The entry, its `_metadata.leftOut` naming each value of the version the active schema
|
|
2455
|
+
* no longer declares, and `_metadata.brokenLinks` the entry links it left pointing nowhere.
|
|
2456
2456
|
*/
|
|
2457
2457
|
async restore(id, versionNumber, locale, options) {
|
|
2458
2458
|
return this.httpClient.fetchPayload("/v1/{contentType}/{id}/versions/{versionNumber}/restore", "post", {
|
|
@@ -2466,15 +2466,14 @@ var _ContentClient = class _ContentClient {
|
|
|
2466
2466
|
});
|
|
2467
2467
|
}
|
|
2468
2468
|
/**
|
|
2469
|
-
* Get children of a hierarchical entry
|
|
2469
|
+
* Get the direct children of a hierarchical entry. The route lists one level and takes no depth
|
|
2470
|
+
* (REL-2195): `{ depth }` was sent as `?depth=`, which the API refused with `400`. A tree nested
|
|
2471
|
+
* under each entry is a list or entry read's `query().children()`.
|
|
2470
2472
|
* @param id - Parent entry ID
|
|
2471
|
-
* @param options -
|
|
2473
|
+
* @param options - Include paths to expand on each child, and the locale to read
|
|
2472
2474
|
*/
|
|
2473
2475
|
async children(id, options) {
|
|
2474
2476
|
const params = {};
|
|
2475
|
-
if (options?.depth != null) {
|
|
2476
|
-
params.depth = options.depth;
|
|
2477
|
-
}
|
|
2478
2477
|
if (options?.include != null) {
|
|
2479
2478
|
params.include = options.include.join(",");
|
|
2480
2479
|
}
|
|
@@ -3179,10 +3178,9 @@ var _AssetClient = class _AssetClient {
|
|
|
3179
3178
|
this.clientLocale
|
|
3180
3179
|
);
|
|
3181
3180
|
}
|
|
3182
|
-
/** Fetch a single asset entry by id (or slug), or `null` if not found. */
|
|
3183
3181
|
async fetchOne(id, options) {
|
|
3184
3182
|
const builder = this.findById(id);
|
|
3185
|
-
if (options?.include != null) builder.include(options.include);
|
|
3183
|
+
if (options?.include != null) builder.include([...options.include]);
|
|
3186
3184
|
if (options?.locale != null && options.locale !== "") builder.locale(options.locale);
|
|
3187
3185
|
return builder.execute();
|
|
3188
3186
|
}
|
|
@@ -3285,11 +3283,15 @@ var _SingletonClient = class _SingletonClient {
|
|
|
3285
3283
|
this.clientLocale = readClientLocale(locale);
|
|
3286
3284
|
}
|
|
3287
3285
|
/**
|
|
3288
|
-
*
|
|
3289
|
-
*
|
|
3286
|
+
* Expand references into the entries they point at: one include path per element (REL-1801).
|
|
3287
|
+
* A path names fields through lists, objects and references — `'hero.media.image'`,
|
|
3288
|
+
* `'featured.author'` — and may pick the fields each entry returns, `'featured(title,slug)'`.
|
|
3289
|
+
* Each is checked against the schema: a path that holds no reference does not compile, and the
|
|
3290
|
+
* read's type follows the paths — an expanded reference is the entry, every other one its id. A
|
|
3291
|
+
* second call adds to the first.
|
|
3290
3292
|
*/
|
|
3291
|
-
include(
|
|
3292
|
-
this.includeFields =
|
|
3293
|
+
include(paths) {
|
|
3294
|
+
this.includeFields = [...this.includeFields ?? [], ...paths];
|
|
3293
3295
|
return this;
|
|
3294
3296
|
}
|
|
3295
3297
|
/**
|
|
@@ -3300,10 +3302,6 @@ var _SingletonClient = class _SingletonClient {
|
|
|
3300
3302
|
this.localeValue = locale;
|
|
3301
3303
|
return this;
|
|
3302
3304
|
}
|
|
3303
|
-
/**
|
|
3304
|
-
* Fetch the singleton content
|
|
3305
|
-
* @param options - Optional fetch options (alternative to fluent methods)
|
|
3306
|
-
*/
|
|
3307
3305
|
async fetch(options) {
|
|
3308
3306
|
try {
|
|
3309
3307
|
return (await this.fetchWithTag(options)).content;
|
|
@@ -3321,7 +3319,7 @@ var _SingletonClient = class _SingletonClient {
|
|
|
3321
3319
|
*/
|
|
3322
3320
|
async fetchWithTag(options) {
|
|
3323
3321
|
const query = {};
|
|
3324
|
-
const includeValue = options?.include
|
|
3322
|
+
const includeValue = this.includeFields === void 0 && options?.include === void 0 ? void 0 : [...this.includeFields ?? [], ...options?.include ?? []];
|
|
3325
3323
|
const localeValueFinal = options?.locale ?? this.localeValue ?? this.clientLocale();
|
|
3326
3324
|
if (includeValue) query.include = includeValue.join(",");
|
|
3327
3325
|
if (localeValueFinal != null && localeValueFinal !== "") query.locale = localeValueFinal;
|
|
@@ -3442,11 +3440,15 @@ var _SettingsClient = class _SettingsClient {
|
|
|
3442
3440
|
this.clientLocale = readClientLocale(locale);
|
|
3443
3441
|
}
|
|
3444
3442
|
/**
|
|
3445
|
-
*
|
|
3446
|
-
*
|
|
3443
|
+
* Expand references into the entries they point at: one include path per element (REL-1801).
|
|
3444
|
+
* A path names fields through lists, objects and references — `'hero.media.image'`,
|
|
3445
|
+
* `'featured.author'` — and may pick the fields each entry returns, `'featured(title,slug)'`.
|
|
3446
|
+
* Each is checked against the schema: a path that holds no reference does not compile, and the
|
|
3447
|
+
* read's type follows the paths — an expanded reference is the entry, every other one its id. A
|
|
3448
|
+
* second call adds to the first.
|
|
3447
3449
|
*/
|
|
3448
|
-
include(
|
|
3449
|
-
this.includeFields =
|
|
3450
|
+
include(paths) {
|
|
3451
|
+
this.includeFields = [...this.includeFields ?? [], ...paths];
|
|
3450
3452
|
return this;
|
|
3451
3453
|
}
|
|
3452
3454
|
/**
|
|
@@ -3457,10 +3459,6 @@ var _SettingsClient = class _SettingsClient {
|
|
|
3457
3459
|
this.localeValue = locale;
|
|
3458
3460
|
return this;
|
|
3459
3461
|
}
|
|
3460
|
-
/**
|
|
3461
|
-
* Fetch the settings group
|
|
3462
|
-
* @param options - Optional fetch options (alternative to fluent methods)
|
|
3463
|
-
*/
|
|
3464
3462
|
async fetch(options) {
|
|
3465
3463
|
try {
|
|
3466
3464
|
return (await this.fetchWithTag(options)).settings;
|
|
@@ -3498,7 +3496,7 @@ var _SettingsClient = class _SettingsClient {
|
|
|
3498
3496
|
*/
|
|
3499
3497
|
async fetchWithTag(options) {
|
|
3500
3498
|
const query = {};
|
|
3501
|
-
const includeValue = options?.include
|
|
3499
|
+
const includeValue = this.includeFields === void 0 && options?.include === void 0 ? void 0 : [...this.includeFields ?? [], ...options?.include ?? []];
|
|
3502
3500
|
const localeValueFinal = options?.locale ?? this.localeValue ?? this.clientLocale();
|
|
3503
3501
|
if (includeValue) query.include = includeValue.join(",");
|
|
3504
3502
|
if (localeValueFinal != null && localeValueFinal !== "") query.locale = localeValueFinal;
|
|
@@ -6285,5 +6283,5 @@ function randomClientId() {
|
|
|
6285
6283
|
__name(randomClientId, "randomClientId");
|
|
6286
6284
|
|
|
6287
6285
|
export { AdhocQueryBuilder, AdhocQueryClient, AssetClient, AssetFileBuilder, AssetUploadBuilder, AuthorizationError, AutocompleteBuilder, BaseValidationError, BatchBuilder, BatchClient, ChangesExpiredError, ConnectionError, ContentByIdBuilder, ContentClient, ContentQueryBuilder, ErrorMapper, FileUploadError, FileValidationError, HttpClient, InvalidApiKeyError, InvalidPayloadError, LIVE_KEEPALIVE_INTERVAL_MS, LIVE_SOCKET_OPEN_TIMEOUT_MS, LiveEdgeError, MethodNotAllowedError, MissingApiKeyError, NetworkError, PUBLISHABLE_KEY_PREFIX, PayloadTooLargeError, PlanFeatureUnavailableError, RateLimitError, ReadOnlyKeyError, ResourceConflictError, ResourceExpiredError, ResourceNotFoundError, SDKError, SearchBuilder, SearchClient, ServerError, ServiceIndeterminateError, SettingsClient, SimilarBuilder, SingletonClient, TimeoutError, TransactionRolledBackError, TypedRelyIOClient, UnknownContractError, UsageQuotaExceededError, VISITOR_ADMISSION_RETRY_AFTER_SECONDS, ValidationError, createClient, entityTagOf, isAborted, isAssetEntry, isPublishableKey, isResourceNotFound, matchRoute, serviceInstructedDelayMs, sleep, validateFile };
|
|
6288
|
-
//# sourceMappingURL=chunk-
|
|
6289
|
-
//# sourceMappingURL=chunk-
|
|
6286
|
+
//# sourceMappingURL=chunk-6NGJXLOR.js.map
|
|
6287
|
+
//# sourceMappingURL=chunk-6NGJXLOR.js.map
|
|
@@ -1664,13 +1664,19 @@ var _ContentQueryBuilder = class _ContentQueryBuilder {
|
|
|
1664
1664
|
return this;
|
|
1665
1665
|
}
|
|
1666
1666
|
/**
|
|
1667
|
-
* Add where conditions to the query
|
|
1668
|
-
*
|
|
1667
|
+
* Add where conditions to the query, each naming a value by its path: a field the content type
|
|
1668
|
+
* declares, a field inside an object (`'pricing.basePrice'`), a reference inside its blocks —
|
|
1669
|
+
* `{ 'sections.features': featureId }` keeps the entries some block of which holds that feature
|
|
1670
|
+
* (REL-1810) — and rich text that can point at an entry, by the entries it points at. A typed read
|
|
1671
|
+
* takes exactly the paths the API filters by (`FilterPaths`, REL-2136). A condition on `_metadata`
|
|
1672
|
+
* is refused here, before anything is sent (`refuseMetadataConditions`).
|
|
1669
1673
|
*/
|
|
1670
1674
|
where(conditions) {
|
|
1671
1675
|
refuseMetadataConditions(conditions);
|
|
1672
1676
|
this.queryOptions.where = {
|
|
1673
1677
|
...this.queryOptions.where,
|
|
1678
|
+
// Sent as written: a path into an object or a block, or a rich-text field's condition, rides
|
|
1679
|
+
// beside the fields', which `QueryOptions` types by the record's own keys alone
|
|
1674
1680
|
...conditions
|
|
1675
1681
|
};
|
|
1676
1682
|
return this;
|
|
@@ -1683,10 +1689,18 @@ var _ContentQueryBuilder = class _ContentQueryBuilder {
|
|
|
1683
1689
|
return this;
|
|
1684
1690
|
}
|
|
1685
1691
|
/**
|
|
1686
|
-
*
|
|
1692
|
+
* Expand references into the entries they point at: one include path per element (REL-1801).
|
|
1693
|
+
* A path names fields through lists, page builders, objects and references —
|
|
1694
|
+
* `'sections.features'`, `'sections.customers.logo'` — and may pick the fields each entry returns,
|
|
1695
|
+
* `'sections.features(name,slug)'`. Each is checked against the schema: a path that holds no
|
|
1696
|
+
* reference does not compile, and the read's type follows the paths — an expanded reference is the
|
|
1697
|
+
* entry, every other one its id.
|
|
1687
1698
|
*/
|
|
1688
|
-
include(
|
|
1689
|
-
this.queryOptions.include = [
|
|
1699
|
+
include(paths) {
|
|
1700
|
+
this.queryOptions.include = [
|
|
1701
|
+
...this.queryOptions.include ?? [],
|
|
1702
|
+
...paths
|
|
1703
|
+
];
|
|
1690
1704
|
return this;
|
|
1691
1705
|
}
|
|
1692
1706
|
sort(fieldOrOptions, direction) {
|
|
@@ -2071,10 +2085,15 @@ var _ContentByIdBuilder = class _ContentByIdBuilder {
|
|
|
2071
2085
|
return this;
|
|
2072
2086
|
}
|
|
2073
2087
|
/**
|
|
2074
|
-
*
|
|
2088
|
+
* Expand references into the entries they point at: one include path per element (REL-1801).
|
|
2089
|
+
* A path names fields through lists, page builders, objects and references —
|
|
2090
|
+
* `'sections.features'`, `'sections.customers.logo'` — and may pick the fields each entry returns,
|
|
2091
|
+
* `'sections.features(name,slug)'`. Each is checked against the schema: a path that holds no
|
|
2092
|
+
* reference does not compile, and the read's type follows the paths — an expanded reference is the
|
|
2093
|
+
* entry, every other one its id. A second call adds to the first.
|
|
2075
2094
|
*/
|
|
2076
|
-
include(
|
|
2077
|
-
this.includeRelations =
|
|
2095
|
+
include(paths) {
|
|
2096
|
+
this.includeRelations = [...this.includeRelations ?? [], ...paths];
|
|
2078
2097
|
return this;
|
|
2079
2098
|
}
|
|
2080
2099
|
/**
|
|
@@ -2248,14 +2267,12 @@ var _ContentClient = class _ContentClient {
|
|
|
2248
2267
|
}
|
|
2249
2268
|
return builder.execute();
|
|
2250
2269
|
}
|
|
2251
|
-
/**
|
|
2252
|
-
* Fetch content with query options
|
|
2253
|
-
*/
|
|
2254
2270
|
async fetch(options) {
|
|
2255
|
-
const
|
|
2271
|
+
const query = this.query();
|
|
2256
2272
|
if (options?.where) {
|
|
2257
|
-
|
|
2273
|
+
query.where(options.where);
|
|
2258
2274
|
}
|
|
2275
|
+
const builder = query;
|
|
2259
2276
|
if (options?.limit != null) {
|
|
2260
2277
|
builder.limit(options.limit);
|
|
2261
2278
|
}
|
|
@@ -2266,7 +2283,7 @@ var _ContentClient = class _ContentClient {
|
|
|
2266
2283
|
builder.sort(options.sort);
|
|
2267
2284
|
}
|
|
2268
2285
|
if (options?.include) {
|
|
2269
|
-
builder.include(options.include);
|
|
2286
|
+
builder.include([...options.include]);
|
|
2270
2287
|
}
|
|
2271
2288
|
if (options?.locale != null && options.locale !== "") {
|
|
2272
2289
|
builder.locale(options.locale);
|
|
@@ -2279,16 +2296,10 @@ var _ContentClient = class _ContentClient {
|
|
|
2279
2296
|
}
|
|
2280
2297
|
return builder.execute();
|
|
2281
2298
|
}
|
|
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
2299
|
async fetchOne(id, options) {
|
|
2289
2300
|
const builder = this.findById(id);
|
|
2290
2301
|
if (options?.include != null) {
|
|
2291
|
-
builder.include(options.include);
|
|
2302
|
+
builder.include([...options.include]);
|
|
2292
2303
|
}
|
|
2293
2304
|
if (options?.locale != null && options.locale !== "") {
|
|
2294
2305
|
builder.locale(options.locale);
|
|
@@ -2298,27 +2309,11 @@ var _ContentClient = class _ContentClient {
|
|
|
2298
2309
|
}
|
|
2299
2310
|
return builder.execute();
|
|
2300
2311
|
}
|
|
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
2312
|
async fetchOneWithTag(id, options) {
|
|
2320
2313
|
const query = {};
|
|
2321
|
-
if (options?.include != null)
|
|
2314
|
+
if (options?.include != null) {
|
|
2315
|
+
query.include = options.include.join(",");
|
|
2316
|
+
}
|
|
2322
2317
|
const locale = options?.locale ?? this.clientLocale();
|
|
2323
2318
|
if (locale != null && locale !== "") query.locale = locale;
|
|
2324
2319
|
const response = await this.httpClient.send(
|
|
@@ -2372,6 +2367,8 @@ var _ContentClient = class _ContentClient {
|
|
|
2372
2367
|
* request adds, as for {@link create}. `ifMatch` and `idempotencyKey` win over the same
|
|
2373
2368
|
* header among them. `locale` defaults to the client's own, the locale whose entity tag
|
|
2374
2369
|
* {@link fetchOneWithTag} reads, so the tag it hands back is checked against the same locale.
|
|
2370
|
+
* @returns The entry, its `_metadata.brokenLinks` naming each entry link another entry publishes
|
|
2371
|
+
* that this revision left pointing nowhere — empty when it took no heading away.
|
|
2375
2372
|
*/
|
|
2376
2373
|
async update(id, data, options) {
|
|
2377
2374
|
const { idempotencyKey, ifMatch, headers, locale, ...body } = options ?? {};
|
|
@@ -2455,6 +2452,9 @@ var _ContentClient = class _ContentClient {
|
|
|
2455
2452
|
* The restore is validated as strictly as a publish, so it cannot publish invalid content, and it
|
|
2456
2453
|
* records a new version of its own rather than rewinding the counter — so the revert is auditable
|
|
2457
2454
|
* and itself reversible.
|
|
2455
|
+
*
|
|
2456
|
+
* @returns The entry, its `_metadata.leftOut` naming each value of the version the active schema
|
|
2457
|
+
* no longer declares, and `_metadata.brokenLinks` the entry links it left pointing nowhere.
|
|
2458
2458
|
*/
|
|
2459
2459
|
async restore(id, versionNumber, locale, options) {
|
|
2460
2460
|
return this.httpClient.fetchPayload("/v1/{contentType}/{id}/versions/{versionNumber}/restore", "post", {
|
|
@@ -2468,15 +2468,14 @@ var _ContentClient = class _ContentClient {
|
|
|
2468
2468
|
});
|
|
2469
2469
|
}
|
|
2470
2470
|
/**
|
|
2471
|
-
* Get children of a hierarchical entry
|
|
2471
|
+
* Get the direct children of a hierarchical entry. The route lists one level and takes no depth
|
|
2472
|
+
* (REL-2195): `{ depth }` was sent as `?depth=`, which the API refused with `400`. A tree nested
|
|
2473
|
+
* under each entry is a list or entry read's `query().children()`.
|
|
2472
2474
|
* @param id - Parent entry ID
|
|
2473
|
-
* @param options -
|
|
2475
|
+
* @param options - Include paths to expand on each child, and the locale to read
|
|
2474
2476
|
*/
|
|
2475
2477
|
async children(id, options) {
|
|
2476
2478
|
const params = {};
|
|
2477
|
-
if (options?.depth != null) {
|
|
2478
|
-
params.depth = options.depth;
|
|
2479
|
-
}
|
|
2480
2479
|
if (options?.include != null) {
|
|
2481
2480
|
params.include = options.include.join(",");
|
|
2482
2481
|
}
|
|
@@ -3181,10 +3180,9 @@ var _AssetClient = class _AssetClient {
|
|
|
3181
3180
|
this.clientLocale
|
|
3182
3181
|
);
|
|
3183
3182
|
}
|
|
3184
|
-
/** Fetch a single asset entry by id (or slug), or `null` if not found. */
|
|
3185
3183
|
async fetchOne(id, options) {
|
|
3186
3184
|
const builder = this.findById(id);
|
|
3187
|
-
if (options?.include != null) builder.include(options.include);
|
|
3185
|
+
if (options?.include != null) builder.include([...options.include]);
|
|
3188
3186
|
if (options?.locale != null && options.locale !== "") builder.locale(options.locale);
|
|
3189
3187
|
return builder.execute();
|
|
3190
3188
|
}
|
|
@@ -3287,11 +3285,15 @@ var _SingletonClient = class _SingletonClient {
|
|
|
3287
3285
|
this.clientLocale = readClientLocale(locale);
|
|
3288
3286
|
}
|
|
3289
3287
|
/**
|
|
3290
|
-
*
|
|
3291
|
-
*
|
|
3288
|
+
* Expand references into the entries they point at: one include path per element (REL-1801).
|
|
3289
|
+
* A path names fields through lists, objects and references — `'hero.media.image'`,
|
|
3290
|
+
* `'featured.author'` — and may pick the fields each entry returns, `'featured(title,slug)'`.
|
|
3291
|
+
* Each is checked against the schema: a path that holds no reference does not compile, and the
|
|
3292
|
+
* read's type follows the paths — an expanded reference is the entry, every other one its id. A
|
|
3293
|
+
* second call adds to the first.
|
|
3292
3294
|
*/
|
|
3293
|
-
include(
|
|
3294
|
-
this.includeFields =
|
|
3295
|
+
include(paths) {
|
|
3296
|
+
this.includeFields = [...this.includeFields ?? [], ...paths];
|
|
3295
3297
|
return this;
|
|
3296
3298
|
}
|
|
3297
3299
|
/**
|
|
@@ -3302,10 +3304,6 @@ var _SingletonClient = class _SingletonClient {
|
|
|
3302
3304
|
this.localeValue = locale;
|
|
3303
3305
|
return this;
|
|
3304
3306
|
}
|
|
3305
|
-
/**
|
|
3306
|
-
* Fetch the singleton content
|
|
3307
|
-
* @param options - Optional fetch options (alternative to fluent methods)
|
|
3308
|
-
*/
|
|
3309
3307
|
async fetch(options) {
|
|
3310
3308
|
try {
|
|
3311
3309
|
return (await this.fetchWithTag(options)).content;
|
|
@@ -3323,7 +3321,7 @@ var _SingletonClient = class _SingletonClient {
|
|
|
3323
3321
|
*/
|
|
3324
3322
|
async fetchWithTag(options) {
|
|
3325
3323
|
const query = {};
|
|
3326
|
-
const includeValue = options?.include
|
|
3324
|
+
const includeValue = this.includeFields === void 0 && options?.include === void 0 ? void 0 : [...this.includeFields ?? [], ...options?.include ?? []];
|
|
3327
3325
|
const localeValueFinal = options?.locale ?? this.localeValue ?? this.clientLocale();
|
|
3328
3326
|
if (includeValue) query.include = includeValue.join(",");
|
|
3329
3327
|
if (localeValueFinal != null && localeValueFinal !== "") query.locale = localeValueFinal;
|
|
@@ -3444,11 +3442,15 @@ var _SettingsClient = class _SettingsClient {
|
|
|
3444
3442
|
this.clientLocale = readClientLocale(locale);
|
|
3445
3443
|
}
|
|
3446
3444
|
/**
|
|
3447
|
-
*
|
|
3448
|
-
*
|
|
3445
|
+
* Expand references into the entries they point at: one include path per element (REL-1801).
|
|
3446
|
+
* A path names fields through lists, objects and references — `'hero.media.image'`,
|
|
3447
|
+
* `'featured.author'` — and may pick the fields each entry returns, `'featured(title,slug)'`.
|
|
3448
|
+
* Each is checked against the schema: a path that holds no reference does not compile, and the
|
|
3449
|
+
* read's type follows the paths — an expanded reference is the entry, every other one its id. A
|
|
3450
|
+
* second call adds to the first.
|
|
3449
3451
|
*/
|
|
3450
|
-
include(
|
|
3451
|
-
this.includeFields =
|
|
3452
|
+
include(paths) {
|
|
3453
|
+
this.includeFields = [...this.includeFields ?? [], ...paths];
|
|
3452
3454
|
return this;
|
|
3453
3455
|
}
|
|
3454
3456
|
/**
|
|
@@ -3459,10 +3461,6 @@ var _SettingsClient = class _SettingsClient {
|
|
|
3459
3461
|
this.localeValue = locale;
|
|
3460
3462
|
return this;
|
|
3461
3463
|
}
|
|
3462
|
-
/**
|
|
3463
|
-
* Fetch the settings group
|
|
3464
|
-
* @param options - Optional fetch options (alternative to fluent methods)
|
|
3465
|
-
*/
|
|
3466
3464
|
async fetch(options) {
|
|
3467
3465
|
try {
|
|
3468
3466
|
return (await this.fetchWithTag(options)).settings;
|
|
@@ -3500,7 +3498,7 @@ var _SettingsClient = class _SettingsClient {
|
|
|
3500
3498
|
*/
|
|
3501
3499
|
async fetchWithTag(options) {
|
|
3502
3500
|
const query = {};
|
|
3503
|
-
const includeValue = options?.include
|
|
3501
|
+
const includeValue = this.includeFields === void 0 && options?.include === void 0 ? void 0 : [...this.includeFields ?? [], ...options?.include ?? []];
|
|
3504
3502
|
const localeValueFinal = options?.locale ?? this.localeValue ?? this.clientLocale();
|
|
3505
3503
|
if (includeValue) query.include = includeValue.join(",");
|
|
3506
3504
|
if (localeValueFinal != null && localeValueFinal !== "") query.locale = localeValueFinal;
|
|
@@ -6346,5 +6344,5 @@ exports.matchRoute = matchRoute;
|
|
|
6346
6344
|
exports.serviceInstructedDelayMs = serviceInstructedDelayMs;
|
|
6347
6345
|
exports.sleep = sleep;
|
|
6348
6346
|
exports.validateFile = validateFile;
|
|
6349
|
-
//# sourceMappingURL=chunk-
|
|
6350
|
-
//# sourceMappingURL=chunk-
|
|
6347
|
+
//# sourceMappingURL=chunk-DEDIJKHY.cjs.map
|
|
6348
|
+
//# sourceMappingURL=chunk-DEDIJKHY.cjs.map
|