@reopt-ai/data-contract 0.1.0 → 0.3.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 (47) hide show
  1. package/dist/{chunk-IAOPUBJU.js → chunk-2LJ7JLDX.js} +2 -2
  2. package/dist/chunk-2LJ7JLDX.js.map +1 -0
  3. package/dist/{chunk-FRJK7OCQ.js → chunk-3A7WZ7L6.js} +3 -1
  4. package/dist/chunk-3A7WZ7L6.js.map +1 -0
  5. package/dist/{chunk-SJYY42BP.js → chunk-55IWO4S3.js} +9 -5
  6. package/dist/chunk-55IWO4S3.js.map +1 -0
  7. package/dist/chunk-ATPS4UV6.cjs +178 -0
  8. package/dist/chunk-ATPS4UV6.cjs.map +1 -0
  9. package/dist/{chunk-DHSMXB54.cjs → chunk-I2T4HRBM.cjs} +17 -13
  10. package/dist/chunk-I2T4HRBM.cjs.map +1 -0
  11. package/dist/chunk-J4VD3TLV.js +178 -0
  12. package/dist/chunk-J4VD3TLV.js.map +1 -0
  13. package/dist/{chunk-ZQVRSCTW.cjs → chunk-KXEQGD3E.cjs} +2 -2
  14. package/dist/chunk-KXEQGD3E.cjs.map +1 -0
  15. package/dist/{chunk-HRKELGGH.cjs → chunk-RDPPPFGO.cjs} +3 -1
  16. package/dist/{chunk-FRJK7OCQ.js.map → chunk-RDPPPFGO.cjs.map} +1 -1
  17. package/dist/client.cjs +109 -22
  18. package/dist/client.cjs.map +1 -1
  19. package/dist/client.d.cts +29 -3
  20. package/dist/client.d.ts +29 -3
  21. package/dist/client.js +96 -9
  22. package/dist/client.js.map +1 -1
  23. package/dist/control.cjs +45 -0
  24. package/dist/control.cjs.map +1 -0
  25. package/dist/control.d.cts +181 -0
  26. package/dist/control.d.ts +181 -0
  27. package/dist/control.js +45 -0
  28. package/dist/control.js.map +1 -0
  29. package/dist/index.cjs +2 -2
  30. package/dist/index.d.cts +15 -3
  31. package/dist/index.d.ts +15 -3
  32. package/dist/index.js +1 -1
  33. package/dist/ingest.cjs +2 -2
  34. package/dist/ingest.d.cts +9 -7
  35. package/dist/ingest.d.ts +9 -7
  36. package/dist/ingest.js +1 -1
  37. package/dist/query.cjs +5 -3
  38. package/dist/query.cjs.map +1 -1
  39. package/dist/query.d.cts +24 -8
  40. package/dist/query.d.ts +24 -8
  41. package/dist/query.js +4 -2
  42. package/package.json +16 -11
  43. package/dist/chunk-DHSMXB54.cjs.map +0 -1
  44. package/dist/chunk-HRKELGGH.cjs.map +0 -1
  45. package/dist/chunk-IAOPUBJU.js.map +0 -1
  46. package/dist/chunk-SJYY42BP.js.map +0 -1
  47. package/dist/chunk-ZQVRSCTW.cjs.map +0 -1
