@jskit-ai/connectors-catalog 0.2.40 → 0.2.42
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 +1 -0
- package/docs/linkedin.md +3 -1
- package/docs/oura.md +4 -1
- package/package.json +3 -3
- package/patterns/api-key-connection/PATTERN.md +4 -1
- package/patterns/api-key-connection/example/connections.js +3 -3
- package/patterns/firebase-messaging/example/server/notifications.js +3 -3
- package/patterns/oauth-connection/PATTERN.md +3 -1
- package/src/server/sideEffect.js +1 -1
- package/test/airtable.test.js +1 -0
- package/test/algolia.test.js +4 -4
- package/test/amazon-redshift.test.js +7 -7
- package/test/amplitude.test.js +3 -3
- package/test/apify.test.js +1 -0
- package/test/apollo-io.test.js +1 -0
- package/test/asana.test.js +1 -1
- package/test/ashby.test.js +1 -1
- package/test/atlassian.test.js +3 -3
- package/test/attention.test.js +1 -1
- package/test/aws.test.js +13 -13
- package/test/brevo.test.js +1 -1
- package/test/calendly.test.js +3 -3
- package/test/canva.test.js +3 -3
- package/test/chargebee.test.js +4 -4
- package/test/clickhouse.test.js +10 -10
- package/test/confidence.test.js +5 -5
- package/test/databricks.test.js +7 -7
- package/test/dbt-semantic-layer.test.js +3 -3
- package/test/designMcp.test.js +4 -4
- package/test/elevenlabs.test.js +1 -0
- package/test/firebase-cloud-messaging.test.js +4 -4
- package/test/firecrawl.test.js +1 -0
- package/test/gemini-enterprise.test.js +4 -4
- package/test/github-api.test.js +3 -2
- package/test/gitlab-api.test.js +5 -4
- package/test/gong.test.js +4 -4
- package/test/google-ads.test.js +9 -9
- package/test/google-maps-platform.test.js +3 -3
- package/test/google.test.js +5 -5
- package/test/granola.test.js +5 -5
- package/test/hex.test.js +3 -3
- package/test/heygen.test.js +3 -3
- package/test/hubspot.test.js +2 -2
- package/test/inngest.test.js +4 -4
- package/test/lightspeed.test.js +6 -6
- package/test/linear.test.js +3 -3
- package/test/linkedin.test.js +6 -6
- package/test/logo-dev.test.js +1 -1
- package/test/mailgun.test.js +1 -1
- package/test/mapbox.test.js +3 -3
- package/test/mcp.test.js +5 -5
- package/test/microsoft-fabric.test.js +7 -7
- package/test/microsoft.test.js +5 -5
- package/test/n8nOAuth.test.js +4 -4
- package/test/notionOAuth.test.js +6 -6
- package/test/oura.test.js +5 -5
- package/test/paddlePermissions.test.js +2 -1
- package/test/pipedriveOAuth.test.js +1 -1
- package/test/posthog.test.js +4 -4
- package/test/prestashop.test.js +6 -6
- package/test/resend.test.js +1 -1
- package/test/salesforce.test.js +8 -8
- package/test/semrush.test.js +10 -10
- package/test/shopify.test.js +10 -10
- package/test/slack.test.js +5 -5
- package/test/snowflake.test.js +7 -7
- package/test/tally.test.js +1 -0
- package/test/telegram.test.js +1 -1
- package/test/tiktok.test.js +7 -7
- package/test/tokens.test.js +18 -18
- package/test/twilio.test.js +5 -5
- package/test/twitch.test.js +4 -4
- package/test/wave.test.js +5 -5
- package/test/wix.test.js +4 -4
- package/test/wordpress-com.test.js +3 -3
- package/test/wordpress.test.js +5 -5
- package/test/workday.test.js +4 -4
- package/test/x-twitter.test.js +5 -5
- package/test/xero.test.js +18 -18
- package/test/zoho-books.test.js +5 -5
- package/test/zoho-crm.test.js +5 -5
package/test/granola.test.js
CHANGED
|
@@ -49,7 +49,7 @@ async function fixture(t) {
|
|
|
49
49
|
return Response.json(state.value === undefined ? value : state.value, { status: state.status });
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
const service = createConnectionService(options);
|
|
52
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
53
53
|
return { service, options, directory, state, requests, connect: () => service.connectApiKey(args) };
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -57,7 +57,7 @@ test("Granola verifies a key, encrypts connection files and reads current bindin
|
|
|
57
57
|
const f = await fixture(t); assert.equal((await f.connect()).status, "connected");
|
|
58
58
|
assert.equal(f.requests[0].url.pathname, "/v1/notes"); assert.equal(f.requests[0].url.searchParams.get("page_size"), "10");
|
|
59
59
|
for (const name of await readdir(f.directory)) assert.equal((await readFile(path.join(f.directory, name), "utf8")).includes(f.state.key), false);
|
|
60
|
-
const restarted = createConnectionService(f.options); assert.equal((await restarted.status(args)).status, "connected");
|
|
60
|
+
const restarted = createConnectionService({ appEnv: "test", ...f.options }); assert.equal((await restarted.status(args)).status, "connected");
|
|
61
61
|
f.state.key = "grn_rotated-key";
|
|
62
62
|
assert.deepEqual(await restarted.invoke({ ...args, operation: "notes.get", input: { note_id: noteId } }), note);
|
|
63
63
|
assert.equal(f.requests.at(-1).url.search, "");
|
|
@@ -127,7 +127,7 @@ test("Granola isolates owners, honors host policy and preserves a saved connecti
|
|
|
127
127
|
for (const owner of [{ ...context, applicationId: "other" }, { ...context, subjectId: "other" }]) {
|
|
128
128
|
await assert.rejects(f.service.invoke({ ...args, context: owner, operation: "notes.list" }), { code: "connector_reconnect_required" });
|
|
129
129
|
}
|
|
130
|
-
const denied = createConnectionService({ ...f.options, authorize: async () => null });
|
|
130
|
+
const denied = createConnectionService({ appEnv: "test", ...f.options, authorize: async () => null });
|
|
131
131
|
await assert.rejects(denied.invoke({ ...args, operation: "notes.list" }), { code: "connector_access_denied" });
|
|
132
132
|
for (const key of ["plain-key", "grn_", "grn_secret\nvalue"]) {
|
|
133
133
|
f.state.key = key; await assert.rejects(f.connect(), { code: "connector_binding_missing" });
|
|
@@ -194,7 +194,7 @@ test("Granola MCP OAuth verifies tools, refreshes after restart and cannot call
|
|
|
194
194
|
return Response.json({ jsonrpc: "2.0", id: message.id, result });
|
|
195
195
|
}
|
|
196
196
|
};
|
|
197
|
-
const service = createConnectionService(options);
|
|
197
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
198
198
|
const start = await service.beginAuthorization(args); const url = new URL(start.authorizationUrl);
|
|
199
199
|
assert.equal(url.origin + url.pathname, "https://mcp-auth.granola.ai/oauth2/authorize");
|
|
200
200
|
assert.equal(url.searchParams.get("code_challenge_method"), "S256");
|
|
@@ -206,7 +206,7 @@ test("Granola MCP OAuth verifies tools, refreshes after restart and cannot call
|
|
|
206
206
|
assert.equal(calls.length, before);
|
|
207
207
|
await assert.rejects(service.completeAuthorization(completion));
|
|
208
208
|
time += 61000;
|
|
209
|
-
const restarted = createConnectionService(options);
|
|
209
|
+
const restarted = createConnectionService({ appEnv: "test", ...options });
|
|
210
210
|
assert.deepEqual(await restarted.invoke({ ...args, operation: "tools.list" }), { tools: [] });
|
|
211
211
|
assert.equal(calls.filter((call) => call.url.endsWith("/token")).length, 2);
|
|
212
212
|
assert.deepEqual(await restarted.invoke({ ...args, operation: "tools.call", input: { name: "get_account_info", arguments: {} } }),
|
package/test/hex.test.js
CHANGED
|
@@ -60,7 +60,7 @@ async function fixture(t, endpoint = "standard") {
|
|
|
60
60
|
return Response.json({ jsonrpc: "2.0", id: message.id, result }, { headers: { "Mcp-Session-Id": "hex-session" } });
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
|
-
const service = createConnectionService(options);
|
|
63
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
64
64
|
const complete = async (start, extra = "code=fixture-code") => service.completeAuthorization({ ...input,
|
|
65
65
|
callbackUrl: `${callback}?state=${new URL(start.authorizationUrl).searchParams.get("state")}&${extra}` });
|
|
66
66
|
return { service, options, state, requests, origin, issuer, directory, protection, complete };
|
|
@@ -89,7 +89,7 @@ for (const endpoint of ["standard", "eu", "hipaa"]) {
|
|
|
89
89
|
assert.equal(request.init.redirect, "error");
|
|
90
90
|
assert.equal(request.init.credentials, "omit");
|
|
91
91
|
}
|
|
92
|
-
const restarted = createConnectionService({ ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
92
|
+
const restarted = createConnectionService({ appEnv: "test", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
93
93
|
state.time += 61_000;
|
|
94
94
|
assert.deepEqual(await restarted.invoke({ ...input, operation: "tools.list" }), discovery);
|
|
95
95
|
const refresh = new URLSearchParams(requests.findLast(({ url }) => url.endsWith("/token")).init.body);
|
|
@@ -124,7 +124,7 @@ test("Hex configuration and changed endpoints cannot bypass account ownership or
|
|
|
124
124
|
const start = await service.beginAuthorization(input);
|
|
125
125
|
const config = structuredClone(options.configuration);
|
|
126
126
|
config.integrations.analysis.settings.endpoint = "eu";
|
|
127
|
-
const changed = createConnectionService({ ...options, configuration: config });
|
|
127
|
+
const changed = createConnectionService({ appEnv: "test", ...options, configuration: config });
|
|
128
128
|
await assert.rejects(changed.completeAuthorization({ ...input, callbackUrl: `${callback}?code=x&state=${new URL(start.authorizationUrl).searchParams.get("state")}` }), { code: "connector_attempt_invalid" });
|
|
129
129
|
assert.equal(requests.length, 0);
|
|
130
130
|
await complete(await service.beginAuthorization(input));
|
package/test/heygen.test.js
CHANGED
|
@@ -26,7 +26,7 @@ async function fixture(t) {
|
|
|
26
26
|
return Response.json({ data: { username: "fixture" } });
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
const service = createConnectionService(options);
|
|
29
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
30
30
|
return { service, options, requests, connect: () => service.connectApiKey(args) };
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -74,7 +74,7 @@ test("HeyGen MCP OAuth verifies tools, refreshes after restart and cannot call A
|
|
|
74
74
|
return Response.json({ jsonrpc: "2.0", id: message.id, result });
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
|
-
const service = createConnectionService(options);
|
|
77
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
78
78
|
const start = await service.beginAuthorization(args); const url = new URL(start.authorizationUrl);
|
|
79
79
|
assert.equal(url.origin + url.pathname, "https://api2.heygen.com/v1/oauth/authorize");
|
|
80
80
|
assert.equal(url.searchParams.get("code_challenge_method"), "S256");
|
|
@@ -86,7 +86,7 @@ test("HeyGen MCP OAuth verifies tools, refreshes after restart and cannot call A
|
|
|
86
86
|
assert.equal(calls.length, before);
|
|
87
87
|
await assert.rejects(service.completeAuthorization(completion));
|
|
88
88
|
time += 61000;
|
|
89
|
-
const restarted = createConnectionService(options);
|
|
89
|
+
const restarted = createConnectionService({ appEnv: "test", ...options });
|
|
90
90
|
assert.deepEqual(await restarted.invoke({ ...args, operation: "tools.list" }), { tools });
|
|
91
91
|
assert.equal(calls.filter((call) => call.url.endsWith("/token")).length, 2);
|
|
92
92
|
const creation = await restarted.invoke({ ...args, operation: "tools.call", input: { name: "create_video_agent", arguments: { prompt: "A booking reminder" } } });
|
package/test/hubspot.test.js
CHANGED
|
@@ -46,7 +46,7 @@ for (const perUser of [false, true]) test(`HubSpot OAuth ${perUser ? "per-user"
|
|
|
46
46
|
return Response.json({ results: [{ id: "123" }] });
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
const service = createConnectionService(options);
|
|
49
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
50
50
|
for (const outcome of ["cancel", "denied"]) {
|
|
51
51
|
const attempt = new URL((await service.beginAuthorization(input)).authorizationUrl);
|
|
52
52
|
const denied = new URL(callback);
|
|
@@ -73,7 +73,7 @@ for (const perUser of [false, true]) test(`HubSpot OAuth ${perUser ? "per-user"
|
|
|
73
73
|
time += 40_000;
|
|
74
74
|
await Promise.all([service.invoke({ ...input, operation: "contacts.list" }), service.invoke({ ...input, operation: "contacts.list" })]);
|
|
75
75
|
assert.equal(exchanges, 2);
|
|
76
|
-
const restarted = createConnectionService({ ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
76
|
+
const restarted = createConnectionService({ appEnv: "test", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
77
77
|
time += 40_000;
|
|
78
78
|
await restarted.invoke({ ...input, operation: "contacts.list" });
|
|
79
79
|
assert.equal(exchanges, 3);
|
package/test/inngest.test.js
CHANGED
|
@@ -49,7 +49,7 @@ async function fixture(t) {
|
|
|
49
49
|
{ status: state.httpStatus, headers: { Location: "https://unexpected.example", Link: '<https://unexpected.example/next>; rel="next"' } });
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
return { service: createConnectionService({ ...options,
|
|
52
|
+
return { service: createConnectionService({ ...options, appEnv: "production" }), options, directory, protection, state, requests, resolved };
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
test("Inngest verifies only signing-key metadata and keeps both credential values out of file state", async (t) => {
|
|
@@ -67,7 +67,7 @@ test("Inngest verifies only signing-key metadata and keeps both credential value
|
|
|
67
67
|
assert.equal(text.includes(state.eventKey), false);
|
|
68
68
|
assert.equal(text.includes(state.signing), false);
|
|
69
69
|
}
|
|
70
|
-
const restarted = createConnectionService({
|
|
70
|
+
const restarted = createConnectionService({ appEnv: "production", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
71
71
|
assert.deepEqual(await restarted.status(input), connection);
|
|
72
72
|
for (const owner of [{ ...context, applicationId: "different-app" }, { ...context, subjectId: "different-owner" }]) {
|
|
73
73
|
await assert.rejects(restarted.invoke({ ...input, context: owner, operation: "events.send", input: event }), { code: "connector_reconnect_required" });
|
|
@@ -189,7 +189,7 @@ test("Inngest reference and branch changes require reverification, including bra
|
|
|
189
189
|
const config = structuredClone(options.configuration);
|
|
190
190
|
Object.assign(config.integrations.jobs.settings, changes);
|
|
191
191
|
for (const [name, value] of Object.entries(changes)) if (value === undefined) delete config.integrations.jobs.settings[name];
|
|
192
|
-
const changed = createConnectionService({
|
|
192
|
+
const changed = createConnectionService({ appEnv: "production", ...options, configuration: config });
|
|
193
193
|
const count = requests.length;
|
|
194
194
|
assert.equal((await changed.status(input)).status, "reconnect-required");
|
|
195
195
|
await assert.rejects(changed.invoke({ ...input, operation: "events.send", input: event }), { code: "connector_reconnect_required" });
|
|
@@ -197,7 +197,7 @@ test("Inngest reference and branch changes require reverification, including bra
|
|
|
197
197
|
}
|
|
198
198
|
const config = structuredClone(options.configuration);
|
|
199
199
|
delete config.integrations.jobs.settings.branchEnvironment;
|
|
200
|
-
const changed = createConnectionService({
|
|
200
|
+
const changed = createConnectionService({ appEnv: "production", ...options, configuration: config });
|
|
201
201
|
await changed.connectApiKey(input);
|
|
202
202
|
await changed.invoke({ ...input, operation: "events.send", input: event });
|
|
203
203
|
assert.equal(requests.at(-1).headers.get("x-inngest-env"), null);
|
package/test/lightspeed.test.js
CHANGED
|
@@ -57,7 +57,7 @@ async function fixture(t, domainPrefix = "fixture-store", selectedScopes = scope
|
|
|
57
57
|
return Response.json(state.value === undefined ? page : state.value, { status: state.status });
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
|
-
const service = createConnectionService(options);
|
|
60
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
61
61
|
const start = async () => {
|
|
62
62
|
const { authorizationUrl } = await service.beginAuthorization({ ...args, verificationInput: { page_size: 1 } }); const url = new URL(authorizationUrl);
|
|
63
63
|
const redirect = new URL(callback); redirect.searchParams.set("code", "fixture-code"); redirect.searchParams.set("state", url.searchParams.get("state"));
|
|
@@ -81,7 +81,7 @@ test("Lightspeed uses central code consent, a configured store token endpoint an
|
|
|
81
81
|
const text = await readFile(path.join(f.directory, file), "utf8");
|
|
82
82
|
for (const secret of ["fixture-code", "fixture-client-secret", "fixture-access-1", "fixture-refresh-1"]) assert.equal(text.includes(secret), false);
|
|
83
83
|
}
|
|
84
|
-
const restarted = createConnectionService(f.options);
|
|
84
|
+
const restarted = createConnectionService({ appEnv: "test", ...f.options });
|
|
85
85
|
assert.equal((await restarted.status(args)).status, "connected");
|
|
86
86
|
assert.deepEqual(await restarted.invoke({ ...args, operation: "products.list" }), page);
|
|
87
87
|
});
|
|
@@ -119,7 +119,7 @@ test("Lightspeed uses actual granted scopes and host ownership before any store
|
|
|
119
119
|
for (const owner of [{ ...context, applicationId: "other" }, { ...context, subjectId: "other" }]) {
|
|
120
120
|
await assert.rejects(f.service.invoke({ ...args, context: owner, operation: "products.list" }), { code: "connector_reconnect_required" });
|
|
121
121
|
}
|
|
122
|
-
const denied = createConnectionService({ ...f.options, authorize: async () => null });
|
|
122
|
+
const denied = createConnectionService({ appEnv: "test", ...f.options, authorize: async () => null });
|
|
123
123
|
await assert.rejects(denied.invoke({ ...args, operation: "products.list" }), { code: "connector_access_denied" });
|
|
124
124
|
assert.equal(f.requests.length, 2);
|
|
125
125
|
const reduced = await fixture(t); reduced.state.tokenPatch.scope = "customers:read";
|
|
@@ -134,7 +134,7 @@ test("Lightspeed persists every rotated refresh token even if the subsequent API
|
|
|
134
134
|
f.state.time += 40_000; f.state.status = 429;
|
|
135
135
|
await assert.rejects(f.service.invoke({ ...args, operation: "products.list" }), { code: "connector_rate_limited" });
|
|
136
136
|
f.state.status = 200;
|
|
137
|
-
const restarted = createConnectionService(f.options); await restarted.invoke({ ...args, operation: "products.list" });
|
|
137
|
+
const restarted = createConnectionService({ appEnv: "test", ...f.options }); await restarted.invoke({ ...args, operation: "products.list" });
|
|
138
138
|
assert.equal(f.state.count, 3); assert.deepEqual((await restarted.status(args)).grantedScopes, scopes);
|
|
139
139
|
f.state.time += 40_000; await restarted.invoke({ ...args, operation: "customers.list" }); assert.equal(f.state.count, 4);
|
|
140
140
|
});
|
|
@@ -162,7 +162,7 @@ test("Lightspeed requires scopes, expiry and replacement refresh tokens from suc
|
|
|
162
162
|
test("Lightspeed configuration changes invalidate grants and denied, cancelled or replayed consent preserves saved access", async (t) => {
|
|
163
163
|
const f = await fixture(t); await f.connect();
|
|
164
164
|
const configuration = structuredClone(f.options.configuration); configuration.integrations.retail.settings.domainPrefix = "other-store";
|
|
165
|
-
await assert.rejects(createConnectionService({ ...f.options, configuration }).invoke({ ...args, operation: "products.list" }), { code: "connector_reconnect_required" });
|
|
165
|
+
await assert.rejects(createConnectionService({ appEnv: "test", ...f.options, configuration }).invoke({ ...args, operation: "products.list" }), { code: "connector_reconnect_required" });
|
|
166
166
|
const start = await f.start(); const denied = new URL(start.callbackUrl); denied.searchParams.delete("code"); denied.searchParams.set("error", "access_denied");
|
|
167
167
|
await assert.rejects(f.service.completeAuthorization({ ...args, callbackUrl: denied.href }), { code: "connector_consent_denied" });
|
|
168
168
|
await assert.rejects(f.service.completeAuthorization({ ...args, callbackUrl: start.callbackUrl }), { code: "connector_attempt_invalid" });
|
|
@@ -239,7 +239,7 @@ test("Lightspeed inventory and sales preserve quantities, paging and permission
|
|
|
239
239
|
const before = f.requests.length;
|
|
240
240
|
for (const invalid of [{ variants: true }, { after: 2, before: 1 }, { size: 1001 }, { product_id: "../other" }])
|
|
241
241
|
await assert.rejects(f.service.invoke({ ...args, operation: "inventory.list", input: invalid }), { code: "connector_input_invalid" });
|
|
242
|
-
const denied = createConnectionService({ ...f.options, authorize: async (owner, request) => request.operation === "sales.list" ? null : owner });
|
|
242
|
+
const denied = createConnectionService({ appEnv: "test", ...f.options, authorize: async (owner, request) => request.operation === "sales.list" ? null : owner });
|
|
243
243
|
await assert.rejects(denied.invoke({ ...args, operation: "sales.list" }), { code: "connector_access_denied" });
|
|
244
244
|
assert.equal(f.requests.length, before);
|
|
245
245
|
for (const malformed of [{ data: [] }, [{ version: "unknown" }], [{ version: 1 }, { version: 2 }]]) {
|
package/test/linear.test.js
CHANGED
|
@@ -65,7 +65,7 @@ for (const perUser of [false, true]) test(`Linear OAuth ${perUser ? "per-user" :
|
|
|
65
65
|
return Response.json({ data: { viewer: { id: "123", name: "Fixture" } } });
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
|
-
const service = createConnectionService(options);
|
|
68
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
69
69
|
for (const outcome of ["cancel", "denied"]) {
|
|
70
70
|
const attempt = new URL((await service.beginAuthorization(input)).authorizationUrl);
|
|
71
71
|
const denied = new URL(callback);
|
|
@@ -93,7 +93,7 @@ for (const perUser of [false, true]) test(`Linear OAuth ${perUser ? "per-user" :
|
|
|
93
93
|
time += 40_000;
|
|
94
94
|
await Promise.all([service.invoke({ ...input, operation: "profile.read" }), service.invoke({ ...input, operation: "profile.read" })]);
|
|
95
95
|
assert.equal(exchanges, 2);
|
|
96
|
-
const restarted = createConnectionService({ ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
96
|
+
const restarted = createConnectionService({ appEnv: "test", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
97
97
|
time += 40_000;
|
|
98
98
|
await restarted.invoke({ ...input, operation: "profile.read" });
|
|
99
99
|
assert.equal(exchanges, 3);
|
|
@@ -110,7 +110,7 @@ for (const perUser of [false, true]) test(`Linear OAuth ${perUser ? "per-user" :
|
|
|
110
110
|
assert.deepEqual(toolCalls.at(-1).arguments, { projectId: "project-1", id: "issue-1", title: "Ship today" });
|
|
111
111
|
assert.equal((await call("fixture_save_issue", { fail: true })).isError, true);
|
|
112
112
|
}
|
|
113
|
-
const guarded = createConnectionService({ ...options, authorize: async (owner, request) =>
|
|
113
|
+
const guarded = createConnectionService({ appEnv: "test", ...options, authorize: async (owner, request) =>
|
|
114
114
|
request.operation === "tools.call" && (request.input.name !== "fixture_save_issue" || request.input.arguments.projectId !== "project-1") ? null : owner });
|
|
115
115
|
const beforeDenied = toolCalls.length;
|
|
116
116
|
for (const args of [{ name: "fixture_create_project", arguments: {} }, { name: "fixture_save_issue", arguments: { projectId: "foreign" } }]) {
|
package/test/linkedin.test.js
CHANGED
|
@@ -55,7 +55,7 @@ async function fixture(t) {
|
|
|
55
55
|
return Response.json(state.response, { status: state.status });
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
const service = createConnectionService({ ...options,
|
|
58
|
+
const service = createConnectionService({ ...options, appEnv: "production" });
|
|
59
59
|
async function start() {
|
|
60
60
|
const { authorizationUrl } = await service.beginAuthorization(input);
|
|
61
61
|
const url = new URL(authorizationUrl); const redirect = new URL(callback);
|
|
@@ -100,7 +100,7 @@ test("LinkedIn uses confidential Web OAuth, validates userinfo and persists only
|
|
|
100
100
|
const text = await readFile(path.join(directory, name), "utf8");
|
|
101
101
|
for (const secret of ["fixture-client-secret", "fixture-access-1", "unused-identity-token"]) assert.equal(text.includes(secret), false);
|
|
102
102
|
}
|
|
103
|
-
const restarted = createConnectionService({
|
|
103
|
+
const restarted = createConnectionService({ appEnv: "production", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
104
104
|
assert.deepEqual(await restarted.invoke({ ...input, operation: "profile.read" }), state.response);
|
|
105
105
|
state.response = { sub: "member-1", email: "member@example.test", email_verified: false };
|
|
106
106
|
assert.deepEqual(await restarted.invoke({ ...input, operation: "profile.read" }), state.response);
|
|
@@ -185,7 +185,7 @@ test("LinkedIn sanitizes API failures and handles provider cancellation and time
|
|
|
185
185
|
state.stall = true;
|
|
186
186
|
const controller = new AbortController(); controller.abort();
|
|
187
187
|
await assert.rejects(service.invoke({ ...input, operation: "profile.read", signal: controller.signal }), { code: "connector_cancelled" });
|
|
188
|
-
const timeoutService = createConnectionService({
|
|
188
|
+
const timeoutService = createConnectionService({ appEnv: "production", ...options, providers: [{ ...provider, requestTimeoutMs: 20 }] });
|
|
189
189
|
const keepAlive = setTimeout(() => {}, 1000);
|
|
190
190
|
try { await assert.rejects(timeoutService.invoke({ ...input, operation: "profile.read" }), { code: "connector_provider_timeout" }); }
|
|
191
191
|
finally { clearTimeout(keepAlive); }
|
|
@@ -200,9 +200,9 @@ test("LinkedIn respects host policy, registration identity and unavailable manag
|
|
|
200
200
|
const count = state.calls.length; state.deny = true;
|
|
201
201
|
await assert.rejects(service.invoke({ ...input, operation: "profile.read" })); assert.equal(state.calls.length, count); state.deny = false;
|
|
202
202
|
const changed = structuredClone(configuration); changed.registrations.linkedin.clientId = "other-client";
|
|
203
|
-
await assert.rejects(createConnectionService({
|
|
203
|
+
await assert.rejects(createConnectionService({ appEnv: "production", ...options, configuration: changed }).invoke({ ...input, operation: "profile.read" }), { code: "connector_reconnect_required" });
|
|
204
204
|
changed.registrations.linkedin = { source: "managed", serviceUrlRef: "env:GATEWAY", serviceCredentialRef: "env:GATEWAY_KEY", assignmentRef: "shared" };
|
|
205
|
-
assert.throws(() => createConnectionService({
|
|
205
|
+
assert.throws(() => createConnectionService({ appEnv: "production", ...options, configuration: changed }), { code: "integration_configuration_invalid" });
|
|
206
206
|
assert.equal(state.calls.length, count);
|
|
207
207
|
});
|
|
208
208
|
|
|
@@ -215,7 +215,7 @@ test("LinkedIn's documented portable JSON validates unchanged", async () => {
|
|
|
215
215
|
test("LinkedIn publishes text as the connected member and respects host policy without retries", async (t) => {
|
|
216
216
|
const f = await fixture(t); f.configuration.integrations.linkedin.scopes.push("w_member_social");
|
|
217
217
|
f.state.scope += " w_member_social";
|
|
218
|
-
const service = createConnectionService({ ...f.options,
|
|
218
|
+
const service = createConnectionService({ ...f.options, appEnv: "production" });
|
|
219
219
|
const auth = new URL((await service.beginAuthorization(input)).authorizationUrl);
|
|
220
220
|
const returned = new URL(callback); returned.searchParams.set("code", "code"); returned.searchParams.set("state", auth.searchParams.get("state"));
|
|
221
221
|
await service.completeAuthorization({ ...input, callbackUrl: returned.href });
|
package/test/logo-dev.test.js
CHANGED
|
@@ -45,7 +45,7 @@ test("Logo.dev shares source configuration with the editor and never treats URL
|
|
|
45
45
|
const invalid = structuredClone(configuration);
|
|
46
46
|
invalid.integrations.logos.authentication.secretRef = "pk_should-not-be-in-source";
|
|
47
47
|
assert.throws(() => parse(invalid), (error) => Boolean(error.fieldErrors["integrations.logos.authentication.secretRef"]));
|
|
48
|
-
const service = createConnectionService({ configuration, providers: [logoDevDefinition],
|
|
48
|
+
const service = createConnectionService({ appEnv: "test", configuration, providers: [logoDevDefinition],
|
|
49
49
|
authorize: async (context) => context,
|
|
50
50
|
resolveReference: async () => assert.fail("Image URL configuration must not resolve private credentials through server verification."),
|
|
51
51
|
store: { withConnection: async () => assert.fail("No connection record should be written.") },
|
package/test/mailgun.test.js
CHANGED
|
@@ -17,7 +17,7 @@ async function fixture(t, region = "us") {
|
|
|
17
17
|
t.after(() => rm(directory, { recursive: true, force: true }));
|
|
18
18
|
const requests = [];
|
|
19
19
|
const state = { fail: false, status: 200, malformed: false, deny: false };
|
|
20
|
-
const service = createConnectionService({
|
|
20
|
+
const service = createConnectionService({ appEnv: "production",
|
|
21
21
|
configuration: { schemaVersion: 1, registrations: {}, integrations: { mail: {
|
|
22
22
|
provider: "mailgun", accountMode: "shared", scopes: [], settings: { region },
|
|
23
23
|
authentication: { method: "api-key", secretRef: "env:MAILGUN_KEY" }
|
package/test/mapbox.test.js
CHANGED
|
@@ -36,7 +36,7 @@ async function fixture(t) {
|
|
|
36
36
|
return Response.json(state.response, { status: state.status });
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
return { service: createConnectionService(options), options, directory, protection, requests, state };
|
|
39
|
+
return { service: createConnectionService({ appEnv: "test", ...options }), options, directory, protection, requests, state };
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
test("Mapbox verifies an active token, persists only references and isolates application owners", async (t) => {
|
|
@@ -49,7 +49,7 @@ test("Mapbox verifies an active token, persists only references and isolates app
|
|
|
49
49
|
assert.equal(requests[0].init.redirect, "error");
|
|
50
50
|
assert.equal(JSON.stringify(connected).includes(state.key), false);
|
|
51
51
|
for (const name of await readdir(directory)) assert.equal((await readFile(path.join(directory, name), "utf8")).includes(state.key), false);
|
|
52
|
-
const restarted = createConnectionService({ ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
52
|
+
const restarted = createConnectionService({ appEnv: "test", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
53
53
|
assert.deepEqual(await restarted.status(input), connected);
|
|
54
54
|
state.key = "pk.replacement";
|
|
55
55
|
state.response = { code: "TokenValid", token: { usage: "pk", user: "fixture", authorization: "replacement-id" } };
|
|
@@ -72,7 +72,7 @@ test("Mapbox keeps browser references separate and re-verifies changed configura
|
|
|
72
72
|
delete changed.integrations.maps.settings.publicTokenRef;
|
|
73
73
|
assert.deepEqual(parse(changed), changed);
|
|
74
74
|
await service.connectApiKey(input);
|
|
75
|
-
const replacement = createConnectionService({ ...options, configuration: changed });
|
|
75
|
+
const replacement = createConnectionService({ appEnv: "test", ...options, configuration: changed });
|
|
76
76
|
assert.equal((await replacement.status(input)).status, "reconnect-required");
|
|
77
77
|
await assert.rejects(replacement.invoke({ ...input, operation: "token.read" }), { code: "connector_reconnect_required" });
|
|
78
78
|
assert.equal(requests.length, 1);
|
package/test/mcp.test.js
CHANGED
|
@@ -61,7 +61,7 @@ async function fixture(t, spec) {
|
|
|
61
61
|
: Response.json(payload, { headers });
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
-
return { options, service: createConnectionService(options), directory, protection, requests, state, policy };
|
|
64
|
+
return { options, service: createConnectionService({ appEnv: "test", ...options }), directory, protection, requests, state, policy };
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
for (const spec of cases) {
|
|
@@ -78,7 +78,7 @@ for (const spec of cases) {
|
|
|
78
78
|
if (request.message?.method !== "initialize") assert.equal(request.headers.get("mcp-session-id"), "fixture-session");
|
|
79
79
|
}
|
|
80
80
|
assert.deepEqual(requests[0].message.params.capabilities, {}, "No sampling, elicitation or local resources are granted.");
|
|
81
|
-
const restarted = createConnectionService({ ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
81
|
+
const restarted = createConnectionService({ appEnv: "test", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
82
82
|
state.token = "rotated-fixture-token";
|
|
83
83
|
assert.deepEqual(await restarted.invoke({ ...input, operation: "tools.list", input: { cursor: "opaque+/=cursor" } }), state.list);
|
|
84
84
|
assert.equal(requests.findLast(({ message }) => message?.method === "tools/list").message.params.cursor, "opaque+/=cursor");
|
|
@@ -110,7 +110,7 @@ for (const spec of cases) {
|
|
|
110
110
|
assert.equal(requests.length, count);
|
|
111
111
|
assert.deepEqual(policy.at(-1), { integrationId: "assistant", operation: "tools.call", accountMode: "assistant", input: { name: "delete_documents", arguments: { id: "all" } } });
|
|
112
112
|
const supplied = { name: "search_documents", arguments: { query: "approved" } };
|
|
113
|
-
const guarded = createConnectionService({ ...options, authorize: async (owner, request) => {
|
|
113
|
+
const guarded = createConnectionService({ appEnv: "test", ...options, authorize: async (owner, request) => {
|
|
114
114
|
supplied.name = "delete_documents";
|
|
115
115
|
supplied.arguments.query = "changed";
|
|
116
116
|
request.input.name = "delete_documents";
|
|
@@ -205,7 +205,7 @@ test("changing the n8n MCP destination requires verification and cannot reuse th
|
|
|
205
205
|
await service.connectApiKey(input);
|
|
206
206
|
const config = structuredClone(options.configuration);
|
|
207
207
|
config.integrations.assistant.settings.serverUrl = "https://other.example/mcp-server/http";
|
|
208
|
-
const changed = createConnectionService({ ...options, configuration: config });
|
|
208
|
+
const changed = createConnectionService({ appEnv: "test", ...options, configuration: config });
|
|
209
209
|
const count = requests.length;
|
|
210
210
|
assert.equal((await changed.status(input)).status, "reconnect-required");
|
|
211
211
|
await assert.rejects(changed.invoke({ ...input, operation: "tools.list" }), { code: "connector_reconnect_required" });
|
|
@@ -215,7 +215,7 @@ test("changing the n8n MCP destination requires verification and cannot reuse th
|
|
|
215
215
|
// Controlled workflow tool names exercise transport and policy, not n8n's live catalogue.
|
|
216
216
|
test("n8n returns workflow execution results only for the authorized workflow", async (t) => {
|
|
217
217
|
const { options, state, requests } = await fixture(t, cases[0]);
|
|
218
|
-
const service = createConnectionService({ ...options, authorize: async (owner, request) =>
|
|
218
|
+
const service = createConnectionService({ appEnv: "test", ...options, authorize: async (owner, request) =>
|
|
219
219
|
request.operation !== "tools.call" || request.input.name === "fixture_run_workflow" && request.input.arguments.workflowId === "report-one" ? owner : null });
|
|
220
220
|
state.list = { tools: [{ name: "fixture_run_workflow", inputSchema: { type: "object" } }] };
|
|
221
221
|
state.call = { content: [{ type: "text", text: JSON.stringify({ workflowId: "report-one", executionId: "execution-one", status: "success", output: { report: "Ready" } }) }] };
|
|
@@ -73,7 +73,7 @@ async function fixture(t, grantType = "authorization_code") {
|
|
|
73
73
|
return Response.json(state.value === undefined ? { data } : state.value, { status: state.status });
|
|
74
74
|
}
|
|
75
75
|
};
|
|
76
|
-
const service = createConnectionService(options);
|
|
76
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
77
77
|
const start = async () => {
|
|
78
78
|
const { authorizationUrl } = await service.beginAuthorization(args); const url = new URL(authorizationUrl);
|
|
79
79
|
const returned = new URL(callback); returned.searchParams.set("state", url.searchParams.get("state")); returned.searchParams.set("code", "private-code");
|
|
@@ -98,7 +98,7 @@ test("Fabric user consent pins the tenant, sends PKCE and maps the actual delega
|
|
|
98
98
|
const text = await readFile(path.join(f.directory, file), "utf8");
|
|
99
99
|
for (const secret of ["private-code", "private-client-secret", "private-access-1", "private-refresh-1"]) assert.equal(text.includes(secret), false);
|
|
100
100
|
}
|
|
101
|
-
const restarted = createConnectionService(f.options); assert.equal((await restarted.status(args)).status, "connected");
|
|
101
|
+
const restarted = createConnectionService({ appEnv: "test", ...f.options }); assert.equal((await restarted.status(args)).status, "connected");
|
|
102
102
|
assert.deepEqual(await restarted.invoke({ ...args, operation: "schema.types" }), { data: schema });
|
|
103
103
|
});
|
|
104
104
|
|
|
@@ -107,7 +107,7 @@ test("Fabric service principals use their own resource scope, no callback, and l
|
|
|
107
107
|
assert.deepEqual((await f.service.status(args)).grantedScopes, [serviceScope]);
|
|
108
108
|
await assert.rejects(f.service.beginAuthorization(args), { code: "connector_mode_unavailable" });
|
|
109
109
|
f.state.time += 95_000; f.state.secret = "rotated-private-secret";
|
|
110
|
-
const restarted = createConnectionService(f.options);
|
|
110
|
+
const restarted = createConnectionService({ appEnv: "test", ...f.options });
|
|
111
111
|
await Promise.all([restarted.invoke({ ...args, operation: "connection.check" }), restarted.invoke({ ...args, operation: "schema.types" })]);
|
|
112
112
|
assert.equal(f.state.tokenCount, 2);
|
|
113
113
|
assert.equal(JSON.stringify(await restarted.status(args)).includes("private"), false);
|
|
@@ -133,7 +133,7 @@ test("Fabric execution is explicitly mutation-capable and application policy can
|
|
|
133
133
|
await f.service.invoke({ ...args, operation: "graphql.execute", input });
|
|
134
134
|
assert.deepEqual(JSON.parse(f.requests.at(-1).init.body), input);
|
|
135
135
|
const before = f.requests.length;
|
|
136
|
-
const denied = createConnectionService({ ...f.options, authorize: async (owner, operation) => {
|
|
136
|
+
const denied = createConnectionService({ appEnv: "test", ...f.options, authorize: async (owner, operation) => {
|
|
137
137
|
if (operation.operation === "graphql.execute") { assert.deepEqual(operation.input, input); return null; }
|
|
138
138
|
return owner;
|
|
139
139
|
} });
|
|
@@ -175,7 +175,7 @@ test("Fabric retains renewal before failed calls and requires reconnect after re
|
|
|
175
175
|
for (const flow of ["authorization_code", "client_credentials"]) {
|
|
176
176
|
const f = await fixture(t, flow); await f.connect(); f.state.time += 95_000; f.state.status = 429;
|
|
177
177
|
await assert.rejects(f.service.invoke({ ...args, operation: "connection.check" }), { code: "connector_rate_limited" });
|
|
178
|
-
f.state.status = 200; const restarted = createConnectionService(f.options);
|
|
178
|
+
f.state.status = 200; const restarted = createConnectionService({ appEnv: "test", ...f.options });
|
|
179
179
|
await restarted.invoke({ ...args, operation: "connection.check" }); assert.equal(f.state.tokenCount, 2);
|
|
180
180
|
f.state.time += 95_000; f.state.tokenStatus = 400;
|
|
181
181
|
if (flow === "authorization_code") f.state.tokenError = "interaction_required";
|
|
@@ -200,7 +200,7 @@ test("Fabric binds saved grants and pending consent to tenant, endpoint, client,
|
|
|
200
200
|
(config) => { config.integrations.fabric.settings.graphqlEndpoint = endpoint.replace("graphqlapis/aaaaaaaa", "graphqlapis/bbbbbbbb"); },
|
|
201
201
|
(config) => { config.registrations.fabric.clientId = tenantId; }]) {
|
|
202
202
|
const configuration = structuredClone(f.options.configuration); change(configuration);
|
|
203
|
-
const service = createConnectionService({ ...f.options, configuration });
|
|
203
|
+
const service = createConnectionService({ appEnv: "test", ...f.options, configuration });
|
|
204
204
|
assert.equal((await service.status(args)).status, "reconnect-required");
|
|
205
205
|
await assert.rejects(service.invoke({ ...args, operation: "connection.check" }), { code: "connector_reconnect_required" });
|
|
206
206
|
await assert.rejects(service.completeAuthorization({ ...args, callbackUrl: pending.callbackUrl }), { code: "connector_attempt_invalid" });
|
|
@@ -211,7 +211,7 @@ test("Fabric binds saved grants and pending consent to tenant, endpoint, client,
|
|
|
211
211
|
const machine = await fixture(t, "client_credentials"); await machine.connect();
|
|
212
212
|
const config = structuredClone(machine.options.configuration); config.registrations.fabric.grantType = "authorization_code";
|
|
213
213
|
config.registrations.fabric.callbackUrlRef = "env:FABRIC_CALLBACK"; config.integrations.fabric.scopes = [delegated];
|
|
214
|
-
const changed = createConnectionService({ ...machine.options, configuration: config, resolveReference: async (ref) => ref.endsWith("CALLBACK") ? callback : "private-client-secret" });
|
|
214
|
+
const changed = createConnectionService({ appEnv: "test", ...machine.options, configuration: config, resolveReference: async (ref) => ref.endsWith("CALLBACK") ? callback : "private-client-secret" });
|
|
215
215
|
assert.equal((await changed.status(args)).status, "reconnect-required");
|
|
216
216
|
});
|
|
217
217
|
|
package/test/microsoft.test.js
CHANGED
|
@@ -55,7 +55,7 @@ async function fixture(t, entry) {
|
|
|
55
55
|
return [202, 204].includes(state.status) ? new Response(null, { status: state.status }) : typeof state.response === "string" ? new Response(state.response, { status: state.status, headers: { "Content-Type": "text/html" } }) : Response.json(state.response, { status: state.status });
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
const service = createConnectionService({ ...options,
|
|
58
|
+
const service = createConnectionService({ ...options, appEnv: "production" });
|
|
59
59
|
const input = { context: owner, integrationId: "service" };
|
|
60
60
|
async function start() {
|
|
61
61
|
const result = await service.beginAuthorization({ ...input, verificationInput: entry.input });
|
|
@@ -92,7 +92,7 @@ for (const entry of cases) {
|
|
|
92
92
|
const text = await readFile(path.join(directory, filename), "utf8");
|
|
93
93
|
for (const secret of ["test-client-secret", "test-access-1", "test-refresh-1"]) assert.equal(text.includes(secret), false);
|
|
94
94
|
}
|
|
95
|
-
const restarted = createConnectionService({ ...options,
|
|
95
|
+
const restarted = createConnectionService({ ...options, appEnv: "production" });
|
|
96
96
|
assert.equal((await restarted.status(input)).status, "connected");
|
|
97
97
|
const invocation = { ...input, operation: entry.provider.checkOperation, input: entry.input };
|
|
98
98
|
assert.deepEqual(await restarted.invoke(invocation), { value: [entry.item] });
|
|
@@ -129,7 +129,7 @@ for (const entry of cases) {
|
|
|
129
129
|
await service.invoke(invocation);
|
|
130
130
|
assert.equal(new URLSearchParams(requests[2].init.body).get("refresh_token"), "test-refresh-1");
|
|
131
131
|
assert.equal(new Headers(requests[3].init.headers).get("authorization"), "Bearer test-access-2");
|
|
132
|
-
const restarted = createConnectionService({ ...options,
|
|
132
|
+
const restarted = createConnectionService({ ...options, appEnv: "production" });
|
|
133
133
|
state.time += 40_000;
|
|
134
134
|
await restarted.invoke(invocation);
|
|
135
135
|
assert.equal(new URLSearchParams(requests[4].init.body).get("refresh_token"), "test-refresh-2");
|
|
@@ -224,7 +224,7 @@ for (const [base, tenantId] of [[cases[6], directoryId], [cases[7], "consumers"]
|
|
|
224
224
|
assert.equal(begun.url.pathname, `/${tenantId}/oauth2/v2.0/authorize`);
|
|
225
225
|
await service.completeAuthorization({ ...input, callbackUrl: begun.callbackUrl });
|
|
226
226
|
state.time += 40_000;
|
|
227
|
-
await createConnectionService({ ...options,
|
|
227
|
+
await createConnectionService({ ...options, appEnv: "production" }).invoke({ ...input, operation: "items.list" });
|
|
228
228
|
const tokenRequests = requests.filter(({ url }) => url.hostname === "login.microsoftonline.com");
|
|
229
229
|
assert.equal(tokenRequests.length, 2);
|
|
230
230
|
assert.equal(new URLSearchParams(tokenRequests[1].init.body).get("refresh_token"), "test-refresh-1");
|
|
@@ -239,7 +239,7 @@ test("Microsoft tenant changes invalidate pending consent and stored grants befo
|
|
|
239
239
|
const pending = await start();
|
|
240
240
|
const configuration = structuredClone(options.configuration);
|
|
241
241
|
configuration.integrations.service.settings = { tenantId: directoryId };
|
|
242
|
-
const changed = createConnectionService({
|
|
242
|
+
const changed = createConnectionService({ appEnv: "production", ...options, configuration });
|
|
243
243
|
const before = requests.length;
|
|
244
244
|
assert.equal((await changed.status(input)).status, "reconnect-required");
|
|
245
245
|
await assert.rejects(changed.invoke({ ...input, operation: entry.provider.checkOperation, input: entry.input }), { code: "connector_reconnect_required" });
|
package/test/n8nOAuth.test.js
CHANGED
|
@@ -157,7 +157,7 @@ test("n8n saved discovery drives project-owned consent, encrypted grants and ref
|
|
|
157
157
|
}
|
|
158
158
|
};
|
|
159
159
|
const startedAt = now;
|
|
160
|
-
const service = createConnectionService(options);
|
|
160
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
161
161
|
const start = await service.beginAuthorization(input);
|
|
162
162
|
const authorization = new URL(start.authorizationUrl);
|
|
163
163
|
assert.equal(authorization.origin + authorization.pathname, discovery.oauth.authorization_endpoint);
|
|
@@ -168,13 +168,13 @@ test("n8n saved discovery drives project-owned consent, encrypted grants and ref
|
|
|
168
168
|
assert.equal((await service.completeAuthorization({ ...input,
|
|
169
169
|
callbackUrl: `${callback}?code=fixture&state=${authorization.searchParams.get("state")}&iss=${encodeURIComponent(discovery.oauth.issuer)}` })).status, "connected");
|
|
170
170
|
now += 61_000;
|
|
171
|
-
const restarted = createConnectionService({ ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
171
|
+
const restarted = createConnectionService({ appEnv: "test", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
172
172
|
assert.deepEqual(await restarted.invoke({ ...input, operation: "tools.list", input: {} }), { tools: [] });
|
|
173
173
|
assert.equal(requests.filter((request) => request.address === discovery.oauth.token_endpoint).length, 2);
|
|
174
174
|
const changed = structuredClone(options.configuration);
|
|
175
175
|
changed.integrations.automation.settings.serverUrl = "https://other.example/mcp-server/http";
|
|
176
176
|
const count = requests.length;
|
|
177
|
-
await assert.rejects(createConnectionService({ ...options, configuration: changed }).beginAuthorization(input), { code: "connector_discovery_required" });
|
|
177
|
+
await assert.rejects(createConnectionService({ appEnv: "test", ...options, configuration: changed }).beginAuthorization(input), { code: "connector_discovery_required" });
|
|
178
178
|
assert.equal(requests.length, count);
|
|
179
179
|
for (const mutation of [
|
|
180
180
|
(d) => { d.oauth.token_endpoint = "https://other.example/token"; },
|
|
@@ -182,6 +182,6 @@ test("n8n saved discovery drives project-owned consent, encrypted grants and ref
|
|
|
182
182
|
(d) => { d.scopes = ["workflow:read", "workflow:read"]; }
|
|
183
183
|
]) {
|
|
184
184
|
const invalid = structuredClone(options.configuration); mutation(invalid.integrations.automation.settings.oauthDiscovery);
|
|
185
|
-
assert.throws(() => createConnectionService({ ...options, configuration: invalid }));
|
|
185
|
+
assert.throws(() => createConnectionService({ appEnv: "test", ...options, configuration: invalid }));
|
|
186
186
|
}
|
|
187
187
|
});
|
package/test/notionOAuth.test.js
CHANGED
|
@@ -42,7 +42,7 @@ test("Notion exchanges JSON with Basic auth and persists rotated refresh tokens
|
|
|
42
42
|
return Response.json({ object: "list", results: [], has_more: false });
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
|
-
const service = createConnectionService(options);
|
|
45
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
46
46
|
const start = await service.beginAuthorization(input);
|
|
47
47
|
const url = new URL(start.authorizationUrl);
|
|
48
48
|
assert.equal(url.origin + url.pathname, notionProvider.oauth.authorization_endpoint);
|
|
@@ -56,7 +56,7 @@ test("Notion exchanges JSON with Basic auth and persists rotated refresh tokens
|
|
|
56
56
|
assert.equal(tokenRequests, 1);
|
|
57
57
|
for (let i = 0; i < 2; i++) {
|
|
58
58
|
now += 61_000;
|
|
59
|
-
const restarted = createConnectionService({ ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
59
|
+
const restarted = createConnectionService({ appEnv: "test", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
60
60
|
assert.deepEqual(await restarted.invoke({ ...input, operation: "content.search", input: {} }), { object: "list", results: [], has_more: false });
|
|
61
61
|
}
|
|
62
62
|
assert.equal(tokenRequests, 3);
|
|
@@ -80,7 +80,7 @@ test("Notion rejects failed or malformed token exchanges without replay or secre
|
|
|
80
80
|
() => { throw new Error("private-fixture-secret"); }
|
|
81
81
|
]) {
|
|
82
82
|
let requests = 0;
|
|
83
|
-
const service = createConnectionService({ configuration, providers: [notionProvider],
|
|
83
|
+
const service = createConnectionService({ appEnv: "test", configuration, providers: [notionProvider],
|
|
84
84
|
store: createFileConnectionStore({ directory, protection }), authorize: async (owner) => owner,
|
|
85
85
|
resolveReference: async (ref) => ref === "env:SECRET" ? "private-fixture-secret" : callback,
|
|
86
86
|
fetchImpl: async () => { requests++; return response(); }
|
|
@@ -139,7 +139,7 @@ test("Notion hosted MCP uses separate PKCE/form credentials and tool discovery",
|
|
|
139
139
|
} : { tools: [] } });
|
|
140
140
|
}
|
|
141
141
|
};
|
|
142
|
-
const service = createConnectionService(options);
|
|
142
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
143
143
|
const start = await service.beginAuthorization(input);
|
|
144
144
|
const url = new URL(start.authorizationUrl);
|
|
145
145
|
assert.equal(url.origin + url.pathname, "https://mcp.notion.com/authorize");
|
|
@@ -148,12 +148,12 @@ test("Notion hosted MCP uses separate PKCE/form credentials and tool discovery",
|
|
|
148
148
|
await service.completeAuthorization({ ...input, callbackUrl: `${callback}?code=fixture&state=${url.searchParams.get("state")}` });
|
|
149
149
|
assert.equal(exchanges, 1);
|
|
150
150
|
now += 3_601_000;
|
|
151
|
-
const restarted = createConnectionService({ ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
151
|
+
const restarted = createConnectionService({ appEnv: "test", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
152
152
|
assert.deepEqual(await restarted.invoke({ ...input, operation: "tools.list", input: {} }), { tools: [] });
|
|
153
153
|
assert.equal(exchanges, 2);
|
|
154
154
|
await assert.rejects(service.invoke({ ...input, operation: "content.search", input: {} }));
|
|
155
155
|
const invalid = structuredClone(configuration); invalid.integrations.notes.accountMode = "per-user";
|
|
156
|
-
assert.throws(() => createConnectionService({ ...options, configuration: invalid }));
|
|
156
|
+
assert.throws(() => createConnectionService({ appEnv: "test", ...options, configuration: invalid }));
|
|
157
157
|
});
|
|
158
158
|
|
|
159
159
|
|