@wildo-ai/external-connectors-models 1.1.2 → 1.1.4

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.
Files changed (99) hide show
  1. package/dist/esm/.native.tsbuildinfo +1 -0
  2. package/dist/esm/companion-exports.d.ts.map +1 -1
  3. package/dist/esm/core/commons.external-connectors-models.schemas.d.ts +45 -7
  4. package/dist/esm/core/commons.external-connectors-models.schemas.d.ts.map +1 -1
  5. package/dist/esm/core/commons.external-connectors-models.schemas.js +42 -5
  6. package/dist/esm/core/commons.external-connectors-models.schemas.js.map +1 -1
  7. package/dist/esm/core/operation-classification.external-connectors-models.schemas.d.ts +13 -0
  8. package/dist/esm/core/operation-classification.external-connectors-models.schemas.d.ts.map +1 -0
  9. package/dist/esm/core/operation-classification.external-connectors-models.schemas.js +14 -0
  10. package/dist/esm/core/operation-classification.external-connectors-models.schemas.js.map +1 -0
  11. package/dist/esm/core/protocols.external-connectors-models.schemas.d.ts +0 -25
  12. package/dist/esm/core/protocols.external-connectors-models.schemas.d.ts.map +1 -1
  13. package/dist/esm/core/protocols.external-connectors-models.schemas.js.map +1 -1
  14. package/dist/esm/core/security.external-connectors-models.schemas.d.ts +132 -2
  15. package/dist/esm/core/security.external-connectors-models.schemas.d.ts.map +1 -1
  16. package/dist/esm/core/security.external-connectors-models.schemas.js +164 -0
  17. package/dist/esm/core/security.external-connectors-models.schemas.js.map +1 -1
  18. package/dist/esm/index.d.ts +3 -9
  19. package/dist/esm/index.d.ts.map +1 -1
  20. package/dist/esm/index.js +6 -10
  21. package/dist/esm/index.js.map +1 -1
  22. package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.d.ts +251 -4
  23. package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.d.ts.map +1 -1
  24. package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.js +307 -2
  25. package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.js.map +1 -1
  26. package/dist/esm/protocols/billing.standard-interface.schemas.d.ts +154 -0
  27. package/dist/esm/protocols/billing.standard-interface.schemas.d.ts.map +1 -1
  28. package/dist/esm/protocols/billing.standard-interface.schemas.js +49 -0
  29. package/dist/esm/protocols/billing.standard-interface.schemas.js.map +1 -1
  30. package/dist/esm/protocols/document-extraction.external-connectors-models.schemas.d.ts +72 -0
  31. package/dist/esm/protocols/document-extraction.external-connectors-models.schemas.d.ts.map +1 -1
  32. package/dist/esm/protocols/document-extraction.external-connectors-models.schemas.js +77 -2
  33. package/dist/esm/protocols/document-extraction.external-connectors-models.schemas.js.map +1 -1
  34. package/dist/esm/protocols/email.external-connectors-models.schemas.d.ts +1 -1
  35. package/dist/esm/protocols/email.external-connectors-models.schemas.d.ts.map +1 -1
  36. package/dist/esm/protocols/email.standard-interface.schemas.d.ts.map +1 -1
  37. package/dist/esm/protocols/embeddings.external-connectors-models.schemas.d.ts.map +1 -1
  38. package/dist/esm/protocols/frontend.external-connectors-models.schemas.d.ts.map +1 -1
  39. package/dist/esm/{features/hooks.external-connectors-models.schemas.d.ts → protocols/hooks-capability.external-connectors-models.schemas.d.ts} +1 -1
  40. package/dist/esm/protocols/hooks-capability.external-connectors-models.schemas.d.ts.map +1 -0
  41. package/dist/esm/{features/hooks.external-connectors-models.schemas.js → protocols/hooks-capability.external-connectors-models.schemas.js} +1 -1
  42. package/dist/esm/protocols/hooks-capability.external-connectors-models.schemas.js.map +1 -0
  43. package/dist/esm/protocols/hooks.external-connectors-models.schemas.d.ts.map +1 -1
  44. package/dist/esm/protocols/image.external-connectors-models.schemas.d.ts.map +1 -1
  45. package/dist/esm/protocols/llm.external-connectors-models.schemas.d.ts +36 -19
  46. package/dist/esm/protocols/llm.external-connectors-models.schemas.d.ts.map +1 -1
  47. package/dist/esm/protocols/llm.external-connectors-models.schemas.js +90 -28
  48. package/dist/esm/protocols/llm.external-connectors-models.schemas.js.map +1 -1
  49. package/dist/esm/protocols/oauth2.external-connectors-models.schemas.d.ts +2 -2
  50. package/dist/esm/protocols/oauth2.external-connectors-models.schemas.d.ts.map +1 -1
  51. package/dist/esm/protocols/rest-api.external-connectors-models.schemas.d.ts +1 -89
  52. package/dist/esm/protocols/rest-api.external-connectors-models.schemas.d.ts.map +1 -1
  53. package/dist/esm/protocols/rest-api.external-connectors-models.schemas.js +1 -83
  54. package/dist/esm/protocols/rest-api.external-connectors-models.schemas.js.map +1 -1
  55. package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.d.ts +370 -0
  56. package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.d.ts.map +1 -0
  57. package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.js +89 -0
  58. package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.js.map +1 -0
  59. package/dist/esm/protocols/sms.external-connectors-models.schemas.d.ts.map +1 -1
  60. package/dist/esm/protocols/sms.standard-interface.schemas.d.ts +66 -6
  61. package/dist/esm/protocols/sms.standard-interface.schemas.d.ts.map +1 -1
  62. package/dist/esm/protocols/sms.standard-interface.schemas.js +71 -1
  63. package/dist/esm/protocols/sms.standard-interface.schemas.js.map +1 -1
  64. package/dist/tsconfig.build.tsbuildinfo +1 -1
  65. package/package.json +2 -2
  66. package/dist/esm/features/core.external-connectors-models.schemas.d.ts +0 -63
  67. package/dist/esm/features/core.external-connectors-models.schemas.d.ts.map +0 -1
  68. package/dist/esm/features/core.external-connectors-models.schemas.js +0 -101
  69. package/dist/esm/features/core.external-connectors-models.schemas.js.map +0 -1
  70. package/dist/esm/features/email.external-connectors-models.schemas.d.ts +0 -181
  71. package/dist/esm/features/email.external-connectors-models.schemas.d.ts.map +0 -1
  72. package/dist/esm/features/email.external-connectors-models.schemas.js +0 -34
  73. package/dist/esm/features/email.external-connectors-models.schemas.js.map +0 -1
  74. package/dist/esm/features/hooks.external-connectors-models.schemas.d.ts.map +0 -1
  75. package/dist/esm/features/hooks.external-connectors-models.schemas.js.map +0 -1
  76. package/dist/esm/features/sms.external-connectors-models.schemas.d.ts +0 -21
  77. package/dist/esm/features/sms.external-connectors-models.schemas.d.ts.map +0 -1
  78. package/dist/esm/features/sms.external-connectors-models.schemas.js +0 -8
  79. package/dist/esm/features/sms.external-connectors-models.schemas.js.map +0 -1
  80. package/dist/esm/protocols/a2a.external-connectors-models.schemas.d.ts +0 -57
  81. package/dist/esm/protocols/a2a.external-connectors-models.schemas.d.ts.map +0 -1
  82. package/dist/esm/protocols/a2a.external-connectors-models.schemas.js +0 -73
  83. package/dist/esm/protocols/a2a.external-connectors-models.schemas.js.map +0 -1
  84. package/dist/esm/protocols/git.external-connectors-models.schemas.d.ts +0 -14
  85. package/dist/esm/protocols/git.external-connectors-models.schemas.d.ts.map +0 -1
  86. package/dist/esm/protocols/git.external-connectors-models.schemas.js +0 -9
  87. package/dist/esm/protocols/git.external-connectors-models.schemas.js.map +0 -1
  88. package/dist/esm/protocols/grpc.external-connectors-models.schemas.d.ts +0 -14
  89. package/dist/esm/protocols/grpc.external-connectors-models.schemas.d.ts.map +0 -1
  90. package/dist/esm/protocols/grpc.external-connectors-models.schemas.js +0 -9
  91. package/dist/esm/protocols/grpc.external-connectors-models.schemas.js.map +0 -1
  92. package/dist/esm/protocols/mcp.external-connectors-models.schemas.d.ts +0 -60
  93. package/dist/esm/protocols/mcp.external-connectors-models.schemas.d.ts.map +0 -1
  94. package/dist/esm/protocols/mcp.external-connectors-models.schemas.js +0 -35
  95. package/dist/esm/protocols/mcp.external-connectors-models.schemas.js.map +0 -1
  96. package/dist/esm/protocols/saml.external-connectors-models.schemas.d.ts +0 -135
  97. package/dist/esm/protocols/saml.external-connectors-models.schemas.d.ts.map +0 -1
  98. package/dist/esm/protocols/saml.external-connectors-models.schemas.js +0 -9
  99. package/dist/esm/protocols/saml.external-connectors-models.schemas.js.map +0 -1
@@ -48,6 +48,27 @@ export var TaxDisplayMode;
48
48
  /** Price amounts are TTC (tax embedded) */
49
49
  TaxDisplayMode["INCLUSIVE"] = "inclusive";
50
50
  })(TaxDisplayMode || (TaxDisplayMode = {}));
51
+ /**
52
+ * How a mid-cycle subscription change is settled.
53
+ *
54
+ * A PROTOCOL vocabulary, and it lives here for the same reason {@link TaxDisplayMode} does: these three
55
+ * values are the wire values a billing provider accepts. It was declared in `@wildo-ai/saas-models`
56
+ * until 2026-09-08 and re-exported the other way round, which is why an authored proration could be
57
+ * resolved by the engine and had no field on the request to travel in — the request contract could not
58
+ * name the type without a package cycle, so the resolved value was sent as provider METADATA and
59
+ * ignored (#516).
60
+ *
61
+ * `@wildo-ai/saas-models` re-exports it, so every existing consumer is unchanged.
62
+ */
63
+ export var ProrationBehavior;
64
+ (function (ProrationBehavior) {
65
+ /** Credit the unused time and charge the new price pro rata, settled on the next invoice. */
66
+ ProrationBehavior["CREATE_PRORATIONS"] = "create_prorations";
67
+ /** No proration: the change takes effect and the next invoice is the new price in full. */
68
+ ProrationBehavior["NONE"] = "none";
69
+ /** Prorate and invoice the difference IMMEDIATELY rather than at the next cycle. */
70
+ ProrationBehavior["ALWAYS_INVOICE"] = "always_invoice";
71
+ })(ProrationBehavior || (ProrationBehavior = {}));
51
72
  /**
52
73
  * Subscription status values (maps to Stripe subscription statuses).
53
74
  */
@@ -63,6 +84,34 @@ export var SubscriptionStatus;
63
84
  SubscriptionStatus["TRIALING"] = "trialing";
64
85
  SubscriptionStatus["PAUSED"] = "paused";
65
86
  })(SubscriptionStatus || (SubscriptionStatus = {}));
87
+ /**
88
+ * Invoice lifecycle status, as the PROVIDER reports it.
89
+ *
90
+ * A PROTOCOL vocabulary for the same reason {@link SubscriptionStatus} is one: these are the states
91
+ * a billing provider puts an invoice in, and the adapter's job is to map its own wire values onto
92
+ * them. It was declared in `@wildo-ai/saas-models` until 2026-09-09 and could not be named by this
93
+ * package at all, so `listInvoices` — the read the reconciliation sweep needs — had no way to type
94
+ * the one field the sweep compares.
95
+ *
96
+ * Moved rather than duplicated: a second enum with the same five members would be two sources for
97
+ * one closed vocabulary, which is what `CLAUDE.md` forbids. `@wildo-ai/saas-models` re-exports it
98
+ * exactly as it already re-exports `SubscriptionStatus`, `TaxDisplayMode` and `ProrationBehavior`,
99
+ * so every existing consumer — including the `invoiceRefs` schema, the badge palette and the
100
+ * documentation catalogue — imports the same specifier it always did.
101
+ */
102
+ export var InvoiceStatus;
103
+ (function (InvoiceStatus) {
104
+ /** Not finalized: the provider has not issued it for collection and it may still change. */
105
+ InvoiceStatus["DRAFT"] = "draft";
106
+ /** Finalized and awaiting payment. */
107
+ InvoiceStatus["OPEN"] = "open";
108
+ /** Settled. */
109
+ InvoiceStatus["PAID"] = "paid";
110
+ /** Cancelled by the provider or the merchant; never collectable. */
111
+ InvoiceStatus["VOID"] = "void";
112
+ /** Written off — payment was attempted and abandoned. */
113
+ InvoiceStatus["UNCOLLECTIBLE"] = "uncollectible";
114
+ })(InvoiceStatus || (InvoiceStatus = {}));
66
115
  // ===============================================================
67
116
  // Standard Billing Event Types
68
117
  // ===============================================================
