@shipeasy/openapi 1.0.0 → 1.1.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 (39) hide show
  1. package/dist/index.d.ts +9 -7
  2. package/dist/index.js +484 -2665
  3. package/dist/resources/alert-rules.d.ts +48 -0
  4. package/dist/resources/alert-rules.js +66 -0
  5. package/dist/resources/configs.d.ts +6 -2
  6. package/dist/resources/configs.js +67 -2375
  7. package/dist/resources/experiments.d.ts +88 -2
  8. package/dist/resources/experiments.js +138 -98
  9. package/dist/resources/gates.d.ts +51 -8
  10. package/dist/resources/gates.js +102 -70
  11. package/dist/resources/index.d.ts +156 -10
  12. package/dist/resources/index.js +483 -2664
  13. package/dist/resources/killswitches.d.ts +6 -2
  14. package/dist/resources/killswitches.js +113 -2412
  15. package/dist/resources/universes.d.ts +7 -4
  16. package/dist/resources/universes.js +30 -20
  17. package/dist/schemas/alert-rules.d.ts +43 -0
  18. package/dist/schemas/alert-rules.js +27 -0
  19. package/dist/schemas/configs.d.ts +154 -0
  20. package/dist/schemas/configs.js +134 -0
  21. package/dist/schemas/constants.d.ts +6 -0
  22. package/dist/schemas/constants.js +7 -0
  23. package/dist/schemas/experiments.d.ts +245 -0
  24. package/dist/schemas/experiments.js +216 -0
  25. package/dist/schemas/folder.d.ts +10 -0
  26. package/dist/schemas/folder.js +8 -0
  27. package/dist/schemas/gates.d.ts +304 -0
  28. package/dist/schemas/gates.js +172 -0
  29. package/dist/schemas/index.d.ts +11 -0
  30. package/dist/schemas/index.js +729 -0
  31. package/dist/schemas/killswitches.d.ts +110 -0
  32. package/dist/schemas/killswitches.js +226 -0
  33. package/dist/schemas/metric-name.d.ts +5 -0
  34. package/dist/schemas/metric-name.js +6 -0
  35. package/dist/schemas/pagination.d.ts +37 -0
  36. package/dist/schemas/pagination.js +44 -0
  37. package/dist/schemas/universes.d.ts +35 -0
  38. package/dist/schemas/universes.js +55 -0
  39. package/package.json +13 -10
