@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.
Files changed (43) hide show
  1. package/CHANGELOG.md +172 -0
  2. package/dist/chunk-3NPPMGB6.js +1092 -0
  3. package/dist/{chunk-7GLDVHIH.js → chunk-6NGJXLOR.js} +65 -67
  4. package/dist/{chunk-4HTIU5YE.cjs → chunk-DEDIJKHY.cjs} +65 -67
  5. package/dist/{chunk-2TIJLV2X.js → chunk-EW23SZPX.js} +43 -65
  6. package/dist/{chunk-PO7CUR5U.cjs → chunk-FOSM4LMM.cjs} +42 -65
  7. package/dist/chunk-Z6GLWSSD.cjs +1106 -0
  8. package/dist/client/index.cjs +3 -3
  9. package/dist/client/index.d.cts +4 -4
  10. package/dist/client/index.d.ts +4 -4
  11. package/dist/client/index.js +1 -1
  12. package/dist/{define-schema-CVi8nwc7.d.ts → define-schema-UHViXKiv.d.ts} +33 -435
  13. package/dist/{define-schema-DqpipEHv.d.cts → define-schema-sWJ8Zn7C.d.cts} +33 -435
  14. package/dist/{define-content-type-ENAod5Ve.d.cts → include-paths-Bs5FhNw2.d.cts} +3505 -483
  15. package/dist/{define-content-type-ENAod5Ve.d.ts → include-paths-Cb7iPCW2.d.ts} +3505 -483
  16. package/dist/index--_u1nPHv.d.cts +507 -0
  17. package/dist/index-8DozAWsA.d.ts +507 -0
  18. package/dist/{index-MLAFUuco.d.cts → index-BT0L8xJj.d.cts} +139 -90
  19. package/dist/{index-BKEAYvvz.d.ts → index-CPjJ25R4.d.ts} +139 -90
  20. package/dist/index.cjs +134 -110
  21. package/dist/index.d.cts +44 -71
  22. package/dist/index.d.ts +44 -71
  23. package/dist/index.js +5 -28
  24. package/dist/markdown/index.cjs +13750 -0
  25. package/dist/markdown/index.d.cts +111 -0
  26. package/dist/markdown/index.d.ts +111 -0
  27. package/dist/markdown/index.js +13742 -0
  28. package/dist/rich-text/index.cjs +49 -0
  29. package/dist/rich-text/index.d.cts +3 -0
  30. package/dist/rich-text/index.d.ts +3 -0
  31. package/dist/rich-text/index.js +4 -0
  32. package/dist/rich-text.d-BWc-5gX1.d.cts +326 -0
  33. package/dist/rich-text.d-BWc-5gX1.d.ts +326 -0
  34. package/dist/schema/index.cjs +34 -38
  35. package/dist/schema/index.d.cts +15 -137
  36. package/dist/schema/index.d.ts +15 -137
  37. package/dist/schema/index.js +1 -1
  38. package/dist/types/index.d.cts +2 -2
  39. package/dist/types/index.d.ts +2 -2
  40. package/package.json +19 -2
  41. package/dist/.tsbuildinfo +0 -1
  42. package/dist/index-BM42r4yg.d.cts +0 -860
  43. package/dist/index-C73cK2Tt.d.ts +0 -860
@@ -1,6 +1,5 @@
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-BM42r4yg.cjs';
2
- import { aK as components, aJ as paths, W as InferContentType, aa as InferAssetType, a3 as InferSingleton } from './define-content-type-ENAod5Ve.cjs';
3
- import { a as SchemaDefinition, b as SchemaContentTypeNames, j as SchemaEntryOf, ax as FilterOperator, h as SchemaAssetTypeNames, c as SchemaSingletonNames, g as SchemaSettingsGroupNames, I as InferSettingsGroup, e as SchemaQueryNames, f as SchemaLocaleCodes } from './define-schema-DqpipEHv.cjs';
1
+ import { cj as MergedRelyIOConfig, bC as ApiPath, bD as ApiMethod, ck as PathParamsOf, ca as ApiResponse, bF as Wire, c9 as RequestConfig, bL as BaseContent, ae as Reading, ai as UntypedReading, cl as ReadWhere, bO as WhereClause, bS as QueryOptions, aa as CheckedIncludes, af as ReadWith, bR as SortOptions, bX as ContentQueryResult, bT as CreateInput, bW as UpdateInput, bU as RevisedContent, bV as RestoredContent, bx as SDKError, cg as BaseValidationError, cf as ValidationViolation, aJ as AssetServedBlocks, cm as CheckedInclude, cn as components, bJ as AssetFileBlock, co as paths, by as RelyIOConfig, aq as InferContentType, ac as ContentReading, aH as InferAssetType, a9 as AssetReading, ay as InferSingleton, ah as SingletonReading, aD as InferSettingsGroup, ag as SettingsReading, bz as RelyIOConfigUpdate } from './include-paths-Bs5FhNw2.cjs';
2
+ import { a as SchemaDefinition, b as SchemaContentTypeNames, j as SchemaEntryOf, a8 as FilterOperator, h as SchemaAssetTypeNames, c as SchemaSingletonNames, g as SchemaSettingsGroupNames, e as SchemaQueryNames, f as SchemaLocaleCodes } from './define-schema-sWJ8Zn7C.cjs';
4
3
  import { VisitorResyncReason } from './live-visitor.js';
