@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,18 @@
1
+ /**
2
+ * Outlook / Graph mail address + inbound mapping helpers. Universal-scope.
3
+ */
4
+ export declare const MAX_BODY_CHARS = 200000;
5
+ export declare const MAX_ATTACHMENT_BYTES: number;
6
+ import type { GraphRecipient, Mailbox } from '../../schemas/outlook.ts';
7
+ export type { GraphRecipient, GraphMessage, GraphFileAttachment } from '../../schemas/outlook.ts';
8
+ export declare function mailboxAddress(value: string): string;
9
+ export declare function splitMailbox(mailbox: string): Mailbox;
10
+ export declare function addressesEqual(left: string, right: string): boolean;
11
+ export declare function cap(value: string, max?: number): string;
12
+ export declare function formatRecipient(recipient: GraphRecipient | undefined): string;
13
+ export declare function recipientAddresses(recipients: GraphRecipient[] | undefined): string[];
14
+ export declare function toGraphRecipients(values: string[] | undefined): GraphRecipient[];
15
+ export declare function stripAngleBrackets(value: string): string;
16
+ export declare function bytesToBase64(bytes: Uint8Array): string;
17
+ export declare function decodeBase64ToBytes(data: string): Uint8Array;
18
+ //# sourceMappingURL=outlook.mime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outlook.mime.d.ts","sourceRoot":"","sources":["../../../src/email/microsoft/outlook.mime.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,cAAc,SAAQ,CAAC;AACpC,eAAO,MAAM,oBAAoB,QAAa,CAAC;AAE/C,OAAO,KAAK,EAAE,cAAc,EAAC,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACvE,YAAY,EAAE,cAAc,EAAC,YAAY,EAAC,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEhG,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGpD;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAQrD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAElE;AAED,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAC,GAAG,SAAe,GAAG,MAAM,CAE5D;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,cAAc,GAAC,SAAS,GAAG,MAAM,CAK3E;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,cAAc,EAAE,GAAC,SAAS,GAAG,MAAM,EAAE,CAInF;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAC,SAAS,GAAG,cAAc,EAAE,CAK9E;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAMvD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAK5D"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Outlook / Graph mail address + inbound mapping helpers. Universal-scope.
3
+ */
4
+ export const MAX_BODY_CHARS = 200_000;
5
+ export const MAX_ATTACHMENT_BYTES = 25 * 1024 * 1024;
6
+ export function mailboxAddress(value) {
7
+ const match = value.match(/<([^>]+)>/);
8
+ return (match ? match[1] : value).trim().toLowerCase();
9
+ }
10
+ export function splitMailbox(mailbox) {
11
+ const match = mailbox.match(/^\s*(?:"?([^"<]+?)"?\s+)?<([^>]+)>\s*$/);
12
+ if (match) {
13
+ const parsed = { addr: match[2].trim() };
14
+ if (match[1])
15
+ parsed.name = match[1].trim();
16
+ return parsed;
17
+ }
18
+ return { addr: mailbox.trim() };
19
+ }
20
+ export function addressesEqual(left, right) {
21
+ return mailboxAddress(left) === mailboxAddress(right);
22
+ }
23
+ export function cap(value, max = MAX_BODY_CHARS) {
24
+ return value.length <= max ? value : value.slice(0, max);
25
+ }
26
+ export function formatRecipient(recipient) {
27
+ const address = recipient?.emailAddress?.address ?? '';
28
+ const name = recipient?.emailAddress?.name ?? '';
29
+ if (name && address)
30
+ return `${name} <${address}>`;
31
+ return address;
32
+ }
33
+ export function recipientAddresses(recipients) {
34
+ return (recipients ?? [])
35
+ .map((recipient) => recipient.emailAddress?.address?.trim() ?? '')
36
+ .filter(Boolean);
37
+ }
38
+ export function toGraphRecipients(values) {
39
+ return (values ?? []).map((value) => {
40
+ const { addr, name } = splitMailbox(value);
41
+ return { emailAddress: { address: addr, name } };
42
+ });
43
+ }
44
+ export function stripAngleBrackets(value) {
45
+ return value.replace(/^<|>$/g, '').trim();
46
+ }
47
+ export function bytesToBase64(bytes) {
48
+ let binary = '';
49
+ for (let offset = 0; offset < bytes.length; offset += 8192) {
50
+ binary += String.fromCharCode(...bytes.subarray(offset, offset + 8192));
51
+ }
52
+ return btoa(binary);
53
+ }
54
+ export function decodeBase64ToBytes(data) {
55
+ const binary = atob(data);
56
+ const bytes = new Uint8Array(binary.length);
57
+ for (let i = 0; i < binary.length; i++)
58
+ bytes[i] = binary.charCodeAt(i);
59
+ return bytes;
60
+ }
61
+ //# sourceMappingURL=outlook.mime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outlook.mime.js","sourceRoot":"","sources":["../../../src/email/microsoft/outlook.mime.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAC,OAAO,CAAC;AACpC,MAAM,CAAC,MAAM,oBAAoB,GAAC,EAAE,GAAC,IAAI,GAAC,IAAI,CAAC;AAK/C,MAAM,UAAU,cAAc,CAAC,KAAa;IAC3C,MAAM,KAAK,GAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACrC,OAAO,CAAC,KAAK,CAAA,CAAC,CAAC,KAAK,CAAC,CAAC,CAAE,CAAA,CAAC,CAAA,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AACtD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AAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAC/D,OAAO,KAAK,CAAC;AACd,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Runtime plugin for the Outlook mail feature pack.
3
+ *
4
+ * Registers the `integration/provider` (`integration.email.microsoft`) plus
5
+ * the dual-registered `email/transport` adapter. Lives on the existing
6
+ * Microsoft vendor package — not a new host or SKU.
7
+ */
8
+ export declare const microsoftEmailPlugin: import("@vibesdotdev/kernel").RuntimePlugin;
9
+ export default microsoftEmailPlugin;
10
+ //# sourceMappingURL=microsoft-email.plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"microsoft-email.plugin.d.ts","sourceRoot":"","sources":["../../src/email/microsoft-email.plugin.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAWH,eAAO,MAAM,oBAAoB,6CAgB/B,CAAC;AAEH,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Runtime plugin for the Outlook mail feature pack.
3
+ *
4
+ * Registers the `integration/provider` (`integration.email.microsoft`) plus
5
+ * the dual-registered `email/transport` adapter. Lives on the existing
6
+ * Microsoft vendor package — not a new host or SKU.
7
+ */
8
+ import { createRuntimePlugin, loader } from '@vibesdotdev/kernel/factory';
9
+ import { IntegrationBackedEmailTransport, createIntegrationBackedEmailTransportDescriptor } from '@vibesdotdev/email/services/email-transport';
10
+ import outlookMailDescriptor from "./microsoft/microsoft.descriptor.js";
11
+ const outlookTransportDescriptor = createIntegrationBackedEmailTransportDescriptor(outlookMailDescriptor);
12
+ export const microsoftEmailPlugin = createRuntimePlugin({
13
+ id: 'integrations-microsoft/email',
14
+ name: 'Outlook Mail Integration',
15
+ description: 'Microsoft Graph mail feature on the existing Microsoft 365 integration: send, check, and pull-mode receive.',
16
+ dependencies: ['integrations', 'email'],
17
+ descriptors: [outlookMailDescriptor, outlookTransportDescriptor],
18
+ loaders: [
19
+ loader(outlookMailDescriptor.id, { kind: 'integration/provider' }, async () => {
20
+ const { OutlookMailIntegration } = await import("./microsoft/microsoft.impl.js");
21
+ return { default: OutlookMailIntegration };
22
+ }),
23
+ loader(outlookTransportDescriptor.id, { kind: 'email/transport' }, async () => ({
24
+ default: IntegrationBackedEmailTransport
25
+ }))
26
+ ]
27
+ });
28
+ export default microsoftEmailPlugin;
29
+ //# sourceMappingURL=microsoft-email.plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"microsoft-email.plugin.js","sourceRoot":"","sources":["../../src/email/microsoft-email.plugin.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EACN,+BAA+B,EAC/B,+CAA+C,EAC/C,MAAM,6CAA6C,CAAC;AACrD,OAAO,qBAAqB,MAAM,qCAAqC,CAAC;AAExE,MAAM,0BAA0B,GAAG,+CAA+C,CAAC,qBAAqB,CAAC,CAAC;AAE1G,MAAM,CAAC,MAAM,oBAAoB,GAAG,mBAAmB,CAAC;IACvD,EAAE,EAAE,8BAA8B;IAClC,IAAI,EAAE,0BAA0B;IAChC,WAAW,EACV,6GAA6G;IAC9G,YAAY,EAAE,CAAC,cAAc,EAAE,OAAO,CAAC;IACvC,WAAW,EAAE,CAAC,qBAAqB,EAAE,0BAA0B,CAAC;IAChE,OAAO,EAAE;QACR,MAAM,CAAC,qBAAqB,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,sBAAsB,EAAE,EAAE,KAAK,IAAI,EAAE;YAC7E,MAAM,EAAE,sBAAsB,EAAE,GAAG,MAAM,MAAM,CAAC,+BAA+B,CAAC,CAAC;YACjF,OAAO,EAAE,OAAO,EAAE,sBAAsB,EAAE,CAAC;QAC5C,CAAC,CAAC;QACF,MAAM,CAAC,0BAA0B,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;YAC/E,OAAO,EAAE,+BAA+B;SACxC,CAAC,CAAC;KACH;CACD,CAAC,CAAC;AAEH,eAAe,oBAAoB,CAAC"}
@@ -0,0 +1,9 @@
1
+ /** Isomorphic Microsoft 365 client and contracts. Full Node composition lives at ./plugin. */
2
+ export { microsoftClientPlugin, microsoftClientPlugin as default } from './api-client-plugin.ts';
3
+ export { MicrosoftClient, getVibesMicrosoftClient } from './client/index.ts';
4
+ export type { MicrosoftClientMode } from './schemas/operations.ts';
5
+ export * from './schemas/graph.ts';
6
+ export { default as microsoftDescriptor } from './microsoft/system.integration.microsoft.descriptor.ts';
7
+ export { default as microsoftDelegatedDescriptor } from './microsoft/system.integration.microsoft.delegated.descriptor.ts';
8
+ export { microsoftEmailPlugin } from './email/microsoft-email.plugin.ts';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,OAAO,EAAE,qBAAqB,EAAC,qBAAqB,IAAI,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAChG,OAAO,EAAE,eAAe,EAAC,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5E,YAAY,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AACxG,OAAO,EAAE,OAAO,IAAI,4BAA4B,EAAE,MAAM,kEAAkE,CAAC;AAC3H,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ /** Isomorphic Microsoft 365 client and contracts. Full Node composition lives at ./plugin. */
2
+ export { microsoftClientPlugin, microsoftClientPlugin as default } from "./api-client-plugin.js";
3
+ export { MicrosoftClient, getVibesMicrosoftClient } from "./client/index.js";
4
+ export * from "./schemas/graph.js";
5
+ export { default as microsoftDescriptor } from "./microsoft/system.integration.microsoft.descriptor.js";
6
+ export { default as microsoftDelegatedDescriptor } from "./microsoft/system.integration.microsoft.delegated.descriptor.js";
7
+ export { microsoftEmailPlugin } from "./email/microsoft-email.plugin.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,OAAO,EAAE,qBAAqB,EAAC,qBAAqB,IAAI,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAChG,OAAO,EAAE,eAAe,EAAC,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAE5E,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AACxG,OAAO,EAAE,OAAO,IAAI,4BAA4B,EAAE,MAAM,kEAAkE,CAAC;AAC3H,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC"}
@@ -0,0 +1,4 @@
1
+ /** Compatibility composition for Node hosts. Browser/Worker hosts compose the explicit narrow slices. */
2
+ export declare const integrationsMicrosoftPlugin: import("@vibesdotdev/kernel").RuntimePlugin;
3
+ export default integrationsMicrosoftPlugin;
4
+ //# sourceMappingURL=integrations-microsoft.plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integrations-microsoft.plugin.d.ts","sourceRoot":"","sources":["../src/integrations-microsoft.plugin.ts"],"names":[],"mappings":"AAIA,yGAAyG;AACzG,eAAO,MAAM,2BAA2B,6CAOtC,CAAC;AACH,eAAe,2BAA2B,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { createRuntimePlugin } from '@vibesdotdev/kernel/factory';
2
+ import client from "./api-client-plugin.js";
3
+ import cloud from "./cloud.plugin.js";
4
+ import consumer from "./microsoft.consumer.plugin.js";
5
+ /** Compatibility composition for Node hosts. Browser/Worker hosts compose the explicit narrow slices. */
6
+ export const integrationsMicrosoftPlugin = createRuntimePlugin({
7
+ id: 'integrations-microsoft', name: 'Microsoft 365',
8
+ async onRegister(runtime) {
9
+ await client.onRegister?.(runtime);
10
+ await cloud.onRegister?.(runtime);
11
+ await consumer.onRegister?.(runtime);
12
+ }
13
+ });
14
+ export default integrationsMicrosoftPlugin;
15
+ //# sourceMappingURL=integrations-microsoft.plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integrations-microsoft.plugin.js","sourceRoot":"","sources":["../src/integrations-microsoft.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,MAAM,MAAM,wBAAwB,CAAC;AAC5C,OAAO,KAAK,MAAM,mBAAmB,CAAC;AACtC,OAAO,QAAQ,MAAM,gCAAgC,CAAC;AACtD,yGAAyG;AACzG,MAAM,CAAC,MAAM,2BAA2B,GAAC,mBAAmB,CAAC;IAC5D,EAAE,EAAE,wBAAwB,EAAC,IAAI,EAAE,eAAe;IAClD,KAAK,CAAC,UAAU,CAAC,OAAO;QACvB,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,CAAC;QACnC,MAAM,KAAK,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,CAAC;QAClC,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;CACD,CAAC,CAAC;AACH,eAAe,2BAA2B,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { DriveItemEntry, DriveItemSearchResult } from './graph-schemas.ts';
2
+ import type { GraphSharePointClient } from './graph-sharepoint-client.ts';
3
+ export declare function normalizeGraphDrivePath(path: string): string;
4
+ export declare function isGraphPathAddressingFailure(err: unknown): boolean;
5
+ export declare function browseDriveWithPathFallback(client: GraphSharePointClient, siteId: string, folderPath?: string): Promise<DriveItemEntry[]>;
6
+ export declare function searchDriveWithPathFallback(client: GraphSharePointClient, siteId: string, query: string, opts?: {
7
+ scopePath?: string;
8
+ limit?: number;
9
+ }): Promise<DriveItemSearchResult[]>;
10
+ export declare function resolveFolderItemId(client: GraphSharePointClient, siteId: string, folderPath: string): Promise<string | null>;
11
+ //# sourceMappingURL=graph-drive-fallback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-drive-fallback.d.ts","sourceRoot":"","sources":["../../src/microsoft/graph-drive-fallback.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAC,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAE1E,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM5D;AA0BD,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAIlE;AAED,wBAAsB,2BAA2B,CAChD,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,MAAM,GACjB,OAAO,CAAC,cAAc,EAAE,CAAC,CAO3B;AAED,wBAAsB,2BAA2B,CAChD,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CAAE,GAC5C,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAelC;AAED,wBAAsB,mBAAmB,CACxC,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,GAAC,IAAI,CAAC,CAwBtB"}
@@ -0,0 +1,90 @@
1
+ import { CaughtFailureSchema, settle } from '@vibesdotdev/kernel';
2
+ import { MicrosoftGraphError } from "../schemas/boundary.js";
3
+ export function normalizeGraphDrivePath(path) {
4
+ return path
5
+ .split('/')
6
+ .map((segment) => segment.trim())
7
+ .filter((segment) => segment.length > 0)
8
+ .join('/');
9
+ }
10
+ function splitPathLikeSearchQuery(query) {
11
+ const normalized = normalizeGraphDrivePath(query);
12
+ if (!normalized.includes('/'))
13
+ return null;
14
+ const segments = normalized.split('/');
15
+ const leaf = segments.at(-1);
16
+ if (!leaf)
17
+ return null;
18
+ const scopePath = segments.slice(0, -1).join('/');
19
+ if (!scopePath)
20
+ return null;
21
+ return { scopePath, query: leaf };
22
+ }
23
+ function filterSearchHitsToScope(hits, scopePath, limit) {
24
+ const normalizedScope = normalizeGraphDrivePath(scopePath);
25
+ const scoped = hits.filter((hit) => {
26
+ const parentPath = normalizeGraphDrivePath(hit.parentPath);
27
+ return parentPath === normalizedScope || parentPath.startsWith(`${normalizedScope}/`);
28
+ });
29
+ return scoped.slice(0, limit ?? 50);
30
+ }
31
+ export function isGraphPathAddressingFailure(err) {
32
+ const failure = CaughtFailureSchema.parse(err);
33
+ return failure instanceof MicrosoftGraphError && (failure.status === 500 ||
34
+ (failure.status === 404 && (failure.graphCode === 'itemNotFound' || failure.graphCode === 'ResourceNotFound')));
35
+ }
36
+ export async function browseDriveWithPathFallback(client, siteId, folderPath) {
37
+ const attempt = await settle(() => client.browseDrive(siteId, folderPath));
38
+ if (attempt.ok)
39
+ return attempt.value;
40
+ if (!folderPath || !isGraphPathAddressingFailure(attempt.cause))
41
+ throw attempt.cause;
42
+ const folderId = await resolveFolderItemId(client, siteId, folderPath);
43
+ if (!folderId)
44
+ throw attempt.cause;
45
+ return client.browseDriveItem(siteId, folderId);
46
+ }
47
+ export async function searchDriveWithPathFallback(client, siteId, query, opts) {
48
+ const pathLikeQuery = opts?.scopePath ? null : splitPathLikeSearchQuery(query);
49
+ if (pathLikeQuery) {
50
+ return searchDriveWithPathFallback(client, siteId, pathLikeQuery.query, {
51
+ scopePath: pathLikeQuery.scopePath,
52
+ limit: opts?.limit
53
+ });
54
+ }
55
+ const attempt = await settle(() => client.searchDrive(siteId, query, {
56
+ scopePath: opts?.scopePath, limit: opts?.limit
57
+ }));
58
+ if (!attempt.ok && (!opts?.scopePath || !isGraphPathAddressingFailure(attempt.cause)))
59
+ throw attempt.cause;
60
+ if (attempt.ok && (!opts?.scopePath || attempt.value.length > 0))
61
+ return attempt.value;
62
+ const fallback = await client.searchDrive(siteId, query, { limit: 200 });
63
+ return opts?.scopePath ? filterSearchHitsToScope(fallback, opts.scopePath, opts.limit) : fallback;
64
+ }
65
+ export async function resolveFolderItemId(client, siteId, folderPath) {
66
+ const normalized = normalizeGraphDrivePath(folderPath);
67
+ if (!normalized)
68
+ return null;
69
+ const segments = normalized.split('/');
70
+ const folderName = segments.at(-1);
71
+ if (!folderName)
72
+ return null;
73
+ const parentPath = segments.slice(0, -1).join('/');
74
+ const attempt = await settle(() => client.searchDrive(siteId, folderName, {
75
+ scopePath: parentPath || undefined, limit: 25
76
+ }));
77
+ if (!attempt.ok && !isGraphPathAddressingFailure(attempt.cause))
78
+ throw attempt.cause;
79
+ const hits = !attempt.ok || (parentPath && !attempt.value.some(hit => hit.isFolder))
80
+ ? await client.searchDrive(siteId, folderName, { limit: 100 })
81
+ : attempt.value;
82
+ const match = hits.find((hit) => {
83
+ if (!hit.isFolder)
84
+ return false;
85
+ return (normalizeGraphDrivePath(`${hit.parentPath ? `${hit.parentPath}/` : ''}${hit.name}`) ===
86
+ normalized);
87
+ });
88
+ return match?.id ?? null;
89
+ }
90
+ //# sourceMappingURL=graph-drive-fallback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-drive-fallback.js","sourceRoot":"","sources":["../../src/microsoft/graph-drive-fallback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAC,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAI7D,MAAM,UAAU,uBAAuB,CAAC,IAAY;IACnD,OAAO,IAAI;SACT,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,OAAO,EAAE,EA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CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from '../schemas/graph.ts';
2
+ //# sourceMappingURL=graph-schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-schemas.d.ts","sourceRoot":"","sources":["../../src/microsoft/graph-schemas.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "../schemas/graph.js";
2
+ //# sourceMappingURL=graph-schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-schemas.js","sourceRoot":"","sources":["../../src/microsoft/graph-schemas.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,219 @@
1
+ import { type SharePointSite, type GraphDrive, type DriveItemEntry, type DriveItemSearchResult } from './graph-schemas.ts';
2
+ import type { MicrosoftFetch } from './secrets-fetch.ts';
3
+ /**
4
+ * Sentinel "site id" that targets the signed-in user's personal OneDrive
5
+ * (`/me/drive`) instead of a SharePoint site. Delegated only — app-only tokens
6
+ * have no `/me`. Used as a drive id by the explorer for the "OneDrive" entry.
7
+ */
8
+ export declare const ONEDRIVE_SITE_ID = "me";
9
+ /**
10
+ * Legacy direct-call token acquirer. Registered providers use the
11
+ * Secrets-owned `authenticatedFetch` transport instead.
12
+ */
13
+ export interface MicrosoftTokenAcquirer {
14
+ acquireToken(scopes?: string[]): Promise<{
15
+ accessToken: string;
16
+ }>;
17
+ }
18
+ export interface GraphClientConfig {
19
+ /** Legacy token acquirer for direct callers; providers use authenticatedFetch. */
20
+ integration?: MicrosoftTokenAcquirer;
21
+ /** Secrets-owned authenticated transport. */
22
+ authenticatedFetch?: MicrosoftFetch;
23
+ /** Unauthenticated far-boundary fetch, including pre-authenticated upload sessions. */
24
+ fetchFn?: MicrosoftFetch;
25
+ }
26
+ /**
27
+ * Microsoft Graph API client for SharePoint operations.
28
+ *
29
+ * Provides listSites(), browseDrive(), and downloadFile() methods.
30
+ * Uses the runtime-supplied authenticated transport for registered
31
+ * providers. App-only access requires the Sites.Read.All (read) /
32
+ * Sites.ReadWrite.All (write) + Files.Read.All/Files.ReadWrite.All APPLICATION
33
+ * permissions, admin-consented into the org's tenant — Sites.Selected does NOT
34
+ * satisfy the `GET /sites?search=*` site enumeration listSites() relies on.
35
+ */
36
+ export declare class GraphSharePointClient {
37
+ private readonly integration;
38
+ private readonly authenticatedFetch;
39
+ private readonly fetchFn;
40
+ constructor(config: GraphClientConfig);
41
+ /**
42
+ * Build a download URL operation result without streaming binary
43
+ * content through the dispatch path. Calls
44
+ * `/sites/{site-id}/drive/items/{item-id}` with `?$select=id,@microsoft.graph.downloadUrl`
45
+ * and returns the temporary URL Graph mints (~1h validity). Consumers
46
+ * fetch bytes directly; this keeps the JSON-only operations dispatch
47
+ * binary-free.
48
+ */
49
+ getDownloadUrl(siteId: string, itemId: string): Promise<{
50
+ url: string;
51
+ expiresAt: string | null;
52
+ }>;
53
+ /**
54
+ * Pre-authenticated download URL for a drive item addressed by its PATH (vs
55
+ * item id). Returns Graph's `@microsoft.graph.downloadUrl` — a short-lived
56
+ * Azure Blob SAS URL that needs no auth header, so it works directly in a
57
+ * browser `<img>`/`<iframe>`/download across origins (the object store has no
58
+ * stable anonymous URL otherwise). `null` if the item is missing.
59
+ */
60
+ getDownloadUrlByPath(siteId: string, path: string): Promise<string | null>;
61
+ /**
62
+ * List SharePoint sites the app has access to.
63
+ *
64
+ * Returns normalized site objects with id, name, and webUrl.
65
+ * App-only requires the Sites.Read.All application permission so the
66
+ * `GET /sites?search=*` enumeration returns the tenant's sites.
67
+ *
68
+ * GET /sites?search=*&$select=id,name,webUrl,displayName
69
+ *
70
+ * @returns Array of SharePoint sites
71
+ */
72
+ listSites(): Promise<SharePointSite[]>;
73
+ /**
74
+ * Return a site's default document library as a real Graph drive.
75
+ *
76
+ * Storage consumers pass a `driveId`, not a site id. SharePoint site ids are
77
+ * often composite strings (`host,siteCollectionId,webId`) that are brittle in
78
+ * agent/tool contexts, while Graph drive ids are the stable primitive accepted
79
+ * by `/drives/{id}` across browse/search/download operations.
80
+ */
81
+ getDefaultDrive(siteId: string): Promise<GraphDrive>;
82
+ /**
83
+ * Browse folder contents within a SharePoint site's default drive.
84
+ *
85
+ * GET /sites/{site-id}/drive/root/children
86
+ *
87
+ * When folderPath is provided:
88
+ * GET /sites/{site-id}/drive/root:/{folderPath}:/children
89
+ *
90
+ * @param siteId - SharePoint site ID
91
+ * @param folderPath - Optional path relative to drive root (e.g. "Documents/Reports")
92
+ * @returns Array of drive item entries (files and folders)
93
+ */
94
+ browseDrive(siteId: string, folderPath?: string): Promise<DriveItemEntry[]>;
95
+ /**
96
+ * Browse folder contents by stable DriveItem id.
97
+ *
98
+ * Use this when a caller already has an item id from search/list, or when
99
+ * Graph path addressing rejects an otherwise valid folder path.
100
+ */
101
+ browseDriveItem(siteId: string, itemId: string): Promise<DriveItemEntry[]>;
102
+ /**
103
+ * RECURSIVELY search a site/OneDrive drive for items matching `query`,
104
+ * at ANY depth, in a single Graph call.
105
+ *
106
+ * Uses Graph's server-side drive search:
107
+ * GET /sites/{site-id}/drive/root/search(q='{query}')
108
+ * GET /me/drive/root/search(q='{query}') (OneDrive sentinel)
109
+ *
110
+ * Graph indexes the whole drive server-side and matches on file/folder
111
+ * NAME and (for supported types) CONTENT — so a partial job number or
112
+ * filename matches files buried several folders deep (e.g. a PDF under
113
+ * "Projects to Bid/2026/Acme/Drawings") that the one-level {@link browseDrive}
114
+ * can never reach. `$select` includes `parentReference` so each hit carries
115
+ * its folder path for breadcrumbs / relinking.
116
+ *
117
+ * `scopePath` (optional, drive-root-relative) narrows the search to a
118
+ * subtree by addressing the folder before `:/search` — e.g.
119
+ * GET /sites/{id}/drive/root:/Projects to Bid:/search(q='...')
120
+ * Use it to keep results inside the org's bid folder.
121
+ *
122
+ * @param siteId SharePoint site id, or {@link ONEDRIVE_SITE_ID} for OneDrive
123
+ * @param query free-text query (job number, partial filename, content)
124
+ * @param opts.scopePath optional folder subtree to search within
125
+ * @param opts.limit cap on hits returned (default 25); paging stops early
126
+ * @returns Array of search hits with folder path metadata
127
+ */
128
+ searchDrive(siteId: string, query: string, opts?: {
129
+ scopePath?: string;
130
+ limit?: number;
131
+ }): Promise<DriveItemSearchResult[]>;
132
+ /**
133
+ * Download file content from a SharePoint drive.
134
+ *
135
+ * Read Graph's item metadata, then fetch its preauthenticated download URL
136
+ * without forwarding Graph authorization across origins.
137
+ *
138
+ * Returns the raw binary content as a Blob.
139
+ * Callers can convert to ArrayBuffer, ReadableStream, or base64
140
+ * depending on their needs.
141
+ *
142
+ * @param siteId - SharePoint site ID
143
+ * @param itemId - Drive item ID (file)
144
+ * @returns Blob with file content
145
+ */
146
+ downloadFile(siteId: string, itemId: string): Promise<Blob>;
147
+ /**
148
+ * Upload bytes to `path` (relative to the site drive root), creating or
149
+ * overwriting the file. Simple PUT below ~4 MiB; resumable upload session
150
+ * (chunked) at or above it.
151
+ */
152
+ uploadFile(siteId: string, path: string, body: ArrayBuffer | ReadableStream | Blob, opts?: {
153
+ contentType?: string;
154
+ conflictBehavior?: 'replace' | 'rename' | 'fail';
155
+ }): Promise<DriveItemEntry>;
156
+ private simpleUpload;
157
+ private resumableUpload;
158
+ /**
159
+ * Create a folder named `name` under `parentPath` (drive-root-relative; empty
160
+ * for the root). `conflictBehavior` defaults to `fail` so existing folders
161
+ * are not clobbered.
162
+ */
163
+ createFolder(siteId: string, parentPath: string, name: string, conflictBehavior?: 'replace' | 'rename' | 'fail'): Promise<DriveItemEntry>;
164
+ /** Delete a drive item by its id. */
165
+ deleteItem(siteId: string, itemId: string): Promise<void>;
166
+ /** Delete a drive item by its drive-root-relative path. */
167
+ deletePath(siteId: string, path: string): Promise<void>;
168
+ /** Fetch metadata for the item at `path`, or `null` if it does not exist. */
169
+ headPath(siteId: string, path: string): Promise<{
170
+ id: string;
171
+ size: number;
172
+ mimeType: string;
173
+ lastModified: string;
174
+ webUrl?: string;
175
+ } | null>;
176
+ /** Stream the bytes of the item at `path`, or `null` if it does not exist. */
177
+ getStream(siteId: string, path: string): Promise<ReadableStream<Uint8Array> | null>;
178
+ /** Metadata URLs and Graph's proxy fallback both leave credentials at Graph. */
179
+ private downloadResponse;
180
+ private downloadTarget;
181
+ private executeWriteJson;
182
+ private executeDelete;
183
+ /** Retrieve a token only for legacy direct callers; registered providers use Secrets. */
184
+ private acquireAccessToken;
185
+ /**
186
+ * Graph drive base for the storage drive identifier. The sentinel
187
+ * {@link ONEDRIVE_SITE_ID} (`'me'`) targets the signed-in user's personal
188
+ * OneDrive (`/me/drive`, delegated only). Composite SharePoint site ids keep
189
+ * using `/sites/{id}/drive` for backwards compatibility; real Graph drive ids
190
+ * use `/drives/{id}`.
191
+ */
192
+ private driveRoot;
193
+ /**
194
+ * Execute a JSON-bearing Graph API request with auth header.
195
+ */
196
+ private executeRequest;
197
+ /** All Graph transports preserve typed, value-safe failures. */
198
+ private fetchResponse;
199
+ private admitGraphResponse;
200
+ private readGraphResponse;
201
+ /**
202
+ * Follow @odata.nextLink for paginated responses.
203
+ */
204
+ private fetchAllPages;
205
+ /**
206
+ * Normalize a raw Graph DriveItem into our simplified DriveItemEntry.
207
+ */
208
+ private normalizeDriveItem;
209
+ /**
210
+ * Normalize a raw Graph search-hit DriveItem into a DriveItemSearchResult,
211
+ * deriving the drive-root-relative `parentPath` from `parentReference.path`.
212
+ *
213
+ * Graph's `parentReference.path` looks like `/drive/root:/Projects to Bid/2026`
214
+ * (URL-encoded segments). We strip the `/drive/root:` (or `/drives/{id}/root:`)
215
+ * prefix and decode each segment so consumers get `Projects to Bid/2026`.
216
+ */
217
+ private normalizeSearchResult;
218
+ }
219
+ //# sourceMappingURL=graph-sharepoint-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph-sharepoint-client.d.ts","sourceRoot":"","sources":["../../src/microsoft/graph-sharepoint-client.ts"],"names":[],"mappings":"AAKA,OAAO,EAON,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAA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