@directus/api 17.0.0 → 17.1.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.
Files changed (79) hide show
  1. package/dist/controllers/fields.js +0 -3
  2. package/dist/controllers/items.js +8 -7
  3. package/dist/extensions/lib/sandbox/generate-api-extensions-sandbox-entrypoint.d.ts +1 -1
  4. package/dist/flows.js +2 -1
  5. package/dist/middleware/collection-exists.js +6 -6
  6. package/dist/operations/item-update/index.js +4 -1
  7. package/dist/operations/request/index.js +5 -5
  8. package/dist/request/agent-with-ip-validation.d.ts +11 -0
  9. package/dist/request/agent-with-ip-validation.js +34 -0
  10. package/dist/request/index.js +6 -5
  11. package/dist/request/is-denied-ip.d.ts +1 -0
  12. package/dist/request/{validate-ip.js → is-denied-ip.js} +10 -12
  13. package/dist/services/collections.d.ts +3 -2
  14. package/dist/services/collections.js +1 -1
  15. package/dist/services/fields.js +8 -1
  16. package/dist/services/files.js +4 -3
  17. package/dist/services/graphql/index.js +3 -2
  18. package/dist/services/import-export.js +62 -26
  19. package/dist/services/items.js +2 -1
  20. package/dist/services/permissions.js +1 -1
  21. package/dist/services/relations.js +1 -1
  22. package/dist/services/roles.d.ts +9 -4
  23. package/dist/services/roles.js +50 -2
  24. package/dist/services/specifications.js +4 -3
  25. package/dist/services/utils.js +1 -1
  26. package/dist/telemetry/utils/get-user-item-count.js +2 -1
  27. package/dist/types/collection.d.ts +2 -13
  28. package/dist/utils/get-field-system-rows.d.ts +2 -0
  29. package/dist/utils/get-field-system-rows.js +17 -0
  30. package/dist/utils/get-permissions.js +1 -1
  31. package/dist/utils/get-schema.js +3 -2
  32. package/dist/utils/merge-permissions-for-share.js +1 -1
  33. package/dist/utils/should-skip-cache.js +1 -1
  34. package/dist/websocket/controllers/hooks.js +1 -1
  35. package/dist/websocket/handlers/items.js +2 -1
  36. package/dist/websocket/messages.d.ts +18 -18
  37. package/package.json +42 -41
  38. package/dist/database/system-data/app-access-permissions/app-access-permissions.yaml +0 -107
  39. package/dist/database/system-data/app-access-permissions/index.d.ts +0 -3
  40. package/dist/database/system-data/app-access-permissions/index.js +0 -17
  41. package/dist/database/system-data/app-access-permissions/schema-access-permissions.yaml +0 -17
  42. package/dist/database/system-data/collections/collections.yaml +0 -103
  43. package/dist/database/system-data/collections/index.d.ts +0 -2
  44. package/dist/database/system-data/collections/index.js +0 -9
  45. package/dist/database/system-data/fields/_defaults.yaml +0 -16
  46. package/dist/database/system-data/fields/activity.yaml +0 -83
  47. package/dist/database/system-data/fields/collections.yaml +0 -249
  48. package/dist/database/system-data/fields/dashboards.yaml +0 -20
  49. package/dist/database/system-data/fields/extensions.yaml +0 -10
  50. package/dist/database/system-data/fields/fields.yaml +0 -104
  51. package/dist/database/system-data/fields/files.yaml +0 -160
  52. package/dist/database/system-data/fields/flows.yaml +0 -26
  53. package/dist/database/system-data/fields/folders.yaml +0 -14
  54. package/dist/database/system-data/fields/index.d.ts +0 -2
  55. package/dist/database/system-data/fields/index.js +0 -33
  56. package/dist/database/system-data/fields/migrations.yaml +0 -10
  57. package/dist/database/system-data/fields/notifications.yaml +0 -15
  58. package/dist/database/system-data/fields/operations.yaml +0 -23
  59. package/dist/database/system-data/fields/panels.yaml +0 -29
  60. package/dist/database/system-data/fields/permissions.yaml +0 -37
  61. package/dist/database/system-data/fields/presets.yaml +0 -56
  62. package/dist/database/system-data/fields/relations.yaml +0 -34
  63. package/dist/database/system-data/fields/revisions.yaml +0 -30
  64. package/dist/database/system-data/fields/roles.yaml +0 -61
  65. package/dist/database/system-data/fields/sessions.yaml +0 -16
  66. package/dist/database/system-data/fields/settings.yaml +0 -471
  67. package/dist/database/system-data/fields/shares.yaml +0 -83
  68. package/dist/database/system-data/fields/translations.yaml +0 -27
  69. package/dist/database/system-data/fields/users.yaml +0 -224
  70. package/dist/database/system-data/fields/versions.yaml +0 -38
  71. package/dist/database/system-data/fields/webhooks.yaml +0 -141
  72. package/dist/database/system-data/relations/index.d.ts +0 -2
  73. package/dist/database/system-data/relations/index.js +0 -9
  74. package/dist/database/system-data/relations/relations.yaml +0 -197
  75. package/dist/request/request-interceptor.d.ts +0 -2
  76. package/dist/request/request-interceptor.js +0 -28
  77. package/dist/request/response-interceptor.d.ts +0 -2
  78. package/dist/request/response-interceptor.js +0 -5
  79. package/dist/request/validate-ip.d.ts +0 -1