@@ -0,0 +1,181 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * `POST /api/v1/organizations` · `/api/v1/projects` and friends — the
5
+ * provisioning contract.
6
+ *
7
+ * A project-scoped client credential cannot authenticate the creation of the
8
+ * project it is scoped to, and an organization key cannot authenticate the
9
+ * creation of its own organization. So provisioning runs on two credentials
10
+ * above the client one: a platform key that creates organizations and writes
11
+ * quotas, and an organization key that creates and deletes projects inside one
12
+ * organization.
13
+ *
14
+ * Quota writes sit with the platform key on purpose. Organization keys are held
15
+ * one-per-workspace by the caller and so have a wide exposure surface; a leaked
16
+ * one that could raise its own limits would turn a credential leak into an
17
+ * unbounded bill.
18
+ */
19
+
20
+ declare const PLATFORM_KEY_HEADER = "reopt-platform-key";
21
+ declare const ORG_KEY_HEADER = "reopt-org-key";
22
+ /**
23
+ * The caller's own id for the thing being provisioned.
24
+ *
25
+ * Preferred over an `Idempotency-Key` header because this domain has a real
26
+ * natural key — the caller already has a stable id for the workspace or brand —
27
+ * and a header would make the caller store a second one just to retry safely.
28
+ */
29
+ declare const zExternalId: z.ZodString;
30
+ declare const zCreateOrganizationInput: z.ZodObject<{
31
+ externalId: z.ZodString;
32
+ name: z.ZodString;
33
+ slug: z.ZodOptional<z.ZodString>;
34
+ monthlyEventQuota: z.ZodOptional<z.ZodNumber>;
35
+ monthlyCreditQuota: z.ZodOptional<z.ZodNumber>;
36
+ }, z.core.$strip>;
37
+ type CreateOrganizationInput = z.input<typeof zCreateOrganizationInput>;
38
+ declare const zOrganization: z.ZodObject<{
39
+ id: z.ZodString;
40
+ externalId: z.ZodString;
41
+ name: z.ZodString;
42
+ slug: z.ZodString;
43
+ monthlyEventQuota: z.ZodNumber;
44
+ monthlyCreditQuota: z.ZodNumber;
45
+ }, z.core.$strip>;
46
+ declare const zCreateOrganizationResponse: z.ZodObject<{
47
+ created: z.ZodBoolean;
48
+ organization: z.ZodObject<{
49
+ id: z.ZodString;
50
+ externalId: z.ZodString;
51
+ name: z.ZodString;
52
+ slug: z.ZodString;
53
+ monthlyEventQuota: z.ZodNumber;
54
+ monthlyCreditQuota: z.ZodNumber;
55
+ }, z.core.$strip>;
56
+ orgKey: z.ZodOptional<z.ZodString>;
57
+ }, z.core.$strip>;
58
+ type CreateOrganizationResponse = z.infer<typeof zCreateOrganizationResponse>;
59
+ declare const zRotateOrganizationKeyResponse: z.ZodObject<{
60
+ organizationId: z.ZodString;
61
+ keyPrefix: z.ZodString;
62
+ orgKey: z.ZodString;
63
+ }, z.core.$strip>;
64
+ type RotateOrganizationKeyResponse = z.infer<typeof zRotateOrganizationKeyResponse>;
65
+ declare const zUpdateOrganizationQuotaInput: z.ZodObject<{
66
+ monthlyEventQuota: z.ZodOptional<z.ZodNumber>;
67
+ monthlyCreditQuota: z.ZodOptional<z.ZodNumber>;
68
+ }, z.core.$strip>;
69
+ type UpdateOrganizationQuotaInput = z.input<typeof zUpdateOrganizationQuotaInput>;
70
+ declare const zUpdateOrganizationQuotaResponse: z.ZodObject<{
71
+ organization: z.ZodObject<{
72
+ id: z.ZodString;
73
+ externalId: z.ZodString;
74
+ name: z.ZodString;
75
+ slug: z.ZodString;
76
+ monthlyEventQuota: z.ZodNumber;
77
+ monthlyCreditQuota: z.ZodNumber;
78
+ }, z.core.$strip>;
79
+ }, z.core.$strip>;
80
+ type UpdateOrganizationQuotaResponse = z.infer<typeof zUpdateOrganizationQuotaResponse>;
81
+ declare const zCreateProjectInput: z.ZodObject<{
82
+ externalId: z.ZodString;
83
+ name: z.ZodString;
84
+ domain: z.ZodOptional<z.ZodString>;
85
+ timezone: z.ZodOptional<z.ZodString>;
86
+ retentionDays: z.ZodOptional<z.ZodNumber>;
87
+ }, z.core.$strip>;
88
+ type CreateProjectInput = z.input<typeof zCreateProjectInput>;
89
+ declare const zProject: z.ZodObject<{
90
+ id: z.ZodString;
91
+ externalId: z.ZodString;
92
+ organizationId: z.ZodString;
93
+ name: z.ZodString;
94
+ timezone: z.ZodString;
95
+ retentionDays: z.ZodNullable<z.ZodNumber>;
96
+ }, z.core.$strip>;
97
+ declare const zCreateProjectResponse: z.ZodObject<{
98
+ created: z.ZodBoolean;
99
+ project: z.ZodObject<{
100
+ id: z.ZodString;
101
+ externalId: z.ZodString;
102
+ organizationId: z.ZodString;
103
+ name: z.ZodString;
104
+ timezone: z.ZodString;
105
+ retentionDays: z.ZodNullable<z.ZodNumber>;
106
+ }, z.core.$strip>;
107
+ clients: z.ZodObject<{
108
+ browser: z.ZodObject<{
109
+ id: z.ZodString;
110
+ writeKey: z.ZodString;
111
+ scopes: z.ZodArray<z.ZodString>;
112
+ }, z.core.$strip>;
113
+ server: z.ZodObject<{
114
+ id: z.ZodString;
115
+ clientSecret: z.ZodOptional<z.ZodString>;
116
+ scopes: z.ZodArray<z.ZodString>;
117
+ }, z.core.$strip>;
118
+ }, z.core.$strip>;
119
+ }, z.core.$strip>;
120
+ type CreateProjectResponse = z.infer<typeof zCreateProjectResponse>;
121
+ declare const zRotateClientSecretResponse: z.ZodObject<{
122
+ projectId: z.ZodString;
123
+ clientId: z.ZodString;
124
+ clientSecret: z.ZodString;
125
+ }, z.core.$strip>;
126
+ type RotateClientSecretResponse = z.infer<typeof zRotateClientSecretResponse>;
127
+ declare const zDeleteProjectInput: z.ZodObject<{
128
+ purge: z.ZodLiteral<true>;
129
+ externalId: z.ZodString;
130
+ }, z.core.$strip>;
131
+ type DeleteProjectInput = z.input<typeof zDeleteProjectInput>;
132
+ declare const zDeleteProjectResponse: z.ZodObject<{
133
+ projectId: z.ZodString;
134
+ purge: z.ZodEnum<{
135
+ queued: "queued";
136
+ "already-absent": "already-absent";
137
+ }>;
138
+ purgingAt: z.ZodOptional<z.ZodString>;
139
+ }, z.core.$strip>;
140
+ type DeleteProjectResponse = z.infer<typeof zDeleteProjectResponse>;
141
+ declare const CONTROL_ERROR_CODES: readonly ["unauthorized", "organization_scope_mismatch", "external_id_conflict", "project_external_id_mismatch", "not_found", "validation_failed", "rate_limited", "internal_error"];
142
+ declare const zControlErrorCode: z.ZodEnum<{
143
+ validation_failed: "validation_failed";
144
+ unauthorized: "unauthorized";
145
+ rate_limited: "rate_limited";
146
+ internal_error: "internal_error";
147
+ organization_scope_mismatch: "organization_scope_mismatch";
148
+ external_id_conflict: "external_id_conflict";
149
+ project_external_id_mismatch: "project_external_id_mismatch";
150
+ not_found: "not_found";
151
+ }>;
152
+ type ControlErrorCode = z.infer<typeof zControlErrorCode>;
153
+ declare const zControlError: z.ZodObject<{
154
+ status: z.ZodNumber;
155
+ code: z.ZodEnum<{
156
+ validation_failed: "validation_failed";
157
+ unauthorized: "unauthorized";
158
+ rate_limited: "rate_limited";
159
+ internal_error: "internal_error";
160
+ organization_scope_mismatch: "organization_scope_mismatch";
161
+ external_id_conflict: "external_id_conflict";
162
+ project_external_id_mismatch: "project_external_id_mismatch";
163
+ not_found: "not_found";
164
+ }>;
165
+ error: z.ZodString;
166
+ message: z.ZodOptional<z.ZodString>;
167
+ errors: z.ZodOptional<z.ZodUnknown>;
168
+ requestId: z.ZodOptional<z.ZodString>;
169
+ }, z.core.$strip>;
170
+ type ControlError = z.infer<typeof zControlError>;
171
+ /** Paths, so the client and the route handlers cannot drift apart. */
172
+ declare const CONTROL_API_PATHS: {
173
+ readonly organizations: "/api/v1/organizations";
174
+ readonly organization: (id: string) => string;
175
+ readonly organizationKeys: (id: string) => string;
176
+ readonly projects: "/api/v1/projects";
177
+ readonly project: (id: string) => string;
178
+ readonly clientRotate: (projectId: string, clientId: string) => string;
179
+ };
180
+
181
+ export { CONTROL_API_PATHS, CONTROL_ERROR_CODES, type ControlError, type ControlErrorCode, type CreateOrganizationInput, type CreateOrganizationResponse, type CreateProjectInput, type CreateProjectResponse, type DeleteProjectInput, type DeleteProjectResponse, ORG_KEY_HEADER, PLATFORM_KEY_HEADER, type RotateClientSecretResponse, type RotateOrganizationKeyResponse, type UpdateOrganizationQuotaInput, type UpdateOrganizationQuotaResponse, zControlError, zControlErrorCode, zCreateOrganizationInput, zCreateOrganizationResponse, zCreateProjectInput, zCreateProjectResponse, zDeleteProjectInput, zDeleteProjectResponse, zExternalId, zOrganization, zProject, zRotateClientSecretResponse, zRotateOrganizationKeyResponse, zUpdateOrganizationQuotaInput, zUpdateOrganizationQuotaResponse };
@@ -0,0 +1,181 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * `POST /api/v1/organizations` · `/api/v1/projects` and friends — the
5
+ * provisioning contract.
6
+ *
7
+ * A project-scoped client credential cannot authenticate the creation of the
8
+ * project it is scoped to, and an organization key cannot authenticate the
9
+ * creation of its own organization. So provisioning runs on two credentials
10
+ * above the client one: a platform key that creates organizations and writes
11
+ * quotas, and an organization key that creates and deletes projects inside one
12
+ * organization.
13
+ *
14
+ * Quota writes sit with the platform key on purpose. Organization keys are held
15
+ * one-per-workspace by the caller and so have a wide exposure surface; a leaked
16
+ * one that could raise its own limits would turn a credential leak into an
17
+ * unbounded bill.
18
+ */
19
+
20
+ declare const PLATFORM_KEY_HEADER = "reopt-platform-key";
21
+ declare const ORG_KEY_HEADER = "reopt-org-key";
22
+ /**
23
+ * The caller's own id for the thing being provisioned.
24
+ *
25
+ * Preferred over an `Idempotency-Key` header because this domain has a real
26
+ * natural key — the caller already has a stable id for the workspace or brand —
27
+ * and a header would make the caller store a second one just to retry safely.
28
+ */
29
+ declare const zExternalId: z.ZodString;
30
+ declare const zCreateOrganizationInput: z.ZodObject<{
31
+ externalId: z.ZodString;
32
+ name: z.ZodString;
33
+ slug: z.ZodOptional<z.ZodString>;
34
+ monthlyEventQuota: z.ZodOptional<z.ZodNumber>;
35
+ monthlyCreditQuota: z.ZodOptional<z.ZodNumber>;
36
+ }, z.core.$strip>;
37
+ type CreateOrganizationInput = z.input<typeof zCreateOrganizationInput>;
38
+ declare const zOrganization: z.ZodObject<{
39
+ id: z.ZodString;
40
+ externalId: z.ZodString;
41
+ name: z.ZodString;
42
+ slug: z.ZodString;
43
+ monthlyEventQuota: z.ZodNumber;
44
+ monthlyCreditQuota: z.ZodNumber;
45
+ }, z.core.$strip>;
46
+ declare const zCreateOrganizationResponse: z.ZodObject<{
47
+ created: z.ZodBoolean;
48
+ organization: z.ZodObject<{
49
+ id: z.ZodString;
50
+ externalId: z.ZodString;
51
+ name: z.ZodString;
52
+ slug: z.ZodString;
53
+ monthlyEventQuota: z.ZodNumber;
54
+ monthlyCreditQuota: z.ZodNumber;
55
+ }, z.core.$strip>;
56
+ orgKey: z.ZodOptional<z.ZodString>;
57
+ }, z.core.$strip>;
58
+ type CreateOrganizationResponse = z.infer<typeof zCreateOrganizationResponse>;
59
+ declare const zRotateOrganizationKeyResponse: z.ZodObject<{
60
+ organizationId: z.ZodString;
61
+ keyPrefix: z.ZodString;
62
+ orgKey: z.ZodString;
63
+ }, z.core.$strip>;
64
+ type RotateOrganizationKeyResponse = z.infer<typeof zRotateOrganizationKeyResponse>;
65
+ declare const zUpdateOrganizationQuotaInput: z.ZodObject<{
66
+ monthlyEventQuota: z.ZodOptional<z.ZodNumber>;
67
+ monthlyCreditQuota: z.ZodOptional<z.ZodNumber>;
68
+ }, z.core.$strip>;
69
+ type UpdateOrganizationQuotaInput = z.input<typeof zUpdateOrganizationQuotaInput>;
70
+ declare const zUpdateOrganizationQuotaResponse: z.ZodObject<{
71
+ organization: z.ZodObject<{
72
+ id: z.ZodString;
73
+ externalId: z.ZodString;
74
+ name: z.ZodString;
75
+ slug: z.ZodString;
76
+ monthlyEventQuota: z.ZodNumber;
77
+ monthlyCreditQuota: z.ZodNumber;
78
+ }, z.core.$strip>;
79
+ }, z.core.$strip>;
80
+ type UpdateOrganizationQuotaResponse = z.infer<typeof zUpdateOrganizationQuotaResponse>;
81
+ declare const zCreateProjectInput: z.ZodObject<{
82
+ externalId: z.ZodString;
83
+ name: z.ZodString;
84
+ domain: z.ZodOptional<z.ZodString>;
85
+ timezone: z.ZodOptional<z.ZodString>;
86
+ retentionDays: z.ZodOptional<z.ZodNumber>;
87
+ }, z.core.$strip>;
88
+ type CreateProjectInput = z.input<typeof zCreateProjectInput>;
89
+ declare const zProject: z.ZodObject<{
90
+ id: z.ZodString;
91
+ externalId: z.ZodString;
92
+ organizationId: z.ZodString;
93
+ name: z.ZodString;
94
+ timezone: z.ZodString;
95
+ retentionDays: z.ZodNullable<z.ZodNumber>;
96
+ }, z.core.$strip>;
97
+ declare const zCreateProjectResponse: z.ZodObject<{
98
+ created: z.ZodBoolean;
99
+ project: z.ZodObject<{
100
+ id: z.ZodString;
101
+ externalId: z.ZodString;
102
+ organizationId: z.ZodString;
103
+ name: z.ZodString;
104
+ timezone: z.ZodString;
105
+ retentionDays: z.ZodNullable<z.ZodNumber>;
106
+ }, z.core.$strip>;
107
+ clients: z.ZodObject<{
108
+ browser: z.ZodObject<{
109
+ id: z.ZodString;
110
+ writeKey: z.ZodString;
111
+ scopes: z.ZodArray<z.ZodString>;
112
+ }, z.core.$strip>;
113
+ server: z.ZodObject<{
114
+ id: z.ZodString;
115
+ clientSecret: z.ZodOptional<z.ZodString>;
116
+ scopes: z.ZodArray<z.ZodString>;
117
+ }, z.core.$strip>;
118
+ }, z.core.$strip>;
119
+ }, z.core.$strip>;
120
+ type CreateProjectResponse = z.infer<typeof zCreateProjectResponse>;
121
+ declare const zRotateClientSecretResponse: z.ZodObject<{
122
+ projectId: z.ZodString;
123
+ clientId: z.ZodString;
124
+ clientSecret: z.ZodString;
125
+ }, z.core.$strip>;
126
+ type RotateClientSecretResponse = z.infer<typeof zRotateClientSecretResponse>;
127
+ declare const zDeleteProjectInput: z.ZodObject<{
128
+ purge: z.ZodLiteral<true>;
129
+ externalId: z.ZodString;
130
+ }, z.core.$strip>;
131
+ type DeleteProjectInput = z.input<typeof zDeleteProjectInput>;
132
+ declare const zDeleteProjectResponse: z.ZodObject<{
133
+ projectId: z.ZodString;
134
+ purge: z.ZodEnum<{
135
+ queued: "queued";
136
+ "already-absent": "already-absent";
137
+ }>;
138
+ purgingAt: z.ZodOptional<z.ZodString>;
139
+ }, z.core.$strip>;
140
+ type DeleteProjectResponse = z.infer<typeof zDeleteProjectResponse>;
141
+ declare const CONTROL_ERROR_CODES: readonly ["unauthorized", "organization_scope_mismatch", "external_id_conflict", "project_external_id_mismatch", "not_found", "validation_failed", "rate_limited", "internal_error"];
142
+ declare const zControlErrorCode: z.ZodEnum<{
143
+ validation_failed: "validation_failed";
144
+ unauthorized: "unauthorized";
145
+ rate_limited: "rate_limited";
146
+ internal_error: "internal_error";
147
+ organization_scope_mismatch: "organization_scope_mismatch";
148
+ external_id_conflict: "external_id_conflict";
149
+ project_external_id_mismatch: "project_external_id_mismatch";
150
+ not_found: "not_found";
151
+ }>;
152
+ type ControlErrorCode = z.infer<typeof zControlErrorCode>;
153
+ declare const zControlError: z.ZodObject<{
154
+ status: z.ZodNumber;
155
+ code: z.ZodEnum<{
156
+ validation_failed: "validation_failed";
157
+ unauthorized: "unauthorized";
158
+ rate_limited: "rate_limited";
159
+ internal_error: "internal_error";
160
+ organization_scope_mismatch: "organization_scope_mismatch";
161
+ external_id_conflict: "external_id_conflict";
162
+ project_external_id_mismatch: "project_external_id_mismatch";
163
+ not_found: "not_found";
164
+ }>;
165
+ error: z.ZodString;
166
+ message: z.ZodOptional<z.ZodString>;
167
+ errors: z.ZodOptional<z.ZodUnknown>;
168
+ requestId: z.ZodOptional<z.ZodString>;
169
+ }, z.core.$strip>;
170
+ type ControlError = z.infer<typeof zControlError>;
171
+ /** Paths, so the client and the route handlers cannot drift apart. */
172
+ declare const CONTROL_API_PATHS: {
173
+ readonly organizations: "/api/v1/organizations";
174
+ readonly organization: (id: string) => string;
175
+ readonly organizationKeys: (id: string) => string;
176
+ readonly projects: "/api/v1/projects";
177
+ readonly project: (id: string) => string;
178
+ readonly clientRotate: (projectId: string, clientId: string) => string;
179
+ };
180
+
181
+ export { CONTROL_API_PATHS, CONTROL_ERROR_CODES, type ControlError, type ControlErrorCode, type CreateOrganizationInput, type CreateOrganizationResponse, type CreateProjectInput, type CreateProjectResponse, type DeleteProjectInput, type DeleteProjectResponse, ORG_KEY_HEADER, PLATFORM_KEY_HEADER, type RotateClientSecretResponse, type RotateOrganizationKeyResponse, type UpdateOrganizationQuotaInput, type UpdateOrganizationQuotaResponse, zControlError, zControlErrorCode, zCreateOrganizationInput, zCreateOrganizationResponse, zCreateProjectInput, zCreateProjectResponse, zDeleteProjectInput, zDeleteProjectResponse, zExternalId, zOrganization, zProject, zRotateClientSecretResponse, zRotateOrganizationKeyResponse, zUpdateOrganizationQuotaInput, zUpdateOrganizationQuotaResponse };
@@ -0,0 +1,45 @@
1
+ import {
2
+ CONTROL_API_PATHS,
3
+ CONTROL_ERROR_CODES,
4
+ ORG_KEY_HEADER,
5
+ PLATFORM_KEY_HEADER,
6
+ zControlError,
7
+ zControlErrorCode,
8
+ zCreateOrganizationInput,
9
+ zCreateOrganizationResponse,
10
+ zCreateProjectInput,
11
+ zCreateProjectResponse,
12
+ zDeleteProjectInput,
13
+ zDeleteProjectResponse,
14
+ zExternalId,
15
+ zOrganization,
16
+ zProject,
17
+ zRotateClientSecretResponse,
18
+ zRotateOrganizationKeyResponse,
19
+ zUpdateOrganizationQuotaInput,
20
+ zUpdateOrganizationQuotaResponse
21
+ } from "./chunk-J4VD3TLV.js";
22
+ import "./chunk-55IWO4S3.js";
23
+ import "./chunk-2LJ7JLDX.js";
24
+ export {
25
+ CONTROL_API_PATHS,
26
+ CONTROL_ERROR_CODES,
27
+ ORG_KEY_HEADER,
28
+ PLATFORM_KEY_HEADER,
29
+ zControlError,
30
+ zControlErrorCode,
31
+ zCreateOrganizationInput,
32
+ zCreateOrganizationResponse,
33
+ zCreateProjectInput,
34
+ zCreateProjectResponse,
35
+ zDeleteProjectInput,
36
+ zDeleteProjectResponse,
37
+ zExternalId,
38
+ zOrganization,
39
+ zProject,
40
+ zRotateClientSecretResponse,
41
+ zRotateOrganizationKeyResponse,
42
+ zUpdateOrganizationQuotaInput,
43
+ zUpdateOrganizationQuotaResponse
44
+ };
45
+ //# sourceMappingURL=control.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/dist/index.cjs CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
 
