@shipeasy/openapi 1.2.0 → 1.4.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.
@@ -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
- "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)."
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
- "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`."
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 matched, evaluation short-circuits and the gate returns `true` for the current caller."
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
  };
@@ -3,7 +3,7 @@ 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';
@@ -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
- "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)."
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
- "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`."
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 matched, evaluation short-circuits and the gate returns `true` for the current caller."
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.enum(["user_id", "session_id", "device_id"]).describe("Identifier used as the bucketing key. `user_id` is sticky across sessions.");
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."),
@@ -717,6 +739,7 @@ export {
717
739
  metricNameSchema,
718
740
  pageQuerySchema,
719
741
  paramSchemaSchema,
742
+ rampSchema,
720
743
  stackedGateEntrySchema,
721
744
  switchKeySchema,
722
745
  universeCreateResponseSchema,