@tangle-network/agent-integrations 0.75.4 → 0.76.2
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.
- package/README.md +10 -14
- package/data/bundled-adapter-manifests.json +1 -1
- package/dist/{adapters-CrN3lR4d.js → adapters-Bx-UTWRg.js} +55 -8
- package/dist/{adapters-CrN3lR4d.js.map → adapters-Bx-UTWRg.js.map} +1 -1
- package/dist/{bundled-manifest-data-C7dav10o.js → bundled-manifest-data-BgTJ7dmp.js} +33 -1
- package/dist/{bundled-manifest-data-C7dav10o.js.map → bundled-manifest-data-BgTJ7dmp.js.map} +1 -1
- package/dist/{bundled-manifest-runtime-G6p2i9W-.d.ts → bundled-manifest-runtime-EpjLQKA9.d.ts} +7 -3
- package/dist/bundled-manifest-runtime-EpjLQKA9.d.ts.map +1 -0
- package/dist/{catalog-DmAjfp4i.d.ts → catalog-z4zNeXVL.d.ts} +3 -3
- package/dist/{catalog-DmAjfp4i.d.ts.map → catalog-z4zNeXVL.d.ts.map} +1 -1
- package/dist/catalog.d.ts +1 -1
- package/dist/{cloudbeds-BL5EF3xl.js → cloudbeds-CGSoT275.js} +17 -2
- package/dist/cloudbeds-CGSoT275.js.map +1 -0
- package/dist/connect/index.d.ts +1 -1
- package/dist/connect/index.js +1 -1
- package/dist/connectors/adapters/index.d.ts +2 -2
- package/dist/connectors/adapters/index.js +3 -3
- package/dist/connectors/index.d.ts +7 -7
- package/dist/connectors/index.js +8 -7
- package/dist/connectors/oauth.d.ts +2 -2
- package/dist/connectors/oauth.js +7 -205
- package/dist/connectors/oauth.js.map +1 -1
- package/dist/{consumer-BafUQUla.d.ts → consumer-YE5ibTlI.d.ts} +18 -9
- package/dist/consumer-YE5ibTlI.d.ts.map +1 -0
- package/dist/consumer.d.ts +1 -1
- package/dist/consumer.js +1 -1
- package/dist/{core-types-DfCMwTYt.d.ts → core-types-0BenSoZJ.d.ts} +17 -3
- package/dist/core-types-0BenSoZJ.d.ts.map +1 -0
- package/dist/{coverage-catalog-oQiZ8yot.d.ts → coverage-catalog-5LheuThC.d.ts} +2 -2
- package/dist/{coverage-catalog-oQiZ8yot.d.ts.map → coverage-catalog-5LheuThC.d.ts.map} +1 -1
- package/dist/coverage-catalog.d.ts +1 -1
- package/dist/{hub-D13zPQGr.js → hub-BjCYNJWr.js} +316 -149
- package/dist/hub-BjCYNJWr.js.map +1 -0
- package/dist/{hub-fmmnwC2s.d.ts → hub-DkiKVWJX.d.ts} +5 -3
- package/dist/hub-DkiKVWJX.d.ts.map +1 -0
- package/dist/hub.d.ts +1 -1
- package/dist/hub.js +1 -1
- package/dist/{index-DbwNiedC.d.ts → index-BFK-G6g1.d.ts} +2 -2
- package/dist/{index-DbwNiedC.d.ts.map → index-BFK-G6g1.d.ts.map} +1 -1
- package/dist/{index-CHD_8Gn2.d.ts → index-BNzWrQM0.d.ts} +3 -3
- package/dist/{index-CHD_8Gn2.d.ts.map → index-BNzWrQM0.d.ts.map} +1 -1
- package/dist/{index-B-VH5b3E.d.ts → index-CkCYzn8f.d.ts} +2 -2
- package/dist/{index-B-VH5b3E.d.ts.map → index-CkCYzn8f.d.ts.map} +1 -1
- package/dist/{index-BKTHRkGz.d.ts → index-WwSnaq5E.d.ts} +11 -2
- package/dist/{index-BKTHRkGz.d.ts.map → index-WwSnaq5E.d.ts.map} +1 -1
- package/dist/{index-CW1fmxQi.d.ts → index-poLalSQ6.d.ts} +3 -3
- package/dist/{index-CW1fmxQi.d.ts.map → index-poLalSQ6.d.ts.map} +1 -1
- package/dist/index.d.ts +18 -18
- package/dist/index.js +11 -10
- package/dist/internal/bundled-manifest-runtime.d.ts +1 -1
- package/dist/internal/bundled-manifest-runtime.js +30 -2
- package/dist/internal/bundled-manifest-runtime.js.map +1 -1
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +2 -2
- package/dist/middleware/index.d.ts +1 -1
- package/dist/middleware/index.js +1 -1
- package/dist/{oauth-tzsnaJIb.d.ts → oauth-DoUCpYU_.d.ts} +85 -64
- package/dist/oauth-DoUCpYU_.d.ts.map +1 -0
- package/dist/oauth-protocol-CFrGJlSz.js +195 -0
- package/dist/oauth-protocol-CFrGJlSz.js.map +1 -0
- package/dist/{policy-C9frNJFH.d.ts → policy-C8jynxf9.d.ts} +2 -2
- package/dist/{policy-C9frNJFH.d.ts.map → policy-C8jynxf9.d.ts.map} +1 -1
- package/dist/{registry-CE1iu5zX.d.ts → registry-0xWMSBUu.d.ts} +3 -3
- package/dist/{registry-CE1iu5zX.d.ts.map → registry-0xWMSBUu.d.ts.map} +1 -1
- package/dist/{registry-core-DtFI-9kF.d.ts → registry-core-B1ApiG47.d.ts} +2 -2
- package/dist/{registry-core-DtFI-9kF.d.ts.map → registry-core-B1ApiG47.d.ts.map} +1 -1
- package/dist/registry.d.ts +2 -2
- package/dist/registry.js +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/sandbox.d.ts +1 -1
- package/dist/{specs-Dp7I8aL5.js → specs-02Un982U.js} +2 -2
- package/dist/{specs-Dp7I8aL5.js.map → specs-02Un982U.js.map} +1 -1
- package/dist/specs.d.ts +1 -1
- package/dist/specs.js +1 -1
- package/dist/{src-CJBv3wD1.js → src-DM3qkMTB.js} +5 -5
- package/dist/{src-CJBv3wD1.js.map → src-DM3qkMTB.js.map} +1 -1
- package/dist/{tangle-id-Bq7jkKmE.d.ts → tangle-id-BW5dTiGi.d.ts} +2 -2
- package/dist/{tangle-id-Bq7jkKmE.d.ts.map → tangle-id-BW5dTiGi.d.ts.map} +1 -1
- package/dist/{tangle-id-81ShqJ7k.js → tangle-id-DUsy7I9_.js} +2 -2
- package/dist/{tangle-id-81ShqJ7k.js.map → tangle-id-DUsy7I9_.js.map} +1 -1
- package/dist/{types-W418mSuf.d.ts → types-Bq85dJDW.d.ts} +13 -1
- package/dist/types-Bq85dJDW.d.ts.map +1 -0
- package/dist/{types-BSDXGSi5.js → types-CjrugGcd.js} +13 -7
- package/dist/types-CjrugGcd.js.map +1 -0
- package/dist/webhooks/index.js +1 -1
- package/dist/worker.d.ts +3 -3
- package/package.json +1 -1
- package/dist/bundled-manifest-runtime-G6p2i9W-.d.ts.map +0 -1
- package/dist/cloudbeds-BL5EF3xl.js.map +0 -1
- package/dist/consumer-BafUQUla.d.ts.map +0 -1
- package/dist/core-types-DfCMwTYt.d.ts.map +0 -1
- package/dist/hub-D13zPQGr.js.map +0 -1
- package/dist/hub-fmmnwC2s.d.ts.map +0 -1
- package/dist/oauth-tzsnaJIb.d.ts.map +0 -1
- package/dist/types-BSDXGSi5.js.map +0 -1
- package/dist/types-W418mSuf.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundled-manifest-runtime.js","names":["bundledAdapters"],"sources":["../../src/connectors/bundled-manifest-runtime.ts"],"sourcesContent":["import type { ConnectorAdapter, ConnectorManifest } from './types.js'\nimport {\n CONNECTOR_ADAPTER_FACTORIES,\n type ConnectorAdapterFactoryDefinition,\n} from './adapters/factories.js'\nimport * as bundledAdapters from './adapters/index.js'\n\nconst MANIFEST_PROBE_PREFIX = 'tangle-adapter-metadata-'\n\nfunction isConnectorAdapter(value: unknown): value is ConnectorAdapter {\n if (!value || typeof value !== 'object') return false\n const manifest = (value as { manifest?: unknown }).manifest\n if (!manifest || typeof manifest !== 'object') return false\n return typeof (manifest as { kind?: unknown }).kind === 'string'\n}\n\nfunction manifestFromFactory(\n definition: ConnectorAdapterFactoryDefinition,\n): ConnectorManifest | undefined {\n const probeOptions = Object.fromEntries(\n Object.keys(definition.envMap).map((name) => [name, `${MANIFEST_PROBE_PREFIX}${name}`]),\n )\n try {\n return definition.factory(probeOptions).manifest\n } catch {\n return undefined\n }\n}\n\n/**\n * Direct adapter instances that public catalog and action hosts may register.\n *\n * Factory adapters are intentionally absent: their construction requires\n * product-owned OAuth configuration. Inbound-only adapters remain available\n * as named exports for webhook hosts, but never compete with action adapters\n * for a public connector kind.\n */\nexport function listBundledConnectorAdapters(): ConnectorAdapter[] {\n const byKind = new Map<string, ConnectorAdapter>()\n const exportByKind = new Map<string, string>()\n for (const [exportName, value] of Object.entries(bundledAdapters)) {\n if (!isConnectorAdapter(value) || value.inboundOnly) continue\n const kind = value.manifest.kind\n const existingExport = exportByKind.get(kind)\n if (existingExport) {\n throw new Error(\n `Duplicate public connector adapter kind \"${kind}\" exported by \"${existingExport}\" and \"${exportName}\".`,\n )\n }\n exportByKind.set(kind, exportName)\n byKind.set(kind, value)\n }\n return [...byKind.values()]\n}\n\n/** Build the runtime manifest registry used to regenerate the static snapshot. */\nexport function buildRuntimeBundledAdapterManifests(): ConnectorManifest[] {\n const byKind = new Map<string, ConnectorManifest>()\n for (const adapter of listBundledConnectorAdapters()) {\n byKind.set(adapter.manifest.kind, adapter.manifest)\n }\n for (const definition of CONNECTOR_ADAPTER_FACTORIES) {\n if (byKind.has(definition.kind)) continue\n const manifest = manifestFromFactory(definition)\n if (manifest) byKind.set(manifest.kind, manifest)\n }\n return [...byKind.values()]\n}\n"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"bundled-manifest-runtime.js","names":["bundledAdapters"],"sources":["../../src/connectors/bundled-manifest-runtime.ts"],"sourcesContent":["import type { ConnectorAdapter, ConnectorManifest } from './types.js'\nimport {\n CONNECTOR_ADAPTER_FACTORIES,\n resolveConnectorAdapterFactoryOptions,\n type ConnectorAdapterFactoryDefinition,\n} from './adapters/factories.js'\nimport * as bundledAdapters from './adapters/index.js'\n\nconst MANIFEST_PROBE_PREFIX = 'tangle-adapter-metadata-'\n\nfunction isConnectorAdapter(value: unknown): value is ConnectorAdapter {\n if (!value || typeof value !== 'object') return false\n const manifest = (value as { manifest?: unknown }).manifest\n if (!manifest || typeof manifest !== 'object') return false\n return typeof (manifest as { kind?: unknown }).kind === 'string'\n}\n\nfunction manifestFromFactory(\n definition: ConnectorAdapterFactoryDefinition,\n): ConnectorManifest | undefined {\n const probeOptions = Object.fromEntries(\n Object.keys(definition.envMap).map((name) => [name, `${MANIFEST_PROBE_PREFIX}${name}`]),\n )\n try {\n return definition.factory(probeOptions).manifest\n } catch {\n return undefined\n }\n}\n\n/**\n * Direct adapter instances that public catalog and action hosts may register.\n *\n * Factory adapters are intentionally absent: their construction requires\n * product-owned OAuth configuration. Inbound-only adapters remain available\n * as named exports for webhook hosts, but never compete with action adapters\n * for a public connector kind.\n */\nexport function listBundledConnectorAdapters(options: {\n envSource?: Readonly<Record<string, string | undefined>>\n includeUnconfigured?: boolean\n onConfigurationError?: (kind: string, error: unknown) => void\n} = {}): ConnectorAdapter[] {\n const byKind = new Map<string, ConnectorAdapter>()\n const exportByKind = new Map<string, string>()\n for (const [exportName, value] of Object.entries(bundledAdapters)) {\n if (!isConnectorAdapter(value) || value.inboundOnly) continue\n const kind = value.manifest.kind\n const existingExport = exportByKind.get(kind)\n if (existingExport) {\n throw new Error(\n `Duplicate public connector adapter kind \"${kind}\" exported by \"${existingExport}\" and \"${exportName}\".`,\n )\n }\n exportByKind.set(kind, exportName)\n byKind.set(kind, value)\n }\n if (options.envSource || options.includeUnconfigured) {\n for (const definition of CONNECTOR_ADAPTER_FACTORIES) {\n const configured = resolveConnectorAdapterFactoryOptions(definition, options.envSource ?? {})\n if (!configured && (byKind.has(definition.kind) || !options.includeUnconfigured)) continue\n try {\n const adapter = definition.factory(configured ?? Object.fromEntries(\n Object.keys(definition.envMap).map((name) => [name, `${MANIFEST_PROBE_PREFIX}${name}`]),\n ))\n if (adapter.manifest.kind !== definition.kind || adapter.inboundOnly) throw new Error('Invalid public factory adapter kind.')\n const envName = (key: string) => {\n const names = definition.envMap[key]\n return (typeof names === 'string' ? [names] : names ?? []).find((name) => options.envSource?.[name])\n }\n const auth = adapter.manifest.auth\n byKind.set(definition.kind, {\n ...adapter, catalogOnly: !configured,\n manifest: { ...adapter.manifest, auth: auth.kind === 'oauth2' ? {\n ...auth, clientIdEnv: envName('clientId') ?? envName('keystring') ?? auth.clientIdEnv,\n clientSecretEnv: envName('clientSecret') ?? auth.clientSecretEnv,\n } : auth },\n })\n } catch (error) {\n if (!options.onConfigurationError) throw error\n options.onConfigurationError(definition.kind, error)\n }\n }\n }\n return [...byKind.values()]\n}\n\n/** Build the runtime manifest registry used to regenerate the static snapshot. */\nexport function buildRuntimeBundledAdapterManifests(): ConnectorManifest[] {\n const byKind = new Map<string, ConnectorManifest>()\n for (const adapter of listBundledConnectorAdapters()) {\n byKind.set(adapter.manifest.kind, adapter.manifest)\n }\n for (const definition of CONNECTOR_ADAPTER_FACTORIES) {\n if (byKind.has(definition.kind)) continue\n const manifest = manifestFromFactory(definition)\n if (manifest) byKind.set(manifest.kind, manifest)\n }\n return [...byKind.values()]\n}\n"],"mappings":";;AAQA,MAAM,wBAAwB;AAE9B,SAAS,mBAAmB,OAA2C;CACrE,IAAI,CAAC,SAAS,OAAO,UAAU,UAAU,OAAO;CAChD,MAAM,WAAY,MAAiC;CACnD,IAAI,CAAC,YAAY,OAAO,aAAa,UAAU,OAAO;CACtD,OAAO,OAAQ,SAAgC,SAAS;AAC1D;AAEA,SAAS,oBACP,YAC+B;CAC/B,MAAM,eAAe,OAAO,YAC1B,OAAO,KAAK,WAAW,MAAM,CAAC,CAAC,KAAK,SAAS,CAAC,MAAM,GAAG,wBAAwB,MAAM,CAAC,CACxF;CACA,IAAI;EACF,OAAO,WAAW,QAAQ,YAAY,CAAC,CAAC;CAC1C,QAAQ;EACN;CACF;AACF;;;;;;;;;AAUA,SAAgB,6BAA6B,UAIzC,CAAC,GAAuB;CAC1B,MAAM,yBAAS,IAAI,IAA8B;CACjD,MAAM,+BAAe,IAAI,IAAoB;CAC7C,KAAK,MAAM,CAAC,YAAY,UAAU,OAAO,QAAQA,gBAAe,GAAG;EACjE,IAAI,CAAC,mBAAmB,KAAK,KAAK,MAAM,aAAa;EACrD,MAAM,OAAO,MAAM,SAAS;EAC5B,MAAM,iBAAiB,aAAa,IAAI,IAAI;EAC5C,IAAI,gBACF,MAAM,IAAI,MACR,4CAA4C,KAAK,iBAAiB,eAAe,SAAS,WAAW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AO,IAAI,QAAQ,SAAS,MAAM,QAAQ,QAAQ;CAEpD,KAAK,MAAM,cAAc,6BAA6B;EACpD,IAAI,OAAO,IAAI,WAAW,IAAI,GAAG;EACjC,MAAM,WAAW,oBAAoB,UAAU;EAC/C,IAAI,UAAU,OAAO,IAAI,SAAS,MAAM,QAAQ;CAClD;CACA,OAAO,CAAC,GAAG,OAAO,OAAO,CAAC;AAC5B"}
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { pt as McpCatalogTool } from "./consumer-
|
|
1
|
+
import { O as IntegrationProvider, _ as IntegrationConnectorCategory, b as IntegrationDataClass, h as IntegrationConnector, s as IntegrationActionRisk } from "./core-types-0BenSoZJ.js";
|
|
2
|
+
import { pt as McpCatalogTool } from "./consumer-YE5ibTlI.js";
|
|
3
3
|
//#region src/mcp.d.ts
|
|
4
4
|
/** Protocol revision sent on `initialize` and the `MCP-Protocol-Version`
|
|
5
5
|
* header. Servers negotiate down from this. */
|
package/dist/mcp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { m as IntegrationError } from "./hub-
|
|
2
|
-
import { F as createCatalogExecutorProvider, N as importMcpConnector } from "./src-
|
|
1
|
+
import { m as IntegrationError } from "./hub-BjCYNJWr.js";
|
|
2
|
+
import { F as createCatalogExecutorProvider, N as importMcpConnector } from "./src-DM3qkMTB.js";
|
|
3
3
|
//#region src/mcp.ts
|
|
4
4
|
/**
|
|
5
5
|
* Live MCP connector — attach a remote MCP (Model Context Protocol) server
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as TangleAuthContext, c as expressTangleAuthMiddleware, d as requireTangleAuth, i as RequireTangleAuthOptions, l as extractToken, n as ExpressLikeResponse, o as TangleAuthOutcome, r as HonoLikeContext, s as TangleAuthReason, t as ExpressLikeRequest, u as honoTangleAuthMiddleware } from "../index-
|
|
1
|
+
import { a as TangleAuthContext, c as expressTangleAuthMiddleware, d as requireTangleAuth, i as RequireTangleAuthOptions, l as extractToken, n as ExpressLikeResponse, o as TangleAuthOutcome, r as HonoLikeContext, s as TangleAuthReason, t as ExpressLikeRequest, u as honoTangleAuthMiddleware } from "../index-BFK-G6g1.js";
|
|
2
2
|
export { ExpressLikeRequest, ExpressLikeResponse, HonoLikeContext, RequireTangleAuthOptions, TangleAuthContext, TangleAuthOutcome, TangleAuthReason, expressTangleAuthMiddleware, extractToken, honoTangleAuthMiddleware, requireTangleAuth };
|
package/dist/middleware/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as isRealNonPlaceholderEmail } from "../billing-access-policy-DJ63AxZ5.js";
|
|
2
|
-
import { a as TangleIdentityUnreachableError, o as createTangleIdentityClient } from "../tangle-id-
|
|
2
|
+
import { a as TangleIdentityUnreachableError, o as createTangleIdentityClient } from "../tangle-id-DUsy7I9_.js";
|
|
3
3
|
//#region src/middleware/index.ts
|
|
4
4
|
/**
|
|
5
5
|
* @stable Drop-in request middleware that verifies id.tangle.tools
|
|
@@ -1,6 +1,87 @@
|
|
|
1
|
-
import { S as OAuth2TokenClientAuthMethod } from "./types-
|
|
2
|
-
//#region src/connectors/oauth.d.ts
|
|
1
|
+
import { M as TokenMetadataSource, S as OAuth2TokenClientAuthMethod } from "./types-Bq85dJDW.js";
|
|
2
|
+
//#region src/connectors/oauth-protocol.d.ts
|
|
3
3
|
type OAuthPkceMode = 'required' | 'supported' | 'unsupported';
|
|
4
|
+
/** Shared by stateful flows and hosts that persist their own state. Reserved
|
|
5
|
+
* parameters always override provider extras and values embedded in the URL. */
|
|
6
|
+
declare function buildOAuthAuthorizationUrl(input: {
|
|
7
|
+
authorizationUrl: string;
|
|
8
|
+
clientId: string;
|
|
9
|
+
authorizationClientIdParam?: string;
|
|
10
|
+
redirectUri: string;
|
|
11
|
+
scopes: readonly string[];
|
|
12
|
+
scopeSeparator?: ' ' | ',';
|
|
13
|
+
sendScopeParam?: boolean;
|
|
14
|
+
configId?: string;
|
|
15
|
+
state: string;
|
|
16
|
+
codeChallenge?: string;
|
|
17
|
+
extraAuthParams?: Readonly<Record<string, string>>;
|
|
18
|
+
}): string;
|
|
19
|
+
interface ExchangeCodeInput {
|
|
20
|
+
tokenUrl: string;
|
|
21
|
+
clientId: string;
|
|
22
|
+
/** Required unless tokenClientAuthMethod is `none`. */
|
|
23
|
+
clientSecret?: string;
|
|
24
|
+
/** Defaults to client_secret_post for backward compatibility. */
|
|
25
|
+
tokenClientAuthMethod?: OAuth2TokenClientAuthMethod;
|
|
26
|
+
tokenClientIdParam?: string;
|
|
27
|
+
tokenClientSecretParam?: string;
|
|
28
|
+
code: string;
|
|
29
|
+
tokenMetadata?: Record<string, TokenMetadataSource>;
|
|
30
|
+
/** Required unless pkce is explicitly unsupported. */
|
|
31
|
+
codeVerifier?: string;
|
|
32
|
+
/** PKCE posture. Defaults to required. */
|
|
33
|
+
pkce?: OAuthPkceMode;
|
|
34
|
+
redirectUri: string;
|
|
35
|
+
/** Non-secret provider identification headers for the token request. */
|
|
36
|
+
tokenRequestHeaders?: Readonly<Record<string, string>>;
|
|
37
|
+
fetchImpl?: typeof fetch;
|
|
38
|
+
signal?: AbortSignal;
|
|
39
|
+
}
|
|
40
|
+
interface OAuthTokens {
|
|
41
|
+
accessToken: string;
|
|
42
|
+
refreshToken?: string;
|
|
43
|
+
expiresIn?: number;
|
|
44
|
+
scope?: string;
|
|
45
|
+
tokenType?: string;
|
|
46
|
+
/** OpenID Connect identity token returned when the connector requests
|
|
47
|
+
* `openid`. Kept separate from the access credential so adapters can
|
|
48
|
+
* capture stable account metadata without persisting the ID token. */
|
|
49
|
+
idToken?: string;
|
|
50
|
+
/** Only explicitly declared, non-credential token response fields. */
|
|
51
|
+
metadata?: Record<string, string>;
|
|
52
|
+
}
|
|
53
|
+
/** POST authorization code → token endpoint. Provider-agnostic; if a
|
|
54
|
+
* provider returns a non-standard JSON shape, the adapter wraps this
|
|
55
|
+
* call rather than reaching into the helper. */
|
|
56
|
+
declare function exchangeAuthorizationCode(input: ExchangeCodeInput): Promise<OAuthTokens>;
|
|
57
|
+
interface RefreshInput {
|
|
58
|
+
tokenUrl: string;
|
|
59
|
+
clientId: string;
|
|
60
|
+
/** Required unless tokenClientAuthMethod is `none`. */
|
|
61
|
+
clientSecret?: string;
|
|
62
|
+
/** Defaults to client_secret_post for backward compatibility. */
|
|
63
|
+
tokenClientAuthMethod?: OAuth2TokenClientAuthMethod;
|
|
64
|
+
tokenClientIdParam?: string;
|
|
65
|
+
tokenClientSecretParam?: string;
|
|
66
|
+
refreshToken: string;
|
|
67
|
+
/** Non-secret provider identification headers for the token request. */
|
|
68
|
+
tokenRequestHeaders?: Readonly<Record<string, string>>;
|
|
69
|
+
fetchImpl?: typeof fetch;
|
|
70
|
+
signal?: AbortSignal;
|
|
71
|
+
}
|
|
72
|
+
/** Refresh an access token. Returns the new tokens — the connector layer
|
|
73
|
+
* is responsible for re-encrypting + persisting the envelope. */
|
|
74
|
+
declare function refreshAccessToken(input: RefreshInput): Promise<OAuthTokens>;
|
|
75
|
+
declare function captureOAuthTokenMetadata(tokenMetadata: Record<string, TokenMetadataSource> | undefined, json: Record<string, unknown>): Record<string, string>;
|
|
76
|
+
/** Build token-endpoint headers without permitting an adapter-supplied value
|
|
77
|
+
* to replace the authentication or form-media-type headers owned here. */
|
|
78
|
+
declare function createOAuthTokenRequestHeaders(additional?: Readonly<Record<string, string>>): Record<string, string>;
|
|
79
|
+
declare function formEncodeOAuthClientCredential(value: string): string;
|
|
80
|
+
declare function createOAuthBasicAuthorizationHeader(clientId: string, clientSecret: string, encodeBase64?: (value: string) => string): string;
|
|
81
|
+
declare function oauthClientCredentialRedactionValues(clientId: string, clientSecret?: string, authorization?: string): string[];
|
|
82
|
+
declare function redactOAuthSensitiveText(text: string, secrets: readonly string[]): string;
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/connectors/oauth.d.ts
|
|
4
85
|
interface PendingOAuthFlow {
|
|
5
86
|
/** code_verifier for PKCE. Absent when the provider rejects PKCE. */
|
|
6
87
|
codeVerifier?: string;
|
|
@@ -69,68 +150,8 @@ declare function startOAuthFlow(input: StartOAuthInput): StartOAuthOutput;
|
|
|
69
150
|
/** Look up + remove the pending flow record. Throws if state is unknown
|
|
70
151
|
* or expired (CSRF guard / replay protection). */
|
|
71
152
|
declare function consumePendingFlow(state: string, store?: OAuthFlowStore): Promise<PendingOAuthFlow>;
|
|
72
|
-
interface ExchangeCodeInput {
|
|
73
|
-
tokenUrl: string;
|
|
74
|
-
clientId: string;
|
|
75
|
-
/** Required unless tokenClientAuthMethod is `none`. */
|
|
76
|
-
clientSecret?: string;
|
|
77
|
-
/** Defaults to client_secret_post for backward compatibility. */
|
|
78
|
-
tokenClientAuthMethod?: OAuth2TokenClientAuthMethod;
|
|
79
|
-
tokenClientIdParam?: string;
|
|
80
|
-
tokenClientSecretParam?: string;
|
|
81
|
-
code: string;
|
|
82
|
-
/** Required unless pkce is explicitly unsupported. */
|
|
83
|
-
codeVerifier?: string;
|
|
84
|
-
/** PKCE posture. Defaults to required. */
|
|
85
|
-
pkce?: OAuthPkceMode;
|
|
86
|
-
redirectUri: string;
|
|
87
|
-
/** Non-secret provider identification headers for the token request. */
|
|
88
|
-
tokenRequestHeaders?: Readonly<Record<string, string>>;
|
|
89
|
-
fetchImpl?: typeof fetch;
|
|
90
|
-
signal?: AbortSignal;
|
|
91
|
-
}
|
|
92
|
-
interface OAuthTokens {
|
|
93
|
-
accessToken: string;
|
|
94
|
-
refreshToken?: string;
|
|
95
|
-
expiresIn?: number;
|
|
96
|
-
scope?: string;
|
|
97
|
-
tokenType?: string;
|
|
98
|
-
/** OpenID Connect identity token returned when the connector requests
|
|
99
|
-
* `openid`. Kept separate from the access credential so adapters can
|
|
100
|
-
* capture stable account metadata without persisting the ID token. */
|
|
101
|
-
idToken?: string;
|
|
102
|
-
}
|
|
103
|
-
/** POST authorization code → token endpoint. Provider-agnostic; if a
|
|
104
|
-
* provider returns a non-standard JSON shape, the adapter wraps this
|
|
105
|
-
* call rather than reaching into the helper. */
|
|
106
|
-
declare function exchangeAuthorizationCode(input: ExchangeCodeInput): Promise<OAuthTokens>;
|
|
107
|
-
interface RefreshInput {
|
|
108
|
-
tokenUrl: string;
|
|
109
|
-
clientId: string;
|
|
110
|
-
/** Required unless tokenClientAuthMethod is `none`. */
|
|
111
|
-
clientSecret?: string;
|
|
112
|
-
/** Defaults to client_secret_post for backward compatibility. */
|
|
113
|
-
tokenClientAuthMethod?: OAuth2TokenClientAuthMethod;
|
|
114
|
-
tokenClientIdParam?: string;
|
|
115
|
-
tokenClientSecretParam?: string;
|
|
116
|
-
refreshToken: string;
|
|
117
|
-
/** Non-secret provider identification headers for the token request. */
|
|
118
|
-
tokenRequestHeaders?: Readonly<Record<string, string>>;
|
|
119
|
-
fetchImpl?: typeof fetch;
|
|
120
|
-
signal?: AbortSignal;
|
|
121
|
-
}
|
|
122
|
-
/** Refresh an access token. Returns the new tokens — the connector layer
|
|
123
|
-
* is responsible for re-encrypting + persisting the envelope. */
|
|
124
|
-
declare function refreshAccessToken(input: RefreshInput): Promise<OAuthTokens>;
|
|
125
|
-
/** Build token-endpoint headers without permitting an adapter-supplied value
|
|
126
|
-
* to replace the authentication or form-media-type headers owned here. */
|
|
127
|
-
declare function createOAuthTokenRequestHeaders(additional?: Readonly<Record<string, string>>): Record<string, string>;
|
|
128
|
-
declare function formEncodeOAuthClientCredential(value: string): string;
|
|
129
|
-
declare function createOAuthBasicAuthorizationHeader(clientId: string, clientSecret: string, encodeBase64?: (value: string) => string): string;
|
|
130
|
-
declare function oauthClientCredentialRedactionValues(clientId: string, clientSecret?: string, authorization?: string): string[];
|
|
131
|
-
declare function redactOAuthSensitiveText(text: string, secrets: readonly string[]): string;
|
|
132
153
|
/** Test-only — drop pending flows between unit-test runs. */
|
|
133
154
|
declare function _resetPendingFlowsForTests(): void;
|
|
134
155
|
//#endregion
|
|
135
|
-
export {
|
|
136
|
-
//# sourceMappingURL=oauth-
|
|
156
|
+
export { exchangeAuthorizationCode as _, StartOAuthOutput as a, redactOAuthSensitiveText as b, startOAuthFlow as c, OAuthTokens as d, RefreshInput as f, createOAuthTokenRequestHeaders as g, createOAuthBasicAuthorizationHeader as h, StartOAuthInput as i, ExchangeCodeInput as l, captureOAuthTokenMetadata as m, OAuthFlowStore as n, _resetPendingFlowsForTests as o, buildOAuthAuthorizationUrl as p, PendingOAuthFlow as r, consumePendingFlow as s, InMemoryOAuthFlowStore as t, OAuthPkceMode as u, formEncodeOAuthClientCredential as v, refreshAccessToken as x, oauthClientCredentialRedactionValues as y };
|
|
157
|
+
//# sourceMappingURL=oauth-DoUCpYU_.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-DoUCpYU_.d.ts","names":[],"sources":["../src/connectors/oauth-protocol.ts","../src/connectors/oauth.ts"],"mappings":";;KAEY;;;iBAII,2BAA2B;EACzC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,kBAAkB,SAAS;;UAkBZ;EACf;EACA;;EAEA;;EAEA,wBAAwB;EACxB;EACA;EACA;EACA,gBAAgB,eAAe;;EAE/B;;EAEA,OAAO;EACP;;EAEA,sBAAsB,SAAS;EAC/B,mBAAmB;EACnB,SAAS;;UAGM;EACf;EACA;EACA;EACA;EACA;;;;EAIA;;EAEA,WAAW;;;;;iBAMS,0BAA0B,OAAO,oBAAoB,QAAQ;UAclE;EACf;EACA;;EAEA;;EAEA,wBAAwB;EACxB;EACA;EACA;;EAEA,sBAAsB,SAAS;EAC/B,mBAAmB;EACnB,SAAS;;;;iBAKW,mBAAmB,OAAO,eAAe,QAAQ;iBA2CvD,0BACd,eAAe,eAAe,kCAC9B,MAAM,0BACL;;;iBA2Ba,+BACd,aAAa,SAAS,0BACrB;iBAQa,gCAAgC;iBAIhC,oCACd,kBACA,sBACA,gBAAe;iBAiBD,qCACd,kBACA,uBACA;iBAgBc,yBACd,cACA;;;UCrNe;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;EAGA;;UAKe;EACf,IAAI,eAAe,MAAM,mBAAmB;EAC5C,QAAQ,gBAAgB,QAAQ,gCAAgC;EAChE,OAAO,cAAc;EACrB,UAAU;;cAGC,kCAAkC;mBAC5B;EAEjB,IAAI,eAAe,MAAM;EAIzB,QAAQ,gBAAgB;EAOxB,MAAM;EAMN;;UAOe;EACf;EACA;EACA;EACA;EACA;;EAEA;EACA;;;EAGA;;EAEA,OAAO;EACP;;;EAGA,kBAAkB;;;EAGlB,QAAQ;;EAER;;UAGe;;EAEf;;;EAGA;;;;;iBAMc,eAAe,OAAO,kBAAkB;;;iBA6BlC,mBAAmB,eAAe,QAAO,iBAAoC,QAAQ;;iBAc3F"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
//#region src/connectors/oauth-protocol.ts
|
|
2
|
+
/** Shared by stateful flows and hosts that persist their own state. Reserved
|
|
3
|
+
* parameters always override provider extras and values embedded in the URL. */
|
|
4
|
+
function buildOAuthAuthorizationUrl(input) {
|
|
5
|
+
const url = new URL(input.authorizationUrl);
|
|
6
|
+
for (const [key, value] of Object.entries(input.extraAuthParams ?? {})) url.searchParams.set(key, value);
|
|
7
|
+
for (const key of [
|
|
8
|
+
"client_id",
|
|
9
|
+
"scope",
|
|
10
|
+
"config_id",
|
|
11
|
+
"code_challenge",
|
|
12
|
+
"code_challenge_method"
|
|
13
|
+
]) url.searchParams.delete(key);
|
|
14
|
+
url.searchParams.set("response_type", "code");
|
|
15
|
+
url.searchParams.set(oauthParameterName(input.authorizationClientIdParam, "client_id"), input.clientId);
|
|
16
|
+
url.searchParams.set("redirect_uri", input.redirectUri);
|
|
17
|
+
url.searchParams.set("state", input.state);
|
|
18
|
+
if (input.configId) url.searchParams.set("config_id", input.configId);
|
|
19
|
+
else if (input.sendScopeParam !== false && input.scopes.length) url.searchParams.set("scope", input.scopes.join(input.scopeSeparator ?? " "));
|
|
20
|
+
if (input.codeChallenge) {
|
|
21
|
+
url.searchParams.set("code_challenge", input.codeChallenge);
|
|
22
|
+
url.searchParams.set("code_challenge_method", "S256");
|
|
23
|
+
}
|
|
24
|
+
return url.toString();
|
|
25
|
+
}
|
|
26
|
+
/** POST authorization code → token endpoint. Provider-agnostic; if a
|
|
27
|
+
* provider returns a non-standard JSON shape, the adapter wraps this
|
|
28
|
+
* call rather than reaching into the helper. */
|
|
29
|
+
async function exchangeAuthorizationCode(input) {
|
|
30
|
+
const usePkce = (input.pkce ?? "required") !== "unsupported";
|
|
31
|
+
if (usePkce && !input.codeVerifier) throw new Error("OAuth token exchange requires a PKCE code_verifier");
|
|
32
|
+
const body = new URLSearchParams({
|
|
33
|
+
grant_type: "authorization_code",
|
|
34
|
+
code: input.code,
|
|
35
|
+
redirect_uri: input.redirectUri
|
|
36
|
+
});
|
|
37
|
+
if (usePkce) body.set("code_verifier", input.codeVerifier);
|
|
38
|
+
return requestOAuthTokens(input, body, "token exchange", [input.code, input.codeVerifier ?? ""]);
|
|
39
|
+
}
|
|
40
|
+
/** Refresh an access token. Returns the new tokens — the connector layer
|
|
41
|
+
* is responsible for re-encrypting + persisting the envelope. */
|
|
42
|
+
async function refreshAccessToken(input) {
|
|
43
|
+
return requestOAuthTokens(input, new URLSearchParams({
|
|
44
|
+
grant_type: "refresh_token",
|
|
45
|
+
refresh_token: input.refreshToken
|
|
46
|
+
}), "refresh", [input.refreshToken]);
|
|
47
|
+
}
|
|
48
|
+
async function requestOAuthTokens(input, body, operation, secrets) {
|
|
49
|
+
const headers = createOAuthTokenRequestHeaders(input.tokenRequestHeaders);
|
|
50
|
+
applyTokenClientAuthentication(input, body, headers);
|
|
51
|
+
const redaction = [...secrets, ...oauthClientCredentialRedactionValues(input.clientId, input.clientSecret, headers.authorization)];
|
|
52
|
+
try {
|
|
53
|
+
const response = await (input.fetchImpl ?? fetch)(input.tokenUrl, {
|
|
54
|
+
method: "POST",
|
|
55
|
+
headers,
|
|
56
|
+
body,
|
|
57
|
+
signal: input.signal
|
|
58
|
+
});
|
|
59
|
+
if (!response.ok) {
|
|
60
|
+
const detail = `${response.status} ${response.statusText} — ${await response.text()}`;
|
|
61
|
+
throw new Error(`OAuth ${operation} failed: ${detail}`);
|
|
62
|
+
}
|
|
63
|
+
const raw = await response.json().catch(() => {
|
|
64
|
+
throw new Error(`OAuth ${operation} returned invalid JSON`);
|
|
65
|
+
});
|
|
66
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) throw new Error(`OAuth ${operation} returned invalid JSON`);
|
|
67
|
+
const json = raw;
|
|
68
|
+
if (typeof json.access_token !== "string" || !json.access_token) throw new Error(`OAuth ${operation} returned no access_token`);
|
|
69
|
+
return {
|
|
70
|
+
accessToken: json.access_token,
|
|
71
|
+
refreshToken: typeof json.refresh_token === "string" ? json.refresh_token : void 0,
|
|
72
|
+
expiresIn: typeof json.expires_in === "number" ? json.expires_in : void 0,
|
|
73
|
+
scope: typeof json.scope === "string" ? json.scope : void 0,
|
|
74
|
+
tokenType: typeof json.token_type === "string" ? json.token_type : void 0,
|
|
75
|
+
idToken: typeof json.id_token === "string" ? json.id_token : void 0,
|
|
76
|
+
..."tokenMetadata" in input && input.tokenMetadata ? { metadata: captureOAuthTokenMetadata(input.tokenMetadata, json) } : {}
|
|
77
|
+
};
|
|
78
|
+
} catch (cause) {
|
|
79
|
+
throw new Error(redactOAuthSensitiveText(cause instanceof Error ? cause.message : `OAuth ${operation} failed`, redaction).slice(0, 500));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function captureOAuthTokenMetadata(tokenMetadata, json) {
|
|
83
|
+
if (!tokenMetadata) return {};
|
|
84
|
+
const captured = {};
|
|
85
|
+
for (const [metaKey, source] of Object.entries(tokenMetadata)) {
|
|
86
|
+
const field = typeof source === "string" ? source : source.field;
|
|
87
|
+
const required = typeof source === "string" ? false : source.required === true;
|
|
88
|
+
const raw = json[field];
|
|
89
|
+
const value = typeof raw === "string" ? raw.trim() : raw;
|
|
90
|
+
if (value === void 0 || value === null || value === "") {
|
|
91
|
+
if (required) throw new Error(`OAuth token exchange did not return required field "${field}" for metadata.${metaKey}.`);
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
captured[metaKey] = String(value);
|
|
95
|
+
}
|
|
96
|
+
return captured;
|
|
97
|
+
}
|
|
98
|
+
/** Build token-endpoint headers without permitting an adapter-supplied value
|
|
99
|
+
* to replace the authentication or form-media-type headers owned here. */
|
|
100
|
+
function createOAuthTokenRequestHeaders(additional) {
|
|
101
|
+
const headers = new Headers(additional);
|
|
102
|
+
headers.set("content-type", "application/x-www-form-urlencoded");
|
|
103
|
+
headers.set("accept", "application/json");
|
|
104
|
+
headers.delete("authorization");
|
|
105
|
+
return Object.fromEntries(headers.entries());
|
|
106
|
+
}
|
|
107
|
+
function formEncodeOAuthClientCredential(value) {
|
|
108
|
+
return new URLSearchParams({ value }).toString().slice(6);
|
|
109
|
+
}
|
|
110
|
+
function createOAuthBasicAuthorizationHeader(clientId, clientSecret, encodeBase64 = defaultOAuthBase64Encode) {
|
|
111
|
+
return `Basic ${encodeBase64(`${formEncodeOAuthClientCredential(clientId)}:${formEncodeOAuthClientCredential(clientSecret)}`)}`;
|
|
112
|
+
}
|
|
113
|
+
function defaultOAuthBase64Encode(value) {
|
|
114
|
+
const encode = globalThis.btoa;
|
|
115
|
+
if (typeof encode !== "function") throw new Error("OAuth client_secret_basic requires a base64 encoder in this runtime.");
|
|
116
|
+
return encode(value);
|
|
117
|
+
}
|
|
118
|
+
function oauthClientCredentialRedactionValues(clientId, clientSecret, authorization) {
|
|
119
|
+
return [
|
|
120
|
+
clientId,
|
|
121
|
+
...clientSecret ? [clientSecret] : [],
|
|
122
|
+
...authorization ? [authorization, ...authorization.startsWith("Basic ") ? [authorization.slice(6)] : []] : []
|
|
123
|
+
];
|
|
124
|
+
}
|
|
125
|
+
function redactOAuthSensitiveText(text, secrets) {
|
|
126
|
+
const matchers = /* @__PURE__ */ new Map();
|
|
127
|
+
for (const secret of new Set(secrets)) {
|
|
128
|
+
if (secret.length === 0) continue;
|
|
129
|
+
addOAuthRedactionMatcher(matchers, escapeRegExp(secret), secret.length);
|
|
130
|
+
const jsonEscaped = JSON.stringify(secret).slice(1, -1);
|
|
131
|
+
addOAuthRedactionMatcher(matchers, escapeRegExp(jsonEscaped), jsonEscaped.length);
|
|
132
|
+
const formEncoded = formEncodeOAuthClientCredential(secret);
|
|
133
|
+
addOAuthRedactionMatcher(matchers, formEncodedRedactionPattern(formEncoded), Math.max(formEncoded.length, formEncoded.replaceAll("+", "%20").length));
|
|
134
|
+
}
|
|
135
|
+
return [...matchers.values()].sort((left, right) => right.representedLength - left.representedLength).reduce((redacted, matcher) => redacted.replace(matcher.pattern, "[REDACTED]"), text);
|
|
136
|
+
}
|
|
137
|
+
function addOAuthRedactionMatcher(matchers, source, representedLength) {
|
|
138
|
+
const existing = matchers.get(source);
|
|
139
|
+
if (existing && existing.representedLength >= representedLength) return;
|
|
140
|
+
matchers.set(source, {
|
|
141
|
+
pattern: new RegExp(source, "g"),
|
|
142
|
+
representedLength
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
function formEncodedRedactionPattern(formEncoded) {
|
|
146
|
+
let pattern = "";
|
|
147
|
+
for (let index = 0; index < formEncoded.length; index += 1) {
|
|
148
|
+
const character = formEncoded[index];
|
|
149
|
+
const encodedByte = formEncoded.slice(index + 1, index + 3);
|
|
150
|
+
if (character === "%" && /^[0-9A-F]{2}$/.test(encodedByte)) {
|
|
151
|
+
pattern += `%${percentEncodedBytePattern(encodedByte)}`;
|
|
152
|
+
index += 2;
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
if (character === "+") {
|
|
156
|
+
pattern += "(?:\\+|%20)";
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
pattern += escapeRegExp(character);
|
|
160
|
+
}
|
|
161
|
+
return pattern;
|
|
162
|
+
}
|
|
163
|
+
function percentEncodedBytePattern(encodedByte) {
|
|
164
|
+
return [...encodedByte].map((character) => /[A-F]/.test(character) ? `[${character}${character.toLowerCase()}]` : character).join("");
|
|
165
|
+
}
|
|
166
|
+
function escapeRegExp(value) {
|
|
167
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
168
|
+
}
|
|
169
|
+
function applyTokenClientAuthentication(input, body, headers) {
|
|
170
|
+
const method = input.tokenClientAuthMethod ?? "client_secret_post";
|
|
171
|
+
if (method === "none") {
|
|
172
|
+
body.set(oauthParameterName(input.tokenClientIdParam, "client_id"), input.clientId);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (!input.clientSecret) throw new Error(`OAuth ${method} client authentication requires a client secret`);
|
|
176
|
+
if (method === "client_secret_post") {
|
|
177
|
+
body.set(oauthParameterName(input.tokenClientIdParam, "client_id"), input.clientId);
|
|
178
|
+
body.set(oauthParameterName(input.tokenClientSecretParam, "client_secret"), input.clientSecret);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (method === "client_secret_basic") {
|
|
182
|
+
headers.authorization = createOAuthBasicAuthorizationHeader(input.clientId, input.clientSecret);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
throw new Error("Unsupported OAuth token client authentication method");
|
|
186
|
+
}
|
|
187
|
+
function oauthParameterName(value, fallback) {
|
|
188
|
+
const name = value ?? fallback;
|
|
189
|
+
if (!/^[A-Za-z][A-Za-z0-9_.-]{0,63}$/.test(name)) throw new Error("Invalid OAuth parameter name");
|
|
190
|
+
return name;
|
|
191
|
+
}
|
|
192
|
+
//#endregion
|
|
193
|
+
export { exchangeAuthorizationCode as a, redactOAuthSensitiveText as c, createOAuthTokenRequestHeaders as i, refreshAccessToken as l, captureOAuthTokenMetadata as n, formEncodeOAuthClientCredential as o, createOAuthBasicAuthorizationHeader as r, oauthClientCredentialRedactionValues as s, buildOAuthAuthorizationUrl as t };
|
|
194
|
+
|
|
195
|
+
//# sourceMappingURL=oauth-protocol-CFrGJlSz.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-protocol-CFrGJlSz.js","names":[],"sources":["../src/connectors/oauth-protocol.ts"],"sourcesContent":["import type { OAuth2TokenClientAuthMethod, TokenMetadataSource } from './types.js'\n\nexport type OAuthPkceMode = 'required' | 'supported' | 'unsupported'\n\n/** Shared by stateful flows and hosts that persist their own state. Reserved\n * parameters always override provider extras and values embedded in the URL. */\nexport function buildOAuthAuthorizationUrl(input: {\n authorizationUrl: string\n clientId: string\n authorizationClientIdParam?: string\n redirectUri: string\n scopes: readonly string[]\n scopeSeparator?: ' ' | ','\n sendScopeParam?: boolean\n configId?: string\n state: string\n codeChallenge?: string\n extraAuthParams?: Readonly<Record<string, string>>\n}): string {\n const url = new URL(input.authorizationUrl)\n for (const [key, value] of Object.entries(input.extraAuthParams ?? {})) url.searchParams.set(key, value)\n for (const key of ['client_id', 'scope', 'config_id', 'code_challenge', 'code_challenge_method']) url.searchParams.delete(key)\n url.searchParams.set('response_type', 'code')\n url.searchParams.set(oauthParameterName(input.authorizationClientIdParam, 'client_id'), input.clientId)\n url.searchParams.set('redirect_uri', input.redirectUri)\n url.searchParams.set('state', input.state)\n if (input.configId) url.searchParams.set('config_id', input.configId)\n else if (input.sendScopeParam !== false && input.scopes.length) url.searchParams.set('scope', input.scopes.join(input.scopeSeparator ?? ' '))\n if (input.codeChallenge) {\n url.searchParams.set('code_challenge', input.codeChallenge)\n url.searchParams.set('code_challenge_method', 'S256')\n }\n return url.toString()\n}\n\nexport interface ExchangeCodeInput {\n tokenUrl: string\n clientId: string\n /** Required unless tokenClientAuthMethod is `none`. */\n clientSecret?: string\n /** Defaults to client_secret_post for backward compatibility. */\n tokenClientAuthMethod?: OAuth2TokenClientAuthMethod\n tokenClientIdParam?: string\n tokenClientSecretParam?: string\n code: string\n tokenMetadata?: Record<string, TokenMetadataSource>\n /** Required unless pkce is explicitly unsupported. */\n codeVerifier?: string\n /** PKCE posture. Defaults to required. */\n pkce?: OAuthPkceMode\n redirectUri: string\n /** Non-secret provider identification headers for the token request. */\n tokenRequestHeaders?: Readonly<Record<string, string>>\n fetchImpl?: typeof fetch\n signal?: AbortSignal\n}\n\nexport interface OAuthTokens {\n accessToken: string\n refreshToken?: string\n expiresIn?: number\n scope?: string\n tokenType?: string\n /** OpenID Connect identity token returned when the connector requests\n * `openid`. Kept separate from the access credential so adapters can\n * capture stable account metadata without persisting the ID token. */\n idToken?: string\n /** Only explicitly declared, non-credential token response fields. */\n metadata?: Record<string, string>\n}\n\n/** POST authorization code → token endpoint. Provider-agnostic; if a\n * provider returns a non-standard JSON shape, the adapter wraps this\n * call rather than reaching into the helper. */\nexport async function exchangeAuthorizationCode(input: ExchangeCodeInput): Promise<OAuthTokens> {\n const usePkce = (input.pkce ?? 'required') !== 'unsupported'\n if (usePkce && !input.codeVerifier) {\n throw new Error('OAuth token exchange requires a PKCE code_verifier')\n }\n const body = new URLSearchParams({\n grant_type: 'authorization_code',\n code: input.code,\n redirect_uri: input.redirectUri,\n })\n if (usePkce) body.set('code_verifier', input.codeVerifier!)\n return requestOAuthTokens(input, body, 'token exchange', [input.code, input.codeVerifier ?? ''])\n}\n\nexport interface RefreshInput {\n tokenUrl: string\n clientId: string\n /** Required unless tokenClientAuthMethod is `none`. */\n clientSecret?: string\n /** Defaults to client_secret_post for backward compatibility. */\n tokenClientAuthMethod?: OAuth2TokenClientAuthMethod\n tokenClientIdParam?: string\n tokenClientSecretParam?: string\n refreshToken: string\n /** Non-secret provider identification headers for the token request. */\n tokenRequestHeaders?: Readonly<Record<string, string>>\n fetchImpl?: typeof fetch\n signal?: AbortSignal\n}\n\n/** Refresh an access token. Returns the new tokens — the connector layer\n * is responsible for re-encrypting + persisting the envelope. */\nexport async function refreshAccessToken(input: RefreshInput): Promise<OAuthTokens> {\n const body = new URLSearchParams({\n grant_type: 'refresh_token',\n refresh_token: input.refreshToken,\n })\n return requestOAuthTokens(input, body, 'refresh', [input.refreshToken])\n}\n\nasync function requestOAuthTokens(\n input: RefreshInput | ExchangeCodeInput,\n body: URLSearchParams,\n operation: string,\n secrets: string[],\n): Promise<OAuthTokens> {\n const headers = createOAuthTokenRequestHeaders(input.tokenRequestHeaders)\n applyTokenClientAuthentication(input, body, headers)\n const redaction = [...secrets, ...oauthClientCredentialRedactionValues(input.clientId, input.clientSecret, headers.authorization)]\n try {\n const response = await (input.fetchImpl ?? fetch)(input.tokenUrl, {\n method: 'POST', headers, body, signal: input.signal,\n })\n if (!response.ok) {\n const detail = `${response.status} ${response.statusText} — ${await response.text()}`\n throw new Error(`OAuth ${operation} failed: ${detail}`)\n }\n const raw: unknown = await response.json().catch(() => { throw new Error(`OAuth ${operation} returned invalid JSON`) })\n if (!raw || typeof raw !== 'object' || Array.isArray(raw)) throw new Error(`OAuth ${operation} returned invalid JSON`)\n const json = raw as Record<string, unknown>\n if (typeof json.access_token !== 'string' || !json.access_token) throw new Error(`OAuth ${operation} returned no access_token`)\n return {\n accessToken: json.access_token,\n refreshToken: typeof json.refresh_token === 'string' ? json.refresh_token : undefined,\n expiresIn: typeof json.expires_in === 'number' ? json.expires_in : undefined,\n scope: typeof json.scope === 'string' ? json.scope : undefined,\n tokenType: typeof json.token_type === 'string' ? json.token_type : undefined,\n idToken: typeof json.id_token === 'string' ? json.id_token : undefined,\n ...('tokenMetadata' in input && input.tokenMetadata ? { metadata: captureOAuthTokenMetadata(input.tokenMetadata, json) } : {}),\n }\n } catch (cause) {\n throw new Error(redactOAuthSensitiveText(cause instanceof Error ? cause.message : `OAuth ${operation} failed`, redaction).slice(0, 500))\n }\n}\n\nexport function captureOAuthTokenMetadata(\n tokenMetadata: Record<string, TokenMetadataSource> | undefined,\n json: Record<string, unknown>,\n): Record<string, string> {\n if (!tokenMetadata) return {}\n const captured: Record<string, string> = {}\n for (const [metaKey, source] of Object.entries(tokenMetadata)) {\n const field = typeof source === 'string' ? source : source.field\n const required = typeof source === 'string' ? false : source.required === true\n const raw = json[field]\n // Trim string values so capture-side emptiness matches the consumer's\n // emptiness check (e.g. resolveBaseUrl's `.trim()` guard). A whitespace-only\n // value must fail loud here at connect for a required field, not defer the\n // break to first call where the host already looks active.\n const value = typeof raw === 'string' ? raw.trim() : raw\n if (value === undefined || value === null || value === '') {\n if (required) {\n throw new Error(\n `OAuth token exchange did not return required field \"${field}\" for metadata.${metaKey}.`,\n )\n }\n continue\n }\n captured[metaKey] = String(value)\n }\n return captured\n}\n\n/** Build token-endpoint headers without permitting an adapter-supplied value\n * to replace the authentication or form-media-type headers owned here. */\nexport function createOAuthTokenRequestHeaders(\n additional?: Readonly<Record<string, string>>,\n): Record<string, string> {\n const headers = new Headers(additional)\n headers.set('content-type', 'application/x-www-form-urlencoded')\n headers.set('accept', 'application/json')\n headers.delete('authorization')\n return Object.fromEntries(headers.entries())\n}\n\nexport function formEncodeOAuthClientCredential(value: string): string {\n return new URLSearchParams({ value }).toString().slice('value='.length)\n}\n\nexport function createOAuthBasicAuthorizationHeader(\n clientId: string,\n clientSecret: string,\n encodeBase64: (value: string) => string = defaultOAuthBase64Encode,\n): string {\n const encodedClientId = formEncodeOAuthClientCredential(clientId)\n const encodedClientSecret = formEncodeOAuthClientCredential(clientSecret)\n return `Basic ${encodeBase64(`${encodedClientId}:${encodedClientSecret}`)}`\n}\n\nfunction defaultOAuthBase64Encode(value: string): string {\n const encode = globalThis.btoa\n if (typeof encode !== 'function') {\n throw new Error(\n 'OAuth client_secret_basic requires a base64 encoder in this runtime.',\n )\n }\n return encode(value)\n}\n\nexport function oauthClientCredentialRedactionValues(\n clientId: string,\n clientSecret?: string,\n authorization?: string,\n): string[] {\n return [\n clientId,\n ...(clientSecret ? [clientSecret] : []),\n ...(authorization\n ? [\n authorization,\n ...(authorization.startsWith('Basic ')\n ? [authorization.slice('Basic '.length)]\n : []),\n ]\n : []),\n ]\n}\n\nexport function redactOAuthSensitiveText(\n text: string,\n secrets: readonly string[],\n): string {\n const matchers = new Map<string, { pattern: RegExp; representedLength: number }>()\n for (const secret of new Set(secrets)) {\n if (secret.length === 0) continue\n addOAuthRedactionMatcher(matchers, escapeRegExp(secret), secret.length)\n\n const jsonEscaped = JSON.stringify(secret).slice(1, -1)\n addOAuthRedactionMatcher(\n matchers,\n escapeRegExp(jsonEscaped),\n jsonEscaped.length,\n )\n\n const formEncoded = formEncodeOAuthClientCredential(secret)\n addOAuthRedactionMatcher(\n matchers,\n formEncodedRedactionPattern(formEncoded),\n Math.max(formEncoded.length, formEncoded.replaceAll('+', '%20').length),\n )\n }\n\n return [...matchers.values()]\n .sort((left, right) => right.representedLength - left.representedLength)\n .reduce(\n (redacted, matcher) => redacted.replace(matcher.pattern, '[REDACTED]'),\n text,\n )\n}\n\nfunction addOAuthRedactionMatcher(\n matchers: Map<string, { pattern: RegExp; representedLength: number }>,\n source: string,\n representedLength: number,\n): void {\n const existing = matchers.get(source)\n if (existing && existing.representedLength >= representedLength) return\n matchers.set(source, {\n pattern: new RegExp(source, 'g'),\n representedLength,\n })\n}\n\nfunction formEncodedRedactionPattern(formEncoded: string): string {\n let pattern = ''\n for (let index = 0; index < formEncoded.length; index += 1) {\n const character = formEncoded[index]!\n const encodedByte = formEncoded.slice(index + 1, index + 3)\n if (character === '%' && /^[0-9A-F]{2}$/.test(encodedByte)) {\n pattern += `%${percentEncodedBytePattern(encodedByte)}`\n index += 2\n continue\n }\n if (character === '+') {\n pattern += '(?:\\\\+|%20)'\n continue\n }\n pattern += escapeRegExp(character)\n }\n return pattern\n}\n\nfunction percentEncodedBytePattern(encodedByte: string): string {\n return [...encodedByte]\n .map((character) =>\n /[A-F]/.test(character)\n ? `[${character}${character.toLowerCase()}]`\n : character,\n )\n .join('')\n}\n\nfunction escapeRegExp(value: string): string {\n return value.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\nfunction applyTokenClientAuthentication(\n input: {\n clientId: string\n clientSecret?: string\n tokenClientIdParam?: string\n tokenClientSecretParam?: string\n tokenClientAuthMethod?: OAuth2TokenClientAuthMethod\n },\n body: URLSearchParams,\n headers: Record<string, string>,\n): void {\n const method = input.tokenClientAuthMethod ?? 'client_secret_post'\n if (method === 'none') {\n body.set(oauthParameterName(input.tokenClientIdParam, 'client_id'), input.clientId)\n return\n }\n if (!input.clientSecret) {\n throw new Error(`OAuth ${method} client authentication requires a client secret`)\n }\n if (method === 'client_secret_post') {\n body.set(oauthParameterName(input.tokenClientIdParam, 'client_id'), input.clientId)\n body.set(\n oauthParameterName(input.tokenClientSecretParam, 'client_secret'),\n input.clientSecret,\n )\n return\n }\n if (method === 'client_secret_basic') {\n headers.authorization = createOAuthBasicAuthorizationHeader(\n input.clientId,\n input.clientSecret,\n )\n return\n }\n throw new Error('Unsupported OAuth token client authentication method')\n}\n\nfunction oauthParameterName(value: string | undefined, fallback: string): string {\n const name = value ?? fallback\n if (!/^[A-Za-z][A-Za-z0-9_.-]{0,63}$/.test(name)) {\n throw new Error('Invalid OAuth parameter name')\n }\n return name\n}\n\n"],"mappings":";;;AAMA,SAAgB,2BAA2B,OAYhC;CACT,MAAM,MAAM,IAAI,IAAI,MAAM,gBAAgB;CAC1C,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,mBAAmB,CAAC,CAAC,GAAG,IAAI,aAAa,IAAI,KAAK,KAAK;CACvG,KAAK,MAAM,OAAO;EAAC;EAAa;EAAS;EAAa;EAAkB;CAAuB,GAAG,IAAI,aAAa,OAAO,GAAG;CAC7H,IAAI,aAAa,IAAI,iBAAiB,MAAM;CAC5C,IAAI,aAAa,IAAI,mBAAmB,MAAM,4BAA4B,WAAW,GAAG,MAAM,QAAQ;CACtG,IAAI,aAAa,IAAI,gBAAgB,MAAM,WAAW;CACtD,IAAI,aAAa,IAAI,SAAS,MAAM,KAAK;CACzC,IAAI,MAAM,UAAU,IAAI,aAAa,IAAI,aAAa,MAAM,QAAQ;MAC/D,IAAI,MAAM,mBAAmB,SAAS,MAAM,OAAO,QAAQ,IAAI,aAAa,IAAI,SAAS,MAAM,OAAO,KAAK,MAAM,kBAAkB,GAAG,CA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SAAS,MAAM,yBAAyB;CAC9C,IAAI,WAAW,QAAQ;EACrB,KAAK,IAAI,mBAAmB,MAAM,oBAAoB,WAAW,GAAG,MAAM,QAAQ;EAClF;CACF;CACA,IAAI,CAAC,MAAM,cACT,MAAM,IAAI,MAAM,SAAS,OAAO,gDAAgD;CAElF,IAAI,WAAW,sBAAsB;EACnC,KAAK,IAAI,mBAAmB,MAAM,oBAAoB,WAAW,GAAG,MAAM,QAAQ;EAClF,KAAK,IACH,mBAAmB,MAAM,wBAAwB,eAAe,GAChE,MAAM,YACR;EACA;CACF;CACA,IAAI,WAAW,uBAAuB;EACpC,QAAQ,gBAAgB,oCACtB,MAAM,UACN,MAAM,YACR;EACA;CACF;CACA,MAAM,IAAI,MAAM,sDAAsD;AACxE;AAEA,SAAS,mBAAmB,OAA2B,UAA0B;CAC/E,MAAM,OAAO,SAAS;CACtB,IAAI,CAAC,iCAAiC,KAAK,IAAI,GAC7C,MAAM,IAAI,MAAM,8BAA8B;CAEhD,OAAO;AACT"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as IntegrationPolicyEngine, E as IntegrationPolicyDecision, b as IntegrationDataClass, c as IntegrationActor, f as IntegrationConnection, g as IntegrationConnectorAction, i as IntegrationActionGuard, l as IntegrationApprovalRequest, o as IntegrationActionResult, s as IntegrationActionRisk, x as IntegrationGuardContext } from "./core-types-0BenSoZJ.js";
|
|
2
2
|
//#region src/audit.d.ts
|
|
3
3
|
type IntegrationAuditEventType = 'connection.created' | 'connection.updated' | 'connection.revoked' | 'grant.created' | 'grant.revoked' | 'capability.issued' | 'action.invoked' | 'action.failed' | 'trigger.subscribed' | 'trigger.received' | 'workflow.installed' | 'approval.requested' | 'approval.resolved' | 'healthcheck.completed';
|
|
4
4
|
interface IntegrationAuditEvent {
|
|
@@ -143,4 +143,4 @@ declare function buildApprovalRequest(ctx: IntegrationGuardContext & {
|
|
|
143
143
|
declare function redactApprovalRequest(request: IntegrationApprovalRequest): IntegrationApprovalRequest;
|
|
144
144
|
//#endregion
|
|
145
145
|
export { createIntegrationAuditEvent as C, createAuditingActionGuard as S, IntegrationAuditEvent as _, StaticIntegrationPolicyOptions as a, IntegrationAuditSink as b, redactApprovalRequest as c, IntegrationIdempotencyRecord as d, IntegrationIdempotencyStore as f, InMemoryIntegrationAuditStore as g, createDefaultIntegrationActionGuard as h, StaticIntegrationPolicyEngine as i, DefaultIntegrationActionGuard as l, IntegrationRateLimiter as m, IntegrationPolicyEffect as n, buildApprovalRequest as o, IntegrationRateLimitDecision as p, IntegrationPolicyRule as r, createDefaultIntegrationPolicyEngine as s, IntegrationApprovalResolution as t, InMemoryIntegrationIdempotencyStore as u, IntegrationAuditEventType as v, sanitizeAuditConnection as w, IntegrationAuditStore as x, IntegrationAuditFilter as y };
|
|
146
|
-
//# sourceMappingURL=policy-
|
|
146
|
+
//# sourceMappingURL=policy-C8jynxf9.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy-
|
|
1
|
+
{"version":3,"file":"policy-C8jynxf9.d.ts","names":[],"sources":["../src/audit.ts","../src/guard.ts","../src/policy.ts"],"mappings":";;KAaY;UAgBK;EACf;EACA,MAAM;EACN;EACA,QAAQ;EACR;EACA;EACA;EACA;EACA,OAAO;EACP,YAAY;EACZ;EACA;EACA,WAAW;;UAGI;EACf,OAAO,OAAO,wBAAwB;;UAGvB,8BAA8B;EAC7C,KAAK,SAAS,yBAAyB,QAAQ,2BAA2B;;UAG3D;EACf,OAAO;EACP,QAAQ;EACR;EACA;EACA;EACA;;cAGW,yCAAyC;mBACnC;EAEjB,OAAO,OAAO;EAId,KAAK,SAAQ,yBAA8B;;iBAK7B,4BAA4B,OAAO,KAAK;EACtD;EACA,sBAAsB;EACtB,YAAY;IACV;iBAYY,0BAA0B;EACxC,MAAM;EACN,UAAU;EACV,YAAY;EACZ;IACE;iBAiCY,wBAAwB,YAAY,wBAAwB;;;UCvH3D;EACf;EACA;EACA,QAAQ;EACR;;UAGe;EACf,IAAI,cAAc,QAAQ,4CAA4C;EACtE,IAAI,QAAQ,+BAA+B;;UAG5B;EACf;EACA;EACA;;UAGe;EACf,MAAM,KAAK,0BAA0B,QAAQ,gCAAgC;;cAGlE,+CAA+C;mBACzC;EAEjB,IAAI,cAAc;EAIlB,IAAI,QAAQ;;cAKD,yCAAyC;mBACnC;mBACA;mBACA;mBACA;mBACA;EAEjB,YAAY;IACV,cAAc;IACd,QAAQ;IACR,cAAc;IACd;IACA,YAAY;;EASR,aAAa,KAAK,yBAAyB,eAAe,QAAQ,2BAA2B,QAAQ;UAwF7F;;iBAWA,oCAAoC,UAAS,6BAA6B,oCAAyC;;;KCxJvH;UAEK;EACf;EACA,QAAQ;EACR;EACA;EACA;EACA;EACA,UAAU;EACV,OAAO;EACP,YAAY;;UAGG;EACf,QAAQ;EACR,oBAAoB;EACpB,qBAAqB;EACrB,2BAA2B;EAC3B,YAAY;;UAGG;EACf;EACA;EACA;EACA;EACA;EACA,WAAW;;cAGA,yCAAyC;mBACnC;mBACA;mBACA;mBACA;mBACA;EAEjB,YAAY,UAAS;EAQrB,OAAO,KAAK;IAA4B;MAAW;MAAc;;MAAiB;UAgB1E;;iBAOM,qCAAqC,UAAS,KAAK,2CAAgD;iBAInG,qBACd,KAAK;EAA4B;IAAW;IAAc;;GAC1D,gBACA,aAAa,OACZ;iBAmBa,sBAAsB,SAAS,6BAA6B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as IntegrationRegistry, s as IntegrationSupportTier } from "./registry-core-
|
|
1
|
+
import { h as IntegrationConnector } from "./core-types-0BenSoZJ.js";
|
|
2
|
+
import { n as IntegrationRegistry, s as IntegrationSupportTier } from "./registry-core-B1ApiG47.js";
|
|
3
3
|
//#region src/registry.d.ts
|
|
4
4
|
declare function buildDefaultIntegrationRegistry(options?: {
|
|
5
5
|
includeSpecs?: boolean;
|
|
@@ -31,4 +31,4 @@ interface IntegrationCatalogExecutability {
|
|
|
31
31
|
declare function classifyIntegrationCatalogExecutability(registry?: IntegrationRegistry): IntegrationCatalogExecutability[];
|
|
32
32
|
//#endregion
|
|
33
33
|
export { buildDefaultIntegrationRegistry as n, classifyIntegrationCatalogExecutability as r, IntegrationCatalogExecutability as t };
|
|
34
|
-
//# sourceMappingURL=registry-
|
|
34
|
+
//# sourceMappingURL=registry-0xWMSBUu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry-
|
|
1
|
+
{"version":3,"file":"registry-0xWMSBUu.d.ts","names":[],"sources":["../src/registry.ts"],"mappings":";;;iBA6BgB,gCAAgC;EAC9C;EACA;EACA;;EAEA;IACO;;;;UAgDQ;EACf;;;;EAIA;EACA,aAAa;EACb,UAAU;;;;EAIV;EACA;EACA;;;;iBAKc,wCACd,WAAU,sBACT"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as IntegrationCatalogSource, h as IntegrationConnector } from "./core-types-0BenSoZJ.js";
|
|
2
2
|
//#region src/registry-core.d.ts
|
|
3
3
|
type IntegrationSupportTier = 'catalogOnly' | 'setupReady' | 'gatewayExecutable' | 'firstPartyExecutable' | 'sandboxExecutable';
|
|
4
4
|
interface IntegrationRegistrySourceRef {
|
|
@@ -47,4 +47,4 @@ declare function canonicalConnectorId(id: string, aliases?: Record<string, strin
|
|
|
47
47
|
declare function inferIntegrationSupportTier(connector: IntegrationConnector): IntegrationSupportTier;
|
|
48
48
|
//#endregion
|
|
49
49
|
export { IntegrationRegistrySourceRef as a, canonicalConnectorId as c, summarizeIntegrationRegistry as d, IntegrationRegistryEntry as i, composeIntegrationRegistry as l, IntegrationRegistry as n, IntegrationRegistrySummary as o, IntegrationRegistryConflict as r, IntegrationSupportTier as s, ComposeIntegrationRegistryOptions as t, inferIntegrationSupportTier as u };
|
|
50
|
-
//# sourceMappingURL=registry-core-
|
|
50
|
+
//# sourceMappingURL=registry-core-B1ApiG47.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry-core-
|
|
1
|
+
{"version":3,"file":"registry-core-B1ApiG47.d.ts","names":[],"sources":["../src/registry-core.ts"],"mappings":";;KAQY;UAOK;EACf;EACA;EACA;EACA,aAAa;EACb;EACA;;UAGe;EACf;EACA,QAAQ;IACN;IACA;IACA;;;UAIa;EACf;EACA,WAAW;EACX;EACA,aAAa;EACb,SAAS;EACT,WAAW;;UAGI;EACf,SAAS;EACT,YAAY;EACZ,MAAM,YAAY;;UAGH;EACf;EACA;EACA;EACA;EACA,eAAe,OAAO;;UAGP;EACf,UAAU;EACV,mBAAmB;;iBAsBL,2BACd,SAAS,4BACT,UAAS,oCACR;iBAiCa,6BAA6B,UAAU,sBAAsB;iBAkB7D,qBAAqB,YAAY,UAAS;iBAW1C,4BAA4B,WAAW,uBAAuB"}
|
package/dist/registry.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as IntegrationRegistrySourceRef, c as canonicalConnectorId, d as summarizeIntegrationRegistry, i as IntegrationRegistryEntry, l as composeIntegrationRegistry, n as IntegrationRegistry, o as IntegrationRegistrySummary, r as IntegrationRegistryConflict, s as IntegrationSupportTier, t as ComposeIntegrationRegistryOptions, u as inferIntegrationSupportTier } from "./registry-core-
|
|
2
|
-
import { n as buildDefaultIntegrationRegistry, r as classifyIntegrationCatalogExecutability, t as IntegrationCatalogExecutability } from "./registry-
|
|
1
|
+
import { a as IntegrationRegistrySourceRef, c as canonicalConnectorId, d as summarizeIntegrationRegistry, i as IntegrationRegistryEntry, l as composeIntegrationRegistry, n as IntegrationRegistry, o as IntegrationRegistrySummary, r as IntegrationRegistryConflict, s as IntegrationSupportTier, t as ComposeIntegrationRegistryOptions, u as inferIntegrationSupportTier } from "./registry-core-B1ApiG47.js";
|
|
2
|
+
import { n as buildDefaultIntegrationRegistry, r as classifyIntegrationCatalogExecutability, t as IntegrationCatalogExecutability } from "./registry-0xWMSBUu.js";
|
|
3
3
|
export { type ComposeIntegrationRegistryOptions, IntegrationCatalogExecutability, type IntegrationRegistry, type IntegrationRegistryConflict, type IntegrationRegistryEntry, type IntegrationRegistrySourceRef, type IntegrationRegistrySummary, type IntegrationSupportTier, buildDefaultIntegrationRegistry, canonicalConnectorId, classifyIntegrationCatalogExecutability, composeIntegrationRegistry, inferIntegrationSupportTier, summarizeIntegrationRegistry };
|
package/dist/registry.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as buildDefaultIntegrationRegistry, w as classifyIntegrationCatalogExecutability } from "./src-
|
|
1
|
+
import { C as buildDefaultIntegrationRegistry, w as classifyIntegrationCatalogExecutability } from "./src-DM3qkMTB.js";
|
|
2
2
|
import { i as summarizeIntegrationRegistry, n as composeIntegrationRegistry, r as inferIntegrationSupportTier, t as canonicalConnectorId } from "./registry-core-BZo69C37.js";
|
|
3
3
|
export { buildDefaultIntegrationRegistry, canonicalConnectorId, classifyIntegrationCatalogExecutability, composeIntegrationRegistry, inferIntegrationSupportTier, summarizeIntegrationRegistry };
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Cr as IntegrationRuntimeHub, Er as createIntegrationRuntime, Sr as IntegrationRuntime, Tr as IntegrationSandboxBundle, _r as IntegrationManifestResolution, br as IntegrationRequirementResolution, fr as InMemoryIntegrationGrantStore, gr as IntegrationManifest, hr as IntegrationGrantStore, mr as IntegrationGrant, pr as IntegrationCapabilityBinding, vr as IntegrationRequirement, wr as IntegrationRuntimeOptions, xr as IntegrationRequirementStatus, yr as IntegrationRequirementMode } from "./consumer-
|
|
1
|
+
import { Cr as IntegrationRuntimeHub, Er as createIntegrationRuntime, Sr as IntegrationRuntime, Tr as IntegrationSandboxBundle, _r as IntegrationManifestResolution, br as IntegrationRequirementResolution, fr as InMemoryIntegrationGrantStore, gr as IntegrationManifest, hr as IntegrationGrantStore, mr as IntegrationGrant, pr as IntegrationCapabilityBinding, vr as IntegrationRequirement, wr as IntegrationRuntimeOptions, xr as IntegrationRequirementStatus, yr as IntegrationRequirementMode } from "./consumer-YE5ibTlI.js";
|
|
2
2
|
export { InMemoryIntegrationGrantStore, IntegrationCapabilityBinding, IntegrationGrant, IntegrationGrantStore, IntegrationManifest, IntegrationManifestResolution, IntegrationRequirement, IntegrationRequirementMode, IntegrationRequirementResolution, IntegrationRequirementStatus, IntegrationRuntime, IntegrationRuntimeHub, IntegrationRuntimeOptions, IntegrationSandboxBundle, createIntegrationRuntime };
|
package/dist/sandbox.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { At as redactInvocationEnvelope, Ct as IntegrationSandboxHostOptions, Dt as invocationRequestFromEnvelope, Et as dispatchIntegrationInvocation, Ot as normalizeIntegrationResult, St as IntegrationSandboxHostHub, Tt as buildIntegrationInvocationEnvelope, bt as IntegrationInvocationEnvelopeValidationOptions, jt as validateIntegrationInvocationEnvelope, kt as redactCapability, wt as NormalizedIntegrationResult, xt as IntegrationSandboxHost, yt as IntegrationInvocationEnvelope } from "./consumer-
|
|
1
|
+
import { At as redactInvocationEnvelope, Ct as IntegrationSandboxHostOptions, Dt as invocationRequestFromEnvelope, Et as dispatchIntegrationInvocation, Ot as normalizeIntegrationResult, St as IntegrationSandboxHostHub, Tt as buildIntegrationInvocationEnvelope, bt as IntegrationInvocationEnvelopeValidationOptions, jt as validateIntegrationInvocationEnvelope, kt as redactCapability, wt as NormalizedIntegrationResult, xt as IntegrationSandboxHost, yt as IntegrationInvocationEnvelope } from "./consumer-YE5ibTlI.js";
|
|
2
2
|
export { IntegrationInvocationEnvelope, IntegrationInvocationEnvelopeValidationOptions, IntegrationSandboxHost, IntegrationSandboxHostHub, IntegrationSandboxHostOptions, NormalizedIntegrationResult, buildIntegrationInvocationEnvelope, dispatchIntegrationInvocation, invocationRequestFromEnvelope, normalizeIntegrationResult, redactCapability, redactInvocationEnvelope, validateIntegrationInvocationEnvelope };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as canonicalIntegrationKind } from "./integration-kind-aliases-DeUJgBWP.js";
|
|
2
|
-
import { a as getBundledAdapterManifest, i as bundledOAuth2AuthContract, n as bundledAuthMode, t as bundledApiKeyHint } from "./bundled-manifest-data-
|
|
2
|
+
import { a as getBundledAdapterManifest, i as bundledOAuth2AuthContract, n as bundledAuthMode, t as bundledApiKeyHint } from "./bundled-manifest-data-BgTJ7dmp.js";
|
|
3
3
|
import { buildIntegrationCoverageConnectors, listIntegrationCoverageSpecs } from "./coverage-catalog.js";
|
|
4
4
|
//#region src/specs/families.ts
|
|
5
5
|
const INTEGRATION_FAMILIES = {
|
|
@@ -2406,4 +2406,4 @@ function validateCredentialSet(spec, values) {
|
|
|
2406
2406
|
//#endregion
|
|
2407
2407
|
export { getIntegrationFamily as _, buildHealthcheckPlan as a, renderConsoleSteps as c, getIntegrationSpec as d, integrationSpecToConnector as f, INTEGRATION_FAMILIES as g, resolveConnectorAuthSpec as h, validateIntegrationSpec as i, renderRunbookMarkdown as l, listIntegrationSpecs as m, validateCredentialFormat as n, consoleStepsToText as o, listExecutableIntegrationSpecs as p, validateCredentialSet as r, renderAgentToolDescription as s, assertValidIntegrationSpec as t, specAuthToConnectorAuth as u };
|
|
2408
2408
|
|
|
2409
|
-
//# sourceMappingURL=specs-
|
|
2409
|
+
//# sourceMappingURL=specs-02Un982U.js.map
|