11
11
 
12
- var _chunkZQVRSCTWcjs = require('./chunk-ZQVRSCTW.cjs');
12
+ var _chunkKXEQGD3Ecjs = require('./chunk-KXEQGD3E.cjs');
13
13
 
14
14
 
15
15
 
@@ -21,5 +21,5 @@ var _chunkZQVRSCTWcjs = require('./chunk-ZQVRSCTW.cjs');
21
21
 
22
22
 
23
23
 
24
- exports.CLIENT_ID_HEADER = _chunkZQVRSCTWcjs.CLIENT_ID_HEADER; exports.CLIENT_SECRET_HEADER = _chunkZQVRSCTWcjs.CLIENT_SECRET_HEADER; exports.CONTRACT_VERSION = _chunkZQVRSCTWcjs.CONTRACT_VERSION; exports.CONTRACT_VERSION_HEADER = _chunkZQVRSCTWcjs.CONTRACT_VERSION_HEADER; exports.DEVICE_ID_HEADER = _chunkZQVRSCTWcjs.DEVICE_ID_HEADER; exports.DataApiError = _chunkZQVRSCTWcjs.DataApiError; exports.REQUEST_ID_HEADER = _chunkZQVRSCTWcjs.REQUEST_ID_HEADER; exports.WRITE_KEY_HEADER = _chunkZQVRSCTWcjs.WRITE_KEY_HEADER; exports.zDate = _chunkZQVRSCTWcjs.zDate; exports.zInstant = _chunkZQVRSCTWcjs.zInstant;
24
+ exports.CLIENT_ID_HEADER = _chunkKXEQGD3Ecjs.CLIENT_ID_HEADER; exports.CLIENT_SECRET_HEADER = _chunkKXEQGD3Ecjs.CLIENT_SECRET_HEADER; exports.CONTRACT_VERSION = _chunkKXEQGD3Ecjs.CONTRACT_VERSION; exports.CONTRACT_VERSION_HEADER = _chunkKXEQGD3Ecjs.CONTRACT_VERSION_HEADER; exports.DEVICE_ID_HEADER = _chunkKXEQGD3Ecjs.DEVICE_ID_HEADER; exports.DataApiError = _chunkKXEQGD3Ecjs.DataApiError; exports.REQUEST_ID_HEADER = _chunkKXEQGD3Ecjs.REQUEST_ID_HEADER; exports.WRITE_KEY_HEADER = _chunkKXEQGD3Ecjs.WRITE_KEY_HEADER; exports.zDate = _chunkKXEQGD3Ecjs.zDate; exports.zInstant = _chunkKXEQGD3Ecjs.zInstant;
25
25
  //# sourceMappingURL=index.cjs.map
