@relyio/sdk 0.12.0 → 0.14.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 (48) hide show
  1. package/CHANGELOG.md +228 -0
  2. package/dist/{chunk-3DRDHXLY.js → chunk-5UMY6CS4.js} +435 -23
  3. package/dist/{chunk-FRJEUAAF.js → chunk-DBBZVZOS.js} +968 -2670
  4. package/dist/{chunk-DXCVO6M5.cjs → chunk-GUPV2M3X.cjs} +969 -2680
  5. package/dist/{chunk-POEEDYFM.js → chunk-PCFTJLEP.js} +543 -260
  6. package/dist/{chunk-FI5VIF4M.cjs → chunk-RSHMA4KT.cjs} +442 -22
  7. package/dist/{chunk-3MSFWXQL.cjs → chunk-X4KSS7PP.cjs} +542 -260
  8. package/dist/client/index.cjs +3 -3
  9. package/dist/client/index.d.cts +4 -5
  10. package/dist/client/index.d.ts +4 -5
  11. package/dist/client/index.js +1 -1
  12. package/dist/{include-paths-CL4gHv6I.d.cts → define-content-type-BUZeWtpk.d.cts} +4458 -1312
  13. package/dist/{include-paths-CrJNTsMl.d.ts → define-content-type-DOrZb_a_.d.ts} +4458 -1312
  14. package/dist/define-schema-5aHmsA8j.d.ts +699 -0
  15. package/dist/define-schema-nCfZeboB.d.cts +699 -0
  16. package/dist/index-B97ZDj44.d.ts +507 -0
  17. package/dist/index-C-pcllqY.d.cts +507 -0
  18. package/dist/index-DOhFQbv7.d.ts +3065 -0
  19. package/dist/index-DgVV5Nj7.d.cts +3065 -0
  20. package/dist/index.cjs +114 -147
  21. package/dist/index.d.cts +49 -87
  22. package/dist/index.d.ts +49 -87
  23. package/dist/index.js +5 -29
  24. package/dist/markdown/index.cjs +13750 -0
  25. package/dist/markdown/index.d.cts +111 -0
  26. package/dist/markdown/index.d.ts +111 -0
  27. package/dist/markdown/index.js +13742 -0
  28. package/dist/rich-text/index.cjs +26 -6
  29. package/dist/rich-text/index.d.cts +3 -148
  30. package/dist/rich-text/index.d.ts +3 -148
  31. package/dist/rich-text/index.js +1 -1
  32. package/dist/rich-text.d-BWc-5gX1.d.cts +326 -0
  33. package/dist/rich-text.d-BWc-5gX1.d.ts +326 -0
  34. package/dist/schema/index.cjs +33 -37
  35. package/dist/schema/index.d.cts +37 -191
  36. package/dist/schema/index.d.ts +37 -191
  37. package/dist/schema/index.js +1 -1
  38. package/dist/types/index.d.cts +2 -3
  39. package/dist/types/index.d.ts +2 -3
  40. package/package.json +14 -3
  41. package/dist/define-schema-DgctHlI2.d.cts +0 -1034
  42. package/dist/define-schema-mrEZbY1h.d.ts +0 -1034
  43. package/dist/index-B9RfZVF1.d.ts +0 -861
  44. package/dist/index-BrvEg6-A.d.cts +0 -3729
  45. package/dist/index-Pw0onkJe.d.ts +0 -3729
  46. package/dist/index-b-AkfTUv.d.cts +0 -861
  47. package/dist/rich-text.d-rKmpgdGd.d.cts +0 -200
  48. package/dist/rich-text.d-rKmpgdGd.d.ts +0 -200
package/dist/index.d.cts CHANGED
@@ -1,15 +1,13 @@
1
- import { C as Change, a as ChangesExpiredError, b as ChangesExpiredReason } from './index-BrvEg6-A.cjs';
2
- export { A as ActiveSandbox, a6 as AdhocAggregateBlock, a5 as AdhocFetchBlock, a4 as AdhocQueryBuilder, a3 as AdhocQueryClient, ab as AdhocQueryDefinition, ac as AdhocQueryOptions, ae as AdhocQueryResult, a8 as AdhocSearchBlock, a7 as AggregateMetric, af as AssetClient, aq as AssetEntryResponse, am as AssetFileBlock, ag as AssetFileBuilder, an as AssetFileExtracted, ah as AssetUploadBuilder, ap as AssetUrls, aj as AssetVisibility, y as AutocompleteBuilder, K as AutocompleteResponse, J as AutocompleteSuggestion, Y as BatchBuilder, X as BatchClient, Z as BatchMethod, _ as BatchOperation, a0 as BatchOperationResult, $ as BatchOptions, a2 as BatchResponse, a1 as BatchSummary, k as ChangesHeadOptions, l as ChangesOptions, t as ChildrenOptions, e as ClientSchema, i as ConditionalWriteOptions, au as ConfirmInput, av as ConfirmResult, s as ContentByIdBuilder, o as ContentClient, r as ContentQueryBuilder, ay as CreateAssetOptions, E as ExtendedQueryResult, F as FeedChange, al as FileBackend, aI as FileErrorCode, ak as FileStatus, ao as FileStatusResult, aK as FileUploadError, aJ as FileUploadErrorCode, aM as FileValidationConstraints, aL as FileValidationError, a9 as FilterValue, aa as FullTextConfig, H as HttpClient, L as LIVE_KEEPALIVE_INTERVAL_MS, m as LIVE_SOCKET_OPEN_TIMEOUT_MS, n as LiveChangesOptions, aA as MultipartCreateResult, aB as MultipartPart, aC as MultipartTarget, ar as PopulatedAssetReference, as as PresignInput, at as PresignResult, P as Project, ad as QueryMetadata, R as Register, f as RegisteredSchema, aw as ResolveUrlInput, ax as ResolveUrlResult, aF as ResourceConflictError, aG as ResourceExpiredError, aE as ResourceNotFoundError, j as RetryableWriteOptions, S as SandboxState, x as SearchBuilder, w as SearchClient, W as SearchEntry, Q as SearchFields, O as SearchFilter, G as SearchHitMetadata, B as SearchMode, I as SearchResponse, D as SearchResultItem, U as SearchSort, V as SearchTypeName, g as SendOptions, q as SettingsClient, v as SettingsFetchOptions, z as SimilarBuilder, N as SimilarResponse, M as SimilarResult, p as SingletonClient, u as SingletonFetchOptions, d as TypedClientConfig, T as TypedRelyIOClient, aD as UploadProgress, az as WaitUntilReadyOptions, c as createClient, c as default, h as entityTagOf, ai as isAssetEntry, aH as isResourceNotFound, aN as validateFile } from './index-BrvEg6-A.cjs';
1
+ import { C as Change, a as ChangesExpiredError, b as ChangesExpiredReason } from './index-DgVV5Nj7.cjs';
2
+ export { i as ActiveSandbox, aH as AdhocQuery, aI as AdhocRecord, aF as AggregateMetric, A as AnySchemaDefinition, m as ApiMethod, l as ApiPath, n as ApiSuccessBody, aQ as AssetClient, aZ as AssetEntryResponse, aR as AssetFileBuilder, aX as AssetFileExtracted, b6 as AssetPlacement, aS as AssetUploadBuilder, aU as AssetVisibility, ah as AutocompleteOptions, ac as AutocompleteResponse, ab as AutocompleteSuggestion, ax as BatchBody, ay as BatchCreate, aB as BatchDelete, aE as BatchDeleteTarget, as as BatchOperationResult, aA as BatchReplace, au as BatchResponse, aC as BatchSingletonWrite, at as BatchSummary, aD as BatchTarget, az as BatchUpdate, av as BatchWrite, aw as BatchWriteOptions, s as ChangesHeadOptions, t as ChangesOptions, Q as ChildrenOptions, e as ClientDefaults, f as ClientSchema, b1 as ConfirmInput, b2 as ConfirmResult, y as ContentClient, b5 as CreateAssetOptions, z as CreateEntryOptions, g as DeployedContentType, D as DeployedLocale, J as DocumentFields, U as DocumentReadOptions, K as DocumentVersion, N as DocumentVersionsOptions, O as DocumentWriteOptions, V as EntryList, E as EntryPlacement, B as EntryWriteOptions, F as FeedChange, X as FieldKey, aW as FileBackend, bi as FileErrorCode, aV as FileStatus, aY as FileStatusResult, bk as FileUploadError, bj as FileUploadErrorCode, bm as FileValidationConstraints, bl as FileValidationError, Y as FreshOption, Z as GetOptions, H as Health, j as HttpClient, u as LIVE_KEEPALIVE_INTERVAL_MS, w as LIVE_SOCKET_OPEN_TIMEOUT_MS, _ as ListAllOptions, $ as ListOptions, x as LiveChangesOptions, L as LocaleCodeOf, a0 as LocaleOption, M as MatchRouteOptions, b9 as MultipartCreateResult, ba as MultipartPart, bb as MultipartTarget, aJ as NamedQueryOptions, aK as NamedQueryParams, a1 as Paging, a_ as PopulatedAssetReference, a$ as PresignInput, b0 as PresignResult, P as Project, aL as QueryAggregate, aM as QueryAnswer, aN as QueryCall, aG as QueryMetadata, aO as QueryName, aP as QueryTypeName, a2 as ReadAs, q as ReadEntry, a3 as ReadLocale, R as Register, h as RegisteredSchema, b3 as ResolveUrlInput, b4 as ResolveUrlResult, be as ResourceConflictError, bf as ResourceExpiredError, bd as ResourceNotFoundError, r as RetryableWriteOptions, p as RouteMatch, S as SandboxState, ag as SearchEntry, ai as SearchFacet, aj as SearchFieldKey, ak as SearchHighlight, a9 as SearchHitMetadata, al as SearchOptions, am as SearchPage, aa as SearchResponse, a8 as SearchResultItem, an as SearchScope, ao as SearchSelected, ap as SearchSortOption, af as SearchTypeName, aq as SearchWhere, k as SendOptions, I as SettingsClient, ar as SimilarOptions, ae as SimilarResponse, ad as SimilarResult, G as SingletonClient, a4 as SortOption, d as TypedClientConfig, T as TypedRelyIOClient, b7 as UpdateAssetOptions, bc as UploadProgress, a5 as VersionOptions, b8 as WaitUntilReadyOptions, W as Wire, a6 as WrittenReadScope, a7 as WrittenSort, c as createClient, c as default, aT as isAssetEntry, bh as isMissingEntry, bg as isResourceNotFound, o as matchRoute, bn as validateFile, v as versionCheckOf } from './index-DgVV5Nj7.cjs';
3
3
  export { fields } from './schema/index.cjs';
