@shipeasy/openapi 1.0.0 → 1.2.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 (40) hide show
  1. package/dist/index.d.ts +9 -7
  2. package/dist/index.js +504 -2672
  3. package/dist/resources/alert-rules.d.ts +48 -0
  4. package/dist/resources/alert-rules.js +66 -0
  5. package/dist/resources/configs.d.ts +6 -2
  6. package/dist/resources/configs.js +67 -2375
  7. package/dist/resources/experiments.d.ts +100 -2
  8. package/dist/resources/experiments.js +158 -105
  9. package/dist/resources/gates.d.ts +51 -8
  10. package/dist/resources/gates.js +102 -70
  11. package/dist/resources/index.d.ts +166 -10
  12. package/dist/resources/index.js +503 -2671
  13. package/dist/resources/killswitches.d.ts +6 -2
  14. package/dist/resources/killswitches.js +113 -2412
  15. package/dist/resources/universes.d.ts +7 -4
  16. package/dist/resources/universes.js +30 -20
  17. package/dist/schemas/alert-rules.d.ts +43 -0
  18. package/dist/schemas/alert-rules.js +27 -0
  19. package/dist/schemas/configs.d.ts +154 -0
  20. package/dist/schemas/configs.js +134 -0
  21. package/dist/schemas/constants.d.ts +6 -0
  22. package/dist/schemas/constants.js +7 -0
  23. package/dist/schemas/experiments.d.ts +245 -0
  24. package/dist/schemas/experiments.js +216 -0
  25. package/dist/schemas/folder.d.ts +10 -0
  26. package/dist/schemas/folder.js +8 -0
  27. package/dist/schemas/gates.d.ts +304 -0
  28. package/dist/schemas/gates.js +172 -0
  29. package/dist/schemas/index.d.ts +11 -0
  30. package/dist/schemas/index.js +729 -0
  31. package/dist/schemas/killswitches.d.ts +110 -0
  32. package/dist/schemas/killswitches.js +226 -0
  33. package/dist/schemas/metric-name.d.ts +5 -0
  34. package/dist/schemas/metric-name.js +6 -0
  35. package/dist/schemas/pagination.d.ts +37 -0
  36. package/dist/schemas/pagination.js +44 -0
  37. package/dist/schemas/universes.d.ts +35 -0
  38. package/dist/schemas/universes.js +55 -0
  39. package/openapi.json +1257 -228
  40. package/package.json +13 -10
@@ -1,7 +1,6 @@
1
1
  import { z } from 'zod';
2
- import { UniverseCreateInput, UniverseUpdateInput } from '@shipeasy/core/schemas/universes';
3
- export { UniverseCreateInput, UniverseUpdateInput } from '@shipeasy/core/schemas/universes';
4
- import { PageQuery, Page } from '@shipeasy/core/pagination';
2
+ import { UniverseCreateInput, UniverseUpdateInput } from '../schemas/universes.js';
3
+ import { PageQuery, Page } from '../schemas/pagination.js';
5
4
  import { Transport } from '../transport.js';
6
5
 
