@nocobase/plugin-notifications 1.2.13-alpha → 1.3.0-alpha.20240710084543

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/package.json +2 -2
  2. package/dist/client/index.d.ts +0 -13
  3. package/dist/client/index.js +0 -10
  4. package/dist/externalVersion.js +0 -15
  5. package/dist/index.d.ts +0 -10
  6. package/dist/index.js +0 -48
  7. package/dist/node_modules/nodemailer/.gitattributes +0 -6
  8. package/dist/node_modules/nodemailer/.ncurc.js +0 -7
  9. package/dist/node_modules/nodemailer/.prettierrc.js +0 -8
  10. package/dist/node_modules/nodemailer/LICENSE +0 -16
  11. package/dist/node_modules/nodemailer/SECURITY.txt +0 -22
  12. package/dist/node_modules/nodemailer/lib/addressparser/index.js +0 -313
  13. package/dist/node_modules/nodemailer/lib/base64/index.js +0 -142
  14. package/dist/node_modules/nodemailer/lib/dkim/index.js +0 -251
  15. package/dist/node_modules/nodemailer/lib/dkim/message-parser.js +0 -155
  16. package/dist/node_modules/nodemailer/lib/dkim/relaxed-body.js +0 -154
  17. package/dist/node_modules/nodemailer/lib/dkim/sign.js +0 -117
  18. package/dist/node_modules/nodemailer/lib/fetch/cookies.js +0 -281
  19. package/dist/node_modules/nodemailer/lib/fetch/index.js +0 -274
  20. package/dist/node_modules/nodemailer/lib/json-transport/index.js +0 -82
  21. package/dist/node_modules/nodemailer/lib/mail-composer/index.js +0 -565
  22. package/dist/node_modules/nodemailer/lib/mailer/index.js +0 -427
  23. package/dist/node_modules/nodemailer/lib/mailer/mail-message.js +0 -315
  24. package/dist/node_modules/nodemailer/lib/mime-funcs/index.js +0 -625
  25. package/dist/node_modules/nodemailer/lib/mime-funcs/mime-types.js +0 -2102
  26. package/dist/node_modules/nodemailer/lib/mime-node/index.js +0 -1305
  27. package/dist/node_modules/nodemailer/lib/mime-node/last-newline.js +0 -33
  28. package/dist/node_modules/nodemailer/lib/mime-node/le-unix.js +0 -43
  29. package/dist/node_modules/nodemailer/lib/mime-node/le-windows.js +0 -52
  30. package/dist/node_modules/nodemailer/lib/nodemailer.js +0 -1
  31. package/dist/node_modules/nodemailer/lib/qp/index.js +0 -219
  32. package/dist/node_modules/nodemailer/lib/sendmail-transport/index.js +0 -210
  33. package/dist/node_modules/nodemailer/lib/ses-transport/index.js +0 -349
  34. package/dist/node_modules/nodemailer/lib/shared/index.js +0 -638
  35. package/dist/node_modules/nodemailer/lib/smtp-connection/data-stream.js +0 -108
  36. package/dist/node_modules/nodemailer/lib/smtp-connection/http-proxy-client.js +0 -143
  37. package/dist/node_modules/nodemailer/lib/smtp-connection/index.js +0 -1812
  38. package/dist/node_modules/nodemailer/lib/smtp-pool/index.js +0 -648
  39. package/dist/node_modules/nodemailer/lib/smtp-pool/pool-resource.js +0 -253
  40. package/dist/node_modules/nodemailer/lib/smtp-transport/index.js +0 -416
  41. package/dist/node_modules/nodemailer/lib/stream-transport/index.js +0 -135
  42. package/dist/node_modules/nodemailer/lib/well-known/index.js +0 -47
  43. package/dist/node_modules/nodemailer/lib/well-known/services.json +0 -338
  44. package/dist/node_modules/nodemailer/lib/xoauth2/index.js +0 -376
  45. package/dist/node_modules/nodemailer/package.json +0 -1
  46. package/dist/server/collections/notification_logs.d.ts +0 -11
  47. package/dist/server/collections/notification_logs.js +0 -54
  48. package/dist/server/collections/notification_services.d.ts +0 -11
  49. package/dist/server/collections/notification_services.js +0 -54
  50. package/dist/server/collections/notifications.d.ts +0 -11
  51. package/dist/server/collections/notifications.js +0 -71
  52. package/dist/server/index.d.ts +0 -9
  53. package/dist/server/index.js +0 -42
  54. package/dist/server/models/Notification.d.ts +0 -17
  55. package/dist/server/models/Notification.js +0 -121
  56. package/dist/server/models/NotificationLog.d.ts +0 -11
  57. package/dist/server/models/NotificationLog.js +0 -38
  58. package/dist/server/models/NotificationService.d.ts +0 -17
  59. package/dist/server/models/NotificationService.js +0 -65
  60. package/dist/server/models/index.d.ts +0 -11
  61. package/dist/server/models/index.js +0 -34
  62. package/dist/server/server.d.ts +0 -12
  63. package/dist/server/server.js +0 -50
