@shipeasy/openapi 1.6.0 → 2.2.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 (151) hide show
  1. package/README.md +37 -0
  2. package/dist/chunk-643YSMLU.js +1616 -0
  3. package/dist/chunk-643YSMLU.js.map +1 -0
  4. package/dist/chunk-MRW3DJ57.js +3385 -0
  5. package/dist/chunk-MRW3DJ57.js.map +1 -0
  6. package/dist/client-K0ShmsC7.d.ts +11284 -0
  7. package/dist/client.d.ts +1 -0
  8. package/dist/client.js +215 -0
  9. package/dist/client.js.map +1 -0
  10. package/dist/custom.d.ts +86 -0
  11. package/dist/custom.js +300 -0
  12. package/dist/custom.js.map +1 -0
  13. package/dist/index.d.ts +29 -41
  14. package/dist/index.js +258 -4375
  15. package/dist/index.js.map +1 -0
  16. package/dist/node-context.d.ts +81 -33
  17. package/dist/node-context.js +98 -44
  18. package/dist/node-context.js.map +1 -0
  19. package/dist/schemas.d.ts +7973 -0
  20. package/dist/schemas.js +1099 -0
  21. package/dist/schemas.js.map +1 -0
  22. package/openapi.json +15922 -3232
  23. package/openapi.yaml +14277 -0
  24. package/package.json +33 -26
  25. package/spec/components/errors.yaml +53 -0
  26. package/spec/components/parameters.yaml +32 -0
  27. package/spec/components/responses.yaml +122 -0
  28. package/spec/components/schemas/alert-rules.yaml +175 -0
  29. package/spec/components/schemas/attributes.yaml +157 -0
  30. package/spec/components/schemas/common.yaml +92 -0
  31. package/spec/components/schemas/configs.yaml +371 -0
  32. package/spec/components/schemas/connectors.yaml +587 -0
  33. package/spec/components/schemas/errors-api.yaml +209 -0
  34. package/spec/components/schemas/events.yaml +321 -0
  35. package/spec/components/schemas/experiments.yaml +865 -0
  36. package/spec/components/schemas/gate-templates.yaml +237 -0
  37. package/spec/components/schemas/gates.yaml +890 -0
  38. package/spec/components/schemas/i18n.yaml +478 -0
  39. package/spec/components/schemas/keys.yaml +186 -0
  40. package/spec/components/schemas/killswitches.yaml +309 -0
  41. package/spec/components/schemas/metrics.yaml +547 -0
  42. package/spec/components/schemas/ops.yaml +1013 -0
  43. package/spec/components/schemas/projects.yaml +222 -0
  44. package/spec/components/schemas/search.yaml +46 -0
  45. package/spec/components/schemas/universes.yaml +127 -0
  46. package/spec/openapi.yaml +367 -0
  47. package/spec/paths/alert-rules.yaml +258 -0
  48. package/spec/paths/attributes.yaml +272 -0
  49. package/spec/paths/configs.yaml +758 -0
  50. package/spec/paths/connectors.yaml +782 -0
  51. package/spec/paths/errors.yaml +382 -0
  52. package/spec/paths/events.yaml +380 -0
  53. package/spec/paths/experiments.yaml +803 -0
  54. package/spec/paths/gate-templates.yaml +267 -0
  55. package/spec/paths/gates.yaml +465 -0
  56. package/spec/paths/i18n.yaml +557 -0
  57. package/spec/paths/keys.yaml +182 -0
  58. package/spec/paths/killswitches.yaml +574 -0
  59. package/spec/paths/metrics.yaml +313 -0
  60. package/spec/paths/ops.yaml +446 -0
  61. package/spec/paths/projects.yaml +210 -0
  62. package/spec/paths/search.yaml +62 -0
  63. package/spec/paths/universes.yaml +255 -0
  64. package/dist/operations/attributes.d.ts +0 -33
  65. package/dist/operations/attributes.js +0 -16
  66. package/dist/operations/cli-adapter.d.ts +0 -35
  67. package/dist/operations/cli-adapter.js +0 -91
  68. package/dist/operations/coerce.d.ts +0 -32
  69. package/dist/operations/coerce.js +0 -53
  70. package/dist/operations/configs.d.ts +0 -28
  71. package/dist/operations/configs.js +0 -119
  72. package/dist/operations/docs.d.ts +0 -37
  73. package/dist/operations/docs.js +0 -39
  74. package/dist/operations/events.d.ts +0 -28
  75. package/dist/operations/events.js +0 -121
  76. package/dist/operations/experiments.d.ts +0 -28
  77. package/dist/operations/experiments.js +0 -280
  78. package/dist/operations/gates.d.ts +0 -28
  79. package/dist/operations/gates.js +0 -132
  80. package/dist/operations/i18n.d.ts +0 -28
  81. package/dist/operations/i18n.js +0 -121
  82. package/dist/operations/index.d.ts +0 -63
  83. package/dist/operations/index.js +0 -1751
  84. package/dist/operations/killswitches.d.ts +0 -28
  85. package/dist/operations/killswitches.js +0 -126
  86. package/dist/operations/mcp-adapter.d.ts +0 -35
  87. package/dist/operations/mcp-adapter.js +0 -94
  88. package/dist/operations/metrics.d.ts +0 -30
  89. package/dist/operations/metrics.js +0 -114
  90. package/dist/operations/ops.d.ts +0 -28
  91. package/dist/operations/ops.js +0 -313
  92. package/dist/operations/projects.d.ts +0 -28
  93. package/dist/operations/projects.js +0 -36
  94. package/dist/operations/sdk-docs.d.ts +0 -28
  95. package/dist/operations/sdk-docs.js +0 -160
  96. package/dist/operations/types.d.ts +0 -138
  97. package/dist/operations/types.js +0 -9
  98. package/dist/operations/universes.d.ts +0 -28
  99. package/dist/operations/universes.js +0 -93
  100. package/dist/operations/util.d.ts +0 -33
  101. package/dist/operations/util.js +0 -9
  102. package/dist/resources/alert-rules.d.ts +0 -50
  103. package/dist/resources/alert-rules.js +0 -75
  104. package/dist/resources/attributes.d.ts +0 -19
  105. package/dist/resources/attributes.js +0 -10
  106. package/dist/resources/configs.d.ts +0 -681
  107. package/dist/resources/configs.js +0 -509
  108. package/dist/resources/events.d.ts +0 -61
  109. package/dist/resources/events.js +0 -42
  110. package/dist/resources/experiments.d.ts +0 -849
  111. package/dist/resources/experiments.js +0 -707
  112. package/dist/resources/gates.d.ts +0 -808
  113. package/dist/resources/gates.js +0 -522
  114. package/dist/resources/i18n.d.ts +0 -84
  115. package/dist/resources/i18n.js +0 -60
  116. package/dist/resources/index.d.ts +0 -2767
  117. package/dist/resources/index.js +0 -2563
  118. package/dist/resources/killswitches.d.ts +0 -436
  119. package/dist/resources/killswitches.js +0 -514
  120. package/dist/resources/metrics.d.ts +0 -54
  121. package/dist/resources/metrics.js +0 -40
  122. package/dist/resources/ops.d.ts +0 -88
  123. package/dist/resources/ops.js +0 -36
  124. package/dist/resources/projects.d.ts +0 -54
  125. package/dist/resources/projects.js +0 -14
  126. package/dist/resources/universes.d.ts +0 -185
  127. package/dist/resources/universes.js +0 -234
  128. package/dist/schemas/alert-rules.d.ts +0 -65
  129. package/dist/schemas/alert-rules.js +0 -37
  130. package/dist/schemas/configs.d.ts +0 -154
  131. package/dist/schemas/configs.js +0 -134
  132. package/dist/schemas/constants.d.ts +0 -6
  133. package/dist/schemas/constants.js +0 -7
  134. package/dist/schemas/experiments.d.ts +0 -229
  135. package/dist/schemas/experiments.js +0 -221
  136. package/dist/schemas/folder.d.ts +0 -10
  137. package/dist/schemas/folder.js +0 -8
  138. package/dist/schemas/gates.d.ts +0 -386
  139. package/dist/schemas/gates.js +0 -190
  140. package/dist/schemas/index.d.ts +0 -11
  141. package/dist/schemas/index.js +0 -762
  142. package/dist/schemas/killswitches.d.ts +0 -110
  143. package/dist/schemas/killswitches.js +0 -226
  144. package/dist/schemas/metric-name.d.ts +0 -5
  145. package/dist/schemas/metric-name.js +0 -6
  146. package/dist/schemas/pagination.d.ts +0 -37
  147. package/dist/schemas/pagination.js +0 -44
  148. package/dist/schemas/universes.d.ts +0 -35
  149. package/dist/schemas/universes.js +0 -55
  150. package/dist/transport.d.ts +0 -30
  151. package/dist/transport.js +0 -44
