@brimble/contracts 0.1.0 → 0.1.2

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.
@@ -54,6 +54,23 @@ export declare const privateDependencyReason: z.ZodEnum<{
54
54
  unreachable: "unreachable";
55
55
  }>;
56
56
  export type PrivateDependencyReason = z.infer<typeof privateDependencyReason>;
57
+ export declare const buildFailureCategory: z.ZodEnum<{
58
+ user: "user";
59
+ provider: "provider";
60
+ platform: "platform";
61
+ timeout: "timeout";
62
+ }>;
63
+ export type BuildFailureCategory = z.infer<typeof buildFailureCategory>;
64
+ export declare const buildProviderFailureReason: z.ZodEnum<{
65
+ unreachable: "unreachable";
66
+ timeout: "timeout";
67
+ auth: "auth";
68
+ billing: "billing";
69
+ capacity: "capacity";
70
+ config: "config";
71
+ paused: "paused";
72
+ }>;
73
+ export type BuildProviderFailureReason = z.infer<typeof buildProviderFailureReason>;
57
74
  /** Mirrors runner ServiceStateAction (service:state). */
58
75
  export declare const serviceStateAction: z.ZodEnum<{
59
76
  stopped: "stopped";
@@ -72,6 +89,12 @@ export declare const deployStatusEvent: z.ZodEnum<{
72
89
  "deploy-error": "deploy-error";
73
90
  }>;
74
91
  export type DeployStatusEvent = z.infer<typeof deployStatusEvent>;
92
+ /** The project status the runner reports on a `deploy:status` message; the dashboard shows it as is. */
93
+ export declare const deployStatusValue: z.ZodEnum<{
94
+ ACTIVE: "ACTIVE";
95
+ FAILED: "FAILED";
96
+ }>;
97
+ export type DeployStatusValue = z.infer<typeof deployStatusValue>;
75
98
  /** Outcome tag on a `deploy:notify` message. */
76
99
  export declare const deployNotifyType: z.ZodEnum<{
77
100
  success: "success";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deployNotifyType = exports.deployStatusEvent = exports.serviceRuntime = exports.serviceStateAction = exports.privateDependencyReason = exports.staleTempMode = exports.dockerCommand = exports.serviceType = exports.planType = exports.gitType = void 0;
3
+ exports.deployNotifyType = exports.deployStatusValue = exports.deployStatusEvent = exports.serviceRuntime = exports.serviceStateAction = exports.buildProviderFailureReason = exports.buildFailureCategory = exports.privateDependencyReason = exports.staleTempMode = exports.dockerCommand = exports.serviceType = exports.planType = exports.gitType = void 0;
4
4
  const zod_1 = require("zod");
5
5
  /** Mirrors @brimble/models GIT_TYPE. */
6
6
  exports.gitType = zod_1.z.enum(['GITHUB', 'GITLAB', 'BITBUCKET', 'DOCKER', 'HUGGINGFACE', 'ORIGIN']);
@@ -14,11 +14,15 @@ exports.dockerCommand = zod_1.z.enum(['start', 'stop', 'restart', 'pause', 'unpa
14
14
  exports.staleTempMode = zod_1.z.enum(['dry-run', 'on']);
15
15
  /** Mirrors core PrivateDependencyProblemReason. */
16
16
  exports.privateDependencyReason = zod_1.z.enum(['denied', 'dns', 'refused', 'unreachable']);
17
+ exports.buildFailureCategory = zod_1.z.enum(['user', 'provider', 'platform', 'timeout']);
18
+ exports.buildProviderFailureReason = zod_1.z.enum(['auth', 'billing', 'capacity', 'unreachable', 'config', 'timeout', 'paused']);
17
19
  /** Mirrors runner ServiceStateAction (service:state). */
18
20
  exports.serviceStateAction = zod_1.z.enum(['stopped', 'resumed']);
19
21
  /** Mirrors runner ServiceRuntime (service:state). */
20
22
  exports.serviceRuntime = zod_1.z.enum(['nomad', 'temp']);
21
23
  /** The `event` discriminator the runner puts on a `deploy:status` message. */
22
24
  exports.deployStatusEvent = zod_1.z.enum(['deploy', 'deploy-error']);
25
+ /** The project status the runner reports on a `deploy:status` message; the dashboard shows it as is. */
26
+ exports.deployStatusValue = zod_1.z.enum(['ACTIVE', 'FAILED']);
23
27
  /** Outcome tag on a `deploy:notify` message. */
24
28
  exports.deployNotifyType = zod_1.z.enum(['success', 'failure']);
@@ -220,6 +220,38 @@ export declare const deployCompletedSchema: z.ZodObject<{
220
220
  host: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodIPv4, z.ZodIPv6]>]>;
221
221
  port: z.ZodString;
222
222
  }, z.core.$strip>>>;
223
+ build: z.ZodOptional<z.ZodObject<{
224
+ provider: z.ZodString;
225
+ fallback: z.ZodOptional<z.ZodObject<{
226
+ from: z.ZodString;
227
+ reason: z.ZodEnum<{
228
+ unreachable: "unreachable";
229
+ timeout: "timeout";
230
+ auth: "auth";
231
+ billing: "billing";
232
+ capacity: "capacity";
233
+ config: "config";
234
+ paused: "paused";
235
+ }>;
236
+ }, z.core.$strip>>;
237
+ failure: z.ZodOptional<z.ZodObject<{
238
+ category: z.ZodEnum<{
239
+ user: "user";
240
+ provider: "provider";
241
+ platform: "platform";
242
+ timeout: "timeout";
243
+ }>;
244
+ reason: z.ZodOptional<z.ZodEnum<{
245
+ unreachable: "unreachable";
246
+ timeout: "timeout";
247
+ auth: "auth";
248
+ billing: "billing";
249
+ capacity: "capacity";
250
+ config: "config";
251
+ paused: "paused";
252
+ }>>;
253
+ }, z.core.$strip>>;
254
+ }, z.core.$strip>>;
223
255
  }, z.core.$strip>;
224
256
  /** `deploy:save` — runner -> core persistence of a finished deployment record. */
225
257
  export declare const deploySaveSchema: z.ZodObject<{
@@ -294,7 +326,10 @@ export declare const deployStatusSchema: z.ZodObject<{
294
326
  }>;
295
327
  data: z.ZodObject<{
296
328
  id: z.ZodString;
297
- status: z.ZodBoolean;
329
+ status: z.ZodEnum<{
330
+ ACTIVE: "ACTIVE";
331
+ FAILED: "FAILED";
332
+ }>;
298
333
  url: z.ZodOptional<z.ZodURL>;
299
334
  message: z.ZodString;
300
335
  teamId: z.ZodOptional<z.ZodString>;
@@ -183,6 +183,11 @@ const privateDependencyProblem = zod_1.z.object({
183
183
  host: zod_1.z.union([common_1.domainName, common_1.ipAddress]),
184
184
  port: zod_1.z.string().regex(/^\d{1,5}$/, 'must be a numeric port string'),
185
185
  });
186
+ const buildOutcome = zod_1.z.object({
187
+ provider: common_1.nonEmptyString,
188
+ fallback: zod_1.z.object({ from: common_1.nonEmptyString, reason: enums_1.buildProviderFailureReason }).optional(),
189
+ failure: zod_1.z.object({ category: enums_1.buildFailureCategory, reason: enums_1.buildProviderFailureReason.optional() }).optional(),
190
+ });
186
191
  /** `deploy:completed` — runner -> core completion signal. Primary and superseded paths share this string, so most fields are optional. */
187
192
  exports.deployCompletedSchema = zod_1.z.object({
188
193
  name: common_1.nonEmptyString.optional(),
@@ -197,6 +202,7 @@ exports.deployCompletedSchema = zod_1.z.object({
197
202
  isSuperseded: zod_1.z.boolean().optional(),
198
203
  upKeep: zod_1.z.boolean().optional(),
199
204
  privateDependencies: zod_1.z.array(privateDependencyProblem).optional(),
205
+ build: buildOutcome.optional(),
200
206
  });
201
207
  /** `deploy:save` — runner -> core persistence of a finished deployment record. */
202
208
  exports.deploySaveSchema = zod_1.z.object({
@@ -233,7 +239,7 @@ exports.deployStatusSchema = zod_1.z.object({
233
239
  event: enums_1.deployStatusEvent,
234
240
  data: zod_1.z.object({
235
241
  id: common_1.objectId,
236
- status: zod_1.z.boolean(),
242
+ status: enums_1.deployStatusValue,
237
243
  url: common_1.httpUrl.optional(),
238
244
  message: zod_1.z.string(),
239
245
  teamId: common_1.objectId.optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brimble/contracts",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Brimble cross-service message contracts (zod schemas) shared between services",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",