@@ -1,121 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
- // If the importer is in node compatibility mode or this is not an ESM
30
- // file that has been converted to a CommonJS file using a Babel-
31
- // compatible transform (i.e. "__esModule" has not been set), then set
32
- // "default" to the CommonJS "module.exports" for node compatibility.
33
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
- mod
35
- ));
36
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
- var Notification_exports = {};
38
- __export(Notification_exports, {
39
- Notification: () => Notification
40
- });
41
- module.exports = __toCommonJS(Notification_exports);
42
- var import_database = require("@nocobase/database");
43
- var import_lodash = __toESM(require("lodash"));
44
- class Notification extends import_database.Model {
45
- get db() {
46
- return this.constructor["database"];
47
- }
48
- async getReceiversByOptions() {
49
- const { data, fromTable, filter, dataField } = this.receiver_options;
50
- let receivers = [];
51
- if (data) {
52
- receivers = Array.isArray(data) ? data : [data];
53
- } else if (fromTable) {
54
- const collection = this.db.getCollection(fromTable);
55
- const rows = await collection.repository.find({
56
- filter
57
- });
58
- receivers = rows.map((row) => row[dataField]);
59
- }
60
- return receivers;
61
- }
62
- async send(options = {}) {
63
- const { transaction } = options;
64
- if (!this.service) {
65
- this.service = await this.getService();
66
- }
67
- const receivers = await this.getReceiversByOptions();
68
- let { to } = options;
69
- if (to) {
70
- to = Array.isArray(to) ? to : [to];
71
- receivers.push(...to);
72
- }
73
- console.log(receivers);
74
- for (const receiver of receivers) {
75
- try {
76
- const response = await this.service.send({
77
- to: receiver,
78
- subject: this.getSubject(),
79
- html: this.getBody(options)
80
- });
81
- await this.createLog(
82
- {
83
- receiver,
84
- state: "success",
85
- response
86
- },
87
- {
88
- transaction
89
- }
90
- );
91
- await new Promise((resolve) => {
92
- setTimeout(resolve, 100);
93
- });
94
- } catch (error) {
95
- console.error(error);
96
- await this.createLog(
97
- {
98
- receiver,
99
- state: "fail",
100
- response: {}
101
- },
102
- {
103
- transaction
104
- }
105
- );
106
- }
107
- }
108
- }
109
- getSubject() {
110
- return this.subject;
111
- }
112
- getBody(data) {
113
- const compiled = import_lodash.default.template(this.body);
114
- const body = compiled(data);
115
- return body;
116
- }
117
- }
118
- // Annotate the CommonJS export names for ESM import in node:
119
- 0 && (module.exports = {
120
- Notification
121
- });
@@ -1,11 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { Model } from '@nocobase/database';
10
- export declare class NotificationLog extends Model {
11
- }
@@ -1,38 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var NotificationLog_exports = {};
28
- __export(NotificationLog_exports, {
29
- NotificationLog: () => NotificationLog
30
- });
31
- module.exports = __toCommonJS(NotificationLog_exports);
32
- var import_database = require("@nocobase/database");
33
- class NotificationLog extends import_database.Model {
34
- }
35
- // Annotate the CommonJS export names for ESM import in node:
36
- 0 && (module.exports = {
37
- NotificationLog
38
- });
@@ -1,17 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { Model } from '@nocobase/database';
10
- import nodemailer from 'nodemailer';
11
- export declare class NotificationService extends Model {
12
- [key: string]: any;
13
- static createTransport: typeof nodemailer.createTransport;
14
- private _transporter;
15
- get transporter(): any;
16
- send(options: any): Promise<any>;
17
- }
@@ -1,65 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
- // If the importer is in node compatibility mode or this is not an ESM
30
- // file that has been converted to a CommonJS file using a Babel-
31
- // compatible transform (i.e. "__esModule" has not been set), then set
32
- // "default" to the CommonJS "module.exports" for node compatibility.
33
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
- mod
35
- ));
36
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
- var NotificationService_exports = {};
38
- __export(NotificationService_exports, {
39
- NotificationService: () => NotificationService
40
- });
41
- module.exports = __toCommonJS(NotificationService_exports);
42
- var import_database = require("@nocobase/database");
43
- var import_nodemailer = __toESM(require("nodemailer"));
44
- class NotificationService extends import_database.Model {
45
- static createTransport = import_nodemailer.default.createTransport;
46
- _transporter = null;
47
- get transporter() {
48
- if (this._transporter) {
49
- return this._transporter;
50
- }
51
- return this._transporter = NotificationService.createTransport(this.options);
52
- }
53
- async send(options) {
54
- const { from } = this.options;
55
- const mailOptions = {
56
- from,
57
- ...options
58
- };
59
- return this.transporter.sendMail(mailOptions);
60
- }
61
- }
62
- // Annotate the CommonJS export names for ESM import in node:
63
- 0 && (module.exports = {
64
- NotificationService
65
- });
@@ -1,11 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- export * from './Notification';
10
- export * from './NotificationLog';
11
- export * from './NotificationService';
@@ -1,34 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __copyProps = (to, from, except, desc) => {
15
- if (from && typeof from === "object" || typeof from === "function") {
16
- for (let key of __getOwnPropNames(from))
17
- if (!__hasOwnProp.call(to, key) && key !== except)
18
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
19
- }
20
- return to;
21
- };
22
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
23
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
- var models_exports = {};
25
- module.exports = __toCommonJS(models_exports);
26
- __reExport(models_exports, require("./Notification"), module.exports);
27
- __reExport(models_exports, require("./NotificationLog"), module.exports);
28
- __reExport(models_exports, require("./NotificationService"), module.exports);
29
- // Annotate the CommonJS export names for ESM import in node:
30
- 0 && (module.exports = {
31
- ...require("./Notification"),
32
- ...require("./NotificationLog"),
33
- ...require("./NotificationService")
34
- });
@@ -1,12 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { Plugin } from '@nocobase/server';
10
- export default class PluginNotificationsServer extends Plugin {
11
- load(): Promise<void>;
12
- }
@@ -1,50 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
- // If the importer is in node compatibility mode or this is not an ESM
30
- // file that has been converted to a CommonJS file using a Babel-
31
- // compatible transform (i.e. "__esModule" has not been set), then set
32
- // "default" to the CommonJS "module.exports" for node compatibility.
33
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
- mod
35
- ));
36
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
- var server_exports = {};
38
- __export(server_exports, {
39
- default: () => PluginNotificationsServer
40
- });
41
- module.exports = __toCommonJS(server_exports);
42
- var import_server = require("@nocobase/server");
43
- var import_path = __toESM(require("path"));
44
- class PluginNotificationsServer extends import_server.Plugin {
45
- async load() {
46
- await this.app.db.import({
47
- directory: import_path.default.resolve(__dirname, "collections")
48
- });
49
- }
50
- }