mcp-scraper 0.84.0 → 0.85.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/CHANGELOG.md +15 -0
- package/README.md +2 -2
- package/dist/bin/api-server.js +2 -2
- package/dist/bin/mcp-scraper-cli.js +3 -3
- package/dist/bin/mcp-scraper-core.js +6 -6
- package/dist/bin/mcp-scraper-install.js +2 -2
- package/dist/bin/mcp-stdio-server.js +6 -6
- package/dist/{chunk-WDWWCNMW.js → chunk-2ZDYUTOZ.js} +3 -3
- package/dist/{chunk-LHIWX7RM.js → chunk-6IOGTFNS.js} +1 -1
- package/dist/{chunk-ZB55UMMF.js → chunk-C7OKENCR.js} +1 -1
- package/dist/{chunk-4S6HPHPB.js → chunk-P7FWOMU7.js} +6 -9
- package/dist/{chunk-OUTE3755.js → chunk-RHAOKXQK.js} +1 -1
- package/dist/{chunk-4KFD2WXG.js → chunk-W3SGF7GX.js} +33 -7
- package/dist/{chunk-U77X4NIR.js → chunk-W4IY6CB4.js} +49 -290
- package/dist/{chunk-NLWBM55O.js → chunk-WN7N4ESQ.js} +2 -2
- package/dist/{chunk-UM7DCY6W.js → chunk-X5HRAAQM.js} +2 -2
- package/dist/{extract-bundle-SI35H4HR.js → extract-bundle-NSMGHEG6.js} +2 -2
- package/dist/{gmail-service-MOZ6S56I.js → gmail-service-BTRAHGJS.js} +2 -2
- package/dist/{server-3F3JMHBF.js → server-EOPETL7Q.js} +463 -869
- package/dist/{site-extract-repository-3WC3VB5Y.js → site-extract-repository-DWU52BRQ.js} +2 -2
- package/dist/{worker-VTFGHWZL.js → worker-5A375BGN.js} +1 -1
- package/package.json +1 -1
- package/public/.well-known/xray-install.json +5 -8
- package/public/agent-install.md +4 -8
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,21 @@ All notable changes to MCP Scraper are documented here. The format is based on [
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.85.0] - 2026-09-01
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Corrected X-Ray's public contract to a provider-neutral measurement foundation: the Pixel, seven observed attribution models, structured post-purchase surveys, explicit Observed + Reported impact, privacy lifecycle, and truthful unavailable view-evidence states remain supported.
|
|
12
|
+
- Advanced the X-Ray install protocol to 3.0.0 and removed provider authorization and revenue-source continuations from generated install guidance.
|
|
13
|
+
|
|
14
|
+
### Removed
|
|
15
|
+
|
|
16
|
+
- Removed the four revenue-source setup MCP tools, five REST operations, revenue-setup ResourceTemplate, Stripe dashboard workflow, and deployable Stripe, Salesforce, and Pipedrive Nango registrations until each provider has complete production receipts.
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Routed the public X-Ray product page and nested attribution and SaaS guides through the canonical `mcpscraper.dev` host instead of leaving the successfully deployed web routes unreachable behind the API project.
|
|
21
|
+
|
|
7
22
|
## [0.84.0] - 2026-09-01
|
|
8
23
|
|
|
9
24
|
### Added
|
package/README.md
CHANGED
|
@@ -175,7 +175,7 @@ Build the branded one-click bundle:
|
|
|
175
175
|
npm run build:mcpb
|
|
176
176
|
```
|
|
177
177
|
|
|
178
|
-
The generated bundle is written to `build/mcpb/mcp-scraper-<version>.mcpb` and copied to `public/downloads/` for the hosted download. The current public bundle is `https://mcpscraper.dev/downloads/mcp-scraper.mcpb` (`0.
|
|
178
|
+
The generated bundle is written to `build/mcpb/mcp-scraper-<version>.mcpb` and copied to `public/downloads/` for the hosted download. The current public bundle is `https://mcpscraper.dev/downloads/mcp-scraper.mcpb` (`0.85.0`, SHA-256 `2410fb6216af649dba24e62df9fa438b85e02c5ed2d3610f9e630314c0a0c2fb`). Install it by opening or dragging it into Claude Desktop. Claude displays the `MCP Scraper` install card, icon, API-key configuration field, and manually curated current-release message from the bundle manifest.
|
|
179
179
|
|
|
180
180
|
The MCPB install exposes every tool — web-intelligence plus all `browser_*` tools — through the one `mcp-scraper` server.
|
|
181
181
|
|
|
@@ -337,7 +337,7 @@ The `mcp-scraper` server (and the MCPB bundle, which runs it) exposes both secti
|
|
|
337
337
|
|
|
338
338
|
All MCP tools return `structuredContent` with the IDs, URLs, CSV paths, transcripts, browser session handles, replay paths, artifacts, recipe fields, or blueprint fields needed by the next step, plus readable text content for compatibility. Runtime `tools/list` omits output schemas so strict clients can register the complete catalog; the generated developer manifest retains every canonical output schema for validation and typed SDK generation. All tools carry MCP annotations; file-writing tools such as replay downloads and annotations state their filesystem side effects.
|
|
339
339
|
|
|
340
|
-
The canonical tool inventory is generated at `docs/mcp-tool-manifest.generated.json`. The unified server exposes
|
|
340
|
+
The canonical tool inventory is generated at `docs/mcp-tool-manifest.generated.json`. The unified server exposes 369 tools: 268 scraper, browser, workflow, billing, connected-service, and personal-assistant tools plus 101 durable-memory tools. The scraper-side inventory includes complete Gmail selection, message, attachment, export, bulk-action, and Memory-import workflows; governed personal-assistant commands, messaging, approvals, grants, number setup, and execution readback; durable PAA starts and status; rendered site-content similarity; governed Local Sourcebook and Transparent Commons workflows; direct site-export reads; Editorial Reading Room and News Publisher templates; and production X-Ray setup, analytics, seven-model attribution, structured post-purchase surveys, reported impact, truthful view-evidence status, CRM policy and receipt, campaign, export, and scheduled-report tools. Provider setup remains absent until its authorization, ingestion, reconciliation, privacy, canary, cleanup, and deployment receipts are complete. Successful evidence-compiled Local Sourcebook revisions publish automatically to their canonical `localsourcebook.com` category profile and review URLs; administrator controls handle exceptional rejection or unpublishing. Release verification compares the exact local and hosted tool-name sets, not only the count.
|
|
341
341
|
|
|
342
342
|
For contract parity, stdio and MCPB memory calls invoke the matching public tool on the hosted MCP Scraper `/mcp` endpoint. The hosted aggregate runtime owns MCP Scraper-specific billing, scheduling, credential, and in-process cutover policy; its internal `/memory/mcp-call` bridge is a fallback to the standalone memory service, not the public stdio execution path. Direct `mcp-memory` OAuth and stdio clients continue to use `memory.mcpscraper.dev` and must be verified as a separate dependent release surface.
|
|
343
343
|
|
package/dist/bin/api-server.js
CHANGED
|
@@ -17,8 +17,8 @@ loadDotEnv();
|
|
|
17
17
|
async function main() {
|
|
18
18
|
const [{ serve }, { app, personalAssistantProductionStartup }, { startWorker }, { migrate }] = await Promise.all([
|
|
19
19
|
import("@hono/node-server"),
|
|
20
|
-
import("../server-
|
|
21
|
-
import("../worker-
|
|
20
|
+
import("../server-EOPETL7Q.js"),
|
|
21
|
+
import("../worker-5A375BGN.js"),
|
|
22
22
|
import("../db-Z34LPZNR.js")
|
|
23
23
|
]);
|
|
24
24
|
const PORT = parseInt(process.env.PORT ?? "3001");
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
openWorkflowReport,
|
|
7
7
|
runWorkflow,
|
|
8
8
|
workflowOutputBaseDir
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-6IOGTFNS.js";
|
|
10
10
|
import "../chunk-RJ7JVYKU.js";
|
|
11
11
|
import "../chunk-OWF2JJKN.js";
|
|
12
12
|
import {
|
|
@@ -15,11 +15,11 @@ import {
|
|
|
15
15
|
XRAY_INSTALL_PROTOCOL_VERSION,
|
|
16
16
|
renderXraySetupPrompt,
|
|
17
17
|
xrayHostRecipe
|
|
18
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-P7FWOMU7.js";
|
|
19
19
|
import "../chunk-GGZEC22A.js";
|
|
20
20
|
import {
|
|
21
21
|
PACKAGE_VERSION
|
|
22
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-RHAOKXQK.js";
|
|
23
23
|
|
|
24
24
|
// src/cli/human-cli.ts
|
|
25
25
|
import { Command } from "commander";
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
runMcpScraperStdio
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-2ZDYUTOZ.js";
|
|
5
|
+
import "../chunk-W4IY6CB4.js";
|
|
6
6
|
import "../chunk-PGJQDMC2.js";
|
|
7
7
|
import "../chunk-DNM65UCK.js";
|
|
8
8
|
import "../chunk-T3MZISOF.js";
|
|
9
9
|
import "../chunk-6HAV7LCE.js";
|
|
10
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-X5HRAAQM.js";
|
|
11
11
|
import "../chunk-OM7HVEJ3.js";
|
|
12
12
|
import "../chunk-OPQIGAFB.js";
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-WN7N4ESQ.js";
|
|
14
|
+
import "../chunk-P7FWOMU7.js";
|
|
15
15
|
import "../chunk-GGZEC22A.js";
|
|
16
|
-
import "../chunk-
|
|
16
|
+
import "../chunk-RHAOKXQK.js";
|
|
17
17
|
import "../chunk-YXNDOQXN.js";
|
|
18
18
|
|
|
19
19
|
// src/mcp/thorbit-restricted-tool-surface.ts
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
renderInstallTerminal
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-WN7N4ESQ.js";
|
|
5
5
|
import {
|
|
6
6
|
PACKAGE_VERSION
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-RHAOKXQK.js";
|
|
8
8
|
|
|
9
9
|
// bin/mcp-scraper-install.ts
|
|
10
10
|
var noColor = process.argv.includes("--no-color") || process.env.NO_COLOR !== void 0 || process.env.FORCE_COLOR === "0" || !process.stdout.isTTY;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
runMcpScraperStdio
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-2ZDYUTOZ.js";
|
|
5
|
+
import "../chunk-W4IY6CB4.js";
|
|
6
6
|
import "../chunk-PGJQDMC2.js";
|
|
7
7
|
import "../chunk-DNM65UCK.js";
|
|
8
8
|
import "../chunk-T3MZISOF.js";
|
|
9
9
|
import "../chunk-6HAV7LCE.js";
|
|
10
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-X5HRAAQM.js";
|
|
11
11
|
import "../chunk-OM7HVEJ3.js";
|
|
12
12
|
import "../chunk-OPQIGAFB.js";
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
13
|
+
import "../chunk-WN7N4ESQ.js";
|
|
14
|
+
import "../chunk-P7FWOMU7.js";
|
|
15
15
|
import "../chunk-GGZEC22A.js";
|
|
16
|
-
import "../chunk-
|
|
16
|
+
import "../chunk-RHAOKXQK.js";
|
|
17
17
|
import "../chunk-YXNDOQXN.js";
|
|
18
18
|
|
|
19
19
|
// bin/mcp-stdio-server.ts
|
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
registerScheduledResultsMcpTools,
|
|
13
13
|
registerSerpIntelligenceCaptureTools,
|
|
14
14
|
resolveDeploymentProfile
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-W4IY6CB4.js";
|
|
16
16
|
import {
|
|
17
17
|
renderInstallTerminal
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-WN7N4ESQ.js";
|
|
19
19
|
import {
|
|
20
20
|
PACKAGE_VERSION
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-RHAOKXQK.js";
|
|
22
22
|
|
|
23
23
|
// src/mcp/stdio-runtime.ts
|
|
24
24
|
import { readFileSync } from "fs";
|
|
@@ -147,9 +147,8 @@ function extractContactEvidence(html, pageUrl) {
|
|
|
147
147
|
|
|
148
148
|
// src/mcp/xray-install-contract.ts
|
|
149
149
|
import { createHash } from "crypto";
|
|
150
|
-
var XRAY_INSTALL_PROTOCOL_VERSION = "
|
|
150
|
+
var XRAY_INSTALL_PROTOCOL_VERSION = "3.0.0";
|
|
151
151
|
var XRAY_SETUP_TOOL = "analytics_setup_site";
|
|
152
|
-
var XRAY_REVENUE_SETUP_TOOL = "analytics_setup_revenue_source";
|
|
153
152
|
var XRAY_TRIGGER_PHRASE = "Install X-Ray";
|
|
154
153
|
var XRAY_CANONICAL_GOAL = "Install X-Ray and tell me what drives customers";
|
|
155
154
|
var CONTINUATION = `Call ${XRAY_SETUP_TOOL} with { "startUrl": "<site URL>", "goal": "${XRAY_CANONICAL_GOAL}" }; on every later call, reuse the returned setupId and revision.`;
|
|
@@ -179,10 +178,8 @@ var XRAY_INSTALL_CONTRACT_PAYLOAD = {
|
|
|
179
178
|
},
|
|
180
179
|
facade: {
|
|
181
180
|
tool: XRAY_SETUP_TOOL,
|
|
182
|
-
saasRevenueTool: XRAY_REVENUE_SETUP_TOOL,
|
|
183
181
|
initialCall: { startUrl: "<site URL>", goal: XRAY_CANONICAL_GOAL },
|
|
184
|
-
continuationRule: "Treat setupId plus revision as the durable continuation handle. Reuse both after approval, runtime publication, verification, retry, or return."
|
|
185
|
-
saasContinuationRule: `When the Site setup reaches outcome_connection_required for SaaS, continue through ${XRAY_REVENUE_SETUP_TOOL} with an already-authorized connection reference. Never request or accept provider credentials.`
|
|
182
|
+
continuationRule: "Treat setupId plus revision as the durable continuation handle. Reuse both after approval, runtime publication, verification, retry, or return."
|
|
186
183
|
},
|
|
187
184
|
topologies: {
|
|
188
185
|
local_stdio: {
|
|
@@ -294,7 +291,7 @@ var XRAY_INSTALL_CONTRACT_PAYLOAD = {
|
|
|
294
291
|
"Infer the business model and customer outcome, then propose one privacy-safe measurement plan.",
|
|
295
292
|
"If the Pixel is absent, return the canonical one-time tag and exact uncovered surfaces; do not claim ongoing control there.",
|
|
296
293
|
"Publish an approved measurement revision as a digest-bound runtime manifest; source or repository access is not required.",
|
|
297
|
-
|
|
294
|
+
"For SaaS, verify the measurement foundation: global tag coverage, ad-source capture, lifecycle events, currency and timezone, consent, and observed outcome events.",
|
|
298
295
|
"Optionally publish a structured post-purchase survey after approved disclosure evidence; reported influence remains separate from deterministic touches.",
|
|
299
296
|
"Compare observed attribution with customer-reported influence only with explicit weights totaling 1,000,000 micros and a named methodology version.",
|
|
300
297
|
"Keep view-through reporting unavailable until event-level provider evidence can join to an eligible X-Ray subject; aggregate impressions never qualify.",
|
|
@@ -310,10 +307,10 @@ var XRAY_INSTALL_CONTRACT_PAYLOAD = {
|
|
|
310
307
|
"Never treat a CTA click as a customer, sale, or revenue event without verified outcome evidence.",
|
|
311
308
|
"Never claim full-domain installation while an in-scope route or renderer is missing, excluded without approval, or unverifiable.",
|
|
312
309
|
"Never treat event-name presence as verification; require persisted definition ID and version evidence.",
|
|
313
|
-
"Never accept
|
|
310
|
+
"Never accept survey invitation tokens or exchange codes through MCP inputs or prompts.",
|
|
314
311
|
"Never treat customer-reported influence as identity, CRM mutation authority, ad-activation evidence, or a deterministic touch."
|
|
315
312
|
],
|
|
316
|
-
terminalStates: ["complete", "tag_required", "input_required", "approval_required", "runtime_convergence_required", "
|
|
313
|
+
terminalStates: ["complete", "tag_required", "input_required", "approval_required", "runtime_convergence_required", "not_ready", "error"]
|
|
317
314
|
};
|
|
318
315
|
function canonicalJson(value) {
|
|
319
316
|
if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
|
|
@@ -343,7 +340,7 @@ function renderXraySetupPrompt() {
|
|
|
343
340
|
"",
|
|
344
341
|
`Use ${XRAY_SETUP_TOOL} as the single conversational setup facade. Ask for the target site URL if it is missing, then call it with the goal \u201C${XRAY_CANONICAL_GOAL}\u201D.`,
|
|
345
342
|
"",
|
|
346
|
-
|
|
343
|
+
"Continue the same setup with its setupId and revision. Confirm one global Pixel across all public rendering surfaces; present one measurement plan; publish it as a digest-bound runtime manifest after exact-revision approval; verify manifest and rule versions; then return first customer-journey answers or explicit readiness thresholds. For SaaS, verify the provider-neutral measurement foundation. Browser events never prove paid revenue. GitHub or repository access is not required after the tag is installed.",
|
|
347
344
|
"",
|
|
348
345
|
"Do not request pasted credentials, invent tracking code, silently activate measurement, call ad platforms directly, or claim customers/revenue from CTA clicks."
|
|
349
346
|
].join("\n");
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
LedgerOperation,
|
|
20
20
|
MC_PER_CREDIT,
|
|
21
21
|
calculateConnectedUsageCharge
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-X5HRAAQM.js";
|
|
23
23
|
import {
|
|
24
24
|
recordVendorUsage,
|
|
25
25
|
runWithCostContext
|
|
@@ -528,6 +528,11 @@ var NANGO_TOOL_CALL_TIMEOUT_MS = 24e4;
|
|
|
528
528
|
var NANGO_CONNECTION_PAGE_SIZE = 100;
|
|
529
529
|
var NANGO_CONNECTION_MAX_PAGES = 20;
|
|
530
530
|
var PROVIDER_IDENTITY_RETRY_MS = 6 * 60 * 60 * 1e3;
|
|
531
|
+
var WITHDRAWN_NANGO_PROVIDER_CONFIG_KEYS = /* @__PURE__ */ new Set([
|
|
532
|
+
"stripe_revenue",
|
|
533
|
+
"salesforce",
|
|
534
|
+
"pipedrive"
|
|
535
|
+
]);
|
|
531
536
|
var MAIN_INTEGRATION_CONTRACT_VERSION = "2026-07-16.1";
|
|
532
537
|
var MAIN_INTEGRATION_CONTRACT_HASH = "f037859ec80c2ea2fac6e4a67c1a59f3200dd22d3642c97789b9bb3236723d3e";
|
|
533
538
|
var MainNangoTransportError = class extends Error {
|
|
@@ -544,6 +549,18 @@ var MainNangoTransportError = class extends Error {
|
|
|
544
549
|
this.retryAfterMs = retryAfterMs;
|
|
545
550
|
}
|
|
546
551
|
};
|
|
552
|
+
function isWithdrawnNangoProvider(providerConfigKey) {
|
|
553
|
+
return typeof providerConfigKey === "string" && WITHDRAWN_NANGO_PROVIDER_CONFIG_KEYS.has(providerConfigKey.normalize("NFKC").trim().toLowerCase());
|
|
554
|
+
}
|
|
555
|
+
function assertNangoProviderAvailable(providerConfigKey) {
|
|
556
|
+
if (!isWithdrawnNangoProvider(providerConfigKey)) return;
|
|
557
|
+
throw new MainNangoTransportError(
|
|
558
|
+
"This provider integration is not currently available.",
|
|
559
|
+
409,
|
|
560
|
+
"provider_unavailable",
|
|
561
|
+
false
|
|
562
|
+
);
|
|
563
|
+
}
|
|
547
564
|
function nangoClientErrorText(error) {
|
|
548
565
|
if (error instanceof Error) return error.message;
|
|
549
566
|
if (typeof error === "string") return error;
|
|
@@ -907,12 +924,13 @@ async function discoverOwnedNangoConnections(identity, options = {}) {
|
|
|
907
924
|
}
|
|
908
925
|
const discovered = rows.filter((row) => connectionIdentityMatches(row, identity)).map(discoveredConnection).filter((connection) => connection !== null);
|
|
909
926
|
const reconciled = await reconcileDiscoveredNangoConnections(identity, discovered);
|
|
910
|
-
|
|
927
|
+
const visibleConnections = reconciled.filter((connection) => !isWithdrawnNangoProvider(connection.providerConfigKey));
|
|
928
|
+
if (options.resolveProviderIdentity === false) return visibleConnections;
|
|
911
929
|
const remoteByKey = new Map(discovered.map((connection) => [
|
|
912
930
|
`${connection.providerConfigKey}\0${connection.upstreamConnectionId}`,
|
|
913
931
|
connection
|
|
914
932
|
]));
|
|
915
|
-
await Promise.all(
|
|
933
|
+
await Promise.all(visibleConnections.map(async (connection) => {
|
|
916
934
|
if (connection.lifecycleStatus !== "connected" || !connection.upstreamConnectionId) return;
|
|
917
935
|
const remote = remoteByKey.get(`${connection.providerConfigKey}\0${connection.upstreamConnectionId}`);
|
|
918
936
|
if (!remote) return;
|
|
@@ -935,7 +953,7 @@ async function discoverOwnedNangoConnections(identity, options = {}) {
|
|
|
935
953
|
sourceUpdatedAt
|
|
936
954
|
});
|
|
937
955
|
}));
|
|
938
|
-
return reconcileDiscoveredNangoConnections(identity, discovered);
|
|
956
|
+
return (await reconcileDiscoveredNangoConnections(identity, discovered)).filter((connection) => !isWithdrawnNangoProvider(connection.providerConfigKey));
|
|
939
957
|
}
|
|
940
958
|
async function listNangoCatalogDirect() {
|
|
941
959
|
const [integrationsPayload, providersPayload] = await Promise.all([
|
|
@@ -952,7 +970,7 @@ async function listNangoCatalogDirect() {
|
|
|
952
970
|
const row = asRecord(value);
|
|
953
971
|
const id = text(row?.unique_key) ?? text(row?.id);
|
|
954
972
|
const provider = text(row?.provider);
|
|
955
|
-
if (!id || !provider) return [];
|
|
973
|
+
if (!id || !provider || isWithdrawnNangoProvider(id)) return [];
|
|
956
974
|
const definition = providers.get(provider);
|
|
957
975
|
return [{
|
|
958
976
|
id,
|
|
@@ -986,6 +1004,7 @@ function sessionPayload(value) {
|
|
|
986
1004
|
return { connectLink, expiresAt: text(data?.expires_at) };
|
|
987
1005
|
}
|
|
988
1006
|
async function createNangoSessionDirect(identity, providerConfigKey) {
|
|
1007
|
+
assertNangoProviderAvailable(providerConfigKey);
|
|
989
1008
|
const defaults = connectDefaults(providerConfigKey);
|
|
990
1009
|
return sessionPayload(await nangoRequest("/connect/sessions", {
|
|
991
1010
|
method: "POST",
|
|
@@ -1010,7 +1029,7 @@ async function createNangoReconnectSessionDirect(identity, connectionId) {
|
|
|
1010
1029
|
}));
|
|
1011
1030
|
}
|
|
1012
1031
|
async function deleteNangoConnectionDirect(identity, connectionId) {
|
|
1013
|
-
const connection = await
|
|
1032
|
+
const connection = await requireOwnedNangoConnectionForCleanup(identity, connectionId);
|
|
1014
1033
|
try {
|
|
1015
1034
|
await nangoRequest(`/connections/${encodeURIComponent(connection.upstreamConnectionId)}`, {
|
|
1016
1035
|
method: "DELETE",
|
|
@@ -1020,11 +1039,16 @@ async function deleteNangoConnectionDirect(identity, connectionId) {
|
|
|
1020
1039
|
if (!(error instanceof MainNangoTransportError) || error.status !== 404) throw error;
|
|
1021
1040
|
}
|
|
1022
1041
|
}
|
|
1023
|
-
async function
|
|
1042
|
+
async function requireOwnedNangoConnectionForCleanup(identity, connectionId) {
|
|
1024
1043
|
const connection = await getOwnedServiceConnection(identity, connectionId);
|
|
1025
1044
|
if (!connection || connection.transport !== "nango" || !connection.upstreamConnectionId) {
|
|
1026
1045
|
throw new MainNangoTransportError("Service connection not found.", 404, "connection_not_found", false);
|
|
1027
1046
|
}
|
|
1047
|
+
return connection;
|
|
1048
|
+
}
|
|
1049
|
+
async function requireOwnedActiveConnection(identity, connectionId, allowNeedsReauth = false) {
|
|
1050
|
+
const connection = await requireOwnedNangoConnectionForCleanup(identity, connectionId);
|
|
1051
|
+
assertNangoProviderAvailable(connection.providerConfigKey);
|
|
1028
1052
|
if (connection.lifecycleStatus !== "connected" && !(allowNeedsReauth && connection.lifecycleStatus === "needs_reauth")) {
|
|
1029
1053
|
throw new MainNangoTransportError("Service connection requires reconnection.", 409, "connection_inactive", false);
|
|
1030
1054
|
}
|
|
@@ -2028,6 +2052,8 @@ export {
|
|
|
2028
2052
|
settleConnectedUsage,
|
|
2029
2053
|
listConnectedUsageHistory,
|
|
2030
2054
|
MainNangoTransportError,
|
|
2055
|
+
isWithdrawnNangoProvider,
|
|
2056
|
+
assertNangoProviderAvailable,
|
|
2031
2057
|
discoverOwnedNangoConnections,
|
|
2032
2058
|
listNangoCatalogDirect,
|
|
2033
2059
|
createNangoSessionDirect,
|