@shipeasy/openapi 1.5.0 → 2.1.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.
Files changed (101) hide show
  1. package/README.md +37 -0
  2. package/dist/chunk-EPLLHLZN.js +1616 -0
  3. package/dist/chunk-EPLLHLZN.js.map +1 -0
  4. package/dist/chunk-SPH5HWCD.js +3326 -0
  5. package/dist/chunk-SPH5HWCD.js.map +1 -0
  6. package/dist/client-pVkoo3Bf.d.ts +11186 -0
  7. package/dist/client.d.ts +1 -0
  8. package/dist/client.js +215 -0
  9. package/dist/client.js.map +1 -0
  10. package/dist/custom.d.ts +64 -0
  11. package/dist/custom.js +292 -0
  12. package/dist/custom.js.map +1 -0
  13. package/dist/index.d.ts +29 -17
  14. package/dist/index.js +253 -2458
  15. package/dist/index.js.map +1 -0
  16. package/dist/node-context.d.ts +85 -0
  17. package/dist/node-context.js +110 -0
  18. package/dist/node-context.js.map +1 -0
  19. package/dist/schemas.d.ts +7920 -0
  20. package/dist/schemas.js +1083 -0
  21. package/dist/schemas.js.map +1 -0
  22. package/openapi.json +15297 -3044
  23. package/openapi.yaml +13979 -0
  24. package/package.json +37 -21
  25. package/spec/components/errors.yaml +53 -0
  26. package/spec/components/parameters.yaml +24 -0
  27. package/spec/components/responses.yaml +107 -0
  28. package/spec/components/schemas/alert-rules.yaml +175 -0
  29. package/spec/components/schemas/attributes.yaml +157 -0
  30. package/spec/components/schemas/common.yaml +87 -0
  31. package/spec/components/schemas/configs.yaml +371 -0
  32. package/spec/components/schemas/connectors.yaml +593 -0
  33. package/spec/components/schemas/errors-api.yaml +209 -0
  34. package/spec/components/schemas/events.yaml +321 -0
  35. package/spec/components/schemas/experiments.yaml +865 -0
  36. package/spec/components/schemas/gate-templates.yaml +198 -0
  37. package/spec/components/schemas/gates.yaml +890 -0
  38. package/spec/components/schemas/i18n.yaml +478 -0
  39. package/spec/components/schemas/keys.yaml +186 -0
  40. package/spec/components/schemas/killswitches.yaml +309 -0
  41. package/spec/components/schemas/metrics.yaml +547 -0
  42. package/spec/components/schemas/ops.yaml +1011 -0
  43. package/spec/components/schemas/projects.yaml +222 -0
  44. package/spec/components/schemas/search.yaml +46 -0
  45. package/spec/components/schemas/universes.yaml +127 -0
  46. package/spec/openapi.yaml +348 -0
  47. package/spec/paths/alert-rules.yaml +250 -0
  48. package/spec/paths/attributes.yaml +261 -0
  49. package/spec/paths/configs.yaml +744 -0
  50. package/spec/paths/connectors.yaml +748 -0
  51. package/spec/paths/errors.yaml +382 -0
  52. package/spec/paths/events.yaml +366 -0
  53. package/spec/paths/experiments.yaml +777 -0
  54. package/spec/paths/gate-templates.yaml +263 -0
  55. package/spec/paths/gates.yaml +451 -0
  56. package/spec/paths/i18n.yaml +544 -0
  57. package/spec/paths/keys.yaml +181 -0
  58. package/spec/paths/killswitches.yaml +557 -0
  59. package/spec/paths/metrics.yaml +302 -0
  60. package/spec/paths/ops.yaml +446 -0
  61. package/spec/paths/projects.yaml +210 -0
  62. package/spec/paths/search.yaml +62 -0
  63. package/spec/paths/universes.yaml +247 -0
  64. package/dist/resources/alert-rules.d.ts +0 -50
  65. package/dist/resources/alert-rules.js +0 -75
  66. package/dist/resources/configs.d.ts +0 -681
  67. package/dist/resources/configs.js +0 -509
  68. package/dist/resources/experiments.d.ts +0 -849
  69. package/dist/resources/experiments.js +0 -707
  70. package/dist/resources/gates.d.ts +0 -808
  71. package/dist/resources/gates.js +0 -522
  72. package/dist/resources/index.d.ts +0 -2749
  73. package/dist/resources/index.js +0 -2391
  74. package/dist/resources/killswitches.d.ts +0 -436
  75. package/dist/resources/killswitches.js +0 -514
  76. package/dist/resources/universes.d.ts +0 -185
  77. package/dist/resources/universes.js +0 -234
  78. package/dist/schemas/alert-rules.d.ts +0 -65
  79. package/dist/schemas/alert-rules.js +0 -37
  80. package/dist/schemas/configs.d.ts +0 -154
  81. package/dist/schemas/configs.js +0 -134
  82. package/dist/schemas/constants.d.ts +0 -6
  83. package/dist/schemas/constants.js +0 -7
  84. package/dist/schemas/experiments.d.ts +0 -229
  85. package/dist/schemas/experiments.js +0 -221
  86. package/dist/schemas/folder.d.ts +0 -10
  87. package/dist/schemas/folder.js +0 -8
  88. package/dist/schemas/gates.d.ts +0 -386
  89. package/dist/schemas/gates.js +0 -190
  90. package/dist/schemas/index.d.ts +0 -11
  91. package/dist/schemas/index.js +0 -762
  92. package/dist/schemas/killswitches.d.ts +0 -110
  93. package/dist/schemas/killswitches.js +0 -226
  94. package/dist/schemas/metric-name.d.ts +0 -5
  95. package/dist/schemas/metric-name.js +0 -6
  96. package/dist/schemas/pagination.d.ts +0 -37
  97. package/dist/schemas/pagination.js +0 -44
  98. package/dist/schemas/universes.d.ts +0 -35
  99. package/dist/schemas/universes.js +0 -55
  100. package/dist/transport.d.ts +0 -30
  101. package/dist/transport.js +0 -44
