directus 9.23.3 → 9.24.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 +15 -15
- package/dist/auth/drivers/ldap.js +22 -22
- package/dist/auth/drivers/local.js +7 -7
- package/dist/auth/drivers/oauth2.js +27 -25
- package/dist/auth/drivers/openid.js +32 -30
- package/dist/auth/drivers/saml.js +10 -10
- package/dist/auth.js +4 -3
- package/dist/cache.js +16 -11
- package/dist/cli/commands/bootstrap/index.js +5 -4
- package/dist/cli/utils/create-db-connection.js +1 -1
- package/dist/cli/utils/create-env/index.js +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +6 -5
- package/dist/controllers/activity.js +10 -10
- package/dist/controllers/assets.js +19 -18
- package/dist/controllers/auth.js +16 -16
- package/dist/controllers/collections.js +11 -11
- package/dist/controllers/dashboards.js +11 -11
- package/dist/controllers/extensions.js +3 -3
- package/dist/controllers/fields.js +17 -17
- package/dist/controllers/files.js +18 -17
- package/dist/controllers/flows.js +13 -13
- package/dist/controllers/folders.js +11 -11
- package/dist/controllers/graphql.js +6 -6
- package/dist/controllers/items.js +19 -19
- package/dist/controllers/notifications.js +11 -11
- package/dist/controllers/operations.js +11 -11
- package/dist/controllers/panels.js +11 -11
- package/dist/controllers/permissions.js +11 -11
- package/dist/controllers/presets.js +11 -11
- package/dist/controllers/relations.js +11 -11
- package/dist/controllers/revisions.js +3 -3
- package/dist/controllers/roles.js +11 -11
- package/dist/controllers/schema.js +5 -5
- package/dist/controllers/server.js +7 -7
- package/dist/controllers/settings.js +2 -2
- package/dist/controllers/shares.js +14 -14
- package/dist/controllers/users.js +16 -16
- package/dist/controllers/utils.js +7 -7
- package/dist/controllers/webhooks.js +11 -11
- package/dist/database/helpers/fn/types.d.ts +0 -1
- package/dist/database/helpers/fn/types.js +0 -2
- package/dist/database/helpers/index.d.ts +3 -3
- package/dist/database/index.js +5 -5
- package/dist/database/migrations/20210805B-change-image-metadata-structure.js +15 -15
- package/dist/database/migrations/run.js +1 -1
- package/dist/database/run-ast.js +6 -6
- package/dist/database/system-data/collections/index.js +2 -2
- package/dist/database/system-data/fields/index.js +3 -3
- package/dist/env.js +1 -1
- package/dist/exceptions/database/dialects/mssql.js +2 -2
- package/dist/exceptions/database/dialects/mysql.js +6 -6
- package/dist/exceptions/database/record-not-unique.d.ts +1 -1
- package/dist/extensions.js +10 -10
- package/dist/flows.js +33 -31
- package/dist/logger.d.ts +1 -0
- package/dist/logger.js +32 -32
- package/dist/mailer.js +16 -16
- package/dist/messenger.js +4 -4
- package/dist/middleware/authenticate.d.ts +1 -1
- package/dist/middleware/authenticate.js +2 -2
- package/dist/middleware/cache.js +11 -11
- package/dist/middleware/collection-exists.js +4 -4
- package/dist/middleware/cors.js +8 -8
- package/dist/middleware/error-handler.js +2 -2
- package/dist/middleware/extract-token.js +3 -3
- package/dist/middleware/get-permissions.js +1 -1
- package/dist/middleware/graphql.js +12 -6
- package/dist/middleware/rate-limiter-global.js +5 -5
- package/dist/middleware/rate-limiter-ip.js +2 -2
- package/dist/middleware/respond.js +16 -16
- package/dist/middleware/sanitize-query.js +1 -1
- package/dist/middleware/schema.js +1 -1
- package/dist/middleware/use-collection.js +1 -1
- package/dist/middleware/validate-batch.js +1 -1
- package/dist/operations/exec/index.js +2 -2
- package/dist/rate-limiter.js +1 -1
- package/dist/request/validate-ip.js +2 -2
- package/dist/server.js +4 -4
- package/dist/services/activity.js +14 -14
- package/dist/services/assets.js +6 -6
- package/dist/services/authentication.js +9 -9
- package/dist/services/collections.js +9 -9
- package/dist/services/fields.js +5 -5
- package/dist/services/files.js +18 -18
- package/dist/services/graphql/index.js +170 -116
- package/dist/services/import-export.js +6 -6
- package/dist/services/items.js +6 -6
- package/dist/services/mail/index.js +5 -5
- package/dist/services/meta.js +1 -0
- package/dist/services/notifications.js +4 -4
- package/dist/services/relations.js +4 -4
- package/dist/services/revisions.js +3 -3
- package/dist/services/roles.js +5 -5
- package/dist/services/server.js +27 -27
- package/dist/services/shares.js +9 -9
- package/dist/services/specifications.js +5 -3
- package/dist/services/users.d.ts +1 -5
- package/dist/services/users.js +24 -27
- package/dist/storage/register-locations.js +1 -1
- package/dist/utils/apply-diff.js +12 -12
- package/dist/utils/apply-query.js +3 -2
- package/dist/utils/dynamic-import.js +1 -1
- package/dist/utils/generate-hash.js +1 -1
- package/dist/utils/get-ast-from-query.js +2 -2
- package/dist/utils/get-auth-providers.js +1 -1
- package/dist/utils/get-cache-headers.js +3 -3
- package/dist/utils/get-collection-from-alias.js +1 -0
- package/dist/utils/get-column-path.js +2 -1
- package/dist/utils/get-default-value.js +1 -1
- package/dist/utils/get-ip-from-req.js +2 -2
- package/dist/utils/get-permissions.js +11 -11
- package/dist/utils/get-schema.js +5 -5
- package/dist/utils/get-snapshot-diff.js +1 -1
- package/dist/utils/is-url-allowed.js +5 -2
- package/dist/utils/parse-image-metadata.js +3 -3
- package/dist/utils/reduce-schema.js +5 -5
- package/dist/utils/sanitize-query.js +26 -26
- package/dist/utils/should-skip-cache.js +13 -4
- package/dist/utils/strip-function.js +1 -1
- package/dist/utils/telemetry.d.ts +1 -0
- package/dist/utils/telemetry.js +30 -0
- package/dist/utils/validate-keys.js +1 -1
- package/dist/utils/validate-query.js +1 -1
- package/dist/utils/validate-storage.js +8 -8
- package/dist/webhooks.js +2 -2
- package/package.json +13 -13
- package/dist/utils/redact-header-cookies.d.ts +0 -1
- package/dist/utils/redact-header-cookies.js +0 -11
- package/dist/utils/track.d.ts +0 -1
- package/dist/utils/track.js +0 -81
- /package/dist/{utils/redact-header-cookies.test.d.ts → logger.test.d.ts} +0 -0
|
@@ -55,7 +55,7 @@ const void_1 = require("./types/void");
|
|
|
55
55
|
const add_path_to_validation_error_1 = require("./utils/add-path-to-validation-error");
|
|
56
56
|
const process_error_1 = __importDefault(require("./utils/process-error"));
|
|
57
57
|
const validationRules = Array.from(graphql_1.specifiedRules);
|
|
58
|
-
if (env_1.default
|
|
58
|
+
if (env_1.default['GRAPHQL_INTROSPECTION'] === false) {
|
|
59
59
|
validationRules.push(graphql_1.NoSchemaIntrospectionCustomRule);
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
@@ -103,12 +103,12 @@ class GraphQLService {
|
|
|
103
103
|
throw new exceptions_1.InvalidPayloadException('GraphQL execution error.', { graphqlErrors: [err.message] });
|
|
104
104
|
}
|
|
105
105
|
const formattedResult = {};
|
|
106
|
-
if (result
|
|
107
|
-
formattedResult.data = result
|
|
108
|
-
if (result
|
|
109
|
-
formattedResult.errors = result
|
|
110
|
-
if (result
|
|
111
|
-
formattedResult.extensions = result
|
|
106
|
+
if (result['data'])
|
|
107
|
+
formattedResult.data = result['data'];
|
|
108
|
+
if (result['errors'])
|
|
109
|
+
formattedResult.errors = result['errors'].map((error) => (0, process_error_1.default)(this.accountability, error));
|
|
110
|
+
if (result['extensions'])
|
|
111
|
+
formattedResult.extensions = result['extensions'];
|
|
112
112
|
return formattedResult;
|
|
113
113
|
}
|
|
114
114
|
getSchema(type = 'schema') {
|
|
@@ -209,8 +209,8 @@ class GraphQLService {
|
|
|
209
209
|
.filter((collection) => READ_ONLY.includes(collection.collection) === false)
|
|
210
210
|
.reduce((acc, collection) => {
|
|
211
211
|
const collectionName = this.scope === 'items' ? collection.collection : collection.collection.substring(9);
|
|
212
|
-
acc[`delete_${collectionName}_items`] = DeleteCollectionTypes
|
|
213
|
-
acc[`delete_${collectionName}_item`] = DeleteCollectionTypes
|
|
212
|
+
acc[`delete_${collectionName}_items`] = DeleteCollectionTypes['many'].getResolver(`delete_${collection.collection}_items`);
|
|
213
|
+
acc[`delete_${collectionName}_item`] = DeleteCollectionTypes['one'].getResolver(`delete_${collection.collection}_item`);
|
|
214
214
|
return acc;
|
|
215
215
|
}, {}));
|
|
216
216
|
}
|
|
@@ -378,7 +378,7 @@ class GraphQLService {
|
|
|
378
378
|
type: new graphql_1.GraphQLUnionType({
|
|
379
379
|
name: `${relation.collection}_${relation.field}_union`,
|
|
380
380
|
types: relation.meta.one_allowed_collections.map((collection) => CollectionTypes[collection].getType()),
|
|
381
|
-
resolveType(
|
|
381
|
+
resolveType(_value, context, info) {
|
|
382
382
|
let path = [];
|
|
383
383
|
let currentPath = info.path;
|
|
384
384
|
while (currentPath.prev) {
|
|
@@ -386,7 +386,7 @@ class GraphQLService {
|
|
|
386
386
|
currentPath = currentPath.prev;
|
|
387
387
|
}
|
|
388
388
|
path = path.reverse().slice(0, -1);
|
|
389
|
-
let parent = context
|
|
389
|
+
let parent = context['data'];
|
|
390
390
|
for (const pathPart of path) {
|
|
391
391
|
parent = parent[pathPart];
|
|
392
392
|
}
|
|
@@ -809,7 +809,7 @@ class GraphQLService {
|
|
|
809
809
|
: new graphql_1.GraphQLNonNull(new graphql_1.GraphQLList(new graphql_1.GraphQLNonNull(ReadCollectionTypes[collection.collection].getType()))),
|
|
810
810
|
resolve: async ({ info, context }) => {
|
|
811
811
|
const result = await self.resolveQuery(info);
|
|
812
|
-
context
|
|
812
|
+
context['data'] = result;
|
|
813
813
|
return result;
|
|
814
814
|
},
|
|
815
815
|
};
|
|
@@ -858,7 +858,7 @@ class GraphQLService {
|
|
|
858
858
|
},
|
|
859
859
|
resolve: async ({ info, context }) => {
|
|
860
860
|
const result = await self.resolveQuery(info);
|
|
861
|
-
context
|
|
861
|
+
context['data'] = result;
|
|
862
862
|
return result;
|
|
863
863
|
},
|
|
864
864
|
});
|
|
@@ -871,7 +871,7 @@ class GraphQLService {
|
|
|
871
871
|
},
|
|
872
872
|
resolve: async ({ info, context }) => {
|
|
873
873
|
const result = await self.resolveQuery(info);
|
|
874
|
-
context
|
|
874
|
+
context['data'] = result;
|
|
875
875
|
return result;
|
|
876
876
|
},
|
|
877
877
|
});
|
|
@@ -959,9 +959,7 @@ class GraphQLService {
|
|
|
959
959
|
resolve: async ({ args, info }) => await self.resolveMutation(args, info),
|
|
960
960
|
};
|
|
961
961
|
if (collectionIsReadable) {
|
|
962
|
-
resolverDefinition.args = ReadCollectionTypes[collection.collection]
|
|
963
|
-
.getResolver(collection.collection)
|
|
964
|
-
.getArgs();
|
|
962
|
+
resolverDefinition.args = ReadCollectionTypes[collection.collection].getResolver(collection.collection).getArgs();
|
|
965
963
|
}
|
|
966
964
|
CreateCollectionTypes[collection.collection].addResolver(resolverDefinition);
|
|
967
965
|
CreateCollectionTypes[collection.collection].addResolver({
|
|
@@ -970,17 +968,13 @@ class GraphQLService {
|
|
|
970
968
|
resolve: async ({ args, info }) => await self.resolveMutation(args, info),
|
|
971
969
|
});
|
|
972
970
|
CreateCollectionTypes[collection.collection].getResolver(`create_${collection.collection}_items`).addArgs({
|
|
973
|
-
...CreateCollectionTypes[collection.collection]
|
|
974
|
-
.getResolver(`create_${collection.collection}_items`)
|
|
975
|
-
.getArgs(),
|
|
971
|
+
...CreateCollectionTypes[collection.collection].getResolver(`create_${collection.collection}_items`).getArgs(),
|
|
976
972
|
data: [
|
|
977
973
|
(0, graphql_compose_1.toInputObjectType)(CreateCollectionTypes[collection.collection]).setTypeName(`create_${collection.collection}_input`).NonNull,
|
|
978
974
|
],
|
|
979
975
|
});
|
|
980
976
|
CreateCollectionTypes[collection.collection].getResolver(`create_${collection.collection}_item`).addArgs({
|
|
981
|
-
...CreateCollectionTypes[collection.collection]
|
|
982
|
-
.getResolver(`create_${collection.collection}_item`)
|
|
983
|
-
.getArgs(),
|
|
977
|
+
...CreateCollectionTypes[collection.collection].getResolver(`create_${collection.collection}_item`).getArgs(),
|
|
984
978
|
data: (0, graphql_compose_1.toInputObjectType)(CreateCollectionTypes[collection.collection]).setTypeName(`create_${collection.collection}_input`).NonNull,
|
|
985
979
|
});
|
|
986
980
|
}
|
|
@@ -1047,30 +1041,30 @@ class GraphQLService {
|
|
|
1047
1041
|
}
|
|
1048
1042
|
}
|
|
1049
1043
|
}
|
|
1050
|
-
DeleteCollectionTypes
|
|
1044
|
+
DeleteCollectionTypes['many'] = schemaComposer.createObjectTC({
|
|
1051
1045
|
name: `delete_many`,
|
|
1052
1046
|
fields: {
|
|
1053
1047
|
ids: new graphql_1.GraphQLNonNull(new graphql_1.GraphQLList(graphql_1.GraphQLID)),
|
|
1054
1048
|
},
|
|
1055
1049
|
});
|
|
1056
|
-
DeleteCollectionTypes
|
|
1050
|
+
DeleteCollectionTypes['one'] = schemaComposer.createObjectTC({
|
|
1057
1051
|
name: `delete_one`,
|
|
1058
1052
|
fields: {
|
|
1059
1053
|
id: new graphql_1.GraphQLNonNull(graphql_1.GraphQLID),
|
|
1060
1054
|
},
|
|
1061
1055
|
});
|
|
1062
1056
|
for (const collection of Object.values(schema.delete.collections)) {
|
|
1063
|
-
DeleteCollectionTypes
|
|
1057
|
+
DeleteCollectionTypes['many'].addResolver({
|
|
1064
1058
|
name: `delete_${collection.collection}_items`,
|
|
1065
|
-
type: DeleteCollectionTypes
|
|
1059
|
+
type: DeleteCollectionTypes['many'],
|
|
1066
1060
|
args: {
|
|
1067
1061
|
ids: new graphql_1.GraphQLNonNull(new graphql_1.GraphQLList(graphql_1.GraphQLID)),
|
|
1068
1062
|
},
|
|
1069
1063
|
resolve: async ({ args, info }) => await self.resolveMutation(args, info),
|
|
1070
1064
|
});
|
|
1071
|
-
DeleteCollectionTypes
|
|
1065
|
+
DeleteCollectionTypes['one'].addResolver({
|
|
1072
1066
|
name: `delete_${collection.collection}_item`,
|
|
1073
|
-
type: DeleteCollectionTypes
|
|
1067
|
+
type: DeleteCollectionTypes['one'],
|
|
1074
1068
|
args: {
|
|
1075
1069
|
id: new graphql_1.GraphQLNonNull(graphql_1.GraphQLID),
|
|
1076
1070
|
},
|
|
@@ -1104,13 +1098,13 @@ class GraphQLService {
|
|
|
1104
1098
|
collection = collection.slice(0, -6);
|
|
1105
1099
|
}
|
|
1106
1100
|
}
|
|
1107
|
-
if (args
|
|
1101
|
+
if (args['id']) {
|
|
1108
1102
|
query.filter = {
|
|
1109
1103
|
_and: [
|
|
1110
1104
|
query.filter || {},
|
|
1111
1105
|
{
|
|
1112
1106
|
[this.schema.collections[collection].primary]: {
|
|
1113
|
-
_eq: args
|
|
1107
|
+
_eq: args['id'],
|
|
1114
1108
|
},
|
|
1115
1109
|
},
|
|
1116
1110
|
],
|
|
@@ -1124,14 +1118,14 @@ class GraphQLService {
|
|
|
1124
1118
|
}
|
|
1125
1119
|
}
|
|
1126
1120
|
const result = await this.read(collection, query);
|
|
1127
|
-
if (args
|
|
1121
|
+
if (args['id']) {
|
|
1128
1122
|
return result?.[0] || null;
|
|
1129
1123
|
}
|
|
1130
1124
|
if (query.group) {
|
|
1131
1125
|
// for every entry in result add a group field based on query.group;
|
|
1132
1126
|
const aggregateKeys = Object.keys(query.aggregate ?? {});
|
|
1133
|
-
result
|
|
1134
|
-
field
|
|
1127
|
+
result['map']((field) => {
|
|
1128
|
+
field['group'] = (0, lodash_1.omit)(field, aggregateKeys);
|
|
1135
1129
|
});
|
|
1136
1130
|
}
|
|
1137
1131
|
return result;
|
|
@@ -1156,44 +1150,46 @@ class GraphQLService {
|
|
|
1156
1150
|
if (collection.endsWith('_item'))
|
|
1157
1151
|
collection = collection.slice(0, -5);
|
|
1158
1152
|
if (singleton && action === 'update') {
|
|
1159
|
-
return await this.upsertSingleton(collection, args
|
|
1153
|
+
return await this.upsertSingleton(collection, args['data'], query);
|
|
1160
1154
|
}
|
|
1161
1155
|
const service = this.getService(collection);
|
|
1162
1156
|
const hasQuery = (query.fields || []).length > 0;
|
|
1163
1157
|
try {
|
|
1164
1158
|
if (single) {
|
|
1165
1159
|
if (action === 'create') {
|
|
1166
|
-
const key = await service.createOne(args
|
|
1160
|
+
const key = await service.createOne(args['data']);
|
|
1167
1161
|
return hasQuery ? await service.readOne(key, query) : true;
|
|
1168
1162
|
}
|
|
1169
1163
|
if (action === 'update') {
|
|
1170
|
-
const key = await service.updateOne(args
|
|
1164
|
+
const key = await service.updateOne(args['id'], args['data']);
|
|
1171
1165
|
return hasQuery ? await service.readOne(key, query) : true;
|
|
1172
1166
|
}
|
|
1173
1167
|
if (action === 'delete') {
|
|
1174
|
-
await service.deleteOne(args
|
|
1175
|
-
return { id: args
|
|
1168
|
+
await service.deleteOne(args['id']);
|
|
1169
|
+
return { id: args['id'] };
|
|
1176
1170
|
}
|
|
1171
|
+
return undefined;
|
|
1177
1172
|
}
|
|
1178
1173
|
else {
|
|
1179
1174
|
if (action === 'create') {
|
|
1180
|
-
const keys = await service.createMany(args
|
|
1175
|
+
const keys = await service.createMany(args['data']);
|
|
1181
1176
|
return hasQuery ? await service.readMany(keys, query) : true;
|
|
1182
1177
|
}
|
|
1183
1178
|
if (action === 'update') {
|
|
1184
1179
|
const keys = [];
|
|
1185
1180
|
if (batchUpdate) {
|
|
1186
|
-
keys.push(...(await service.updateBatch(args
|
|
1181
|
+
keys.push(...(await service.updateBatch(args['data'])));
|
|
1187
1182
|
}
|
|
1188
1183
|
else {
|
|
1189
|
-
keys.push(...(await service.updateMany(args
|
|
1184
|
+
keys.push(...(await service.updateMany(args['ids'], args['data'])));
|
|
1190
1185
|
}
|
|
1191
1186
|
return hasQuery ? await service.readMany(keys, query) : true;
|
|
1192
1187
|
}
|
|
1193
1188
|
if (action === 'delete') {
|
|
1194
|
-
const keys = await service.deleteMany(args
|
|
1189
|
+
const keys = await service.deleteMany(args['ids']);
|
|
1195
1190
|
return { ids: keys };
|
|
1196
1191
|
}
|
|
1192
|
+
return undefined;
|
|
1197
1193
|
}
|
|
1198
1194
|
}
|
|
1199
1195
|
catch (err) {
|
|
@@ -1235,7 +1231,7 @@ class GraphQLService {
|
|
|
1235
1231
|
* of arguments
|
|
1236
1232
|
*/
|
|
1237
1233
|
parseArgs(args, variableValues) {
|
|
1238
|
-
if (!args || args
|
|
1234
|
+
if (!args || args['length'] === 0)
|
|
1239
1235
|
return {};
|
|
1240
1236
|
const parse = (node) => {
|
|
1241
1237
|
switch (node.kind) {
|
|
@@ -1259,7 +1255,7 @@ class GraphQLService {
|
|
|
1259
1255
|
return 'value' in node ? node.value : null;
|
|
1260
1256
|
}
|
|
1261
1257
|
};
|
|
1262
|
-
const argsObject = Object.fromEntries(args
|
|
1258
|
+
const argsObject = Object.fromEntries(args['map']((arg) => [arg.name.value, parse(arg.value)]));
|
|
1263
1259
|
return argsObject;
|
|
1264
1260
|
}
|
|
1265
1261
|
/**
|
|
@@ -1341,7 +1337,7 @@ class GraphQLService {
|
|
|
1341
1337
|
if (!query.deep)
|
|
1342
1338
|
query.deep = {};
|
|
1343
1339
|
const args = this.parseArgs(selection.arguments, variableValues);
|
|
1344
|
-
(0, lodash_1.set)(query.deep, currentAlias ?? current, (0, lodash_1.merge)({}, (0, lodash_1.get)(query.deep, currentAlias ?? current), (0, lodash_1.mapKeys)((0, sanitize_query_1.sanitizeQuery)(args, this.accountability), (
|
|
1340
|
+
(0, lodash_1.set)(query.deep, currentAlias ?? current, (0, lodash_1.merge)({}, (0, lodash_1.get)(query.deep, currentAlias ?? current), (0, lodash_1.mapKeys)((0, sanitize_query_1.sanitizeQuery)(args, this.accountability), (_value, key) => `_${key}`)));
|
|
1345
1341
|
}
|
|
1346
1342
|
}
|
|
1347
1343
|
}
|
|
@@ -1408,10 +1404,10 @@ class GraphQLService {
|
|
|
1408
1404
|
*/
|
|
1409
1405
|
formatError(error) {
|
|
1410
1406
|
if (Array.isArray(error)) {
|
|
1411
|
-
error[0].extensions
|
|
1407
|
+
error[0].extensions['code'] = error[0].code;
|
|
1412
1408
|
return new graphql_1.GraphQLError(error[0].message, undefined, undefined, undefined, undefined, error[0]);
|
|
1413
1409
|
}
|
|
1414
|
-
error.extensions
|
|
1410
|
+
error.extensions['code'] = error.code;
|
|
1415
1411
|
return new graphql_1.GraphQLError(error.message, undefined, undefined, undefined, undefined, error);
|
|
1416
1412
|
}
|
|
1417
1413
|
/**
|
|
@@ -1482,7 +1478,7 @@ class GraphQLService {
|
|
|
1482
1478
|
name: 'auth_tokens',
|
|
1483
1479
|
fields: {
|
|
1484
1480
|
access_token: graphql_1.GraphQLString,
|
|
1485
|
-
expires:
|
|
1481
|
+
expires: bigint_1.GraphQLBigInt,
|
|
1486
1482
|
refresh_token: graphql_1.GraphQLString,
|
|
1487
1483
|
},
|
|
1488
1484
|
});
|
|
@@ -1496,15 +1492,60 @@ class GraphQLService {
|
|
|
1496
1492
|
const ServerInfo = schemaComposer.createObjectTC({
|
|
1497
1493
|
name: 'server_info',
|
|
1498
1494
|
fields: {
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1495
|
+
project: {
|
|
1496
|
+
type: new graphql_1.GraphQLObjectType({
|
|
1497
|
+
name: 'server_info_project',
|
|
1498
|
+
fields: {
|
|
1499
|
+
project_name: { type: graphql_1.GraphQLString },
|
|
1500
|
+
project_descriptor: { type: graphql_1.GraphQLString },
|
|
1501
|
+
project_logo: { type: graphql_1.GraphQLString },
|
|
1502
|
+
project_color: { type: graphql_1.GraphQLString },
|
|
1503
|
+
default_language: { type: graphql_1.GraphQLString },
|
|
1504
|
+
public_foreground: { type: graphql_1.GraphQLString },
|
|
1505
|
+
public_background: { type: graphql_1.GraphQLString },
|
|
1506
|
+
public_note: { type: graphql_1.GraphQLString },
|
|
1507
|
+
custom_css: { type: graphql_1.GraphQLString },
|
|
1508
|
+
},
|
|
1509
|
+
}),
|
|
1510
|
+
},
|
|
1506
1511
|
},
|
|
1507
1512
|
});
|
|
1513
|
+
if (this.accountability?.user) {
|
|
1514
|
+
ServerInfo.addFields({
|
|
1515
|
+
rateLimit: env_1.default['RATE_LIMITER_ENABLED']
|
|
1516
|
+
? {
|
|
1517
|
+
type: new graphql_1.GraphQLObjectType({
|
|
1518
|
+
name: 'server_info_rate_limit',
|
|
1519
|
+
fields: {
|
|
1520
|
+
points: { type: graphql_1.GraphQLInt },
|
|
1521
|
+
duration: { type: graphql_1.GraphQLInt },
|
|
1522
|
+
},
|
|
1523
|
+
}),
|
|
1524
|
+
}
|
|
1525
|
+
: graphql_1.GraphQLBoolean,
|
|
1526
|
+
rateLimitGlobal: env_1.default['RATE_LIMITER_GLOBAL_ENABLED']
|
|
1527
|
+
? {
|
|
1528
|
+
type: new graphql_1.GraphQLObjectType({
|
|
1529
|
+
name: 'server_info_rate_limit_global',
|
|
1530
|
+
fields: {
|
|
1531
|
+
points: { type: graphql_1.GraphQLInt },
|
|
1532
|
+
duration: { type: graphql_1.GraphQLInt },
|
|
1533
|
+
},
|
|
1534
|
+
}),
|
|
1535
|
+
}
|
|
1536
|
+
: graphql_1.GraphQLBoolean,
|
|
1537
|
+
flows: {
|
|
1538
|
+
type: new graphql_1.GraphQLObjectType({
|
|
1539
|
+
name: 'server_info_flows',
|
|
1540
|
+
fields: {
|
|
1541
|
+
execAllowedModules: {
|
|
1542
|
+
type: new graphql_1.GraphQLList(graphql_1.GraphQLString),
|
|
1543
|
+
},
|
|
1544
|
+
},
|
|
1545
|
+
}),
|
|
1546
|
+
},
|
|
1547
|
+
});
|
|
1548
|
+
}
|
|
1508
1549
|
if (this.accountability?.admin === true) {
|
|
1509
1550
|
ServerInfo.addFields({
|
|
1510
1551
|
directus: {
|
|
@@ -1595,7 +1636,7 @@ class GraphQLService {
|
|
|
1595
1636
|
const service = new GraphQLService({
|
|
1596
1637
|
schema: this.schema,
|
|
1597
1638
|
accountability: this.accountability,
|
|
1598
|
-
scope: args
|
|
1639
|
+
scope: args['scope'] ?? 'items',
|
|
1599
1640
|
});
|
|
1600
1641
|
return service.getSchema('sdl');
|
|
1601
1642
|
},
|
|
@@ -1661,19 +1702,19 @@ class GraphQLService {
|
|
|
1661
1702
|
schema: this.schema,
|
|
1662
1703
|
});
|
|
1663
1704
|
const result = await authenticationService.login(constants_2.DEFAULT_AUTH_PROVIDER, args, args?.otp);
|
|
1664
|
-
if (args
|
|
1665
|
-
res?.cookie(env_1.default
|
|
1705
|
+
if (args['mode'] === 'cookie') {
|
|
1706
|
+
res?.cookie(env_1.default['REFRESH_TOKEN_COOKIE_NAME'], result['refreshToken'], {
|
|
1666
1707
|
httpOnly: true,
|
|
1667
|
-
domain: env_1.default
|
|
1668
|
-
maxAge: (0, get_milliseconds_1.getMilliseconds)(env_1.default
|
|
1669
|
-
secure: env_1.default
|
|
1670
|
-
sameSite: env_1.default
|
|
1708
|
+
domain: env_1.default['REFRESH_TOKEN_COOKIE_DOMAIN'],
|
|
1709
|
+
maxAge: (0, get_milliseconds_1.getMilliseconds)(env_1.default['REFRESH_TOKEN_TTL']),
|
|
1710
|
+
secure: env_1.default['REFRESH_TOKEN_COOKIE_SECURE'] ?? false,
|
|
1711
|
+
sameSite: env_1.default['REFRESH_TOKEN_COOKIE_SAME_SITE'] || 'strict',
|
|
1671
1712
|
});
|
|
1672
1713
|
}
|
|
1673
1714
|
return {
|
|
1674
|
-
access_token: result
|
|
1675
|
-
expires: result
|
|
1676
|
-
refresh_token: result
|
|
1715
|
+
access_token: result['accessToken'],
|
|
1716
|
+
expires: result['expires'],
|
|
1717
|
+
refresh_token: result['refreshToken'],
|
|
1677
1718
|
};
|
|
1678
1719
|
},
|
|
1679
1720
|
},
|
|
@@ -1697,24 +1738,24 @@ class GraphQLService {
|
|
|
1697
1738
|
accountability: accountability,
|
|
1698
1739
|
schema: this.schema,
|
|
1699
1740
|
});
|
|
1700
|
-
const currentRefreshToken = args
|
|
1741
|
+
const currentRefreshToken = args['refresh_token'] || req?.cookies[env_1.default['REFRESH_TOKEN_COOKIE_NAME']];
|
|
1701
1742
|
if (!currentRefreshToken) {
|
|
1702
1743
|
throw new exceptions_1.InvalidPayloadException(`"refresh_token" is required in either the JSON payload or Cookie`);
|
|
1703
1744
|
}
|
|
1704
1745
|
const result = await authenticationService.refresh(currentRefreshToken);
|
|
1705
|
-
if (args
|
|
1706
|
-
res?.cookie(env_1.default
|
|
1746
|
+
if (args['mode'] === 'cookie') {
|
|
1747
|
+
res?.cookie(env_1.default['REFRESH_TOKEN_COOKIE_NAME'], result['refreshToken'], {
|
|
1707
1748
|
httpOnly: true,
|
|
1708
|
-
domain: env_1.default
|
|
1709
|
-
maxAge: (0, get_milliseconds_1.getMilliseconds)(env_1.default
|
|
1710
|
-
secure: env_1.default
|
|
1711
|
-
sameSite: env_1.default
|
|
1749
|
+
domain: env_1.default['REFRESH_TOKEN_COOKIE_DOMAIN'],
|
|
1750
|
+
maxAge: (0, get_milliseconds_1.getMilliseconds)(env_1.default['REFRESH_TOKEN_TTL']),
|
|
1751
|
+
secure: env_1.default['REFRESH_TOKEN_COOKIE_SECURE'] ?? false,
|
|
1752
|
+
sameSite: env_1.default['REFRESH_TOKEN_COOKIE_SAME_SITE'] || 'strict',
|
|
1712
1753
|
});
|
|
1713
1754
|
}
|
|
1714
1755
|
return {
|
|
1715
|
-
access_token: result
|
|
1716
|
-
expires: result
|
|
1717
|
-
refresh_token: result
|
|
1756
|
+
access_token: result['accessToken'],
|
|
1757
|
+
expires: result['expires'],
|
|
1758
|
+
refresh_token: result['refreshToken'],
|
|
1718
1759
|
};
|
|
1719
1760
|
},
|
|
1720
1761
|
},
|
|
@@ -1737,7 +1778,7 @@ class GraphQLService {
|
|
|
1737
1778
|
accountability: accountability,
|
|
1738
1779
|
schema: this.schema,
|
|
1739
1780
|
});
|
|
1740
|
-
const currentRefreshToken = args
|
|
1781
|
+
const currentRefreshToken = args['refresh_token'] || req?.cookies[env_1.default['REFRESH_TOKEN_COOKIE_NAME']];
|
|
1741
1782
|
if (!currentRefreshToken) {
|
|
1742
1783
|
throw new exceptions_1.InvalidPayloadException(`"refresh_token" is required in either the JSON payload or Cookie`);
|
|
1743
1784
|
}
|
|
@@ -1763,7 +1804,7 @@ class GraphQLService {
|
|
|
1763
1804
|
accountability.origin = origin;
|
|
1764
1805
|
const service = new users_1.UsersService({ accountability, schema: this.schema });
|
|
1765
1806
|
try {
|
|
1766
|
-
await service.requestPasswordReset(args
|
|
1807
|
+
await service.requestPasswordReset(args['email'], args['reset_url'] || null);
|
|
1767
1808
|
}
|
|
1768
1809
|
catch (err) {
|
|
1769
1810
|
if (err instanceof exceptions_1.InvalidPayloadException) {
|
|
@@ -1790,7 +1831,7 @@ class GraphQLService {
|
|
|
1790
1831
|
if (origin)
|
|
1791
1832
|
accountability.origin = origin;
|
|
1792
1833
|
const service = new users_1.UsersService({ accountability, schema: this.schema });
|
|
1793
|
-
await service.resetPassword(args
|
|
1834
|
+
await service.resetPassword(args['token'], args['password']);
|
|
1794
1835
|
return true;
|
|
1795
1836
|
},
|
|
1796
1837
|
},
|
|
@@ -1816,7 +1857,7 @@ class GraphQLService {
|
|
|
1816
1857
|
accountability: this.accountability,
|
|
1817
1858
|
schema: this.schema,
|
|
1818
1859
|
});
|
|
1819
|
-
await authService.verifyPassword(this.accountability.user, args
|
|
1860
|
+
await authService.verifyPassword(this.accountability.user, args['password']);
|
|
1820
1861
|
const { url, secret } = await service.generateTFA(this.accountability.user);
|
|
1821
1862
|
return { secret, otpauth_url: url };
|
|
1822
1863
|
},
|
|
@@ -1834,7 +1875,7 @@ class GraphQLService {
|
|
|
1834
1875
|
accountability: this.accountability,
|
|
1835
1876
|
schema: this.schema,
|
|
1836
1877
|
});
|
|
1837
|
-
await service.enableTFA(this.accountability.user, args
|
|
1878
|
+
await service.enableTFA(this.accountability.user, args['otp'], args['secret']);
|
|
1838
1879
|
return true;
|
|
1839
1880
|
},
|
|
1840
1881
|
},
|
|
@@ -1850,7 +1891,7 @@ class GraphQLService {
|
|
|
1850
1891
|
accountability: this.accountability,
|
|
1851
1892
|
schema: this.schema,
|
|
1852
1893
|
});
|
|
1853
|
-
const otpValid = await service.verifyOTP(this.accountability.user, args
|
|
1894
|
+
const otpValid = await service.verifyOTP(this.accountability.user, args['otp']);
|
|
1854
1895
|
if (otpValid === false) {
|
|
1855
1896
|
throw new exceptions_1.InvalidPayloadException(`"otp" is invalid`);
|
|
1856
1897
|
}
|
|
@@ -1858,13 +1899,26 @@ class GraphQLService {
|
|
|
1858
1899
|
return true;
|
|
1859
1900
|
},
|
|
1860
1901
|
},
|
|
1902
|
+
utils_random_string: {
|
|
1903
|
+
type: graphql_1.GraphQLString,
|
|
1904
|
+
args: {
|
|
1905
|
+
length: graphql_1.GraphQLInt,
|
|
1906
|
+
},
|
|
1907
|
+
resolve: async (_, args) => {
|
|
1908
|
+
const { nanoid } = await import('nanoid');
|
|
1909
|
+
if (args['length'] && Number(args['length']) > 500) {
|
|
1910
|
+
throw new exceptions_1.InvalidPayloadException(`"length" can't be more than 500 characters`);
|
|
1911
|
+
}
|
|
1912
|
+
return nanoid(args['length'] ? Number(args['length']) : 32);
|
|
1913
|
+
},
|
|
1914
|
+
},
|
|
1861
1915
|
utils_hash_generate: {
|
|
1862
1916
|
type: graphql_1.GraphQLString,
|
|
1863
1917
|
args: {
|
|
1864
1918
|
string: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString),
|
|
1865
1919
|
},
|
|
1866
1920
|
resolve: async (_, args) => {
|
|
1867
|
-
return await (0, generate_hash_1.generateHash)(args
|
|
1921
|
+
return await (0, generate_hash_1.generateHash)(args['string']);
|
|
1868
1922
|
},
|
|
1869
1923
|
},
|
|
1870
1924
|
utils_hash_verify: {
|
|
@@ -1874,7 +1928,7 @@ class GraphQLService {
|
|
|
1874
1928
|
hash: new graphql_1.GraphQLNonNull(graphql_1.GraphQLString),
|
|
1875
1929
|
},
|
|
1876
1930
|
resolve: async (_, args) => {
|
|
1877
|
-
return await argon2_1.default.verify(args
|
|
1931
|
+
return await argon2_1.default.verify(args['hash'], args['string']);
|
|
1878
1932
|
},
|
|
1879
1933
|
},
|
|
1880
1934
|
utils_sort: {
|
|
@@ -1890,7 +1944,7 @@ class GraphQLService {
|
|
|
1890
1944
|
schema: this.schema,
|
|
1891
1945
|
});
|
|
1892
1946
|
const { item, to } = args;
|
|
1893
|
-
await service.sort(args
|
|
1947
|
+
await service.sort(args['collection'], { item, to });
|
|
1894
1948
|
return true;
|
|
1895
1949
|
},
|
|
1896
1950
|
},
|
|
@@ -1904,7 +1958,7 @@ class GraphQLService {
|
|
|
1904
1958
|
accountability: this.accountability,
|
|
1905
1959
|
schema: this.schema,
|
|
1906
1960
|
});
|
|
1907
|
-
await service.revert(args
|
|
1961
|
+
await service.revert(args['revision']);
|
|
1908
1962
|
return true;
|
|
1909
1963
|
},
|
|
1910
1964
|
},
|
|
@@ -1931,7 +1985,7 @@ class GraphQLService {
|
|
|
1931
1985
|
accountability: this.accountability,
|
|
1932
1986
|
schema: this.schema,
|
|
1933
1987
|
});
|
|
1934
|
-
await service.acceptInvite(args
|
|
1988
|
+
await service.acceptInvite(args['token'], args['password']);
|
|
1935
1989
|
return true;
|
|
1936
1990
|
},
|
|
1937
1991
|
},
|
|
@@ -1980,7 +2034,7 @@ class GraphQLService {
|
|
|
1980
2034
|
accountability: this.accountability,
|
|
1981
2035
|
schema: this.schema,
|
|
1982
2036
|
});
|
|
1983
|
-
return await collectionsService.readOne(args
|
|
2037
|
+
return await collectionsService.readOne(args['name']);
|
|
1984
2038
|
},
|
|
1985
2039
|
},
|
|
1986
2040
|
});
|
|
@@ -2043,7 +2097,7 @@ class GraphQLService {
|
|
|
2043
2097
|
accountability: this.accountability,
|
|
2044
2098
|
schema: this.schema,
|
|
2045
2099
|
});
|
|
2046
|
-
return await service.readAll(args
|
|
2100
|
+
return await service.readAll(args['collection']);
|
|
2047
2101
|
},
|
|
2048
2102
|
},
|
|
2049
2103
|
fields_by_name: {
|
|
@@ -2057,7 +2111,7 @@ class GraphQLService {
|
|
|
2057
2111
|
accountability: this.accountability,
|
|
2058
2112
|
schema: this.schema,
|
|
2059
2113
|
});
|
|
2060
|
-
return await service.readOne(args
|
|
2114
|
+
return await service.readOne(args['collection'], args['field']);
|
|
2061
2115
|
},
|
|
2062
2116
|
},
|
|
2063
2117
|
});
|
|
@@ -2111,7 +2165,7 @@ class GraphQLService {
|
|
|
2111
2165
|
accountability: this.accountability,
|
|
2112
2166
|
schema: this.schema,
|
|
2113
2167
|
});
|
|
2114
|
-
return await service.readAll(args
|
|
2168
|
+
return await service.readAll(args['collection']);
|
|
2115
2169
|
},
|
|
2116
2170
|
},
|
|
2117
2171
|
relations_by_name: {
|
|
@@ -2125,7 +2179,7 @@ class GraphQLService {
|
|
|
2125
2179
|
accountability: this.accountability,
|
|
2126
2180
|
schema: this.schema,
|
|
2127
2181
|
});
|
|
2128
|
-
return await service.readOne(args
|
|
2182
|
+
return await service.readOne(args['collection'], args['field']);
|
|
2129
2183
|
},
|
|
2130
2184
|
},
|
|
2131
2185
|
});
|
|
@@ -2148,7 +2202,7 @@ class GraphQLService {
|
|
|
2148
2202
|
accountability: this.accountability,
|
|
2149
2203
|
schema: this.schema,
|
|
2150
2204
|
});
|
|
2151
|
-
const collectionKey = await collectionsService.createOne(args
|
|
2205
|
+
const collectionKey = await collectionsService.createOne(args['data']);
|
|
2152
2206
|
return await collectionsService.readOne(collectionKey);
|
|
2153
2207
|
},
|
|
2154
2208
|
},
|
|
@@ -2165,7 +2219,7 @@ class GraphQLService {
|
|
|
2165
2219
|
accountability: this.accountability,
|
|
2166
2220
|
schema: this.schema,
|
|
2167
2221
|
});
|
|
2168
|
-
const collectionKey = await collectionsService.updateOne(args
|
|
2222
|
+
const collectionKey = await collectionsService.updateOne(args['collection'], args['data']);
|
|
2169
2223
|
return await collectionsService.readOne(collectionKey);
|
|
2170
2224
|
},
|
|
2171
2225
|
},
|
|
@@ -2184,8 +2238,8 @@ class GraphQLService {
|
|
|
2184
2238
|
accountability: this.accountability,
|
|
2185
2239
|
schema: this.schema,
|
|
2186
2240
|
});
|
|
2187
|
-
await collectionsService.deleteOne(args
|
|
2188
|
-
return { collection: args
|
|
2241
|
+
await collectionsService.deleteOne(args['collection']);
|
|
2242
|
+
return { collection: args['collection'] };
|
|
2189
2243
|
},
|
|
2190
2244
|
},
|
|
2191
2245
|
});
|
|
@@ -2201,8 +2255,8 @@ class GraphQLService {
|
|
|
2201
2255
|
accountability: this.accountability,
|
|
2202
2256
|
schema: this.schema,
|
|
2203
2257
|
});
|
|
2204
|
-
await service.createField(args
|
|
2205
|
-
return await service.readOne(args
|
|
2258
|
+
await service.createField(args['collection'], args['data']);
|
|
2259
|
+
return await service.readOne(args['collection'], args['data'].field);
|
|
2206
2260
|
},
|
|
2207
2261
|
},
|
|
2208
2262
|
update_fields_item: {
|
|
@@ -2217,11 +2271,11 @@ class GraphQLService {
|
|
|
2217
2271
|
accountability: this.accountability,
|
|
2218
2272
|
schema: this.schema,
|
|
2219
2273
|
});
|
|
2220
|
-
await service.updateField(args
|
|
2221
|
-
...args
|
|
2222
|
-
field: args
|
|
2274
|
+
await service.updateField(args['collection'], {
|
|
2275
|
+
...args['data'],
|
|
2276
|
+
field: args['field'],
|
|
2223
2277
|
});
|
|
2224
|
-
return await service.readOne(args
|
|
2278
|
+
return await service.readOne(args['collection'], args['data'].field);
|
|
2225
2279
|
},
|
|
2226
2280
|
},
|
|
2227
2281
|
delete_fields_item: {
|
|
@@ -2241,7 +2295,7 @@ class GraphQLService {
|
|
|
2241
2295
|
accountability: this.accountability,
|
|
2242
2296
|
schema: this.schema,
|
|
2243
2297
|
});
|
|
2244
|
-
await service.deleteField(args
|
|
2298
|
+
await service.deleteField(args['collection'], args['field']);
|
|
2245
2299
|
const { collection, field } = args;
|
|
2246
2300
|
return { collection, field };
|
|
2247
2301
|
},
|
|
@@ -2258,8 +2312,8 @@ class GraphQLService {
|
|
|
2258
2312
|
accountability: this.accountability,
|
|
2259
2313
|
schema: this.schema,
|
|
2260
2314
|
});
|
|
2261
|
-
await relationsService.createOne(args
|
|
2262
|
-
return await relationsService.readOne(args
|
|
2315
|
+
await relationsService.createOne(args['data']);
|
|
2316
|
+
return await relationsService.readOne(args['data'].collection, args['data'].field);
|
|
2263
2317
|
},
|
|
2264
2318
|
},
|
|
2265
2319
|
update_relations_item: {
|
|
@@ -2274,8 +2328,8 @@ class GraphQLService {
|
|
|
2274
2328
|
accountability: this.accountability,
|
|
2275
2329
|
schema: this.schema,
|
|
2276
2330
|
});
|
|
2277
|
-
await relationsService.updateOne(args
|
|
2278
|
-
return await relationsService.readOne(args
|
|
2331
|
+
await relationsService.updateOne(args['collection'], args['field'], args['data']);
|
|
2332
|
+
return await relationsService.readOne(args['data'].collection, args['data'].field);
|
|
2279
2333
|
},
|
|
2280
2334
|
},
|
|
2281
2335
|
delete_relations_item: {
|
|
@@ -2295,8 +2349,8 @@ class GraphQLService {
|
|
|
2295
2349
|
accountability: this.accountability,
|
|
2296
2350
|
schema: this.schema,
|
|
2297
2351
|
});
|
|
2298
|
-
await relationsService.deleteOne(args
|
|
2299
|
-
return { collection: args
|
|
2352
|
+
await relationsService.deleteOne(args['collection'], args['field']);
|
|
2353
|
+
return { collection: args['collection'], field: args['field'] };
|
|
2300
2354
|
},
|
|
2301
2355
|
},
|
|
2302
2356
|
});
|
|
@@ -2330,7 +2384,7 @@ class GraphQLService {
|
|
|
2330
2384
|
schema: this.schema,
|
|
2331
2385
|
accountability: this.accountability,
|
|
2332
2386
|
});
|
|
2333
|
-
await service.updateOne(this.accountability.user, args
|
|
2387
|
+
await service.updateOne(this.accountability.user, args['data']);
|
|
2334
2388
|
if ('directus_users' in ReadCollectionTypes) {
|
|
2335
2389
|
const selections = this.replaceFragmentsInSelections(info.fieldNodes[0]?.selectionSet?.selections, info.fragments);
|
|
2336
2390
|
const query = this.getQuery(args, selections || [], info.variableValues);
|
|
@@ -2386,7 +2440,7 @@ class GraphQLService {
|
|
|
2386
2440
|
accountability: this.accountability,
|
|
2387
2441
|
schema: this.schema,
|
|
2388
2442
|
});
|
|
2389
|
-
const primaryKey = await service.updateOne(args
|
|
2443
|
+
const primaryKey = await service.updateOne(args['id'], { comment: args['comment'] });
|
|
2390
2444
|
if ('directus_activity' in ReadCollectionTypes) {
|
|
2391
2445
|
const selections = this.replaceFragmentsInSelections(info.fieldNodes[0]?.selectionSet?.selections, info.fragments);
|
|
2392
2446
|
const query = this.getQuery(args, selections || [], info.variableValues);
|
|
@@ -2400,7 +2454,7 @@ class GraphQLService {
|
|
|
2400
2454
|
if ('directus_activity' in schema.delete.collections) {
|
|
2401
2455
|
schemaComposer.Mutation.addFields({
|
|
2402
2456
|
delete_comment: {
|
|
2403
|
-
type: DeleteCollectionTypes
|
|
2457
|
+
type: DeleteCollectionTypes['one'],
|
|
2404
2458
|
args: {
|
|
2405
2459
|
id: new graphql_1.GraphQLNonNull(graphql_1.GraphQLID),
|
|
2406
2460
|
},
|
|
@@ -2409,8 +2463,8 @@ class GraphQLService {
|
|
|
2409
2463
|
accountability: this.accountability,
|
|
2410
2464
|
schema: this.schema,
|
|
2411
2465
|
});
|
|
2412
|
-
await service.deleteOne(args
|
|
2413
|
-
return { id: args
|
|
2466
|
+
await service.deleteOne(args['id']);
|
|
2467
|
+
return { id: args['id'] };
|
|
2414
2468
|
},
|
|
2415
2469
|
},
|
|
2416
2470
|
});
|
|
@@ -2428,7 +2482,7 @@ class GraphQLService {
|
|
|
2428
2482
|
accountability: this.accountability,
|
|
2429
2483
|
schema: this.schema,
|
|
2430
2484
|
});
|
|
2431
|
-
const primaryKey = await service.importOne(args
|
|
2485
|
+
const primaryKey = await service.importOne(args['url'], args['data']);
|
|
2432
2486
|
if ('directus_files' in ReadCollectionTypes) {
|
|
2433
2487
|
const selections = this.replaceFragmentsInSelections(info.fieldNodes[0]?.selectionSet?.selections, info.fragments);
|
|
2434
2488
|
const query = this.getQuery(args, selections || [], info.variableValues);
|
|
@@ -2453,7 +2507,7 @@ class GraphQLService {
|
|
|
2453
2507
|
accountability: this.accountability,
|
|
2454
2508
|
schema: this.schema,
|
|
2455
2509
|
});
|
|
2456
|
-
await service.inviteUser(args
|
|
2510
|
+
await service.inviteUser(args['email'], args['role'], args['invite_url'] || null);
|
|
2457
2511
|
return true;
|
|
2458
2512
|
},
|
|
2459
2513
|
},
|