4
- import { S as SDKError, B as BaseContent } from './index-b-AkfTUv.cjs';
5
- export { c as ApiMethod, A as ApiPath, w as ApiResponse, d as ApiSuccessBody, H as BaseValidationError, t as CacheConfig, y as CacheStrategy, k as ContentQueryResult, o as ContentTypeSchema, C as CreateInput, n as CustomQuery, D as DebugConfig, E as Environment, p as FieldOptions, F as FieldTypeName, J as InvalidPayloadError, L as LiveWebSocket, b as LiveWebSocketConstructor, z as LogLevel, M as MatchRouteOptions, P as PerformanceMetrics, Q as QueryOptions, u as RealtimeConfig, r as RealtimeEvent, q as RealtimeEventType, R as RelyIOConfig, a as RelyIOConfigUpdate, v as RequestConfig, x as RetryConfig, e as RouteMatch, l as SingletonContent, j as SortOptions, s as SubscriptionOptions, U as UpdateInput, I as ValidationError, V as ValidationRule, G as ValidationViolation, h as WhereClause, g as WhereFieldCondition, i as WhereOperator, f as WhereScalar, W as Wire, m as matchRoute } from './index-b-AkfTUv.cjs';
4
+ import { cl as SDKError, aM as EntryMetadata } from './define-content-type-BUZeWtpk.cjs';
5
+ export { aH as AnyDeclaredFieldset, cS as ApiResponse, cq as AssetFileBlock, ak as AssetReading, b2 as AssetServedBlocks, a$ as AssetTypeDefinition, cr as AssetUrls, cs as BaseContent, B as BaseFieldConfig, cu as BaseSettingsGroup, ct as BaseSingleton, cY as BaseValidationError, ai as BlockOf, cO as CacheConfig, cU as CacheStrategy, am as CheckInclude, al as CheckedIncludes, an as ContentReading, aL as ContentTypeDefinition, cG as ContentTypeSchema, cA as CreateInput, cF as CustomQuery, cz as DateOnlyOperator, cQ as DebugConfig, aG as DeclaredFieldset, cW as Environment, h as FieldDefinition, aJ as FieldMember, cJ as FieldOptions, i as FieldRule, ac as FieldSchemaContext, j as FieldType, cH as FieldTypeName, k as FieldUIConfig, ad as FieldValue, ae as FieldValues, aF as Fieldset, b5 as FileKindConfig, bj as FileScanConfig, bi as FileUploadConfig, bb as ImageExifConfig, b3 as ImageKindConfig, ba as ImageSourceConfig, b9 as ImageUploadConfig, ao as IncludablePaths, b1 as InferAssetEntry, b0 as InferAssetType, aN as InferContentType, ca as InferJsonSchema, aT as InferSingleton, c_ as InvalidPayloadError, cb as JsonFieldValue, cc as JsonSchema, cd as JsonValue, ah as Keyed, a_ as KeyedAssetTypeConfig, aK as KeyedContentTypeConfig, K as KeyedEnumConfig, l as KeyedField, m as KeyedFieldOptions, aI as KeyedFieldsetConfig, aV as KeyedSettingsGroupConfig, aQ as KeyedSingletonConfig, co as LiveWebSocket, cp as LiveWebSocketConstructor, aO as LocalePublicationFields, r as LocalizationConfig, s as Localized, t as LocalizedDetails, cV as LogLevel, cN as PerformanceMetrics, aq as ReadWith, ap as Reading, cP as RealtimeConfig, cL as RealtimeEvent, cK as RealtimeEventType, cm as RelyIOConfig, cn as RelyIOConfigUpdate, cR as RequestConfig, cC as RestoredContent, cT as RetryConfig, cB as RevisedContent, aW as SettingsGroupDefinition, ar as SettingsReading, aj as ShapeValue, cE as SingletonContent, aR as SingletonContentTypeDefinition, aS as SingletonMetadata, as as SingletonReading, cM as SubscriptionOptions, ag as UnresolvedEntry, at as UntypedReading, cD as UpdateInput, cZ as ValidationError, cI as ValidationRule, cX as ValidationViolation, bc as VariantDefinition, bf as VideoCaptionsConfig, bg as VideoDownloadConfig, b4 as VideoKindConfig, be as VideoPosterConfig, bd as VideoUploadConfig, bh as VideoWatermarkConfig, cx as WhereClause, cw as WhereFieldCondition, cy as WhereOperator, cv as WhereScalar, W as WidgetOptions, aZ as defineAssetType, aD as defineContentType, aU as defineSettingsGroup, aP as defineSingleton, aE as fieldset } from './define-content-type-BUZeWtpk.cjs';
6
6
  import { VisitorRetry } from './live-visitor.js';
7
7
  export { camelToSnake, createDeferred, debounce, deepClone, generateId, isBrowser, isNode, isPlainObject, isValidEmail, isValidUrl, mergeDeep, omit, pick, retry, sleep, snakeToCamel, throttle, toSafeString } from './utils/index.cjs';
