@rebasepro/server 0.16.0 → 0.16.1-canary.g041c925
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/{GCSStorageController-BEmDYFKc.js → GCSStorageController-Bl7nmhdv.js} +7 -6
- package/dist/{GCSStorageController-BEmDYFKc.js.map → GCSStorageController-Bl7nmhdv.js.map} +1 -1
- package/dist/{S3StorageController-B2EDXXMH.js → S3StorageController-CWvvrRpF.js} +7 -6
- package/dist/{S3StorageController-B2EDXXMH.js.map → S3StorageController-CWvvrRpF.js.map} +1 -1
- package/dist/{admin_block-DLILvzle.js → admin_block-BeypnEfb.js} +6 -6
- package/dist/admin_block-BeypnEfb.js.map +1 -0
- package/dist/api/ast-schema-editor.d.ts +23 -0
- package/dist/api/contract-routes.d.ts +1 -1
- package/dist/api/errors.d.ts +1 -1
- package/dist/api/index.d.ts +3 -3
- package/dist/api/live-schema-routes.d.ts +122 -0
- package/dist/api/logs-routes.d.ts +1 -1
- package/dist/api/mount.d.ts +41 -0
- package/dist/api/rest/api-generator.d.ts +2 -2
- package/dist/api/rest/index.d.ts +1 -1
- package/dist/api/rest/query-parser.d.ts +1 -1
- package/dist/api/schema-editor-routes.d.ts +1 -1
- package/dist/api/types.d.ts +12 -4
- package/dist/{schema-editor-routes-CV9k0w3G.js → ast-schema-editor-CDGgrIn7.js} +37 -45
- package/dist/ast-schema-editor-CDGgrIn7.js.map +1 -0
- package/dist/auth/adapter-middleware.d.ts +2 -2
- package/dist/auth/admin-roles-route.d.ts +2 -2
- package/dist/auth/admin-user-ops.d.ts +3 -3
- package/dist/auth/admin-users-route.d.ts +4 -6
- package/dist/auth/api-keys/api-key-middleware.d.ts +2 -2
- package/dist/auth/api-keys/api-key-permission-guard.d.ts +1 -1
- package/dist/auth/api-keys/api-key-routes.d.ts +2 -2
- package/dist/auth/api-keys/api-key-store.d.ts +1 -1
- package/dist/auth/api-keys/index.d.ts +9 -9
- package/dist/auth/apple-oauth.d.ts +2 -2
- package/dist/auth/auth-hooks.d.ts +4 -4
- package/dist/auth/bitbucket-oauth.d.ts +2 -2
- package/dist/auth/builtin-auth-adapter.d.ts +8 -4
- package/dist/auth/capabilities.d.ts +51 -0
- package/dist/auth/captcha.d.ts +86 -0
- package/dist/auth/cookie-utils.d.ts +2 -2
- package/dist/auth/discord-oauth.d.ts +2 -2
- package/dist/auth/facebook-oauth.d.ts +2 -2
- package/dist/auth/github-oauth.d.ts +2 -2
- package/dist/auth/gitlab-oauth.d.ts +2 -2
- package/dist/auth/google-oauth.d.ts +1 -1
- package/dist/auth/index.d.ts +58 -54
- package/dist/auth/jwks-routes.d.ts +1 -1
- package/dist/auth/jwt.d.ts +1 -1
- package/dist/auth/linkedin-oauth.d.ts +2 -2
- package/dist/auth/magic-link-routes.d.ts +10 -3
- package/dist/auth/mfa-gate.d.ts +1 -1
- package/dist/auth/mfa-routes.d.ts +3 -3
- package/dist/auth/microsoft-oauth.d.ts +2 -2
- package/dist/auth/middleware.d.ts +6 -7
- package/dist/auth/otp-routes.d.ts +89 -0
- package/dist/auth/rate-limiter.d.ts +2 -2
- package/dist/auth/require-auth.d.ts +1 -1
- package/dist/auth/reset-password-admin.d.ts +4 -4
- package/dist/auth/routes.d.ts +18 -10
- package/dist/auth/session-routes.d.ts +3 -3
- package/dist/auth/slack-oauth.d.ts +2 -2
- package/dist/auth/spotify-oauth.d.ts +2 -2
- package/dist/auth/token-revocation.d.ts +2 -2
- package/dist/auth/twitter-oauth.d.ts +2 -2
- package/dist/{auth-5Et5mnUA.js → auth-DzarZhLS.js} +603 -4376
- package/dist/auth-DzarZhLS.js.map +1 -0
- package/dist/backup/backup-common.d.ts +1 -1
- package/dist/backup/backup-routes.d.ts +3 -3
- package/dist/backup/index.d.ts +3 -3
- package/dist/{backup-C6ljYVTp.js → backup-CRdZkA6c.js} +7 -6
- package/dist/{backup-C6ljYVTp.js.map → backup-CRdZkA6c.js.map} +1 -1
- package/dist/boot/bindings.d.ts +81 -0
- package/dist/boot/boot.d.ts +5 -5
- package/dist/boot/bundle.d.ts +10 -1
- package/dist/boot/driver.d.ts +1 -1
- package/dist/boot/env.d.ts +28 -1
- package/dist/boot/fetch-bundle.d.ts +144 -1
- package/dist/boot/local-provisioner.d.ts +30 -0
- package/dist/boot/options.d.ts +30 -6
- package/dist/boot/resource-adapters.d.ts +31 -0
- package/dist/boot/resource-loading.d.ts +10 -0
- package/dist/boot/role.d.ts +3 -2
- package/dist/boot/sources.d.ts +1 -1
- package/dist/boot/version-skew.d.ts +1 -1
- package/dist/collections/BackendCollectionRegistry.d.ts +1 -1
- package/dist/collections/loader.d.ts +1 -1
- package/dist/{contract-routes-DZ-LBpSL.js → contract-routes-DDSRyGSl.js} +8 -7
- package/dist/contract-routes-DDSRyGSl.js.map +1 -0
- package/dist/cron/cron-routes.d.ts +2 -2
- package/dist/cron/cron-scheduler.d.ts +3 -3
- package/dist/cron/index.d.ts +8 -8
- package/dist/{cron-loader-YhhQeVBM.js → cron-loader-d9WMFENB.js} +8 -7
- package/dist/{cron-loader-YhhQeVBM.js.map → cron-loader-d9WMFENB.js.map} +1 -1
- package/dist/{cron-routes-maM_RlUu.js → cron-routes-B_GKclr5.js} +9 -8
- package/dist/cron-routes-B_GKclr5.js.map +1 -0
- package/dist/{cron-scheduler-DIpYBmZP.js → cron-scheduler-BB82dWuU.js} +9 -9
- package/dist/cron-scheduler-BB82dWuU.js.map +1 -0
- package/dist/{cron-store-DfH_4Cd9.js → cron-store-BTZqwkM1.js} +10 -9
- package/dist/{cron-store-DfH_4Cd9.js.map → cron-store-BTZqwkM1.js.map} +1 -1
- package/dist/{ddl-bootstrap-Cywoj8Ta.js → ddl-bootstrap-euwN8FOy.js} +21 -6
- package/dist/ddl-bootstrap-euwN8FOy.js.map +1 -0
- package/dist/deploy/pod-contract.d.ts +139 -0
- package/dist/dev-secrets.d.ts +52 -0
- package/dist/{dynamic-import-Dvh-K5fl.js → dynamic-import-X40pTZUQ.js} +5 -4
- package/dist/{dynamic-import-Dvh-K5fl.js.map → dynamic-import-X40pTZUQ.js.map} +1 -1
- package/dist/email/dev-sink.d.ts +88 -0
- package/dist/email/index.d.ts +9 -7
- package/dist/email/link-base.d.ts +1 -1
- package/dist/email/smtp-email-service.d.ts +2 -2
- package/dist/email/templates.d.ts +12 -0
- package/dist/email/types.d.ts +18 -6
- package/dist/env.d.ts +1 -1
- package/dist/{errors-EBYiaJ2E.js → errors-DBwpj9N8.js} +8 -7
- package/dist/errors-DBwpj9N8.js.map +1 -0
- package/dist/{function-loader-DDS1v7YX.js → function-loader-LLdmBFoL.js} +9 -8
- package/dist/{function-loader-DDS1v7YX.js.map → function-loader-LLdmBFoL.js.map} +1 -1
- package/dist/{function-routes-Btcez1T-.js → function-routes-ClT6UQpD.js} +8 -7
- package/dist/function-routes-ClT6UQpD.js.map +1 -0
- package/dist/functions/context.d.ts +141 -0
- package/dist/functions/define-function.d.ts +1 -1
- package/dist/functions/function-routes.d.ts +9 -3
- package/dist/functions/guards.d.ts +76 -0
- package/dist/functions/index.d.ts +96 -5
- package/dist/functions/index.js +919 -0
- package/dist/functions/index.js.map +1 -0
- package/dist/functions/internal.d.ts +26 -0
- package/dist/functions/proxy.d.ts +1 -1
- package/dist/functions/request-timeout.d.ts +9 -1
- package/dist/functions/runtime-env.d.ts +92 -0
- package/dist/functions/wait-until.d.ts +74 -0
- package/dist/history/history-routes.d.ts +2 -2
- package/dist/history/index.d.ts +1 -1
- package/dist/index.d.ts +65 -54
- package/dist/index.es.js +3498 -305
- package/dist/index.es.js.map +1 -1
- package/dist/init/docs.d.ts +1 -1
- package/dist/init/middlewares.d.ts +1 -1
- package/dist/init/shutdown.d.ts +4 -0
- package/dist/init/storage.d.ts +1 -1
- package/dist/init/surfaces.d.ts +10 -0
- package/dist/init.d.ts +171 -22
- package/dist/jobs/index.d.ts +5 -5
- package/dist/{jobs-CyOKXXlu.js → jobs-CeZzdeR8.js} +10 -9
- package/dist/{jobs-CyOKXXlu.js.map → jobs-CeZzdeR8.js.map} +1 -1
- package/dist/{jwt-DxH9fLPt.js → jwt-CpMqxVct.js} +9 -8
- package/dist/{jwt-DxH9fLPt.js.map → jwt-CpMqxVct.js.map} +1 -1
- package/dist/{logger-DfvF_8r-.js → logger-DS03e908.js} +104 -10
- package/dist/logger-DS03e908.js.map +1 -0
- package/dist/{logs-routes-CWBLQj2l.js → logs-routes-DB72iQSr.js} +36 -9
- package/dist/logs-routes-DB72iQSr.js.map +1 -0
- package/dist/metrics/index.d.ts +1 -1
- package/dist/{openapi-generator-BCKJRUS4.js → openapi-generator-wFJo22gg.js} +7 -11
- package/dist/{openapi-generator-BCKJRUS4.js.map → openapi-generator-wFJo22gg.js.map} +1 -1
- package/dist/{proxy-Bj5DVllb.js → proxy-CMymhnwG.js} +9 -6
- package/dist/{proxy-Bj5DVllb.js.map → proxy-CMymhnwG.js.map} +1 -1
- package/dist/query-parser-C3hHu17g.js +355 -0
- package/dist/query-parser-C3hHu17g.js.map +1 -0
- package/dist/{request-timeout-BuFoEKwT.js → request-timeout-C8gkc-j7.js} +21 -6
- package/dist/request-timeout-C8gkc-j7.js.map +1 -0
- package/dist/rls-audit/index.d.ts +111 -0
- package/dist/{rolldown-runtime-DSJWtz9O.js → rolldown-runtime-dW7B1o5h.js} +4 -3
- package/dist/schema-edit/apply-schema-change.d.ts +141 -0
- package/dist/schema-edit/github-repository.d.ts +67 -0
- package/dist/schema-edit/local-git-repository.d.ts +28 -0
- package/dist/schema-edit/project-root.d.ts +43 -0
- package/dist/schema-edit/remote-source.d.ts +25 -0
- package/dist/schema-edit/schema-edit-permissions.d.ts +129 -0
- package/dist/schema-editor-routes-CRKMZnXu.js +87 -0
- package/dist/schema-editor-routes-CRKMZnXu.js.map +1 -0
- package/dist/schemas-DBxgjM9A.js +4153 -0
- package/dist/schemas-DBxgjM9A.js.map +1 -0
- package/dist/{selection-_z6TM1DB.js → selection-CRpqKUbt.js} +6 -5
- package/dist/{selection-_z6TM1DB.js.map → selection-CRpqKUbt.js.map} +1 -1
- package/dist/services/webhook-service.d.ts +1 -1
- package/dist/singleton.d.ts +7 -0
- package/dist/{src-CrCxd8km.js → src-6VqGNeDB.js} +122 -5
- package/dist/src-6VqGNeDB.js.map +1 -0
- package/dist/{src-BPfYOeN4.js → src-C5vFEj-t.js} +8 -6
- package/dist/src-C5vFEj-t.js.map +1 -0
- package/dist/storage/GCSStorageController.d.ts +1 -1
- package/dist/storage/LocalStorageController.d.ts +1 -1
- package/dist/storage/S3StorageController.d.ts +1 -1
- package/dist/storage/cache-headers.d.ts +87 -0
- package/dist/storage/index.d.ts +11 -11
- package/dist/storage/path-pattern.d.ts +58 -0
- package/dist/storage/policies.d.ts +88 -0
- package/dist/storage/range.d.ts +63 -0
- package/dist/storage/rendition-cache.d.ts +45 -0
- package/dist/storage/routes.d.ts +17 -5
- package/dist/storage/storage-registry.d.ts +1 -1
- package/dist/storage/triggers.d.ts +66 -0
- package/dist/storage/tus-handler.d.ts +34 -3
- package/dist/topics/runtime.d.ts +68 -0
- package/dist/{types-DSnOC4mF.js → types-BfKcm9do.js} +5 -4
- package/dist/{types-DSnOC4mF.js.map → types-BfKcm9do.js.map} +1 -1
- package/dist/utils/host.d.ts +58 -0
- package/dist/utils/logger.d.ts +0 -15
- package/dist/utils/request-id.d.ts +1 -1
- package/functions/package.json +24 -0
- package/package.json +13 -7
- package/dist/admin_block-DLILvzle.js.map +0 -1
- package/dist/auth-5Et5mnUA.js.map +0 -1
- package/dist/contract-routes-DZ-LBpSL.js.map +0 -1
- package/dist/cron-routes-maM_RlUu.js.map +0 -1
- package/dist/cron-scheduler-DIpYBmZP.js.map +0 -1
- package/dist/ddl-bootstrap-Cywoj8Ta.js.map +0 -1
- package/dist/errors-EBYiaJ2E.js.map +0 -1
- package/dist/function-routes-Btcez1T-.js.map +0 -1
- package/dist/logger-DfvF_8r-.js.map +0 -1
- package/dist/logs-routes-CWBLQj2l.js.map +0 -1
- package/dist/request-timeout-BuFoEKwT.js.map +0 -1
- package/dist/schema-editor-routes-CV9k0w3G.js.map +0 -1
- package/dist/src-BPfYOeN4.js.map +0 -1
- package/dist/src-CrCxd8km.js.map +0 -1
|
@@ -1,5 +1,96 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* `@rebasepro/server/functions` — the portable authoring surface.
|
|
3
|
+
*
|
|
4
|
+
* Everything a custom function needs, and nothing that ties it to one runtime.
|
|
5
|
+
* Import from here rather than from `@rebasepro/server`:
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { defineFunction, requireAuth, getUser, rebase } from "@rebasepro/server/functions";
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* ## Why this entry point exists
|
|
12
|
+
*
|
|
13
|
+
* `@rebasepro/server` is a single barrel over the whole framework: the boot
|
|
14
|
+
* sequence, the collection loader, the backup routes, the SPA server, the
|
|
15
|
+
* WebSocket layer. Importing one name from it pulls `@hono/node-server`, `ws`,
|
|
16
|
+
* `jsonwebtoken`, Drizzle and a dozen modules that open files. On Node that
|
|
17
|
+
* costs a little start-up time and nothing else, which is why it stood for as
|
|
18
|
+
* long as it did. On a host without Node built-ins it does not resolve at all —
|
|
19
|
+
* so with only that entry point, *no* custom function could ever run anywhere
|
|
20
|
+
* but Node, no matter how portable the function's own code was.
|
|
21
|
+
*
|
|
22
|
+
* That is not a limitation you can lift later. `import { defineFunction } from
|
|
23
|
+
* "@rebasepro/server"` is the line in every function file, every template and
|
|
24
|
+
* every documentation page; changing it afterwards is a breaking change for
|
|
25
|
+
* everyone who has written one. The entry point has to exist before the code
|
|
26
|
+
* that would depend on it does.
|
|
27
|
+
*
|
|
28
|
+
* ## What "portable" means here, precisely
|
|
29
|
+
*
|
|
30
|
+
* Every module reachable from this file:
|
|
31
|
+
*
|
|
32
|
+
* - imports no Node built-in, directly or transitively;
|
|
33
|
+
* - imports no package that needs one (`@hono/node-server`, `ws`,
|
|
34
|
+
* `jsonwebtoken`, `drizzle-orm`, `pg`, …);
|
|
35
|
+
* - touches no host global — `process`, `Buffer`, `__dirname` — at module
|
|
36
|
+
* scope, so the module *evaluates* on a runtime that has none.
|
|
37
|
+
*
|
|
38
|
+
* `portability.test.ts` walks this graph on every run and fails naming the
|
|
39
|
+
* import chain that broke it. The rule is not a convention; it is a test.
|
|
40
|
+
*
|
|
41
|
+
* ## What is deliberately not here
|
|
42
|
+
*
|
|
43
|
+
* - **`rebase.sql()`** — reachable through `rebase`, and Node-only in practice:
|
|
44
|
+
* it runs on the database owner connection over a TCP socket. It is left on
|
|
45
|
+
* the object rather than hidden because there is nothing wrong with using it
|
|
46
|
+
* on a Node deployment; see its docblock, and `runtimeKey()` if a function
|
|
47
|
+
* needs to degrade rather than fail.
|
|
48
|
+
* - **Token verification.** Deciding whether a caller is who they say needs the
|
|
49
|
+
* signing key and belongs to the host; deciding whether *this* caller may
|
|
50
|
+
* call *this* route needs only the resolved identity and belongs here. That
|
|
51
|
+
* is why `requireAuth` below carries no crypto — see `./guards.ts`.
|
|
52
|
+
* - **The loader, the router, the proxy, the timeout middleware.** Host
|
|
53
|
+
* machinery. It lives in `./internal.ts`.
|
|
54
|
+
*
|
|
55
|
+
* @module
|
|
56
|
+
*/
|
|
57
|
+
export { defineFunction } from "./define-function.js";
|
|
58
|
+
export type { RebaseFunctionContext } from "./define-function.js";
|
|
59
|
+
/**
|
|
60
|
+
* The app-scoped Rebase client: `dataAsAdmin`, `auth`, `storage`, `email`,
|
|
61
|
+
* `sql`.
|
|
62
|
+
*
|
|
63
|
+
* Re-exported here — the same object the package root exports, not a copy —
|
|
64
|
+
* because it is the one piece of the framework a function reaches for at
|
|
65
|
+
* runtime, and requiring a second import from the Node-only barrel to get it
|
|
66
|
+
* would defeat the entry point.
|
|
67
|
+
*
|
|
68
|
+
* It is safe to hold at module scope, unlike a configuration value, because it
|
|
69
|
+
* is a lazy Proxy: nothing is resolved until a property is read, which happens
|
|
70
|
+
* inside a request. That indirection is also the whole of what a future
|
|
71
|
+
* isolate-based host has to hook — see `_setRebaseResolver` in
|
|
72
|
+
* `../singleton.ts`.
|
|
73
|
+
*/
|
|
74
|
+
export { rebase } from "../singleton.js";
|
|
75
|
+
export { getUser, getUserId, getRoles, hasRole, isAdmin, isAuthenticated, getDriver, requireDriver, getApiKey, getRequestId, identityResolved } from "./context.js";
|
|
76
|
+
export type { FunctionUser } from "./context.js";
|
|
77
|
+
export { requireAuth, requireAdmin, requireRole } from "./guards.js";
|
|
78
|
+
export { getEnv, env, requireEnv, runtimeKey, isNodeRuntime, lazyResource } from "./runtime-env.js";
|
|
79
|
+
export { waitUntil } from "./wait-until.js";
|
|
80
|
+
/**
|
|
81
|
+
* The Hono environment a Rebase function runs in: `c.get("user")`,
|
|
82
|
+
* `c.get("driver")`, `c.get("apiKey")` and `c.get("requestId")` are typed
|
|
83
|
+
* through it.
|
|
84
|
+
*
|
|
85
|
+
* `defineFunction` applies it for you. Declare it explicitly only when building
|
|
86
|
+
* the Hono app by hand: `new Hono<HonoEnv>()`.
|
|
87
|
+
*/
|
|
88
|
+
export type { HonoEnv, ApiResponse } from "../api/types.js";
|
|
89
|
+
/**
|
|
90
|
+
* Throw this to answer with a specific status.
|
|
91
|
+
*
|
|
92
|
+
* The functions router installs the framework's error handler, so an `ApiError`
|
|
93
|
+
* thrown anywhere inside a handler becomes the status and body it names,
|
|
94
|
+
* whereas any other throw becomes a 500 with its detail withheld.
|
|
95
|
+
*/
|
|
96
|
+
export { ApiError } from "../api/errors.js";
|