@@ -1 +1 @@
1
- {"version":3,"file":"billing.standard-interface.schemas.js","sourceRoot":"","sources":["../../../../src/protocols/billing.standard-interface.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,kEAAkE;AAClE,yEAAyE;AACzE,kEAAkE;AAElE;;GAEG;AACH,MAAM,CAAN,IAAY,YASX;AATD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,qCAAqB,CAAA;IACrB,+CAA+C;IAC/C,iCAAiB,CAAA;IACjB,mDAAmD;IACnD,uCAAuB,CAAA;IACvB,mCAAmC;IACnC,mCAAmB,CAAA;AACrB,CAAC,EATW,YAAY,KAAZ,YAAY,QASvB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,gCAAa,CAAA;AACf,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,mDAAmD;IACnD,yCAAuB,CAAA;IACvB,2CAA2C;IAC3C,yCAAuB,CAAA;AACzB,CAAC,EALW,cAAc,KAAd,cAAc,QAKzB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,kBAUX;AAVD,WAAY,kBAAkB;IAC5B,uCAAiB,CAAA;IACjB,2CAAqB,CAAA;IACrB,uCAAiB,CAAA;IACjB,6CAAuB,CAAA;IACvB,8DAA8D;IAC9D,+CAAyB,CAAA;IACzB,+DAAyC,CAAA;IACzC,2CAAqB,CAAA;IACrB,uCAAiB,CAAA;AACnB,CAAC,EAVW,kBAAkB,KAAlB,kBAAkB,QAU7B;AAED,kEAAkE;AAClE,+BAA+B;AAC/B,kEAAkE;AAElE;;;;GAIG;AACH,MAAM,CAAN,IAAY,yBAkCX;AAlCD,WAAY,yBAAyB;IACnC,0CAA0C;IAC1C,0EAA6C,CAAA;IAC7C,0EAA6C,CAAA;IAC7C,0EAA6C,CAAA;IAC7C,wFAA2D,CAAA;IAE3D,iEAAiE;IACjE,0DAA6B,CAAA;IAC7B,8EAAiD,CAAA;IACjD,oEAAuC,CAAA;IAEvC,oFAAoF;IACpF,sFAAyD,CAAA;IAEzD,oCAAoC;IACpC,kEAAqC,CAAA;IACrC,kEAAqC,CAAA;IAErC,mFAAmF;IACnF,qFAAqF;IACrF,8DAAiC,CAAA;IACjC,8DAAiC,CAAA;IACjC,8DAAiC,CAAA;IAEjC,yEAAyE;IACzE,oFAAuD,CAAA;IACvD,oFAAuD,CAAA;IACvD,oFAAuD,CAAA;IAEvD,kFAAkF;IAClF,qFAAqF;IACrF,gFAAmD,CAAA;IACnD,gFAAmD,CAAA;AACrD,CAAC,EAlCW,yBAAyB,KAAzB,yBAAyB,QAkCpC","sourcesContent":["/**\n * Standard Billing Interface\n * --------\n * This is the canonical interface that Wildo uses internally for all billing\n * operations. The ETL layer transforms these standard requests into\n * provider-specific API calls (e.g., Stripe, Paddle, LemonSqueezy).\n *\n * Design Principles:\n * 1. Provider-agnostic — works with any billing provider\n * 2. Hosted-first — uses provider-hosted checkout and portals (no PCI scope)\n * 3. Webhook-driven — state changes flow in via webhooks, not polling\n * 4. Scope-agnostic — billing accounts map to any Wildo scope (org, user)\n *\n * @see billing-and-features-system.md §7.1 (Standard Billing Interface)\n */\n\n// ===============================================================\n// Billing Interface Enums (canonical source, re-exported by saas-models)\n// ===============================================================\n\n/**\n * Pricing model for a price entry.\n */\nexport enum PricingModel {\n FLAT = 'flat',\n PER_UNIT = 'per_unit',\n /** Volume pricing (all units at tier price) */\n TIERED = 'tiered',\n /** Incremental (each tier priced independently) */\n GRADUATED = 'graduated',\n /** Price per package of N units */\n PACKAGE = 'package',\n}\n\n/**\n * Billing interval for recurring prices.\n */\nexport enum BillingInterval {\n MONTH = 'month',\n YEAR = 'year',\n}\n\n/**\n * Tax display mode: how prices are displayed (HT vs TTC).\n */\nexport enum TaxDisplayMode {\n /** Price amounts are HT (tax added at checkout) */\n EXCLUSIVE = 'exclusive',\n /** Price amounts are TTC (tax embedded) */\n INCLUSIVE = 'inclusive',\n}\n\n/**\n * Subscription status values (maps to Stripe subscription statuses).\n */\nexport enum SubscriptionStatus {\n ACTIVE = 'active',\n PAST_DUE = 'past_due',\n UNPAID = 'unpaid',\n CANCELLED = 'cancelled',\n /** Stripe: first payment never completed within 23h window */\n INCOMPLETE = 'incomplete',\n INCOMPLETE_EXPIRED = 'incomplete_expired',\n TRIALING = 'trialing',\n PAUSED = 'paused',\n}\n\n// ===============================================================\n// Standard Billing Event Types\n// ===============================================================\n\n/**\n * Canonical billing events the system cares about.\n * Provider-specific events are mapped to these types by the transformer.\n * Only events that affect local state (features, status) need to be handled.\n */\nexport enum StandardBilling_EventType {\n // Subscription lifecycle (→ feature sync)\n SUBSCRIPTION_CREATED = 'subscription.created',\n SUBSCRIPTION_UPDATED = 'subscription.updated',\n SUBSCRIPTION_DELETED = 'subscription.deleted',\n SUBSCRIPTION_TRIAL_WILL_END = 'subscription.trial_will_end',\n\n // Invoice status (→ billing status tracking, past_due detection)\n INVOICE_PAID = 'invoice.paid',\n INVOICE_PAYMENT_FAILED = 'invoice.payment_failed',\n INVOICE_FINALIZED = 'invoice.finalized',\n\n // Checkout (→ one-off purchase completion for ONE_TIME, CREDIT_PACK, ITEM products)\n CHECKOUT_SESSION_COMPLETED = 'checkout.session.completed',\n\n // Customer (→ billing account sync)\n CUSTOMER_UPDATED = 'customer.updated',\n CUSTOMER_DELETED = 'customer.deleted',\n\n // Coupon (→ no local action; coupons are managed through Wildo's promotion system.\n // Included for logging/audit in case coupons are modified directly on the provider.)\n COUPON_CREATED = 'coupon.created',\n COUPON_UPDATED = 'coupon.updated',\n COUPON_DELETED = 'coupon.deleted',\n\n // Customer discount (→ subscription re-sync to pick up discount changes)\n CUSTOMER_DISCOUNT_CREATED = 'customer.discount.created',\n CUSTOMER_DISCOUNT_UPDATED = 'customer.discount.updated',\n CUSTOMER_DISCOUNT_DELETED = 'customer.discount.deleted',\n\n // Payment method (→ no local action needed; provider manages via Customer Portal.\n // Included for completeness: apps can optionally log these events for audit trails.)\n PAYMENT_METHOD_ATTACHED = 'payment_method.attached',\n PAYMENT_METHOD_DETACHED = 'payment_method.detached',\n}\n\n// ===============================================================\n// Standard Billing Webhook Event\n// ===============================================================\n\n/**\n * Canonical webhook event representation.\n * Provider transformers parse raw webhook payloads into this shape.\n */\nexport interface StandardBilling_WebhookEvent {\n /** Canonical event type */\n type: StandardBilling_EventType;\n /** Provider-assigned event ID (for idempotency) */\n providerEventId: string;\n /** Event payload — shape varies by event type */\n data: Record<string, unknown>;\n /** When the event occurred at the provider */\n createdAt: Date;\n}\n\n// ===============================================================\n// Request/Response Types\n// ===============================================================\n\n// ── Customer ────────────────────────────────────────────────────\n\nexport interface StandardBilling_CreateCustomerRequest {\n /** Descriptive name (e.g., organization name or user display name) */\n name: string;\n /** Contact email for invoices and receipts */\n email: string;\n /** Arbitrary key-value metadata stored on the provider customer */\n metadata?: Record<string, string>;\n}\n\nexport interface StandardBilling_CreateCustomerResponse {\n providerCustomerId: string;\n}\n\n/**\n * Postal address on a provider customer record.\n *\n * Every field is independently clearable (`null`) rather than merely omittable: `undefined` means\n * \"leave whatever the provider already has\", `null` means \"blank it\". Subject erasure needs the\n * second meaning — an address that is silently preserved because the request could only express\n * \"no change\" is personal data surviving an erasure.\n */\nexport interface StandardBilling_CustomerAddress {\n line1?: string | null;\n line2?: string | null;\n city?: string | null;\n state?: string | null;\n postalCode?: string | null;\n /** ISO 3166-1 alpha-2 country code. */\n country?: string | null;\n}\n\nexport interface StandardBilling_UpdateCustomerRequest {\n name?: string;\n email?: string;\n metadata?: Record<string, string>;\n /**\n * Contact phone. `null` clears it at the provider — see {@link StandardBilling_CustomerAddress}\n * for why clearability is expressed separately from omission.\n */\n phone?: string | null;\n /**\n * Billing address. `null` clears the whole address; a partial object clears only the fields it\n * sets to `null` and leaves the rest untouched.\n */\n address?: StandardBilling_CustomerAddress | null;\n}\n\n/**\n * A stored payment instrument attached to a provider customer.\n *\n * Deliberately thin: enough to identify an instrument for detachment and to render a\n * \"•••• 4242\"-style hint, and nothing more. Wildo never handles raw instrument data — that is the\n * whole point of routing users through the provider-hosted portal — so this carries no PAN, no\n * expiry, and no billing details.\n */\nexport interface StandardBilling_PaymentMethodSummary {\n providerPaymentMethodId: string;\n /**\n * Instrument kind as the provider names it (`'card'`, `'sepa_debit'`, `'us_bank_account'`, …).\n * Intentionally an OPEN provider identifier, not a closed Wildo vocabulary: the set differs per\n * provider and grows without our involvement, and nothing in the framework branches on it — it\n * is carried for display and diagnostics only.\n */\n type: string;\n /** Last four digits, when the instrument exposes them. */\n last4?: string;\n}\n\n// ── Product/Price Sync ──────────────────────────────────────────\n\nexport interface StandardBilling_SyncProductRequest {\n /** Internal Wildo product key (stored in metadata for reverse lookup) */\n productKey: string;\n name: string;\n description?: string;\n /** If set, updates existing provider product instead of creating new */\n providerProductId?: string;\n metadata?: Record<string, string>;\n}\n\nexport interface StandardBilling_SyncProductResponse {\n providerProductId: string;\n}\n\nexport interface StandardBilling_SyncPriceRequest {\n providerProductId: string;\n model: PricingModel;\n /** Amount in smallest currency unit (cents) */\n amount: number;\n currency: string;\n interval?: BillingInterval;\n /** For TIERED/VOLUME pricing models */\n tiers?: Array<{\n upTo: number | null;\n unitAmount: number;\n flatAmount?: number;\n }>;\n /** For PACKAGE pricing */\n packageSize?: number;\n /** Tax behavior */\n taxBehavior?: TaxDisplayMode;\n /** If set, updates existing provider price instead of creating new */\n providerPriceId?: string;\n metadata?: Record<string, string>;\n}\n\nexport interface StandardBilling_SyncPriceResponse {\n providerPriceId: string;\n}\n\n// ── Subscription Lifecycle ──────────────────────────────────────\n\nexport interface StandardBilling_CreateSubscriptionRequest {\n providerCustomerId: string;\n items: Array<{\n providerPriceId: string;\n quantity?: number;\n }>;\n trialPeriodDays?: number;\n /** Provider promotion code to apply */\n providerPromotionCodeId?: string;\n metadata?: Record<string, string>;\n}\n\nexport interface StandardBilling_CreateSubscriptionResponse {\n providerSubscriptionId: string;\n status: string;\n}\n\nexport interface StandardBilling_UpdateSubscriptionRequest {\n items?: Array<{\n /** Provider-side subscription item ID (used to target the correct item on the provider).\n * If omitted, the provider transformer falls back to index-based matching. */\n providerSubscriptionItemId?: string;\n providerPriceId: string;\n quantity?: number;\n }>;\n /** Provider promotion code to apply */\n providerPromotionCodeId?: string;\n metadata?: Record<string, string>;\n}\n\nexport interface StandardBilling_CancelSubscriptionOptions {\n /** If true, subscription remains active until current period ends */\n atPeriodEnd?: boolean;\n}\n\n// ── Read/Sync (Reconciliation) ──────────────────────────────────\n\n/**\n * StandardBilling_SubscriptionData: canonical subscription representation\n * returned by the provider adapter's retrieveSubscription().\n * Used for reconciliation when webhooks may have been missed.\n */\nexport interface StandardBilling_SubscriptionData {\n providerSubscriptionId: string;\n status: SubscriptionStatus;\n currentPeriodStart: Date;\n currentPeriodEnd: Date;\n cancelAtPeriodEnd: boolean;\n trialEnd?: Date;\n items: Array<{\n providerSubscriptionItemId: string;\n providerProductId: string;\n providerPriceId: string;\n quantity: number;\n }>;\n /** Active discount on this subscription (from coupon/promotion code) */\n discount?: {\n providerCouponId: string;\n percentOff?: number;\n amountOff?: number;\n currency?: string;\n duration: string;\n durationInMonths?: number;\n end?: Date;\n };\n}\n\n/**\n * StandardBilling_InvoicePreview: canonical upcoming invoice from provider.\n * Returned by retrieveUpcomingInvoice() for plan change previews.\n */\nexport interface StandardBilling_InvoicePreview {\n amount: number;\n currency: string;\n lineItems: Array<{\n description: string;\n amount: number;\n quantity: number;\n providerPriceId?: string;\n }>;\n periodStart: Date;\n periodEnd: Date;\n}\n\n// ── Checkout / Portal (Provider-Hosted UI) ──────────────────────\n\nexport interface StandardBilling_CreateCheckoutSessionRequest {\n providerCustomerId: string;\n lineItems: Array<{\n providerPriceId: string;\n quantity?: number;\n }>;\n /** Checkout mode: 'subscription' for recurring, 'payment' for one-time */\n mode: 'subscription' | 'payment';\n successUrl: string;\n cancelUrl: string;\n /** Allow promotion codes in checkout */\n allowPromotionCodes?: boolean;\n /** Pre-fill promotion code */\n providerPromotionCodeId?: string;\n /** Trial period for subscriptions */\n trialPeriodDays?: number;\n metadata?: Record<string, string>;\n}\n\nexport interface StandardBilling_CreateCheckoutSessionResponse {\n /** Redirect URL for the hosted checkout page */\n url: string;\n sessionId: string;\n}\n\nexport interface StandardBilling_CreateCustomerPortalSessionResponse {\n /** Redirect URL for the customer portal */\n url: string;\n}\n\n// ── Usage Reporting (METERED products via Billing Meter Events) ─\n\nexport interface StandardBilling_ReportUsageRequest {\n /** Meter event name (corresponds to the meter's event_name) */\n meterEventName: string;\n /** Provider customer ID (maps to payload.stripe_customer_id in Stripe) */\n providerCustomerId: string;\n /** Usage value to report */\n value: number;\n /** Optional event timestamp */\n timestamp?: Date;\n /** Optional unique event identifier (for idempotency) */\n identifier?: string;\n}\n\n// ── Promotions ──────────────────────────────────────────────────\n\nexport interface StandardBilling_CreateCouponRequest {\n /** Discount amount in smallest currency unit (for fixed discounts) */\n amountOff?: number;\n /** Discount percentage (for percentage discounts) */\n percentOff?: number;\n currency?: string;\n duration: 'once' | 'repeating' | 'forever';\n durationInMonths?: number;\n maxRedemptions?: number;\n metadata?: Record<string, string>;\n}\n\nexport interface StandardBilling_CreateCouponResponse {\n providerCouponId: string;\n}\n\nexport interface StandardBilling_CreatePromotionCodeResponse {\n providerPromotionId: string;\n}\n\n// ===============================================================\n// Standard Billing Interface\n// ===============================================================\n\n/**\n * Provider-agnostic billing interface.\n * Each billing provider (Stripe, Paddle, etc.) implements this interface\n * through a transformer that maps canonical operations to provider SDK calls.\n */\nexport interface StandardBilling_Interface {\n // ── Customer (maps to BillingAccount) ──\n createCustomer(request: StandardBilling_CreateCustomerRequest): Promise<StandardBilling_CreateCustomerResponse>;\n updateCustomer(providerCustomerId: string, request: StandardBilling_UpdateCustomerRequest): Promise<void>;\n /**\n * Hard-delete the provider customer.\n *\n * ⚠️ NOT the subject-erasure path. Erasing a subject ANONYMIZES this customer (blank the personal\n * fields, keep the record) because the financial history hanging off it — invoices, subscriptions,\n * usage — is retained under a legal obligation and must stay attributable to its provider record.\n * Deleting the customer would strand exactly the audit trail retention exists to preserve.\n * Reserve this for a genuine account teardown with no retained history.\n */\n deleteCustomer(providerCustomerId: string): Promise<void>;\n\n // ── Payment instruments ──\n /**\n * Stored payment instruments for a customer. Used by subject erasure to enumerate what must be\n * detached; day-to-day management belongs in the provider-hosted portal.\n */\n listPaymentMethods(providerCustomerId: string): Promise<StandardBilling_PaymentMethodSummary[]>;\n /**\n * Detach an instrument from its customer. Detaching does NOT delete the instrument's transaction\n * history at the provider — it stops future charges and unlinks it from the customer, which is\n * what erasure needs and what the retained invoice record requires.\n */\n detachPaymentMethod(providerPaymentMethodId: string): Promise<void>;\n\n // ── Product/Price sync (Wildo → Provider) ──\n syncProduct(request: StandardBilling_SyncProductRequest): Promise<StandardBilling_SyncProductResponse>;\n syncPrice(request: StandardBilling_SyncPriceRequest): Promise<StandardBilling_SyncPriceResponse>;\n\n // ── Subscription lifecycle ──\n // NOTE: User-initiated plan changes, cancellation, and payment method management\n // should use createCustomerPortalSession() instead of calling these directly.\n // These methods are for: initial checkout completion, backend-driven upgrades,\n // admin-triggered changes, and webhook-driven updates.\n createSubscription(request: StandardBilling_CreateSubscriptionRequest): Promise<StandardBilling_CreateSubscriptionResponse>;\n updateSubscription(providerSubscriptionId: string, request: StandardBilling_UpdateSubscriptionRequest): Promise<void>;\n cancelSubscription(providerSubscriptionId: string, options?: StandardBilling_CancelSubscriptionOptions): Promise<void>;\n pauseSubscription(providerSubscriptionId: string): Promise<void>;\n resumeSubscription(providerSubscriptionId: string): Promise<void>;\n\n // ── Read/sync (for reconciliation and upcoming cost preview) ──\n /** On-demand retrieval for reconciliation (if webhook missed) */\n retrieveSubscription(providerSubscriptionId: string): Promise<StandardBilling_SubscriptionData>;\n /** Preview prorated cost of a plan change before user commits */\n retrieveUpcomingInvoice(providerSubscriptionId: string, newPriceId?: string): Promise<StandardBilling_InvoicePreview>;\n\n // ── Provider-hosted UI (primary user-facing interactions) ──\n /** Hosted checkout page — NO Stripe Elements needed, no PCI scope */\n createCheckoutSession(request: StandardBilling_CreateCheckoutSessionRequest): Promise<StandardBilling_CreateCheckoutSessionResponse>;\n /** Customer portal for: invoices, payment methods, billing address, cancel */\n createCustomerPortalSession(providerCustomerId: string, returnUrl: string): Promise<StandardBilling_CreateCustomerPortalSessionResponse>;\n\n // ── Usage reporting (for METERED products) ──\n reportUsage(request: StandardBilling_ReportUsageRequest): Promise<void>;\n\n // ── Webhooks ──\n /** HTTP header name that carries the webhook signature (e.g., 'stripe-signature') */\n readonly webhookSignatureHeaderName: string;\n verifyWebhookSignature(payload: string | Uint8Array, signature: string, secret: string): boolean;\n /** Parse a raw webhook payload into a canonical event. Returns null for unknown/unhandled event types. */\n parseWebhookEvent(payload: string | Uint8Array): StandardBilling_WebhookEvent | null;\n\n // ── Promotions (synced to provider) ──\n createCoupon(request: StandardBilling_CreateCouponRequest): Promise<StandardBilling_CreateCouponResponse>;\n createPromotionCode(providerCouponId: string, code: string): Promise<StandardBilling_CreatePromotionCodeResponse>;\n}\n"]}
1
+ {"version":3,"file":"billing.standard-interface.schemas.js","sourceRoot":"","sources":["../../../src/protocols/billing.standard-interface.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,kEAAkE;AAClE,yEAAyE;AACzE,kEAAkE;AAElE;;GAEG;AACH,MAAM,CAAN,IAAY,YASX;AATD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,qCAAqB,CAAA;IACrB,+CAA+C;IAC/C,iCAAiB,CAAA;IACjB,mDAAmD;IACnD,uCAAuB,CAAA;IACvB,mCAAmC;IACnC,mCAAmB,CAAA;AACrB,CAAC,EATW,YAAY,KAAZ,YAAY,QASvB;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,gCAAa,CAAA;AACf,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,mDAAmD;IACnD,yCAAuB,CAAA;IACvB,2CAA2C;IAC3C,yCAAuB,CAAA;AACzB,CAAC,EALW,cAAc,KAAd,cAAc,QAKzB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAN,IAAY,iBAOX;AAPD,WAAY,iBAAiB;IAC3B,6FAA6F;IAC7F,4DAAuC,CAAA;IACvC,2FAA2F;IAC3F,kCAAa,CAAA;IACb,oFAAoF;IACpF,sDAAiC,CAAA;AACnC,CAAC,EAPW,iBAAiB,KAAjB,iBAAiB,QAO5B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,kBAUX;AAVD,WAAY,kBAAkB;IAC5B,uCAAiB,CAAA;IACjB,2CAAqB,CAAA;IACrB,uCAAiB,CAAA;IACjB,6CAAuB,CAAA;IACvB,8DAA8D;IAC9D,+CAAyB,CAAA;IACzB,+DAAyC,CAAA;IACzC,2CAAqB,CAAA;IACrB,uCAAiB,CAAA;AACnB,CAAC,EAVW,kBAAkB,KAAlB,kBAAkB,QAU7B;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAN,IAAY,aAWX;AAXD,WAAY,aAAa;IACvB,4FAA4F;IAC5F,gCAAe,CAAA;IACf,sCAAsC;IACtC,8BAAa,CAAA;IACb,eAAe;IACf,8BAAa,CAAA;IACb,oEAAoE;IACpE,8BAAa,CAAA;IACb,yDAAyD;IACzD,gDAA+B,CAAA;AACjC,CAAC,EAXW,aAAa,KAAb,aAAa,QAWxB;AAED,kEAAkE;AAClE,+BAA+B;AAC/B,kEAAkE;AAElE;;;;GAIG;AACH,MAAM,CAAN,IAAY,yBAkCX;AAlCD,WAAY,yBAAyB;IACnC,0CAA0C;IAC1C,0EAA6C,CAAA;IAC7C,0EAA6C,CAAA;IAC7C,0EAA6C,CAAA;IAC7C,wFAA2D,CAAA;IAE3D,iEAAiE;IACjE,0DAA6B,CAAA;IAC7B,8EAAiD,CAAA;IACjD,oEAAuC,CAAA;IAEvC,oFAAoF;IACpF,sFAAyD,CAAA;IAEzD,oCAAoC;IACpC,kEAAqC,CAAA;IACrC,kEAAqC,CAAA;IAErC,mFAAmF;IACnF,qFAAqF;IACrF,8DAAiC,CAAA;IACjC,8DAAiC,CAAA;IACjC,8DAAiC,CAAA;IAEjC,yEAAyE;IACzE,oFAAuD,CAAA;IACvD,oFAAuD,CAAA;IACvD,oFAAuD,CAAA;IAEvD,kFAAkF;IAClF,qFAAqF;IACrF,gFAAmD,CAAA;IACnD,gFAAmD,CAAA;AACrD,CAAC,EAlCW,yBAAyB,KAAzB,yBAAyB,QAkCpC","sourcesContent":["/**\n * Standard Billing Interface\n * --------\n * This is the canonical interface that Wildo uses internally for all billing\n * operations. The ETL layer transforms these standard requests into\n * provider-specific API calls (e.g., Stripe, Paddle, LemonSqueezy).\n *\n * Design Principles:\n * 1. Provider-agnostic — works with any billing provider\n * 2. Hosted-first — uses provider-hosted checkout and portals (no PCI scope)\n * 3. Webhook-driven — state changes flow in via webhooks, not polling\n * 4. Scope-agnostic — billing accounts map to any Wildo scope (org, user)\n *\n * @see billing-and-features-system.md §7.1 (Standard Billing Interface)\n */\n\n// ===============================================================\n// Billing Interface Enums (canonical source, re-exported by saas-models)\n// ===============================================================\n\n/**\n * Pricing model for a price entry.\n */\nexport enum PricingModel {\n FLAT = 'flat',\n PER_UNIT = 'per_unit',\n /** Volume pricing (all units at tier price) */\n TIERED = 'tiered',\n /** Incremental (each tier priced independently) */\n GRADUATED = 'graduated',\n /** Price per package of N units */\n PACKAGE = 'package',\n}\n\n/**\n * Billing interval for recurring prices.\n */\nexport enum BillingInterval {\n MONTH = 'month',\n YEAR = 'year',\n}\n\n/**\n * Tax display mode: how prices are displayed (HT vs TTC).\n */\nexport enum TaxDisplayMode {\n /** Price amounts are HT (tax added at checkout) */\n EXCLUSIVE = 'exclusive',\n /** Price amounts are TTC (tax embedded) */\n INCLUSIVE = 'inclusive',\n}\n\n/**\n * How a mid-cycle subscription change is settled.\n *\n * A PROTOCOL vocabulary, and it lives here for the same reason {@link TaxDisplayMode} does: these three\n * values are the wire values a billing provider accepts. It was declared in `@wildo-ai/saas-models`\n * until 2026-09-08 and re-exported the other way round, which is why an authored proration could be\n * resolved by the engine and had no field on the request to travel in — the request contract could not\n * name the type without a package cycle, so the resolved value was sent as provider METADATA and\n * ignored (#516).\n *\n * `@wildo-ai/saas-models` re-exports it, so every existing consumer is unchanged.\n */\nexport enum ProrationBehavior {\n /** Credit the unused time and charge the new price pro rata, settled on the next invoice. */\n CREATE_PRORATIONS = 'create_prorations',\n /** No proration: the change takes effect and the next invoice is the new price in full. */\n NONE = 'none',\n /** Prorate and invoice the difference IMMEDIATELY rather than at the next cycle. */\n ALWAYS_INVOICE = 'always_invoice',\n}\n\n/**\n * Subscription status values (maps to Stripe subscription statuses).\n */\nexport enum SubscriptionStatus {\n ACTIVE = 'active',\n PAST_DUE = 'past_due',\n UNPAID = 'unpaid',\n CANCELLED = 'cancelled',\n /** Stripe: first payment never completed within 23h window */\n INCOMPLETE = 'incomplete',\n INCOMPLETE_EXPIRED = 'incomplete_expired',\n TRIALING = 'trialing',\n PAUSED = 'paused',\n}\n\n/**\n * Invoice lifecycle status, as the PROVIDER reports it.\n *\n * A PROTOCOL vocabulary for the same reason {@link SubscriptionStatus} is one: these are the states\n * a billing provider puts an invoice in, and the adapter's job is to map its own wire values onto\n * them. It was declared in `@wildo-ai/saas-models` until 2026-09-09 and could not be named by this\n * package at all, so `listInvoices` — the read the reconciliation sweep needs — had no way to type\n * the one field the sweep compares.\n *\n * Moved rather than duplicated: a second enum with the same five members would be two sources for\n * one closed vocabulary, which is what `CLAUDE.md` forbids. `@wildo-ai/saas-models` re-exports it\n * exactly as it already re-exports `SubscriptionStatus`, `TaxDisplayMode` and `ProrationBehavior`,\n * so every existing consumer — including the `invoiceRefs` schema, the badge palette and the\n * documentation catalogue — imports the same specifier it always did.\n */\nexport enum InvoiceStatus {\n /** Not finalized: the provider has not issued it for collection and it may still change. */\n DRAFT = 'draft',\n /** Finalized and awaiting payment. */\n OPEN = 'open',\n /** Settled. */\n PAID = 'paid',\n /** Cancelled by the provider or the merchant; never collectable. */\n VOID = 'void',\n /** Written off — payment was attempted and abandoned. */\n UNCOLLECTIBLE = 'uncollectible',\n}\n\n// ===============================================================\n// Standard Billing Event Types\n// ===============================================================\n\n/**\n * Canonical billing events the system cares about.\n * Provider-specific events are mapped to these types by the transformer.\n * Only events that affect local state (features, status) need to be handled.\n */\nexport enum StandardBilling_EventType {\n // Subscription lifecycle (→ feature sync)\n SUBSCRIPTION_CREATED = 'subscription.created',\n SUBSCRIPTION_UPDATED = 'subscription.updated',\n SUBSCRIPTION_DELETED = 'subscription.deleted',\n SUBSCRIPTION_TRIAL_WILL_END = 'subscription.trial_will_end',\n\n // Invoice status (→ billing status tracking, past_due detection)\n INVOICE_PAID = 'invoice.paid',\n INVOICE_PAYMENT_FAILED = 'invoice.payment_failed',\n INVOICE_FINALIZED = 'invoice.finalized',\n\n // Checkout (→ one-off purchase completion for ONE_TIME, CREDIT_PACK, ITEM products)\n CHECKOUT_SESSION_COMPLETED = 'checkout.session.completed',\n\n // Customer (→ billing account sync)\n CUSTOMER_UPDATED = 'customer.updated',\n CUSTOMER_DELETED = 'customer.deleted',\n\n // Coupon (→ no local action; coupons are managed through Wildo's promotion system.\n // Included for logging/audit in case coupons are modified directly on the provider.)\n COUPON_CREATED = 'coupon.created',\n COUPON_UPDATED = 'coupon.updated',\n COUPON_DELETED = 'coupon.deleted',\n\n // Customer discount (→ subscription re-sync to pick up discount changes)\n CUSTOMER_DISCOUNT_CREATED = 'customer.discount.created',\n CUSTOMER_DISCOUNT_UPDATED = 'customer.discount.updated',\n CUSTOMER_DISCOUNT_DELETED = 'customer.discount.deleted',\n\n // Payment method (→ no local action needed; provider manages via Customer Portal.\n // Included for completeness: apps can optionally log these events for audit trails.)\n PAYMENT_METHOD_ATTACHED = 'payment_method.attached',\n PAYMENT_METHOD_DETACHED = 'payment_method.detached',\n}\n\n// ===============================================================\n// Standard Billing Webhook Event\n// ===============================================================\n\n/**\n * Canonical webhook event representation.\n * Provider transformers parse raw webhook payloads into this shape.\n */\nexport interface StandardBilling_WebhookEvent {\n /** Canonical event type */\n type: StandardBilling_EventType;\n /** Provider-assigned event ID (for idempotency) */\n providerEventId: string;\n /** Event payload — shape varies by event type */\n data: Record<string, unknown>;\n /** When the event occurred at the provider */\n createdAt: Date;\n}\n\n// ===============================================================\n// Request/Response Types\n// ===============================================================\n\n// ── Customer ────────────────────────────────────────────────────\n\nexport interface StandardBilling_CreateCustomerRequest {\n /** Descriptive name (e.g., organization name or user display name) */\n name: string;\n /** Contact email for invoices and receipts */\n email: string;\n /** Arbitrary key-value metadata stored on the provider customer */\n metadata?: Record<string, string>;\n}\n\nexport interface StandardBilling_CreateCustomerResponse {\n providerCustomerId: string;\n}\n\n/**\n * Postal address on a provider customer record.\n *\n * Every field is independently clearable (`null`) rather than merely omittable: `undefined` means\n * \"leave whatever the provider already has\", `null` means \"blank it\". Subject erasure needs the\n * second meaning — an address that is silently preserved because the request could only express\n * \"no change\" is personal data surviving an erasure.\n */\nexport interface StandardBilling_CustomerAddress {\n line1?: string | null;\n line2?: string | null;\n city?: string | null;\n state?: string | null;\n postalCode?: string | null;\n /** ISO 3166-1 alpha-2 country code. */\n country?: string | null;\n}\n\nexport interface StandardBilling_UpdateCustomerRequest {\n name?: string;\n email?: string;\n metadata?: Record<string, string>;\n /**\n * Contact phone. `null` clears it at the provider — see {@link StandardBilling_CustomerAddress}\n * for why clearability is expressed separately from omission.\n */\n phone?: string | null;\n /**\n * Billing address. `null` clears the whole address; a partial object clears only the fields it\n * sets to `null` and leaves the rest untouched.\n */\n address?: StandardBilling_CustomerAddress | null;\n}\n\n/**\n * A stored payment instrument attached to a provider customer.\n *\n * Deliberately thin: enough to identify an instrument for detachment and to render a\n * \"•••• 4242\"-style hint, and nothing more. Wildo never handles raw instrument data — that is the\n * whole point of routing users through the provider-hosted portal — so this carries no PAN, no\n * expiry, and no billing details.\n */\nexport interface StandardBilling_PaymentMethodSummary {\n providerPaymentMethodId: string;\n /**\n * Instrument kind as the provider names it (`'card'`, `'sepa_debit'`, `'us_bank_account'`, …).\n * Intentionally an OPEN provider identifier, not a closed Wildo vocabulary: the set differs per\n * provider and grows without our involvement, and nothing in the framework branches on it — it\n * is carried for display and diagnostics only.\n */\n type: string;\n /** Last four digits, when the instrument exposes them. */\n last4?: string;\n}\n\n// ── Product/Price Sync ──────────────────────────────────────────\n\nexport interface StandardBilling_SyncProductRequest {\n /** Internal Wildo product key (stored in metadata for reverse lookup) */\n productKey: string;\n name: string;\n description?: string;\n /** If set, updates existing provider product instead of creating new */\n providerProductId?: string;\n metadata?: Record<string, string>;\n}\n\nexport interface StandardBilling_SyncProductResponse {\n providerProductId: string;\n}\n\nexport interface StandardBilling_SyncPriceRequest {\n providerProductId: string;\n model: PricingModel;\n /** Amount in smallest currency unit (cents) */\n amount: number;\n currency: string;\n interval?: BillingInterval;\n /** For TIERED/VOLUME pricing models */\n tiers?: Array<{\n upTo: number | null;\n unitAmount: number;\n flatAmount?: number;\n }>;\n /** For PACKAGE pricing */\n packageSize?: number;\n /** Tax behavior */\n taxBehavior?: TaxDisplayMode;\n /** If set, updates existing provider price instead of creating new */\n providerPriceId?: string;\n metadata?: Record<string, string>;\n}\n\nexport interface StandardBilling_SyncPriceResponse {\n providerPriceId: string;\n}\n\n// ── Subscription Lifecycle ──────────────────────────────────────\n\nexport interface StandardBilling_CreateSubscriptionRequest {\n providerCustomerId: string;\n items: Array<{\n providerPriceId: string;\n quantity?: number;\n }>;\n trialPeriodDays?: number;\n /** Provider promotion code to apply */\n providerPromotionCodeId?: string;\n /**\n * Ask the provider to compute tax on this purchase (#408, 2026-09-08).\n *\n * Set from the application's `billing.tax.calculationMode`, which is PROVIDER_MANAGED or\n * DISABLED — Wildo never calculates tax locally, so the only question a provider is asked is\n * whether to calculate at all. A provider that cannot compute tax ignores this; one that can and\n * is not configured for the customer's jurisdiction will say so at the call, which is the right\n * place for that failure.\n *\n * Distinct from a price's `taxBehavior`, which says whether a displayed amount INCLUDES tax.\n * That one has always reached the provider; this one decides whether tax is computed.\n */\n automaticTax?: boolean;\n /**\n * Require a payment method up front for a trial (#408, 2026-09-08).\n *\n * Set from the product's `behaviorPolicy.trial.requirePaymentMethod`, which was declared,\n * labelled, rendered on billing screens and passed to no provider call — so a trial declared as\n * requiring a card behaved identically to one that did not. Wonder Todos' enterprise plan\n * (`true`) and professional plan (`false`) were indistinguishable at the provider.\n *\n * Two provider-side consequences follow and a connector should honour both: collect the payment\n * method during checkout, and decide what happens if the trial ends without one.\n */\n requirePaymentMethodForTrial?: boolean;\n metadata?: Record<string, string>;\n}\n\nexport interface StandardBilling_CreateSubscriptionResponse {\n providerSubscriptionId: string;\n status: string;\n}\n\nexport interface StandardBilling_UpdateSubscriptionRequest {\n items?: Array<{\n /** Provider-side subscription item ID (used to target the correct item on the provider).\n * If omitted, the provider transformer falls back to index-based matching. */\n providerSubscriptionItemId?: string;\n providerPriceId: string;\n quantity?: number;\n }>;\n /** Provider promotion code to apply */\n providerPromotionCodeId?: string;\n /**\n * How the provider settles this mid-cycle change (#516).\n *\n * The engine resolves it from the target product's `upgrade`/`downgrade` behaviour policy and it\n * had nowhere to travel: it was put in `metadata`, a free-form bag the provider does not read, so a\n * product declaring `NONE` for a downgrade was still prorated by the provider's own default. Absent\n * means \"do not send one\" — the provider applies its account default, which is what every\n * subscription update did before this field existed.\n */\n prorationBehavior?: ProrationBehavior;\n metadata?: Record<string, string>;\n}\n\nexport interface StandardBilling_CancelSubscriptionOptions {\n /** If true, subscription remains active until current period ends */\n atPeriodEnd?: boolean;\n}\n\n// ── Read/Sync (Reconciliation) ──────────────────────────────────\n\n/**\n * StandardBilling_SubscriptionData: canonical subscription representation\n * returned by the provider adapter's retrieveSubscription().\n * Used for reconciliation when webhooks may have been missed.\n */\nexport interface StandardBilling_SubscriptionData {\n providerSubscriptionId: string;\n status: SubscriptionStatus;\n currentPeriodStart: Date;\n currentPeriodEnd: Date;\n cancelAtPeriodEnd: boolean;\n trialEnd?: Date;\n items: Array<{\n providerSubscriptionItemId: string;\n providerProductId: string;\n providerPriceId: string;\n quantity: number;\n }>;\n /** Active discount on this subscription (from coupon/promotion code) */\n discount?: {\n providerCouponId: string;\n percentOff?: number;\n amountOff?: number;\n currency?: string;\n duration: string;\n durationInMonths?: number;\n end?: Date;\n };\n}\n\n/**\n * StandardBilling_InvoicePreview: canonical upcoming invoice from provider.\n * Returned by retrieveUpcomingInvoice() for plan change previews.\n */\nexport interface StandardBilling_InvoicePreview {\n amount: number;\n currency: string;\n lineItems: Array<{\n description: string;\n amount: number;\n quantity: number;\n providerPriceId?: string;\n }>;\n periodStart: Date;\n periodEnd: Date;\n}\n\n/**\n * StandardBilling_InvoiceData: an invoice the provider ALREADY holds.\n *\n * Distinct from {@link StandardBilling_InvoicePreview}, and the distinction is the point: a preview\n * is a hypothetical the provider computes on request and never stores, while this is a record that\n * exists at the provider whether or not Wildo ever heard about it. The second is what a\n * reconciliation sweep needs — a webhook that was never delivered leaves an invoice that exists\n * there and nowhere here, and no amount of previewing finds it.\n *\n * Deliberately thin. It carries what `invoiceRefs` stores and nothing else: line items, tax\n * breakdowns and payment attempts live at the provider, and the customer reaches them through the\n * provider-hosted portal.\n */\nexport interface StandardBilling_InvoiceData {\n providerInvoiceId: string;\n /** The customer the invoice was billed to — the key that maps it back to a local billing account. */\n providerCustomerId: string;\n status: InvoiceStatus;\n /**\n * The invoice TOTAL, in the CURRENCY's smallest unit.\n *\n * The total, not the amount PAID: an invoice's value does not depend on whether it has been\n * settled, and an unpaid invoice recorded at zero is indistinguishable from a zero invoice.\n */\n total: number;\n currency: string;\n hostedInvoiceUrl?: string;\n invoicePdfUrl?: string;\n /** When the provider created the invoice — used to bound how far back a sweep looks. */\n createdAt: Date;\n}\n\n// ── Checkout / Portal (Provider-Hosted UI) ──────────────────────\n\nexport interface StandardBilling_CreateCheckoutSessionRequest {\n providerCustomerId: string;\n lineItems: Array<{\n providerPriceId: string;\n quantity?: number;\n }>;\n /** Checkout mode: 'subscription' for recurring, 'payment' for one-time */\n mode: 'subscription' | 'payment';\n successUrl: string;\n cancelUrl: string;\n /** Allow promotion codes in checkout */\n allowPromotionCodes?: boolean;\n /** Pre-fill promotion code */\n providerPromotionCodeId?: string;\n /** Trial period for subscriptions */\n trialPeriodDays?: number;\n /**\n * Ask the provider to compute tax on this purchase (#408, 2026-09-08).\n *\n * Set from the application's `billing.tax.calculationMode`, which is PROVIDER_MANAGED or\n * DISABLED — Wildo never calculates tax locally, so the only question a provider is asked is\n * whether to calculate at all. A provider that cannot compute tax ignores this; one that can and\n * is not configured for the customer's jurisdiction will say so at the call, which is the right\n * place for that failure.\n *\n * Distinct from a price's `taxBehavior`, which says whether a displayed amount INCLUDES tax.\n * That one has always reached the provider; this one decides whether tax is computed.\n */\n automaticTax?: boolean;\n /**\n * Require a payment method up front for a trial (#408, 2026-09-08).\n *\n * Set from the product's `behaviorPolicy.trial.requirePaymentMethod`, which was declared,\n * labelled, rendered on billing screens and passed to no provider call — so a trial declared as\n * requiring a card behaved identically to one that did not. Wonder Todos' enterprise plan\n * (`true`) and professional plan (`false`) were indistinguishable at the provider.\n *\n * Two provider-side consequences follow and a connector should honour both: collect the payment\n * method during checkout, and decide what happens if the trial ends without one.\n */\n requirePaymentMethodForTrial?: boolean;\n metadata?: Record<string, string>;\n}\n\nexport interface StandardBilling_CreateCheckoutSessionResponse {\n /** Redirect URL for the hosted checkout page */\n url: string;\n sessionId: string;\n}\n\nexport interface StandardBilling_CreateCustomerPortalSessionResponse {\n /** Redirect URL for the customer portal */\n url: string;\n}\n\n// ── Usage Reporting (METERED products via Billing Meter Events) ─\n\nexport interface StandardBilling_ReportUsageRequest {\n /** Meter event name (corresponds to the meter's event_name) */\n meterEventName: string;\n /** Provider customer ID (maps to payload.stripe_customer_id in Stripe) */\n providerCustomerId: string;\n /** Usage value to report */\n value: number;\n /** Optional event timestamp */\n timestamp?: Date;\n /** Optional unique event identifier (for idempotency) */\n identifier?: string;\n}\n\n// ── Promotions ──────────────────────────────────────────────────\n\nexport interface StandardBilling_CreateCouponRequest {\n /** Discount amount in smallest currency unit (for fixed discounts) */\n amountOff?: number;\n /** Discount percentage (for percentage discounts) */\n percentOff?: number;\n currency?: string;\n duration: 'once' | 'repeating' | 'forever';\n durationInMonths?: number;\n maxRedemptions?: number;\n metadata?: Record<string, string>;\n}\n\nexport interface StandardBilling_CreateCouponResponse {\n providerCouponId: string;\n}\n\nexport interface StandardBilling_CreatePromotionCodeResponse {\n providerPromotionId: string;\n}\n\n// ===============================================================\n// Standard Billing Interface\n// ===============================================================\n\n/**\n * Provider-agnostic billing interface.\n * Each billing provider (Stripe, Paddle, etc.) implements this interface\n * through a transformer that maps canonical operations to provider SDK calls.\n */\nexport interface StandardBilling_Interface {\n // ── Customer (maps to BillingAccount) ──\n createCustomer(request: StandardBilling_CreateCustomerRequest): Promise<StandardBilling_CreateCustomerResponse>;\n updateCustomer(providerCustomerId: string, request: StandardBilling_UpdateCustomerRequest): Promise<void>;\n /**\n * Hard-delete the provider customer.\n *\n * ⚠️ NOT the subject-erasure path. Erasing a subject ANONYMIZES this customer (blank the personal\n * fields, keep the record) because the financial history hanging off it — invoices, subscriptions,\n * usage — is retained under a legal obligation and must stay attributable to its provider record.\n * Deleting the customer would strand exactly the audit trail retention exists to preserve.\n * Reserve this for a genuine account teardown with no retained history.\n */\n deleteCustomer(providerCustomerId: string): Promise<void>;\n\n // ── Payment instruments ──\n /**\n * Stored payment instruments for a customer. Used by subject erasure to enumerate what must be\n * detached; day-to-day management belongs in the provider-hosted portal.\n */\n listPaymentMethods(providerCustomerId: string): Promise<StandardBilling_PaymentMethodSummary[]>;\n /**\n * Detach an instrument from its customer. Detaching does NOT delete the instrument's transaction\n * history at the provider — it stops future charges and unlinks it from the customer, which is\n * what erasure needs and what the retained invoice record requires.\n */\n detachPaymentMethod(providerPaymentMethodId: string): Promise<void>;\n\n // ── Product/Price sync (Wildo → Provider) ──\n syncProduct(request: StandardBilling_SyncProductRequest): Promise<StandardBilling_SyncProductResponse>;\n syncPrice(request: StandardBilling_SyncPriceRequest): Promise<StandardBilling_SyncPriceResponse>;\n\n // ── Subscription lifecycle ──\n // NOTE: User-initiated plan changes, cancellation, and payment method management\n // should use createCustomerPortalSession() instead of calling these directly.\n // These methods are for: initial checkout completion, backend-driven upgrades,\n // admin-triggered changes, and webhook-driven updates.\n createSubscription(request: StandardBilling_CreateSubscriptionRequest): Promise<StandardBilling_CreateSubscriptionResponse>;\n updateSubscription(providerSubscriptionId: string, request: StandardBilling_UpdateSubscriptionRequest): Promise<void>;\n cancelSubscription(providerSubscriptionId: string, options?: StandardBilling_CancelSubscriptionOptions): Promise<void>;\n pauseSubscription(providerSubscriptionId: string): Promise<void>;\n resumeSubscription(providerSubscriptionId: string): Promise<void>;\n\n // ── Read/sync (for reconciliation and upcoming cost preview) ──\n /** On-demand retrieval for reconciliation (if webhook missed) */\n retrieveSubscription(providerSubscriptionId: string): Promise<StandardBilling_SubscriptionData>;\n /** Preview prorated cost of a plan change before user commits */\n retrieveUpcomingInvoice(providerSubscriptionId: string, newPriceId?: string): Promise<StandardBilling_InvoicePreview>;\n /**\n * Invoices the provider holds for one customer, newest first.\n *\n * The RECOVERY read for {@link StandardBilling_EventType.INVOICE_PAID} and its siblings. Wildo\n * never creates an invoice — every local `invoiceRefs` row exists because a webhook arrived — so a\n * delivery that is lost, or that arrives while the application is down and exhausts the provider's\n * retries, leaves an invoice with no local trace and nothing that could notice. This is the only\n * call that can find one.\n *\n * `limit` bounds one page and an adapter may cap it lower; the sweep asks for a recent window\n * rather than the whole history, because an invoice older than the window has either been\n * reconciled already or is a backlog no single tick should try to drain.\n */\n listInvoices(providerCustomerId: string, options?: { limit?: number }): Promise<StandardBilling_InvoiceData[]>;\n\n // ── Provider-hosted UI (primary user-facing interactions) ──\n /** Hosted checkout page — NO Stripe Elements needed, no PCI scope */\n createCheckoutSession(request: StandardBilling_CreateCheckoutSessionRequest): Promise<StandardBilling_CreateCheckoutSessionResponse>;\n /** Customer portal for: invoices, payment methods, billing address, cancel */\n createCustomerPortalSession(providerCustomerId: string, returnUrl: string): Promise<StandardBilling_CreateCustomerPortalSessionResponse>;\n\n // ── Usage reporting (for METERED products) ──\n reportUsage(request: StandardBilling_ReportUsageRequest): Promise<void>;\n\n // ── Webhooks ──\n /** HTTP header name that carries the webhook signature (e.g., 'stripe-signature') */\n readonly webhookSignatureHeaderName: string;\n verifyWebhookSignature(payload: string | Uint8Array, signature: string, secret: string): boolean;\n /** Parse a raw webhook payload into a canonical event. Returns null for unknown/unhandled event types. */\n parseWebhookEvent(payload: string | Uint8Array): StandardBilling_WebhookEvent | null;\n\n // ── Promotions (synced to provider) ──\n createCoupon(request: StandardBilling_CreateCouponRequest): Promise<StandardBilling_CreateCouponResponse>;\n createPromotionCode(providerCouponId: string, code: string): Promise<StandardBilling_CreatePromotionCodeResponse>;\n}\n"]}
@@ -169,6 +169,78 @@ export declare const DocumentExtractionProvider_ExtractDocumentTextOutputSchema:
169
169
  }, z.core.$strip>;
170
170
  }, z.core.$strip>;
