@nocobase/plugin-data-visualization 2.1.0-alpha.12 → 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.
Files changed (57) hide show
  1. package/dist/client/flow/models/ChartBlockModel.d.ts +1 -0
  2. package/dist/client/flow/models/ChartOptionsBuilder.d.ts +4 -0
  3. package/dist/client/flow/models/QueryBuilder.d.ts +1 -4
  4. package/dist/client/flow/resources/ChartResource.d.ts +1 -0
  5. package/dist/client/index.js +1 -1
  6. package/dist/externalVersion.js +12 -11
  7. package/dist/node_modules/koa-compose/package.json +1 -1
  8. package/dist/server/actions/query.d.ts +2 -4
  9. package/dist/server/actions/query.js +48 -183
  10. package/dist/server/plugin.d.ts +0 -2
  11. package/dist/server/plugin.js +2 -6
  12. package/dist/server/types.d.ts +3 -0
  13. package/package.json +4 -2
  14. package/dist/client/flow/components/AntdFilterSelector.d.ts +0 -35
  15. package/dist/node_modules/moment-timezone/LICENSE +0 -20
  16. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-10-year-range.js +0 -1548
  17. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-10-year-range.min.js +0 -1
  18. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-1970-2030.js +0 -1548
  19. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-1970-2030.min.js +0 -1
  20. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-2012-2022.js +0 -1560
  21. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data-2012-2022.min.js +0 -1
  22. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data.js +0 -1548
  23. package/dist/node_modules/moment-timezone/builds/moment-timezone-with-data.min.js +0 -1
  24. package/dist/node_modules/moment-timezone/builds/moment-timezone.min.js +0 -1
  25. package/dist/node_modules/moment-timezone/composer.json +0 -43
  26. package/dist/node_modules/moment-timezone/data/meta/latest.json +0 -5889
  27. package/dist/node_modules/moment-timezone/data/packed/latest.json +0 -852
  28. package/dist/node_modules/moment-timezone/index.d.ts +0 -78
  29. package/dist/node_modules/moment-timezone/index.js +0 -15
  30. package/dist/node_modules/moment-timezone/moment-timezone-utils.d.ts +0 -70
  31. package/dist/node_modules/moment-timezone/moment-timezone-utils.js +0 -339
  32. package/dist/node_modules/moment-timezone/moment-timezone.js +0 -696
  33. package/dist/node_modules/moment-timezone/package.json +0 -1
  34. package/dist/server/flow-schema-contributions/index.d.ts +0 -10
  35. package/dist/server/flow-schema-contributions/index.js +0 -240
  36. package/dist/server/formatter/formatter.d.ts +0 -27
  37. package/dist/server/formatter/formatter.js +0 -85
  38. package/dist/server/formatter/mysql-formatter.d.ts +0 -14
  39. package/dist/server/formatter/mysql-formatter.js +0 -93
  40. package/dist/server/formatter/oracle-formatter.d.ts +0 -14
  41. package/dist/server/formatter/oracle-formatter.js +0 -74
  42. package/dist/server/formatter/postgres-formatter.d.ts +0 -14
  43. package/dist/server/formatter/postgres-formatter.js +0 -74
  44. package/dist/server/formatter/sqlite-formatter.d.ts +0 -15
  45. package/dist/server/formatter/sqlite-formatter.js +0 -83
  46. package/dist/server/query-parser/index.d.ts +0 -11
  47. package/dist/server/query-parser/index.js +0 -56
  48. package/dist/server/query-parser/mysql-query-parser.d.ts +0 -15
  49. package/dist/server/query-parser/mysql-query-parser.js +0 -43
  50. package/dist/server/query-parser/oracle-query-parser.d.ts +0 -18
  51. package/dist/server/query-parser/oracle-query-parser.js +0 -60
  52. package/dist/server/query-parser/postgres-query-parser.d.ts +0 -15
  53. package/dist/server/query-parser/postgres-query-parser.js +0 -43
  54. package/dist/server/query-parser/query-parser.d.ts +0 -31
  55. package/dist/server/query-parser/query-parser.js +0 -146
  56. package/dist/server/query-parser/sqlite-query-parser.d.ts +0 -15
  57. package/dist/server/query-parser/sqlite-query-parser.js +0 -43