@@ -1,224 +0,0 @@
1
- table: directus_users
2
-
3
- fields:
4
- - field: first_name
5
- interface: input
6
- options:
7
- iconRight: account_circle
8
- width: half
9
-
10
- - field: last_name
11
- interface: input
12
- options:
13
- iconRight: account_circle
14
- width: half
15
-
16
- - field: email
17
- interface: input
18
- options:
19
- iconRight: email
20
- width: half
21
-
22
- - field: password
23
- special:
24
- - hash
25
- - conceal
26
- interface: input-hash
27
- options:
28
- iconRight: lock
29
- masked: true
30
- width: half
31
-
32
- - field: avatar
33
- interface: file
34
- width: full
35
- display: image
36
-
37
- - field: location
38
- interface: input
39
- options:
40
- iconRight: place
41
- width: half
42
-
43
- - field: title
44
- interface: input
45
- options:
46
- iconRight: work
47
- width: half
48
-
49
- - field: description
50
- interface: input-multiline
51
- width: full
52
-
53
- - field: tags
54
- interface: tags
55
- special:
56
- - cast-json
57
- width: full
58
- options:
59
- iconRight: local_offer
60
- display: labels
61
- display_options:
62
- choices: null
63
- format: false
64
-
65
- - field: preferences_divider
66
- interface: presentation-divider
67
- options:
68
- icon: face
69
- title: $t:fields.directus_users.user_preferences
70
- special:
71
- - alias
72
- - no-data
73
- width: full
74
-
75
- - field: language
76
- interface: system-language
77
- width: half
78
- options:
79
- includeProjectDefault: true
80
-
81
- - field: tfa_secret
82
- interface: system-mfa-setup
83
- special:
84
- - conceal
85
- width: half
86
-
87
- - field: email_notifications
88
- interface: boolean
89
- width: half
90
- special:
91
- - cast-boolean
92
-
93
- - field: theming_divider
94
- interface: presentation-divider
95
- options:
96
- icon: palette
97
- title: $t:theme
98
- special:
99
- - alias
100
- - no-data
101
- width: full
102
-
103
- - field: appearance
104
- interface: select-dropdown
105
- options:
106
- choices:
107
- - value: null
108
- text: $t:default_sync_with_project
109
- - value: auto
110
- text: $t:appearance_auto
111
- - value: light
112
- text: $t:appearance_light
113
- - value: dark
114
- text: $t:appearance_dark
115
- width: half
116
-
117
- - field: theme_light
118
- width: full
119
- interface: system-theme
120
- options:
121
- appearance: light
122
- includeNull: true
123
-
124
- - field: theme_light_overrides
125
- width: full
126
- interface: system-theme-overrides
127
- options:
128
- appearance: light
129
- special:
130
- - cast-json
131
-
132
- - field: theme_dark
133
- width: full
134
- interface: system-theme
135
- options:
136
- appearance: dark
137
- includeNull: true
138
-
139
- - field: theme_dark_overrides
140
- width: full
141
- interface: system-theme-overrides
142
- options:
143
- appearance: dark
144
- special:
145
- - cast-json
146
-
147
- - field: admin_divider
148
- interface: presentation-divider
149
- options:
150
- icon: verified_user
151
- title: $t:fields.directus_users.admin_options
152
- color: 'var(--theme--danger)'
153
- special:
154
- - alias
155
- - no-data
156
- width: full
157
-
158
- - field: status
159
- interface: select-dropdown
160
- options:
161
- choices:
162
- - text: $t:fields.directus_users.status_draft
163
- value: draft
164
- - text: $t:fields.directus_users.status_invited
165
- value: invited
166
- - text: $t:fields.directus_users.status_active
167
- value: active
168
- - text: $t:fields.directus_users.status_suspended
169
- value: suspended
170
- - text: $t:fields.directus_users.status_archived
171
- value: archived
172
- width: half
173
-
174
- - field: role
175
- interface: select-dropdown-m2o
176
- options:
177
- template: '{{ name }}'
178
- special:
179
- - m2o
180
- width: half
181
- display: related-values
182
- display_options:
183
- template: '{{ name }}'
184
-
185
- - field: token
186
- interface: system-token
187
- special:
188
- - conceal
189
- width: full
190
-
191
- - field: id
192
- special:
193
- - uuid
194
- interface: input
195
- options:
196
- iconRight: vpn_key
197
- width: full
198
-
199
- - field: last_page
200
- width: half
201
-
202
- - field: last_access
203
- width: half
204
- display: datetime
205
- readonly: true
206
- display_options:
207
- relative: true
208
-
209
- - field: provider
210
- width: half
211
- interface: select-dropdown
212
- options:
213
- choices:
214
- - text: $t:default_provider
215
- value: default
216
-
217
- - field: external_identifier
218
- width: half
219
- options:
220
- iconRight: account_circle
221
- interface: input
222
-
223
- - field: auth_data
224
- hidden: true
@@ -1,38 +0,0 @@
1
- table: directus_versions
2
-
3
- fields:
4
- - field: id
5
- special:
6
- - uuid
7
- readonly: true
8
- hidden: true
9
-
10
- - field: key
11
-
12
- - field: name
13
-
14
- - field: collection
15
-
16
- - field: item
17
-
18
- - field: hash
19
- readonly: true
20
- hidden: true
21
-
22
- - field: date_created
23
- special:
24
- - date-created
25
- - cast-timestamp
26
-
27
- - field: date_updated
28
- special:
29
- - date-updated
30
- - cast-timestamp
31
-
32
- - field: user_created
33
- special:
34
- - user-created
35
-
36
- - field: user_updated
37
- special:
38
- - user-updated
@@ -1,141 +0,0 @@
1
- table: directus_webhooks
2
-
3
- fields:
4
- - field: id
5
- hidden: true
6
-
7
- - field: name
8
- interface: input
9
- options:
10
- iconRight: title
11
- width: full
12
-
13
- - field: method
14
- interface: select-dropdown
15
- display: labels
16
- display_options:
17
- choices:
18
- - value: POST
19
- foreground: 'var(--theme--primary)'
20
- background: 'var(--theme--primary-subdued)'
21
- - value: GET
22
- foreground: 'var(--theme--secondary)'
23
- background: 'var(--secondary-25)'
24
- format: false
25
- options:
26
- choices:
27
- - GET
28
- - POST
29
- width: half
30
-
31
- - field: url
32
- interface: input
33
- options:
34
- iconRight: link
35
- width: half
36
-
37
- - field: status
38
- interface: select-dropdown
39
- display: labels
40
- display_options:
41
- showAsDot: true
42
- choices:
43
- - text: $t:field_options.directus_webhooks.status_options_active
44
- value: active
45
- foreground: 'var(--theme--primary-background)'
46
- background: 'var(--theme--primary)'
47
- - text: $t:field_options.directus_webhooks.status_options_inactive
48
- value: inactive
49
- foreground: 'var(--theme--foreground)'
50
- background: 'var(--background-normal-alt)'
51
- options:
52
- choices:
53
- - text: $t:field_options.directus_webhooks.status_options_active
54
- value: active
55
- - text: $t:field_options.directus_webhooks.status_options_inactive
56
- value: inactive
57
- width: half
58
-
59
- - field: data
60
- interface: boolean
61
- options:
62
- label: $t:fields.directus_webhooks.data_label
63
- special:
64
- - cast-boolean
65
- width: half
66
- display: boolean
67
-
68
- - field: headers
69
- special:
70
- - cast-json
71
- interface: list
72
- options:
73
- template: '{{ header }}: {{ value }}'
74
- addLabel: $t:field_options.directus_webhooks.headers.add
75
- fields:
76
- - field: header
77
- name: $t:field_options.directus_webhooks.headers.header
78
- type: string
79
- meta:
80
- interface: input
81
- width: half
82
- - field: value
83
- name: $t:field_options.directus_webhooks.headers.value
84
- type: string
85
- meta:
86
- interface: input
87
- width: half
88
- width: full
89
-
90
- - field: triggers_divider
91
- interface: presentation-divider
92
- options:
93
- icon: api
94
- title: $t:fields.directus_webhooks.triggers
95
- special:
96
- - alias
97
- - no-data
98
- width: full
99
-
100
- - field: actions
101
- interface: select-multiple-checkbox
102
- options:
103
- choices:
104
- - text: $t:create
105
- value: create
106
- - text: $t:update
107
- value: update
108
- - text: $t:delete_label
109
- value: delete
110
- special:
111
- - cast-csv
112
- width: full
113
- display: labels
114
- display_options:
115
- choices:
116
- - text: $t:create
117
- value: create
118
- foreground: 'var(--theme--primary)'
119
- background: 'var(--theme--primary-subdued)'
120
- - text: $t:update
121
- value: update
122
- foreground: 'var(--blue)'
123
- background: 'var(--blue-25)'
124
- - text: $t:delete_label
125
- value: delete
126
- foreground: 'var(--theme--danger)'
127
- background: 'var(--danger-25)'
128
- - text: $t:login
129
- value: login
130
- foreground: 'var(--purple)'
131
- background: 'var(--purple-25)'
132
-
133
- - field: collections
134
- interface: system-collections
135
- special:
136
- - cast-csv
137
- width: full
138
- display: labels
139
- display_options:
140
- choices: null
141
- format: false
@@ -1,2 +0,0 @@
1
- import type { RelationMeta } from '@directus/types';
2
- export declare const systemRelationRows: RelationMeta[];
@@ -1,9 +0,0 @@
1
- import { merge } from 'lodash-es';
2
- import { requireYAML } from '../../../utils/require-yaml.js';
3
- import { dirname, resolve } from 'node:path';
4
- import { fileURLToPath } from 'node:url';
5
- const __dirname = dirname(fileURLToPath(import.meta.url));
6
- const systemData = requireYAML(resolve(__dirname, './relations.yaml'));
7
- export const systemRelationRows = systemData.data.map((row) => {
8
- return merge({ system: true }, systemData.defaults, row);
9
- });
@@ -1,197 +0,0 @@
1
- table: directus_relations
2
-
3
- defaults:
4
- many_collection: directus_users
5
- many_field: null
6
- one_collection: null
7
- one_field: null
8
- one_allowed_collections: null
9
- one_collection_field: null
10
- one_deselect_action: 'nullify'
11
- junction_field: null
12
- sort_field: null
13
-
14
- data:
15
- ### Collections
16
- - many_collection: directus_collections
17
- many_field: group
18
- one_collection: directus_collections
19
-
20
- ### Users
21
- - many_collection: directus_users
22
- many_field: role
23
- one_collection: directus_roles
24
- one_field: users
25
-
26
- - many_collection: directus_users
27
- many_field: avatar
28
- one_collection: directus_files
29
-
30
- ### Revisions
31
- - many_collection: directus_revisions
32
- many_field: activity
33
- one_collection: directus_activity
34
- one_field: revisions
35
-
36
- - many_collection: directus_revisions
37
- many_field: parent
38
- one_collection: directus_revisions
39
-
40
- - many_collection: directus_revisions
41
- many_field: version
42
- one_collection: directus_versions
43
-
44
- ### Presets
45
- - many_collection: directus_presets
46
- many_field: user
47
- one_collection: directus_users
48
-
49
- - many_collection: directus_presets
50
- many_field: role
51
- one_collection: directus_roles
52
-
53
- ### Folders
54
- - many_collection: directus_folders
55
- many_field: parent
56
- one_collection: directus_folders
57
-
58
- ### Files
59
- - many_collection: directus_files
60
- many_field: folder
61
- one_collection: directus_folders
62
-
63
- - many_collection: directus_files
64
- many_field: uploaded_by
65
- one_collection: directus_users
66
-
67
- - many_collection: directus_files
68
- many_field: modified_by
69
- one_collection: directus_users
70
-
71
- ### Fields
72
- - many_collection: directus_fields
73
- many_field: collection
74
- one_collection: directus_collections
75
- one_field: fields
76
-
77
- - many_collection: directus_fields
78
- many_field: group
79
- one_collection: directus_fields
80
-
81
- ### Activity
82
- - many_collection: directus_activity
83
- many_field: user
84
- one_collection: directus_users
85
-
86
- ### Settings
87
- - many_collection: directus_settings
88
- many_field: project_logo
89
- one_collection: directus_files
90
-
91
- - many_collection: directus_settings
92
- many_field: public_foreground
93
- one_collection: directus_files
94
-
95
- - many_collection: directus_settings
96
- many_field: public_background
97
- one_collection: directus_files
98
-
99
- - many_collection: directus_settings
100
- many_field: public_favicon
101
- one_collection: directus_files
102
-
103
- - many_collection: directus_settings
104
- many_field: storage_default_folder
105
- one_collection: directus_folders
106
-
107
- ### Panels
108
- - many_collection: directus_panels
109
- many_field: dashboard
110
- one_collection: directus_dashboards
111
- one_field: panels
112
-
113
- - many_collection: directus_panels
114
- many_field: user_created
115
- one_collection: directus_users
116
-
117
- ### Flows
118
- - many_collection: directus_flows
119
- many_field: operation
120
- one_collection: directus_operations
121
-
122
- - many_collection: directus_flows
123
- many_field: user_created
124
- one_collection: directus_users
125
-
126
- ### Operations
127
- - many_collection: directus_operations
128
- many_field: flow
129
- one_collection: directus_flows
130
- one_field: operations
131
- one_deselect_action: delete
132
-
133
- - many_collection: directus_operations
134
- many_field: resolve
135
- one_collection: directus_operations
136
-
137
- - many_collection: directus_operations
138
- many_field: reject
139
- one_collection: directus_operations
140
-
141
- - many_collection: directus_operations
142
- many_field: user_created
143
- one_collection: directus_users
144
-
145
- ### Permissions
146
- - many_collection: directus_permissions
147
- many_field: role
148
- one_collection: directus_roles
149
-
150
- ### Sessions
151
- - many_collection: directus_sessions
152
- many_field: user
153
- one_collection: directus_users
154
-
155
- - many_collection: directus_sessions
156
- many_field: share
157
- one_collection: directus_shares
158
-
159
- ### Dashboards
160
- - many_collection: directus_dashboards
161
- many_field: user_created
162
- one_collection: directus_users
163
-
164
- ### Notifications
165
- - many_collection: directus_notifications
166
- many_field: recipient
167
- one_collection: directus_users
168
-
169
- - many_collection: directus_notifications
170
- many_field: sender
171
- one_collection: directus_users
172
-
173
- ### Shares
174
- - many_collection: directus_shares
175
- many_field: role
176
- one_collection: directus_roles
177
-
178
- - many_collection: directus_shares
179
- many_field: collection
180
- one_collection: directus_collections
181
-
182
- - many_collection: directus_shares
183
- many_field: user_created
184
- one_collection: directus_users
185
-
186
- ### Versions
187
- - many_collection: directus_versions
188
- many_field: collection
189
- one_collection: directus_collections
190
-
191
- - many_collection: directus_versions
192
- many_field: user_created
193
- one_collection: directus_users
194
-
195
- - many_collection: directus_versions
196
- many_field: user_updated
197
- one_collection: directus_users
@@ -1,2 +0,0 @@
1
- import type { InternalAxiosRequestConfig } from 'axios';
2
- export declare const requestInterceptor: (config: InternalAxiosRequestConfig) => Promise<InternalAxiosRequestConfig<any>>;
@@ -1,28 +0,0 @@
1
- import axios from 'axios';
2
- import { lookup } from 'node:dns/promises';
3
- import { isIP } from 'node:net';
4
- import { URL } from 'node:url';
5
- import { useLogger } from '../logger.js';
6
- import { validateIp } from './validate-ip.js';
7
- export const requestInterceptor = async (config) => {
8
- const logger = useLogger();
9
- const uri = axios.getUri(config);
10
- const { hostname } = new URL(uri);
11
- let ip;
12
- if (isIP(hostname) === 0) {
13
- try {
14
- const dns = await lookup(hostname);
15
- ip = dns.address;
16
- }
17
- catch (error) {
18
- logger.warn(`Couldn't lookup the DNS for URL "${uri}"`);
19
- logger.warn(error);
20
- throw new Error(`Requested URL "${uri}" resolves to a denied IP address`);
21
- }
22
- }
23
- else {
24
- ip = hostname;
25
- }
26
- validateIp(ip, uri);
27
- return config;
28
- };
@@ -1,2 +0,0 @@
1
- import type { AxiosResponse } from 'axios';
2
- export declare const responseInterceptor: (config: AxiosResponse<any, any>) => Promise<AxiosResponse<any, any>>;
@@ -1,5 +0,0 @@
1
- import { validateIp } from './validate-ip.js';
2
- export const responseInterceptor = async (config) => {
3
- validateIp(config.request.socket.remoteAddress, config.request.url);
4
- return config;
5
- };
@@ -1 +0,0 @@
1
- export declare function validateIp(ip: string, url: string): void;