@treeseed/sdk 0.10.12 → 0.10.14
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/api/auth/d1-store.js +20 -1
- package/dist/db/market-schema.d.ts +7515 -6263
- package/dist/db/market-schema.js +71 -15
- package/dist/index.d.ts +3 -1
- package/dist/index.js +18 -0
- package/dist/market-client.d.ts +107 -0
- package/dist/market-client.js +91 -1
- package/dist/operations/services/deploy.d.ts +8 -0
- package/dist/operations/services/deploy.js +12 -1
- package/dist/operations/services/github-api.d.ts +83 -0
- package/dist/operations/services/github-api.js +167 -0
- package/dist/operations/services/mailpit-runtime.d.ts +13 -2
- package/dist/operations/services/mailpit-runtime.js +19 -14
- package/dist/operations/services/project-web-monitor.d.ts +15 -0
- package/dist/operations/services/project-web-monitor.js +260 -0
- package/dist/operations/services/railway-api.js +2 -2
- package/dist/operations.d.ts +1 -0
- package/dist/operations.js +11 -1
- package/dist/platform-operation-store.d.ts +4 -0
- package/dist/platform-operation-store.js +29 -3
- package/dist/platform-operations.d.ts +8 -0
- package/dist/platform-operations.js +19 -0
- package/dist/remote.js +6 -6
- package/dist/scripts/test-cloudflare-local.js +1 -1
- package/dist/scripts/workspace-command-e2e.js +3 -1
- package/dist/sdk-types.d.ts +109 -1
- package/dist/sdk-types.js +5 -1
- package/drizzle/market/0000_market_control_plane.sql +80 -14
- package/drizzle/market/0002_user_email_addresses.sql +26 -0
- package/package.json +1 -1
- package/templates/github/deploy-web.workflow.yml +1 -0
|
@@ -310,6 +310,7 @@ class D1AuthStore {
|
|
|
310
310
|
scopes: this.scopesForPrincipal(permissions),
|
|
311
311
|
metadata: {
|
|
312
312
|
...parseJson(user.metadata_json, {}),
|
|
313
|
+
email: user.email ?? void 0,
|
|
313
314
|
username: user.username ?? void 0
|
|
314
315
|
}
|
|
315
316
|
}
|
|
@@ -637,7 +638,11 @@ class D1AuthStore {
|
|
|
637
638
|
expiresInSeconds: this.config.accessTokenTtlSeconds,
|
|
638
639
|
principal: {
|
|
639
640
|
...principalRecord.principal,
|
|
640
|
-
scopes: requestedScopes
|
|
641
|
+
scopes: requestedScopes,
|
|
642
|
+
metadata: {
|
|
643
|
+
...principalRecord.principal.metadata,
|
|
644
|
+
sessionId
|
|
645
|
+
}
|
|
641
646
|
}
|
|
642
647
|
};
|
|
643
648
|
}
|
|
@@ -865,6 +870,20 @@ class D1AuthStore {
|
|
|
865
870
|
}
|
|
866
871
|
const payload = verifyAccessToken(token, this.config.authSecret);
|
|
867
872
|
if (!payload) return null;
|
|
873
|
+
const sessionId = typeof payload.metadata?.sessionId === "string" ? payload.metadata.sessionId.trim() : "";
|
|
874
|
+
if (sessionId) {
|
|
875
|
+
const session = await this.first(
|
|
876
|
+
`SELECT id, user_id, expires_at, revoked_at
|
|
877
|
+
FROM auth_sessions
|
|
878
|
+
WHERE id = ?`,
|
|
879
|
+
[sessionId]
|
|
880
|
+
);
|
|
881
|
+
const sessionExpiresAt = session ? new Date(session.expires_at).getTime() : 0;
|
|
882
|
+
if (!session || session.user_id !== payload.sub || session.revoked_at || !Number.isFinite(sessionExpiresAt) || sessionExpiresAt <= Date.now()) {
|
|
883
|
+
return null;
|
|
884
|
+
}
|
|
885
|
+
await this.run(`UPDATE auth_sessions SET updated_at = ? WHERE id = ?`, [isoNow(), session.id]);
|
|
886
|
+
}
|
|
868
887
|
return {
|
|
869
888
|
principal: principalFromAccessTokenPayload(payload),
|
|
870
889
|
credential: {
|