package/dist/index.d.cts CHANGED
@@ -8,7 +8,8 @@ import { z } from 'zod';
8
8
  * `@reopt-ai/data-contract` this module — version, shared primitives, errors
9
9
  * `@reopt-ai/data-contract/ingest` POST /api/track request + response schemas
10
10
  * `@reopt-ai/data-contract/query` POST /api/v1/query/* request + response schemas
11
- * `@reopt-ai/data-contract/client` createDataClient() typed fetch over both
11
+ * `@reopt-ai/data-contract/control` provisioning request + response schemas
12
+ * `@reopt-ai/data-contract/client` createDataClient() — typed fetch over all
12
13
  *
13
14
  * Only `/client` touches `fetch`; everything else is pure zod. The single
14
15
  * runtime dependency is zod, deliberately — consumers bundle this.
@@ -19,7 +20,7 @@ import { z } from 'zod';
19
20
  * The server echoes the version it was built against in `x-reopt-contract-version`;
20
21
  * `createDataClient` surfaces a mismatch rather than guessing.
21
22
  */
22
- declare const CONTRACT_VERSION = "0.1.0";
23
+ declare const CONTRACT_VERSION = "0.3.0";
23
24
  /** Response header carrying the server's contract version. */
24
25
  declare const CONTRACT_VERSION_HEADER = "x-reopt-contract-version";
