@reopt-ai/data-contract 0.6.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/client.cjs +228 -321
  2. package/dist/client.cjs.map +1 -1
  3. package/dist/client.d.cts +57 -71
  4. package/dist/client.d.cts.map +1 -0
  5. package/dist/client.d.ts +57 -71
  6. package/dist/client.d.ts.map +1 -0
  7. package/dist/client.js +228 -322
  8. package/dist/client.js.map +1 -1
  9. package/dist/control.cjs +158 -54
  10. package/dist/control.cjs.map +1 -1
  11. package/dist/control.d.cts +124 -140
  12. package/dist/control.d.cts.map +1 -0
  13. package/dist/control.d.ts +124 -140
  14. package/dist/control.d.ts.map +1 -0
  15. package/dist/control.js +134 -54
  16. package/dist/control.js.map +1 -1
  17. package/dist/events-BUIeU60t.d.cts +142 -0
  18. package/dist/events-BUIeU60t.d.cts.map +1 -0
  19. package/dist/events-BUIeU60t.d.ts +142 -0
  20. package/dist/events-BUIeU60t.d.ts.map +1 -0
  21. package/dist/events.cjs +110 -15
  22. package/dist/events.cjs.map +1 -1
  23. package/dist/events.d.cts +2 -59
  24. package/dist/events.d.ts +2 -59
  25. package/dist/events.js +101 -15
  26. package/dist/events.js.map +1 -1
  27. package/dist/identity.cjs +150 -55
  28. package/dist/identity.cjs.map +1 -1
  29. package/dist/identity.d.cts +21 -20
  30. package/dist/identity.d.cts.map +1 -0
  31. package/dist/identity.d.ts +21 -20
  32. package/dist/identity.d.ts.map +1 -0
  33. package/dist/identity.js +126 -56
  34. package/dist/identity.js.map +1 -1
  35. package/dist/index.cjs +46 -25
  36. package/dist/index.cjs.map +1 -1
  37. package/dist/index.d.cts +37 -54
  38. package/dist/index.d.cts.map +1 -0
  39. package/dist/index.d.ts +37 -54
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +36 -25
  42. package/dist/index.js.map +1 -1
  43. package/dist/ingest.cjs +152 -57
  44. package/dist/ingest.cjs.map +1 -1
  45. package/dist/ingest.d.cts +185 -196
  46. package/dist/ingest.d.cts.map +1 -0
  47. package/dist/ingest.d.ts +185 -196
  48. package/dist/ingest.d.ts.map +1 -0
  49. package/dist/ingest.js +126 -57
  50. package/dist/ingest.js.map +1 -1
  51. package/dist/query.cjs +284 -84
  52. package/dist/query.cjs.map +1 -1
  53. package/dist/query.d.cts +458 -471
  54. package/dist/query.d.cts.map +1 -0
  55. package/dist/query.d.ts +458 -471
  56. package/dist/query.d.ts.map +1 -0
  57. package/dist/query.js +245 -84
  58. package/dist/query.js.map +1 -1
  59. package/dist/report.cjs +104 -74
  60. package/dist/report.cjs.map +1 -1
  61. package/dist/report.d.cts +182 -136
  62. package/dist/report.d.cts.map +1 -0
  63. package/dist/report.d.ts +182 -136
  64. package/dist/report.d.ts.map +1 -0
  65. package/dist/report.js +93 -74
  66. package/dist/report.js.map +1 -1
  67. package/dist/version-B_0qb1_K.cjs +53 -0
  68. package/dist/version-B_0qb1_K.cjs.map +1 -0
  69. package/dist/version-C09Cyf4R.js +12 -0
  70. package/dist/version-C09Cyf4R.js.map +1 -0
  71. package/dist/{version-BANKB6Og.d.ts → version-CGujUGWd.d.cts} +5 -3
  72. package/dist/version-CGujUGWd.d.cts.map +1 -0
  73. package/dist/{version-BANKB6Og.d.cts → version-CGujUGWd.d.ts} +5 -3
  74. package/dist/version-CGujUGWd.d.ts.map +1 -0
  75. package/package.json +69 -28
  76. package/dist/chunk-33BCA2LH.js +0 -53
  77. package/dist/chunk-33BCA2LH.js.map +0 -1
  78. package/dist/chunk-3EEANNYN.cjs +0 -62
  79. package/dist/chunk-3EEANNYN.cjs.map +0 -1
  80. package/dist/chunk-AOS53KAV.cjs +0 -19
  81. package/dist/chunk-AOS53KAV.cjs.map +0 -1
  82. package/dist/chunk-BA52YA7N.cjs +0 -179
  83. package/dist/chunk-BA52YA7N.cjs.map +0 -1
  84. package/dist/chunk-DUJSYMYY.js +0 -179
  85. package/dist/chunk-DUJSYMYY.js.map +0 -1
  86. package/dist/chunk-FMOKJTQD.js +0 -160
  87. package/dist/chunk-FMOKJTQD.js.map +0 -1
  88. package/dist/chunk-FP2X3PRK.js +0 -62
  89. package/dist/chunk-FP2X3PRK.js.map +0 -1
  90. package/dist/chunk-FQSCQSMP.cjs +0 -160
  91. package/dist/chunk-FQSCQSMP.cjs.map +0 -1
  92. package/dist/chunk-FUGY5ANJ.cjs +0 -361
  93. package/dist/chunk-FUGY5ANJ.cjs.map +0 -1
  94. package/dist/chunk-IY4MXH35.js +0 -204
  95. package/dist/chunk-IY4MXH35.js.map +0 -1
  96. package/dist/chunk-L3WJGIKD.js +0 -361
  97. package/dist/chunk-L3WJGIKD.js.map +0 -1
  98. package/dist/chunk-LA5F5KR6.cjs +0 -204
  99. package/dist/chunk-LA5F5KR6.cjs.map +0 -1
  100. package/dist/chunk-YSAEOYPD.cjs +0 -53
  101. package/dist/chunk-YSAEOYPD.cjs.map +0 -1
  102. package/dist/chunk-ZCKVMUIQ.js +0 -19
  103. package/dist/chunk-ZCKVMUIQ.js.map +0 -1
