@nocobase/plugin-data-visualization 2.1.0-alpha.13 → 2.1.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/flow/models/ChartBlockModel.d.ts +1 -0
- package/dist/client/flow/models/ChartOptionsBuilder.d.ts +4 -0
- package/dist/client/flow/models/QueryBuilder.d.ts +1 -4
- package/dist/client/flow/resources/ChartResource.d.ts +1 -0
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +12 -11
- package/dist/node_modules/koa-compose/package.json +1 -1
- package/dist/server/actions/query.d.ts +2 -4
- package/dist/server/actions/query.js +47 -210
- package/dist/server/plugin.js +2 -2
- package/dist/server/types.d.ts +3 -0
- package/package.json +4 -2
- package/dist/client/flow/components/AntdFilterSelector.d.ts +0 -35
- package/dist/node_modules/moment-timezone/LICENSE +0 -20
- package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-10-year-range.js +0 -1548
- package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-10-year-range.min.js +0 -1
- package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-1970-2030.js +0 -1548
- package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-1970-2030.min.js +0 -1
- package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-2012-2022.js +0 -1560
- package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-2012-2022.min.js +0 -1
- package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data.js +0 -1548
- package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data.min.js +0 -1
- package/dist/node_modules/moment-timezone/builds/moment-timezone.min.js +0 -1
- package/dist/node_modules/moment-timezone/composer.json +0 -43
- package/dist/node_modules/moment-timezone/data/meta/latest.json +0 -5889
- package/dist/node_modules/moment-timezone/data/packed/latest.json +0 -852
- package/dist/node_modules/moment-timezone/index.d.ts +0 -78
- package/dist/node_modules/moment-timezone/index.js +0 -15
- package/dist/node_modules/moment-timezone/moment-timezone-utils.d.ts +0 -70
- package/dist/node_modules/moment-timezone/moment-timezone-utils.js +0 -339
- package/dist/node_modules/moment-timezone/moment-timezone.js +0 -696
- package/dist/node_modules/moment-timezone/package.json +0 -1
- package/dist/server/formatter/formatter.d.ts +0 -27
- package/dist/server/formatter/formatter.js +0 -85
- package/dist/server/formatter/mysql-formatter.d.ts +0 -14
- package/dist/server/formatter/mysql-formatter.js +0 -93
- package/dist/server/formatter/oracle-formatter.d.ts +0 -14
- package/dist/server/formatter/oracle-formatter.js +0 -74
- package/dist/server/formatter/postgres-formatter.d.ts +0 -14
- package/dist/server/formatter/postgres-formatter.js +0 -74
- package/dist/server/formatter/sqlite-formatter.d.ts +0 -15
- package/dist/server/formatter/sqlite-formatter.js +0 -83
- package/dist/server/query-parser/index.d.ts +0 -11
- package/dist/server/query-parser/index.js +0 -56
- package/dist/server/query-parser/mysql-query-parser.d.ts +0 -15
- package/dist/server/query-parser/mysql-query-parser.js +0 -43
- package/dist/server/query-parser/oracle-query-parser.d.ts +0 -18
- package/dist/server/query-parser/oracle-query-parser.js +0 -60
- package/dist/server/query-parser/postgres-query-parser.d.ts +0 -15
- package/dist/server/query-parser/postgres-query-parser.js +0 -43
- package/dist/server/query-parser/query-parser.d.ts +0 -31
- package/dist/server/query-parser/query-parser.js +0 -146
- package/dist/server/query-parser/sqlite-query-parser.d.ts +0 -15
- package/dist/server/query-parser/sqlite-query-parser.js +0 -43
|
@@ -1,85 +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 formatter_exports = {};
|
|
38
|
-
__export(formatter_exports, {
|
|
39
|
-
Formatter: () => Formatter
|
|
40
|
-
});
|
|
41
|
-
module.exports = __toCommonJS(formatter_exports);
|
|
42
|
-
var import_moment_timezone = __toESM(require("moment-timezone"));
|
|
43
|
-
class Formatter {
|
|
44
|
-
sequelize;
|
|
45
|
-
constructor(sequelize) {
|
|
46
|
-
this.sequelize = sequelize;
|
|
47
|
-
}
|
|
48
|
-
getTimezoneByOffset(offset) {
|
|
49
|
-
if (!/^[+-]\d{1,2}:\d{2}$/.test(offset)) {
|
|
50
|
-
return offset;
|
|
51
|
-
}
|
|
52
|
-
const offsetMinutes = import_moment_timezone.default.duration(offset).asMinutes();
|
|
53
|
-
return import_moment_timezone.default.tz.names().find((timezone) => {
|
|
54
|
-
return import_moment_timezone.default.tz(timezone).utcOffset() === offsetMinutes;
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
convertFormat(format) {
|
|
58
|
-
return format;
|
|
59
|
-
}
|
|
60
|
-
format(options) {
|
|
61
|
-
var _a, _b;
|
|
62
|
-
const { type, field, format, timezone, options: fieldOptions } = options;
|
|
63
|
-
const col = this.sequelize.col(field);
|
|
64
|
-
switch (type) {
|
|
65
|
-
case "date":
|
|
66
|
-
case "datetime":
|
|
67
|
-
case "datetimeTz":
|
|
68
|
-
return this.formatDate(col, format, timezone);
|
|
69
|
-
case "datetimeNoTz":
|
|
70
|
-
case "dateOnly":
|
|
71
|
-
case "time":
|
|
72
|
-
return this.formatDate(col, format);
|
|
73
|
-
case "unixTimestamp": {
|
|
74
|
-
const accuracy = ((_b = (_a = fieldOptions == null ? void 0 : fieldOptions.uiSchema) == null ? void 0 : _a["x-component-props"]) == null ? void 0 : _b.accuracy) || (fieldOptions == null ? void 0 : fieldOptions.accuracy) || "second";
|
|
75
|
-
return this.formatUnixTimeStamp(field, format, accuracy, timezone);
|
|
76
|
-
}
|
|
77
|
-
default:
|
|
78
|
-
return this.sequelize.col(field);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
83
|
-
0 && (module.exports = {
|
|
84
|
-
Formatter
|
|
85
|
-
});
|
|
@@ -1,14 +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 { Col, Formatter } from './formatter';
|
|
10
|
-
export declare class MySQLFormatter extends Formatter {
|
|
11
|
-
convertFormat(format: string): string;
|
|
12
|
-
formatDate(field: Col, format: string, timezoneOffset?: string): import("sequelize/types/utils").Fn;
|
|
13
|
-
formatUnixTimeStamp(field: string, format: string, accuracy?: 'second' | 'millisecond', timezoneOffset?: string): import("sequelize/types/utils").Fn;
|
|
14
|
-
}
|
|
@@ -1,93 +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 mysql_formatter_exports = {};
|
|
38
|
-
__export(mysql_formatter_exports, {
|
|
39
|
-
MySQLFormatter: () => MySQLFormatter
|
|
40
|
-
});
|
|
41
|
-
module.exports = __toCommonJS(mysql_formatter_exports);
|
|
42
|
-
var import_formatter = require("./formatter");
|
|
43
|
-
var import_moment_timezone = __toESM(require("moment-timezone"));
|
|
44
|
-
class MySQLFormatter extends import_formatter.Formatter {
|
|
45
|
-
convertFormat(format) {
|
|
46
|
-
return format.replace(/YYYY/g, "%Y").replace(/MM/g, "%m").replace(/DD/g, "%d").replace(/hh/g, "%H").replace(/mm/g, "%i").replace(/ss/g, "%S");
|
|
47
|
-
}
|
|
48
|
-
formatDate(field, format, timezoneOffset) {
|
|
49
|
-
const tz = import_moment_timezone.default.tz(process.env.TZ || "UTC").format("Z");
|
|
50
|
-
format = this.convertFormat(format);
|
|
51
|
-
if (timezoneOffset && tz !== timezoneOffset) {
|
|
52
|
-
return this.sequelize.fn("date_format", this.sequelize.fn("convert_tz", field, tz, timezoneOffset), format);
|
|
53
|
-
}
|
|
54
|
-
return this.sequelize.fn("date_format", field, format);
|
|
55
|
-
}
|
|
56
|
-
formatUnixTimeStamp(field, format, accuracy = "second", timezoneOffset) {
|
|
57
|
-
const col = this.sequelize.getQueryInterface().quoteIdentifiers(field);
|
|
58
|
-
const timezone = this.getTimezoneByOffset(timezoneOffset);
|
|
59
|
-
format = this.convertFormat(format);
|
|
60
|
-
if (timezone) {
|
|
61
|
-
if (accuracy === "millisecond") {
|
|
62
|
-
return this.sequelize.fn(
|
|
63
|
-
"date_format",
|
|
64
|
-
this.sequelize.fn(
|
|
65
|
-
"convert_tz",
|
|
66
|
-
this.sequelize.fn("from_unixtime", this.sequelize.literal(`ROUND(${col} / 1000)`)),
|
|
67
|
-
process.env.TZ || "UTC",
|
|
68
|
-
timezone
|
|
69
|
-
),
|
|
70
|
-
format
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
return this.sequelize.fn(
|
|
74
|
-
"date_format",
|
|
75
|
-
this.sequelize.fn(
|
|
76
|
-
"convert_tz",
|
|
77
|
-
this.sequelize.fn("from_unixtime", this.sequelize.col(field)),
|
|
78
|
-
process.env.TZ || "UTC",
|
|
79
|
-
timezone
|
|
80
|
-
),
|
|
81
|
-
format
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
if (accuracy === "millisecond") {
|
|
85
|
-
return this.sequelize.fn("from_unixtime", this.sequelize.literal(`ROUND(${col} / 1000)`), format);
|
|
86
|
-
}
|
|
87
|
-
return this.sequelize.fn("from_unixtime", this.sequelize.col(field), format);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
-
0 && (module.exports = {
|
|
92
|
-
MySQLFormatter
|
|
93
|
-
});
|
|
@@ -1,14 +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 { Col, Formatter } from './formatter';
|
|
10
|
-
export declare class OracleFormatter extends Formatter {
|
|
11
|
-
convertFormat(format: string): string;
|
|
12
|
-
formatDate(field: Col, format: string, timezoneOffset?: string): import("sequelize/types/utils").Fn;
|
|
13
|
-
formatUnixTimeStamp(field: string, format: string, accuracy?: 'second' | 'millisecond', timezoneOffset?: string): import("sequelize/types/utils").Fn;
|
|
14
|
-
}
|
|
@@ -1,74 +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 oracle_formatter_exports = {};
|
|
28
|
-
__export(oracle_formatter_exports, {
|
|
29
|
-
OracleFormatter: () => OracleFormatter
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(oracle_formatter_exports);
|
|
32
|
-
var import_formatter = require("./formatter");
|
|
33
|
-
class OracleFormatter extends import_formatter.Formatter {
|
|
34
|
-
convertFormat(format) {
|
|
35
|
-
return format.replace(/hh/g, "HH24").replace(/mm/g, "MI").replace(/ss/g, "SS");
|
|
36
|
-
}
|
|
37
|
-
formatDate(field, format, timezoneOffset) {
|
|
38
|
-
format = this.convertFormat(format);
|
|
39
|
-
const timezone = this.getTimezoneByOffset(timezoneOffset);
|
|
40
|
-
if (timezone) {
|
|
41
|
-
const col = this.sequelize.getQueryInterface().quoteIdentifiers(field.col);
|
|
42
|
-
const fieldWithTZ = this.sequelize.literal(`(${col} AT TIME ZONE '${timezone}')`);
|
|
43
|
-
return this.sequelize.fn("to_char", fieldWithTZ, format);
|
|
44
|
-
}
|
|
45
|
-
return this.sequelize.fn("to_char", field, format);
|
|
46
|
-
}
|
|
47
|
-
formatUnixTimeStamp(field, format, accuracy = "second", timezoneOffset) {
|
|
48
|
-
format = this.convertFormat(format);
|
|
49
|
-
const col = this.sequelize.getQueryInterface().quoteIdentifiers(field);
|
|
50
|
-
const timezone = this.getTimezoneByOffset(timezoneOffset);
|
|
51
|
-
if (timezone) {
|
|
52
|
-
if (accuracy === "millisecond") {
|
|
53
|
-
return this.sequelize.fn(
|
|
54
|
-
"to_char",
|
|
55
|
-
this.sequelize.literal(`to_timestamp(ROUND(${col} / 1000)) AT TIME ZONE '${timezone}'`),
|
|
56
|
-
format
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
return this.sequelize.fn(
|
|
60
|
-
"to_char",
|
|
61
|
-
this.sequelize.literal(`to_timestamp(${col}) AT TIME ZONE '${timezone}'`),
|
|
62
|
-
format
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
if (accuracy === "millisecond") {
|
|
66
|
-
return this.sequelize.fn("to_char", this.sequelize.literal(`to_timestamp(ROUND(${col} / 1000)`), format);
|
|
67
|
-
}
|
|
68
|
-
return this.sequelize.fn("to_char", this.sequelize.literal(`to_timestamp(${col})`), format);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
72
|
-
0 && (module.exports = {
|
|
73
|
-
OracleFormatter
|
|
74
|
-
});
|
|
@@ -1,14 +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 { Col, Formatter } from './formatter';
|
|
10
|
-
export declare class PostgresFormatter extends Formatter {
|
|
11
|
-
convertFormat(format: string): string;
|
|
12
|
-
formatDate(field: Col, format: string, timezoneOffset?: string): import("sequelize/types/utils").Fn;
|
|
13
|
-
formatUnixTimeStamp(field: string, format: string, accuracy?: 'second' | 'millisecond', timezoneOffset?: string): import("sequelize/types/utils").Fn;
|
|
14
|
-
}
|
|
@@ -1,74 +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 postgres_formatter_exports = {};
|
|
28
|
-
__export(postgres_formatter_exports, {
|
|
29
|
-
PostgresFormatter: () => PostgresFormatter
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(postgres_formatter_exports);
|
|
32
|
-
var import_formatter = require("./formatter");
|
|
33
|
-
class PostgresFormatter extends import_formatter.Formatter {
|
|
34
|
-
convertFormat(format) {
|
|
35
|
-
return format.replace(/hh/g, "HH24").replace(/mm/g, "MI").replace(/ss/g, "SS");
|
|
36
|
-
}
|
|
37
|
-
formatDate(field, format, timezoneOffset) {
|
|
38
|
-
format = this.convertFormat(format);
|
|
39
|
-
const timezone = this.getTimezoneByOffset(timezoneOffset);
|
|
40
|
-
if (timezone) {
|
|
41
|
-
const col = this.sequelize.getQueryInterface().quoteIdentifiers(field.col);
|
|
42
|
-
const fieldWithTZ = this.sequelize.literal(`(${col} AT TIME ZONE '${timezone}')`);
|
|
43
|
-
return this.sequelize.fn("to_char", fieldWithTZ, format);
|
|
44
|
-
}
|
|
45
|
-
return this.sequelize.fn("to_char", field, format);
|
|
46
|
-
}
|
|
47
|
-
formatUnixTimeStamp(field, format, accuracy = "second", timezoneOffset) {
|
|
48
|
-
format = this.convertFormat(format);
|
|
49
|
-
const col = this.sequelize.getQueryInterface().quoteIdentifiers(field);
|
|
50
|
-
const timezone = this.getTimezoneByOffset(timezoneOffset);
|
|
51
|
-
if (timezone) {
|
|
52
|
-
if (accuracy === "millisecond") {
|
|
53
|
-
return this.sequelize.fn(
|
|
54
|
-
"to_char",
|
|
55
|
-
this.sequelize.literal(`to_timestamp(ROUND(${col} / 1000)) AT TIME ZONE '${timezone}'`),
|
|
56
|
-
format
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
return this.sequelize.fn(
|
|
60
|
-
"to_char",
|
|
61
|
-
this.sequelize.literal(`to_timestamp(${col}) AT TIME ZONE '${timezone}'`),
|
|
62
|
-
format
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
|
-
if (accuracy === "millisecond") {
|
|
66
|
-
return this.sequelize.fn("to_char", this.sequelize.literal(`to_timestamp(ROUND(${col} / 1000)`), format);
|
|
67
|
-
}
|
|
68
|
-
return this.sequelize.fn("to_char", this.sequelize.literal(`to_timestamp(${col})`), format);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
72
|
-
0 && (module.exports = {
|
|
73
|
-
PostgresFormatter
|
|
74
|
-
});
|
|
@@ -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 { Col, Formatter } from './formatter';
|
|
10
|
-
export declare class SQLiteFormatter extends Formatter {
|
|
11
|
-
convertFormat(format: string): string;
|
|
12
|
-
getOffsetMinutesFromTimezone(timezone: string): string;
|
|
13
|
-
formatDate(field: Col, format: string, timezone?: string): import("sequelize/types/utils").Fn;
|
|
14
|
-
formatUnixTimeStamp(field: string, format: string, accuracy?: 'second' | 'millisecond', timezone?: string): import("sequelize/types/utils").Fn;
|
|
15
|
-
}
|
|
@@ -1,83 +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 sqlite_formatter_exports = {};
|
|
28
|
-
__export(sqlite_formatter_exports, {
|
|
29
|
-
SQLiteFormatter: () => SQLiteFormatter
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(sqlite_formatter_exports);
|
|
32
|
-
var import_formatter = require("./formatter");
|
|
33
|
-
class SQLiteFormatter extends import_formatter.Formatter {
|
|
34
|
-
convertFormat(format) {
|
|
35
|
-
return format.replace(/YYYY/g, "%Y").replace(/MM/g, "%m").replace(/DD/g, "%d").replace(/hh/g, "%H").replace(/mm/g, "%M").replace(/ss/g, "%S");
|
|
36
|
-
}
|
|
37
|
-
getOffsetMinutesFromTimezone(timezone) {
|
|
38
|
-
const sign = timezone.charAt(0);
|
|
39
|
-
timezone = timezone.slice(1);
|
|
40
|
-
const [hours, minutes] = timezone.split(":");
|
|
41
|
-
const hoursNum = Number(hours);
|
|
42
|
-
const minutesNum = Number(minutes);
|
|
43
|
-
const offset = hoursNum * 60 + minutesNum;
|
|
44
|
-
return `${sign}${offset} minutes`;
|
|
45
|
-
}
|
|
46
|
-
formatDate(field, format, timezone) {
|
|
47
|
-
format = this.convertFormat(format);
|
|
48
|
-
if (timezone) {
|
|
49
|
-
return this.sequelize.fn("strftime", format, field, this.getOffsetMinutesFromTimezone(timezone));
|
|
50
|
-
}
|
|
51
|
-
return this.sequelize.fn("strftime", format, field);
|
|
52
|
-
}
|
|
53
|
-
formatUnixTimeStamp(field, format, accuracy = "second", timezone) {
|
|
54
|
-
format = this.convertFormat(format);
|
|
55
|
-
const col = this.sequelize.getQueryInterface().quoteIdentifiers(field);
|
|
56
|
-
if (accuracy === "millisecond") {
|
|
57
|
-
return this.sequelize.fn(
|
|
58
|
-
"strftime",
|
|
59
|
-
format,
|
|
60
|
-
this.sequelize.fn(
|
|
61
|
-
"DATETIME",
|
|
62
|
-
this.sequelize.literal(`ROUND(${col} / 1000)`),
|
|
63
|
-
"unixepoch",
|
|
64
|
-
this.getOffsetMinutesFromTimezone(timezone)
|
|
65
|
-
)
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
return this.sequelize.fn(
|
|
69
|
-
"strftime",
|
|
70
|
-
format,
|
|
71
|
-
this.sequelize.fn(
|
|
72
|
-
"DATETIME",
|
|
73
|
-
this.sequelize.col(field),
|
|
74
|
-
"unixepoch",
|
|
75
|
-
this.getOffsetMinutesFromTimezone(timezone)
|
|
76
|
-
)
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
81
|
-
0 && (module.exports = {
|
|
82
|
-
SQLiteFormatter
|
|
83
|
-
});
|
|
@@ -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 { Database } from '@nocobase/database';
|
|
10
|
-
import { QueryParser } from './query-parser';
|
|
11
|
-
export declare const createQueryParser: (db: Database) => QueryParser;
|
|
@@ -1,56 +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 query_parser_exports = {};
|
|
28
|
-
__export(query_parser_exports, {
|
|
29
|
-
createQueryParser: () => createQueryParser
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(query_parser_exports);
|
|
32
|
-
var import_sqlite_query_parser = require("./sqlite-query-parser");
|
|
33
|
-
var import_postgres_query_parser = require("./postgres-query-parser");
|
|
34
|
-
var import_mysql_query_parser = require("./mysql-query-parser");
|
|
35
|
-
var import_query_parser = require("./query-parser");
|
|
36
|
-
var import_oracle_query_parser = require("./oracle-query-parser");
|
|
37
|
-
const createQueryParser = (db) => {
|
|
38
|
-
const dialect = db.sequelize.getDialect();
|
|
39
|
-
switch (dialect) {
|
|
40
|
-
case "sqlite":
|
|
41
|
-
return new import_sqlite_query_parser.SQLiteQueryParser(db);
|
|
42
|
-
case "postgres":
|
|
43
|
-
return new import_postgres_query_parser.PostgresQueryParser(db);
|
|
44
|
-
case "mysql":
|
|
45
|
-
case "mariadb":
|
|
46
|
-
return new import_mysql_query_parser.MySQLQueryParser(db);
|
|
47
|
-
case "oracle":
|
|
48
|
-
return new import_oracle_query_parser.OracleQueryParser(db);
|
|
49
|
-
default:
|
|
50
|
-
return new import_query_parser.QueryParser(db);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
-
0 && (module.exports = {
|
|
55
|
-
createQueryParser
|
|
56
|
-
});
|
|
@@ -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 { Database } from '@nocobase/database';
|
|
10
|
-
import { MySQLFormatter } from '../formatter/mysql-formatter';
|
|
11
|
-
import { QueryParser } from './query-parser';
|
|
12
|
-
export declare class MySQLQueryParser extends QueryParser {
|
|
13
|
-
formatter: MySQLFormatter;
|
|
14
|
-
constructor(db: Database);
|
|
15
|
-
}
|
|
@@ -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 __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 mysql_query_parser_exports = {};
|
|
28
|
-
__export(mysql_query_parser_exports, {
|
|
29
|
-
MySQLQueryParser: () => MySQLQueryParser
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(mysql_query_parser_exports);
|
|
32
|
-
var import_mysql_formatter = require("../formatter/mysql-formatter");
|
|
33
|
-
var import_query_parser = require("./query-parser");
|
|
34
|
-
class MySQLQueryParser extends import_query_parser.QueryParser {
|
|
35
|
-
constructor(db) {
|
|
36
|
-
super(db);
|
|
37
|
-
this.formatter = new import_mysql_formatter.MySQLFormatter(db.sequelize);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
-
0 && (module.exports = {
|
|
42
|
-
MySQLQueryParser
|
|
43
|
-
});
|
|
@@ -1,18 +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 { QueryParser } from './query-parser';
|
|
10
|
-
import { OrderProps } from '../types';
|
|
11
|
-
import { Context } from '@nocobase/actions';
|
|
12
|
-
import { OracleFormatter } from '../formatter/oracle-formatter';
|
|
13
|
-
import { Database } from '@nocobase/database';
|
|
14
|
-
export declare class OracleQueryParser extends QueryParser {
|
|
15
|
-
formatter: OracleFormatter;
|
|
16
|
-
constructor(db: Database);
|
|
17
|
-
parseOrders(ctx: Context, orders: OrderProps[], hasAgg: boolean): any[];
|
|
18
|
-
}
|