25
26
  /** Request header names shared by the ingest and query planes. */
@@ -44,6 +45,17 @@ interface ClientCredentials {
44
45
  clientId: string;
45
46
  clientSecret: string;
46
47
  }
48
+ /**
49
+ * Credentials are optional on the client itself because the provisioning
50
+ * surface does not use them — it authenticates per call with a platform or
51
+ * organization key. A caller that only provisions should not have to invent an
52
+ * empty client id to satisfy a constructor.
53
+ *
54
+ * Reaching ingest or query without them fails with `credentials_missing`
55
+ * rather than sending an unauthenticated request and reporting the 401 as a
56
+ * server problem.
57
+ */
58
+ type OptionalClientCredentials = Partial<ClientCredentials>;
47
59
  /**
48
60
  * Every non-2xx response from either plane, plus the two failures the client
49
61
  * itself raises (`contract_mismatch`, `network_error`).
@@ -80,4 +92,4 @@ declare class DataApiError extends Error {
80
92
  static is(value: unknown): value is DataApiError;
81
93
  }
82
94
 
83
- export { CLIENT_ID_HEADER, CLIENT_SECRET_HEADER, CONTRACT_VERSION, CONTRACT_VERSION_HEADER, type ClientCredentials, DEVICE_ID_HEADER, DataApiError, REQUEST_ID_HEADER, WRITE_KEY_HEADER, zDate, zInstant };
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 };
package/dist/index.d.ts CHANGED
@@ -8,7 +8,8 @@ import { z } from 'zod';
8
8
  * `@reopt-ai/data-contract` this module — version, shared primitives, errors
9
9
  * `@reopt-ai/data-contract/ingest` POST /api/track request + response schemas
10
10
  * `@reopt-ai/data-contract/query` POST /api/v1/query/* request + response schemas
11
- * `@reopt-ai/data-contract/client` createDataClient() typed fetch over both
11
+ * `@reopt-ai/data-contract/control` provisioning request + response schemas
12
+ * `@reopt-ai/data-contract/client` createDataClient() — typed fetch over all
12
13
  *
13
14
  * Only `/client` touches `fetch`; everything else is pure zod. The single
14
15
  * runtime dependency is zod, deliberately — consumers bundle this.
@@ -19,7 +20,7 @@ import { z } from 'zod';
19
20
  * The server echoes the version it was built against in `x-reopt-contract-version`;
20
21
  * `createDataClient` surfaces a mismatch rather than guessing.
21
22
  */
