jmap-kit 0.0.0 → 1.0.2
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/LICENSE +21 -0
- package/README.md +138 -3
- package/dist/src/capabilities/blob/blob.d.ts +83 -0
- package/dist/src/capabilities/blob/blob.js +98 -0
- package/dist/src/capabilities/blob/blob.js.map +1 -0
- package/dist/src/capabilities/blob/types.d.ts +212 -0
- package/dist/src/capabilities/blob/types.js +16 -0
- package/dist/src/capabilities/blob/types.js.map +1 -0
- package/dist/src/capabilities/blob-capability.d.ts +195 -0
- package/dist/src/capabilities/blob-capability.js +277 -0
- package/dist/src/capabilities/blob-capability.js.map +1 -0
- package/dist/src/capabilities/core/core.d.ts +47 -0
- package/dist/src/capabilities/core/core.js +59 -0
- package/dist/src/capabilities/core/core.js.map +1 -0
- package/dist/src/capabilities/core/types.d.ts +13 -0
- package/dist/src/capabilities/core/types.js +2 -0
- package/dist/src/capabilities/core/types.js.map +1 -0
- package/dist/src/capabilities/core-capability.d.ts +307 -0
- package/dist/src/capabilities/core-capability.js +344 -0
- package/dist/src/capabilities/core-capability.js.map +1 -0
- package/dist/src/capabilities/email/email.d.ts +124 -0
- package/dist/src/capabilities/email/email.js +136 -0
- package/dist/src/capabilities/email/email.js.map +1 -0
- package/dist/src/capabilities/email/types.d.ts +776 -0
- package/dist/src/capabilities/email/types.js +2 -0
- package/dist/src/capabilities/email/types.js.map +1 -0
- package/dist/src/capabilities/email-capability.d.ts +266 -0
- package/dist/src/capabilities/email-capability.js +241 -0
- package/dist/src/capabilities/email-capability.js.map +1 -0
- package/dist/src/capabilities/emailsubmission/emailsubmission.d.ts +95 -0
- package/dist/src/capabilities/emailsubmission/emailsubmission.js +107 -0
- package/dist/src/capabilities/emailsubmission/emailsubmission.js.map +1 -0
- package/dist/src/capabilities/emailsubmission/types.d.ts +256 -0
- package/dist/src/capabilities/emailsubmission/types.js +2 -0
- package/dist/src/capabilities/emailsubmission/types.js.map +1 -0
- package/dist/src/capabilities/example/example.d.ts +80 -0
- package/dist/src/capabilities/example/example.js +91 -0
- package/dist/src/capabilities/example/example.js.map +1 -0
- package/dist/src/capabilities/example/types.d.ts +33 -0
- package/dist/src/capabilities/example/types.js +2 -0
- package/dist/src/capabilities/example/types.js.map +1 -0
- package/dist/src/capabilities/identity/identity.d.ts +71 -0
- package/dist/src/capabilities/identity/identity.js +83 -0
- package/dist/src/capabilities/identity/identity.js.map +1 -0
- package/dist/src/capabilities/identity/types.d.ts +110 -0
- package/dist/src/capabilities/identity/types.js +2 -0
- package/dist/src/capabilities/identity/types.js.map +1 -0
- package/dist/src/capabilities/mailbox/mailbox.d.ts +91 -0
- package/dist/src/capabilities/mailbox/mailbox.js +103 -0
- package/dist/src/capabilities/mailbox/mailbox.js.map +1 -0
- package/dist/src/capabilities/mailbox/types.d.ts +248 -0
- package/dist/src/capabilities/mailbox/types.js +2 -0
- package/dist/src/capabilities/mailbox/types.js.map +1 -0
- package/dist/src/capabilities/maskedemail/maskedemail.d.ts +60 -0
- package/dist/src/capabilities/maskedemail/maskedemail.js +72 -0
- package/dist/src/capabilities/maskedemail/maskedemail.js.map +1 -0
- package/dist/src/capabilities/maskedemail/types.d.ts +67 -0
- package/dist/src/capabilities/maskedemail/types.js +4 -0
- package/dist/src/capabilities/maskedemail/types.js.map +1 -0
- package/dist/src/capabilities/maskedemail-capability.d.ts +112 -0
- package/dist/src/capabilities/maskedemail-capability.js +166 -0
- package/dist/src/capabilities/maskedemail-capability.js.map +1 -0
- package/dist/src/capabilities/searchsnippet/searchsnippet.d.ts +51 -0
- package/dist/src/capabilities/searchsnippet/searchsnippet.js +63 -0
- package/dist/src/capabilities/searchsnippet/searchsnippet.js.map +1 -0
- package/dist/src/capabilities/searchsnippet/types.d.ts +88 -0
- package/dist/src/capabilities/searchsnippet/types.js +2 -0
- package/dist/src/capabilities/searchsnippet/types.js.map +1 -0
- package/dist/src/capabilities/submission-capability.d.ts +89 -0
- package/dist/src/capabilities/submission-capability.js +75 -0
- package/dist/src/capabilities/submission-capability.js.map +1 -0
- package/dist/src/capabilities/thread/thread.d.ts +58 -0
- package/dist/src/capabilities/thread/thread.js +70 -0
- package/dist/src/capabilities/thread/thread.js.map +1 -0
- package/dist/src/capabilities/thread/types.d.ts +43 -0
- package/dist/src/capabilities/thread/types.js +2 -0
- package/dist/src/capabilities/thread/types.js.map +1 -0
- package/dist/src/capabilities/utils/assert-invocation-datatype.d.ts +7 -0
- package/dist/src/capabilities/utils/assert-invocation-datatype.js +13 -0
- package/dist/src/capabilities/utils/assert-invocation-datatype.js.map +1 -0
- package/dist/src/capabilities/utils/assert-invocation-method.d.ts +7 -0
- package/dist/src/capabilities/utils/assert-invocation-method.js +13 -0
- package/dist/src/capabilities/utils/assert-invocation-method.js.map +1 -0
- package/dist/src/capabilities/utils/assert-invocation.d.ts +7 -0
- package/dist/src/capabilities/utils/assert-invocation.js +22 -0
- package/dist/src/capabilities/utils/assert-invocation.js.map +1 -0
- package/dist/src/capabilities/utils/assert-non-nullish.d.ts +1 -0
- package/dist/src/capabilities/utils/assert-non-nullish.js +6 -0
- package/dist/src/capabilities/utils/assert-non-nullish.js.map +1 -0
- package/dist/src/capabilities/utils/create-readonly-account-validator.d.ts +49 -0
- package/dist/src/capabilities/utils/create-readonly-account-validator.js +80 -0
- package/dist/src/capabilities/utils/create-readonly-account-validator.js.map +1 -0
- package/dist/src/capabilities/vacationresponse/types.d.ts +100 -0
- package/dist/src/capabilities/vacationresponse/types.js +2 -0
- package/dist/src/capabilities/vacationresponse/types.js.map +1 -0
- package/dist/src/capabilities/vacationresponse/vacationresponse.d.ts +61 -0
- package/dist/src/capabilities/vacationresponse/vacationresponse.js +73 -0
- package/dist/src/capabilities/vacationresponse/vacationresponse.js.map +1 -0
- package/dist/src/capabilities/vacationresponse-capability.d.ts +65 -0
- package/dist/src/capabilities/vacationresponse-capability.js +68 -0
- package/dist/src/capabilities/vacationresponse-capability.js.map +1 -0
- package/dist/src/capability-registry/capability-registry.d.ts +148 -0
- package/dist/src/capability-registry/capability-registry.js +360 -0
- package/dist/src/capability-registry/capability-registry.js.map +1 -0
- package/dist/src/capability-registry/types.d.ts +385 -0
- package/dist/src/capability-registry/types.js +2 -0
- package/dist/src/capability-registry/types.js.map +1 -0
- package/dist/src/capability-registry/utils.d.ts +71 -0
- package/dist/src/capability-registry/utils.js +163 -0
- package/dist/src/capability-registry/utils.js.map +1 -0
- package/dist/src/common/registry.d.ts +366 -0
- package/dist/src/common/registry.js +321 -0
- package/dist/src/common/registry.js.map +1 -0
- package/dist/src/common/types.d.ts +338 -0
- package/dist/src/common/types.js +21 -0
- package/dist/src/common/types.js.map +1 -0
- package/dist/src/common/utils.d.ts +20 -0
- package/dist/src/common/utils.js +26 -0
- package/dist/src/common/utils.js.map +1 -0
- package/dist/src/index.d.ts +40 -0
- package/dist/src/index.js +33 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/invocation/arguments-proxy.d.ts +14 -0
- package/dist/src/invocation/arguments-proxy.js +37 -0
- package/dist/src/invocation/arguments-proxy.js.map +1 -0
- package/dist/src/invocation/error-invocation.d.ts +27 -0
- package/dist/src/invocation/error-invocation.js +39 -0
- package/dist/src/invocation/error-invocation.js.map +1 -0
- package/dist/src/invocation/invocation.d.ts +111 -0
- package/dist/src/invocation/invocation.js +158 -0
- package/dist/src/invocation/invocation.js.map +1 -0
- package/dist/src/invocation/result-reference.d.ts +86 -0
- package/dist/src/invocation/result-reference.js +118 -0
- package/dist/src/invocation/result-reference.js.map +1 -0
- package/dist/src/invocation/types.d.ts +637 -0
- package/dist/src/invocation/types.js +2 -0
- package/dist/src/invocation/types.js.map +1 -0
- package/dist/src/invocation/utils.d.ts +21 -0
- package/dist/src/invocation/utils.js +30 -0
- package/dist/src/invocation/utils.js.map +1 -0
- package/dist/src/invocation-factory/invocation-factory-manager.d.ts +20 -0
- package/dist/src/invocation-factory/invocation-factory-manager.js +50 -0
- package/dist/src/invocation-factory/invocation-factory-manager.js.map +1 -0
- package/dist/src/invocation-factory/invocation-list.d.ts +32 -0
- package/dist/src/invocation-factory/invocation-list.js +77 -0
- package/dist/src/invocation-factory/invocation-list.js.map +1 -0
- package/dist/src/invocation-factory/types.d.ts +11 -0
- package/dist/src/invocation-factory/types.js +2 -0
- package/dist/src/invocation-factory/types.js.map +1 -0
- package/dist/src/jmap-client/jmap-client.d.ts +252 -0
- package/dist/src/jmap-client/jmap-client.js +777 -0
- package/dist/src/jmap-client/jmap-client.js.map +1 -0
- package/dist/src/jmap-client/types.d.ts +427 -0
- package/dist/src/jmap-client/types.js +21 -0
- package/dist/src/jmap-client/types.js.map +1 -0
- package/dist/src/jmap-client/utils/abort-controller.d.ts +8 -0
- package/dist/src/jmap-client/utils/abort-controller.js +24 -0
- package/dist/src/jmap-client/utils/abort-controller.js.map +1 -0
- package/dist/src/jmap-client/utils/assert-connected.d.ts +7 -0
- package/dist/src/jmap-client/utils/assert-connected.js +11 -0
- package/dist/src/jmap-client/utils/assert-connected.js.map +1 -0
- package/dist/src/jmap-client/utils/deep-freeze.d.ts +7 -0
- package/dist/src/jmap-client/utils/deep-freeze.js +17 -0
- package/dist/src/jmap-client/utils/deep-freeze.js.map +1 -0
- package/dist/src/jmap-client/utils/emitter.d.ts +9 -0
- package/dist/src/jmap-client/utils/emitter.js +18 -0
- package/dist/src/jmap-client/utils/emitter.js.map +1 -0
- package/dist/src/jmap-client/utils/filter-session-capabilities.d.ts +22 -0
- package/dist/src/jmap-client/utils/filter-session-capabilities.js +40 -0
- package/dist/src/jmap-client/utils/filter-session-capabilities.js.map +1 -0
- package/dist/src/jmap-client/utils/jmap-request-error.d.ts +28 -0
- package/dist/src/jmap-client/utils/jmap-request-error.js +48 -0
- package/dist/src/jmap-client/utils/jmap-request-error.js.map +1 -0
- package/dist/src/jmap-client/utils/logger.d.ts +6 -0
- package/dist/src/jmap-client/utils/logger.js +22 -0
- package/dist/src/jmap-client/utils/logger.js.map +1 -0
- package/dist/src/jmap-client/utils/merge-headers.d.ts +11 -0
- package/dist/src/jmap-client/utils/merge-headers.js +40 -0
- package/dist/src/jmap-client/utils/merge-headers.js.map +1 -0
- package/dist/src/jmap-client/utils/template-utils.d.ts +27 -0
- package/dist/src/jmap-client/utils/template-utils.js +61 -0
- package/dist/src/jmap-client/utils/template-utils.js.map +1 -0
- package/dist/src/jmap-client/utils/track-utils.d.ts +19 -0
- package/dist/src/jmap-client/utils/track-utils.js +35 -0
- package/dist/src/jmap-client/utils/track-utils.js.map +1 -0
- package/dist/src/jmap-client/utils/transport.d.ts +12 -0
- package/dist/src/jmap-client/utils/transport.js +38 -0
- package/dist/src/jmap-client/utils/transport.js.map +1 -0
- package/dist/src/jmap-client/utils/validate-session.d.ts +19 -0
- package/dist/src/jmap-client/utils/validate-session.js +29 -0
- package/dist/src/jmap-client/utils/validate-session.js.map +1 -0
- package/dist/src/request-builder/request-builder.d.ts +95 -0
- package/dist/src/request-builder/request-builder.js +343 -0
- package/dist/src/request-builder/request-builder.js.map +1 -0
- package/dist/src/request-builder/types.d.ts +32 -0
- package/dist/src/request-builder/types.js +2 -0
- package/dist/src/request-builder/types.js.map +1 -0
- package/package.json +69 -3
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { SUBMISSION_CAPABILITY_URI } from "../../common/registry.js";
|
|
2
|
+
import { Invocation } from "../../invocation/invocation.js";
|
|
3
|
+
/**
|
|
4
|
+
* EmailSubmissionInvocation represents a JMAP EmailSubmission capability invocation.
|
|
5
|
+
*
|
|
6
|
+
* An EmailSubmission object represents the submission of an Email for delivery to one or more
|
|
7
|
+
* recipients. It supports standard JMAP methods for retrieving, querying, and modifying submissions.
|
|
8
|
+
*
|
|
9
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc8621.html#section-7 | RFC 8621 Section 7: Email Submission}
|
|
10
|
+
*/
|
|
11
|
+
export class EmailSubmissionInvocation extends Invocation {
|
|
12
|
+
get uri() {
|
|
13
|
+
return SUBMISSION_CAPABILITY_URI;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Constructs an EmailSubmissionInvocation
|
|
17
|
+
*
|
|
18
|
+
* @param method The name of the method being invoked (e.g., "get", "set", "query")
|
|
19
|
+
* @param args The arguments for the method invocation
|
|
20
|
+
* @param methodCallId An optional unique symbol to identify this method call for result referencing
|
|
21
|
+
*/
|
|
22
|
+
constructor(method, args, methodCallId) {
|
|
23
|
+
super("EmailSubmission", method, args, methodCallId);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Create an invocation factory function
|
|
27
|
+
*
|
|
28
|
+
* @param method The name of the method to create
|
|
29
|
+
* @returns A new EmailSubmission invocation factory function for creating invocations of the specified type
|
|
30
|
+
*/
|
|
31
|
+
static createInvocationFactory(method) {
|
|
32
|
+
/**
|
|
33
|
+
* An invocation factory function to create an `EmailSubmission/{method}` invocation.
|
|
34
|
+
*
|
|
35
|
+
* @param args The invocation arguments for the specified `method`
|
|
36
|
+
* @param methodCallId An optional unique symbol to identify this method call for result referencing
|
|
37
|
+
* @returns An object representing the named arguments for the specified `method`
|
|
38
|
+
*/
|
|
39
|
+
return (args, methodCallId) => new EmailSubmissionInvocation(method, args, methodCallId);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export const EmailSubmission = {
|
|
43
|
+
request: {
|
|
44
|
+
/**
|
|
45
|
+
* Retrieves EmailSubmission objects by their IDs.
|
|
46
|
+
*
|
|
47
|
+
* @param args The invocation arguments for EmailSubmission/get
|
|
48
|
+
* @param methodCallId An optional unique symbol to identify this method call for result referencing
|
|
49
|
+
* @returns An EmailSubmissionInvocation representing the EmailSubmission/get request
|
|
50
|
+
*
|
|
51
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc8621.html#section-7.1 | RFC 8621 Section 7.1: EmailSubmission/get}
|
|
52
|
+
*/
|
|
53
|
+
get: EmailSubmissionInvocation.createInvocationFactory("get"),
|
|
54
|
+
/**
|
|
55
|
+
* Returns changes to EmailSubmission objects since a given state.
|
|
56
|
+
*
|
|
57
|
+
* @param args The invocation arguments for EmailSubmission/changes
|
|
58
|
+
* @param methodCallId An optional unique symbol to identify this method call for result referencing
|
|
59
|
+
* @returns An EmailSubmissionInvocation representing the EmailSubmission/changes request
|
|
60
|
+
*
|
|
61
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc8621.html#section-7.2 | RFC 8621 Section 7.2: EmailSubmission/changes}
|
|
62
|
+
*/
|
|
63
|
+
changes: EmailSubmissionInvocation.createInvocationFactory("changes"),
|
|
64
|
+
/**
|
|
65
|
+
* Queries for EmailSubmission objects matching specified criteria.
|
|
66
|
+
*
|
|
67
|
+
* @param args The invocation arguments for EmailSubmission/query
|
|
68
|
+
* @param methodCallId An optional unique symbol to identify this method call for result referencing
|
|
69
|
+
* @returns An EmailSubmissionInvocation representing the EmailSubmission/query request
|
|
70
|
+
*
|
|
71
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc8621.html#section-7.3 | RFC 8621 Section 7.3: EmailSubmission/query}
|
|
72
|
+
*/
|
|
73
|
+
query: EmailSubmissionInvocation.createInvocationFactory("query"),
|
|
74
|
+
/**
|
|
75
|
+
* Returns changes to a query result since a given state.
|
|
76
|
+
*
|
|
77
|
+
* @param args The invocation arguments for EmailSubmission/queryChanges
|
|
78
|
+
* @param methodCallId An optional unique symbol to identify this method call for result referencing
|
|
79
|
+
* @returns An EmailSubmissionInvocation representing the EmailSubmission/queryChanges request
|
|
80
|
+
*
|
|
81
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc8621.html#section-7.4 | RFC 8621 Section 7.4: EmailSubmission/queryChanges}
|
|
82
|
+
*/
|
|
83
|
+
queryChanges: EmailSubmissionInvocation.createInvocationFactory("queryChanges"),
|
|
84
|
+
/**
|
|
85
|
+
* Creates, updates, or destroys EmailSubmission objects.
|
|
86
|
+
*
|
|
87
|
+
* An Email is sent by creating an EmailSubmission object. Additional `onSuccessUpdateEmail`
|
|
88
|
+
* and `onSuccessDestroyEmail` arguments allow updating or destroying the referenced Email
|
|
89
|
+
* upon successful submission.
|
|
90
|
+
*
|
|
91
|
+
* @param args The invocation arguments for EmailSubmission/set
|
|
92
|
+
* @param methodCallId An optional unique symbol to identify this method call for result referencing
|
|
93
|
+
* @returns An EmailSubmissionInvocation representing the EmailSubmission/set request
|
|
94
|
+
*
|
|
95
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc8621.html#section-7.5 | RFC 8621 Section 7.5: EmailSubmission/set}
|
|
96
|
+
*/
|
|
97
|
+
set: EmailSubmissionInvocation.createInvocationFactory("set"),
|
|
98
|
+
},
|
|
99
|
+
response: {
|
|
100
|
+
get: EmailSubmissionInvocation.createInvocationFactory("get"),
|
|
101
|
+
changes: EmailSubmissionInvocation.createInvocationFactory("changes"),
|
|
102
|
+
query: EmailSubmissionInvocation.createInvocationFactory("query"),
|
|
103
|
+
queryChanges: EmailSubmissionInvocation.createInvocationFactory("queryChanges"),
|
|
104
|
+
set: EmailSubmissionInvocation.createInvocationFactory("set"),
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
//# sourceMappingURL=emailsubmission.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"emailsubmission.js","sourceRoot":"","sources":["../../../../src/capabilities/emailsubmission/emailsubmission.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAiB5D;;;;;;;GAOG;AACH,MAAM,OAAO,yBAEX,SAAQ,UAAiB;IACvB,IAAI,GAAG;QACH,OAAO,yBAAyB,CAAC;IACrC,CAAC;IAED;;;;;;OAMG;IACH,YAAY,MAAsB,EAAE,IAA2B,EAAE,YAAqB;QAClF,KAAK,CAAC,iBAAiB,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;IACzD,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,uBAAuB,CAE5B,MAAsB;QACpB;;;;;;WAMG;QACH,OAAO,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,CAAC,IAAI,yBAAyB,CAAQ,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;IACpG,CAAC;CACJ;AAED,MAAM,CAAC,MAAM,eAAe,GAAG;IAC3B,OAAO,EAAE;QACL;;;;;;;;WAQG;QACH,GAAG,EAAE,yBAAyB,CAAC,uBAAuB,CAA0C,KAAK,CAAC;QACtG;;;;;;;;WAQG;QACH,OAAO,EACH,yBAAyB,CAAC,uBAAuB,CAA8C,SAAS,CAAC;QAC7G;;;;;;;;WAQG;QACH,KAAK,EAAE,yBAAyB,CAAC,uBAAuB,CAA4C,OAAO,CAAC;QAC5G;;;;;;;;WAQG;QACH,YAAY,EACR,yBAAyB,CAAC,uBAAuB,CAC7C,cAAc,CACjB;QACL;;;;;;;;;;;;WAYG;QACH,GAAG,EAAE,yBAAyB,CAAC,uBAAuB,CAA0C,KAAK,CAAC;KACzG;IACD,QAAQ,EAAE;QACN,GAAG,EAAE,yBAAyB,CAAC,uBAAuB,CAA2C,KAAK,CAAC;QACvG,OAAO,EACH,yBAAyB,CAAC,uBAAuB,CAA+C,SAAS,CAAC;QAC9G,KAAK,EAAE,yBAAyB,CAAC,uBAAuB,CAA6C,OAAO,CAAC;QAC7G,YAAY,EACR,yBAAyB,CAAC,uBAAuB,CAC7C,cAAc,CACjB;QACL,GAAG,EAAE,yBAAyB,CAAC,uBAAuB,CAA2C,KAAK,CAAC;KAC1G;CACkC,CAAC"}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import type { Id, UTCDate } from "../../common/types.js";
|
|
2
|
+
import type { BaseChangesRequestInvocationArgs, BaseChangesResponseInvocationArgs, BaseGetRequestInvocationArgs, BaseGetResponseInvocationArgs, BaseQueryChangesRequestInvocationArgs, BaseQueryChangesResponseInvocationArgs, BaseQueryRequestInvocationArgs, BaseQueryResponseInvocationArgs, BaseSetRequestInvocationArgs, BaseSetResponseInvocationArgs, PatchObject } from "../../invocation/types.js";
|
|
3
|
+
/**
|
|
4
|
+
* An Address object used in the Envelope for SMTP submission.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc8621.html#section-7 | RFC 8621 Section 7: Email Submission}
|
|
7
|
+
*/
|
|
8
|
+
export type EmailSubmissionAddress = {
|
|
9
|
+
/**
|
|
10
|
+
* The email address being represented by the object. This is a `Mailbox` as used in the
|
|
11
|
+
* Reverse-path or Forward-path of the MAIL FROM or RCPT TO command in
|
|
12
|
+
* {@link https://www.rfc-editor.org/rfc/rfc5321.html RFC 5321}.
|
|
13
|
+
*/
|
|
14
|
+
email: string;
|
|
15
|
+
/**
|
|
16
|
+
* Any parameters to send with the email address (either mail-parameter or rcpt-parameter
|
|
17
|
+
* as appropriate, as specified in {@link https://www.rfc-editor.org/rfc/rfc5321.html RFC 5321}).
|
|
18
|
+
* If supplied, each key in the object is a parameter name, and the value is either the
|
|
19
|
+
* parameter value (type `String`) or `null` if the parameter does not take a value.
|
|
20
|
+
*/
|
|
21
|
+
parameters?: Record<string, string | null> | null;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* An Envelope object containing the information for use when sending via SMTP.
|
|
25
|
+
*
|
|
26
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc8621.html#section-7 | RFC 8621 Section 7: Email Submission}
|
|
27
|
+
*/
|
|
28
|
+
export type EmailSubmissionEnvelope = {
|
|
29
|
+
/**
|
|
30
|
+
* The email address to use as the return address in the SMTP submission, plus any
|
|
31
|
+
* parameters to pass with the MAIL FROM address. The JMAP server MAY allow the
|
|
32
|
+
* address to be the empty string.
|
|
33
|
+
*/
|
|
34
|
+
mailFrom: EmailSubmissionAddress;
|
|
35
|
+
/**
|
|
36
|
+
* The email addresses to send the message to, and any RCPT TO parameters to pass
|
|
37
|
+
* with the recipient.
|
|
38
|
+
*/
|
|
39
|
+
rcptTo: EmailSubmissionAddress[];
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* A DeliveryStatus object representing the delivery status for a recipient.
|
|
43
|
+
*
|
|
44
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc8621.html#section-7 | RFC 8621 Section 7: Email Submission}
|
|
45
|
+
*/
|
|
46
|
+
export type DeliveryStatus = {
|
|
47
|
+
/**
|
|
48
|
+
* The SMTP reply string returned for this recipient when the server last tried to relay
|
|
49
|
+
* the message, or in a later Delivery Status Notification (DSN, as defined in
|
|
50
|
+
* {@link https://www.rfc-editor.org/rfc/rfc3464.html RFC 3464}) response for the message.
|
|
51
|
+
*/
|
|
52
|
+
smtpReply: string;
|
|
53
|
+
/**
|
|
54
|
+
* Represents whether the message has been successfully delivered to the recipient.
|
|
55
|
+
* This MUST be one of the following values:
|
|
56
|
+
* - `queued`: The message is in a local mail queue and the status will change once
|
|
57
|
+
* it exits the local mail queues.
|
|
58
|
+
* - `yes`: The message was successfully delivered to the mail store of the recipient.
|
|
59
|
+
* - `no`: Delivery to the recipient permanently failed.
|
|
60
|
+
* - `unknown`: The final delivery status is unknown.
|
|
61
|
+
*/
|
|
62
|
+
delivered: "queued" | "yes" | "no" | "unknown";
|
|
63
|
+
/**
|
|
64
|
+
* Represents whether the message has been displayed to the recipient.
|
|
65
|
+
* This MUST be one of the following values:
|
|
66
|
+
* - `unknown`: The display status is unknown. This is the initial value.
|
|
67
|
+
* - `yes`: The recipient's system claims the message content has been displayed
|
|
68
|
+
* to the recipient.
|
|
69
|
+
*/
|
|
70
|
+
displayed: "unknown" | "yes";
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* EmailSubmissionObject properties set by the server. These cannot be set by an
|
|
74
|
+
* `EmailSubmission/set` call.
|
|
75
|
+
*
|
|
76
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc8621.html#section-7 | RFC 8621 Section 7: Email Submission}
|
|
77
|
+
*/
|
|
78
|
+
export type EmailSubmissionObjectServerSet = Readonly<{
|
|
79
|
+
/**
|
|
80
|
+
* (immutable; server-set) The id of the EmailSubmission.
|
|
81
|
+
*/
|
|
82
|
+
id: Id;
|
|
83
|
+
/**
|
|
84
|
+
* (immutable; server-set) The Thread id of the Email to send. This is set by the server
|
|
85
|
+
* to the `threadId` property of the Email referenced by the `emailId`.
|
|
86
|
+
*/
|
|
87
|
+
threadId: Id;
|
|
88
|
+
/**
|
|
89
|
+
* (immutable; server-set) The date the submission was/will be released for delivery.
|
|
90
|
+
* If the client successfully used FUTURERELEASE
|
|
91
|
+
* ({@link https://www.rfc-editor.org/rfc/rfc4865.html RFC 4865}) with the submission,
|
|
92
|
+
* this MUST be the time when the server will release the message; otherwise, it MUST be
|
|
93
|
+
* the time the EmailSubmission was created.
|
|
94
|
+
*/
|
|
95
|
+
sendAt: UTCDate;
|
|
96
|
+
/**
|
|
97
|
+
* (server-set) This represents the delivery status for each of the submission's recipients,
|
|
98
|
+
* if known. This property MAY not be supported by all servers, in which case it will remain
|
|
99
|
+
* `null`. Servers that support it SHOULD update the EmailSubmission object each time the
|
|
100
|
+
* status of any of the recipients changes, even if some recipients are still being retried.
|
|
101
|
+
*
|
|
102
|
+
* This value is a map from the email address of each recipient to a DeliveryStatus object.
|
|
103
|
+
*/
|
|
104
|
+
deliveryStatus: Record<string, DeliveryStatus> | null;
|
|
105
|
+
/**
|
|
106
|
+
* (server-set) A list of blob ids for DSNs
|
|
107
|
+
* ({@link https://www.rfc-editor.org/rfc/rfc3464.html RFC 3464}) received for this
|
|
108
|
+
* submission, in order of receipt, oldest first.
|
|
109
|
+
*/
|
|
110
|
+
dsnBlobIds: Id[];
|
|
111
|
+
/**
|
|
112
|
+
* (server-set) A list of blob ids for MDNs
|
|
113
|
+
* ({@link https://www.rfc-editor.org/rfc/rfc8098.html RFC 8098}) received for this
|
|
114
|
+
* submission, in order of receipt, oldest first.
|
|
115
|
+
*/
|
|
116
|
+
mdnBlobIds: Id[];
|
|
117
|
+
}>;
|
|
118
|
+
/**
|
|
119
|
+
* EmailSubmissionObject properties that may be set via an `EmailSubmission/set` call.
|
|
120
|
+
*
|
|
121
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc8621.html#section-7 | RFC 8621 Section 7: Email Submission}
|
|
122
|
+
*/
|
|
123
|
+
export type EmailSubmissionObjectSettable = {
|
|
124
|
+
/**
|
|
125
|
+
* (immutable) The id of the Identity to associate with this submission.
|
|
126
|
+
*/
|
|
127
|
+
readonly identityId: Id;
|
|
128
|
+
/**
|
|
129
|
+
* (immutable) The id of the Email to send. The Email being sent does not have to be a
|
|
130
|
+
* draft, for example, when "redirecting" an existing Email to a different address.
|
|
131
|
+
*/
|
|
132
|
+
readonly emailId: Id;
|
|
133
|
+
/**
|
|
134
|
+
* (immutable) Information for use when sending via SMTP. If `null` or omitted on creation,
|
|
135
|
+
* the server MUST generate this from the referenced Email.
|
|
136
|
+
*/
|
|
137
|
+
readonly envelope?: EmailSubmissionEnvelope | null;
|
|
138
|
+
/**
|
|
139
|
+
* This represents whether the submission may be canceled. This is server set on create
|
|
140
|
+
* and MUST be one of the following values:
|
|
141
|
+
* - `pending`: It may be possible to cancel this submission.
|
|
142
|
+
* - `final`: The message has been relayed to at least one recipient in a manner that
|
|
143
|
+
* cannot be recalled. It is no longer possible to cancel this submission.
|
|
144
|
+
* - `canceled`: The submission was canceled and will not be delivered to any recipient.
|
|
145
|
+
*/
|
|
146
|
+
undoStatus?: "pending" | "final" | "canceled";
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* Properties of the EmailSubmission object.
|
|
150
|
+
*
|
|
151
|
+
* An EmailSubmission object represents the submission of an Email for delivery to one or
|
|
152
|
+
* more recipients.
|
|
153
|
+
*
|
|
154
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc8621.html#section-7 | RFC 8621 Section 7: Email Submission}
|
|
155
|
+
*/
|
|
156
|
+
export type EmailSubmissionObject = EmailSubmissionObjectServerSet & EmailSubmissionObjectSettable;
|
|
157
|
+
/**
|
|
158
|
+
* The arguments for fetching EmailSubmission objects via an `EmailSubmission/get` call.
|
|
159
|
+
*/
|
|
160
|
+
export type EmailSubmissionGetRequestInvocationArgs = BaseGetRequestInvocationArgs<EmailSubmissionObject>;
|
|
161
|
+
/**
|
|
162
|
+
* The response to an `EmailSubmission/get` call.
|
|
163
|
+
*/
|
|
164
|
+
export type EmailSubmissionGetResponseInvocationArgs = BaseGetResponseInvocationArgs<EmailSubmissionObject>;
|
|
165
|
+
/**
|
|
166
|
+
* The arguments for fetching EmailSubmission changes via an `EmailSubmission/changes` call.
|
|
167
|
+
*/
|
|
168
|
+
export type EmailSubmissionChangesRequestInvocationArgs = BaseChangesRequestInvocationArgs;
|
|
169
|
+
/**
|
|
170
|
+
* The response to an `EmailSubmission/changes` call.
|
|
171
|
+
*/
|
|
172
|
+
export type EmailSubmissionChangesResponseInvocationArgs = BaseChangesResponseInvocationArgs;
|
|
173
|
+
/**
|
|
174
|
+
* Filter conditions for `EmailSubmission/query`.
|
|
175
|
+
*
|
|
176
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc8621.html#section-7.3 | RFC 8621 Section 7.3: EmailSubmission/query}
|
|
177
|
+
*/
|
|
178
|
+
export type EmailSubmissionFilterCondition = Partial<{
|
|
179
|
+
/**
|
|
180
|
+
* The EmailSubmission `identityId` property must be in this list to match the condition.
|
|
181
|
+
*/
|
|
182
|
+
identityIds: Id[];
|
|
183
|
+
/**
|
|
184
|
+
* The EmailSubmission `emailId` property must be in this list to match the condition.
|
|
185
|
+
*/
|
|
186
|
+
emailIds: Id[];
|
|
187
|
+
/**
|
|
188
|
+
* The EmailSubmission `threadId` property must be in this list to match the condition.
|
|
189
|
+
*/
|
|
190
|
+
threadIds: Id[];
|
|
191
|
+
/**
|
|
192
|
+
* The EmailSubmission `undoStatus` property must be identical to the value given to
|
|
193
|
+
* match the condition.
|
|
194
|
+
*/
|
|
195
|
+
undoStatus: string;
|
|
196
|
+
/**
|
|
197
|
+
* The `sendAt` property of the EmailSubmission object must be before this date-time
|
|
198
|
+
* to match the condition.
|
|
199
|
+
*/
|
|
200
|
+
before: UTCDate;
|
|
201
|
+
/**
|
|
202
|
+
* The `sendAt` property of the EmailSubmission object must be the same as or after
|
|
203
|
+
* this date-time to match the condition.
|
|
204
|
+
*/
|
|
205
|
+
after: UTCDate;
|
|
206
|
+
}>;
|
|
207
|
+
/**
|
|
208
|
+
* The arguments to query EmailSubmission objects via an `EmailSubmission/query` call.
|
|
209
|
+
*/
|
|
210
|
+
export type EmailSubmissionQueryRequestInvocationArgs = BaseQueryRequestInvocationArgs<EmailSubmissionObject, EmailSubmissionFilterCondition>;
|
|
211
|
+
/**
|
|
212
|
+
* The response to an `EmailSubmission/query` call.
|
|
213
|
+
*/
|
|
214
|
+
export type EmailSubmissionQueryResponseInvocationArgs = BaseQueryResponseInvocationArgs;
|
|
215
|
+
/**
|
|
216
|
+
* The arguments to query changes to EmailSubmission objects via an
|
|
217
|
+
* `EmailSubmission/queryChanges` call.
|
|
218
|
+
*/
|
|
219
|
+
export type EmailSubmissionQueryChangesRequestInvocationArgs = BaseQueryChangesRequestInvocationArgs<EmailSubmissionObject, EmailSubmissionFilterCondition>;
|
|
220
|
+
/**
|
|
221
|
+
* The response to an `EmailSubmission/queryChanges` call.
|
|
222
|
+
*/
|
|
223
|
+
export type EmailSubmissionQueryChangesResponseInvocationArgs = BaseQueryChangesResponseInvocationArgs;
|
|
224
|
+
/**
|
|
225
|
+
* The arguments for creating, updating, and destroying EmailSubmission objects via an
|
|
226
|
+
* `EmailSubmission/set` call.
|
|
227
|
+
*
|
|
228
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc8621.html#section-7.5 | RFC 8621 Section 7.5: EmailSubmission/set}
|
|
229
|
+
*/
|
|
230
|
+
export type EmailSubmissionSetRequestInvocationArgs = BaseSetRequestInvocationArgs<EmailSubmissionObjectSettable> & {
|
|
231
|
+
/**
|
|
232
|
+
* A map of EmailSubmission id to an object containing properties to update on the Email
|
|
233
|
+
* object referenced by the EmailSubmission if the create/update/destroy succeeds. For
|
|
234
|
+
* references to EmailSubmissions created in the same `/set` invocation, the id will be
|
|
235
|
+
* the creation id prefixed with a `#`.
|
|
236
|
+
*/
|
|
237
|
+
onSuccessUpdateEmail?: Record<Id, PatchObject> | null;
|
|
238
|
+
/**
|
|
239
|
+
* A list of EmailSubmission ids for which the Email with the corresponding `emailId`
|
|
240
|
+
* should be destroyed if the create/update/destroy succeeds. For references to
|
|
241
|
+
* EmailSubmission creations, the id will be the creation id prefixed with a `#`.
|
|
242
|
+
*/
|
|
243
|
+
onSuccessDestroyEmail?: Id[] | null;
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* The response to an `EmailSubmission/set` call.
|
|
247
|
+
*/
|
|
248
|
+
export type EmailSubmissionSetResponseInvocationArgs = BaseSetResponseInvocationArgs<EmailSubmissionObject>;
|
|
249
|
+
/**
|
|
250
|
+
* Union type of all EmailSubmission capability request invocation arguments.
|
|
251
|
+
*/
|
|
252
|
+
export type EmailSubmissionRequestInvocationArgs = EmailSubmissionGetRequestInvocationArgs | EmailSubmissionChangesRequestInvocationArgs | EmailSubmissionQueryRequestInvocationArgs | EmailSubmissionQueryChangesRequestInvocationArgs | EmailSubmissionSetRequestInvocationArgs;
|
|
253
|
+
/**
|
|
254
|
+
* Union type of all EmailSubmission capability response invocation arguments.
|
|
255
|
+
*/
|
|
256
|
+
export type EmailSubmissionResponseInvocationArgs = EmailSubmissionGetResponseInvocationArgs | EmailSubmissionChangesResponseInvocationArgs | EmailSubmissionQueryResponseInvocationArgs | EmailSubmissionQueryChangesResponseInvocationArgs | EmailSubmissionSetResponseInvocationArgs;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/capabilities/emailsubmission/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { JMAPCapability, JMAPMethodName } from "../../common/types.js";
|
|
2
|
+
import { Invocation } from "../../invocation/invocation.js";
|
|
3
|
+
import type { InvocationArgs, InvocationFactory } from "../../invocation/types.js";
|
|
4
|
+
import type { ExampleGetRequestInvocationArgs, ExampleGetResponseInvocationArgs, ExampleInvocationArgs, ExampleQueryRequestInvocationArgs, ExampleSetRequestInvocationArgs, ExampleSetResponseInvocationArgs } from "./types.js";
|
|
5
|
+
/**
|
|
6
|
+
* ExampleInvocation represents an illustrative example JMAP capability invocation.
|
|
7
|
+
*
|
|
8
|
+
* This capability serves as a reference implementation demonstrating how to define custom
|
|
9
|
+
* invocations in this library. It implements standard JMAP method patterns (echo, get, set, query)
|
|
10
|
+
* and is used internally for testing the invocation framework, request building, and response handling.
|
|
11
|
+
*
|
|
12
|
+
* **Note:** This is not a real JMAP invocation - it exists purely for documentation and testing purposes.
|
|
13
|
+
*/
|
|
14
|
+
export declare class ExampleInvocation<TArgs extends ExampleInvocationArgs> extends Invocation<TArgs> {
|
|
15
|
+
get uri(): JMAPCapability;
|
|
16
|
+
/**
|
|
17
|
+
* Constructs an ExampleInvocation
|
|
18
|
+
*
|
|
19
|
+
* @param method The name of the method being invoked (e.g., "echo", "get", "set", "query")
|
|
20
|
+
* @param args The arguments for the method invocation
|
|
21
|
+
* @param methodCallId An optional unique symbol to identify this method call for result referencing
|
|
22
|
+
*/
|
|
23
|
+
constructor(method: JMAPMethodName, args: InvocationArgs<TArgs>, methodCallId?: symbol);
|
|
24
|
+
/**
|
|
25
|
+
* Create an invocation factory function
|
|
26
|
+
*
|
|
27
|
+
* @param method The name of the method to create
|
|
28
|
+
* @returns A new Example invocation factory function for creating invocations of the specified type
|
|
29
|
+
*/
|
|
30
|
+
static createInvocationFactory<TArgs extends ExampleInvocationArgs>(method: JMAPMethodName): InvocationFactory<TArgs, ExampleInvocation<TArgs>>;
|
|
31
|
+
}
|
|
32
|
+
export declare const Example: {
|
|
33
|
+
request: {
|
|
34
|
+
/**
|
|
35
|
+
* An example echo method that returns the same arguments it receives.
|
|
36
|
+
*
|
|
37
|
+
* This method demonstrates a simple request-only pattern used for testing.
|
|
38
|
+
*
|
|
39
|
+
* @param args The invocation arguments for Example/echo
|
|
40
|
+
* @param methodCallId An optional unique symbol to identify this method call for result referencing
|
|
41
|
+
* @returns An ExampleInvocation representing the Example/echo request
|
|
42
|
+
*/
|
|
43
|
+
echo: InvocationFactory<import("../../invocation/types.js").BaseInvocationArgs, ExampleInvocation<import("../../invocation/types.js").BaseInvocationArgs>>;
|
|
44
|
+
/**
|
|
45
|
+
* An example get method that retrieves Example objects by their IDs.
|
|
46
|
+
*
|
|
47
|
+
* This method demonstrates the standard JMAP /get pattern used for testing.
|
|
48
|
+
*
|
|
49
|
+
* @param args The invocation arguments for Example/get
|
|
50
|
+
* @param methodCallId An optional unique symbol to identify this method call for result referencing
|
|
51
|
+
* @returns An ExampleInvocation representing the Example/get request
|
|
52
|
+
*/
|
|
53
|
+
get: InvocationFactory<ExampleGetRequestInvocationArgs, ExampleInvocation<ExampleGetRequestInvocationArgs>>;
|
|
54
|
+
/**
|
|
55
|
+
* An example set method that creates, updates, or destroys Example objects.
|
|
56
|
+
*
|
|
57
|
+
* This method demonstrates the standard JMAP /set pattern used for testing.
|
|
58
|
+
*
|
|
59
|
+
* @param args The invocation arguments for Example/set
|
|
60
|
+
* @param methodCallId An optional unique symbol to identify this method call for result referencing
|
|
61
|
+
* @returns An ExampleInvocation representing the Example/set request
|
|
62
|
+
*/
|
|
63
|
+
set: InvocationFactory<ExampleSetRequestInvocationArgs, ExampleInvocation<ExampleSetRequestInvocationArgs>>;
|
|
64
|
+
/**
|
|
65
|
+
* An example query method that searches for Example objects matching criteria.
|
|
66
|
+
*
|
|
67
|
+
* This method demonstrates the standard JMAP /query pattern used for testing.
|
|
68
|
+
*
|
|
69
|
+
* @param args The invocation arguments for Example/query
|
|
70
|
+
* @param methodCallId An optional unique symbol to identify this method call for result referencing
|
|
71
|
+
* @returns An ExampleInvocation representing the Example/query request
|
|
72
|
+
*/
|
|
73
|
+
query: InvocationFactory<ExampleQueryRequestInvocationArgs, ExampleInvocation<ExampleQueryRequestInvocationArgs>>;
|
|
74
|
+
};
|
|
75
|
+
response: {
|
|
76
|
+
get: InvocationFactory<ExampleGetResponseInvocationArgs, ExampleInvocation<ExampleGetResponseInvocationArgs>>;
|
|
77
|
+
set: InvocationFactory<ExampleSetResponseInvocationArgs, ExampleInvocation<ExampleSetResponseInvocationArgs>>;
|
|
78
|
+
query: InvocationFactory<import("../../invocation/types.js").BaseQueryResponseInvocationArgs, ExampleInvocation<import("../../invocation/types.js").BaseQueryResponseInvocationArgs>>;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Invocation } from "../../invocation/invocation.js";
|
|
2
|
+
/**
|
|
3
|
+
* ExampleInvocation represents an illustrative example JMAP capability invocation.
|
|
4
|
+
*
|
|
5
|
+
* This capability serves as a reference implementation demonstrating how to define custom
|
|
6
|
+
* invocations in this library. It implements standard JMAP method patterns (echo, get, set, query)
|
|
7
|
+
* and is used internally for testing the invocation framework, request building, and response handling.
|
|
8
|
+
*
|
|
9
|
+
* **Note:** This is not a real JMAP invocation - it exists purely for documentation and testing purposes.
|
|
10
|
+
*/
|
|
11
|
+
export class ExampleInvocation extends Invocation {
|
|
12
|
+
get uri() {
|
|
13
|
+
return "urn:example";
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Constructs an ExampleInvocation
|
|
17
|
+
*
|
|
18
|
+
* @param method The name of the method being invoked (e.g., "echo", "get", "set", "query")
|
|
19
|
+
* @param args The arguments for the method invocation
|
|
20
|
+
* @param methodCallId An optional unique symbol to identify this method call for result referencing
|
|
21
|
+
*/
|
|
22
|
+
constructor(method, args, methodCallId) {
|
|
23
|
+
super("Example", method, args, methodCallId);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Create an invocation factory function
|
|
27
|
+
*
|
|
28
|
+
* @param method The name of the method to create
|
|
29
|
+
* @returns A new Example invocation factory function for creating invocations of the specified type
|
|
30
|
+
*/
|
|
31
|
+
static createInvocationFactory(method) {
|
|
32
|
+
/**
|
|
33
|
+
* An invocation factory function to create an `Example/*` invocation for the specified `method`
|
|
34
|
+
*
|
|
35
|
+
* @param args The invocation arguments for the specified `method`
|
|
36
|
+
* @param methodCallId An optional unique symbol to identify this method call for result referencing
|
|
37
|
+
* @returns An object representing the named arguments for the specified `method`
|
|
38
|
+
*/
|
|
39
|
+
return (args, methodCallId) => new ExampleInvocation(method, args, methodCallId);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export const Example = {
|
|
43
|
+
request: {
|
|
44
|
+
/**
|
|
45
|
+
* An example echo method that returns the same arguments it receives.
|
|
46
|
+
*
|
|
47
|
+
* This method demonstrates a simple request-only pattern used for testing.
|
|
48
|
+
*
|
|
49
|
+
* @param args The invocation arguments for Example/echo
|
|
50
|
+
* @param methodCallId An optional unique symbol to identify this method call for result referencing
|
|
51
|
+
* @returns An ExampleInvocation representing the Example/echo request
|
|
52
|
+
*/
|
|
53
|
+
echo: ExampleInvocation.createInvocationFactory("echo"),
|
|
54
|
+
/**
|
|
55
|
+
* An example get method that retrieves Example objects by their IDs.
|
|
56
|
+
*
|
|
57
|
+
* This method demonstrates the standard JMAP /get pattern used for testing.
|
|
58
|
+
*
|
|
59
|
+
* @param args The invocation arguments for Example/get
|
|
60
|
+
* @param methodCallId An optional unique symbol to identify this method call for result referencing
|
|
61
|
+
* @returns An ExampleInvocation representing the Example/get request
|
|
62
|
+
*/
|
|
63
|
+
get: ExampleInvocation.createInvocationFactory("get"),
|
|
64
|
+
/**
|
|
65
|
+
* An example set method that creates, updates, or destroys Example objects.
|
|
66
|
+
*
|
|
67
|
+
* This method demonstrates the standard JMAP /set pattern used for testing.
|
|
68
|
+
*
|
|
69
|
+
* @param args The invocation arguments for Example/set
|
|
70
|
+
* @param methodCallId An optional unique symbol to identify this method call for result referencing
|
|
71
|
+
* @returns An ExampleInvocation representing the Example/set request
|
|
72
|
+
*/
|
|
73
|
+
set: ExampleInvocation.createInvocationFactory("set"),
|
|
74
|
+
/**
|
|
75
|
+
* An example query method that searches for Example objects matching criteria.
|
|
76
|
+
*
|
|
77
|
+
* This method demonstrates the standard JMAP /query pattern used for testing.
|
|
78
|
+
*
|
|
79
|
+
* @param args The invocation arguments for Example/query
|
|
80
|
+
* @param methodCallId An optional unique symbol to identify this method call for result referencing
|
|
81
|
+
* @returns An ExampleInvocation representing the Example/query request
|
|
82
|
+
*/
|
|
83
|
+
query: ExampleInvocation.createInvocationFactory("query"),
|
|
84
|
+
},
|
|
85
|
+
response: {
|
|
86
|
+
get: ExampleInvocation.createInvocationFactory("get"),
|
|
87
|
+
set: ExampleInvocation.createInvocationFactory("set"),
|
|
88
|
+
query: ExampleInvocation.createInvocationFactory("query"),
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
//# sourceMappingURL=example.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example.js","sourceRoot":"","sources":["../../../../src/capabilities/example/example.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAa5D;;;;;;;;GAQG;AACH,MAAM,OAAO,iBAAuD,SAAQ,UAAiB;IACzF,IAAI,GAAG;QACH,OAAO,aAAa,CAAC;IACzB,CAAC;IAED;;;;;;OAMG;IACH,YAAY,MAAsB,EAAE,IAA2B,EAAE,YAAqB;QAClF,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;IACjD,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,uBAAuB,CAC1B,MAAsB;QAEtB;;;;;;WAMG;QACH,OAAO,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,CAAC,IAAI,iBAAiB,CAAQ,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;IAC5F,CAAC;CACJ;AAED,MAAM,CAAC,MAAM,OAAO,GAAG;IACnB,OAAO,EAAE;QACL;;;;;;;;WAQG;QACH,IAAI,EAAE,iBAAiB,CAAC,uBAAuB,CAAmC,MAAM,CAAC;QACzF;;;;;;;;WAQG;QACH,GAAG,EAAE,iBAAiB,CAAC,uBAAuB,CAAkC,KAAK,CAAC;QACtF;;;;;;;;WAQG;QACH,GAAG,EAAE,iBAAiB,CAAC,uBAAuB,CAAkC,KAAK,CAAC;QACtF;;;;;;;;WAQG;QACH,KAAK,EAAE,iBAAiB,CAAC,uBAAuB,CAAoC,OAAO,CAAC;KAC/F;IACD,QAAQ,EAAE;QACN,GAAG,EAAE,iBAAiB,CAAC,uBAAuB,CAAmC,KAAK,CAAC;QACvF,GAAG,EAAE,iBAAiB,CAAC,uBAAuB,CAAmC,KAAK,CAAC;QACvF,KAAK,EAAE,iBAAiB,CAAC,uBAAuB,CAAqC,OAAO,CAAC;KAChG;CACkC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { BaseFilterCondition, BaseGetRequestInvocationArgs, BaseGetResponseInvocationArgs, BaseInvocationArgs, BaseQueryRequestInvocationArgs, BaseQueryResponseInvocationArgs, BaseSetRequestInvocationArgs, BaseSetResponseInvocationArgs } from "../../invocation/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The arguments for an Example/echo request invocation (illustrative example)
|
|
4
|
+
*/
|
|
5
|
+
export type ExampleEchoRequestInvocationArgs = BaseInvocationArgs;
|
|
6
|
+
/**
|
|
7
|
+
* The arguments for an Example/get request invocation (illustrative example)
|
|
8
|
+
*/
|
|
9
|
+
export type ExampleGetRequestInvocationArgs = BaseGetRequestInvocationArgs<BaseInvocationArgs>;
|
|
10
|
+
/**
|
|
11
|
+
* The arguments for an Example/set request invocation (illustrative example)
|
|
12
|
+
*/
|
|
13
|
+
export type ExampleSetRequestInvocationArgs = BaseSetRequestInvocationArgs<BaseInvocationArgs>;
|
|
14
|
+
/**
|
|
15
|
+
* The arguments for an Example/query request invocation (illustrative example)
|
|
16
|
+
*/
|
|
17
|
+
export type ExampleQueryRequestInvocationArgs = BaseQueryRequestInvocationArgs<BaseInvocationArgs, BaseFilterCondition>;
|
|
18
|
+
/**
|
|
19
|
+
* The response arguments for an Example/get response invocation (illustrative example)
|
|
20
|
+
*/
|
|
21
|
+
export type ExampleGetResponseInvocationArgs = BaseGetResponseInvocationArgs<BaseInvocationArgs>;
|
|
22
|
+
/**
|
|
23
|
+
* The response arguments for an Example/set response invocation (illustrative example)
|
|
24
|
+
*/
|
|
25
|
+
export type ExampleSetResponseInvocationArgs = BaseSetResponseInvocationArgs<BaseInvocationArgs>;
|
|
26
|
+
/**
|
|
27
|
+
* The response arguments for an Example/query response invocation (illustrative example)
|
|
28
|
+
*/
|
|
29
|
+
export type ExampleQueryResponseInvocationArgs = BaseQueryResponseInvocationArgs;
|
|
30
|
+
/**
|
|
31
|
+
* Union type of all Example capability invocation arguments (request and response, illustrative example)
|
|
32
|
+
*/
|
|
33
|
+
export type ExampleInvocationArgs = ExampleEchoRequestInvocationArgs | ExampleGetRequestInvocationArgs | ExampleSetRequestInvocationArgs | ExampleQueryRequestInvocationArgs | ExampleGetResponseInvocationArgs | ExampleSetResponseInvocationArgs | ExampleQueryResponseInvocationArgs;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/capabilities/example/types.ts"],"names":[],"mappings":""}
|