directus 9.20.4 → 9.21.2
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/dist/auth/drivers/openid.js +3 -1
- package/dist/cli/commands/schema/apply.js +0 -2
- package/dist/cli/commands/schema/snapshot.js +0 -2
- package/dist/cli/utils/create-db-connection.d.ts +1 -1
- package/dist/controllers/extensions.js +4 -13
- package/dist/database/helpers/date/dialects/sqlite.d.ts +1 -1
- package/dist/database/helpers/date/dialects/sqlite.js +4 -0
- package/dist/database/helpers/date/types.d.ts +1 -1
- package/dist/database/helpers/date/types.js +4 -0
- package/dist/database/helpers/fn/dialects/mssql.d.ts +8 -8
- package/dist/database/helpers/fn/dialects/mssql.js +22 -16
- package/dist/database/helpers/fn/dialects/mysql.d.ts +8 -8
- package/dist/database/helpers/fn/dialects/mysql.js +22 -16
- package/dist/database/helpers/fn/dialects/postgres.d.ts +8 -8
- package/dist/database/helpers/fn/dialects/postgres.js +22 -16
- package/dist/database/helpers/fn/types.d.ts +1 -1
- package/dist/database/helpers/index.d.ts +1 -1
- package/dist/database/helpers/schema/dialects/cockroachdb.d.ts +1 -0
- package/dist/database/helpers/schema/dialects/cockroachdb.js +11 -0
- package/dist/database/helpers/schema/types.d.ts +3 -2
- package/dist/database/helpers/schema/types.js +5 -0
- package/dist/database/migrations/run.js +29 -3
- package/dist/database/run-ast.d.ts +1 -1
- package/dist/database/run-ast.js +1 -1
- package/dist/env.d.ts +4 -0
- package/dist/env.js +9 -4
- package/dist/env.test.d.ts +1 -8
- package/dist/exceptions/database/contains-null-values.d.ts +1 -1
- package/dist/exceptions/database/dialects/types.d.ts +6 -6
- package/dist/exceptions/database/invalid-foreign-key.d.ts +1 -1
- package/dist/exceptions/database/not-null-violation.d.ts +1 -1
- package/dist/exceptions/database/record-not-unique.d.ts +1 -1
- package/dist/exceptions/database/value-out-of-range.d.ts +1 -1
- package/dist/exceptions/database/value-too-long.d.ts +1 -1
- package/dist/exceptions/hit-rate-limit.d.ts +1 -1
- package/dist/exceptions/method-not-allowed.d.ts +1 -1
- package/dist/exceptions/service-unavailable.d.ts +1 -1
- package/dist/extensions.d.ts +7 -7
- package/dist/extensions.js +92 -89
- package/dist/logger.d.ts +1 -0
- package/dist/messenger.d.ts +1 -1
- package/dist/middleware/authenticate.d.ts +1 -0
- package/dist/middleware/schema.js +1 -1
- package/dist/middleware/validate-batch.d.ts +2 -0
- package/dist/operations/condition/index.d.ts +1 -1
- package/dist/operations/condition/index.js +1 -1
- package/dist/operations/condition/index.test.d.ts +1 -0
- package/dist/operations/exec/index.d.ts +1 -1
- package/dist/operations/item-create/index.d.ts +1 -1
- package/dist/operations/item-delete/index.d.ts +1 -1
- package/dist/operations/item-read/index.d.ts +1 -1
- package/dist/operations/item-update/index.d.ts +1 -1
- package/dist/operations/log/index.d.ts +1 -1
- package/dist/operations/mail/index.d.ts +1 -1
- package/dist/operations/notification/index.d.ts +1 -1
- package/dist/operations/request/index.d.ts +1 -1
- package/dist/operations/sleep/index.d.ts +1 -1
- package/dist/operations/transform/index.d.ts +1 -1
- package/dist/operations/trigger/index.d.ts +1 -1
- package/dist/operations/trigger/index.js +5 -2
- package/dist/rate-limiter.d.ts +1 -1
- package/dist/services/authorization.js +7 -3
- package/dist/services/collections.d.ts +1 -1
- package/dist/services/collections.js +112 -13
- package/dist/services/fields.d.ts +5 -4
- package/dist/services/fields.js +118 -50
- package/dist/services/fields.test.d.ts +1 -0
- package/dist/services/graphql/index.js +4 -1
- package/dist/services/graphql/utils/process-error.d.ts +4 -0
- package/dist/services/graphql/utils/process-error.js +26 -0
- package/dist/services/graphql/utils/process-error.test.d.ts +1 -0
- package/dist/services/items.d.ts +1 -1
- package/dist/services/items.js +39 -13
- package/dist/services/mail/index.d.ts +2 -2
- package/dist/services/mail/index.js +2 -1
- package/dist/services/mail/templates/base.liquid +4 -4
- package/dist/services/notifications.js +9 -4
- package/dist/services/notifications.test.d.ts +1 -0
- package/dist/services/payload.d.ts +2 -2
- package/dist/services/payload.js +14 -12
- package/dist/services/relations.d.ts +4 -4
- package/dist/services/relations.js +66 -8
- package/dist/services/users.js +8 -2
- package/dist/services/users.test.d.ts +1 -0
- package/dist/types/assets.d.ts +7 -7
- package/dist/types/ast.d.ts +7 -7
- package/dist/types/auth.d.ts +4 -4
- package/dist/types/collection.d.ts +2 -2
- package/dist/types/events.d.ts +1 -1
- package/dist/types/files.d.ts +2 -2
- package/dist/types/items.d.ts +5 -5
- package/dist/types/migration.d.ts +1 -1
- package/dist/types/revision.d.ts +1 -1
- package/dist/types/services.d.ts +1 -1
- package/dist/types/snapshot.d.ts +4 -4
- package/dist/types/webhooks.d.ts +2 -2
- package/dist/utils/apply-snapshot.js +32 -13
- package/dist/utils/get-ast-from-query.d.ts +1 -1
- package/dist/utils/get-column-path.d.ts +2 -2
- package/dist/utils/get-module-default.d.ts +1 -1
- package/dist/utils/get-relation-info.d.ts +1 -1
- package/dist/utils/get-schema.d.ts +6 -2
- package/dist/utils/get-schema.js +1 -1
- package/dist/utils/get-snapshot.js +1 -1
- package/dist/utils/job-queue.d.ts +1 -1
- package/dist/utils/merge-permissions.d.ts +1 -0
- package/dist/utils/reduce-schema.js +3 -1
- package/package.json +69 -80
- package/dist/__mocks__/cache.d.ts +0 -5
- package/dist/__mocks__/cache.js +0 -7
- package/dist/__utils__/items-utils.d.ts +0 -2
- package/dist/__utils__/items-utils.js +0 -36
- package/dist/__utils__/schemas.d.ts +0 -13
- package/dist/__utils__/schemas.js +0 -304
- package/dist/__utils__/snapshots.d.ts +0 -5
- package/dist/__utils__/snapshots.js +0 -897
- package/dist/cli/index.test.js +0 -63
- package/dist/controllers/files.test.js +0 -49
- package/dist/database/migrations/run.test.js +0 -92
- package/dist/env.test.js +0 -40
- package/dist/middleware/authenticate.test.js +0 -214
- package/dist/middleware/extract-token.test.js +0 -60
- package/dist/middleware/validate-batch.test.js +0 -82
- package/dist/operations/exec/index.test.js +0 -95
- package/dist/services/files.test.js +0 -89
- package/dist/services/items.test.js +0 -765
- package/dist/services/payload.test.js +0 -196
- package/dist/services/specifications.test.js +0 -96
- package/dist/utils/apply-snapshot.test.js +0 -305
- package/dist/utils/async-handler.test.js +0 -18
- package/dist/utils/calculate-field-depth.test.js +0 -76
- package/dist/utils/filter-items.test.js +0 -60
- package/dist/utils/get-auth-providers.test.js +0 -72
- package/dist/utils/get-cache-key.test.js +0 -74
- package/dist/utils/get-column-path.test.js +0 -136
- package/dist/utils/get-config-from-env.test.js +0 -19
- package/dist/utils/get-relation-info.test.js +0 -88
- package/dist/utils/get-relation-type.test.js +0 -69
- package/dist/utils/get-string-byte-size.test.js +0 -8
- package/dist/utils/is-directus-jwt.test.js +0 -26
- package/dist/utils/jwt.test.js +0 -36
- package/dist/utils/merge-permissions.test.js +0 -80
- package/dist/utils/validate-keys.test.js +0 -97
package/package.json
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "directus",
|
|
3
|
-
"version": "9.
|
|
4
|
-
"
|
|
5
|
-
"homepage": "https://github.com/directus/directus#readme",
|
|
6
|
-
"description": "Directus is a real-time API and App dashboard for managing SQL database content.",
|
|
3
|
+
"version": "9.21.2",
|
|
4
|
+
"description": "Directus is a real-time API and App dashboard for managing SQL database content",
|
|
7
5
|
"keywords": [
|
|
8
6
|
"directus",
|
|
9
7
|
"realtime",
|
|
@@ -23,13 +21,17 @@
|
|
|
23
21
|
"framework",
|
|
24
22
|
"vue"
|
|
25
23
|
],
|
|
26
|
-
"
|
|
27
|
-
"type": "git",
|
|
28
|
-
"url": "git+https://github.com/directus/directus.git"
|
|
29
|
-
},
|
|
24
|
+
"homepage": "https://directus.io",
|
|
30
25
|
"bugs": {
|
|
31
26
|
"url": "https://github.com/directus/directus/issues"
|
|
32
27
|
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/directus/directus.git",
|
|
31
|
+
"directory": "api"
|
|
32
|
+
},
|
|
33
|
+
"funding": "https://github.com/directus/directus?sponsor=1",
|
|
34
|
+
"license": "GPL-3.0-only",
|
|
33
35
|
"author": {
|
|
34
36
|
"name": "Monospace Inc",
|
|
35
37
|
"email": "info@monospace.io",
|
|
@@ -47,40 +49,28 @@
|
|
|
47
49
|
"url": "https://github.com/benhaynes"
|
|
48
50
|
}
|
|
49
51
|
],
|
|
50
|
-
"main": "dist/index.js",
|
|
51
52
|
"exports": {
|
|
52
53
|
".": "./dist/index.js",
|
|
53
54
|
"./*": "./dist/*.js",
|
|
54
55
|
"./package.json": "./package.json"
|
|
55
56
|
},
|
|
57
|
+
"main": "dist/index.js",
|
|
56
58
|
"bin": {
|
|
57
59
|
"directus": "cli.js"
|
|
58
60
|
},
|
|
59
|
-
"engines": {
|
|
60
|
-
"node": ">=12.20.0"
|
|
61
|
-
},
|
|
62
61
|
"files": [
|
|
63
62
|
"dist",
|
|
64
|
-
"
|
|
65
|
-
"
|
|
63
|
+
"!**/*.test.js",
|
|
64
|
+
"!**/__*__/"
|
|
66
65
|
],
|
|
67
66
|
"dependencies": {
|
|
68
67
|
"@authenio/samlify-node-xmllint": "2.0.0",
|
|
69
|
-
"@aws-sdk/client-ses": "3.
|
|
70
|
-
"@directus/app": "9.20.4",
|
|
71
|
-
"@directus/drive": "9.20.4",
|
|
72
|
-
"@directus/drive-azure": "9.20.4",
|
|
73
|
-
"@directus/drive-gcs": "9.20.4",
|
|
74
|
-
"@directus/drive-s3": "9.20.4",
|
|
75
|
-
"@directus/extensions-sdk": "9.20.4",
|
|
68
|
+
"@aws-sdk/client-ses": "3.211.0",
|
|
76
69
|
"@directus/format-title": "9.15.0",
|
|
77
|
-
"@directus/schema": "9.20.4",
|
|
78
|
-
"@directus/shared": "9.20.4",
|
|
79
|
-
"@directus/specs": "9.20.4",
|
|
80
70
|
"@godaddy/terminus": "4.11.2",
|
|
81
|
-
"@rollup/plugin-alias": "4.0.
|
|
82
|
-
"@rollup/plugin-virtual": "3.0.
|
|
83
|
-
"argon2": "0.30.
|
|
71
|
+
"@rollup/plugin-alias": "4.0.2",
|
|
72
|
+
"@rollup/plugin-virtual": "3.0.1",
|
|
73
|
+
"argon2": "0.30.2",
|
|
84
74
|
"async": "3.2.4",
|
|
85
75
|
"async-mutex": "0.4.0",
|
|
86
76
|
"axios": "1.1.3",
|
|
@@ -95,7 +85,6 @@
|
|
|
95
85
|
"csv-parser": "3.0.0",
|
|
96
86
|
"date-fns": "2.29.3",
|
|
97
87
|
"deep-diff": "1.0.2",
|
|
98
|
-
"deep-map": "2.0.0",
|
|
99
88
|
"destroy": "1.2.0",
|
|
100
89
|
"dotenv": "16.0.3",
|
|
101
90
|
"encodeurl": "1.0.2",
|
|
@@ -108,22 +97,22 @@
|
|
|
108
97
|
"fs-extra": "10.1.0",
|
|
109
98
|
"globby": "11.0.4",
|
|
110
99
|
"graphql": "16.6.0",
|
|
111
|
-
"graphql-compose": "9.0.
|
|
100
|
+
"graphql-compose": "9.0.10",
|
|
112
101
|
"helmet": "6.0.0",
|
|
113
102
|
"inquirer": "8.2.4",
|
|
114
|
-
"ioredis": "5.2.
|
|
115
|
-
"joi": "17.
|
|
103
|
+
"ioredis": "5.2.4",
|
|
104
|
+
"joi": "17.7.0",
|
|
116
105
|
"js-yaml": "4.1.0",
|
|
117
106
|
"js2xmlparser": "5.0.0",
|
|
118
107
|
"json2csv": "5.0.7",
|
|
119
108
|
"jsonwebtoken": "8.5.1",
|
|
120
|
-
"keyv": "4.5.
|
|
109
|
+
"keyv": "4.5.2",
|
|
121
110
|
"knex": "2.3.0",
|
|
122
111
|
"knex-schema-inspector": "3.0.0",
|
|
123
112
|
"ldapjs": "2.3.3",
|
|
124
|
-
"liquidjs": "9.42.
|
|
113
|
+
"liquidjs": "9.42.1",
|
|
125
114
|
"lodash": "4.17.21",
|
|
126
|
-
"marked": "4.
|
|
115
|
+
"marked": "4.2.2",
|
|
127
116
|
"micromustache": "8.0.3",
|
|
128
117
|
"mime-types": "2.1.35",
|
|
129
118
|
"ms": "2.1.3",
|
|
@@ -133,20 +122,19 @@
|
|
|
133
122
|
"nodemailer": "6.8.0",
|
|
134
123
|
"object-hash": "3.0.0",
|
|
135
124
|
"openapi3-ts": "3.1.1",
|
|
136
|
-
"openid-client": "5.
|
|
125
|
+
"openid-client": "5.3.0",
|
|
137
126
|
"ora": "5.4.0",
|
|
138
127
|
"otplib": "12.0.1",
|
|
139
|
-
"pino": "8.
|
|
128
|
+
"pino": "8.7.0",
|
|
140
129
|
"pino-http": "8.2.1",
|
|
141
130
|
"pino-http-print": "3.1.0",
|
|
142
131
|
"qs": "6.11.0",
|
|
143
|
-
"rate-limiter-flexible": "2.
|
|
144
|
-
"
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
"snappy": "7.2.0",
|
|
132
|
+
"rate-limiter-flexible": "2.4.1",
|
|
133
|
+
"rollup": "3.3.0",
|
|
134
|
+
"samlify": "2.8.7",
|
|
135
|
+
"sanitize-html": "2.7.3",
|
|
136
|
+
"sharp": "0.31.2",
|
|
137
|
+
"snappy": "7.2.2",
|
|
150
138
|
"stream-json": "1.7.4",
|
|
151
139
|
"strip-bom-stream": "4.0.0",
|
|
152
140
|
"tmp-promise": "3.0.3",
|
|
@@ -154,22 +142,18 @@
|
|
|
154
142
|
"uuid": "9.0.0",
|
|
155
143
|
"uuid-validate": "0.0.3",
|
|
156
144
|
"vm2": "3.9.11",
|
|
157
|
-
"wellknown": "0.5.0"
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
"@
|
|
161
|
-
"
|
|
162
|
-
"
|
|
163
|
-
"
|
|
164
|
-
"
|
|
165
|
-
"
|
|
166
|
-
"
|
|
167
|
-
"sqlite3": "5.1.2",
|
|
168
|
-
"tedious": "15.1.0"
|
|
145
|
+
"wellknown": "0.5.0",
|
|
146
|
+
"@directus/app": "9.21.2",
|
|
147
|
+
"@directus/drive": "9.21.2",
|
|
148
|
+
"@directus/drive-azure": "9.21.2",
|
|
149
|
+
"@directus/drive-gcs": "9.21.2",
|
|
150
|
+
"@directus/drive-s3": "9.21.2",
|
|
151
|
+
"@directus/extensions-sdk": "9.21.2",
|
|
152
|
+
"@directus/schema": "9.21.2",
|
|
153
|
+
"@directus/shared": "9.21.2",
|
|
154
|
+
"@directus/specs": "9.21.2"
|
|
169
155
|
},
|
|
170
|
-
"gitHead": "24621f3934dc77eb23441331040ed13c676ceffd",
|
|
171
156
|
"devDependencies": {
|
|
172
|
-
"@otplib/preset-default": "12.0.1",
|
|
173
157
|
"@types/async": "3.2.15",
|
|
174
158
|
"@types/busboy": "1.5.0",
|
|
175
159
|
"@types/bytes": "3.1.1",
|
|
@@ -179,25 +163,22 @@
|
|
|
179
163
|
"@types/destroy": "1.0.0",
|
|
180
164
|
"@types/encodeurl": "1.0.0",
|
|
181
165
|
"@types/express": "4.17.14",
|
|
182
|
-
"@types/express-pino-logger": "4.0.3",
|
|
183
166
|
"@types/express-serve-static-core": "4.17.31",
|
|
184
|
-
"@types/express-session": "1.17.5",
|
|
185
167
|
"@types/fast-redact": "3.0.2",
|
|
186
168
|
"@types/flat": "5.0.2",
|
|
187
169
|
"@types/fs-extra": "9.0.13",
|
|
188
170
|
"@types/inquirer": "8.2.1",
|
|
189
|
-
"@types/jest": "29.2.0",
|
|
190
171
|
"@types/js-yaml": "4.0.5",
|
|
191
172
|
"@types/json2csv": "5.0.3",
|
|
192
173
|
"@types/jsonwebtoken": "8.5.9",
|
|
193
174
|
"@types/keyv": "3.1.4",
|
|
194
|
-
"@types/ldapjs": "2.2.
|
|
195
|
-
"@types/lodash": "4.14.
|
|
175
|
+
"@types/ldapjs": "2.2.5",
|
|
176
|
+
"@types/lodash": "4.14.189",
|
|
196
177
|
"@types/marked": "4.0.7",
|
|
197
178
|
"@types/mime-types": "2.1.1",
|
|
198
179
|
"@types/ms": "0.7.31",
|
|
199
|
-
"@types/node": "18.11.
|
|
200
|
-
"@types/node-cron": "3.0.
|
|
180
|
+
"@types/node": "18.11.9",
|
|
181
|
+
"@types/node-cron": "3.0.6",
|
|
201
182
|
"@types/nodemailer": "6.4.6",
|
|
202
183
|
"@types/object-hash": "2.2.1",
|
|
203
184
|
"@types/pino": "7.0.4",
|
|
@@ -206,31 +187,39 @@
|
|
|
206
187
|
"@types/sanitize-html": "2.6.2",
|
|
207
188
|
"@types/sharp": "0.31.0",
|
|
208
189
|
"@types/stream-json": "1.7.2",
|
|
209
|
-
"@types/supertest": "2.0.12",
|
|
210
190
|
"@types/uuid": "8.3.4",
|
|
211
191
|
"@types/uuid-validate": "0.0.1",
|
|
212
|
-
"@types/wellknown": "0.5.
|
|
192
|
+
"@types/wellknown": "0.5.4",
|
|
193
|
+
"@vitest/coverage-c8": "0.25.2",
|
|
213
194
|
"copyfiles": "2.4.1",
|
|
214
|
-
"cross-env": "7.0.3",
|
|
215
195
|
"form-data": "4.0.0",
|
|
216
|
-
"jest": "29.2.1",
|
|
217
196
|
"knex-mock-client": "1.8.4",
|
|
218
|
-
"rimraf": "3.0.2",
|
|
219
|
-
"supertest": "6.3.0",
|
|
220
|
-
"ts-jest": "29.0.3",
|
|
221
197
|
"ts-node": "10.9.1",
|
|
222
198
|
"ts-node-dev": "2.0.0",
|
|
223
|
-
"typescript": "4.
|
|
199
|
+
"typescript": "4.9.3",
|
|
200
|
+
"vitest": "0.25.2"
|
|
201
|
+
},
|
|
202
|
+
"optionalDependencies": {
|
|
203
|
+
"@keyv/redis": "2.5.3",
|
|
204
|
+
"keyv-memcache": "1.2.5",
|
|
205
|
+
"memcached": "2.2.2",
|
|
206
|
+
"mysql": "2.18.1",
|
|
207
|
+
"nodemailer-mailgun-transport": "2.1.5",
|
|
208
|
+
"nodemailer-sendgrid": "1.0.3",
|
|
209
|
+
"pg": "8.8.0",
|
|
210
|
+
"sqlite3": "5.1.2",
|
|
211
|
+
"tedious": "15.1.1"
|
|
212
|
+
},
|
|
213
|
+
"engines": {
|
|
214
|
+
"node": ">=12.20.0"
|
|
224
215
|
},
|
|
225
216
|
"scripts": {
|
|
217
|
+
"build": "tsc --build && copyfiles \"src/**/*.{yaml,liquid}\" -u 1 dist",
|
|
218
|
+
"cli": "NODE_ENV=development SERVE_APP=false ts-node --script-mode --transpile-only src/cli/run.ts",
|
|
219
|
+
"dev": "NODE_ENV=development SERVE_APP=false ts-node-dev --files --transpile-only --respawn --watch \".env\" --inspect=0 --exit-child -- src/start.ts",
|
|
226
220
|
"start": "npx directus start",
|
|
227
|
-
"
|
|
228
|
-
"
|
|
229
|
-
"
|
|
230
|
-
"dev": "cross-env NODE_ENV=development SERVE_APP=false ts-node-dev --files --transpile-only --respawn --watch \".env\" --inspect=0 --exit-child -- src/start.ts",
|
|
231
|
-
"cli": "cross-env NODE_ENV=development SERVE_APP=false ts-node --script-mode --transpile-only src/cli/run.ts",
|
|
232
|
-
"test": "jest",
|
|
233
|
-
"test:coverage": "jest --coverage",
|
|
234
|
-
"test:watch": "jest --watch"
|
|
221
|
+
"test": "vitest run",
|
|
222
|
+
"test:coverage": "vitest run --coverage",
|
|
223
|
+
"test:watch": "vitest"
|
|
235
224
|
}
|
|
236
225
|
}
|
package/dist/__mocks__/cache.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setSystemCache = exports.clearSystemCache = exports.flushCaches = exports.getCache = void 0;
|
|
4
|
-
exports.getCache = jest.fn().mockReturnValue({ cache: undefined, systemCache: undefined, lockCache: undefined });
|
|
5
|
-
exports.flushCaches = jest.fn();
|
|
6
|
-
exports.clearSystemCache = jest.fn();
|
|
7
|
-
exports.setSystemCache = jest.fn();
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sqlFieldList = exports.sqlFieldFormatter = void 0;
|
|
4
|
-
// dynamically adds fields to the sql strings as the schema grows
|
|
5
|
-
const sqlFieldFormatter = (schema, table) => {
|
|
6
|
-
const fields = [];
|
|
7
|
-
// Exclude alias fields, unable to selected in DB
|
|
8
|
-
for (const field of Object.keys(schema.collections[table].fields)) {
|
|
9
|
-
if (schema.collections[table].fields[field].type !== 'alias') {
|
|
10
|
-
fields.push(field);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
let sql = '';
|
|
14
|
-
for (const field of fields.slice(0, fields.length - 1)) {
|
|
15
|
-
sql += `"${table}"."${field}", `;
|
|
16
|
-
}
|
|
17
|
-
sql += `"${table}"."${fields[fields.length - 1]}"`;
|
|
18
|
-
return sql;
|
|
19
|
-
};
|
|
20
|
-
exports.sqlFieldFormatter = sqlFieldFormatter;
|
|
21
|
-
const sqlFieldList = (schema, table) => {
|
|
22
|
-
const fields = [];
|
|
23
|
-
// Exclude alias fields, unable to selected in DB
|
|
24
|
-
for (const field of Object.keys(schema.collections[table].fields)) {
|
|
25
|
-
if (schema.collections[table].fields[field].type !== 'alias') {
|
|
26
|
-
fields.push(field);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
let sql = '';
|
|
30
|
-
for (const field of fields.slice(0, fields.length - 1)) {
|
|
31
|
-
sql += `"${field}", `;
|
|
32
|
-
}
|
|
33
|
-
sql += `"${fields[fields.length - 1]}"`;
|
|
34
|
-
return sql;
|
|
35
|
-
};
|
|
36
|
-
exports.sqlFieldList = sqlFieldList;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { CollectionsOverview, Relation } from '@directus/shared/types';
|
|
2
|
-
export declare const systemSchema: {
|
|
3
|
-
collections: CollectionsOverview;
|
|
4
|
-
relations: Relation[];
|
|
5
|
-
};
|
|
6
|
-
export declare const userSchema: {
|
|
7
|
-
collections: CollectionsOverview;
|
|
8
|
-
relations: Relation[];
|
|
9
|
-
};
|
|
10
|
-
export declare const snapshotApplyTestSchema: {
|
|
11
|
-
collections: CollectionsOverview;
|
|
12
|
-
relations: Relation[];
|
|
13
|
-
};
|
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.snapshotApplyTestSchema = exports.userSchema = exports.systemSchema = void 0;
|
|
4
|
-
exports.systemSchema = {
|
|
5
|
-
collections: {
|
|
6
|
-
directus_users: {
|
|
7
|
-
collection: 'directus_users',
|
|
8
|
-
primary: 'id',
|
|
9
|
-
singleton: false,
|
|
10
|
-
note: '$t:directus_collection.directus_users',
|
|
11
|
-
sortField: null,
|
|
12
|
-
accountability: null,
|
|
13
|
-
fields: {
|
|
14
|
-
id: {
|
|
15
|
-
field: 'id',
|
|
16
|
-
defaultValue: null,
|
|
17
|
-
nullable: false,
|
|
18
|
-
generated: false,
|
|
19
|
-
type: 'uuid',
|
|
20
|
-
dbType: 'uuid',
|
|
21
|
-
precision: null,
|
|
22
|
-
scale: null,
|
|
23
|
-
special: [],
|
|
24
|
-
note: null,
|
|
25
|
-
alias: false,
|
|
26
|
-
validation: null,
|
|
27
|
-
},
|
|
28
|
-
name: {
|
|
29
|
-
field: 'name',
|
|
30
|
-
defaultValue: "A User's Name",
|
|
31
|
-
nullable: false,
|
|
32
|
-
generated: false,
|
|
33
|
-
type: 'uuid',
|
|
34
|
-
dbType: 'uuid',
|
|
35
|
-
precision: null,
|
|
36
|
-
scale: null,
|
|
37
|
-
special: [],
|
|
38
|
-
note: null,
|
|
39
|
-
alias: false,
|
|
40
|
-
validation: null,
|
|
41
|
-
},
|
|
42
|
-
items: {
|
|
43
|
-
field: 'items',
|
|
44
|
-
defaultValue: null,
|
|
45
|
-
nullable: true,
|
|
46
|
-
generated: false,
|
|
47
|
-
type: 'alias',
|
|
48
|
-
dbType: null,
|
|
49
|
-
precision: null,
|
|
50
|
-
scale: null,
|
|
51
|
-
special: ['o2m'],
|
|
52
|
-
note: null,
|
|
53
|
-
alias: true,
|
|
54
|
-
validation: null,
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
directus_files: {
|
|
59
|
-
collection: 'directus_files',
|
|
60
|
-
primary: 'id',
|
|
61
|
-
singleton: false,
|
|
62
|
-
note: '$t:directus_collection.directus_files',
|
|
63
|
-
sortField: null,
|
|
64
|
-
accountability: null,
|
|
65
|
-
fields: {
|
|
66
|
-
id: {
|
|
67
|
-
field: 'id',
|
|
68
|
-
defaultValue: null,
|
|
69
|
-
nullable: false,
|
|
70
|
-
generated: false,
|
|
71
|
-
type: 'uuid',
|
|
72
|
-
dbType: 'uuid',
|
|
73
|
-
precision: null,
|
|
74
|
-
scale: null,
|
|
75
|
-
special: [],
|
|
76
|
-
note: null,
|
|
77
|
-
alias: false,
|
|
78
|
-
validation: null,
|
|
79
|
-
},
|
|
80
|
-
title: {
|
|
81
|
-
field: 'title',
|
|
82
|
-
defaultValue: "A File's Title",
|
|
83
|
-
nullable: false,
|
|
84
|
-
generated: false,
|
|
85
|
-
type: 'string',
|
|
86
|
-
dbType: 'text',
|
|
87
|
-
precision: null,
|
|
88
|
-
scale: null,
|
|
89
|
-
special: [],
|
|
90
|
-
note: null,
|
|
91
|
-
alias: false,
|
|
92
|
-
validation: null,
|
|
93
|
-
},
|
|
94
|
-
uploaded_by: {
|
|
95
|
-
field: 'uploaded_by',
|
|
96
|
-
defaultValue: null,
|
|
97
|
-
nullable: true,
|
|
98
|
-
generated: false,
|
|
99
|
-
type: 'uuid',
|
|
100
|
-
dbType: 'uuid',
|
|
101
|
-
precision: null,
|
|
102
|
-
scale: null,
|
|
103
|
-
special: [],
|
|
104
|
-
note: null,
|
|
105
|
-
alias: false,
|
|
106
|
-
validation: null,
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
},
|
|
111
|
-
relations: [
|
|
112
|
-
{
|
|
113
|
-
collection: 'directus_files',
|
|
114
|
-
field: 'uploaded_by',
|
|
115
|
-
related_collection: 'directus_users',
|
|
116
|
-
schema: {
|
|
117
|
-
table: 'directus_files',
|
|
118
|
-
column: 'uploaded_by',
|
|
119
|
-
foreign_key_table: 'directus_users',
|
|
120
|
-
foreign_key_column: 'id',
|
|
121
|
-
on_update: 'NO ACTION',
|
|
122
|
-
on_delete: 'NO ACTION',
|
|
123
|
-
constraint_name: null,
|
|
124
|
-
},
|
|
125
|
-
meta: {
|
|
126
|
-
system: true,
|
|
127
|
-
many_collection: 'directus_files',
|
|
128
|
-
many_field: 'uploaded_by',
|
|
129
|
-
one_collection: 'directus_users',
|
|
130
|
-
one_field: 'items',
|
|
131
|
-
one_allowed_collections: null,
|
|
132
|
-
one_collection_field: null,
|
|
133
|
-
one_deselect_action: 'nullify',
|
|
134
|
-
junction_field: null,
|
|
135
|
-
sort_field: null,
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
],
|
|
139
|
-
};
|
|
140
|
-
exports.userSchema = {
|
|
141
|
-
collections: {
|
|
142
|
-
authors: {
|
|
143
|
-
collection: 'authors',
|
|
144
|
-
primary: 'id',
|
|
145
|
-
singleton: false,
|
|
146
|
-
note: 'authors',
|
|
147
|
-
sortField: null,
|
|
148
|
-
accountability: null,
|
|
149
|
-
fields: {
|
|
150
|
-
id: {
|
|
151
|
-
field: 'id',
|
|
152
|
-
defaultValue: null,
|
|
153
|
-
nullable: false,
|
|
154
|
-
generated: false,
|
|
155
|
-
type: 'uuid',
|
|
156
|
-
dbType: 'uuid',
|
|
157
|
-
precision: null,
|
|
158
|
-
scale: null,
|
|
159
|
-
special: [],
|
|
160
|
-
note: null,
|
|
161
|
-
alias: false,
|
|
162
|
-
validation: null,
|
|
163
|
-
},
|
|
164
|
-
name: {
|
|
165
|
-
field: 'name',
|
|
166
|
-
defaultValue: "An Author's Name",
|
|
167
|
-
nullable: false,
|
|
168
|
-
generated: false,
|
|
169
|
-
type: 'uuid',
|
|
170
|
-
dbType: 'uuid',
|
|
171
|
-
precision: null,
|
|
172
|
-
scale: null,
|
|
173
|
-
special: [],
|
|
174
|
-
note: null,
|
|
175
|
-
alias: false,
|
|
176
|
-
validation: null,
|
|
177
|
-
},
|
|
178
|
-
items: {
|
|
179
|
-
field: 'items',
|
|
180
|
-
defaultValue: null,
|
|
181
|
-
nullable: true,
|
|
182
|
-
generated: false,
|
|
183
|
-
type: 'alias',
|
|
184
|
-
dbType: null,
|
|
185
|
-
precision: null,
|
|
186
|
-
scale: null,
|
|
187
|
-
special: ['o2m'],
|
|
188
|
-
note: null,
|
|
189
|
-
alias: true,
|
|
190
|
-
validation: null,
|
|
191
|
-
},
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
posts: {
|
|
195
|
-
collection: 'posts',
|
|
196
|
-
primary: 'id',
|
|
197
|
-
singleton: false,
|
|
198
|
-
note: 'posts',
|
|
199
|
-
sortField: null,
|
|
200
|
-
accountability: null,
|
|
201
|
-
fields: {
|
|
202
|
-
id: {
|
|
203
|
-
field: 'id',
|
|
204
|
-
defaultValue: null,
|
|
205
|
-
nullable: false,
|
|
206
|
-
generated: false,
|
|
207
|
-
type: 'uuid',
|
|
208
|
-
dbType: 'uuid',
|
|
209
|
-
precision: null,
|
|
210
|
-
scale: null,
|
|
211
|
-
special: [],
|
|
212
|
-
note: null,
|
|
213
|
-
alias: false,
|
|
214
|
-
validation: null,
|
|
215
|
-
},
|
|
216
|
-
title: {
|
|
217
|
-
field: 'title',
|
|
218
|
-
defaultValue: "A Post's Title",
|
|
219
|
-
nullable: false,
|
|
220
|
-
generated: false,
|
|
221
|
-
type: 'string',
|
|
222
|
-
dbType: 'text',
|
|
223
|
-
precision: null,
|
|
224
|
-
scale: null,
|
|
225
|
-
special: [],
|
|
226
|
-
note: null,
|
|
227
|
-
alias: false,
|
|
228
|
-
validation: null,
|
|
229
|
-
},
|
|
230
|
-
uploaded_by: {
|
|
231
|
-
field: 'uploaded_by',
|
|
232
|
-
defaultValue: null,
|
|
233
|
-
nullable: true,
|
|
234
|
-
generated: false,
|
|
235
|
-
type: 'uuid',
|
|
236
|
-
dbType: 'uuid',
|
|
237
|
-
precision: null,
|
|
238
|
-
scale: null,
|
|
239
|
-
special: [],
|
|
240
|
-
note: null,
|
|
241
|
-
alias: false,
|
|
242
|
-
validation: null,
|
|
243
|
-
},
|
|
244
|
-
},
|
|
245
|
-
},
|
|
246
|
-
},
|
|
247
|
-
relations: [
|
|
248
|
-
{
|
|
249
|
-
collection: 'posts',
|
|
250
|
-
field: 'uploaded_by',
|
|
251
|
-
related_collection: 'authors',
|
|
252
|
-
schema: {
|
|
253
|
-
table: 'posts',
|
|
254
|
-
column: 'uploaded_by',
|
|
255
|
-
foreign_key_table: 'authors',
|
|
256
|
-
foreign_key_column: 'id',
|
|
257
|
-
on_update: 'NO ACTION',
|
|
258
|
-
on_delete: 'SET NULL',
|
|
259
|
-
constraint_name: null,
|
|
260
|
-
},
|
|
261
|
-
meta: {
|
|
262
|
-
id: 11,
|
|
263
|
-
many_collection: 'posts',
|
|
264
|
-
many_field: 'uploaded_by',
|
|
265
|
-
one_collection: 'authors',
|
|
266
|
-
one_field: 'items',
|
|
267
|
-
one_collection_field: null,
|
|
268
|
-
one_allowed_collections: null,
|
|
269
|
-
junction_field: null,
|
|
270
|
-
sort_field: null,
|
|
271
|
-
one_deselect_action: 'nullify',
|
|
272
|
-
},
|
|
273
|
-
},
|
|
274
|
-
],
|
|
275
|
-
};
|
|
276
|
-
exports.snapshotApplyTestSchema = {
|
|
277
|
-
collections: {
|
|
278
|
-
test_table: {
|
|
279
|
-
collection: 'test_table',
|
|
280
|
-
primary: 'id',
|
|
281
|
-
singleton: false,
|
|
282
|
-
note: 'test_table',
|
|
283
|
-
sortField: null,
|
|
284
|
-
accountability: 'all',
|
|
285
|
-
fields: {
|
|
286
|
-
id: {
|
|
287
|
-
field: 'id',
|
|
288
|
-
defaultValue: null,
|
|
289
|
-
nullable: false,
|
|
290
|
-
generated: false,
|
|
291
|
-
type: 'uuid',
|
|
292
|
-
dbType: 'uuid',
|
|
293
|
-
precision: null,
|
|
294
|
-
scale: null,
|
|
295
|
-
special: [],
|
|
296
|
-
note: null,
|
|
297
|
-
alias: false,
|
|
298
|
-
validation: null,
|
|
299
|
-
},
|
|
300
|
-
},
|
|
301
|
-
},
|
|
302
|
-
},
|
|
303
|
-
relations: [],
|
|
304
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Snapshot } from '../types';
|
|
2
|
-
export declare const snapshotBeforeCreateCollection: Snapshot;
|
|
3
|
-
export declare const snapshotCreateCollection: Snapshot;
|
|
4
|
-
export declare const snapshotCreateCollectionNotNested: Snapshot;
|
|
5
|
-
export declare const snapshotBeforeDeleteCollection: Snapshot;
|