7
6
  interface Universe {
@@ -36,10 +35,12 @@ declare const universesResource: {
36
35
  readonly schemas: {
37
36
  readonly create: z.ZodObject<{
38
37
  name: z.ZodString;
38
+ folder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
39
39
  unit_type: z.ZodDefault<z.ZodString>;
40
40
  holdout_range: z.ZodDefault<z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
41
41
  }, z.core.$strip>;
42
42
  readonly update: z.ZodObject<{
43
+ folder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
43
44
  holdout_range: z.ZodOptional<z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
44
45
  }, z.core.$strip>;
45
46
  };
@@ -82,6 +83,7 @@ declare const universesResource: {
82
83
  readonly successStatus: 201;
83
84
  readonly request: z.ZodObject<{
84
85
  name: z.ZodString;
86
+ folder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
85
87
  unit_type: z.ZodDefault<z.ZodString>;
86
88
  holdout_range: z.ZodDefault<z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
87
89
  }, z.core.$strip>;
@@ -131,6 +133,7 @@ declare const universesResource: {
131
133
  readonly id: "Stable opaque universe id (`uni_…`).";
132
134
  };
133
135
  readonly request: z.ZodObject<{
136
+ folder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
134
137
  holdout_range: z.ZodOptional<z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
135
138
  }, z.core.$strip>;
136
139
  readonly response: z.ZodObject<{
@@ -179,4 +182,4 @@ declare const universesResource: {
179
182
  }];
180
183
  };
181
184
 
182
- export { type Universe, type UniversesClient, universesClient, universesResource };
185
+ export { type Universe, UniverseCreateInput, UniverseUpdateInput, type UniversesClient, universesClient, universesResource };
@@ -1,41 +1,51 @@
1
1
  // src/resources/universes.ts
2
+ import { z as z3 } from "zod";
3
+
4
+ // src/schemas/universes.ts
2
5
  import { z as z2 } from "zod";
3
6
 
4
- // ../core/src/schemas/universes.ts
7
+ // src/schemas/folder.ts
5
8
  import { z } from "zod";
6
- var universeNameSchema = z.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/).describe(
7
- "Stable universe key referenced by experiments via `universe: '<name>'`. Lowercase letters, digits, `_` or `-`, max 64 chars. Immutable after create."
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."
8
16
  );
9
- var holdoutRangeSchema = z.tuple([z.number().int().min(0).max(9999), z.number().int().min(0).max(9999)]).refine(([lo, hi]) => lo <= hi, "lo must be <= hi").nullable().describe(
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(
10
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."
11
19
  );
12
- var universeCreateSchema = z.object({
20
+ var universeCreateSchema = z2.object({
13
21
  name: universeNameSchema,
14
- unit_type: z.string().default("user_id").describe(
22
+ folder: folderSchema,
23
+ unit_type: z2.string().default("user_id").describe(
15
24
  "Unit of randomisation. Typically `user_id`. Use `account_id` to keep whole accounts in the same group across an experiment."
16
25
  ),
17
26
  holdout_range: holdoutRangeSchema.default(null)
18
27
  }).describe("Body for `POST /api/admin/universes`. Only `name` is required.");
19
- var universeUpdateSchema = z.object({
28
+ var universeUpdateSchema = z2.object({
29
+ folder: folderSchema,
20
30
  holdout_range: holdoutRangeSchema.optional()
21
31
  }).describe(
22
32
  "Body for `PATCH /api/admin/universes/{id}`. Only `holdout_range` is mutable \u2014 name and unit_type are immutable after create."
23
33
  );
24
- var universeResponseSchema = z.object({
25
- id: z.string().describe("Stable opaque universe id."),
34
+ var universeResponseSchema = z2.object({
35
+ id: z2.string().describe("Stable opaque universe id."),
26
36
  name: universeNameSchema,
27
- unitType: z.string().describe("Unit of randomisation. Snake-case in request (`unit_type`), camelCase in response."),
28
- holdoutRange: z.tuple([z.number(), z.number()]).nullable().describe("Reserved holdout bucket range, or `null` if none."),
29
- createdAt: z.string().describe("ISO-8601 timestamp of creation.")
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.")
30
40
  });
31
- var universeCreateResponseSchema = z.object({
32
- id: z.string().describe("Newly assigned universe id."),
41
+ var universeCreateResponseSchema = z2.object({
42
+ id: z2.string().describe("Newly assigned universe id."),
33
43
  name: universeNameSchema
34
44
  });
35
- var universeUpdateResponseSchema = z.object({
36
- id: z.string().describe("Universe id that was updated.")
45
+ var universeUpdateResponseSchema = z2.object({
46
+ id: z2.string().describe("Universe id that was updated.")
37
47
  });
38
- var universeDeleteResponseSchema = z.object({ ok: z.literal(true) });
48
+ var universeDeleteResponseSchema = z2.object({ ok: z2.literal(true) });
39
49
 
40
50
  // src/transport.ts
41
51
  var ApiError = class extends Error {
@@ -48,9 +58,9 @@ var ApiError = class extends Error {
48
58
  };
49
59
 
50
60
  // src/resources/universes.ts
51
- var universeListResponseSchema = z2.object({
52
- data: z2.array(universeResponseSchema),
53
- next_cursor: z2.string().nullable()
61
+ var universeListResponseSchema = z3.object({
62
+ data: z3.array(universeResponseSchema),
63
+ next_cursor: z3.string().nullable()
54
64
  });
55
65
  var BASE = "/api/admin/universes";
56
66
  function universesClient(t) {
@@ -0,0 +1,43 @@
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 alertRuleCreateSchema: z.ZodObject<{
6
+ name: z.ZodString;
7
+ metricId: z.ZodString;
8
+ comparator: z.ZodEnum<{
9
+ gt: "gt";
10
+ gte: "gte";
11
+ lt: "lt";
12
+ lte: "lte";
13
+ }>;
14
+ threshold: z.ZodNumber;
15
+ windowHours: z.ZodDefault<z.ZodNumber>;
16
+ severity: z.ZodDefault<z.ZodEnum<{
17
+ danger: "danger";
18
+ warn: "warn";
19
+ info: "info";
20
+ }>>;
21
+ enabled: z.ZodDefault<z.ZodBoolean>;
22
+ }, z.core.$strict>;
23
+ declare const alertRuleUpdateSchema: z.ZodObject<{
24
+ name: z.ZodOptional<z.ZodString>;
25
+ comparator: z.ZodOptional<z.ZodEnum<{
26
+ gt: "gt";
27
+ gte: "gte";
28
+ lt: "lt";
29
+ lte: "lte";
30
+ }>>;
31
+ threshold: z.ZodOptional<z.ZodNumber>;
32
+ windowHours: z.ZodOptional<z.ZodNumber>;
33
+ severity: z.ZodOptional<z.ZodEnum<{
34
+ danger: "danger";
35
+ warn: "warn";
36
+ info: "info";
37
+ }>>;
38
+ enabled: z.ZodOptional<z.ZodBoolean>;
39
+ }, z.core.$strict>;
40
+ type AlertRuleCreate = z.infer<typeof alertRuleCreateSchema>;
41
+ type AlertRuleUpdate = z.infer<typeof alertRuleUpdateSchema>;
42
+
43
+ export { ALERT_COMPARATORS, ALERT_SEVERITIES, type AlertRuleCreate, type AlertRuleUpdate, alertRuleCreateSchema, alertRuleUpdateSchema };
@@ -0,0 +1,27 @@
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 alertRuleCreateSchema = z.object({
6
+ name: z.string().min(1).max(120).describe("Human label for the rule, shown on the alert and the rules list."),
7
+ metricId: z.string().min(1).describe("Id of the metric to evaluate."),
8
+ comparator: z.enum(ALERT_COMPARATORS).describe("How the metric value is compared to the threshold (gt/gte/lt/lte)."),
9
+ threshold: z.number().finite().describe("Threshold the metric value is compared against."),
10
+ windowHours: z.number().int().min(1).max(720).default(24).describe("Lookback window (hours) the metric is aggregated over. 1\u2013720."),
11
+ severity: z.enum(ALERT_SEVERITIES).default("warn").describe("Severity of the raised alert."),
12
+ enabled: z.boolean().default(true).describe("Whether the rule is evaluated by the cron.")
13
+ }).strict();
14
+ var alertRuleUpdateSchema = z.object({
15
+ name: z.string().min(1).max(120),
16
+ comparator: z.enum(ALERT_COMPARATORS),
17
+ threshold: z.number().finite(),
18
+ windowHours: z.number().int().min(1).max(720),
19
+ severity: z.enum(ALERT_SEVERITIES),
20
+ enabled: z.boolean()
21
+ }).partial().strict();
22
+ export {
23
+ ALERT_COMPARATORS,
24
+ ALERT_SEVERITIES,
25
+ alertRuleCreateSchema,
26
+ alertRuleUpdateSchema
27
+ };
@@ -0,0 +1,154 @@
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 };
@@ -0,0 +1,134 @@
1
+ // src/schemas/configs.ts
2
+ import { z as z2 } from "zod";
3
+
4
+ // src/schemas/constants.ts
5
+ var CONFIG_ENVS = ["dev", "staging", "prod"];
6
+ var CONFIG_KINDS = ["config", "killswitch"];
7
+
8
+ // src/schemas/folder.ts
9
+ import { z } from "zod";
10
+ var folderSchema = z.string().max(256).regex(/^[a-zA-Z0-9_-]+$/, "Folder must be alphanumeric, `_` or `-` (no `/`).").nullable().optional().describe(
11
+ "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."
12
+ );
13
+
14
+ // src/schemas/configs.ts
15
+ var SEGMENT = /^[a-z0-9](?:[a-z0-9_-]*[a-z0-9])?$/;
16
+ var RESERVED_FOLDER = "_default";
17
+ var configNameSchema = z2.string().max(128).refine(
18
+ (s) => {
19
+ const parts = s.split(".");
20
+ if (parts.length !== 2) return false;
21
+ return parts.every((p, i) => p === RESERVED_FOLDER && i === 0 ? true : SEGMENT.test(p));
22
+ },
23
+ {
24
+ message: "Must be `folder.name` \u2014 exactly two lowercase segments separated by a dot (e.g. `pricing.tiers`)."
25
+ }
26
+ ).describe(
27
+ "Stable config key in `folder.name` form (two lowercase segments separated by a dot, e.g. `pricing.tiers`). Used by SDKs as `Shipeasy.getConfig('<name>')`. Immutable after create."
28
+ );
29
+ var configKindSchema = z2.enum(CONFIG_KINDS);
30
+ var configEnvSchema = z2.enum(CONFIG_ENVS).describe("Target environment. One of the project's configured envs (`dev`, `stage`, `prod`).");
31
+ var jsonSchemaSchema = z2.record(z2.string(), z2.unknown()).refine((s) => s.type === "object", { message: "Top-level schema type must be 'object'" }).describe(
32
+ "JSON Schema (draft 2020-12) describing the shape of the config value. Top-level `type` must be `'object'`; every published value is validated against this schema."
33
+ );
34
+ var initialValuesSchema = z2.union([z2.unknown(), z2.record(configEnvSchema, z2.unknown())]).describe(
35
+ "Initial config value. Either a single JSON object applied to every env, or a `{ env: value }` map seeding per-env values. Must match `schema`. Defaults to `{}` on every env when omitted."
36
+ );
37
+ var configCreateSchema = z2.object({
38
+ name: configNameSchema,
39
+ description: z2.string().max(512).optional().describe("Optional free-form description shown in the dashboard. Max 512 chars."),
40
+ folder: folderSchema,
41
+ schema: jsonSchemaSchema,
42
+ value: initialValuesSchema.optional()
43
+ }).describe("Body for `POST /api/admin/configs`. `name` + `schema` required.");
44
+ var configUpdateSchema = z2.object({
45
+ schema: jsonSchemaSchema.optional().describe(
46
+ "Replacement schema. When supplied, the new schema is validated against every published value before it lands."
47
+ ),
48
+ value: z2.unknown().optional().describe(
49
+ "Flat value applied to **every** env. Publishes a new version per env. To target one env, use `PUT /{id}/drafts` then `POST /{id}/publish`."
50
+ ),
51
+ folder: folderSchema
52
+ }).describe(
53
+ "Body for `PATCH /api/admin/configs/{id}`. Partial \u2014 only supplied fields change. `value` republishes on every env."
54
+ );
55
+ var configSchemaUpdateSchema = z2.object({ schema: jsonSchemaSchema }).describe("Schema-only update. Does not bump value versions or rebuild KV.");
56
+ var configDraftUpsertSchema = z2.object({
57
+ env: configEnvSchema,
58
+ value: z2.unknown().describe("Draft value to stage on `env`. Validated against the config's current schema.")
59
+ }).describe(
60
+ "Body for `PUT /api/admin/configs/{id}/drafts`. Stages a value for a single env without publishing."
61
+ );
62
+ var configPublishSchema = z2.object({ env: configEnvSchema }).describe(
63
+ "Body for `POST /api/admin/configs/{id}/publish` and `DELETE /api/admin/configs/{id}/drafts`. Names the target env."
64
+ );
65
+ var configEnvPublishedSchema = z2.object({
66
+ version: z2.number().int().describe("Monotonically increasing version per env."),
67
+ publishedAt: z2.string().describe("ISO-8601 publish timestamp."),
68
+ publishedBy: z2.string().describe("Email/id of the actor who published this version.")
69
+ });
70
+ var configDraftSummarySchema = z2.object({
71
+ updatedAt: z2.string().describe("ISO-8601 last-edit timestamp on the draft."),
72
+ authorEmail: z2.string().describe("Email/id of the actor who last edited the draft."),
73
+ baseVersion: z2.number().int().describe("Published version the draft was forked from.")
74
+ });
75
+ var configResponseSchema = z2.object({
76
+ id: z2.string().describe("Stable opaque config id (`cfg_\u2026`)."),
77
+ name: configNameSchema,
78
+ description: z2.string().nullable(),
79
+ schema: jsonSchemaSchema,
80
+ updatedAt: z2.string().describe("ISO-8601 timestamp of last mutation."),
81
+ envs: z2.record(configEnvSchema, configEnvPublishedSchema).describe("Per-env latest published version metadata."),
82
+ drafts: z2.record(configEnvSchema, configDraftSummarySchema).describe("Per-env active drafts (if any)."),
83
+ values: z2.record(configEnvSchema, z2.unknown()).optional().describe("Per-env latest published values (only returned by `GET /{id}`, not list)."),
84
+ draftValues: z2.record(configEnvSchema, z2.unknown()).optional().describe("Per-env draft values (only returned by `GET /{id}`).")
85
+ });
86
+ var configCreateResponseSchema = z2.object({
87
+ id: z2.string().describe("Newly assigned config id."),
88
+ name: configNameSchema
89
+ });
90
+ var configUpdateResponseSchema = z2.object({
91
+ id: z2.string().describe("Config id that was updated.")
92
+ });
93
+ var configDeleteResponseSchema = z2.object({ ok: z2.literal(true) });
94
+ var configDraftSaveResponseSchema = z2.object({
95
+ id: z2.string(),
96
+ env: configEnvSchema,
97
+ baseVersion: z2.number().int().describe("Published version the draft is based on."),
98
+ updatedAt: z2.string()
99
+ });
100
+ var configDraftDiscardResponseSchema = z2.object({ ok: z2.literal(true) });
101
+ var configPublishResponseSchema = z2.object({
102
+ id: z2.string(),
103
+ env: configEnvSchema,
104
+ version: z2.number().int().describe("Newly published version on `env`.")
105
+ });
106
+ var configActivityEntrySchema = z2.object({
107
+ id: z2.string(),
108
+ action: z2.string().describe("Audit action (e.g. `config.create`, `config.publish`)."),
109
+ actorEmail: z2.string(),
110
+ actorType: z2.enum(["user", "cli", "system"]),
111
+ payload: z2.unknown().nullable(),
112
+ createdAt: z2.string().describe("ISO-8601 timestamp.")
113
+ });
114
+ var configActivityResponseSchema = z2.array(configActivityEntrySchema).describe("Recent audit rows for one config, newest first.");
115
+ export {
116
+ configActivityEntrySchema,
117
+ configActivityResponseSchema,
118
+ configCreateResponseSchema,
119
+ configCreateSchema,
120
+ configDeleteResponseSchema,
121
+ configDraftDiscardResponseSchema,
122
+ configDraftSaveResponseSchema,
123
+ configDraftUpsertSchema,
124
+ configEnvSchema,
125
+ configKindSchema,
126
+ configNameSchema,
127
+ configPublishResponseSchema,
128
+ configPublishSchema,
129
+ configResponseSchema,
130
+ configSchemaUpdateSchema,
131
+ configUpdateResponseSchema,
132
+ configUpdateSchema,
133
+ jsonSchemaSchema
134
+ };
@@ -0,0 +1,6 @@
1
+ declare const CONFIG_ENVS: readonly ["dev", "staging", "prod"];
2
+ type ConfigEnv = (typeof CONFIG_ENVS)[number];
3
+ declare const CONFIG_KINDS: readonly ["config", "killswitch"];
4
+ type ConfigKind = (typeof CONFIG_KINDS)[number];
5
+
6
+ export { CONFIG_ENVS, CONFIG_KINDS, type ConfigEnv, type ConfigKind };
@@ -0,0 +1,7 @@
1
+ // src/schemas/constants.ts
2
+ var CONFIG_ENVS = ["dev", "staging", "prod"];
3
+ var CONFIG_KINDS = ["config", "killswitch"];
4
+ export {
5
+ CONFIG_ENVS,
6
+ CONFIG_KINDS
7
+ };