@reopt-ai/data-contract 0.5.0 → 0.6.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.
Files changed (73) hide show
  1. package/dist/{chunk-2LZBZXBF.js → chunk-33BCA2LH.js} +1 -15
  2. package/dist/chunk-33BCA2LH.js.map +1 -0
  3. package/dist/chunk-3EEANNYN.cjs +62 -0
  4. package/dist/chunk-3EEANNYN.cjs.map +1 -0
  5. package/dist/{chunk-MFZEIH5Z.js → chunk-EZ2TA4S6.js} +31 -6
  6. package/dist/chunk-EZ2TA4S6.js.map +1 -0
  7. package/dist/chunk-FP2X3PRK.js +62 -0
  8. package/dist/chunk-FP2X3PRK.js.map +1 -0
  9. package/dist/{chunk-VQ2CD5MG.cjs → chunk-FUGY5ANJ.cjs} +13 -13
  10. package/dist/{chunk-VQ2CD5MG.cjs.map → chunk-FUGY5ANJ.cjs.map} +1 -1
  11. package/dist/chunk-GCQZNME3.js +153 -0
  12. package/dist/chunk-GCQZNME3.js.map +1 -0
  13. package/dist/chunk-HLQAZ6JW.js +19 -0
  14. package/dist/chunk-HLQAZ6JW.js.map +1 -0
  15. package/dist/{chunk-AHXPQQKO.js → chunk-IY4MXH35.js} +3 -3
  16. package/dist/chunk-JB4MJQX7.cjs +19 -0
  17. package/dist/chunk-JB4MJQX7.cjs.map +1 -0
  18. package/dist/{chunk-BCGR27G2.js → chunk-L3WJGIKD.js} +2 -2
  19. package/dist/{chunk-4B4AY44F.cjs → chunk-LA5F5KR6.cjs} +6 -6
  20. package/dist/{chunk-4B4AY44F.cjs.map → chunk-LA5F5KR6.cjs.map} +1 -1
  21. package/dist/chunk-PHPTCLRU.cjs +153 -0
  22. package/dist/chunk-PHPTCLRU.cjs.map +1 -0
  23. package/dist/{chunk-XI3VP5DN.cjs → chunk-VGB2VJO4.cjs} +34 -9
  24. package/dist/chunk-VGB2VJO4.cjs.map +1 -0
  25. package/dist/{chunk-OLSMH4RY.cjs → chunk-YSAEOYPD.cjs} +2 -16
  26. package/dist/chunk-YSAEOYPD.cjs.map +1 -0
  27. package/dist/client.cjs +53 -49
  28. package/dist/client.cjs.map +1 -1
  29. package/dist/client.d.cts +2 -0
  30. package/dist/client.d.ts +2 -0
  31. package/dist/client.js +9 -5
  32. package/dist/client.js.map +1 -1
  33. package/dist/control.cjs +5 -4
  34. package/dist/control.cjs.map +1 -1
  35. package/dist/control.d.cts +6 -6
  36. package/dist/control.d.ts +6 -6
  37. package/dist/control.js +4 -3
  38. package/dist/events.cjs +17 -0
  39. package/dist/events.cjs.map +1 -0
  40. package/dist/events.d.cts +59 -0
  41. package/dist/events.d.ts +59 -0
  42. package/dist/events.js +17 -0
  43. package/dist/events.js.map +1 -0
  44. package/dist/identity.cjs +57 -0
  45. package/dist/identity.cjs.map +1 -0
  46. package/dist/identity.d.cts +119 -0
  47. package/dist/identity.d.ts +119 -0
  48. package/dist/identity.js +57 -0
  49. package/dist/identity.js.map +1 -0
  50. package/dist/index.cjs +4 -2
  51. package/dist/index.cjs.map +1 -1
  52. package/dist/index.d.cts +5 -15
  53. package/dist/index.d.ts +5 -15
  54. package/dist/index.js +7 -5
  55. package/dist/ingest.cjs +18 -2
  56. package/dist/ingest.cjs.map +1 -1
  57. package/dist/ingest.d.cts +39 -9
  58. package/dist/ingest.d.ts +39 -9
  59. package/dist/ingest.js +18 -2
  60. package/dist/query.cjs +4 -3
  61. package/dist/query.cjs.map +1 -1
  62. package/dist/query.d.cts +17 -16
  63. package/dist/query.d.ts +17 -16
  64. package/dist/query.js +3 -2
  65. package/dist/version-BzeRTpta.d.cts +26 -0
  66. package/dist/version-BzeRTpta.d.ts +26 -0
  67. package/package.json +13 -2
  68. package/dist/chunk-2LZBZXBF.js.map +0 -1
  69. package/dist/chunk-MFZEIH5Z.js.map +0 -1
  70. package/dist/chunk-OLSMH4RY.cjs.map +0 -1
  71. package/dist/chunk-XI3VP5DN.cjs.map +0 -1
  72. /package/dist/{chunk-AHXPQQKO.js.map → chunk-IY4MXH35.js.map} +0 -0
  73. /package/dist/{chunk-BCGR27G2.js.map → chunk-L3WJGIKD.js.map} +0 -0
