@rebasepro/server 0.13.0 → 0.13.1-canary.g06dbe5b

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.
Files changed (125) hide show
  1. package/dist/{admin_block-CcSGdH7M.js → admin_block-H86dCPsj.js} +62 -2
  2. package/dist/admin_block-H86dCPsj.js.map +1 -0
  3. package/dist/api/ast-schema-editor.d.ts +74 -6
  4. package/dist/api/errors.d.ts +0 -6
  5. package/dist/api/openapi-generator.d.ts +14 -0
  6. package/dist/api/rest/api-generator.d.ts +1 -1
  7. package/dist/api/rest/idempotency.d.ts +62 -4
  8. package/dist/api/rest/query-parser.d.ts +15 -1
  9. package/dist/api/rest/write-validation.d.ts +52 -9
  10. package/dist/auth/adapter-middleware.d.ts +3 -1
  11. package/dist/auth/apple-oauth.d.ts +16 -11
  12. package/dist/auth/bitbucket-oauth.d.ts +2 -4
  13. package/dist/auth/builtin-auth-adapter.d.ts +2 -0
  14. package/dist/auth/discord-oauth.d.ts +5 -6
  15. package/dist/auth/facebook-oauth.d.ts +2 -4
  16. package/dist/auth/github-oauth.d.ts +2 -4
  17. package/dist/auth/gitlab-oauth.d.ts +6 -4
  18. package/dist/auth/google-oauth.d.ts +1 -0
  19. package/dist/auth/index.d.ts +8 -1
  20. package/dist/auth/interfaces.d.ts +68 -1
  21. package/dist/auth/jwt.d.ts +40 -0
  22. package/dist/auth/linkedin-oauth.d.ts +2 -4
  23. package/dist/auth/mfa-gate.d.ts +42 -0
  24. package/dist/auth/mfa-routes.d.ts +26 -1
  25. package/dist/auth/mfa.d.ts +16 -0
  26. package/dist/auth/microsoft-oauth.d.ts +19 -4
  27. package/dist/auth/oauth-code-flow.d.ts +66 -0
  28. package/dist/auth/oauth-signin-policy.d.ts +61 -0
  29. package/dist/auth/oidc-id-token.d.ts +61 -0
  30. package/dist/auth/rate-limiter.d.ts +37 -2
  31. package/dist/auth/rls-scope.d.ts +25 -0
  32. package/dist/auth/routes.d.ts +8 -0
  33. package/dist/auth/slack-oauth.d.ts +2 -4
  34. package/dist/auth/spotify-oauth.d.ts +2 -4
  35. package/dist/auth/twitter-oauth.d.ts +2 -5
  36. package/dist/{auth-CuC9M2x6.js → auth-DkAHqvf5.js} +1604 -391
  37. package/dist/auth-DkAHqvf5.js.map +1 -0
  38. package/dist/{backup-CVggVhR2.js → backup-DLluVyuA.js} +2 -2
  39. package/dist/{backup-CVggVhR2.js.map → backup-DLluVyuA.js.map} +1 -1
  40. package/dist/boot/boot.d.ts +19 -0
  41. package/dist/boot/ddl-bootstrap.d.ts +70 -0
  42. package/dist/{contract-routes-Dj8i5AiM.js → contract-routes-BB1U05sS.js} +3 -3
  43. package/dist/{contract-routes-Dj8i5AiM.js.map → contract-routes-BB1U05sS.js.map} +1 -1
  44. package/dist/cron/cron-scheduler.d.ts +8 -3
  45. package/dist/cron/define-cron.d.ts +17 -3
  46. package/dist/{cron-loader-B1S2MCSl.js → cron-loader-3U5aGILy.js} +2 -2
  47. package/dist/{cron-loader-B1S2MCSl.js.map → cron-loader-3U5aGILy.js.map} +1 -1
  48. package/dist/{cron-routes-CrQ0tK-_.js → cron-routes-rZgwlOz4.js} +2 -2
  49. package/dist/{cron-routes-CrQ0tK-_.js.map → cron-routes-rZgwlOz4.js.map} +1 -1
  50. package/dist/{cron-scheduler-B3RFt0HS.js → cron-scheduler-FJAaCAXm.js} +30 -5
  51. package/dist/cron-scheduler-FJAaCAXm.js.map +1 -0
  52. package/dist/{cron-store-BywZsyfZ.js → cron-store-9NmUDfzL.js} +66 -47
  53. package/dist/cron-store-9NmUDfzL.js.map +1 -0
  54. package/dist/ddl-bootstrap-BhXbTnBl.js +183 -0
  55. package/dist/ddl-bootstrap-BhXbTnBl.js.map +1 -0
  56. package/dist/email/html.d.ts +54 -0
  57. package/dist/email/index.d.ts +3 -0
  58. package/dist/email/link-base.d.ts +39 -0
  59. package/dist/email/smtp-email-service.d.ts +7 -1
  60. package/dist/email/templates.d.ts +9 -1
  61. package/dist/email/types.d.ts +11 -1
  62. package/dist/{errors-CgkCzoj7.js → errors-B1WZEdsK.js} +3 -11
  63. package/dist/errors-B1WZEdsK.js.map +1 -0
  64. package/dist/function-loader-D1SwtCa5.js +139 -0
  65. package/dist/function-loader-D1SwtCa5.js.map +1 -0
  66. package/dist/{function-routes-C0cLIy3N.js → function-routes-Btcez1T-.js} +18 -6
  67. package/dist/function-routes-Btcez1T-.js.map +1 -0
  68. package/dist/functions/define-function.d.ts +25 -6
  69. package/dist/functions/function-loader.d.ts +23 -0
  70. package/dist/functions/function-routes.d.ts +7 -1
  71. package/dist/functions/request-timeout.d.ts +34 -0
  72. package/dist/history/history-routes.d.ts +6 -0
  73. package/dist/index.d.ts +2 -1
  74. package/dist/index.es.js +1960 -794
  75. package/dist/index.es.js.map +1 -1
  76. package/dist/init/docs.d.ts +10 -1
  77. package/dist/init/process-safety.d.ts +25 -0
  78. package/dist/init.d.ts +27 -0
  79. package/dist/{jwt-DD6EtpGj.js → jwt-Cuq6MwNy.js} +70 -8
  80. package/dist/jwt-Cuq6MwNy.js.map +1 -0
  81. package/dist/logger-DfvF_8r-.js +190 -0
  82. package/dist/logger-DfvF_8r-.js.map +1 -0
  83. package/dist/openapi-generator-BQxxxDpb.js +865 -0
  84. package/dist/openapi-generator-BQxxxDpb.js.map +1 -0
  85. package/dist/request-timeout-RivJsME0.js +65 -0
  86. package/dist/request-timeout-RivJsME0.js.map +1 -0
  87. package/dist/schema-editor-routes-DZFKGXgq.js +437 -0
  88. package/dist/schema-editor-routes-DZFKGXgq.js.map +1 -0
  89. package/dist/serve-spa.d.ts +5 -4
  90. package/dist/services/outbound-url-guard.d.ts +53 -0
  91. package/dist/services/routed-realtime-service.d.ts +10 -2
  92. package/dist/services/webhook-service.d.ts +76 -1
  93. package/dist/singleton.d.ts +25 -8
  94. package/dist/{src-Cum9kox5.js → src-By48Ffg0.js} +322 -70
  95. package/dist/src-By48Ffg0.js.map +1 -0
  96. package/dist/{src-_qQ3RNCK.js → src-Ca6NhxKs.js} +79 -2
  97. package/dist/src-Ca6NhxKs.js.map +1 -0
  98. package/dist/storage/LocalStorageController.d.ts +12 -1
  99. package/dist/storage/image-transform.d.ts +57 -0
  100. package/dist/storage/keys.d.ts +98 -0
  101. package/dist/storage/routes.d.ts +11 -0
  102. package/dist/storage/tus-handler.d.ts +7 -1
  103. package/dist/utils/logger.d.ts +18 -0
  104. package/dist/utils/logging.d.ts +0 -4
  105. package/dist/utils/sql.d.ts +11 -6
  106. package/package.json +7 -6
  107. package/dist/admin_block-CcSGdH7M.js.map +0 -1
  108. package/dist/auth-CuC9M2x6.js.map +0 -1
  109. package/dist/backend-CIxN4FVm.js +0 -15
  110. package/dist/backend-CIxN4FVm.js.map +0 -1
  111. package/dist/cron-scheduler-B3RFt0HS.js.map +0 -1
  112. package/dist/cron-store-BywZsyfZ.js.map +0 -1
  113. package/dist/errors-CgkCzoj7.js.map +0 -1
  114. package/dist/function-loader-B_1fYfUY.js +0 -86
  115. package/dist/function-loader-B_1fYfUY.js.map +0 -1
  116. package/dist/function-routes-C0cLIy3N.js.map +0 -1
  117. package/dist/jwt-DD6EtpGj.js.map +0 -1
  118. package/dist/logger-BYU66ENZ.js +0 -94
  119. package/dist/logger-BYU66ENZ.js.map +0 -1
  120. package/dist/openapi-generator-BEwyiaAr.js +0 -597
  121. package/dist/openapi-generator-BEwyiaAr.js.map +0 -1
  122. package/dist/schema-editor-routes-CbF20Mf1.js +0 -248
  123. package/dist/schema-editor-routes-CbF20Mf1.js.map +0 -1
  124. package/dist/src-Cum9kox5.js.map +0 -1
  125. package/dist/src-_qQ3RNCK.js.map +0 -1
