@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.
@@ -80,6 +80,8 @@ declare const RESOURCE_REGISTRY: readonly [{
80
80
  semver_gte: "semver_gte";
81
81
  semver_lt: "semver_lt";
82
82
  semver_lte: "semver_lte";
83
+ gate_pass: "gate_pass";
84
+ exp_in: "exp_in";
83
85
  }>;
84
86
  value: zod.ZodUnknown;
85
87
  }, zod_v4_core.$strip>>>;
@@ -110,9 +112,20 @@ declare const RESOURCE_REGISTRY: readonly [{
110
112
  semver_gte: "semver_gte";
111
113
  semver_lt: "semver_lt";
112
114
  semver_lte: "semver_lte";
115
+ gate_pass: "gate_pass";
116
+ exp_in: "exp_in";
113
117
  }>;
114
118
  value: zod.ZodUnknown;
115
119
  }, zod_v4_core.$strip>>>;
120
+ rolloutPct: zod.ZodOptional<zod.ZodNumber>;
121
+ bucketBy: zod.ZodOptional<zod.ZodString>;
122
+ salt: zod.ZodOptional<zod.ZodString>;
123
+ ramp: zod.ZodOptional<zod.ZodObject<{
124
+ from: zod.ZodNumber;
125
+ to: zod.ZodNumber;
126
+ startAt: zod.ZodNumber;
127
+ durationMs: zod.ZodNumber;
128
+ }, zod_v4_core.$strip>>;
116
129
  locked: zod.ZodOptional<zod.ZodBoolean>;
117
130
  }, zod_v4_core.$strip>, zod.ZodObject<{
118
131
  id: zod.ZodString;
@@ -122,6 +135,12 @@ declare const RESOURCE_REGISTRY: readonly [{
122
135
  rolloutPct: zod.ZodNumber;
123
136
  bucketBy: zod.ZodOptional<zod.ZodString>;
124
137
  salt: zod.ZodOptional<zod.ZodString>;
138
+ ramp: zod.ZodOptional<zod.ZodObject<{
139
+ from: zod.ZodNumber;
140
+ to: zod.ZodNumber;
141
+ startAt: zod.ZodNumber;
142
+ durationMs: zod.ZodNumber;
143
+ }, zod_v4_core.$strip>>;
125
144
  locked: zod.ZodOptional<zod.ZodBoolean>;
126
145
  }, zod_v4_core.$strip>], "type">>>>;
127
146
  }, zod_v4_core.$strip>;
@@ -150,6 +169,8 @@ declare const RESOURCE_REGISTRY: readonly [{
150
169
  semver_gte: "semver_gte";
151
170
  semver_lt: "semver_lt";
152
171
  semver_lte: "semver_lte";
172
+ gate_pass: "gate_pass";
173
+ exp_in: "exp_in";
153
174
  }>;
154
175
  value: zod.ZodUnknown;
155
176
  }, zod_v4_core.$strip>>>;
@@ -180,9 +201,20 @@ declare const RESOURCE_REGISTRY: readonly [{
180
201
  semver_gte: "semver_gte";
181
202
  semver_lt: "semver_lt";
182
203
  semver_lte: "semver_lte";
204
+ gate_pass: "gate_pass";
205
+ exp_in: "exp_in";
183
206
  }>;
184
207
  value: zod.ZodUnknown;
185
208
  }, zod_v4_core.$strip>>>;
209
+ rolloutPct: zod.ZodOptional<zod.ZodNumber>;
210
+ bucketBy: zod.ZodOptional<zod.ZodString>;
211
+ salt: zod.ZodOptional<zod.ZodString>;
212
+ ramp: zod.ZodOptional<zod.ZodObject<{
213
+ from: zod.ZodNumber;
214
+ to: zod.ZodNumber;
215
+ startAt: zod.ZodNumber;
216
+ durationMs: zod.ZodNumber;
217
+ }, zod_v4_core.$strip>>;
186
218
  locked: zod.ZodOptional<zod.ZodBoolean>;
