@rebasepro/server 0.22.0 → 0.24.0
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/README.md +1 -1
- package/bin/rebase-server.js +4 -2
- package/dist/{GCSStorageController-CLIJXwGS.js → GCSStorageController-BSiP1c-f.js} +57 -29
- package/dist/GCSStorageController-BSiP1c-f.js.map +1 -0
- package/dist/{S3StorageController-Dcuf8lMA.js → S3StorageController-CAwFRgjV.js} +19 -7
- package/dist/S3StorageController-CAwFRgjV.js.map +1 -0
- package/dist/api/ast-schema-editor.d.ts +127 -1
- package/dist/api/errors.d.ts +9 -0
- package/dist/api/live-schema-routes.d.ts +52 -8
- package/dist/api/logs-routes.d.ts +39 -1
- package/dist/api/openapi-generator.d.ts +17 -0
- package/dist/api/rest/api-generator.d.ts +158 -42
- package/dist/api/rest/auth-collection-writes.d.ts +85 -0
- package/dist/api/rest/field-access-query.d.ts +6 -2
- package/dist/api/rest/idempotency.d.ts +7 -1
- package/dist/api/rest/nested-write-access.d.ts +46 -0
- package/dist/api/rest/write-validation.d.ts +34 -2
- package/dist/api/types.d.ts +17 -1
- package/dist/{ast-schema-editor-CslO8Oje.js → ast-schema-editor-CWqS_sLJ.js} +411 -13
- package/dist/ast-schema-editor-CWqS_sLJ.js.map +1 -0
- package/dist/auth/access.d.ts +105 -0
- package/dist/auth/adapter-middleware.d.ts +2 -1
- package/dist/auth/address-ownership.d.ts +68 -0
- package/dist/auth/admin-roles-route.d.ts +4 -2
- package/dist/auth/admin-roles.d.ts +17 -20
- package/dist/auth/admin-user-ops.d.ts +35 -2
- package/dist/auth/admin-users-route.d.ts +1 -0
- package/dist/auth/api-keys/api-key-middleware.d.ts +56 -55
- package/dist/auth/api-keys/api-key-routes.d.ts +41 -11
- package/dist/auth/api-keys/api-key-store.d.ts +31 -8
- package/dist/auth/api-keys/api-key-types.d.ts +14 -16
- package/dist/auth/api-keys/http-operation.d.ts +19 -0
- package/dist/auth/api-keys/index.d.ts +11 -11
- package/dist/auth/api-keys/key-grant.d.ts +41 -0
- package/dist/auth/api-keys/legacy-permissions.d.ts +33 -0
- package/dist/auth/auth-hooks.d.ts +50 -7
- package/dist/auth/builtin-auth-adapter.d.ts +8 -0
- package/dist/auth/captcha.d.ts +5 -0
- package/dist/auth/cookie-utils.d.ts +7 -0
- package/dist/auth/deliverable-address.d.ts +6 -0
- package/dist/auth/email-change-routes.d.ts +41 -0
- package/dist/auth/expired-token-sweep.d.ts +67 -0
- package/dist/auth/impersonation.d.ts +110 -0
- package/dist/auth/index.d.ts +4 -2
- package/dist/auth/interfaces.d.ts +146 -65
- package/dist/auth/jwt.d.ts +66 -3
- package/dist/auth/magic-link-routes.d.ts +2 -6
- package/dist/auth/mfa-routes.d.ts +2 -9
- package/dist/auth/middleware.d.ts +17 -5
- package/dist/auth/oauth-signin-policy.d.ts +25 -8
- package/dist/auth/otp-routes.d.ts +2 -6
- package/dist/auth/passwordless-signup.d.ts +27 -0
- package/dist/auth/platform-token.d.ts +122 -0
- package/dist/auth/rate-limiter.d.ts +72 -1
- package/dist/auth/routes.d.ts +45 -0
- package/dist/auth/scope-routes.d.ts +22 -0
- package/dist/auth/session-routes.d.ts +18 -6
- package/dist/auth/token-revocation.d.ts +53 -1
- package/dist/auth/verify-credential.d.ts +28 -0
- package/dist/{auth-CCDpk2rn.js → auth-DMLngxn_.js} +2712 -711
- package/dist/auth-DMLngxn_.js.map +1 -0
- package/dist/backend-DTAOsLQc.js +30 -0
- package/dist/backend-DTAOsLQc.js.map +1 -0
- package/dist/backup/backup-common.d.ts +29 -0
- package/dist/backup/backup-routes.d.ts +24 -4
- package/dist/backup/backup-schedule.d.ts +33 -0
- package/dist/backup/backup-storage.d.ts +14 -0
- package/dist/backup/index.d.ts +2 -0
- package/dist/backup-CN0s50D2.js +444 -0
- package/dist/backup-CN0s50D2.js.map +1 -0
- package/dist/boot/bundle.d.ts +19 -0
- package/dist/boot/driver.d.ts +10 -0
- package/dist/boot/env.d.ts +51 -6
- package/dist/boot/fetch-bundle.d.ts +18 -1
- package/dist/boot/rls-audit-option.d.ts +26 -0
- package/dist/boot/security-headers.d.ts +26 -0
- package/dist/boot/sources.d.ts +1 -0
- package/dist/boot/static-routing.d.ts +56 -0
- package/dist/collection_patch-BRu-BvDv.js +472 -0
- package/dist/collection_patch-BRu-BvDv.js.map +1 -0
- package/dist/{contract-routes-eLxV0le1.js → contract-routes-fz8i4pxs.js} +17 -4
- package/dist/contract-routes-fz8i4pxs.js.map +1 -0
- package/dist/cron/cron-routes.d.ts +7 -2
- package/dist/cron/cron-scheduler.d.ts +146 -21
- package/dist/cron/cron-store.d.ts +76 -8
- package/dist/cron/index.d.ts +1 -1
- package/dist/{cron-loader-CQjvjpEw.js → cron-loader-CwaANlOG.js} +4 -4
- package/dist/cron-loader-CwaANlOG.js.map +1 -0
- package/dist/cron-routes-Bc-SB0Se.js +96 -0
- package/dist/cron-routes-Bc-SB0Se.js.map +1 -0
- package/dist/{cron-scheduler-COPQxlEq.js → cron-scheduler-CYQgco86.js} +427 -83
- package/dist/cron-scheduler-CYQgco86.js.map +1 -0
- package/dist/{cron-store-BYGZFNWk.js → cron-store-D2Q9-Aco.js} +139 -23
- package/dist/cron-store-D2Q9-Aco.js.map +1 -0
- package/dist/{ddl-bootstrap-CfNvxMuK.js → ddl-bootstrap-BaqMSa4Y.js} +3 -26
- package/dist/ddl-bootstrap-BaqMSa4Y.js.map +1 -0
- package/dist/email/index.d.ts +2 -2
- package/dist/email/link-base.d.ts +5 -4
- package/dist/email/smtp-email-service.d.ts +13 -1
- package/dist/email/templates.d.ts +31 -0
- package/dist/email/types.d.ts +29 -2
- package/dist/env.d.ts +25 -7
- package/dist/{errors-DWsX4yTd.js → errors-D6_y86c5.js} +102 -8
- package/dist/errors-D6_y86c5.js.map +1 -0
- package/dist/{function-loader-xnbDAPfa.js → function-loader-D7o5Epjj.js} +2 -2
- package/dist/{function-loader-xnbDAPfa.js.map → function-loader-D7o5Epjj.js.map} +1 -1
- package/dist/{function-routes-Chet4-lB.js → function-routes-CaNG4waN.js} +24 -12
- package/dist/function-routes-CaNG4waN.js.map +1 -0
- package/dist/functions/context.d.ts +17 -6
- package/dist/functions/guards.d.ts +22 -5
- package/dist/functions/index.d.ts +2 -2
- package/dist/functions/index.js +90 -36
- package/dist/functions/index.js.map +1 -1
- package/dist/{history-recorder-BQmB0P_j.js → history-recorder-Nr8zLvoU.js} +9 -7
- package/dist/history-recorder-Nr8zLvoU.js.map +1 -0
- package/dist/{history-store-CetkrBBD.js → history-store-rcAm_xFR.js} +2 -2
- package/dist/{history-store-CetkrBBD.js.map → history-store-rcAm_xFR.js.map} +1 -1
- package/dist/index.d.ts +14 -4
- package/dist/index.es.js +5733 -1551
- package/dist/index.es.js.map +1 -1
- package/dist/init/docs.d.ts +5 -2
- package/dist/init/health.d.ts +17 -2
- package/dist/init/shutdown.d.ts +18 -3
- package/dist/init.d.ts +54 -0
- package/dist/jobs/index.d.ts +2 -2
- package/dist/jobs/job-queue.d.ts +23 -2
- package/dist/jobs/job-store.d.ts +37 -5
- package/dist/jobs/types.d.ts +8 -6
- package/dist/{jobs-Bjr8DZAi.js → jobs-DqYNfquG.js} +306 -167
- package/dist/jobs-DqYNfquG.js.map +1 -0
- package/dist/{jwt-C4OW-DNq.js → jwt-R6bSPMjk.js} +114 -38
- package/dist/{jwt-C4OW-DNq.js.map → jwt-R6bSPMjk.js.map} +1 -1
- package/dist/{keys-Qfc4XieN.js → keys-GAVZqbqx.js} +18 -17
- package/dist/{keys-Qfc4XieN.js.map → keys-GAVZqbqx.js.map} +1 -1
- package/dist/{logger-DO2PZc4i.js → logger-D-S-hO5e.js} +26 -3
- package/dist/logger-D-S-hO5e.js.map +1 -0
- package/dist/{logs-routes-3EEzPjhl.js → logs-routes-DAdv37GI.js} +54 -11
- package/dist/logs-routes-DAdv37GI.js.map +1 -0
- package/dist/mcp/consent-page.d.ts +1 -1
- package/dist/mcp/mcp-routes.d.ts +45 -2
- package/dist/mcp/mcp-tools.d.ts +22 -10
- package/dist/mcp/oauth-metadata.d.ts +21 -16
- package/dist/mcp/oauth-routes.d.ts +34 -1
- package/dist/mcp/oauth-store.d.ts +29 -13
- package/dist/metrics/history-recorder.d.ts +1 -1
- package/dist/{openapi-generator-D8uFz-LW.js → openapi-generator-DAq_XVDu.js} +135 -22
- package/dist/openapi-generator-DAq_XVDu.js.map +1 -0
- package/dist/{proxy-Czngl3p9.js → proxy-qRlqeUmO.js} +2 -2
- package/dist/{proxy-Czngl3p9.js.map → proxy-qRlqeUmO.js.map} +1 -1
- package/dist/{query-parser-BleZmY18.js → query-parser-BgiKJKvc.js} +41 -82
- package/dist/query-parser-BgiKJKvc.js.map +1 -0
- package/dist/{request-timeout-C_4C2BeR.js → request-timeout-DgH7j8qO.js} +3 -3
- package/dist/{request-timeout-C_4C2BeR.js.map → request-timeout-DgH7j8qO.js.map} +1 -1
- package/dist/rls-audit/index.d.ts +4 -0
- package/dist/schema-edit/apply-schema-change.d.ts +63 -3
- package/dist/schema-edit/project-root.d.ts +3 -2
- package/dist/schema-edit/remote-source.d.ts +9 -4
- package/dist/{schema-editor-routes-DdLihzp0.js → schema-editor-routes-oIyuWl3L.js} +12 -7
- package/dist/schema-editor-routes-oIyuWl3L.js.map +1 -0
- package/dist/serve-spa.d.ts +58 -0
- package/dist/services/routed-realtime-service.d.ts +11 -0
- package/dist/soft-delete-params-BWPilMPF.js +59 -0
- package/dist/soft-delete-params-BWPilMPF.js.map +1 -0
- package/dist/{src-Br6ARbs6.js → src-CatHFUym.js} +439 -45
- package/dist/src-CatHFUym.js.map +1 -0
- package/dist/{src-1vL-I1Po.js → src-I3aG1PcY.js} +371 -81
- package/dist/src-I3aG1PcY.js.map +1 -0
- package/dist/storage/GCSStorageController.d.ts +13 -1
- package/dist/storage/LocalStorageController.d.ts +2 -0
- package/dist/storage/S3StorageController.d.ts +2 -0
- package/dist/storage/index.d.ts +2 -2
- package/dist/storage/keys.d.ts +12 -0
- package/dist/storage/property-limits.d.ts +41 -6
- package/dist/storage/rendition-cache.d.ts +11 -1
- package/dist/storage/request-keys.d.ts +82 -0
- package/dist/storage/requested-object.d.ts +74 -0
- package/dist/storage/routes.d.ts +36 -18
- package/dist/storage/tus-handler.d.ts +30 -5
- package/dist/storage/types.d.ts +36 -1
- package/dist/types-BfKcm9do.js.map +1 -1
- package/dist/utils/logger.d.ts +12 -0
- package/package.json +9 -9
- package/dist/GCSStorageController-CLIJXwGS.js.map +0 -1
- package/dist/S3StorageController-Dcuf8lMA.js.map +0 -1
- package/dist/admin-roles-vYdp_Pil.js +0 -36
- package/dist/admin-roles-vYdp_Pil.js.map +0 -1
- package/dist/admin_block-DxKLmdiv.js +0 -206
- package/dist/admin_block-DxKLmdiv.js.map +0 -1
- package/dist/ast-schema-editor-CslO8Oje.js.map +0 -1
- package/dist/auth/api-keys/api-key-permission-guard.d.ts +0 -65
- package/dist/auth-CCDpk2rn.js.map +0 -1
- package/dist/backup-DzI9jLwc.js +0 -192
- package/dist/backup-DzI9jLwc.js.map +0 -1
- package/dist/contract-routes-eLxV0le1.js.map +0 -1
- package/dist/cron-loader-CQjvjpEw.js.map +0 -1
- package/dist/cron-routes-B7CRGfiq.js +0 -72
- package/dist/cron-routes-B7CRGfiq.js.map +0 -1
- package/dist/cron-scheduler-COPQxlEq.js.map +0 -1
- package/dist/cron-store-BYGZFNWk.js.map +0 -1
- package/dist/ddl-bootstrap-CfNvxMuK.js.map +0 -1
- package/dist/errors-DWsX4yTd.js.map +0 -1
- package/dist/function-routes-Chet4-lB.js.map +0 -1
- package/dist/history-recorder-BQmB0P_j.js.map +0 -1
- package/dist/jobs-Bjr8DZAi.js.map +0 -1
- package/dist/logger-DO2PZc4i.js.map +0 -1
- package/dist/logs-routes-3EEzPjhl.js.map +0 -1
- package/dist/openapi-generator-D8uFz-LW.js.map +0 -1
- package/dist/query-parser-BleZmY18.js.map +0 -1
- package/dist/schema-editor-routes-DdLihzp0.js.map +0 -1
- package/dist/src-1vL-I1Po.js.map +0 -1
- package/dist/src-Br6ARbs6.js.map +0 -1
|
@@ -2,7 +2,7 @@ import { Hono } from "hono";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { HonoEnv } from "../api/types.js";
|
|
4
4
|
import type { MiddlewareHandler } from "hono";
|
|
5
|
-
import type { AuthModuleConfig } from "./routes.js";
|
|
5
|
+
import type { AuthModuleConfig, CreateSessionAndTokens } from "./routes.js";
|
|
6
6
|
import type { AuthResponsePayload, TransformAuthResponseContext } from "@rebasepro/types";
|
|
7
7
|
import type { resolveAuthHooks } from "./auth-hooks.js";
|
|
8
8
|
interface SessionRoutesConfig {
|
|
@@ -28,12 +28,24 @@ interface SessionRoutesConfig {
|
|
|
28
28
|
isAnonymous?: boolean;
|
|
29
29
|
metadata?: Record<string, unknown> | null;
|
|
30
30
|
}, roleIds: string[], accessToken: string, refreshToken: string, providerId: string) => unknown;
|
|
31
|
-
createSessionAndTokens:
|
|
32
|
-
roleIds: string[];
|
|
33
|
-
accessToken: string;
|
|
34
|
-
refreshToken: string;
|
|
35
|
-
}>;
|
|
31
|
+
createSessionAndTokens: CreateSessionAndTokens;
|
|
36
32
|
applyTransformHook: (response: AuthResponsePayload, method: TransformAuthResponseContext["method"], request: Request, uid: string) => Promise<AuthResponsePayload>;
|
|
33
|
+
/**
|
|
34
|
+
* The `register` captcha, built by the caller so a misconfiguration fails
|
|
35
|
+
* the boot once. `/anonymous/link` is registration — it is where a guest
|
|
36
|
+
* becomes an account — so it is guarded by the same challenge as
|
|
37
|
+
* `/register`. Absent when captcha is off or `register` is not protected.
|
|
38
|
+
*/
|
|
39
|
+
registerCaptcha?: MiddlewareHandler<HonoEnv>;
|
|
40
|
+
/**
|
|
41
|
+
* Mail the account a verification link, in the background. Upgrading a
|
|
42
|
+
* guest is registration, and registration starts the address proof.
|
|
43
|
+
*/
|
|
44
|
+
sendVerificationMail?: (user: {
|
|
45
|
+
id: string;
|
|
46
|
+
email: string;
|
|
47
|
+
displayName?: string | null;
|
|
48
|
+
}) => void;
|
|
37
49
|
}
|
|
38
50
|
export declare function mountSessionRoutes(opts: SessionRoutesConfig): void;
|
|
39
51
|
export {};
|
|
@@ -37,6 +37,55 @@ import type { AccessTokenPayload } from "./jwt.js";
|
|
|
37
37
|
* failure is logged at warn so it is visible rather than silent.
|
|
38
38
|
*/
|
|
39
39
|
export declare function isAccessTokenRevoked(authRepo: Pick<AuthRepository, "getTokensValidAfter">, payload: Pick<AccessTokenPayload, "uid" | "iat">): Promise<boolean>;
|
|
40
|
+
/**
|
|
41
|
+
* The repository reads {@link judgeAccessToken} may make. All optional: a
|
|
42
|
+
* repository answers what it can, and the judge says what it could not ask.
|
|
43
|
+
*/
|
|
44
|
+
export type AccessJudgeRepository = Partial<Pick<AuthRepository, "getAccountAccessState" | "getUserWithRoles" | "getTokensValidAfter">>;
|
|
45
|
+
/**
|
|
46
|
+
* Why an access token that verifies is not honoured.
|
|
47
|
+
*
|
|
48
|
+
* - `revoked`: issued before the account's revocation watermark — a sign-out
|
|
49
|
+
* everywhere, a password change or reset.
|
|
50
|
+
* - `session-revoked`: its own sign-in was ended — `POST /auth/logout`, or
|
|
51
|
+
* `DELETE /auth/sessions/:id` from another device. Needs the token's `sid`.
|
|
52
|
+
* - `account-deleted`: the account it names no longer exists.
|
|
53
|
+
* - `account-disabled`: an administrator switched the account off.
|
|
54
|
+
*/
|
|
55
|
+
export type AccessTokenRefusal = "revoked" | "session-revoked" | "account-deleted" | "account-disabled";
|
|
56
|
+
export type AccessTokenVerdict = {
|
|
57
|
+
live: true;
|
|
58
|
+
/**
|
|
59
|
+
* The account's roles now, or `undefined` when the repository could
|
|
60
|
+
* not say (it reads neither the account nor its roles).
|
|
61
|
+
*/
|
|
62
|
+
roles?: string[];
|
|
63
|
+
} | {
|
|
64
|
+
live: false;
|
|
65
|
+
refusal: AccessTokenRefusal;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Is the account behind this verified access token still the one that may use
|
|
69
|
+
* it — and with which roles?
|
|
70
|
+
*
|
|
71
|
+
* A verified signature says who the token was minted for, an hour ago at
|
|
72
|
+
* most. This asks the database what has happened to that account since. Every
|
|
73
|
+
* door that honours an access token — the data plane, the admin gates, the
|
|
74
|
+
* realtime socket — asks it here, so they cannot disagree about it.
|
|
75
|
+
*
|
|
76
|
+
* They did. A deleted account read as "not revoked": the watermark lives on
|
|
77
|
+
* the user row, so once the row was gone there was no watermark, and the
|
|
78
|
+
* roles lookup answered `[]` rather than "nobody". A token its owner had
|
|
79
|
+
* revoked came back to life when an administrator deleted the account, as an
|
|
80
|
+
* authenticated principal with that uid, for the rest of its lifetime. MCP
|
|
81
|
+
* refresh and personal API keys already treated a missing account as revoked;
|
|
82
|
+
* the main door did not.
|
|
83
|
+
*
|
|
84
|
+
* Throws when the repository does. Unlike the watermark read on its own, this
|
|
85
|
+
* one decides the roles a request runs with, so a failure is a refusal (the
|
|
86
|
+
* callers answer 503) rather than a guess.
|
|
87
|
+
*/
|
|
88
|
+
export declare function judgeAccessToken(authRepo: AccessJudgeRepository, payload: Pick<AccessTokenPayload, "uid" | "iat" | "sid">): Promise<AccessTokenVerdict>;
|
|
40
89
|
/**
|
|
41
90
|
* End every session this user holds, on every device.
|
|
42
91
|
*
|
|
@@ -68,5 +117,8 @@ export declare function revokeAllSessions(authRepo: Pick<AuthRepository, "delete
|
|
|
68
117
|
* `test/password-change-revokes-sessions.test.ts` holds every route that sets a
|
|
69
118
|
* password to this, and fails if anything but this function calls
|
|
70
119
|
* `updatePassword`.
|
|
120
|
+
*
|
|
121
|
+
* `null` removes the password instead, for the same reason and with the same
|
|
122
|
+
* revocation: see `confirmAddressOwnership`.
|
|
71
123
|
*/
|
|
72
|
-
export declare function replaceUserPassword(authRepo: Pick<AuthRepository, "updatePassword" | "deleteAllRefreshTokensForUser" | "setTokensValidAfter"
|
|
124
|
+
export declare function replaceUserPassword(authRepo: Pick<AuthRepository, "updatePassword" | "deleteAllRefreshTokensForUser" | "setTokensValidAfter"> & Partial<Pick<AuthRepository, "deleteAllPasswordResetTokensForUser">>, uid: string, passwordHash: string | null): Promise<void>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Verify a bearer credential outside the HTTP middlewares — for a custom
|
|
3
|
+
* socket, a tunnel, anything an app authenticates from a frame or a header it
|
|
4
|
+
* read itself.
|
|
5
|
+
*
|
|
6
|
+
* One answer for the two kinds of credential a person can hold: a session
|
|
7
|
+
* token, and an API key (`rk_`). Both come back as who the caller acts as and
|
|
8
|
+
* what it may do, so the endpoint checks a scope the same way either way.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
import type { ApiKeyStore } from "./api-keys/api-key-store.js";
|
|
13
|
+
/** Who a verified credential acts as, and what it may do. */
|
|
14
|
+
export interface VerifiedCredential {
|
|
15
|
+
uid: string;
|
|
16
|
+
roles: string[];
|
|
17
|
+
scopes: string[];
|
|
18
|
+
/** `"api-key"` when an `rk_` key was presented, otherwise `"session"`. */
|
|
19
|
+
kind: "session" | "api-key";
|
|
20
|
+
}
|
|
21
|
+
/** Install the key store `verifyCredential` checks `rk_` keys against. Called once at boot. */
|
|
22
|
+
export declare function configureCredentialStore(store: ApiKeyStore | undefined): void;
|
|
23
|
+
/**
|
|
24
|
+
* The identity and scopes behind a bearer credential, or null when it does
|
|
25
|
+
* not verify — expired, revoked, unknown, or a key on a backend with no key
|
|
26
|
+
* store.
|
|
27
|
+
*/
|
|
28
|
+
export declare function verifyCredential(token: string): Promise<VerifiedCredential | null>;
|