@@ -1,240 +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 flow_schema_contributions_exports = {};
28
- __export(flow_schema_contributions_exports, {
29
- flowSchemaContribution: () => flowSchemaContribution
30
- });
31
- module.exports = __toCommonJS(flow_schema_contributions_exports);
32
- const chartBlockModelSchemaContribution = {
33
- use: "ChartBlockModel",
34
- title: "Chart block",
35
- source: "plugin",
36
- strict: false,
37
- stepParamsSchema: {
38
- type: "object",
39
- properties: {
40
- chartSettings: {
41
- type: "object",
42
- properties: {
43
- configure: {
44
- type: "object",
45
- properties: {
46
- query: {
47
- type: "object",
48
- properties: {
49
- mode: {
50
- type: "string",
51
- enum: ["builder", "sql"]
52
- },
53
- collectionPath: {
54
- type: "array",
55
- items: { type: "string" },
56
- minItems: 2,
57
- maxItems: 2
58
- },
59
- measures: {
60
- type: "array",
61
- items: {
62
- type: "object",
63
- properties: {
64
- field: { type: "string" },
65
- aggregation: { type: "string" },
66
- alias: { type: "string" }
67
- },
68
- additionalProperties: true
69
- }
70
- },
71
- dimensions: {
72
- type: "array",
73
- items: {
74
- type: "object",
75
- properties: {
76
- field: { type: "string" },
77
- alias: { type: "string" },
78
- format: { type: "string" }
79
- },
80
- additionalProperties: true
81
- }
82
- },
83
- sqlDatasource: { type: "string" },
84
- sql: { type: "string" }
85
- },
86
- additionalProperties: true
87
- },
88
- chart: {
89
- type: "object",
90
- properties: {
91
- option: {
92
- type: "object",
93
- properties: {
94
- mode: {
95
- type: "string",
96
- enum: ["basic", "custom"]
97
- },
98
- builder: {
99
- type: "object",
100
- additionalProperties: true
101
- },
102
- raw: { type: "string" }
103
- },
104
- additionalProperties: true
105
- },
106
- events: {
107
- type: "object",
108
- properties: {
109
- raw: { type: "string" }
110
- },
111
- additionalProperties: true
112
- }
113
- },
114
- additionalProperties: true
115
- }
116
- },
117
- additionalProperties: true
118
- }
119
- },
120
- additionalProperties: true
121
- }
122
- },
123
- additionalProperties: true
124
- },
125
- skeleton: {
126
- uid: "todo-chart-block-uid",
127
- use: "ChartBlockModel",
128
- stepParams: {
129
- chartSettings: {
130
- configure: {
131
- query: {
132
- mode: "builder",
133
- collectionPath: ["main", "orders"],
134
- measures: [
135
- {
136
- field: "id",
137
- aggregation: "count",
138
- alias: "count_id"
139
- }
140
- ],
141
- dimensions: [
142
- {
143
- field: "createdAt"
144
- }
145
- ]
146
- },
147
- chart: {
148
- option: {
149
- mode: "basic",
150
- builder: {
151
- type: "line",
152
- xField: "createdAt",
153
- yField: "count_id"
154
- }
155
- }
156
- }
157
- }
158
- }
159
- }
160
- },
161
- docs: {
162
- minimalExample: {
163
- uid: "chart-users",
164
- use: "ChartBlockModel",
165
- stepParams: {
166
- chartSettings: {
167
- configure: {
168
- query: {
169
- mode: "builder",
170
- collectionPath: ["main", "orders"],
171
- measures: [
172
- {
173
- field: "id",
174
- aggregation: "count",
175
- alias: "count_id"
176
- }
177
- ],
178
- dimensions: [
179
- {
180
- field: "createdAt"
181
- }
182
- ]
183
- },
184
- chart: {
185
- option: {
186
- mode: "basic",
187
- builder: {
188
- type: "line",
189
- xField: "createdAt",
190
- yField: "count_id"
191
- }
192
- }
193
- }
194
- }
195
- }
196
- }
197
- },
198
- dynamicHints: [
199
- {
200
- kind: "dynamic-ui-schema",
201
- path: "ChartBlockModel.stepParams.chartSettings.configure.query",
202
- message: "Chart query configuration depends on runtime collections and query builders. Builder charts are renderable only when collectionPath includes datasource+collection and measures are present.",
203
- "x-flow": {
204
- contextRequirements: ["collection metadata", "query builder", "optional SQL resource"],
205
- unresolvedReason: "runtime-chart-query-config",
206
- recommendedFallback: {
207
- mode: "builder"
208
- }
209
- }
210
- },
211
- {
212
- kind: "dynamic-ui-schema",
213
- path: "ChartBlockModel.stepParams.chartSettings.configure.chart",
214
- message: "Chart option builders and event scripts depend on runtime chart builders and RunJS execution. Basic mode still needs option.builder; custom mode does not bypass query/dataSource requirements.",
215
- "x-flow": {
216
- contextRequirements: ["chart builder", "RunJS"],
217
- unresolvedReason: "runtime-chart-option-builder",
218
- recommendedFallback: {
219
- option: {
220
- mode: "basic"
221
- }
222
- }
223
- }
224
- }
225
- ]
226
- }
227
- };
228
- const flowSchemaContribution = {
229
- inventory: {
230
- publicTreeRoots: ["ChartBlockModel"]
231
- },
232
- models: [chartBlockModelSchemaContribution],
233
- defaults: {
234
- source: "plugin"
235
- }
236
- };
237
- // Annotate the CommonJS export names for ESM import in node:
238
- 0 && (module.exports = {
239
- flowSchemaContribution
240
- });
@@ -1,27 +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 { Sequelize } from 'sequelize';
10
- export type Col = ReturnType<typeof Sequelize.col>;
11
- export type Literal = ReturnType<typeof Sequelize.literal>;
12
- export type Fn = ReturnType<typeof Sequelize.fn>;
13
- export declare abstract class Formatter {
14
- sequelize: Sequelize;
15
- constructor(sequelize: Sequelize);
16
- abstract formatDate(field: Col, format: string, timezone?: string): Fn | Col;
17
- abstract formatUnixTimeStamp(field: string, format: string, accuracy?: 'second' | 'millisecond', timezone?: string): Fn | Literal;
18
- getTimezoneByOffset(offset: string): string;
19
- convertFormat(format: string): string;
20
- format(options: {
21
- type: string;
22
- field: string;
23
- format: string;
24
- options?: any;
25
- timezone?: string;
26
- }): import("sequelize/types/utils").Col | import("sequelize/types/utils").Literal | import("sequelize/types/utils").Fn;
27
- }
@@ -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
- }