@tracelog/event-contract 1.3.1 → 2.0.1

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 CHANGED
@@ -18,6 +18,18 @@ carry it forward.
18
18
  This package, `@tracelog/capture-core` and `@tracelog/capture-web` carry one
19
19
  number between them.
20
20
 
21
+ ## [2.0.1](https://github.com/nacorga/tracelog-sdk/compare/event-contract@2.0.0...event-contract@2.0.1) (2026-10-02)
22
+
23
+
24
+ ### Fixed
25
+
26
+ * a bundle that imports only the contract's limits carries no zod ([518d50e](https://github.com/nacorga/tracelog-sdk/commit/518d50ef2e1dcae1b6c8bd9e871503f3d45f5bf9))
27
+
28
+ ## [2.0.0](https://github.com/nacorga/tracelog-sdk/compare/event-contract@1.3.1...event-contract@2.0.0) (2026-10-01)
29
+
30
+
31
+ * **event-contract:** Synchronize tracelog-sdk versions
32
+
21
33
  ## [1.3.1](https://github.com/nacorga/tracelog-sdk/compare/event-contract@1.3.0...event-contract@1.3.1) (2026-09-30)
22
34
 
23
35
 
package/README.md CHANGED
@@ -19,7 +19,7 @@ schemas rather than a copy of them. Sites installing TraceLog do not need it:
19
19
  <!-- x-release-please-start-version -->
20
20
 
21
21
  ```bash
22
- npm install --save-exact @tracelog/event-contract@1.3.1
22
+ npm install --save-exact @tracelog/event-contract@2.0.1
23
23
  ```
24
24
 
25
25
  <!-- x-release-please-end -->
