@vibesdotdev/integrations-microsoft 0.0.0-stage → 1.0.0-rc.1

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 (143) hide show
  1. package/LICENSE +126 -0
  2. package/README.md +120 -2
  3. package/dist/api-client-plugin.d.ts +3 -0
  4. package/dist/api-client-plugin.d.ts.map +1 -0
  5. package/dist/api-client-plugin.js +11 -0
  6. package/dist/api-client-plugin.js.map +1 -0
  7. package/dist/client/helper.d.ts +17 -0
  8. package/dist/client/helper.d.ts.map +1 -0
  9. package/dist/client/helper.js +18 -0
  10. package/dist/client/helper.js.map +1 -0
  11. package/dist/client/index.d.ts +3 -0
  12. package/dist/client/index.d.ts.map +1 -0
  13. package/dist/client/index.js +3 -0
  14. package/dist/client/index.js.map +1 -0
  15. package/dist/client/runtime-client.d.ts +87 -0
  16. package/dist/client/runtime-client.d.ts.map +1 -0
  17. package/dist/client/runtime-client.js +47 -0
  18. package/dist/client/runtime-client.js.map +1 -0
  19. package/dist/cloud.plugin.d.ts +3 -0
  20. package/dist/cloud.plugin.d.ts.map +1 -0
  21. package/dist/cloud.plugin.js +19 -0
  22. package/dist/cloud.plugin.js.map +1 -0
  23. package/dist/email/index.d.ts +13 -0
  24. package/dist/email/index.d.ts.map +1 -0
  25. package/dist/email/index.js +13 -0
  26. package/dist/email/index.js.map +1 -0
  27. package/dist/email/microsoft/index.d.ts +4 -0
  28. package/dist/email/microsoft/index.d.ts.map +1 -0
  29. package/dist/email/microsoft/index.js +4 -0
  30. package/dist/email/microsoft/index.js.map +1 -0
  31. package/dist/email/microsoft/microsoft.descriptor.d.ts +85 -0
  32. package/dist/email/microsoft/microsoft.descriptor.d.ts.map +1 -0
  33. package/dist/email/microsoft/microsoft.descriptor.js +79 -0
  34. package/dist/email/microsoft/microsoft.descriptor.js.map +1 -0
  35. package/dist/email/microsoft/microsoft.impl.d.ts +100 -0
  36. package/dist/email/microsoft/microsoft.impl.d.ts.map +1 -0
  37. package/dist/email/microsoft/microsoft.impl.js +323 -0
  38. package/dist/email/microsoft/microsoft.impl.js.map +1 -0
  39. package/dist/email/microsoft/outlook.mime.d.ts +18 -0
  40. package/dist/email/microsoft/outlook.mime.d.ts.map +1 -0
  41. package/dist/email/microsoft/outlook.mime.js +61 -0
  42. package/dist/email/microsoft/outlook.mime.js.map +1 -0
  43. package/dist/email/microsoft-email.plugin.d.ts +10 -0
  44. package/dist/email/microsoft-email.plugin.d.ts.map +1 -0
  45. package/dist/email/microsoft-email.plugin.js +29 -0
  46. package/dist/email/microsoft-email.plugin.js.map +1 -0
  47. package/dist/index.d.ts +9 -0
  48. package/dist/index.d.ts.map +1 -0
  49. package/dist/index.js +8 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/integrations-microsoft.plugin.d.ts +4 -0
  52. package/dist/integrations-microsoft.plugin.d.ts.map +1 -0
  53. package/dist/integrations-microsoft.plugin.js +15 -0
  54. package/dist/integrations-microsoft.plugin.js.map +1 -0
  55. package/dist/microsoft/graph-drive-fallback.d.ts +11 -0
  56. package/dist/microsoft/graph-drive-fallback.d.ts.map +1 -0
  57. package/dist/microsoft/graph-drive-fallback.js +90 -0
  58. package/dist/microsoft/graph-drive-fallback.js.map +1 -0
  59. package/dist/microsoft/graph-schemas.d.ts +2 -0
  60. package/dist/microsoft/graph-schemas.d.ts.map +1 -0
  61. package/dist/microsoft/graph-schemas.js +2 -0
  62. package/dist/microsoft/graph-schemas.js.map +1 -0
  63. package/dist/microsoft/graph-sharepoint-client.d.ts +219 -0
  64. package/dist/microsoft/graph-sharepoint-client.d.ts.map +1 -0
  65. package/dist/microsoft/graph-sharepoint-client.js +644 -0
  66. package/dist/microsoft/graph-sharepoint-client.js.map +1 -0
  67. package/dist/microsoft/index.d.ts +8 -0
  68. package/dist/microsoft/index.d.ts.map +1 -0
  69. package/dist/microsoft/index.js +8 -0
  70. package/dist/microsoft/index.js.map +1 -0
  71. package/dist/microsoft/microsoft-delegated-implementation.d.ts +20 -0
  72. package/dist/microsoft/microsoft-delegated-implementation.d.ts.map +1 -0
  73. package/dist/microsoft/microsoft-delegated-implementation.js +69 -0
  74. package/dist/microsoft/microsoft-delegated-implementation.js.map +1 -0
  75. package/dist/microsoft/microsoft-implementation.d.ts +22 -0
  76. package/dist/microsoft/microsoft-implementation.d.ts.map +1 -0
  77. package/dist/microsoft/microsoft-implementation.js +78 -0
  78. package/dist/microsoft/microsoft-implementation.js.map +1 -0
  79. package/dist/microsoft/secrets-fetch.d.ts +20 -0
  80. package/dist/microsoft/secrets-fetch.d.ts.map +1 -0
  81. package/dist/microsoft/secrets-fetch.js +47 -0
  82. package/dist/microsoft/secrets-fetch.js.map +1 -0
  83. package/dist/microsoft/sharepoint-operations.d.ts +23 -0
  84. package/dist/microsoft/sharepoint-operations.d.ts.map +1 -0
  85. package/dist/microsoft/sharepoint-operations.js +123 -0
  86. package/dist/microsoft/sharepoint-operations.js.map +1 -0
  87. package/dist/microsoft/system.integration.microsoft.delegated.descriptor.d.ts +85 -0
  88. package/dist/microsoft/system.integration.microsoft.delegated.descriptor.d.ts.map +1 -0
  89. package/dist/microsoft/system.integration.microsoft.delegated.descriptor.js +109 -0
  90. package/dist/microsoft/system.integration.microsoft.delegated.descriptor.js.map +1 -0
  91. package/dist/microsoft/system.integration.microsoft.descriptor.d.ts +69 -0
  92. package/dist/microsoft/system.integration.microsoft.descriptor.d.ts.map +1 -0
  93. package/dist/microsoft/system.integration.microsoft.descriptor.js +114 -0
  94. package/dist/microsoft/system.integration.microsoft.descriptor.js.map +1 -0
  95. package/dist/microsoft.consumer.plugin.d.ts +4 -0
  96. package/dist/microsoft.consumer.plugin.d.ts.map +1 -0
  97. package/dist/microsoft.consumer.plugin.js +13 -0
  98. package/dist/microsoft.consumer.plugin.js.map +1 -0
  99. package/dist/schemas/boundary.d.ts +69 -0
  100. package/dist/schemas/boundary.d.ts.map +1 -0
  101. package/dist/schemas/boundary.js +94 -0
  102. package/dist/schemas/boundary.js.map +1 -0
  103. package/dist/schemas/graph.d.ts +139 -0
  104. package/dist/schemas/graph.d.ts.map +1 -0
  105. package/dist/schemas/graph.js +161 -0
  106. package/dist/schemas/graph.js.map +1 -0
  107. package/dist/schemas/oauth.d.ts +131 -0
  108. package/dist/schemas/oauth.d.ts.map +1 -0
  109. package/dist/schemas/oauth.js +27 -0
  110. package/dist/schemas/oauth.js.map +1 -0
  111. package/dist/schemas/operations.d.ts +239 -0
  112. package/dist/schemas/operations.d.ts.map +1 -0
  113. package/dist/schemas/operations.js +29 -0
  114. package/dist/schemas/operations.js.map +1 -0
  115. package/dist/schemas/outlook.d.ts +241 -0
  116. package/dist/schemas/outlook.d.ts.map +1 -0
  117. package/dist/schemas/outlook.js +29 -0
  118. package/dist/schemas/outlook.js.map +1 -0
  119. package/dist/schemas/sharepoint.d.ts +67 -0
  120. package/dist/schemas/sharepoint.d.ts.map +1 -0
  121. package/dist/schemas/sharepoint.js +71 -0
  122. package/dist/schemas/sharepoint.js.map +1 -0
  123. package/dist/server/oauth.d.ts +9 -0
  124. package/dist/server/oauth.d.ts.map +1 -0
  125. package/dist/server/oauth.js +67 -0
  126. package/dist/server/oauth.js.map +1 -0
  127. package/dist/sharepoint/index.d.ts +11 -0
  128. package/dist/sharepoint/index.d.ts.map +1 -0
  129. package/dist/sharepoint/index.js +11 -0
  130. package/dist/sharepoint/index.js.map +1 -0
  131. package/dist/sharepoint/sharepoint.adapter.descriptor.d.ts +10 -0
  132. package/dist/sharepoint/sharepoint.adapter.descriptor.d.ts.map +1 -0
  133. package/dist/sharepoint/sharepoint.adapter.descriptor.js +32 -0
  134. package/dist/sharepoint/sharepoint.adapter.descriptor.js.map +1 -0
  135. package/dist/sharepoint/sharepoint.adapter.impl.d.ts +195 -0
  136. package/dist/sharepoint/sharepoint.adapter.impl.d.ts.map +1 -0
  137. package/dist/sharepoint/sharepoint.adapter.impl.js +645 -0
  138. package/dist/sharepoint/sharepoint.adapter.impl.js.map +1 -0
  139. package/dist/sharepoint/sharepoint.schemas.d.ts +2 -0
  140. package/dist/sharepoint/sharepoint.schemas.d.ts.map +1 -0
  141. package/dist/sharepoint/sharepoint.schemas.js +2 -0
  142. package/dist/sharepoint/sharepoint.schemas.js.map +1 -0
  143. package/package.json +146 -4
