@relyio/sdk 0.2.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 (45) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/LICENSE +201 -0
  3. package/README.md +314 -0
  4. package/dist/.tsbuildinfo +1 -0
  5. package/dist/chunk-2QUK2ZGD.js +738 -0
  6. package/dist/chunk-7W4MJXQ4.cjs +4429 -0
  7. package/dist/chunk-FJK7ZWKK.cjs +776 -0
  8. package/dist/chunk-HT6NFRM2.cjs +196 -0
  9. package/dist/chunk-I3ESNANB.js +177 -0
  10. package/dist/chunk-IY5LSKXU.js +3 -0
  11. package/dist/chunk-MWMSFIWN.cjs +17 -0
  12. package/dist/chunk-PPA2WWOH.cjs +4 -0
  13. package/dist/chunk-RJBIJ2ZK.js +4375 -0
  14. package/dist/chunk-XQ4QHWZE.js +13 -0
  15. package/dist/client/index.cjs +17 -0
  16. package/dist/client/index.d.cts +3 -0
  17. package/dist/client/index.d.ts +3 -0
  18. package/dist/client/index.js +4 -0
  19. package/dist/define-schema-DHvUCKwj.d.cts +2101 -0
  20. package/dist/define-schema-DHvUCKwj.d.ts +2101 -0
  21. package/dist/index-B-KiFHbx.d.ts +2708 -0
  22. package/dist/index-BsUqCAu8.d.cts +7855 -0
  23. package/dist/index-BsUqCAu8.d.ts +7855 -0
  24. package/dist/index-DGWaawHt.d.cts +2708 -0
  25. package/dist/index.cjs +499 -0
  26. package/dist/index.d.cts +523 -0
  27. package/dist/index.d.ts +523 -0
  28. package/dist/index.js +148 -0
  29. package/dist/react/index.cjs +4 -0
  30. package/dist/react/index.d.cts +2 -0
  31. package/dist/react/index.d.ts +2 -0
  32. package/dist/react/index.js +3 -0
  33. package/dist/schema/index.cjs +157 -0
  34. package/dist/schema/index.d.cts +223 -0
  35. package/dist/schema/index.d.ts +223 -0
  36. package/dist/schema/index.js +4 -0
  37. package/dist/types/index.cjs +6 -0
  38. package/dist/types/index.d.cts +1 -0
  39. package/dist/types/index.d.ts +1 -0
  40. package/dist/types/index.js +3 -0
  41. package/dist/utils/index.cjs +81 -0
  42. package/dist/utils/index.d.cts +87 -0
  43. package/dist/utils/index.d.ts +87 -0
  44. package/dist/utils/index.js +4 -0
  45. package/package.json +159 -0
