@ekanos/harness 0.6.0 → 0.7.1
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
DEFAULT_OAUTH_CONNECTION_ID
|
|
2
|
+
DEFAULT_OAUTH_CONNECTION_ID,
|
|
3
|
+
resolveOAuthProvider
|
|
3
4
|
} from "@ekanos/sdk/integration";
|
|
4
5
|
import { invokeSchedule, invokeWebhook } from "@ekanos/sdk/testing";
|
|
5
6
|
import {
|
|
@@ -214,6 +215,20 @@ function clientCredentials(ctx, oauth) {
|
|
|
214
215
|
const clientSecret = ctx.secrets.values[oauth.credentials.clientSecretSecretName];
|
|
215
216
|
return clientId && clientSecret ? { clientId, clientSecret } : null;
|
|
216
217
|
}
|
|
218
|
+
function resolvedProvider(ctx, oauth) {
|
|
219
|
+
const resolved = resolveOAuthProvider(oauth.provider, ctx.secrets.values);
|
|
220
|
+
if (resolved.ok) return resolved.provider;
|
|
221
|
+
const problems = [
|
|
222
|
+
...resolved.missing.map((name) => `${name} is not set`),
|
|
223
|
+
...resolved.invalid.map(
|
|
224
|
+
(name) => `${name} is not a single hostname label (e.g. "acme")`
|
|
225
|
+
)
|
|
226
|
+
];
|
|
227
|
+
console.error(
|
|
228
|
+
`[harness:${ctx.slug}] oauth: the provider's endpoint URL could not be filled from ${ctx.secrets.file}: ${problems.join("; ")}.`
|
|
229
|
+
);
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
217
232
|
function oauthConnect(ctx) {
|
|
218
233
|
const connectionId = requestedConnection(ctx);
|
|
219
234
|
const oauth = connectionId ? oauthFor(ctx, connectionId) : void 0;
|
|
@@ -229,7 +244,9 @@ function oauthConnect(ctx) {
|
|
|
229
244
|
);
|
|
230
245
|
return oauthError(ctx, returnPath, "not_configured");
|
|
231
246
|
}
|
|
232
|
-
const
|
|
247
|
+
const provider = resolvedProvider(ctx, oauth);
|
|
248
|
+
if (!provider) return oauthError(ctx, returnPath, "not_configured");
|
|
249
|
+
const codeVerifier = provider.pkce ? generateCodeVerifier() : void 0;
|
|
233
250
|
const nonce = ctx.state.nonces.issue({
|
|
234
251
|
returnPath,
|
|
235
252
|
connectionId,
|
|
@@ -237,7 +254,7 @@ function oauthConnect(ctx) {
|
|
|
237
254
|
});
|
|
238
255
|
return redirect(
|
|
239
256
|
buildAuthorizeUrl({
|
|
240
|
-
provider
|
|
257
|
+
provider,
|
|
241
258
|
clientId: credentials.clientId,
|
|
242
259
|
redirectUri: callbackUrl(ctx.origin, ctx.slug),
|
|
243
260
|
state: nonce,
|
|
@@ -272,9 +289,11 @@ async function oauthCallback(ctx) {
|
|
|
272
289
|
if (!code) return oauthError(ctx, returnPath, "invalid");
|
|
273
290
|
const credentials = clientCredentials(ctx, oauth);
|
|
274
291
|
if (!credentials) return oauthError(ctx, returnPath, "not_configured");
|
|
292
|
+
const provider = resolvedProvider(ctx, oauth);
|
|
293
|
+
if (!provider) return oauthError(ctx, returnPath, "not_configured");
|
|
275
294
|
const exchange = await exchangeAuthorizationCode({
|
|
276
295
|
ctx: ctx.state.ctx,
|
|
277
|
-
provider
|
|
296
|
+
provider,
|
|
278
297
|
...credentials,
|
|
279
298
|
code,
|
|
280
299
|
redirectUri: callbackUrl(ctx.origin, ctx.slug),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type IntegrationDefinition } from '@ekanos/sdk/integration';
|
|
2
2
|
/**
|
|
3
3
|
* ─────────────────────────────────────────────────────────────────────────────
|
|
4
4
|
* `.ekanos/local-secrets.json` — the harness's admin-tier credential source
|
|
@@ -38,7 +38,8 @@ export declare const LOCAL_SECRETS_RELATIVE_PATH: string;
|
|
|
38
38
|
export declare const ACTIVATION_BLOCK_KEY = "activationData";
|
|
39
39
|
/**
|
|
40
40
|
* The secret names a definition declares statically — the admin tier: OAuth
|
|
41
|
-
* client credentials
|
|
41
|
+
* client credentials, their `{field}` endpoint placeholders, and webhook
|
|
42
|
+
* signing keys. Activation-form fields are the
|
|
42
43
|
* account tier and are not declared anywhere; see `ACTIVATION_BLOCK_KEY`.
|
|
43
44
|
*/
|
|
44
45
|
export declare function declaredSecretNames(definition: Pick<IntegrationDefinition, 'oauth' | 'oauthConnections' | 'webhooks'>): string[];
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
oauthProviderPlaceholders
|
|
3
|
+
} from "@ekanos/sdk/integration";
|
|
1
4
|
import { createHash } from "node:crypto";
|
|
2
5
|
import * as fs from "node:fs";
|
|
3
6
|
import * as path from "node:path";
|
|
@@ -16,6 +19,9 @@ function declaredSecretNames(definition) {
|
|
|
16
19
|
if (!oauth) continue;
|
|
17
20
|
names.add(oauth.credentials.clientIdSecretName);
|
|
18
21
|
names.add(oauth.credentials.clientSecretSecretName);
|
|
22
|
+
for (const name of oauthProviderPlaceholders(oauth.provider)) {
|
|
23
|
+
names.add(name);
|
|
24
|
+
}
|
|
19
25
|
}
|
|
20
26
|
for (const webhook of definition.webhooks ?? []) {
|
|
21
27
|
if (webhook.signature !== "none") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ekanos/harness",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Ekanos integration dev harness — every surface of an integration rendered in real Ekanos chrome, from fixtures, with no Supabase or auth; and, in live mode, a real localhost OAuth loop over your own dev-app credentials.",
|
|
6
6
|
"homepage": "https://sdk.ekanos.dev/harness/overview",
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"tw-animate-css": "1.4.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@ekanos/sdk": "0.
|
|
69
|
-
"@ekanos/ui": "0.
|
|
68
|
+
"@ekanos/sdk": "0.10.0",
|
|
69
|
+
"@ekanos/ui": "0.10.0",
|
|
70
70
|
"@kit/tsconfig": "0.1.0",
|
|
71
71
|
"@tailwindcss/postcss": "4.3.3",
|
|
72
72
|
"@tanstack/react-query": "5.103.2",
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
"zod": "4.6.5"
|
|
86
86
|
},
|
|
87
87
|
"peerDependencies": {
|
|
88
|
-
"@ekanos/sdk": "^0.
|
|
89
|
-
"@ekanos/ui": "^0.
|
|
88
|
+
"@ekanos/sdk": "^0.10.0",
|
|
89
|
+
"@ekanos/ui": "^0.10.0",
|
|
90
90
|
"@tanstack/react-query": "^5.101.4",
|
|
91
91
|
"next": "^16.0.0",
|
|
92
92
|
"next-intl": "^4.14.7",
|