@happyvertical/smrt-webhooks 0.62.4 → 0.62.6
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.
- package/README.md +23 -0
- package/dist/admin.d.ts +2 -0
- package/dist/admin.d.ts.map +1 -1
- package/dist/admin.js +1 -1
- package/dist/chunks/{admin-ySI79PC3.js → admin-BAWFGnX4.js} +182 -3
- package/dist/chunks/admin-BAWFGnX4.js.map +1 -0
- package/dist/chunks/{dispatcher-BmwcfQvY.js → dispatcher-B4n4hqB1.js} +11 -50
- package/dist/chunks/dispatcher-B4n4hqB1.js.map +1 -0
- package/dist/dispatcher.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +28 -6
- package/dist/models.d.ts +7 -0
- package/dist/models.d.ts.map +1 -1
- package/dist/signing.d.ts +61 -5
- package/dist/signing.d.ts.map +1 -1
- package/dist/smrt-knowledge.json +9 -3
- package/package.json +6 -6
- package/dist/chunks/admin-ySI79PC3.js.map +0 -1
- package/dist/chunks/dispatcher-BmwcfQvY.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as runWebhookDeliveryJob,
|
|
2
|
-
import { a as WebhookDeliveryCollection, c as WebhookSubscriptionCollection, d as
|
|
1
|
+
import { a as runWebhookDeliveryJob, i as registerWebhookRuntime, n as assertWebhookEvent, o as unregisterWebhookRuntime, s as WebhookStore, t as WebhookDispatcher } from "./chunks/dispatcher-B4n4hqB1.js";
|
|
2
|
+
import { _ as assertHmacSecret, a as WebhookDeliveryCollection, b as sendPublicWebhook, c as WebhookSubscriptionCollection, d as assertWebhookProfileSecret, f as buildWebhookHeaders, g as verifyWebhookSignature, h as signWebhookPayload, i as WebhookDelivery, l as DEFAULT_WEBHOOK_TOLERANCE_MS, m as resolveWebhookSigningProfile, n as webhookAdminView, o as WebhookDeliveryTask, p as formatWebhookTimestamp, r as WebhookCursor, s as WebhookSubscription, t as WebhookAdminService, u as WEBHOOK_SIGNING_PRESETS, v as assertWebhookUrl, y as isPublicAddress } from "./chunks/admin-BAWFGnX4.js";
|
|
3
3
|
import { GlobalInterceptors, ObjectRegistry, SmrtRecipe, getChangesSince } from "@happyvertical/smrt-core";
|
|
4
4
|
import { requireTenant } from "@happyvertical/smrt-tenancy";
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
6
6
|
//#region src/__smrt-register__.ts
|
|
7
|
-
ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-webhooks","packageVersion":"0.62.4","objects":{"@happyvertical/smrt-webhooks:WebhookSubscription":{"name":"webhooksubscription","className":"WebhookSubscription","qualifiedName":"@happyvertical/smrt-webhooks:WebhookSubscription","collection":"webhooksubscriptions","description":"Server-only subscription. Hosts authorize administration before accessing it.","filePath":"src/models.ts","packageName":"@happyvertical/smrt-webhooks","fields":{"tenantId":{"type":"text","_meta":{"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":true,"autoPopulate":true,"nullable":false,"mode":"required","field":"tenantId","allowSuperAdminBypass":false},"__statedOptions":["sqlType","requiredFor","__tenancy"],"sqlType":"UUID","requiredFor":"tenant-scope"},"required":true},"url":{"type":"text","_meta":{"__statedOptions":["required","requiredFor"],"required":true,"requiredFor":"system-table"},"required":true},"events":{"type":"json","_meta":{"__statedOptions":[]},"required":false},"models":{"type":"json","_meta":{"__statedOptions":[]},"required":false},"secret":{"type":"text","_meta":{"__statedOptions":["sensitive","required","requiredFor"],"required":true,"sensitive":true,"requiredFor":"system-table"},"required":true,"sensitive":true},"enabled":{"type":"boolean","_meta":{"__statedOptions":["default"],"default":true},"required":false,"default":true}},"methods":{"save":{"name":"save","async":true,"parameters":[{"name":"options","type":"SmrtSaveOptions","optional":true}],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"_smrt_webhook_subscriptions","api":false,"cli":false,"mcp":false,"tenantScoped":{"mode":"required"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"WebhookSubscription","collectionExportName":"WebhookSubscriptionCollection","validationRules":[{"field":"url","rule":"required","fieldType":"text"},{"field":"secret","rule":"required","fieldType":"text"}],"schema":{"tableName":"_smrt_webhook_subscriptions","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_webhook_subscriptions\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"url\\" TEXT NOT NULL,\\n \\"events\\" JSON,\\n \\"models\\" JSON,\\n \\"secret\\" TEXT NOT NULL,\\n \\"enabled\\" BOOLEAN DEFAULT TRUE\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"url":{"type":"TEXT","notNull":true,"unique":false},"events":{"type":"JSON","notNull":false,"unique":false},"models":{"type":"JSON","notNull":false,"unique":false},"secret":{"type":"TEXT","notNull":true,"unique":false},"enabled":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true}},"indexes":[{"name":"_smrt_webhook_subscriptions_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"_smrt_webhook_subscriptions_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"1979c7f5"},"importPath":"@happyvertical/smrt-webhooks"},"@happyvertical/smrt-webhooks:WebhookSubscriptionCollection":{"name":"webhooksubscriptioncollection","className":"WebhookSubscriptionCollection","qualifiedName":"@happyvertical/smrt-webhooks:WebhookSubscriptionCollection","collection":"webhooksubscriptions","filePath":"src/models.ts","packageName":"@happyvertical/smrt-webhooks","fields":{},"methods":{},"decoratorConfig":{"tableName":"_smrt_webhook_subscriptions","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"WebhookSubscription","exportName":"WebhookSubscriptionCollection","collectionExportName":"WebhookSubscriptionCollectionCollection","collectionOf":"@happyvertical/smrt-webhooks:WebhookSubscription","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"_smrt_webhook_subscriptions","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_webhook_subscriptions\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"url\\" TEXT NOT NULL,\\n \\"events\\" JSON,\\n \\"models\\" JSON,\\n \\"secret\\" TEXT NOT NULL,\\n \\"enabled\\" BOOLEAN DEFAULT TRUE\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"url":{"type":"TEXT","notNull":true,"unique":false},"events":{"type":"JSON","notNull":false,"unique":false},"models":{"type":"JSON","notNull":false,"unique":false},"secret":{"type":"TEXT","notNull":true,"unique":false},"enabled":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true}},"indexes":[{"name":"_smrt_webhook_subscriptions_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"_smrt_webhook_subscriptions_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"1979c7f5"},"importPath":"@happyvertical/smrt-webhooks"},"@happyvertical/smrt-webhooks:WebhookDelivery":{"name":"webhookdelivery","className":"WebhookDelivery","qualifiedName":"@happyvertical/smrt-webhooks:WebhookDelivery","collection":"webhookdeliveries","description":"Durable outbox and safe outcome metadata; payload never appears in public projections.","filePath":"src/models.ts","packageName":"@happyvertical/smrt-webhooks","fields":{"tenantId":{"type":"text","_meta":{"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":true,"autoPopulate":true,"nullable":false,"mode":"required","field":"tenantId","allowSuperAdminBypass":false},"__statedOptions":["sqlType","requiredFor","__tenancy"],"sqlType":"UUID","requiredFor":"tenant-scope"},"required":true},"subscriptionId":{"type":"foreignKey","_meta":{"__statedOptions":["onUpdate","onDelete","related"],"onUpdate":"RESTRICT","onDelete":"RESTRICT"},"required":false,"related":"WebhookSubscription"},"eventId":{"type":"text","_meta":{"__statedOptions":["required","requiredFor"],"required":true,"requiredFor":"identity"},"required":true},"payload":{"type":"text","_meta":{"__statedOptions":["required","sensitive"],"required":true,"sensitive":true},"required":true,"sensitive":true},"status":{"type":"text","_meta":{"__statedOptions":["default"],"default":"pending"},"required":false,"default":"pending"},"generation":{"type":"integer","_meta":{"__statedOptions":["default"],"default":0},"required":false,"default":0},"attempts":{"type":"integer","_meta":{"__statedOptions":["default"],"default":0},"required":false,"default":0},"responseStatus":{"type":"integer","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false},"error":{"type":"text","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false},"leaseToken":{"type":"text","_meta":{"__statedOptions":["nullable","sensitive","required"],"sensitive":true,"nullable":true,"required":false},"required":false,"sensitive":true},"leaseUntil":{"type":"datetime","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false}},"methods":{},"decoratorConfig":{"tableName":"_smrt_webhook_deliveries","api":false,"cli":false,"mcp":false,"indexes":[{"name":"_smrt_webhook_delivery_identity","columns":["tenantId","subscriptionId","eventId"],"unique":true}],"tenantScoped":{"mode":"required"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"WebhookDelivery","collectionExportName":"WebhookDeliveryCollection","validationRules":[{"field":"eventId","rule":"required","fieldType":"text"},{"field":"payload","rule":"required","fieldType":"text"}],"schema":{"tableName":"_smrt_webhook_deliveries","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_webhook_deliveries\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"subscription_id\\" UUID,\\n \\"event_id\\" TEXT NOT NULL,\\n \\"payload\\" TEXT NOT NULL,\\n \\"status\\" TEXT DEFAULT 'pending',\\n \\"generation\\" INTEGER DEFAULT 0,\\n \\"attempts\\" INTEGER DEFAULT 0,\\n \\"response_status\\" INTEGER,\\n \\"error\\" TEXT,\\n \\"lease_token\\" TEXT,\\n \\"lease_until\\" TIMESTAMP\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"subscription_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"_smrt_webhook_subscriptions","column":"id","onDelete":"RESTRICT","onUpdate":"RESTRICT"}},"event_id":{"type":"TEXT","notNull":true,"unique":false},"payload":{"type":"TEXT","notNull":true,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"pending"},"generation":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"attempts":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"response_status":{"type":"INTEGER","notNull":false,"unique":false},"error":{"type":"TEXT","notNull":false,"unique":false},"lease_token":{"type":"TEXT","notNull":false,"unique":false},"lease_until":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_webhook_deliveries_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"_smrt_webhook_delivery_identity","columns":["tenant_id","subscription_id","event_id"],"unique":true},{"name":"_smrt_webhook_deliveries_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"_smrt_webhook_deliveries_subscription_id_idx","columns":["subscription_id"]}],"version":"ed54179d"},"importPath":"@happyvertical/smrt-webhooks"},"@happyvertical/smrt-webhooks:WebhookDeliveryCollection":{"name":"webhookdeliverycollection","className":"WebhookDeliveryCollection","qualifiedName":"@happyvertical/smrt-webhooks:WebhookDeliveryCollection","collection":"webhookdeliveries","filePath":"src/models.ts","packageName":"@happyvertical/smrt-webhooks","fields":{},"methods":{},"decoratorConfig":{"tableName":"_smrt_webhook_deliveries","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"WebhookDelivery","exportName":"WebhookDeliveryCollection","collectionExportName":"WebhookDeliveryCollectionCollection","collectionOf":"@happyvertical/smrt-webhooks:WebhookDelivery","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"_smrt_webhook_deliveries","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_webhook_deliveries\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"subscription_id\\" UUID,\\n \\"event_id\\" TEXT NOT NULL,\\n \\"payload\\" TEXT NOT NULL,\\n \\"status\\" TEXT DEFAULT 'pending',\\n \\"generation\\" INTEGER DEFAULT 0,\\n \\"attempts\\" INTEGER DEFAULT 0,\\n \\"response_status\\" INTEGER,\\n \\"error\\" TEXT,\\n \\"lease_token\\" TEXT,\\n \\"lease_until\\" TIMESTAMP\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"subscription_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"_smrt_webhook_subscriptions","column":"id","onDelete":"RESTRICT","onUpdate":"RESTRICT"}},"event_id":{"type":"TEXT","notNull":true,"unique":false},"payload":{"type":"TEXT","notNull":true,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"pending"},"generation":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"attempts":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"response_status":{"type":"INTEGER","notNull":false,"unique":false},"error":{"type":"TEXT","notNull":false,"unique":false},"lease_token":{"type":"TEXT","notNull":false,"unique":false},"lease_until":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_webhook_deliveries_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"_smrt_webhook_delivery_identity","columns":["tenant_id","subscription_id","event_id"],"unique":true},{"name":"_smrt_webhook_deliveries_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"_smrt_webhook_deliveries_subscription_id_idx","columns":["subscription_id"]}],"version":"ed54179d"},"importPath":"@happyvertical/smrt-webhooks"},"@happyvertical/smrt-webhooks:WebhookDeliveryTask":{"name":"webhookdeliverytask","className":"WebhookDeliveryTask","qualifiedName":"@happyvertical/smrt-webhooks:WebhookDeliveryTask","collection":"webhookdeliverytasks","description":"Jobs queue entry point; persisted arguments contain IDs only.","filePath":"src/models.ts","packageName":"@happyvertical/smrt-webhooks","fields":{},"methods":{"deliver":{"name":"deliver","async":true,"parameters":[{"name":"args","type":"Record<string, unknown>","optional":true},{"name":"_context","type":"JobExecutionContext","optional":true}],"returnType":"Promise<void>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"_smrt_webhook_delivery_tasks","api":false,"cli":false,"mcp":false},"extends":"SmrtObject","exportName":"WebhookDeliveryTask","collectionExportName":"WebhookDeliveryTaskCollection","schema":{"tableName":"_smrt_webhook_delivery_tasks","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_webhook_delivery_tasks\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"}},"indexes":[{"name":"_smrt_webhook_delivery_tasks_slug_context_idx","columns":["slug","context"],"unique":true},{"name":"_smrt_webhook_delivery_tasks_created_at_idx","columns":["created_at"]}],"version":"268c614c"},"importPath":"@happyvertical/smrt-webhooks"},"@happyvertical/smrt-webhooks:WebhookCursor":{"name":"webhookcursor","className":"WebhookCursor","qualifiedName":"@happyvertical/smrt-webhooks:WebhookCursor","collection":"webhookcursors","description":"Tenant-bound durable cursor for replayable model change-feed publication.","filePath":"src/models.ts","packageName":"@happyvertical/smrt-webhooks","fields":{"tenantId":{"type":"text","_meta":{"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":true,"autoPopulate":true,"nullable":false,"mode":"required","field":"tenantId","allowSuperAdminBypass":false},"__statedOptions":["sqlType","requiredFor","__tenancy"],"sqlType":"UUID","requiredFor":"tenant-scope"},"required":true},"runtime":{"type":"text","_meta":{"__statedOptions":["required","requiredFor"],"required":true,"requiredFor":"identity"},"required":true},"position":{"type":"integer","_meta":{"__statedOptions":["default"],"default":0},"required":false,"default":0}},"methods":{},"decoratorConfig":{"tableName":"_smrt_webhook_cursors","api":false,"cli":false,"mcp":false,"indexes":[{"name":"_smrt_webhook_cursor_identity","columns":["tenantId","runtime"],"unique":true}],"tenantScoped":{"mode":"required"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"WebhookCursor","collectionExportName":"WebhookCursorCollection","validationRules":[{"field":"runtime","rule":"required","fieldType":"text"}],"schema":{"tableName":"_smrt_webhook_cursors","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_webhook_cursors\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"runtime\\" TEXT NOT NULL,\\n \\"position\\" INTEGER DEFAULT 0\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"runtime":{"type":"TEXT","notNull":true,"unique":false},"position":{"type":"INTEGER","notNull":false,"unique":false,"default":0}},"indexes":[{"name":"_smrt_webhook_cursors_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"_smrt_webhook_cursor_identity","columns":["tenant_id","runtime"],"unique":true},{"name":"_smrt_webhook_cursors_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"f46a5a8e"},"importPath":"@happyvertical/smrt-webhooks"}},"moduleType":"smrt","recipes":[{"id":"integrations.webhooks","className":"WebhooksRecipe","label":"Outbound webhooks","summary":"Deliver signed model events and inspect delivery attempts from a server.","synonyms":[],"models":["@happyvertical/smrt-webhooks:WebhookSubscription","@happyvertical/smrt-webhooks:WebhookDelivery","@happyvertical/smrt-webhooks:WebhookDeliveryTask","@happyvertical/smrt-webhooks:WebhookCursor"],"nav":[],"requires":[],"group":{"id":"integrations","label":"Integrations","summary":"Connect your application to external services."},"help":{"markdown":"## Overview\\n\\nSend signed event notifications to an external HTTPS endpoint. Administrators\\ncan pause subscriptions and inspect delivery attempts. This integration requires\\na server and a running background worker.\\n\\n## Tasks\\n\\n- Add a subscription with a public HTTPS endpoint, signing secret, and event/model filters.\\n- Disable a subscription to cancel unsent deliveries.\\n- Inspect the delivery log, then retry failed deliveries after correcting their endpoint.\\n- Ask the endpoint owner to verify signatures and deduplicate delivery IDs.\\n","fieldRefs":[]},"surfaces":[{"kind":"settings-panel","export":"@happyvertical/smrt-webhooks/svelte#WebhookAdmin","label":"Outbound webhooks"}],"runtime":"server","demo":{"mode":"server","reasons":["The recipe declares runtime \\"server\\".","Needs a server because its package does not build for a browser: Intentionally server-only outbound delivery: node:crypto HMAC and node:https/dns/net pinned transport enforce signing and SSRF protection. Browser hosts use the separate /svelte admin export with authenticated server callbacks.; and its package depends on @happyvertical/smrt-jobs, @happyvertical/smrt-tenancy, which do not build for a browser (#3615, #3624, #3627, #3717)."]}}],"smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-jobs","@happyvertical/smrt-tenancy"],"browser":{"status":"server-only","issues":["#3615","#3624","#3627","#3717"],"reason":"Intentionally server-only outbound delivery: node:crypto HMAC and node:https/dns/net pinned transport enforce signing and SSRF protection. Browser hosts use the separate /svelte admin export with authenticated server callbacks.","via":["@happyvertical/smrt-jobs","@happyvertical/smrt-tenancy"]},"stampsConstructors":true}`));
|
|
7
|
+
ObjectRegistry.registerPackageManifest(JSON.parse(`{"version":"1.0.0","timestamp":0,"packageName":"@happyvertical/smrt-webhooks","packageVersion":"0.62.6","objects":{"@happyvertical/smrt-webhooks:WebhookSubscription":{"name":"webhooksubscription","className":"WebhookSubscription","qualifiedName":"@happyvertical/smrt-webhooks:WebhookSubscription","collection":"webhooksubscriptions","description":"Server-only subscription. Hosts authorize administration before accessing it.","filePath":"src/models.ts","packageName":"@happyvertical/smrt-webhooks","fields":{"tenantId":{"type":"text","_meta":{"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":true,"autoPopulate":true,"nullable":false,"mode":"required","field":"tenantId","allowSuperAdminBypass":false},"__statedOptions":["sqlType","requiredFor","__tenancy"],"sqlType":"UUID","requiredFor":"tenant-scope"},"required":true},"url":{"type":"text","_meta":{"__statedOptions":["required","requiredFor"],"required":true,"requiredFor":"system-table"},"required":true},"events":{"type":"json","_meta":{"__statedOptions":[]},"required":false},"models":{"type":"json","_meta":{"__statedOptions":[]},"required":false},"secret":{"type":"text","_meta":{"__statedOptions":["sensitive","required","requiredFor"],"required":true,"sensitive":true,"requiredFor":"system-table"},"required":true,"sensitive":true},"enabled":{"type":"boolean","_meta":{"__statedOptions":["default"],"default":true},"required":false,"default":true},"signingProfile":{"type":"json","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false}},"methods":{"save":{"name":"save","async":true,"parameters":[{"name":"options","type":"SmrtSaveOptions","optional":true}],"returnType":"Promise<this>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"_smrt_webhook_subscriptions","api":false,"cli":false,"mcp":false,"tenantScoped":{"mode":"required"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"WebhookSubscription","collectionExportName":"WebhookSubscriptionCollection","validationRules":[{"field":"url","rule":"required","fieldType":"text"},{"field":"secret","rule":"required","fieldType":"text"}],"schema":{"tableName":"_smrt_webhook_subscriptions","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_webhook_subscriptions\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"url\\" TEXT NOT NULL,\\n \\"events\\" JSON,\\n \\"models\\" JSON,\\n \\"secret\\" TEXT NOT NULL,\\n \\"enabled\\" BOOLEAN DEFAULT TRUE,\\n \\"signing_profile\\" JSON\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"url":{"type":"TEXT","notNull":true,"unique":false},"events":{"type":"JSON","notNull":false,"unique":false},"models":{"type":"JSON","notNull":false,"unique":false},"secret":{"type":"TEXT","notNull":true,"unique":false},"enabled":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true},"signing_profile":{"type":"JSON","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_webhook_subscriptions_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"_smrt_webhook_subscriptions_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"86156cdc"},"importPath":"@happyvertical/smrt-webhooks"},"@happyvertical/smrt-webhooks:WebhookSubscriptionCollection":{"name":"webhooksubscriptioncollection","className":"WebhookSubscriptionCollection","qualifiedName":"@happyvertical/smrt-webhooks:WebhookSubscriptionCollection","collection":"webhooksubscriptions","filePath":"src/models.ts","packageName":"@happyvertical/smrt-webhooks","fields":{},"methods":{},"decoratorConfig":{"tableName":"_smrt_webhook_subscriptions","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"WebhookSubscription","exportName":"WebhookSubscriptionCollection","collectionExportName":"WebhookSubscriptionCollectionCollection","collectionOf":"@happyvertical/smrt-webhooks:WebhookSubscription","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"_smrt_webhook_subscriptions","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_webhook_subscriptions\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"url\\" TEXT NOT NULL,\\n \\"events\\" JSON,\\n \\"models\\" JSON,\\n \\"secret\\" TEXT NOT NULL,\\n \\"enabled\\" BOOLEAN DEFAULT TRUE,\\n \\"signing_profile\\" JSON\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"url":{"type":"TEXT","notNull":true,"unique":false},"events":{"type":"JSON","notNull":false,"unique":false},"models":{"type":"JSON","notNull":false,"unique":false},"secret":{"type":"TEXT","notNull":true,"unique":false},"enabled":{"type":"BOOLEAN","notNull":false,"unique":false,"default":true},"signing_profile":{"type":"JSON","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_webhook_subscriptions_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"_smrt_webhook_subscriptions_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"86156cdc"},"importPath":"@happyvertical/smrt-webhooks"},"@happyvertical/smrt-webhooks:WebhookDelivery":{"name":"webhookdelivery","className":"WebhookDelivery","qualifiedName":"@happyvertical/smrt-webhooks:WebhookDelivery","collection":"webhookdeliveries","description":"Durable outbox and safe outcome metadata; payload never appears in public projections.","filePath":"src/models.ts","packageName":"@happyvertical/smrt-webhooks","fields":{"tenantId":{"type":"text","_meta":{"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":true,"autoPopulate":true,"nullable":false,"mode":"required","field":"tenantId","allowSuperAdminBypass":false},"__statedOptions":["sqlType","requiredFor","__tenancy"],"sqlType":"UUID","requiredFor":"tenant-scope"},"required":true},"subscriptionId":{"type":"foreignKey","_meta":{"__statedOptions":["onUpdate","onDelete","related"],"onUpdate":"RESTRICT","onDelete":"RESTRICT"},"required":false,"related":"WebhookSubscription"},"eventId":{"type":"text","_meta":{"__statedOptions":["required","requiredFor"],"required":true,"requiredFor":"identity"},"required":true},"payload":{"type":"text","_meta":{"__statedOptions":["required","sensitive"],"required":true,"sensitive":true},"required":true,"sensitive":true},"status":{"type":"text","_meta":{"__statedOptions":["default"],"default":"pending"},"required":false,"default":"pending"},"generation":{"type":"integer","_meta":{"__statedOptions":["default"],"default":0},"required":false,"default":0},"attempts":{"type":"integer","_meta":{"__statedOptions":["default"],"default":0},"required":false,"default":0},"responseStatus":{"type":"integer","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false},"error":{"type":"text","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false},"leaseToken":{"type":"text","_meta":{"__statedOptions":["nullable","sensitive","required"],"sensitive":true,"nullable":true,"required":false},"required":false,"sensitive":true},"leaseUntil":{"type":"datetime","_meta":{"__statedOptions":["nullable","required"],"nullable":true,"required":false},"required":false}},"methods":{},"decoratorConfig":{"tableName":"_smrt_webhook_deliveries","api":false,"cli":false,"mcp":false,"indexes":[{"name":"_smrt_webhook_delivery_identity","columns":["tenantId","subscriptionId","eventId"],"unique":true}],"tenantScoped":{"mode":"required"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"WebhookDelivery","collectionExportName":"WebhookDeliveryCollection","validationRules":[{"field":"eventId","rule":"required","fieldType":"text"},{"field":"payload","rule":"required","fieldType":"text"}],"schema":{"tableName":"_smrt_webhook_deliveries","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_webhook_deliveries\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"subscription_id\\" UUID,\\n \\"event_id\\" TEXT NOT NULL,\\n \\"payload\\" TEXT NOT NULL,\\n \\"status\\" TEXT DEFAULT 'pending',\\n \\"generation\\" INTEGER DEFAULT 0,\\n \\"attempts\\" INTEGER DEFAULT 0,\\n \\"response_status\\" INTEGER,\\n \\"error\\" TEXT,\\n \\"lease_token\\" TEXT,\\n \\"lease_until\\" TIMESTAMP\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"subscription_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"_smrt_webhook_subscriptions","column":"id","onDelete":"RESTRICT","onUpdate":"RESTRICT"}},"event_id":{"type":"TEXT","notNull":true,"unique":false},"payload":{"type":"TEXT","notNull":true,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"pending"},"generation":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"attempts":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"response_status":{"type":"INTEGER","notNull":false,"unique":false},"error":{"type":"TEXT","notNull":false,"unique":false},"lease_token":{"type":"TEXT","notNull":false,"unique":false},"lease_until":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_webhook_deliveries_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"_smrt_webhook_delivery_identity","columns":["tenant_id","subscription_id","event_id"],"unique":true},{"name":"_smrt_webhook_deliveries_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"_smrt_webhook_deliveries_subscription_id_idx","columns":["subscription_id"]}],"version":"ed54179d"},"importPath":"@happyvertical/smrt-webhooks"},"@happyvertical/smrt-webhooks:WebhookDeliveryCollection":{"name":"webhookdeliverycollection","className":"WebhookDeliveryCollection","qualifiedName":"@happyvertical/smrt-webhooks:WebhookDeliveryCollection","collection":"webhookdeliveries","filePath":"src/models.ts","packageName":"@happyvertical/smrt-webhooks","fields":{},"methods":{},"decoratorConfig":{"tableName":"_smrt_webhook_deliveries","api":false,"mcp":false,"cli":false},"extends":"SmrtCollection","extendsTypeArg":"WebhookDelivery","exportName":"WebhookDeliveryCollection","collectionExportName":"WebhookDeliveryCollectionCollection","collectionOf":"@happyvertical/smrt-webhooks:WebhookDelivery","inheritedExposure":["api","mcp","cli"],"schema":{"tableName":"_smrt_webhook_deliveries","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_webhook_deliveries\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"subscription_id\\" UUID,\\n \\"event_id\\" TEXT NOT NULL,\\n \\"payload\\" TEXT NOT NULL,\\n \\"status\\" TEXT DEFAULT 'pending',\\n \\"generation\\" INTEGER DEFAULT 0,\\n \\"attempts\\" INTEGER DEFAULT 0,\\n \\"response_status\\" INTEGER,\\n \\"error\\" TEXT,\\n \\"lease_token\\" TEXT,\\n \\"lease_until\\" TIMESTAMP\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"subscription_id":{"type":"UUID","referenceKind":"foreignKey","notNull":false,"unique":false,"foreignKey":{"table":"_smrt_webhook_subscriptions","column":"id","onDelete":"RESTRICT","onUpdate":"RESTRICT"}},"event_id":{"type":"TEXT","notNull":true,"unique":false},"payload":{"type":"TEXT","notNull":true,"unique":false},"status":{"type":"TEXT","notNull":false,"unique":false,"default":"pending"},"generation":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"attempts":{"type":"INTEGER","notNull":false,"unique":false,"default":0},"response_status":{"type":"INTEGER","notNull":false,"unique":false},"error":{"type":"TEXT","notNull":false,"unique":false},"lease_token":{"type":"TEXT","notNull":false,"unique":false},"lease_until":{"type":"TIMESTAMP","notNull":false,"unique":false}},"indexes":[{"name":"_smrt_webhook_deliveries_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"_smrt_webhook_delivery_identity","columns":["tenant_id","subscription_id","event_id"],"unique":true},{"name":"_smrt_webhook_deliveries_tenant_id_created_at_idx","columns":["tenant_id","created_at"]},{"name":"_smrt_webhook_deliveries_subscription_id_idx","columns":["subscription_id"]}],"version":"ed54179d"},"importPath":"@happyvertical/smrt-webhooks"},"@happyvertical/smrt-webhooks:WebhookDeliveryTask":{"name":"webhookdeliverytask","className":"WebhookDeliveryTask","qualifiedName":"@happyvertical/smrt-webhooks:WebhookDeliveryTask","collection":"webhookdeliverytasks","description":"Jobs queue entry point; persisted arguments contain IDs only.","filePath":"src/models.ts","packageName":"@happyvertical/smrt-webhooks","fields":{},"methods":{"deliver":{"name":"deliver","async":true,"parameters":[{"name":"args","type":"Record<string, unknown>","optional":true},{"name":"_context","type":"JobExecutionContext","optional":true}],"returnType":"Promise<void>","isStatic":false,"isPublic":true}},"decoratorConfig":{"tableName":"_smrt_webhook_delivery_tasks","api":false,"cli":false,"mcp":false},"extends":"SmrtObject","exportName":"WebhookDeliveryTask","collectionExportName":"WebhookDeliveryTaskCollection","schema":{"tableName":"_smrt_webhook_delivery_tasks","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_webhook_delivery_tasks\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"}},"indexes":[{"name":"_smrt_webhook_delivery_tasks_slug_context_idx","columns":["slug","context"],"unique":true},{"name":"_smrt_webhook_delivery_tasks_created_at_idx","columns":["created_at"]}],"version":"268c614c"},"importPath":"@happyvertical/smrt-webhooks"},"@happyvertical/smrt-webhooks:WebhookCursor":{"name":"webhookcursor","className":"WebhookCursor","qualifiedName":"@happyvertical/smrt-webhooks:WebhookCursor","collection":"webhookcursors","description":"Tenant-bound durable cursor for replayable model change-feed publication.","filePath":"src/models.ts","packageName":"@happyvertical/smrt-webhooks","fields":{"tenantId":{"type":"text","_meta":{"__tenancy":{"isTenantIdField":true,"autoFilter":true,"required":true,"autoPopulate":true,"nullable":false,"mode":"required","field":"tenantId","allowSuperAdminBypass":false},"__statedOptions":["sqlType","requiredFor","__tenancy"],"sqlType":"UUID","requiredFor":"tenant-scope"},"required":true},"runtime":{"type":"text","_meta":{"__statedOptions":["required","requiredFor"],"required":true,"requiredFor":"identity"},"required":true},"position":{"type":"integer","_meta":{"__statedOptions":["default"],"default":0},"required":false,"default":0}},"methods":{},"decoratorConfig":{"tableName":"_smrt_webhook_cursors","api":false,"cli":false,"mcp":false,"indexes":[{"name":"_smrt_webhook_cursor_identity","columns":["tenantId","runtime"],"unique":true}],"tenantScoped":{"mode":"required"},"conflictColumns":["tenant_id","slug","context"]},"extends":"SmrtObject","exportName":"WebhookCursor","collectionExportName":"WebhookCursorCollection","validationRules":[{"field":"runtime","rule":"required","fieldType":"text"}],"schema":{"tableName":"_smrt_webhook_cursors","ddl":"CREATE TABLE IF NOT EXISTS \\"_smrt_webhook_cursors\\" (\\n \\"_sync_origin_device_id\\" TEXT,\\n \\"_sync_revision\\" INTEGER,\\n \\"id\\" UUID PRIMARY KEY NOT NULL,\\n \\"slug\\" TEXT NOT NULL,\\n \\"context\\" TEXT NOT NULL DEFAULT '',\\n \\"created_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"updated_at\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\n \\"tenant_id\\" UUID NOT NULL,\\n \\"runtime\\" TEXT NOT NULL,\\n \\"position\\" INTEGER DEFAULT 0\\n);","columns":{"_sync_origin_device_id":{"type":"TEXT"},"_sync_revision":{"type":"INTEGER"},"id":{"type":"UUID","primaryKey":true,"referenceKind":"id","notNull":true},"slug":{"type":"TEXT","notNull":true},"context":{"type":"TEXT","notNull":true,"default":""},"created_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"updated_at":{"type":"TIMESTAMP","notNull":true,"default":"current_timestamp"},"tenant_id":{"type":"UUID","referenceKind":"tenantId","notNull":true,"unique":false},"runtime":{"type":"TEXT","notNull":true,"unique":false},"position":{"type":"INTEGER","notNull":false,"unique":false,"default":0}},"indexes":[{"name":"_smrt_webhook_cursors_slug_context_idx","columns":["tenant_id","slug","context"],"unique":true},{"name":"_smrt_webhook_cursor_identity","columns":["tenant_id","runtime"],"unique":true},{"name":"_smrt_webhook_cursors_tenant_id_created_at_idx","columns":["tenant_id","created_at"]}],"version":"f46a5a8e"},"importPath":"@happyvertical/smrt-webhooks"}},"moduleType":"smrt","recipes":[{"id":"integrations.webhooks","className":"WebhooksRecipe","label":"Outbound webhooks","summary":"Deliver signed model events and inspect delivery attempts from a server.","synonyms":[],"models":["@happyvertical/smrt-webhooks:WebhookSubscription","@happyvertical/smrt-webhooks:WebhookDelivery","@happyvertical/smrt-webhooks:WebhookDeliveryTask","@happyvertical/smrt-webhooks:WebhookCursor"],"nav":[],"requires":[],"group":{"id":"integrations","label":"Integrations","summary":"Connect your application to external services."},"help":{"markdown":"## Overview\\n\\nSend signed event notifications to an external HTTPS endpoint. Administrators\\ncan pause subscriptions and inspect delivery attempts. This integration requires\\na server and a running background worker.\\n\\n## Tasks\\n\\n- Add a subscription with a public HTTPS endpoint, signing secret, and event/model filters.\\n- Disable a subscription to cancel unsent deliveries.\\n- Inspect the delivery log, then retry failed deliveries after correcting their endpoint.\\n- Ask the endpoint owner to verify signatures and deduplicate delivery IDs.\\n","fieldRefs":[]},"surfaces":[{"kind":"settings-panel","export":"@happyvertical/smrt-webhooks/svelte#WebhookAdmin","label":"Outbound webhooks"}],"runtime":"server","demo":{"mode":"server","reasons":["The recipe declares runtime \\"server\\".","Needs a server because its package does not build for a browser: Intentionally server-only outbound delivery: node:crypto HMAC and node:https/dns/net pinned transport enforce signing and SSRF protection. Browser hosts use the separate /svelte admin export with authenticated server callbacks.; and its package depends on @happyvertical/smrt-jobs, @happyvertical/smrt-tenancy, which do not build for a browser (#3615, #3624, #3627, #3717)."]}}],"smrtDependencies":["@happyvertical/smrt-core","@happyvertical/smrt-jobs","@happyvertical/smrt-tenancy"],"browser":{"status":"server-only","issues":["#3615","#3624","#3627","#3717"],"reason":"Intentionally server-only outbound delivery: node:crypto HMAC and node:https/dns/net pinned transport enforce signing and SSRF protection. Browser hosts use the separate /svelte admin export with authenticated server callbacks.","via":["@happyvertical/smrt-jobs","@happyvertical/smrt-tenancy"]},"stampsConstructors":true}`));
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/change-feed.ts
|
|
10
10
|
var WebhookHistoryExpiredError = class extends Error {
|
|
@@ -143,6 +143,6 @@ var WebhooksRecipe = class extends SmrtRecipe {
|
|
|
143
143
|
static help = "./webhooks.recipe.md";
|
|
144
144
|
};
|
|
145
145
|
//#endregion
|
|
146
|
-
export { DEFAULT_WEBHOOK_TOLERANCE_MS, WebhookAdminService, WebhookChangeFeed, WebhookCursor, WebhookDelivery, WebhookDeliveryCollection, WebhookDeliveryTask, WebhookDispatcher, WebhookHistoryExpiredError, WebhookStore, WebhookSubscription, WebhookSubscriptionCollection, WebhooksRecipe, assertHmacSecret, assertWebhookEvent, assertWebhookUrl, isPublicAddress, registerWebhookModelEvents, registerWebhookRuntime, runWebhookDeliveryJob, sendPublicWebhook, signWebhookPayload, unregisterWebhookRuntime, verifyWebhookSignature, webhookAdminView };
|
|
146
|
+
export { DEFAULT_WEBHOOK_TOLERANCE_MS, WEBHOOK_SIGNING_PRESETS, WebhookAdminService, WebhookChangeFeed, WebhookCursor, WebhookDelivery, WebhookDeliveryCollection, WebhookDeliveryTask, WebhookDispatcher, WebhookHistoryExpiredError, WebhookStore, WebhookSubscription, WebhookSubscriptionCollection, WebhooksRecipe, assertHmacSecret, assertWebhookEvent, assertWebhookProfileSecret, assertWebhookUrl, buildWebhookHeaders, formatWebhookTimestamp, isPublicAddress, registerWebhookModelEvents, registerWebhookRuntime, resolveWebhookSigningProfile, runWebhookDeliveryJob, sendPublicWebhook, signWebhookPayload, unregisterWebhookRuntime, verifyWebhookSignature, webhookAdminView };
|
|
147
147
|
|
|
148
148
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/__smrt-register__.ts","../src/change-feed.ts","../src/events.ts","../src/recipes.ts"],"sourcesContent":["// Generated by @happyvertical/smrt-core smrtPlugin at library build time.\n// The package manifest is inlined so self-registration cannot miss when a\n// downstream bundler relocates this module away from dist/manifest.json\n// (https://github.com/happyvertical/smrt/issues/1506,\n// https://github.com/happyvertical/smrt/issues/1507).\nimport { ObjectRegistry } from '@happyvertical/smrt-core';\n\nObjectRegistry.registerPackageManifest(JSON.parse(\"{\\\"version\\\":\\\"1.0.0\\\",\\\"timestamp\\\":0,\\\"packageName\\\":\\\"@happyvertical/smrt-webhooks\\\",\\\"packageVersion\\\":\\\"0.62.4\\\",\\\"objects\\\":{\\\"@happyvertical/smrt-webhooks:WebhookSubscription\\\":{\\\"name\\\":\\\"webhooksubscription\\\",\\\"className\\\":\\\"WebhookSubscription\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-webhooks:WebhookSubscription\\\",\\\"collection\\\":\\\"webhooksubscriptions\\\",\\\"description\\\":\\\"Server-only subscription. Hosts authorize administration before accessing it.\\\",\\\"filePath\\\":\\\"src/models.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-webhooks\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"requiredFor\\\",\\\"__tenancy\\\"],\\\"sqlType\\\":\\\"UUID\\\",\\\"requiredFor\\\":\\\"tenant-scope\\\"},\\\"required\\\":true},\\\"url\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"requiredFor\\\"],\\\"required\\\":true,\\\"requiredFor\\\":\\\"system-table\\\"},\\\"required\\\":true},\\\"events\\\":{\\\"type\\\":\\\"json\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"models\\\":{\\\"type\\\":\\\"json\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"secret\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"sensitive\\\",\\\"required\\\",\\\"requiredFor\\\"],\\\"required\\\":true,\\\"sensitive\\\":true,\\\"requiredFor\\\":\\\"system-table\\\"},\\\"required\\\":true,\\\"sensitive\\\":true},\\\"enabled\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"],\\\"default\\\":true},\\\"required\\\":false,\\\"default\\\":true}},\\\"methods\\\":{\\\"save\\\":{\\\"name\\\":\\\"save\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"SmrtSaveOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"_smrt_webhook_subscriptions\\\",\\\"api\\\":false,\\\"cli\\\":false,\\\"mcp\\\":false,\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"WebhookSubscription\\\",\\\"collectionExportName\\\":\\\"WebhookSubscriptionCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"url\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"secret\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"_smrt_webhook_subscriptions\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"_smrt_webhook_subscriptions\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"url\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"events\\\\\\\" JSON,\\\\n \\\\\\\"models\\\\\\\" JSON,\\\\n \\\\\\\"secret\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"enabled\\\\\\\" BOOLEAN DEFAULT TRUE\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"url\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"events\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"models\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"secret\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"enabled\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":true}},\\\"indexes\\\":[{\\\"name\\\":\\\"_smrt_webhook_subscriptions_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"_smrt_webhook_subscriptions_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]}],\\\"version\\\":\\\"1979c7f5\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-webhooks\\\"},\\\"@happyvertical/smrt-webhooks:WebhookSubscriptionCollection\\\":{\\\"name\\\":\\\"webhooksubscriptioncollection\\\",\\\"className\\\":\\\"WebhookSubscriptionCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-webhooks:WebhookSubscriptionCollection\\\",\\\"collection\\\":\\\"webhooksubscriptions\\\",\\\"filePath\\\":\\\"src/models.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-webhooks\\\",\\\"fields\\\":{},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"_smrt_webhook_subscriptions\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"WebhookSubscription\\\",\\\"exportName\\\":\\\"WebhookSubscriptionCollection\\\",\\\"collectionExportName\\\":\\\"WebhookSubscriptionCollectionCollection\\\",\\\"collectionOf\\\":\\\"@happyvertical/smrt-webhooks:WebhookSubscription\\\",\\\"inheritedExposure\\\":[\\\"api\\\",\\\"mcp\\\",\\\"cli\\\"],\\\"schema\\\":{\\\"tableName\\\":\\\"_smrt_webhook_subscriptions\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"_smrt_webhook_subscriptions\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"url\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"events\\\\\\\" JSON,\\\\n \\\\\\\"models\\\\\\\" JSON,\\\\n \\\\\\\"secret\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"enabled\\\\\\\" BOOLEAN DEFAULT TRUE\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"url\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"events\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"models\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"secret\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"enabled\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":true}},\\\"indexes\\\":[{\\\"name\\\":\\\"_smrt_webhook_subscriptions_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"_smrt_webhook_subscriptions_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]}],\\\"version\\\":\\\"1979c7f5\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-webhooks\\\"},\\\"@happyvertical/smrt-webhooks:WebhookDelivery\\\":{\\\"name\\\":\\\"webhookdelivery\\\",\\\"className\\\":\\\"WebhookDelivery\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-webhooks:WebhookDelivery\\\",\\\"collection\\\":\\\"webhookdeliveries\\\",\\\"description\\\":\\\"Durable outbox and safe outcome metadata; payload never appears in public projections.\\\",\\\"filePath\\\":\\\"src/models.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-webhooks\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"requiredFor\\\",\\\"__tenancy\\\"],\\\"sqlType\\\":\\\"UUID\\\",\\\"requiredFor\\\":\\\"tenant-scope\\\"},\\\"required\\\":true},\\\"subscriptionId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"onUpdate\\\",\\\"onDelete\\\",\\\"related\\\"],\\\"onUpdate\\\":\\\"RESTRICT\\\",\\\"onDelete\\\":\\\"RESTRICT\\\"},\\\"required\\\":false,\\\"related\\\":\\\"WebhookSubscription\\\"},\\\"eventId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"requiredFor\\\"],\\\"required\\\":true,\\\"requiredFor\\\":\\\"identity\\\"},\\\"required\\\":true},\\\"payload\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"sensitive\\\"],\\\"required\\\":true,\\\"sensitive\\\":true},\\\"required\\\":true,\\\"sensitive\\\":true},\\\"status\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"],\\\"default\\\":\\\"pending\\\"},\\\"required\\\":false,\\\"default\\\":\\\"pending\\\"},\\\"generation\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"],\\\"default\\\":0},\\\"required\\\":false,\\\"default\\\":0},\\\"attempts\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"],\\\"default\\\":0},\\\"required\\\":false,\\\"default\\\":0},\\\"responseStatus\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"required\\\"],\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false},\\\"error\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"required\\\"],\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false},\\\"leaseToken\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"sensitive\\\",\\\"required\\\"],\\\"sensitive\\\":true,\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false,\\\"sensitive\\\":true},\\\"leaseUntil\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"required\\\"],\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"_smrt_webhook_deliveries\\\",\\\"api\\\":false,\\\"cli\\\":false,\\\"mcp\\\":false,\\\"indexes\\\":[{\\\"name\\\":\\\"_smrt_webhook_delivery_identity\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"subscriptionId\\\",\\\"eventId\\\"],\\\"unique\\\":true}],\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"WebhookDelivery\\\",\\\"collectionExportName\\\":\\\"WebhookDeliveryCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"eventId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"payload\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"_smrt_webhook_deliveries\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"_smrt_webhook_deliveries\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"subscription_id\\\\\\\" UUID,\\\\n \\\\\\\"event_id\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"payload\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"status\\\\\\\" TEXT DEFAULT 'pending',\\\\n \\\\\\\"generation\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"attempts\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"response_status\\\\\\\" INTEGER,\\\\n \\\\\\\"error\\\\\\\" TEXT,\\\\n \\\\\\\"lease_token\\\\\\\" TEXT,\\\\n \\\\\\\"lease_until\\\\\\\" TIMESTAMP\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"subscription_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"_smrt_webhook_subscriptions\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"RESTRICT\\\",\\\"onUpdate\\\":\\\"RESTRICT\\\"}},\\\"event_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"payload\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"pending\\\"},\\\"generation\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":0},\\\"attempts\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":0},\\\"response_status\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"error\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"lease_token\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"lease_until\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"_smrt_webhook_deliveries_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"_smrt_webhook_delivery_identity\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"subscription_id\\\",\\\"event_id\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"_smrt_webhook_deliveries_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"_smrt_webhook_deliveries_subscription_id_idx\\\",\\\"columns\\\":[\\\"subscription_id\\\"]}],\\\"version\\\":\\\"ed54179d\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-webhooks\\\"},\\\"@happyvertical/smrt-webhooks:WebhookDeliveryCollection\\\":{\\\"name\\\":\\\"webhookdeliverycollection\\\",\\\"className\\\":\\\"WebhookDeliveryCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-webhooks:WebhookDeliveryCollection\\\",\\\"collection\\\":\\\"webhookdeliveries\\\",\\\"filePath\\\":\\\"src/models.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-webhooks\\\",\\\"fields\\\":{},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"_smrt_webhook_deliveries\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"WebhookDelivery\\\",\\\"exportName\\\":\\\"WebhookDeliveryCollection\\\",\\\"collectionExportName\\\":\\\"WebhookDeliveryCollectionCollection\\\",\\\"collectionOf\\\":\\\"@happyvertical/smrt-webhooks:WebhookDelivery\\\",\\\"inheritedExposure\\\":[\\\"api\\\",\\\"mcp\\\",\\\"cli\\\"],\\\"schema\\\":{\\\"tableName\\\":\\\"_smrt_webhook_deliveries\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"_smrt_webhook_deliveries\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"subscription_id\\\\\\\" UUID,\\\\n \\\\\\\"event_id\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"payload\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"status\\\\\\\" TEXT DEFAULT 'pending',\\\\n \\\\\\\"generation\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"attempts\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"response_status\\\\\\\" INTEGER,\\\\n \\\\\\\"error\\\\\\\" TEXT,\\\\n \\\\\\\"lease_token\\\\\\\" TEXT,\\\\n \\\\\\\"lease_until\\\\\\\" TIMESTAMP\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"subscription_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"_smrt_webhook_subscriptions\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"RESTRICT\\\",\\\"onUpdate\\\":\\\"RESTRICT\\\"}},\\\"event_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"payload\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"pending\\\"},\\\"generation\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":0},\\\"attempts\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":0},\\\"response_status\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"error\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"lease_token\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"lease_until\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"_smrt_webhook_deliveries_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"_smrt_webhook_delivery_identity\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"subscription_id\\\",\\\"event_id\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"_smrt_webhook_deliveries_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"_smrt_webhook_deliveries_subscription_id_idx\\\",\\\"columns\\\":[\\\"subscription_id\\\"]}],\\\"version\\\":\\\"ed54179d\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-webhooks\\\"},\\\"@happyvertical/smrt-webhooks:WebhookDeliveryTask\\\":{\\\"name\\\":\\\"webhookdeliverytask\\\",\\\"className\\\":\\\"WebhookDeliveryTask\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-webhooks:WebhookDeliveryTask\\\",\\\"collection\\\":\\\"webhookdeliverytasks\\\",\\\"description\\\":\\\"Jobs queue entry point; persisted arguments contain IDs only.\\\",\\\"filePath\\\":\\\"src/models.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-webhooks\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"deliver\\\":{\\\"name\\\":\\\"deliver\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"args\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":true},{\\\"name\\\":\\\"_context\\\",\\\"type\\\":\\\"JobExecutionContext\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"_smrt_webhook_delivery_tasks\\\",\\\"api\\\":false,\\\"cli\\\":false,\\\"mcp\\\":false},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"WebhookDeliveryTask\\\",\\\"collectionExportName\\\":\\\"WebhookDeliveryTaskCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"_smrt_webhook_delivery_tasks\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"_smrt_webhook_delivery_tasks\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"}},\\\"indexes\\\":[{\\\"name\\\":\\\"_smrt_webhook_delivery_tasks_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"_smrt_webhook_delivery_tasks_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"268c614c\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-webhooks\\\"},\\\"@happyvertical/smrt-webhooks:WebhookCursor\\\":{\\\"name\\\":\\\"webhookcursor\\\",\\\"className\\\":\\\"WebhookCursor\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-webhooks:WebhookCursor\\\",\\\"collection\\\":\\\"webhookcursors\\\",\\\"description\\\":\\\"Tenant-bound durable cursor for replayable model change-feed publication.\\\",\\\"filePath\\\":\\\"src/models.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-webhooks\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"requiredFor\\\",\\\"__tenancy\\\"],\\\"sqlType\\\":\\\"UUID\\\",\\\"requiredFor\\\":\\\"tenant-scope\\\"},\\\"required\\\":true},\\\"runtime\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"requiredFor\\\"],\\\"required\\\":true,\\\"requiredFor\\\":\\\"identity\\\"},\\\"required\\\":true},\\\"position\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"],\\\"default\\\":0},\\\"required\\\":false,\\\"default\\\":0}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"_smrt_webhook_cursors\\\",\\\"api\\\":false,\\\"cli\\\":false,\\\"mcp\\\":false,\\\"indexes\\\":[{\\\"name\\\":\\\"_smrt_webhook_cursor_identity\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"runtime\\\"],\\\"unique\\\":true}],\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"WebhookCursor\\\",\\\"collectionExportName\\\":\\\"WebhookCursorCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"runtime\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"_smrt_webhook_cursors\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"_smrt_webhook_cursors\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"runtime\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"position\\\\\\\" INTEGER DEFAULT 0\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"runtime\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"position\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":0}},\\\"indexes\\\":[{\\\"name\\\":\\\"_smrt_webhook_cursors_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"_smrt_webhook_cursor_identity\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"runtime\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"_smrt_webhook_cursors_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]}],\\\"version\\\":\\\"f46a5a8e\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-webhooks\\\"}},\\\"moduleType\\\":\\\"smrt\\\",\\\"recipes\\\":[{\\\"id\\\":\\\"integrations.webhooks\\\",\\\"className\\\":\\\"WebhooksRecipe\\\",\\\"label\\\":\\\"Outbound webhooks\\\",\\\"summary\\\":\\\"Deliver signed model events and inspect delivery attempts from a server.\\\",\\\"synonyms\\\":[],\\\"models\\\":[\\\"@happyvertical/smrt-webhooks:WebhookSubscription\\\",\\\"@happyvertical/smrt-webhooks:WebhookDelivery\\\",\\\"@happyvertical/smrt-webhooks:WebhookDeliveryTask\\\",\\\"@happyvertical/smrt-webhooks:WebhookCursor\\\"],\\\"nav\\\":[],\\\"requires\\\":[],\\\"group\\\":{\\\"id\\\":\\\"integrations\\\",\\\"label\\\":\\\"Integrations\\\",\\\"summary\\\":\\\"Connect your application to external services.\\\"},\\\"help\\\":{\\\"markdown\\\":\\\"## Overview\\\\n\\\\nSend signed event notifications to an external HTTPS endpoint. Administrators\\\\ncan pause subscriptions and inspect delivery attempts. This integration requires\\\\na server and a running background worker.\\\\n\\\\n## Tasks\\\\n\\\\n- Add a subscription with a public HTTPS endpoint, signing secret, and event/model filters.\\\\n- Disable a subscription to cancel unsent deliveries.\\\\n- Inspect the delivery log, then retry failed deliveries after correcting their endpoint.\\\\n- Ask the endpoint owner to verify signatures and deduplicate delivery IDs.\\\\n\\\",\\\"fieldRefs\\\":[]},\\\"surfaces\\\":[{\\\"kind\\\":\\\"settings-panel\\\",\\\"export\\\":\\\"@happyvertical/smrt-webhooks/svelte#WebhookAdmin\\\",\\\"label\\\":\\\"Outbound webhooks\\\"}],\\\"runtime\\\":\\\"server\\\",\\\"demo\\\":{\\\"mode\\\":\\\"server\\\",\\\"reasons\\\":[\\\"The recipe declares runtime \\\\\\\"server\\\\\\\".\\\",\\\"Needs a server because its package does not build for a browser: Intentionally server-only outbound delivery: node:crypto HMAC and node:https/dns/net pinned transport enforce signing and SSRF protection. Browser hosts use the separate /svelte admin export with authenticated server callbacks.; and its package depends on @happyvertical/smrt-jobs, @happyvertical/smrt-tenancy, which do not build for a browser (#3615, #3624, #3627, #3717).\\\"]}}],\\\"smrtDependencies\\\":[\\\"@happyvertical/smrt-core\\\",\\\"@happyvertical/smrt-jobs\\\",\\\"@happyvertical/smrt-tenancy\\\"],\\\"browser\\\":{\\\"status\\\":\\\"server-only\\\",\\\"issues\\\":[\\\"#3615\\\",\\\"#3624\\\",\\\"#3627\\\",\\\"#3717\\\"],\\\"reason\\\":\\\"Intentionally server-only outbound delivery: node:crypto HMAC and node:https/dns/net pinned transport enforce signing and SSRF protection. Browser hosts use the separate /svelte admin export with authenticated server callbacks.\\\",\\\"via\\\":[\\\"@happyvertical/smrt-jobs\\\",\\\"@happyvertical/smrt-tenancy\\\"]},\\\"stampsConstructors\\\":true}\"));\n","import { randomUUID } from 'node:crypto';\nimport { getChangesSince } from '@happyvertical/smrt-core';\nimport { requireTenant } from '@happyvertical/smrt-tenancy';\nimport type { WebhookDispatcher } from './dispatcher.js';\n\nexport class WebhookHistoryExpiredError extends Error {\n constructor(readonly resumeCursor: number) {\n super(\n 'Webhook change history expired; reconcile source state before resetting the cursor.',\n );\n }\n}\n\n/** Durable, replayable lifecycle publication from SMRT's committed change feed.\n * Host scheduling calls poll() in each authenticated tenant context. The mapping\n * is an explicit physical-table allowlist; shared STI tables represent the base model.\n */\nexport class WebhookChangeFeed {\n constructor(\n private readonly dispatcher: WebhookDispatcher,\n private readonly models: Readonly<Record<string, string>>,\n ) {\n if (\n !Object.keys(models).length ||\n Object.keys(models).some((table) => table.startsWith('_smrt_')) ||\n Object.values(models).some((model) => !model)\n )\n throw new Error('Explicit application model tables are required.');\n }\n /** Cursor only advances after all matched changes have durable outbox/jobs.\n * A crash or partial failure replays the same stable identities on the next poll.\n * History pruning fails loudly: the host must reconcile source state before reset.\n */\n async poll(): Promise<{ cursor: number; published: number }> {\n const tenantId = requireTenant().tenantId;\n const { db, runtime } = this.dispatcher.store;\n const now = new Date().toISOString();\n const id = randomUUID();\n await db.query(\n `INSERT INTO _smrt_webhook_cursors (id, slug, context, tenant_id, runtime, position, created_at, updated_at)\n VALUES (?, ?, '', ?, ?, 0, ?, ?) ON CONFLICT (tenant_id, runtime) DO NOTHING`,\n id,\n id,\n tenantId,\n runtime,\n now,\n now,\n );\n const rows = await db.query(\n 'SELECT position FROM _smrt_webhook_cursors WHERE tenant_id = ? AND runtime = ?',\n tenantId,\n runtime,\n );\n const since = Number((rows.rows[0] as { position: number }).position);\n const page = await getChangesSince(db, {\n since,\n tenantId,\n tables: Object.keys(this.models),\n limit: 500,\n });\n if (page.resyncRequired)\n throw new WebhookHistoryExpiredError(page.resyncCursor ?? page.cursor);\n let published = 0;\n for (const change of page.changes) {\n // Core's tenant feed includes global rows; webhooks deliberately do not.\n if (\n change.tenantId !== tenantId ||\n !change.rowId ||\n !this.models[change.table]\n )\n continue;\n await this.dispatcher.dispatch({\n id: `change:${change.seq}`,\n event: change.operation,\n model: this.models[change.table],\n occurredAt: change.timestamp,\n data: { id: change.rowId },\n });\n published++;\n }\n await db.query(\n 'UPDATE _smrt_webhook_cursors SET position = ?, updated_at = ? WHERE tenant_id = ? AND runtime = ? AND position = ?',\n page.cursor,\n new Date().toISOString(),\n tenantId,\n runtime,\n since,\n );\n return { cursor: page.cursor, published };\n }\n /** Operator-only recovery: call after reconciling retained source state externally. */\n async resumeAfterResync(cursor: number): Promise<void> {\n if (!Number.isSafeInteger(cursor) || cursor < 0)\n throw new Error('Invalid webhook change cursor.');\n const tenantId = requireTenant().tenantId;\n const { db, runtime } = this.dispatcher.store;\n await db.query(\n 'UPDATE _smrt_webhook_cursors SET position = ? WHERE tenant_id = ? AND runtime = ?',\n cursor,\n tenantId,\n runtime,\n );\n }\n}\n","import { randomUUID } from 'node:crypto';\nimport {\n GlobalInterceptors,\n type InterceptorContext,\n type SmrtObject,\n} from '@happyvertical/smrt-core';\nimport { requireTenant } from '@happyvertical/smrt-tenancy';\nimport type { WebhookDispatcher } from './dispatcher.js';\n\n/** Opt-in lifecycle binding. Explicit model allowlist prevents recursive/internal data publication.\n * Payloads contain record identity only; use dispatch() for authorized custom projections.\n */\nexport function registerWebhookModelEvents(\n dispatcher: WebhookDispatcher,\n models: readonly string[],\n): () => void {\n const internal = new Set([\n 'WebhookSubscription',\n 'WebhookDelivery',\n 'WebhookDeliveryTask',\n 'WebhookCursor',\n 'SmrtJob',\n 'SmrtJobEvent',\n 'SmrtWorker',\n ]);\n if (models.some((name) => internal.has(name.split(':').at(-1) ?? name))) {\n throw new Error(\n 'Internal queue and webhook models cannot publish lifecycle webhooks.',\n );\n }\n const allowed = new Set(models);\n const pending = new WeakMap<\n InterceptorContext,\n { event: string; id: string }\n >();\n const matches = (context: InterceptorContext) =>\n allowed.has(context.qualifiedClassName ?? context.className);\n async function emit(\n instance: SmrtObject,\n context: InterceptorContext,\n event: string,\n ) {\n if (!matches(context)) return;\n const tenantId = requireTenant().tenantId;\n if ('tenantId' in instance && instance.tenantId !== tenantId)\n throw new Error('Webhook model tenant mismatch.');\n await dispatcher.dispatch({\n id: pending.get(context)?.id ?? randomUUID(),\n event,\n model: context.qualifiedClassName ?? context.className,\n occurredAt: context.timestamp.toISOString(),\n data: { id: instance.id },\n });\n }\n const interceptor = {\n name: `webhook-model-events:${randomUUID()}`,\n beforeSave(instance: SmrtObject, context: InterceptorContext) {\n if (matches(context))\n pending.set(context, {\n event: instance.isPersisted ? 'update' : 'create',\n id: randomUUID(),\n });\n },\n async afterSave(instance: SmrtObject, context: InterceptorContext) {\n await emit(instance, context, pending.get(context)?.event ?? 'update');\n },\n async afterDelete(instance: SmrtObject, context: InterceptorContext) {\n await emit(instance, context, 'delete');\n },\n };\n GlobalInterceptors.register(interceptor);\n return () => {\n GlobalInterceptors.unregister(interceptor);\n };\n}\n","import { SmrtRecipe } from '@happyvertical/smrt-core';\nimport {\n WebhookCursor,\n WebhookDelivery,\n WebhookDeliveryTask,\n WebhookSubscription,\n} from './models.js';\n/** Server-backed administration through authenticated host callbacks. */\nexport class WebhooksRecipe extends SmrtRecipe {\n static id = 'integrations.webhooks';\n static label = 'Outbound webhooks';\n static summary =\n 'Deliver signed model events and inspect delivery attempts from a server.';\n static models = [\n WebhookSubscription,\n WebhookDelivery,\n WebhookDeliveryTask,\n WebhookCursor,\n ];\n static group = {\n id: 'integrations',\n label: 'Integrations',\n summary: 'Connect your application to external services.',\n };\n static runtime = 'server' as const;\n static surfaces = [\n {\n kind: 'settings-panel',\n export: '@happyvertical/smrt-webhooks/svelte#WebhookAdmin',\n label: 'Outbound webhooks',\n },\n ] as const;\n // Administration uses the authorized service, never generated model CRUD.\n static nav = [];\n static help = './webhooks.recipe.md';\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/__smrt-register__.ts","../src/change-feed.ts","../src/events.ts","../src/recipes.ts"],"sourcesContent":["// Generated by @happyvertical/smrt-core smrtPlugin at library build time.\n// The package manifest is inlined so self-registration cannot miss when a\n// downstream bundler relocates this module away from dist/manifest.json\n// (https://github.com/happyvertical/smrt/issues/1506,\n// https://github.com/happyvertical/smrt/issues/1507).\nimport { ObjectRegistry } from '@happyvertical/smrt-core';\n\nObjectRegistry.registerPackageManifest(JSON.parse(\"{\\\"version\\\":\\\"1.0.0\\\",\\\"timestamp\\\":0,\\\"packageName\\\":\\\"@happyvertical/smrt-webhooks\\\",\\\"packageVersion\\\":\\\"0.62.6\\\",\\\"objects\\\":{\\\"@happyvertical/smrt-webhooks:WebhookSubscription\\\":{\\\"name\\\":\\\"webhooksubscription\\\",\\\"className\\\":\\\"WebhookSubscription\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-webhooks:WebhookSubscription\\\",\\\"collection\\\":\\\"webhooksubscriptions\\\",\\\"description\\\":\\\"Server-only subscription. Hosts authorize administration before accessing it.\\\",\\\"filePath\\\":\\\"src/models.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-webhooks\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"requiredFor\\\",\\\"__tenancy\\\"],\\\"sqlType\\\":\\\"UUID\\\",\\\"requiredFor\\\":\\\"tenant-scope\\\"},\\\"required\\\":true},\\\"url\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"requiredFor\\\"],\\\"required\\\":true,\\\"requiredFor\\\":\\\"system-table\\\"},\\\"required\\\":true},\\\"events\\\":{\\\"type\\\":\\\"json\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"models\\\":{\\\"type\\\":\\\"json\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[]},\\\"required\\\":false},\\\"secret\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"sensitive\\\",\\\"required\\\",\\\"requiredFor\\\"],\\\"required\\\":true,\\\"sensitive\\\":true,\\\"requiredFor\\\":\\\"system-table\\\"},\\\"required\\\":true,\\\"sensitive\\\":true},\\\"enabled\\\":{\\\"type\\\":\\\"boolean\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"],\\\"default\\\":true},\\\"required\\\":false,\\\"default\\\":true},\\\"signingProfile\\\":{\\\"type\\\":\\\"json\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"required\\\"],\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false}},\\\"methods\\\":{\\\"save\\\":{\\\"name\\\":\\\"save\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"options\\\",\\\"type\\\":\\\"SmrtSaveOptions\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<this>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"_smrt_webhook_subscriptions\\\",\\\"api\\\":false,\\\"cli\\\":false,\\\"mcp\\\":false,\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"WebhookSubscription\\\",\\\"collectionExportName\\\":\\\"WebhookSubscriptionCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"url\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"secret\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"_smrt_webhook_subscriptions\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"_smrt_webhook_subscriptions\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"url\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"events\\\\\\\" JSON,\\\\n \\\\\\\"models\\\\\\\" JSON,\\\\n \\\\\\\"secret\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"enabled\\\\\\\" BOOLEAN DEFAULT TRUE,\\\\n \\\\\\\"signing_profile\\\\\\\" JSON\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"url\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"events\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"models\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"secret\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"enabled\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":true},\\\"signing_profile\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"_smrt_webhook_subscriptions_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"_smrt_webhook_subscriptions_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]}],\\\"version\\\":\\\"86156cdc\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-webhooks\\\"},\\\"@happyvertical/smrt-webhooks:WebhookSubscriptionCollection\\\":{\\\"name\\\":\\\"webhooksubscriptioncollection\\\",\\\"className\\\":\\\"WebhookSubscriptionCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-webhooks:WebhookSubscriptionCollection\\\",\\\"collection\\\":\\\"webhooksubscriptions\\\",\\\"filePath\\\":\\\"src/models.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-webhooks\\\",\\\"fields\\\":{},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"_smrt_webhook_subscriptions\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"WebhookSubscription\\\",\\\"exportName\\\":\\\"WebhookSubscriptionCollection\\\",\\\"collectionExportName\\\":\\\"WebhookSubscriptionCollectionCollection\\\",\\\"collectionOf\\\":\\\"@happyvertical/smrt-webhooks:WebhookSubscription\\\",\\\"inheritedExposure\\\":[\\\"api\\\",\\\"mcp\\\",\\\"cli\\\"],\\\"schema\\\":{\\\"tableName\\\":\\\"_smrt_webhook_subscriptions\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"_smrt_webhook_subscriptions\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"url\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"events\\\\\\\" JSON,\\\\n \\\\\\\"models\\\\\\\" JSON,\\\\n \\\\\\\"secret\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"enabled\\\\\\\" BOOLEAN DEFAULT TRUE,\\\\n \\\\\\\"signing_profile\\\\\\\" JSON\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"url\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"events\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"models\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"secret\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"enabled\\\":{\\\"type\\\":\\\"BOOLEAN\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":true},\\\"signing_profile\\\":{\\\"type\\\":\\\"JSON\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"_smrt_webhook_subscriptions_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"_smrt_webhook_subscriptions_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]}],\\\"version\\\":\\\"86156cdc\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-webhooks\\\"},\\\"@happyvertical/smrt-webhooks:WebhookDelivery\\\":{\\\"name\\\":\\\"webhookdelivery\\\",\\\"className\\\":\\\"WebhookDelivery\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-webhooks:WebhookDelivery\\\",\\\"collection\\\":\\\"webhookdeliveries\\\",\\\"description\\\":\\\"Durable outbox and safe outcome metadata; payload never appears in public projections.\\\",\\\"filePath\\\":\\\"src/models.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-webhooks\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"requiredFor\\\",\\\"__tenancy\\\"],\\\"sqlType\\\":\\\"UUID\\\",\\\"requiredFor\\\":\\\"tenant-scope\\\"},\\\"required\\\":true},\\\"subscriptionId\\\":{\\\"type\\\":\\\"foreignKey\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"onUpdate\\\",\\\"onDelete\\\",\\\"related\\\"],\\\"onUpdate\\\":\\\"RESTRICT\\\",\\\"onDelete\\\":\\\"RESTRICT\\\"},\\\"required\\\":false,\\\"related\\\":\\\"WebhookSubscription\\\"},\\\"eventId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"requiredFor\\\"],\\\"required\\\":true,\\\"requiredFor\\\":\\\"identity\\\"},\\\"required\\\":true},\\\"payload\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"sensitive\\\"],\\\"required\\\":true,\\\"sensitive\\\":true},\\\"required\\\":true,\\\"sensitive\\\":true},\\\"status\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"],\\\"default\\\":\\\"pending\\\"},\\\"required\\\":false,\\\"default\\\":\\\"pending\\\"},\\\"generation\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"],\\\"default\\\":0},\\\"required\\\":false,\\\"default\\\":0},\\\"attempts\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"],\\\"default\\\":0},\\\"required\\\":false,\\\"default\\\":0},\\\"responseStatus\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"required\\\"],\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false},\\\"error\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"required\\\"],\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false},\\\"leaseToken\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"sensitive\\\",\\\"required\\\"],\\\"sensitive\\\":true,\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false,\\\"sensitive\\\":true},\\\"leaseUntil\\\":{\\\"type\\\":\\\"datetime\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"nullable\\\",\\\"required\\\"],\\\"nullable\\\":true,\\\"required\\\":false},\\\"required\\\":false}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"_smrt_webhook_deliveries\\\",\\\"api\\\":false,\\\"cli\\\":false,\\\"mcp\\\":false,\\\"indexes\\\":[{\\\"name\\\":\\\"_smrt_webhook_delivery_identity\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"subscriptionId\\\",\\\"eventId\\\"],\\\"unique\\\":true}],\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"WebhookDelivery\\\",\\\"collectionExportName\\\":\\\"WebhookDeliveryCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"eventId\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"},{\\\"field\\\":\\\"payload\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"_smrt_webhook_deliveries\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"_smrt_webhook_deliveries\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"subscription_id\\\\\\\" UUID,\\\\n \\\\\\\"event_id\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"payload\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"status\\\\\\\" TEXT DEFAULT 'pending',\\\\n \\\\\\\"generation\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"attempts\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"response_status\\\\\\\" INTEGER,\\\\n \\\\\\\"error\\\\\\\" TEXT,\\\\n \\\\\\\"lease_token\\\\\\\" TEXT,\\\\n \\\\\\\"lease_until\\\\\\\" TIMESTAMP\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"subscription_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"_smrt_webhook_subscriptions\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"RESTRICT\\\",\\\"onUpdate\\\":\\\"RESTRICT\\\"}},\\\"event_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"payload\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"pending\\\"},\\\"generation\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":0},\\\"attempts\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":0},\\\"response_status\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"error\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"lease_token\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"lease_until\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"_smrt_webhook_deliveries_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"_smrt_webhook_delivery_identity\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"subscription_id\\\",\\\"event_id\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"_smrt_webhook_deliveries_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"_smrt_webhook_deliveries_subscription_id_idx\\\",\\\"columns\\\":[\\\"subscription_id\\\"]}],\\\"version\\\":\\\"ed54179d\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-webhooks\\\"},\\\"@happyvertical/smrt-webhooks:WebhookDeliveryCollection\\\":{\\\"name\\\":\\\"webhookdeliverycollection\\\",\\\"className\\\":\\\"WebhookDeliveryCollection\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-webhooks:WebhookDeliveryCollection\\\",\\\"collection\\\":\\\"webhookdeliveries\\\",\\\"filePath\\\":\\\"src/models.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-webhooks\\\",\\\"fields\\\":{},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"_smrt_webhook_deliveries\\\",\\\"api\\\":false,\\\"mcp\\\":false,\\\"cli\\\":false},\\\"extends\\\":\\\"SmrtCollection\\\",\\\"extendsTypeArg\\\":\\\"WebhookDelivery\\\",\\\"exportName\\\":\\\"WebhookDeliveryCollection\\\",\\\"collectionExportName\\\":\\\"WebhookDeliveryCollectionCollection\\\",\\\"collectionOf\\\":\\\"@happyvertical/smrt-webhooks:WebhookDelivery\\\",\\\"inheritedExposure\\\":[\\\"api\\\",\\\"mcp\\\",\\\"cli\\\"],\\\"schema\\\":{\\\"tableName\\\":\\\"_smrt_webhook_deliveries\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"_smrt_webhook_deliveries\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"subscription_id\\\\\\\" UUID,\\\\n \\\\\\\"event_id\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"payload\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"status\\\\\\\" TEXT DEFAULT 'pending',\\\\n \\\\\\\"generation\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"attempts\\\\\\\" INTEGER DEFAULT 0,\\\\n \\\\\\\"response_status\\\\\\\" INTEGER,\\\\n \\\\\\\"error\\\\\\\" TEXT,\\\\n \\\\\\\"lease_token\\\\\\\" TEXT,\\\\n \\\\\\\"lease_until\\\\\\\" TIMESTAMP\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"subscription_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"foreignKey\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"foreignKey\\\":{\\\"table\\\":\\\"_smrt_webhook_subscriptions\\\",\\\"column\\\":\\\"id\\\",\\\"onDelete\\\":\\\"RESTRICT\\\",\\\"onUpdate\\\":\\\"RESTRICT\\\"}},\\\"event_id\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"payload\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"status\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":\\\"pending\\\"},\\\"generation\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":0},\\\"attempts\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":0},\\\"response_status\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"error\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"lease_token\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":false,\\\"unique\\\":false},\\\"lease_until\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":false,\\\"unique\\\":false}},\\\"indexes\\\":[{\\\"name\\\":\\\"_smrt_webhook_deliveries_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"_smrt_webhook_delivery_identity\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"subscription_id\\\",\\\"event_id\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"_smrt_webhook_deliveries_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]},{\\\"name\\\":\\\"_smrt_webhook_deliveries_subscription_id_idx\\\",\\\"columns\\\":[\\\"subscription_id\\\"]}],\\\"version\\\":\\\"ed54179d\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-webhooks\\\"},\\\"@happyvertical/smrt-webhooks:WebhookDeliveryTask\\\":{\\\"name\\\":\\\"webhookdeliverytask\\\",\\\"className\\\":\\\"WebhookDeliveryTask\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-webhooks:WebhookDeliveryTask\\\",\\\"collection\\\":\\\"webhookdeliverytasks\\\",\\\"description\\\":\\\"Jobs queue entry point; persisted arguments contain IDs only.\\\",\\\"filePath\\\":\\\"src/models.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-webhooks\\\",\\\"fields\\\":{},\\\"methods\\\":{\\\"deliver\\\":{\\\"name\\\":\\\"deliver\\\",\\\"async\\\":true,\\\"parameters\\\":[{\\\"name\\\":\\\"args\\\",\\\"type\\\":\\\"Record<string, unknown>\\\",\\\"optional\\\":true},{\\\"name\\\":\\\"_context\\\",\\\"type\\\":\\\"JobExecutionContext\\\",\\\"optional\\\":true}],\\\"returnType\\\":\\\"Promise<void>\\\",\\\"isStatic\\\":false,\\\"isPublic\\\":true}},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"_smrt_webhook_delivery_tasks\\\",\\\"api\\\":false,\\\"cli\\\":false,\\\"mcp\\\":false},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"WebhookDeliveryTask\\\",\\\"collectionExportName\\\":\\\"WebhookDeliveryTaskCollection\\\",\\\"schema\\\":{\\\"tableName\\\":\\\"_smrt_webhook_delivery_tasks\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"_smrt_webhook_delivery_tasks\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"}},\\\"indexes\\\":[{\\\"name\\\":\\\"_smrt_webhook_delivery_tasks_slug_context_idx\\\",\\\"columns\\\":[\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"_smrt_webhook_delivery_tasks_created_at_idx\\\",\\\"columns\\\":[\\\"created_at\\\"]}],\\\"version\\\":\\\"268c614c\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-webhooks\\\"},\\\"@happyvertical/smrt-webhooks:WebhookCursor\\\":{\\\"name\\\":\\\"webhookcursor\\\",\\\"className\\\":\\\"WebhookCursor\\\",\\\"qualifiedName\\\":\\\"@happyvertical/smrt-webhooks:WebhookCursor\\\",\\\"collection\\\":\\\"webhookcursors\\\",\\\"description\\\":\\\"Tenant-bound durable cursor for replayable model change-feed publication.\\\",\\\"filePath\\\":\\\"src/models.ts\\\",\\\"packageName\\\":\\\"@happyvertical/smrt-webhooks\\\",\\\"fields\\\":{\\\"tenantId\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__tenancy\\\":{\\\"isTenantIdField\\\":true,\\\"autoFilter\\\":true,\\\"required\\\":true,\\\"autoPopulate\\\":true,\\\"nullable\\\":false,\\\"mode\\\":\\\"required\\\",\\\"field\\\":\\\"tenantId\\\",\\\"allowSuperAdminBypass\\\":false},\\\"__statedOptions\\\":[\\\"sqlType\\\",\\\"requiredFor\\\",\\\"__tenancy\\\"],\\\"sqlType\\\":\\\"UUID\\\",\\\"requiredFor\\\":\\\"tenant-scope\\\"},\\\"required\\\":true},\\\"runtime\\\":{\\\"type\\\":\\\"text\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"required\\\",\\\"requiredFor\\\"],\\\"required\\\":true,\\\"requiredFor\\\":\\\"identity\\\"},\\\"required\\\":true},\\\"position\\\":{\\\"type\\\":\\\"integer\\\",\\\"_meta\\\":{\\\"__statedOptions\\\":[\\\"default\\\"],\\\"default\\\":0},\\\"required\\\":false,\\\"default\\\":0}},\\\"methods\\\":{},\\\"decoratorConfig\\\":{\\\"tableName\\\":\\\"_smrt_webhook_cursors\\\",\\\"api\\\":false,\\\"cli\\\":false,\\\"mcp\\\":false,\\\"indexes\\\":[{\\\"name\\\":\\\"_smrt_webhook_cursor_identity\\\",\\\"columns\\\":[\\\"tenantId\\\",\\\"runtime\\\"],\\\"unique\\\":true}],\\\"tenantScoped\\\":{\\\"mode\\\":\\\"required\\\"},\\\"conflictColumns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"]},\\\"extends\\\":\\\"SmrtObject\\\",\\\"exportName\\\":\\\"WebhookCursor\\\",\\\"collectionExportName\\\":\\\"WebhookCursorCollection\\\",\\\"validationRules\\\":[{\\\"field\\\":\\\"runtime\\\",\\\"rule\\\":\\\"required\\\",\\\"fieldType\\\":\\\"text\\\"}],\\\"schema\\\":{\\\"tableName\\\":\\\"_smrt_webhook_cursors\\\",\\\"ddl\\\":\\\"CREATE TABLE IF NOT EXISTS \\\\\\\"_smrt_webhook_cursors\\\\\\\" (\\\\n \\\\\\\"_sync_origin_device_id\\\\\\\" TEXT,\\\\n \\\\\\\"_sync_revision\\\\\\\" INTEGER,\\\\n \\\\\\\"id\\\\\\\" UUID PRIMARY KEY NOT NULL,\\\\n \\\\\\\"slug\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"context\\\\\\\" TEXT NOT NULL DEFAULT '',\\\\n \\\\\\\"created_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"updated_at\\\\\\\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\\\\n \\\\\\\"tenant_id\\\\\\\" UUID NOT NULL,\\\\n \\\\\\\"runtime\\\\\\\" TEXT NOT NULL,\\\\n \\\\\\\"position\\\\\\\" INTEGER DEFAULT 0\\\\n);\\\",\\\"columns\\\":{\\\"_sync_origin_device_id\\\":{\\\"type\\\":\\\"TEXT\\\"},\\\"_sync_revision\\\":{\\\"type\\\":\\\"INTEGER\\\"},\\\"id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"primaryKey\\\":true,\\\"referenceKind\\\":\\\"id\\\",\\\"notNull\\\":true},\\\"slug\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true},\\\"context\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"\\\"},\\\"created_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"updated_at\\\":{\\\"type\\\":\\\"TIMESTAMP\\\",\\\"notNull\\\":true,\\\"default\\\":\\\"current_timestamp\\\"},\\\"tenant_id\\\":{\\\"type\\\":\\\"UUID\\\",\\\"referenceKind\\\":\\\"tenantId\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"runtime\\\":{\\\"type\\\":\\\"TEXT\\\",\\\"notNull\\\":true,\\\"unique\\\":false},\\\"position\\\":{\\\"type\\\":\\\"INTEGER\\\",\\\"notNull\\\":false,\\\"unique\\\":false,\\\"default\\\":0}},\\\"indexes\\\":[{\\\"name\\\":\\\"_smrt_webhook_cursors_slug_context_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"slug\\\",\\\"context\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"_smrt_webhook_cursor_identity\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"runtime\\\"],\\\"unique\\\":true},{\\\"name\\\":\\\"_smrt_webhook_cursors_tenant_id_created_at_idx\\\",\\\"columns\\\":[\\\"tenant_id\\\",\\\"created_at\\\"]}],\\\"version\\\":\\\"f46a5a8e\\\"},\\\"importPath\\\":\\\"@happyvertical/smrt-webhooks\\\"}},\\\"moduleType\\\":\\\"smrt\\\",\\\"recipes\\\":[{\\\"id\\\":\\\"integrations.webhooks\\\",\\\"className\\\":\\\"WebhooksRecipe\\\",\\\"label\\\":\\\"Outbound webhooks\\\",\\\"summary\\\":\\\"Deliver signed model events and inspect delivery attempts from a server.\\\",\\\"synonyms\\\":[],\\\"models\\\":[\\\"@happyvertical/smrt-webhooks:WebhookSubscription\\\",\\\"@happyvertical/smrt-webhooks:WebhookDelivery\\\",\\\"@happyvertical/smrt-webhooks:WebhookDeliveryTask\\\",\\\"@happyvertical/smrt-webhooks:WebhookCursor\\\"],\\\"nav\\\":[],\\\"requires\\\":[],\\\"group\\\":{\\\"id\\\":\\\"integrations\\\",\\\"label\\\":\\\"Integrations\\\",\\\"summary\\\":\\\"Connect your application to external services.\\\"},\\\"help\\\":{\\\"markdown\\\":\\\"## Overview\\\\n\\\\nSend signed event notifications to an external HTTPS endpoint. Administrators\\\\ncan pause subscriptions and inspect delivery attempts. This integration requires\\\\na server and a running background worker.\\\\n\\\\n## Tasks\\\\n\\\\n- Add a subscription with a public HTTPS endpoint, signing secret, and event/model filters.\\\\n- Disable a subscription to cancel unsent deliveries.\\\\n- Inspect the delivery log, then retry failed deliveries after correcting their endpoint.\\\\n- Ask the endpoint owner to verify signatures and deduplicate delivery IDs.\\\\n\\\",\\\"fieldRefs\\\":[]},\\\"surfaces\\\":[{\\\"kind\\\":\\\"settings-panel\\\",\\\"export\\\":\\\"@happyvertical/smrt-webhooks/svelte#WebhookAdmin\\\",\\\"label\\\":\\\"Outbound webhooks\\\"}],\\\"runtime\\\":\\\"server\\\",\\\"demo\\\":{\\\"mode\\\":\\\"server\\\",\\\"reasons\\\":[\\\"The recipe declares runtime \\\\\\\"server\\\\\\\".\\\",\\\"Needs a server because its package does not build for a browser: Intentionally server-only outbound delivery: node:crypto HMAC and node:https/dns/net pinned transport enforce signing and SSRF protection. Browser hosts use the separate /svelte admin export with authenticated server callbacks.; and its package depends on @happyvertical/smrt-jobs, @happyvertical/smrt-tenancy, which do not build for a browser (#3615, #3624, #3627, #3717).\\\"]}}],\\\"smrtDependencies\\\":[\\\"@happyvertical/smrt-core\\\",\\\"@happyvertical/smrt-jobs\\\",\\\"@happyvertical/smrt-tenancy\\\"],\\\"browser\\\":{\\\"status\\\":\\\"server-only\\\",\\\"issues\\\":[\\\"#3615\\\",\\\"#3624\\\",\\\"#3627\\\",\\\"#3717\\\"],\\\"reason\\\":\\\"Intentionally server-only outbound delivery: node:crypto HMAC and node:https/dns/net pinned transport enforce signing and SSRF protection. Browser hosts use the separate /svelte admin export with authenticated server callbacks.\\\",\\\"via\\\":[\\\"@happyvertical/smrt-jobs\\\",\\\"@happyvertical/smrt-tenancy\\\"]},\\\"stampsConstructors\\\":true}\"));\n","import { randomUUID } from 'node:crypto';\nimport { getChangesSince } from '@happyvertical/smrt-core';\nimport { requireTenant } from '@happyvertical/smrt-tenancy';\nimport type { WebhookDispatcher } from './dispatcher.js';\n\nexport class WebhookHistoryExpiredError extends Error {\n constructor(readonly resumeCursor: number) {\n super(\n 'Webhook change history expired; reconcile source state before resetting the cursor.',\n );\n }\n}\n\n/** Durable, replayable lifecycle publication from SMRT's committed change feed.\n * Host scheduling calls poll() in each authenticated tenant context. The mapping\n * is an explicit physical-table allowlist; shared STI tables represent the base model.\n */\nexport class WebhookChangeFeed {\n constructor(\n private readonly dispatcher: WebhookDispatcher,\n private readonly models: Readonly<Record<string, string>>,\n ) {\n if (\n !Object.keys(models).length ||\n Object.keys(models).some((table) => table.startsWith('_smrt_')) ||\n Object.values(models).some((model) => !model)\n )\n throw new Error('Explicit application model tables are required.');\n }\n /** Cursor only advances after all matched changes have durable outbox/jobs.\n * A crash or partial failure replays the same stable identities on the next poll.\n * History pruning fails loudly: the host must reconcile source state before reset.\n */\n async poll(): Promise<{ cursor: number; published: number }> {\n const tenantId = requireTenant().tenantId;\n const { db, runtime } = this.dispatcher.store;\n const now = new Date().toISOString();\n const id = randomUUID();\n await db.query(\n `INSERT INTO _smrt_webhook_cursors (id, slug, context, tenant_id, runtime, position, created_at, updated_at)\n VALUES (?, ?, '', ?, ?, 0, ?, ?) ON CONFLICT (tenant_id, runtime) DO NOTHING`,\n id,\n id,\n tenantId,\n runtime,\n now,\n now,\n );\n const rows = await db.query(\n 'SELECT position FROM _smrt_webhook_cursors WHERE tenant_id = ? AND runtime = ?',\n tenantId,\n runtime,\n );\n const since = Number((rows.rows[0] as { position: number }).position);\n const page = await getChangesSince(db, {\n since,\n tenantId,\n tables: Object.keys(this.models),\n limit: 500,\n });\n if (page.resyncRequired)\n throw new WebhookHistoryExpiredError(page.resyncCursor ?? page.cursor);\n let published = 0;\n for (const change of page.changes) {\n // Core's tenant feed includes global rows; webhooks deliberately do not.\n if (\n change.tenantId !== tenantId ||\n !change.rowId ||\n !this.models[change.table]\n )\n continue;\n await this.dispatcher.dispatch({\n id: `change:${change.seq}`,\n event: change.operation,\n model: this.models[change.table],\n occurredAt: change.timestamp,\n data: { id: change.rowId },\n });\n published++;\n }\n await db.query(\n 'UPDATE _smrt_webhook_cursors SET position = ?, updated_at = ? WHERE tenant_id = ? AND runtime = ? AND position = ?',\n page.cursor,\n new Date().toISOString(),\n tenantId,\n runtime,\n since,\n );\n return { cursor: page.cursor, published };\n }\n /** Operator-only recovery: call after reconciling retained source state externally. */\n async resumeAfterResync(cursor: number): Promise<void> {\n if (!Number.isSafeInteger(cursor) || cursor < 0)\n throw new Error('Invalid webhook change cursor.');\n const tenantId = requireTenant().tenantId;\n const { db, runtime } = this.dispatcher.store;\n await db.query(\n 'UPDATE _smrt_webhook_cursors SET position = ? WHERE tenant_id = ? AND runtime = ?',\n cursor,\n tenantId,\n runtime,\n );\n }\n}\n","import { randomUUID } from 'node:crypto';\nimport {\n GlobalInterceptors,\n type InterceptorContext,\n type SmrtObject,\n} from '@happyvertical/smrt-core';\nimport { requireTenant } from '@happyvertical/smrt-tenancy';\nimport type { WebhookDispatcher } from './dispatcher.js';\n\n/** Opt-in lifecycle binding. Explicit model allowlist prevents recursive/internal data publication.\n * Payloads contain record identity only; use dispatch() for authorized custom projections.\n */\nexport function registerWebhookModelEvents(\n dispatcher: WebhookDispatcher,\n models: readonly string[],\n): () => void {\n const internal = new Set([\n 'WebhookSubscription',\n 'WebhookDelivery',\n 'WebhookDeliveryTask',\n 'WebhookCursor',\n 'SmrtJob',\n 'SmrtJobEvent',\n 'SmrtWorker',\n ]);\n if (models.some((name) => internal.has(name.split(':').at(-1) ?? name))) {\n throw new Error(\n 'Internal queue and webhook models cannot publish lifecycle webhooks.',\n );\n }\n const allowed = new Set(models);\n const pending = new WeakMap<\n InterceptorContext,\n { event: string; id: string }\n >();\n const matches = (context: InterceptorContext) =>\n allowed.has(context.qualifiedClassName ?? context.className);\n async function emit(\n instance: SmrtObject,\n context: InterceptorContext,\n event: string,\n ) {\n if (!matches(context)) return;\n const tenantId = requireTenant().tenantId;\n if ('tenantId' in instance && instance.tenantId !== tenantId)\n throw new Error('Webhook model tenant mismatch.');\n await dispatcher.dispatch({\n id: pending.get(context)?.id ?? randomUUID(),\n event,\n model: context.qualifiedClassName ?? context.className,\n occurredAt: context.timestamp.toISOString(),\n data: { id: instance.id },\n });\n }\n const interceptor = {\n name: `webhook-model-events:${randomUUID()}`,\n beforeSave(instance: SmrtObject, context: InterceptorContext) {\n if (matches(context))\n pending.set(context, {\n event: instance.isPersisted ? 'update' : 'create',\n id: randomUUID(),\n });\n },\n async afterSave(instance: SmrtObject, context: InterceptorContext) {\n await emit(instance, context, pending.get(context)?.event ?? 'update');\n },\n async afterDelete(instance: SmrtObject, context: InterceptorContext) {\n await emit(instance, context, 'delete');\n },\n };\n GlobalInterceptors.register(interceptor);\n return () => {\n GlobalInterceptors.unregister(interceptor);\n };\n}\n","import { SmrtRecipe } from '@happyvertical/smrt-core';\nimport {\n WebhookCursor,\n WebhookDelivery,\n WebhookDeliveryTask,\n WebhookSubscription,\n} from './models.js';\n/** Server-backed administration through authenticated host callbacks. */\nexport class WebhooksRecipe extends SmrtRecipe {\n static id = 'integrations.webhooks';\n static label = 'Outbound webhooks';\n static summary =\n 'Deliver signed model events and inspect delivery attempts from a server.';\n static models = [\n WebhookSubscription,\n WebhookDelivery,\n WebhookDeliveryTask,\n WebhookCursor,\n ];\n static group = {\n id: 'integrations',\n label: 'Integrations',\n summary: 'Connect your application to external services.',\n };\n static runtime = 'server' as const;\n static surfaces = [\n {\n kind: 'settings-panel',\n export: '@happyvertical/smrt-webhooks/svelte#WebhookAdmin',\n label: 'Outbound webhooks',\n },\n ] as const;\n // Administration uses the authorized service, never generated model CRUD.\n static nav = [];\n static help = './webhooks.recipe.md';\n}\n"],"mappings":"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"}
|
package/dist/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"version": "1.0.0",
|
|
3
3
|
"timestamp": 0,
|
|
4
4
|
"packageName": "@happyvertical/smrt-webhooks",
|
|
5
|
-
"packageVersion": "0.62.
|
|
5
|
+
"packageVersion": "0.62.6",
|
|
6
6
|
"objects": {
|
|
7
7
|
"@happyvertical/smrt-webhooks:WebhookSubscription": {
|
|
8
8
|
"name": "webhooksubscription",
|
|
@@ -87,6 +87,18 @@
|
|
|
87
87
|
},
|
|
88
88
|
"required": false,
|
|
89
89
|
"default": true
|
|
90
|
+
},
|
|
91
|
+
"signingProfile": {
|
|
92
|
+
"type": "json",
|
|
93
|
+
"_meta": {
|
|
94
|
+
"__statedOptions": [
|
|
95
|
+
"nullable",
|
|
96
|
+
"required"
|
|
97
|
+
],
|
|
98
|
+
"nullable": true,
|
|
99
|
+
"required": false
|
|
100
|
+
},
|
|
101
|
+
"required": false
|
|
90
102
|
}
|
|
91
103
|
},
|
|
92
104
|
"methods": {
|
|
@@ -136,7 +148,7 @@
|
|
|
136
148
|
],
|
|
137
149
|
"schema": {
|
|
138
150
|
"tableName": "_smrt_webhook_subscriptions",
|
|
139
|
-
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_webhook_subscriptions\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID NOT NULL,\n \"url\" TEXT NOT NULL,\n \"events\" JSON,\n \"models\" JSON,\n \"secret\" TEXT NOT NULL,\n \"enabled\" BOOLEAN DEFAULT TRUE\n);",
|
|
151
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_webhook_subscriptions\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID NOT NULL,\n \"url\" TEXT NOT NULL,\n \"events\" JSON,\n \"models\" JSON,\n \"secret\" TEXT NOT NULL,\n \"enabled\" BOOLEAN DEFAULT TRUE,\n \"signing_profile\" JSON\n);",
|
|
140
152
|
"columns": {
|
|
141
153
|
"_sync_origin_device_id": {
|
|
142
154
|
"type": "TEXT"
|
|
@@ -200,6 +212,11 @@
|
|
|
200
212
|
"notNull": false,
|
|
201
213
|
"unique": false,
|
|
202
214
|
"default": true
|
|
215
|
+
},
|
|
216
|
+
"signing_profile": {
|
|
217
|
+
"type": "JSON",
|
|
218
|
+
"notNull": false,
|
|
219
|
+
"unique": false
|
|
203
220
|
}
|
|
204
221
|
},
|
|
205
222
|
"indexes": [
|
|
@@ -220,7 +237,7 @@
|
|
|
220
237
|
]
|
|
221
238
|
}
|
|
222
239
|
],
|
|
223
|
-
"version": "
|
|
240
|
+
"version": "86156cdc"
|
|
224
241
|
},
|
|
225
242
|
"importPath": "@happyvertical/smrt-webhooks"
|
|
226
243
|
},
|
|
@@ -251,7 +268,7 @@
|
|
|
251
268
|
],
|
|
252
269
|
"schema": {
|
|
253
270
|
"tableName": "_smrt_webhook_subscriptions",
|
|
254
|
-
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_webhook_subscriptions\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID NOT NULL,\n \"url\" TEXT NOT NULL,\n \"events\" JSON,\n \"models\" JSON,\n \"secret\" TEXT NOT NULL,\n \"enabled\" BOOLEAN DEFAULT TRUE\n);",
|
|
271
|
+
"ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_webhook_subscriptions\" (\n \"_sync_origin_device_id\" TEXT,\n \"_sync_revision\" INTEGER,\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID NOT NULL,\n \"url\" TEXT NOT NULL,\n \"events\" JSON,\n \"models\" JSON,\n \"secret\" TEXT NOT NULL,\n \"enabled\" BOOLEAN DEFAULT TRUE,\n \"signing_profile\" JSON\n);",
|
|
255
272
|
"columns": {
|
|
256
273
|
"_sync_origin_device_id": {
|
|
257
274
|
"type": "TEXT"
|
|
@@ -315,6 +332,11 @@
|
|
|
315
332
|
"notNull": false,
|
|
316
333
|
"unique": false,
|
|
317
334
|
"default": true
|
|
335
|
+
},
|
|
336
|
+
"signing_profile": {
|
|
337
|
+
"type": "JSON",
|
|
338
|
+
"notNull": false,
|
|
339
|
+
"unique": false
|
|
318
340
|
}
|
|
319
341
|
},
|
|
320
342
|
"indexes": [
|
|
@@ -335,7 +357,7 @@
|
|
|
335
357
|
]
|
|
336
358
|
}
|
|
337
359
|
],
|
|
338
|
-
"version": "
|
|
360
|
+
"version": "86156cdc"
|
|
339
361
|
},
|
|
340
362
|
"importPath": "@happyvertical/smrt-webhooks"
|
|
341
363
|
},
|
|
@@ -1170,6 +1192,6 @@
|
|
|
1170
1192
|
"@happyvertical/smrt-tenancy"
|
|
1171
1193
|
]
|
|
1172
1194
|
},
|
|
1173
|
-
"schemaFingerprint": "
|
|
1195
|
+
"schemaFingerprint": "95eab4dd971fa6fb95597f7e1a76b9bf23ffd0663d07b27d334eaa6af12ee6b0",
|
|
1174
1196
|
"stampsConstructors": true
|
|
1175
1197
|
}
|
package/dist/models.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SmrtCollection, SmrtObject, type SmrtSaveOptions } from '@happyvertical/smrt-core';
|
|
2
2
|
import { type JobExecutionContext } from '@happyvertical/smrt-jobs';
|
|
3
|
+
import { type WebhookSigningProfileConfig } from './signing.js';
|
|
3
4
|
/** Server-only subscription. Hosts authorize administration before accessing it. */
|
|
4
5
|
export declare class WebhookSubscription extends SmrtObject {
|
|
5
6
|
tenantId: string;
|
|
@@ -8,6 +9,12 @@ export declare class WebhookSubscription extends SmrtObject {
|
|
|
8
9
|
models: string[];
|
|
9
10
|
secret: string;
|
|
10
11
|
enabled: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Optional wire-format profile (`{ preset, ...overrides }`); null keeps the
|
|
14
|
+
* historical `x-smrt-*` default. Nullable column: add it with the normal
|
|
15
|
+
* application migration before deploying.
|
|
16
|
+
*/
|
|
17
|
+
signingProfile: WebhookSigningProfileConfig | null;
|
|
11
18
|
save(options?: SmrtSaveOptions): Promise<this>;
|
|
12
19
|
}
|
|
13
20
|
export declare class WebhookSubscriptionCollection extends SmrtCollection<WebhookSubscription> {
|
package/dist/models.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,cAAc,EACd,UAAU,EACV,KAAK,eAAe,EAErB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../src/models.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,cAAc,EACd,UAAU,EACV,KAAK,eAAe,EAErB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAGL,KAAK,2BAA2B,EACjC,MAAM,cAAc,CAAC;AAEtB,oFAAoF;AACpF,qBAOa,mBAAoB,SAAQ,UAAU;IACrC,QAAQ,EAAE,MAAM,CAAM;IAElC,GAAG,EAAE,MAAM,CAAM;IACQ,MAAM,EAAE,MAAM,EAAE,CAAM;IACtB,MAAM,EAAE,MAAM,EAAE,CAAM;IAO/C,MAAM,EAAE,MAAM,CAAM;IACuB,OAAO,EAAE,OAAO,CAAQ;IACnE;;;;OAIG;IAEH,cAAc,EAAE,2BAA2B,GAAG,IAAI,CAAQ;IAE3C,IAAI,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CAkB9D;AACD,qBAAa,6BAA8B,SAAQ,cAAc,CAAC,mBAAmB,CAAC;IACpF,MAAM,CAAC,QAAQ,CAAC,UAAU,6BAAuB;CAClD;AAED,6FAA6F;AAC7F,qBAca,eAAgB,SAAQ,UAAU;IACjC,QAAQ,EAAE,MAAM,CAAM;IAKlC,cAAc,EAAE,MAAM,CAAM;IAE5B,OAAO,EAAE,MAAM,CAAM;IACqC,OAAO,EAAE,MAAM,CACpE;IACwC,MAAM,EAAE,MAAM,CAAa;IAChC,UAAU,EAAE,MAAM,CAAK;IACvB,QAAQ,EAAE,MAAM,CAAK;IACjB,cAAc,EAAE,MAAM,GAAG,IAAI,CAClE;IACkC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAQ;IACX,UAAU,EAChE,MAAM,GACN,IAAI,CAAQ;IAC6B,UAAU,EAAE,IAAI,GAAG,IAAI,CAAQ;CAC7E;AACD,qBAAa,yBAA0B,SAAQ,cAAc,CAAC,eAAe,CAAC;IAC5E,MAAM,CAAC,QAAQ,CAAC,UAAU,yBAAmB;CAC9C;AAED,oEAAoE;AACpE,qBAMa,mBAAoB,SAAQ,UAAU;IAE3C,OAAO,CACX,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EAClC,QAAQ,CAAC,EAAE,mBAAmB,GAC7B,OAAO,CAAC,IAAI,CAAC;CAIjB;AAED,gFAAgF;AAChF,qBAca,aAAc,SAAQ,UAAU;IAC/B,QAAQ,EAAE,MAAM,CAAM;IAElC,OAAO,EAAE,MAAM,CAAM;IACmB,QAAQ,EAAE,MAAM,CAAK;CAC9D"}
|