@@ -0,0 +1,523 @@
1
+ export { N as AdhocAggregateBlock, M as AdhocFetchBlock, L as AdhocQueryBuilder, K as AdhocQueryClient, W as AdhocQueryDefinition, X as AdhocQueryOptions, Z as AdhocQueryResult, P as AdhocSearchBlock, Q as AdhocSimilarBlock, O as AggregateMetric, _ as AssetClient, a8 as AssetEntryResponse, a5 as AssetFileBlock, $ as AssetFileBuilder, a6 as AssetFileExtracted, a0 as AssetUploadBuilder, a7 as AssetUrls, a2 as AssetVisibility, A as AutocompleteBuilder, t as AutocompleteResponse, s as AutocompleteSuggestion, y as BatchBuilder, B as BatchClient, z as BatchMethod, D as BatchOperation, G as BatchOperationResult, F as BatchOptions, J as BatchResponse, I as BatchSummary, j as ChildrenOptions, C as ClientSchema, b as ConditionalWriteOptions, ac as ConfirmInput, ad as ConfirmResult, i as ContentByIdBuilder, d as ContentClient, h as ContentQueryBuilder, ag as CreateAssetOptions, E as ExtendedQueryResult, a4 as FileBackend, am as FileErrorCode, a3 as FileStatus, an as FileUploadError, ap as FileValidationConstraints, ao as FileValidationError, U as FilterValue, V as FullTextConfig, H as HttpClient, ai as MultipartCreateResult, aj as MultipartPart, ak as MultipartTarget, a9 as PopulatedAssetReference, aa as PresignInput, ab as PresignResult, Y as QueryMetadata, ae as ResolveUrlInput, af as ResolveUrlResult, R as RetryableWriteOptions, n as SearchBuilder, m as SearchClient, x as SearchFields, w as SearchFilter, p as SearchMode, r as SearchResponse, q as SearchResultItem, S as SendOptions, g as SettingsClient, l as SettingsFetchOptions, o as SimilarBuilder, v as SimilarResponse, u as SimilarResult, f as SingletonClient, k as SingletonFetchOptions, a as TypedClientConfig, T as TypedRelyIOClient, al as UploadProgress, ah as WaitUntilReadyOptions, c as createClient, c as default, e as entityTagOf, a1 as isAssetEntry, aq as validateFile } from './index-DGWaawHt.cjs';
2
+ export { fields } from './schema/index.cjs';
3
+ import { S as SDKError } from './index-BsUqCAu8.cjs';
4
+ export { a as ApiMethod, A as ApiPath, r as ApiResponse, b as ApiSuccessBody, B as BaseContent, v as BaseValidationError, o as CacheConfig, t as CacheStrategy, f as ContentQueryResult, j as ContentTypeSchema, C as CreateInput, i as CustomQuery, D as DebugConfig, E as Environment, k as FieldOptions, F as FieldTypeName, z as InvalidFieldTypeError, I as InvalidPayloadError, L as LogLevel, P as PerformanceMetrics, Q as QueryOptions, p as RealtimeConfig, m as RealtimeEvent, l as RealtimeEventType, R as RelyIOConfig, q as RequestConfig, y as RequiredFieldError, s as RetryConfig, x as SchemaValidationError, h as SettingsGroup, g as SingletonContent, e as SortOptions, n as SubscriptionOptions, U as UpdateInput, w as ValidationError, V as ValidationRule, u as ValidationViolation, c as WhereClause, d as WhereOperator, W as Wire } from './index-BsUqCAu8.cjs';
5
+ export { camelToSnake, createDeferred, debounce, deepClone, generateId, isBrowser, isNode, isPlainObject, isValidEmail, isValidUrl, mergeDeep, omit, pick, retry, sleep, snakeToCamel, throttle, toSafeString } from './utils/index.cjs';
6
+ export { bv as AggregateBlock, ap as AssetTypeConfig, as as AssetTypeDefinition, n as BaseFieldConfig, ae as ComponentConfig, af as ComponentDefinition, ag as ComponentMetadata, a1 as ContentTypeConfig, a2 as ContentTypeConfigWithFields, a3 as ContentTypeConfigWithFieldsets, a4 as ContentTypeDefinition, a5 as EntryMetadata, bu as FetchBlock, c as FieldDefinition, b as FieldRule, o as FieldType, F as FieldUIConfig, a0 as Fieldset, aw as FileKindConfig, aK as FileScanConfig, aJ as FileUploadConfig, bF as FilterDefinition, aC as ImageExifConfig, au as ImageKindConfig, aB as ImageSourceConfig, aA as ImageUploadConfig, bD as IncludeDefinition, at as InferAssetType, a6 as InferContentType, bL as InferQueryParams, bK as InferQueryResponse, ac as InferSingleton, ab as InferSingletonContentType, L as LocalizationConfig, bs as QueryConfig, bt as QueryDefinition, K as SchemaAssetTypeNames, w as SchemaConfig, y as SchemaContentTypeNames, x as SchemaDefinition, H as SchemaLocaleCodes, G as SchemaQueryNames, J as SchemaSettingsGroupNames, z as SchemaSingletonNames, bw as SearchBlock, bE as SelectMapping, ak as SettingsGroupConfig, al as SettingsGroupDefinition, bx as SimilarBlock, a9 as SingletonContentTypeDefinition, aa as SingletonMetadata, bB as SortCondition, aD as VariantDefinition, aG as VideoCaptionsConfig, aH as VideoDownloadConfig, av as VideoKindConfig, aF as VideoPosterConfig, aE as VideoUploadConfig, aI as VideoWatermarkConfig, by as WhereCondition, ao as defineAssetType, ad as defineComponent, _ as defineContentType, br as defineQuery, u as defineSchema, aj as defineSettingsGroup, a8 as defineSingleton, a7 as defineSingletonContentType, $ as fieldset, v as schemaToJSON } from './define-schema-DHvUCKwj.cjs';
7
+
8
+ /**
9
+ * Network-related errors
10
+ */
11
+ declare class NetworkError extends SDKError {
12
+ readonly code = "NETWORK_ERROR";
13
+ readonly retryable = true;
14
+ constructor(message?: string, statusCode?: number, cause?: Error, context?: Record<string, unknown>);
15
+ getUserMessage(): string;
16
+ }
17
+ declare class TimeoutError extends SDKError {
18
+ readonly code = "TIMEOUT_ERROR";
19
+ readonly retryable = true;
20
+ constructor(message?: string, timeout?: number, statusCode?: number, cause?: Error);
21
+ getUserMessage(): string;
22
+ }
23
+ declare class ConnectionError extends SDKError {
24
+ readonly code = "CONNECTION_ERROR";
25
+ readonly retryable = true;
26
+ constructor(message?: string, statusCode?: number, cause?: Error, context?: Record<string, unknown>);
27
+ getUserMessage(): string;
28
+ }
29
+
30
+ /**
31
+ * Authentication and authorization errors.
32
+ *
33
+ * `ExpiredTokenError` was deleted at API5. The mapper reached it by sniffing an
34
+ * `EXPIRED_TOKEN` code, and no route in the closed vocabulary can send that
35
+ * name — so nothing could construct it and nothing could catch it
36
+ * (`INV-API-CODES-ARE-A-CLOSED-UNION`: a code no route declares is deleted, not
37
+ * retained). An API key that has expired arrives as `INVALID_API_KEY` with
38
+ * `details.reason: 'expired'`.
39
+ */
40
+ declare class AuthenticationError extends SDKError {
41
+ readonly code = "AUTHENTICATION_ERROR";
42
+ readonly retryable = false;
43
+ constructor(message?: string, statusCode?: number, cause?: Error, context?: Record<string, unknown>);
44
+ getUserMessage(): string;
45
+ }
46
+ declare class AuthorizationError extends SDKError {
47
+ readonly code = "AUTHORIZATION_ERROR";
48
+ readonly retryable = false;
49
+ constructor(message?: string, statusCode?: number, cause?: Error, context?: Record<string, unknown>);
50
+ getUserMessage(): string;
51
+ }
52
+ declare class InvalidApiKeyError extends SDKError {
53
+ readonly code = "INVALID_API_KEY";
54
+ readonly retryable = false;
55
+ constructor(message?: string, cause?: Error, context?: Record<string, unknown>);
56
+ getUserMessage(): string;
57
+ }
58
+
59
+ /**
60
+ * Content and resource errors.
61
+ *
62
+ * `ContentTypeNotFoundError` and `ContentNotFoundError` were deleted at API5.
63
+ * The mapper reached them by sniffing `CONTENT_TYPE_NOT_FOUND` and
64
+ * `CONTENT_NOT_FOUND`, neither of which is in the closed vocabulary, so neither
65
+ * class was reachable. Both cases are `RESOURCE_NOT_FOUND`, whose declared
66
+ * `details` are `{ kind, id? }` — the same two facts, from the one code a route
67
+ * can actually declare.
68
+ */
69
+ declare class ResourceNotFoundError extends SDKError {
70
+ readonly code = "RESOURCE_NOT_FOUND";
71
+ readonly retryable = false;
72
+ constructor(message?: string, statusCode?: number, cause?: Error, context?: Record<string, unknown>);
73
+ getUserMessage(): string;
74
+ }
75
+ declare class ResourceConflictError extends SDKError {
76
+ readonly code = "RESOURCE_CONFLICT";
77
+ readonly retryable = false;
78
+ constructor(message?: string, statusCode?: number, cause?: Error, context?: Record<string, unknown>);
79
+ getUserMessage(): string;
80
+ }
81
+ declare class ResourceExpiredError extends SDKError {
82
+ readonly code = "RESOURCE_EXPIRED";
83
+ readonly retryable = false;
84
+ constructor(message?: string, statusCode?: number, cause?: Error, context?: Record<string, unknown>);
85
+ getUserMessage(): string;
86
+ }
87
+ /**
88
+ * "Did the service say this resource does not exist?"
89
+ *
90
+ * Reads the **code**, not the status. Four contract codes are 4xx on a read and
91
+ * only one of them means "not there"; the incumbent checked `statusCode === 404`
92
+ * on the thrown value, and a second arm duck-typed a plain object for the same
93
+ * number so a hand-written test double would pass. Both are the branch
94
+ * `INV-API-CLIENT-IS-DERIVED` forbids where a code exists — and the second one
95
+ * only existed because the tests faked the boundary (rule 20). They now stub
96
+ * `fetch`, so the double is gone with the branch.
97
+ */
98
+ declare function isResourceNotFound(error: unknown): boolean;
99
+
100
+ /**
101
+ * One class per contract code that had none.
102
+ *
103
+ * The vocabulary's organising rule is Decision 3's: a code exists only if a
104
+ * client would **do something different** because of it. A mapper that folds
105
+ * `USAGE_QUOTA_EXCEEDED`, `READ_ONLY_KEY` and `PLAN_FEATURE_UNAVAILABLE` into
106
+ * one `AuthorizationError` throws that distinction away at the last step — the
107
+ * server took care to say which of the three it was, and the client that has to
108
+ * decide "retry later", "use a write key" or "upgrade the plan" cannot tell.
109
+ * Before this phase the mapper switched on the numeric **status**, so all three
110
+ * arrived as 403 and were literally indistinguishable.
111
+ *
112
+ * `retryable` is the field the retry loop reads, so it is a behavioural claim
113
+ * rather than a label: `RATE_LIMIT_EXCEEDED` and `SERVICE_INDETERMINATE` are
114
+ * the only refusals a later attempt can change, and `SERVICE_INDETERMINATE`
115
+ * only because `INV-AC-INDETERMINATE-IS-AN-OUTAGE` says it is an outage rather
116
+ * than a denial.
117
+ */
118
+ /** `MISSING_API_KEY` — no `X-API-Key` header reached the service. */
119
+ declare class MissingApiKeyError extends SDKError {
120
+ readonly code = "MISSING_API_KEY";
121
+ readonly retryable = false;
122
+ constructor(message?: string, context?: Record<string, unknown>);
123
+ getUserMessage(): string;
124
+ }
125
+ /** `READ_ONLY_KEY` — the key is valid and cannot write. */
126
+ declare class ReadOnlyKeyError extends SDKError {
127
+ readonly code = "READ_ONLY_KEY";
128
+ readonly retryable = false;
129
+ constructor(message?: string, context?: Record<string, unknown>);
130
+ getUserMessage(): string;
131
+ }
132
+ /** `PLAN_FEATURE_UNAVAILABLE` — the plan does not include the capability. */
133
+ declare class PlanFeatureUnavailableError extends SDKError {
134
+ readonly code = "PLAN_FEATURE_UNAVAILABLE";
135
+ readonly retryable = false;
136
+ /** The entitlement key the service named, when it named one. */
137
+ readonly feature?: string;
138
+ constructor(message?: string, feature?: string, context?: Record<string, unknown>);
139
+ getUserMessage(): string;
140
+ }
141
+ /** `USAGE_QUOTA_EXCEEDED` — a metered allowance is spent for this cycle. */
142
+ declare class UsageQuotaExceededError extends SDKError {
143
+ readonly code = "USAGE_QUOTA_EXCEEDED";
144
+ readonly retryable = false;
145
+ /** The meter the service named. Always present on a refusal from the contract. */
146
+ readonly meter?: string;
147
+ /** The threshold, where the deciding seam carried one — often it does not. */
148
+ readonly limit?: number;
149
+ constructor(message?: string, meter?: string, limit?: number, context?: Record<string, unknown>);
150
+ getUserMessage(): string;
151
+ }
152
+ /**
153
+ * `RATE_LIMIT_EXCEEDED` — too many requests in the window.
154
+ *
155
+ * The one refusal the SDK's own retry loop acts on. `resetAt` and `limit` are
156
+ * optional because the IP window can fill neither honestly, which is the same
157
+ * decision the service made about its `X-RateLimit-*` headers at API0c.
158
+ */
159
+ declare class RateLimitError extends SDKError {
160
+ readonly code = "RATE_LIMIT_EXCEEDED";
161
+ readonly retryable = true;
162
+ readonly limit?: number;
163
+ readonly resetAt?: string;
164
+ constructor(message?: string, limit?: number, resetAt?: string, context?: Record<string, unknown>);
165
+ getUserMessage(): string;
166
+ }
167
+ /** `METHOD_NOT_ALLOWED` — the route exists and does not serve this verb. */
168
+ declare class MethodNotAllowedError extends SDKError {
169
+ readonly code = "METHOD_NOT_ALLOWED";
170
+ readonly retryable = false;
171
+ constructor(message?: string, context?: Record<string, unknown>);
172
+ getUserMessage(): string;
173
+ }
174
+ /** `PAYLOAD_TOO_LARGE` — the request body exceeded the declared ceiling. */
175
+ declare class PayloadTooLargeError extends SDKError {
176
+ readonly code = "PAYLOAD_TOO_LARGE";
177
+ readonly retryable = false;
178
+ readonly limitBytes?: number;
179
+ constructor(message?: string, limitBytes?: number, context?: Record<string, unknown>);
180
+ getUserMessage(): string;
181
+ }
182
+ /**
183
+ * `TRANSACTION_ROLLED_BACK` — an atomic batch failed at one member and nothing
184
+ * was written. `failedIndex` is which one, so a caller can fix that operation
185
+ * rather than re-sending the whole batch blind.
186
+ */
187
+ declare class TransactionRolledBackError extends SDKError {
188
+ readonly code = "TRANSACTION_ROLLED_BACK";
189
+ readonly retryable = false;
190
+ readonly failedIndex?: number;
191
+ constructor(message?: string, failedIndex?: number, context?: Record<string, unknown>);
192
+ getUserMessage(): string;
193
+ }
194
+ /**
195
+ * `SERVICE_INDETERMINATE` — a dependency the service needed to decide was
196
+ * unreachable, so it answered "I could not tell" rather than "no"
197
+ * (`INV-AC-INDETERMINATE-IS-AN-OUTAGE`). Retryable: it is an outage.
198
+ */
199
+ declare class ServiceIndeterminateError extends SDKError {
200
+ readonly code = "SERVICE_INDETERMINATE";
201
+ readonly retryable = true;
202
+ readonly missing?: string;
203
+ constructor(message?: string, missing?: string, context?: Record<string, unknown>);
204
+ getUserMessage(): string;
205
+ }
206
+ /** `INTERNAL_ERROR` — everything a client can only log (Decision 3). */
207
+ declare class ServerError extends SDKError {
208
+ readonly code = "INTERNAL_ERROR";
209
+ readonly retryable = true;
210
+ constructor(message?: string, statusCode?: number, context?: Record<string, unknown>);
211
+ getUserMessage(): string;
212
+ }
213
+ /**
214
+ * A refusal whose code this build of the SDK does not know.
215
+ *
216
+ * This is the arm the widened union forces a `default` for, and it is the
217
+ * normal case for a published client: the service can gain a code at any time
218
+ * and every SDK already installed is older than that. Carrying the code through
219
+ * as data is what keeps adding one additive — the alternative, a thrown parse
220
+ * failure, would turn a new server code into a client crash.
221
+ */
222
+ declare class UnknownContractError extends SDKError {
223
+ readonly code: string;
224
+ readonly retryable = false;
225
+ constructor(code: string, message: string, statusCode: number, context?: Record<string, unknown>);
226
+ getUserMessage(): string;
227
+ }
228
+
229
+ /**
230
+ * Map a RelyIO refusal onto an SDK error class.
231
+ *
232
+ * **It switches on `error.code`, not on the numeric status.** The status is a
233
+ * transport fact and it is lossy by design: five contract codes share 403 and
234
+ * two share 401, so a status-driven mapper cannot tell `MISSING_API_KEY` from
235
+ * `INVALID_API_KEY` — the client that would prompt for a key and the client
236
+ * that would rotate one got the same class. Switching on the code is what
237
+ * `INV-API-CLIENT-IS-DERIVED` means by "MUST NOT branch on the numeric status
238
+ * where a contract code exists".
239
+ *
240
+ * There is no `isApiErrorData` here any more. It accepted **any** object, so it
241
+ * asserted nothing, and every read past it was a guess. `readError` from the
242
+ * contract is the one parser: it returns the refusal or `undefined`, and
243
+ * `undefined` means the body was never a RelyIO refusal — a proxy page, a
244
+ * gateway timeout — which is reported as a transport failure rather than
245
+ * dressed up as one of the service's codes (rule 6).
246
+ *
247
+ * The `default` arm is not optional and is not defensive padding: the
248
+ * customer-facing union is widened with an unknown arm precisely so this switch
249
+ * cannot compile without it (Decision 13). A published SDK is always older than
250
+ * the service, so a code it has never heard of is the expected case and must
251
+ * reach the caller as data.
252
+ */
253
+ declare class ErrorMapper {
254
+ /** Map a non-2xx response to an SDK error. */
255
+ static mapHttpError(response: {
256
+ status: number;
257
+ statusText: string;
258
+ body?: unknown;
259
+ headers?: Record<string, string>;
260
+ }, requestContext?: Record<string, unknown>): SDKError;
261
+ private static fromContractCode;
262
+ /**
263
+ * Map generic JavaScript errors to SDK errors
264
+ */
265
+ static mapGenericError(error: Error, _context?: Record<string, unknown>): SDKError;
266
+ /**
267
+ * Check if an error is retryable
268
+ */
269
+ static isRetryable(error: Error): boolean;
270
+ /**
271
+ * Extract retry delay from error
272
+ */
273
+ static getRetryDelay(_error: Error): number;
274
+ }
275
+
276
+ /**
277
+ * Locale utilities and helpers for the RelyIO SDK
278
+ *
279
+ * Provides convenient functions for working with localized content,
280
+ * building language switchers, and detecting translation status.
281
+ *
282
+ * @example
283
+ * ```typescript
284
+ * import { localeHelpers } from '@relyio/sdk'
285
+ *
286
+ * // Check if entry needs translation
287
+ * const needsWork = localeHelpers.needsTranslation(entry, 'de-DE')
288
+ *
289
+ * // Build language switcher options
290
+ * const options = localeHelpers.buildLanguageSwitcher(entry, {
291
+ * currentLocale: 'en-US',
292
+ * })
293
+ * ```
294
+ */
295
+ /**
296
+ * Locale status information from entry metadata
297
+ */
298
+ interface LocaleStatus {
299
+ code: string;
300
+ status: 'published' | 'draft' | 'archived';
301
+ version?: number;
302
+ publishedAt?: string;
303
+ }
304
+ /**
305
+ * Entry metadata with locale information
306
+ */
307
+ interface LocaleMetadata {
308
+ locale?: string;
309
+ requestedLocale?: string;
310
+ defaultLocale?: string;
311
+ localeFallbacksApplied?: Record<string, string>;
312
+ availableLocales?: LocaleStatus[];
313
+ localizations?: Record<string, unknown>;
314
+ }
315
+ /**
316
+ * Entry with locale metadata
317
+ */
318
+ interface LocalizedEntry {
319
+ _metadata?: LocaleMetadata;
320
+ [key: string]: unknown;
321
+ }
322
+ /**
323
+ * Language switcher option
324
+ */
325
+ interface LanguageSwitcherOption {
326
+ code: string;
327
+ label: string;
328
+ status: 'published' | 'draft' | 'archived';
329
+ isCurrent: boolean;
330
+ isDefault: boolean;
331
+ hasContent: boolean;
332
+ }
333
+ /**
334
+ * Options for building language switcher
335
+ */
336
+ interface LanguageSwitcherOptions {
337
+ /** Current locale code */
338
+ currentLocale: string;
339
+ /** Whether to show inactive locales */
340
+ showInactive?: boolean;
341
+ /** Whether to show archived locales */
342
+ showArchived?: boolean;
343
+ /** Custom display name resolver */
344
+ getDisplayName?: (code: string) => string;
345
+ }
346
+ /**
347
+ * Translation completeness per locale
348
+ */
349
+ interface TranslationCompleteness {
350
+ [localeCode: string]: number;
351
+ }
352
+ /**
353
+ * Check if an entry needs translation for a specific locale
354
+ *
355
+ * Returns true if any fields fell back to another locale
356
+ *
357
+ * @example
358
+ * ```typescript
359
+ * const product = await client.content('product')
360
+ * .findById('prod_123')
361
+ * .locale('de-DE')
362
+ * .execute()
363
+ *
364
+ * if (localeHelpers.needsTranslation(product)) {
365
+ * showTranslationBadge()
366
+ * }
367
+ * ```
368
+ */
369
+ declare function needsTranslation(entry: LocalizedEntry, locale?: string): boolean;
370
+ /**
371
+ * Get the fields that are using fallback content
372
+ *
373
+ * @example
374
+ * ```typescript
375
+ * const fallbackFields = localeHelpers.getFallbackFields(product)
376
+ * // Returns: { description: 'en-US', excerpt: 'en-US' }
377
+ * ```
378
+ */
379
+ declare function getFallbackFields(entry: LocalizedEntry): Record<string, string>;
380
+ /**
381
+ * Check if a specific field is using fallback content
382
+ */
383
+ declare function isFieldFallback(entry: LocalizedEntry, fieldName: string): boolean;
384
+ /**
385
+ * Get the fallback locale for a specific field
386
+ */
387
+ declare function getFieldFallbackLocale(entry: LocalizedEntry, fieldName: string): string | null;
388
+ /**
389
+ * Build language switcher options from an entry
390
+ *
391
+ * @example
392
+ * ```typescript
393
+ * const options = localeHelpers.buildLanguageSwitcher(product, {
394
+ * currentLocale: 'en-US',
395
+ * showArchived: false,
396
+ * })
397
+ *
398
+ * // Returns:
399
+ * // [
400
+ * // { code: 'en-US', label: 'English (US)', status: 'published', isCurrent: true, isDefault: true, hasContent: true },
401
+ * // { code: 'es-ES', label: 'es-ES', status: 'published', isCurrent: false, isDefault: false, hasContent: true },
402
+ * // ]
403
+ * ```
404
+ */
405
+ declare function buildLanguageSwitcher(entry: LocalizedEntry, options: LanguageSwitcherOptions): LanguageSwitcherOption[];
406
+ /**
407
+ * Get available locale codes from an entry
408
+ */
409
+ declare function getAvailableLocaleCodes(entry: LocalizedEntry): string[];
410
+ /**
411
+ * Get published locale codes from an entry
412
+ */
413
+ declare function getPublishedLocaleCodes(entry: LocalizedEntry): string[];
414
+ /**
415
+ * Check if an entry has content in a specific locale
416
+ */
417
+ declare function hasLocale(entry: LocalizedEntry, localeCode: string): boolean;
418
+ /**
419
+ * Check if an entry is published in a specific locale
420
+ */
421
+ declare function isPublishedInLocale(entry: LocalizedEntry, localeCode: string): boolean;
422
+ /**
423
+ * Get the default locale from entry metadata
424
+ */
425
+ declare function getDefaultLocale(entry: LocalizedEntry): string | null;
426
+ /**
427
+ * Get the requested locale from entry metadata
428
+ */
429
+ declare function getRequestedLocale(entry: LocalizedEntry): string | null;
430
+ /**
431
+ * Calculate translation completeness percentage for each locale
432
+ *
433
+ * This is an estimate based on available locale information.
434
+ * For accurate completeness, you should track field-level translations.
435
+ *
436
+ * @example
437
+ * ```typescript
438
+ * const completeness = localeHelpers.estimateTranslationCompleteness(entry, ['title', 'description', 'excerpt'])
439
+ * // Returns: { 'en-US': 100, 'es-ES': 66, 'de-DE': 33 }
440
+ * ```
441
+ */
442
+ declare function estimateTranslationCompleteness(entry: LocalizedEntry, localizedFieldNames: string[]): TranslationCompleteness;
443
+ /**
444
+ * Get localized content from entry's localizations
445
+ *
446
+ * @example
447
+ * ```typescript
448
+ * const entry = await client.content('product')
449
+ * .findById('prod_123')
450
+ * .allLocales()
451
+ * .execute()
452
+ *
453
+ * const spanishTitle = localeHelpers.getLocalizedField(entry, 'title', 'es-ES')
454
+ * ```
455
+ */
456
+ declare function getLocalizedField<T = unknown>(entry: LocalizedEntry, fieldName: string, localeCode: string): T | null;
457
+ /**
458
+ * Get all localized values for a field
459
+ *
460
+ * @example
461
+ * ```typescript
462
+ * const titles = localeHelpers.getAllLocalizedValues(entry, 'title')
463
+ * // Returns: { 'en-US': 'Product', 'es-ES': 'Producto', 'de-DE': 'Produkt' }
464
+ * ```
465
+ */
466
+ declare function getAllLocalizedValues(entry: LocalizedEntry, fieldName: string): Record<string, unknown>;
467
+ /**
468
+ * Locale helpers namespace for convenient access
469
+ */
470
+ declare const localeHelpers: {
471
+ needsTranslation: typeof needsTranslation;
472
+ getFallbackFields: typeof getFallbackFields;
473
+ isFieldFallback: typeof isFieldFallback;
474
+ getFieldFallbackLocale: typeof getFieldFallbackLocale;
475
+ buildLanguageSwitcher: typeof buildLanguageSwitcher;
476
+ getAvailableLocaleCodes: typeof getAvailableLocaleCodes;
477
+ getPublishedLocaleCodes: typeof getPublishedLocaleCodes;
478
+ hasLocale: typeof hasLocale;
479
+ isPublishedInLocale: typeof isPublishedInLocale;
480
+ getDefaultLocale: typeof getDefaultLocale;
481
+ getRequestedLocale: typeof getRequestedLocale;
482
+ estimateTranslationCompleteness: typeof estimateTranslationCompleteness;
483
+ getLocalizedField: typeof getLocalizedField;
484
+ getAllLocalizedValues: typeof getAllLocalizedValues;
485
+ };
486
+
487
+ /**
488
+ * RelyIO SDK - Main Entry Point
489
+ *
490
+ * @example With schema (fully typed, recommended)
491
+ * ```typescript
492
+ * import { createClient, defineSchema, defineContentType, fields } from '@relyio/sdk'
493
+ *
494
+ * const product = defineContentType('product', {
495
+ * displayName: 'Product',
496
+ * fields: [
497
+ * fields.shortText('title', { config: { required: true } }),
498
+ * fields.decimal('price', { config: { min: 0, decimalPlaces: 2 } }),
499
+ * ]
500
+ * })
501
+ *
502
+ * const schema = defineSchema({ contentTypes: { product } })
503
+ * const client = createClient({ apiKey: '...', schema })
504
+ *
505
+ * // Full autocomplete for content types and fields!
506
+ * const products = await client.content('product').query().execute()
507
+ * ```
508
+ *
509
+ * @example Without schema (dynamic usage)
510
+ * ```typescript
511
+ * import { createClient } from '@relyio/sdk'
512
+ *
513
+ * const client = createClient({ apiKey: '...' })
514
+ *
515
+ * // Works dynamically without type checking
516
+ * const products = await client.content('product').query().execute()
517
+ * const results = await client.search('wireless').in('product').execute()
518
+ * ```
519
+ */
520
+
521
+ declare const VERSION = "__VERSION__";
522
+
523
+ export { AuthenticationError, AuthorizationError, ConnectionError, ErrorMapper, InvalidApiKeyError, type LanguageSwitcherOption, type LanguageSwitcherOptions, type LocaleMetadata, type LocaleStatus, type LocalizedEntry, MethodNotAllowedError, MissingApiKeyError, NetworkError, PayloadTooLargeError, PlanFeatureUnavailableError, RateLimitError, ReadOnlyKeyError, ResourceConflictError, ResourceExpiredError, ResourceNotFoundError, SDKError, ServerError, ServiceIndeterminateError, TimeoutError, TransactionRolledBackError, type TranslationCompleteness, UnknownContractError, UsageQuotaExceededError, VERSION, buildLanguageSwitcher, estimateTranslationCompleteness, getAllLocalizedValues, getAvailableLocaleCodes, getDefaultLocale, getFallbackFields, getFieldFallbackLocale, getLocalizedField, getPublishedLocaleCodes, getRequestedLocale, hasLocale, isFieldFallback, isPublishedInLocale, isResourceNotFound, localeHelpers, needsTranslation };