@directus/api 16.0.0 → 17.0.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 (92) hide show
  1. package/dist/controllers/items.js +8 -7
  2. package/dist/controllers/permissions.js +11 -2
  3. package/dist/controllers/utils.js +13 -32
  4. package/dist/extensions/lib/sandbox/generate-api-extensions-sandbox-entrypoint.d.ts +1 -1
  5. package/dist/flows.js +2 -1
  6. package/dist/middleware/collection-exists.js +6 -6
  7. package/dist/middleware/respond.js +1 -1
  8. package/dist/operations/request/index.js +5 -5
  9. package/dist/request/agent-with-ip-validation.d.ts +11 -0
  10. package/dist/request/agent-with-ip-validation.js +34 -0
  11. package/dist/request/index.js +6 -5
  12. package/dist/request/is-denied-ip.d.ts +1 -0
  13. package/dist/request/{validate-ip.js → is-denied-ip.js} +10 -12
  14. package/dist/services/assets.js +1 -3
  15. package/dist/services/authorization.d.ts +1 -1
  16. package/dist/services/authorization.js +15 -3
  17. package/dist/services/collections.d.ts +3 -2
  18. package/dist/services/collections.js +1 -1
  19. package/dist/services/fields.js +2 -1
  20. package/dist/services/files.js +4 -3
  21. package/dist/services/graphql/index.js +3 -2
  22. package/dist/services/{import-export/index.d.ts → import-export.d.ts} +1 -1
  23. package/dist/services/{import-export/index.js → import-export.js} +12 -11
  24. package/dist/services/index.d.ts +1 -1
  25. package/dist/services/index.js +1 -1
  26. package/dist/services/items.js +2 -1
  27. package/dist/services/permissions.d.ts +3 -2
  28. package/dist/services/permissions.js +77 -2
  29. package/dist/services/relations.js +1 -1
  30. package/dist/services/roles.js +83 -15
  31. package/dist/services/server.js +2 -1
  32. package/dist/services/specifications.js +4 -3
  33. package/dist/services/utils.js +1 -1
  34. package/dist/telemetry/utils/get-user-item-count.js +2 -1
  35. package/dist/types/collection.d.ts +2 -13
  36. package/dist/types/items.d.ts +4 -12
  37. package/dist/types/items.js +0 -4
  38. package/dist/utils/get-field-system-rows.d.ts +2 -0
  39. package/dist/utils/get-field-system-rows.js +17 -0
  40. package/dist/utils/get-permissions.js +1 -1
  41. package/dist/utils/get-schema.js +3 -2
  42. package/dist/utils/merge-permissions-for-share.js +1 -1
  43. package/dist/utils/should-skip-cache.js +1 -1
  44. package/dist/websocket/handlers/items.js +2 -1
  45. package/dist/websocket/messages.d.ts +18 -18
  46. package/package.json +36 -35
  47. package/dist/database/system-data/app-access-permissions/app-access-permissions.yaml +0 -107
  48. package/dist/database/system-data/app-access-permissions/index.d.ts +0 -3
  49. package/dist/database/system-data/app-access-permissions/index.js +0 -17
  50. package/dist/database/system-data/app-access-permissions/schema-access-permissions.yaml +0 -17
  51. package/dist/database/system-data/collections/collections.yaml +0 -103
  52. package/dist/database/system-data/collections/index.d.ts +0 -2
  53. package/dist/database/system-data/collections/index.js +0 -9
  54. package/dist/database/system-data/fields/_defaults.yaml +0 -16
  55. package/dist/database/system-data/fields/activity.yaml +0 -83
  56. package/dist/database/system-data/fields/collections.yaml +0 -249
  57. package/dist/database/system-data/fields/dashboards.yaml +0 -20
  58. package/dist/database/system-data/fields/extensions.yaml +0 -10
  59. package/dist/database/system-data/fields/fields.yaml +0 -104
  60. package/dist/database/system-data/fields/files.yaml +0 -160
  61. package/dist/database/system-data/fields/flows.yaml +0 -26
  62. package/dist/database/system-data/fields/folders.yaml +0 -14
  63. package/dist/database/system-data/fields/index.d.ts +0 -2
  64. package/dist/database/system-data/fields/index.js +0 -33
  65. package/dist/database/system-data/fields/migrations.yaml +0 -10
  66. package/dist/database/system-data/fields/notifications.yaml +0 -15
  67. package/dist/database/system-data/fields/operations.yaml +0 -23
  68. package/dist/database/system-data/fields/panels.yaml +0 -29
  69. package/dist/database/system-data/fields/permissions.yaml +0 -37
  70. package/dist/database/system-data/fields/presets.yaml +0 -56
  71. package/dist/database/system-data/fields/relations.yaml +0 -34
  72. package/dist/database/system-data/fields/revisions.yaml +0 -30
  73. package/dist/database/system-data/fields/roles.yaml +0 -61
  74. package/dist/database/system-data/fields/sessions.yaml +0 -16
  75. package/dist/database/system-data/fields/settings.yaml +0 -471
  76. package/dist/database/system-data/fields/shares.yaml +0 -83
  77. package/dist/database/system-data/fields/translations.yaml +0 -27
  78. package/dist/database/system-data/fields/users.yaml +0 -224
  79. package/dist/database/system-data/fields/versions.yaml +0 -38
  80. package/dist/database/system-data/fields/webhooks.yaml +0 -141
  81. package/dist/database/system-data/relations/index.d.ts +0 -2
  82. package/dist/database/system-data/relations/index.js +0 -9
  83. package/dist/database/system-data/relations/relations.yaml +0 -197
  84. package/dist/request/request-interceptor.d.ts +0 -2
  85. package/dist/request/request-interceptor.js +0 -28
  86. package/dist/request/response-interceptor.d.ts +0 -2
  87. package/dist/request/response-interceptor.js +0 -5
  88. package/dist/request/validate-ip.d.ts +0 -1
  89. package/dist/services/import-export/import-worker.d.ts +0 -9
  90. package/dist/services/import-export/import-worker.js +0 -9
  91. package/dist/worker-pool.d.ts +0 -2
  92. package/dist/worker-pool.js +0 -19
