@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,107 +0,0 @@
1
- # NOTE: Activity/collections/fields/presets/relations/revisions will have an extra hardcoded filter
2
- # to filter out collections you don't have read access
3
-
4
- - collection: directus_activity
5
- action: read
6
- permissions:
7
- user:
8
- _eq: $CURRENT_USER
9
-
10
- - collection: directus_activity
11
- action: create
12
- validation:
13
- comment:
14
- _nnull: true
15
-
16
- - collection: directus_presets
17
- action: read
18
- permissions:
19
- _or:
20
- - user:
21
- _eq: $CURRENT_USER
22
- - _and:
23
- - user:
24
- _null: true
25
- - role:
26
- _eq: $CURRENT_ROLE
27
- - _and:
28
- - user:
29
- _null: true
30
- - role:
31
- _null: true
32
-
33
- - collection: directus_presets
34
- action: create
35
- validation:
36
- user:
37
- _eq: $CURRENT_USER
38
-
39
- - collection: directus_presets
40
- action: update
41
- permissions:
42
- user:
43
- _eq: $CURRENT_USER
44
-
45
- - collection: directus_presets
46
- action: delete
47
- permissions:
48
- user:
49
- _eq: $CURRENT_USER
50
-
51
- - collection: directus_roles
52
- action: read
53
- permissions:
54
- id:
55
- _eq: $CURRENT_ROLE
56
-
57
- - collection: directus_settings
58
- action: read
59
-
60
- - collection: directus_translations
61
- action: read
62
-
63
- - collection: directus_notifications
64
- action: read
65
- permissions:
66
- recipient:
67
- _eq: $CURRENT_USER
68
-
69
- - collection: directus_notifications
70
- action: update
71
- permissions:
72
- recipient:
73
- _eq: $CURRENT_USER
74
- fields:
75
- - status
76
-
77
- - collection: directus_shares
78
- action: read
79
- permissions:
80
- user_created:
81
- _eq: $CURRENT_USER
82
-
83
- - collection: directus_users
84
- action: read
85
- permissions:
86
- id:
87
- _eq: $CURRENT_USER
88
- fields:
89
- - id
90
- - first_name
91
- - last_name
92
- - last_page
93
- - email
94
- - password
95
- - location
96
- - title
97
- - description
98
- - tags
99
- - preferences_divider
100
- - avatar
101
- - language
102
- - appearance
103
- - theme_light
104
- - theme_dark
105
- - tfa_secret
106
- - status
107
- - role
@@ -1,3 +0,0 @@
1
- import type { Permission } from '@directus/types';
2
- export declare const schemaPermissions: Permission[];
3
- export declare const appAccessMinimalPermissions: Permission[];
@@ -1,17 +0,0 @@
1
- import { merge } from 'lodash-es';
2
- import path, { dirname } from 'node:path';
3
- import { fileURLToPath } from 'node:url';
4
- import { requireYAML } from '../../../utils/require-yaml.js';
5
- const defaults = {
6
- role: null,
7
- permissions: {},
8
- validation: null,
9
- presets: null,
10
- fields: ['*'],
11
- system: true,
12
- };
13
- const __dirname = dirname(fileURLToPath(import.meta.url));
14
- const schemaPermissionsRaw = requireYAML(path.resolve(__dirname, './schema-access-permissions.yaml'));
15
- const permissions = requireYAML(path.resolve(__dirname, './app-access-permissions.yaml'));
16
- export const schemaPermissions = schemaPermissionsRaw.map((row) => merge({}, defaults, row));
17
- export const appAccessMinimalPermissions = [...schemaPermissions, ...permissions].map((row) => merge({}, defaults, row));
@@ -1,17 +0,0 @@
1
- # NOTE: Activity/collections/fields/presets/relations/revisions will have an extra hardcoded filter
2
- # to filter out collections you don't have read access
3
-
4
- - collection: directus_collections
5
- action: read
6
-
7
- - collection: directus_fields
8
- action: read
9
-
10
- - collection: directus_permissions
11
- action: read
12
- permissions:
13
- role:
14
- _eq: $CURRENT_ROLE
15
-
16
- - collection: directus_relations
17
- action: read
@@ -1,103 +0,0 @@
1
- table: directus_collections
2
-
3
- defaults:
4
- collection: null
5
- hidden: false
6
- singleton: false
7
- icon: null
8
- note: null
9
- translations: null
10
- display_template: null
11
- accountability: 'all'
12
-
13
- data:
14
- - collection: directus_activity
15
- note: $t:directus_collection.directus_activity
16
- accountability: null
17
-
18
- - collection: directus_collections
19
- icon: database
20
- note: $t:directus_collection.directus_collections
21
-
22
- - collection: directus_fields
23
- icon: input
24
- note: $t:directus_collection.directus_fields
25
-
26
- - collection: directus_files
27
- icon: folder
28
- note: $t:directus_collection.directus_files
29
- display_template: '{{ $thumbnail }} {{ title }}'
30
-
31
- - collection: directus_folders
32
- note: $t:directus_collection.directus_folders
33
- display_template: '{{ name }}'
34
-
35
- - collection: directus_migrations
36
- note: $t:directus_collection.directus_migrations
37
-
38
- - collection: directus_permissions
39
- icon: admin_panel_settings
40
- note: $t:directus_collection.directus_permissions
41
-
42
- - collection: directus_presets
43
- icon: bookmark
44
- note: $t:directus_collection.directus_presets
45
- accountability: null
46
-
47
- - collection: directus_relations
48
- icon: merge_type
49
- note: $t:directus_collection.directus_relations
50
-
51
- - collection: directus_revisions
52
- note: $t:directus_collection.directus_revisions
53
- accountability: null
54
-
55
- - collection: directus_roles
56
- icon: supervised_user_circle
57
- note: $t:directus_collection.directus_roles
58
-
59
- - collection: directus_sessions
60
- note: $t:directus_collection.directus_sessions
61
-
62
- - collection: directus_settings
63
- singleton: true
64
- note: $t:directus_collection.directus_settings
65
-
66
- - collection: directus_users
67
- archive_field: status
68
- archive_value: archived
69
- unarchive_value: draft
70
- icon: people_alt
71
- note: $t:directus_collection.directus_users
72
- display_template: '{{ first_name }} {{ last_name }}'
73
-
74
- - collection: directus_webhooks
75
- note: $t:directus_collection.directus_webhooks
76
-
77
- - collection: directus_dashboards
78
- note: $t:directus_collection.directus_dashboards
79
-
80
- - collection: directus_panels
81
- note: $t:directus_collection.directus_panels
82
-
83
- - collection: directus_notifications
84
- note: $t:directus_collection.directus_notifications
85
-
86
- - collection: directus_shares
87
- icon: share
88
- note: $t:directus_collection.directus_shares
89
-
90
- - collection: directus_flows
91
- note: $t:directus_collection.directus_flows
92
-
93
- - collection: directus_operations
94
- note: $t:directus_collection.directus_operations
95
-
96
- - collection: directus_translations
97
- note: $t:directus_collection.directus_translations
98
-
99
- - collection: directus_versions
100
- note: $t:directus_collection.directus_versions
101
-
102
- - collection: directus_extensions
103
- note: $t:directus_collection.directus_extensions
@@ -1,2 +0,0 @@
1
- import type { CollectionMeta } from '../../../types/index.js';
2
- export declare const systemCollectionRows: CollectionMeta[];
@@ -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, './collections.yaml'));
7
- export const systemCollectionRows = systemData['data'].map((row) => {
8
- return merge({ system: true }, systemData['defaults'], row);
9
- });
@@ -1,16 +0,0 @@
1
- collection: null
2
- field: null
3
- special: null
4
- interface: null
5
- options: null
6
- display: null
7
- display_options: null
8
- readonly: false
9
- hidden: false
10
- sort: null
11
- width: full
12
- group: null
13
- translations: null
14
- note: null
15
- conditions: null
16
- required: false
@@ -1,83 +0,0 @@
1
- table: directus_activity
2
-
3
- fields:
4
- - field: id
5
- width: half
6
-
7
- - field: item
8
- width: half
9
-
10
- - field: action
11
- display: labels
12
- display_options:
13
- choices:
14
- - text: $t:field_options.directus_activity.create
15
- value: create
16
- foreground: 'var(--theme--primary)'
17
- background: 'var(--theme--primary-subdued)'
18
- - text: $t:field_options.directus_activity.update
19
- value: update
20
- foreground: 'var(--blue)'
21
- background: 'var(--blue-25)'
22
- - text: $t:field_options.directus_activity.delete
23
- value: delete
24
- foreground: 'var(--theme--danger)'
25
- background: 'var(--danger-25)'
26
- - text: $t:field_options.directus_activity.login
27
- value: login
28
- foreground: 'var(--purple)'
29
- background: 'var(--purple-25)'
30
- width: half
31
-
32
- - field: collection
33
- display: collection
34
- display_options:
35
- icon: true
36
- width: half
37
-
38
- - field: timestamp
39
- display: datetime
40
- special:
41
- - date-created
42
- - cast-timestamp
43
- options:
44
- relative: true
45
- width: half
46
-
47
- - field: user
48
- display: user
49
- width: half
50
-
51
- - field: comment
52
- display: formatted-value
53
- display_options:
54
- color: 'var(--theme--foreground-subdued)'
55
- width: half
56
-
57
- - field: user_agent
58
- display: formatted-value
59
- display_options:
60
- font: monospace
61
- width: half
62
-
63
- - field: origin
64
- display: formatted-value
65
- display_options:
66
- font: monospace
67
- width: half
68
-
69
- - field: ip
70
- display: formatted-value
71
- display_options:
72
- font: monospace
73
- width: half
74
-
75
- - field: revisions
76
- interface: list-o2m
77
- special:
78
- - o2m
79
- options:
80
- fields:
81
- - collection
82
- - item
83
- width: half
@@ -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