directus 9.11.1 → 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/cli/utils/create-env/env-stub.liquid +266 -9
- package/dist/controllers/activity.js +1 -1
- 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/index.js +10 -19
- 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/seeds/05-activity.yaml +0 -1
- package/dist/database/system-data/collections/collections.yaml +4 -0
- package/dist/database/system-data/fields/flows.yaml +21 -0
- package/dist/database/system-data/fields/operations.yaml +19 -0
- 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 +6 -30
- 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/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/authentication.d.ts +2 -2
- package/dist/services/authentication.js +7 -7
- package/dist/services/authorization.js +12 -0
- package/dist/services/flows.d.ts +14 -0
- package/dist/services/flows.js +42 -0
- package/dist/services/graphql.js +7 -1
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.js +2 -0
- package/dist/services/items.js +1 -1
- 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/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/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/operation-options.d.ts +3 -0
- package/dist/utils/operation-options.js +45 -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
|
@@ -65,13 +65,14 @@ class MailService {
|
|
|
65
65
|
}
|
|
66
66
|
async getDefaultTemplateData() {
|
|
67
67
|
const projectInfo = await this.knex
|
|
68
|
-
.select(['project_name', 'project_logo', 'project_color'])
|
|
68
|
+
.select(['project_name', 'project_logo', 'project_color', 'project_url'])
|
|
69
69
|
.from('directus_settings')
|
|
70
70
|
.first();
|
|
71
71
|
return {
|
|
72
72
|
projectName: (projectInfo === null || projectInfo === void 0 ? void 0 : projectInfo.project_name) || 'Directus',
|
|
73
73
|
projectColor: (projectInfo === null || projectInfo === void 0 ? void 0 : projectInfo.project_color) || '#546e7a',
|
|
74
74
|
projectLogo: getProjectLogoURL(projectInfo === null || projectInfo === void 0 ? void 0 : projectInfo.project_logo),
|
|
75
|
+
projectUrl: (projectInfo === null || projectInfo === void 0 ? void 0 : projectInfo.project_url) || '',
|
|
75
76
|
};
|
|
76
77
|
function getProjectLogoURL(logoID) {
|
|
77
78
|
const projectLogoUrl = new url_1.Url(env_1.default.PUBLIC_URL);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { UsersService, MailService } from '.';
|
|
2
1
|
import { AbstractServiceOptions, PrimaryKey, MutationOptions } from '../types';
|
|
3
2
|
import { ItemsService } from './items';
|
|
4
3
|
import { Notification } from '@directus/shared/types';
|
|
4
|
+
import { UsersService } from './users';
|
|
5
|
+
import { MailService } from './mail';
|
|
5
6
|
export declare class NotificationsService extends ItemsService {
|
|
6
7
|
usersService: UsersService;
|
|
7
8
|
mailService: MailService;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NotificationsService = void 0;
|
|
4
|
-
const _1 = require(".");
|
|
5
4
|
const items_1 = require("./items");
|
|
6
5
|
const md_1 = require("../utils/md");
|
|
6
|
+
const users_1 = require("./users");
|
|
7
|
+
const mail_1 = require("./mail");
|
|
7
8
|
class NotificationsService extends items_1.ItemsService {
|
|
8
9
|
constructor(options) {
|
|
9
10
|
super('directus_notifications', options);
|
|
10
|
-
this.usersService = new
|
|
11
|
-
this.mailService = new
|
|
11
|
+
this.usersService = new users_1.UsersService({ schema: this.schema });
|
|
12
|
+
this.mailService = new mail_1.MailService({ schema: this.schema, accountability: this.accountability });
|
|
12
13
|
}
|
|
13
14
|
async createOne(data, opts) {
|
|
14
15
|
await this.sendEmail(data);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { OperationRaw } from '@directus/shared/types';
|
|
2
|
+
import { Messenger } from '../messenger';
|
|
3
|
+
import { AbstractServiceOptions, Item, MutationOptions, PrimaryKey } from '../types';
|
|
4
|
+
import { ItemsService } from './items';
|
|
5
|
+
export declare class OperationsService extends ItemsService<OperationRaw> {
|
|
6
|
+
messenger: Messenger;
|
|
7
|
+
constructor(options: AbstractServiceOptions);
|
|
8
|
+
createOne(data: Partial<Item>, opts?: MutationOptions): Promise<PrimaryKey>;
|
|
9
|
+
createMany(data: Partial<Item>[], opts?: MutationOptions): Promise<PrimaryKey[]>;
|
|
10
|
+
updateOne(key: PrimaryKey, data: Partial<Item>, opts?: MutationOptions): Promise<PrimaryKey>;
|
|
11
|
+
updateMany(keys: PrimaryKey[], data: Partial<Item>, opts?: MutationOptions): Promise<PrimaryKey[]>;
|
|
12
|
+
deleteOne(key: PrimaryKey, opts?: MutationOptions): Promise<PrimaryKey>;
|
|
13
|
+
deleteMany(keys: PrimaryKey[], opts?: MutationOptions): Promise<PrimaryKey[]>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OperationsService = void 0;
|
|
4
|
+
const messenger_1 = require("../messenger");
|
|
5
|
+
const items_1 = require("./items");
|
|
6
|
+
class OperationsService extends items_1.ItemsService {
|
|
7
|
+
constructor(options) {
|
|
8
|
+
super('directus_operations', options);
|
|
9
|
+
this.messenger = (0, messenger_1.getMessenger)();
|
|
10
|
+
}
|
|
11
|
+
async createOne(data, opts) {
|
|
12
|
+
const result = await super.createOne(data, opts);
|
|
13
|
+
this.messenger.publish('flows', { type: 'reload' });
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
async createMany(data, opts) {
|
|
17
|
+
const result = await super.createMany(data, opts);
|
|
18
|
+
this.messenger.publish('flows', { type: 'reload' });
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
async updateOne(key, data, opts) {
|
|
22
|
+
const result = await super.updateOne(key, data, opts);
|
|
23
|
+
this.messenger.publish('flows', { type: 'reload' });
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
async updateMany(keys, data, opts) {
|
|
27
|
+
const result = await super.updateMany(keys, data, opts);
|
|
28
|
+
this.messenger.publish('flows', { type: 'reload' });
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
async deleteOne(key, opts) {
|
|
32
|
+
const result = await super.deleteOne(key, opts);
|
|
33
|
+
this.messenger.publish('flows', { type: 'reload' });
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
async deleteMany(keys, opts) {
|
|
37
|
+
const result = await super.deleteMany(keys, opts);
|
|
38
|
+
this.messenger.publish('flows', { type: 'reload' });
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.OperationsService = OperationsService;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { AbstractServiceOptions, Item, PrimaryKey, Webhook, MutationOptions } from '../types';
|
|
2
2
|
import { ItemsService } from './items';
|
|
3
|
+
import { Messenger } from '../messenger';
|
|
3
4
|
export declare class WebhooksService extends ItemsService<Webhook> {
|
|
5
|
+
messenger: Messenger;
|
|
4
6
|
constructor(options: AbstractServiceOptions);
|
|
5
7
|
createOne(data: Partial<Item>, opts?: MutationOptions): Promise<PrimaryKey>;
|
|
6
8
|
createMany(data: Partial<Item>[], opts?: MutationOptions): Promise<PrimaryKey[]>;
|
|
@@ -1,40 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WebhooksService = void 0;
|
|
4
|
-
const webhooks_1 = require("../webhooks");
|
|
5
4
|
const items_1 = require("./items");
|
|
5
|
+
const messenger_1 = require("../messenger");
|
|
6
6
|
class WebhooksService extends items_1.ItemsService {
|
|
7
7
|
constructor(options) {
|
|
8
8
|
super('directus_webhooks', options);
|
|
9
|
+
this.messenger = (0, messenger_1.getMessenger)();
|
|
9
10
|
}
|
|
10
11
|
async createOne(data, opts) {
|
|
11
12
|
const result = await super.createOne(data, opts);
|
|
12
|
-
|
|
13
|
+
this.messenger.publish('webhooks', { type: 'reload' });
|
|
13
14
|
return result;
|
|
14
15
|
}
|
|
15
16
|
async createMany(data, opts) {
|
|
16
17
|
const result = await super.createMany(data, opts);
|
|
17
|
-
|
|
18
|
+
this.messenger.publish('webhooks', { type: 'reload' });
|
|
18
19
|
return result;
|
|
19
20
|
}
|
|
20
21
|
async updateOne(key, data, opts) {
|
|
21
22
|
const result = await super.updateOne(key, data, opts);
|
|
22
|
-
|
|
23
|
+
this.messenger.publish('webhooks', { type: 'reload' });
|
|
23
24
|
return result;
|
|
24
25
|
}
|
|
25
26
|
async updateMany(keys, data, opts) {
|
|
26
27
|
const result = await super.updateMany(keys, data, opts);
|
|
27
|
-
|
|
28
|
+
this.messenger.publish('webhooks', { type: 'reload' });
|
|
28
29
|
return result;
|
|
29
30
|
}
|
|
30
31
|
async deleteOne(key, opts) {
|
|
31
32
|
const result = await super.deleteOne(key, opts);
|
|
32
|
-
|
|
33
|
+
this.messenger.publish('webhooks', { type: 'reload' });
|
|
33
34
|
return result;
|
|
34
35
|
}
|
|
35
36
|
async deleteMany(keys, opts) {
|
|
36
37
|
const result = await super.deleteMany(keys, opts);
|
|
37
|
-
|
|
38
|
+
this.messenger.publish('webhooks', { type: 'reload' });
|
|
38
39
|
return result;
|
|
39
40
|
}
|
|
40
41
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ActionHandler, FilterHandler, InitHandler } from '@directus/shared/types';
|
|
2
|
+
import { ScheduledTask } from 'node-cron';
|
|
3
|
+
export declare type EventHandler = {
|
|
4
|
+
type: 'filter';
|
|
5
|
+
name: string;
|
|
6
|
+
handler: FilterHandler;
|
|
7
|
+
} | {
|
|
8
|
+
type: 'action';
|
|
9
|
+
name: string;
|
|
10
|
+
handler: ActionHandler;
|
|
11
|
+
} | {
|
|
12
|
+
type: 'init';
|
|
13
|
+
name: string;
|
|
14
|
+
handler: InitHandler;
|
|
15
|
+
} | {
|
|
16
|
+
type: 'schedule';
|
|
17
|
+
task: ScheduledTask;
|
|
18
|
+
};
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
|
@@ -10,11 +10,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
10
10
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./activity"), exports);
|
|
14
13
|
__exportStar(require("./assets"), exports);
|
|
15
14
|
__exportStar(require("./ast"), exports);
|
|
16
15
|
__exportStar(require("./auth"), exports);
|
|
17
16
|
__exportStar(require("./collection"), exports);
|
|
17
|
+
__exportStar(require("./events"), exports);
|
|
18
18
|
__exportStar(require("./files"), exports);
|
|
19
19
|
__exportStar(require("./graphql"), exports);
|
|
20
20
|
__exportStar(require("./items"), exports);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.constructFlowTree = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
function constructFlowTree(flow) {
|
|
6
|
+
var _a;
|
|
7
|
+
const rootOperation = (_a = flow.operations.find((operation) => operation.id === flow.operation)) !== null && _a !== void 0 ? _a : null;
|
|
8
|
+
const operationTree = constructOperationTree(rootOperation, flow.operations);
|
|
9
|
+
const flowTree = {
|
|
10
|
+
...(0, lodash_1.omit)(flow, 'operations'),
|
|
11
|
+
operation: operationTree,
|
|
12
|
+
};
|
|
13
|
+
return flowTree;
|
|
14
|
+
}
|
|
15
|
+
exports.constructFlowTree = constructFlowTree;
|
|
16
|
+
function constructOperationTree(root, operations) {
|
|
17
|
+
if (root === null) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const resolveOperation = root.resolve !== null ? operations.find((operation) => operation.id === root.resolve) : null;
|
|
21
|
+
const rejectOperation = root.reject !== null ? operations.find((operation) => operation.id === root.reject) : null;
|
|
22
|
+
if (resolveOperation === undefined || rejectOperation === undefined) {
|
|
23
|
+
throw new Error('Undefined reference in operations');
|
|
24
|
+
}
|
|
25
|
+
const operationTree = {
|
|
26
|
+
...(0, lodash_1.omit)(root, 'flow'),
|
|
27
|
+
resolve: constructOperationTree(resolveOperation, operations),
|
|
28
|
+
reject: constructOperationTree(rejectOperation, operations),
|
|
29
|
+
};
|
|
30
|
+
return operationTree;
|
|
31
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Accountability, SchemaOverview } from '@directus/shared/types';
|
|
2
|
+
import { Knex } from 'knex';
|
|
3
|
+
export declare function getAccountabilityForRole(role: null | string, context: {
|
|
4
|
+
accountability: null | Accountability;
|
|
5
|
+
schema: SchemaOverview;
|
|
6
|
+
database: Knex;
|
|
7
|
+
}): Promise<Accountability>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAccountabilityForRole = void 0;
|
|
4
|
+
const get_permissions_1 = require("./get-permissions");
|
|
5
|
+
const exceptions_1 = require("../exceptions");
|
|
6
|
+
async function getAccountabilityForRole(role, context) {
|
|
7
|
+
let generatedAccountability = context.accountability;
|
|
8
|
+
if (role === null) {
|
|
9
|
+
generatedAccountability = {
|
|
10
|
+
role: null,
|
|
11
|
+
user: null,
|
|
12
|
+
admin: false,
|
|
13
|
+
app: false,
|
|
14
|
+
};
|
|
15
|
+
generatedAccountability.permissions = await (0, get_permissions_1.getPermissions)(generatedAccountability, context.schema);
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
const roleInfo = await context.database
|
|
19
|
+
.select(['app_access', 'admin_access'])
|
|
20
|
+
.from('directus_roles')
|
|
21
|
+
.where({ id: role })
|
|
22
|
+
.first();
|
|
23
|
+
if (!roleInfo) {
|
|
24
|
+
throw new exceptions_1.InvalidConfigException(`Configured role "${role}" isn't a valid role ID or doesn't exist.`);
|
|
25
|
+
}
|
|
26
|
+
generatedAccountability = {
|
|
27
|
+
role,
|
|
28
|
+
user: null,
|
|
29
|
+
admin: roleInfo.admin_access === 1 || roleInfo.admin_access === '1' || roleInfo.admin_access === true,
|
|
30
|
+
app: roleInfo.app_access === 1 || roleInfo.app_access === '1' || roleInfo.app_access === true,
|
|
31
|
+
};
|
|
32
|
+
generatedAccountability.permissions = await (0, get_permissions_1.getPermissions)(generatedAccountability, context.schema);
|
|
33
|
+
}
|
|
34
|
+
return generatedAccountability;
|
|
35
|
+
}
|
|
36
|
+
exports.getAccountabilityForRole = getAccountabilityForRole;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.optionToString = exports.optionToObject = exports.applyOperationOptions = void 0;
|
|
4
|
+
const micromustache_1 = require("micromustache");
|
|
5
|
+
const parse_json_1 = require("./parse-json");
|
|
6
|
+
function resolveFn(path, scope) {
|
|
7
|
+
if (!scope)
|
|
8
|
+
return undefined;
|
|
9
|
+
const value = (0, micromustache_1.get)(scope, path);
|
|
10
|
+
return typeof value === 'object' ? JSON.stringify(value) : value;
|
|
11
|
+
}
|
|
12
|
+
function renderMustache(item, scope) {
|
|
13
|
+
if (typeof item === 'string') {
|
|
14
|
+
return (0, micromustache_1.renderFn)(item, resolveFn, scope, { explicit: true });
|
|
15
|
+
}
|
|
16
|
+
else if (Array.isArray(item)) {
|
|
17
|
+
return item.map((element) => renderMustache(element, scope));
|
|
18
|
+
}
|
|
19
|
+
else if (typeof item === 'object' && item !== null) {
|
|
20
|
+
return Object.fromEntries(Object.entries(item).map(([key, value]) => [key, renderMustache(value, scope)]));
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
return item;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function applyOperationOptions(options, data) {
|
|
27
|
+
return Object.fromEntries(Object.entries(options).map(([key, value]) => {
|
|
28
|
+
if (typeof value === 'string') {
|
|
29
|
+
const single = value.match(/^\{\{\s*([^}\s]+)\s*\}\}$/);
|
|
30
|
+
if (single !== null) {
|
|
31
|
+
return [key, (0, micromustache_1.get)(data, single[1])];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return [key, renderMustache(value, data)];
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
exports.applyOperationOptions = applyOperationOptions;
|
|
38
|
+
function optionToObject(option) {
|
|
39
|
+
return typeof option === 'string' ? (0, parse_json_1.parseJSON)(option) : option;
|
|
40
|
+
}
|
|
41
|
+
exports.optionToObject = optionToObject;
|
|
42
|
+
function optionToString(option) {
|
|
43
|
+
return typeof option === 'object' ? JSON.stringify(option) : String(option);
|
|
44
|
+
}
|
|
45
|
+
exports.optionToString = optionToString;
|
|
@@ -104,7 +104,7 @@ function validateFilterPrimitive(value, key) {
|
|
|
104
104
|
false) {
|
|
105
105
|
throw new exceptions_1.InvalidQueryException(`The filter value for "${key}" has to be a string, number, or boolean`);
|
|
106
106
|
}
|
|
107
|
-
if (typeof value === 'number' && Number.isNaN(value)
|
|
107
|
+
if (typeof value === 'number' && (Number.isNaN(value) || value > Number.MAX_SAFE_INTEGER)) {
|
|
108
108
|
throw new exceptions_1.InvalidQueryException(`The filter value for "${key}" is not a valid number`);
|
|
109
109
|
}
|
|
110
110
|
if (typeof value === 'string' && value.length === 0) {
|
package/dist/webhooks.d.ts
CHANGED
package/dist/webhooks.js
CHANGED
|
@@ -3,16 +3,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.unregister = exports.register = void 0;
|
|
6
|
+
exports.unregister = exports.register = exports.reload = exports.init = void 0;
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
8
|
const database_1 = __importDefault(require("./database"));
|
|
9
9
|
const emitter_1 = __importDefault(require("./emitter"));
|
|
10
10
|
const logger_1 = __importDefault(require("./logger"));
|
|
11
11
|
const services_1 = require("./services");
|
|
12
12
|
const get_schema_1 = require("./utils/get-schema");
|
|
13
|
+
const messenger_1 = require("./messenger");
|
|
13
14
|
let registered = [];
|
|
14
|
-
async function
|
|
15
|
+
async function init() {
|
|
16
|
+
await register();
|
|
17
|
+
const messenger = (0, messenger_1.getMessenger)();
|
|
18
|
+
messenger.subscribe('webhooks', (event) => {
|
|
19
|
+
if (event.type === 'reload') {
|
|
20
|
+
reload();
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
exports.init = init;
|
|
25
|
+
async function reload() {
|
|
15
26
|
unregister();
|
|
27
|
+
await register();
|
|
28
|
+
}
|
|
29
|
+
exports.reload = reload;
|
|
30
|
+
async function register() {
|
|
16
31
|
const webhookService = new services_1.WebhooksService({ knex: (0, database_1.default)(), schema: await (0, get_schema_1.getSchema)() });
|
|
17
32
|
const webhooks = await webhookService.readByQuery({ filter: { status: { _eq: 'active' } } });
|
|
18
33
|
for (const webhook of webhooks) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "directus",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.12.0",
|
|
4
4
|
"license": "GPL-3.0-only",
|
|
5
5
|
"homepage": "https://github.com/directus/directus#readme",
|
|
6
6
|
"description": "Directus is a real-time API and App dashboard for managing SQL database content.",
|
|
@@ -73,21 +73,20 @@
|
|
|
73
73
|
"files": [
|
|
74
74
|
"dist",
|
|
75
75
|
"LICENSE",
|
|
76
|
-
"README.md"
|
|
77
|
-
"example.env"
|
|
76
|
+
"README.md"
|
|
78
77
|
],
|
|
79
78
|
"dependencies": {
|
|
80
79
|
"@aws-sdk/client-ses": "^3.40.0",
|
|
81
|
-
"@directus/app": "9.
|
|
82
|
-
"@directus/drive": "9.
|
|
83
|
-
"@directus/drive-azure": "9.
|
|
84
|
-
"@directus/drive-gcs": "9.
|
|
85
|
-
"@directus/drive-s3": "9.
|
|
86
|
-
"@directus/extensions-sdk": "9.
|
|
87
|
-
"@directus/format-title": "9.
|
|
88
|
-
"@directus/schema": "9.
|
|
89
|
-
"@directus/shared": "9.
|
|
90
|
-
"@directus/specs": "9.
|
|
80
|
+
"@directus/app": "9.12.0",
|
|
81
|
+
"@directus/drive": "9.12.0",
|
|
82
|
+
"@directus/drive-azure": "9.12.0",
|
|
83
|
+
"@directus/drive-gcs": "9.12.0",
|
|
84
|
+
"@directus/drive-s3": "9.12.0",
|
|
85
|
+
"@directus/extensions-sdk": "9.12.0",
|
|
86
|
+
"@directus/format-title": "9.12.0",
|
|
87
|
+
"@directus/schema": "9.12.0",
|
|
88
|
+
"@directus/shared": "9.12.0",
|
|
89
|
+
"@directus/specs": "9.12.0",
|
|
91
90
|
"@godaddy/terminus": "^4.9.0",
|
|
92
91
|
"@rollup/plugin-alias": "^3.1.9",
|
|
93
92
|
"@rollup/plugin-virtual": "^2.0.3",
|
|
@@ -112,8 +111,10 @@
|
|
|
112
111
|
"execa": "^5.1.1",
|
|
113
112
|
"exifr": "^7.1.2",
|
|
114
113
|
"express": "^4.17.1",
|
|
114
|
+
"fast-redact": "^3.1.1",
|
|
115
115
|
"flat": "^5.0.2",
|
|
116
116
|
"fs-extra": "^10.0.0",
|
|
117
|
+
"globby": "^11.0.4",
|
|
117
118
|
"graphql": "^15.5.0",
|
|
118
119
|
"graphql-compose": "^9.0.1",
|
|
119
120
|
"helmet": "^4.6.0",
|
|
@@ -131,6 +132,7 @@
|
|
|
131
132
|
"lodash": "^4.17.21",
|
|
132
133
|
"macos-release": "^2.4.1",
|
|
133
134
|
"marked": "^4.0.3",
|
|
135
|
+
"micromustache": "^8.0.3",
|
|
134
136
|
"mime-types": "^2.1.31",
|
|
135
137
|
"ms": "^2.1.3",
|
|
136
138
|
"nanoid": "^3.1.23",
|
|
@@ -171,7 +173,7 @@
|
|
|
171
173
|
"sqlite3": "^5.0.6",
|
|
172
174
|
"tedious": "^13.0.0"
|
|
173
175
|
},
|
|
174
|
-
"gitHead": "
|
|
176
|
+
"gitHead": "4d63fba50a7cf199e89423365a515e99cecf4ebf",
|
|
175
177
|
"devDependencies": {
|
|
176
178
|
"@types/async": "3.2.10",
|
|
177
179
|
"@types/body-parser": "1.19.2",
|
|
@@ -183,9 +185,11 @@
|
|
|
183
185
|
"@types/express": "4.17.13",
|
|
184
186
|
"@types/express-pino-logger": "4.0.3",
|
|
185
187
|
"@types/express-session": "1.17.4",
|
|
188
|
+
"@types/fast-redact": "^3.0.1",
|
|
186
189
|
"@types/flat": "5.0.2",
|
|
187
190
|
"@types/fs-extra": "9.0.13",
|
|
188
191
|
"@types/inquirer": "8.1.3",
|
|
192
|
+
"@types/ioredis": "^4.28.10",
|
|
189
193
|
"@types/jest": "27.4.1",
|
|
190
194
|
"@types/js-yaml": "4.0.5",
|
|
191
195
|
"@types/json2csv": "5.0.3",
|
package/dist/types/activity.d.ts
DELETED
package/dist/types/activity.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Action = void 0;
|
|
4
|
-
var Action;
|
|
5
|
-
(function (Action) {
|
|
6
|
-
Action["CREATE"] = "create";
|
|
7
|
-
Action["UPDATE"] = "update";
|
|
8
|
-
Action["DELETE"] = "delete";
|
|
9
|
-
Action["REVERT"] = "revert";
|
|
10
|
-
Action["COMMENT"] = "comment";
|
|
11
|
-
Action["UPLOAD"] = "upload";
|
|
12
|
-
Action["LOGIN"] = "login";
|
|
13
|
-
})(Action = exports.Action || (exports.Action = {}));
|