@@ -0,0 +1,119 @@
1
+ export { C as CLIENT_ID_HEADER, a as CLIENT_SECRET_HEADER, b as CONTRACT_VERSION, c as CONTRACT_VERSION_HEADER, D as DEVICE_ID_HEADER, R as REQUEST_ID_HEADER, W as WRITE_KEY_HEADER } from './version-BzeRTpta.js';
2
+
3
+ /**
4
+ * Request header carrying the browser's current session id. The browser SDK
5
+ * adds it to same-origin requests so a server-side `track()` can land in the
6
+ * session the user is actually in; the server SDK forwards it to ingest.
7
+ *
8
+ * Ingest treats it as a *hint*, never as authority — a browser can put any
9
+ * value here.
10
+ */
11
+ declare const SESSION_ID_HEADER = "reopt-session-id";
12
+ /** Every request header the identity protocol may carry, for CORS allow-lists. */
13
+ declare const IDENTITY_REQUEST_HEADERS: readonly ["reopt-device-id", "reopt-session-id"];
14
+ /**
15
+ * 400 days — the longest lifetime Chrome will honour. Anything longer is
16
+ * silently clamped to this, so asking for more only hides the real expiry.
17
+ */
18
+ declare const COOKIE_MAX_AGE_SECONDS: number;
19
+ /** Consent category whose refusal means "send nothing at all". */
20
+ declare const OPT_OUT_CONSENT_CATEGORY = "analytics";
21
+ /** `reopt_<writeKey>_device` — device id plus session/profile hints. */
22
+ declare function deviceCookieName(writeKey: string): string;
23
+ /** `reopt_<writeKey>_consent` — per-category consent decisions. */
24
+ declare function consentCookieName(writeKey: string): string;
25
+ /** Everything the device cookie may carry. Only `deviceId` is required. */
26
+ interface DeviceCookieState {
27
+ deviceId: string;
28
+ /** Current session, if the browser has one. */
29
+ sessionId?: string;
30
+ /** Last identified profile. A hint for the server SDK, never trusted by ingest. */
31
+ profileId?: string;
32
+ }
33
+ /** Per-category consent. `false` withdraws, `true` grants, absent = undecided. */
34
+ type ConsentCookieState = Record<string, boolean>;
35
+ /**
36
+ * What the server hands the browser SDK so the first render already agrees
37
+ * with the server about who the visitor is. Plain JSON — it crosses the
38
+ * RSC → client component boundary as a prop.
39
+ */
40
+ interface ReoptBootstrap {
41
+ /** From the device cookie (seeded by the proxy on first visit). */
42
+ deviceId: string;
43
+ /** Session hint, or `null` when the browser has not started one. */
44
+ sessionId: string | null;
45
+ /** Result of the server's `getProfileId` resolver, or `null`. */
46
+ profileId: string | null;
47
+ consent: ConsentCookieState;
48
+ /** Server clock at render time, so a skewed device clock can be corrected. */
49
+ serverTimeMs: number;
50
+ }
51
+ /**
52
+ * Ids are opaque, but a cookie is attacker-controlled input (a sibling
53
+ * subdomain can set one). The value ends up in an HTTP header, and
54
+ * `Headers.set` throws on anything outside ISO-8859-1 — so a single odd
55
+ * cookie would break every `fetch` the tracing patch touches. Only the URL
56
+ * "unreserved" set is accepted; every id this SDK mints is a UUID.
57
+ */
58
+ declare const IDENTITY_ID_PATTERN: RegExp;
59
+ declare function isValidIdentityId(value: unknown): value is string;
60
+ /**
61
+ * Reads a device cookie value. Accepts the JSON envelope written by
62
+ * `serializeDeviceCookie` and, for cookies seeded before the envelope existed,
63
+ * a bare device id. Returns `null` for anything else — a malformed cookie is
64
+ * treated as absent, never as an error, so a corrupted value cannot take the
65
+ * page down.
66
+ */
67
+ declare function parseDeviceCookie(raw: string | null | undefined): DeviceCookieState | null;
68
+ /**
69
+ * Cookie values may not contain `;`, `,` or whitespace, and JSON contains
70
+ * quotes and commas. The envelope is therefore URI-encoded; `parseDeviceCookie`
71
+ * reverses it. Optional fields are omitted rather than written as `null` so
72
+ * the cookie stays as small as the state it carries.
73
+ */
74
+ declare function serializeDeviceCookie(state: DeviceCookieState): string;
75
+ /**
76
+ * Reads a consent cookie. Only boolean entries survive; anything else in the
77
+ * object is dropped rather than failing the whole cookie, because one odd key
78
+ * must not erase a user's recorded opt-out.
79
+ */
80
+ declare function parseConsentCookie(raw: string | null | undefined): ConsentCookieState | null;
81
+ declare function serializeConsentCookie(state: ConsentCookieState): string;
82
+ /**
83
+ * "Opted out" means the visitor refused the `analytics` category. An absent
84
+ * cookie or an undecided category is *not* an opt-out — it is the default
85
+ * state of every first visit, and treating it as refusal would make consent
86
+ * banners mandatory for every integration.
87
+ */
88
+ declare function isOptedOut(consent: ConsentCookieState | null | undefined): boolean;
89
+ /**
90
+ * Sessions are assigned by ingest, not by the browser. To let a later request
91
+ * — from the same browser, or from a server acting for it — join that session
92
+ * with authority, ingest hands the browser its session id together with an
93
+ * HMAC over it, and the browser sends both back as `reopt-session-id`. An
94
+ * unsigned or wrongly signed value is a hint at most: ingest falls back to
95
+ * deciding the session from the device, exactly as if the header were absent.
96
+ *
97
+ * The token is `base64url(HMAC-SHA256(secret, sessionId))`. The secret is
98
+ * per project and never leaves the server. WebCrypto only, so this runs in
99
+ * browsers, edge runtimes and Node alike.
100
+ */
101
+ declare const SESSION_HEADER_SEPARATOR = ".";
102
+ interface SessionCredential {
103
+ id: string;
104
+ token: string;
105
+ }
106
+ /** `<id>.<token>` — what travels in `reopt-session-id`. */
107
+ declare function formatSessionHeader(credential: SessionCredential): string;
108
+ /** Splits a `reopt-session-id` value. `null` unless both parts are well-formed. */
109
+ declare function parseSessionHeader(value: string | null | undefined): SessionCredential | null;
110
+ /** Issues the token for `sessionId`. Server-side only — needs the project secret. */
111
+ declare function signSessionToken(secret: string, sessionId: string): Promise<string>;
112
+ /**
113
+ * Constant-time check of a presented token. Recomputes and compares the
114
+ * digests byte by byte rather than using `subtle.verify` with a decoded
115
+ * token, so a malformed token can never throw its way past the check.
116
+ */
117
+ declare function verifySessionToken(secret: string, credential: SessionCredential): Promise<boolean>;
118
+
119
+ export { COOKIE_MAX_AGE_SECONDS, type ConsentCookieState, type DeviceCookieState, IDENTITY_ID_PATTERN, IDENTITY_REQUEST_HEADERS, OPT_OUT_CONSENT_CATEGORY, type ReoptBootstrap, SESSION_HEADER_SEPARATOR, SESSION_ID_HEADER, type SessionCredential, consentCookieName, deviceCookieName, formatSessionHeader, isOptedOut, isValidIdentityId, parseConsentCookie, parseDeviceCookie, parseSessionHeader, serializeConsentCookie, serializeDeviceCookie, signSessionToken, verifySessionToken };
@@ -0,0 +1,57 @@
1
+ import {
2
+ COOKIE_MAX_AGE_SECONDS,
3
+ IDENTITY_ID_PATTERN,
4
+ IDENTITY_REQUEST_HEADERS,
5
+ OPT_OUT_CONSENT_CATEGORY,
6
+ SESSION_HEADER_SEPARATOR,
7
+ SESSION_ID_HEADER,
8
+ consentCookieName,
9
+ deviceCookieName,
10
+ formatSessionHeader,
11
+ isOptedOut,
12
+ isValidIdentityId,
13
+ parseConsentCookie,
14
+ parseDeviceCookie,
15
+ parseSessionHeader,
16
+ serializeConsentCookie,
17
+ serializeDeviceCookie,
18
+ signSessionToken,
19
+ verifySessionToken
20
+ } from "./chunk-GCQZNME3.js";
21
+ import {
22
+ CLIENT_ID_HEADER,
23
+ CLIENT_SECRET_HEADER,
24
+ CONTRACT_VERSION,
25
+ CONTRACT_VERSION_HEADER,
26
+ DEVICE_ID_HEADER,
27
+ REQUEST_ID_HEADER,
28
+ WRITE_KEY_HEADER
29
+ } from "./chunk-HLQAZ6JW.js";
30
+ export {
31
+ CLIENT_ID_HEADER,
32
+ CLIENT_SECRET_HEADER,
33
+ CONTRACT_VERSION,
34
+ CONTRACT_VERSION_HEADER,
35
+ COOKIE_MAX_AGE_SECONDS,
36
+ DEVICE_ID_HEADER,
37
+ IDENTITY_ID_PATTERN,
38
+ IDENTITY_REQUEST_HEADERS,
39
+ OPT_OUT_CONSENT_CATEGORY,
40
+ REQUEST_ID_HEADER,
41
+ SESSION_HEADER_SEPARATOR,
42
+ SESSION_ID_HEADER,
43
+ WRITE_KEY_HEADER,
44
+ consentCookieName,
45
+ deviceCookieName,
46
+ formatSessionHeader,
47
+ isOptedOut,
48
+ isValidIdentityId,
49
+ parseConsentCookie,
50
+ parseDeviceCookie,
51
+ parseSessionHeader,
52
+ serializeConsentCookie,
53
+ serializeDeviceCookie,
54
+ signSessionToken,
55
+ verifySessionToken
56
+ };
57
+ //# sourceMappingURL=identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/dist/index.cjs CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
 