5
4
  import { DevUnreadableReason } from './dev-handshake/index.cjs';
6
5
 
@@ -288,7 +287,7 @@ type ExtendedQueryResult<T extends BaseContent = BaseContent> = ContentQueryResu
288
287
  * .execute()
289
288
  * ```
290
289
  */
291
- declare class ContentQueryBuilder<T extends BaseContent = BaseContent, F extends BaseContent = T> {
290
+ declare class ContentQueryBuilder<T extends BaseContent = BaseContent, F extends BaseContent = T, R extends Reading = UntypedReading<T>, I extends string = never> {
292
291
  private readonly httpClient;
293
292
  private readonly contentType;
294
293
  private queryOptions;
@@ -323,18 +322,27 @@ declare class ContentQueryBuilder<T extends BaseContent = BaseContent, F extends
323
322
  */
324
323
  headers(headers: Record<string, string>): this;
325
324
  /**
326
- * Add where conditions to the query: conditions on the fields the content type declares. A
327
- * condition on `_metadata` is refused here, before anything is sent (`refuseMetadataConditions`).
325
+ * Add where conditions to the query, each naming a value by its path: a field the content type
326
+ * declares, a field inside an object (`'pricing.basePrice'`), a reference inside its blocks —
327
+ * `{ 'sections.features': featureId }` keeps the entries some block of which holds that feature
328
+ * (REL-1810) — and rich text that can point at an entry, by the entries it points at. A typed read
329
+ * takes exactly the paths the API filters by (`FilterPaths`, REL-2136). A condition on `_metadata`
330
+ * is refused here, before anything is sent (`refuseMetadataConditions`).
328
331
  */
329
- where(conditions: WhereClause<F>): this;
332
+ where(conditions: ReadWhere<WhereClause<F>, R>): this;
330
333
  /**
331
334
  * Select specific fields to return
332
335
  */
333
336
  select(fields: NonNullable<QueryOptions<T, F>['select']>): this;
334
337
  /**
335
- * Include related content in the response
338
+ * Expand references into the entries they point at: one include path per element (REL-1801).
339
+ * A path names fields through lists, page builders, objects and references —
340
+ * `'sections.features'`, `'sections.customers.logo'` — and may pick the fields each entry returns,
341
+ * `'sections.features(name,slug)'`. Each is checked against the schema: a path that holds no
342
+ * reference does not compile, and the read's type follows the paths — an expanded reference is the
343
+ * entry, every other one its id.
336
344
  */
337
- include(relations: string[]): this;
345
+ include<const P extends readonly string[]>(paths: CheckedIncludes<R, P>): ContentQueryBuilder<Extract<ReadWith<R, I | P[number]>, BaseContent>, F, R, I | P[number]>;
338
346
  /**
339
347
  * Add sorting to the query
340
348
  *
@@ -477,7 +485,7 @@ declare class ContentQueryBuilder<T extends BaseContent = BaseContent, F extends
477
485
  /**
478
486
  * Clone the query builder
479
487
  */
480
- clone(): ContentQueryBuilder<T, F>;
488
+ clone(): ContentQueryBuilder<T, F, R, I>;
481
489
  /**
482
490
  * Get the current query options
483
491
  */
@@ -514,7 +522,7 @@ declare class ContentQueryBuilder<T extends BaseContent = BaseContent, F extends
514
522
  /**
515
523
  * Specialized query builder for finding by ID
516
524
  */
517
- declare class ContentByIdBuilder<T extends BaseContent = BaseContent> {
525
+ declare class ContentByIdBuilder<T extends BaseContent = BaseContent, R extends Reading = UntypedReading<T>, I extends string = never> {
518
526
  private readonly httpClient;
519
527
  private readonly contentType;
520
528
  private readonly id;
@@ -541,9 +549,14 @@ declare class ContentByIdBuilder<T extends BaseContent = BaseContent> {
541
549
  */
542
550
  fresh(position: string): this;
543
551
  /**
544
- * Include related content in the response
552
+ * Expand references into the entries they point at: one include path per element (REL-1801).
553
+ * A path names fields through lists, page builders, objects and references —
554
+ * `'sections.features'`, `'sections.customers.logo'` — and may pick the fields each entry returns,
555
+ * `'sections.features(name,slug)'`. Each is checked against the schema: a path that holds no
556
+ * reference does not compile, and the read's type follows the paths — an expanded reference is the
557
+ * entry, every other one its id. A second call adds to the first.
545
558
  */
546
- include(relations: string[]): this;
559
+ include<const P extends readonly string[]>(paths: CheckedIncludes<R, P>): ContentByIdBuilder<Extract<ReadWith<R, I | P[number]>, BaseContent>, R, I | P[number]>;
547
560
  /**
548
561
  * Set locale for localized content
549
562
  * @param locale - Locale code (e.g., 'en-US', 'de-DE', 'fr-FR')
@@ -647,17 +660,20 @@ declare function entityTagOf(response: {
647
660
  /**
648
661
  * Content fetch options
649
662
  */
650
- interface ContentFetchOptions<T extends BaseContent = BaseContent> {
651
- /** Filter conditions */
652
- where?: WhereClause<T>;
663
+ interface ContentFetchOptions<T extends BaseContent = BaseContent, R extends Reading = UntypedReading<T>> {
664
+ /** Filter conditions: what `query().where()` takes (REL-2136) */
665
+ where?: ReadWhere<WhereClause<T>, R>;
653
666
  /** Maximum entries to return */
654
667
  limit?: number;
655
668
  /** Entries to skip (offset pagination) */
656
669
  offset?: number;
657
670
  /** Sort configuration */
658
671
  sort?: Record<string, 'asc' | 'desc'>;
659
- /** Reference fields to populate */
660
- include?: string[];
672
+ /**
673
+ * Include paths: the references to expand (REL-1801) — see `ContentQueryBuilder.include`. Typed
674
+ * where `fetch` is called with them inline.
675
+ */
676
+ include?: readonly string[];
661
677
  /** Locale for localized content */
662
678
  locale?: string;
663
679
  /** Fields to select (projection) */
@@ -685,7 +701,7 @@ interface ContentFetchOptions<T extends BaseContent = BaseContent> {
685
701
  * const all = await products.fetchAll()
686
702
  * ```
