@dxos/plugin-jmap 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/LICENSE +105 -0
  2. package/dist/lib/JmapPlugin.mjs +16 -0
  3. package/dist/lib/JmapPlugin.mjs.map +1 -0
  4. package/dist/lib/apis.mjs +2 -0
  5. package/dist/lib/capabilities.mjs +17 -0
  6. package/dist/lib/capabilities.mjs.map +1 -0
  7. package/dist/lib/chunk-apis.mjs +756 -0
  8. package/dist/lib/chunk-apis.mjs.map +1 -0
  9. package/dist/lib/chunk-connector.mjs +111 -0
  10. package/dist/lib/chunk-connector.mjs.map +1 -0
  11. package/dist/lib/chunk-constants.mjs +23 -0
  12. package/dist/lib/chunk-constants.mjs.map +1 -0
  13. package/dist/lib/chunk-errors.mjs +42 -0
  14. package/dist/lib/chunk-errors.mjs.map +1 -0
  15. package/dist/lib/chunk-handler.mjs +27 -0
  16. package/dist/lib/chunk-handler.mjs.map +1 -0
  17. package/dist/lib/chunk-jmap-fixtures.mjs +102 -0
  18. package/dist/lib/chunk-jmap-fixtures.mjs.map +1 -0
  19. package/dist/lib/chunk-mail-send.mjs +17 -0
  20. package/dist/lib/chunk-mail-send.mjs.map +1 -0
  21. package/dist/lib/chunk-meta.mjs +37 -0
  22. package/dist/lib/chunk-meta.mjs.map +1 -0
  23. package/dist/lib/chunk-operation-handler.mjs +12 -0
  24. package/dist/lib/chunk-operation-handler.mjs.map +1 -0
  25. package/dist/lib/chunk-send.mjs +98 -0
  26. package/dist/lib/chunk-send.mjs.map +1 -0
  27. package/dist/lib/chunk-sync-provider.mjs +511 -0
  28. package/dist/lib/chunk-sync-provider.mjs.map +1 -0
  29. package/dist/lib/chunk-sync.mjs +37 -0
  30. package/dist/lib/chunk-sync.mjs.map +1 -0
  31. package/dist/lib/index.mjs +4 -0
  32. package/dist/lib/meta.mjs +2 -0
  33. package/dist/lib/operations.mjs +13 -0
  34. package/dist/lib/operations.mjs.map +1 -0
  35. package/dist/lib/plugin.mjs +9 -0
  36. package/dist/lib/plugin.mjs.map +1 -0
  37. package/dist/lib/services.mjs +139 -0
  38. package/dist/lib/services.mjs.map +1 -0
  39. package/dist/lib/testing/node.mjs +2 -0
  40. package/dist/lib/testing.mjs +19 -0
  41. package/dist/lib/testing.mjs.map +1 -0
  42. package/dist/lib/translations.mjs +7 -0
  43. package/dist/lib/translations.mjs.map +1 -0
  44. package/dist/types/dx.config.d.ts +28 -0
  45. package/dist/types/dx.config.d.ts.map +1 -0
  46. package/dist/types/src/JmapPlugin.d.ts +9 -0
  47. package/dist/types/src/JmapPlugin.d.ts.map +1 -0
  48. package/dist/types/src/apis/Jmap/api.d.ts +42 -0
  49. package/dist/types/src/apis/Jmap/api.d.ts.map +1 -0
  50. package/dist/types/src/apis/Jmap/index.d.ts +3 -0
  51. package/dist/types/src/apis/Jmap/index.d.ts.map +1 -0
  52. package/dist/types/src/apis/Jmap/types.d.ts +65 -0
  53. package/dist/types/src/apis/Jmap/types.d.ts.map +1 -0
  54. package/dist/types/src/apis/JmapMail/api.d.ts +223 -0
  55. package/dist/types/src/apis/JmapMail/api.d.ts.map +1 -0
  56. package/dist/types/src/apis/JmapMail/index.d.ts +4 -0
  57. package/dist/types/src/apis/JmapMail/index.d.ts.map +1 -0
  58. package/dist/types/src/apis/JmapMail/query.d.ts +26 -0
  59. package/dist/types/src/apis/JmapMail/query.d.ts.map +1 -0
  60. package/dist/types/src/apis/JmapMail/query.test.d.ts +2 -0
  61. package/dist/types/src/apis/JmapMail/query.test.d.ts.map +1 -0
  62. package/dist/types/src/apis/JmapMail/types.d.ts +290 -0
  63. package/dist/types/src/apis/JmapMail/types.d.ts.map +1 -0
  64. package/dist/types/src/apis/index.d.ts +3 -0
  65. package/dist/types/src/apis/index.d.ts.map +1 -0
  66. package/dist/types/src/apis/jmap-api.test.d.ts +2 -0
  67. package/dist/types/src/apis/jmap-api.test.d.ts.map +1 -0
  68. package/dist/types/src/capabilities/connector.d.ts +5 -0
  69. package/dist/types/src/capabilities/connector.d.ts.map +1 -0
  70. package/dist/types/src/capabilities/credential-form.d.ts +37 -0
  71. package/dist/types/src/capabilities/credential-form.d.ts.map +1 -0
  72. package/dist/types/src/capabilities/credential-form.test.d.ts +2 -0
  73. package/dist/types/src/capabilities/credential-form.test.d.ts.map +1 -0
  74. package/dist/types/src/capabilities/index.d.ts +5 -0
  75. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  76. package/dist/types/src/capabilities/mail-send.d.ts +6 -0
  77. package/dist/types/src/capabilities/mail-send.d.ts.map +1 -0
  78. package/dist/types/src/capabilities/operation-handler.d.ts +5 -0
  79. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  80. package/dist/types/src/constants.d.ts +19 -0
  81. package/dist/types/src/constants.d.ts.map +1 -0
  82. package/dist/types/src/errors.d.ts +103 -0
  83. package/dist/types/src/errors.d.ts.map +1 -0
  84. package/dist/types/src/index.d.ts +4 -0
  85. package/dist/types/src/index.d.ts.map +1 -0
  86. package/dist/types/src/meta.d.ts +33 -0
  87. package/dist/types/src/meta.d.ts.map +1 -0
  88. package/dist/types/src/operations/index.d.ts +3 -0
  89. package/dist/types/src/operations/index.d.ts.map +1 -0
  90. package/dist/types/src/operations/mail/mapper.d.ts +49 -0
  91. package/dist/types/src/operations/mail/mapper.d.ts.map +1 -0
  92. package/dist/types/src/operations/mail/materialize/handler.d.ts +11 -0
  93. package/dist/types/src/operations/mail/materialize/handler.d.ts.map +1 -0
  94. package/dist/types/src/operations/mail/send/handler.d.ts +4 -0
  95. package/dist/types/src/operations/mail/send/handler.d.ts.map +1 -0
  96. package/dist/types/src/operations/mail/send/index.d.ts +2 -0
  97. package/dist/types/src/operations/mail/send/index.d.ts.map +1 -0
  98. package/dist/types/src/operations/mail/sync/handler.d.ts +4 -0
  99. package/dist/types/src/operations/mail/sync/handler.d.ts.map +1 -0
  100. package/dist/types/src/operations/mail/sync/index.d.ts +3 -0
  101. package/dist/types/src/operations/mail/sync/index.d.ts.map +1 -0
  102. package/dist/types/src/operations/mail/sync/mapper.test.d.ts +2 -0
  103. package/dist/types/src/operations/mail/sync/mapper.test.d.ts.map +1 -0
  104. package/dist/types/src/operations/mail/sync/sync-e2e.test.d.ts +2 -0
  105. package/dist/types/src/operations/mail/sync/sync-e2e.test.d.ts.map +1 -0
  106. package/dist/types/src/operations/mail/sync/sync-provider.d.ts +11 -0
  107. package/dist/types/src/operations/mail/sync/sync-provider.d.ts.map +1 -0
  108. package/dist/types/src/operations/mail/sync/sync.test.d.ts +2 -0
  109. package/dist/types/src/operations/mail/sync/sync.test.d.ts.map +1 -0
  110. package/dist/types/src/operations/mail/sync/system-tags.d.ts +14 -0
  111. package/dist/types/src/operations/mail/sync/system-tags.d.ts.map +1 -0
  112. package/dist/types/src/operations/mail/tags.d.ts +12 -0
  113. package/dist/types/src/operations/mail/tags.d.ts.map +1 -0
  114. package/dist/types/src/plugin.d.ts +4 -0
  115. package/dist/types/src/plugin.d.ts.map +1 -0
  116. package/dist/types/src/services/index.d.ts +3 -0
  117. package/dist/types/src/services/index.d.ts.map +1 -0
  118. package/dist/types/src/services/jmap-credentials.d.ts +39 -0
  119. package/dist/types/src/services/jmap-credentials.d.ts.map +1 -0
  120. package/dist/types/src/services/jmap-mail-api.d.ts +109 -0
  121. package/dist/types/src/services/jmap-mail-api.d.ts.map +1 -0
  122. package/dist/types/src/testing/index.d.ts +5 -0
  123. package/dist/types/src/testing/index.d.ts.map +1 -0
  124. package/dist/types/src/testing/jmap-fixtures.d.ts +26 -0
  125. package/dist/types/src/testing/jmap-fixtures.d.ts.map +1 -0
  126. package/dist/types/src/testing/jmap-fixtures.test.d.ts +2 -0
  127. package/dist/types/src/testing/jmap-fixtures.test.d.ts.map +1 -0
  128. package/dist/types/src/testing/node.d.ts +4 -0
  129. package/dist/types/src/testing/node.d.ts.map +1 -0
  130. package/dist/types/src/testing/sync-fixture.d.ts +22 -0
  131. package/dist/types/src/testing/sync-fixture.d.ts.map +1 -0
  132. package/dist/types/src/translations.d.ts +8 -0
  133. package/dist/types/src/translations.d.ts.map +1 -0
  134. package/dist/types/tsconfig.tsbuildinfo +1 -0
  135. package/dx.config.ts +32 -0
  136. package/package.json +121 -0
  137. package/src/JmapPlugin.ts +25 -0
  138. package/src/apis/Jmap/api.ts +138 -0
  139. package/src/apis/Jmap/index.ts +6 -0
  140. package/src/apis/Jmap/types.ts +86 -0
  141. package/src/apis/JmapMail/api.ts +324 -0
  142. package/src/apis/JmapMail/index.ts +7 -0
  143. package/src/apis/JmapMail/query.test.ts +181 -0
  144. package/src/apis/JmapMail/query.ts +231 -0
  145. package/src/apis/JmapMail/types.ts +196 -0
  146. package/src/apis/index.ts +8 -0
  147. package/src/apis/jmap-api.test.ts +261 -0
  148. package/src/capabilities/connector.ts +44 -0
  149. package/src/capabilities/credential-form.test.ts +69 -0
  150. package/src/capabilities/credential-form.ts +113 -0
  151. package/src/capabilities/index.ts +24 -0
  152. package/src/capabilities/mail-send.ts +21 -0
  153. package/src/capabilities/operation-handler.ts +16 -0
  154. package/src/constants.ts +24 -0
  155. package/src/errors.ts +38 -0
  156. package/src/index.ts +7 -0
  157. package/src/meta.ts +9 -0
  158. package/src/operations/index.ts +13 -0
  159. package/src/operations/mail/mapper.ts +191 -0
  160. package/src/operations/mail/materialize/handler.ts +41 -0
  161. package/src/operations/mail/send/handler.ts +116 -0
  162. package/src/operations/mail/send/index.ts +5 -0
  163. package/src/operations/mail/sync/handler.ts +52 -0
  164. package/src/operations/mail/sync/index.ts +7 -0
  165. package/src/operations/mail/sync/mapper.test.ts +150 -0
  166. package/src/operations/mail/sync/sync-e2e.test.ts +63 -0
  167. package/src/operations/mail/sync/sync-provider.ts +481 -0
  168. package/src/operations/mail/sync/sync.test.ts +766 -0
  169. package/src/operations/mail/sync/system-tags.ts +24 -0
  170. package/src/operations/mail/tags.ts +29 -0
  171. package/src/plugin.ts +11 -0
  172. package/src/services/index.ts +6 -0
  173. package/src/services/jmap-credentials.ts +61 -0
  174. package/src/services/jmap-mail-api.ts +294 -0
  175. package/src/testing/index.ts +8 -0
  176. package/src/testing/jmap-fixtures.test.ts +107 -0
  177. package/src/testing/jmap-fixtures.ts +105 -0
  178. package/src/testing/node.ts +12 -0
  179. package/src/testing/sync-fixture.ts +39 -0
  180. package/src/translations.ts +15 -0