8
- import { a5 as EntryMetadata } from './include-paths-CL4gHv6I.cjs';
9
- export { J as AssetReading, al as AssetTypeConfig, am as AssetTypeDefinition, o as BaseFieldConfig, G as BlockOf, N as CheckInclude, M as CheckedIncludes, P as ContentReading, a3 as ContentTypeConfig, a4 as ContentTypeDefinition, c as FieldDefinition, a2 as FieldMember, b as FieldRule, v as FieldSchemaContext, p as FieldType, F as FieldUIConfig, w as FieldValue, x as FieldValues, a1 as Fieldset, aq as FileKindConfig, aE as FileScanConfig, aD as FileUploadConfig, aw as ImageExifConfig, ao as ImageKindConfig, av as ImageSourceConfig, au as ImageUploadConfig, Q as IncludablePaths, an as InferAssetType, a6 as InferContentType, ae as InferSingleton, ad as InferSingletonContentType, K as Keyed, a7 as LocalePublicationFields, L as LocalizationConfig, X as ReadWith, W as Reading, ag as SettingsGroupConfig, ah as SettingsGroupDefinition, Y as SettingsReading, H as ShapeValue, ab as SingletonContentTypeDefinition, ac as SingletonMetadata, Z as SingletonReading, z as UnresolvedEntry, _ as UntypedReading, ax as VariantDefinition, aA as VideoCaptionsConfig, aB as VideoDownloadConfig, ap as VideoKindConfig, az as VideoPosterConfig, ay as VideoUploadConfig, aC as VideoWatermarkConfig, ak as defineAssetType, $ as defineContentType, af as defineSettingsGroup, a9 as defineSingleton, a8 as defineSingletonContentType, a0 as fieldset } from './include-paths-CL4gHv6I.cjs';
10
- export { RICH_TEXT_VOID_TAGS, RichTextAttributes, RichTextNodeContext, RichTextRenderable, RichTextReplaceableNode, RichTextTag, RichTextTarget, renderRichText, richTextToHtml, richTextToMarkdown, safeRichTextHref } from './rich-text/index.cjs';
11
- export { _ as AggregateBlock, Z as FetchBlock, aa as FilterDefinition, a7 as IncludeDefinition, ak as InferQueryParams, aj as InferQueryResponse, U as QueryConfig, W as QueryDefinition, h as SchemaAssetTypeNames, S as SchemaConfig, b as SchemaContentTypeNames, a as SchemaDefinition, i as SchemaEntry, j as SchemaEntryOf, f as SchemaLocaleCodes, e as SchemaQueryNames, g as SchemaSettingsGroupNames, c as SchemaSingletonNames, $ as SearchBlock, a9 as SelectMapping, a5 as SortCondition, a0 as WhereCondition, Q as defineQuery, d as defineSchema } from './define-schema-DgctHlI2.cjs';
12
- export { R as RichTextBlock, a as RichTextCellAlignment, b as RichTextCodeBlock, c as RichTextCodeGroup, d as RichTextCodeLines, e as RichTextDivider, f as RichTextHeading, g as RichTextInline, h as RichTextLineBreak, i as RichTextLinkMark, j as RichTextList, k as RichTextListItem, l as RichTextListStyle, m as RichTextMark, n as RichTextMarkType, o as RichTextNode, p as RichTextParagraph, q as RichTextQuote, r as RichTextSpan, s as RichTextStructure, t as RichTextTable, u as RichTextTableCell, v as RichTextTableRow, w as RichTextValue } from './rich-text.d-rKmpgdGd.cjs';
8
+ export { n as RICH_TEXT_VOID_TAGS, R as RelyIOFieldAttributes, a as RelyIOFieldName, b as RelyIOFieldPath, c as RelyIOKeyed, q as RichTextAnchorsOption, t as RichTextAttributes, u as RichTextBlocksOf, v as RichTextDeclaredOf, w as RichTextDeclaredWriters, x as RichTextEntryLinkOf, y as RichTextEntryLinkOption, j as RichTextHtmlDeclaredWriters, k as RichTextHtmlFieldOption, l as RichTextHtmlOptions, z as RichTextInlineOf, m as RichTextMarkdownOptions, A as RichTextNodeContext, B as RichTextRenderable, C as RichTextRenderableOf, D as RichTextReplaceableNode, E as RichTextTag, F as RichTextTarget, e as entryHeadingAnchors, g as escapeHtml, o as isDeclaredRichTextNode, r as relyioField, p as renderRichText, d as richTextHeadingAnchors, f as richTextHeadingSlug, h as richTextToHtml, i as richTextToMarkdown, s as safeRichTextHref } from './index-C-pcllqY.cjs';
9
+ export { A as AggregateBlock, L as AnyQueryParameters, M as DeclaredParameters, n as FetchBlock, w as FilterDefinition, I as IncludeDefinition, J as InferQueryParams, G as InferQueryResponse, Q as QueryConfig, l as QueryDefinition, K as QueryParameterValue, h as SchemaAssetTypeNames, S as SchemaConfig, b as SchemaContentTypeNames, a as SchemaDefinition, i as SchemaEntry, j as SchemaEntryOf, f as SchemaLocaleCodes, e as SchemaQueryNames, g as SchemaSettingsGroupNames, c as SchemaSingletonNames, o as SearchBlock, v as SelectMapping, s as SortCondition, W as WhereCondition, k as defineQuery, d as defineSchema } from './define-schema-nCfZeboB.cjs';
10
+ export { e as RichTextBlock, f as RichTextCellAlignment, g as RichTextCodeBlock, h as RichTextCodeGroup, i as RichTextCodeLines, j as RichTextDivider, d as RichTextEntryLinkMark, k as RichTextHeading, l as RichTextInline, m as RichTextLineBreak, n as RichTextLinkMark, o as RichTextList, p as RichTextListItem, q as RichTextListStyle, r as RichTextMark, s as RichTextMarkType, t as RichTextNode, u as RichTextParagraph, v as RichTextQuote, w as RichTextSpan, x as RichTextStructure, y as RichTextTable, z as RichTextTableCell, B as RichTextTableRow, b as RichTextValue } from './rich-text.d-BWc-5gX1.cjs';
13
11
  import './dev-handshake/index.cjs';
14
12
 
15
13
  /**
@@ -687,10 +685,7 @@ interface TranslationCompleteness {
687
685
  *
688
686
  * @example
689
687
  * ```typescript
690
- * const product = await client.content('product')
691
- * .findById('prod_123')
692
- * .locale('de-DE')
693
- * .execute()
688
+ * const product = await client.content('product').get('prod_123', { locale: 'de-DE' })
694
689
  *
695
690
  * if (localeHelpers.needsTranslation(product)) {
696
691
  * showTranslationBadge()
@@ -776,10 +771,7 @@ declare function estimateTranslationCompleteness(entry: LocalizedEntry, localize
776
771
  *
777
772
  * @example
778
773
  * ```typescript
779
- * const entry = await client.content('product')
780
- * .findById('prod_123')
781
- * .allLocales()
782
- * .execute()
774
+ * const entry = await client.content('product').get('prod_123', { locale: '*' })
783
775
  *
784
776
  * const spanishTitle = localeHelpers.getLocalizedField(entry, 'title', 'es-ES')
785
777
  * ```
@@ -816,70 +808,41 @@ declare const localeHelpers: {
816
808
  };
817
809
 
818
810
  /**
819
- * The DOM↔field binding contract, as the one pure helper that emits it.
820
- *
821
- * Spread onto the element that renders a field, it stamps which entry, content type, field and
822
- * locale produced that element, so an editing surface can find the field by scanning the DOM
823
- * rather than by guessing (`INV-TB-BINDING`). The contract is `toolbar-spec.md` §DOM↔field; this
824
- * file is its only implementation.
825
- *
826
- * **Frozen** (`INV-SS-BINDING-FROZEN`). The attribute set is exactly the five below. Adding,
827
- * renaming or dropping one is a new contract, and a new contract is a bump of `data-relyio-v` — a
828
- * page built against version 1 keeps being read as version 1 by any surface that scans it.
829
- *
830
- * **Pure** (`INV-TB-SDK-PURE`). It reads the entry it is handed and returns attributes. It imports
831
- * nothing but the SDK's own types: no realtime, no AI, no first-party code, no framework. That is
832
- * what lets it live in the customer SDK and run on a server render as happily as in a browser.
833
- *
834
- * **Every value comes from the entry.** The id, the content type and the locale are the ones the
835
- * API reported in `_metadata` — the locale is the one the payload's field values were composed
836
- * for. There is deliberately no `locale` argument: a caller-supplied locale could bind a node to a
837
- * locale whose value it is not rendering, which is the silently inferred binding `INV-TB-BINDING`
838
- * forbids.
839
- */
840
-
841
- /** The version of the binding contract this helper emits. */
842
- declare const BINDING_VERSION = "1";
843
- /** The attributes `relyioField` returns — the whole of binding contract version 1. */
844
- interface RelyIOFieldAttributes {
845
- /** The entry's id (`_metadata.id`). */
846
- readonly 'data-relyio-entry': string;
847
- /** The entry's content type (`_metadata.type`); every customer read is keyed by it. */
848
- readonly 'data-relyio-type': string;
849
- /** The field the element renders. */
850
- readonly 'data-relyio-field': string;
851
- /** The locale the entry's field values were composed for (`_metadata.locale`). */
852
- readonly 'data-relyio-locale': string;
853
- /** The binding contract's version. */
854
- readonly 'data-relyio-v': typeof BINDING_VERSION;
855
- }
811
+ * A key path (REL-1814): where a value sits inside an entry, each item on the way named by its
812
+ * `_key` — `sections[_key=="f2k6ub9s"].heading`. A field by its id (`title`), a field of an object's
813
+ * value after the object's (`hero.title`), an item of a list by its key (`faq[_key=="k1"]`) and a
814
+ * field of that item after it (`faq[_key=="k1"].question`), to any depth. Inside a rich-text field a
815
+ * key names a declared Block or Inline element wherever it stands in the tree (`body[_key=="c1"]`):
816
+ * a key is unique within the field, nested trees included, so the path needs no step for the quote
817
+ * or the list item around it, and a field of the node follows it (`body[_key=="c1"].caption`).
818
+ *
819
+ * It is the spelling a validation error's path, a live binding, a comment's anchor and a filled
820
+ * field's path already use, so the address a page stamps is the one the Studio opens a field by,
821
+ * and it stays on its item when the list is reordered — which an index would not. The rule is
822
+ * `@relyio/schema`'s `formatItemPath` and `parseKeyedPath`, restated here because this package takes
823
+ * no runtime from that one (it is build-inlined for types only); `devtools/verification`'s
824
+ * `key-paths-sdk.test.ts` holds the two to one corpus.
825
+ */
826
+ /** One step of a key path: a field by its id, or the item of the list (or rich text) before it. */
827
+ type KeyPathSegment = {
828
+ readonly field: string;
829
+ } | {
830
+ readonly key: string;
831
+ };
856
832
  /**
857
- * The field names `relyioField` accepts for an entry of type `T`.
858
- *
859
- * A schema-typed entry narrows to its declared field names, so they autocomplete and a misspelt
860
- * one does not compile. An entry with no declared fields — `BaseContent`, which is what an
861
- * un-generated client returns — has none to narrow to, and `keyof` of it is `never`; that would
862
- * make the helper uncallable for every untyped customer, so it accepts any field name instead.
833
+ * The key path of an item of the list at `listPath` — `faq[_key=="k1"]` — or of a field inside it
834
+ * when `field` is given: `faq[_key=="k1"].question`. The key is written as a JSON string, so a quote
835
+ * in it stays inside it. `listPath` and `field` are key paths of their own (`sections[_key=="a"].links`,
836
+ * `link.label`).
863
837
  */
