@relyio/sdk 0.5.0 → 0.7.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 (37) hide show
  1. package/CHANGELOG.md +540 -0
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/{chunk-HAQELDZN.cjs → chunk-72UK5U7T.cjs} +70 -60
  4. package/dist/{chunk-5AZUUV5B.js → chunk-GYHAVYND.js} +1086 -494
  5. package/dist/{chunk-I3ESNANB.js → chunk-H6IBQSMM.js} +2 -2
  6. package/dist/{chunk-HT6NFRM2.cjs → chunk-TZL374LS.cjs} +2 -2
  7. package/dist/{chunk-CIRT6TVT.cjs → chunk-VH2DE7HZ.cjs} +1088 -497
  8. package/dist/{chunk-XY5KFEFY.js → chunk-YEJUMW4X.js} +70 -60
  9. package/dist/client/index.cjs +4 -3
  10. package/dist/client/index.d.cts +4 -4
  11. package/dist/client/index.d.ts +4 -4
  12. package/dist/client/index.js +2 -1
  13. package/dist/{index-C5mRBb6t.d.cts → define-content-type-DiVpbwNs.d.cts} +1629 -665
  14. package/dist/{index-mXUx2H99.d.ts → define-content-type-DiVpbwNs.d.ts} +1629 -665
  15. package/dist/{define-schema-DzYXk4HL.d.ts → define-schema-C-5an28C.d.ts} +211 -429
  16. package/dist/{define-schema-2xbHgtK-.d.cts → define-schema-D7MButVt.d.cts} +211 -429
  17. package/dist/{index-Dzo-upNS.d.ts → index-1G97sNA8.d.ts} +677 -296
  18. package/dist/index-BOQIHnsh.d.ts +818 -0
  19. package/dist/index-DbsTUw3Q.d.cts +818 -0
  20. package/dist/{index-BozPz4n1.d.cts → index-M0X45k7J.d.cts} +677 -296
  21. package/dist/index.cjs +180 -103
  22. package/dist/index.d.cts +307 -32
  23. package/dist/index.d.ts +307 -32
  24. package/dist/index.js +95 -8
  25. package/dist/schema/index.cjs +35 -35
  26. package/dist/schema/index.d.cts +21 -15
  27. package/dist/schema/index.d.ts +21 -15
  28. package/dist/schema/index.js +1 -1
  29. package/dist/types/index.d.cts +2 -2
  30. package/dist/types/index.d.ts +2 -2
  31. package/dist/utils/index.cjs +19 -19
  32. package/dist/utils/index.d.cts +10 -1
  33. package/dist/utils/index.d.ts +10 -1
  34. package/dist/utils/index.js +1 -1
  35. package/package.json +4 -3
  36. package/dist/define-content-type-CBfnTWSS.d.cts +0 -716
  37. package/dist/define-content-type-CBfnTWSS.d.ts +0 -716
@@ -1,6 +1,6 @@
1
- import { J as MergedRelyIOConfig, A as ApiPath, a as ApiMethod, K as PathParamsOf, t as ApiResponse, W as Wire, s as RequestConfig, B as BaseContent, d as WhereClause, f as SortOptions, g as ContentQueryResult, Q as QueryOptions, C as CreateInput, U as UpdateInput, S as SDKError, x as BaseValidationError, w as ValidationViolation, N as components, O as paths, R as RelyIOConfig } from './index-mXUx2H99.js';
2
- import { a as SchemaDefinition, b as SchemaContentTypeNames, h as SchemaAssetTypeNames, M as InferAssetType, c as SchemaSingletonNames, t as InferSingleton, g as SchemaSettingsGroupNames, E as InferSettingsGroup, e as SchemaQueryNames, f as SchemaLocaleCodes } from './define-schema-DzYXk4HL.js';
3
- import { J as InferContentType } from './define-content-type-CBfnTWSS.js';
1
+ import { H as MergedRelyIOConfig, A as ApiPath, b as ApiMethod, J as PathParamsOf, v as ApiResponse, W as Wire, u as RequestConfig, B as BaseContent, g as WhereClause, Q as QueryOptions, i as SortOptions, j as ContentQueryResult, C as CreateInput, U as UpdateInput, S as SDKError, z as BaseValidationError, y as ValidationViolation, R as RelyIOConfig, a as RelyIOConfigUpdate } from './index-BOQIHnsh.js';
2
+ import { aK as components, aJ as paths, W as InferContentType, aa as InferAssetType, a3 as InferSingleton } from './define-content-type-DiVpbwNs.js';
3
+ import { a as SchemaDefinition, b as SchemaContentTypeNames, j as SchemaEntryOf, ay as FilterOperator, h as SchemaAssetTypeNames, c as SchemaSingletonNames, g as SchemaSettingsGroupNames, I as InferSettingsGroup, e as SchemaQueryNames, f as SchemaLocaleCodes } from './define-schema-C-5an28C.js';
4
4
  import { DevUnreadableReason } from './dev-handshake/index.js';
5
5
 
6
6
  /**
@@ -99,14 +99,21 @@ type SendOptions<P extends ApiPath, M extends ApiMethod<P>> = {
99
99
  * nothing inside the SDK uses them.
100
100
  */
