@nocobase/utils 1.2.12-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 (65) hide show
  1. package/package.json +2 -2
  2. package/lib/assign.d.ts +0 -17
  3. package/lib/assign.js +0 -143
  4. package/lib/client.d.ts +0 -29
  5. package/lib/client.js +0 -86
  6. package/lib/collections-graph.d.ts +0 -24
  7. package/lib/collections-graph.js +0 -108
  8. package/lib/common.d.ts +0 -14
  9. package/lib/common.js +0 -87
  10. package/lib/date.d.ts +0 -37
  11. package/lib/date.js +0 -189
  12. package/lib/dayjs.d.ts +0 -10
  13. package/lib/dayjs.js +0 -72
  14. package/lib/forEach.d.ts +0 -9
  15. package/lib/forEach.js +0 -45
  16. package/lib/fs-exists.d.ts +0 -9
  17. package/lib/fs-exists.js +0 -46
  18. package/lib/getValuesByPath.d.ts +0 -9
  19. package/lib/getValuesByPath.js +0 -71
  20. package/lib/i18n.d.ts +0 -10
  21. package/lib/i18n.js +0 -43
  22. package/lib/index.d.ts +0 -35
  23. package/lib/index.js +0 -98
  24. package/lib/isPortalInBody.d.ts +0 -13
  25. package/lib/isPortalInBody.js +0 -54
  26. package/lib/isValidFilter.d.ts +0 -9
  27. package/lib/isValidFilter.js +0 -63
  28. package/lib/json-templates.d.ts +0 -9
  29. package/lib/json-templates.js +0 -141
  30. package/lib/koa-multer.d.ts +0 -15
  31. package/lib/koa-multer.js +0 -94
  32. package/lib/log.d.ts +0 -9
  33. package/lib/log.js +0 -39
  34. package/lib/measure-execution-time.d.ts +0 -9
  35. package/lib/measure-execution-time.js +0 -44
  36. package/lib/merge.d.ts +0 -9
  37. package/lib/merge.js +0 -55
  38. package/lib/mixin/AsyncEmitter.d.ts +0 -11
  39. package/lib/mixin/AsyncEmitter.js +0 -80
  40. package/lib/mixin/index.d.ts +0 -9
  41. package/lib/mixin/index.js +0 -48
  42. package/lib/notification.d.ts +0 -9
  43. package/lib/notification.js +0 -43
  44. package/lib/number.d.ts +0 -9
  45. package/lib/number.js +0 -45
  46. package/lib/parse-date.d.ts +0 -15
  47. package/lib/parse-date.js +0 -262
  48. package/lib/parse-filter.d.ts +0 -159
  49. package/lib/parse-filter.js +0 -317
  50. package/lib/parseHTML.d.ts +0 -15
  51. package/lib/parseHTML.js +0 -42
  52. package/lib/perf-hooks.d.ts +0 -14
  53. package/lib/perf-hooks.js +0 -69
  54. package/lib/registry.d.ts +0 -22
  55. package/lib/registry.js +0 -69
  56. package/lib/requireModule.d.ts +0 -12
  57. package/lib/requireModule.js +0 -90
  58. package/lib/server.d.ts +0 -19
  59. package/lib/server.js +0 -50
  60. package/lib/toposort.d.ts +0 -18
  61. package/lib/toposort.js +0 -83
  62. package/lib/uid.d.ts +0 -9
  63. package/lib/uid.js +0 -46
  64. package/lib/url.d.ts +0 -9
  65. package/lib/url.js +0 -46