864
- type RelyIOFieldName<T extends BaseContent> = [Exclude<keyof T, '_metadata'>] extends [never] ? string : string & Exclude<keyof T, '_metadata'>;
838
+ declare function formatKeyPath(listPath: string, key: string, field?: string): string;
865
839
  /**
866
- * Binding attributes for one field of one entry.
867
- *
868
- * @example
869
- * ```tsx
870
- * import { relyioField } from '@relyio/sdk'
871
- *
872
- * <h1 {...relyioField(post, 'title')}>{post.title}</h1>
873
- * // → data-relyio-entry="6710f…" data-relyio-type="post" data-relyio-field="title"
874
- * // data-relyio-locale="en-US" data-relyio-v="1"
875
- * ```
876
- *
877
- * @throws {TypeError} when the entry's `_metadata` lacks its id, content type or locale. Every
878
- * entry the API returns carries all three, so this is reached only by a value that was not read
879
- * from RelyIO. It throws rather than emitting a partial binding: a node stamped with no locale, or
880
- * none at all, is a binding a surface would have to guess the rest of.
840
+ * A key path read back into its steps: `sections[_key=="a"].links[_key=="b"].label` → `sections`,
841
+ * `a`, `links`, `b`, `label`. A path with no item in it is its field ids (`hero.title` → `hero`,
842
+ * `title`). `null` for anything else — an index (`faq[0]`), an item of an item, an unterminated or
843
+ * empty key, an empty field id — which names no value by key.
881
844
  */
882
- declare function relyioField<T extends BaseContent>(entry: T, field: RelyIOFieldName<T>): RelyIOFieldAttributes;
845
+ declare function parseKeyPath(path: string): KeyPathSegment[] | null;
883
846
 
884
847
  /**
885
848
  * The DOM event a preview surface dispatches when content on the page has changed, and the one
@@ -981,19 +944,18 @@ declare function snapToLadder(value: number): number;
981
944
  * ```typescript
982
945
  * import { createClient, defineSchema, defineContentType, fields } from '@relyio/sdk'
983
946
  *
984
- * const product = defineContentType('product', {
985
- * displayName: 'Product',
986
- * fields: [
987
- * fields.shortText('title', { config: { required: true } }),
988
- * fields.decimal('price', { config: { min: 0, decimalPlaces: 2 } }),
989
- * ]
947
+ * const product = defineContentType({
948
+ * fields: {
949
+ * title: fields.shortText({ required: true }),
950
+ * price: fields.decimal({ min: 0, decimalPlaces: 2 }),
951
+ * },
990
952
  * })
991
953
  *
992
954
  * const schema = defineSchema({ contentTypes: { product } })
993
955
  * const client = createClient({ apiKey: '...', schema })
994
956
  *
995
957
  * // Full autocomplete for content types and fields!
996
- * const products = await client.content('product').query().execute()
958
+ * const { data: products } = await client.content('product').list({ sort: { price: 'asc' } })
997
959
  * ```
998
960
  *
999
961
  * @example Without schema (dynamic usage)
@@ -1003,11 +965,11 @@ declare function snapToLadder(value: number): number;
1003
965
  * const client = createClient({ apiKey: '...' })
1004
966
  *
1005
967
  * // Works dynamically without type checking
1006
- * const products = await client.content('product').query().execute()
1007
- * const results = await client.search('wireless').in('product').execute()
968
+ * const { data: products } = await client.content('product').list()
969
+ * const results = await client.search('wireless', { contentType: 'product' })
1008
970
  * ```
1009
971
  */
1010
972
 
1011
973
  declare const VERSION = "__VERSION__";
1012
974
 
1013
- export { AuthorizationError, BaseContent, Change, type ChangeSource, type ChangeSourceOptions, ChangesExpiredError, ChangesExpiredReason, ConnectionError, EntryMetadata, ErrorMapper, FOLLOW_BACK_OFF_MAX_MS, FOLLOW_RETRY_BASE_MS, FOLLOW_RETRY_MAX_MS, type FollowEnd, type FollowOptions, type FollowResync, type FollowState, type FollowVerdict, IMAGE_LADDER, InvalidApiKeyError, type LanguageSwitcherOption, type LanguageSwitcherOptions, type LiveEdgeEnd, LiveEdgeError, type LocaleMetadata, type LocaleStatus, type LocalizedEntry, MethodNotAllowedError, MissingApiKeyError, NetworkError, PUBLISHABLE_KEY_PREFIX, PayloadTooLargeError, PlanFeatureUnavailableError, RELYIO_CHANGE_EVENT, RELYIO_RESYNC_EVENT, RateLimitError, ReadOnlyKeyError, type RelyIOChangeDetail, type RelyIOFieldAttributes, type RelyIOFieldName, type RelyIOResyncDetail, SDKError, ServerError, ServiceIndeterminateError, TimeoutError, TransactionRolledBackError, type TranslationCompleteness, UnknownContractError, UsageQuotaExceededError, VERSION, buildLanguageSwitcher, classifyFollowFailure, estimateTranslationCompleteness, followChanges, getAllLocalizedValues, getAvailableLocaleCodes, getDefaultLocale, getFallbackFields, getFieldFallbackLocale, getLocalizedField, getPublishedLocaleCodes, getRequestedLocale, hasLocale, isFieldFallback, isPublishableKey, isPublishedInLocale, localeHelpers, needsTranslation, relyioField, snapToLadder };
975
+ export { AuthorizationError, Change, type ChangeSource, type ChangeSourceOptions, ChangesExpiredError, ChangesExpiredReason, ConnectionError, EntryMetadata, ErrorMapper, FOLLOW_BACK_OFF_MAX_MS, FOLLOW_RETRY_BASE_MS, FOLLOW_RETRY_MAX_MS, type FollowEnd, type FollowOptions, type FollowResync, type FollowState, type FollowVerdict, IMAGE_LADDER, InvalidApiKeyError, type KeyPathSegment, type LanguageSwitcherOption, type LanguageSwitcherOptions, type LiveEdgeEnd, LiveEdgeError, type LocaleMetadata, type LocaleStatus, type LocalizedEntry, MethodNotAllowedError, MissingApiKeyError, NetworkError, PUBLISHABLE_KEY_PREFIX, PayloadTooLargeError, PlanFeatureUnavailableError, RELYIO_CHANGE_EVENT, RELYIO_RESYNC_EVENT, RateLimitError, ReadOnlyKeyError, type RelyIOChangeDetail, type RelyIOResyncDetail, SDKError, ServerError, ServiceIndeterminateError, TimeoutError, TransactionRolledBackError, type TranslationCompleteness, UnknownContractError, UsageQuotaExceededError, VERSION, buildLanguageSwitcher, classifyFollowFailure, estimateTranslationCompleteness, followChanges, formatKeyPath, getAllLocalizedValues, getAvailableLocaleCodes, getDefaultLocale, getFallbackFields, getFieldFallbackLocale, getLocalizedField, getPublishedLocaleCodes, getRequestedLocale, hasLocale, isFieldFallback, isPublishableKey, isPublishedInLocale, localeHelpers, needsTranslation, parseKeyPath, snapToLadder };
package/dist/index.d.ts CHANGED
@@ -1,15 +1,13 @@
1
- import { C as Change, a as ChangesExpiredError, b as ChangesExpiredReason } from './index-Pw0onkJe.js';
2
- export { A as ActiveSandbox, a6 as AdhocAggregateBlock, a5 as AdhocFetchBlock, a4 as AdhocQueryBuilder, a3 as AdhocQueryClient, ab as AdhocQueryDefinition, ac as AdhocQueryOptions, ae as AdhocQueryResult, a8 as AdhocSearchBlock, a7 as AggregateMetric, af as AssetClient, aq as AssetEntryResponse, am as AssetFileBlock, ag as AssetFileBuilder, an as AssetFileExtracted, ah as AssetUploadBuilder, ap as AssetUrls, aj as AssetVisibility, y as AutocompleteBuilder, K as AutocompleteResponse, J as AutocompleteSuggestion, Y as BatchBuilder, X as BatchClient, Z as BatchMethod, _ as BatchOperation, a0 as BatchOperationResult, $ as BatchOptions, a2 as BatchResponse, a1 as BatchSummary, k as ChangesHeadOptions, l as ChangesOptions, t as ChildrenOptions, e as ClientSchema, i as ConditionalWriteOptions, au as ConfirmInput, av as ConfirmResult, s as ContentByIdBuilder, o as ContentClient, r as ContentQueryBuilder, ay as CreateAssetOptions, E as ExtendedQueryResult, F as FeedChange, al as FileBackend, aI as FileErrorCode, ak as FileStatus, ao as FileStatusResult, aK as FileUploadError, aJ as FileUploadErrorCode, aM as FileValidationConstraints, aL as FileValidationError, a9 as FilterValue, aa as FullTextConfig, H as HttpClient, L as LIVE_KEEPALIVE_INTERVAL_MS, m as LIVE_SOCKET_OPEN_TIMEOUT_MS, n as LiveChangesOptions, aA as MultipartCreateResult, aB as MultipartPart, aC as MultipartTarget, ar as PopulatedAssetReference, as as PresignInput, at as PresignResult, P as Project, ad as QueryMetadata, R as Register, f as RegisteredSchema, aw as ResolveUrlInput, ax as ResolveUrlResult, aF as ResourceConflictError, aG as ResourceExpiredError, aE as ResourceNotFoundError, j as RetryableWriteOptions, S as SandboxState, x as SearchBuilder, w as SearchClient, W as SearchEntry, Q as SearchFields, O as SearchFilter, G as SearchHitMetadata, B as SearchMode, I as SearchResponse, D as SearchResultItem, U as SearchSort, V as SearchTypeName, g as SendOptions, q as SettingsClient, v as SettingsFetchOptions, z as SimilarBuilder, N as SimilarResponse, M as SimilarResult, p as SingletonClient, u as SingletonFetchOptions, d as TypedClientConfig, T as TypedRelyIOClient, aD as UploadProgress, az as WaitUntilReadyOptions, c as createClient, c as default, h as entityTagOf, ai as isAssetEntry, aH as isResourceNotFound, aN as validateFile } from './index-Pw0onkJe.js';
1
+ import { C as Change, a as ChangesExpiredError, b as ChangesExpiredReason } from './index-DOhFQbv7.js';
2
+ export { i as ActiveSandbox, aH as AdhocQuery, aI as AdhocRecord, aF as AggregateMetric, A as AnySchemaDefinition, m as ApiMethod, l as ApiPath, n as ApiSuccessBody, aQ as AssetClient, aZ as AssetEntryResponse, aR as AssetFileBuilder, aX as AssetFileExtracted, b6 as AssetPlacement, aS as AssetUploadBuilder, aU as AssetVisibility, ah as AutocompleteOptions, ac as AutocompleteResponse, ab as AutocompleteSuggestion, ax as BatchBody, ay as BatchCreate, aB as BatchDelete, aE as BatchDeleteTarget, as as BatchOperationResult, aA as BatchReplace, au as BatchResponse, aC as BatchSingletonWrite, at as BatchSummary, aD as BatchTarget, az as BatchUpdate, av as BatchWrite, aw as BatchWriteOptions, s as ChangesHeadOptions, t as ChangesOptions, Q as ChildrenOptions, e as ClientDefaults, f as ClientSchema, b1 as ConfirmInput, b2 as ConfirmResult, y as ContentClient, b5 as CreateAssetOptions, z as CreateEntryOptions, g as DeployedContentType, D as DeployedLocale, J as DocumentFields, U as DocumentReadOptions, K as DocumentVersion, N as DocumentVersionsOptions, O as DocumentWriteOptions, V as EntryList, E as EntryPlacement, B as EntryWriteOptions, F as FeedChange, X as FieldKey, aW as FileBackend, bi as FileErrorCode, aV as FileStatus, aY as FileStatusResult, bk as FileUploadError, bj as FileUploadErrorCode, bm as FileValidationConstraints, bl as FileValidationError, Y as FreshOption, Z as GetOptions, H as Health, j as HttpClient, u as LIVE_KEEPALIVE_INTERVAL_MS, w as LIVE_SOCKET_OPEN_TIMEOUT_MS, _ as ListAllOptions, $ as ListOptions, x as LiveChangesOptions, L as LocaleCodeOf, a0 as LocaleOption, M as MatchRouteOptions, b9 as MultipartCreateResult, ba as MultipartPart, bb as MultipartTarget, aJ as NamedQueryOptions, aK as NamedQueryParams, a1 as Paging, a_ as PopulatedAssetReference, a$ as PresignInput, b0 as PresignResult, P as Project, aL as QueryAggregate, aM as QueryAnswer, aN as QueryCall, aG as QueryMetadata, aO as QueryName, aP as QueryTypeName, a2 as ReadAs, q as ReadEntry, a3 as ReadLocale, R as Register, h as RegisteredSchema, b3 as ResolveUrlInput, b4 as ResolveUrlResult, be as ResourceConflictError, bf as ResourceExpiredError, bd as ResourceNotFoundError, r as RetryableWriteOptions, p as RouteMatch, S as SandboxState, ag as SearchEntry, ai as SearchFacet, aj as SearchFieldKey, ak as SearchHighlight, a9 as SearchHitMetadata, al as SearchOptions, am as SearchPage, aa as SearchResponse, a8 as SearchResultItem, an as SearchScope, ao as SearchSelected, ap as SearchSortOption, af as SearchTypeName, aq as SearchWhere, k as SendOptions, I as SettingsClient, ar as SimilarOptions, ae as SimilarResponse, ad as SimilarResult, G as SingletonClient, a4 as SortOption, d as TypedClientConfig, T as TypedRelyIOClient, b7 as UpdateAssetOptions, bc as UploadProgress, a5 as VersionOptions, b8 as WaitUntilReadyOptions, W as Wire, a6 as WrittenReadScope, a7 as WrittenSort, c as createClient, c as default, aT as isAssetEntry, bh as isMissingEntry, bg as isResourceNotFound, o as matchRoute, bn as validateFile, v as versionCheckOf } from './index-DOhFQbv7.js';
3
3
  export { fields } from './schema/index.js';
