@tangle-network/agent-integrations 0.58.0 → 0.59.1

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.
Files changed (56) hide show
  1. package/README.md +31 -0
  2. package/dist/{adapters-ediOgE75.js → adapters-DQ0JJ-aG.js} +6 -283
  3. package/dist/{adapters-ediOgE75.js.map → adapters-DQ0JJ-aG.js.map} +1 -1
  4. package/dist/catalog-CFvKzwVj.js +201 -0
  5. package/dist/catalog-CFvKzwVj.js.map +1 -0
  6. package/dist/catalog.js +1 -1
  7. package/dist/connect/index.js +1 -1
  8. package/dist/connectors/adapters/index.js +1 -1
  9. package/dist/connectors/index.d.ts +2 -1
  10. package/dist/connectors/index.js +2 -1
  11. package/dist/connectors/oauth.d.ts +2 -0
  12. package/dist/connectors/oauth.js +282 -0
  13. package/dist/connectors/oauth.js.map +1 -0
  14. package/dist/{consumer-BC6pCUzI.d.ts → consumer-zHtoJixe.d.ts} +5 -37
  15. package/dist/{consumer-BC6pCUzI.d.ts.map → consumer-zHtoJixe.d.ts.map} +1 -1
  16. package/dist/consumer.d.ts +1 -1
  17. package/dist/hub-0Od2lgun.d.ts +38 -0
  18. package/dist/hub-0Od2lgun.d.ts.map +1 -0
  19. package/dist/hub-D13zPQGr.js +1004 -0
  20. package/dist/hub-D13zPQGr.js.map +1 -0
  21. package/dist/hub.d.ts +2 -0
  22. package/dist/hub.js +2 -0
  23. package/dist/index-BQXENE9p.d.ts +130 -0
  24. package/dist/index-BQXENE9p.d.ts.map +1 -0
  25. package/dist/index.d.ts +5 -3
  26. package/dist/index.js +15 -11
  27. package/dist/internal/bundled-manifest-runtime.js +1 -1
  28. package/dist/mcp.d.ts +1 -1
  29. package/dist/mcp.js +2 -1
  30. package/dist/mcp.js.map +1 -1
  31. package/dist/middleware/index.js +1 -1
  32. package/dist/oauth-C5pa5j3O.d.ts +136 -0
  33. package/dist/oauth-C5pa5j3O.d.ts.map +1 -0
  34. package/dist/registry-core-BZo69C37.js +186 -0
  35. package/dist/registry-core-BZo69C37.js.map +1 -0
  36. package/dist/registry.js +2 -2
  37. package/dist/runtime.d.ts +1 -1
  38. package/dist/runtime.js +1 -1
  39. package/dist/sandbox.d.ts +2 -0
  40. package/dist/sandbox.js +114 -0
  41. package/dist/sandbox.js.map +1 -0
  42. package/dist/{src-Bd4KMI-J.js → src-wcW1OCA7.js} +84922 -86026
  43. package/dist/src-wcW1OCA7.js.map +1 -0
  44. package/dist/stripe/index.js +1 -1
  45. package/dist/tangle-search/index.d.ts +37 -1
  46. package/dist/tangle-search/index.d.ts.map +1 -1
  47. package/dist/tangle-search/index.js +81 -1
  48. package/dist/tangle-search/index.js.map +1 -1
  49. package/dist/webhooks/index.js +1 -1
  50. package/docs/host-search-and-phone.md +28 -1
  51. package/package.json +17 -2
  52. package/dist/catalog-CBd0zbdD.js +0 -383
  53. package/dist/catalog-CBd0zbdD.js.map +0 -1
  54. package/dist/index-j2QziJA5.d.ts +0 -263
  55. package/dist/index-j2QziJA5.d.ts.map +0 -1
  56. package/dist/src-Bd4KMI-J.js.map +0 -1