187
219
  }, zod_v4_core.$strip>, zod.ZodObject<{
188
220
  id: zod.ZodString;
@@ -192,6 +224,12 @@ declare const RESOURCE_REGISTRY: readonly [{
192
224
  rolloutPct: zod.ZodNumber;
193
225
  bucketBy: zod.ZodOptional<zod.ZodString>;
194
226
  salt: zod.ZodOptional<zod.ZodString>;
227
+ ramp: zod.ZodOptional<zod.ZodObject<{
228
+ from: zod.ZodNumber;
229
+ to: zod.ZodNumber;
230
+ startAt: zod.ZodNumber;
231
+ durationMs: zod.ZodNumber;
232
+ }, zod_v4_core.$strip>>;
195
233
  locked: zod.ZodOptional<zod.ZodBoolean>;
196
234
  }, zod_v4_core.$strip>], "type">>>>;
197
235
  }, zod_v4_core.$strip>;
@@ -232,6 +270,8 @@ declare const RESOURCE_REGISTRY: readonly [{
232
270
  semver_gte: "semver_gte";
233
271
  semver_lt: "semver_lt";
234
272
  semver_lte: "semver_lte";
273
+ gate_pass: "gate_pass";
274
+ exp_in: "exp_in";
235
275
  }>;
236
276
  value: zod.ZodUnknown;
237
277
  }, zod_v4_core.$strip>>>;
@@ -267,9 +307,20 @@ declare const RESOURCE_REGISTRY: readonly [{
267
307
  semver_gte: "semver_gte";
268
308
  semver_lt: "semver_lt";
269
309
  semver_lte: "semver_lte";
310
+ gate_pass: "gate_pass";
311
+ exp_in: "exp_in";
270
312
  }>;
271
313
  value: zod.ZodUnknown;
272
314
  }, zod_v4_core.$strip>>>;
315
+ rolloutPct: zod.ZodOptional<zod.ZodNumber>;
316
+ bucketBy: zod.ZodOptional<zod.ZodString>;
317
+ salt: zod.ZodOptional<zod.ZodString>;
318
+ ramp: zod.ZodOptional<zod.ZodObject<{
319
+ from: zod.ZodNumber;
320
+ to: zod.ZodNumber;
321
+ startAt: zod.ZodNumber;
322
+ durationMs: zod.ZodNumber;
323
+ }, zod_v4_core.$strip>>;
273
324
  locked: zod.ZodOptional<zod.ZodBoolean>;
274
325
  }, zod_v4_core.$strip>, zod.ZodObject<{
275
326
  id: zod.ZodString;
@@ -279,6 +330,12 @@ declare const RESOURCE_REGISTRY: readonly [{
279
330
  rolloutPct: zod.ZodNumber;
280
331
  bucketBy: zod.ZodOptional<zod.ZodString>;
281
332
  salt: zod.ZodOptional<zod.ZodString>;
333
+ ramp: zod.ZodOptional<zod.ZodObject<{
334
+ from: zod.ZodNumber;
335
+ to: zod.ZodNumber;
336
+ startAt: zod.ZodNumber;
337
+ durationMs: zod.ZodNumber;
338
+ }, zod_v4_core.$strip>>;
282
339
  locked: zod.ZodOptional<zod.ZodBoolean>;
283
340
  }, zod_v4_core.$strip>], "type">>>>;
284
341
  updatedAt: zod.ZodString;
@@ -348,6 +405,8 @@ declare const RESOURCE_REGISTRY: readonly [{
348
405
  semver_gte: "semver_gte";
349
406
  semver_lt: "semver_lt";
350
407
  semver_lte: "semver_lte";
408
+ gate_pass: "gate_pass";
409
+ exp_in: "exp_in";
351
410
  }>;
352
411
  value: zod.ZodUnknown;
353
412
  }, zod_v4_core.$strip>>>;
@@ -378,9 +437,20 @@ declare const RESOURCE_REGISTRY: readonly [{
378
437
  semver_gte: "semver_gte";
379
438
  semver_lt: "semver_lt";
380
439
  semver_lte: "semver_lte";
440
+ gate_pass: "gate_pass";
441
+ exp_in: "exp_in";
381
442
  }>;
382
443
  value: zod.ZodUnknown;
383
444
  }, zod_v4_core.$strip>>>;
445
+ rolloutPct: zod.ZodOptional<zod.ZodNumber>;
446
+ bucketBy: zod.ZodOptional<zod.ZodString>;
447
+ salt: zod.ZodOptional<zod.ZodString>;
448
+ ramp: zod.ZodOptional<zod.ZodObject<{
449
+ from: zod.ZodNumber;
450
+ to: zod.ZodNumber;
451
+ startAt: zod.ZodNumber;
452
+ durationMs: zod.ZodNumber;
453
+ }, zod_v4_core.$strip>>;
384
454
  locked: zod.ZodOptional<zod.ZodBoolean>;
385
455
  }, zod_v4_core.$strip>, zod.ZodObject<{
386
456
  id: zod.ZodString;
@@ -390,6 +460,12 @@ declare const RESOURCE_REGISTRY: readonly [{
390
460
  rolloutPct: zod.ZodNumber;
391
461
  bucketBy: zod.ZodOptional<zod.ZodString>;
392
462
  salt: zod.ZodOptional<zod.ZodString>;
463
+ ramp: zod.ZodOptional<zod.ZodObject<{
464
+ from: zod.ZodNumber;
465
+ to: zod.ZodNumber;
466
+ startAt: zod.ZodNumber;
467
+ durationMs: zod.ZodNumber;
468
+ }, zod_v4_core.$strip>>;
393
469
  locked: zod.ZodOptional<zod.ZodBoolean>;
394
470
  }, zod_v4_core.$strip>], "type">>>>;
395
471
  }, zod_v4_core.$strip>;
