@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
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import './rich-text.d-rKmpgdGd.js';
|
|
2
|
+
import { aW as paths, a5 as EntryMetadata, aX as components } from './include-paths-CrJNTsMl.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Where the SDK's transport gets its truth.
|
|
@@ -579,7 +580,7 @@ type DeclaresNoField<T> = [Exclude<keyof T, '_metadata'>] extends [never] ? true
|
|
|
579
580
|
* Not the field's read type. The REST dialect (`fromRestWhere` in `@relyio/entry-reads`) reads a
|
|
580
581
|
* bare value as `eq`, an array as `in` and an object as operators — refusing an object with none —
|
|
581
582
|
* and drops `null`. So a list field (`tags`) is matched by one of its items, a reference by the
|
|
582
|
-
* target's id, and
|
|
583
|
+
* target's id, and an object's value or an expanded entry is never a value to send.
|
|
583
584
|
*/
|
|
584
585
|
type WhereScalar<V> = Exclude<V extends readonly (infer Item)[] ? Item : V, null | undefined | object>;
|
|
585
586
|
/** One field's condition: a value (`eq`), a list of values (`in`), or operators. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { K as MergedRelyIOConfig, A as ApiPath, c as ApiMethod, N as PathParamsOf, w as ApiResponse, W as Wire, v as RequestConfig, B as BaseContent, h as WhereClause, Q as QueryOptions, j as SortOptions, k as ContentQueryResult, C as CreateInput, U as UpdateInput, S as SDKError, H as BaseValidationError, G as ValidationViolation, R as RelyIOConfig, a as RelyIOConfigUpdate } from './index-
|
|
2
|
-
import {
|
|
3
|
-
import { a as SchemaDefinition, b as SchemaContentTypeNames, j as SchemaEntryOf,
|
|
1
|
+
import { K as MergedRelyIOConfig, A as ApiPath, c as ApiMethod, N as PathParamsOf, w as ApiResponse, W as Wire, v as RequestConfig, B as BaseContent, h as WhereClause, Q as QueryOptions, j as SortOptions, k as ContentQueryResult, C as CreateInput, U as UpdateInput, S as SDKError, H as BaseValidationError, G as ValidationViolation, R as RelyIOConfig, a as RelyIOConfigUpdate } from './index-b-AkfTUv.cjs';
|
|
2
|
+
import { W as Reading, _ as UntypedReading, M as CheckedIncludes, X as ReadWith, aX as components, aY as CheckedInclude, aW as paths, a6 as InferContentType, P as ContentReading, an as InferAssetType, J as AssetReading, ae as InferSingleton, Z as SingletonReading, aj as InferSettingsGroup, Y as SettingsReading } from './include-paths-CL4gHv6I.cjs';
|
|
3
|
+
import { a as SchemaDefinition, b as SchemaContentTypeNames, j as SchemaEntryOf, al as FilterOperator, h as SchemaAssetTypeNames, c as SchemaSingletonNames, g as SchemaSettingsGroupNames, e as SchemaQueryNames, f as SchemaLocaleCodes } from './define-schema-DgctHlI2.cjs';
|
|
4
4
|
import { VisitorResyncReason } from './live-visitor.js';
|
|
5
5
|
import { DevUnreadableReason } from './dev-handshake/index.cjs';
|
|
6
6
|
|
|
@@ -288,7 +288,7 @@ type ExtendedQueryResult<T extends BaseContent = BaseContent> = ContentQueryResu
|
|
|
288
288
|
* .execute()
|
|
289
289
|
* ```
|
|
290
290
|
*/
|
|
291
|
-
declare class ContentQueryBuilder<T extends BaseContent = BaseContent, F extends BaseContent = T> {
|
|
291
|
+
declare class ContentQueryBuilder<T extends BaseContent = BaseContent, F extends BaseContent = T, R extends Reading = UntypedReading<T>, I extends string = never> {
|
|
292
292
|
private readonly httpClient;
|
|
293
293
|
private readonly contentType;
|
|
294
294
|
private queryOptions;
|
|
@@ -332,9 +332,14 @@ declare class ContentQueryBuilder<T extends BaseContent = BaseContent, F extends
|
|
|
332
332
|
*/
|
|
333
333
|
select(fields: NonNullable<QueryOptions<T, F>['select']>): this;
|
|
334
334
|
/**
|
|
335
|
-
*
|
|
335
|
+
* Expand references into the entries they point at: one include path per element (REL-1801).
|
|
336
|
+
* A path names fields through lists, page builders, objects and references —
|
|
337
|
+
* `'sections.features'`, `'sections.customers.logo'` — and may pick the fields each entry returns,
|
|
338
|
+
* `'sections.features(name,slug)'`. Each is checked against the schema: a path that holds no
|
|
339
|
+
* reference does not compile, and the read's type follows the paths — an expanded reference is the
|
|
340
|
+
* entry, every other one its id.
|
|
336
341
|
*/
|
|
337
|
-
include
|
|
342
|
+
include<const P extends readonly string[]>(paths: CheckedIncludes<R, P>): ContentQueryBuilder<Extract<ReadWith<R, I | P[number]>, BaseContent>, F, R, I | P[number]>;
|
|
338
343
|
/**
|
|
339
344
|
* Add sorting to the query
|
|
340
345
|
*
|
|
@@ -477,7 +482,7 @@ declare class ContentQueryBuilder<T extends BaseContent = BaseContent, F extends
|
|
|
477
482
|
/**
|
|
478
483
|
* Clone the query builder
|
|
479
484
|
*/
|
|
480
|
-
clone(): ContentQueryBuilder<T, F>;
|
|
485
|
+
clone(): ContentQueryBuilder<T, F, R, I>;
|
|
481
486
|
/**
|
|
482
487
|
* Get the current query options
|
|
483
488
|
*/
|
|
@@ -514,7 +519,7 @@ declare class ContentQueryBuilder<T extends BaseContent = BaseContent, F extends
|
|
|
514
519
|
/**
|
|
515
520
|
* Specialized query builder for finding by ID
|
|
516
521
|
*/
|
|
517
|
-
declare class ContentByIdBuilder<T extends BaseContent = BaseContent> {
|
|
522
|
+
declare class ContentByIdBuilder<T extends BaseContent = BaseContent, R extends Reading = UntypedReading<T>, I extends string = never> {
|
|
518
523
|
private readonly httpClient;
|
|
519
524
|
private readonly contentType;
|
|
520
525
|
private readonly id;
|
|
@@ -541,9 +546,14 @@ declare class ContentByIdBuilder<T extends BaseContent = BaseContent> {
|
|
|
541
546
|
*/
|
|
542
547
|
fresh(position: string): this;
|
|
543
548
|
/**
|
|
544
|
-
*
|
|
549
|
+
* Expand references into the entries they point at: one include path per element (REL-1801).
|
|
550
|
+
* A path names fields through lists, page builders, objects and references —
|
|
551
|
+
* `'sections.features'`, `'sections.customers.logo'` — and may pick the fields each entry returns,
|
|
552
|
+
* `'sections.features(name,slug)'`. Each is checked against the schema: a path that holds no
|
|
553
|
+
* reference does not compile, and the read's type follows the paths — an expanded reference is the
|
|
554
|
+
* entry, every other one its id. A second call adds to the first.
|
|
545
555
|
*/
|
|
546
|
-
include
|
|
556
|
+
include<const P extends readonly string[]>(paths: CheckedIncludes<R, P>): ContentByIdBuilder<Extract<ReadWith<R, I | P[number]>, BaseContent>, R, I | P[number]>;
|
|
547
557
|
/**
|
|
548
558
|
* Set locale for localized content
|
|
549
559
|
* @param locale - Locale code (e.g., 'en-US', 'de-DE', 'fr-FR')
|
|
@@ -656,8 +666,11 @@ interface ContentFetchOptions<T extends BaseContent = BaseContent> {
|
|
|
656
666
|
offset?: number;
|
|
657
667
|
/** Sort configuration */
|
|
658
668
|
sort?: Record<string, 'asc' | 'desc'>;
|
|
659
|
-
/**
|
|
660
|
-
|
|
669
|
+
/**
|
|
670
|
+
* Include paths: the references to expand (REL-1801) — see `ContentQueryBuilder.include`. Typed
|
|
671
|
+
* where `fetch` is called with them inline.
|
|
672
|
+
*/
|
|
673
|
+
include?: readonly string[];
|
|
661
674
|
/** Locale for localized content */
|
|
662
675
|
locale?: string;
|
|
663
676
|
/** Fields to select (projection) */
|
|
@@ -685,7 +698,7 @@ interface ContentFetchOptions<T extends BaseContent = BaseContent> {
|
|
|
685
698
|
* const all = await products.fetchAll()
|
|
686
699
|
* ```
|
|
687
700
|
*/
|
|
688
|
-
declare class ContentClient<T extends BaseContent = BaseContent
|
|
701
|
+
declare class ContentClient<T extends BaseContent = BaseContent, R extends Reading = UntypedReading<T>> {
|
|
689
702
|
private readonly httpClient;
|
|
690
703
|
private readonly contentType;
|
|
691
704
|
/** The client's locale, asked on every call rather than copied when this client was taken. */
|
|
@@ -698,11 +711,11 @@ declare class ContentClient<T extends BaseContent = BaseContent> {
|
|
|
698
711
|
/**
|
|
699
712
|
* Create a new query builder for this content type
|
|
700
713
|
*/
|
|
701
|
-
query(): ContentQueryBuilder<T>;
|
|
714
|
+
query(): ContentQueryBuilder<T, T, R>;
|
|
702
715
|
/**
|
|
703
716
|
* Find content by ID with fluent options
|
|
704
717
|
*/
|
|
705
|
-
findById(id: string): ContentByIdBuilder<T>;
|
|
718
|
+
findById(id: string): ContentByIdBuilder<T, R>;
|
|
706
719
|
/**
|
|
707
720
|
* Fetch all content items
|
|
708
721
|
* @param locale - Optional locale for localized content
|
|
@@ -711,15 +724,22 @@ declare class ContentClient<T extends BaseContent = BaseContent> {
|
|
|
711
724
|
/**
|
|
712
725
|
* Fetch content with query options
|
|
713
726
|
*/
|
|
714
|
-
fetch(options
|
|
727
|
+
fetch<const P extends readonly string[]>(options: Omit<ContentFetchOptions<T>, 'include'> & {
|
|
728
|
+
include: CheckedIncludes<R, P>;
|
|
729
|
+
}): Promise<Array<ReadWith<R, P[number]>>>;
|
|
730
|
+
fetch(options?: Omit<ContentFetchOptions<T>, 'include'>): Promise<T[]>;
|
|
715
731
|
/**
|
|
716
732
|
* Fetch a single content item by ID
|
|
717
733
|
* @param id - Entry ID or slug
|
|
718
734
|
* @param options - Fetch options (include, locale, and `headers` this one request adds — e.g.
|
|
719
735
|
* `{ 'X-RelyIO-Dataset': 'staging' }` to read a dataset other than the client's)
|
|
720
736
|
*/
|
|
737
|
+
fetchOne<const P extends readonly string[]>(id: string, options: {
|
|
738
|
+
include: CheckedIncludes<R, P>;
|
|
739
|
+
locale?: string;
|
|
740
|
+
headers?: Record<string, string>;
|
|
741
|
+
}): Promise<ReadWith<R, P[number]> | null>;
|
|
721
742
|
fetchOne(id: string, options?: {
|
|
722
|
-
include?: string[];
|
|
723
743
|
locale?: string;
|
|
724
744
|
headers?: Record<string, string>;
|
|
725
745
|
}): Promise<T | null>;
|
|
@@ -741,8 +761,15 @@ declare class ContentClient<T extends BaseContent = BaseContent> {
|
|
|
741
761
|
* whether the entry, the content type or the schema was missing. `headers`
|
|
742
762
|
* are the ones this read adds, as for `fetchOne`.
|
|
743
763
|
*/
|
|
764
|
+
fetchOneWithTag<const P extends readonly string[]>(id: string, options: {
|
|
765
|
+
include: CheckedIncludes<R, P>;
|
|
766
|
+
locale?: string;
|
|
767
|
+
headers?: Record<string, string>;
|
|
768
|
+
}): Promise<{
|
|
769
|
+
entry: ReadWith<R, P[number]>;
|
|
770
|
+
entityTag?: string;
|
|
771
|
+
}>;
|
|
744
772
|
fetchOneWithTag(id: string, options?: {
|
|
745
|
-
include?: string[];
|
|
746
773
|
locale?: string;
|
|
747
774
|
headers?: Record<string, string>;
|
|
748
775
|
}): Promise<{
|
|
@@ -853,7 +880,7 @@ declare class ContentClient<T extends BaseContent = BaseContent> {
|
|
|
853
880
|
* Create a new ContentClient with a different default locale, fixed: an update of the client's
|
|
854
881
|
* locale (`updateConfig({ locale })`) does not reach it
|
|
855
882
|
*/
|
|
856
|
-
withLocale(locale: string): ContentClient<T>;
|
|
883
|
+
withLocale(locale: string): ContentClient<T, R>;
|
|
857
884
|
/**
|
|
858
885
|
* Get the default locale as it is now: the client's, or the one `withLocale()` fixed
|
|
859
886
|
*/
|
|
@@ -1292,7 +1319,15 @@ declare class AssetUploadBuilder<T extends BaseContent = BaseContent> {
|
|
|
1292
1319
|
* over the same dynamic `/{assetType}` routes — assets are `entryType: 'asset'`
|
|
1293
1320
|
* entries) and adds the `file(uid)` sub-resource builder + an `upload()` helper.
|
|
1294
1321
|
*/
|
|
1295
|
-
|
|
1322
|
+
/**
|
|
1323
|
+
* An asset read typed by the asset type's reading `R`: what the type's include paths make of its
|
|
1324
|
+
* fields, beside the `file` and `urls` blocks every asset read carries (REL-1801).
|
|
1325
|
+
*/
|
|
1326
|
+
interface AssetResponseReading<R extends Reading> extends Reading {
|
|
1327
|
+
readonly read: AssetEntryResponse<Extract<ReadWith<R, this['include']>, BaseContent>>;
|
|
1328
|
+
readonly checked: CheckedInclude<R, this['path']>;
|
|
1329
|
+
}
|
|
1330
|
+
declare class AssetClient<T extends BaseContent = BaseContent, R extends Reading = UntypedReading<T>> {
|
|
1296
1331
|
private readonly httpClient;
|
|
1297
1332
|
private readonly assetType;
|
|
1298
1333
|
/** The client's locale, asked on every call rather than copied when this client was taken. */
|
|
@@ -1306,12 +1341,15 @@ declare class AssetClient<T extends BaseContent = BaseContent> {
|
|
|
1306
1341
|
* Create a query builder for this asset type. It resolves asset reads; its conditions name the
|
|
1307
1342
|
* asset type's fields, which the `file` and `urls` blocks are not.
|
|
1308
1343
|
*/
|
|
1309
|
-
query(): ContentQueryBuilder<AssetEntryResponse<T>, T
|
|
1344
|
+
query(): ContentQueryBuilder<AssetEntryResponse<T>, T, AssetResponseReading<R>>;
|
|
1310
1345
|
/** Find an asset entry by id (or slug) with fluent options. */
|
|
1311
|
-
findById(id: string): ContentByIdBuilder<AssetEntryResponse<T>>;
|
|
1346
|
+
findById(id: string): ContentByIdBuilder<AssetEntryResponse<T>, AssetResponseReading<R>>;
|
|
1312
1347
|
/** Fetch a single asset entry by id (or slug), or `null` if not found. */
|
|
1348
|
+
fetchOne<const P extends readonly string[]>(id: string, options: {
|
|
1349
|
+
include: CheckedIncludes<R, P>;
|
|
1350
|
+
locale?: string;
|
|
1351
|
+
}): Promise<ReadWith<AssetResponseReading<R>, P[number]> | null>;
|
|
1313
1352
|
fetchOne(id: string, options?: {
|
|
1314
|
-
include?: string[];
|
|
1315
1353
|
locale?: string;
|
|
1316
1354
|
}): Promise<AssetEntryResponse<T> | null>;
|
|
1317
1355
|
/** Fetch the first asset entry matching the conditions, or `null`. */
|
|
@@ -1369,8 +1407,11 @@ type PopulatedAssetReference<T extends BaseContent = BaseContent> = AssetEntryRe
|
|
|
1369
1407
|
interface SingletonFetchOptions {
|
|
1370
1408
|
/** Locale for localized content */
|
|
1371
1409
|
locale?: string;
|
|
1372
|
-
/**
|
|
1373
|
-
|
|
1410
|
+
/**
|
|
1411
|
+
* Include paths: the references to expand (REL-1801), added to the ones `include()` named — see
|
|
1412
|
+
* `include()`. Typed where the call names them inline.
|
|
1413
|
+
*/
|
|
1414
|
+
include?: readonly string[];
|
|
1374
1415
|
/**
|
|
1375
1416
|
* The feed position this read follows — a change's `fresh` (`FeedChange`), or a resync's. Sent as
|
|
1376
1417
|
* `?_fresh`: no cache holds an answer for it from before that position, so the read is answered
|
|
@@ -1395,7 +1436,7 @@ interface SingletonFetchOptions {
|
|
|
1395
1436
|
* .fetch()
|
|
1396
1437
|
* ```
|
|
1397
1438
|
*/
|
|
1398
|
-
declare class SingletonClient<T = unknown> {
|
|
1439
|
+
declare class SingletonClient<T = unknown, R extends Reading = UntypedReading<T>, I extends string = never> {
|
|
1399
1440
|
private httpClient;
|
|
1400
1441
|
private singletonKey;
|
|
1401
1442
|
private includeFields?;
|
|
@@ -1408,10 +1449,14 @@ declare class SingletonClient<T = unknown> {
|
|
|
1408
1449
|
*/
|
|
1409
1450
|
constructor(httpClient: HttpClient, singletonKey: string, locale?: ClientLocale);
|
|
1410
1451
|
/**
|
|
1411
|
-
*
|
|
1412
|
-
*
|
|
1452
|
+
* Expand references into the entries they point at: one include path per element (REL-1801).
|
|
1453
|
+
* A path names fields through lists, objects and references — `'hero.media.image'`,
|
|
1454
|
+
* `'featured.author'` — and may pick the fields each entry returns, `'featured(title,slug)'`.
|
|
1455
|
+
* Each is checked against the schema: a path that holds no reference does not compile, and the
|
|
1456
|
+
* read's type follows the paths — an expanded reference is the entry, every other one its id. A
|
|
1457
|
+
* second call adds to the first.
|
|
1413
1458
|
*/
|
|
1414
|
-
include
|
|
1459
|
+
include<const P extends readonly string[]>(paths: CheckedIncludes<R, P>): SingletonClient<ReadWith<R, I | P[number]>, R, I | P[number]>;
|
|
1415
1460
|
/**
|
|
1416
1461
|
* Set locale for localized content
|
|
1417
1462
|
* @param locale - Locale code (e.g., 'en', 'de', 'fr')
|
|
@@ -1421,7 +1466,10 @@ declare class SingletonClient<T = unknown> {
|
|
|
1421
1466
|
* Fetch the singleton content
|
|
1422
1467
|
* @param options - Optional fetch options (alternative to fluent methods)
|
|
1423
1468
|
*/
|
|
1424
|
-
fetch(options
|
|
1469
|
+
fetch<const P extends readonly string[]>(options: Omit<SingletonFetchOptions, 'include'> & {
|
|
1470
|
+
include: CheckedIncludes<R, P>;
|
|
1471
|
+
}): Promise<ReadWith<R, I | P[number]> | null>;
|
|
1472
|
+
fetch(options?: Omit<SingletonFetchOptions, 'include'>): Promise<T | null>;
|
|
1425
1473
|
/**
|
|
1426
1474
|
* Fetch the singleton **and the entity tag that read served**, which is what
|
|
1427
1475
|
* `update`'s `ifMatch` takes (`INV-API-CONDITIONAL-WRITE-IS-REACHABLE`).
|
|
@@ -1479,7 +1527,7 @@ declare class SingletonClient<T = unknown> {
|
|
|
1479
1527
|
/**
|
|
1480
1528
|
* Reset fluent options for reuse
|
|
1481
1529
|
*/
|
|
1482
|
-
reset():
|
|
1530
|
+
reset(): SingletonClient<ReadWith<R, never>, R>;
|
|
1483
1531
|
}
|
|
1484
1532
|
|
|
1485
1533
|
/**
|
|
@@ -1488,8 +1536,11 @@ declare class SingletonClient<T = unknown> {
|
|
|
1488
1536
|
interface SettingsFetchOptions {
|
|
1489
1537
|
/** Locale for localized settings */
|
|
1490
1538
|
locale?: string;
|
|
1491
|
-
/**
|
|
1492
|
-
|
|
1539
|
+
/**
|
|
1540
|
+
* Include paths: the references to expand (REL-1801), added to the ones `include()` named — see
|
|
1541
|
+
* `include()`. Typed where the call names them inline.
|
|
1542
|
+
*/
|
|
1543
|
+
include?: readonly string[];
|
|
1493
1544
|
}
|
|
1494
1545
|
/**
|
|
1495
1546
|
* Settings client for managing settings group operations
|
|
@@ -1508,7 +1559,7 @@ interface SettingsFetchOptions {
|
|
|
1508
1559
|
* .fetch()
|
|
1509
1560
|
* ```
|
|
1510
1561
|
*/
|
|
1511
|
-
declare class SettingsClient<T = unknown> {
|
|
1562
|
+
declare class SettingsClient<T = unknown, R extends Reading = UntypedReading<T>, I extends string = never> {
|
|
1512
1563
|
private readonly httpClient;
|
|
1513
1564
|
private readonly groupId;
|
|
1514
1565
|
private includeFields?;
|
|
@@ -1521,10 +1572,14 @@ declare class SettingsClient<T = unknown> {
|
|
|
1521
1572
|
*/
|
|
1522
1573
|
constructor(httpClient: HttpClient, groupId: string, locale?: ClientLocale);
|
|
1523
1574
|
/**
|
|
1524
|
-
*
|
|
1525
|
-
*
|
|
1575
|
+
* Expand references into the entries they point at: one include path per element (REL-1801).
|
|
1576
|
+
* A path names fields through lists, objects and references — `'hero.media.image'`,
|
|
1577
|
+
* `'featured.author'` — and may pick the fields each entry returns, `'featured(title,slug)'`.
|
|
1578
|
+
* Each is checked against the schema: a path that holds no reference does not compile, and the
|
|
1579
|
+
* read's type follows the paths — an expanded reference is the entry, every other one its id. A
|
|
1580
|
+
* second call adds to the first.
|
|
1526
1581
|
*/
|
|
1527
|
-
include
|
|
1582
|
+
include<const P extends readonly string[]>(paths: CheckedIncludes<R, P>): SettingsClient<ReadWith<R, I | P[number]>, R, I | P[number]>;
|
|
1528
1583
|
/**
|
|
1529
1584
|
* Set locale for localized settings
|
|
1530
1585
|
* @param locale - Locale code (e.g., 'en', 'de', 'fr')
|
|
@@ -1534,7 +1589,10 @@ declare class SettingsClient<T = unknown> {
|
|
|
1534
1589
|
* Fetch the settings group
|
|
1535
1590
|
* @param options - Optional fetch options (alternative to fluent methods)
|
|
1536
1591
|
*/
|
|
1537
|
-
fetch(options
|
|
1592
|
+
fetch<const P extends readonly string[]>(options: Omit<SettingsFetchOptions, 'include'> & {
|
|
1593
|
+
include: CheckedIncludes<R, P>;
|
|
1594
|
+
}): Promise<ReadWith<R, I | P[number]> | null>;
|
|
1595
|
+
fetch(options?: Omit<SettingsFetchOptions, 'include'>): Promise<T | null>;
|
|
1538
1596
|
/**
|
|
1539
1597
|
* Update settings group
|
|
1540
1598
|
*
|
|
@@ -1605,12 +1663,12 @@ declare class SettingsClient<T = unknown> {
|
|
|
1605
1663
|
/**
|
|
1606
1664
|
* Reset fluent options for reuse
|
|
1607
1665
|
*/
|
|
1608
|
-
resetOptions():
|
|
1666
|
+
resetOptions(): SettingsClient<ReadWith<R, never>, R>;
|
|
1609
1667
|
}
|
|
1610
1668
|
|
|
1611
1669
|
/**
|
|
1612
1670
|
* Any schema the client can be typed by. `any` is deliberate: the client accepts whatever content
|
|
1613
|
-
* types,
|
|
1671
|
+
* types, singletons, queries and settings groups a customer declares.
|
|
1614
1672
|
*
|
|
1615
1673
|
* This is the constraint `TypedRelyIOClient`'s `TSchema` carries, so `RegisteredSchema` is inferred
|
|
1616
1674
|
* against the same one — `createClient` returns `TypedRelyIOClient<RegisteredSchema>`, and a schema
|
|
@@ -1666,9 +1724,12 @@ type SearchHitSystemFields = Pick<components['schemas']['SearchHit'], '_metadata
|
|
|
1666
1724
|
* `_metadata`, and the score annotations the request asked for. There is no per-item `data` wrapper.
|
|
1667
1725
|
*
|
|
1668
1726
|
* `T`'s `_metadata` is replaced, not kept: `T` is an entry type, and a hit is not an entry read.
|
|
1669
|
-
*
|
|
1727
|
+
* Every field is optional, a required one too: a `fields` projection names only some of them, and a
|
|
1728
|
+
* hit is built from the search row, not by the read that fills a required field a draft holds empty
|
|
1729
|
+
* (REL-1795). Distributes over a union of entry types, so a search across two types keeps each
|
|
1730
|
+
* one's fields.
|
|
1670
1731
|
*/
|
|
1671
|
-
type SearchResultItem<T = unknown> = T extends unknown ? Omit<T, '_metadata'
|
|
1732
|
+
type SearchResultItem<T = unknown> = T extends unknown ? Partial<Omit<T, '_metadata'>> & SearchHitSystemFields : never;
|
|
1672
1733
|
/**
|
|
1673
1734
|
* Search response from API
|
|
1674
1735
|
*/
|
|
@@ -3203,7 +3264,7 @@ declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined
|
|
|
3203
3264
|
* .execute()
|
|
3204
3265
|
* ```
|
|
3205
3266
|
*/
|
|
3206
|
-
content<K extends TSchema extends AnySchemaDefinition ? SchemaContentTypeNames<TSchema> : string>(contentType: K): TSchema extends AnySchemaDefinition ? ContentClient<InferContentType<TSchema['contentTypes'][K & keyof TSchema['contentTypes']], TSchema>> : ContentClient<BaseContent>;
|
|
3267
|
+
content<K extends TSchema extends AnySchemaDefinition ? SchemaContentTypeNames<TSchema> : string>(contentType: K): TSchema extends AnySchemaDefinition ? ContentClient<InferContentType<TSchema['contentTypes'][K & keyof TSchema['contentTypes']], TSchema>, ContentReading<TSchema['contentTypes'][K & keyof TSchema['contentTypes']], TSchema>> : ContentClient<BaseContent>;
|
|
3207
3268
|
/**
|
|
3208
3269
|
* Get an asset client for a specific asset type.
|
|
3209
3270
|
*
|
|
@@ -3222,7 +3283,7 @@ declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined
|
|
|
3222
3283
|
* const heroUrl = await relyio.asset('productPhoto').file(photo._metadata.id).url({ variantId: 'hero' })
|
|
3223
3284
|
* ```
|
|
3224
3285
|
*/
|
|
3225
|
-
asset<K extends TSchema extends AnySchemaDefinition ? SchemaAssetTypeNames<TSchema> : string>(assetType: K): TSchema extends AnySchemaDefinition ? AssetClient<InferAssetType<NonNullable<TSchema['assetTypes']>[K & keyof NonNullable<TSchema['assetTypes']>], TSchema>> : AssetClient<BaseContent>;
|
|
3286
|
+
asset<K extends TSchema extends AnySchemaDefinition ? SchemaAssetTypeNames<TSchema> : string>(assetType: K): TSchema extends AnySchemaDefinition ? AssetClient<InferAssetType<NonNullable<TSchema['assetTypes']>[K & keyof NonNullable<TSchema['assetTypes']>], TSchema>, AssetReading<NonNullable<TSchema['assetTypes']>[K & keyof NonNullable<TSchema['assetTypes']>], TSchema>> : AssetClient<BaseContent>;
|
|
3226
3287
|
/**
|
|
3227
3288
|
* Get a singleton client for a specific singleton key
|
|
3228
3289
|
* Type-safe when schema is provided: autocompletes singleton names AND field names
|
|
@@ -3235,7 +3296,7 @@ declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined
|
|
|
3235
3296
|
* .fetch()
|
|
3236
3297
|
* ```
|
|
3237
3298
|
*/
|
|
3238
|
-
singleton<K extends TSchema extends AnySchemaDefinition ? SchemaSingletonNames<TSchema> : string>(key: K): TSchema extends AnySchemaDefinition ? SingletonClient<InferSingleton<TSchema['singletonContentTypes'][K & keyof TSchema['singletonContentTypes']], TSchema>> : SingletonClient<unknown>;
|
|
3299
|
+
singleton<K extends TSchema extends AnySchemaDefinition ? SchemaSingletonNames<TSchema> : string>(key: K): TSchema extends AnySchemaDefinition ? SingletonClient<InferSingleton<TSchema['singletonContentTypes'][K & keyof TSchema['singletonContentTypes']], TSchema>, SingletonReading<TSchema['singletonContentTypes'][K & keyof TSchema['singletonContentTypes']], TSchema>> : SingletonClient<unknown>;
|
|
3239
3300
|
/**
|
|
3240
3301
|
* Get a settings client for a specific settings group
|
|
3241
3302
|
* Type-safe when schema is provided: autocompletes settings group names AND field names
|
|
@@ -3247,7 +3308,7 @@ declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined
|
|
|
3247
3308
|
* .fetch()
|
|
3248
3309
|
* ```
|
|
3249
3310
|
*/
|
|
3250
|
-
settings<K extends TSchema extends AnySchemaDefinition ? SchemaSettingsGroupNames<TSchema> : string>(groupId: K): TSchema extends AnySchemaDefinition ? SettingsClient<InferSettingsGroup<NonNullable<TSchema['settingsGroups']>[K & keyof NonNullable<TSchema['settingsGroups']>], TSchema>> : SettingsClient<unknown>;
|
|
3311
|
+
settings<K extends TSchema extends AnySchemaDefinition ? SchemaSettingsGroupNames<TSchema> : string>(groupId: K): TSchema extends AnySchemaDefinition ? SettingsClient<InferSettingsGroup<NonNullable<TSchema['settingsGroups']>[K & keyof NonNullable<TSchema['settingsGroups']>], TSchema>, SettingsReading<NonNullable<TSchema['settingsGroups']>[K & keyof NonNullable<TSchema['settingsGroups']>], TSchema>> : SettingsClient<unknown>;
|
|
3251
3312
|
/**
|
|
3252
3313
|
* Start a search query with full-text, semantic, or hybrid search.
|
|
3253
3314
|
*
|