@wildo-ai/external-connectors-models 1.1.5 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/.native.tsbuildinfo +1 -0
- package/dist/esm/companion-exports.d.ts.map +1 -1
- package/dist/esm/companion-exports.js.map +1 -1
- package/dist/esm/core/commons.external-connectors-models.schemas.d.ts +10 -0
- package/dist/esm/core/commons.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/core/commons.external-connectors-models.schemas.js +10 -0
- package/dist/esm/core/commons.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/core/oauth2.enums.d.ts.map +1 -1
- package/dist/esm/core/oauth2.enums.js.map +1 -1
- package/dist/esm/core/operation-classification.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/core/operation-classification.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/core/operations.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/core/operations.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/core/security.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/core/security.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.d.ts +52 -0
- package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.js +58 -1
- package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/billing.standard-interface.schemas.d.ts +129 -4
- package/dist/esm/protocols/billing.standard-interface.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/billing.standard-interface.schemas.js.map +1 -1
- package/dist/esm/protocols/document-extraction.external-connectors-models.schemas.d.ts +56 -1
- package/dist/esm/protocols/document-extraction.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/document-extraction.external-connectors-models.schemas.js +25 -0
- package/dist/esm/protocols/document-extraction.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/email-inbound.standard-interface.schemas.d.ts +229 -0
- package/dist/esm/protocols/email-inbound.standard-interface.schemas.d.ts.map +1 -0
- package/dist/esm/protocols/email-inbound.standard-interface.schemas.js +160 -0
- package/dist/esm/protocols/email-inbound.standard-interface.schemas.js.map +1 -0
- package/dist/esm/protocols/email.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/email.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/email.standard-interface.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/email.standard-interface.schemas.js.map +1 -1
- package/dist/esm/protocols/embeddings.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/embeddings.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/file-storage.standard-interface.d.ts +179 -0
- package/dist/esm/protocols/file-storage.standard-interface.d.ts.map +1 -0
- package/dist/esm/protocols/file-storage.standard-interface.js +79 -0
- package/dist/esm/protocols/file-storage.standard-interface.js.map +1 -0
- package/dist/esm/protocols/frontend.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/frontend.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/hooks-capability.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/hooks-capability.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/hooks.external-connectors-models.schemas.d.ts +19 -1
- package/dist/esm/protocols/hooks.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/hooks.external-connectors-models.schemas.js +11 -0
- package/dist/esm/protocols/hooks.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/image.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/image.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/llm.external-connectors-models.schemas.d.ts +8 -0
- package/dist/esm/protocols/llm.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/llm.external-connectors-models.schemas.js +10 -0
- package/dist/esm/protocols/llm.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/oauth2-provider-assurance.definitions.d.ts.map +1 -1
- package/dist/esm/protocols/oauth2-provider-assurance.definitions.js.map +1 -1
- package/dist/esm/protocols/oauth2-provider-assurance.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/oauth2-provider-assurance.schemas.js.map +1 -1
- package/dist/esm/protocols/oauth2.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/oauth2.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/provider-oauth2-token-endpoint-hosts.external-connectors-models.d.ts +39 -0
- package/dist/esm/protocols/provider-oauth2-token-endpoint-hosts.external-connectors-models.d.ts.map +1 -0
- package/dist/esm/protocols/provider-oauth2-token-endpoint-hosts.external-connectors-models.js +66 -0
- package/dist/esm/protocols/provider-oauth2-token-endpoint-hosts.external-connectors-models.js.map +1 -0
- package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.d.ts +337 -5
- package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.js +324 -1
- package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/sms.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/sms.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/sms.standard-interface.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/sms.standard-interface.schemas.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-extraction.external-connectors-models.schemas.js","sourceRoot":"","sources":["../../../../src/protocols/document-extraction.external-connectors-models.schemas.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AAClG,mGAAmG;AACnG,0FAA0F;AAC1F,4FAA4F;AAC5F,+FAA+F;AAC/F,gGAAgG;AAChG,EAAE;AACF,gGAAgG;AAChG,iGAAiG;AACjG,+FAA+F;AAC/F,+FAA+F;AAC/F,8CAA8C;AAC9C,kEAAkE;AAElE;;;;;;;;;;;;;GAaG;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","sourcesContent":["import { z } from \"zod\"\nimport {\n ExternalProvider_ExchangeProtocol_Kind,\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 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"]}
|
|
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,EACL,sCAAsC,GACrC,MAAM,oDAAoD,CAAA;AAE7D,iEAAiE;AACjE,+BAA+B;AAC/B,WAAW;AACX,iEAAiE;AACjE,6EAA6E;AAC7E,mDAAmD;AACnD,EAAE;AACF,kEAAkE;AAClE,EAAE;AACF,iFAAiF;AACjF,iFAAiF;AACjF,gFAAgF;AAChF,+EAA+E;AAC/E,iFAAiF;AACjF,EAAE;AACF,+DAA+D;AAC/D,EAAE;AACF,kFAAkF;AAClF,iFAAiF;AACjF,8EAA8E;AAC9E,gFAAgF;AAChF,gFAAgF;AAChF,4EAA4E;AAC5E,4EAA4E;AAC5E,qEAAqE;AACrE,EAAE;AACF,8EAA8E;AAC9E,gFAAgF;AAChF,gFAAgF;AAChF,iFAAiF;AACjF,8EAA8E;AAC9E,iEAAiE;AAEjE;;;;GAIG;AACH,MAAM,CAAN,IAAY,gCASX;AATD,WAAY,gCAAgC;IAC1C;;;;;;OAMG;IACH,6EAAyC,CAAA;AAC3C,CAAC,EATW,gCAAgC,KAAhC,gCAAgC,QAS3C;AAED;;;;;;;GAOG;AACH,MAAM,CAAN,IAAY,uCAGX;AAHD,WAAY,uCAAuC;IACjD,qDAAqD;IACrD,2GAAgE,CAAA;AAClE,CAAC,EAHW,uCAAuC,KAAvC,uCAAuC,QAGlD;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAN,IAAY,gCAGX;AAHD,WAAY,gCAAgC;IAC1C,+FAA+F;IAC/F,mFAA+C,CAAA;AACjD,CAAC,EAHW,gCAAgC,KAAhC,gCAAgC,QAG3C;AAsBD;;;;GAIG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAG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D,CAAC,CAAC,+BAA+B,CAAC,mBAAmB,CAAC;AAC1D,CAAC,CAAC","sourcesContent":["import { z } from \"zod\"\nimport {\n ExternalProvider_ExchangeProtocol_Kind,\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 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, and what a COMPLETE poll carries (#2020): the extraction, or a\n * 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 * HOW a document-extraction provider exchanges with its vendor (#2020) — the discriminator of the runtime arm's\n * `exchange`.\n *\n * Two shapes exist in the field and they cannot be folded into one:\n * - SINGLE_REQUEST: one request carries the document and the answer carries the text (Mistral OCR).\n * - SUBMIT_AND_POLL: the vendor accepts the document, answers with a job, and the text is fetched later by polling\n * that job until it is done (Azure Document Intelligence's `Operation-Location`, VLM Run). Asynchronous Textract is\n * a job-based vendor this form does NOT serve (SigV4, S3 input, POST polls); see the private exchange type.\n * Folding this into one request is what #2001 showed failing: the first request answers a job id, not text.\n *\n * A closed vocabulary with one home, so the engine's switch over it is exhaustive: a new form, or a deleted one, is a\n * compile error at the one place that executes the exchange.\n */\nexport enum DocumentExtractionExchangeForm {\n SINGLE_REQUEST = \"single-request\",\n SUBMIT_AND_POLL = \"submit-and-poll\",\n}\n\n/**\n * What a SUBMIT_AND_POLL provider's `parseSubmitResponse` returns: the vendor's job id, or a CLASSIFIED refusal. The\n * refusal carries the same two classes as an extraction, for the same reason: a vendor refusing THIS document at\n * submission is permanent, an outage is not, and confusing them deletes a corpus.\n */\nexport type DocumentExtraction_JobSubmission =\n | {\n submitted: true;\n /** The vendor's identifier for the job. Opaque to the engine; handed back to `buildPollRequest`. */\n jobId: string;\n }\n | {\n submitted: false;\n failureClass: DocumentExtraction_FailureClass;\n /** Operator-facing; MUST NOT contain the response body or the document (see the extraction's `message`). */\n message: string;\n };\n\n/** Where a polled job stands. PENDING keeps the engine polling until the provider's deadline. */\nexport enum DocumentExtraction_JobState {\n PENDING = \"pending\",\n COMPLETE = \"complete\",\n}\n\n/**\n * What a SUBMIT_AND_POLL provider's `parsePollResponse` returns for one poll: still running, or done — with the\n * extraction or its classified refusal, exactly what a single-request parser returns.\n *\n * COMPLETE means the VENDOR says the job has ended. A job the vendor reports failed is COMPLETE with a refusal, and\n * only then may the engine submit the document again, because only then is nothing still running. A poll the vendor\n * answered with a transient error (a 5xx or 429 on the poll route) says nothing about the job, so it is PENDING: the\n * engine polls again until the deadline. Reading it as COMPLETE would stop the engine while the job may still run,\n * and a retry would then pay the vendor twice for one document.\n */\nexport type DocumentExtraction_JobPoll =\n | { state: DocumentExtraction_JobState.PENDING }\n | { state: DocumentExtraction_JobState.COMPLETE; extraction: DocumentExtraction_ProviderExtraction };\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"]}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* One authentication method's result, as a receiving server records it in `Authentication-Results`.
|
|
4
|
+
*
|
|
5
|
+
* The union of the results the three methods define, so one vocabulary serves SPF, DKIM and DMARC.
|
|
6
|
+
* Two members go beyond what a DMARC result can be — `SOFTFAIL` (SPF only) and `POLICY` (DKIM and
|
|
7
|
+
* SPF) — and are here because mapping them onto a neighbour would record a result the receiver did
|
|
8
|
+
* not report: a softfail is neither a fail nor neutral.
|
|
9
|
+
*
|
|
10
|
+
* spec-cite: RFC 8601 §2.7.1 (DKIM results: none, pass, fail, policy, neutral, temperror, permerror)
|
|
11
|
+
* and §2.7.2 (SPF results: none, pass, fail, softfail, neutral, temperror, permerror, plus policy
|
|
12
|
+
* from §2.4); DMARC results per RFC 7489 §11.2 (none, pass, fail, temperror, permerror). Fetched 2026-09-27.
|
|
13
|
+
*/
|
|
14
|
+
export declare enum EmailAuthenticationVerdict {
|
|
15
|
+
PASS = "pass",
|
|
16
|
+
FAIL = "fail",
|
|
17
|
+
SOFTFAIL = "softfail",
|
|
18
|
+
NEUTRAL = "neutral",
|
|
19
|
+
NONE = "none",
|
|
20
|
+
POLICY = "policy",
|
|
21
|
+
TEMPERROR = "temperror",
|
|
22
|
+
PERMERROR = "permerror"
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* What the receiving provider concluded about a message's origin.
|
|
26
|
+
*
|
|
27
|
+
* `dmarcAligned` is kept beside the DMARC verdict rather than folded into it because it is the fact
|
|
28
|
+
* sender assurance is built on: DMARC authenticates the `From` DOMAIN by requiring that it align with
|
|
29
|
+
* an identifier SPF or DKIM authenticated. A provider that reports DMARC `pass` has already required
|
|
30
|
+
* alignment, so for most vendors `dmarcAligned` equals `dmarc === PASS`; it is a separate field so a
|
|
31
|
+
* vendor that reports the two independently is not forced to invent one from the other.
|
|
32
|
+
*/
|
|
33
|
+
export declare const StandardInboundEmail_AuthenticationSchema: z.ZodObject<{
|
|
34
|
+
spf: z.ZodEnum<typeof EmailAuthenticationVerdict>;
|
|
35
|
+
dkim: z.ZodEnum<typeof EmailAuthenticationVerdict>;
|
|
36
|
+
dmarc: z.ZodEnum<typeof EmailAuthenticationVerdict>;
|
|
37
|
+
dmarcAligned: z.ZodBoolean;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
export type StandardInboundEmail_Authentication = z.infer<typeof StandardInboundEmail_AuthenticationSchema>;
|
|
40
|
+
export declare const StandardInboundEmail_AddressSchema: z.ZodObject<{
|
|
41
|
+
address: z.ZodString;
|
|
42
|
+
name: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$strip>;
|
|
44
|
+
export type StandardInboundEmail_Address = z.infer<typeof StandardInboundEmail_AddressSchema>;
|
|
45
|
+
/** How a MIME part asks to be presented (`Content-Disposition`). spec-cite: RFC 2183 §2.1 (`inline`) and §2.2 (`attachment`). */
|
|
46
|
+
export declare enum EmailAttachmentDisposition {
|
|
47
|
+
ATTACHMENT = "attachment",
|
|
48
|
+
INLINE = "inline"
|
|
49
|
+
}
|
|
50
|
+
/** One attachment as the provider describes it. The bytes are fetched through `openAttachment`, never inlined. */
|
|
51
|
+
export declare const StandardInboundEmail_AttachmentSchema: z.ZodObject<{
|
|
52
|
+
ref: z.ZodString;
|
|
53
|
+
filename: z.ZodString;
|
|
54
|
+
contentType: z.ZodString;
|
|
55
|
+
sizeBytes: z.ZodNumber;
|
|
56
|
+
contentId: z.ZodOptional<z.ZodString>;
|
|
57
|
+
disposition: z.ZodOptional<z.ZodEnum<typeof EmailAttachmentDisposition>>;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
export type StandardInboundEmail_Attachment = z.infer<typeof StandardInboundEmail_AttachmentSchema>;
|
|
60
|
+
/**
|
|
61
|
+
* What a provider's notification says, parsed. Small on purpose: a notification tells the engine
|
|
62
|
+
* THAT a message arrived and where to fetch it, and nothing past this point trusts it for more.
|
|
63
|
+
*/
|
|
64
|
+
export declare const StandardInboundEmail_NotificationSchema: z.ZodObject<{
|
|
65
|
+
providerMessageId: z.ZodString;
|
|
66
|
+
receivedFor: z.ZodArray<z.ZodString>;
|
|
67
|
+
receivedAt: z.ZodCoercedDate<unknown>;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
export type StandardInboundEmail_Notification = z.infer<typeof StandardInboundEmail_NotificationSchema>;
|
|
70
|
+
/**
|
|
71
|
+
* One received message, provider-neutral.
|
|
72
|
+
*
|
|
73
|
+
* The threading headers are separated out because the engine correlates threads from them;
|
|
74
|
+
* `headers` carries the rest, for a channel record that chooses to keep an allow-listed subset.
|
|
75
|
+
*/
|
|
76
|
+
export declare const StandardInboundEmail_MessageSchema: z.ZodObject<{
|
|
77
|
+
providerMessageId: z.ZodString;
|
|
78
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
79
|
+
inReplyTo: z.ZodOptional<z.ZodString>;
|
|
80
|
+
references: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
81
|
+
from: z.ZodObject<{
|
|
82
|
+
address: z.ZodString;
|
|
83
|
+
name: z.ZodOptional<z.ZodString>;
|
|
84
|
+
}, z.core.$strip>;
|
|
85
|
+
to: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
86
|
+
address: z.ZodString;
|
|
87
|
+
name: z.ZodOptional<z.ZodString>;
|
|
88
|
+
}, z.core.$strip>>>;
|
|
89
|
+
cc: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
90
|
+
address: z.ZodString;
|
|
91
|
+
name: z.ZodOptional<z.ZodString>;
|
|
92
|
+
}, z.core.$strip>>>;
|
|
93
|
+
replyTo: z.ZodOptional<z.ZodObject<{
|
|
94
|
+
address: z.ZodString;
|
|
95
|
+
name: z.ZodOptional<z.ZodString>;
|
|
96
|
+
}, z.core.$strip>>;
|
|
97
|
+
receivedFor: z.ZodArray<z.ZodString>;
|
|
98
|
+
subject: z.ZodDefault<z.ZodString>;
|
|
99
|
+
textBody: z.ZodOptional<z.ZodString>;
|
|
100
|
+
htmlBody: z.ZodOptional<z.ZodString>;
|
|
101
|
+
headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
102
|
+
authentication: z.ZodObject<{
|
|
103
|
+
spf: z.ZodEnum<typeof EmailAuthenticationVerdict>;
|
|
104
|
+
dkim: z.ZodEnum<typeof EmailAuthenticationVerdict>;
|
|
105
|
+
dmarc: z.ZodEnum<typeof EmailAuthenticationVerdict>;
|
|
106
|
+
dmarcAligned: z.ZodBoolean;
|
|
107
|
+
}, z.core.$strip>;
|
|
108
|
+
attachments: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
109
|
+
ref: z.ZodString;
|
|
110
|
+
filename: z.ZodString;
|
|
111
|
+
contentType: z.ZodString;
|
|
112
|
+
sizeBytes: z.ZodNumber;
|
|
113
|
+
contentId: z.ZodOptional<z.ZodString>;
|
|
114
|
+
disposition: z.ZodOptional<z.ZodEnum<typeof EmailAttachmentDisposition>>;
|
|
115
|
+
}, z.core.$strip>>>;
|
|
116
|
+
sizeBytes: z.ZodOptional<z.ZodNumber>;
|
|
117
|
+
receivedAt: z.ZodCoercedDate<unknown>;
|
|
118
|
+
rawRef: z.ZodOptional<z.ZodString>;
|
|
119
|
+
}, z.core.$strip>;
|
|
120
|
+
export type StandardInboundEmail_Message = z.infer<typeof StandardInboundEmail_MessageSchema>;
|
|
121
|
+
/** The bytes of one attachment. */
|
|
122
|
+
export interface StandardInboundEmail_OpenedAttachment {
|
|
123
|
+
readonly bytes: Uint8Array;
|
|
124
|
+
readonly contentType: string;
|
|
125
|
+
readonly filename: string;
|
|
126
|
+
}
|
|
127
|
+
/** The original bytes of a message, exactly as the provider serves them. */
|
|
128
|
+
export interface StandardInboundEmail_OpenedRaw {
|
|
129
|
+
readonly bytes: Uint8Array;
|
|
130
|
+
}
|
|
131
|
+
/** Where a domain stands AT THE PROVIDER — distinct from the organization's own status, which also records ownership proof. */
|
|
132
|
+
export declare enum EmailProviderDomainStatus {
|
|
133
|
+
/** The provider has not verified the domain's records yet (not started, pending, or a temporary failure it will retry). */
|
|
134
|
+
PENDING = "pending",
|
|
135
|
+
/** The provider verified the domain's records. */
|
|
136
|
+
VERIFIED = "verified",
|
|
137
|
+
/** The provider gave up verifying the records. */
|
|
138
|
+
FAILED = "failed"
|
|
139
|
+
}
|
|
140
|
+
/** One DNS record the provider asks to be published. */
|
|
141
|
+
export declare const StandardEmailDomain_DnsRecordSchema: z.ZodObject<{
|
|
142
|
+
purpose: z.ZodString;
|
|
143
|
+
type: z.ZodString;
|
|
144
|
+
name: z.ZodString;
|
|
145
|
+
value: z.ZodString;
|
|
146
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
147
|
+
status: z.ZodOptional<z.ZodString>;
|
|
148
|
+
}, z.core.$strip>;
|
|
149
|
+
export type StandardEmailDomain_DnsRecord = z.infer<typeof StandardEmailDomain_DnsRecordSchema>;
|
|
150
|
+
/** A domain as the provider describes it. */
|
|
151
|
+
export declare const StandardEmailDomainSchema: z.ZodObject<{
|
|
152
|
+
providerDomainId: z.ZodString;
|
|
153
|
+
name: z.ZodString;
|
|
154
|
+
status: z.ZodEnum<typeof EmailProviderDomainStatus>;
|
|
155
|
+
sending: z.ZodBoolean;
|
|
156
|
+
receiving: z.ZodBoolean;
|
|
157
|
+
records: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
158
|
+
purpose: z.ZodString;
|
|
159
|
+
type: z.ZodString;
|
|
160
|
+
name: z.ZodString;
|
|
161
|
+
value: z.ZodString;
|
|
162
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
163
|
+
status: z.ZodOptional<z.ZodString>;
|
|
164
|
+
}, z.core.$strip>>>;
|
|
165
|
+
}, z.core.$strip>;
|
|
166
|
+
export type StandardEmailDomain = z.infer<typeof StandardEmailDomainSchema>;
|
|
167
|
+
/**
|
|
168
|
+
* What an EMAIL_INBOUND provider implements to host an organization's own domain. Every tenant shares one
|
|
169
|
+
* provider account, so the ENGINE proves the organization owns the domain before it ever calls `createDomain`.
|
|
170
|
+
*/
|
|
171
|
+
export interface StandardEmailDomains_Interface {
|
|
172
|
+
createDomain(input: {
|
|
173
|
+
readonly name: string;
|
|
174
|
+
readonly sending: boolean;
|
|
175
|
+
readonly receiving: boolean;
|
|
176
|
+
}): Promise<StandardEmailDomain>;
|
|
177
|
+
getDomain(providerDomainId: string): Promise<StandardEmailDomain | null>;
|
|
178
|
+
/** Start the provider's (asynchronous) verification. */
|
|
179
|
+
verifyDomain(providerDomainId: string): Promise<void>;
|
|
180
|
+
deleteDomain(providerDomainId: string): Promise<void>;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* What an EMAIL_INBOUND provider implements. Built by the provider module's adapter factory with the
|
|
184
|
+
* credential the engine resolved, exactly as a billing adapter is — the module never reads a secret
|
|
185
|
+
* itself.
|
|
186
|
+
*/
|
|
187
|
+
export interface StandardInboundEmail_Interface {
|
|
188
|
+
/** Map the verified notification body onto the standard notification. Pure; refuses an unknown shape by throwing. */
|
|
189
|
+
parseNotification(body: unknown): StandardInboundEmail_Notification;
|
|
190
|
+
/** Fetch the whole message the notification announced. */
|
|
191
|
+
fetchMessage(providerMessageId: string): Promise<StandardInboundEmail_Message>;
|
|
192
|
+
/** Fetch one attachment's bytes, by the `ref` the message listed. */
|
|
193
|
+
openAttachment(ref: string): Promise<StandardInboundEmail_OpenedAttachment>;
|
|
194
|
+
/** Fetch the original message bytes, by the message's `rawRef`. */
|
|
195
|
+
openRaw(rawRef: string): Promise<StandardInboundEmail_OpenedRaw>;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* One request a provider module asks the engine to make on its behalf.
|
|
199
|
+
*
|
|
200
|
+
* `path` is appended to the contract's `baseUrl`. A provider that serves bytes from ANOTHER host (a
|
|
201
|
+
* signed download URL) returns `url` instead, and the engine admits it only against the hosts the
|
|
202
|
+
* contract declares — a provider-supplied URL is never fetched merely because a provider named it.
|
|
203
|
+
*/
|
|
204
|
+
export type InboundEmailProviderRequest = {
|
|
205
|
+
readonly path: string;
|
|
206
|
+
readonly method?: EmailProviderHttpMethod;
|
|
207
|
+
readonly jsonBody?: unknown;
|
|
208
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
209
|
+
} | {
|
|
210
|
+
readonly url: string;
|
|
211
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* The methods a provider's `path` request may use. A `url` request (a signed download link) is always a GET.
|
|
215
|
+
* Absent means GET.
|
|
216
|
+
*/
|
|
217
|
+
export declare enum EmailProviderHttpMethod {
|
|
218
|
+
GET = "GET",
|
|
219
|
+
POST = "POST",
|
|
220
|
+
PATCH = "PATCH",
|
|
221
|
+
DELETE = "DELETE"
|
|
222
|
+
}
|
|
223
|
+
/** A provider's HTTP answer, as the engine hands it to the provider's parser. */
|
|
224
|
+
export interface InboundEmailProviderResponseInput {
|
|
225
|
+
readonly status: number;
|
|
226
|
+
/** The JSON body, or `undefined` when the answer was not JSON. */
|
|
227
|
+
readonly body: unknown;
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=email-inbound.standard-interface.schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-inbound.standard-interface.schemas.d.ts","sourceRoot":"","sources":["../../../src/protocols/email-inbound.standard-interface.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBxB;;;;;;;;;;;GAWG;AACH,oBAAY,0BAA0B;IACpC,IAAI,SAAS;IACb,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,SAAS,cAAc;CACxB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,yCAAyC;;;;;iBAKpD,CAAC;AAEH,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yCAAyC,CAAC,CAAC;AAE5G,eAAO,MAAM,kCAAkC;;;iBAG7C,CAAC;AAEH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAE9F,iIAAiI;AACjI,oBAAY,0BAA0B;IACpC,UAAU,eAAe;IACzB,MAAM,WAAW;CAClB;AAED,kHAAkH;AAClH,eAAO,MAAM,qCAAqC;;;;;;;iBAShD,CAAC;AAEH,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qCAAqC,CAAC,CAAC;AAEpG;;;GAGG;AACH,eAAO,MAAM,uCAAuC;;;;iBAMlD,CAAC;AAEH,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO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AAM,EAAE,MAAM,CAAC;IACxB,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// ===============================================================
|
|
3
|
+
// Standard Inbound Email Interface (#1630)
|
|
4
|
+
// --------
|
|
5
|
+
// The canonical shape of a message an EMAIL_INBOUND provider RECEIVED for the application, and the
|
|
6
|
+
// three calls the engine makes on the provider to get it. Provider-agnostic: a vendor's module maps
|
|
7
|
+
// its own notification and message payloads onto these schemas, and nothing past that mapping ever
|
|
8
|
+
// sees a vendor field.
|
|
9
|
+
//
|
|
10
|
+
// There is deliberately NO `verify` here. The notification reaches the application through the
|
|
11
|
+
// provider's `WEBHOOK_ORIGINATOR` endpoint (the `inbound-email` key, capability `EMAIL_INBOUND`), and
|
|
12
|
+
// that endpoint is verified by the ENGINE-owned scheme its `signatureConfig` names (#1596). A
|
|
13
|
+
// provider that verified its own notifications would put the one fail-closed decision of the inbound
|
|
14
|
+
// path in vendor code, where nothing checks it.
|
|
15
|
+
// ===============================================================
|
|
16
|
+
/**
|
|
17
|
+
* One authentication method's result, as a receiving server records it in `Authentication-Results`.
|
|
18
|
+
*
|
|
19
|
+
* The union of the results the three methods define, so one vocabulary serves SPF, DKIM and DMARC.
|
|
20
|
+
* Two members go beyond what a DMARC result can be — `SOFTFAIL` (SPF only) and `POLICY` (DKIM and
|
|
21
|
+
* SPF) — and are here because mapping them onto a neighbour would record a result the receiver did
|
|
22
|
+
* not report: a softfail is neither a fail nor neutral.
|
|
23
|
+
*
|
|
24
|
+
* spec-cite: RFC 8601 §2.7.1 (DKIM results: none, pass, fail, policy, neutral, temperror, permerror)
|
|
25
|
+
* and §2.7.2 (SPF results: none, pass, fail, softfail, neutral, temperror, permerror, plus policy
|
|
26
|
+
* from §2.4); DMARC results per RFC 7489 §11.2 (none, pass, fail, temperror, permerror). Fetched 2026-09-27.
|
|
27
|
+
*/
|
|
28
|
+
export var EmailAuthenticationVerdict;
|
|
29
|
+
(function (EmailAuthenticationVerdict) {
|
|
30
|
+
EmailAuthenticationVerdict["PASS"] = "pass";
|
|
31
|
+
EmailAuthenticationVerdict["FAIL"] = "fail";
|
|
32
|
+
EmailAuthenticationVerdict["SOFTFAIL"] = "softfail";
|
|
33
|
+
EmailAuthenticationVerdict["NEUTRAL"] = "neutral";
|
|
34
|
+
EmailAuthenticationVerdict["NONE"] = "none";
|
|
35
|
+
EmailAuthenticationVerdict["POLICY"] = "policy";
|
|
36
|
+
EmailAuthenticationVerdict["TEMPERROR"] = "temperror";
|
|
37
|
+
EmailAuthenticationVerdict["PERMERROR"] = "permerror";
|
|
38
|
+
})(EmailAuthenticationVerdict || (EmailAuthenticationVerdict = {}));
|
|
39
|
+
/**
|
|
40
|
+
* What the receiving provider concluded about a message's origin.
|
|
41
|
+
*
|
|
42
|
+
* `dmarcAligned` is kept beside the DMARC verdict rather than folded into it because it is the fact
|
|
43
|
+
* sender assurance is built on: DMARC authenticates the `From` DOMAIN by requiring that it align with
|
|
44
|
+
* an identifier SPF or DKIM authenticated. A provider that reports DMARC `pass` has already required
|
|
45
|
+
* alignment, so for most vendors `dmarcAligned` equals `dmarc === PASS`; it is a separate field so a
|
|
46
|
+
* vendor that reports the two independently is not forced to invent one from the other.
|
|
47
|
+
*/
|
|
48
|
+
export const StandardInboundEmail_AuthenticationSchema = z.object({
|
|
49
|
+
spf: z.enum(EmailAuthenticationVerdict),
|
|
50
|
+
dkim: z.enum(EmailAuthenticationVerdict),
|
|
51
|
+
dmarc: z.enum(EmailAuthenticationVerdict),
|
|
52
|
+
dmarcAligned: z.boolean(),
|
|
53
|
+
});
|
|
54
|
+
export const StandardInboundEmail_AddressSchema = z.object({
|
|
55
|
+
address: z.string().min(1),
|
|
56
|
+
name: z.string().optional(),
|
|
57
|
+
});
|
|
58
|
+
/** How a MIME part asks to be presented (`Content-Disposition`). spec-cite: RFC 2183 §2.1 (`inline`) and §2.2 (`attachment`). */
|
|
59
|
+
export var EmailAttachmentDisposition;
|
|
60
|
+
(function (EmailAttachmentDisposition) {
|
|
61
|
+
EmailAttachmentDisposition["ATTACHMENT"] = "attachment";
|
|
62
|
+
EmailAttachmentDisposition["INLINE"] = "inline";
|
|
63
|
+
})(EmailAttachmentDisposition || (EmailAttachmentDisposition = {}));
|
|
64
|
+
/** One attachment as the provider describes it. The bytes are fetched through `openAttachment`, never inlined. */
|
|
65
|
+
export const StandardInboundEmail_AttachmentSchema = z.object({
|
|
66
|
+
/** Opaque to the engine; handed back to `openAttachment`. */
|
|
67
|
+
ref: z.string().min(1),
|
|
68
|
+
filename: z.string(),
|
|
69
|
+
contentType: z.string(),
|
|
70
|
+
sizeBytes: z.number().int().nonnegative(),
|
|
71
|
+
/** The `Content-ID` of an inline part, without angle brackets. */
|
|
72
|
+
contentId: z.string().optional(),
|
|
73
|
+
disposition: z.enum(EmailAttachmentDisposition).optional(),
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* What a provider's notification says, parsed. Small on purpose: a notification tells the engine
|
|
77
|
+
* THAT a message arrived and where to fetch it, and nothing past this point trusts it for more.
|
|
78
|
+
*/
|
|
79
|
+
export const StandardInboundEmail_NotificationSchema = z.object({
|
|
80
|
+
/** The provider's id for the message — what `fetchMessage` takes, and the dedup key of the channel delivery. */
|
|
81
|
+
providerMessageId: z.string().min(1),
|
|
82
|
+
/** The addresses the message was delivered FOR (the SMTP envelope recipients), which routing reads. */
|
|
83
|
+
receivedFor: z.array(z.string().min(1)).min(1),
|
|
84
|
+
receivedAt: z.coerce.date(),
|
|
85
|
+
});
|
|
86
|
+
/**
|
|
87
|
+
* One received message, provider-neutral.
|
|
88
|
+
*
|
|
89
|
+
* The threading headers are separated out because the engine correlates threads from them;
|
|
90
|
+
* `headers` carries the rest, for a channel record that chooses to keep an allow-listed subset.
|
|
91
|
+
*/
|
|
92
|
+
export const StandardInboundEmail_MessageSchema = z.object({
|
|
93
|
+
providerMessageId: z.string().min(1),
|
|
94
|
+
/** The RFC 5322 `Message-ID`, angle brackets included, or absent when the sender set none. */
|
|
95
|
+
messageId: z.string().optional(),
|
|
96
|
+
inReplyTo: z.string().optional(),
|
|
97
|
+
references: z.array(z.string()).default([]),
|
|
98
|
+
from: StandardInboundEmail_AddressSchema,
|
|
99
|
+
to: z.array(StandardInboundEmail_AddressSchema).default([]),
|
|
100
|
+
cc: z.array(StandardInboundEmail_AddressSchema).default([]),
|
|
101
|
+
replyTo: StandardInboundEmail_AddressSchema.optional(),
|
|
102
|
+
receivedFor: z.array(z.string().min(1)).min(1),
|
|
103
|
+
subject: z.string().default(""),
|
|
104
|
+
textBody: z.string().optional(),
|
|
105
|
+
htmlBody: z.string().optional(),
|
|
106
|
+
headers: z.record(z.string(), z.string()).default({}),
|
|
107
|
+
authentication: StandardInboundEmail_AuthenticationSchema,
|
|
108
|
+
attachments: z.array(StandardInboundEmail_AttachmentSchema).default([]),
|
|
109
|
+
sizeBytes: z.number().int().nonnegative().optional(),
|
|
110
|
+
receivedAt: z.coerce.date(),
|
|
111
|
+
/**
|
|
112
|
+
* Where the ORIGINAL message bytes are, when the provider keeps them (#1600). Opaque to the engine; handed
|
|
113
|
+
* to `openRaw`. Absent when the provider offers no raw copy — the engine then keeps no raw MIME.
|
|
114
|
+
*/
|
|
115
|
+
rawRef: z.string().min(1).optional(),
|
|
116
|
+
});
|
|
117
|
+
// ===============================================================
|
|
118
|
+
// Receiving domains (#1600)
|
|
119
|
+
// ===============================================================
|
|
120
|
+
/** Where a domain stands AT THE PROVIDER — distinct from the organization's own status, which also records ownership proof. */
|
|
121
|
+
export var EmailProviderDomainStatus;
|
|
122
|
+
(function (EmailProviderDomainStatus) {
|
|
123
|
+
/** The provider has not verified the domain's records yet (not started, pending, or a temporary failure it will retry). */
|
|
124
|
+
EmailProviderDomainStatus["PENDING"] = "pending";
|
|
125
|
+
/** The provider verified the domain's records. */
|
|
126
|
+
EmailProviderDomainStatus["VERIFIED"] = "verified";
|
|
127
|
+
/** The provider gave up verifying the records. */
|
|
128
|
+
EmailProviderDomainStatus["FAILED"] = "failed";
|
|
129
|
+
})(EmailProviderDomainStatus || (EmailProviderDomainStatus = {}));
|
|
130
|
+
/** One DNS record the provider asks to be published. */
|
|
131
|
+
export const StandardEmailDomain_DnsRecordSchema = z.object({
|
|
132
|
+
/** What it is for, as the provider names it (DKIM, SPF, MX, Receiving…). */
|
|
133
|
+
purpose: z.string(),
|
|
134
|
+
type: z.string(),
|
|
135
|
+
name: z.string(),
|
|
136
|
+
value: z.string(),
|
|
137
|
+
priority: z.number().int().optional(),
|
|
138
|
+
status: z.string().optional(),
|
|
139
|
+
});
|
|
140
|
+
/** A domain as the provider describes it. */
|
|
141
|
+
export const StandardEmailDomainSchema = z.object({
|
|
142
|
+
providerDomainId: z.string().min(1),
|
|
143
|
+
name: z.string().min(1),
|
|
144
|
+
status: z.enum(EmailProviderDomainStatus),
|
|
145
|
+
sending: z.boolean(),
|
|
146
|
+
receiving: z.boolean(),
|
|
147
|
+
records: z.array(StandardEmailDomain_DnsRecordSchema).default([]),
|
|
148
|
+
});
|
|
149
|
+
/**
|
|
150
|
+
* The methods a provider's `path` request may use. A `url` request (a signed download link) is always a GET.
|
|
151
|
+
* Absent means GET.
|
|
152
|
+
*/
|
|
153
|
+
export var EmailProviderHttpMethod;
|
|
154
|
+
(function (EmailProviderHttpMethod) {
|
|
155
|
+
EmailProviderHttpMethod["GET"] = "GET";
|
|
156
|
+
EmailProviderHttpMethod["POST"] = "POST";
|
|
157
|
+
EmailProviderHttpMethod["PATCH"] = "PATCH";
|
|
158
|
+
EmailProviderHttpMethod["DELETE"] = "DELETE";
|
|
159
|
+
})(EmailProviderHttpMethod || (EmailProviderHttpMethod = {}));
|
|
160
|
+
//# sourceMappingURL=email-inbound.standard-interface.schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"email-inbound.standard-interface.schemas.js","sourceRoot":"","sources":["../../../src/protocols/email-inbound.standard-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C,EALW,uBAAuB,KAAvB,uBAAuB,QAKlC","sourcesContent":["import { z } from \"zod\";\n\n// ===============================================================\n// Standard Inbound Email Interface (#1630)\n// --------\n// The canonical shape of a message an EMAIL_INBOUND provider RECEIVED for the application, and the\n// three calls the engine makes on the provider to get it. Provider-agnostic: a vendor's module maps\n// its own notification and message payloads onto these schemas, and nothing past that mapping ever\n// sees a vendor field.\n//\n// There is deliberately NO `verify` here. The notification reaches the application through the\n// provider's `WEBHOOK_ORIGINATOR` endpoint (the `inbound-email` key, capability `EMAIL_INBOUND`), and\n// that endpoint is verified by the ENGINE-owned scheme its `signatureConfig` names (#1596). A\n// provider that verified its own notifications would put the one fail-closed decision of the inbound\n// path in vendor code, where nothing checks it.\n// ===============================================================\n\n/**\n * One authentication method's result, as a receiving server records it in `Authentication-Results`.\n *\n * The union of the results the three methods define, so one vocabulary serves SPF, DKIM and DMARC.\n * Two members go beyond what a DMARC result can be — `SOFTFAIL` (SPF only) and `POLICY` (DKIM and\n * SPF) — and are here because mapping them onto a neighbour would record a result the receiver did\n * not report: a softfail is neither a fail nor neutral.\n *\n * spec-cite: RFC 8601 §2.7.1 (DKIM results: none, pass, fail, policy, neutral, temperror, permerror)\n * and §2.7.2 (SPF results: none, pass, fail, softfail, neutral, temperror, permerror, plus policy\n * from §2.4); DMARC results per RFC 7489 §11.2 (none, pass, fail, temperror, permerror). Fetched 2026-09-27.\n */\nexport enum EmailAuthenticationVerdict {\n PASS = \"pass\",\n FAIL = \"fail\",\n SOFTFAIL = \"softfail\",\n NEUTRAL = \"neutral\",\n NONE = \"none\",\n POLICY = \"policy\",\n TEMPERROR = \"temperror\",\n PERMERROR = \"permerror\",\n}\n\n/**\n * What the receiving provider concluded about a message's origin.\n *\n * `dmarcAligned` is kept beside the DMARC verdict rather than folded into it because it is the fact\n * sender assurance is built on: DMARC authenticates the `From` DOMAIN by requiring that it align with\n * an identifier SPF or DKIM authenticated. A provider that reports DMARC `pass` has already required\n * alignment, so for most vendors `dmarcAligned` equals `dmarc === PASS`; it is a separate field so a\n * vendor that reports the two independently is not forced to invent one from the other.\n */\nexport const StandardInboundEmail_AuthenticationSchema = z.object({\n spf: z.enum(EmailAuthenticationVerdict),\n dkim: z.enum(EmailAuthenticationVerdict),\n dmarc: z.enum(EmailAuthenticationVerdict),\n dmarcAligned: z.boolean(),\n});\n\nexport type StandardInboundEmail_Authentication = z.infer<typeof StandardInboundEmail_AuthenticationSchema>;\n\nexport const StandardInboundEmail_AddressSchema = z.object({\n address: z.string().min(1),\n name: z.string().optional(),\n});\n\nexport type StandardInboundEmail_Address = z.infer<typeof StandardInboundEmail_AddressSchema>;\n\n/** How a MIME part asks to be presented (`Content-Disposition`). spec-cite: RFC 2183 §2.1 (`inline`) and §2.2 (`attachment`). */\nexport enum EmailAttachmentDisposition {\n ATTACHMENT = \"attachment\",\n INLINE = \"inline\",\n}\n\n/** One attachment as the provider describes it. The bytes are fetched through `openAttachment`, never inlined. */\nexport const StandardInboundEmail_AttachmentSchema = z.object({\n /** Opaque to the engine; handed back to `openAttachment`. */\n ref: z.string().min(1),\n filename: z.string(),\n contentType: z.string(),\n sizeBytes: z.number().int().nonnegative(),\n /** The `Content-ID` of an inline part, without angle brackets. */\n contentId: z.string().optional(),\n disposition: z.enum(EmailAttachmentDisposition).optional(),\n});\n\nexport type StandardInboundEmail_Attachment = z.infer<typeof StandardInboundEmail_AttachmentSchema>;\n\n/**\n * What a provider's notification says, parsed. Small on purpose: a notification tells the engine\n * THAT a message arrived and where to fetch it, and nothing past this point trusts it for more.\n */\nexport const StandardInboundEmail_NotificationSchema = z.object({\n /** The provider's id for the message — what `fetchMessage` takes, and the dedup key of the channel delivery. */\n providerMessageId: z.string().min(1),\n /** The addresses the message was delivered FOR (the SMTP envelope recipients), which routing reads. */\n receivedFor: z.array(z.string().min(1)).min(1),\n receivedAt: z.coerce.date(),\n});\n\nexport type StandardInboundEmail_Notification = z.infer<typeof StandardInboundEmail_NotificationSchema>;\n\n/**\n * One received message, provider-neutral.\n *\n * The threading headers are separated out because the engine correlates threads from them;\n * `headers` carries the rest, for a channel record that chooses to keep an allow-listed subset.\n */\nexport const StandardInboundEmail_MessageSchema = z.object({\n providerMessageId: z.string().min(1),\n /** The RFC 5322 `Message-ID`, angle brackets included, or absent when the sender set none. */\n messageId: z.string().optional(),\n inReplyTo: z.string().optional(),\n references: z.array(z.string()).default([]),\n from: StandardInboundEmail_AddressSchema,\n to: z.array(StandardInboundEmail_AddressSchema).default([]),\n cc: z.array(StandardInboundEmail_AddressSchema).default([]),\n replyTo: StandardInboundEmail_AddressSchema.optional(),\n receivedFor: z.array(z.string().min(1)).min(1),\n subject: z.string().default(\"\"),\n textBody: z.string().optional(),\n htmlBody: z.string().optional(),\n headers: z.record(z.string(), z.string()).default({}),\n authentication: StandardInboundEmail_AuthenticationSchema,\n attachments: z.array(StandardInboundEmail_AttachmentSchema).default([]),\n sizeBytes: z.number().int().nonnegative().optional(),\n receivedAt: z.coerce.date(),\n /**\n * Where the ORIGINAL message bytes are, when the provider keeps them (#1600). Opaque to the engine; handed\n * to `openRaw`. Absent when the provider offers no raw copy — the engine then keeps no raw MIME.\n */\n rawRef: z.string().min(1).optional(),\n});\n\nexport type StandardInboundEmail_Message = z.infer<typeof StandardInboundEmail_MessageSchema>;\n\n/** The bytes of one attachment. */\nexport interface StandardInboundEmail_OpenedAttachment {\n readonly bytes: Uint8Array;\n readonly contentType: string;\n readonly filename: string;\n}\n\n/** The original bytes of a message, exactly as the provider serves them. */\nexport interface StandardInboundEmail_OpenedRaw {\n readonly bytes: Uint8Array;\n}\n\n// ===============================================================\n// Receiving domains (#1600)\n// ===============================================================\n\n/** Where a domain stands AT THE PROVIDER — distinct from the organization's own status, which also records ownership proof. */\nexport enum EmailProviderDomainStatus {\n /** The provider has not verified the domain's records yet (not started, pending, or a temporary failure it will retry). */\n PENDING = \"pending\",\n /** The provider verified the domain's records. */\n VERIFIED = \"verified\",\n /** The provider gave up verifying the records. */\n FAILED = \"failed\",\n}\n\n/** One DNS record the provider asks to be published. */\nexport const StandardEmailDomain_DnsRecordSchema = z.object({\n /** What it is for, as the provider names it (DKIM, SPF, MX, Receiving…). */\n purpose: z.string(),\n type: z.string(),\n name: z.string(),\n value: z.string(),\n priority: z.number().int().optional(),\n status: z.string().optional(),\n});\n\nexport type StandardEmailDomain_DnsRecord = z.infer<typeof StandardEmailDomain_DnsRecordSchema>;\n\n/** A domain as the provider describes it. */\nexport const StandardEmailDomainSchema = z.object({\n providerDomainId: z.string().min(1),\n name: z.string().min(1),\n status: z.enum(EmailProviderDomainStatus),\n sending: z.boolean(),\n receiving: z.boolean(),\n records: z.array(StandardEmailDomain_DnsRecordSchema).default([]),\n});\n\nexport type StandardEmailDomain = z.infer<typeof StandardEmailDomainSchema>;\n\n/**\n * What an EMAIL_INBOUND provider implements to host an organization's own domain. Every tenant shares one\n * provider account, so the ENGINE proves the organization owns the domain before it ever calls `createDomain`.\n */\nexport interface StandardEmailDomains_Interface {\n createDomain(input: { readonly name: string; readonly sending: boolean; readonly receiving: boolean }): Promise<StandardEmailDomain>;\n getDomain(providerDomainId: string): Promise<StandardEmailDomain | null>;\n /** Start the provider's (asynchronous) verification. */\n verifyDomain(providerDomainId: string): Promise<void>;\n deleteDomain(providerDomainId: string): Promise<void>;\n}\n\n/**\n * What an EMAIL_INBOUND provider implements. Built by the provider module's adapter factory with the\n * credential the engine resolved, exactly as a billing adapter is — the module never reads a secret\n * itself.\n */\nexport interface StandardInboundEmail_Interface {\n /** Map the verified notification body onto the standard notification. Pure; refuses an unknown shape by throwing. */\n parseNotification(body: unknown): StandardInboundEmail_Notification;\n /** Fetch the whole message the notification announced. */\n fetchMessage(providerMessageId: string): Promise<StandardInboundEmail_Message>;\n /** Fetch one attachment's bytes, by the `ref` the message listed. */\n openAttachment(ref: string): Promise<StandardInboundEmail_OpenedAttachment>;\n /** Fetch the original message bytes, by the message's `rawRef`. */\n openRaw(rawRef: string): Promise<StandardInboundEmail_OpenedRaw>;\n}\n\n// ===============================================================\n// What a provider module DECLARES (pure functions; the engine owns the transport)\n// ===============================================================\n\n/**\n * One request a provider module asks the engine to make on its behalf.\n *\n * `path` is appended to the contract's `baseUrl`. A provider that serves bytes from ANOTHER host (a\n * signed download URL) returns `url` instead, and the engine admits it only against the hosts the\n * contract declares — a provider-supplied URL is never fetched merely because a provider named it.\n */\nexport type InboundEmailProviderRequest =\n | { readonly path: string; readonly method?: EmailProviderHttpMethod; readonly jsonBody?: unknown; readonly headers?: Readonly<Record<string, string>> }\n | { readonly url: string; readonly headers?: Readonly<Record<string, string>> };\n\n/**\n * The methods a provider's `path` request may use. A `url` request (a signed download link) is always a GET.\n * Absent means GET.\n */\nexport enum EmailProviderHttpMethod {\n GET = \"GET\",\n POST = \"POST\",\n PATCH = \"PATCH\",\n DELETE = \"DELETE\",\n}\n\n/** A provider's HTTP answer, as the engine hands it to the provider's parser. */\nexport interface InboundEmailProviderResponseInput {\n readonly status: number;\n /** The JSON body, or `undefined` when the answer was not JSON. */\n readonly body: unknown;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.external-connectors-models.schemas.d.ts","sourceRoot":"","sources":["
|
|
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;AAIxB,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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