4
- import { S as SDKError, B as BaseContent } from './index-B9RfZVF1.js';
5
- export { c as ApiMethod, A as ApiPath, w as ApiResponse, d as ApiSuccessBody, H as BaseValidationError, t as CacheConfig, y as CacheStrategy, k as ContentQueryResult, o as ContentTypeSchema, C as CreateInput, n as CustomQuery, D as DebugConfig, E as Environment, p as FieldOptions, F as FieldTypeName, J as InvalidPayloadError, L as LiveWebSocket, b as LiveWebSocketConstructor, z as LogLevel, M as MatchRouteOptions, P as PerformanceMetrics, Q as QueryOptions, u as RealtimeConfig, r as RealtimeEvent, q as RealtimeEventType, R as RelyIOConfig, a as RelyIOConfigUpdate, v as RequestConfig, x as RetryConfig, e as RouteMatch, l as SingletonContent, j as SortOptions, s as SubscriptionOptions, U as UpdateInput, I as ValidationError, V as ValidationRule, G as ValidationViolation, h as WhereClause, g as WhereFieldCondition, i as WhereOperator, f as WhereScalar, W as Wire, m as matchRoute } from './index-B9RfZVF1.js';
4
+ import { cl as SDKError, aM as EntryMetadata } from './define-content-type-DOrZb_a_.js';
5
+ export { aH as AnyDeclaredFieldset, cS as ApiResponse, cq as AssetFileBlock, ak as AssetReading, b2 as AssetServedBlocks, a$ as AssetTypeDefinition, cr as AssetUrls, cs as BaseContent, B as BaseFieldConfig, cu as BaseSettingsGroup, ct as BaseSingleton, cY as BaseValidationError, ai as BlockOf, cO as CacheConfig, cU as CacheStrategy, am as CheckInclude, al as CheckedIncludes, an as ContentReading, aL as ContentTypeDefinition, cG as ContentTypeSchema, cA as CreateInput, cF as CustomQuery, cz as DateOnlyOperator, cQ as DebugConfig, aG as DeclaredFieldset, cW as Environment, h as FieldDefinition, aJ as FieldMember, cJ as FieldOptions, i as FieldRule, ac as FieldSchemaContext, j as FieldType, cH as FieldTypeName, k as FieldUIConfig, ad as FieldValue, ae as FieldValues, aF as Fieldset, b5 as FileKindConfig, bj as FileScanConfig, bi as FileUploadConfig, bb as ImageExifConfig, b3 as ImageKindConfig, ba as ImageSourceConfig, b9 as ImageUploadConfig, ao as IncludablePaths, b1 as InferAssetEntry, b0 as InferAssetType, aN as InferContentType, ca as InferJsonSchema, aT as InferSingleton, c_ as InvalidPayloadError, cb as JsonFieldValue, cc as JsonSchema, cd as JsonValue, ah as Keyed, a_ as KeyedAssetTypeConfig, aK as KeyedContentTypeConfig, K as KeyedEnumConfig, l as KeyedField, m as KeyedFieldOptions, aI as KeyedFieldsetConfig, aV as KeyedSettingsGroupConfig, aQ as KeyedSingletonConfig, co as LiveWebSocket, cp as LiveWebSocketConstructor, aO as LocalePublicationFields, r as LocalizationConfig, s as Localized, t as LocalizedDetails, cV as LogLevel, cN as PerformanceMetrics, aq as ReadWith, ap as Reading, cP as RealtimeConfig, cL as RealtimeEvent, cK as RealtimeEventType, cm as RelyIOConfig, cn as RelyIOConfigUpdate, cR as RequestConfig, cC as RestoredContent, cT as RetryConfig, cB as RevisedContent, aW as SettingsGroupDefinition, ar as SettingsReading, aj as ShapeValue, cE as SingletonContent, aR as SingletonContentTypeDefinition, aS as SingletonMetadata, as as SingletonReading, cM as SubscriptionOptions, ag as UnresolvedEntry, at as UntypedReading, cD as UpdateInput, cZ as ValidationError, cI as ValidationRule, cX as ValidationViolation, bc as VariantDefinition, bf as VideoCaptionsConfig, bg as VideoDownloadConfig, b4 as VideoKindConfig, be as VideoPosterConfig, bd as VideoUploadConfig, bh as VideoWatermarkConfig, cx as WhereClause, cw as WhereFieldCondition, cy as WhereOperator, cv as WhereScalar, W as WidgetOptions, aZ as defineAssetType, aD as defineContentType, aU as defineSettingsGroup, aP as defineSingleton, aE as fieldset } from './define-content-type-DOrZb_a_.js';
6
6
  import { VisitorRetry } from './live-visitor.js';
