@tangle-network/agent-integrations 0.53.50 → 0.53.52
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/dist/catalog.d.ts +2 -2
- package/dist/catalog.js +8 -8
- package/dist/{chunk-KBYYTHXQ.js → chunk-ABWBYMCF.js} +2 -2
- package/dist/{chunk-QE4WFYSK.js → chunk-CONRYVPK.js} +12 -6
- package/dist/chunk-CONRYVPK.js.map +1 -0
- package/dist/{chunk-T3WH6MMA.js → chunk-CT3J7ZB6.js} +111 -8
- package/dist/chunk-CT3J7ZB6.js.map +1 -0
- package/dist/{chunk-W72KPXXX.js → chunk-DCSQH4O6.js} +58 -1
- package/dist/chunk-DCSQH4O6.js.map +1 -0
- package/dist/{chunk-EP6EDAPV.js → chunk-E2QYXDJQ.js} +19 -6
- package/dist/chunk-E2QYXDJQ.js.map +1 -0
- package/dist/{chunk-ZZA4HOBE.js → chunk-PIEBVPSW.js} +2 -2
- package/dist/{chunk-UI3U62H6.js → chunk-PIF635BP.js} +2 -2
- package/dist/{chunk-2JRYKWYX.js → chunk-QL6CRJ3E.js} +303 -556
- package/dist/{chunk-2JRYKWYX.js.map → chunk-QL6CRJ3E.js.map} +1 -1
- package/dist/connect/index.d.ts +2 -2
- package/dist/connect/index.js +2 -2
- package/dist/connectors/adapters/index.d.ts +16 -21
- package/dist/connectors/adapters/index.js +2 -2
- package/dist/connectors/index.d.ts +22 -12
- package/dist/connectors/index.js +5 -3
- package/dist/{consumer-DrLnbqYt.d.ts → consumer-BbQWkIzU.d.ts} +1 -1
- package/dist/consumer.d.ts +3 -3
- package/dist/consumer.js +2 -2
- package/dist/{core-types-D26cY5tD.d.ts → core-types-A-xIaTzb.d.ts} +1 -1
- package/dist/coverage-catalog.d.ts +2 -2
- package/dist/{importers-CQKts3pm.d.ts → importers-BMigcDVf.d.ts} +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.js +10 -8
- package/dist/mcp.d.ts +3 -3
- package/dist/mcp.js +8 -8
- package/dist/middleware/index.d.ts +2 -2
- package/dist/middleware/index.js +2 -2
- package/dist/registry.d.ts +2 -2
- package/dist/registry.js +8 -8
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.js +8 -8
- package/dist/specs.d.ts +11 -2
- package/dist/specs.js +4 -4
- package/dist/{tangle-id-BCOVbWrP.d.ts → tangle-id-gFOGXe4Y.d.ts} +1 -1
- package/dist/{types-DpKn0frG.d.ts → types-DpKEBiX6.d.ts} +19 -1
- package/docs/integration-execution-matrix.json +65 -99
- package/package.json +1 -1
- package/dist/chunk-EP6EDAPV.js.map +0 -1
- package/dist/chunk-QE4WFYSK.js.map +0 -1
- package/dist/chunk-T3WH6MMA.js.map +0 -1
- package/dist/chunk-W72KPXXX.js.map +0 -1
- /package/dist/{chunk-KBYYTHXQ.js.map → chunk-ABWBYMCF.js.map} +0 -0
- /package/dist/{chunk-ZZA4HOBE.js.map → chunk-PIEBVPSW.js.map} +0 -0
- /package/dist/{chunk-UI3U62H6.js.map → chunk-PIF635BP.js.map} +0 -0
|
@@ -7,17 +7,17 @@ import {
|
|
|
7
7
|
canonicalIntegrationKind,
|
|
8
8
|
integrationSpecToConnector,
|
|
9
9
|
listIntegrationSpecs
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-CONRYVPK.js";
|
|
11
11
|
import {
|
|
12
12
|
listBundledConnectorAdapters
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-E2QYXDJQ.js";
|
|
14
14
|
import {
|
|
15
15
|
CONNECTOR_ADAPTER_FACTORIES,
|
|
16
16
|
createOAuthBasicAuthorizationHeader,
|
|
17
17
|
createOAuthTokenRequestHeaders,
|
|
18
18
|
oauthClientCredentialRedactionValues,
|
|
19
19
|
redactOAuthSensitiveText
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-QL6CRJ3E.js";
|
|
21
21
|
|
|
22
22
|
// src/activepieces-catalog.ts
|
|
23
23
|
import { readFileSync } from "fs";
|
|
@@ -252,6 +252,12 @@ function createConnectorAdapterProvider(options) {
|
|
|
252
252
|
"auth_not_supported"
|
|
253
253
|
);
|
|
254
254
|
}
|
|
255
|
+
if ((auth.grantType ?? "authorization_code") !== "authorization_code") {
|
|
256
|
+
throw new IntegrationError(
|
|
257
|
+
`Connector ${request.connectorId} uses client_credentials and requires a machine connection path.`,
|
|
258
|
+
"auth_not_supported"
|
|
259
|
+
);
|
|
260
|
+
}
|
|
255
261
|
const pkce = resolveOAuthPkceMode(auth.pkce, request.connectorId);
|
|
256
262
|
const tokenClientAuthMethod = resolveTokenClientAuthMethod(
|
|
257
263
|
auth.tokenClientAuthMethod,
|
|
@@ -280,7 +286,8 @@ function createConnectorAdapterProvider(options) {
|
|
|
280
286
|
const url = new URL(resolveOAuthUrlTemplate(
|
|
281
287
|
auth.authorizationUrl,
|
|
282
288
|
request.metadata,
|
|
283
|
-
request.connectorId
|
|
289
|
+
request.connectorId,
|
|
290
|
+
auth.urlTemplateMetadata
|
|
284
291
|
));
|
|
285
292
|
url.searchParams.set("response_type", "code");
|
|
286
293
|
url.searchParams.set(
|
|
@@ -292,7 +299,7 @@ function createConnectorAdapterProvider(options) {
|
|
|
292
299
|
client.clientId
|
|
293
300
|
);
|
|
294
301
|
url.searchParams.set("redirect_uri", request.redirectUri);
|
|
295
|
-
if (scopes.length > 0) {
|
|
302
|
+
if (auth.sendScopeParam !== false && scopes.length > 0) {
|
|
296
303
|
url.searchParams.set("scope", scopes.join(auth.scopeSeparator ?? " "));
|
|
297
304
|
}
|
|
298
305
|
const state = request.state ?? randomState();
|
|
@@ -335,6 +342,12 @@ function createConnectorAdapterProvider(options) {
|
|
|
335
342
|
"auth_not_supported"
|
|
336
343
|
);
|
|
337
344
|
}
|
|
345
|
+
if ((auth.grantType ?? "authorization_code") !== "authorization_code") {
|
|
346
|
+
throw new IntegrationError(
|
|
347
|
+
`Connector ${request.connectorId} uses client_credentials and requires a machine connection path.`,
|
|
348
|
+
"auth_not_supported"
|
|
349
|
+
);
|
|
350
|
+
}
|
|
338
351
|
const tokenClientAuthMethod = resolveTokenClientAuthMethod(
|
|
339
352
|
auth.tokenClientAuthMethod,
|
|
340
353
|
request.connectorId
|
|
@@ -419,7 +432,8 @@ function createConnectorAdapterProvider(options) {
|
|
|
419
432
|
const tokenUrl = resolveOAuthUrlTemplate(
|
|
420
433
|
auth.tokenUrl,
|
|
421
434
|
request.metadata,
|
|
422
|
-
request.connectorId
|
|
435
|
+
request.connectorId,
|
|
436
|
+
auth.urlTemplateMetadata
|
|
423
437
|
);
|
|
424
438
|
let res;
|
|
425
439
|
try {
|
|
@@ -695,12 +709,42 @@ function base64Encode(value) {
|
|
|
695
709
|
for (const byte of bytes) binary += String.fromCharCode(byte);
|
|
696
710
|
return btoa2(binary);
|
|
697
711
|
}
|
|
698
|
-
function resolveOAuthUrlTemplate(template, metadata, connectorId) {
|
|
712
|
+
function resolveOAuthUrlTemplate(template, metadata, connectorId, metadataSpecs) {
|
|
699
713
|
const placeholders = [...template.matchAll(/\{([A-Za-z][A-Za-z0-9_]*)\}/g)];
|
|
700
714
|
let resolved = template;
|
|
701
715
|
for (const match of placeholders) {
|
|
702
716
|
const key = match[1];
|
|
703
717
|
const raw = metadata?.[key];
|
|
718
|
+
const metadataSpec = metadataSpecs?.[key];
|
|
719
|
+
if (metadataSpec?.kind === "base-url") {
|
|
720
|
+
if (typeof raw !== "string") {
|
|
721
|
+
throw new IntegrationError(
|
|
722
|
+
`OAuth URL for ${connectorId} requires metadata.${key} as a provider base URL.`,
|
|
723
|
+
"config_missing"
|
|
724
|
+
);
|
|
725
|
+
}
|
|
726
|
+
resolved = resolved.replaceAll(
|
|
727
|
+
match[0],
|
|
728
|
+
resolveOAuthMetadataBaseUrl(raw, metadataSpec, connectorId, key)
|
|
729
|
+
);
|
|
730
|
+
continue;
|
|
731
|
+
}
|
|
732
|
+
if (metadataSpec?.kind === "path-segment") {
|
|
733
|
+
if (!isOAuthPathSegmentPlaceholder(template, match.index ?? -1, match[0])) {
|
|
734
|
+
throw new IntegrationError(
|
|
735
|
+
`OAuth URL for ${connectorId} declares metadata.${key} outside a complete path segment.`,
|
|
736
|
+
"config_missing"
|
|
737
|
+
);
|
|
738
|
+
}
|
|
739
|
+
if (typeof raw !== "string" || !isOAuthPathSegment(raw.trim())) {
|
|
740
|
+
throw new IntegrationError(
|
|
741
|
+
`OAuth URL for ${connectorId} requires metadata.${key} as a valid path segment.`,
|
|
742
|
+
"config_missing"
|
|
743
|
+
);
|
|
744
|
+
}
|
|
745
|
+
resolved = resolved.replaceAll(match[0], encodeURIComponent(raw.trim()));
|
|
746
|
+
continue;
|
|
747
|
+
}
|
|
704
748
|
if (typeof raw !== "string" || !isDnsLabel(raw.trim())) {
|
|
705
749
|
throw new IntegrationError(
|
|
706
750
|
`OAuth URL for ${connectorId} requires metadata.${key} as a valid tenant label.`,
|
|
@@ -726,6 +770,65 @@ function resolveOAuthUrlTemplate(template, metadata, connectorId) {
|
|
|
726
770
|
}
|
|
727
771
|
return url.toString();
|
|
728
772
|
}
|
|
773
|
+
function isOAuthPathSegment(value) {
|
|
774
|
+
return value !== "." && value !== ".." && /^[A-Za-z0-9._~-]{1,128}$/.test(value);
|
|
775
|
+
}
|
|
776
|
+
function isOAuthPathSegmentPlaceholder(template, index, placeholder) {
|
|
777
|
+
if (index < 0) return false;
|
|
778
|
+
const schemeIndex = template.indexOf("://");
|
|
779
|
+
const rootEnd = schemeIndex >= 0 ? schemeIndex + 3 : template.startsWith("{") ? template.indexOf("}") + 1 : 0;
|
|
780
|
+
const pathStart = template.indexOf("/", rootEnd);
|
|
781
|
+
const end = index + placeholder.length;
|
|
782
|
+
const queryStart = template.search(/[?#]/);
|
|
783
|
+
return pathStart >= 0 && index >= pathStart && (queryStart < 0 || index < queryStart) && template[index - 1] === "/" && (end === template.length || template[end] === "/" || template[end] === "?" || template[end] === "#");
|
|
784
|
+
}
|
|
785
|
+
function resolveOAuthMetadataBaseUrl(value, spec, connectorId, metadataKey) {
|
|
786
|
+
let url;
|
|
787
|
+
try {
|
|
788
|
+
url = new URL(value.trim());
|
|
789
|
+
} catch {
|
|
790
|
+
throw invalidOAuthMetadataBaseUrl(connectorId, metadataKey);
|
|
791
|
+
}
|
|
792
|
+
if (url.protocol !== "https:" || url.username || url.password || url.pathname !== "/" || url.search || url.hash) {
|
|
793
|
+
throw invalidOAuthMetadataBaseUrl(connectorId, metadataKey);
|
|
794
|
+
}
|
|
795
|
+
const exactAllowed = spec.allowedBaseUrls?.some((candidate) => sameOrigin(candidate, url)) ?? false;
|
|
796
|
+
const suffixAllowed = spec.allowedBaseUrlSuffixes?.some(
|
|
797
|
+
(suffix) => !url.port && suffix.startsWith(".") && url.hostname.toLowerCase().endsWith(suffix.toLowerCase())
|
|
798
|
+
) ?? false;
|
|
799
|
+
const hasExplicitAllowlist = Boolean(
|
|
800
|
+
spec.allowedBaseUrls?.length || spec.allowedBaseUrlSuffixes?.length
|
|
801
|
+
);
|
|
802
|
+
if (hasExplicitAllowlist && !exactAllowed && !suffixAllowed) {
|
|
803
|
+
throw invalidOAuthMetadataBaseUrl(connectorId, metadataKey);
|
|
804
|
+
}
|
|
805
|
+
if (spec.requirePublicHttps && !isPublicDnsHostname(url.hostname)) {
|
|
806
|
+
throw invalidOAuthMetadataBaseUrl(connectorId, metadataKey);
|
|
807
|
+
}
|
|
808
|
+
return url.origin;
|
|
809
|
+
}
|
|
810
|
+
function invalidOAuthMetadataBaseUrl(connectorId, metadataKey) {
|
|
811
|
+
return new IntegrationError(
|
|
812
|
+
`OAuth URL for ${connectorId} requires metadata.${metadataKey} as an allowed HTTPS provider root.`,
|
|
813
|
+
"config_missing"
|
|
814
|
+
);
|
|
815
|
+
}
|
|
816
|
+
function sameOrigin(candidate, actual) {
|
|
817
|
+
try {
|
|
818
|
+
const allowed = new URL(candidate);
|
|
819
|
+
return allowed.protocol === "https:" && !allowed.username && !allowed.password && allowed.pathname === "/" && !allowed.search && !allowed.hash && allowed.origin === actual.origin;
|
|
820
|
+
} catch {
|
|
821
|
+
return false;
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
function isPublicDnsHostname(hostname) {
|
|
825
|
+
const normalized = hostname.toLowerCase().replace(/^\[|\]$/g, "");
|
|
826
|
+
if (normalized === "localhost" || normalized.endsWith(".localhost") || normalized.endsWith(".local") || normalized.endsWith(".internal") || normalized.endsWith(".home.arpa")) {
|
|
827
|
+
return false;
|
|
828
|
+
}
|
|
829
|
+
if (/^[0-9.]+$/.test(normalized) || normalized.includes(":")) return false;
|
|
830
|
+
return normalized.includes(".") && normalized.split(".").every(isDnsLabel);
|
|
831
|
+
}
|
|
729
832
|
function isDnsLabel(value) {
|
|
730
833
|
return value.length > 0 && value.length <= 63 && /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i.test(value);
|
|
731
834
|
}
|
|
@@ -4743,4 +4846,4 @@ export {
|
|
|
4743
4846
|
signCapability,
|
|
4744
4847
|
verifyCapabilityToken
|
|
4745
4848
|
};
|
|
4746
|
-
//# sourceMappingURL=chunk-
|
|
4849
|
+
//# sourceMappingURL=chunk-CT3J7ZB6.js.map
|