acebase-server 1.15.1 → 1.16.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/.eslintrc.json +49 -0
- package/README.md +10 -0
- package/dist/cjs/auth.js +2 -2
- package/dist/cjs/cluster.js +2 -2
- package/dist/cjs/middleware/cors.js +3 -3
- package/dist/cjs/oauth-providers/dropbox.js +22 -22
- package/dist/cjs/oauth-providers/facebook.js +16 -16
- package/dist/cjs/oauth-providers/google.js +33 -39
- package/dist/cjs/oauth-providers/index.js +1 -1
- package/dist/cjs/oauth-providers/instagram.js +12 -12
- package/dist/cjs/oauth-providers/oauth-provider.js +0 -5
- package/dist/cjs/oauth-providers/spotify.js +34 -34
- package/dist/cjs/routes/auth-change-password.js +5 -5
- package/dist/cjs/routes/auth-delete.js +1 -1
- package/dist/cjs/routes/auth-forgot-password.js +2 -2
- package/dist/cjs/routes/auth-reset-password.js +11 -9
- package/dist/cjs/routes/auth-signin.js +1 -1
- package/dist/cjs/routes/auth-signout.js +1 -1
- package/dist/cjs/routes/auth-signup.js +5 -5
- package/dist/cjs/routes/auth-update.js +1 -1
- package/dist/cjs/routes/auth-verify-email.js +8 -6
- package/dist/cjs/routes/auth.js +1 -1
- package/dist/cjs/routes/data-export.js +1 -1
- package/dist/cjs/routes/data-get.js +2 -2
- package/dist/cjs/routes/data-index-list.js +0 -1
- package/dist/cjs/routes/data-query.js +1 -1
- package/dist/cjs/routes/data-reflect.js +4 -4
- package/dist/cjs/routes/data-schema-get.js +1 -1
- package/dist/cjs/routes/data-schemas-list.js +1 -1
- package/dist/cjs/routes/data-transaction.js +1 -1
- package/dist/cjs/routes/docs.js +57 -54
- package/dist/cjs/routes/meta-info.js +8 -12
- package/dist/cjs/routes/meta-logs.js +1 -1
- package/dist/cjs/routes/oauth2-init.js +8 -5
- package/dist/cjs/routes/oauth2-refresh.js +2 -2
- package/dist/cjs/routes/oauth2-signin.js +23 -23
- package/dist/cjs/routes/webmanager.js +4 -4
- package/dist/cjs/rules.js +8 -8
- package/dist/cjs/schema/user.js +1 -2
- package/dist/cjs/server.js +74 -31
- package/dist/cjs/settings/email.js +0 -2
- package/dist/cjs/settings/index.js +19 -4
- package/dist/cjs/shared/email.js +0 -4
- package/dist/cjs/shared/env.js +0 -2
- package/dist/cjs/shared/error.js +0 -1
- package/dist/cjs/shared/http.js +9 -1
- package/dist/cjs/shared/password.js +5 -5
- package/dist/cjs/shared/rootpath.js +1 -1
- package/dist/cjs/shared/signin.js +3 -3
- package/dist/cjs/shared/simple-fetch.js +5 -5
- package/dist/cjs/shared/tokens.js +3 -3
- package/dist/cjs/start.js +6 -6
- package/dist/cjs/websocket/index.js +11 -11
- package/dist/cjs/websocket/socket.io.js +2 -1
- package/dist/esm/auth.js +5 -5
- package/dist/esm/cluster.js +2 -2
- package/dist/esm/middleware/admin-only.js +1 -1
- package/dist/esm/middleware/cors.js +3 -3
- package/dist/esm/middleware/user.js +3 -3
- package/dist/esm/oauth-providers/dropbox.js +47 -51
- package/dist/esm/oauth-providers/facebook.js +34 -38
- package/dist/esm/oauth-providers/google.js +33 -39
- package/dist/esm/oauth-providers/index.js +1 -1
- package/dist/esm/oauth-providers/instagram.js +28 -32
- package/dist/esm/oauth-providers/oauth-provider.js +0 -5
- package/dist/esm/oauth-providers/spotify.js +46 -52
- package/dist/esm/routes/auth-change-password.js +5 -5
- package/dist/esm/routes/auth-delete.js +1 -1
- package/dist/esm/routes/auth-forgot-password.js +2 -2
- package/dist/esm/routes/auth-reset-password.js +11 -9
- package/dist/esm/routes/auth-signin.js +1 -1
- package/dist/esm/routes/auth-signout.js +1 -1
- package/dist/esm/routes/auth-signup.js +5 -5
- package/dist/esm/routes/auth-update.js +1 -1
- package/dist/esm/routes/auth-verify-email.js +8 -6
- package/dist/esm/routes/auth.js +1 -1
- package/dist/esm/routes/data-export.js +1 -1
- package/dist/esm/routes/data-get.js +2 -2
- package/dist/esm/routes/data-index-list.js +0 -1
- package/dist/esm/routes/data-query.js +1 -1
- package/dist/esm/routes/data-reflect.js +4 -4
- package/dist/esm/routes/data-schema-get.js +1 -1
- package/dist/esm/routes/data-schemas-list.js +1 -1
- package/dist/esm/routes/data-transaction.js +1 -1
- package/dist/esm/routes/data.js +1 -1
- package/dist/esm/routes/docs.js +56 -54
- package/dist/esm/routes/meta-info.js +8 -12
- package/dist/esm/routes/meta-logs.js +1 -1
- package/dist/esm/routes/oauth2-init.js +8 -5
- package/dist/esm/routes/oauth2-refresh.js +2 -2
- package/dist/esm/routes/oauth2-signin.js +20 -20
- package/dist/esm/routes/webmanager.js +5 -5
- package/dist/esm/rules.js +8 -8
- package/dist/esm/schema/user.js +1 -2
- package/dist/esm/server.js +72 -30
- package/dist/esm/settings/email.js +0 -2
- package/dist/esm/settings/index.js +19 -4
- package/dist/esm/shared/email.js +0 -4
- package/dist/esm/shared/env.js +0 -2
- package/dist/esm/shared/error.js +0 -1
- package/dist/esm/shared/http.js +7 -0
- package/dist/esm/shared/password.js +5 -5
- package/dist/esm/shared/rootpath.js +2 -2
- package/dist/esm/shared/signin.js +6 -6
- package/dist/esm/shared/simple-fetch.js +5 -5
- package/dist/esm/shared/tokens.js +3 -3
- package/dist/esm/start.js +6 -6
- package/dist/esm/websocket/index.js +15 -15
- package/dist/esm/websocket/manager.js +1 -1
- package/dist/esm/websocket/socket.io.js +2 -1
- package/dist/types/auth.d.ts +1 -1
- package/dist/types/logger.d.ts +1 -1
- package/dist/types/middleware/404.d.ts +1 -1
- package/dist/types/middleware/admin-only.d.ts +3 -3
- package/dist/types/middleware/cache.d.ts +1 -1
- package/dist/types/middleware/context.d.ts +1 -1
- package/dist/types/middleware/cors.d.ts +1 -1
- package/dist/types/middleware/swagger.d.ts +1 -1
- package/dist/types/middleware/user.d.ts +1 -1
- package/dist/types/oauth-providers/dropbox.d.ts +1 -1
- package/dist/types/oauth-providers/facebook.d.ts +1 -1
- package/dist/types/oauth-providers/google.d.ts +1 -1
- package/dist/types/oauth-providers/instagram.d.ts +1 -1
- package/dist/types/oauth-providers/spotify.d.ts +1 -1
- package/dist/types/routes/auth-change-password.d.ts +2 -2
- package/dist/types/routes/auth-delete.d.ts +2 -2
- package/dist/types/routes/auth-forgot-password.d.ts +2 -2
- package/dist/types/routes/auth-reset-password.d.ts +2 -2
- package/dist/types/routes/auth-signin.d.ts +2 -2
- package/dist/types/routes/auth-signout.d.ts +2 -2
- package/dist/types/routes/auth-signup.d.ts +2 -2
- package/dist/types/routes/auth-state.d.ts +3 -3
- package/dist/types/routes/auth-update.d.ts +2 -2
- package/dist/types/routes/auth-verify-email.d.ts +2 -2
- package/dist/types/routes/data-exists.d.ts +1 -1
- package/dist/types/routes/data-export.d.ts +1 -1
- package/dist/types/routes/data-get.d.ts +1 -1
- package/dist/types/routes/data-import.d.ts +1 -1
- package/dist/types/routes/data-index-create.d.ts +2 -2
- package/dist/types/routes/data-index-delete.d.ts +1 -1
- package/dist/types/routes/data-index-list.d.ts +2 -2
- package/dist/types/routes/data-query.d.ts +1 -1
- package/dist/types/routes/data-reflect.d.ts +1 -1
- package/dist/types/routes/data-schema-get.d.ts +1 -1
- package/dist/types/routes/data-schema-set.d.ts +1 -1
- package/dist/types/routes/data-schema-test.d.ts +1 -1
- package/dist/types/routes/data-schemas-list.d.ts +1 -1
- package/dist/types/routes/data-set.d.ts +1 -1
- package/dist/types/routes/data-sync-changes.d.ts +1 -1
- package/dist/types/routes/data-sync-mutations.d.ts +1 -1
- package/dist/types/routes/data-transaction.d.ts +2 -2
- package/dist/types/routes/data-update.d.ts +1 -1
- package/dist/types/routes/data.d.ts +1 -1
- package/dist/types/routes/meta-info.d.ts +1 -1
- package/dist/types/routes/meta-logs.d.ts +1 -1
- package/dist/types/routes/meta-ping.d.ts +1 -1
- package/dist/types/routes/meta-stats.d.ts +1 -1
- package/dist/types/routes/oauth2-init.d.ts +1 -1
- package/dist/types/routes/oauth2-refresh.d.ts +1 -1
- package/dist/types/routes/oauth2-signin.d.ts +1 -1
- package/dist/types/routes/webmanager.d.ts +1 -1
- package/dist/types/schema/user.d.ts +2 -2
- package/dist/types/server.d.ts +3 -0
- package/dist/types/settings/index.d.ts +23 -0
- package/dist/types/shared/clients.d.ts +3 -3
- package/dist/types/shared/env.d.ts +2 -1
- package/dist/types/shared/http.d.ts +5 -0
- package/dist/types/shared/signin.d.ts +4 -4
- package/dist/types/shared/validate.d.ts +1 -1
- package/dist/types/websocket/index.d.ts +1 -1
- package/dist/types/websocket/manager.d.ts +1 -1
- package/img/acebase-swagger-ui.png +0 -0
- package/img/acebase-webmanager.png +0 -0
- package/package.json +9 -4
- package/src/routes/auth-signin.yaml +2 -2
- package/webmanager/acebase-client-browser.min.js +8 -11
- package/webmanager/index.html +1 -0
- package/webmanager/index.js +67 -71
- package/.vscode/launch.json +0 -24
- package/create-package-files +0 -25
- package/dist/cjs/auth.js.map +0 -1
- package/dist/cjs/cluster.js.map +0 -1
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/logger.js.map +0 -1
- package/dist/cjs/middleware/404.js.map +0 -1
- package/dist/cjs/middleware/admin-only.js.map +0 -1
- package/dist/cjs/middleware/cache.js.map +0 -1
- package/dist/cjs/middleware/connection.js.map +0 -1
- package/dist/cjs/middleware/context.js.map +0 -1
- package/dist/cjs/middleware/cors.js.map +0 -1
- package/dist/cjs/middleware/swagger.js.map +0 -1
- package/dist/cjs/middleware/user.js.map +0 -1
- package/dist/cjs/oauth-providers/dropbox.js.map +0 -1
- package/dist/cjs/oauth-providers/facebook.js.map +0 -1
- package/dist/cjs/oauth-providers/google.js.map +0 -1
- package/dist/cjs/oauth-providers/index.js.map +0 -1
- package/dist/cjs/oauth-providers/instagram.js.map +0 -1
- package/dist/cjs/oauth-providers/oauth-provider.js.map +0 -1
- package/dist/cjs/oauth-providers/spotify.js.map +0 -1
- package/dist/cjs/routes/auth-change-password.js.map +0 -1
- package/dist/cjs/routes/auth-delete.js.map +0 -1
- package/dist/cjs/routes/auth-forgot-password.js.map +0 -1
- package/dist/cjs/routes/auth-reset-password.js.map +0 -1
- package/dist/cjs/routes/auth-signin.js.map +0 -1
- package/dist/cjs/routes/auth-signout.js.map +0 -1
- package/dist/cjs/routes/auth-signup.js.map +0 -1
- package/dist/cjs/routes/auth-state.js.map +0 -1
- package/dist/cjs/routes/auth-update.js.map +0 -1
- package/dist/cjs/routes/auth-verify-email.js.map +0 -1
- package/dist/cjs/routes/auth.js.map +0 -1
- package/dist/cjs/routes/data-exists.js.map +0 -1
- package/dist/cjs/routes/data-export.js.map +0 -1
- package/dist/cjs/routes/data-get.js.map +0 -1
- package/dist/cjs/routes/data-import.js.map +0 -1
- package/dist/cjs/routes/data-index-create.js.map +0 -1
- package/dist/cjs/routes/data-index-delete.js.map +0 -1
- package/dist/cjs/routes/data-index-list.js.map +0 -1
- package/dist/cjs/routes/data-query.js.map +0 -1
- package/dist/cjs/routes/data-reflect.js.map +0 -1
- package/dist/cjs/routes/data-schema-get.js.map +0 -1
- package/dist/cjs/routes/data-schema-set.js.map +0 -1
- package/dist/cjs/routes/data-schema-test.js.map +0 -1
- package/dist/cjs/routes/data-schemas-list.js.map +0 -1
- package/dist/cjs/routes/data-set.js.map +0 -1
- package/dist/cjs/routes/data-sync-changes.js.map +0 -1
- package/dist/cjs/routes/data-sync-mutations.js.map +0 -1
- package/dist/cjs/routes/data-transaction.js.map +0 -1
- package/dist/cjs/routes/data-update.js.map +0 -1
- package/dist/cjs/routes/data.js.map +0 -1
- package/dist/cjs/routes/docs.js.map +0 -1
- package/dist/cjs/routes/meta-info.js.map +0 -1
- package/dist/cjs/routes/meta-logs.js.map +0 -1
- package/dist/cjs/routes/meta-ping.js.map +0 -1
- package/dist/cjs/routes/meta-stats.js.map +0 -1
- package/dist/cjs/routes/meta.js.map +0 -1
- package/dist/cjs/routes/oauth2-init.js.map +0 -1
- package/dist/cjs/routes/oauth2-refresh.js.map +0 -1
- package/dist/cjs/routes/oauth2-signin.js.map +0 -1
- package/dist/cjs/routes/webmanager.js.map +0 -1
- package/dist/cjs/rules.js.map +0 -1
- package/dist/cjs/schema/user.js.map +0 -1
- package/dist/cjs/server.js.map +0 -1
- package/dist/cjs/settings/email.js.map +0 -1
- package/dist/cjs/settings/index.js.map +0 -1
- package/dist/cjs/shared/clients.js.map +0 -1
- package/dist/cjs/shared/email.js.map +0 -1
- package/dist/cjs/shared/env.js.map +0 -1
- package/dist/cjs/shared/error.js.map +0 -1
- package/dist/cjs/shared/http.js.map +0 -1
- package/dist/cjs/shared/password.js.map +0 -1
- package/dist/cjs/shared/rootpath.js.map +0 -1
- package/dist/cjs/shared/signin.js.map +0 -1
- package/dist/cjs/shared/simple-fetch.js.map +0 -1
- package/dist/cjs/shared/tokens.js.map +0 -1
- package/dist/cjs/shared/validate.js.map +0 -1
- package/dist/cjs/start.js.map +0 -1
- package/dist/cjs/test.js.map +0 -1
- package/dist/cjs/websocket/index.js.map +0 -1
- package/dist/cjs/websocket/manager.js.map +0 -1
- package/dist/cjs/websocket/socket.io.js.map +0 -1
- package/dist/esm/auth.js.map +0 -1
- package/dist/esm/cluster.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/logger.js.map +0 -1
- package/dist/esm/middleware/404.js.map +0 -1
- package/dist/esm/middleware/admin-only.js.map +0 -1
- package/dist/esm/middleware/cache.js.map +0 -1
- package/dist/esm/middleware/connection.js.map +0 -1
- package/dist/esm/middleware/context.js.map +0 -1
- package/dist/esm/middleware/cors.js.map +0 -1
- package/dist/esm/middleware/swagger.js.map +0 -1
- package/dist/esm/middleware/user.js.map +0 -1
- package/dist/esm/oauth-providers/dropbox.js.map +0 -1
- package/dist/esm/oauth-providers/facebook.js.map +0 -1
- package/dist/esm/oauth-providers/google.js.map +0 -1
- package/dist/esm/oauth-providers/index.js.map +0 -1
- package/dist/esm/oauth-providers/instagram.js.map +0 -1
- package/dist/esm/oauth-providers/oauth-provider.js.map +0 -1
- package/dist/esm/oauth-providers/spotify.js.map +0 -1
- package/dist/esm/routes/auth-change-password.js.map +0 -1
- package/dist/esm/routes/auth-delete.js.map +0 -1
- package/dist/esm/routes/auth-forgot-password.js.map +0 -1
- package/dist/esm/routes/auth-reset-password.js.map +0 -1
- package/dist/esm/routes/auth-signin.js.map +0 -1
- package/dist/esm/routes/auth-signout.js.map +0 -1
- package/dist/esm/routes/auth-signup.js.map +0 -1
- package/dist/esm/routes/auth-state.js.map +0 -1
- package/dist/esm/routes/auth-update.js.map +0 -1
- package/dist/esm/routes/auth-verify-email.js.map +0 -1
- package/dist/esm/routes/auth.js.map +0 -1
- package/dist/esm/routes/data-exists.js.map +0 -1
- package/dist/esm/routes/data-export.js.map +0 -1
- package/dist/esm/routes/data-get.js.map +0 -1
- package/dist/esm/routes/data-import.js.map +0 -1
- package/dist/esm/routes/data-index-create.js.map +0 -1
- package/dist/esm/routes/data-index-delete.js.map +0 -1
- package/dist/esm/routes/data-index-list.js.map +0 -1
- package/dist/esm/routes/data-query.js.map +0 -1
- package/dist/esm/routes/data-reflect.js.map +0 -1
- package/dist/esm/routes/data-schema-get.js.map +0 -1
- package/dist/esm/routes/data-schema-set.js.map +0 -1
- package/dist/esm/routes/data-schema-test.js.map +0 -1
- package/dist/esm/routes/data-schemas-list.js.map +0 -1
- package/dist/esm/routes/data-set.js.map +0 -1
- package/dist/esm/routes/data-sync-changes.js.map +0 -1
- package/dist/esm/routes/data-sync-mutations.js.map +0 -1
- package/dist/esm/routes/data-transaction.js.map +0 -1
- package/dist/esm/routes/data-update.js.map +0 -1
- package/dist/esm/routes/data.js.map +0 -1
- package/dist/esm/routes/docs.js.map +0 -1
- package/dist/esm/routes/meta-info.js.map +0 -1
- package/dist/esm/routes/meta-logs.js.map +0 -1
- package/dist/esm/routes/meta-ping.js.map +0 -1
- package/dist/esm/routes/meta-stats.js.map +0 -1
- package/dist/esm/routes/meta.js.map +0 -1
- package/dist/esm/routes/oauth2-init.js.map +0 -1
- package/dist/esm/routes/oauth2-refresh.js.map +0 -1
- package/dist/esm/routes/oauth2-signin.js.map +0 -1
- package/dist/esm/routes/webmanager.js.map +0 -1
- package/dist/esm/rules.js.map +0 -1
- package/dist/esm/schema/user.js.map +0 -1
- package/dist/esm/server.js.map +0 -1
- package/dist/esm/settings/email.js.map +0 -1
- package/dist/esm/settings/index.js.map +0 -1
- package/dist/esm/shared/clients.js.map +0 -1
- package/dist/esm/shared/email.js.map +0 -1
- package/dist/esm/shared/env.js.map +0 -1
- package/dist/esm/shared/error.js.map +0 -1
- package/dist/esm/shared/http.js.map +0 -1
- package/dist/esm/shared/password.js.map +0 -1
- package/dist/esm/shared/rootpath.js.map +0 -1
- package/dist/esm/shared/signin.js.map +0 -1
- package/dist/esm/shared/simple-fetch.js.map +0 -1
- package/dist/esm/shared/tokens.js.map +0 -1
- package/dist/esm/shared/validate.js.map +0 -1
- package/dist/esm/start.js.map +0 -1
- package/dist/esm/test.js.map +0 -1
- package/dist/esm/websocket/index.js.map +0 -1
- package/dist/esm/websocket/manager.js.map +0 -1
- package/dist/esm/websocket/socket.io.js.map +0 -1
- package/dist/types/auth.d.ts.map +0 -1
- package/dist/types/cluster.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/logger.d.ts.map +0 -1
- package/dist/types/middleware/404.d.ts.map +0 -1
- package/dist/types/middleware/admin-only.d.ts.map +0 -1
- package/dist/types/middleware/cache.d.ts.map +0 -1
- package/dist/types/middleware/connection.d.ts.map +0 -1
- package/dist/types/middleware/context.d.ts.map +0 -1
- package/dist/types/middleware/cors.d.ts.map +0 -1
- package/dist/types/middleware/swagger.d.ts.map +0 -1
- package/dist/types/middleware/user.d.ts.map +0 -1
- package/dist/types/oauth-providers/dropbox.d.ts.map +0 -1
- package/dist/types/oauth-providers/facebook.d.ts.map +0 -1
- package/dist/types/oauth-providers/google.d.ts.map +0 -1
- package/dist/types/oauth-providers/index.d.ts.map +0 -1
- package/dist/types/oauth-providers/instagram.d.ts.map +0 -1
- package/dist/types/oauth-providers/oauth-provider.d.ts.map +0 -1
- package/dist/types/oauth-providers/spotify.d.ts.map +0 -1
- package/dist/types/routes/auth-change-password.d.ts.map +0 -1
- package/dist/types/routes/auth-delete.d.ts.map +0 -1
- package/dist/types/routes/auth-forgot-password.d.ts.map +0 -1
- package/dist/types/routes/auth-reset-password.d.ts.map +0 -1
- package/dist/types/routes/auth-signin.d.ts.map +0 -1
- package/dist/types/routes/auth-signout.d.ts.map +0 -1
- package/dist/types/routes/auth-signup.d.ts.map +0 -1
- package/dist/types/routes/auth-state.d.ts.map +0 -1
- package/dist/types/routes/auth-update.d.ts.map +0 -1
- package/dist/types/routes/auth-verify-email.d.ts.map +0 -1
- package/dist/types/routes/auth.d.ts.map +0 -1
- package/dist/types/routes/data-exists.d.ts.map +0 -1
- package/dist/types/routes/data-export.d.ts.map +0 -1
- package/dist/types/routes/data-get.d.ts.map +0 -1
- package/dist/types/routes/data-import.d.ts.map +0 -1
- package/dist/types/routes/data-index-create.d.ts.map +0 -1
- package/dist/types/routes/data-index-delete.d.ts.map +0 -1
- package/dist/types/routes/data-index-list.d.ts.map +0 -1
- package/dist/types/routes/data-query.d.ts.map +0 -1
- package/dist/types/routes/data-reflect.d.ts.map +0 -1
- package/dist/types/routes/data-schema-get.d.ts.map +0 -1
- package/dist/types/routes/data-schema-set.d.ts.map +0 -1
- package/dist/types/routes/data-schema-test.d.ts.map +0 -1
- package/dist/types/routes/data-schemas-list.d.ts.map +0 -1
- package/dist/types/routes/data-set.d.ts.map +0 -1
- package/dist/types/routes/data-sync-changes.d.ts.map +0 -1
- package/dist/types/routes/data-sync-mutations.d.ts.map +0 -1
- package/dist/types/routes/data-transaction.d.ts.map +0 -1
- package/dist/types/routes/data-update.d.ts.map +0 -1
- package/dist/types/routes/data.d.ts.map +0 -1
- package/dist/types/routes/docs.d.ts.map +0 -1
- package/dist/types/routes/meta-info.d.ts.map +0 -1
- package/dist/types/routes/meta-logs.d.ts.map +0 -1
- package/dist/types/routes/meta-ping.d.ts.map +0 -1
- package/dist/types/routes/meta-stats.d.ts.map +0 -1
- package/dist/types/routes/meta.d.ts.map +0 -1
- package/dist/types/routes/oauth2-init.d.ts.map +0 -1
- package/dist/types/routes/oauth2-refresh.d.ts.map +0 -1
- package/dist/types/routes/oauth2-signin.d.ts.map +0 -1
- package/dist/types/routes/webmanager.d.ts.map +0 -1
- package/dist/types/rules.d.ts.map +0 -1
- package/dist/types/schema/user.d.ts.map +0 -1
- package/dist/types/server.d.ts.map +0 -1
- package/dist/types/settings/email.d.ts.map +0 -1
- package/dist/types/settings/index.d.ts.map +0 -1
- package/dist/types/shared/clients.d.ts.map +0 -1
- package/dist/types/shared/email.d.ts.map +0 -1
- package/dist/types/shared/env.d.ts.map +0 -1
- package/dist/types/shared/error.d.ts.map +0 -1
- package/dist/types/shared/http.d.ts.map +0 -1
- package/dist/types/shared/password.d.ts.map +0 -1
- package/dist/types/shared/rootpath.d.ts.map +0 -1
- package/dist/types/shared/signin.d.ts.map +0 -1
- package/dist/types/shared/simple-fetch.d.ts.map +0 -1
- package/dist/types/shared/tokens.d.ts.map +0 -1
- package/dist/types/shared/validate.d.ts.map +0 -1
- package/dist/types/start.d.ts.map +0 -1
- package/dist/types/test.d.ts.map +0 -1
- package/dist/types/websocket/index.d.ts.map +0 -1
- package/dist/types/websocket/manager.d.ts.map +0 -1
- package/dist/types/websocket/socket.io.d.ts.map +0 -1
- package/src/auth.ts +0 -87
- package/src/cluster.ts +0 -62
- package/src/index.ts +0 -4
- package/src/logger.ts +0 -56
- package/src/middleware/404.ts +0 -13
- package/src/middleware/admin-only.ts +0 -29
- package/src/middleware/cache.ts +0 -15
- package/src/middleware/connection.ts +0 -48
- package/src/middleware/context.ts +0 -23
- package/src/middleware/cors.ts +0 -49
- package/src/middleware/swagger.ts +0 -19
- package/src/middleware/user.ts +0 -51
- package/src/oauth-providers/dropbox.ts +0 -144
- package/src/oauth-providers/facebook.ts +0 -103
- package/src/oauth-providers/google.ts +0 -147
- package/src/oauth-providers/index.ts +0 -21
- package/src/oauth-providers/instagram.ts +0 -98
- package/src/oauth-providers/oauth-provider.ts +0 -65
- package/src/oauth-providers/spotify.ts +0 -127
- package/src/placeholder.d.ts +0 -12
- package/src/routes/auth-change-password.ts +0 -92
- package/src/routes/auth-delete.ts +0 -49
- package/src/routes/auth-forgot-password.ts +0 -77
- package/src/routes/auth-reset-password.ts +0 -96
- package/src/routes/auth-signin.ts +0 -55
- package/src/routes/auth-signout.ts +0 -64
- package/src/routes/auth-signup.ts +0 -164
- package/src/routes/auth-state.ts +0 -20
- package/src/routes/auth-update.ts +0 -149
- package/src/routes/auth-verify-email.ts +0 -75
- package/src/routes/auth.ts +0 -67
- package/src/routes/data-exists.ts +0 -31
- package/src/routes/data-export.ts +0 -51
- package/src/routes/data-get.ts +0 -67
- package/src/routes/data-import.ts +0 -56
- package/src/routes/data-index-create.ts +0 -82
- package/src/routes/data-index-delete.ts +0 -36
- package/src/routes/data-index-list.ts +0 -39
- package/src/routes/data-query.ts +0 -97
- package/src/routes/data-reflect.ts +0 -91
- package/src/routes/data-schema-get.ts +0 -36
- package/src/routes/data-schema-set.ts +0 -35
- package/src/routes/data-schema-test.ts +0 -48
- package/src/routes/data-schemas-list.ts +0 -31
- package/src/routes/data-set.ts +0 -83
- package/src/routes/data-sync-changes.ts +0 -77
- package/src/routes/data-sync-mutations.ts +0 -77
- package/src/routes/data-transaction.ts +0 -166
- package/src/routes/data-update.ts +0 -84
- package/src/routes/data.ts +0 -79
- package/src/routes/docs.ts +0 -249
- package/src/routes/meta-info.ts +0 -80
- package/src/routes/meta-logs.ts +0 -57
- package/src/routes/meta-ping.ts +0 -15
- package/src/routes/meta-stats.ts +0 -31
- package/src/routes/meta.ts +0 -22
- package/src/routes/oauth2-init.ts +0 -44
- package/src/routes/oauth2-refresh.ts +0 -39
- package/src/routes/oauth2-signin.ts +0 -286
- package/src/routes/webmanager.ts +0 -29
- package/src/rules.ts +0 -189
- package/src/schema/user.ts +0 -99
- package/src/server.ts +0 -419
- package/src/settings/email.ts +0 -18
- package/src/settings/index.ts +0 -241
- package/src/shared/clients.ts +0 -31
- package/src/shared/email.ts +0 -33
- package/src/shared/env.ts +0 -38
- package/src/shared/error.ts +0 -37
- package/src/shared/http.ts +0 -26
- package/src/shared/password.ts +0 -41
- package/src/shared/rootpath.ts +0 -17
- package/src/shared/signin.ts +0 -149
- package/src/shared/simple-fetch.ts +0 -65
- package/src/shared/tokens.ts +0 -77
- package/src/shared/validate.ts +0 -53
- package/src/start.ts +0 -48
- package/src/test.ts +0 -10
- package/src/websocket/index.ts +0 -336
- package/src/websocket/manager.ts +0 -46
- package/src/websocket/socket.io.ts +0 -90
- package/tsconfig-cjs.json +0 -11
- package/tsconfig.json +0 -22
package/dist/esm/routes/docs.js
CHANGED
|
@@ -18,36 +18,38 @@ export const addRoute = (env) => {
|
|
|
18
18
|
contact: {
|
|
19
19
|
name: 'AceBase API Support',
|
|
20
20
|
email: 'me@appy.one',
|
|
21
|
-
url: 'https://github.com/appy-one/acebase-server'
|
|
21
|
+
url: 'https://github.com/appy-one/acebase-server',
|
|
22
22
|
},
|
|
23
|
-
// servers: [`http://${config.server.host}:${config.server.port}`]
|
|
24
23
|
},
|
|
24
|
+
servers: [
|
|
25
|
+
{ url: `http${env.config.https?.enabled ? 's' : ''}://${env.config.host}:${env.config.port}${env.config.rootPath ? `/${env.config.rootPath}` : ''}` },
|
|
26
|
+
],
|
|
25
27
|
tags: [{
|
|
26
28
|
name: 'auth',
|
|
27
|
-
description: 'User authentication endpoints'
|
|
29
|
+
description: 'User authentication endpoints',
|
|
28
30
|
}, {
|
|
29
31
|
name: 'oauth2',
|
|
30
|
-
description: 'User authentication using 3rd party OAuth2 providers'
|
|
32
|
+
description: 'User authentication using 3rd party OAuth2 providers',
|
|
31
33
|
}, {
|
|
32
34
|
name: 'data',
|
|
33
|
-
description: 'Data manipulation and query endpoints'
|
|
35
|
+
description: 'Data manipulation and query endpoints',
|
|
34
36
|
}, {
|
|
35
37
|
name: 'indexes',
|
|
36
|
-
description: 'Index management endpoints'
|
|
38
|
+
description: 'Index management endpoints',
|
|
37
39
|
}, {
|
|
38
40
|
name: 'schemas',
|
|
39
|
-
description: 'Data schema management endpoints'
|
|
41
|
+
description: 'Data schema management endpoints',
|
|
40
42
|
}, {
|
|
41
43
|
name: 'metadata',
|
|
42
|
-
description: 'Metadata endpoints'
|
|
44
|
+
description: 'Metadata endpoints',
|
|
43
45
|
}],
|
|
44
46
|
components: {
|
|
45
47
|
securitySchemes: {
|
|
46
48
|
bearerAuth: {
|
|
47
49
|
type: 'http',
|
|
48
50
|
scheme: 'bearer',
|
|
49
|
-
bearerFormat: 'token' // switch to JWT in the future?
|
|
50
|
-
}
|
|
51
|
+
bearerFormat: 'token', // switch to JWT in the future?
|
|
52
|
+
},
|
|
51
53
|
},
|
|
52
54
|
schemas: {
|
|
53
55
|
User: {
|
|
@@ -62,8 +64,8 @@ export const addRoute = (env) => {
|
|
|
62
64
|
properties: {
|
|
63
65
|
width: { type: 'number', example: 500 },
|
|
64
66
|
height: { type: 'number', example: 500 },
|
|
65
|
-
url: { type: 'string', example: 'https://profile.pic/user.jpg' }
|
|
66
|
-
}
|
|
67
|
+
url: { type: 'string', example: 'https://profile.pic/user.jpg' },
|
|
68
|
+
},
|
|
67
69
|
},
|
|
68
70
|
emailVerified: { type: 'boolean', example: true },
|
|
69
71
|
created: { type: 'string', example: '2022-03-09T15:38:57.361Z' },
|
|
@@ -74,36 +76,36 @@ export const addRoute = (env) => {
|
|
|
74
76
|
changePassword: { type: 'boolean', example: false },
|
|
75
77
|
changePasswordRequested: { type: 'boolean', example: false },
|
|
76
78
|
changePasswordBefore: { type: 'string', example: '2022-03-09T15:38:57.361Z' },
|
|
77
|
-
settings: { type: 'object' }
|
|
78
|
-
}
|
|
79
|
+
settings: { type: 'object' },
|
|
80
|
+
},
|
|
79
81
|
},
|
|
80
82
|
Error: {
|
|
81
83
|
type: 'object',
|
|
82
84
|
properties: {
|
|
83
85
|
code: { type: 'string', description: 'error code', example: 'invalid_request' },
|
|
84
|
-
message: { type: 'string', description: 'The error message', example: 'Invalid request for this endpoint' }
|
|
85
|
-
}
|
|
86
|
+
message: { type: 'string', description: 'The error message', example: 'Invalid request for this endpoint' },
|
|
87
|
+
},
|
|
86
88
|
},
|
|
87
89
|
UnexpectedError: {
|
|
88
90
|
type: 'object',
|
|
89
91
|
properties: {
|
|
90
92
|
code: { type: 'string', value: 'unexpected', description: 'The string `"unexpected"`' },
|
|
91
|
-
message: { type: 'string', description: 'The server error message' }
|
|
92
|
-
}
|
|
93
|
+
message: { type: 'string', description: 'The server error message' },
|
|
94
|
+
},
|
|
93
95
|
},
|
|
94
96
|
UnknownError: {
|
|
95
97
|
type: 'object',
|
|
96
98
|
properties: {
|
|
97
99
|
code: { type: 'string', value: 'unknown', description: 'The string `"unknown"`' },
|
|
98
|
-
message: { type: 'string', description: 'The server error message' }
|
|
99
|
-
}
|
|
100
|
+
message: { type: 'string', description: 'The server error message' },
|
|
101
|
+
},
|
|
100
102
|
},
|
|
101
103
|
SchemaValidationError: {
|
|
102
104
|
type: 'object',
|
|
103
105
|
properties: {
|
|
104
106
|
code: { type: 'string', description: 'The string `"schema_validation_failed"`', example: 'schema_validation_failed' },
|
|
105
|
-
message: { type: 'string', description: 'The server error message', example: 'Property at path "path/property" is of the wrong type' }
|
|
106
|
-
}
|
|
107
|
+
message: { type: 'string', description: 'The server error message', example: 'Property at path "path/property" is of the wrong type' },
|
|
108
|
+
},
|
|
107
109
|
},
|
|
108
110
|
SerializedValue: {
|
|
109
111
|
type: 'object',
|
|
@@ -116,26 +118,26 @@ export const addRoute = (env) => {
|
|
|
116
118
|
{ type: 'integer' },
|
|
117
119
|
{ type: 'boolean' },
|
|
118
120
|
{ type: 'object' },
|
|
119
|
-
{ type: 'array' }
|
|
121
|
+
{ type: 'array' },
|
|
120
122
|
],
|
|
121
123
|
example: '2022-04-07T16:36:21Z',
|
|
122
|
-
required: true
|
|
124
|
+
required: true,
|
|
123
125
|
},
|
|
124
126
|
map: {
|
|
125
127
|
description: 'If the value has been serialized for transport, contains a string defining `val`s data type (eg `"date"` or `"binary"`), or an object with deep property mappings for an object value in `val`',
|
|
126
128
|
oneOf: [
|
|
127
129
|
{ type: 'string', example: 'date' },
|
|
128
|
-
{ type: 'object', example: { 'stats/created': 'date' } }
|
|
130
|
+
{ type: 'object', example: { 'stats/created': 'date' } },
|
|
129
131
|
],
|
|
130
132
|
example: 'date',
|
|
131
|
-
required: false
|
|
132
|
-
}
|
|
133
|
+
required: false,
|
|
134
|
+
},
|
|
133
135
|
},
|
|
134
136
|
required: ['val'],
|
|
135
137
|
example: {
|
|
136
138
|
val: { name: 'My todo list', stats: { size: 216, created: '2022-04-07T15:11:42Z', modified: '2022-03-08T12:24:05Z' } },
|
|
137
|
-
map: { 'stats/created': 'date', 'stats/modified': 'date' }
|
|
138
|
-
}
|
|
139
|
+
map: { 'stats/created': 'date', 'stats/modified': 'date' },
|
|
140
|
+
},
|
|
139
141
|
},
|
|
140
142
|
ReflectionNodeInfo: {
|
|
141
143
|
type: 'object',
|
|
@@ -146,28 +148,28 @@ export const addRoute = (env) => {
|
|
|
146
148
|
oneOf: [{
|
|
147
149
|
type: 'string',
|
|
148
150
|
description: 'key of the node',
|
|
149
|
-
example: 'jld2cjxh0000qzrmn831i7rn'
|
|
151
|
+
example: 'jld2cjxh0000qzrmn831i7rn',
|
|
150
152
|
}, {
|
|
151
153
|
type: 'number',
|
|
152
154
|
description: 'index of the node (parent node is an array)',
|
|
153
|
-
example: 12
|
|
154
|
-
}]
|
|
155
|
+
example: 12,
|
|
156
|
+
}],
|
|
155
157
|
},
|
|
156
158
|
exists: {
|
|
157
159
|
type: 'boolean',
|
|
158
160
|
description: 'whether the target path exists',
|
|
159
|
-
example: true
|
|
161
|
+
example: true,
|
|
160
162
|
},
|
|
161
163
|
type: {
|
|
162
164
|
type: 'string',
|
|
163
165
|
enum: ['unknown', 'object', 'array', 'number', 'boolean', 'string', 'date', 'binary', 'reference'],
|
|
164
166
|
description: 'data type of the target path',
|
|
165
|
-
example: 'object'
|
|
167
|
+
example: 'object',
|
|
166
168
|
},
|
|
167
169
|
value: {
|
|
168
170
|
oneOf: [{ type: 'string' }, { type: 'number' }, { type: 'boolean' }, { type: 'array' }, { type: 'object' }],
|
|
169
171
|
description: `target node's stored value if it is a boolean, number or date, a small string or binary value (less than configured max inline value size), or an empty object or array`,
|
|
170
|
-
example: {}
|
|
172
|
+
example: {},
|
|
171
173
|
},
|
|
172
174
|
address: {
|
|
173
175
|
type: 'object',
|
|
@@ -175,8 +177,8 @@ export const addRoute = (env) => {
|
|
|
175
177
|
required: ['pageNr', 'recordNr'],
|
|
176
178
|
properties: {
|
|
177
179
|
pageNr: { type: 'integer' },
|
|
178
|
-
recordNr: { type: 'integer' }
|
|
179
|
-
}
|
|
180
|
+
recordNr: { type: 'integer' },
|
|
181
|
+
},
|
|
180
182
|
},
|
|
181
183
|
children: {
|
|
182
184
|
type: 'object',
|
|
@@ -186,27 +188,27 @@ export const addRoute = (env) => {
|
|
|
186
188
|
count: {
|
|
187
189
|
type: 'integer',
|
|
188
190
|
description: 'The total number of children',
|
|
189
|
-
example: 2865
|
|
191
|
+
example: 2865,
|
|
190
192
|
},
|
|
191
193
|
more: {
|
|
192
194
|
type: 'boolean',
|
|
193
195
|
description: 'If there are more children than the ones in list',
|
|
194
|
-
example: true
|
|
196
|
+
example: true,
|
|
195
197
|
},
|
|
196
198
|
list: {
|
|
197
199
|
type: 'array',
|
|
198
200
|
description: 'Reflection info about the requested children',
|
|
199
201
|
items: {
|
|
200
|
-
$ref: '#/components/schemas/ReflectionNodeInfo'
|
|
202
|
+
$ref: '#/components/schemas/ReflectionNodeInfo',
|
|
201
203
|
},
|
|
202
204
|
example: [{
|
|
203
205
|
key: 'name',
|
|
204
206
|
type: 'string',
|
|
205
|
-
value: 'My name'
|
|
206
|
-
}]
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
207
|
+
value: 'My name',
|
|
208
|
+
}],
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
},
|
|
210
212
|
},
|
|
211
213
|
example: {
|
|
212
214
|
key: 'jld2cjxh0000qzrmn831i7rn',
|
|
@@ -219,23 +221,23 @@ export const addRoute = (env) => {
|
|
|
219
221
|
list: [{
|
|
220
222
|
key: 'l260qein000009jy3yjig8h9',
|
|
221
223
|
type: 'object',
|
|
222
|
-
address: { pageNr: 1, recordNr: 25 }
|
|
224
|
+
address: { pageNr: 1, recordNr: 25 },
|
|
223
225
|
}, {
|
|
224
226
|
key: 'l260rp5b000109jy98ykf7x2',
|
|
225
227
|
type: 'object',
|
|
226
|
-
address: { pageNr: 1, recordNr: 54 }
|
|
227
|
-
}]
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
228
|
+
address: { pageNr: 1, recordNr: 54 },
|
|
229
|
+
}],
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
},
|
|
232
234
|
},
|
|
233
235
|
security: [
|
|
234
236
|
// Enable bearer auth globally
|
|
235
|
-
{ bearerAuth: [] }
|
|
237
|
+
{ bearerAuth: [] },
|
|
236
238
|
],
|
|
237
239
|
},
|
|
238
|
-
apis: [yamlPath]
|
|
240
|
+
apis: [yamlPath],
|
|
239
241
|
};
|
|
240
242
|
const swaggerDocs = createSwaggerDocs(options);
|
|
241
243
|
env.app.use('/docs', swaggerUi.serve, swaggerUi.setup(swaggerDocs));
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
import { readFileSync } from 'fs';
|
|
2
|
-
import { packageRootPath } from '../shared/rootpath.js';
|
|
3
|
-
import { join as joinPaths } from 'path';
|
|
4
1
|
import * as os from 'os';
|
|
2
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3
|
+
// @ts-ignore path to package.json is different in builds
|
|
4
|
+
import meta from '../../../package.json' assert { type: 'json' };
|
|
5
5
|
export const addRoute = (env) => {
|
|
6
|
-
// Read server version from package.json
|
|
7
|
-
const filePath = joinPaths(packageRootPath, '/package.json');
|
|
8
|
-
const json = readFileSync(filePath, 'utf-8');
|
|
9
|
-
const packageInfo = JSON.parse(json);
|
|
10
6
|
// Add info endpoint
|
|
11
7
|
env.app.get(`/info/${env.db.name}`, (req, res) => {
|
|
12
8
|
const info = {
|
|
13
|
-
version:
|
|
9
|
+
version: meta.version,
|
|
14
10
|
time: Date.now(),
|
|
15
|
-
process: process.pid
|
|
11
|
+
process: process.pid,
|
|
16
12
|
};
|
|
17
13
|
if (req.user && req.user.uid === 'admin') {
|
|
18
14
|
const numberToByteSize = number => {
|
|
@@ -48,11 +44,11 @@ export const addRoute = (env) => {
|
|
|
48
44
|
external: numberToByteSize(mem.external),
|
|
49
45
|
heapTotal: numberToByteSize(mem.heapTotal),
|
|
50
46
|
heapUsed: numberToByteSize(mem.heapUsed),
|
|
51
|
-
residentSet: numberToByteSize(mem.rss)
|
|
52
|
-
}
|
|
47
|
+
residentSet: numberToByteSize(mem.rss),
|
|
48
|
+
},
|
|
53
49
|
},
|
|
54
50
|
cpus: os.cpus(),
|
|
55
|
-
network: os.networkInterfaces()
|
|
51
|
+
network: os.networkInterfaces(),
|
|
56
52
|
};
|
|
57
53
|
Object.assign(info, adminInfo);
|
|
58
54
|
}
|
|
@@ -5,7 +5,7 @@ export const addRoute = (env) => {
|
|
|
5
5
|
// Create indexes if not there yet
|
|
6
6
|
const db = env.log.ref.db;
|
|
7
7
|
const createIndexes = [
|
|
8
|
-
db.indexes.create(env.log.ref.path, 'date')
|
|
8
|
+
db.indexes.create(env.log.ref.path, 'date'),
|
|
9
9
|
];
|
|
10
10
|
if (req.query.filter_col === 'action') {
|
|
11
11
|
createIndexes.push(db.indexes.create(env.log.ref.path, 'action', { include: ['date'] }));
|
|
@@ -7,11 +7,14 @@ export const addRoute = (env) => {
|
|
|
7
7
|
const options = Object.keys(req.query).filter(key => key.startsWith('option_')).reduce((options, key) => {
|
|
8
8
|
const name = key.slice(7);
|
|
9
9
|
let value = req.query[key];
|
|
10
|
-
if (
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
if (typeof value === 'string') {
|
|
11
|
+
// Check if this should be a boolean or number
|
|
12
|
+
if (['true', 'false'].includes(value)) {
|
|
13
|
+
value = value === 'true';
|
|
14
|
+
}
|
|
15
|
+
else if (/^\-?[0-9]+$/.test(value)) {
|
|
16
|
+
value = parseInt(value);
|
|
17
|
+
}
|
|
15
18
|
}
|
|
16
19
|
options[name] = value;
|
|
17
20
|
return options;
|
|
@@ -28,13 +28,13 @@ export const addRoute = (env) => {
|
|
|
28
28
|
LOG_DETAILS.provider = state.provider;
|
|
29
29
|
// Get access & refresh tokens
|
|
30
30
|
const tokens = await provider.getAccessToken({ type: 'auth', auth_code: authCode, redirect_url: `${req.protocol}://${req.headers.host}/oauth2/${env.db.name}/signin` });
|
|
31
|
-
let user_details;
|
|
31
|
+
// let user_details;
|
|
32
32
|
// TODO: Have we got an id_token?
|
|
33
33
|
// if (tokens.id_token) {
|
|
34
34
|
// // decode, extract user information
|
|
35
35
|
// }
|
|
36
36
|
// else {
|
|
37
|
-
user_details = await provider.getUserInfo(tokens.access_token);
|
|
37
|
+
const user_details = await provider.getUserInfo(tokens.access_token);
|
|
38
38
|
// }
|
|
39
39
|
if (user_details.picture && user_details.picture.length > 0) {
|
|
40
40
|
// Download it, convert to base64
|
|
@@ -42,13 +42,13 @@ export const addRoute = (env) => {
|
|
|
42
42
|
try {
|
|
43
43
|
const response = await fetch(best.url);
|
|
44
44
|
const contentType = response.headers.get('Content-Type');
|
|
45
|
-
if (contentType === 'image/png') { //state.provider === 'google' &&
|
|
45
|
+
if (contentType === 'image/png') { //state.provider === 'google' &&
|
|
46
46
|
// Don't accept image/png, because it's probably a placeholder image. Google does this by creating a png with people's initials
|
|
47
47
|
user_details.picture = [];
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
50
|
const image = await response.arrayBuffer();
|
|
51
|
-
|
|
51
|
+
const buff = Buffer.from(image);
|
|
52
52
|
best.url = `data:${contentType};base64,${buff.toString('base64')}`;
|
|
53
53
|
user_details.picture = [best]; // Only keep the best one
|
|
54
54
|
}
|
|
@@ -80,15 +80,15 @@ export const addRoute = (env) => {
|
|
|
80
80
|
// Use the signed in uid to link this account to. This allows multiple auth provider
|
|
81
81
|
// accounts (with different email addresses) to be linked to the account the user
|
|
82
82
|
// is signed into, and also allows multiple AceBase users to link to the same provider
|
|
83
|
-
// accounts, eg if a client app allows users to link their own account to a shared
|
|
83
|
+
// accounts, eg if a client app allows users to link their own account to a shared
|
|
84
84
|
// family Spotify / Dropbox account.
|
|
85
|
-
|
|
85
|
+
const snap = await env.authRef.child(state.uid).get();
|
|
86
86
|
if (!snap.exists()) {
|
|
87
87
|
// This is wrong!
|
|
88
88
|
throw new Error(`Invalid uid`);
|
|
89
89
|
}
|
|
90
90
|
snaps = [snap];
|
|
91
|
-
|
|
91
|
+
const user = snap.val();
|
|
92
92
|
addToExistingAccount = user.email === user_details.email;
|
|
93
93
|
}
|
|
94
94
|
else {
|
|
@@ -104,8 +104,8 @@ export const addRoute = (env) => {
|
|
|
104
104
|
snaps = await query.get();
|
|
105
105
|
}
|
|
106
106
|
if (snaps.length === 0 && user_details.email) {
|
|
107
|
-
// Try again with providerUsername, use might previously have denied access to email,
|
|
108
|
-
// and now has granted access. In that case, we'll already have an account with the
|
|
107
|
+
// Try again with providerUsername, use might previously have denied access to email,
|
|
108
|
+
// and now has granted access. In that case, we'll already have an account with the
|
|
109
109
|
// generated providerUsername
|
|
110
110
|
snaps = await env.authRef.query().filter('username', '==', providerUsername).get();
|
|
111
111
|
}
|
|
@@ -118,7 +118,7 @@ export const addRoute = (env) => {
|
|
|
118
118
|
// Update user details
|
|
119
119
|
user.email_verified = user.email_verified || user_details.email_verified;
|
|
120
120
|
user.email = user.email || user_details.email;
|
|
121
|
-
if (user_details.picture
|
|
121
|
+
if (user_details.picture?.length > 0) {
|
|
122
122
|
user.picture = user_details.picture[0];
|
|
123
123
|
}
|
|
124
124
|
await env.authRef.child(uid).update({
|
|
@@ -126,7 +126,7 @@ export const addRoute = (env) => {
|
|
|
126
126
|
email_verified: user.email_verified,
|
|
127
127
|
last_signin: new Date(),
|
|
128
128
|
last_signin_ip: req.ip,
|
|
129
|
-
picture: user.picture
|
|
129
|
+
picture: user.picture,
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
// Add provider details
|
|
@@ -143,13 +143,13 @@ export const addRoute = (env) => {
|
|
|
143
143
|
username: user.username,
|
|
144
144
|
email: user.email,
|
|
145
145
|
displayName: user.display_name,
|
|
146
|
-
settings: user.settings
|
|
146
|
+
settings: user.settings,
|
|
147
147
|
},
|
|
148
148
|
date: user.created,
|
|
149
149
|
ip: req.ip,
|
|
150
150
|
activationCode: user.email_verified ? null : createSignedPublicToken({ uid: user.uid }, env.tokenSalt),
|
|
151
151
|
emailVerified: user.email_verified,
|
|
152
|
-
provider: state.provider
|
|
152
|
+
provider: state.provider,
|
|
153
153
|
};
|
|
154
154
|
env.config.email?.send(request).catch(err => {
|
|
155
155
|
env.log.error(LOG_ACTION + '.email', 'unexpected', { ...LOG_DETAILS, uid, request }, err);
|
|
@@ -163,7 +163,7 @@ export const addRoute = (env) => {
|
|
|
163
163
|
return res.send({ code: 'admin_only', message: 'Only admin is allowed to create users' });
|
|
164
164
|
}
|
|
165
165
|
// Create user with Generated password
|
|
166
|
-
|
|
166
|
+
const pwd = createPasswordHash(generatePassword());
|
|
167
167
|
user = {
|
|
168
168
|
uid: null,
|
|
169
169
|
username: typeof user_details.email === 'undefined' ? providerUsername : null,
|
|
@@ -179,7 +179,7 @@ export const addRoute = (env) => {
|
|
|
179
179
|
last_signin: new Date(),
|
|
180
180
|
last_signin_ip: req.ip,
|
|
181
181
|
picture: user_details.picture && user_details.picture[0],
|
|
182
|
-
settings: getProviderSettings()
|
|
182
|
+
settings: getProviderSettings(),
|
|
183
183
|
};
|
|
184
184
|
const userRef = await env.authRef.push(user);
|
|
185
185
|
const uid = userRef.key;
|
|
@@ -196,13 +196,13 @@ export const addRoute = (env) => {
|
|
|
196
196
|
username: user.username,
|
|
197
197
|
email: user.email,
|
|
198
198
|
displayName: user.display_name,
|
|
199
|
-
settings: user.settings
|
|
199
|
+
settings: user.settings,
|
|
200
200
|
},
|
|
201
201
|
date: user.created,
|
|
202
202
|
ip: user.created_ip,
|
|
203
203
|
activationCode: user.email_verified ? null : createSignedPublicToken({ uid: user.uid }, env.tokenSalt),
|
|
204
204
|
emailVerified: user.email_verified,
|
|
205
|
-
provider: state.provider
|
|
205
|
+
provider: state.provider,
|
|
206
206
|
};
|
|
207
207
|
env.config.email?.send(request).catch(err => {
|
|
208
208
|
env.log.error(LOG_ACTION + '.email', 'unexpected', { ...LOG_DETAILS, uid, request }, err);
|
|
@@ -220,16 +220,16 @@ export const addRoute = (env) => {
|
|
|
220
220
|
return res.redirect(callbackUrl);
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
-
|
|
223
|
+
const result = {
|
|
224
224
|
provider: {
|
|
225
225
|
name: state.provider,
|
|
226
226
|
access_token: tokens.access_token,
|
|
227
227
|
refresh_token: tokens.refresh_token,
|
|
228
|
-
expires_in: tokens.expires_in
|
|
228
|
+
expires_in: tokens.expires_in,
|
|
229
229
|
},
|
|
230
230
|
access_token: createPublicAccessToken(user.uid, req.ip, user.access_token, env.tokenSalt),
|
|
231
231
|
// Disabled sending user details because:
|
|
232
|
-
// 1) they might be too big to send as redirect header,
|
|
232
|
+
// 1) they might be too big to send as redirect header,
|
|
233
233
|
// 2) client should verify the sent access token and get user details from the server
|
|
234
234
|
// user: getPublicAccountDetails(user)
|
|
235
235
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { packageRootPath } from
|
|
1
|
+
import { packageRootPath } from '../shared/rootpath.js';
|
|
2
2
|
import { join as joinPaths } from 'path';
|
|
3
3
|
export const addRoutes = (env) => {
|
|
4
|
-
const webManagerDir =
|
|
4
|
+
const webManagerDir = `webmanager`;
|
|
5
5
|
// Add redirect from root to webmanager
|
|
6
6
|
env.app.get('/', (req, res) => {
|
|
7
|
-
res.redirect(webManagerDir);
|
|
7
|
+
res.redirect(`/${env.rootPath ? `${env.rootPath}/` : ''}${webManagerDir}/`);
|
|
8
8
|
});
|
|
9
9
|
// Serve static files from webmanager directory
|
|
10
|
-
env.app.get(
|
|
11
|
-
const filePath = req.path.slice(webManagerDir.length);
|
|
10
|
+
env.app.get(`/${webManagerDir}/*`, (req, res) => {
|
|
11
|
+
const filePath = req.path.slice(webManagerDir.length + 2);
|
|
12
12
|
const assetsPath = joinPaths(packageRootPath, '/webmanager');
|
|
13
13
|
if (filePath.length === 0) {
|
|
14
14
|
// Send default file
|
package/dist/esm/rules.js
CHANGED
|
@@ -38,9 +38,9 @@ export class PathBasedRules {
|
|
|
38
38
|
})(defaultAccess);
|
|
39
39
|
const defaultRules = {
|
|
40
40
|
rules: {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
41
|
+
'.read': defaultAccessRule,
|
|
42
|
+
'.write': defaultAccessRule,
|
|
43
|
+
},
|
|
44
44
|
};
|
|
45
45
|
let accessRules = defaultRules;
|
|
46
46
|
if (!fs.existsSync(rulesFilePath)) {
|
|
@@ -109,20 +109,20 @@ export class PathBasedRules {
|
|
|
109
109
|
return allow;
|
|
110
110
|
}
|
|
111
111
|
else if (path.startsWith('__')) {
|
|
112
|
-
// NEW: with the auth database now integrated into the main database,
|
|
112
|
+
// NEW: with the auth database now integrated into the main database,
|
|
113
113
|
// deny access to private resources starting with '__' for non-admins
|
|
114
114
|
return { allow: false, code: 'private', message: `Access to private resource "${path}" not allowed` };
|
|
115
115
|
}
|
|
116
|
-
const env = { now: Date.now(), auth: user || null }; // IDEA: Add functions like "exists" and "value". These will be async (so that requires refactoring) and can be used like "await exists('./shared/' + auth.uid)" and "await value('./writable') === true"
|
|
116
|
+
const env = { now: Date.now(), auth: user || null }; // IDEA: Add functions like "exists" and "value". These will be async (so that requires refactoring) and can be used like "await exists('./shared/' + auth.uid)" and "await value('./writable') === true"
|
|
117
117
|
const pathKeys = PathInfo.getPathKeys(path);
|
|
118
118
|
let rule = this.accessRules.rules;
|
|
119
|
-
|
|
119
|
+
const rulePath = [];
|
|
120
120
|
while (true) {
|
|
121
121
|
if (!rule) {
|
|
122
122
|
// TODO: check if this one is redundant with the pathKeys.length === 0 near the end
|
|
123
123
|
return { allow: false, code: 'no_rule', message: `No rules set for requested path "${path}", defaulting to false` };
|
|
124
124
|
}
|
|
125
|
-
|
|
125
|
+
const checkRule = write ? rule['.write'] : rule['.read'];
|
|
126
126
|
if (typeof checkRule === 'boolean') {
|
|
127
127
|
if (!checkRule) {
|
|
128
128
|
return { allow: false, code: 'rule', message: `Access denied to path "${path}" by set rule`, rule: checkRule, rulePath: rulePath.join('/') };
|
|
@@ -146,7 +146,7 @@ export class PathBasedRules {
|
|
|
146
146
|
return { allow: false, code: 'no_rule', message: `No rule found for path ${path}` };
|
|
147
147
|
}
|
|
148
148
|
let nextKey = pathKeys.shift();
|
|
149
|
-
// if nextKey is '*' or '$something', rule[nextKey] will be undefined (or match a variable) so there is no
|
|
149
|
+
// if nextKey is '*' or '$something', rule[nextKey] will be undefined (or match a variable) so there is no
|
|
150
150
|
// need to change things here for usage of wildcard paths in subscriptions
|
|
151
151
|
if (typeof rule[nextKey] === 'undefined') {
|
|
152
152
|
// Check if current rule has a wildcard child
|
package/dist/esm/schema/user.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
;
|
|
2
1
|
export const getPublicAccountDetails = (account) => {
|
|
3
2
|
return {
|
|
4
3
|
uid: account.uid,
|
|
@@ -15,7 +14,7 @@ export const getPublicAccountDetails = (account) => {
|
|
|
15
14
|
changePassword: account.change_password,
|
|
16
15
|
changePasswordRequested: account.change_password_requested?.toISOString(),
|
|
17
16
|
changePasswordBefore: account.change_password_before?.toISOString(),
|
|
18
|
-
settings: account.settings
|
|
17
|
+
settings: account.settings,
|
|
19
18
|
};
|
|
20
19
|
};
|
|
21
20
|
//# sourceMappingURL=user.js.map
|