@wildo-ai/external-connectors-models 1.1.10 → 1.1.12
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/companion-exports.js.map +1 -1
- package/dist/esm/core/commons.external-connectors-models.schemas.d.ts +140 -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 +203 -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.js.map +1 -1
- package/dist/esm/core/security.external-connectors-models.schemas.d.ts +4 -2
- package/dist/esm/core/security.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/core/security.external-connectors-models.schemas.js +10 -4
- package/dist/esm/core/security.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/index.d.ts +8 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.d.ts +9 -42
- 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 +31 -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 +64 -3
- package/dist/esm/protocols/billing.standard-interface.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/billing.standard-interface.schemas.js +23 -2
- package/dist/esm/protocols/billing.standard-interface.schemas.js.map +1 -1
- package/dist/esm/protocols/content-safety.external-connectors-models.schemas.d.ts +150 -0
- package/dist/esm/protocols/content-safety.external-connectors-models.schemas.d.ts.map +1 -0
- package/dist/esm/protocols/content-safety.external-connectors-models.schemas.js +182 -0
- package/dist/esm/protocols/content-safety.external-connectors-models.schemas.js.map +1 -0
- package/dist/esm/protocols/document-extraction.external-connectors-models.schemas.d.ts +41 -9
- 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 +40 -14
- package/dist/esm/protocols/document-extraction.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/electronic-signature.external-connectors-models.schemas.d.ts +157 -0
- package/dist/esm/protocols/electronic-signature.external-connectors-models.schemas.d.ts.map +1 -0
- package/dist/esm/protocols/electronic-signature.external-connectors-models.schemas.js +134 -0
- package/dist/esm/protocols/electronic-signature.external-connectors-models.schemas.js.map +1 -0
- package/dist/esm/protocols/email-inbound.standard-interface.schemas.d.ts +85 -0
- package/dist/esm/protocols/email-inbound.standard-interface.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/email-inbound.standard-interface.schemas.js +46 -2
- package/dist/esm/protocols/email-inbound.standard-interface.schemas.js.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 +4 -0
- package/dist/esm/protocols/email.standard-interface.schemas.js.map +1 -1
- package/dist/esm/protocols/embeddings.external-connectors-models.schemas.d.ts +86 -10
- package/dist/esm/protocols/embeddings.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/embeddings.external-connectors-models.schemas.js +146 -7
- package/dist/esm/protocols/embeddings.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/file-storage.standard-interface.d.ts +14 -1
- package/dist/esm/protocols/file-storage.standard-interface.d.ts.map +1 -1
- package/dist/esm/protocols/file-storage.standard-interface.js +6 -0
- package/dist/esm/protocols/file-storage.standard-interface.js.map +1 -1
- package/dist/esm/protocols/frontend.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/graphql-operations.external-connectors-models.schemas.d.ts +254 -0
- package/dist/esm/protocols/graphql-operations.external-connectors-models.schemas.d.ts.map +1 -0
- package/dist/esm/protocols/graphql-operations.external-connectors-models.schemas.js +480 -0
- package/dist/esm/protocols/graphql-operations.external-connectors-models.schemas.js.map +1 -0
- package/dist/esm/protocols/hooks-capability.external-connectors-models.schemas.d.ts +7 -2
- 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 +482 -7
- package/dist/esm/protocols/hooks.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/hooks.external-connectors-models.schemas.js +348 -0
- package/dist/esm/protocols/hooks.external-connectors-models.schemas.js.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 +165 -8
- package/dist/esm/protocols/llm.external-connectors-models.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/llm.external-connectors-models.schemas.js +243 -20
- package/dist/esm/protocols/llm.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/oauth2-provider-assurance.definitions.js.map +1 -1
- package/dist/esm/protocols/oauth2-provider-assurance.schemas.js.map +1 -1
- package/dist/esm/protocols/oauth2.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/provider-configuration-authoring.external-connectors-models.schemas.d.ts +52 -0
- package/dist/esm/protocols/provider-configuration-authoring.external-connectors-models.schemas.d.ts.map +1 -0
- package/dist/esm/protocols/provider-configuration-authoring.external-connectors-models.schemas.js +132 -0
- package/dist/esm/protocols/provider-configuration-authoring.external-connectors-models.schemas.js.map +1 -0
- package/dist/esm/protocols/provider-connection-parameters.external-connectors-models.d.ts +111 -0
- package/dist/esm/protocols/provider-connection-parameters.external-connectors-models.d.ts.map +1 -0
- package/dist/esm/protocols/provider-connection-parameters.external-connectors-models.js +203 -0
- package/dist/esm/protocols/provider-connection-parameters.external-connectors-models.js.map +1 -0
- package/dist/esm/protocols/provider-oauth2-token-endpoint-hosts.external-connectors-models.d.ts +6 -0
- package/dist/esm/protocols/provider-oauth2-token-endpoint-hosts.external-connectors-models.d.ts.map +1 -1
- package/dist/esm/protocols/provider-oauth2-token-endpoint-hosts.external-connectors-models.js +13 -7
- package/dist/esm/protocols/provider-oauth2-token-endpoint-hosts.external-connectors-models.js.map +1 -1
- package/dist/esm/protocols/provider-vendor-registration.external-connectors-models.d.ts +50 -0
- package/dist/esm/protocols/provider-vendor-registration.external-connectors-models.d.ts.map +1 -0
- package/dist/esm/protocols/provider-vendor-registration.external-connectors-models.js +30 -0
- package/dist/esm/protocols/provider-vendor-registration.external-connectors-models.js.map +1 -0
- package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.d.ts +1165 -11
- 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 +1217 -9
- package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/service-account-token.external-connectors-models.schemas.d.ts +73 -0
- package/dist/esm/protocols/service-account-token.external-connectors-models.schemas.d.ts.map +1 -0
- package/dist/esm/protocols/service-account-token.external-connectors-models.schemas.js +82 -0
- package/dist/esm/protocols/service-account-token.external-connectors-models.schemas.js.map +1 -0
- package/dist/esm/protocols/sms.external-connectors-models.schemas.js.map +1 -1
- package/dist/esm/protocols/sms.standard-interface.schemas.d.ts +79 -1
- package/dist/esm/protocols/sms.standard-interface.schemas.d.ts.map +1 -1
- package/dist/esm/protocols/sms.standard-interface.schemas.js +93 -0
- package/dist/esm/protocols/sms.standard-interface.schemas.js.map +1 -1
- package/dist/esm/protocols/subject-erasure-effect.standard-interface.d.ts +133 -0
- package/dist/esm/protocols/subject-erasure-effect.standard-interface.d.ts.map +1 -0
- package/dist/esm/protocols/subject-erasure-effect.standard-interface.js +61 -0
- package/dist/esm/protocols/subject-erasure-effect.standard-interface.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/dist/esm/.native.tsbuildinfo +0 -1
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//===============================================================
|
|
3
|
+
// Electronic Signature Provider (#2293)
|
|
4
|
+
// --------
|
|
5
|
+
// A deliverable sent to a trust-service vendor so the people who must sign it apply their own electronic signature
|
|
6
|
+
// (level 2 of epic #2916). The vendor renders the signing page, authenticates each signer and returns the signed
|
|
7
|
+
// document; the engine never trusts the vendor's word that it is signed (it validates the document at receipt).
|
|
8
|
+
//
|
|
9
|
+
// ## Why the exchange is a sequence of steps
|
|
10
|
+
//
|
|
11
|
+
// Vendors do not agree on how many calls a request takes. DocuSign creates an envelope, its documents and its recipients
|
|
12
|
+
// in one call; Yousign and IgniSign create the request, upload each document, add each signer and then activate (or
|
|
13
|
+
// publish) it, each a call of its own. So creation is a CONVERSATION the provider drives with pure functions: the
|
|
14
|
+
// engine asks for the first request, sends it, hands the answer back with whatever the provider chose to carry, and
|
|
15
|
+
// repeats until the provider answers SENT or REFUSED. The provider never touches the network, a key or a clock.
|
|
16
|
+
//
|
|
17
|
+
// spec-cite: N/A — the step counts above are a paraphrase of each vendor's public API reference (DocuSign eSignature
|
|
18
|
+
// REST `Envelopes:create`; Yousign API v3 "create a signature request, add documents and signers, activate"; IgniSign v4
|
|
19
|
+
// init, documents, signers, publish), cited for the shape the exchange must admit, not quoted.
|
|
20
|
+
//
|
|
21
|
+
// ## What a provider is given
|
|
22
|
+
//
|
|
23
|
+
// The document's bytes and name, its SHA-256, the required level, and per signer the opaque reference the engine keys
|
|
24
|
+
// them by, their name and their contact: what a vendor needs to send the invitation and nothing about the tenant, the
|
|
25
|
+
// record or the approval. Contact data comes from the operator's database; that is a stated residual of the epic.
|
|
26
|
+
//===============================================================
|
|
27
|
+
/**
|
|
28
|
+
* The level of electronic signature a deliverable requires, and a provider declares it can apply.
|
|
29
|
+
*
|
|
30
|
+
* eIDAS Art. 3(10) and Art. 26: an advanced signature is uniquely linked to and capable of identifying the signatory,
|
|
31
|
+
* created with data under their sole control, and linked to the signed data so that any later change is detectable.
|
|
32
|
+
* Qualified signatures (Art. 3(12)) are deliberately not a member (Paul, 2026-10-19).
|
|
33
|
+
*
|
|
34
|
+
* spec-cite: Regulation (EU) No 910/2014, Art. 3(10), 3(11), 3(12) and Art. 26 — the definitions of simple, advanced
|
|
35
|
+
* and qualified electronic signatures; paraphrased, not quoted.
|
|
36
|
+
*
|
|
37
|
+
* Import path: `@wildo-ai/external-connectors-models`.
|
|
38
|
+
*/
|
|
39
|
+
export var ElectronicSignature_Level;
|
|
40
|
+
(function (ElectronicSignature_Level) {
|
|
41
|
+
/** A simple electronic signature: data the signatory attaches to sign (Art. 3(10)). Any vendor applies it. */
|
|
42
|
+
ElectronicSignature_Level["SIMPLE"] = "simple";
|
|
43
|
+
/** An advanced electronic signature (Art. 26), applied by a trust-service vendor. */
|
|
44
|
+
ElectronicSignature_Level["ADVANCED"] = "advanced";
|
|
45
|
+
})(ElectronicSignature_Level || (ElectronicSignature_Level = {}));
|
|
46
|
+
/** The levels from weakest to strongest: the one order {@link electronicSignatureLevelSatisfies} compares on. */
|
|
47
|
+
const ELECTRONIC_SIGNATURE_LEVEL_ORDER = [ElectronicSignature_Level.SIMPLE, ElectronicSignature_Level.ADVANCED];
|
|
48
|
+
/**
|
|
49
|
+
* Whether a signature at `achieved` meets a requirement of `required`. An advanced signature is also a simple one, so it
|
|
50
|
+
* meets a SIMPLE requirement; a simple one never meets an ADVANCED requirement.
|
|
51
|
+
*
|
|
52
|
+
* Import path: `@wildo-ai/external-connectors-models`.
|
|
53
|
+
*/
|
|
54
|
+
export function electronicSignatureLevelSatisfies(achieved, required) {
|
|
55
|
+
return ELECTRONIC_SIGNATURE_LEVEL_ORDER.indexOf(achieved) >= ELECTRONIC_SIGNATURE_LEVEL_ORDER.indexOf(required);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Whether a provider's contract reaches the vendor's PRODUCTION environment or one of its test environments. Evidence
|
|
59
|
+
* signed in a test environment is refused in production (its chain does not reach the production anchors), and a
|
|
60
|
+
* contract declaring a test environment is refused at startup in a production runtime.
|
|
61
|
+
*
|
|
62
|
+
* Import path: `@wildo-ai/external-connectors-models`.
|
|
63
|
+
*/
|
|
64
|
+
export var ElectronicSignature_VendorEnvironment;
|
|
65
|
+
(function (ElectronicSignature_VendorEnvironment) {
|
|
66
|
+
ElectronicSignature_VendorEnvironment["PRODUCTION"] = "production";
|
|
67
|
+
ElectronicSignature_VendorEnvironment["NON_PRODUCTION"] = "non_production";
|
|
68
|
+
})(ElectronicSignature_VendorEnvironment || (ElectronicSignature_VendorEnvironment = {}));
|
|
69
|
+
/**
|
|
70
|
+
* The electronic-signature operation vocabulary — disjoint from every other protocol's operation keys.
|
|
71
|
+
*
|
|
72
|
+
* Import path: `@wildo-ai/external-connectors-models`.
|
|
73
|
+
*/
|
|
74
|
+
export var ElectronicSignatureProvider_OperationKey;
|
|
75
|
+
(function (ElectronicSignatureProvider_OperationKey) {
|
|
76
|
+
/** Create a request at the vendor: the document, its signers, the level. */
|
|
77
|
+
ElectronicSignatureProvider_OperationKey["SEND_REQUEST"] = "electronicSignature.sendRequest";
|
|
78
|
+
/** Re-read a request's status at the vendor. */
|
|
79
|
+
ElectronicSignatureProvider_OperationKey["READ_REQUEST"] = "electronicSignature.readRequest";
|
|
80
|
+
/** Download the signed document of a request the vendor reports complete. */
|
|
81
|
+
ElectronicSignatureProvider_OperationKey["DOWNLOAD_SIGNED_DOCUMENT"] = "electronicSignature.downloadSignedDocument";
|
|
82
|
+
/** Cancel an open request at the vendor, and (where the provider deletes on removal) delete it there. */
|
|
83
|
+
ElectronicSignatureProvider_OperationKey["CANCEL_REQUEST"] = "electronicSignature.cancelRequest";
|
|
84
|
+
})(ElectronicSignatureProvider_OperationKey || (ElectronicSignatureProvider_OperationKey = {}));
|
|
85
|
+
/**
|
|
86
|
+
* Where the vendor says a request stands, read from its own API. A CLAIM of the vendor's: the engine moves its own record
|
|
87
|
+
* on it (declined, expired, cancelled, partially signed) but never to SIGNED, which needs the validated document.
|
|
88
|
+
*
|
|
89
|
+
* Import path: `@wildo-ai/external-connectors-models`.
|
|
90
|
+
*/
|
|
91
|
+
export var ElectronicSignature_VendorRequestStatus;
|
|
92
|
+
(function (ElectronicSignature_VendorRequestStatus) {
|
|
93
|
+
/** Created and waiting for its signers; nobody has signed. */
|
|
94
|
+
ElectronicSignature_VendorRequestStatus["PENDING"] = "pending";
|
|
95
|
+
/** Some signers signed, others have not yet. */
|
|
96
|
+
ElectronicSignature_VendorRequestStatus["PARTIALLY_SIGNED"] = "partially_signed";
|
|
97
|
+
/** Every signer signed; the signed document can be downloaded. */
|
|
98
|
+
ElectronicSignature_VendorRequestStatus["COMPLETED"] = "completed";
|
|
99
|
+
/** A signer refused. */
|
|
100
|
+
ElectronicSignature_VendorRequestStatus["DECLINED"] = "declined";
|
|
101
|
+
/** The vendor's deadline passed. */
|
|
102
|
+
ElectronicSignature_VendorRequestStatus["EXPIRED"] = "expired";
|
|
103
|
+
/** Cancelled at the vendor. */
|
|
104
|
+
ElectronicSignature_VendorRequestStatus["CANCELLED"] = "cancelled";
|
|
105
|
+
})(ElectronicSignature_VendorRequestStatus || (ElectronicSignature_VendorRequestStatus = {}));
|
|
106
|
+
/** What a provider reads from the vendor's answer to a status re-read. */
|
|
107
|
+
export const ElectronicSignature_VendorRequestReadingSchema = z.object({
|
|
108
|
+
status: z.enum(ElectronicSignature_VendorRequestStatus),
|
|
109
|
+
/** The vendor's references of the signers the vendor reports as signed, when it says. */
|
|
110
|
+
signedVendorSignerReferences: z.array(z.string().min(1)).optional(),
|
|
111
|
+
});
|
|
112
|
+
/** What a provider reads from the vendor's answer to a cancellation. */
|
|
113
|
+
export var ElectronicSignature_CancellationOutcome;
|
|
114
|
+
(function (ElectronicSignature_CancellationOutcome) {
|
|
115
|
+
/** The request is cancelled at the vendor (now, or already). */
|
|
116
|
+
ElectronicSignature_CancellationOutcome["CANCELLED"] = "cancelled";
|
|
117
|
+
/** The vendor refuses: the request is already final there (signed, declined, expired). */
|
|
118
|
+
ElectronicSignature_CancellationOutcome["ALREADY_FINAL"] = "already_final";
|
|
119
|
+
/** The vendor could not be asked or did not answer usably. Try again. */
|
|
120
|
+
ElectronicSignature_CancellationOutcome["FAILED"] = "failed";
|
|
121
|
+
})(ElectronicSignature_CancellationOutcome || (ElectronicSignature_CancellationOutcome = {}));
|
|
122
|
+
/**
|
|
123
|
+
* The provider's limits the engine enforces on its side: how many steps a sending may take, and how large a document
|
|
124
|
+
* and a signed document may be. A provider declares its vendor's documented maxima.
|
|
125
|
+
*/
|
|
126
|
+
export const ElectronicSignature_LimitsSchema = z.object({
|
|
127
|
+
/** The most requests one sending makes (every step of the conversation counts). */
|
|
128
|
+
maxSendSteps: z.number().int().positive().max(64),
|
|
129
|
+
/** The largest document, in bytes, the vendor accepts. */
|
|
130
|
+
maxDocumentBytes: z.number().int().positive(),
|
|
131
|
+
/** The largest signed document, in bytes, the engine reads back. */
|
|
132
|
+
maxSignedDocumentBytes: z.number().int().positive(),
|
|
133
|
+
});
|
|
134
|
+
//# sourceMappingURL=electronic-signature.external-connectors-models.schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"electronic-signature.external-connectors-models.schemas.js","sourceRoot":"","sources":["../../../src/protocols/electronic-signature.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,iEAAiE;AACjE,wCAAwC;AACxC,WAAW;AACX,mHAAmH;AACnH,iHAAiH;AACjH,gHAAgH;AAChH,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,yHAAyH;AACzH,oH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IACrC,kEAAkE;IAClE,kEAAuB,CAAA;IACvB,wBAAwB;IACxB,gEAAqB,CAAA;IACrB,oCAAoC;IACpC,8DAAmB,CAAA;IACnB,+BAA+B;IAC/B,kEAAuB,CAAA;AACzB,CAAC,EAbW,uCAAuC,KAAvC,uCAAuC,QAalD;AAgED,0EAA0E;AAC1E,MAAM,CAAC,MAAM,8CAA8C,GAAG,CAAC,CAAC,MAAM,CAAC;IACrE,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,uCAAuC,CAAC;IACvD,yFAAyF;IACzF,4BAA4B,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CACpE,CAAC,CAAA;AAGF,wEAAwE;AACxE,MAAM,CAAN,IAAY,uCAOX;AAPD,WAAY,uCAAuC;IACjD,gEAAgE;IAChE,kEAAuB,CAAA;IACvB,0FAA0F;IAC1F,0EAA+B,CAAA;IAC/B,yEAAyE;IACzE,4DAAiB,CAAA;AACnB,CAAC,EAPW,uCAAuC,KAAvC,uCAAuC,QAOlD;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC;IACvD,mFAAmF;IACnF,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;IACjD,0DAA0D;IAC1D,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAC7C,oEAAoE;IACpE,sBAAsB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CACpD,CAAC,CAAA","sourcesContent":["import { z } from \"zod\"\nimport type { API_HttpMethod } from \"../core/commons.external-connectors-models.schemas\"\n\n//===============================================================\n// Electronic Signature Provider (#2293)\n// --------\n// A deliverable sent to a trust-service vendor so the people who must sign it apply their own electronic signature\n// (level 2 of epic #2916). The vendor renders the signing page, authenticates each signer and returns the signed\n// document; the engine never trusts the vendor's word that it is signed (it validates the document at receipt).\n//\n// ## Why the exchange is a sequence of steps\n//\n// Vendors do not agree on how many calls a request takes. DocuSign creates an envelope, its documents and its recipients\n// in one call; Yousign and IgniSign create the request, upload each document, add each signer and then activate (or\n// publish) it, each a call of its own. So creation is a CONVERSATION the provider drives with pure functions: the\n// engine asks for the first request, sends it, hands the answer back with whatever the provider chose to carry, and\n// repeats until the provider answers SENT or REFUSED. The provider never touches the network, a key or a clock.\n//\n// spec-cite: N/A — the step counts above are a paraphrase of each vendor's public API reference (DocuSign eSignature\n// REST `Envelopes:create`; Yousign API v3 \"create a signature request, add documents and signers, activate\"; IgniSign v4\n// init, documents, signers, publish), cited for the shape the exchange must admit, not quoted.\n//\n// ## What a provider is given\n//\n// The document's bytes and name, its SHA-256, the required level, and per signer the opaque reference the engine keys\n// them by, their name and their contact: what a vendor needs to send the invitation and nothing about the tenant, the\n// record or the approval. Contact data comes from the operator's database; that is a stated residual of the epic.\n//===============================================================\n\n/**\n * The level of electronic signature a deliverable requires, and a provider declares it can apply.\n *\n * eIDAS Art. 3(10) and Art. 26: an advanced signature is uniquely linked to and capable of identifying the signatory,\n * created with data under their sole control, and linked to the signed data so that any later change is detectable.\n * Qualified signatures (Art. 3(12)) are deliberately not a member (Paul, 2026-10-19).\n *\n * spec-cite: Regulation (EU) No 910/2014, Art. 3(10), 3(11), 3(12) and Art. 26 — the definitions of simple, advanced\n * and qualified electronic signatures; paraphrased, not quoted.\n *\n * Import path: `@wildo-ai/external-connectors-models`.\n */\nexport enum ElectronicSignature_Level {\n /** A simple electronic signature: data the signatory attaches to sign (Art. 3(10)). Any vendor applies it. */\n SIMPLE = \"simple\",\n /** An advanced electronic signature (Art. 26), applied by a trust-service vendor. */\n ADVANCED = \"advanced\",\n}\n\n/** The levels from weakest to strongest: the one order {@link electronicSignatureLevelSatisfies} compares on. */\nconst ELECTRONIC_SIGNATURE_LEVEL_ORDER: readonly ElectronicSignature_Level[] = [ElectronicSignature_Level.SIMPLE, ElectronicSignature_Level.ADVANCED]\n\n/**\n * Whether a signature at `achieved` meets a requirement of `required`. An advanced signature is also a simple one, so it\n * meets a SIMPLE requirement; a simple one never meets an ADVANCED requirement.\n *\n * Import path: `@wildo-ai/external-connectors-models`.\n */\nexport function electronicSignatureLevelSatisfies(achieved: ElectronicSignature_Level, required: ElectronicSignature_Level): boolean {\n return ELECTRONIC_SIGNATURE_LEVEL_ORDER.indexOf(achieved) >= ELECTRONIC_SIGNATURE_LEVEL_ORDER.indexOf(required)\n}\n\n/**\n * Whether a provider's contract reaches the vendor's PRODUCTION environment or one of its test environments. Evidence\n * signed in a test environment is refused in production (its chain does not reach the production anchors), and a\n * contract declaring a test environment is refused at startup in a production runtime.\n *\n * Import path: `@wildo-ai/external-connectors-models`.\n */\nexport enum ElectronicSignature_VendorEnvironment {\n PRODUCTION = \"production\",\n NON_PRODUCTION = \"non_production\",\n}\n\n/**\n * The electronic-signature operation vocabulary — disjoint from every other protocol's operation keys.\n *\n * Import path: `@wildo-ai/external-connectors-models`.\n */\nexport enum ElectronicSignatureProvider_OperationKey {\n /** Create a request at the vendor: the document, its signers, the level. */\n SEND_REQUEST = \"electronicSignature.sendRequest\",\n /** Re-read a request's status at the vendor. */\n READ_REQUEST = \"electronicSignature.readRequest\",\n /** Download the signed document of a request the vendor reports complete. */\n DOWNLOAD_SIGNED_DOCUMENT = \"electronicSignature.downloadSignedDocument\",\n /** Cancel an open request at the vendor, and (where the provider deletes on removal) delete it there. */\n CANCEL_REQUEST = \"electronicSignature.cancelRequest\",\n}\n\n/**\n * Where the vendor says a request stands, read from its own API. A CLAIM of the vendor's: the engine moves its own record\n * on it (declined, expired, cancelled, partially signed) but never to SIGNED, which needs the validated document.\n *\n * Import path: `@wildo-ai/external-connectors-models`.\n */\nexport enum ElectronicSignature_VendorRequestStatus {\n /** Created and waiting for its signers; nobody has signed. */\n PENDING = \"pending\",\n /** Some signers signed, others have not yet. */\n PARTIALLY_SIGNED = \"partially_signed\",\n /** Every signer signed; the signed document can be downloaded. */\n COMPLETED = \"completed\",\n /** A signer refused. */\n DECLINED = \"declined\",\n /** The vendor's deadline passed. */\n EXPIRED = \"expired\",\n /** Cancelled at the vendor. */\n CANCELLED = \"cancelled\",\n}\n\n/**\n * One HTTP request a provider function asks the engine to send. The engine owns the host (the contract's base URL, never\n * anything here), the API-key header, the timeout and the redirect refusal; `path` is appended to the base URL and must\n * start with `/` (an absolute URL is refused). `body` is already encoded; `transportHeaders` describe it (a\n * `content-type` at minimum when there is a body) and can never replace the engine's authentication header.\n */\nexport interface ElectronicSignature_ProviderRequest {\n readonly method: API_HttpMethod\n readonly path: string\n readonly body?: string | Uint8Array\n readonly transportHeaders?: Readonly<Record<string, string>>\n}\n\n/** A vendor answer as the engine hands it to a provider function: status, lower-cased headers, best-effort decoded body. */\nexport interface ElectronicSignature_ProviderResponse {\n readonly status: number\n readonly headers: Readonly<Record<string, string>>\n readonly body: unknown\n}\n\n/** One signer of a request, as a provider is given it. */\nexport interface ElectronicSignature_SignerInput {\n /** The engine's own opaque reference to this signer (its signer row). The provider maps it to the vendor's signer. */\n readonly signerRef: string\n /** The order in which the vendor asks the signers, from 0. Equal orders sign in parallel. */\n readonly signingOrder: number\n readonly firstName: string\n readonly lastName: string\n readonly email: string\n}\n\n/** What a provider is given to send a request. Nothing about the tenant, the record or the approval. */\nexport interface ElectronicSignature_SendInput {\n readonly document: Uint8Array\n readonly documentName: string\n readonly mimeType: string\n /** The SHA-256 of `document`, lower-case hex, as the file recorded it. */\n readonly contentSha256: string\n readonly level: ElectronicSignature_Level\n readonly signers: readonly ElectronicSignature_SignerInput[]\n}\n\n/**\n * What a provider answers at each step of sending: another request to make (with JSON-safe state it wants back), or\n * the end, SENT or REFUSED.\n */\nexport type ElectronicSignature_SendStep =\n | { readonly kind: \"request\"; readonly request: ElectronicSignature_ProviderRequest; readonly carry?: unknown }\n | {\n readonly kind: \"sent\"\n /** The vendor's references for the request: several when the vendor splits it per document. Never empty. */\n readonly vendorReferences: readonly string[]\n /** The vendor's reference to each signer, keyed by the engine's `signerRef`. */\n readonly vendorSignerReferences: Readonly<Record<string, string>>\n }\n | {\n readonly kind: \"refused\"\n readonly reason: string\n /** Whether asking again later could succeed (a vendor outage or throttle), as opposed to a refusal of the request. */\n readonly retryable: boolean\n }\n\n/** What a provider reads from the vendor's answer to a status re-read. */\nexport const ElectronicSignature_VendorRequestReadingSchema = z.object({\n status: z.enum(ElectronicSignature_VendorRequestStatus),\n /** The vendor's references of the signers the vendor reports as signed, when it says. */\n signedVendorSignerReferences: z.array(z.string().min(1)).optional(),\n})\nexport type ElectronicSignature_VendorRequestReading = z.infer<typeof ElectronicSignature_VendorRequestReadingSchema>\n\n/** What a provider reads from the vendor's answer to a cancellation. */\nexport enum ElectronicSignature_CancellationOutcome {\n /** The request is cancelled at the vendor (now, or already). */\n CANCELLED = \"cancelled\",\n /** The vendor refuses: the request is already final there (signed, declined, expired). */\n ALREADY_FINAL = \"already_final\",\n /** The vendor could not be asked or did not answer usably. Try again. */\n FAILED = \"failed\",\n}\n\n/**\n * The provider's limits the engine enforces on its side: how many steps a sending may take, and how large a document\n * and a signed document may be. A provider declares its vendor's documented maxima.\n */\nexport const ElectronicSignature_LimitsSchema = z.object({\n /** The most requests one sending makes (every step of the conversation counts). */\n maxSendSteps: z.number().int().positive().max(64),\n /** The largest document, in bytes, the vendor accepts. */\n maxDocumentBytes: z.number().int().positive(),\n /** The largest signed document, in bytes, the engine reads back. */\n maxSignedDocumentBytes: z.number().int().positive(),\n})\nexport type ElectronicSignature_Limits = z.infer<typeof ElectronicSignature_LimitsSchema>\n"]}
|
|
@@ -64,6 +64,7 @@ export type StandardInboundEmail_Attachment = z.infer<typeof StandardInboundEmai
|
|
|
64
64
|
export declare const StandardInboundEmail_NotificationSchema: z.ZodObject<{
|
|
65
65
|
providerMessageId: z.ZodString;
|
|
66
66
|
receivedFor: z.ZodArray<z.ZodString>;
|
|
67
|
+
namedAddresses: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
67
68
|
receivedAt: z.ZodCoercedDate<unknown>;
|
|
68
69
|
}, z.core.$strip>;
|
|
69
70
|
export type StandardInboundEmail_Notification = z.infer<typeof StandardInboundEmail_NotificationSchema>;
|
|
@@ -118,6 +119,77 @@ export declare const StandardInboundEmail_MessageSchema: z.ZodObject<{
|
|
|
118
119
|
rawRef: z.ZodOptional<z.ZodString>;
|
|
119
120
|
}, z.core.$strip>;
|
|
120
121
|
export type StandardInboundEmail_Message = z.infer<typeof StandardInboundEmail_MessageSchema>;
|
|
122
|
+
/**
|
|
123
|
+
* How a receiving provider hands the engine a message (#3395). A closed vocabulary because the engine's whole path
|
|
124
|
+
* from the webhook to the stored message depends on it.
|
|
125
|
+
*/
|
|
126
|
+
export declare enum InboundEmailMessageDelivery {
|
|
127
|
+
/**
|
|
128
|
+
* The webhook NOTIFIES: a small signed notification names the message, and the engine fetches the message, its
|
|
129
|
+
* attachments and its original bytes through the provider's API (Resend). The default.
|
|
130
|
+
*/
|
|
131
|
+
FETCHED = "fetched",
|
|
132
|
+
/**
|
|
133
|
+
* The webhook IS the message: the whole message, attachments included as base64, arrives in the request body, and
|
|
134
|
+
* nothing is fetched (Postmark; Mailgun's routes post the message too). The engine reads the bytes out of the body
|
|
135
|
+
* it verified and stores them through the same path a fetched message's bytes take.
|
|
136
|
+
*/
|
|
137
|
+
PUSHED = "pushed"
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* A pushed message as a provider module maps it (#3395): the standard message, and the bytes its attachments and its
|
|
141
|
+
* original copy arrived with. The engine re-validates it, refuses an attachment whose content is absent or not
|
|
142
|
+
* base64, and refuses a `rawRef` with no raw content (or raw content with no `rawRef`).
|
|
143
|
+
*/
|
|
144
|
+
export declare const StandardInboundEmail_PushedMessageSchema: z.ZodObject<{
|
|
145
|
+
message: z.ZodObject<{
|
|
146
|
+
providerMessageId: z.ZodString;
|
|
147
|
+
messageId: z.ZodOptional<z.ZodString>;
|
|
148
|
+
inReplyTo: z.ZodOptional<z.ZodString>;
|
|
149
|
+
references: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
150
|
+
from: z.ZodObject<{
|
|
151
|
+
address: z.ZodString;
|
|
152
|
+
name: z.ZodOptional<z.ZodString>;
|
|
153
|
+
}, z.core.$strip>;
|
|
154
|
+
to: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
155
|
+
address: z.ZodString;
|
|
156
|
+
name: z.ZodOptional<z.ZodString>;
|
|
157
|
+
}, z.core.$strip>>>;
|
|
158
|
+
cc: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
159
|
+
address: z.ZodString;
|
|
160
|
+
name: z.ZodOptional<z.ZodString>;
|
|
161
|
+
}, z.core.$strip>>>;
|
|
162
|
+
replyTo: z.ZodOptional<z.ZodObject<{
|
|
163
|
+
address: z.ZodString;
|
|
164
|
+
name: z.ZodOptional<z.ZodString>;
|
|
165
|
+
}, z.core.$strip>>;
|
|
166
|
+
receivedFor: z.ZodArray<z.ZodString>;
|
|
167
|
+
subject: z.ZodDefault<z.ZodString>;
|
|
168
|
+
textBody: z.ZodOptional<z.ZodString>;
|
|
169
|
+
htmlBody: z.ZodOptional<z.ZodString>;
|
|
170
|
+
headers: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
171
|
+
authentication: z.ZodObject<{
|
|
172
|
+
spf: z.ZodEnum<typeof EmailAuthenticationVerdict>;
|
|
173
|
+
dkim: z.ZodEnum<typeof EmailAuthenticationVerdict>;
|
|
174
|
+
dmarc: z.ZodEnum<typeof EmailAuthenticationVerdict>;
|
|
175
|
+
dmarcAligned: z.ZodBoolean;
|
|
176
|
+
}, z.core.$strip>;
|
|
177
|
+
attachments: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
178
|
+
ref: z.ZodString;
|
|
179
|
+
filename: z.ZodString;
|
|
180
|
+
contentType: z.ZodString;
|
|
181
|
+
sizeBytes: z.ZodNumber;
|
|
182
|
+
contentId: z.ZodOptional<z.ZodString>;
|
|
183
|
+
disposition: z.ZodOptional<z.ZodEnum<typeof EmailAttachmentDisposition>>;
|
|
184
|
+
}, z.core.$strip>>>;
|
|
185
|
+
sizeBytes: z.ZodOptional<z.ZodNumber>;
|
|
186
|
+
receivedAt: z.ZodCoercedDate<unknown>;
|
|
187
|
+
rawRef: z.ZodOptional<z.ZodString>;
|
|
188
|
+
}, z.core.$strip>;
|
|
189
|
+
attachmentContents: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
190
|
+
raw: z.ZodOptional<z.ZodString>;
|
|
191
|
+
}, z.core.$strip>;
|
|
192
|
+
export type StandardInboundEmail_PushedMessage = z.infer<typeof StandardInboundEmail_PushedMessageSchema>;
|
|
121
193
|
/** The bytes of one attachment. */
|
|
122
194
|
export interface StandardInboundEmail_OpenedAttachment {
|
|
123
195
|
readonly bytes: Uint8Array;
|
|
@@ -204,8 +276,20 @@ export interface StandardInboundEmail_Interface {
|
|
|
204
276
|
export type InboundEmailProviderRequest = {
|
|
205
277
|
readonly path: string;
|
|
206
278
|
readonly method?: EmailProviderHttpMethod;
|
|
279
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
280
|
+
/** A JSON body (Resend). At most one of `jsonBody` and `multipartFormFields`. */
|
|
207
281
|
readonly jsonBody?: unknown;
|
|
282
|
+
readonly multipartFormFields?: never;
|
|
283
|
+
} | {
|
|
284
|
+
readonly path: string;
|
|
285
|
+
readonly method?: EmailProviderHttpMethod;
|
|
208
286
|
readonly headers?: Readonly<Record<string, string>>;
|
|
287
|
+
/**
|
|
288
|
+
* Text fields sent as a `multipart/form-data` body (#3395), for an API documented to take one (Mailgun's domains
|
|
289
|
+
* API). The engine encodes it and sets the content type with its boundary.
|
|
290
|
+
*/
|
|
291
|
+
readonly multipartFormFields: Readonly<Record<string, string>>;
|
|
292
|
+
readonly jsonBody?: never;
|
|
209
293
|
} | {
|
|
210
294
|
readonly url: string;
|
|
211
295
|
readonly headers?: Readonly<Record<string, string>>;
|
|
@@ -217,6 +301,7 @@ export type InboundEmailProviderRequest = {
|
|
|
217
301
|
export declare enum EmailProviderHttpMethod {
|
|
218
302
|
GET = "GET",
|
|
219
303
|
POST = "POST",
|
|
304
|
+
PUT = "PUT",
|
|
220
305
|
PATCH = "PATCH",
|
|
221
306
|
DELETE = "DELETE"
|
|
222
307
|
}
|
|
@@ -1 +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;
|
|
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;AAkBxB;;;;;;;;;;;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,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Q,CAAC,MAAM,CAAC,EAAE,uBAAuB,CAAC;IAC1C,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD,iFAAiF;IACjF,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,mBAAmB,CAAC,EAAE,KAAK,CAAC;CACtC,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,uBAAuB,CAAC;IAC1C,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC/D,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC;CAC3B,GACD;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CAAE,CAAC;AAElF;;;GAGG;AACH,oBAAY,uBAAuB;IACjC,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,KAAK,UAAU;IACf,MAAM,WAAW;CAClB;AAED,iFAAiF;AACjF,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { z_wireDate } from '@wildo-ai/zod-decorators';
|
|
2
3
|
// ===============================================================
|
|
3
4
|
// Standard Inbound Email Interface (#1630)
|
|
4
5
|
// --------
|
|
@@ -81,7 +82,15 @@ export const StandardInboundEmail_NotificationSchema = z.object({
|
|
|
81
82
|
providerMessageId: z.string().min(1),
|
|
82
83
|
/** The addresses the message was delivered FOR (the SMTP envelope recipients), which routing reads. */
|
|
83
84
|
receivedFor: z.array(z.string().min(1)).min(1),
|
|
84
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Every address the stored notification body names, sender first, then its recipients and copied (#1642). Read for one
|
|
87
|
+
* purpose only: the subject keys of the delivery that stores the body, so a person's erasure finds and deletes it, and
|
|
88
|
+
* their access export reads it. Never trusted for routing, identity or anything else. Absent when the provider module
|
|
89
|
+
* does not project it, and then the delivery is keyed by `receivedFor` alone.
|
|
90
|
+
*/
|
|
91
|
+
namedAddresses: z.array(z.string().min(1)).optional(),
|
|
92
|
+
// Framework-internal z_wireDate (#3480): a provider adapter parses the provider's own HTTP JSON with this contract directly (email-inbound-provider-adapter), outside every framework conversion.
|
|
93
|
+
receivedAt: z_wireDate(),
|
|
85
94
|
});
|
|
86
95
|
/**
|
|
87
96
|
* One received message, provider-neutral.
|
|
@@ -107,13 +116,47 @@ export const StandardInboundEmail_MessageSchema = z.object({
|
|
|
107
116
|
authentication: StandardInboundEmail_AuthenticationSchema,
|
|
108
117
|
attachments: z.array(StandardInboundEmail_AttachmentSchema).default([]),
|
|
109
118
|
sizeBytes: z.number().int().nonnegative().optional(),
|
|
110
|
-
receivedAt:
|
|
119
|
+
receivedAt: z_wireDate(),
|
|
111
120
|
/**
|
|
112
121
|
* Where the ORIGINAL message bytes are, when the provider keeps them (#1600). Opaque to the engine; handed
|
|
113
122
|
* to `openRaw`. Absent when the provider offers no raw copy — the engine then keeps no raw MIME.
|
|
114
123
|
*/
|
|
115
124
|
rawRef: z.string().min(1).optional(),
|
|
116
125
|
});
|
|
126
|
+
/**
|
|
127
|
+
* How a receiving provider hands the engine a message (#3395). A closed vocabulary because the engine's whole path
|
|
128
|
+
* from the webhook to the stored message depends on it.
|
|
129
|
+
*/
|
|
130
|
+
export var InboundEmailMessageDelivery;
|
|
131
|
+
(function (InboundEmailMessageDelivery) {
|
|
132
|
+
/**
|
|
133
|
+
* The webhook NOTIFIES: a small signed notification names the message, and the engine fetches the message, its
|
|
134
|
+
* attachments and its original bytes through the provider's API (Resend). The default.
|
|
135
|
+
*/
|
|
136
|
+
InboundEmailMessageDelivery["FETCHED"] = "fetched";
|
|
137
|
+
/**
|
|
138
|
+
* The webhook IS the message: the whole message, attachments included as base64, arrives in the request body, and
|
|
139
|
+
* nothing is fetched (Postmark; Mailgun's routes post the message too). The engine reads the bytes out of the body
|
|
140
|
+
* it verified and stores them through the same path a fetched message's bytes take.
|
|
141
|
+
*/
|
|
142
|
+
InboundEmailMessageDelivery["PUSHED"] = "pushed";
|
|
143
|
+
})(InboundEmailMessageDelivery || (InboundEmailMessageDelivery = {}));
|
|
144
|
+
/**
|
|
145
|
+
* A pushed message as a provider module maps it (#3395): the standard message, and the bytes its attachments and its
|
|
146
|
+
* original copy arrived with. The engine re-validates it, refuses an attachment whose content is absent or not
|
|
147
|
+
* base64, and refuses a `rawRef` with no raw content (or raw content with no `rawRef`).
|
|
148
|
+
*/
|
|
149
|
+
export const StandardInboundEmail_PushedMessageSchema = z.object({
|
|
150
|
+
message: StandardInboundEmail_MessageSchema,
|
|
151
|
+
/** Each attachment's content as the vendor posted it, base64, keyed by the attachment's `ref`. */
|
|
152
|
+
attachmentContents: z.record(z.string(), z.string()).default({}),
|
|
153
|
+
/**
|
|
154
|
+
* The original message as text, when the vendor includes it (Postmark's `RawEmail`, a server option), stored under
|
|
155
|
+
* the message's `rawRef`. A JSON string, so it is the vendor's text rendering of the MIME message, re-encoded as UTF-8:
|
|
156
|
+
* not necessarily byte-identical to what the sending server transmitted.
|
|
157
|
+
*/
|
|
158
|
+
raw: z.string().optional(),
|
|
159
|
+
});
|
|
117
160
|
// ===============================================================
|
|
118
161
|
// Receiving domains (#1600)
|
|
119
162
|
// ===============================================================
|
|
@@ -154,6 +197,7 @@ export var EmailProviderHttpMethod;
|
|
|
154
197
|
(function (EmailProviderHttpMethod) {
|
|
155
198
|
EmailProviderHttpMethod["GET"] = "GET";
|
|
156
199
|
EmailProviderHttpMethod["POST"] = "POST";
|
|
200
|
+
EmailProviderHttpMethod["PUT"] = "PUT";
|
|
157
201
|
EmailProviderHttpMethod["PATCH"] = "PATCH";
|
|
158
202
|
EmailProviderHttpMethod["DELETE"] = "DELETE";
|
|
159
203
|
})(EmailProviderHttpMethod || (EmailProviderHttpMethod = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email-inbound.standard-interface.schemas.js","sourceRoot":"","sources":["../../../../src/protocols/email-inbound.standard-interface.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,kEAAkE;AAClE,2CAA2C;AAC3C,WAAW;AACX,mGAAmG;AACnG,oGAAoG;AACpG,mGAAmG;AACnG,uBAAuB;AACvB,EAAE;AACF,+FAA+F;AAC/F,sGAAsG;AACtG,8FAA8F;AAC9F,qGAAqG;AACrG,gDAAgD;AAChD,kEAAkE;AAElE;;;;;;;;;;;GAWG;AACH,MAAM,CAAN,IAAY,0BASX;AATD,WAAY,0BAA0B;IACpC,2CAAa,CAAA;IACb,2CAAa,CAAA;IACb,mDAAqB,CAAA;IACrB,iDAAmB,CAAA;IACnB,2CAAa,CAAA;IACb,+CAAiB,CAAA;IACjB,qDAAuB,CAAA;IACvB,qDAAuB,CAAA;AACzB,CAAC,EATW,0BAA0B,KAA1B,0BAA0B,QASrC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,yCAAyC,GAAG,CAAC,CAAC,MAAM,CAAC;IAChE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC;IACvC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC;IACxC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC;IACzC,YAAY,E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,GAAG,CAAC,CAAC,CAAC;IACvB,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC;IACzC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;IACtB,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CAClE,CAAC,CAAC;AA+CH;;;GAGG;AACH,MAAM,CAAN,IAAY,uBAKX;AALD,WAAY,uBAAuB;IACjC,sCAAW,CAAA;IACX,wCAAa,CAAA;IACb,0CAAe,CAAA;IACf,4CAAiB,CAAA;AACnB,CAAC,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
|
+
{"version":3,"file":"email-inbound.standard-interface.schemas.js","sourceRoot":"","sources":["../../../src/protocols/email-inbound.standard-interface.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAA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M,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACnC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC;IACzC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;IACtB,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CAClE,CAAC,CAAC;AAiEH;;;GAGG;AACH,MAAM,CAAN,IAAY,uBAMX;AAND,WAAY,uBAAuB;IACjC,sCAAW,CAAA;IACX,wCAAa,CAAA;IACb,sCAAW,CAAA;IACX,0CAAe,CAAA;IACf,4CAAiB,CAAA;AACnB,CAAC,EANW,uBAAuB,KAAvB,uBAAuB,QAMlC","sourcesContent":["import { z } from \"zod\";\nimport { z_wireDate } from '@wildo-ai/zod-decorators';\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 /**\n * Every address the stored notification body names, sender first, then its recipients and copied (#1642). Read for one\n * purpose only: the subject keys of the delivery that stores the body, so a person's erasure finds and deletes it, and\n * their access export reads it. Never trusted for routing, identity or anything else. Absent when the provider module\n * does not project it, and then the delivery is keyed by `receivedFor` alone.\n */\n namedAddresses: z.array(z.string().min(1)).optional(),\n // Framework-internal z_wireDate (#3480): a provider adapter parses the provider's own HTTP JSON with this contract directly (email-inbound-provider-adapter), outside every framework conversion.\n receivedAt: z_wireDate(),\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_wireDate(),\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/**\n * How a receiving provider hands the engine a message (#3395). A closed vocabulary because the engine's whole path\n * from the webhook to the stored message depends on it.\n */\nexport enum InboundEmailMessageDelivery {\n /**\n * The webhook NOTIFIES: a small signed notification names the message, and the engine fetches the message, its\n * attachments and its original bytes through the provider's API (Resend). The default.\n */\n FETCHED = \"fetched\",\n /**\n * The webhook IS the message: the whole message, attachments included as base64, arrives in the request body, and\n * nothing is fetched (Postmark; Mailgun's routes post the message too). The engine reads the bytes out of the body\n * it verified and stores them through the same path a fetched message's bytes take.\n */\n PUSHED = \"pushed\",\n}\n\n/**\n * A pushed message as a provider module maps it (#3395): the standard message, and the bytes its attachments and its\n * original copy arrived with. The engine re-validates it, refuses an attachment whose content is absent or not\n * base64, and refuses a `rawRef` with no raw content (or raw content with no `rawRef`).\n */\nexport const StandardInboundEmail_PushedMessageSchema = z.object({\n message: StandardInboundEmail_MessageSchema,\n /** Each attachment's content as the vendor posted it, base64, keyed by the attachment's `ref`. */\n attachmentContents: z.record(z.string(), z.string()).default({}),\n /**\n * The original message as text, when the vendor includes it (Postmark's `RawEmail`, a server option), stored under\n * the message's `rawRef`. A JSON string, so it is the vendor's text rendering of the MIME message, re-encoded as UTF-8:\n * not necessarily byte-identical to what the sending server transmitted.\n */\n raw: z.string().optional(),\n});\n\nexport type StandardInboundEmail_PushedMessage = z.infer<typeof StandardInboundEmail_PushedMessageSchema>;\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 | {\n readonly path: string;\n readonly method?: EmailProviderHttpMethod;\n readonly headers?: Readonly<Record<string, string>>;\n /** A JSON body (Resend). At most one of `jsonBody` and `multipartFormFields`. */\n readonly jsonBody?: unknown;\n readonly multipartFormFields?: never;\n }\n | {\n readonly path: string;\n readonly method?: EmailProviderHttpMethod;\n readonly headers?: Readonly<Record<string, string>>;\n /**\n * Text fields sent as a `multipart/form-data` body (#3395), for an API documented to take one (Mailgun's domains\n * API). The engine encodes it and sets the content type with its boundary.\n */\n readonly multipartFormFields: Readonly<Record<string, string>>;\n readonly jsonBody?: never;\n }\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 PUT = \"PUT\",\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.js","sourceRoot":"","sources":["../../../../src/protocols/email.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,uCAAuC,EAA6C,MAAM,uDAAuD,CAAC;AAE3J,iEAAiE;AACjE,iBAAiB;AACjB,WAAW;AACX,qEAAqE;AACrE,wEAAwE;AACxE,sDAAsD;AACtD,EAAE;AACF,wBAAwB;AACxB,wEAAwE;AACxE,0EAA0E;AAC1E,gEAAgE;AAChE,0EAA0E;AAC1E,iEAAiE;AAEjE,kEAAkE;AAClE,uBAAuB;AACvB,kEAAkE;AAElE;;;GAGG;AACH,MAAM,CAAN,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IACjC,0DAA+B,CAAA;IAC/B,kDAAuB,CAAA;AACzB,CAAC,EAHW,uBAAuB,KAAvB,uBAAuB,QAGlC;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,4BAGX;AAHD,WAAY,4BAA4B;IACtC,qDAAqB,CAAA;IACrB,6CAAa,CAAA;AACf,CAAC,EAHW,4BAA4B,KAA5B,4BAA4B,QAGvC;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,2BAIX;AAJD,WAAY,2BAA2B;IACrC,4CAAa,CAAA;IACb,oDAAqB,CAAA;IACrB,0CAAW,CAAA;AACb,CAAC,EAJW,2BAA2B,KAA3B,2BAA2B,QAItC;AAED;;GAEG;AACH,MAAM,CA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D,aAAa;IACb,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC,QAAQ,EAAE;IAErD,SAAS;IACT,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAE3C,mCAAmC;IACnC,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACzC,gBAAgB,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CAC9C,CAAC,CAAC;AAGH,kEAAkE;AAClE,uBAAuB;AACvB,kEAAkE;AAElE,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC;IACvD,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,4BAA4B,CAAC;IAC/C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE;IAChB,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;IAE3B,sBAAsB;IACtB,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,QAAQ,EAAE;IACvD,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,EAAE,mBAAmB;IAC7C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAEhC,gBAAgB;IAChB,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CACrC,CAAC,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { \n ExternalProvider_ExchangeProtocol_Kind \n} from \"../core/commons.external-connectors-models.schemas\";\nimport { ExternalProvider_OperationContextSchema, ExternalProvider_OperationDefinition_Base } from \"../core/operations.external-connectors-models.schemas\";\n\n//===============================================================\n// Email Provider\n// --------\n// Integration with email service providers for sending transactional\n// and marketing emails. Supports both REST API and SMTP-based providers\n// with differentiated operations for each email type.\n//\n// CONFIGURATION LEVELS:\n// - Profile (Provider-level): Fixed by the provider, cannot be changed.\n// Examples: API endpoints, SMTP server addresses, capabilities, limits.\n// - Configuration (Consumer-level): User-configurable settings.\n// Examples: API keys, sender addresses, tracking preferences, webhooks.\n//===============================================================\n\n// ===============================================================\n// Email Provider Enums\n// ===============================================================\n\n/**\n * The type of email operation - transactional vs marketing have different\n * requirements, compliance rules, and often use separate sending domains/IPs.\n */\nexport enum EmailProvider_EmailType {\n TRANSACTIONAL = \"transactional\", // Password resets, receipts, notifications\n MARKETING = \"marketing\", // Newsletters, promotions, campaigns\n}\n\n/**\n * The delivery method used by the email provider.\n * REST API provides more features, SMTP is simpler but more limited.\n */\nexport enum EmailProvider_DeliveryMethod {\n REST_API = \"rest_api\",\n SMTP = \"smtp\",\n}\n\n/**\n * SMTP encryption/security modes.\n */\nexport enum EmailProvider_SMTP_Security {\n NONE = \"none\", // Plain text (port 25, not recommended)\n STARTTLS = \"starttls\", // Upgrade to TLS (port 587)\n TLS = \"tls\", // Implicit TLS/SSL (port 465)\n}\n\n/**\n * Email delivery status for tracking.\n */\nexport enum EmailProvider_DeliveryStatus {\n QUEUED = \"queued\",\n SENT = \"sent\",\n DELIVERED = \"delivered\",\n OPENED = \"opened\",\n CLICKED = \"clicked\",\n BOUNCED = \"bounced\",\n SOFT_BOUNCED = \"soft_bounced\",\n SPAM_COMPLAINT = \"spam_complaint\",\n UNSUBSCRIBED = \"unsubscribed\",\n DROPPED = \"dropped\",\n DEFERRED = \"deferred\",\n FAILED = \"failed\",\n}\n\n/**\n * Email bounce types.\n */\nexport enum EmailProvider_BounceType {\n HARD = \"hard\", // Permanent failure (address doesn't exist)\n SOFT = \"soft\", // Temporary failure (mailbox full, server down)\n TRANSIENT = \"transient\",\n}\n\n/**\n * Standard email provider operation keys.\n * Each provider implements a subset of these based on capabilities.\n */\nexport enum EmailProvider_OperationKey {\n // Core Transactional Operations\n SEND_EMAIL = \"email.send\",\n SEND_BATCH = \"email.sendBatch\",\n SEND_TEMPLATE = \"email.sendTemplate\",\n \n // Marketing/Campaign Operations\n SEND_CAMPAIGN = \"email.campaign.send\",\n CREATE_CAMPAIGN = \"email.campaign.create\",\n SCHEDULE_CAMPAIGN = \"email.campaign.schedule\",\n GET_CAMPAIGN = \"email.campaign.get\",\n \n // List Management (Marketing)\n LIST_CREATE = \"email.list.create\",\n LIST_ADD_CONTACT = \"email.list.addContact\",\n LIST_REMOVE_CONTACT = \"email.list.removeContact\",\n LIST_GET = \"email.list.get\",\n \n // Template Operations\n TEMPLATE_CREATE = \"email.template.create\",\n TEMPLATE_GET = \"email.template.get\",\n TEMPLATE_LIST = \"email.template.list\",\n TEMPLATE_DELETE = \"email.template.delete\",\n \n // Status & Analytics\n GET_MESSAGE_STATUS = \"email.message.getStatus\",\n GET_ANALYTICS = \"email.analytics.get\",\n \n // Suppression/Bounces\n GET_SUPPRESSIONS = \"email.suppressions.get\",\n ADD_SUPPRESSION = \"email.suppressions.add\",\n DELETE_SUPPRESSION = \"email.suppressions.delete\",\n \n // Domain Verification\n DOMAIN_VERIFY = \"email.domain.verify\",\n DOMAIN_GET_STATUS = \"email.domain.getStatus\",\n}\n\n/**\n * Email provider capabilities - what features the provider supports.\n * Used to determine which operations are available.\n */\nexport enum EmailProvider_Capability {\n // Delivery Methods\n SUPPORTS_REST_API = \"supports_rest_api\",\n SUPPORTS_SMTP = \"supports_smtp\",\n \n // Email Types\n SUPPORTS_TRANSACTIONAL = \"supports_transactional\",\n SUPPORTS_MARKETING = \"supports_marketing\",\n \n // Core Features\n SUPPORTS_TEMPLATES = \"supports_templates\",\n SUPPORTS_BATCH_SENDING = \"supports_batch_sending\",\n SUPPORTS_SCHEDULING = \"supports_scheduling\",\n SUPPORTS_ATTACHMENTS = \"supports_attachments\",\n SUPPORTS_INLINE_IMAGES = \"supports_inline_images\",\n \n // Tracking\n SUPPORTS_OPEN_TRACKING = \"supports_open_tracking\",\n SUPPORTS_CLICK_TRACKING = \"supports_click_tracking\",\n SUPPORTS_WEBHOOKS = \"supports_webhooks\",\n \n // Marketing Specific\n SUPPORTS_CAMPAIGNS = \"supports_campaigns\",\n SUPPORTS_LIST_MANAGEMENT = \"supports_list_management\",\n SUPPORTS_SEGMENTATION = \"supports_segmentation\",\n SUPPORTS_AB_TESTING = \"supports_ab_testing\",\n \n // Compliance & Deliverability\n SUPPORTS_SUPPRESSION_LISTS = \"supports_suppression_lists\",\n SUPPORTS_DEDICATED_IP = \"supports_dedicated_ip\",\n SUPPORTS_CUSTOM_DOMAIN = \"supports_custom_domain\",\n SUPPORTS_EMAIL_VALIDATION = \"supports_email_validation\",\n}\n\n// ===============================================================\n// SMTP Server Profile (Provider-level, fixed)\n// ===============================================================\n\nexport const EmailProvider_SMTP_ServerProfileSchema = z.object({\n host: z.string().min(1),\n port: z.number().int().min(1).max(65535),\n security: z.enum(EmailProvider_SMTP_Security),\n // Note: username/password are consumer-level (in Configuration)\n});\nexport type EmailProvider_SMTP_ServerProfile = z.infer<typeof EmailProvider_SMTP_ServerProfileSchema>;\n\n// ===============================================================\n// Email Address Schema\n// ===============================================================\n\nexport const EmailProvider_AddressSchema = z.object({\n email: z.email(),\n name: z.string().optional(),\n});\nexport type EmailProvider_Address = z.infer<typeof EmailProvider_AddressSchema>;\n\n// ===============================================================\n// Email Attachment Schema\n// ===============================================================\n\nexport const EmailProvider_AttachmentSchema = z.object({\n filename: z.string().min(1),\n content: z.string(), // Base64 encoded content\n contentType: z.string().optional(),\n contentId: z.string().optional(), // For inline images (cid:)\n});\nexport type EmailProvider_Attachment = z.infer<typeof EmailProvider_AttachmentSchema>;\n\n// ===============================================================\n// Send Email Input Schema\n// ===============================================================\n\nexport const EmailProvider_SendEmailInputSchema = z.object({\n // Recipients\n to: z.array(EmailProvider_AddressSchema).min(1),\n cc: z.array(EmailProvider_AddressSchema).optional(),\n bcc: z.array(EmailProvider_AddressSchema).optional(),\n \n // Sender (can override configuration default)\n from: EmailProvider_AddressSchema.optional(),\n replyTo: EmailProvider_AddressSchema.optional(),\n \n // Content\n subject: z.string().min(1),\n text: z.string().optional(),\n html: z.string().optional(),\n \n // Attachments\n attachments: z.array(EmailProvider_AttachmentSchema).optional(),\n \n // Headers\n headers: z.record(z.string(), z.string()).optional(),\n \n // Tags for categorization/analytics\n tags: z.array(z.string()).optional(),\n \n // Scheduling\n scheduledAt: z.iso.datetime().optional(),\n \n // Tracking overrides\n trackOpens: z.boolean().optional(),\n trackClicks: z.boolean().optional(),\n});\nexport type EmailProvider_SendEmailInput = z.infer<typeof EmailProvider_SendEmailInputSchema>;\n\n// ===============================================================\n// Send Email Output Schema\n// ===============================================================\n\nexport const EmailProvider_SendEmailOutputSchema = z.object({\n // Provider's message ID\n id: z.string(),\n \n // Status (if available immediately)\n status: z.enum(EmailProvider_DeliveryStatus).optional(),\n \n // Provider-specific data\n providerMessageId: z.string().optional(),\n});\nexport type EmailProvider_SendEmailOutput = z.infer<typeof EmailProvider_SendEmailOutputSchema>;\n\n// ===============================================================\n// Send Template Email Input Schema\n// ===============================================================\n\nexport const EmailProvider_SendTemplateInputSchema = z.object({\n // Recipients\n to: z.array(EmailProvider_AddressSchema).min(1),\n cc: z.array(EmailProvider_AddressSchema).optional(),\n bcc: z.array(EmailProvider_AddressSchema).optional(),\n \n // Sender\n from: EmailProvider_AddressSchema.optional(),\n replyTo: EmailProvider_AddressSchema.optional(),\n \n // Template\n templateId: z.string().min(1),\n templateAlias: z.string().optional(), // Some providers use alias instead of ID\n \n // Template variables\n variables: z.record(z.string(), z.unknown()).optional(),\n \n // Subject override (if template allows)\n subject: z.string().optional(),\n \n // Tags\n tags: z.array(z.string()).optional(),\n \n // Scheduling\n scheduledAt: z.iso.datetime().optional(),\n});\nexport type EmailProvider_SendTemplateInput = z.infer<typeof EmailProvider_SendTemplateInputSchema>;\n\n// ===============================================================\n// Batch Send Input Schema\n// ===============================================================\n\nconst emailProviderBatchItemSchema = z.object({\n to: EmailProvider_AddressSchema,\n variables: z.record(z.string(), z.unknown()).optional(),\n subject: z.string().optional(), // Override per recipient\n});\n\nexport const EmailProvider_SendBatchInputSchema = z.object({\n // Sender\n from: EmailProvider_AddressSchema.optional(),\n replyTo: EmailProvider_AddressSchema.optional(),\n \n // Content (direct or template)\n subject: z.string().optional(), // Default subject\n text: z.string().optional(),\n html: z.string().optional(),\n templateId: z.string().optional(),\n \n // Recipients with personalizations\n recipients: z.array(emailProviderBatchItemSchema).min(1),\n \n // Tags\n tags: z.array(z.string()).optional(),\n});\nexport type EmailProvider_SendBatchInput = z.infer<typeof EmailProvider_SendBatchInputSchema>;\n\n// ===============================================================\n// Batch Send Output Schema\n// ===============================================================\n\nexport const EmailProvider_SendBatchOutputSchema = z.object({\n // Summary\n totalRequested: z.number().int(),\n totalAccepted: z.number().int(),\n totalRejected: z.number().int(),\n \n // Results per recipient\n results: z.array(z.object({\n email: z.string(),\n id: z.string().optional(),\n status: z.enum([\"accepted\", \"rejected\"]),\n error: z.string().optional(),\n })),\n});\nexport type EmailProvider_SendBatchOutput = z.infer<typeof EmailProvider_SendBatchOutputSchema>;\n\n// ===============================================================\n// Campaign Input Schema (Marketing)\n// ===============================================================\n\nexport const EmailProvider_CreateCampaignInputSchema = z.object({\n // Campaign details\n name: z.string().min(1),\n subject: z.string().min(1),\n previewText: z.string().optional(),\n \n // Sender\n from: EmailProvider_AddressSchema,\n replyTo: EmailProvider_AddressSchema.optional(),\n \n // Content\n html: z.string().optional(),\n text: z.string().optional(),\n templateId: z.string().optional(),\n \n // Recipients\n listIds: z.array(z.string()).optional(),\n segmentIds: z.array(z.string()).optional(),\n \n // Scheduling\n scheduledAt: z.iso.datetime().optional(),\n \n // Tracking\n trackOpens: z.boolean().optional().default(true),\n trackClicks: z.boolean().optional().default(true),\n});\nexport type EmailProvider_CreateCampaignInput = z.infer<typeof EmailProvider_CreateCampaignInputSchema>;\n\n// ===============================================================\n// Campaign Output Schema\n// ===============================================================\n\nexport const EmailProvider_CampaignOutputSchema = z.object({\n id: z.string(),\n status: z.enum([\"draft\", \"scheduled\", \"sending\", \"sent\", \"cancelled\"]),\n scheduledAt: z.iso.datetime().optional(),\n sentAt: z.iso.datetime().optional(),\n});\nexport type EmailProvider_CampaignOutput = z.infer<typeof EmailProvider_CampaignOutputSchema>;\n\n// ===============================================================\n// Message Status Schema\n// ===============================================================\n\nexport const EmailProvider_MessageStatusSchema = z.object({\n id: z.string(),\n status: z.enum(EmailProvider_DeliveryStatus),\n to: z.email(),\n subject: z.string().optional(),\n sentAt: z.iso.datetime().optional(),\n deliveredAt: z.iso.datetime().optional(),\n openedAt: z.iso.datetime().optional(),\n clickedAt: z.iso.datetime().optional(),\n bouncedAt: z.iso.datetime().optional(),\n bounceType: z.enum(EmailProvider_BounceType).optional(),\n bounceReason: z.string().optional(),\n});\nexport type EmailProvider_MessageStatus = z.infer<typeof EmailProvider_MessageStatusSchema>;\n\n// ===============================================================\n// Email Operation Context (for tracking)\n// ===============================================================\n\nexport const EmailProvider_OperationContextSchema = ExternalProvider_OperationContextSchema.extend({\n // Message identification\n messageId: z.string().optional(),\n \n // Delivery info\n deliveryMethod: z.enum(EmailProvider_DeliveryMethod).optional(),\n deliveryStatus: z.enum(EmailProvider_DeliveryStatus).optional(),\n \n // Email type\n emailType: z.enum(EmailProvider_EmailType).optional(),\n \n // Counts\n recipientCount: z.number().int().optional(),\n \n // Rate limit headers from provider\n rateLimitRemaining: z.number().optional(),\n rateLimitResetAt: z.iso.datetime().optional(),\n});\nexport type EmailProvider_OperationContext = z.infer<typeof EmailProvider_OperationContextSchema>;\n\n// ===============================================================\n// Webhook Event Schema\n// ===============================================================\n\nexport const EmailProvider_WebhookEventSchema = z.object({\n eventType: z.enum(EmailProvider_DeliveryStatus),\n messageId: z.string(),\n email: z.email(),\n timestamp: z.iso.datetime(),\n \n // Event-specific data\n bounceType: z.enum(EmailProvider_BounceType).optional(),\n bounceReason: z.string().optional(),\n link: z.url().optional(), // For click events\n userAgent: z.string().optional(),\n \n // Original tags\n tags: z.array(z.string()).optional(),\n});\nexport type EmailProvider_WebhookEvent = z.infer<typeof EmailProvider_WebhookEventSchema>;\n\n// ===============================================================\n// Email Operation Definition\n// ===============================================================\n\nexport type EmailProvider_OperationDefinition = ExternalProvider_OperationDefinition_Base & {\n operationContextSchema: typeof EmailProvider_OperationContextSchema;\n \n // Which email types this operation supports\n supportedEmailTypes: EmailProvider_EmailType[];\n \n // Which delivery methods work for this operation\n supportedDeliveryMethods: EmailProvider_DeliveryMethod[];\n \n // Required capabilities\n requiredCapabilities?: EmailProvider_Capability[];\n};\n\n"]}
|
|
1
|
+
{"version":3,"file":"email.external-connectors-models.schemas.js","sourceRoot":"","sources":["../../../src/protocols/email.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,uCAAuC,EAA6C,MAAM,uDAAuD,CAAC;AAE3J,iEAAiE;AACjE,iBAAiB;AACjB,WAAW;AACX,qEAAqE;AACrE,wEAAwE;AACxE,sDAAsD;AACtD,EAAE;AACF,wBAAwB;AACxB,wEAAwE;AACxE,0EAA0E;AAC1E,gEAAgE;AAChE,0EAA0E;AAC1E,iEAAiE;AAEjE,kEAAkE;AAClE,uBAAuB;AACvB,kEAAkE;AAElE;;;GAGG;AACH,MAAM,CAAN,IAAY,uBAGX;AAHD,WAAY,uBAAuB;IACjC,0DAA+B,CAAA;IAC/B,kDAAuB,CAAA;AACzB,CAAC,EAHW,uBAAuB,KAAvB,uBAAuB,QAGlC;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,4BAGX;AAHD,WAAY,4BAA4B;IACtC,qDAAqB,CAAA;IACrB,6CAAa,CAAA;AACf,CAAC,EAHW,4BAA4B,KAA5B,4BAA4B,QAGvC;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,2BAIX;AAJD,WA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";\nimport { \n ExternalProvider_ExchangeProtocol_Kind \n} from \"../core/commons.external-connectors-models.schemas\";\nimport { ExternalProvider_OperationContextSchema, ExternalProvider_OperationDefinition_Base } from \"../core/operations.external-connectors-models.schemas\";\n\n//===============================================================\n// Email Provider\n// --------\n// Integration with email service providers for sending transactional\n// and marketing emails. Supports both REST API and SMTP-based providers\n// with differentiated operations for each email type.\n//\n// CONFIGURATION LEVELS:\n// - Profile (Provider-level): Fixed by the provider, cannot be changed.\n// Examples: API endpoints, SMTP server addresses, capabilities, limits.\n// - Configuration (Consumer-level): User-configurable settings.\n// Examples: API keys, sender addresses, tracking preferences, webhooks.\n//===============================================================\n\n// ===============================================================\n// Email Provider Enums\n// ===============================================================\n\n/**\n * The type of email operation - transactional vs marketing have different\n * requirements, compliance rules, and often use separate sending domains/IPs.\n */\nexport enum EmailProvider_EmailType {\n TRANSACTIONAL = \"transactional\", // Password resets, receipts, notifications\n MARKETING = \"marketing\", // Newsletters, promotions, campaigns\n}\n\n/**\n * The delivery method used by the email provider.\n * REST API provides more features, SMTP is simpler but more limited.\n */\nexport enum EmailProvider_DeliveryMethod {\n REST_API = \"rest_api\",\n SMTP = \"smtp\",\n}\n\n/**\n * SMTP encryption/security modes.\n */\nexport enum EmailProvider_SMTP_Security {\n NONE = \"none\", // Plain text (port 25, not recommended)\n STARTTLS = \"starttls\", // Upgrade to TLS (port 587)\n TLS = \"tls\", // Implicit TLS/SSL (port 465)\n}\n\n/**\n * Email delivery status for tracking.\n */\nexport enum EmailProvider_DeliveryStatus {\n QUEUED = \"queued\",\n SENT = \"sent\",\n DELIVERED = \"delivered\",\n OPENED = \"opened\",\n CLICKED = \"clicked\",\n BOUNCED = \"bounced\",\n SOFT_BOUNCED = \"soft_bounced\",\n SPAM_COMPLAINT = \"spam_complaint\",\n UNSUBSCRIBED = \"unsubscribed\",\n DROPPED = \"dropped\",\n DEFERRED = \"deferred\",\n FAILED = \"failed\",\n}\n\n/**\n * Email bounce types.\n */\nexport enum EmailProvider_BounceType {\n HARD = \"hard\", // Permanent failure (address doesn't exist)\n SOFT = \"soft\", // Temporary failure (mailbox full, server down)\n TRANSIENT = \"transient\",\n}\n\n/**\n * Standard email provider operation keys.\n * Each provider implements a subset of these based on capabilities.\n */\nexport enum EmailProvider_OperationKey {\n // Core Transactional Operations\n SEND_EMAIL = \"email.send\",\n SEND_BATCH = \"email.sendBatch\",\n SEND_TEMPLATE = \"email.sendTemplate\",\n \n // Marketing/Campaign Operations\n SEND_CAMPAIGN = \"email.campaign.send\",\n CREATE_CAMPAIGN = \"email.campaign.create\",\n SCHEDULE_CAMPAIGN = \"email.campaign.schedule\",\n GET_CAMPAIGN = \"email.campaign.get\",\n \n // List Management (Marketing)\n LIST_CREATE = \"email.list.create\",\n LIST_ADD_CONTACT = \"email.list.addContact\",\n LIST_REMOVE_CONTACT = \"email.list.removeContact\",\n LIST_GET = \"email.list.get\",\n \n // Template Operations\n TEMPLATE_CREATE = \"email.template.create\",\n TEMPLATE_GET = \"email.template.get\",\n TEMPLATE_LIST = \"email.template.list\",\n TEMPLATE_DELETE = \"email.template.delete\",\n \n // Status & Analytics\n GET_MESSAGE_STATUS = \"email.message.getStatus\",\n GET_ANALYTICS = \"email.analytics.get\",\n \n // Suppression/Bounces\n GET_SUPPRESSIONS = \"email.suppressions.get\",\n ADD_SUPPRESSION = \"email.suppressions.add\",\n DELETE_SUPPRESSION = \"email.suppressions.delete\",\n \n // Domain Verification\n DOMAIN_VERIFY = \"email.domain.verify\",\n DOMAIN_GET_STATUS = \"email.domain.getStatus\",\n}\n\n/**\n * Email provider capabilities - what features the provider supports.\n * Used to determine which operations are available.\n */\nexport enum EmailProvider_Capability {\n // Delivery Methods\n SUPPORTS_REST_API = \"supports_rest_api\",\n SUPPORTS_SMTP = \"supports_smtp\",\n \n // Email Types\n SUPPORTS_TRANSACTIONAL = \"supports_transactional\",\n SUPPORTS_MARKETING = \"supports_marketing\",\n \n // Core Features\n SUPPORTS_TEMPLATES = \"supports_templates\",\n SUPPORTS_BATCH_SENDING = \"supports_batch_sending\",\n SUPPORTS_SCHEDULING = \"supports_scheduling\",\n SUPPORTS_ATTACHMENTS = \"supports_attachments\",\n SUPPORTS_INLINE_IMAGES = \"supports_inline_images\",\n \n // Tracking\n SUPPORTS_OPEN_TRACKING = \"supports_open_tracking\",\n SUPPORTS_CLICK_TRACKING = \"supports_click_tracking\",\n SUPPORTS_WEBHOOKS = \"supports_webhooks\",\n \n // Marketing Specific\n SUPPORTS_CAMPAIGNS = \"supports_campaigns\",\n SUPPORTS_LIST_MANAGEMENT = \"supports_list_management\",\n SUPPORTS_SEGMENTATION = \"supports_segmentation\",\n SUPPORTS_AB_TESTING = \"supports_ab_testing\",\n \n // Compliance & Deliverability\n SUPPORTS_SUPPRESSION_LISTS = \"supports_suppression_lists\",\n SUPPORTS_DEDICATED_IP = \"supports_dedicated_ip\",\n SUPPORTS_CUSTOM_DOMAIN = \"supports_custom_domain\",\n SUPPORTS_EMAIL_VALIDATION = \"supports_email_validation\",\n}\n\n// ===============================================================\n// SMTP Server Profile (Provider-level, fixed)\n// ===============================================================\n\nexport const EmailProvider_SMTP_ServerProfileSchema = z.object({\n host: z.string().min(1),\n port: z.number().int().min(1).max(65535),\n security: z.enum(EmailProvider_SMTP_Security),\n // Note: username/password are consumer-level (in Configuration)\n});\nexport type EmailProvider_SMTP_ServerProfile = z.infer<typeof EmailProvider_SMTP_ServerProfileSchema>;\n\n// ===============================================================\n// Email Address Schema\n// ===============================================================\n\nexport const EmailProvider_AddressSchema = z.object({\n email: z.email(),\n name: z.string().optional(),\n});\nexport type EmailProvider_Address = z.infer<typeof EmailProvider_AddressSchema>;\n\n// ===============================================================\n// Email Attachment Schema\n// ===============================================================\n\nexport const EmailProvider_AttachmentSchema = z.object({\n filename: z.string().min(1),\n content: z.string(), // Base64 encoded content\n contentType: z.string().optional(),\n contentId: z.string().optional(), // For inline images (cid:)\n});\nexport type EmailProvider_Attachment = z.infer<typeof EmailProvider_AttachmentSchema>;\n\n// ===============================================================\n// Send Email Input Schema\n// ===============================================================\n\nexport const EmailProvider_SendEmailInputSchema = z.object({\n // Recipients\n to: z.array(EmailProvider_AddressSchema).min(1),\n cc: z.array(EmailProvider_AddressSchema).optional(),\n bcc: z.array(EmailProvider_AddressSchema).optional(),\n \n // Sender (can override configuration default)\n from: EmailProvider_AddressSchema.optional(),\n replyTo: EmailProvider_AddressSchema.optional(),\n \n // Content\n subject: z.string().min(1),\n text: z.string().optional(),\n html: z.string().optional(),\n \n // Attachments\n attachments: z.array(EmailProvider_AttachmentSchema).optional(),\n \n // Headers\n headers: z.record(z.string(), z.string()).optional(),\n \n // Tags for categorization/analytics\n tags: z.array(z.string()).optional(),\n \n // Scheduling\n scheduledAt: z.iso.datetime().optional(),\n \n // Tracking overrides\n trackOpens: z.boolean().optional(),\n trackClicks: z.boolean().optional(),\n});\nexport type EmailProvider_SendEmailInput = z.infer<typeof EmailProvider_SendEmailInputSchema>;\n\n// ===============================================================\n// Send Email Output Schema\n// ===============================================================\n\nexport const EmailProvider_SendEmailOutputSchema = z.object({\n // Provider's message ID\n id: z.string(),\n \n // Status (if available immediately)\n status: z.enum(EmailProvider_DeliveryStatus).optional(),\n \n // Provider-specific data\n providerMessageId: z.string().optional(),\n});\nexport type EmailProvider_SendEmailOutput = z.infer<typeof EmailProvider_SendEmailOutputSchema>;\n\n// ===============================================================\n// Send Template Email Input Schema\n// ===============================================================\n\nexport const EmailProvider_SendTemplateInputSchema = z.object({\n // Recipients\n to: z.array(EmailProvider_AddressSchema).min(1),\n cc: z.array(EmailProvider_AddressSchema).optional(),\n bcc: z.array(EmailProvider_AddressSchema).optional(),\n \n // Sender\n from: EmailProvider_AddressSchema.optional(),\n replyTo: EmailProvider_AddressSchema.optional(),\n \n // Template\n templateId: z.string().min(1),\n templateAlias: z.string().optional(), // Some providers use alias instead of ID\n \n // Template variables\n variables: z.record(z.string(), z.unknown()).optional(),\n \n // Subject override (if template allows)\n subject: z.string().optional(),\n \n // Tags\n tags: z.array(z.string()).optional(),\n \n // Scheduling\n scheduledAt: z.iso.datetime().optional(),\n});\nexport type EmailProvider_SendTemplateInput = z.infer<typeof EmailProvider_SendTemplateInputSchema>;\n\n// ===============================================================\n// Batch Send Input Schema\n// ===============================================================\n\nconst emailProviderBatchItemSchema = z.object({\n to: EmailProvider_AddressSchema,\n variables: z.record(z.string(), z.unknown()).optional(),\n subject: z.string().optional(), // Override per recipient\n});\n\nexport const EmailProvider_SendBatchInputSchema = z.object({\n // Sender\n from: EmailProvider_AddressSchema.optional(),\n replyTo: EmailProvider_AddressSchema.optional(),\n \n // Content (direct or template)\n subject: z.string().optional(), // Default subject\n text: z.string().optional(),\n html: z.string().optional(),\n templateId: z.string().optional(),\n \n // Recipients with personalizations\n recipients: z.array(emailProviderBatchItemSchema).min(1),\n \n // Tags\n tags: z.array(z.string()).optional(),\n});\nexport type EmailProvider_SendBatchInput = z.infer<typeof EmailProvider_SendBatchInputSchema>;\n\n// ===============================================================\n// Batch Send Output Schema\n// ===============================================================\n\nexport const EmailProvider_SendBatchOutputSchema = z.object({\n // Summary\n totalRequested: z.number().int(),\n totalAccepted: z.number().int(),\n totalRejected: z.number().int(),\n \n // Results per recipient\n results: z.array(z.object({\n email: z.string(),\n id: z.string().optional(),\n status: z.enum([\"accepted\", \"rejected\"]),\n error: z.string().optional(),\n })),\n});\nexport type EmailProvider_SendBatchOutput = z.infer<typeof EmailProvider_SendBatchOutputSchema>;\n\n// ===============================================================\n// Campaign Input Schema (Marketing)\n// ===============================================================\n\nexport const EmailProvider_CreateCampaignInputSchema = z.object({\n // Campaign details\n name: z.string().min(1),\n subject: z.string().min(1),\n previewText: z.string().optional(),\n \n // Sender\n from: EmailProvider_AddressSchema,\n replyTo: EmailProvider_AddressSchema.optional(),\n \n // Content\n html: z.string().optional(),\n text: z.string().optional(),\n templateId: z.string().optional(),\n \n // Recipients\n listIds: z.array(z.string()).optional(),\n segmentIds: z.array(z.string()).optional(),\n \n // Scheduling\n scheduledAt: z.iso.datetime().optional(),\n \n // Tracking\n trackOpens: z.boolean().optional().default(true),\n trackClicks: z.boolean().optional().default(true),\n});\nexport type EmailProvider_CreateCampaignInput = z.infer<typeof EmailProvider_CreateCampaignInputSchema>;\n\n// ===============================================================\n// Campaign Output Schema\n// ===============================================================\n\nexport const EmailProvider_CampaignOutputSchema = z.object({\n id: z.string(),\n status: z.enum([\"draft\", \"scheduled\", \"sending\", \"sent\", \"cancelled\"]),\n scheduledAt: z.iso.datetime().optional(),\n sentAt: z.iso.datetime().optional(),\n});\nexport type EmailProvider_CampaignOutput = z.infer<typeof EmailProvider_CampaignOutputSchema>;\n\n// ===============================================================\n// Message Status Schema\n// ===============================================================\n\nexport const EmailProvider_MessageStatusSchema = z.object({\n id: z.string(),\n status: z.enum(EmailProvider_DeliveryStatus),\n to: z.email(),\n subject: z.string().optional(),\n sentAt: z.iso.datetime().optional(),\n deliveredAt: z.iso.datetime().optional(),\n openedAt: z.iso.datetime().optional(),\n clickedAt: z.iso.datetime().optional(),\n bouncedAt: z.iso.datetime().optional(),\n bounceType: z.enum(EmailProvider_BounceType).optional(),\n bounceReason: z.string().optional(),\n});\nexport type EmailProvider_MessageStatus = z.infer<typeof EmailProvider_MessageStatusSchema>;\n\n// ===============================================================\n// Email Operation Context (for tracking)\n// ===============================================================\n\nexport const EmailProvider_OperationContextSchema = ExternalProvider_OperationContextSchema.extend({\n // Message identification\n messageId: z.string().optional(),\n \n // Delivery info\n deliveryMethod: z.enum(EmailProvider_DeliveryMethod).optional(),\n deliveryStatus: z.enum(EmailProvider_DeliveryStatus).optional(),\n \n // Email type\n emailType: z.enum(EmailProvider_EmailType).optional(),\n \n // Counts\n recipientCount: z.number().int().optional(),\n \n // Rate limit headers from provider\n rateLimitRemaining: z.number().optional(),\n rateLimitResetAt: z.iso.datetime().optional(),\n});\nexport type EmailProvider_OperationContext = z.infer<typeof EmailProvider_OperationContextSchema>;\n\n// ===============================================================\n// Webhook Event Schema\n// ===============================================================\n\nexport const EmailProvider_WebhookEventSchema = z.object({\n eventType: z.enum(EmailProvider_DeliveryStatus),\n messageId: z.string(),\n email: z.email(),\n timestamp: z.iso.datetime(),\n \n // Event-specific data\n bounceType: z.enum(EmailProvider_BounceType).optional(),\n bounceReason: z.string().optional(),\n link: z.url().optional(), // For click events\n userAgent: z.string().optional(),\n \n // Original tags\n tags: z.array(z.string()).optional(),\n});\nexport type EmailProvider_WebhookEvent = z.infer<typeof EmailProvider_WebhookEventSchema>;\n\n// ===============================================================\n// Email Operation Definition\n// ===============================================================\n\nexport type EmailProvider_OperationDefinition = ExternalProvider_OperationDefinition_Base & {\n operationContextSchema: typeof EmailProvider_OperationContextSchema;\n \n // Which email types this operation supports\n supportedEmailTypes: EmailProvider_EmailType[];\n \n // Which delivery methods work for this operation\n supportedDeliveryMethods: EmailProvider_DeliveryMethod[];\n \n // Required capabilities\n requiredCapabilities?: EmailProvider_Capability[];\n};\n\n"]}
|
|
@@ -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,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;;;;;;;;;;;;;
|
|
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,CAA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