@@ -0,0 +1,223 @@
1
+ import * as HttpClient from '@effect/platform/HttpClient';
2
+ import * as Effect from 'effect/Effect';
3
+ import { JmapApiError } from '../../errors';
4
+ import { JmapCredentials } from '../../services/jmap-credentials';
5
+ import { type EmailAddress } from './types';
6
+ /**
7
+ * Resolved per-request context: the session `apiUrl`, the mail account id, and (optionally) the
8
+ * session's blob `downloadUrl` template (RFC 8620 §6.2). Most operations (mailboxGet, emailQuery,
9
+ * send, delete, …) don't need it and construct a `Target` without it; only the attachment-fetching
10
+ * path populates it from `Jmap.Session.downloadUrl`, so {@link downloadBlob} is the sole consumer
11
+ * that requires it — absent here just means "this call site never populated it", not "the server
12
+ * didn't advertise one" (every real session does).
13
+ */
14
+ export type Target = {
15
+ readonly apiUrl: string;
16
+ readonly accountId: string;
17
+ readonly downloadUrl?: string;
18
+ };
19
+ /**
20
+ * Downloads a blob's raw bytes via the session's `downloadUrl` template. `name`/`type` are advisory
21
+ * (they only affect the response's `Content-Disposition`/`Accept`), not required for correctness.
22
+ */
23
+ export declare const downloadBlob: (target: Target, blobId: string, options?: {
24
+ name?: string;
25
+ type?: string;
26
+ } | undefined) => Effect.Effect<Uint8Array<ArrayBuffer>, JmapApiError, HttpClient.HttpClient | JmapCredentials>;
27
+ /** Email properties fetched by {@link emailGet} — enough for the mapper to build a Message. */
28
+ export declare const EMAIL_PROPERTIES: readonly ['id', 'blobId', 'threadId', 'mailboxIds', 'keywords', 'from', 'to', 'cc', 'subject', 'receivedAt', 'sentAt', 'preview', 'messageId', 'inReplyTo', 'references', 'bodyValues', 'textBody', 'htmlBody', 'attachments'];
29
+ /** Lists all folders (mailboxes) in the account (RFC 8621 §2.3). */
30
+ export declare const mailboxGet: (target: Target) => Effect.Effect<{
31
+ readonly accountId?: string | undefined;
32
+ readonly state?: string | undefined;
33
+ readonly list: readonly {
34
+ readonly id: string;
35
+ readonly name: string;
36
+ readonly role?: string | null | undefined;
37
+ readonly parentId?: string | null | undefined;
38
+ readonly sortOrder?: number | undefined;
39
+ readonly totalEmails?: number | undefined;
40
+ readonly unreadEmails?: number | undefined;
41
+ }[];
42
+ readonly notFound?: readonly string[] | null | undefined;
43
+ }, JmapApiError, HttpClient.HttpClient | JmapCredentials>;
44
+ /** Queries email ids matching a filter (RFC 8621 §4.4). */
45
+ export declare const emailQuery: (target: Target, options?: {
46
+ filter?: unknown;
47
+ sort?: readonly {
48
+ property: string;
49
+ isAscending?: boolean;
50
+ }[];
51
+ position?: number;
52
+ limit?: number;
53
+ calculateTotal?: boolean;
54
+ } | undefined) => Effect.Effect<{
55
+ readonly accountId?: string | undefined;
56
+ readonly queryState?: string | undefined;
57
+ readonly position?: number | undefined;
58
+ readonly total?: number | undefined;
59
+ readonly limit?: number | undefined;
60
+ readonly ids: readonly string[];
61
+ }, JmapApiError, HttpClient.HttpClient | JmapCredentials>;
62
+ /** Fetches emails by id with decoded HTML and text body values (RFC 8621 §4.2). */
63
+ export declare const emailGet: (target: Target, ids: readonly string[], properties?: readonly string[] | undefined) => Effect.Effect<{
64
+ readonly accountId?: string | undefined;
65
+ readonly state?: string | undefined;
66
+ readonly list: readonly {
67
+ readonly id: string;
68
+ readonly blobId?: string | undefined;
69
+ readonly threadId: string;
70
+ readonly mailboxIds?: {
71
+ readonly [x: string]: boolean;
72
+ } | undefined;
73
+ readonly keywords?: {
74
+ readonly [x: string]: boolean;
75
+ } | undefined;
76
+ readonly from?: readonly {
77
+ readonly name?: string | null | undefined;
78
+ readonly email: string;
79
+ }[] | null | undefined;
80
+ readonly to?: readonly {
81
+ readonly name?: string | null | undefined;
82
+ readonly email: string;
83
+ }[] | null | undefined;
84
+ readonly cc?: readonly {
85
+ readonly name?: string | null | undefined;
86
+ readonly email: string;
87
+ }[] | null | undefined;
88
+ readonly bcc?: readonly {
89
+ readonly name?: string | null | undefined;
90
+ readonly email: string;
91
+ }[] | null | undefined;
92
+ readonly subject?: string | null | undefined;
93
+ readonly receivedAt: string;
94
+ readonly sentAt?: string | null | undefined;
95
+ readonly preview?: string | null | undefined;
96
+ readonly messageId?: readonly string[] | null | undefined;
97
+ readonly inReplyTo?: readonly string[] | null | undefined;
98
+ readonly references?: readonly string[] | null | undefined;
99
+ readonly bodyValues?: {
100
+ readonly [x: string]: {
101
+ readonly value: string;
102
+ readonly isEncodingProblem?: boolean | undefined;
103
+ readonly isTruncated?: boolean | undefined;
104
+ };
105
+ } | undefined;
106
+ readonly textBody?: readonly {
107
+ readonly partId?: string | null | undefined;
108
+ readonly blobId?: string | null | undefined;
109
+ readonly size?: number | undefined;
110
+ readonly type?: string | undefined;
111
+ readonly charset?: string | null | undefined;
112
+ readonly name?: string | null | undefined;
113
+ readonly disposition?: string | null | undefined;
114
+ readonly cid?: string | null | undefined;
115
+ }[] | undefined;
116
+ readonly htmlBody?: readonly {
117
+ readonly partId?: string | null | undefined;
118
+ readonly blobId?: string | null | undefined;
119
+ readonly size?: number | undefined;
120
+ readonly type?: string | undefined;
121
+ readonly charset?: string | null | undefined;
122
+ readonly name?: string | null | undefined;
123
+ readonly disposition?: string | null | undefined;
124
+ readonly cid?: string | null | undefined;
125
+ }[] | undefined;
126
+ readonly attachments?: readonly {
127
+ readonly partId?: string | null | undefined;
128
+ readonly blobId?: string | null | undefined;
129
+ readonly size?: number | undefined;
130
+ readonly type?: string | undefined;
131
+ readonly charset?: string | null | undefined;
132
+ readonly name?: string | null | undefined;
133
+ readonly disposition?: string | null | undefined;
134
+ readonly cid?: string | null | undefined;
135
+ }[] | undefined;
136
+ }[];
137
+ readonly notFound?: readonly string[] | null | undefined;
138
+ }, JmapApiError, HttpClient.HttpClient | JmapCredentials>;
139
+ /**
140
+ * Fetches the delta of email changes since an opaque `sinceState` token (RFC 8621 §4.3). A server that
141
+ * can't compute the delta (state too old / evicted) returns a `cannotCalculateChanges` method error,
142
+ * surfaced as a {@link JmapApiError} with that `type` — the caller's cue to fall back to a full scan.
143
+ * The token to pass comes from a prior `Email/get` `state` (NOT `Email/query` `queryState`).
144
+ */
145
+ export declare const emailChanges: (target: Target, sinceState: string, maxChanges?: number | undefined) => Effect.Effect<{
146
+ readonly accountId?: string | undefined;
147
+ readonly oldState: string;
148
+ readonly newState: string;
149
+ readonly hasMoreChanges: boolean;
150
+ readonly created: readonly string[];
151
+ readonly updated: readonly string[];
152
+ readonly destroyed: readonly string[];
153
+ }, JmapApiError, HttpClient.HttpClient | JmapCredentials>;
154
+ /** Lists the account's sending identities (RFC 8621 §6.2). */
155
+ export declare const identityGet: (target: Target) => Effect.Effect<{
156
+ readonly accountId?: string | undefined;
157
+ readonly state?: string | undefined;
158
+ readonly list: readonly {
159
+ readonly id: string;
160
+ readonly name?: string | null | undefined;
161
+ readonly email: string;
162
+ }[];
163
+ readonly notFound?: readonly string[] | null | undefined;
164
+ }, JmapApiError, HttpClient.HttpClient | JmapCredentials>;
165
+ /** Patches a single email (e.g. replace `mailboxIds` to move to Trash). Idempotent, so retryable. */
166
+ export declare const emailSetUpdate: (target: Target, emailId: string, patch: Record<string, unknown>) => Effect.Effect<{
167
+ readonly accountId?: string | undefined;
168
+ readonly oldState?: string | null | undefined;
169
+ readonly newState?: string | undefined;
170
+ readonly created?: {
171
+ readonly [x: string]: {
172
+ readonly id: string;
173
+ readonly blobId?: string | undefined;
174
+ readonly threadId?: string | undefined;
175
+ readonly size?: number | undefined;
176
+ };
177
+ } | null | undefined;
178
+ readonly updated?: {
179
+ readonly [x: string]: unknown;
180
+ } | null | undefined;
181
+ readonly destroyed?: readonly string[] | null | undefined;
182
+ readonly notCreated?: {
183
+ readonly [x: string]: {
184
+ readonly type: string;
185
+ readonly description?: string | null | undefined;
186
+ };
187
+ } | null | undefined;
188
+ readonly notUpdated?: {
189
+ readonly [x: string]: {
190
+ readonly type: string;
191
+ readonly description?: string | null | undefined;
192
+ };
193
+ } | null | undefined;
194
+ readonly notDestroyed?: {
195
+ readonly [x: string]: {
196
+ readonly type: string;
197
+ readonly description?: string | null | undefined;
198
+ };
199
+ } | null | undefined;
200
+ }, JmapApiError, HttpClient.HttpClient | JmapCredentials>;
201
+ /**
202
+ * Creates a draft and submits it for delivery in a single batched request. Not retried (a retry
203
+ * could double-send). Returns the created email's id and thread id.
204
+ */
205
+ export declare const submitEmail: (target: Target, args: {
206
+ identityId: string;
207
+ draftsMailboxId: string;
208
+ sentMailboxId: string;
209
+ draft: {
210
+ from: readonly EmailAddress[];
211
+ to: readonly EmailAddress[];
212
+ cc?: readonly EmailAddress[];
213
+ bcc?: readonly EmailAddress[];
214
+ subject?: string;
215
+ inReplyTo?: readonly string[];
216
+ references?: readonly string[];
217
+ text: string;
218
+ };
219
+ }) => Effect.Effect<{
220
+ id: string;
221
+ threadId: string | undefined;
222
+ }, JmapApiError, HttpClient.HttpClient | JmapCredentials>;
223
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../../src/apis/JmapMail/api.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,UAAU,MAAM,6BAA6B,CAAC;AAE1D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAUlE,OAAO,EACL,KAAK,YAAY,EAQlB,MAAM,SAAS,CAAC;AAEjB;;;;;;;GAOG;AACH,MAAM,MAAM,MAAM,GAAG;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAWF;;;GAGG;AACH,eAAO,MAAM,YAAY;WAGL,MAAM;WAAS,MAAM;+GA2BvC,CAAC;AAQH,+FAA+F;AAC/F,eAAO,MAAM,gBAAgB,YAC3B,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,UAAU,EACV,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,WAAW,EACX,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,CACL,CAAC;AAEX,oEAAoE;AACpE,eAAO,MAAM,UAAU;;;;;;;;;;;;;yDAMrB,CAAC;AAEH,2DAA2D;AAC3D,eAAO,MAAM,UAAU;aAGV,OAAO;WACT,SAAS;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE;eAClD,MAAM;YACT,MAAM;qBACG,OAAO;;;;;;;;yDAyB1B,CAAC;AAEH,mFAAmF;AACnF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yDAgBnB,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,YAAY;;;;;;;;yDAcvB,CAAC;AAEH,8DAA8D;AAC9D,eAAO,MAAM,WAAW;;;;;;;;;yDAMtB,CAAC;AAEH,qGAAqG;AACrG,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yDAezB,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,WAAW;gBAGR,MAAM;qBACD,MAAM;mBACR,MAAM;WACd;QACL,IAAI,EAAE,SAAS,YAAY,EAAE,CAAC;QAC9B,EAAE,EAAE,SAAS,YAAY,EAAE,CAAC;QAC5B,EAAE,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;QAC7B,GAAG,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;QAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QAC9B,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QAC/B,IAAI,EAAE,MAAM,CAAC;KACd;;;;yDAwEH,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './api';
2
+ export * from './types';
3
+ export * from './query';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/apis/JmapMail/index.ts"],"names":[],"mappings":"AAIA,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,26 @@
1
+ import * as Option from 'effect/Option';
2
+ import { type Filter } from '../Jmap';
3
+ import { type Mailbox } from './types';
4
+ /** Context for {@link parseMailQuery}: a clock (for relative dates) and a label/folder resolver. */
5
+ export type ParseContext = {
6
+ readonly now: Date;
7
+ /** Resolves a `label:`/`in:` name or system role to a JMAP mailbox id. */
8
+ readonly resolveMailbox: (nameOrRole: string) => Option.Option<string>;
9
+ };
10
+ /**
11
+ * Translates a Gmail-like query string into a JMAP `Email/query` filter (RFC 8621 §4.4.1).
12
+ *
13
+ * Supported operators: `from:`/`to:`/`cc:`/`bcc:`/`subject:`/`body:`, `label:`/`in:` (resolved to a
14
+ * mailbox id), `is:unread|read|starred|flagged|unstarred|draft|answered`, `has:attachment`,
15
+ * `after:`/`before:` (`YYYY/MM/DD` or `YYYY-MM-DD`), `newer_than:`/`older_than:` (e.g. `7d`, `2w`,
16
+ * `3m`, `1y`), `larger:`/`smaller:` (e.g. `10M`, `500k`), `list:`/`deliveredto:` (header match),
17
+ * quoted phrases, `-` negation, `OR` groups, and bare words (full-text). Space-separated terms are
18
+ * AND-ed. Returns `None` for an empty query, or one whose terms all fail to resolve (e.g. an unknown
19
+ * label).
20
+ */
21
+ export declare const parseMailQuery: (query: string, ctx: ParseContext) => Option.Option<Filter>;
22
+ /** Resolves a label/folder name (case-insensitive) or a system role/alias to a mailbox id. */
23
+ export declare const resolveMailboxByNameOrRole: (folders: readonly Mailbox[], nameOrRole: string) => Option.Option<string>;
24
+ /** Whether a filter restricts the mailbox scope (`inMailbox`/`inMailboxOtherThan`), recursively. */
25
+ export declare const filterScopesMailbox: (filter: Filter) => boolean;
26
+ //# sourceMappingURL=query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../../../src/apis/JmapMail/query.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,KAAK,MAAM,EAA6C,MAAM,SAAS,CAAC;AACjF,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,oGAAoG;AACpG,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;IACnB,0EAA0E;IAC1E,QAAQ,CAAC,cAAc,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;CACxE,CAAC;AAMF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,UAAW,MAAM,OAAO,YAAY,KAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CACnD,CAAC;AAEpC,8FAA8F;AAC9F,eAAO,MAAM,0BAA0B,YAAa,SAAS,OAAO,EAAE,cAAc,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAMhH,CAAC;AAwEF,oGAAoG;AACpG,eAAO,MAAM,mBAAmB,WAAY,MAAM,KAAG,OAG0B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=query.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.test.d.ts","sourceRoot":"","sources":["../../../../../src/apis/JmapMail/query.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,290 @@
1
+ import * as Schema from 'effect/Schema';
2
+ /** Structured email address — JMAP gives `{ name, email }` directly (no header parsing). */
3
+ export declare const EmailAddress: Schema.Struct<{
4
+ name: Schema.optional<Schema.NullOr<typeof Schema.String>>;
5
+ email: typeof Schema.String;
6
+ }>;
7
+ export type EmailAddress = Schema.Schema.Type<typeof EmailAddress>;
8
+ /** A folder. `role` is a well-known role (`inbox`, `drafts`, `sent`, `trash`, …) or null for custom folders. */
9
+ export declare const Mailbox: Schema.Struct<{
10
+ id: typeof Schema.String;
11
+ name: typeof Schema.String;
12
+ role: Schema.optional<Schema.NullOr<typeof Schema.String>>;
13
+ parentId: Schema.optional<Schema.NullOr<typeof Schema.String>>;
14
+ sortOrder: Schema.optional<typeof Schema.Number>;
15
+ totalEmails: Schema.optional<typeof Schema.Number>;
16
+ unreadEmails: Schema.optional<typeof Schema.Number>;
17
+ }>;
18
+ export type Mailbox = Schema.Schema.Type<typeof Mailbox>;
19
+ /** A decoded body part value (when fetched with `fetchTextBodyValues`). */
20
+ export declare const BodyValue: Schema.Struct<{
21
+ value: typeof Schema.String;
22
+ isEncodingProblem: Schema.optional<typeof Schema.Boolean>;
23
+ isTruncated: Schema.optional<typeof Schema.Boolean>;
24
+ }>;
25
+ export type BodyValue = Schema.Schema.Type<typeof BodyValue>;
26
+ /** A body part reference (the `partId` keys into `Email.bodyValues`; `blobId` fetches raw bytes). */
27
+ export declare const EmailBodyPart: Schema.Struct<{
28
+ partId: Schema.optional<Schema.NullOr<typeof Schema.String>>;
29
+ blobId: Schema.optional<Schema.NullOr<typeof Schema.String>>;
30
+ size: Schema.optional<typeof Schema.Number>;
31
+ type: Schema.optional<typeof Schema.String>;
32
+ charset: Schema.optional<Schema.NullOr<typeof Schema.String>>;
33
+ /** Attachment filename, present on parts listed in `Email.attachments`. */
34
+ name: Schema.optional<Schema.NullOr<typeof Schema.String>>;
35
+ /** MIME `Content-Disposition` (`attachment` or `inline`), present on parts listed in `Email.attachments`. */
36
+ disposition: Schema.optional<Schema.NullOr<typeof Schema.String>>;
37
+ /** The part's `Content-ID` header (RFC 8621 §4.1.4), if any — matches a `cid:` reference in an HTML body. */
38
+ cid: Schema.optional<Schema.NullOr<typeof Schema.String>>;
39
+ }>;
40
+ export type EmailBodyPart = Schema.Schema.Type<typeof EmailBodyPart>;
41
+ /** An email (RFC 8621 §4). Only the properties requested in `Email/get` are present. */
42
+ export declare const Email: Schema.Struct<{
43
+ id: typeof Schema.String;
44
+ blobId: Schema.optional<typeof Schema.String>;
45
+ threadId: typeof Schema.String;
46
+ mailboxIds: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Boolean>>;
47
+ keywords: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Boolean>>;
48
+ from: Schema.optional<Schema.NullOr<Schema.Array$<Schema.Struct<{
49
+ name: Schema.optional<Schema.NullOr<typeof Schema.String>>;
50
+ email: typeof Schema.String;
51
+ }>>>>;
52
+ to: Schema.optional<Schema.NullOr<Schema.Array$<Schema.Struct<{
53
+ name: Schema.optional<Schema.NullOr<typeof Schema.String>>;
54
+ email: typeof Schema.String;
55
+ }>>>>;
56
+ cc: Schema.optional<Schema.NullOr<Schema.Array$<Schema.Struct<{
57
+ name: Schema.optional<Schema.NullOr<typeof Schema.String>>;
58
+ email: typeof Schema.String;
59
+ }>>>>;
60
+ bcc: Schema.optional<Schema.NullOr<Schema.Array$<Schema.Struct<{
61
+ name: Schema.optional<Schema.NullOr<typeof Schema.String>>;
62
+ email: typeof Schema.String;
63
+ }>>>>;
64
+ subject: Schema.optional<Schema.NullOr<typeof Schema.String>>;
65
+ receivedAt: typeof Schema.String;
66
+ sentAt: Schema.optional<Schema.NullOr<typeof Schema.String>>;
67
+ preview: Schema.optional<Schema.NullOr<typeof Schema.String>>;
68
+ messageId: Schema.optional<Schema.NullOr<Schema.Array$<typeof Schema.String>>>;
69
+ inReplyTo: Schema.optional<Schema.NullOr<Schema.Array$<typeof Schema.String>>>;
70
+ references: Schema.optional<Schema.NullOr<Schema.Array$<typeof Schema.String>>>;
71
+ bodyValues: Schema.optional<Schema.Record$<typeof Schema.String, Schema.Struct<{
72
+ value: typeof Schema.String;
73
+ isEncodingProblem: Schema.optional<typeof Schema.Boolean>;
74
+ isTruncated: Schema.optional<typeof Schema.Boolean>;
75
+ }>>>;
76
+ textBody: Schema.optional<Schema.Array$<Schema.Struct<{
77
+ partId: Schema.optional<Schema.NullOr<typeof Schema.String>>;
78
+ blobId: Schema.optional<Schema.NullOr<typeof Schema.String>>;
79
+ size: Schema.optional<typeof Schema.Number>;
80
+ type: Schema.optional<typeof Schema.String>;
81
+ charset: Schema.optional<Schema.NullOr<typeof Schema.String>>;
82
+ /** Attachment filename, present on parts listed in `Email.attachments`. */
83
+ name: Schema.optional<Schema.NullOr<typeof Schema.String>>;
84
+ /** MIME `Content-Disposition` (`attachment` or `inline`), present on parts listed in `Email.attachments`. */
85
+ disposition: Schema.optional<Schema.NullOr<typeof Schema.String>>;
86
+ /** The part's `Content-ID` header (RFC 8621 §4.1.4), if any — matches a `cid:` reference in an HTML body. */
87
+ cid: Schema.optional<Schema.NullOr<typeof Schema.String>>;
88
+ }>>>;
89
+ htmlBody: Schema.optional<Schema.Array$<Schema.Struct<{
90
+ partId: Schema.optional<Schema.NullOr<typeof Schema.String>>;
91
+ blobId: Schema.optional<Schema.NullOr<typeof Schema.String>>;
92
+ size: Schema.optional<typeof Schema.Number>;
93
+ type: Schema.optional<typeof Schema.String>;
94
+ charset: Schema.optional<Schema.NullOr<typeof Schema.String>>;
95
+ /** Attachment filename, present on parts listed in `Email.attachments`. */
96
+ name: Schema.optional<Schema.NullOr<typeof Schema.String>>;
97
+ /** MIME `Content-Disposition` (`attachment` or `inline`), present on parts listed in `Email.attachments`. */
98
+ disposition: Schema.optional<Schema.NullOr<typeof Schema.String>>;
99
+ /** The part's `Content-ID` header (RFC 8621 §4.1.4), if any — matches a `cid:` reference in an HTML body. */
100
+ cid: Schema.optional<Schema.NullOr<typeof Schema.String>>;
101
+ }>>>;
102
+ /** Non-body parts (RFC 8621 §4.1.4) — the attachments proper, distinct from `textBody`/`htmlBody`. */
103
+ attachments: Schema.optional<Schema.Array$<Schema.Struct<{
104
+ partId: Schema.optional<Schema.NullOr<typeof Schema.String>>;
105
+ blobId: Schema.optional<Schema.NullOr<typeof Schema.String>>;
106
+ size: Schema.optional<typeof Schema.Number>;
107
+ type: Schema.optional<typeof Schema.String>;
108
+ charset: Schema.optional<Schema.NullOr<typeof Schema.String>>;
109
+ /** Attachment filename, present on parts listed in `Email.attachments`. */
110
+ name: Schema.optional<Schema.NullOr<typeof Schema.String>>;
111
+ /** MIME `Content-Disposition` (`attachment` or `inline`), present on parts listed in `Email.attachments`. */
112
+ disposition: Schema.optional<Schema.NullOr<typeof Schema.String>>;
113
+ /** The part's `Content-ID` header (RFC 8621 §4.1.4), if any — matches a `cid:` reference in an HTML body. */
114
+ cid: Schema.optional<Schema.NullOr<typeof Schema.String>>;
115
+ }>>>;
116
+ }>;
117
+ export type Email = Schema.Schema.Type<typeof Email>;
118
+ /** A sending identity (RFC 8621 §6); `email` is an address the server permits as `from`. */
119
+ export declare const Identity: Schema.Struct<{
120
+ id: typeof Schema.String;
121
+ name: Schema.optional<Schema.NullOr<typeof Schema.String>>;
122
+ email: typeof Schema.String;
123
+ }>;
124
+ export type Identity = Schema.Schema.Type<typeof Identity>;
125
+ export declare const MailboxGetResult: Schema.Struct<{
126
+ accountId: Schema.optional<typeof Schema.String>;
127
+ state: Schema.optional<typeof Schema.String>;
128
+ list: Schema.Array$<Schema.Struct<{
129
+ id: typeof Schema.String;
130
+ name: typeof Schema.String;
131
+ role: Schema.optional<Schema.NullOr<typeof Schema.String>>;
132
+ parentId: Schema.optional<Schema.NullOr<typeof Schema.String>>;
133
+ sortOrder: Schema.optional<typeof Schema.Number>;
134
+ totalEmails: Schema.optional<typeof Schema.Number>;
135
+ unreadEmails: Schema.optional<typeof Schema.Number>;
136
+ }>>;
137
+ notFound: Schema.optional<Schema.NullOr<Schema.Array$<typeof Schema.String>>>;
138
+ }>;
139
+ export type MailboxGetResult = Schema.Schema.Type<typeof MailboxGetResult>;
140
+ export declare const EmailQueryResult: Schema.Struct<{
141
+ accountId: Schema.optional<typeof Schema.String>;
142
+ queryState: Schema.optional<typeof Schema.String>;
143
+ position: Schema.optional<typeof Schema.Number>;
144
+ total: Schema.optional<typeof Schema.Number>;
145
+ limit: Schema.optional<typeof Schema.Number>;
146
+ ids: Schema.Array$<typeof Schema.String>;
147
+ }>;
148
+ export type EmailQueryResult = Schema.Schema.Type<typeof EmailQueryResult>;
149
+ export declare const EmailGetResult: Schema.Struct<{
150
+ accountId: Schema.optional<typeof Schema.String>;
151
+ state: Schema.optional<typeof Schema.String>;
152
+ list: Schema.Array$<Schema.Struct<{
153
+ id: typeof Schema.String;
154
+ blobId: Schema.optional<typeof Schema.String>;
155
+ threadId: typeof Schema.String;
156
+ mailboxIds: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Boolean>>;
157
+ keywords: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Boolean>>;
158
+ from: Schema.optional<Schema.NullOr<Schema.Array$<Schema.Struct<{
159
+ name: Schema.optional<Schema.NullOr<typeof Schema.String>>;
160
+ email: typeof Schema.String;
161
+ }>>>>;
162
+ to: Schema.optional<Schema.NullOr<Schema.Array$<Schema.Struct<{
163
+ name: Schema.optional<Schema.NullOr<typeof Schema.String>>;
164
+ email: typeof Schema.String;
165
+ }>>>>;
166
+ cc: Schema.optional<Schema.NullOr<Schema.Array$<Schema.Struct<{
167
+ name: Schema.optional<Schema.NullOr<typeof Schema.String>>;
168
+ email: typeof Schema.String;
169
+ }>>>>;
170
+ bcc: Schema.optional<Schema.NullOr<Schema.Array$<Schema.Struct<{
171
+ name: Schema.optional<Schema.NullOr<typeof Schema.String>>;
172
+ email: typeof Schema.String;
173
+ }>>>>;
174
+ subject: Schema.optional<Schema.NullOr<typeof Schema.String>>;
175
+ receivedAt: typeof Schema.String;
176
+ sentAt: Schema.optional<Schema.NullOr<typeof Schema.String>>;
177
+ preview: Schema.optional<Schema.NullOr<typeof Schema.String>>;
178
+ messageId: Schema.optional<Schema.NullOr<Schema.Array$<typeof Schema.String>>>;
179
+ inReplyTo: Schema.optional<Schema.NullOr<Schema.Array$<typeof Schema.String>>>;
180
+ references: Schema.optional<Schema.NullOr<Schema.Array$<typeof Schema.String>>>;
181
+ bodyValues: Schema.optional<Schema.Record$<typeof Schema.String, Schema.Struct<{
182
+ value: typeof Schema.String;
183
+ isEncodingProblem: Schema.optional<typeof Schema.Boolean>;
184
+ isTruncated: Schema.optional<typeof Schema.Boolean>;
185
+ }>>>;
186
+ textBody: Schema.optional<Schema.Array$<Schema.Struct<{
187
+ partId: Schema.optional<Schema.NullOr<typeof Schema.String>>;
188
+ blobId: Schema.optional<Schema.NullOr<typeof Schema.String>>;
189
+ size: Schema.optional<typeof Schema.Number>;
190
+ type: Schema.optional<typeof Schema.String>;
191
+ charset: Schema.optional<Schema.NullOr<typeof Schema.String>>;
192
+ /** Attachment filename, present on parts listed in `Email.attachments`. */
193
+ name: Schema.optional<Schema.NullOr<typeof Schema.String>>;
194
+ /** MIME `Content-Disposition` (`attachment` or `inline`), present on parts listed in `Email.attachments`. */
195
+ disposition: Schema.optional<Schema.NullOr<typeof Schema.String>>;
196
+ /** The part's `Content-ID` header (RFC 8621 §4.1.4), if any — matches a `cid:` reference in an HTML body. */
197
+ cid: Schema.optional<Schema.NullOr<typeof Schema.String>>;
198
+ }>>>;
199
+ htmlBody: Schema.optional<Schema.Array$<Schema.Struct<{
200
+ partId: Schema.optional<Schema.NullOr<typeof Schema.String>>;
201
+ blobId: Schema.optional<Schema.NullOr<typeof Schema.String>>;
202
+ size: Schema.optional<typeof Schema.Number>;
203
+ type: Schema.optional<typeof Schema.String>;
204
+ charset: Schema.optional<Schema.NullOr<typeof Schema.String>>;
205
+ /** Attachment filename, present on parts listed in `Email.attachments`. */
206
+ name: Schema.optional<Schema.NullOr<typeof Schema.String>>;
207
+ /** MIME `Content-Disposition` (`attachment` or `inline`), present on parts listed in `Email.attachments`. */
208
+ disposition: Schema.optional<Schema.NullOr<typeof Schema.String>>;
209
+ /** The part's `Content-ID` header (RFC 8621 §4.1.4), if any — matches a `cid:` reference in an HTML body. */
210
+ cid: Schema.optional<Schema.NullOr<typeof Schema.String>>;
211
+ }>>>;
212
+ /** Non-body parts (RFC 8621 §4.1.4) — the attachments proper, distinct from `textBody`/`htmlBody`. */
213
+ attachments: Schema.optional<Schema.Array$<Schema.Struct<{
214
+ partId: Schema.optional<Schema.NullOr<typeof Schema.String>>;
215
+ blobId: Schema.optional<Schema.NullOr<typeof Schema.String>>;
216
+ size: Schema.optional<typeof Schema.Number>;
217
+ type: Schema.optional<typeof Schema.String>;
218
+ charset: Schema.optional<Schema.NullOr<typeof Schema.String>>;
219
+ /** Attachment filename, present on parts listed in `Email.attachments`. */
220
+ name: Schema.optional<Schema.NullOr<typeof Schema.String>>;
221
+ /** MIME `Content-Disposition` (`attachment` or `inline`), present on parts listed in `Email.attachments`. */
222
+ disposition: Schema.optional<Schema.NullOr<typeof Schema.String>>;
223
+ /** The part's `Content-ID` header (RFC 8621 §4.1.4), if any — matches a `cid:` reference in an HTML body. */
224
+ cid: Schema.optional<Schema.NullOr<typeof Schema.String>>;
225
+ }>>>;
226
+ }>>;
227
+ notFound: Schema.optional<Schema.NullOr<Schema.Array$<typeof Schema.String>>>;
228
+ }>;
229
+ export type EmailGetResult = Schema.Schema.Type<typeof EmailGetResult>;
230
+ /** `Email/changes` delta since an opaque `sinceState` token (RFC 8621 §4.3 / RFC 8620 §5.2). */
231
+ export declare const EmailChangesResult: Schema.Struct<{
232
+ accountId: Schema.optional<typeof Schema.String>;
233
+ oldState: typeof Schema.String;
234
+ newState: typeof Schema.String;
235
+ hasMoreChanges: typeof Schema.Boolean;
236
+ created: Schema.Array$<typeof Schema.String>;
237
+ updated: Schema.Array$<typeof Schema.String>;
238
+ destroyed: Schema.Array$<typeof Schema.String>;
239
+ }>;
240
+ export type EmailChangesResult = Schema.Schema.Type<typeof EmailChangesResult>;
241
+ export declare const IdentityGetResult: Schema.Struct<{
242
+ accountId: Schema.optional<typeof Schema.String>;
243
+ state: Schema.optional<typeof Schema.String>;
244
+ list: Schema.Array$<Schema.Struct<{
245
+ id: typeof Schema.String;
246
+ name: Schema.optional<Schema.NullOr<typeof Schema.String>>;
247
+ email: typeof Schema.String;
248
+ }>>;
249
+ notFound: Schema.optional<Schema.NullOr<Schema.Array$<typeof Schema.String>>>;
250
+ }>;
251
+ export type IdentityGetResult = Schema.Schema.Type<typeof IdentityGetResult>;
252
+ export declare const EmailSetResult: Schema.Struct<{
253
+ accountId: Schema.optional<typeof Schema.String>;
254
+ oldState: Schema.optional<Schema.NullOr<typeof Schema.String>>;
255
+ newState: Schema.optional<typeof Schema.String>;
256
+ created: Schema.optional<Schema.NullOr<Schema.Record$<typeof Schema.String, Schema.Struct<{
257
+ id: typeof Schema.String;
258
+ blobId: Schema.optional<typeof Schema.String>;
259
+ threadId: Schema.optional<typeof Schema.String>;
260
+ size: Schema.optional<typeof Schema.Number>;
261
+ }>>>>;
262
+ updated: Schema.optional<Schema.NullOr<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>>;
263
+ destroyed: Schema.optional<Schema.NullOr<Schema.Array$<typeof Schema.String>>>;
264
+ notCreated: Schema.optional<Schema.NullOr<Schema.Record$<typeof Schema.String, Schema.Struct<{
265
+ type: typeof Schema.String;
266
+ description: Schema.optional<Schema.NullOr<typeof Schema.String>>;
267
+ }>>>>;
268
+ notUpdated: Schema.optional<Schema.NullOr<Schema.Record$<typeof Schema.String, Schema.Struct<{
269
+ type: typeof Schema.String;
270
+ description: Schema.optional<Schema.NullOr<typeof Schema.String>>;
271
+ }>>>>;
272
+ notDestroyed: Schema.optional<Schema.NullOr<Schema.Record$<typeof Schema.String, Schema.Struct<{
273
+ type: typeof Schema.String;
274
+ description: Schema.optional<Schema.NullOr<typeof Schema.String>>;
275
+ }>>>>;
276
+ }>;
277
+ export type EmailSetResult = Schema.Schema.Type<typeof EmailSetResult>;
278
+ export declare const EmailSubmissionSetResult: Schema.Struct<{
279
+ accountId: Schema.optional<typeof Schema.String>;
280
+ newState: Schema.optional<typeof Schema.String>;
281
+ created: Schema.optional<Schema.NullOr<Schema.Record$<typeof Schema.String, Schema.Struct<{
282
+ id: typeof Schema.String;
283
+ }>>>>;
284
+ notCreated: Schema.optional<Schema.NullOr<Schema.Record$<typeof Schema.String, Schema.Struct<{
285
+ type: typeof Schema.String;
286
+ description: Schema.optional<Schema.NullOr<typeof Schema.String>>;
287
+ }>>>>;
288
+ }>;
289
+ export type EmailSubmissionSetResult = Schema.Schema.Type<typeof EmailSubmissionSetResult>;
290
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/apis/JmapMail/types.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,3 @@
1
+ export * as Jmap from './Jmap';
2
+ export * as JmapMail from './JmapMail';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/apis/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAE/B,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=jmap-api.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jmap-api.test.d.ts","sourceRoot":"","sources":["../../../../src/apis/jmap-api.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import * as Effect from 'effect/Effect';
2
+ import * as Capability from '@dxos/app-framework/Capability';
3
+ declare const _default: (props: void) => Effect.Effect<Capability.Contribution<Capability.CapabilityIdentifier<"org.dxos.plugin.connector.capability.connector", "multi">>, never, import("effect/Scope").Scope>;
4
+ export default _default;
5
+ //# sourceMappingURL=connector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/connector.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,UAAU,MAAM,gCAAgC,CAAC"}
@@ -0,0 +1,37 @@
1
+ import * as Schema from 'effect/Schema';
2
+ import { Obj } from '@dxos/echo';
3
+ import { AccessToken } from '@dxos/link';
4
+ import * as Connection from '@dxos/plugin-connector/Connection';
5
+ import * as ConnectorSpec from '@dxos/plugin-connector/ConnectorSpec';
6
+ import { Jmap } from '../apis';
7
+ /**
8
+ * Manual-credential form for the JMAP connector. JMAP auth is a server-issued Bearer API token
9
+ * (Fastmail: Settings → Privacy & Security → Integrations), outside any OAuth flow, so the host,
10
+ * email, and token are collected directly.
11
+ */
12
+ declare const JmapCredentialFormSchema: Schema.Struct<{
13
+ host: Schema.SchemaClass<string, string, never>;
14
+ email: Schema.SchemaClass<string, string, never>;
15
+ token: Schema.SchemaClass<string, string, never>;
16
+ }>;
17
+ type JmapCredentialFormValues = Schema.Schema.Type<typeof JmapCredentialFormSchema>;
18
+ export declare const jmapCredentialForm: ConnectorSpec.CredentialForm<JmapCredentialFormValues>;
19
+ /**
20
+ * Builds the `AccessToken` (source = host, account = form email or session username) and `Connection`
21
+ * for a validated JMAP credential. Pure (no DB), so the construction is unit-testable.
22
+ */
23
+ export declare const buildJmapCredential: ({ host, email, token, session, connector, }: {
24
+ host: string;
25
+ email: string;
26
+ token: string;
27
+ session: Jmap.Session;
28
+ connector: {
29
+ id?: string;
30
+ label?: string;
31
+ };
32
+ }) => {
33
+ accessToken: Obj.OfShape<AccessToken.AccessToken & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object>>;
34
+ connection: Obj.OfShape<Connection.Connection & import("@dxos/echo/Entity").OfKind<import("@dxos/echo/internal").EntityKind.Object>>;
35
+ };
36
+ export {};
37
+ //# sourceMappingURL=credential-form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credential-form.d.ts","sourceRoot":"","sources":["../../../../src/capabilities/credential-form.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAU,GAAG,EAAO,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,KAAK,UAAU,MAAM,mCAAmC,CAAC;AAChE,OAAO,KAAK,aAAa,MAAM,sCAAsC,CAAC;AAEtE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAK/B;;;;GAIG;AACH,QAAA,MAAM,wBAAwB;;;;EAa5B,CAAC;AAEH,KAAK,wBAAwB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAEpF,eAAO,MAAM,kBAAkB,EAAE,aAAa,CAAC,cAAc,CAAC,wBAAwB,CA2BrF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,gDAM7B;IACD,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC;IACtB,SAAS,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C;;;CAaA,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=credential-form.test.d.ts.map