directus 9.10.0 → 9.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +8 -1
- package/dist/auth/drivers/oauth2.d.ts +1 -1
- package/dist/auth/drivers/oauth2.js +14 -11
- package/dist/auth/drivers/openid.d.ts +1 -1
- package/dist/auth/drivers/openid.js +14 -11
- package/dist/cli/commands/schema/apply.js +4 -3
- package/dist/cli/utils/create-env/env-stub.liquid +266 -9
- package/dist/controllers/activity.js +1 -1
- package/dist/controllers/assets.js +8 -9
- package/dist/controllers/flows.d.ts +2 -0
- package/dist/controllers/flows.js +157 -0
- package/dist/controllers/folders.js +1 -1
- package/dist/controllers/notifications.js +1 -1
- package/dist/controllers/operations.d.ts +2 -0
- package/dist/controllers/operations.js +138 -0
- package/dist/database/helpers/date/dialects/sqlite.js +6 -2
- package/dist/database/index.js +15 -19
- package/dist/database/migrations/20210225A-add-relations-sort-field.js +2 -1
- package/dist/database/migrations/20210506A-rename-interfaces.js +2 -1
- package/dist/database/migrations/20210802A-replace-groups.js +2 -1
- package/dist/database/migrations/20210805A-update-groups.js +2 -1
- package/dist/database/migrations/20210805B-change-image-metadata-structure.js +3 -2
- package/dist/database/migrations/20211007A-update-presets.js +5 -4
- package/dist/database/migrations/20220429A-add-flows.d.ts +3 -0
- package/dist/database/migrations/20220429A-add-flows.js +83 -0
- package/dist/database/migrations/20220429B-add-color-to-insights-icon.d.ts +3 -0
- package/dist/database/migrations/20220429B-add-color-to-insights-icon.js +15 -0
- package/dist/database/migrations/20220429C-drop-non-null-from-ip-of-activity.d.ts +3 -0
- package/dist/database/migrations/20220429C-drop-non-null-from-ip-of-activity.js +15 -0
- package/dist/database/migrations/20220429D-drop-non-null-from-sender-of-notifications.d.ts +3 -0
- package/dist/database/migrations/20220429D-drop-non-null-from-sender-of-notifications.js +15 -0
- package/dist/database/run-ast.js +10 -14
- package/dist/database/seeds/05-activity.yaml +0 -1
- package/dist/database/system-data/collections/collections.yaml +4 -0
- package/dist/database/system-data/fields/activity.yaml +3 -0
- package/dist/database/system-data/fields/dashboards.yaml +3 -1
- package/dist/database/system-data/fields/flows.yaml +21 -0
- package/dist/database/system-data/fields/notifications.yaml +3 -1
- package/dist/database/system-data/fields/operations.yaml +19 -0
- package/dist/database/system-data/fields/panels.yaml +3 -1
- package/dist/database/system-data/fields/shares.yaml +3 -1
- package/dist/database/system-data/fields/users.yaml +2 -4
- package/dist/database/system-data/relations/relations.yaml +20 -0
- package/dist/env.d.ts +1 -1
- package/dist/env.js +167 -12
- package/dist/exceptions/index.d.ts +1 -0
- package/dist/exceptions/index.js +1 -0
- package/dist/exceptions/invalid-provider.d.ts +4 -0
- package/dist/exceptions/invalid-provider.js +10 -0
- package/dist/exceptions/range-not-satisfiable.d.ts +2 -2
- package/dist/exceptions/range-not-satisfiable.js +5 -1
- package/dist/extensions.d.ts +3 -0
- package/dist/extensions.js +73 -20
- package/dist/flows.d.ts +17 -0
- package/dist/flows.js +310 -0
- package/dist/messenger.d.ts +24 -0
- package/dist/messenger.js +64 -0
- package/dist/middleware/graphql.js +2 -1
- package/dist/operations/condition/index.d.ts +6 -0
- package/dist/operations/condition/index.js +15 -0
- package/dist/operations/item-create/index.d.ts +8 -0
- package/dist/operations/item-create/index.js +40 -0
- package/dist/operations/item-delete/index.d.ts +9 -0
- package/dist/operations/item-delete/index.js +45 -0
- package/dist/operations/item-read/index.d.ts +9 -0
- package/dist/operations/item-read/index.js +45 -0
- package/dist/operations/item-update/index.d.ts +10 -0
- package/dist/operations/item-update/index.js +50 -0
- package/dist/operations/log/index.d.ts +5 -0
- package/dist/operations/log/index.js +14 -0
- package/dist/operations/mail/index.d.ts +7 -0
- package/dist/operations/mail/index.js +16 -0
- package/dist/operations/notification/index.d.ts +8 -0
- package/dist/operations/notification/index.js +39 -0
- package/dist/operations/request/index.d.ts +9 -0
- package/dist/operations/request/index.js +14 -0
- package/dist/operations/sleep/index.d.ts +5 -0
- package/dist/operations/sleep/index.js +9 -0
- package/dist/operations/transform/index.d.ts +5 -0
- package/dist/operations/transform/index.js +10 -0
- package/dist/operations/trigger/index.d.ts +6 -0
- package/dist/operations/trigger/index.js +21 -0
- package/dist/services/activity.d.ts +1 -2
- package/dist/services/activity.js +10 -10
- package/dist/services/assets.js +27 -1
- package/dist/services/authentication.d.ts +2 -2
- package/dist/services/authentication.js +11 -8
- package/dist/services/authorization.js +12 -0
- package/dist/services/fields.js +15 -8
- package/dist/services/flows.d.ts +14 -0
- package/dist/services/flows.js +42 -0
- package/dist/services/graphql.js +56 -33
- package/dist/services/import-export.d.ts +1 -1
- package/dist/services/import-export.js +13 -12
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.js +2 -0
- package/dist/services/items.d.ts +3 -3
- package/dist/services/items.js +25 -2
- package/dist/services/mail/index.js +2 -1
- package/dist/services/notifications.d.ts +2 -1
- package/dist/services/notifications.js +4 -3
- package/dist/services/operations.d.ts +14 -0
- package/dist/services/operations.js +42 -0
- package/dist/services/payload.d.ts +2 -2
- package/dist/services/payload.js +8 -7
- package/dist/services/users.d.ts +4 -0
- package/dist/services/users.js +20 -0
- package/dist/services/webhooks.d.ts +2 -0
- package/dist/services/webhooks.js +8 -7
- package/dist/types/events.d.ts +18 -0
- package/dist/types/events.js +2 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +1 -1
- package/dist/utils/apply-query.js +31 -4
- package/dist/utils/apply-snapshot.d.ts +3 -3
- package/dist/utils/apply-snapshot.js +64 -49
- package/dist/utils/construct-flow-tree.d.ts +2 -0
- package/dist/utils/construct-flow-tree.js +31 -0
- package/dist/utils/get-accountability-for-role.d.ts +7 -0
- package/dist/utils/get-accountability-for-role.js +36 -0
- package/dist/utils/get-ast-from-query.js +1 -7
- package/dist/utils/get-default-value.js +4 -3
- package/dist/utils/get-permissions.d.ts +1 -1
- package/dist/utils/get-permissions.js +9 -8
- package/dist/utils/get-schema.js +2 -1
- package/dist/utils/get-snapshot.js +22 -4
- package/dist/utils/operation-options.d.ts +3 -0
- package/dist/utils/operation-options.js +45 -0
- package/dist/utils/parse-json.d.ts +5 -0
- package/dist/utils/parse-json.js +19 -0
- package/dist/utils/sanitize-query.d.ts +1 -2
- package/dist/utils/sanitize-query.js +6 -5
- package/dist/utils/validate-keys.d.ts +6 -0
- package/dist/utils/validate-keys.js +28 -0
- package/dist/utils/validate-query.js +1 -1
- package/dist/webhooks.d.ts +2 -0
- package/dist/webhooks.js +17 -2
- package/package.json +18 -14
- package/dist/types/activity.d.ts +0 -9
- package/dist/types/activity.js +0 -13
- package/example.env +0 -202
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.down = exports.up = void 0;
|
|
4
|
+
async function up(knex) {
|
|
5
|
+
await knex.schema.alterTable('directus_activity', (table) => {
|
|
6
|
+
table.setNullable('ip');
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
exports.up = up;
|
|
10
|
+
async function down(knex) {
|
|
11
|
+
await knex.schema.alterTable('directus_activity', (table) => {
|
|
12
|
+
table.dropNullable('ip');
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
exports.down = down;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.down = exports.up = void 0;
|
|
4
|
+
async function up(knex) {
|
|
5
|
+
await knex.schema.alterTable('directus_notifications', (table) => {
|
|
6
|
+
table.setNullable('sender');
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
exports.up = up;
|
|
10
|
+
async function down(knex) {
|
|
11
|
+
await knex.schema.alterTable('directus_notifications', (table) => {
|
|
12
|
+
table.dropNullable('sender');
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
exports.down = down;
|
package/dist/database/run-ast.js
CHANGED
|
@@ -93,14 +93,9 @@ async function parseCurrentLevel(schema, collection, children, query) {
|
|
|
93
93
|
const nestedCollectionNodes = [];
|
|
94
94
|
for (const child of children) {
|
|
95
95
|
if (child.type === 'field') {
|
|
96
|
-
const
|
|
97
|
-
if (columnsInCollection.includes(
|
|
98
|
-
columnsToSelectInternal.push(child.
|
|
99
|
-
if (query.alias) {
|
|
100
|
-
columnsToSelectInternal.push(...Object.entries(query.alias)
|
|
101
|
-
.filter(([_key, value]) => value === child.name)
|
|
102
|
-
.map(([key]) => key));
|
|
103
|
-
}
|
|
96
|
+
const fieldName = (0, strip_function_1.stripFunction)(child.name);
|
|
97
|
+
if (columnsInCollection.includes(fieldName)) {
|
|
98
|
+
columnsToSelectInternal.push(child.fieldKey);
|
|
104
99
|
}
|
|
105
100
|
continue;
|
|
106
101
|
}
|
|
@@ -126,7 +121,7 @@ async function parseCurrentLevel(schema, collection, children, query) {
|
|
|
126
121
|
const columnsToSelect = [...new Set(columnsToSelectInternal)];
|
|
127
122
|
const fieldNodes = columnsToSelect.map((column) => {
|
|
128
123
|
var _a;
|
|
129
|
-
return (_a = children.find((childNode) => childNode.type === 'field' &&
|
|
124
|
+
return (_a = children.find((childNode) => childNode.type === 'field' && childNode.fieldKey === column)) !== null && _a !== void 0 ? _a : {
|
|
130
125
|
type: 'field',
|
|
131
126
|
name: column,
|
|
132
127
|
fieldKey: column,
|
|
@@ -137,6 +132,11 @@ async function parseCurrentLevel(schema, collection, children, query) {
|
|
|
137
132
|
function getColumnPreprocessor(knex, schema, table) {
|
|
138
133
|
const helpers = (0, helpers_1.getHelpers)(knex);
|
|
139
134
|
return function (fieldNode) {
|
|
135
|
+
var _a;
|
|
136
|
+
let alias = undefined;
|
|
137
|
+
if (fieldNode.name !== fieldNode.fieldKey) {
|
|
138
|
+
alias = fieldNode.fieldKey;
|
|
139
|
+
}
|
|
140
140
|
let field;
|
|
141
141
|
if (fieldNode.type === 'field') {
|
|
142
142
|
field = schema.collections[table].fields[(0, strip_function_1.stripFunction)(fieldNode.name)];
|
|
@@ -144,11 +144,7 @@ function getColumnPreprocessor(knex, schema, table) {
|
|
|
144
144
|
else {
|
|
145
145
|
field = schema.collections[fieldNode.relation.collection].fields[fieldNode.relation.field];
|
|
146
146
|
}
|
|
147
|
-
|
|
148
|
-
if (fieldNode.name !== fieldNode.fieldKey) {
|
|
149
|
-
alias = fieldNode.fieldKey;
|
|
150
|
-
}
|
|
151
|
-
if (field.type.startsWith('geometry')) {
|
|
147
|
+
if ((_a = field === null || field === void 0 ? void 0 : field.type) === null || _a === void 0 ? void 0 : _a.startsWith('geometry')) {
|
|
152
148
|
return helpers.st.asText(table, field.field);
|
|
153
149
|
}
|
|
154
150
|
return (0, get_column_1.getColumn)(knex, table, fieldNode.name, alias, schema);
|
|
@@ -68,3 +68,7 @@ data:
|
|
|
68
68
|
- collection: directus_shares
|
|
69
69
|
icon: share
|
|
70
70
|
note: $t:directus_collection.directus_shares
|
|
71
|
+
- collection: directus_flows
|
|
72
|
+
note: $t:directus_collection.directus_flows
|
|
73
|
+
- collection: directus_operations
|
|
74
|
+
note: $t:directus_collection.directus_operations
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
table: directus_flows
|
|
2
|
+
|
|
3
|
+
fields:
|
|
4
|
+
- field: id
|
|
5
|
+
special: uuid
|
|
6
|
+
- field: name
|
|
7
|
+
- field: icon
|
|
8
|
+
- field: color
|
|
9
|
+
- field: note
|
|
10
|
+
- field: status
|
|
11
|
+
- field: trigger
|
|
12
|
+
- field: accountability
|
|
13
|
+
- field: options
|
|
14
|
+
special: cast-json
|
|
15
|
+
- field: operation
|
|
16
|
+
- field: operations
|
|
17
|
+
special: o2m
|
|
18
|
+
- field: date_created
|
|
19
|
+
special: date-created
|
|
20
|
+
- field: user_created
|
|
21
|
+
special: user-created
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
table: directus_operations
|
|
2
|
+
|
|
3
|
+
fields:
|
|
4
|
+
- field: id
|
|
5
|
+
special: uuid
|
|
6
|
+
- field: name
|
|
7
|
+
- field: key
|
|
8
|
+
- field: type
|
|
9
|
+
- field: position_x
|
|
10
|
+
- field: position_y
|
|
11
|
+
- field: options
|
|
12
|
+
special: cast-json
|
|
13
|
+
- field: resolve
|
|
14
|
+
- field: reject
|
|
15
|
+
- field: flow
|
|
16
|
+
- field: date_created
|
|
17
|
+
special: date-created
|
|
18
|
+
- field: user_created
|
|
19
|
+
special: user-created
|
|
@@ -135,10 +135,8 @@ fields:
|
|
|
135
135
|
template: '{{ name }}'
|
|
136
136
|
|
|
137
137
|
- field: token
|
|
138
|
-
interface: token
|
|
139
|
-
|
|
140
|
-
iconRight: vpn_key
|
|
141
|
-
placeholder: $t:fields.directus_users.token_placeholder
|
|
138
|
+
interface: system-token
|
|
139
|
+
special: conceal
|
|
142
140
|
width: full
|
|
143
141
|
|
|
144
142
|
- field: id
|
|
@@ -61,6 +61,20 @@ data:
|
|
|
61
61
|
many_field: dashboard
|
|
62
62
|
one_collection: directus_dashboards
|
|
63
63
|
one_field: panels
|
|
64
|
+
- many_collection: directus_flows
|
|
65
|
+
many_field: operation
|
|
66
|
+
one_collection: directus_operations
|
|
67
|
+
- many_collection: directus_operations
|
|
68
|
+
many_field: flow
|
|
69
|
+
one_collection: directus_flows
|
|
70
|
+
one_field: operations
|
|
71
|
+
one_deselect_action: delete
|
|
72
|
+
- many_collection: directus_operations
|
|
73
|
+
many_field: resolve
|
|
74
|
+
one_collection: directus_operations
|
|
75
|
+
- many_collection: directus_operations
|
|
76
|
+
many_field: reject
|
|
77
|
+
one_collection: directus_operations
|
|
64
78
|
- many_collection: directus_files
|
|
65
79
|
many_field: modified_by
|
|
66
80
|
one_collection: directus_users
|
|
@@ -88,6 +102,12 @@ data:
|
|
|
88
102
|
- many_collection: directus_panels
|
|
89
103
|
many_field: user_created
|
|
90
104
|
one_collection: directus_users
|
|
105
|
+
- many_collection: directus_flows
|
|
106
|
+
many_field: user_created
|
|
107
|
+
one_collection: directus_users
|
|
108
|
+
- many_collection: directus_operations
|
|
109
|
+
many_field: user_created
|
|
110
|
+
one_collection: directus_users
|
|
91
111
|
- many_collection: directus_notifications
|
|
92
112
|
many_field: recipient
|
|
93
113
|
one_collection: directus_users
|
package/dist/env.d.ts
CHANGED
package/dist/env.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* @NOTE
|
|
4
|
-
*
|
|
4
|
+
* For all possible keys, see: https://docs.directus.io/configuration/config-options/
|
|
5
5
|
*/
|
|
6
6
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
7
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
@@ -14,6 +14,156 @@ const lodash_1 = require("lodash");
|
|
|
14
14
|
const path_1 = __importDefault(require("path"));
|
|
15
15
|
const require_yaml_1 = require("./utils/require-yaml");
|
|
16
16
|
const utils_1 = require("@directus/shared/utils");
|
|
17
|
+
const parse_json_1 = require("./utils/parse-json");
|
|
18
|
+
// keeping this here for now to prevent a circular import to constants.ts
|
|
19
|
+
const allowedEnvironmentVars = [
|
|
20
|
+
// general
|
|
21
|
+
'CONFIG_PATH',
|
|
22
|
+
'HOST',
|
|
23
|
+
'PORT',
|
|
24
|
+
'PUBLIC_URL',
|
|
25
|
+
'LOG_LEVEL',
|
|
26
|
+
'LOG_STYLE',
|
|
27
|
+
'MAX_PAYLOAD_SIZE',
|
|
28
|
+
'ROOT_REDIRECT',
|
|
29
|
+
'SERVE_APP',
|
|
30
|
+
'GRAPHQL_INTROSPECTION',
|
|
31
|
+
'LOGGER_.+',
|
|
32
|
+
// server
|
|
33
|
+
'SERVER_.+',
|
|
34
|
+
// database
|
|
35
|
+
'DB_.+',
|
|
36
|
+
// security
|
|
37
|
+
'KEY',
|
|
38
|
+
'SECRET',
|
|
39
|
+
'ACCESS_TOKEN_TTL',
|
|
40
|
+
'REFRESH_TOKEN_TTL',
|
|
41
|
+
'REFRESH_TOKEN_COOKIE_DOMAIN',
|
|
42
|
+
'REFRESH_TOKEN_COOKIE_SECURE',
|
|
43
|
+
'REFRESH_TOKEN_COOKIE_SAME_SITE',
|
|
44
|
+
'REFRESH_TOKEN_COOKIE_NAME',
|
|
45
|
+
'PASSWORD_RESET_URL_ALLOW_LIST',
|
|
46
|
+
'USER_INVITE_URL_ALLOW_LIST',
|
|
47
|
+
'IP_TRUST_PROXY',
|
|
48
|
+
'IP_CUSTOM_HEADER',
|
|
49
|
+
'ASSETS_CONTENT_SECURITY_POLICY',
|
|
50
|
+
'IMPORT_IP_DENY_LIST',
|
|
51
|
+
'CONTENT_SECURITY_POLICY_.+',
|
|
52
|
+
'HSTS_.+',
|
|
53
|
+
// hashing
|
|
54
|
+
'HASH_.+',
|
|
55
|
+
// cors
|
|
56
|
+
'CORS_ENABLED',
|
|
57
|
+
'CORS_ORIGIN',
|
|
58
|
+
'CORS_METHODS',
|
|
59
|
+
'CORS_ALLOWED_HEADERS',
|
|
60
|
+
'CORS_EXPOSED_HEADERS',
|
|
61
|
+
'CORS_CREDENTIALS',
|
|
62
|
+
'CORS_MAX_AGE',
|
|
63
|
+
// rate limiting
|
|
64
|
+
'RATE_LIMITER_.+',
|
|
65
|
+
// cache
|
|
66
|
+
'CACHE_ENABLED',
|
|
67
|
+
'CACHE_TTL',
|
|
68
|
+
'CACHE_CONTROL_S_MAXAGE',
|
|
69
|
+
'CACHE_AUTO_PURGE',
|
|
70
|
+
'CACHE_SYSTEM_TTL',
|
|
71
|
+
'CACHE_SCHEMA',
|
|
72
|
+
'CACHE_PERMISSIONS',
|
|
73
|
+
'CACHE_NAMESPACE',
|
|
74
|
+
'CACHE_STORE',
|
|
75
|
+
'CACHE_STATUS_HEADER',
|
|
76
|
+
'CACHE_REDIS',
|
|
77
|
+
'CACHE_REDIS_HOST',
|
|
78
|
+
'CACHE_REDIS_PORT',
|
|
79
|
+
'CACHE_REDIS_PASSWORD',
|
|
80
|
+
'CACHE_MEMCACHE',
|
|
81
|
+
// storage
|
|
82
|
+
'STORAGE_LOCATIONS',
|
|
83
|
+
'STORAGE_.+_DRIVER',
|
|
84
|
+
'STORAGE_.+_ROOT',
|
|
85
|
+
'STORAGE_.+_KEY',
|
|
86
|
+
'STORAGE_.+_SECRET',
|
|
87
|
+
'STORAGE_.+_BUCKET',
|
|
88
|
+
'STORAGE_.+_REGION',
|
|
89
|
+
'STORAGE_.+_ENDPOINT',
|
|
90
|
+
'STORAGE_.+_ACL',
|
|
91
|
+
'STORAGE_.+_CONTAINER_NAME',
|
|
92
|
+
'STORAGE_.+_ACCOUNT_NAME',
|
|
93
|
+
'STORAGE_.+_ACCOUNT_KEY',
|
|
94
|
+
'STORAGE_.+_ENDPOINT',
|
|
95
|
+
'STORAGE_.+_KEY_FILENAME',
|
|
96
|
+
'STORAGE_.+_BUCKET',
|
|
97
|
+
// metadata
|
|
98
|
+
'FILE_METADATA_ALLOW_LIST',
|
|
99
|
+
// assets
|
|
100
|
+
'ASSETS_CACHE_TTL',
|
|
101
|
+
'ASSETS_TRANSFORM_MAX_CONCURRENT',
|
|
102
|
+
'ASSETS_TRANSFORM_IMAGE_MAX_DIMENSION',
|
|
103
|
+
'ASSETS_TRANSFORM_MAX_OPERATIONS',
|
|
104
|
+
'ASSETS_CONTENT_SECURITY_POLICY',
|
|
105
|
+
// auth
|
|
106
|
+
'AUTH_PROVIDERS',
|
|
107
|
+
'AUTH_DISABLE_DEFAULT',
|
|
108
|
+
'AUTH_.+_DRIVER',
|
|
109
|
+
'AUTH_.+_CLIENT_ID',
|
|
110
|
+
'AUTH_.+_CLIENT_SECRET',
|
|
111
|
+
'AUTH_.+_SCOPE',
|
|
112
|
+
'AUTH_.+_AUTHORIZE_URL',
|
|
113
|
+
'AUTH_.+_ACCESS_URL',
|
|
114
|
+
'AUTH_.+_PROFILE_URL',
|
|
115
|
+
'AUTH_.+_IDENTIFIER_KEY',
|
|
116
|
+
'AUTH_.+_EMAIL_KEY',
|
|
117
|
+
'AUTH_.+_FIRST_NAME_KEY',
|
|
118
|
+
'AUTH_.+_LAST_NAME_KEY',
|
|
119
|
+
'AUTH_.+_ALLOW_PUBLIC_REGISTRATION',
|
|
120
|
+
'AUTH_.+_DEFAULT_ROLE_ID',
|
|
121
|
+
'AUTH_.+_ICON',
|
|
122
|
+
'AUTH_.+_PARAMS',
|
|
123
|
+
'AUTH_.+_ISSUER_URL',
|
|
124
|
+
'AUTH_.+_AUTH_REQUIRE_VERIFIED_EMAIL',
|
|
125
|
+
'AUTH_.+_CLIENT_URL',
|
|
126
|
+
'AUTH_.+_BIND_DN',
|
|
127
|
+
'AUTH_.+_BIND_PASSWORD',
|
|
128
|
+
'AUTH_.+_USER_DN',
|
|
129
|
+
'AUTH_.+_USER_ATTRIBUTE',
|
|
130
|
+
'AUTH_.+_USER_SCOPE',
|
|
131
|
+
'AUTH_.+_MAIL_ATTRIBUTE',
|
|
132
|
+
'AUTH_.+_FIRST_NAME_ATTRIBUTE',
|
|
133
|
+
'AUTH_.+_LAST_NAME_ATTRIBUTE',
|
|
134
|
+
'AUTH_.+_GROUP_DN',
|
|
135
|
+
'AUTH_.+_GROUP_ATTRIBUTE',
|
|
136
|
+
'AUTH_.+_GROUP_SCOPE',
|
|
137
|
+
// extensions
|
|
138
|
+
'EXTENSIONS_PATH',
|
|
139
|
+
'EXTENSIONS_AUTO_RELOAD',
|
|
140
|
+
// emails
|
|
141
|
+
'EMAIL_FROM',
|
|
142
|
+
'EMAIL_TRANSPORT',
|
|
143
|
+
'EMAIL_SENDMAIL_NEW_LINE',
|
|
144
|
+
'EMAIL_SENDMAIL_PATH',
|
|
145
|
+
'EMAIL_SMTP_HOST',
|
|
146
|
+
'EMAIL_SMTP_PORT',
|
|
147
|
+
'EMAIL_SMTP_USER',
|
|
148
|
+
'EMAIL_SMTP_PASSWORD',
|
|
149
|
+
'EMAIL_SMTP_POOL',
|
|
150
|
+
'EMAIL_SMTP_SECURE',
|
|
151
|
+
'EMAIL_SMTP_IGNORE_TLS',
|
|
152
|
+
'EMAIL_MAILGUN_API_KEY',
|
|
153
|
+
'EMAIL_MAILGUN_DOMAIN',
|
|
154
|
+
'EMAIL_MAILGUN_HOST',
|
|
155
|
+
'EMAIL_SES_CREDENTIALS__ACCESS_KEY_ID',
|
|
156
|
+
'EMAIL_SES_CREDENTIALS__SECRET_ACCESS_KEY',
|
|
157
|
+
'EMAIL_SES_REGION',
|
|
158
|
+
// admin account
|
|
159
|
+
'ADMIN_EMAIL',
|
|
160
|
+
'ADMIN_PASSWORD',
|
|
161
|
+
// telemetry
|
|
162
|
+
'TELEMETRY',
|
|
163
|
+
// limits & optimization
|
|
164
|
+
'RELATIONAL_BATCH_SIZE',
|
|
165
|
+
'EXPORT_BATCH_SIZE',
|
|
166
|
+
].map((name) => new RegExp(`^${name}$`));
|
|
17
167
|
const acceptedEnvTypes = ['string', 'number', 'regex', 'array', 'json'];
|
|
18
168
|
const defaults = {
|
|
19
169
|
CONFIG_PATH: path_1.default.resolve(process.cwd(), '.env'),
|
|
@@ -179,15 +329,17 @@ function processValues(env) {
|
|
|
179
329
|
let newKey;
|
|
180
330
|
if (key.length > 5 && key.endsWith('_FILE')) {
|
|
181
331
|
newKey = key.slice(0, -5);
|
|
182
|
-
if (
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
332
|
+
if (allowedEnvironmentVars.some((pattern) => pattern.test(newKey))) {
|
|
333
|
+
if (newKey in env) {
|
|
334
|
+
throw new Error(`Duplicate environment variable encountered: you can't use "${newKey}" and "${key}" simultaneously.`);
|
|
335
|
+
}
|
|
336
|
+
try {
|
|
337
|
+
value = fs_1.default.readFileSync(value, { encoding: 'utf8' });
|
|
338
|
+
key = newKey;
|
|
339
|
+
}
|
|
340
|
+
catch {
|
|
341
|
+
throw new Error(`Failed to read value from file "${value}", defined in environment variable "${key}".`);
|
|
342
|
+
}
|
|
191
343
|
}
|
|
192
344
|
}
|
|
193
345
|
// Convert values with a type prefix
|
|
@@ -212,7 +364,7 @@ function processValues(env) {
|
|
|
212
364
|
env[key] = tryJSON(value);
|
|
213
365
|
break;
|
|
214
366
|
case 'boolean':
|
|
215
|
-
env[key] = value
|
|
367
|
+
env[key] = toBoolean(value);
|
|
216
368
|
}
|
|
217
369
|
continue;
|
|
218
370
|
}
|
|
@@ -255,9 +407,12 @@ function processValues(env) {
|
|
|
255
407
|
}
|
|
256
408
|
function tryJSON(value) {
|
|
257
409
|
try {
|
|
258
|
-
return
|
|
410
|
+
return (0, parse_json_1.parseJSON)(value);
|
|
259
411
|
}
|
|
260
412
|
catch {
|
|
261
413
|
return value;
|
|
262
414
|
}
|
|
263
415
|
}
|
|
416
|
+
function toBoolean(value) {
|
|
417
|
+
return value === 'true' || value === true || value === '1' || value === 1;
|
|
418
|
+
}
|
|
@@ -7,6 +7,7 @@ export * from './invalid-credentials';
|
|
|
7
7
|
export * from './invalid-ip';
|
|
8
8
|
export * from './invalid-otp';
|
|
9
9
|
export * from './invalid-payload';
|
|
10
|
+
export * from './invalid-provider';
|
|
10
11
|
export * from './invalid-query';
|
|
11
12
|
export * from './invalid-token';
|
|
12
13
|
export * from './method-not-allowed';
|
package/dist/exceptions/index.js
CHANGED
|
@@ -19,6 +19,7 @@ __exportStar(require("./invalid-credentials"), exports);
|
|
|
19
19
|
__exportStar(require("./invalid-ip"), exports);
|
|
20
20
|
__exportStar(require("./invalid-otp"), exports);
|
|
21
21
|
__exportStar(require("./invalid-payload"), exports);
|
|
22
|
+
__exportStar(require("./invalid-provider"), exports);
|
|
22
23
|
__exportStar(require("./invalid-query"), exports);
|
|
23
24
|
__exportStar(require("./invalid-token"), exports);
|
|
24
25
|
__exportStar(require("./method-not-allowed"), exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InvalidProviderException = void 0;
|
|
4
|
+
const exceptions_1 = require("@directus/shared/exceptions");
|
|
5
|
+
class InvalidProviderException extends exceptions_1.BaseException {
|
|
6
|
+
constructor(message = 'Invalid provider.') {
|
|
7
|
+
super(message, 403, 'INVALID_PROVIDER');
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.InvalidProviderException = InvalidProviderException;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Range } from '@directus/drive';
|
|
2
1
|
import { BaseException } from '@directus/shared/exceptions';
|
|
2
|
+
import { Range } from '@directus/drive';
|
|
3
3
|
export declare class RangeNotSatisfiableException extends BaseException {
|
|
4
|
-
constructor(range
|
|
4
|
+
constructor(range?: Range);
|
|
5
5
|
}
|
|
@@ -4,7 +4,11 @@ exports.RangeNotSatisfiableException = void 0;
|
|
|
4
4
|
const exceptions_1 = require("@directus/shared/exceptions");
|
|
5
5
|
class RangeNotSatisfiableException extends exceptions_1.BaseException {
|
|
6
6
|
constructor(range) {
|
|
7
|
-
|
|
7
|
+
var _a, _b;
|
|
8
|
+
const rangeString = range && ((range === null || range === void 0 ? void 0 : range.start) !== undefined || (range === null || range === void 0 ? void 0 : range.end) !== undefined)
|
|
9
|
+
? `"${(_a = range.start) !== null && _a !== void 0 ? _a : ''}-${(_b = range.end) !== null && _b !== void 0 ? _b : ''}" `
|
|
10
|
+
: '';
|
|
11
|
+
super(`Range ${rangeString}is invalid or the file's size doesn't match the requested range.`, 416, 'RANGE_NOT_SATISFIABLE');
|
|
8
12
|
}
|
|
9
13
|
}
|
|
10
14
|
exports.RangeNotSatisfiableException = RangeNotSatisfiableException;
|
package/dist/extensions.d.ts
CHANGED
|
@@ -29,9 +29,12 @@ declare class ExtensionManager {
|
|
|
29
29
|
private getSharedDepsMapping;
|
|
30
30
|
private registerHooks;
|
|
31
31
|
private registerEndpoints;
|
|
32
|
+
private registerOperations;
|
|
32
33
|
private registerHook;
|
|
33
34
|
private registerEndpoint;
|
|
35
|
+
private registerOperation;
|
|
34
36
|
private unregisterHooks;
|
|
35
37
|
private unregisterEndpoints;
|
|
38
|
+
private unregisterOperations;
|
|
36
39
|
}
|
|
37
40
|
export {};
|