22
- declare const CONTRACT_VERSION = "0.1.0";
23
+ declare const CONTRACT_VERSION = "0.3.0";
23
24
  /** Response header carrying the server's contract version. */
24
25
  declare const CONTRACT_VERSION_HEADER = "x-reopt-contract-version";
25
26
  /** Request header names shared by the ingest and query planes. */
@@ -44,6 +45,17 @@ interface ClientCredentials {
44
45
  clientId: string;
45
46
  clientSecret: string;
46
47
  }
48
+ /**
49
+ * Credentials are optional on the client itself because the provisioning
50
+ * surface does not use them — it authenticates per call with a platform or
51
+ * organization key. A caller that only provisions should not have to invent an
52
+ * empty client id to satisfy a constructor.
53
+ *
54
+ * Reaching ingest or query without them fails with `credentials_missing`
55
+ * rather than sending an unauthenticated request and reporting the 401 as a
56
+ * server problem.
57
+ */
58
+ type OptionalClientCredentials = Partial<ClientCredentials>;
47
59
  /**
48
60
  * Every non-2xx response from either plane, plus the two failures the client
49
61
  * itself raises (`contract_mismatch`, `network_error`).
@@ -80,4 +92,4 @@ declare class DataApiError extends Error {
80
92
  static is(value: unknown): value is DataApiError;
81
93
  }
82
94
 
83
- export { CLIENT_ID_HEADER, CLIENT_SECRET_HEADER, CONTRACT_VERSION, CONTRACT_VERSION_HEADER, type ClientCredentials, DEVICE_ID_HEADER, DataApiError, REQUEST_ID_HEADER, WRITE_KEY_HEADER, zDate, zInstant };
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 };
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  WRITE_KEY_HEADER,
10
10
  zDate,
11
11
  zInstant
12
- } from "./chunk-IAOPUBJU.js";
12
+ } from "./chunk-2LJ7JLDX.js";
13
13
  export {
14
14
  CLIENT_ID_HEADER,
15
15
  CLIENT_SECRET_HEADER,
package/dist/ingest.cjs CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
 
20
20
 
21
- var _chunkHRKELGGHcjs = require('./chunk-HRKELGGH.cjs');
21
+ var _chunkRDPPPFGOcjs = require('./chunk-RDPPPFGO.cjs');
22
22
 
23
23
 
24
24
 
@@ -39,5 +39,5 @@ var _chunkHRKELGGHcjs = require('./chunk-HRKELGGH.cjs');
39
39
 
40
40
 
41
41
 
42
- exports.INGEST_ERROR_CODES = _chunkHRKELGGHcjs.INGEST_ERROR_CODES; exports.INGEST_MODES = _chunkHRKELGGHcjs.INGEST_MODES; exports.INGEST_REJECTION_REASONS = _chunkHRKELGGHcjs.INGEST_REJECTION_REASONS; exports.MAX_TRACK_PAYLOAD_BYTES = _chunkHRKELGGHcjs.MAX_TRACK_PAYLOAD_BYTES; exports.RESERVED_EVENT_NAMES = _chunkHRKELGGHcjs.RESERVED_EVENT_NAMES; exports.reconcileIngestResponse = _chunkHRKELGGHcjs.reconcileIngestResponse; exports.zDecrementPayload = _chunkHRKELGGHcjs.zDecrementPayload; exports.zIdentifyPayload = _chunkHRKELGGHcjs.zIdentifyPayload; exports.zIncrementPayload = _chunkHRKELGGHcjs.zIncrementPayload; exports.zIngestAcceptedResponse = _chunkHRKELGGHcjs.zIngestAcceptedResponse; exports.zIngestError = _chunkHRKELGGHcjs.zIngestError; exports.zIngestErrorCode = _chunkHRKELGGHcjs.zIngestErrorCode; exports.zIngestMode = _chunkHRKELGGHcjs.zIngestMode; exports.zIngestOkResponse = _chunkHRKELGGHcjs.zIngestOkResponse; exports.zIngestRejection = _chunkHRKELGGHcjs.zIngestRejection; exports.zIngestRejectionReason = _chunkHRKELGGHcjs.zIngestRejectionReason; exports.zIngestResponse = _chunkHRKELGGHcjs.zIngestResponse; exports.zTrackHandlerPayload = _chunkHRKELGGHcjs.zTrackHandlerPayload; exports.zTrackPayload = _chunkHRKELGGHcjs.zTrackPayload;
42
+ exports.INGEST_ERROR_CODES = _chunkRDPPPFGOcjs.INGEST_ERROR_CODES; exports.INGEST_MODES = _chunkRDPPPFGOcjs.INGEST_MODES; exports.INGEST_REJECTION_REASONS = _chunkRDPPPFGOcjs.INGEST_REJECTION_REASONS; exports.MAX_TRACK_PAYLOAD_BYTES = _chunkRDPPPFGOcjs.MAX_TRACK_PAYLOAD_BYTES; exports.RESERVED_EVENT_NAMES = _chunkRDPPPFGOcjs.RESERVED_EVENT_NAMES; exports.reconcileIngestResponse = _chunkRDPPPFGOcjs.reconcileIngestResponse; exports.zDecrementPayload = _chunkRDPPPFGOcjs.zDecrementPayload; exports.zIdentifyPayload = _chunkRDPPPFGOcjs.zIdentifyPayload; exports.zIncrementPayload = _chunkRDPPPFGOcjs.zIncrementPayload; exports.zIngestAcceptedResponse = _chunkRDPPPFGOcjs.zIngestAcceptedResponse; exports.zIngestError = _chunkRDPPPFGOcjs.zIngestError; exports.zIngestErrorCode = _chunkRDPPPFGOcjs.zIngestErrorCode; exports.zIngestMode = _chunkRDPPPFGOcjs.zIngestMode; exports.zIngestOkResponse = _chunkRDPPPFGOcjs.zIngestOkResponse; exports.zIngestRejection = _chunkRDPPPFGOcjs.zIngestRejection; exports.zIngestRejectionReason = _chunkRDPPPFGOcjs.zIngestRejectionReason; exports.zIngestResponse = _chunkRDPPPFGOcjs.zIngestResponse; exports.zTrackHandlerPayload = _chunkRDPPPFGOcjs.zTrackHandlerPayload; exports.zTrackPayload = _chunkRDPPPFGOcjs.zTrackPayload;
43
43
  //# sourceMappingURL=ingest.cjs.map
package/dist/ingest.d.cts CHANGED
@@ -232,33 +232,35 @@ declare function reconcileIngestResponse(response: IngestResponse, sentCount: nu
232
232
  * Stable machine-readable codes. Branch on these, never on `error`/`message`,
233
233
  * which are prose and may be reworded.
234
234
  */