7
7
  export { camelToSnake, createDeferred, debounce, deepClone, generateId, isBrowser, isNode, isPlainObject, isValidEmail, isValidUrl, mergeDeep, omit, pick, retry, sleep, snakeToCamel, throttle, toSafeString } from './utils/index.js';
8
- import { a5 as EntryMetadata } from './include-paths-CrJNTsMl.js';
9
- export { J as AssetReading, al as AssetTypeConfig, am as AssetTypeDefinition, o as BaseFieldConfig, G as BlockOf, N as CheckInclude, M as CheckedIncludes, P as ContentReading, a3 as ContentTypeConfig, a4 as ContentTypeDefinition, c as FieldDefinition, a2 as FieldMember, b as FieldRule, v as FieldSchemaContext, p as FieldType, F as FieldUIConfig, w as FieldValue, x as FieldValues, a1 as Fieldset, aq as FileKindConfig, aE as FileScanConfig, aD as FileUploadConfig, aw as ImageExifConfig, ao as ImageKindConfig, av as ImageSourceConfig, au as ImageUploadConfig, Q as IncludablePaths, an as InferAssetType, a6 as InferContentType, ae as InferSingleton, ad as InferSingletonContentType, K as Keyed, a7 as LocalePublicationFields, L as LocalizationConfig, X as ReadWith, W as Reading, ag as SettingsGroupConfig, ah as SettingsGroupDefinition, Y as SettingsReading, H as ShapeValue, ab as SingletonContentTypeDefinition, ac as SingletonMetadata, Z as SingletonReading, z as UnresolvedEntry, _ as UntypedReading, ax as VariantDefinition, aA as VideoCaptionsConfig, aB as VideoDownloadConfig, ap as VideoKindConfig, az as VideoPosterConfig, ay as VideoUploadConfig, aC as VideoWatermarkConfig, ak as defineAssetType, $ as defineContentType, af as defineSettingsGroup, a9 as defineSingleton, a8 as defineSingletonContentType, a0 as fieldset } from './include-paths-CrJNTsMl.js';
10
- export { RICH_TEXT_VOID_TAGS, RichTextAttributes, RichTextNodeContext, RichTextRenderable, RichTextReplaceableNode, RichTextTag, RichTextTarget, renderRichText, richTextToHtml, richTextToMarkdown, safeRichTextHref } from './rich-text/index.js';
11
- export { _ as AggregateBlock, Z as FetchBlock, aa as FilterDefinition, a7 as IncludeDefinition, ak as InferQueryParams, aj as InferQueryResponse, U as QueryConfig, W as QueryDefinition, h as SchemaAssetTypeNames, S as SchemaConfig, b as SchemaContentTypeNames, a as SchemaDefinition, i as SchemaEntry, j as SchemaEntryOf, f as SchemaLocaleCodes, e as SchemaQueryNames, g as SchemaSettingsGroupNames, c as SchemaSingletonNames, $ as SearchBlock, a9 as SelectMapping, a5 as SortCondition, a0 as WhereCondition, Q as defineQuery, d as defineSchema } from './define-schema-mrEZbY1h.js';
12
- export { R as RichTextBlock, a as RichTextCellAlignment, b as RichTextCodeBlock, c as RichTextCodeGroup, d as RichTextCodeLines, e as RichTextDivider, f as RichTextHeading, g as RichTextInline, h as RichTextLineBreak, i as RichTextLinkMark, j as RichTextList, k as RichTextListItem, l as RichTextListStyle, m as RichTextMark, n as RichTextMarkType, o as RichTextNode, p as RichTextParagraph, q as RichTextQuote, r as RichTextSpan, s as RichTextStructure, t as RichTextTable, u as RichTextTableCell, v as RichTextTableRow, w as RichTextValue } from './rich-text.d-rKmpgdGd.js';
8
+ export { n as RICH_TEXT_VOID_TAGS, R as RelyIOFieldAttributes, a as RelyIOFieldName, b as RelyIOFieldPath, c as RelyIOKeyed, q as RichTextAnchorsOption, t as RichTextAttributes, u as RichTextBlocksOf, v as RichTextDeclaredOf, w as RichTextDeclaredWriters, x as RichTextEntryLinkOf, y as RichTextEntryLinkOption, j as RichTextHtmlDeclaredWriters, k as RichTextHtmlFieldOption, l as RichTextHtmlOptions, z as RichTextInlineOf, m as RichTextMarkdownOptions, A as RichTextNodeContext, B as RichTextRenderable, C as RichTextRenderableOf, D as RichTextReplaceableNode, E as RichTextTag, F as RichTextTarget, e as entryHeadingAnchors, g as escapeHtml, o as isDeclaredRichTextNode, r as relyioField, p as renderRichText, d as richTextHeadingAnchors, f as richTextHeadingSlug, h as richTextToHtml, i as richTextToMarkdown, s as safeRichTextHref } from './index-B97ZDj44.js';
9
+ export { A as AggregateBlock, L as AnyQueryParameters, M as DeclaredParameters, n as FetchBlock, w as FilterDefinition, I as IncludeDefinition, J as InferQueryParams, G as InferQueryResponse, Q as QueryConfig, l as QueryDefinition, K as QueryParameterValue, h as SchemaAssetTypeNames, S as SchemaConfig, b as SchemaContentTypeNames, a as SchemaDefinition, i as SchemaEntry, j as SchemaEntryOf, f as SchemaLocaleCodes, e as SchemaQueryNames, g as SchemaSettingsGroupNames, c as SchemaSingletonNames, o as SearchBlock, v as SelectMapping, s as SortCondition, W as WhereCondition, k as defineQuery, d as defineSchema } from './define-schema-5aHmsA8j.js';
10
+ export { e as RichTextBlock, f as RichTextCellAlignment, g as RichTextCodeBlock, h as RichTextCodeGroup, i as RichTextCodeLines, j as RichTextDivider, d as RichTextEntryLinkMark, k as RichTextHeading, l as RichTextInline, m as RichTextLineBreak, n as RichTextLinkMark, o as RichTextList, p as RichTextListItem, q as RichTextListStyle, r as RichTextMark, s as RichTextMarkType, t as RichTextNode, u as RichTextParagraph, v as RichTextQuote, w as RichTextSpan, x as RichTextStructure, y as RichTextTable, z as RichTextTableCell, B as RichTextTableRow, b as RichTextValue } from './rich-text.d-BWc-5gX1.js';
13
11
  import './dev-handshake/index.js';
14
12
 