@@ -0,0 +1,245 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const experimentInlineMetricSchema: z.ZodObject<{
4
+ name: z.ZodOptional<z.ZodString>;
5
+ query: z.ZodString;
6
+ }, z.core.$strip>;
7
+ type ExperimentInlineMetric = z.infer<typeof experimentInlineMetricSchema>;
8
+ declare const experimentNameSchema: z.ZodString;
9
+ declare const experimentGroupSchema: z.ZodObject<{
10
+ name: z.ZodString;
11
+ weight: z.ZodNumber;
12
+ params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
13
+ }, z.core.$strip>;
14
+ declare const paramSchemaSchema: z.ZodRecord<z.ZodString, z.ZodEnum<{
15
+ string: "string";
16
+ number: "number";
17
+ bool: "bool";
18
+ }>>;
19
+ declare const bucketBySchema: z.ZodEnum<{
20
+ user_id: "user_id";
21
+ session_id: "session_id";
22
+ device_id: "device_id";
23
+ }>;
24
+ declare const experimentCreateSchema: z.ZodObject<{
25
+ name: z.ZodString;
26
+ description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
27
+ hypothesis: z.ZodDefault<z.ZodNullable<z.ZodString>>;
28
+ tag: z.ZodDefault<z.ZodNullable<z.ZodString>>;
29
+ owner_email: z.ZodDefault<z.ZodNullable<z.ZodString>>;
30
+ audience: z.ZodDefault<z.ZodNullable<z.ZodString>>;
31
+ bucket_by: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
32
+ user_id: "user_id";
33
+ session_id: "session_id";
34
+ device_id: "device_id";
35
+ }>>>;
36
+ folder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
37
+ universe: z.ZodString;
38
+ targeting_gate: z.ZodDefault<z.ZodNullable<z.ZodString>>;
39
+ allocation_pct: z.ZodDefault<z.ZodNumber>;
40
+ salt: z.ZodOptional<z.ZodString>;
41
+ params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodEnum<{
42
+ string: "string";
43
+ number: "number";
44
+ bool: "bool";
45
+ }>>>;
46
+ groups: z.ZodArray<z.ZodObject<{
47
+ name: z.ZodString;
48
+ weight: z.ZodNumber;
49
+ params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
50
+ }, z.core.$strip>>;
51
+ significance_threshold: z.ZodDefault<z.ZodNumber>;
52
+ min_runtime_days: z.ZodDefault<z.ZodNumber>;
53
+ min_sample_size: z.ZodDefault<z.ZodNumber>;
54
+ sequential_testing: z.ZodDefault<z.ZodBoolean>;
55
+ goal_metric: z.ZodOptional<z.ZodObject<{
56
+ name: z.ZodOptional<z.ZodString>;
57
+ query: z.ZodString;
58
+ }, z.core.$strip>>;
59
+ guardrail_metrics: z.ZodDefault<z.ZodArray<z.ZodObject<{
60
+ name: z.ZodOptional<z.ZodString>;
61
+ query: z.ZodString;
62
+ }, z.core.$strip>>>;
63
+ }, z.core.$strip>;
64
+ declare const experimentUpdateSchema: z.ZodObject<{
65
+ name: z.ZodOptional<z.ZodString>;
66
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
67
+ hypothesis: z.ZodOptional<z.ZodNullable<z.ZodString>>;
68
+ tag: z.ZodOptional<z.ZodNullable<z.ZodString>>;
69
+ owner_email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
70
+ audience: z.ZodOptional<z.ZodNullable<z.ZodString>>;
71
+ bucket_by: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
72
+ user_id: "user_id";
73
+ session_id: "session_id";
74
+ device_id: "device_id";
75
+ }>>>;
76
+ folder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
77
+ targeting_gate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
78
+ allocation_pct: z.ZodOptional<z.ZodNumber>;
79
+ salt: z.ZodOptional<z.ZodString>;
80
+ universe: z.ZodOptional<z.ZodString>;
81
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
82
+ string: "string";
83
+ number: "number";
84
+ bool: "bool";
85
+ }>>>;
86
+ groups: z.ZodOptional<z.ZodArray<z.ZodObject<{
87
+ name: z.ZodString;
88
+ weight: z.ZodNumber;
89
+ params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
90
+ }, z.core.$strip>>>;
91
+ significance_threshold: z.ZodOptional<z.ZodNumber>;
92
+ min_runtime_days: z.ZodOptional<z.ZodNumber>;
93
+ min_sample_size: z.ZodOptional<z.ZodNumber>;
94
+ sequential_testing: z.ZodOptional<z.ZodBoolean>;
95
+ goal_metric: z.ZodOptional<z.ZodObject<{
96
+ name: z.ZodOptional<z.ZodString>;
97
+ query: z.ZodString;
98
+ }, z.core.$strip>>;
99
+ guardrail_metrics: z.ZodOptional<z.ZodArray<z.ZodObject<{
100
+ name: z.ZodOptional<z.ZodString>;
101
+ query: z.ZodString;
102
+ }, z.core.$strip>>>;
103
+ }, z.core.$strip>;
104
+ declare const experimentStatusUpdateSchema: z.ZodObject<{
105
+ status: z.ZodEnum<{
106
+ draft: "draft";
107
+ running: "running";
108
+ stopped: "stopped";
109
+ archived: "archived";
110
+ }>;
111
+ }, z.core.$strip>;
112
+ declare const experimentMetricsUpdateSchema: z.ZodObject<{
113
+ metrics: z.ZodArray<z.ZodObject<{
114
+ metric_id: z.ZodString;
115
+ role: z.ZodEnum<{
116
+ goal: "goal";
117
+ guardrail: "guardrail";
118
+ secondary: "secondary";
119
+ }>;
120
+ }, z.core.$strip>>;
121
+ }, z.core.$strip>;
122
+ declare const experimentResponseSchema: z.ZodObject<{
123
+ id: z.ZodString;
124
+ name: z.ZodString;
125
+ description: z.ZodNullable<z.ZodString>;
126
+ hypothesis: z.ZodNullable<z.ZodString>;
127
+ tag: z.ZodNullable<z.ZodString>;
128
+ ownerEmail: z.ZodNullable<z.ZodString>;
129
+ audience: z.ZodNullable<z.ZodString>;
130
+ bucketBy: z.ZodNullable<z.ZodEnum<{
131
+ user_id: "user_id";
132
+ session_id: "session_id";
133
+ device_id: "device_id";
134
+ }>>;
135
+ folder: z.ZodNullable<z.ZodString>;
136
+ status: z.ZodEnum<{
137
+ draft: "draft";
138
+ running: "running";
139
+ stopped: "stopped";
140
+ archived: "archived";
141
+ }>;
142
+ universe: z.ZodString;
143
+ targetingGate: z.ZodNullable<z.ZodString>;
144
+ allocationPct: z.ZodNumber;
145
+ salt: z.ZodString;
146
+ params: z.ZodRecord<z.ZodString, z.ZodEnum<{
147
+ string: "string";
148
+ number: "number";
149
+ bool: "bool";
150
+ }>>;
151
+ groups: z.ZodArray<z.ZodObject<{
152
+ name: z.ZodString;
153
+ weight: z.ZodNumber;
154
+ params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
155
+ }, z.core.$strip>>;
156
+ significanceThreshold: z.ZodNumber;
157
+ minRuntimeDays: z.ZodNumber;
158
+ minSampleSize: z.ZodNumber;
159
+ sequentialTesting: z.ZodBoolean;
160
+ startedAt: z.ZodNullable<z.ZodString>;
161
+ stoppedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
162
+ updatedAt: z.ZodString;
163
+ }, z.core.$strip>;
164
+ declare const experimentCreateResponseSchema: z.ZodObject<{
165
+ id: z.ZodString;
166
+ name: z.ZodString;
167
+ }, z.core.$strip>;
168
+ declare const experimentUpdateResponseSchema: z.ZodObject<{
169
+ id: z.ZodString;
170
+ }, z.core.$strip>;
171
+ declare const experimentDeleteResponseSchema: z.ZodObject<{
172
+ ok: z.ZodLiteral<true>;
173
+ }, z.core.$strip>;
174
+ declare const experimentStatusResponseSchema: z.ZodObject<{
175
+ id: z.ZodString;
176
+ status: z.ZodEnum<{
177
+ draft: "draft";
178
+ running: "running";
179
+ stopped: "stopped";
180
+ archived: "archived";
181
+ }>;
182
+ }, z.core.$strip>;
183
+ declare const experimentMetricsResponseSchema: z.ZodObject<{
184
+ id: z.ZodString;
185
+ metrics: z.ZodArray<z.ZodObject<{
186
+ metric_id: z.ZodString;
187
+ role: z.ZodEnum<{
188
+ goal: "goal";
189
+ guardrail: "guardrail";
190
+ secondary: "secondary";
191
+ }>;
192
+ }, z.core.$strip>>;
193
+ }, z.core.$strip>;
194
+ declare const experimentResultsResponseSchema: z.ZodObject<{
195
+ experiment: z.ZodObject<{
196
+ id: z.ZodString;
197
+ name: z.ZodString;
198
+ status: z.ZodEnum<{
199
+ draft: "draft";
200
+ running: "running";
201
+ stopped: "stopped";
202
+ archived: "archived";
203
+ }>;
204
+ }, z.core.$strip>;
205
+ results: z.ZodArray<z.ZodObject<{
206
+ metric: z.ZodString;
207
+ group_name: z.ZodString;
208
+ ds: z.ZodString;
209
+ n: z.ZodNullable<z.ZodNumber>;
210
+ mean: z.ZodNullable<z.ZodNumber>;
211
+ delta_pct: z.ZodNullable<z.ZodNumber>;
212
+ p_value: z.ZodNullable<z.ZodNumber>;
213
+ srm_detected: z.ZodNullable<z.ZodNumber>;
214
+ }, z.core.$strip>>;
215
+ }, z.core.$strip>;
216
+ declare const experimentTimeseriesResponseSchema: z.ZodObject<{
217
+ experiment: z.ZodObject<{
218
+ id: z.ZodString;
219
+ name: z.ZodString;
220
+ status: z.ZodEnum<{
221
+ draft: "draft";
222
+ running: "running";
223
+ stopped: "stopped";
224
+ archived: "archived";
225
+ }>;
226
+ }, z.core.$strip>;
227
+ series: z.ZodArray<z.ZodObject<{
228
+ metric: z.ZodString;
229
+ group_name: z.ZodString;
230
+ ds: z.ZodString;
231
+ n: z.ZodNullable<z.ZodNumber>;
232
+ mean: z.ZodNullable<z.ZodNumber>;
233
+ delta_pct: z.ZodNullable<z.ZodNumber>;
234
+ p_value: z.ZodNullable<z.ZodNumber>;
235
+ srm_detected: z.ZodNullable<z.ZodNumber>;
236
+ }, z.core.$strip>>;
237
+ }, z.core.$strip>;
238
+ declare const experimentReanalyzeResponseSchema: z.ZodObject<{
239
+ id: z.ZodString;
240
+ queued: z.ZodLiteral<true>;
241
+ }, z.core.$strip>;
242
+ type ExperimentCreateInput = z.infer<typeof experimentCreateSchema>;
243
+ type ExperimentUpdateInput = z.infer<typeof experimentUpdateSchema>;
244
+
245
+ export { type ExperimentCreateInput, type ExperimentInlineMetric, type ExperimentUpdateInput, bucketBySchema, experimentCreateResponseSchema, experimentCreateSchema, experimentDeleteResponseSchema, experimentGroupSchema, experimentInlineMetricSchema, experimentMetricsResponseSchema, experimentMetricsUpdateSchema, experimentNameSchema, experimentReanalyzeResponseSchema, experimentResponseSchema, experimentResultsResponseSchema, experimentStatusResponseSchema, experimentStatusUpdateSchema, experimentTimeseriesResponseSchema, experimentUpdateResponseSchema, experimentUpdateSchema, paramSchemaSchema };
@@ -0,0 +1,216 @@
1
+ // src/schemas/experiments.ts
2
+ import { z as z3 } from "zod";
3
+
4
+ // src/schemas/folder.ts
5
+ import { z } from "zod";
6
+ var folderSchema = z.string().max(256).regex(/^[a-zA-Z0-9_-]+$/, "Folder must be alphanumeric, `_` or `-` (no `/`).").nullable().optional().describe(
7
+ "Optional folder name used to group items in the dashboard. Part of the SDK lookup key: an item in folder `checkout` named `new-cart` is referenced as `checkout/new-cart` from the SDK."
8
+ );
9
+
10
+ // src/schemas/metric-name.ts
11
+ import { z as z2 } from "zod";
12
+ var metricNameSchema = z2.string().regex(/^[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?)?$/).max(128);
13
+
14
+ // src/schemas/experiments.ts
15
+ var experimentInlineMetricSchema = z3.object({
16
+ name: metricNameSchema.optional(),
17
+ query: z3.string().min(1).max(4096).describe("Metric DSL string, e.g. `count_users(checkout_completed)`.")
18
+ });
19
+ var experimentNameSchema = z3.string().regex(/^[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?)?$/).max(128).describe(
20
+ "Stable experiment key. Single segment or `folder.name` (a-z, 0-9, `_`/`-`; max 128 chars). Used by SDKs as `Shipeasy.getExperiment(user, '<name>')`. Immutable after create."
21
+ );
22
+ var experimentGroupSchema = z3.object({
23
+ name: z3.string().min(1).max(64).describe("Group label (e.g. `control`, `treatment_a`). Max 64 chars."),
24
+ weight: z3.number().int().min(0).max(1e4).describe(
25
+ "Allocation weight in basis points (0\u201310000). The sum across all groups must equal exactly **10000** (100%)."
26
+ ),
27
+ params: z3.record(z3.string(), z3.unknown()).default({}).describe(
28
+ "Per-group parameter values delivered to the SDK when a caller is hashed into this group. Keys must match the experiment's `params` schema."
29
+ )
30
+ }).describe("One variant in the experiment. Weights across all groups must sum to 10000.");
31
+ var paramSchemaSchema = z3.record(z3.string(), z3.enum(["string", "bool", "number"])).describe(
32
+ "Map of param-name \u2192 scalar type. Defines the shape of `groups[].params`. Example: `{ headline: 'string', show_cta: 'bool' }`."
33
+ );
34
+ var bucketBySchema = z3.enum(["user_id", "session_id", "device_id"]).describe("Identifier used as the bucketing key. `user_id` is sticky across sessions.");
35
+ var experimentCreateSchema = z3.object({
36
+ name: experimentNameSchema,
37
+ description: z3.string().max(2e3).nullable().default(null).describe("Free-form description. Max 2000 chars, markdown rendered in the dashboard."),
38
+ hypothesis: z3.string().max(4e3).nullable().default(null).describe("Hypothesis statement shown in the editor. Display-only."),
39
+ tag: z3.string().max(64).nullable().default(null).describe("Short tag chip rendered next to the name. Display-only."),
40
+ owner_email: z3.string().max(254).nullable().default(null).describe("Owner email. Display-only."),
41
+ audience: z3.string().max(256).nullable().default(null).describe("Audience label shown in the editor. Display-only."),
42
+ bucket_by: bucketBySchema.nullable().default(null),
43
+ folder: folderSchema,
44
+ universe: z3.string().min(1).describe(
45
+ "Name of an existing universe in the project. Returns `422` if the universe doesn't exist."
46
+ ),
47
+ targeting_gate: z3.string().nullable().default(null).describe(
48
+ "Optional gate name. Only callers that pass the gate are enrolled in the experiment."
49
+ ),
50
+ allocation_pct: z3.number().int().min(0).max(1e4).default(0).describe(
51
+ "Share of the (gated) audience allocated to the experiment, in basis points (0\u201310000 = 0%\u2013100%). `0` = unallocated. Immutable while the experiment is running."
52
+ ),
53
+ salt: z3.string().min(1).max(64).optional().describe("Hash salt for bucketing. Auto-generated if omitted. Immutable while running."),
54
+ params: paramSchemaSchema.default({}),
55
+ groups: z3.array(experimentGroupSchema).min(2).describe(
56
+ "Two or more variants. Weights must sum to exactly 10000 (100%). Immutable while running."
57
+ ),
58
+ significance_threshold: z3.number().min(1e-4).max(0.5).default(0.05).describe(
59
+ "p-value cutoff used by the analysis pass. Defaults to `0.05`. Values other than 0.05 require Pro plan or higher."
60
+ ),
61
+ min_runtime_days: z3.number().int().min(0).max(365).default(0).describe("Minimum days the experiment must run before results are considered conclusive."),
62
+ min_sample_size: z3.number().int().min(1).default(100).describe("Minimum exposures per group before results are considered conclusive."),
63
+ sequential_testing: z3.boolean().default(false).describe(
64
+ "Enable sequential testing (always-valid p-values). Requires Premium plan or higher."
65
+ ),
66
+ goal_metric: experimentInlineMetricSchema.optional().describe(
67
+ "Single goal metric defined inline as a DSL query. The underlying event is auto-created if missing."
68
+ ),
69
+ guardrail_metrics: z3.array(experimentInlineMetricSchema).max(10).default([]).describe(
70
+ "Up to 10 guardrail metrics defined inline. Each is upserted (event + metric) and attached with role=guardrail."
71
+ )
72
+ }).refine(
73
+ (e) => e.groups.reduce((s, g) => s + g.weight, 0) === 1e4,
74
+ "groups weights must sum to exactly 10000"
75
+ ).describe(
76
+ "Body for `POST /api/admin/experiments`. `name`, `universe`, and `groups` (\u22652, weights sum to 10000) required."
77
+ );
78
+ var experimentUpdateSchema = z3.object({
79
+ name: experimentNameSchema.optional(),
80
+ description: z3.string().max(2e3).nullable().optional(),
81
+ hypothesis: z3.string().max(4e3).nullable().optional(),
82
+ tag: z3.string().max(64).nullable().optional(),
83
+ owner_email: z3.string().max(254).nullable().optional(),
84
+ audience: z3.string().max(256).nullable().optional(),
85
+ bucket_by: bucketBySchema.nullable().optional(),
86
+ folder: folderSchema,
87
+ targeting_gate: z3.string().nullable().optional(),
88
+ allocation_pct: z3.number().int().min(0).max(1e4).optional().describe("Basis-points allocation (0\u201310000). Immutable while the experiment is running."),
89
+ salt: z3.string().min(1).max(64).optional().describe("Hash salt. Immutable while running."),
90
+ universe: z3.string().optional().describe(
91
+ "New universe name. Immutable while running. Returns `422` if the universe doesn't exist."
92
+ ),
93
+ params: paramSchemaSchema.optional(),
94
+ groups: z3.array(experimentGroupSchema).min(2).optional().describe("Replacement groups. Weights must sum to 10000. Immutable while running."),
95
+ significance_threshold: z3.number().min(1e-4).max(0.5).optional(),
96
+ min_runtime_days: z3.number().int().min(0).max(365).optional(),
97
+ min_sample_size: z3.number().int().min(1).optional(),
98
+ sequential_testing: z3.boolean().optional(),
99
+ goal_metric: experimentInlineMetricSchema.optional().describe("Replaces the goal metric (event auto-upserted)."),
100
+ guardrail_metrics: z3.array(experimentInlineMetricSchema).max(10).optional().describe("Replaces the guardrail set wholesale (event auto-upserted per entry).")
101
+ }).describe(
102
+ "Body for `PATCH /api/admin/experiments/{id}`. Partial \u2014 only supplied fields change. `allocation_pct`, `groups`, `salt`, `universe`, `params` are immutable while the experiment is running (stop first)."
103
+ );
104
+ var experimentStatusUpdateSchema = z3.object({
105
+ status: z3.enum(["draft", "running", "stopped", "archived"]).describe(
106
+ "Target status. Allowed transitions: `draft \u2192 running`, `running \u2192 stopped`, `stopped \u2192 archived`, `draft \u2192 archived`. Restarting an archived experiment is not allowed."
107
+ )
108
+ }).describe("Body for `POST /api/admin/experiments/{id}/status`.");
109
+ var experimentMetricsUpdateSchema = z3.object({
110
+ metrics: z3.array(
111
+ z3.object({
112
+ metric_id: z3.string().describe("Existing metric id in the project."),
113
+ role: z3.enum(["goal", "guardrail", "secondary"]).describe(
114
+ "Metric role. `goal` drives the decision, `guardrail` blocks ship if degraded, `secondary` is informational."
115
+ )
116
+ })
117
+ ).describe("Replacement metrics list \u2014 replaces the current attachments wholesale.")
118
+ }).describe(
119
+ "Body for `POST /api/admin/experiments/{id}/metrics`. Replaces the experiment's metric attachments wholesale. Returns `422` if any `metric_id` is unknown."
120
+ );
121
+ var experimentResponseSchema = z3.object({
122
+ id: z3.string().describe("Stable opaque experiment id (`exp_\u2026`)."),
123
+ name: experimentNameSchema,
124
+ description: z3.string().nullable(),
125
+ hypothesis: z3.string().nullable(),
126
+ tag: z3.string().nullable(),
127
+ ownerEmail: z3.string().nullable(),
128
+ audience: z3.string().nullable(),
129
+ bucketBy: bucketBySchema.nullable(),
130
+ folder: z3.string().nullable(),
131
+ status: z3.enum(["draft", "running", "stopped", "archived"]),
132
+ universe: z3.string().describe("Universe name this experiment draws from."),
133
+ targetingGate: z3.string().nullable(),
134
+ allocationPct: z3.number().int().describe("Allocation in basis points (0\u201310000)."),
135
+ salt: z3.string(),
136
+ params: z3.record(z3.string(), z3.enum(["string", "bool", "number"])),
137
+ groups: z3.array(experimentGroupSchema),
138
+ significanceThreshold: z3.number(),
139
+ minRuntimeDays: z3.number().int(),
140
+ minSampleSize: z3.number().int(),
141
+ sequentialTesting: z3.boolean(),
142
+ startedAt: z3.string().nullable().describe("ISO-8601 timestamp the experiment last transitioned to `running`, or `null`."),
143
+ stoppedAt: z3.string().nullable().optional(),
144
+ updatedAt: z3.string()
145
+ });
146
+ var experimentCreateResponseSchema = z3.object({
147
+ id: z3.string().describe("Newly assigned experiment id."),
148
+ name: experimentNameSchema
149
+ });
150
+ var experimentUpdateResponseSchema = z3.object({
151
+ id: z3.string().describe("Experiment id that was updated.")
152
+ });
153
+ var experimentDeleteResponseSchema = z3.object({ ok: z3.literal(true) });
154
+ var experimentStatusResponseSchema = z3.object({
155
+ id: z3.string(),
156
+ status: z3.enum(["draft", "running", "stopped", "archived"])
157
+ });
158
+ var experimentMetricsResponseSchema = z3.object({
159
+ id: z3.string(),
160
+ metrics: z3.array(
161
+ z3.object({
162
+ metric_id: z3.string(),
163
+ role: z3.enum(["goal", "guardrail", "secondary"])
164
+ })
165
+ )
166
+ });
167
+ var experimentResultRowSchema = z3.object({
168
+ metric: z3.string(),
169
+ group_name: z3.string(),
170
+ ds: z3.string().describe("Date slice (`YYYY-MM-DD`)."),
171
+ n: z3.number().nullable(),
172
+ mean: z3.number().nullable(),
173
+ delta_pct: z3.number().nullable(),
174
+ p_value: z3.number().nullable(),
175
+ srm_detected: z3.number().nullable().describe("`1` if sample-ratio mismatch detected, else `0`.")
176
+ });
177
+ var experimentResultsResponseSchema = z3.object({
178
+ experiment: z3.object({
179
+ id: z3.string(),
180
+ name: experimentNameSchema,
181
+ status: z3.enum(["draft", "running", "stopped", "archived"])
182
+ }),
183
+ results: z3.array(experimentResultRowSchema)
184
+ });
185
+ var experimentTimeseriesResponseSchema = z3.object({
186
+ experiment: z3.object({
187
+ id: z3.string(),
188
+ name: experimentNameSchema,
189
+ status: z3.enum(["draft", "running", "stopped", "archived"])
190
+ }),
191
+ series: z3.array(experimentResultRowSchema)
192
+ });
193
+ var experimentReanalyzeResponseSchema = z3.object({
194
+ id: z3.string(),
195
+ queued: z3.literal(true)
196
+ });
197
+ export {
198
+ bucketBySchema,
199
+ experimentCreateResponseSchema,
200
+ experimentCreateSchema,
201
+ experimentDeleteResponseSchema,
202
+ experimentGroupSchema,
203
+ experimentInlineMetricSchema,
204
+ experimentMetricsResponseSchema,
205
+ experimentMetricsUpdateSchema,
206
+ experimentNameSchema,
207
+ experimentReanalyzeResponseSchema,
208
+ experimentResponseSchema,
209
+ experimentResultsResponseSchema,
210
+ experimentStatusResponseSchema,
211
+ experimentStatusUpdateSchema,
212
+ experimentTimeseriesResponseSchema,
213
+ experimentUpdateResponseSchema,
214
+ experimentUpdateSchema,
215
+ paramSchemaSchema
216
+ };
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+
3
+ /** Folder name validation shared across every entity that supports folders.
4
+ * Flat string — no `/` allowed because `/` is the folder/name separator in
5
+ * SDK lookup keys (see KV blob format 3). Empty string is coerced to null
6
+ * at the boundary so the DB stores a single canonical "no folder" value. */
7
+ declare const folderSchema: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8
+ type FolderInput = z.infer<typeof folderSchema>;
9
+
10
+ export { type FolderInput, folderSchema };
@@ -0,0 +1,8 @@
1
+ // src/schemas/folder.ts
2
+ import { z } from "zod";
3
+ var folderSchema = z.string().max(256).regex(/^[a-zA-Z0-9_-]+$/, "Folder must be alphanumeric, `_` or `-` (no `/`).").nullable().optional().describe(
4
+ "Optional folder name used to group items in the dashboard. Part of the SDK lookup key: an item in folder `checkout` named `new-cart` is referenced as `checkout/new-cart` from the SDK."
5
+ );
6
+ export {
7
+ folderSchema
8
+ };