package/dist/index.d.ts CHANGED
@@ -1,294 +1,3 @@
1
- import { z } from "zod";
2
- export declare const EVENT_ENVELOPE_VERSION: 1;
3
- export declare const MAX_BATCH_EVENTS = 50;
4
- export declare const MAX_BATCH_BYTES: number;
5
- export declare const MAX_CONTEXT_BYTES: number;
6
- export declare const MAX_ERROR_MESSAGE_BYTES = 1024;
7
- export declare const FUTURE_TOLERANCE_MS: number;
8
- export declare const LATE_AFTER_MS: number;
9
- export declare const eventIdSchema: z.ZodUUID;
10
- export declare const sessionIdSchema: z.ZodUUID;
11
- export declare const eventNameSchema: z.ZodString;
12
- export declare const occurredAtSchema: z.ZodISODateTime;
13
- export declare const eventModeSchema: z.ZodLiteral<"verification">;
14
- export declare const contextSchema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
15
- export declare const utmSchema: z.ZodObject<{
16
- source: z.ZodOptional<z.ZodString>;
17
- medium: z.ZodOptional<z.ZodString>;
18
- campaign: z.ZodOptional<z.ZodString>;
19
- term: z.ZodOptional<z.ZodString>;
20
- content: z.ZodOptional<z.ZodString>;
21
- }, z.core.$strict>;
22
- export declare const deviceSchema: z.ZodEnum<{
23
- desktop: "desktop";
24
- mobile: "mobile";
25
- tablet: "tablet";
26
- }>;
27
- export declare const sessionStartEventSchema: z.ZodObject<{
28
- kind: z.ZodLiteral<"session_start">;
29
- referrer: z.ZodOptional<z.ZodString>;
30
- utm: z.ZodObject<{
31
- source: z.ZodOptional<z.ZodString>;
32
- medium: z.ZodOptional<z.ZodString>;
33
- campaign: z.ZodOptional<z.ZodString>;
34
- term: z.ZodOptional<z.ZodString>;
35
- content: z.ZodOptional<z.ZodString>;
36
- }, z.core.$strict>;
37
- landingPage: z.ZodString;
38
- device: z.ZodEnum<{
39
- desktop: "desktop";
40
- mobile: "mobile";
41
- tablet: "tablet";
42
- }>;
43
- eventId: z.ZodUUID;
44
- sessionId: z.ZodUUID;
45
- name: z.ZodString;
46
- occurredAt: z.ZodISODateTime;
47
- mode: z.ZodOptional<z.ZodLiteral<"verification">>;
48
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
49
- }, z.core.$strict>;
50
- export declare const stepEventSchema: z.ZodObject<{
51
- kind: z.ZodLiteral<"step">;
52
- eventId: z.ZodUUID;
53
- sessionId: z.ZodUUID;
54
- name: z.ZodString;
55
- occurredAt: z.ZodISODateTime;
56
- mode: z.ZodOptional<z.ZodLiteral<"verification">>;
57
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
58
- }, z.core.$strict>;
59
- export declare const currencySchema: z.ZodString;
60
- export declare const conversionEventSchema: z.ZodObject<{
61
- kind: z.ZodLiteral<"conversion">;
62
- identifier: z.ZodString;
63
- value: z.ZodOptional<z.ZodNumber>;
64
- currency: z.ZodOptional<z.ZodString>;
65
- eventId: z.ZodUUID;
66
- sessionId: z.ZodUUID;
67
- name: z.ZodString;
68
- occurredAt: z.ZodISODateTime;
69
- mode: z.ZodOptional<z.ZodLiteral<"verification">>;
70
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
71
- }, z.core.$strict>;
72
- export declare const errorMessageSchema: z.ZodString;
73
- export declare const errorEventSchema: z.ZodObject<{
74
- kind: z.ZodLiteral<"error">;
75
- message: z.ZodString;
76
- stepName: z.ZodString;
77
- eventId: z.ZodUUID;
78
- sessionId: z.ZodUUID;
79
- name: z.ZodString;
80
- occurredAt: z.ZodISODateTime;
81
- mode: z.ZodOptional<z.ZodLiteral<"verification">>;
82
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
83
- }, z.core.$strict>;
84
- export declare const eventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
85
- kind: z.ZodLiteral<"session_start">;
86
- referrer: z.ZodOptional<z.ZodString>;
87
- utm: z.ZodObject<{
88
- source: z.ZodOptional<z.ZodString>;
89
- medium: z.ZodOptional<z.ZodString>;
90
- campaign: z.ZodOptional<z.ZodString>;
91
- term: z.ZodOptional<z.ZodString>;
92
- content: z.ZodOptional<z.ZodString>;
93
- }, z.core.$strict>;
94
- landingPage: z.ZodString;
95
- device: z.ZodEnum<{
96
- desktop: "desktop";
97
- mobile: "mobile";
98
- tablet: "tablet";
99
- }>;
100
- eventId: z.ZodUUID;
101
- sessionId: z.ZodUUID;
102
- name: z.ZodString;
103
- occurredAt: z.ZodISODateTime;
104
- mode: z.ZodOptional<z.ZodLiteral<"verification">>;
105
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
106
- }, z.core.$strict>, z.ZodObject<{
107
- kind: z.ZodLiteral<"step">;
108
- eventId: z.ZodUUID;
109
- sessionId: z.ZodUUID;
110
- name: z.ZodString;
111
- occurredAt: z.ZodISODateTime;
112
- mode: z.ZodOptional<z.ZodLiteral<"verification">>;
113
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
114
- }, z.core.$strict>, z.ZodObject<{
115
- kind: z.ZodLiteral<"conversion">;
116
- identifier: z.ZodString;
117
- value: z.ZodOptional<z.ZodNumber>;
118
- currency: z.ZodOptional<z.ZodString>;
119
- eventId: z.ZodUUID;
120
- sessionId: z.ZodUUID;
121
- name: z.ZodString;
122
- occurredAt: z.ZodISODateTime;
123
- mode: z.ZodOptional<z.ZodLiteral<"verification">>;
124
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
125
- }, z.core.$strict>, z.ZodObject<{
126
- kind: z.ZodLiteral<"error">;
127
- message: z.ZodString;
128
- stepName: z.ZodString;
129
- eventId: z.ZodUUID;
130
- sessionId: z.ZodUUID;
131
- name: z.ZodString;
132
- occurredAt: z.ZodISODateTime;
133
- mode: z.ZodOptional<z.ZodLiteral<"verification">>;
134
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
135
- }, z.core.$strict>], "kind">;
136
- export declare const eventBatchSchema: z.ZodObject<{
137
- v: z.ZodLiteral<1>;
138
- events: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
139
- kind: z.ZodLiteral<"session_start">;
140
- referrer: z.ZodOptional<z.ZodString>;
141
- utm: z.ZodObject<{
142
- source: z.ZodOptional<z.ZodString>;
143
- medium: z.ZodOptional<z.ZodString>;
144
- campaign: z.ZodOptional<z.ZodString>;
145
- term: z.ZodOptional<z.ZodString>;
146
- content: z.ZodOptional<z.ZodString>;
147
- }, z.core.$strict>;
148
- landingPage: z.ZodString;
149
- device: z.ZodEnum<{
150
- desktop: "desktop";
151
- mobile: "mobile";
152
- tablet: "tablet";
153
- }>;
154
- eventId: z.ZodUUID;
155
- sessionId: z.ZodUUID;
156
- name: z.ZodString;
157
- occurredAt: z.ZodISODateTime;
158
- mode: z.ZodOptional<z.ZodLiteral<"verification">>;
159
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
160
- }, z.core.$strict>, z.ZodObject<{
161
- kind: z.ZodLiteral<"step">;
162
- eventId: z.ZodUUID;
163
- sessionId: z.ZodUUID;
164
- name: z.ZodString;
165
- occurredAt: z.ZodISODateTime;
166
- mode: z.ZodOptional<z.ZodLiteral<"verification">>;
167
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
168
- }, z.core.$strict>, z.ZodObject<{
169
- kind: z.ZodLiteral<"conversion">;
170
- identifier: z.ZodString;
171
- value: z.ZodOptional<z.ZodNumber>;
172
- currency: z.ZodOptional<z.ZodString>;
173
- eventId: z.ZodUUID;
174
- sessionId: z.ZodUUID;
175
- name: z.ZodString;
176
- occurredAt: z.ZodISODateTime;
177
- mode: z.ZodOptional<z.ZodLiteral<"verification">>;
178
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
179
- }, z.core.$strict>, z.ZodObject<{
180
- kind: z.ZodLiteral<"error">;
181
- message: z.ZodString;
182
- stepName: z.ZodString;
183
- eventId: z.ZodUUID;
184
- sessionId: z.ZodUUID;
185
- name: z.ZodString;
186
- occurredAt: z.ZodISODateTime;
187
- mode: z.ZodOptional<z.ZodLiteral<"verification">>;
188
- context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
189
- }, z.core.$strict>], "kind">>;
190
- }, z.core.$strict>;
191
- export declare const validationClassSchema: z.ZodEnum<{
192
- unknown_version: "unknown_version";
193
- invalid_schema: "invalid_schema";
194
- too_large: "too_large";
195
- future_time: "future_time";
196
- late: "late";
197
- }>;
198
- /**
199
- * `expired` is ingestion's, never `validateEventBatch`'s: an event whose day
200
- * has left the platform's raw hot window is refused alone, the rest of its
201
- * batch stored, because its evidence would not outlive the hour
202
- * ([spec/data.md] § Validation). The window is the platform's to set, so the
203
- * contract names the class and holds no age.
204
- */
205
- export declare const rejectionClassSchema: z.ZodEnum<{
206
- unknown_version: "unknown_version";
207
- invalid_schema: "invalid_schema";
208
- too_large: "too_large";
209
- future_time: "future_time";
210
- expired: "expired";
211
- }>;
212
- /**
213
- * The tag sighting: which GA4, Meta and Google Ads tags the page requested
214
- * around a conversion, carried in that conversion's `context` under
215
- * `TAG_SIGHTINGS_CONTEXT_KEY` ([spec/capture.md] § Tag sightings). The
216
- * envelope does not validate it — `context` stays the free-form bag it is —
217
- * so a platform pinned at any 1.x accepts a conversion carrying it; the
218
- * platform parses it with `tagSightingReportSchema`, and a value that fails
219
- * is no report.
220
- */
221
- export declare const TAG_SIGHTINGS_CONTEXT_KEY = "__tl.tags";
222
- export declare const MAX_TAG_SIGHTINGS = 16;
223
- export declare const tagSightingKinds: readonly ["ga4", "meta", "google_ads"];
224
- export type TagSightingKind = (typeof tagSightingKinds)[number];
225
- /** Source strings, so the bundle can inline them and both sides build one pattern. */
226
- export declare const TAG_ID_PATTERNS: Readonly<Record<TagSightingKind, string>>;
227
- export declare const TAG_EVENT_PATTERN = "^[A-Za-z0-9_]{1,64}$";
228
- export declare const tagSightingSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
229
- kind: z.ZodLiteral<"ga4">;
230
- id: z.ZodString;
231
- event: z.ZodNull;
232
- }, z.core.$strict>, z.ZodObject<{
233
- kind: z.ZodLiteral<"meta">;
234
- id: z.ZodString;
235
- event: z.ZodNullable<z.ZodString>;
236
- }, z.core.$strict>, z.ZodObject<{
237
- kind: z.ZodLiteral<"google_ads">;
238
- id: z.ZodString;
239
- event: z.ZodNull;
240
- }, z.core.$strict>], "kind">;
241
- export declare const tagSightingReportSchema: z.ZodObject<{
242
- complete: z.ZodBoolean;
243
- sightings: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
244
- kind: z.ZodLiteral<"ga4">;
245
- id: z.ZodString;
246
- event: z.ZodNull;
247
- }, z.core.$strict>, z.ZodObject<{
248
- kind: z.ZodLiteral<"meta">;
249
- id: z.ZodString;
250
- event: z.ZodNullable<z.ZodString>;
251
- }, z.core.$strict>, z.ZodObject<{
252
- kind: z.ZodLiteral<"google_ads">;
253
- id: z.ZodString;
254
- event: z.ZodNull;
255
- }, z.core.$strict>], "kind">>;
256
- unread: z.ZodOptional<z.ZodArray<z.ZodEnum<{
257
- ga4: "ga4";
258
- meta: "meta";
259
- google_ads: "google_ads";
260
- }>>>;
261
- }, z.core.$strict>;
262
- export type TagSighting = z.infer<typeof tagSightingSchema>;
263
- export type TagSightingReport = z.infer<typeof tagSightingReportSchema>;
264
- export type EventId = z.infer<typeof eventIdSchema>;
265
- export type SessionId = z.infer<typeof sessionIdSchema>;
266
- export type EventName = z.infer<typeof eventNameSchema>;
267
- export type EventMode = z.infer<typeof eventModeSchema>;
268
- export type EventContext = z.infer<typeof contextSchema>;
269
- export type Utm = z.infer<typeof utmSchema>;
270
- export type Device = z.infer<typeof deviceSchema>;
271
- export type SessionStartEvent = z.infer<typeof sessionStartEventSchema>;
272
- export type StepEvent = z.infer<typeof stepEventSchema>;
273
- export type ConversionEvent = z.infer<typeof conversionEventSchema>;
274
- export type ErrorEvent = z.infer<typeof errorEventSchema>;
275
- export type Event = z.infer<typeof eventSchema>;
276
- export type EventBatch = z.infer<typeof eventBatchSchema>;
277
- export type ValidationClass = z.infer<typeof validationClassSchema>;
278
- export type RejectionClass = z.infer<typeof rejectionClassSchema>;
279
- export interface LateEventFlag {
280
- classification: "late";
281
- eventId: EventId;
282
- }
283
- export type EventBatchValidationResult = {
284
- accepted: true;
285
- batch: EventBatch;
286
- flags: readonly LateEventFlag[];
287
- } | {
288
- accepted: false;
289
- classification: RejectionClass;
290
- };
291
- export declare function validateEventBatch(input: unknown, clock: {
292
- now(): Date;
293
- }): EventBatchValidationResult;
1
+ export * from "./limits.js";
2
+ export * from "./schema.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mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -1,191 +1,3 @@
1
- import { z } from "zod";
2
- export const EVENT_ENVELOPE_VERSION = 1;
3
- export const MAX_BATCH_EVENTS = 50;
4
- export const MAX_BATCH_BYTES = 256 * 1024;
5
- export const MAX_CONTEXT_BYTES = 8 * 1024;
6
- export const MAX_ERROR_MESSAGE_BYTES = 1024;
7
- export const FUTURE_TOLERANCE_MS = 5 * 60 * 1000;
8
- export const LATE_AFTER_MS = 7 * 24 * 60 * 60 * 1000;
9
- const textEncoder = new TextEncoder();
10
- function utf8ByteLength(value) {
11
- return textEncoder.encode(value).byteLength;
12
- }
13
- function serializedByteLength(value) {
14
- try {
15
- const serialized = JSON.stringify(value);
16
- return serialized === undefined ? undefined : utf8ByteLength(serialized);
17
- }
18
- catch {
19
- return undefined;
20
- }
21
- }
22
- export const eventIdSchema = z.uuidv7();
23
- export const sessionIdSchema = z.uuidv7();
24
- export const eventNameSchema = z.string().regex(/^[a-z][a-z0-9_]{0,63}$/);
25
- export const occurredAtSchema = z.iso.datetime({ precision: 3 });
26
- export const eventModeSchema = z.literal("verification");
27
- export const contextSchema = z
28
- .record(z.string(), z.json())
29
- .refine((context) => (serializedByteLength(context) ?? Number.POSITIVE_INFINITY) <=
30
- MAX_CONTEXT_BYTES, { message: `context must serialize to at most ${MAX_CONTEXT_BYTES} bytes` });
31
- const commonEventFields = {
32
- eventId: eventIdSchema,
33
- sessionId: sessionIdSchema,
34
- name: eventNameSchema,
35
- occurredAt: occurredAtSchema,
36
- mode: eventModeSchema.optional(),
37
- context: contextSchema.optional(),
38
- };
39
- export const utmSchema = z.strictObject({
40
- source: z.string().optional(),
41
- medium: z.string().optional(),
42
- campaign: z.string().optional(),
43
- term: z.string().optional(),
44
- content: z.string().optional(),
45
- });
46
- export const deviceSchema = z.enum(["desktop", "mobile", "tablet"]);
47
- export const sessionStartEventSchema = z.strictObject({
48
- ...commonEventFields,
49
- kind: z.literal("session_start"),
50
- referrer: z.string().optional(),
51
- utm: utmSchema,
52
- landingPage: z.string(),
53
- device: deviceSchema,
54
- });
55
- export const stepEventSchema = z.strictObject({
56
- ...commonEventFields,
57
- kind: z.literal("step"),
58
- });
59
- export const currencySchema = z.string().regex(/^[A-Z]{3}$/);
60
- export const conversionEventSchema = z.strictObject({
61
- ...commonEventFields,
62
- kind: z.literal("conversion"),
63
- identifier: z.string().min(1).max(256),
64
- value: z.number().nonnegative().optional(),
65
- currency: currencySchema.optional(),
66
- });
67
- export const errorMessageSchema = z
68
- .string()
69
- .refine((message) => utf8ByteLength(message) <= MAX_ERROR_MESSAGE_BYTES, {
70
- message: `message must be at most ${MAX_ERROR_MESSAGE_BYTES} bytes`,
71
- });
72
- export const errorEventSchema = z.strictObject({
73
- ...commonEventFields,
74
- kind: z.literal("error"),
75
- message: errorMessageSchema,
76
- stepName: eventNameSchema,
77
- });
78
- export const eventSchema = z.discriminatedUnion("kind", [
79
- sessionStartEventSchema,
80
- stepEventSchema,
81
- conversionEventSchema,
82
- errorEventSchema,
83
- ]);
84
- export const eventBatchSchema = z.strictObject({
85
- v: z.literal(EVENT_ENVELOPE_VERSION),
86
- events: z.array(eventSchema).max(MAX_BATCH_EVENTS),
87
- });
88
- export const validationClassSchema = z.enum([
89
- "unknown_version",
90
- "invalid_schema",
91
- "too_large",
92
- "future_time",
93
- "late",
94
- ]);
95
- /**
96
- * `expired` is ingestion's, never `validateEventBatch`'s: an event whose day
97
- * has left the platform's raw hot window is refused alone, the rest of its
98
- * batch stored, because its evidence would not outlive the hour
99
- * ([spec/data.md] § Validation). The window is the platform's to set, so the
100
- * contract names the class and holds no age.
101
- */
102
- export const rejectionClassSchema = z.enum([
103
- "unknown_version",
104
- "invalid_schema",
105
- "too_large",
106
- "future_time",
107
- "expired",
108
- ]);
109
- /**
110
- * The tag sighting: which GA4, Meta and Google Ads tags the page requested
111
- * around a conversion, carried in that conversion's `context` under
112
- * `TAG_SIGHTINGS_CONTEXT_KEY` ([spec/capture.md] § Tag sightings). The
113
- * envelope does not validate it — `context` stays the free-form bag it is —
114
- * so a platform pinned at any 1.x accepts a conversion carrying it; the
115
- * platform parses it with `tagSightingReportSchema`, and a value that fails
116
- * is no report.
117
- */
118
- export const TAG_SIGHTINGS_CONTEXT_KEY = "__tl.tags";
119
- export const MAX_TAG_SIGHTINGS = 16;
120
- export const tagSightingKinds = ["ga4", "meta", "google_ads"];
121
- /** Source strings, so the bundle can inline them and both sides build one pattern. */
122
- export const TAG_ID_PATTERNS = {
123
- ga4: "^G-[A-Z0-9]{4,15}$",
124
- meta: "^[0-9]{6,20}$",
125
- google_ads: "^AW-[0-9]{6,15}(?:/[A-Za-z0-9_-]{1,64})?$",
126
- };
127
- export const TAG_EVENT_PATTERN = "^[A-Za-z0-9_]{1,64}$";
128
- const tagId = (kind) => z.string().regex(new RegExp(TAG_ID_PATTERNS[kind]));
129
- export const tagSightingSchema = z.discriminatedUnion("kind", [
130
- z.strictObject({ kind: z.literal("ga4"), id: tagId("ga4"), event: z.null() }),
131
- z.strictObject({
132
- kind: z.literal("meta"),
133
- id: tagId("meta"),
134
- event: z.string().regex(new RegExp(TAG_EVENT_PATTERN)).nullable(),
135
- }),
136
- z.strictObject({
137
- kind: z.literal("google_ads"),
138
- id: tagId("google_ads"),
139
- event: z.null(),
140
- }),
141
- ]);
142
- export const tagSightingReportSchema = z.strictObject({
143
- /** False when the conversion left before its window closed, or more was sighted than fits. */
144
- complete: z.boolean(),
145
- sightings: z.array(tagSightingSchema).max(MAX_TAG_SIGHTINGS),
146
- /**
147
- * From 1.2.0, in every report whose window the runtime watched whole: each
148
- * kind the page requested inside the window whose tag the runtime could
149
- * not read, once. A report without it could not tell.
150
- */
151
- unread: z
152
- .array(z.enum(tagSightingKinds))
153
- .max(tagSightingKinds.length)
154
- .refine((kinds) => new Set(kinds).size === kinds.length, {
155
- message: "each kind at most once",
156
- })
157
- .optional(),
158
- });
159
- function hasUnknownNumericVersion(input) {
160
- return (typeof input === "object" &&
161
- input !== null &&
162
- "v" in input &&
163
- typeof input.v === "number" &&
164
- input.v !== EVENT_ENVELOPE_VERSION);
165
- }
166
- export function validateEventBatch(input, clock) {
167
- const bodyBytes = serializedByteLength(input);
168
- if (bodyBytes !== undefined && bodyBytes > MAX_BATCH_BYTES) {
169
- return { accepted: false, classification: "too_large" };
170
- }
171
- if (hasUnknownNumericVersion(input)) {
172
- return { accepted: false, classification: "unknown_version" };
173
- }
174
- const parsed = eventBatchSchema.safeParse(input);
175
- if (!parsed.success) {
176
- return { accepted: false, classification: "invalid_schema" };
177
- }
178
- const now = clock.now().getTime();
179
- const flags = [];
180
- for (const event of parsed.data.events) {
181
- const occurredAt = new Date(event.occurredAt).getTime();
182
- if (occurredAt > now + FUTURE_TOLERANCE_MS) {
183
- return { accepted: false, classification: "future_time" };
184
- }
185
- if (occurredAt < now - LATE_AFTER_MS) {
186
- flags.push({ classification: "late", eventId: event.eventId });
187
- }
188
- }
189
- return { accepted: true, batch: parsed.data, flags };
190
- }
1
+ export * from "./limits.js";
2
+ export * from "./schema.js";
191
3
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAU,CAAC;AACjD,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AACnC,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,GAAG,IAAI,CAAC;AAC1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAG,IAAI,CAAC;AAC1C,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAC5C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACjD,MAAM,CAAC,MAAM,aAA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AAC;AACvD,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The envelope's limits and the tag sighting's constants, apart from the
3
+ * schemas: a runtime imports only these, and a module that builds no zod
4
+ * schema is one a bundler can keep while it drops `schema.ts` — and zod with
5
+ * it — from a bundle that never validates.
6
+ */
7
+ export declare const EVENT_ENVELOPE_VERSION: 1;
8
+ export declare const MAX_BATCH_EVENTS = 50;
9
+ export declare const MAX_BATCH_BYTES: number;
10
+ export declare const MAX_CONTEXT_BYTES: number;
11
+ export declare const MAX_ERROR_MESSAGE_BYTES = 1024;
12
+ export declare const FUTURE_TOLERANCE_MS: number;
13
+ export declare const LATE_AFTER_MS: number;
14
+ /**
15
+ * The tag sighting: which GA4, Meta and Google Ads tags the page requested
16
+ * around a conversion, carried in that conversion's `context` under
17
+ * `TAG_SIGHTINGS_CONTEXT_KEY` ([spec/capture.md] § Tag sightings). The
18
+ * envelope does not validate it — `context` stays the free-form bag it is —
19
+ * so a platform pinned at any 1.x accepts a conversion carrying it; the
20
+ * platform parses it with `tagSightingReportSchema`, and a value that fails
21
+ * is no report.
22
+ */
23
+ export declare const TAG_SIGHTINGS_CONTEXT_KEY = "__tl.tags";
24
+ export declare const MAX_TAG_SIGHTINGS = 16;
25
+ export declare const tagSightingKinds: readonly ["ga4", "meta", "google_ads"];
26
+ export type TagSightingKind = (typeof tagSightingKinds)[number];
27
+ /** Source strings, so the bundle can inline them and both sides build one pattern. */
28
+ export declare const TAG_ID_PATTERNS: Readonly<Record<TagSightingKind, string>>;
29
+ export declare const TAG_EVENT_PATTERN = "^[A-Za-z0-9_]{1,64}$";
30
+ //# sourceMappingURL=limits.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limits.d.ts","sourceRoot":"","sources":["../src/limits.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,EAAG,CAAU,CAAC;AACjD,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,eAAe,QAAa,CAAC;AAC1C,eAAO,MAAM,iBAAiB,QAAW,CAAC;AAC1C,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAC5C,eAAO,MAAM,mBAAmB,QAAgB,CAAC;AACjD,eAAO,MAAM,aAAa,QAA0B,CAAC;AAErD;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,cAAc,CAAC;AACrD,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,gBAAgB,wCAAyC,CAAC;AACvE,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAChE,sFAAsF;AACtF,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAIrE,CAAC;AACF,eAAO,MAAM,iBAAiB,yBAAyB,CAAC"}
package/dist/limits.js ADDED
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The envelope's limits and the tag sighting's constants, apart from the
3
+ * schemas: a runtime imports only these, and a module that builds no zod
4
+ * schema is one a bundler can keep while it drops `schema.ts` — and zod with
5
+ * it — from a bundle that never validates.
6
+ */
7
+ export const EVENT_ENVELOPE_VERSION = 1;
8
+ export const MAX_BATCH_EVENTS = 50;
9
+ export const MAX_BATCH_BYTES = 256 * 1024;
10
+ export const MAX_CONTEXT_BYTES = 8 * 1024;
11
+ export const MAX_ERROR_MESSAGE_BYTES = 1024;
12
+ export const FUTURE_TOLERANCE_MS = 5 * 60 * 1000;
13
+ export const LATE_AFTER_MS = 7 * 24 * 60 * 60 * 1000;
14
+ /**
15
+ * The tag sighting: which GA4, Meta and Google Ads tags the page requested
16
+ * around a conversion, carried in that conversion's `context` under
17
+ * `TAG_SIGHTINGS_CONTEXT_KEY` ([spec/capture.md] § Tag sightings). The
18
+ * envelope does not validate it — `context` stays the free-form bag it is —
19
+ * so a platform pinned at any 1.x accepts a conversion carrying it; the
20
+ * platform parses it with `tagSightingReportSchema`, and a value that fails
21
+ * is no report.
22
+ */
23
+ export const TAG_SIGHTINGS_CONTEXT_KEY = "__tl.tags";
24
+ export const MAX_TAG_SIGHTINGS = 16;
25
+ export const tagSightingKinds = ["ga4", "meta", "google_ads"];
26
+ /** Source strings, so the bundle can inline them and both sides build one pattern. */
27
+ export const TAG_ID_PATTERNS = {
28
+ ga4: "^G-[A-Z0-9]{4,15}$",
29
+ meta: "^[0-9]{6,20}$",
30
+ google_ads: "^AW-[0-9]{6,15}(?:/[A-Za-z0-9_-]{1,64})?$",
31
+ };
32
+ export const TAG_EVENT_PATTERN = "^[A-Za-z0-9_]{1,64}$";
33
+ //# sourceMappingURL=limits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limits.js","sourceRoot":"","sources":["../src/limits.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAU,CAAC;AACjD,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AACnC,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,GAAG,IAAI,CAAC;AAC1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,GAAG,IAAI,CAAC;AAC1C,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAC5C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACjD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAErD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,WAAW,CAAC;AACrD,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AACpC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAU,CAAC;AAEvE,sFAAsF;AACtF,MAAM,CAAC,MAAM,eAAe,GAA8C;IACxE,GAAG,EAAE,oBAAoB;IACzB,IAAI,EAAE,eAAe;IACrB,UAAU,EAAE,2CAA2C;CACxD,CAAC;AACF,MAAM,CAAC,MAAM,iBAAiB,GAAG,sBAAsB,CAAC"}
@@ -0,0 +1,271 @@
1
+ import { z } from "zod";
2
+ export declare const eventIdSchema: z.ZodUUID;
3
+ export declare const sessionIdSchema: z.ZodUUID;
4
+ export declare const eventNameSchema: z.ZodString;
5
+ export declare const occurredAtSchema: z.ZodISODateTime;
6
+ export declare const eventModeSchema: z.ZodLiteral<"verification">;
7
+ export declare const contextSchema: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
8
+ export declare const utmSchema: z.ZodObject<{
9
+ source: z.ZodOptional<z.ZodString>;
10
+ medium: z.ZodOptional<z.ZodString>;
11
+ campaign: z.ZodOptional<z.ZodString>;
12
+ term: z.ZodOptional<z.ZodString>;
13
+ content: z.ZodOptional<z.ZodString>;
14
+ }, z.core.$strict>;
15
+ export declare const deviceSchema: z.ZodEnum<{
16
+ desktop: "desktop";
17
+ mobile: "mobile";
18
+ tablet: "tablet";
19
+ }>;
20
+ export declare const sessionStartEventSchema: z.ZodObject<{
21
+ kind: z.ZodLiteral<"session_start">;
22
+ referrer: z.ZodOptional<z.ZodString>;
23
+ utm: z.ZodObject<{
24
+ source: z.ZodOptional<z.ZodString>;
25
+ medium: z.ZodOptional<z.ZodString>;
26
+ campaign: z.ZodOptional<z.ZodString>;
27
+ term: z.ZodOptional<z.ZodString>;
28
+ content: z.ZodOptional<z.ZodString>;
29
+ }, z.core.$strict>;
30
+ landingPage: z.ZodString;
31
+ device: z.ZodEnum<{
32
+ desktop: "desktop";
33
+ mobile: "mobile";
34
+ tablet: "tablet";
35
+ }>;
36
+ eventId: z.ZodUUID;
37
+ sessionId: z.ZodUUID;
38
+ name: z.ZodString;
39
+ occurredAt: z.ZodISODateTime;
40
+ mode: z.ZodOptional<z.ZodLiteral<"verification">>;
41
+ context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
42
+ }, z.core.$strict>;
43
+ export declare const stepEventSchema: z.ZodObject<{
44
+ kind: z.ZodLiteral<"step">;
45
+ eventId: z.ZodUUID;
46
+ sessionId: z.ZodUUID;
47
+ name: z.ZodString;
48
+ occurredAt: z.ZodISODateTime;
49
+ mode: z.ZodOptional<z.ZodLiteral<"verification">>;
50
+ context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
51
+ }, z.core.$strict>;
52
+ export declare const currencySchema: z.ZodString;
53
+ export declare const conversionEventSchema: z.ZodObject<{
54
+ kind: z.ZodLiteral<"conversion">;
55
+ identifier: z.ZodString;
56
+ value: z.ZodOptional<z.ZodNumber>;
57
+ currency: z.ZodOptional<z.ZodString>;
58
+ eventId: z.ZodUUID;
59
+ sessionId: z.ZodUUID;
60
+ name: z.ZodString;
61
+ occurredAt: z.ZodISODateTime;
62
+ mode: z.ZodOptional<z.ZodLiteral<"verification">>;
63
+ context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
64
+ }, z.core.$strict>;
65
+ export declare const errorMessageSchema: z.ZodString;
66
+ export declare const errorEventSchema: z.ZodObject<{
67
+ kind: z.ZodLiteral<"error">;
68
+ message: z.ZodString;
69
+ stepName: z.ZodString;
70
+ eventId: z.ZodUUID;
71
+ sessionId: z.ZodUUID;
72
+ name: z.ZodString;
73
+ occurredAt: z.ZodISODateTime;
74
+ mode: z.ZodOptional<z.ZodLiteral<"verification">>;
75
+ context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
76
+ }, z.core.$strict>;
77
+ export declare const eventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
78
+ kind: z.ZodLiteral<"session_start">;
79
+ referrer: z.ZodOptional<z.ZodString>;
80
+ utm: z.ZodObject<{
81
+ source: z.ZodOptional<z.ZodString>;
82
+ medium: z.ZodOptional<z.ZodString>;
83
+ campaign: z.ZodOptional<z.ZodString>;
84
+ term: z.ZodOptional<z.ZodString>;
85
+ content: z.ZodOptional<z.ZodString>;
86
+ }, z.core.$strict>;
87
+ landingPage: z.ZodString;
88
+ device: z.ZodEnum<{
89
+ desktop: "desktop";
90
+ mobile: "mobile";
91
+ tablet: "tablet";
92
+ }>;
93
+ eventId: z.ZodUUID;
94
+ sessionId: z.ZodUUID;
95
+ name: z.ZodString;
96
+ occurredAt: z.ZodISODateTime;
97
+ mode: z.ZodOptional<z.ZodLiteral<"verification">>;
98
+ context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
99
+ }, z.core.$strict>, z.ZodObject<{
100
+ kind: z.ZodLiteral<"step">;
101
+ eventId: z.ZodUUID;
102
+ sessionId: z.ZodUUID;
103
+ name: z.ZodString;
104
+ occurredAt: z.ZodISODateTime;
105
+ mode: z.ZodOptional<z.ZodLiteral<"verification">>;
106
+ context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
107
+ }, z.core.$strict>, z.ZodObject<{
108
+ kind: z.ZodLiteral<"conversion">;
109
+ identifier: z.ZodString;
110
+ value: z.ZodOptional<z.ZodNumber>;
111
+ currency: z.ZodOptional<z.ZodString>;
112
+ eventId: z.ZodUUID;
113
+ sessionId: z.ZodUUID;
114
+ name: z.ZodString;
115
+ occurredAt: z.ZodISODateTime;
116
+ mode: z.ZodOptional<z.ZodLiteral<"verification">>;
117
+ context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
118
+ }, z.core.$strict>, z.ZodObject<{
119
+ kind: z.ZodLiteral<"error">;
120
+ message: z.ZodString;
121
+ stepName: z.ZodString;
122
+ eventId: z.ZodUUID;
123
+ sessionId: z.ZodUUID;
124
+ name: z.ZodString;
125
+ occurredAt: z.ZodISODateTime;
126
+ mode: z.ZodOptional<z.ZodLiteral<"verification">>;
127
+ context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
128
+ }, z.core.$strict>], "kind">;
129
+ export declare const eventBatchSchema: z.ZodObject<{
130
+ v: z.ZodLiteral<1>;
131
+ events: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
132
+ kind: z.ZodLiteral<"session_start">;
133
+ referrer: z.ZodOptional<z.ZodString>;
134
+ utm: z.ZodObject<{
135
+ source: z.ZodOptional<z.ZodString>;
136
+ medium: z.ZodOptional<z.ZodString>;
137
+ campaign: z.ZodOptional<z.ZodString>;
138
+ term: z.ZodOptional<z.ZodString>;
139
+ content: z.ZodOptional<z.ZodString>;
140
+ }, z.core.$strict>;
141
+ landingPage: z.ZodString;
142
+ device: z.ZodEnum<{
143
+ desktop: "desktop";
144
+ mobile: "mobile";
145
+ tablet: "tablet";
146
+ }>;
147
+ eventId: z.ZodUUID;
148
+ sessionId: z.ZodUUID;
149
+ name: z.ZodString;
150
+ occurredAt: z.ZodISODateTime;
151
+ mode: z.ZodOptional<z.ZodLiteral<"verification">>;
152
+ context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
153
+ }, z.core.$strict>, z.ZodObject<{
154
+ kind: z.ZodLiteral<"step">;
155
+ eventId: z.ZodUUID;
156
+ sessionId: z.ZodUUID;
157
+ name: z.ZodString;
158
+ occurredAt: z.ZodISODateTime;
159
+ mode: z.ZodOptional<z.ZodLiteral<"verification">>;
160
+ context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
161
+ }, z.core.$strict>, z.ZodObject<{
162
+ kind: z.ZodLiteral<"conversion">;
163
+ identifier: z.ZodString;
164
+ value: z.ZodOptional<z.ZodNumber>;
165
+ currency: z.ZodOptional<z.ZodString>;
166
+ eventId: z.ZodUUID;
167
+ sessionId: z.ZodUUID;
168
+ name: z.ZodString;
169
+ occurredAt: z.ZodISODateTime;
170
+ mode: z.ZodOptional<z.ZodLiteral<"verification">>;
171
+ context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
172
+ }, z.core.$strict>, z.ZodObject<{
173
+ kind: z.ZodLiteral<"error">;
174
+ message: z.ZodString;
175
+ stepName: z.ZodString;
176
+ eventId: z.ZodUUID;
177
+ sessionId: z.ZodUUID;
178
+ name: z.ZodString;
179
+ occurredAt: z.ZodISODateTime;
180
+ mode: z.ZodOptional<z.ZodLiteral<"verification">>;
181
+ context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodJSONSchema>>;
182
+ }, z.core.$strict>], "kind">>;
183
+ }, z.core.$strict>;
184
+ export declare const validationClassSchema: z.ZodEnum<{
185
+ unknown_version: "unknown_version";
186
+ invalid_schema: "invalid_schema";
187
+ too_large: "too_large";
188
+ future_time: "future_time";
189
+ late: "late";
190
+ }>;
191
+ /**
192
+ * `expired` is ingestion's, never `validateEventBatch`'s: an event whose day
193
+ * has left the platform's raw hot window is refused alone, the rest of its
194
+ * batch stored, because its evidence would not outlive the hour
195
+ * ([spec/data.md] § Validation). The window is the platform's to set, so the
196
+ * contract names the class and holds no age.
197
+ */
198
+ export declare const rejectionClassSchema: z.ZodEnum<{
199
+ unknown_version: "unknown_version";
200
+ invalid_schema: "invalid_schema";
201
+ too_large: "too_large";
202
+ future_time: "future_time";
203
+ expired: "expired";
204
+ }>;
205
+ export declare const tagSightingSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
206
+ kind: z.ZodLiteral<"ga4">;
207
+ id: z.ZodString;
208
+ event: z.ZodNull;
209
+ }, z.core.$strict>, z.ZodObject<{
210
+ kind: z.ZodLiteral<"meta">;
211
+ id: z.ZodString;
212
+ event: z.ZodNullable<z.ZodString>;
213
+ }, z.core.$strict>, z.ZodObject<{
214
+ kind: z.ZodLiteral<"google_ads">;
215
+ id: z.ZodString;
216
+ event: z.ZodNull;
217
+ }, z.core.$strict>], "kind">;
218
+ export declare const tagSightingReportSchema: z.ZodObject<{
219
+ complete: z.ZodBoolean;
220
+ sightings: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
221
+ kind: z.ZodLiteral<"ga4">;
222
+ id: z.ZodString;
223
+ event: z.ZodNull;
224
+ }, z.core.$strict>, z.ZodObject<{
225
+ kind: z.ZodLiteral<"meta">;
226
+ id: z.ZodString;
227
+ event: z.ZodNullable<z.ZodString>;
228
+ }, z.core.$strict>, z.ZodObject<{
229
+ kind: z.ZodLiteral<"google_ads">;
230
+ id: z.ZodString;
231
+ event: z.ZodNull;
232
+ }, z.core.$strict>], "kind">>;
233
+ unread: z.ZodOptional<z.ZodArray<z.ZodEnum<{
234
+ ga4: "ga4";
235
+ meta: "meta";
236
+ google_ads: "google_ads";
237
+ }>>>;
238
+ }, z.core.$strict>;
239
+ export type TagSighting = z.infer<typeof tagSightingSchema>;
240
+ export type TagSightingReport = z.infer<typeof tagSightingReportSchema>;
241
+ export type EventId = z.infer<typeof eventIdSchema>;
242
+ export type SessionId = z.infer<typeof sessionIdSchema>;
243
+ export type EventName = z.infer<typeof eventNameSchema>;
244
+ export type EventMode = z.infer<typeof eventModeSchema>;
245
+ export type EventContext = z.infer<typeof contextSchema>;
246
+ export type Utm = z.infer<typeof utmSchema>;
247
+ export type Device = z.infer<typeof deviceSchema>;
248
+ export type SessionStartEvent = z.infer<typeof sessionStartEventSchema>;
249
+ export type StepEvent = z.infer<typeof stepEventSchema>;
250
+ export type ConversionEvent = z.infer<typeof conversionEventSchema>;
251
+ export type ErrorEvent = z.infer<typeof errorEventSchema>;
252
+ export type Event = z.infer<typeof eventSchema>;
253
+ export type EventBatch = z.infer<typeof eventBatchSchema>;
254
+ export type ValidationClass = z.infer<typeof validationClassSchema>;
255
+ export type RejectionClass = z.infer<typeof rejectionClassSchema>;
256
+ export interface LateEventFlag {
257
+ classification: "late";
258
+ eventId: EventId;
259
+ }
260
+ export type EventBatchValidationResult = {
261
+ accepted: true;
262
+ batch: EventBatch;
263
+ flags: readonly LateEventFlag[];
264
+ } | {
265
+ accepted: false;
266
+ classification: RejectionClass;
267
+ };
268
+ export declare function validateEventBatch(input: unknown, clock: {
269
+ now(): Date;
270
+ }): EventBatchValidationResult;
271
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgCxB,eAAO,MAAM,aAAa,WAAa,CAAC;AACxC,eAAO,MAAM,eAAe,WAAa,CAAC;AAC1C,eAAO,MAAM,eAAe,aAA6C,CAAC;AAC1E,eAAO,MAAM,gBAAgB,kBAAmC,CAAC;AACjE,eAAO,MAAM,eAAe,8BAA4B,CAAC;AACzD,eAAO,MAAM,aAAa,2CAOvB,CAAC;AAWJ,eAAO,MAAM,SAAS;;;;;;kBAMpB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;EAA0C,CAAC;AAEpE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;kBAOlC,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;kBAG1B,CAAC;AAEH,eAAO,MAAM,cAAc,aAAiC,CAAC;AAE7D,eAAO,MAAM,qBAAqB;;;;;;;;;;;kBAMhC,CAAC;AAEH,eAAO,MAAM,kBAAkB,aAI3B,CAAC;AAEL,eAAO,MAAM,gBAAgB;;;;;;;;;;kBAK3B,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAKtB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAG3B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;EAMhC,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;;;;;EAM/B,CAAC;AAIH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;4BAY5B,CAAC;AACH,eAAO,MAAM,u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C,CAAC;AAC1D,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,MAAM,0BAA0B,GAClC;IACE,QAAQ,EAAE,IAAI,CAAC;IACf,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,SAAS,aAAa,EAAE,CAAC;CACjC,GACD;IACE,QAAQ,EAAE,KAAK,CAAC;IAChB,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAYN,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,EACd,KAAK,EAAE;IAAE,GAAG,IAAI,IAAI,CAAA;CAAE,GACrB,0BAA0B,CA8B5B"}
package/dist/schema.js ADDED
@@ -0,0 +1,166 @@
1
+ import { z } from "zod";
2
+ import { EVENT_ENVELOPE_VERSION, FUTURE_TOLERANCE_MS, LATE_AFTER_MS, MAX_BATCH_BYTES, MAX_BATCH_EVENTS, MAX_CONTEXT_BYTES, MAX_ERROR_MESSAGE_BYTES, MAX_TAG_SIGHTINGS, TAG_EVENT_PATTERN, TAG_ID_PATTERNS, tagSightingKinds, } from "./limits.js";
3
+ const textEncoder = new TextEncoder();
4
+ function utf8ByteLength(value) {
5
+ return textEncoder.encode(value).byteLength;
6
+ }
7
+ function serializedByteLength(value) {
8
+ try {
9
+ const serialized = JSON.stringify(value);
10
+ return serialized === undefined ? undefined : utf8ByteLength(serialized);
11
+ }
12
+ catch {
13
+ return undefined;
14
+ }
15
+ }
16
+ export const eventIdSchema = z.uuidv7();
17
+ export const sessionIdSchema = z.uuidv7();
18
+ export const eventNameSchema = z.string().regex(/^[a-z][a-z0-9_]{0,63}$/);
19
+ export const occurredAtSchema = z.iso.datetime({ precision: 3 });
20
+ export const eventModeSchema = z.literal("verification");
21
+ export const contextSchema = z
22
+ .record(z.string(), z.json())
23
+ .refine((context) => (serializedByteLength(context) ?? Number.POSITIVE_INFINITY) <=
24
+ MAX_CONTEXT_BYTES, { message: `context must serialize to at most ${MAX_CONTEXT_BYTES} bytes` });
25
+ const commonEventFields = {
26
+ eventId: eventIdSchema,
27
+ sessionId: sessionIdSchema,
28
+ name: eventNameSchema,
29
+ occurredAt: occurredAtSchema,
30
+ mode: eventModeSchema.optional(),
31
+ context: contextSchema.optional(),
32
+ };
33
+ export const utmSchema = z.strictObject({
34
+ source: z.string().optional(),
35
+ medium: z.string().optional(),
36
+ campaign: z.string().optional(),
37
+ term: z.string().optional(),
38
+ content: z.string().optional(),
39
+ });
40
+ export const deviceSchema = z.enum(["desktop", "mobile", "tablet"]);
41
+ export const sessionStartEventSchema = z.strictObject({
42
+ ...commonEventFields,
43
+ kind: z.literal("session_start"),
44
+ referrer: z.string().optional(),
45
+ utm: utmSchema,
46
+ landingPage: z.string(),
47
+ device: deviceSchema,
48
+ });
49
+ export const stepEventSchema = z.strictObject({
50
+ ...commonEventFields,
51
+ kind: z.literal("step"),
52
+ });
53
+ export const currencySchema = z.string().regex(/^[A-Z]{3}$/);
54
+ export const conversionEventSchema = z.strictObject({
55
+ ...commonEventFields,
56
+ kind: z.literal("conversion"),
57
+ identifier: z.string().min(1).max(256),
58
+ value: z.number().nonnegative().optional(),
59
+ currency: currencySchema.optional(),
60
+ });
61
+ export const errorMessageSchema = z
62
+ .string()
63
+ .refine((message) => utf8ByteLength(message) <= MAX_ERROR_MESSAGE_BYTES, {
64
+ message: `message must be at most ${MAX_ERROR_MESSAGE_BYTES} bytes`,
65
+ });
66
+ export const errorEventSchema = z.strictObject({
67
+ ...commonEventFields,
68
+ kind: z.literal("error"),
69
+ message: errorMessageSchema,
70
+ stepName: eventNameSchema,
71
+ });
72
+ export const eventSchema = z.discriminatedUnion("kind", [
73
+ sessionStartEventSchema,
74
+ stepEventSchema,
75
+ conversionEventSchema,
76
+ errorEventSchema,
77
+ ]);
78
+ export const eventBatchSchema = z.strictObject({
79
+ v: z.literal(EVENT_ENVELOPE_VERSION),
80
+ events: z.array(eventSchema).max(MAX_BATCH_EVENTS),
81
+ });
82
+ export const validationClassSchema = z.enum([
83
+ "unknown_version",
84
+ "invalid_schema",
85
+ "too_large",
86
+ "future_time",
87
+ "late",
88
+ ]);
89
+ /**
90
+ * `expired` is ingestion's, never `validateEventBatch`'s: an event whose day
91
+ * has left the platform's raw hot window is refused alone, the rest of its
92
+ * batch stored, because its evidence would not outlive the hour
93
+ * ([spec/data.md] § Validation). The window is the platform's to set, so the
94
+ * contract names the class and holds no age.
95
+ */
96
+ export const rejectionClassSchema = z.enum([
97
+ "unknown_version",
98
+ "invalid_schema",
99
+ "too_large",
100
+ "future_time",
101
+ "expired",
102
+ ]);
103
+ const tagId = (kind) => z.string().regex(new RegExp(TAG_ID_PATTERNS[kind]));
104
+ export const tagSightingSchema = z.discriminatedUnion("kind", [
105
+ z.strictObject({ kind: z.literal("ga4"), id: tagId("ga4"), event: z.null() }),
106
+ z.strictObject({
107
+ kind: z.literal("meta"),
108
+ id: tagId("meta"),
109
+ event: z.string().regex(new RegExp(TAG_EVENT_PATTERN)).nullable(),
110
+ }),
111
+ z.strictObject({
112
+ kind: z.literal("google_ads"),
113
+ id: tagId("google_ads"),
114
+ event: z.null(),
115
+ }),
116
+ ]);
117
+ export const tagSightingReportSchema = z.strictObject({
118
+ /** False when the conversion left before its window closed, or more was sighted than fits. */
119
+ complete: z.boolean(),
120
+ sightings: z.array(tagSightingSchema).max(MAX_TAG_SIGHTINGS),
121
+ /**
122
+ * From 1.2.0, in every report whose window the runtime watched whole: each
123
+ * kind the page requested inside the window whose tag the runtime could
124
+ * not read, once. A report without it could not tell.
125
+ */
126
+ unread: z
127
+ .array(z.enum(tagSightingKinds))
128
+ .max(tagSightingKinds.length)
129
+ .refine((kinds) => new Set(kinds).size === kinds.length, {
130
+ message: "each kind at most once",
131
+ })
132
+ .optional(),
133
+ });
134
+ function hasUnknownNumericVersion(input) {
135
+ return (typeof input === "object" &&
136
+ input !== null &&
137
+ "v" in input &&
138
+ typeof input.v === "number" &&
139
+ input.v !== EVENT_ENVELOPE_VERSION);
140
+ }
141
+ export function validateEventBatch(input, clock) {
142
+ const bodyBytes = serializedByteLength(input);
143
+ if (bodyBytes !== undefined && bodyBytes > MAX_BATCH_BYTES) {
144
+ return { accepted: false, classification: "too_large" };
145
+ }
146
+ if (hasUnknownNumericVersion(input)) {
147
+ return { accepted: false, classification: "unknown_version" };
148
+ }
149
+ const parsed = eventBatchSchema.safeParse(input);
150
+ if (!parsed.success) {
151
+ return { accepted: false, classification: "invalid_schema" };
152
+ }
153
+ const now = clock.now().getTime();
154
+ const flags = [];
155
+ for (const event of parsed.data.events) {
156
+ const occurredAt = new Date(event.occurredAt).getTime();
157
+ if (occurredAt > now + FUTURE_TOLERANCE_MS) {
158
+ return { accepted: false, classification: "future_time" };
159
+ }
160
+ if (occurredAt < now - LATE_AFTER_MS) {
161
+ flags.push({ classification: "late", eventId: event.eventId });
162
+ }
163
+ }
164
+ return { accepted: true, batch: parsed.data, flags };
165
+ }
166
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,GAEjB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC;AAEtC,SAAS,cAAc,CAAC,KAAa;IACnC,OAAO,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC;A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C,MAAM,KAAK,GAAoB,EAAE,CAAC;IAElC,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACvC,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,CAAC;QACxD,IAAI,UAAU,GAAG,GAAG,GAAG,mBAAmB,EAAE,CAAC;YAC3C,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC;QAC5D,CAAC;QAED,IAAI,UAAU,GAAG,GAAG,GAAG,aAAa,EAAE,CAAC;YACrC,KAAK,CAAC,IAAI,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;AACvD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tracelog/event-contract",
3
- "version": "1.3.1",
3
+ "version": "2.0.1",
4
4
  "description": "The TraceLog event envelope: one definition of the wire format, its limits and its schemas.",
5
5
  "keywords": [
6
6
  "conversion",