@@ -1,249 +0,0 @@
1
- table: directus_collections
2
-
3
- fields:
4
- - field: collection_divider
5
- special:
6
- - alias
7
- - no-data
8
- interface: presentation-divider
9
- options:
10
- icon: box
11
- title: $t:field_options.directus_collections.collection_setup
12
- width: full
13
-
14
- - field: collection
15
- interface: input
16
- options:
17
- font: monospace
18
- readonly: true
19
- width: half
20
-
21
- - field: note
22
- interface: input
23
- options:
24
- placeholder: $t:field_options.directus_collections.note_placeholder
25
- width: half
26
-
27
- - field: icon
28
- interface: select-icon
29
- options:
30
- width: half
31
-
32
- - field: color
33
- interface: select-color
34
- options:
35
- placeholder: $t:interfaces.select-color.placeholder
36
- width: half
37
-
38
- - field: display_template
39
- interface: system-display-template
40
- options:
41
- collectionField: collection
42
- width: full
43
-
44
- - field: hidden
45
- special:
46
- - cast-boolean
47
- interface: boolean
48
- options:
49
- label: $t:field_options.directus_collections.hidden_label
50
- width: half
51
-
52
- - field: singleton
53
- special:
54
- - cast-boolean
55
- interface: boolean
56
- options:
57
- label: $t:singleton_label
58
- width: half
59
-
60
- - field: translations
61
- special:
62
- - cast-json
63
- interface: list
64
- options:
65
- template: '{{ translation }} ({{ language }})'
66
- fields:
67
- - field: language
68
- name: $t:language
69
- type: string
70
- schema:
71
- default_value: en-US
72
- meta:
73
- interface: system-language
74
- width: half
75
- required: true
76
- - field: translation
77
- name: $t:field_options.directus_collections.collection_name
78
- type: string
79
- meta:
80
- interface: input
81
- width: half
82
- required: true
83
- options:
84
- placeholder: $t:field_options.directus_collections.translation_placeholder
85
- - field: singular
86
- name: $t:field_options.directus_collections.singular_unit
87
- type: string
88
- meta:
89
- interface: input
90
- width: half
91
- options:
92
- placeholder: $t:field_options.directus_collections.translation_placeholder
93
- - field: plural
94
- name: $t:field_options.directus_collections.plural_unit
95
- type: string
96
- meta:
97
- interface: input
98
- width: half
99
- options:
100
- placeholder: $t:field_options.directus_collections.translation_placeholder
101
- width: full
102
-
103
- - field: preview_divider
104
- special:
105
- - alias
106
- - no-data
107
- interface: presentation-divider
108
- options:
109
- icon: preview
110
- title: $t:field_options.directus_collections.preview_divider
111
- width: full
112
-
113
- - field: preview_url
114
- interface: system-display-template
115
- options:
116
- collectionField: collection
117
- injectVersionField: true
118
- width: full
119
-
120
- - field: content_versioning_divider
121
- special:
122
- - alias
123
- - no-data
124
- interface: presentation-divider
125
- options:
126
- icon: published_with_changes
127
- title: $t:field_options.directus_collections.content_versioning_divider
128
- width: full
129
-
130
- - field: versioning
131
- interface: boolean
132
- special:
133
- - cast-boolean
134
- options:
135
- label: $t:field_options.directus_collections.enable_versioning
136
- width: half
137
-
138
- - field: archive_divider
139
- special:
140
- - alias
141
- - no-data
142
- interface: presentation-divider
143
- options:
144
- icon: archive
145
- title: $t:field_options.directus_collections.archive_divider
146
- width: full
147
-
148
- - field: archive_field
149
- interface: system-field
150
- options:
151
- collectionField: collection
152
- allowNone: true
153
- placeholder: $t:field_options.directus_collections.archive_field_placeholder
154
- width: half
155
-
156
- - field: archive_app_filter
157
- interface: boolean
158
- special:
159
- - cast-boolean
160
- options:
161
- label: $t:field_options.directus_collections.archive_app_filter
162
- width: half
163
-
164
- - field: archive_value
165
- interface: input
166
- options:
167
- font: monospace
168
- iconRight: archive
169
- placeholder: $t:field_options.directus_collections.archive_value
170
- width: half
171
-
172
- - field: unarchive_value
173
- interface: input
174
- options:
175
- font: monospace
176
- iconRight: unarchive
177
- placeholder: $t:field_options.directus_collections.unarchive_value
178
- width: half
179
-
180
- - field: sort_divider
181
- special:
182
- - alias
183
- - no-data
184
- interface: presentation-divider
185
- options:
186
- icon: sort
187
- title: $t:field_options.directus_collections.sort_divider
188
- width: full
189
-
190
- - field: sort_field
191
- interface: system-field
192
- options:
193
- collectionField: collection
194
- placeholder: $t:field_options.directus_collections.sort_field
195
- typeAllowList:
196
- - float
197
- - decimal
198
- - integer
199
- allowNone: true
200
- allowPrimaryKey: false
201
- allowForeignKeys: false
202
- width: half
203
-
204
- - field: accountability_divider
205
- special:
206
- - alias
207
- - no-data
208
- interface: presentation-divider
209
- options:
210
- icon: admin_panel_settings
211
- title: $t:field_options.directus_collections.accountability_divider
212
- width: full
213
-
214
- - field: accountability
215
- interface: select-dropdown
216
- options:
217
- choices:
218
- - text: $t:field_options.directus_collections.track_activity_revisions
219
- value: all
220
- - text: $t:field_options.directus_collections.only_track_activity
221
- value: activity
222
- - text: $t:field_options.directus_collections.do_not_track_anything
223
- value: null
224
- width: half
225
-
226
- - field: duplication_divider
227
- special:
228
- - alias
229
- - no-data
230
- interface: presentation-divider
231
- options:
232
- icon: content_copy
233
- title: $t:field_options.directus_collections.duplication_divider
234
-
235
- - field: item_duplication_fields
236
- special:
237
- - cast-json
238
- interface: system-field-tree
239
- options:
240
- collectionField: collection
241
-
242
- - field: sort
243
- hidden: true
244
-
245
- - field: group
246
- hidden: true
247
-
248
- - field: collapse
249
- hidden: true
@@ -1,20 +0,0 @@
1
- table: directus_dashboards
2
-
3
- fields:
4
- - field: id
5
- special:
6
- - uuid
7
- - field: name
8
- - field: icon
9
- - field: panels
10
- special:
11
- - o2m
12
- - field: date_created
13
- special:
14
- - date-created
15
- - cast-timestamp
16
- - field: user_created
17
- special:
18
- - user-created
19
- - field: note
20
- - field: color
@@ -1,10 +0,0 @@
1
- table: directus_extensions
2
-
3
- fields:
4
- - collection: directus_extensions
5
- field: name
6
-
7
- - collection: directus_extensions
8
- field: enabled
9
- special:
10
- - cast-boolean
@@ -1,104 +0,0 @@
1
- # directus_fields isn't surfaced in the app
2
- table: directus_fields
3
-
4
- fields:
5
- - collection: directus_fields
6
- field: id
7
- width: half
8
-
9
- - collection: directus_fields
10
- field: collection
11
- width: half
12
-
13
- - collection: directus_fields
14
- field: field
15
- width: half
16
-
17
- - collection: directus_fields
18
- field: special
19
- hidden: true
20
- special:
21
- - cast-csv
22
- width: half
23
-
24
- - collection: directus_fields
25
- field: interface
26
- width: half
27
-
28
- - collection: directus_fields
29
- field: options
30
- hidden: true
31
- special:
32
- - cast-json
33
- width: half
34
-
35
- - collection: directus_fields
36
- field: display
37
- width: half
38
-
39
- - collection: directus_fields
40
- field: display_options
41
- hidden: true
42
- special:
43
- - cast-json
44
- width: half
45
-
46
- - collection: directus_fields
47
- field: readonly
48
- hidden: true
49
- special:
50
- - cast-boolean
51
- width: half
52
-
53
- - collection: directus_fields
54
- field: hidden
55
- hidden: true
56
- special:
57
- - cast-boolean
58
- width: half
59
-
60
- - collection: directus_fields
61
- field: required
62
- hidden: true
63
- special:
64
- - cast-boolean
65
- width: half
66
-
67
- - collection: directus_fields
68
- field: sort
69
- width: half
70
-
71
- - collection: directus_fields
72
- field: width
73
- width: half
74
-
75
- - collection: directus_fields
76
- field: group
77
- width: half
78
-
79
- - collection: directus_fields
80
- field: translations
81
- hidden: true
82
- special:
83
- - cast-json
84
- width: half
85
-
86
- - collection: directus_fields
87
- field: note
88
- width: half
89
-
90
- - collection: directus_fields
91
- field: conditions
92
- hidden: true
93
- special:
94
- - cast-json
95
-
96
- - collection: directus_fields
97
- field: validation
98
- hidden: true
99
- special:
100
- - cast-json
101
-
102
- - collection: directus_fields
103
- field: validation_message
104
- hidden: true
@@ -1,160 +0,0 @@
1
- table: directus_files
2
-
3
- fields:
4
- - field: id
5
- hidden: true
6
- interface: input
7
- special:
8
- - uuid
9
-
10
- - field: title
11
- interface: input
12
- options:
13
- iconRight: title
14
- placeholder: $t:field_options.directus_files.title
15
- width: full
16
-
17
- - field: description
18
- interface: input-multiline
19
- width: full
20
- options:
21
- placeholder: $t:field_options.directus_files.description
22
-
23
- - field: tags
24
- interface: tags
25
- options:
26
- iconRight: local_offer
27
- special:
28
- - cast-json
29
- width: full
30
- display: labels
31
- display_options:
32
- choices: null
33
- format: false
34
-
35
- - field: location
36
- interface: input
37
- options:
38
- iconRight: place
39
- placeholder: $t:field_options.directus_files.location
40
- width: half
41
-
42
- - field: storage
43
- interface: input
44
- options:
45
- iconRight: storage
46
- width: half
47
- readonly: true
48
-
49
- - field: focal_point_divider
50
- interface: presentation-divider
51
- options:
52
- icon: image_search
53
- title: $t:field_options.directus_files.focal_point_divider
54
- special:
55
- - alias
56
- - no-data
57
- width: full
58
-
59
- - field: focal_point_x
60
- width: half
61
-
62
- - field: focal_point_y
63
- width: half
64
-
65
- - field: storage_divider
66
- interface: presentation-divider
67
- options:
68
- icon: insert_drive_file
69
- title: $t:field_options.directus_files.storage_divider
70
- special:
71
- - alias
72
- - no-data
73
- width: full
74
-
75
- - field: filename_disk
76
- interface: input
77
- options:
78
- iconRight: publish
79
- placeholder: $t:field_options.directus_files.filename_disk
80
- readonly: true
81
- width: half
82
-
83
- - field: filename_download
84
- interface: input
85
- options:
86
- iconRight: get_app
87
- placeholder: $t:field_options.directus_files.filename_download
88
- width: half
89
-
90
- - field: metadata
91
- hidden: true
92
- special:
93
- - cast-json
94
-
95
- - field: type
96
- display: mime-type
97
- readonly: true
98
-
99
- - field: filesize
100
- display: filesize
101
- readonly: true
102
-
103
- - field: modified_by
104
- interface: select-dropdown-m2o
105
- special:
106
- - user-updated
107
- width: half
108
- display: user
109
- readonly: true
110
- options:
111
- template: '{{avatar.$thumbnail}} {{first_name}} {{last_name}}'
112
-
113
- - field: modified_on
114
- interface: datetime
115
- special:
116
- - date-updated
117
- width: half
118
- display: datetime
119
- readonly: true
120
-
121
- - field: embed
122
- width: half
123
- hidden: true
124
-
125
- - field: uploaded_by
126
- display: user
127
- width: half
128
- hidden: true
129
- special:
130
- - user-created
131
-
132
- - field: uploaded_on
133
- display: datetime
134
- width: half
135
- hidden: true
136
-
137
- - field: folder
138
- width: half
139
- readonly: true
140
- special:
141
- - m2o
142
- display: related-values
143
- display_options:
144
- template: '{{ name }}'
145
-
146
- - field: width
147
- width: half
148
- readonly: true
149
-
150
- - field: height
151
- width: half
152
- readonly: true
153
-
154
- - field: charset
155
- width: half
156
- readonly: true
157
-
158
- - field: duration
159
- width: half
160
- readonly: true
@@ -1,26 +0,0 @@
1
- table: directus_flows
2
-
3
- fields:
4
- - field: id
5
- special:
6
- - uuid
7
- - field: name
8
- - field: icon
9
- - field: color
10
- - field: description
11
- - field: status
12
- - field: trigger
13
- - field: accountability
14
- - field: options
15
- special:
16
- - cast-json
17
- - field: operation
18
- - field: operations
19
- special:
20
- - o2m
21
- - field: date_created
22
- special:
23
- - date-created
24
- - field: user_created
25
- special:
26
- - user-created
@@ -1,14 +0,0 @@
1
- table: directus_folders
2
-
3
- fields:
4
- - field: id
5
- interface: input
6
- special:
7
- - uuid
8
- width: half
9
-
10
- - field: parent
11
- width: half
12
-
13
- - field: name
14
- width: full
@@ -1,2 +0,0 @@
1
- import type { FieldMeta } from '@directus/types';
2
- export declare const systemFieldRows: FieldMeta[];
@@ -1,33 +0,0 @@
1
- import fse from 'fs-extra';
2
- import { merge } from 'lodash-es';
3
- import path from 'path';
4
- import { getAuthProviders } from '../../../utils/get-auth-providers.js';
5
- import { requireYAML } from '../../../utils/require-yaml.js';
6
- import formatTitle from '@directus/format-title';
7
- import { fileURLToPath } from 'url';
8
- const __filename = fileURLToPath(import.meta.url);
9
- const __dirname = path.dirname(__filename);
10
- const defaults = requireYAML(path.join(__dirname, './_defaults.yaml'));
11
- const fieldData = fse.readdirSync(path.resolve(__dirname));
12
- export const systemFieldRows = [];
13
- for (const filepath of fieldData) {
14
- if (filepath.includes('_defaults') || filepath.includes('index'))
15
- continue;
16
- const systemFields = requireYAML(path.resolve(__dirname, filepath));
17
- systemFields['fields'].forEach((field, index) => {
18
- const systemField = merge({ system: true }, defaults, field, {
19
- collection: systemFields['table'],
20
- sort: index + 1,
21
- });
22
- // Dynamically populate auth providers field
23
- if (systemField.collection === 'directus_users' && systemField.field === 'provider') {
24
- getAuthProviders().forEach(({ name }) => {
25
- systemField.options?.['choices']?.push({
26
- text: formatTitle(name),
27
- value: name,
28
- });
29
- });
30
- }
31
- systemFieldRows.push(systemField);
32
- });
33
- }
@@ -1,10 +0,0 @@
1
- # directus_migrations isn't surfaced in the app, nor accessible from the API
2
- table: directus_migrations
3
-
4
- fields:
5
- - collection: directus_migrations
6
- field: version
7
- - collection: directus_migrations
8
- field: name
9
- - collection: directus_migrations
10
- field: timestamp
@@ -1,15 +0,0 @@
1
- table: directus_notifications
2
-
3
- fields:
4
- - field: id
5
- - field: timestamp
6
- special:
7
- - date-created
8
- - cast-timestamp
9
- - field: status
10
- - field: recipient
11
- - field: sender
12
- - field: subject
13
- - field: message
14
- - field: collection
15
- - field: item
@@ -1,23 +0,0 @@
1
- table: directus_operations
2
-
3
- fields:
4
- - field: id
5
- special:
6
- - uuid
7
- - field: name
8
- - field: key
9
- - field: type
10
- - field: position_x
11
- - field: position_y
12
- - field: options
13
- special:
14
- - cast-json
15
- - field: resolve
16
- - field: reject
17
- - field: flow
18
- - field: date_created
19
- special:
20
- - date-created
21
- - field: user_created
22
- special:
23
- - user-created
@@ -1,29 +0,0 @@
1
- table: directus_panels
2
-
3
- fields:
4
- - field: id
5
- special:
6
- - uuid
7
- - field: name
8
- - field: icon
9
- - field: color
10
- - field: note
11
- - field: type
12
- - field: show_header
13
- special:
14
- - cast-boolean
15
- - field: position_x
16
- - field: position_y
17
- - field: width
18
- - field: height
19
- - field: options
20
- special:
21
- - cast-json
22
- - field: date_created
23
- special:
24
- - date-created
25
- - cast-timestamp
26
- - field: user_created
27
- special:
28
- - user-created
29
- - field: dashboard