@voyantjs/db 0.20.0 → 0.21.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.
@@ -15,6 +15,7 @@ export declare const PREFIXES: {
15
15
  readonly connection_secrets: "secr";
16
16
  readonly webhook_subscriptions: "hksub";
17
17
  readonly webhook_deliveries: "whde";
18
+ readonly rate_limit_buckets: "rlbk";
18
19
  readonly domains: "dom";
19
20
  readonly email_domain_records: "emdr";
20
21
  readonly idempotency_keys: "ikey";
@@ -148,6 +149,8 @@ export declare const PREFIXES: {
148
149
  readonly channel_release_schedules: "chrs";
149
150
  readonly channel_remittance_exceptions: "chre";
150
151
  readonly channel_settlement_approvals: "chap";
152
+ readonly channel_availability_push_intents: "cavi";
153
+ readonly channel_content_push_intents: "ccpi";
151
154
  readonly facilities: "fac";
152
155
  readonly facility_contacts: "fcon";
153
156
  readonly facility_features: "ffea";
@@ -289,6 +292,20 @@ export declare const PREFIXES: {
289
292
  readonly catalog_overlay: "ovly";
290
293
  readonly booking_catalog_snapshot: "bcsn";
291
294
  readonly catalog_drift_event: "cdrf";
295
+ readonly catalog_quotes: "cquo";
296
+ readonly catalog_sourced_entries: "cse";
297
+ readonly catalog_content_drift_event: "cnde";
298
+ readonly catalog_demo_inventory: "cdmi";
299
+ readonly catalog_demo_orders: "cdmo";
300
+ readonly booking_drafts: "bdrf";
301
+ readonly tax_classes: "txcl";
302
+ readonly tax_policy_profiles: "txpp";
303
+ readonly tax_policy_rules: "txpr";
304
+ readonly product_pax_pricing_tiers: "ppt";
305
+ readonly availability_holds: "avhd";
306
+ readonly workflow_runs: "wfrn";
307
+ readonly workflow_run_steps: "wfrs";
308
+ readonly operator_settings: "opset";
292
309
  };
293
310
  export type PrefixKey = keyof typeof PREFIXES;
294
311
  export type PrefixValue = (typeof PREFIXES)[PrefixKey];
@@ -1 +1 @@
1
- {"version":3,"file":"typeid-prefixes.d.ts","sourceRoot":"","sources":["../../src/lib/typeid-prefixes.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// --- INFRA ---
18
18
  webhook_subscriptions: "hksub",
19
19
  webhook_deliveries: "whde",
20
+ rate_limit_buckets: "rlbk",
20
21
  domains: "dom",
21
22
  email_domain_records: "emdr",
22
23
  idempotency_keys: "ikey",
@@ -151,6 +152,8 @@ export const PREFIXES = {
151
152
  channel_release_schedules: "chrs",
152
153
  channel_remittance_exceptions: "chre",
153
154
  channel_settlement_approvals: "chap",
155
+ channel_availability_push_intents: "cavi",
156
+ channel_content_push_intents: "ccpi",
154
157
  facilities: "fac",
155
158
  facility_contacts: "fcon",
156
159
  facility_features: "ffea",
@@ -301,5 +304,41 @@ export const PREFIXES = {
301
304
  catalog_overlay: "ovly",
302
305
  booking_catalog_snapshot: "bcsn",
303
306
  catalog_drift_event: "cdrf",
307
+ catalog_quotes: "cquo",
308
+ catalog_sourced_entries: "cse",
309
+ catalog_content_drift_event: "cnde",
310
+ catalog_demo_inventory: "cdmi",
311
+ catalog_demo_orders: "cdmo",
312
+ // Resumable session-bound draft for the unified booking journey.
313
+ // Per docs/architecture/booking-journey-architecture.md §5.7 +
314
+ // §12.10 (chose option B: ship as a sibling table to
315
+ // booking_session_states).
316
+ booking_drafts: "bdrf",
317
+ // --- FINANCE (extensions for journey tax computation) ---
318
+ // Per booking-journey-architecture §9. The classes are the per-
319
+ // product treatment decision; tax_regimes remains the
320
+ // jurisdictional rate catalog and is unchanged.
321
+ tax_classes: "txcl",
322
+ tax_policy_profiles: "txpp",
323
+ tax_policy_rules: "txpr",
324
+ // Per-product per-occupancy rate tier table for non-cruise
325
+ // verticals. Cruises keep their specialized cruise_prices table.
326
+ product_pax_pricing_tiers: "ppt",
327
+ // --- AVAILABILITY (extension for booking-journey holds) ---
328
+ // Soft holds against availability_slots tied to booking_drafts.
329
+ // Per booking-journey-architecture §5.7 + §6 — the doc proposes
330
+ // bookingAllocations for owned holds, but those require a
331
+ // booking_id FK and journey holds are pre-booking. A dedicated
332
+ // table is the cleanest fit.
333
+ availability_holds: "avhd",
334
+ // Workflow runs — observability for in-process workflows (the
335
+ // catalog-checkout finalize spine, follow-up scheduled jobs, etc).
336
+ // Lives outside the durable @voyantjs/workflows orchestrator so
337
+ // edge-compatible templates can record runs without spinning up
338
+ // a separate Node process.
339
+ workflow_runs: "wfrn",
340
+ workflow_run_steps: "wfrs",
341
+ // --- Operator-template-local settings ---
342
+ operator_settings: "opset",
304
343
  };
305
344
  //# sourceMappingURL=typeid-prefixes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"typeid-prefixes.js","sourceRoot":"","sources":["../../src/lib/typeid-prefixes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,cAAc;IACd,aAAa,EAAE,MAAM;IACrB,gBAAgB,EAAE,MAAM;IACxB,kBAAkB,EAAE,MAAM;IAE1B,gBAAgB;IAChB,qBAAqB,EAAE,OAAO;IAC9B,kBAAkB,EAAE,MAAM;IAC1B,OAAO,EAAE,KAAK;IACd,oBAAoB,EAAE,MAAM;IAC5B,gBAAgB,EAAE,MAAM;IAExB,yBAAyB;IACzB,iBAAiB,EAAE,MAAM;IACzB,sBAAsB,EAAE,MAAM;IAC9B,uBAAuB,EAAE,MAAM;IAC/B,2BAA2B,EAAE,MAAM;IACnC,0BAA0B,EAAE,MAAM;IAClC,YAAY,EAAE,MAAM;IACpB,kBAAkB,EAAE,MAAM;IAC1B,QAAQ,EAAE,KAAK;IACf,eAAe,EAAE,MAAM;IACvB,SAAS,EAAE,MAAM;IACjB,iBAAiB,EAAE,MAAM;IACzB,cAAc,EAAE,MAAM;IACtB,cAAc,EAAE,MAAM;IACtB,qBAAqB,EAAE,MAAM;IAC7B,kBAAkB,EAAE,MAAM;IAC1B,QAAQ,EAAE,MAAM;IAChB,eAAe,EAAE,MAAM;IACvB,YAAY,EAAE,MAAM;IACpB,2BAA2B,EAAE,MAAM;IACnC,uBAAuB,EAAE,MAAM;IAC/B,2BAA2B,EAAE,MAAM;IACnC,oBAAoB,E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,6DAA6D;IAC7D,gEAAgE;IAChE,gEAAgE;IAChE,0DAA0D;IAC1D,+DAA+D;IAC/D,6BAA6B;IAC7B,kBAAkB,EAAE,MAAM;IAE1B,8DAA8D;IAC9D,mEAAmE;IACnE,gEAAgE;IAChE,gEAAgE;IAChE,2BAA2B;IAC3B,aAAa,EAAE,MAAM;IACrB,kBAAkB,EAAE,MAAM;IAC1B,2CAA2C;IAC3C,iBAAiB,EAAE,OAAO;CAClB,CAAA"}
@@ -1,4 +1,6 @@
1
1
  export * from "./domains.js";
2
2
  export * from "./idempotency_keys.js";
3
+ export * from "./rate_limit_buckets.js";
4
+ export * from "./webhook_deliveries.js";
3
5
  export * from "./webhook_subscriptions.js";
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schema/infra/index.ts"],"names":[],"mappings":"AACA,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schema/infra/index.ts"],"names":[],"mappings":"AACA,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA"}
@@ -1,5 +1,7 @@
1
1
  // audit_log: REMOVED - migrated to Tinybird (audit_log.datasource)
2
2
  export * from "./domains.js";
3
3
  export * from "./idempotency_keys.js";
4
+ export * from "./rate_limit_buckets.js";
5
+ export * from "./webhook_deliveries.js";
4
6
  export * from "./webhook_subscriptions.js";
5
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/schema/infra/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/schema/infra/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA"}
@@ -0,0 +1,138 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Generic token-bucket rate-limit primitive.
4
+ *
5
+ * Any module that needs token-bucket rate limiting (channel push,
6
+ * operator-configured webhooks, third-party integrations, future use
7
+ * cases) uses this table with its own scope key. Channel push wraps it
8
+ * with channel-specific scope construction:
9
+ *
10
+ * "channel:" + channelId + ":" + connectionId
11
+ *
12
+ * The `acquireToken(scope, config, priority)` helper does the atomic
13
+ * refill + decrement in one round-trip; see distribution's rate-limit
14
+ * service for the canonical implementation.
15
+ *
16
+ * Per docs/architecture/channel-push-architecture.md §14.2.
17
+ */
18
+ export declare const infraRateLimitBucketsTable: Omit<import("drizzle-orm/pg-core").PgTableWithColumns<{
19
+ name: "rate_limit_buckets";
20
+ schema: undefined;
21
+ columns: {
22
+ scope: import("drizzle-orm/pg-core").PgColumn<{
23
+ name: "scope";
24
+ tableName: "rate_limit_buckets";
25
+ dataType: "string";
26
+ columnType: "PgText";
27
+ data: string;
28
+ driverParam: string;
29
+ notNull: true;
30
+ hasDefault: false;
31
+ isPrimaryKey: true;
32
+ isAutoincrement: false;
33
+ hasRuntimeDefault: false;
34
+ enumValues: [string, ...string[]];
35
+ baseColumn: never;
36
+ identity: undefined;
37
+ generated: undefined;
38
+ }, {}, {}>;
39
+ tokensAvailable: import("drizzle-orm/pg-core").PgColumn<{
40
+ name: "tokens_available";
41
+ tableName: "rate_limit_buckets";
42
+ dataType: "string";
43
+ columnType: "PgNumeric";
44
+ data: string;
45
+ driverParam: string;
46
+ notNull: true;
47
+ hasDefault: false;
48
+ isPrimaryKey: false;
49
+ isAutoincrement: false;
50
+ hasRuntimeDefault: false;
51
+ enumValues: undefined;
52
+ baseColumn: never;
53
+ identity: undefined;
54
+ generated: undefined;
55
+ }, {}, {}>;
56
+ capacity: import("drizzle-orm/pg-core").PgColumn<{
57
+ name: "capacity";
58
+ tableName: "rate_limit_buckets";
59
+ dataType: "string";
60
+ columnType: "PgNumeric";
61
+ data: string;
62
+ driverParam: string;
63
+ notNull: true;
64
+ hasDefault: false;
65
+ isPrimaryKey: false;
66
+ isAutoincrement: false;
67
+ hasRuntimeDefault: false;
68
+ enumValues: undefined;
69
+ baseColumn: never;
70
+ identity: undefined;
71
+ generated: undefined;
72
+ }, {}, {}>;
73
+ refillRatePerSec: import("drizzle-orm/pg-core").PgColumn<{
74
+ name: "refill_rate_per_sec";
75
+ tableName: "rate_limit_buckets";
76
+ dataType: "string";
77
+ columnType: "PgNumeric";
78
+ data: string;
79
+ driverParam: string;
80
+ notNull: true;
81
+ hasDefault: false;
82
+ isPrimaryKey: false;
83
+ isAutoincrement: false;
84
+ hasRuntimeDefault: false;
85
+ enumValues: undefined;
86
+ baseColumn: never;
87
+ identity: undefined;
88
+ generated: undefined;
89
+ }, {}, {}>;
90
+ lastRefillAt: import("drizzle-orm/pg-core").PgColumn<{
91
+ name: "last_refill_at";
92
+ tableName: "rate_limit_buckets";
93
+ dataType: "date";
94
+ columnType: "PgTimestamp";
95
+ data: Date;
96
+ driverParam: string;
97
+ notNull: true;
98
+ hasDefault: true;
99
+ isPrimaryKey: false;
100
+ isAutoincrement: false;
101
+ hasRuntimeDefault: false;
102
+ enumValues: undefined;
103
+ baseColumn: never;
104
+ identity: undefined;
105
+ generated: undefined;
106
+ }, {}, {}>;
107
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
108
+ name: "updated_at";
109
+ tableName: "rate_limit_buckets";
110
+ dataType: "date";
111
+ columnType: "PgTimestamp";
112
+ data: Date;
113
+ driverParam: string;
114
+ notNull: true;
115
+ hasDefault: true;
116
+ isPrimaryKey: false;
117
+ isAutoincrement: false;
118
+ hasRuntimeDefault: false;
119
+ enumValues: undefined;
120
+ baseColumn: never;
121
+ identity: undefined;
122
+ generated: undefined;
123
+ }, {}, {}>;
124
+ };
125
+ dialect: "pg";
126
+ }>, "enableRLS">;
127
+ export type InsertInfraRateLimitBucket = typeof infraRateLimitBucketsTable.$inferInsert;
128
+ export type SelectInfraRateLimitBucket = typeof infraRateLimitBucketsTable.$inferSelect;
129
+ export declare const infraRateLimitBucketSelectSchema: z.ZodObject<{
130
+ scope: z.ZodString;
131
+ tokensAvailable: z.ZodString;
132
+ capacity: z.ZodString;
133
+ refillRatePerSec: z.ZodString;
134
+ lastRefillAt: z.ZodDate;
135
+ updatedAt: z.ZodDate;
136
+ }, z.core.$strip>;
137
+ export type InfraRateLimitBucket = z.infer<typeof infraRateLimitBucketSelectSchema>;
138
+ //# sourceMappingURL=rate_limit_buckets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rate_limit_buckets.d.ts","sourceRoot":"","sources":["../../../src/schema/infra/rate_limit_buckets.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAwBzB,CAAA;AAEd,MAAM,MAAM,0BAA0B,GAAG,OAAO,0BAA0B,CAAC,YAAY,CAAA;AACvF,MAAM,MAAM,0BAA0B,GAAG,OAAO,0BAA0B,CAAC,YAAY,CAAA;AAEvF,eAAO,MAAM,gCAAgC;;;;;;;iBAO3C,CAAA;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA"}
@@ -0,0 +1,52 @@
1
+ import { numeric, pgTable, text, timestamp } from "drizzle-orm/pg-core";
2
+ import { z } from "zod";
3
+ /**
4
+ * Generic token-bucket rate-limit primitive.
5
+ *
6
+ * Any module that needs token-bucket rate limiting (channel push,
7
+ * operator-configured webhooks, third-party integrations, future use
8
+ * cases) uses this table with its own scope key. Channel push wraps it
9
+ * with channel-specific scope construction:
10
+ *
11
+ * "channel:" + channelId + ":" + connectionId
12
+ *
13
+ * The `acquireToken(scope, config, priority)` helper does the atomic
14
+ * refill + decrement in one round-trip; see distribution's rate-limit
15
+ * service for the canonical implementation.
16
+ *
17
+ * Per docs/architecture/channel-push-architecture.md §14.2.
18
+ */
19
+ export const infraRateLimitBucketsTable = pgTable("rate_limit_buckets", {
20
+ /**
21
+ * Caller-defined scope. NOT a typeid — bucket scopes are application
22
+ * level (e.g. `"channel:ch_xxx:conn_yyy"`). The PK doubles as the
23
+ * lookup key.
24
+ */
25
+ scope: text("scope").primaryKey(),
26
+ /**
27
+ * Current token balance. `numeric` (not `integer`) so partial-token
28
+ * priority gates work cleanly (e.g. "dispatch when bucket >= 0.3 *
29
+ * capacity"). Drizzle returns this as a string; callers parse to
30
+ * number.
31
+ */
32
+ tokensAvailable: numeric("tokens_available").notNull(),
33
+ capacity: numeric("capacity").notNull(),
34
+ /** Tokens added per second since `last_refill_at`. */
35
+ refillRatePerSec: numeric("refill_rate_per_sec").notNull(),
36
+ /**
37
+ * Last time the bucket was refilled. Atomic UPDATE in `acquireToken`
38
+ * computes `(now - last_refill_at) * refill_rate`, caps at capacity,
39
+ * sets the new value, and stamps `last_refill_at = now()`.
40
+ */
41
+ lastRefillAt: timestamp("last_refill_at", { withTimezone: true }).notNull().defaultNow(),
42
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
43
+ }).enableRLS();
44
+ export const infraRateLimitBucketSelectSchema = z.object({
45
+ scope: z.string(),
46
+ tokensAvailable: z.string(),
47
+ capacity: z.string(),
48
+ refillRatePerSec: z.string(),
49
+ lastRefillAt: z.date(),
50
+ updatedAt: z.date(),
51
+ });
52
+ //# sourceMappingURL=rate_limit_buckets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rate_limit_buckets.js","sourceRoot":"","sources":["../../../src/schema/infra/rate_limit_buckets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,OAAO,CAAC,oBAAoB,EAAE;IACtE;;;;OAIG;IACH,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE;IACjC;;;;;OAKG;IACH,eAAe,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC,OAAO,EAAE;IACtD,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE;IACvC,sDAAsD;IACtD,gBAAgB,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC,OAAO,EAAE;IAC1D;;;;OAIG;IACH,YAAY,EAAE,SAAS,CAAC,gBAAgB,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE;IACxF,SAAS,EAAE,SAAS,CAAC,YAAY,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE;CAClF,CAAC,CAAC,SAAS,EAAE,CAAA;AAKd,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC;IACvD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;IAC3B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE;IAC5B,YAAY,EAAE,CAAC,CAAC,IAAI,EAAE;IACtB,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE;CACpB,CAAC,CAAA"}
@@ -0,0 +1,572 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Generic outbound HTTP delivery log.
4
+ *
5
+ * Every outbound HTTP call from any module writes a row per attempt for
6
+ * observability, retry-chain history, and (eventually) durable
7
+ * scheduling. Channel push is the first concrete consumer; future
8
+ * consumers include operator-configured webhooks (delivering Voyant
9
+ * events to operator-supplied URLs), third-party integrations (CRM
10
+ * sync, accounting exports), and any other real-time outbound system
11
+ * that needs the same observability surface.
12
+ *
13
+ * Distinct from `channel_webhook_events` (in distribution), which logs
14
+ * events received FROM channels — opposite direction.
15
+ *
16
+ * Per docs/architecture/channel-push-architecture.md §11.
17
+ *
18
+ * IMPORTANT: callers MUST NOT INSERT directly. Use the
19
+ * `prepareOutboundEnvelope` helper (in `@voyantjs/voyant-distribution` or
20
+ * a future shared infra package) — it enforces auth-header redaction,
21
+ * PII redaction, and excerpt-bounding. Direct inserts are a lint
22
+ * violation per §11.3.
23
+ */
24
+ export declare const infraWebhookDeliveriesTable: Omit<import("drizzle-orm/pg-core").PgTableWithColumns<{
25
+ name: "webhook_deliveries";
26
+ schema: undefined;
27
+ columns: {
28
+ id: import("drizzle-orm/pg-core").PgColumn<{
29
+ name: string;
30
+ tableName: "webhook_deliveries";
31
+ dataType: "string";
32
+ columnType: "PgText";
33
+ data: string;
34
+ driverParam: string;
35
+ notNull: true;
36
+ hasDefault: true;
37
+ isPrimaryKey: true;
38
+ isAutoincrement: false;
39
+ hasRuntimeDefault: true;
40
+ enumValues: [string, ...string[]];
41
+ baseColumn: never;
42
+ identity: undefined;
43
+ generated: undefined;
44
+ }, {}, {}>;
45
+ sourceModule: import("drizzle-orm/pg-core").PgColumn<{
46
+ name: "source_module";
47
+ tableName: "webhook_deliveries";
48
+ dataType: "string";
49
+ columnType: "PgText";
50
+ data: string;
51
+ driverParam: string;
52
+ notNull: true;
53
+ hasDefault: false;
54
+ isPrimaryKey: false;
55
+ isAutoincrement: false;
56
+ hasRuntimeDefault: false;
57
+ enumValues: [string, ...string[]];
58
+ baseColumn: never;
59
+ identity: undefined;
60
+ generated: undefined;
61
+ }, {}, {}>;
62
+ sourceEvent: import("drizzle-orm/pg-core").PgColumn<{
63
+ name: "source_event";
64
+ tableName: "webhook_deliveries";
65
+ dataType: "string";
66
+ columnType: "PgText";
67
+ data: string;
68
+ driverParam: string;
69
+ notNull: true;
70
+ hasDefault: false;
71
+ isPrimaryKey: false;
72
+ isAutoincrement: false;
73
+ hasRuntimeDefault: false;
74
+ enumValues: [string, ...string[]];
75
+ baseColumn: never;
76
+ identity: undefined;
77
+ generated: undefined;
78
+ }, {}, {}>;
79
+ sourceEntityModule: import("drizzle-orm/pg-core").PgColumn<{
80
+ name: "source_entity_module";
81
+ tableName: "webhook_deliveries";
82
+ dataType: "string";
83
+ columnType: "PgText";
84
+ data: string;
85
+ driverParam: string;
86
+ notNull: false;
87
+ hasDefault: false;
88
+ isPrimaryKey: false;
89
+ isAutoincrement: false;
90
+ hasRuntimeDefault: false;
91
+ enumValues: [string, ...string[]];
92
+ baseColumn: never;
93
+ identity: undefined;
94
+ generated: undefined;
95
+ }, {}, {}>;
96
+ sourceEntityId: import("drizzle-orm/pg-core").PgColumn<{
97
+ name: "source_entity_id";
98
+ tableName: "webhook_deliveries";
99
+ dataType: "string";
100
+ columnType: "PgText";
101
+ data: string;
102
+ driverParam: string;
103
+ notNull: false;
104
+ hasDefault: false;
105
+ isPrimaryKey: false;
106
+ isAutoincrement: false;
107
+ hasRuntimeDefault: false;
108
+ enumValues: [string, ...string[]];
109
+ baseColumn: never;
110
+ identity: undefined;
111
+ generated: undefined;
112
+ }, {}, {}>;
113
+ subscriptionId: import("drizzle-orm/pg-core").PgColumn<{
114
+ name: "subscription_id";
115
+ tableName: "webhook_deliveries";
116
+ dataType: "string";
117
+ columnType: "PgText";
118
+ data: string;
119
+ driverParam: string;
120
+ notNull: false;
121
+ hasDefault: false;
122
+ isPrimaryKey: false;
123
+ isAutoincrement: false;
124
+ hasRuntimeDefault: false;
125
+ enumValues: [string, ...string[]];
126
+ baseColumn: never;
127
+ identity: undefined;
128
+ generated: undefined;
129
+ }, {}, {}>;
130
+ targetUrl: import("drizzle-orm/pg-core").PgColumn<{
131
+ name: "target_url";
132
+ tableName: "webhook_deliveries";
133
+ dataType: "string";
134
+ columnType: "PgText";
135
+ data: string;
136
+ driverParam: string;
137
+ notNull: true;
138
+ hasDefault: false;
139
+ isPrimaryKey: false;
140
+ isAutoincrement: false;
141
+ hasRuntimeDefault: false;
142
+ enumValues: [string, ...string[]];
143
+ baseColumn: never;
144
+ identity: undefined;
145
+ generated: undefined;
146
+ }, {}, {}>;
147
+ targetKind: import("drizzle-orm/pg-core").PgColumn<{
148
+ name: "target_kind";
149
+ tableName: "webhook_deliveries";
150
+ dataType: "string";
151
+ columnType: "PgText";
152
+ data: string;
153
+ driverParam: string;
154
+ notNull: false;
155
+ hasDefault: false;
156
+ isPrimaryKey: false;
157
+ isAutoincrement: false;
158
+ hasRuntimeDefault: false;
159
+ enumValues: [string, ...string[]];
160
+ baseColumn: never;
161
+ identity: undefined;
162
+ generated: undefined;
163
+ }, {}, {}>;
164
+ targetRef: import("drizzle-orm/pg-core").PgColumn<{
165
+ name: "target_ref";
166
+ tableName: "webhook_deliveries";
167
+ dataType: "string";
168
+ columnType: "PgText";
169
+ data: string;
170
+ driverParam: string;
171
+ notNull: false;
172
+ hasDefault: false;
173
+ isPrimaryKey: false;
174
+ isAutoincrement: false;
175
+ hasRuntimeDefault: false;
176
+ enumValues: [string, ...string[]];
177
+ baseColumn: never;
178
+ identity: undefined;
179
+ generated: undefined;
180
+ }, {}, {}>;
181
+ requestMethod: import("drizzle-orm/pg-core").PgColumn<{
182
+ name: "request_method";
183
+ tableName: "webhook_deliveries";
184
+ dataType: "string";
185
+ columnType: "PgText";
186
+ data: string;
187
+ driverParam: string;
188
+ notNull: true;
189
+ hasDefault: false;
190
+ isPrimaryKey: false;
191
+ isAutoincrement: false;
192
+ hasRuntimeDefault: false;
193
+ enumValues: [string, ...string[]];
194
+ baseColumn: never;
195
+ identity: undefined;
196
+ generated: undefined;
197
+ }, {}, {}>;
198
+ requestHeaders: import("drizzle-orm/pg-core").PgColumn<{
199
+ name: "request_headers";
200
+ tableName: "webhook_deliveries";
201
+ dataType: "json";
202
+ columnType: "PgJsonb";
203
+ data: Record<string, string>;
204
+ driverParam: unknown;
205
+ notNull: false;
206
+ hasDefault: false;
207
+ isPrimaryKey: false;
208
+ isAutoincrement: false;
209
+ hasRuntimeDefault: false;
210
+ enumValues: undefined;
211
+ baseColumn: never;
212
+ identity: undefined;
213
+ generated: undefined;
214
+ }, {}, {
215
+ $type: Record<string, string>;
216
+ }>;
217
+ requestBodyHash: import("drizzle-orm/pg-core").PgColumn<{
218
+ name: "request_body_hash";
219
+ tableName: "webhook_deliveries";
220
+ dataType: "string";
221
+ columnType: "PgText";
222
+ data: string;
223
+ driverParam: string;
224
+ notNull: false;
225
+ hasDefault: false;
226
+ isPrimaryKey: false;
227
+ isAutoincrement: false;
228
+ hasRuntimeDefault: false;
229
+ enumValues: [string, ...string[]];
230
+ baseColumn: never;
231
+ identity: undefined;
232
+ generated: undefined;
233
+ }, {}, {}>;
234
+ requestBodyExcerpt: import("drizzle-orm/pg-core").PgColumn<{
235
+ name: "request_body_excerpt";
236
+ tableName: "webhook_deliveries";
237
+ dataType: "string";
238
+ columnType: "PgText";
239
+ data: string;
240
+ driverParam: string;
241
+ notNull: false;
242
+ hasDefault: false;
243
+ isPrimaryKey: false;
244
+ isAutoincrement: false;
245
+ hasRuntimeDefault: false;
246
+ enumValues: [string, ...string[]];
247
+ baseColumn: never;
248
+ identity: undefined;
249
+ generated: undefined;
250
+ }, {}, {}>;
251
+ responseStatus: import("drizzle-orm/pg-core").PgColumn<{
252
+ name: "response_status";
253
+ tableName: "webhook_deliveries";
254
+ dataType: "number";
255
+ columnType: "PgInteger";
256
+ data: number;
257
+ driverParam: string | number;
258
+ notNull: false;
259
+ hasDefault: false;
260
+ isPrimaryKey: false;
261
+ isAutoincrement: false;
262
+ hasRuntimeDefault: false;
263
+ enumValues: undefined;
264
+ baseColumn: never;
265
+ identity: undefined;
266
+ generated: undefined;
267
+ }, {}, {}>;
268
+ responseHeaders: import("drizzle-orm/pg-core").PgColumn<{
269
+ name: "response_headers";
270
+ tableName: "webhook_deliveries";
271
+ dataType: "json";
272
+ columnType: "PgJsonb";
273
+ data: Record<string, string>;
274
+ driverParam: unknown;
275
+ notNull: false;
276
+ hasDefault: false;
277
+ isPrimaryKey: false;
278
+ isAutoincrement: false;
279
+ hasRuntimeDefault: false;
280
+ enumValues: undefined;
281
+ baseColumn: never;
282
+ identity: undefined;
283
+ generated: undefined;
284
+ }, {}, {
285
+ $type: Record<string, string>;
286
+ }>;
287
+ responseBodyExcerpt: import("drizzle-orm/pg-core").PgColumn<{
288
+ name: "response_body_excerpt";
289
+ tableName: "webhook_deliveries";
290
+ dataType: "string";
291
+ columnType: "PgText";
292
+ data: string;
293
+ driverParam: string;
294
+ notNull: false;
295
+ hasDefault: false;
296
+ isPrimaryKey: false;
297
+ isAutoincrement: false;
298
+ hasRuntimeDefault: false;
299
+ enumValues: [string, ...string[]];
300
+ baseColumn: never;
301
+ identity: undefined;
302
+ generated: undefined;
303
+ }, {}, {}>;
304
+ attemptNumber: import("drizzle-orm/pg-core").PgColumn<{
305
+ name: "attempt_number";
306
+ tableName: "webhook_deliveries";
307
+ dataType: "number";
308
+ columnType: "PgInteger";
309
+ data: number;
310
+ driverParam: string | number;
311
+ notNull: true;
312
+ hasDefault: true;
313
+ isPrimaryKey: false;
314
+ isAutoincrement: false;
315
+ hasRuntimeDefault: false;
316
+ enumValues: undefined;
317
+ baseColumn: never;
318
+ identity: undefined;
319
+ generated: undefined;
320
+ }, {}, {}>;
321
+ parentDeliveryId: import("drizzle-orm/pg-core").PgColumn<{
322
+ name: "parent_delivery_id";
323
+ tableName: "webhook_deliveries";
324
+ dataType: "string";
325
+ columnType: "PgText";
326
+ data: string;
327
+ driverParam: string;
328
+ notNull: false;
329
+ hasDefault: false;
330
+ isPrimaryKey: false;
331
+ isAutoincrement: false;
332
+ hasRuntimeDefault: false;
333
+ enumValues: [string, ...string[]];
334
+ baseColumn: never;
335
+ identity: undefined;
336
+ generated: undefined;
337
+ }, {}, {}>;
338
+ idempotencyKey: import("drizzle-orm/pg-core").PgColumn<{
339
+ name: "idempotency_key";
340
+ tableName: "webhook_deliveries";
341
+ dataType: "string";
342
+ columnType: "PgText";
343
+ data: string;
344
+ driverParam: string;
345
+ notNull: false;
346
+ hasDefault: false;
347
+ isPrimaryKey: false;
348
+ isAutoincrement: false;
349
+ hasRuntimeDefault: false;
350
+ enumValues: [string, ...string[]];
351
+ baseColumn: never;
352
+ identity: undefined;
353
+ generated: undefined;
354
+ }, {}, {}>;
355
+ status: import("drizzle-orm/pg-core").PgColumn<{
356
+ name: "status";
357
+ tableName: "webhook_deliveries";
358
+ dataType: "string";
359
+ columnType: "PgText";
360
+ data: string;
361
+ driverParam: string;
362
+ notNull: true;
363
+ hasDefault: false;
364
+ isPrimaryKey: false;
365
+ isAutoincrement: false;
366
+ hasRuntimeDefault: false;
367
+ enumValues: [string, ...string[]];
368
+ baseColumn: never;
369
+ identity: undefined;
370
+ generated: undefined;
371
+ }, {}, {}>;
372
+ scheduledFor: import("drizzle-orm/pg-core").PgColumn<{
373
+ name: "scheduled_for";
374
+ tableName: "webhook_deliveries";
375
+ dataType: "date";
376
+ columnType: "PgTimestamp";
377
+ data: Date;
378
+ driverParam: string;
379
+ notNull: false;
380
+ hasDefault: false;
381
+ isPrimaryKey: false;
382
+ isAutoincrement: false;
383
+ hasRuntimeDefault: false;
384
+ enumValues: undefined;
385
+ baseColumn: never;
386
+ identity: undefined;
387
+ generated: undefined;
388
+ }, {}, {}>;
389
+ startedAt: import("drizzle-orm/pg-core").PgColumn<{
390
+ name: "started_at";
391
+ tableName: "webhook_deliveries";
392
+ dataType: "date";
393
+ columnType: "PgTimestamp";
394
+ data: Date;
395
+ driverParam: string;
396
+ notNull: false;
397
+ hasDefault: false;
398
+ isPrimaryKey: false;
399
+ isAutoincrement: false;
400
+ hasRuntimeDefault: false;
401
+ enumValues: undefined;
402
+ baseColumn: never;
403
+ identity: undefined;
404
+ generated: undefined;
405
+ }, {}, {}>;
406
+ finishedAt: import("drizzle-orm/pg-core").PgColumn<{
407
+ name: "finished_at";
408
+ tableName: "webhook_deliveries";
409
+ dataType: "date";
410
+ columnType: "PgTimestamp";
411
+ data: Date;
412
+ driverParam: string;
413
+ notNull: false;
414
+ hasDefault: false;
415
+ isPrimaryKey: false;
416
+ isAutoincrement: false;
417
+ hasRuntimeDefault: false;
418
+ enumValues: undefined;
419
+ baseColumn: never;
420
+ identity: undefined;
421
+ generated: undefined;
422
+ }, {}, {}>;
423
+ durationMs: import("drizzle-orm/pg-core").PgColumn<{
424
+ name: "duration_ms";
425
+ tableName: "webhook_deliveries";
426
+ dataType: "number";
427
+ columnType: "PgInteger";
428
+ data: number;
429
+ driverParam: string | number;
430
+ notNull: false;
431
+ hasDefault: false;
432
+ isPrimaryKey: false;
433
+ isAutoincrement: false;
434
+ hasRuntimeDefault: false;
435
+ enumValues: undefined;
436
+ baseColumn: never;
437
+ identity: undefined;
438
+ generated: undefined;
439
+ }, {}, {}>;
440
+ errorClass: import("drizzle-orm/pg-core").PgColumn<{
441
+ name: "error_class";
442
+ tableName: "webhook_deliveries";
443
+ dataType: "string";
444
+ columnType: "PgText";
445
+ data: string;
446
+ driverParam: string;
447
+ notNull: false;
448
+ hasDefault: false;
449
+ isPrimaryKey: false;
450
+ isAutoincrement: false;
451
+ hasRuntimeDefault: false;
452
+ enumValues: [string, ...string[]];
453
+ baseColumn: never;
454
+ identity: undefined;
455
+ generated: undefined;
456
+ }, {}, {}>;
457
+ errorMessage: import("drizzle-orm/pg-core").PgColumn<{
458
+ name: "error_message";
459
+ tableName: "webhook_deliveries";
460
+ dataType: "string";
461
+ columnType: "PgText";
462
+ data: string;
463
+ driverParam: string;
464
+ notNull: false;
465
+ hasDefault: false;
466
+ isPrimaryKey: false;
467
+ isAutoincrement: false;
468
+ hasRuntimeDefault: false;
469
+ enumValues: [string, ...string[]];
470
+ baseColumn: never;
471
+ identity: undefined;
472
+ generated: undefined;
473
+ }, {}, {}>;
474
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
475
+ name: "created_at";
476
+ tableName: "webhook_deliveries";
477
+ dataType: "date";
478
+ columnType: "PgTimestamp";
479
+ data: Date;
480
+ driverParam: string;
481
+ notNull: true;
482
+ hasDefault: true;
483
+ isPrimaryKey: false;
484
+ isAutoincrement: false;
485
+ hasRuntimeDefault: false;
486
+ enumValues: undefined;
487
+ baseColumn: never;
488
+ identity: undefined;
489
+ generated: undefined;
490
+ }, {}, {}>;
491
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
492
+ name: "updated_at";
493
+ tableName: "webhook_deliveries";
494
+ dataType: "date";
495
+ columnType: "PgTimestamp";
496
+ data: Date;
497
+ driverParam: string;
498
+ notNull: true;
499
+ hasDefault: true;
500
+ isPrimaryKey: false;
501
+ isAutoincrement: false;
502
+ hasRuntimeDefault: false;
503
+ enumValues: undefined;
504
+ baseColumn: never;
505
+ identity: undefined;
506
+ generated: undefined;
507
+ }, {}, {}>;
508
+ };
509
+ dialect: "pg";
510
+ }>, "enableRLS">;
511
+ export type InsertInfraWebhookDelivery = typeof infraWebhookDeliveriesTable.$inferInsert;
512
+ export type SelectInfraWebhookDelivery = typeof infraWebhookDeliveriesTable.$inferSelect;
513
+ export declare const webhookDeliveryStatusSchema: z.ZodEnum<{
514
+ pending: "pending";
515
+ in_flight: "in_flight";
516
+ succeeded: "succeeded";
517
+ failed: "failed";
518
+ abandoned: "abandoned";
519
+ }>;
520
+ export declare const webhookDeliveryErrorClassSchema: z.ZodEnum<{
521
+ timeout: "timeout";
522
+ network: "network";
523
+ "4xx": "4xx";
524
+ "5xx": "5xx";
525
+ adapter_error: "adapter_error";
526
+ rate_limited: "rate_limited";
527
+ }>;
528
+ export declare const infraWebhookDeliverySelectSchema: z.ZodObject<{
529
+ id: z.ZodString;
530
+ sourceModule: z.ZodString;
531
+ sourceEvent: z.ZodString;
532
+ sourceEntityModule: z.ZodNullable<z.ZodString>;
533
+ sourceEntityId: z.ZodNullable<z.ZodString>;
534
+ subscriptionId: z.ZodNullable<z.ZodString>;
535
+ targetUrl: z.ZodString;
536
+ targetKind: z.ZodNullable<z.ZodString>;
537
+ targetRef: z.ZodNullable<z.ZodString>;
538
+ requestMethod: z.ZodString;
539
+ requestHeaders: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
540
+ requestBodyHash: z.ZodNullable<z.ZodString>;
541
+ requestBodyExcerpt: z.ZodNullable<z.ZodString>;
542
+ responseStatus: z.ZodNullable<z.ZodNumber>;
543
+ responseHeaders: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>;
544
+ responseBodyExcerpt: z.ZodNullable<z.ZodString>;
545
+ attemptNumber: z.ZodNumber;
546
+ parentDeliveryId: z.ZodNullable<z.ZodString>;
547
+ idempotencyKey: z.ZodNullable<z.ZodString>;
548
+ status: z.ZodEnum<{
549
+ pending: "pending";
550
+ in_flight: "in_flight";
551
+ succeeded: "succeeded";
552
+ failed: "failed";
553
+ abandoned: "abandoned";
554
+ }>;
555
+ scheduledFor: z.ZodNullable<z.ZodDate>;
556
+ startedAt: z.ZodNullable<z.ZodDate>;
557
+ finishedAt: z.ZodNullable<z.ZodDate>;
558
+ durationMs: z.ZodNullable<z.ZodNumber>;
559
+ errorClass: z.ZodNullable<z.ZodEnum<{
560
+ timeout: "timeout";
561
+ network: "network";
562
+ "4xx": "4xx";
563
+ "5xx": "5xx";
564
+ adapter_error: "adapter_error";
565
+ rate_limited: "rate_limited";
566
+ }>>;
567
+ errorMessage: z.ZodNullable<z.ZodString>;
568
+ createdAt: z.ZodDate;
569
+ updatedAt: z.ZodDate;
570
+ }, z.core.$strip>;
571
+ export type InfraWebhookDelivery = z.infer<typeof infraWebhookDeliverySelectSchema>;
572
+ //# sourceMappingURL=webhook_deliveries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook_deliveries.d.ts","sourceRoot":"","sources":["../../../src/schema/infra/webhook_deliveries.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAgF3B,CAAA;AAEb,MAAM,MAAM,0BAA0B,GAAG,OAAO,2BAA2B,CAAC,YAAY,CAAA;AACxF,MAAM,MAAM,0BAA0B,GAAG,OAAO,2BAA2B,CAAC,YAAY,CAAA;AAExF,eAAO,MAAM,2BAA2B;;;;;;EAMtC,CAAA;AAEF,eAAO,MAAM,+BAA+B;;;;;;;EAO1C,CAAA;AAEF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6B3C,CAAA;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAA"}
@@ -0,0 +1,136 @@
1
+ import { index, integer, jsonb, pgTable, text, timestamp } from "drizzle-orm/pg-core";
2
+ import { z } from "zod";
3
+ import { typeId, typeIdSchema } from "../../lib/index.js";
4
+ /**
5
+ * Generic outbound HTTP delivery log.
6
+ *
7
+ * Every outbound HTTP call from any module writes a row per attempt for
8
+ * observability, retry-chain history, and (eventually) durable
9
+ * scheduling. Channel push is the first concrete consumer; future
10
+ * consumers include operator-configured webhooks (delivering Voyant
11
+ * events to operator-supplied URLs), third-party integrations (CRM
12
+ * sync, accounting exports), and any other real-time outbound system
13
+ * that needs the same observability surface.
14
+ *
15
+ * Distinct from `channel_webhook_events` (in distribution), which logs
16
+ * events received FROM channels — opposite direction.
17
+ *
18
+ * Per docs/architecture/channel-push-architecture.md §11.
19
+ *
20
+ * IMPORTANT: callers MUST NOT INSERT directly. Use the
21
+ * `prepareOutboundEnvelope` helper (in `@voyantjs/voyant-distribution` or
22
+ * a future shared infra package) — it enforces auth-header redaction,
23
+ * PII redaction, and excerpt-bounding. Direct inserts are a lint
24
+ * violation per §11.3.
25
+ */
26
+ export const infraWebhookDeliveriesTable = pgTable("webhook_deliveries", {
27
+ id: typeId("webhook_deliveries"),
28
+ // ── Provenance: who issued this call and why ──────────────────────
29
+ /** "distribution", "iam", "operator-webhooks", … */
30
+ sourceModule: text("source_module").notNull(),
31
+ /** "channel.booking.push", "channel.availability.push", … */
32
+ sourceEvent: text("source_event").notNull(),
33
+ /** e.g. "bookings", "products" — for entity-scoped queries. */
34
+ sourceEntityModule: text("source_entity_module"),
35
+ /** e.g. "book_xxx" — for entity-scoped queries. */
36
+ sourceEntityId: text("source_entity_id"),
37
+ /** References webhook_subscriptions.id when applicable. */
38
+ subscriptionId: text("subscription_id"),
39
+ // ── Target ────────────────────────────────────────────────────────
40
+ targetUrl: text("target_url").notNull(),
41
+ /** "channel:tui", "subscription", "internal", … */
42
+ targetKind: text("target_kind"),
43
+ /** e.g. channel_id when target_kind = "channel:*". */
44
+ targetRef: text("target_ref"),
45
+ // ── Request (sensitive headers redacted before write) ─────────────
46
+ requestMethod: text("request_method").notNull(),
47
+ /** Auth headers (Authorization, Cookie, X-Api-Key, …) MUST be redacted. */
48
+ requestHeaders: jsonb("request_headers").$type(),
49
+ /** SHA-256 of the canonical request body — for idempotency / drift. */
50
+ requestBodyHash: text("request_body_hash"),
51
+ /** First N chars (bounded to 4 KB) for debugging. */
52
+ requestBodyExcerpt: text("request_body_excerpt"),
53
+ // ── Response ──────────────────────────────────────────────────────
54
+ responseStatus: integer("response_status"),
55
+ responseHeaders: jsonb("response_headers").$type(),
56
+ responseBodyExcerpt: text("response_body_excerpt"),
57
+ // ── Retry chain ──────────────────────────────────────────────────
58
+ attemptNumber: integer("attempt_number").notNull().default(1),
59
+ /** Previous attempt in the retry chain. */
60
+ parentDeliveryId: text("parent_delivery_id"),
61
+ /** Stable across retries; supplied by the caller. */
62
+ idempotencyKey: text("idempotency_key"),
63
+ // ── Lifecycle ────────────────────────────────────────────────────
64
+ /** "pending" | "in_flight" | "succeeded" | "failed" | "abandoned" */
65
+ status: text("status").notNull(),
66
+ /** When set, a future scheduler picks the row up at this time; v1 dispatches inline. */
67
+ scheduledFor: timestamp("scheduled_for", { withTimezone: true }),
68
+ startedAt: timestamp("started_at", { withTimezone: true }),
69
+ finishedAt: timestamp("finished_at", { withTimezone: true }),
70
+ durationMs: integer("duration_ms"),
71
+ // ── Error detail ─────────────────────────────────────────────────
72
+ /** "network" | "timeout" | "4xx" | "5xx" | "adapter_error" | "rate_limited" */
73
+ errorClass: text("error_class"),
74
+ errorMessage: text("error_message"),
75
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
76
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
77
+ }, (table) => [
78
+ // Forward-compatible scheduler index (v1 doesn't run a worker yet).
79
+ index("idx_webhook_deliveries_pending").on(table.status, table.scheduledFor),
80
+ // Module-scoped logs for the operator dashboard.
81
+ index("idx_webhook_deliveries_module").on(table.sourceModule, table.createdAt),
82
+ // Entity-scoped logs ("show me all deliveries for this booking").
83
+ index("idx_webhook_deliveries_entity").on(table.sourceEntityModule, table.sourceEntityId, table.createdAt),
84
+ // Retry-chain queries.
85
+ index("idx_webhook_deliveries_idempotency").on(table.idempotencyKey, table.attemptNumber),
86
+ // Per-subscription history.
87
+ index("idx_webhook_deliveries_subscription").on(table.subscriptionId, table.createdAt),
88
+ // Per-channel history (target_kind = "channel:*", target_ref = channel id).
89
+ index("idx_webhook_deliveries_target").on(table.targetKind, table.targetRef, table.createdAt),
90
+ ]).enableRLS();
91
+ export const webhookDeliveryStatusSchema = z.enum([
92
+ "pending",
93
+ "in_flight",
94
+ "succeeded",
95
+ "failed",
96
+ "abandoned",
97
+ ]);
98
+ export const webhookDeliveryErrorClassSchema = z.enum([
99
+ "network",
100
+ "timeout",
101
+ "4xx",
102
+ "5xx",
103
+ "adapter_error",
104
+ "rate_limited",
105
+ ]);
106
+ export const infraWebhookDeliverySelectSchema = z.object({
107
+ id: typeIdSchema("webhook_deliveries"),
108
+ sourceModule: z.string(),
109
+ sourceEvent: z.string(),
110
+ sourceEntityModule: z.string().nullable(),
111
+ sourceEntityId: z.string().nullable(),
112
+ subscriptionId: z.string().nullable(),
113
+ targetUrl: z.string(),
114
+ targetKind: z.string().nullable(),
115
+ targetRef: z.string().nullable(),
116
+ requestMethod: z.string(),
117
+ requestHeaders: z.record(z.string(), z.string()).nullable(),
118
+ requestBodyHash: z.string().nullable(),
119
+ requestBodyExcerpt: z.string().nullable(),
120
+ responseStatus: z.number().int().nullable(),
121
+ responseHeaders: z.record(z.string(), z.string()).nullable(),
122
+ responseBodyExcerpt: z.string().nullable(),
123
+ attemptNumber: z.number().int(),
124
+ parentDeliveryId: z.string().nullable(),
125
+ idempotencyKey: z.string().nullable(),
126
+ status: webhookDeliveryStatusSchema,
127
+ scheduledFor: z.date().nullable(),
128
+ startedAt: z.date().nullable(),
129
+ finishedAt: z.date().nullable(),
130
+ durationMs: z.number().int().nullable(),
131
+ errorClass: webhookDeliveryErrorClassSchema.nullable(),
132
+ errorMessage: z.string().nullable(),
133
+ createdAt: z.date(),
134
+ updatedAt: z.date(),
135
+ });
136
+ //# sourceMappingURL=webhook_deliveries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webhook_deliveries.js","sourceRoot":"","sources":["../../../src/schema/infra/webhook_deliveries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACrF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAEhD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,OAAO,CAChD,oBAAoB,EACpB;IACE,EAAE,EAAE,MAAM,CAAC,oBAAoB,CAAC;IAEhC,qEAAqE;IACrE,oDAAoD;IACpD,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC,OAAO,EAAE;IAC7C,6DAA6D;IAC7D,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE;IAC3C,+DAA+D;IAC/D,kBAAkB,EAAE,IAAI,CAAC,sBAAsB,CAAC;IAChD,mDAAmD;IACnD,cAAc,EAAE,IAAI,CAAC,kBAAkB,CAAC;IACxC,2DAA2D;IAC3D,cAAc,EAAE,IAAI,CAAC,iBAAiB,CAAC;IAEvC,qEAAqE;IACrE,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE;IACvC,mDAAmD;IACnD,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC;IAC/B,sDAAsD;IACtD,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC;IAE7B,q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M,EAAE,CAAC,QAAQ,EAAE;IACvC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC,MAAM,EAAE,2BAA2B;IACnC,YAAY,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IACjC,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IAC9B,UAAU,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IAC/B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACvC,UAAU,EAAE,+BAA+B,CAAC,QAAQ,EAAE;IACtD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE;IACnB,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE;CACpB,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyantjs/db",
3
- "version": "0.20.0",
3
+ "version": "0.21.1",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -157,7 +157,7 @@
157
157
  "postgres": "^3.4.8",
158
158
  "typeid-js": "^1.2.0",
159
159
  "zod": "^4.3.6",
160
- "@voyantjs/core": "0.20.0"
160
+ "@voyantjs/core": "0.21.1"
161
161
  },
162
162
  "devDependencies": {
163
163
  "typescript": "^6.0.2",