@@ -6,6 +6,18 @@ export interface LoadedFunction {
6
6
  /** The Hono sub-app to mount */
7
7
  app: Hono<import("hono").Env>;
8
8
  }
9
+ /** What a directory of function files produced: what mounted, and what did not. */
10
+ export interface LoadedFunctions {
11
+ /** The functions that will be served. */
12
+ functions: LoadedFunction[];
13
+ /**
14
+ * One entry per file the loader saw and did **not** mount, each already
15
+ * phrased as `<name> (<reason>)`. Returned rather than only logged so the
16
+ * running server can say what is missing — a boot log line is not reachable
17
+ * from `GET /api/functions`.
18
+ */
19
+ problems: string[];
20
+ }
9
21
  /**
10
22
  * Auto-discover Hono route files from a directory.
11
23
  *
@@ -14,5 +26,16 @@ export interface LoadedFunction {
14
26
  * `functions/send-invoice.ts` → mounted at `/send-invoice`
15
27
  *
16
28
  * This mirrors how `loadCollectionsFromDirectory` works for collections.
29
+ *
30
+ * Returns only what loaded. Use {@link loadFunctionsWithDiagnostics} when the
31
+ * caller also needs to report what did not.
17
32
  */
18
33
  export declare function loadFunctionsFromDirectory(directory: string, importModule?: ModuleImporter): Promise<LoadedFunction[]>;