@@ -515,6 +591,8 @@ declare const RESOURCE_REGISTRY: readonly [{
515
591
  semver_gte: "semver_gte";
516
592
  semver_lt: "semver_lt";
517
593
  semver_lte: "semver_lte";
594
+ gate_pass: "gate_pass";
595
+ exp_in: "exp_in";
518
596
  }>;
519
597
  value: zod.ZodUnknown;
520
598
  }, zod_v4_core.$strip>>>;
@@ -545,9 +623,20 @@ declare const RESOURCE_REGISTRY: readonly [{
545
623
  semver_gte: "semver_gte";
546
624
  semver_lt: "semver_lt";
547
625
  semver_lte: "semver_lte";
626
+ gate_pass: "gate_pass";
627
+ exp_in: "exp_in";
548
628
  }>;
549
629
  value: zod.ZodUnknown;
550
630
  }, zod_v4_core.$strip>>>;
631
+ rolloutPct: zod.ZodOptional<zod.ZodNumber>;
632
+ bucketBy: zod.ZodOptional<zod.ZodString>;
633
+ salt: zod.ZodOptional<zod.ZodString>;
634
+ ramp: zod.ZodOptional<zod.ZodObject<{
635
+ from: zod.ZodNumber;
636
+ to: zod.ZodNumber;
637
+ startAt: zod.ZodNumber;
638
+ durationMs: zod.ZodNumber;
639
+ }, zod_v4_core.$strip>>;
551
640
  locked: zod.ZodOptional<zod.ZodBoolean>;
552
641
  }, zod_v4_core.$strip>, zod.ZodObject<{
553
642
  id: zod.ZodString;
@@ -557,6 +646,12 @@ declare const RESOURCE_REGISTRY: readonly [{
557
646
  rolloutPct: zod.ZodNumber;
558
647
  bucketBy: zod.ZodOptional<zod.ZodString>;
559
648
  salt: zod.ZodOptional<zod.ZodString>;
649
+ ramp: zod.ZodOptional<zod.ZodObject<{
650
+ from: zod.ZodNumber;
651
+ to: zod.ZodNumber;
652
+ startAt: zod.ZodNumber;
653
+ durationMs: zod.ZodNumber;
654
+ }, zod_v4_core.$strip>>;
560
655
  locked: zod.ZodOptional<zod.ZodBoolean>;
561
656
  }, zod_v4_core.$strip>], "type">>>>;
562
657
  }, zod_v4_core.$strip>;
