@vibesdotdev/integrations-microsoft 0.0.0-stage → 1.0.0-rc.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 (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
+ * Delegated-OAuth Microsoft 365 descriptor.
3
+ *
4
+ * Sibling of `integration.microsoft` (app-only). The runtime-client
5
+ * surface (`getVibesMicrosoftClient(runtime)`) defaults to this variant so
6
+ * Graph calls run on behalf of the signed-in user, reading their
7
+ * OneDrive / SharePoint with their own tenant permissions instead of
8
+ * the Sites.Selected app-only grant.
9
+ *
10
+ * Tokens remain with the identity owner. The registered provider hands
11
+ * Secrets an OAuth-account reference, and Secrets applies the current access
12
+ * token to each Graph request without returning it to this package.
13
+ *
14
+ * Refresh and disconnect remain owned by Better Auth's `offline_access`
15
+ * lifecycle; this descriptor does not store or return tokens.
16
+ */
17
+ declare const _default: {
18
+ id: string;
19
+ kind: "integration/provider";
20
+ name?: string | undefined;
21
+ description?: string | undefined;
22
+ tags?: string[] | undefined;
23
+ hardware?: string[] | undefined;
24
+ enabled?: boolean | undefined;
25
+ capabilityId?: string | undefined;
26
+ retention?: string | {
27
+ reason: string;
28
+ maxAgeDays?: number | undefined;
29
+ maxEntries?: number | undefined;
30
+ maxBytes?: number | undefined;
31
+ cascadeFrom?: string | undefined;
32
+ ageField?: string | undefined;
33
+ enforcedBy?: string | undefined;
34
+ } | undefined;
35
+ requiredContext?: string[] | undefined;
36
+ optionalContext?: string[] | undefined;
37
+ provider?: string | undefined;
38
+ category?: "push" | "webhook" | "accounting" | "vcs" | "issue-tracker" | "productivity" | "ocr" | "email" | "messaging" | "sms" | "storage" | "analytics" | "observability" | "crm" | "calendar" | "other" | undefined;
39
+ priority?: number | undefined;
40
+ baseUrl?: string | undefined;
41
+ config?: Record<string, import("@vibesdotdev/kernel/bootstrap").JsonValue> | undefined;
42
+ protectedConfigKeys?: string[] | undefined;
43
+ configurationSource?: "account" | "host" | undefined;
44
+ configSettingKey?: string | undefined;
45
+ credentials?: {
46
+ key: string;
47
+ source: "secret" | "setting";
48
+ reference?: {
49
+ source: "secret";
50
+ key: string;
51
+ store?: string | undefined;
52
+ operation?: object | undefined;
53
+ } | undefined;
54
+ providerType?: string | undefined;
55
+ scope?: "user" | "platform" | "project" | "org" | undefined;
56
+ scopeId?: string | undefined;
57
+ settingKey?: string | undefined;
58
+ required?: boolean | undefined;
59
+ }[] | undefined;
60
+ oauth?: {
61
+ authorizationEndpoint: string;
62
+ tokenEndpoint: string;
63
+ scopes?: string[] | undefined;
64
+ authorizationParams?: Record<string, string> | undefined;
65
+ configFromCallback?: string[] | undefined;
66
+ clientAuthentication?: "form" | "basic" | undefined;
67
+ bodyEncoding?: "form" | "json" | undefined;
68
+ headers?: Record<string, string> | undefined;
69
+ scopeIdCallbackParam?: string | undefined;
70
+ } | undefined;
71
+ operations?: {
72
+ id: string;
73
+ name: string;
74
+ description?: string | undefined;
75
+ requiresOrg?: boolean | undefined;
76
+ }[] | undefined;
77
+ connection?: {
78
+ authMode?: "delegated" | "oauth" | "webhook" | "system-config" | undefined;
79
+ connectable?: boolean | undefined;
80
+ checkable?: boolean | undefined;
81
+ requiresProviderAdmin?: boolean | undefined;
82
+ } | undefined;
83
+ };
84
+ export default _default;
85
+ //# sourceMappingURL=system.integration.microsoft.delegated.descriptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system.integration.microsoft.delegated.descriptor.d.ts","sourceRoot":"","sources":["../../src/microsoft/system.integration.microsoft.delegated.descriptor.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACH,wBAkGG"}
@@ -0,0 +1,109 @@
1
+ import { oauthDefaultAccountCredentialReference } from '@vibesdotdev/auth';
2
+ import { createRuntimeAsset } from '@vibesdotdev/kernel/factory';
3
+ /**
4
+ * Delegated-OAuth Microsoft 365 descriptor.
5
+ *
6
+ * Sibling of `integration.microsoft` (app-only). The runtime-client
7
+ * surface (`getVibesMicrosoftClient(runtime)`) defaults to this variant so
8
+ * Graph calls run on behalf of the signed-in user, reading their
9
+ * OneDrive / SharePoint with their own tenant permissions instead of
10
+ * the Sites.Selected app-only grant.
11
+ *
12
+ * Tokens remain with the identity owner. The registered provider hands
13
+ * Secrets an OAuth-account reference, and Secrets applies the current access
14
+ * token to each Graph request without returning it to this package.
15
+ *
16
+ * Refresh and disconnect remain owned by Better Auth's `offline_access`
17
+ * lifecycle; this descriptor does not store or return tokens.
18
+ */
19
+ export default createRuntimeAsset({
20
+ kind: 'integration/provider',
21
+ id: 'integration.microsoft.delegated',
22
+ name: 'Microsoft 365 (Delegated)',
23
+ description: 'Microsoft 365 integration that acts on behalf of the signed-in user, sourcing access + refresh tokens from the auth-web identity provider account record.',
24
+ provider: 'microsoft',
25
+ category: 'productivity',
26
+ enabled: true,
27
+ priority: 95,
28
+ requiredContext: ['userId', 'authInternalClient'],
29
+ optionalContext: ['orgId'],
30
+ baseUrl: 'https://graph.microsoft.com/v1.0',
31
+ config: {
32
+ scopes: ['Files.Read.All', 'Sites.Read.All', 'offline_access']
33
+ },
34
+ credentials: [
35
+ {
36
+ key: 'accessToken',
37
+ source: 'secret',
38
+ reference: oauthDefaultAccountCredentialReference({ providerId: 'microsoft' }),
39
+ required: true
40
+ },
41
+ {
42
+ key: 'refreshToken',
43
+ source: 'secret',
44
+ // Auth refreshes this credential; the feature supplies no refresh-token reference.
45
+ required: false
46
+ }
47
+ ],
48
+ operations: [
49
+ {
50
+ id: 'listSites',
51
+ name: 'List SharePoint sites',
52
+ description: "List SharePoint sites the signed-in user has access to (their own tenant permissions).",
53
+ requiresOrg: true
54
+ },
55
+ {
56
+ id: 'browseDrive',
57
+ name: 'Browse drive folder',
58
+ description: "List children of a folder (or root) in a SharePoint site's default drive, scoped to the signed-in user. " +
59
+ 'Args: `{ siteId: string; folderPath?: string }`.',
60
+ requiresOrg: true
61
+ },
62
+ {
63
+ id: 'browseDriveItem',
64
+ name: 'Browse drive item folder',
65
+ description: 'List children of a SharePoint/OneDrive folder by stable drive item id, scoped to the signed-in user. ' +
66
+ 'Use this with item ids returned by storage.search or storage.browse. Args: `{ siteId: string; itemId: string }`.',
67
+ requiresOrg: true
68
+ },
69
+ {
70
+ id: 'searchDrive',
71
+ name: 'Search drive (recursive)',
72
+ description: 'Recursively search a SharePoint site (or all visible sites + OneDrive when ' +
73
+ 'siteId is omitted) for files/folders matching a query, at ANY depth, scoped ' +
74
+ "to the signed-in user. Finds deeply-nested files browse can't reach. " +
75
+ 'Args: `{ query: string; siteId?: string; scopePath?: string; limit?: number }`.',
76
+ requiresOrg: true
77
+ },
78
+ {
79
+ id: 'getDownloadUrl',
80
+ name: 'Get drive item download URL',
81
+ description: 'Return a temporary pre-authenticated download URL for a drive item, scoped to the signed-in user. ' +
82
+ 'Args: `{ siteId: string; itemId: string }`.',
83
+ requiresOrg: true
84
+ },
85
+ {
86
+ id: 'uploadFile',
87
+ name: 'Upload file',
88
+ description: 'Upload bytes to a path in a SharePoint site drive (simple or resumable), scoped to the signed-in user. ' +
89
+ 'Args: `{ siteId: string; path: string; contentBase64: string; contentType?: string }`.',
90
+ requiresOrg: true
91
+ },
92
+ {
93
+ id: 'createFolder',
94
+ name: 'Create folder',
95
+ description: 'Create a folder in a SharePoint site drive, scoped to the signed-in user. ' +
96
+ 'Args: `{ siteId: string; name: string; parentPath?: string }`.',
97
+ requiresOrg: true
98
+ },
99
+ {
100
+ id: 'deleteItem',
101
+ name: 'Delete drive item',
102
+ description: 'Delete a file or folder in a SharePoint site drive by item id, scoped to the signed-in user. ' +
103
+ 'Args: `{ siteId: string; itemId: string }`.',
104
+ requiresOrg: true
105
+ }
106
+ ],
107
+ tags: ['system', 'integration', 'microsoft', 'graph', 'sharepoint', 'onedrive', 'delegated']
108
+ });
109
+ //# sourceMappingURL=system.integration.microsoft.delegated.descriptor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system.integration.microsoft.delegated.descriptor.js","sourceRoot":"","sources":["../../src/microsoft/system.integration.microsoft.delegated.descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sCAAsC,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAGjE;;;;;;;;;;;;;;;GAeG;AACH,eAAe,kBAAkB,CAAqC;IACrE,IAAI,EAAE,sBAAsB;IAC5B,EAAE,EAAE,iCAAiC;IACrC,IAAI,EAAE,2BAA2B;IACjC,WAAW,EACV,2JAA2J;IAC5J,QAAQ,EAAE,WAAW;IACrB,QAAQ,EAAE,cAAc;IACxB,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,EAAE;IACZ,eAAe,EAAE,CAAC,QAAQ,EAAE,oBAAoB,CAAC;IACjD,eAAe,EAAE,CAAC,OAAO,CAAC;IAC1B,OAAO,EAAE,kCAAkC;IAC3C,MAAM,EAAE;QACP,MAAM,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,CAAC;KAC9D;IACD,WAAW,EAAE;QACZ;YACC,GAAG,EAAE,aAAa;YAClB,MAAM,EAAE,QAAQ;YAChB,SAAS,EAAE,sCAAsC,CAAC,EAAC,UAAU,EAAC,WAAW,EAAC,CAAC;YAC3E,QAAQ,EAAE,IAAI;SACd;QACD;YACC,GAAG,EAAE,cAAc;YACnB,MAAM,EAAE,QAAQ;YAChB,mFAAmF;YACnF,QAAQ,EAAE,KAAK;SACf;KACD;IACD,UAAU,EAAE;QACX;YACC,EAAE,EAAE,WAAW;YACf,IAAI,EAAE,uBAAuB;YAC7B,WAAW,EACV,wFAAwF;YACzF,WAAW,EAAE,IAAI;SACjB;QACD;YACC,EAAE,EAAE,aAAa;YACjB,IAAI,EAAE,qBAAqB;YAC3B,WAAW,EACV,0GAA0G;gBAC1G,kDAAkD;YACnD,WAAW,EAAE,IAAI;SACjB;QACD;YACC,EAAE,EAAE,iBAAiB;YACrB,IAAI,EAAE,0BAA0B;YAChC,WAAW,EACV,uGAAuG;gBACvG,kHAAkH;YACnH,WAAW,EAAE,IAAI;SACjB;QACD;YACC,EAAE,EAAE,aAAa;YACjB,IAAI,EAAE,0BAA0B;YAChC,WAAW,EACV,6EAA6E;gBAC7E,8EAA8E;gBAC9E,uEAAuE;gBACvE,iFAAiF;YAClF,WAAW,EAAE,IAAI;SACjB;QACD;YACC,EAAE,EAAE,gBAAgB;YACpB,IAAI,EAAE,6BAA6B;YACnC,WAAW,EACV,oGAAoG;gBACpG,6CAA6C;YAC9C,WAAW,EAAE,IAAI;SACjB;QACD;YACC,EAAE,EAAE,YAAY;YAChB,IAAI,EAAE,aAAa;YACnB,WAAW,EACV,yGAAyG;gBACzG,wFAAwF;YACzF,WAAW,EAAE,IAAI;SACjB;QACD;YACC,EAAE,EAAE,cAAc;YAClB,IAAI,EAAE,eAAe;YACrB,WAAW,EACV,4EAA4E;gBAC5E,gEAAgE;YACjE,WAAW,EAAE,IAAI;SACjB;QACD;YACC,EAAE,EAAE,YAAY;YAChB,IAAI,EAAE,mBAAmB;YACzB,WAAW,EACV,+FAA+F;gBAC/F,6CAA6C;YAC9C,WAAW,EAAE,IAAI;SACjB;KACD;IACD,IAAI,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,CAAC;CAC5F,CAAC,CAAC"}
@@ -0,0 +1,69 @@
1
+ declare const _default: {
2
+ id: string;
3
+ kind: "integration/provider";
4
+ name?: string | undefined;
5
+ description?: string | undefined;
6
+ tags?: string[] | undefined;
7
+ hardware?: string[] | undefined;
8
+ enabled?: boolean | undefined;
9
+ capabilityId?: string | undefined;
10
+ retention?: string | {
11
+ reason: string;
12
+ maxAgeDays?: number | undefined;
13
+ maxEntries?: number | undefined;
14
+ maxBytes?: number | undefined;
15
+ cascadeFrom?: string | undefined;
16
+ ageField?: string | undefined;
17
+ enforcedBy?: string | undefined;
18
+ } | undefined;
19
+ requiredContext?: string[] | undefined;
20
+ optionalContext?: string[] | undefined;
21
+ provider?: string | undefined;
22
+ category?: "push" | "webhook" | "accounting" | "vcs" | "issue-tracker" | "productivity" | "ocr" | "email" | "messaging" | "sms" | "storage" | "analytics" | "observability" | "crm" | "calendar" | "other" | undefined;
23
+ priority?: number | undefined;
24
+ baseUrl?: string | undefined;
25
+ config?: Record<string, import("@vibesdotdev/kernel/bootstrap").JsonValue> | undefined;
26
+ protectedConfigKeys?: string[] | undefined;
27
+ configurationSource?: "account" | "host" | undefined;
28
+ configSettingKey?: string | undefined;
29
+ credentials?: {
30
+ key: string;
31
+ source: "secret" | "setting";
32
+ reference?: {
33
+ source: "secret";
34
+ key: string;
35
+ store?: string | undefined;
36
+ operation?: object | undefined;
37
+ } | undefined;
38
+ providerType?: string | undefined;
39
+ scope?: "user" | "platform" | "project" | "org" | undefined;
40
+ scopeId?: string | undefined;
41
+ settingKey?: string | undefined;
42
+ required?: boolean | undefined;
43
+ }[] | undefined;
44
+ oauth?: {
45
+ authorizationEndpoint: string;
46
+ tokenEndpoint: string;
47
+ scopes?: string[] | undefined;
48
+ authorizationParams?: Record<string, string> | undefined;
49
+ configFromCallback?: string[] | undefined;
50
+ clientAuthentication?: "form" | "basic" | undefined;
51
+ bodyEncoding?: "form" | "json" | undefined;
52
+ headers?: Record<string, string> | undefined;
53
+ scopeIdCallbackParam?: string | undefined;
54
+ } | undefined;
55
+ operations?: {
56
+ id: string;
57
+ name: string;
58
+ description?: string | undefined;
59
+ requiresOrg?: boolean | undefined;
60
+ }[] | undefined;
61
+ connection?: {
62
+ authMode?: "delegated" | "oauth" | "webhook" | "system-config" | undefined;
63
+ connectable?: boolean | undefined;
64
+ checkable?: boolean | undefined;
65
+ requiresProviderAdmin?: boolean | undefined;
66
+ } | undefined;
67
+ };
68
+ export default _default;
69
+ //# sourceMappingURL=system.integration.microsoft.descriptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system.integration.microsoft.descriptor.d.ts","sourceRoot":"","sources":["../../src/microsoft/system.integration.microsoft.descriptor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,wBAwHG"}
@@ -0,0 +1,114 @@
1
+ import { createRuntimeAsset } from '@vibesdotdev/kernel/factory';
2
+ export default createRuntimeAsset({
3
+ kind: 'integration/provider',
4
+ id: 'integration.microsoft',
5
+ name: 'Microsoft 365',
6
+ description: 'Microsoft 365 integration using Secrets-owned client credentials for app-only access to Graph API, SharePoint, and OneDrive.',
7
+ provider: 'microsoft',
8
+ category: 'productivity',
9
+ enabled: true,
10
+ priority: 90,
11
+ // App-only credentials resolve PER-ORG (the consented tenant). The runtime
12
+ // must inject the calling org/user so `MicrosoftIntegration` can resolve the
13
+ // right tenant per request — without this the context orgId is undefined and
14
+ // the env (home) tenant leaks to every org (cross-org bleed, cf. ac19f2688).
15
+ optionalContext: ['orgId', 'userId'],
16
+ baseUrl: 'https://graph.microsoft.com/v1.0',
17
+ configSettingKey: 'integrations.microsoft.config',
18
+ config: {
19
+ tenantId: '',
20
+ scopes: ['https://graph.microsoft.com/.default']
21
+ },
22
+ credentials: [
23
+ // The managed organization credential wins when present; the shared
24
+ // application references are fallback candidates. The tenant fallback is
25
+ // restricted to the configured home organization by the provider.
26
+ {
27
+ key: 'clientId',
28
+ source: 'secret',
29
+ providerType: 'microsoft',
30
+ scope: 'org',
31
+ reference: { source: 'secret', key: 'VIBES_AUTH_MICROSOFT_CLIENT_ID' },
32
+ required: true
33
+ },
34
+ {
35
+ key: 'clientSecret',
36
+ source: 'secret',
37
+ providerType: 'microsoft',
38
+ scope: 'org',
39
+ reference: { source: 'secret', key: 'VIBES_AUTH_MICROSOFT_CLIENT_SECRET' },
40
+ required: true
41
+ },
42
+ {
43
+ key: 'tenantId',
44
+ source: 'secret',
45
+ providerType: 'microsoft',
46
+ scope: 'org',
47
+ reference: { source: 'secret', key: 'VIBES_AUTH_MICROSOFT_TENANT_ID' },
48
+ required: true
49
+ }
50
+ ],
51
+ operations: [
52
+ {
53
+ id: 'listSites',
54
+ name: 'List SharePoint sites',
55
+ description: 'List SharePoint sites visible to the integration. App-only requires the ' +
56
+ 'Sites.Read.All APPLICATION permission (Sites.Selected is insufficient for ' +
57
+ 'the `GET /sites?search=*` enumeration the explorer relies on).',
58
+ requiresOrg: true
59
+ },
60
+ {
61
+ id: 'browseDrive',
62
+ name: 'Browse drive folder',
63
+ description: "List children of a folder (or root) in a SharePoint site's default drive. " +
64
+ 'Args: `{ siteId: string; folderPath?: string }`.',
65
+ requiresOrg: true
66
+ },
67
+ {
68
+ id: 'browseDriveItem',
69
+ name: 'Browse drive item folder',
70
+ description: 'List children of a SharePoint/OneDrive folder by stable drive item id. ' +
71
+ 'Use this with item ids returned by storage.search or storage.browse. Args: `{ siteId: string; itemId: string }`.',
72
+ requiresOrg: true
73
+ },
74
+ {
75
+ id: 'searchDrive',
76
+ name: 'Search drive (recursive)',
77
+ description: 'Recursively search a SharePoint site (or all visible sites when siteId ' +
78
+ 'is omitted) for files/folders matching a query, at ANY depth, via Graph ' +
79
+ "`drive/root/search(q=...)`. Finds deeply-nested files browse can't reach. " +
80
+ 'Args: `{ query: string; siteId?: string; scopePath?: string; limit?: number }`.',
81
+ requiresOrg: true
82
+ },
83
+ {
84
+ id: 'getDownloadUrl',
85
+ name: 'Get drive item download URL',
86
+ description: 'Return a temporary pre-authenticated download URL for a drive item. ' +
87
+ 'Args: `{ siteId: string; itemId: string }`.',
88
+ requiresOrg: true
89
+ },
90
+ {
91
+ id: 'uploadFile',
92
+ name: 'Upload file',
93
+ description: 'Upload bytes to a path in a SharePoint site drive (simple or resumable). ' +
94
+ 'Args: `{ siteId: string; path: string; contentBase64: string; contentType?: string }`.',
95
+ requiresOrg: true
96
+ },
97
+ {
98
+ id: 'createFolder',
99
+ name: 'Create folder',
100
+ description: 'Create a folder in a SharePoint site drive. ' +
101
+ 'Args: `{ siteId: string; name: string; parentPath?: string }`.',
102
+ requiresOrg: true
103
+ },
104
+ {
105
+ id: 'deleteItem',
106
+ name: 'Delete drive item',
107
+ description: 'Delete a file or folder in a SharePoint site drive by item id. ' +
108
+ 'Args: `{ siteId: string; itemId: string }`.',
109
+ requiresOrg: true
110
+ }
111
+ ],
112
+ tags: ['system', 'integration', 'microsoft', 'graph', 'sharepoint', 'onedrive']
113
+ });
114
+ //# sourceMappingURL=system.integration.microsoft.descriptor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system.integration.microsoft.descriptor.js","sourceRoot":"","sources":["../../src/microsoft/system.integration.microsoft.descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAGjE,eAAe,kBAAkB,CAAqC;IACrE,IAAI,EAAE,sBAAsB;IAC5B,EAAE,EAAE,uBAAuB;IAC3B,IAAI,EAAE,eAAe;IACrB,WAAW,EACV,8HAA8H;IAC/H,QAAQ,EAAE,WAAW;IACrB,QAAQ,EAAE,cAAc;IACxB,OAAO,EAAE,IAAI;IACb,QAAQ,EAAE,EAAE;IACZ,2EAA2E;IAC3E,6EAA6E;IAC7E,6EAA6E;IAC7E,6EAA6E;IAC7E,eAAe,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC;IACpC,OAAO,EAAE,kCAAkC;IAC3C,gBAAgB,EAAE,+BAA+B;IACjD,MAAM,EAAE;QACP,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,CAAC,sCAAsC,CAAC;KAChD;IACD,WAAW,EAAE;QACZ,oEAAoE;QACpE,yEAAyE;QACzE,kEAAkE;QAClE;YACC,GAAG,EAAE,UAAU;YACf,MAAM,EAAE,QAAQ;YAChB,YAAY,EAAE,WAAW;YACzB,KAAK,EAAE,KAAK;YACZ,SAAS,EAAE,EAAE,MAAM,EAAE,QA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E,aAAa;YACnB,WAAW,EACV,2EAA2E;gBAC3E,wFAAwF;YACzF,WAAW,EAAE,IAAI;SACjB;QACD;YACC,EAAE,EAAE,cAAc;YAClB,IAAI,EAAE,eAAe;YACrB,WAAW,EACV,8CAA8C;gBAC9C,gEAAgE;YACjE,WAAW,EAAE,IAAI;SACjB;QACD;YACC,EAAE,EAAE,YAAY;YAChB,IAAI,EAAE,mBAAmB;YACzB,WAAW,EACV,iEAAiE;gBACjE,6CAA6C;YAC9C,WAAW,EAAE,IAAI;SACjB;KACD;IACD,IAAI,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,CAAC;CAC/E,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ /** App-only provider slice; compose where org-scoped Microsoft operations are enabled. */
2
+ export declare const microsoftConsumerPlugin: import("@vibesdotdev/kernel").RuntimePlugin;
3
+ export default microsoftConsumerPlugin;
4
+ //# sourceMappingURL=microsoft.consumer.plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"microsoft.consumer.plugin.d.ts","sourceRoot":"","sources":["../src/microsoft.consumer.plugin.ts"],"names":[],"mappings":"AAEA,0FAA0F;AAC1F,eAAO,MAAM,uBAAuB,6CAOlC,CAAC;AACH,eAAe,uBAAuB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { createRuntimePlugin, loader } from '@vibesdotdev/kernel/factory';
2
+ import microsoftDescriptor from "./microsoft/system.integration.microsoft.descriptor.js";
3
+ /** App-only provider slice; compose where org-scoped Microsoft operations are enabled. */
4
+ export const microsoftConsumerPlugin = createRuntimePlugin({
5
+ id: 'integrations-microsoft/consumer', name: 'Microsoft app-only provider',
6
+ descriptors: [microsoftDescriptor],
7
+ loaders: [loader(microsoftDescriptor.id, { kind: 'integration/provider' }, async () => {
8
+ const { MicrosoftIntegration } = await import("./microsoft/microsoft-implementation.js");
9
+ return { default: MicrosoftIntegration };
10
+ })]
11
+ });
12
+ export default microsoftConsumerPlugin;
13
+ //# sourceMappingURL=microsoft.consumer.plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"microsoft.consumer.plugin.js","sourceRoot":"","sources":["../src/microsoft.consumer.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAC,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,mBAAmB,MAAM,wDAAwD,CAAC;AACzF,0FAA0F;AAC1F,MAAM,CAAC,MAAM,uBAAuB,GAAC,mBAAmB,CAAC;IACxD,EAAE,EAAE,iCAAiC,EAAC,IAAI,EAAE,6BAA6B;IACzE,WAAW,EAAE,CAAC,mBAAmB,CAAC;IAClC,OAAO,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,EAAC,EAAE,IAAI,EAAE,sBAAsB,EAAE,EAAC,KAAK,IAAI,EAAE;YACnF,MAAM,EAAE,oBAAoB,EAAE,GAAC,MAAM,MAAM,CAAC,yCAAyC,CAAC,CAAC;YACvF,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,CAAC;QAC1C,CAAC,CAAC,CAAC;CACH,CAAC,CAAC;AACH,eAAe,uBAAuB,CAAC"}
@@ -0,0 +1,69 @@
1
+ import * as z from 'zod/v4';
2
+ import { CapabilityError, valueFreeFailure, type RuntimeRef } from '@vibesdotdev/kernel';
3
+ export declare const IdentitySchema: z.ZodString;
4
+ export declare const OptionalIdentitySchema: z.ZodOptional<z.ZodString>;
5
+ export declare const MicrosoftConfigSchema: z.ZodObject<{
6
+ tenantId: z.ZodOptional<z.ZodString>;
7
+ scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
8
+ }, z.core.$strip>;
9
+ export declare const DelegatedAuthOAuthAccountSchema: z.ZodObject<{
10
+ providerId: z.ZodString;
11
+ accountId: z.ZodOptional<z.ZodString>;
12
+ accessToken: z.ZodNullable<z.ZodString>;
13
+ refreshToken: z.ZodNullable<z.ZodString>;
14
+ expiresAt: z.ZodNullable<z.ZodString>;
15
+ refreshTokenExpiresAt: z.ZodNullable<z.ZodString>;
16
+ scope: z.ZodNullable<z.ZodString>;
17
+ }, z.core.$strip>;
18
+ export type DelegatedAuthOAuthAccount = z.infer<typeof DelegatedAuthOAuthAccountSchema>;
19
+ export declare const DelegatedAuthClientSchema: z.ZodObject<{
20
+ getOAuthAccount: z.ZodFunction<z.ZodTuple<readonly [z.ZodString, z.ZodString, z.ZodOptional<z.ZodObject<{
21
+ accountId: z.ZodString;
22
+ }, z.core.$strict>>], null>, z.ZodPromise<z.ZodNullable<z.ZodObject<{
23
+ providerId: z.ZodString;
24
+ accountId: z.ZodOptional<z.ZodString>;
25
+ accessToken: z.ZodNullable<z.ZodString>;
26
+ refreshToken: z.ZodNullable<z.ZodString>;
27
+ expiresAt: z.ZodNullable<z.ZodString>;
28
+ refreshTokenExpiresAt: z.ZodNullable<z.ZodString>;
29
+ scope: z.ZodNullable<z.ZodString>;
30
+ }, z.core.$strip>>>>;
31
+ listOAuthAccounts: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodString], null>, z.ZodPromise<z.ZodArray<z.ZodObject<{
32
+ providerId: z.ZodString;
33
+ accountId: z.ZodOptional<z.ZodString>;
34
+ accessToken: z.ZodNullable<z.ZodString>;
35
+ accessTokenExpiresAt: z.ZodNullable<z.ZodString>;
36
+ createdAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
37
+ }, z.core.$strip>>>>>;
38
+ }, z.core.$strip>;
39
+ export type DelegatedAuthClient = z.infer<typeof DelegatedAuthClientSchema>;
40
+ /** Parse once without placing rejected values in diagnostic messages. */
41
+ export declare function admitMicrosoft<T>(schema: z.ZodType<T>, input: unknown, boundary?: 'input' | 'response'): T;
42
+ export declare function optionalMicrosoftContext(runtime: Pick<RuntimeRef, 'context'> | undefined, id: string): Promise<unknown>;
43
+ export declare const GraphErrorBodySchema: z.ZodObject<{
44
+ error: z.ZodObject<{
45
+ code: z.ZodOptional<z.ZodEnum<{
46
+ itemNotFound: "itemNotFound";
47
+ ResourceNotFound: "ResourceNotFound";
48
+ generalException: "generalException";
49
+ accessDenied: "accessDenied";
50
+ InvalidAuthenticationToken: "InvalidAuthenticationToken";
51
+ }>>;
52
+ }, z.core.$strip>;
53
+ }, z.core.$strip>;
54
+ export declare class MicrosoftGraphError extends CapabilityError {
55
+ readonly status: number;
56
+ readonly graphCode?: z.infer<typeof GraphErrorBodySchema>['error']['code'];
57
+ constructor(status: number, graphCode?: z.infer<typeof GraphErrorBodySchema>['error']['code'], failure?: ReturnType<typeof valueFreeFailure>);
58
+ }
59
+ export declare function graphFailure(response: Response): Promise<MicrosoftGraphError>;
60
+ /** Close an unused body before returning; cleanup failure remains a failure. */
61
+ export declare function closeMicrosoftResponse(response: Response): Promise<void>;
62
+ export declare function microsoftFailure(error: unknown): CapabilityError;
63
+ export declare const MicrosoftTokenAcquirerSchema: z.ZodObject<{
64
+ acquireToken: z.ZodFunction<z.ZodTuple<readonly [z.ZodOptional<z.ZodArray<z.ZodString>>], null>, z.ZodPromise<z.ZodObject<{
65
+ accessToken: z.ZodString;
66
+ }, z.core.$strip>>>;
67
+ }, z.core.$strip>;
68
+ export declare function readMicrosoftJson<T>(response: Response, schema: z.ZodType<T>): Promise<T>;
69
+ //# sourceMappingURL=boundary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boundary.d.ts","sourceRoot":"","sources":["../../src/schemas/boundary.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAqB,gBAAgB,EAAQ,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAElH,eAAO,MAAM,cAAc,aAAkB,CAAC;AAC9C,eAAO,MAAM,sBAAsB,4BAA0B,CAAC;AAC9D,eAAO,MAAM,qBAAqB;;;iBAAoF,CAAC;AACvH,eAAO,MAAM,+BAA+B;;;;;;;;iBAA6B,CAAC;AAC1E,MAAM,MAAM,yBAAyB,G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;AAEH,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAO9F"}
@@ -0,0 +1,94 @@
1
+ import { userOAuthAccountDetailSchema, userOAuthAccountSchema, userOAuthAccountSelectionSchema } from '@vibesdotdev/auth/system/internal-api';
2
+ import * as z from 'zod/v4';
3
+ import { CapabilityError, CaughtFailureSchema, valueFreeFailure, settle } from '@vibesdotdev/kernel';
4
+ export const IdentitySchema = z.string().min(1);
5
+ export const OptionalIdentitySchema = IdentitySchema.optional();
6
+ export const MicrosoftConfigSchema = z.object({ tenantId: z.string().optional(), scopes: z.string().array().optional() });
7
+ export const DelegatedAuthOAuthAccountSchema = userOAuthAccountDetailSchema;
8
+ export const DelegatedAuthClientSchema = z.object({
9
+ getOAuthAccount: z.function({ input: [z.string(), z.string(), userOAuthAccountSelectionSchema.optional()], output: z.promise(DelegatedAuthOAuthAccountSchema.nullable()) }),
10
+ listOAuthAccounts: z.function({ input: [z.string()], output: z.promise(userOAuthAccountSchema.array()) }).optional()
11
+ });
12
+ /** Parse once without placing rejected values in diagnostic messages. */
13
+ export function admitMicrosoft(schema, input, boundary = 'input') {
14
+ const parsed = schema.safeParse(input);
15
+ if (parsed.success)
16
+ return parsed.data;
17
+ throw new CapabilityError('Microsoft input or response does not match its contract.', boundary === 'input' ? 'INVALID_INPUT' : 'UNAVAILABLE', {
18
+ reason: boundary === 'input' ? 'microsoft-input-invalid' : 'microsoft-response-invalid', cause: valueFreeFailure(parsed.error),
19
+ details: { issues: parsed.error.issues.map(issue => ({ code: issue.code, path: issue.path.map(String) })) }
20
+ });
21
+ }
22
+ export async function optionalMicrosoftContext(runtime, id) {
23
+ if (!runtime)
24
+ return undefined;
25
+ try {
26
+ return await runtime.context(id);
27
+ }
28
+ catch (error) {
29
+ const failure = CaughtFailureSchema.parse(error);
30
+ if (CapabilityError.isAbsenceOf(failure, 'context', id))
31
+ return undefined;
32
+ throw failure;
33
+ }
34
+ }
35
+ export const GraphErrorBodySchema = z.object({
36
+ error: z.object({
37
+ code: z.enum(['itemNotFound', 'ResourceNotFound', 'generalException', 'accessDenied', 'InvalidAuthenticationToken']).optional()
38
+ })
39
+ });
40
+ export class MicrosoftGraphError extends CapabilityError {
41
+ status;
42
+ graphCode;
43
+ constructor(status, graphCode, failure) {
44
+ super('Microsoft Graph refused the request.', status === 401 ? 'AUTH_REQUIRED' : status === 403 ? 'PERMISSION_DENIED' : status === 404 ? 'NOT_FOUND' : status === 429 ? 'RATE_LIMITED' : 'UNAVAILABLE', {
45
+ reason: 'microsoft-graph-request-refused', details: { status, graphCode, failure }
46
+ });
47
+ this.status = status;
48
+ this.graphCode = graphCode;
49
+ }
50
+ }
51
+ export async function graphFailure(response) {
52
+ const decoded = await settle(() => response.json());
53
+ if (!decoded.ok) {
54
+ if (decoded.cause instanceof CapabilityError)
55
+ throw decoded.cause;
56
+ if (!(decoded.cause instanceof SyntaxError))
57
+ throw microsoftFailure(decoded.cause);
58
+ return new MicrosoftGraphError(response.status, undefined, valueFreeFailure(decoded.cause));
59
+ }
60
+ const body = decoded.value;
61
+ const parsed = GraphErrorBodySchema.safeParse(body);
62
+ return new MicrosoftGraphError(response.status, parsed.success ? parsed.data.error.code : undefined);
63
+ }
64
+ /** Close an unused body before returning; cleanup failure remains a failure. */
65
+ export async function closeMicrosoftResponse(response) {
66
+ const body = response.body;
67
+ if (!body)
68
+ return;
69
+ const closed = await settle(() => body.cancel());
70
+ if (!closed.ok)
71
+ throw microsoftFailure(closed.cause);
72
+ }
73
+ export function microsoftFailure(error) {
74
+ const failure = CaughtFailureSchema.parse(error);
75
+ if (failure instanceof CapabilityError)
76
+ return failure;
77
+ return new CapabilityError('Microsoft request failed.', 'UNAVAILABLE', {
78
+ reason: 'microsoft-request-failed', cause: failure, details: { failure: valueFreeFailure(failure) }
79
+ });
80
+ }
81
+ export const MicrosoftTokenAcquirerSchema = z.object({
82
+ acquireToken: z.function({ input: [z.string().array().optional()], output: z.promise(z.object({ accessToken: z.string().min(1) })) })
83
+ });
84
+ export async function readMicrosoftJson(response, schema) {
85
+ const decoded = await settle(() => response.json());
86
+ if (!decoded.ok && decoded.cause instanceof CapabilityError)
87
+ throw decoded.cause;
88
+ if (!decoded.ok)
89
+ throw new CapabilityError('Microsoft returned invalid JSON.', 'UNAVAILABLE', {
90
+ reason: 'microsoft-response-invalid', cause: valueFreeFailure(decoded.cause), details: { failure: valueFreeFailure(decoded.cause) }
91
+ });
92
+ return admitMicrosoft(schema, decoded.value, 'response');
93
+ }
94
+ //# sourceMappingURL=boundary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boundary.js","sourceRoot":"","sources":["../../src/schemas/boundary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,sBAAsB,EAAE,+BAA+B,EAAE,MAAM,uCAAuC,CAAC;AAC9I,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,eAAe,EAAC,mBAAmB,EAAC,gBAAgB,EAAC,MAAM,EAAkB,MAAM,qBAAqB,CAAC;AAElH,MAAM,CAAC,MAAM,cAAc,GAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC9C,MAAM,CAAC,MAAM,sBAAsB,GAAC,cAAc,CAAC,QAAQ,EAAE,CAAC;AAC9D,MAAM,CAAC,MAAM,qBAAqB,GAAC,CAAC,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AACvH,MAAM,CAAC,MAAM,+BAA+B,GAAC,4BAA4B,CAAC;AAE1E,MAAM,CAAC,MAAM,yBAAyB,GAAC,CAAC,CAAC,M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