acebase-server 1.12.0 → 1.13.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/.vscode/launch.json +24 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/shared/rootpath.js +2 -0
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/shared/rootpath.js +2 -0
- package/package.json +3 -3
- package/webmanager/acebase-client-browser.min.js +16 -16
- package/create-package-files +0 -12
- 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/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-change-password.yaml +0 -74
- package/src/routes/auth-delete.ts +0 -49
- package/src/routes/auth-delete.yaml +0 -78
- package/src/routes/auth-forgot-password.ts +0 -77
- package/src/routes/auth-forgot-password.yaml +0 -50
- package/src/routes/auth-reset-password.ts +0 -96
- package/src/routes/auth-reset-password.yaml +0 -54
- package/src/routes/auth-signin.ts +0 -55
- package/src/routes/auth-signin.yaml +0 -130
- package/src/routes/auth-signout.ts +0 -64
- package/src/routes/auth-signout.yaml +0 -46
- package/src/routes/auth-signup.ts +0 -164
- package/src/routes/auth-signup.yaml +0 -136
- package/src/routes/auth-state.ts +0 -20
- package/src/routes/auth-state.yaml +0 -29
- package/src/routes/auth-update.ts +0 -149
- package/src/routes/auth-update.yaml +0 -152
- package/src/routes/auth-verify-email.ts +0 -75
- package/src/routes/auth-verify-email.yaml +0 -53
- package/src/routes/auth.ts +0 -67
- package/src/routes/data-exists.ts +0 -31
- package/src/routes/data-exists.yaml +0 -44
- package/src/routes/data-export.ts +0 -51
- package/src/routes/data-export.yaml +0 -64
- package/src/routes/data-get.ts +0 -68
- package/src/routes/data-get.yaml +0 -54
- package/src/routes/data-import.ts +0 -56
- package/src/routes/data-import.yaml +0 -75
- package/src/routes/data-index-create.ts +0 -82
- package/src/routes/data-index-create.yaml +0 -105
- package/src/routes/data-index-delete.ts +0 -36
- package/src/routes/data-index-delete.yaml +0 -51
- package/src/routes/data-index-list.ts +0 -39
- package/src/routes/data-index-list.yaml +0 -80
- package/src/routes/data-query.ts +0 -97
- package/src/routes/data-query.yaml +0 -166
- package/src/routes/data-reflect.ts +0 -91
- package/src/routes/data-reflect.yaml +0 -124
- package/src/routes/data-schema-get.ts +0 -36
- package/src/routes/data-schema-get.yaml +0 -53
- package/src/routes/data-schema-set.ts +0 -35
- package/src/routes/data-schema-set.yaml +0 -60
- package/src/routes/data-schema-test.ts +0 -50
- package/src/routes/data-schema-test.yaml +0 -66
- package/src/routes/data-schemas-list.ts +0 -31
- package/src/routes/data-schemas-list.yaml +0 -41
- package/src/routes/data-set.ts +0 -84
- package/src/routes/data-set.yaml +0 -77
- package/src/routes/data-sync-changes.ts +0 -78
- package/src/routes/data-sync-changes.yaml +0 -67
- package/src/routes/data-sync-mutations.ts +0 -78
- package/src/routes/data-sync-mutations.yaml +0 -67
- package/src/routes/data-transaction-finish.yaml +0 -82
- package/src/routes/data-transaction-start.yaml +0 -58
- package/src/routes/data-transaction.ts +0 -168
- package/src/routes/data-update.ts +0 -85
- package/src/routes/data-update.yaml +0 -77
- 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-info.yaml +0 -41
- package/src/routes/meta-logs.ts +0 -57
- package/src/routes/meta-ping.ts +0 -15
- package/src/routes/meta-ping.yaml +0 -23
- package/src/routes/meta-stats.ts +0 -31
- package/src/routes/meta-stats.yaml +0 -41
- package/src/routes/meta.ts +0 -22
- package/src/routes/oauth2-init.ts +0 -44
- package/src/routes/oauth2-init.yaml +0 -63
- package/src/routes/oauth2-refresh.ts +0 -39
- package/src/routes/oauth2-refresh.yaml +0 -65
- package/src/routes/oauth2-signin.ts +0 -286
- package/src/routes/oauth2-signin.yaml +0 -66
- package/src/routes/webmanager.ts +0 -29
- package/src/rules.ts +0 -196
- package/src/schema/user.ts +0 -99
- package/src/server.ts +0 -420
- 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 -39
- 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 -15
- 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 -337
- package/src/websocket/manager.ts +0 -46
- package/src/websocket/socket.io.ts +0 -90
- package/tsconfig-cjs.json +0 -10
- package/tsconfig.json +0 -21
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/sync/mutations/{dbname}:
|
|
2
|
-
get:
|
|
3
|
-
tags:
|
|
4
|
-
- data
|
|
5
|
-
summary: Gets mutations since cursor
|
|
6
|
-
description: Gets all mutations for specific path(s) and event combinations since given cursor. Use either the _path_ or _for_ parameter. If both are given, only _path_ is used.
|
|
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: query
|
|
17
|
-
description: "single database path to get all changes for (equivalent to _for_ `[{ path, events: ['value'] }]`)"
|
|
18
|
-
schema:
|
|
19
|
-
type: string
|
|
20
|
-
example: collection
|
|
21
|
-
- name: for
|
|
22
|
-
in: query
|
|
23
|
-
description: JSON array of path / events combinations
|
|
24
|
-
schema:
|
|
25
|
-
type: string
|
|
26
|
-
example: "[{ path: 'collection', events: ['child_changed'] }]"
|
|
27
|
-
- name: cursor
|
|
28
|
-
in: query
|
|
29
|
-
description: previously acquired cursor to use
|
|
30
|
-
schema:
|
|
31
|
-
type: string
|
|
32
|
-
example: l2a37q55000008ll8dyngkny
|
|
33
|
-
- name: timestamp
|
|
34
|
-
in: query
|
|
35
|
-
description: instead of a cursor, you can also use a timestamp (ms since 1970/01/01)
|
|
36
|
-
schema:
|
|
37
|
-
type: integer
|
|
38
|
-
example: ""
|
|
39
|
-
responses:
|
|
40
|
-
200:
|
|
41
|
-
description: Returns an array of all mutations to the requested selection
|
|
42
|
-
content:
|
|
43
|
-
'application/json':
|
|
44
|
-
schema:
|
|
45
|
-
type: object
|
|
46
|
-
example: []
|
|
47
|
-
400:
|
|
48
|
-
description: Returns "400 Bad Request" if transaction logging is not enabled in the server settings (code `no_transaction_logging`) or if no targets were specified in your query (no _path_ or _for_ parameters given, code `invalid_request`)
|
|
49
|
-
content:
|
|
50
|
-
'application/json':
|
|
51
|
-
schema:
|
|
52
|
-
$ref: '#/components/schemas/Error'
|
|
53
|
-
example:
|
|
54
|
-
code: no_transaction_logging
|
|
55
|
-
message: Transaction logging not enabled
|
|
56
|
-
403:
|
|
57
|
-
description: Returns a "403 Forbidden" if the signed in user is not allowed to read from any of the targeted paths
|
|
58
|
-
content:
|
|
59
|
-
'application/json':
|
|
60
|
-
schema:
|
|
61
|
-
$ref: '#/components/schemas/Error'
|
|
62
|
-
500:
|
|
63
|
-
description: An unexpected error occurred
|
|
64
|
-
content:
|
|
65
|
-
'application/json':
|
|
66
|
-
schema:
|
|
67
|
-
$ref: '#/components/schemas/UnexpectedError'
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/transaction/{dbname}/finish:
|
|
2
|
-
post:
|
|
3
|
-
tags:
|
|
4
|
-
- data
|
|
5
|
-
summary: Finishes a transaction on a path
|
|
6
|
-
description: Finishes a transaction on a path in the database by overwriting it with a new value. 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
|
-
requestBody:
|
|
16
|
-
description: transaction details and the new value to store
|
|
17
|
-
content:
|
|
18
|
-
'application/json':
|
|
19
|
-
schema:
|
|
20
|
-
type: object
|
|
21
|
-
properties:
|
|
22
|
-
id:
|
|
23
|
-
type: string
|
|
24
|
-
description: transaction id returned by the _start_ endpoint
|
|
25
|
-
example: jld2cjxh0000qzrmn831i7rn
|
|
26
|
-
path:
|
|
27
|
-
type: string
|
|
28
|
-
description: the same path used in the _start_ endpoint call
|
|
29
|
-
example: collection/child/property
|
|
30
|
-
value:
|
|
31
|
-
$ref: '#/components/schemas/SerializedValue'
|
|
32
|
-
responses:
|
|
33
|
-
200:
|
|
34
|
-
description: If successful returns the string `"done"`
|
|
35
|
-
content:
|
|
36
|
-
'text/plain':
|
|
37
|
-
headers:
|
|
38
|
-
'AceBase-Context':
|
|
39
|
-
description: Returns the context that was passed to the transaction start endpoint, augmented with an `acebase_cursor` if transaction logging is enabled on the server.
|
|
40
|
-
schema:
|
|
41
|
-
type: string
|
|
42
|
-
example: '{ "acebase_cursor": "l3lf2iwd000109mgdn0d6pqt" }'
|
|
43
|
-
schema:
|
|
44
|
-
type: string
|
|
45
|
-
value: done
|
|
46
|
-
example: done
|
|
47
|
-
description: the string `"done"`
|
|
48
|
-
400:
|
|
49
|
-
description: Returns "400 Bad Request" if the sent value is incorrect
|
|
50
|
-
content:
|
|
51
|
-
'application/json':
|
|
52
|
-
schema:
|
|
53
|
-
$ref: '#/components/schemas/Error'
|
|
54
|
-
example:
|
|
55
|
-
code: invalid_serialized_value
|
|
56
|
-
message: The sent value is not properly serialized
|
|
57
|
-
403:
|
|
58
|
-
description: Returns "403 Forbidden" if the signed in user is not allowed to write to the target path
|
|
59
|
-
content:
|
|
60
|
-
'application/json':
|
|
61
|
-
schema:
|
|
62
|
-
$ref: '#/components/schemas/Error'
|
|
63
|
-
410:
|
|
64
|
-
description: Returns "410 Gone" if the specified transaction was not found, timed out, or the path does not match with the one provided in the _start_ endpoint.
|
|
65
|
-
content:
|
|
66
|
-
'text/plain':
|
|
67
|
-
schema:
|
|
68
|
-
type: string
|
|
69
|
-
value: transaction not found
|
|
70
|
-
example: transaction not found
|
|
71
|
-
422:
|
|
72
|
-
description: Returns "422 Unprocessable Entity" if schema validation for the sent value failed.
|
|
73
|
-
content:
|
|
74
|
-
'application/json':
|
|
75
|
-
schema:
|
|
76
|
-
$ref: '#/components/schemas/SchemaValidationError'
|
|
77
|
-
500:
|
|
78
|
-
description: An unexpected error occurred
|
|
79
|
-
content:
|
|
80
|
-
'application/json':
|
|
81
|
-
schema:
|
|
82
|
-
$ref: '#/components/schemas/UnexpectedError'
|
|
@@ -1,58 +0,0 @@
|
|
|
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'
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import { SchemaValidationError } from 'acebase';
|
|
2
|
-
import { ID, Transport } from 'acebase-core';
|
|
3
|
-
import { Api } from 'acebase-core/src/api';
|
|
4
|
-
import { SerializedValue } from 'acebase-core/types/transport';
|
|
5
|
-
import { RouteInitEnvironment, RouteRequest } from '../shared/env';
|
|
6
|
-
import { sendBadRequestError, sendError, sendUnauthorizedError, sendUnexpectedError } from '../shared/error';
|
|
7
|
-
|
|
8
|
-
export const TRANSACTION_TIMEOUT_MS = 10000; // 10s to finish a started transaction
|
|
9
|
-
|
|
10
|
-
export class DataTransactionError extends Error {
|
|
11
|
-
constructor(public code: 'invalid_serialized_value', message: string) {
|
|
12
|
-
super(message);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export type ApiTransactionDetails = {
|
|
17
|
-
id: string;
|
|
18
|
-
value: SerializedValue;
|
|
19
|
-
};
|
|
20
|
-
export type StartRequestQuery = null;
|
|
21
|
-
export type StartRequestBody = {
|
|
22
|
-
path: string;
|
|
23
|
-
};
|
|
24
|
-
export type StartResponseBody = ApiTransactionDetails // 200
|
|
25
|
-
| { code: string, message: string } // 403
|
|
26
|
-
| { code: 'unexpected', message: string }; // 500
|
|
27
|
-
export type StartRequest = RouteRequest<any, StartResponseBody, StartRequestBody, StartRequestQuery>;
|
|
28
|
-
|
|
29
|
-
export type FinishRequestQuery = null;
|
|
30
|
-
export type FinishRequestBody = ApiTransactionDetails & { path: string };
|
|
31
|
-
export type FinishResponseBody = 'done' // 200
|
|
32
|
-
| { code: string, message: string } // 400, 403
|
|
33
|
-
| 'transaction not found' // 410
|
|
34
|
-
| string // 500
|
|
35
|
-
|
|
36
|
-
export type FinishRequest = RouteRequest<any, FinishResponseBody, FinishRequestBody, FinishRequestQuery>;
|
|
37
|
-
|
|
38
|
-
type Transaction = { id: string; started: number; path: string; context: any; finish?: (val?: any) => ReturnType<Api['transaction']>; timeout: NodeJS.Timeout };
|
|
39
|
-
|
|
40
|
-
export const addRoutes = (env: RouteInitEnvironment) => {
|
|
41
|
-
|
|
42
|
-
const _transactions = new Map<string, Transaction>();
|
|
43
|
-
|
|
44
|
-
// Start transaction endpoint:
|
|
45
|
-
env.app.post(`/transaction/${env.db.name}/start`, (req: StartRequest, res) => {
|
|
46
|
-
const data = req.body;
|
|
47
|
-
|
|
48
|
-
const LOG_ACTION = 'data.transaction.start';
|
|
49
|
-
const LOG_DETAILS = { ip: req.ip, uid: req.user?.uid ?? null, path: data.path };
|
|
50
|
-
|
|
51
|
-
const access = env.rules.userHasAccess(req.user, data.path, true);
|
|
52
|
-
if (!access.allow) {
|
|
53
|
-
env.log.error(LOG_ACTION, 'unauthorized', { ...LOG_DETAILS, rule_code: access.code, rule_path: access.rulePath ?? null }, access.details);
|
|
54
|
-
return sendUnauthorizedError(res, access.code, access.message);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Start transaction
|
|
58
|
-
const tx: Transaction = {
|
|
59
|
-
id: ID.generate(),
|
|
60
|
-
started: Date.now(),
|
|
61
|
-
path: data.path,
|
|
62
|
-
context: req.context,
|
|
63
|
-
finish: undefined,
|
|
64
|
-
timeout: setTimeout(() => {
|
|
65
|
-
_transactions.delete(tx.id);
|
|
66
|
-
tx.finish(); // Finish without value cancels the transaction
|
|
67
|
-
}, TRANSACTION_TIMEOUT_MS)
|
|
68
|
-
};
|
|
69
|
-
_transactions.set(tx.id, tx);
|
|
70
|
-
|
|
71
|
-
try {
|
|
72
|
-
env.debug.verbose(`Transaction ${tx.id} starting...`);
|
|
73
|
-
|
|
74
|
-
// const ref = db.ref(tx.path);
|
|
75
|
-
const donePromise = env.db.api.transaction(tx.path, val => {
|
|
76
|
-
env.debug.verbose(`Transaction ${tx.id} started with value: `, val);
|
|
77
|
-
const currentValue = Transport.serialize(val);
|
|
78
|
-
const promise = new Promise<any>((resolve) => {
|
|
79
|
-
tx.finish = (val: any) => {
|
|
80
|
-
env.debug.verbose(`Transaction ${tx.id} finishing with value: `, val);
|
|
81
|
-
_transactions.delete(tx.id);
|
|
82
|
-
resolve(val);
|
|
83
|
-
return donePromise;
|
|
84
|
-
};
|
|
85
|
-
});
|
|
86
|
-
res.send({ id: tx.id, value: currentValue });
|
|
87
|
-
return promise;
|
|
88
|
-
}, { context: tx.context });
|
|
89
|
-
}
|
|
90
|
-
catch (err) {
|
|
91
|
-
env.debug.error(`failed to start transaction on "${tx.path}":`, err);
|
|
92
|
-
env.log.error(LOG_ACTION, err.code ?? 'unexpected', LOG_DETAILS, typeof err.code === 'undefined' ? err : null);
|
|
93
|
-
sendUnexpectedError(res, err);
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
// Finish transaction endpoint:
|
|
98
|
-
env.app.post(`/transaction/${env.db.name}/finish`, async (req: FinishRequest, res) => {
|
|
99
|
-
const data = req.body;
|
|
100
|
-
const LOG_ACTION = 'data.transaction.finish';
|
|
101
|
-
const LOG_DETAILS = { ip: req.ip, uid: req.user?.uid ?? null, path: data.path };
|
|
102
|
-
|
|
103
|
-
const tx = _transactions.get(data.id);
|
|
104
|
-
if (!tx || tx.path !== data.path) {
|
|
105
|
-
env.log.error(LOG_ACTION, tx ? 'wrong_path' : 'not_found', { ...LOG_DETAILS, id: data.id, tx_path: tx?.path ?? null });
|
|
106
|
-
res.statusCode = 410; // Gone
|
|
107
|
-
res.send(`transaction not found`);
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
clearTimeout(tx.timeout);
|
|
111
|
-
_transactions.delete(tx.id);
|
|
112
|
-
|
|
113
|
-
const access = env.rules.userHasAccess(req.user, tx.path, true);
|
|
114
|
-
if (!access.allow) {
|
|
115
|
-
env.log.error(LOG_ACTION, 'unauthorized', { ...LOG_DETAILS, rule_code: access.code, rule_path: access.rulePath ?? null }, access.details);
|
|
116
|
-
return sendUnauthorizedError(res, access.code, access.message);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Finish transaction
|
|
120
|
-
try {
|
|
121
|
-
let cancel = false;
|
|
122
|
-
if (typeof data.value === 'object' && (data.value === null || Object.keys(data.value).length === 0)) {
|
|
123
|
-
// Returning undefined from a transaction callback should cancel the transaction
|
|
124
|
-
// acebase-client (Transport.serialize) serializes value undefined as { val: undefined, map: undefined }, which
|
|
125
|
-
// then is sent to the server as an empty object: {}
|
|
126
|
-
cancel = true;
|
|
127
|
-
}
|
|
128
|
-
else if (typeof data.value?.val === 'undefined' || !['string','object','undefined'].includes(typeof data.value?.map)) {
|
|
129
|
-
throw new DataTransactionError('invalid_serialized_value', 'The sent value is not properly serialized');
|
|
130
|
-
}
|
|
131
|
-
const newValue = cancel ? undefined : Transport.deserialize(data.value);
|
|
132
|
-
|
|
133
|
-
if (tx.path === '' && req.user?.uid !== 'admin' && newValue !== null && typeof newValue === 'object') {
|
|
134
|
-
// Non-admin user: remove any private properties from the update object
|
|
135
|
-
Object.keys(newValue).filter(key => key.startsWith('__')).forEach(key => delete newValue[key]);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const result = await tx.finish(newValue);
|
|
140
|
-
|
|
141
|
-
// NEW: capture cursor and return it in the response context header
|
|
142
|
-
if (!tx.context) { tx.context = {}; }
|
|
143
|
-
tx.context.acebase_cursor = result.cursor;
|
|
144
|
-
res.setHeader('AceBase-Context', JSON.stringify(tx.context));
|
|
145
|
-
|
|
146
|
-
res.send('done');
|
|
147
|
-
}
|
|
148
|
-
catch (err) {
|
|
149
|
-
tx.finish(); // Finish without value cancels the transaction
|
|
150
|
-
if (err instanceof SchemaValidationError) {
|
|
151
|
-
env.log.error(LOG_ACTION, 'schema_validation_failed', { ...LOG_DETAILS, reason: err.reason });
|
|
152
|
-
res.status(422).send({ code: 'schema_validation_failed', message: err.message });
|
|
153
|
-
}
|
|
154
|
-
else if (err instanceof DataTransactionError) {
|
|
155
|
-
env.log.error(LOG_ACTION, err.code, { ...LOG_DETAILS, message: err.message });
|
|
156
|
-
sendBadRequestError(res, err);
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
env.debug.error(`failed to finish transaction on "${tx.path}":`, err);
|
|
160
|
-
env.log.error(LOG_ACTION, 'unexpected', LOG_DETAILS, err);
|
|
161
|
-
sendError(res, err);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
export default addRoutes;
|
|
@@ -1,85 +0,0 @@
|
|
|
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
|
-
|
|
28
|
-
const path = req.path.slice(env.db.name.length + 7);
|
|
29
|
-
const LOG_ACTION = 'data.update';
|
|
30
|
-
const LOG_DETAILS = { ip: req.ip, uid: req.user?.uid ?? null, path };
|
|
31
|
-
|
|
32
|
-
const access = env.rules.userHasAccess(req.user, path, true);
|
|
33
|
-
if (!access.allow) {
|
|
34
|
-
env.log.error(LOG_ACTION, 'unauthorized', { ...LOG_DETAILS, rule_code: access.code, rule_path: access.rulePath ?? null, rule_error: access.details?.message ?? null });
|
|
35
|
-
return sendUnauthorizedError(res, access.code, access.message);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
try {
|
|
39
|
-
const data = req.body;
|
|
40
|
-
if (typeof data?.val === 'undefined' || !['string','object','undefined'].includes(typeof data?.map)) {
|
|
41
|
-
throw new UpdateDataError('invalid_serialized_value', 'The sent value is not properly serialized');
|
|
42
|
-
}
|
|
43
|
-
const val = Transport.deserialize(data);
|
|
44
|
-
|
|
45
|
-
if (path === '' && req.user?.uid !== 'admin' && val !== null && typeof val === 'object') {
|
|
46
|
-
// Non-admin user: remove any private properties from the update object
|
|
47
|
-
Object.keys(val).filter(key => key.startsWith('__')).forEach(key => delete val[key]);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Schema validation moved to storage, no need to check here but an early check won't do no harm!
|
|
51
|
-
const validation = await env.db.schema.check(path, val, true);
|
|
52
|
-
if (!validation.ok) {
|
|
53
|
-
throw new SchemaValidationError(validation.reason);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
await env.db.ref(path)
|
|
57
|
-
.context(req.context)
|
|
58
|
-
.update(val);
|
|
59
|
-
|
|
60
|
-
// NEW: add cursor to response context, which was added to the request context in `acebase_cursor` if transaction logging is enabled
|
|
61
|
-
const returnContext = { acebase_cursor: req.context.acebase_cursor };
|
|
62
|
-
res.setHeader('AceBase-Context', JSON.stringify(returnContext) );
|
|
63
|
-
|
|
64
|
-
res.send({ success: true });
|
|
65
|
-
}
|
|
66
|
-
catch(err) {
|
|
67
|
-
if (err instanceof SchemaValidationError) {
|
|
68
|
-
env.log.error(LOG_ACTION, 'schema_validation_failed', { ...LOG_DETAILS, reason: err.reason });
|
|
69
|
-
res.status(422).send({ code: 'schema_validation_failed', message: err.message });
|
|
70
|
-
}
|
|
71
|
-
else if (err instanceof UpdateDataError) {
|
|
72
|
-
env.log.error(LOG_ACTION, err.code, { ...LOG_DETAILS, message: err.message });
|
|
73
|
-
sendBadRequestError(res, err);
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
env.debug.error(`failed to update "${path}":`, err);
|
|
77
|
-
env.log.error(LOG_ACTION, 'unexpected', LOG_DETAILS, err);
|
|
78
|
-
sendError(res, err);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export default addRoute;
|
|
@@ -1,77 +0,0 @@
|
|
|
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
|
-
headers:
|
|
40
|
-
'AceBase-Context':
|
|
41
|
-
description: Returns contextual information, such as the `acebase_cursor` if transaction logging is enabled on the server.
|
|
42
|
-
schema:
|
|
43
|
-
type: string
|
|
44
|
-
example: '{ "acebase_cursor": "l3lf2iwd000109mgdn0d6pqt" }'
|
|
45
|
-
schema:
|
|
46
|
-
type: object
|
|
47
|
-
properties:
|
|
48
|
-
success:
|
|
49
|
-
type: boolean
|
|
50
|
-
example: true
|
|
51
|
-
400:
|
|
52
|
-
description: Returns "400 Bad Request" if the sent value is incorrect
|
|
53
|
-
content:
|
|
54
|
-
'application/json':
|
|
55
|
-
schema:
|
|
56
|
-
$ref: '#/components/schemas/Error'
|
|
57
|
-
example:
|
|
58
|
-
code: invalid_serialized_value
|
|
59
|
-
message: The sent value is not properly serialized
|
|
60
|
-
403:
|
|
61
|
-
description: Returns "403 Forbidden" if the signed in user is not allowed to write to the target path
|
|
62
|
-
content:
|
|
63
|
-
'application/json':
|
|
64
|
-
schema:
|
|
65
|
-
$ref: '#/components/schemas/Error'
|
|
66
|
-
422:
|
|
67
|
-
description: Returns "422 Unprocessable Entity" if schema validation for the sent value failed.
|
|
68
|
-
content:
|
|
69
|
-
'application/json':
|
|
70
|
-
schema:
|
|
71
|
-
$ref: '#/components/schemas/SchemaValidationError'
|
|
72
|
-
500:
|
|
73
|
-
description: An unexpected error occurred
|
|
74
|
-
content:
|
|
75
|
-
'application/json':
|
|
76
|
-
schema:
|
|
77
|
-
$ref: '#/components/schemas/UnexpectedError'
|
package/src/routes/data.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
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;
|