@shipeasy/openapi 1.5.0 → 2.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 (101) hide show
  1. package/README.md +37 -0
  2. package/dist/chunk-EPLLHLZN.js +1616 -0
  3. package/dist/chunk-EPLLHLZN.js.map +1 -0
  4. package/dist/chunk-SPH5HWCD.js +3326 -0
  5. package/dist/chunk-SPH5HWCD.js.map +1 -0
  6. package/dist/client-pVkoo3Bf.d.ts +11186 -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 +64 -0
  11. package/dist/custom.js +292 -0
  12. package/dist/custom.js.map +1 -0
  13. package/dist/index.d.ts +29 -17
  14. package/dist/index.js +253 -2458
  15. package/dist/index.js.map +1 -0
  16. package/dist/node-context.d.ts +85 -0
  17. package/dist/node-context.js +110 -0
  18. package/dist/node-context.js.map +1 -0
  19. package/dist/schemas.d.ts +7920 -0
  20. package/dist/schemas.js +1083 -0
  21. package/dist/schemas.js.map +1 -0
  22. package/openapi.json +15297 -3044
  23. package/openapi.yaml +13979 -0
  24. package/package.json +37 -21
  25. package/spec/components/errors.yaml +53 -0
  26. package/spec/components/parameters.yaml +24 -0
  27. package/spec/components/responses.yaml +107 -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 +87 -0
  31. package/spec/components/schemas/configs.yaml +371 -0
  32. package/spec/components/schemas/connectors.yaml +593 -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 +198 -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 +1011 -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 +348 -0
  47. package/spec/paths/alert-rules.yaml +250 -0
  48. package/spec/paths/attributes.yaml +261 -0
  49. package/spec/paths/configs.yaml +744 -0
  50. package/spec/paths/connectors.yaml +748 -0
  51. package/spec/paths/errors.yaml +382 -0
  52. package/spec/paths/events.yaml +366 -0
  53. package/spec/paths/experiments.yaml +777 -0
  54. package/spec/paths/gate-templates.yaml +263 -0
  55. package/spec/paths/gates.yaml +451 -0
  56. package/spec/paths/i18n.yaml +544 -0
  57. package/spec/paths/keys.yaml +181 -0
  58. package/spec/paths/killswitches.yaml +557 -0
  59. package/spec/paths/metrics.yaml +302 -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 +247 -0
  64. package/dist/resources/alert-rules.d.ts +0 -50
  65. package/dist/resources/alert-rules.js +0 -75
  66. package/dist/resources/configs.d.ts +0 -681
  67. package/dist/resources/configs.js +0 -509
  68. package/dist/resources/experiments.d.ts +0 -849
  69. package/dist/resources/experiments.js +0 -707
  70. package/dist/resources/gates.d.ts +0 -808
  71. package/dist/resources/gates.js +0 -522
  72. package/dist/resources/index.d.ts +0 -2749
  73. package/dist/resources/index.js +0 -2391
  74. package/dist/resources/killswitches.d.ts +0 -436
  75. package/dist/resources/killswitches.js +0 -514
  76. package/dist/resources/universes.d.ts +0 -185
  77. package/dist/resources/universes.js +0 -234
  78. package/dist/schemas/alert-rules.d.ts +0 -65
  79. package/dist/schemas/alert-rules.js +0 -37
  80. package/dist/schemas/configs.d.ts +0 -154
  81. package/dist/schemas/configs.js +0 -134
  82. package/dist/schemas/constants.d.ts +0 -6
  83. package/dist/schemas/constants.js +0 -7
  84. package/dist/schemas/experiments.d.ts +0 -229
  85. package/dist/schemas/experiments.js +0 -221
  86. package/dist/schemas/folder.d.ts +0 -10
  87. package/dist/schemas/folder.js +0 -8
  88. package/dist/schemas/gates.d.ts +0 -386
  89. package/dist/schemas/gates.js +0 -190
  90. package/dist/schemas/index.d.ts +0 -11
  91. package/dist/schemas/index.js +0 -762
  92. package/dist/schemas/killswitches.d.ts +0 -110
  93. package/dist/schemas/killswitches.js +0 -226
  94. package/dist/schemas/metric-name.d.ts +0 -5
  95. package/dist/schemas/metric-name.js +0 -6
  96. package/dist/schemas/pagination.d.ts +0 -37
  97. package/dist/schemas/pagination.js +0 -44
  98. package/dist/schemas/universes.d.ts +0 -35
  99. package/dist/schemas/universes.js +0 -55
  100. package/dist/transport.d.ts +0 -30
  101. package/dist/transport.js +0 -44
