@keystrokehq/platform 0.0.120 → 0.0.121
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/dist/run.cjs +1 -1
- package/dist/run.mjs +1 -1
- package/dist/{start-3-EHSg3p.mjs → start-CGgykWD2.mjs} +20 -13
- package/dist/start-CGgykWD2.mjs.map +1 -0
- package/dist/{start-DTky6Eom.cjs → start-CP-3N24R.cjs} +20 -13
- package/dist/start-CP-3N24R.cjs.map +1 -0
- package/dist/start.cjs +1 -1
- package/dist/start.mjs +1 -1
- package/package.json +1 -1
- package/dist/start-3-EHSg3p.mjs.map +0 -1
- package/dist/start-DTky6Eom.cjs.map +0 -1
package/dist/run.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_config = require("./config.cjs");
|
|
2
|
-
const require_start = require("./start-
|
|
2
|
+
const require_start = require("./start-CP-3N24R.cjs");
|
|
3
3
|
//#region src/run.ts
|
|
4
4
|
async function main() {
|
|
5
5
|
await require_start.startPlatformServer(require_config.definePlatformConfig());
|
package/dist/run.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { definePlatformConfig } from "./config.mjs";
|
|
2
|
-
import { t as startPlatformServer } from "./start-
|
|
2
|
+
import { t as startPlatformServer } from "./start-CGgykWD2.mjs";
|
|
3
3
|
//#region src/run.ts
|
|
4
4
|
async function main() {
|
|
5
5
|
await startPlatformServer(definePlatformConfig());
|
|
@@ -1170,7 +1170,7 @@ function createRemoteJWKSet(url, options) {
|
|
|
1170
1170
|
return remoteJWKSet;
|
|
1171
1171
|
}
|
|
1172
1172
|
//#endregion
|
|
1173
|
-
//#region ../../packages/auth/dist/jwt-
|
|
1173
|
+
//#region ../../packages/auth/dist/jwt-BVJ7dVm9.mjs
|
|
1174
1174
|
/** OAuth device-flow client id for `keystroke auth login`. */
|
|
1175
1175
|
const CLI_CLIENT_ID = "keystroke-cli";
|
|
1176
1176
|
const jwksCache = /* @__PURE__ */ new Map();
|
|
@@ -1250,6 +1250,13 @@ async function resolveRequestAuth(jwtVerifier, headers) {
|
|
|
1250
1250
|
session: sessionFromJwt(jwtUser, bearerToken)
|
|
1251
1251
|
};
|
|
1252
1252
|
}
|
|
1253
|
+
/** Auth API origin for JWT verification — platform URL when auth is mounted there. */
|
|
1254
|
+
function resolveAuthApiBaseUrl() {
|
|
1255
|
+
return (process.env.PUBLIC_PLATFORM_URL ?? process.env.PUBLIC_WEB_URL ?? "").replace(/\/+$/, "");
|
|
1256
|
+
}
|
|
1257
|
+
function createDefaultAuthJwtVerifier() {
|
|
1258
|
+
return createAuthJwtVerifier(resolveAuthApiBaseUrl());
|
|
1259
|
+
}
|
|
1253
1260
|
function createAuthJwtVerifier(authBaseUrl) {
|
|
1254
1261
|
const normalizedBaseUrl = authBaseUrl.replace(/\/+$/, "");
|
|
1255
1262
|
if (!normalizedBaseUrl) return;
|
|
@@ -1438,8 +1445,8 @@ function createAuthInstance(options) {
|
|
|
1438
1445
|
function createAuth(options = {}) {
|
|
1439
1446
|
const secret = options.secret ?? process.env.BETTER_AUTH_SECRET;
|
|
1440
1447
|
if (!secret) return;
|
|
1441
|
-
const baseURL = options.baseURL ?? process.env.PUBLIC_WEB_URL;
|
|
1442
|
-
if (!baseURL) throw new Error("PUBLIC_WEB_URL is required when auth is enabled");
|
|
1448
|
+
const baseURL = options.baseURL ?? process.env.PUBLIC_PLATFORM_URL?.replace(/\/+$/, "") ?? process.env.PUBLIC_WEB_URL;
|
|
1449
|
+
if (!baseURL) throw new Error("PUBLIC_PLATFORM_URL or PUBLIC_WEB_URL is required when auth is enabled");
|
|
1443
1450
|
return createAuthInstance({
|
|
1444
1451
|
...options,
|
|
1445
1452
|
secret,
|
|
@@ -1683,7 +1690,7 @@ function routeProject(project) {
|
|
|
1683
1690
|
//#endregion
|
|
1684
1691
|
//#region src/auth/require-session.ts
|
|
1685
1692
|
function requireSession(jwtVerifier) {
|
|
1686
|
-
const verifier = jwtVerifier ??
|
|
1693
|
+
const verifier = jwtVerifier ?? createDefaultAuthJwtVerifier();
|
|
1687
1694
|
return async (c, next) => {
|
|
1688
1695
|
const result = await resolveRequestAuth(verifier, c.req.raw.headers);
|
|
1689
1696
|
if (!result) return c.json({ error: "Unauthorized" }, 401);
|
|
@@ -2277,7 +2284,7 @@ function mountAccountRoutes(options) {
|
|
|
2277
2284
|
const account = new Hono();
|
|
2278
2285
|
const orgScoped = new Hono();
|
|
2279
2286
|
const projectScoped = new Hono();
|
|
2280
|
-
const protect = requireSession(
|
|
2287
|
+
const protect = requireSession(createDefaultAuthJwtVerifier());
|
|
2281
2288
|
account.use("/*", protect);
|
|
2282
2289
|
orgScoped.use("/*", protect);
|
|
2283
2290
|
orgScoped.use("/*", requireOrganization());
|
|
@@ -2616,11 +2623,11 @@ function manifestTriggerEntries(manifest) {
|
|
|
2616
2623
|
}
|
|
2617
2624
|
return entries;
|
|
2618
2625
|
}
|
|
2619
|
-
function createIntegrationServices(platformOrigin
|
|
2626
|
+
function createIntegrationServices(platformOrigin) {
|
|
2620
2627
|
const tokenRefresh = createOAuthTokenRefreshRegistry();
|
|
2621
2628
|
const oauthAdapter = createOAuthTokenAdapterFromBackend(createLocalCredentialBackend({ tokenRefresh }));
|
|
2622
2629
|
const oauthRedirectOrigin = platformApiOrigin(platformOrigin);
|
|
2623
|
-
const jwtVerifier =
|
|
2630
|
+
const jwtVerifier = createDefaultAuthJwtVerifier();
|
|
2624
2631
|
return {
|
|
2625
2632
|
tokenRefresh,
|
|
2626
2633
|
oauthAdapter,
|
|
@@ -2659,8 +2666,7 @@ function createIntegrationServices(platformOrigin, webOrigin) {
|
|
|
2659
2666
|
*/
|
|
2660
2667
|
async function mountOAuthCallbacks() {
|
|
2661
2668
|
const platformOrigin = process.env.PUBLIC_PLATFORM_URL?.replace(/\/$/, "");
|
|
2662
|
-
const
|
|
2663
|
-
const { tokenRefresh, services: baseServices } = createIntegrationServices(platformOrigin, webOrigin);
|
|
2669
|
+
const { tokenRefresh, services: baseServices } = createIntegrationServices(platformOrigin);
|
|
2664
2670
|
const callbacks = new Hono();
|
|
2665
2671
|
await mountProjectIntegrations({
|
|
2666
2672
|
app: callbacks,
|
|
@@ -2690,8 +2696,7 @@ async function mountOAuthCallbacks() {
|
|
|
2690
2696
|
async function mountRuntimeRoutes() {
|
|
2691
2697
|
const api = new Hono();
|
|
2692
2698
|
const platformOrigin = process.env.PUBLIC_PLATFORM_URL?.replace(/\/$/, "");
|
|
2693
|
-
const
|
|
2694
|
-
const { tokenRefresh, jwtVerifier, services: baseServices } = createIntegrationServices(platformOrigin, webOrigin);
|
|
2699
|
+
const { tokenRefresh, jwtVerifier, services: baseServices } = createIntegrationServices(platformOrigin);
|
|
2695
2700
|
const protect = requireSession(jwtVerifier);
|
|
2696
2701
|
api.use("/*", protect);
|
|
2697
2702
|
api.use("/*", requireOrganization());
|
|
@@ -3244,8 +3249,10 @@ async function startPlatformServer(platformConfig, hooks = {}) {
|
|
|
3244
3249
|
} });
|
|
3245
3250
|
const webUrl = process.env.PUBLIC_WEB_URL;
|
|
3246
3251
|
if (!webUrl) throw new Error("PUBLIC_WEB_URL is required for the platform server");
|
|
3252
|
+
const platformUrl = process.env.PUBLIC_PLATFORM_URL?.replace(/\/+$/, "");
|
|
3253
|
+
if (!platformUrl) throw new Error("PUBLIC_PLATFORM_URL is required for the platform server");
|
|
3247
3254
|
const auth = createAuth({
|
|
3248
|
-
baseURL:
|
|
3255
|
+
baseURL: platformUrl,
|
|
3249
3256
|
verificationUri: `${webUrl.replace(/\/+$/, "")}/device`,
|
|
3250
3257
|
trustedOrigins: [webUrl]
|
|
3251
3258
|
});
|
|
@@ -3268,4 +3275,4 @@ async function startPlatformServer(platformConfig, hooks = {}) {
|
|
|
3268
3275
|
//#endregion
|
|
3269
3276
|
export { startPlatformServer as t };
|
|
3270
3277
|
|
|
3271
|
-
//# sourceMappingURL=start-
|
|
3278
|
+
//# sourceMappingURL=start-CGgykWD2.mjs.map
|