@@ -1,185 +0,0 @@
1
- import { z } from 'zod';
2
- import { UniverseCreateInput, UniverseUpdateInput } from '../schemas/universes.js';
3
- import { PageQuery, Page } from '../schemas/pagination.js';
4
- import { Transport } from '../transport.js';
5
-
6
- interface Universe {
7
- id: string;
8
- name: string;
9
- unitType: string;
10
- holdoutRange: [number, number] | null;
11
- allocationPct?: number;
12
- holdoutPct?: number;
13
- updatedAt?: string;
14
- }
15
- interface UniversesClient {
16
- list(opts?: Partial<PageQuery>): Promise<Page<Universe>>;
17
- listAll(): Promise<Universe[]>;
18
- resolve(idOrName: string): Promise<Universe>;
19
- create(input: UniverseCreateInput): Promise<Universe>;
20
- update(id: string, input: UniverseUpdateInput): Promise<Universe>;
21
- delete(id: string): Promise<{
22
- ok: true;
23
- }>;
24
- }
25
- declare function universesClient(t: Transport): UniversesClient;
26
- declare const universesResource: {
27
- readonly name: "universes";
28
- readonly basePath: "/api/admin/universes";
29
- readonly describeOne: "universe";
30
- readonly describeMany: "universes";
31
- readonly tag: {
32
- readonly name: "Universes";
33
- readonly description: string;
34
- };
35
- readonly schemas: {
36
- readonly create: z.ZodObject<{
37
- name: z.ZodString;
38
- folder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
39
- unit_type: z.ZodDefault<z.ZodString>;
40
- holdout_range: z.ZodDefault<z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
41
- }, z.core.$strip>;
42
- readonly update: z.ZodObject<{
43
- folder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
44
- holdout_range: z.ZodOptional<z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
45
- }, z.core.$strip>;
46
- };
47
- readonly actions: readonly [];
48
- readonly endpoints: readonly [{
49
- readonly operationId: "listUniverses";
50
- readonly method: "GET";
51
- readonly path: "";
52
- readonly summary: "List universes";
53
- readonly description: "Returns a single page of universes ordered by `created_at desc, id desc`. The universes table has no `updated_at`, so this list is keyed on creation time.";
54
- readonly response: z.ZodObject<{
55
- data: z.ZodArray<z.ZodObject<{
56
- id: z.ZodString;
57
- name: z.ZodString;
58
- unitType: z.ZodString;
59
- holdoutRange: z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
60
- createdAt: z.ZodString;
61
- }, z.core.$strip>>;
62
- next_cursor: z.ZodNullable<z.ZodString>;
63
- }, z.core.$strip>;
64
- readonly examples: {
65
- readonly response: {
66
- readonly data: readonly [{
67
- readonly id: "uni_01j7w8a1b2c3d4e5f6g7h8i9j0";
68
- readonly name: "primary_users";
69
- readonly unitType: "user_id";
70
- readonly holdoutRange: readonly [9500, 9999];
71
- readonly createdAt: "2026-04-12T10:14:08.000Z";
72
- }];
73
- readonly next_cursor: null;
74
- };
75
- };
76
- readonly useCase: "Snapshot every universe in the project — for example to audit which `unit_type` and `holdout_range` are in use before launching a new experiment.";
77
- }, {
78
- readonly operationId: "createUniverse";
79
- readonly method: "POST";
80
- readonly path: "";
81
- readonly summary: "Create a universe";
82
- readonly description: string;
83
- readonly successStatus: 201;
84
- readonly request: z.ZodObject<{
85
- name: z.ZodString;
86
- folder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
87
- unit_type: z.ZodDefault<z.ZodString>;
88
- holdout_range: z.ZodDefault<z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
89
- }, z.core.$strip>;
90
- readonly response: z.ZodObject<{
91
- id: z.ZodString;
92
- name: z.ZodString;
93
- }, z.core.$strip>;
94
- readonly examples: {
95
- readonly requestExamples: {
96
- readonly minimal: {
97
- readonly summary: "Minimal — name only";
98
- readonly description: "Smallest valid body. Creates a `user_id`-keyed universe with no holdout.";
99
- readonly value: {
100
- readonly name: "primary_users";
101
- };
102
- };
103
- readonly holdout: {
104
- readonly summary: "Holdout — reserve 5% for measurement";
105
- readonly description: "Reserves buckets 9500–9999 (5% of callers) as the holdout. Pro plan or higher.";
106
- readonly value: {
107
- readonly name: "primary_users";
108
- readonly holdout_range: readonly [9500, 9999];
109
- };
110
- };
111
- readonly accountLevel: {
112
- readonly summary: "Account-level randomisation";
113
- readonly description: "Bucket whole accounts together via `unit_type: 'account_id'`.";
114
- readonly value: {
115
- readonly name: "saas_accounts";
116
- readonly unit_type: "account_id";
117
- };
118
- };
119
- };
120
- readonly response: {
121
- readonly id: "uni_01j7w8a1b2c3d4e5f6g7h8i9j0";
122
- readonly name: "primary_users";
123
- };
124
- };
125
- readonly useCase: string;
126
- }, {
127
- readonly operationId: "updateUniverse";
128
- readonly method: "PATCH";
129
- readonly path: "/{id}";
130
- readonly summary: "Update a universe";
131
- readonly description: string;
132
- readonly pathParams: {
133
- readonly id: "Stable opaque universe id (`uni_…`).";
134
- };
135
- readonly request: z.ZodObject<{
136
- folder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
137
- holdout_range: z.ZodOptional<z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
138
- }, z.core.$strip>;
139
- readonly response: z.ZodObject<{
140
- id: z.ZodString;
141
- }, z.core.$strip>;
142
- readonly examples: {
143
- readonly requestExamples: {
144
- readonly setHoldout: {
145
- readonly summary: "Set holdout — reserve 5%";
146
- readonly description: "Reserve buckets 9500–9999 as the holdout. Pro plan or higher.";
147
- readonly value: {
148
- readonly holdout_range: readonly [9500, 9999];
149
- };
150
- };
151
- readonly removeHoldout: {
152
- readonly summary: "Remove holdout";
153
- readonly description: "Disable the holdout entirely.";
154
- readonly value: {
155
- readonly holdout_range: null;
156
- };
157
- };
158
- };
159
- readonly response: {
160
- readonly id: "uni_01j7w8a1b2c3d4e5f6g7h8i9j0";
161
- };
162
- };
163
- readonly useCase: string;
164
- }, {
165
- readonly operationId: "deleteUniverse";
166
- readonly method: "DELETE";
167
- readonly path: "/{id}";
168
- readonly summary: "Delete a universe";
169
- readonly description: "Soft-deletes the universe. Returns `409` if any non-archived experiment still references it — archive those experiments first.";
170
- readonly pathParams: {
171
- readonly id: "Stable opaque universe id.";
172
- };
173
- readonly response: z.ZodObject<{
174
- ok: z.ZodLiteral<true>;
175
- }, z.core.$strip>;
176
- readonly examples: {
177
- readonly response: {
178
- readonly ok: true;
179
- };
180
- };
181
- readonly useCase: "Tear down a universe after every experiment that used it has been archived.";
182
- }];
183
- };
184
-
185
- export { type Universe, UniverseCreateInput, UniverseUpdateInput, type UniversesClient, universesClient, universesResource };
@@ -1,234 +0,0 @@
1
- // src/resources/universes.ts
2
- import { z as z3 } from "zod";
3
-
4
- // src/schemas/universes.ts
5
- import { z as z2 } from "zod";
6
-
7
- // src/schemas/folder.ts
8
- import { z } from "zod";
9
- var folderSchema = z.string().max(256).regex(/^[a-zA-Z0-9_-]+$/, "Folder must be alphanumeric, `_` or `-` (no `/`).").nullable().optional().describe(
10
- "Optional folder name used to group items in the dashboard. Part of the SDK lookup key: an item in folder `checkout` named `new-cart` is referenced as `checkout/new-cart` from the SDK."
11
- );
12
-
13
- // src/schemas/universes.ts
14
- var universeNameSchema = z2.string().regex(/^[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?)?$/).max(128).describe(
15
- "Stable universe key. Single segment or `folder.name`. Lowercase letters, digits, `_` or `-`; max 128 chars. Immutable after create."
16
- );
17
- var holdoutRangeSchema = z2.tuple([z2.number().int().min(0).max(9999), z2.number().int().min(0).max(9999)]).refine(([lo, hi]) => lo <= hi, "lo must be <= hi").nullable().describe(
18
- "Inclusive `[lo, hi]` bucket range (0\u20139999) reserved as the **holdout** \u2014 callers hashed into this slice are excluded from every experiment in the universe. `null` disables the holdout. Pro plan or higher required."
19
- );
20
- var universeCreateSchema = z2.object({
21
- name: universeNameSchema,
22
- folder: folderSchema,
23
- unit_type: z2.string().default("user_id").describe(
24
- "Unit of randomisation. Typically `user_id`. Use `account_id` to keep whole accounts in the same group across an experiment."
25
- ),
26
- holdout_range: holdoutRangeSchema.default(null)
27
- }).describe("Body for `POST /api/admin/universes`. Only `name` is required.");
28
- var universeUpdateSchema = z2.object({
29
- folder: folderSchema,
30
- holdout_range: holdoutRangeSchema.optional()
31
- }).describe(
32
- "Body for `PATCH /api/admin/universes/{id}`. Only `holdout_range` is mutable \u2014 name and unit_type are immutable after create."
33
- );
34
- var universeResponseSchema = z2.object({
35
- id: z2.string().describe("Stable opaque universe id."),
36
- name: universeNameSchema,
37
- unitType: z2.string().describe("Unit of randomisation. Snake-case in request (`unit_type`), camelCase in response."),
38
- holdoutRange: z2.tuple([z2.number(), z2.number()]).nullable().describe("Reserved holdout bucket range, or `null` if none."),
39
- createdAt: z2.string().describe("ISO-8601 timestamp of creation.")
40
- });
41
- var universeCreateResponseSchema = z2.object({
42
- id: z2.string().describe("Newly assigned universe id."),
43
- name: universeNameSchema
44
- });
45
- var universeUpdateResponseSchema = z2.object({
46
- id: z2.string().describe("Universe id that was updated.")
47
- });
48
- var universeDeleteResponseSchema = z2.object({ ok: z2.literal(true) });
49
-
50
- // src/transport.ts
51
- var ApiError = class extends Error {
52
- constructor(message, status) {
53
- super(message);
54
- this.status = status;
55
- this.name = "ApiError";
56
- }
57
- status;
58
- };
59
-
60
- // src/resources/universes.ts
61
- var universeListResponseSchema = z3.object({
62
- data: z3.array(universeResponseSchema),
63
- next_cursor: z3.string().nullable()
64
- });
65
- var BASE = "/api/admin/universes";
66
- function universesClient(t) {
67
- async function list(opts = {}) {
68
- const query = {};
69
- if (opts.limit !== void 0) query.limit = String(opts.limit);
70
- if (opts.cursor) query.cursor = opts.cursor;
71
- return t.request("GET", BASE, void 0, query);
72
- }
73
- async function listAll() {
74
- const out = [];
75
- let cursor;
76
- do {
77
- const page = await list({ limit: 500, cursor });
78
- out.push(...page.data);
79
- cursor = page.next_cursor ?? void 0;
80
- } while (cursor);
81
- return out;
82
- }
83
- async function resolve(idOrName) {
84
- const all = await listAll();
85
- const found = all.find((u) => u.id === idOrName) ?? all.find((u) => u.name === idOrName);
86
- if (!found) throw new ApiError(`Universe '${idOrName}' not found`, 404);
87
- return found;
88
- }
89
- return {
90
- list,
91
- listAll,
92
- resolve,
93
- create: (input) => t.request("POST", BASE, universeCreateSchema.parse(input)),
94
- update: (id, input) => t.request("PATCH", `${BASE}/${id}`, universeUpdateSchema.parse(input)),
95
- delete: (id) => t.request("DELETE", `${BASE}/${id}`)
96
- };
97
- }
98
- var universesResource = {
99
- name: "universes",
100
- basePath: BASE,
101
- describeOne: "universe",
102
- describeMany: "universes",
103
- tag: {
104
- name: "Universes",
105
- description: [
106
- "Universes: the shared bucketing space all experiments draw from.",
107
- "",
108
- "**Identity.** Each universe is keyed by a stable `name` (a-z, 0-9, `_`/`-`, max 64 chars). Experiments reference it via `universe: '<name>'`. The name is immutable.",
109
- "",
110
- "**Unit of randomisation.** `unit_type` selects the attribute hashed into a 0\u20139999 bucket \u2014 default `user_id` for per-user randomisation, `account_id` to keep a whole account in the same group.",
111
- "",
112
- "**Holdout.** `holdout_range` is an inclusive `[lo, hi]` bucket range (0\u20139999) reserved for measurement \u2014 callers hashed into the holdout are excluded from every experiment in the universe. Pro plan or higher.",
113
- "",
114
- "**Deletion.** Blocked while any non-archived experiment references the universe \u2014 archive those first."
115
- ].join("\n")
116
- },
117
- schemas: {
118
- create: universeCreateSchema,
119
- update: universeUpdateSchema
120
- },
121
- actions: [],
122
- endpoints: [
123
- {
124
- operationId: "listUniverses",
125
- method: "GET",
126
- path: "",
127
- summary: "List universes",
128
- description: "Returns a single page of universes ordered by `created_at desc, id desc`. The universes table has no `updated_at`, so this list is keyed on creation time.",
129
- response: universeListResponseSchema,
130
- examples: {
131
- response: {
132
- data: [
133
- {
134
- id: "uni_01j7w8a1b2c3d4e5f6g7h8i9j0",
135
- name: "primary_users",
136
- unitType: "user_id",
137
- holdoutRange: [9500, 9999],
138
- createdAt: "2026-04-12T10:14:08.000Z"
139
- }
140
- ],
141
- next_cursor: null
142
- }
143
- },
144
- useCase: "Snapshot every universe in the project \u2014 for example to audit which `unit_type` and `holdout_range` are in use before launching a new experiment."
145
- },
146
- {
147
- operationId: "createUniverse",
148
- method: "POST",
149
- path: "",
150
- summary: "Create a universe",
151
- description: [
152
- "Creates a new universe. Only `name` is required \u2014 `unit_type` defaults to `user_id` and `holdout_range` defaults to `null` (no holdout).",
153
- "",
154
- "Returns `409` if `name` already exists in the project. Returns `403` if you supply `holdout_range` on a plan below Pro."
155
- ].join("\n"),
156
- successStatus: 201,
157
- request: universeCreateSchema,
158
- response: universeCreateResponseSchema,
159
- examples: {
160
- requestExamples: {
161
- minimal: {
162
- summary: "Minimal \u2014 name only",
163
- description: "Smallest valid body. Creates a `user_id`-keyed universe with no holdout.",
164
- value: { name: "primary_users" }
165
- },
166
- holdout: {
167
- summary: "Holdout \u2014 reserve 5% for measurement",
168
- description: "Reserves buckets 9500\u20139999 (5% of callers) as the holdout. Pro plan or higher.",
169
- value: { name: "primary_users", holdout_range: [9500, 9999] }
170
- },
171
- accountLevel: {
172
- summary: "Account-level randomisation",
173
- description: "Bucket whole accounts together via `unit_type: 'account_id'`.",
174
- value: { name: "saas_accounts", unit_type: "account_id" }
175
- }
176
- },
177
- response: { id: "uni_01j7w8a1b2c3d4e5f6g7h8i9j0", name: "primary_users" }
178
- },
179
- useCase: [
180
- '- **Default universe** \u2014 `{ "name": "primary_users" }`. Per-user randomisation, no holdout.',
181
- "- **Reserved holdout** \u2014 supply `holdout_range` to carve out a measurement slice excluded from all experiments.",
182
- "- **Account-level** \u2014 `unit_type: 'account_id'` so multi-seat accounts see one consistent variant."
183
- ].join("\n")
184
- },
185
- {
186
- operationId: "updateUniverse",
187
- method: "PATCH",
188
- path: "/{id}",
189
- summary: "Update a universe",
190
- description: [
191
- "Partial update. Only `holdout_range` is mutable \u2014 `name` and `unit_type` are immutable after create.",
192
- "",
193
- 'Pass `"holdout_range": null` to remove an existing holdout.'
194
- ].join("\n"),
195
- pathParams: { id: "Stable opaque universe id (`uni_\u2026`)." },
196
- request: universeUpdateSchema,
197
- response: universeUpdateResponseSchema,
198
- examples: {
199
- requestExamples: {
200
- setHoldout: {
201
- summary: "Set holdout \u2014 reserve 5%",
202
- description: "Reserve buckets 9500\u20139999 as the holdout. Pro plan or higher.",
203
- value: { holdout_range: [9500, 9999] }
204
- },
205
- removeHoldout: {
206
- summary: "Remove holdout",
207
- description: "Disable the holdout entirely.",
208
- value: { holdout_range: null }
209
- }
210
- },
211
- response: { id: "uni_01j7w8a1b2c3d4e5f6g7h8i9j0" }
212
- },
213
- useCase: [
214
- "- **Adjust holdout** \u2014 change the reserved measurement slice without recreating experiments.",
215
- '- **Remove holdout** \u2014 `{ "holdout_range": null }`.'
216
- ].join("\n")
217
- },
218
- {
219
- operationId: "deleteUniverse",
220
- method: "DELETE",
221
- path: "/{id}",
222
- summary: "Delete a universe",
223
- description: "Soft-deletes the universe. Returns `409` if any non-archived experiment still references it \u2014 archive those experiments first.",
224
- pathParams: { id: "Stable opaque universe id." },
225
- response: universeDeleteResponseSchema,
226
- examples: { response: { ok: true } },
227
- useCase: "Tear down a universe after every experiment that used it has been archived."
228
- }
229
- ]
230
- };
231
- export {
232
- universesClient,
233
- universesResource
234
- };
@@ -1,65 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- declare const ALERT_COMPARATORS: readonly ["gt", "gte", "lt", "lte"];
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>;
13
- declare const alertRuleCreateSchema: z.ZodObject<{
14
- name: z.ZodString;
15
- metricId: z.ZodString;
16
- comparator: z.ZodEnum<{
17
- gt: "gt";
18
- gte: "gte";
19
- lt: "lt";
20
- lte: "lte";
21
- }>;
22
- threshold: z.ZodNumber;
23
- windowHours: z.ZodDefault<z.ZodNumber>;
24
- severity: z.ZodDefault<z.ZodEnum<{
25
- danger: "danger";
26
- warn: "warn";
27
- info: "info";
28
- }>>;
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>>>;
37
- }, z.core.$strict>;
38
- declare const alertRuleUpdateSchema: z.ZodObject<{
39
- name: z.ZodOptional<z.ZodString>;
40
- comparator: z.ZodOptional<z.ZodEnum<{
41
- gt: "gt";
42
- gte: "gte";
43
- lt: "lt";
44
- lte: "lte";
45
- }>>;
46
- threshold: z.ZodOptional<z.ZodNumber>;
47
- windowHours: z.ZodOptional<z.ZodNumber>;
48
- severity: z.ZodOptional<z.ZodEnum<{
49
- danger: "danger";
50
- warn: "warn";
51
- info: "info";
52
- }>>;
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>>>>;
61
- }, z.core.$strict>;
62
- type AlertRuleCreate = z.infer<typeof alertRuleCreateSchema>;
63
- type AlertRuleUpdate = z.infer<typeof alertRuleUpdateSchema>;
64
-
65
- export { ALERT_COMPARATORS, ALERT_SEVERITIES, type AlertRuleCreate, type AlertRuleUpdate, type NotificationTarget, alertRuleCreateSchema, alertRuleUpdateSchema, notificationTargetSchema };
@@ -1,37 +0,0 @@
1
- // src/schemas/alert-rules.ts
2
- import { z } from "zod";
3
- var ALERT_COMPARATORS = ["gt", "gte", "lt", "lte"];
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();
12
- var alertRuleCreateSchema = z.object({
13
- name: z.string().min(1).max(120).describe("Human label for the rule, shown on the alert and the rules list."),
14
- metricId: z.string().min(1).describe("Id of the metric to evaluate."),
15
- comparator: z.enum(ALERT_COMPARATORS).describe("How the metric value is compared to the threshold (gt/gte/lt/lte)."),
16
- threshold: z.number().finite().describe("Threshold the metric value is compared against."),
17
- windowHours: z.number().int().min(1).max(720).default(24).describe("Lookback window (hours) the metric is aggregated over. 1\u2013720."),
18
- severity: z.enum(ALERT_SEVERITIES).default("warn").describe("Severity of the raised alert."),
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).")
21
- }).strict();
22
- var alertRuleUpdateSchema = z.object({
23
- name: z.string().min(1).max(120),
24
- comparator: z.enum(ALERT_COMPARATORS),
25
- threshold: z.number().finite(),
26
- windowHours: z.number().int().min(1).max(720),
27
- severity: z.enum(ALERT_SEVERITIES),
28
- enabled: z.boolean(),
29
- notify: notificationTargetSchema.nullish()
30
- }).partial().strict();
31
- export {
32
- ALERT_COMPARATORS,
33
- ALERT_SEVERITIES,
34
- alertRuleCreateSchema,
35
- alertRuleUpdateSchema,
36
- notificationTargetSchema
37
- };
@@ -1,154 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- /** Names are exactly two segments — `<folder>.<name>` — so the dashboard can
4
- * group rows by folder. `_default` is reserved for the migration that lifts
5
- * legacy single-segment names and is the only segment allowed to start with
6
- * an underscore. */
7
- declare const configNameSchema: z.ZodString;
8
- declare const configKindSchema: z.ZodEnum<{
9
- config: "config";
10
- killswitch: "killswitch";
11
- }>;
12
- declare const configEnvSchema: z.ZodEnum<{
13
- dev: "dev";
14
- staging: "staging";
15
- prod: "prod";
16
- }>;
17
- /** JSON Schema describing the shape of a config value.
18
- * Configs are object-only; the top-level `type` must be `"object"`. */
19
- declare const jsonSchemaSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
20
- type JsonSchemaInput = z.infer<typeof jsonSchemaSchema>;
21
- declare const configCreateSchema: z.ZodObject<{
22
- name: z.ZodString;
23
- description: z.ZodOptional<z.ZodString>;
24
- folder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
25
- schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
26
- value: z.ZodOptional<z.ZodUnion<readonly [z.ZodUnknown, z.ZodRecord<z.ZodEnum<{
27
- dev: "dev";
28
- staging: "staging";
29
- prod: "prod";
30
- }>, z.ZodUnknown>]>>;
31
- }, z.core.$strip>;
32
- /** Flat update — accepts an optional new schema and/or a flat value applied to all envs. */
33
- declare const configUpdateSchema: z.ZodObject<{
34
- schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
35
- value: z.ZodOptional<z.ZodUnknown>;
36
- folder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
37
- }, z.core.$strip>;
38
- /** Schema-only update — does not bump value versions or rebuild KV. */
39
- declare const configSchemaUpdateSchema: z.ZodObject<{
40
- schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
41
- }, z.core.$strip>;
42
- declare const configDraftUpsertSchema: z.ZodObject<{
43
- env: z.ZodEnum<{
44
- dev: "dev";
45
- staging: "staging";
46
- prod: "prod";
47
- }>;
48
- value: z.ZodUnknown;
49
- }, z.core.$strip>;
50
- declare const configPublishSchema: z.ZodObject<{
51
- env: z.ZodEnum<{
52
- dev: "dev";
53
- staging: "staging";
54
- prod: "prod";
55
- }>;
56
- }, z.core.$strip>;
57
- declare const configResponseSchema: z.ZodObject<{
58
- id: z.ZodString;
59
- name: z.ZodString;
60
- description: z.ZodNullable<z.ZodString>;
61
- schema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
62
- updatedAt: z.ZodString;
63
- envs: z.ZodRecord<z.ZodEnum<{
64
- dev: "dev";
65
- staging: "staging";
66
- prod: "prod";
67
- }>, z.ZodObject<{
68
- version: z.ZodNumber;
69
- publishedAt: z.ZodString;
70
- publishedBy: z.ZodString;
71
- }, z.core.$strip>>;
72
- drafts: z.ZodRecord<z.ZodEnum<{
73
- dev: "dev";
74
- staging: "staging";
75
- prod: "prod";
76
- }>, z.ZodObject<{
77
- updatedAt: z.ZodString;
78
- authorEmail: z.ZodString;
79
- baseVersion: z.ZodNumber;
80
- }, z.core.$strip>>;
81
- values: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
82
- dev: "dev";
83
- staging: "staging";
84
- prod: "prod";
85
- }>, z.ZodUnknown>>;
86
- draftValues: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
87
- dev: "dev";
88
- staging: "staging";
89
- prod: "prod";
90
- }>, z.ZodUnknown>>;
91
- }, z.core.$strip>;
92
- declare const configCreateResponseSchema: z.ZodObject<{
93
- id: z.ZodString;
94
- name: z.ZodString;
95
- }, z.core.$strip>;
96
- declare const configUpdateResponseSchema: z.ZodObject<{
97
- id: z.ZodString;
98
- }, z.core.$strip>;
99
- declare const configDeleteResponseSchema: z.ZodObject<{
100
- ok: z.ZodLiteral<true>;
101
- }, z.core.$strip>;
102
- declare const configDraftSaveResponseSchema: z.ZodObject<{
103
- id: z.ZodString;
104
- env: z.ZodEnum<{
105
- dev: "dev";
106
- staging: "staging";
107
- prod: "prod";
108
- }>;
109
- baseVersion: z.ZodNumber;
110
- updatedAt: z.ZodString;
111
- }, z.core.$strip>;
112
- declare const configDraftDiscardResponseSchema: z.ZodObject<{
113
- ok: z.ZodLiteral<true>;
114
- }, z.core.$strip>;
115
- declare const configPublishResponseSchema: z.ZodObject<{
116
- id: z.ZodString;
117
- env: z.ZodEnum<{
118
- dev: "dev";
119
- staging: "staging";
120
- prod: "prod";
121
- }>;
122
- version: z.ZodNumber;
123
- }, z.core.$strip>;
124
- declare const configActivityEntrySchema: z.ZodObject<{
125
- id: z.ZodString;
126
- action: z.ZodString;
127
- actorEmail: z.ZodString;
128
- actorType: z.ZodEnum<{
129
- user: "user";
130
- cli: "cli";
131
- system: "system";
132
- }>;
133
- payload: z.ZodNullable<z.ZodUnknown>;
134
- createdAt: z.ZodString;
135
- }, z.core.$strip>;
136
- declare const configActivityResponseSchema: z.ZodArray<z.ZodObject<{
137
- id: z.ZodString;
138
- action: z.ZodString;
139
- actorEmail: z.ZodString;
140
- actorType: z.ZodEnum<{
141
- user: "user";
142
- cli: "cli";
143
- system: "system";
144
- }>;
145
- payload: z.ZodNullable<z.ZodUnknown>;
146
- createdAt: z.ZodString;
147
- }, z.core.$strip>>;
148
- type ConfigCreateInput = z.infer<typeof configCreateSchema>;
149
- type ConfigUpdateInput = z.infer<typeof configUpdateSchema>;
150
- type ConfigSchemaUpdateInput = z.infer<typeof configSchemaUpdateSchema>;
151
- type ConfigDraftUpsertInput = z.infer<typeof configDraftUpsertSchema>;
152
- type ConfigPublishInput = z.infer<typeof configPublishSchema>;
153
-
154
- export { type ConfigCreateInput, type ConfigDraftUpsertInput, type ConfigPublishInput, type ConfigSchemaUpdateInput, type ConfigUpdateInput, type JsonSchemaInput, configActivityEntrySchema, configActivityResponseSchema, configCreateResponseSchema, configCreateSchema, configDeleteResponseSchema, configDraftDiscardResponseSchema, configDraftSaveResponseSchema, configDraftUpsertSchema, configEnvSchema, configKindSchema, configNameSchema, configPublishResponseSchema, configPublishSchema, configResponseSchema, configSchemaUpdateSchema, configUpdateResponseSchema, configUpdateSchema, jsonSchemaSchema };