@amplifyup/sdk 0.1.63 → 0.1.65

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.
@@ -1,4 +1,4 @@
1
- import { i as AmplifyUpTarget } from './types-Db_eLrfU.js';
1
+ import { i as AmplifyUpTarget, y as ListRow } from './types-C32MgOiv.js';
2
2
 
3
3
  /**
4
4
  * On-request variant selection (tier 3).
@@ -60,7 +60,8 @@ declare function selectVariants(options: SelectVariantsOptions): Promise<SelectV
60
60
  * Page resolve covers data known at Deploy. Visitor-triggered data — search,
61
61
  * load more, pickers — runs here: the browser asks AmplifyUp, AmplifyUp asks
62
62
  * the CMS. Only entities published with the page can be queried.
63
- * Results are plain CMS rows, not Field envelopes, and are not canvas-editable.
63
+ * Edge JSON stays raw. `queryContent` envelopes rows on the SDK so they
64
+ * edit in Composer the same way as list-field rows.
64
65
  */
65
66
 
66
67
  type QueryFilterOp = 'eq' | 'neq' | 'in' | 'nin' | 'gt' | 'gte' | 'lt' | 'lte' | 'contains' | 'exists';
@@ -148,7 +149,7 @@ interface QueryContentOptions {
148
149
  * });
149
150
  * ```
150
151
  */
151
- declare function queryContent<T = Record<string, unknown>>(options: QueryContentOptions): Promise<QueryResult<T>>;
152
+ declare function queryContent<T extends Record<string, unknown> = Record<string, unknown>>(options: QueryContentOptions): Promise<QueryResult<ListRow<T>>>;
152
153
  /** Convenience: next page from pagination meta on a list prop. */
153
154
  declare function nextPageSpec(pagination: QueryPagination): QuerySpec;
154
155
  /**
@@ -1,4 +1,4 @@
1
- import { i as AmplifyUpTarget } from './types-Db_eLrfU.mjs';
1
+ import { i as AmplifyUpTarget, y as ListRow } from './types-C32MgOiv.mjs';
2
2
 
3
3
  /**
4
4
  * On-request variant selection (tier 3).
@@ -60,7 +60,8 @@ declare function selectVariants(options: SelectVariantsOptions): Promise<SelectV
60
60
  * Page resolve covers data known at Deploy. Visitor-triggered data — search,
61
61
  * load more, pickers — runs here: the browser asks AmplifyUp, AmplifyUp asks
62
62
  * the CMS. Only entities published with the page can be queried.
63
- * Results are plain CMS rows, not Field envelopes, and are not canvas-editable.
63
+ * Edge JSON stays raw. `queryContent` envelopes rows on the SDK so they
64
+ * edit in Composer the same way as list-field rows.
64
65
  */
65
66
 
66
67
  type QueryFilterOp = 'eq' | 'neq' | 'in' | 'nin' | 'gt' | 'gte' | 'lt' | 'lte' | 'contains' | 'exists';
@@ -148,7 +149,7 @@ interface QueryContentOptions {
148
149
  * });
149
150
  * ```
150
151
  */
151
- declare function queryContent<T = Record<string, unknown>>(options: QueryContentOptions): Promise<QueryResult<T>>;
152
+ declare function queryContent<T extends Record<string, unknown> = Record<string, unknown>>(options: QueryContentOptions): Promise<QueryResult<ListRow<T>>>;
152
153
  /** Convenience: next page from pagination meta on a list prop. */
153
154
  declare function nextPageSpec(pagination: QueryPagination): QuerySpec;
