acebase-server 1.18.2 → 1.19.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.
Files changed (93) hide show
  1. package/.eslintrc.json +49 -49
  2. package/.github/workflows/publish.yml +125 -0
  3. package/Dockerfile +26 -26
  4. package/LICENSE +21 -21
  5. package/bin/acebase-server.js +8 -8
  6. package/create-package-files.sh +25 -0
  7. package/dist/cjs/middleware/admin-only.js +2 -1
  8. package/dist/cjs/middleware/user.js +1 -0
  9. package/dist/cjs/routes/auth-delete.js +3 -2
  10. package/dist/cjs/routes/auth-signup.js +11 -11
  11. package/dist/cjs/routes/auth-update.js +2 -1
  12. package/dist/cjs/routes/auth.js +0 -3
  13. package/dist/cjs/routes/data-exists.js +2 -2
  14. package/dist/cjs/routes/data-export.js +2 -2
  15. package/dist/cjs/routes/data-get.js +2 -2
  16. package/dist/cjs/routes/data-reflect.js +4 -4
  17. package/dist/cjs/routes/data-set.js +4 -3
  18. package/dist/cjs/routes/data-transaction.js +4 -3
  19. package/dist/cjs/routes/data-update.js +4 -3
  20. package/dist/cjs/routes/docs.js +1 -1
  21. package/dist/cjs/routes/meta-info.js +3 -2
  22. package/dist/cjs/rules.js +2 -1
  23. package/dist/cjs/schema/user.js +2 -1
  24. package/dist/cjs/server.js +12 -3
  25. package/dist/cjs/settings/index.js +6 -0
  26. package/dist/cjs/shared/admin.js +8 -0
  27. package/dist/cjs/websocket/index.js +2 -1
  28. package/dist/esm/middleware/admin-only.js +2 -1
  29. package/dist/esm/middleware/user.js +1 -0
  30. package/dist/esm/routes/auth-delete.js +3 -2
  31. package/dist/esm/routes/auth-signup.js +4 -4
  32. package/dist/esm/routes/auth-update.js +2 -1
  33. package/dist/esm/routes/auth.js +0 -3
  34. package/dist/esm/routes/data-exists.js +1 -2
  35. package/dist/esm/routes/data-export.js +1 -2
  36. package/dist/esm/routes/data-get.js +1 -1
  37. package/dist/esm/routes/data-reflect.js +3 -3
  38. package/dist/esm/routes/data-set.js +2 -1
  39. package/dist/esm/routes/data-transaction.js +2 -1
  40. package/dist/esm/routes/data-update.js +2 -1
  41. package/dist/esm/routes/docs.js +1 -1
  42. package/dist/esm/routes/meta-info.js +3 -2
  43. package/dist/esm/rules.js +2 -1
  44. package/dist/esm/schema/user.js +1 -0
  45. package/dist/esm/server.js +12 -3
  46. package/dist/esm/settings/index.js +6 -0
  47. package/dist/esm/shared/admin.js +4 -0
  48. package/dist/esm/websocket/index.js +1 -1
  49. package/dist/types/middleware/user.d.ts +1 -0
  50. package/dist/types/routes/auth-update.d.ts +2 -0
  51. package/dist/types/rules.d.ts +1 -1
  52. package/dist/types/schema/user.d.ts +4 -0
  53. package/dist/types/settings/index.d.ts +14 -2
  54. package/dist/types/shared/admin.d.ts +3 -0
  55. package/package.json +4 -5
  56. package/release_notes.md +4 -0
  57. package/src/routes/auth-change-password.yaml +73 -73
  58. package/src/routes/auth-delete.yaml +77 -77
  59. package/src/routes/auth-forgot-password.yaml +49 -49
  60. package/src/routes/auth-reset-password.yaml +53 -53
  61. package/src/routes/auth-signin.yaml +129 -129
  62. package/src/routes/auth-signout.yaml +46 -46
  63. package/src/routes/auth-signup.yaml +135 -135
  64. package/src/routes/auth-state.yaml +28 -28
  65. package/src/routes/auth-update.yaml +151 -151
  66. package/src/routes/auth-verify-email.yaml +52 -52
  67. package/src/routes/data-exists.yaml +44 -44
  68. package/src/routes/data-export.yaml +63 -63
  69. package/src/routes/data-import.yaml +74 -74
  70. package/src/routes/data-index-create.yaml +105 -105
  71. package/src/routes/data-index-delete.yaml +51 -51
  72. package/src/routes/data-index-list.yaml +84 -84
  73. package/src/routes/data-query.yaml +165 -165
  74. package/src/routes/data-reflect.yaml +124 -124
  75. package/src/routes/data-schema-get.yaml +53 -53
  76. package/src/routes/data-schema-set.yaml +64 -64
  77. package/src/routes/data-schema-test.yaml +66 -66
  78. package/src/routes/data-schemas-list.yaml +41 -41
  79. package/src/routes/data-set.yaml +77 -77
  80. package/src/routes/data-sync-changes.yaml +66 -66
  81. package/src/routes/data-sync-mutations.yaml +66 -66
  82. package/src/routes/data-transaction-finish.yaml +82 -82
  83. package/src/routes/data-transaction-start.yaml +58 -58
  84. package/src/routes/data-update.yaml +77 -77
  85. package/src/routes/meta-info.yaml +40 -40
  86. package/src/routes/meta-ping.yaml +22 -22
  87. package/src/routes/meta-stats.yaml +40 -40
  88. package/src/routes/oauth2-init.yaml +62 -62
  89. package/src/routes/oauth2-refresh.yaml +64 -64
  90. package/src/routes/oauth2-signin.yaml +65 -65
  91. package/webmanager/acebase-client-browser.min.js +12 -12
  92. package/webmanager/index.html +271 -271
  93. package/webmanager/index.js +437 -437