@@ -1,204 +0,0 @@
1
- import {
2
- zTimezone
3
- } from "./chunk-L3WJGIKD.js";
4
- import {
5
- zInstant
6
- } from "./chunk-33BCA2LH.js";
7
-
8
- // src/control.ts
9
- import { z } from "zod";
10
- var PLATFORM_KEY_HEADER = "reopt-platform-key";
11
- var ORG_KEY_HEADER = "reopt-org-key";
12
- var zExternalId = z.string().min(1).max(191);
13
- var zCreateOrganizationInput = z.object({
14
- externalId: zExternalId,
15
- name: z.string().min(1).max(200),
16
- slug: z.string().min(1).max(100).regex(/^[a-z0-9-]+$/, "lowercase letters, digits and hyphens only").optional(),
17
- monthlyEventQuota: z.number().int().nonnegative().optional(),
18
- monthlyCreditQuota: z.number().int().nonnegative().optional()
19
- });
20
- var zOrganization = z.object({
21
- id: z.string(),
22
- externalId: zExternalId,
23
- name: z.string(),
24
- slug: z.string(),
25
- monthlyEventQuota: z.number().int(),
26
- monthlyCreditQuota: z.number().int()
27
- });
28
- var zCreateOrganizationResponse = z.object({
29
- /** `false` when this externalId already had an organization. */
30
- created: z.boolean(),
31
- organization: zOrganization,
32
- /**
33
- * Plaintext, returned here and nowhere else.
34
- *
35
- * Absent when `created` is `false`: re-issuing on every retry would let a
36
- * retry quietly multiply live credentials. A caller that lost the key rotates
37
- * instead — see `POST /api/v1/organizations/{id}/keys`.
38
- */
39
- orgKey: z.string().optional()
40
- });
41
- var zRotateOrganizationKeyResponse = z.object({
42
- organizationId: z.string(),
43
- keyPrefix: z.string(),
44
- /** Plaintext, returned once. Every previously issued key is revoked immediately. */
45
- orgKey: z.string()
46
- });
47
- var zUpdateOrganizationQuotaInput = z.object({
48
- monthlyEventQuota: z.number().int().nonnegative().optional(),
49
- monthlyCreditQuota: z.number().int().nonnegative().optional()
50
- }).refine((value) => value.monthlyEventQuota !== void 0 || value.monthlyCreditQuota !== void 0, {
51
- message: "at least one quota must be given"
52
- });
53
- var zUpdateOrganizationQuotaResponse = z.object({ organization: zOrganization });
54
- var zCreateProjectInput = z.object({
55
- externalId: zExternalId,
56
- name: z.string().min(1).max(200),
57
- domain: z.string().max(253).optional(),
58
- /** Becomes the project's default for every query that omits one. */
59
- timezone: zTimezone.optional(),
60
- retentionDays: z.number().int().min(1).max(3650).optional()
61
- });
62
- var zProject = z.object({
63
- id: z.string(),
64
- externalId: zExternalId,
65
- organizationId: z.string(),
66
- name: z.string(),
67
- /** The applied value — `"UTC"` when none was given. */
68
- timezone: z.string(),
69
- retentionDays: z.number().int().nullable()
70
- });
71
- var zCreateProjectResponse = z.object({
72
- created: z.boolean(),
73
- project: zProject,
74
- /**
75
- * Two credentials, not one. A key embedded in a browser bundle must not also
76
- * be able to read the project's analytics, so the browser write key and the
77
- * server secret are separate rows with different reach.
78
- */
79
- clients: z.object({
80
- browser: z.object({
81
- id: z.string(),
82
- /** Public by design, and recoverable — it ships in page source anyway. */
83
- writeKey: z.string(),
84
- scopes: z.array(z.string())
85
- }),
86
- server: z.object({
87
- id: z.string(),
88
- /** Plaintext, returned once. Absent when `created` is `false`. */
89
- clientSecret: z.string().optional(),
90
- scopes: z.array(z.string())
91
- })
92
- })
93
- });
94
- var zRotateClientSecretResponse = z.object({
95
- projectId: z.string(),
96
- clientId: z.string(),
97
- /** Plaintext, returned once. The previous secret stops working immediately. */
98
- clientSecret: z.string()
99
- });
100
- var zDeleteProjectInput = z.object({
101
- /**
102
- * A field in the body rather than `?purge=true`. This deletes the project's
103
- * Postgres rows and every analytics row behind it, with no undo — and a query
104
- * parameter is far too easy to fire from shell history or a mis-copied URL.
105
- */
106
- purge: z.literal(true),
107
- /** Checked against the project on record; a mismatch is refused. */
108
- externalId: zExternalId
109
- });
110
- var zDeleteProjectResponse = z.object({
111
- projectId: z.string(),
112
- /** Idempotent, but it still says which of the two happened. */
113
- purge: z.enum(["queued", "already-absent"]),
114
- /** When the purge was marked. Absent for `already-absent`. */
115
- purgingAt: zInstant.optional()
116
- });
117
- var EVENT_META_STATUSES = ["active", "deprecated", "archived", "internal"];
118
- var zEventMetaStatus = z.enum(EVENT_META_STATUSES);
119
- var zEventName = z.string().min(1).max(200);
120
- var zUpsertEventMetaInput = z.object({
121
- conversion: z.boolean().optional(),
122
- /** `internal` events are left out of every metric unless a query opts in. */
123
- status: zEventMetaStatus.optional(),
124
- /** Property keys the hourly rollups break this event down by. */
125
- rollupProperties: z.array(z.string().min(1).max(200)).max(20).optional()
126
- }).strict();
127
- var zEventMetaResponse = z.object({
128
- projectId: z.string(),
129
- name: z.string(),
130
- conversion: z.boolean(),
131
- status: zEventMetaStatus,
132
- rollupProperties: z.array(z.string()),
133
- /** Fields this call actually changed; empty on a repeat. */
134
- changed: z.array(z.string()),
135
- updatedAt: zInstant
136
- });
137
- var CONTROL_ERROR_CODES = [
138
- /** 401 — missing or invalid platform key / organization key. */
139
- "unauthorized",
140
- /** 403 — the organization key belongs to a different organization. */
141
- "organization_scope_mismatch",
142
- /**
143
- * 409 — this externalId exists with a materially different configuration.
144
- * Only fields whose change alters results are compared (see the docs); a
145
- * renamed brand is not a conflict.
146
- */
147
- "external_id_conflict",
148
- /** 409 — the externalId in a delete body does not match the project's. */
149
- "project_external_id_mismatch",
150
- /** 404 — no such organization or project, on an endpoint that is not idempotent. */
151
- "not_found",
152
- /** 400 — input failed the schema. */
153
- "validation_failed",
154
- /** 429 — per-credential rate limit. */
155
- "rate_limited",
156
- /** 500 — unexpected server failure. */
157
- "internal_error"
158
- ];
159
- var zControlErrorCode = z.enum(CONTROL_ERROR_CODES);
160
- var zControlError = z.object({
161
- status: z.number().int(),
162
- code: zControlErrorCode,
163
- error: z.string(),
164
- message: z.string().optional(),
165
- errors: z.unknown().optional(),
166
- requestId: z.string().optional()
167
- });
168
- var CONTROL_API_PATHS = {
169
- organizations: "/api/v1/organizations",
170
- organization: (id) => `/api/v1/organizations/${encodeURIComponent(id)}`,
171
- organizationKeys: (id) => `/api/v1/organizations/${encodeURIComponent(id)}/keys`,
172
- projects: "/api/v1/projects",
173
- project: (id) => `/api/v1/projects/${encodeURIComponent(id)}`,
174
- clientRotate: (projectId, clientId) => `/api/v1/projects/${encodeURIComponent(projectId)}/clients/${encodeURIComponent(clientId)}/rotate`,
175
- projectEvent: (projectId, name) => `/api/v1/projects/${encodeURIComponent(projectId)}/events/${encodeURIComponent(name)}`
176
- };
177
-
178
- export {
179
- PLATFORM_KEY_HEADER,
180
- ORG_KEY_HEADER,
181
- zExternalId,
182
- zCreateOrganizationInput,
183
- zOrganization,
184
- zCreateOrganizationResponse,
185
- zRotateOrganizationKeyResponse,
186
- zUpdateOrganizationQuotaInput,
187
- zUpdateOrganizationQuotaResponse,
188
- zCreateProjectInput,
189
- zProject,
190
- zCreateProjectResponse,
191
- zRotateClientSecretResponse,
192
- zDeleteProjectInput,
193
- zDeleteProjectResponse,
194
- EVENT_META_STATUSES,
195
- zEventMetaStatus,
196
- zEventName,
197
- zUpsertEventMetaInput,
198
- zEventMetaResponse,
199
- CONTROL_ERROR_CODES,
200
- zControlErrorCode,
201
- zControlError,
202
- CONTROL_API_PATHS
203
- };
204
- //# sourceMappingURL=chunk-IY4MXH35.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/control.ts"],"sourcesContent":["/**\n * `POST /api/v1/organizations` · `/api/v1/projects` and friends — the\n * provisioning contract.\n *\n * A project-scoped client credential cannot authenticate the creation of the\n * project it is scoped to, and an organization key cannot authenticate the\n * creation of its own organization. So provisioning runs on two credentials\n * above the client one: a platform key that creates organizations and writes\n * quotas, and an organization key that creates and deletes projects inside one\n * organization.\n *\n * Quota writes sit with the platform key on purpose. Organization keys are held\n * one-per-workspace by the caller and so have a wide exposure surface; a leaked\n * one that could raise its own limits would turn a credential leak into an\n * unbounded bill.\n */\nimport { z } from \"zod\";\nimport { zInstant } from \"./index.js\";\nimport { zTimezone } from \"./query.js\";\n\nexport const PLATFORM_KEY_HEADER = \"reopt-platform-key\";\nexport const ORG_KEY_HEADER = \"reopt-org-key\";\n\n/**\n * The caller's own id for the thing being provisioned.\n *\n * Preferred over an `Idempotency-Key` header because this domain has a real\n * natural key — the caller already has a stable id for the workspace or brand —\n * and a header would make the caller store a second one just to retry safely.\n */\nexport const zExternalId = z.string().min(1).max(191);\n\n// ─── Organizations ──────────────────────────────────────────────────────────\n\nexport const zCreateOrganizationInput = z.object({\n externalId: zExternalId,\n name: z.string().min(1).max(200),\n slug: z\n .string()\n .min(1)\n .max(100)\n .regex(/^[a-z0-9-]+$/, \"lowercase letters, digits and hyphens only\")\n .optional(),\n monthlyEventQuota: z.number().int().nonnegative().optional(),\n monthlyCreditQuota: z.number().int().nonnegative().optional(),\n});\nexport type CreateOrganizationInput = z.input<typeof zCreateOrganizationInput>;\n\nexport const zOrganization = z.object({\n id: z.string(),\n externalId: zExternalId,\n name: z.string(),\n slug: z.string(),\n monthlyEventQuota: z.number().int(),\n monthlyCreditQuota: z.number().int(),\n});\n\nexport const zCreateOrganizationResponse = z.object({\n /** `false` when this externalId already had an organization. */\n created: z.boolean(),\n organization: zOrganization,\n /**\n * Plaintext, returned here and nowhere else.\n *\n * Absent when `created` is `false`: re-issuing on every retry would let a\n * retry quietly multiply live credentials. A caller that lost the key rotates\n * instead — see `POST /api/v1/organizations/{id}/keys`.\n */\n orgKey: z.string().optional(),\n});\nexport type CreateOrganizationResponse = z.infer<typeof zCreateOrganizationResponse>;\n\nexport const zRotateOrganizationKeyResponse = z.object({\n organizationId: z.string(),\n keyPrefix: z.string(),\n /** Plaintext, returned once. Every previously issued key is revoked immediately. */\n orgKey: z.string(),\n});\nexport type RotateOrganizationKeyResponse = z.infer<typeof zRotateOrganizationKeyResponse>;\n\nexport const zUpdateOrganizationQuotaInput = z\n .object({\n monthlyEventQuota: z.number().int().nonnegative().optional(),\n monthlyCreditQuota: z.number().int().nonnegative().optional(),\n })\n .refine((value) => value.monthlyEventQuota !== undefined || value.monthlyCreditQuota !== undefined, {\n message: \"at least one quota must be given\",\n });\nexport type UpdateOrganizationQuotaInput = z.input<typeof zUpdateOrganizationQuotaInput>;\n\nexport const zUpdateOrganizationQuotaResponse = z.object({ organization: zOrganization });\nexport type UpdateOrganizationQuotaResponse = z.infer<typeof zUpdateOrganizationQuotaResponse>;\n\n// ─── Projects ───────────────────────────────────────────────────────────────\n\nexport const zCreateProjectInput = z.object({\n externalId: zExternalId,\n name: z.string().min(1).max(200),\n domain: z.string().max(253).optional(),\n /** Becomes the project's default for every query that omits one. */\n timezone: zTimezone.optional(),\n retentionDays: z.number().int().min(1).max(3650).optional(),\n});\nexport type CreateProjectInput = z.input<typeof zCreateProjectInput>;\n\nexport const zProject = z.object({\n id: z.string(),\n externalId: zExternalId,\n organizationId: z.string(),\n name: z.string(),\n /** The applied value — `\"UTC\"` when none was given. */\n timezone: z.string(),\n retentionDays: z.number().int().nullable(),\n});\n\nexport const zCreateProjectResponse = z.object({\n created: z.boolean(),\n project: zProject,\n /**\n * Two credentials, not one. A key embedded in a browser bundle must not also\n * be able to read the project's analytics, so the browser write key and the\n * server secret are separate rows with different reach.\n */\n clients: z.object({\n browser: z.object({\n id: z.string(),\n /** Public by design, and recoverable — it ships in page source anyway. */\n writeKey: z.string(),\n scopes: z.array(z.string()),\n }),\n server: z.object({\n id: z.string(),\n /** Plaintext, returned once. Absent when `created` is `false`. */\n clientSecret: z.string().optional(),\n scopes: z.array(z.string()),\n }),\n }),\n});\nexport type CreateProjectResponse = z.infer<typeof zCreateProjectResponse>;\n\nexport const zRotateClientSecretResponse = z.object({\n projectId: z.string(),\n clientId: z.string(),\n /** Plaintext, returned once. The previous secret stops working immediately. */\n clientSecret: z.string(),\n});\nexport type RotateClientSecretResponse = z.infer<typeof zRotateClientSecretResponse>;\n\nexport const zDeleteProjectInput = z.object({\n /**\n * A field in the body rather than `?purge=true`. This deletes the project's\n * Postgres rows and every analytics row behind it, with no undo — and a query\n * parameter is far too easy to fire from shell history or a mis-copied URL.\n */\n purge: z.literal(true),\n /** Checked against the project on record; a mismatch is refused. */\n externalId: zExternalId,\n});\nexport type DeleteProjectInput = z.input<typeof zDeleteProjectInput>;\n\nexport const zDeleteProjectResponse = z.object({\n projectId: z.string(),\n /** Idempotent, but it still says which of the two happened. */\n purge: z.enum([\"queued\", \"already-absent\"]),\n /** When the purge was marked. Absent for `already-absent`. */\n purgingAt: zInstant.optional(),\n});\nexport type DeleteProjectResponse = z.infer<typeof zDeleteProjectResponse>;\n\n// ─── Errors ─────────────────────────────────────────────────────────────────\n\n// ─── Event metadata ─────────────────────────────────────────────────────────\n\n/**\n * `PUT /api/v1/projects/{projectId}/events/{name}` — catalogue settings for\n * one event name. Provisioning calls it to mark `form.submitted` a conversion\n * and an operational probe `internal`; the call is idempotent so a retried\n * provisioning run is harmless.\n */\nexport const EVENT_META_STATUSES = [\"active\", \"deprecated\", \"archived\", \"internal\"] as const;\nexport const zEventMetaStatus = z.enum(EVENT_META_STATUSES);\nexport type EventMetaStatus = z.infer<typeof zEventMetaStatus>;\n\nexport const zEventName = z.string().min(1).max(200);\n\nexport const zUpsertEventMetaInput = z\n .object({\n conversion: z.boolean().optional(),\n /** `internal` events are left out of every metric unless a query opts in. */\n status: zEventMetaStatus.optional(),\n /** Property keys the hourly rollups break this event down by. */\n rollupProperties: z.array(z.string().min(1).max(200)).max(20).optional(),\n })\n .strict();\nexport type UpsertEventMetaInput = z.infer<typeof zUpsertEventMetaInput>;\n\nexport const zEventMetaResponse = z.object({\n projectId: z.string(),\n name: z.string(),\n conversion: z.boolean(),\n status: zEventMetaStatus,\n rollupProperties: z.array(z.string()),\n /** Fields this call actually changed; empty on a repeat. */\n changed: z.array(z.string()),\n updatedAt: zInstant,\n});\nexport type EventMetaResponse = z.infer<typeof zEventMetaResponse>;\n\nexport const CONTROL_ERROR_CODES = [\n /** 401 — missing or invalid platform key / organization key. */\n \"unauthorized\",\n /** 403 — the organization key belongs to a different organization. */\n \"organization_scope_mismatch\",\n /**\n * 409 — this externalId exists with a materially different configuration.\n * Only fields whose change alters results are compared (see the docs); a\n * renamed brand is not a conflict.\n */\n \"external_id_conflict\",\n /** 409 — the externalId in a delete body does not match the project's. */\n \"project_external_id_mismatch\",\n /** 404 — no such organization or project, on an endpoint that is not idempotent. */\n \"not_found\",\n /** 400 — input failed the schema. */\n \"validation_failed\",\n /** 429 — per-credential rate limit. */\n \"rate_limited\",\n /** 500 — unexpected server failure. */\n \"internal_error\",\n] as const;\nexport const zControlErrorCode = z.enum(CONTROL_ERROR_CODES);\nexport type ControlErrorCode = z.infer<typeof zControlErrorCode>;\n\nexport const zControlError = z.object({\n status: z.number().int(),\n code: zControlErrorCode,\n error: z.string(),\n message: z.string().optional(),\n errors: z.unknown().optional(),\n requestId: z.string().optional(),\n});\nexport type ControlError = z.infer<typeof zControlError>;\n\n/** Paths, so the client and the route handlers cannot drift apart. */\nexport const CONTROL_API_PATHS = {\n organizations: \"/api/v1/organizations\",\n organization: (id: string) => `/api/v1/organizations/${encodeURIComponent(id)}`,\n organizationKeys: (id: string) => `/api/v1/organizations/${encodeURIComponent(id)}/keys`,\n projects: \"/api/v1/projects\",\n project: (id: string) => `/api/v1/projects/${encodeURIComponent(id)}`,\n clientRotate: (projectId: string, clientId: string) =>\n `/api/v1/projects/${encodeURIComponent(projectId)}/clients/${encodeURIComponent(clientId)}/rotate`,\n projectEvent: (projectId: string, name: string) =>\n `/api/v1/projects/${encodeURIComponent(projectId)}/events/${encodeURIComponent(name)}`,\n} as const;\n"],"mappings":";;;;;;;;AAgBA,SAAS,SAAS;AAIX,IAAM,sBAAsB;AAC5B,IAAM,iBAAiB;AASvB,IAAM,cAAc,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAI7C,IAAM,2BAA2B,EAAE,OAAO;AAAA,EAC/C,YAAY;AAAA,EACZ,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EAC/B,MAAM,EACH,OAAO,EACP,IAAI,CAAC,EACL,IAAI,GAAG,EACP,MAAM,gBAAgB,4CAA4C,EAClE,SAAS;AAAA,EACZ,mBAAmB,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS;AAAA,EAC3D,oBAAoB,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS;AAC9D,CAAC;AAGM,IAAM,gBAAgB,EAAE,OAAO;AAAA,EACpC,IAAI,EAAE,OAAO;AAAA,EACb,YAAY;AAAA,EACZ,MAAM,EAAE,OAAO;AAAA,EACf,MAAM,EAAE,OAAO;AAAA,EACf,mBAAmB,EAAE,OAAO,EAAE,IAAI;AAAA,EAClC,oBAAoB,EAAE,OAAO,EAAE,IAAI;AACrC,CAAC;AAEM,IAAM,8BAA8B,EAAE,OAAO;AAAA;AAAA,EAElD,SAAS,EAAE,QAAQ;AAAA,EACnB,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQd,QAAQ,EAAE,OAAO,EAAE,SAAS;AAC9B,CAAC;AAGM,IAAM,iCAAiC,EAAE,OAAO;AAAA,EACrD,gBAAgB,EAAE,OAAO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- var zGranularity = z.enum(["hour", "day", "week", "month"]);
9
- var zTimezone = z.string().min(1).max(64).refine(isValidTimeZone, { message: "unknown IANA time zone" });
10
- function isValidTimeZone(value) {
11
- try {
12
- new Intl.DateTimeFormat("en-US", { timeZone: value });
13
- return true;
14
- } catch {
15
- return false;
16
- }
17
- }
18
- var zChannelFilter = z.object({
19
- referrerTypes: z.array(z.string()).optional(),
20
- channelTypes: z.array(z.string()).optional(),
21
- utmSources: z.array(z.string()).optional(),
22
- utmMediums: z.array(z.string()).optional(),
23
- utmCampaigns: z.array(z.string()).optional()
24
- }).optional();
25
- var zQuerySource = z.enum(["rollup", "raw", "mixed"]);
26
- var zQueryMeta = z.object({
27
- projectId: z.string(),
28
- /** When the underlying computation actually ran. On a cache hit, when the cached value was computed. */
29
- computedAt: zInstant,
30
- /** Age of the returned computation, in seconds. `0` on a cache miss. */
31
- cacheAgeSeconds: z.number().int().nonnegative(),
32
- /**
33
- * How far behind live materialization was when the computation ran, in
34
- * seconds. `0` means no live event is pending; `null` means measurement
35
- * failed and must never be interpreted as fresh.
36
- *
37
- * Deliberately not `now - max(events.created_at)` — that conflates "the
38
- * pipeline is behind" with "this project is quiet", and grows without bound
39
- * on an idle project.
40
- */
41
- ingestLagSeconds: z.number().int().nonnegative().nullable(),
42
- /** Whether the freshness measurement itself succeeded. */
43
- ingestLagStatus: z.enum(["known", "unknown"]),
44
- /**
45
- * Pending events older than the live replay window. Kept separate so an old
46
- * permanently failing event neither pegs live lag nor disappears behind 0.
47
- * `null` means the measurement failed.
48
- */
49
- ingestDeadLetterCount: z.number().int().nonnegative().nullable(),
50
- cached: z.boolean(),
51
- /**
52
- * The time zone actually used to place bucket and window boundaries — the
53
- * resolved value, not the requested one. Read it rather than assuming the
54
- * request was honoured: when no zone is given anywhere it is `"UTC"`, and
55
- * that is exactly the case a consumer needs to notice.
56
- */
57
- timezone: z.string(),
58
- /**
59
- * Where the numbers came from. `rollup`: pre-aggregated hourly tables;
60
- * `raw`: a scan of the event/session tables; `mixed`: finished hours from
61
- * the rollup, the hour still in progress from raw. Diagnostic — the values
62
- * agree either way — but a consumer that expected `rollup` and sees `raw`
63
- * has asked for a combination the rollups cannot serve.
64
- */
65
- source: zQuerySource,
66
- requestId: z.string()
67
- });
68
- function zQueryEnvelope(data) {
69
- return z.object({ data, meta: zQueryMeta });
70
- }
71
- var zTimeseriesBreakdown = z.object({
72
- kind: z.literal("property"),
73
- key: z.string().min(1).max(200),
74
- topN: z.number().int().min(1).max(100).default(5)
75
- });
76
- var zEventPropertyFilter = z.object({
77
- key: z.string().min(1).max(200),
78
- operator: z.literal("eq").default("eq"),
79
- value: z.string().min(1).max(500)
80
- });
81
- var zEventsTimeseriesInput = z.object({
82
- projectId: z.string().min(1),
83
- startDate: zDate,
84
- endDate: zDate,
85
- granularity: zGranularity.default("day"),
86
- /** Omit to count every event in the window. */
87
- eventName: z.string().min(1).max(200).optional(),
88
- /** Exact matches against top-level `properties` keys. Every item must match. */
89
- propertyFilters: z.array(zEventPropertyFilter).max(10).optional(),
90
- breakdown: zTimeseriesBreakdown.optional(),
91
- /**
92
- * Cannot be combined with `breakdown` — the backend's breakdown time series
93
- * takes no segment. Sending both is refused with `unsupported_combination`
94
- * rather than silently ignoring one of them.
95
- */
96
- segmentId: z.string().min(1).optional(),
97
- /** Omit to fall back to the project's configured zone, then to UTC. */
98
- timezone: zTimezone.optional(),
99
- /**
100
- * Events whose catalogue status is `internal` (operational probes) are
101
- * left out by default. A probe that needs to find its own event sets this.
102
- */
103
- includeInternal: z.boolean().default(false)
104
- }).refine((input) => input.startDate <= input.endDate, {
105
- message: "endDate must be on or after startDate",
106
- path: ["endDate"]
107
- });
108
- var zBucketStart = z.string().regex(/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/, "expected 'YYYY-MM-DD HH:MM:SS'");
109
- var zTimeseriesPoint = z.object({
110
- date: zBucketStart,
111
- count: z.number().int().nonnegative()
112
- });
113
- var zEventsTimeseriesData = z.object({
114
- granularity: zGranularity,
115
- /** Zone the buckets were cut in. Mirrors `meta.timezone`. */
116
- timezone: z.string(),
117
- /** Total per bucket. Always present, with or without a breakdown. */
118
- series: z.array(zTimeseriesPoint),
119
- /** Present only when `breakdown` was requested: the top-N values, each with its own series. */
120
- breakdown: z.array(
121
- z.object({
122
- value: z.string(),
123
- points: z.array(zTimeseriesPoint)
124
- })
125
- ).optional()
126
- });
127
- var zEventsTimeseriesResponse = zQueryEnvelope(zEventsTimeseriesData);
128
- var zFunnelInput = z.object({
129
- projectId: z.string().min(1),
130
- /** Ordered event names. A user counts at step k if they reached at least step k. */
131
- steps: z.array(z.string().min(1).max(200)).min(2).max(10),
132
- startDate: zDate,
133
- endDate: zDate,
134
- /** Max seconds between the first and last step for a conversion to count. Default 24h. */
135
- windowSeconds: z.number().int().min(60).max(2592e3).default(86400),
136
- segmentId: z.string().min(1).optional(),
137
- channelFilter: zChannelFilter,
138
- /**
139
- * Decides where `startDate` / `endDate` fall. A funnel has no buckets, so
140
- * this only moves the window — but a nine-hour window shift changes who is
141
- * in the funnel.
142
- */
143
- timezone: zTimezone.optional(),
144
- /** Accepted for symmetry with events.timeseries; funnel steps are named explicitly, so nothing is filtered. */
145
- includeInternal: z.boolean().default(false)
146
- }).refine((input) => input.startDate <= input.endDate, {
147
- message: "endDate must be on or after startDate",
148
- path: ["endDate"]
149
- });
150
- var zFunnelStep = z.object({
151
- step: z.number().int().min(1),
152
- name: z.string(),
153
- users: z.number().int().nonnegative(),
154
- /** Percent of the previous step that reached this one. `100` for step 1. */
155
- conversionRate: z.number(),
156
- /** Percent of the previous step that did not. `0` for step 1. */
157
- dropoffRate: z.number(),
158
- dropoffUsers: z.number().int().nonnegative()
159
- });
160
- var zFunnelData = z.object({
161
- steps: z.array(zFunnelStep),
162
- totalUsers: z.number().int().nonnegative(),
163
- /** Percent of step-1 users that reached the last step. */
164
- overallConversionRate: z.number()
165
- });
166
- var zFunnelResponse = zQueryEnvelope(zFunnelData);
167
- var zRetentionInterval = z.enum(["day", "week", "month"]);
168
- var zRetentionInput = z.object({
169
- projectId: z.string().min(1),
170
- startDate: zDate,
171
- endDate: zDate,
172
- interval: zRetentionInterval.default("day"),
173
- periods: z.number().int().min(1).max(30).default(7),
174
- startEvent: z.string().min(1).max(200).optional(),
175
- returnEvent: z.string().min(1).max(200).optional(),
176
- /** `bounded`: returned in exactly period N. `unbounded`: returned in period N or later. */
177
- retentionType: z.enum(["bounded", "unbounded"]).default("bounded"),
178
- /**
179
- * `first-ever` (default): the cohort is everyone whose true first activity
180
- * landed in the window, read from the first-seen aggregate. `startEvent`,
181
- * `segmentId` and `channelFilter` then constrain only the *returning* side.
182
- * `first-in-window`: the cohort is selected by scanning events in the window
183
- * with all filters applied. Slower, but filters apply to cohort selection.
184
- */
185
- cohortMode: z.enum(["first-ever", "first-in-window"]).default("first-ever"),
186
- segmentId: z.string().min(1).optional(),
187
- channelFilter: zChannelFilter,
188
- /**
189
- * Decides where a cohort day starts, and so which period a return falls in.
190
- *
191
- * Honoured under both cohort modes. Note that a non-UTC zone makes
192
- * `first-ever` read raw events instead of its daily rollup — the rollup is
193
- * cut on UTC days and cannot be re-cut after the fact — so expect a slower
194
- * query in exchange for cohorts that match the reader's calendar.
195
- */
196
- timezone: zTimezone.optional(),
197
- /** Accepted for symmetry with events.timeseries; retention reads named or all-event activity and does not yet apply the internal filter. */
198
- includeInternal: z.boolean().default(false)
199
- }).refine((input) => input.startDate <= input.endDate, {
200
- message: "endDate must be on or after startDate",
201
- path: ["endDate"]
202
- });
203
- var zRetentionCell = z.object({
204
- /** `0` is the cohort's own period. */
205
- period: z.number().int().nonnegative(),
206
- users: z.number().int().nonnegative(),
207
- /** Percent of `cohortSize`. */
208
- rate: z.number()
209
- });
210
- var zRetentionData = z.object({
211
- matrix: z.array(
212
- z.object({
213
- /** Cohort bucket start, same shape and zone as {@link zBucketStart}. */
214
- cohortDate: zBucketStart,
215
- cohortSize: z.number().int().nonnegative(),
216
- /** Length is `periods + 1`, index-aligned to `period`. */
217
- retention: z.array(zRetentionCell)
218
- })
219
- ),
220
- /** Unweighted mean rate per period across cohorts. */
221
- averageRetention: z.array(z.object({ period: z.number().int().nonnegative(), rate: z.number() })),
222
- interval: zRetentionInterval,
223
- periods: z.number().int(),
224
- retentionType: z.enum(["bounded", "unbounded"]),
225
- /** Zone the cohort days were cut in. Mirrors `meta.timezone`. */
226
- timezone: z.string()
227
- });
228
- var zRetentionResponse = zQueryEnvelope(zRetentionData);
229
- var zTrafficOverviewInput = z.object({
230
- projectId: z.string().min(1),
231
- startDate: zDate,
232
- endDate: zDate,
233
- granularity: zGranularity.default("day"),
234
- timezone: zTimezone.optional()
235
- }).refine((input) => input.startDate <= input.endDate, {
236
- message: "endDate must be on or after startDate",
237
- path: ["endDate"]
238
- });
239
- var zTrafficTotals = z.object({
240
- sessions: z.number().int().nonnegative(),
241
- pageviews: z.number().int().nonnegative(),
242
- newVisitors: z.number().int().nonnegative(),
243
- returningVisitors: z.number().int().nonnegative(),
244
- /** Percent of sessions that bounced, two decimals. */
245
- bounceRate: z.number()
246
- });
247
- var zTrafficSeriesPoint = zTrafficTotals.extend({ date: zBucketStart });
248
- var zTrafficOverviewData = z.object({
249
- granularity: zGranularity,
250
- timezone: z.string(),
251
- totals: zTrafficTotals,
252
- series: z.array(zTrafficSeriesPoint)
253
- });
254
- var zTrafficOverviewResponse = zQueryEnvelope(zTrafficOverviewData);
255
- var zTrafficDimension = z.enum(["channel", "referrer", "utm"]);
256
- var zTrafficSourcesInput = z.object({
257
- projectId: z.string().min(1),
258
- startDate: zDate,
259
- endDate: zDate,
260
- /** `channel`: channel_type · `referrer`: referrer name+type · `utm`: source/medium/campaign. */
261
- dimension: zTrafficDimension,
262
- limit: z.number().int().min(1).max(100).default(10),
263
- timezone: zTimezone.optional()
264
- }).refine((input) => input.startDate <= input.endDate, {
265
- message: "endDate must be on or after startDate",
266
- path: ["endDate"]
267
- });
268
- var zTrafficSourceRow = zTrafficTotals.extend({
269
- /** Display key for the row: the channel, the referrer name, or `source / medium / campaign`. */
270
- key: z.string(),
271
- channelType: z.string().optional(),
272
- referrerName: z.string().optional(),
273
- referrerType: z.string().optional(),
274
- utmSource: z.string().optional(),
275
- utmMedium: z.string().optional(),
276
- utmCampaign: z.string().optional()
277
- });
278
- var zTrafficSourcesData = z.object({
279
- dimension: zTrafficDimension,
280
- timezone: z.string(),
281
- /** Ordered by sessions, descending. */
282
- rows: z.array(zTrafficSourceRow)
283
- });
284
- var zTrafficSourcesResponse = zQueryEnvelope(zTrafficSourcesData);
285
- var QUERY_ERROR_CODES = [
286
- /** 401 — unknown or mismatched credentials. */
287
- "unauthorized",
288
- /** 403 — the credential's project is not the project asked about. */
289
- "project_scope_mismatch",
290
- /** 403 — the credential lacks the `query` scope. Provision a query-scoped client. */
291
- "query_scope_missing",
292
- /** 400 — input failed the schema. `errors` carries the zod issues. */
293
- "validation_failed",
294
- /** 400 — inputs are individually valid but cannot be served together (e.g. breakdown + segmentId). */
295
- "unsupported_combination",
296
- /** 410 — the project is being deleted. Permanent; stop asking. */
297
- "project_purging",
298
- /** 429 — per-credential query rate limit. `Retry-After` set. */
299
- "rate_limited",
300
- /** 504 — the analytics backend exceeded its statement timeout. Narrow the window. */
301
- "query_timeout",
302
- /** 500 — unexpected server failure. */
303
- "internal_error"
304
- ];
305
- var zQueryErrorCode = z.enum(QUERY_ERROR_CODES);
306
- var zQueryError = z.object({
307
- status: z.number().int(),
308
- code: zQueryErrorCode,
309
- error: z.string(),
310
- message: z.string().optional(),
311
- errors: z.unknown().optional(),
312
- requestId: z.string().optional()
313
- });
314
- var QUERY_API_PATHS = {
315
- eventsTimeseries: "/api/v1/query/events/timeseries",
316
- funnel: "/api/v1/query/funnel",
317
- retention: "/api/v1/query/retention",
318
- trafficOverview: "/api/v1/query/traffic/overview",
319
- trafficSources: "/api/v1/query/traffic/sources"
320
- };
321
-
322
- export {
323
- zGranularity,
324
- zTimezone,
325
- isValidTimeZone,
326
- zChannelFilter,
327
- zQuerySource,
328
- zQueryMeta,
329
- zQueryEnvelope,
330
- zTimeseriesBreakdown,
331
- zEventPropertyFilter,
332
- zEventsTimeseriesInput,
333
- zBucketStart,
334
- zTimeseriesPoint,
335
- zEventsTimeseriesData,
336
- zEventsTimeseriesResponse,
337
- zFunnelInput,
338
- zFunnelStep,
339
- zFunnelData,
340
- zFunnelResponse,
341
- zRetentionInterval,
342
- zRetentionInput,
343
- zRetentionCell,
344
- zRetentionData,
345
- zRetentionResponse,
346
- zTrafficOverviewInput,
347
- zTrafficTotals,
348
- zTrafficSeriesPoint,
349
- zTrafficOverviewData,
350
- zTrafficOverviewResponse,
351
- zTrafficDimension,
352
- zTrafficSourcesInput,
353
- zTrafficSourceRow,
354
- zTrafficSourcesData,
355
- zTrafficSourcesResponse,
356
- QUERY_ERROR_CODES,
357
- zQueryErrorCode,
358
- zQueryError,
359
- QUERY_API_PATHS
360
- };
361
- //# sourceMappingURL=chunk-L3WJGIKD.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/query.ts"],"sourcesContent":["/**\n * `POST /api/v1/query/*` — the read contract.\n *\n * Server credentials, project-scoped: the authenticated client's projectId must\n * equal the `projectId` in the body, or the request is refused. Reads are POSTs\n * because the inputs nest (funnel steps, channel filters) and would not survive\n * a query string; consumers cache on their own side, so HTTP cache semantics\n * buy nothing here.\n *\n * Response shapes mirror the existing dashboard computations exactly — this\n * plane re-exposes them, it does not add new math.\n */\nimport { z } from \"zod\";\nimport { zDate, zInstant } from \"./index.js\";\n\nexport { zDate, zInstant };\n\n/** Bucket width for a time series. */\nexport const zGranularity = z.enum([\"hour\", \"day\", \"week\", \"month\"]);\nexport type Granularity = z.infer<typeof zGranularity>;\n\n/**\n * IANA time zone name, e.g. `Asia/Seoul`. Decides two things at once: where a\n * calendar day starts, and therefore which bucket an event falls in.\n *\n * A Korean brand reading \"23 Aug: 120 visits\" means 23 Aug in Seoul. Computed\n * in UTC, that headline silently covers 23 Aug 09:00 through 24 Aug 09:00 —\n * wrong by nine hours in a way nothing on the page reveals.\n *\n * Validated against the runtime's own zone database rather than a regex, so an\n * unknown name fails here with a clear message instead of deep inside a query.\n */\nexport const zTimezone = z.string().min(1).max(64).refine(isValidTimeZone, { message: \"unknown IANA time zone\" });\n\nexport function isValidTimeZone(value: string): boolean {\n try {\n new Intl.DateTimeFormat(\"en-US\", { timeZone: value });\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Acquisition-channel filter. Every field is a set — an event matches when its\n * value is in the set; omitted fields do not constrain. Mirrors the dashboard's\n * `channelFilterSchema` field-for-field.\n */\nexport const zChannelFilter = z\n .object({\n referrerTypes: z.array(z.string()).optional(),\n channelTypes: z.array(z.string()).optional(),\n utmSources: z.array(z.string()).optional(),\n utmMediums: z.array(z.string()).optional(),\n utmCampaigns: z.array(z.string()).optional(),\n })\n .optional();\nexport type ChannelFilter = z.infer<typeof zChannelFilter>;\n\n// ─── Envelope ───────────────────────────────────────────────────────────────\n\n/**\n * Staleness is reported as two independent numbers, never as one sum, because\n * the two have different remedies: a stale cache resolves itself at the next\n * TTL, while ingest lag means the read model is genuinely behind and the right\n * response is an \"aggregating\" badge, not a refresh.\n */\nexport const zQuerySource = z.enum([\"rollup\", \"raw\", \"mixed\"]);\nexport type QuerySource = z.infer<typeof zQuerySource>;\n\nexport const zQueryMeta = z.object({\n projectId: z.string(),\n /** When the underlying computation actually ran. On a cache hit, when the cached value was computed. */\n computedAt: zInstant,\n /** Age of the returned computation, in seconds. `0` on a cache miss. */\n cacheAgeSeconds: z.number().int().nonnegative(),\n /**\n * How far behind live materialization was when the computation ran, in\n * seconds. `0` means no live event is pending; `null` means measurement\n * failed and must never be interpreted as fresh.\n *\n * Deliberately not `now - max(events.created_at)` — that conflates \"the\n * pipeline is behind\" with \"this project is quiet\", and grows without bound\n * on an idle project.\n */\n ingestLagSeconds: z.number().int().nonnegative().nullable(),\n /** Whether the freshness measurement itself succeeded. */\n ingestLagStatus: z.enum([\"known\", \"unknown\"]),\n /**\n * Pending events older than the live replay window. Kept separate so an old\n * permanently failing event neither pegs live lag nor disappears behind 0.\n * `null` means the measurement failed.\n */\n ingestDeadLetterCount: z.number().int().nonnegative().nullable(),\n cached: z.boolean(),\n /**\n * The time zone actually used to place bucket and window boundaries — the\n * resolved value, not the requested one. Read it rather than assuming the\n * request was honoured: when no zone is given anywhere it is `\"UTC\"`, and\n * that is exactly the case a consumer needs to notice.\n */\n timezone: z.string(),\n /**\n * Where the numbers came from. `rollup`: pre-aggregated hourly tables;\n * `raw`: a scan of the event/session tables; `mixed`: finished hours from\n * the rollup, the hour still in progress from raw. Diagnostic — the values\n * agree either way — but a consumer that expected `rollup` and sees `raw`\n * has asked for a combination the rollups cannot serve.\n */\n source: zQuerySource,\n requestId: z.string(),\n});\nexport type QueryMeta = z.infer<typeof zQueryMeta>;\n\n/** Every query response is `{ data, meta }`. */\nexport function zQueryEnvelope<T extends z.ZodTypeAny>(data: T) {\n return z.object({ data, meta: zQueryMeta });\n}\n\n// ─── events.timeseries ──────────────────────────────────────────────────────\n\n/**\n * v1 breaks down by `properties` JSON keys only. Built-in columns\n * (country / os / browser / utm_*) have a totals breakdown in the backend but\n * no *time series* variant, and this plane does not add new computations.\n */\nexport const zTimeseriesBreakdown = z.object({\n kind: z.literal(\"property\"),\n key: z.string().min(1).max(200),\n topN: z.number().int().min(1).max(100).default(5),\n});\nexport type TimeseriesBreakdown = z.infer<typeof zTimeseriesBreakdown>;\n\n/** Exact-match filter for a top-level event `properties` key. Multiple filters are ANDed. */\nexport const zEventPropertyFilter = z.object({\n key: z.string().min(1).max(200),\n operator: z.literal(\"eq\").default(\"eq\"),\n value: z.string().min(1).max(500),\n});\nexport type EventPropertyFilter = z.infer<typeof zEventPropertyFilter>;\n\nexport const zEventsTimeseriesInput = z\n .object({\n projectId: z.string().min(1),\n startDate: zDate,\n endDate: zDate,\n granularity: zGranularity.default(\"day\"),\n /** Omit to count every event in the window. */\n eventName: z.string().min(1).max(200).optional(),\n /** Exact matches against top-level `properties` keys. Every item must match. */\n propertyFilters: z.array(zEventPropertyFilter).max(10).optional(),\n breakdown: zTimeseriesBreakdown.optional(),\n /**\n * Cannot be combined with `breakdown` — the backend's breakdown time series\n * takes no segment. Sending both is refused with `unsupported_combination`\n * rather than silently ignoring one of them.\n */\n segmentId: z.string().min(1).optional(),\n /** Omit to fall back to the project's configured zone, then to UTC. */\n timezone: zTimezone.optional(),\n /**\n * Events whose catalogue status is `internal` (operational probes) are\n * left out by default. A probe that needs to find its own event sets this.\n */\n includeInternal: z.boolean().default(false),\n })\n .refine((input) => input.startDate <= input.endDate, {\n message: \"endDate must be on or after startDate\",\n path: [\"endDate\"],\n });\nexport type EventsTimeseriesInput = z.input<typeof zEventsTimeseriesInput>;\n\n/**\n * Bucket start as wall-clock time in `meta.timezone`, `YYYY-MM-DD HH:MM:SS`.\n *\n * Pinned rather than left to the backend, because a consumer keys its chart on\n * this string: an unspecified format is one where two backends, or two\n * granularities, can quietly disagree and produce two different keys for the\n * same bucket.\n *\n * It is wall time, not an instant — for `Asia/Seoul` a day bucket reads\n * `2026-08-24 00:00:00`, which is `2026-08-23T15:00:00Z`. Day, week and month\n * buckets always carry `00:00:00`, so slicing the first ten characters is a\n * safe way to get a date key.\n */\nexport const zBucketStart = z.string().regex(/^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$/, \"expected 'YYYY-MM-DD HH:MM:SS'\");\n\nexport const zTimeseriesPoint = z.object({\n date: zBucketStart,\n count: z.number().int().nonnegative(),\n});\nexport type TimeseriesPoint = z.infer<typeof zTimeseriesPoint>;\n\nexport const zEventsTimeseriesData = z.object({\n granularity: zGranularity,\n /** Zone the buckets were cut in. Mirrors `meta.timezone`. */\n timezone: z.string(),\n /** Total per bucket. Always present, with or without a breakdown. */\n series: z.array(zTimeseriesPoint),\n /** Present only when `breakdown` was requested: the top-N values, each with its own series. */\n breakdown: z\n .array(\n z.object({\n value: z.string(),\n points: z.array(zTimeseriesPoint),\n })\n )\n .optional(),\n});\nexport type EventsTimeseriesData = z.infer<typeof zEventsTimeseriesData>;\n\nexport const zEventsTimeseriesResponse = zQueryEnvelope(zEventsTimeseriesData);\nexport type EventsTimeseriesResponse = z.infer<typeof zEventsTimeseriesResponse>;\n\n// ─── funnel ─────────────────────────────────────────────────────────────────\n\nexport const zFunnelInput = z\n .object({\n projectId: z.string().min(1),\n /** Ordered event names. A user counts at step k if they reached at least step k. */\n steps: z.array(z.string().min(1).max(200)).min(2).max(10),\n startDate: zDate,\n endDate: zDate,\n /** Max seconds between the first and last step for a conversion to count. Default 24h. */\n windowSeconds: z.number().int().min(60).max(2_592_000).default(86_400),\n segmentId: z.string().min(1).optional(),\n channelFilter: zChannelFilter,\n /**\n * Decides where `startDate` / `endDate` fall. A funnel has no buckets, so\n * this only moves the window — but a nine-hour window shift changes who is\n * in the funnel.\n */\n timezone: zTimezone.optional(),\n /** Accepted for symmetry with events.timeseries; funnel steps are named explicitly, so nothing is filtered. */\n includeInternal: z.boolean().default(false),\n })\n .refine((input) => input.startDate <= input.endDate, {\n message: \"endDate must be on or after startDate\",\n path: [\"endDate\"],\n });\nexport type FunnelInput = z.input<typeof zFunnelInput>;\n\nexport const zFunnelStep = z.object({\n step: z.number().int().min(1),\n name: z.string(),\n users: z.number().int().nonnegative(),\n /** Percent of the previous step that reached this one. `100` for step 1. */\n conversionRate: z.number(),\n /** Percent of the previous step that did not. `0` for step 1. */\n dropoffRate: z.number(),\n dropoffUsers: z.number().int().nonnegative(),\n});\n\nexport const zFunnelData = z.object({\n steps: z.array(zFunnelStep),\n totalUsers: z.number().int().nonnegative(),\n /** Percent of step-1 users that reached the last step. */\n overallConversionRate: z.number(),\n});\nexport type FunnelData = z.infer<typeof zFunnelData>;\n\nexport const zFunnelResponse = zQueryEnvelope(zFunnelData);\nexport type FunnelResponse = z.infer<typeof zFunnelResponse>;\n\n// ─── retention ──────────────────────────────────────────────────────────────\n\nexport const zRetentionInterval = z.enum([\"day\", \"week\", \"month\"]);\n\nexport const zRetentionInput = z\n .object({\n projectId: z.string().min(1),\n startDate: zDate,\n endDate: zDate,\n interval: zRetentionInterval.default(\"day\"),\n periods: z.number().int().min(1).max(30).default(7),\n startEvent: z.string().min(1).max(200).optional(),\n returnEvent: z.string().min(1).max(200).optional(),\n /** `bounded`: returned in exactly period N. `unbounded`: returned in period N or later. */\n retentionType: z.enum([\"bounded\", \"unbounded\"]).default(\"bounded\"),\n /**\n * `first-ever` (default): the cohort is everyone whose true first activity\n * landed in the window, read from the first-seen aggregate. `startEvent`,\n * `segmentId` and `channelFilter` then constrain only the *returning* side.\n * `first-in-window`: the cohort is selected by scanning events in the window\n * with all filters applied. Slower, but filters apply to cohort selection.\n */\n cohortMode: z.enum([\"first-ever\", \"first-in-window\"]).default(\"first-ever\"),\n segmentId: z.string().min(1).optional(),\n channelFilter: zChannelFilter,\n /**\n * Decides where a cohort day starts, and so which period a return falls in.\n *\n * Honoured under both cohort modes. Note that a non-UTC zone makes\n * `first-ever` read raw events instead of its daily rollup — the rollup is\n * cut on UTC days and cannot be re-cut after the fact — so expect a slower\n * query in exchange for cohorts that match the reader's calendar.\n */\n timezone: zTimezone.optional(),\n /** Accepted for symmetry with events.timeseries; retention reads named or all-event activity and does not yet apply the internal filter. */\n includeInternal: z.boolean().default(false),\n })\n .refine((input) => input.startDate <= input.endDate, {\n message: \"endDate must be on or after startDate\",\n path: [\"endDate\"],\n });\nexport type RetentionInput = z.input<typeof zRetentionInput>;\n\nexport const zRetentionCell = z.object({\n /** `0` is the cohort's own period. */\n period: z.number().int().nonnegative(),\n users: z.number().int().nonnegative(),\n /** Percent of `cohortSize`. */\n rate: z.number(),\n});\n\nexport const zRetentionData = z.object({\n matrix: z.array(\n z.object({\n /** Cohort bucket start, same shape and zone as {@link zBucketStart}. */\n cohortDate: zBucketStart,\n cohortSize: z.number().int().nonnegative(),\n /** Length is `periods + 1`, index-aligned to `period`. */\n retention: z.array(zRetentionCell),\n })\n ),\n /** Unweighted mean rate per period across cohorts. */\n averageRetention: z.array(z.object({ period: z.number().int().nonnegative(), rate: z.number() })),\n interval: zRetentionInterval,\n periods: z.number().int(),\n retentionType: z.enum([\"bounded\", \"unbounded\"]),\n /** Zone the cohort days were cut in. Mirrors `meta.timezone`. */\n timezone: z.string(),\n});\nexport type RetentionData = z.infer<typeof zRetentionData>;\n\nexport const zRetentionResponse = zQueryEnvelope(zRetentionData);\nexport type RetentionResponse = z.infer<typeof zRetentionResponse>;\n\n// ─── traffic ────────────────────────────────────────────────────────────────\n\n/**\n * Session-level traffic for a brand site, served from the hourly rollups.\n * `newVisitors` counts sessions whose device was first seen inside them;\n * `returningVisitors` is the rest. Both are session counts, not people —\n * \"visitor\" is the vocabulary the dashboards already use.\n */\nexport const zTrafficOverviewInput = z\n .object({\n projectId: z.string().min(1),\n startDate: zDate,\n endDate: zDate,\n granularity: zGranularity.default(\"day\"),\n timezone: zTimezone.optional(),\n })\n .refine((input) => input.startDate <= input.endDate, {\n message: \"endDate must be on or after startDate\",\n path: [\"endDate\"],\n });\nexport type TrafficOverviewInput = z.input<typeof zTrafficOverviewInput>;\n\nexport const zTrafficTotals = z.object({\n sessions: z.number().int().nonnegative(),\n pageviews: z.number().int().nonnegative(),\n newVisitors: z.number().int().nonnegative(),\n returningVisitors: z.number().int().nonnegative(),\n /** Percent of sessions that bounced, two decimals. */\n bounceRate: z.number(),\n});\nexport type TrafficTotals = z.infer<typeof zTrafficTotals>;\n\nexport const zTrafficSeriesPoint = zTrafficTotals.extend({ date: zBucketStart });\n\nexport const zTrafficOverviewData = z.object({\n granularity: zGranularity,\n timezone: z.string(),\n totals: zTrafficTotals,\n series: z.array(zTrafficSeriesPoint),\n});\nexport type TrafficOverviewData = z.infer<typeof zTrafficOverviewData>;\nexport const zTrafficOverviewResponse = zQueryEnvelope(zTrafficOverviewData);\nexport type TrafficOverviewResponse = z.infer<typeof zTrafficOverviewResponse>;\n\nexport const zTrafficDimension = z.enum([\"channel\", \"referrer\", \"utm\"]);\nexport type TrafficDimension = z.infer<typeof zTrafficDimension>;\n\nexport const zTrafficSourcesInput = z\n .object({\n projectId: z.string().min(1),\n startDate: zDate,\n endDate: zDate,\n /** `channel`: channel_type · `referrer`: referrer name+type · `utm`: source/medium/campaign. */\n dimension: zTrafficDimension,\n limit: z.number().int().min(1).max(100).default(10),\n timezone: zTimezone.optional(),\n })\n .refine((input) => input.startDate <= input.endDate, {\n message: \"endDate must be on or after startDate\",\n path: [\"endDate\"],\n });\nexport type TrafficSourcesInput = z.input<typeof zTrafficSourcesInput>;\n\nexport const zTrafficSourceRow = zTrafficTotals.extend({\n /** Display key for the row: the channel, the referrer name, or `source / medium / campaign`. */\n key: z.string(),\n channelType: z.string().optional(),\n referrerName: z.string().optional(),\n referrerType: z.string().optional(),\n utmSource: z.string().optional(),\n utmMedium: z.string().optional(),\n utmCampaign: z.string().optional(),\n});\nexport type TrafficSourceRow = z.infer<typeof zTrafficSourceRow>;\n\nexport const zTrafficSourcesData = z.object({\n dimension: zTrafficDimension,\n timezone: z.string(),\n /** Ordered by sessions, descending. */\n rows: z.array(zTrafficSourceRow),\n});\nexport type TrafficSourcesData = z.infer<typeof zTrafficSourcesData>;\nexport const zTrafficSourcesResponse = zQueryEnvelope(zTrafficSourcesData);\nexport type TrafficSourcesResponse = z.infer<typeof zTrafficSourcesResponse>;\n\n// ─── Errors ─────────────────────────────────────────────────────────────────\n\nexport const QUERY_ERROR_CODES = [\n /** 401 — unknown or mismatched credentials. */\n \"unauthorized\",\n /** 403 — the credential's project is not the project asked about. */\n \"project_scope_mismatch\",\n /** 403 — the credential lacks the `query` scope. Provision a query-scoped client. */\n \"query_scope_missing\",\n /** 400 — input failed the schema. `errors` carries the zod issues. */\n \"validation_failed\",\n /** 400 — inputs are individually valid but cannot be served together (e.g. breakdown + segmentId). */\n \"unsupported_combination\",\n /** 410 — the project is being deleted. Permanent; stop asking. */\n \"project_purging\",\n /** 429 — per-credential query rate limit. `Retry-After` set. */\n \"rate_limited\",\n /** 504 — the analytics backend exceeded its statement timeout. Narrow the window. */\n \"query_timeout\",\n /** 500 — unexpected server failure. */\n \"internal_error\",\n] as const;\nexport const zQueryErrorCode = z.enum(QUERY_ERROR_CODES);\nexport type QueryErrorCode = z.infer<typeof zQueryErrorCode>;\n\nexport const zQueryError = z.object({\n status: z.number().int(),\n code: zQueryErrorCode,\n error: z.string(),\n message: z.string().optional(),\n errors: z.unknown().optional(),\n requestId: z.string().optional(),\n});\nexport type QueryError = z.infer<typeof zQueryError>;\n\n/** Paths, so the client and the route handlers cannot drift apart. */\nexport const QUERY_API_PATHS = {\n eventsTimeseries: \"/api/v1/query/events/timeseries\",\n funnel: \"/api/v1/query/funnel\",\n retention: \"/api/v1/query/retention\",\n trafficOverview: \"/api/v1/query/traffic/overview\",\n trafficSources: \"/api/v1/query/traffic/sources\",\n} as const;\n"],"mappings":";;;;;;AAYA,SAAS,SAAS;AAMX,IAAM,eAAe,EAAE,KAAK,CAAC,QAAQ,OAAO,QAAQ,OAAO,CAAC;AAc5D,IAAM,YAAY,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,OAAO,iBAAiB,EAAE,SAAS,yBAAyB,CAAC;AAEzG,SAAS,gBAAgB,OAAwB;AACtD,MAAI;AACF,QAAI,KAAK,eAAe,SAAS,EAAE,UAAU,MAAM,CAAC;AACpD,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAOO,IAAM,iBAAiB,EAC3B,OAAO;AAAA,EACN,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS;AAAA,EAC5C,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS;AAAA,EAC3C,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS;AAAA,EACzC,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS;AAAA,EACzC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS;AAC7C,CAAC,EACA,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