@tego/core 1.3.44
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/LICENSE +201 -0
- package/lib/acl/available-action.d.ts +5 -0
- package/lib/acl/available-action.js +62 -0
- package/lib/acl/index.d.ts +2 -0
- package/lib/acl/index.js +49 -0
- package/lib/aes-encryptor.d.ts +11 -0
- package/lib/aes-encryptor.js +116 -0
- package/lib/app-command.d.ts +12 -0
- package/lib/app-command.js +76 -0
- package/lib/app-supervisor.d.ts +61 -0
- package/lib/app-supervisor.js +299 -0
- package/lib/application.d.ts +354 -0
- package/lib/application.js +878 -0
- package/lib/cache/index.d.ts +3 -0
- package/lib/cache/index.js +35 -0
- package/lib/commands/console.d.ts +3 -0
- package/lib/commands/console.js +48 -0
- package/lib/commands/create-migration.d.ts +3 -0
- package/lib/commands/create-migration.js +80 -0
- package/lib/commands/db-auth.d.ts +3 -0
- package/lib/commands/db-auth.js +28 -0
- package/lib/commands/db-clean.d.ts +3 -0
- package/lib/commands/db-clean.js +31 -0
- package/lib/commands/db-sync.d.ts +3 -0
- package/lib/commands/db-sync.js +40 -0
- package/lib/commands/destroy.d.ts +3 -0
- package/lib/commands/destroy.js +30 -0
- package/lib/commands/index.d.ts +2 -0
- package/lib/commands/index.js +71 -0
- package/lib/commands/install.d.ts +3 -0
- package/lib/commands/install.js +33 -0
- package/lib/commands/migrator.d.ts +3 -0
- package/lib/commands/migrator.js +31 -0
- package/lib/commands/pm.d.ts +3 -0
- package/lib/commands/pm.js +75 -0
- package/lib/commands/refresh.d.ts +3 -0
- package/lib/commands/refresh.js +31 -0
- package/lib/commands/restart.d.ts +3 -0
- package/lib/commands/restart.js +35 -0
- package/lib/commands/start.d.ts +3 -0
- package/lib/commands/start.js +74 -0
- package/lib/commands/stop.d.ts +3 -0
- package/lib/commands/stop.js +34 -0
- package/lib/commands/upgrade.d.ts +3 -0
- package/lib/commands/upgrade.js +29 -0
- package/lib/cron/cron-job-manager.d.ts +25 -0
- package/lib/cron/cron-job-manager.js +89 -0
- package/lib/environment.d.ts +10 -0
- package/lib/environment.js +73 -0
- package/lib/errors/application-not-install.d.ts +4 -0
- package/lib/errors/application-not-install.js +35 -0
- package/lib/errors/handler.d.ts +3 -0
- package/lib/errors/handler.js +41 -0
- package/lib/errors/plugin-command-error.d.ts +2 -0
- package/lib/errors/plugin-command-error.js +31 -0
- package/lib/errors/plugin-not-exist.d.ts +2 -0
- package/lib/errors/plugin-not-exist.js +31 -0
- package/lib/gateway/errors.d.ts +22 -0
- package/lib/gateway/errors.js +138 -0
- package/lib/gateway/gateway.d.ts +56 -0
- package/lib/gateway/gateway.js +408 -0
- package/lib/gateway/index.d.ts +2 -0
- package/lib/gateway/index.js +30 -0
- package/lib/gateway/ipc-socket-client.d.ts +17 -0
- package/lib/gateway/ipc-socket-client.js +99 -0
- package/lib/gateway/ipc-socket-server.d.ts +12 -0
- package/lib/gateway/ipc-socket-server.js +140 -0
- package/lib/gateway/types.d.ts +25 -0
- package/lib/gateway/types.js +15 -0
- package/lib/gateway/ws-server.d.ts +63 -0
- package/lib/gateway/ws-server.js +335 -0
- package/lib/helper.d.ts +11 -0
- package/lib/helper.js +193 -0
- package/lib/helpers/application-version.d.ts +10 -0
- package/lib/helpers/application-version.js +77 -0
- package/lib/helpers/multiple-instance-manager.d.ts +6 -0
- package/lib/helpers/multiple-instance-manager.js +40 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.js +57 -0
- package/lib/locale/index.d.ts +1 -0
- package/lib/locale/index.js +21 -0
- package/lib/locale/locale.d.ts +22 -0
- package/lib/locale/locale.js +166 -0
- package/lib/locale/resource.d.ts +1 -0
- package/lib/locale/resource.js +74 -0
- package/lib/main-data-source.d.ts +4 -0
- package/lib/main-data-source.js +45 -0
- package/lib/middlewares/data-template.d.ts +2 -0
- package/lib/middlewares/data-template.js +39 -0
- package/lib/middlewares/data-wrapping.d.ts +3 -0
- package/lib/middlewares/data-wrapping.js +90 -0
- package/lib/middlewares/db2resource.d.ts +6 -0
- package/lib/middlewares/db2resource.js +76 -0
- package/lib/middlewares/extract-client-ip.d.ts +2 -0
- package/lib/middlewares/extract-client-ip.js +37 -0
- package/lib/middlewares/i18n.d.ts +1 -0
- package/lib/middlewares/i18n.js +44 -0
- package/lib/middlewares/index.d.ts +3 -0
- package/lib/middlewares/index.js +32 -0
- package/lib/middlewares/parse-variables.d.ts +1 -0
- package/lib/middlewares/parse-variables.js +84 -0
- package/lib/migration.d.ts +12 -0
- package/lib/migration.js +47 -0
- package/lib/migrations/20230912193824-package-name-unique.d.ts +6 -0
- package/lib/migrations/20230912193824-package-name-unique.js +52 -0
- package/lib/migrations/20230912294620-update-pkg.d.ts +6 -0
- package/lib/migrations/20230912294620-update-pkg.js +58 -0
- package/lib/migrations/20240106082756-update-plugins.d.ts +6 -0
- package/lib/migrations/20240106082756-update-plugins.js +44 -0
- package/lib/migrations/20240705000001-remove-pkgs-approval.d.ts +6 -0
- package/lib/migrations/20240705000001-remove-pkgs-approval.js +47 -0
- package/lib/notice/index.d.ts +25 -0
- package/lib/notice/index.js +91 -0
- package/lib/plugin-manager/clientStaticUtils.d.ts +24 -0
- package/lib/plugin-manager/clientStaticUtils.js +156 -0
- package/lib/plugin-manager/constants.d.ts +7 -0
- package/lib/plugin-manager/constants.js +120 -0
- package/lib/plugin-manager/deps.d.ts +2 -0
- package/lib/plugin-manager/deps.js +68 -0
- package/lib/plugin-manager/index.d.ts +2 -0
- package/lib/plugin-manager/index.js +23 -0
- package/lib/plugin-manager/middleware.d.ts +2 -0
- package/lib/plugin-manager/middleware.js +36 -0
- package/lib/plugin-manager/options/collection.d.ts +2 -0
- package/lib/plugin-manager/options/collection.js +39 -0
- package/lib/plugin-manager/options/resource.d.ts +15 -0
- package/lib/plugin-manager/options/resource.js +185 -0
- package/lib/plugin-manager/plugin-manager-repository.d.ts +27 -0
- package/lib/plugin-manager/plugin-manager-repository.js +136 -0
- package/lib/plugin-manager/plugin-manager.d.ts +205 -0
- package/lib/plugin-manager/plugin-manager.js +1032 -0
- package/lib/plugin-manager/types.d.ts +15 -0
- package/lib/plugin-manager/types.js +15 -0
- package/lib/plugin-manager/utils.d.ts +101 -0
- package/lib/plugin-manager/utils.js +513 -0
- package/lib/plugin-manager/web-service.d.ts +6 -0
- package/lib/plugin-manager/web-service.js +116 -0
- package/lib/plugin.d.ts +125 -0
- package/lib/plugin.js +359 -0
- package/lib/pub-sub-manager/handler-manager.d.ts +28 -0
- package/lib/pub-sub-manager/handler-manager.js +149 -0
- package/lib/pub-sub-manager/index.d.ts +3 -0
- package/lib/pub-sub-manager/index.js +25 -0
- package/lib/pub-sub-manager/memory-pub-sub-adapter.d.ts +21 -0
- package/lib/pub-sub-manager/memory-pub-sub-adapter.js +82 -0
- package/lib/pub-sub-manager/pub-sub-manager.d.ts +19 -0
- package/lib/pub-sub-manager/pub-sub-manager.js +108 -0
- package/lib/pub-sub-manager/types.d.ts +20 -0
- package/lib/pub-sub-manager/types.js +15 -0
- package/lib/sync-message-manager.d.ts +16 -0
- package/lib/sync-message-manager.js +112 -0
- package/package.json +58 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var package_name_unique_exports = {};
|
|
20
|
+
__export(package_name_unique_exports, {
|
|
21
|
+
default: () => package_name_unique_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(package_name_unique_exports);
|
|
24
|
+
var import_database = require("@tachybase/database");
|
|
25
|
+
var import_migration = require("../migration");
|
|
26
|
+
const _package_name_unique_default = class _package_name_unique_default extends import_migration.Migration {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
this.on = "beforeLoad";
|
|
30
|
+
this.appVersion = "<0.14.0-alpha.2";
|
|
31
|
+
}
|
|
32
|
+
async up() {
|
|
33
|
+
const tableNameWithSchema = this.pm.collection.getTableNameWithSchema();
|
|
34
|
+
const field = this.pm.collection.getField("packageName");
|
|
35
|
+
const exists = await field.existsInDb();
|
|
36
|
+
if (exists) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
await this.db.sequelize.getQueryInterface().addColumn(tableNameWithSchema, field.columnName(), {
|
|
41
|
+
type: import_database.DataTypes.STRING
|
|
42
|
+
});
|
|
43
|
+
await this.db.sequelize.getQueryInterface().addConstraint(tableNameWithSchema, {
|
|
44
|
+
type: "unique",
|
|
45
|
+
fields: [field.columnName()]
|
|
46
|
+
});
|
|
47
|
+
} catch (error) {
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
__name(_package_name_unique_default, "default");
|
|
52
|
+
let package_name_unique_default = _package_name_unique_default;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var update_pkg_exports = {};
|
|
20
|
+
__export(update_pkg_exports, {
|
|
21
|
+
default: () => update_pkg_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(update_pkg_exports);
|
|
24
|
+
var import_migration = require("../migration");
|
|
25
|
+
var import_plugin_manager = require("../plugin-manager");
|
|
26
|
+
const _update_pkg_default = class _update_pkg_default extends import_migration.Migration {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
this.on = "afterSync";
|
|
30
|
+
// 'beforeLoad' or 'afterLoad'
|
|
31
|
+
this.appVersion = "<0.14.0-alpha.2";
|
|
32
|
+
}
|
|
33
|
+
async up() {
|
|
34
|
+
const plugins = await this.pm.repository.find();
|
|
35
|
+
for (const plugin of plugins) {
|
|
36
|
+
const { name } = plugin;
|
|
37
|
+
if (plugin.packageName) {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
const packageName = await import_plugin_manager.PluginManager.getPackageName(name);
|
|
42
|
+
await this.pm.repository.update({
|
|
43
|
+
filter: {
|
|
44
|
+
name
|
|
45
|
+
},
|
|
46
|
+
values: {
|
|
47
|
+
packageName
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
this.app.logger.info(`update ${packageName}`);
|
|
51
|
+
} catch (error) {
|
|
52
|
+
this.app.logger.warn(error.message);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
__name(_update_pkg_default, "default");
|
|
58
|
+
let update_pkg_default = _update_pkg_default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var update_plugins_exports = {};
|
|
20
|
+
__export(update_plugins_exports, {
|
|
21
|
+
default: () => update_plugins_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(update_plugins_exports);
|
|
24
|
+
var import_migration = require("../migration");
|
|
25
|
+
const _update_plugins_default = class _update_plugins_default extends import_migration.Migration {
|
|
26
|
+
constructor() {
|
|
27
|
+
super(...arguments);
|
|
28
|
+
this.on = "afterSync";
|
|
29
|
+
// 'beforeLoad' or 'afterLoad'
|
|
30
|
+
this.appVersion = "<0.18.0-alpha.10";
|
|
31
|
+
}
|
|
32
|
+
async up() {
|
|
33
|
+
await this.pm.repository.update({
|
|
34
|
+
values: {
|
|
35
|
+
installed: true
|
|
36
|
+
},
|
|
37
|
+
filter: {
|
|
38
|
+
enabled: true
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
__name(_update_plugins_default, "default");
|
|
44
|
+
let update_plugins_default = _update_plugins_default;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var remove_pkgs_approval_exports = {};
|
|
20
|
+
__export(remove_pkgs_approval_exports, {
|
|
21
|
+
default: () => remove_pkgs_approval_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(remove_pkgs_approval_exports);
|
|
24
|
+
var import_migration = require("../migration");
|
|
25
|
+
const _remove_pkgs_approval_default = class _remove_pkgs_approval_default extends import_migration.Migration {
|
|
26
|
+
constructor() {
|
|
27
|
+
super(...arguments);
|
|
28
|
+
this.on = "beforeLoad";
|
|
29
|
+
this.appVersion = "<0.21.65";
|
|
30
|
+
}
|
|
31
|
+
async up() {
|
|
32
|
+
console.log("remove workflow notice");
|
|
33
|
+
await this.pm.repository.destroy({
|
|
34
|
+
filter: {
|
|
35
|
+
name: "workflow-notice"
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
console.log("remove approval");
|
|
39
|
+
await this.pm.repository.destroy({
|
|
40
|
+
filter: {
|
|
41
|
+
name: "approval"
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
__name(_remove_pkgs_approval_default, "default");
|
|
47
|
+
let remove_pkgs_approval_default = _remove_pkgs_approval_default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import Application from '../application';
|
|
2
|
+
export declare enum NoticeLevel {
|
|
3
|
+
INFO = "info",
|
|
4
|
+
WARNING = "warning",
|
|
5
|
+
SUCCESS = "success",
|
|
6
|
+
ERROR = "error"
|
|
7
|
+
}
|
|
8
|
+
export declare enum NoticeType {
|
|
9
|
+
STATUS = "status",
|
|
10
|
+
TOAST = "toast",
|
|
11
|
+
NOTIFICATION = "notification",
|
|
12
|
+
CUSTOM = "custom",
|
|
13
|
+
MODAL = "modal"
|
|
14
|
+
}
|
|
15
|
+
export declare class NoticeManager {
|
|
16
|
+
#private;
|
|
17
|
+
private app;
|
|
18
|
+
private ws;
|
|
19
|
+
constructor(app: Application);
|
|
20
|
+
notify(eventType: string, event: unknown): void;
|
|
21
|
+
status(content: string, level: NoticeLevel, duration: number): void;
|
|
22
|
+
toast(content: string, level: NoticeLevel, duration: number): void;
|
|
23
|
+
notification(title: string, content: string, level: NoticeLevel, duration: number): void;
|
|
24
|
+
modal(title: string, content: string, level: NoticeLevel, duration: number): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __typeError = (msg) => {
|
|
6
|
+
throw TypeError(msg);
|
|
7
|
+
};
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
23
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
24
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
25
|
+
var notice_exports = {};
|
|
26
|
+
__export(notice_exports, {
|
|
27
|
+
NoticeLevel: () => NoticeLevel,
|
|
28
|
+
NoticeManager: () => NoticeManager,
|
|
29
|
+
NoticeType: () => NoticeType
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(notice_exports);
|
|
32
|
+
var import_gateway = require("../gateway");
|
|
33
|
+
var _NoticeManager_instances, emit_fn;
|
|
34
|
+
var NoticeLevel = /* @__PURE__ */ ((NoticeLevel2) => {
|
|
35
|
+
NoticeLevel2["INFO"] = "info";
|
|
36
|
+
NoticeLevel2["WARNING"] = "warning";
|
|
37
|
+
NoticeLevel2["SUCCESS"] = "success";
|
|
38
|
+
NoticeLevel2["ERROR"] = "error";
|
|
39
|
+
return NoticeLevel2;
|
|
40
|
+
})(NoticeLevel || {});
|
|
41
|
+
var NoticeType = /* @__PURE__ */ ((NoticeType2) => {
|
|
42
|
+
NoticeType2["STATUS"] = "status";
|
|
43
|
+
NoticeType2["TOAST"] = "toast";
|
|
44
|
+
NoticeType2["NOTIFICATION"] = "notification";
|
|
45
|
+
NoticeType2["CUSTOM"] = "custom";
|
|
46
|
+
NoticeType2["MODAL"] = "modal";
|
|
47
|
+
return NoticeType2;
|
|
48
|
+
})(NoticeType || {});
|
|
49
|
+
const _NoticeManager = class _NoticeManager {
|
|
50
|
+
constructor(app) {
|
|
51
|
+
this.app = app;
|
|
52
|
+
__privateAdd(this, _NoticeManager_instances);
|
|
53
|
+
const gateway = import_gateway.Gateway.getInstance();
|
|
54
|
+
this.ws = gateway["wsServer"];
|
|
55
|
+
}
|
|
56
|
+
notify(eventType, event) {
|
|
57
|
+
__privateMethod(this, _NoticeManager_instances, emit_fn).call(this, {
|
|
58
|
+
type: "custom" /* CUSTOM */,
|
|
59
|
+
eventType,
|
|
60
|
+
event
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
status(content, level, duration) {
|
|
64
|
+
__privateMethod(this, _NoticeManager_instances, emit_fn).call(this, { type: "status" /* STATUS */, content, level, duration });
|
|
65
|
+
}
|
|
66
|
+
toast(content, level, duration) {
|
|
67
|
+
__privateMethod(this, _NoticeManager_instances, emit_fn).call(this, { type: "toast" /* TOAST */, content, level, duration });
|
|
68
|
+
}
|
|
69
|
+
notification(title, content, level, duration) {
|
|
70
|
+
__privateMethod(this, _NoticeManager_instances, emit_fn).call(this, { type: "notification" /* NOTIFICATION */, title, content, level, duration });
|
|
71
|
+
}
|
|
72
|
+
modal(title, content, level, duration) {
|
|
73
|
+
__privateMethod(this, _NoticeManager_instances, emit_fn).call(this, { type: "modal" /* MODAL */, title, content, level, duration });
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
_NoticeManager_instances = new WeakSet();
|
|
77
|
+
emit_fn = /* @__PURE__ */ __name(function(msg) {
|
|
78
|
+
var _a;
|
|
79
|
+
(_a = this.ws) == null ? void 0 : _a.sendToConnectionsByTag("app", this.app.name, {
|
|
80
|
+
type: "notice",
|
|
81
|
+
payload: msg
|
|
82
|
+
});
|
|
83
|
+
}, "#emit");
|
|
84
|
+
__name(_NoticeManager, "NoticeManager");
|
|
85
|
+
let NoticeManager = _NoticeManager;
|
|
86
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
87
|
+
0 && (module.exports = {
|
|
88
|
+
NoticeLevel,
|
|
89
|
+
NoticeManager,
|
|
90
|
+
NoticeType
|
|
91
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const PLUGIN_STATICS_PATH = "/static/plugins/";
|
|
2
|
+
/**
|
|
3
|
+
* get package.json path for specific NPM package
|
|
4
|
+
* TODO:这里在支持多路径后逻辑不好维护
|
|
5
|
+
*/
|
|
6
|
+
export declare function getDepPkgPath(packageName: string, cwd?: string): string;
|
|
7
|
+
export declare function getPackageDir(packageName: string): string;
|
|
8
|
+
export declare function getPackageFilePath(packageName: string, filePath: string): string;
|
|
9
|
+
export declare function getPackageFilePathWithExistCheck(packageName: string, filePath: string): {
|
|
10
|
+
filePath: string;
|
|
11
|
+
exists: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare function getExposeUrl(packageName: string, filePath: string): string;
|
|
14
|
+
export declare function getExposeReadmeUrl(packageName: string, lang: string): string;
|
|
15
|
+
export declare function getExposeChangelogUrl(packageName: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* get package name by client static url
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* getPluginNameByClientStaticUrl('/static/plugins/dayjs/index.js') => 'dayjs'
|
|
21
|
+
* getPluginNameByClientStaticUrl('/static/plugins/@tachybase/foo/README.md') => '@tachybase/foo'
|
|
22
|
+
*/
|
|
23
|
+
export declare function getPackageNameByExposeUrl(pathname: string): string;
|
|
24
|
+
export declare function getPackageDirByExposeUrl(pathname: string): string;
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var clientStaticUtils_exports = {};
|
|
30
|
+
__export(clientStaticUtils_exports, {
|
|
31
|
+
PLUGIN_STATICS_PATH: () => PLUGIN_STATICS_PATH,
|
|
32
|
+
getDepPkgPath: () => getDepPkgPath,
|
|
33
|
+
getExposeChangelogUrl: () => getExposeChangelogUrl,
|
|
34
|
+
getExposeReadmeUrl: () => getExposeReadmeUrl,
|
|
35
|
+
getExposeUrl: () => getExposeUrl,
|
|
36
|
+
getPackageDir: () => getPackageDir,
|
|
37
|
+
getPackageDirByExposeUrl: () => getPackageDirByExposeUrl,
|
|
38
|
+
getPackageFilePath: () => getPackageFilePath,
|
|
39
|
+
getPackageFilePathWithExistCheck: () => getPackageFilePathWithExistCheck,
|
|
40
|
+
getPackageNameByExposeUrl: () => getPackageNameByExposeUrl
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(clientStaticUtils_exports);
|
|
43
|
+
var import_node_fs = __toESM(require("node:fs"));
|
|
44
|
+
var import_node_path = __toESM(require("node:path"));
|
|
45
|
+
var import_globals = __toESM(require("@tachybase/globals"));
|
|
46
|
+
const PLUGIN_STATICS_PATH = "/static/plugins/";
|
|
47
|
+
function findPackageJson(filePath) {
|
|
48
|
+
const directory = import_node_path.default.dirname(filePath);
|
|
49
|
+
const packageJsonPath = import_node_path.default.resolve(directory, "package.json");
|
|
50
|
+
if (import_node_fs.default.existsSync(packageJsonPath)) {
|
|
51
|
+
return directory;
|
|
52
|
+
} else if (directory !== "/") {
|
|
53
|
+
return findPackageJson(directory);
|
|
54
|
+
} else {
|
|
55
|
+
throw new Error("package.json not found.");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
__name(findPackageJson, "findPackageJson");
|
|
59
|
+
function getDepPkgPath(packageName, cwd) {
|
|
60
|
+
if (cwd) {
|
|
61
|
+
try {
|
|
62
|
+
return require.resolve(`${packageName}/package.json`, { paths: [cwd] });
|
|
63
|
+
} catch {
|
|
64
|
+
const mainFile = require.resolve(`${packageName}`, { paths: [cwd] });
|
|
65
|
+
const packageDir = mainFile.slice(0, mainFile.indexOf(packageName.replace("/", import_node_path.default.sep)) + packageName.length);
|
|
66
|
+
const result = import_node_path.default.join(packageDir, "package.json");
|
|
67
|
+
if (!import_node_fs.default.existsSync(result)) {
|
|
68
|
+
return import_node_path.default.join(findPackageJson(mainFile), "package.json");
|
|
69
|
+
}
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
const pluginPaths = import_globals.default.getInstance().get("PLUGIN_PATHS");
|
|
74
|
+
for (const basePath of pluginPaths) {
|
|
75
|
+
if (!import_node_fs.default.existsSync((0, import_node_path.resolve)(basePath, packageName))) {
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
return require.resolve(`${(0, import_node_path.resolve)(basePath, packageName)}/package.json`);
|
|
80
|
+
} catch {
|
|
81
|
+
const mainFile = require.resolve(`${(0, import_node_path.resolve)(basePath, packageName)}`);
|
|
82
|
+
const packageDir = mainFile.slice(0, mainFile.indexOf(packageName.replace("/", import_node_path.default.sep)) + packageName.length);
|
|
83
|
+
const result = import_node_path.default.join(packageDir, "package.json");
|
|
84
|
+
if (!import_node_fs.default.existsSync(result)) {
|
|
85
|
+
return import_node_path.default.join(findPackageJson(mainFile), "package.json");
|
|
86
|
+
}
|
|
87
|
+
return result;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
__name(getDepPkgPath, "getDepPkgPath");
|
|
93
|
+
function getPackageDir(packageName) {
|
|
94
|
+
const packageJsonPath = getDepPkgPath(packageName);
|
|
95
|
+
return import_node_path.default.dirname(packageJsonPath);
|
|
96
|
+
}
|
|
97
|
+
__name(getPackageDir, "getPackageDir");
|
|
98
|
+
function getPackageFilePath(packageName, filePath) {
|
|
99
|
+
const packageDir = getPackageDir(packageName);
|
|
100
|
+
return import_node_path.default.join(packageDir, filePath);
|
|
101
|
+
}
|
|
102
|
+
__name(getPackageFilePath, "getPackageFilePath");
|
|
103
|
+
function getPackageFilePathWithExistCheck(packageName, filePath) {
|
|
104
|
+
const absolutePath = getPackageFilePath(packageName, filePath);
|
|
105
|
+
const exists = import_node_fs.default.existsSync(absolutePath);
|
|
106
|
+
return {
|
|
107
|
+
filePath: absolutePath,
|
|
108
|
+
exists
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
__name(getPackageFilePathWithExistCheck, "getPackageFilePathWithExistCheck");
|
|
112
|
+
function getExposeUrl(packageName, filePath) {
|
|
113
|
+
return `${process.env.PLUGIN_STATICS_PATH}${packageName}/${filePath}`;
|
|
114
|
+
}
|
|
115
|
+
__name(getExposeUrl, "getExposeUrl");
|
|
116
|
+
function getExposeReadmeUrl(packageName, lang) {
|
|
117
|
+
let READMEPath = null;
|
|
118
|
+
if (getPackageFilePathWithExistCheck(packageName, `README.${lang}.md`).exists) {
|
|
119
|
+
READMEPath = `README.${lang}.md`;
|
|
120
|
+
} else if (getPackageFilePathWithExistCheck(packageName, "README.md").exists) {
|
|
121
|
+
READMEPath = "README.md";
|
|
122
|
+
}
|
|
123
|
+
return READMEPath ? getExposeUrl(packageName, READMEPath) : null;
|
|
124
|
+
}
|
|
125
|
+
__name(getExposeReadmeUrl, "getExposeReadmeUrl");
|
|
126
|
+
function getExposeChangelogUrl(packageName) {
|
|
127
|
+
const { exists } = getPackageFilePathWithExistCheck(packageName, "CHANGELOG.md");
|
|
128
|
+
return exists ? getExposeUrl(packageName, "CHANGELOG.md") : null;
|
|
129
|
+
}
|
|
130
|
+
__name(getExposeChangelogUrl, "getExposeChangelogUrl");
|
|
131
|
+
function getPackageNameByExposeUrl(pathname) {
|
|
132
|
+
pathname = pathname.replace(process.env.PLUGIN_STATICS_PATH, "");
|
|
133
|
+
const pathArr = pathname.split("/");
|
|
134
|
+
if (pathname.startsWith("@")) {
|
|
135
|
+
return pathArr.slice(0, 2).join("/");
|
|
136
|
+
}
|
|
137
|
+
return pathArr[0];
|
|
138
|
+
}
|
|
139
|
+
__name(getPackageNameByExposeUrl, "getPackageNameByExposeUrl");
|
|
140
|
+
function getPackageDirByExposeUrl(pathname) {
|
|
141
|
+
return getPackageDir(getPackageNameByExposeUrl(pathname));
|
|
142
|
+
}
|
|
143
|
+
__name(getPackageDirByExposeUrl, "getPackageDirByExposeUrl");
|
|
144
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
145
|
+
0 && (module.exports = {
|
|
146
|
+
PLUGIN_STATICS_PATH,
|
|
147
|
+
getDepPkgPath,
|
|
148
|
+
getExposeChangelogUrl,
|
|
149
|
+
getExposeReadmeUrl,
|
|
150
|
+
getExposeUrl,
|
|
151
|
+
getPackageDir,
|
|
152
|
+
getPackageDirByExposeUrl,
|
|
153
|
+
getPackageFilePath,
|
|
154
|
+
getPackageFilePathWithExistCheck,
|
|
155
|
+
getPackageNameByExposeUrl
|
|
156
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const APP_NAME = "tachybase";
|
|
2
|
+
export declare const DEFAULT_PLUGIN_STORAGE_PATH = "storage/plugins";
|
|
3
|
+
export declare const DEFAULT_PLUGIN_PATH = "packages/";
|
|
4
|
+
export declare const pluginPrefix: string[];
|
|
5
|
+
export declare const requireRegex: RegExp;
|
|
6
|
+
export declare const importRegex: RegExp;
|
|
7
|
+
export declare const EXTERNAL: string[];
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var constants_exports = {};
|
|
19
|
+
__export(constants_exports, {
|
|
20
|
+
APP_NAME: () => APP_NAME,
|
|
21
|
+
DEFAULT_PLUGIN_PATH: () => DEFAULT_PLUGIN_PATH,
|
|
22
|
+
DEFAULT_PLUGIN_STORAGE_PATH: () => DEFAULT_PLUGIN_STORAGE_PATH,
|
|
23
|
+
EXTERNAL: () => EXTERNAL,
|
|
24
|
+
importRegex: () => importRegex,
|
|
25
|
+
pluginPrefix: () => pluginPrefix,
|
|
26
|
+
requireRegex: () => requireRegex
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(constants_exports);
|
|
29
|
+
const APP_NAME = "tachybase";
|
|
30
|
+
const DEFAULT_PLUGIN_STORAGE_PATH = "storage/plugins";
|
|
31
|
+
const DEFAULT_PLUGIN_PATH = "packages/";
|
|
32
|
+
const pluginPrefix = (process.env.PLUGIN_PACKAGE_PREFIX || "@tachybase/plugin-,@tachybase/module-").split(",");
|
|
33
|
+
const requireRegex = /require\s*\(['"`](.*?)['"`]\)/g;
|
|
34
|
+
const importRegex = /^import(?:['"\s]*([\w*${}\s,]+)from\s*)?['"\s]['"\s](.*[@\w_-]+)['"\s].*/gm;
|
|
35
|
+
const EXTERNAL = [
|
|
36
|
+
// tachybase
|
|
37
|
+
"@tachybase/acl",
|
|
38
|
+
"@tachybase/actions",
|
|
39
|
+
"@tachybase/auth",
|
|
40
|
+
"@tachybase/cache",
|
|
41
|
+
"@tachybase/client",
|
|
42
|
+
"@tachybase/database",
|
|
43
|
+
"@tachybase/evaluators",
|
|
44
|
+
"@tachybase/logger",
|
|
45
|
+
"@tachybase/resourcer",
|
|
46
|
+
"@tachybase/sdk",
|
|
47
|
+
"@tego/core",
|
|
48
|
+
"@tachybase/test",
|
|
49
|
+
"@tachybase/utils",
|
|
50
|
+
"@tachybase/globals",
|
|
51
|
+
"@tachybase/loader",
|
|
52
|
+
"@tego/client",
|
|
53
|
+
"@tego/server",
|
|
54
|
+
// @tachybase/auth
|
|
55
|
+
"jsonwebtoken",
|
|
56
|
+
// @tachybase/cache
|
|
57
|
+
"cache-manager",
|
|
58
|
+
// @tachybase/database
|
|
59
|
+
"sequelize",
|
|
60
|
+
"umzug",
|
|
61
|
+
"async-mutex",
|
|
62
|
+
// @tachybase/evaluators
|
|
63
|
+
"@formulajs/formulajs",
|
|
64
|
+
// @tachybase/logger
|
|
65
|
+
"winston",
|
|
66
|
+
"winston-daily-rotate-file",
|
|
67
|
+
// koa
|
|
68
|
+
"koa",
|
|
69
|
+
"@koa/cors",
|
|
70
|
+
"multer",
|
|
71
|
+
"@koa/multer",
|
|
72
|
+
"koa-bodyparser",
|
|
73
|
+
// react
|
|
74
|
+
"react",
|
|
75
|
+
"react-dom",
|
|
76
|
+
"react/jsx-runtime",
|
|
77
|
+
// react-router
|
|
78
|
+
"react-router",
|
|
79
|
+
"react-router-dom",
|
|
80
|
+
// antd
|
|
81
|
+
"antd",
|
|
82
|
+
"antd-style",
|
|
83
|
+
"@ant-design/icons",
|
|
84
|
+
"@ant-design/cssinjs",
|
|
85
|
+
// i18next
|
|
86
|
+
"i18next",
|
|
87
|
+
"react-i18next",
|
|
88
|
+
// dnd-kit 相关
|
|
89
|
+
"@dnd-kit/accessibility",
|
|
90
|
+
"@dnd-kit/core",
|
|
91
|
+
"@dnd-kit/modifiers",
|
|
92
|
+
"@dnd-kit/sortable",
|
|
93
|
+
"@dnd-kit/utilities",
|
|
94
|
+
// 内置类库 相关
|
|
95
|
+
"@tachybase/components",
|
|
96
|
+
"@tachybase/requirejs",
|
|
97
|
+
"@tachybase/schema",
|
|
98
|
+
// utils
|
|
99
|
+
"dayjs",
|
|
100
|
+
"mysql2",
|
|
101
|
+
"pg",
|
|
102
|
+
"pg-hstore",
|
|
103
|
+
"sqlite3",
|
|
104
|
+
"supertest",
|
|
105
|
+
"axios",
|
|
106
|
+
"@emotion/css",
|
|
107
|
+
"ahooks",
|
|
108
|
+
"lodash",
|
|
109
|
+
"china-division"
|
|
110
|
+
];
|
|
111
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
112
|
+
0 && (module.exports = {
|
|
113
|
+
APP_NAME,
|
|
114
|
+
DEFAULT_PLUGIN_PATH,
|
|
115
|
+
DEFAULT_PLUGIN_STORAGE_PATH,
|
|
116
|
+
EXTERNAL,
|
|
117
|
+
importRegex,
|
|
118
|
+
pluginPrefix,
|
|
119
|
+
requireRegex
|
|
120
|
+
});
|