4
4
 
5
+ var _chunkYSAEOYPDcjs = require('./chunk-YSAEOYPD.cjs');
5
6
 
6
7
 
7
8
 
@@ -9,8 +10,8 @@
9
10
 
10
11
 
11
12
 
12
- var _chunkOLSMH4RYcjs = require('./chunk-OLSMH4RY.cjs');
13
13
 
14
+ var _chunkJB4MJQX7cjs = require('./chunk-JB4MJQX7.cjs');
14
15
 
15
16
 
16
17
 
@@ -21,5 +22,6 @@ var _chunkOLSMH4RYcjs = require('./chunk-OLSMH4RY.cjs');
21
22
 
22
23
 
23
24
 
24
- exports.CLIENT_ID_HEADER = _chunkOLSMH4RYcjs.CLIENT_ID_HEADER; exports.CLIENT_SECRET_HEADER = _chunkOLSMH4RYcjs.CLIENT_SECRET_HEADER; exports.CONTRACT_VERSION = _chunkOLSMH4RYcjs.CONTRACT_VERSION; exports.CONTRACT_VERSION_HEADER = _chunkOLSMH4RYcjs.CONTRACT_VERSION_HEADER; exports.DEVICE_ID_HEADER = _chunkOLSMH4RYcjs.DEVICE_ID_HEADER; exports.DataApiError = _chunkOLSMH4RYcjs.DataApiError; exports.REQUEST_ID_HEADER = _chunkOLSMH4RYcjs.REQUEST_ID_HEADER; exports.WRITE_KEY_HEADER = _chunkOLSMH4RYcjs.WRITE_KEY_HEADER; exports.zDate = _chunkOLSMH4RYcjs.zDate; exports.zInstant = _chunkOLSMH4RYcjs.zInstant;
25
+
26
+ exports.CLIENT_ID_HEADER = _chunkJB4MJQX7cjs.CLIENT_ID_HEADER; exports.CLIENT_SECRET_HEADER = _chunkJB4MJQX7cjs.CLIENT_SECRET_HEADER; exports.CONTRACT_VERSION = _chunkJB4MJQX7cjs.CONTRACT_VERSION; exports.CONTRACT_VERSION_HEADER = _chunkJB4MJQX7cjs.CONTRACT_VERSION_HEADER; exports.DEVICE_ID_HEADER = _chunkJB4MJQX7cjs.DEVICE_ID_HEADER; exports.DataApiError = _chunkYSAEOYPDcjs.DataApiError; exports.REQUEST_ID_HEADER = _chunkJB4MJQX7cjs.REQUEST_ID_HEADER; exports.WRITE_KEY_HEADER = _chunkJB4MJQX7cjs.WRITE_KEY_HEADER; exports.zDate = _chunkYSAEOYPDcjs.zDate; exports.zInstant = _chunkYSAEOYPDcjs.zInstant;
25
27
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/eric/reopt-ai/reopt-data/packages/data-contract/dist/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,+lBAAC","file":"/Users/eric/reopt-ai/reopt-data/packages/data-contract/dist/index.cjs"}
1
+ {"version":3,"sources":["/Users/eric/reopt-ai/reopt-data/packages/data-contract/dist/index.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,+lBAAC","file":"/Users/eric/reopt-ai/reopt-data/packages/data-contract/dist/index.cjs"}
package/dist/index.d.cts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ export { C as CLIENT_ID_HEADER, a as CLIENT_SECRET_HEADER, b as CONTRACT_VERSION, c as CONTRACT_VERSION_HEADER, D as DEVICE_ID_HEADER, R as REQUEST_ID_HEADER, W as WRITE_KEY_HEADER } from './version-BzeRTpta.cjs';
2
3
 
3
4
  /**
4
5
  * `@reopt-ai/data-contract` — the wire contract between reopt-data and its
@@ -10,25 +11,14 @@ import { z } from 'zod';
10
11
  * `@reopt-ai/data-contract/query` POST /api/v1/query/* request + response schemas
11
12
  * `@reopt-ai/data-contract/control` provisioning request + response schemas
12
13
  * `@reopt-ai/data-contract/client` createDataClient() — typed fetch over all
14
+ * `@reopt-ai/data-contract/events` event names + property keys (no zod)
15
+ * `@reopt-ai/data-contract/identity` cookie/header names and encodings shared by
16
+ * the SDKs, the Next.js proxy and ingest
13
17
  *
14
18
  * Only `/client` touches `fetch`; everything else is pure zod. The single
15
19
  * runtime dependency is zod, deliberately — consumers bundle this.
16
20
  */
17
21
 
18
- /**
19
- * Contract version. Bumped on any breaking change to a schema in this package.
20
- * The server echoes the version it was built against in `x-reopt-contract-version`;
21
- * `createDataClient` surfaces a mismatch rather than guessing.
22
- */
23
- declare const CONTRACT_VERSION = "0.5.0";
24
- /** Response header carrying the server's contract version. */
25
- declare const CONTRACT_VERSION_HEADER = "x-reopt-contract-version";
26
- /** Request header names shared by the ingest and query planes. */
27
- declare const CLIENT_ID_HEADER = "reopt-client-id";
28
- declare const CLIENT_SECRET_HEADER = "reopt-client-secret";
29
- declare const WRITE_KEY_HEADER = "reopt-write-key";
30
- declare const DEVICE_ID_HEADER = "reopt-device-id";
31
- declare const REQUEST_ID_HEADER = "x-request-id";
32
22
  /**
33
23
  * A real calendar date. The query's resolved IANA zone decides which instants
34
24
  * its inclusive day covers.
@@ -92,4 +82,4 @@ declare class DataApiError extends Error {
92
82
  static is(value: unknown): value is DataApiError;
93
83
  }
94
84
 
95
- export { CLIENT_ID_HEADER, CLIENT_SECRET_HEADER, CONTRACT_VERSION, CONTRACT_VERSION_HEADER, type ClientCredentials, DEVICE_ID_HEADER, DataApiError, type OptionalClientCredentials, REQUEST_ID_HEADER, WRITE_KEY_HEADER, zDate, zInstant };
85
+ export { type ClientCredentials, DataApiError, type OptionalClientCredentials, zDate, zInstant };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ export { C as CLIENT_ID_HEADER, a as CLIENT_SECRET_HEADER, b as CONTRACT_VERSION, c as CONTRACT_VERSION_HEADER, D as DEVICE_ID_HEADER, R as REQUEST_ID_HEADER, W as WRITE_KEY_HEADER } from './version-BzeRTpta.js';
2
3
 
3
4
  /**
4
5
  * `@reopt-ai/data-contract` — the wire contract between reopt-data and its
@@ -10,25 +11,14 @@ import { z } from 'zod';
10
11
  * `@reopt-ai/data-contract/query` POST /api/v1/query/* request + response schemas
11
12
  * `@reopt-ai/data-contract/control` provisioning request + response schemas
12
13
  * `@reopt-ai/data-contract/client` createDataClient() — typed fetch over all
14
+ * `@reopt-ai/data-contract/events` event names + property keys (no zod)
15
+ * `@reopt-ai/data-contract/identity` cookie/header names and encodings shared by
16
+ * the SDKs, the Next.js proxy and ingest
13
17
  *
14
18
  * Only `/client` touches `fetch`; everything else is pure zod. The single
15
19
  * runtime dependency is zod, deliberately — consumers bundle this.
16
20
  */
17
21
 
18
- /**
19
- * Contract version. Bumped on any breaking change to a schema in this package.
20
- * The server echoes the version it was built against in `x-reopt-contract-version`;
21
- * `createDataClient` surfaces a mismatch rather than guessing.
22
- */
23
- declare const CONTRACT_VERSION = "0.5.0";
24
- /** Response header carrying the server's contract version. */
25
- declare const CONTRACT_VERSION_HEADER = "x-reopt-contract-version";
26
- /** Request header names shared by the ingest and query planes. */
27
- declare const CLIENT_ID_HEADER = "reopt-client-id";
28
- declare const CLIENT_SECRET_HEADER = "reopt-client-secret";
29
- declare const WRITE_KEY_HEADER = "reopt-write-key";
30
- declare const DEVICE_ID_HEADER = "reopt-device-id";
31
- declare const REQUEST_ID_HEADER = "x-request-id";
32
22
  /**
33
23
  * A real calendar date. The query's resolved IANA zone decides which instants
34
24
  * its inclusive day covers.
@@ -92,4 +82,4 @@ declare class DataApiError extends Error {
92
82
  static is(value: unknown): value is DataApiError;
93
83
  }
94
84
 
95
- export { CLIENT_ID_HEADER, CLIENT_SECRET_HEADER, CONTRACT_VERSION, CONTRACT_VERSION_HEADER, type ClientCredentials, DEVICE_ID_HEADER, DataApiError, type OptionalClientCredentials, REQUEST_ID_HEADER, WRITE_KEY_HEADER, zDate, zInstant };
85
+ export { type ClientCredentials, DataApiError, type OptionalClientCredentials, zDate, zInstant };
package/dist/index.js CHANGED
@@ -1,15 +1,17 @@
1
+ import {
2
+ DataApiError,
3
+ zDate,
4
+ zInstant
5
+ } from "./chunk-33BCA2LH.js";
1
6
  import {
2
7
  CLIENT_ID_HEADER,
3
8
  CLIENT_SECRET_HEADER,
4
9
  CONTRACT_VERSION,
5
10
  CONTRACT_VERSION_HEADER,
6
11
  DEVICE_ID_HEADER,
7
- DataApiError,
8
12
  REQUEST_ID_HEADER,
9
- WRITE_KEY_HEADER,
10
- zDate,
11
- zInstant
12
- } from "./chunk-2LZBZXBF.js";
13
+ WRITE_KEY_HEADER
14
+ } from "./chunk-HLQAZ6JW.js";
13
15
  export {
14
16
  CLIENT_ID_HEADER,
15
17
  CLIENT_SECRET_HEADER,
package/dist/ingest.cjs CHANGED
@@ -18,7 +18,9 @@
18
18
 
19
19
 
20
20
 
21
- var _chunkXI3VP5DNcjs = require('./chunk-XI3VP5DN.cjs');
21
+ var _chunkVGB2VJO4cjs = require('./chunk-VGB2VJO4.cjs');
22
+ require('./chunk-PHPTCLRU.cjs');
23
+ require('./chunk-JB4MJQX7.cjs');
22
24
 
23
25
 
24
26
 
@@ -26,6 +28,7 @@ var _chunkXI3VP5DNcjs = require('./chunk-XI3VP5DN.cjs');
26
28
 
27
29
 
28
30
 
31
+ var _chunk3EEANNYNcjs = require('./chunk-3EEANNYN.cjs');
29
32
 
30
33
 
31
34
 
@@ -39,5 +42,18 @@ var _chunkXI3VP5DNcjs = require('./chunk-XI3VP5DN.cjs');
39
42
 
40
43
 
41
44
 
42
- exports.INGEST_ERROR_CODES = _chunkXI3VP5DNcjs.INGEST_ERROR_CODES; exports.INGEST_MODES = _chunkXI3VP5DNcjs.INGEST_MODES; exports.INGEST_REJECTION_REASONS = _chunkXI3VP5DNcjs.INGEST_REJECTION_REASONS; exports.MAX_TRACK_PAYLOAD_BYTES = _chunkXI3VP5DNcjs.MAX_TRACK_PAYLOAD_BYTES; exports.RESERVED_EVENT_NAMES = _chunkXI3VP5DNcjs.RESERVED_EVENT_NAMES; exports.reconcileIngestResponse = _chunkXI3VP5DNcjs.reconcileIngestResponse; exports.zDecrementPayload = _chunkXI3VP5DNcjs.zDecrementPayload; exports.zIdentifyPayload = _chunkXI3VP5DNcjs.zIdentifyPayload; exports.zIncrementPayload = _chunkXI3VP5DNcjs.zIncrementPayload; exports.zIngestAcceptedResponse = _chunkXI3VP5DNcjs.zIngestAcceptedResponse; exports.zIngestError = _chunkXI3VP5DNcjs.zIngestError; exports.zIngestErrorCode = _chunkXI3VP5DNcjs.zIngestErrorCode; exports.zIngestMode = _chunkXI3VP5DNcjs.zIngestMode; exports.zIngestOkResponse = _chunkXI3VP5DNcjs.zIngestOkResponse; exports.zIngestRejection = _chunkXI3VP5DNcjs.zIngestRejection; exports.zIngestRejectionReason = _chunkXI3VP5DNcjs.zIngestRejectionReason; exports.zIngestResponse = _chunkXI3VP5DNcjs.zIngestResponse; exports.zTrackHandlerPayload = _chunkXI3VP5DNcjs.zTrackHandlerPayload; exports.zTrackPayload = _chunkXI3VP5DNcjs.zTrackPayload;
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+ exports.AUTO_EVENT_NAMES = _chunk3EEANNYNcjs.AUTO_EVENT_NAMES; exports.AUTO_EVENT_PROPERTIES = _chunk3EEANNYNcjs.AUTO_EVENT_PROPERTIES; exports.AUTO_EVENT_ROLLUP_KEYS = _chunk3EEANNYNcjs.AUTO_EVENT_ROLLUP_KEYS; exports.INGEST_ERROR_CODES = _chunkVGB2VJO4cjs.INGEST_ERROR_CODES; exports.INGEST_MODES = _chunkVGB2VJO4cjs.INGEST_MODES; exports.INGEST_REJECTION_REASONS = _chunkVGB2VJO4cjs.INGEST_REJECTION_REASONS; exports.MAX_TRACK_PAYLOAD_BYTES = _chunkVGB2VJO4cjs.MAX_TRACK_PAYLOAD_BYTES; exports.RESERVED_EVENT_NAMES = _chunk3EEANNYNcjs.RESERVED_EVENT_NAMES; exports.SCROLL_DEPTH_BUCKETS = _chunk3EEANNYNcjs.SCROLL_DEPTH_BUCKETS; exports.reconcileIngestResponse = _chunkVGB2VJO4cjs.reconcileIngestResponse; exports.scrollDepthBucket = _chunk3EEANNYNcjs.scrollDepthBucket; exports.zDecrementPayload = _chunkVGB2VJO4cjs.zDecrementPayload; exports.zIdentifyPayload = _chunkVGB2VJO4cjs.zIdentifyPayload; exports.zIncrementPayload = _chunkVGB2VJO4cjs.zIncrementPayload; exports.zIngestAcceptedResponse = _chunkVGB2VJO4cjs.zIngestAcceptedResponse; exports.zIngestError = _chunkVGB2VJO4cjs.zIngestError; exports.zIngestErrorCode = _chunkVGB2VJO4cjs.zIngestErrorCode; exports.zIngestMode = _chunkVGB2VJO4cjs.zIngestMode; exports.zIngestOkResponse = _chunkVGB2VJO4cjs.zIngestOkResponse; exports.zIngestRejection = _chunkVGB2VJO4cjs.zIngestRejection; exports.zIngestRejectionReason = _chunkVGB2VJO4cjs.zIngestRejectionReason; exports.zIngestResponse = _chunkVGB2VJO4cjs.zIngestResponse; exports.zSessionCredential = _chunkVGB2VJO4cjs.zSessionCredential; exports.zTrackHandlerPayload = _chunkVGB2VJO4cjs.zTrackHandlerPayload; exports.zTrackPayload = _chunkVGB2VJO4cjs.zTrackPayload;
43
59
  //# sourceMappingURL=ingest.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/eric/reopt-ai/reopt-data/packages/data-contract/dist/ingest.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,0uCAAC","file":"/Users/eric/reopt-ai/reopt-data/packages/data-contract/dist/ingest.cjs"}
1
+ {"version":3,"sources":["/Users/eric/reopt-ai/reopt-data/packages/data-contract/dist/ingest.cjs"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,woDAAC","file":"/Users/eric/reopt-ai/reopt-data/packages/data-contract/dist/ingest.cjs"}
package/dist/ingest.d.cts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ export { AUTO_EVENT_NAMES, AUTO_EVENT_PROPERTIES, AUTO_EVENT_ROLLUP_KEYS, AutoEventName, RESERVED_EVENT_NAMES, SCROLL_DEPTH_BUCKETS, ScrollDepthBucket, scrollDepthBucket } from './events.cjs';
2
3
 
3
4
  /**
4
5
  * `POST /api/track` — the ingest contract.
@@ -12,8 +13,6 @@ import { z } from 'zod';
12
13
  * now a deprecated re-export of this module.
13
14
  */
14
15
 
15
- /** Event names the pipeline reserves for its own session bookkeeping. */
16
- declare const RESERVED_EVENT_NAMES: readonly ["session_start", "session_end", "screen_view"];
17
16
  /** Hard cap enforced by the route before the body is even parsed. */
18
17
  declare const MAX_TRACK_PAYLOAD_BYTES = 512000;
19
18
  declare const zTrackPayload: z.ZodObject<{
@@ -42,6 +41,7 @@ declare const zDecrementPayload: z.ZodObject<{
42
41
  declare const zTrackHandlerPayload: z.ZodDiscriminatedUnion<[z.ZodObject<{
43
42
  eventId: z.ZodUUID;
44
43
  timestamp: z.ZodNumber;
44
+ deviceId: z.ZodOptional<z.ZodString>;
45
45
  type: z.ZodLiteral<"track">;
46
46
  payload: z.ZodObject<{
47
47
  name: z.ZodString;
@@ -51,6 +51,7 @@ declare const zTrackHandlerPayload: z.ZodDiscriminatedUnion<[z.ZodObject<{
51
51
  }, z.core.$strip>, z.ZodObject<{
52
52
  eventId: z.ZodUUID;
53
53
  timestamp: z.ZodNumber;
54
+ deviceId: z.ZodOptional<z.ZodString>;
54
55
  type: z.ZodLiteral<"identify">;
55
56
  payload: z.ZodObject<{
56
57
  profileId: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
@@ -63,6 +64,7 @@ declare const zTrackHandlerPayload: z.ZodDiscriminatedUnion<[z.ZodObject<{
63
64
  }, z.core.$strip>, z.ZodObject<{
64
65
  eventId: z.ZodUUID;
65
66
  timestamp: z.ZodNumber;
67
+ deviceId: z.ZodOptional<z.ZodString>;
66
68
  type: z.ZodLiteral<"increment">;
67
69
  payload: z.ZodObject<{
68
70
  profileId: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
@@ -72,6 +74,7 @@ declare const zTrackHandlerPayload: z.ZodDiscriminatedUnion<[z.ZodObject<{
72
74
  }, z.core.$strip>, z.ZodObject<{
73
75
  eventId: z.ZodUUID;
74
76
  timestamp: z.ZodNumber;
77
+ deviceId: z.ZodOptional<z.ZodString>;
75
78
  type: z.ZodLiteral<"decrement">;
76
79
  payload: z.ZodObject<{
77
80
  profileId: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
@@ -124,9 +127,24 @@ declare const zIngestRejection: z.ZodObject<{
124
127
  message: z.ZodOptional<z.ZodString>;
125
128
  }, z.core.$strip>;
126
129
  type IngestRejection = z.infer<typeof zIngestRejection>;
130
+ /**
131
+ * The session ingest filed this batch under, with the token that lets the
132
+ * browser (or a server acting for it) join the same session later with
133
+ * authority — see `signSessionToken` in `./identity`. Browser mode only;
134
+ * absent when the batch carried no sessionable event.
135
+ */
136
+ declare const zSessionCredential: z.ZodObject<{
137
+ id: z.ZodString;
138
+ token: z.ZodString;
139
+ }, z.core.$strip>;
140
+ type SessionCredential = z.infer<typeof zSessionCredential>;
127
141
  /** 200 — accepted and handed to the materialize queue. */
128
142
  declare const zIngestOkResponse: z.ZodObject<{
129
143
  queued: z.ZodBoolean;
144
+ session: z.ZodOptional<z.ZodObject<{
145
+ id: z.ZodString;
146
+ token: z.ZodString;
147
+ }, z.core.$strip>>;
130
148
  accepted: z.ZodNumber;
131
149
  duplicates: z.ZodNumber;
132
150
  rejected: z.ZodArray<z.ZodObject<{
@@ -155,6 +173,10 @@ declare const zIngestOkResponse: z.ZodObject<{
155
173
  declare const zIngestAcceptedResponse: z.ZodObject<{
156
174
  backgroundQueued: z.ZodLiteral<false>;
157
175
  replay: z.ZodLiteral<"unmaterialized-raw-events">;
176
+ session: z.ZodOptional<z.ZodObject<{
177
+ id: z.ZodString;
178
+ token: z.ZodString;
179
+ }, z.core.$strip>>;
158
180
  accepted: z.ZodNumber;
159
181
  duplicates: z.ZodNumber;
160
182
  rejected: z.ZodArray<z.ZodObject<{
@@ -176,6 +198,10 @@ declare const zIngestAcceptedResponse: z.ZodObject<{
176
198
  }, z.core.$strip>;
177
199
  declare const zIngestResponse: z.ZodDiscriminatedUnion<[z.ZodObject<{
178
200
  queued: z.ZodBoolean;
201
+ session: z.ZodOptional<z.ZodObject<{
202
+ id: z.ZodString;
203
+ token: z.ZodString;
204
+ }, z.core.$strip>>;
179
205
  accepted: z.ZodNumber;
180
206
  duplicates: z.ZodNumber;
181
207
  rejected: z.ZodArray<z.ZodObject<{
@@ -197,6 +223,10 @@ declare const zIngestResponse: z.ZodDiscriminatedUnion<[z.ZodObject<{
197
223
  }, z.core.$strip>, z.ZodObject<{
198
224
  backgroundQueued: z.ZodLiteral<false>;
199
225
  replay: z.ZodLiteral<"unmaterialized-raw-events">;
226
+ session: z.ZodOptional<z.ZodObject<{
227
+ id: z.ZodString;
228
+ token: z.ZodString;
229
+ }, z.core.$strip>>;
200
230
  accepted: z.ZodNumber;
201
231
  duplicates: z.ZodNumber;
202
232
  rejected: z.ZodArray<z.ZodObject<{
@@ -234,33 +264,33 @@ declare function reconcileIngestResponse(response: IngestResponse, sentCount: nu
234
264
  */
235
265
  declare const INGEST_ERROR_CODES: readonly ["unauthorized", "invalid_json", "payload_too_large", "empty_batch", "alias_unsupported", "project_without_organization", "validation_failed", "rate_limited", "quota_exceeded", "project_purging", "internal_error"];
236
266
  declare const zIngestErrorCode: z.ZodEnum<{
237
- unauthorized: "unauthorized";
238
267
  validation_failed: "validation_failed";
239
- rate_limited: "rate_limited";
240
- internal_error: "internal_error";
268
+ unauthorized: "unauthorized";
241
269
  invalid_json: "invalid_json";
242
270
  payload_too_large: "payload_too_large";
243
271
  empty_batch: "empty_batch";
244
272
  alias_unsupported: "alias_unsupported";
245
273
  project_without_organization: "project_without_organization";
274
+ rate_limited: "rate_limited";
246
275
  quota_exceeded: "quota_exceeded";
247
276
  project_purging: "project_purging";
277
+ internal_error: "internal_error";
248
278
  }>;
249
279
  type IngestErrorCode = z.infer<typeof zIngestErrorCode>;
250
280
  declare const zIngestError: z.ZodObject<{
251
281
  status: z.ZodNumber;
252
282
  code: z.ZodEnum<{
253
- unauthorized: "unauthorized";
254
283
  validation_failed: "validation_failed";
255
- rate_limited: "rate_limited";
256
- internal_error: "internal_error";
284
+ unauthorized: "unauthorized";
257
285
  invalid_json: "invalid_json";
258
286
  payload_too_large: "payload_too_large";
259
287
  empty_batch: "empty_batch";
260
288
  alias_unsupported: "alias_unsupported";
261
289
  project_without_organization: "project_without_organization";
290
+ rate_limited: "rate_limited";
262
291
  quota_exceeded: "quota_exceeded";
263
292
  project_purging: "project_purging";
293
+ internal_error: "internal_error";
264
294
  }>;
265
295
  error: z.ZodString;
266
296
  message: z.ZodOptional<z.ZodString>;
@@ -269,4 +299,4 @@ declare const zIngestError: z.ZodObject<{
269
299
  }, z.core.$strip>;
270
300
  type IngestError = z.infer<typeof zIngestError>;
271
301
 
272
- export { type IDecrementPayload, type IIdentifyPayload, type IIncrementPayload, INGEST_ERROR_CODES, INGEST_MODES, INGEST_REJECTION_REASONS, type ITrackHandlerPayload, type ITrackPayload, type IngestAcceptedResponse, type IngestError, type IngestErrorCode, type IngestMode, type IngestOkResponse, type IngestRejection, type IngestRejectionReason, type IngestResponse, MAX_TRACK_PAYLOAD_BYTES, RESERVED_EVENT_NAMES, reconcileIngestResponse, zDecrementPayload, zIdentifyPayload, zIncrementPayload, zIngestAcceptedResponse, zIngestError, zIngestErrorCode, zIngestMode, zIngestOkResponse, zIngestRejection, zIngestRejectionReason, zIngestResponse, zTrackHandlerPayload, zTrackPayload };
302
+ export { type IDecrementPayload, type IIdentifyPayload, type IIncrementPayload, INGEST_ERROR_CODES, INGEST_MODES, INGEST_REJECTION_REASONS, type ITrackHandlerPayload, type ITrackPayload, type IngestAcceptedResponse, type IngestError, type IngestErrorCode, type IngestMode, type IngestOkResponse, type IngestRejection, type IngestRejectionReason, type IngestResponse, MAX_TRACK_PAYLOAD_BYTES, type SessionCredential, reconcileIngestResponse, zDecrementPayload, zIdentifyPayload, zIncrementPayload, zIngestAcceptedResponse, zIngestError, zIngestErrorCode, zIngestMode, zIngestOkResponse, zIngestRejection, zIngestRejectionReason, zIngestResponse, zSessionCredential, zTrackHandlerPayload, zTrackPayload };
package/dist/ingest.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ export { AUTO_EVENT_NAMES, AUTO_EVENT_PROPERTIES, AUTO_EVENT_ROLLUP_KEYS, AutoEventName, RESERVED_EVENT_NAMES, SCROLL_DEPTH_BUCKETS, ScrollDepthBucket, scrollDepthBucket } from './events.js';
2
3
 
3
4
  /**
4
5
  * `POST /api/track` — the ingest contract.
@@ -12,8 +13,6 @@ import { z } from 'zod';
12
13
  * now a deprecated re-export of this module.
13
14
  */
14
15
 
15
- /** Event names the pipeline reserves for its own session bookkeeping. */
16
- declare const RESERVED_EVENT_NAMES: readonly ["session_start", "session_end", "screen_view"];
17
16
  /** Hard cap enforced by the route before the body is even parsed. */
18
17
  declare const MAX_TRACK_PAYLOAD_BYTES = 512000;
19
18
  declare const zTrackPayload: z.ZodObject<{
@@ -42,6 +41,7 @@ declare const zDecrementPayload: z.ZodObject<{
42
41
  declare const zTrackHandlerPayload: z.ZodDiscriminatedUnion<[z.ZodObject<{
43
42
  eventId: z.ZodUUID;
44
43
  timestamp: z.ZodNumber;
44
+ deviceId: z.ZodOptional<z.ZodString>;
45
45
  type: z.ZodLiteral<"track">;
46
46
  payload: z.ZodObject<{
47
47
  name: z.ZodString;
@@ -51,6 +51,7 @@ declare const zTrackHandlerPayload: z.ZodDiscriminatedUnion<[z.ZodObject<{
51
51
  }, z.core.$strip>, z.ZodObject<{
52
52
  eventId: z.ZodUUID;
53
53
  timestamp: z.ZodNumber;
54
+ deviceId: z.ZodOptional<z.ZodString>;
54
55
  type: z.ZodLiteral<"identify">;
55
56
  payload: z.ZodObject<{
56
57
  profileId: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
@@ -63,6 +64,7 @@ declare const zTrackHandlerPayload: z.ZodDiscriminatedUnion<[z.ZodObject<{
63
64
  }, z.core.$strip>, z.ZodObject<{
64
65
  eventId: z.ZodUUID;
65
66
  timestamp: z.ZodNumber;
67
+ deviceId: z.ZodOptional<z.ZodString>;
66
68
  type: z.ZodLiteral<"increment">;
67
69
  payload: z.ZodObject<{
68
70
  profileId: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
@@ -72,6 +74,7 @@ declare const zTrackHandlerPayload: z.ZodDiscriminatedUnion<[z.ZodObject<{
72
74
  }, z.core.$strip>, z.ZodObject<{
73
75
  eventId: z.ZodUUID;
74
76
  timestamp: z.ZodNumber;
77
+ deviceId: z.ZodOptional<z.ZodString>;
75
78
  type: z.ZodLiteral<"decrement">;
76
79
  payload: z.ZodObject<{
77
80
  profileId: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
@@ -124,9 +127,24 @@ declare const zIngestRejection: z.ZodObject<{
124
127
  message: z.ZodOptional<z.ZodString>;
125
128
  }, z.core.$strip>;
126
129
  type IngestRejection = z.infer<typeof zIngestRejection>;
130
+ /**
131
+ * The session ingest filed this batch under, with the token that lets the
132
+ * browser (or a server acting for it) join the same session later with
133
+ * authority — see `signSessionToken` in `./identity`. Browser mode only;
134
+ * absent when the batch carried no sessionable event.
135
+ */
136
+ declare const zSessionCredential: z.ZodObject<{
137
+ id: z.ZodString;
138
+ token: z.ZodString;
139
+ }, z.core.$strip>;
140
+ type SessionCredential = z.infer<typeof zSessionCredential>;
127
141
  /** 200 — accepted and handed to the materialize queue. */
128
142
  declare const zIngestOkResponse: z.ZodObject<{
129
143
  queued: z.ZodBoolean;
144
+ session: z.ZodOptional<z.ZodObject<{
145
+ id: z.ZodString;
146
+ token: z.ZodString;
147
+ }, z.core.$strip>>;
130
148
  accepted: z.ZodNumber;
131
149
  duplicates: z.ZodNumber;
132
150
  rejected: z.ZodArray<z.ZodObject<{
@@ -155,6 +173,10 @@ declare const zIngestOkResponse: z.ZodObject<{
155
173
  declare const zIngestAcceptedResponse: z.ZodObject<{
156
174
  backgroundQueued: z.ZodLiteral<false>;
157
175
  replay: z.ZodLiteral<"unmaterialized-raw-events">;
176
+ session: z.ZodOptional<z.ZodObject<{
177
+ id: z.ZodString;
178
+ token: z.ZodString;
179
+ }, z.core.$strip>>;
158
180
  accepted: z.ZodNumber;
159
181
  duplicates: z.ZodNumber;
160
182
  rejected: z.ZodArray<z.ZodObject<{
@@ -176,6 +198,10 @@ declare const zIngestAcceptedResponse: z.ZodObject<{
176
198
  }, z.core.$strip>;
177
199
  declare const zIngestResponse: z.ZodDiscriminatedUnion<[z.ZodObject<{
178
200
  queued: z.ZodBoolean;
201
+ session: z.ZodOptional<z.ZodObject<{
202
+ id: z.ZodString;
203
+ token: z.ZodString;
204
+ }, z.core.$strip>>;
179
205
  accepted: z.ZodNumber;
180
206
  duplicates: z.ZodNumber;
181
207
  rejected: z.ZodArray<z.ZodObject<{
@@ -197,6 +223,10 @@ declare const zIngestResponse: z.ZodDiscriminatedUnion<[z.ZodObject<{
197
223
  }, z.core.$strip>, z.ZodObject<{
198
224
  backgroundQueued: z.ZodLiteral<false>;
199
225
  replay: z.ZodLiteral<"unmaterialized-raw-events">;
226
+ session: z.ZodOptional<z.ZodObject<{
227
+ id: z.ZodString;
228
+ token: z.ZodString;
229
+ }, z.core.$strip>>;
200
230
  accepted: z.ZodNumber;
201
231
  duplicates: z.ZodNumber;
202
232
  rejected: z.ZodArray<z.ZodObject<{
@@ -234,33 +264,33 @@ declare function reconcileIngestResponse(response: IngestResponse, sentCount: nu
234
264
  */
235
265
  declare const INGEST_ERROR_CODES: readonly ["unauthorized", "invalid_json", "payload_too_large", "empty_batch", "alias_unsupported", "project_without_organization", "validation_failed", "rate_limited", "quota_exceeded", "project_purging", "internal_error"];
236
266
  declare const zIngestErrorCode: z.ZodEnum<{
237
- unauthorized: "unauthorized";
238
267
  validation_failed: "validation_failed";
239
- rate_limited: "rate_limited";
240
- internal_error: "internal_error";
268
+ unauthorized: "unauthorized";
241
269
  invalid_json: "invalid_json";
242
270
  payload_too_large: "payload_too_large";
243
271
  empty_batch: "empty_batch";
244
272
  alias_unsupported: "alias_unsupported";
245
273
  project_without_organization: "project_without_organization";
274
+ rate_limited: "rate_limited";
246
275
  quota_exceeded: "quota_exceeded";
247
276
  project_purging: "project_purging";
277
+ internal_error: "internal_error";
248
278
  }>;
249
279
  type IngestErrorCode = z.infer<typeof zIngestErrorCode>;
250
280
  declare const zIngestError: z.ZodObject<{
251
281
  status: z.ZodNumber;
252
282
  code: z.ZodEnum<{
253
- unauthorized: "unauthorized";
254
283
  validation_failed: "validation_failed";
255
- rate_limited: "rate_limited";
256
- internal_error: "internal_error";
284
+ unauthorized: "unauthorized";
257
285
  invalid_json: "invalid_json";
258
286
  payload_too_large: "payload_too_large";
259
287
  empty_batch: "empty_batch";
260
288
  alias_unsupported: "alias_unsupported";
261
289
  project_without_organization: "project_without_organization";
290
+ rate_limited: "rate_limited";
262
291
  quota_exceeded: "quota_exceeded";
263
292
  project_purging: "project_purging";
293
+ internal_error: "internal_error";
264
294
  }>;
265
295
  error: z.ZodString;
266
296
  message: z.ZodOptional<z.ZodString>;
@@ -269,4 +299,4 @@ declare const zIngestError: z.ZodObject<{
269
299
  }, z.core.$strip>;
270
300
  type IngestError = z.infer<typeof zIngestError>;
271
301
 
272
- export { type IDecrementPayload, type IIdentifyPayload, type IIncrementPayload, INGEST_ERROR_CODES, INGEST_MODES, INGEST_REJECTION_REASONS, type ITrackHandlerPayload, type ITrackPayload, type IngestAcceptedResponse, type IngestError, type IngestErrorCode, type IngestMode, type IngestOkResponse, type IngestRejection, type IngestRejectionReason, type IngestResponse, MAX_TRACK_PAYLOAD_BYTES, RESERVED_EVENT_NAMES, reconcileIngestResponse, zDecrementPayload, zIdentifyPayload, zIncrementPayload, zIngestAcceptedResponse, zIngestError, zIngestErrorCode, zIngestMode, zIngestOkResponse, zIngestRejection, zIngestRejectionReason, zIngestResponse, zTrackHandlerPayload, zTrackPayload };
302
+ export { type IDecrementPayload, type IIdentifyPayload, type IIncrementPayload, INGEST_ERROR_CODES, INGEST_MODES, INGEST_REJECTION_REASONS, type ITrackHandlerPayload, type ITrackPayload, type IngestAcceptedResponse, type IngestError, type IngestErrorCode, type IngestMode, type IngestOkResponse, type IngestRejection, type IngestRejectionReason, type IngestResponse, MAX_TRACK_PAYLOAD_BYTES, type SessionCredential, reconcileIngestResponse, zDecrementPayload, zIdentifyPayload, zIncrementPayload, zIngestAcceptedResponse, zIngestError, zIngestErrorCode, zIngestMode, zIngestOkResponse, zIngestRejection, zIngestRejectionReason, zIngestResponse, zSessionCredential, zTrackHandlerPayload, zTrackPayload };