@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.
- package/package.json +2 -2
- package/lib/assign.d.ts +0 -17
- package/lib/assign.js +0 -143
- package/lib/client.d.ts +0 -29
- package/lib/client.js +0 -86
- package/lib/collections-graph.d.ts +0 -24
- package/lib/collections-graph.js +0 -108
- package/lib/common.d.ts +0 -14
- package/lib/common.js +0 -87
- package/lib/date.d.ts +0 -37
- package/lib/date.js +0 -189
- package/lib/dayjs.d.ts +0 -10
- package/lib/dayjs.js +0 -72
- package/lib/forEach.d.ts +0 -9
- package/lib/forEach.js +0 -45
- package/lib/fs-exists.d.ts +0 -9
- package/lib/fs-exists.js +0 -46
- package/lib/getValuesByPath.d.ts +0 -9
- package/lib/getValuesByPath.js +0 -71
- package/lib/i18n.d.ts +0 -10
- package/lib/i18n.js +0 -43
- package/lib/index.d.ts +0 -35
- package/lib/index.js +0 -98
- package/lib/isPortalInBody.d.ts +0 -13
- package/lib/isPortalInBody.js +0 -54
- package/lib/isValidFilter.d.ts +0 -9
- package/lib/isValidFilter.js +0 -63
- package/lib/json-templates.d.ts +0 -9
- package/lib/json-templates.js +0 -141
- package/lib/koa-multer.d.ts +0 -15
- package/lib/koa-multer.js +0 -94
- package/lib/log.d.ts +0 -9
- package/lib/log.js +0 -39
- package/lib/measure-execution-time.d.ts +0 -9
- package/lib/measure-execution-time.js +0 -44
- package/lib/merge.d.ts +0 -9
- package/lib/merge.js +0 -55
- package/lib/mixin/AsyncEmitter.d.ts +0 -11
- package/lib/mixin/AsyncEmitter.js +0 -80
- package/lib/mixin/index.d.ts +0 -9
- package/lib/mixin/index.js +0 -48
- package/lib/notification.d.ts +0 -9
- package/lib/notification.js +0 -43
- package/lib/number.d.ts +0 -9
- package/lib/number.js +0 -45
- package/lib/parse-date.d.ts +0 -15
- package/lib/parse-date.js +0 -262
- package/lib/parse-filter.d.ts +0 -159
- package/lib/parse-filter.js +0 -317
- package/lib/parseHTML.d.ts +0 -15
- package/lib/parseHTML.js +0 -42
- package/lib/perf-hooks.d.ts +0 -14
- package/lib/perf-hooks.js +0 -69
- package/lib/registry.d.ts +0 -22
- package/lib/registry.js +0 -69
- package/lib/requireModule.d.ts +0 -12
- package/lib/requireModule.js +0 -90
- package/lib/server.d.ts +0 -19
- package/lib/server.js +0 -50
- package/lib/toposort.d.ts +0 -18
- package/lib/toposort.js +0 -83
- package/lib/uid.d.ts +0 -9
- package/lib/uid.js +0 -46
- package/lib/url.d.ts +0 -9
- package/lib/url.js +0 -46
package/lib/mixin/index.js
DELETED
|
@@ -1,48 +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 mixin_exports = {};
|
|
29
|
-
__export(mixin_exports, {
|
|
30
|
-
applyMixins: () => applyMixins
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(mixin_exports);
|
|
33
|
-
function applyMixins(derivedCtor, constructors) {
|
|
34
|
-
constructors.forEach((baseCtor) => {
|
|
35
|
-
Object.getOwnPropertyNames(baseCtor.prototype).forEach((name) => {
|
|
36
|
-
Object.defineProperty(
|
|
37
|
-
derivedCtor.prototype,
|
|
38
|
-
name,
|
|
39
|
-
Object.getOwnPropertyDescriptor(baseCtor.prototype, name) || /* @__PURE__ */ Object.create(null)
|
|
40
|
-
);
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
__name(applyMixins, "applyMixins");
|
|
45
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
-
0 && (module.exports = {
|
|
47
|
-
applyMixins
|
|
48
|
-
});
|
package/lib/notification.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 showToast: (message: any, type?: string, duration?: number) => void;
|
package/lib/notification.js
DELETED
|
@@ -1,43 +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 notification_exports = {};
|
|
29
|
-
__export(notification_exports, {
|
|
30
|
-
showToast: () => showToast
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(notification_exports);
|
|
33
|
-
var import_antd = require("antd");
|
|
34
|
-
const showToast = /* @__PURE__ */ __name((message, type = "info", duration = 5e3) => {
|
|
35
|
-
import_antd.notification[type]({
|
|
36
|
-
message,
|
|
37
|
-
duration
|
|
38
|
-
});
|
|
39
|
-
}, "showToast");
|
|
40
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
-
0 && (module.exports = {
|
|
42
|
-
showToast
|
|
43
|
-
});
|
package/lib/number.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 toFixedByStep(value: any, step: string | number): any;
|
package/lib/number.js
DELETED
|
@@ -1,45 +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 number_exports = {};
|
|
29
|
-
__export(number_exports, {
|
|
30
|
-
toFixedByStep: () => toFixedByStep
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(number_exports);
|
|
33
|
-
var import_mini_decimal = require("@rc-component/mini-decimal");
|
|
34
|
-
function toFixedByStep(value, step) {
|
|
35
|
-
if (typeof value === "undefined" || value === null || value === "") {
|
|
36
|
-
return "";
|
|
37
|
-
}
|
|
38
|
-
const precision = (0, import_mini_decimal.getNumberPrecision)(step);
|
|
39
|
-
return (0, import_mini_decimal.toFixed)(String(value), ".", precision);
|
|
40
|
-
}
|
|
41
|
-
__name(toFixedByStep, "toFixedByStep");
|
|
42
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
-
0 && (module.exports = {
|
|
44
|
-
toFixedByStep
|
|
45
|
-
});
|
package/lib/parse-date.d.ts
DELETED
|
@@ -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
|
-
export declare function parseWeek(value: any): {
|
|
10
|
-
unit: string;
|
|
11
|
-
start: string;
|
|
12
|
-
};
|
|
13
|
-
export declare function parseDate(value: any, options?: {
|
|
14
|
-
timezone?: string;
|
|
15
|
-
}): string | any[];
|
package/lib/parse-date.js
DELETED
|
@@ -1,262 +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 parse_date_exports = {};
|
|
29
|
-
__export(parse_date_exports, {
|
|
30
|
-
parseDate: () => parseDate,
|
|
31
|
-
parseWeek: () => parseWeek
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(parse_date_exports);
|
|
34
|
-
var import_date = require("./date");
|
|
35
|
-
var import_dayjs = require("./dayjs");
|
|
36
|
-
function parseUTC(value) {
|
|
37
|
-
if (value instanceof Date || import_dayjs.dayjs.isDayjs(value)) {
|
|
38
|
-
return {
|
|
39
|
-
unit: "utc",
|
|
40
|
-
start: value.toISOString()
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
if (value.endsWith("Z")) {
|
|
44
|
-
return {
|
|
45
|
-
unit: "utc",
|
|
46
|
-
start: value
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
__name(parseUTC, "parseUTC");
|
|
51
|
-
function parseYear(value) {
|
|
52
|
-
if (/^\d\d\d\d$/.test(value)) {
|
|
53
|
-
return {
|
|
54
|
-
unit: "year",
|
|
55
|
-
start: `${value}-01-01 00:00:00`
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
__name(parseYear, "parseYear");
|
|
60
|
-
function parseQuarter(value) {
|
|
61
|
-
if (/^\d\d\d\dQ\d$/.test(value)) {
|
|
62
|
-
const [year, q] = value.split("Q");
|
|
63
|
-
return {
|
|
64
|
-
unit: "quarter",
|
|
65
|
-
start: (0, import_dayjs.dayjs)(year, "YYYY").quarter(q).format("YYYY-MM-DD HH:mm:ss")
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
__name(parseQuarter, "parseQuarter");
|
|
70
|
-
function parseWeek(value) {
|
|
71
|
-
if (/^\d\d\d\d[W]\d\d$/.test(value)) {
|
|
72
|
-
const arr = value.split("W");
|
|
73
|
-
const year = (0, import_dayjs.dayjs)(arr[0], "YYYY").format("GGGG");
|
|
74
|
-
if (year !== arr[0]) {
|
|
75
|
-
return {
|
|
76
|
-
unit: "isoWeek",
|
|
77
|
-
start: (0, import_dayjs.dayjs)(arr[0], "YYYY").add(1, "week").startOf("isoWeek").isoWeek(Number(arr[1])).format("YYYY-MM-DD HH:mm:ss")
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
return {
|
|
81
|
-
unit: "isoWeek",
|
|
82
|
-
start: (0, import_dayjs.dayjs)(arr[0], "YYYY").isoWeek(Number(arr[1])).format("YYYY-MM-DD HH:mm:ss")
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
if (/^\d\d\d\d[w]\d\d$/.test(value)) {
|
|
86
|
-
const arr = value.split("w");
|
|
87
|
-
const year = (0, import_dayjs.dayjs)(arr[0], "YYYY").format("gggg");
|
|
88
|
-
if (year !== arr[0]) {
|
|
89
|
-
return {
|
|
90
|
-
unit: "week",
|
|
91
|
-
start: (0, import_dayjs.dayjs)(arr[0], "YYYY").add(1, "week").startOf("week").week(Number(arr[1])).format("YYYY-MM-DD HH:mm:ss")
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
return {
|
|
95
|
-
unit: "week",
|
|
96
|
-
start: (0, import_dayjs.dayjs)(arr[0], "YYYY").week(Number(arr[1])).format("YYYY-MM-DD HH:mm:ss")
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
__name(parseWeek, "parseWeek");
|
|
101
|
-
function parseMonth(value) {
|
|
102
|
-
if (/^\d\d\d\d\-\d\d$/.test(value)) {
|
|
103
|
-
return {
|
|
104
|
-
unit: "month",
|
|
105
|
-
start: `${value}-01 00:00:00`
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
__name(parseMonth, "parseMonth");
|
|
110
|
-
function parseDay(value) {
|
|
111
|
-
if (/^\d\d\d\d\-\d\d\-\d\d$/.test(value)) {
|
|
112
|
-
return {
|
|
113
|
-
unit: "day",
|
|
114
|
-
start: `${value} 00:00:00`
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
__name(parseDay, "parseDay");
|
|
119
|
-
function parseHour(value) {
|
|
120
|
-
if (/^\d\d\d\d\-\d\d\-\d\d(\T|\s)\d\d$/.test(value)) {
|
|
121
|
-
return {
|
|
122
|
-
unit: "hour",
|
|
123
|
-
start: `${value}:00:00`
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
__name(parseHour, "parseHour");
|
|
128
|
-
function parseMinute(value) {
|
|
129
|
-
if (/^\d\d\d\d\-\d\d\-\d\d(\T|\s)\d\d\:\d\d$/.test(value)) {
|
|
130
|
-
return {
|
|
131
|
-
unit: "minute",
|
|
132
|
-
start: `${value}:00`
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
__name(parseMinute, "parseMinute");
|
|
137
|
-
function parseSecond(value) {
|
|
138
|
-
if (/^\d\d\d\d\-\d\d\-\d\d(\T|\s)\d\d\:\d\d\:\d\d$/.test(value)) {
|
|
139
|
-
return {
|
|
140
|
-
unit: "second",
|
|
141
|
-
start: `${value}`
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
__name(parseSecond, "parseSecond");
|
|
146
|
-
function parseMillisecond(value) {
|
|
147
|
-
if (/^\d\d\d\d\-\d\d\-\d\d(\T|\s)\d\d\:\d\d\:\d\d\.\d\d\d$/.test(value)) {
|
|
148
|
-
return {
|
|
149
|
-
unit: "millisecond",
|
|
150
|
-
start: `${value}`
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
__name(parseMillisecond, "parseMillisecond");
|
|
155
|
-
const parsers = [
|
|
156
|
-
parseUTC,
|
|
157
|
-
parseYear,
|
|
158
|
-
parseQuarter,
|
|
159
|
-
parseWeek,
|
|
160
|
-
parseMonth,
|
|
161
|
-
parseDay,
|
|
162
|
-
parseHour,
|
|
163
|
-
parseMinute,
|
|
164
|
-
parseSecond,
|
|
165
|
-
parseMillisecond
|
|
166
|
-
];
|
|
167
|
-
function toISOString(m) {
|
|
168
|
-
return m.toISOString();
|
|
169
|
-
}
|
|
170
|
-
__name(toISOString, "toISOString");
|
|
171
|
-
function dateRange(r) {
|
|
172
|
-
if (!r.timezone) {
|
|
173
|
-
r.timezone = "+00:00";
|
|
174
|
-
}
|
|
175
|
-
let m;
|
|
176
|
-
if (r.unit === "utc") {
|
|
177
|
-
return (0, import_dayjs.dayjs)(r == null ? void 0 : r.start).toISOString();
|
|
178
|
-
} else {
|
|
179
|
-
m = (0, import_dayjs.dayjs)(`${r == null ? void 0 : r.start}${r == null ? void 0 : r.timezone}`);
|
|
180
|
-
}
|
|
181
|
-
m = m.utcOffset((0, import_date.offsetFromString)(r.timezone));
|
|
182
|
-
return [m = m.startOf(r.unit), m.add(1, r.unit === "isoWeek" ? "weeks" : r.unit).startOf(r.unit)].map(toISOString);
|
|
183
|
-
}
|
|
184
|
-
__name(dateRange, "dateRange");
|
|
185
|
-
function parseDate(value, options = {}) {
|
|
186
|
-
if (!value) {
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
if (Array.isArray(value)) {
|
|
190
|
-
return parseDateBetween(value, options);
|
|
191
|
-
}
|
|
192
|
-
let timezone = options.timezone || "+00:00";
|
|
193
|
-
const input = value;
|
|
194
|
-
if (typeof value === "string") {
|
|
195
|
-
const match = /(.+)((\+|\-)\d\d\:\d\d)$/.exec(value);
|
|
196
|
-
if (match) {
|
|
197
|
-
value = match[1];
|
|
198
|
-
timezone = match[2];
|
|
199
|
-
}
|
|
200
|
-
if (/^(\(|\[)/.test(value)) {
|
|
201
|
-
return parseDateBetween(input, options);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
for (const parse of parsers) {
|
|
205
|
-
const r = parse(value);
|
|
206
|
-
if (r) {
|
|
207
|
-
r["input"] = input;
|
|
208
|
-
if (!r["timezone"]) {
|
|
209
|
-
r["timezone"] = timezone;
|
|
210
|
-
}
|
|
211
|
-
return dateRange(r);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
__name(parseDate, "parseDate");
|
|
216
|
-
function parseDateBetween(value, options = {}) {
|
|
217
|
-
if (Array.isArray(value) && value.length > 1) {
|
|
218
|
-
const [startValue, endValue, op = "[]", timezone2] = value;
|
|
219
|
-
const r0 = parseDate(startValue, { timezone: timezone2 });
|
|
220
|
-
const r1 = parseDate(endValue, { timezone: timezone2 });
|
|
221
|
-
let start;
|
|
222
|
-
let startOp;
|
|
223
|
-
let end;
|
|
224
|
-
let endOp;
|
|
225
|
-
if (typeof r0 === "string") {
|
|
226
|
-
start = r0;
|
|
227
|
-
startOp = op[0];
|
|
228
|
-
} else {
|
|
229
|
-
start = op.startsWith("(") ? r0[1] : r0[0];
|
|
230
|
-
startOp = "[";
|
|
231
|
-
}
|
|
232
|
-
if (typeof r1 === "string") {
|
|
233
|
-
end = r1;
|
|
234
|
-
endOp = op[1];
|
|
235
|
-
} else {
|
|
236
|
-
end = op.endsWith(")") ? r1[0] : r1[1];
|
|
237
|
-
endOp = ")";
|
|
238
|
-
}
|
|
239
|
-
const newOp = startOp + endOp;
|
|
240
|
-
return newOp === "[)" ? [start, end] : [start, end, newOp];
|
|
241
|
-
}
|
|
242
|
-
if (typeof value !== "string") {
|
|
243
|
-
return;
|
|
244
|
-
}
|
|
245
|
-
const match = /(.+)((\+|\-)\d\d\:\d\d)$/.exec(value);
|
|
246
|
-
let timezone = options.timezone || "+00:00";
|
|
247
|
-
if (match) {
|
|
248
|
-
value = match[1];
|
|
249
|
-
timezone = match[2];
|
|
250
|
-
}
|
|
251
|
-
const m = /^(\(|\[)(.+)\,(.+)(\)|\])$/.exec(value);
|
|
252
|
-
if (!m) {
|
|
253
|
-
return;
|
|
254
|
-
}
|
|
255
|
-
return parseDateBetween([m[2], m[3], `${m[1]}${m[4]}`, timezone]);
|
|
256
|
-
}
|
|
257
|
-
__name(parseDateBetween, "parseDateBetween");
|
|
258
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
259
|
-
0 && (module.exports = {
|
|
260
|
-
parseDate,
|
|
261
|
-
parseWeek
|
|
262
|
-
});
|
package/lib/parse-filter.d.ts
DELETED
|
@@ -1,159 +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 flatten(target: any, opts?: any): {};
|
|
10
|
-
export declare function unflatten(obj: any, opts?: any): {};
|
|
11
|
-
export type ParseFilterOptions = {
|
|
12
|
-
vars?: Record<string, any>;
|
|
13
|
-
now?: any;
|
|
14
|
-
timezone?: string;
|
|
15
|
-
getField?: any;
|
|
16
|
-
};
|
|
17
|
-
export declare const parseFilter: (filter: any, opts?: ParseFilterOptions) => Promise<{}>;
|
|
18
|
-
export type GetDayRangeOptions = {
|
|
19
|
-
now?: any;
|
|
20
|
-
timezone?: string | number;
|
|
21
|
-
offset: number;
|
|
22
|
-
};
|
|
23
|
-
export declare function getDayRange(options: GetDayRangeOptions): (string | number)[];
|
|
24
|
-
export type Utc2unitOptions = {
|
|
25
|
-
now?: any;
|
|
26
|
-
unit: any;
|
|
27
|
-
timezone?: string | number;
|
|
28
|
-
offset?: number;
|
|
29
|
-
};
|
|
30
|
-
export declare function utc2unit(options: Utc2unitOptions): any;
|
|
31
|
-
export declare const toUnit: (unit: any, offset?: number) => ({ now, timezone, field }: {
|
|
32
|
-
now: any;
|
|
33
|
-
timezone: any;
|
|
34
|
-
field: any;
|
|
35
|
-
}) => any;
|
|
36
|
-
export declare function getDateVars(): {
|
|
37
|
-
now: string;
|
|
38
|
-
today: ({ now, timezone, field }: {
|
|
39
|
-
now: any;
|
|
40
|
-
timezone: any;
|
|
41
|
-
field: any;
|
|
42
|
-
}) => any;
|
|
43
|
-
yesterday: ({ now, timezone, field }: {
|
|
44
|
-
now: any;
|
|
45
|
-
timezone: any;
|
|
46
|
-
field: any;
|
|
47
|
-
}) => any;
|
|
48
|
-
tomorrow: ({ now, timezone, field }: {
|
|
49
|
-
now: any;
|
|
50
|
-
timezone: any;
|
|
51
|
-
field: any;
|
|
52
|
-
}) => any;
|
|
53
|
-
thisWeek: ({ now, timezone, field }: {
|
|
54
|
-
now: any;
|
|
55
|
-
timezone: any;
|
|
56
|
-
field: any;
|
|
57
|
-
}) => any;
|
|
58
|
-
lastWeek: ({ now, timezone, field }: {
|
|
59
|
-
now: any;
|
|
60
|
-
timezone: any;
|
|
61
|
-
field: any;
|
|
62
|
-
}) => any;
|
|
63
|
-
nextWeek: ({ now, timezone, field }: {
|
|
64
|
-
now: any;
|
|
65
|
-
timezone: any;
|
|
66
|
-
field: any;
|
|
67
|
-
}) => any;
|
|
68
|
-
thisIsoWeek: ({ now, timezone, field }: {
|
|
69
|
-
now: any;
|
|
70
|
-
timezone: any;
|
|
71
|
-
field: any;
|
|
72
|
-
}) => any;
|
|
73
|
-
lastIsoWeek: ({ now, timezone, field }: {
|
|
74
|
-
now: any;
|
|
75
|
-
timezone: any;
|
|
76
|
-
field: any;
|
|
77
|
-
}) => any;
|
|
78
|
-
nextIsoWeek: ({ now, timezone, field }: {
|
|
79
|
-
now: any;
|
|
80
|
-
timezone: any;
|
|
81
|
-
field: any;
|
|
82
|
-
}) => any;
|
|
83
|
-
thisMonth: ({ now, timezone, field }: {
|
|
84
|
-
now: any;
|
|
85
|
-
timezone: any;
|
|
86
|
-
field: any;
|
|
87
|
-
}) => any;
|
|
88
|
-
lastMonth: ({ now, timezone, field }: {
|
|
89
|
-
now: any;
|
|
90
|
-
timezone: any;
|
|
91
|
-
field: any;
|
|
92
|
-
}) => any;
|
|
93
|
-
nextMonth: ({ now, timezone, field }: {
|
|
94
|
-
now: any;
|
|
95
|
-
timezone: any;
|
|
96
|
-
field: any;
|
|
97
|
-
}) => any;
|
|
98
|
-
thisQuarter: ({ now, timezone, field }: {
|
|
99
|
-
now: any;
|
|
100
|
-
timezone: any;
|
|
101
|
-
field: any;
|
|
102
|
-
}) => any;
|
|
103
|
-
lastQuarter: ({ now, timezone, field }: {
|
|
104
|
-
now: any;
|
|
105
|
-
timezone: any;
|
|
106
|
-
field: any;
|
|
107
|
-
}) => any;
|
|
108
|
-
nextQuarter: ({ now, timezone, field }: {
|
|
109
|
-
now: any;
|
|
110
|
-
timezone: any;
|
|
111
|
-
field: any;
|
|
112
|
-
}) => any;
|
|
113
|
-
thisYear: ({ now, timezone, field }: {
|
|
114
|
-
now: any;
|
|
115
|
-
timezone: any;
|
|
116
|
-
field: any;
|
|
117
|
-
}) => any;
|
|
118
|
-
lastYear: ({ now, timezone, field }: {
|
|
119
|
-
now: any;
|
|
120
|
-
timezone: any;
|
|
121
|
-
field: any;
|
|
122
|
-
}) => any;
|
|
123
|
-
nextYear: ({ now, timezone, field }: {
|
|
124
|
-
now: any;
|
|
125
|
-
timezone: any;
|
|
126
|
-
field: any;
|
|
127
|
-
}) => any;
|
|
128
|
-
last7Days: ({ now, timezone, field }: {
|
|
129
|
-
now: any;
|
|
130
|
-
timezone: any;
|
|
131
|
-
field: any;
|
|
132
|
-
}) => (string | number)[];
|
|
133
|
-
next7Days: ({ now, timezone, field }: {
|
|
134
|
-
now: any;
|
|
135
|
-
timezone: any;
|
|
136
|
-
field: any;
|
|
137
|
-
}) => (string | number)[];
|
|
138
|
-
last30Days: ({ now, timezone, field }: {
|
|
139
|
-
now: any;
|
|
140
|
-
timezone: any;
|
|
141
|
-
field: any;
|
|
142
|
-
}) => (string | number)[];
|
|
143
|
-
next30Days: ({ now, timezone, field }: {
|
|
144
|
-
now: any;
|
|
145
|
-
timezone: any;
|
|
146
|
-
field: any;
|
|
147
|
-
}) => (string | number)[];
|
|
148
|
-
last90Days: ({ now, timezone, field }: {
|
|
149
|
-
now: any;
|
|
150
|
-
timezone: any;
|
|
151
|
-
field: any;
|
|
152
|
-
}) => (string | number)[];
|
|
153
|
-
next90Days: ({ now, timezone, field }: {
|
|
154
|
-
now: any;
|
|
155
|
-
timezone: any;
|
|
156
|
-
field: any;
|
|
157
|
-
}) => (string | number)[];
|
|
158
|
-
};
|
|
159
|
-
export declare function splitPathToTwoParts(path: string): string[];
|