235
- 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", "internal_error"];
235
+ 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
236
  declare const zIngestErrorCode: z.ZodEnum<{
237
- unauthorized: "unauthorized";
238
237
  validation_failed: "validation_failed";
239
- rate_limited: "rate_limited";
240
- internal_error: "internal_error";
238
+ unauthorized: "unauthorized";
241
239
  invalid_json: "invalid_json";
242
240
  payload_too_large: "payload_too_large";
243
241
  empty_batch: "empty_batch";
244
242
  alias_unsupported: "alias_unsupported";
245
243
  project_without_organization: "project_without_organization";
244
+ rate_limited: "rate_limited";
246
245
  quota_exceeded: "quota_exceeded";
246
+ project_purging: "project_purging";
247
+ internal_error: "internal_error";
247
248
  }>;
248
249
  type IngestErrorCode = z.infer<typeof zIngestErrorCode>;
249
250
  declare const zIngestError: z.ZodObject<{
250
251
  status: z.ZodNumber;
251
252
  code: z.ZodEnum<{
252
- unauthorized: "unauthorized";
253
253
  validation_failed: "validation_failed";
254
- rate_limited: "rate_limited";
255
- internal_error: "internal_error";
254
+ unauthorized: "unauthorized";
256
255
  invalid_json: "invalid_json";
257
256
  payload_too_large: "payload_too_large";
258
257
  empty_batch: "empty_batch";
259
258
  alias_unsupported: "alias_unsupported";
260
259
  project_without_organization: "project_without_organization";
260
+ rate_limited: "rate_limited";
261
261
  quota_exceeded: "quota_exceeded";
262
+ project_purging: "project_purging";
263
+ internal_error: "internal_error";
262
264
  }>;
263
265
  error: z.ZodString;
264
266
  message: z.ZodOptional<z.ZodString>;
package/dist/ingest.d.ts CHANGED
@@ -232,33 +232,35 @@ declare function reconcileIngestResponse(response: IngestResponse, sentCount: nu
232
232
  * Stable machine-readable codes. Branch on these, never on `error`/`message`,
233
233
  * which are prose and may be reworded.
234
234
  */
235
- 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", "internal_error"];
235
+ 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
236
  declare const zIngestErrorCode: z.ZodEnum<{
237
- unauthorized: "unauthorized";
238
237
  validation_failed: "validation_failed";
239
- rate_limited: "rate_limited";
240
- internal_error: "internal_error";
238
+ unauthorized: "unauthorized";
241
239
  invalid_json: "invalid_json";
242
240
  payload_too_large: "payload_too_large";
243
241
  empty_batch: "empty_batch";
244
242
  alias_unsupported: "alias_unsupported";
245
243
  project_without_organization: "project_without_organization";
244
+ rate_limited: "rate_limited";
246
245
  quota_exceeded: "quota_exceeded";
246
+ project_purging: "project_purging";
247
+ internal_error: "internal_error";
247
248
  }>;
248
249
  type IngestErrorCode = z.infer<typeof zIngestErrorCode>;
249
250
  declare const zIngestError: z.ZodObject<{
250
251
  status: z.ZodNumber;
251
252
  code: z.ZodEnum<{
252
- unauthorized: "unauthorized";
253
253
  validation_failed: "validation_failed";
254
- rate_limited: "rate_limited";
255
- internal_error: "internal_error";
254
+ unauthorized: "unauthorized";
256
255
  invalid_json: "invalid_json";
257
256
  payload_too_large: "payload_too_large";
258
257
  empty_batch: "empty_batch";
259
258
  alias_unsupported: "alias_unsupported";
260
259
  project_without_organization: "project_without_organization";
260
+ rate_limited: "rate_limited";
261
261
  quota_exceeded: "quota_exceeded";
262
+ project_purging: "project_purging";
263
+ internal_error: "internal_error";
262
264
  }>;
263
265
  error: z.ZodString;
264
266
  message: z.ZodOptional<z.ZodString>;
package/dist/ingest.js CHANGED
@@ -18,7 +18,7 @@ import {
18
18
  zIngestResponse,
19
19
  zTrackHandlerPayload,
20
20
  zTrackPayload
21
- } from "./chunk-FRJK7OCQ.js";
21
+ } from "./chunk-3A7WZ7L6.js";
22
22
  export {
23
23
  INGEST_ERROR_CODES,
24
24
  INGEST_MODES,