@vibesdotdev/integrations 0.0.0-stage → 1.0.0-rc.3

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 (242) hide show
  1. package/LICENSE +18 -0
  2. package/README.md +100 -2
  3. package/dist/ai/ai.cloud.plugin.d.ts +5 -0
  4. package/dist/ai/ai.cloud.plugin.d.ts.map +1 -0
  5. package/dist/ai/ai.cloud.plugin.js +67 -0
  6. package/dist/ai/ai.cloud.plugin.js.map +1 -0
  7. package/dist/ai/ai.plugin.d.ts +5 -0
  8. package/dist/ai/ai.plugin.d.ts.map +1 -0
  9. package/dist/ai/ai.plugin.js +97 -0
  10. package/dist/ai/ai.plugin.js.map +1 -0
  11. package/dist/base/base.plugin.d.ts +10 -0
  12. package/dist/base/base.plugin.d.ts.map +1 -0
  13. package/dist/base/base.plugin.js +23 -0
  14. package/dist/base/base.plugin.js.map +1 -0
  15. package/dist/base/index.d.ts +13 -0
  16. package/dist/base/index.d.ts.map +1 -0
  17. package/dist/base/index.js +15 -0
  18. package/dist/base/index.js.map +1 -0
  19. package/dist/base/resolver.d.ts +13 -0
  20. package/dist/base/resolver.d.ts.map +1 -0
  21. package/dist/base/resolver.js +30 -0
  22. package/dist/base/resolver.js.map +1 -0
  23. package/dist/base/schemas.d.ts +167 -0
  24. package/dist/base/schemas.d.ts.map +1 -0
  25. package/dist/base/schemas.js +48 -0
  26. package/dist/base/schemas.js.map +1 -0
  27. package/dist/catalog/index.d.ts +6 -0
  28. package/dist/catalog/index.d.ts.map +1 -0
  29. package/dist/catalog/index.js +6 -0
  30. package/dist/catalog/index.js.map +1 -0
  31. package/dist/catalog/integration-catalog.capability.d.ts +14 -0
  32. package/dist/catalog/integration-catalog.capability.d.ts.map +1 -0
  33. package/dist/catalog/integration-catalog.capability.js +23 -0
  34. package/dist/catalog/integration-catalog.capability.js.map +1 -0
  35. package/dist/catalog/integration-catalog.descriptor.d.ts +6 -0
  36. package/dist/catalog/integration-catalog.descriptor.d.ts.map +1 -0
  37. package/dist/catalog/integration-catalog.descriptor.js +11 -0
  38. package/dist/catalog/integration-catalog.descriptor.js.map +1 -0
  39. package/dist/catalog/integration-catalog.exposure.d.ts +62 -0
  40. package/dist/catalog/integration-catalog.exposure.d.ts.map +1 -0
  41. package/dist/catalog/integration-catalog.exposure.js +101 -0
  42. package/dist/catalog/integration-catalog.exposure.js.map +1 -0
  43. package/dist/catalog/integration-catalog.http.d.ts +9 -0
  44. package/dist/catalog/integration-catalog.http.d.ts.map +1 -0
  45. package/dist/catalog/integration-catalog.http.js +58 -0
  46. package/dist/catalog/integration-catalog.http.js.map +1 -0
  47. package/dist/catalog/integration-catalog.kind.d.ts +36 -0
  48. package/dist/catalog/integration-catalog.kind.d.ts.map +1 -0
  49. package/dist/catalog/integration-catalog.kind.js +14 -0
  50. package/dist/catalog/integration-catalog.kind.js.map +1 -0
  51. package/dist/catalog/queries.d.ts +6 -0
  52. package/dist/catalog/queries.d.ts.map +1 -0
  53. package/dist/catalog/queries.js +29 -0
  54. package/dist/catalog/queries.js.map +1 -0
  55. package/dist/client/helper.d.ts +5 -0
  56. package/dist/client/helper.d.ts.map +1 -0
  57. package/dist/client/helper.js +6 -0
  58. package/dist/client/helper.js.map +1 -0
  59. package/dist/client/index.d.ts +4 -0
  60. package/dist/client/index.d.ts.map +1 -0
  61. package/dist/client/index.js +3 -0
  62. package/dist/client/index.js.map +1 -0
  63. package/dist/client/integrations.runtime-client.browser.d.ts +10 -0
  64. package/dist/client/integrations.runtime-client.browser.d.ts.map +1 -0
  65. package/dist/client/integrations.runtime-client.browser.js +13 -0
  66. package/dist/client/integrations.runtime-client.browser.js.map +1 -0
  67. package/dist/client/integrations.runtime-client.d.ts +25 -0
  68. package/dist/client/integrations.runtime-client.d.ts.map +1 -0
  69. package/dist/client/integrations.runtime-client.descriptor.d.ts +4 -0
  70. package/dist/client/integrations.runtime-client.descriptor.d.ts.map +1 -0
  71. package/dist/client/integrations.runtime-client.descriptor.js +13 -0
  72. package/dist/client/integrations.runtime-client.descriptor.js.map +1 -0
  73. package/dist/client/integrations.runtime-client.js +41 -0
  74. package/dist/client/integrations.runtime-client.js.map +1 -0
  75. package/dist/docs/integrations.docs.descriptor.d.ts +4 -0
  76. package/dist/docs/integrations.docs.descriptor.d.ts.map +1 -0
  77. package/dist/docs/integrations.docs.descriptor.js +43 -0
  78. package/dist/docs/integrations.docs.descriptor.js.map +1 -0
  79. package/dist/docs/integrations.providers.docs.descriptor.d.ts +4 -0
  80. package/dist/docs/integrations.providers.docs.descriptor.d.ts.map +1 -0
  81. package/dist/docs/integrations.providers.docs.descriptor.js +32 -0
  82. package/dist/docs/integrations.providers.docs.descriptor.js.map +1 -0
  83. package/dist/http/fetch-with-retry.d.ts +27 -0
  84. package/dist/http/fetch-with-retry.d.ts.map +1 -0
  85. package/dist/http/fetch-with-retry.js +76 -0
  86. package/dist/http/fetch-with-retry.js.map +1 -0
  87. package/dist/index.d.ts +24 -0
  88. package/dist/index.d.ts.map +1 -0
  89. package/dist/index.js +16 -0
  90. package/dist/index.js.map +1 -0
  91. package/dist/integrations.browser.plugin.d.ts +11 -0
  92. package/dist/integrations.browser.plugin.d.ts.map +1 -0
  93. package/dist/integrations.browser.plugin.js +26 -0
  94. package/dist/integrations.browser.plugin.js.map +1 -0
  95. package/dist/integrations.consumer.plugin.d.ts +3 -0
  96. package/dist/integrations.consumer.plugin.d.ts.map +1 -0
  97. package/dist/integrations.consumer.plugin.js +12 -0
  98. package/dist/integrations.consumer.plugin.js.map +1 -0
  99. package/dist/integrations.plugin.d.ts +10 -0
  100. package/dist/integrations.plugin.d.ts.map +1 -0
  101. package/dist/integrations.plugin.js +67 -0
  102. package/dist/integrations.plugin.js.map +1 -0
  103. package/dist/kinds/integration-store.context.descriptor.d.ts +31 -0
  104. package/dist/kinds/integration-store.context.descriptor.d.ts.map +1 -0
  105. package/dist/kinds/integration-store.context.descriptor.js +8 -0
  106. package/dist/kinds/integration-store.context.descriptor.js.map +1 -0
  107. package/dist/kinds/integration.kind.d.ts +74 -0
  108. package/dist/kinds/integration.kind.d.ts.map +1 -0
  109. package/dist/kinds/integration.kind.js +542 -0
  110. package/dist/kinds/integration.kind.js.map +1 -0
  111. package/dist/kinds/integration.store.d.ts +30 -0
  112. package/dist/kinds/integration.store.d.ts.map +1 -0
  113. package/dist/kinds/integration.store.js +295 -0
  114. package/dist/kinds/integration.store.js.map +1 -0
  115. package/dist/schemas/boundary.d.ts +7 -0
  116. package/dist/schemas/boundary.d.ts.map +1 -0
  117. package/dist/schemas/boundary.js +16 -0
  118. package/dist/schemas/boundary.js.map +1 -0
  119. package/dist/schemas/catalog.d.ts +135 -0
  120. package/dist/schemas/catalog.d.ts.map +1 -0
  121. package/dist/schemas/catalog.js +13 -0
  122. package/dist/schemas/catalog.js.map +1 -0
  123. package/dist/schemas/credential-resolution.d.ts +35 -0
  124. package/dist/schemas/credential-resolution.d.ts.map +1 -0
  125. package/dist/schemas/credential-resolution.js +14 -0
  126. package/dist/schemas/credential-resolution.js.map +1 -0
  127. package/dist/schemas/http-retry.d.ts +9 -0
  128. package/dist/schemas/http-retry.d.ts.map +1 -0
  129. package/dist/schemas/http-retry.js +8 -0
  130. package/dist/schemas/http-retry.js.map +1 -0
  131. package/dist/schemas/integration-connection.d.ts +79 -0
  132. package/dist/schemas/integration-connection.d.ts.map +1 -0
  133. package/dist/schemas/integration-connection.js +55 -0
  134. package/dist/schemas/integration-connection.js.map +1 -0
  135. package/dist/schemas/integration-descriptor.d.ts +358 -0
  136. package/dist/schemas/integration-descriptor.d.ts.map +1 -0
  137. package/dist/schemas/integration-descriptor.js +153 -0
  138. package/dist/schemas/integration-descriptor.js.map +1 -0
  139. package/dist/schemas/oauth-state.d.ts +30 -0
  140. package/dist/schemas/oauth-state.d.ts.map +1 -0
  141. package/dist/schemas/oauth-state.js +26 -0
  142. package/dist/schemas/oauth-state.js.map +1 -0
  143. package/dist/schemas/settings.d.ts +9 -0
  144. package/dist/schemas/settings.d.ts.map +1 -0
  145. package/dist/schemas/settings.js +8 -0
  146. package/dist/schemas/settings.js.map +1 -0
  147. package/dist/schemas/store.d.ts +68 -0
  148. package/dist/schemas/store.d.ts.map +1 -0
  149. package/dist/schemas/store.js +31 -0
  150. package/dist/schemas/store.js.map +1 -0
  151. package/dist/server/defaults/system-defaults.kind.d.ts +8 -0
  152. package/dist/server/defaults/system-defaults.kind.d.ts.map +1 -0
  153. package/dist/server/defaults/system-defaults.kind.js +13 -0
  154. package/dist/server/defaults/system-defaults.kind.js.map +1 -0
  155. package/dist/server/integration-oauth.d.ts +44 -0
  156. package/dist/server/integration-oauth.d.ts.map +1 -0
  157. package/dist/server/integration-oauth.js +56 -0
  158. package/dist/server/integration-oauth.js.map +1 -0
  159. package/dist/server/integration-secrets.d.ts +11 -0
  160. package/dist/server/integration-secrets.d.ts.map +1 -0
  161. package/dist/server/integration-secrets.js +98 -0
  162. package/dist/server/integration-secrets.js.map +1 -0
  163. package/dist/server/oauth-state.d.ts +74 -0
  164. package/dist/server/oauth-state.d.ts.map +1 -0
  165. package/dist/server/oauth-state.js +208 -0
  166. package/dist/server/oauth-state.js.map +1 -0
  167. package/dist/server/schemas/integration-oauth.d.ts +32 -0
  168. package/dist/server/schemas/integration-oauth.d.ts.map +1 -0
  169. package/dist/server/schemas/integration-oauth.js +20 -0
  170. package/dist/server/schemas/integration-oauth.js.map +1 -0
  171. package/dist/server/schemas/integration-secrets.d.ts +165 -0
  172. package/dist/server/schemas/integration-secrets.d.ts.map +1 -0
  173. package/dist/server/schemas/integration-secrets.js +72 -0
  174. package/dist/server/schemas/integration-secrets.js.map +1 -0
  175. package/dist/server/schemas/system-defaults.d.ts +124 -0
  176. package/dist/server/schemas/system-defaults.d.ts.map +1 -0
  177. package/dist/server/schemas/system-defaults.js +48 -0
  178. package/dist/server/schemas/system-defaults.js.map +1 -0
  179. package/dist/server/system-defaults.d.ts +20 -0
  180. package/dist/server/system-defaults.d.ts.map +1 -0
  181. package/dist/server/system-defaults.js +58 -0
  182. package/dist/server/system-defaults.js.map +1 -0
  183. package/dist/settings/context.d.ts +11 -0
  184. package/dist/settings/context.d.ts.map +1 -0
  185. package/dist/settings/context.js +19 -0
  186. package/dist/settings/context.js.map +1 -0
  187. package/dist/settings/system-settings-reader.context.descriptor.d.ts +43 -0
  188. package/dist/settings/system-settings-reader.context.descriptor.d.ts.map +1 -0
  189. package/dist/settings/system-settings-reader.context.descriptor.js +23 -0
  190. package/dist/settings/system-settings-reader.context.descriptor.js.map +1 -0
  191. package/dist/status/integration-connect.availability.d.ts +16 -0
  192. package/dist/status/integration-connect.availability.d.ts.map +1 -0
  193. package/dist/status/integration-connect.availability.js +14 -0
  194. package/dist/status/integration-connect.availability.js.map +1 -0
  195. package/dist/status/integration-connection-status.d.ts +18 -0
  196. package/dist/status/integration-connection-status.d.ts.map +1 -0
  197. package/dist/status/integration-connection-status.js +17 -0
  198. package/dist/status/integration-connection-status.js.map +1 -0
  199. package/dist/status/integration-connection.capability.d.ts +19 -0
  200. package/dist/status/integration-connection.capability.d.ts.map +1 -0
  201. package/dist/status/integration-connection.capability.js +15 -0
  202. package/dist/status/integration-connection.capability.js.map +1 -0
  203. package/dist/status/integration-connection.kind.d.ts +55 -0
  204. package/dist/status/integration-connection.kind.d.ts.map +1 -0
  205. package/dist/status/integration-connection.kind.js +31 -0
  206. package/dist/status/integration-connection.kind.js.map +1 -0
  207. package/dist/status/integration-connection.queries.d.ts +25 -0
  208. package/dist/status/integration-connection.queries.d.ts.map +1 -0
  209. package/dist/status/integration-connection.queries.js +65 -0
  210. package/dist/status/integration-connection.queries.js.map +1 -0
  211. package/dist/svelte/components/IntegrationsCatalog.svelte +201 -0
  212. package/dist/svelte/components/IntegrationsCatalog.svelte.d.ts +5 -0
  213. package/dist/svelte/components/IntegrationsCatalog.svelte.d.ts.map +1 -0
  214. package/dist/svelte/components/IntegrationsLoader.svelte +46 -0
  215. package/dist/svelte/components/IntegrationsLoader.svelte.d.ts +12 -0
  216. package/dist/svelte/components/IntegrationsLoader.svelte.d.ts.map +1 -0
  217. package/dist/svelte/connect-action.d.ts +20 -0
  218. package/dist/svelte/connect-action.d.ts.map +1 -0
  219. package/dist/svelte/connect-action.js +40 -0
  220. package/dist/svelte/docs/integrations-svelte.catalog.docs.descriptor.d.ts +4 -0
  221. package/dist/svelte/docs/integrations-svelte.catalog.docs.descriptor.d.ts.map +1 -0
  222. package/dist/svelte/docs/integrations-svelte.catalog.docs.descriptor.js +30 -0
  223. package/dist/svelte/index.d.ts +12 -0
  224. package/dist/svelte/index.d.ts.map +1 -0
  225. package/dist/svelte/index.js +7 -0
  226. package/dist/svelte/integrations-svelte.plugin.d.ts +10 -0
  227. package/dist/svelte/integrations-svelte.plugin.d.ts.map +1 -0
  228. package/dist/svelte/integrations-svelte.plugin.js +16 -0
  229. package/dist/svelte/loaders.d.ts +17 -0
  230. package/dist/svelte/loaders.d.ts.map +1 -0
  231. package/dist/svelte/loaders.js +17 -0
  232. package/dist/svelte/runtime.d.ts +12 -0
  233. package/dist/svelte/runtime.d.ts.map +1 -0
  234. package/dist/svelte/runtime.js +11 -0
  235. package/dist/svelte/state.svelte.d.ts +30 -0
  236. package/dist/svelte/state.svelte.d.ts.map +1 -0
  237. package/dist/svelte/state.svelte.js +133 -0
  238. package/dist/svelte/styles.css +2 -0
  239. package/dist/svelte/types.d.ts +13 -0
  240. package/dist/svelte/types.d.ts.map +1 -0
  241. package/dist/svelte/types.js +1 -0
  242. package/package.json +223 -4