687
703
  */
688
- declare class ContentClient<T extends BaseContent = BaseContent> {
704
+ declare class ContentClient<T extends BaseContent = BaseContent, R extends Reading = UntypedReading<T>> {
689
705
  private readonly httpClient;
690
706
  private readonly contentType;
691
707
  /** The client's locale, asked on every call rather than copied when this client was taken. */
@@ -698,11 +714,11 @@ declare class ContentClient<T extends BaseContent = BaseContent> {
698
714
  /**
699
715
  * Create a new query builder for this content type
700
716
  */
701
- query(): ContentQueryBuilder<T>;
717
+ query(): ContentQueryBuilder<T, T, R>;
702
718
  /**
703
719
  * Find content by ID with fluent options
704
720
  */
705
- findById(id: string): ContentByIdBuilder<T>;
721
+ findById(id: string): ContentByIdBuilder<T, R>;
706
722
  /**
707
723
  * Fetch all content items
708
724
  * @param locale - Optional locale for localized content
@@ -711,15 +727,22 @@ declare class ContentClient<T extends BaseContent = BaseContent> {
711
727
  /**
712
728
  * Fetch content with query options
713
729
  */
714
- fetch(options?: ContentFetchOptions<T>): Promise<T[]>;
730
+ fetch<const P extends readonly string[]>(options: Omit<ContentFetchOptions<T, R>, 'include'> & {
731
+ include: CheckedIncludes<R, P>;
732
+ }): Promise<Array<ReadWith<R, P[number]>>>;
733
+ fetch(options?: Omit<ContentFetchOptions<T, R>, 'include'>): Promise<T[]>;
715
734
  /**
716
735
  * Fetch a single content item by ID
717
736
  * @param id - Entry ID or slug
718
737
  * @param options - Fetch options (include, locale, and `headers` this one request adds — e.g.
719
738
  * `{ 'X-RelyIO-Dataset': 'staging' }` to read a dataset other than the client's)
720
739
  */
740
+ fetchOne<const P extends readonly string[]>(id: string, options: {
741
+ include: CheckedIncludes<R, P>;
742
+ locale?: string;
743
+ headers?: Record<string, string>;
744
+ }): Promise<ReadWith<R, P[number]> | null>;
721
745
  fetchOne(id: string, options?: {
722
- include?: string[];
723
746
  locale?: string;
724
747
  headers?: Record<string, string>;
725
748
  }): Promise<T | null>;
@@ -741,8 +764,15 @@ declare class ContentClient<T extends BaseContent = BaseContent> {
741
764
  * whether the entry, the content type or the schema was missing. `headers`
742
765
  * are the ones this read adds, as for `fetchOne`.
743
766
  */
767
+ fetchOneWithTag<const P extends readonly string[]>(id: string, options: {
768
+ include: CheckedIncludes<R, P>;
769
+ locale?: string;
770
+ headers?: Record<string, string>;
771
+ }): Promise<{
772
+ entry: ReadWith<R, P[number]>;
773
+ entityTag?: string;
774
+ }>;
744
775
  fetchOneWithTag(id: string, options?: {
745
- include?: string[];
746
776
  locale?: string;
747
777
  headers?: Record<string, string>;
748
778
  }): Promise<{
@@ -754,7 +784,7 @@ declare class ContentClient<T extends BaseContent = BaseContent> {
754
784
  * @param where - Filter conditions
755
785
  * @param locale - Optional locale
756
786
  */
757
- fetchFirst(where?: WhereClause<T>, locale?: string): Promise<T | null>;
787
+ fetchFirst(where?: ReadWhere<WhereClause<T>, R>, locale?: string): Promise<T | null>;
758
788
  /**
759
789
  * Create a new content item
760
790
  * @param data - Content data
@@ -778,6 +808,8 @@ declare class ContentClient<T extends BaseContent = BaseContent> {
778
808
  * request adds, as for {@link create}. `ifMatch` and `idempotencyKey` win over the same
779
809
  * header among them. `locale` defaults to the client's own, the locale whose entity tag
780
810
  * {@link fetchOneWithTag} reads, so the tag it hands back is checked against the same locale.
811
+ * @returns The entry, its `_metadata.brokenLinks` naming each entry link another entry publishes
812
+ * that this revision left pointing nowhere — empty when it took no heading away.
781
813
  */
782
814
  update(id: string, data: UpdateInput<T>, options?: {
783
815
  slug?: string;
@@ -785,7 +817,7 @@ declare class ContentClient<T extends BaseContent = BaseContent> {
785
817
  parentId?: string;
786
818
  sortOrder?: number;
787
819
  headers?: Record<string, string>;
788
- } & ConditionalWriteOptions): Promise<T>;
820
+ } & ConditionalWriteOptions): Promise<RevisedContent<T>>;
789
821
  /**
790
822
  * Delete a content item by ID
791
823
  */
@@ -829,15 +861,19 @@ declare class ContentClient<T extends BaseContent = BaseContent> {
829
861
  * The restore is validated as strictly as a publish, so it cannot publish invalid content, and it
830
862
  * records a new version of its own rather than rewinding the counter — so the revert is auditable
831
863
  * and itself reversible.
864
+ *
865
+ * @returns The entry, its `_metadata.leftOut` naming each value of the version the active schema
866
+ * no longer declares, and `_metadata.brokenLinks` the entry links it left pointing nowhere.
832
867
  */
833
- restore(id: string, versionNumber: number, locale: string, options?: ConditionalWriteOptions): Promise<T>;
868
+ restore(id: string, versionNumber: number, locale: string, options?: ConditionalWriteOptions): Promise<RestoredContent<T>>;
834
869
  /**
835
- * Get children of a hierarchical entry
870
+ * Get the direct children of a hierarchical entry. The route lists one level and takes no depth
871
+ * (REL-2195): `{ depth }` was sent as `?depth=`, which the API refused with `400`. A tree nested
872
+ * under each entry is a list or entry read's `query().children()`.
836
873
  * @param id - Parent entry ID
837
- * @param options - Fetch options
874
+ * @param options - Include paths to expand on each child, and the locale to read
838
875
  */
839
876
  children(id: string, options?: {
840
- depth?: number;
841
877
  include?: string[];
842
878
  locale?: string;
843
879
  }): Promise<T[]>;
@@ -853,7 +889,7 @@ declare class ContentClient<T extends BaseContent = BaseContent> {
853
889
  * Create a new ContentClient with a different default locale, fixed: an update of the client's
854
890
  * locale (`updateConfig({ locale })`) does not reach it
855
891
  */
856
- withLocale(locale: string): ContentClient<T>;
892
+ withLocale(locale: string): ContentClient<T, R>;
857
893
  /**
858
894
  * Get the default locale as it is now: the client's, or the one `withLocale()` fixed
859
895
  */
@@ -937,12 +973,6 @@ type AssetVisibility = 'public' | 'protected' | 'private';
937
973
  type FileStatus = 'pending_upload' | 'uploading' | 'processing' | 'ready' | 'failed';
938
974
  /** Storage backend: `r2` = image + file kinds, `stream` = video kind. */
939
975
  type FileBackend = 'r2' | 'stream';
940
- /**
941
- * Customer-facing file binding block on an asset entry: the document's `AssetFile` — status,
942
- * backend, file name, MIME type, size, advisory hash, visibility, extracted metadata, focal point,
943
- * enrichment and scan status, processing stage/progress/error, and video playback readiness.
944
- */
945
- type AssetFileBlock = components['schemas']['AssetFile'];
946
976
  /** Extracted media metadata (Phase 1 basics + Phase 2 enrichment, plans 15–19); open-ended. */
947
977
  type AssetFileExtracted = NonNullable<AssetFileBlock['extracted']>;
948
978
  /**
@@ -951,33 +981,13 @@ type AssetFileExtracted = NonNullable<AssetFileBlock['extracted']>;
951
981
  * nothing of the entry's content. `processing.error` is present exactly while `status` is `failed`.
952
982
  */
953
983
  type FileStatusResult = components['schemas']['FileStatus'];
954
- /**
955
- * Computed gateway delivery URLs (the reserved `urls` key). Always served from
956
- * `cdn.relyio.net`. Image bindings expose `original` + `variants`; video bindings
957
- * expose `playback`/`poster`/`download`. Present only when `file.status` is
958
- * `ready` — otherwise the response omits `urls` and callers read `file.status`.
959
- */
960
- interface AssetUrls {
961
- /** Image: canonical original delivery URL. */
962
- original?: string;
963
- /** Image: variant id → delivery URL map. */
964
- variants?: Record<string, string>;
965
- /** Video: HLS/DASH manifest URL. */
966
- playback?: string;
967
- /** Video: poster image URL. */
968
- poster?: string;
969
- /** Video: downloadable MP4 URL (when enabled). */
970
- download?: string;
971
- [key: string]: unknown;
972
- }
984
+
973
985
  /**
974
986
  * An asset entry response: schema fields at the top level plus the reserved
975
- * `file` + `urls` blocks and `_metadata`. `T` carries the inferred field shape.
987
+ * `file` + `urls` blocks and `_metadata`. `T` carries the inferred field shape — for a typed client
988
+ * `InferAssetType`, so this is `InferAssetEntry`, the shape an expanded asset reads as too.
976
989
  */
977
- type AssetEntryResponse<T extends BaseContent = BaseContent> = T & {
978
- file?: AssetFileBlock;
979
- urls?: AssetUrls;
980
- };
990
+ type AssetEntryResponse<T extends BaseContent = BaseContent> = T & AssetServedBlocks;
981
991
  /** Request a single upload target for the binding. */
982
992
  interface PresignInput {
983
993
  /** Original file name (required). */
@@ -1292,7 +1302,20 @@ declare class AssetUploadBuilder<T extends BaseContent = BaseContent> {
1292
1302
  * over the same dynamic `/{assetType}` routes — assets are `entryType: 'asset'`
1293
1303
  * entries) and adds the `file(uid)` sub-resource builder + an `upload()` helper.
1294
1304
  */
1295
- declare class AssetClient<T extends BaseContent = BaseContent> {
1305
+ /**
1306
+ * An asset read typed by the asset type's reading `R`: what the type's include paths make of its
1307
+ * fields, beside the `file` and `urls` blocks every asset read carries (REL-1801).
1308
+ */
1309
+ interface AssetResponseReading<R extends Reading, T extends BaseContent = BaseContent> extends Reading {
1310
+ readonly read: AssetEntryResponse<Extract<ReadWith<R, this['include']>, BaseContent>>;
1311
+ readonly checked: CheckedInclude<R, this['path']>;
1312
+ /**
1313
+ * The asset type's own `where` — every path the API filters its fields by, never the `file` and
1314
+ * `urls` blocks — or, where no schema types it, the conditions `T`'s keys take (REL-2195).
1315
+ */
1316
+ readonly where: ReadWhere<WhereClause<T>, R>;
1317
+ }
1318
+ declare class AssetClient<T extends BaseContent = BaseContent, R extends Reading = UntypedReading<T>> {
1296
1319
  private readonly httpClient;
1297
1320
  private readonly assetType;
1298
1321
  /** The client's locale, asked on every call rather than copied when this client was taken. */
@@ -1306,16 +1329,19 @@ declare class AssetClient<T extends BaseContent = BaseContent> {
1306
1329
  * Create a query builder for this asset type. It resolves asset reads; its conditions name the
1307
1330
  * asset type's fields, which the `file` and `urls` blocks are not.
1308
1331
  */
1309
- query(): ContentQueryBuilder<AssetEntryResponse<T>, T>;
1332
+ query(): ContentQueryBuilder<AssetEntryResponse<T>, T, AssetResponseReading<R, T>>;
1310
1333
  /** Find an asset entry by id (or slug) with fluent options. */
1311
- findById(id: string): ContentByIdBuilder<AssetEntryResponse<T>>;
1334
+ findById(id: string): ContentByIdBuilder<AssetEntryResponse<T>, AssetResponseReading<R, T>>;
1312
1335
  /** Fetch a single asset entry by id (or slug), or `null` if not found. */
1336
+ fetchOne<const P extends readonly string[]>(id: string, options: {
1337
+ include: CheckedIncludes<R, P>;
1338
+ locale?: string;
1339
+ }): Promise<ReadWith<AssetResponseReading<R, T>, P[number]> | null>;
1313
1340
  fetchOne(id: string, options?: {
1314
- include?: string[];
1315
1341
  locale?: string;
1316
1342
  }): Promise<AssetEntryResponse<T> | null>;
1317
1343
  /** Fetch the first asset entry matching the conditions, or `null`. */
1318
- fetchFirst(where?: WhereClause<T>, locale?: string): Promise<AssetEntryResponse<T> | null>;
1344
+ fetchFirst(where?: ReadWhere<WhereClause<T>, R>, locale?: string): Promise<AssetEntryResponse<T> | null>;
1319
1345
  /**
1320
1346
  * Create a new asset entry as a draft. The binary is uploaded separately via
1321
1347
  * `file(uid)` (or use the high-level `upload()` helper), and the entry
@@ -1369,8 +1395,11 @@ type PopulatedAssetReference<T extends BaseContent = BaseContent> = AssetEntryRe
1369
1395
  interface SingletonFetchOptions {
1370
1396
  /** Locale for localized content */
1371
1397
  locale?: string;
1372
- /** Reference fields to populate */
1373
- include?: string[];
1398
+ /**
1399
+ * Include paths: the references to expand (REL-1801), added to the ones `include()` named — see
1400
+ * `include()`. Typed where the call names them inline.
1401
+ */
1402
+ include?: readonly string[];
1374
1403
  /**
1375
1404
  * The feed position this read follows — a change's `fresh` (`FeedChange`), or a resync's. Sent as
1376
1405
  * `?_fresh`: no cache holds an answer for it from before that position, so the read is answered
@@ -1395,7 +1424,7 @@ interface SingletonFetchOptions {
1395
1424
  * .fetch()
1396
1425
  * ```
1397
1426
  */
1398
- declare class SingletonClient<T = unknown> {
1427
+ declare class SingletonClient<T = unknown, R extends Reading = UntypedReading<T>, I extends string = never> {
1399
1428
  private httpClient;
1400
1429
  private singletonKey;
1401
1430
  private includeFields?;
@@ -1408,10 +1437,14 @@ declare class SingletonClient<T = unknown> {
1408
1437
  */
1409
1438
  constructor(httpClient: HttpClient, singletonKey: string, locale?: ClientLocale);
1410
1439
  /**
1411
- * Include reference fields in the response
1412
- * @param fields - Reference field names to populate
1440
+ * Expand references into the entries they point at: one include path per element (REL-1801).
1441
+ * A path names fields through lists, objects and references — `'hero.media.image'`,
1442
+ * `'featured.author'` — and may pick the fields each entry returns, `'featured(title,slug)'`.
1443
+ * Each is checked against the schema: a path that holds no reference does not compile, and the
1444
+ * read's type follows the paths — an expanded reference is the entry, every other one its id. A
1445
+ * second call adds to the first.
1413
1446
  */
1414
- include(fields: string[]): this;
1447
+ include<const P extends readonly string[]>(paths: CheckedIncludes<R, P>): SingletonClient<ReadWith<R, I | P[number]>, R, I | P[number]>;
1415
1448
  /**
1416
1449
  * Set locale for localized content
1417
1450
  * @param locale - Locale code (e.g., 'en', 'de', 'fr')
@@ -1421,7 +1454,10 @@ declare class SingletonClient<T = unknown> {
1421
1454
  * Fetch the singleton content
1422
1455
  * @param options - Optional fetch options (alternative to fluent methods)
1423
1456
  */
1424
- fetch(options?: SingletonFetchOptions): Promise<T | null>;
1457
+ fetch<const P extends readonly string[]>(options: Omit<SingletonFetchOptions, 'include'> & {
1458
+ include: CheckedIncludes<R, P>;
1459
+ }): Promise<ReadWith<R, I | P[number]> | null>;
1460
+ fetch(options?: Omit<SingletonFetchOptions, 'include'>): Promise<T | null>;
1425
1461
  /**
1426
1462
  * Fetch the singleton **and the entity tag that read served**, which is what
1427
1463
  * `update`'s `ifMatch` takes (`INV-API-CONDITIONAL-WRITE-IS-REACHABLE`).
@@ -1479,7 +1515,7 @@ declare class SingletonClient<T = unknown> {
1479
1515
  /**
1480
1516
  * Reset fluent options for reuse
1481
1517
  */
1482
- reset(): this;
1518
+ reset(): SingletonClient<ReadWith<R, never>, R>;
1483
1519
  }
1484
1520
 
1485
1521
  /**
@@ -1488,8 +1524,11 @@ declare class SingletonClient<T = unknown> {
1488
1524
  interface SettingsFetchOptions {
1489
1525
  /** Locale for localized settings */
1490
1526
  locale?: string;
1491
- /** Reference fields to populate */
1492
- include?: string[];
1527
+ /**
1528
+ * Include paths: the references to expand (REL-1801), added to the ones `include()` named — see
1529
+ * `include()`. Typed where the call names them inline.
1530
+ */
1531
+ include?: readonly string[];
1493
1532
  }
1494
1533
  /**
1495
1534
  * Settings client for managing settings group operations
@@ -1508,7 +1547,7 @@ interface SettingsFetchOptions {
1508
1547
  * .fetch()
1509
1548
  * ```
1510
1549
  */
1511
- declare class SettingsClient<T = unknown> {
1550
+ declare class SettingsClient<T = unknown, R extends Reading = UntypedReading<T>, I extends string = never> {
1512
1551
  private readonly httpClient;
1513
1552
  private readonly groupId;
1514
1553
  private includeFields?;
@@ -1521,10 +1560,14 @@ declare class SettingsClient<T = unknown> {
1521
1560
  */
1522
1561
  constructor(httpClient: HttpClient, groupId: string, locale?: ClientLocale);
1523
1562
  /**
1524
- * Include reference fields in the response
1525
- * @param fields - Reference field names to populate
1563
+ * Expand references into the entries they point at: one include path per element (REL-1801).
1564
+ * A path names fields through lists, objects and references — `'hero.media.image'`,
1565
+ * `'featured.author'` — and may pick the fields each entry returns, `'featured(title,slug)'`.
1566
+ * Each is checked against the schema: a path that holds no reference does not compile, and the
1567
+ * read's type follows the paths — an expanded reference is the entry, every other one its id. A
1568
+ * second call adds to the first.
1526
1569
  */
1527
- include(fields: string[]): this;
1570
+ include<const P extends readonly string[]>(paths: CheckedIncludes<R, P>): SettingsClient<ReadWith<R, I | P[number]>, R, I | P[number]>;
1528
1571
  /**
1529
1572
  * Set locale for localized settings
1530
1573
  * @param locale - Locale code (e.g., 'en', 'de', 'fr')
@@ -1534,7 +1577,10 @@ declare class SettingsClient<T = unknown> {
1534
1577
  * Fetch the settings group
1535
1578
  * @param options - Optional fetch options (alternative to fluent methods)
1536
1579
  */
1537
- fetch(options?: SettingsFetchOptions): Promise<T | null>;
1580
+ fetch<const P extends readonly string[]>(options: Omit<SettingsFetchOptions, 'include'> & {
1581
+ include: CheckedIncludes<R, P>;
1582
+ }): Promise<ReadWith<R, I | P[number]> | null>;
1583
+ fetch(options?: Omit<SettingsFetchOptions, 'include'>): Promise<T | null>;
1538
1584
  /**
1539
1585
  * Update settings group
1540
1586
  *
@@ -1605,12 +1651,12 @@ declare class SettingsClient<T = unknown> {
1605
1651
  /**
1606
1652
  * Reset fluent options for reuse
1607
1653
  */
1608
- resetOptions(): this;
1654
+ resetOptions(): SettingsClient<ReadWith<R, never>, R>;
1609
1655
  }
1610
1656
 
1611
1657
  /**
1612
1658
  * Any schema the client can be typed by. `any` is deliberate: the client accepts whatever content
1613
- * types, components, singletons, queries and settings groups a customer declares.
1659
+ * types, singletons, queries and settings groups a customer declares.
1614
1660
  *
1615
1661
  * This is the constraint `TypedRelyIOClient`'s `TSchema` carries, so `RegisteredSchema` is inferred
1616
1662
  * against the same one — `createClient` returns `TypedRelyIOClient<RegisteredSchema>`, and a schema
@@ -1666,9 +1712,12 @@ type SearchHitSystemFields = Pick<components['schemas']['SearchHit'], '_metadata
1666
1712
  * `_metadata`, and the score annotations the request asked for. There is no per-item `data` wrapper.
1667
1713
  *
1668
1714
  * `T`'s `_metadata` is replaced, not kept: `T` is an entry type, and a hit is not an entry read.
1669
- * Distributes over a union of entry types, so a search across two types keeps each one's fields.
1715
+ * Every field is optional, a required one too: a `fields` projection names only some of them, and a
1716
+ * hit is built from the search row, not by the read that fills a required field a draft holds empty
1717
+ * (REL-1795). Distributes over a union of entry types, so a search across two types keeps each
1718
+ * one's fields.
1670
1719
  */
1671
- type SearchResultItem<T = unknown> = T extends unknown ? Omit<T, '_metadata'> & SearchHitSystemFields : never;
1720
+ type SearchResultItem<T = unknown> = T extends unknown ? Partial<Omit<T, '_metadata'>> & SearchHitSystemFields : never;
1672
1721
  /**
1673
1722
  * Search response from API
1674
1723
  */
@@ -3203,7 +3252,7 @@ declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined
3203
3252
  * .execute()
3204
3253
  * ```
3205
3254
  */
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>;
3255
+ 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
3256
  /**
3208
3257
  * Get an asset client for a specific asset type.
3209
3258
  *
@@ -3222,7 +3271,7 @@ declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined
3222
3271
  * const heroUrl = await relyio.asset('productPhoto').file(photo._metadata.id).url({ variantId: 'hero' })
3223
3272
  * ```
3224
3273
  */
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>;
3274
+ 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
3275
  /**
3227
3276
  * Get a singleton client for a specific singleton key
3228
3277
  * Type-safe when schema is provided: autocompletes singleton names AND field names
@@ -3235,7 +3284,7 @@ declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined
3235
3284
  * .fetch()
3236
3285
  * ```
3237
3286
  */
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>;
3287
+ 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
3288
  /**
3240
3289
  * Get a settings client for a specific settings group
3241
3290
  * Type-safe when schema is provided: autocompletes settings group names AND field names
@@ -3247,7 +3296,7 @@ declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined
3247
3296
  * .fetch()
3248
3297
  * ```
3249
3298
  */
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>;
3299
+ 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
3300
  /**
3252
3301
  * Start a search query with full-text, semantic, or hybrid search.
3253
3302
  *
@@ -3665,4 +3714,4 @@ declare function createClient<TSchema extends AnySchemaDefinition>(config: Typed
3665
3714
  */
3666
3715
  type ClientSchema<T extends TypedRelyIOClient<AnySchemaDefinition>> = T extends TypedRelyIOClient<infer TSchema> ? TSchema : never;
3667
3716
 
3668
- export { type BatchOptions as $, type ActiveSandbox as A, type SearchMode as B, type Change as C, type SearchResultItem as D, type ExtendedQueryResult as E, type FeedChange as F, type SearchHitMetadata as G, HttpClient as H, type SearchResponse as I, type AutocompleteSuggestion as J, type AutocompleteResponse as K, LIVE_KEEPALIVE_INTERVAL_MS as L, type SimilarResult as M, type SimilarResponse as N, type SearchFilter as O, type Project as P, type SearchFields as Q, type Register as R, type SandboxState as S, TypedRelyIOClient as T, type SearchSort as U, type SearchTypeName as V, type SearchEntry as W, BatchClient as X, BatchBuilder as Y, type BatchMethod as Z, type BatchOperation as _, ChangesExpiredError as a, type BatchOperationResult as a0, type BatchSummary as a1, type BatchResponse as a2, AdhocQueryClient as a3, AdhocQueryBuilder as a4, type FetchBlock as a5, type AggregateBlock as a6, type AggregateMetric as a7, type SearchBlock as a8, type FilterValue as a9, type MultipartCreateResult as aA, type MultipartPart as aB, type MultipartTarget as aC, type UploadProgress as aD, ResourceNotFoundError as aE, ResourceConflictError as aF, ResourceExpiredError as aG, isResourceNotFound as aH, type FileErrorCode as aI, type FileUploadErrorCode as aJ, FileUploadError as aK, FileValidationError as aL, type FileValidationConstraints as aM, validateFile as aN, type FullTextConfig as aa, type AdhocQueryDefinition as ab, type AdhocQueryOptions as ac, type QueryMetadata as ad, type AdhocQueryResult as ae, AssetClient as af, AssetFileBuilder as ag, AssetUploadBuilder as ah, isAssetEntry as ai, type AssetVisibility as aj, type FileStatus as ak, type FileBackend as al, type AssetFileBlock as am, type AssetFileExtracted as an, type FileStatusResult as ao, type AssetUrls as ap, type AssetEntryResponse as aq, type PopulatedAssetReference as ar, type PresignInput as as, type PresignResult as at, type ConfirmInput as au, type ConfirmResult as av, type ResolveUrlInput as aw, type ResolveUrlResult as ax, type CreateAssetOptions as ay, type WaitUntilReadyOptions as az, type ChangesExpiredReason as b, createClient as c, type TypedClientConfig as d, type ClientSchema as e, type RegisteredSchema as f, type SendOptions as g, entityTagOf as h, type ConditionalWriteOptions as i, type RetryableWriteOptions as j, type ChangesHeadOptions as k, type ChangesOptions as l, LIVE_SOCKET_OPEN_TIMEOUT_MS as m, type LiveChangesOptions as n, ContentClient as o, SingletonClient as p, SettingsClient as q, ContentQueryBuilder as r, ContentByIdBuilder as s, type ChildrenOptions as t, type SingletonFetchOptions as u, type SettingsFetchOptions as v, SearchClient as w, SearchBuilder as x, AutocompleteBuilder as y, SimilarBuilder as z };
3717
+ export { type BatchOptions as $, type ActiveSandbox as A, type SearchMode as B, type Change as C, type SearchResultItem as D, type ExtendedQueryResult as E, type FeedChange as F, type SearchHitMetadata as G, HttpClient as H, type SearchResponse as I, type AutocompleteSuggestion as J, type AutocompleteResponse as K, LIVE_KEEPALIVE_INTERVAL_MS as L, type SimilarResult as M, type SimilarResponse as N, type SearchFilter as O, type Project as P, type SearchFields as Q, type Register as R, type SandboxState as S, TypedRelyIOClient as T, type SearchSort as U, type SearchTypeName as V, type SearchEntry as W, BatchClient as X, BatchBuilder as Y, type BatchMethod as Z, type BatchOperation as _, ChangesExpiredError as a, type BatchOperationResult as a0, type BatchSummary as a1, type BatchResponse as a2, AdhocQueryClient as a3, AdhocQueryBuilder as a4, type FetchBlock as a5, type AggregateBlock as a6, type AggregateMetric as a7, type SearchBlock as a8, type FilterValue as a9, type MultipartTarget as aA, type UploadProgress as aB, ResourceNotFoundError as aC, ResourceConflictError as aD, ResourceExpiredError as aE, isResourceNotFound as aF, type FileErrorCode as aG, type FileUploadErrorCode as aH, FileUploadError as aI, FileValidationError as aJ, type FileValidationConstraints as aK, validateFile as aL, type FullTextConfig as aa, type AdhocQueryDefinition as ab, type AdhocQueryOptions as ac, type QueryMetadata as ad, type AdhocQueryResult as ae, AssetClient as af, AssetFileBuilder as ag, AssetUploadBuilder as ah, isAssetEntry as ai, type AssetVisibility as aj, type FileStatus as ak, type FileBackend as al, type AssetFileExtracted as am, type FileStatusResult as an, type AssetEntryResponse as ao, type PopulatedAssetReference as ap, type PresignInput as aq, type PresignResult as ar, type ConfirmInput as as, type ConfirmResult as at, type ResolveUrlInput as au, type ResolveUrlResult as av, type CreateAssetOptions as aw, type WaitUntilReadyOptions as ax, type MultipartCreateResult as ay, type MultipartPart as az, type ChangesExpiredReason as b, createClient as c, type TypedClientConfig as d, type ClientSchema as e, type RegisteredSchema as f, type SendOptions as g, entityTagOf as h, type ConditionalWriteOptions as i, type RetryableWriteOptions as j, type ChangesHeadOptions as k, type ChangesOptions as l, LIVE_SOCKET_OPEN_TIMEOUT_MS as m, type LiveChangesOptions as n, ContentClient as o, SingletonClient as p, SettingsClient as q, ContentQueryBuilder as r, ContentByIdBuilder as s, type ChildrenOptions as t, type SingletonFetchOptions as u, type SettingsFetchOptions as v, SearchClient as w, SearchBuilder as x, AutocompleteBuilder as y, SimilarBuilder as z };