@brimble/contracts 0.0.0-stage → 0.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.
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ /** A stringified mongo ObjectId (24 hex chars). */
3
+ export declare const objectId: z.ZodString;
4
+ /** An IPv4 or IPv6 address. */
5
+ export declare const ipAddress: z.ZodUnion<readonly [z.ZodIPv4, z.ZodIPv6]>;
6
+ /** An IPv4/IPv6 address or CIDR range (e.g. 10.0.0.0/8, 0.0.0.0/0). */
7
+ export declare const ipOrCidr: z.ZodUnion<readonly [z.ZodIPv4, z.ZodIPv6, z.ZodCIDRv4, z.ZodCIDRv6]>;
8
+ /** A TCP/UDP port. */
9
+ export declare const port: z.ZodNumber;
10
+ /** A fully-qualified domain name, optionally a wildcard (`*.example.com`). Accepts punycode labels. */
11
+ export declare const domainName: z.ZodString;
12
+ /** An http(s) URL. */
13
+ export declare const httpUrl: z.ZodURL;
14
+ /** A git remote: an http(s)/ssh URL or scp-style `git@host:org/repo(.git)`. */
15
+ export declare const gitRemoteUrl: z.ZodString;
16
+ /** A git commit sha (short or full, hex). */
17
+ export declare const commitSha: z.ZodString;
18
+ /** An HTTP redirect status. */
19
+ export declare const redirectStatus: z.ZodUnion<readonly [z.ZodLiteral<301>, z.ZodLiteral<302>, z.ZodLiteral<307>, z.ZodLiteral<308>]>;
20
+ export declare const nonEmptyString: z.ZodString;
package/dist/common.js ADDED
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nonEmptyString = exports.redirectStatus = exports.commitSha = exports.gitRemoteUrl = exports.httpUrl = exports.domainName = exports.port = exports.ipOrCidr = exports.ipAddress = exports.objectId = void 0;
4
+ const zod_1 = require("zod");
5
+ /** A stringified mongo ObjectId (24 hex chars). */
6
+ exports.objectId = zod_1.z.string().regex(/^[a-fA-F0-9]{24}$/, 'must be a 24-character hex ObjectId');
7
+ /** An IPv4 or IPv6 address. */
8
+ exports.ipAddress = zod_1.z.union([zod_1.z.ipv4(), zod_1.z.ipv6()]);
9
+ /** An IPv4/IPv6 address or CIDR range (e.g. 10.0.0.0/8, 0.0.0.0/0). */
10
+ exports.ipOrCidr = zod_1.z.union([zod_1.z.ipv4(), zod_1.z.ipv6(), zod_1.z.cidrv4(), zod_1.z.cidrv6()]);
11
+ /** A TCP/UDP port. */
12
+ exports.port = zod_1.z.number().int().min(1).max(65535);
13
+ /** A fully-qualified domain name, optionally a wildcard (`*.example.com`). Accepts punycode labels. */
14
+ exports.domainName = zod_1.z
15
+ .string()
16
+ .min(1)
17
+ .max(253)
18
+ .regex(/^(\*\.)?([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/i, 'must be a valid domain name');
19
+ /** An http(s) URL. */
20
+ exports.httpUrl = zod_1.z.url();
21
+ /** A git remote: an http(s)/ssh URL or scp-style `git@host:org/repo(.git)`. */
22
+ exports.gitRemoteUrl = zod_1.z
23
+ .string()
24
+ .max(2048)
25
+ .refine((value) => /^git@[\w.-]+:[\w./-]+?(?:\.git)?$/.test(value) || /^(https?|ssh):\/\/[^\s]+$/.test(value), 'must be a valid git remote URL');
26
+ /** A git commit sha (short or full, hex). */
27
+ exports.commitSha = zod_1.z.string().regex(/^[a-f0-9]{7,64}$/i, 'must be a hex commit sha');
28
+ /** An HTTP redirect status. */
29
+ exports.redirectStatus = zod_1.z.union([zod_1.z.literal(301), zod_1.z.literal(302), zod_1.z.literal(307), zod_1.z.literal(308)]);
30
+ exports.nonEmptyString = zod_1.z.string().min(1);
@@ -0,0 +1,7 @@
1
+ /** Events core emits to the DNS/edge service (APP.DNS). */
2
+ export declare const DnsInboundEvent: {
3
+ readonly DomainMap: "domain:map";
4
+ readonly DomainUnmap: "domain:unmap";
5
+ readonly ProjectRatelimitSync: "project:ratelimit:sync";
6
+ };
7
+ export type DnsInboundEvent = (typeof DnsInboundEvent)[keyof typeof DnsInboundEvent];
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DnsInboundEvent = void 0;
4
+ /** Events core emits to the DNS/edge service (APP.DNS). */
5
+ exports.DnsInboundEvent = {
6
+ DomainMap: 'domain:map',
7
+ DomainUnmap: 'domain:unmap',
8
+ ProjectRatelimitSync: 'project:ratelimit:sync',
9
+ };
@@ -0,0 +1,4 @@
1
+ import { MessageContract } from '../envelope';
2
+ /** core -> dns/edge service: event name to the schema its `data` must satisfy. */
3
+ export declare const dnsInboundContract: MessageContract;
4
+ export * from './events';
@@ -0,0 +1,26 @@
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
+ exports.dnsInboundContract = void 0;
18
+ const events_1 = require("./events");
19
+ const schemas_1 = require("./schemas");
20
+ /** core -> dns/edge service: event name to the schema its `data` must satisfy. */
21
+ exports.dnsInboundContract = {
22
+ [events_1.DnsInboundEvent.DomainMap]: schemas_1.domainMapSchema,
23
+ [events_1.DnsInboundEvent.DomainUnmap]: schemas_1.domainUnmapSchema,
24
+ [events_1.DnsInboundEvent.ProjectRatelimitSync]: schemas_1.projectRatelimitSyncSchema,
25
+ };
26
+ __exportStar(require("./events"), exports);
@@ -0,0 +1,141 @@
1
+ import { z } from 'zod';
2
+ /** One rate-limit zone (mirrors @brimble/models RateLimitZone). */
3
+ export declare const rateLimitZoneSchema: z.ZodObject<{
4
+ name: z.ZodString;
5
+ key: z.ZodString;
6
+ window: z.ZodString;
7
+ events: z.ZodNumber;
8
+ matcher: z.ZodOptional<z.ZodObject<{
9
+ methods: z.ZodOptional<z.ZodArray<z.ZodString>>;
10
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
11
+ }, z.core.$strip>>;
12
+ ipv4Prefix: z.ZodOptional<z.ZodNumber>;
13
+ ipv6Prefix: z.ZodOptional<z.ZodNumber>;
14
+ }, z.core.$strip>;
15
+ /** Distributed rate-limit coordination (mirrors @brimble/models DistributedRateLimitConfig). */
16
+ export declare const distributedRateLimitSchema: z.ZodObject<{
17
+ enabled: z.ZodBoolean;
18
+ readInterval: z.ZodOptional<z.ZodString>;
19
+ writeInterval: z.ZodOptional<z.ZodString>;
20
+ purgeAge: z.ZodOptional<z.ZodString>;
21
+ }, z.core.$strip>;
22
+ /** Full rate-limit config (mirrors @brimble/models RatelimitConfig). */
23
+ export declare const ratelimitConfigSchema: z.ZodObject<{
24
+ enabled: z.ZodBoolean;
25
+ zones: z.ZodArray<z.ZodObject<{
26
+ name: z.ZodString;
27
+ key: z.ZodString;
28
+ window: z.ZodString;
29
+ events: z.ZodNumber;
30
+ matcher: z.ZodOptional<z.ZodObject<{
31
+ methods: z.ZodOptional<z.ZodArray<z.ZodString>>;
32
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
33
+ }, z.core.$strip>>;
34
+ ipv4Prefix: z.ZodOptional<z.ZodNumber>;
35
+ ipv6Prefix: z.ZodOptional<z.ZodNumber>;
36
+ }, z.core.$strip>>;
37
+ distributed: z.ZodOptional<z.ZodObject<{
38
+ enabled: z.ZodBoolean;
39
+ readInterval: z.ZodOptional<z.ZodString>;
40
+ writeInterval: z.ZodOptional<z.ZodString>;
41
+ purgeAge: z.ZodOptional<z.ZodString>;
42
+ }, z.core.$strip>>;
43
+ logKey: z.ZodOptional<z.ZodBoolean>;
44
+ disableMetrics: z.ZodOptional<z.ZodBoolean>;
45
+ jitter: z.ZodOptional<z.ZodNumber>;
46
+ sweepInterval: z.ZodOptional<z.ZodString>;
47
+ }, z.core.$strip>;
48
+ /**
49
+ * `domain:map` — map/update a domain's routing in the DNS/edge layer.
50
+ * Superset of what core emits and what dns reads (dns MapDomain); `domain` is the
51
+ * only guaranteed field, everything else is situational.
52
+ */
53
+ export declare const domainMapSchema: z.ZodObject<{
54
+ domain: z.ZodString;
55
+ domainId: z.ZodOptional<z.ZodString>;
56
+ projectId: z.ZodOptional<z.ZodString>;
57
+ ip: z.ZodOptional<z.ZodUnion<readonly [z.ZodIPv4, z.ZodIPv6]>>;
58
+ port: z.ZodOptional<z.ZodNumber>;
59
+ redirect: z.ZodOptional<z.ZodObject<{
60
+ url: z.ZodURL;
61
+ status: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<301>, z.ZodLiteral<302>, z.ZodLiteral<307>, z.ZodLiteral<308>]>>;
62
+ }, z.core.$loose>>;
63
+ wildcard: z.ZodOptional<z.ZodBoolean>;
64
+ proxy: z.ZodOptional<z.ZodBoolean>;
65
+ maintenance: z.ZodOptional<z.ZodString>;
66
+ isStatic: z.ZodOptional<z.ZodBoolean>;
67
+ type: z.ZodOptional<z.ZodString>;
68
+ allowed_ips: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodIPv4, z.ZodIPv6, z.ZodCIDRv4, z.ZodCIDRv6]>>>;
69
+ isDNS: z.ZodOptional<z.ZodBoolean>;
70
+ isGrpc: z.ZodOptional<z.ZodBoolean>;
71
+ withConsul: z.ZodOptional<z.ZodBoolean>;
72
+ logRetention: z.ZodOptional<z.ZodNumber>;
73
+ rateLimit: z.ZodOptional<z.ZodObject<{
74
+ enabled: z.ZodBoolean;
75
+ zones: z.ZodArray<z.ZodObject<{
76
+ name: z.ZodString;
77
+ key: z.ZodString;
78
+ window: z.ZodString;
79
+ events: z.ZodNumber;
80
+ matcher: z.ZodOptional<z.ZodObject<{
81
+ methods: z.ZodOptional<z.ZodArray<z.ZodString>>;
82
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
83
+ }, z.core.$strip>>;
84
+ ipv4Prefix: z.ZodOptional<z.ZodNumber>;
85
+ ipv6Prefix: z.ZodOptional<z.ZodNumber>;
86
+ }, z.core.$strip>>;
87
+ distributed: z.ZodOptional<z.ZodObject<{
88
+ enabled: z.ZodBoolean;
89
+ readInterval: z.ZodOptional<z.ZodString>;
90
+ writeInterval: z.ZodOptional<z.ZodString>;
91
+ purgeAge: z.ZodOptional<z.ZodString>;
92
+ }, z.core.$strip>>;
93
+ logKey: z.ZodOptional<z.ZodBoolean>;
94
+ disableMetrics: z.ZodOptional<z.ZodBoolean>;
95
+ jitter: z.ZodOptional<z.ZodNumber>;
96
+ sweepInterval: z.ZodOptional<z.ZodString>;
97
+ }, z.core.$strip>>;
98
+ }, z.core.$strip>;
99
+ /** `domain:unmap` — remove a domain's routing. */
100
+ export declare const domainUnmapSchema: z.ZodObject<{
101
+ domain: z.ZodString;
102
+ }, z.core.$strip>;
103
+ /**
104
+ * `project:ratelimit:sync` — re-push a project's rate-limit config to the edge.
105
+ * Core emits only `{ project }`; the dns consumer also accepts `projectId`/`domain`/`rateLimit`.
106
+ */
107
+ export declare const projectRatelimitSyncSchema: z.ZodObject<{
108
+ project: z.ZodOptional<z.ZodString>;
109
+ projectId: z.ZodOptional<z.ZodString>;
110
+ domain: z.ZodOptional<z.ZodString>;
111
+ rateLimit: z.ZodOptional<z.ZodObject<{
112
+ enabled: z.ZodBoolean;
113
+ zones: z.ZodArray<z.ZodObject<{
114
+ name: z.ZodString;
115
+ key: z.ZodString;
116
+ window: z.ZodString;
117
+ events: z.ZodNumber;
118
+ matcher: z.ZodOptional<z.ZodObject<{
119
+ methods: z.ZodOptional<z.ZodArray<z.ZodString>>;
120
+ paths: z.ZodOptional<z.ZodArray<z.ZodString>>;
121
+ }, z.core.$strip>>;
122
+ ipv4Prefix: z.ZodOptional<z.ZodNumber>;
123
+ ipv6Prefix: z.ZodOptional<z.ZodNumber>;
124
+ }, z.core.$strip>>;
125
+ distributed: z.ZodOptional<z.ZodObject<{
126
+ enabled: z.ZodBoolean;
127
+ readInterval: z.ZodOptional<z.ZodString>;
128
+ writeInterval: z.ZodOptional<z.ZodString>;
129
+ purgeAge: z.ZodOptional<z.ZodString>;
130
+ }, z.core.$strip>>;
131
+ logKey: z.ZodOptional<z.ZodBoolean>;
132
+ disableMetrics: z.ZodOptional<z.ZodBoolean>;
133
+ jitter: z.ZodOptional<z.ZodNumber>;
134
+ sweepInterval: z.ZodOptional<z.ZodString>;
135
+ }, z.core.$strip>>;
136
+ }, z.core.$strip>;
137
+ export type RateLimitZone = z.infer<typeof rateLimitZoneSchema>;
138
+ export type RatelimitConfig = z.infer<typeof ratelimitConfigSchema>;
139
+ export type DomainMapPayload = z.infer<typeof domainMapSchema>;
140
+ export type DomainUnmapPayload = z.infer<typeof domainUnmapSchema>;
141
+ export type ProjectRatelimitSyncPayload = z.infer<typeof projectRatelimitSyncSchema>;
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.projectRatelimitSyncSchema = exports.domainUnmapSchema = exports.domainMapSchema = exports.ratelimitConfigSchema = exports.distributedRateLimitSchema = exports.rateLimitZoneSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const common_1 = require("../common");
6
+ /** One rate-limit zone (mirrors @brimble/models RateLimitZone). */
7
+ exports.rateLimitZoneSchema = zod_1.z.object({
8
+ name: common_1.nonEmptyString,
9
+ key: common_1.nonEmptyString,
10
+ window: common_1.nonEmptyString,
11
+ events: zod_1.z.number().int().nonnegative(),
12
+ matcher: zod_1.z
13
+ .object({
14
+ methods: zod_1.z.array(common_1.nonEmptyString).optional(),
15
+ paths: zod_1.z.array(common_1.nonEmptyString).optional(),
16
+ })
17
+ .optional(),
18
+ ipv4Prefix: zod_1.z.number().int().min(0).max(32).optional(),
19
+ ipv6Prefix: zod_1.z.number().int().min(0).max(128).optional(),
20
+ });
21
+ /** Distributed rate-limit coordination (mirrors @brimble/models DistributedRateLimitConfig). */
22
+ exports.distributedRateLimitSchema = zod_1.z.object({
23
+ enabled: zod_1.z.boolean(),
24
+ readInterval: common_1.nonEmptyString.optional(),
25
+ writeInterval: common_1.nonEmptyString.optional(),
26
+ purgeAge: common_1.nonEmptyString.optional(),
27
+ });
28
+ /** Full rate-limit config (mirrors @brimble/models RatelimitConfig). */
29
+ exports.ratelimitConfigSchema = zod_1.z.object({
30
+ enabled: zod_1.z.boolean(),
31
+ zones: zod_1.z.array(exports.rateLimitZoneSchema),
32
+ distributed: exports.distributedRateLimitSchema.optional(),
33
+ logKey: zod_1.z.boolean().optional(),
34
+ disableMetrics: zod_1.z.boolean().optional(),
35
+ jitter: zod_1.z.number().optional(),
36
+ sweepInterval: common_1.nonEmptyString.optional(),
37
+ });
38
+ const redirectSchema = zod_1.z
39
+ .object({
40
+ url: common_1.httpUrl,
41
+ status: common_1.redirectStatus.optional(),
42
+ })
43
+ .loose();
44
+ /**
45
+ * `domain:map` — map/update a domain's routing in the DNS/edge layer.
46
+ * Superset of what core emits and what dns reads (dns MapDomain); `domain` is the
47
+ * only guaranteed field, everything else is situational.
48
+ */
49
+ exports.domainMapSchema = zod_1.z.object({
50
+ domain: common_1.domainName,
51
+ domainId: common_1.objectId.optional(),
52
+ projectId: common_1.objectId.optional(),
53
+ ip: common_1.ipAddress.optional(),
54
+ port: common_1.port.optional(),
55
+ redirect: redirectSchema.optional(),
56
+ wildcard: zod_1.z.boolean().optional(),
57
+ proxy: zod_1.z.boolean().optional(),
58
+ maintenance: zod_1.z.string().min(1).optional(),
59
+ isStatic: zod_1.z.boolean().optional(),
60
+ type: zod_1.z.string().min(1).optional(),
61
+ allowed_ips: zod_1.z.array(common_1.ipOrCidr).optional(),
62
+ isDNS: zod_1.z.boolean().optional(),
63
+ isGrpc: zod_1.z.boolean().optional(),
64
+ withConsul: zod_1.z.boolean().optional(),
65
+ logRetention: zod_1.z.number().int().nonnegative().optional(),
66
+ rateLimit: exports.ratelimitConfigSchema.optional(),
67
+ });
68
+ /** `domain:unmap` — remove a domain's routing. */
69
+ exports.domainUnmapSchema = zod_1.z.object({
70
+ domain: common_1.domainName,
71
+ });
72
+ /**
73
+ * `project:ratelimit:sync` — re-push a project's rate-limit config to the edge.
74
+ * Core emits only `{ project }`; the dns consumer also accepts `projectId`/`domain`/`rateLimit`.
75
+ */
76
+ exports.projectRatelimitSyncSchema = zod_1.z
77
+ .object({
78
+ project: common_1.objectId.optional(),
79
+ projectId: common_1.objectId.optional(),
80
+ domain: common_1.domainName.optional(),
81
+ rateLimit: exports.ratelimitConfigSchema.optional(),
82
+ })
83
+ .refine((value) => Boolean(value.project || value.projectId), { message: 'project or projectId is required' });
@@ -0,0 +1,109 @@
1
+ import { z } from 'zod';
2
+ /** Mirrors core EmailEvent. The transactional email each `email` message renders. */
3
+ export declare const emailEvent: z.ZodEnum<{
4
+ "team-invite": "team-invite";
5
+ "workspace-removed": "workspace-removed";
6
+ "team-role-updated": "team-role-updated";
7
+ "team-2fa-required": "team-2fa-required";
8
+ "ownership-transfer-requested": "ownership-transfer-requested";
9
+ "ownership-transfer-completed": "ownership-transfer-completed";
10
+ "ownership-transfer-denied": "ownership-transfer-denied";
11
+ "api-key-created": "api-key-created";
12
+ "database-password-changed": "database-password-changed";
13
+ "support-acknowledged": "support-acknowledged";
14
+ "support-resolved": "support-resolved";
15
+ "subscription-unpaid": "subscription-unpaid";
16
+ "subscription-reactivated": "subscription-reactivated";
17
+ "deletion-scheduled": "deletion-scheduled";
18
+ "excess-projects-destroyed": "excess-projects-destroyed";
19
+ "build-minutes-exhausted": "build-minutes-exhausted";
20
+ "license-key": "license-key";
21
+ "domain-purchased": "domain-purchased";
22
+ "domain-auto-renew-card-needed": "domain-auto-renew-card-needed";
23
+ "domain-auto-renew-disabled": "domain-auto-renew-disabled";
24
+ "domain-expiry": "domain-expiry";
25
+ "free-database-trial-started": "free-database-trial-started";
26
+ "free-database-trial-expiring": "free-database-trial-expiring";
27
+ "free-database-trial-deleted": "free-database-trial-deleted";
28
+ "deployment-finished": "deployment-finished";
29
+ "service-state-changed": "service-state-changed";
30
+ "project-deleted": "project-deleted";
31
+ "clone-capacity-failed": "clone-capacity-failed";
32
+ "repo-ready": "repo-ready";
33
+ "database-provisioned": "database-provisioned";
34
+ "database-scaled": "database-scaled";
35
+ "database-ssl-enabled": "database-ssl-enabled";
36
+ "database-ssl-failed": "database-ssl-failed";
37
+ "database-backup-reminder": "database-backup-reminder";
38
+ "database-backup-failing": "database-backup-failing";
39
+ "database-backup-recovered": "database-backup-recovered";
40
+ "database-storage-almost-full": "database-storage-almost-full";
41
+ "database-weekly-report": "database-weekly-report";
42
+ "server-ready": "server-ready";
43
+ "storage-migration-finished": "storage-migration-finished";
44
+ "email-forwarding-test": "email-forwarding-test";
45
+ "gateway-dns-action": "gateway-dns-action";
46
+ "domain-limit-exceeded": "domain-limit-exceeded";
47
+ "alert-state-changed": "alert-state-changed";
48
+ "alert-evaluation-failed": "alert-evaluation-failed";
49
+ "log-drain-health": "log-drain-health";
50
+ "streak-milestone": "streak-milestone";
51
+ "streak-ended": "streak-ended";
52
+ "quest-reward-claimed": "quest-reward-claimed";
53
+ "quest-reward-issued": "quest-reward-issued";
54
+ "domain-coupon-unlocked": "domain-coupon-unlocked";
55
+ "runner-health": "runner-health";
56
+ }>;
57
+ export type EmailEvent = z.infer<typeof emailEvent>;
58
+ /** Mirrors brimble-email EmailProvider. */
59
+ export declare const emailProvider: z.ZodEnum<{
60
+ resend: "resend";
61
+ sendbyte: "sendbyte";
62
+ }>;
63
+ export type EmailProvider = z.infer<typeof emailProvider>;
64
+ /** Mirrors brimble-email WebhookPlatform. */
65
+ export declare const webhookPlatform: z.ZodEnum<{
66
+ discord: "discord";
67
+ slack: "slack";
68
+ webhook: "webhook";
69
+ }>;
70
+ export type WebhookPlatform = z.infer<typeof webhookPlatform>;
71
+ /** Mirrors brimble-email webhookEventSchema / WebhookEvent — the business event a `webhook` message carries. */
72
+ export declare const webhookEvent: z.ZodEnum<{
73
+ "deployment.started": "deployment.started";
74
+ "deployment.success": "deployment.success";
75
+ "deployment.failed": "deployment.failed";
76
+ "alert.firing": "alert.firing";
77
+ "alert.resolved": "alert.resolved";
78
+ "project.created": "project.created";
79
+ "project.deleted": "project.deleted";
80
+ "project.updated": "project.updated";
81
+ "domain.created": "domain.created";
82
+ "domain.purchased": "domain.purchased";
83
+ "domain.renewed": "domain.renewed";
84
+ "project.domain.updated": "project.domain.updated";
85
+ "autoscaling.group.created": "autoscaling.group.created";
86
+ "autoscaling.group.updated": "autoscaling.group.updated";
87
+ "autoscaling.group.deleted": "autoscaling.group.deleted";
88
+ "environment.variables.added": "environment.variables.added";
89
+ "environment.variables.updated": "environment.variables.updated";
90
+ "environment.variables.deleted": "environment.variables.deleted";
91
+ "dns.record.created": "dns.record.created";
92
+ "dns.record.updated": "dns.record.updated";
93
+ "dns.record.deleted": "dns.record.deleted";
94
+ "payment.successful": "payment.successful";
95
+ "payment.failed": "payment.failed";
96
+ "subscription.created": "subscription.created";
97
+ "subscription.renewed": "subscription.renewed";
98
+ "subscription.renewal_failed": "subscription.renewal_failed";
99
+ "subscription.canceled": "subscription.canceled";
100
+ "subscription.past_due": "subscription.past_due";
101
+ "subscription.unpaid": "subscription.unpaid";
102
+ "subscription.paused": "subscription.paused";
103
+ "subscription.reactivated": "subscription.reactivated";
104
+ "subscription.incomplete_expired": "subscription.incomplete_expired";
105
+ "subscription.suspended": "subscription.suspended";
106
+ "subscription.upgraded": "subscription.upgraded";
107
+ "subscription.downgraded": "subscription.downgraded";
108
+ }>;
109
+ export type WebhookEvent = z.infer<typeof webhookEvent>;
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.webhookEvent = exports.webhookPlatform = exports.emailProvider = exports.emailEvent = void 0;
4
+ const zod_1 = require("zod");
5
+ /** Mirrors core EmailEvent. The transactional email each `email` message renders. */
6
+ exports.emailEvent = zod_1.z.enum([
7
+ 'team-invite',
8
+ 'workspace-removed',
9
+ 'team-role-updated',
10
+ 'team-2fa-required',
11
+ 'ownership-transfer-requested',
12
+ 'ownership-transfer-completed',
13
+ 'ownership-transfer-denied',
14
+ 'api-key-created',
15
+ 'database-password-changed',
16
+ 'support-acknowledged',
17
+ 'support-resolved',
18
+ 'subscription-unpaid',
19
+ 'subscription-reactivated',
20
+ 'deletion-scheduled',
21
+ 'excess-projects-destroyed',
22
+ 'build-minutes-exhausted',
23
+ 'license-key',
24
+ 'domain-purchased',
25
+ 'domain-auto-renew-card-needed',
26
+ 'domain-auto-renew-disabled',
27
+ 'domain-expiry',
28
+ 'free-database-trial-started',
29
+ 'free-database-trial-expiring',
30
+ 'free-database-trial-deleted',
31
+ 'deployment-finished',
32
+ 'service-state-changed',
33
+ 'project-deleted',
34
+ 'clone-capacity-failed',
35
+ 'repo-ready',
36
+ 'database-provisioned',
37
+ 'database-scaled',
38
+ 'database-ssl-enabled',
39
+ 'database-ssl-failed',
40
+ 'database-backup-reminder',
41
+ 'database-backup-failing',
42
+ 'database-backup-recovered',
43
+ 'database-storage-almost-full',
44
+ 'database-weekly-report',
45
+ 'server-ready',
46
+ 'storage-migration-finished',
47
+ 'email-forwarding-test',
48
+ 'gateway-dns-action',
49
+ 'domain-limit-exceeded',
50
+ 'alert-state-changed',
51
+ 'alert-evaluation-failed',
52
+ 'log-drain-health',
53
+ 'streak-milestone',
54
+ 'streak-ended',
55
+ 'quest-reward-claimed',
56
+ 'quest-reward-issued',
57
+ 'domain-coupon-unlocked',
58
+ 'runner-health',
59
+ ]);
60
+ /** Mirrors brimble-email EmailProvider. */
61
+ exports.emailProvider = zod_1.z.enum(['resend', 'sendbyte']);
62
+ /** Mirrors brimble-email WebhookPlatform. */
63
+ exports.webhookPlatform = zod_1.z.enum(['slack', 'discord', 'webhook']);
64
+ /** Mirrors brimble-email webhookEventSchema / WebhookEvent — the business event a `webhook` message carries. */
65
+ exports.webhookEvent = zod_1.z.enum([
66
+ 'deployment.started',
67
+ 'deployment.success',
68
+ 'deployment.failed',
69
+ 'alert.firing',
70
+ 'alert.resolved',
71
+ 'project.created',
72
+ 'project.deleted',
73
+ 'project.updated',
74
+ 'domain.created',
75
+ 'domain.purchased',
76
+ 'domain.renewed',
77
+ 'project.domain.updated',
78
+ 'autoscaling.group.created',
79
+ 'autoscaling.group.updated',
80
+ 'autoscaling.group.deleted',
81
+ 'environment.variables.added',
82
+ 'environment.variables.updated',
83
+ 'environment.variables.deleted',
84
+ 'dns.record.created',
85
+ 'dns.record.updated',
86
+ 'dns.record.deleted',
87
+ 'payment.successful',
88
+ 'payment.failed',
89
+ 'subscription.created',
90
+ 'subscription.renewed',
91
+ 'subscription.renewal_failed',
92
+ 'subscription.canceled',
93
+ 'subscription.past_due',
94
+ 'subscription.unpaid',
95
+ 'subscription.paused',
96
+ 'subscription.reactivated',
97
+ 'subscription.incomplete_expired',
98
+ 'subscription.suspended',
99
+ 'subscription.upgraded',
100
+ 'subscription.downgraded',
101
+ ]);
@@ -0,0 +1,9 @@
1
+ /** Events core emits to the email/messaging service (APP.MESSAGING). Mirrors brimble-email MessageType. */
2
+ export declare const EmailInboundEvent: {
3
+ readonly Email: "email";
4
+ readonly Discord: "discord";
5
+ readonly Slack: "slack";
6
+ readonly Webhook: "webhook";
7
+ readonly Changelog: "changelog";
8
+ };
9
+ export type EmailInboundEvent = (typeof EmailInboundEvent)[keyof typeof EmailInboundEvent];
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EmailInboundEvent = void 0;
4
+ /** Events core emits to the email/messaging service (APP.MESSAGING). Mirrors brimble-email MessageType. */
5
+ exports.EmailInboundEvent = {
6
+ Email: 'email',
7
+ Discord: 'discord',
8
+ Slack: 'slack',
9
+ Webhook: 'webhook',
10
+ Changelog: 'changelog',
11
+ };
@@ -0,0 +1,4 @@
1
+ import { MessageContract } from '../envelope';
2
+ /** core -> email/messaging service: event name to the schema its `data` must satisfy. */
3
+ export declare const emailInboundContract: MessageContract;
4
+ export * from './events';
@@ -0,0 +1,28 @@
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
+ exports.emailInboundContract = void 0;
18
+ const events_1 = require("./events");
19
+ const schemas_1 = require("./schemas");
20
+ /** core -> email/messaging service: event name to the schema its `data` must satisfy. */
21
+ exports.emailInboundContract = {
22
+ [events_1.EmailInboundEvent.Email]: schemas_1.sendMailSchema,
23
+ [events_1.EmailInboundEvent.Discord]: schemas_1.discordDispatchSchema,
24
+ [events_1.EmailInboundEvent.Slack]: schemas_1.slackDispatchSchema,
25
+ [events_1.EmailInboundEvent.Webhook]: schemas_1.webhookDispatchSchema,
26
+ [events_1.EmailInboundEvent.Changelog]: schemas_1.changelogEventSchema,
27
+ };
28
+ __exportStar(require("./events"), exports);