15
13
  /**
@@ -687,10 +685,7 @@ interface TranslationCompleteness {
687
685
  *
688
686
  * @example
689
687
  * ```typescript
690
- * const product = await client.content('product')
691
- * .findById('prod_123')
692
- * .locale('de-DE')
693
- * .execute()
688
+ * const product = await client.content('product').get('prod_123', { locale: 'de-DE' })
694
689
  *
695
690
  * if (localeHelpers.needsTranslation(product)) {
696
691
  * showTranslationBadge()
@@ -776,10 +771,7 @@ declare function estimateTranslationCompleteness(entry: LocalizedEntry, localize
776
771
  *
777
772
  * @example
778
773
  * ```typescript
779
- * const entry = await client.content('product')
780
- * .findById('prod_123')
781
- * .allLocales()
782
- * .execute()
774
+ * const entry = await client.content('product').get('prod_123', { locale: '*' })
783
775
  *
784
776
  * const spanishTitle = localeHelpers.getLocalizedField(entry, 'title', 'es-ES')
785
777
  * ```
@@ -816,70 +808,41 @@ declare const localeHelpers: {
816
808
  };
817
809
 
818
810
  /**
819
- * The DOM↔field binding contract, as the one pure helper that emits it.
820
- *
821
- * Spread onto the element that renders a field, it stamps which entry, content type, field and
822
- * locale produced that element, so an editing surface can find the field by scanning the DOM
823
- * rather than by guessing (`INV-TB-BINDING`). The contract is `toolbar-spec.md` §DOM↔field; this
824
- * file is its only implementation.
825
- *
826
- * **Frozen** (`INV-SS-BINDING-FROZEN`). The attribute set is exactly the five below. Adding,
827
- * renaming or dropping one is a new contract, and a new contract is a bump of `data-relyio-v` — a
828
- * page built against version 1 keeps being read as version 1 by any surface that scans it.
829
- *
830
- * **Pure** (`INV-TB-SDK-PURE`). It reads the entry it is handed and returns attributes. It imports
831
- * nothing but the SDK's own types: no realtime, no AI, no first-party code, no framework. That is
832
- * what lets it live in the customer SDK and run on a server render as happily as in a browser.
833
- *
834
- * **Every value comes from the entry.** The id, the content type and the locale are the ones the
835
- * API reported in `_metadata` — the locale is the one the payload's field values were composed
836
- * for. There is deliberately no `locale` argument: a caller-supplied locale could bind a node to a
837
- * locale whose value it is not rendering, which is the silently inferred binding `INV-TB-BINDING`
838
- * forbids.
839
- */
840
-
841
- /** The version of the binding contract this helper emits. */
842
- declare const BINDING_VERSION = "1";
843
- /** The attributes `relyioField` returns — the whole of binding contract version 1. */
844
- interface RelyIOFieldAttributes {
845
- /** The entry's id (`_metadata.id`). */
846
- readonly 'data-relyio-entry': string;
847
- /** The entry's content type (`_metadata.type`); every customer read is keyed by it. */
848
- readonly 'data-relyio-type': string;
849
- /** The field the element renders. */
850
- readonly 'data-relyio-field': string;
851
- /** The locale the entry's field values were composed for (`_metadata.locale`). */
852
- readonly 'data-relyio-locale': string;
853
- /** The binding contract's version. */
854
- readonly 'data-relyio-v': typeof BINDING_VERSION;
855
- }
811
+ * A key path (REL-1814): where a value sits inside an entry, each item on the way named by its
812
+ * `_key` — `sections[_key=="f2k6ub9s"].heading`. A field by its id (`title`), a field of an object's
813
+ * value after the object's (`hero.title`), an item of a list by its key (`faq[_key=="k1"]`) and a
814
+ * field of that item after it (`faq[_key=="k1"].question`), to any depth. Inside a rich-text field a
815
+ * key names a declared Block or Inline element wherever it stands in the tree (`body[_key=="c1"]`):
816
+ * a key is unique within the field, nested trees included, so the path needs no step for the quote
817
+ * or the list item around it, and a field of the node follows it (`body[_key=="c1"].caption`).
818
+ *
819
+ * It is the spelling a validation error's path, a live binding, a comment's anchor and a filled
820
+ * field's path already use, so the address a page stamps is the one the Studio opens a field by,
821
+ * and it stays on its item when the list is reordered — which an index would not. The rule is
822
+ * `@relyio/schema`'s `formatItemPath` and `parseKeyedPath`, restated here because this package takes
823
+ * no runtime from that one (it is build-inlined for types only); `devtools/verification`'s
824
+ * `key-paths-sdk.test.ts` holds the two to one corpus.
825
+ */
826
+ /** One step of a key path: a field by its id, or the item of the list (or rich text) before it. */
827
+ type KeyPathSegment = {
828
+ readonly field: string;
829
+ } | {
830
+ readonly key: string;
831
+ };
856
832
  /**
857
- * The field names `relyioField` accepts for an entry of type `T`.
858
- *
859
- * A schema-typed entry narrows to its declared field names, so they autocomplete and a misspelt
860
- * one does not compile. An entry with no declared fields — `BaseContent`, which is what an
861
- * un-generated client returns — has none to narrow to, and `keyof` of it is `never`; that would
862
- * make the helper uncallable for every untyped customer, so it accepts any field name instead.
833
+ * The key path of an item of the list at `listPath` — `faq[_key=="k1"]` — or of a field inside it
834
+ * when `field` is given: `faq[_key=="k1"].question`. The key is written as a JSON string, so a quote
835
+ * in it stays inside it. `listPath` and `field` are key paths of their own (`sections[_key=="a"].links`,
836
+ * `link.label`).
863
837
  */
864
- type RelyIOFieldName<T extends BaseContent> = [Exclude<keyof T, '_metadata'>] extends [never] ? string : string & Exclude<keyof T, '_metadata'>;
838
+ declare function formatKeyPath(listPath: string, key: string, field?: string): string;
865
839
  /**
866
- * Binding attributes for one field of one entry.
867
- *
868
- * @example
869
- * ```tsx
870
- * import { relyioField } from '@relyio/sdk'
871
- *
872
- * <h1 {...relyioField(post, 'title')}>{post.title}</h1>
873
- * // → data-relyio-entry="6710f…" data-relyio-type="post" data-relyio-field="title"
874
- * // data-relyio-locale="en-US" data-relyio-v="1"
875
- * ```
876
- *
877
- * @throws {TypeError} when the entry's `_metadata` lacks its id, content type or locale. Every
878
- * entry the API returns carries all three, so this is reached only by a value that was not read
879
- * from RelyIO. It throws rather than emitting a partial binding: a node stamped with no locale, or
880
- * none at all, is a binding a surface would have to guess the rest of.
840
+ * A key path read back into its steps: `sections[_key=="a"].links[_key=="b"].label` → `sections`,
841
+ * `a`, `links`, `b`, `label`. A path with no item in it is its field ids (`hero.title` → `hero`,
842
+ * `title`). `null` for anything else — an index (`faq[0]`), an item of an item, an unterminated or
843
+ * empty key, an empty field id — which names no value by key.
881
844
  */
882
- declare function relyioField<T extends BaseContent>(entry: T, field: RelyIOFieldName<T>): RelyIOFieldAttributes;
845
+ declare function parseKeyPath(path: string): KeyPathSegment[] | null;
883
846
 
884
847
  /**
885
848
  * The DOM event a preview surface dispatches when content on the page has changed, and the one
@@ -981,19 +944,18 @@ declare function snapToLadder(value: number): number;
981
944
  * ```typescript
982
945
  * import { createClient, defineSchema, defineContentType, fields } from '@relyio/sdk'
983
946
  *
984
- * const product = defineContentType('product', {
985
- * displayName: 'Product',
986
- * fields: [
987
- * fields.shortText('title', { config: { required: true } }),
988
- * fields.decimal('price', { config: { min: 0, decimalPlaces: 2 } }),
989
- * ]
947
+ * const product = defineContentType({
948
+ * fields: {
949
+ * title: fields.shortText({ required: true }),
950
+ * price: fields.decimal({ min: 0, decimalPlaces: 2 }),
951
+ * },
990
952
  * })
991
953
  *
992
954
  * const schema = defineSchema({ contentTypes: { product } })
993
955
  * const client = createClient({ apiKey: '...', schema })
994
956
  *
995
957
  * // Full autocomplete for content types and fields!
996
- * const products = await client.content('product').query().execute()
958
+ * const { data: products } = await client.content('product').list({ sort: { price: 'asc' } })
997
959
  * ```
998
960
  *
999
961
  * @example Without schema (dynamic usage)
@@ -1003,11 +965,11 @@ declare function snapToLadder(value: number): number;
1003
965
  * const client = createClient({ apiKey: '...' })
1004
966
  *
1005
967
  * // Works dynamically without type checking
1006
- * const products = await client.content('product').query().execute()
1007
- * const results = await client.search('wireless').in('product').execute()
968
+ * const { data: products } = await client.content('product').list()
969
+ * const results = await client.search('wireless', { contentType: 'product' })
1008
970
  * ```
1009
971
  */
1010
972
 
1011
973
  declare const VERSION = "__VERSION__";
1012
974
 
