@keystrokehq/platform 0.0.120 → 0.0.122
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-DTky6Eom.cjs → start-B7tYhvDm.cjs} +22 -14
- package/dist/start-B7tYhvDm.cjs.map +1 -0
- package/dist/{start-3-EHSg3p.mjs → start-DfVTA4cX.mjs} +22 -14
- package/dist/start-DfVTA4cX.mjs.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-B7tYhvDm.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-DfVTA4cX.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.Hono();
|
|
2278
2285
|
const orgScoped = new hono.Hono();
|
|
2279
2286
|
const projectScoped = new hono.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 = require_dist$2.createOAuthTokenRefreshRegistry();
|
|
2621
2628
|
const oauthAdapter = require_dist$2.createOAuthTokenAdapterFromBackend(require_dist$2.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.Hono();
|
|
2665
2671
|
await require_dist$2.mountProjectIntegrations({
|
|
2666
2672
|
app: callbacks,
|
|
@@ -2690,8 +2696,7 @@ async function mountOAuthCallbacks() {
|
|
|
2690
2696
|
async function mountRuntimeRoutes() {
|
|
2691
2697
|
const api = new hono.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());
|
|
@@ -3179,7 +3184,8 @@ async function createApp(auth, options) {
|
|
|
3179
3184
|
"Content-Type",
|
|
3180
3185
|
"Authorization",
|
|
3181
3186
|
require_dist.ACTIVE_ORG_HEADER
|
|
3182
|
-
]
|
|
3187
|
+
],
|
|
3188
|
+
maxAge: 86400
|
|
3183
3189
|
}));
|
|
3184
3190
|
mountAuth(app, auth);
|
|
3185
3191
|
app.route("/api/projects", mountWebhookRoutes());
|
|
@@ -3244,8 +3250,10 @@ async function startPlatformServer(platformConfig, hooks = {}) {
|
|
|
3244
3250
|
} });
|
|
3245
3251
|
const webUrl = process.env.PUBLIC_WEB_URL;
|
|
3246
3252
|
if (!webUrl) throw new Error("PUBLIC_WEB_URL is required for the platform server");
|
|
3253
|
+
const platformUrl = process.env.PUBLIC_PLATFORM_URL?.replace(/\/+$/, "");
|
|
3254
|
+
if (!platformUrl) throw new Error("PUBLIC_PLATFORM_URL is required for the platform server");
|
|
3247
3255
|
const auth = createAuth({
|
|
3248
|
-
baseURL:
|
|
3256
|
+
baseURL: platformUrl,
|
|
3249
3257
|
verificationUri: `${webUrl.replace(/\/+$/, "")}/device`,
|
|
3250
3258
|
trustedOrigins: [webUrl]
|
|
3251
3259
|
});
|
|
@@ -3273,4 +3281,4 @@ Object.defineProperty(exports, "startPlatformServer", {
|
|
|
3273
3281
|
}
|
|
3274
3282
|
});
|
|
3275
3283
|
|
|
3276
|
-
//# sourceMappingURL=start-
|
|
3284
|
+
//# sourceMappingURL=start-B7tYhvDm.cjs.map
|