@jskit-ai/connectors-catalog 0.2.27 → 0.2.29
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/package.json +3 -3
- package/patterns/api-key-connection/example/connections.js +4 -1
- package/patterns/firebase-messaging/example/server/notifications.js +4 -1
- package/src/server/brevo.js +9 -8
- package/src/server/calendly.js +5 -4
- package/src/server/chargebee.js +6 -5
- package/src/server/firebase-cloud-messaging.js +2 -1
- package/src/server/gatewayapi.js +4 -3
- package/src/server/gmail.js +3 -2
- package/src/server/google-ads-search.js +3 -2
- package/src/server/incident-io.js +3 -2
- package/src/server/inngest.js +3 -2
- package/src/server/linkedin.js +2 -1
- package/src/server/mailgun.js +3 -2
- package/src/server/microsoft-outlook.js +5 -4
- package/src/server/microsoft-teams.js +4 -3
- package/src/server/resend.js +4 -3
- package/src/server/sideEffect.js +17 -0
- package/src/server/slack.js +3 -2
- package/src/server/telegram.js +3 -2
- package/src/server/twilio.js +5 -4
- package/src/server/twitch.js +3 -2
- package/src/server/wave.js +4 -3
- package/src/server/wixBookings.js +10 -9
- package/src/server/woocommerce.js +2 -1
- package/test/brevo.test.js +1 -1
- package/test/calendly.test.js +3 -3
- package/test/chargebee.test.js +4 -4
- package/test/firebase-cloud-messaging.test.js +4 -4
- package/test/google-ads.test.js +9 -9
- package/test/google.test.js +5 -5
- package/test/inngest.test.js +4 -4
- package/test/linkedin.test.js +6 -6
- package/test/mailgun.test.js +1 -1
- package/test/microsoft.test.js +5 -5
- package/test/resend.test.js +1 -1
- package/test/slack.test.js +5 -5
- package/test/telegram.test.js +1 -1
- 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.test.js +1 -1
package/test/tokens.test.js
CHANGED
|
@@ -125,7 +125,7 @@ async function fixture(t, entry) {
|
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
127
|
const input = { context: { applicationId: "app-one", subjectId: "account-one" }, integrationId: "source" };
|
|
128
|
-
return { service: createConnectionService(options), options, directory, protection, input, state, requests };
|
|
128
|
+
return { service: createConnectionService({ ...options, sideEffects: "live" }), options, directory, protection, input, state, requests };
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
for (const entry of cases) {
|
|
@@ -145,7 +145,7 @@ for (const entry of cases) {
|
|
|
145
145
|
assert.equal(first.init.redirect, "error");
|
|
146
146
|
for (const [header, value] of Object.entries(entry.extraHeaders || {})) assert.equal(first.headers.get(header), value);
|
|
147
147
|
for (const name of await readdir(directory)) assert.equal((await readFile(path.join(directory, name), "utf8")).includes(state.key), false);
|
|
148
|
-
const restarted = createConnectionService({ ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
148
|
+
const restarted = createConnectionService({ sideEffects: "live", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
149
149
|
assert.equal((await restarted.status(input)).status, "connected");
|
|
150
150
|
state.response = entry.operationResponse || entry.response;
|
|
151
151
|
state.key = entry.rotatedKey || "rotated-fixture-key";
|
|
@@ -224,7 +224,7 @@ test("Clay advances only explicitly requested query pages and validates each res
|
|
|
224
224
|
test("Clay search policy, billing failure and interrupted iterators never replay a request", async (t) => {
|
|
225
225
|
const { service, options, input, state, requests } = await fixture(t, cases.find(({ provider }) => provider === clayProvider));
|
|
226
226
|
await service.connectApiKey(input);
|
|
227
|
-
const restricted = createConnectionService({ ...options, authorize: async (owner, request) =>
|
|
227
|
+
const restricted = createConnectionService({ sideEffects: "live", ...options, authorize: async (owner, request) =>
|
|
228
228
|
request.operation === "searches.create" || request.operation === "searches.next" && request.input.searchId !== "search-1" ? null : owner });
|
|
229
229
|
await assert.rejects(restricted.invoke({ ...input, operation: "searches.create", input: { query: "anything" } }), { code: "connector_access_denied" });
|
|
230
230
|
await assert.rejects(restricted.invoke({ ...input, operation: "searches.next", input: { searchId: "another-search" } }), { code: "connector_access_denied" });
|
|
@@ -240,7 +240,7 @@ test("Clay search policy, billing failure and interrupted iterators never replay
|
|
|
240
240
|
let started;
|
|
241
241
|
const pendingRequest = new Promise((resolve) => { started = resolve; });
|
|
242
242
|
let attempts = 0;
|
|
243
|
-
const interrupted = createConnectionService({ ...options, fetchImpl: async (_url, init) => {
|
|
243
|
+
const interrupted = createConnectionService({ sideEffects: "live", ...options, fetchImpl: async (_url, init) => {
|
|
244
244
|
attempts += 1;
|
|
245
245
|
init.signal.throwIfAborted();
|
|
246
246
|
started();
|
|
@@ -283,7 +283,7 @@ test("Clay runs approved routines and queries Enterprise tables without replay o
|
|
|
283
283
|
["routines.run", { routineId: "x", items: [{ id: "x" }] }], ["tables.query", { query: { tables: [] } }],
|
|
284
284
|
["tables.query", { query, limit: 101 }], ["tables.query", { query: { ...query, url: "https://other.test" } }]])
|
|
285
285
|
await assert.rejects(invoke(operation, values), { code: "connector_input_invalid" });
|
|
286
|
-
const restricted = createConnectionService({ ...options, authorize: async (owner, request) => request.operation === "routines.run" ? null : owner });
|
|
286
|
+
const restricted = createConnectionService({ sideEffects: "live", ...options, authorize: async (owner, request) => request.operation === "routines.run" ? null : owner });
|
|
287
287
|
await assert.rejects(restricted.invoke({ ...input, operation: "routines.run", input: { routineId: "x", items } }), { code: "connector_access_denied" });
|
|
288
288
|
assert.equal(requests.length, count);
|
|
289
289
|
state.response = { status: "complete" };
|
|
@@ -302,7 +302,7 @@ test("regional connections require re-verification before changing their provide
|
|
|
302
302
|
await service.connectApiKey(input);
|
|
303
303
|
const config = structuredClone(options.configuration);
|
|
304
304
|
config.integrations.source.settings = { [setting]: alternative };
|
|
305
|
-
const changed = createConnectionService({ ...options, configuration: config });
|
|
305
|
+
const changed = createConnectionService({ sideEffects: "live", ...options, configuration: config });
|
|
306
306
|
assert.equal((await changed.status(input)).status, "reconnect-required");
|
|
307
307
|
await assert.rejects(changed.invoke({ ...input, operation: provider.checkOperation }), { code: "connector_reconnect_required" });
|
|
308
308
|
assert.equal(requests.length, 1);
|
|
@@ -313,7 +313,7 @@ test("regional connections require re-verification before changing their provide
|
|
|
313
313
|
assert.equal((await service.status(input)).status, "reconnect-required");
|
|
314
314
|
config.integrations.source.settings[setting] = "https://attacker.invalid";
|
|
315
315
|
const count = requests.length;
|
|
316
|
-
assert.throws(() => createConnectionService({ ...options, configuration: config }), { code: "integration_configuration_invalid" });
|
|
316
|
+
assert.throws(() => createConnectionService({ sideEffects: "live", ...options, configuration: config }), { code: "integration_configuration_invalid" });
|
|
317
317
|
assert.equal(requests.length, count);
|
|
318
318
|
}
|
|
319
319
|
});
|
|
@@ -327,7 +327,7 @@ test("Storyblok supports all space regions and requires explicit draft reads wit
|
|
|
327
327
|
]) {
|
|
328
328
|
const config = structuredClone(options.configuration);
|
|
329
329
|
config.integrations.source.settings = { region };
|
|
330
|
-
const regional = createConnectionService({ ...options, configuration: config });
|
|
330
|
+
const regional = createConnectionService({ sideEffects: "live", ...options, configuration: config });
|
|
331
331
|
state.response = entry.response;
|
|
332
332
|
await regional.connectApiKey(input);
|
|
333
333
|
assert.equal(requests.at(-1).url.host, host);
|
|
@@ -369,7 +369,7 @@ test("Storyblok delivers one page with resolved content and keeps private previe
|
|
|
369
369
|
assert.equal(request.url.pathname, "/v2/cdn/stories/bookings/groom%20%26%20wash");
|
|
370
370
|
assert.deepEqual(Object.fromEntries(request.url.searchParams), { version: "published", cv: "42",
|
|
371
371
|
resolve_relations: "page.author", resolve_links: "url", resolve_assets: "1", token: f.state.key });
|
|
372
|
-
const restricted = createConnectionService({ ...f.options, authorize: async (owner, request) => request.input?.version === "draft" ? null : owner });
|
|
372
|
+
const restricted = createConnectionService({ sideEffects: "live", ...f.options, authorize: async (owner, request) => request.input?.version === "draft" ? null : owner });
|
|
373
373
|
const before = f.requests.length;
|
|
374
374
|
await assert.rejects(restricted.invoke({ ...f.input, operation: "stories.get", input: { id: "home", version: "draft" } }), { code: "connector_access_denied" });
|
|
375
375
|
for (const id of ["../private", "a/../private", "a//b", "/home"]) {
|
|
@@ -583,7 +583,7 @@ test("Lexware reads accounting resources and creates explicit draft invoices wit
|
|
|
583
583
|
{ ...draft, voucherDate: "2026-02-30T00:00:00Z" }, { ...draft, lineItems: [{ ...draft.lineItems[0], netAmount: -1 }] },
|
|
584
584
|
{ ...draft, lineItems: [{ ...draft.lineItems[0], taxRatePercentage: 101 }] }, { ...draft, lineItems: [{ ...draft.lineItems[0], currency: "USD" }] }])
|
|
585
585
|
await assert.rejects(service.invoke({ ...input, operation: "invoices.createDraft", input: invalid }), { code: "connector_input_invalid" });
|
|
586
|
-
const restricted = createConnectionService({ ...options, authorize: async (owner, request) => request.operation === "invoices.createDraft" ? null : owner });
|
|
586
|
+
const restricted = createConnectionService({ sideEffects: "live", ...options, authorize: async (owner, request) => request.operation === "invoices.createDraft" ? null : owner });
|
|
587
587
|
await assert.rejects(restricted.invoke({ ...input, operation: "invoices.createDraft", input: draft }), { code: "connector_access_denied" });
|
|
588
588
|
assert.equal(requests.length, before);
|
|
589
589
|
state.response = {};
|
|
@@ -779,10 +779,10 @@ test("Contentful uses the selected delivery space and rejects invalid settings b
|
|
|
779
779
|
} });
|
|
780
780
|
for (const settings of [{}, { spaceId: "../other" }, { spaceId: "space-one", environmentId: "../../other" },
|
|
781
781
|
{ spaceId: "space-one", region: "elsewhere" }]) {
|
|
782
|
-
assert.throws(() => createConnectionService(configured(settings)));
|
|
782
|
+
assert.throws(() => createConnectionService({ ...configured(settings), sideEffects: "live" }));
|
|
783
783
|
}
|
|
784
784
|
assert.equal(requests.length, 0);
|
|
785
|
-
const service = createConnectionService(configured({ spaceId: "space-one", environmentId: "preview-2", region: "eu" }));
|
|
785
|
+
const service = createConnectionService({ ...configured({ spaceId: "space-one", environmentId: "preview-2", region: "eu" }), sideEffects: "live" });
|
|
786
786
|
await service.connectApiKey(input);
|
|
787
787
|
assert.equal(requests[0].url.href, "https://cdn.eu.contentful.com/spaces/space-one/environments/preview-2/entries?limit=1&skip=0");
|
|
788
788
|
assert.equal(requests[0].headers.get("authorization"), "Bearer private-fixture-key");
|
|
@@ -863,7 +863,7 @@ test("HubSpot leads become linked deals and advance through a pipeline with app-
|
|
|
863
863
|
const entry = cases.find(item => item.provider.id === "hubspot");
|
|
864
864
|
const f = await fixture(t, { ...entry, scopes: hubspotProvider.scopes.map(scope => scope.value) });
|
|
865
865
|
const calls = [];
|
|
866
|
-
const service = createConnectionService({ ...f.options,
|
|
866
|
+
const service = createConnectionService({ sideEffects: "live", ...f.options,
|
|
867
867
|
authorize: async (owner, request) => request.operation === "deals.update" && request.input.id !== "202" ? null : owner,
|
|
868
868
|
fetchImpl: async (address, init) => {
|
|
869
869
|
const url = new URL(address), body = init.body ? JSON.parse(init.body) : undefined;
|
|
@@ -906,7 +906,7 @@ test("HubSpot leads become linked deals and advance through a pipeline with app-
|
|
|
906
906
|
["deals.associateContact", { contactId: "101/other", dealId: "202" }]
|
|
907
907
|
]) await assert.rejects(invoke(operation, input));
|
|
908
908
|
assert.equal(calls.length, before);
|
|
909
|
-
const limited = createConnectionService({ ...f.options, configuration: { ...f.options.configuration,
|
|
909
|
+
const limited = createConnectionService({ sideEffects: "live", ...f.options, configuration: { ...f.options.configuration,
|
|
910
910
|
integrations: { source: { ...f.options.configuration.integrations.source, scopes: ["crm.objects.contacts.read"] } } } });
|
|
911
911
|
await assert.rejects(limited.invoke({ ...f.input, operation: "deals.create", input: { properties: { dealname: "Denied", dealstage: "won" } } }), { code: "connector_scope_missing" });
|
|
912
912
|
assert.equal(hubspotProvider.operations["contacts.create"].validateResult({ status: "error" }), false);
|
|
@@ -917,7 +917,7 @@ test("incident.io incident recovery covers follow-ups, alerts, schedules and cat
|
|
|
917
917
|
const f = await fixture(t, cases.find(item => item.provider.id === "incident-io"));
|
|
918
918
|
const calls = [];
|
|
919
919
|
let rejected = false;
|
|
920
|
-
const service = createConnectionService({ ...f.options,
|
|
920
|
+
const service = createConnectionService({ sideEffects: "live", ...f.options,
|
|
921
921
|
authorize: async (owner, request) => request.operation === "alerts.resolve" && request.input.id !== "alert-one" ? null : owner,
|
|
922
922
|
fetchImpl: async (address, init) => {
|
|
923
923
|
const url = new URL(address), body = init.body ? JSON.parse(init.body) : undefined;
|
|
@@ -1005,7 +1005,7 @@ test("Notion reads content and data sources then creates and updates a note with
|
|
|
1005
1005
|
for (const [op, values] of [["pages.get", { id: "../users" }], ["blocks.append", { id, children: [] }],
|
|
1006
1006
|
["blocks.append", { id, children: Array(101).fill(children[0]) }], ["pages.update", { id, properties: { x: "x".repeat(65536) } }]])
|
|
1007
1007
|
await assert.rejects(invoke(op, values), { code: "connector_input_invalid" });
|
|
1008
|
-
const restricted = createConnectionService({ ...options, authorize: async (owner, request) => request.operation === "pages.create" ? null : owner });
|
|
1008
|
+
const restricted = createConnectionService({ sideEffects: "live", ...options, authorize: async (owner, request) => request.operation === "pages.create" ? null : owner });
|
|
1009
1009
|
await assert.rejects(restricted.invoke({ ...input, operation: "pages.create", input: { parentId: id, parentType: "page_id", properties } }), { code: "connector_access_denied" });
|
|
1010
1010
|
assert.equal(requests.length, before);
|
|
1011
1011
|
for (const status of [403, 404, 429, 500]) { state.status = status; const count = requests.length; await assert.rejects(invoke("blocks.append", { id, children })); assert.equal(requests.length, count + 1); }
|
|
@@ -1036,7 +1036,7 @@ test("Pipedrive token CRM reads and writes use its configured company and preser
|
|
|
1036
1036
|
const count = requests.length;
|
|
1037
1037
|
for (const [op, values] of [["deals.get", { id: "../other" }], ["leads.create", { title: "No contact" }], ["deals.update", { id: 1 }], ["persons.create", { name: "X", emails: Array(21).fill({ value: "x@y.test" }) }]])
|
|
1038
1038
|
await assert.rejects(invoke(op, values), { code: "connector_input_invalid" });
|
|
1039
|
-
const denied = createConnectionService({ ...options, authorize: async (owner, request) => request.operation === "deals.create" ? null : owner });
|
|
1039
|
+
const denied = createConnectionService({ sideEffects: "live", ...options, authorize: async (owner, request) => request.operation === "deals.create" ? null : owner });
|
|
1040
1040
|
await assert.rejects(denied.invoke({ ...input, operation: "deals.create", input: { title: "Denied" } }), { code: "connector_access_denied" });
|
|
1041
1041
|
assert.equal(requests.length, count);
|
|
1042
1042
|
for (const status of [403, 429, 500]) { state.status = status; const before = requests.length; await assert.rejects(invoke("deals.create", { title: "Explicit" })); assert.equal(requests.length, before + 1); }
|
|
@@ -1072,7 +1072,7 @@ test("Replicate submits, polls and cancels model predictions without losing medi
|
|
|
1072
1072
|
const count = requests.length;
|
|
1073
1073
|
for (const [op, values] of [["predictions.get", { id: "../other" }], ["models.predict", { owner: "fixture", name: "model", input: { prompt: "x".repeat(262145) } }], ["predictions.create", { version: "unversioned", input: {} }]])
|
|
1074
1074
|
await assert.rejects(invoke(op, values), { code: "connector_input_invalid" });
|
|
1075
|
-
const denied = createConnectionService({ ...options, authorize: async (owner, request) => request.operation === "predictions.cancel" ? null : owner });
|
|
1075
|
+
const denied = createConnectionService({ sideEffects: "live", ...options, authorize: async (owner, request) => request.operation === "predictions.cancel" ? null : owner });
|
|
1076
1076
|
await assert.rejects(denied.invoke({ ...input, operation: "predictions.cancel", input: { id: "job1" } }), { code: "connector_access_denied" });
|
|
1077
1077
|
assert.equal(requests.length, count);
|
|
1078
1078
|
for (const status of [403, 429, 500]) { state.status = status; const before = requests.length; await assert.rejects(invoke("models.predict", { owner: "fixture", name: "model", input: {} })); assert.equal(requests.length, before + 1); }
|
package/test/twilio.test.js
CHANGED
|
@@ -78,7 +78,7 @@ test("Twilio rejects invalid or ambiguous sends before transport and preserves t
|
|
|
78
78
|
]) await assert.rejects(service.invoke({ ...input, operation: "calls.create", input: invalid }), { code: "connector_input_invalid" });
|
|
79
79
|
await assert.rejects(service.invoke({ ...input, operation: "messages.get", input: { resourceSid: "../Accounts" } }), { code: "connector_input_invalid" });
|
|
80
80
|
assert.equal(requests.length, 1);
|
|
81
|
-
const denied = createConnectionService({ ...options, authorize: async () => { throw new Error("App policy denied destination"); } });
|
|
81
|
+
const denied = createConnectionService({ sideEffects: "live", ...options, authorize: async () => { throw new Error("App policy denied destination"); } });
|
|
82
82
|
await assert.rejects(denied.invoke({ ...input, operation: "messages.send", input: base }), /App policy denied destination/u);
|
|
83
83
|
assert.equal(requests.length, 1);
|
|
84
84
|
state.response = { sid: "invalid", account_sid: accountSid, status: "queued" };
|
|
@@ -105,7 +105,7 @@ async function fixture(t, region = "us1") {
|
|
|
105
105
|
return Response.json(state.response, { status: state.status });
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
|
-
return { service: createConnectionService(options), options, requests, directory, protection, state };
|
|
108
|
+
return { service: createConnectionService({ ...options, sideEffects: "live" }), options, requests, directory, protection, state };
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
for (const [region, host] of [["us1", "api.twilio.com"], ["ie1", "api.dublin.ie1.twilio.com"], ["au1", "api.sydney.au1.twilio.com"]]) {
|
|
@@ -125,7 +125,7 @@ for (const [region, host] of [["us1", "api.twilio.com"], ["ie1", "api.dublin.ie1
|
|
|
125
125
|
assert.equal(stored.includes(state.secret), false);
|
|
126
126
|
assert.equal(stored.includes(authorization), false);
|
|
127
127
|
}
|
|
128
|
-
const restarted = createConnectionService({ ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
128
|
+
const restarted = createConnectionService({ sideEffects: "live", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
129
129
|
assert.deepEqual(await restarted.status(input), connected);
|
|
130
130
|
state.secret = "rotated-fixture-secret";
|
|
131
131
|
assert.deepEqual(await restarted.invoke({ ...input, operation: "calls.list" }), calls);
|
|
@@ -164,11 +164,11 @@ test("Twilio requires re-verification after account, API key identity or region
|
|
|
164
164
|
for (const [field, value] of [["accountSid", `AC${"d".repeat(32)}`], ["apiKeySid", `SK${"e".repeat(32)}`], ["region", "ie1"]]) {
|
|
165
165
|
const configuration = structuredClone(options.configuration);
|
|
166
166
|
configuration.integrations.voice.settings[field] = value;
|
|
167
|
-
const changed = createConnectionService({ ...options, configuration });
|
|
167
|
+
const changed = createConnectionService({ sideEffects: "live", ...options, configuration });
|
|
168
168
|
assert.equal((await changed.status(input)).status, "reconnect-required");
|
|
169
169
|
await assert.rejects(changed.invoke({ ...input, operation: "calls.list" }), { code: "connector_reconnect_required" });
|
|
170
170
|
}
|
|
171
|
-
const wrongDestination = createConnectionService({ ...options, providers: [{ ...twilioProvider, operations: {
|
|
171
|
+
const wrongDestination = createConnectionService({ sideEffects: "live", ...options, providers: [{ ...twilioProvider, operations: {
|
|
172
172
|
"calls.list": { scopes: [], request: () => ({ method: "GET", url: `https://api.dublin.ie1.twilio.com/2010-04-01/Accounts/${accountSid}/Calls.json` }) }
|
|
173
173
|
} }] });
|
|
174
174
|
await assert.rejects(wrongDestination.invoke({ ...input, operation: "calls.list" }), { code: "connector_destination_invalid" });
|
package/test/twitch.test.js
CHANGED
|
@@ -67,7 +67,7 @@ async function fixture(t, granted = scopes) {
|
|
|
67
67
|
return Response.json(url.pathname === "/helix/users" ? state.profile : state.followed, { status: state.apiStatus });
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
|
-
const service = createConnectionService(options);
|
|
70
|
+
const service = createConnectionService({ ...options, sideEffects: "live" });
|
|
71
71
|
async function start() {
|
|
72
72
|
const { authorizationUrl } = await service.beginAuthorization(input);
|
|
73
73
|
const url = new URL(authorizationUrl);
|
|
@@ -101,7 +101,7 @@ test("Twitch exchanges code consent, validates client ownership, and persists en
|
|
|
101
101
|
const text = await readFile(path.join(directory, name), "utf8");
|
|
102
102
|
for (const secret of ["fixture-client-secret", "fixture-access-1", "fixture-refresh-1"]) assert.equal(text.includes(secret), false);
|
|
103
103
|
}
|
|
104
|
-
const restarted = createConnectionService({ ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
104
|
+
const restarted = createConnectionService({ sideEffects: "live", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
105
105
|
assert.deepEqual(await restarted.status(input), { ...connected, callbackUrl: callback });
|
|
106
106
|
assert.deepEqual(await restarted.invoke({ ...input, operation: "profile.read" }), state.profile);
|
|
107
107
|
assert.deepEqual(requests.slice(-2).map(({ url }) => url.pathname), ["/oauth2/validate", "/helix/users"]);
|
|
@@ -112,7 +112,7 @@ test("Twitch exchanges code consent, validates client ownership, and persists en
|
|
|
112
112
|
const changed = structuredClone(options.configuration);
|
|
113
113
|
changed.registrations.twitch.clientId = "other-client";
|
|
114
114
|
const count = requests.length;
|
|
115
|
-
await assert.rejects(createConnectionService({ ...options, configuration: changed }).invoke({ ...input, operation: "profile.read" }), { code: "connector_reconnect_required" });
|
|
115
|
+
await assert.rejects(createConnectionService({ sideEffects: "live", ...options, configuration: changed }).invoke({ ...input, operation: "profile.read" }), { code: "connector_reconnect_required" });
|
|
116
116
|
assert.equal(requests.length, count);
|
|
117
117
|
await restarted.disconnect(input);
|
|
118
118
|
assert.equal((await service.status(input)).status, "disconnected");
|
|
@@ -154,7 +154,7 @@ test("Twitch serializes refresh rotation, encodes reserved token characters and
|
|
|
154
154
|
await Promise.all([service.invoke({ ...input, operation: "channels.followed" }), service.invoke({ ...input, operation: "channels.followed" })]);
|
|
155
155
|
assert.equal(state.tokenCount, 2);
|
|
156
156
|
assert.deepEqual((await service.status(input)).grantedScopes, ["user:read:follows"]);
|
|
157
|
-
const restarted = createConnectionService(options);
|
|
157
|
+
const restarted = createConnectionService({ ...options, sideEffects: "live" });
|
|
158
158
|
state.time += 40_000;
|
|
159
159
|
state.tokenScope = scopes;
|
|
160
160
|
await restarted.invoke({ ...input, operation: "token.validate" });
|
package/test/wave.test.js
CHANGED
|
@@ -68,7 +68,7 @@ async function fixture(t, requestedScopes = scopes) {
|
|
|
68
68
|
return Response.json(state.responses?.shift() || state.response || value, { status: state.status });
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
|
-
const service = createConnectionService(options);
|
|
71
|
+
const service = createConnectionService({ ...options, sideEffects: "live" });
|
|
72
72
|
async function start() {
|
|
73
73
|
const result = await service.beginAuthorization(input);
|
|
74
74
|
const url = new URL(result.authorizationUrl);
|
|
@@ -101,7 +101,7 @@ test("Wave code consent verifies the user and persists encrypted state for CLI r
|
|
|
101
101
|
const text = await readFile(path.join(directory, file), "utf8");
|
|
102
102
|
for (const secret of ["fixture-wave-secret", "fixture-wave-code", "fixture-access-1", "fixture-refresh-1"]) assert.equal(text.includes(secret), false);
|
|
103
103
|
}
|
|
104
|
-
const restarted = createConnectionService(options);
|
|
104
|
+
const restarted = createConnectionService({ ...options, sideEffects: "live" });
|
|
105
105
|
assert.deepEqual(await restarted.status(input), { ...connected, callbackUrl: callback });
|
|
106
106
|
assert.deepEqual(await restarted.invoke({ ...input, operation: "user.read" }), user);
|
|
107
107
|
});
|
|
@@ -173,7 +173,7 @@ test("Wave serializes refresh with the original callback and preserves rotated g
|
|
|
173
173
|
await assert.rejects(service.invoke({ ...input, operation: "user.read" }), { code: "connector_rate_limited" });
|
|
174
174
|
assert.equal(state.tokenCount, 3);
|
|
175
175
|
state.status = 200;
|
|
176
|
-
const restarted = createConnectionService(options);
|
|
176
|
+
const restarted = createConnectionService({ ...options, sideEffects: "live" });
|
|
177
177
|
await restarted.invoke({ ...input, operation: "user.read" });
|
|
178
178
|
assert.equal(state.tokenCount, 3);
|
|
179
179
|
assert.deepEqual((await restarted.status(input)).grantedScopes, ["user:read", "business:read"]);
|
|
@@ -188,12 +188,12 @@ test("Wave rejects cross-owner access, changed callbacks and denied host policy
|
|
|
188
188
|
}
|
|
189
189
|
bindings["env:WAVE_CALLBACK"] = "https://new.example.test/callback";
|
|
190
190
|
assert.equal((await service.status(input)).status, "reconnect-required");
|
|
191
|
-
await assert.rejects(createConnectionService(options).invoke({ ...input, operation: "user.read" }), { code: "connector_reconnect_required" });
|
|
191
|
+
await assert.rejects(createConnectionService({ ...options, sideEffects: "live" }).invoke({ ...input, operation: "user.read" }), { code: "connector_reconnect_required" });
|
|
192
192
|
delete bindings["env:WAVE_CALLBACK"];
|
|
193
193
|
assert.equal((await service.status(input)).status, "reconnect-required");
|
|
194
194
|
bindings["env:WAVE_CALLBACK"] = callback;
|
|
195
195
|
assert.equal((await service.status(input)).status, "connected");
|
|
196
|
-
const denied = createConnectionService({ ...options, authorize: async () => null });
|
|
196
|
+
const denied = createConnectionService({ sideEffects: "live", ...options, authorize: async () => null });
|
|
197
197
|
await assert.rejects(denied.invoke({ ...input, operation: "customers.list", input: { businessId } }), { code: "connector_access_denied" });
|
|
198
198
|
assert.equal(requests.length, count);
|
|
199
199
|
});
|
package/test/wix.test.js
CHANGED
|
@@ -64,7 +64,7 @@ async function fixture(t, settings = {}) {
|
|
|
64
64
|
return Response.json(state.response, { status: state.status });
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
|
-
return { service: createConnectionService(options), options, configuration, directory, protection, requests, state };
|
|
67
|
+
return { service: createConnectionService({ ...options, sideEffects: "live" }), options, configuration, directory, protection, requests, state };
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
test("Wix validates account settings and secret references without opening an OAuth journey", async (t) => {
|
|
@@ -97,7 +97,7 @@ test("Wix verifies with account headers, encrypts its file grant and resolves ro
|
|
|
97
97
|
assert.deepEqual(JSON.parse(first.init.body), { query: { cursorPaging: { limit: 20 } } });
|
|
98
98
|
for (const name of await readdir(directory)) assert.equal((await readFile(path.join(directory, name), "utf8")).includes(state.key), false);
|
|
99
99
|
state.key = "rotated-wix-key";
|
|
100
|
-
const restarted = createConnectionService({ ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
100
|
+
const restarted = createConnectionService({ sideEffects: "live", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
101
101
|
assert.equal((await restarted.status(input)).status, "reconnect-required");
|
|
102
102
|
assert.deepEqual(await restarted.invoke({ ...input, operation: "sites.list" }), sites);
|
|
103
103
|
assert.equal(requests.at(-1).headers.get("authorization"), state.key);
|
|
@@ -141,7 +141,7 @@ test("Wix preserves owner isolation, host policy and account binding", async (t)
|
|
|
141
141
|
}
|
|
142
142
|
state.deny = true; await assert.rejects(service.invoke({ ...input, operation: "sites.list" })); state.deny = false;
|
|
143
143
|
const changed = structuredClone(configuration); changed.integrations.wix.settings.accountId = siteId;
|
|
144
|
-
const moved = createConnectionService({ ...options, configuration: changed });
|
|
144
|
+
const moved = createConnectionService({ sideEffects: "live", ...options, configuration: changed });
|
|
145
145
|
assert.equal((await moved.status(input)).status, "reconnect-required");
|
|
146
146
|
await assert.rejects(moved.invoke({ ...input, operation: "sites.list" }), { code: "connector_reconnect_required" });
|
|
147
147
|
assert.equal(requests.length, before);
|
|
@@ -160,7 +160,7 @@ test("Wix sanitizes provider failures, rejects invalid verification and preserve
|
|
|
160
160
|
}
|
|
161
161
|
state.stall = true; const controller = new AbortController(); controller.abort();
|
|
162
162
|
await assert.rejects(service.invoke({ ...input, operation: "sites.list", signal: controller.signal }), { code: "connector_cancelled" });
|
|
163
|
-
const timed = createConnectionService({ ...options, providers: [{ ...provider, requestTimeoutMs: 20 }] });
|
|
163
|
+
const timed = createConnectionService({ sideEffects: "live", ...options, providers: [{ ...provider, requestTimeoutMs: 20 }] });
|
|
164
164
|
const keepAlive = setTimeout(() => {}, 1000);
|
|
165
165
|
try { await assert.rejects(timed.invoke({ ...input, operation: "sites.list" }), { code: "connector_provider_timeout" }); }
|
|
166
166
|
finally { clearTimeout(keepAlive); }
|
package/test/wordpress.test.js
CHANGED
|
@@ -44,7 +44,7 @@ async function fixture(t, spec) {
|
|
|
44
44
|
return Response.json(state.response, { status: state.status, headers: { Link: '<https://other-site.example/next>; rel="next"' } });
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
|
-
return { service: createConnectionService(options), options, directory, protection, requests, state };
|
|
47
|
+
return { service: createConnectionService({ ...options, sideEffects: "live" }), options, directory, protection, requests, state };
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
for (const spec of cases) {
|