@tangle-network/agent-integrations 0.27.0 → 0.29.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/README.md +40 -0
- package/dist/bin/tangle-catalog-runtime.js +4 -2
- package/dist/bin/tangle-catalog-runtime.js.map +1 -1
- package/dist/catalog.d.ts +1 -0
- package/dist/catalog.js +4 -2
- package/dist/chunk-H4XYLS7T.js +75 -0
- package/dist/chunk-H4XYLS7T.js.map +1 -0
- package/dist/{chunk-ICSBYCE2.js → chunk-TUX6MJJ4.js} +15 -83
- package/dist/chunk-TUX6MJJ4.js.map +1 -0
- package/dist/chunk-YOKNZY2N.js +284 -0
- package/dist/chunk-YOKNZY2N.js.map +1 -0
- package/dist/consumer.d.ts +8 -0
- package/dist/consumer.js +12 -0
- package/dist/consumer.js.map +1 -0
- package/dist/errors-Bg3_rxnQ.d.ts +32 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +20 -10
- package/dist/registry.d.ts +241 -77
- package/dist/registry.js +4 -2
- package/dist/router-BncoovUh.d.ts +149 -0
- package/dist/runtime.d.ts +1 -0
- package/dist/runtime.js +4 -2
- package/dist/specs.d.ts +2 -1
- package/dist/stripe/index.d.ts +812 -0
- package/dist/stripe/index.js +866 -0
- package/dist/stripe/index.js.map +1 -0
- package/dist/tangle-catalog-runtime.d.ts +2 -1
- package/dist/tangle-catalog-runtime.js +4 -2
- package/dist/webhooks/index.d.ts +3 -148
- package/package.json +22 -10
- package/dist/chunk-ICSBYCE2.js.map +0 -1
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_TANGLE_PLATFORM_URL
|
|
3
|
+
} from "./chunk-ATYHZXLL.js";
|
|
4
|
+
|
|
5
|
+
// src/consumer.ts
|
|
6
|
+
var PLATFORM_USER_ID_PATTERN = /^[A-Za-z0-9_-]{1,128}$/;
|
|
7
|
+
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
8
|
+
var DEFAULT_MAX_ATTEMPTS = 2;
|
|
9
|
+
var RETRYABLE_STATUSES = /* @__PURE__ */ new Set([502, 503, 504]);
|
|
10
|
+
var IntegrationHubRequestError = class extends Error {
|
|
11
|
+
name = "IntegrationHubRequestError";
|
|
12
|
+
/** HTTP status, or 0 for a network-level failure. */
|
|
13
|
+
status;
|
|
14
|
+
/** Platform error code (`VALIDATION_ERROR`, `scope_missing`, …) or
|
|
15
|
+
* `network_error` / `http_error` when no structured code was returned. */
|
|
16
|
+
code;
|
|
17
|
+
/** `METHOD /path` the request targeted. */
|
|
18
|
+
endpoint;
|
|
19
|
+
/** True when the failure class is transient and a retry could succeed. */
|
|
20
|
+
retryable;
|
|
21
|
+
constructor(input) {
|
|
22
|
+
super(input.message);
|
|
23
|
+
this.status = input.status;
|
|
24
|
+
this.code = input.code;
|
|
25
|
+
this.endpoint = input.endpoint;
|
|
26
|
+
this.retryable = input.retryable;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var IntegrationHubClient = class {
|
|
30
|
+
endpoint;
|
|
31
|
+
product;
|
|
32
|
+
auth;
|
|
33
|
+
fetchImpl;
|
|
34
|
+
timeoutMs;
|
|
35
|
+
maxAttempts;
|
|
36
|
+
constructor(options) {
|
|
37
|
+
if (!options.product) {
|
|
38
|
+
throw new Error("IntegrationHubClient: product is required");
|
|
39
|
+
}
|
|
40
|
+
if (options.auth.mode === "service" && !options.auth.serviceToken) {
|
|
41
|
+
throw new Error("IntegrationHubClient: service auth requires a serviceToken");
|
|
42
|
+
}
|
|
43
|
+
if (options.auth.mode === "service" && !options.auth.serviceName) {
|
|
44
|
+
throw new Error("IntegrationHubClient: service auth requires a serviceName");
|
|
45
|
+
}
|
|
46
|
+
if (options.auth.mode === "user-key" && !options.auth.apiKey) {
|
|
47
|
+
throw new Error("IntegrationHubClient: user-key auth requires an apiKey");
|
|
48
|
+
}
|
|
49
|
+
this.endpoint = (options.endpoint ?? DEFAULT_TANGLE_PLATFORM_URL).replace(/\/+$/, "");
|
|
50
|
+
this.product = options.product;
|
|
51
|
+
this.auth = options.auth;
|
|
52
|
+
this.fetchImpl = options.fetchImpl ?? fetch;
|
|
53
|
+
this.timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
54
|
+
this.maxAttempts = Math.max(1, options.maxAttempts ?? DEFAULT_MAX_ATTEMPTS);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Resolve a manifest against a user's connections. The returned
|
|
58
|
+
* `ready` / `missing` split is the canonical way to ask "does this user
|
|
59
|
+
* have the connections this work needs" — the raw connection list is not
|
|
60
|
+
* reachable by a service token by design.
|
|
61
|
+
*/
|
|
62
|
+
async resolveManifest(input) {
|
|
63
|
+
return this.request("POST", "/resolve-manifest", input.userId, {
|
|
64
|
+
product: input.product ?? this.product,
|
|
65
|
+
manifest: input.manifest,
|
|
66
|
+
ownerUserId: input.userId
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Convenience over {@link resolveManifest} — probe a single connector and
|
|
71
|
+
* get back a boolean plus the satisfying connection. The Surface-A quest
|
|
72
|
+
* primitive ("is the user's GitHub linked?").
|
|
73
|
+
*/
|
|
74
|
+
async checkConnector(input) {
|
|
75
|
+
const requirementId = input.connectorId;
|
|
76
|
+
const resolution = await this.resolveManifest({
|
|
77
|
+
userId: input.userId,
|
|
78
|
+
manifest: {
|
|
79
|
+
id: `connectivity-check:${input.connectorId}`,
|
|
80
|
+
requirements: [
|
|
81
|
+
{
|
|
82
|
+
id: requirementId,
|
|
83
|
+
connectorId: input.connectorId,
|
|
84
|
+
reason: `Connectivity check for ${input.connectorId}`,
|
|
85
|
+
mode: input.mode ?? "read",
|
|
86
|
+
...input.requiredScopes ? { requiredScopes: input.requiredScopes } : {},
|
|
87
|
+
...input.requiredActions ? { requiredActions: input.requiredActions } : {}
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
const requirement = resolution.ready.find((r) => r.requirement.id === requirementId) ?? resolution.missing.find((r) => r.requirement.id === requirementId) ?? resolution.optionalMissing.find((r) => r.requirement.id === requirementId);
|
|
93
|
+
if (!requirement) {
|
|
94
|
+
throw new IntegrationHubRequestError({
|
|
95
|
+
status: 0,
|
|
96
|
+
code: "malformed_response",
|
|
97
|
+
message: `resolve-manifest returned no resolution for requirement ${requirementId}`,
|
|
98
|
+
endpoint: "POST /resolve-manifest",
|
|
99
|
+
retryable: false
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
connected: requirement.status === "ready",
|
|
104
|
+
...requirement.connection ? { connection: requirement.connection } : {},
|
|
105
|
+
resolution: requirement
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/** Create grants for every satisfiable requirement of a manifest. The
|
|
109
|
+
* platform rejects the call if any non-optional requirement is missing a
|
|
110
|
+
* connection. */
|
|
111
|
+
async createGrants(input) {
|
|
112
|
+
const data = await this.request(
|
|
113
|
+
"POST",
|
|
114
|
+
"/grants",
|
|
115
|
+
input.userId,
|
|
116
|
+
{
|
|
117
|
+
grantee: input.grantee,
|
|
118
|
+
manifest: input.manifest,
|
|
119
|
+
ownerUserId: input.userId,
|
|
120
|
+
...input.metadata ? { metadata: input.metadata } : {}
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
return data.grants;
|
|
124
|
+
}
|
|
125
|
+
/** List the acting user's grants, optionally filtered to one grantee. */
|
|
126
|
+
async listGrants(input) {
|
|
127
|
+
const query = input.grantee !== void 0 ? `?granteeType=${encodeURIComponent(input.grantee.type)}&granteeId=${encodeURIComponent(input.grantee.id)}` : "";
|
|
128
|
+
const data = await this.request(
|
|
129
|
+
"GET",
|
|
130
|
+
`/grants${query}`,
|
|
131
|
+
input.userId
|
|
132
|
+
);
|
|
133
|
+
return data.grants;
|
|
134
|
+
}
|
|
135
|
+
/** Mint a short-lived capability bundle for a sandbox / agent process.
|
|
136
|
+
* Provider credentials never leave the platform — the bundle carries only
|
|
137
|
+
* scoped, expiring capability tokens. */
|
|
138
|
+
async mintCapabilityBundle(input) {
|
|
139
|
+
if (!input.manifestId && !(input.grantIds && input.grantIds.length > 0)) {
|
|
140
|
+
throw new Error(
|
|
141
|
+
"IntegrationHubClient.mintCapabilityBundle: manifestId or a non-empty grantIds is required"
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
return this.request("POST", "/capabilities/bundle", input.userId, {
|
|
145
|
+
subject: input.subject,
|
|
146
|
+
...input.manifestId ? { manifestId: input.manifestId } : {},
|
|
147
|
+
...input.grantIds ? { grantIds: input.grantIds } : {},
|
|
148
|
+
...input.grantee ? { grantee: input.grantee } : {},
|
|
149
|
+
...input.ttlMs !== void 0 ? { ttlMs: input.ttlMs } : {}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
/** Run live healthchecks across all of the acting user's connections. */
|
|
153
|
+
async runHealthchecks(input) {
|
|
154
|
+
const data = await this.request(
|
|
155
|
+
"POST",
|
|
156
|
+
"/healthchecks/run",
|
|
157
|
+
input.userId,
|
|
158
|
+
{ ownerUserId: input.userId }
|
|
159
|
+
);
|
|
160
|
+
return data.healthchecks;
|
|
161
|
+
}
|
|
162
|
+
buildHeaders(userId, hasBody) {
|
|
163
|
+
const headers = new Headers({ accept: "application/json" });
|
|
164
|
+
if (hasBody) headers.set("content-type", "application/json");
|
|
165
|
+
if (this.auth.mode === "service") {
|
|
166
|
+
headers.set("authorization", `Bearer ${this.auth.serviceToken}`);
|
|
167
|
+
headers.set("x-service-name", this.auth.serviceName);
|
|
168
|
+
headers.set("x-platform-user-id", userId);
|
|
169
|
+
} else {
|
|
170
|
+
headers.set("authorization", `Bearer ${this.auth.apiKey}`);
|
|
171
|
+
}
|
|
172
|
+
return headers;
|
|
173
|
+
}
|
|
174
|
+
async request(method, path, userId, body) {
|
|
175
|
+
if (!PLATFORM_USER_ID_PATTERN.test(userId)) {
|
|
176
|
+
throw new IntegrationHubRequestError({
|
|
177
|
+
status: 0,
|
|
178
|
+
code: "invalid_user_id",
|
|
179
|
+
message: `userId ${JSON.stringify(userId)} is not a valid platform user id`,
|
|
180
|
+
endpoint: `${method} ${path}`,
|
|
181
|
+
retryable: false
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
const url = `${this.endpoint}/v1/integrations${path}`;
|
|
185
|
+
const endpointLabel = `${method} /v1/integrations${path}`;
|
|
186
|
+
const headers = this.buildHeaders(userId, body !== void 0);
|
|
187
|
+
const init = {
|
|
188
|
+
method,
|
|
189
|
+
headers,
|
|
190
|
+
...body !== void 0 ? { body: JSON.stringify(body) } : {}
|
|
191
|
+
};
|
|
192
|
+
let lastError;
|
|
193
|
+
for (let attempt = 1; attempt <= this.maxAttempts; attempt++) {
|
|
194
|
+
let response;
|
|
195
|
+
try {
|
|
196
|
+
response = await this.fetchImpl(url, {
|
|
197
|
+
...init,
|
|
198
|
+
signal: AbortSignal.timeout(this.timeoutMs)
|
|
199
|
+
});
|
|
200
|
+
} catch (error) {
|
|
201
|
+
lastError = new IntegrationHubRequestError({
|
|
202
|
+
status: 0,
|
|
203
|
+
code: "network_error",
|
|
204
|
+
message: `${endpointLabel} failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
205
|
+
endpoint: endpointLabel,
|
|
206
|
+
retryable: true
|
|
207
|
+
});
|
|
208
|
+
if (attempt < this.maxAttempts) {
|
|
209
|
+
await delay(attempt);
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
throw lastError;
|
|
213
|
+
}
|
|
214
|
+
const payload = await readJson(response);
|
|
215
|
+
if (response.ok && isSuccessEnvelope(payload)) {
|
|
216
|
+
return payload.data;
|
|
217
|
+
}
|
|
218
|
+
const retryable = RETRYABLE_STATUSES.has(response.status);
|
|
219
|
+
lastError = new IntegrationHubRequestError({
|
|
220
|
+
status: response.status,
|
|
221
|
+
code: errorCode(payload, response.status),
|
|
222
|
+
message: errorMessage(payload, endpointLabel, response.status),
|
|
223
|
+
endpoint: endpointLabel,
|
|
224
|
+
retryable
|
|
225
|
+
});
|
|
226
|
+
if (retryable && attempt < this.maxAttempts) {
|
|
227
|
+
await delay(attempt);
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
throw lastError;
|
|
231
|
+
}
|
|
232
|
+
throw lastError ?? new IntegrationHubRequestError({
|
|
233
|
+
status: 0,
|
|
234
|
+
code: "unknown",
|
|
235
|
+
message: `${endpointLabel} exhausted retries without a result`,
|
|
236
|
+
endpoint: endpointLabel,
|
|
237
|
+
retryable: false
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
function createIntegrationHubClient(options) {
|
|
242
|
+
return new IntegrationHubClient(options);
|
|
243
|
+
}
|
|
244
|
+
function isSuccessEnvelope(payload) {
|
|
245
|
+
return typeof payload === "object" && payload !== null && payload.success === true && "data" in payload;
|
|
246
|
+
}
|
|
247
|
+
async function readJson(response) {
|
|
248
|
+
const text = await response.text().catch(() => "");
|
|
249
|
+
if (!text) return void 0;
|
|
250
|
+
try {
|
|
251
|
+
return JSON.parse(text);
|
|
252
|
+
} catch {
|
|
253
|
+
return { __text: text };
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
function errorCode(payload, status) {
|
|
257
|
+
if (typeof payload === "object" && payload !== null) {
|
|
258
|
+
const error = payload.error;
|
|
259
|
+
if (error && typeof error.code === "string") return error.code;
|
|
260
|
+
}
|
|
261
|
+
return status === 0 ? "network_error" : "http_error";
|
|
262
|
+
}
|
|
263
|
+
function errorMessage(payload, endpointLabel, status) {
|
|
264
|
+
if (typeof payload === "object" && payload !== null) {
|
|
265
|
+
const record = payload;
|
|
266
|
+
if (record.error && typeof record.error.message === "string") {
|
|
267
|
+
return `${endpointLabel} \u2192 ${status}: ${record.error.message}`;
|
|
268
|
+
}
|
|
269
|
+
if (typeof record.__text === "string" && record.__text.length > 0) {
|
|
270
|
+
return `${endpointLabel} \u2192 ${status}: ${record.__text.slice(0, 300)}`;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return `${endpointLabel} \u2192 ${status}`;
|
|
274
|
+
}
|
|
275
|
+
function delay(attempt) {
|
|
276
|
+
return new Promise((resolve) => setTimeout(resolve, attempt * 200));
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export {
|
|
280
|
+
IntegrationHubRequestError,
|
|
281
|
+
IntegrationHubClient,
|
|
282
|
+
createIntegrationHubClient
|
|
283
|
+
};
|
|
284
|
+
//# sourceMappingURL=chunk-YOKNZY2N.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/consumer.ts"],"sourcesContent":["/**\n * @stable Integration Hub consumer client.\n *\n * The third client-shaped surface a product needs, alongside the two that\n * already ship:\n *\n * - `createTangleIntegrationsClient` (`client.ts`) — the *invoke* client.\n * Capability-token auth, runs INSIDE a sandbox / generated app, single\n * endpoint `/v1/integrations/invoke`.\n * - `startConnectFlow` / `finishConnectFlow` (`connect/index.ts`) — the\n * *user-consent* flow, mirrors `/cross-site/*`.\n * - **this** — the S2S *management* client. A product BACKEND (blueprint-\n * agent, sandbox, gtm-agent, tax-agent, legal-agent, evals, …) drives the\n * `/v1/integrations/{resolve-manifest,grants,capabilities/bundle,\n * healthchecks/run}` management surface on `id.tangle.tools` on behalf of\n * an identified user.\n *\n * Every consumer needs the identical client — the wire protocol, the\n * `{ success, data }` envelope, the auth header shape are all platform-owned.\n * Re-implementing a bespoke fetch loop per product forks the protocol and the\n * copies drift. This module is that shared implementation. It mirrors the\n * `connect/index.ts` design rule one-for-one: DO NOT invent the wire protocol\n * — speak exactly what `products/platform/api/src/routes/integrations.ts`\n * serves.\n *\n * Two auth modes — the route layer (`authMiddleware`) accepts either:\n *\n * - `service` — a `svc_*` service token + `X-Service-Name`. The acting\n * user travels in `X-Platform-User-Id`. The platform honors that header\n * only for service tokens whose `SERVICE_SCOPES` set contains\n * `impersonate:user`; a token without it is rejected (403). Reaches the\n * four management paths the platform allowlists for service tokens.\n * - `user-key` — a per-user `sk-tan-*` API key (minted via the connect\n * flow). The key identifies the user; no impersonation header. Reaches\n * every route the user themselves can.\n *\n * The capability-token `invoke` endpoint is intentionally NOT exposed here —\n * that is `createTangleIntegrationsClient`'s job and uses a different auth.\n */\n\nimport type { IntegrationActor, IntegrationConnection } from './index.js'\nimport type {\n IntegrationGrant,\n IntegrationManifest,\n IntegrationManifestResolution,\n IntegrationRequirementMode,\n IntegrationRequirementResolution,\n IntegrationSandboxBundle,\n} from './runtime.js'\nimport type { IntegrationHealthcheckResult } from './healthcheck.js'\nimport { DEFAULT_TANGLE_PLATFORM_URL } from './connectors/adapters/tangle-id.js'\n\n/** Matches the platform's `PLATFORM_USER_ID_PATTERN` (`auth.ts`). A user id\n * that fails this is rejected client-side before the request leaves. */\nconst PLATFORM_USER_ID_PATTERN = /^[A-Za-z0-9_-]{1,128}$/\n\nconst DEFAULT_TIMEOUT_MS = 10_000\nconst DEFAULT_MAX_ATTEMPTS = 2\n/** HTTP statuses worth a retry — transient platform/edge failures only.\n * 4xx is deterministic and never retried. */\nconst RETRYABLE_STATUSES = new Set([502, 503, 504])\n\nexport type IntegrationHubAuth =\n | {\n mode: 'service'\n /** The `svc_*` token issued to this product. */\n serviceToken: string\n /** Registered service name — sent as `X-Service-Name`. Required\n * because one token may be shared across services, in which case the\n * platform demands the header to disambiguate. */\n serviceName: string\n }\n | {\n mode: 'user-key'\n /** A per-user `sk-tan-*` key bound to the acting user. */\n apiKey: string\n }\n\nexport interface IntegrationHubClientOptions {\n /** The product / consumer identifier (e.g. `blueprint-agent`). Sent as the\n * `product` field of resolve-manifest calls; recorded platform-side. */\n product: string\n /** Service-token or per-user-key auth. */\n auth: IntegrationHubAuth\n /** Platform base URL. Defaults to `https://id.tangle.tools`. */\n endpoint?: string\n /** Injected for tests. Defaults to the global `fetch`. */\n fetchImpl?: typeof fetch\n /** Per-request timeout in ms. Default 10_000. */\n timeoutMs?: number\n /** Max attempts on transient (network / 502 / 503 / 504) failures.\n * Default 2 — i.e. one retry. */\n maxAttempts?: number\n}\n\n/** Thrown for every non-2xx response and every transport failure. Carries the\n * HTTP status and the platform error code so callers can branch precisely\n * (`403` + `impersonate` → the service token lacks the scope; `409` /\n * `missing_connection` → prompt the user to connect). */\nexport class IntegrationHubRequestError extends Error {\n readonly name = 'IntegrationHubRequestError'\n /** HTTP status, or 0 for a network-level failure. */\n readonly status: number\n /** Platform error code (`VALIDATION_ERROR`, `scope_missing`, …) or\n * `network_error` / `http_error` when no structured code was returned. */\n readonly code: string\n /** `METHOD /path` the request targeted. */\n readonly endpoint: string\n /** True when the failure class is transient and a retry could succeed. */\n readonly retryable: boolean\n\n constructor(input: {\n status: number\n code: string\n message: string\n endpoint: string\n retryable: boolean\n }) {\n super(input.message)\n this.status = input.status\n this.code = input.code\n this.endpoint = input.endpoint\n this.retryable = input.retryable\n }\n}\n\nexport interface ResolveManifestInput {\n /** The acting user — the connection owner. */\n userId: string\n manifest: IntegrationManifest\n /** Overrides the client-level `product` for this call. */\n product?: string\n}\n\nexport interface CreateGrantsInput {\n /** The acting user — the connection owner. */\n userId: string\n /** Who the grant is FOR (the sandbox / agent / app that will invoke). */\n grantee: IntegrationActor\n manifest: IntegrationManifest\n metadata?: Record<string, unknown>\n}\n\nexport interface ListGrantsInput {\n /** The acting user — the connection owner. */\n userId: string\n /** Optional grantee filter; both fields travel together as query params. */\n grantee?: IntegrationActor\n}\n\nexport interface MintCapabilityBundleInput {\n /** The acting user — must own every connection behind the grants. */\n userId: string\n /** Who the capability bundle is issued TO (the sandbox / agent process). */\n subject: IntegrationActor\n /** Mint from every grant of a manifest … */\n manifestId?: string\n /** … or from an explicit grant id list. Exactly one of the two is required. */\n grantIds?: string[]\n grantee?: IntegrationActor\n /** Bundle TTL in ms. Platform clamps to [1s, 60m]; default 15m. */\n ttlMs?: number\n}\n\nexport interface CapabilityBundleResult {\n bundle: IntegrationSandboxBundle\n /** Bridge environment variables to inject into the sandbox process —\n * `buildIntegrationBridgeEnvironment(bundle)`, computed platform-side. */\n env: Record<string, string>\n}\n\nexport interface CheckConnectorInput {\n /** The acting user. */\n userId: string\n /** Connector to probe — `github`, `google-calendar`, `tangle-id`, … */\n connectorId: string\n /** Defaults to `read`. */\n mode?: IntegrationRequirementMode\n requiredScopes?: string[]\n requiredActions?: string[]\n}\n\nexport interface CheckConnectorResult {\n /** True when the user has an active connection satisfying the requirement. */\n connected: boolean\n /** The satisfying connection, present iff `connected`. */\n connection?: IntegrationConnection\n /** The full requirement resolution — status, missing scopes/actions, message. */\n resolution: IntegrationRequirementResolution\n}\n\n/**\n * S2S management client for the `id.tangle.tools` integration hub. One per\n * product; methods are stateless and safe to call concurrently.\n */\nexport class IntegrationHubClient {\n private readonly endpoint: string\n private readonly product: string\n private readonly auth: IntegrationHubAuth\n private readonly fetchImpl: typeof fetch\n private readonly timeoutMs: number\n private readonly maxAttempts: number\n\n constructor(options: IntegrationHubClientOptions) {\n if (!options.product) {\n throw new Error('IntegrationHubClient: product is required')\n }\n if (options.auth.mode === 'service' && !options.auth.serviceToken) {\n throw new Error('IntegrationHubClient: service auth requires a serviceToken')\n }\n if (options.auth.mode === 'service' && !options.auth.serviceName) {\n throw new Error('IntegrationHubClient: service auth requires a serviceName')\n }\n if (options.auth.mode === 'user-key' && !options.auth.apiKey) {\n throw new Error('IntegrationHubClient: user-key auth requires an apiKey')\n }\n this.endpoint = (options.endpoint ?? DEFAULT_TANGLE_PLATFORM_URL).replace(/\\/+$/, '')\n this.product = options.product\n this.auth = options.auth\n this.fetchImpl = options.fetchImpl ?? fetch\n this.timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS\n this.maxAttempts = Math.max(1, options.maxAttempts ?? DEFAULT_MAX_ATTEMPTS)\n }\n\n /**\n * Resolve a manifest against a user's connections. The returned\n * `ready` / `missing` split is the canonical way to ask \"does this user\n * have the connections this work needs\" — the raw connection list is not\n * reachable by a service token by design.\n */\n async resolveManifest(input: ResolveManifestInput): Promise<IntegrationManifestResolution> {\n return this.request<IntegrationManifestResolution>('POST', '/resolve-manifest', input.userId, {\n product: input.product ?? this.product,\n manifest: input.manifest,\n ownerUserId: input.userId,\n })\n }\n\n /**\n * Convenience over {@link resolveManifest} — probe a single connector and\n * get back a boolean plus the satisfying connection. The Surface-A quest\n * primitive (\"is the user's GitHub linked?\").\n */\n async checkConnector(input: CheckConnectorInput): Promise<CheckConnectorResult> {\n const requirementId = input.connectorId\n const resolution = await this.resolveManifest({\n userId: input.userId,\n manifest: {\n id: `connectivity-check:${input.connectorId}`,\n requirements: [\n {\n id: requirementId,\n connectorId: input.connectorId,\n reason: `Connectivity check for ${input.connectorId}`,\n mode: input.mode ?? 'read',\n ...(input.requiredScopes ? { requiredScopes: input.requiredScopes } : {}),\n ...(input.requiredActions ? { requiredActions: input.requiredActions } : {}),\n },\n ],\n },\n })\n const requirement =\n resolution.ready.find((r) => r.requirement.id === requirementId) ??\n resolution.missing.find((r) => r.requirement.id === requirementId) ??\n resolution.optionalMissing.find((r) => r.requirement.id === requirementId)\n if (!requirement) {\n throw new IntegrationHubRequestError({\n status: 0,\n code: 'malformed_response',\n message: `resolve-manifest returned no resolution for requirement ${requirementId}`,\n endpoint: 'POST /resolve-manifest',\n retryable: false,\n })\n }\n return {\n connected: requirement.status === 'ready',\n ...(requirement.connection ? { connection: requirement.connection } : {}),\n resolution: requirement,\n }\n }\n\n /** Create grants for every satisfiable requirement of a manifest. The\n * platform rejects the call if any non-optional requirement is missing a\n * connection. */\n async createGrants(input: CreateGrantsInput): Promise<IntegrationGrant[]> {\n const data = await this.request<{ grants: IntegrationGrant[] }>(\n 'POST',\n '/grants',\n input.userId,\n {\n grantee: input.grantee,\n manifest: input.manifest,\n ownerUserId: input.userId,\n ...(input.metadata ? { metadata: input.metadata } : {}),\n },\n )\n return data.grants\n }\n\n /** List the acting user's grants, optionally filtered to one grantee. */\n async listGrants(input: ListGrantsInput): Promise<IntegrationGrant[]> {\n const query =\n input.grantee !== undefined\n ? `?granteeType=${encodeURIComponent(input.grantee.type)}&granteeId=${encodeURIComponent(input.grantee.id)}`\n : ''\n const data = await this.request<{ grants: IntegrationGrant[] }>(\n 'GET',\n `/grants${query}`,\n input.userId,\n )\n return data.grants\n }\n\n /** Mint a short-lived capability bundle for a sandbox / agent process.\n * Provider credentials never leave the platform — the bundle carries only\n * scoped, expiring capability tokens. */\n async mintCapabilityBundle(input: MintCapabilityBundleInput): Promise<CapabilityBundleResult> {\n if (!input.manifestId && !(input.grantIds && input.grantIds.length > 0)) {\n throw new Error(\n 'IntegrationHubClient.mintCapabilityBundle: manifestId or a non-empty grantIds is required',\n )\n }\n return this.request<CapabilityBundleResult>('POST', '/capabilities/bundle', input.userId, {\n subject: input.subject,\n ...(input.manifestId ? { manifestId: input.manifestId } : {}),\n ...(input.grantIds ? { grantIds: input.grantIds } : {}),\n ...(input.grantee ? { grantee: input.grantee } : {}),\n ...(input.ttlMs !== undefined ? { ttlMs: input.ttlMs } : {}),\n })\n }\n\n /** Run live healthchecks across all of the acting user's connections. */\n async runHealthchecks(input: { userId: string }): Promise<IntegrationHealthcheckResult[]> {\n const data = await this.request<{ healthchecks: IntegrationHealthcheckResult[] }>(\n 'POST',\n '/healthchecks/run',\n input.userId,\n { ownerUserId: input.userId },\n )\n return data.healthchecks\n }\n\n private buildHeaders(userId: string, hasBody: boolean): Headers {\n const headers = new Headers({ accept: 'application/json' })\n if (hasBody) headers.set('content-type', 'application/json')\n if (this.auth.mode === 'service') {\n headers.set('authorization', `Bearer ${this.auth.serviceToken}`)\n headers.set('x-service-name', this.auth.serviceName)\n headers.set('x-platform-user-id', userId)\n } else {\n headers.set('authorization', `Bearer ${this.auth.apiKey}`)\n }\n return headers\n }\n\n private async request<T>(\n method: 'GET' | 'POST',\n path: string,\n userId: string,\n body?: Record<string, unknown>,\n ): Promise<T> {\n if (!PLATFORM_USER_ID_PATTERN.test(userId)) {\n throw new IntegrationHubRequestError({\n status: 0,\n code: 'invalid_user_id',\n message: `userId ${JSON.stringify(userId)} is not a valid platform user id`,\n endpoint: `${method} ${path}`,\n retryable: false,\n })\n }\n const url = `${this.endpoint}/v1/integrations${path}`\n const endpointLabel = `${method} /v1/integrations${path}`\n const headers = this.buildHeaders(userId, body !== undefined)\n const init: RequestInit = {\n method,\n headers,\n ...(body !== undefined ? { body: JSON.stringify(body) } : {}),\n }\n\n let lastError: IntegrationHubRequestError | undefined\n for (let attempt = 1; attempt <= this.maxAttempts; attempt++) {\n let response: Response\n try {\n response = await this.fetchImpl(url, {\n ...init,\n signal: AbortSignal.timeout(this.timeoutMs),\n })\n } catch (error) {\n lastError = new IntegrationHubRequestError({\n status: 0,\n code: 'network_error',\n message: `${endpointLabel} failed: ${error instanceof Error ? error.message : String(error)}`,\n endpoint: endpointLabel,\n retryable: true,\n })\n if (attempt < this.maxAttempts) {\n await delay(attempt)\n continue\n }\n throw lastError\n }\n\n const payload = await readJson(response)\n if (response.ok && isSuccessEnvelope(payload)) {\n return payload.data as T\n }\n\n const retryable = RETRYABLE_STATUSES.has(response.status)\n lastError = new IntegrationHubRequestError({\n status: response.status,\n code: errorCode(payload, response.status),\n message: errorMessage(payload, endpointLabel, response.status),\n endpoint: endpointLabel,\n retryable,\n })\n if (retryable && attempt < this.maxAttempts) {\n await delay(attempt)\n continue\n }\n throw lastError\n }\n // Unreachable — the loop always returns or throws — but satisfies the\n // type checker and fails loud if the invariant is ever broken.\n throw (\n lastError ??\n new IntegrationHubRequestError({\n status: 0,\n code: 'unknown',\n message: `${endpointLabel} exhausted retries without a result`,\n endpoint: endpointLabel,\n retryable: false,\n })\n )\n }\n}\n\nexport function createIntegrationHubClient(\n options: IntegrationHubClientOptions,\n): IntegrationHubClient {\n return new IntegrationHubClient(options)\n}\n\ninterface SuccessEnvelope {\n success: true\n data: unknown\n}\n\nfunction isSuccessEnvelope(payload: unknown): payload is SuccessEnvelope {\n return (\n typeof payload === 'object' &&\n payload !== null &&\n (payload as { success?: unknown }).success === true &&\n 'data' in payload\n )\n}\n\nasync function readJson(response: Response): Promise<unknown> {\n const text = await response.text().catch(() => '')\n if (!text) return undefined\n try {\n return JSON.parse(text)\n } catch {\n // Hono `HTTPException` (auth-middleware rejections) renders the message\n // as a plain-text body, not the `{ success, error }` envelope. Preserve\n // it so the error message stays actionable.\n return { __text: text }\n }\n}\n\nfunction errorCode(payload: unknown, status: number): string {\n if (typeof payload === 'object' && payload !== null) {\n const error = (payload as { error?: { code?: unknown } }).error\n if (error && typeof error.code === 'string') return error.code\n }\n return status === 0 ? 'network_error' : 'http_error'\n}\n\nfunction errorMessage(payload: unknown, endpointLabel: string, status: number): string {\n if (typeof payload === 'object' && payload !== null) {\n const record = payload as { error?: { message?: unknown }; __text?: unknown }\n if (record.error && typeof record.error.message === 'string') {\n return `${endpointLabel} → ${status}: ${record.error.message}`\n }\n if (typeof record.__text === 'string' && record.__text.length > 0) {\n return `${endpointLabel} → ${status}: ${record.__text.slice(0, 300)}`\n }\n }\n return `${endpointLabel} → ${status}`\n}\n\n/** Linear backoff — 200ms, 400ms, … — capped implicitly by `maxAttempts`. */\nfunction delay(attempt: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, attempt * 200))\n}\n"],"mappings":";;;;;AAsDA,IAAM,2BAA2B;AAEjC,IAAM,qBAAqB;AAC3B,IAAM,uBAAuB;AAG7B,IAAM,qBAAqB,oBAAI,IAAI,CAAC,KAAK,KAAK,GAAG,CAAC;AAuC3C,IAAM,6BAAN,cAAyC,MAAM;AAAA,EAC3C,OAAO;AAAA;AAAA,EAEP;AAAA;AAAA;AAAA,EAGA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EAET,YAAY,OAMT;AACD,UAAM,MAAM,OAAO;AACnB,SAAK,SAAS,MAAM;AACpB,SAAK,OAAO,MAAM;AAClB,SAAK,WAAW,MAAM;AACtB,SAAK,YAAY,MAAM;AAAA,EACzB;AACF;AAuEO,IAAM,uBAAN,MAA2B;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;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AAO,SAAS,OAAO,OAAO,MAAM,YAAY,UAAU;AAC5D,aAAO,GAAG,aAAa,WAAM,MAAM,KAAK,OAAO,MAAM,OAAO;AAAA,IAC9D;AACA,QAAI,OAAO,OAAO,WAAW,YAAY,OAAO,OAAO,SAAS,GAAG;AACjE,aAAO,GAAG,aAAa,WAAM,MAAM,KAAK,OAAO,OAAO,MAAM,GAAG,GAAG,CAAC;AAAA,IACrE;AAAA,EACF;AACA,SAAO,GAAG,aAAa,WAAM,MAAM;AACrC;AAGA,SAAS,MAAM,SAAgC;AAC7C,SAAO,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,UAAU,GAAG,CAAC;AACpE;","names":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { C as CapabilityBundleResult, y as CheckConnectorInput, z as CheckConnectorResult, A as CreateGrantsInput, B as IntegrationHubAuth, D as IntegrationHubClient, E as IntegrationHubClientOptions, F as IntegrationHubRequestError, L as ListGrantsInput, G as MintCapabilityBundleInput, R as ResolveManifestInput, H as createIntegrationHubClient } from './registry.js';
|
|
2
|
+
import './tangle-id-CTU4kGId.js';
|
|
3
|
+
import './errors-Bg3_rxnQ.js';
|
|
4
|
+
import './connect/index.js';
|
|
5
|
+
import './middleware/index.js';
|
|
6
|
+
import './connectors/index.js';
|
|
7
|
+
import './connectors/adapters/index.js';
|
|
8
|
+
import 'node:http';
|
package/dist/consumer.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IntegrationHubClient,
|
|
3
|
+
IntegrationHubRequestError,
|
|
4
|
+
createIntegrationHubClient
|
|
5
|
+
} from "./chunk-YOKNZY2N.js";
|
|
6
|
+
import "./chunk-ATYHZXLL.js";
|
|
7
|
+
export {
|
|
8
|
+
IntegrationHubClient,
|
|
9
|
+
IntegrationHubRequestError,
|
|
10
|
+
createIntegrationHubClient
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=consumer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
type IntegrationErrorCode = 'missing_connection' | 'missing_grant' | 'approval_required' | 'approval_denied' | 'connection_revoked' | 'connection_expired' | 'scope_missing' | 'action_denied' | 'action_not_found' | 'trigger_not_found' | 'provider_rate_limited' | 'provider_auth_failed' | 'provider_unavailable' | 'provider_error' | 'capability_expired' | 'capability_invalid' | 'manifest_invalid' | 'passthrough_disabled' | 'input_invalid' | 'unknown';
|
|
2
|
+
interface IntegrationUserAction {
|
|
3
|
+
type: 'connect' | 'reconnect' | 'approve' | 'retry' | 'contact_support' | 'change_request';
|
|
4
|
+
label: string;
|
|
5
|
+
connectorId?: string;
|
|
6
|
+
approvalId?: string;
|
|
7
|
+
}
|
|
8
|
+
declare class IntegrationRuntimeError extends Error {
|
|
9
|
+
readonly code: IntegrationErrorCode;
|
|
10
|
+
readonly status: number;
|
|
11
|
+
readonly userAction?: IntegrationUserAction;
|
|
12
|
+
readonly metadata?: Record<string, unknown>;
|
|
13
|
+
constructor(input: {
|
|
14
|
+
code: IntegrationErrorCode;
|
|
15
|
+
message: string;
|
|
16
|
+
status?: number;
|
|
17
|
+
userAction?: IntegrationUserAction;
|
|
18
|
+
metadata?: Record<string, unknown>;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
interface NormalizedIntegrationError {
|
|
22
|
+
ok: false;
|
|
23
|
+
code: IntegrationErrorCode;
|
|
24
|
+
message: string;
|
|
25
|
+
status: number;
|
|
26
|
+
userAction?: IntegrationUserAction;
|
|
27
|
+
metadata?: Record<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
declare function normalizeIntegrationError(error: unknown): NormalizedIntegrationError;
|
|
30
|
+
declare function statusForCode(code: IntegrationErrorCode): number;
|
|
31
|
+
|
|
32
|
+
export { IntegrationRuntimeError as I, type NormalizedIntegrationError as N, type IntegrationUserAction as a, type IntegrationErrorCode as b, normalizeIntegrationError as n, statusForCode as s };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { aB as ACTIVEPIECES_OVERRIDES, aC as ACTIVEPIECES_PUBLIC_CATALOG_URL, aD as ACTIVEPIECES_RUNTIME_SIGNATURE_HEADER, aE as ActivepiecesCatalogAuthField, aF as ActivepiecesCatalogEntry, aG as ActivepiecesExecutorInvocation, aH as ActivepiecesExecutorProviderOptions, aI as ActivepiecesHttpExecutorOptions, aJ as ActivepiecesPieceOverride, aK as ActivepiecesRuntimeRequest, U as ApiKeyAuthSpec, aL as ApprovalBackedPolicyEngine, aM as ApprovalBackedPolicyOptions, aN as CANONICAL_INTEGRATION_ACTIONS, aO as CanonicalIntegrationActionId, aP as CanonicalLaunchConnectorOptions, aQ as CatalogExecutorInvocation, aR as CatalogExecutorProviderOptions, aS as CompleteAuthRequest, ComposeIntegrationRegistryOptions, aT as ConnectionCredentialResolverOptions, aU as ConnectorAdapterProviderOptions, aV as ConsentSummary, V as ConsoleStep, W as CredentialFieldSpec, X as CredentialValidationInput, Y as CredentialValidationResult, Z as CustomAuthSpec, aW as DEFAULT_INTEGRATION_BRIDGE_ENV, aX as DefaultIntegrationActionGuard, aY as DiscoverWorkspaceCapabilitiesInput, aZ as GatewayCatalogAction, a_ as GatewayCatalogEntry, a$ as GatewayCatalogProviderOptions, b0 as GatewayCatalogTrigger, b1 as GraphqlOperationSpec, _ as HealthcheckPlan, $ as HealthcheckSpec, a0 as HmacAuthSpec, b2 as HttpIntegrationProviderOptions, a1 as INTEGRATION_FAMILIES, b3 as ImportCatalogOptions, b4 as InMemoryConnectionStore, b5 as InMemoryIntegrationApprovalStore, b6 as InMemoryIntegrationAuditStore, b7 as InMemoryIntegrationEventStore, f as InMemoryIntegrationGrantStore, b8 as InMemoryIntegrationHealthcheckStore, b9 as InMemoryIntegrationIdempotencyStore, ba as InMemoryIntegrationSecretStore, bb as InMemoryIntegrationWorkflowStore, bc as InferIntegrationRequirementsOptions, bd as InstalledIntegrationWorkflow, be as IntegrationActionGuard, bf as IntegrationActionPack, bg as IntegrationActionRequest, bh as IntegrationActionResult, bi as IntegrationActionRisk, bj as IntegrationActor, bk as IntegrationApprovalFilter, bl as IntegrationApprovalRecord, bm as IntegrationApprovalRequest, bn as IntegrationApprovalResolution, bo as IntegrationApprovalStatus, bp as IntegrationApprovalStore, bq as IntegrationAuditEvent, br as IntegrationAuditEventType, bs as IntegrationAuditFilter, bt as IntegrationAuditSink, bu as IntegrationAuditStore, a2 as IntegrationAuthMode, a3 as IntegrationAuthSpec, bv as IntegrationBridgePayload, bw as IntegrationBridgeToolBinding, bx as IntegrationCapability, g as IntegrationCapabilityBinding, by as IntegrationCatalogFreshnessOptions, bz as IntegrationCatalogFreshnessResult, IntegrationCatalogSource, I as IntegrationCatalogView, bA as IntegrationConnection, bB as IntegrationConnectionStore, bC as IntegrationConnector, bD as IntegrationConnectorAction, bE as IntegrationConnectorCategory, bF as IntegrationConnectorTrigger, bG as IntegrationCoveragePriority, bH as IntegrationCoverageSpec, bI as IntegrationDataClass, bJ as IntegrationError, bK as IntegrationErrorCode, bL as IntegrationEventStore, a4 as IntegrationFamilyId, a5 as IntegrationFamilySpec, h as IntegrationGrant, j as IntegrationGrantStore, bM as IntegrationGuardContext, bN as IntegrationHealthcheckCheck, bO as IntegrationHealthcheckResult, bP as IntegrationHealthcheckStatus, bQ as IntegrationHealthcheckStore, bR as IntegrationHub, bS as IntegrationHubOptions, bT as IntegrationIdempotencyRecord, bU as IntegrationIdempotencyStore, bV as IntegrationInvocationEnvelope, bW as IntegrationInvocationEnvelopeValidationOptions, a6 as IntegrationLifecycleSpec, k as IntegrationManifest, l as IntegrationManifestResolution, a7 as IntegrationPlannerHints, bX as IntegrationPolicyDecision, bY as IntegrationPolicyEffect, bZ as IntegrationPolicyEngine, b_ as IntegrationPolicyRule, b$ as IntegrationProvider, c0 as IntegrationProviderKind, c1 as IntegrationRateLimitDecision, c2 as IntegrationRateLimiter, IntegrationRegistry, IntegrationRegistryConflict, IntegrationRegistryEntry, IntegrationRegistrySourceRef, IntegrationRegistrySummary, m as IntegrationRequirement, n as IntegrationRequirementMode, o as IntegrationRequirementResolution, q as IntegrationRequirementStatus, r as IntegrationRuntime, c3 as IntegrationRuntimeError, u as IntegrationRuntimeHub, v as IntegrationRuntimeOptions, w as IntegrationSandboxBundle, c4 as IntegrationSandboxHost, c5 as IntegrationSandboxHostHub, c6 as IntegrationSandboxHostOptions, c7 as IntegrationSecretStore, a8 as IntegrationSetupSpec, a9 as IntegrationSpec, aa as IntegrationSpecStatus, ab as IntegrationSpecValidationIssue, ac as IntegrationSpecValidationResult, IntegrationSupportTier, a as IntegrationToolDefinition, b as IntegrationToolSearchFilters, c as IntegrationToolSearchResult, c8 as IntegrationTriggerEvent, c9 as IntegrationTriggerSubscription, ca as IntegrationUserAction, cb as IntegrationWebhookReceiverResult, cc as IntegrationWorkflowDefinition, cd as IntegrationWorkflowRuntime, ce as IntegrationWorkflowRuntimeHub, cf as IntegrationWorkflowRuntimeOptions, cg as IntegrationWorkflowStore, ch as InvokeWithCapabilityRequest, ci as IssueCapabilityRequest, cj as IssuedIntegrationCapability, ck as ManifestValidationIssue, cl as ManifestValidationResult, cm as McpCatalog, cn as McpCatalogTool, M as McpToolDefinition, co as MissingRequirementExplanation, ad as NoneAuthSpec, cp as NormalizedIntegrationError, cq as NormalizedIntegrationResult, ae as NormalizedPermission, af as OAuth2AuthSpec, cr as OpenApiDocument, cs as OpenApiOperation, ct as PROVIDER_PASSTHROUGH_ACTION, ag as PermissionDescriptor, cu as PlatformIntegrationPolicyPresetOptions, ah as PostSetupCheck, cv as ProviderHttpRequestInput, cw as ProviderPassthroughPolicy, ai as Quirk, cx as RenderConsentOptions, aj as RenderSpecOptions, ak as RenderedConsoleStep, al as ScopeDescriptor, cy as SecretRef, cz as StartAuthRequest, cA as StartAuthResult, cB as StartedTangleCatalogRuntimeNodeServer, cC as StaticIntegrationPolicyEngine, cD as StaticIntegrationPolicyOptions, cE as StoredIntegrationEvent, T as TANGLE_CATALOG_RUNTIME_SIGNATURE_HEADER, cF as TANGLE_INTEGRATIONS_CATALOG_PROVIDER_ID, cG as TANGLE_INTEGRATIONS_CATALOG_SOURCE, y as TangleCatalogAuthResolverOptions, cH as TangleCatalogExecutorInvocation, cI as TangleCatalogExecutorProviderOptions, z as TangleCatalogHttpAuthResolverOptions, A as TangleCatalogHttpAuthResolverRequest, cJ as TangleCatalogHttpExecutorInvocation, cK as TangleCatalogHttpExecutorOptions, B as TangleCatalogInstalledPackageExecutorOptions, cL as TangleCatalogRuntimeActionRequest, C as TangleCatalogRuntimeHandlerOptions, D as TangleCatalogRuntimeHttpRequest, E as TangleCatalogRuntimeHttpResponse, F as TangleCatalogRuntimeInvocation, G as TangleCatalogRuntimeModuleAction, cM as TangleCatalogRuntimeNodeServerOptions, H as TangleCatalogRuntimePackageCoverageOptions, J as TangleCatalogRuntimePackageCoverageRow, cN as TangleCatalogRuntimePackageManifest, cO as TangleCatalogRuntimePackageManifestOptions, cP as TangleCatalogRuntimePiece, cQ as TangleCatalogRuntimeRequest, cR as TangleCatalogTriggerInvocation, cS as TangleIntegrationCatalogEntry, cT as TangleIntegrationCatalogFreshnessOptions, cU as TangleIntegrationCatalogFreshnessResult, cV as TangleIntegrationContract, cW as TangleIntegrationContractStatus, cX as TangleIntegrationImplementationKind, cY as TangleIntegrationInvokeInput, cZ as TangleIntegrationInvokeResult, c_ as TangleIntegrationsClient, c$ as TangleIntegrationsClientOptions, d0 as WorkspaceCapability, d1 as WorkspaceCapabilityDiscovery, d2 as WorkspaceToolSchema, d3 as WorkspaceTrigger, d4 as adapterManifestsToConnectors, d5 as assertValidIntegrationManifest, am as assertValidIntegrationSpec, d6 as auditIntegrationCatalogFreshness, K as auditTangleCatalogRuntimePackages, d7 as auditTangleIntegrationCatalogFreshness, d8 as buildActivepiecesConnectors, d9 as buildActivepiecesRuntimeRequest, da as buildApprovalRequest, db as buildCanonicalLaunchConnectors, buildDefaultIntegrationRegistry, an as buildHealthcheckPlan, dc as buildIntegrationBridgeEnvironment, dd as buildIntegrationBridgePayload, d as buildIntegrationCatalogView, de as buildIntegrationCoverageConnectors, df as buildIntegrationInvocationEnvelope, e as buildIntegrationToolCatalog, dg as buildTangleCatalogRuntimePackageManifest, dh as buildTangleCatalogRuntimeRequest, di as buildTangleIntegrationCatalogConnectors, dj as calendarExercisePlannerManifest, dk as canonicalActionConnectorId, canonicalConnectorId, composeIntegrationRegistry, ao as consoleStepsToText, dl as createActivepiecesExecutorProvider, dm as createActivepiecesHttpExecutor, dn as createApprovalBackedPolicyEngine, dp as createAuditingActionGuard, dq as createCatalogExecutorProvider, dr as createConnectionCredentialResolver, ds as createConnectorAdapterCatalogSource, dt as createConnectorAdapterProvider, du as createCredentialBackedAdapterProvider, dv as createDefaultIntegrationActionGuard, dw as createDefaultIntegrationPolicyEngine, dx as createGatewayCatalogProvider, dy as createHttpIntegrationProvider, dz as createIntegrationAuditEvent, x as createIntegrationRuntime, dA as createIntegrationWorkflowRuntime, dB as createMockIntegrationProvider, dC as createPlatformIntegrationPolicyPreset, L as createTangleCatalogCredentialAuthResolver, dD as createTangleCatalogExecutorProvider, N as createTangleCatalogHttpAuthResolver, dE as createTangleCatalogHttpExecutor, O as createTangleCatalogInstalledPackageExecutor, P as createTangleCatalogRuntimeHandler, dF as createTangleCatalogRuntimeNodeRequestListener, dG as createTangleIntegrationsClient, dH as decodeIntegrationBridgePayload, dI as discoverWorkspaceCapabilities, dJ as dispatchIntegrationInvocation, dK as encodeIntegrationBridgePayload, dL as explainMissingRequirements, dM as extractActivepiecesPublicPieceCount, dN as extractExternalCatalogPublicCount, dO as filterDiscoveryByWorkspaceScopes, dP as getActivepiecesOverride, ap as getIntegrationFamily, aq as getIntegrationSpec, dQ as healthcheckRequest, dR as importGraphqlConnector, dS as importMcpConnector, dT as importOpenApiConnector, dU as inferIntegrationManifestFromTools, inferIntegrationSupportTier, dV as integrationCoverageChecklistMarkdown, ar as integrationSpecToConnector, i as integrationToolName, dW as invocationRequestFromEnvelope, dX as listActivepiecesCatalogEntries, as as listExecutableIntegrationSpecs, dY as listIntegrationCoverageSpecs, at as listIntegrationSpecs, dZ as listTangleIntegrationCatalogEntries, d_ as listTangleIntegrationCatalogRuntimePackages, d$ as listTangleIntegrationContracts, e0 as manifestToConnector, e1 as normalizeGatewayCatalog, e2 as normalizeIntegrationError, e3 as normalizeIntegrationResult, e4 as parseIntegrationBridgeEnvironment, p as parseIntegrationToolName, e5 as receiveIntegrationWebhook, e6 as redactApprovalRequest, e7 as redactCapability, e8 as redactIntegrationBridgePayload, e9 as redactInvocationEnvelope, au as renderAgentToolDescription, ea as renderApprovalCopy, eb as renderConsentSummary, av as renderConsoleSteps, aw as renderRunbookMarkdown, ec as renderTangleCatalogRuntimePnpmAddCommand, ed as resolveConnectionCredentials, ee as resolveIntegrationApproval, ef as revokeConnection, eg as runIntegrationHealthcheck, eh as runIntegrationHealthchecks, ei as sanitizeAuditConnection, ej as sanitizeConnection, s as searchIntegrationTools, ek as signActivepiecesRuntimeRequest, el as signCapability, Q as signTangleCatalogRuntimeRequest, ax as specAuthToConnectorAuth, em as startTangleCatalogRuntimeNodeServer, en as statusForCode, eo as storedEventToTriggerEvent, summarizeIntegrationRegistry, R as tangleCatalogAuthValue, t as toMcpTools, ay as validateCredentialFormat, az as validateCredentialSet, ep as validateIntegrationInvocationEnvelope, eq as validateIntegrationManifest, aA as validateIntegrationSpec, er as validateProviderPassthroughRequest, es as verifyActivepiecesRuntimeSignature, et as verifyCapabilityToken, S as verifyTangleCatalogRuntimeSignature } from './registry.js';
|
|
1
|
+
export { aN as ACTIVEPIECES_OVERRIDES, aO as ACTIVEPIECES_PUBLIC_CATALOG_URL, aP as ACTIVEPIECES_RUNTIME_SIGNATURE_HEADER, aQ as ActivepiecesCatalogAuthField, aR as ActivepiecesCatalogEntry, aS as ActivepiecesExecutorInvocation, aT as ActivepiecesExecutorProviderOptions, aU as ActivepiecesHttpExecutorOptions, aV as ActivepiecesPieceOverride, aW as ActivepiecesRuntimeRequest, a4 as ApiKeyAuthSpec, aX as ApprovalBackedPolicyEngine, aY as ApprovalBackedPolicyOptions, aZ as CANONICAL_INTEGRATION_ACTIONS, a_ as CanonicalIntegrationActionId, a$ as CanonicalLaunchConnectorOptions, C as CapabilityBundleResult, b0 as CatalogExecutorInvocation, b1 as CatalogExecutorProviderOptions, y as CheckConnectorInput, z as CheckConnectorResult, b2 as CompleteAuthRequest, ComposeIntegrationRegistryOptions, b3 as ConnectionCredentialResolverOptions, b4 as ConnectorAdapterProviderOptions, b5 as ConsentSummary, a5 as ConsoleStep, A as CreateGrantsInput, a6 as CredentialFieldSpec, a7 as CredentialValidationInput, a8 as CredentialValidationResult, a9 as CustomAuthSpec, b6 as DEFAULT_INTEGRATION_BRIDGE_ENV, b7 as DefaultIntegrationActionGuard, b8 as DiscoverWorkspaceCapabilitiesInput, b9 as GatewayCatalogAction, ba as GatewayCatalogEntry, bb as GatewayCatalogProviderOptions, bc as GatewayCatalogTrigger, bd as GraphqlOperationSpec, aa as HealthcheckPlan, ab as HealthcheckSpec, ac as HmacAuthSpec, be as HttpIntegrationProviderOptions, ad as INTEGRATION_FAMILIES, bf as ImportCatalogOptions, bg as InMemoryConnectionStore, bh as InMemoryIntegrationApprovalStore, bi as InMemoryIntegrationAuditStore, bj as InMemoryIntegrationEventStore, f as InMemoryIntegrationGrantStore, bk as InMemoryIntegrationHealthcheckStore, bl as InMemoryIntegrationIdempotencyStore, bm as InMemoryIntegrationSecretStore, bn as InMemoryIntegrationWorkflowStore, bo as InferIntegrationRequirementsOptions, bp as InstalledIntegrationWorkflow, bq as IntegrationActionGuard, br as IntegrationActionPack, bs as IntegrationActionRequest, bt as IntegrationActionResult, bu as IntegrationActionRisk, bv as IntegrationActor, bw as IntegrationApprovalFilter, bx as IntegrationApprovalRecord, by as IntegrationApprovalRequest, bz as IntegrationApprovalResolution, bA as IntegrationApprovalStatus, bB as IntegrationApprovalStore, bC as IntegrationAuditEvent, bD as IntegrationAuditEventType, bE as IntegrationAuditFilter, bF as IntegrationAuditSink, bG as IntegrationAuditStore, ae as IntegrationAuthMode, af as IntegrationAuthSpec, bH as IntegrationBridgePayload, bI as IntegrationBridgeToolBinding, bJ as IntegrationCapability, g as IntegrationCapabilityBinding, bK as IntegrationCatalogFreshnessOptions, bL as IntegrationCatalogFreshnessResult, IntegrationCatalogSource, I as IntegrationCatalogView, bM as IntegrationConnection, bN as IntegrationConnectionStore, bO as IntegrationConnector, bP as IntegrationConnectorAction, bQ as IntegrationConnectorCategory, bR as IntegrationConnectorTrigger, bS as IntegrationCoveragePriority, bT as IntegrationCoverageSpec, bU as IntegrationDataClass, bV as IntegrationError, bW as IntegrationEventStore, ag as IntegrationFamilyId, ah as IntegrationFamilySpec, h as IntegrationGrant, j as IntegrationGrantStore, bX as IntegrationGuardContext, bY as IntegrationHealthcheckCheck, bZ as IntegrationHealthcheckResult, b_ as IntegrationHealthcheckStatus, b$ as IntegrationHealthcheckStore, c0 as IntegrationHub, B as IntegrationHubAuth, D as IntegrationHubClient, E as IntegrationHubClientOptions, c1 as IntegrationHubOptions, F as IntegrationHubRequestError, c2 as IntegrationIdempotencyRecord, c3 as IntegrationIdempotencyStore, c4 as IntegrationInvocationEnvelope, c5 as IntegrationInvocationEnvelopeValidationOptions, ai as IntegrationLifecycleSpec, k as IntegrationManifest, l as IntegrationManifestResolution, aj as IntegrationPlannerHints, c6 as IntegrationPolicyDecision, c7 as IntegrationPolicyEffect, c8 as IntegrationPolicyEngine, c9 as IntegrationPolicyRule, ca as IntegrationProvider, cb as IntegrationProviderKind, cc as IntegrationRateLimitDecision, cd as IntegrationRateLimiter, IntegrationRegistry, IntegrationRegistryConflict, IntegrationRegistryEntry, IntegrationRegistrySourceRef, IntegrationRegistrySummary, m as IntegrationRequirement, n as IntegrationRequirementMode, o as IntegrationRequirementResolution, q as IntegrationRequirementStatus, r as IntegrationRuntime, u as IntegrationRuntimeHub, v as IntegrationRuntimeOptions, w as IntegrationSandboxBundle, ce as IntegrationSandboxHost, cf as IntegrationSandboxHostHub, cg as IntegrationSandboxHostOptions, ch as IntegrationSecretStore, ak as IntegrationSetupSpec, al as IntegrationSpec, am as IntegrationSpecStatus, an as IntegrationSpecValidationIssue, ao as IntegrationSpecValidationResult, IntegrationSupportTier, a as IntegrationToolDefinition, b as IntegrationToolSearchFilters, c as IntegrationToolSearchResult, ci as IntegrationTriggerEvent, cj as IntegrationTriggerSubscription, ck as IntegrationWebhookReceiverResult, cl as IntegrationWorkflowDefinition, cm as IntegrationWorkflowRuntime, cn as IntegrationWorkflowRuntimeHub, co as IntegrationWorkflowRuntimeOptions, cp as IntegrationWorkflowStore, cq as InvokeWithCapabilityRequest, cr as IssueCapabilityRequest, cs as IssuedIntegrationCapability, L as ListGrantsInput, ct as ManifestValidationIssue, cu as ManifestValidationResult, cv as McpCatalog, cw as McpCatalogTool, M as McpToolDefinition, G as MintCapabilityBundleInput, cx as MissingRequirementExplanation, ap as NoneAuthSpec, cy as NormalizedIntegrationResult, aq as NormalizedPermission, ar as OAuth2AuthSpec, cz as OpenApiDocument, cA as OpenApiOperation, cB as PROVIDER_PASSTHROUGH_ACTION, as as PermissionDescriptor, cC as PlatformIntegrationPolicyPresetOptions, at as PostSetupCheck, cD as ProviderHttpRequestInput, cE as ProviderPassthroughPolicy, au as Quirk, cF as RenderConsentOptions, av as RenderSpecOptions, aw as RenderedConsoleStep, R as ResolveManifestInput, ax as ScopeDescriptor, cG as SecretRef, cH as StartAuthRequest, cI as StartAuthResult, cJ as StartedTangleCatalogRuntimeNodeServer, cK as StaticIntegrationPolicyEngine, cL as StaticIntegrationPolicyOptions, cM as StoredIntegrationEvent, T as TANGLE_CATALOG_RUNTIME_SIGNATURE_HEADER, cN as TANGLE_INTEGRATIONS_CATALOG_PROVIDER_ID, cO as TANGLE_INTEGRATIONS_CATALOG_SOURCE, J as TangleCatalogAuthResolverOptions, cP as TangleCatalogExecutorInvocation, cQ as TangleCatalogExecutorProviderOptions, K as TangleCatalogHttpAuthResolverOptions, N as TangleCatalogHttpAuthResolverRequest, cR as TangleCatalogHttpExecutorInvocation, cS as TangleCatalogHttpExecutorOptions, O as TangleCatalogInstalledPackageExecutorOptions, cT as TangleCatalogRuntimeActionRequest, P as TangleCatalogRuntimeHandlerOptions, Q as TangleCatalogRuntimeHttpRequest, S as TangleCatalogRuntimeHttpResponse, U as TangleCatalogRuntimeInvocation, V as TangleCatalogRuntimeModuleAction, cU as TangleCatalogRuntimeNodeServerOptions, W as TangleCatalogRuntimePackageCoverageOptions, X as TangleCatalogRuntimePackageCoverageRow, cV as TangleCatalogRuntimePackageManifest, cW as TangleCatalogRuntimePackageManifestOptions, cX as TangleCatalogRuntimePiece, cY as TangleCatalogRuntimeRequest, cZ as TangleCatalogTriggerInvocation, c_ as TangleIntegrationCatalogEntry, c$ as TangleIntegrationCatalogFreshnessOptions, d0 as TangleIntegrationCatalogFreshnessResult, d1 as TangleIntegrationContract, d2 as TangleIntegrationContractStatus, d3 as TangleIntegrationImplementationKind, d4 as TangleIntegrationInvokeInput, d5 as TangleIntegrationInvokeResult, d6 as TangleIntegrationsClient, d7 as TangleIntegrationsClientOptions, d8 as WorkspaceCapability, d9 as WorkspaceCapabilityDiscovery, da as WorkspaceToolSchema, db as WorkspaceTrigger, dc as adapterManifestsToConnectors, dd as assertValidIntegrationManifest, ay as assertValidIntegrationSpec, de as auditIntegrationCatalogFreshness, Y as auditTangleCatalogRuntimePackages, df as auditTangleIntegrationCatalogFreshness, dg as buildActivepiecesConnectors, dh as buildActivepiecesRuntimeRequest, di as buildApprovalRequest, dj as buildCanonicalLaunchConnectors, buildDefaultIntegrationRegistry, az as buildHealthcheckPlan, dk as buildIntegrationBridgeEnvironment, dl as buildIntegrationBridgePayload, d as buildIntegrationCatalogView, dm as buildIntegrationCoverageConnectors, dn as buildIntegrationInvocationEnvelope, e as buildIntegrationToolCatalog, dp as buildTangleCatalogRuntimePackageManifest, dq as buildTangleCatalogRuntimeRequest, dr as buildTangleIntegrationCatalogConnectors, ds as calendarExercisePlannerManifest, dt as canonicalActionConnectorId, canonicalConnectorId, composeIntegrationRegistry, aA as consoleStepsToText, du as createActivepiecesExecutorProvider, dv as createActivepiecesHttpExecutor, dw as createApprovalBackedPolicyEngine, dx as createAuditingActionGuard, dy as createCatalogExecutorProvider, dz as createConnectionCredentialResolver, dA as createConnectorAdapterCatalogSource, dB as createConnectorAdapterProvider, dC as createCredentialBackedAdapterProvider, dD as createDefaultIntegrationActionGuard, dE as createDefaultIntegrationPolicyEngine, dF as createGatewayCatalogProvider, dG as createHttpIntegrationProvider, dH as createIntegrationAuditEvent, H as createIntegrationHubClient, x as createIntegrationRuntime, dI as createIntegrationWorkflowRuntime, dJ as createMockIntegrationProvider, dK as createPlatformIntegrationPolicyPreset, Z as createTangleCatalogCredentialAuthResolver, dL as createTangleCatalogExecutorProvider, _ as createTangleCatalogHttpAuthResolver, dM as createTangleCatalogHttpExecutor, $ as createTangleCatalogInstalledPackageExecutor, a0 as createTangleCatalogRuntimeHandler, dN as createTangleCatalogRuntimeNodeRequestListener, dO as createTangleIntegrationsClient, dP as decodeIntegrationBridgePayload, dQ as discoverWorkspaceCapabilities, dR as dispatchIntegrationInvocation, dS as encodeIntegrationBridgePayload, dT as explainMissingRequirements, dU as extractActivepiecesPublicPieceCount, dV as extractExternalCatalogPublicCount, dW as filterDiscoveryByWorkspaceScopes, dX as getActivepiecesOverride, aB as getIntegrationFamily, aC as getIntegrationSpec, dY as healthcheckRequest, dZ as importGraphqlConnector, d_ as importMcpConnector, d$ as importOpenApiConnector, e0 as inferIntegrationManifestFromTools, inferIntegrationSupportTier, e1 as integrationCoverageChecklistMarkdown, aD as integrationSpecToConnector, i as integrationToolName, e2 as invocationRequestFromEnvelope, e3 as listActivepiecesCatalogEntries, aE as listExecutableIntegrationSpecs, e4 as listIntegrationCoverageSpecs, aF as listIntegrationSpecs, e5 as listTangleIntegrationCatalogEntries, e6 as listTangleIntegrationCatalogRuntimePackages, e7 as listTangleIntegrationContracts, e8 as manifestToConnector, e9 as normalizeGatewayCatalog, ea as normalizeIntegrationResult, eb as parseIntegrationBridgeEnvironment, p as parseIntegrationToolName, ec as receiveIntegrationWebhook, ed as redactApprovalRequest, ee as redactCapability, ef as redactIntegrationBridgePayload, eg as redactInvocationEnvelope, aG as renderAgentToolDescription, eh as renderApprovalCopy, ei as renderConsentSummary, aH as renderConsoleSteps, aI as renderRunbookMarkdown, ej as renderTangleCatalogRuntimePnpmAddCommand, ek as resolveConnectionCredentials, el as resolveIntegrationApproval, em as revokeConnection, en as runIntegrationHealthcheck, eo as runIntegrationHealthchecks, ep as sanitizeAuditConnection, eq as sanitizeConnection, s as searchIntegrationTools, er as signActivepiecesRuntimeRequest, es as signCapability, a1 as signTangleCatalogRuntimeRequest, aJ as specAuthToConnectorAuth, et as startTangleCatalogRuntimeNodeServer, eu as storedEventToTriggerEvent, summarizeIntegrationRegistry, a2 as tangleCatalogAuthValue, t as toMcpTools, aK as validateCredentialFormat, aL as validateCredentialSet, ev as validateIntegrationInvocationEnvelope, ew as validateIntegrationManifest, aM as validateIntegrationSpec, ex as validateProviderPassthroughRequest, ey as verifyActivepiecesRuntimeSignature, ez as verifyCapabilityToken, a3 as verifyTangleCatalogRuntimeSignature } from './registry.js';
|
|
2
|
+
export { b as IntegrationErrorCode, I as IntegrationRuntimeError, a as IntegrationUserAction, N as NormalizedIntegrationError, n as normalizeIntegrationError, s as statusForCode } from './errors-Bg3_rxnQ.js';
|
|
2
3
|
export { ConnectFlowOptions, FinishConnectInput, FinishConnectOutput, InMemoryConnectStateStore, StartConnectInput, StartConnectOutput, finishConnectFlow, revokeConnectFlow, startConnectFlow } from './connect/index.js';
|
|
3
4
|
export { ExpressLikeRequest, ExpressLikeResponse, HonoLikeContext, RequireTangleAuthOptions, TangleAuthContext, TangleAuthOutcome, TangleAuthReason, expressTangleAuthMiddleware, extractToken, honoTangleAuthMiddleware, requireTangleAuth } from './middleware/index.js';
|
|
4
5
|
export { A as AuthSpec, e as CASStrategy, f as Capability, g as CapabilityClass, h as CapabilityMutation, i as CapabilityMutationResult, j as CapabilityParameterSchema, k as CapabilityRead, l as CapabilityReadResult, C as ConnectorAdapter, d as ConnectorCredentials, m as ConnectorInvocation, n as ConnectorManifest, o as ConnectorManifestValidationIssue, p as ConnectorManifestValidationResult, q as ConsistencyModel, r as CredentialsExpired, D as DEFAULT_TANGLE_PLATFORM_URL, s as DataSourceMetadata, E as EventHandlerResult, I as InboundEvent, t as RateLimitSpec, R as ResolvedDataSource, u as ResourceContention, v as TANGLE_API_KEY_PREFIX, w as TANGLE_SERVICE_TOKEN_PREFIX, b as TangleIdentityClient, T as TangleIdentityOptions, x as TangleIdentityUnreachableError, c as TangleTokenVerifyFailure, y as TangleTokenVerifyResult, a as TangleUserSummary, z as TangleWorkspaceSummary, B as assertValidConnectorManifest, F as createTangleIdentityClient, G as tangleIdentity, H as validateConnectorManifest } from './tangle-id-CTU4kGId.js';
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,6 @@ import {
|
|
|
18
18
|
IntegrationError,
|
|
19
19
|
IntegrationHub,
|
|
20
20
|
IntegrationRuntime,
|
|
21
|
-
IntegrationRuntimeError,
|
|
22
21
|
IntegrationSandboxHost,
|
|
23
22
|
IntegrationWorkflowRuntime,
|
|
24
23
|
PROVIDER_PASSTHROUGH_ACTION,
|
|
@@ -98,7 +97,6 @@ import {
|
|
|
98
97
|
listTangleIntegrationContracts,
|
|
99
98
|
manifestToConnector,
|
|
100
99
|
normalizeGatewayCatalog,
|
|
101
|
-
normalizeIntegrationError,
|
|
102
100
|
normalizeIntegrationResult,
|
|
103
101
|
parseIntegrationBridgeEnvironment,
|
|
104
102
|
parseIntegrationToolName,
|
|
@@ -122,7 +120,6 @@ import {
|
|
|
122
120
|
signCapability,
|
|
123
121
|
signTangleCatalogRuntimeRequest,
|
|
124
122
|
startTangleCatalogRuntimeNodeServer,
|
|
125
|
-
statusForCode,
|
|
126
123
|
storedEventToTriggerEvent,
|
|
127
124
|
summarizeIntegrationRegistry,
|
|
128
125
|
tangleCatalogAuthValue,
|
|
@@ -133,13 +130,29 @@ import {
|
|
|
133
130
|
verifyActivepiecesRuntimeSignature,
|
|
134
131
|
verifyCapabilityToken,
|
|
135
132
|
verifyTangleCatalogRuntimeSignature
|
|
136
|
-
} from "./chunk-
|
|
133
|
+
} from "./chunk-TUX6MJJ4.js";
|
|
134
|
+
import {
|
|
135
|
+
InMemoryConnectStateStore,
|
|
136
|
+
finishConnectFlow,
|
|
137
|
+
revokeConnectFlow,
|
|
138
|
+
startConnectFlow
|
|
139
|
+
} from "./chunk-P24T3MLM.js";
|
|
137
140
|
import {
|
|
138
141
|
expressTangleAuthMiddleware,
|
|
139
142
|
extractToken,
|
|
140
143
|
honoTangleAuthMiddleware,
|
|
141
144
|
requireTangleAuth
|
|
142
145
|
} from "./chunk-SVQ4PHDZ.js";
|
|
146
|
+
import {
|
|
147
|
+
IntegrationRuntimeError,
|
|
148
|
+
normalizeIntegrationError,
|
|
149
|
+
statusForCode
|
|
150
|
+
} from "./chunk-H4XYLS7T.js";
|
|
151
|
+
import {
|
|
152
|
+
IntegrationHubClient,
|
|
153
|
+
IntegrationHubRequestError,
|
|
154
|
+
createIntegrationHubClient
|
|
155
|
+
} from "./chunk-YOKNZY2N.js";
|
|
143
156
|
import {
|
|
144
157
|
INTEGRATION_FAMILIES,
|
|
145
158
|
assertValidIntegrationSpec,
|
|
@@ -199,12 +212,6 @@ import {
|
|
|
199
212
|
verifyStripeSignature,
|
|
200
213
|
verifyTwilioSignature
|
|
201
214
|
} from "./chunk-2TW2QKGZ.js";
|
|
202
|
-
import {
|
|
203
|
-
InMemoryConnectStateStore,
|
|
204
|
-
finishConnectFlow,
|
|
205
|
-
revokeConnectFlow,
|
|
206
|
-
startConnectFlow
|
|
207
|
-
} from "./chunk-P24T3MLM.js";
|
|
208
215
|
import {
|
|
209
216
|
CredentialsExpired,
|
|
210
217
|
DEFAULT_TANGLE_PLATFORM_URL,
|
|
@@ -242,6 +249,8 @@ export {
|
|
|
242
249
|
InMemoryOAuthFlowStore,
|
|
243
250
|
IntegrationError,
|
|
244
251
|
IntegrationHub,
|
|
252
|
+
IntegrationHubClient,
|
|
253
|
+
IntegrationHubRequestError,
|
|
245
254
|
IntegrationRuntime,
|
|
246
255
|
IntegrationRuntimeError,
|
|
247
256
|
IntegrationSandboxHost,
|
|
@@ -301,6 +310,7 @@ export {
|
|
|
301
310
|
createGatewayCatalogProvider,
|
|
302
311
|
createHttpIntegrationProvider,
|
|
303
312
|
createIntegrationAuditEvent,
|
|
313
|
+
createIntegrationHubClient,
|
|
304
314
|
createIntegrationRuntime,
|
|
305
315
|
createIntegrationWorkflowRuntime,
|
|
306
316
|
createMockIntegrationProvider,
|