@@ -0,0 +1,98 @@
1
+ import { CapabilityError } from '@vibesdotdev/kernel';
2
+ import { publicSecretSchema } from '@vibesdotdev/secrets/schemas';
3
+ import { parseIntegrationBoundary } from "../schemas/boundary.js";
4
+ import { AttachIntegrationSecretOptionsSchema, IntegrationSecretAssociationSchema, ListIntegrationServiceSecretsOptionsSchema, ResolveIntegrationSecretOptionsSchema } from "./schemas/integration-secrets.js";
5
+ const INTEGRATION_RESOURCE_TYPE = 'integration';
6
+ async function secretsClient(runtime) {
7
+ return runtime
8
+ .query('runtime/client')
9
+ .withId('secrets')
10
+ .resolve();
11
+ }
12
+ async function managedSecrets(runtime, scope, scopeId) {
13
+ const client = await secretsClient(runtime);
14
+ return client.managed(scope, scopeId);
15
+ }
16
+ export async function attachSecretToIntegrationService(options) {
17
+ options = parseIntegrationBoundary(AttachIntegrationSecretOptionsSchema, options);
18
+ const managed = await managedSecrets(options.runtime, options.scope, options.scopeId);
19
+ const secret = await managed.get(options.secretId);
20
+ if (!secret) {
21
+ throw new CapabilityError('The managed secret is not available in the selected scope.', 'NOT_FOUND', {
22
+ reason: 'integration-secret-not-found',
23
+ retryable: false
24
+ });
25
+ }
26
+ await options.client.attachSecretToResource({
27
+ secretId: secret.id,
28
+ resourceType: INTEGRATION_RESOURCE_TYPE,
29
+ resourceId: options.serviceId,
30
+ attachedBy: options.attachedBy,
31
+ purpose: options.purpose
32
+ });
33
+ }
34
+ export async function listIntegrationServiceSecrets(options) {
35
+ options = parseIntegrationBoundary(ListIntegrationServiceSecretsOptionsSchema, options);
36
+ const [associations, secrets] = await Promise.all([
37
+ options.client.listSecretsForResource({
38
+ resourceType: INTEGRATION_RESOURCE_TYPE,
39
+ resourceId: options.serviceId
40
+ }),
41
+ (await managedSecrets(options.runtime, options.scope, options.scopeId)).list()
42
+ ]);
43
+ const ids = new Set(associations
44
+ .map((association) => IntegrationSecretAssociationSchema.parse(association).secretId));
45
+ return secrets
46
+ .filter((secret) => ids.has(secret.id))
47
+ .map((secret) => {
48
+ const publicSecret = publicSecretSchema.parse(secret);
49
+ return {
50
+ secretId: publicSecret.id,
51
+ name: publicSecret.name,
52
+ providerType: publicSecret.providerType,
53
+ updatedAt: publicSecret.updatedAt
54
+ };
55
+ });
56
+ }
57
+ export async function resolveIntegrationServiceSecret(options) {
58
+ options = parseIntegrationBoundary(ResolveIntegrationSecretOptionsSchema, options);
59
+ const references = await listIntegrationServiceSecrets({
60
+ runtime: options.runtime,
61
+ client: options.client,
62
+ serviceId: options.serviceId,
63
+ scope: options.scope,
64
+ scopeId: options.scopeId
65
+ });
66
+ const selected = references.find((secret) => (options.reference === undefined || secret.name === options.reference.key)
67
+ && (options.secretName === undefined || secret.name === options.secretName)
68
+ && (options.providerType === undefined || secret.providerType === options.providerType));
69
+ if (!selected)
70
+ return undefined;
71
+ if (options.recordUsage && !options.client.recordSecretUsage) {
72
+ throw new CapabilityError('Secret usage recording is unavailable.', 'UNAVAILABLE', {
73
+ reason: 'integration-secret-usage-unavailable',
74
+ retryable: false
75
+ });
76
+ }
77
+ const client = await secretsClient(options.runtime);
78
+ const reference = client.managedCredentialReference(selected.secretId);
79
+ const result = await options.runtime.resolveCredential(reference);
80
+ if (!result.ok)
81
+ throw result.error;
82
+ if (options.recordUsage) {
83
+ await options.client.recordSecretUsage?.({
84
+ resourceType: INTEGRATION_RESOURCE_TYPE,
85
+ resourceId: options.serviceId,
86
+ secretId: selected.secretId
87
+ });
88
+ }
89
+ return result.value;
90
+ }
91
+ export async function sendIntegrationAuthenticatedRequest(runtime, input) {
92
+ return (await secretsClient(runtime)).sendAuthenticatedRequest(input);
93
+ }
94
+ /** Forward credential use to Secrets without reading or returning signing key material. */
95
+ export async function signIntegrationPayload(runtime, input) {
96
+ return (await secretsClient(runtime)).signPayload(input);
97
+ }
98
+ //# sourceMappingURL=integration-secrets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration-secrets.js","sourceRoot":"","sources":["../../src/server/integration-secrets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAA2C,MAAM,qBAAqB,CAAC;AAE/F,OAAO,EAAE,kBAAkB,EAA6E,MAAM,8BAA8B,CAAC;AAC7I,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EACN,oCAAoC,EACpC,kCAAkC,EAClC,0CAA0C,EAC1C,qCAAqC,EAKrC,MAAM,kCAAkC,CAAC;AAU1C,MAAM,yBAAyB,GAAG,aAAsB,CAAC;AAEzD,KAAK,UA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AAC,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC;AACrB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mCAAmC,CACxD,OAAmB,EACnB,KAAqC;IAErC,OAAO,CAAC,MAAM,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;AACvE,CAAC;AAED,2FAA2F;AAC3F,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,OAAmB,EAAE,KAAsC;IACvG,OAAO,CAAC,MAAM,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC1D,CAAC"}
@@ -0,0 +1,74 @@
1
+ import { type OauthStateOptions, type SignedOauthStatePayload, type IssueSignedOauthStateInput, type ReadSignedOauthStateInput } from '../schemas/oauth-state.ts';
2
+ export type { OauthStateOptions, SignedOauthStatePayload } from '../schemas/oauth-state.ts';
3
+ /**
4
+ * OAuth integration connect/callback state.
5
+ *
6
+ * Every host that exposes `/api/integrations/[id]/connect` +
7
+ * `/api/integrations/[id]/callback` (or provider-specific equivalents) needs
8
+ * to defend the OAuth roundtrip against CSRF. The proven pattern in this
9
+ * monorepo is the standard one: issue a random state token, persist it in
10
+ * an HTTP-only `SameSite=Lax` cookie scoped to the callback path, embed it
11
+ * in the authorization URL, and on return compare the URL `state` against
12
+ * the cookie value in constant time before deleting the cookie.
13
+ *
14
+ * Why a cookie, not server-side storage: the cookie is tied to the same
15
+ * browser that initiated the flow (which is what CSRF protection actually
16
+ * needs), has zero infrastructure dependencies, and survives across
17
+ * single-region Workers, multi-region Workers, and local dev without any
18
+ * deploy-time binding setup. A KV-backed implementation that fails open
19
+ * when the binding is absent is strictly worse — that's the bug this
20
+ * helper exists to prevent.
21
+ *
22
+ * This module is framework-agnostic on purpose: it talks to a structural
23
+ * `CookieJar` interface that SvelteKit's `event.cookies` satisfies
24
+ * directly (and that any other framework can satisfy with a small shim).
25
+ * Per `packages/integrations/SPEC.md` hard rules, this package must not
26
+ * import `@sveltejs/kit`.
27
+ */
28
+ /**
29
+ * Structural shape that SvelteKit's `event.cookies` already satisfies.
30
+ * Other frameworks can satisfy this with a tiny adapter.
31
+ */
32
+ export interface OauthStateCookieJar {
33
+ get(name: string): string | undefined;
34
+ set(name: string, value: string, options: {
35
+ path: string;
36
+ httpOnly?: boolean;
37
+ sameSite?: 'lax' | 'strict' | 'none';
38
+ secure?: boolean;
39
+ maxAge?: number;
40
+ }): void;
41
+ delete(name: string, options: {
42
+ path: string;
43
+ }): void;
44
+ }
45
+ export interface OauthStateHandle {
46
+ /** Generate a random state token, set the cookie, return the token for the auth URL. */
47
+ issue(): string;
48
+ /**
49
+ * Validate `returnedState` (from the callback URL) against the stored
50
+ * cookie value in constant time. Deletes the cookie on success.
51
+ * Throws `CapabilityError` on any failure (missing, wrong, replayed).
52
+ */
53
+ validate(returnedState: string | null | undefined): void;
54
+ }
55
+ /**
56
+ * Build a per-integration state handle.
57
+ *
58
+ * @param integrationId - Descriptor id, e.g. `'integration.quickbooks'`. Used
59
+ * as the cookie-name discriminator so two parallel OAuth flows in the same
60
+ * browser don't clobber each other.
61
+ * @param cookies - Cookie jar (SvelteKit `event.cookies` satisfies this).
62
+ * @param options - Optional overrides.
63
+ */
64
+ export declare function createOauthState(integrationId: string, cookies: OauthStateCookieJar, options?: OauthStateOptions): OauthStateHandle;
65
+ /**
66
+ * Issue a signed OAuth state token: `v1.<base64url payload>.<base64url hmac>`.
67
+ */
68
+ export declare function issueSignedOauthState(input: IssueSignedOauthStateInput): Promise<string>;
69
+ /**
70
+ * Validate and decode a signed OAuth state token. Throws
71
+ * `SignedOauthStateError` on missing/malformed/forged/expired states.
72
+ */
73
+ export declare function readSignedOauthState(input: ReadSignedOauthStateInput): Promise<SignedOauthStatePayload>;
74
+ //# sourceMappingURL=oauth-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-state.d.ts","sourceRoot":"","sources":["../../src/server/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,EAAE,yBAAyB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAoC7G"}
@@ -0,0 +1,208 @@
1
+ import { CapabilityError } from '@vibesdotdev/kernel';
2
+ import { parseIntegrationBoundary } from "../schemas/boundary.js";
3
+ import { OauthStateOptionsSchema, IssueSignedOauthStateSchema, ReadSignedOauthStateSchema, SignedOauthStatePayloadSchema } from "../schemas/oauth-state.js";
4
+ /**
5
+ * Build a per-integration state handle.
6
+ *
7
+ * @param integrationId - Descriptor id, e.g. `'integration.quickbooks'`. Used
8
+ * as the cookie-name discriminator so two parallel OAuth flows in the same
9
+ * browser don't clobber each other.
10
+ * @param cookies - Cookie jar (SvelteKit `event.cookies` satisfies this).
11
+ * @param options - Optional overrides.
12
+ */
13
+ export function createOauthState(integrationId, cookies, options = {}) {
14
+ const cookieName = cookieNameFor(integrationId);
15
+ const parsed = parseIntegrationBoundary(OauthStateOptionsSchema, options);
16
+ const path = parsed.callbackPath;
17
+ const ttlSeconds = parsed.ttlSeconds;
18
+ const secure = parsed.secure;
19
+ return {
20
+ issue() {
21
+ const token = generateStateToken();
22
+ // SameSite=Lax, NOT 'none': the OAuth callback is a top-level GET
23
+ // navigation, which Lax cookies ARE sent on, and same
24
+ // registrable-domain subdomains are same-site anyway. 'none'
25
+ // requires `Secure`, so on plain-http local dev the browser
26
+ // silently drops the cookie and every callback fails state
27
+ // validation. See SPEC.md §Owns → oauth-state.ts.
28
+ cookies.set(cookieName, token, {
29
+ path,
30
+ httpOnly: true,
31
+ sameSite: 'lax',
32
+ secure,
33
+ maxAge: ttlSeconds
34
+ });
35
+ return token;
36
+ },
37
+ validate(returnedState) {
38
+ const stored = cookies.get(cookieName);
39
+ if (!returnedState) {
40
+ throw new CapabilityError('OAuth state validation failed.', 'INVALID_INPUT', { reason: 'oauth-state-missing', retryable: false });
41
+ }
42
+ if (!stored) {
43
+ // Missing state typically means the flow expired (10-minute
44
+ // cookie TTL) or the callback was opened in a different
45
+ // browser than the one that initiated the connect.
46
+ throw new CapabilityError('OAuth state validation failed.', 'INVALID_INPUT', { reason: 'oauth-state-missing', retryable: false });
47
+ }
48
+ if (!constantTimeEqual(returnedState, stored)) {
49
+ // Don't clear on mismatch: a parallel/abandoned flow in
50
+ // the same browser shouldn't be allowed to nuke an
51
+ // otherwise-valid pending state. The 256-bit token isn't
52
+ // brute-forceable and is single-use against the upstream
53
+ // provider's `code`, so leaving the cookie is safe.
54
+ throw new CapabilityError('OAuth state validation failed.', 'INVALID_INPUT', { reason: 'oauth-state-mismatch', retryable: false });
55
+ }
56
+ // Successful match: consume the cookie so the same state
57
+ // can't be replayed.
58
+ cookies.delete(cookieName, { path });
59
+ }
60
+ };
61
+ }
62
+ /**
63
+ * Cookie name derived from the integration id. Stable, URL-safe, and
64
+ * collision-free across providers in the same browser.
65
+ */
66
+ function cookieNameFor(integrationId) {
67
+ return `oauth_state.${integrationId.replace(/[^a-zA-Z0-9._-]/g, '_')}`;
68
+ }
69
+ /**
70
+ * Generate a 256-bit state token, hex-encoded. Uses Web Crypto, which is
71
+ * present in every runtime this monorepo targets (Workers, Node 18+, Bun).
72
+ */
73
+ function generateStateToken() {
74
+ const bytes = new Uint8Array(32);
75
+ crypto.getRandomValues(bytes);
76
+ let hex = '';
77
+ for (const byte of bytes) {
78
+ hex += byte.toString(16).padStart(2, '0');
79
+ }
80
+ return hex;
81
+ }
82
+ /**
83
+ * Constant-time string comparison. Avoids the byte-by-byte short-circuit
84
+ * that would leak token prefixes via timing.
85
+ */
86
+ function constantTimeEqual(a, b) {
87
+ if (a.length !== b.length)
88
+ return false;
89
+ let diff = 0;
90
+ for (let i = 0; i < a.length; i++) {
91
+ diff |= a.charCodeAt(i) ^ b.charCodeAt(i);
92
+ }
93
+ return diff === 0;
94
+ }
95
+ // ─────────────────────────────────────────────────────────────────────────────
96
+ // Signed-payload state (sanctioned variant)
97
+ //
98
+ // The cookie-backed `createOauthState` above is the default and what every
99
+ // host should reach for first. Some upstream providers, however, drop side
100
+ // cookies across their consent roundtrip even when the redirect is a
101
+ // top-level GET (observed with Intuit/QuickBooks). For those flows the host
102
+ // also needs to transport server-trusted context (orgId, returnTo) through
103
+ // the roundtrip without trusting query params. The signed-payload state
104
+ // below is the ONE sanctioned alternative: an HMAC-SHA256-signed,
105
+ // TTL-bounded `state` value carrying `{ nonce, iat, orgId, returnTo? }`.
106
+ //
107
+ // Trade-off (documented, deliberate): unlike the cookie variant, a signed
108
+ // state is not bound to the initiating browser — it is a short-lived bearer
109
+ // artifact. Hosts that use it MUST re-validate org membership AND the
110
+ // manage-connection role on the callback before acting on the payload, and
111
+ // MUST pass any returnTo through their safe-redirect allowlist.
112
+ //
113
+ // Key hygiene: callers supply a `secret` (hosts should prefer a dedicated
114
+ // signing secret; QuickBooks currently passes the Intuit clientSecret). The
115
+ // HMAC key material is domain-separated with a fixed prefix so even a reused
116
+ // credential yields a signing key distinct from any other HMAC use of that
117
+ // secret.
118
+ // ─────────────────────────────────────────────────────────────────────────────
119
+ const SIGNED_STATE_VERSION = 'v1';
120
+ /** Domain-separation prefix mixed into the HMAC key material. */
121
+ const SIGNED_STATE_KEY_DOMAIN = 'vibes.integrations.signed-oauth-state.v1';
122
+ const textEncoder = new TextEncoder();
123
+ const textDecoder = new TextDecoder();
124
+ /**
125
+ * Issue a signed OAuth state token: `v1.<base64url payload>.<base64url hmac>`.
126
+ */
127
+ export async function issueSignedOauthState(input) {
128
+ input = parseIntegrationBoundary(IssueSignedOauthStateSchema, input);
129
+ const payload = {
130
+ v: 1,
131
+ nonce: base64UrlEncode(randomBytes(16)),
132
+ iat: input.now ?? Date.now(),
133
+ orgId: input.orgId,
134
+ returnTo: input.returnTo ?? undefined
135
+ };
136
+ const encodedPayload = base64UrlEncode(textEncoder.encode(JSON.stringify(payload)));
137
+ const signature = await signStatePayload(encodedPayload, input.secret);
138
+ return `${SIGNED_STATE_VERSION}.${encodedPayload}.${signature}`;
139
+ }
140
+ /**
141
+ * Validate and decode a signed OAuth state token. Throws
142
+ * `SignedOauthStateError` on missing/malformed/forged/expired states.
143
+ */
144
+ export async function readSignedOauthState(input) {
145
+ const options = parseIntegrationBoundary(ReadSignedOauthStateSchema, input);
146
+ if (!options.state) {
147
+ throw new CapabilityError('Signed OAuth state validation failed.', 'INVALID_INPUT', { reason: 'oauth-signed-state-missing', retryable: false });
148
+ }
149
+ const parts = options.state.split('.');
150
+ if (parts.length !== 3 || parts[0] !== SIGNED_STATE_VERSION || !parts[1] || !parts[2]) {
151
+ throw new CapabilityError('Signed OAuth state validation failed.', 'INVALID_INPUT', { reason: 'oauth-signed-state-malformed', retryable: false });
152
+ }
153
+ const expectedSignature = await signStatePayload(parts[1], options.secret);
154
+ if (!constantTimeEqual(parts[2], expectedSignature)) {
155
+ throw new CapabilityError('Signed OAuth state validation failed.', 'INVALID_INPUT', { reason: 'oauth-signed-state-signature', retryable: false });
156
+ }
157
+ let decoded;
158
+ try {
159
+ decoded = JSON.parse(textDecoder.decode(base64UrlDecode(parts[1])));
160
+ }
161
+ catch (cause) {
162
+ throw new CapabilityError('Signed OAuth state payload is malformed.', 'INVALID_INPUT', {
163
+ reason: 'oauth-signed-state-malformed', retryable: false, cause
164
+ });
165
+ }
166
+ const result = SignedOauthStatePayloadSchema.safeParse(decoded);
167
+ if (!result.success) {
168
+ throw new CapabilityError('Signed OAuth state payload is invalid.', 'INVALID_INPUT', {
169
+ reason: 'oauth-signed-state-malformed', retryable: false, cause: result.error
170
+ });
171
+ }
172
+ const payload = result.data;
173
+ const age = (options.now ?? Date.now()) - payload.iat;
174
+ if (age < 0 || age >= options.ttlMs) {
175
+ throw new CapabilityError('Signed OAuth state expired.', 'INVALID_INPUT', {
176
+ reason: 'oauth-signed-state-expired', retryable: false
177
+ });
178
+ }
179
+ return payload;
180
+ }
181
+ async function signStatePayload(payload, secret) {
182
+ const key = await crypto.subtle.importKey('raw', textEncoder.encode(`${SIGNED_STATE_KEY_DOMAIN}${secret}`), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign']);
183
+ const signature = await crypto.subtle.sign('HMAC', key, textEncoder.encode(payload));
184
+ return base64UrlEncode(new Uint8Array(signature));
185
+ }
186
+ function randomBytes(length) {
187
+ const bytes = new Uint8Array(length);
188
+ crypto.getRandomValues(bytes);
189
+ return bytes;
190
+ }
191
+ function base64UrlEncode(bytes) {
192
+ let binary = '';
193
+ for (const byte of bytes) {
194
+ binary += String.fromCharCode(byte);
195
+ }
196
+ return btoa(binary).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/u, '');
197
+ }
198
+ function base64UrlDecode(value) {
199
+ const base64 = value.replace(/-/g, '+').replace(/_/g, '/');
200
+ const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, '=');
201
+ const binary = atob(padded);
202
+ const bytes = new Uint8Array(binary.length);
203
+ for (let i = 0; i < binary.length; i += 1) {
204
+ bytes[i] = binary.charCodeAt(i);
205
+ }
206
+ return bytes;
207
+ }
208
+ //# sourceMappingURL=oauth-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-state.js","sourceRoot":"","sources":["../../src/server/oauth-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,6BAA6B,EAAyH,MAAM,2BAA2B,CAAC;AA4DnR;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAC/B,aAAqB,EACrB,OAA4B,EAC5B,UAA6B,EAAE;IAE/B,MAAM,UAAU,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,wBAAwB,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;IAC1E,MAAM,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC;IACjC,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IACrC,MAAM,MAAM,GAAG,MAAM,CAA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,CAAC;IACrC,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IAC9B,OAAO,KAAK,CAAC;AACd,CAAC;AAED,SAAS,eAAe,CAAC,KAAiB;IACzC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC1B,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACjF,CAAC;AAED,SAAS,eAAe,CAAC,KAAa;IACrC,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IACpE,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5B,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3C,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,KAAK,CAAC;AACd,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Integration OAuth boundary schemas.
3
+ *
4
+ * The authorization URL a browser follows is public routing data, but it carries
5
+ * the client identifier, which is a host-managed credential. The caller therefore
6
+ * hands Secrets a URL template plus the identifier's credential candidates, and the
7
+ * finished URL is the only thing that comes back.
8
+ */
9
+ import * as z from 'zod/v4';
10
+ /**
11
+ * An authorization URL awaiting its client identifier, with the ordered
12
+ * candidates for that identifier. Values stay with Secrets; the URL template is the
13
+ * only thing that is public.
14
+ */
15
+ export declare const IntegrationClientIdResolutionSchema: z.ZodObject<{
16
+ authorizationUrl: z.ZodURL;
17
+ clientId: z.ZodArray<z.ZodUnion<readonly [z.ZodDiscriminatedUnion<[z.ZodObject<{
18
+ source: z.ZodLiteral<"secret">;
19
+ key: z.ZodString;
20
+ store: z.ZodOptional<z.ZodString>;
21
+ operation: z.ZodOptional<z.ZodCustom<object, object>>;
22
+ }, z.core.$strict>], "source">, z.ZodObject<{
23
+ source: z.ZodLiteral<"oauth-account">;
24
+ providerId: z.ZodString;
25
+ token: z.ZodDefault<z.ZodEnum<{
26
+ accessToken: "accessToken";
27
+ refreshToken: "refreshToken";
28
+ }>>;
29
+ }, z.core.$strict>]>>;
30
+ }, z.core.$strict>;
31
+ export type IntegrationClientIdResolution = z.infer<typeof IntegrationClientIdResolutionSchema>;
32
+ //# sourceMappingURL=integration-oauth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration-oauth.d.ts","sourceRoot":"","sources":["../../../src/server/schemas/integration-oauth.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAG5B;;;;GAIG;AACH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;kBAGrC,CAAC;AAEZ,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Integration OAuth boundary schemas.
3
+ *
4
+ * The authorization URL a browser follows is public routing data, but it carries
5
+ * the client identifier, which is a host-managed credential. The caller therefore
6
+ * hands Secrets a URL template plus the identifier's credential candidates, and the
7
+ * finished URL is the only thing that comes back.
8
+ */
9
+ import * as z from 'zod/v4';
10
+ import { CredentialCandidatesSchema } from '@vibesdotdev/secrets/schemas';
11
+ /**
12
+ * An authorization URL awaiting its client identifier, with the ordered
13
+ * candidates for that identifier. Values stay with Secrets; the URL template is the
14
+ * only thing that is public.
15
+ */
16
+ export const IntegrationClientIdResolutionSchema = z.object({
17
+ authorizationUrl: z.url(),
18
+ clientId: CredentialCandidatesSchema
19
+ }).strict();
20
+ //# sourceMappingURL=integration-oauth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration-oauth.js","sourceRoot":"","sources":["../../../src/server/schemas/integration-oauth.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E;;;;GAIG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3D,gBAAgB,EAAE,CAAC,CAAC,GAAG,EAAE;IACzB,QAAQ,EAAE,0BAA0B;CACpC,CAAC,CAAC,MAAM,EAAE,CAAC"}
@@ -0,0 +1,165 @@
1
+ import * as z from 'zod/v4';
2
+ import type { RuntimeRef } from '@vibesdotdev/kernel';
3
+ import { type CredentialReference } from '@vibesdotdev/kernel/credentials';
4
+ import { type ManagedSecretScope, type PublicSecret } from '@vibesdotdev/secrets/schemas';
5
+ export declare const IntegrationSecretResourceTypeSchema: z.ZodLiteral<"integration">;
6
+ export type IntegrationSecretResourceType = z.infer<typeof IntegrationSecretResourceTypeSchema>;
7
+ export declare const AttachSecretToResourceInputSchema: z.ZodObject<{
8
+ secretId: z.ZodString;
9
+ resourceType: z.ZodLiteral<"integration">;
10
+ resourceId: z.ZodString;
11
+ attachedBy: z.ZodString;
12
+ purpose: z.ZodOptional<z.ZodNullable<z.ZodString>>;
13
+ }, z.core.$strict>;
14
+ export type AttachSecretToResourceInput = z.infer<typeof AttachSecretToResourceInputSchema>;
15
+ export declare const ListSecretsForResourceInputSchema: z.ZodObject<{
16
+ resourceType: z.ZodLiteral<"integration">;
17
+ resourceId: z.ZodString;
18
+ }, z.core.$strict>;
19
+ export type ListSecretsForResourceInput = z.infer<typeof ListSecretsForResourceInputSchema>;
20
+ export declare const IntegrationSecretAssociationSchema: z.ZodObject<{
21
+ secretId: z.ZodString;
22
+ }, z.core.$strict>;
23
+ export type IntegrationSecretAssociation = z.infer<typeof IntegrationSecretAssociationSchema>;
24
+ /** Integration-facing projection composed from the secrets owner's public metadata. */
25
+ export type IntegrationSecretReference = Pick<PublicSecret, 'name' | 'providerType' | 'updatedAt'> & {
26
+ secretId: string;
27
+ };
28
+ export declare const RecordSecretUsageInputSchema: z.ZodObject<{
29
+ resourceType: z.ZodLiteral<"integration">;
30
+ resourceId: z.ZodString;
31
+ secretId: z.ZodString;
32
+ }, z.core.$strict>;
33
+ export type RecordSecretUsageInput = z.infer<typeof RecordSecretUsageInputSchema>;
34
+ /** Association metadata only. Credential values remain owned by secrets/store. */
35
+ export declare const IntegrationSecretClientSchema: z.ZodObject<{
36
+ attachSecretToResource: z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
37
+ secretId: z.ZodString;
38
+ resourceType: z.ZodLiteral<"integration">;
39
+ resourceId: z.ZodString;
40
+ attachedBy: z.ZodString;
41
+ purpose: z.ZodOptional<z.ZodNullable<z.ZodString>>;
42
+ }, z.core.$strict>], null>, z.ZodPromise<z.ZodVoid>>;
43
+ listSecretsForResource: z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
44
+ resourceType: z.ZodLiteral<"integration">;
45
+ resourceId: z.ZodString;
46
+ }, z.core.$strict>], null>, z.ZodPromise<z.ZodReadonly<z.ZodArray<z.ZodObject<{
47
+ secretId: z.ZodString;
48
+ }, z.core.$strict>>>>>;
49
+ recordSecretUsage: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
50
+ resourceType: z.ZodLiteral<"integration">;
51
+ resourceId: z.ZodString;
52
+ secretId: z.ZodString;
53
+ }, z.core.$strict>], null>, z.ZodPromise<z.ZodVoid>>>;
54
+ }, z.core.$strict>;
55
+ export type IntegrationSecretClient = z.infer<typeof IntegrationSecretClientSchema>;
56
+ export declare const AttachIntegrationSecretOptionsSchema: z.ZodObject<{
57
+ runtime: z.ZodCustom<RuntimeRef, RuntimeRef>;
58
+ client: z.ZodObject<{
59
+ attachSecretToResource: z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
60
+ secretId: z.ZodString;
61
+ resourceType: z.ZodLiteral<"integration">;
62
+ resourceId: z.ZodString;
63
+ attachedBy: z.ZodString;
64
+ purpose: z.ZodOptional<z.ZodNullable<z.ZodString>>;
65
+ }, z.core.$strict>], null>, z.ZodPromise<z.ZodVoid>>;
66
+ listSecretsForResource: z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
67
+ resourceType: z.ZodLiteral<"integration">;
68
+ resourceId: z.ZodString;
69
+ }, z.core.$strict>], null>, z.ZodPromise<z.ZodReadonly<z.ZodArray<z.ZodObject<{
70
+ secretId: z.ZodString;
71
+ }, z.core.$strict>>>>>;
72
+ recordSecretUsage: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
73
+ resourceType: z.ZodLiteral<"integration">;
74
+ resourceId: z.ZodString;
75
+ secretId: z.ZodString;
76
+ }, z.core.$strict>], null>, z.ZodPromise<z.ZodVoid>>>;
77
+ }, z.core.$strict>;
78
+ serviceId: z.ZodString;
79
+ secretId: z.ZodString;
80
+ attachedBy: z.ZodString;
81
+ scope: z.ZodEnum<{
82
+ user: "user";
83
+ platform: "platform";
84
+ project: "project";
85
+ org: "org";
86
+ }>;
87
+ scopeId: z.ZodString;
88
+ purpose: z.ZodOptional<z.ZodNullable<z.ZodString>>;
89
+ }, z.core.$strict>;
90
+ export type AttachIntegrationSecretOptions = z.infer<typeof AttachIntegrationSecretOptionsSchema>;
91
+ export declare const ListIntegrationServiceSecretsOptionsSchema: z.ZodObject<{
92
+ runtime: z.ZodCustom<RuntimeRef, RuntimeRef>;
93
+ client: z.ZodObject<{
94
+ attachSecretToResource: z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
95
+ secretId: z.ZodString;
96
+ resourceType: z.ZodLiteral<"integration">;
97
+ resourceId: z.ZodString;
98
+ attachedBy: z.ZodString;
99
+ purpose: z.ZodOptional<z.ZodNullable<z.ZodString>>;
100
+ }, z.core.$strict>], null>, z.ZodPromise<z.ZodVoid>>;
101
+ listSecretsForResource: z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
102
+ resourceType: z.ZodLiteral<"integration">;
103
+ resourceId: z.ZodString;
104
+ }, z.core.$strict>], null>, z.ZodPromise<z.ZodReadonly<z.ZodArray<z.ZodObject<{
105
+ secretId: z.ZodString;
106
+ }, z.core.$strict>>>>>;
107
+ recordSecretUsage: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
108
+ resourceType: z.ZodLiteral<"integration">;
109
+ resourceId: z.ZodString;
110
+ secretId: z.ZodString;
111
+ }, z.core.$strict>], null>, z.ZodPromise<z.ZodVoid>>>;
112
+ }, z.core.$strict>;
113
+ serviceId: z.ZodString;
114
+ scope: z.ZodEnum<{
115
+ user: "user";
116
+ platform: "platform";
117
+ project: "project";
118
+ org: "org";
119
+ }>;
120
+ scopeId: z.ZodString;
121
+ }, z.core.$strict>;
122
+ export type ListIntegrationServiceSecretsOptions = z.infer<typeof ListIntegrationServiceSecretsOptionsSchema>;
123
+ export declare const ResolveIntegrationSecretOptionsSchema: z.ZodObject<{
124
+ runtime: z.ZodCustom<RuntimeRef, RuntimeRef>;
125
+ client: z.ZodObject<{
126
+ attachSecretToResource: z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
127
+ secretId: z.ZodString;
128
+ resourceType: z.ZodLiteral<"integration">;
129
+ resourceId: z.ZodString;
130
+ attachedBy: z.ZodString;
131
+ purpose: z.ZodOptional<z.ZodNullable<z.ZodString>>;
132
+ }, z.core.$strict>], null>, z.ZodPromise<z.ZodVoid>>;
133
+ listSecretsForResource: z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
134
+ resourceType: z.ZodLiteral<"integration">;
135
+ resourceId: z.ZodString;
136
+ }, z.core.$strict>], null>, z.ZodPromise<z.ZodReadonly<z.ZodArray<z.ZodObject<{
137
+ secretId: z.ZodString;
138
+ }, z.core.$strict>>>>>;
139
+ recordSecretUsage: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
140
+ resourceType: z.ZodLiteral<"integration">;
141
+ resourceId: z.ZodString;
142
+ secretId: z.ZodString;
143
+ }, z.core.$strict>], null>, z.ZodPromise<z.ZodVoid>>>;
144
+ }, z.core.$strict>;
145
+ serviceId: z.ZodString;
146
+ secretName: z.ZodOptional<z.ZodString>;
147
+ providerType: z.ZodOptional<z.ZodString>;
148
+ reference: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
149
+ source: z.ZodLiteral<"secret">;
150
+ key: z.ZodString;
151
+ store: z.ZodOptional<z.ZodString>;
152
+ operation: z.ZodOptional<z.ZodCustom<object, object>>;
153
+ }, z.core.$strict>], "source">>;
154
+ scope: z.ZodEnum<{
155
+ user: "user";
156
+ platform: "platform";
157
+ project: "project";
158
+ org: "org";
159
+ }>;
160
+ scopeId: z.ZodString;
161
+ recordUsage: z.ZodDefault<z.ZodBoolean>;
162
+ }, z.core.$strict>;
163
+ export type ResolveIntegrationSecretOptions = z.infer<typeof ResolveIntegrationSecretOptionsSchema>;
164
+ export type { CredentialReference, ManagedSecretScope };
165
+ //# sourceMappingURL=integration-secrets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration-secrets.d.ts","sourceRoot":"","sources":["../../../src/server/schemas/integration-secrets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,q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