@jskit-ai/connectors-catalog 0.2.40 → 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/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
- The patterns and docs give `createConnectionService` `appEnv: appEnvironment(env)` in place of `sideEffects`; a marked operation is logged outside production (`APP_ENV`).
|
|
5
6
|
- Operations that act on the world are marked `sideEffect`, so a test copy (`SIDE_EFFECTS` is not `live`) simulates them: Brevo email, SMS, campaign sends and events; Calendly cancellations and invitees; Chargebee subscription changes; Firebase Cloud Messaging; GatewayAPI; Gmail sends; Google Ads campaign status; incident.io incidents; Inngest events; LinkedIn posts; Mailgun; Outlook mail and events; Teams messages; Resend emails and broadcasts; Slack messages; Telegram; Twilio messages and calls; Twitch chat; Wave invoice and estimate sends; Wix Bookings changes; WooCommerce refunds. The api-key and Firebase messaging patterns pass `sideEffects: resolveSideEffectsMode(env)`.
|
|
6
7
|
- The browser catalog (`./shared`) no longer bundles the whole AI model snapshot. The AI connector definition now reads only the 13 configurable providers (0.2 MB, in `ai-models.json`). The other 200 providers, which are framework metadata (2.0 MB), moved to `ai-framework-models.json`, which only `./shared/ai` and `./server/ai` load. Exports, the catalogue and every configurable model's choices, hints and credential scopes are unchanged. The definition no longer recognises a framework provider's model key, which its settings schema already rejected.
|
|
7
8
|
- The Resend guide shows local auth's `auth.local.confirmation-sender` next to its recovery sender.
|
package/docs/linkedin.md
CHANGED
|
@@ -65,6 +65,7 @@ No generator or editor database is needed.
|
|
|
65
65
|
import { readFile } from "node:fs/promises";
|
|
66
66
|
import { parseIntegrationConfiguration } from "@jskit-ai/connectors-core/shared/configuration";
|
|
67
67
|
import { createConnectionService, createEnvironmentReferenceResolver } from "@jskit-ai/connectors-core/server";
|
|
68
|
+
import { appEnvironment } from "@jskit-ai/kernel/shared/support/appEnvironment";
|
|
68
69
|
import { createFileConnectionStore, createCredentialProtection } from "@jskit-ai/connectors-core/server/file-storage";
|
|
69
70
|
import { linkedinProvider } from "@jskit-ai/connectors-catalog/server/linkedin";
|
|
70
71
|
|
|
@@ -76,7 +77,8 @@ const protection = createCredentialProtection({
|
|
|
76
77
|
const connections = createConnectionService({
|
|
77
78
|
configuration, providers,
|
|
78
79
|
store: createFileConnectionStore({ directory: process.env.CONNECTOR_STATE_DIRECTORY, protection }),
|
|
79
|
-
resolveReference: createEnvironmentReferenceResolver(process.env), authorize: applicationConnectionPolicy
|
|
80
|
+
resolveReference: createEnvironmentReferenceResolver(process.env), authorize: applicationConnectionPolicy,
|
|
81
|
+
appEnv: appEnvironment(process.env)
|
|
80
82
|
});
|
|
81
83
|
```
|
|
82
84
|
|
package/docs/oura.md
CHANGED
|
@@ -69,6 +69,7 @@ Use ordinary application modules; no template, generator or database is needed:
|
|
|
69
69
|
import { readFile } from "node:fs/promises";
|
|
70
70
|
import { parseIntegrationConfiguration } from "@jskit-ai/connectors-core/shared/configuration";
|
|
71
71
|
import { createConnectionService, createEnvironmentReferenceResolver } from "@jskit-ai/connectors-core/server";
|
|
72
|
+
import { appEnvironment } from "@jskit-ai/kernel/shared/support/appEnvironment";
|
|
72
73
|
import { createFileConnectionStore, createCredentialProtection } from "@jskit-ai/connectors-core/server/file-storage";
|
|
73
74
|
import { ouraProvider } from "@jskit-ai/connectors-catalog/server/oura";
|
|
74
75
|
|
|
@@ -82,7 +83,9 @@ const connections = createConnectionService({
|
|
|
82
83
|
configuration, providers,
|
|
83
84
|
store: createFileConnectionStore({ directory: process.env.CONNECTOR_STATE_DIRECTORY, protection }),
|
|
84
85
|
resolveReference: createEnvironmentReferenceResolver(process.env),
|
|
85
|
-
authorize: applicationConnectionPolicy
|
|
86
|
+
authorize: applicationConnectionPolicy,
|
|
87
|
+
// Only production (APP_ENV) sends side-effect operations, such as an email; elsewhere they are logged.
|
|
88
|
+
appEnv: appEnvironment(process.env)
|
|
86
89
|
});
|
|
87
90
|
```
|
|
88
91
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jskit-ai/connectors-catalog",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.41",
|
|
4
4
|
"description": "Provider definitions and focused API operations for JSKIT connectors.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -125,14 +125,14 @@
|
|
|
125
125
|
"@aws-sdk/client-redshift-data": "3.1128.0",
|
|
126
126
|
"@aws-sdk/client-s3": "3.1128.0",
|
|
127
127
|
"@aws-sdk/s3-request-presigner": "3.1128.0",
|
|
128
|
-
"@jskit-ai/connectors-core": "0.2.
|
|
128
|
+
"@jskit-ai/connectors-core": "0.2.40",
|
|
129
129
|
"@modelcontextprotocol/sdk": "1.32.1",
|
|
130
130
|
"@smithy/fetch-http-handler": "5.8.0",
|
|
131
131
|
"jose": "^6.1.3",
|
|
132
132
|
"json-rest-schema": "^1.0.20"
|
|
133
133
|
},
|
|
134
134
|
"peerDependencies": {
|
|
135
|
-
"@jskit-ai/kernel": "0.2.
|
|
135
|
+
"@jskit-ai/kernel": "0.2.27"
|
|
136
136
|
},
|
|
137
137
|
"jskit": {
|
|
138
138
|
"kind": "runtime",
|
|
@@ -161,6 +161,7 @@ A server module or manually written CLI composes the same library calls:
|
|
|
161
161
|
import { readFile } from "node:fs/promises";
|
|
162
162
|
import { parseIntegrationConfiguration } from "@jskit-ai/connectors-core/shared/configuration";
|
|
163
163
|
import { createConnectionService, createEnvironmentReferenceResolver } from "@jskit-ai/connectors-core/server";
|
|
164
|
+
import { appEnvironment } from "@jskit-ai/kernel/shared/support/appEnvironment";
|
|
164
165
|
import { createFileConnectionStore, createCredentialProtection } from "@jskit-ai/connectors-core/server/file-storage";
|
|
165
166
|
import { resendProvider } from "@jskit-ai/connectors-catalog/server/resend";
|
|
166
167
|
import { firecrawlProvider } from "@jskit-ai/connectors-catalog/server/firecrawl";
|
|
@@ -175,7 +176,9 @@ const store = createFileConnectionStore({ directory: process.env.CONNECTOR_STATE
|
|
|
175
176
|
const connections = createConnectionService({
|
|
176
177
|
configuration, providers, store,
|
|
177
178
|
resolveReference: createEnvironmentReferenceResolver(process.env),
|
|
178
|
-
authorize: applicationConnectionPolicy
|
|
179
|
+
authorize: applicationConnectionPolicy,
|
|
180
|
+
// Only production (APP_ENV) sends side-effect operations, such as an email; elsewhere they are logged.
|
|
181
|
+
appEnv: appEnvironment(process.env)
|
|
179
182
|
});
|
|
180
183
|
|
|
181
184
|
// context comes from the existing application's authentication or local operator policy.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { parseIntegrationConfiguration } from "@jskit-ai/connectors-core/shared/configuration";
|
|
3
3
|
import { createConnectionService, createEnvironmentReferenceResolver } from "@jskit-ai/connectors-core/server";
|
|
4
|
-
import {
|
|
4
|
+
import { appEnvironment } from "@jskit-ai/kernel/shared/support/appEnvironment";
|
|
5
5
|
import { createFileConnectionStore, createCredentialProtection } from "@jskit-ai/connectors-core/server/file-storage";
|
|
6
6
|
import { resendProvider } from "@jskit-ai/connectors-catalog/server/resend";
|
|
7
7
|
import { firecrawlProvider } from "@jskit-ai/connectors-catalog/server/firecrawl";
|
|
@@ -18,7 +18,7 @@ export async function applicationConnections({ authorize, env = process.env, con
|
|
|
18
18
|
keys: { current: Buffer.from(env.CONNECTOR_STORAGE_KEY, "base64") }, activeKeyId: "current"
|
|
19
19
|
});
|
|
20
20
|
const store = createFileConnectionStore({ directory: env.CONNECTOR_STATE_DIRECTORY, protection });
|
|
21
|
-
// Sending email is a side effect:
|
|
21
|
+
// Sending email is a side effect: only production (APP_ENV) sends it; elsewhere it is logged and answers { simulated: true }.
|
|
22
22
|
return createConnectionService({ configuration, providers, store, authorize, resolveReference: createEnvironmentReferenceResolver(env),
|
|
23
|
-
|
|
23
|
+
appEnv: appEnvironment(env) });
|
|
24
24
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { parseIntegrationConfiguration } from "@jskit-ai/connectors-core/shared/configuration";
|
|
3
3
|
import { createConnectionService, createEnvironmentReferenceResolver } from "@jskit-ai/connectors-core/server";
|
|
4
|
-
import {
|
|
4
|
+
import { appEnvironment } from "@jskit-ai/kernel/shared/support/appEnvironment";
|
|
5
5
|
import { createFileConnectionStore, createCredentialProtection } from "@jskit-ai/connectors-core/server/file-storage";
|
|
6
6
|
import { firebaseCloudMessagingProvider } from "@jskit-ai/connectors-catalog/server/firebase-cloud-messaging";
|
|
7
7
|
|
|
@@ -28,7 +28,7 @@ export async function openNotificationConnections({
|
|
|
28
28
|
return createConnectionService({ configuration, providers, store,
|
|
29
29
|
resolveReference: createEnvironmentReferenceResolver(environment),
|
|
30
30
|
authorize: authorizeConnectionOperation,
|
|
31
|
-
// A push notification is a side effect:
|
|
32
|
-
|
|
31
|
+
// A push notification is a side effect: only production (APP_ENV) sends it; elsewhere it is logged.
|
|
32
|
+
appEnv: appEnvironment(environment)
|
|
33
33
|
});
|
|
34
34
|
}
|
|
@@ -58,6 +58,7 @@ package APIs in an application module:
|
|
|
58
58
|
import { readFile } from "node:fs/promises";
|
|
59
59
|
import { parseIntegrationConfiguration } from "@jskit-ai/connectors-core/shared/configuration";
|
|
60
60
|
import { createConnectionService, createEnvironmentReferenceResolver } from "@jskit-ai/connectors-core/server";
|
|
61
|
+
import { appEnvironment } from "@jskit-ai/kernel/shared/support/appEnvironment";
|
|
61
62
|
import { createFileConnectionStore, createCredentialProtection } from "@jskit-ai/connectors-core/server/file-storage";
|
|
62
63
|
import { wordpressComProvider } from "@jskit-ai/connectors-catalog/server/wordpress-com";
|
|
63
64
|
|
|
@@ -69,7 +70,8 @@ const protection = createCredentialProtection({
|
|
|
69
70
|
const connections = createConnectionService({
|
|
70
71
|
configuration, providers,
|
|
71
72
|
store: createFileConnectionStore({ directory: process.env.CONNECTOR_STATE_DIRECTORY, protection }),
|
|
72
|
-
resolveReference: createEnvironmentReferenceResolver(process.env), authorize: applicationConnectionPolicy
|
|
73
|
+
resolveReference: createEnvironmentReferenceResolver(process.env), authorize: applicationConnectionPolicy,
|
|
74
|
+
appEnv: appEnvironment(process.env)
|
|
73
75
|
});
|
|
74
76
|
```
|
|
75
77
|
|
package/src/server/sideEffect.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Marks a provider operation that acts on the outside world on someone's behalf: it sends an email, SMS, push
|
|
3
3
|
* notification or chat message, publishes a post, books or cancels a meeting, moves money or sends an invoice, or
|
|
4
|
-
* triggers another system's events.
|
|
4
|
+
* triggers another system's events. Outside production (APP_ENV), a marked operation is logged and answers
|
|
5
5
|
* `{ simulated: true }` instead of sending it; reads and ordinary record changes are not marked.
|
|
6
6
|
* @template {object} Operation
|
|
7
7
|
* @param {Operation} operation
|
package/test/airtable.test.js
CHANGED
|
@@ -21,6 +21,7 @@ test("Airtable discovers schema, changes tables/fields and completes a paged rec
|
|
|
21
21
|
let malformed = false;
|
|
22
22
|
let token = "fixture-token";
|
|
23
23
|
const service = createConnectionService({
|
|
24
|
+
appEnv: "test",
|
|
24
25
|
configuration: { schemaVersion: 1, registrations: {}, integrations: { data: {
|
|
25
26
|
provider: "airtable", accountMode: "shared", scopes: [],
|
|
26
27
|
authentication: { method: "api-key", secretRef: "env:AIRTABLE_TOKEN" }
|
package/test/algolia.test.js
CHANGED
|
@@ -39,7 +39,7 @@ async function fixture(t) {
|
|
|
39
39
|
return Response.json(state.response, { status: state.status });
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
|
-
return { service: createConnectionService(options), options, directory, protection, requests, references, state };
|
|
42
|
+
return { service: createConnectionService({ appEnv: "test", ...options }), options, directory, protection, requests, references, state };
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
test("Algolia persists a file connection, uses application headers and rotates only the backend key", async (t) => {
|
|
@@ -55,7 +55,7 @@ test("Algolia persists a file connection, uses application headers and rotates o
|
|
|
55
55
|
for (const name of await readdir(directory)) {
|
|
56
56
|
assert.equal((await readFile(path.join(directory, name), "utf8")).includes(state.key), false);
|
|
57
57
|
}
|
|
58
|
-
const restarted = createConnectionService({ ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
58
|
+
const restarted = createConnectionService({ appEnv: "test", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
59
59
|
assert.deepEqual(await restarted.status(input), connected);
|
|
60
60
|
state.key = "rotated-fixture-secret";
|
|
61
61
|
assert.equal((await restarted.status(input)).status, "reconnect-required");
|
|
@@ -121,14 +121,14 @@ test("Algolia searches a named index with encoded paths, JSON parameters and res
|
|
|
121
121
|
test("Algolia rejects cross-application destinations and requires verification after configuration changes", async (t) => {
|
|
122
122
|
const { service, options, requests } = await fixture(t);
|
|
123
123
|
await service.connectApiKey(input);
|
|
124
|
-
const wrongDestination = createConnectionService({ ...options, providers: [{ ...algoliaProvider, operations: {
|
|
124
|
+
const wrongDestination = createConnectionService({ appEnv: "test", ...options, providers: [{ ...algoliaProvider, operations: {
|
|
125
125
|
...algoliaProvider.operations, "indices.list": { scopes: [], request: () => ({ method: "GET", url: "https://differentapp.algolia.net/1/indexes" }) }
|
|
126
126
|
} }] });
|
|
127
127
|
await assert.rejects(wrongDestination.invoke({ ...input, operation: "indices.list" }), { code: "connector_destination_invalid" });
|
|
128
128
|
assert.equal(requests.length, 1);
|
|
129
129
|
const configuration = structuredClone(options.configuration);
|
|
130
130
|
configuration.integrations.search.settings.applicationId = "OTHERAPP";
|
|
131
|
-
const changed = createConnectionService({ ...options, configuration });
|
|
131
|
+
const changed = createConnectionService({ appEnv: "test", ...options, configuration });
|
|
132
132
|
assert.equal((await changed.status(input)).status, "reconnect-required");
|
|
133
133
|
await assert.rejects(changed.invoke({ ...input, operation: "indices.list" }), { code: "connector_reconnect_required" });
|
|
134
134
|
assert.equal(requests.length, 1);
|
|
@@ -41,7 +41,7 @@ async function fixture(t, deploymentType = "serverless", databaseUser) {
|
|
|
41
41
|
ExecuteStatement: state.started, DescribeStatement: state.statement, GetStatementResult: state.results, CancelStatement: { Status: true } }[action], { status: state.status });
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
|
-
return { service: createConnectionService(options), options, requests, resolutions, state, target, directory, protection };
|
|
44
|
+
return { service: createConnectionService({ appEnv: "test", ...options }), options, requests, resolutions, state, target, directory, protection };
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
for (const [type, user] of [["serverless"], ["provisioned"], ["provisioned", "report_reader"]]) {
|
|
@@ -60,7 +60,7 @@ for (const [type, user] of [["serverless"], ["provisioned"], ["provisioned", "re
|
|
|
60
60
|
const file = await readFile(path.join(directory, name), "utf8");
|
|
61
61
|
assert.equal(file.includes(state.secret), false); assert.equal(file.includes(state.key), false);
|
|
62
62
|
}
|
|
63
|
-
const restarted = createConnectionService({ ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
63
|
+
const restarted = createConnectionService({ appEnv: "test", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
64
64
|
assert.deepEqual(await restarted.status(input), connected);
|
|
65
65
|
state.key = "AKIAROTATEDKEY1234567";
|
|
66
66
|
await restarted.invoke({ ...input, operation: "tables.list" });
|
|
@@ -201,7 +201,7 @@ test("Redshift supports explicit temporary AWS credentials, never host defaults"
|
|
|
201
201
|
state.key = "ASIAEXAMPLEKEY1234567"; await assert.rejects(service.connectApiKey(input), { code: "connector_binding_missing" });
|
|
202
202
|
assert.equal(requests.length, 0);
|
|
203
203
|
options.configuration.integrations.warehouse.settings.sessionTokenRef = "env:AWS_SESSION_TOKEN";
|
|
204
|
-
state.session = "temporary/+="; const temporary = createConnectionService(options); await temporary.connectApiKey(input);
|
|
204
|
+
state.session = "temporary/+="; const temporary = createConnectionService({ appEnv: "test", ...options }); await temporary.connectApiKey(input);
|
|
205
205
|
assert.equal(requests[0].headers.get("x-amz-security-token"), state.session);
|
|
206
206
|
});
|
|
207
207
|
|
|
@@ -211,10 +211,10 @@ test("Redshift authorizes before secrets and binds connections to owners and war
|
|
|
211
211
|
await assert.rejects(service.invoke({ ...input, context: owner, operation: "tables.list" }), { code: "connector_reconnect_required" });
|
|
212
212
|
}
|
|
213
213
|
const configuration = structuredClone(options.configuration); configuration.integrations.warehouse.settings.workgroup = "other";
|
|
214
|
-
const changed = createConnectionService({ ...options, configuration }); assert.equal((await changed.status(input)).status, "reconnect-required");
|
|
214
|
+
const changed = createConnectionService({ appEnv: "test", ...options, configuration }); assert.equal((await changed.status(input)).status, "reconnect-required");
|
|
215
215
|
await assert.rejects(changed.invoke({ ...input, operation: "tables.list" }), { code: "connector_reconnect_required" });
|
|
216
216
|
const count = resolutions.length;
|
|
217
|
-
const denied = createConnectionService({ ...options, authorize: async () => null });
|
|
217
|
+
const denied = createConnectionService({ appEnv: "test", ...options, authorize: async () => null });
|
|
218
218
|
await assert.rejects(denied.invoke({ ...input, operation: "query.start", input: { sql: "select 1", clientToken: "request-1" } }), { code: "connector_access_denied" });
|
|
219
219
|
assert.equal(resolutions.length, count); assert.equal(requests.length, 1);
|
|
220
220
|
});
|
|
@@ -223,7 +223,7 @@ test("Redshift local cancellation and timeout do not replay or silently cancel r
|
|
|
223
223
|
const { options } = await fixture(t);
|
|
224
224
|
for (const [name, code] of [["AbortError", "connector_cancelled"], ["TimeoutError", "connector_provider_timeout"]]) {
|
|
225
225
|
const controller = new AbortController(), actions = [];
|
|
226
|
-
const interrupted = createConnectionService({ ...options, fetchImpl: async (address, init) => {
|
|
226
|
+
const interrupted = createConnectionService({ appEnv: "test", ...options, fetchImpl: async (address, init) => {
|
|
227
227
|
const action = new Headers(init.headers).get("x-amz-target").split(".").at(-1);
|
|
228
228
|
if (action !== "ExecuteStatement") return options.fetchImpl(address, init);
|
|
229
229
|
actions.push(action); controller.abort(new DOMException("Interrupted", name)); throw new Error("wrapped");
|
|
@@ -263,7 +263,7 @@ test("Redshift database/schema discovery preserves native names and paging in ea
|
|
|
263
263
|
await assert.rejects(service.invoke({ ...input, operation }), { code: "connector_response_invalid" });
|
|
264
264
|
state.response = { [field]: [] };
|
|
265
265
|
const before = resolutions.length, calls = requests.length;
|
|
266
|
-
const denied = createConnectionService({ ...options, authorize: async () => false });
|
|
266
|
+
const denied = createConnectionService({ appEnv: "test", ...options, authorize: async () => false });
|
|
267
267
|
await assert.rejects(denied.invoke({ ...input, operation }));
|
|
268
268
|
assert.equal(resolutions.length, before); assert.equal(requests.length, calls);
|
|
269
269
|
}
|
package/test/amplitude.test.js
CHANGED
|
@@ -59,7 +59,7 @@ async function fixture(t, region = "us") {
|
|
|
59
59
|
return Response.json({ jsonrpc: "2.0", id: message.id, result }, { headers: { "Mcp-Session-Id": "amplitude-session" } });
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
|
-
const service = createConnectionService(options);
|
|
62
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
63
63
|
const complete = async (start, extra = "code=fixture-code") => service.completeAuthorization({ ...input,
|
|
64
64
|
callbackUrl: `${callback}?state=${new URL(start.authorizationUrl).searchParams.get("state")}&${extra}` });
|
|
65
65
|
return { service, options, state, requests, origin, directory, protection, complete };
|
|
@@ -88,7 +88,7 @@ for (const region of ["us", "eu"]) {
|
|
|
88
88
|
assert.equal(request.init.redirect, "error");
|
|
89
89
|
assert.equal(request.init.credentials, "omit");
|
|
90
90
|
}
|
|
91
|
-
const restarted = createConnectionService({ ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
91
|
+
const restarted = createConnectionService({ appEnv: "test", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
92
92
|
state.time += 61_000;
|
|
93
93
|
assert.deepEqual(await restarted.invoke({ ...input, operation: "tools.list" }), discovery);
|
|
94
94
|
const refresh = new URLSearchParams(requests.findLast(({ url }) => url.endsWith("/token")).init.body);
|
|
@@ -123,7 +123,7 @@ test("Amplitude configuration and changed regions cannot bypass account ownershi
|
|
|
123
123
|
const start = await service.beginAuthorization(input);
|
|
124
124
|
const config = structuredClone(options.configuration);
|
|
125
125
|
config.integrations.analytics.settings.region = "eu";
|
|
126
|
-
const changed = createConnectionService({ ...options, configuration: config });
|
|
126
|
+
const changed = createConnectionService({ appEnv: "test", ...options, configuration: config });
|
|
127
127
|
await assert.rejects(changed.completeAuthorization({ ...input, callbackUrl: `${callback}?code=x&state=${new URL(start.authorizationUrl).searchParams.get("state")}` }), { code: "connector_attempt_invalid" });
|
|
128
128
|
assert.equal(requests.length, 0);
|
|
129
129
|
await complete(await service.beginAuthorization(input));
|
package/test/apify.test.js
CHANGED
|
@@ -16,6 +16,7 @@ test("Apify submits a bounded run, observes terminal states, aborts and retrieve
|
|
|
16
16
|
let status = 200;
|
|
17
17
|
let deny = false;
|
|
18
18
|
const service = createConnectionService({
|
|
19
|
+
appEnv: "test",
|
|
19
20
|
configuration: { schemaVersion: 1, registrations: {}, integrations: { scraper: {
|
|
20
21
|
provider: "apify", accountMode: "shared", scopes: [],
|
|
21
22
|
authentication: { method: "api-key", secretRef: "env:APIFY_TOKEN" }
|
package/test/apollo-io.test.js
CHANGED
|
@@ -13,6 +13,7 @@ test("Apollo prospects, explicit enrichment and CRM changes run through the appl
|
|
|
13
13
|
const state = { response: { accounts: [] }, status: 200, fail: false, deny: false, key: "fixture-apollo-key" };
|
|
14
14
|
const context = { applicationId: "sales-app", subjectId: "workspace" };
|
|
15
15
|
const service = createConnectionService({
|
|
16
|
+
appEnv: "test",
|
|
16
17
|
configuration: { schemaVersion: 1, registrations: {}, integrations: { sales: {
|
|
17
18
|
provider: "apollo-io", accountMode: "shared", scopes: [], authentication: { method: "api-key", secretRef: "env:APOLLO_API_KEY" }
|
|
18
19
|
} } }, providers: [apolloIoProvider], authorize: async owner => { if (state.deny) throw new Error("forbidden"); return owner; },
|
package/test/asana.test.js
CHANGED
|
@@ -12,7 +12,7 @@ test("Asana creates a private project, explicitly shares it, tracks tasks and pr
|
|
|
12
12
|
const requests = [];
|
|
13
13
|
const state = { status: 200, response: { data: [{ gid: "123" }] }, fail: false, deny: false, key: "asana-fixture" };
|
|
14
14
|
const identity = { context: { applicationId: "work-app", subjectId: "workspace" }, integrationId: "work" };
|
|
15
|
-
const service = createConnectionService({ configuration: { schemaVersion: 1, registrations: {}, integrations: {
|
|
15
|
+
const service = createConnectionService({ appEnv: "test", configuration: { schemaVersion: 1, registrations: {}, integrations: {
|
|
16
16
|
work: { provider: "asana", accountMode: "shared", scopes: [], authentication: { method: "api-key", secretRef: "env:ASANA_API_KEY" } }
|
|
17
17
|
} }, providers: [asanaProvider], authorize: async context => { if (state.deny) throw new Error("forbidden"); return context; },
|
|
18
18
|
resolveReference: async () => state.key,
|
package/test/ashby.test.js
CHANGED
|
@@ -14,7 +14,7 @@ test("Ashby syncs candidates/applications, updates a profile and explicitly adva
|
|
|
14
14
|
const requests = [];
|
|
15
15
|
const state = { status: 200, response: { success: true, results: [], moreDataAvailable: false }, fail: false, deny: false };
|
|
16
16
|
const identity = { context: { applicationId: "hiring-app", subjectId: "workspace" }, integrationId: "hiring" };
|
|
17
|
-
const service = createConnectionService({ configuration: { schemaVersion: 1, registrations: {}, integrations: {
|
|
17
|
+
const service = createConnectionService({ appEnv: "test", configuration: { schemaVersion: 1, registrations: {}, integrations: {
|
|
18
18
|
hiring: { provider: "ashby", accountMode: "shared", scopes: [], authentication: { method: "api-key", secretRef: "env:ASHBY_API_KEY" } }
|
|
19
19
|
} }, providers: [ashbyProvider], authorize: async context => { if (state.deny) throw new Error("forbidden"); return context; },
|
|
20
20
|
resolveReference: async () => "ashby-fixture-key",
|
package/test/atlassian.test.js
CHANGED
|
@@ -62,7 +62,7 @@ async function fixture(t) {
|
|
|
62
62
|
return Response.json({ jsonrpc: "2.0", id: message.id, result }, { headers: { "Mcp-Session-Id": "atlassian-session" } });
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
|
-
const service = createConnectionService(options);
|
|
65
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
66
66
|
const complete = async (start, extra = "code=fixture-code") => service.completeAuthorization({ ...input,
|
|
67
67
|
callbackUrl: `${callback}?state=${new URL(start.authorizationUrl).searchParams.get("state")}&${extra}` });
|
|
68
68
|
return { service, options, state, requests, directory, protection, complete };
|
|
@@ -92,7 +92,7 @@ test("Atlassian v2 binds PKCE and resource grants to its authorization server, t
|
|
|
92
92
|
assert.equal(request.init.redirect, "error");
|
|
93
93
|
assert.equal(request.init.credentials, "omit");
|
|
94
94
|
}
|
|
95
|
-
const restarted = createConnectionService({ ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
95
|
+
const restarted = createConnectionService({ appEnv: "test", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
96
96
|
state.time += 61_000;
|
|
97
97
|
assert.deepEqual(await restarted.invoke({ ...input, operation: "tools.list", input: { cursor: "next-page" } }), discovery);
|
|
98
98
|
assert.deepEqual(requests.findLast(({ message }) => message?.method === "tools/list").message.params, { cursor: "next-page" });
|
|
@@ -129,7 +129,7 @@ test("Atlassian validates assistant ownership and permissions, and cannot reuse
|
|
|
129
129
|
assert.deepEqual(parse(config).integrations.work.scopes, config.integrations.work.scopes);
|
|
130
130
|
assert(atlassianProvider.scopes.filter(({ value }) => /^(write:|delete:|manage:)/.test(value)).every(({ recommended }) => !recommended));
|
|
131
131
|
const start = await service.beginAuthorization(input);
|
|
132
|
-
const changed = createConnectionService({ ...options, configuration: config });
|
|
132
|
+
const changed = createConnectionService({ appEnv: "test", ...options, configuration: config });
|
|
133
133
|
await assert.rejects(changed.completeAuthorization({ ...input, callbackUrl: `${callback}?code=x&state=${new URL(start.authorizationUrl).searchParams.get("state")}` }), { code: "connector_attempt_invalid" });
|
|
134
134
|
assert.equal(requests.length, 0);
|
|
135
135
|
});
|
package/test/attention.test.js
CHANGED
|
@@ -12,7 +12,7 @@ test("Attention preserves full call content and supports explicit coaching and o
|
|
|
12
12
|
const requests = [];
|
|
13
13
|
const state = { status: 200, response: { data: [] }, fail: false, deny: false };
|
|
14
14
|
const identity = { context: { applicationId: "coaching-app", subjectId: "workspace" }, integrationId: "calls" };
|
|
15
|
-
const service = createConnectionService({ configuration: { schemaVersion: 1, registrations: {}, integrations: {
|
|
15
|
+
const service = createConnectionService({ appEnv: "test", configuration: { schemaVersion: 1, registrations: {}, integrations: {
|
|
16
16
|
calls: { provider: "attention", accountMode: "shared", scopes: [], authentication: { method: "api-key", secretRef: "env:ATTENTION_API_KEY" } }
|
|
17
17
|
} }, providers: [attentionProvider], authorize: async context => { if (state.deny) throw new Error("forbidden"); return context; },
|
|
18
18
|
resolveReference: async () => "attention-fixture-key",
|
package/test/aws.test.js
CHANGED
|
@@ -45,7 +45,7 @@ async function fixture(t, provider = awsS3Provider) {
|
|
|
45
45
|
return Response.json(response, { status: state.status });
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
return { service: createConnectionService(options), options, requests, resolutions, state, directory, protection };
|
|
48
|
+
return { service: createConnectionService({ appEnv: "test", ...options }), options, requests, resolutions, state, directory, protection };
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
for (const provider of [awsS3Provider, awsAthenaProvider]) {
|
|
@@ -66,7 +66,7 @@ for (const provider of [awsS3Provider, awsAthenaProvider]) {
|
|
|
66
66
|
assert.equal(file.includes(state.secret), false);
|
|
67
67
|
assert.equal(file.includes(state.key), false);
|
|
68
68
|
}
|
|
69
|
-
const restarted = createConnectionService({ ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
69
|
+
const restarted = createConnectionService({ appEnv: "test", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
70
70
|
assert.deepEqual(await restarted.status(input), connected);
|
|
71
71
|
state.key = "AKIAROTATEDKEY1234567";
|
|
72
72
|
state.secret = "rotated-secret";
|
|
@@ -103,7 +103,7 @@ for (const provider of [awsS3Provider, awsAthenaProvider]) {
|
|
|
103
103
|
}
|
|
104
104
|
assert.equal(requests.length, 0);
|
|
105
105
|
options.configuration.integrations.aws.settings.sessionTokenRef = "env:AWS_SESSION_TOKEN";
|
|
106
|
-
const temporary = createConnectionService(options);
|
|
106
|
+
const temporary = createConnectionService({ appEnv: "test", ...options });
|
|
107
107
|
await assert.rejects(temporary.connectApiKey(input), { code: "connector_binding_missing" });
|
|
108
108
|
state.session = "session/+=value";
|
|
109
109
|
await temporary.connectApiKey(input);
|
|
@@ -122,11 +122,11 @@ for (const provider of [awsS3Provider, awsAthenaProvider]) {
|
|
|
122
122
|
}
|
|
123
123
|
const configuration = structuredClone(options.configuration);
|
|
124
124
|
configuration.integrations.aws.settings.region = "ap-southeast-2";
|
|
125
|
-
const changed = createConnectionService({ ...options, configuration });
|
|
125
|
+
const changed = createConnectionService({ appEnv: "test", ...options, configuration });
|
|
126
126
|
assert.equal((await changed.status(input)).status, "reconnect-required");
|
|
127
127
|
await assert.rejects(changed.invoke({ ...input, operation: provider.checkOperation }), { code: "connector_reconnect_required" });
|
|
128
128
|
const count = resolutions.length;
|
|
129
|
-
const denied = createConnectionService({ ...options, authorize: async () => null });
|
|
129
|
+
const denied = createConnectionService({ appEnv: "test", ...options, authorize: async () => null });
|
|
130
130
|
await assert.rejects(denied.invoke({ ...input, operation: provider.checkOperation }), { code: "connector_access_denied" });
|
|
131
131
|
assert.equal(requests.length, 1);
|
|
132
132
|
assert.equal(resolutions.length, count);
|
|
@@ -154,7 +154,7 @@ for (const provider of [awsS3Provider, awsAthenaProvider]) {
|
|
|
154
154
|
for (const [failure, code] of [["AbortError", "connector_cancelled"], ["TimeoutError", "connector_provider_timeout"]]) {
|
|
155
155
|
const controller = new AbortController();
|
|
156
156
|
let calls = 0;
|
|
157
|
-
const interrupted = createConnectionService({ ...options, fetchImpl: async () => {
|
|
157
|
+
const interrupted = createConnectionService({ appEnv: "test", ...options, fetchImpl: async () => {
|
|
158
158
|
calls++;
|
|
159
159
|
controller.abort(new DOMException("Interrupted", failure));
|
|
160
160
|
throw new Error("Wrapped failure");
|
|
@@ -210,7 +210,7 @@ test("S3 presigns GET and PUT for exact keys with bounded expiry, read/write pol
|
|
|
210
210
|
}
|
|
211
211
|
const configuration = structuredClone(options.configuration);
|
|
212
212
|
configuration.integrations.aws.scopes = ["read"];
|
|
213
|
-
const reader = createConnectionService({ ...options, configuration });
|
|
213
|
+
const reader = createConnectionService({ appEnv: "test", ...options, configuration });
|
|
214
214
|
await reader.connectApiKey(input);
|
|
215
215
|
await assert.rejects(reader.invoke({ ...input, operation: "objects.uploadUrl", input: { key: "file" } }), { code: "connector_scope_missing" });
|
|
216
216
|
assert.equal(requests.length, 2, "Only connection checks contact S3; URL construction is not upload/download proof.");
|
|
@@ -268,7 +268,7 @@ test("S3 transfer composition preserves denial, HTTP failures and uncertain writ
|
|
|
268
268
|
} }), new RegExp(`HTTP ${status}`));
|
|
269
269
|
}
|
|
270
270
|
assert.equal(calls, 4);
|
|
271
|
-
const denied = createConnectionService({ ...options, authorize: async () => null });
|
|
271
|
+
const denied = createConnectionService({ appEnv: "test", ...options, authorize: async () => null });
|
|
272
272
|
await assert.rejects(transferS3Object({ ...args, service: denied, fetchImpl: async () => { calls++; } }), { code: "connector_access_denied" });
|
|
273
273
|
await assert.rejects(transferS3Object({ ...args, signal: AbortSignal.abort(), fetchImpl: async () => { calls++; } }), { name: "AbortError" });
|
|
274
274
|
assert.equal(calls, 4);
|
|
@@ -281,13 +281,13 @@ test("S3 transfer composition preserves denial, HTTP failures and uncertain writ
|
|
|
281
281
|
test("S3 local permissions never masquerade as an IAM grant and cannot bypass connection verification", async (t) => {
|
|
282
282
|
const { options, requests, resolutions, state } = await fixture(t);
|
|
283
283
|
options.configuration.integrations.aws.scopes = ["write"];
|
|
284
|
-
assert.throws(() => createConnectionService(options), (error) => {
|
|
284
|
+
assert.throws(() => createConnectionService({ appEnv: "test", ...options }), (error) => {
|
|
285
285
|
assert.equal(error.fieldErrors["integrations.aws.scopes"], "Include this provider's required permissions.");
|
|
286
286
|
return true;
|
|
287
287
|
});
|
|
288
288
|
assert.equal(resolutions.length, 0);
|
|
289
289
|
options.configuration.integrations.aws.scopes = ["read"];
|
|
290
|
-
const service = createConnectionService(options);
|
|
290
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
291
291
|
assert.deepEqual((await service.connectApiKey(input)).grantedScopes, []);
|
|
292
292
|
state.status = 403;
|
|
293
293
|
state.xml = "<Error><Code>ExpiredToken</Code><Message>Expired session</Message></Error>";
|
|
@@ -313,7 +313,7 @@ test("Athena never runs SQL on connect and sends the caller's exact statement an
|
|
|
313
313
|
const configuration = structuredClone(options.configuration);
|
|
314
314
|
configuration.integrations.aws.settings.resultLocation = "s3://query-results/reports/";
|
|
315
315
|
let authorized;
|
|
316
|
-
const configured = createConnectionService({ ...options, configuration, authorize: async (owner, request) => { authorized = request; return owner; } });
|
|
316
|
+
const configured = createConnectionService({ appEnv: "test", ...options, configuration, authorize: async (owner, request) => { authorized = request; return owner; } });
|
|
317
317
|
await configured.connectApiKey(input);
|
|
318
318
|
const fields = { sql: " SELECT ' value ' ", clientRequestToken: "idempotency-key-for-this-query-0001", database: "reports", catalog: "AwsDataCatalog" };
|
|
319
319
|
const result = await configured.invoke({ ...input, operation: "query.start", input: fields });
|
|
@@ -364,7 +364,7 @@ test("Athena rejects malformed verification and results, validates pagination an
|
|
|
364
364
|
for (const fields of [{ queryId: " " }, { queryId: "query-1", maxResults: 0 }, { queryId: "query-1", maxResults: 1.5 }, { queryId: "query-1", nextToken: "" }, { queryId: "query-1", queryResultType: "DATA_MANIFEST" }]) {
|
|
365
365
|
await assert.rejects(service.invoke({ ...input, operation: "query.results", input: fields }), { code: "connector_input_invalid" });
|
|
366
366
|
}
|
|
367
|
-
const malformed = createConnectionService({ ...options, fetchImpl: async (_, init) => {
|
|
367
|
+
const malformed = createConnectionService({ appEnv: "test", ...options, fetchImpl: async (_, init) => {
|
|
368
368
|
const target = new Headers(init.headers).get("x-amz-target");
|
|
369
369
|
return Response.json(target.endsWith("GetQueryExecution") ? query : { ResultSet: {} });
|
|
370
370
|
} });
|
|
@@ -397,7 +397,7 @@ test("Athena browses catalogs, databases and typed table metadata with opaque pa
|
|
|
397
397
|
state.response = { TableMetadataList: [{ Name: "orders", Columns: [{ Name: "bad", Type: 42 }] }] };
|
|
398
398
|
await assert.rejects(service.invoke({ ...input, operation: "tables.list", input: { catalog: "AwsDataCatalog", database: "reports" } }), { code: "connector_response_invalid" });
|
|
399
399
|
await assert.rejects(service.invoke({ ...input, operation: "catalogs.list", input: { maxResults: 1 } }), { code: "connector_input_invalid" });
|
|
400
|
-
const denied = createConnectionService({ ...options, authorize: async () => { throw new Error("Catalog not authorized"); } });
|
|
400
|
+
const denied = createConnectionService({ appEnv: "test", ...options, authorize: async () => { throw new Error("Catalog not authorized"); } });
|
|
401
401
|
const count = resolutions.length;
|
|
402
402
|
await assert.rejects(denied.invoke({ ...input, operation: "databases.list", input: { catalog: "private" } }), /Catalog not authorized/);
|
|
403
403
|
assert.equal(resolutions.length, count);
|
package/test/brevo.test.js
CHANGED
|
@@ -10,7 +10,7 @@ test("Brevo explicitly sends messages and campaigns, manages contacts and retain
|
|
|
10
10
|
const directory = await makeTestDirectory("brevo-repair-"); t.after(() => rm(directory, { recursive: true, force: true }));
|
|
11
11
|
const requests = []; const state = { response: { contacts: [], count: 0 }, status: 200, deny: false, fail: false };
|
|
12
12
|
const identity = { context: { applicationId: "booking-app", subjectId: "owner" }, integrationId: "messaging" };
|
|
13
|
-
const service = createConnectionService({
|
|
13
|
+
const service = createConnectionService({ appEnv: "production", configuration: { schemaVersion: 1, registrations: {}, integrations: {
|
|
14
14
|
messaging: { provider: "brevo", accountMode: "shared", scopes: [], authentication: { method: "api-key", secretRef: "env:BREVO_API_KEY" } }
|
|
15
15
|
} }, providers: [brevoProvider], authorize: async context => { if (state.deny) throw new Error("denied"); return context; },
|
|
16
16
|
resolveReference: async () => "brevo-fixture-key",
|
package/test/calendly.test.js
CHANGED
|
@@ -42,7 +42,7 @@ test("Calendly web OAuth uses Basic and PKCE, persists rotating refresh tokens a
|
|
|
42
42
|
return Response.json({ resource: { uri: "https://api.calendly.com/users/one", name: "Fixture" } });
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
|
-
const service = createConnectionService({ ...options,
|
|
45
|
+
const service = createConnectionService({ ...options, appEnv: "production" });
|
|
46
46
|
for (const outcome of ["cancel", "denied"]) {
|
|
47
47
|
const attempt = new URL((await service.beginAuthorization(input)).authorizationUrl);
|
|
48
48
|
const denied = new URL(callback);
|
|
@@ -68,7 +68,7 @@ test("Calendly web OAuth uses Basic and PKCE, persists rotating refresh tokens a
|
|
|
68
68
|
time += 40_000;
|
|
69
69
|
await Promise.all([service.invoke({ ...input, operation: "profile.read" }), service.invoke({ ...input, operation: "profile.read" })]);
|
|
70
70
|
assert.equal(exchanges, 2);
|
|
71
|
-
const restarted = createConnectionService({
|
|
71
|
+
const restarted = createConnectionService({ appEnv: "production", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
72
72
|
time += 40_000;
|
|
73
73
|
await restarted.invoke({ ...input, operation: "profile.read" });
|
|
74
74
|
assert.equal(exchanges, 3);
|
|
@@ -90,7 +90,7 @@ test("Calendly scheduling retains booking details, scopes, pagination and explic
|
|
|
90
90
|
const directory = await makeTestDirectory("calendly-scheduling-"); t.after(() => rm(directory, { recursive: true, force: true }));
|
|
91
91
|
const requests = []; const state = { response: { resource: { uri: "https://api.calendly.com/users/u", name: "Owner" } }, status: 200, fail: false, deny: false };
|
|
92
92
|
const identity = { context: { applicationId: "booking", subjectId: "owner" }, integrationId: "calendar" };
|
|
93
|
-
const service = createConnectionService({
|
|
93
|
+
const service = createConnectionService({ appEnv: "production", configuration: { schemaVersion: 1, registrations: {}, integrations: {
|
|
94
94
|
calendar: { provider: "calendly", accountMode: "shared", scopes: ["users:read", "event_types:read", "availability:read", "scheduled_events:read", "scheduled_events:write", "scheduling_links:write"], authentication: { method: "api-key", secretRef: "env:CALENDLY_API_KEY" } }
|
|
95
95
|
} }, providers: [calendlyProvider], authorize: async context => { if (state.deny) throw new Error("denied"); return context; }, resolveReference: async () => "fixture-token",
|
|
96
96
|
store: createFileConnectionStore({ directory, protection: createCredentialProtection({ keys: { current: new Uint8Array(32).fill(6) }, activeKeyId: "current" }) }),
|
package/test/canva.test.js
CHANGED
|
@@ -64,7 +64,7 @@ async function fixture(t, selectedScopes = scopes) {
|
|
|
64
64
|
return Response.json({ jsonrpc: "2.0", id: message.id, result }, { headers: { "Mcp-Session-Id": "canva-session" } });
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
|
-
const service = createConnectionService(options);
|
|
67
|
+
const service = createConnectionService({ appEnv: "test", ...options });
|
|
68
68
|
const complete = async (start, extra = "code=fixture-code") => service.completeAuthorization({ ...input,
|
|
69
69
|
callbackUrl: `${callback}?state=${new URL(start.authorizationUrl).searchParams.get("state")}&${extra}` });
|
|
70
70
|
return { service, options, state, requests, directory, protection, complete };
|
|
@@ -100,7 +100,7 @@ test("Canva metadata clients exchange and refresh PKCE grants without client sec
|
|
|
100
100
|
assert.equal(request.init.redirect, "error");
|
|
101
101
|
assert.equal(request.init.credentials, "omit");
|
|
102
102
|
}
|
|
103
|
-
const restarted = createConnectionService({ ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
103
|
+
const restarted = createConnectionService({ appEnv: "test", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
104
104
|
state.time += 61_000;
|
|
105
105
|
assert.deepEqual(await restarted.invoke({ ...input, operation: "tools.list", input: { cursor: "next-page" } }), discovery);
|
|
106
106
|
assert.deepEqual(requests.findLast(({ message }) => message?.method === "tools/list").message.params, { cursor: "next-page" });
|
|
@@ -149,7 +149,7 @@ test("Canva validates metadata URLs, client type and permissions before reusing
|
|
|
149
149
|
invalid.registrations.canva.clientSecretRef = "env:SHOULD_NOT_BE_USED";
|
|
150
150
|
assert.throws(() => parse(invalid), (error) => Boolean(error.fieldErrors["registrations.canva.clientSecretRef"]));
|
|
151
151
|
const start = await service.beginAuthorization(input);
|
|
152
|
-
const changed = createConnectionService({ ...options, configuration: config });
|
|
152
|
+
const changed = createConnectionService({ appEnv: "test", ...options, configuration: config });
|
|
153
153
|
await assert.rejects(changed.completeAuthorization({ ...input, callbackUrl: `${callback}?code=x&state=${new URL(start.authorizationUrl).searchParams.get("state")}` }), { code: "connector_attempt_invalid" });
|
|
154
154
|
assert.equal(requests.length, 0);
|
|
155
155
|
});
|
package/test/chargebee.test.js
CHANGED
|
@@ -33,7 +33,7 @@ async function fixture(t) {
|
|
|
33
33
|
return Response.json(state.response, { status: state.status });
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
return { service: createConnectionService({ ...options,
|
|
36
|
+
return { service: createConnectionService({ ...options, appEnv: "production" }), options, requests, directory, protection, state };
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
test("Chargebee verifies a site with Basic API-key authentication and retains file ownership across restart", async (t) => {
|
|
@@ -52,7 +52,7 @@ test("Chargebee verifies a site with Basic API-key authentication and retains fi
|
|
|
52
52
|
assert.equal(stored.includes(state.key), false);
|
|
53
53
|
assert.equal(stored.includes(first.headers.get("authorization")), false);
|
|
54
54
|
}
|
|
55
|
-
const restarted = createConnectionService({
|
|
55
|
+
const restarted = createConnectionService({ appEnv: "production", ...options, store: createFileConnectionStore({ directory, protection }) });
|
|
56
56
|
assert.deepEqual(await restarted.status(input), connected);
|
|
57
57
|
state.key = "test_rotated_key";
|
|
58
58
|
assert.deepEqual(await restarted.invoke({ ...input, operation: "customers.list" }), customers);
|
|
@@ -88,10 +88,10 @@ test("Chargebee site changes require verification and never fall back across sit
|
|
|
88
88
|
await service.connectApiKey(input);
|
|
89
89
|
const configuration = structuredClone(options.configuration);
|
|
90
90
|
configuration.integrations.billing.settings.siteName = "acme-live";
|
|
91
|
-
const changed = createConnectionService({
|
|
91
|
+
const changed = createConnectionService({ appEnv: "production", ...options, configuration });
|
|
92
92
|
assert.equal((await changed.status(input)).status, "reconnect-required");
|
|
93
93
|
await assert.rejects(changed.invoke({ ...input, operation: "customers.list" }), { code: "connector_reconnect_required" });
|
|
94
|
-
const wrongHost = createConnectionService({
|
|
94
|
+
const wrongHost = createConnectionService({ appEnv: "production", ...options, providers: [{ ...chargebeeProvider, operations: {
|
|
95
95
|
"customers.list": { scopes: [], request: () => ({ method: "GET", url: "https://acme-live.chargebee.com/api/v2/customers" }) }
|
|
96
96
|
} }] });
|
|
97
97
|
await assert.rejects(wrongHost.invoke({ ...input, operation: "customers.list" }), { code: "connector_destination_invalid" });
|