@shipeasy/openapi 1.0.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.d.ts +15 -0
- package/dist/index.js +4604 -0
- package/dist/resources/configs.d.ts +677 -0
- package/dist/resources/configs.js +2817 -0
- package/dist/resources/experiments.d.ts +775 -0
- package/dist/resources/experiments.js +649 -0
- package/dist/resources/gates.d.ts +670 -0
- package/dist/resources/gates.js +473 -0
- package/dist/resources/index.d.ts +2522 -0
- package/dist/resources/index.js +4528 -0
- package/dist/resources/killswitches.d.ts +432 -0
- package/dist/resources/killswitches.js +2813 -0
- package/dist/resources/universes.d.ts +182 -0
- package/dist/resources/universes.js +224 -0
- package/dist/transport.d.ts +30 -0
- package/dist/transport.js +44 -0
- package/openapi.json +6011 -0
- package/package.json +58 -0
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { GateCreateInput, GateUpdateInput } from '@shipeasy/core/schemas/gates';
|
|
3
|
+
export { GateCreateInput, GateUpdateInput } from '@shipeasy/core/schemas/gates';
|
|
4
|
+
import { PageQuery, Page } from '@shipeasy/core/pagination';
|
|
5
|
+
import { Transport } from '../transport.js';
|
|
6
|
+
|
|
7
|
+
/** Gate row as returned by `GET /api/admin/gates`. Booleans come back as 0/1 from D1. */
|
|
8
|
+
interface Gate {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
enabled: number | boolean;
|
|
12
|
+
rolloutPct: number;
|
|
13
|
+
rules?: unknown[];
|
|
14
|
+
salt?: string;
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
}
|
|
17
|
+
interface GatesClient {
|
|
18
|
+
/** Single page of gates ordered `(updated_at desc, id desc)`. */
|
|
19
|
+
list(opts?: Partial<PageQuery>): Promise<Page<Gate>>;
|
|
20
|
+
/** Drain every page. Use for small datasets or batch CLI jobs. */
|
|
21
|
+
listAll(): Promise<Gate[]>;
|
|
22
|
+
/** Server has no GET /:id endpoint — resolved by paging through and filtering. */
|
|
23
|
+
getByName(name: string): Promise<Gate>;
|
|
24
|
+
/** Same as getByName but accepts either `id` or `name` (id wins if both match). */
|
|
25
|
+
resolve(idOrName: string): Promise<Gate>;
|
|
26
|
+
create(input: GateCreateInput): Promise<{
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
}>;
|
|
30
|
+
update(id: string, input: GateUpdateInput): Promise<{
|
|
31
|
+
id: string;
|
|
32
|
+
}>;
|
|
33
|
+
delete(id: string): Promise<{
|
|
34
|
+
ok: true;
|
|
35
|
+
}>;
|
|
36
|
+
enable(id: string): Promise<{
|
|
37
|
+
id: string;
|
|
38
|
+
enabled: boolean;
|
|
39
|
+
}>;
|
|
40
|
+
disable(id: string): Promise<{
|
|
41
|
+
id: string;
|
|
42
|
+
enabled: boolean;
|
|
43
|
+
}>;
|
|
44
|
+
/** Convenience: resolve by name, then PATCH rollout_pct. `pct` is 0–100 (decimals OK). */
|
|
45
|
+
setRollout(name: string, pct: number): Promise<{
|
|
46
|
+
id: string;
|
|
47
|
+
}>;
|
|
48
|
+
}
|
|
49
|
+
declare function gatesClient(t: Transport): GatesClient;
|
|
50
|
+
/**
|
|
51
|
+
* Resource descriptor for the registry. MCP iterates this to auto-generate
|
|
52
|
+
* its tool catalog; CLI iterates it to auto-wire commander subcommands.
|
|
53
|
+
*
|
|
54
|
+
* `inputSchema` fields are zod schemas — convert with `z.toJSONSchema()` for
|
|
55
|
+
* MCP `inputSchema` JSON Schema, parse directly for CLI option validation.
|
|
56
|
+
*/
|
|
57
|
+
declare const gatesResource: {
|
|
58
|
+
readonly name: "gates";
|
|
59
|
+
readonly basePath: "/api/admin/gates";
|
|
60
|
+
readonly describeOne: "feature gate";
|
|
61
|
+
readonly describeMany: "feature gates";
|
|
62
|
+
readonly tag: {
|
|
63
|
+
readonly name: "Gates";
|
|
64
|
+
readonly description: string;
|
|
65
|
+
};
|
|
66
|
+
readonly schemas: {
|
|
67
|
+
readonly create: z.ZodObject<{
|
|
68
|
+
title: z.ZodOptional<z.ZodString>;
|
|
69
|
+
description: z.ZodOptional<z.ZodString>;
|
|
70
|
+
folder: z.ZodOptional<z.ZodString>;
|
|
71
|
+
group: z.ZodOptional<z.ZodString>;
|
|
72
|
+
owner_email: z.ZodOptional<z.ZodString>;
|
|
73
|
+
name: z.ZodString;
|
|
74
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
75
|
+
rollout_pct: z.ZodDefault<z.ZodNumber>;
|
|
76
|
+
rules: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
77
|
+
attr: z.ZodString;
|
|
78
|
+
op: z.ZodEnum<{
|
|
79
|
+
eq: "eq";
|
|
80
|
+
neq: "neq";
|
|
81
|
+
in: "in";
|
|
82
|
+
not_in: "not_in";
|
|
83
|
+
gt: "gt";
|
|
84
|
+
gte: "gte";
|
|
85
|
+
lt: "lt";
|
|
86
|
+
lte: "lte";
|
|
87
|
+
contains: "contains";
|
|
88
|
+
regex: "regex";
|
|
89
|
+
}>;
|
|
90
|
+
value: z.ZodUnknown;
|
|
91
|
+
}, z.core.$strip>>>;
|
|
92
|
+
salt: z.ZodOptional<z.ZodString>;
|
|
93
|
+
stack: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
94
|
+
id: z.ZodString;
|
|
95
|
+
type: z.ZodLiteral<"condition">;
|
|
96
|
+
name: z.ZodOptional<z.ZodString>;
|
|
97
|
+
fromTemplate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
98
|
+
pass: z.ZodOptional<z.ZodEnum<{
|
|
99
|
+
all: "all";
|
|
100
|
+
any: "any";
|
|
101
|
+
}>>;
|
|
102
|
+
rules: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
103
|
+
attr: z.ZodString;
|
|
104
|
+
op: z.ZodEnum<{
|
|
105
|
+
eq: "eq";
|
|
106
|
+
neq: "neq";
|
|
107
|
+
in: "in";
|
|
108
|
+
not_in: "not_in";
|
|
109
|
+
gt: "gt";
|
|
110
|
+
gte: "gte";
|
|
111
|
+
lt: "lt";
|
|
112
|
+
lte: "lte";
|
|
113
|
+
contains: "contains";
|
|
114
|
+
regex: "regex";
|
|
115
|
+
}>;
|
|
116
|
+
value: z.ZodUnknown;
|
|
117
|
+
}, z.core.$strip>>>;
|
|
118
|
+
locked: z.ZodOptional<z.ZodBoolean>;
|
|
119
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
120
|
+
id: z.ZodString;
|
|
121
|
+
type: z.ZodLiteral<"rollout">;
|
|
122
|
+
name: z.ZodOptional<z.ZodString>;
|
|
123
|
+
fromTemplate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
124
|
+
rolloutPct: z.ZodNumber;
|
|
125
|
+
bucketBy: z.ZodOptional<z.ZodString>;
|
|
126
|
+
salt: z.ZodOptional<z.ZodString>;
|
|
127
|
+
locked: z.ZodOptional<z.ZodBoolean>;
|
|
128
|
+
}, z.core.$strip>], "type">>>>;
|
|
129
|
+
}, z.core.$strip>;
|
|
130
|
+
readonly update: z.ZodObject<{
|
|
131
|
+
title: z.ZodOptional<z.ZodString>;
|
|
132
|
+
description: z.ZodOptional<z.ZodString>;
|
|
133
|
+
folder: z.ZodOptional<z.ZodString>;
|
|
134
|
+
group: z.ZodOptional<z.ZodString>;
|
|
135
|
+
owner_email: z.ZodOptional<z.ZodString>;
|
|
136
|
+
rollout_pct: z.ZodOptional<z.ZodNumber>;
|
|
137
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
138
|
+
attr: z.ZodString;
|
|
139
|
+
op: z.ZodEnum<{
|
|
140
|
+
eq: "eq";
|
|
141
|
+
neq: "neq";
|
|
142
|
+
in: "in";
|
|
143
|
+
not_in: "not_in";
|
|
144
|
+
gt: "gt";
|
|
145
|
+
gte: "gte";
|
|
146
|
+
lt: "lt";
|
|
147
|
+
lte: "lte";
|
|
148
|
+
contains: "contains";
|
|
149
|
+
regex: "regex";
|
|
150
|
+
}>;
|
|
151
|
+
value: z.ZodUnknown;
|
|
152
|
+
}, z.core.$strip>>>;
|
|
153
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
154
|
+
stack: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
155
|
+
id: z.ZodString;
|
|
156
|
+
type: z.ZodLiteral<"condition">;
|
|
157
|
+
name: z.ZodOptional<z.ZodString>;
|
|
158
|
+
fromTemplate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
159
|
+
pass: z.ZodOptional<z.ZodEnum<{
|
|
160
|
+
all: "all";
|
|
161
|
+
any: "any";
|
|
162
|
+
}>>;
|
|
163
|
+
rules: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
164
|
+
attr: z.ZodString;
|
|
165
|
+
op: z.ZodEnum<{
|
|
166
|
+
eq: "eq";
|
|
167
|
+
neq: "neq";
|
|
168
|
+
in: "in";
|
|
169
|
+
not_in: "not_in";
|
|
170
|
+
gt: "gt";
|
|
171
|
+
gte: "gte";
|
|
172
|
+
lt: "lt";
|
|
173
|
+
lte: "lte";
|
|
174
|
+
contains: "contains";
|
|
175
|
+
regex: "regex";
|
|
176
|
+
}>;
|
|
177
|
+
value: z.ZodUnknown;
|
|
178
|
+
}, z.core.$strip>>>;
|
|
179
|
+
locked: z.ZodOptional<z.ZodBoolean>;
|
|
180
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
181
|
+
id: z.ZodString;
|
|
182
|
+
type: z.ZodLiteral<"rollout">;
|
|
183
|
+
name: z.ZodOptional<z.ZodString>;
|
|
184
|
+
fromTemplate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
185
|
+
rolloutPct: z.ZodNumber;
|
|
186
|
+
bucketBy: z.ZodOptional<z.ZodString>;
|
|
187
|
+
salt: z.ZodOptional<z.ZodString>;
|
|
188
|
+
locked: z.ZodOptional<z.ZodBoolean>;
|
|
189
|
+
}, z.core.$strip>], "type">>>>;
|
|
190
|
+
}, z.core.$strip>;
|
|
191
|
+
};
|
|
192
|
+
/** Custom action endpoints beyond CRUD (POST <basePath>/:id/<action>). */
|
|
193
|
+
readonly actions: readonly [{
|
|
194
|
+
readonly name: "enable";
|
|
195
|
+
readonly description: "Enable a gate";
|
|
196
|
+
}, {
|
|
197
|
+
readonly name: "disable";
|
|
198
|
+
readonly description: "Disable a gate";
|
|
199
|
+
}];
|
|
200
|
+
/**
|
|
201
|
+
* Full operation list for the OpenAPI doc. Order here is the order shown in
|
|
202
|
+
* the docs sidebar. The typed client (`gatesClient`) is the runtime contract;
|
|
203
|
+
* this is the documented surface.
|
|
204
|
+
*/
|
|
205
|
+
readonly endpoints: readonly [{
|
|
206
|
+
readonly operationId: "listGates";
|
|
207
|
+
readonly method: "GET";
|
|
208
|
+
readonly path: "";
|
|
209
|
+
readonly summary: "List feature gates";
|
|
210
|
+
readonly description: "Returns a single page of gates ordered by `updated_at desc, id desc`. Use the `cursor` query parameter to paginate.";
|
|
211
|
+
readonly response: z.ZodObject<{
|
|
212
|
+
data: z.ZodArray<z.ZodObject<{
|
|
213
|
+
id: z.ZodString;
|
|
214
|
+
name: z.ZodString;
|
|
215
|
+
enabled: z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber]>;
|
|
216
|
+
rolloutPct: z.ZodNumber;
|
|
217
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
218
|
+
attr: z.ZodString;
|
|
219
|
+
op: z.ZodEnum<{
|
|
220
|
+
eq: "eq";
|
|
221
|
+
neq: "neq";
|
|
222
|
+
in: "in";
|
|
223
|
+
not_in: "not_in";
|
|
224
|
+
gt: "gt";
|
|
225
|
+
gte: "gte";
|
|
226
|
+
lt: "lt";
|
|
227
|
+
lte: "lte";
|
|
228
|
+
contains: "contains";
|
|
229
|
+
regex: "regex";
|
|
230
|
+
}>;
|
|
231
|
+
value: z.ZodUnknown;
|
|
232
|
+
}, z.core.$strip>>>;
|
|
233
|
+
salt: z.ZodOptional<z.ZodString>;
|
|
234
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
235
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
236
|
+
folder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
237
|
+
groupName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
238
|
+
ownerEmail: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
239
|
+
stack: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
240
|
+
id: z.ZodString;
|
|
241
|
+
type: z.ZodLiteral<"condition">;
|
|
242
|
+
name: z.ZodOptional<z.ZodString>;
|
|
243
|
+
fromTemplate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
244
|
+
pass: z.ZodOptional<z.ZodEnum<{
|
|
245
|
+
all: "all";
|
|
246
|
+
any: "any";
|
|
247
|
+
}>>;
|
|
248
|
+
rules: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
249
|
+
attr: z.ZodString;
|
|
250
|
+
op: z.ZodEnum<{
|
|
251
|
+
eq: "eq";
|
|
252
|
+
neq: "neq";
|
|
253
|
+
in: "in";
|
|
254
|
+
not_in: "not_in";
|
|
255
|
+
gt: "gt";
|
|
256
|
+
gte: "gte";
|
|
257
|
+
lt: "lt";
|
|
258
|
+
lte: "lte";
|
|
259
|
+
contains: "contains";
|
|
260
|
+
regex: "regex";
|
|
261
|
+
}>;
|
|
262
|
+
value: z.ZodUnknown;
|
|
263
|
+
}, z.core.$strip>>>;
|
|
264
|
+
locked: z.ZodOptional<z.ZodBoolean>;
|
|
265
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
266
|
+
id: z.ZodString;
|
|
267
|
+
type: z.ZodLiteral<"rollout">;
|
|
268
|
+
name: z.ZodOptional<z.ZodString>;
|
|
269
|
+
fromTemplate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
270
|
+
rolloutPct: z.ZodNumber;
|
|
271
|
+
bucketBy: z.ZodOptional<z.ZodString>;
|
|
272
|
+
salt: z.ZodOptional<z.ZodString>;
|
|
273
|
+
locked: z.ZodOptional<z.ZodBoolean>;
|
|
274
|
+
}, z.core.$strip>], "type">>>>;
|
|
275
|
+
updatedAt: z.ZodString;
|
|
276
|
+
}, z.core.$strip>>;
|
|
277
|
+
next_cursor: z.ZodNullable<z.ZodString>;
|
|
278
|
+
}, z.core.$strip>;
|
|
279
|
+
readonly examples: {
|
|
280
|
+
readonly response: {
|
|
281
|
+
readonly data: readonly [{
|
|
282
|
+
readonly id: "gat_01j7w7m9q4hxbf6npe6s9zr3vc";
|
|
283
|
+
readonly name: "checkout_v2";
|
|
284
|
+
readonly enabled: 1;
|
|
285
|
+
readonly rolloutPct: 5000;
|
|
286
|
+
readonly rules: readonly [{
|
|
287
|
+
readonly attr: "country";
|
|
288
|
+
readonly op: "in";
|
|
289
|
+
readonly value: readonly ["US", "CA", "GB"];
|
|
290
|
+
}, {
|
|
291
|
+
readonly attr: "plan";
|
|
292
|
+
readonly op: "neq";
|
|
293
|
+
readonly value: "free";
|
|
294
|
+
}];
|
|
295
|
+
readonly salt: "9c1f4f1f2c0c4a5fa1c2b6d3e7c8e3a1";
|
|
296
|
+
readonly title: "Checkout v2";
|
|
297
|
+
readonly description: "New checkout flow. Pro users in US/CA/GB only.";
|
|
298
|
+
readonly folder: "checkout";
|
|
299
|
+
readonly groupName: "growth";
|
|
300
|
+
readonly ownerEmail: "ana@example.com";
|
|
301
|
+
readonly stack: null;
|
|
302
|
+
readonly updatedAt: "2026-05-09T16:01:22.000Z";
|
|
303
|
+
}];
|
|
304
|
+
readonly next_cursor: null;
|
|
305
|
+
};
|
|
306
|
+
};
|
|
307
|
+
readonly useCase: "Snapshot every gate in the project — for example to render an admin overview or to drive a CI check that asserts no gate is left at 100% in staging.";
|
|
308
|
+
}, {
|
|
309
|
+
readonly operationId: "createGate";
|
|
310
|
+
readonly method: "POST";
|
|
311
|
+
readonly path: "";
|
|
312
|
+
readonly summary: "Create a feature gate";
|
|
313
|
+
readonly description: string;
|
|
314
|
+
readonly successStatus: 201;
|
|
315
|
+
readonly request: z.ZodObject<{
|
|
316
|
+
title: z.ZodOptional<z.ZodString>;
|
|
317
|
+
description: z.ZodOptional<z.ZodString>;
|
|
318
|
+
folder: z.ZodOptional<z.ZodString>;
|
|
319
|
+
group: z.ZodOptional<z.ZodString>;
|
|
320
|
+
owner_email: z.ZodOptional<z.ZodString>;
|
|
321
|
+
name: z.ZodString;
|
|
322
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
323
|
+
rollout_pct: z.ZodDefault<z.ZodNumber>;
|
|
324
|
+
rules: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
325
|
+
attr: z.ZodString;
|
|
326
|
+
op: z.ZodEnum<{
|
|
327
|
+
eq: "eq";
|
|
328
|
+
neq: "neq";
|
|
329
|
+
in: "in";
|
|
330
|
+
not_in: "not_in";
|
|
331
|
+
gt: "gt";
|
|
332
|
+
gte: "gte";
|
|
333
|
+
lt: "lt";
|
|
334
|
+
lte: "lte";
|
|
335
|
+
contains: "contains";
|
|
336
|
+
regex: "regex";
|
|
337
|
+
}>;
|
|
338
|
+
value: z.ZodUnknown;
|
|
339
|
+
}, z.core.$strip>>>;
|
|
340
|
+
salt: z.ZodOptional<z.ZodString>;
|
|
341
|
+
stack: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
342
|
+
id: z.ZodString;
|
|
343
|
+
type: z.ZodLiteral<"condition">;
|
|
344
|
+
name: z.ZodOptional<z.ZodString>;
|
|
345
|
+
fromTemplate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
346
|
+
pass: z.ZodOptional<z.ZodEnum<{
|
|
347
|
+
all: "all";
|
|
348
|
+
any: "any";
|
|
349
|
+
}>>;
|
|
350
|
+
rules: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
351
|
+
attr: z.ZodString;
|
|
352
|
+
op: z.ZodEnum<{
|
|
353
|
+
eq: "eq";
|
|
354
|
+
neq: "neq";
|
|
355
|
+
in: "in";
|
|
356
|
+
not_in: "not_in";
|
|
357
|
+
gt: "gt";
|
|
358
|
+
gte: "gte";
|
|
359
|
+
lt: "lt";
|
|
360
|
+
lte: "lte";
|
|
361
|
+
contains: "contains";
|
|
362
|
+
regex: "regex";
|
|
363
|
+
}>;
|
|
364
|
+
value: z.ZodUnknown;
|
|
365
|
+
}, z.core.$strip>>>;
|
|
366
|
+
locked: z.ZodOptional<z.ZodBoolean>;
|
|
367
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
368
|
+
id: z.ZodString;
|
|
369
|
+
type: z.ZodLiteral<"rollout">;
|
|
370
|
+
name: z.ZodOptional<z.ZodString>;
|
|
371
|
+
fromTemplate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
372
|
+
rolloutPct: z.ZodNumber;
|
|
373
|
+
bucketBy: z.ZodOptional<z.ZodString>;
|
|
374
|
+
salt: z.ZodOptional<z.ZodString>;
|
|
375
|
+
locked: z.ZodOptional<z.ZodBoolean>;
|
|
376
|
+
}, z.core.$strip>], "type">>>>;
|
|
377
|
+
}, z.core.$strip>;
|
|
378
|
+
readonly response: z.ZodObject<{
|
|
379
|
+
id: z.ZodString;
|
|
380
|
+
name: z.ZodString;
|
|
381
|
+
}, z.core.$strip>;
|
|
382
|
+
readonly examples: {
|
|
383
|
+
readonly requestExamples: {
|
|
384
|
+
readonly minimal: {
|
|
385
|
+
readonly summary: "Minimal — dark gate, name only";
|
|
386
|
+
readonly description: "Smallest valid body. The gate is created `enabled: true` at `rollout_pct: 0`, with no rules. Ramp it later via PATCH.";
|
|
387
|
+
readonly value: {
|
|
388
|
+
readonly name: "checkout_v2";
|
|
389
|
+
};
|
|
390
|
+
};
|
|
391
|
+
readonly targeted: {
|
|
392
|
+
readonly summary: "Targeted rollout — rules + percentage";
|
|
393
|
+
readonly description: "Gate Pro users in US/CA/GB, then hash 10% of that audience into the on-bucket (`rollout_pct: 1000` = 10.00%). Adds dashboard metadata so the gate is self-documenting.";
|
|
394
|
+
readonly value: {
|
|
395
|
+
readonly name: "checkout_v2";
|
|
396
|
+
readonly rollout_pct: 1000;
|
|
397
|
+
readonly rules: readonly [{
|
|
398
|
+
readonly attr: "country";
|
|
399
|
+
readonly op: "in";
|
|
400
|
+
readonly value: readonly ["US", "CA", "GB"];
|
|
401
|
+
}, {
|
|
402
|
+
readonly attr: "plan";
|
|
403
|
+
readonly op: "neq";
|
|
404
|
+
readonly value: "free";
|
|
405
|
+
}];
|
|
406
|
+
readonly title: "Checkout v2";
|
|
407
|
+
readonly description: "New checkout flow. Pro users in US/CA/GB only.";
|
|
408
|
+
readonly folder: "checkout";
|
|
409
|
+
readonly group: "growth";
|
|
410
|
+
readonly owner_email: "ana@example.com";
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
readonly gatekeeperStack: {
|
|
414
|
+
readonly summary: "Gatekeeper stack — internal ∪ beta ∪ public";
|
|
415
|
+
readonly description: "Three-layer fall-through: employees always on, opted-in beta accounts always on, then 25% of everyone else. First match wins; evaluation stops as soon as one entry returns `true`.";
|
|
416
|
+
readonly value: {
|
|
417
|
+
readonly name: "checkout_v2";
|
|
418
|
+
readonly title: "Checkout v2";
|
|
419
|
+
readonly owner_email: "ana@example.com";
|
|
420
|
+
readonly stack: readonly [{
|
|
421
|
+
readonly id: "01HKJ0EMP";
|
|
422
|
+
readonly type: "condition";
|
|
423
|
+
readonly name: "Employees";
|
|
424
|
+
readonly pass: "any";
|
|
425
|
+
readonly rules: readonly [{
|
|
426
|
+
readonly attr: "email";
|
|
427
|
+
readonly op: "regex";
|
|
428
|
+
readonly value: "@acme\\.com$";
|
|
429
|
+
}];
|
|
430
|
+
}, {
|
|
431
|
+
readonly id: "01HKJ0BETA";
|
|
432
|
+
readonly type: "condition";
|
|
433
|
+
readonly name: "Beta opt-in";
|
|
434
|
+
readonly pass: "all";
|
|
435
|
+
readonly rules: readonly [{
|
|
436
|
+
readonly attr: "beta_opt_in";
|
|
437
|
+
readonly op: "eq";
|
|
438
|
+
readonly value: true;
|
|
439
|
+
}];
|
|
440
|
+
}, {
|
|
441
|
+
readonly id: "01HKJ0PUB";
|
|
442
|
+
readonly type: "rollout";
|
|
443
|
+
readonly name: "Public";
|
|
444
|
+
readonly rolloutPct: 2500;
|
|
445
|
+
readonly bucketBy: "userID";
|
|
446
|
+
readonly locked: true;
|
|
447
|
+
}];
|
|
448
|
+
};
|
|
449
|
+
};
|
|
450
|
+
readonly disabledOnCreate: {
|
|
451
|
+
readonly summary: "Disabled on create — provision then enable later";
|
|
452
|
+
readonly description: "Create with `enabled: false` so the gate evaluates to `false` for every caller until a follow-up `POST /{id}/enable`. Useful when provisioning ahead of a launch.";
|
|
453
|
+
readonly value: {
|
|
454
|
+
readonly name: "checkout_v2";
|
|
455
|
+
readonly enabled: false;
|
|
456
|
+
readonly rollout_pct: 0;
|
|
457
|
+
};
|
|
458
|
+
};
|
|
459
|
+
};
|
|
460
|
+
readonly response: {
|
|
461
|
+
readonly id: "gat_01j7w7m9q4hxbf6npe6s9zr3vc";
|
|
462
|
+
readonly name: "checkout_v2";
|
|
463
|
+
};
|
|
464
|
+
};
|
|
465
|
+
readonly useCase: string;
|
|
466
|
+
}, {
|
|
467
|
+
readonly operationId: "updateGate";
|
|
468
|
+
readonly method: "PATCH";
|
|
469
|
+
readonly path: "/{id}";
|
|
470
|
+
readonly summary: "Update a feature gate";
|
|
471
|
+
readonly description: string;
|
|
472
|
+
readonly pathParams: {
|
|
473
|
+
readonly id: "Stable opaque gate id (`gat_…`).";
|
|
474
|
+
};
|
|
475
|
+
readonly request: z.ZodObject<{
|
|
476
|
+
title: z.ZodOptional<z.ZodString>;
|
|
477
|
+
description: z.ZodOptional<z.ZodString>;
|
|
478
|
+
folder: z.ZodOptional<z.ZodString>;
|
|
479
|
+
group: z.ZodOptional<z.ZodString>;
|
|
480
|
+
owner_email: z.ZodOptional<z.ZodString>;
|
|
481
|
+
rollout_pct: z.ZodOptional<z.ZodNumber>;
|
|
482
|
+
rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
483
|
+
attr: z.ZodString;
|
|
484
|
+
op: z.ZodEnum<{
|
|
485
|
+
eq: "eq";
|
|
486
|
+
neq: "neq";
|
|
487
|
+
in: "in";
|
|
488
|
+
not_in: "not_in";
|
|
489
|
+
gt: "gt";
|
|
490
|
+
gte: "gte";
|
|
491
|
+
lt: "lt";
|
|
492
|
+
lte: "lte";
|
|
493
|
+
contains: "contains";
|
|
494
|
+
regex: "regex";
|
|
495
|
+
}>;
|
|
496
|
+
value: z.ZodUnknown;
|
|
497
|
+
}, z.core.$strip>>>;
|
|
498
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
499
|
+
stack: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
500
|
+
id: z.ZodString;
|
|
501
|
+
type: z.ZodLiteral<"condition">;
|
|
502
|
+
name: z.ZodOptional<z.ZodString>;
|
|
503
|
+
fromTemplate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
504
|
+
pass: z.ZodOptional<z.ZodEnum<{
|
|
505
|
+
all: "all";
|
|
506
|
+
any: "any";
|
|
507
|
+
}>>;
|
|
508
|
+
rules: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
509
|
+
attr: z.ZodString;
|
|
510
|
+
op: z.ZodEnum<{
|
|
511
|
+
eq: "eq";
|
|
512
|
+
neq: "neq";
|
|
513
|
+
in: "in";
|
|
514
|
+
not_in: "not_in";
|
|
515
|
+
gt: "gt";
|
|
516
|
+
gte: "gte";
|
|
517
|
+
lt: "lt";
|
|
518
|
+
lte: "lte";
|
|
519
|
+
contains: "contains";
|
|
520
|
+
regex: "regex";
|
|
521
|
+
}>;
|
|
522
|
+
value: z.ZodUnknown;
|
|
523
|
+
}, z.core.$strip>>>;
|
|
524
|
+
locked: z.ZodOptional<z.ZodBoolean>;
|
|
525
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
526
|
+
id: z.ZodString;
|
|
527
|
+
type: z.ZodLiteral<"rollout">;
|
|
528
|
+
name: z.ZodOptional<z.ZodString>;
|
|
529
|
+
fromTemplate: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
530
|
+
rolloutPct: z.ZodNumber;
|
|
531
|
+
bucketBy: z.ZodOptional<z.ZodString>;
|
|
532
|
+
salt: z.ZodOptional<z.ZodString>;
|
|
533
|
+
locked: z.ZodOptional<z.ZodBoolean>;
|
|
534
|
+
}, z.core.$strip>], "type">>>>;
|
|
535
|
+
}, z.core.$strip>;
|
|
536
|
+
readonly response: z.ZodObject<{
|
|
537
|
+
id: z.ZodString;
|
|
538
|
+
}, z.core.$strip>;
|
|
539
|
+
readonly examples: {
|
|
540
|
+
readonly requestExamples: {
|
|
541
|
+
readonly rampRollout: {
|
|
542
|
+
readonly summary: "Ramp rollout — 0 → 50%";
|
|
543
|
+
readonly description: "Single-field patch. `5000` basis points = 50%.";
|
|
544
|
+
readonly value: {
|
|
545
|
+
readonly rollout_pct: 5000;
|
|
546
|
+
};
|
|
547
|
+
};
|
|
548
|
+
readonly killSwitch: {
|
|
549
|
+
readonly summary: "Kill switch — disable the gate";
|
|
550
|
+
readonly description: "Forces evaluation to `false` for every caller, regardless of rules or rollout. Same effect as `POST /{id}/disable` but composable with other patches.";
|
|
551
|
+
readonly value: {
|
|
552
|
+
readonly enabled: false;
|
|
553
|
+
};
|
|
554
|
+
};
|
|
555
|
+
readonly extendInRule: {
|
|
556
|
+
readonly summary: "Add a value to an `in` rule";
|
|
557
|
+
readonly description: "Array fields replace wholesale — there is no per-rule patch. To add `'AU'` to a country whitelist that previously held `['US','CA','GB']`, send the full new `rules` array. Same pattern applies to `not_in`.";
|
|
558
|
+
readonly value: {
|
|
559
|
+
readonly rules: readonly [{
|
|
560
|
+
readonly attr: "country";
|
|
561
|
+
readonly op: "in";
|
|
562
|
+
readonly value: readonly ["US", "CA", "GB", "AU"];
|
|
563
|
+
}, {
|
|
564
|
+
readonly attr: "plan";
|
|
565
|
+
readonly op: "neq";
|
|
566
|
+
readonly value: "free";
|
|
567
|
+
}];
|
|
568
|
+
};
|
|
569
|
+
};
|
|
570
|
+
readonly replaceStack: {
|
|
571
|
+
readonly summary: "Replace gatekeeper stack";
|
|
572
|
+
readonly description: "Stack is replace-wholesale. Send the full new ordered list. Pass `\"stack\": null` to revert the gate to flat `rules` + `rollout_pct` evaluation.";
|
|
573
|
+
readonly value: {
|
|
574
|
+
readonly stack: readonly [{
|
|
575
|
+
readonly id: "01HKJ0EMP";
|
|
576
|
+
readonly type: "condition";
|
|
577
|
+
readonly name: "Employees";
|
|
578
|
+
readonly pass: "any";
|
|
579
|
+
readonly rules: readonly [{
|
|
580
|
+
readonly attr: "email";
|
|
581
|
+
readonly op: "regex";
|
|
582
|
+
readonly value: "@acme\\.com$";
|
|
583
|
+
}];
|
|
584
|
+
}, {
|
|
585
|
+
readonly id: "01HKJ0PUB";
|
|
586
|
+
readonly type: "rollout";
|
|
587
|
+
readonly name: "Public";
|
|
588
|
+
readonly rolloutPct: 5000;
|
|
589
|
+
readonly locked: true;
|
|
590
|
+
}];
|
|
591
|
+
};
|
|
592
|
+
};
|
|
593
|
+
readonly updateMetadata: {
|
|
594
|
+
readonly summary: "Update dashboard metadata";
|
|
595
|
+
readonly description: "Any subset of `title`, `description`, `folder`, `group`, `owner_email`. Snake-case in the request; the GET response returns camelCase (`groupName`, `ownerEmail`).";
|
|
596
|
+
readonly value: {
|
|
597
|
+
readonly title: "Checkout v2 (50%)";
|
|
598
|
+
readonly description: "Bumped to 50% after passing canary. Added AU.";
|
|
599
|
+
readonly folder: "checkout";
|
|
600
|
+
readonly owner_email: "ana@example.com";
|
|
601
|
+
};
|
|
602
|
+
};
|
|
603
|
+
};
|
|
604
|
+
readonly response: {
|
|
605
|
+
readonly id: "gat_01j7w7m9q4hxbf6npe6s9zr3vc";
|
|
606
|
+
};
|
|
607
|
+
};
|
|
608
|
+
readonly useCase: string;
|
|
609
|
+
}, {
|
|
610
|
+
readonly operationId: "deleteGate";
|
|
611
|
+
readonly method: "DELETE";
|
|
612
|
+
readonly path: "/{id}";
|
|
613
|
+
readonly summary: "Delete a feature gate";
|
|
614
|
+
readonly description: "Soft-deletes the gate. Returns 409 if the gate is still referenced by a running experiment as a targeting gate — stop the experiment first.";
|
|
615
|
+
readonly pathParams: {
|
|
616
|
+
readonly id: "Stable opaque gate id (`gat_…`).";
|
|
617
|
+
};
|
|
618
|
+
readonly response: z.ZodObject<{
|
|
619
|
+
ok: z.ZodLiteral<true>;
|
|
620
|
+
}, z.core.$strip>;
|
|
621
|
+
readonly examples: {
|
|
622
|
+
readonly response: {
|
|
623
|
+
readonly ok: true;
|
|
624
|
+
};
|
|
625
|
+
};
|
|
626
|
+
readonly useCase: "Tear down a gate after a feature has fully shipped and the rollout flag is no longer needed.";
|
|
627
|
+
}, {
|
|
628
|
+
readonly operationId: "enableGate";
|
|
629
|
+
readonly method: "POST";
|
|
630
|
+
readonly path: "/{id}/enable";
|
|
631
|
+
readonly summary: "Enable a gate";
|
|
632
|
+
readonly description: "Sets `enabled: true`. The current `rollout_pct` is preserved.";
|
|
633
|
+
readonly pathParams: {
|
|
634
|
+
readonly id: "Stable opaque gate id.";
|
|
635
|
+
};
|
|
636
|
+
readonly response: z.ZodObject<{
|
|
637
|
+
id: z.ZodString;
|
|
638
|
+
enabled: z.ZodBoolean;
|
|
639
|
+
}, z.core.$strip>;
|
|
640
|
+
readonly examples: {
|
|
641
|
+
readonly response: {
|
|
642
|
+
readonly id: "gat_01j7w7m9q4hxbf6npe6s9zr3vc";
|
|
643
|
+
readonly enabled: true;
|
|
644
|
+
};
|
|
645
|
+
};
|
|
646
|
+
readonly useCase: "Re-enable a previously disabled gate without re-issuing a full update.";
|
|
647
|
+
}, {
|
|
648
|
+
readonly operationId: "disableGate";
|
|
649
|
+
readonly method: "POST";
|
|
650
|
+
readonly path: "/{id}/disable";
|
|
651
|
+
readonly summary: "Disable a gate";
|
|
652
|
+
readonly description: "Sets `enabled: false` so the gate evaluates to `false` for every caller, regardless of `rollout_pct` or `rules`. Use as a quick kill switch.";
|
|
653
|
+
readonly pathParams: {
|
|
654
|
+
readonly id: "Stable opaque gate id.";
|
|
655
|
+
};
|
|
656
|
+
readonly response: z.ZodObject<{
|
|
657
|
+
id: z.ZodString;
|
|
658
|
+
enabled: z.ZodBoolean;
|
|
659
|
+
}, z.core.$strip>;
|
|
660
|
+
readonly examples: {
|
|
661
|
+
readonly response: {
|
|
662
|
+
readonly id: "gat_01j7w7m9q4hxbf6npe6s9zr3vc";
|
|
663
|
+
readonly enabled: false;
|
|
664
|
+
};
|
|
665
|
+
};
|
|
666
|
+
readonly useCase: "Flip a gate off in production without redeploying — the canonical kill-switch flow.";
|
|
667
|
+
}];
|
|
668
|
+
};
|
|
669
|
+
|
|
670
|
+
export { type Gate, type GatesClient, gatesClient, gatesResource };
|