154
155
  /**
package/dist/react.d.mts CHANGED
@@ -1,10 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { P as PageConfig, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-Db_eLrfU.mjs';
3
- export { Z as ZoneConfig } from './types-Db_eLrfU.mjs';
2
+ import { L as LayoutComponentProps, P as PageConfig, F as Field$1, l as FIELDS_BRAND, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-C32MgOiv.mjs';
3
+ export { w as FieldRef, x as Fields, z as ImageValue, y as ListRow, B as PortableRef, Z as ZoneConfig, m as attachFieldEnvelopes, p as composerStoreKey, o as envelopeListRows, v as isBrandedFields, s as isFieldEnvelope, u as isReadOnlyRowField, q as listOwnerFromSpec, t as toFieldEnvelopes } from './types-C32MgOiv.mjs';
4
4
  import react__default, { ReactNode } from 'react';
5
- import { L as LayoutComponentProps, F as Field$1, C as CollectionField, a as Fields } from './AmplifyRenderer-TawbUIKZ.mjs';
6
- export { A as AmplifyRenderer, I as ImageValue, P as PortableRef, b as isBrandedFields, i as isFieldEnvelope, t as toFieldEnvelopes } from './AmplifyRenderer-TawbUIKZ.mjs';
7
- export { Q as QueryContentError, e as QueryContentOptions, k as QueryFilter, l as QueryFilterOp, i as QueryPagination, h as QueryResult, m as QuerySort, j as QuerySpec, S as SelectVariantsError, a as SelectVariantsOptions, b as SelectVariantsResult, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-DIZjc7st.mjs';
5
+ export { AmplifyRenderer } from './AmplifyRenderer.mjs';
6
+ export { Q as QueryContentError, e as QueryContentOptions, k as QueryFilter, l as QueryFilterOp, i as QueryPagination, h as QueryResult, m as QuerySort, j as QuerySpec, S as SelectVariantsError, a as SelectVariantsOptions, b as SelectVariantsResult, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-DuRilU_n.mjs';
8
7
  export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.mjs';
9
8
 
10
9
  type RenderComponentContext = {
@@ -81,7 +80,9 @@ declare function Slot({ name, className, }: {
81
80
  name: string;
82
81
  className?: string;
83
82
  }): react_jsx_runtime.JSX.Element | null;
84
- type RejectArray<T> = [T] extends [readonly unknown[]] ? never : T;
83
+ type RejectFieldInput<T> = [T] extends [readonly unknown[]] ? never : T extends {
84
+ readonly [FIELDS_BRAND]: true;
85
+ } ? never : T;
85
86
  /**
86
87
  * Field Component
87
88
  *
@@ -89,7 +90,7 @@ type RejectArray<T> = [T] extends [readonly unknown[]] ? never : T;
89
90
  * For a computed value, pass `value` and `name`.
90
91
  *
91
92
  * For markdown / rich text fields, use {@link RichText} instead.
92
- * List fields use {@link Collection} (repeaters) or `.value` (reference lists).
93
+ * Do not pass a list or a list row — use `<Field field={post.title} />`.
93
94
  *
94
95
  * @example
95
96
  * ```tsx
@@ -106,25 +107,14 @@ type RejectArray<T> = [T] extends [readonly unknown[]] ? never : T;
106
107
  * ```
107
108
  */
108
109
  declare function Field<T = unknown>(props: {
109
- /** Envelope from `props.fields` (`{ value, name }`). Arrays are not allowed. */
110
- field?: Field$1<RejectArray<T>>;
110
+ /** Envelope from `props.fields` (`{ value, name, ref? }`). Lists and rows are not allowed. */
111
+ field?: Field$1<RejectFieldInput<T>>;
111
112
  /** Computed value — requires `name`. */
112
- value?: RejectArray<T>;
113
+ value?: RejectFieldInput<T>;
113
114
  /** Required with `value` for computed values. */
114
115
  name?: string;
115
116
  className?: string;
116
117
  }): react_jsx_runtime.JSX.Element | null;
117
- /**
118
- * Repeater (inline-authored list). Inside Composer: empty placeholder plus
119
- * add / remove / reorder. Outside Composer: children only.
120
- *
121
- * Reference lists are not canvas-bound — map `fields.posts.value` instead.
122
- */
123
- declare function Collection<T extends Record<string, unknown>>({ field, children, className, }: {
124
- field: CollectionField<T> | Field$1<T[]>;
125
- children: (item: Fields<T>, index: number) => ReactNode;
126
- className?: string;
127
- }): react_jsx_runtime.JSX.Element | null;
128
118
  /**
129
119
  * RichText - Renders a markdown (or HTML string) value as formatted HTML.
130
120
  *
@@ -143,10 +133,10 @@ declare function Collection<T extends Record<string, unknown>>({ field, children
143
133
  * }
144
134
  * ```
145
135
  */
