@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.
@@ -0,0 +1,432 @@
1
+ import { z } from 'zod';
2
+ import { killswitchCreateSchema, killswitchUpdateSchema, killswitchSwitchSetSchema, killswitchSwitchUnsetSchema } from '@shipeasy/core/schemas/killswitches';
3
+ import { PageQuery, Page } from '@shipeasy/core/pagination';
4
+ import { Transport } from '../transport.js';
5
+
6
+ type KillswitchCreateInput = z.input<typeof killswitchCreateSchema>;
7
+ type KillswitchUpdateInput = z.input<typeof killswitchUpdateSchema>;
8
+ type KillswitchSwitchSetInput = z.input<typeof killswitchSwitchSetSchema>;
9
+ type KillswitchSwitchUnsetInput = z.input<typeof killswitchSwitchUnsetSchema>;
10
+ interface Killswitch {
11
+ id: string;
12
+ name: string;
13
+ description: string | null;
14
+ updatedAt: string;
15
+ envs: Record<string, {
16
+ value: boolean;
17
+ switches?: Record<string, boolean>;
18
+ version: number;
19
+ publishedAt: string;
20
+ }>;
21
+ }
22
+ interface KillswitchesClient {
23
+ list(opts?: Partial<PageQuery>): Promise<Page<Killswitch>>;
24
+ listAll(): Promise<Killswitch[]>;
25
+ get(id: string): Promise<Killswitch>;
26
+ resolve(idOrName: string): Promise<Killswitch>;
27
+ create(input: KillswitchCreateInput): Promise<{
28
+ id: string;
29
+ name: string;
30
+ }>;
31
+ update(id: string, input: KillswitchUpdateInput): Promise<{
32
+ id: string;
33
+ }>;
34
+ delete(id: string): Promise<{
35
+ ok: true;
36
+ }>;
37
+ setSwitch(id: string, input: KillswitchSwitchSetInput): Promise<unknown>;
38
+ unsetSwitch(id: string, input: KillswitchSwitchUnsetInput): Promise<unknown>;
39
+ }
40
+ declare function killswitchesClient(t: Transport): KillswitchesClient;
41
+ declare const killswitchesResource: {
42
+ readonly name: "killswitches";
43
+ readonly basePath: "/api/admin/killswitches";
44
+ readonly describeOne: "killswitch";
45
+ readonly describeMany: "killswitches";
46
+ readonly tag: {
47
+ readonly name: "Killswitches";
48
+ readonly description: string;
49
+ };
50
+ readonly schemas: {
51
+ readonly create: z.ZodObject<{
52
+ name: z.ZodString;
53
+ description: z.ZodOptional<z.ZodString>;
54
+ value: z.ZodOptional<z.ZodBoolean>;
55
+ switches: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
56
+ }, z.core.$strip>;
57
+ readonly update: z.ZodObject<{
58
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
59
+ value: z.ZodOptional<z.ZodBoolean>;
60
+ switches: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
61
+ }, z.core.$strip>;
62
+ readonly setSwitch: z.ZodObject<{
63
+ env: z.ZodEnum<{
64
+ dev: "dev";
65
+ staging: "staging";
66
+ prod: "prod";
67
+ }>;
68
+ switchKey: z.ZodString;
69
+ value: z.ZodBoolean;
70
+ }, z.core.$strip>;
71
+ readonly unsetSwitch: z.ZodObject<{
72
+ env: z.ZodEnum<{
73
+ dev: "dev";
74
+ staging: "staging";
75
+ prod: "prod";
76
+ }>;
77
+ switchKey: z.ZodString;
78
+ }, z.core.$strip>;
79
+ };
80
+ readonly actions: readonly [{
81
+ readonly name: "setSwitch";
82
+ readonly description: "Set or update one switch entry on one env";
83
+ }, {
84
+ readonly name: "unsetSwitch";
85
+ readonly description: "Remove one switch entry from one env";
86
+ }];
87
+ readonly endpoints: readonly [{
88
+ readonly operationId: "listKillswitches";
89
+ readonly method: "GET";
90
+ readonly path: "";
91
+ readonly summary: "List killswitches";
92
+ readonly description: "Returns a single page of killswitches ordered by `updated_at desc, id desc`. Each row includes the latest published `value`/`switches`/`version` per env.";
93
+ readonly response: z.ZodObject<{
94
+ data: z.ZodArray<z.ZodObject<{
95
+ id: z.ZodString;
96
+ name: z.ZodString;
97
+ description: z.ZodNullable<z.ZodString>;
98
+ updatedAt: z.ZodString;
99
+ envs: z.ZodRecord<z.ZodEnum<{
100
+ dev: "dev";
101
+ staging: "staging";
102
+ prod: "prod";
103
+ }>, z.ZodObject<{
104
+ value: z.ZodBoolean;
105
+ switches: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
106
+ version: z.ZodNumber;
107
+ publishedAt: z.ZodString;
108
+ }, z.core.$strip>>;
109
+ }, z.core.$strip>>;
110
+ next_cursor: z.ZodNullable<z.ZodString>;
111
+ }, z.core.$strip>;
112
+ readonly examples: {
113
+ readonly response: {
114
+ readonly data: readonly [{
115
+ id: string;
116
+ name: string;
117
+ description: string;
118
+ updatedAt: string;
119
+ envs: {
120
+ dev: {
121
+ value: boolean;
122
+ version: number;
123
+ publishedAt: string;
124
+ };
125
+ stage: {
126
+ value: boolean;
127
+ version: number;
128
+ publishedAt: string;
129
+ };
130
+ prod: {
131
+ value: boolean;
132
+ switches: {
133
+ eu_region: boolean;
134
+ };
135
+ version: number;
136
+ publishedAt: string;
137
+ };
138
+ };
139
+ }];
140
+ readonly next_cursor: null;
141
+ };
142
+ };
143
+ readonly useCase: "Snapshot every killswitch in the project — e.g. to render an incident-response runbook listing every kill and its current trip state.";
144
+ }, {
145
+ readonly operationId: "getKillswitch";
146
+ readonly method: "GET";
147
+ readonly path: "/{id}";
148
+ readonly summary: "Get one killswitch";
149
+ readonly description: "Returns the killswitch metadata plus the latest published `value`/`switches`/`version` per env.";
150
+ readonly pathParams: {
151
+ readonly id: "Stable opaque killswitch id (`ksw_…`).";
152
+ };
153
+ readonly response: z.ZodObject<{
154
+ id: z.ZodString;
155
+ name: z.ZodString;
156
+ description: z.ZodNullable<z.ZodString>;
157
+ updatedAt: z.ZodString;
158
+ envs: z.ZodRecord<z.ZodEnum<{
159
+ dev: "dev";
160
+ staging: "staging";
161
+ prod: "prod";
162
+ }>, z.ZodObject<{
163
+ value: z.ZodBoolean;
164
+ switches: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
165
+ version: z.ZodNumber;
166
+ publishedAt: z.ZodString;
167
+ }, z.core.$strip>>;
168
+ }, z.core.$strip>;
169
+ readonly examples: {
170
+ readonly response: {
171
+ id: string;
172
+ name: string;
173
+ description: string;
174
+ updatedAt: string;
175
+ envs: {
176
+ dev: {
177
+ value: boolean;
178
+ version: number;
179
+ publishedAt: string;
180
+ };
181
+ stage: {
182
+ value: boolean;
183
+ version: number;
184
+ publishedAt: string;
185
+ };
186
+ prod: {
187
+ value: boolean;
188
+ switches: {
189
+ eu_region: boolean;
190
+ };
191
+ version: number;
192
+ publishedAt: string;
193
+ };
194
+ };
195
+ };
196
+ };
197
+ readonly useCase: "Fetch the current state of one killswitch — e.g. to verify a trip propagated before declaring an incident mitigated.";
198
+ }, {
199
+ readonly operationId: "createKillswitch";
200
+ readonly method: "POST";
201
+ readonly path: "";
202
+ readonly summary: "Create a killswitch";
203
+ readonly description: string;
204
+ readonly successStatus: 201;
205
+ readonly request: z.ZodObject<{
206
+ name: z.ZodString;
207
+ description: z.ZodOptional<z.ZodString>;
208
+ value: z.ZodOptional<z.ZodBoolean>;
209
+ switches: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
210
+ }, z.core.$strip>;
211
+ readonly response: z.ZodObject<{
212
+ id: z.ZodString;
213
+ name: z.ZodString;
214
+ }, z.core.$strip>;
215
+ readonly examples: {
216
+ readonly requestExamples: {
217
+ readonly minimal: {
218
+ readonly summary: "Minimal — name only, untripped";
219
+ readonly description: "Smallest valid body. Creates a killswitch with `value: false` on every env.";
220
+ readonly value: {
221
+ readonly name: "payments.checkout";
222
+ };
223
+ };
224
+ readonly preTripped: {
225
+ readonly summary: "Pre-tripped on create";
226
+ readonly description: "Ship the killswitch already tripped (`value: true`) — useful when provisioning a kill ahead of a deploy you want to ship with the feature off.";
227
+ readonly value: {
228
+ readonly name: "payments.checkout";
229
+ readonly description: "Master kill for the new checkout flow.";
230
+ readonly value: true;
231
+ };
232
+ };
233
+ readonly withSwitches: {
234
+ readonly summary: "With per-region switches";
235
+ readonly description: "Seed a `switches` map so specific named call sites can be tripped independently of the flat `value`.";
236
+ readonly value: {
237
+ readonly name: "payments.checkout";
238
+ readonly value: false;
239
+ readonly switches: {
240
+ readonly eu_region: true;
241
+ readonly apac_region: false;
242
+ };
243
+ };
244
+ };
245
+ };
246
+ readonly response: {
247
+ readonly id: "ksw_01j7w9d8h2k4m6n8p0q2r4s6t8";
248
+ readonly name: "payments.checkout";
249
+ };
250
+ };
251
+ readonly useCase: string;
252
+ }, {
253
+ readonly operationId: "updateKillswitch";
254
+ readonly method: "PATCH";
255
+ readonly path: "/{id}";
256
+ readonly summary: "Update a killswitch";
257
+ readonly description: string;
258
+ readonly pathParams: {
259
+ readonly id: "Stable opaque killswitch id.";
260
+ };
261
+ readonly request: z.ZodObject<{
262
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
263
+ value: z.ZodOptional<z.ZodBoolean>;
264
+ switches: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
265
+ }, z.core.$strip>;
266
+ readonly response: z.ZodObject<{
267
+ id: z.ZodString;
268
+ }, z.core.$strip>;
269
+ readonly examples: {
270
+ readonly requestExamples: {
271
+ readonly trip: {
272
+ readonly summary: "Trip the killswitch on every env";
273
+ readonly description: "Sets `value: true` on dev/stage/prod, bumping each env's version by one.";
274
+ readonly value: {
275
+ readonly value: true;
276
+ };
277
+ };
278
+ readonly untrip: {
279
+ readonly summary: "Untrip on every env";
280
+ readonly description: "Sets `value: false` on every env.";
281
+ readonly value: {
282
+ readonly value: false;
283
+ };
284
+ };
285
+ readonly replaceSwitches: {
286
+ readonly summary: "Replace switches map";
287
+ readonly description: "Replaces the per-key overrides wholesale on every env. Pass `{}` to clear.";
288
+ readonly value: {
289
+ readonly switches: {
290
+ readonly eu_region: true;
291
+ readonly apac_region: true;
292
+ };
293
+ };
294
+ };
295
+ readonly updateDescription: {
296
+ readonly summary: "Description-only update";
297
+ readonly description: "Doesn't bump versions or trigger a republish — only metadata changes.";
298
+ readonly value: {
299
+ readonly description: "Master kill — owner: payments-platform";
300
+ };
301
+ };
302
+ };
303
+ readonly response: {
304
+ readonly id: "ksw_01j7w9d8h2k4m6n8p0q2r4s6t8";
305
+ };
306
+ };
307
+ readonly useCase: string;
308
+ }, {
309
+ readonly operationId: "deleteKillswitch";
310
+ readonly method: "DELETE";
311
+ readonly path: "/{id}";
312
+ readonly summary: "Delete a killswitch";
313
+ readonly description: "Soft-deletes the killswitch and rebuilds the project's flags KV blob so SDKs stop seeing it.";
314
+ readonly pathParams: {
315
+ readonly id: "Stable opaque killswitch id.";
316
+ };
317
+ readonly response: z.ZodObject<{
318
+ ok: z.ZodLiteral<true>;
319
+ }, z.core.$strip>;
320
+ readonly examples: {
321
+ readonly response: {
322
+ readonly ok: true;
323
+ };
324
+ };
325
+ readonly useCase: "Tear down a killswitch after the feature it protected has been removed.";
326
+ }, {
327
+ readonly operationId: "setKillswitchSwitch";
328
+ readonly method: "PUT";
329
+ readonly path: "/{id}/switch";
330
+ readonly summary: "Set one switch entry";
331
+ readonly description: string;
332
+ readonly pathParams: {
333
+ readonly id: "Stable opaque killswitch id.";
334
+ };
335
+ readonly request: z.ZodObject<{
336
+ env: z.ZodEnum<{
337
+ dev: "dev";
338
+ staging: "staging";
339
+ prod: "prod";
340
+ }>;
341
+ switchKey: z.ZodString;
342
+ value: z.ZodBoolean;
343
+ }, z.core.$strip>;
344
+ readonly response: z.ZodObject<{
345
+ id: z.ZodString;
346
+ env: z.ZodEnum<{
347
+ dev: "dev";
348
+ staging: "staging";
349
+ prod: "prod";
350
+ }>;
351
+ switchKey: z.ZodString;
352
+ value: z.ZodBoolean;
353
+ }, z.core.$strip>;
354
+ readonly examples: {
355
+ readonly requestExamples: {
356
+ readonly tripRegion: {
357
+ readonly summary: "Trip eu_region on prod";
358
+ readonly description: "Sets `switches.eu_region = true` on prod only. Other envs and the flat `value` are unchanged.";
359
+ readonly value: {
360
+ readonly env: "prod";
361
+ readonly switchKey: "eu_region";
362
+ readonly value: true;
363
+ };
364
+ };
365
+ readonly untripRegion: {
366
+ readonly summary: "Untrip eu_region on prod";
367
+ readonly description: "Flip the same entry back off without removing it from the map.";
368
+ readonly value: {
369
+ readonly env: "prod";
370
+ readonly switchKey: "eu_region";
371
+ readonly value: false;
372
+ };
373
+ };
374
+ };
375
+ readonly response: {
376
+ readonly id: "ksw_01j7w9d8h2k4m6n8p0q2r4s6t8";
377
+ readonly env: "prod";
378
+ readonly switchKey: "eu_region";
379
+ readonly value: true;
380
+ };
381
+ };
382
+ readonly useCase: string;
383
+ }, {
384
+ readonly operationId: "unsetKillswitchSwitch";
385
+ readonly method: "DELETE";
386
+ readonly path: "/{id}/switch";
387
+ readonly summary: "Remove one switch entry";
388
+ readonly description: string;
389
+ readonly pathParams: {
390
+ readonly id: "Stable opaque killswitch id.";
391
+ };
392
+ readonly request: z.ZodObject<{
393
+ env: z.ZodEnum<{
394
+ dev: "dev";
395
+ staging: "staging";
396
+ prod: "prod";
397
+ }>;
398
+ switchKey: z.ZodString;
399
+ }, z.core.$strip>;
400
+ readonly response: z.ZodObject<{
401
+ id: z.ZodString;
402
+ env: z.ZodEnum<{
403
+ dev: "dev";
404
+ staging: "staging";
405
+ prod: "prod";
406
+ }>;
407
+ switchKey: z.ZodString;
408
+ removed: z.ZodBoolean;
409
+ }, z.core.$strip>;
410
+ readonly examples: {
411
+ readonly requestExamples: {
412
+ readonly removeRegion: {
413
+ readonly summary: "Remove eu_region from prod";
414
+ readonly description: "Drops the `eu_region` override on prod so the flat `value` applies again.";
415
+ readonly value: {
416
+ readonly env: "prod";
417
+ readonly switchKey: "eu_region";
418
+ };
419
+ };
420
+ };
421
+ readonly response: {
422
+ readonly id: "ksw_01j7w9d8h2k4m6n8p0q2r4s6t8";
423
+ readonly env: "prod";
424
+ readonly switchKey: "eu_region";
425
+ readonly removed: true;
426
+ };
427
+ };
428
+ readonly useCase: "Clean up a per-region override after the incident is resolved so the flat `value` governs again.";
429
+ }];
430
+ };
431
+
432
+ export { type Killswitch, type KillswitchCreateInput, type KillswitchSwitchSetInput, type KillswitchSwitchUnsetInput, type KillswitchUpdateInput, type KillswitchesClient, killswitchesClient, killswitchesResource };