@gradial/aci 0.1.41 → 0.1.43
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/CHANGELOG.md +15 -11
- package/README.md +4 -4
- package/dist/astro/index.d.ts +1 -1
- package/dist/astro/index.js +1 -1
- package/dist/astro/page.d.ts +6 -0
- package/dist/astro/page.js +3 -2
- package/dist/audience-data-models.d.ts +286 -0
- package/dist/audience-data-models.js +46 -0
- package/dist/cli/compile-registry.d.mts +6 -0
- package/dist/cli/compile-registry.mjs +774 -0
- package/dist/cli/materialize-template.d.mts +19 -0
- package/dist/cli/materialize-template.mjs +128 -0
- package/dist/cli/validate-content.d.mts +32 -0
- package/dist/cli/validate-content.mjs +464 -0
- package/dist/cli/verify-next-cdn-routes.d.mts +2 -0
- package/dist/cli/verify-next-cdn-routes.mjs +47 -0
- package/dist/collect/aci.js +1 -0
- package/dist/collect/aci.js.sha256 +1 -0
- package/dist/collect/assignments.d.ts +65 -0
- package/dist/collect/assignments.js +138 -0
- package/dist/collect/batcher.d.ts +23 -0
- package/dist/collect/batcher.js +28 -6
- package/dist/collect/consent/envelope.d.ts +9 -3
- package/dist/collect/consent/envelope.js +58 -40
- package/dist/collect/declarative.d.ts +1 -1
- package/dist/collect/declarative.js +7 -1
- package/dist/collect/index.js +39 -6
- package/dist/collect/linkclicks.js +4 -2
- package/dist/collect/pageviews.d.ts +15 -3
- package/dist/collect/pageviews.js +28 -13
- package/dist/collect/transport.d.ts +4 -0
- package/dist/collect/transport.js +37 -2
- package/dist/consent/portable-envelope.d.ts +9 -0
- package/dist/consent/portable-envelope.js +110 -0
- package/dist/consent-banner/index.d.ts +33 -0
- package/dist/consent-banner/index.js +100 -0
- package/dist/content/assets.d.ts +1 -0
- package/dist/content/assets.js +1 -0
- package/dist/content/personalization.d.ts +35 -0
- package/dist/content/personalization.js +57 -0
- package/dist/content/resolve-slots.js +1 -0
- package/dist/content/types.d.ts +9 -1
- package/dist/edge/personalization-core.d.ts +11 -0
- package/dist/edge/personalization-core.js +265 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/next/assignments-script.d.ts +14 -0
- package/dist/next/assignments-script.js +17 -0
- package/dist/next/collect-route.d.ts +19 -0
- package/dist/next/collect-route.js +422 -0
- package/dist/next/envelope-digest.d.ts +21 -0
- package/dist/next/envelope-digest.js +58 -0
- package/dist/next/index.d.ts +1 -0
- package/dist/next/index.js +1 -0
- package/dist/next/middleware.d.ts +31 -3
- package/dist/next/middleware.js +254 -30
- package/dist/next/page.js +2 -1
- package/dist/next/personalization-host.d.ts +127 -0
- package/dist/next/personalization-host.js +257 -0
- package/dist/next/server.d.ts +1 -0
- package/dist/next/server.js +9 -6
- package/dist/next/vercel-collect-sdk-route.d.ts +27 -0
- package/dist/next/vercel-collect-sdk-route.js +205 -0
- package/dist/next/vercel-personalization.d.ts +4 -0
- package/dist/next/vercel-personalization.js +4 -0
- package/dist/next/vercel-s3-personalization.d.ts +79 -0
- package/dist/next/vercel-s3-personalization.js +574 -0
- package/dist/providers/s3.d.ts +20 -5
- package/dist/providers/s3.js +93 -23
- package/dist/react/VideoPlayer.d.ts +6 -6
- package/dist/react/index.d.ts +6 -6
- package/dist/testing/conformance/checks.js +75 -4
- package/dist/types/block-ref.d.ts +2 -0
- package/dist/types/block-ref.js +1 -0
- package/dist/types/page.d.ts +1 -1
- package/package.json +44 -15
- package/src/astro/ConsentBanner.astro +62 -0
- package/src/cli/compile-registry.mjs +24 -10
- package/src/cli/validate-content.mjs +52 -13
- package/src/cli/verify-next-cdn-routes.mjs +5 -4
- package/src/consent-banner/styles.css +110 -0
- package/src/types/block-ref.test.ts +45 -0
- package/src/types/block-ref.ts +2 -0
- package/src/types/page.ts +1 -1
- package/templates/astro/starter-content/src/cms/contracts/components/index.ts +2 -0
- package/templates/astro/starter-content/src/cms/contracts/components/personalizationChoice.contract.ts +17 -0
- package/templates/astro/starter-content/src/cms/registry.ts +3 -0
- package/templates/astro/starter-content/src/components/sections/PersonalizationChoice.astro +41 -0
- package/templates/astro/starter-content/src/fixtures/atomicBlocks.ts +7 -6
- package/templates/astro/starter-content/src/fixtures/composition.ts +3 -2
- package/templates/astro/starter-content/src/fixtures/sections.ts +2 -1
- package/templates/astro/starter-content/src/render/RenderPage.astro +3 -2
- package/templates/astro/template/src/layouts/SiteLayout.astro +3 -1
- package/templates/astro/template/src/pages/[...slug].astro +1 -0
- package/templates/common/.agents/skills/authoring/SKILL.md +11 -3
- package/templates/common/.agents/skills/authoring/references/block-slots.md +3 -0
- package/templates/common/.content/audiences/preference-blue/_index.json +11 -0
- package/templates/common/.content/audiences/preference-red/_index.json +11 -0
- package/templates/common/.content/overlays/audience/preference-blue/pages/home/_index.json +13 -0
- package/templates/common/.content/overlays/audience/preference-red/pages/home/_index.json +13 -0
- package/templates/common/.content/pages/home/_index.json +124 -4
- package/templates/common/.content/segments/preference-blue/_index.json +20 -0
- package/templates/common/.content/segments/preference-red/_index.json +20 -0
- package/templates/common/contracts/components/index.ts +21 -1
- package/templates/common/contracts/components/personalizationChoice.contract.ts +17 -0
- package/templates/common/starter-content/.content/pages/about/_index.json +3 -0
- package/templates/common/starter-content/.content/pages/home/_index.json +9 -0
- package/templates/nextjs/starter-content/src/cms/contracts/components/index.ts +3 -1
- package/templates/nextjs/starter-content/src/cms/contracts/components/personalizationChoice.contract.ts +17 -0
- package/templates/nextjs/starter-content/src/cms/registry.ts +3 -0
- package/templates/nextjs/starter-content/src/components/sections/PersonalizationChoice.tsx +53 -0
- package/templates/nextjs/starter-content/src/middleware.ts +41 -0
- package/templates/nextjs/template/src/app/collect/route.ts +18 -0
- package/templates/nextjs/template/src/middleware.ts +36 -2
- package/templates/nextjs/template/src/middleware.ts.tmpl +31 -1
- package/templates/astro/template/.aci.yaml +0 -28
- package/templates/common/.content/.gradial-dam/blobs/sha256/7f/bf/7fbfc7fe230ff12688c496f660119e41d9725c4504d82e310c15665c73c09292 +0 -0
- package/templates/common/.content/.gradial-dam/blobs/sha256/a0/f5/a0f506689de9b15a7055f70103a3f02cd3ba105771ae2de6754df2ede1210d3a +0 -0
- package/templates/common/.content/.gradial-dam/blobs/sha256/dd/b7/ddb7e9642be08317bcd4b2bd26b58ba8d0d34dd7239e03e684a4f3634fa3845b +0 -0
- package/templates/common/.content/.gradial-dam/blobs/sha256/fb/32/fb3260e8286ea8231ea1c77b9c0be92d6edd9026565731eb14cfdcfd6b1b75b3 +0 -0
- package/templates/common/.content/config/robots.txt +0 -2
- package/templates/common/.content/config/site.json +0 -197
- package/templates/common/.content/dam/folders/seed/ast_site_about_hero/asset.json +0 -9
- package/templates/common/.content/dam/folders/seed/ast_site_about_hero/editorial.json +0 -14
- package/templates/common/.content/dam/folders/seed/ast_site_about_hero/governance.json +0 -23
- package/templates/common/.content/dam/folders/seed/ast_site_about_hero/versions/v0001.json +0 -37
- package/templates/common/.content/dam/folders/seed/ast_site_home_hero/asset.json +0 -9
- package/templates/common/.content/dam/folders/seed/ast_site_home_hero/editorial.json +0 -14
- package/templates/common/.content/dam/folders/seed/ast_site_home_hero/governance.json +0 -23
- package/templates/common/.content/dam/folders/seed/ast_site_home_hero/versions/v0001.json +0 -37
- package/templates/common/.content/fragments/navbar/_index.json +0 -25
- package/templates/common/.content/fragments/site-footer/_index.json +0 -62
- package/templates/common/.content/pages/about/_index.json +0 -51
- package/templates/nextjs/template/.aci.yaml +0 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 0.1.
|
|
3
|
+
## 0.1.43 - 2026-07-27
|
|
4
4
|
|
|
5
5
|
### Fixed
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
never published, leaving its `aci` command unresolvable. The publish process
|
|
11
|
-
now stamps one release version into the SDK, all six platform packages, and
|
|
12
|
-
the README in lockstep, and gates publishing on registry verification of
|
|
13
|
-
every platform package.
|
|
7
|
+
- Ship the native CLI support required by the starter's `event_latest`
|
|
8
|
+
audience criteria in the same release as the SDK, so `aci content compile`
|
|
9
|
+
cannot resolve an older nested platform binary.
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
## 0.1.40 - 2026-07-21
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- First-party consent banner component (`mountConsentBanner`) for sites without
|
|
16
|
+
an external CMP. Checks for the `aci_consent` cookie, renders a banner with
|
|
17
|
+
accept/reject buttons, and calls `applyConsent()` on user decision.
|
|
18
|
+
- `ConsentBanner.astro` wrapper component for Astro sites, importable from
|
|
19
|
+
`@gradial/aci/astro/ConsentBanner`.
|
|
20
|
+
- Base CSS styles for the consent banner in `@gradial/aci/consent-banner/styles.css`.
|
|
21
|
+
Sites override with their own CSS.
|
|
18
22
|
|
|
19
23
|
## 0.1.34 - 2026-07-20
|
|
20
24
|
|
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.43` 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.43 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.43 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.43 init --list
|
|
95
95
|
```
|
|
96
96
|
|
|
97
97
|
## Personalization: The One-Tag Install
|
package/dist/astro/index.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export { getPageData, type PageData, type AstroGlobal, type GetPageDataOptions,
|
|
|
39
39
|
export { createRegistry, registryLookup } from '../registry.js';
|
|
40
40
|
export type { Registry, RegistryEntry, AnyComponent } from '../registry.js';
|
|
41
41
|
export type { BlockRef } from '../types/block-ref.js';
|
|
42
|
-
export { collectScriptTagHTML, collectTagAttributes, COLLECT_SCRIPT_SRC, type CollectTagAttributes, type PersonalizationSiteConfig, type SitePersonalizationConfig, } from '../content/personalization.js';
|
|
42
|
+
export { collectScriptTagHTML, collectTagAttributes, COLLECT_SCRIPT_SRC, assignmentsScriptTagHTML, assignmentsScriptJSON, ASSIGNMENTS_TAG_VERSION, type CollectTagAttributes, type PersonalizationSiteConfig, type SitePersonalizationConfig, type AssignmentsPayloadSource, type ExperimentAssignmentContext, } from '../content/personalization.js';
|
|
43
43
|
export interface RenderableBlock {
|
|
44
44
|
Component: AnyComponent | undefined;
|
|
45
45
|
props: Record<string, unknown>;
|
package/dist/astro/index.js
CHANGED
|
@@ -46,7 +46,7 @@ export { createRegistry, registryLookup } from '../registry.js';
|
|
|
46
46
|
// tag with data attributes), so the kit layout emits the contract tag via
|
|
47
47
|
// this snippet builder (design/04; design/09 Task 9b).
|
|
48
48
|
// ---------------------------------------------------------------------------
|
|
49
|
-
export { collectScriptTagHTML, collectTagAttributes, COLLECT_SCRIPT_SRC, } from '../content/personalization.js';
|
|
49
|
+
export { collectScriptTagHTML, collectTagAttributes, COLLECT_SCRIPT_SRC, assignmentsScriptTagHTML, assignmentsScriptJSON, ASSIGNMENTS_TAG_VERSION, } from '../content/personalization.js';
|
|
50
50
|
export function createRenderChildren(registry) {
|
|
51
51
|
function renderChildren(blocks) {
|
|
52
52
|
return blocks.map((block) => {
|
package/dist/astro/page.d.ts
CHANGED
|
@@ -66,6 +66,12 @@ export interface PageData {
|
|
|
66
66
|
* personalization is disabled or when in preview mode.
|
|
67
67
|
*/
|
|
68
68
|
collectTag: string;
|
|
69
|
+
/**
|
|
70
|
+
* Pre-rendered data-aci-assignments script tag HTML. Empty string when
|
|
71
|
+
* the page payload carries no experiments block (base pages, previews) —
|
|
72
|
+
* the SDK's assignments collector reads this tag to emit exposures.
|
|
73
|
+
*/
|
|
74
|
+
assignmentsTag: string;
|
|
69
75
|
}
|
|
70
76
|
export interface GetPageDataOptions {
|
|
71
77
|
/** Path to compiled content root. Defaults to ACI_CONTENT_ROOT env or '.aci/compiled'. */
|
package/dist/astro/page.js
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
import { normalizeRoute } from '../content/routes.js';
|
|
34
34
|
import { routeMetadataForContent } from '../content/provider.js';
|
|
35
35
|
import { resolveSlots } from '../content/resolve-slots.js';
|
|
36
|
-
import { collectScriptTagHTML } from '../content/personalization.js';
|
|
36
|
+
import { assignmentsScriptTagHTML, collectScriptTagHTML } from '../content/personalization.js';
|
|
37
37
|
import { getPendingRenderInputFromHeaders } from '../runtime/page.js';
|
|
38
38
|
// ---------------------------------------------------------------------------
|
|
39
39
|
// Implementation
|
|
@@ -96,7 +96,8 @@ export async function getPageData(astro, _options) {
|
|
|
96
96
|
// Collect tag: suppress in preview mode (authoring surface, not visitor traffic)
|
|
97
97
|
const isPreview = astro.url.searchParams.has('preview_token');
|
|
98
98
|
const collectTag = isPreview ? '' : collectScriptTagHTML(siteConfig);
|
|
99
|
-
|
|
99
|
+
const assignmentsTag = isPreview ? '' : assignmentsScriptTagHTML(page);
|
|
100
|
+
return { route, siteConfig, page, meta, layout, slots, collectTag, assignmentsTag };
|
|
100
101
|
}
|
|
101
102
|
// ---------------------------------------------------------------------------
|
|
102
103
|
// Internal helpers
|
|
@@ -9,6 +9,149 @@ export declare const segmentDataModel: import("./index.js").DataModelContract<z.
|
|
|
9
9
|
}>;
|
|
10
10
|
priority: z.ZodOptional<z.ZodNumber>;
|
|
11
11
|
description: z.ZodOptional<z.ZodString>;
|
|
12
|
+
criteria: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
13
|
+
all: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
14
|
+
minCount: z.ZodNumber;
|
|
15
|
+
event: z.ZodString;
|
|
16
|
+
path: z.ZodOptional<z.ZodString>;
|
|
17
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
18
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
20
|
+
experimentId: z.ZodString;
|
|
21
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$strict>>;
|
|
23
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
24
|
+
type: z.ZodLiteral<"event_count">;
|
|
25
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
26
|
+
event: z.ZodString;
|
|
27
|
+
path: z.ZodOptional<z.ZodString>;
|
|
28
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
29
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
30
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
31
|
+
experimentId: z.ZodString;
|
|
32
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
33
|
+
}, z.core.$strict>>;
|
|
34
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
35
|
+
type: z.ZodLiteral<"event_exists">;
|
|
36
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
37
|
+
event: z.ZodString;
|
|
38
|
+
path: z.ZodOptional<z.ZodString>;
|
|
39
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
40
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
42
|
+
experimentId: z.ZodString;
|
|
43
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, z.core.$strict>>;
|
|
45
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
46
|
+
type: z.ZodLiteral<"event_latest">;
|
|
47
|
+
}, z.core.$strict>], "type">>;
|
|
48
|
+
any: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
49
|
+
minCount: z.ZodNumber;
|
|
50
|
+
event: z.ZodString;
|
|
51
|
+
path: z.ZodOptional<z.ZodString>;
|
|
52
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
53
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
54
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
55
|
+
experimentId: z.ZodString;
|
|
56
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
57
|
+
}, z.core.$strict>>;
|
|
58
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
59
|
+
type: z.ZodLiteral<"event_count">;
|
|
60
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
61
|
+
event: z.ZodString;
|
|
62
|
+
path: z.ZodOptional<z.ZodString>;
|
|
63
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
64
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
66
|
+
experimentId: z.ZodString;
|
|
67
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
68
|
+
}, z.core.$strict>>;
|
|
69
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
70
|
+
type: z.ZodLiteral<"event_exists">;
|
|
71
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
72
|
+
event: z.ZodString;
|
|
73
|
+
path: z.ZodOptional<z.ZodString>;
|
|
74
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
75
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
76
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
77
|
+
experimentId: z.ZodString;
|
|
78
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
79
|
+
}, z.core.$strict>>;
|
|
80
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
81
|
+
type: z.ZodLiteral<"event_latest">;
|
|
82
|
+
}, z.core.$strict>], "type">>>;
|
|
83
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
84
|
+
all: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
85
|
+
minCount: z.ZodNumber;
|
|
86
|
+
event: z.ZodString;
|
|
87
|
+
path: z.ZodOptional<z.ZodString>;
|
|
88
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
89
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
91
|
+
experimentId: z.ZodString;
|
|
92
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
93
|
+
}, z.core.$strict>>;
|
|
94
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
95
|
+
type: z.ZodLiteral<"event_count">;
|
|
96
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
97
|
+
event: z.ZodString;
|
|
98
|
+
path: z.ZodOptional<z.ZodString>;
|
|
99
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
100
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
101
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
102
|
+
experimentId: z.ZodString;
|
|
103
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
104
|
+
}, z.core.$strict>>;
|
|
105
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
106
|
+
type: z.ZodLiteral<"event_exists">;
|
|
107
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
108
|
+
event: z.ZodString;
|
|
109
|
+
path: z.ZodOptional<z.ZodString>;
|
|
110
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
111
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
112
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
113
|
+
experimentId: z.ZodString;
|
|
114
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
115
|
+
}, z.core.$strict>>;
|
|
116
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
117
|
+
type: z.ZodLiteral<"event_latest">;
|
|
118
|
+
}, z.core.$strict>], "type">>>;
|
|
119
|
+
any: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
120
|
+
minCount: z.ZodNumber;
|
|
121
|
+
event: z.ZodString;
|
|
122
|
+
path: z.ZodOptional<z.ZodString>;
|
|
123
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
124
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
125
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
126
|
+
experimentId: z.ZodString;
|
|
127
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
128
|
+
}, z.core.$strict>>;
|
|
129
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
130
|
+
type: z.ZodLiteral<"event_count">;
|
|
131
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
132
|
+
event: z.ZodString;
|
|
133
|
+
path: z.ZodOptional<z.ZodString>;
|
|
134
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
135
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
136
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
137
|
+
experimentId: z.ZodString;
|
|
138
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
139
|
+
}, z.core.$strict>>;
|
|
140
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
141
|
+
type: z.ZodLiteral<"event_exists">;
|
|
142
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
143
|
+
event: z.ZodString;
|
|
144
|
+
path: z.ZodOptional<z.ZodString>;
|
|
145
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
146
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
147
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
148
|
+
experimentId: z.ZodString;
|
|
149
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
150
|
+
}, z.core.$strict>>;
|
|
151
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
152
|
+
type: z.ZodLiteral<"event_latest">;
|
|
153
|
+
}, z.core.$strict>], "type">>;
|
|
154
|
+
}, z.core.$strict>]>>;
|
|
12
155
|
}, z.core.$strip>, "segment">;
|
|
13
156
|
export declare const audienceDataModel: import("./index.js").DataModelContract<z.ZodObject<{
|
|
14
157
|
id: z.ZodString;
|
|
@@ -259,6 +402,149 @@ export declare const audienceDataModels: (import("./index.js").DataModelContract
|
|
|
259
402
|
}>;
|
|
260
403
|
priority: z.ZodOptional<z.ZodNumber>;
|
|
261
404
|
description: z.ZodOptional<z.ZodString>;
|
|
405
|
+
criteria: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
406
|
+
all: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
407
|
+
minCount: z.ZodNumber;
|
|
408
|
+
event: z.ZodString;
|
|
409
|
+
path: z.ZodOptional<z.ZodString>;
|
|
410
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
411
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
412
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
413
|
+
experimentId: z.ZodString;
|
|
414
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
415
|
+
}, z.core.$strict>>;
|
|
416
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
417
|
+
type: z.ZodLiteral<"event_count">;
|
|
418
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
419
|
+
event: z.ZodString;
|
|
420
|
+
path: z.ZodOptional<z.ZodString>;
|
|
421
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
422
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
423
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
424
|
+
experimentId: z.ZodString;
|
|
425
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
426
|
+
}, z.core.$strict>>;
|
|
427
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
428
|
+
type: z.ZodLiteral<"event_exists">;
|
|
429
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
430
|
+
event: z.ZodString;
|
|
431
|
+
path: z.ZodOptional<z.ZodString>;
|
|
432
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
433
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
434
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
435
|
+
experimentId: z.ZodString;
|
|
436
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
437
|
+
}, z.core.$strict>>;
|
|
438
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
439
|
+
type: z.ZodLiteral<"event_latest">;
|
|
440
|
+
}, z.core.$strict>], "type">>;
|
|
441
|
+
any: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
442
|
+
minCount: z.ZodNumber;
|
|
443
|
+
event: z.ZodString;
|
|
444
|
+
path: z.ZodOptional<z.ZodString>;
|
|
445
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
446
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
447
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
448
|
+
experimentId: z.ZodString;
|
|
449
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
450
|
+
}, z.core.$strict>>;
|
|
451
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
452
|
+
type: z.ZodLiteral<"event_count">;
|
|
453
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
454
|
+
event: z.ZodString;
|
|
455
|
+
path: z.ZodOptional<z.ZodString>;
|
|
456
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
457
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
458
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
459
|
+
experimentId: z.ZodString;
|
|
460
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
461
|
+
}, z.core.$strict>>;
|
|
462
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
463
|
+
type: z.ZodLiteral<"event_exists">;
|
|
464
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
465
|
+
event: z.ZodString;
|
|
466
|
+
path: z.ZodOptional<z.ZodString>;
|
|
467
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
468
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
469
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
470
|
+
experimentId: z.ZodString;
|
|
471
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
472
|
+
}, z.core.$strict>>;
|
|
473
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
474
|
+
type: z.ZodLiteral<"event_latest">;
|
|
475
|
+
}, z.core.$strict>], "type">>>;
|
|
476
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
477
|
+
all: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
478
|
+
minCount: z.ZodNumber;
|
|
479
|
+
event: z.ZodString;
|
|
480
|
+
path: z.ZodOptional<z.ZodString>;
|
|
481
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
482
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
483
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
484
|
+
experimentId: z.ZodString;
|
|
485
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
486
|
+
}, z.core.$strict>>;
|
|
487
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
488
|
+
type: z.ZodLiteral<"event_count">;
|
|
489
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
490
|
+
event: z.ZodString;
|
|
491
|
+
path: z.ZodOptional<z.ZodString>;
|
|
492
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
493
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
494
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
495
|
+
experimentId: z.ZodString;
|
|
496
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
497
|
+
}, z.core.$strict>>;
|
|
498
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
499
|
+
type: z.ZodLiteral<"event_exists">;
|
|
500
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
501
|
+
event: z.ZodString;
|
|
502
|
+
path: z.ZodOptional<z.ZodString>;
|
|
503
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
504
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
505
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
506
|
+
experimentId: z.ZodString;
|
|
507
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
508
|
+
}, z.core.$strict>>;
|
|
509
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
510
|
+
type: z.ZodLiteral<"event_latest">;
|
|
511
|
+
}, z.core.$strict>], "type">>>;
|
|
512
|
+
any: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
513
|
+
minCount: z.ZodNumber;
|
|
514
|
+
event: z.ZodString;
|
|
515
|
+
path: z.ZodOptional<z.ZodString>;
|
|
516
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
517
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
518
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
519
|
+
experimentId: z.ZodString;
|
|
520
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
521
|
+
}, z.core.$strict>>;
|
|
522
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
523
|
+
type: z.ZodLiteral<"event_count">;
|
|
524
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
525
|
+
event: z.ZodString;
|
|
526
|
+
path: z.ZodOptional<z.ZodString>;
|
|
527
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
528
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
529
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
530
|
+
experimentId: z.ZodString;
|
|
531
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
532
|
+
}, z.core.$strict>>;
|
|
533
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
534
|
+
type: z.ZodLiteral<"event_exists">;
|
|
535
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
536
|
+
event: z.ZodString;
|
|
537
|
+
path: z.ZodOptional<z.ZodString>;
|
|
538
|
+
referrer: z.ZodOptional<z.ZodString>;
|
|
539
|
+
withinDays: z.ZodOptional<z.ZodNumber>;
|
|
540
|
+
experiment: z.ZodOptional<z.ZodObject<{
|
|
541
|
+
experimentId: z.ZodString;
|
|
542
|
+
armId: z.ZodOptional<z.ZodString>;
|
|
543
|
+
}, z.core.$strict>>;
|
|
544
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
|
|
545
|
+
type: z.ZodLiteral<"event_latest">;
|
|
546
|
+
}, z.core.$strict>], "type">>;
|
|
547
|
+
}, z.core.$strict>]>>;
|
|
262
548
|
}, z.core.$strip>, "segment"> | import("./index.js").DataModelContract<z.ZodObject<{
|
|
263
549
|
id: z.ZodString;
|
|
264
550
|
displayName: z.ZodString;
|
|
@@ -4,6 +4,51 @@ const resourceStatus = z.enum(['draft', 'enabled', 'disabled']);
|
|
|
4
4
|
const experimentStatus = z.enum(['draft', 'running', 'paused', 'stopped', 'promoted', 'archived']);
|
|
5
5
|
const experimentKind = z.enum(['ab', 'abn', 'xt']);
|
|
6
6
|
const scalarValue = z.union([z.string(), z.number(), z.boolean()]);
|
|
7
|
+
// Largest whole-day window whose nanoseconds fit in Go's time.Duration:
|
|
8
|
+
// floor(MaxInt64 / (24 * time.Hour)) = 106751.
|
|
9
|
+
const maxCriteriaWithinDays = 106751;
|
|
10
|
+
const criteriaFilterValue = z.union([
|
|
11
|
+
z.string().regex(/^(?!\*$)/, 'must not be a lone "*"'),
|
|
12
|
+
z.number(),
|
|
13
|
+
z.boolean(),
|
|
14
|
+
]);
|
|
15
|
+
const criteriaExperimentSchema = z.object({
|
|
16
|
+
experimentId: z.string().regex(/\S/, 'experimentId is required'),
|
|
17
|
+
armId: z.string().optional(),
|
|
18
|
+
}).strict();
|
|
19
|
+
const criteriaFilterShape = {
|
|
20
|
+
event: z.string().regex(/\S/, 'event is required'),
|
|
21
|
+
path: z.string().regex(/^(?!\*$)/, 'path must not be a lone "*"').optional(),
|
|
22
|
+
referrer: z.string().regex(/^(?!\*$)/, 'referrer must not be a lone "*"').optional(),
|
|
23
|
+
withinDays: z.number().int().positive().max(maxCriteriaWithinDays).optional(),
|
|
24
|
+
experiment: criteriaExperimentSchema.optional(),
|
|
25
|
+
properties: z.record(z.string(), criteriaFilterValue).optional(),
|
|
26
|
+
};
|
|
27
|
+
const segmentCriteriaConditionSchema = z.discriminatedUnion('type', [
|
|
28
|
+
z.object({
|
|
29
|
+
type: z.literal('event_count'),
|
|
30
|
+
...criteriaFilterShape,
|
|
31
|
+
minCount: z.number().int().positive(),
|
|
32
|
+
}).strict(),
|
|
33
|
+
z.object({
|
|
34
|
+
type: z.literal('event_exists'),
|
|
35
|
+
...criteriaFilterShape,
|
|
36
|
+
}).strict(),
|
|
37
|
+
z.object({
|
|
38
|
+
type: z.literal('event_latest'),
|
|
39
|
+
...criteriaFilterShape,
|
|
40
|
+
}).strict(),
|
|
41
|
+
]);
|
|
42
|
+
const segmentCriteriaSchema = z.union([
|
|
43
|
+
z.object({
|
|
44
|
+
all: z.array(segmentCriteriaConditionSchema).min(1),
|
|
45
|
+
any: z.array(segmentCriteriaConditionSchema).optional(),
|
|
46
|
+
}).strict(),
|
|
47
|
+
z.object({
|
|
48
|
+
all: z.array(segmentCriteriaConditionSchema).optional(),
|
|
49
|
+
any: z.array(segmentCriteriaConditionSchema).min(1),
|
|
50
|
+
}).strict(),
|
|
51
|
+
]);
|
|
7
52
|
const requestRuleConditionSchema = z.object({
|
|
8
53
|
field: z.string().min(1),
|
|
9
54
|
operator: z.enum(['equals', 'contains', 'startsWith', 'exists']),
|
|
@@ -21,6 +66,7 @@ export const segmentDataModel = defineDataModel({
|
|
|
21
66
|
status: resourceStatus,
|
|
22
67
|
priority: z.number().int().nonnegative().optional(),
|
|
23
68
|
description: z.string().optional(),
|
|
69
|
+
criteria: segmentCriteriaSchema.optional(),
|
|
24
70
|
}),
|
|
25
71
|
});
|
|
26
72
|
export const audienceDataModel = defineDataModel({
|