171
171
  export type DocumentExtractionProvider_ExtractDocumentTextOutput = z.infer<typeof DocumentExtractionProvider_ExtractDocumentTextOutputSchema>;
172
+ /**
173
+ * WHY an extraction failed, in the only two senses a caller can act on differently.
174
+ *
175
+ * This is the arm's most load-bearing output after the text itself, and the consequence of
176
+ * confusing the two is CORPUS DELETION rather than a misleading log line:
177
+ * `RagIngestionBackendService` deletes a field's entire chunk set when an ingestion pass yields no
178
+ * text, so reporting a provider OUTAGE as an unreadable document silently destroys a live,
179
+ * already-embedded corpus and reports success.
180
+ *
181
+ * It lived in `saas-backend-lib`'s execution seam until 2026-09-09, which is exactly why the wire
182
+ * shape lived there too: a vocabulary a provider cannot reach is one a provider cannot answer in,
183
+ * so classification had to be done by whoever could. Moving it here is what makes
184
+ * {@link DocumentExtraction_ProviderExtraction} expressible at all.
185
+ */
186
+ export declare enum DocumentExtraction_FailureClass {
187
+ /**
188
+ * The provider read the request and judged the DOCUMENT unprocessable — corrupt bytes, an
189
+ * unsupported format, a password-protected file. PERMANENT: re-sending the same bytes cannot
190
+ * succeed, so a sweep may safely stop retrying and skip the document.
191
+ */
192
+ UNREADABLE_DOCUMENT = "unreadable_document",
193
+ /**
194
+ * The provider could not be reached, refused the credential, throttled, or failed internally —
195
+ * a network error, a 401/403, a 429, any 5xx, or a timeout. TRANSIENT and, decisively, says
196
+ * NOTHING about the document. A caller must not conclude anything about the bytes from this.
197
+ */
198
+ PROVIDER_UNAVAILABLE = "provider_unavailable"
199
+ }
200
+ /**
201
+ * What a provider's `parseExtractResponse` returns: the extraction, or a CLASSIFIED refusal.
202
+ *
203
+ * A discriminated union rather than "return the output or throw", for the reason the failure class
204
+ * exists: a thrown `Error` carries no class, and the engine would have to guess one — which is the
205
+ * guess that deletes a corpus. A provider that cannot classify a response must still say which of
206
+ * the two it is, and the arm's JSDoc tells it to prefer `PROVIDER_UNAVAILABLE` when unsure,
207
+ * because that is the answer with no destructive consequence.
208
+ */
209
+ export type DocumentExtraction_ProviderExtraction = {
210
+ extracted: true;
211
+ /** Per-page text joined in document order. Markdown is kept as-is; see the output schema. */
212
+ text: string;
213
+ /** Pages the provider actually returned — the authoritative count, not the request estimate. */
214
+ pageCount: number;
215
+ /** The model the provider says produced the text. Absent means "the resolved model". */
216
+ model?: string;
217
+ usage?: DocumentExtractionProvider_Usage;
218
+ } | {
219
+ extracted: false;
220
+ failureClass: DocumentExtraction_FailureClass;
221
+ /**
222
+ * Operator-facing reason. MUST NOT contain the provider's response body or any part of the
223
+ * document: this message reaches logs, and a provider error body can echo request content.
224
+ */
225
+ message: string;
226
+ };
227
+ /**
228
+ * The framework's DEFAULT reading of an extraction response's HTTP status.
229
+ *
230
+ * Offered to every provider's `parseExtractResponse` rather than applied by the engine, because
231
+ * only the provider knows whether its vendor also signals a per-document verdict inside a 2xx
232
+ * body (Twilio does exactly that on the SMS arm). What it prevents is each provider re-deriving a
233
+ * classification whose worst case is corpus deletion.
234
+ *
235
+ * Every boundary is deliberate:
236
+ * - 4xx generally means the provider READ the request and refused THIS DOCUMENT → permanent.
237
+ * - 401/403 is a CREDENTIAL fault, not a document fault. Classifying it as unreadable would make
238
+ * a rotated key look like a corpus of corrupt files and delete chunk sets across every
239
+ * document for as long as the key was wrong.
240
+ * - 408/429 are explicitly retryable by their own definition.
241
+ * - 5xx is the provider's fault, never the document's.
242
+ */
243
+ export declare const classifyDocumentExtractionHttpStatus: (status: number) => DocumentExtraction_FailureClass;
172
244
  export declare const DocumentExtractionProvider_StatusSchema: z.ZodObject<{
173
245
  status: z.ZodEnum<typeof import("..").ExternalProvider_Status>;
174
246
  lastCheckedAt: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"document-extraction.external-connectors-models.schemas.d.ts","sourceRoot":"","sources":["../../../../src/protocols/document-extraction.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC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AgC,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,EAC/E,UAAS,MAAM,CAAC,gCAAgC,EAAE,oCAAoC,CAAqC,KAC1H,kCAeF,CAAC;AAOF,MAAM,MAAM,kCAAkC,GAAG,8CAA8C,GAAG;IAChG,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAA;AAED,MAAM,MAAM,wCAAwC,GAAG,oDAAoD,GAAG;IAC5G,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAA;AAMD;;;;;;;GAOG;AACH,eAAO,MAAM,sCAAsC;;;iBAKjD,CAAC;AACH,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sCAAsC,CAAC,CAAC;AAEtG,eAAO,MAAM,2DAA2D;;;;iBAItE,CAAC;AACH,MAAM,MAAM,qDAAqD,GAAG,CAAC,CAAC,KAAK,CACzE,OAAO,2DAA2D,CACnE,CAAC;AAMF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,yDAAyD;;;iBAKpE,CAAC;AACH,MAAM,MAAM,mDAAmD,GAAG,CAAC,CAAC,KAAK,CACvE,OAAO,yDAAyD,CACjE,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,0DAA0D;;;;;;;;iBAOrE,CAAC;AACH,MAAM,MAAM,oDAAoD,GAAG,CAAC,CAAC,KAAK,CACxE,OAAO,0DAA0D,CAClE,CAAC;AAMF,eAAO,MAAM,uCAAuC;;;;;iBAElD,CAAC;AACH,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uCAAuC,CAAC,CAAC"}
1
+ {"version":3,"file":"document-extraction.external-connectors-models.schemas.d.ts","sourceRoot":"","sources":["../../../src/protocols/document-extraction.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAC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xF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,gCAAgC,CAAC;CAC1C,GACD;IACE,SAAS,EAAE,KAAK,CAAC;IACjB,YAAY,EAAE,+BAA+B,CAAC;IAC9C;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEN;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,oCAAoC,GAAI,QAAQ,MAAM,KAAG,+BAOrE,CAAC;AAMF,eAAO,MAAM,uCAAuC;;;;;iBAElD,CAAC;AACH,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uCAAuC,CAAC,CAAC"}
@@ -157,9 +157,15 @@ export const resolveDocumentExtractionModelForApplicability = (input, catalog =
157
157
  * embeddings arm records for its own missing completion-token dimension.
158
158
  */
159
159
  export const DocumentExtractionProvider_UsageSchema = z.object({
160
- /** Pages the provider reports having processed (Mistral: `usage_info.pages_processed`). */
160
+ /**
161
+ * Pages the provider reports having processed.
162
+ *
163
+ * The FRAMEWORK's name for the dimension. Which vendor field it is projected from is the
164
+ * provider's `parseExtractResponse` to know — the wired one reads Mistral's
165
+ * `usage_info.pages_processed`, and a second provider will read something else.
166
+ */
161
167
  pagesProcessed: z.number().optional(),
162
- /** Document size the provider reports having received (Mistral: `usage_info.doc_size_bytes`). */
168
+ /** Document size the provider reports having received. Same ownership as `pagesProcessed`. */
163
169
  documentSizeBytes: z.number().optional(),
164
170
  });
165
171
  export const DocumentExtractionProvider_ExecutionTransportMetadataSchema = z.object({
@@ -209,6 +215,75 @@ export const DocumentExtractionProvider_ExtractDocumentTextOutputSchema = z.obje
209
215
  usage: DocumentExtractionProvider_UsageSchema,
210
216
  });
211
217
  // ===============================================================
218
+ // The PROVIDER-OWNED WIRE SEAM
219
+ // --------
220
+ // Until 2026-09-09 this arm declared `baseUrl`, `endpointPath`, `apiKey` and `models` — where the
221
+ // call goes and how it authenticates — and NOTHING about the body or the response. So the engine's
222
+ // execution seam composed Mistral's `/v1/ocr` request (`document: { type: 'document_url',
223
+ // document_url }`, `include_image_base64`) and read Mistral's response (`pages[].markdown`,
224
+ // `usage_info.pages_processed`) with the vendor named nowhere, and a second provider declaring
225
+ // DOCUMENT_EXTRACTION_PROVIDER would have been sent through Mistral's API carrying its own key.
226
+ //
227
+ // The remedy is the one the EMAIL and SMS arms already converged on: the provider declares PURE
228
+ // FUNCTIONS and the engine owns transport and credentials. The types those functions are written
229
+ // against live HERE rather than beside the contract, because the failure vocabulary is read by
230
+ // BOTH sides — the provider produces it, the engine's caller branches on it — and a vocabulary
231
+ // with two homes is a vocabulary that drifts.
232
+ // ===============================================================
233
+ /**
234
+ * WHY an extraction failed, in the only two senses a caller can act on differently.
235
+ *
236
+ * This is the arm's most load-bearing output after the text itself, and the consequence of
237
+ * confusing the two is CORPUS DELETION rather than a misleading log line:
238
+ * `RagIngestionBackendService` deletes a field's entire chunk set when an ingestion pass yields no
239
+ * text, so reporting a provider OUTAGE as an unreadable document silently destroys a live,
240
+ * already-embedded corpus and reports success.
241
+ *
242
+ * It lived in `saas-backend-lib`'s execution seam until 2026-09-09, which is exactly why the wire
243
+ * shape lived there too: a vocabulary a provider cannot reach is one a provider cannot answer in,
244
+ * so classification had to be done by whoever could. Moving it here is what makes
245
+ * {@link DocumentExtraction_ProviderExtraction} expressible at all.
246
+ */
247
+ export var DocumentExtraction_FailureClass;
248
+ (function (DocumentExtraction_FailureClass) {
249
+ /**
250
+ * The provider read the request and judged the DOCUMENT unprocessable — corrupt bytes, an
251
+ * unsupported format, a password-protected file. PERMANENT: re-sending the same bytes cannot
252
+ * succeed, so a sweep may safely stop retrying and skip the document.
253
+ */
254
+ DocumentExtraction_FailureClass["UNREADABLE_DOCUMENT"] = "unreadable_document";
255
+ /**
256
+ * The provider could not be reached, refused the credential, throttled, or failed internally —
257
+ * a network error, a 401/403, a 429, any 5xx, or a timeout. TRANSIENT and, decisively, says
258
+ * NOTHING about the document. A caller must not conclude anything about the bytes from this.
259
+ */
260
+ DocumentExtraction_FailureClass["PROVIDER_UNAVAILABLE"] = "provider_unavailable";
261
+ })(DocumentExtraction_FailureClass || (DocumentExtraction_FailureClass = {}));
262
+ /**
263
+ * The framework's DEFAULT reading of an extraction response's HTTP status.
264
+ *
265
+ * Offered to every provider's `parseExtractResponse` rather than applied by the engine, because
266
+ * only the provider knows whether its vendor also signals a per-document verdict inside a 2xx
267
+ * body (Twilio does exactly that on the SMS arm). What it prevents is each provider re-deriving a
268
+ * classification whose worst case is corpus deletion.
269
+ *
270
+ * Every boundary is deliberate:
271
+ * - 4xx generally means the provider READ the request and refused THIS DOCUMENT → permanent.
272
+ * - 401/403 is a CREDENTIAL fault, not a document fault. Classifying it as unreadable would make
273
+ * a rotated key look like a corpus of corrupt files and delete chunk sets across every
274
+ * document for as long as the key was wrong.
275
+ * - 408/429 are explicitly retryable by their own definition.
276
+ * - 5xx is the provider's fault, never the document's.
277
+ */
278
+ export const classifyDocumentExtractionHttpStatus = (status) => {
279
+ const isCredentialFault = status === 401 || status === 403;
280
+ const isThrottleOrTimeout = status === 408 || status === 429;
281
+ const isServerFault = status >= 500;
282
+ return isCredentialFault || isThrottleOrTimeout || isServerFault
283
+ ? DocumentExtraction_FailureClass.PROVIDER_UNAVAILABLE
284
+ : DocumentExtraction_FailureClass.UNREADABLE_DOCUMENT;
285
+ };
286
+ // ===============================================================
212
287
  // STATUS
213
288
  // ===============================================================
214
289
  export const DocumentExtractionProvider_StatusSchema = ExternalProvider_ExchangeProtocol_Status_BaseSchema.extend({
@@ -1 +1 @@
1
- {"version":3,"file":"document-extraction.external-connectors-models.schemas.js","sourceRoot":"","sources":["../../../../src/protocols/document-extraction.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAEL,sCAAsC,EAEtC,mDAAmD,GACpD,MAAM,oDAAoD,CAAA;AAE3D,iEAAiE;AACjE,+BAA+B;AAC/B,WA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zod\"\nimport {\n ExternalProvider_ExchangeProtocol_Configuration_Base,\n ExternalProvider_ExchangeProtocol_Kind,\n ExternalProvider_ExchangeProtocol_Profile_Base,\n ExternalProvider_ExchangeProtocol_Status_BaseSchema,\n} from \"../core/commons.external-connectors-models.schemas\"\n\n//===============================================================\n// Document Extraction Provider\n// --------\n// Document bytes → text. Serves the file-side TEXT PROVIDER that\n// `FileTextExtractionBackendService` owns, whose largest consumer is the RAG\n// ingestion path (`.ragSource()` corpus building).\n//\n// ## Why this is a provider at all, and not just a better library\n//\n// The local `pdfjs-dist` path reads a PDF's TEXT LAYER. A scanned document — the\n// common case for uploaded contracts, invoices and forms — is an IMAGE of a page\n// and carries no text layer, so it extracts to the empty string, contributes no\n// chunks, and becomes silently unanswerable. That is not a defect in the local\n// library; it is its nature, and it is the entire reason a provider exists here.\n//\n// ## Deliberately a SEPARATE protocol kind from `LLM_PROVIDER`\n//\n// Same reasoning as `EMBEDDINGS_PROVIDER` (RAG plan DL2) and the `IMAGE_PROVIDER`\n// precedent before it: an unmapped LLM operation key fails SILENTLY across every\n// consumer surface (the registry's semantic-operation map filters it out, the\n// executor never dispatches it, the capability slot never fills), whereas a new\n// `runtimeContract.kind` fails COMPILATION at every switch over the union. That\n// compile-enforcement is the whole argument, and it is verified rather than\n// asserted — deleting an arm from `secretRefForRuntimeContract` reddens the\n// `never` check with the offending contract named in the diagnostic.\n//\n// It also fills its own `EngineCapability.AI_DOCUMENT_EXTRACTION` slot, so an\n// application selects its OCR provider INDEPENDENTLY of its chat and embeddings\n// providers. Those are three unrelated procurement decisions — a deployment may\n// well want Anthropic for chat, OpenAI for embeddings, and Mistral for OCR — and\n// fusing any two of them into one `selection` entry makes that unexpressible.\n//===============================================================\n\n/**\n * Concrete document-extraction model ids the framework knows.\n *\n * Import path: `@wildo-ai/external-connectors-models`.\n */\nexport enum DocumentExtractionProvider_Model {\n /**\n * Mistral's OCR model alias. An ALIAS deliberately, not a dated snapshot: unlike an embedding\n * model — where the concrete id is persisted as a stamp on every chunk and a silent change\n * would fracture the vector space — extraction output is consumed immediately and re-derived\n * on every ingestion pass, so tracking the vendor's current model is a benefit rather than a\n * hazard.\n */\n MISTRAL_OCR_LATEST = \"mistral-ocr-latest\",\n}\n\n/**\n * The document-extraction operation vocabulary — deliberately DISJOINT from\n * `LLMProvider_OperationKey`, `ImageProvider_OperationKey` and\n * `EmbeddingsProvider_OperationKey` (each protocol kind owns its own operation enum, so a key's\n * membership decides its protocol without inspection).\n *\n * Import path: `@wildo-ai/external-connectors-models`.\n */\nexport enum DocumentExtractionProvider_OperationKey {\n /** One document's bytes → its text, page by page. */\n EXTRACT_DOCUMENT_TEXT = \"documentExtraction.extractDocumentText\",\n}\n\n/**\n * @wildo_source:part:start saas.external-providers.document-extraction.applicability facet:kind:api facet:audience:app-developer\n *\n * WHAT a document is being extracted FOR — the durable axis of extraction-model selection\n * (model-selection-by-applicability rule: an author names a CLASS, never a concrete model id;\n * the framework resolves the id from the catalog + preference below).\n *\n * One class today, and that is a statement rather than a placeholder: every extraction in the\n * engine feeds `FileTextExtractionBackendService`, and a second class would only be earned by a\n * surface with genuinely different requirements (a layout-preserving export, say, or a\n * cheap-and-approximate preview tier).\n */\nexport enum DocumentExtraction_Applicability {\n /** The default document-text surface: file text extraction, and the RAG corpus built on it. */\n DOCUMENT_TEXT_DEFAULT = \"document-text-default\",\n}\n/** @wildo_source:part:end saas.external-providers.document-extraction.applicability */\n\n/**\n * One row per document-extraction model: everything the framework knows about a concrete id.\n * Mirrors `Embeddings_ModelCatalogEntry`'s shape at the size this axis needs today.\n */\nexport type DocumentExtraction_ModelCatalogEntry = {\n /** The `ref` of the provider module that serves this id. */\n providerRef: string;\n /**\n * MIME types this model can process, as declared by the provider's documentation.\n *\n * Consulted BEFORE bytes leave the deployment: sending a document the model cannot read wastes\n * an egress of application content, which the data-minimization posture on the execution seam\n * exists to avoid.\n */\n supportedMimeTypes: readonly string[];\n /** FRAMEWORK OPINION — which applicability classes this model may be resolved for. */\n applicabilities: readonly DocumentExtraction_Applicability[];\n};\n\n/**\n * THE document-extraction model catalog — the single per-model fact table (the\n * `EMBEDDINGS_MODEL_CATALOG` discipline: an EXHAUSTIVE `Record`, so a new\n * `DocumentExtractionProvider_Model` member without a row is a compile error).\n */\nexport const DOCUMENT_EXTRACTION_MODEL_CATALOG: Record<\n DocumentExtractionProvider_Model,\n DocumentExtraction_ModelCatalogEntry\n> = {\n [DocumentExtractionProvider_Model.MISTRAL_OCR_LATEST]: {\n providerRef: \"mistral\",\n /**\n * Mistral's published OCR format list (docs.mistral.ai \"Known limitations\": \"Supported\n * formats for OCR: PDF, PNG, JPG, JPEG, TIFF, BMP, GIF, WEBP\"), narrowed to the MIME types\n * the engine's own extraction gate admits today.\n *\n * `application/pdf` is the only entry that is currently REACHABLE: image MIME types are\n * refused by `FileTextExtractionBackendService.isExtractionSupported`, which is a separate,\n * deliberate decision (an uploaded photo is not a document). The image types are declared\n * here anyway because this row states what the MODEL can do, not what the engine currently\n * asks it to do — and admitting images to extraction later must be an engine decision, not\n * an accidental consequence of a catalog edit.\n */\n supportedMimeTypes: [\"application/pdf\", \"image/png\", \"image/jpeg\", \"image/tiff\", \"image/webp\"],\n applicabilities: [DocumentExtraction_Applicability.DOCUMENT_TEXT_DEFAULT],\n },\n};\n\n/**\n * The framework's DEFAULT answer to \"which extraction model serves this class\", ordered by\n * preference, highest first.\n *\n * Unlike the embeddings preference — which is a MIGRATION KEY, because editing it re-binds a\n * class and forces every stamped chunk to be re-embedded — this one carries no durable\n * consequence: extraction output is re-derived on the next ingestion pass and nothing persists\n * the model that produced it. Editing this list changes what the next extraction uses and\n * nothing else.\n */\nexport const DOCUMENT_EXTRACTION_MODEL_APPLICABILITY_PREFERENCE: Record<\n DocumentExtraction_Applicability,\n readonly DocumentExtractionProvider_Model[]\n> = {\n [DocumentExtraction_Applicability.DOCUMENT_TEXT_DEFAULT]: [\n DocumentExtractionProvider_Model.MISTRAL_OCR_LATEST,\n ],\n};\n\n/** Why {@link resolveDocumentExtractionModelForApplicability} could not answer — carried into a named CONFIGURATION error. */\nexport enum DocumentExtraction_ModelResolutionFailure {\n /** The applicability has no candidate at all for this provider. */\n NO_CANDIDATE_FOR_PROVIDER = \"no_candidate_for_provider\",\n}\n\nexport type DocumentExtraction_ModelResolution =\n | { resolved: true; model: DocumentExtractionProvider_Model; entry: DocumentExtraction_ModelCatalogEntry }\n | {\n resolved: false;\n failure: DocumentExtraction_ModelResolutionFailure;\n consideredModels: readonly DocumentExtractionProvider_Model[];\n };\n\n/**\n * Resolve an applicability class to ONE concrete extraction model for a given provider.\n *\n * Fails CLOSED and explains itself (the `resolveModelForApplicability` contract): a silent\n * fallback to some other model would send application documents to a model nobody chose.\n */\nexport const resolveDocumentExtractionModelForApplicability = (\n input: { applicability: DocumentExtraction_Applicability; providerRef: string },\n catalog: Record<DocumentExtractionProvider_Model, DocumentExtraction_ModelCatalogEntry> = DOCUMENT_EXTRACTION_MODEL_CATALOG,\n): DocumentExtraction_ModelResolution => {\n const candidates = DOCUMENT_EXTRACTION_MODEL_APPLICABILITY_PREFERENCE[input.applicability];\n const forProvider = candidates.filter((model) => {\n const entry = catalog[model];\n return entry.providerRef === input.providerRef && entry.applicabilities.includes(input.applicability);\n });\n if (forProvider.length === 0) {\n return {\n resolved: false,\n failure: DocumentExtraction_ModelResolutionFailure.NO_CANDIDATE_FOR_PROVIDER,\n consideredModels: candidates,\n };\n }\n const model = forProvider[0]!;\n return { resolved: true, model, entry: catalog[model] };\n};\n\n// ===============================================================\n// Document Extraction Provider Profiles and Configurations (the config arm —\n// disjoint from LLM/image/embeddings config by construction)\n// ===============================================================\n\nexport type DocumentExtractionProvider_Profile = ExternalProvider_ExchangeProtocol_Profile_Base & {\n baseURL?: string,\n /** Model ids this provider serves (advertised for validation/UX). */\n supportedModels?: string[],\n}\n\nexport type DocumentExtractionProvider_Configuration = ExternalProvider_ExchangeProtocol_Configuration_Base & {\n customLocation?: string,\n}\n\n// ===============================================================\n// Document Extraction Operations Context\n// ===============================================================\n\n/**\n * Usage of one extraction call.\n *\n * There is NO token dimension, and its absence is structural rather than an omission: an OCR\n * call is billed and reported per PAGE, not per token. Any consumer judging usage completeness\n * for an extraction must do so on `pagesProcessed` alone — the operation-aware discipline the\n * embeddings arm records for its own missing completion-token dimension.\n */\nexport const DocumentExtractionProvider_UsageSchema = z.object({\n /** Pages the provider reports having processed (Mistral: `usage_info.pages_processed`). */\n pagesProcessed: z.number().optional(),\n /** Document size the provider reports having received (Mistral: `usage_info.doc_size_bytes`). */\n documentSizeBytes: z.number().optional(),\n});\nexport type DocumentExtractionProvider_Usage = z.infer<typeof DocumentExtractionProvider_UsageSchema>;\n\nexport const DocumentExtractionProvider_ExecutionTransportMetadataSchema = z.object({\n protocolKind: z.literal(ExternalProvider_ExchangeProtocol_Kind.DOCUMENT_EXTRACTION_PROVIDER),\n providerRef: z.string(),\n model: z.string().optional(),\n});\nexport type DocumentExtractionProvider_ExecutionTransportMetadata = z.infer<\n typeof DocumentExtractionProvider_ExecutionTransportMetadataSchema\n>;\n\n// ===============================================================\n// Document Extraction I/O Schemas\n// ===============================================================\n\n/**\n * Input DESCRIPTOR of the {@link DocumentExtractionProvider_OperationKey.EXTRACT_DOCUMENT_TEXT}\n * operation — the metadata about the document, deliberately NOT the document.\n *\n * ⚠️ THE BYTES ARE ABSENT ON PURPOSE, and this is the design decision most likely to be\n * \"corrected\" by a later reader. A `documentBase64: z.string()` field here would be structurally\n * correct and operationally dangerous: a Zod-shaped input object is the thing every diagnostic\n * path in this codebase reaches for when something goes wrong — error `context`, debug logs,\n * agent-call traces — and a multi-megabyte base64 blob of an application's private contract is\n * the single worst payload to make casually loggable. The embeddings arm reached the same\n * conclusion from the other direction (its header forbids raw texts and vectors from ever\n * entering a trace); here the prohibition is enforced by the SHAPE rather than by discipline.\n *\n * The bytes travel as a `Buffer` on the execution service's own request type, which no\n * serializer walks.\n */\nexport const DocumentExtractionProvider_ExtractDocumentTextInputSchema = z.object({\n /** The document's MIME type — checked against the model's catalog row before any egress. */\n mimeType: z.string(),\n /** Byte length of the document being sent. Diagnostic and ceiling-checking only. */\n documentByteLength: z.number().int().nonnegative(),\n});\nexport type DocumentExtractionProvider_ExtractDocumentTextInput = z.infer<\n typeof DocumentExtractionProvider_ExtractDocumentTextInputSchema\n>;\n\n/**\n * Output of {@link DocumentExtractionProvider_OperationKey.EXTRACT_DOCUMENT_TEXT}.\n *\n * `text` is the concatenation of the provider's per-page output in document order. Providers in\n * this family return MARKDOWN per page (Mistral's `pages[].markdown`), which is kept as-is:\n * headings and table structure are signal for a retrieval corpus, and stripping them to \"plain\"\n * text would discard information the provider was paid to recover.\n */\nexport const DocumentExtractionProvider_ExtractDocumentTextOutputSchema = z.object({\n text: z.string(),\n /** Pages the provider actually returned — the authoritative count, not the request's estimate. */\n pageCount: z.number().int().nonnegative(),\n /** The concrete model that produced the text. */\n model: z.string(),\n usage: DocumentExtractionProvider_UsageSchema,\n});\nexport type DocumentExtractionProvider_ExtractDocumentTextOutput = z.infer<\n typeof DocumentExtractionProvider_ExtractDocumentTextOutputSchema\n>;\n\n// ===============================================================\n// STATUS\n// ===============================================================\n\nexport const DocumentExtractionProvider_StatusSchema = ExternalProvider_ExchangeProtocol_Status_BaseSchema.extend({\n protocolKind: z.literal(ExternalProvider_ExchangeProtocol_Kind.DOCUMENT_EXTRACTION_PROVIDER),\n});\nexport type DocumentExtractionProvider_Status = z.infer<typeof DocumentExtractionProvider_StatusSchema>;\n"]}
1
+ {"version":3,"file":"document-extraction.external-connectors-models.schemas.js","sourceRoot":"","sources":["../../../src/protocols/document-extraction.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAEL,sCAAsC,EAEtC,mDAAmD,GACpD,MAAM,oDAAoD,CAAA;AAE3D,iEAAiE;AACjE,+BAA+B;AAC/B,WAAW;AACX,iEAAiE;AACjE,6EAA6E;AAC7E,mDAAmD;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;AACH,MAAM,CAAN,IAAY,+BAaX;AAbD,WAAY,+BAA+B;IACzC;;;;OAIG;IACH,8EAA2C,CAAA;IAC3C;;;;OAIG;IACH,gFAA6C,CAAA;AAC/C,CAAC,EAbW,+BAA+B,KAA/B,+BAA+B,QAa1C;AAgCD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,MAAc,EAAmC,EAAE;IACtG,MAAM,iBAAiB,GAAG,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,CAAC;IAC3D,MAAM,mBAAmB,GAAG,MAAM,KAAK,GAAG,IAAI,MAAM,KAAK,GAAG,CAAC;IAC7D,MAAM,aAAa,GAAG,MAAM,IAAI,GAAG,CAAC;IACpC,OAAO,iBAAiB,IAAI,mBAAmB,IAAI,aAAa;QAC9D,CAAC,CAAC,+BAA+B,CAAC,oBAAoB;QACtD,CAAC,CAAC,+BAA+B,CAAC,mBAAmB,CAAC;AAC1D,CAAC,CAAC;AAEF,kEAAkE;AAClE,SAAS;AACT,kEAAkE;AAElE,MAAM,CAAC,MAAM,uCAAuC,GAAG,mDAAmD,CAAC,MAAM,CAAC;IAChH,YAAY,EAAE,CAAC,CAAC,OAAO,CAAC,sCAAsC,CAAC,4BAA4B,CAAC;CAC7F,CAAC,CAAC","sourcesContent":["import { z } from \"zod\"\nimport {\n ExternalProvider_ExchangeProtocol_Configuration_Base,\n ExternalProvider_ExchangeProtocol_Kind,\n ExternalProvider_ExchangeProtocol_Profile_Base,\n ExternalProvider_ExchangeProtocol_Status_BaseSchema,\n} from \"../core/commons.external-connectors-models.schemas\"\n\n//===============================================================\n// Document Extraction Provider\n// --------\n// Document bytes → text. Serves the file-side TEXT PROVIDER that\n// `FileTextExtractionBackendService` owns, whose largest consumer is the RAG\n// ingestion path (`.ragSource()` corpus building).\n//\n// ## Why this is a provider at all, and not just a better library\n//\n// The local `pdfjs-dist` path reads a PDF's TEXT LAYER. A scanned document — the\n// common case for uploaded contracts, invoices and forms — is an IMAGE of a page\n// and carries no text layer, so it extracts to the empty string, contributes no\n// chunks, and becomes silently unanswerable. That is not a defect in the local\n// library; it is its nature, and it is the entire reason a provider exists here.\n//\n// ## Deliberately a SEPARATE protocol kind from `LLM_PROVIDER`\n//\n// Same reasoning as `EMBEDDINGS_PROVIDER` (RAG plan DL2) and the `IMAGE_PROVIDER`\n// precedent before it: an unmapped LLM operation key fails SILENTLY across every\n// consumer surface (the registry's semantic-operation map filters it out, the\n// executor never dispatches it, the capability slot never fills), whereas a new\n// `runtimeContract.kind` fails COMPILATION at every switch over the union. That\n// compile-enforcement is the whole argument, and it is verified rather than\n// asserted — deleting an arm from `secretRefForRuntimeContract` reddens the\n// `never` check with the offending contract named in the diagnostic.\n//\n// It also fills its own `EngineCapability.AI_DOCUMENT_EXTRACTION` slot, so an\n// application selects its OCR provider INDEPENDENTLY of its chat and embeddings\n// providers. Those are three unrelated procurement decisions — a deployment may\n// well want Anthropic for chat, OpenAI for embeddings, and Mistral for OCR — and\n// fusing any two of them into one `selection` entry makes that unexpressible.\n//===============================================================\n\n/**\n * Concrete document-extraction model ids the framework knows.\n *\n * Import path: `@wildo-ai/external-connectors-models`.\n */\nexport enum DocumentExtractionProvider_Model {\n /**\n * Mistral's OCR model alias. An ALIAS deliberately, not a dated snapshot: unlike an embedding\n * model — where the concrete id is persisted as a stamp on every chunk and a silent change\n * would fracture the vector space — extraction output is consumed immediately and re-derived\n * on every ingestion pass, so tracking the vendor's current model is a benefit rather than a\n * hazard.\n */\n MISTRAL_OCR_LATEST = \"mistral-ocr-latest\",\n}\n\n/**\n * The document-extraction operation vocabulary — deliberately DISJOINT from\n * `LLMProvider_OperationKey`, `ImageProvider_OperationKey` and\n * `EmbeddingsProvider_OperationKey` (each protocol kind owns its own operation enum, so a key's\n * membership decides its protocol without inspection).\n *\n * Import path: `@wildo-ai/external-connectors-models`.\n */\nexport enum DocumentExtractionProvider_OperationKey {\n /** One document's bytes → its text, page by page. */\n EXTRACT_DOCUMENT_TEXT = \"documentExtraction.extractDocumentText\",\n}\n\n/**\n * @wildo_source:part:start saas.external-providers.document-extraction.applicability facet:kind:api facet:audience:app-developer\n *\n * WHAT a document is being extracted FOR — the durable axis of extraction-model selection\n * (model-selection-by-applicability rule: an author names a CLASS, never a concrete model id;\n * the framework resolves the id from the catalog + preference below).\n *\n * One class today, and that is a statement rather than a placeholder: every extraction in the\n * engine feeds `FileTextExtractionBackendService`, and a second class would only be earned by a\n * surface with genuinely different requirements (a layout-preserving export, say, or a\n * cheap-and-approximate preview tier).\n */\nexport enum DocumentExtraction_Applicability {\n /** The default document-text surface: file text extraction, and the RAG corpus built on it. */\n DOCUMENT_TEXT_DEFAULT = \"document-text-default\",\n}\n/** @wildo_source:part:end saas.external-providers.document-extraction.applicability */\n\n/**\n * One row per document-extraction model: everything the framework knows about a concrete id.\n * Mirrors `Embeddings_ModelCatalogEntry`'s shape at the size this axis needs today.\n */\nexport type DocumentExtraction_ModelCatalogEntry = {\n /** The `ref` of the provider module that serves this id. */\n providerRef: string;\n /**\n * MIME types this model can process, as declared by the provider's documentation.\n *\n * Consulted BEFORE bytes leave the deployment: sending a document the model cannot read wastes\n * an egress of application content, which the data-minimization posture on the execution seam\n * exists to avoid.\n */\n supportedMimeTypes: readonly string[];\n /** FRAMEWORK OPINION — which applicability classes this model may be resolved for. */\n applicabilities: readonly DocumentExtraction_Applicability[];\n};\n\n/**\n * THE document-extraction model catalog — the single per-model fact table (the\n * `EMBEDDINGS_MODEL_CATALOG` discipline: an EXHAUSTIVE `Record`, so a new\n * `DocumentExtractionProvider_Model` member without a row is a compile error).\n */\nexport const DOCUMENT_EXTRACTION_MODEL_CATALOG: Record<\n DocumentExtractionProvider_Model,\n DocumentExtraction_ModelCatalogEntry\n> = {\n [DocumentExtractionProvider_Model.MISTRAL_OCR_LATEST]: {\n providerRef: \"mistral\",\n /**\n * Mistral's published OCR format list (docs.mistral.ai \"Known limitations\": \"Supported\n * formats for OCR: PDF, PNG, JPG, JPEG, TIFF, BMP, GIF, WEBP\"), narrowed to the MIME types\n * the engine's own extraction gate admits today.\n *\n * `application/pdf` is the only entry that is currently REACHABLE: image MIME types are\n * refused by `FileTextExtractionBackendService.isExtractionSupported`, which is a separate,\n * deliberate decision (an uploaded photo is not a document). The image types are declared\n * here anyway because this row states what the MODEL can do, not what the engine currently\n * asks it to do — and admitting images to extraction later must be an engine decision, not\n * an accidental consequence of a catalog edit.\n */\n supportedMimeTypes: [\"application/pdf\", \"image/png\", \"image/jpeg\", \"image/tiff\", \"image/webp\"],\n applicabilities: [DocumentExtraction_Applicability.DOCUMENT_TEXT_DEFAULT],\n },\n};\n\n/**\n * The framework's DEFAULT answer to \"which extraction model serves this class\", ordered by\n * preference, highest first.\n *\n * Unlike the embeddings preference — which is a MIGRATION KEY, because editing it re-binds a\n * class and forces every stamped chunk to be re-embedded — this one carries no durable\n * consequence: extraction output is re-derived on the next ingestion pass and nothing persists\n * the model that produced it. Editing this list changes what the next extraction uses and\n * nothing else.\n */\nexport const DOCUMENT_EXTRACTION_MODEL_APPLICABILITY_PREFERENCE: Record<\n DocumentExtraction_Applicability,\n readonly DocumentExtractionProvider_Model[]\n> = {\n [DocumentExtraction_Applicability.DOCUMENT_TEXT_DEFAULT]: [\n DocumentExtractionProvider_Model.MISTRAL_OCR_LATEST,\n ],\n};\n\n/** Why {@link resolveDocumentExtractionModelForApplicability} could not answer — carried into a named CONFIGURATION error. */\nexport enum DocumentExtraction_ModelResolutionFailure {\n /** The applicability has no candidate at all for this provider. */\n NO_CANDIDATE_FOR_PROVIDER = \"no_candidate_for_provider\",\n}\n\nexport type DocumentExtraction_ModelResolution =\n | { resolved: true; model: DocumentExtractionProvider_Model; entry: DocumentExtraction_ModelCatalogEntry }\n | {\n resolved: false;\n failure: DocumentExtraction_ModelResolutionFailure;\n consideredModels: readonly DocumentExtractionProvider_Model[];\n };\n\n/**\n * Resolve an applicability class to ONE concrete extraction model for a given provider.\n *\n * Fails CLOSED and explains itself (the `resolveModelForApplicability` contract): a silent\n * fallback to some other model would send application documents to a model nobody chose.\n */\nexport const resolveDocumentExtractionModelForApplicability = (\n input: { applicability: DocumentExtraction_Applicability; providerRef: string },\n catalog: Record<DocumentExtractionProvider_Model, DocumentExtraction_ModelCatalogEntry> = DOCUMENT_EXTRACTION_MODEL_CATALOG,\n): DocumentExtraction_ModelResolution => {\n const candidates = DOCUMENT_EXTRACTION_MODEL_APPLICABILITY_PREFERENCE[input.applicability];\n const forProvider = candidates.filter((model) => {\n const entry = catalog[model];\n return entry.providerRef === input.providerRef && entry.applicabilities.includes(input.applicability);\n });\n if (forProvider.length === 0) {\n return {\n resolved: false,\n failure: DocumentExtraction_ModelResolutionFailure.NO_CANDIDATE_FOR_PROVIDER,\n consideredModels: candidates,\n };\n }\n const model = forProvider[0]!;\n return { resolved: true, model, entry: catalog[model] };\n};\n\n// ===============================================================\n// Document Extraction Provider Profiles and Configurations (the config arm —\n// disjoint from LLM/image/embeddings config by construction)\n// ===============================================================\n\nexport type DocumentExtractionProvider_Profile = ExternalProvider_ExchangeProtocol_Profile_Base & {\n baseURL?: string,\n /** Model ids this provider serves (advertised for validation/UX). */\n supportedModels?: string[],\n}\n\nexport type DocumentExtractionProvider_Configuration = ExternalProvider_ExchangeProtocol_Configuration_Base & {\n customLocation?: string,\n}\n\n// ===============================================================\n// Document Extraction Operations Context\n// ===============================================================\n\n/**\n * Usage of one extraction call.\n *\n * There is NO token dimension, and its absence is structural rather than an omission: an OCR\n * call is billed and reported per PAGE, not per token. Any consumer judging usage completeness\n * for an extraction must do so on `pagesProcessed` alone — the operation-aware discipline the\n * embeddings arm records for its own missing completion-token dimension.\n */\nexport const DocumentExtractionProvider_UsageSchema = z.object({\n /**\n * Pages the provider reports having processed.\n *\n * The FRAMEWORK's name for the dimension. Which vendor field it is projected from is the\n * provider's `parseExtractResponse` to know — the wired one reads Mistral's\n * `usage_info.pages_processed`, and a second provider will read something else.\n */\n pagesProcessed: z.number().optional(),\n /** Document size the provider reports having received. Same ownership as `pagesProcessed`. */\n documentSizeBytes: z.number().optional(),\n});\nexport type DocumentExtractionProvider_Usage = z.infer<typeof DocumentExtractionProvider_UsageSchema>;\n\nexport const DocumentExtractionProvider_ExecutionTransportMetadataSchema = z.object({\n protocolKind: z.literal(ExternalProvider_ExchangeProtocol_Kind.DOCUMENT_EXTRACTION_PROVIDER),\n providerRef: z.string(),\n model: z.string().optional(),\n});\nexport type DocumentExtractionProvider_ExecutionTransportMetadata = z.infer<\n typeof DocumentExtractionProvider_ExecutionTransportMetadataSchema\n>;\n\n// ===============================================================\n// Document Extraction I/O Schemas\n// ===============================================================\n\n/**\n * Input DESCRIPTOR of the {@link DocumentExtractionProvider_OperationKey.EXTRACT_DOCUMENT_TEXT}\n * operation — the metadata about the document, deliberately NOT the document.\n *\n * ⚠️ THE BYTES ARE ABSENT ON PURPOSE, and this is the design decision most likely to be\n * \"corrected\" by a later reader. A `documentBase64: z.string()` field here would be structurally\n * correct and operationally dangerous: a Zod-shaped input object is the thing every diagnostic\n * path in this codebase reaches for when something goes wrong — error `context`, debug logs,\n * agent-call traces — and a multi-megabyte base64 blob of an application's private contract is\n * the single worst payload to make casually loggable. The embeddings arm reached the same\n * conclusion from the other direction (its header forbids raw texts and vectors from ever\n * entering a trace); here the prohibition is enforced by the SHAPE rather than by discipline.\n *\n * The bytes travel as a `Buffer` on the execution service's own request type, which no\n * serializer walks.\n */\nexport const DocumentExtractionProvider_ExtractDocumentTextInputSchema = z.object({\n /** The document's MIME type — checked against the model's catalog row before any egress. */\n mimeType: z.string(),\n /** Byte length of the document being sent. Diagnostic and ceiling-checking only. */\n documentByteLength: z.number().int().nonnegative(),\n});\nexport type DocumentExtractionProvider_ExtractDocumentTextInput = z.infer<\n typeof DocumentExtractionProvider_ExtractDocumentTextInputSchema\n>;\n\n/**\n * Output of {@link DocumentExtractionProvider_OperationKey.EXTRACT_DOCUMENT_TEXT}.\n *\n * `text` is the concatenation of the provider's per-page output in document order. Providers in\n * this family return MARKDOWN per page (Mistral's `pages[].markdown`), which is kept as-is:\n * headings and table structure are signal for a retrieval corpus, and stripping them to \"plain\"\n * text would discard information the provider was paid to recover.\n */\nexport const DocumentExtractionProvider_ExtractDocumentTextOutputSchema = z.object({\n text: z.string(),\n /** Pages the provider actually returned — the authoritative count, not the request's estimate. */\n pageCount: z.number().int().nonnegative(),\n /** The concrete model that produced the text. */\n model: z.string(),\n usage: DocumentExtractionProvider_UsageSchema,\n});\nexport type DocumentExtractionProvider_ExtractDocumentTextOutput = z.infer<\n typeof DocumentExtractionProvider_ExtractDocumentTextOutputSchema\n>;\n\n// ===============================================================\n// The PROVIDER-OWNED WIRE SEAM\n// --------\n// Until 2026-09-09 this arm declared `baseUrl`, `endpointPath`, `apiKey` and `models` — where the\n// call goes and how it authenticates — and NOTHING about the body or the response. So the engine's\n// execution seam composed Mistral's `/v1/ocr` request (`document: { type: 'document_url',\n// document_url }`, `include_image_base64`) and read Mistral's response (`pages[].markdown`,\n// `usage_info.pages_processed`) with the vendor named nowhere, and a second provider declaring\n// DOCUMENT_EXTRACTION_PROVIDER would have been sent through Mistral's API carrying its own key.\n//\n// The remedy is the one the EMAIL and SMS arms already converged on: the provider declares PURE\n// FUNCTIONS and the engine owns transport and credentials. The types those functions are written\n// against live HERE rather than beside the contract, because the failure vocabulary is read by\n// BOTH sides — the provider produces it, the engine's caller branches on it — and a vocabulary\n// with two homes is a vocabulary that drifts.\n// ===============================================================\n\n/**\n * WHY an extraction failed, in the only two senses a caller can act on differently.\n *\n * This is the arm's most load-bearing output after the text itself, and the consequence of\n * confusing the two is CORPUS DELETION rather than a misleading log line:\n * `RagIngestionBackendService` deletes a field's entire chunk set when an ingestion pass yields no\n * text, so reporting a provider OUTAGE as an unreadable document silently destroys a live,\n * already-embedded corpus and reports success.\n *\n * It lived in `saas-backend-lib`'s execution seam until 2026-09-09, which is exactly why the wire\n * shape lived there too: a vocabulary a provider cannot reach is one a provider cannot answer in,\n * so classification had to be done by whoever could. Moving it here is what makes\n * {@link DocumentExtraction_ProviderExtraction} expressible at all.\n */\nexport enum DocumentExtraction_FailureClass {\n /**\n * The provider read the request and judged the DOCUMENT unprocessable — corrupt bytes, an\n * unsupported format, a password-protected file. PERMANENT: re-sending the same bytes cannot\n * succeed, so a sweep may safely stop retrying and skip the document.\n */\n UNREADABLE_DOCUMENT = \"unreadable_document\",\n /**\n * The provider could not be reached, refused the credential, throttled, or failed internally —\n * a network error, a 401/403, a 429, any 5xx, or a timeout. TRANSIENT and, decisively, says\n * NOTHING about the document. A caller must not conclude anything about the bytes from this.\n */\n PROVIDER_UNAVAILABLE = \"provider_unavailable\",\n}\n\n/**\n * What a provider's `parseExtractResponse` returns: the extraction, or a CLASSIFIED refusal.\n *\n * A discriminated union rather than \"return the output or throw\", for the reason the failure class\n * exists: a thrown `Error` carries no class, and the engine would have to guess one — which is the\n * guess that deletes a corpus. A provider that cannot classify a response must still say which of\n * the two it is, and the arm's JSDoc tells it to prefer `PROVIDER_UNAVAILABLE` when unsure,\n * because that is the answer with no destructive consequence.\n */\nexport type DocumentExtraction_ProviderExtraction =\n | {\n extracted: true;\n /** Per-page text joined in document order. Markdown is kept as-is; see the output schema. */\n text: string;\n /** Pages the provider actually returned — the authoritative count, not the request estimate. */\n pageCount: number;\n /** The model the provider says produced the text. Absent means \"the resolved model\". */\n model?: string;\n usage?: DocumentExtractionProvider_Usage;\n }\n | {\n extracted: false;\n failureClass: DocumentExtraction_FailureClass;\n /**\n * Operator-facing reason. MUST NOT contain the provider's response body or any part of the\n * document: this message reaches logs, and a provider error body can echo request content.\n */\n message: string;\n };\n\n/**\n * The framework's DEFAULT reading of an extraction response's HTTP status.\n *\n * Offered to every provider's `parseExtractResponse` rather than applied by the engine, because\n * only the provider knows whether its vendor also signals a per-document verdict inside a 2xx\n * body (Twilio does exactly that on the SMS arm). What it prevents is each provider re-deriving a\n * classification whose worst case is corpus deletion.\n *\n * Every boundary is deliberate:\n * - 4xx generally means the provider READ the request and refused THIS DOCUMENT → permanent.\n * - 401/403 is a CREDENTIAL fault, not a document fault. Classifying it as unreadable would make\n * a rotated key look like a corpus of corrupt files and delete chunk sets across every\n * document for as long as the key was wrong.\n * - 408/429 are explicitly retryable by their own definition.\n * - 5xx is the provider's fault, never the document's.\n */\nexport const classifyDocumentExtractionHttpStatus = (status: number): DocumentExtraction_FailureClass => {\n const isCredentialFault = status === 401 || status === 403;\n const isThrottleOrTimeout = status === 408 || status === 429;\n const isServerFault = status >= 500;\n return isCredentialFault || isThrottleOrTimeout || isServerFault\n ? DocumentExtraction_FailureClass.PROVIDER_UNAVAILABLE\n : DocumentExtraction_FailureClass.UNREADABLE_DOCUMENT;\n};\n\n// ===============================================================\n// STATUS\n// ===============================================================\n\nexport const DocumentExtractionProvider_StatusSchema = ExternalProvider_ExchangeProtocol_Status_BaseSchema.extend({\n protocolKind: z.literal(ExternalProvider_ExchangeProtocol_Kind.DOCUMENT_EXTRACTION_PROVIDER),\n});\nexport type DocumentExtractionProvider_Status = z.infer<typeof DocumentExtractionProvider_StatusSchema>;\n"]}
@@ -297,8 +297,8 @@ export declare const EmailProvider_CampaignOutputSchema: z.ZodObject<{
297
297
  id: z.ZodString;
298
298
  status: z.ZodEnum<{
299
299
  cancelled: "cancelled";
300
- sent: "sent";
301
300
  draft: "draft";
301
+ sent: "sent";
302
302
  scheduled: "scheduled";
303
303
  sending: "sending";
304
304
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"email.external-connectors-models.schemas.d.ts","sourceRoot":"","sources":["../../../../src/protocols/email.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,oDAAoD,EACpD,sCAAsC,EACtC,8CAA8C,EAE/C,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAA2C,yCAAyC,EAAE,MAAM,uDAAuD,CAAC;AAoB3J;;;GAGG;AACH,oBAAY,uBAAuB;IACjC,aAAa,kBAAkB,CAAG,2CAA2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B,EAAE,CAAC;CACnD,CAAC;AAMF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;iBAmBrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
1
+ {"version":3,"file":"email.external-connectors-models.schemas.d.ts","sourceRoot":"","sources":["../../../src/protocols/email.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,oDAAoD,EACpD,sCAAsC,EACtC,8CAA8C,EAE/C,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAA2C,yCAAyC,EAAE,MAAM,uDAAuD,CAAC;AAoB3J;;;GAGG;AACH,oBAAY,uBAAuB;IACjC,aAAa,kBAAkB,CAAG,2CAA2C;IAC7E,SAAS,cAAc;CACxB;AAED;;;GAGG;AACH,oBAAY,4BAA4B;IACtC,QAAQ,aAAa;IACrB,IAAI,SAAS;CACd;AAED;;GAEG;AACH,oBAAY,2BAA2B;IACrC,IAAI,SAAS,CAAY,wCAAwC;IACjE,QAAQ,aAAa,CAAI,4BAA4B;IACrD,GAAG,QAAQ;CACZ;AAED;;GAEG;AACH,oBAAY,4BAA4B;IACtC,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,YAAY,iBAAiB;IAC7B,cAAc,mBAAmB;IACjC,YAAY,iBAAiB;IAC7B,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,oBAAY,wBAAwB;IAClC,IAAI,SAAS,CAAO,4CAA4C;IAChE,IAAI,SAAS,CAAO,gDAAgD;IACpE,SAAS,cAAc;CACxB;AAED;;;GAGG;AACH,oBAAY,0BAA0B;IAEpC,UAAU,eAAe;IACzB,UAAU,oBAAoB;IAC9B,aAAa,uBAAuB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CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAM5F,eAAO,MAAM,oCAAoC;;;;;;;;;;;iBAiB/C,CAAC;AACH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAMlG,eAAO,MAAM,gCAAgC;;;;;;;;;;iBAc3C,CAAC;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAM1F,MAAM,MAAM,iCAAiC,GAAG,yCAAyC,GAAG;IAC1F,sBAAsB,EAAE,OAAO,oCAAoC,CAAC;IAGpE,mBAAmB,EAAE,uBAAuB,EAAE,CAAC;IAG/C,wBAAwB,EAAE,4BAA4B,EAAE,CAAC;IAGzD,oBAAoB,CAAC,EAAE,wBAAwB,EAAE,CAAC;CACnD,CAAC;AAMF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;iBAmBrC,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"email.standard-interface.schemas.d.ts","sourceRoot":"","sources":["../../../../src/protocols/email.standard-interface.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAA2B,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAmB7I,eAAO,MAAM,2BAA2B;;;iBAGtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAMhF,eAAO,MAAM,8BAA8B;;;;;iBAKzC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF;;;;;;GAMG;AACH,oBAAY,4BAA4B;IACtC,IAAI,S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CAAmC;wBAC7B,wBAAwB,EAAE;;;;;;CAMnC,CAAC;AAEX,MAAM,MAAM,uBAAuB,GAAG,MAAM,OAAO,mCAAmC,CAAC"}
1
+ {"version":3,"file":"email.standard-interface.schemas.d.ts","sourceRoot":"","sources":["../../../src/protocols/email.standard-interface.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,wBAAwB,EAA2B,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAmB7I,eAAO,MAAM,2BAA2B;;;iBAGtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAMhF,eAAO,MAAM,8BAA8B;;;;;iBAKzC,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF;;;;;;GAMG;AACH,oBAAY,4BAA4B;IACtC,IAAI,SAAS;IACb,mBAAmB,wBAAwB;CAC5C;AAED,8EAA8E;AAC9E,oBAAY,6BAA6B;IACvC,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,SAAS,cAAc;CACxB;AAED,kFAAkF;AAClF,oBAAY,qCAAqC;IAC/C,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,kBAAkB,uBAAuB;CAC1C;AAMD,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0C3C,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAMxF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;iBAkH3C,CAAC;AAEH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAM1F,eAAO,MAAM,uCAAuC;;;;;;;;;;;;;;;;;;;;;;;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,CAAC,CAAC,KAAK,CAAC,OAAO,uCAAuC,CAAC,CAAC;AAMxG,eAAO,MAAM,wCAAwC;;;;;;;;;;;;;;iBAQnD,CAAC;AAEH,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wCAAwC,CAAC,CAAC;AAM1G,eAAO,MAAM,oCAAoC;;iBAE/C,CAAC;AAEH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAElG,eAAO,MAAM,qCAAqC;;;;;;;;;;;iBAWhD,CAAC;AAEH,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAC;AAMpG,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;iBAoBpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAM5E;;;GAGG;AACH,eAAO,MAAM,mCAAmC;wBAC7B,wBAAwB,EAAE;;;;;;CAMnC,CAAC;AAEX,MAAM,MAAM,uBAAuB,GAAG,MAAM,OAAO,mCAAmC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"embeddings.external-connectors-models.schemas.d.ts","sourceRoot":"","sources":["../../../../src/protocols/embeddings.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EACL,oDAAoD,EACpD,sCAAsC,EACtC,8CAA8C,EAE/C,MAAM,oDAAoD,CAAA;AAkB3D;;;;;GAKG;AACH,oBAAY,wBAAwB;IAClC,kGAAkG;IAClG,8BAA8B,2BAA2B;IACzD,kEAAkE;IAClE,8BAA8B,2BAA2B;CAC1D;AAED;;;;;;;;;GASG;AACH,oBAAY,+BAA+B;IACzC,8DAA8D;IAC9D,WAAW,0BAA0B;CACtC;AAED;;;;;;;;GAQG;AACH,oBAAY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AqE;IACrE,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAA;AAED,MAAM,MAAM,gCAAgC,GAAG,oDAAoD,GAAG;IACpG,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAA;AAMD;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B;;iBAGzC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF,eAAO,MAAM,mDAAmD;;;;iBAI9D,CAAC;AACH,MAAM,MAAM,6CAA6C,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mDAAmD,CAAC,CAAC;AAMhI,kFAAkF;AAClF,eAAO,MAAM,wCAAwC;;;iBAKnD,CAAC;AACH,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wCAAwC,CAAC,CAAC;AAE1G;;;;;;;GAOG;AACH,eAAO,MAAM,yCAAyC;;;;;;;iBAOpD,CAAC;AACH,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yCAAyC,CAAC,CAAC;AAM5G,eAAO,MAAM,+BAA+B;;;;;iBAE1C,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC"}
1
+ {"version":3,"file":"embeddings.external-connectors-models.schemas.d.ts","sourceRoot":"","sources":["../../../src/protocols/embeddings.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EACL,oDAAoD,EACpD,sCAAsC,EACtC,8CAA8C,EAE/C,MAAM,oDAAoD,CAAA;AAkB3D;;;;;GAKG;AACH,oBAAY,wBAAwB;IAClC,kGAAkG;IAClG,8BAA8B,2BAA2B;IACzD,kEAAkE;IAClE,8BAA8B,2BAA2B;CAC1D;AAED;;;;;;;;;GASG;AACH,oBAAY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,MAAM,0BAA0B,GAAG,8CAA8C,GAAG;IACxF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAA;AAED,MAAM,MAAM,gCAAgC,GAAG,oDAAoD,GAAG;IACpG,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAA;AAMD;;;;;GAKG;AACH,eAAO,MAAM,8BAA8B;;iBAGzC,CAAC;AACH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF,eAAO,MAAM,mDAAmD;;;;iBAI9D,CAAC;AACH,MAAM,MAAM,6CAA6C,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mDAAmD,CAAC,CAAC;AAMhI,kFAAkF;AAClF,eAAO,MAAM,wCAAwC;;;iBAKnD,CAAC;AACH,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wCAAwC,CAAC,CAAC;AAE1G;;;;;;;GAOG;AACH,eAAO,MAAM,yCAAyC;;;;;;;iBAOpD,CAAC;AACH,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yCAAyC,CAAC,CAAC;AAM5G,eAAO,MAAM,+BAA+B;;;;;iBAE1C,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"frontend.external-connectors-models.schemas.d.ts","sourceRoot":"","sources":["../../../../src/protocols/frontend.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,oDAAoD,EAAE,sCAAsC,EAAE,8CAA8C,EAAuD,MAAM,oDAAoD,CAAA;AACtQ,OAAO,EAAE,yCAAyC,EAAE,MAAM,uDAAuD,CAAC;AAGlH,MAAM,MAAM,wBAAwB,GAAG,8CAA8C,CAAC;AAEtF,MAAM,MAAM,8BAA8B,GAAG,oDAAoD,CAAC;AAElG,MAAM,MAAM,0BAA0B,GAAG,yCAAyC,CAAC;AAMnF,QAAA,MAAM,8BAA8B;;;;;iBAElC,CAAC;AAEH,eAAO,MAAM,6BAA6B,EAAE,OAAO,8BAA+D,CAAC;AACnH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC"}
1
+ {"version":3,"file":"frontend.external-connectors-models.schemas.d.ts","sourceRoot":"","sources":["../../../src/protocols/frontend.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,oDAAoD,EAAE,sCAAsC,EAAE,8CAA8C,EAAuD,MAAM,oDAAoD,CAAA;AACtQ,OAAO,EAAE,yCAAyC,EAAE,MAAM,uDAAuD,CAAC;AAGlH,MAAM,MAAM,wBAAwB,GAAG,8CAA8C,CAAC;AAEtF,MAAM,MAAM,8BAA8B,GAAG,oDAAoD,CAAC;AAElG,MAAM,MAAM,0BAA0B,GAAG,yCAAyC,CAAC;AAMnF,QAAA,MAAM,8BAA8B;;;;;iBAElC,CAAC;AAEH,eAAO,MAAM,6BAA6B,EAAE,OAAO,8BAA+D,CAAC;AACnH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC"}
@@ -98,4 +98,4 @@ export interface Hook_ScopeResolverStrategy {
98
98
  /** Whether scope resolution is required for this event type (affects error handling) */
99
99
  isScopeRequired(eventType: string): boolean;
100
100
  }
101
- //# sourceMappingURL=hooks.external-connectors-models.schemas.d.ts.map
101
+ //# sourceMappingURL=hooks-capability.external-connectors-models.schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks-capability.external-connectors-models.schemas.d.ts","sourceRoot":"","sources":["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AgB,EAAE,OAAO,EAAE,wEAAwE;IACnG,WAAW,EAAE,wBAAwB,GACpC,OAAO,CAAC,IAAI,CAAC,CAAC;CAClB;AAMD;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,0BAA0B;IACzC,+CAA+C;IAC/C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,yCAAyC;IACzC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,mDAAmD;IACnD,YAAY,CAAC,WAAW,EAAE,wBAAwB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAEzF,wFAAwF;IACxF,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;CAC7C"}
@@ -8,4 +8,4 @@
8
8
  * - WebhookCapabilityHandler: Dispatches processed events to business logic
9
9
  * - Hook_ScopeResolverStrategy: Escape hatch for custom scope resolution
10
10
  */
11
- //# sourceMappingURL=hooks.external-connectors-models.schemas.js.map
11
+ //# sourceMappingURL=hooks-capability.external-connectors-models.schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks-capability.external-connectors-models.schemas.js","sourceRoot":"","sources":["../../../src/protocols/hooks-capability.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG","sourcesContent":["/**\n * Hook Protocol Feature Types\n * \n * Standard types for the webhook processing pipeline:\n * - StandardHook_ParsedEvent: Provider-agnostic parsed event\n * - StandardHook_ResolvedScope: Resolved engine scope from event\n * - WebhookCapabilityAdapter: Runtime contract for verify + parse\n * - WebhookCapabilityHandler: Dispatches processed events to business logic\n * - Hook_ScopeResolverStrategy: Escape hatch for custom scope resolution\n */\n\n// ===============================================================\n// Standard Parsed Event (Provider-Agnostic)\n// ===============================================================\n\n/**\n * A webhook event normalized to a provider-agnostic format.\n * Produced by WebhookCapabilityAdapter.parseEvent().\n */\nexport interface StandardHook_ParsedEvent {\n /** Unique event ID from the provider (for idempotency) */\n eventId: string;\n /** Standardized event type (e.g., 'SUBSCRIPTION_CREATED') */\n eventType: string;\n /** Original provider event type (e.g., 'customer.subscription.created') */\n providerEventType: string;\n /** Provider reference (e.g., 'stripe', 'google') */\n providerRef: string;\n /** Endpoint key this event was received on (e.g., 'billing', 'calendar') */\n endpointKey: string;\n /** Parsed event payload (provider-specific structure) */\n payload: unknown;\n /** Raw event payload as received (for scope ID extraction via dot-path) */\n rawPayload: unknown;\n /** Event timestamp */\n timestamp: Date | string;\n}\n\n// ===============================================================\n// Standard Resolved Scope\n// ===============================================================\n\n/**\n * Framework scope resolved from a webhook event.\n * Maps to ExecutionContext initiatorIds fields.\n */\nexport interface StandardHook_ResolvedScope {\n applicationId?: string;\n organizationId?: string;\n userId?: string;\n /** Additional provider-specific scope IDs for audit/debug */\n providerScopeIds?: Record<string, string>;\n}\n\n// ===============================================================\n// Webhook Capability Adapter\n// ===============================================================\n\n/**\n * Adapter that bridges a capability-specific transformer\n * (e.g., StandardBilling_Interface) to the generic webhook pipeline.\n * \n * Each capability implements one adapter. The adapter normalizes\n * capability-specific verify/parse methods into the standard pipeline contract.\n * \n * Example: BillingWebhookAdapter wraps Stripe_BillingTransformer.verifyWebhookSignature()\n * and parseWebhookEvent() into the standard interface.\n */\nexport interface WebhookCapabilityAdapter {\n /** Verify the webhook signature using the capability's verification logic */\n verifySignature(\n rawBody: string | Uint8Array, \n signatureHeader: string, \n secret: string\n ): boolean | Promise<boolean>;\n\n /** \n * Parse the raw webhook body into a StandardHook_ParsedEvent.\n * Returns null if the event type is unknown/unsupported (acknowledged but not processed).\n */\n parseEvent(\n rawBody: string | Uint8Array, \n headers: Record<string, string>\n ): StandardHook_ParsedEvent | null;\n}\n\n// ===============================================================\n// Webhook Capability Handler\n// ===============================================================\n\n/**\n * Handles processed webhook events for a specific capability.\n * Dispatches to business logic (e.g., BillingWebhookEventRouter) with the ExecutionContext.\n * \n * Registered at startup and matched by endpoint capability.\n */\nexport interface WebhookCapabilityHandler {\n /** Which capability this handler serves (e.g., 'billing', 'calendar') */\n readonly capability: string;\n\n /** \n * Handle the processed webhook event with its execution context.\n * The executionContext carries the resolved scope and can be used for all DB operations.\n */\n handleEvent(\n executionContext: unknown, // ExecutionContext<any> — typed as unknown to avoid circular dependency\n parsedEvent: StandardHook_ParsedEvent\n ): Promise<void>;\n}\n\n// ===============================================================\n// Hook Scope Resolver Strategy (Escape Hatch)\n// ===============================================================\n\n/**\n * Optional override for scope resolution when the declarative\n * Hook_EndpointScopeBinding config is insufficient.\n * \n * Register with WebhookHandlerBackendService.registerCustomScopeResolver()\n * to override the generic declarative resolver for a specific endpoint.\n * \n * Use cases:\n * - Different event types within the same endpoint have scope IDs at different payload paths\n * - Complex multi-step scope resolution logic\n * - Provider-specific edge cases\n */\nexport interface Hook_ScopeResolverStrategy {\n /** Provider reference this resolver handles */\n readonly providerRef: string;\n /** Endpoint key this resolver handles */\n readonly endpointKey: string;\n\n /** Resolve the engine scope from a parsed event */\n resolveScope(parsedEvent: StandardHook_ParsedEvent): Promise<StandardHook_ResolvedScope>;\n\n /** Whether scope resolution is required for this event type (affects error handling) */\n isScopeRequired(eventType: string): boolean;\n}\n"]}