34
+ /**
35
+ * {@link loadFunctionsFromDirectory}, plus the list of files that were skipped.
36
+ *
37
+ * Never throws: a single malformed function must not crash server boot. The
38
+ * caller decides what to do with `problems` — `init.ts` mounts the router
39
+ * regardless and surfaces the count on the listing endpoint.
40
+ */
41
+ export declare function loadFunctionsWithDiagnostics(directory: string, importModule?: ModuleImporter): Promise<LoadedFunctions>;
@@ -6,5 +6,11 @@ import { LoadedFunction } from "./function-loader";
6
6
  *
7
7
  * Each function is mounted at `/<function-name>`, preserving
8
8
  * whatever HTTP methods and middleware the Hono sub-app defines.
9
+ *
10
+ * @param functions What loaded. May be empty — the router still mounts, so
11
+ * "no functions are served" answers 200 with an empty list instead of 404.
12
+ * @param skipped How many files the loader saw and could not serve. Reported
13
+ * as a count and a pointer to the log, not as filenames: the listing is
14
+ * reachable anonymously, and the per-file reasons carry import errors.
9
15
  */
10
- export declare function createFunctionRoutes(functions: LoadedFunction[]): Hono<HonoEnv>;
16
+ export declare function createFunctionRoutes(functions: LoadedFunction[], skipped?: number): Hono<HonoEnv>;
@@ -0,0 +1,34 @@
1
+ import type { MiddlewareHandler } from "hono";
2
+ import type { HonoEnv } from "../api/types";
3
+ /** Default ceiling for a custom function request, in milliseconds. */
4
+ export declare const DEFAULT_FUNCTIONS_TIMEOUT_MS = 30000;
5
+ /**
6
+ * Resolve the functions request timeout from config, then env, then the default.
7
+ *
8
+ * `0` (or any non-positive number) disables the ceiling — for a deployment
9
+ * whose proxy already imposes one, or a function that legitimately streams for
10
+ * minutes.
11
+ */
12
+ export declare function resolveFunctionsTimeoutMs(configured?: number): number;
13
+ /**
14
+ * A per-request ceiling for the custom functions router.
15
+ *
16
+ * Custom functions are the one router that runs code the framework did not
17
+ * write, and nothing else in the stack bounds how long that code takes: the
18
+ * Node server is constructed without `requestTimeout`/`headersTimeout`, so a
19
+ * handler awaiting a promise that never settles — a `fetch` to an unreachable
20
+ * third party with no `AbortSignal`, a query on a wedged connection — holds its
21
+ * socket and its request object until the client gives up. On the managed
22
+ * runtime the process is shared between tenants, so that is not only the slow
23
+ * caller's problem.
24
+ *
25
+ * The handler is **not** cancelled — it cannot be, there is no cancellation
26
+ * token to hand user code. What is bounded is the client-visible request: after
27
+ * `ms` the caller gets a 504 and the socket is released, and the handler's
28
+ * eventual result is dropped. It is a ceiling, not a kill switch, and the exact
29
+ * number matters far less than its existence.
30
+ *
31
+ * Mounted in front of the auth middleware rather than behind it, so a wedged
32
+ * driver — the failure that also hangs `withAuth()` — is covered too.
33
+ */
34
+ export declare function createFunctionsRequestTimeout(ms: number): MiddlewareHandler<HonoEnv>;
@@ -19,5 +19,11 @@ export interface HistoryService {
19
19
  export declare function createHistoryRoutes(params: {
20
20
  historyService: HistoryService;
21
21
  registry: BackendCollectionRegistry;
22
+ /**
23
+ * The unscoped driver, still accepted so the call in `init.ts` and any
24
+ * embedder's keeps compiling — and deliberately not read. Every read and
25
+ * write on these routes goes through the request-scoped driver instead;
26
+ * see {@link authorizeEntityRead}.
27
+ */
22
28
  driver: DataDriver;
23
29
  }): Hono<HonoEnv>;
package/dist/index.d.ts CHANGED
@@ -14,7 +14,7 @@ export { loadCollectionsFromDirectory, applyCollectionDefaults, type CollectionD
14
14
  export { assertCollectionConfigs, findCollectionConfigProblems, unknownKeyPolicyFromEnv, type ConfigProblem, type UnknownKeyPolicy, type ValidateCollectionConfigOptions } from "./collections/validate-config";
15
15
  export * from "./db/interfaces";
16
16
  export * from "./auth/interfaces";
17
- export { requireAuth, requireAdmin, optionalAuth, queryTokenAuth, fileTokenAuth, extractUserFromToken, hashPassword, verifyPassword, validatePasswordStrength, generateSecurePassword, resolveAuthHooks, createBuiltinAuthAdapter, createCustomAuthAdapter, createGoogleProvider, createLinkedinProvider, createGitHubProvider, createMicrosoftProvider, createAppleProvider, createFacebookProvider, createTwitterProvider, createDiscordProvider, createGitLabProvider, createBitbucketProvider, createSlackProvider, createSpotifyProvider, isApiKeyToken, validateApiKey, httpMethodToOperation, isOperationAllowed, safeCompare } from "./auth";
17
+ export { requireAuth, requireAdmin, optionalAuth, queryTokenAuth, fileTokenAuth, extractUserFromToken, hashPassword, verifyPassword, validatePasswordStrength, generateSecurePassword, resolveAuthHooks, createBuiltinAuthAdapter, createCustomAuthAdapter, createGoogleProvider, createLinkedinProvider, createGitHubProvider, createMicrosoftProvider, createAppleProvider, createFacebookProvider, createTwitterProvider, createDiscordProvider, createGitLabProvider, createBitbucketProvider, createSlackProvider, createSpotifyProvider, oauthCodeFlowSchema, pkceTokenParams, providerVerifiedEmail, verifyOidcIdToken, tryVerifyOidcIdToken, isApiKeyToken, validateApiKey, httpMethodToOperation, isOperationAllowed, safeCompare } from "./auth";
18
18
  export type { AccessTokenPayload, PasswordValidationResult, AuthHooks, AuthMethod, ResolvedAuthHooks, BuiltinAuthAdapterConfig, GoogleProviderConfig, AuthMiddlewareOptions, AuthResult, ApiKey, ApiKeyMasked, ApiKeyPermission, ApiKeyWithSecret, CreateApiKeyRequest, UpdateApiKeyRequest, ApiKeyStore, ApiKeyOperation } from "./auth";
19
19
  export * from "./api/types";
20
20
  export * from "./api/errors";
@@ -35,6 +35,7 @@ export type { RebaseEnv } from "./env";
35
35
  export * from "./types";
36
36
  export * from "./services/driver-registry";
37
37
  export * from "./services/webhook-service";
38
+ export * from "./services/outbound-url-guard";
38
39
  export { cleanupDevPortFile, listenWithPortRetry } from "./utils/dev-port";
39
40
  export { serveSPA } from "./serve-spa";
40
41
  export { installShutdownHandlers } from "./init/shutdown";