@jskit-ai/connectors-catalog 0.2.39 → 0.2.41
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/xero.test.js
CHANGED
|
@@ -62,7 +62,7 @@ async function fixture(t) {
|
|
|
62
62
|
return Response.json(state.response, { status: state.accountingStatus ?? state.status });
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
|
-
const service = createConnectionService(options);
|
|
65
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
66
66
|
async function start() {
|
|
67
67
|
const { authorizationUrl } = await service.beginAuthorization(input);
|
|
68
68
|
const url = new URL(authorizationUrl);
|
|
@@ -89,7 +89,7 @@ test("Xero exchanges code with Basic authentication, discovers tenants and persi
|
|
|
89
89
|
const value = await readFile(path.join(f.directory, file), "utf8");
|
|
90
90
|
for (const secret of ["fixture-client-secret", "fixture-access-1", "fixture-refresh-1"]) assert.equal(value.includes(secret), false);
|
|
91
91
|
}
|
|
92
|
-
const restarted = createConnectionService({ ...f.options, store: createFileConnectionStore({ directory: f.directory, protection: f.protection }) });
|
|
92
|
+
const restarted = createConnectionService({ appEnv: "test", ...f.options, store: createFileConnectionStore({ directory: f.directory, protection: f.protection }) });
|
|
93
93
|
assert.deepEqual(await restarted.status(input), { ...connected, callbackUrl: callback });
|
|
94
94
|
assert.deepEqual(await restarted.invoke({ ...input, operation: "connections.list" }), [connection]);
|
|
95
95
|
for (const owner of [{ ...context, applicationId: "other-app" }, { ...context, subjectId: "other-user" }]) {
|
|
@@ -118,7 +118,7 @@ test("Xero configuration supports captured permissions plus read variants and re
|
|
|
118
118
|
const copy = structuredClone(config); copy.registrations.xero.source = "managed";
|
|
119
119
|
delete copy.registrations.xero.clientId; delete copy.registrations.xero.clientSecretRef; delete copy.registrations.xero.callbackUrlRef; delete copy.registrations.xero.tokenEndpointAuthMethod;
|
|
120
120
|
Object.assign(copy.registrations.xero, { serviceUrlRef: "env:GATEWAY", serviceCredentialRef: "env:APP", assignmentRef: "paid" });
|
|
121
|
-
assert.throws(() => createConnectionService({ ...f.options, configuration: copy }), { code: "integration_configuration_invalid" });
|
|
121
|
+
assert.throws(() => createConnectionService({ appEnv: "test", ...f.options, configuration: copy }), { code: "integration_configuration_invalid" });
|
|
122
122
|
});
|
|
123
123
|
|
|
124
124
|
test("Xero checks current organisation permission before every accounting request and leaves discovery unscoped", async (t) => {
|
|
@@ -173,7 +173,7 @@ test("Xero serializes refresh rotation, persists reduced grants and retains new
|
|
|
173
173
|
f.state.tokenScope = "offline_access accounting.contacts.read"; f.state.time += 40_000; f.state.status = 429;
|
|
174
174
|
await assert.rejects(f.service.invoke({ ...input, operation: "contacts.list", input: { tenantId } }), { code: "connector_rate_limited" });
|
|
175
175
|
assert.equal(f.state.tokenCount, 3); f.state.status = 200;
|
|
176
|
-
const restarted = createConnectionService(f.options);
|
|
176
|
+
const restarted = createConnectionService({ appEnv: "test", ...f.options });
|
|
177
177
|
assert.deepEqual((await restarted.status(input)).grantedScopes, ["offline_access", "accounting.contacts.read"]);
|
|
178
178
|
await restarted.invoke({ ...input, operation: "contacts.list", input: { tenantId } });
|
|
179
179
|
assert.equal(f.state.tokenCount, 3);
|
|
@@ -197,7 +197,7 @@ test("Xero consent cancellation, denied scopes and registration changes cannot r
|
|
|
197
197
|
await assert.rejects(f.service.invoke({ ...input, operation: "contacts.list", input: { tenantId } }), { code: "connector_scope_missing" });
|
|
198
198
|
assert.equal(f.requests.length, count);
|
|
199
199
|
const pending = await f.start(); const changed = structuredClone(f.options.configuration); changed.registrations.xero.clientId = "other-client";
|
|
200
|
-
const service = createConnectionService({ ...f.options, configuration: changed });
|
|
200
|
+
const service = createConnectionService({ appEnv: "test", ...f.options, configuration: changed });
|
|
201
201
|
assert.equal((await service.status(input)).status, "reconnect-required");
|
|
202
202
|
await assert.rejects(service.completeAuthorization({ ...input, callbackUrl: pending.callbackUrl }), { code: "connector_attempt_invalid" });
|
|
203
203
|
assert.equal(f.requests.length, count);
|
|
@@ -207,7 +207,7 @@ test("Xero accepts read-only or full accounting scopes and applies host authoriz
|
|
|
207
207
|
const f = await fixture(t); const config = structuredClone(f.options.configuration);
|
|
208
208
|
config.integrations.xero.scopes = ["offline_access", "accounting.contacts", "accounting.invoices", "accounting.settings"];
|
|
209
209
|
f.state.tokenScope = config.integrations.xero.scopes.join(" ");
|
|
210
|
-
const service = createConnectionService({ ...f.options, configuration: config });
|
|
210
|
+
const service = createConnectionService({ appEnv: "test", ...f.options, configuration: config });
|
|
211
211
|
const started = await service.beginAuthorization(input);
|
|
212
212
|
await service.completeAuthorization({ ...input, callbackUrl: `${callback}?code=fixture&state=${new URL(started.authorizationUrl).searchParams.get("state")}` });
|
|
213
213
|
await service.invoke({ ...input, operation: "contacts.list", input: { tenantId } });
|
|
@@ -252,7 +252,7 @@ test("Xero interruption and timeout stop before the accounting call and keep the
|
|
|
252
252
|
const keepAlive = setTimeout(() => {}, 1000);
|
|
253
253
|
t.after(() => clearTimeout(keepAlive));
|
|
254
254
|
const f = await fixture(t); await f.connect(); f.state.stall = true;
|
|
255
|
-
const service = createConnectionService({ ...f.options, providers: [{ ...xeroProvider, requestTimeoutMs: 35 }] });
|
|
255
|
+
const service = createConnectionService({ appEnv: "test", ...f.options, providers: [{ ...xeroProvider, requestTimeoutMs: 35 }] });
|
|
256
256
|
const count = f.requests.length;
|
|
257
257
|
await assert.rejects(service.invoke({ ...input, operation: "contacts.list", input: { tenantId } }));
|
|
258
258
|
assert.equal(f.requests.length, count + 1); assert.equal(f.requests.at(-1).url.pathname, "/connections");
|
|
@@ -268,7 +268,7 @@ test("Xero payment pages preserve amounts and invoice references and enforce cur
|
|
|
268
268
|
const scopes = [...defaults, "accounting.payments.read"];
|
|
269
269
|
f.options.configuration.integrations.xero.scopes = scopes;
|
|
270
270
|
f.state.tokenScope = scopes.join(" ");
|
|
271
|
-
const service = createConnectionService(f.options);
|
|
271
|
+
const service = createConnectionService({ appEnv: "test", ...f.options });
|
|
272
272
|
const { authorizationUrl } = await service.beginAuthorization(input);
|
|
273
273
|
const url = new URL(callback); url.searchParams.set("code", "fixture-code");
|
|
274
274
|
url.searchParams.set("state", new URL(authorizationUrl).searchParams.get("state"));
|
|
@@ -298,7 +298,7 @@ test("Xero financial reports retain nested rows and decimal text with explicit d
|
|
|
298
298
|
const f = await fixture(t);
|
|
299
299
|
const scopes = [...defaults, "accounting.reports.profitandloss.read", "accounting.reports.balancesheet.read"];
|
|
300
300
|
f.options.configuration.integrations.xero.scopes = scopes; f.state.tokenScope = scopes.join(" ");
|
|
301
|
-
const service = createConnectionService(f.options);
|
|
301
|
+
const service = createConnectionService({ appEnv: "test", ...f.options });
|
|
302
302
|
const { authorizationUrl } = await service.beginAuthorization(input);
|
|
303
303
|
const url = new URL(callback); url.searchParams.set("code", "fixture-code");
|
|
304
304
|
url.searchParams.set("state", new URL(authorizationUrl).searchParams.get("state"));
|
|
@@ -359,7 +359,7 @@ test("Xero contact writes use stable idempotency and never forward a write to te
|
|
|
359
359
|
const f = await fixture(t);
|
|
360
360
|
const scopes = [...defaults, "accounting.contacts"];
|
|
361
361
|
f.options.configuration.integrations.xero.scopes = scopes; f.state.tokenScope = scopes.join(" ");
|
|
362
|
-
const service = createConnectionService(f.options);
|
|
362
|
+
const service = createConnectionService({ appEnv: "test", ...f.options });
|
|
363
363
|
const { authorizationUrl } = await service.beginAuthorization(input);
|
|
364
364
|
const url = new URL(callback); url.searchParams.set("code", "fixture-code"); url.searchParams.set("state", new URL(authorizationUrl).searchParams.get("state"));
|
|
365
365
|
await service.completeAuthorization({ ...input, callbackUrl: url.href });
|
|
@@ -387,7 +387,7 @@ test("Xero records one deliberate invoice payment with an explicit account and n
|
|
|
387
387
|
const f = await fixture(t);
|
|
388
388
|
const scopes = [...defaults, "accounting.payments"];
|
|
389
389
|
f.options.configuration.integrations.xero.scopes = scopes; f.state.tokenScope = scopes.join(" ");
|
|
390
|
-
const service = createConnectionService(f.options);
|
|
390
|
+
const service = createConnectionService({ appEnv: "test", ...f.options });
|
|
391
391
|
const { authorizationUrl } = await service.beginAuthorization(input);
|
|
392
392
|
const url = new URL(callback); url.searchParams.set("code", "fixture-code"); url.searchParams.set("state", new URL(authorizationUrl).searchParams.get("state"));
|
|
393
393
|
await service.completeAuthorization({ ...input, callbackUrl: url.href });
|
|
@@ -420,7 +420,7 @@ test("Xero invoice writes retain explicit currency, tax basis and line precision
|
|
|
420
420
|
const f = await fixture(t);
|
|
421
421
|
const scopes = [...defaults, "accounting.invoices"];
|
|
422
422
|
f.options.configuration.integrations.xero.scopes = scopes; f.state.tokenScope = scopes.join(" ");
|
|
423
|
-
const service = createConnectionService(f.options);
|
|
423
|
+
const service = createConnectionService({ appEnv: "test", ...f.options });
|
|
424
424
|
const { authorizationUrl } = await service.beginAuthorization(input);
|
|
425
425
|
const url = new URL(callback); url.searchParams.set("code", "fixture-code"); url.searchParams.set("state", new URL(authorizationUrl).searchParams.get("state"));
|
|
426
426
|
await service.completeAuthorization({ ...input, callbackUrl: url.href });
|
|
@@ -480,7 +480,7 @@ test("Xero aged, executive, bank and trial reports use individual scopes and exp
|
|
|
480
480
|
];
|
|
481
481
|
const scopes = [...defaults, ...new Set(cases.map(([, , scope]) => `accounting.reports.${scope}.read`))];
|
|
482
482
|
f.options.configuration.integrations.xero.scopes = scopes; f.state.tokenScope = scopes.join(" ");
|
|
483
|
-
const service = createConnectionService(f.options);
|
|
483
|
+
const service = createConnectionService({ appEnv: "test", ...f.options });
|
|
484
484
|
const { authorizationUrl } = await service.beginAuthorization(input);
|
|
485
485
|
const url = new URL(callback); url.searchParams.set("code", "fixture-code");
|
|
486
486
|
url.searchParams.set("state", new URL(authorizationUrl).searchParams.get("state"));
|
|
@@ -505,7 +505,7 @@ test("Xero budgets preserve account balances and enforce date ranges, record ide
|
|
|
505
505
|
const f = await fixture(t);
|
|
506
506
|
const scopes = [...defaults, "accounting.budgets.read", "accounting.reports.budgetsummary.read"];
|
|
507
507
|
f.options.configuration.integrations.xero.scopes = scopes; f.state.tokenScope = scopes.join(" ");
|
|
508
|
-
const service = createConnectionService(f.options);
|
|
508
|
+
const service = createConnectionService({ appEnv: "test", ...f.options });
|
|
509
509
|
const { authorizationUrl } = await service.beginAuthorization(input);
|
|
510
510
|
const url = new URL(callback); url.searchParams.set("code", "fixture-code");
|
|
511
511
|
url.searchParams.set("state", new URL(authorizationUrl).searchParams.get("state"));
|
|
@@ -545,7 +545,7 @@ test("Xero bank and manual journal reads preserve native detail and enforce fixe
|
|
|
545
545
|
const f = await fixture(t);
|
|
546
546
|
const scopes = [...defaults, "accounting.banktransactions.read", "accounting.manualjournals.read"];
|
|
547
547
|
f.options.configuration.integrations.xero.scopes = scopes; f.state.tokenScope = scopes.join(" ");
|
|
548
|
-
const service = createConnectionService(f.options);
|
|
548
|
+
const service = createConnectionService({ appEnv: "test", ...f.options });
|
|
549
549
|
const { authorizationUrl } = await service.beginAuthorization(input);
|
|
550
550
|
const url = new URL(callback); url.searchParams.set("code", "fixture-code");
|
|
551
551
|
url.searchParams.set("state", new URL(authorizationUrl).searchParams.get("state"));
|
|
@@ -581,7 +581,7 @@ test("Xero manual journal writes default to draft and retain deliberate posting,
|
|
|
581
581
|
const f = await fixture(t);
|
|
582
582
|
const scopes = [...defaults, "accounting.manualjournals"];
|
|
583
583
|
f.options.configuration.integrations.xero.scopes = scopes; f.state.tokenScope = scopes.join(" ");
|
|
584
|
-
const service = createConnectionService(f.options);
|
|
584
|
+
const service = createConnectionService({ appEnv: "test", ...f.options });
|
|
585
585
|
const { authorizationUrl } = await service.beginAuthorization(input);
|
|
586
586
|
const url = new URL(callback); url.searchParams.set("code", "fixture-code");
|
|
587
587
|
url.searchParams.set("state", new URL(authorizationUrl).searchParams.get("state"));
|
|
@@ -619,7 +619,7 @@ test("Xero spend and receive writes use explicit bank/contact references and nev
|
|
|
619
619
|
const f = await fixture(t);
|
|
620
620
|
const scopes = [...defaults, "accounting.banktransactions"];
|
|
621
621
|
f.options.configuration.integrations.xero.scopes = scopes; f.state.tokenScope = scopes.join(" ");
|
|
622
|
-
const service = createConnectionService(f.options);
|
|
622
|
+
const service = createConnectionService({ appEnv: "test", ...f.options });
|
|
623
623
|
const { authorizationUrl } = await service.beginAuthorization(input);
|
|
624
624
|
const url = new URL(callback); url.searchParams.set("code", "fixture-code");
|
|
625
625
|
url.searchParams.set("state", new URL(authorizationUrl).searchParams.get("state"));
|
|
@@ -658,7 +658,7 @@ test("Xero attachments use parent-bound file paths, binary bodies and checked or
|
|
|
658
658
|
const f = await fixture(t);
|
|
659
659
|
const scopes = [...defaults, "accounting.attachments"];
|
|
660
660
|
f.options.configuration.integrations.xero.scopes = scopes; f.state.tokenScope = scopes.join(" ");
|
|
661
|
-
const service = createConnectionService(f.options);
|
|
661
|
+
const service = createConnectionService({ appEnv: "test", ...f.options });
|
|
662
662
|
const { authorizationUrl } = await service.beginAuthorization(input);
|
|
663
663
|
const url = new URL(callback); url.searchParams.set("code", "fixture-code");
|
|
664
664
|
url.searchParams.set("state", new URL(authorizationUrl).searchParams.get("state"));
|
package/test/zoho-books.test.js
CHANGED
|
@@ -71,7 +71,7 @@ async function fixture(t, settings = { region: "eu" }, selectedScopes = scopes)
|
|
|
71
71
|
return Response.json(state.value === undefined ? value : state.value, { status: state.status });
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
|
-
const service = createConnectionService(options);
|
|
74
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
75
75
|
const start = async () => {
|
|
76
76
|
const { authorizationUrl } = await service.beginAuthorization(args); const url = new URL(authorizationUrl);
|
|
77
77
|
const redirect = new URL(callback); redirect.searchParams.set("code", "fixture-code"); redirect.searchParams.set("state", url.searchParams.get("state"));
|
|
@@ -94,7 +94,7 @@ test("Zoho Books uses regional PKCE consent and persists verified credentials in
|
|
|
94
94
|
const text = await readFile(path.join(f.directory, name), "utf8");
|
|
95
95
|
for (const secret of ["fixture-code", "fixture-client-secret", "fixture-access-1", "fixture-refresh-token"]) assert.equal(text.includes(secret), false);
|
|
96
96
|
}
|
|
97
|
-
const restarted = createConnectionService(f.options);
|
|
97
|
+
const restarted = createConnectionService({ appEnv: "test", ...f.options });
|
|
98
98
|
assert.equal((await restarted.status(args)).status, "connected");
|
|
99
99
|
assert.deepEqual(await restarted.invoke({ ...args, operation: "organizations.list" }), organizations);
|
|
100
100
|
});
|
|
@@ -160,7 +160,7 @@ test("Zoho Books enforces read or full scopes and isolates application and user
|
|
|
160
160
|
for (const owner of [{ ...context, applicationId: "other" }, { ...context, subjectId: "other" }]) {
|
|
161
161
|
await assert.rejects(f.service.invoke({ ...args, context: owner, operation: "organizations.list" }), { code: "connector_reconnect_required" });
|
|
162
162
|
}
|
|
163
|
-
const denied = createConnectionService({ ...f.options, authorize: async () => null });
|
|
163
|
+
const denied = createConnectionService({ appEnv: "test", ...f.options, authorize: async () => null });
|
|
164
164
|
await assert.rejects(denied.invoke({ ...args, operation: "organizations.list" }), { code: "connector_access_denied" });
|
|
165
165
|
assert.equal(f.requests.length, 2);
|
|
166
166
|
const full = await fixture(t, { region: "eu", organizationId: org }, ["ZohoBooks.settings.READ", "ZohoBooks.contacts.ALL", "ZohoBooks.invoices.ALL"]);
|
|
@@ -173,7 +173,7 @@ test("Zoho Books refresh retains tokens and scopes across restart and persists b
|
|
|
173
173
|
assert.equal(f.state.count, 2); f.state.time += 40_000; f.state.status = 429;
|
|
174
174
|
await assert.rejects(f.service.invoke({ ...args, operation: "organizations.list" }), { code: "connector_rate_limited" });
|
|
175
175
|
f.state.status = 200;
|
|
176
|
-
const restarted = createConnectionService(f.options); await restarted.invoke({ ...args, operation: "organizations.list" });
|
|
176
|
+
const restarted = createConnectionService({ appEnv: "test", ...f.options }); await restarted.invoke({ ...args, operation: "organizations.list" });
|
|
177
177
|
assert.equal(f.state.count, 3); assert.deepEqual((await restarted.status(args)).grantedScopes, scopes);
|
|
178
178
|
f.state.time += 40_000; f.state.tokenValue = { error: "invalid_code", error_description: "sensitive provider text" };
|
|
179
179
|
await assert.rejects(restarted.invoke({ ...args, operation: "organizations.list" }), { code: "connector_reconnect_required" });
|
|
@@ -188,7 +188,7 @@ test("Zoho Books rejects token host substitution and binds saved connections to
|
|
|
188
188
|
const f = await fixture(t); await f.connect();
|
|
189
189
|
for (const change of [{ region: "sa" }, { organizationId: org }]) {
|
|
190
190
|
const configuration = structuredClone(f.options.configuration); Object.assign(configuration.integrations.books.settings, change);
|
|
191
|
-
await assert.rejects(createConnectionService({ ...f.options, configuration }).invoke({ ...args, operation: "organizations.list" }), { code: "connector_reconnect_required" });
|
|
191
|
+
await assert.rejects(createConnectionService({ appEnv: "test", ...f.options, configuration }).invoke({ ...args, operation: "organizations.list" }), { code: "connector_reconnect_required" });
|
|
192
192
|
}
|
|
193
193
|
});
|
|
194
194
|
|
package/test/zoho-crm.test.js
CHANGED
|
@@ -60,7 +60,7 @@ async function fixture(t, settings = { region: "us", environment: "production" }
|
|
|
60
60
|
return Response.json(state.value === undefined ? value : state.value, { status: state.status });
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
|
-
const service = createConnectionService(options);
|
|
63
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
64
64
|
const start = async () => {
|
|
65
65
|
const { authorizationUrl } = await service.beginAuthorization(args); const url = new URL(authorizationUrl);
|
|
66
66
|
const redirect = new URL(callback); redirect.searchParams.set("code", "fixture-code"); redirect.searchParams.set("state", url.searchParams.get("state"));
|
|
@@ -84,7 +84,7 @@ test("Zoho CRM uses regional code consent, PKCE, offline access and encrypted re
|
|
|
84
84
|
const text = await readFile(path.join(f.directory, file), "utf8");
|
|
85
85
|
for (const secret of ["fixture-code", "fixture-client-secret", "fixture-access-1", "fixture-refresh-token"]) assert.equal(text.includes(secret), false);
|
|
86
86
|
}
|
|
87
|
-
const restarted = createConnectionService(f.options);
|
|
87
|
+
const restarted = createConnectionService({ appEnv: "test", ...f.options });
|
|
88
88
|
assert.equal((await restarted.status(args)).status, "connected");
|
|
89
89
|
assert.deepEqual(await restarted.invoke({ ...args, operation: "users.current" }), profile);
|
|
90
90
|
});
|
|
@@ -131,7 +131,7 @@ test("Zoho CRM honors reduced scopes and full-module grants without cross-user c
|
|
|
131
131
|
for (const owner of [{ ...context, applicationId: "other" }, { ...context, subjectId: "other" }]) {
|
|
132
132
|
await assert.rejects(f.service.invoke({ ...args, context: owner, operation: "users.current" }), { 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: "users.current" }), { code: "connector_access_denied" });
|
|
136
136
|
assert.equal(f.requests.length, 2);
|
|
137
137
|
const all = await fixture(t, { region: "us", environment: "production" }, ["ZohoCRM.users.ALL", "ZohoCRM.modules.ALL"]);
|
|
@@ -145,7 +145,7 @@ test("Zoho CRM refresh retains the original refresh token and scopes across rest
|
|
|
145
145
|
f.state.time += 40_000; f.state.status = 429;
|
|
146
146
|
await assert.rejects(f.service.invoke({ ...args, operation: "users.current" }), { code: "connector_rate_limited" });
|
|
147
147
|
f.state.status = 200;
|
|
148
|
-
const restarted = createConnectionService(f.options); await restarted.invoke({ ...args, operation: "users.current" });
|
|
148
|
+
const restarted = createConnectionService({ appEnv: "test", ...f.options }); await restarted.invoke({ ...args, operation: "users.current" });
|
|
149
149
|
assert.equal(f.state.count, 3); assert.deepEqual((await restarted.status(args)).grantedScopes, scopes);
|
|
150
150
|
f.state.time += 40_000;
|
|
151
151
|
await restarted.invoke({ ...args, operation: "leads.list" }); assert.equal(f.state.count, 4);
|
|
@@ -168,7 +168,7 @@ test("Zoho CRM settings changes require reconnect and consent denial, cancellati
|
|
|
168
168
|
const f = await fixture(t); await f.connect();
|
|
169
169
|
for (const change of [{ region: "eu" }, { environment: "sandbox" }]) {
|
|
170
170
|
const configuration = structuredClone(f.options.configuration); Object.assign(configuration.integrations.crm.settings, change);
|
|
171
|
-
await assert.rejects(createConnectionService({ ...f.options, configuration }).invoke({ ...args, operation: "users.current" }), { code: "connector_reconnect_required" });
|
|
171
|
+
await assert.rejects(createConnectionService({ appEnv: "test", ...f.options, configuration }).invoke({ ...args, operation: "users.current" }), { code: "connector_reconnect_required" });
|
|
172
172
|
}
|
|
173
173
|
const start = await f.start(); const denied = new URL(start.callbackUrl); denied.searchParams.delete("code"); denied.searchParams.set("error", "access_denied");
|
|
174
174
|
await assert.rejects(f.service.completeAuthorization({ ...args, callbackUrl: denied.href }), { code: "connector_consent_denied" });
|