@rebasepro/server 0.0.1-canary.4829d6e

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 (127) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +77 -0
  3. package/dist/api/ast-schema-editor.d.ts +21 -0
  4. package/dist/api/collections_for_test/callbacks_test_collection.d.ts +2 -0
  5. package/dist/api/errors.d.ts +53 -0
  6. package/dist/api/index.d.ts +7 -0
  7. package/dist/api/logs-routes.d.ts +37 -0
  8. package/dist/api/openapi-generator.d.ts +16 -0
  9. package/dist/api/rest/api-generator.d.ts +68 -0
  10. package/dist/api/rest/index.d.ts +1 -0
  11. package/dist/api/rest/query-parser.d.ts +6 -0
  12. package/dist/api/schema-editor-routes.d.ts +3 -0
  13. package/dist/api/types.d.ts +56 -0
  14. package/dist/auth/adapter-middleware.d.ts +43 -0
  15. package/dist/auth/admin-roles-route.d.ts +18 -0
  16. package/dist/auth/admin-user-ops.d.ts +80 -0
  17. package/dist/auth/admin-users-route.d.ts +28 -0
  18. package/dist/auth/api-keys/api-key-middleware.d.ts +39 -0
  19. package/dist/auth/api-keys/api-key-permission-guard.d.ts +32 -0
  20. package/dist/auth/api-keys/api-key-routes.d.ts +20 -0
  21. package/dist/auth/api-keys/api-key-store.d.ts +35 -0
  22. package/dist/auth/api-keys/api-key-types.d.ts +96 -0
  23. package/dist/auth/api-keys/index.d.ts +17 -0
  24. package/dist/auth/apple-oauth.d.ts +30 -0
  25. package/dist/auth/auth-hooks.d.ts +242 -0
  26. package/dist/auth/bitbucket-oauth.d.ts +11 -0
  27. package/dist/auth/builtin-auth-adapter.d.ts +55 -0
  28. package/dist/auth/cookie-utils.d.ts +32 -0
  29. package/dist/auth/crypto-utils.d.ts +16 -0
  30. package/dist/auth/custom-auth-adapter.d.ts +39 -0
  31. package/dist/auth/discord-oauth.d.ts +14 -0
  32. package/dist/auth/facebook-oauth.d.ts +14 -0
  33. package/dist/auth/github-oauth.d.ts +15 -0
  34. package/dist/auth/gitlab-oauth.d.ts +13 -0
  35. package/dist/auth/google-oauth.d.ts +47 -0
  36. package/dist/auth/index.d.ts +38 -0
  37. package/dist/auth/interfaces.d.ts +431 -0
  38. package/dist/auth/jwt.d.ts +67 -0
  39. package/dist/auth/linkedin-oauth.d.ts +18 -0
  40. package/dist/auth/magic-link-routes.d.ts +32 -0
  41. package/dist/auth/mfa-crypto.d.ts +23 -0
  42. package/dist/auth/mfa-routes.d.ts +7 -0
  43. package/dist/auth/mfa.d.ts +49 -0
  44. package/dist/auth/microsoft-oauth.d.ts +16 -0
  45. package/dist/auth/middleware.d.ts +158 -0
  46. package/dist/auth/password.d.ts +22 -0
  47. package/dist/auth/rate-limiter.d.ts +50 -0
  48. package/dist/auth/reset-password-admin.d.ts +29 -0
  49. package/dist/auth/rls-scope.d.ts +31 -0
  50. package/dist/auth/routes.d.ts +66 -0
  51. package/dist/auth/session-routes.d.ts +29 -0
  52. package/dist/auth/slack-oauth.d.ts +12 -0
  53. package/dist/auth/spotify-oauth.d.ts +12 -0
  54. package/dist/auth/twitter-oauth.d.ts +18 -0
  55. package/dist/backup/backup-common.d.ts +31 -0
  56. package/dist/backup/backup-routes.d.ts +22 -0
  57. package/dist/backup/index.d.ts +7 -0
  58. package/dist/collections/BackendCollectionRegistry.d.ts +13 -0
  59. package/dist/collections/loader.d.ts +39 -0
  60. package/dist/cron/cron-loader.d.ts +18 -0
  61. package/dist/cron/cron-routes.d.ts +14 -0
  62. package/dist/cron/cron-scheduler.d.ts +106 -0
  63. package/dist/cron/cron-store.d.ts +32 -0
  64. package/dist/cron/define-cron.d.ts +28 -0
  65. package/dist/cron/index.d.ts +7 -0
  66. package/dist/db/interfaces.d.ts +18 -0
  67. package/dist/dynamic-import-Dvh-K5fl.js +22 -0
  68. package/dist/dynamic-import-Dvh-K5fl.js.map +1 -0
  69. package/dist/email/index.d.ts +6 -0
  70. package/dist/email/smtp-email-service.d.ts +30 -0
  71. package/dist/email/templates.d.ts +50 -0
  72. package/dist/email/types.d.ts +126 -0
  73. package/dist/env.d.ts +102 -0
  74. package/dist/functions/define-function.d.ts +55 -0
  75. package/dist/functions/function-loader.d.ts +18 -0
  76. package/dist/functions/function-routes.d.ts +10 -0
  77. package/dist/functions/index.d.ts +5 -0
  78. package/dist/history/history-routes.d.ts +23 -0
  79. package/dist/history/index.d.ts +1 -0
  80. package/dist/index.d.ts +38 -0
  81. package/dist/index.es.js +18458 -0
  82. package/dist/index.es.js.map +1 -0
  83. package/dist/index.umd.js +48745 -0
  84. package/dist/index.umd.js.map +1 -0
  85. package/dist/init/docs.d.ts +4 -0
  86. package/dist/init/health.d.ts +2 -0
  87. package/dist/init/middlewares.d.ts +10 -0
  88. package/dist/init/shutdown.d.ts +65 -0
  89. package/dist/init/storage.d.ts +5 -0
  90. package/dist/init.d.ts +375 -0
  91. package/dist/jwt-BwIn8xmk.js +4200 -0
  92. package/dist/jwt-BwIn8xmk.js.map +1 -0
  93. package/dist/logger-BYU66ENZ.js +94 -0
  94. package/dist/logger-BYU66ENZ.js.map +1 -0
  95. package/dist/ms-DnYXB-Wd.js +162 -0
  96. package/dist/ms-DnYXB-Wd.js.map +1 -0
  97. package/dist/openapi-generator-Z9oYWLf_.js +586 -0
  98. package/dist/openapi-generator-Z9oYWLf_.js.map +1 -0
  99. package/dist/schema-editor-routes-D3ef8zu1.js +219 -0
  100. package/dist/schema-editor-routes-D3ef8zu1.js.map +1 -0
  101. package/dist/serve-spa.d.ts +36 -0
  102. package/dist/services/driver-registry.d.ts +78 -0
  103. package/dist/services/routed-realtime-service.d.ts +43 -0
  104. package/dist/services/webhook-service.d.ts +29 -0
  105. package/dist/singleton.d.ts +51 -0
  106. package/dist/src-B4OLmNVa.js +437 -0
  107. package/dist/src-B4OLmNVa.js.map +1 -0
  108. package/dist/src-B9tjYmqP.js +24598 -0
  109. package/dist/src-B9tjYmqP.js.map +1 -0
  110. package/dist/storage/GCSStorageController.d.ts +43 -0
  111. package/dist/storage/LocalStorageController.d.ts +46 -0
  112. package/dist/storage/S3StorageController.d.ts +40 -0
  113. package/dist/storage/image-transform.d.ts +50 -0
  114. package/dist/storage/index.d.ts +31 -0
  115. package/dist/storage/routes.d.ts +70 -0
  116. package/dist/storage/storage-registry.d.ts +78 -0
  117. package/dist/storage/tus-handler.d.ts +53 -0
  118. package/dist/storage/types.d.ts +128 -0
  119. package/dist/types/index.d.ts +11 -0
  120. package/dist/utils/dev-port.d.ts +45 -0
  121. package/dist/utils/dynamic-import.d.ts +25 -0
  122. package/dist/utils/logger.d.ts +31 -0
  123. package/dist/utils/logging.d.ts +9 -0
  124. package/dist/utils/request-id.d.ts +4 -0
  125. package/dist/utils/request-logger.d.ts +19 -0
  126. package/dist/utils/sql.d.ts +27 -0
  127. package/package.json +115 -0
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Structured HTTP request logging middleware for Hono.
3
+ *
4
+ * Logs every request with method, path, status code, latency, and
5
+ * content-length. In production, outputs JSON for Cloud Logging; in
6
+ * development, emits a coloured one-liner.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * import { requestLogger } from "@rebasepro/server";
11
+ * app.use("/*", requestLogger());
12
+ * ```
13
+ */
14
+ import type { MiddlewareHandler } from "hono";
15
+ export interface RequestLoggerOptions {
16
+ /** Paths to skip logging (e.g. "/health"). Supports exact match. */
17
+ skip?: string[];
18
+ }
19
+ export declare function requestLogger(options?: RequestLoggerOptions): MiddlewareHandler;
@@ -0,0 +1,27 @@
1
+ import { SQL } from "drizzle-orm";
2
+ /**
3
+ * Returns a SQL chunk calling `auth.uid()` — the current user's ID.
4
+ * This is a PostgreSQL RLS helper function created in the `auth` schema
5
+ * that reads `app.user_id` set per-transaction by `withAuth()`.
6
+ *
7
+ * @example
8
+ * sql`${table.user_id} = ${authUid()}`
9
+ */
10
+ export declare const authUid: () => SQL;
11
+ /**
12
+ * Returns a SQL chunk calling `auth.roles()` — the current user's roles
13
+ * as a comma-separated string.
14
+ * Reads `app.user_roles` set per-transaction by `withAuth()`.
15
+ *
16
+ * @example
17
+ * sql`auth.roles() ~ 'admin'`
18
+ */
19
+ export declare const authRoles: () => SQL;
20
+ /**
21
+ * Returns a SQL chunk calling `auth.jwt()` — the full JWT claims as JSONB.
22
+ * Reads `app.jwt` set per-transaction by `withAuth()`.
23
+ *
24
+ * @example
25
+ * sql`auth.jwt()->>'sub'`
26
+ */
27
+ export declare const authJwt: () => SQL;
package/package.json ADDED
@@ -0,0 +1,115 @@
1
+ {
2
+ "name": "@rebasepro/server",
3
+ "type": "module",
4
+ "version": "0.0.1-canary.4829d6e",
5
+ "description": "Database-Agnostic Backend Core for Rebase",
6
+ "funding": {
7
+ "url": "https://github.com/sponsors/rebaseco"
8
+ },
9
+ "author": "Rebase",
10
+ "license": "MIT",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/rebasepro/rebase.git",
14
+ "directory": "packages/server"
15
+ },
16
+ "main": "./dist/index.umd.js",
17
+ "module": "./dist/index.es.js",
18
+ "types": "./dist/index.d.ts",
19
+ "source": "src/index.ts",
20
+ "engines": {
21
+ "node": ">=14"
22
+ },
23
+ "keywords": [
24
+ "rebase",
25
+ "cms",
26
+ "admin",
27
+ "admin panel",
28
+ "postgresql",
29
+ "drizzle",
30
+ "backend",
31
+ "database"
32
+ ],
33
+ "exports": {
34
+ ".": {
35
+ "types": "./dist/index.d.ts",
36
+ "development": "./dist/index.es.js",
37
+ "import": "./dist/index.es.js",
38
+ "require": "./dist/index.umd.js"
39
+ },
40
+ "./package.json": "./package.json"
41
+ },
42
+ "dependencies": {
43
+ "@hono/node-server": "2.0.4",
44
+ "drizzle-orm": "^0.45.2",
45
+ "hono": "^4.12.25",
46
+ "jsonwebtoken": "^9.0.3",
47
+ "ws": "^8.21.0",
48
+ "zod": "^4.4.3",
49
+ "@rebasepro/client": "0.0.1-canary.4829d6e",
50
+ "@rebasepro/common": "0.0.1-canary.4829d6e",
51
+ "@rebasepro/types": "0.0.1-canary.4829d6e",
52
+ "@rebasepro/utils": "0.0.1-canary.4829d6e"
53
+ },
54
+ "devDependencies": {
55
+ "@types/jest": "^30.0.0",
56
+ "@types/jsonwebtoken": "^9.0.10",
57
+ "@types/node": "^25.9.3",
58
+ "@types/nodemailer": "^8.0.1",
59
+ "@types/react": "^19.2.17",
60
+ "@types/react-dom": "^19.2.3",
61
+ "@types/ws": "^8.18.1",
62
+ "@vitejs/plugin-react": "^6.0.2",
63
+ "cross-env": "^10.1.0",
64
+ "jest": "^30.4.2",
65
+ "ts-jest": "29.4.11",
66
+ "typescript": "^6.0.3",
67
+ "vite": "^8.0.16"
68
+ },
69
+ "peerDependencies": {
70
+ "@aws-sdk/client-s3": "^3.1068.0",
71
+ "@aws-sdk/s3-request-presigner": "^3.1068.0",
72
+ "@google-cloud/storage": "^7.0.0",
73
+ "google-auth-library": "^10.7.0",
74
+ "nodemailer": "^9.0.0",
75
+ "sharp": "^0.35.1",
76
+ "ts-morph": "28.0.0"
77
+ },
78
+ "peerDependenciesMeta": {
79
+ "@aws-sdk/client-s3": {
80
+ "optional": true
81
+ },
82
+ "@aws-sdk/s3-request-presigner": {
83
+ "optional": true
84
+ },
85
+ "@google-cloud/storage": {
86
+ "optional": true
87
+ },
88
+ "google-auth-library": {
89
+ "optional": true
90
+ },
91
+ "nodemailer": {
92
+ "optional": true
93
+ },
94
+ "sharp": {
95
+ "optional": true
96
+ },
97
+ "ts-morph": {
98
+ "optional": true
99
+ }
100
+ },
101
+ "gitHead": "d935eefa5aa8d1009a2398cfac2c1e4ee9aeb6b6",
102
+ "publishConfig": {
103
+ "access": "public"
104
+ },
105
+ "files": [
106
+ "dist"
107
+ ],
108
+ "scripts": {
109
+ "watch": "vite build --watch",
110
+ "build": "vite build && tsc --emitDeclarationOnly -p tsconfig.prod.json",
111
+ "test:lint": "eslint \"src/**\" --quiet",
112
+ "test": "cross-env NODE_OPTIONS=\"--experimental-vm-modules\" jest --passWithNoTests --forceExit",
113
+ "clean": "rm -rf dist && find ./src -name '*.js' -type f | xargs rm -f"
114
+ }
115
+ }