1013
- export { AuthorizationError, BaseContent, Change, type ChangeSource, type ChangeSourceOptions, ChangesExpiredError, ChangesExpiredReason, ConnectionError, EntryMetadata, ErrorMapper, FOLLOW_BACK_OFF_MAX_MS, FOLLOW_RETRY_BASE_MS, FOLLOW_RETRY_MAX_MS, type FollowEnd, type FollowOptions, type FollowResync, type FollowState, type FollowVerdict, IMAGE_LADDER, InvalidApiKeyError, type LanguageSwitcherOption, type LanguageSwitcherOptions, type LiveEdgeEnd, LiveEdgeError, type LocaleMetadata, type LocaleStatus, type LocalizedEntry, MethodNotAllowedError, MissingApiKeyError, NetworkError, PUBLISHABLE_KEY_PREFIX, PayloadTooLargeError, PlanFeatureUnavailableError, RELYIO_CHANGE_EVENT, RELYIO_RESYNC_EVENT, RateLimitError, ReadOnlyKeyError, type RelyIOChangeDetail, type RelyIOFieldAttributes, type RelyIOFieldName, type RelyIOResyncDetail, SDKError, ServerError, ServiceIndeterminateError, TimeoutError, TransactionRolledBackError, type TranslationCompleteness, UnknownContractError, UsageQuotaExceededError, VERSION, buildLanguageSwitcher, classifyFollowFailure, estimateTranslationCompleteness, followChanges, getAllLocalizedValues, getAvailableLocaleCodes, getDefaultLocale, getFallbackFields, getFieldFallbackLocale, getLocalizedField, getPublishedLocaleCodes, getRequestedLocale, hasLocale, isFieldFallback, isPublishableKey, isPublishedInLocale, localeHelpers, needsTranslation, relyioField, snapToLadder };
975
+ export { AuthorizationError, Change, type ChangeSource, type ChangeSourceOptions, ChangesExpiredError, ChangesExpiredReason, ConnectionError, EntryMetadata, ErrorMapper, FOLLOW_BACK_OFF_MAX_MS, FOLLOW_RETRY_BASE_MS, FOLLOW_RETRY_MAX_MS, type FollowEnd, type FollowOptions, type FollowResync, type FollowState, type FollowVerdict, IMAGE_LADDER, InvalidApiKeyError, type KeyPathSegment, type LanguageSwitcherOption, type LanguageSwitcherOptions, type LiveEdgeEnd, LiveEdgeError, type LocaleMetadata, type LocaleStatus, type LocalizedEntry, MethodNotAllowedError, MissingApiKeyError, NetworkError, PUBLISHABLE_KEY_PREFIX, PayloadTooLargeError, PlanFeatureUnavailableError, RELYIO_CHANGE_EVENT, RELYIO_RESYNC_EVENT, RateLimitError, ReadOnlyKeyError, type RelyIOChangeDetail, type RelyIOResyncDetail, SDKError, ServerError, ServiceIndeterminateError, TimeoutError, TransactionRolledBackError, type TranslationCompleteness, UnknownContractError, UsageQuotaExceededError, VERSION, buildLanguageSwitcher, classifyFollowFailure, estimateTranslationCompleteness, followChanges, formatKeyPath, getAllLocalizedValues, getAvailableLocaleCodes, getDefaultLocale, getFallbackFields, getFieldFallbackLocale, getLocalizedField, getPublishedLocaleCodes, getRequestedLocale, hasLocale, isFieldFallback, isPublishableKey, isPublishedInLocale, localeHelpers, needsTranslation, parseKeyPath, snapToLadder };
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- export { defineAssetType, defineContentType, defineQuery, defineSchema, defineSettingsGroup, defineSingleton, defineSingletonContentType, fields, fieldset } from './chunk-POEEDYFM.js';
2
- import { LiveEdgeError, SDKError, serviceInstructedDelayMs, VISITOR_ADMISSION_RETRY_AFTER_SECONDS, isAborted, sleep } from './chunk-FRJEUAAF.js';
3
- export { AdhocQueryBuilder, AdhocQueryClient, AssetClient, AssetFileBuilder, AssetUploadBuilder, AuthorizationError, AutocompleteBuilder, BaseValidationError, BatchBuilder, BatchClient, ChangesExpiredError, ConnectionError, ContentByIdBuilder, ContentClient, ContentQueryBuilder, ErrorMapper, FileUploadError, FileValidationError, HttpClient, InvalidApiKeyError, InvalidPayloadError, LIVE_KEEPALIVE_INTERVAL_MS, LIVE_SOCKET_OPEN_TIMEOUT_MS, LiveEdgeError, MethodNotAllowedError, MissingApiKeyError, NetworkError, PUBLISHABLE_KEY_PREFIX, PayloadTooLargeError, PlanFeatureUnavailableError, RateLimitError, ReadOnlyKeyError, ResourceConflictError, ResourceExpiredError, ResourceNotFoundError, SDKError, SearchBuilder, SearchClient, ServerError, ServiceIndeterminateError, SettingsClient, SimilarBuilder, SingletonClient, TimeoutError, TransactionRolledBackError, TypedRelyIOClient, UnknownContractError, UsageQuotaExceededError, ValidationError, createClient, createClient as default, entityTagOf, isAssetEntry, isPublishableKey, isResourceNotFound, matchRoute, validateFile } from './chunk-FRJEUAAF.js';
1
+ export { defineAssetType, defineContentType, defineQuery, defineSchema, defineSettingsGroup, defineSingleton, fields, fieldset } from './chunk-PCFTJLEP.js';
2
+ import { LiveEdgeError, SDKError, serviceInstructedDelayMs, VISITOR_ADMISSION_RETRY_AFTER_SECONDS, isAborted, sleep } from './chunk-DBBZVZOS.js';
3
+ export { AssetClient, AssetFileBuilder, AssetUploadBuilder, AuthorizationError, BaseValidationError, ChangesExpiredError, ConnectionError, ContentClient, ErrorMapper, FileUploadError, FileValidationError, HttpClient, InvalidApiKeyError, InvalidPayloadError, LIVE_KEEPALIVE_INTERVAL_MS, LIVE_SOCKET_OPEN_TIMEOUT_MS, LiveEdgeError, MethodNotAllowedError, MissingApiKeyError, NetworkError, PUBLISHABLE_KEY_PREFIX, PayloadTooLargeError, PlanFeatureUnavailableError, RateLimitError, ReadOnlyKeyError, ResourceConflictError, ResourceExpiredError, ResourceNotFoundError, SDKError, ServerError, ServiceIndeterminateError, SettingsClient, SingletonClient, TimeoutError, TransactionRolledBackError, TypedRelyIOClient, UnknownContractError, UsageQuotaExceededError, ValidationError, createClient, createClient as default, isAssetEntry, isMissingEntry, isPublishableKey, isResourceNotFound, matchRoute, validateFile, versionCheckOf } from './chunk-DBBZVZOS.js';
4
4
  import './chunk-BBUB7C2Z.js';
5
5
  import './chunk-IY5LSKXU.js';
6
6
  export { camelToSnake, createDeferred, debounce, deepClone, generateId, isBrowser, isNode, isPlainObject, isValidEmail, isValidUrl, mergeDeep, omit, pick, retry, sleep, snakeToCamel, throttle, toSafeString } from './chunk-H6IBQSMM.js';
7
- export { RICH_TEXT_VOID_TAGS, renderRichText, richTextToHtml, richTextToMarkdown, safeRichTextHref } from './chunk-3DRDHXLY.js';
7
+ export { RICH_TEXT_VOID_TAGS, entryHeadingAnchors, escapeHtml, formatKeyPath, isDeclaredRichTextNode, parseKeyPath, relyioField, renderRichText, richTextHeadingAnchors, richTextHeadingSlug, richTextToHtml, richTextToMarkdown, safeRichTextHref } from './chunk-5UMY6CS4.js';
8
8
  import { __name } from './chunk-XQ4QHWZE.js';
9
9
 
10
10
  /* RelyIO SDK - Built with ❤️ by the RelyIO Team */
@@ -253,30 +253,6 @@ var localeHelpers = {
253
253
  getAllLocalizedValues
254
254
  };
255
255
 
256
- // src/binding/relyio-field.ts
257
- var BINDING_VERSION = "1";
258
- function relyioField(entry, field) {
259
- const metadata = entry._metadata;
260
- return {
261
- "data-relyio-entry": requireMetadata(metadata, "id", field),
262
- "data-relyio-type": requireMetadata(metadata, "type", field),
263
- "data-relyio-field": field,
264
- "data-relyio-locale": requireMetadata(metadata, "locale", field),
265
- "data-relyio-v": BINDING_VERSION
266
- };
267
- }
268
- __name(relyioField, "relyioField");
269
- function requireMetadata(metadata, key, field) {
270
- const value = metadata?.[key];
271
- if (typeof value !== "string" || value.length === 0) {
272
- throw new TypeError(
273
- `relyioField(entry, '${field}'): the entry has no _metadata.${key}, so the field cannot be bound. Pass an entry as the RelyIO API returned it.`
274
- );
275
- }
276
- return value;
277
- }
278
- __name(requireMetadata, "requireMetadata");
279
-
280
256
  // src/binding/change-event.ts
281
257
  var RELYIO_CHANGE_EVENT = "relyio:change";
282
258
  var RELYIO_RESYNC_EVENT = "relyio:resync";
@@ -298,6 +274,6 @@ __name(snapToLadder, "snapToLadder");
298
274
  // src/index.ts
299
275
  var VERSION = "__VERSION__";
300
276
 
301
- export { FOLLOW_BACK_OFF_MAX_MS, FOLLOW_RETRY_BASE_MS, FOLLOW_RETRY_MAX_MS, IMAGE_LADDER, RELYIO_CHANGE_EVENT, RELYIO_RESYNC_EVENT, VERSION, buildLanguageSwitcher, classifyFollowFailure, estimateTranslationCompleteness, followChanges, getAllLocalizedValues, getAvailableLocaleCodes, getDefaultLocale, getFallbackFields, getFieldFallbackLocale, getLocalizedField, getPublishedLocaleCodes, getRequestedLocale, hasLocale, isFieldFallback, isPublishedInLocale, localeHelpers, needsTranslation, relyioField, snapToLadder };
277
+ export { FOLLOW_BACK_OFF_MAX_MS, FOLLOW_RETRY_BASE_MS, FOLLOW_RETRY_MAX_MS, IMAGE_LADDER, RELYIO_CHANGE_EVENT, RELYIO_RESYNC_EVENT, VERSION, buildLanguageSwitcher, classifyFollowFailure, estimateTranslationCompleteness, followChanges, getAllLocalizedValues, getAvailableLocaleCodes, getDefaultLocale, getFallbackFields, getFieldFallbackLocale, getLocalizedField, getPublishedLocaleCodes, getRequestedLocale, hasLocale, isFieldFallback, isPublishedInLocale, localeHelpers, needsTranslation, snapToLadder };
302
278
  //# sourceMappingURL=index.js.map
303
279
  //# sourceMappingURL=index.js.map