@@ -0,0 +1,85 @@
1
+ /**
2
+ * Outlook `integration/provider` descriptor.
3
+ *
4
+ * Email feature on the existing Microsoft 365 vendor pack — not a new host,
5
+ * SKU, or catalog kind. Registers under `category: 'email'` so
6
+ * `packages/email`'s `EmailClient` can pick it up. Priority stays below
7
+ * Resend (100) and Cloudflare Email (75) so this mailbox adapter does not
8
+ * become the default live sender.
9
+ *
10
+ * Credentials reuse the Microsoft OAuth access token
11
+ * (`providerType: 'microsoft'`), the same secret `storeMicrosoftTokens`
12
+ * writes. Graph `/me` mail APIs require a delegated mailbox token.
13
+ */
14
+ declare const _default: {
15
+ id: string;
16
+ kind: "integration/provider";
17
+ name?: string | undefined;
18
+ description?: string | undefined;
19
+ tags?: string[] | undefined;
20
+ hardware?: string[] | undefined;
21
+ enabled?: boolean | undefined;
22
+ capabilityId?: string | undefined;
23
+ retention?: string | {
24
+ reason: string;
25
+ maxAgeDays?: number | undefined;
26
+ maxEntries?: number | undefined;
27
+ maxBytes?: number | undefined;
28
+ cascadeFrom?: string | undefined;
29
+ ageField?: string | undefined;
30
+ enforcedBy?: string | undefined;
31
+ } | undefined;
32
+ requiredContext?: string[] | undefined;
33
+ optionalContext?: string[] | undefined;
34
+ provider?: string | undefined;
35
+ category?: "push" | "webhook" | "accounting" | "vcs" | "issue-tracker" | "productivity" | "ocr" | "email" | "messaging" | "sms" | "storage" | "analytics" | "observability" | "crm" | "calendar" | "other" | undefined;
36
+ priority?: number | undefined;
37
+ baseUrl?: string | undefined;
38
+ config?: Record<string, import("@vibesdotdev/kernel/bootstrap").JsonValue> | undefined;
39
+ protectedConfigKeys?: string[] | undefined;
40
+ configurationSource?: "account" | "host" | undefined;
41
+ configSettingKey?: string | undefined;
42
+ credentials?: {
43
+ key: string;
44
+ source: "secret" | "setting";
45
+ reference?: {
46
+ source: "secret";
47
+ key: string;
48
+ store?: string | undefined;
49
+ operation?: object | undefined;
50
+ } | undefined;
51
+ providerType?: string | undefined;
52
+ scope?: "user" | "platform" | "project" | "org" | undefined;
53
+ scopeId?: string | undefined;
54
+ settingKey?: string | undefined;
55
+ required?: boolean | undefined;
56
+ }[] | undefined;
57
+ oauth?: {
58
+ authorizationEndpoint: string;
59
+ tokenEndpoint: string;
60
+ scopes?: string[] | undefined;
61
+ authorizationParams?: Record<string, string> | undefined;
62
+ configFromCallback?: string[] | undefined;
63
+ clientAuthentication?: "form" | "basic" | undefined;
64
+ bodyEncoding?: "form" | "json" | undefined;
65
+ headers?: Record<string, string> | undefined;
66
+ scopeIdCallbackParam?: string | undefined;
67
+ } | undefined;
68
+ operations?: {
69
+ id: string;
70
+ name: string;
71
+ description?: string | undefined;
72
+ requiresOrg?: boolean | undefined;
73
+ }[] | undefined;
74
+ connection?: {
75
+ authMode?: "delegated" | "oauth" | "webhook" | "system-config" | undefined;
76
+ connectable?: boolean | undefined;
77
+ checkable?: boolean | undefined;
78
+ requiresProviderAdmin?: boolean | undefined;
79
+ } | undefined;
80
+ } & {
81
+ name: string;
82
+ provider: string;
83
+ };
84
+ export default _default;
85
+ //# sourceMappingURL=microsoft.descriptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"microsoft.descriptor.d.ts","sourceRoot":"","sources":["../../../src/email/microsoft/microsoft.descriptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAK4E,MAAM;cAAY,MAAM;;AAAvG,wBAkEG"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Outlook `integration/provider` descriptor.
3
+ *
4
+ * Email feature on the existing Microsoft 365 vendor pack — not a new host,
5
+ * SKU, or catalog kind. Registers under `category: 'email'` so
6
+ * `packages/email`'s `EmailClient` can pick it up. Priority stays below
7
+ * Resend (100) and Cloudflare Email (75) so this mailbox adapter does not
8
+ * become the default live sender.
9
+ *
10
+ * Credentials reuse the Microsoft OAuth access token
11
+ * (`providerType: 'microsoft'`), the same secret `storeMicrosoftTokens`
12
+ * writes. Graph `/me` mail APIs require a delegated mailbox token.
13
+ */
14
+ import { createRuntimeAsset } from '@vibesdotdev/kernel/factory';
15
+ export default createRuntimeAsset({
16
+ kind: 'integration/provider',
17
+ id: 'integration.email.microsoft',
18
+ name: 'Outlook',
19
+ description: 'Microsoft Graph mail mailbox on the existing Microsoft 365 integration. Outbound send, health/status, and pull-mode receive over the signed-in mailbox OAuth token.',
20
+ provider: 'microsoft',
21
+ category: 'email',
22
+ enabled: true,
23
+ priority: 70,
24
+ baseUrl: 'https://graph.microsoft.com/v1.0',
25
+ configSettingKey: 'integrations.email.microsoft.config',
26
+ config: {
27
+ defaultFrom: '',
28
+ scopes: ['Mail.Send', 'Mail.Read', 'offline_access']
29
+ },
30
+ credentials: [
31
+ {
32
+ key: 'accessToken',
33
+ source: 'secret',
34
+ providerType: 'microsoft',
35
+ scope: 'org',
36
+ required: false
37
+ },
38
+ {
39
+ key: 'accessToken',
40
+ source: 'secret',
41
+ reference: { source: 'secret', key: 'MICROSOFT_ACCESS_TOKEN' },
42
+ required: false
43
+ }
44
+ ],
45
+ operations: [
46
+ {
47
+ id: 'send',
48
+ name: 'Send email',
49
+ description: 'Create a Graph message in the signed-in mailbox, then POST /me/messages/{id}/send.',
50
+ requiresOrg: false
51
+ },
52
+ {
53
+ id: 'check',
54
+ name: 'Check status / health',
55
+ description: 'GET /me as a health probe, or GET /me/messages/{id} for a previously sent message.',
56
+ requiresOrg: false
57
+ },
58
+ {
59
+ id: 'receive',
60
+ name: 'Receive email',
61
+ description: 'Pull-mode inbound via Graph /me/messages. Args: `{ since?: ISO 8601; limit?: number (default 50) }`.',
62
+ requiresOrg: false
63
+ },
64
+ {
65
+ id: 'get-received',
66
+ name: 'Retrieve received email',
67
+ description: 'GET /me/messages/{emailId} through the selected account.',
68
+ requiresOrg: false
69
+ },
70
+ {
71
+ id: 'get-received-attachment',
72
+ name: 'Download received attachment',
73
+ description: 'GET /me/messages/{emailId}/attachments/{attachmentId} through the selected account.',
74
+ requiresOrg: false
75
+ }
76
+ ],
77
+ tags: ['email', 'microsoft', 'outlook', 'graph', 'mailbox']
78
+ });
79
+ //# sourceMappingURL=microsoft.descriptor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"microsoft.descriptor.js","sourceRoot":"","sources":["../../../src/email/microsoft/microsoft.descriptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAGjE,eAAe,kBAAkB,CAA0E;IAC1G,IAAI,EAAE,sBAAsB;IAC5B,EAAE,EAAE,6BAA6B;IACjC,IAAI,EAAE,SAAS;IACf,WAAW,EACV,qKAAqK;IACtK,QAAQ,EAAE,WAAW;IACrB,QAAQ,EAAE,OAAO;IACjB,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,EAAE;IACZ,OAAO,EAAE,kCAAkC;IAC3C,gBAAgB,EAAE,qCAAqC;IACvD,MAAM,EAAE;QACP,WAAW,EAAE,EAAE;QACf,MAAM,EAAE,CAAC,WAAW,EAAE,WAAW,EAAE,gBAAgB,CAAC;KACpD;IACD,WAAW,EAAE;QACZ;YACC,GAAG,EAAE,aAAa;YAClB,MAAM,EAAE,QAAQ;YAChB,YAAY,EAAE,WAAW;YACzB,KAAK,EAAE,KAAK;YACZ,QAAQ,EAAE,KAAK;SACf;QACD;YACC,GAAG,EAAE,aAAa;YAClB,MAAM,EAAE,QAAQ;YAChB,SAAS,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,wBAAwB,EAAE;YAC9D,QAAQ,EAAE,KAAK;SACf;KACD;IACD,UAAU,EAAE;QACX;YACC,EAAE,EAAE,MAAM;YACV,IAAI,EAAE,YAAY;YAClB,WAAW,EAAE,oFAAoF;YACjG,WAAW,EAAE,KAAK;SAClB;QACD;YACC,EAAE,EAAE,OAAO;YACX,IAAI,EAAE,uBAAuB;YAC7B,WAAW,EACV,oFAAoF;YACrF,WAAW,EAAE,KAAK;SAClB;QACD;YACC,EAAE,EAAE,SAAS;YACb,IAAI,EAAE,eAAe;YACrB,WAAW,EACV,sGAAsG;YACvG,WAAW,EAAE,KAAK;SAClB;QACD;YACC,EAAE,EAAE,cAAc;YAClB,IAAI,EAAE,yBAAyB;YAC/B,WAAW,EAAE,0DAA0D;YACvE,WAAW,EAAE,KAAK;SAClB;QACD;YACC,EAAE,EAAE,yBAAyB;YAC7B,IAAI,EAAE,8BAA8B;YACpC,WAAW,EAAE,qFAAqF;YAClG,WAAW,EAAE,KAAK;SAClB;KACD;IACD,IAAI,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC;CAC3D,CAAC,CAAC"}
@@ -0,0 +1,100 @@
1
+ import type { EmailIntegrationImplementation, EmailReceiveOptions } from '@vibesdotdev/email/services/email-integration';
2
+ import { BaseIntegrationProvider } from '@vibesdotdev/integrations/kinds/integration';
3
+ import type { IntegrationConnectionSelector, IntegrationOperationResult } from '@vibesdotdev/integrations/schemas/integration-descriptor';
4
+ import type { EmailHealthResult, EmailSendInput, EmailSendResult, EmailStatusResult } from '@vibesdotdev/email/schemas/email-data';
5
+ import type { EmailWebhookEvent } from '@vibesdotdev/email/schemas/email-webhook';
6
+ export declare class OutlookMailIntegration {
7
+ private readonly provider;
8
+ private readonly runtime;
9
+ constructor(...args: ConstructorParameters<typeof BaseIntegrationProvider>);
10
+ get descriptor(): {
11
+ id: string;
12
+ kind: "integration/provider";
13
+ requiredContext: string[];
14
+ optionalContext: string[];
15
+ provider: string;
16
+ category: "push" | "webhook" | "accounting" | "vcs" | "issue-tracker" | "productivity" | "ocr" | "email" | "messaging" | "sms" | "storage" | "analytics" | "observability" | "crm" | "calendar" | "other";
17
+ priority: number;
18
+ config: Record<string, import("@vibesdotdev/kernel/bootstrap").JsonValue>;
19
+ protectedConfigKeys: string[];
20
+ credentials: {
21
+ key: string;
22
+ source: "secret" | "setting";
23
+ required: boolean;
24
+ reference?: {
25
+ source: "secret";
26
+ key: string;
27
+ store?: string | undefined;
28
+ operation?: object | undefined;
29
+ } | undefined;
30
+ providerType?: string | undefined;
31
+ scope?: "user" | "platform" | "project" | "org" | undefined;
32
+ scopeId?: string | undefined;
33
+ settingKey?: string | undefined;
34
+ }[];
35
+ operations: {
36
+ id: string;
37
+ name: string;
38
+ requiresOrg: boolean;
39
+ description?: string | undefined;
40
+ }[];
41
+ name?: string | undefined;
42
+ description?: string | undefined;
43
+ tags?: string[] | undefined;
44
+ hardware?: string[] | undefined;
45
+ enabled?: boolean | undefined;
46
+ capabilityId?: string | undefined;
47
+ retention?: string | {
48
+ reason: string;
49
+ maxAgeDays?: number | undefined;
50
+ maxEntries?: number | undefined;
51
+ maxBytes?: number | undefined;
52
+ cascadeFrom?: string | undefined;
53
+ ageField?: string | undefined;
54
+ enforcedBy?: string | undefined;
55
+ } | undefined;
56
+ baseUrl?: string | undefined;
57
+ configurationSource?: "account" | "host" | undefined;
58
+ configSettingKey?: string | undefined;
59
+ oauth?: {
60
+ authorizationEndpoint: string;
61
+ tokenEndpoint: string;
62
+ scopes: string[];
63
+ configFromCallback: string[];
64
+ clientAuthentication: "form" | "basic";
65
+ bodyEncoding: "form" | "json";
66
+ headers: Record<string, string>;
67
+ authorizationParams?: Record<string, string> | undefined;
68
+ scopeIdCallbackParam?: string | undefined;
69
+ } | undefined;
70
+ connection?: {
71
+ connectable: boolean;
72
+ checkable: boolean;
73
+ requiresProviderAdmin: boolean;
74
+ authMode?: "delegated" | "oauth" | "webhook" | "system-config" | undefined;
75
+ } | undefined;
76
+ };
77
+ private requireDeclaredOperation;
78
+ getConfig(...args: Parameters<BaseIntegrationProvider['getConfig']>): ReturnType<BaseIntegrationProvider['getConfig']>;
79
+ getCredentials(...args: Parameters<BaseIntegrationProvider['getCredentials']>): ReturnType<BaseIntegrationProvider['getCredentials']>;
80
+ getCredential(...args: Parameters<BaseIntegrationProvider['getCredential']>): ReturnType<BaseIntegrationProvider['getCredential']>;
81
+ getCredentialUseConfiguration(...args: Parameters<BaseIntegrationProvider['getCredentialUseConfiguration']>): ReturnType<BaseIntegrationProvider['getCredentialUseConfiguration']>;
82
+ getResolvedConfiguration(...args: Parameters<BaseIntegrationProvider['getResolvedConfiguration']>): ReturnType<BaseIntegrationProvider['getResolvedConfiguration']>;
83
+ setCredential(...args: Parameters<BaseIntegrationProvider['setCredential']>): ReturnType<BaseIntegrationProvider['setCredential']>;
84
+ unsetCredential(...args: Parameters<BaseIntegrationProvider['unsetCredential']>): ReturnType<BaseIntegrationProvider['unsetCredential']>;
85
+ startAuthorization(...args: Parameters<BaseIntegrationProvider['startAuthorization']>): ReturnType<BaseIntegrationProvider['startAuthorization']>;
86
+ completeAuthorization(...args: Parameters<BaseIntegrationProvider['completeAuthorization']>): ReturnType<BaseIntegrationProvider['completeAuthorization']>;
87
+ invokeOperation(opId: string, args?: Parameters<EmailIntegrationImplementation['invokeOperation']>[1]): Promise<IntegrationOperationResult>;
88
+ invokeOperationForConnection(selector: Readonly<IntegrationConnectionSelector>, opId: string, args?: Parameters<EmailIntegrationImplementation['invokeOperation']>[1]): Promise<IntegrationOperationResult>;
89
+ private dispatch;
90
+ send(input: EmailSendInput, selector?: Readonly<IntegrationConnectionSelector>): Promise<EmailSendResult>;
91
+ check(messageId?: string, selector?: Readonly<IntegrationConnectionSelector>): Promise<EmailStatusResult | EmailHealthResult>;
92
+ receive(options?: EmailReceiveOptions, selector?: Readonly<IntegrationConnectionSelector>): Promise<EmailWebhookEvent[]>;
93
+ private readMessage;
94
+ private readAttachment;
95
+ private mailboxAddress;
96
+ private ambientHostReference;
97
+ private requireTarget;
98
+ }
99
+ export default OutlookMailIntegration;
100
+ //# sourceMappingURL=microsoft.impl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"microsoft.impl.d.ts","sourceRoot":"","sources":["../../../src/email/microsoft/microsoft.impl.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,8BAA8B,EAAC,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AACxH,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,KAAK,EACX,6BAA6B,EAC7B,0BAA0B,EAC1B,MAAM,0DAA0D,CAAC;AAClE,OAAO,KAAK,EACX,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AA4BlF,qBAAa,sBAAsB;IAClC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0B;IACnD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAa;gBACzB,GAAG,IAAI,EAAE,qBAAqB,CAAC,OAAO,uBAAuB,CAAC;IAI1E,IAAI,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAAuC;IACrD,OAAO,CAAC,wBAAwB;IAMhC,SAAS,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC,GAAG,UAAU,CAAC,uBAAuB,CAAC,WAAW,CAAC,CAAC;IACtH,cAAc,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAC,GAAG,UAAU,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAC;IACrI,aAAa,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,uBAAuB,CAAC,eAAe,CAAC,CAAC,GAAG,UAAU,CAAC,uBAAuB,CAAC,eAAe,CAAC,CAAC;IAClI,6BAA6B,CAAC,GAAG,IAAI,EA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AAQ,CAAC,6BAA6B,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC;IA2CxG,KAAK,CACV,SAAS,CAAC,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC,6BAA6B,CAAC,GAChD,OAAO,CAAC,iBAAiB,GAAC,iBAAiB,CAAC;IA8BzC,OAAO,CACZ,OAAO,GAAE,mBAAsB,EAC/B,QAAQ,CAAC,EAAE,QAAQ,CAAC,6BAA6B,CAAC,GAChD,OAAO,CAAC,iBAAiB,EAAE,CAAC;YA6BjB,WAAW;YAeX,cAAc;YAsBd,cAAc;IAgB5B,OAAO,CAAC,oBAAoB;YAWd,aAAa;CAgB3B;AAED,eAAe,sBAAsB,CAAC"}
@@ -0,0 +1,323 @@
1
+ import { CaughtFailureSchema, valueFreeFailure } from '@vibesdotdev/kernel';
2
+ /**
3
+ * Outlook integration implementation.
4
+ *
5
+ * Email feature on the existing Microsoft vendor: Graph `/me` mail over the
6
+ * same OAuth access token the Microsoft pack stores. Fetch-only (workerd-safe).
7
+ * Selected-account dispatch never falls back to ambient credentials.
8
+ *
9
+ * Send creates a Graph message (so the receipt id is real) then sends it.
10
+ */
11
+ import { invokeEmailIntegrationOperation } from '@vibesdotdev/email/services/email-integration';
12
+ import { BaseIntegrationProvider } from '@vibesdotdev/integrations/kinds/integration';
13
+ import { MAX_ATTACHMENT_BYTES, addressesEqual, bytesToBase64, cap, decodeBase64ToBytes, formatRecipient, mailboxAddress, stripAngleBrackets, toGraphRecipients } from "./outlook.mime.js";
14
+ const GRAPH_API = 'https://graph.microsoft.com/v1.0';
15
+ const DEFAULT_RECEIVE_LIMIT = 50;
16
+ const MAX_RECEIVE_LIMIT = 1000;
17
+ import { emailSendInputSchema } from '@vibesdotdev/email/schemas/email-data';
18
+ import * as S from "../../schemas/outlook.js";
19
+ import { admitMicrosoft, graphFailure, readMicrosoftJson, closeMicrosoftResponse } from "../../schemas/boundary.js";
20
+ import { CapabilityError } from '@vibesdotdev/kernel';
21
+ import { createMicrosoftSecretsFetch, microsoftDelegatedCredentialBinding } from "../../microsoft/secrets-fetch.js";
22
+ export class OutlookMailIntegration {
23
+ provider;
24
+ runtime;
25
+ constructor(...args) {
26
+ this.provider = new BaseIntegrationProvider(...args);
27
+ this.runtime = args[1].runtime;
28
+ }
29
+ get descriptor() { return this.provider.descriptor; }
30
+ requireDeclaredOperation(opId) {
31
+ if (!this.descriptor.operations?.some(operation => operation.id === opId)) {
32
+ throw new CapabilityError('Outlook operation is not declared.', 'INVALID_INPUT', { reason: 'microsoft-operation-undeclared' });
33
+ }
34
+ }
35
+ getConfig(...args) { return this.provider.getConfig(...args); }
36
+ getCredentials(...args) { return this.provider.getCredentials(...args); }
37
+ getCredential(...args) { return this.provider.getCredential(...args); }
38
+ getCredentialUseConfiguration(...args) { return this.provider.getCredentialUseConfiguration(...args); }
39
+ getResolvedConfiguration(...args) { return this.provider.getResolvedConfiguration(...args); }
40
+ setCredential(...args) { return this.provider.setCredential(...args); }
41
+ unsetCredential(...args) { return this.provider.unsetCredential(...args); }
42
+ startAuthorization(...args) { return this.provider.startAuthorization(...args); }
43
+ completeAuthorization(...args) { return this.provider.completeAuthorization(...args); }
44
+ async invokeOperation(opId, args) {
45
+ return this.dispatch(opId, args);
46
+ }
47
+ async invokeOperationForConnection(selector, opId, args) {
48
+ return this.dispatch(opId, args, selector);
49
+ }
50
+ async dispatch(opId, args, selector) {
51
+ this.requireDeclaredOperation(opId);
52
+ try {
53
+ if (opId === 'get-received') {
54
+ const { emailId } = admitMicrosoft(S.OutlookReceivedArgsSchema, args);
55
+ // SAFETY: integration/provider owns this generic compatibility surface; the get-received operation returns the validated inbound-event contract.
56
+ return { ok: true, data: await this.readMessage(emailId, selector) };
57
+ }
58
+ if (opId === 'get-received-attachment') {
59
+ const { emailId, attachmentId } = admitMicrosoft(S.OutlookAttachmentArgsSchema, args);
60
+ // SAFETY: integration/provider owns this generic compatibility surface; attachment content was checked against the selected-account receipt.
61
+ return { ok: true, data: { content: await this.readAttachment(emailId, attachmentId, selector) } };
62
+ }
63
+ if (opId === 'send' || opId === 'check' || opId === 'receive') {
64
+ return invokeEmailIntegrationOperation({
65
+ descriptor: this.descriptor,
66
+ send: (input) => this.send(input, selector),
67
+ check: (messageId) => this.check(messageId, selector),
68
+ receive: (options) => this.receive(options, selector)
69
+ }, opId, args);
70
+ }
71
+ throw new Error(`Outlook operation '${opId}' is not implemented.`);
72
+ }
73
+ catch (error) {
74
+ const failure = CaughtFailureSchema.parse(error);
75
+ if (failure instanceof CapabilityError)
76
+ throw failure;
77
+ throw new CapabilityError('Microsoft request failed.', 'UNAVAILABLE', {
78
+ reason: 'microsoft-request-failed', cause: failure, details: { failure: valueFreeFailure(failure) }
79
+ });
80
+ }
81
+ }
82
+ async send(input, selector) {
83
+ input = admitMicrosoft(emailSendInputSchema, input);
84
+ const target = await this.requireTarget(selector);
85
+ const mailbox = await this.mailboxAddress(target, selector);
86
+ if (selector && input.from && !addressesEqual(input.from, mailbox)) {
87
+ throw new CapabilityError('Selected Outlook delivery requires the saved connection sender.', 'PERMISSION_DENIED', { reason: 'outlook-sender-mismatch' });
88
+ }
89
+ const to = Array.isArray(input.to) ? input.to : [input.to];
90
+ if (to.length === 0)
91
+ throw new Error('Outlook send requires at least one recipient.');
92
+ const bodyContent = input.html ?? input.text ?? '';
93
+ const draft = {
94
+ subject: input.subject, body: { contentType: input.html ? 'HTML' : 'Text', content: bodyContent },
95
+ toRecipients: toGraphRecipients(to)
96
+ };
97
+ if (input.cc?.length)
98
+ draft.ccRecipients = toGraphRecipients(input.cc);
99
+ if (input.bcc?.length)
100
+ draft.bccRecipients = toGraphRecipients(input.bcc);
101
+ if (input.replyTo)
102
+ draft.replyTo = toGraphRecipients([input.replyTo]);
103
+ if (input.inReplyTo)
104
+ draft.internetMessageHeaders = [{ name: 'In-Reply-To', value: input.inReplyTo }];
105
+ if (input.attachments?.length)
106
+ draft.attachments = input.attachments.map(attachment => ({
107
+ '@odata.type': '#microsoft.graph.fileAttachment', name: attachment.filename, contentType: attachment.contentType,
108
+ contentBytes: attachment.content, contentId: attachment.contentId, isInline: attachment.disposition === 'inline'
109
+ }));
110
+ const t0 = Date.now();
111
+ const created = await graphFetch(target.fetch, '/me/messages', {
112
+ method: 'POST',
113
+ headers: { 'Content-Type': 'application/json' },
114
+ body: JSON.stringify(draft)
115
+ });
116
+ if (!created.ok)
117
+ throw await graphFailure(created);
118
+ const message = await readMicrosoftJson(created, S.GraphMessageReceiptSchema);
119
+ const sent = await graphFetch(target.fetch, `/me/messages/${encodeURIComponent(message.id)}/send`, {
120
+ method: 'POST'
121
+ });
122
+ if (!sent.ok)
123
+ throw await graphFailure(sent);
124
+ await closeMicrosoftResponse(sent);
125
+ return {
126
+ messageId: message.id,
127
+ providerId: this.descriptor.id,
128
+ durationMs: Date.now() - t0
129
+ };
130
+ }
131
+ async check(messageId, selector) {
132
+ const target = await this.requireTarget(selector);
133
+ if (messageId) {
134
+ const response = await graphFetch(target.fetch, `/me/messages/${encodeURIComponent(messageId)}?$select=id,isDraft,sentDateTime`);
135
+ if (!response.ok) {
136
+ throw await graphFailure(response);
137
+ }
138
+ const data = await readMicrosoftJson(response, S.GraphMessageReceiptSchema);
139
+ if (data.id !== messageId)
140
+ throw new CapabilityError('Microsoft Graph receipt does not match the request.', 'UNAVAILABLE', { reason: 'microsoft-graph-receipt-mismatch' });
141
+ return {
142
+ messageId,
143
+ status: data.isDraft ? 'queued' : 'sent',
144
+ providerId: this.descriptor.id,
145
+ timestamp: data.sentDateTime
146
+ };
147
+ }
148
+ const response = await graphFetch(target.fetch, '/me?$select=mail,userPrincipalName');
149
+ if (!response.ok) {
150
+ throw await graphFailure(response);
151
+ }
152
+ const profile = await readMicrosoftJson(response, S.GraphProfileSchema);
153
+ if (!profileMailbox(profile)) {
154
+ throw new CapabilityError('Outlook profile is missing mail.', 'UNAVAILABLE', { reason: 'outlook-mailbox-missing' });
155
+ }
156
+ return { ok: true, providerId: this.descriptor.id };
157
+ }
158
+ async receive(options = {}, selector) {
159
+ const target = await this.requireTarget(selector);
160
+ const parsedOptions = admitMicrosoft(S.OutlookReceiveOptionsSchema, options);
161
+ const requested = parsedOptions.limit ?? DEFAULT_RECEIVE_LIMIT;
162
+ const limit = Math.min(MAX_RECEIVE_LIMIT, Math.max(1, Math.floor(requested)));
163
+ const filters = [];
164
+ if (parsedOptions.since) {
165
+ const since = Date.parse(parsedOptions.since);
166
+ if (!Number.isFinite(since))
167
+ throw new Error('Outlook receive `since` must be an ISO 8601 timestamp.');
168
+ filters.push(`receivedDateTime ge ${new Date(since).toISOString()}`);
169
+ }
170
+ if (parsedOptions.unseenOnly === true)
171
+ filters.push('isRead eq false');
172
+ const params = new URLSearchParams({
173
+ $top: String(limit),
174
+ $orderby: 'receivedDateTime desc',
175
+ $select: 'id,internetMessageId,subject,from,toRecipients,ccRecipients,replyTo,receivedDateTime,body,hasAttachments,conversationId'
176
+ });
177
+ if (filters.length)
178
+ params.set('$filter', filters.join(' and '));
179
+ const list = await graphFetch(target.fetch, `/me/messages?${params.toString()}`);
180
+ if (!list.ok)
181
+ throw await graphFailure(list);
182
+ const payload = await readMicrosoftJson(list, S.GraphMessageListSchema);
183
+ const events = [];
184
+ for (const message of payload.value ?? []) {
185
+ events.push(toInboundEvent(this.descriptor.provider ?? 'microsoft', message));
186
+ }
187
+ return events;
188
+ }
189
+ async readMessage(emailId, selector) {
190
+ const target = await this.requireTarget(selector);
191
+ const response = await graphFetch(target.fetch, `/me/messages/${encodeURIComponent(emailId)}?$expand=attachments($select=id,name,contentType,size,isInline,contentId)`);
192
+ if (!response.ok)
193
+ throw await graphFailure(response);
194
+ const resource = await readMicrosoftJson(response, S.GraphMessageReceiptSchema);
195
+ if (resource.id !== emailId)
196
+ throw new CapabilityError('Microsoft Graph receipt does not match the request.', 'UNAVAILABLE', { reason: 'microsoft-graph-receipt-mismatch' });
197
+ return toInboundEvent(this.descriptor.provider ?? 'microsoft', resource);
198
+ }
199
+ async readAttachment(emailId, attachmentId, selector) {
200
+ const target = await this.requireTarget(selector);
201
+ const response = await graphFetch(target.fetch, `/me/messages/${encodeURIComponent(emailId)}/attachments/${encodeURIComponent(attachmentId)}`);
202
+ if (!response.ok)
203
+ throw await graphFailure(response);
204
+ const body = await readMicrosoftJson(response, S.GraphFileAttachmentSchema);
205
+ if (body.id !== attachmentId)
206
+ throw new CapabilityError('Microsoft Graph receipt does not match the request.', 'UNAVAILABLE', { reason: 'microsoft-graph-receipt-mismatch' });
207
+ if (body.size !== undefined && (body.size < 0 || body.size > MAX_ATTACHMENT_BYTES)) {
208
+ throw new Error('Attachment exceeds its allowed size');
209
+ }
210
+ if (!body.contentBytes)
211
+ throw new Error('Attachment body is missing');
212
+ const bytes = decodeBase64ToBytes(body.contentBytes);
213
+ if (bytes.byteLength > MAX_ATTACHMENT_BYTES)
214
+ throw new Error('Attachment exceeds its allowed size');
215
+ return bytesToBase64(bytes);
216
+ }
217
+ async mailboxAddress(target, selector) {
218
+ const configured = target.defaultFrom;
219
+ const response = await graphFetch(target.fetch, '/me?$select=mail,userPrincipalName');
220
+ if (!response.ok)
221
+ throw await graphFailure(response);
222
+ const profile = await readMicrosoftJson(response, S.GraphProfileSchema);
223
+ const mailbox = profileMailbox(profile);
224
+ if (!mailbox)
225
+ throw new CapabilityError('Outlook profile is missing mail.', 'UNAVAILABLE', { reason: 'outlook-mailbox-missing' });
226
+ if (selector && configured && !addressesEqual(configured, mailbox)) {
227
+ throw new CapabilityError('Saved Outlook sender does not match the authenticated mailbox.', 'PERMISSION_DENIED', { reason: 'outlook-sender-mismatch' });
228
+ }
229
+ return configured && addressesEqual(configured, mailbox) ? configured : mailbox;
230
+ }
231
+ ambientHostReference(candidate) {
232
+ // Host references are declared secrets; an OAuth account candidate is never ambient.
233
+ if (candidate.source !== 'secret')
234
+ return false;
235
+ return (this.descriptor.credentials ?? []).some(source => source.reference !== undefined && source.scope === undefined
236
+ && source.reference.source === candidate.source
237
+ && source.reference.key === candidate.key
238
+ && source.reference.store === candidate.store);
239
+ }
240
+ async requireTarget(selector) {
241
+ const { config, credentialReferences } = await this.provider.getCredentialUseConfiguration(selector);
242
+ const declared = credentialReferences.accessToken ?? [];
243
+ // A selected mailbox names its saved account. The ambient host reference is not that account.
244
+ const candidates = selector ? declared.filter(candidate => !this.ambientHostReference(candidate)) : declared;
245
+ if (candidates.length === 0) {
246
+ throw new CapabilityError('Outlook requires a connected Microsoft account.', 'AUTH_REQUIRED', { reason: 'microsoft-account-disconnected' });
247
+ }
248
+ return {
249
+ fetch: createMicrosoftSecretsFetch(this.runtime, microsoftDelegatedCredentialBinding(candidates)),
250
+ defaultFrom: admitMicrosoft(S.OutlookConfigSchema, config).defaultFrom?.trim() ?? ''
251
+ };
252
+ }
253
+ }
254
+ export default OutlookMailIntegration;
255
+ function profileMailbox(profile) {
256
+ if (profile.mail?.trim())
257
+ return profile.mail.trim();
258
+ if (profile.userPrincipalName?.includes('@')) {
259
+ return profile.userPrincipalName.trim();
260
+ }
261
+ return '';
262
+ }
263
+ function toInboundEvent(provider, message) {
264
+ const from = formatRecipient(message.from);
265
+ const toAll = (message.toRecipients ?? []).map(formatRecipient).filter(Boolean);
266
+ const rfcId = stripAngleBrackets(message.internetMessageId ?? '') || message.id || '';
267
+ const createdAt = message.receivedDateTime ?? new Date().toISOString();
268
+ const html = message.body?.contentType?.toLowerCase() === 'html' ? message.body.content ?? '' : '';
269
+ const text = message.body?.contentType?.toLowerCase() === 'html' ? '' : message.body?.content ?? '';
270
+ return {
271
+ provider,
272
+ messageId: rfcId,
273
+ status: 'received',
274
+ to: toAll[0] ? mailboxAddress(toAll[0]) || toAll[0] : undefined,
275
+ timestamp: createdAt,
276
+ raw: {
277
+ direction: 'inbound',
278
+ graph_id: message.id ?? '',
279
+ conversation_id: message.conversationId ?? '',
280
+ message_id: rfcId,
281
+ from,
282
+ from_address: message.from?.emailAddress?.address ?? '',
283
+ from_name: message.from?.emailAddress?.name ?? '',
284
+ to: toAll[0] ?? '',
285
+ to_all: toAll,
286
+ cc: (message.ccRecipients ?? []).map(formatRecipient).filter(Boolean),
287
+ reply_to: formatRecipient(message.replyTo?.[0]),
288
+ subject: message.subject ?? '',
289
+ text: cap(text),
290
+ html: cap(html),
291
+ attachments: (message.attachments ?? []).map((attachment) => ({
292
+ filename: attachment.name,
293
+ content_type: attachment.contentType ?? 'application/octet-stream',
294
+ content_id: attachment.contentId ? stripAngleBrackets(attachment.contentId) : undefined,
295
+ disposition: attachment.isInline ? 'inline' : 'attachment',
296
+ attachment_id: attachment.id,
297
+ encoded_length: attachment.size
298
+ })),
299
+ created_at: createdAt
300
+ }
301
+ };
302
+ }
303
+ async function graphFetch(fetchFn, path, init = {}) {
304
+ const headers = new Headers(init.headers);
305
+ headers.delete('Authorization');
306
+ try {
307
+ return await fetchFn(`${GRAPH_API}${path}`, {
308
+ ...init,
309
+ headers,
310
+ redirect: 'error',
311
+ signal: init.signal ?? AbortSignal.timeout(20_000)
312
+ });
313
+ }
314
+ catch (error) {
315
+ const failure = CaughtFailureSchema.parse(error);
316
+ if (failure instanceof CapabilityError)
317
+ throw failure;
318
+ throw new CapabilityError('Microsoft request failed.', 'UNAVAILABLE', {
319
+ reason: 'microsoft-request-failed', cause: failure, details: { failure: valueFreeFailure(failure) }
320
+ });
321
+ }
322
+ }
323
+ //# sourceMappingURL=microsoft.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"microsoft.impl.js","sourceRoot":"","sources":["../../../src/email/microsoft/microsoft.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAC,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC3E;;;;;;;;GAQG;AAEH,OAAO,EAAE,+BAA+B,EAAE,MAAM,+CAA+C,CAAC;AAEhG,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAYtF,OAAO,EACN,oBAAoB,EACpB,cAAc,EACd,aAAa,EACb,GAAG,EACH,mBAAmB,EACnB,eAAe,EACf,cAAc,E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