@shipeasy/openapi 1.2.0 → 1.5.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.
- package/dist/index.js +40 -9
- package/dist/resources/alert-rules.d.ts +3 -1
- package/dist/resources/alert-rules.js +11 -2
- package/dist/resources/experiments.d.ts +6 -30
- package/dist/resources/experiments.js +6 -1
- package/dist/resources/gates.d.ts +95 -0
- package/dist/resources/gates.js +23 -6
- package/dist/resources/index.d.ts +101 -30
- package/dist/resources/index.js +40 -9
- package/dist/schemas/alert-rules.d.ts +23 -1
- package/dist/schemas/alert-rules.js +13 -3
- package/dist/schemas/experiments.d.ts +4 -20
- package/dist/schemas/experiments.js +6 -1
- package/dist/schemas/gates.d.ts +83 -1
- package/dist/schemas/gates.js +24 -6
- package/dist/schemas/index.d.ts +2 -2
- package/dist/schemas/index.js +42 -9
- package/openapi.json +319 -51
- package/package.json +1 -1
package/dist/schemas/gates.d.ts
CHANGED
|
@@ -17,10 +17,18 @@ declare const gateRuleSchema: z.ZodObject<{
|
|
|
17
17
|
semver_gte: "semver_gte";
|
|
18
18
|
semver_lt: "semver_lt";
|
|
19
19
|
semver_lte: "semver_lte";
|
|
20
|
+
gate_pass: "gate_pass";
|
|
21
|
+
exp_in: "exp_in";
|
|
20
22
|
}>;
|
|
21
23
|
value: z.ZodUnknown;
|
|
22
24
|
}, z.core.$strip>;
|
|
23
25
|
declare const gateNameSchema: z.ZodString;
|
|
26
|
+
declare const rampSchema: z.ZodObject<{
|
|
27
|
+
from: z.ZodNumber;
|
|
28
|
+
to: z.ZodNumber;
|
|
29
|
+
startAt: z.ZodNumber;
|
|
30
|
+
durationMs: z.ZodNumber;
|
|
31
|
+
}, z.core.$strip>;
|
|
24
32
|
declare const stackedGateEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
25
33
|
id: z.ZodString;
|
|
26
34
|
type: z.ZodLiteral<"condition">;
|
|
@@ -47,9 +55,20 @@ declare const stackedGateEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
47
55
|
semver_gte: "semver_gte";
|
|
48
56
|
semver_lt: "semver_lt";
|
|
49
57
|
semver_lte: "semver_lte";
|
|
58
|
+
gate_pass: "gate_pass";
|
|
59
|
+
exp_in: "exp_in";
|
|
50
60
|
}>;
|
|
51
61
|
value: z.ZodUnknown;
|
|
52
62
|
}, z.core.$strip>>>;
|
|
63
|
+
rolloutPct: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
bucketBy: z.ZodOptional<z.ZodString>;
|
|
65
|
+
salt: z.ZodOptional<z.ZodString>;
|
|
66
|
+
ramp: z.ZodOptional<z.ZodObject<{
|
|
67
|
+
from: z.ZodNumber;
|
|
68
|
+
to: z.ZodNumber;
|
|
69
|
+
startAt: z.ZodNumber;
|
|
70
|
+
durationMs: z.ZodNumber;
|
|
71
|
+
}, z.core.$strip>>;
|
|
53
72
|
locked: z.ZodOptional<z.ZodBoolean>;
|
|
54
73
|
}, z.core.$strip>, z.ZodObject<{
|
|
55
74
|
id: z.ZodString;
|
|
@@ -59,6 +78,12 @@ declare const stackedGateEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
59
78
|
rolloutPct: z.ZodNumber;
|
|
60
79
|
bucketBy: z.ZodOptional<z.ZodString>;
|
|
61
80
|
salt: z.ZodOptional<z.ZodString>;
|
|
81
|
+
ramp: z.ZodOptional<z.ZodObject<{
|
|
82
|
+
from: z.ZodNumber;
|
|
83
|
+
to: z.ZodNumber;
|
|
84
|
+
startAt: z.ZodNumber;
|
|
85
|
+
durationMs: z.ZodNumber;
|
|
86
|
+
}, z.core.$strip>>;
|
|
62
87
|
locked: z.ZodOptional<z.ZodBoolean>;
|
|
63
88
|
}, z.core.$strip>], "type">;
|
|
64
89
|
declare const gateMetadataPatchSchema: z.ZodObject<{
|
|
@@ -95,6 +120,8 @@ declare const gateCreateSchema: z.ZodObject<{
|
|
|
95
120
|
semver_gte: "semver_gte";
|
|
96
121
|
semver_lt: "semver_lt";
|
|
97
122
|
semver_lte: "semver_lte";
|
|
123
|
+
gate_pass: "gate_pass";
|
|
124
|
+
exp_in: "exp_in";
|
|
98
125
|
}>;
|
|
99
126
|
value: z.ZodUnknown;
|
|
100
127
|
}, z.core.$strip>>>;
|
|
@@ -125,9 +152,20 @@ declare const gateCreateSchema: z.ZodObject<{
|
|
|
125
152
|
semver_gte: "semver_gte";
|
|
126
153
|
semver_lt: "semver_lt";
|
|
127
154
|
semver_lte: "semver_lte";
|
|
155
|
+
gate_pass: "gate_pass";
|
|
156
|
+
exp_in: "exp_in";
|
|
128
157
|
}>;
|
|
129
158
|
value: z.ZodUnknown;
|
|
130
159
|
}, z.core.$strip>>>;
|
|
160
|
+
rolloutPct: z.ZodOptional<z.ZodNumber>;
|
|
161
|
+
bucketBy: z.ZodOptional<z.ZodString>;
|
|
162
|
+
salt: z.ZodOptional<z.ZodString>;
|
|
163
|
+
ramp: z.ZodOptional<z.ZodObject<{
|
|
164
|
+
from: z.ZodNumber;
|
|
165
|
+
to: z.ZodNumber;
|
|
166
|
+
startAt: z.ZodNumber;
|
|
167
|
+
durationMs: z.ZodNumber;
|
|
168
|
+
}, z.core.$strip>>;
|
|
131
169
|
locked: z.ZodOptional<z.ZodBoolean>;
|
|
132
170
|
}, z.core.$strip>, z.ZodObject<{
|
|
133
171
|
id: z.ZodString;
|
|
@@ -137,6 +175,12 @@ declare const gateCreateSchema: z.ZodObject<{
|
|
|
137
175
|
rolloutPct: z.ZodNumber;
|
|
138
176
|
bucketBy: z.ZodOptional<z.ZodString>;
|
|
139
177
|
salt: z.ZodOptional<z.ZodString>;
|
|
178
|
+
ramp: z.ZodOptional<z.ZodObject<{
|
|
179
|
+
from: z.ZodNumber;
|
|
180
|
+
to: z.ZodNumber;
|
|
181
|
+
startAt: z.ZodNumber;
|
|
182
|
+
durationMs: z.ZodNumber;
|
|
183
|
+
}, z.core.$strip>>;
|
|
140
184
|
locked: z.ZodOptional<z.ZodBoolean>;
|
|
141
185
|
}, z.core.$strip>], "type">>>>;
|
|
142
186
|
}, z.core.$strip>;
|
|
@@ -165,6 +209,8 @@ declare const gateUpdateSchema: z.ZodObject<{
|
|
|
165
209
|
semver_gte: "semver_gte";
|
|
166
210
|
semver_lt: "semver_lt";
|
|
167
211
|
semver_lte: "semver_lte";
|
|
212
|
+
gate_pass: "gate_pass";
|
|
213
|
+
exp_in: "exp_in";
|
|
168
214
|
}>;
|
|
169
215
|
value: z.ZodUnknown;
|
|
170
216
|
}, z.core.$strip>>>;
|
|
@@ -195,9 +241,20 @@ declare const gateUpdateSchema: z.ZodObject<{
|
|
|
195
241
|
semver_gte: "semver_gte";
|
|
196
242
|
semver_lt: "semver_lt";
|
|
197
243
|
semver_lte: "semver_lte";
|
|
244
|
+
gate_pass: "gate_pass";
|
|
245
|
+
exp_in: "exp_in";
|
|
198
246
|
}>;
|
|
199
247
|
value: z.ZodUnknown;
|
|
200
248
|
}, z.core.$strip>>>;
|
|
249
|
+
rolloutPct: z.ZodOptional<z.ZodNumber>;
|
|
250
|
+
bucketBy: z.ZodOptional<z.ZodString>;
|
|
251
|
+
salt: z.ZodOptional<z.ZodString>;
|
|
252
|
+
ramp: z.ZodOptional<z.ZodObject<{
|
|
253
|
+
from: z.ZodNumber;
|
|
254
|
+
to: z.ZodNumber;
|
|
255
|
+
startAt: z.ZodNumber;
|
|
256
|
+
durationMs: z.ZodNumber;
|
|
257
|
+
}, z.core.$strip>>;
|
|
201
258
|
locked: z.ZodOptional<z.ZodBoolean>;
|
|
202
259
|
}, z.core.$strip>, z.ZodObject<{
|
|
203
260
|
id: z.ZodString;
|
|
@@ -207,6 +264,12 @@ declare const gateUpdateSchema: z.ZodObject<{
|
|
|
207
264
|
rolloutPct: z.ZodNumber;
|
|
208
265
|
bucketBy: z.ZodOptional<z.ZodString>;
|
|
209
266
|
salt: z.ZodOptional<z.ZodString>;
|
|
267
|
+
ramp: z.ZodOptional<z.ZodObject<{
|
|
268
|
+
from: z.ZodNumber;
|
|
269
|
+
to: z.ZodNumber;
|
|
270
|
+
startAt: z.ZodNumber;
|
|
271
|
+
durationMs: z.ZodNumber;
|
|
272
|
+
}, z.core.$strip>>;
|
|
210
273
|
locked: z.ZodOptional<z.ZodBoolean>;
|
|
211
274
|
}, z.core.$strip>], "type">>>>;
|
|
212
275
|
}, z.core.$strip>;
|
|
@@ -235,6 +298,8 @@ declare const gateResponseSchema: z.ZodObject<{
|
|
|
235
298
|
semver_gte: "semver_gte";
|
|
236
299
|
semver_lt: "semver_lt";
|
|
237
300
|
semver_lte: "semver_lte";
|
|
301
|
+
gate_pass: "gate_pass";
|
|
302
|
+
exp_in: "exp_in";
|
|
238
303
|
}>;
|
|
239
304
|
value: z.ZodUnknown;
|
|
240
305
|
}, z.core.$strip>>>;
|
|
@@ -270,9 +335,20 @@ declare const gateResponseSchema: z.ZodObject<{
|
|
|
270
335
|
semver_gte: "semver_gte";
|
|
271
336
|
semver_lt: "semver_lt";
|
|
272
337
|
semver_lte: "semver_lte";
|
|
338
|
+
gate_pass: "gate_pass";
|
|
339
|
+
exp_in: "exp_in";
|
|
273
340
|
}>;
|
|
274
341
|
value: z.ZodUnknown;
|
|
275
342
|
}, z.core.$strip>>>;
|
|
343
|
+
rolloutPct: z.ZodOptional<z.ZodNumber>;
|
|
344
|
+
bucketBy: z.ZodOptional<z.ZodString>;
|
|
345
|
+
salt: z.ZodOptional<z.ZodString>;
|
|
346
|
+
ramp: z.ZodOptional<z.ZodObject<{
|
|
347
|
+
from: z.ZodNumber;
|
|
348
|
+
to: z.ZodNumber;
|
|
349
|
+
startAt: z.ZodNumber;
|
|
350
|
+
durationMs: z.ZodNumber;
|
|
351
|
+
}, z.core.$strip>>;
|
|
276
352
|
locked: z.ZodOptional<z.ZodBoolean>;
|
|
277
353
|
}, z.core.$strip>, z.ZodObject<{
|
|
278
354
|
id: z.ZodString;
|
|
@@ -282,6 +358,12 @@ declare const gateResponseSchema: z.ZodObject<{
|
|
|
282
358
|
rolloutPct: z.ZodNumber;
|
|
283
359
|
bucketBy: z.ZodOptional<z.ZodString>;
|
|
284
360
|
salt: z.ZodOptional<z.ZodString>;
|
|
361
|
+
ramp: z.ZodOptional<z.ZodObject<{
|
|
362
|
+
from: z.ZodNumber;
|
|
363
|
+
to: z.ZodNumber;
|
|
364
|
+
startAt: z.ZodNumber;
|
|
365
|
+
durationMs: z.ZodNumber;
|
|
366
|
+
}, z.core.$strip>>;
|
|
285
367
|
locked: z.ZodOptional<z.ZodBoolean>;
|
|
286
368
|
}, z.core.$strip>], "type">>>>;
|
|
287
369
|
updatedAt: z.ZodString;
|
|
@@ -301,4 +383,4 @@ declare const gateToggleResponseSchema: z.ZodObject<{
|
|
|
301
383
|
enabled: z.ZodBoolean;
|
|
302
384
|
}, z.core.$strip>;
|
|
303
385
|
|
|
304
|
-
export { type GateCreateInput, type GateUpdateInput, type StackedGateEntryInput, gateCreateResponseSchema, gateCreateSchema, gateDeleteResponseSchema, gateMetadataPatchSchema, gateNameSchema, gateResponseSchema, gateRuleSchema, gateToggleResponseSchema, gateUpdateResponseSchema, gateUpdateSchema, stackedGateEntrySchema };
|
|
386
|
+
export { type GateCreateInput, type GateUpdateInput, type StackedGateEntryInput, gateCreateResponseSchema, gateCreateSchema, gateDeleteResponseSchema, gateMetadataPatchSchema, gateNameSchema, gateResponseSchema, gateRuleSchema, gateToggleResponseSchema, gateUpdateResponseSchema, gateUpdateSchema, rampSchema, stackedGateEntrySchema };
|
package/dist/schemas/gates.js
CHANGED
|
@@ -26,12 +26,14 @@ var gateRuleSchema = z2.object({
|
|
|
26
26
|
"semver_gt",
|
|
27
27
|
"semver_gte",
|
|
28
28
|
"semver_lt",
|
|
29
|
-
"semver_lte"
|
|
29
|
+
"semver_lte",
|
|
30
|
+
"gate_pass",
|
|
31
|
+
"exp_in"
|
|
30
32
|
]).describe(
|
|
31
|
-
|
|
33
|
+
'Comparison operator. Equality: `eq`/`neq`. Set membership: `in`/`not_in` (value is an array). Numeric order: `gt`/`gte`/`lt`/`lte`. Semver order: `semver_gt`/`semver_gte`/`semver_lt`/`semver_lte` (value is a dotted version like `4.2.0`). String: `contains` (substring), `regex` (JS-flavour pattern, value is the pattern string). Cross-resource references (evaluated only on the worker hot path, where both KV blobs load): `gate_pass` (`value` is another gate\'s name \u2014 true when that gate passes for the same caller); `exp_in` (`attr` is a running experiment\'s name, `value` is a group name, `"$holdout"`, or `"$any"` \u2014 true when the caller is in that variant / the universe holdout / any variant).'
|
|
32
34
|
),
|
|
33
35
|
value: z2.unknown().describe(
|
|
34
|
-
|
|
36
|
+
'Operand. Shape depends on `op`: scalar for `eq/neq/gt/gte/lt/lte/contains/semver_*`; array of scalars for `in/not_in`; string pattern for `regex`; referenced gate name for `gate_pass`; group name / `"$holdout"` / `"$any"` for `exp_in`.'
|
|
35
37
|
)
|
|
36
38
|
}).describe(
|
|
37
39
|
"Single targeting predicate. A gate's `rules` array is evaluated with AND semantics; use the gatekeeper `stack` for OR / fall-through logic."
|
|
@@ -42,9 +44,17 @@ var gateNameSchema = z2.string().regex(
|
|
|
42
44
|
).max(128).describe(
|
|
43
45
|
"Stable gate key used by SDKs (`Shipeasy.checkGate(user, '<name>')`). Single segment or `folder.name`. Lowercase letters, digits, `_` or `-`; max 128 chars. Immutable after create \u2014 rename = delete + recreate."
|
|
44
46
|
);
|
|
47
|
+
var rampSchema = z2.object({
|
|
48
|
+
from: z2.number().int().min(0).max(1e4).describe("Start of the ramp in basis points (0\u201310000)."),
|
|
49
|
+
to: z2.number().int().min(0).max(1e4).describe("End of the ramp in basis points (0\u201310000)."),
|
|
50
|
+
startAt: z2.number().int().nonnegative().describe("Ramp start, epoch milliseconds (UTC)."),
|
|
51
|
+
durationMs: z2.number().int().positive().describe("Ramp length in milliseconds.")
|
|
52
|
+
}).describe(
|
|
53
|
+
"Linear rollout ramp. The effective rollout % interpolates `from`\u2192`to` over `[startAt, startAt+durationMs]`, clamped outside that window, evaluated against the wall-clock at eval time. Overrides the entry's static `rolloutPct` while present."
|
|
54
|
+
);
|
|
45
55
|
var stackedConditionSchema = z2.object({
|
|
46
56
|
id: z2.string().min(1).describe(
|
|
47
|
-
"Client-supplied stable id for the stack entry (used for React keys, audit diffs)."
|
|
57
|
+
"Client-supplied stable id for the stack entry (used for React keys, audit diffs, and as the default per-condition rollout salt)."
|
|
48
58
|
),
|
|
49
59
|
type: z2.literal("condition").describe("Discriminator. `condition` = rule-based predicate sub-gate."),
|
|
50
60
|
name: z2.string().optional().describe("Human label shown in the dashboard."),
|
|
@@ -53,9 +63,15 @@ var stackedConditionSchema = z2.object({
|
|
|
53
63
|
),
|
|
54
64
|
pass: z2.enum(["all", "any"]).optional().describe("Combinator across `rules`. `all` = AND (default), `any` = OR."),
|
|
55
65
|
rules: z2.array(gateRuleSchema).default([]).describe("Predicates evaluated under `pass`. Empty array = match nothing."),
|
|
66
|
+
rolloutPct: z2.number().int().min(0).max(1e4).optional().describe(
|
|
67
|
+
"Per-condition rollout in basis points. After the rules match, the caller is bucketed at this %; in-bucket \u2192 gate `true`, otherwise fall through to the next entry. Absent \u21D2 10000 (100%, every matching caller passes)."
|
|
68
|
+
),
|
|
69
|
+
bucketBy: z2.string().optional().describe("Attribute used to hash the caller into the per-condition bucket. Default `userID`."),
|
|
70
|
+
salt: z2.string().optional().describe("Per-condition hash salt. Defaults to the entry `id`, then the gate salt."),
|
|
71
|
+
ramp: rampSchema.optional(),
|
|
56
72
|
locked: z2.boolean().optional().describe("If `true`, dashboard hides edit controls (e.g. the trailing public-floor entry).")
|
|
57
73
|
}).describe(
|
|
58
|
-
"Rule-based sub-gate. When
|
|
74
|
+
"Rule-based sub-gate. When the rules match and the caller falls in the per-condition rollout bucket, evaluation short-circuits and the gate returns `true`; otherwise it falls through to the next entry."
|
|
59
75
|
);
|
|
60
76
|
var stackedRolloutSchema = z2.object({
|
|
61
77
|
id: z2.string().min(1).describe("Client-supplied stable id for the stack entry."),
|
|
@@ -71,9 +87,10 @@ var stackedRolloutSchema = z2.object({
|
|
|
71
87
|
salt: z2.string().optional().describe(
|
|
72
88
|
"Per-entry hash salt. Defaults to the gate's salt. Set explicitly to keep two rollouts independent or correlated across gates."
|
|
73
89
|
),
|
|
90
|
+
ramp: rampSchema.optional(),
|
|
74
91
|
locked: z2.boolean().optional().describe("If `true`, dashboard hides edit controls.")
|
|
75
92
|
}).describe(
|
|
76
|
-
"Percentage-rollout sub-gate. Hashes `bucketBy` (default `userID`) with `salt` and returns `true` for `rolloutPct/10000` fraction of callers."
|
|
93
|
+
"Percentage-rollout sub-gate. Hashes `bucketBy` (default `userID`) with `salt` and returns `true` for `rolloutPct/10000` fraction of callers (or the ramp's effective % when `ramp` is set)."
|
|
77
94
|
);
|
|
78
95
|
var stackedGateEntrySchema = z2.discriminatedUnion("type", [stackedConditionSchema, stackedRolloutSchema]).describe(
|
|
79
96
|
"One entry in the ordered gatekeeper stack. Evaluated top-to-bottom; first matching entry decides. Mix `condition` and `rollout` entries to express `internal-only` + `1% beta` + `50% public` in a single gate."
|
|
@@ -168,5 +185,6 @@ export {
|
|
|
168
185
|
gateToggleResponseSchema,
|
|
169
186
|
gateUpdateResponseSchema,
|
|
170
187
|
gateUpdateSchema,
|
|
188
|
+
rampSchema,
|
|
171
189
|
stackedGateEntrySchema
|
|
172
190
|
};
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ export { CursorParts, DEFAULT_PAGE_SIZE, MAX_PAGE_SIZE, Page, PageQuery, decodeC
|
|
|
3
3
|
export { FolderInput, folderSchema } from './folder.js';
|
|
4
4
|
export { metricNameSchema } from './metric-name.js';
|
|
5
5
|
export { ConfigCreateInput, ConfigDraftUpsertInput, ConfigPublishInput, ConfigSchemaUpdateInput, ConfigUpdateInput, JsonSchemaInput, configActivityEntrySchema, configActivityResponseSchema, configCreateResponseSchema, configCreateSchema, configDeleteResponseSchema, configDraftDiscardResponseSchema, configDraftSaveResponseSchema, configDraftUpsertSchema, configEnvSchema, configKindSchema, configNameSchema, configPublishResponseSchema, configPublishSchema, configResponseSchema, configSchemaUpdateSchema, configUpdateResponseSchema, configUpdateSchema, jsonSchemaSchema } from './configs.js';
|
|
6
|
-
export { GateCreateInput, GateUpdateInput, StackedGateEntryInput, gateCreateResponseSchema, gateCreateSchema, gateDeleteResponseSchema, gateMetadataPatchSchema, gateNameSchema, gateResponseSchema, gateRuleSchema, gateToggleResponseSchema, gateUpdateResponseSchema, gateUpdateSchema, stackedGateEntrySchema } from './gates.js';
|
|
6
|
+
export { GateCreateInput, GateUpdateInput, StackedGateEntryInput, gateCreateResponseSchema, gateCreateSchema, gateDeleteResponseSchema, gateMetadataPatchSchema, gateNameSchema, gateResponseSchema, gateRuleSchema, gateToggleResponseSchema, gateUpdateResponseSchema, gateUpdateSchema, rampSchema, stackedGateEntrySchema } from './gates.js';
|
|
7
7
|
export { KillswitchCreateInput, KillswitchSwitchSetInput, KillswitchSwitchUnsetInput, KillswitchUpdateInput, KillswitchValue, KillswitchValueSetInput, SWITCH_KEY_RE, killswitchCreateResponseSchema, killswitchCreateSchema, killswitchDeleteResponseSchema, killswitchResponseSchema, killswitchSwitchSetResponseSchema, killswitchSwitchSetSchema, killswitchSwitchUnsetResponseSchema, killswitchSwitchUnsetSchema, killswitchUpdateResponseSchema, killswitchUpdateSchema, killswitchValueSchema, killswitchValueSetSchema, switchKeySchema } from './killswitches.js';
|
|
8
8
|
export { UniverseCreateInput, UniverseUpdateInput, holdoutRangeSchema, universeCreateResponseSchema, universeCreateSchema, universeDeleteResponseSchema, universeNameSchema, universeResponseSchema, universeUpdateResponseSchema, universeUpdateSchema } from './universes.js';
|
|
9
9
|
export { ExperimentCreateInput, ExperimentInlineMetric, ExperimentUpdateInput, bucketBySchema, experimentCreateResponseSchema, experimentCreateSchema, experimentDeleteResponseSchema, experimentGroupSchema, experimentInlineMetricSchema, experimentMetricsResponseSchema, experimentMetricsUpdateSchema, experimentNameSchema, experimentReanalyzeResponseSchema, experimentResponseSchema, experimentResultsResponseSchema, experimentStatusResponseSchema, experimentStatusUpdateSchema, experimentTimeseriesResponseSchema, experimentUpdateResponseSchema, experimentUpdateSchema, paramSchemaSchema } from './experiments.js';
|
|
10
|
-
export { ALERT_COMPARATORS, ALERT_SEVERITIES, AlertRuleCreate, AlertRuleUpdate, alertRuleCreateSchema, alertRuleUpdateSchema } from './alert-rules.js';
|
|
10
|
+
export { ALERT_COMPARATORS, ALERT_SEVERITIES, AlertRuleCreate, AlertRuleUpdate, NotificationTarget, alertRuleCreateSchema, alertRuleUpdateSchema, notificationTargetSchema } from './alert-rules.js';
|
|
11
11
|
import 'zod';
|
package/dist/schemas/index.js
CHANGED
|
@@ -173,12 +173,14 @@ var gateRuleSchema = z5.object({
|
|
|
173
173
|
"semver_gt",
|
|
174
174
|
"semver_gte",
|
|
175
175
|
"semver_lt",
|
|
176
|
-
"semver_lte"
|
|
176
|
+
"semver_lte",
|
|
177
|
+
"gate_pass",
|
|
178
|
+
"exp_in"
|
|
177
179
|
]).describe(
|
|
178
|
-
|
|
180
|
+
'Comparison operator. Equality: `eq`/`neq`. Set membership: `in`/`not_in` (value is an array). Numeric order: `gt`/`gte`/`lt`/`lte`. Semver order: `semver_gt`/`semver_gte`/`semver_lt`/`semver_lte` (value is a dotted version like `4.2.0`). String: `contains` (substring), `regex` (JS-flavour pattern, value is the pattern string). Cross-resource references (evaluated only on the worker hot path, where both KV blobs load): `gate_pass` (`value` is another gate\'s name \u2014 true when that gate passes for the same caller); `exp_in` (`attr` is a running experiment\'s name, `value` is a group name, `"$holdout"`, or `"$any"` \u2014 true when the caller is in that variant / the universe holdout / any variant).'
|
|
179
181
|
),
|
|
180
182
|
value: z5.unknown().describe(
|
|
181
|
-
|
|
183
|
+
'Operand. Shape depends on `op`: scalar for `eq/neq/gt/gte/lt/lte/contains/semver_*`; array of scalars for `in/not_in`; string pattern for `regex`; referenced gate name for `gate_pass`; group name / `"$holdout"` / `"$any"` for `exp_in`.'
|
|
182
184
|
)
|
|
183
185
|
}).describe(
|
|
184
186
|
"Single targeting predicate. A gate's `rules` array is evaluated with AND semantics; use the gatekeeper `stack` for OR / fall-through logic."
|
|
@@ -189,9 +191,17 @@ var gateNameSchema = z5.string().regex(
|
|
|
189
191
|
).max(128).describe(
|
|
190
192
|
"Stable gate key used by SDKs (`Shipeasy.checkGate(user, '<name>')`). Single segment or `folder.name`. Lowercase letters, digits, `_` or `-`; max 128 chars. Immutable after create \u2014 rename = delete + recreate."
|
|
191
193
|
);
|
|
194
|
+
var rampSchema = z5.object({
|
|
195
|
+
from: z5.number().int().min(0).max(1e4).describe("Start of the ramp in basis points (0\u201310000)."),
|
|
196
|
+
to: z5.number().int().min(0).max(1e4).describe("End of the ramp in basis points (0\u201310000)."),
|
|
197
|
+
startAt: z5.number().int().nonnegative().describe("Ramp start, epoch milliseconds (UTC)."),
|
|
198
|
+
durationMs: z5.number().int().positive().describe("Ramp length in milliseconds.")
|
|
199
|
+
}).describe(
|
|
200
|
+
"Linear rollout ramp. The effective rollout % interpolates `from`\u2192`to` over `[startAt, startAt+durationMs]`, clamped outside that window, evaluated against the wall-clock at eval time. Overrides the entry's static `rolloutPct` while present."
|
|
201
|
+
);
|
|
192
202
|
var stackedConditionSchema = z5.object({
|
|
193
203
|
id: z5.string().min(1).describe(
|
|
194
|
-
"Client-supplied stable id for the stack entry (used for React keys, audit diffs)."
|
|
204
|
+
"Client-supplied stable id for the stack entry (used for React keys, audit diffs, and as the default per-condition rollout salt)."
|
|
195
205
|
),
|
|
196
206
|
type: z5.literal("condition").describe("Discriminator. `condition` = rule-based predicate sub-gate."),
|
|
197
207
|
name: z5.string().optional().describe("Human label shown in the dashboard."),
|
|
@@ -200,9 +210,15 @@ var stackedConditionSchema = z5.object({
|
|
|
200
210
|
),
|
|
201
211
|
pass: z5.enum(["all", "any"]).optional().describe("Combinator across `rules`. `all` = AND (default), `any` = OR."),
|
|
202
212
|
rules: z5.array(gateRuleSchema).default([]).describe("Predicates evaluated under `pass`. Empty array = match nothing."),
|
|
213
|
+
rolloutPct: z5.number().int().min(0).max(1e4).optional().describe(
|
|
214
|
+
"Per-condition rollout in basis points. After the rules match, the caller is bucketed at this %; in-bucket \u2192 gate `true`, otherwise fall through to the next entry. Absent \u21D2 10000 (100%, every matching caller passes)."
|
|
215
|
+
),
|
|
216
|
+
bucketBy: z5.string().optional().describe("Attribute used to hash the caller into the per-condition bucket. Default `userID`."),
|
|
217
|
+
salt: z5.string().optional().describe("Per-condition hash salt. Defaults to the entry `id`, then the gate salt."),
|
|
218
|
+
ramp: rampSchema.optional(),
|
|
203
219
|
locked: z5.boolean().optional().describe("If `true`, dashboard hides edit controls (e.g. the trailing public-floor entry).")
|
|
204
220
|
}).describe(
|
|
205
|
-
"Rule-based sub-gate. When
|
|
221
|
+
"Rule-based sub-gate. When the rules match and the caller falls in the per-condition rollout bucket, evaluation short-circuits and the gate returns `true`; otherwise it falls through to the next entry."
|
|
206
222
|
);
|
|
207
223
|
var stackedRolloutSchema = z5.object({
|
|
208
224
|
id: z5.string().min(1).describe("Client-supplied stable id for the stack entry."),
|
|
@@ -218,9 +234,10 @@ var stackedRolloutSchema = z5.object({
|
|
|
218
234
|
salt: z5.string().optional().describe(
|
|
219
235
|
"Per-entry hash salt. Defaults to the gate's salt. Set explicitly to keep two rollouts independent or correlated across gates."
|
|
220
236
|
),
|
|
237
|
+
ramp: rampSchema.optional(),
|
|
221
238
|
locked: z5.boolean().optional().describe("If `true`, dashboard hides edit controls.")
|
|
222
239
|
}).describe(
|
|
223
|
-
"Percentage-rollout sub-gate. Hashes `bucketBy` (default `userID`) with `salt` and returns `true` for `rolloutPct/10000` fraction of callers."
|
|
240
|
+
"Percentage-rollout sub-gate. Hashes `bucketBy` (default `userID`) with `salt` and returns `true` for `rolloutPct/10000` fraction of callers (or the ramp's effective % when `ramp` is set)."
|
|
224
241
|
);
|
|
225
242
|
var stackedGateEntrySchema = z5.discriminatedUnion("type", [stackedConditionSchema, stackedRolloutSchema]).describe(
|
|
226
243
|
"One entry in the ordered gatekeeper stack. Evaluated top-to-bottom; first matching entry decides. Mix `condition` and `rollout` entries to express `internal-only` + `1% beta` + `50% public` in a single gate."
|
|
@@ -458,7 +475,12 @@ var experimentGroupSchema = z8.object({
|
|
|
458
475
|
var paramSchemaSchema = z8.record(z8.string(), z8.enum(["string", "bool", "number"])).describe(
|
|
459
476
|
"Map of param-name \u2192 scalar type. Defines the shape of `groups[].params`. Example: `{ headline: 'string', show_cta: 'bool' }`."
|
|
460
477
|
);
|
|
461
|
-
var bucketBySchema = z8.
|
|
478
|
+
var bucketBySchema = z8.string().min(1).max(128).regex(
|
|
479
|
+
/^[a-zA-Z_][a-zA-Z0-9_]*$/,
|
|
480
|
+
"Must be a user-attribute name (letters, digits, underscore; not starting with a digit)."
|
|
481
|
+
).describe(
|
|
482
|
+
"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."
|
|
483
|
+
);
|
|
462
484
|
var experimentCreateSchema = z8.object({
|
|
463
485
|
name: experimentNameSchema,
|
|
464
486
|
description: z8.string().max(2e3).nullable().default(null).describe("Free-form description. Max 2000 chars, markdown rendered in the dashboard."),
|
|
@@ -626,6 +648,13 @@ var experimentReanalyzeResponseSchema = z8.object({
|
|
|
626
648
|
import { z as z9 } from "zod";
|
|
627
649
|
var ALERT_COMPARATORS = ["gt", "gte", "lt", "lte"];
|
|
628
650
|
var ALERT_SEVERITIES = ["danger", "warn", "info"];
|
|
651
|
+
var notificationTargetSchema = z9.object({
|
|
652
|
+
slackChannel: z9.object({
|
|
653
|
+
id: z9.string().min(1).describe("Slack channel id (e.g. C0123ABCD)."),
|
|
654
|
+
name: z9.string().min(1).describe("Slack channel name (without the leading #).")
|
|
655
|
+
}).nullish().describe("Slack channel to post this rule's alert to. Requires a Slack connector."),
|
|
656
|
+
email: z9.string().email().nullish().describe("Email address to notify for this rule (overrides the default recipient).")
|
|
657
|
+
}).strict();
|
|
629
658
|
var alertRuleCreateSchema = z9.object({
|
|
630
659
|
name: z9.string().min(1).max(120).describe("Human label for the rule, shown on the alert and the rules list."),
|
|
631
660
|
metricId: z9.string().min(1).describe("Id of the metric to evaluate."),
|
|
@@ -633,7 +662,8 @@ var alertRuleCreateSchema = z9.object({
|
|
|
633
662
|
threshold: z9.number().finite().describe("Threshold the metric value is compared against."),
|
|
634
663
|
windowHours: z9.number().int().min(1).max(720).default(24).describe("Lookback window (hours) the metric is aggregated over. 1\u2013720."),
|
|
635
664
|
severity: z9.enum(ALERT_SEVERITIES).default("warn").describe("Severity of the raised alert."),
|
|
636
|
-
enabled: z9.boolean().default(true).describe("Whether the rule is evaluated by the cron.")
|
|
665
|
+
enabled: z9.boolean().default(true).describe("Whether the rule is evaluated by the cron."),
|
|
666
|
+
notify: notificationTargetSchema.nullish().describe("Where to deliver this rule's alert (Slack channel and/or email target).")
|
|
637
667
|
}).strict();
|
|
638
668
|
var alertRuleUpdateSchema = z9.object({
|
|
639
669
|
name: z9.string().min(1).max(120),
|
|
@@ -641,7 +671,8 @@ var alertRuleUpdateSchema = z9.object({
|
|
|
641
671
|
threshold: z9.number().finite(),
|
|
642
672
|
windowHours: z9.number().int().min(1).max(720),
|
|
643
673
|
severity: z9.enum(ALERT_SEVERITIES),
|
|
644
|
-
enabled: z9.boolean()
|
|
674
|
+
enabled: z9.boolean(),
|
|
675
|
+
notify: notificationTargetSchema.nullish()
|
|
645
676
|
}).partial().strict();
|
|
646
677
|
export {
|
|
647
678
|
ALERT_COMPARATORS,
|
|
@@ -715,8 +746,10 @@ export {
|
|
|
715
746
|
killswitchValueSchema,
|
|
716
747
|
killswitchValueSetSchema,
|
|
717
748
|
metricNameSchema,
|
|
749
|
+
notificationTargetSchema,
|
|
718
750
|
pageQuerySchema,
|
|
719
751
|
paramSchemaSchema,
|
|
752
|
+
rampSchema,
|
|
720
753
|
stackedGateEntrySchema,
|
|
721
754
|
switchKeySchema,
|
|
722
755
|
universeCreateResponseSchema,
|