@@ -1,130 +1,130 @@
1
- /auth/{dbname}/signin:
2
- post:
3
- tags:
4
- - auth
5
- summary: Sign in a user
6
- description: Signs in an existing user
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
- requestBody:
16
- description: sign in details
17
- content:
18
- 'application/json':
19
- schema:
20
- oneOf:
21
- - type: object
22
- properties:
23
- client_id:
24
- description: ID of the connected websocket
25
- type: string
26
- method:
27
- description: Method of authentication (email)
28
- type: string
29
- value: email
30
- email:
31
- description: User email address
32
- type: string
33
- password:
34
- description: Password
35
- type: string
36
- format: password
37
- required:
38
- - method
39
- - email
40
- - password
41
- example:
42
- method: email
43
- email: user@example.com
44
- password: sup3rs3cr3t
45
- - type: object
46
- properties:
47
- client_id:
48
- description: ID of the connected websocket
49
- type: string
50
- method:
51
- description: Method of authentication (account)
52
- type: string
53
- value: account
54
- username:
55
- description: Username
56
- type: string
57
- password:
58
- description: Password
59
- type: string
60
- format: password
61
- required:
62
- - method
63
- - username
64
- - password
65
- example:
66
- method: account
67
- username: admin
68
- password: sup3rs3cr3t
69
- - type: object
70
- properties:
71
- client_id:
72
- type: string
73
- description: ID of the connected websocket
74
- method:
75
- type: string
76
- value: token
77
- description: Method of authentication (token)
78
- access_token:
79
- type: string
80
- description: Previously acquired access token to sign in with
81
- required:
82
- - method
83
- - access_token
84
- example:
85
- method: token
86
- access_token: bewufh387f3fyubqwekrjbcqwkuiec7gq3euyfbqwkuyebqjk..
87
- responses:
88
- 200:
89
- description: When signin succeeds, it returns an object with the result
90
- content:
91
- 'application/json':
92
- schema:
93
- type: object
94
- properties:
95
- access_token:
96
- description: The access token that provides access to API calls that require authentication. This access token should be added to the Authorization header of those requests. The token is allowed to be cached by the client to sign in witht the token method later
97
- type: string
98
- example: ewufh387f3fyubqwekrjbcqwkuiec7gq3euyfbqwkuyebqjk..
99
- user:
100
- $ref: '#/components/schemas/User'
101
- 401:
102
- description: When the sent request details are incorrect, this "401 Unauthorized" is returned
103
- content:
104
- 'application/json':
105
- schema:
106
- type: object
107
- properties:
108
- code:
109
- type: string
110
- description: The exact error code
111
- enum:
112
- - invalid_token
113
- - not_found
114
- - duplicate
115
- - token_mismatch
116
- - wrong_password
117
- example: not_found
118
- message:
119
- type: string
120
- description: Description of the error
121
- example: Incorrect email
122
- example:
123
- code: wrong_password
124
- message: Incorrect password
125
- 500:
126
- description: An unenexpected error occurred on the server
127
- content:
128
- 'application/json':
129
- schema:
1
+ /auth/{dbname}/signin:
2
+ post:
3
+ tags:
4
+ - auth
5
+ summary: Sign in a user
6
+ description: Signs in an existing user
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
+ requestBody:
16
+ description: sign in details
17
+ content:
18
+ 'application/json':
19
+ schema:
20
+ oneOf:
21
+ - type: object
22
+ properties:
23
+ client_id:
24
+ description: ID of the connected websocket
25
+ type: string
26
+ method:
27
+ description: Method of authentication (email)
28
+ type: string
29
+ value: email
30
+ email:
31
+ description: User email address
32
+ type: string
33
+ password:
34
+ description: Password
35
+ type: string
36
+ format: password
37
+ required:
38
+ - method
39
+ - email
40
+ - password
41
+ example:
42
+ method: email
43
+ email: user@example.com
44
+ password: sup3rs3cr3t
45
+ - type: object
46
+ properties:
47
+ client_id:
48
+ description: ID of the connected websocket
49
+ type: string
50
+ method:
51
+ description: Method of authentication (account)
52
+ type: string
53
+ value: account
54
+ username:
55
+ description: Username
56
+ type: string
57
+ password:
58
+ description: Password
59
+ type: string
60
+ format: password
61
+ required:
62
+ - method
63
+ - username
64
+ - password
65
+ example:
66
+ method: account
67
+ username: admin
68
+ password: sup3rs3cr3t
69
+ - type: object
70
+ properties:
71
+ client_id:
72
+ type: string
73
+ description: ID of the connected websocket
74
+ method:
75
+ type: string
76
+ value: token
77
+ description: Method of authentication (token)
78
+ access_token:
79
+ type: string
80
+ description: Previously acquired access token to sign in with
81
+ required:
82
+ - method
83
+ - access_token
84
+ example:
85
+ method: token
86
+ access_token: bewufh387f3fyubqwekrjbcqwkuiec7gq3euyfbqwkuyebqjk..
87
+ responses:
88
+ 200:
89
+ description: When signin succeeds, it returns an object with the result
90
+ content:
91
+ 'application/json':
92
+ schema:
93
+ type: object
94
+ properties:
95
+ access_token:
96
+ description: The access token that provides access to API calls that require authentication. This access token should be added to the Authorization header of those requests. The token is allowed to be cached by the client to sign in witht the token method later
97
+ type: string
98
+ example: ewufh387f3fyubqwekrjbcqwkuiec7gq3euyfbqwkuyebqjk..
99
+ user:
100
+ $ref: '#/components/schemas/User'
101
+ 401:
102
+ description: When the sent request details are incorrect, this "401 Unauthorized" is returned
103
+ content:
104
+ 'application/json':
105
+ schema:
106
+ type: object
107
+ properties:
108
+ code:
109
+ type: string
110
+ description: The exact error code
111
+ enum:
112
+ - invalid_token
113
+ - not_found
114
+ - duplicate
115
+ - token_mismatch
116
+ - wrong_password
117
+ example: not_found
118
+ message:
119
+ type: string
120
+ description: Description of the error
121
+ example: Incorrect email
122
+ example:
123
+ code: wrong_password
124
+ message: Incorrect password
125
+ 500:
126
+ description: An unenexpected error occurred on the server
127
+ content:
128
+ 'application/json':
129
+ schema:
130
130
  $ref: '#/components/schemas/UnexpectedError'
