@tangle-network/agent-integrations 0.32.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/tangle-catalog-runtime.js +7 -7
- package/dist/catalog.d.ts +74 -8
- package/dist/catalog.js +7 -7
- package/dist/{chunk-JCHD6L3B.js → chunk-43VQSANC.js} +2 -2
- package/dist/{chunk-F4YILONK.js → chunk-6N23S4JY.js} +21530 -257
- package/dist/chunk-6N23S4JY.js.map +1 -0
- package/dist/{chunk-VVC7U7W7.js → chunk-7T5YTVER.js} +51 -2
- package/dist/chunk-7T5YTVER.js.map +1 -0
- package/dist/{chunk-Q5X3QNHR.js → chunk-NQ7OPDUM.js} +261 -1
- package/dist/chunk-NQ7OPDUM.js.map +1 -0
- package/dist/{chunk-S2MVWQYL.js → chunk-RF3RH374.js} +2 -2
- package/dist/{chunk-DN6DNPPH.js → chunk-XO2RSS6Y.js} +125 -11
- package/dist/chunk-XO2RSS6Y.js.map +1 -0
- package/dist/{chunk-CDY2ETYT.js → chunk-YPZORI3G.js} +2 -2
- package/dist/connect/index.d.ts +2 -1
- package/dist/connect/index.js +2 -2
- package/dist/connectors/adapters/index.d.ts +113 -25
- package/dist/connectors/adapters/index.js +4 -2
- package/dist/connectors/index.d.ts +3 -2
- package/dist/connectors/index.js +4 -2
- package/dist/consumer-CzJgntej.d.ts +292 -0
- package/dist/consumer.d.ts +6 -8
- package/dist/consumer.js +2 -2
- package/dist/core-types-D5Dc65Ud.d.ts +355 -0
- package/dist/index.d.ts +1282 -4
- package/dist/index.js +13 -7
- package/dist/middleware/index.d.ts +2 -1
- package/dist/middleware/index.js +2 -2
- package/dist/registry.d.ts +3 -2424
- package/dist/registry.js +7 -7
- package/dist/runtime.d.ts +137 -8
- package/dist/runtime.js +7 -7
- package/dist/specs.d.ts +208 -8
- package/dist/specs.js +1 -1
- package/dist/tangle-catalog-runtime-2HddXxoM.d.ts +242 -0
- package/dist/tangle-catalog-runtime.d.ts +3 -8
- package/dist/tangle-catalog-runtime.js +7 -7
- package/dist/tangle-id-DA_qj-O_.d.ts +192 -0
- package/dist/{tangle-id-Dj0ipP4E.d.ts → types-XdpvaIzW.d.ts} +1 -167
- package/docs/integration-execution-audit.md +7 -5
- package/docs/integration-execution-matrix.json +32 -0
- package/package.json +12 -10
- package/dist/chunk-DN6DNPPH.js.map +0 -1
- package/dist/chunk-F4YILONK.js.map +0 -1
- package/dist/chunk-Q5X3QNHR.js.map +0 -1
- package/dist/chunk-VVC7U7W7.js.map +0 -1
- /package/dist/{chunk-JCHD6L3B.js.map → chunk-43VQSANC.js.map} +0 -0
- /package/dist/{chunk-S2MVWQYL.js.map → chunk-RF3RH374.js.map} +0 -0
- /package/dist/{chunk-CDY2ETYT.js.map → chunk-YPZORI3G.js.map} +0 -0
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
integrationSpecToConnector,
|
|
7
7
|
listIntegrationSpecs
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-7T5YTVER.js";
|
|
9
9
|
|
|
10
10
|
// src/activepieces-catalog.ts
|
|
11
11
|
import { readFileSync } from "fs";
|
|
@@ -201,6 +201,16 @@ function dataClassFor(category) {
|
|
|
201
201
|
// src/index.ts
|
|
202
202
|
import { createHmac as createHmac2, randomUUID as randomUUID5, timingSafeEqual as timingSafeEqual2 } from "crypto";
|
|
203
203
|
|
|
204
|
+
// src/core-error.ts
|
|
205
|
+
var IntegrationError = class extends Error {
|
|
206
|
+
constructor(message, code) {
|
|
207
|
+
super(message);
|
|
208
|
+
this.code = code;
|
|
209
|
+
this.name = "IntegrationError";
|
|
210
|
+
}
|
|
211
|
+
code;
|
|
212
|
+
};
|
|
213
|
+
|
|
204
214
|
// src/adapter-provider.ts
|
|
205
215
|
function createConnectorAdapterProvider(options) {
|
|
206
216
|
const providerId = options.id ?? "first-party";
|
|
@@ -1186,6 +1196,116 @@ function assertBridgePayload(value) {
|
|
|
1186
1196
|
if (!Array.isArray(payload.tools)) throw new Error("Invalid integration bridge tools.");
|
|
1187
1197
|
}
|
|
1188
1198
|
|
|
1199
|
+
// src/apps.ts
|
|
1200
|
+
var TangleAppsClient = class {
|
|
1201
|
+
endpoint;
|
|
1202
|
+
fetchImpl;
|
|
1203
|
+
constructor(options) {
|
|
1204
|
+
this.endpoint = options.endpoint.replace(/\/$/, "");
|
|
1205
|
+
this.fetchImpl = options.fetchImpl ?? fetch;
|
|
1206
|
+
}
|
|
1207
|
+
/**
|
|
1208
|
+
* Register a product as an app (ONE-TIME, with the owner's bearer — a Tangle
|
|
1209
|
+
* session or `sk-tan-*` key). Returns the client_id + the once-shown
|
|
1210
|
+
* client_secret; persist the secret immediately (never retrievable again).
|
|
1211
|
+
*/
|
|
1212
|
+
async registerApp(input, ownerBearer) {
|
|
1213
|
+
const data = await this.request(
|
|
1214
|
+
"POST",
|
|
1215
|
+
"/v1/apps",
|
|
1216
|
+
input,
|
|
1217
|
+
ownerBearer
|
|
1218
|
+
);
|
|
1219
|
+
return { ...data.app, clientSecret: data.clientSecret };
|
|
1220
|
+
}
|
|
1221
|
+
/** List the caller's registered apps (no secrets). */
|
|
1222
|
+
async listApps(ownerBearer) {
|
|
1223
|
+
const data = await this.request("GET", "/v1/apps", void 0, ownerBearer);
|
|
1224
|
+
return data.apps ?? [];
|
|
1225
|
+
}
|
|
1226
|
+
/** Revoke an app and cascade-kill its grants + tokens. */
|
|
1227
|
+
revokeApp(appId, ownerBearer) {
|
|
1228
|
+
return this.request("POST", `/v1/apps/${encodeURIComponent(appId)}/revoke`, {}, ownerBearer);
|
|
1229
|
+
}
|
|
1230
|
+
/**
|
|
1231
|
+
* Durable re-mint: mint a fresh single-use `sk-tan-broker-` token against an
|
|
1232
|
+
* existing consented grant using ONLY the app credentials — no user session,
|
|
1233
|
+
* no `agc_` code. The runtime path: one call per `/v1/hub/exec`.
|
|
1234
|
+
*/
|
|
1235
|
+
async mintBrokerToken(input) {
|
|
1236
|
+
const data = await this.request(
|
|
1237
|
+
"POST",
|
|
1238
|
+
`/v1/apps/grants/${encodeURIComponent(input.grantId)}/mint-broker-token`,
|
|
1239
|
+
{
|
|
1240
|
+
client_id: input.clientId,
|
|
1241
|
+
client_secret: input.clientSecret,
|
|
1242
|
+
grant_id: input.grantId,
|
|
1243
|
+
...input.ttlSeconds ? { ttl_seconds: input.ttlSeconds } : {}
|
|
1244
|
+
}
|
|
1245
|
+
);
|
|
1246
|
+
return toBrokerToken(data);
|
|
1247
|
+
}
|
|
1248
|
+
/**
|
|
1249
|
+
* Exchange an `agc_` authorization code (from the user's one-time consent)
|
|
1250
|
+
* for the first broker token + the durable grant. Use on the consent
|
|
1251
|
+
* callback; afterward `mintBrokerToken` is enough.
|
|
1252
|
+
*/
|
|
1253
|
+
async exchangeAuthCode(input) {
|
|
1254
|
+
const data = await this.request("POST", "/v1/apps/oauth/token", {
|
|
1255
|
+
grant_type: "authorization_code",
|
|
1256
|
+
client_id: input.clientId,
|
|
1257
|
+
client_secret: input.clientSecret,
|
|
1258
|
+
code: input.code,
|
|
1259
|
+
redirect_uri: input.redirectUri,
|
|
1260
|
+
...input.connectionId ? { connection_id: input.connectionId } : {}
|
|
1261
|
+
});
|
|
1262
|
+
return toBrokerToken(data);
|
|
1263
|
+
}
|
|
1264
|
+
async request(method, path, body, bearer) {
|
|
1265
|
+
try {
|
|
1266
|
+
const headers = { accept: "application/json" };
|
|
1267
|
+
if (bearer) headers.authorization = `Bearer ${bearer}`;
|
|
1268
|
+
if (body !== void 0) headers["content-type"] = "application/json";
|
|
1269
|
+
const response = await this.fetchImpl(`${this.endpoint}${path}`, {
|
|
1270
|
+
method,
|
|
1271
|
+
headers,
|
|
1272
|
+
body: body !== void 0 ? JSON.stringify(body) : void 0
|
|
1273
|
+
});
|
|
1274
|
+
const json = await response.json().catch(() => void 0);
|
|
1275
|
+
if (!response.ok || json && json.success === false) {
|
|
1276
|
+
const platformCode = json?.error && typeof json.error === "object" ? json.error.code : void 0;
|
|
1277
|
+
const message = json?.error && typeof json.error === "object" && json.error.message || (typeof json?.error === "string" ? json.error : `Tangle apps request failed (HTTP ${response.status})`);
|
|
1278
|
+
throw new IntegrationRuntimeError({
|
|
1279
|
+
code: platformCode === "BROKER_DISABLED" ? "passthrough_disabled" : "unknown",
|
|
1280
|
+
message,
|
|
1281
|
+
status: response.status,
|
|
1282
|
+
metadata: { platformCode, path }
|
|
1283
|
+
});
|
|
1284
|
+
}
|
|
1285
|
+
return (json && "data" in json ? json.data : json) ?? {};
|
|
1286
|
+
} catch (error) {
|
|
1287
|
+
if (error instanceof IntegrationRuntimeError) throw error;
|
|
1288
|
+
const normalized = normalizeIntegrationError(error);
|
|
1289
|
+
throw new IntegrationRuntimeError({
|
|
1290
|
+
code: normalized.code,
|
|
1291
|
+
message: normalized.message,
|
|
1292
|
+
metadata: { path, userAction: normalized.userAction }
|
|
1293
|
+
});
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
};
|
|
1297
|
+
function createTangleAppsClient(options) {
|
|
1298
|
+
return new TangleAppsClient(options);
|
|
1299
|
+
}
|
|
1300
|
+
function toBrokerToken(data) {
|
|
1301
|
+
return {
|
|
1302
|
+
accessToken: data.access_token,
|
|
1303
|
+
expiresIn: data.expires_in,
|
|
1304
|
+
scope: data.scope,
|
|
1305
|
+
connectionId: data.connection_id
|
|
1306
|
+
};
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1189
1309
|
// src/client.ts
|
|
1190
1310
|
var TangleIntegrationsClient = class {
|
|
1191
1311
|
endpoint;
|
|
@@ -3592,14 +3712,6 @@ function sameActor2(a, b) {
|
|
|
3592
3712
|
}
|
|
3593
3713
|
|
|
3594
3714
|
// src/index.ts
|
|
3595
|
-
var IntegrationError = class extends Error {
|
|
3596
|
-
constructor(message, code) {
|
|
3597
|
-
super(message);
|
|
3598
|
-
this.code = code;
|
|
3599
|
-
this.name = "IntegrationError";
|
|
3600
|
-
}
|
|
3601
|
-
code;
|
|
3602
|
-
};
|
|
3603
3715
|
var InMemoryConnectionStore = class {
|
|
3604
3716
|
connections = /* @__PURE__ */ new Map();
|
|
3605
3717
|
get(connectionId) {
|
|
@@ -4713,6 +4825,7 @@ export {
|
|
|
4713
4825
|
summarizeIntegrationRegistry,
|
|
4714
4826
|
canonicalConnectorId,
|
|
4715
4827
|
inferIntegrationSupportTier,
|
|
4828
|
+
IntegrationError,
|
|
4716
4829
|
createConnectorAdapterProvider,
|
|
4717
4830
|
adapterManifestsToConnectors,
|
|
4718
4831
|
createConnectorAdapterCatalogSource,
|
|
@@ -4741,6 +4854,8 @@ export {
|
|
|
4741
4854
|
buildIntegrationBridgeEnvironment,
|
|
4742
4855
|
parseIntegrationBridgeEnvironment,
|
|
4743
4856
|
redactIntegrationBridgePayload,
|
|
4857
|
+
TangleAppsClient,
|
|
4858
|
+
createTangleAppsClient,
|
|
4744
4859
|
TangleIntegrationsClient,
|
|
4745
4860
|
createTangleIntegrationsClient,
|
|
4746
4861
|
renderConsentSummary,
|
|
@@ -4796,7 +4911,6 @@ export {
|
|
|
4796
4911
|
InMemoryIntegrationWorkflowStore,
|
|
4797
4912
|
IntegrationWorkflowRuntime,
|
|
4798
4913
|
createIntegrationWorkflowRuntime,
|
|
4799
|
-
IntegrationError,
|
|
4800
4914
|
InMemoryConnectionStore,
|
|
4801
4915
|
IntegrationHub,
|
|
4802
4916
|
sanitizeConnection,
|
|
@@ -4805,4 +4919,4 @@ export {
|
|
|
4805
4919
|
signCapability,
|
|
4806
4920
|
verifyCapabilityToken
|
|
4807
4921
|
};
|
|
4808
|
-
//# sourceMappingURL=chunk-
|
|
4922
|
+
//# sourceMappingURL=chunk-XO2RSS6Y.js.map
|