@amplifyup/sdk 0.1.78 → 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 (48) hide show
  1. package/README.md +91 -28
  2. package/dist/AmplifyRenderer-BNWBrFQN.d.ts +47 -0
  3. package/dist/AmplifyRenderer-CPUr9Bkc.d.mts +47 -0
  4. package/dist/AmplifyRenderer.d.mts +4 -40
  5. package/dist/AmplifyRenderer.d.ts +4 -40
  6. package/dist/AmplifyRenderer.js +106 -14
  7. package/dist/AmplifyRenderer.js.map +1 -1
  8. package/dist/AmplifyRenderer.mjs +106 -14
  9. package/dist/AmplifyRenderer.mjs.map +1 -1
  10. package/dist/cli.d.mts +1 -0
  11. package/dist/cli.d.ts +1 -0
  12. package/dist/cli.js +266 -0
  13. package/dist/cli.js.map +1 -0
  14. package/dist/cli.mjs +260 -0
  15. package/dist/cli.mjs.map +1 -0
  16. package/dist/config.d.mts +18 -0
  17. package/dist/config.d.ts +18 -0
  18. package/dist/config.js +10 -0
  19. package/dist/config.js.map +1 -0
  20. package/dist/config.mjs +8 -0
  21. package/dist/config.mjs.map +1 -0
  22. package/dist/index.d.mts +3 -3
  23. package/dist/index.d.ts +3 -3
  24. package/dist/index.js +2 -2
  25. package/dist/index.js.map +1 -1
  26. package/dist/index.mjs +2 -2
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/next.d.mts +9 -0
  29. package/dist/next.d.ts +9 -0
  30. package/dist/next.js +259 -0
  31. package/dist/next.js.map +1 -0
  32. package/dist/next.mjs +253 -0
  33. package/dist/next.mjs.map +1 -0
  34. package/dist/query-DYjs4LQQ.d.mts +262 -0
  35. package/dist/query-Xo9cy-2F.d.ts +262 -0
  36. package/dist/react.d.mts +19 -21
  37. package/dist/react.d.ts +19 -21
  38. package/dist/react.js +1141 -1035
  39. package/dist/react.js.map +1 -1
  40. package/dist/react.mjs +1140 -1035
  41. package/dist/react.mjs.map +1 -1
  42. package/dist/server.d.mts +3 -3
  43. package/dist/server.d.ts +3 -3
  44. package/dist/{types-D4TSd2Yt.d.mts → types-ffQNIQCK.d.mts} +1 -102
  45. package/dist/{types-D4TSd2Yt.d.ts → types-ffQNIQCK.d.ts} +1 -102
  46. package/package.json +17 -2
  47. package/dist/query-B23UsNIv.d.ts +0 -161
  48. package/dist/query-CV8x3oQT.d.mts +0 -161
package/dist/server.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { j as AmplifyUpTarget, P as PageConfig, A as AmplifyContentMeta } from './types-D4TSd2Yt.mjs';
2
- export { r as resolveAmplifyUpTarget, k as resolveAmplifyUpUrls } from './types-D4TSd2Yt.mjs';
1
+ import { A as AmplifyUpTarget, P as PageConfig, a as AmplifyContentMeta } from './types-ffQNIQCK.mjs';
2
+ export { r as resolveAmplifyUpTarget, b as resolveAmplifyUpUrls } from './types-ffQNIQCK.mjs';
3
3
  export { A as AMPLIFYUP_EDITOR_ROUTE, i as isAmplifyUpEditorRoute } from './reservedRoutes-aGgViBDM.mjs';
