@tangle-network/agent-integrations 0.33.1 → 0.33.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 +2 -7
- package/dist/catalog.d.ts +2 -2
- package/dist/catalog.js +9 -7
- package/dist/{chunk-7T5YTVER.js → chunk-53NQJZAT.js} +8 -318
- package/dist/chunk-53NQJZAT.js.map +1 -0
- package/dist/chunk-7P2LN4VT.js +318 -0
- package/dist/chunk-7P2LN4VT.js.map +1 -0
- package/dist/{chunk-XO2RSS6Y.js → chunk-C4CGT5JE.js} +52 -669
- package/dist/chunk-C4CGT5JE.js.map +1 -0
- package/dist/{chunk-YPZORI3G.js → chunk-CR35IEKW.js} +2 -2
- package/dist/{chunk-43VQSANC.js → chunk-D57YS6XC.js} +2 -2
- package/dist/{chunk-6N23S4JY.js → chunk-DT3H3NIW.js} +532 -5
- package/dist/chunk-DT3H3NIW.js.map +1 -0
- package/dist/{chunk-RF3RH374.js → chunk-O553GSCX.js} +2 -2
- package/dist/chunk-PZ5AY32C.js +10 -0
- package/dist/{chunk-NQ7OPDUM.js → chunk-ZDK7Y4QG.js} +12 -1
- package/dist/chunk-ZDK7Y4QG.js.map +1 -0
- package/dist/connect/index.d.ts +2 -2
- package/dist/connect/index.js +3 -2
- package/dist/connectors/adapters/index.d.ts +2 -2
- package/dist/connectors/adapters/index.js +3 -2
- package/dist/connectors/index.d.ts +2 -2
- package/dist/connectors/index.js +3 -2
- package/dist/{consumer-CzJgntej.d.ts → consumer-yV4NtH2h.d.ts} +1 -1
- package/dist/consumer.d.ts +3 -3
- package/dist/consumer.js +3 -2
- package/dist/{core-types-D5Dc65Ud.d.ts → core-types-CjWifQOf.d.ts} +2 -2
- package/dist/coverage-catalog.d.ts +26 -0
- package/dist/coverage-catalog.js +12 -0
- package/dist/coverage-catalog.js.map +1 -0
- package/dist/index.d.ts +74 -58
- package/dist/index.js +16 -47
- package/dist/middleware/index.d.ts +2 -2
- package/dist/middleware/index.js +3 -2
- package/dist/registry.d.ts +2 -2
- package/dist/registry.js +9 -7
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.js +9 -7
- package/dist/specs.d.ts +2 -2
- package/dist/specs.js +3 -1
- package/dist/stripe/index.js +1 -0
- package/dist/stripe/index.js.map +1 -1
- package/dist/{tangle-id-DA_qj-O_.d.ts → tangle-id-hDDWP-2f.d.ts} +1 -1
- package/dist/{types-XdpvaIzW.d.ts → types-Bxg-wJkW.d.ts} +12 -3
- package/dist/webhooks/index.js +1 -0
- package/dist/webhooks/index.js.map +1 -1
- package/docs/adapter-triage.md +9 -42
- package/docs/external-product-integration.md +3 -4
- package/docs/integration-execution-audit.md +134 -70
- package/docs/integration-execution-matrix.json +3062 -1823
- package/package.json +14 -25
- package/dist/bin/tangle-catalog-runtime.d.ts +0 -1
- package/dist/bin/tangle-catalog-runtime.js +0 -82
- package/dist/bin/tangle-catalog-runtime.js.map +0 -1
- package/dist/chunk-6N23S4JY.js.map +0 -1
- package/dist/chunk-7T5YTVER.js.map +0 -1
- package/dist/chunk-NQ7OPDUM.js.map +0 -1
- package/dist/chunk-XO2RSS6Y.js.map +0 -1
- package/dist/tangle-catalog-runtime-2HddXxoM.d.ts +0 -242
- package/dist/tangle-catalog-runtime.d.ts +0 -3
- package/dist/tangle-catalog-runtime.js +0 -32
- /package/dist/{chunk-YPZORI3G.js.map → chunk-CR35IEKW.js.map} +0 -0
- /package/dist/{chunk-43VQSANC.js.map → chunk-D57YS6XC.js.map} +0 -0
- /package/dist/{chunk-RF3RH374.js.map → chunk-O553GSCX.js.map} +0 -0
- /package/dist/{tangle-catalog-runtime.js.map → chunk-PZ5AY32C.js.map} +0 -0
|
@@ -5,7 +5,10 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
integrationSpecToConnector,
|
|
7
7
|
listIntegrationSpecs
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-53NQJZAT.js";
|
|
9
|
+
import {
|
|
10
|
+
adapters_exports
|
|
11
|
+
} from "./chunk-DT3H3NIW.js";
|
|
9
12
|
|
|
10
13
|
// src/activepieces-catalog.ts
|
|
11
14
|
import { readFileSync } from "fs";
|
|
@@ -199,7 +202,7 @@ function dataClassFor(category) {
|
|
|
199
202
|
}
|
|
200
203
|
|
|
201
204
|
// src/index.ts
|
|
202
|
-
import { createHmac
|
|
205
|
+
import { createHmac, randomUUID as randomUUID3, timingSafeEqual } from "crypto";
|
|
203
206
|
|
|
204
207
|
// src/core-error.ts
|
|
205
208
|
var IntegrationError = class extends Error {
|
|
@@ -232,10 +235,10 @@ function createConnectorAdapterProvider(options) {
|
|
|
232
235
|
"connector_not_found"
|
|
233
236
|
);
|
|
234
237
|
}
|
|
235
|
-
const auth = adapter.manifest.auth;
|
|
236
|
-
if (auth
|
|
238
|
+
const auth = oauthManifestAuth(adapter.manifest.auth);
|
|
239
|
+
if (!auth) {
|
|
237
240
|
throw new IntegrationError(
|
|
238
|
-
`Connector ${request.connectorId} does not support OAuth2 authorization (auth kind: ${auth.kind}).`,
|
|
241
|
+
`Connector ${request.connectorId} does not support OAuth2 authorization (auth kind: ${adapter.manifest.auth.kind}).`,
|
|
239
242
|
"auth_not_supported"
|
|
240
243
|
);
|
|
241
244
|
}
|
|
@@ -283,10 +286,10 @@ function createConnectorAdapterProvider(options) {
|
|
|
283
286
|
"connector_not_found"
|
|
284
287
|
);
|
|
285
288
|
}
|
|
286
|
-
const auth = adapter.manifest.auth;
|
|
287
|
-
if (auth
|
|
289
|
+
const auth = oauthManifestAuth(adapter.manifest.auth);
|
|
290
|
+
if (!auth) {
|
|
288
291
|
throw new IntegrationError(
|
|
289
|
-
`Connector ${request.connectorId} does not support OAuth2 authorization (auth kind: ${auth.kind}).`,
|
|
292
|
+
`Connector ${request.connectorId} does not support OAuth2 authorization (auth kind: ${adapter.manifest.auth.kind}).`,
|
|
290
293
|
"auth_not_supported"
|
|
291
294
|
);
|
|
292
295
|
}
|
|
@@ -437,13 +440,14 @@ function createConnectorAdapterCatalogSource(options) {
|
|
|
437
440
|
}
|
|
438
441
|
function manifestToConnector(providerId, adapter) {
|
|
439
442
|
const manifest = adapter.manifest;
|
|
443
|
+
const primaryAuth = primaryManifestAuth(manifest.auth);
|
|
440
444
|
return {
|
|
441
445
|
id: manifest.kind,
|
|
442
446
|
providerId,
|
|
443
447
|
title: manifest.displayName,
|
|
444
448
|
category: mapCategory(manifest.category),
|
|
445
|
-
auth: mapAuth(
|
|
446
|
-
scopes:
|
|
449
|
+
auth: mapAuth(primaryAuth.kind),
|
|
450
|
+
scopes: primaryAuth.kind === "oauth2" ? primaryAuth.scopes : [],
|
|
447
451
|
actions: manifest.capabilities.filter((capability) => capability.class === "read" || capability.class === "mutation").map((capability) => ({
|
|
448
452
|
id: capability.name,
|
|
449
453
|
title: titleFromName(capability.name),
|
|
@@ -457,7 +461,9 @@ function manifestToConnector(providerId, adapter) {
|
|
|
457
461
|
metadata: {
|
|
458
462
|
source: "first-party-adapter",
|
|
459
463
|
supportTier: "firstPartyExecutable",
|
|
460
|
-
executable: true
|
|
464
|
+
executable: true,
|
|
465
|
+
authOptions: manifest.auth.kind === "one_of" ? manifest.auth.options.map((auth) => auth.kind) : [manifest.auth.kind],
|
|
466
|
+
preferredAuth: manifest.auth.kind === "one_of" ? manifest.auth.preferred : manifest.auth.kind
|
|
461
467
|
}
|
|
462
468
|
};
|
|
463
469
|
}
|
|
@@ -508,11 +514,21 @@ function mutationResultToAction(request, result) {
|
|
|
508
514
|
};
|
|
509
515
|
}
|
|
510
516
|
function mapAuth(kind) {
|
|
517
|
+
if (kind === "one_of") return "custom";
|
|
511
518
|
if (kind === "oauth2") return "oauth2";
|
|
512
519
|
if (kind === "api-key") return "api_key";
|
|
513
520
|
if (kind === "none") return "none";
|
|
514
521
|
return "custom";
|
|
515
522
|
}
|
|
523
|
+
function primaryManifestAuth(auth) {
|
|
524
|
+
if (auth.kind !== "one_of") return auth;
|
|
525
|
+
return auth.options.find((option) => option.kind === auth.preferred) ?? auth.options[0];
|
|
526
|
+
}
|
|
527
|
+
function oauthManifestAuth(auth) {
|
|
528
|
+
if (auth.kind === "oauth2") return auth;
|
|
529
|
+
if (auth.kind !== "one_of") return void 0;
|
|
530
|
+
return auth.options.find((option) => option.kind === "oauth2");
|
|
531
|
+
}
|
|
516
532
|
function mapCategory(category) {
|
|
517
533
|
if (category === "comms") return "chat";
|
|
518
534
|
if (category === "spreadsheet") return "database";
|
|
@@ -2638,620 +2654,6 @@ function createActivepiecesExecutorProvider(options) {
|
|
|
2638
2654
|
});
|
|
2639
2655
|
}
|
|
2640
2656
|
|
|
2641
|
-
// src/activepieces-runtime.ts
|
|
2642
|
-
import { createHmac, randomUUID as randomUUID3, timingSafeEqual } from "crypto";
|
|
2643
|
-
var ACTIVEPIECES_RUNTIME_SIGNATURE_HEADER = "x-tangle-activepieces-signature";
|
|
2644
|
-
var TANGLE_CATALOG_RUNTIME_SIGNATURE_HEADER = "x-tangle-catalog-signature";
|
|
2645
|
-
function createActivepiecesHttpExecutor(options) {
|
|
2646
|
-
const endpoint = options.endpoint.replace(/\/$/, "");
|
|
2647
|
-
const path = options.path ?? "/v1/activepieces/actions/invoke";
|
|
2648
|
-
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
2649
|
-
const signatureHeader = options.signatureHeader ?? ACTIVEPIECES_RUNTIME_SIGNATURE_HEADER;
|
|
2650
|
-
const fetchImpl = options.fetchImpl ?? fetch;
|
|
2651
|
-
const requestId = options.requestId ?? (() => `apexec_${randomUUID3()}`);
|
|
2652
|
-
return async (invocation) => {
|
|
2653
|
-
const body = buildActivepiecesRuntimeRequest(invocation, requestId());
|
|
2654
|
-
const serialized = JSON.stringify(body);
|
|
2655
|
-
const response = await fetchImpl(`${endpoint}${normalizedPath}`, {
|
|
2656
|
-
method: "POST",
|
|
2657
|
-
headers: {
|
|
2658
|
-
"content-type": "application/json",
|
|
2659
|
-
...options.headers,
|
|
2660
|
-
...options.secret ? { [signatureHeader]: signActivepiecesRuntimeRequest(serialized, options.secret) } : {}
|
|
2661
|
-
},
|
|
2662
|
-
body: serialized,
|
|
2663
|
-
signal: AbortSignal.timeout(options.timeoutMs ?? 3e4)
|
|
2664
|
-
});
|
|
2665
|
-
const parsed = await response.json().catch(() => void 0);
|
|
2666
|
-
if (!response.ok) {
|
|
2667
|
-
return parsed ?? {
|
|
2668
|
-
ok: false,
|
|
2669
|
-
action: invocation.request.action,
|
|
2670
|
-
output: { message: `Activepieces runtime returned HTTP ${response.status}.` }
|
|
2671
|
-
};
|
|
2672
|
-
}
|
|
2673
|
-
return parsed ?? {
|
|
2674
|
-
ok: false,
|
|
2675
|
-
action: invocation.request.action,
|
|
2676
|
-
output: { message: "Activepieces runtime returned an empty response." }
|
|
2677
|
-
};
|
|
2678
|
-
};
|
|
2679
|
-
}
|
|
2680
|
-
function buildActivepiecesRuntimeRequest(invocation, requestId = `apexec_${randomUUID3()}`) {
|
|
2681
|
-
return {
|
|
2682
|
-
version: 1,
|
|
2683
|
-
requestId,
|
|
2684
|
-
providerId: invocation.connection.providerId,
|
|
2685
|
-
connection: invocation.connection,
|
|
2686
|
-
connector: {
|
|
2687
|
-
id: invocation.connector.id,
|
|
2688
|
-
title: invocation.connector.title,
|
|
2689
|
-
auth: invocation.connector.auth,
|
|
2690
|
-
scopes: invocation.connector.scopes,
|
|
2691
|
-
metadata: invocation.connector.metadata
|
|
2692
|
-
},
|
|
2693
|
-
piece: invocation.piece,
|
|
2694
|
-
action: {
|
|
2695
|
-
id: invocation.request.action,
|
|
2696
|
-
input: invocation.request.input,
|
|
2697
|
-
idempotencyKey: invocation.request.idempotencyKey,
|
|
2698
|
-
dryRun: invocation.request.dryRun,
|
|
2699
|
-
metadata: invocation.request.metadata
|
|
2700
|
-
}
|
|
2701
|
-
};
|
|
2702
|
-
}
|
|
2703
|
-
function signActivepiecesRuntimeRequest(serializedBody, secret) {
|
|
2704
|
-
return `sha256=${createHmac("sha256", secret).update(serializedBody).digest("hex")}`;
|
|
2705
|
-
}
|
|
2706
|
-
function verifyActivepiecesRuntimeSignature(serializedBody, signature, secret) {
|
|
2707
|
-
if (!signature) return false;
|
|
2708
|
-
const expected = signActivepiecesRuntimeRequest(serializedBody, secret);
|
|
2709
|
-
const left = Buffer.from(signature);
|
|
2710
|
-
const right = Buffer.from(expected);
|
|
2711
|
-
return left.length === right.length && timingSafeEqual(left, right);
|
|
2712
|
-
}
|
|
2713
|
-
function createTangleCatalogHttpExecutor(options) {
|
|
2714
|
-
const endpoint = options.endpoint.replace(/\/$/, "");
|
|
2715
|
-
const path = options.path ?? "/v1/integration-catalog/actions/invoke";
|
|
2716
|
-
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
2717
|
-
const signatureHeader = options.signatureHeader ?? TANGLE_CATALOG_RUNTIME_SIGNATURE_HEADER;
|
|
2718
|
-
const fetchImpl = options.fetchImpl ?? fetch;
|
|
2719
|
-
const requestId = options.requestId ?? (() => `tcat_${randomUUID3()}`);
|
|
2720
|
-
return async (invocation) => {
|
|
2721
|
-
const body = buildTangleCatalogRuntimeRequest(invocation, requestId());
|
|
2722
|
-
const serialized = JSON.stringify(body);
|
|
2723
|
-
const response = await fetchImpl(`${endpoint}${normalizedPath}`, {
|
|
2724
|
-
method: "POST",
|
|
2725
|
-
headers: {
|
|
2726
|
-
"content-type": "application/json",
|
|
2727
|
-
...options.headers,
|
|
2728
|
-
...options.secret ? { [signatureHeader]: signTangleCatalogRuntimeRequest(serialized, options.secret) } : {}
|
|
2729
|
-
},
|
|
2730
|
-
body: serialized,
|
|
2731
|
-
signal: AbortSignal.timeout(options.timeoutMs ?? 3e4)
|
|
2732
|
-
});
|
|
2733
|
-
const parsed = await response.json().catch(() => void 0);
|
|
2734
|
-
if (!response.ok) {
|
|
2735
|
-
return parsed ?? {
|
|
2736
|
-
ok: false,
|
|
2737
|
-
action: invocation.request.action,
|
|
2738
|
-
output: { message: `Tangle catalog runtime returned HTTP ${response.status}.` }
|
|
2739
|
-
};
|
|
2740
|
-
}
|
|
2741
|
-
return parsed ?? {
|
|
2742
|
-
ok: false,
|
|
2743
|
-
action: invocation.request.action,
|
|
2744
|
-
output: { message: "Tangle catalog runtime returned an empty response." }
|
|
2745
|
-
};
|
|
2746
|
-
};
|
|
2747
|
-
}
|
|
2748
|
-
function buildTangleCatalogRuntimeRequest(invocation, requestId = `tcat_${randomUUID3()}`) {
|
|
2749
|
-
return {
|
|
2750
|
-
version: 1,
|
|
2751
|
-
requestId,
|
|
2752
|
-
providerId: invocation.connection.providerId,
|
|
2753
|
-
connection: invocation.connection,
|
|
2754
|
-
connector: {
|
|
2755
|
-
id: invocation.connector.id,
|
|
2756
|
-
title: invocation.connector.title,
|
|
2757
|
-
auth: invocation.connector.auth,
|
|
2758
|
-
scopes: invocation.connector.scopes,
|
|
2759
|
-
metadata: invocation.connector.metadata
|
|
2760
|
-
},
|
|
2761
|
-
piece: invocation.piece,
|
|
2762
|
-
action: {
|
|
2763
|
-
id: invocation.request.action,
|
|
2764
|
-
input: invocation.request.input,
|
|
2765
|
-
idempotencyKey: invocation.request.idempotencyKey,
|
|
2766
|
-
dryRun: invocation.request.dryRun,
|
|
2767
|
-
metadata: invocation.request.metadata
|
|
2768
|
-
}
|
|
2769
|
-
};
|
|
2770
|
-
}
|
|
2771
|
-
var signTangleCatalogRuntimeRequest = signActivepiecesRuntimeRequest;
|
|
2772
|
-
var verifyTangleCatalogRuntimeSignature = verifyActivepiecesRuntimeSignature;
|
|
2773
|
-
|
|
2774
|
-
// src/tangle-catalog-runtime.ts
|
|
2775
|
-
import { randomUUID as randomUUID4 } from "crypto";
|
|
2776
|
-
function createTangleCatalogRuntimeHandler(options) {
|
|
2777
|
-
const connectors = options.connectors ?? buildTangleIntegrationCatalogConnectors({
|
|
2778
|
-
includeCatalogActions: true,
|
|
2779
|
-
executable: true
|
|
2780
|
-
});
|
|
2781
|
-
const byConnector = new Map(connectors.map((connector) => [connector.id, connector]));
|
|
2782
|
-
const requireSignature = options.requireSignature ?? Boolean(options.secret);
|
|
2783
|
-
const signatureHeader = options.signatureHeader ?? TANGLE_CATALOG_RUNTIME_SIGNATURE_HEADER;
|
|
2784
|
-
const maxBodyBytes = options.maxBodyBytes ?? 1e6;
|
|
2785
|
-
return async function handleTangleCatalogRuntimeRequest(input) {
|
|
2786
|
-
const serialized = serializeBody(input.body);
|
|
2787
|
-
if (Buffer.byteLength(serialized, "utf8") > maxBodyBytes) {
|
|
2788
|
-
return errorResponse(413, "unknown", "payload_too_large", "Tangle catalog runtime request is too large.");
|
|
2789
|
-
}
|
|
2790
|
-
if (requireSignature) {
|
|
2791
|
-
if (!options.secret) {
|
|
2792
|
-
return errorResponse(500, "unknown", "runtime_misconfigured", "Tangle catalog runtime secret is not configured.");
|
|
2793
|
-
}
|
|
2794
|
-
const signature = readHeader(input.headers, signatureHeader);
|
|
2795
|
-
if (!verifyTangleCatalogRuntimeSignature(serialized, signature, options.secret)) {
|
|
2796
|
-
return errorResponse(401, "unknown", "signature_invalid", "Tangle catalog runtime signature is invalid.");
|
|
2797
|
-
}
|
|
2798
|
-
}
|
|
2799
|
-
const parsed = parseRuntimeRequest(serialized);
|
|
2800
|
-
if (!parsed.ok) return parsed.response;
|
|
2801
|
-
const request = parsed.request;
|
|
2802
|
-
if (request.providerId !== request.connection.providerId) {
|
|
2803
|
-
return errorResponse(400, request.action.id, "provider_mismatch", "Request providerId does not match connection providerId.");
|
|
2804
|
-
}
|
|
2805
|
-
const connector = byConnector.get(request.connector.id);
|
|
2806
|
-
if (!connector) {
|
|
2807
|
-
return errorResponse(404, request.action.id, "connector_not_found", `Connector ${request.connector.id} is not in the Tangle catalog runtime.`);
|
|
2808
|
-
}
|
|
2809
|
-
if (request.connection.connectorId !== connector.id) {
|
|
2810
|
-
return errorResponse(400, request.action.id, "connector_mismatch", "Connection connectorId does not match runtime connector.");
|
|
2811
|
-
}
|
|
2812
|
-
if (request.connection.providerId !== connector.providerId) {
|
|
2813
|
-
return errorResponse(400, request.action.id, "provider_mismatch", "Connection providerId does not match runtime connector.");
|
|
2814
|
-
}
|
|
2815
|
-
const action = connector.actions.find((candidate) => candidate.id === request.action.id);
|
|
2816
|
-
if (!action) {
|
|
2817
|
-
return errorResponse(404, request.action.id, "action_not_found", `Action ${request.action.id} is not defined by connector ${connector.id}.`);
|
|
2818
|
-
}
|
|
2819
|
-
const result = await options.executeAction({
|
|
2820
|
-
request,
|
|
2821
|
-
connection: request.connection,
|
|
2822
|
-
connector,
|
|
2823
|
-
action
|
|
2824
|
-
});
|
|
2825
|
-
return {
|
|
2826
|
-
status: result.ok ? 200 : 502,
|
|
2827
|
-
headers: { "content-type": "application/json" },
|
|
2828
|
-
body: result
|
|
2829
|
-
};
|
|
2830
|
-
};
|
|
2831
|
-
}
|
|
2832
|
-
function createTangleCatalogInstalledPackageExecutor(options = {}) {
|
|
2833
|
-
const packageByConnector = new Map(
|
|
2834
|
-
listActivepiecesCatalogEntries().filter((entry) => entry.npmPackage).map((entry) => [entry.id, entry.npmPackage])
|
|
2835
|
-
);
|
|
2836
|
-
const moduleCache = /* @__PURE__ */ new Map();
|
|
2837
|
-
return async (invocation) => {
|
|
2838
|
-
await options.beforeRun?.(invocation);
|
|
2839
|
-
const packageName = packageByConnector.get(invocation.connector.id);
|
|
2840
|
-
if (!packageName) {
|
|
2841
|
-
return runtimeFailure(invocation.action.id, "runtime_not_available", `No installed runtime package is known for connector ${invocation.connector.id}.`);
|
|
2842
|
-
}
|
|
2843
|
-
if (invocation.request.piece.packageName && invocation.request.piece.packageName !== packageName) {
|
|
2844
|
-
return runtimeFailure(
|
|
2845
|
-
invocation.action.id,
|
|
2846
|
-
"runtime_package_mismatch",
|
|
2847
|
-
`Runtime package ${invocation.request.piece.packageName} does not match catalog package ${packageName}.`
|
|
2848
|
-
);
|
|
2849
|
-
}
|
|
2850
|
-
const loaded = await loadRuntimeModule(packageName, options.moduleLoader, moduleCache);
|
|
2851
|
-
if (!loaded.ok) {
|
|
2852
|
-
return runtimeFailure(invocation.action.id, "runtime_not_installed", loaded.message);
|
|
2853
|
-
}
|
|
2854
|
-
const piece = findPieceExport(loaded.module, invocation.connector.id);
|
|
2855
|
-
if (!piece) {
|
|
2856
|
-
return runtimeFailure(invocation.action.id, "runtime_invalid", `Runtime package ${packageName} does not export a recognizable piece for ${invocation.connector.id}.`);
|
|
2857
|
-
}
|
|
2858
|
-
const action = findRuntimeAction(piece, invocation, options.actionAliases, options.allowFuzzyActionMatch ?? false);
|
|
2859
|
-
if (!action?.run) {
|
|
2860
|
-
return runtimeFailure(invocation.action.id, "action_not_implemented", `Runtime package ${packageName} does not expose executable action ${invocation.action.id}.`);
|
|
2861
|
-
}
|
|
2862
|
-
try {
|
|
2863
|
-
const output = await action.run({
|
|
2864
|
-
auth: await options.resolveAuth?.(invocation.connection),
|
|
2865
|
-
propsValue: invocation.request.action.input,
|
|
2866
|
-
input: invocation.request.action.input,
|
|
2867
|
-
connection: invocation.connection,
|
|
2868
|
-
request: invocation.request
|
|
2869
|
-
});
|
|
2870
|
-
return {
|
|
2871
|
-
ok: true,
|
|
2872
|
-
action: invocation.action.id,
|
|
2873
|
-
output
|
|
2874
|
-
};
|
|
2875
|
-
} catch (error) {
|
|
2876
|
-
return runtimeFailure(
|
|
2877
|
-
invocation.action.id,
|
|
2878
|
-
"runtime_action_failed",
|
|
2879
|
-
error instanceof Error ? error.message : "Runtime action failed."
|
|
2880
|
-
);
|
|
2881
|
-
}
|
|
2882
|
-
};
|
|
2883
|
-
}
|
|
2884
|
-
async function auditTangleCatalogRuntimePackages(options = {}) {
|
|
2885
|
-
const only = options.connectorIds ? new Set(options.connectorIds) : void 0;
|
|
2886
|
-
const rows = [];
|
|
2887
|
-
const moduleCache = /* @__PURE__ */ new Map();
|
|
2888
|
-
const entries = listActivepiecesCatalogEntries().filter((entry) => entry.npmPackage && (!only || only.has(entry.id)));
|
|
2889
|
-
for (const entry of entries) {
|
|
2890
|
-
const packageName = entry.npmPackage;
|
|
2891
|
-
const base = {
|
|
2892
|
-
connectorId: entry.id,
|
|
2893
|
-
packageName,
|
|
2894
|
-
actionMappingsTotal: entry.actions.length,
|
|
2895
|
-
triggerMappingsTotal: entry.triggers.length
|
|
2896
|
-
};
|
|
2897
|
-
const loaded = await loadRuntimeModule(packageName, options.moduleLoader, moduleCache);
|
|
2898
|
-
if (!loaded.ok) {
|
|
2899
|
-
rows.push({
|
|
2900
|
-
...base,
|
|
2901
|
-
packageInstalled: false,
|
|
2902
|
-
packageLoads: false,
|
|
2903
|
-
pieceExportFound: false,
|
|
2904
|
-
actionMappingsVerified: 0,
|
|
2905
|
-
triggerMappingsFound: 0,
|
|
2906
|
-
triggerHostingSupported: false,
|
|
2907
|
-
error: loaded.message
|
|
2908
|
-
});
|
|
2909
|
-
continue;
|
|
2910
|
-
}
|
|
2911
|
-
const piece = findPieceExport(loaded.module, entry.id);
|
|
2912
|
-
const actions = piece?.actions ?? [];
|
|
2913
|
-
const triggers = piece?.triggers ?? [];
|
|
2914
|
-
rows.push({
|
|
2915
|
-
...base,
|
|
2916
|
-
packageInstalled: true,
|
|
2917
|
-
packageLoads: true,
|
|
2918
|
-
pieceExportFound: Boolean(piece),
|
|
2919
|
-
actionMappingsVerified: entry.actions.filter((action) => hasRuntimeName(actions, [
|
|
2920
|
-
action.id,
|
|
2921
|
-
action.title,
|
|
2922
|
-
action.upstreamName
|
|
2923
|
-
], entry.id)).length,
|
|
2924
|
-
triggerMappingsFound: entry.triggers.filter((trigger2) => hasRuntimeName(triggers, [
|
|
2925
|
-
trigger2.id,
|
|
2926
|
-
trigger2.title,
|
|
2927
|
-
trigger2.upstreamName
|
|
2928
|
-
], entry.id)).length,
|
|
2929
|
-
triggerHostingSupported: entry.triggers.length === 0 || triggers.length > 0
|
|
2930
|
-
});
|
|
2931
|
-
}
|
|
2932
|
-
return rows;
|
|
2933
|
-
}
|
|
2934
|
-
function createTangleCatalogCredentialAuthResolver(options) {
|
|
2935
|
-
return async function resolveTangleCatalogAuth(connection) {
|
|
2936
|
-
if (!connection.secretRef) return void 0;
|
|
2937
|
-
const credentials = await options.secrets.get(connection.secretRef);
|
|
2938
|
-
if (!credentials) throw new Error(`Secret ${connection.secretRef.provider}/${connection.secretRef.id} not found.`);
|
|
2939
|
-
return options.mapCredentials?.({
|
|
2940
|
-
connection,
|
|
2941
|
-
credentials,
|
|
2942
|
-
connectorId: connection.connectorId
|
|
2943
|
-
}) ?? tangleCatalogAuthValue(credentials);
|
|
2944
|
-
};
|
|
2945
|
-
}
|
|
2946
|
-
function createTangleCatalogHttpAuthResolver(options) {
|
|
2947
|
-
const endpoint = options.endpoint.replace(/\/$/, "");
|
|
2948
|
-
const path = options.path ?? "/v1/integration-catalog/credentials/resolve";
|
|
2949
|
-
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
2950
|
-
const fetchImpl = options.fetchImpl ?? fetch;
|
|
2951
|
-
const requestId = options.requestId ?? (() => `tcat_auth_${randomUUID4()}`);
|
|
2952
|
-
return async function resolveTangleCatalogHttpAuth(connection) {
|
|
2953
|
-
const body = {
|
|
2954
|
-
version: 1,
|
|
2955
|
-
requestId: requestId(),
|
|
2956
|
-
providerId: connection.providerId,
|
|
2957
|
-
connectorId: connection.connectorId,
|
|
2958
|
-
connectionId: connection.id,
|
|
2959
|
-
secretRef: connection.secretRef
|
|
2960
|
-
};
|
|
2961
|
-
const serialized = JSON.stringify(body);
|
|
2962
|
-
const response = await fetchImpl(`${endpoint}${normalizedPath}`, {
|
|
2963
|
-
method: "POST",
|
|
2964
|
-
headers: {
|
|
2965
|
-
"content-type": "application/json",
|
|
2966
|
-
...options.headers,
|
|
2967
|
-
[TANGLE_CATALOG_RUNTIME_SIGNATURE_HEADER]: signTangleCatalogRuntimeRequest(serialized, options.secret)
|
|
2968
|
-
},
|
|
2969
|
-
body: serialized,
|
|
2970
|
-
signal: AbortSignal.timeout(options.timeoutMs ?? 1e4)
|
|
2971
|
-
});
|
|
2972
|
-
const parsed = await response.json().catch(() => void 0);
|
|
2973
|
-
if (!response.ok) {
|
|
2974
|
-
throw new Error(parsed?.error?.message ?? `Credential resolver returned HTTP ${response.status}.`);
|
|
2975
|
-
}
|
|
2976
|
-
if (parsed && "auth" in parsed) return parsed.auth;
|
|
2977
|
-
if (parsed?.credentials) return tangleCatalogAuthValue(parsed.credentials);
|
|
2978
|
-
return void 0;
|
|
2979
|
-
};
|
|
2980
|
-
}
|
|
2981
|
-
function tangleCatalogAuthValue(credentials) {
|
|
2982
|
-
if (credentials.kind === "none") return void 0;
|
|
2983
|
-
if (credentials.kind === "api-key") return credentials.apiKey;
|
|
2984
|
-
if (credentials.kind === "hmac") return credentials.secret;
|
|
2985
|
-
if (credentials.kind === "custom") return credentials.values;
|
|
2986
|
-
return {
|
|
2987
|
-
access_token: credentials.accessToken,
|
|
2988
|
-
refresh_token: credentials.refreshToken,
|
|
2989
|
-
expires_at: credentials.expiresAt
|
|
2990
|
-
};
|
|
2991
|
-
}
|
|
2992
|
-
function serializeBody(body) {
|
|
2993
|
-
if (typeof body === "string") return body;
|
|
2994
|
-
if (body instanceof Uint8Array) return new TextDecoder().decode(body);
|
|
2995
|
-
return JSON.stringify(body);
|
|
2996
|
-
}
|
|
2997
|
-
async function loadRuntimeModule(packageName, moduleLoader, moduleCache) {
|
|
2998
|
-
try {
|
|
2999
|
-
const load = moduleLoader ?? ((name) => import(name));
|
|
3000
|
-
const promise = moduleCache.get(packageName) ?? Promise.resolve(load(packageName));
|
|
3001
|
-
moduleCache.set(packageName, promise);
|
|
3002
|
-
return { ok: true, module: await promise };
|
|
3003
|
-
} catch (error) {
|
|
3004
|
-
return {
|
|
3005
|
-
ok: false,
|
|
3006
|
-
message: error instanceof Error ? `Runtime package ${packageName} could not be loaded: ${error.message}` : `Runtime package ${packageName} could not be loaded.`
|
|
3007
|
-
};
|
|
3008
|
-
}
|
|
3009
|
-
}
|
|
3010
|
-
function findPieceExport(moduleValue, connectorId) {
|
|
3011
|
-
const mod = moduleValue && typeof moduleValue === "object" ? moduleValue : {};
|
|
3012
|
-
const values = [
|
|
3013
|
-
mod.default,
|
|
3014
|
-
mod[camel(connectorId)],
|
|
3015
|
-
mod[connectorId],
|
|
3016
|
-
...Object.values(mod)
|
|
3017
|
-
];
|
|
3018
|
-
for (const value of values) {
|
|
3019
|
-
const resolved = resolvePiece(value);
|
|
3020
|
-
if (resolved) return resolved;
|
|
3021
|
-
}
|
|
3022
|
-
return void 0;
|
|
3023
|
-
}
|
|
3024
|
-
function resolvePiece(value) {
|
|
3025
|
-
if (!value || typeof value !== "object" && typeof value !== "function") return void 0;
|
|
3026
|
-
const candidate = value;
|
|
3027
|
-
const ctorName = candidate.constructor?.name;
|
|
3028
|
-
const looksLikePiece = ctorName === "Piece" || "_actions" in candidate || "_triggers" in candidate || "actions" in candidate || "triggers" in candidate;
|
|
3029
|
-
if (!looksLikePiece) return void 0;
|
|
3030
|
-
const actions = readPieceMembers(candidate, "_actions", "actions");
|
|
3031
|
-
const triggers = readPieceMembers(candidate, "_triggers", "triggers");
|
|
3032
|
-
if (!actions && !triggers) return void 0;
|
|
3033
|
-
return { actions: actions ?? [], triggers: triggers ?? [] };
|
|
3034
|
-
}
|
|
3035
|
-
function readPieceMembers(piece, privateKey, publicKey) {
|
|
3036
|
-
const raw = coerceMemberCollection(piece[privateKey]) ?? coerceMemberCollection(readPublicMember(piece, publicKey));
|
|
3037
|
-
if (!raw) return void 0;
|
|
3038
|
-
return raw.filter((member) => Boolean(member) && typeof member === "object");
|
|
3039
|
-
}
|
|
3040
|
-
function readPublicMember(piece, key) {
|
|
3041
|
-
const value = piece[key];
|
|
3042
|
-
if (typeof value !== "function") return value;
|
|
3043
|
-
try {
|
|
3044
|
-
return value.call(piece);
|
|
3045
|
-
} catch {
|
|
3046
|
-
return void 0;
|
|
3047
|
-
}
|
|
3048
|
-
}
|
|
3049
|
-
function coerceMemberCollection(value) {
|
|
3050
|
-
if (Array.isArray(value)) return value;
|
|
3051
|
-
if (value && typeof value === "object") return Object.values(value);
|
|
3052
|
-
return void 0;
|
|
3053
|
-
}
|
|
3054
|
-
function hasRuntimeName(members, candidates, connectorId) {
|
|
3055
|
-
const expected = normalizeNameSet(candidates, connectorId);
|
|
3056
|
-
return members.some((member) => {
|
|
3057
|
-
const names = normalizeNameSet([member.name, member.displayName], connectorId);
|
|
3058
|
-
for (const name of names) if (expected.has(name)) return true;
|
|
3059
|
-
return false;
|
|
3060
|
-
});
|
|
3061
|
-
}
|
|
3062
|
-
function findRuntimeAction(piece, invocation, aliases = {}, allowFuzzyActionMatch = false) {
|
|
3063
|
-
const actions = piece.actions;
|
|
3064
|
-
const explicit = aliases[invocation.connector.id]?.[invocation.action.id];
|
|
3065
|
-
if (explicit) {
|
|
3066
|
-
const exact = actions.find((action) => action.name === explicit || action.displayName === explicit);
|
|
3067
|
-
if (exact) return exact;
|
|
3068
|
-
}
|
|
3069
|
-
const connectorId = invocation.connector.id;
|
|
3070
|
-
const candidates = normalizeNameSet([
|
|
3071
|
-
invocation.action.id,
|
|
3072
|
-
invocation.action.title,
|
|
3073
|
-
invocation.request.piece.upstreamActionName,
|
|
3074
|
-
explicit
|
|
3075
|
-
], connectorId);
|
|
3076
|
-
for (const action of actions) {
|
|
3077
|
-
const names = normalizeNameSet([action.name, action.displayName], connectorId);
|
|
3078
|
-
for (const name of names) if (candidates.has(name)) return action;
|
|
3079
|
-
}
|
|
3080
|
-
void allowFuzzyActionMatch;
|
|
3081
|
-
return void 0;
|
|
3082
|
-
}
|
|
3083
|
-
function normalizeNameSet(values, connectorId) {
|
|
3084
|
-
const out = /* @__PURE__ */ new Set();
|
|
3085
|
-
const conn = comparable(connectorId);
|
|
3086
|
-
for (const value of values) {
|
|
3087
|
-
if (!value) continue;
|
|
3088
|
-
for (const variant of nameVariants(comparable(value), conn)) {
|
|
3089
|
-
if (variant) out.add(variant);
|
|
3090
|
-
}
|
|
3091
|
-
}
|
|
3092
|
-
return out;
|
|
3093
|
-
}
|
|
3094
|
-
function nameVariants(cmp, conn) {
|
|
3095
|
-
const base = [cmp, cmp.replace(/(action|trigger)$/, "")];
|
|
3096
|
-
const variants = [];
|
|
3097
|
-
for (const value of base) {
|
|
3098
|
-
variants.push(value);
|
|
3099
|
-
if (conn && value.startsWith(conn) && value.length > conn.length) {
|
|
3100
|
-
variants.push(value.slice(conn.length));
|
|
3101
|
-
}
|
|
3102
|
-
}
|
|
3103
|
-
return variants;
|
|
3104
|
-
}
|
|
3105
|
-
function runtimeFailure(action, code, message) {
|
|
3106
|
-
return {
|
|
3107
|
-
ok: false,
|
|
3108
|
-
action,
|
|
3109
|
-
output: { code, message }
|
|
3110
|
-
};
|
|
3111
|
-
}
|
|
3112
|
-
function comparable(value) {
|
|
3113
|
-
return value.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
3114
|
-
}
|
|
3115
|
-
function camel(value) {
|
|
3116
|
-
return value.replace(/[-_.]+([a-z0-9])/g, (_, char) => char.toUpperCase());
|
|
3117
|
-
}
|
|
3118
|
-
function parseRuntimeRequest(serialized) {
|
|
3119
|
-
try {
|
|
3120
|
-
const request = JSON.parse(serialized);
|
|
3121
|
-
if (request.version !== 1) {
|
|
3122
|
-
return { ok: false, response: errorResponse(400, request.action?.id ?? "unknown", "version_invalid", "Unsupported Tangle catalog runtime request version.") };
|
|
3123
|
-
}
|
|
3124
|
-
if (!request.connection || !request.connector || !request.action?.id) {
|
|
3125
|
-
return { ok: false, response: errorResponse(400, request.action?.id ?? "unknown", "request_invalid", "Tangle catalog runtime request is missing required fields.") };
|
|
3126
|
-
}
|
|
3127
|
-
return { ok: true, request };
|
|
3128
|
-
} catch {
|
|
3129
|
-
return { ok: false, response: errorResponse(400, "unknown", "json_invalid", "Tangle catalog runtime request body is not valid JSON.") };
|
|
3130
|
-
}
|
|
3131
|
-
}
|
|
3132
|
-
function readHeader(headers, name) {
|
|
3133
|
-
if (!headers) return void 0;
|
|
3134
|
-
if (headers instanceof Headers) return headers.get(name) ?? void 0;
|
|
3135
|
-
const wanted = name.toLowerCase();
|
|
3136
|
-
for (const [key, value] of Object.entries(headers)) {
|
|
3137
|
-
if (key.toLowerCase() !== wanted) continue;
|
|
3138
|
-
if (Array.isArray(value)) return value[0];
|
|
3139
|
-
return value;
|
|
3140
|
-
}
|
|
3141
|
-
return void 0;
|
|
3142
|
-
}
|
|
3143
|
-
function errorResponse(status, action, code, message) {
|
|
3144
|
-
return {
|
|
3145
|
-
status,
|
|
3146
|
-
headers: { "content-type": "application/json" },
|
|
3147
|
-
body: {
|
|
3148
|
-
ok: false,
|
|
3149
|
-
action,
|
|
3150
|
-
output: { code, message }
|
|
3151
|
-
}
|
|
3152
|
-
};
|
|
3153
|
-
}
|
|
3154
|
-
|
|
3155
|
-
// src/tangle-catalog-runtime-server.ts
|
|
3156
|
-
import { createServer } from "http";
|
|
3157
|
-
function createTangleCatalogRuntimeNodeRequestListener(options) {
|
|
3158
|
-
const path = options.path ?? "/v1/integration-catalog/actions/invoke";
|
|
3159
|
-
const maxBodyBytes = options.maxBodyBytes ?? 1e6;
|
|
3160
|
-
const resolveAuth = options.executor?.resolveAuth ?? (options.authResolver ? createTangleCatalogHttpAuthResolver(options.authResolver) : void 0);
|
|
3161
|
-
const runtime = createTangleCatalogRuntimeHandler({
|
|
3162
|
-
secret: options.secret,
|
|
3163
|
-
requireSignature: options.requireSignature,
|
|
3164
|
-
maxBodyBytes,
|
|
3165
|
-
executeAction: createTangleCatalogInstalledPackageExecutor({
|
|
3166
|
-
...options.executor,
|
|
3167
|
-
resolveAuth
|
|
3168
|
-
})
|
|
3169
|
-
});
|
|
3170
|
-
return async function tangleCatalogRuntimeNodeRequestListener(request, response) {
|
|
3171
|
-
try {
|
|
3172
|
-
const url = new URL(request.url ?? "/", "http://localhost");
|
|
3173
|
-
if (request.method === "GET" && url.pathname === "/health") {
|
|
3174
|
-
writeJson(response, 200, { ok: true });
|
|
3175
|
-
return;
|
|
3176
|
-
}
|
|
3177
|
-
if (request.method !== "POST" || url.pathname !== path) {
|
|
3178
|
-
writeJson(response, 404, {
|
|
3179
|
-
ok: false,
|
|
3180
|
-
error: { code: "not_found", message: "Tangle catalog runtime route not found." }
|
|
3181
|
-
});
|
|
3182
|
-
return;
|
|
3183
|
-
}
|
|
3184
|
-
const body = await readBody(request, maxBodyBytes);
|
|
3185
|
-
const result = await runtime({
|
|
3186
|
-
body,
|
|
3187
|
-
headers: request.headers
|
|
3188
|
-
});
|
|
3189
|
-
writeJson(response, result.status, result.body, result.headers);
|
|
3190
|
-
} catch (error) {
|
|
3191
|
-
const message = error instanceof Error ? error.message : "Tangle catalog runtime request failed.";
|
|
3192
|
-
options.onLog?.({ level: "error", message });
|
|
3193
|
-
writeJson(response, message === "payload_too_large" ? 413 : 500, {
|
|
3194
|
-
ok: false,
|
|
3195
|
-
action: "unknown",
|
|
3196
|
-
output: {
|
|
3197
|
-
code: message === "payload_too_large" ? "payload_too_large" : "runtime_request_failed",
|
|
3198
|
-
message: message === "payload_too_large" ? "Tangle catalog runtime request is too large." : message
|
|
3199
|
-
}
|
|
3200
|
-
});
|
|
3201
|
-
}
|
|
3202
|
-
};
|
|
3203
|
-
}
|
|
3204
|
-
async function startTangleCatalogRuntimeNodeServer(options) {
|
|
3205
|
-
const host = options.host ?? "0.0.0.0";
|
|
3206
|
-
const port = options.port ?? 4109;
|
|
3207
|
-
const listener = createTangleCatalogRuntimeNodeRequestListener(options);
|
|
3208
|
-
const server = createServer(listener);
|
|
3209
|
-
await new Promise((resolve2, reject) => {
|
|
3210
|
-
server.once("error", reject);
|
|
3211
|
-
server.listen(port, host, () => {
|
|
3212
|
-
server.off("error", reject);
|
|
3213
|
-
resolve2();
|
|
3214
|
-
});
|
|
3215
|
-
});
|
|
3216
|
-
const address = server.address();
|
|
3217
|
-
const actualPort = typeof address === "object" && address ? address.port : port;
|
|
3218
|
-
const urlHost = host === "0.0.0.0" ? "127.0.0.1" : host;
|
|
3219
|
-
return {
|
|
3220
|
-
server,
|
|
3221
|
-
url: `http://${urlHost}:${actualPort}`,
|
|
3222
|
-
close: () => new Promise((resolve2, reject) => {
|
|
3223
|
-
server.close((error) => {
|
|
3224
|
-
if (error) reject(error);
|
|
3225
|
-
else resolve2();
|
|
3226
|
-
});
|
|
3227
|
-
})
|
|
3228
|
-
};
|
|
3229
|
-
}
|
|
3230
|
-
function readBody(request, maxBodyBytes) {
|
|
3231
|
-
return new Promise((resolve2, reject) => {
|
|
3232
|
-
const chunks = [];
|
|
3233
|
-
let bytes = 0;
|
|
3234
|
-
request.on("data", (chunk) => {
|
|
3235
|
-
bytes += chunk.byteLength;
|
|
3236
|
-
if (bytes > maxBodyBytes) {
|
|
3237
|
-
reject(new Error("payload_too_large"));
|
|
3238
|
-
request.destroy();
|
|
3239
|
-
return;
|
|
3240
|
-
}
|
|
3241
|
-
chunks.push(chunk);
|
|
3242
|
-
});
|
|
3243
|
-
request.on("end", () => resolve2(Buffer.concat(chunks).toString("utf8")));
|
|
3244
|
-
request.on("error", reject);
|
|
3245
|
-
});
|
|
3246
|
-
}
|
|
3247
|
-
function writeJson(response, status, body, headers = {}) {
|
|
3248
|
-
response.writeHead(status, {
|
|
3249
|
-
"content-type": "application/json",
|
|
3250
|
-
...headers
|
|
3251
|
-
});
|
|
3252
|
-
response.end(JSON.stringify(body));
|
|
3253
|
-
}
|
|
3254
|
-
|
|
3255
2657
|
// src/catalog-freshness.ts
|
|
3256
2658
|
var ACTIVEPIECES_PUBLIC_CATALOG_URL = "https://www.activepieces.com/pieces";
|
|
3257
2659
|
function parseCount(value) {
|
|
@@ -3819,7 +3221,7 @@ var IntegrationHub = class {
|
|
|
3819
3221
|
assertScopes(connection, request.scopes);
|
|
3820
3222
|
const now = this.now();
|
|
3821
3223
|
const capability = {
|
|
3822
|
-
id: `cap_${
|
|
3224
|
+
id: `cap_${randomUUID3()}`,
|
|
3823
3225
|
subject: request.subject,
|
|
3824
3226
|
connectionId: request.connectionId,
|
|
3825
3227
|
scopes: unique6(request.scopes),
|
|
@@ -4057,12 +3459,12 @@ function assertScopes(connection, requiredScopes2) {
|
|
|
4057
3459
|
if (missing2.length > 0) throw new IntegrationError(`Missing integration scopes: ${missing2.join(", ")}`, "scope_denied");
|
|
4058
3460
|
}
|
|
4059
3461
|
function hmac(payload, secret) {
|
|
4060
|
-
return
|
|
3462
|
+
return createHmac("sha256", secret).update(payload).digest("base64url");
|
|
4061
3463
|
}
|
|
4062
3464
|
function constantTimeEqual(a, b) {
|
|
4063
3465
|
const left = Buffer.from(a);
|
|
4064
3466
|
const right = Buffer.from(b);
|
|
4065
|
-
return left.length === right.length &&
|
|
3467
|
+
return left.length === right.length && timingSafeEqual(left, right);
|
|
4066
3468
|
}
|
|
4067
3469
|
function base64UrlEncode2(value) {
|
|
4068
3470
|
return Buffer.from(value, "utf8").toString("base64url");
|
|
@@ -4116,30 +3518,27 @@ function createCatalogExecutorProvider(options) {
|
|
|
4116
3518
|
// src/tangle-catalog.ts
|
|
4117
3519
|
var TANGLE_INTEGRATIONS_CATALOG_PROVIDER_ID = "tangle-catalog";
|
|
4118
3520
|
var TANGLE_INTEGRATIONS_CATALOG_SOURCE = "tangle-integrations-catalog";
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
"airtable",
|
|
4134
|
-
"asana",
|
|
4135
|
-
"salesforce"
|
|
4136
|
-
]);
|
|
3521
|
+
function listTangleNativeAdapterIds() {
|
|
3522
|
+
const ids = /* @__PURE__ */ new Set();
|
|
3523
|
+
for (const value of Object.values(adapters_exports)) {
|
|
3524
|
+
if (isConnectorAdapter(value)) {
|
|
3525
|
+
ids.add(value.manifest.kind);
|
|
3526
|
+
}
|
|
3527
|
+
}
|
|
3528
|
+
return [...ids].sort();
|
|
3529
|
+
}
|
|
3530
|
+
function isConnectorAdapter(value) {
|
|
3531
|
+
return Boolean(
|
|
3532
|
+
value && typeof value === "object" && "manifest" in value && value.manifest && typeof value.manifest.kind === "string"
|
|
3533
|
+
);
|
|
3534
|
+
}
|
|
4137
3535
|
function listTangleIntegrationCatalogEntries() {
|
|
4138
3536
|
return listActivepiecesCatalogEntries().map((entry) => sanitizeEntry(entry));
|
|
4139
3537
|
}
|
|
4140
3538
|
function listTangleIntegrationContracts() {
|
|
3539
|
+
const nativeAdapterIds = new Set(listTangleNativeAdapterIds());
|
|
4141
3540
|
return listActivepiecesCatalogEntries().map((entry) => {
|
|
4142
|
-
const nativeAdapter =
|
|
3541
|
+
const nativeAdapter = nativeAdapterIds.has(entry.id);
|
|
4143
3542
|
return {
|
|
4144
3543
|
id: entry.id,
|
|
4145
3544
|
title: entry.title,
|
|
@@ -4176,7 +3575,8 @@ function listTangleIntegrationContracts() {
|
|
|
4176
3575
|
});
|
|
4177
3576
|
}
|
|
4178
3577
|
function listTangleIntegrationCatalogRuntimePackages() {
|
|
4179
|
-
|
|
3578
|
+
const nativeAdapterIds = new Set(listTangleNativeAdapterIds());
|
|
3579
|
+
return listActivepiecesCatalogEntries().filter((entry) => Boolean(entry.npmPackage) && !nativeAdapterIds.has(entry.id)).map((entry) => ({
|
|
4180
3580
|
connectorId: entry.id,
|
|
4181
3581
|
packageName: entry.npmPackage,
|
|
4182
3582
|
version: entry.version
|
|
@@ -4341,7 +3741,7 @@ function sanitizeConnector(connector, providerId) {
|
|
|
4341
3741
|
source: TANGLE_INTEGRATIONS_CATALOG_SOURCE,
|
|
4342
3742
|
providerId,
|
|
4343
3743
|
executable: metadata.executable,
|
|
4344
|
-
runtime: "
|
|
3744
|
+
runtime: "native-adapter-backlog",
|
|
4345
3745
|
catalogOnly: metadata.catalogOnly,
|
|
4346
3746
|
supportTier: metadata.supportTier,
|
|
4347
3747
|
catalogActionCount: metadata.catalogActionCount,
|
|
@@ -4403,7 +3803,7 @@ function buildDefaultIntegrationRegistry(options = {}) {
|
|
|
4403
3803
|
source: "tangle-integrations-catalog",
|
|
4404
3804
|
providerId: "tangle-catalog",
|
|
4405
3805
|
executable: connector.metadata?.executable,
|
|
4406
|
-
runtime: "
|
|
3806
|
+
runtime: "native-adapter-backlog",
|
|
4407
3807
|
catalogOnly: connector.metadata?.catalogOnly,
|
|
4408
3808
|
supportTier: connector.metadata?.supportTier,
|
|
4409
3809
|
catalogActionCount: connector.metadata?.catalogActionCount,
|
|
@@ -4798,18 +4198,9 @@ export {
|
|
|
4798
4198
|
ACTIVEPIECES_PUBLIC_CATALOG_URL,
|
|
4799
4199
|
extractActivepiecesPublicPieceCount,
|
|
4800
4200
|
auditIntegrationCatalogFreshness,
|
|
4801
|
-
ACTIVEPIECES_RUNTIME_SIGNATURE_HEADER,
|
|
4802
|
-
TANGLE_CATALOG_RUNTIME_SIGNATURE_HEADER,
|
|
4803
|
-
createActivepiecesHttpExecutor,
|
|
4804
|
-
buildActivepiecesRuntimeRequest,
|
|
4805
|
-
signActivepiecesRuntimeRequest,
|
|
4806
|
-
verifyActivepiecesRuntimeSignature,
|
|
4807
|
-
createTangleCatalogHttpExecutor,
|
|
4808
|
-
buildTangleCatalogRuntimeRequest,
|
|
4809
|
-
signTangleCatalogRuntimeRequest,
|
|
4810
|
-
verifyTangleCatalogRuntimeSignature,
|
|
4811
4201
|
TANGLE_INTEGRATIONS_CATALOG_PROVIDER_ID,
|
|
4812
4202
|
TANGLE_INTEGRATIONS_CATALOG_SOURCE,
|
|
4203
|
+
listTangleNativeAdapterIds,
|
|
4813
4204
|
listTangleIntegrationCatalogEntries,
|
|
4814
4205
|
listTangleIntegrationContracts,
|
|
4815
4206
|
listTangleIntegrationCatalogRuntimePackages,
|
|
@@ -4897,14 +4288,6 @@ export {
|
|
|
4897
4288
|
importMcpConnector,
|
|
4898
4289
|
createGatewayCatalogProvider,
|
|
4899
4290
|
normalizeGatewayCatalog,
|
|
4900
|
-
createTangleCatalogRuntimeHandler,
|
|
4901
|
-
createTangleCatalogInstalledPackageExecutor,
|
|
4902
|
-
auditTangleCatalogRuntimePackages,
|
|
4903
|
-
createTangleCatalogCredentialAuthResolver,
|
|
4904
|
-
createTangleCatalogHttpAuthResolver,
|
|
4905
|
-
tangleCatalogAuthValue,
|
|
4906
|
-
createTangleCatalogRuntimeNodeRequestListener,
|
|
4907
|
-
startTangleCatalogRuntimeNodeServer,
|
|
4908
4291
|
InMemoryIntegrationGrantStore,
|
|
4909
4292
|
IntegrationRuntime,
|
|
4910
4293
|
createIntegrationRuntime,
|
|
@@ -4919,4 +4302,4 @@ export {
|
|
|
4919
4302
|
signCapability,
|
|
4920
4303
|
verifyCapabilityToken
|
|
4921
4304
|
};
|
|
4922
|
-
//# sourceMappingURL=chunk-
|
|
4305
|
+
//# sourceMappingURL=chunk-C4CGT5JE.js.map
|