@ionite/adapters 0.1.0-beta.20261118.1 → 0.1.0-beta.20261118.2
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/package.json +1 -1
- package/src/api.ts +4 -2
- package/src/serve.ts +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ionite/adapters",
|
|
3
|
-
"version": "0.1.0-beta.20261118.
|
|
3
|
+
"version": "0.1.0-beta.20261118.2",
|
|
4
4
|
"description": "ionite adapter SDK: run a vendor adapter as a service ionite connects apps through (Bun)",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "ionite",
|
package/src/api.ts
CHANGED
|
@@ -255,8 +255,9 @@ export function createAdapterApi<Connection>(
|
|
|
255
255
|
const parsed = signInRequestSchema.safeParse(body);
|
|
256
256
|
if (!parsed.success) return json({ error: describeIssues(parsed.error) }, 400);
|
|
257
257
|
// Only this adapter's own onboarding page: the link must not become an open redirect.
|
|
258
|
-
|
|
259
|
-
|
|
258
|
+
const { redirect } = parsed.data;
|
|
259
|
+
if (redirect !== onboardPath && !redirect.startsWith(`${onboardPath}?`)) {
|
|
260
|
+
return json({ error: `redirect must be an ${onboardPath} path` }, 400);
|
|
260
261
|
}
|
|
261
262
|
const link = await options.issueSignIn(parsed.data);
|
|
262
263
|
log.info('Sign-in link issued for ionite', { ...audit, user: parsed.data.email });
|
|
@@ -306,6 +307,7 @@ export function createAdapterApi<Connection>(
|
|
|
306
307
|
}
|
|
307
308
|
|
|
308
309
|
const apiPrefix = `${options.basePath ?? ''}/api/adapter/`;
|
|
310
|
+
const onboardPath = `${options.basePath ?? ''}/onboard`;
|
|
309
311
|
return async function handle(request: Request): Promise<Response | undefined> {
|
|
310
312
|
const { pathname } = new URL(request.url);
|
|
311
313
|
if (!pathname.startsWith(apiPrefix)) return undefined;
|
package/src/serve.ts
CHANGED
|
@@ -37,6 +37,8 @@ export interface ServeAdapterOptions<Connection> {
|
|
|
37
37
|
publicBaseUrl?: string;
|
|
38
38
|
/** Default: the store `ADAPTER_VAULT_*` describes (see `credentialStoreFromEnv`). */
|
|
39
39
|
credentialStore?: CredentialStore<Connection>;
|
|
40
|
+
/** Default: `envConfig()`, the `ION_*` variables. */
|
|
41
|
+
configSource?: Parameters<typeof ionite>[0];
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
/**
|
|
@@ -73,7 +75,7 @@ export async function serveAdapter<Connection>(
|
|
|
73
75
|
|
|
74
76
|
const onboardRedirectPolicy = { ...defaultRedirectPolicies, fallback: onboardPath };
|
|
75
77
|
|
|
76
|
-
const ion = ionite(envConfig(), {
|
|
78
|
+
const ion = ionite(options.configSource ?? envConfig(), {
|
|
77
79
|
validators,
|
|
78
80
|
log: prettyLogger,
|
|
79
81
|
basePath: `${prefix}/api/ionite`,
|