101
101
  declare class HttpClient {
102
- private baseUrl;
103
- private defaultHeaders;
104
- private timeout;
105
- private retryPolicy;
106
- private debug;
107
- private logger?;
108
- private config;
102
+ /** What every request reads off the configuration, derived by {@link configure} and nowhere else. */
103
+ private connection;
109
104
  constructor(config: MergedRelyIOConfig);
105
+ /**
106
+ * Run on `config` from now on: every later request — whoever holds this client — is sent to its
107
+ * `baseUrl`, with its headers, key and dataset, its timeout and retries, through its `fetch`, and
108
+ * logged by its `debug` options.
109
+ *
110
+ * The client's own `updateConfig()` calls this rather than building a second client, so a
111
+ * `content()` or other sub-client taken before the update sends through the update too. Anything
112
+ * set on this client since it was last configured — `setDefaultHeaders()`, `setBaseUrl()` — is
113
+ * replaced by what `config` says.
114
+ */
115
+ configure(config: MergedRelyIOConfig): void;
116
+ private announce;
110
117
  /**
111
118
  * Call a route the committed document declares, and get back the body that
112
119
  * document says it serves.
@@ -129,7 +136,17 @@ declare class HttpClient {
129
136
  *
130
137
  * The loop always makes one attempt. The incumbent's `while (attempt <
131
138
  * maxAttempts)` made none at `retryAttempts: 0` — a value the config validator
132
- * accepts — and then dereferenced an unassigned `lastError`.
139
+ * then accepted, and now refuses — and then dereferenced an unassigned
140
+ * `lastError`. `retryAttempts` is the most attempts, the first included; an
141
+ * `HttpClient` constructed directly is not validated, so the first attempt
142
+ * stays unconditional.
143
+ *
144
+ * A request that would carry no `X-API-Key` makes none: it rejects with
145
+ * `MissingApiKeyError` before `fetch` is called, is not retried, and names
146
+ * `apiKey`. This is where a client built without a key learns it — the
147
+ * constructor accepts one so that a module-scope client can be evaluated by a
148
+ * build that holds no key (REL-1120) — and so does one whose `setApiKey` was
149
+ * given none.
133
150
  */
134
151
  request<T = unknown>(config: RequestConfig): Promise<ApiResponse<T>>;
135
152
  /**
@@ -153,13 +170,28 @@ declare class HttpClient {
153
170
  */
154
171
  patch<T = unknown>(url: string, data?: unknown, params?: Record<string, unknown>): Promise<ApiResponse<T>>;
155
172
  /**
156
- * Set default headers for all requests
173
+ * Add headers to every later request, each replacing any header of the same name — the name
174
+ * matched without regard to case — until the client is next configured.
157
175
  */
158
176
  setDefaultHeaders(headers: Record<string, string>): void;
159
177
  /**
160
- * Set authentication token
178
+ * Replace the key every later request sends as `X-API-Key`, and the `apiKey` the configuration
179
+ * reports.
180
+ *
181
+ * The key is read the way construction reads it (`presentKey`): an absent, empty or blank key is
182
+ * no key, so the header is dropped and the next request is refused with `MissingApiKeyError`
183
+ * before anything is sent. A key header of any other spelling — one given in `headers` — goes
184
+ * too, from the headers sent and from the headers the configuration reports, so the old key is
185
+ * never sent beside the new one.
186
+ *
187
+ * The configuration is the one the owning `TypedRelyIOClient` holds (it hands its own to the
188
+ * constructor), so its `getConfig().apiKey` — what a surface reads to decide a key's kind — is the
189
+ * key sent from here on.
190
+ *
191
+ * This replaced `setAuthToken`, which added `Authorization: Bearer` beside an `X-API-Key` it
192
+ * never touched: the API reads `X-API-Key` first, so the old key was the one used (REL-1385).
161
193
  */
162
- setAuthToken(token: string): void;
194
+ setApiKey(apiKey: string): void;
163
195
  /**
164
196
  * Get current default headers
165
197
  */
@@ -184,7 +216,12 @@ declare class HttpClient {
184
216
  */
185
217
  private makeRequest;
186
218
  /**
187
- * Filter headers that browsers don't allow to be set manually
219
+ * The headers without those a browser controls itself, when this is a browser; unchanged when it
220
+ * is not.
221
+ *
222
+ * A name is matched without regard to case (RFC 9110 §5.1), because a browser refuses `Origin`
223
+ * whatever case a page spells it in. This matched only the all-lowercase and all-uppercase
224
+ * spellings, so `Origin` and `User-Agent` — how people write them — reached `fetch` (REL-1409).
188
225
  */
189
226
  private filterHeadersForBrowser;
190
227
  /**
@@ -196,11 +233,21 @@ declare class HttpClient {
196
233
  private mergeRequestConfig;
197
234
  private buildQueryString;
198
235
  private headersToObject;
199
- /** A backoff the caller's abort cuts short; the next attempt then refuses to send. */
200
- private sleep;
201
236
  private log;
202
237
  }
203
238
 
239
+ /**
240
+ * The client's locale as a sub-client holds it: a function it asks on every call, or a locale fixed
241
+ * when it was built.
242
+ *
243
+ * `TypedRelyIOClient` hands every sub-client and builder a function over the configuration it holds,
244
+ * so one taken before `updateConfig({ locale })` sends the locale the client holds when the call is
245
+ * made, and none once `updateConfig({ locale: null })` has cleared it (REL-1453). A string is a locale
246
+ * fixed at construction — a sub-client's own `withLocale()`, or one built directly — and stays what it
247
+ * was.
248
+ */
249
+ type ClientLocale = string | (() => string | undefined);
250
+
204
251
  /**
205
252
  * Children population options
206
253
  */
@@ -240,10 +287,9 @@ type ExtendedQueryResult<T extends BaseContent = BaseContent> = ContentQueryResu
240
287
  * .execute()
241
288
  * ```
242
289
  */
243
- declare class ContentQueryBuilder<T extends BaseContent = BaseContent> {
290
+ declare class ContentQueryBuilder<T extends BaseContent = BaseContent, F extends BaseContent = T> {
244
291
  private readonly httpClient;
245
292
  private readonly contentType;
246
- private readonly defaultLocale?;
247
293
  private queryOptions;
248
294
  private localeValue?;
249
295
  private localesArray?;
@@ -252,15 +298,29 @@ declare class ContentQueryBuilder<T extends BaseContent = BaseContent> {
252
298
  private childrenOptions?;
253
299
  private pageNumber?;
254
300
  private pageSizeValue?;
255
- constructor(httpClient: HttpClient, contentType: string, defaultLocale?: string | undefined);
301
+ private requestHeaders?;
302
+ /** The client's locale, asked when the query is sent rather than copied when it was built. */
303
+ private readonly clientLocale;
304
+ /**
305
+ * @param locale - The client's locale (`withLocale()`, `updateConfig({ locale })`), sent when the
306
+ * query names none: the function `TypedRelyIOClient` hands over, or a locale fixed for it
307
+ */
308
+ constructor(httpClient: HttpClient, contentType: string, locale?: ClientLocale);
309
+ /**
310
+ * Headers this query adds to the client's own, e.g. `X-RelyIO-Dataset` to list another dataset
311
+ * the key can see. A name the client already sends is replaced for this query only; the client
312
+ * is not changed.
313
+ */
314
+ headers(headers: Record<string, string>): this;
256
315
  /**
257
- * Add where conditions to the query
316
+ * Add where conditions to the query: conditions on the fields the content type declares. A
317
+ * condition on `_metadata` is refused here, before anything is sent (`refuseMetadataConditions`).
258
318
  */
259
- where(conditions: WhereClause<T>): this;
319
+ where(conditions: WhereClause<F>): this;
260
320
  /**
261
321
  * Select specific fields to return
262
322
  */
263
- select(fields: (keyof T)[]): this;
323
+ select(fields: NonNullable<QueryOptions<T, F>['select']>): this;
264
324
  /**
265
325
  * Include related content in the response
266
326
  */
@@ -278,7 +338,7 @@ declare class ContentQueryBuilder<T extends BaseContent = BaseContent> {
278
338
  * ```
279
339
  */
280
340
  sort(field: string, direction: 'asc' | 'desc'): this;
281
- sort(sortOptions: SortOptions<T>): this;
341
+ sort(sortOptions: SortOptions<F>): this;
282
342
  /**
283
343
  * Sort by a specific field in ascending order
284
344
  */
@@ -407,11 +467,11 @@ declare class ContentQueryBuilder<T extends BaseContent = BaseContent> {
407
467
  /**
408
468
  * Clone the query builder
409
469
  */
410
- clone(): ContentQueryBuilder<T>;
470
+ clone(): ContentQueryBuilder<T, F>;
411
471
  /**
412
472
  * Get the current query options
413
473
  */
414
- getQueryOptions(): QueryOptions<T>;
474
+ getQueryOptions(): QueryOptions<T, F>;
415
475
  /**
416
476
  * Execute the query and return the whole body.
417
477
  *
@@ -448,13 +508,19 @@ declare class ContentByIdBuilder<T extends BaseContent = BaseContent> {
448
508
  private readonly httpClient;
449
509
  private readonly contentType;
450
510
  private readonly id;
451
- private readonly defaultLocale?;
452
511
  private includeRelations?;
453
512
  private localeValue?;
454
513
  private localesArray?;
455
514
  private fetchAllLocales;
456
515
  private childrenOptions?;
457
- constructor(httpClient: HttpClient, contentType: string, id: string, defaultLocale?: string | undefined);
516
+ private requestHeaders?;
517
+ /** The client's locale, asked when the read is sent rather than copied when it was built. */
518
+ private readonly clientLocale;
519
+ /**
520
+ * @param locale - The client's locale (`withLocale()`, `updateConfig({ locale })`), sent when the
521
+ * read names none: the function `TypedRelyIOClient` hands over, or a locale fixed for it
522
+ */
523
+ constructor(httpClient: HttpClient, contentType: string, id: string, locale?: ClientLocale);
458
524
  /**
459
525
  * Include related content in the response
460
526
  */
@@ -471,6 +537,12 @@ declare class ContentByIdBuilder<T extends BaseContent = BaseContent> {
471
537
  * @param localeCodes - Array of locale codes to fetch
472
538
  */
473
539
  locales(localeCodes: string[]): this;
540
+ /**
541
+ * Headers this one read adds to the client's own, e.g. `X-RelyIO-Dataset` to read another dataset
542
+ * the key can see. A name the client already sends is replaced for this request only; the client
543
+ * is not changed.
544
+ */
545
+ headers(headers: Record<string, string>): this;
474
546
  /**
475
547
  * Fetch content in all available locales
476
548
  * Returns default locale at top level, others in _metadata.localizations
@@ -597,8 +669,13 @@ interface ContentFetchOptions<T extends BaseContent = BaseContent> {
597
669
  declare class ContentClient<T extends BaseContent = BaseContent> {
598
670
  private readonly httpClient;
599
671
  private readonly contentType;
600
- private readonly defaultLocale?;
601
- constructor(httpClient: HttpClient, contentType: string, defaultLocale?: string | undefined);
672
+ /** The client's locale, asked on every call rather than copied when this client was taken. */
673
+ private readonly clientLocale;
674
+ /**
675
+ * @param locale - The client's locale: the function `TypedRelyIOClient` hands over, asked on
676
+ * every call, or a locale fixed for this client
677
+ */
678
+ constructor(httpClient: HttpClient, contentType: string, locale?: ClientLocale);
602
679
  /**
603
680
  * Create a new query builder for this content type
604
681
  */
@@ -619,11 +696,13 @@ declare class ContentClient<T extends BaseContent = BaseContent> {
619
696
  /**
620
697
  * Fetch a single content item by ID
621
698
  * @param id - Entry ID or slug
622
- * @param options - Fetch options (include, locale)
699
+ * @param options - Fetch options (include, locale, and `headers` this one request adds — e.g.
700
+ * `{ 'X-RelyIO-Dataset': 'staging' }` to read a dataset other than the client's)
623
701
  */
624
702
  fetchOne(id: string, options?: {
625
703
  include?: string[];
626
704
  locale?: string;
705
+ headers?: Record<string, string>;
627
706
  }): Promise<T | null>;
628
707
  /**
629
708
  * Fetch one entry **and the entity tag that read served**.
@@ -637,10 +716,16 @@ declare class ContentClient<T extends BaseContent = BaseContent> {
637
716
  * `entityTag` is `undefined` when the response came from the cache: a cached
638
717
  * body cannot know the current version, and an absent tag beats a stale one
639
718
  * that would refuse the next write.
719
+ *
720
+ * Unlike {@link fetchOne}, a missing entry is not `null`: the service's
721
+ * `RESOURCE_NOT_FOUND` is thrown as it arrived, with the `kind` that says
722
+ * whether the entry, the content type or the schema was missing. `headers`
723
+ * are the ones this read adds, as for `fetchOne`.
640
724
  */
641
725
  fetchOneWithTag(id: string, options?: {
642
726
  include?: string[];
643
727
  locale?: string;
728
+ headers?: Record<string, string>;
644
729
  }): Promise<{
645
730
  entry: T;
646
731
  entityTag?: string;
@@ -654,25 +739,33 @@ declare class ContentClient<T extends BaseContent = BaseContent> {
654
739
  /**
655
740
  * Create a new content item
656
741
  * @param data - Content data
657
- * @param options - Create options (slug, locale, parentId, sortOrder)
742
+ * @param options - Create options (slug, locale, parentId, sortOrder), and `headers` this one
743
+ * request adds — e.g. `{ 'X-RelyIO-Dataset': 'staging' }` to write a dataset other than the
744
+ * client's. They are sent, never put in the body; `idempotencyKey` still wins over an
745
+ * `Idempotency-Key` among them. `locale` defaults to the client's own (`withLocale()`).
658
746
  */
659
747
  create(data: CreateInput<T>, options?: {
660
748
  slug?: string;
661
749
  locale?: string;
662
750
  parentId?: string;
663
751
  sortOrder?: number;
752
+ headers?: Record<string, string>;
664
753
  } & RetryableWriteOptions): Promise<T>;
665
754
  /**
666
755
  * Update a content item by ID (partial update)
667
756
  * @param id - Entry ID
668
757
  * @param data - Fields to update
669
- * @param options - Update options (slug, locale, parentId, sortOrder)
758
+ * @param options - Update options (slug, locale, parentId, sortOrder), and `headers` this one
759
+ * request adds, as for {@link create}. `ifMatch` and `idempotencyKey` win over the same
760
+ * header among them. `locale` defaults to the client's own, the locale whose entity tag
761
+ * {@link fetchOneWithTag} reads, so the tag it hands back is checked against the same locale.
670
762
  */
671
763
  update(id: string, data: UpdateInput<T>, options?: {
672
764
  slug?: string;
673
765
  locale?: string;
674
766
  parentId?: string;
675
767
  sortOrder?: number;
768
+ headers?: Record<string, string>;
676
769
  } & ConditionalWriteOptions): Promise<T>;
677
770
  /**
678
771
  * Delete a content item by ID
@@ -686,8 +779,9 @@ declare class ContentClient<T extends BaseContent = BaseContent> {
686
779
  * Get version history for one locale of an entry.
687
780
  *
688
781
  * Versions are numbered per locale, so this is one locale's timeline: `locale` defaults to the
689
- * schema default, no fallback is applied, and a locale with no history returns an empty array
690
- * rather than another locale's rows. Every row names the locale it belongs to.
782
+ * client's own (`withLocale()`), else the schema default; no fallback is applied, and a locale
783
+ * with no history returns an empty array rather than another locale's rows. Every row names the
784
+ * locale it belongs to.
691
785
  */
692
786
  versions(id: string, options?: {
693
787
  limit?: number;
@@ -699,8 +793,8 @@ declare class ContentClient<T extends BaseContent = BaseContent> {
699
793
  /**
700
794
  * Get a specific version of an entry.
701
795
  *
702
- * `locale` defaults to the schema default. Version numbers are per locale, so version 2 is
703
- * different content in each one.
796
+ * `locale` defaults to the client's own (`withLocale()`), else the schema default. Version
797
+ * numbers are per locale, so version 2 is different content in each one.
704
798
  */
705
799
  version(id: string, versionNumber: number, options?: {
706
800
  locale?: string;
@@ -737,11 +831,12 @@ declare class ContentClient<T extends BaseContent = BaseContent> {
737
831
  */
738
832
  ofType<U extends BaseContent = BaseContent>(contentType: string): ContentClient<U>;
739
833
  /**
740
- * Create a new ContentClient with a different default locale
834
+ * Create a new ContentClient with a different default locale, fixed: an update of the client's
835
+ * locale (`updateConfig({ locale })`) does not reach it
741
836
  */
742
837
  withLocale(locale: string): ContentClient<T>;
743
838
  /**
744
- * Get the current default locale
839
+ * Get the default locale as it is now: the client's, or the one `withLocale()` fixed
745
840
  */
746
841
  getDefaultLocale(): string | undefined;
747
842
  }
@@ -752,21 +847,40 @@ declare class ContentClient<T extends BaseContent = BaseContent> {
752
847
  * A **thin customer-side mirror** of the realtime-contracts `FileErrorCode`
753
848
  * (correction C6 — the SDK must not import the server/Studio contracts package).
754
849
  * Keep the members in sync with `@relyio/realtime-contracts`.
850
+ *
851
+ * Written once, as values, because a processing failure's code arrives as a string the service
852
+ * stored and has to be recognised at runtime; `FileErrorCode` is read off this list. The module is
853
+ * internal — `errors/index.ts` does not re-export it — so the list is not a second public name for
854
+ * the type.
855
+ */
856
+ declare const FILE_ERROR_CODES: readonly ["UPLOAD_TOO_LARGE", "UNSUPPORTED_MIME", "DIMENSION_OUT_OF_RANGE", "ASPECT_RATIO", "CORRUPT_FILE", "UNSUPPORTED_CODEC", "IMAGES_LIMIT_EXCEEDED", "STREAM_ENCODE_FAILED", "SCAN_INFECTED", "INTERNAL"];
857
+
858
+ /**
859
+ * Upload/processing error taxonomy (plan 17, 00b Step 4): a customer-side mirror of the
860
+ * realtime-contracts `FileErrorCode`, read off the list in `./file-error-codes`.
755
861
  */
756
- type FileErrorCode = 'UPLOAD_TOO_LARGE' | 'UNSUPPORTED_MIME' | 'DIMENSION_OUT_OF_RANGE' | 'ASPECT_RATIO' | 'CORRUPT_FILE' | 'UNSUPPORTED_CODEC' | 'IMAGES_LIMIT_EXCEEDED' | 'STREAM_ENCODE_FAILED' | 'SCAN_INFECTED' | 'INTERNAL';
862
+ type FileErrorCode = (typeof FILE_ERROR_CODES)[number];
863
+ /**
864
+ * The code a {@link FileUploadError} carries: a {@link FileErrorCode}, or `PROCESSING_FAILED` for a
865
+ * processing failure this SDK cannot name — the service stored no code, as an image or file
866
+ * processing failure is stored today, or one this version of the SDK predates. What the service
867
+ * stored is in the error's `context.processingError` either way.
868
+ */
869
+ type FileUploadErrorCode = FileErrorCode | 'PROCESSING_FAILED';
757
870
  /**
758
871
  * A failure during the upload protocol (presign / PUT / multipart / confirm) or
759
- * surfaced by the server's processing pipeline. Carries a typed {@link FileErrorCode}
872
+ * surfaced by the server's processing pipeline. Carries a typed {@link FileUploadErrorCode}
760
873
  * and a `retriable` hint so callers (and `upload()`'s bounded auto-retry) can
761
874
  * decide whether to retry on the same entry.
762
875
  */
763
876
  declare class FileUploadError extends SDKError {
764
- readonly code: FileErrorCode;
877
+ readonly code: FileUploadErrorCode;
765
878
  readonly retryable: boolean;
766
- constructor(code: FileErrorCode, message: string, options?: {
879
+ constructor(code: FileUploadErrorCode, message: string, options?: {
767
880
  retriable?: boolean;
768
881
  statusCode?: number;
769
882
  cause?: Error;
883
+ context?: Record<string, unknown>;
770
884
  });
771
885
  getUserMessage(): string;
772
886
  }
@@ -804,73 +918,20 @@ type AssetVisibility = 'public' | 'protected' | 'private';
804
918
  type FileStatus = 'pending_upload' | 'uploading' | 'processing' | 'ready' | 'failed';
805
919
  /** Storage backend: `r2` = image + file kinds, `stream` = video kind. */
806
920
  type FileBackend = 'r2' | 'stream';
807
- /** Extracted media metadata (Phase 1 basics + Phase 2 enrichment, plans 15–19). */
808
- interface AssetFileExtracted {
809
- width?: number;
810
- height?: number;
811
- format?: string;
812
- duration?: number;
813
- hasAlpha?: boolean;
814
- isAnimated?: boolean;
815
- orientation?: number;
816
- placeholder?: string;
817
- dominantColor?: string;
818
- palette?: string[];
819
- exif?: Record<string, unknown>;
820
- video?: {
821
- codec?: string;
822
- bitrate?: number;
823
- framerate?: number;
824
- audioTracks?: unknown[];
825
- };
826
- pageCount?: number;
827
- text?: string;
828
- safety?: {
829
- nsfwScore?: number;
830
- flagged?: boolean;
831
- categories?: string[];
832
- };
833
- [key: string]: unknown;
834
- }
835
- /** Customer-facing file binding block on an asset entry. */
836
- interface AssetFileBlock {
837
- status: FileStatus;
838
- backend: FileBackend;
839
- fileName: string;
840
- mimeType?: string | null;
841
- size?: number | null;
842
- /** Advisory client-computed SHA-256 (duplicate detection only). */
843
- hash?: string | null;
844
- visibility: AssetVisibility;
845
- extracted?: AssetFileExtracted;
846
- /** 0..1 normalized smart-crop anchor (written by plan 18). */
847
- focalPoint?: {
848
- x: number;
849
- y: number;
850
- };
851
- /** Phase-2 enrichment status — independent of `status` (plan 15). */
852
- enrichment?: {
853
- status: 'pending' | 'running' | 'complete' | 'partial' | 'failed';
854
- };
855
- /** File-kind malware scan status (plan 19). */
856
- scan?: {
857
- status: 'pending' | 'clean' | 'infected' | 'error' | 'skipped';
858
- };
859
- /** Processing progress (e.g. video encoding %) + terminal error. */
860
- processing?: {
861
- stage?: string;
862
- progress?: number;
863
- error?: {
864
- code?: string;
865
- message?: string;
866
- retriable?: boolean;
867
- };
868
- };
869
- /** Video playback readiness. */
870
- playback?: {
871
- ready?: boolean;
872
- };
873
- }
921
+ /**
922
+ * Customer-facing file binding block on an asset entry: the document's `AssetFile` — status,
923
+ * backend, file name, MIME type, size, advisory hash, visibility, extracted metadata, focal point,
924
+ * enrichment and scan status, processing stage/progress/error, and video playback readiness.
925
+ */
926
+ type AssetFileBlock = components['schemas']['AssetFile'];
927
+ /** Extracted media metadata (Phase 1 basics + Phase 2 enrichment, plans 15–19); open-ended. */
928
+ type AssetFileExtracted = NonNullable<AssetFileBlock['extracted']>;
929
+ /**
930
+ * Where one file binding's upload got to, as {@link AssetFileBuilder.status} reads it
931
+ * (`GET /v1/{assetType}/{id}/file`): the document's `FileStatus` — the binding's lifecycle and
932
+ * nothing of the entry's content. `processing.error` is present exactly while `status` is `failed`.
933
+ */
934
+ type FileStatusResult = components['schemas']['FileStatus'];
874
935
  /**
875
936
  * Computed gateway delivery URLs (the reserved `urls` key). Always served from
876
937
  * `cdn.relyio.net`. Image bindings expose `original` + `variants`; video bindings
@@ -1003,9 +1064,12 @@ type UpdateAssetOptions = {
1003
1064
  interface WaitUntilReadyOptions {
1004
1065
  /** Locale of the binding to watch. */
1005
1066
  locale?: string;
1006
- /** Total time to wait before giving up (ms). Default 60000. */
1067
+ /**
1068
+ * Total time to wait before giving up (ms), from 0 to 2147483647. Default 60000. `0` reads the
1069
+ * file once and rejects with a `TimeoutError` if it is not ready.
1070
+ */
1007
1071
  timeoutMs?: number;
1008
- /** Delay between polls (ms). Default 1500. */
1072
+ /** Delay between polls (ms), from 1 to 2147483647. Default 1500. */
1009
1073
  pollIntervalMs?: number;
1010
1074
  }
1011
1075
  /**
@@ -1016,8 +1080,13 @@ declare class AssetFileBuilder<T extends BaseContent = BaseContent> {
1016
1080
  private readonly httpClient;
1017
1081
  private readonly assetType;
1018
1082
  private readonly entryUid;
1019
- private readonly defaultLocale?;
1020
- constructor(httpClient: HttpClient, assetType: string, entryUid: string, defaultLocale?: string | undefined);
1083
+ /** The client's locale, asked on every call rather than copied when this builder was taken. */
1084
+ private readonly clientLocale;
1085
+ /**
1086
+ * @param locale - The client's locale, sent when a call names none: the function
1087
+ * `TypedRelyIOClient` hands over, or a locale fixed for this builder
1088
+ */
1089
+ constructor(httpClient: HttpClient, assetType: string, entryUid: string, locale?: ClientLocale);
1021
1090
  /**
1022
1091
  * The path parameters every `/file/*` route on this builder takes.
1023
1092
  *
@@ -1027,6 +1096,12 @@ declare class AssetFileBuilder<T extends BaseContent = BaseContent> {
1027
1096
  */
1028
1097
  private get target();
1029
1098
  private withLocale;
1099
+ /**
1100
+ * The `locale` body field of a multipart call: the session's, else the client's. The API finds
1101
+ * the binding by it, so a session a `withLocale()` client opened must name the same locale on
1102
+ * every later call or its `objectKey` is refused as another binding's.
1103
+ */
1104
+ private localeField;
1030
1105
  /**
1031
1106
  * Issue a single upload target — an R2 presigned PUT (image/file) or a
1032
1107
  * Cloudflare Stream direct-creator URL (video). Resumable multipart is plan 17.
@@ -1063,6 +1138,18 @@ declare class AssetFileBuilder<T extends BaseContent = BaseContent> {
1063
1138
  * Throws if the binding is not `ready`.
1064
1139
  */
1065
1140
  url(input?: ResolveUrlInput): Promise<ResolveUrlResult>;
1141
+ /**
1142
+ * Read where this file's upload got to — `status`, and the processing stage, progress and error
1143
+ * the pipeline recorded — whatever the asset entry is published in.
1144
+ *
1145
+ * An asset is a draft until its file is ready, and stays one when its file fails, so a key that
1146
+ * reads published content finds no entry for an upload in flight or one that failed. This read
1147
+ * answers for the binding itself. It takes the capability the upload calls take, so a read-only
1148
+ * key is refused with `ReadOnlyKeyError`, and it never returns the entry's fields.
1149
+ */
1150
+ status(options?: {
1151
+ locale?: string;
1152
+ }): Promise<FileStatusResult>;
1066
1153
  /**
1067
1154
  * Update the binding's delivery visibility (token-based; no byte relocation —
1068
1155
  * a downgrade purges the gateway cache). Returns the refreshed asset entry.
@@ -1090,8 +1177,23 @@ declare class AssetFileBuilder<T extends BaseContent = BaseContent> {
1090
1177
  locale?: string;
1091
1178
  }): Promise<void>;
1092
1179
  /**
1093
- * Poll the asset entry until its file binding reaches `ready` (resolves with
1094
- * the ready entry) or `failed` (throws). Times out after `timeoutMs`.
1180
+ * Poll the asset entry until its file binding reaches `ready`, and resolve with the ready entry.
1181
+ *
1182
+ * Each poll reads the entry through the key's lens. When that finds nothing — a key that reads
1183
+ * published content, and an asset that is a draft until its file is ready and stays one when it
1184
+ * fails — the poll reads the binding itself ({@link status}), so a failed upload rejects as one
1185
+ * rather than running out the limit (REL-1481).
1186
+ *
1187
+ * @throws {FileUploadError} When processing failed. `code` is the processing code the service
1188
+ * stored — `UNSUPPORTED_CODEC`, `CORRUPT_FILE` and so on — or `PROCESSING_FAILED` where it
1189
+ * stored none this SDK knows; `context.processingError` holds what it stored, and `retryable`
1190
+ * is its `retriable` hint.
1191
+ * @throws {TimeoutError} When `timeoutMs` passes first. The file may still become ready; the
1192
+ * error's `context.timeout` is the limit and `context.fileStatus` the status last seen. A file
1193
+ * that is `ready` in an asset the key's lens never shows — created with `publish: false`, or
1194
+ * awaiting a workflow — ends here too, and the message says so.
1195
+ * @throws {ReadOnlyKeyError} When the key's lens does not show the asset and the key may not read
1196
+ * its binding either: nothing it can read would ever report the file.
1095
1197
  */
1096
1198
  waitUntilReady(options?: WaitUntilReadyOptions): Promise<AssetEntryResponse<T>>;
1097
1199
  }
@@ -1106,7 +1208,6 @@ declare class AssetUploadBuilder<T extends BaseContent = BaseContent> {
1106
1208
  private readonly httpClient;
1107
1209
  private readonly assetType;
1108
1210
  private readonly file;
1109
- private readonly defaultLocale?;
1110
1211
  private _fileName?;
1111
1212
  private _visibility?;
1112
1213
  private _locale?;
@@ -1118,7 +1219,13 @@ declare class AssetUploadBuilder<T extends BaseContent = BaseContent> {
1118
1219
  private _onProgress?;
1119
1220
  private _validate?;
1120
1221
  private _maxPartRetries;
1121
- constructor(httpClient: HttpClient, assetType: string, file: Blob, defaultLocale?: string | undefined);
1222
+ /** The client's locale, read once when the upload starts. */
1223
+ private readonly clientLocale;
1224
+ /**
1225
+ * @param locale - The client's locale, the upload's when `.locale()` names none: the function
1226
+ * `TypedRelyIOClient` hands over, or a locale fixed for this upload
1227
+ */
1228
+ constructor(httpClient: HttpClient, assetType: string, file: Blob, locale?: ClientLocale);
1122
1229
  /** Subscribe to client → storage upload progress (single PUT + multipart). */
1123
1230
  onProgress(callback: (_progress: UploadProgress) => void): this;
1124
1231
  /**
@@ -1140,7 +1247,12 @@ declare class AssetUploadBuilder<T extends BaseContent = BaseContent> {
1140
1247
  content(content: Record<string, unknown>): this;
1141
1248
  /** Set an explicit slug for the new entry. */
1142
1249
  slug(slug: string): this;
1143
- /** Wait until the file binding becomes `ready` before resolving. */
1250
+ /**
1251
+ * Wait until the file binding becomes `ready` before resolving.
1252
+ *
1253
+ * @throws {Error} When `timeoutMs` or `pollIntervalMs` is one the wait cannot honour — refused
1254
+ * here, before anything is uploaded, rather than after the bytes are in.
1255
+ */
1144
1256
  waitForReady(options?: boolean | Omit<WaitUntilReadyOptions, 'locale'>): this;
1145
1257
  /** Execute the full upload flow and resolve with the asset entry. */
1146
1258
  execute(): Promise<AssetEntryResponse<T>>;
@@ -1164,10 +1276,18 @@ declare class AssetUploadBuilder<T extends BaseContent = BaseContent> {
1164
1276
  declare class AssetClient<T extends BaseContent = BaseContent> {
1165
1277
  private readonly httpClient;
1166
1278
  private readonly assetType;
1167
- private readonly defaultLocale?;
1168
- constructor(httpClient: HttpClient, assetType: string, defaultLocale?: string | undefined);
1169
- /** Create a query builder for this asset type. */
1170
- query(): ContentQueryBuilder<AssetEntryResponse<T>>;
1279
+ /** The client's locale, asked on every call rather than copied when this client was taken. */
1280
+ private readonly clientLocale;
1281
+ /**
1282
+ * @param locale - The client's locale: the function `TypedRelyIOClient` hands over, asked on
1283
+ * every call, or a locale fixed for this client
1284
+ */
1285
+ constructor(httpClient: HttpClient, assetType: string, locale?: ClientLocale);
1286
+ /**
1287
+ * Create a query builder for this asset type. It resolves asset reads; its conditions name the
1288
+ * asset type's fields, which the `file` and `urls` blocks are not.
1289
+ */
1290
+ query(): ContentQueryBuilder<AssetEntryResponse<T>, T>;
1171
1291
  /** Find an asset entry by id (or slug) with fluent options. */
1172
1292
  findById(id: string): ContentByIdBuilder<AssetEntryResponse<T>>;
1173
1293
  /** Fetch a single asset entry by id (or slug), or `null` if not found. */
@@ -1176,14 +1296,18 @@ declare class AssetClient<T extends BaseContent = BaseContent> {
1176
1296
  locale?: string;
1177
1297
  }): Promise<AssetEntryResponse<T> | null>;
1178
1298
  /** Fetch the first asset entry matching the conditions, or `null`. */
1179
- fetchFirst(where?: WhereClause<AssetEntryResponse<T>>, locale?: string): Promise<AssetEntryResponse<T> | null>;
1299
+ fetchFirst(where?: WhereClause<T>, locale?: string): Promise<AssetEntryResponse<T> | null>;
1180
1300
  /**
1181
1301
  * Create a new asset entry as a draft. The binary is uploaded separately via
1182
1302
  * `file(uid)` (or use the high-level `upload()` helper), and the entry
1183
1303
  * auto-publishes when its file becomes ready (unless `publish: false`).
1304
+ * `locale` defaults to the client's own (`withLocale()`).
1184
1305
  */
1185
1306
  create(data: CreateInput<T>, options?: CreateAssetOptions & RetryableWriteOptions): Promise<AssetEntryResponse<T>>;
1186
- /** Update an asset entry's metadata fields (and/or slug). */
1307
+ /**
1308
+ * Update an asset entry's metadata fields (and/or slug). `locale` defaults to the client's own
1309
+ * (`withLocale()`).
1310
+ */
1187
1311
  update(id: string, data: UpdateInput<T>, options?: UpdateAssetOptions): Promise<AssetEntryResponse<T>>;
1188
1312
  /** Delete an asset entry (cascades file-byte cleanup + gateway purge). */
1189
1313
  delete(id: string, options?: ConditionalWriteOptions): Promise<void>;
@@ -1193,9 +1317,12 @@ declare class AssetClient<T extends BaseContent = BaseContent> {
1193
1317
  upload(file: Blob): AssetUploadBuilder<T>;
1194
1318
  /** Get the asset type id. */
1195
1319
  getAssetType(): string;
1196
- /** Get the current default locale. */
1320
+ /** Get the default locale as it is now: the client's, or the one `withLocale()` fixed. */
1197
1321
  getDefaultLocale(): string | undefined;
1198
- /** Create a new AssetClient for this type with a different default locale. */
1322
+ /**
1323
+ * Create a new AssetClient for this type with a different default locale, fixed: an update of the
1324
+ * client's locale (`updateConfig({ locale })`) does not reach it.
1325
+ */
1199
1326
  withLocale(locale: string): AssetClient<T>;
1200
1327
  }
1201
1328
  /**
@@ -1230,6 +1357,11 @@ interface SingletonFetchOptions {
1230
1357
  * Singleton client for managing singleton content operations
1231
1358
  * Provides a fluent API for singleton operations following the same pattern as ContentClient
1232
1359
  *
1360
+ * Every call is in the locale it names — the argument (`fetch({ locale })`, `update(data, locale)`,
1361
+ * `versions({ locale })`), then `.locale()` — and otherwise in the client's own (`withLocale()`,
1362
+ * `updateConfig({ locale })`) as it is when the call is made, as `content()`'s are: reads, the write,
1363
+ * and version history alike.
1364
+ *
1233
1365
  * @example
1234
1366
  * ```typescript
1235
1367
  * const homepage = await client.singleton('homepage')
@@ -1243,7 +1375,13 @@ declare class SingletonClient<T = unknown> {
1243
1375
  private singletonKey;
1244
1376
  private includeFields?;
1245
1377
  private localeValue?;
1246
- constructor(httpClient: HttpClient, singletonKey: string);
1378
+ /** The client's locale, asked on every call rather than copied when this client was taken. */
1379
+ private readonly clientLocale;
1380
+ /**
1381
+ * @param locale - The client's locale: the function `TypedRelyIOClient` hands over, asked on
1382
+ * every call, or a locale fixed for this client
1383
+ */
1384
+ constructor(httpClient: HttpClient, singletonKey: string, locale?: ClientLocale);
1247
1385
  /**
1248
1386
  * Include reference fields in the response
1249
1387
  * @param fields - Reference field names to populate
@@ -1274,7 +1412,8 @@ declare class SingletonClient<T = unknown> {
1274
1412
  * Update singleton content. The API auto-publishes on PATCH — there is no
1275
1413
  * separate publish route; calling `update()` writes and publishes.
1276
1414
  * @param data - The content fields to update
1277
- * @param locale - Optional locale for localized content (overrides fluent locale)
1415
+ * @param locale - Optional locale for localized content (overrides the fluent locale, which
1416
+ * overrides the client's own)
1278
1417
  * @param options - `If-Match` / `Idempotency-Key`, both declared on this route
1279
1418
  */
1280
1419
  update(data: Partial<T>, locale?: string, options?: ConditionalWriteOptions): Promise<T>;
@@ -1286,8 +1425,9 @@ declare class SingletonClient<T = unknown> {
1286
1425
  * Get version history for one locale of the singleton.
1287
1426
  *
1288
1427
  * Versions are numbered per locale, so this is one locale's timeline: `locale` defaults to the
1289
- * schema default, no fallback is applied, and a locale with no history returns an empty array
1290
- * rather than another locale's rows. Every row names the locale it belongs to.
1428
+ * fluent `.locale()`, then the client's own (`withLocale()`), then the schema default; no
1429
+ * fallback is applied, and a locale with no history returns an empty array rather than another
1430
+ * locale's rows. Every row names the locale it belongs to.
1291
1431
  */
1292
1432
  versions(options?: {
1293
1433
  limit?: number;
@@ -1299,12 +1439,14 @@ declare class SingletonClient<T = unknown> {
1299
1439
  /**
1300
1440
  * Get a specific version of the singleton.
1301
1441
  *
1302
- * `locale` defaults to the schema default. Version numbers are per locale, so version 2 is
1303
- * different content in each one.
1442
+ * `locale` defaults to the fluent `.locale()`, then the client's own (`withLocale()`), then the
1443
+ * schema default. Version numbers are per locale, so version 2 is different content in each one.
1304
1444
  */
1305
1445
  version(versionNumber: number, options?: {
1306
1446
  locale?: string;
1307
1447
  }): Promise<T | null>;
1448
+ /** The locale a write or history read sends: the call's, the fluent one, else the client's. */
1449
+ private localeOf;
1308
1450
  /**
1309
1451
  * Get the singleton key
1310
1452
  */
@@ -1328,6 +1470,11 @@ interface SettingsFetchOptions {
1328
1470
  * Settings client for managing settings group operations
1329
1471
  * Provides a fluent API for settings operations following the same pattern as ContentClient
1330
1472
  *
1473
+ * Every call is in the locale it names — the argument (`fetch({ locale })`, `update(settings,
1474
+ * locale)`, `reset(locale)`, `versions({ locale })`), then `.locale()` — and otherwise in the
1475
+ * client's own (`withLocale()`, `updateConfig({ locale })`) as it is when the call is made, as
1476
+ * `content()`'s are: reads, writes and version history alike.
1477
+ *
1331
1478
  * @example
1332
1479
  * ```typescript
1333
1480
  * const emailConfig = await client.settings('email-config')
@@ -1341,7 +1488,13 @@ declare class SettingsClient<T = unknown> {
1341
1488
  private readonly groupId;
1342
1489
  private includeFields?;
1343
1490
  private localeValue?;
1344
- constructor(httpClient: HttpClient, groupId: string);
1491
+ /** The client's locale, asked on every call rather than copied when this client was taken. */
1492
+ private readonly clientLocale;
1493
+ /**
1494
+ * @param locale - The client's locale: the function `TypedRelyIOClient` hands over, asked on
1495
+ * every call, or a locale fixed for this client
1496
+ */
1497
+ constructor(httpClient: HttpClient, groupId: string, locale?: ClientLocale);
1345
1498
  /**
1346
1499
  * Include reference fields in the response
1347
1500
  * @param fields - Reference field names to populate
@@ -1359,8 +1512,13 @@ declare class SettingsClient<T = unknown> {
1359
1512
  fetch(options?: SettingsFetchOptions): Promise<T | null>;
1360
1513
  /**
1361
1514
  * Update settings group
1515
+ *
1516
+ * The fields travel as `content` beside an optional `locale`, the body the route validates
1517
+ * (`UpdateSettingsDto`); any other top-level key is refused `REQUEST_INVALID`.
1518
+ *
1362
1519
  * @param settings - The settings fields to update
1363
- * @param locale - Optional locale for localized settings (overrides fluent locale)
1520
+ * @param locale - Optional locale for localized settings (overrides the fluent locale, which
1521
+ * overrides the client's own)
1364
1522
  */
1365
1523
  update(settings: Partial<T>, locale?: string, options?: ConditionalWriteOptions): Promise<T>;
1366
1524
  /**
@@ -1374,7 +1532,11 @@ declare class SettingsClient<T = unknown> {
1374
1532
  }>;
1375
1533
  /**
1376
1534
  * Reset settings to default values
1377
- * @param locale - Optional locale for localized settings
1535
+ *
1536
+ * The route reads its locale from `?locale=` and takes no body, so that is where it is sent.
1537
+ *
1538
+ * @param locale - Optional locale for localized settings (overrides the fluent locale, which
1539
+ * overrides the client's own)
1378
1540
  */
1379
1541
  reset(locale?: string, options?: ConditionalWriteOptions): Promise<T>;
1380
1542
  /**
@@ -1389,8 +1551,9 @@ declare class SettingsClient<T = unknown> {
1389
1551
  * Get version history for one locale of the settings group.
1390
1552
  *
1391
1553
  * Versions are numbered per locale, so this is one locale's timeline: `locale` defaults to the
1392
- * schema default, no fallback is applied, and a locale with no history returns an empty array
1393
- * rather than another locale's rows. Every row names the locale it belongs to.
1554
+ * fluent `.locale()`, then the client's own (`withLocale()`), then the schema default; no
1555
+ * fallback is applied, and a locale with no history returns an empty array rather than another
1556
+ * locale's rows. Every row names the locale it belongs to.
1394
1557
  */
1395
1558
  versions(options?: {
1396
1559
  limit?: number;
@@ -1402,12 +1565,14 @@ declare class SettingsClient<T = unknown> {
1402
1565
  /**
1403
1566
  * Get a specific version of the settings.
1404
1567
  *
1405
- * `locale` defaults to the schema default. Version numbers are per locale, so version 2 is
1406
- * different content in each one.
1568
+ * `locale` defaults to the fluent `.locale()`, then the client's own (`withLocale()`), then the
1569
+ * schema default. Version numbers are per locale, so version 2 is different content in each one.
1407
1570
  */
1408
1571
  version(versionNumber: number, options?: {
1409
1572
  locale?: string;
1410
1573
  }): Promise<T | null>;
1574
+ /** The locale a write or history read sends: the call's, the fluent one, else the client's. */
1575
+ private localeOf;
1411
1576
  /**
1412
1577
  * Get the settings group ID
1413
1578
  */
@@ -1418,22 +1583,67 @@ declare class SettingsClient<T = unknown> {
1418
1583
  resetOptions(): this;
1419
1584
  }
1420
1585
 
1586
+ /**
1587
+ * Any schema the client can be typed by. `any` is deliberate: the client accepts whatever content
1588
+ * types, components, singletons, queries and settings groups a customer declares.
1589
+ *
1590
+ * This is the constraint `TypedRelyIOClient`'s `TSchema` carries, so `RegisteredSchema` is inferred
1591
+ * against the same one — `createClient` returns `TypedRelyIOClient<RegisteredSchema>`, and a schema
1592
+ * inferred against any wider alias would not be provably inside the client's bound.
1593
+ */
1594
+ type AnySchemaDefinition = SchemaDefinition<any, any, any, any, any>;
1595
+ /**
1596
+ * The seam `relyio generate-types` fills (`INV-SS-TYPES-INFERRED`).
1597
+ *
1598
+ * Empty here on purpose. The generated `schema.ts` augments it —
1599
+ *
1600
+ * ```ts
1601
+ * declare module '@relyio/sdk' {
1602
+ * interface Register {
1603
+ * schema: typeof schema
1604
+ * }
1605
+ * }
1606
+ * ```
1607
+ *
1608
+ * — and from then on `createClient({ apiKey })`, with no generic and no `schema:`, is typed by that
1609
+ * schema. The pattern is TanStack Router's. It is type-level only: nothing at runtime reads it.
1610
+ */
1611
+ interface Register {
1612
+ }
1613
+ /**
1614
+ * The schema the project registered through `Register`, or `undefined` when nothing did — which is
1615
+ * the untyped client, exactly as before the generator ran.
1616
+ */
1617
+ type RegisteredSchema = Register extends {
1618
+ schema: infer S extends AnySchemaDefinition;
1619
+ } ? S : undefined;
1620
+
1421
1621
  /**
1422
1622
  * Search mode for content queries
1423
1623
  */
1424
1624
  type SearchMode = 'keyword' | 'semantic' | 'hybrid';
1425
1625
  /**
1426
- * One search hit as the route emits it: the entry fields at the top level,
1427
- * plus optional score annotations. There is no per-item `data` wrapper.
1626
+ * What a search or similar hit reports beside its fields: the committed document's
1627
+ * `SearchHitMetadata`, read through `http/api-schema.ts`.
1628
+ *
1629
+ * Narrower than an entry read's `EntryMetadata`, because a hit is not built by the entry read: it
1630
+ * carries no `entryType`, `defaultLocale`, `availableLocales`, `refs`, `firstPublishedAt` or
1631
+ * version history. Until REL-1413 a hit was typed as an entry and so promised all five — the
1632
+ * locale helpers kept an optional chain after `availableLocales` for the hits that lacked it. Read
1633
+ * the entry (`content(type).findById(hit._metadata.id)`) for those.
1428
1634
  */
1429
- type SearchResultItem<T = unknown> = T & {
1430
- _score?: number;
1431
- _scoreBreakdown?: {
1432
- keyword?: number;
1433
- semantic?: number;
1434
- };
1435
- _highlights?: Record<string, string[]>;
1436
- };
1635
+ type SearchHitMetadata = components['schemas']['SearchHitMetadata'];
1636
+ /** What a hit carries beside the entry's fields, as the document declares it. */
1637
+ type SearchHitSystemFields = Pick<components['schemas']['SearchHit'], '_metadata' | '_score' | '_scoreBreakdown' | '_highlights'>;
1638
+ /**
1639
+ * One search hit as the route emits it — the document's `SearchHit`: the fields `T` declares at the
1640
+ * top level (at `_metadata.locale`, or only the aliases a `fields` projection names), the hit's own
1641
+ * `_metadata`, and the score annotations the request asked for. There is no per-item `data` wrapper.
1642
+ *
1643
+ * `T`'s `_metadata` is replaced, not kept: `T` is an entry type, and a hit is not an entry read.
1644
+ * Distributes over a union of entry types, so a search across two types keeps each one's fields.
1645
+ */
1646
+ type SearchResultItem<T = unknown> = T extends unknown ? Omit<T, '_metadata'> & SearchHitSystemFields : never;
1437
1647
  /**
1438
1648
  * Search response from API
1439
1649
  */
@@ -1453,20 +1663,12 @@ type SearchResultItem<T = unknown> = T & {
1453
1663
  */
1454
1664
  type SearchResponse<T = unknown> = Wire<'/v1/search', 'post', SearchResultItem<T>>;
1455
1665
  /**
1456
- * Autocomplete suggestion
1457
- */
1458
- interface AutocompleteSuggestion {
1459
- /** Suggested text */
1460
- text: string;
1461
- /** Highlighted version */
1462
- highlighted?: string;
1463
- /** Score */
1464
- score?: number;
1465
- /** Source entry ID */
1466
- entryId?: string;
1467
- /** Content type */
1468
- contentType?: string;
1469
- }
1666
+ * One autocomplete suggestion — the document's `AutocompleteSuggestion`: the value, its best score,
1667
+ * an entry holding it (`id`), and the value with its match wrapped in `<em>` when Atlas highlighted
1668
+ * it. The hand-written type this replaces named `highlighted`, `entryId` and `contentType`, none of
1669
+ * which the route sends, and made `score` optional where it is always sent.
1670
+ */
1671
+ type AutocompleteSuggestion = components['schemas']['AutocompleteSuggestion'];
1470
1672
  /**
1471
1673
  * Autocomplete response
1472
1674
  */
@@ -1479,11 +1681,10 @@ interface AutocompleteSuggestion {
1479
1681
  */
1480
1682
  type AutocompleteResponse = Wire<'/v1/search/autocomplete', 'post', AutocompleteSuggestion>;
1481
1683
  /**
1482
- * One similar-content hit as the route emits it — a flat entry, no `data` wrapper.
1684
+ * One similar-content hit as the route emits it: the same `SearchHit` a search serves, built by
1685
+ * the same transform, with `_score` on every hit.
1483
1686
  */
1484
- type SimilarResult<T = unknown> = T & {
1485
- _score?: number;
1486
- };
1687
+ type SimilarResult<T = unknown> = SearchResultItem<T>;
1487
1688
  /**
1488
1689
  * Similar response
1489
1690
  */
@@ -1493,12 +1694,31 @@ type SimilarResponse<T = unknown> = Wire<'/v1/search/similar', 'post', SimilarRe
1493
1694
  * Filter conditions for search
1494
1695
  */
1495
1696
  type SearchFilter = Record<string, unknown>;
1697
+ /**
1698
+ * The content type names a search may be scoped to: the schema's where one types the client, any
1699
+ * name where none does.
1700
+ */
1701
+ type SearchTypeName<S extends AnySchemaDefinition | undefined> = S extends AnySchemaDefinition ? SchemaContentTypeNames<S> : string;
1702
+ /**
1703
+ * What a search over the content types `K` returns: their entries, typed by the schema
1704
+ * (`INV-SS-TYPES-INFERRED`) — or `T` unchanged where no schema types the client.
1705
+ */
1706
+ type SearchEntry<S extends AnySchemaDefinition | undefined, K extends SearchTypeName<S> = SearchTypeName<S>, T extends BaseContent = BaseContent> = S extends AnySchemaDefinition ? SchemaEntryOf<S, K & SchemaContentTypeNames<S>> : T;
1496
1707
  /**
1497
1708
  * Field projection for search results
1498
1709
  */
1499
1710
  type SearchFields<T> = {
1500
1711
  [K: string]: keyof T | string;
1501
1712
  };
1713
+ /**
1714
+ * One ordering of `POST /v1/search`'s results, as the route's `sort` array takes it.
1715
+ */
1716
+ interface SearchSort {
1717
+ /** Field path, or `_score` for relevance */
1718
+ field: string;
1719
+ /** Direction; the route's default is `desc` */
1720
+ direction: 'asc' | 'desc';
1721
+ }
1502
1722
  /**
1503
1723
  * Fluent builder for search queries
1504
1724
  *
@@ -1513,23 +1733,38 @@ type SearchFields<T> = {
1513
1733
  * .execute()
1514
1734
  * ```
1515
1735
  */
1516
- declare class SearchBuilder<T extends BaseContent = BaseContent> {
1736
+ declare class SearchBuilder<T extends BaseContent = BaseContent, S extends AnySchemaDefinition | undefined = undefined> {
1517
1737
  private readonly httpClient;
1518
1738
  private query;
1519
1739
  private searchOptions;
1520
- constructor(httpClient: HttpClient, query: string);
1740
+ private requestHeaders?;
1741
+ /** The client's locale, asked when the query is sent rather than copied when it was built. */
1742
+ private readonly clientLocale;
1743
+ /**
1744
+ * @param locale - The client's locale (`withLocale()`, `updateConfig({ locale })`), sent when
1745
+ * `.locale()` names none: the function `TypedRelyIOClient` hands over, or a locale fixed for it
1746
+ */
1747
+ constructor(httpClient: HttpClient, query: string, locale?: ClientLocale);
1521
1748
  /**
1522
- * Search within a single content type
1749
+ * Headers this search adds to the client's own, e.g. `X-RelyIO-Dataset` to search another
1750
+ * dataset the key can see. A name the client already sends is replaced for this search only.
1751
+ */
1752
+ headers(headers: Record<string, string>): this;
1753
+ /**
1754
+ * Search within a single content type. Where a schema types the client, the name is one of its
1755
+ * content types and the results are that type's entries.
1523
1756
  * @param contentType - Content type to search in
1524
1757
  */
1525
- in<K extends string>(contentType: K): SearchBuilder<T>;
1758
+ in<K extends SearchTypeName<S>>(contentType: K): SearchBuilder<SearchEntry<S, K, T>, S>;
1526
1759
  /**
1527
- * Search across multiple content types
1760
+ * Search across multiple content types. Where a schema types the client, the names are its content
1761
+ * types and the results are a union of their entries — every type's, for `'*'`.
1528
1762
  * @param contentTypes - Array of content types or '*' for all
1529
1763
  */
1530
- across(contentTypes: string[] | '*'): SearchBuilder<T>;
1764
+ across<K extends SearchTypeName<S>>(contentTypes: K[] | '*'): SearchBuilder<SearchEntry<S, K, T>, S>;
1531
1765
  /**
1532
- * Add filter conditions
1766
+ * Add filter conditions, on the fields the content types declare. A condition on `_metadata` is
1767
+ * refused here, before anything is sent.
1533
1768
  * @param conditions - Filter conditions
1534
1769
  */
1535
1770
  where(conditions: SearchFilter): this;
@@ -1543,6 +1778,13 @@ declare class SearchBuilder<T extends BaseContent = BaseContent> {
1543
1778
  * @param projection - Field mapping
1544
1779
  */
1545
1780
  fields(projection: Record<string, string>): this;
1781
+ /**
1782
+ * Order the results by a field instead of by relevance. Called again, it adds a tie-breaker.
1783
+ * `_score` names relevance itself.
1784
+ * @param field - Field path to sort by (e.g. `updatedAt`, `pricing.basePrice`)
1785
+ * @param direction - `asc` or `desc` (the route's default is `desc`)
1786
+ */
1787
+ sort(field: string, direction?: 'asc' | 'desc'): this;
1546
1788
  /**
1547
1789
  * Limit number of results
1548
1790
  * @param count - Maximum results
@@ -1596,7 +1838,13 @@ declare class AutocompleteBuilder {
1596
1838
  private readonly httpClient;
1597
1839
  private query;
1598
1840
  private autocompleteOptions;
1599
- constructor(httpClient: HttpClient, query: string);
1841
+ /** The client's locale, asked when the query is sent rather than copied when it was built. */
1842
+ private readonly clientLocale;
1843
+ /**
1844
+ * @param locale - The client's locale (`withLocale()`, `updateConfig({ locale })`), sent when
1845
+ * `.locale()` names none: the function `TypedRelyIOClient` hands over, or a locale fixed for it
1846
+ */
1847
+ constructor(httpClient: HttpClient, query: string, locale?: ClientLocale);
1600
1848
  /**
1601
1849
  * Autocomplete within a content type
1602
1850
  * @param contentType - Content type to search
@@ -1612,7 +1860,8 @@ declare class AutocompleteBuilder {
1612
1860
  */
1613
1861
  fuzzy(): this;
1614
1862
  /**
1615
- * Add filter conditions
1863
+ * Add filter conditions, on the fields the content types declare. A condition on `_metadata` is
1864
+ * refused here, before anything is sent.
1616
1865
  * @param conditions - Filter conditions
1617
1866
  */
1618
1867
  where(conditions: SearchFilter): this;
@@ -1651,17 +1900,29 @@ declare class SimilarBuilder<T extends BaseContent = BaseContent> {
1651
1900
  private readonly httpClient;
1652
1901
  private sourceId;
1653
1902
  private similarOptions;
1654
- constructor(httpClient: HttpClient, sourceId: string);
1903
+ private requestHeaders?;
1904
+ /** The client's locale, asked when the read is sent rather than copied when it was built. */
1905
+ private readonly clientLocale;
1906
+ /**
1907
+ * @param locale - The client's locale (`withLocale()`, `updateConfig({ locale })`), sent when
1908
+ * `.locale()` names none: the function `TypedRelyIOClient` hands over, or a locale fixed for it
1909
+ */
1910
+ constructor(httpClient: HttpClient, sourceId: string, locale?: ClientLocale);
1911
+ /**
1912
+ * Headers this read adds to the client's own, e.g. `X-RelyIO-Dataset` to read another dataset
1913
+ * the key can see. A name the client already sends is replaced for this read only.
1914
+ */
1915
+ headers(headers: Record<string, string>): this;
1655
1916
  /**
1656
1917
  * Find similar content within a content type
1657
1918
  * @param contentType - Content type to search
1658
1919
  */
1659
1920
  in(contentType: string): this;
1660
1921
  /**
1661
- * Add filter conditions
1662
- * @param conditions - Filter conditions
1922
+ * Find similar content across several content types, or `'*'` for every type
1923
+ * @param contentTypes - Array of content types or '*' for all
1663
1924
  */
1664
- where(conditions: SearchFilter): this;
1925
+ across(contentTypes: string[] | '*'): this;
1665
1926
  /**
1666
1927
  * Limit number of results
1667
1928
  * @param count - Maximum results
@@ -1712,12 +1973,19 @@ declare class SimilarBuilder<T extends BaseContent = BaseContent> {
1712
1973
  */
1713
1974
  declare class SearchClient {
1714
1975
  private readonly httpClient;
1715
- constructor(httpClient: HttpClient);
1976
+ /** The client's locale, handed to every builder here to ask when it sends. */
1977
+ private readonly clientLocale;
1978
+ /**
1979
+ * @param locale - The client's locale (`withLocale()`, `updateConfig({ locale })`): every builder
1980
+ * here sends it when the query names none, as `content()`'s reads do — the function
1981
+ * `TypedRelyIOClient` hands over, or a locale fixed for this client
1982
+ */
1983
+ constructor(httpClient: HttpClient, locale?: ClientLocale);
1716
1984
  /**
1717
1985
  * Start a search query
1718
1986
  * @param query - Search query string
1719
1987
  */
1720
- search<T extends BaseContent = BaseContent>(query: string): SearchBuilder<T>;
1988
+ search<T extends BaseContent = BaseContent, S extends AnySchemaDefinition | undefined = undefined>(query: string): SearchBuilder<T, S>;
1721
1989
  /**
1722
1990
  * Start an autocomplete query
1723
1991
  * @param query - Partial query to autocomplete
@@ -1728,12 +1996,6 @@ declare class SearchClient {
1728
1996
  * @param sourceId - Entry ID to find similar content for
1729
1997
  */
1730
1998
  similar<T extends BaseContent = BaseContent>(sourceId: string): SimilarBuilder<T>;
1731
- /**
1732
- * Quick search helper - searches all content types
1733
- * @param query - Search query
1734
- * @param limit - Max results (default 20)
1735
- */
1736
- global<T extends BaseContent = BaseContent>(query: string, limit?: number): Promise<SearchResponse<T>>;
1737
1999
  }
1738
2000
 
1739
2001
  /**
@@ -1762,7 +2024,10 @@ interface BatchOptions {
1762
2024
  *
1763
2025
  * Requires that all operations be the same kind of write — one transaction cannot span two
1764
2026
  * calls — so a batch mixing creates and deletes, or `update` and `replace`, is rejected with
1765
- * a 400 before anything is attempted.
2027
+ * a 400 before anything is attempted: `execute()` rejects with `InvalidPayloadError`. A
2028
+ * singleton write is a create when the dataset has never written that singleton and an update
2029
+ * after, and an atomic batch cannot create one — that operation reports `REQUEST_INVALID` and
2030
+ * every other `TRANSACTION_ROLLED_BACK` — so create it in a request of its own first.
1766
2031
  *
1767
2032
  * @default false
1768
2033
  */
@@ -1820,23 +2085,53 @@ type BatchResponse = components['schemas']['MultiPayload'];
1820
2085
  /**
1821
2086
  * Fluent builder for batch operations
1822
2087
  *
2088
+ * Every create, update, replace and singleton operation it builds is in the locale that operation
2089
+ * names, and otherwise in the client's own (`withLocale()`), sent as that operation's
2090
+ * `body.locale` — a batch is one request, but the API reads a locale per operation. A delete names
2091
+ * none (it removes the whole entry), and a `raw()` operation is sent exactly as written.
2092
+ *
2093
+ * An atomic batch — `.atomic()` or `execute({ atomic: true })` — is one transaction: every
2094
+ * operation lands or none does. The API accepts one only when every operation is the same kind of
2095
+ * write and none writes a singleton that does not exist yet (see {@link BatchOptions.atomic}).
2096
+ *
1823
2097
  * @example
1824
2098
  * ```typescript
2099
+ * // Each operation lands or fails on its own
1825
2100
  * const result = await relyio.batch()
1826
2101
  * .create('product', { content: { title: 'iPhone', price: 999 } })
1827
2102
  * .update('product', 'entry_abc', { content: { price: 899 } })
1828
2103
  * .delete('product', 'entry_xyz')
1829
2104
  * .upsertSingleton('homepage', { content: { hero: 'Welcome!' } })
1830
- * .execute({ atomic: true })
2105
+ * .execute()
1831
2106
  *
1832
- * console.log(result.summary.succeeded) // 4
2107
+ * console.log(result.summary.succeeded)
2108
+ *
2109
+ * // All or nothing: one kind of write
2110
+ * await relyio.batch()
2111
+ * .create('product', { content: { title: 'iPhone', price: 999 } })
2112
+ * .create('product', { content: { title: 'iPad', price: 799 } })
2113
+ * .atomic()
2114
+ * .execute()
1833
2115
  * ```
1834
2116
  */
1835
2117
  declare class BatchBuilder<TSchema = unknown> {
1836
2118
  private readonly httpClient;
1837
2119
  private operations;
1838
2120
  private defaultOptions;
1839
- constructor(httpClient: HttpClient);
2121
+ private requestHeaders;
2122
+ /** The client's locale, asked as each operation is added rather than copied when this was built. */
2123
+ private readonly clientLocale;
2124
+ /**
2125
+ * @param locale - The client's locale (`withLocale()`, `updateConfig({ locale })`), each
2126
+ * operation's when it names none: the function `TypedRelyIOClient` hands over, or a locale fixed
2127
+ * for this batch
2128
+ */
2129
+ constructor(httpClient: HttpClient, locale?: ClientLocale);
2130
+ /**
2131
+ * An operation's body with its locale: the one it names, else the client's as it is when the
2132
+ * operation is added.
2133
+ */
2134
+ private localized;
1840
2135
  /**
1841
2136
  * Add a create operation
1842
2137
  * @param contentType - Content type to create
@@ -1914,7 +2209,8 @@ declare class BatchBuilder<TSchema = unknown> {
1914
2209
  locale?: string;
1915
2210
  }, id?: string): this;
1916
2211
  /**
1917
- * Add a raw operation (for advanced use cases)
2212
+ * Add a raw operation (for advanced use cases). It is sent exactly as written: the client's
2213
+ * locale is not added to it.
1918
2214
  * @param operation - The operation to add
1919
2215
  */
1920
2216
  raw(operation: BatchOperation): this;
@@ -1973,6 +2269,12 @@ declare class BatchBuilder<TSchema = unknown> {
1973
2269
  * Stop on first error (non-atomic mode)
1974
2270
  */
1975
2271
  stopOnError(): this;
2272
+ /**
2273
+ * Headers the batch request adds — e.g. `{ 'X-RelyIO-Dataset': 'staging' }` to write a dataset
2274
+ * other than the client's. They replace the client's own header of the same name for this
2275
+ * request alone, and apply to every operation in it: a batch is one request.
2276
+ */
2277
+ headers(headers: Record<string, string>): this;
1976
2278
  /**
1977
2279
  * Get the current list of operations
1978
2280
  */
@@ -2025,9 +2327,15 @@ declare class BatchBuilder<TSchema = unknown> {
2025
2327
  */
2026
2328
  declare class BatchClient<TSchema = unknown> {
2027
2329
  private readonly httpClient;
2028
- constructor(httpClient: HttpClient);
2330
+ /** The client's locale, handed to every batch this builds to ask as operations are added. */
2331
+ private readonly clientLocale;
2332
+ /**
2333
+ * @param locale - The client's locale: the function `TypedRelyIOClient` hands over, or a locale
2334
+ * fixed for this client
2335
+ */
2336
+ constructor(httpClient: HttpClient, locale?: ClientLocale);
2029
2337
  /**
2030
- * Create a new batch builder
2338
+ * Create a new batch builder, whose operations default to this client's locale
2031
2339
  */
2032
2340
  create(): BatchBuilder<TSchema>;
2033
2341
  /**
@@ -2093,20 +2401,27 @@ interface FetchBlock {
2093
2401
  interface AggregateBlock {
2094
2402
  /** Source content type or query reference */
2095
2403
  source: string;
2404
+ /**
2405
+ * Filter conditions applied before grouping, in the Query DSL's spelling — bare operator names
2406
+ * (`{ price: { gte: 10 } }`), not the list route's `$gte`. A `$`-prefixed key is not an operator
2407
+ * in this dialect: the service reads the object as a nested field and drops it.
2408
+ */
2409
+ where?: Record<string, unknown>;
2096
2410
  /** Field to group by */
2097
2411
  by?: string | string[];
2098
- /** Metrics to compute */
2412
+ /** Metrics to compute, keyed by the name each one answers under */
2099
2413
  metrics: Record<string, AggregateMetric>;
2100
2414
  }
2101
2415
  /**
2102
- * Aggregate metric definition
2416
+ * One metric, as the Query DSL writes it: `<field>.<fn>`, where `fn` is `count`, `sum`, `avg`,
2417
+ * `min`, `max`, `first` or `last` — `'id.count'`, `'pricing.basePrice.avg'`. The service
2418
+ * validates every metric against that form (`INVALID_AGGREGATION_EXPRESSION`); `count` ignores the
2419
+ * field it names. `first` and `last` were missing here while the service ran them (REL-1470).
2420
+ *
2421
+ * It used to be `{ fn, field? }`, a shape the service refuses on every request: the validator
2422
+ * tests the metric as a string, so an object arrives as `[object Object]`.
2103
2423
  */
2104
- interface AggregateMetric {
2105
- /** Aggregation function */
2106
- fn: 'count' | 'sum' | 'avg' | 'min' | 'max' | 'first' | 'last';
2107
- /** Field to aggregate (optional for count) */
2108
- field?: string;
2109
- }
2424
+ type AggregateMetric = `${string}.${'count' | 'sum' | 'avg' | 'min' | 'max' | 'first' | 'last'}`;
2110
2425
  /**
2111
2426
  * Search block for full-text/semantic search
2112
2427
  */
@@ -2125,36 +2440,11 @@ interface SearchBlock {
2125
2440
  limit?: number;
2126
2441
  }
2127
2442
  /**
2128
- * Similar block for vector similarity search
2443
+ * One post-fetch filter: a parameter expression, or the operators every query clause compares with
2444
+ * (`FilterOperator`, REL-1479). This kept a copy of eleven, without `exists` or `notExists`; and a
2445
+ * bare number or boolean, which it took, the service does not read as a filter.
2129
2446
  */
2130
- interface SimilarBlock {
2131
- /** Content type */
2132
- contentType: string;
2133
- /** Source entry ID */
2134
- source: string;
2135
- /** Minimum similarity threshold */
2136
- threshold?: number;
2137
- /** Additional filters */
2138
- where?: Record<string, unknown>;
2139
- /** Maximum results */
2140
- limit?: number;
2141
- }
2142
- /**
2143
- * Post-fetch filters with parameter support
2144
- */
2145
- type FilterValue = string | number | boolean | {
2146
- eq?: unknown;
2147
- ne?: unknown;
2148
- gt?: unknown;
2149
- gte?: unknown;
2150
- lt?: unknown;
2151
- lte?: unknown;
2152
- in?: unknown[];
2153
- nin?: unknown[];
2154
- contains?: unknown;
2155
- startsWith?: string;
2156
- endsWith?: string;
2157
- };
2447
+ type FilterValue = string | FilterOperator;
2158
2448
  /**
2159
2449
  * Full-text search configuration
2160
2450
  */
@@ -2176,8 +2466,6 @@ interface AdhocQueryDefinition {
2176
2466
  aggregate?: AggregateBlock;
2177
2467
  /** Search block - full-text/semantic search */
2178
2468
  search?: SearchBlock;
2179
- /** Similar block - vector similarity */
2180
- similar?: SimilarBlock;
2181
2469
  /** Field selection/transformation */
2182
2470
  select?: Record<string, string>;
2183
2471
  /** Post-fetch filters with parameter support */
@@ -2268,7 +2556,14 @@ declare class AdhocQueryBuilder<T = unknown> {
2268
2556
  private queryDef;
2269
2557
  private parameters;
2270
2558
  private options;
2271
- constructor(httpClient: HttpClient);
2559
+ /** The client's locale, asked when the query is sent rather than copied when it was built. */
2560
+ private readonly clientLocale;
2561
+ /**
2562
+ * @param locale - The client's locale (`withLocale()`, `updateConfig({ locale })`), sent as the
2563
+ * `locale` parameter when `.param('locale', …)` binds none: the function `TypedRelyIOClient`
2564
+ * hands over, or a locale fixed for this builder
2565
+ */
2566
+ constructor(httpClient: HttpClient, locale?: ClientLocale);
2272
2567
  /**
2273
2568
  * Add a fetch block to retrieve content
2274
2569
  * @param config - Fetch configuration
@@ -2294,11 +2589,6 @@ declare class AdhocQueryBuilder<T = unknown> {
2294
2589
  * @param config - Search configuration
2295
2590
  */
2296
2591
  search(config: SearchBlock): this;
2297
- /**
2298
- * Add similar block
2299
- * @param config - Similar configuration
2300
- */
2301
- similar(config: SimilarBlock): this;
2302
2592
  /**
2303
2593
  * Add where conditions to fetch
2304
2594
  * @param conditions - Filter conditions
@@ -2427,7 +2717,14 @@ declare class AdhocQueryBuilder<T = unknown> {
2427
2717
  */
2428
2718
  declare class AdhocQueryClient {
2429
2719
  private readonly httpClient;
2430
- constructor(httpClient: HttpClient);
2720
+ /** The client's locale, asked on every query rather than copied when this client was taken. */
2721
+ private readonly clientLocale;
2722
+ /**
2723
+ * @param locale - The client's locale (`withLocale()`, `updateConfig({ locale })`), sent as the
2724
+ * `locale` parameter of every query that binds none: the function `TypedRelyIOClient` hands
2725
+ * over, or a locale fixed for this client
2726
+ */
2727
+ constructor(httpClient: HttpClient, locale?: ClientLocale);
2431
2728
  /**
2432
2729
  * Create a new query builder
2433
2730
  */
@@ -2437,8 +2734,13 @@ declare class AdhocQueryClient {
2437
2734
  * @param definition - Query definition
2438
2735
  * @param parameters - Parameter values
2439
2736
  * @param options - Execution options
2737
+ * @param request - `headers` this one request adds to the client's own, e.g. `X-RelyIO-Dataset`
2738
+ * to query another dataset the key can see. A name the client already sends is replaced for
2739
+ * this request only.
2440
2740
  */
2441
- execute<T = unknown>(definition: AdhocQueryDefinition, parameters?: Record<string, unknown>, options?: AdhocQueryOptions): Promise<AdhocQueryResult<T>>;
2741
+ execute<T = unknown>(definition: AdhocQueryDefinition, parameters?: Record<string, unknown>, options?: AdhocQueryOptions, request?: {
2742
+ headers?: Record<string, string>;
2743
+ }): Promise<AdhocQueryResult<T>>;
2442
2744
  /**
2443
2745
  * Quick fetch helper
2444
2746
  * @param contentType - Content type
@@ -2584,41 +2886,10 @@ interface ChangesOptions {
2584
2886
  */
2585
2887
  onExpired?: 'throw' | 'resync' | ((expired: ChangesExpiredError) => void | Promise<void>);
2586
2888
  }
2587
-
2588
- /**
2589
- * Any schema the client can be typed by. `any` is deliberate: the client accepts whatever content
2590
- * types, components, singletons, queries and settings groups a customer declares.
2591
- *
2592
- * This is the constraint `TypedRelyIOClient`'s `TSchema` carries, so `RegisteredSchema` is inferred
2593
- * against the same one — `createClient` returns `TypedRelyIOClient<RegisteredSchema>`, and a schema
2594
- * inferred against any wider alias would not be provably inside the client's bound.
2595
- */
2596
- type AnySchemaDefinition = SchemaDefinition<any, any, any, any, any>;
2597
- /**
2598
- * The seam `relyio generate-types` fills (`INV-SS-TYPES-INFERRED`).
2599
- *
2600
- * Empty here on purpose. The generated `schema.ts` augments it —
2601
- *
2602
- * ```ts
2603
- * declare module '@relyio/sdk' {
2604
- * interface Register {
2605
- * schema: typeof schema
2606
- * }
2607
- * }
2608
- * ```
2609
- *
2610
- * — and from then on `createClient({ apiKey })`, with no generic and no `schema:`, is typed by that
2611
- * schema. The pattern is TanStack Router's. It is type-level only: nothing at runtime reads it.
2612
- */
2613
- interface Register {
2889
+ interface ChangesHeadOptions {
2890
+ /** Cancels the request; the promise then rejects. */
2891
+ signal?: AbortSignal;
2614
2892
  }
2615
- /**
2616
- * The schema the project registered through `Register`, or `undefined` when nothing did — which is
2617
- * the untyped client, exactly as before the generator ran.
2618
- */
2619
- type RegisteredSchema = Register extends {
2620
- schema: infer S extends AnySchemaDefinition;
2621
- } ? S : undefined;
2622
2893
 
2623
2894
  /**
2624
2895
  * The key's project, as `GET /v1/project` describes it: organization, project, dataset and branch,
@@ -2662,13 +2933,25 @@ interface TypedClientConfig<TSchema extends AnySchemaDefinition | undefined = un
2662
2933
  * ```
2663
2934
  */
2664
2935
  declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined = undefined> {
2665
- private httpClient;
2936
+ /**
2937
+ * The one HTTP client every sub-client sends through. `updateConfig()` and `setApiKey()` change it
2938
+ * in place rather than replacing it, so a sub-client taken before either sends through the change.
2939
+ */
2940
+ private readonly httpClient;
2666
2941
  private config;
2942
+ /**
2943
+ * The configuration as `createClient()`, `setApiKey()` and `updateConfig()` gave it, before the
2944
+ * `relyio dev` handshake: what the next update is laid over, and what `withLocale()` starts from.
2945
+ */
2946
+ private configured;
2667
2947
  private _sandbox;
2668
- private _search;
2669
- private _batch;
2670
- private _adhocQuery;
2671
2948
  private _schema;
2949
+ /**
2950
+ * The client's locale as it is when a call is made. Every sub-client and builder is handed this
2951
+ * rather than a copy of the locale, so one taken before `updateConfig({ locale })` sends the new
2952
+ * locale, or none after `locale: null` (REL-1453).
2953
+ */
2954
+ private readonly currentLocale;
2672
2955
  constructor(config: TypedClientConfig<TSchema>);
2673
2956
  /**
2674
2957
  * Get the schema definition
@@ -2690,7 +2973,7 @@ declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined
2690
2973
  */
2691
2974
  get sandbox(): SandboxState;
2692
2975
  /**
2693
- * Get the ad-hoc query client
2976
+ * Get the ad-hoc query client. Every query it sends is in the client's locale as it is then.
2694
2977
  */
2695
2978
  get query(): AdhocQueryClient;
2696
2979
  /**
@@ -2707,7 +2990,7 @@ declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined
2707
2990
  * .execute()
2708
2991
  * ```
2709
2992
  */
2710
- content<K extends TSchema extends AnySchemaDefinition ? SchemaContentTypeNames<TSchema> : string>(contentType: K): TSchema extends AnySchemaDefinition ? ContentClient<InferContentType<TSchema['contentTypes'][K & keyof TSchema['contentTypes']]>> : ContentClient<BaseContent>;
2993
+ 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>;
2711
2994
  /**
2712
2995
  * Get an asset client for a specific asset type.
2713
2996
  *
@@ -2726,7 +3009,7 @@ declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined
2726
3009
  * const heroUrl = await relyio.asset('productPhoto').file(photo._metadata.id).url({ variantId: 'hero' })
2727
3010
  * ```
2728
3011
  */
2729
- asset<K extends TSchema extends AnySchemaDefinition ? SchemaAssetTypeNames<TSchema> : string>(assetType: K): TSchema extends AnySchemaDefinition ? AssetClient<InferAssetType<NonNullable<TSchema['assetTypes']>[K & keyof NonNullable<TSchema['assetTypes']>]>> : AssetClient<BaseContent>;
3012
+ 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>;
2730
3013
  /**
2731
3014
  * Get a singleton client for a specific singleton key
2732
3015
  * Type-safe when schema is provided: autocompletes singleton names AND field names
@@ -2739,7 +3022,7 @@ declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined
2739
3022
  * .fetch()
2740
3023
  * ```
2741
3024
  */
2742
- singleton<K extends TSchema extends AnySchemaDefinition ? SchemaSingletonNames<TSchema> : string>(key: K): TSchema extends AnySchemaDefinition ? SingletonClient<InferSingleton<TSchema['singletonContentTypes'][K & keyof TSchema['singletonContentTypes']]>> : SingletonClient<unknown>;
3025
+ 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>;
2743
3026
  /**
2744
3027
  * Get a settings client for a specific settings group
2745
3028
  * Type-safe when schema is provided: autocompletes settings group names AND field names
@@ -2751,9 +3034,12 @@ declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined
2751
3034
  * .fetch()
2752
3035
  * ```
2753
3036
  */
2754
- settings<K extends TSchema extends AnySchemaDefinition ? SchemaSettingsGroupNames<TSchema> : string>(groupId: K): TSchema extends AnySchemaDefinition ? SettingsClient<InferSettingsGroup<NonNullable<TSchema['settingsGroups']>[K & keyof NonNullable<TSchema['settingsGroups']>]>> : SettingsClient<unknown>;
3037
+ 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>;
2755
3038
  /**
2756
- * Start a search query with full-text, semantic, or hybrid search
3039
+ * Start a search query with full-text, semantic, or hybrid search.
3040
+ *
3041
+ * Where a schema types the client, the results are its entries — every content type's until
3042
+ * `in()` or `across()` narrows them (`INV-SS-TYPES-INFERRED`).
2757
3043
  *
2758
3044
  * @example
2759
3045
  * ```typescript
@@ -2765,7 +3051,7 @@ declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined
2765
3051
  * .execute()
2766
3052
  * ```
2767
3053
  */
2768
- search<T extends BaseContent = BaseContent>(query: string): SearchBuilder<T>;
3054
+ search<T extends BaseContent = SearchEntry<TSchema>>(query: string): SearchBuilder<T, TSchema>;
2769
3055
  /**
2770
3056
  * Start an autocomplete query for search suggestions
2771
3057
  *
@@ -2794,7 +3080,11 @@ declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined
2794
3080
  */
2795
3081
  similar<T extends BaseContent = BaseContent>(sourceId: string): SimilarBuilder<T>;
2796
3082
  /**
2797
- * Start a batch operation for bulk create/update/delete
3083
+ * Start a batch operation for bulk create/update/delete.
3084
+ *
3085
+ * By default each operation lands or fails on its own. `atomic: true` makes the batch one
3086
+ * transaction, which the API accepts only when every operation is the same kind of write and none
3087
+ * writes a singleton that does not exist yet.
2798
3088
  *
2799
3089
  * @example
2800
3090
  * ```typescript
@@ -2803,12 +3093,20 @@ declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined
2803
3093
  * .update('product', 'entry_abc', { content: { price: 899 } })
2804
3094
  * .delete('product', 'entry_xyz')
2805
3095
  * .upsertSingleton('homepage', { content: { hero: 'Welcome!' } })
2806
- * .execute({ atomic: true })
3096
+ * .execute()
2807
3097
  *
2808
3098
  * console.log(result.summary.succeeded)
3099
+ *
3100
+ * // All or nothing: one kind of write
3101
+ * await relyio.batch()
3102
+ * .update('product', 'entry_abc', { content: { price: 899 } })
3103
+ * .update('product', 'entry_def', { content: { price: 799 } })
3104
+ * .execute({ atomic: true })
2809
3105
  * ```
2810
3106
  */
2811
3107
  batch(): BatchBuilder<NonNullable<TSchema>>;
3108
+ /** The search client, whose builders send the client's locale as it is when each one is sent. */
3109
+ private searchClient;
2812
3110
  /**
2813
3111
  * Follow the dataset's changes feed: each write this key can see, as ids, in
2814
3112
  * order, long-polled from `GET /v1/changes`.
@@ -2835,6 +3133,23 @@ declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined
2835
3133
  * ```
2836
3134
  */
2837
3135
  changes(options?: ChangesOptions): AsyncIterable<Change>;
3136
+ /**
3137
+ * The dataset's current position in the changes feed, as a cursor to start
3138
+ * `changes({ since })` or `followChanges(…, { since })` from. One
3139
+ * `GET /v1/changes` without a cursor: answered at once, holding nothing.
3140
+ *
3141
+ * Take it **before** you read what you will follow. A write your read did not
3142
+ * see is then after the position and replayed; opening the feed afterwards
3143
+ * without a `since` starts after it and misses it.
3144
+ *
3145
+ * @example
3146
+ * ```typescript
3147
+ * const since = await relyio.changesHead()
3148
+ * const post = await relyio.content('post').findById(id).execute()
3149
+ * for await (const change of relyio.changes({ since, ids: [id] })) { … }
3150
+ * ```
3151
+ */
3152
+ changesHead(options?: ChangesHeadOptions): Promise<string>;
2838
3153
  /**
2839
3154
  * Build and execute an ad-hoc query dynamically
2840
3155
  *
@@ -2910,15 +3225,73 @@ declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined
2910
3225
  */
2911
3226
  testConnection(): Promise<boolean>;
2912
3227
  /**
2913
- * Update the configuration and reinitialize all clients
3228
+ * Change some of the client's options and keep the rest.
3229
+ *
3230
+ * What you pass is laid over the configuration the client holds, field by field:
3231
+ *
3232
+ * - an option you name replaces the value the client holds;
3233
+ * - an option left out, or given as `undefined`, keeps the value the client holds;
3234
+ * - an option with no default given as `null` is cleared — `locale`, `dataset`, `apiKey`, `dev`,
3235
+ * `fetch`, `browser.onCorsError`, `realtime.wsUrl`, `debug.logger` — so the client runs as though
3236
+ * it had never been given one. An option with a default takes no `null`;
3237
+ * - a bag of options you name — `browser`, `cache`, `realtime`, `debug` — keeps every field of it
3238
+ * you do not name, so `updateConfig({ browser: { includeCredentials: true } })` keeps a
3239
+ * configured `onCorsError`;
3240
+ * - `headers` is laid over the headers the client sends, a name matched without regard to case: a
3241
+ * header you name is added or replaces every spelling of it, every other one is still sent, and a
3242
+ * header given as `null` is no longer sent;
3243
+ * - naming `apiKey` — a key, or `null` — replaces every key the client holds, one given in
3244
+ * `headers` included.
3245
+ *
3246
+ * The configuration it is laid over is what `createClient()`, `setApiKey()` and earlier updates
3247
+ * gave the client. The `relyio dev` handshake is read again, as `createClient()` reads it: while a
3248
+ * sandbox is active its key and dataset are sent over the configured ones, and once it has gone
3249
+ * the configured ones are.
3250
+ *
3251
+ * The client's one HTTP client is changed in place, so every request from now on is sent as the
3252
+ * update says — including one from a `content()`, `asset()`, `singleton()` or `settings()`
3253
+ * sub-client, a `query` client, or a builder such as `search()` or `batch()`, taken before the
3254
+ * call. The locale reaches them too: each reads the client's locale when it sends, so a new
3255
+ * `locale` is the default of its next request and `locale: null` leaves that request with none. A
3256
+ * locale the call names, and a sub-client's own `withLocale()`, still win over it. A client made
3257
+ * by `withLocale()` is a client of its own: an update of this one does not reach it.
3258
+ *
3259
+ * @example
3260
+ * ```typescript
3261
+ * const relyio = createClient({ apiKey, headers: { 'X-Tenant': 'acme' }, browser: { onCorsError } })
3262
+ *
3263
+ * relyio.updateConfig({ headers: { 'X-Trace': traceId } }) // X-Tenant is still sent
3264
+ * relyio.updateConfig({ browser: { includeCredentials: true } }) // onCorsError is kept
3265
+ * relyio.updateConfig({ headers: { 'X-Tenant': null } }) // X-Tenant is no longer sent
3266
+ * relyio.updateConfig({ locale: null }) // reads name no locale of the client's
3267
+ * ```
2914
3268
  */
2915
- updateConfig(newConfig: Partial<RelyIOConfig>): void;
3269
+ updateConfig(update: RelyIOConfigUpdate): void;
2916
3270
  /**
2917
3271
  * Get the current configuration
2918
3272
  */
2919
3273
  getConfig(): Readonly<MergedRelyIOConfig>;
2920
3274
  /**
2921
- * Set the API key
3275
+ * Replace the API key every later request sends as `X-API-Key`.
3276
+ *
3277
+ * It reaches every request this client makes from now on, including those of a `content()`,
3278
+ * `asset()` or other sub-client taken before the call, and `getConfig().apiKey` reports it. A key
3279
+ * given in `headers`, under any spelling, is replaced with it and does not come back on a later
3280
+ * `updateConfig()`. A client already derived with `withLocale()` is a client of its own and keeps
3281
+ * its key.
3282
+ *
3283
+ * An empty or blank key is no key, as it is when passed to `createClient`: the next request
3284
+ * rejects with `MissingApiKeyError` and nothing is sent.
3285
+ *
3286
+ * Under an active `relyio dev` sandbox the sandbox's scoped key stands, as it does over the key
3287
+ * passed to `createClient` — replacing the configured key does not retarget the client at the
3288
+ * sandbox's dataset with a key the sandbox did not issue.
3289
+ *
3290
+ * @example
3291
+ * ```typescript
3292
+ * const relyio = createClient({ apiKey: process.env.RELYIO_API_KEY! })
3293
+ * relyio.setApiKey(rotatedKey) // the next read sends `X-API-Key: <rotatedKey>`
3294
+ * ```
2922
3295
  */
2923
3296
  setApiKey(apiKey: string): void;
2924
3297
  /**
@@ -2927,7 +3300,13 @@ declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined
2927
3300
  getHttpClient(): HttpClient;
2928
3301
  /**
2929
3302
  * Create a locale-scoped client
2930
- * All content operations on the returned client will use the specified locale
3303
+ *
3304
+ * Every call the returned client builds is in this locale unless the call names one of its own,
3305
+ * which wins: every read — `content()`, `asset()`, `singleton()`, `settings()`, `search()`,
3306
+ * `similar()`, `autocomplete()`, `executeQuery()` and the ad-hoc queries — and every write and
3307
+ * version-history read — `create()` and `update()`, the singleton and settings writes, the asset
3308
+ * file writes, `versions()` and `version()`, and each operation `batch()` builds. `restore()`
3309
+ * always names its locale; a delete, and a `batch().raw()` operation, carry none of the client's.
2931
3310
  *
2932
3311
  * Type-safe when schema is provided: autocompletes valid locale codes!
2933
3312
  *
@@ -2935,9 +3314,11 @@ declare class TypedRelyIOClient<TSchema extends AnySchemaDefinition | undefined
2935
3314
  * ```typescript
2936
3315
  * const spanish = relyio.withLocale('es-ES') // ← Autocompletes with schema!
2937
3316
  *
2938
- * // All operations use Spanish
3317
+ * // Reads and writes use Spanish
2939
3318
  * const products = await spanish.content('product').query().execute()
2940
3319
  * const homepage = await spanish.singleton('homepage').fetch()
3320
+ * const results = await spanish.search('zapatos').execute()
3321
+ * await spanish.content('product').update(id, { title: 'Zapatos' })
2941
3322
  *
2942
3323
  * // Original client unchanged
2943
3324
  * const englishProducts = await relyio.content('product').query().execute()
@@ -3033,4 +3414,4 @@ declare function createClient<TSchema extends AnySchemaDefinition>(config: Typed
3033
3414
  */
3034
3415
  type ClientSchema<T extends TypedRelyIOClient<AnySchemaDefinition>> = T extends TypedRelyIOClient<infer TSchema> ? TSchema : never;
3035
3416
 
3036
- export { type SearchBlock as $, type ActiveSandbox as A, type AutocompleteSuggestion as B, type Change as C, type AutocompleteResponse as D, type ExtendedQueryResult as E, type SimilarResult as F, type SimilarResponse as G, HttpClient as H, type SearchFilter as I, type SearchFields as J, BatchClient as K, BatchBuilder as L, type BatchMethod as M, type BatchOperation as N, type BatchOptions as O, type Project as P, type BatchOperationResult as Q, type Register as R, type SandboxState as S, TypedRelyIOClient as T, type BatchSummary as U, type BatchResponse as V, AdhocQueryClient as W, AdhocQueryBuilder as X, type FetchBlock as Y, type AggregateBlock as Z, type AggregateMetric as _, type TypedClientConfig as a, type SimilarBlock as a0, type FilterValue as a1, type FullTextConfig as a2, type AdhocQueryDefinition as a3, type AdhocQueryOptions as a4, type QueryMetadata as a5, type AdhocQueryResult as a6, AssetClient as a7, AssetFileBuilder as a8, AssetUploadBuilder as a9, FileUploadError as aA, FileValidationError as aB, type FileValidationConstraints as aC, validateFile as aD, isAssetEntry as aa, type AssetVisibility as ab, type FileStatus as ac, type FileBackend as ad, type AssetFileBlock as ae, type AssetFileExtracted as af, type AssetUrls as ag, type AssetEntryResponse as ah, type PopulatedAssetReference as ai, type PresignInput as aj, type PresignResult as ak, type ConfirmInput as al, type ConfirmResult as am, type ResolveUrlInput as an, type ResolveUrlResult as ao, type CreateAssetOptions as ap, type WaitUntilReadyOptions as aq, type MultipartCreateResult as ar, type MultipartPart as as, type MultipartTarget as at, type UploadProgress as au, ResourceNotFoundError as av, ResourceConflictError as aw, ResourceExpiredError as ax, isResourceNotFound as ay, type FileErrorCode as az, type ClientSchema as b, createClient as c, type RegisteredSchema as d, type SendOptions as e, entityTagOf as f, type ConditionalWriteOptions as g, type RetryableWriteOptions as h, ChangesExpiredError as i, type ChangesOptions as j, type ChangesExpiredReason as k, ContentClient as l, SingletonClient as m, SettingsClient as n, ContentQueryBuilder as o, ContentByIdBuilder as p, type ChildrenOptions as q, type SingletonFetchOptions as r, type SettingsFetchOptions as s, SearchClient as t, SearchBuilder as u, AutocompleteBuilder as v, SimilarBuilder as w, type SearchMode as x, type SearchResultItem as y, type SearchResponse as z };
3417
+ export { AdhocQueryClient as $, type ActiveSandbox as A, type SearchHitMetadata as B, ChangesExpiredError as C, type SearchResponse as D, type ExtendedQueryResult as E, type AutocompleteSuggestion as F, type AutocompleteResponse as G, HttpClient as H, type SimilarResult as I, type SimilarResponse as J, type SearchFilter as K, type SearchFields as L, type SearchSort as M, type SearchTypeName as N, type SearchEntry as O, type Project as P, BatchClient as Q, type Register as R, type SandboxState as S, TypedRelyIOClient as T, BatchBuilder as U, type BatchMethod as V, type BatchOperation as W, type BatchOptions as X, type BatchOperationResult as Y, type BatchSummary as Z, type BatchResponse as _, type Change as a, AdhocQueryBuilder as a0, type FetchBlock as a1, type AggregateBlock as a2, type AggregateMetric as a3, type SearchBlock as a4, type FilterValue as a5, type FullTextConfig as a6, type AdhocQueryDefinition as a7, type AdhocQueryOptions as a8, type QueryMetadata as a9, ResourceNotFoundError as aA, ResourceConflictError as aB, ResourceExpiredError as aC, isResourceNotFound as aD, type FileErrorCode as aE, type FileUploadErrorCode as aF, FileUploadError as aG, FileValidationError as aH, type FileValidationConstraints as aI, validateFile as aJ, type AdhocQueryResult as aa, AssetClient as ab, AssetFileBuilder as ac, AssetUploadBuilder as ad, isAssetEntry as ae, type AssetVisibility as af, type FileStatus as ag, type FileBackend as ah, type AssetFileBlock as ai, type AssetFileExtracted as aj, type FileStatusResult as ak, type AssetUrls as al, type AssetEntryResponse as am, type PopulatedAssetReference as an, type PresignInput as ao, type PresignResult as ap, type ConfirmInput as aq, type ConfirmResult as ar, type ResolveUrlInput as as, type ResolveUrlResult as at, type CreateAssetOptions as au, type WaitUntilReadyOptions as av, type MultipartCreateResult as aw, type MultipartPart as ax, type MultipartTarget as ay, type UploadProgress 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, ContentClient as m, SingletonClient as n, SettingsClient as o, ContentQueryBuilder as p, ContentByIdBuilder as q, type ChildrenOptions as r, type SingletonFetchOptions as s, type SettingsFetchOptions as t, SearchClient as u, SearchBuilder as v, AutocompleteBuilder as w, SimilarBuilder as x, type SearchMode as y, type SearchResultItem as z };