@@ -1,46 +1,46 @@
1
- /auth/{dbname}/signout:
2
- post:
3
- tags:
4
- - auth
5
- summary: Sign out current user
6
- description: Signs out the currently signed in user
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
- requestBody:
16
- description: Sign out details
17
- content:
18
- 'application/json':
19
- schema:
20
- type: object
21
- properties:
22
- client_id:
23
- type: string
24
- description: ID of the connected websocket
25
- everywhere:
26
- type: boolean
27
- description: Whether the user should sign out on ALL clients
28
- example:
29
- client_id: x8WIv7-mJelg7on_ALbx
30
- everywhere: false
31
- responses:
32
- 200:
33
- description: Returns `"Bye!"` if signout is successful
34
- content:
35
- 'text/plain':
36
- schema:
37
- type: string
38
- value: Bye!
39
- example: Bye!
40
- 500:
41
- description: Returns an object describing an unexpected error
42
- content:
43
- 'application/json':
44
- schema:
45
- $ref: '#/components/schemas/Error'
46
-
1
+ /auth/{dbname}/signout:
2
+ post:
3
+ tags:
4
+ - auth
5
+ summary: Sign out current user
6
+ description: Signs out the currently signed in user
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
+ requestBody:
16
+ description: Sign out details
17
+ content:
18
+ 'application/json':
19
+ schema:
20
+ type: object
21
+ properties:
22
+ client_id:
23
+ type: string
24
+ description: ID of the connected websocket
25
+ everywhere:
26
+ type: boolean
27
+ description: Whether the user should sign out on ALL clients
28
+ example:
29
+ client_id: x8WIv7-mJelg7on_ALbx
30
+ everywhere: false
31
+ responses:
32
+ 200:
33
+ description: Returns `"Bye!"` if signout is successful
34
+ content:
35
+ 'text/plain':
36
+ schema:
37
+ type: string
38
+ value: Bye!
39
+ example: Bye!
40
+ 500:
41
+ description: Returns an object describing an unexpected error
42
+ content:
43
+ 'application/json':
44
+ schema:
45
+ $ref: '#/components/schemas/Error'
46
+
@@ -1,136 +1,136 @@
1
- /auth/{dbname}/signup:
2
- post:
3
- tags:
4
- - auth
5
- summary: Create a new user
6
- description: Signs up a new user (must be enabled in the server config)
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
- requestBody:
16
- description: new user details
17
- content:
18
- 'application/json':
19
- schema:
20
- type: object
21
- properties:
22
- username:
23
- type: string
24
- description: Requested username (optional if `email` provided)
25
- email:
26
- type: string
27
- description: Email address (optional if `username` provided)
28
- displayName:
29
- type: string
30
- description: Name of the user for public displaying purposes. Consider this a real name, alias or handle
31
- password:
32
- type: string
33
- format: password
34
- description: Password to set for the account
35
- picture:
36
- type: object
37
- description: Profile picture
38
- properties:
39
- url:
40
- type: string
41
- width:
42
- type: number
43
- height:
44
- type: number
45
- example:
46
- url: https://my.profile.pic/me.jpg
47
- width: 500
48
- height: 500
49
- settings:
50
- type: object
51
- otherProperties: true
52
- desciption: (optional) miscellanious other info to store with the user account
53
- required:
54
- - username
55
- - email
56
- - displayName
57
- - password
58
- example:
59
- email: user@example.com
60
- displayName: Real Name
61
- password: sup3rs3cr3t
62
- responses:
63
- 200:
64
- description: When signup succeeds, it returns an object with the result
65
- content:
66
- 'application/json':
67
- schema:
68
- type: object
69
- properties:
70
- access_token:
71
- description: The access token that provides access to API calls that require authentication. This access token should be added to the Authorization header of those requests. The token is allowed to be cached by the client to sign in witht the token method later
72
- type: string
73
- example: ewufh387f3fyubqwekrjbcqwkuiec7gq3euyfbqwkuyebqjk..
74
- user:
75
- $ref: '#/components/schemas/User'
76
- 403:
77
- description: If user signup is disabled in the server config, only the admin user can create new accounts and `"403 Forbidden"` is returned
78
- content:
79
- 'application/json':
80
- schema:
81
- type: object
82
- properties:
83
- code:
84
- type: string
85
- value: admin_only
86
- message:
87
- type: string
88
- value: Only admin is allowed to create users
89
- example:
90
- code: admin_only
91
- message: Only admin is allowed to create users
92
- 409:
93
- description: An account with the same username or email address exists already
94
- content:
95
- 'application/json':
96
- schema:
97
- type: object
98
- properties:
99
- code:
100
- type: string
101
- value: conflict
102
- message:
103
- type: string
104
- value: Account with username and/or email already exists
105
- 422:
106
- description: When the sent request details are incorrect, `"422 Unprocessable Entity"` is returned
107
- content:
108
- 'application/json':
109
- schema:
110
- type: object
111
- properties:
112
- code:
113
- type: string
114
- description: The exact error code
115
- enum:
116
- - missing_details
117
- - invalid_email
118
- - invalid_username
119
- - invalid_display_name
120
- - invalid_password
121
- - invalid_settings
122
- - invalid_picture
123
- example: missing_details
124
- message:
125
- type: string
126
- description: Description of the error
127
- example: No username or email provided
128
- example:
129
- code: invalid_password
130
- message: Invalid password, must be at least 8 characters and cannot contain spaces
131
- 500:
132
- description: An unenexpected error occurred on the server
133
- content:
134
- 'application/json':
135
- schema:
1
+ /auth/{dbname}/signup:
2
+ post:
3
+ tags:
4
+ - auth
5
+ summary: Create a new user
6
+ description: Signs up a new user (must be enabled in the server config)
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
+ requestBody:
16
+ description: new user details
17
+ content:
18
+ 'application/json':
19
+ schema:
20
+ type: object
21
+ properties:
22
+ username:
23
+ type: string
24
+ description: Requested username (optional if `email` provided)
25
+ email:
26
+ type: string
27
+ description: Email address (optional if `username` provided)
28
+ displayName:
29
+ type: string
30
+ description: Name of the user for public displaying purposes. Consider this a real name, alias or handle
31
+ password:
32
+ type: string
33
+ format: password
34
+ description: Password to set for the account
35
+ picture:
36
+ type: object
37
+ description: Profile picture
38
+ properties:
39
+ url:
40
+ type: string
41
+ width:
42
+ type: number
43
+ height:
44
+ type: number
45
+ example:
46
+ url: https://my.profile.pic/me.jpg
47
+ width: 500
48
+ height: 500
49
+ settings:
50
+ type: object
51
+ otherProperties: true
52
+ desciption: (optional) miscellanious other info to store with the user account
53
+ required:
54
+ - username
55
+ - email
56
+ - displayName
57
+ - password
58
+ example:
59
+ email: user@example.com
60
+ displayName: Real Name
61
+ password: sup3rs3cr3t
62
+ responses:
63
+ 200:
64
+ description: When signup succeeds, it returns an object with the result
65
+ content:
66
+ 'application/json':
67
+ schema:
68
+ type: object
69
+ properties:
70
+ access_token:
71
+ description: The access token that provides access to API calls that require authentication. This access token should be added to the Authorization header of those requests. The token is allowed to be cached by the client to sign in witht the token method later
72
+ type: string
73
+ example: ewufh387f3fyubqwekrjbcqwkuiec7gq3euyfbqwkuyebqjk..
74
+ user:
75
+ $ref: '#/components/schemas/User'
76
+ 403:
77
+ description: If user signup is disabled in the server config, only the admin user can create new accounts and `"403 Forbidden"` is returned
78
+ content:
79
+ 'application/json':
80
+ schema:
81
+ type: object
82
+ properties:
83
+ code:
84
+ type: string
85
+ value: admin_only
86
+ message:
87
+ type: string
88
+ value: Only admin is allowed to create users
89
+ example:
90
+ code: admin_only
91
+ message: Only admin is allowed to create users
92
+ 409:
93
+ description: An account with the same username or email address exists already
94
+ content:
95
+ 'application/json':
96
+ schema:
97
+ type: object
98
+ properties:
99
+ code:
100
+ type: string
101
+ value: conflict
102
+ message:
103
+ type: string
104
+ value: Account with username and/or email already exists
105
+ 422:
106
+ description: When the sent request details are incorrect, `"422 Unprocessable Entity"` is returned
107
+ content:
108
+ 'application/json':
109
+ schema:
110
+ type: object
111
+ properties:
112
+ code:
113
+ type: string
114
+ description: The exact error code
115
+ enum:
116
+ - missing_details
117
+ - invalid_email
118
+ - invalid_username
119
+ - invalid_display_name
120
+ - invalid_password
121
+ - invalid_settings
122
+ - invalid_picture
123
+ example: missing_details
124
+ message:
125
+ type: string
126
+ description: Description of the error
127
+ example: No username or email provided
128
+ example:
129
+ code: invalid_password
130
+ message: Invalid password, must be at least 8 characters and cannot contain spaces
131
+ 500:
132
+ description: An unenexpected error occurred on the server
133
+ content:
134
+ 'application/json':
135
+ schema:
136
136
  $ref: '#/components/schemas/UnexpectedError'