@@ -709,11 +804,7 @@ declare const RESOURCE_REGISTRY: readonly [{
709
804
  tag: zod.ZodDefault<zod.ZodNullable<zod.ZodString>>;
710
805
  owner_email: zod.ZodDefault<zod.ZodNullable<zod.ZodString>>;
711
806
  audience: zod.ZodDefault<zod.ZodNullable<zod.ZodString>>;
712
- bucket_by: zod.ZodDefault<zod.ZodNullable<zod.ZodEnum<{
713
- user_id: "user_id";
714
- session_id: "session_id";
715
- device_id: "device_id";
716
- }>>>;
807
+ bucket_by: zod.ZodDefault<zod.ZodNullable<zod.ZodString>>;
717
808
  folder: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
718
809
  universe: zod.ZodString;
719
810
  targeting_gate: zod.ZodDefault<zod.ZodNullable<zod.ZodString>>;
@@ -749,11 +840,7 @@ declare const RESOURCE_REGISTRY: readonly [{
749
840
  tag: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
750
841
  owner_email: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
751
842
  audience: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
752
- bucket_by: zod.ZodOptional<zod.ZodNullable<zod.ZodEnum<{
753
- user_id: "user_id";
754
- session_id: "session_id";
755
- device_id: "device_id";
756
- }>>>;
843
+ bucket_by: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
757
844
  folder: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
758
845
  targeting_gate: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
759
846
  allocation_pct: zod.ZodOptional<zod.ZodNumber>;
@@ -814,11 +901,7 @@ declare const RESOURCE_REGISTRY: readonly [{
814
901
  tag: zod.ZodNullable<zod.ZodString>;
815
902
  ownerEmail: zod.ZodNullable<zod.ZodString>;
816
903
  audience: zod.ZodNullable<zod.ZodString>;
817
- bucketBy: zod.ZodNullable<zod.ZodEnum<{
818
- user_id: "user_id";
819
- session_id: "session_id";
820
- device_id: "device_id";
821
- }>>;
904
+ bucketBy: zod.ZodNullable<zod.ZodString>;
822
905
  folder: zod.ZodNullable<zod.ZodString>;
823
906
  status: zod.ZodEnum<{
824
907
  draft: "draft";
@@ -901,11 +984,7 @@ declare const RESOURCE_REGISTRY: readonly [{
901
984
  tag: zod.ZodNullable<zod.ZodString>;
902
985
  ownerEmail: zod.ZodNullable<zod.ZodString>;
903
986
  audience: zod.ZodNullable<zod.ZodString>;
904
- bucketBy: zod.ZodNullable<zod.ZodEnum<{
905
- user_id: "user_id";
906
- session_id: "session_id";
907
- device_id: "device_id";
908
- }>>;
987
+ bucketBy: zod.ZodNullable<zod.ZodString>;
909
988
  folder: zod.ZodNullable<zod.ZodString>;
910
989
  status: zod.ZodEnum<{
911
990
  draft: "draft";
@@ -980,11 +1059,7 @@ declare const RESOURCE_REGISTRY: readonly [{
980
1059
  tag: zod.ZodDefault<zod.ZodNullable<zod.ZodString>>;
981
1060
  owner_email: zod.ZodDefault<zod.ZodNullable<zod.ZodString>>;
982
1061
  audience: zod.ZodDefault<zod.ZodNullable<zod.ZodString>>;
983
- bucket_by: zod.ZodDefault<zod.ZodNullable<zod.ZodEnum<{
984
- user_id: "user_id";
985
- session_id: "session_id";
986
- device_id: "device_id";
987
- }>>>;
1062
+ bucket_by: zod.ZodDefault<zod.ZodNullable<zod.ZodString>>;
988
1063
  folder: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
989
1064
  universe: zod.ZodString;
990
1065
  targeting_gate: zod.ZodDefault<zod.ZodNullable<zod.ZodString>>;
@@ -1119,11 +1194,7 @@ declare const RESOURCE_REGISTRY: readonly [{
1119
1194
  tag: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
1120
1195
  owner_email: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
1121
1196
  audience: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
1122
- bucket_by: zod.ZodOptional<zod.ZodNullable<zod.ZodEnum<{
1123
- user_id: "user_id";
1124
- session_id: "session_id";
1125
- device_id: "device_id";
1126
- }>>>;
1197
+ bucket_by: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
1127
1198
  folder: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
1128
1199
  targeting_gate: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
1129
1200
  allocation_pct: zod.ZodOptional<zod.ZodNumber>;
@@ -29,12 +29,14 @@ var gateRuleSchema = z2.object({
29
29
  "semver_gt",
30
30
  "semver_gte",
31
31
  "semver_lt",
32
- "semver_lte"
32
+ "semver_lte",
33
+ "gate_pass",
34
+ "exp_in"
33
35
  ]).describe(
34
- "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)."
36
+ '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).'
35
37
  ),
36
38
  value: z2.unknown().describe(
37
- "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`."
39
+ '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`.'
38
40
  )
39
41
  }).describe(
40
42
  "Single targeting predicate. A gate's `rules` array is evaluated with AND semantics; use the gatekeeper `stack` for OR / fall-through logic."
@@ -45,9 +47,17 @@ var gateNameSchema = z2.string().regex(
45
47
  ).max(128).describe(
46
48
  "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."
47
49
  );
50
+ var rampSchema = z2.object({
51
+ from: z2.number().int().min(0).max(1e4).describe("Start of the ramp in basis points (0\u201310000)."),
52
+ to: z2.number().int().min(0).max(1e4).describe("End of the ramp in basis points (0\u201310000)."),
53
+ startAt: z2.number().int().nonnegative().describe("Ramp start, epoch milliseconds (UTC)."),
54
+ durationMs: z2.number().int().positive().describe("Ramp length in milliseconds.")
55
+ }).describe(
56
+ "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."
57
+ );
48
58
  var stackedConditionSchema = z2.object({
49
59
  id: z2.string().min(1).describe(
50
- "Client-supplied stable id for the stack entry (used for React keys, audit diffs)."
60
+ "Client-supplied stable id for the stack entry (used for React keys, audit diffs, and as the default per-condition rollout salt)."
51
61
  ),
52
62
  type: z2.literal("condition").describe("Discriminator. `condition` = rule-based predicate sub-gate."),
53
63
  name: z2.string().optional().describe("Human label shown in the dashboard."),
@@ -56,9 +66,15 @@ var stackedConditionSchema = z2.object({
56
66
  ),
57
67
  pass: z2.enum(["all", "any"]).optional().describe("Combinator across `rules`. `all` = AND (default), `any` = OR."),
58
68
  rules: z2.array(gateRuleSchema).default([]).describe("Predicates evaluated under `pass`. Empty array = match nothing."),
69
+ rolloutPct: z2.number().int().min(0).max(1e4).optional().describe(
70
+ "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)."
71
+ ),
72
+ bucketBy: z2.string().optional().describe("Attribute used to hash the caller into the per-condition bucket. Default `userID`."),
73
+ salt: z2.string().optional().describe("Per-condition hash salt. Defaults to the entry `id`, then the gate salt."),
74
+ ramp: rampSchema.optional(),
59
75
  locked: z2.boolean().optional().describe("If `true`, dashboard hides edit controls (e.g. the trailing public-floor entry).")
60
76
  }).describe(
61
- "Rule-based sub-gate. When matched, evaluation short-circuits and the gate returns `true` for the current caller."
77
+ "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."
62
78
  );
63
79
  var stackedRolloutSchema = z2.object({
64
80
  id: z2.string().min(1).describe("Client-supplied stable id for the stack entry."),
@@ -74,9 +90,10 @@ var stackedRolloutSchema = z2.object({
74
90
  salt: z2.string().optional().describe(
75
91
  "Per-entry hash salt. Defaults to the gate's salt. Set explicitly to keep two rollouts independent or correlated across gates."
76
92
  ),
93
+ ramp: rampSchema.optional(),
77
94
  locked: z2.boolean().optional().describe("If `true`, dashboard hides edit controls.")
78
95
  }).describe(
79
- "Percentage-rollout sub-gate. Hashes `bucketBy` (default `userID`) with `salt` and returns `true` for `rolloutPct/10000` fraction of callers."
96
+ "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)."
80
97
  );
81
98
  var stackedGateEntrySchema = z2.discriminatedUnion("type", [stackedConditionSchema, stackedRolloutSchema]).describe(
82
99
  "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."
@@ -530,7 +547,12 @@ var experimentGroupSchema = z5.object({
530
547
  var paramSchemaSchema = z5.record(z5.string(), z5.enum(["string", "bool", "number"])).describe(
531
548
  "Map of param-name \u2192 scalar type. Defines the shape of `groups[].params`. Example: `{ headline: 'string', show_cta: 'bool' }`."
532
549
  );
533
- var bucketBySchema = z5.enum(["user_id", "session_id", "device_id"]).describe("Identifier used as the bucketing key. `user_id` is sticky across sessions.");
550
+ var bucketBySchema = z5.string().min(1).max(128).regex(
551
+ /^[a-zA-Z_][a-zA-Z0-9_]*$/,
552
+ "Must be a user-attribute name (letters, digits, underscore; not starting with a digit)."
553
+ ).describe(
554
+ "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."
555
+ );
534
556
  var experimentCreateSchema = z5.object({
535
557
  name: experimentNameSchema,
536
558
  description: z5.string().max(2e3).nullable().default(null).describe("Free-form description. Max 2000 chars, markdown rendered in the dashboard."),
@@ -2274,6 +2296,13 @@ var killswitchesResource = {
2274
2296
  import { z as z13 } from "zod";
2275
2297
  var ALERT_COMPARATORS = ["gt", "gte", "lt", "lte"];
2276
2298
  var ALERT_SEVERITIES = ["danger", "warn", "info"];
2299
+ var notificationTargetSchema = z13.object({
2300
+ slackChannel: z13.object({
2301
+ id: z13.string().min(1).describe("Slack channel id (e.g. C0123ABCD)."),
2302
+ name: z13.string().min(1).describe("Slack channel name (without the leading #).")
2303
+ }).nullish().describe("Slack channel to post this rule's alert to. Requires a Slack connector."),
2304
+ email: z13.string().email().nullish().describe("Email address to notify for this rule (overrides the default recipient).")
2305
+ }).strict();
2277
2306
  var alertRuleCreateSchema = z13.object({
2278
2307
  name: z13.string().min(1).max(120).describe("Human label for the rule, shown on the alert and the rules list."),
2279
2308
  metricId: z13.string().min(1).describe("Id of the metric to evaluate."),
@@ -2281,7 +2310,8 @@ var alertRuleCreateSchema = z13.object({
2281
2310
  threshold: z13.number().finite().describe("Threshold the metric value is compared against."),
2282
2311
  windowHours: z13.number().int().min(1).max(720).default(24).describe("Lookback window (hours) the metric is aggregated over. 1\u2013720."),
2283
2312
  severity: z13.enum(ALERT_SEVERITIES).default("warn").describe("Severity of the raised alert."),
2284
- enabled: z13.boolean().default(true).describe("Whether the rule is evaluated by the cron.")
2313
+ enabled: z13.boolean().default(true).describe("Whether the rule is evaluated by the cron."),
2314
+ notify: notificationTargetSchema.nullish().describe("Where to deliver this rule's alert (Slack channel and/or email target).")
2285
2315
  }).strict();
2286
2316
  var alertRuleUpdateSchema = z13.object({
2287
2317
  name: z13.string().min(1).max(120),
@@ -2289,7 +2319,8 @@ var alertRuleUpdateSchema = z13.object({
2289
2319
  threshold: z13.number().finite(),
2290
2320
  windowHours: z13.number().int().min(1).max(720),
2291
2321
  severity: z13.enum(ALERT_SEVERITIES),
2292
- enabled: z13.boolean()
2322
+ enabled: z13.boolean(),
2323
+ notify: notificationTargetSchema.nullish()
2293
2324
  }).partial().strict();
2294
2325
 
2295
2326
  // src/resources/alert-rules.ts
@@ -2,6 +2,14 @@ import { z } from 'zod';
2
2
 
3
3
  declare const ALERT_COMPARATORS: readonly ["gt", "gte", "lt", "lte"];
4
4
  declare const ALERT_SEVERITIES: readonly ["danger", "warn", "info"];
5
+ declare const notificationTargetSchema: z.ZodObject<{
6
+ slackChannel: z.ZodOptional<z.ZodNullable<z.ZodObject<{
7
+ id: z.ZodString;
8
+ name: z.ZodString;
9
+ }, z.core.$strip>>>;
10
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
11
+ }, z.core.$strict>;
12
+ type NotificationTarget = z.infer<typeof notificationTargetSchema>;
5
13
  declare const alertRuleCreateSchema: z.ZodObject<{
6
14
  name: z.ZodString;
7
15
  metricId: z.ZodString;
@@ -19,6 +27,13 @@ declare const alertRuleCreateSchema: z.ZodObject<{
19
27
  info: "info";
20
28
  }>>;
21
29
  enabled: z.ZodDefault<z.ZodBoolean>;
30
+ notify: z.ZodOptional<z.ZodNullable<z.ZodObject<{
31
+ slackChannel: z.ZodOptional<z.ZodNullable<z.ZodObject<{
32
+ id: z.ZodString;
33
+ name: z.ZodString;
34
+ }, z.core.$strip>>>;
35
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
36
+ }, z.core.$strict>>>;
22
37
  }, z.core.$strict>;
23
38
  declare const alertRuleUpdateSchema: z.ZodObject<{
24
39
  name: z.ZodOptional<z.ZodString>;
@@ -36,8 +51,15 @@ declare const alertRuleUpdateSchema: z.ZodObject<{
36
51
  info: "info";
37
52
  }>>;
38
53
  enabled: z.ZodOptional<z.ZodBoolean>;
54
+ notify: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodObject<{
55
+ slackChannel: z.ZodOptional<z.ZodNullable<z.ZodObject<{
56
+ id: z.ZodString;
57
+ name: z.ZodString;
58
+ }, z.core.$strip>>>;
59
+ email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
60
+ }, z.core.$strict>>>>;
39
61
  }, z.core.$strict>;
40
62
  type AlertRuleCreate = z.infer<typeof alertRuleCreateSchema>;
41
63
  type AlertRuleUpdate = z.infer<typeof alertRuleUpdateSchema>;
42
64
 
43
- export { ALERT_COMPARATORS, ALERT_SEVERITIES, type AlertRuleCreate, type AlertRuleUpdate, alertRuleCreateSchema, alertRuleUpdateSchema };
65
+ export { ALERT_COMPARATORS, ALERT_SEVERITIES, type AlertRuleCreate, type AlertRuleUpdate, type NotificationTarget, alertRuleCreateSchema, alertRuleUpdateSchema, notificationTargetSchema };
@@ -2,6 +2,13 @@
2
2
  import { z } from "zod";
3
3
  var ALERT_COMPARATORS = ["gt", "gte", "lt", "lte"];
4
4
  var ALERT_SEVERITIES = ["danger", "warn", "info"];
5
+ var notificationTargetSchema = z.object({
6
+ slackChannel: z.object({
7
+ id: z.string().min(1).describe("Slack channel id (e.g. C0123ABCD)."),
8
+ name: z.string().min(1).describe("Slack channel name (without the leading #).")
9
+ }).nullish().describe("Slack channel to post this rule's alert to. Requires a Slack connector."),
10
+ email: z.string().email().nullish().describe("Email address to notify for this rule (overrides the default recipient).")
11
+ }).strict();
5
12
  var alertRuleCreateSchema = z.object({
6
13
  name: z.string().min(1).max(120).describe("Human label for the rule, shown on the alert and the rules list."),
7
14
  metricId: z.string().min(1).describe("Id of the metric to evaluate."),
@@ -9,7 +16,8 @@ var alertRuleCreateSchema = z.object({
9
16
  threshold: z.number().finite().describe("Threshold the metric value is compared against."),
10
17
  windowHours: z.number().int().min(1).max(720).default(24).describe("Lookback window (hours) the metric is aggregated over. 1\u2013720."),
11
18
  severity: z.enum(ALERT_SEVERITIES).default("warn").describe("Severity of the raised alert."),
12
- enabled: z.boolean().default(true).describe("Whether the rule is evaluated by the cron.")
19
+ enabled: z.boolean().default(true).describe("Whether the rule is evaluated by the cron."),
20
+ notify: notificationTargetSchema.nullish().describe("Where to deliver this rule's alert (Slack channel and/or email target).")
13
21
  }).strict();
14
22
  var alertRuleUpdateSchema = z.object({
15
23
  name: z.string().min(1).max(120),
@@ -17,11 +25,13 @@ var alertRuleUpdateSchema = z.object({
17
25
  threshold: z.number().finite(),
18
26
  windowHours: z.number().int().min(1).max(720),
19
27
  severity: z.enum(ALERT_SEVERITIES),
20
- enabled: z.boolean()
28
+ enabled: z.boolean(),
29
+ notify: notificationTargetSchema.nullish()
21
30
  }).partial().strict();
22
31
  export {
23
32
  ALERT_COMPARATORS,
24
33
  ALERT_SEVERITIES,
25
34
  alertRuleCreateSchema,
26
- alertRuleUpdateSchema
35
+ alertRuleUpdateSchema,
36
+ notificationTargetSchema
27
37
  };
@@ -16,11 +16,7 @@ declare const paramSchemaSchema: z.ZodRecord<z.ZodString, z.ZodEnum<{
16
16
  number: "number";
17
17
  bool: "bool";
18
18
  }>>;
19
- declare const bucketBySchema: z.ZodEnum<{
20
- user_id: "user_id";
21
- session_id: "session_id";
22
- device_id: "device_id";
23
- }>;
19
+ declare const bucketBySchema: z.ZodString;
24
20
  declare const experimentCreateSchema: z.ZodObject<{
25
21
  name: z.ZodString;
26
22
  description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
@@ -28,11 +24,7 @@ declare const experimentCreateSchema: z.ZodObject<{
28
24
  tag: z.ZodDefault<z.ZodNullable<z.ZodString>>;
29
25
  owner_email: z.ZodDefault<z.ZodNullable<z.ZodString>>;
30
26
  audience: z.ZodDefault<z.ZodNullable<z.ZodString>>;
31
- bucket_by: z.ZodDefault<z.ZodNullable<z.ZodEnum<{
32
- user_id: "user_id";
33
- session_id: "session_id";
34
- device_id: "device_id";
35
- }>>>;
27
+ bucket_by: z.ZodDefault<z.ZodNullable<z.ZodString>>;
36
28
  folder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
37
29
  universe: z.ZodString;
38
30
  targeting_gate: z.ZodDefault<z.ZodNullable<z.ZodString>>;
@@ -68,11 +60,7 @@ declare const experimentUpdateSchema: z.ZodObject<{
68
60
  tag: z.ZodOptional<z.ZodNullable<z.ZodString>>;
69
61
  owner_email: z.ZodOptional<z.ZodNullable<z.ZodString>>;
70
62
  audience: z.ZodOptional<z.ZodNullable<z.ZodString>>;
71
- bucket_by: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
72
- user_id: "user_id";
73
- session_id: "session_id";
74
- device_id: "device_id";
75
- }>>>;
63
+ bucket_by: z.ZodOptional<z.ZodNullable<z.ZodString>>;
76
64
  folder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
77
65
  targeting_gate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
78
66
  allocation_pct: z.ZodOptional<z.ZodNumber>;
@@ -127,11 +115,7 @@ declare const experimentResponseSchema: z.ZodObject<{
127
115
  tag: z.ZodNullable<z.ZodString>;
128
116
  ownerEmail: z.ZodNullable<z.ZodString>;
129
117
  audience: z.ZodNullable<z.ZodString>;
130
- bucketBy: z.ZodNullable<z.ZodEnum<{
131
- user_id: "user_id";
132
- session_id: "session_id";
133
- device_id: "device_id";
134
- }>>;
118
+ bucketBy: z.ZodNullable<z.ZodString>;
135
119
  folder: z.ZodNullable<z.ZodString>;
136
120
  status: z.ZodEnum<{
137
121
  draft: "draft";
@@ -31,7 +31,12 @@ var experimentGroupSchema = z3.object({
31
31
  var paramSchemaSchema = z3.record(z3.string(), z3.enum(["string", "bool", "number"])).describe(
32
32
  "Map of param-name \u2192 scalar type. Defines the shape of `groups[].params`. Example: `{ headline: 'string', show_cta: 'bool' }`."
33
33
  );
34
- var bucketBySchema = z3.enum(["user_id", "session_id", "device_id"]).describe("Identifier used as the bucketing key. `user_id` is sticky across sessions.");
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
+ );
35
40
  var experimentCreateSchema = z3.object({
36
41
  name: experimentNameSchema,
37
42
  description: z3.string().max(2e3).nullable().default(null).describe("Free-form description. Max 2000 chars, markdown rendered in the dashboard."),