@@ -1,54 +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 __name = (target, value) => __defProp(target, "name", { value, configurable: true });
15
- var __export = (target, all) => {
16
- for (var name in all)
17
- __defProp(target, name, { get: all[name], enumerable: true });
18
- };
19
- var __copyProps = (to, from, except, desc) => {
20
- if (from && typeof from === "object" || typeof from === "function") {
21
- for (let key of __getOwnPropNames(from))
22
- if (!__hasOwnProp.call(to, key) && key !== except)
23
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
24
- }
25
- return to;
26
- };
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var isPortalInBody_exports = {};
29
- __export(isPortalInBody_exports, {
30
- isPortalInBody: () => isPortalInBody
31
- });
32
- module.exports = __toCommonJS(isPortalInBody_exports);
33
- const isPortalInBody = /* @__PURE__ */ __name((dom) => {
34
- var _a;
35
- while (dom) {
36
- if (dom.id === "root" || ((_a = dom.classList) == null ? void 0 : _a.contains("nb-action"))) {
37
- return false;
38
- }
39
- dom = dom.parentNode;
40
- }
41
- if (process.env.__TEST__) {
42
- return false;
43
- }
44
- if (process.env.NODE_ENV !== "production") {
45
- if (!document.querySelector("#root")) {
46
- throw new Error(`isPortalInBody: can not find element with id 'root'`);
47
- }
48
- }
49
- return true;
50
- }, "isPortalInBody");
51
- // Annotate the CommonJS export names for ESM import in node:
52
- 0 && (module.exports = {
53
- isPortalInBody
54
- });
@@ -1,9 +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 declare function isValidFilter(condition: any): any;
@@ -1,63 +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 __name = (target, value) => __defProp(target, "name", { value, configurable: true });
15
- var __export = (target, all) => {
16
- for (var name in all)
17
- __defProp(target, name, { get: all[name], enumerable: true });
18
- };
19
- var __copyProps = (to, from, except, desc) => {
20
- if (from && typeof from === "object" || typeof from === "function") {
21
- for (let key of __getOwnPropNames(from))
22
- if (!__hasOwnProp.call(to, key) && key !== except)
23
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
24
- }
25
- return to;
26
- };
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var isValidFilter_exports = {};
29
- __export(isValidFilter_exports, {
30
- isValidFilter: () => isValidFilter
31
- });
32
- module.exports = __toCommonJS(isValidFilter_exports);
33
- function isValidFilter(condition) {
34
- if (!condition) {
35
- return false;
36
- }
37
- const groups = [condition.$and, condition.$or].filter(Boolean);
38
- if (groups.length == 0) {
39
- return Object.keys(condition).length > 0;
40
- }
41
- return groups.some((item) => {
42
- if (Array.isArray(item)) {
43
- return item.some(isValidFilter);
44
- }
45
- if (item.$and || item.$or) {
46
- return isValidFilter(item);
47
- }
48
- const [name] = Object.keys(item);
49
- if (!name || !item[name]) {
50
- return false;
51
- }
52
- const [op] = Object.keys(item[name]);
53
- if (!op || typeof item[name][op] === "undefined") {
54
- return false;
55
- }
56
- return true;
57
- });
58
- }
59
- __name(isValidFilter, "isValidFilter");
60
- // Annotate the CommonJS export names for ESM import in node:
61
- 0 && (module.exports = {
62
- isValidFilter
63
- });
@@ -1,9 +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 declare function parse(value: any): any;
@@ -1,141 +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 __name = (target, value) => __defProp(target, "name", { value, configurable: true });
15
- var __export = (target, all) => {
16
- for (var name in all)
17
- __defProp(target, name, { get: all[name], enumerable: true });
18
- };
19
- var __copyProps = (to, from, except, desc) => {
20
- if (from && typeof from === "object" || typeof from === "function") {
21
- for (let key of __getOwnPropNames(from))
22
- if (!__hasOwnProp.call(to, key) && key !== except)
23
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
24
- }
25
- return to;
26
- };
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var json_templates_exports = {};
29
- __export(json_templates_exports, {
30
- parse: () => parse
31
- });
32
- module.exports = __toCommonJS(json_templates_exports);
33
- var import_lodash = require("lodash");
34
- function type(value) {
35
- let valueType = typeof value;
36
- if (Array.isArray(value)) {
37
- valueType = "array";
38
- } else if (value instanceof Date) {
39
- valueType = "date";
40
- } else if (value === null) {
41
- valueType = "null";
42
- }
43
- return valueType;
44
- }
45
- __name(type, "type");
46
- function Parameter(match) {
47
- let param;
48
- const matchValue = match.substr(2, match.length - 4).trim();
49
- const i = matchValue.indexOf(":");
50
- if (i !== -1) {
51
- param = {
52
- key: matchValue.substr(0, i),
53
- defaultValue: matchValue.substr(i + 1)
54
- };
55
- } else {
56
- param = { key: matchValue };
57
- }
58
- return param;
59
- }
60
- __name(Parameter, "Parameter");
61
- function Template(fn, parameters) {
62
- fn.parameters = Array.from(new Map(parameters.map((parameter) => [parameter.key, parameter])).values());
63
- return fn;
64
- }
65
- __name(Template, "Template");
66
- function parse(value) {
67
- switch (type(value)) {
68
- case "string":
69
- return parseString(value);
70
- case "object":
71
- return parseObject(value);
72
- case "array":
73
- return parseArray(value);
74
- default:
75
- return Template(function() {
76
- return value;
77
- }, []);
78
- }
79
- }
80
- __name(parse, "parse");
81
- const parseString = (() => {
82
- const regex = /{{(\w|:|[\s-+.,@/()?=*_$])+}}/g;
83
- return (str) => {
84
- let parameters = [];
85
- let templateFn = /* @__PURE__ */ __name((context) => str, "templateFn");
86
- const matches = str.match(regex);
87
- if (matches) {
88
- parameters = matches.map(Parameter);
89
- templateFn = /* @__PURE__ */ __name((context) => {
90
- context = context || {};
91
- return matches.reduce((result, match, i) => {
92
- const parameter = parameters[i];
93
- let value = (0, import_lodash.get)(context, parameter.key);
94
- if (typeof value === "undefined") {
95
- value = parameter.defaultValue;
96
- }
97
- if (typeof value === "function") {
98
- value = value();
99
- }
100
- if (matches.length === 1 && str.startsWith("{{") && str.endsWith("}}")) {
101
- return value;
102
- }
103
- if (value instanceof Date) {
104
- value = value.toISOString();
105
- }
106
- return result.replace(match, value == null ? "" : value);
107
- }, str);
108
- }, "templateFn");
109
- }
110
- return Template(templateFn, parameters);
111
- };
112
- })();
113
- function parseObject(object) {
114
- const children = Object.keys(object).map((key) => ({
115
- keyTemplate: parseString(key),
116
- valueTemplate: parse(object[key])
117
- }));
118
- const templateParameters = children.reduce(
119
- (parameters, child) => parameters.concat(child.valueTemplate.parameters, child.keyTemplate.parameters),
120
- []
121
- );
122
- const templateFn = /* @__PURE__ */ __name((context) => {
123
- return children.reduce((newObject, child) => {
124
- newObject[child.keyTemplate(context)] = child.valueTemplate(context);
125
- return newObject;
126
- }, {});
127
- }, "templateFn");
128
- return Template(templateFn, templateParameters);
129
- }
130
- __name(parseObject, "parseObject");
131
- function parseArray(array) {
132
- const templates = array.map(parse);
133
- const templateParameters = templates.reduce((parameters, template) => parameters.concat(template.parameters), []);
134
- const templateFn = /* @__PURE__ */ __name((context) => templates.map((template) => template(context)), "templateFn");
135
- return Template(templateFn, templateParameters);
136
- }
137
- __name(parseArray, "parseArray");
138
- // Annotate the CommonJS export names for ESM import in node:
139
- 0 && (module.exports = {
140
- parse
141
- });
@@ -1,15 +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 originalMulter from 'multer';
10
- declare function multer(options?: any): any;
11
- declare namespace multer {
12
- var diskStorage: typeof originalMulter.diskStorage;
13
- var memoryStorage: typeof originalMulter.memoryStorage;
14
- }
15
- export { multer as koaMulter };
package/lib/koa-multer.js DELETED
@@ -1,94 +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 __name = (target, value) => __defProp(target, "name", { value, configurable: true });
17
- var __export = (target, all) => {
18
- for (var name in all)
19
- __defProp(target, name, { get: all[name], enumerable: true });
20
- };
21
- var __copyProps = (to, from, except, desc) => {
22
- if (from && typeof from === "object" || typeof from === "function") {
23
- for (let key of __getOwnPropNames(from))
24
- if (!__hasOwnProp.call(to, key) && key !== except)
25
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
26
- }
27
- return to;
28
- };
29
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
30
- // If the importer is in node compatibility mode or this is not an ESM
31
- // file that has been converted to a CommonJS file using a Babel-
32
- // compatible transform (i.e. "__esModule" has not been set), then set
33
- // "default" to the CommonJS "module.exports" for node compatibility.
34
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
- mod
36
- ));
37
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
- var koa_multer_exports = {};
39
- __export(koa_multer_exports, {
40
- koaMulter: () => multer
41
- });
42
- module.exports = __toCommonJS(koa_multer_exports);
43
- var import_multer = __toESM(require("multer"));
44
- function multer(options) {
45
- const m = (0, import_multer.default)(options);
46
- makePromise(m, "any");
47
- makePromise(m, "array");
48
- makePromise(m, "fields");
49
- makePromise(m, "none");
50
- makePromise(m, "single");
51
- return m;
52
- }
53
- __name(multer, "multer");
54
- function makePromise(multer2, name) {
55
- if (!multer2[name])
56
- return;
57
- const fn = multer2[name];
58
- multer2[name] = function(...args) {
59
- const middleware = Reflect.apply(fn, this, args);
60
- return async (ctx, next) => {
61
- await new Promise((resolve, reject) => {
62
- middleware(ctx.req, ctx.res, (err) => {
63
- if (err)
64
- return reject(err);
65
- if ("request" in ctx) {
66
- if (ctx.req.body) {
67
- ctx.request.body = ctx.req.body;
68
- delete ctx.req.body;
69
- }
70
- if (ctx.req.file) {
71
- ctx.request.file = ctx.req.file;
72
- ctx.file = ctx.req.file;
73
- delete ctx.req.file;
74
- }
75
- if (ctx.req.files) {
76
- ctx.request.files = ctx.req.files;
77
- ctx.files = ctx.req.files;
78
- delete ctx.req.files;
79
- }
80
- }
81
- resolve(ctx);
82
- });
83
- });
84
- return next();
85
- };
86
- };
87
- }
88
- __name(makePromise, "makePromise");
89
- multer.diskStorage = import_multer.default.diskStorage;
90
- multer.memoryStorage = import_multer.default.memoryStorage;
91
- // Annotate the CommonJS export names for ESM import in node:
92
- 0 && (module.exports = {
93
- koaMulter
94
- });
package/lib/log.d.ts DELETED
@@ -1,9 +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 declare const error: (message: Error | string, ...args: any[]) => void;
package/lib/log.js DELETED
@@ -1,39 +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 __name = (target, value) => __defProp(target, "name", { value, configurable: true });
15
- var __export = (target, all) => {
16
- for (var name in all)
17
- __defProp(target, name, { get: all[name], enumerable: true });
18
- };
19
- var __copyProps = (to, from, except, desc) => {
20
- if (from && typeof from === "object" || typeof from === "function") {
21
- for (let key of __getOwnPropNames(from))
22
- if (!__hasOwnProp.call(to, key) && key !== except)
23
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
24
- }
25
- return to;
26
- };
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var log_exports = {};
29
- __export(log_exports, {
30
- error: () => error
31
- });
32
- module.exports = __toCommonJS(log_exports);
33
- const error = /* @__PURE__ */ __name((message, ...args) => {
34
- console.error(message, ...args);
35
- }, "error");
36
- // Annotate the CommonJS export names for ESM import in node:
37
- 0 && (module.exports = {
38
- error
39
- });
@@ -1,9 +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 declare function measureExecutionTime(operation: any, operationName: any): Promise<void>;
@@ -1,44 +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 __name = (target, value) => __defProp(target, "name", { value, configurable: true });
15
- var __export = (target, all) => {
16
- for (var name in all)
17
- __defProp(target, name, { get: all[name], enumerable: true });
18
- };
19
- var __copyProps = (to, from, except, desc) => {
20
- if (from && typeof from === "object" || typeof from === "function") {
21
- for (let key of __getOwnPropNames(from))
22
- if (!__hasOwnProp.call(to, key) && key !== except)
23
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
24
- }
25
- return to;
26
- };
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var measure_execution_time_exports = {};
29
- __export(measure_execution_time_exports, {
30
- measureExecutionTime: () => measureExecutionTime
31
- });
32
- module.exports = __toCommonJS(measure_execution_time_exports);
33
- async function measureExecutionTime(operation, operationName) {
34
- const startTime = Date.now();
35
- await operation();
36
- const endTime = Date.now();
37
- const duration = (endTime - startTime).toFixed(0);
38
- console.log(`${operationName} completed in ${duration} milliseconds`);
39
- }
40
- __name(measureExecutionTime, "measureExecutionTime");
41
- // Annotate the CommonJS export names for ESM import in node:
42
- 0 && (module.exports = {
43
- measureExecutionTime
44
- });
package/lib/merge.d.ts DELETED
@@ -1,9 +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 declare function merge(obj1: any, obj2: any, opts?: any): unknown;
package/lib/merge.js DELETED
@@ -1,55 +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 __name = (target, value) => __defProp(target, "name", { value, configurable: true });
17
- var __export = (target, all) => {
18
- for (var name in all)
19
- __defProp(target, name, { get: all[name], enumerable: true });
20
- };
21
- var __copyProps = (to, from, except, desc) => {
22
- if (from && typeof from === "object" || typeof from === "function") {
23
- for (let key of __getOwnPropNames(from))
24
- if (!__hasOwnProp.call(to, key) && key !== except)
25
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
26
- }
27
- return to;
28
- };
29
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
30
- // If the importer is in node compatibility mode or this is not an ESM
31
- // file that has been converted to a CommonJS file using a Babel-
32
- // compatible transform (i.e. "__esModule" has not been set), then set
33
- // "default" to the CommonJS "module.exports" for node compatibility.
34
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
- mod
36
- ));
37
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
- var merge_exports = {};
39
- __export(merge_exports, {
40
- merge: () => merge
41
- });
42
- module.exports = __toCommonJS(merge_exports);
43
- var import_deepmerge = __toESM(require("deepmerge"));
44
- const overwriteMerge = /* @__PURE__ */ __name((destinationArray, sourceArray, options) => sourceArray, "overwriteMerge");
45
- function merge(obj1, obj2, opts) {
46
- return (0, import_deepmerge.default)(obj1, obj2, {
47
- arrayMerge: overwriteMerge,
48
- ...opts
49
- });
50
- }
51
- __name(merge, "merge");
52
- // Annotate the CommonJS export names for ESM import in node:
53
- 0 && (module.exports = {
54
- merge
55
- });
@@ -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 declare class AsyncEmitter {
10
- emitAsync(event: string | symbol, ...args: any[]): Promise<boolean>;
11
- }
@@ -1,80 +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 __name = (target, value) => __defProp(target, "name", { value, configurable: true });
15
- var __export = (target, all) => {
16
- for (var name in all)
17
- __defProp(target, name, { get: all[name], enumerable: true });
18
- };
19
- var __copyProps = (to, from, except, desc) => {
20
- if (from && typeof from === "object" || typeof from === "function") {
21
- for (let key of __getOwnPropNames(from))
22
- if (!__hasOwnProp.call(to, key) && key !== except)
23
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
24
- }
25
- return to;
26
- };
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var AsyncEmitter_exports = {};
29
- __export(AsyncEmitter_exports, {
30
- AsyncEmitter: () => AsyncEmitter
31
- });
32
- module.exports = __toCommonJS(AsyncEmitter_exports);
33
- const _AsyncEmitter = class _AsyncEmitter {
34
- async emitAsync(event, ...args) {
35
- const events = this._events;
36
- let callbacks = events[event];
37
- if (!callbacks) {
38
- return false;
39
- }
40
- const run = /* @__PURE__ */ __name((cb) => {
41
- switch (args.length) {
42
- case 0:
43
- cb = cb.call(this);
44
- break;
45
- case 1:
46
- cb = cb.call(this, args[0]);
47
- break;
48
- case 2:
49
- cb = cb.call(this, args[0], args[1]);
50
- break;
51
- case 3:
52
- cb = cb.call(this, args[0], args[1], args[2]);
53
- break;
54
- default:
55
- cb = cb.apply(this, args);
56
- }
57
- if (cb && (cb instanceof Promise || typeof cb.then === "function")) {
58
- return cb;
59
- }
60
- return Promise.resolve(true);
61
- }, "run");
62
- if (typeof callbacks === "function") {
63
- await run(callbacks);
64
- } else if (typeof callbacks === "object") {
65
- callbacks = callbacks.slice().filter(Boolean);
66
- await callbacks.reduce((prev, next) => {
67
- return prev.then((res) => {
68
- return run(next).then((result) => Promise.resolve(res.concat(result)));
69
- });
70
- }, Promise.resolve([]));
71
- }
72
- return true;
73
- }
74
- };
75
- __name(_AsyncEmitter, "AsyncEmitter");
76
- let AsyncEmitter = _AsyncEmitter;
77
- // Annotate the CommonJS export names for ESM import in node:
78
- 0 && (module.exports = {
79
- AsyncEmitter
80
- });
@@ -1,9 +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 declare function applyMixins(derivedCtor: any, constructors: any[]): void;