@gradial/aci 0.1.45 → 0.1.47
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.
- package/README.md +4 -4
- package/dist/astro/error-page.d.ts +56 -0
- package/dist/astro/error-page.js +79 -0
- package/dist/astro/index.d.ts +4 -0
- package/dist/astro/index.js +9 -0
- package/dist/audience-data-models.d.ts +142 -2
- package/dist/audience-data-models.js +2 -0
- package/dist/cli/compile-registry.d.mts +1 -5
- package/dist/cli/compile-registry.mjs +10 -25
- package/dist/cli/emit-error-pages.d.mts +39 -0
- package/dist/cli/emit-error-pages.mjs +402 -0
- package/dist/cli/validate-content.d.mts +1 -31
- package/dist/cli/validate-content.mjs +12 -50
- package/dist/cli/verify-next-cdn-routes.mjs +1 -0
- package/dist/content/default-error-page-html.d.ts +2 -0
- package/dist/content/default-error-page-html.js +6 -0
- package/dist/content/default-error-page.d.ts +23 -0
- package/dist/content/default-error-page.js +34 -0
- package/dist/content/error-page-kind.d.ts +57 -0
- package/dist/content/error-page-kind.js +106 -0
- package/dist/content/error-pages.d.ts +88 -0
- package/dist/content/error-pages.js +120 -0
- package/dist/content/index.d.ts +2 -0
- package/dist/content/index.js +2 -0
- package/dist/content/provider.d.ts +1 -1
- package/dist/content/resolve-slots.js +0 -1
- package/dist/content/types.d.ts +12 -2
- package/dist/internal/render-proof.d.ts +1 -0
- package/dist/internal/render-proof.js +197 -0
- package/dist/next/config.js +17 -0
- package/dist/next/error-page-instrumentation.d.ts +23 -0
- package/dist/next/error-page-instrumentation.js +36 -0
- package/dist/next/error-page-marker.d.ts +11 -0
- package/dist/next/error-page-marker.js +20 -0
- package/dist/next/error-pages.d.ts +52 -0
- package/dist/next/error-pages.js +94 -0
- package/dist/next/error-seat-payload.d.ts +33 -0
- package/dist/next/error-seat-payload.js +143 -0
- package/dist/next/error-seat.d.ts +57 -0
- package/dist/next/error-seat.js +83 -0
- package/dist/next/index.d.ts +4 -0
- package/dist/next/index.js +8 -0
- package/dist/next/middleware.js +9 -54
- package/dist/next/page.js +9 -4
- package/dist/next/personalization-host.d.ts +5 -0
- package/dist/next/server.js +88 -75
- package/dist/next/vercel-collect-sdk-route.js +6 -30
- package/dist/next/vercel-edge-projection-v1.d.ts +24 -0
- package/dist/next/vercel-edge-projection-v1.js +880 -0
- package/dist/next/vercel-s3-personalization.js +7 -11
- package/dist/providers/s3.d.ts +2 -4
- package/dist/providers/s3.js +173 -19
- package/dist/types/block-ref.d.ts +0 -2
- package/dist/types/block-ref.js +0 -1
- package/package.json +15 -9
- package/src/cli/compile-registry.mjs +10 -24
- package/src/cli/emit-error-pages.mjs +424 -0
- package/src/cli/validate-content.mjs +13 -52
- package/src/cli/verify-next-cdn-routes.mjs +6 -0
- package/src/types/block-ref.ts +0 -2
- package/templates/astro/starter-content/src/fixtures/atomicBlocks.ts +6 -7
- package/templates/astro/starter-content/src/fixtures/composition.ts +2 -3
- package/templates/astro/starter-content/src/fixtures/sections.ts +1 -2
- package/templates/astro/template/package.json.tmpl +1 -1
- package/templates/astro/template/src/aci/error-page-instrumentation.mjs +33 -0
- package/templates/astro/template/src/pages/404.astro +54 -0
- package/templates/astro/template/src/pages/500.astro +53 -0
- package/templates/astro/template/src/pages/[...slug].astro +15 -2
- package/templates/common/.agents/skills/authoring/SKILL.md +74 -11
- package/templates/common/.agents/skills/authoring/references/block-slots.md +0 -3
- package/templates/common/.content/config/robots.txt +4 -0
- package/templates/common/.content/config/site.json.tmpl +4 -0
- package/templates/common/.content/pages/404/_index.json +31 -0
- package/templates/common/.content/pages/error/_index.json +31 -0
- package/templates/common/.content/pages/home/_index.json +0 -10
- package/templates/common/.content/schemas/site.schema.json +9 -0
- package/templates/common/starter-content/.content/config/robots.txt +2 -0
- package/templates/common/starter-content/.content/config/site.json +4 -0
- package/templates/common/starter-content/.content/pages/404/_index.json +31 -0
- package/templates/common/starter-content/.content/pages/about/_index.json +0 -3
- package/templates/common/starter-content/.content/pages/error/_index.json +31 -0
- package/templates/common/starter-content/.content/pages/home/_index.json +21 -14
- package/templates/common/starter-content/.content/schemas/site.schema.json +9 -0
- package/templates/nextjs/template/package.json.tmpl +1 -1
- package/templates/nextjs/template/src/aci/error-page-instrumentation.d.mts +4 -0
- package/templates/nextjs/template/src/aci/error-page-instrumentation.mjs +38 -0
- package/templates/nextjs/template/src/app/error.tsx +18 -0
- package/templates/nextjs/template/src/app/not-found.tsx +13 -0
- package/src/types/block-ref.test.ts +0 -45
- package/templates/nextjs/template/src/app/collect/route.ts +0 -18
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Agentic Content Infrastructure SDK
|
|
2
2
|
|
|
3
|
-
`@gradial/aci` `0.1.
|
|
3
|
+
`@gradial/aci` `0.1.47` is a pre-1.0 public-surface reset for the ACI
|
|
4
4
|
client SDK. Breaking changes from the old `0.1.x` accidental surface are
|
|
5
5
|
intentional: the root import is framework-neutral, framework runtime behavior is
|
|
6
6
|
behind explicit subpaths, and the first required customer path is React/Next.
|
|
@@ -8,7 +8,7 @@ behind explicit subpaths, and the first required customer path is React/Next.
|
|
|
8
8
|
## Install
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
npm install @gradial/aci@0.1.
|
|
11
|
+
npm install @gradial/aci@0.1.47 zod@^4
|
|
12
12
|
```
|
|
13
13
|
|
|
14
14
|
## Root Import
|
|
@@ -85,13 +85,13 @@ go through an app-owned HTTP endpoint backed server-side by a `ContentProvider`.
|
|
|
85
85
|
The first RC scaffold path is Next:
|
|
86
86
|
|
|
87
87
|
```bash
|
|
88
|
-
npx @gradial/aci@0.1.
|
|
88
|
+
npx @gradial/aci@0.1.47 init my-site --template next-starter
|
|
89
89
|
```
|
|
90
90
|
|
|
91
91
|
List available templates:
|
|
92
92
|
|
|
93
93
|
```bash
|
|
94
|
-
npx @gradial/aci@0.1.
|
|
94
|
+
npx @gradial/aci@0.1.47 init --list
|
|
95
95
|
```
|
|
96
96
|
|
|
97
97
|
## Personalization: The One-Tag Install
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Astro error-page render helper (authorable-error-pages REQ-7 / REQ-11 /
|
|
3
|
+
* D-10 / D-11; 02-design "SDK core"). The Astro counterpart of the Next
|
|
4
|
+
* seams in `src/next/error-pages.tsx`: resolve the page bound by
|
|
5
|
+
* `site.json#errorPages[kind]` and load it through the normal page pipeline
|
|
6
|
+
* (`getPageData`) so the template's `404.astro`/`500.astro` stay thin —
|
|
7
|
+
* the spike's hand-rolled binding resolution and siteConfig casting live
|
|
8
|
+
* here instead (spike A kill list).
|
|
9
|
+
*
|
|
10
|
+
* Never throws: an error surface must not crash and must not re-enter the
|
|
11
|
+
* failing system (ANTI-2). Any failure — no bindings (REQ-4 warn posture),
|
|
12
|
+
* unreadable content, a bound page missing at render time — degrades to the
|
|
13
|
+
* shipped branded-neutral default fragment with the problem surfaced via
|
|
14
|
+
* console.warn.
|
|
15
|
+
*
|
|
16
|
+
* REQ-11: error pages are base-audience with no personalization, so the
|
|
17
|
+
* returned page data always carries empty collect/assignment tags.
|
|
18
|
+
*/
|
|
19
|
+
import { type AstroGlobal, type PageData } from './page.js';
|
|
20
|
+
import { type ErrorPageKind, type ErrorPagePush, type ErrorPageType } from '../content/error-pages.js';
|
|
21
|
+
import type { KernelRouteMetadata } from '../content/types.js';
|
|
22
|
+
export interface AstroErrorPageData {
|
|
23
|
+
kind: ErrorPageKind;
|
|
24
|
+
/** D-14 page_type for the seat's instrumentation script. */
|
|
25
|
+
pageType: ErrorPageType;
|
|
26
|
+
/**
|
|
27
|
+
* Pre-rendered D-14 analytics `<script>` tag: the site's push function
|
|
28
|
+
* (`options.pushErrorPageView`, D-15 — normally the tenant-owned
|
|
29
|
+
* `src/aci/error-page-instrumentation.mjs`; the SDK default when omitted)
|
|
30
|
+
* serialized via `serializeErrorPageInstrumentation`. The seat injects it
|
|
31
|
+
* via `<Fragment set:html={...}>` — Astro serves real HTML documents, so
|
|
32
|
+
* the inline script executes.
|
|
33
|
+
*/
|
|
34
|
+
instrumentationTag: string;
|
|
35
|
+
/**
|
|
36
|
+
* The bound page loaded through the normal pipeline, with collect and
|
|
37
|
+
* assignment tags suppressed (REQ-11). Null when the shipped default
|
|
38
|
+
* applies — render `fallbackHtml` instead.
|
|
39
|
+
*/
|
|
40
|
+
data: PageData | null;
|
|
41
|
+
/** Shipped branded-neutral default fragment (REQ-4) when `data` is null. */
|
|
42
|
+
fallbackHtml: string | null;
|
|
43
|
+
/** Document metadata for the layout shell, valid in either branch. */
|
|
44
|
+
meta: KernelRouteMetadata;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Resolves and loads the error page bound to `kind` for Astro's native
|
|
48
|
+
* error seats (`404.astro` / `500.astro`). `astro` is the seat's Astro
|
|
49
|
+
* global; the bound route's content is loaded as if it were the requested
|
|
50
|
+
* route, so static builds emit it into `dist/404.html`/`dist/500.html` and
|
|
51
|
+
* server output renders it at error time from local compiled content — no
|
|
52
|
+
* CMS fetch on the failing path (ANTI-2).
|
|
53
|
+
*/
|
|
54
|
+
export declare function getErrorPageData(astro: AstroGlobal, kind: ErrorPageKind, options?: {
|
|
55
|
+
pushErrorPageView?: ErrorPagePush;
|
|
56
|
+
}): Promise<AstroErrorPageData>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Astro error-page render helper (authorable-error-pages REQ-7 / REQ-11 /
|
|
3
|
+
* D-10 / D-11; 02-design "SDK core"). The Astro counterpart of the Next
|
|
4
|
+
* seams in `src/next/error-pages.tsx`: resolve the page bound by
|
|
5
|
+
* `site.json#errorPages[kind]` and load it through the normal page pipeline
|
|
6
|
+
* (`getPageData`) so the template's `404.astro`/`500.astro` stay thin —
|
|
7
|
+
* the spike's hand-rolled binding resolution and siteConfig casting live
|
|
8
|
+
* here instead (spike A kill list).
|
|
9
|
+
*
|
|
10
|
+
* Never throws: an error surface must not crash and must not re-enter the
|
|
11
|
+
* failing system (ANTI-2). Any failure — no bindings (REQ-4 warn posture),
|
|
12
|
+
* unreadable content, a bound page missing at render time — degrades to the
|
|
13
|
+
* shipped branded-neutral default fragment with the problem surfaced via
|
|
14
|
+
* console.warn.
|
|
15
|
+
*
|
|
16
|
+
* REQ-11: error pages are base-audience with no personalization, so the
|
|
17
|
+
* returned page data always carries empty collect/assignment tags.
|
|
18
|
+
*/
|
|
19
|
+
import { getPageData } from './page.js';
|
|
20
|
+
import { defaultPushErrorPageView, errorPageType, resolveErrorPage, serializeErrorPageInstrumentation, } from '../content/error-pages.js';
|
|
21
|
+
import { defaultErrorPageFragmentHtml } from '../content/default-error-page.js';
|
|
22
|
+
const FALLBACK_META = {
|
|
23
|
+
notFound: {
|
|
24
|
+
title: 'Page not found',
|
|
25
|
+
description: 'The page you requested does not exist.',
|
|
26
|
+
},
|
|
27
|
+
catchAll: {
|
|
28
|
+
title: 'Something went wrong',
|
|
29
|
+
description: 'The page you requested could not be served right now.',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Resolves and loads the error page bound to `kind` for Astro's native
|
|
34
|
+
* error seats (`404.astro` / `500.astro`). `astro` is the seat's Astro
|
|
35
|
+
* global; the bound route's content is loaded as if it were the requested
|
|
36
|
+
* route, so static builds emit it into `dist/404.html`/`dist/500.html` and
|
|
37
|
+
* server output renders it at error time from local compiled content — no
|
|
38
|
+
* CMS fetch on the failing path (ANTI-2).
|
|
39
|
+
*/
|
|
40
|
+
export async function getErrorPageData(astro, kind, options = {}) {
|
|
41
|
+
const pageType = errorPageType(kind);
|
|
42
|
+
const instrumentationTag = serializeErrorPageInstrumentation(options.pushErrorPageView ?? defaultPushErrorPageView, kind);
|
|
43
|
+
try {
|
|
44
|
+
const { FileContentProvider } = await import('../providers/file.js');
|
|
45
|
+
const siteConfig = await new FileContentProvider().getSiteConfig();
|
|
46
|
+
const resolved = await resolveErrorPage(kind, siteConfig);
|
|
47
|
+
for (const warning of resolved.warnings) {
|
|
48
|
+
console.warn(`[aci error-pages] ${warning}`);
|
|
49
|
+
}
|
|
50
|
+
if (resolved.route) {
|
|
51
|
+
const slug = resolved.route.replace(/^\/+|\/+$/g, '');
|
|
52
|
+
const data = await getPageData({
|
|
53
|
+
params: { slug },
|
|
54
|
+
request: astro.request,
|
|
55
|
+
url: astro.url,
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
kind,
|
|
59
|
+
pageType,
|
|
60
|
+
instrumentationTag,
|
|
61
|
+
// Base audience, no personalization on error surfaces (REQ-11).
|
|
62
|
+
data: { ...data, collectTag: '', assignmentsTag: '' },
|
|
63
|
+
fallbackHtml: null,
|
|
64
|
+
meta: data.meta,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
console.warn(`[aci error-pages] bound ${kind} page failed to load; serving the shipped default: ${String(error)}`);
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
kind,
|
|
73
|
+
pageType,
|
|
74
|
+
instrumentationTag,
|
|
75
|
+
data: null,
|
|
76
|
+
fallbackHtml: defaultErrorPageFragmentHtml(),
|
|
77
|
+
meta: { ...FALLBACK_META[kind], siteName: 'Gradial' },
|
|
78
|
+
};
|
|
79
|
+
}
|
package/dist/astro/index.d.ts
CHANGED
|
@@ -36,6 +36,10 @@ export declare function getGradialStaticPaths(): Promise<Array<{
|
|
|
36
36
|
}>>;
|
|
37
37
|
export declare function getPageRuntimeRenderInput(request: Request): RenderInput | null;
|
|
38
38
|
export { getPageData, type PageData, type AstroGlobal, type GetPageDataOptions, } from './page.js';
|
|
39
|
+
export { getErrorPageData, type AstroErrorPageData, } from './error-page.js';
|
|
40
|
+
export { errorPageType, type ErrorPageType } from '../content/error-pages.js';
|
|
41
|
+
export type { ErrorPageKind } from '../content/error-pages.js';
|
|
42
|
+
export { PageNotFoundError } from '../content/provider.js';
|
|
39
43
|
export { createRegistry, registryLookup } from '../registry.js';
|
|
40
44
|
export type { Registry, RegistryEntry, AnyComponent } from '../registry.js';
|
|
41
45
|
export type { BlockRef } from '../types/block-ref.js';
|
package/dist/astro/index.js
CHANGED
|
@@ -37,6 +37,15 @@ export function getPageRuntimeRenderInput(request) {
|
|
|
37
37
|
// ---------------------------------------------------------------------------
|
|
38
38
|
export { getPageData, } from './page.js';
|
|
39
39
|
// ---------------------------------------------------------------------------
|
|
40
|
+
// Authorable error pages (specs/features/authorable-error-pages, REQ-7/D-10)
|
|
41
|
+
// — the seats' resolve+render helper, and PageNotFoundError so the catch-all
|
|
42
|
+
// can map content misses to a 404 response in server output.
|
|
43
|
+
// ---------------------------------------------------------------------------
|
|
44
|
+
export { getErrorPageData, } from './error-page.js';
|
|
45
|
+
// Single definition of the kind→page_type mapping (quorum SIMPLE-005).
|
|
46
|
+
export { errorPageType } from '../content/error-pages.js';
|
|
47
|
+
export { PageNotFoundError } from '../content/provider.js';
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
40
49
|
// Registry helpers
|
|
41
50
|
// ---------------------------------------------------------------------------
|
|
42
51
|
export { createRegistry, registryLookup } from '../registry.js';
|
|
@@ -80,6 +80,41 @@ export declare const segmentDataModel: import("./index.js").DataModelContract<z.
|
|
|
80
80
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
81
81
|
type: z.ZodLiteral<"event_latest">;
|
|
82
82
|
}, z.core.$strict>], "type">>>;
|
|
83
|
+
none: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
84
|
+
minCount: z.ZodNumber;
|
|
85
|
+
event: z.ZodString;
|
|
86
|
+
path: z.ZodOptional<z.ZodString>;
|
|
87
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
88
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
90
|
+
experimentId: z.ZodString;
|
|
91
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
92
|
+
}, z.core.$strict>>;
|
|
93
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
94
|
+
type: z.ZodLiteral<"event_count">;
|
|
95
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
96
|
+
event: z.ZodString;
|
|
97
|
+
path: z.ZodOptional<z.ZodString>;
|
|
98
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
99
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
100
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
101
|
+
experimentId: z.ZodString;
|
|
102
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, z.core.$strict>>;
|
|
104
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
105
|
+
type: z.ZodLiteral<"event_exists">;
|
|
106
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
107
|
+
event: z.ZodString;
|
|
108
|
+
path: z.ZodOptional<z.ZodString>;
|
|
109
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
110
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
111
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
112
|
+
experimentId: z.ZodString;
|
|
113
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
114
|
+
}, z.core.$strict>>;
|
|
115
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
116
|
+
type: z.ZodLiteral<"event_latest">;
|
|
117
|
+
}, z.core.$strict>], "type">>>;
|
|
83
118
|
}, z.core.$strict>, z.ZodObject<{
|
|
84
119
|
all: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
85
120
|
minCount: z.ZodNumber;
|
|
@@ -151,6 +186,41 @@ export declare const segmentDataModel: import("./index.js").DataModelContract<z.
|
|
|
151
186
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
152
187
|
type: z.ZodLiteral<"event_latest">;
|
|
153
188
|
}, z.core.$strict>], "type">>;
|
|
189
|
+
none: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
190
|
+
minCount: z.ZodNumber;
|
|
191
|
+
event: z.ZodString;
|
|
192
|
+
path: z.ZodOptional<z.ZodString>;
|
|
193
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
194
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
195
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
196
|
+
experimentId: z.ZodString;
|
|
197
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
198
|
+
}, z.core.$strict>>;
|
|
199
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
200
|
+
type: z.ZodLiteral<"event_count">;
|
|
201
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
202
|
+
event: z.ZodString;
|
|
203
|
+
path: z.ZodOptional<z.ZodString>;
|
|
204
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
205
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
206
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
207
|
+
experimentId: z.ZodString;
|
|
208
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
209
|
+
}, z.core.$strict>>;
|
|
210
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
211
|
+
type: z.ZodLiteral<"event_exists">;
|
|
212
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
213
|
+
event: z.ZodString;
|
|
214
|
+
path: z.ZodOptional<z.ZodString>;
|
|
215
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
216
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
217
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
218
|
+
experimentId: z.ZodString;
|
|
219
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
220
|
+
}, z.core.$strict>>;
|
|
221
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
222
|
+
type: z.ZodLiteral<"event_latest">;
|
|
223
|
+
}, z.core.$strict>], "type">>>;
|
|
154
224
|
}, z.core.$strict>]>>;
|
|
155
225
|
}, z.core.$strip>, "segment">;
|
|
156
226
|
export declare const audienceDataModel: import("./index.js").DataModelContract<z.ZodObject<{
|
|
@@ -163,11 +233,11 @@ export declare const audienceDataModel: import("./index.js").DataModelContract<z
|
|
|
163
233
|
}>;
|
|
164
234
|
priority: z.ZodNumber;
|
|
165
235
|
membershipSource: z.ZodEnum<{
|
|
236
|
+
none: "none";
|
|
166
237
|
segment: "segment";
|
|
167
238
|
rule: "rule";
|
|
168
239
|
manual: "manual";
|
|
169
240
|
external: "external";
|
|
170
|
-
none: "none";
|
|
171
241
|
}>;
|
|
172
242
|
ruleRef: z.ZodOptional<z.ZodString>;
|
|
173
243
|
segmentRef: z.ZodOptional<z.ZodString>;
|
|
@@ -473,6 +543,41 @@ export declare const audienceDataModels: (import("./index.js").DataModelContract
|
|
|
473
543
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
474
544
|
type: z.ZodLiteral<"event_latest">;
|
|
475
545
|
}, z.core.$strict>], "type">>>;
|
|
546
|
+
none: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
547
|
+
minCount: z.ZodNumber;
|
|
548
|
+
event: z.ZodString;
|
|
549
|
+
path: z.ZodOptional<z.ZodString>;
|
|
550
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
551
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
552
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
553
|
+
experimentId: z.ZodString;
|
|
554
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
555
|
+
}, z.core.$strict>>;
|
|
556
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
557
|
+
type: z.ZodLiteral<"event_count">;
|
|
558
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
559
|
+
event: z.ZodString;
|
|
560
|
+
path: z.ZodOptional<z.ZodString>;
|
|
561
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
562
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
563
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
564
|
+
experimentId: z.ZodString;
|
|
565
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
566
|
+
}, z.core.$strict>>;
|
|
567
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
568
|
+
type: z.ZodLiteral<"event_exists">;
|
|
569
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
570
|
+
event: z.ZodString;
|
|
571
|
+
path: z.ZodOptional<z.ZodString>;
|
|
572
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
573
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
574
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
575
|
+
experimentId: z.ZodString;
|
|
576
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
577
|
+
}, z.core.$strict>>;
|
|
578
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
579
|
+
type: z.ZodLiteral<"event_latest">;
|
|
580
|
+
}, z.core.$strict>], "type">>>;
|
|
476
581
|
}, z.core.$strict>, z.ZodObject<{
|
|
477
582
|
all: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
478
583
|
minCount: z.ZodNumber;
|
|
@@ -544,6 +649,41 @@ export declare const audienceDataModels: (import("./index.js").DataModelContract
|
|
|
544
649
|
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
545
650
|
type: z.ZodLiteral<"event_latest">;
|
|
546
651
|
}, z.core.$strict>], "type">>;
|
|
652
|
+
none: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
653
|
+
minCount: z.ZodNumber;
|
|
654
|
+
event: z.ZodString;
|
|
655
|
+
path: z.ZodOptional<z.ZodString>;
|
|
656
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
657
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
658
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
659
|
+
experimentId: z.ZodString;
|
|
660
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
661
|
+
}, z.core.$strict>>;
|
|
662
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
663
|
+
type: z.ZodLiteral<"event_count">;
|
|
664
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
665
|
+
event: z.ZodString;
|
|
666
|
+
path: z.ZodOptional<z.ZodString>;
|
|
667
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
668
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
669
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
670
|
+
experimentId: z.ZodString;
|
|
671
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
672
|
+
}, z.core.$strict>>;
|
|
673
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
674
|
+
type: z.ZodLiteral<"event_exists">;
|
|
675
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
676
|
+
event: z.ZodString;
|
|
677
|
+
path: z.ZodOptional<z.ZodString>;
|
|
678
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
679
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
680
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
681
|
+
experimentId: z.ZodString;
|
|
682
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
683
|
+
}, z.core.$strict>>;
|
|
684
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
685
|
+
type: z.ZodLiteral<"event_latest">;
|
|
686
|
+
}, z.core.$strict>], "type">>>;
|
|
547
687
|
}, z.core.$strict>]>>;
|
|
548
688
|
}, z.core.$strip>, "segment"> | import("./index.js").DataModelContract<z.ZodObject<{
|
|
549
689
|
id: z.ZodString;
|
|
@@ -555,11 +695,11 @@ export declare const audienceDataModels: (import("./index.js").DataModelContract
|
|
|
555
695
|
}>;
|
|
556
696
|
priority: z.ZodNumber;
|
|
557
697
|
membershipSource: z.ZodEnum<{
|
|
698
|
+
none: "none";
|
|
558
699
|
segment: "segment";
|
|
559
700
|
rule: "rule";
|
|
560
701
|
manual: "manual";
|
|
561
702
|
external: "external";
|
|
562
|
-
none: "none";
|
|
563
703
|
}>;
|
|
564
704
|
ruleRef: z.ZodOptional<z.ZodString>;
|
|
565
705
|
segmentRef: z.ZodOptional<z.ZodString>;
|
|
@@ -43,10 +43,12 @@ const segmentCriteriaSchema = z.union([
|
|
|
43
43
|
z.object({
|
|
44
44
|
all: z.array(segmentCriteriaConditionSchema).min(1),
|
|
45
45
|
any: z.array(segmentCriteriaConditionSchema).optional(),
|
|
46
|
+
none: z.array(segmentCriteriaConditionSchema).optional(),
|
|
46
47
|
}).strict(),
|
|
47
48
|
z.object({
|
|
48
49
|
all: z.array(segmentCriteriaConditionSchema).optional(),
|
|
49
50
|
any: z.array(segmentCriteriaConditionSchema).min(1),
|
|
51
|
+
none: z.array(segmentCriteriaConditionSchema).optional(),
|
|
50
52
|
}).strict(),
|
|
51
53
|
]);
|
|
52
54
|
const requestRuleConditionSchema = z.object({
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { realpathSync } from 'node:fs';
|
|
3
2
|
import { mkdir, writeFile } from 'node:fs/promises';
|
|
4
3
|
import path from 'node:path';
|
|
5
|
-
import {
|
|
4
|
+
import { pathToFileURL } from 'node:url';
|
|
6
5
|
import { z } from 'zod';
|
|
7
6
|
import { ImageSchema } from '../types/image.ts';
|
|
8
7
|
import { VideoSchema } from '../types/video.ts';
|
|
@@ -19,16 +18,14 @@ try {
|
|
|
19
18
|
globalThis.React = React;
|
|
20
19
|
}
|
|
21
20
|
catch { /* react not available — component files without JSX will still work */ }
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
process.exitCode = 1;
|
|
31
|
-
}
|
|
21
|
+
const args = parseArgs(process.argv.slice(2));
|
|
22
|
+
try {
|
|
23
|
+
const result = await compileRegistry(args);
|
|
24
|
+
console.log(JSON.stringify({ success: true, ...result, errors: [] }, null, 2));
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
console.error(JSON.stringify({ success: false, errors: [String(error?.message ?? error)] }, null, 2));
|
|
28
|
+
process.exitCode = 1;
|
|
32
29
|
}
|
|
33
30
|
async function compileRegistry(options) {
|
|
34
31
|
const required = ['components', 'layouts', 'output'];
|
|
@@ -443,10 +440,9 @@ async function generatePageSchema(schemaDir, componentEntries, outDir) {
|
|
|
443
440
|
const defs = {
|
|
444
441
|
baseBlock: {
|
|
445
442
|
type: 'object',
|
|
446
|
-
required: ['
|
|
443
|
+
required: ['id', 'component', 'props'],
|
|
447
444
|
additionalProperties: true,
|
|
448
445
|
properties: {
|
|
449
|
-
$type: { const: 'component' },
|
|
450
446
|
id: { type: 'string', minLength: 1 },
|
|
451
447
|
component: { type: 'string' },
|
|
452
448
|
props: { type: 'object' },
|
|
@@ -761,14 +757,3 @@ function parseArgs(argv) {
|
|
|
761
757
|
}
|
|
762
758
|
return out;
|
|
763
759
|
}
|
|
764
|
-
function isMainModule() {
|
|
765
|
-
if (!process.argv[1])
|
|
766
|
-
return false;
|
|
767
|
-
try {
|
|
768
|
-
return realpathSync(fileURLToPath(import.meta.url)) === realpathSync(path.resolve(process.argv[1]));
|
|
769
|
-
}
|
|
770
|
-
catch {
|
|
771
|
-
return false;
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
export { compileRegistry, generatePageSchema };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* D-15 policy resolution for the 500.html instrumentation tag (page_type
|
|
4
|
+
* "error"; self-contained inline delivery — this copy is a real static
|
|
5
|
+
* document where inline scripts execute). Convention path: the tenant-owned
|
|
6
|
+
* `src/aci/error-page-instrumentation.mjs` exporting `pushErrorPageView` is
|
|
7
|
+
* serialized via the SDK mechanism; absent → the SDK default tag. A module
|
|
8
|
+
* that EXISTS but fails to import or lacks the export fails the emit loudly:
|
|
9
|
+
* a typo'd policy module silently reverting to the default is the failure
|
|
10
|
+
* mode D-15 guards against. The source used is logged either way.
|
|
11
|
+
*
|
|
12
|
+
* Exported for unit tests; `content` injects the SDK content functions so
|
|
13
|
+
* tests stay dist-free (at runtime they arrive through the same lazy dist
|
|
14
|
+
* import every other SDK internal uses here, sdkContent).
|
|
15
|
+
*/
|
|
16
|
+
export function resolveInstrumentationTag(root: string | undefined, content: any): Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* D-16 prepare-phase artifact: serializes BOTH kinds' instrumentation tags
|
|
19
|
+
* (tenant module when present, SDK default otherwise) into
|
|
20
|
+
* error-pages/instrumentation.json under the compiled content root. The
|
|
21
|
+
* AWS-lane code capsule packs source/.aci/compiled/**, so the Go publish
|
|
22
|
+
* materializer reads this file from the capsule and stamps the kind-matching
|
|
23
|
+
* tag into the CDN error artifacts — the tag crosses the JS→Go boundary as
|
|
24
|
+
* data. Serialization failures (bind/method-shorthand exports, FIND-006)
|
|
25
|
+
* throw before anything is written.
|
|
26
|
+
*
|
|
27
|
+
* Exported for unit tests; `content` and `outRoot` are injected there like
|
|
28
|
+
* resolveInstrumentationTag's `content`.
|
|
29
|
+
*/
|
|
30
|
+
export function writeInstrumentationArtifact(root: string | undefined, content: any, outRoot?: string): Promise<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Appends the D-14 instrumentation script tag and the generation marker
|
|
33
|
+
* before </body>. Exported for unit tests (the tag is a parameter so the
|
|
34
|
+
* function stays synchronous and dist-free there). Throws when the document
|
|
35
|
+
* has no </body> (quorum BUG-003): writing an UNMARKED 500.html would poison
|
|
36
|
+
* every later build via the skip-if-present contract, so the emit fails
|
|
37
|
+
* loudly instead.
|
|
38
|
+
*/
|
|
39
|
+
export function stampInstrumentation(html: any, instrumentationTag: any): any;
|