@@ -1,134 +0,0 @@
1
- // src/schemas/configs.ts
2
- import { z as z2 } from "zod";
3
-
4
- // src/schemas/constants.ts
5
- var CONFIG_ENVS = ["dev", "staging", "prod"];
6
- var CONFIG_KINDS = ["config", "killswitch"];
7
-
8
- // src/schemas/folder.ts
9
- import { z } from "zod";
10
- var folderSchema = z.string().max(256).regex(/^[a-zA-Z0-9_-]+$/, "Folder must be alphanumeric, `_` or `-` (no `/`).").nullable().optional().describe(
11
- "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."
12
- );
13
-
14
- // src/schemas/configs.ts
15
- var SEGMENT = /^[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?$/;
16
- var RESERVED_FOLDER = "_default";
17
- var configNameSchema = z2.string().max(128).refine(
18
- (s) => {
19
- const parts = s.split(".");
20
- if (parts.length !== 2) return false;
21
- return parts.every((p, i) => p === RESERVED_FOLDER && i === 0 ? true : SEGMENT.test(p));
22
- },
23
- {
24
- message: "Must be `folder.name` \u2014 exactly two lowercase segments separated by a dot (e.g. `pricing.tiers`)."
25
- }
26
- ).describe(
27
- "Stable config key in `folder.name` form (two lowercase segments separated by a dot, e.g. `pricing.tiers`). Used by SDKs as `Shipeasy.getConfig('<name>')`. Immutable after create."
28
- );
29
- var configKindSchema = z2.enum(CONFIG_KINDS);
30
- var configEnvSchema = z2.enum(CONFIG_ENVS).describe("Target environment. One of the project's configured envs (`dev`, `stage`, `prod`).");
31
- var jsonSchemaSchema = z2.record(z2.string(), z2.unknown()).refine((s) => s.type === "object", { message: "Top-level schema type must be 'object'" }).describe(
32
- "JSON Schema (draft 2020-12) describing the shape of the config value. Top-level `type` must be `'object'`; every published value is validated against this schema."
33
- );
34
- var initialValuesSchema = z2.union([z2.unknown(), z2.record(configEnvSchema, z2.unknown())]).describe(
35
- "Initial config value. Either a single JSON object applied to every env, or a `{ env: value }` map seeding per-env values. Must match `schema`. Defaults to `{}` on every env when omitted."
36
- );
37
- var configCreateSchema = z2.object({
38
- name: configNameSchema,
39
- description: z2.string().max(512).optional().describe("Optional free-form description shown in the dashboard. Max 512 chars."),
40
- folder: folderSchema,
41
- schema: jsonSchemaSchema,
42
- value: initialValuesSchema.optional()
43
- }).describe("Body for `POST /api/admin/configs`. `name` + `schema` required.");
44
- var configUpdateSchema = z2.object({
45
- schema: jsonSchemaSchema.optional().describe(
46
- "Replacement schema. When supplied, the new schema is validated against every published value before it lands."
47
- ),
48
- value: z2.unknown().optional().describe(
49
- "Flat value applied to **every** env. Publishes a new version per env. To target one env, use `PUT /{id}/drafts` then `POST /{id}/publish`."
50
- ),
51
- folder: folderSchema
52
- }).describe(
53
- "Body for `PATCH /api/admin/configs/{id}`. Partial \u2014 only supplied fields change. `value` republishes on every env."
54
- );
55
- var configSchemaUpdateSchema = z2.object({ schema: jsonSchemaSchema }).describe("Schema-only update. Does not bump value versions or rebuild KV.");
56
- var configDraftUpsertSchema = z2.object({
57
- env: configEnvSchema,
58
- value: z2.unknown().describe("Draft value to stage on `env`. Validated against the config's current schema.")
59
- }).describe(
60
- "Body for `PUT /api/admin/configs/{id}/drafts`. Stages a value for a single env without publishing."
61
- );
62
- var configPublishSchema = z2.object({ env: configEnvSchema }).describe(
63
- "Body for `POST /api/admin/configs/{id}/publish` and `DELETE /api/admin/configs/{id}/drafts`. Names the target env."
64
- );
65
- var configEnvPublishedSchema = z2.object({
66
- version: z2.number().int().describe("Monotonically increasing version per env."),
67
- publishedAt: z2.string().describe("ISO-8601 publish timestamp."),
68
- publishedBy: z2.string().describe("Email/id of the actor who published this version.")
69
- });
70
- var configDraftSummarySchema = z2.object({
71
- updatedAt: z2.string().describe("ISO-8601 last-edit timestamp on the draft."),
72
- authorEmail: z2.string().describe("Email/id of the actor who last edited the draft."),
73
- baseVersion: z2.number().int().describe("Published version the draft was forked from.")
74
- });
75
- var configResponseSchema = z2.object({
76
- id: z2.string().describe("Stable opaque config id (`cfg_\u2026`)."),
77
- name: configNameSchema,
78
- description: z2.string().nullable(),
79
- schema: jsonSchemaSchema,
80
- updatedAt: z2.string().describe("ISO-8601 timestamp of last mutation."),
81
- envs: z2.record(configEnvSchema, configEnvPublishedSchema).describe("Per-env latest published version metadata."),
82
- drafts: z2.record(configEnvSchema, configDraftSummarySchema).describe("Per-env active drafts (if any)."),
83
- values: z2.record(configEnvSchema, z2.unknown()).optional().describe("Per-env latest published values (only returned by `GET /{id}`, not list)."),
84
- draftValues: z2.record(configEnvSchema, z2.unknown()).optional().describe("Per-env draft values (only returned by `GET /{id}`).")
85
- });
86
- var configCreateResponseSchema = z2.object({
87
- id: z2.string().describe("Newly assigned config id."),
88
- name: configNameSchema
89
- });
90
- var configUpdateResponseSchema = z2.object({
91
- id: z2.string().describe("Config id that was updated.")
92
- });
93
- var configDeleteResponseSchema = z2.object({ ok: z2.literal(true) });
94
- var configDraftSaveResponseSchema = z2.object({
95
- id: z2.string(),
96
- env: configEnvSchema,
97
- baseVersion: z2.number().int().describe("Published version the draft is based on."),
98
- updatedAt: z2.string()
99
- });
100
- var configDraftDiscardResponseSchema = z2.object({ ok: z2.literal(true) });
101
- var configPublishResponseSchema = z2.object({
102
- id: z2.string(),
103
- env: configEnvSchema,
104
- version: z2.number().int().describe("Newly published version on `env`.")
105
- });
106
- var configActivityEntrySchema = z2.object({
107
- id: z2.string(),
108
- action: z2.string().describe("Audit action (e.g. `config.create`, `config.publish`)."),
109
- actorEmail: z2.string(),
110
- actorType: z2.enum(["user", "cli", "system"]),
111
- payload: z2.unknown().nullable(),
112
- createdAt: z2.string().describe("ISO-8601 timestamp.")
113
- });
114
- var configActivityResponseSchema = z2.array(configActivityEntrySchema).describe("Recent audit rows for one config, newest first.");
115
- export {
116
- configActivityEntrySchema,
117
- configActivityResponseSchema,
118
- configCreateResponseSchema,
119
- configCreateSchema,
120
- configDeleteResponseSchema,
121
- configDraftDiscardResponseSchema,
122
- configDraftSaveResponseSchema,
123
- configDraftUpsertSchema,
124
- configEnvSchema,
125
- configKindSchema,
126
- configNameSchema,
127
- configPublishResponseSchema,
128
- configPublishSchema,
129
- configResponseSchema,
130
- configSchemaUpdateSchema,
131
- configUpdateResponseSchema,
132
- configUpdateSchema,
133
- jsonSchemaSchema
134
- };
@@ -1,6 +0,0 @@
1
- declare const CONFIG_ENVS: readonly ["dev", "staging", "prod"];
2
- type ConfigEnv = (typeof CONFIG_ENVS)[number];
3
- declare const CONFIG_KINDS: readonly ["config", "killswitch"];
4
- type ConfigKind = (typeof CONFIG_KINDS)[number];
5
-
6
- export { CONFIG_ENVS, CONFIG_KINDS, type ConfigEnv, type ConfigKind };
@@ -1,7 +0,0 @@
1
- // src/schemas/constants.ts
2
- var CONFIG_ENVS = ["dev", "staging", "prod"];
3
- var CONFIG_KINDS = ["config", "killswitch"];
4
- export {
5
- CONFIG_ENVS,
6
- CONFIG_KINDS
7
- };
@@ -1,229 +0,0 @@
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.ZodString;
20
- declare const experimentCreateSchema: z.ZodObject<{
21
- name: z.ZodString;
22
- description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
23
- hypothesis: z.ZodDefault<z.ZodNullable<z.ZodString>>;
24
- tag: z.ZodDefault<z.ZodNullable<z.ZodString>>;
25
- owner_email: z.ZodDefault<z.ZodNullable<z.ZodString>>;
26
- audience: z.ZodDefault<z.ZodNullable<z.ZodString>>;
27
- bucket_by: z.ZodDefault<z.ZodNullable<z.ZodString>>;
28
- folder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
29
- universe: z.ZodString;
30
- targeting_gate: z.ZodDefault<z.ZodNullable<z.ZodString>>;
31
- allocation_pct: z.ZodDefault<z.ZodNumber>;
32
- salt: z.ZodOptional<z.ZodString>;
33
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodEnum<{
34
- string: "string";
35
- number: "number";
36
- bool: "bool";
37
- }>>>;
38
- groups: z.ZodArray<z.ZodObject<{
39
- name: z.ZodString;
40
- weight: z.ZodNumber;
41
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
42
- }, z.core.$strip>>;
43
- significance_threshold: z.ZodDefault<z.ZodNumber>;
44
- min_runtime_days: z.ZodDefault<z.ZodNumber>;
45
- min_sample_size: z.ZodDefault<z.ZodNumber>;
46
- sequential_testing: z.ZodDefault<z.ZodBoolean>;
47
- goal_metric: z.ZodOptional<z.ZodObject<{
48
- name: z.ZodOptional<z.ZodString>;
49
- query: z.ZodString;
50
- }, z.core.$strip>>;
51
- guardrail_metrics: z.ZodDefault<z.ZodArray<z.ZodObject<{
52
- name: z.ZodOptional<z.ZodString>;
53
- query: z.ZodString;
54
- }, z.core.$strip>>>;
55
- }, z.core.$strip>;
56
- declare const experimentUpdateSchema: z.ZodObject<{
57
- name: z.ZodOptional<z.ZodString>;
58
- description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
59
- hypothesis: z.ZodOptional<z.ZodNullable<z.ZodString>>;
60
- tag: z.ZodOptional<z.ZodNullable<z.ZodString>>;
61
- owner_email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
62
- audience: z.ZodOptional<z.ZodNullable<z.ZodString>>;
63
- bucket_by: z.ZodOptional<z.ZodNullable<z.ZodString>>;
64
- folder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
65
- targeting_gate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
66
- allocation_pct: z.ZodOptional<z.ZodNumber>;
67
- salt: z.ZodOptional<z.ZodString>;
68
- universe: z.ZodOptional<z.ZodString>;
69
- params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
70
- string: "string";
71
- number: "number";
72
- bool: "bool";
73
- }>>>;
74
- groups: z.ZodOptional<z.ZodArray<z.ZodObject<{
75
- name: z.ZodString;
76
- weight: z.ZodNumber;
77
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
78
- }, z.core.$strip>>>;
79
- significance_threshold: z.ZodOptional<z.ZodNumber>;
80
- min_runtime_days: z.ZodOptional<z.ZodNumber>;
81
- min_sample_size: z.ZodOptional<z.ZodNumber>;
82
- sequential_testing: z.ZodOptional<z.ZodBoolean>;
83
- goal_metric: z.ZodOptional<z.ZodObject<{
84
- name: z.ZodOptional<z.ZodString>;
85
- query: z.ZodString;
86
- }, z.core.$strip>>;
87
- guardrail_metrics: z.ZodOptional<z.ZodArray<z.ZodObject<{
88
- name: z.ZodOptional<z.ZodString>;
89
- query: z.ZodString;
90
- }, z.core.$strip>>>;
91
- }, z.core.$strip>;
92
- declare const experimentStatusUpdateSchema: z.ZodObject<{
93
- status: z.ZodEnum<{
94
- draft: "draft";
95
- running: "running";
96
- stopped: "stopped";
97
- archived: "archived";
98
- }>;
99
- }, z.core.$strip>;
100
- declare const experimentMetricsUpdateSchema: z.ZodObject<{
101
- metrics: z.ZodArray<z.ZodObject<{
102
- metric_id: z.ZodString;
103
- role: z.ZodEnum<{
104
- goal: "goal";
105
- guardrail: "guardrail";
106
- secondary: "secondary";
107
- }>;
108
- }, z.core.$strip>>;
109
- }, z.core.$strip>;
110
- declare const experimentResponseSchema: z.ZodObject<{
111
- id: z.ZodString;
112
- name: z.ZodString;
113
- description: z.ZodNullable<z.ZodString>;
114
- hypothesis: z.ZodNullable<z.ZodString>;
115
- tag: z.ZodNullable<z.ZodString>;
116
- ownerEmail: z.ZodNullable<z.ZodString>;
117
- audience: z.ZodNullable<z.ZodString>;
118
- bucketBy: z.ZodNullable<z.ZodString>;
119
- folder: z.ZodNullable<z.ZodString>;
120
- status: z.ZodEnum<{
121
- draft: "draft";
122
- running: "running";
123
- stopped: "stopped";
124
- archived: "archived";
125
- }>;
126
- universe: z.ZodString;
127
- targetingGate: z.ZodNullable<z.ZodString>;
128
- allocationPct: z.ZodNumber;
129
- salt: z.ZodString;
130
- params: z.ZodRecord<z.ZodString, z.ZodEnum<{
131
- string: "string";
132
- number: "number";
133
- bool: "bool";
134
- }>>;
135
- groups: z.ZodArray<z.ZodObject<{
136
- name: z.ZodString;
137
- weight: z.ZodNumber;
138
- params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
139
- }, z.core.$strip>>;
140
- significanceThreshold: z.ZodNumber;
141
- minRuntimeDays: z.ZodNumber;
142
- minSampleSize: z.ZodNumber;
143
- sequentialTesting: z.ZodBoolean;
144
- startedAt: z.ZodNullable<z.ZodString>;
145
- stoppedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
146
- updatedAt: z.ZodString;
147
- }, z.core.$strip>;
148
- declare const experimentCreateResponseSchema: z.ZodObject<{
149
- id: z.ZodString;
150
- name: z.ZodString;
151
- }, z.core.$strip>;
152
- declare const experimentUpdateResponseSchema: z.ZodObject<{
153
- id: z.ZodString;
154
- }, z.core.$strip>;
155
- declare const experimentDeleteResponseSchema: z.ZodObject<{
156
- ok: z.ZodLiteral<true>;
157
- }, z.core.$strip>;
158
- declare const experimentStatusResponseSchema: z.ZodObject<{
159
- id: z.ZodString;
160
- status: z.ZodEnum<{
161
- draft: "draft";
162
- running: "running";
163
- stopped: "stopped";
164
- archived: "archived";
165
- }>;
166
- }, z.core.$strip>;
167
- declare const experimentMetricsResponseSchema: z.ZodObject<{
168
- id: z.ZodString;
169
- metrics: z.ZodArray<z.ZodObject<{
170
- metric_id: z.ZodString;
171
- role: z.ZodEnum<{
172
- goal: "goal";
173
- guardrail: "guardrail";
174
- secondary: "secondary";
175
- }>;
176
- }, z.core.$strip>>;
177
- }, z.core.$strip>;
178
- declare const experimentResultsResponseSchema: z.ZodObject<{
179
- experiment: z.ZodObject<{
180
- id: z.ZodString;
181
- name: z.ZodString;
182
- status: z.ZodEnum<{
183
- draft: "draft";
184
- running: "running";
185
- stopped: "stopped";
186
- archived: "archived";
187
- }>;
188
- }, z.core.$strip>;
189
- results: z.ZodArray<z.ZodObject<{
190
- metric: z.ZodString;
191
- group_name: z.ZodString;
192
- ds: z.ZodString;
193
- n: z.ZodNullable<z.ZodNumber>;
194
- mean: z.ZodNullable<z.ZodNumber>;
195
- delta_pct: z.ZodNullable<z.ZodNumber>;
196
- p_value: z.ZodNullable<z.ZodNumber>;
197
- srm_detected: z.ZodNullable<z.ZodNumber>;
198
- }, z.core.$strip>>;
199
- }, z.core.$strip>;
200
- declare const experimentTimeseriesResponseSchema: z.ZodObject<{
201
- experiment: z.ZodObject<{
202
- id: z.ZodString;
203
- name: z.ZodString;
204
- status: z.ZodEnum<{
205
- draft: "draft";
206
- running: "running";
207
- stopped: "stopped";
208
- archived: "archived";
209
- }>;
210
- }, z.core.$strip>;
211
- series: z.ZodArray<z.ZodObject<{
212
- metric: z.ZodString;
213
- group_name: z.ZodString;
214
- ds: z.ZodString;
215
- n: z.ZodNullable<z.ZodNumber>;
216
- mean: z.ZodNullable<z.ZodNumber>;
217
- delta_pct: z.ZodNullable<z.ZodNumber>;
218
- p_value: z.ZodNullable<z.ZodNumber>;
219
- srm_detected: z.ZodNullable<z.ZodNumber>;
220
- }, z.core.$strip>>;
221
- }, z.core.$strip>;
222
- declare const experimentReanalyzeResponseSchema: z.ZodObject<{
223
- id: z.ZodString;
224
- queued: z.ZodLiteral<true>;
225
- }, z.core.$strip>;
226
- type ExperimentCreateInput = z.infer<typeof experimentCreateSchema>;
227
- type ExperimentUpdateInput = z.infer<typeof experimentUpdateSchema>;
228
-
229
- 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 };
@@ -1,221 +0,0 @@
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.string().min(1).max(128).regex(
35
- /^[a-zA-Z_][a-zA-Z0-9_]*$/,
36
- "Must be a user-attribute name (letters, digits, underscore; not starting with a digit)."
37
- ).describe(
38
- "User-attribute name used as the bucketing key \u2014 e.g. `user_id` (default), `session_id`, `device_id`, or a custom attribute like `company_id` to keep a whole org on one variant. Defaults to `user_id` when omitted."
39
- );
40
- var experimentCreateSchema = z3.object({
41
- name: experimentNameSchema,
42
- description: z3.string().max(2e3).nullable().default(null).describe("Free-form description. Max 2000 chars, markdown rendered in the dashboard."),
43
- hypothesis: z3.string().max(4e3).nullable().default(null).describe("Hypothesis statement shown in the editor. Display-only."),
44
- tag: z3.string().max(64).nullable().default(null).describe("Short tag chip rendered next to the name. Display-only."),
45
- owner_email: z3.string().max(254).nullable().default(null).describe("Owner email. Display-only."),
46
- audience: z3.string().max(256).nullable().default(null).describe("Audience label shown in the editor. Display-only."),
47
- bucket_by: bucketBySchema.nullable().default(null),
48
- folder: folderSchema,
49
- universe: z3.string().min(1).describe(
50
- "Name of an existing universe in the project. Returns `422` if the universe doesn't exist."
51
- ),
52
- targeting_gate: z3.string().nullable().default(null).describe(
53
- "Optional gate name. Only callers that pass the gate are enrolled in the experiment."
54
- ),
55
- allocation_pct: z3.number().int().min(0).max(1e4).default(0).describe(
56
- "Share of the (gated) audience allocated to the experiment, in basis points (0\u201310000 = 0%\u2013100%). `0` = unallocated. Immutable while the experiment is running."
57
- ),
58
- salt: z3.string().min(1).max(64).optional().describe("Hash salt for bucketing. Auto-generated if omitted. Immutable while running."),
59
- params: paramSchemaSchema.default({}),
60
- groups: z3.array(experimentGroupSchema).min(2).describe(
61
- "Two or more variants. Weights must sum to exactly 10000 (100%). Immutable while running."
62
- ),
63
- significance_threshold: z3.number().min(1e-4).max(0.5).default(0.05).describe(
64
- "p-value cutoff used by the analysis pass. Defaults to `0.05`. Values other than 0.05 require Pro plan or higher."
65
- ),
66
- min_runtime_days: z3.number().int().min(0).max(365).default(0).describe("Minimum days the experiment must run before results are considered conclusive."),
67
- min_sample_size: z3.number().int().min(1).default(100).describe("Minimum exposures per group before results are considered conclusive."),
68
- sequential_testing: z3.boolean().default(false).describe(
69
- "Enable sequential testing (always-valid p-values). Requires Premium plan or higher."
70
- ),
71
- goal_metric: experimentInlineMetricSchema.optional().describe(
72
- "Single goal metric defined inline as a DSL query. The underlying event is auto-created if missing."
73
- ),
74
- guardrail_metrics: z3.array(experimentInlineMetricSchema).max(10).default([]).describe(
75
- "Up to 10 guardrail metrics defined inline. Each is upserted (event + metric) and attached with role=guardrail."
76
- )
77
- }).refine(
78
- (e) => e.groups.reduce((s, g) => s + g.weight, 0) === 1e4,
79
- "groups weights must sum to exactly 10000"
80
- ).describe(
81
- "Body for `POST /api/admin/experiments`. `name`, `universe`, and `groups` (\u22652, weights sum to 10000) required."
82
- );
83
- var experimentUpdateSchema = z3.object({
84
- name: experimentNameSchema.optional(),
85
- description: z3.string().max(2e3).nullable().optional(),
86
- hypothesis: z3.string().max(4e3).nullable().optional(),
87
- tag: z3.string().max(64).nullable().optional(),
88
- owner_email: z3.string().max(254).nullable().optional(),
89
- audience: z3.string().max(256).nullable().optional(),
90
- bucket_by: bucketBySchema.nullable().optional(),
91
- folder: folderSchema,
92
- targeting_gate: z3.string().nullable().optional(),
93
- allocation_pct: z3.number().int().min(0).max(1e4).optional().describe("Basis-points allocation (0\u201310000). Immutable while the experiment is running."),
94
- salt: z3.string().min(1).max(64).optional().describe("Hash salt. Immutable while running."),
95
- universe: z3.string().optional().describe(
96
- "New universe name. Immutable while running. Returns `422` if the universe doesn't exist."
97
- ),
98
- params: paramSchemaSchema.optional(),
99
- groups: z3.array(experimentGroupSchema).min(2).optional().describe("Replacement groups. Weights must sum to 10000. Immutable while running."),
100
- significance_threshold: z3.number().min(1e-4).max(0.5).optional(),
101
- min_runtime_days: z3.number().int().min(0).max(365).optional(),
102
- min_sample_size: z3.number().int().min(1).optional(),
103
- sequential_testing: z3.boolean().optional(),
104
- goal_metric: experimentInlineMetricSchema.optional().describe("Replaces the goal metric (event auto-upserted)."),
105
- guardrail_metrics: z3.array(experimentInlineMetricSchema).max(10).optional().describe("Replaces the guardrail set wholesale (event auto-upserted per entry).")
106
- }).describe(
107
- "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)."
108
- );
109
- var experimentStatusUpdateSchema = z3.object({
110
- status: z3.enum(["draft", "running", "stopped", "archived"]).describe(
111
- "Target status. Allowed transitions: `draft \u2192 running`, `running \u2192 stopped`, `stopped \u2192 archived`, `draft \u2192 archived`, and `archived \u2192 draft` (restore \u2014 only if the experiment never started). Restarting an archived experiment directly is not allowed; restore it to draft first, then start."
112
- )
113
- }).describe("Body for `POST /api/admin/experiments/{id}/status`.");
114
- var experimentMetricsUpdateSchema = z3.object({
115
- metrics: z3.array(
116
- z3.object({
117
- metric_id: z3.string().describe("Existing metric id in the project."),
118
- role: z3.enum(["goal", "guardrail", "secondary"]).describe(
119
- "Metric role. `goal` drives the decision, `guardrail` blocks ship if degraded, `secondary` is informational."
120
- )
121
- })
122
- ).describe("Replacement metrics list \u2014 replaces the current attachments wholesale.")
123
- }).describe(
124
- "Body for `POST /api/admin/experiments/{id}/metrics`. Replaces the experiment's metric attachments wholesale. Returns `422` if any `metric_id` is unknown."
125
- );
126
- var experimentResponseSchema = z3.object({
127
- id: z3.string().describe("Stable opaque experiment id (`exp_\u2026`)."),
128
- name: experimentNameSchema,
129
- description: z3.string().nullable(),
130
- hypothesis: z3.string().nullable(),
131
- tag: z3.string().nullable(),
132
- ownerEmail: z3.string().nullable(),
133
- audience: z3.string().nullable(),
134
- bucketBy: bucketBySchema.nullable(),
135
- folder: z3.string().nullable(),
136
- status: z3.enum(["draft", "running", "stopped", "archived"]),
137
- universe: z3.string().describe("Universe name this experiment draws from."),
138
- targetingGate: z3.string().nullable(),
139
- allocationPct: z3.number().int().describe("Allocation in basis points (0\u201310000)."),
140
- salt: z3.string(),
141
- params: z3.record(z3.string(), z3.enum(["string", "bool", "number"])),
142
- groups: z3.array(experimentGroupSchema),
143
- significanceThreshold: z3.number(),
144
- minRuntimeDays: z3.number().int(),
145
- minSampleSize: z3.number().int(),
146
- sequentialTesting: z3.boolean(),
147
- startedAt: z3.string().nullable().describe("ISO-8601 timestamp the experiment last transitioned to `running`, or `null`."),
148
- stoppedAt: z3.string().nullable().optional(),
149
- updatedAt: z3.string()
150
- });
151
- var experimentCreateResponseSchema = z3.object({
152
- id: z3.string().describe("Newly assigned experiment id."),
153
- name: experimentNameSchema
154
- });
155
- var experimentUpdateResponseSchema = z3.object({
156
- id: z3.string().describe("Experiment id that was updated.")
157
- });
158
- var experimentDeleteResponseSchema = z3.object({ ok: z3.literal(true) });
159
- var experimentStatusResponseSchema = z3.object({
160
- id: z3.string(),
161
- status: z3.enum(["draft", "running", "stopped", "archived"])
162
- });
163
- var experimentMetricsResponseSchema = z3.object({
164
- id: z3.string(),
165
- metrics: z3.array(
166
- z3.object({
167
- metric_id: z3.string(),
168
- role: z3.enum(["goal", "guardrail", "secondary"])
169
- })
170
- )
171
- });
172
- var experimentResultRowSchema = z3.object({
173
- metric: z3.string(),
174
- group_name: z3.string(),
175
- ds: z3.string().describe("Date slice (`YYYY-MM-DD`)."),
176
- n: z3.number().nullable(),
177
- mean: z3.number().nullable(),
178
- delta_pct: z3.number().nullable(),
179
- p_value: z3.number().nullable(),
180
- srm_detected: z3.number().nullable().describe("`1` if sample-ratio mismatch detected, else `0`.")
181
- });
182
- var experimentResultsResponseSchema = z3.object({
183
- experiment: z3.object({
184
- id: z3.string(),
185
- name: experimentNameSchema,
186
- status: z3.enum(["draft", "running", "stopped", "archived"])
187
- }),
188
- results: z3.array(experimentResultRowSchema)
189
- });
190
- var experimentTimeseriesResponseSchema = z3.object({
191
- experiment: z3.object({
192
- id: z3.string(),
193
- name: experimentNameSchema,
194
- status: z3.enum(["draft", "running", "stopped", "archived"])
195
- }),
196
- series: z3.array(experimentResultRowSchema)
197
- });
198
- var experimentReanalyzeResponseSchema = z3.object({
199
- id: z3.string(),
200
- queued: z3.literal(true)
201
- });
202
- export {
203
- bucketBySchema,
204
- experimentCreateResponseSchema,
205
- experimentCreateSchema,
206
- experimentDeleteResponseSchema,
207
- experimentGroupSchema,
208
- experimentInlineMetricSchema,
209
- experimentMetricsResponseSchema,
210
- experimentMetricsUpdateSchema,
211
- experimentNameSchema,
212
- experimentReanalyzeResponseSchema,
213
- experimentResponseSchema,
214
- experimentResultsResponseSchema,
215
- experimentStatusResponseSchema,
216
- experimentStatusUpdateSchema,
217
- experimentTimeseriesResponseSchema,
218
- experimentUpdateResponseSchema,
219
- experimentUpdateSchema,
220
- paramSchemaSchema
221
- };
@@ -1,10 +0,0 @@
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 };
@@ -1,8 +0,0 @@
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
- };