@@ -1,849 +0,0 @@
1
- import { z } from 'zod';
2
- import { experimentCreateSchema, experimentUpdateSchema } from '../schemas/experiments.js';
3
- import { PageQuery, Page } from '../schemas/pagination.js';
4
- import { Transport } from '../transport.js';
5
-
6
- /**
7
- * Input shape callers send (defaults still optional). The server applies
8
- * defaults via `.parse()`, so consumers can omit `significance_threshold`,
9
- * `min_runtime_days`, `params`, etc. — `z.input` expresses that.
10
- */
11
- type ExperimentCreateInput = z.input<typeof experimentCreateSchema>;
12
- type ExperimentUpdateInput = z.input<typeof experimentUpdateSchema>;
13
- interface Experiment {
14
- id: string;
15
- name: string;
16
- status: "draft" | "running" | "stopped" | "archived" | string;
17
- universe: string;
18
- allocationPct: number;
19
- significance_threshold?: number;
20
- min_runtime_days?: number;
21
- startedAt?: string | null;
22
- started_at?: string | null;
23
- updatedAt?: string;
24
- }
25
- interface ExperimentResult {
26
- metric: string;
27
- group_name: string;
28
- ds: string;
29
- n: number | null;
30
- mean: number | null;
31
- delta_pct: number | null;
32
- p_value: number | null;
33
- srm_detected: number | null;
34
- }
35
- interface ExperimentTimeseriesPoint {
36
- ds: string;
37
- group_name: string;
38
- metric: string;
39
- value: number | null;
40
- }
41
- type ExperimentStatus = "draft" | "running" | "stopped" | "archived";
42
- interface ExperimentMetricsInput {
43
- metrics: {
44
- metric_id: string;
45
- role: "goal" | "guardrail" | "secondary";
46
- }[];
47
- }
48
- interface ExperimentsClient {
49
- list(opts?: Partial<PageQuery>): Promise<Page<Experiment>>;
50
- listAll(): Promise<Experiment[]>;
51
- get(id: string): Promise<Experiment>;
52
- resolve(idOrName: string): Promise<Experiment>;
53
- create(input: ExperimentCreateInput): Promise<Experiment>;
54
- update(id: string, input: ExperimentUpdateInput): Promise<Experiment>;
55
- delete(id: string): Promise<{
56
- ok: true;
57
- }>;
58
- setStatus(id: string, status: ExperimentStatus): Promise<Experiment>;
59
- start(id: string): Promise<Experiment>;
60
- stop(id: string): Promise<Experiment>;
61
- archive(id: string): Promise<Experiment>;
62
- /** Restore a soft-deleted (archived) experiment back to `draft`. */
63
- restore(id: string): Promise<Experiment>;
64
- setMetrics(id: string, input: ExperimentMetricsInput): Promise<unknown>;
65
- results(id: string): Promise<ExperimentResult[]>;
66
- timeseries(id: string, metric?: string): Promise<ExperimentTimeseriesPoint[]>;
67
- reanalyze(id: string): Promise<{
68
- ok: true;
69
- }>;
70
- }
71
- declare function experimentsClient(t: Transport): ExperimentsClient;
72
- declare const experimentsResource: {
73
- readonly name: "experiments";
74
- readonly basePath: "/api/admin/experiments";
75
- readonly describeOne: "experiment";
76
- readonly describeMany: "experiments";
77
- readonly tag: {
78
- readonly name: "Experiments";
79
- readonly description: string;
80
- };
81
- readonly schemas: {
82
- readonly create: z.ZodObject<{
83
- name: z.ZodString;
84
- description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
85
- hypothesis: z.ZodDefault<z.ZodNullable<z.ZodString>>;
86
- tag: z.ZodDefault<z.ZodNullable<z.ZodString>>;
87
- owner_email: z.ZodDefault<z.ZodNullable<z.ZodString>>;
88
- audience: z.ZodDefault<z.ZodNullable<z.ZodString>>;
89
- bucket_by: z.ZodDefault<z.ZodNullable<z.ZodString>>;
90
- folder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
91
- universe: z.ZodString;
92
- targeting_gate: z.ZodDefault<z.ZodNullable<z.ZodString>>;
93
- allocation_pct: z.ZodDefault<z.ZodNumber>;
94
- salt: z.ZodOptional<z.ZodString>;
95
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodEnum<{
96
- string: "string";
97
- number: "number";
98
- bool: "bool";
99
- }>>>;
100
- groups: z.ZodArray<z.ZodObject<{
101
- name: z.ZodString;
102
- weight: z.ZodNumber;
103
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
104
- }, z.core.$strip>>;
105
- significance_threshold: z.ZodDefault<z.ZodNumber>;
106
- min_runtime_days: z.ZodDefault<z.ZodNumber>;
107
- min_sample_size: z.ZodDefault<z.ZodNumber>;
108
- sequential_testing: z.ZodDefault<z.ZodBoolean>;
109
- goal_metric: z.ZodOptional<z.ZodObject<{
110
- name: z.ZodOptional<z.ZodString>;
111
- query: z.ZodString;
112
- }, z.core.$strip>>;
113
- guardrail_metrics: z.ZodDefault<z.ZodArray<z.ZodObject<{
114
- name: z.ZodOptional<z.ZodString>;
115
- query: z.ZodString;
116
- }, z.core.$strip>>>;
117
- }, z.core.$strip>;
118
- readonly update: z.ZodObject<{
119
- name: z.ZodOptional<z.ZodString>;
120
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
121
- hypothesis: z.ZodOptional<z.ZodNullable<z.ZodString>>;
122
- tag: z.ZodOptional<z.ZodNullable<z.ZodString>>;
123
- owner_email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
124
- audience: z.ZodOptional<z.ZodNullable<z.ZodString>>;
125
- bucket_by: z.ZodOptional<z.ZodNullable<z.ZodString>>;
126
- folder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
127
- targeting_gate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
128
- allocation_pct: z.ZodOptional<z.ZodNumber>;
129
- salt: z.ZodOptional<z.ZodString>;
130
- universe: z.ZodOptional<z.ZodString>;
131
- params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
132
- string: "string";
133
- number: "number";
134
- bool: "bool";
135
- }>>>;
136
- groups: z.ZodOptional<z.ZodArray<z.ZodObject<{
137
- name: z.ZodString;
138
- weight: z.ZodNumber;
139
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
140
- }, z.core.$strip>>>;
141
- significance_threshold: z.ZodOptional<z.ZodNumber>;
142
- min_runtime_days: z.ZodOptional<z.ZodNumber>;
143
- min_sample_size: z.ZodOptional<z.ZodNumber>;
144
- sequential_testing: z.ZodOptional<z.ZodBoolean>;
145
- goal_metric: z.ZodOptional<z.ZodObject<{
146
- name: z.ZodOptional<z.ZodString>;
147
- query: z.ZodString;
148
- }, z.core.$strip>>;
149
- guardrail_metrics: z.ZodOptional<z.ZodArray<z.ZodObject<{
150
- name: z.ZodOptional<z.ZodString>;
151
- query: z.ZodString;
152
- }, z.core.$strip>>>;
153
- }, z.core.$strip>;
154
- };
155
- readonly actions: readonly [{
156
- readonly name: "start";
157
- readonly description: "Transition draft experiment to running";
158
- }, {
159
- readonly name: "stop";
160
- readonly description: "Stop a running experiment";
161
- }, {
162
- readonly name: "archive";
163
- readonly description: "Archive a stopped experiment";
164
- }, {
165
- readonly name: "restore";
166
- readonly description: "Restore an archived (never-started) experiment to draft";
167
- }, {
168
- readonly name: "reanalyze";
169
- readonly description: "Re-run analysis pass for the experiment";
170
- }];
171
- readonly endpoints: readonly [{
172
- readonly operationId: "listExperiments";
173
- readonly method: "GET";
174
- readonly path: "";
175
- readonly summary: "List experiments";
176
- readonly description: "Returns a single page of non-archived experiments ordered by `updated_at desc, id desc`. Use the `cursor` query parameter to paginate.";
177
- readonly response: z.ZodObject<{
178
- data: z.ZodArray<z.ZodObject<{
179
- id: z.ZodString;
180
- name: z.ZodString;
181
- description: z.ZodNullable<z.ZodString>;
182
- hypothesis: z.ZodNullable<z.ZodString>;
183
- tag: z.ZodNullable<z.ZodString>;
184
- ownerEmail: z.ZodNullable<z.ZodString>;
185
- audience: z.ZodNullable<z.ZodString>;
186
- bucketBy: z.ZodNullable<z.ZodString>;
187
- folder: z.ZodNullable<z.ZodString>;
188
- status: z.ZodEnum<{
189
- draft: "draft";
190
- running: "running";
191
- stopped: "stopped";
192
- archived: "archived";
193
- }>;
194
- universe: z.ZodString;
195
- targetingGate: z.ZodNullable<z.ZodString>;
196
- allocationPct: z.ZodNumber;
197
- salt: z.ZodString;
198
- params: z.ZodRecord<z.ZodString, z.ZodEnum<{
199
- string: "string";
200
- number: "number";
201
- bool: "bool";
202
- }>>;
203
- groups: z.ZodArray<z.ZodObject<{
204
- name: z.ZodString;
205
- weight: z.ZodNumber;
206
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
207
- }, z.core.$strip>>;
208
- significanceThreshold: z.ZodNumber;
209
- minRuntimeDays: z.ZodNumber;
210
- minSampleSize: z.ZodNumber;
211
- sequentialTesting: z.ZodBoolean;
212
- startedAt: z.ZodNullable<z.ZodString>;
213
- stoppedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
214
- updatedAt: z.ZodString;
215
- }, z.core.$strip>>;
216
- next_cursor: z.ZodNullable<z.ZodString>;
217
- }, z.core.$strip>;
218
- readonly examples: {
219
- readonly response: {
220
- readonly data: readonly [{
221
- id: string;
222
- name: string;
223
- description: string;
224
- tag: string;
225
- status: string;
226
- universe: string;
227
- targetingGate: null;
228
- allocationPct: number;
229
- salt: string;
230
- params: {
231
- cta_color: string;
232
- };
233
- groups: {
234
- name: string;
235
- weight: number;
236
- params: {
237
- cta_color: string;
238
- };
239
- }[];
240
- significanceThreshold: number;
241
- minRuntimeDays: number;
242
- minSampleSize: number;
243
- sequentialTesting: boolean;
244
- startedAt: string;
245
- stoppedAt: null;
246
- updatedAt: string;
247
- }];
248
- readonly next_cursor: null;
249
- };
250
- };
251
- readonly useCase: "Snapshot every active experiment in the project — e.g. render an overview dashboard or drive a CI check that no experiment has been running past its `min_runtime_days`.";
252
- }, {
253
- readonly operationId: "getExperiment";
254
- readonly method: "GET";
255
- readonly path: "/{id}";
256
- readonly summary: "Get one experiment";
257
- readonly description: "Returns the full experiment row including groups, params, allocation, and lifecycle timestamps.";
258
- readonly pathParams: {
259
- readonly id: "Stable opaque experiment id (`exp_…`) or the experiment's `name`.";
260
- };
261
- readonly response: z.ZodObject<{
262
- id: z.ZodString;
263
- name: z.ZodString;
264
- description: z.ZodNullable<z.ZodString>;
265
- hypothesis: z.ZodNullable<z.ZodString>;
266
- tag: z.ZodNullable<z.ZodString>;
267
- ownerEmail: z.ZodNullable<z.ZodString>;
268
- audience: z.ZodNullable<z.ZodString>;
269
- bucketBy: z.ZodNullable<z.ZodString>;
270
- folder: z.ZodNullable<z.ZodString>;
271
- status: z.ZodEnum<{
272
- draft: "draft";
273
- running: "running";
274
- stopped: "stopped";
275
- archived: "archived";
276
- }>;
277
- universe: z.ZodString;
278
- targetingGate: z.ZodNullable<z.ZodString>;
279
- allocationPct: z.ZodNumber;
280
- salt: z.ZodString;
281
- params: z.ZodRecord<z.ZodString, z.ZodEnum<{
282
- string: "string";
283
- number: "number";
284
- bool: "bool";
285
- }>>;
286
- groups: z.ZodArray<z.ZodObject<{
287
- name: z.ZodString;
288
- weight: z.ZodNumber;
289
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
290
- }, z.core.$strip>>;
291
- significanceThreshold: z.ZodNumber;
292
- minRuntimeDays: z.ZodNumber;
293
- minSampleSize: z.ZodNumber;
294
- sequentialTesting: z.ZodBoolean;
295
- startedAt: z.ZodNullable<z.ZodString>;
296
- stoppedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
297
- updatedAt: z.ZodString;
298
- }, z.core.$strip>;
299
- readonly examples: {
300
- readonly response: {
301
- id: string;
302
- name: string;
303
- description: string;
304
- tag: string;
305
- status: string;
306
- universe: string;
307
- targetingGate: null;
308
- allocationPct: number;
309
- salt: string;
310
- params: {
311
- cta_color: string;
312
- };
313
- groups: {
314
- name: string;
315
- weight: number;
316
- params: {
317
- cta_color: string;
318
- };
319
- }[];
320
- significanceThreshold: number;
321
- minRuntimeDays: number;
322
- minSampleSize: number;
323
- sequentialTesting: boolean;
324
- startedAt: string;
325
- stoppedAt: null;
326
- updatedAt: string;
327
- };
328
- };
329
- readonly useCase: "Fetch one experiment to render the detail page or to inspect its current allocation and group weights.";
330
- }, {
331
- readonly operationId: "createExperiment";
332
- readonly method: "POST";
333
- readonly path: "";
334
- readonly summary: "Create an experiment";
335
- readonly description: string;
336
- readonly successStatus: 201;
337
- readonly request: z.ZodObject<{
338
- name: z.ZodString;
339
- description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
340
- hypothesis: z.ZodDefault<z.ZodNullable<z.ZodString>>;
341
- tag: z.ZodDefault<z.ZodNullable<z.ZodString>>;
342
- owner_email: z.ZodDefault<z.ZodNullable<z.ZodString>>;
343
- audience: z.ZodDefault<z.ZodNullable<z.ZodString>>;
344
- bucket_by: z.ZodDefault<z.ZodNullable<z.ZodString>>;
345
- folder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
346
- universe: z.ZodString;
347
- targeting_gate: z.ZodDefault<z.ZodNullable<z.ZodString>>;
348
- allocation_pct: z.ZodDefault<z.ZodNumber>;
349
- salt: z.ZodOptional<z.ZodString>;
350
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodEnum<{
351
- string: "string";
352
- number: "number";
353
- bool: "bool";
354
- }>>>;
355
- groups: z.ZodArray<z.ZodObject<{
356
- name: z.ZodString;
357
- weight: z.ZodNumber;
358
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
359
- }, z.core.$strip>>;
360
- significance_threshold: z.ZodDefault<z.ZodNumber>;
361
- min_runtime_days: z.ZodDefault<z.ZodNumber>;
362
- min_sample_size: z.ZodDefault<z.ZodNumber>;
363
- sequential_testing: z.ZodDefault<z.ZodBoolean>;
364
- goal_metric: z.ZodOptional<z.ZodObject<{
365
- name: z.ZodOptional<z.ZodString>;
366
- query: z.ZodString;
367
- }, z.core.$strip>>;
368
- guardrail_metrics: z.ZodDefault<z.ZodArray<z.ZodObject<{
369
- name: z.ZodOptional<z.ZodString>;
370
- query: z.ZodString;
371
- }, z.core.$strip>>>;
372
- }, z.core.$strip>;
373
- readonly response: z.ZodObject<{
374
- id: z.ZodString;
375
- name: z.ZodString;
376
- }, z.core.$strip>;
377
- readonly examples: {
378
- readonly requestExamples: {
379
- readonly minimal: {
380
- readonly summary: "Minimal — two-group 50/50";
381
- readonly description: "Smallest valid body. Two groups at 50/50, no allocation, no targeting.";
382
- readonly value: {
383
- readonly name: "checkout_button_color";
384
- readonly universe: "primary_users";
385
- readonly groups: readonly [{
386
- readonly name: "control";
387
- readonly weight: 5000;
388
- }, {
389
- readonly name: "treatment";
390
- readonly weight: 5000;
391
- }];
392
- };
393
- };
394
- readonly targeted: {
395
- readonly summary: "Targeted — gate + allocation + params";
396
- readonly description: "Gate the audience with a `targeting_gate`, allocate 50% of it, and parameterise the variants.";
397
- readonly value: {
398
- readonly name: "checkout_button_color";
399
- readonly description: "Green CTA on checkout for Pro users.";
400
- readonly universe: "primary_users";
401
- readonly targeting_gate: "pro_plan_only";
402
- readonly allocation_pct: 5000;
403
- readonly params: {
404
- readonly cta_color: "string";
405
- };
406
- readonly groups: readonly [{
407
- readonly name: "control";
408
- readonly weight: 5000;
409
- readonly params: {
410
- readonly cta_color: "blue";
411
- };
412
- }, {
413
- readonly name: "treatment";
414
- readonly weight: 5000;
415
- readonly params: {
416
- readonly cta_color: "green";
417
- };
418
- }];
419
- };
420
- };
421
- readonly multivariant: {
422
- readonly summary: "Multivariant — three groups";
423
- readonly description: "Three variants splitting 40/30/30. Requires the sum to equal 10000.";
424
- readonly value: {
425
- readonly name: "headline_test";
426
- readonly universe: "primary_users";
427
- readonly groups: readonly [{
428
- readonly name: "control";
429
- readonly weight: 4000;
430
- }, {
431
- readonly name: "alt_a";
432
- readonly weight: 3000;
433
- }, {
434
- readonly name: "alt_b";
435
- readonly weight: 3000;
436
- }];
437
- };
438
- };
439
- readonly sequential: {
440
- readonly summary: "Sequential testing — Premium plan";
441
- readonly description: "Enable always-valid sequential tests. Requires Premium plan or higher.";
442
- readonly value: {
443
- readonly name: "checkout_button_color";
444
- readonly universe: "primary_users";
445
- readonly groups: readonly [{
446
- readonly name: "control";
447
- readonly weight: 5000;
448
- }, {
449
- readonly name: "treatment";
450
- readonly weight: 5000;
451
- }];
452
- readonly sequential_testing: true;
453
- readonly min_runtime_days: 14;
454
- };
455
- };
456
- };
457
- readonly response: {
458
- readonly id: "exp_01j7wb12c3d4e5f6g7h8j9k0l1";
459
- readonly name: "checkout_button_color";
460
- };
461
- };
462
- readonly useCase: string;
463
- }, {
464
- readonly operationId: "updateExperiment";
465
- readonly method: "PATCH";
466
- readonly path: "/{id}";
467
- readonly summary: "Update an experiment";
468
- readonly description: string;
469
- readonly pathParams: {
470
- readonly id: "Stable opaque experiment id.";
471
- };
472
- readonly request: z.ZodObject<{
473
- name: z.ZodOptional<z.ZodString>;
474
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
475
- hypothesis: z.ZodOptional<z.ZodNullable<z.ZodString>>;
476
- tag: z.ZodOptional<z.ZodNullable<z.ZodString>>;
477
- owner_email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
478
- audience: z.ZodOptional<z.ZodNullable<z.ZodString>>;
479
- bucket_by: z.ZodOptional<z.ZodNullable<z.ZodString>>;
480
- folder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
481
- targeting_gate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
482
- allocation_pct: z.ZodOptional<z.ZodNumber>;
483
- salt: z.ZodOptional<z.ZodString>;
484
- universe: z.ZodOptional<z.ZodString>;
485
- params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
486
- string: "string";
487
- number: "number";
488
- bool: "bool";
489
- }>>>;
490
- groups: z.ZodOptional<z.ZodArray<z.ZodObject<{
491
- name: z.ZodString;
492
- weight: z.ZodNumber;
493
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
494
- }, z.core.$strip>>>;
495
- significance_threshold: z.ZodOptional<z.ZodNumber>;
496
- min_runtime_days: z.ZodOptional<z.ZodNumber>;
497
- min_sample_size: z.ZodOptional<z.ZodNumber>;
498
- sequential_testing: z.ZodOptional<z.ZodBoolean>;
499
- goal_metric: z.ZodOptional<z.ZodObject<{
500
- name: z.ZodOptional<z.ZodString>;
501
- query: z.ZodString;
502
- }, z.core.$strip>>;
503
- guardrail_metrics: z.ZodOptional<z.ZodArray<z.ZodObject<{
504
- name: z.ZodOptional<z.ZodString>;
505
- query: z.ZodString;
506
- }, z.core.$strip>>>;
507
- }, z.core.$strip>;
508
- readonly response: z.ZodObject<{
509
- id: z.ZodString;
510
- }, z.core.$strip>;
511
- readonly examples: {
512
- readonly requestExamples: {
513
- readonly rampAllocation: {
514
- readonly summary: "Ramp allocation — 0 → 50%";
515
- readonly description: "Bumps the share of the targeted audience enrolled. Allowed only when the experiment is in `draft`.";
516
- readonly value: {
517
- readonly allocation_pct: 5000;
518
- };
519
- };
520
- readonly changeWeights: {
521
- readonly summary: "Change group weights";
522
- readonly description: "Replace the groups array — weights must still sum to 10000.";
523
- readonly value: {
524
- readonly groups: readonly [{
525
- readonly name: "control";
526
- readonly weight: 2500;
527
- }, {
528
- readonly name: "treatment";
529
- readonly weight: 7500;
530
- }];
531
- };
532
- };
533
- readonly tighterSignificance: {
534
- readonly summary: "Tighter significance threshold";
535
- readonly description: "Drop the p-value cutoff from 0.05 → 0.01. Requires Pro plan or higher.";
536
- readonly value: {
537
- readonly significance_threshold: 0.01;
538
- };
539
- };
540
- readonly updateMetadata: {
541
- readonly summary: "Update metadata";
542
- readonly description: "Change description/tag/targeting_gate freely on running experiments.";
543
- readonly value: {
544
- readonly description: "Bumped to 50% after passing canary on 25%.";
545
- readonly tag: "checkout";
546
- };
547
- };
548
- };
549
- readonly response: {
550
- readonly id: "exp_01j7wb12c3d4e5f6g7h8j9k0l1";
551
- };
552
- };
553
- readonly useCase: string;
554
- }, {
555
- readonly operationId: "deleteExperiment";
556
- readonly method: "DELETE";
557
- readonly path: "/{id}";
558
- readonly summary: "Delete an experiment";
559
- readonly description: "Archives the experiment (soft-delete via status transition). Returns `409` if the experiment is still `running` — stop it first.";
560
- readonly pathParams: {
561
- readonly id: "Stable opaque experiment id.";
562
- };
563
- readonly response: z.ZodObject<{
564
- ok: z.ZodLiteral<true>;
565
- }, z.core.$strip>;
566
- readonly examples: {
567
- readonly response: {
568
- readonly ok: true;
569
- };
570
- };
571
- readonly useCase: "Tear down an experiment after the analysis is signed off.";
572
- }, {
573
- readonly operationId: "setExperimentStatus";
574
- readonly method: "POST";
575
- readonly path: "/{id}/status";
576
- readonly summary: "Transition experiment status";
577
- readonly description: string;
578
- readonly pathParams: {
579
- readonly id: "Stable opaque experiment id.";
580
- };
581
- readonly request: z.ZodObject<{
582
- status: z.ZodEnum<{
583
- draft: "draft";
584
- running: "running";
585
- stopped: "stopped";
586
- archived: "archived";
587
- }>;
588
- }, z.core.$strip>;
589
- readonly response: z.ZodObject<{
590
- id: z.ZodString;
591
- status: z.ZodEnum<{
592
- draft: "draft";
593
- running: "running";
594
- stopped: "stopped";
595
- archived: "archived";
596
- }>;
597
- }, z.core.$strip>;
598
- readonly examples: {
599
- readonly requestExamples: {
600
- readonly start: {
601
- readonly summary: "Start — draft → running";
602
- readonly description: "Begins allocation. The experiment counts against the plan's `experiments_running` limit.";
603
- readonly value: {
604
- readonly status: "running";
605
- };
606
- };
607
- readonly stop: {
608
- readonly summary: "Stop — running → stopped";
609
- readonly description: "Halts allocation. Existing exposures remain analysable.";
610
- readonly value: {
611
- readonly status: "stopped";
612
- };
613
- };
614
- readonly archive: {
615
- readonly summary: "Archive — stopped → archived";
616
- readonly description: "Soft-deletes the experiment. List endpoints exclude archived rows by default.";
617
- readonly value: {
618
- readonly status: "archived";
619
- };
620
- };
621
- readonly restore: {
622
- readonly summary: "Restore — archived → draft";
623
- readonly description: "Un-deletes a soft-deleted experiment so it can be re-completed and started. Allowed only if it never ran.";
624
- readonly value: {
625
- readonly status: "draft";
626
- };
627
- };
628
- };
629
- readonly response: {
630
- readonly id: "exp_01j7wb12c3d4e5f6g7h8j9k0l1";
631
- readonly status: "running";
632
- };
633
- };
634
- readonly useCase: string;
635
- }, {
636
- readonly operationId: "setExperimentMetrics";
637
- readonly method: "POST";
638
- readonly path: "/{id}/metrics";
639
- readonly summary: "Attach metrics";
640
- readonly description: string;
641
- readonly pathParams: {
642
- readonly id: "Stable opaque experiment id.";
643
- };
644
- readonly request: z.ZodObject<{
645
- metrics: z.ZodArray<z.ZodObject<{
646
- metric_id: z.ZodString;
647
- role: z.ZodEnum<{
648
- goal: "goal";
649
- guardrail: "guardrail";
650
- secondary: "secondary";
651
- }>;
652
- }, z.core.$strip>>;
653
- }, z.core.$strip>;
654
- readonly response: z.ZodObject<{
655
- id: z.ZodString;
656
- metrics: z.ZodArray<z.ZodObject<{
657
- metric_id: z.ZodString;
658
- role: z.ZodEnum<{
659
- goal: "goal";
660
- guardrail: "guardrail";
661
- secondary: "secondary";
662
- }>;
663
- }, z.core.$strip>>;
664
- }, z.core.$strip>;
665
- readonly examples: {
666
- readonly requestExamples: {
667
- readonly standard: {
668
- readonly summary: "Standard — one goal + one guardrail";
669
- readonly description: "Attaches one decision metric and one safety metric.";
670
- readonly value: {
671
- readonly metrics: readonly [{
672
- readonly metric_id: "met_checkout_completed";
673
- readonly role: "goal";
674
- }, {
675
- readonly metric_id: "met_page_errors";
676
- readonly role: "guardrail";
677
- }];
678
- };
679
- };
680
- readonly detach: {
681
- readonly summary: "Detach all";
682
- readonly description: "Send an empty array to clear every metric.";
683
- readonly value: {
684
- readonly metrics: readonly [];
685
- };
686
- };
687
- };
688
- readonly response: {
689
- readonly id: "exp_01j7wb12c3d4e5f6g7h8j9k0l1";
690
- readonly metrics: readonly [{
691
- readonly metric_id: "met_checkout_completed";
692
- readonly role: "goal";
693
- }, {
694
- readonly metric_id: "met_page_errors";
695
- readonly role: "guardrail";
696
- }];
697
- };
698
- };
699
- readonly useCase: string;
700
- }, {
701
- readonly operationId: "getExperimentResults";
702
- readonly method: "GET";
703
- readonly path: "/{id}/results";
704
- readonly summary: "Get analysis results";
705
- readonly description: "Returns the latest analysis output for the experiment — one row per metric/group/day, including sample size, mean, % delta vs. control, p-value, and a sample-ratio mismatch flag.";
706
- readonly pathParams: {
707
- readonly id: "Stable opaque experiment id.";
708
- };
709
- readonly response: z.ZodObject<{
710
- experiment: z.ZodObject<{
711
- id: z.ZodString;
712
- name: z.ZodString;
713
- status: z.ZodEnum<{
714
- draft: "draft";
715
- running: "running";
716
- stopped: "stopped";
717
- archived: "archived";
718
- }>;
719
- }, z.core.$strip>;
720
- results: z.ZodArray<z.ZodObject<{
721
- metric: z.ZodString;
722
- group_name: z.ZodString;
723
- ds: z.ZodString;
724
- n: z.ZodNullable<z.ZodNumber>;
725
- mean: z.ZodNullable<z.ZodNumber>;
726
- delta_pct: z.ZodNullable<z.ZodNumber>;
727
- p_value: z.ZodNullable<z.ZodNumber>;
728
- srm_detected: z.ZodNullable<z.ZodNumber>;
729
- }, z.core.$strip>>;
730
- }, z.core.$strip>;
731
- readonly examples: {
732
- readonly response: {
733
- readonly experiment: {
734
- readonly id: "exp_01j7wb12c3d4e5f6g7h8j9k0l1";
735
- readonly name: "checkout_button_color";
736
- readonly status: "running";
737
- };
738
- readonly results: readonly [{
739
- readonly metric: "checkout_completed";
740
- readonly group_name: "control";
741
- readonly ds: "2026-05-09";
742
- readonly n: 12421;
743
- readonly mean: 0.1834;
744
- readonly delta_pct: null;
745
- readonly p_value: null;
746
- readonly srm_detected: 0;
747
- }, {
748
- readonly metric: "checkout_completed";
749
- readonly group_name: "treatment";
750
- readonly ds: "2026-05-09";
751
- readonly n: 12519;
752
- readonly mean: 0.1922;
753
- readonly delta_pct: 4.8;
754
- readonly p_value: 0.018;
755
- readonly srm_detected: 0;
756
- }];
757
- };
758
- };
759
- readonly useCase: "Render the results table on the experiment detail page or drive an automated decision once a `goal` metric reaches significance.";
760
- }, {
761
- readonly operationId: "getExperimentTimeseries";
762
- readonly method: "GET";
763
- readonly path: "/{id}/timeseries";
764
- readonly summary: "Get analysis timeseries";
765
- readonly description: "Same row shape as `/results`, but returns every daily slice rather than the latest. Filter to a single metric with the `metric` query parameter.";
766
- readonly pathParams: {
767
- readonly id: "Stable opaque experiment id.";
768
- };
769
- readonly queryParams: {
770
- readonly metric: {
771
- readonly schema: z.ZodOptional<z.ZodString>;
772
- readonly description: "Optional metric name to filter the series.";
773
- };
774
- };
775
- readonly response: z.ZodObject<{
776
- experiment: z.ZodObject<{
777
- id: z.ZodString;
778
- name: z.ZodString;
779
- status: z.ZodEnum<{
780
- draft: "draft";
781
- running: "running";
782
- stopped: "stopped";
783
- archived: "archived";
784
- }>;
785
- }, z.core.$strip>;
786
- series: z.ZodArray<z.ZodObject<{
787
- metric: z.ZodString;
788
- group_name: z.ZodString;
789
- ds: z.ZodString;
790
- n: z.ZodNullable<z.ZodNumber>;
791
- mean: z.ZodNullable<z.ZodNumber>;
792
- delta_pct: z.ZodNullable<z.ZodNumber>;
793
- p_value: z.ZodNullable<z.ZodNumber>;
794
- srm_detected: z.ZodNullable<z.ZodNumber>;
795
- }, z.core.$strip>>;
796
- }, z.core.$strip>;
797
- readonly examples: {
798
- readonly response: {
799
- readonly experiment: {
800
- readonly id: "exp_01j7wb12c3d4e5f6g7h8j9k0l1";
801
- readonly name: "checkout_button_color";
802
- readonly status: "running";
803
- };
804
- readonly series: readonly [{
805
- readonly metric: "checkout_completed";
806
- readonly group_name: "treatment";
807
- readonly ds: "2026-05-08";
808
- readonly n: 11200;
809
- readonly mean: 0.1903;
810
- readonly delta_pct: 3.9;
811
- readonly p_value: 0.034;
812
- readonly srm_detected: 0;
813
- }, {
814
- readonly metric: "checkout_completed";
815
- readonly group_name: "treatment";
816
- readonly ds: "2026-05-09";
817
- readonly n: 12519;
818
- readonly mean: 0.1922;
819
- readonly delta_pct: 4.8;
820
- readonly p_value: 0.018;
821
- readonly srm_detected: 0;
822
- }];
823
- };
824
- };
825
- readonly useCase: "Drive a chart of metric movement over the experiment runtime, or sanity-check the lift is monotonic before deciding.";
826
- }, {
827
- readonly operationId: "reanalyzeExperiment";
828
- readonly method: "POST";
829
- readonly path: "/{id}/reanalyze";
830
- readonly summary: "Re-queue analysis";
831
- readonly description: "Requeues the daily analysis pass for this experiment outside the normal cron cadence. Useful after attaching a new metric or correcting an event taxonomy. The job runs asynchronously.";
832
- readonly pathParams: {
833
- readonly id: "Stable opaque experiment id.";
834
- };
835
- readonly response: z.ZodObject<{
836
- id: z.ZodString;
837
- queued: z.ZodLiteral<true>;
838
- }, z.core.$strip>;
839
- readonly examples: {
840
- readonly response: {
841
- readonly id: "exp_01j7wb12c3d4e5f6g7h8j9k0l1";
842
- readonly queued: true;
843
- };
844
- };
845
- readonly useCase: "Force-refresh results after wiring up a new metric without waiting for the next nightly cron tick.";
846
- }];
847
- };
848
-
849
- export { type Experiment, type ExperimentCreateInput, type ExperimentMetricsInput, type ExperimentResult, type ExperimentStatus, type ExperimentTimeseriesPoint, type ExperimentUpdateInput, type ExperimentsClient, experimentsClient, experimentsResource };