4
- export { g as FetchEdgeQueryOptions, F as FetchEdgeSelectOptions, 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, c as fetchEdgeQuery, f as fetchEdgeSelect, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-CV8x3oQT.mjs';
4
+ export { g as FetchEdgeQueryOptions, F as FetchEdgeSelectOptions, 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, c as fetchEdgeQuery, f as fetchEdgeSelect, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-DYjs4LQQ.mjs';
5
5
 
6
6
  /**
7
7
  * Compact variant-key codec for URLs and Edge `variants` query params.
package/dist/server.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { j as AmplifyUpTarget, P as PageConfig, A as AmplifyContentMeta } from './types-D4TSd2Yt.js';
2
- export { r as resolveAmplifyUpTarget, k as resolveAmplifyUpUrls } from './types-D4TSd2Yt.js';
1
+ import { A as AmplifyUpTarget, P as PageConfig, a as AmplifyContentMeta } from './types-ffQNIQCK.js';
2
+ export { r as resolveAmplifyUpTarget, b as resolveAmplifyUpUrls } from './types-ffQNIQCK.js';
3
3
  export { A as AMPLIFYUP_EDITOR_ROUTE, i as isAmplifyUpEditorRoute } from './reservedRoutes-aGgViBDM.js';
4
- export { g as FetchEdgeQueryOptions, F as FetchEdgeSelectOptions, 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, c as fetchEdgeQuery, f as fetchEdgeSelect, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-B23UsNIv.js';
4
+ export { g as FetchEdgeQueryOptions, F as FetchEdgeSelectOptions, 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, c as fetchEdgeQuery, f as fetchEdgeSelect, n as nextPageSpec, q as queryContent, d as searchSpec, s as selectVariants } from './query-Xo9cy-2F.js';
5
5
 
6
6
  /**
7
7
  * Compact variant-key codec for URLs and Edge `variants` query params.
@@ -1,104 +1,3 @@
1
- /**
2
- * Field envelopes — same shape in published, draft, and Composer edit.
3
- * `{ value, name, ref? }` where `name` is the path within the owning record
4
- * (`title`, `author.name`). Page-level fields omit `ref`.
5
- * `ref` is stamped from the connection that produced the row
6
- * (`providerId`, AmplifyUp `entity`, `id`) — never from a CMS `_type`.
7
- * Produced once at the Edge resolve boundary (`fetchEdgeResolve`) and again
8
- * on the SDK for `queryContent` rows.
9
- */
10
- declare const FIELDS_BRAND: unique symbol;
11
- type ImageValue = {
12
- url: string;
13
- alt?: string;
14
- width?: number;
15
- height?: number;
16
- };
17
- /** Connection that produced a list row. Omitted on page-level fields. */
18
- type FieldRef = {
19
- providerId: string;
20
- entity: string;
21
- id: string;
22
- };
23
- /** AmplifyUp entity + provider from the connection that produced a list. */
24
- type ListOwner = {
25
- providerId: string;
26
- entity: string;
27
- };
28
- type ConnectionLike = {
29
- mode?: string;
30
- providerId?: string;
31
- entity?: string;
32
- spec?: {
33
- providerId?: string;
34
- entity?: string;
35
- };
36
- };
37
- type FieldReadLike = {
38
- resource: string;
39
- path?: string;
40
- /** Schema field kind (image, string, object, …) from the component definition. */
41
- kind?: string;
42
- };
43
- type EnvelopeSources = {
44
- connections?: Record<string, ConnectionLike | null | undefined>;
45
- reads?: Record<string, FieldReadLike>;
46
- };
47
- type Field<T> = {
48
- value: T;
49
- name: string;
50
- ref?: FieldRef;
51
- /** Row field with no write target — display only in Composer. */
52
- readOnly?: true;
53
- };
54
- /** Portable entry identity after normalize (`id` required). */
55
- type PortableRef = {
56
- id: string;
57
- type?: string;
58
- };
59
- type IdentifierKey = 'id' | '_id' | 'slug' | 'key' | '_key' | 'docId' | '_type' | 'type';
60
- type IsPlainObject<T> = T extends object ? T extends readonly unknown[] ? false : T extends ImageValue ? false : true : false;
61
- type AsRecord<T> = T extends Record<string, unknown> ? T : Record<string, unknown>;
62
- /** A list row: enveloped fields plus a plain `id`. */
63
- type ListRow<T extends Record<string, unknown> = Record<string, unknown>> = Fields<T> & {
64
- id: string;
65
- };
66
- type FieldsProp<T> = NonNullable<T> extends ImageValue ? Field<T | null> : NonNullable<T> extends readonly (infer U)[] ? IsPlainObject<U> extends true ? Field<Array<ListRow<AsRecord<U>>>> : Field<T> : IsPlainObject<NonNullable<T>> extends true ? Fields<NonNullable<T>> : Field<T>;
67
- type Fields<T> = {
68
- readonly [FIELDS_BRAND]: true;
69
- } & {
70
- [K in keyof T]-?: K extends IdentifierKey ? T[K] : FieldsProp<T[K]>;
71
- };
72
- /** Props passed into site components. Raw CMS bags are not assignable. */
73
- type LayoutComponentProps<T extends Record<string, unknown> = Record<string, unknown>> = {
74
- fields: Fields<T>;
75
- };
76
- declare function isBrandedFields(value: unknown): value is Fields<Record<string, unknown>>;
77
- declare function isFieldEnvelope(value: unknown): value is Field<unknown>;
78
- declare function isReadOnlyRowField(value: unknown): boolean;
79
- declare function composerStoreKey(name: string, ref?: FieldRef | null, layoutNodeId?: string): string;
80
- declare function listOwnerFromSpec(spec: {
81
- providerId?: string;
82
- entity?: string;
83
- } | null | undefined): ListOwner | undefined;
84
- type EnvelopeScope = {
85
- ref?: FieldRef;
86
- readOnly?: boolean;
87
- owners?: (fieldName: string) => ListOwner | undefined;
88
- /** Schema-driven: true when the field at this path is a scalar leaf. */
89
- leaf?: (path: string) => boolean;
90
- };
91
- /**
92
- * Wrap a props bag as envelopes. Already-enveloped bags are returned as-is.
93
- * Nested plain objects become nested bags; portable images stay a leaf.
94
- * Object arrays become list rows (`Fields` + plain `id`); `name` is the path
95
- * within the record when `ref` is set.
96
- */
97
- declare function toFieldEnvelopes<T extends Record<string, unknown>>(source: T | null | undefined, prefix?: string, scope?: EnvelopeScope | FieldRef): Fields<T>;
98
- declare function envelopeListRows<T extends Record<string, unknown> = Record<string, unknown>>(items: unknown[], owner?: ListOwner | null): Array<ListRow<T>>;
99
- /** Attach branded `fields` once. Keeps sibling keys (e.g. zoneId). */
100
- declare function attachFieldEnvelopes(props: Record<string, unknown> | null | undefined, sources?: EnvelopeSources | Record<string, ConnectionLike | null | undefined>): Record<string, unknown>;
101
-
102
1
  /**
103
2
  * Runtime page-data context: validate SDK-supplied entity fields against
104
3
  * the published pageData contract and attach to events.
@@ -388,4 +287,4 @@ interface EventTrackingConfig {
388
287
  componentName?: string | null;
389
288
  }
390
289
 
391
- export { type AmplifyContentMeta as A, type ImageValue as B, type ContentSource as C, type PortableRef as D, type EventTrackingConfig as E, type Field as F, type IdentifyInput as I, type LayoutComponentProps as L, type PageConfig as P, type ResolvedPageResourceRef as R, type ZoneConfig as Z, type PageDataSnapshot as a, type PageTaxonomies as b, type CDPAdapter as c, type AmplifyUpConfig as d, type EventProperties as e, type AmplifyPageContextInput as f, type AttachedPageEventContext as g, type IdentifyTraits as h, type ProfileFieldsInput as i, type AmplifyUpTarget as j, resolveAmplifyUpUrls as k, isAmplifyUpTarget as l, FIELDS_BRAND as m, normalizeAmplifyUpTarget as n, attachFieldEnvelopes as o, envelopeListRows as p, composerStoreKey as q, resolveAmplifyUpTarget as r, listOwnerFromSpec as s, toFieldEnvelopes as t, isFieldEnvelope as u, isReadOnlyRowField as v, isBrandedFields as w, type FieldRef as x, type Fields as y, type ListRow as z };
290
+ export { type AmplifyUpTarget as A, type ContentSource as C, type EventTrackingConfig as E, type IdentifyInput as I, type PageConfig as P, type ResolvedPageResourceRef as R, type ZoneConfig as Z, type AmplifyContentMeta as a, resolveAmplifyUpUrls as b, type PageDataSnapshot as c, type PageTaxonomies as d, type CDPAdapter as e, type AmplifyUpConfig as f, type EventProperties as g, type AmplifyPageContextInput as h, type AttachedPageEventContext as i, type IdentifyTraits as j, type ProfileFieldsInput as k, isAmplifyUpTarget as l, normalizeAmplifyUpTarget as n, resolveAmplifyUpTarget as r };
@@ -1,104 +1,3 @@
1
- /**
2
- * Field envelopes — same shape in published, draft, and Composer edit.
3
- * `{ value, name, ref? }` where `name` is the path within the owning record
4
- * (`title`, `author.name`). Page-level fields omit `ref`.
5
- * `ref` is stamped from the connection that produced the row
6
- * (`providerId`, AmplifyUp `entity`, `id`) — never from a CMS `_type`.
7
- * Produced once at the Edge resolve boundary (`fetchEdgeResolve`) and again
8
- * on the SDK for `queryContent` rows.
9
- */
10
- declare const FIELDS_BRAND: unique symbol;
11
- type ImageValue = {
12
- url: string;
13
- alt?: string;
14
- width?: number;
15
- height?: number;
16
- };
17
- /** Connection that produced a list row. Omitted on page-level fields. */
18
- type FieldRef = {
19
- providerId: string;
20
- entity: string;
21
- id: string;
22
- };
23
- /** AmplifyUp entity + provider from the connection that produced a list. */
24
- type ListOwner = {
25
- providerId: string;
26
- entity: string;
27
- };
28
- type ConnectionLike = {
29
- mode?: string;
30
- providerId?: string;
31
- entity?: string;
32
- spec?: {
33
- providerId?: string;
34
- entity?: string;
35
- };
36
- };
37
- type FieldReadLike = {
38
- resource: string;
39
- path?: string;
40
- /** Schema field kind (image, string, object, …) from the component definition. */
41
- kind?: string;
42
- };
43
- type EnvelopeSources = {
44
- connections?: Record<string, ConnectionLike | null | undefined>;
45
- reads?: Record<string, FieldReadLike>;
46
- };
47
- type Field<T> = {
48
- value: T;
49
- name: string;
50
- ref?: FieldRef;
51
- /** Row field with no write target — display only in Composer. */
52
- readOnly?: true;
53
- };
54
- /** Portable entry identity after normalize (`id` required). */
55
- type PortableRef = {
56
- id: string;
57
- type?: string;
58
- };
59
- type IdentifierKey = 'id' | '_id' | 'slug' | 'key' | '_key' | 'docId' | '_type' | 'type';
60
- type IsPlainObject<T> = T extends object ? T extends readonly unknown[] ? false : T extends ImageValue ? false : true : false;
61
- type AsRecord<T> = T extends Record<string, unknown> ? T : Record<string, unknown>;
62
- /** A list row: enveloped fields plus a plain `id`. */
63
- type ListRow<T extends Record<string, unknown> = Record<string, unknown>> = Fields<T> & {
64
- id: string;
65
- };
66
- type FieldsProp<T> = NonNullable<T> extends ImageValue ? Field<T | null> : NonNullable<T> extends readonly (infer U)[] ? IsPlainObject<U> extends true ? Field<Array<ListRow<AsRecord<U>>>> : Field<T> : IsPlainObject<NonNullable<T>> extends true ? Fields<NonNullable<T>> : Field<T>;
67
- type Fields<T> = {
68
- readonly [FIELDS_BRAND]: true;
69
- } & {
70
- [K in keyof T]-?: K extends IdentifierKey ? T[K] : FieldsProp<T[K]>;
71
- };
72
- /** Props passed into site components. Raw CMS bags are not assignable. */
73
- type LayoutComponentProps<T extends Record<string, unknown> = Record<string, unknown>> = {
74
- fields: Fields<T>;
75
- };
76
- declare function isBrandedFields(value: unknown): value is Fields<Record<string, unknown>>;
77
- declare function isFieldEnvelope(value: unknown): value is Field<unknown>;
78
- declare function isReadOnlyRowField(value: unknown): boolean;
79
- declare function composerStoreKey(name: string, ref?: FieldRef | null, layoutNodeId?: string): string;
80
- declare function listOwnerFromSpec(spec: {
81
- providerId?: string;
82
- entity?: string;
83
- } | null | undefined): ListOwner | undefined;
84
- type EnvelopeScope = {
85
- ref?: FieldRef;
86
- readOnly?: boolean;
87
- owners?: (fieldName: string) => ListOwner | undefined;
88
- /** Schema-driven: true when the field at this path is a scalar leaf. */
89
- leaf?: (path: string) => boolean;
90
- };
91
- /**
92
- * Wrap a props bag as envelopes. Already-enveloped bags are returned as-is.
93
- * Nested plain objects become nested bags; portable images stay a leaf.
94
- * Object arrays become list rows (`Fields` + plain `id`); `name` is the path
95
- * within the record when `ref` is set.
96
- */
97
- declare function toFieldEnvelopes<T extends Record<string, unknown>>(source: T | null | undefined, prefix?: string, scope?: EnvelopeScope | FieldRef): Fields<T>;
98
- declare function envelopeListRows<T extends Record<string, unknown> = Record<string, unknown>>(items: unknown[], owner?: ListOwner | null): Array<ListRow<T>>;
99
- /** Attach branded `fields` once. Keeps sibling keys (e.g. zoneId). */
100
- declare function attachFieldEnvelopes(props: Record<string, unknown> | null | undefined, sources?: EnvelopeSources | Record<string, ConnectionLike | null | undefined>): Record<string, unknown>;
101
-
102
1
  /**
103
2
  * Runtime page-data context: validate SDK-supplied entity fields against
104
3
  * the published pageData contract and attach to events.
@@ -388,4 +287,4 @@ interface EventTrackingConfig {
388
287
  componentName?: string | null;
389
288
  }
390
289
 
391
- export { type AmplifyContentMeta as A, type ImageValue as B, type ContentSource as C, type PortableRef as D, type EventTrackingConfig as E, type Field as F, type IdentifyInput as I, type LayoutComponentProps as L, type PageConfig as P, type ResolvedPageResourceRef as R, type ZoneConfig as Z, type PageDataSnapshot as a, type PageTaxonomies as b, type CDPAdapter as c, type AmplifyUpConfig as d, type EventProperties as e, type AmplifyPageContextInput as f, type AttachedPageEventContext as g, type IdentifyTraits as h, type ProfileFieldsInput as i, type AmplifyUpTarget as j, resolveAmplifyUpUrls as k, isAmplifyUpTarget as l, FIELDS_BRAND as m, normalizeAmplifyUpTarget as n, attachFieldEnvelopes as o, envelopeListRows as p, composerStoreKey as q, resolveAmplifyUpTarget as r, listOwnerFromSpec as s, toFieldEnvelopes as t, isFieldEnvelope as u, isReadOnlyRowField as v, isBrandedFields as w, type FieldRef as x, type Fields as y, type ListRow as z };
290
+ export { type AmplifyUpTarget as A, type ContentSource as C, type EventTrackingConfig as E, type IdentifyInput as I, type PageConfig as P, type ResolvedPageResourceRef as R, type ZoneConfig as Z, type AmplifyContentMeta as a, resolveAmplifyUpUrls as b, type PageDataSnapshot as c, type PageTaxonomies as d, type CDPAdapter as e, type AmplifyUpConfig as f, type EventProperties as g, type AmplifyPageContextInput as h, type AttachedPageEventContext as i, type IdentifyTraits as j, type ProfileFieldsInput as k, isAmplifyUpTarget as l, normalizeAmplifyUpTarget as n, resolveAmplifyUpTarget as r };
package/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "@amplifyup/sdk",
3
- "version": "0.1.78",
3
+ "version": "0.2.0",
4
4
  "description": "AmplifyUp Tracking SDK - CDP-agnostic event tracking library",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
7
7
  "types": "./dist/index.d.ts",
8
+ "bin": {
9
+ "amplifyup": "./dist/cli.js"
10
+ },
8
11
  "exports": {
9
12
  ".": {
10
13
  "types": "./dist/index.d.ts",
@@ -25,6 +28,16 @@
25
28
  "types": "./dist/middleware.d.ts",
26
29
  "import": "./dist/middleware.mjs",
27
30
  "require": "./dist/middleware.js"
31
+ },
32
+ "./next": {
33
+ "types": "./dist/next.d.ts",
34
+ "import": "./dist/next.mjs",
35
+ "require": "./dist/next.js"
36
+ },
37
+ "./config": {
38
+ "types": "./dist/config.d.ts",
39
+ "import": "./dist/config.mjs",
40
+ "require": "./dist/config.js"
28
41
  }
29
42
  },
30
43
  "files": [
@@ -74,6 +87,8 @@
74
87
  }
75
88
  },
76
89
  "dependencies": {
77
- "marked": "^18.0.9"
90
+ "jiti": "^2.7.0",
91
+ "marked": "^18.0.9",
92
+ "tinyglobby": "^0.2.17"
78
93
  }
79
94
  }
@@ -1,161 +0,0 @@
1
- import { j as AmplifyUpTarget, z as ListRow } from './types-D4TSd2Yt.js';
2
-
3
- /**
4
- * On-request variant selection (tier 3).
5
- *
6
- * Decisions happen on AmplifyUp Edge. The client asks after the view has
7
- * rendered; the Worker returns variant keys only. Profile data never leaves
8
- * the edge. This helper is the JS wrapper around POST /v1/select — the same
9
- * wire format is the contract for Flutter / native / .NET clients. No DOM
10
- * or Next.js assumptions.
11
- */
12
-
13
- interface SelectVariantsResult {
14
- siteId: string;
15
- view: string;
16
- variantKeys: Record<string, string>;
17
- meta?: Record<string, unknown>;
18
- }
19
- declare class SelectVariantsError extends Error {
20
- status: number;
21
- body: unknown;
22
- constructor(message: string, status: number, body?: unknown);
23
- }
24
- interface FetchEdgeSelectOptions {
25
- edgeUrl: string;
26
- trackingId?: string;
27
- site?: string;
28
- view: string;
29
- anonId: string;
30
- sessionId?: string;
31
- zones?: string[];
32
- /** Request-local facts the edge cannot observe (app version, screen class). */
33
- context?: Record<string, unknown>;
34
- fetch?: typeof fetch;
35
- signal?: AbortSignal;
36
- }
37
- declare function fetchEdgeSelect(options: FetchEdgeSelectOptions): Promise<SelectVariantsResult>;
38
- interface SelectVariantsOptions {
39
- trackingId?: string;
40
- site?: string;
41
- view: string;
42
- anonId: string;
43
- sessionId?: string;
44
- zones?: string[];
45
- context?: Record<string, unknown>;
46
- target?: AmplifyUpTarget;
47
- edgeUrl?: string;
48
- fetch?: typeof fetch;
49
- signal?: AbortSignal;
50
- }
51
- /**
52
- * Ask Edge to decide deferred rules for a view. Returns variant keys to pass
53
- * to `/v1/resolve?variants=`.
54
- */
55
- declare function selectVariants(options: SelectVariantsOptions): Promise<SelectVariantsResult>;
56
-
57
- /**
58
- * Runtime content queries.
59
- *
60
- * Page resolve covers data known at Deploy. Visitor-triggered data — search,
61
- * load more, pickers — runs here: the browser asks AmplifyUp, AmplifyUp asks
62
- * the CMS. Only entities published with the page can be queried.
63
- * Edge JSON stays raw. `queryContent` envelopes rows on the SDK so they
64
- * edit in Composer the same way as list-field rows.
65
- */
66
-
67
- type QueryFilterOp = 'eq' | 'neq' | 'in' | 'nin' | 'gt' | 'gte' | 'lt' | 'lte' | 'contains' | 'exists';
68
- interface QueryFilter {
69
- field: string;
70
- op: QueryFilterOp;
71
- value?: unknown;
72
- }
73
- interface QuerySort {
74
- field: string;
75
- dir: 'asc' | 'desc';
76
- }
77
- /**
78
- * Provider-neutral query. AmplifyUp compiles this for the connected CMS —
79
- * it never contains CMS query syntax. Same shape Composer saves on a
80
- * query connection, and the shape returned in `{field}Pagination.spec`.
81
- */
82
- interface QuerySpec {
83
- providerId: string;
84
- entity: string;
85
- filter: QueryFilter[];
86
- sort: QuerySort[];
87
- limit: number;
88
- offset: number;
89
- }
90
- /** Pagination meta added to list props when a query connection is paginated. */
91
- interface QueryPagination {
92
- hasMore: boolean;
93
- limit: number;
94
- offset: number;
95
- nextOffset: number;
96
- spec: QuerySpec;
97
- }
98
- interface QueryResult<T = Record<string, unknown>> {
99
- results: T[];
100
- count: number;
101
- hasMore: boolean;
102
- limit: number;
103
- offset: number;
104
- nextOffset: number;
105
- /** True when a content source failed and results may be incomplete. */
106
- degraded?: boolean;
107
- }
108
- declare class QueryContentError extends Error {
109
- status: number;
110
- body: unknown;
111
- constructor(message: string, status: number, body?: unknown);
112
- }
113
- interface FetchEdgeQueryOptions {
114
- edgeUrl: string;
115
- trackingId: string;
116
- /** Published route the query belongs to (provides sources + entity mapping). */
117
- route: string;
118
- spec: QuerySpec;
119
- siteId?: string | null;
120
- fetch?: typeof fetch;
121
- signal?: AbortSignal;
122
- }
123
- /**
124
- * Low-level runtime query against a known Edge URL.
125
- * Most callers should use `queryContent`, which resolves the URL for them.
126
- */
127
- declare function fetchEdgeQuery<T = Record<string, unknown>>(options: FetchEdgeQueryOptions): Promise<QueryResult<T>>;
128
- interface QueryContentOptions {
129
- trackingId: string;
130
- /** Published route the query belongs to, e.g. '/insights'. */
131
- route: string;
132
- spec: QuerySpec;
133
- siteId?: string | null;
134
- target?: AmplifyUpTarget;
135
- fetch?: typeof fetch;
136
- signal?: AbortSignal;
137
- }
138
- /**
139
- * Run a content query at request time (search, load more, pickers).
140
- *
141
- * Start from the published spec on a paginated list prop so filters and sort
142
- * stay owned by Composer:
143
- *
144
- * ```ts
145
- * const next = await queryContent({
146
- * trackingId,
147
- * route: '/insights',
148
- * spec: { ...postsPagination.spec, offset: postsPagination.nextOffset },
149
- * });
150
- * ```
151
- */
152
- declare function queryContent<T extends Record<string, unknown> = Record<string, unknown>>(options: QueryContentOptions): Promise<QueryResult<ListRow<T>>>;
153
- /** Convenience: next page from pagination meta on a list prop. */
154
- declare function nextPageSpec(pagination: QueryPagination): QuerySpec;
155
- /**
156
- * Convenience: same published query, filtered by a visitor's search term.
157
- * Resets to the first page. Empty terms return the unfiltered spec.
158
- */
159
- declare function searchSpec(pagination: QueryPagination, field: string, term: string): QuerySpec;
160
-
161
- export { type FetchEdgeSelectOptions as F, QueryContentError as Q, SelectVariantsError as S, type SelectVariantsOptions as a, type SelectVariantsResult as b, fetchEdgeQuery as c, searchSpec as d, type QueryContentOptions as e, fetchEdgeSelect as f, type FetchEdgeQueryOptions as g, type QueryResult as h, type QueryPagination as i, type QuerySpec as j, type QueryFilter as k, type QueryFilterOp as l, type QuerySort as m, nextPageSpec as n, queryContent as q, selectVariants as s };
@@ -1,161 +0,0 @@
1
- import { j as AmplifyUpTarget, z as ListRow } from './types-D4TSd2Yt.mjs';
2
-
3
- /**
4
- * On-request variant selection (tier 3).
5
- *
6
- * Decisions happen on AmplifyUp Edge. The client asks after the view has
7
- * rendered; the Worker returns variant keys only. Profile data never leaves
8
- * the edge. This helper is the JS wrapper around POST /v1/select — the same
9
- * wire format is the contract for Flutter / native / .NET clients. No DOM
10
- * or Next.js assumptions.
11
- */
12
-
13
- interface SelectVariantsResult {
14
- siteId: string;
15
- view: string;
16
- variantKeys: Record<string, string>;
17
- meta?: Record<string, unknown>;
18
- }
19
- declare class SelectVariantsError extends Error {
20
- status: number;
21
- body: unknown;
22
- constructor(message: string, status: number, body?: unknown);
23
- }
24
- interface FetchEdgeSelectOptions {
25
- edgeUrl: string;
26
- trackingId?: string;
27
- site?: string;
28
- view: string;
29
- anonId: string;
30
- sessionId?: string;
31
- zones?: string[];
32
- /** Request-local facts the edge cannot observe (app version, screen class). */
33
- context?: Record<string, unknown>;
34
- fetch?: typeof fetch;
35
- signal?: AbortSignal;
36
- }
37
- declare function fetchEdgeSelect(options: FetchEdgeSelectOptions): Promise<SelectVariantsResult>;
38
- interface SelectVariantsOptions {
39
- trackingId?: string;
40
- site?: string;
41
- view: string;
42
- anonId: string;
43
- sessionId?: string;
44
- zones?: string[];
45
- context?: Record<string, unknown>;
46
- target?: AmplifyUpTarget;
47
- edgeUrl?: string;
48
- fetch?: typeof fetch;
49
- signal?: AbortSignal;
50
- }
51
- /**
52
- * Ask Edge to decide deferred rules for a view. Returns variant keys to pass
53
- * to `/v1/resolve?variants=`.
54
- */
55
- declare function selectVariants(options: SelectVariantsOptions): Promise<SelectVariantsResult>;
56
-
57
- /**
58
- * Runtime content queries.
59
- *
60
- * Page resolve covers data known at Deploy. Visitor-triggered data — search,
61
- * load more, pickers — runs here: the browser asks AmplifyUp, AmplifyUp asks
62
- * the CMS. Only entities published with the page can be queried.
63
- * Edge JSON stays raw. `queryContent` envelopes rows on the SDK so they
64
- * edit in Composer the same way as list-field rows.
65
- */
66
-
67
- type QueryFilterOp = 'eq' | 'neq' | 'in' | 'nin' | 'gt' | 'gte' | 'lt' | 'lte' | 'contains' | 'exists';
68
- interface QueryFilter {
69
- field: string;
70
- op: QueryFilterOp;
71
- value?: unknown;
72
- }
73
- interface QuerySort {
74
- field: string;
75
- dir: 'asc' | 'desc';
76
- }
77
- /**
78
- * Provider-neutral query. AmplifyUp compiles this for the connected CMS —
79
- * it never contains CMS query syntax. Same shape Composer saves on a
80
- * query connection, and the shape returned in `{field}Pagination.spec`.
81
- */
82
- interface QuerySpec {
83
- providerId: string;
84
- entity: string;
85
- filter: QueryFilter[];
86
- sort: QuerySort[];
87
- limit: number;
88
- offset: number;
89
- }
90
- /** Pagination meta added to list props when a query connection is paginated. */
91
- interface QueryPagination {
92
- hasMore: boolean;
93
- limit: number;
94
- offset: number;
95
- nextOffset: number;
96
- spec: QuerySpec;
97
- }
98
- interface QueryResult<T = Record<string, unknown>> {
99
- results: T[];
100
- count: number;
101
- hasMore: boolean;
102
- limit: number;
103
- offset: number;
104
- nextOffset: number;
105
- /** True when a content source failed and results may be incomplete. */
106
- degraded?: boolean;
107
- }
108
- declare class QueryContentError extends Error {
109
- status: number;
110
- body: unknown;
111
- constructor(message: string, status: number, body?: unknown);
112
- }
113
- interface FetchEdgeQueryOptions {
114
- edgeUrl: string;
115
- trackingId: string;
116
- /** Published route the query belongs to (provides sources + entity mapping). */
117
- route: string;
118
- spec: QuerySpec;
119
- siteId?: string | null;
120
- fetch?: typeof fetch;
121
- signal?: AbortSignal;
122
- }
123
- /**
124
- * Low-level runtime query against a known Edge URL.
125
- * Most callers should use `queryContent`, which resolves the URL for them.
126
- */
127
- declare function fetchEdgeQuery<T = Record<string, unknown>>(options: FetchEdgeQueryOptions): Promise<QueryResult<T>>;
128
- interface QueryContentOptions {
129
- trackingId: string;
130
- /** Published route the query belongs to, e.g. '/insights'. */
131
- route: string;
132
- spec: QuerySpec;
133
- siteId?: string | null;
134
- target?: AmplifyUpTarget;
135
- fetch?: typeof fetch;
136
- signal?: AbortSignal;
137
- }
138
- /**
139
- * Run a content query at request time (search, load more, pickers).
140
- *
141
- * Start from the published spec on a paginated list prop so filters and sort
142
- * stay owned by Composer:
143
- *
144
- * ```ts
145
- * const next = await queryContent({
146
- * trackingId,
147
- * route: '/insights',
148
- * spec: { ...postsPagination.spec, offset: postsPagination.nextOffset },
149
- * });
150
- * ```
151
- */
152
- declare function queryContent<T extends Record<string, unknown> = Record<string, unknown>>(options: QueryContentOptions): Promise<QueryResult<ListRow<T>>>;
153
- /** Convenience: next page from pagination meta on a list prop. */
154
- declare function nextPageSpec(pagination: QueryPagination): QuerySpec;
155
- /**
156
- * Convenience: same published query, filtered by a visitor's search term.
157
- * Resets to the first page. Empty terms return the unfiltered spec.
158
- */
159
- declare function searchSpec(pagination: QueryPagination, field: string, term: string): QuerySpec;
160
-
161
- export { type FetchEdgeSelectOptions as F, QueryContentError as Q, SelectVariantsError as S, type SelectVariantsOptions as a, type SelectVariantsResult as b, fetchEdgeQuery as c, searchSpec as d, type QueryContentOptions as e, fetchEdgeSelect as f, type FetchEdgeQueryOptions as g, type QueryResult as h, type QueryPagination as i, type QuerySpec as j, type QueryFilter as k, type QueryFilterOp as l, type QuerySort as m, nextPageSpec as n, queryContent as q, selectVariants as s };