acebase-server 1.9.0 → 1.10.1
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/create-package-files +12 -0
- package/dist/cjs/auth.js +89 -0
- package/dist/cjs/auth.js.map +1 -0
- package/dist/cjs/cluster.js +57 -0
- package/dist/cjs/cluster.js.map +1 -0
- package/dist/cjs/index.js +9 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/middleware/404.js +15 -0
- package/dist/cjs/middleware/404.js.map +1 -0
- package/dist/cjs/middleware/cache.js +15 -0
- package/dist/cjs/middleware/cache.js.map +1 -0
- package/dist/cjs/middleware/connection.js +50 -0
- package/dist/cjs/middleware/connection.js.map +1 -0
- package/dist/cjs/middleware/context.js +21 -0
- package/dist/cjs/middleware/context.js.map +1 -0
- package/dist/cjs/middleware/cors.js +51 -0
- package/dist/cjs/middleware/cors.js.map +1 -0
- package/dist/cjs/middleware/swagger.js +18 -0
- package/dist/cjs/middleware/swagger.js.map +1 -0
- package/dist/cjs/middleware/user.js +58 -0
- package/dist/cjs/middleware/user.js.map +1 -0
- package/dist/cjs/oauth-providers/dropbox.js +109 -0
- package/dist/cjs/oauth-providers/dropbox.js.map +1 -0
- package/dist/cjs/oauth-providers/facebook.js +85 -0
- package/dist/cjs/oauth-providers/facebook.js.map +1 -0
- package/dist/cjs/oauth-providers/google.js +125 -0
- package/dist/cjs/oauth-providers/google.js.map +1 -0
- package/dist/cjs/oauth-providers/index.js +27 -0
- package/dist/cjs/oauth-providers/index.js.map +1 -0
- package/dist/cjs/oauth-providers/instagram.js +80 -0
- package/dist/cjs/oauth-providers/instagram.js.map +1 -0
- package/dist/cjs/oauth-providers/oauth-provider.js +3 -0
- package/dist/cjs/oauth-providers/oauth-provider.js.map +1 -0
- package/dist/cjs/oauth-providers/spotify.js +113 -0
- package/dist/cjs/oauth-providers/spotify.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/routes/auth-change-password.js +85 -0
- package/dist/cjs/routes/auth-change-password.js.map +1 -0
- package/dist/cjs/routes/auth-delete.js +51 -0
- package/dist/cjs/routes/auth-delete.js.map +1 -0
- package/dist/cjs/routes/auth-forgot-password.js +75 -0
- package/dist/cjs/routes/auth-forgot-password.js.map +1 -0
- package/dist/cjs/routes/auth-reset-password.js +94 -0
- package/dist/cjs/routes/auth-reset-password.js.map +1 -0
- package/dist/cjs/routes/auth-signin.js +47 -0
- package/dist/cjs/routes/auth-signin.js.map +1 -0
- package/dist/cjs/routes/auth-signout.js +60 -0
- package/dist/cjs/routes/auth-signout.js.map +1 -0
- package/dist/cjs/routes/auth-signup.js +141 -0
- package/dist/cjs/routes/auth-signup.js.map +1 -0
- package/dist/cjs/routes/auth-state.js +26 -0
- package/dist/cjs/routes/auth-state.js.map +1 -0
- package/dist/cjs/routes/auth-update.js +129 -0
- package/dist/cjs/routes/auth-update.js.map +1 -0
- package/dist/cjs/routes/auth-verify-email.js +67 -0
- package/dist/cjs/routes/auth-verify-email.js.map +1 -0
- package/dist/cjs/routes/auth.js +55 -0
- package/dist/cjs/routes/auth.js.map +1 -0
- package/dist/cjs/routes/data-exists.js +34 -0
- package/dist/cjs/routes/data-exists.js.map +1 -0
- package/dist/cjs/routes/data-export.js +49 -0
- package/dist/cjs/routes/data-export.js.map +1 -0
- package/dist/cjs/routes/data-get.js +67 -0
- package/dist/cjs/routes/data-get.js.map +1 -0
- package/dist/cjs/routes/data-import.js +55 -0
- package/dist/cjs/routes/data-import.js.map +1 -0
- package/dist/cjs/routes/data-index-create.js +45 -0
- package/dist/cjs/routes/data-index-create.js.map +1 -0
- package/dist/cjs/routes/data-index-delete.js +36 -0
- package/dist/cjs/routes/data-index-delete.js.map +1 -0
- package/dist/cjs/routes/data-index-list.js +35 -0
- package/dist/cjs/routes/data-index-list.js.map +1 -0
- package/dist/cjs/routes/data-query.js +71 -0
- package/dist/cjs/routes/data-query.js.map +1 -0
- package/dist/cjs/routes/data-reflect.js +89 -0
- package/dist/cjs/routes/data-reflect.js.map +1 -0
- package/dist/cjs/routes/data-schema-get.js +39 -0
- package/dist/cjs/routes/data-schema-get.js.map +1 -0
- package/dist/cjs/routes/data-schema-set.js +33 -0
- package/dist/cjs/routes/data-schema-set.js.map +1 -0
- package/dist/cjs/routes/data-schema-test.js +46 -0
- package/dist/cjs/routes/data-schema-test.js.map +1 -0
- package/dist/cjs/routes/data-schemas-list.js +35 -0
- package/dist/cjs/routes/data-schemas-list.js.map +1 -0
- package/dist/cjs/routes/data-set.js +72 -0
- package/dist/cjs/routes/data-set.js.map +1 -0
- package/dist/cjs/routes/data-sync-changes.js +68 -0
- package/dist/cjs/routes/data-sync-changes.js.map +1 -0
- package/dist/cjs/routes/data-sync-mutations.js +68 -0
- package/dist/cjs/routes/data-sync-mutations.js.map +1 -0
- package/dist/cjs/routes/data-transaction.js +120 -0
- package/dist/cjs/routes/data-transaction.js.map +1 -0
- package/dist/cjs/routes/data-update.js +71 -0
- package/dist/cjs/routes/data-update.js.map +1 -0
- package/dist/cjs/routes/data.js +63 -0
- package/dist/cjs/routes/data.js.map +1 -0
- package/dist/cjs/routes/docs.js +249 -0
- package/dist/cjs/routes/docs.js.map +1 -0
- package/dist/cjs/routes/meta-info.js +70 -0
- package/dist/cjs/routes/meta-info.js.map +1 -0
- package/dist/cjs/routes/meta-ping.js +12 -0
- package/dist/cjs/routes/meta-ping.js.map +1 -0
- package/dist/cjs/routes/meta-stats.js +28 -0
- package/dist/cjs/routes/meta-stats.js.map +1 -0
- package/dist/cjs/routes/meta.js +17 -0
- package/dist/cjs/routes/meta.js.map +1 -0
- package/dist/cjs/routes/oauth2-init.js +52 -0
- package/dist/cjs/routes/oauth2-init.js.map +1 -0
- package/dist/cjs/routes/oauth2-refresh.js +43 -0
- package/dist/cjs/routes/oauth2-refresh.js.map +1 -0
- package/dist/cjs/routes/oauth2-signin.js +262 -0
- package/dist/cjs/routes/oauth2-signin.js.map +1 -0
- package/dist/cjs/routes/webmanager.js +27 -0
- package/dist/cjs/routes/webmanager.js.map +1 -0
- package/dist/cjs/rules.js +175 -0
- package/dist/cjs/rules.js.map +1 -0
- package/dist/cjs/schema/user.js +26 -0
- package/dist/cjs/schema/user.js.map +1 -0
- package/dist/cjs/server.js +363 -0
- package/dist/cjs/server.js.map +1 -0
- package/dist/cjs/settings/email.js +5 -0
- package/dist/cjs/settings/email.js.map +1 -0
- package/dist/cjs/settings/index.js +159 -0
- package/dist/cjs/settings/index.js.map +1 -0
- package/dist/cjs/shared/clients.js +27 -0
- package/dist/cjs/shared/clients.js.map +1 -0
- package/dist/cjs/shared/email.js +7 -0
- package/dist/cjs/shared/email.js.map +1 -0
- package/{src/oauth-providers/oauth-provider.js → dist/cjs/shared/env.js} +3 -0
- package/dist/cjs/shared/env.js.map +1 -0
- package/dist/cjs/shared/error.js +35 -0
- package/dist/cjs/shared/error.js.map +1 -0
- package/dist/cjs/shared/http.js +21 -0
- package/dist/cjs/shared/http.js.map +1 -0
- package/dist/cjs/shared/password.js +46 -0
- package/dist/cjs/shared/password.js.map +1 -0
- package/dist/cjs/shared/rootpath.js +15 -0
- package/dist/cjs/shared/rootpath.js.map +1 -0
- package/dist/cjs/shared/signin.js +139 -0
- package/dist/cjs/shared/signin.js.map +1 -0
- package/dist/cjs/shared/simple-fetch.js +77 -0
- package/dist/cjs/shared/simple-fetch.js.map +1 -0
- package/dist/cjs/shared/tokens.js +79 -0
- package/dist/cjs/shared/tokens.js.map +1 -0
- package/dist/cjs/shared/validate.js +62 -0
- package/dist/cjs/shared/validate.js.map +1 -0
- package/dist/cjs/start.js +51 -0
- package/dist/cjs/start.js.map +1 -0
- package/dist/cjs/test.js +11 -0
- package/dist/cjs/test.js.map +1 -0
- package/dist/cjs/websocket/index.js +301 -0
- package/dist/cjs/websocket/index.js.map +1 -0
- package/dist/cjs/websocket/manager.js +16 -0
- package/dist/cjs/websocket/manager.js.map +1 -0
- package/dist/cjs/websocket/socket.io.js +79 -0
- package/dist/cjs/websocket/socket.io.js.map +1 -0
- package/dist/esm/auth.js +76 -0
- package/dist/esm/auth.js.map +1 -0
- package/{src → dist/esm}/cluster.js +9 -14
- package/dist/esm/cluster.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/middleware/404.js +11 -0
- package/dist/esm/middleware/404.js.map +1 -0
- package/dist/esm/middleware/cache.js +11 -0
- package/dist/esm/middleware/cache.js.map +1 -0
- package/dist/esm/middleware/connection.js +46 -0
- package/dist/esm/middleware/connection.js.map +1 -0
- package/dist/esm/middleware/context.js +17 -0
- package/dist/esm/middleware/context.js.map +1 -0
- package/dist/esm/middleware/cors.js +45 -0
- package/dist/esm/middleware/cors.js.map +1 -0
- package/dist/esm/middleware/swagger.js +14 -0
- package/dist/esm/middleware/swagger.js.map +1 -0
- package/dist/esm/middleware/user.js +45 -0
- package/dist/esm/middleware/user.js.map +1 -0
- package/{src → dist/esm}/oauth-providers/dropbox.js +11 -9
- package/dist/esm/oauth-providers/dropbox.js.map +1 -0
- package/{src → dist/esm}/oauth-providers/facebook.js +6 -9
- package/dist/esm/oauth-providers/facebook.js.map +1 -0
- package/{src → dist/esm}/oauth-providers/google.js +8 -11
- package/dist/esm/oauth-providers/google.js.map +1 -0
- package/dist/esm/oauth-providers/index.js +19 -0
- package/dist/esm/oauth-providers/index.js.map +1 -0
- package/{src → dist/esm}/oauth-providers/instagram.js +6 -9
- package/dist/esm/oauth-providers/instagram.js.map +1 -0
- package/dist/esm/oauth-providers/oauth-provider.js +2 -0
- package/dist/esm/oauth-providers/oauth-provider.js.map +1 -0
- package/{src → dist/esm}/oauth-providers/spotify.js +7 -10
- package/dist/esm/oauth-providers/spotify.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/routes/auth-change-password.js +70 -0
- package/dist/esm/routes/auth-change-password.js.map +1 -0
- package/dist/esm/routes/auth-delete.js +36 -0
- package/dist/esm/routes/auth-delete.js.map +1 -0
- package/dist/esm/routes/auth-forgot-password.js +61 -0
- package/dist/esm/routes/auth-forgot-password.js.map +1 -0
- package/dist/esm/routes/auth-reset-password.js +78 -0
- package/dist/esm/routes/auth-reset-password.js.map +1 -0
- package/dist/esm/routes/auth-signin.js +34 -0
- package/dist/esm/routes/auth-signin.js.map +1 -0
- package/dist/esm/routes/auth-signout.js +46 -0
- package/dist/esm/routes/auth-signout.js.map +1 -0
- package/dist/esm/routes/auth-signup.js +126 -0
- package/dist/esm/routes/auth-signup.js.map +1 -0
- package/dist/esm/routes/auth-state.js +13 -0
- package/dist/esm/routes/auth-state.js.map +1 -0
- package/dist/esm/routes/auth-update.js +115 -0
- package/dist/esm/routes/auth-update.js.map +1 -0
- package/dist/esm/routes/auth-verify-email.js +52 -0
- package/dist/esm/routes/auth-verify-email.js.map +1 -0
- package/dist/esm/routes/auth.js +51 -0
- package/dist/esm/routes/auth.js.map +1 -0
- package/dist/esm/routes/data-exists.js +21 -0
- package/dist/esm/routes/data-exists.js.map +1 -0
- package/dist/esm/routes/data-export.js +36 -0
- package/dist/esm/routes/data-export.js.map +1 -0
- package/dist/esm/routes/data-get.js +53 -0
- package/dist/esm/routes/data-get.js.map +1 -0
- package/dist/esm/routes/data-import.js +42 -0
- package/dist/esm/routes/data-import.js.map +1 -0
- package/dist/esm/routes/data-index-create.js +31 -0
- package/dist/esm/routes/data-index-create.js.map +1 -0
- package/dist/esm/routes/data-index-delete.js +23 -0
- package/dist/esm/routes/data-index-delete.js.map +1 -0
- package/dist/esm/routes/data-index-list.js +22 -0
- package/dist/esm/routes/data-index-list.js.map +1 -0
- package/dist/esm/routes/data-query.js +57 -0
- package/dist/esm/routes/data-query.js.map +1 -0
- package/dist/esm/routes/data-reflect.js +76 -0
- package/dist/esm/routes/data-reflect.js.map +1 -0
- package/dist/esm/routes/data-schema-get.js +26 -0
- package/dist/esm/routes/data-schema-get.js.map +1 -0
- package/dist/esm/routes/data-schema-set.js +20 -0
- package/dist/esm/routes/data-schema-set.js.map +1 -0
- package/dist/esm/routes/data-schema-test.js +32 -0
- package/dist/esm/routes/data-schema-test.js.map +1 -0
- package/dist/esm/routes/data-schemas-list.js +22 -0
- package/dist/esm/routes/data-schemas-list.js.map +1 -0
- package/dist/esm/routes/data-set.js +57 -0
- package/dist/esm/routes/data-set.js.map +1 -0
- package/dist/esm/routes/data-sync-changes.js +54 -0
- package/dist/esm/routes/data-sync-changes.js.map +1 -0
- package/dist/esm/routes/data-sync-mutations.js +54 -0
- package/dist/esm/routes/data-sync-mutations.js.map +1 -0
- package/dist/esm/routes/data-transaction.js +104 -0
- package/dist/esm/routes/data-transaction.js.map +1 -0
- package/dist/esm/routes/data-update.js +56 -0
- package/dist/esm/routes/data-update.js.map +1 -0
- package/dist/esm/routes/data.js +59 -0
- package/dist/esm/routes/data.js.map +1 -0
- package/dist/esm/routes/docs.js +244 -0
- package/dist/esm/routes/docs.js.map +1 -0
- package/dist/esm/routes/meta-info.js +66 -0
- package/dist/esm/routes/meta-info.js.map +1 -0
- package/dist/esm/routes/meta-ping.js +8 -0
- package/dist/esm/routes/meta-ping.js.map +1 -0
- package/dist/esm/routes/meta-stats.js +15 -0
- package/dist/esm/routes/meta-stats.js.map +1 -0
- package/dist/esm/routes/meta.js +13 -0
- package/dist/esm/routes/meta.js.map +1 -0
- package/dist/esm/routes/oauth2-init.js +39 -0
- package/dist/esm/routes/oauth2-init.js.map +1 -0
- package/dist/esm/routes/oauth2-refresh.js +30 -0
- package/dist/esm/routes/oauth2-refresh.js.map +1 -0
- package/dist/esm/routes/oauth2-signin.js +248 -0
- package/dist/esm/routes/oauth2-signin.js.map +1 -0
- package/dist/esm/routes/webmanager.js +23 -0
- package/dist/esm/routes/webmanager.js.map +1 -0
- package/dist/esm/rules.js +171 -0
- package/dist/esm/rules.js.map +1 -0
- package/dist/esm/schema/user.js +21 -0
- package/dist/esm/schema/user.js.map +1 -0
- package/dist/esm/server.js +344 -0
- package/dist/esm/server.js.map +1 -0
- package/dist/esm/settings/email.js +4 -0
- package/dist/esm/settings/email.js.map +1 -0
- package/dist/esm/settings/index.js +152 -0
- package/dist/esm/settings/index.js.map +1 -0
- package/dist/esm/shared/clients.js +23 -0
- package/dist/esm/shared/clients.js.map +1 -0
- package/dist/esm/shared/email.js +6 -0
- package/dist/esm/shared/email.js.map +1 -0
- package/dist/esm/shared/env.js +4 -0
- package/dist/esm/shared/env.js.map +1 -0
- package/dist/esm/shared/error.js +27 -0
- package/dist/esm/shared/error.js.map +1 -0
- package/dist/esm/shared/http.js +16 -0
- package/dist/esm/shared/http.js.map +1 -0
- package/dist/esm/shared/password.js +39 -0
- package/dist/esm/shared/password.js.map +1 -0
- package/dist/esm/shared/rootpath.js +12 -0
- package/dist/esm/shared/rootpath.js.map +1 -0
- package/dist/esm/shared/signin.js +125 -0
- package/dist/esm/shared/signin.js.map +1 -0
- package/{src/oauth-providers → dist/esm/shared}/simple-fetch.js +7 -10
- package/dist/esm/shared/simple-fetch.js.map +1 -0
- package/dist/esm/shared/tokens.js +72 -0
- package/dist/esm/shared/tokens.js.map +1 -0
- package/dist/esm/shared/validate.js +42 -0
- package/dist/esm/shared/validate.js.map +1 -0
- package/dist/esm/start.js +48 -0
- package/dist/esm/start.js.map +1 -0
- package/dist/esm/test.js +9 -0
- package/dist/esm/test.js.map +1 -0
- package/dist/esm/websocket/index.js +288 -0
- package/dist/esm/websocket/index.js.map +1 -0
- package/dist/esm/websocket/manager.js +12 -0
- package/dist/esm/websocket/manager.js.map +1 -0
- package/dist/esm/websocket/socket.io.js +73 -0
- package/dist/esm/websocket/socket.io.js.map +1 -0
- package/dist/types/auth.d.ts +3 -0
- package/dist/types/cluster.d.ts +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/middleware/404.d.ts +7 -0
- package/dist/types/middleware/cache.d.ts +3 -0
- package/dist/types/middleware/connection.d.ts +7 -0
- package/dist/types/middleware/context.d.ts +3 -0
- package/dist/types/middleware/cors.d.ts +25 -0
- package/dist/types/middleware/swagger.d.ts +3 -0
- package/dist/types/middleware/user.d.ts +2 -0
- package/dist/types/oauth-providers/dropbox.d.ts +63 -0
- package/dist/types/oauth-providers/facebook.d.ts +45 -0
- package/dist/types/oauth-providers/google.d.ts +47 -0
- package/dist/types/oauth-providers/index.d.ts +18 -0
- package/dist/types/oauth-providers/instagram.d.ts +54 -0
- package/dist/types/oauth-providers/oauth-provider.d.ts +70 -0
- package/dist/types/oauth-providers/spotify.d.ts +57 -0
- package/dist/types/routes/auth-change-password.d.ts +20 -0
- package/dist/types/routes/auth-delete.d.ts +16 -0
- package/dist/types/routes/auth-forgot-password.d.ts +16 -0
- package/dist/types/routes/auth-reset-password.d.ts +23 -0
- package/dist/types/routes/auth-signin.d.ts +24 -0
- package/dist/types/routes/auth-signout.d.ts +14 -0
- package/dist/types/routes/auth-signup.d.ts +32 -0
- package/dist/types/routes/auth-state.d.ts +13 -0
- package/dist/types/routes/auth-update.d.ts +33 -0
- package/dist/types/routes/auth-verify-email.d.ts +21 -0
- package/dist/types/routes/auth.d.ts +6 -0
- package/dist/types/routes/data-exists.d.ts +9 -0
- package/dist/types/routes/data-export.d.ts +10 -0
- package/dist/types/routes/data-get.d.ts +14 -0
- package/dist/types/routes/data-import.d.ts +13 -0
- package/dist/types/routes/data-index-create.d.ts +51 -0
- package/dist/types/routes/data-index-delete.d.ts +17 -0
- package/dist/types/routes/data-index-list.d.ts +21 -0
- package/dist/types/routes/data-query.d.ts +49 -0
- package/dist/types/routes/data-reflect.d.ts +29 -0
- package/dist/types/routes/data-schema-get.d.ts +11 -0
- package/dist/types/routes/data-schema-set.d.ts +19 -0
- package/dist/types/routes/data-schema-test.d.ts +21 -0
- package/dist/types/routes/data-schemas-list.d.ts +11 -0
- package/dist/types/routes/data-set.d.ts +27 -0
- package/dist/types/routes/data-sync-changes.d.ts +28 -0
- package/dist/types/routes/data-sync-mutations.d.ts +28 -0
- package/dist/types/routes/data-transaction.d.ts +34 -0
- package/dist/types/routes/data-update.d.ts +27 -0
- package/dist/types/routes/data.d.ts +3 -0
- package/dist/types/routes/docs.d.ts +3 -0
- package/dist/types/routes/meta-info.d.ts +11 -0
- package/dist/types/routes/meta-ping.d.ts +7 -0
- package/dist/types/routes/meta-stats.d.ts +13 -0
- package/dist/types/routes/meta.d.ts +3 -0
- package/dist/types/routes/oauth2-init.d.ts +13 -0
- package/dist/types/routes/oauth2-refresh.d.ts +17 -0
- package/dist/types/routes/oauth2-signin.d.ts +15 -0
- package/dist/types/routes/webmanager.d.ts +3 -0
- package/dist/types/rules.d.ts +41 -0
- package/dist/types/schema/user.d.ts +85 -0
- package/dist/types/server.d.ts +106 -0
- package/dist/types/settings/email.d.ts +14 -0
- package/dist/types/settings/index.d.ts +165 -0
- package/dist/types/shared/clients.d.ts +44 -0
- package/dist/types/shared/email.d.ts +34 -0
- package/dist/types/shared/env.d.ts +42 -0
- package/dist/types/shared/error.d.ts +15 -0
- package/dist/types/shared/http.d.ts +14 -0
- package/dist/types/shared/password.d.ts +19 -0
- package/dist/types/shared/rootpath.d.ts +2 -0
- package/dist/types/shared/signin.d.ts +31 -0
- package/dist/types/shared/simple-fetch.d.ts +21 -0
- package/dist/types/shared/tokens.d.ts +23 -0
- package/dist/types/shared/validate.d.ts +22 -0
- package/dist/types/start.d.ts +1 -0
- package/dist/types/test.d.ts +1 -0
- package/dist/types/websocket/index.d.ts +2 -0
- package/dist/types/websocket/manager.d.ts +99 -0
- package/dist/types/websocket/socket.io.d.ts +10 -0
- package/package.json +26 -10
- package/src/auth.ts +87 -0
- package/src/cluster.ts +62 -0
- package/src/index.ts +2 -0
- package/src/middleware/404.ts +13 -0
- package/src/middleware/cache.ts +15 -0
- package/src/middleware/connection.ts +48 -0
- package/src/middleware/context.ts +23 -0
- package/src/middleware/cors.ts +49 -0
- package/src/middleware/swagger.ts +19 -0
- package/src/middleware/user.ts +51 -0
- package/src/{ts/oauth-providers → oauth-providers}/dropbox.ts +1 -1
- package/src/{ts/oauth-providers → oauth-providers}/facebook.ts +1 -1
- package/src/{ts/oauth-providers → oauth-providers}/google.ts +1 -1
- package/src/oauth-providers/index.ts +20 -0
- package/src/{ts/oauth-providers → oauth-providers}/instagram.ts +1 -1
- package/src/{ts/oauth-providers → oauth-providers}/oauth-provider.ts +0 -0
- package/src/{ts/oauth-providers → oauth-providers}/spotify.ts +1 -1
- package/src/routes/auth-change-password.ts +89 -0
- package/src/{ts/routes → routes}/auth-change-password.yaml +3 -4
- package/src/routes/auth-delete.ts +47 -0
- package/src/{ts/routes → routes}/auth-delete.yaml +3 -2
- package/src/routes/auth-forgot-password.ts +73 -0
- package/src/{ts/routes → routes}/auth-forgot-password.yaml +3 -2
- package/src/routes/auth-reset-password.ts +93 -0
- package/src/{ts/routes → routes}/auth-reset-password.yaml +3 -2
- package/src/routes/auth-signin.ts +55 -0
- package/src/{ts/routes → routes}/auth-signin.yaml +8 -7
- package/src/routes/auth-signout.ts +61 -0
- package/src/{ts/routes → routes}/auth-signout.yaml +4 -3
- package/src/routes/auth-signup.ts +161 -0
- package/src/{ts/routes → routes}/auth-signup.yaml +18 -2
- package/src/routes/auth-state.ts +20 -0
- package/src/{ts/routes → routes}/auth-state.yaml +3 -2
- package/src/routes/auth-update.ts +147 -0
- package/src/{ts/routes → routes}/auth-update.yaml +25 -4
- package/src/routes/auth-verify-email.ts +67 -0
- package/src/{ts/routes → routes}/auth-verify-email.yaml +3 -2
- package/src/routes/auth.ts +67 -0
- package/src/routes/data-exists.ts +31 -0
- package/src/routes/data-exists.yaml +44 -0
- package/src/routes/data-export.ts +51 -0
- package/src/routes/data-export.yaml +64 -0
- package/src/routes/data-get.ts +68 -0
- package/src/routes/data-get.yaml +54 -0
- package/src/routes/data-import.ts +56 -0
- package/src/routes/data-import.yaml +75 -0
- package/src/routes/data-index-create.ts +85 -0
- package/src/routes/data-index-create.yaml +105 -0
- package/src/routes/data-index-delete.ts +39 -0
- package/src/routes/data-index-delete.yaml +51 -0
- package/src/routes/data-index-list.ts +42 -0
- package/src/routes/data-index-list.yaml +80 -0
- package/src/routes/data-query.ts +97 -0
- package/src/routes/data-query.yaml +166 -0
- package/src/routes/data-reflect.ts +94 -0
- package/src/routes/data-reflect.yaml +124 -0
- package/src/routes/data-schema-get.ts +38 -0
- package/src/routes/data-schema-get.yaml +53 -0
- package/src/routes/data-schema-set.ts +38 -0
- package/src/routes/data-schema-set.yaml +60 -0
- package/src/routes/data-schema-test.ts +53 -0
- package/src/routes/data-schema-test.yaml +66 -0
- package/src/routes/data-schemas-list.ts +33 -0
- package/src/routes/data-schemas-list.yaml +41 -0
- package/src/routes/data-set.ts +76 -0
- package/src/routes/data-set.yaml +71 -0
- package/src/routes/data-sync-changes.ts +78 -0
- package/src/routes/data-sync-changes.yaml +67 -0
- package/src/routes/data-sync-mutations.ts +78 -0
- package/src/routes/data-sync-mutations.yaml +67 -0
- package/src/routes/data-transaction-finish.yaml +76 -0
- package/src/routes/data-transaction-start.yaml +58 -0
- package/src/routes/data-transaction.ts +144 -0
- package/src/routes/data-update.ts +77 -0
- package/src/routes/data-update.yaml +71 -0
- package/src/routes/data.ts +79 -0
- package/src/routes/docs.ts +249 -0
- package/src/routes/meta-info.ts +80 -0
- package/src/routes/meta-info.yaml +41 -0
- package/src/routes/meta-ping.ts +15 -0
- package/src/routes/meta-ping.yaml +23 -0
- package/src/routes/meta-stats.ts +31 -0
- package/src/routes/meta-stats.yaml +41 -0
- package/src/routes/meta.ts +18 -0
- package/src/routes/oauth2-init.ts +44 -0
- package/src/routes/oauth2-init.yaml +63 -0
- package/src/routes/oauth2-refresh.ts +39 -0
- package/src/routes/oauth2-refresh.yaml +65 -0
- package/src/routes/oauth2-signin.ts +281 -0
- package/src/routes/oauth2-signin.yaml +66 -0
- package/src/routes/webmanager.ts +29 -0
- package/src/rules.ts +196 -0
- package/src/schema/user.ts +99 -0
- package/src/server.ts +416 -0
- package/src/settings/email.ts +18 -0
- package/src/settings/index.ts +240 -0
- package/src/shared/clients.ts +31 -0
- package/src/shared/email.ts +33 -0
- package/src/shared/env.ts +38 -0
- package/src/shared/error.ts +37 -0
- package/src/shared/http.ts +24 -0
- package/src/shared/password.ts +41 -0
- package/src/shared/rootpath.ts +15 -0
- package/src/shared/signin.ts +143 -0
- package/src/{ts/oauth-providers → shared}/simple-fetch.ts +2 -2
- package/src/shared/tokens.ts +77 -0
- package/src/shared/validate.ts +53 -0
- package/src/{start.js → start.ts} +7 -5
- package/src/test.ts +10 -0
- package/src/websocket/index.ts +320 -0
- package/src/websocket/manager.ts +46 -0
- package/src/websocket/socket.io.ts +91 -0
- package/tsconfig-cjs.json +10 -0
- package/tsconfig.json +13 -5
- package/{src/webmanager → webmanager}/index.html +0 -0
- package/{src/webmanager → webmanager}/index.js +0 -0
- package/src/acebase-server.js +0 -3056
- package/src/index.d.ts +0 -212
- package/src/index.js +0 -2
- package/src/routes/docs.js +0 -90
- package/src/ts/routes/docs.ts +0 -93
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/transaction/{dbname}/start:
|
|
2
|
+
post:
|
|
3
|
+
tags:
|
|
4
|
+
- data
|
|
5
|
+
summary: Starts a transaction on a path
|
|
6
|
+
description: Starts a transaction on a path in the database by returning its current value, locking it until the _finish_ endpoint is called. NOTE this API endpoint is also available through the websocket connection, which is the preferred method. This API endpoint is provided for clients not supporting websockets, and those that don't have a websocket connection by choice or because of network limitations.
|
|
7
|
+
parameters:
|
|
8
|
+
- name: dbname
|
|
9
|
+
in: path
|
|
10
|
+
description: name of the database
|
|
11
|
+
required: true
|
|
12
|
+
schema:
|
|
13
|
+
type: string
|
|
14
|
+
example: mydb
|
|
15
|
+
- name: AceBase-Context
|
|
16
|
+
in: header
|
|
17
|
+
description: Contextual info about the database operation (must be valid JSON). This info is included in event notifications sent to clients watching data at this or child paths
|
|
18
|
+
schema:
|
|
19
|
+
type: string
|
|
20
|
+
example: {}
|
|
21
|
+
requestBody:
|
|
22
|
+
description: path to start the transaction on
|
|
23
|
+
content:
|
|
24
|
+
'application/json':
|
|
25
|
+
schema:
|
|
26
|
+
type: object
|
|
27
|
+
properties:
|
|
28
|
+
path:
|
|
29
|
+
type: string
|
|
30
|
+
description: database path
|
|
31
|
+
example:
|
|
32
|
+
path: collection/child/property
|
|
33
|
+
responses:
|
|
34
|
+
200:
|
|
35
|
+
description: returns an object with the transaction id, and the current (serialized) value of the given path
|
|
36
|
+
content:
|
|
37
|
+
'application/json':
|
|
38
|
+
schema:
|
|
39
|
+
type: object
|
|
40
|
+
properties:
|
|
41
|
+
id:
|
|
42
|
+
type: string
|
|
43
|
+
description: transaction id
|
|
44
|
+
example: jld2cjxh0000qzrmn831i7rn
|
|
45
|
+
value:
|
|
46
|
+
$ref: '#/components/schemas/SerializedValue'
|
|
47
|
+
403:
|
|
48
|
+
description: Returns a "403 Forbidden" if the signed in user is not allowed to write to the target path
|
|
49
|
+
content:
|
|
50
|
+
'application/json':
|
|
51
|
+
schema:
|
|
52
|
+
$ref: '#/components/schemas/Error'
|
|
53
|
+
500:
|
|
54
|
+
description: An unexpected error occurred
|
|
55
|
+
content:
|
|
56
|
+
'application/json':
|
|
57
|
+
schema:
|
|
58
|
+
$ref: '#/components/schemas/UnexpectedError'
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { SchemaValidationError } from 'acebase';
|
|
2
|
+
import { ID, Transport } from 'acebase-core';
|
|
3
|
+
import { SerializedValue } from 'acebase-core/types/transport';
|
|
4
|
+
import { RouteInitEnvironment, RouteRequest } from '../shared/env';
|
|
5
|
+
import { sendBadRequestError, sendError, sendUnauthorizedError, sendUnexpectedError } from '../shared/error';
|
|
6
|
+
|
|
7
|
+
export const TRANSACTION_TIMEOUT_MS = 10000; // 10s to finish a started transaction
|
|
8
|
+
|
|
9
|
+
export class DataTransactionError extends Error {
|
|
10
|
+
constructor(public code: 'invalid_serialized_value', message: string) {
|
|
11
|
+
super(message);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type ApiTransactionDetails = {
|
|
16
|
+
id: string;
|
|
17
|
+
value: SerializedValue;
|
|
18
|
+
};
|
|
19
|
+
export type StartRequestQuery = null;
|
|
20
|
+
export type StartRequestBody = {
|
|
21
|
+
path: string;
|
|
22
|
+
};
|
|
23
|
+
export type StartResponseBody = ApiTransactionDetails // 200
|
|
24
|
+
| { code: string, message: string } // 403
|
|
25
|
+
| { code: 'unexpected', message: string }; // 500
|
|
26
|
+
export type StartRequest = RouteRequest<any, StartResponseBody, StartRequestBody, StartRequestQuery>;
|
|
27
|
+
|
|
28
|
+
export type FinishRequestQuery = null;
|
|
29
|
+
export type FinishRequestBody = ApiTransactionDetails & { path: string };
|
|
30
|
+
export type FinishResponseBody = 'done' // 200
|
|
31
|
+
| { code: string, message: string } // 400, 403
|
|
32
|
+
| 'transaction not found' // 410
|
|
33
|
+
| string // 500
|
|
34
|
+
|
|
35
|
+
export type FinishRequest = RouteRequest<any, FinishResponseBody, FinishRequestBody, FinishRequestQuery>;
|
|
36
|
+
|
|
37
|
+
type Transaction = { id: string; started: number; path: string; context: any; finish?: (val?: any) => Promise<any>; timeout: NodeJS.Timeout };
|
|
38
|
+
|
|
39
|
+
export const addRoutes = (env: RouteInitEnvironment) => {
|
|
40
|
+
|
|
41
|
+
const _transactions = new Map<string, Transaction>();
|
|
42
|
+
|
|
43
|
+
// Start transaction endpoint:
|
|
44
|
+
env.app.post(`/transaction/${env.db.name}/start`, (req: StartRequest, res) => {
|
|
45
|
+
const data = req.body;
|
|
46
|
+
const access = env.rules.userHasAccess(req.user, data.path, true);
|
|
47
|
+
if (!access.allow) {
|
|
48
|
+
return sendUnauthorizedError(res, access.code, access.message);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Start transaction
|
|
52
|
+
const tx: Transaction = {
|
|
53
|
+
id: ID.generate(),
|
|
54
|
+
started: Date.now(),
|
|
55
|
+
path: data.path,
|
|
56
|
+
context: req.context,
|
|
57
|
+
finish: undefined,
|
|
58
|
+
timeout: setTimeout(() => {
|
|
59
|
+
_transactions.delete(tx.id);
|
|
60
|
+
tx.finish(); // Finish without value cancels the transaction
|
|
61
|
+
}, TRANSACTION_TIMEOUT_MS)
|
|
62
|
+
};
|
|
63
|
+
_transactions.set(tx.id, tx);
|
|
64
|
+
|
|
65
|
+
try {
|
|
66
|
+
env.debug.verbose(`Transaction ${tx.id} starting...`);
|
|
67
|
+
|
|
68
|
+
// const ref = db.ref(tx.path);
|
|
69
|
+
const donePromise = env.db.api.transaction(tx.path, val => {
|
|
70
|
+
env.debug.verbose(`Transaction ${tx.id} started with value: `, val);
|
|
71
|
+
const currentValue = Transport.serialize(val);
|
|
72
|
+
const promise = new Promise((resolve) => {
|
|
73
|
+
tx.finish = (val: any) => {
|
|
74
|
+
env.debug.verbose(`Transaction ${tx.id} finishing with value: `, val);
|
|
75
|
+
_transactions.delete(tx.id);
|
|
76
|
+
resolve(val);
|
|
77
|
+
return donePromise;
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
res.send({ id: tx.id, value: currentValue });
|
|
81
|
+
return promise;
|
|
82
|
+
}, { context: tx.context });
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
env.debug.error(`failed to start transaction on "${tx.path}":`, err);
|
|
86
|
+
env.logRef?.push({ action: 'tx_start', success: false, code: err.code ?? 'unknown_error', path: tx.path, error: err.message, ip: req.ip, uid: req.user?.uid ?? null });
|
|
87
|
+
sendUnexpectedError(res, err);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// Finish transaction endpoint:
|
|
92
|
+
env.app.post(`/transaction/${env.db.name}/finish`, async (req: FinishRequest, res) => {
|
|
93
|
+
const data = req.body;
|
|
94
|
+
|
|
95
|
+
const tx = _transactions.get(data.id);
|
|
96
|
+
if (!tx || tx.path !== data.path) {
|
|
97
|
+
res.statusCode = 410; // Gone
|
|
98
|
+
res.send(`transaction not found`);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
clearTimeout(tx.timeout);
|
|
102
|
+
_transactions.delete(tx.id);
|
|
103
|
+
|
|
104
|
+
const access = env.rules.userHasAccess(req.user, tx.path, true);
|
|
105
|
+
if (!access.allow) {
|
|
106
|
+
return sendUnauthorizedError(res, access.code, access.message);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Finish transaction
|
|
110
|
+
try {
|
|
111
|
+
if (typeof data.value?.val === 'undefined' || !['string','object','undefined'].includes(typeof data.value?.map)) {
|
|
112
|
+
throw new DataTransactionError('invalid_serialized_value', 'The sent value is not properly serialized');
|
|
113
|
+
}
|
|
114
|
+
const newValue = Transport.deserialize(data.value);
|
|
115
|
+
|
|
116
|
+
if (tx.path === '' && req.user?.uid !== 'admin' && newValue !== null && typeof newValue === 'object') {
|
|
117
|
+
// Non-admin user: remove any private properties from the update object
|
|
118
|
+
Object.keys(newValue).filter(key => key.startsWith('__')).forEach(key => delete newValue[key]);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
await tx.finish(newValue);
|
|
122
|
+
res.send('done');
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
tx.finish(); // Finish without value cancels the transaction
|
|
126
|
+
if (err instanceof SchemaValidationError) {
|
|
127
|
+
env.logRef?.push({ action: 'tx_finish', success: false, code: 'schema_validation_failed', path: tx.path, error: err.reason, ip: req.ip, uid: req.user?.uid ?? null });
|
|
128
|
+
res.status(422).send({ code: 'schema_validation_failed', message: err.message });
|
|
129
|
+
}
|
|
130
|
+
else if (err instanceof DataTransactionError) {
|
|
131
|
+
env.logRef?.push({ action: 'tx_finish', success: false, code: err.code, path: tx.path, ip: req.ip, uid: req.user?.uid ?? null });
|
|
132
|
+
sendBadRequestError(res, err);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
env.debug.error(`failed to finsih transaction on "${tx.path}":`, err);
|
|
136
|
+
env.logRef?.push({ action: 'tx_finish', success: false, code: 'unknown_error', path: tx.path, error: err.message, ip: req.ip, uid: req.user?.uid ?? null });
|
|
137
|
+
sendError(res, err);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export default addRoutes;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { SchemaValidationError } from 'acebase';
|
|
2
|
+
import { Transport } from 'acebase-core';
|
|
3
|
+
import { SerializedValue } from 'acebase-core/types/transport';
|
|
4
|
+
import { RuleValidationFailCode } from '../rules';
|
|
5
|
+
import { RouteInitEnvironment, RouteRequest } from '../shared/env';
|
|
6
|
+
import { sendBadRequestError, sendError, sendUnauthorizedError } from '../shared/error';
|
|
7
|
+
|
|
8
|
+
export class UpdateDataError extends Error {
|
|
9
|
+
constructor(public code: 'invalid_serialized_value', message: string) {
|
|
10
|
+
super(message);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type RequestQuery = null;
|
|
15
|
+
export type RequestBody = SerializedValue; //{ val: any; map?: string|Record<string, 'date'|'binary'|'reference'|'regexp'|'array'> };
|
|
16
|
+
export type ResponseBody = { success: true } // 200
|
|
17
|
+
| { code: 'invalid_serialized_value', message: string } // 400
|
|
18
|
+
| { code: RuleValidationFailCode, message: string } // 403
|
|
19
|
+
| { code: 'schema_validation_failed', message: string } // 422
|
|
20
|
+
| { code: string, message: string } // 500
|
|
21
|
+
|
|
22
|
+
export type Request = RouteRequest<any, ResponseBody, RequestBody, RequestQuery>;
|
|
23
|
+
|
|
24
|
+
export const addRoute = (env: RouteInitEnvironment) => {
|
|
25
|
+
|
|
26
|
+
env.app.post(`/data/${env.db.name}/*`, async (req: Request, res) => {
|
|
27
|
+
// update data
|
|
28
|
+
const path = req.path.slice(env.db.name.length + 7);
|
|
29
|
+
const access = env.rules.userHasAccess(req.user, path, true);
|
|
30
|
+
if (!access.allow) {
|
|
31
|
+
return sendUnauthorizedError(res, access.code, access.message);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
const data = req.body;
|
|
36
|
+
if (typeof data?.val === 'undefined' || !['string','object','undefined'].includes(typeof data?.map)) {
|
|
37
|
+
throw new UpdateDataError('invalid_serialized_value', 'The sent value is not properly serialized');
|
|
38
|
+
}
|
|
39
|
+
const val = Transport.deserialize(data);
|
|
40
|
+
|
|
41
|
+
if (path === '' && req.user?.uid !== 'admin' && val !== null && typeof val === 'object') {
|
|
42
|
+
// Non-admin user: remove any private properties from the update object
|
|
43
|
+
Object.keys(val).filter(key => key.startsWith('__')).forEach(key => delete val[key]);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Schema validation moved to storage, no need to check here but an early check won't do no harm!
|
|
47
|
+
const validation = await env.db.schema.check(path, val, true);
|
|
48
|
+
if (!validation.ok) {
|
|
49
|
+
throw new SchemaValidationError(validation.reason);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
await env.db.ref(path)
|
|
53
|
+
.context(req.context)
|
|
54
|
+
.update(val);
|
|
55
|
+
|
|
56
|
+
res.send({ success: true });
|
|
57
|
+
}
|
|
58
|
+
catch(err) {
|
|
59
|
+
if (err instanceof SchemaValidationError) {
|
|
60
|
+
env.logRef?.push({ action: 'update_data', success: false, code: 'schema_validation_failed', path, error: err.reason, ip: req.ip, uid: req.user?.uid ?? null });
|
|
61
|
+
res.status(422).send({ code: 'schema_validation_failed', message: err.message });
|
|
62
|
+
}
|
|
63
|
+
else if (err instanceof UpdateDataError) {
|
|
64
|
+
env.logRef?.push({ action: 'update_data', success: false, code: err.code, path, ip: req.ip, uid: req.user?.uid ?? null });
|
|
65
|
+
sendBadRequestError(res, err);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
env.debug.error(`failed to update "${path}":`, err);
|
|
69
|
+
env.logRef?.push({ action: 'update_data', success: false, code: `unknown_error`, path, error: err.message, ip: req.ip, uid: req.user?.uid ?? null });
|
|
70
|
+
sendError(res, err);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export default addRoute;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/data/{dbname}/{path}:
|
|
2
|
+
post:
|
|
3
|
+
tags:
|
|
4
|
+
- data
|
|
5
|
+
summary: Update the value of a path
|
|
6
|
+
description: Updates the stored value of a path in the database. If the value is an object, only the given properties are overwritten
|
|
7
|
+
parameters:
|
|
8
|
+
- name: dbname
|
|
9
|
+
in: path
|
|
10
|
+
description: name of the database
|
|
11
|
+
required: true
|
|
12
|
+
schema:
|
|
13
|
+
type: string
|
|
14
|
+
example: mydb
|
|
15
|
+
- name: path
|
|
16
|
+
in: path
|
|
17
|
+
description: database path
|
|
18
|
+
required: true
|
|
19
|
+
schema:
|
|
20
|
+
type: string
|
|
21
|
+
example: collection/child/property
|
|
22
|
+
- name: AceBase-Context
|
|
23
|
+
in: header
|
|
24
|
+
description: Contextual info about the database operation (must be valid JSON). This info is included in event notifications sent to clients watching data at this or child paths
|
|
25
|
+
schema:
|
|
26
|
+
type: string
|
|
27
|
+
example: {}
|
|
28
|
+
requestBody:
|
|
29
|
+
description: serialized value to store in the database
|
|
30
|
+
content:
|
|
31
|
+
'application/json':
|
|
32
|
+
schema:
|
|
33
|
+
$ref: '#/components/schemas/SerializedValue'
|
|
34
|
+
responses:
|
|
35
|
+
200:
|
|
36
|
+
description: Returns "200 OK" when the database operation succeeded
|
|
37
|
+
content:
|
|
38
|
+
'application/json':
|
|
39
|
+
schema:
|
|
40
|
+
type: object
|
|
41
|
+
properties:
|
|
42
|
+
success:
|
|
43
|
+
type: boolean
|
|
44
|
+
example: true
|
|
45
|
+
400:
|
|
46
|
+
description: Returns "400 Bad Request" if the sent value is incorrect
|
|
47
|
+
content:
|
|
48
|
+
'application/json':
|
|
49
|
+
schema:
|
|
50
|
+
$ref: '#/components/schemas/Error'
|
|
51
|
+
example:
|
|
52
|
+
code: invalid_serialized_value
|
|
53
|
+
message: The sent value is not properly serialized
|
|
54
|
+
403:
|
|
55
|
+
description: Returns "403 Forbidden" if the signed in user is not allowed to write to the target path
|
|
56
|
+
content:
|
|
57
|
+
'application/json':
|
|
58
|
+
schema:
|
|
59
|
+
$ref: '#/components/schemas/Error'
|
|
60
|
+
422:
|
|
61
|
+
description: Returns "422 Unprocessable Entity" if schema validation for the sent value failed.
|
|
62
|
+
content:
|
|
63
|
+
'application/json':
|
|
64
|
+
schema:
|
|
65
|
+
$ref: '#/components/schemas/SchemaValidationError'
|
|
66
|
+
500:
|
|
67
|
+
description: An unexpected error occurred
|
|
68
|
+
content:
|
|
69
|
+
'application/json':
|
|
70
|
+
schema:
|
|
71
|
+
$ref: '#/components/schemas/UnexpectedError'
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { RouteInitEnvironment } from "../shared/env";
|
|
2
|
+
import addContextMiddleware from "../middleware/context";
|
|
3
|
+
import addGetDataRoute from './data-get';
|
|
4
|
+
import addUpdateDataRoute from './data-update';
|
|
5
|
+
import addSetDataRoute from './data-set';
|
|
6
|
+
import addTransactionRoutes from './data-transaction';
|
|
7
|
+
import addExistsRoute from './data-exists';
|
|
8
|
+
import addReflectRoute from './data-reflect';
|
|
9
|
+
import addImportDataRoute from './data-import';
|
|
10
|
+
import addExportDataRoute from './data-export';
|
|
11
|
+
import addQueryRoute from './data-query';
|
|
12
|
+
|
|
13
|
+
// Indexes:
|
|
14
|
+
import addListIndexesRoute from './data-index-list';
|
|
15
|
+
import addCreateIndexRoute from './data-index-create';
|
|
16
|
+
import addDeleteIndexRoute from './data-index-delete';
|
|
17
|
+
|
|
18
|
+
// Schemas:
|
|
19
|
+
import addListSchemasRoute from './data-schemas-list';
|
|
20
|
+
import addGetSchemaRoute from './data-schema-get';
|
|
21
|
+
import addSetSchemaRoute from './data-schema-set';
|
|
22
|
+
import addTestSchemaRoute from './data-schema-test';
|
|
23
|
+
|
|
24
|
+
// Sycnronization:
|
|
25
|
+
import addSyncMutationsRoute from './data-sync-mutations';
|
|
26
|
+
import addSyncChangesRoute from './data-sync-changes';
|
|
27
|
+
|
|
28
|
+
export const addRoutes = (env: RouteInitEnvironment) => {
|
|
29
|
+
|
|
30
|
+
// Add context middleware that handles AceBase-Context header
|
|
31
|
+
addContextMiddleware(env);
|
|
32
|
+
|
|
33
|
+
// Add get data endpoint
|
|
34
|
+
addGetDataRoute(env);
|
|
35
|
+
|
|
36
|
+
// Add update data endpoint
|
|
37
|
+
addUpdateDataRoute(env);
|
|
38
|
+
|
|
39
|
+
// Add set data endpoint
|
|
40
|
+
addSetDataRoute(env);
|
|
41
|
+
|
|
42
|
+
// add transaction routes (start & finish)
|
|
43
|
+
addTransactionRoutes(env);
|
|
44
|
+
|
|
45
|
+
// Add exists endpoint
|
|
46
|
+
addExistsRoute(env);
|
|
47
|
+
|
|
48
|
+
// Add reflect endpoint
|
|
49
|
+
addReflectRoute(env);
|
|
50
|
+
|
|
51
|
+
// Add import endpoint
|
|
52
|
+
addImportDataRoute(env);
|
|
53
|
+
|
|
54
|
+
// Add export endpoint
|
|
55
|
+
addExportDataRoute(env);
|
|
56
|
+
|
|
57
|
+
// Add query endpoint
|
|
58
|
+
addQueryRoute(env);
|
|
59
|
+
|
|
60
|
+
// Add index endpoints:
|
|
61
|
+
addListIndexesRoute(env); // list indexes
|
|
62
|
+
addCreateIndexRoute(env); // create index
|
|
63
|
+
addDeleteIndexRoute(env); // delete index
|
|
64
|
+
|
|
65
|
+
// Add schema endpoints:
|
|
66
|
+
addListSchemasRoute(env); // list all
|
|
67
|
+
addGetSchemaRoute(env); // get schema
|
|
68
|
+
addSetSchemaRoute(env); // set schema
|
|
69
|
+
addTestSchemaRoute(env); // test
|
|
70
|
+
|
|
71
|
+
// Add sync mutations endpoint
|
|
72
|
+
addSyncMutationsRoute(env);
|
|
73
|
+
|
|
74
|
+
// add sync changes endpoint
|
|
75
|
+
addSyncChangesRoute(env);
|
|
76
|
+
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export default addRoutes;
|