@brimble/contracts 0.0.0-stage → 0.1.1

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,215 @@
1
+ import { z } from 'zod';
2
+ /** `email` — a transactional email to render and send (core SendMail). */
3
+ export declare const sendMailSchema: z.ZodObject<{
4
+ emails: z.ZodUnion<readonly [z.ZodEmail, z.ZodArray<z.ZodEmail>]>;
5
+ subject: z.ZodString;
6
+ template: z.ZodString;
7
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
8
+ from: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
9
+ name: z.ZodString;
10
+ email: z.ZodEmail;
11
+ }, z.core.$strip>, z.ZodString]>>;
12
+ text: z.ZodOptional<z.ZodString>;
13
+ provider: z.ZodOptional<z.ZodEnum<{
14
+ resend: "resend";
15
+ sendbyte: "sendbyte";
16
+ }>>;
17
+ event: z.ZodOptional<z.ZodEnum<{
18
+ "team-invite": "team-invite";
19
+ "workspace-removed": "workspace-removed";
20
+ "team-role-updated": "team-role-updated";
21
+ "team-2fa-required": "team-2fa-required";
22
+ "ownership-transfer-requested": "ownership-transfer-requested";
23
+ "ownership-transfer-completed": "ownership-transfer-completed";
24
+ "ownership-transfer-denied": "ownership-transfer-denied";
25
+ "api-key-created": "api-key-created";
26
+ "database-password-changed": "database-password-changed";
27
+ "support-acknowledged": "support-acknowledged";
28
+ "support-resolved": "support-resolved";
29
+ "subscription-unpaid": "subscription-unpaid";
30
+ "subscription-reactivated": "subscription-reactivated";
31
+ "deletion-scheduled": "deletion-scheduled";
32
+ "excess-projects-destroyed": "excess-projects-destroyed";
33
+ "build-minutes-exhausted": "build-minutes-exhausted";
34
+ "license-key": "license-key";
35
+ "domain-purchased": "domain-purchased";
36
+ "domain-auto-renew-card-needed": "domain-auto-renew-card-needed";
37
+ "domain-auto-renew-disabled": "domain-auto-renew-disabled";
38
+ "domain-expiry": "domain-expiry";
39
+ "free-database-trial-started": "free-database-trial-started";
40
+ "free-database-trial-expiring": "free-database-trial-expiring";
41
+ "free-database-trial-deleted": "free-database-trial-deleted";
42
+ "deployment-finished": "deployment-finished";
43
+ "service-state-changed": "service-state-changed";
44
+ "project-deleted": "project-deleted";
45
+ "clone-capacity-failed": "clone-capacity-failed";
46
+ "repo-ready": "repo-ready";
47
+ "database-provisioned": "database-provisioned";
48
+ "database-scaled": "database-scaled";
49
+ "database-ssl-enabled": "database-ssl-enabled";
50
+ "database-ssl-failed": "database-ssl-failed";
51
+ "database-backup-reminder": "database-backup-reminder";
52
+ "database-backup-failing": "database-backup-failing";
53
+ "database-backup-recovered": "database-backup-recovered";
54
+ "database-storage-almost-full": "database-storage-almost-full";
55
+ "database-weekly-report": "database-weekly-report";
56
+ "server-ready": "server-ready";
57
+ "storage-migration-finished": "storage-migration-finished";
58
+ "email-forwarding-test": "email-forwarding-test";
59
+ "gateway-dns-action": "gateway-dns-action";
60
+ "domain-limit-exceeded": "domain-limit-exceeded";
61
+ "alert-state-changed": "alert-state-changed";
62
+ "alert-evaluation-failed": "alert-evaluation-failed";
63
+ "log-drain-health": "log-drain-health";
64
+ "streak-milestone": "streak-milestone";
65
+ "streak-ended": "streak-ended";
66
+ "quest-reward-claimed": "quest-reward-claimed";
67
+ "quest-reward-issued": "quest-reward-issued";
68
+ "domain-coupon-unlocked": "domain-coupon-unlocked";
69
+ "runner-health": "runner-health";
70
+ }>>;
71
+ attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
72
+ filename: z.ZodString;
73
+ content: z.ZodString;
74
+ }, z.core.$strip>>>;
75
+ }, z.core.$strip>;
76
+ /** `discord` — a direct discord webhook dispatch (core sends `{ url, message }`). */
77
+ export declare const discordDispatchSchema: z.ZodObject<{
78
+ url: z.ZodURL;
79
+ message: z.ZodObject<{
80
+ content: z.ZodOptional<z.ZodString>;
81
+ username: z.ZodOptional<z.ZodString>;
82
+ avatar_url: z.ZodOptional<z.ZodURL>;
83
+ tts: z.ZodOptional<z.ZodBoolean>;
84
+ embeds: z.ZodOptional<z.ZodArray<z.ZodObject<{
85
+ title: z.ZodOptional<z.ZodString>;
86
+ description: z.ZodOptional<z.ZodString>;
87
+ url: z.ZodOptional<z.ZodURL>;
88
+ timestamp: z.ZodOptional<z.ZodString>;
89
+ color: z.ZodOptional<z.ZodNumber>;
90
+ footer: z.ZodOptional<z.ZodObject<{
91
+ text: z.ZodString;
92
+ icon_url: z.ZodOptional<z.ZodURL>;
93
+ }, z.core.$strip>>;
94
+ image: z.ZodOptional<z.ZodObject<{
95
+ url: z.ZodURL;
96
+ }, z.core.$strip>>;
97
+ thumbnail: z.ZodOptional<z.ZodObject<{
98
+ url: z.ZodURL;
99
+ }, z.core.$strip>>;
100
+ author: z.ZodOptional<z.ZodObject<{
101
+ name: z.ZodString;
102
+ url: z.ZodOptional<z.ZodURL>;
103
+ icon_url: z.ZodOptional<z.ZodURL>;
104
+ }, z.core.$strip>>;
105
+ fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
106
+ name: z.ZodString;
107
+ value: z.ZodString;
108
+ inline: z.ZodOptional<z.ZodBoolean>;
109
+ }, z.core.$strip>>>;
110
+ }, z.core.$loose>>>;
111
+ }, z.core.$strip>;
112
+ }, z.core.$strip>;
113
+ /** `slack` — a direct slack webhook dispatch (`{ url, message }`). */
114
+ export declare const slackDispatchSchema: z.ZodObject<{
115
+ url: z.ZodURL;
116
+ message: z.ZodObject<{
117
+ text: z.ZodOptional<z.ZodString>;
118
+ blocks: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
119
+ attachments: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
120
+ username: z.ZodOptional<z.ZodString>;
121
+ icon_emoji: z.ZodOptional<z.ZodString>;
122
+ icon_url: z.ZodOptional<z.ZodURL>;
123
+ channel: z.ZodOptional<z.ZodString>;
124
+ }, z.core.$strip>;
125
+ }, z.core.$strip>;
126
+ /** `webhook` — a business event fanned out to a subscriber's stored endpoints (brimble-email webhookPayloadDataSchema). */
127
+ export declare const webhookDispatchSchema: z.ZodObject<{
128
+ event: z.ZodEnum<{
129
+ "deployment.started": "deployment.started";
130
+ "deployment.success": "deployment.success";
131
+ "deployment.failed": "deployment.failed";
132
+ "alert.firing": "alert.firing";
133
+ "alert.resolved": "alert.resolved";
134
+ "project.created": "project.created";
135
+ "project.deleted": "project.deleted";
136
+ "project.updated": "project.updated";
137
+ "domain.created": "domain.created";
138
+ "domain.purchased": "domain.purchased";
139
+ "domain.renewed": "domain.renewed";
140
+ "project.domain.updated": "project.domain.updated";
141
+ "autoscaling.group.created": "autoscaling.group.created";
142
+ "autoscaling.group.updated": "autoscaling.group.updated";
143
+ "autoscaling.group.deleted": "autoscaling.group.deleted";
144
+ "environment.variables.added": "environment.variables.added";
145
+ "environment.variables.updated": "environment.variables.updated";
146
+ "environment.variables.deleted": "environment.variables.deleted";
147
+ "dns.record.created": "dns.record.created";
148
+ "dns.record.updated": "dns.record.updated";
149
+ "dns.record.deleted": "dns.record.deleted";
150
+ "payment.successful": "payment.successful";
151
+ "payment.failed": "payment.failed";
152
+ "subscription.created": "subscription.created";
153
+ "subscription.renewed": "subscription.renewed";
154
+ "subscription.renewal_failed": "subscription.renewal_failed";
155
+ "subscription.canceled": "subscription.canceled";
156
+ "subscription.past_due": "subscription.past_due";
157
+ "subscription.unpaid": "subscription.unpaid";
158
+ "subscription.paused": "subscription.paused";
159
+ "subscription.reactivated": "subscription.reactivated";
160
+ "subscription.incomplete_expired": "subscription.incomplete_expired";
161
+ "subscription.suspended": "subscription.suspended";
162
+ "subscription.upgraded": "subscription.upgraded";
163
+ "subscription.downgraded": "subscription.downgraded";
164
+ }>;
165
+ subscription_id: z.ZodOptional<z.ZodString>;
166
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
167
+ }, z.core.$strip>;
168
+ /** `changelog` — a changelog broadcast campaign. */
169
+ export declare const changelogEventSchema: z.ZodObject<{
170
+ subject: z.ZodString;
171
+ data: z.ZodObject<{
172
+ name: z.ZodOptional<z.ZodString>;
173
+ periodLabel: z.ZodOptional<z.ZodString>;
174
+ intro: z.ZodOptional<z.ZodString>;
175
+ entries: z.ZodArray<z.ZodObject<{
176
+ category: z.ZodEnum<{
177
+ new: "new";
178
+ improved: "improved";
179
+ fixed: "fixed";
180
+ }>;
181
+ title: z.ZodString;
182
+ description: z.ZodString;
183
+ imageUrl: z.ZodOptional<z.ZodURL>;
184
+ link: z.ZodOptional<z.ZodObject<{
185
+ label: z.ZodString;
186
+ url: z.ZodURL;
187
+ }, z.core.$strip>>;
188
+ }, z.core.$strip>>;
189
+ changelogUrl: z.ZodOptional<z.ZodURL>;
190
+ }, z.core.$strip>;
191
+ provider: z.ZodOptional<z.ZodEnum<{
192
+ resend: "resend";
193
+ sendbyte: "sendbyte";
194
+ }>>;
195
+ recipients: z.ZodOptional<z.ZodArray<z.ZodObject<{
196
+ email: z.ZodEmail;
197
+ name: z.ZodOptional<z.ZodString>;
198
+ userId: z.ZodOptional<z.ZodString>;
199
+ }, z.core.$strip>>>;
200
+ idempotencyKey: z.ZodOptional<z.ZodString>;
201
+ preview: z.ZodOptional<z.ZodBoolean>;
202
+ campaignId: z.ZodOptional<z.ZodString>;
203
+ sendByteProgress: z.ZodOptional<z.ZodObject<{
204
+ listId: z.ZodOptional<z.ZodString>;
205
+ campaignId: z.ZodOptional<z.ZodString>;
206
+ sentAt: z.ZodOptional<z.ZodString>;
207
+ }, z.core.$strip>>;
208
+ email: z.ZodOptional<z.ZodEmail>;
209
+ emails: z.ZodOptional<z.ZodUnion<readonly [z.ZodEmail, z.ZodArray<z.ZodEmail>]>>;
210
+ }, z.core.$strip>;
211
+ export type SendMailPayload = z.infer<typeof sendMailSchema>;
212
+ export type DiscordDispatchPayload = z.infer<typeof discordDispatchSchema>;
213
+ export type SlackDispatchPayload = z.infer<typeof slackDispatchSchema>;
214
+ export type WebhookDispatchPayload = z.infer<typeof webhookDispatchSchema>;
215
+ export type ChangelogEventPayload = z.infer<typeof changelogEventSchema>;
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.changelogEventSchema = exports.webhookDispatchSchema = exports.slackDispatchSchema = exports.discordDispatchSchema = exports.sendMailSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const common_1 = require("../common");
6
+ const enums_1 = require("./enums");
7
+ /** `email` — a transactional email to render and send (core SendMail). */
8
+ exports.sendMailSchema = zod_1.z.object({
9
+ emails: zod_1.z.union([zod_1.z.email(), zod_1.z.array(zod_1.z.email())]),
10
+ subject: zod_1.z.string().min(1),
11
+ template: zod_1.z.string().min(1),
12
+ data: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
13
+ from: zod_1.z.union([zod_1.z.object({ name: zod_1.z.string(), email: zod_1.z.email() }), zod_1.z.string()]).optional(),
14
+ text: zod_1.z.string().optional(),
15
+ provider: enums_1.emailProvider.optional(),
16
+ event: enums_1.emailEvent.optional(),
17
+ attachments: zod_1.z.array(zod_1.z.object({ filename: zod_1.z.string().min(1), content: zod_1.z.string().min(1) })).optional(),
18
+ });
19
+ const discordEmbedSchema = zod_1.z
20
+ .object({
21
+ title: zod_1.z.string().optional(),
22
+ description: zod_1.z.string().optional(),
23
+ url: common_1.httpUrl.optional(),
24
+ timestamp: zod_1.z.string().optional(),
25
+ color: zod_1.z.number().optional(),
26
+ footer: zod_1.z.object({ text: zod_1.z.string(), icon_url: common_1.httpUrl.optional() }).optional(),
27
+ image: zod_1.z.object({ url: common_1.httpUrl }).optional(),
28
+ thumbnail: zod_1.z.object({ url: common_1.httpUrl }).optional(),
29
+ author: zod_1.z.object({ name: zod_1.z.string(), url: common_1.httpUrl.optional(), icon_url: common_1.httpUrl.optional() }).optional(),
30
+ fields: zod_1.z.array(zod_1.z.object({ name: zod_1.z.string(), value: zod_1.z.string(), inline: zod_1.z.boolean().optional() })).optional(),
31
+ })
32
+ .loose();
33
+ const discordMessageSchema = zod_1.z.object({
34
+ content: zod_1.z.string().optional(),
35
+ username: zod_1.z.string().optional(),
36
+ avatar_url: common_1.httpUrl.optional(),
37
+ tts: zod_1.z.boolean().optional(),
38
+ embeds: zod_1.z.array(discordEmbedSchema).optional(),
39
+ });
40
+ const slackMessageSchema = zod_1.z.object({
41
+ text: zod_1.z.string().optional(),
42
+ blocks: zod_1.z.array(zod_1.z.record(zod_1.z.string(), zod_1.z.unknown())).optional(),
43
+ attachments: zod_1.z.array(zod_1.z.record(zod_1.z.string(), zod_1.z.unknown())).optional(),
44
+ username: zod_1.z.string().optional(),
45
+ icon_emoji: zod_1.z.string().optional(),
46
+ icon_url: common_1.httpUrl.optional(),
47
+ channel: zod_1.z.string().optional(),
48
+ });
49
+ /** `discord` — a direct discord webhook dispatch (core sends `{ url, message }`). */
50
+ exports.discordDispatchSchema = zod_1.z.object({
51
+ url: common_1.httpUrl,
52
+ message: discordMessageSchema,
53
+ });
54
+ /** `slack` — a direct slack webhook dispatch (`{ url, message }`). */
55
+ exports.slackDispatchSchema = zod_1.z.object({
56
+ url: common_1.httpUrl,
57
+ message: slackMessageSchema,
58
+ });
59
+ /** `webhook` — a business event fanned out to a subscriber's stored endpoints (brimble-email webhookPayloadDataSchema). */
60
+ exports.webhookDispatchSchema = zod_1.z.object({
61
+ event: enums_1.webhookEvent,
62
+ subscription_id: common_1.objectId.optional(),
63
+ data: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
64
+ });
65
+ const changelogEntrySchema = zod_1.z.object({
66
+ category: zod_1.z.enum(['new', 'improved', 'fixed']),
67
+ title: zod_1.z.string().min(1),
68
+ description: zod_1.z.string().min(1),
69
+ imageUrl: common_1.httpUrl.optional(),
70
+ link: zod_1.z.object({ label: zod_1.z.string().min(1), url: common_1.httpUrl }).optional(),
71
+ });
72
+ const changelogDataSchema = zod_1.z.object({
73
+ name: zod_1.z.string().optional(),
74
+ periodLabel: zod_1.z.string().optional(),
75
+ intro: zod_1.z.string().optional(),
76
+ entries: zod_1.z.array(changelogEntrySchema).min(1),
77
+ changelogUrl: common_1.httpUrl.optional(),
78
+ });
79
+ const sendByteProgressSchema = zod_1.z.object({
80
+ listId: zod_1.z.string().optional(),
81
+ campaignId: common_1.objectId.optional(),
82
+ sentAt: zod_1.z.string().optional(),
83
+ });
84
+ /** `changelog` — a changelog broadcast campaign. */
85
+ exports.changelogEventSchema = zod_1.z.object({
86
+ subject: zod_1.z.string().min(1),
87
+ data: changelogDataSchema,
88
+ provider: enums_1.emailProvider.optional(),
89
+ recipients: zod_1.z.array(zod_1.z.object({ email: zod_1.z.email(), name: zod_1.z.string().optional(), userId: common_1.objectId.optional() })).optional(),
90
+ idempotencyKey: zod_1.z.string().min(1).optional(),
91
+ preview: zod_1.z.boolean().optional(),
92
+ campaignId: common_1.objectId.optional(),
93
+ sendByteProgress: sendByteProgressSchema.optional(),
94
+ email: zod_1.z.email().optional(),
95
+ emails: zod_1.z.union([zod_1.z.email(), zod_1.z.array(zod_1.z.email())]).optional(),
96
+ });
@@ -0,0 +1,57 @@
1
+ /**
2
+ * The package exposes NO zod types across its public API so a consumer's own zod
3
+ * version (or absence of zod) can never clash with the one bundled here. A schema is
4
+ * described only by the structural `safeParse` shape every zod major already satisfies.
5
+ */
6
+ export type SchemaIssue = {
7
+ path: ReadonlyArray<PropertyKey>;
8
+ message: string;
9
+ };
10
+ export type SchemaError = {
11
+ issues: ReadonlyArray<SchemaIssue>;
12
+ };
13
+ export type SafeParseResult<T = unknown> = {
14
+ success: true;
15
+ data: T;
16
+ } | {
17
+ success: false;
18
+ error: SchemaError;
19
+ };
20
+ export type SchemaLike<T = unknown> = {
21
+ safeParse(data: unknown): SafeParseResult<T>;
22
+ };
23
+ /** A contract maps each event name to the schema its `data` must satisfy. */
24
+ export type MessageContract = Record<string, SchemaLike>;
25
+ export type MessageEnvelope<TEvent extends string = string, TData = unknown> = {
26
+ event: TEvent;
27
+ data: TData;
28
+ };
29
+ export type ParseSuccess<TData> = {
30
+ success: true;
31
+ event: string;
32
+ data: TData;
33
+ };
34
+ export type ParseFailure = {
35
+ success: false;
36
+ event: string;
37
+ issues: string;
38
+ };
39
+ export type ParseResult<TData = unknown> = ParseSuccess<TData> | ParseFailure;
40
+ export declare function formatIssues(issues: ReadonlyArray<SchemaIssue>): string;
41
+ /**
42
+ * Validate the `data` of a known event against its contract schema.
43
+ * Returns a discriminated result so callers never throw on bad input from the wire.
44
+ */
45
+ export declare function parseMessage(contract: MessageContract, event: string, data: unknown): ParseResult;
46
+ /** Parse a full `{ event, data }` envelope (e.g. straight off a RabbitMQ message body). */
47
+ export declare function parseEnvelope(contract: MessageContract, raw: unknown): ParseResult;
48
+ /**
49
+ * Validate a payload a producer is about to send; throws on mismatch so a service
50
+ * never puts a malformed message on the bus.
51
+ */
52
+ export declare function assertMessage<T>(schema: SchemaLike<T>, event: string, data: unknown): T;
53
+ /**
54
+ * Producer-side validate against a contract by event name — the zod-free path, so a
55
+ * sender never imports a raw schema (and never meets this package's zod version).
56
+ */
57
+ export declare function assertEvent(contract: MessageContract, event: string, data: unknown): unknown;
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatIssues = formatIssues;
4
+ exports.parseMessage = parseMessage;
5
+ exports.parseEnvelope = parseEnvelope;
6
+ exports.assertMessage = assertMessage;
7
+ exports.assertEvent = assertEvent;
8
+ function formatIssues(issues) {
9
+ return issues.map((issue) => `${issue.path.map((segment) => segment.toString()).join('.') || '(root)'}: ${issue.message}`).join('; ');
10
+ }
11
+ /**
12
+ * Validate the `data` of a known event against its contract schema.
13
+ * Returns a discriminated result so callers never throw on bad input from the wire.
14
+ */
15
+ function parseMessage(contract, event, data) {
16
+ const schema = contract[event];
17
+ if (!schema) {
18
+ return { success: false, event, issues: `No contract for event "${event}"` };
19
+ }
20
+ const result = schema.safeParse(data);
21
+ if (result.success) {
22
+ return { success: true, event, data: result.data };
23
+ }
24
+ return { success: false, event, issues: formatIssues(result.error.issues) };
25
+ }
26
+ /** Parse a full `{ event, data }` envelope (e.g. straight off a RabbitMQ message body). */
27
+ function parseEnvelope(contract, raw) {
28
+ if (!raw || typeof raw !== 'object') {
29
+ return { success: false, event: 'unknown', issues: '(root): expected an object envelope' };
30
+ }
31
+ const envelope = raw;
32
+ const event = envelope.event;
33
+ if (typeof event !== 'string' || event.length === 0) {
34
+ return { success: false, event: 'unknown', issues: 'event: expected a non-empty string' };
35
+ }
36
+ return parseMessage(contract, event, envelope.data);
37
+ }
38
+ /**
39
+ * Validate a payload a producer is about to send; throws on mismatch so a service
40
+ * never puts a malformed message on the bus.
41
+ */
42
+ function assertMessage(schema, event, data) {
43
+ const result = schema.safeParse(data);
44
+ if (!result.success) {
45
+ throw new Error(`Invalid "${event}" message payload: ${formatIssues(result.error.issues)}`);
46
+ }
47
+ return result.data;
48
+ }
49
+ /**
50
+ * Producer-side validate against a contract by event name — the zod-free path, so a
51
+ * sender never imports a raw schema (and never meets this package's zod version).
52
+ */
53
+ function assertEvent(contract, event, data) {
54
+ const schema = contract[event];
55
+ if (!schema) {
56
+ throw new Error(`No contract for event "${event}"`);
57
+ }
58
+ return assertMessage(schema, event, data);
59
+ }
@@ -0,0 +1,4 @@
1
+ export * from './envelope';
2
+ export * from './runner';
3
+ export * from './email';
4
+ export * from './dns';
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./envelope"), exports);
18
+ __exportStar(require("./runner"), exports);
19
+ __exportStar(require("./email"), exports);
20
+ __exportStar(require("./dns"), exports);
@@ -0,0 +1,86 @@
1
+ import { z } from 'zod';
2
+ /** Mirrors @brimble/models GIT_TYPE. */
3
+ export declare const gitType: z.ZodEnum<{
4
+ GITHUB: "GITHUB";
5
+ GITLAB: "GITLAB";
6
+ BITBUCKET: "BITBUCKET";
7
+ DOCKER: "DOCKER";
8
+ HUGGINGFACE: "HUGGINGFACE";
9
+ ORIGIN: "ORIGIN";
10
+ }>;
11
+ export type GitType = z.infer<typeof gitType>;
12
+ /** Mirrors @brimble/models SUBSCRIPTION_PLAN_TYPE. */
13
+ export declare const planType: z.ZodEnum<{
14
+ FREE_PLAN: "FREE_PLAN";
15
+ DEVELOPER_PLAN: "DEVELOPER_PLAN";
16
+ TEAM_PLAN: "TEAM_PLAN";
17
+ DOMAIN_PLAN: "DOMAIN_PLAN";
18
+ HACKER_PLAN: "HACKER_PLAN";
19
+ LISCENSE_PLAN: "LISCENSE_PLAN";
20
+ EMAIL_FORWARDING_PLAN: "EMAIL_FORWARDING_PLAN";
21
+ }>;
22
+ export type PlanType = z.infer<typeof planType>;
23
+ /** Mirrors @brimble/models ServiceType. */
24
+ export declare const serviceType: z.ZodEnum<{
25
+ database: "database";
26
+ "web-service": "web-service";
27
+ static: "static";
28
+ mcp: "mcp";
29
+ liscense: "liscense";
30
+ worker: "worker";
31
+ }>;
32
+ export type ServiceType = z.infer<typeof serviceType>;
33
+ /** Docker verbs the runner will execute for `process:cmd` (mantis allowedDockerCommands). */
34
+ export declare const dockerCommand: z.ZodEnum<{
35
+ start: "start";
36
+ stop: "stop";
37
+ restart: "restart";
38
+ pause: "pause";
39
+ unpause: "unpause";
40
+ kill: "kill";
41
+ }>;
42
+ export type DockerCommand = z.infer<typeof dockerCommand>;
43
+ /** Mirrors mantis StaleTempCleanupMode. */
44
+ export declare const staleTempMode: z.ZodEnum<{
45
+ "dry-run": "dry-run";
46
+ on: "on";
47
+ }>;
48
+ export type StaleTempMode = z.infer<typeof staleTempMode>;
49
+ /** Mirrors core PrivateDependencyProblemReason. */
50
+ export declare const privateDependencyReason: z.ZodEnum<{
51
+ denied: "denied";
52
+ dns: "dns";
53
+ refused: "refused";
54
+ unreachable: "unreachable";
55
+ }>;
56
+ export type PrivateDependencyReason = z.infer<typeof privateDependencyReason>;
57
+ /** Mirrors runner ServiceStateAction (service:state). */
58
+ export declare const serviceStateAction: z.ZodEnum<{
59
+ stopped: "stopped";
60
+ resumed: "resumed";
61
+ }>;
62
+ export type ServiceStateAction = z.infer<typeof serviceStateAction>;
63
+ /** Mirrors runner ServiceRuntime (service:state). */
64
+ export declare const serviceRuntime: z.ZodEnum<{
65
+ nomad: "nomad";
66
+ temp: "temp";
67
+ }>;
68
+ export type ServiceRuntime = z.infer<typeof serviceRuntime>;
69
+ /** The `event` discriminator the runner puts on a `deploy:status` message. */
70
+ export declare const deployStatusEvent: z.ZodEnum<{
71
+ deploy: "deploy";
72
+ "deploy-error": "deploy-error";
73
+ }>;
74
+ export type DeployStatusEvent = z.infer<typeof deployStatusEvent>;
75
+ /** The project status the runner reports on a `deploy:status` message; the dashboard shows it as is. */
76
+ export declare const deployStatusValue: z.ZodEnum<{
77
+ ACTIVE: "ACTIVE";
78
+ FAILED: "FAILED";
79
+ }>;
80
+ export type DeployStatusValue = z.infer<typeof deployStatusValue>;
81
+ /** Outcome tag on a `deploy:notify` message. */
82
+ export declare const deployNotifyType: z.ZodEnum<{
83
+ success: "success";
84
+ failure: "failure";
85
+ }>;
86
+ export type DeployNotifyType = z.infer<typeof deployNotifyType>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deployNotifyType = exports.deployStatusValue = exports.deployStatusEvent = exports.serviceRuntime = exports.serviceStateAction = exports.privateDependencyReason = exports.staleTempMode = exports.dockerCommand = exports.serviceType = exports.planType = exports.gitType = void 0;
4
+ const zod_1 = require("zod");
5
+ /** Mirrors @brimble/models GIT_TYPE. */
6
+ exports.gitType = zod_1.z.enum(['GITHUB', 'GITLAB', 'BITBUCKET', 'DOCKER', 'HUGGINGFACE', 'ORIGIN']);
7
+ /** Mirrors @brimble/models SUBSCRIPTION_PLAN_TYPE. */
8
+ exports.planType = zod_1.z.enum(['FREE_PLAN', 'DEVELOPER_PLAN', 'TEAM_PLAN', 'DOMAIN_PLAN', 'HACKER_PLAN', 'LISCENSE_PLAN', 'EMAIL_FORWARDING_PLAN']);
9
+ /** Mirrors @brimble/models ServiceType. */
10
+ exports.serviceType = zod_1.z.enum(['database', 'web-service', 'static', 'mcp', 'liscense', 'worker']);
11
+ /** Docker verbs the runner will execute for `process:cmd` (mantis allowedDockerCommands). */
12
+ exports.dockerCommand = zod_1.z.enum(['start', 'stop', 'restart', 'pause', 'unpause', 'kill']);
13
+ /** Mirrors mantis StaleTempCleanupMode. */
14
+ exports.staleTempMode = zod_1.z.enum(['dry-run', 'on']);
15
+ /** Mirrors core PrivateDependencyProblemReason. */
16
+ exports.privateDependencyReason = zod_1.z.enum(['denied', 'dns', 'refused', 'unreachable']);
17
+ /** Mirrors runner ServiceStateAction (service:state). */
18
+ exports.serviceStateAction = zod_1.z.enum(['stopped', 'resumed']);
19
+ /** Mirrors runner ServiceRuntime (service:state). */
20
+ exports.serviceRuntime = zod_1.z.enum(['nomad', 'temp']);
21
+ /** The `event` discriminator the runner puts on a `deploy:status` message. */
22
+ exports.deployStatusEvent = zod_1.z.enum(['deploy', 'deploy-error']);
23
+ /** The project status the runner reports on a `deploy:status` message; the dashboard shows it as is. */
24
+ exports.deployStatusValue = zod_1.z.enum(['ACTIVE', 'FAILED']);
25
+ /** Outcome tag on a `deploy:notify` message. */
26
+ exports.deployNotifyType = zod_1.z.enum(['success', 'failure']);
@@ -0,0 +1,27 @@
1
+ /** Events core emits to the runner (mantis). Mirrors mantis `QueueEvents`. */
2
+ export declare const RunnerInboundEvent: {
3
+ readonly Clone: "clone";
4
+ readonly ClonePublicRepo: "clone:public:repo";
5
+ readonly ProcessCancel: "process:cancel";
6
+ readonly ProcessCmd: "process:cmd";
7
+ readonly KillContainer: "container:kill";
8
+ readonly StopContainer: "container:stop";
9
+ readonly StartContainer: "container:start";
10
+ readonly DeleteHubContainer: "container:hub:delete";
11
+ readonly StaleTempCleanup: "container:cleanup";
12
+ readonly StaleTempSnapshot: "container:cleanup:snapshot";
13
+ readonly DatabaseVolumeDelete: "database-volume:delete";
14
+ readonly ProxyClearCache: "proxy:clear:cache";
15
+ };
16
+ export type RunnerInboundEvent = (typeof RunnerInboundEvent)[keyof typeof RunnerInboundEvent];
17
+ /** Events the runner emits back to core. */
18
+ export declare const RunnerOutboundEvent: {
19
+ readonly DeployCompleted: "deploy:completed";
20
+ readonly DeploySave: "deploy:save";
21
+ readonly DeployNotify: "deploy:notify";
22
+ readonly DeployStatus: "deploy:status";
23
+ readonly DeployStarted: "deploy:started";
24
+ readonly Screenshot: "screenshot";
25
+ readonly ServiceState: "service:state";
26
+ };
27
+ export type RunnerOutboundEvent = (typeof RunnerOutboundEvent)[keyof typeof RunnerOutboundEvent];
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RunnerOutboundEvent = exports.RunnerInboundEvent = void 0;
4
+ /** Events core emits to the runner (mantis). Mirrors mantis `QueueEvents`. */
5
+ exports.RunnerInboundEvent = {
6
+ Clone: 'clone',
7
+ ClonePublicRepo: 'clone:public:repo',
8
+ ProcessCancel: 'process:cancel',
9
+ ProcessCmd: 'process:cmd',
10
+ KillContainer: 'container:kill',
11
+ StopContainer: 'container:stop',
12
+ StartContainer: 'container:start',
13
+ DeleteHubContainer: 'container:hub:delete',
14
+ StaleTempCleanup: 'container:cleanup',
15
+ StaleTempSnapshot: 'container:cleanup:snapshot',
16
+ DatabaseVolumeDelete: 'database-volume:delete',
17
+ ProxyClearCache: 'proxy:clear:cache',
18
+ };
19
+ /** Events the runner emits back to core. */
20
+ exports.RunnerOutboundEvent = {
21
+ DeployCompleted: 'deploy:completed',
22
+ DeploySave: 'deploy:save',
23
+ DeployNotify: 'deploy:notify',
24
+ DeployStatus: 'deploy:status',
25
+ DeployStarted: 'deploy:started',
26
+ Screenshot: 'screenshot',
27
+ ServiceState: 'service:state',
28
+ };
@@ -0,0 +1,6 @@
1
+ import { MessageContract } from '../envelope';
2
+ /** core -> runner: event name to the schema its `data` must satisfy. */
3
+ export declare const runnerInboundContract: MessageContract;
4
+ /** runner -> core. */
5
+ export declare const runnerOutboundContract: MessageContract;
6
+ export * from './events';