@@ -1,263 +0,0 @@
1
- import { S as OAuth2UrlTemplateMetadataSpec, p as ConnectorManifest, x as OAuth2TokenClientAuthMethod } from "./types-CauVC-Gr.js";
2
- import "./index-CDVPZuIY.js";
3
- //#region src/connectors/oauth.d.ts
4
- type OAuthPkceMode = 'required' | 'supported' | 'unsupported';
5
- interface PendingOAuthFlow {
6
- /** code_verifier for PKCE. Absent when the provider rejects PKCE. */
7
- codeVerifier?: string;
8
- /** Opaque-state value also returned in the OAuth redirect. */
9
- state: string;
10
- /** Project the user is connecting under. */
11
- projectId: string;
12
- /** Connector kind (e.g. 'google-calendar'). */
13
- kind: string;
14
- /** Operator-supplied label that becomes DataSource.label. */
15
- label: string;
16
- /** When we drop the entry. */
17
- expiresAt: number;
18
- /** The redirectUri we used in the start step — must match exactly on
19
- * the callback exchange. */
20
- redirectUri: string;
21
- }
22
- interface OAuthFlowStore {
23
- put(state: string, flow: PendingOAuthFlow): Promise<void> | void;
24
- consume(state: string): Promise<PendingOAuthFlow | undefined> | PendingOAuthFlow | undefined;
25
- sweep?(now: number): Promise<void> | void;
26
- clear?(): Promise<void> | void;
27
- }
28
- declare class InMemoryOAuthFlowStore implements OAuthFlowStore {
29
- private readonly pendingFlows;
30
- put(state: string, flow: PendingOAuthFlow): void;
31
- consume(state: string): PendingOAuthFlow | undefined;
32
- sweep(now: number): void;
33
- clear(): void;
34
- }
35
- interface StartOAuthInput {
36
- projectId: string;
37
- kind: string;
38
- label: string;
39
- authorizationUrl: string;
40
- scopes: string[];
41
- /** OAuth defaults to spaces; set `,` for providers such as Zoho. */
42
- scopeSeparator?: ' ' | ',';
43
- clientId: string;
44
- /** Authorization query parameter for the client id. Defaults to
45
- * `client_id`; TikTok uses `client_key`. */
46
- authorizationClientIdParam?: string;
47
- /** PKCE posture. Defaults to required to preserve the existing safe flow. */
48
- pkce?: OAuthPkceMode;
49
- redirectUri: string;
50
- /** Optional extra query params; Google needs `access_type=offline` and
51
- * `prompt=consent` to issue refresh tokens reliably. */
52
- extraAuthParams?: Record<string, string>;
53
- /** Optional flow store. Use a durable store in distributed production
54
- * runtimes; omitted means local in-memory storage. */
55
- store?: OAuthFlowStore;
56
- /** Override clock for tests. */
57
- now?: number;
58
- }
59
- interface StartOAuthOutput {
60
- /** URL the SPA should redirect the user to. */
61
- authorizationUrl: string;
62
- /** State token — caller stashes this in localStorage to verify on
63
- * callback. */
64
- state: string;
65
- }
66
- /** Build the authorization URL + state. SPA navigates the user there;
67
- * user consents; provider redirects back to redirectUri with `code` +
68
- * `state`. The caller's callback then invokes `consumePendingFlow`. */
69
- declare function startOAuthFlow(input: StartOAuthInput): StartOAuthOutput;
70
- /** Look up + remove the pending flow record. Throws if state is unknown
71
- * or expired (CSRF guard / replay protection). */
72
- declare function consumePendingFlow(state: string, store?: OAuthFlowStore): Promise<PendingOAuthFlow>;
73
- interface ExchangeCodeInput {
74
- tokenUrl: string;
75
- clientId: string;
76
- /** Required unless tokenClientAuthMethod is `none`. */
77
- clientSecret?: string;
78
- /** Defaults to client_secret_post for backward compatibility. */
79
- tokenClientAuthMethod?: OAuth2TokenClientAuthMethod;
80
- tokenClientIdParam?: string;
81
- tokenClientSecretParam?: string;
82
- code: string;
83
- /** Required unless pkce is explicitly unsupported. */
84
- codeVerifier?: string;
85
- /** PKCE posture. Defaults to required. */
86
- pkce?: OAuthPkceMode;
87
- redirectUri: string;
88
- /** Non-secret provider identification headers for the token request. */
89
- tokenRequestHeaders?: Readonly<Record<string, string>>;
90
- fetchImpl?: typeof fetch;
91
- signal?: AbortSignal;
92
- }
93
- interface OAuthTokens {
94
- accessToken: string;
95
- refreshToken?: string;
96
- expiresIn?: number;
97
- scope?: string;
98
- tokenType?: string;
99
- /** OpenID Connect identity token returned when the connector requests
100
- * `openid`. Kept separate from the access credential so adapters can
101
- * capture stable account metadata without persisting the ID token. */
102
- idToken?: string;
103
- }
104
- /** POST authorization code → token endpoint. Provider-agnostic; if a
105
- * provider returns a non-standard JSON shape, the adapter wraps this
106
- * call rather than reaching into the helper. */
107
- declare function exchangeAuthorizationCode(input: ExchangeCodeInput): Promise<OAuthTokens>;
108
- interface RefreshInput {
109
- tokenUrl: string;
110
- clientId: string;
111
- /** Required unless tokenClientAuthMethod is `none`. */
112
- clientSecret?: string;
113
- /** Defaults to client_secret_post for backward compatibility. */
114
- tokenClientAuthMethod?: OAuth2TokenClientAuthMethod;
115
- tokenClientIdParam?: string;
116
- tokenClientSecretParam?: string;
117
- refreshToken: string;
118
- /** Non-secret provider identification headers for the token request. */
119
- tokenRequestHeaders?: Readonly<Record<string, string>>;
120
- fetchImpl?: typeof fetch;
121
- signal?: AbortSignal;
122
- }
123
- /** Refresh an access token. Returns the new tokens — the connector layer
124
- * is responsible for re-encrypting + persisting the envelope. */
125
- declare function refreshAccessToken(input: RefreshInput): Promise<OAuthTokens>;
126
- /** Build token-endpoint headers without permitting an adapter-supplied value
127
- * to replace the authentication or form-media-type headers owned here. */
128
- declare function createOAuthTokenRequestHeaders(additional?: Readonly<Record<string, string>>): Record<string, string>;
129
- declare function formEncodeOAuthClientCredential(value: string): string;
130
- declare function createOAuthBasicAuthorizationHeader(clientId: string, clientSecret: string, encodeBase64?: (value: string) => string): string;
131
- declare function oauthClientCredentialRedactionValues(clientId: string, clientSecret?: string, authorization?: string): string[];
132
- declare function redactOAuthSensitiveText(text: string, secrets: readonly string[]): string;
133
- /** Test-only — drop pending flows between unit-test runs. */
134
- declare function _resetPendingFlowsForTests(): void;
135
- //#endregion
136
- //#region src/connectors/webhooks.d.ts
137
- /**
138
- * Inbound webhook signature verifiers — provider-specific HMAC schemes.
139
- *
140
- * Each signature scheme is a pure function:
141
- * (rawBody: string, headers, secret, now?) → boolean
142
- *
143
- * Constant-time comparison via `crypto.timingSafeEqual`. Timestamps are
144
- * checked against a configurable tolerance to bound replay risk; the default
145
- * mirrors the upstream provider's documented window (Stripe: 5 min, Slack: 5 min).
146
- *
147
- * These verifiers are the building blocks for any inbound-webhook receiver
148
- * (a route + a `verify` call + a per-event handler). They live in this
149
- * package so every consumer of the integration substrate gets correct
150
- * verification — not just one product reimplementing it.
151
- */
152
- /** Default replay-protection window. Providers commonly use 5 minutes. */
153
- declare const DEFAULT_SIGNATURE_TOLERANCE_SECONDS: number;
154
- interface ParsedStripeSignatureHeader {
155
- t: number;
156
- sigs: string[];
157
- }
158
- declare function parseStripeSignatureHeader(header: string): ParsedStripeSignatureHeader | null;
159
- interface StripeVerifyOptions {
160
- /** Replay-protection window in seconds. Default 300. */
161
- toleranceSeconds?: number;
162
- /** Override `now()` for tests. UTC seconds. */
163
- now?: number;
164
- }
165
- /** Verify a Stripe webhook signature against the raw request body. */
166
- declare function verifyStripeSignature(rawBody: string, signatureHeader: string, secret: string, options?: StripeVerifyOptions): boolean;
167
- interface SlackVerifyOptions {
168
- toleranceSeconds?: number;
169
- now?: number;
170
- }
171
- declare function verifySlackSignature(rawBody: string, signatureHeader: string, timestampHeader: string, secret: string, options?: SlackVerifyOptions): boolean;
172
- interface GenericHmacVerifyOptions {
173
- /** sha256 (default) | sha1 | sha512 — matches the algorithm the receiver
174
- * computed at sign time. */
175
- algorithm?: 'sha256' | 'sha1' | 'sha512';
176
- /** Optional prefix the receiver prepends to the signature in the header
177
- * (e.g., `'sha256='`). Stripped before constant-time comparison. */
178
- signaturePrefix?: string;
179
- /** Lowercase comparison (most providers emit hex-lowercase). Default true. */
180
- lowercaseHex?: boolean;
181
- }
182
- declare function verifyHmacSignature(rawBody: string, signatureHeader: string, secret: string, options?: GenericHmacVerifyOptions): boolean;
183
- interface TwilioVerifyOptions {
184
- /** Skip verification when the auth token isn't configured. Useful in
185
- * dev where the receiver wants to accept any payload. Default `false`
186
- * — production should always require a configured token. */
187
- skipWhenAuthTokenMissing?: boolean;
188
- /** When true, sign the raw body instead of the URL-encoded sorted-params
189
- * reduction. Twilio uses raw-body signing for `application/json`
190
- * webhook bodies. Default `false`. */
191
- bodyAsRaw?: boolean;
192
- /** When `bodyAsRaw` is true, the raw body to sign. Ignored otherwise. */
193
- rawBody?: string;
194
- }
195
- /** Verify a Twilio webhook signature. */
196
- declare function verifyTwilioSignature(input: {
197
- authToken: string | null | undefined;
198
- signatureHeader: string | string[] | undefined;
199
- fullUrl: string | null | undefined;
200
- params: Record<string, string> | undefined;
201
- }, options?: TwilioVerifyOptions): boolean;
202
- interface EmailVerifyOptions {
203
- /** Replay-protection window in seconds. Default 300. */
204
- toleranceSeconds?: number;
205
- /** Override `now()` for tests. UTC seconds. */
206
- now?: number;
207
- }
208
- /** Verify a Tangle inbound-email signature against the raw request body. */
209
- declare function verifyEmailSignature(rawBody: string, signatureHeader: string, timestampHeader: string, secret: string, options?: EmailVerifyOptions): boolean;
210
- declare function firstHeader(headers: Record<string, string | string[] | undefined>, name: string): string | undefined;
211
- //#endregion
212
- //#region src/connectors/bundled-manifest-data.d.ts
213
- /** Every connector manifest this package bundles, sorted by kind. */
214
- declare function listBundledAdapterManifests(): ConnectorManifest[];
215
- /** The bundled manifest for `kind`, or undefined when nothing implements it. */
216
- declare function getBundledAdapterManifest(kind: string): ConnectorManifest | undefined;
217
- /** Whether this package ships a real, executable adapter for `kind`. */
218
- declare function hasBundledAdapter(kind: string): boolean;
219
- /** Kinds this package implements. */
220
- declare function listBundledAdapterKinds(): string[];
221
- /**
222
- * How a bundled connector really authenticates.
223
- *
224
- * `oauth2_client_credentials` is called out separately because it IS a
225
- * connectable mode but has no user-facing authorize step — a caller that
226
- * treats "oauth2 without an authorizationUrl" as broken would wrongly
227
- * condemn these machine-to-machine providers.
228
- */
229
- type BundledAuthMode = 'oauth2' | 'oauth2_client_credentials' | 'api_key' | 'hmac' | 'none';
230
- /** The auth mode a connect flow would actually drive for this manifest,
231
- * resolving `one_of` through its declared `preferred` mode. */
232
- declare function bundledAuthMode(manifest: ConnectorManifest): BundledAuthMode | undefined;
233
- /** The setup hint an api-key connector shows when collecting its credential. */
234
- declare function bundledApiKeyHint(manifest: ConnectorManifest): string | undefined;
235
- interface BundledOAuth2AuthContract {
236
- grantType: 'authorization_code' | 'client_credentials';
237
- authorizationUrl?: string;
238
- tokenUrl: string;
239
- scopes: string[];
240
- clientIdEnv: string;
241
- clientSecretEnv?: string;
242
- scopeSeparator: ' ' | ',';
243
- pkce?: 'required' | 'supported' | 'unsupported';
244
- authorizationClientIdParam: string;
245
- tokenClientIdParam: string;
246
- tokenClientSecretParam: string;
247
- tokenClientAuthMethod: 'none' | 'client_secret_post' | 'client_secret_basic';
248
- sendScopeParam?: boolean;
249
- extraAuthParams?: Record<string, string>;
250
- tokenRequestHeaders?: Record<string, string>;
251
- urlTemplateMetadata?: Readonly<Record<string, OAuth2UrlTemplateMetadataSpec>>;
252
- }
253
- /** The selected OAuth2 contract for a manifest, including non-redirect
254
- * client-credentials providers and validated provider-root templates. */
255
- declare function bundledOAuth2AuthContract(manifest: ConnectorManifest): BundledOAuth2AuthContract | undefined;
256
- /** The authorization-code OAuth2 branch of a manifest, if it has one. */
257
- declare function bundledOAuth2Auth(manifest: ConnectorManifest): (BundledOAuth2AuthContract & {
258
- grantType: 'authorization_code';
259
- authorizationUrl: string;
260
- }) | undefined;
261
- //#endregion
262
- export { PendingOAuthFlow as A, oauthClientCredentialRedactionValues as B, verifyStripeSignature as C, OAuthFlowStore as D, InMemoryOAuthFlowStore as E, consumePendingFlow as F, refreshAccessToken as H, createOAuthBasicAuthorizationHeader as I, createOAuthTokenRequestHeaders as L, StartOAuthInput as M, StartOAuthOutput as N, OAuthPkceMode as O, _resetPendingFlowsForTests as P, exchangeAuthorizationCode as R, verifySlackSignature as S, ExchangeCodeInput as T, startOAuthFlow as U, redactOAuthSensitiveText as V, TwilioVerifyOptions as _, bundledOAuth2Auth as a, verifyEmailSignature as b, hasBundledAdapter as c, DEFAULT_SIGNATURE_TOLERANCE_SECONDS as d, EmailVerifyOptions as f, StripeVerifyOptions as g, SlackVerifyOptions as h, bundledAuthMode as i, RefreshInput as j, OAuthTokens as k, listBundledAdapterKinds as l, ParsedStripeSignatureHeader as m, BundledOAuth2AuthContract as n, bundledOAuth2AuthContract as o, GenericHmacVerifyOptions as p, bundledApiKeyHint as r, getBundledAdapterManifest as s, BundledAuthMode as t, listBundledAdapterManifests as u, firstHeader as v, verifyTwilioSignature as w, verifyHmacSignature as x, parseStripeSignatureHeader as y, formEncodeOAuthClientCredential as z };
263
- //# sourceMappingURL=index-j2QziJA5.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-j2QziJA5.d.ts","names":[],"sources":["../src/connectors/oauth.ts","../src/connectors/webhooks.ts","../src/connectors/bundled-manifest-data.ts"],"mappings":";;;KAkBY;UAEK;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;EAGA;;UAKe;EACf,IAAI,eAAe,MAAM,mBAAmB;EAC5C,QAAQ,gBAAgB,QAAQ,gCAAgC;EAChE,OAAO,cAAc;EACrB,UAAU;;cAGC,kCAAkC;mBAC5B;EAEjB,IAAI,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