@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/oura.test.js
CHANGED
|
@@ -41,7 +41,7 @@ async function fixture(t) {
|
|
|
41
41
|
return Response.json(state.response, { status: state.status });
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
const service = createConnectionService(options);
|
|
44
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
45
45
|
async function start(scope = "daily personal") {
|
|
46
46
|
const { authorizationUrl } = await service.beginAuthorization(input);
|
|
47
47
|
const url = new URL(authorizationUrl);
|
|
@@ -77,7 +77,7 @@ test("Oura uses code consent, records reduced callback scopes and persists a pri
|
|
|
77
77
|
const text = await readFile(path.join(directory, name), "utf8");
|
|
78
78
|
for (const secret of ["fixture-client-secret", "fixture-access-1", "fixture-refresh-1"]) assert.equal(text.includes(secret), false);
|
|
79
79
|
}
|
|
80
|
-
const restarted = createConnectionService({ ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
80
|
+
const restarted = createConnectionService({ appEnv: "test", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
81
81
|
assert.deepEqual(await restarted.status(input), { ...connected, callbackUrl: callback });
|
|
82
82
|
const operation = { ...input, operation: "dailySleep.list", input: { start_date: "2026-09-01", end_date: "2026-09-08", next_token: "next +&2" } };
|
|
83
83
|
assert.deepEqual(await restarted.invoke(operation), daily);
|
|
@@ -122,7 +122,7 @@ test("Oura serializes single-use refresh tokens and preserves reduced scopes aft
|
|
|
122
122
|
state.time += 40_000;
|
|
123
123
|
await Promise.all([service.invoke({ ...input, operation: "dailySleep.list" }), service.invoke({ ...input, operation: "dailySleep.list" })]);
|
|
124
124
|
assert.equal(state.tokenCount, 2);
|
|
125
|
-
const restarted = createConnectionService(options);
|
|
125
|
+
const restarted = createConnectionService({ appEnv: "test", ...options });
|
|
126
126
|
state.time += 40_000;
|
|
127
127
|
await restarted.invoke({ ...input, operation: "dailySleep.list" });
|
|
128
128
|
assert.equal(state.tokenCount, 3);
|
|
@@ -176,14 +176,14 @@ test("Oura rejects an empty permission selection before starting broad consent",
|
|
|
176
176
|
const { options, requests } = await fixture(t);
|
|
177
177
|
const configuration = structuredClone(options.configuration);
|
|
178
178
|
configuration.integrations.oura.scopes = [];
|
|
179
|
-
assert.throws(() => createConnectionService({ ...options, configuration }));
|
|
179
|
+
assert.throws(() => createConnectionService({ appEnv: "test", ...options, configuration }));
|
|
180
180
|
assert.equal(requests.length, 0);
|
|
181
181
|
});
|
|
182
182
|
|
|
183
183
|
test("Oura reads sleep readiness activity and separately consented heart rate with explicit paging", async t => {
|
|
184
184
|
const { options, state, requests } = await fixture(t);
|
|
185
185
|
options.configuration.integrations.oura.scopes.push("heartrate");
|
|
186
|
-
const expanded = createConnectionService(options);
|
|
186
|
+
const expanded = createConnectionService({ appEnv: "test", ...options });
|
|
187
187
|
const { authorizationUrl } = await expanded.beginAuthorization(input);
|
|
188
188
|
const cb = new URL(callback); cb.searchParams.set("state", new URL(authorizationUrl).searchParams.get("state")); cb.searchParams.set("code", "fixture-code"); cb.searchParams.set("scope", "daily heartrate");
|
|
189
189
|
await expanded.completeAuthorization({ ...input, callbackUrl: cb.href });
|
|
@@ -19,7 +19,7 @@ test("Paddle maps reads to the captured permission and requires exact host appro
|
|
|
19
19
|
fetchImpl: () => assert.fail("Authorization must not execute a provider payment action"),
|
|
20
20
|
authorize: async (context, decision) => { decisions.push(decision); return { ...context, approved }; }
|
|
21
21
|
};
|
|
22
|
-
const runtime = createConnectionService(options);
|
|
22
|
+
const runtime = createConnectionService({ appEnv: "test", ...options });
|
|
23
23
|
const input = { context: { applicationId: "app", subjectId: "owner" }, integrationId: "paddle" };
|
|
24
24
|
await assert.rejects(runtime.invoke({ ...input, operation: "products.list", input: {} }), { code: "connector_access_denied" });
|
|
25
25
|
assert.equal(decisions.length, 0);
|
|
@@ -45,6 +45,7 @@ test("Paddle product and recurring-price writes validate inputs and do not retry
|
|
|
45
45
|
const webhookId = `ntfset_${"c".repeat(26)}`;
|
|
46
46
|
const webhookWrites = [];
|
|
47
47
|
const runtime = createConnectionService({
|
|
48
|
+
appEnv: "test",
|
|
48
49
|
configuration: { schemaVersion: 1, registrations: {}, integrations: { paddle: {
|
|
49
50
|
provider: "paddle", accountMode: "shared", scopes: [], settings: { environment: "sandbox" },
|
|
50
51
|
authentication: { method: "api-key", secretRef: "env:PADDLE_API_KEY" }
|
|
@@ -16,7 +16,7 @@ async function fixture(t, fetchImpl) {
|
|
|
16
16
|
tokenEndpointAuthMethod: "client_secret_basic", clientSecretRef: "env:SECRET", callbackUrlRef: "env:CALLBACK" } },
|
|
17
17
|
integrations: { crm: { provider: "pipedrive", accountMode: "per-user", scopes: [],
|
|
18
18
|
authentication: { method: "oauth2", registrationRef: "crm" } } } };
|
|
19
|
-
const service = () => createConnectionService({ configuration, providers: [pipedriveProvider],
|
|
19
|
+
const service = () => createConnectionService({ appEnv: "test", configuration, providers: [pipedriveProvider],
|
|
20
20
|
store: createFileConnectionStore({ directory, protection }), authorize: async (owner) => owner,
|
|
21
21
|
now: () => now, resolveReference: async (ref) => ref === "env:SECRET" ? "private-secret" : callback, fetchImpl });
|
|
22
22
|
const input = (subjectId) => ({ context: { applicationId: "app", subjectId }, integrationId: "crm" });
|
package/test/posthog.test.js
CHANGED
|
@@ -35,7 +35,7 @@ async function fixture(t, region = "eu") {
|
|
|
35
35
|
return Response.json(state.response, { status: state.status });
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
return { service: createConnectionService(options), options, requests, directory, protection, state };
|
|
38
|
+
return { service: createConnectionService({ appEnv: "test", ...options }), options, requests, directory, protection, state };
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
for (const region of ["eu", "us"]) {
|
|
@@ -58,7 +58,7 @@ for (const region of ["eu", "us"]) {
|
|
|
58
58
|
assert.equal(stored.includes(state.token), false);
|
|
59
59
|
assert.equal(stored.includes(verificationInput.distinct_id), false);
|
|
60
60
|
}
|
|
61
|
-
const restarted = createConnectionService({ ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
61
|
+
const restarted = createConnectionService({ appEnv: "test", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
62
62
|
assert.deepEqual(await restarted.status(input), connected);
|
|
63
63
|
state.token = "phc_rotated_public_token";
|
|
64
64
|
assert.deepEqual(await restarted.invoke({ ...input, operation: "flags.evaluate", input: verificationInput }), flags);
|
|
@@ -111,12 +111,12 @@ test("PostHog requires re-verification after project or region changes and block
|
|
|
111
111
|
for (const [field, value] of [["projectId", "999"], ["region", "us"]]) {
|
|
112
112
|
const configuration = structuredClone(options.configuration);
|
|
113
113
|
configuration.integrations.analytics.settings[field] = value;
|
|
114
|
-
const changed = createConnectionService({ ...options, configuration });
|
|
114
|
+
const changed = createConnectionService({ appEnv: "test", ...options, configuration });
|
|
115
115
|
assert.equal((await changed.status(input)).status, "reconnect-required");
|
|
116
116
|
await assert.rejects(changed.invoke({ ...input, operation: "flags.evaluate", input: verificationInput }), { code: "connector_reconnect_required" });
|
|
117
117
|
}
|
|
118
118
|
for (const origin of ["https://us.i.posthog.com", "https://eu.posthog.com", "https://attacker.invalid"]) {
|
|
119
|
-
const wrongHost = createConnectionService({ ...options, providers: [{ ...posthogProvider, operations: {
|
|
119
|
+
const wrongHost = createConnectionService({ appEnv: "test", ...options, providers: [{ ...posthogProvider, operations: {
|
|
120
120
|
"flags.evaluate": { scopes: [], request: () => ({ method: "POST", url: `${origin}/flags?v=2`, body: verificationInput }) }
|
|
121
121
|
} }] });
|
|
122
122
|
await assert.rejects(wrongHost.invoke({ ...input, operation: "flags.evaluate", input: verificationInput }), { code: "connector_destination_invalid" });
|
package/test/prestashop.test.js
CHANGED
|
@@ -35,7 +35,7 @@ async function fixture(t) {
|
|
|
35
35
|
return Response.json(state.response, { status: state.status, headers: { Link: '<https://unrelated.example/next>; rel="next"' } });
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
return { service: createConnectionService(options), options, directory, protection, requests, state };
|
|
38
|
+
return { service: createConnectionService({ appEnv: "test", ...options }), options, directory, protection, requests, state };
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
test("PrestaShop verifies product reads with header-only Basic authentication, then survives file restart and key rotation", async (t) => {
|
|
@@ -58,7 +58,7 @@ test("PrestaShop verifies product reads with header-only Basic authentication, t
|
|
|
58
58
|
assert.equal(text.includes(state.secret), false);
|
|
59
59
|
assert.equal(text.includes(requests[0].headers.get("authorization")), false);
|
|
60
60
|
}
|
|
61
|
-
const restarted = createConnectionService({ ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
61
|
+
const restarted = createConnectionService({ appEnv: "test", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
62
62
|
assert.deepEqual(await restarted.status(input), connected);
|
|
63
63
|
state.secret = "rotated-prestashop-webservice-key";
|
|
64
64
|
assert.deepEqual(await restarted.invoke({ ...input, operation: "products.list" }), products);
|
|
@@ -146,15 +146,15 @@ test("PrestaShop isolates owners, rejects changed store bindings and enforces th
|
|
|
146
146
|
for (const settings of [{ siteUrl: "https://other.example" }, { siteUrl: "https://merchant.example:8443/other-store" }]) {
|
|
147
147
|
const configuration = structuredClone(options.configuration);
|
|
148
148
|
configuration.integrations.store.settings = settings;
|
|
149
|
-
const changed = createConnectionService({ ...options, configuration });
|
|
149
|
+
const changed = createConnectionService({ appEnv: "test", ...options, configuration });
|
|
150
150
|
assert.equal((await changed.status(input)).status, "reconnect-required");
|
|
151
151
|
await assert.rejects(changed.invoke({ ...input, operation: "products.list" }), { code: "connector_reconnect_required" });
|
|
152
152
|
}
|
|
153
|
-
const wrongHost = createConnectionService({ ...options, providers: [{ ...prestashopProvider, operations: {
|
|
153
|
+
const wrongHost = createConnectionService({ appEnv: "test", ...options, providers: [{ ...prestashopProvider, operations: {
|
|
154
154
|
"products.list": { scopes: [], request: () => ({ method: "GET", url: "https://other.example/api/products" }) }
|
|
155
155
|
} }] });
|
|
156
156
|
await assert.rejects(wrongHost.invoke({ ...input, operation: "products.list" }), { code: "connector_destination_invalid" });
|
|
157
|
-
const denied = createConnectionService({ ...options, authorize: async () => { throw new Error("Access denied"); } });
|
|
157
|
+
const denied = createConnectionService({ appEnv: "test", ...options, authorize: async () => { throw new Error("Access denied"); } });
|
|
158
158
|
await assert.rejects(denied.invoke({ ...input, operation: "orders.list" }), /Access denied/u);
|
|
159
159
|
assert.equal(requests.length, 1);
|
|
160
160
|
});
|
|
@@ -197,7 +197,7 @@ test("PrestaShop keeps transport failures and cancellation observable without a
|
|
|
197
197
|
assert.equal(requests.length, 2);
|
|
198
198
|
const controller = new AbortController();
|
|
199
199
|
let calls = 0;
|
|
200
|
-
const interrupted = createConnectionService({ ...options, fetchImpl: async () => {
|
|
200
|
+
const interrupted = createConnectionService({ appEnv: "test", ...options, fetchImpl: async () => {
|
|
201
201
|
calls++;
|
|
202
202
|
controller.abort();
|
|
203
203
|
throw new DOMException("Interrupted", "AbortError");
|
package/test/resend.test.js
CHANGED
|
@@ -20,7 +20,7 @@ async function fixture(t) {
|
|
|
20
20
|
t.after(() => rm(directory, { recursive: true, force: true }));
|
|
21
21
|
const requests = [];
|
|
22
22
|
const state = { fail: false };
|
|
23
|
-
const service = createConnectionService({
|
|
23
|
+
const service = createConnectionService({ appEnv: "production",
|
|
24
24
|
configuration: { schemaVersion: 1, registrations: {}, integrations: { mail: {
|
|
25
25
|
provider: "resend", accountMode: "shared", scopes: [],
|
|
26
26
|
authentication: { method: "api-key", secretRef: "env:RESEND_KEY" }
|
package/test/salesforce.test.js
CHANGED
|
@@ -56,7 +56,7 @@ async function fixture(t, settings = { environment: "production", accountUrl })
|
|
|
56
56
|
return Response.json(url.pathname.endsWith("/limits") ? (state.limits || limits) : state.response);
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
|
-
const service = createConnectionService(options);
|
|
59
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
60
60
|
const start = async (target = service) => {
|
|
61
61
|
const result = await target.beginAuthorization(input); const url = new URL(result.authorizationUrl);
|
|
62
62
|
const returned = new URL(callback); returned.searchParams.set("code", "fixture-code"); returned.searchParams.set("state", url.searchParams.get("state"));
|
|
@@ -145,7 +145,7 @@ test("Salesforce encrypted file restart preserves ownership and renews an undate
|
|
|
145
145
|
const value = await readFile(path.join(f.directory, name), "utf8");
|
|
146
146
|
for (const secret of ["fixture-secret", "access-1", "refresh-1"]) assert.equal(value.includes(secret), false);
|
|
147
147
|
}
|
|
148
|
-
const restarted = createConnectionService({ ...f.options, store: createFileConnectionStore({ directory: f.directory, protection: f.protection }) });
|
|
148
|
+
const restarted = createConnectionService({ appEnv: "test", ...f.options, store: createFileConnectionStore({ directory: f.directory, protection: f.protection }) });
|
|
149
149
|
await restarted.invoke({ ...input, operation: "limits.read" }); assert.equal(f.state.grants, 1);
|
|
150
150
|
for (const owner of [{ ...context, subjectId: "user-two" }, { ...context, applicationId: "other-app" }]) {
|
|
151
151
|
await assert.rejects(restarted.invoke({ ...input, context: owner, operation: "limits.read" }), { code: "connector_reconnect_required" });
|
|
@@ -162,7 +162,7 @@ test("Salesforce persists rotation before later failures and retains a previous
|
|
|
162
162
|
f.state.refresh = false; f.state.status = 403; f.state.errorCode = "REQUEST_LIMIT_EXCEEDED";
|
|
163
163
|
await assert.rejects(f.service.invoke({ ...input, operation: "limits.read" }), { code: "connector_rate_limited" });
|
|
164
164
|
assert.equal(f.state.grants, 2); f.state.status = 200; f.state.time += 60000; f.state.refresh = true;
|
|
165
|
-
await createConnectionService(f.options).invoke({ ...input, operation: "limits.read" }); assert.equal(f.state.grants, 3);
|
|
165
|
+
await createConnectionService({ appEnv: "test", ...f.options }).invoke({ ...input, operation: "limits.read" }); assert.equal(f.state.grants, 3);
|
|
166
166
|
f.state.time += 60000; f.state.scope = "refresh_token";
|
|
167
167
|
await assert.rejects(f.service.invoke({ ...input, operation: "limits.read" }), { code: "connector_scope_missing" });
|
|
168
168
|
assert.deepEqual((await f.service.status(input)).grantedScopes, ["refresh_token"]);
|
|
@@ -183,7 +183,7 @@ test("Salesforce rejects foreign and malformed grants, missing API consent and c
|
|
|
183
183
|
if (field === "client") config.registrations.sf.clientId = "different-client";
|
|
184
184
|
else config.integrations.crm.settings = field === "domain" ? { environment: "production", accountUrl: "https://other.my.salesforce.com" }
|
|
185
185
|
: { environment: "sandbox", accountUrl: "https://fixture--uat.sandbox.my.salesforce.com" };
|
|
186
|
-
const changed = createConnectionService({ ...f.options, configuration: config });
|
|
186
|
+
const changed = createConnectionService({ appEnv: "test", ...f.options, configuration: config });
|
|
187
187
|
assert.equal((await changed.status(input)).status, "reconnect-required");
|
|
188
188
|
await assert.rejects(changed.completeAuthorization({ ...input, callbackUrl: pending.callbackUrl }), { code: "connector_attempt_invalid" });
|
|
189
189
|
await assert.rejects(changed.invoke({ ...input, operation: "limits.read" }), { code: "connector_reconnect_required" });
|
|
@@ -230,7 +230,7 @@ test("Salesforce host policy, cancelled/denied consent and managed references ca
|
|
|
230
230
|
assert.equal(f.state.requests.length, 0);
|
|
231
231
|
f.state.deny = false;
|
|
232
232
|
const config = structuredClone(f.configuration); config.registrations.sf = { source: "managed", serviceUrlRef: "env:GATEWAY", serviceCredentialRef: "env:APP", assignmentRef: "shared" };
|
|
233
|
-
assert.throws(() => createConnectionService({ ...f.options, configuration: config }), { code: "integration_configuration_invalid" });
|
|
233
|
+
assert.throws(() => createConnectionService({ appEnv: "test", ...f.options, configuration: config }), { code: "integration_configuration_invalid" });
|
|
234
234
|
assert.equal(f.state.requests.length, 0);
|
|
235
235
|
});
|
|
236
236
|
|
|
@@ -239,7 +239,7 @@ test("Salesforce cancellation and timeout interrupt requests and a revoked refre
|
|
|
239
239
|
const keepAlive = setTimeout(() => {}, 1000);
|
|
240
240
|
t.after(() => clearTimeout(keepAlive));
|
|
241
241
|
const f = await fixture(t); await f.connect(); f.state.stall = "api";
|
|
242
|
-
const timed = createConnectionService({ ...f.options, providers: [{ ...provider, requestTimeoutMs: 30 }] });
|
|
242
|
+
const timed = createConnectionService({ appEnv: "test", ...f.options, providers: [{ ...provider, requestTimeoutMs: 30 }] });
|
|
243
243
|
await assert.rejects(timed.invoke({ ...input, operation: "limits.read" }), { code: "connector_provider_timeout" });
|
|
244
244
|
const controller = new AbortController(); const pending = f.service.invoke({ ...input, operation: "limits.read", signal: controller.signal });
|
|
245
245
|
const timer = setTimeout(() => controller.abort(), 30);
|
|
@@ -254,7 +254,7 @@ test("Salesforce query policy authorizes an immutable request and denies data ac
|
|
|
254
254
|
const f = await fixture(t); await f.connect();
|
|
255
255
|
const allowed = "SELECT Id FROM Account LIMIT 1";
|
|
256
256
|
const caller = { q: allowed };
|
|
257
|
-
const service = createConnectionService({ ...f.options, authorize: async (owner, request) => {
|
|
257
|
+
const service = createConnectionService({ appEnv: "test", ...f.options, authorize: async (owner, request) => {
|
|
258
258
|
if (request.operation === "query.read") {
|
|
259
259
|
assert.equal(request.input.q, allowed);
|
|
260
260
|
caller.q = "SELECT Id FROM Contact";
|
|
@@ -265,7 +265,7 @@ test("Salesforce query policy authorizes an immutable request and denies data ac
|
|
|
265
265
|
await service.invoke({ ...input, operation: "query.read", input: caller });
|
|
266
266
|
assert.equal(f.state.requests.at(-1).url.searchParams.get("q"), allowed);
|
|
267
267
|
const count = f.state.requests.length;
|
|
268
|
-
const denied = createConnectionService({ ...f.options, authorize: async () => { throw new Error("Query not allowed"); },
|
|
268
|
+
const denied = createConnectionService({ appEnv: "test", ...f.options, authorize: async () => { throw new Error("Query not allowed"); },
|
|
269
269
|
resolveReference: async () => { assert.fail("No credentials should be resolved before authorization"); } });
|
|
270
270
|
await assert.rejects(denied.invoke({ ...input, operation: "query.read", input: { q: allowed } }), /Query not allowed/);
|
|
271
271
|
assert.equal(f.state.requests.length, count);
|
package/test/semrush.test.js
CHANGED
|
@@ -42,7 +42,7 @@ async function fixture(t) {
|
|
|
42
42
|
return Response.json(state.response, { status: state.status });
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
|
-
return { service: createConnectionService(options), options, requests, directory, protection, state };
|
|
45
|
+
return { service: createConnectionService({ appEnv: "test", ...options }), options, requests, directory, protection, state };
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
test("Semrush V4 verifies Projects access, stores no raw key and preserves ownership through restart and rotation", async (t) => {
|
|
@@ -58,7 +58,7 @@ test("Semrush V4 verifies Projects access, stores no raw key and preserves owner
|
|
|
58
58
|
const stored = await readFile(path.join(directory, name), "utf8");
|
|
59
59
|
assert.doesNotThrow(() => JSON.parse(stored)); assert.equal(stored.includes(state.key), false);
|
|
60
60
|
}
|
|
61
|
-
const restarted = createConnectionService({ ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
61
|
+
const restarted = createConnectionService({ appEnv: "test", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
62
62
|
assert.deepEqual(await restarted.status(input), connected);
|
|
63
63
|
state.key = "rotated-v4-key";
|
|
64
64
|
assert.deepEqual(await restarted.invoke({ ...input, operation: "projects.list" }), page);
|
|
@@ -178,7 +178,7 @@ test("Semrush transport failures do not retry or verify the connection, and auth
|
|
|
178
178
|
assert.equal(requests.length, count + 1);
|
|
179
179
|
}
|
|
180
180
|
state.status = 200; state.response = page; await service.connectApiKey(input);
|
|
181
|
-
const denied = createConnectionService({ ...options, authorize: async () => { throw new ConnectorError("connector_permission_denied", "Denied", { statusCode: 403 }); } });
|
|
181
|
+
const denied = createConnectionService({ appEnv: "test", ...options, authorize: async () => { throw new ConnectorError("connector_permission_denied", "Denied", { statusCode: 403 }); } });
|
|
182
182
|
const count = requests.length, resolutions = state.resolutions;
|
|
183
183
|
await assert.rejects(denied.invoke({ ...input, operation: "projects.get", input: { projectId: project.project_id } }), { code: "connector_permission_denied" });
|
|
184
184
|
assert.equal(requests.length, count); assert.equal(state.resolutions, resolutions);
|
|
@@ -191,7 +191,7 @@ test("Semrush interruption and timeout leave the stored connection usable withou
|
|
|
191
191
|
const pending = service.invoke({ ...input, operation: "projects.list", signal: controller.signal });
|
|
192
192
|
setTimeout(() => controller.abort(), 15);
|
|
193
193
|
await assert.rejects(pending, { code: "connector_cancelled" });
|
|
194
|
-
const timeoutService = createConnectionService({ ...options, providers: [{ ...semrushProvider, requestTimeoutMs: 20 }] });
|
|
194
|
+
const timeoutService = createConnectionService({ appEnv: "test", ...options, providers: [{ ...semrushProvider, requestTimeoutMs: 20 }] });
|
|
195
195
|
const keepAlive = setTimeout(() => {}, 1000);
|
|
196
196
|
try { await assert.rejects(timeoutService.invoke({ ...input, operation: "projects.list" }), { code: "connector_provider_timeout" }); }
|
|
197
197
|
finally { clearTimeout(keepAlive); }
|
|
@@ -211,7 +211,7 @@ test("Semrush creates and renames projects without replaying uncertain writes",
|
|
|
211
211
|
}
|
|
212
212
|
await assert.rejects(service.invoke({ ...input, operation: "projects.update", input: { projectId: project.project_id } }));
|
|
213
213
|
assert.equal(requests.length, before);
|
|
214
|
-
const denied = createConnectionService({ ...options, authorize: async (owner, request) => request.operation === "projects.create" ? null : owner });
|
|
214
|
+
const denied = createConnectionService({ appEnv: "test", ...options, authorize: async (owner, request) => request.operation === "projects.create" ? null : owner });
|
|
215
215
|
const resolutions = state.resolutions;
|
|
216
216
|
await assert.rejects(denied.invoke({ ...input, operation: "projects.create", input: { domain: "example.test", project_name: "Website" } }), { code: "connector_access_denied" });
|
|
217
217
|
assert.equal(requests.length, before); assert.equal(state.resolutions, resolutions);
|
|
@@ -242,7 +242,7 @@ test("Semrush deletion validates the exact project and never retries an uncertai
|
|
|
242
242
|
await service.connectApiKey(input);
|
|
243
243
|
const deletion = { ...input, operation: "projects.delete", input: { projectId: project.project_id } };
|
|
244
244
|
const before = requests.length, resolutions = state.resolutions;
|
|
245
|
-
const denied = createConnectionService({ ...options, authorize: async () => null });
|
|
245
|
+
const denied = createConnectionService({ appEnv: "test", ...options, authorize: async () => null });
|
|
246
246
|
await assert.rejects(denied.invoke(deletion), { code: "connector_access_denied" });
|
|
247
247
|
assert.equal(state.resolutions, resolutions);
|
|
248
248
|
for (const projectId of [0, -1, "not-an-id", Number.MAX_SAFE_INTEGER + 1]) {
|
|
@@ -354,7 +354,7 @@ test("Semrush V3 domain reports use a separate private key and decode provider C
|
|
|
354
354
|
requests.push({ url: new URL(address), init, headers: new Headers(init.headers) });
|
|
355
355
|
return new Response(csv, { headers: { "content-type": "text/csv" } });
|
|
356
356
|
};
|
|
357
|
-
const service = createConnectionService(options);
|
|
357
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
358
358
|
await service.connectApiKey(input);
|
|
359
359
|
const call = { ...input, operation: "domains.overview", input: { domain: "example.test", database: "us" } };
|
|
360
360
|
const report = await service.invoke(call);
|
|
@@ -379,7 +379,7 @@ test("Semrush V3 domain reports use a separate private key and decode provider C
|
|
|
379
379
|
await assert.rejects(service.invoke(call), (error) => error.code === expected && !error.message.includes("private-v3-key"));
|
|
380
380
|
}
|
|
381
381
|
assert.equal((await service.status(input)).status, "connected");
|
|
382
|
-
const denied = createConnectionService({ ...options, authorize: async () => null,
|
|
382
|
+
const denied = createConnectionService({ appEnv: "test", ...options, authorize: async () => null,
|
|
383
383
|
resolveReference: async () => { throw new Error("Must not resolve a denied caller's key"); } });
|
|
384
384
|
const before = requests.length;
|
|
385
385
|
await assert.rejects(denied.invoke(call), { code: "connector_access_denied" });
|
|
@@ -400,7 +400,7 @@ test("Semrush keyword detail pages translate offsets and decode quoted organic/p
|
|
|
400
400
|
requests.push({ url: new URL(address), init });
|
|
401
401
|
return new Response(csv, { headers: { "content-type": "text/csv" } });
|
|
402
402
|
};
|
|
403
|
-
const service = createConnectionService(options);
|
|
403
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
404
404
|
await service.connectApiKey(input);
|
|
405
405
|
for (const [prefix, target, value] of [["domains", "domain", "example.test"], ["urls", "url", "https://example.test/a?b=2&c=3"],
|
|
406
406
|
["subfolders", "subfolder", "example.test/blog/"]]) {
|
|
@@ -445,7 +445,7 @@ test("Semrush tracking discovers campaigns and reads dated organic/paid position
|
|
|
445
445
|
requests.push({ url: new URL(address), init });
|
|
446
446
|
return Response.json(response);
|
|
447
447
|
};
|
|
448
|
-
const service = createConnectionService(options);
|
|
448
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
449
449
|
await service.connectApiKey(input);
|
|
450
450
|
const campaigns = { ...input, operation: "tracking.campaigns", input: { projectId: project.project_id } };
|
|
451
451
|
assert.deepEqual(await service.invoke(campaigns), response);
|
package/test/shopify.test.js
CHANGED
|
@@ -58,14 +58,14 @@ async function fixture(t, { method = "oauth2", scopes = ["read_products", "write
|
|
|
58
58
|
return Response.json(state.value === undefined ? value : state.value, { status: state.status });
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
|
-
const service = createConnectionService(options);
|
|
61
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
62
62
|
const connect = () => method === "oauth2" ? service.connectClientCredentials(args) : service.connectApiKey(args);
|
|
63
63
|
return { directory, options, state, requests, decisions, service, connect };
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
test("Shopify verifies and persists organization-app grants with the Shopify header, renewal and bounded product pages", async (t) => {
|
|
67
67
|
const f = await fixture(t); assert.equal((await f.connect()).status, "connected");
|
|
68
|
-
const restarted = createConnectionService(f.options); assert.equal((await restarted.status(args)).status, "connected");
|
|
68
|
+
const restarted = createConnectionService({ appEnv: "test", ...f.options }); assert.equal((await restarted.status(args)).status, "connected");
|
|
69
69
|
const result = await restarted.invoke({ ...args, operation: "products.list", input: { first: 1, after: "cursor & next", query: "status:active" } });
|
|
70
70
|
assert.deepEqual(result.data.products.nodes, [product]);
|
|
71
71
|
assert.deepEqual(JSON.parse(f.requests.at(-1).init.body).variables, { first: 1, after: "cursor & next", query: "status:active" });
|
|
@@ -118,7 +118,7 @@ test("Shopify preserves read-only configuration and actual OAuth grants even whe
|
|
|
118
118
|
for (const method of ["oauth2", "api-key"]) {
|
|
119
119
|
const f = await fixture(t, { method, scopes: ["read_products"] }); await f.connect(); const count = f.requests.length;
|
|
120
120
|
f.state.approved = true;
|
|
121
|
-
const assistant = createConnectionService({ ...f.options, executionMode: "assistant" });
|
|
121
|
+
const assistant = createConnectionService({ appEnv: "test", ...f.options, executionMode: "assistant" });
|
|
122
122
|
await assert.rejects(assistant.invoke({ ...args, operation: "products.create", input: { product: { title: "New" } } }), { code: "connector_scope_missing" });
|
|
123
123
|
assert.equal(f.requests.length, count);
|
|
124
124
|
}
|
|
@@ -144,7 +144,7 @@ test("Shopify binds connection access to the application, subject, permanent sho
|
|
|
144
144
|
await assert.rejects(f.service.invoke({ ...args, context: owner, operation: "products.list" }), { code: "connector_reconnect_required" });
|
|
145
145
|
}
|
|
146
146
|
const configuration = structuredClone(f.options.configuration); configuration.integrations.shopify.settings.shopDomain = "other.myshopify.com";
|
|
147
|
-
const changed = createConnectionService({ ...f.options, configuration });
|
|
147
|
+
const changed = createConnectionService({ appEnv: "test", ...f.options, configuration });
|
|
148
148
|
assert.equal((await changed.status(args)).status, "reconnect-required");
|
|
149
149
|
await assert.rejects(changed.invoke({ ...args, operation: "products.list" }), { code: "connector_reconnect_required" });
|
|
150
150
|
f.state.denied = true; await assert.rejects(f.service.invoke({ ...args, operation: "products.list" }), { code: "connector_access_denied" });
|
|
@@ -182,13 +182,13 @@ test("Shopify rejects malformed GraphQL results and distinguishes throttling, de
|
|
|
182
182
|
|
|
183
183
|
test("Shopify assistant permissions require host approval for the exact action and immutable input", async (t) => {
|
|
184
184
|
const f = await fixture(t); await f.connect();
|
|
185
|
-
const assistant = createConnectionService({ ...f.options, executionMode: "assistant" });
|
|
185
|
+
const assistant = createConnectionService({ appEnv: "test", ...f.options, executionMode: "assistant" });
|
|
186
186
|
const input = { product: { title: "Approved product" } }; const call = { ...args, operation: "products.create", input };
|
|
187
187
|
const count = f.requests.length;
|
|
188
188
|
await assert.rejects(assistant.invoke(call), { code: "connector_approval_required" }); assert.equal(f.requests.length, count);
|
|
189
189
|
assert.deepEqual(f.decisions.at(-1).assistantPermission, { action: "products.create", decision: "ask" });
|
|
190
190
|
f.state.approved = true;
|
|
191
|
-
const changing = createConnectionService({ ...f.options, executionMode: "assistant", authorize: async (owner, request) => {
|
|
191
|
+
const changing = createConnectionService({ appEnv: "test", ...f.options, executionMode: "assistant", authorize: async (owner, request) => {
|
|
192
192
|
assert.deepEqual(request.input, input); input.product.title = "Caller changed"; request.input.product.title = "Policy changed";
|
|
193
193
|
request.assistantPermission.decision = "always"; return { ...owner, approved: true };
|
|
194
194
|
} });
|
|
@@ -200,25 +200,25 @@ test("Shopify assistant permissions require host approval for the exact action a
|
|
|
200
200
|
|
|
201
201
|
test("Shopify assistant never/always policies, overrides and disabled access preserve normal app authorization and cleanup", async (t) => {
|
|
202
202
|
const f = await fixture(t, { assistantPolicy: { enabled: true, defaultPermission: "never", actions: { "products.list": "always", "products.create": "ask" } } });
|
|
203
|
-
await f.connect(); const assistant = createConnectionService({ ...f.options, executionMode: "assistant" });
|
|
203
|
+
await f.connect(); const assistant = createConnectionService({ appEnv: "test", ...f.options, executionMode: "assistant" });
|
|
204
204
|
await assistant.invoke({ ...args, operation: "products.list" });
|
|
205
205
|
await assert.rejects(assistant.invoke({ ...args, operation: "products.delete", input: { input: { id: product.id } } }), { code: "connector_access_denied" });
|
|
206
206
|
f.state.denied = true; await assert.rejects(assistant.invoke({ ...args, operation: "products.list" }), { code: "connector_access_denied" }); f.state.denied = false;
|
|
207
207
|
const configuration = structuredClone(f.options.configuration); configuration.integrations.shopify.assistantPolicy.enabled = false;
|
|
208
|
-
const disabled = createConnectionService({ ...f.options, configuration, executionMode: "assistant" });
|
|
208
|
+
const disabled = createConnectionService({ appEnv: "test", ...f.options, configuration, executionMode: "assistant" });
|
|
209
209
|
await assert.rejects(disabled.invoke({ ...args, operation: "products.list" }), { code: "connector_access_denied" });
|
|
210
210
|
assert.equal((await disabled.status(args)).status, "connected"); await disabled.disconnect(args);
|
|
211
211
|
assert.equal((await disabled.status(args)).status, "disconnected");
|
|
212
212
|
});
|
|
213
213
|
|
|
214
214
|
test("Shopify lifecycle permissions authorize declared host actions without inventing store activation or claiming", async (t) => {
|
|
215
|
-
const f = await fixture(t); const assistant = createConnectionService({ ...f.options, executionMode: "assistant" });
|
|
215
|
+
const f = await fixture(t); const assistant = createConnectionService({ appEnv: "test", ...f.options, executionMode: "assistant" });
|
|
216
216
|
await assert.rejects(assistant.authorizeAssistantAction({ ...args, action: "claim", input: { store: "fixture-store" } }), { code: "connector_approval_required" });
|
|
217
217
|
f.state.approved = true; await assistant.authorizeAssistantAction({ ...args, action: "claim", input: { store: "fixture-store" } });
|
|
218
218
|
assert.deepEqual(f.decisions.at(-1).input, { store: "fixture-store" }); assert.equal(f.requests.length, 0);
|
|
219
219
|
await assert.rejects(assistant.authorizeAssistantAction({ ...args, action: "invented" }), { code: "connector_operation_unknown" });
|
|
220
220
|
await assert.rejects(f.service.authorizeAssistantAction({ ...args, action: "claim" }), { code: "connector_operation_unknown" });
|
|
221
|
-
assert.throws(() => createConnectionService({ ...f.options, executionMode: "browser-choice" }));
|
|
221
|
+
assert.throws(() => createConnectionService({ appEnv: "test", ...f.options, executionMode: "browser-choice" }));
|
|
222
222
|
});
|
|
223
223
|
|
|
224
224
|
test("Shopify reports provider failures and cancellation without retrying a product mutation", async (t) => {
|
package/test/slack.test.js
CHANGED
|
@@ -59,7 +59,7 @@ async function fixture(t, actor = "user", granted = scopes) {
|
|
|
59
59
|
return Response.json(url.pathname === "/api/auth.test" ? { ok: true, team_id: "T123", user_id: "U123" } : state.page, { status: state.apiStatus });
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
|
-
const service = createConnectionService({ ...options,
|
|
62
|
+
const service = createConnectionService({ ...options, appEnv: "production" });
|
|
63
63
|
async function start() {
|
|
64
64
|
const { authorizationUrl } = await service.beginAuthorization(input);
|
|
65
65
|
const url = new URL(authorizationUrl);
|
|
@@ -91,7 +91,7 @@ for (const actor of ["user", "bot"]) {
|
|
|
91
91
|
assert(body.get("code_verifier"));
|
|
92
92
|
assert.equal(requests[1].url.searchParams.get("types"), "public_channel");
|
|
93
93
|
for (const filename of await readdir(directory)) assert(!(await readFile(path.join(directory, filename), "utf8")).includes("secret-"));
|
|
94
|
-
const restarted = createConnectionService({
|
|
94
|
+
const restarted = createConnectionService({ appEnv: "production", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
95
95
|
assert.deepEqual(await restarted.status(input), { ...connected, callbackUrl: callback });
|
|
96
96
|
for (const [operation, type] of [["channels.list", "public_channel"], ["groups.list", "private_channel"], ["directMessages.list", "im"], ["groupMessages.list", "mpim"]]) {
|
|
97
97
|
assert.deepEqual(await restarted.invoke({ ...input, operation, input: { limit: 5, cursor: "next +&/=", exclude_archived: true } }), page);
|
|
@@ -111,7 +111,7 @@ for (const actor of ["user", "bot"]) {
|
|
|
111
111
|
const { service, options, state, connect, requests } = await fixture(t, actor);
|
|
112
112
|
await connect();
|
|
113
113
|
state.time += 40_000;
|
|
114
|
-
const restarted = createConnectionService({ ...options,
|
|
114
|
+
const restarted = createConnectionService({ ...options, appEnv: "production" });
|
|
115
115
|
await Promise.all([service.invoke({ ...input, operation: "channels.list" }), restarted.invoke({ ...input, operation: "groups.list" })]);
|
|
116
116
|
assert.equal(state.tokenCount, 2);
|
|
117
117
|
state.time += 40_000;
|
|
@@ -177,7 +177,7 @@ test("Slack changing actor invalidates pending attempts and connections, and can
|
|
|
177
177
|
const next = await start();
|
|
178
178
|
const configuration = structuredClone(options.configuration);
|
|
179
179
|
configuration.integrations.slack.settings.actor = "bot";
|
|
180
|
-
const changed = createConnectionService({
|
|
180
|
+
const changed = createConnectionService({ appEnv: "production", ...options, configuration });
|
|
181
181
|
const before = requests.length;
|
|
182
182
|
await assert.rejects(changed.completeAuthorization({ ...input, callbackUrl: next.callbackUrl }), { code: "connector_attempt_invalid" });
|
|
183
183
|
await assert.rejects(changed.invoke({ ...input, operation: "channels.list" }), { code: "connector_reconnect_required" });
|
|
@@ -247,7 +247,7 @@ test("Slack API throttling does not replay and revocation persists reconnect sta
|
|
|
247
247
|
state.apiStatus = 200;
|
|
248
248
|
state.page = { ok: false, error: "token_revoked", detail: "secret-client" };
|
|
249
249
|
await assert.rejects(service.invoke({ ...input, operation: "channels.list" }), { code: "connector_reconnect_required" });
|
|
250
|
-
const restarted = createConnectionService({ ...options,
|
|
250
|
+
const restarted = createConnectionService({ ...options, appEnv: "production" });
|
|
251
251
|
assert.equal((await restarted.status(input)).status, "reconnect-required");
|
|
252
252
|
before = requests.length;
|
|
253
253
|
await assert.rejects(restarted.invoke({ ...input, operation: "channels.list" }), { code: "connector_reconnect_required" });
|
package/test/snowflake.test.js
CHANGED
|
@@ -70,7 +70,7 @@ async function fixture(t, { role = "REPORTING_READER", accountUrl = "https://myo
|
|
|
70
70
|
return Response.json(state.value === undefined ? [database] : state.value, { status: state.status });
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
|
-
const service = createConnectionService(options);
|
|
73
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
74
74
|
const start = async () => {
|
|
75
75
|
const { authorizationUrl } = await service.beginAuthorization({ ...args, verificationInput: { showLimit: 1 } });
|
|
76
76
|
const url = new URL(authorizationUrl); const returned = new URL(callback);
|
|
@@ -91,7 +91,7 @@ test("Snowflake binds PKCE and credentials to the account and persists encrypted
|
|
|
91
91
|
const value = await readFile(path.join(f.directory, file), "utf8");
|
|
92
92
|
for (const secret of ["private-code", "private+secret/=", "private-access-1", "private-refresh-1"]) assert.equal(value.includes(secret), false);
|
|
93
93
|
}
|
|
94
|
-
const restarted = createConnectionService(f.options);
|
|
94
|
+
const restarted = createConnectionService({ appEnv: "test", ...f.options });
|
|
95
95
|
assert.equal((await restarted.status(args)).status, "connected");
|
|
96
96
|
assert.deepEqual((await restarted.status(args)).grantedScopes, ["refresh_token", "session:role:REPORTING_READER"]);
|
|
97
97
|
assert.deepEqual(await restarted.invoke({ ...args, operation: "databases.list" }), [database]);
|
|
@@ -131,12 +131,12 @@ test("Snowflake isolates application users and invalidates saved grants after ac
|
|
|
131
131
|
for (const owner of [{ ...context, subjectId: "another" }, { ...context, applicationId: "another" }]) {
|
|
132
132
|
await assert.rejects(f.service.invoke({ ...args, context: owner, operation: "databases.list" }), { code: "connector_reconnect_required" });
|
|
133
133
|
}
|
|
134
|
-
const denied = createConnectionService({ ...f.options, authorize: async () => null });
|
|
134
|
+
const denied = createConnectionService({ appEnv: "test", ...f.options, authorize: async () => null });
|
|
135
135
|
await assert.rejects(denied.invoke({ ...args, operation: "databases.list" }), { code: "connector_access_denied" });
|
|
136
136
|
for (const settings of [{ accountUrl: "https://other-account.snowflakecomputing.com", role: "REPORTING_READER" }, { accountUrl: "https://myorg-myaccount.snowflakecomputing.com", role: "PUBLIC" }]) {
|
|
137
137
|
const configuration = structuredClone(f.options.configuration); configuration.integrations.warehouse.settings = settings;
|
|
138
138
|
configuration.integrations.warehouse.scopes = getProviderScopes(snowflakeProvider, settings).map((scope) => scope.value);
|
|
139
|
-
const changed = createConnectionService({ ...f.options, configuration });
|
|
139
|
+
const changed = createConnectionService({ appEnv: "test", ...f.options, configuration });
|
|
140
140
|
assert.equal((await changed.status(args)).status, "reconnect-required");
|
|
141
141
|
await assert.rejects(changed.invoke({ ...args, operation: "databases.list" }), { code: "connector_reconnect_required" });
|
|
142
142
|
}
|
|
@@ -146,7 +146,7 @@ test("Snowflake isolates application users and invalidates saved grants after ac
|
|
|
146
146
|
test("Snowflake saves rotated refresh tokens before a failed read and marks revoked tokens for reconnection", async (t) => {
|
|
147
147
|
const f = await fixture(t, { basic: true }); await f.connect(); f.state.time += 121_000; f.state.status = 429; f.state.secret = "rotated+secret/=";
|
|
148
148
|
await assert.rejects(f.service.invoke({ ...args, operation: "databases.list" }), { code: "connector_rate_limited" });
|
|
149
|
-
f.state.status = 200; const restarted = createConnectionService(f.options);
|
|
149
|
+
f.state.status = 200; const restarted = createConnectionService({ appEnv: "test", ...f.options });
|
|
150
150
|
await restarted.invoke({ ...args, operation: "databases.list" }); assert.equal(f.state.count, 2);
|
|
151
151
|
f.state.time += 121_000; f.state.tokenStatus = 400;
|
|
152
152
|
await assert.rejects(restarted.invoke({ ...args, operation: "databases.list" }), (error) => error.code === "connector_reconnect_required" && !error.message.includes("private"));
|
|
@@ -171,7 +171,7 @@ test("Snowflake accepts short-lived consent without refresh and rejects malforme
|
|
|
171
171
|
test("Snowflake consumes denied, cancelled, mismatched and replayed attempts while preserving earlier access", async (t) => {
|
|
172
172
|
const f = await fixture(t); await f.connect(); const start = await f.start();
|
|
173
173
|
const configuration = structuredClone(f.options.configuration); configuration.integrations.warehouse.settings.accountUrl = "https://other-account.snowflakecomputing.com";
|
|
174
|
-
const other = createConnectionService({ ...f.options, configuration });
|
|
174
|
+
const other = createConnectionService({ appEnv: "test", ...f.options, configuration });
|
|
175
175
|
await assert.rejects(other.completeAuthorization({ ...args, callbackUrl: start.callbackUrl }), { code: "connector_attempt_invalid" });
|
|
176
176
|
const denied = await f.start(); const returned = new URL(denied.callbackUrl); returned.searchParams.delete("code"); returned.searchParams.set("error", "access_denied");
|
|
177
177
|
await assert.rejects(f.service.completeAuthorization({ ...args, callbackUrl: returned.href }), { code: "connector_consent_denied" });
|
|
@@ -329,7 +329,7 @@ test("Snowflake application policy gates SQL, handles and warehouse resources be
|
|
|
329
329
|
const handle = "019c07a7-0000-df4f-0000-001000067872";
|
|
330
330
|
const deniedHandle = "536fad38-b564-4dc5-9892-a4543504df6c";
|
|
331
331
|
const seen = [];
|
|
332
|
-
const service = createConnectionService({ ...f.options, authorize: async (owner, request) => {
|
|
332
|
+
const service = createConnectionService({ appEnv: "test", ...f.options, authorize: async (owner, request) => {
|
|
333
333
|
seen.push(request);
|
|
334
334
|
if ((request.operation === "statements.submit" && request.input.statement !== "select 1") ||
|
|
335
335
|
(request.operation === "statements.get" && request.input.handle !== handle) ||
|
package/test/tally.test.js
CHANGED
|
@@ -12,6 +12,7 @@ test("Tally submission retrieval preserves answers and explicit paging with acco
|
|
|
12
12
|
const requests = [];
|
|
13
13
|
let response = { items: [], total: 0, hasMore: false }, status = 200;
|
|
14
14
|
const service = createConnectionService({
|
|
15
|
+
appEnv: "test",
|
|
15
16
|
configuration: { schemaVersion: 1, registrations: {}, integrations: { forms: {
|
|
16
17
|
provider: "tally", accountMode: "shared", displayName: "Forms", scopes: [],
|
|
17
18
|
authentication: { method: "api-key", secretRef: "env:TALLY_API_KEY" }
|
package/test/telegram.test.js
CHANGED
|
@@ -11,7 +11,7 @@ test("Telegram sends plain messages and polls without hidden acknowledgement or
|
|
|
11
11
|
t.after(() => rm(directory, { recursive: true, force: true }));
|
|
12
12
|
const requests = [];
|
|
13
13
|
let response = { ok: true, result: { id: 123, is_bot: true, first_name: "Fixture" } }, status = 200;
|
|
14
|
-
const service = createConnectionService({
|
|
14
|
+
const service = createConnectionService({ appEnv: "production",
|
|
15
15
|
configuration: { schemaVersion: 1, registrations: {}, integrations: { forms: {
|
|
16
16
|
provider: "telegram", accountMode: "shared", displayName: "Forms", scopes: [],
|
|
17
17
|
authentication: { method: "api-key", secretRef: "env:TELEGRAM_BOT_TOKEN" }
|
package/test/tiktok.test.js
CHANGED
|
@@ -49,7 +49,7 @@ async function fixture(t) {
|
|
|
49
49
|
return Response.json(state.response, { status: state.status });
|
|
50
50
|
}
|
|
51
51
|
};
|
|
52
|
-
const service = createConnectionService(options);
|
|
52
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
53
53
|
async function start() {
|
|
54
54
|
const { authorizationUrl } = await service.beginAuthorization(input);
|
|
55
55
|
const url = new URL(authorizationUrl); const redirect = new URL(callback);
|
|
@@ -75,7 +75,7 @@ test("TikTok configuration requires basic access, a confidential registration an
|
|
|
75
75
|
assert.throws(() => validateIntegrationConfiguration(config, { providers: [provider] }), { code: "integration_configuration_invalid" });
|
|
76
76
|
}
|
|
77
77
|
for (const value of ["http://127.0.0.1:8080/callback", `${callback}?tenant=1`, `${callback}#done`, `https://app.example/${"x".repeat(500)}`]) {
|
|
78
|
-
const service = createConnectionService({ ...options, resolveReference: async (ref) => ref === "env:TIKTOK_CALLBACK" ? value : "fixture-client-secret" });
|
|
78
|
+
const service = createConnectionService({ appEnv: "test", ...options, resolveReference: async (ref) => ref === "env:TIKTOK_CALLBACK" ? value : "fixture-client-secret" });
|
|
79
79
|
await assert.rejects(service.beginAuthorization(input), { code: "connector_callback_invalid" });
|
|
80
80
|
}
|
|
81
81
|
assert.equal(state.calls.length, 0);
|
|
@@ -98,7 +98,7 @@ test("TikTok sends client_key and comma scopes, verifies the account and persist
|
|
|
98
98
|
const text = await readFile(path.join(directory, name), "utf8");
|
|
99
99
|
for (const secret of ["fixture-client-secret", "fixture-access-1", "fixture-refresh-1"]) assert.equal(text.includes(secret), false);
|
|
100
100
|
}
|
|
101
|
-
const restarted = createConnectionService({ ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
101
|
+
const restarted = createConnectionService({ appEnv: "test", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
102
102
|
assert.deepEqual(await restarted.invoke({ ...input, operation: "profile.read" }), profile);
|
|
103
103
|
for (const owner of [{ ...context, applicationId: "another-app" }, { ...context, subjectId: "another-user" }]) {
|
|
104
104
|
await assert.rejects(restarted.invoke({ ...input, context: owner, operation: "profile.read" }), { code: "connector_reconnect_required" });
|
|
@@ -145,7 +145,7 @@ test("TikTok refresh can shrink permissions and initial grants cannot exceed con
|
|
|
145
145
|
await assert.rejects(service.invoke({ ...input, operation: "videos.list" }), { code: "connector_scope_missing" });
|
|
146
146
|
await service.disconnect(input);
|
|
147
147
|
const config = structuredClone(configuration); config.integrations.tiktok.scopes = ["user.info.basic"];
|
|
148
|
-
const reduced = createConnectionService({ ...options, configuration: config });
|
|
148
|
+
const reduced = createConnectionService({ appEnv: "test", ...options, configuration: config });
|
|
149
149
|
state.scope = scopes.join(",");
|
|
150
150
|
const begin = new URL((await reduced.beginAuthorization(input)).authorizationUrl);
|
|
151
151
|
const result = await reduced.completeAuthorization({ ...input, callbackUrl: `${callback}?state=${begin.searchParams.get("state")}&code=code` });
|
|
@@ -215,7 +215,7 @@ test("TikTok distinguishes missing scopes from expired access and sanitizes prov
|
|
|
215
215
|
state.stall = true;
|
|
216
216
|
const controller = new AbortController(); controller.abort();
|
|
217
217
|
await assert.rejects(service.invoke({ ...input, operation: "profile.read", signal: controller.signal }), { code: "connector_cancelled" });
|
|
218
|
-
const timeoutService = createConnectionService({ ...options, providers: [{ ...provider, requestTimeoutMs: 20 }] });
|
|
218
|
+
const timeoutService = createConnectionService({ appEnv: "test", ...options, providers: [{ ...provider, requestTimeoutMs: 20 }] });
|
|
219
219
|
const keepAlive = setTimeout(() => {}, 1000);
|
|
220
220
|
try { await assert.rejects(timeoutService.invoke({ ...input, operation: "profile.read" }), { code: "connector_provider_timeout" }); }
|
|
221
221
|
finally { clearTimeout(keepAlive); }
|
|
@@ -230,9 +230,9 @@ test("TikTok enforces host policy, registration ownership and unavailable manage
|
|
|
230
230
|
const before = state.calls.length; state.deny = true;
|
|
231
231
|
await assert.rejects(service.invoke({ ...input, operation: "profile.read" })); assert.equal(state.calls.length, before); state.deny = false;
|
|
232
232
|
const changed = structuredClone(configuration); changed.registrations.tiktok.clientId = "other-key";
|
|
233
|
-
await assert.rejects(createConnectionService({ ...options, configuration: changed }).invoke({ ...input, operation: "profile.read" }), { code: "connector_reconnect_required" });
|
|
233
|
+
await assert.rejects(createConnectionService({ appEnv: "test", ...options, configuration: changed }).invoke({ ...input, operation: "profile.read" }), { code: "connector_reconnect_required" });
|
|
234
234
|
changed.registrations.tiktok = { source: "managed", serviceUrlRef: "env:GATEWAY", serviceCredentialRef: "env:GATEWAY_KEY", assignmentRef: "shared" };
|
|
235
|
-
assert.throws(() => createConnectionService({ ...options, configuration: changed }), { code: "integration_configuration_invalid" });
|
|
235
|
+
assert.throws(() => createConnectionService({ appEnv: "test", ...options, configuration: changed }), { code: "integration_configuration_invalid" });
|
|
236
236
|
assert.equal(state.calls.length, before);
|
|
237
237
|
});
|
|
238
238
|
|