146
- declare function RichText(props: {
147
- field?: Field$1<string | null>;
136
+ declare function RichText<T = string | null>(props: {
137
+ field?: Field$1<RejectFieldInput<T>>;
148
138
  /** Computed markdown — requires `name`. */
149
- value?: string | null;
139
+ value?: RejectFieldInput<T>;
150
140
  /** Required with `value` for computed values. */
151
141
  name?: string;
152
142
  className?: string;
@@ -169,17 +159,16 @@ declare function RichText(props: {
169
159
  * }
170
160
  * ```
171
161
  */
172
- declare function Image(props: {
173
- field?: Field$1<unknown>;
162
+ declare function Image<T = unknown>(props: {
163
+ field?: Field$1<RejectFieldInput<T>>;
174
164
  /** Computed image — requires `name`. */
175
- value?: unknown;
165
+ value?: RejectFieldInput<T>;
176
166
  /** Required with `value` for computed values. */
177
167
  name?: string;
178
168
  alt?: string;
179
169
  } & Omit<react__default.ImgHTMLAttributes<HTMLImageElement>, 'src' | 'alt' | 'name'>): react_jsx_runtime.JSX.Element | null;
180
170
 
181
- declare function ComposerProvider({ layoutNodeId, children, }: {
182
- layoutNodeId?: string;
171
+ declare function ComposerProvider({ children, }: {
183
172
  children: ReactNode;
184
173
  }): react_jsx_runtime.JSX.Element;
185
174
  declare function MaybeComposerProvider({ enabled, layoutNodeId, children, }: {
@@ -207,4 +196,4 @@ interface AmplifyUpProviderProps {
207
196
  declare function AmplifyUpProvider({ children, config, pageContext, }: AmplifyUpProviderProps): react_jsx_runtime.JSX.Element;
208
197
  declare function useAmplifyUp(): AmplifyUpContextType;
209
198
 
210
- export { AmplifyContentMeta, AmplifyPageContent, AmplifyUpProvider, Collection, CollectionField, ComponentContextProvider, ComposerProvider, ContentSource, Field, Field$1 as FieldEnvelope, Fields, Image, LayoutComponentProps, MaybeComposerProvider, PageConfig, RichText, Slot, useAmplifyUp };
199
+ export { AmplifyContentMeta, AmplifyPageContent, AmplifyUpProvider, ComponentContextProvider, ComposerProvider, ContentSource, Field, Field$1 as FieldEnvelope, Image, LayoutComponentProps, MaybeComposerProvider, PageConfig, RichText, Slot, useAmplifyUp };
package/dist/react.d.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { P as PageConfig, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-Db_eLrfU.js';
3
- export { Z as ZoneConfig } from './types-Db_eLrfU.js';
2
+ import { L as LayoutComponentProps, P as PageConfig, F as Field$1, l as FIELDS_BRAND, c as AmplifyUpConfig, e as AmplifyPageContextInput, C as ContentSource, A as AmplifyContentMeta } from './types-C32MgOiv.js';
3
+ export { w as FieldRef, x as Fields, z as ImageValue, y as ListRow, B as PortableRef, Z as ZoneConfig, m as attachFieldEnvelopes, p as composerStoreKey, o as envelopeListRows, v as isBrandedFields, s as isFieldEnvelope, u as isReadOnlyRowField, q as listOwnerFromSpec, t as toFieldEnvelopes } from './types-C32MgOiv.js';
4
4
  import react__default, { ReactNode } from 'react';
5
- import { L as LayoutComponentProps, F as Field$1, C as CollectionField, a as Fields } from './AmplifyRenderer-Bwob7ICJ.js';
6
- export { A as AmplifyRenderer, I as ImageValue, P as PortableRef, b as isBrandedFields, i as isFieldEnvelope, t as toFieldEnvelopes } from './AmplifyRenderer-Bwob7ICJ.js';
7
- export { Q as QueryContentError, e as QueryContentOptions, k as QueryFilter, l as QueryFilterOp, i as QueryPagination, h as QueryResult, m as QuerySort, j as QuerySpec, S as SelectVariantsError, a as SelectVariantsOptions, b as SelectVariantsResult, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-3AXnQgzO.js';
5
+ export { AmplifyRenderer } from './AmplifyRenderer.js';
6
+ export { Q as QueryContentError, e as QueryContentOptions, k as QueryFilter, l as QueryFilterOp, i as QueryPagination, h as QueryResult, m as QuerySort, j as QuerySpec, S as SelectVariantsError, a as SelectVariantsOptions, b as SelectVariantsResult, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-BLjZYjHJ.js';
8
7
  export { i as isComposerPreview, a as isPreviewRequest, b as isWorkingContentRequest } from './preview-_vHmzRen.js';
9
8
 
10
9
  type RenderComponentContext = {
@@ -81,7 +80,9 @@ declare function Slot({ name, className, }: {
81
80
  name: string;
82
81
  className?: string;
83
82
  }): react_jsx_runtime.JSX.Element | null;
84
- type RejectArray<T> = [T] extends [readonly unknown[]] ? never : T;
83
+ type RejectFieldInput<T> = [T] extends [readonly unknown[]] ? never : T extends {
84
+ readonly [FIELDS_BRAND]: true;
85
+ } ? never : T;
85
86
  /**
86
87
  * Field Component
87
88
  *
@@ -89,7 +90,7 @@ type RejectArray<T> = [T] extends [readonly unknown[]] ? never : T;
89
90
  * For a computed value, pass `value` and `name`.
90
91
  *
91
92
  * For markdown / rich text fields, use {@link RichText} instead.
92
- * List fields use {@link Collection} (repeaters) or `.value` (reference lists).
93
+ * Do not pass a list or a list row — use `<Field field={post.title} />`.
93
94
  *
94
95
  * @example
95
96
  * ```tsx
@@ -106,25 +107,14 @@ type RejectArray<T> = [T] extends [readonly unknown[]] ? never : T;
106
107
  * ```
107
108
  */
108
109
  declare function Field<T = unknown>(props: {
109
- /** Envelope from `props.fields` (`{ value, name }`). Arrays are not allowed. */
110
- field?: Field$1<RejectArray<T>>;
110
+ /** Envelope from `props.fields` (`{ value, name, ref? }`). Lists and rows are not allowed. */
111
+ field?: Field$1<RejectFieldInput<T>>;
111
112
  /** Computed value — requires `name`. */
112
- value?: RejectArray<T>;
113
+ value?: RejectFieldInput<T>;
113
114
  /** Required with `value` for computed values. */
114
115
  name?: string;
115
116
  className?: string;
116
117
  }): react_jsx_runtime.JSX.Element | null;
117
- /**
118
- * Repeater (inline-authored list). Inside Composer: empty placeholder plus
119
- * add / remove / reorder. Outside Composer: children only.
120
- *
121
- * Reference lists are not canvas-bound — map `fields.posts.value` instead.
122
- */
123
- declare function Collection<T extends Record<string, unknown>>({ field, children, className, }: {
124
- field: CollectionField<T> | Field$1<T[]>;
125
- children: (item: Fields<T>, index: number) => ReactNode;
126
- className?: string;
127
- }): react_jsx_runtime.JSX.Element | null;
128
118
  /**
129
119
  * RichText - Renders a markdown (or HTML string) value as formatted HTML.
130
120
  *
@@ -143,10 +133,10 @@ declare function Collection<T extends Record<string, unknown>>({ field, children
143
133
  * }
144
134
  * ```
145
135
  */
146
- declare function RichText(props: {
147
- field?: Field$1<string | null>;
136
+ declare function RichText<T = string | null>(props: {
137
+ field?: Field$1<RejectFieldInput<T>>;
148
138
  /** Computed markdown — requires `name`. */
149
- value?: string | null;
139
+ value?: RejectFieldInput<T>;
150
140
  /** Required with `value` for computed values. */
151
141
  name?: string;
152
142
  className?: string;
@@ -169,17 +159,16 @@ declare function RichText(props: {
169
159
  * }
170
160
  * ```
171
161
  */
172
- declare function Image(props: {
173
- field?: Field$1<unknown>;
162
+ declare function Image<T = unknown>(props: {
163
+ field?: Field$1<RejectFieldInput<T>>;
174
164
  /** Computed image — requires `name`. */
175
- value?: unknown;
165
+ value?: RejectFieldInput<T>;
176
166
  /** Required with `value` for computed values. */
177
167
  name?: string;
178
168
  alt?: string;
179
169
  } & Omit<react__default.ImgHTMLAttributes<HTMLImageElement>, 'src' | 'alt' | 'name'>): react_jsx_runtime.JSX.Element | null;
180
170
 
181
- declare function ComposerProvider({ layoutNodeId, children, }: {
182
- layoutNodeId?: string;
171
+ declare function ComposerProvider({ children, }: {
183
172
  children: ReactNode;
184
173
  }): react_jsx_runtime.JSX.Element;
185
174
  declare function MaybeComposerProvider({ enabled, layoutNodeId, children, }: {
@@ -207,4 +196,4 @@ interface AmplifyUpProviderProps {
207
196
  declare function AmplifyUpProvider({ children, config, pageContext, }: AmplifyUpProviderProps): react_jsx_runtime.JSX.Element;
208
197
  declare function useAmplifyUp(): AmplifyUpContextType;
209
198
 
210
- export { AmplifyContentMeta, AmplifyPageContent, AmplifyUpProvider, Collection, CollectionField, ComponentContextProvider, ComposerProvider, ContentSource, Field, Field$1 as FieldEnvelope, Fields, Image, LayoutComponentProps, MaybeComposerProvider, PageConfig, RichText, Slot, useAmplifyUp };
199
+ export { AmplifyContentMeta, AmplifyPageContent, AmplifyUpProvider, ComponentContextProvider, ComposerProvider, ContentSource, Field, Field$1 as FieldEnvelope, Image, LayoutComponentProps, MaybeComposerProvider, PageConfig, RichText, Slot, useAmplifyUp };