@nocobase/database 1.2.13-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 +4 -4
- package/lib/collection-factory.d.ts +0 -25
- package/lib/collection-factory.js +0 -61
- package/lib/collection-group-manager.d.ts +0 -34
- package/lib/collection-group-manager.js +0 -66
- package/lib/collection-importer.d.ts +0 -15
- package/lib/collection-importer.js +0 -83
- package/lib/collection.d.ts +0 -145
- package/lib/collection.js +0 -663
- package/lib/database-utils/index.d.ts +0 -16
- package/lib/database-utils/index.js +0 -75
- package/lib/database.d.ts +0 -228
- package/lib/database.js +0 -795
- package/lib/decorators/must-have-filter-decorator.d.ts +0 -10
- package/lib/decorators/must-have-filter-decorator.js +0 -48
- package/lib/decorators/target-collection-decorator.d.ts +0 -10
- package/lib/decorators/target-collection-decorator.js +0 -56
- package/lib/decorators/transaction-decorator.d.ts +0 -9
- package/lib/decorators/transaction-decorator.js +0 -95
- package/lib/eager-loading/eager-loading-tree.d.ts +0 -39
- package/lib/eager-loading/eager-loading-tree.js +0 -448
- package/lib/errors/identifier-error.d.ts +0 -11
- package/lib/errors/identifier-error.js +0 -44
- package/lib/errors/zero-column-table-error.d.ts +0 -10
- package/lib/errors/zero-column-table-error.js +0 -40
- package/lib/features/references-map.d.ts +0 -29
- package/lib/features/references-map.js +0 -120
- package/lib/features/referential-integrity-check.d.ts +0 -16
- package/lib/features/referential-integrity-check.js +0 -86
- package/lib/field-repository/array-field-repository.d.ts +0 -36
- package/lib/field-repository/array-field-repository.js +0 -179
- package/lib/fields/array-field.d.ts +0 -19
- package/lib/fields/array-field.js +0 -66
- package/lib/fields/belongs-to-field.d.ts +0 -25
- package/lib/fields/belongs-to-field.js +0 -166
- package/lib/fields/belongs-to-many-field.d.ts +0 -28
- package/lib/fields/belongs-to-many-field.js +0 -196
- package/lib/fields/boolean-field.d.ts +0 -16
- package/lib/fields/boolean-field.js +0 -45
- package/lib/fields/context-field.d.ts +0 -22
- package/lib/fields/context-field.js +0 -79
- package/lib/fields/date-field.d.ts +0 -21
- package/lib/fields/date-field.js +0 -73
- package/lib/fields/field.d.ts +0 -52
- package/lib/fields/field.js +0 -168
- package/lib/fields/has-inverse-field.d.ts +0 -12
- package/lib/fields/has-inverse-field.js +0 -24
- package/lib/fields/has-many-field.d.ts +0 -76
- package/lib/fields/has-many-field.js +0 -165
- package/lib/fields/has-one-field.d.ts +0 -76
- package/lib/fields/has-one-field.js +0 -159
- package/lib/fields/index.d.ts +0 -54
- package/lib/fields/index.js +0 -74
- package/lib/fields/json-field.d.ts +0 -22
- package/lib/fields/json-field.js +0 -63
- package/lib/fields/nanoid-field.d.ts +0 -22
- package/lib/fields/nanoid-field.js +0 -65
- package/lib/fields/number-field.d.ts +0 -49
- package/lib/fields/number-field.js +0 -94
- package/lib/fields/password-field.d.ts +0 -29
- package/lib/fields/password-field.js +0 -106
- package/lib/fields/radio-field.d.ts +0 -24
- package/lib/fields/radio-field.js +0 -75
- package/lib/fields/relation-field.d.ts +0 -31
- package/lib/fields/relation-field.js +0 -94
- package/lib/fields/set-field.d.ts +0 -18
- package/lib/fields/set-field.js +0 -55
- package/lib/fields/sort-field.d.ts +0 -22
- package/lib/fields/sort-field.js +0 -197
- package/lib/fields/string-field.d.ts +0 -16
- package/lib/fields/string-field.js +0 -45
- package/lib/fields/text-field.d.ts +0 -18
- package/lib/fields/text-field.js +0 -53
- package/lib/fields/time-field.d.ts +0 -16
- package/lib/fields/time-field.js +0 -45
- package/lib/fields/uid-field.d.ts +0 -21
- package/lib/fields/uid-field.js +0 -72
- package/lib/fields/uuid-field.d.ts +0 -20
- package/lib/fields/uuid-field.js +0 -63
- package/lib/fields/virtual-field.d.ts +0 -16
- package/lib/fields/virtual-field.js +0 -45
- package/lib/filter-match.d.ts +0 -9
- package/lib/filter-match.js +0 -75
- package/lib/filter-parser.d.ts +0 -29
- package/lib/filter-parser.js +0 -238
- package/lib/helpers.d.ts +0 -11
- package/lib/helpers.js +0 -182
- package/lib/index.d.ts +0 -37
- package/lib/index.js +0 -138
- package/lib/inherited-collection.d.ts +0 -22
- package/lib/inherited-collection.js +0 -147
- package/lib/inherited-map.d.ts +0 -29
- package/lib/inherited-map.js +0 -125
- package/lib/inherited-sync-runner.d.ts +0 -12
- package/lib/inherited-sync-runner.js +0 -184
- package/lib/interface-manager.d.ts +0 -17
- package/lib/interface-manager.js +0 -50
- package/lib/interfaces/base-interface.d.ts +0 -33
- package/lib/interfaces/base-interface.js +0 -80
- package/lib/interfaces/boolean-interface.d.ts +0 -13
- package/lib/interfaces/boolean-interface.js +0 -70
- package/lib/interfaces/checkboxes-interface.d.ts +0 -11
- package/lib/interfaces/checkboxes-interface.js +0 -41
- package/lib/interfaces/datetime-interface.d.ts +0 -13
- package/lib/interfaces/datetime-interface.js +0 -108
- package/lib/interfaces/index.d.ts +0 -14
- package/lib/interfaces/index.js +0 -40
- package/lib/interfaces/integer-interface.d.ts +0 -12
- package/lib/interfaces/integer-interface.js +0 -44
- package/lib/interfaces/json-interface.d.ts +0 -13
- package/lib/interfaces/json-interface.js +0 -47
- package/lib/interfaces/many-to-many-interface.d.ts +0 -11
- package/lib/interfaces/many-to-many-interface.js +0 -41
- package/lib/interfaces/many-to-one-interface.d.ts +0 -11
- package/lib/interfaces/many-to-one-interface.js +0 -41
- package/lib/interfaces/multiple-select-interface.d.ts +0 -13
- package/lib/interfaces/multiple-select-interface.js +0 -76
- package/lib/interfaces/number-interface.d.ts +0 -15
- package/lib/interfaces/number-interface.js +0 -72
- package/lib/interfaces/one-belongs-to-one-interface.d.ts +0 -11
- package/lib/interfaces/one-belongs-to-one-interface.js +0 -41
- package/lib/interfaces/one-has-one-interface.d.ts +0 -11
- package/lib/interfaces/one-has-one-interface.js +0 -41
- package/lib/interfaces/one-to-many-interface.d.ts +0 -11
- package/lib/interfaces/one-to-many-interface.js +0 -41
- package/lib/interfaces/percent-interface.d.ts +0 -13
- package/lib/interfaces/percent-interface.js +0 -55
- package/lib/interfaces/select-interface.d.ts +0 -13
- package/lib/interfaces/select-interface.js +0 -63
- package/lib/interfaces/to-many-interface.d.ts +0 -12
- package/lib/interfaces/to-many-interface.js +0 -61
- package/lib/interfaces/to-one-interface.d.ts +0 -13
- package/lib/interfaces/to-one-interface.js +0 -61
- package/lib/interfaces/utils.d.ts +0 -10
- package/lib/interfaces/utils.js +0 -72
- package/lib/listeners/adjacency-list.d.ts +0 -10
- package/lib/listeners/adjacency-list.js +0 -51
- package/lib/listeners/append-child-collection-name-after-repository-find.d.ts +0 -14
- package/lib/listeners/append-child-collection-name-after-repository-find.js +0 -75
- package/lib/listeners/index.d.ts +0 -10
- package/lib/listeners/index.js +0 -42
- package/lib/magic-attribute-model.d.ts +0 -16
- package/lib/magic-attribute-model.js +0 -213
- package/lib/migration.d.ts +0 -43
- package/lib/migration.js +0 -112
- package/lib/mock-database.d.ts +0 -33
- package/lib/mock-database.js +0 -136
- package/lib/model-hook.d.ts +0 -20
- package/lib/model-hook.js +0 -96
- package/lib/model.d.ts +0 -32
- package/lib/model.js +0 -179
- package/lib/operators/array.d.ts +0 -10
- package/lib/operators/array.js +0 -196
- package/lib/operators/association.d.ts +0 -10
- package/lib/operators/association.js +0 -44
- package/lib/operators/boolean.d.ts +0 -10
- package/lib/operators/boolean.js +0 -47
- package/lib/operators/child-collection.d.ts +0 -10
- package/lib/operators/child-collection.js +0 -77
- package/lib/operators/date.d.ts +0 -10
- package/lib/operators/date.js +0 -149
- package/lib/operators/empty.d.ts +0 -13
- package/lib/operators/empty.js +0 -102
- package/lib/operators/eq.d.ts +0 -10
- package/lib/operators/eq.js +0 -44
- package/lib/operators/index.d.ts +0 -13
- package/lib/operators/index.js +0 -63
- package/lib/operators/ne.d.ts +0 -10
- package/lib/operators/ne.js +0 -49
- package/lib/operators/notIn.d.ts +0 -10
- package/lib/operators/notIn.js +0 -42
- package/lib/operators/string.d.ts +0 -10
- package/lib/operators/string.js +0 -118
- package/lib/operators/utils.d.ts +0 -12
- package/lib/operators/utils.js +0 -53
- package/lib/options-parser.d.ts +0 -45
- package/lib/options-parser.js +0 -350
- package/lib/query-interface/mysql-query-interface.d.ts +0 -44
- package/lib/query-interface/mysql-query-interface.js +0 -134
- package/lib/query-interface/postgres-query-interface.d.ts +0 -41
- package/lib/query-interface/postgres-query-interface.js +0 -207
- package/lib/query-interface/query-interface-builder.d.ts +0 -10
- package/lib/query-interface/query-interface-builder.js +0 -55
- package/lib/query-interface/query-interface.d.ts +0 -52
- package/lib/query-interface/query-interface.js +0 -59
- package/lib/query-interface/sqlite-query-interface.d.ts +0 -44
- package/lib/query-interface/sqlite-query-interface.js +0 -141
- package/lib/relation-repository/belongs-to-many-repository.d.ts +0 -28
- package/lib/relation-repository/belongs-to-many-repository.js +0 -248
- package/lib/relation-repository/belongs-to-repository.d.ts +0 -17
- package/lib/relation-repository/belongs-to-repository.js +0 -51
- package/lib/relation-repository/hasmany-repository.d.ts +0 -21
- package/lib/relation-repository/hasmany-repository.js +0 -158
- package/lib/relation-repository/hasone-repository.d.ts +0 -17
- package/lib/relation-repository/hasone-repository.js +0 -51
- package/lib/relation-repository/multiple-relation-repository.d.ts +0 -27
- package/lib/relation-repository/multiple-relation-repository.js +0 -200
- package/lib/relation-repository/relation-repository.d.ts +0 -38
- package/lib/relation-repository/relation-repository.js +0 -175
- package/lib/relation-repository/single-relation-repository.d.ts +0 -36
- package/lib/relation-repository/single-relation-repository.js +0 -151
- package/lib/relation-repository/types.d.ts +0 -15
- package/lib/relation-repository/types.js +0 -24
- package/lib/repositories/tree-repository/adjacency-list-repository.d.ts +0 -26
- package/lib/repositories/tree-repository/adjacency-list-repository.js +0 -192
- package/lib/repositories/view-repository.d.ts +0 -11
- package/lib/repositories/view-repository.js +0 -41
- package/lib/repository.d.ts +0 -214
- package/lib/repository.js +0 -609
- package/lib/sql-parser/index.d.ts +0 -13
- package/lib/sql-parser/index.js +0 -33
- package/lib/sync-runner.d.ts +0 -41
- package/lib/sync-runner.js +0 -335
- package/lib/types.d.ts +0 -57
- package/lib/types.js +0 -24
- package/lib/update-associations.d.ts +0 -68
- package/lib/update-associations.js +0 -429
- package/lib/update-guard.d.ts +0 -36
- package/lib/update-guard.js +0 -212
- package/lib/utils.d.ts +0 -15
- package/lib/utils.js +0 -136
- package/lib/value-parsers/array-value-parser.d.ts +0 -16
- package/lib/value-parsers/array-value-parser.js +0 -67
- package/lib/value-parsers/base-value-parser.d.ts +0 -20
- package/lib/value-parsers/base-value-parser.js +0 -72
- package/lib/value-parsers/boolean-value-parser.d.ts +0 -12
- package/lib/value-parsers/boolean-value-parser.js +0 -61
- package/lib/value-parsers/date-value-parser.d.ts +0 -13
- package/lib/value-parsers/date-value-parser.js +0 -99
- package/lib/value-parsers/index.d.ts +0 -20
- package/lib/value-parsers/index.js +0 -87
- package/lib/value-parsers/json-value-parser.d.ts +0 -12
- package/lib/value-parsers/json-value-parser.js +0 -56
- package/lib/value-parsers/number-value-parser.d.ts +0 -12
- package/lib/value-parsers/number-value-parser.js +0 -67
- package/lib/value-parsers/string-value-parser.d.ts +0 -16
- package/lib/value-parsers/string-value-parser.js +0 -73
- package/lib/value-parsers/to-many-value-parser.d.ts +0 -21
- package/lib/value-parsers/to-many-value-parser.js +0 -117
- package/lib/value-parsers/to-one-value-parser.d.ts +0 -12
- package/lib/value-parsers/to-one-value-parser.js +0 -57
- package/lib/view/field-type-map.d.ts +0 -109
- package/lib/view/field-type-map.js +0 -101
- package/lib/view/view-inference.d.ts +0 -40
- package/lib/view/view-inference.js +0 -157
- package/lib/view-collection.d.ts +0 -14
- package/lib/view-collection.js +0 -54
|
@@ -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 __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_value_parser_exports = {};
|
|
29
|
-
__export(json_value_parser_exports, {
|
|
30
|
-
JsonValueParser: () => JsonValueParser
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(json_value_parser_exports);
|
|
33
|
-
var import_base_value_parser = require("./base-value-parser");
|
|
34
|
-
const _JsonValueParser = class _JsonValueParser extends import_base_value_parser.BaseValueParser {
|
|
35
|
-
async setValue(value) {
|
|
36
|
-
if (typeof value === "string") {
|
|
37
|
-
if (value.trim() === "") {
|
|
38
|
-
this.value = null;
|
|
39
|
-
} else {
|
|
40
|
-
try {
|
|
41
|
-
this.value = JSON.parse(value);
|
|
42
|
-
} catch (error) {
|
|
43
|
-
this.errors.push(error.message);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
} else {
|
|
47
|
-
this.value = value;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
__name(_JsonValueParser, "JsonValueParser");
|
|
52
|
-
let JsonValueParser = _JsonValueParser;
|
|
53
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
-
0 && (module.exports = {
|
|
55
|
-
JsonValueParser
|
|
56
|
-
});
|
|
@@ -1,12 +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 { BaseValueParser } from './base-value-parser';
|
|
10
|
-
export declare class NumberValueParser extends BaseValueParser {
|
|
11
|
-
setValue(value: any): Promise<void>;
|
|
12
|
-
}
|
|
@@ -1,67 +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_value_parser_exports = {};
|
|
29
|
-
__export(number_value_parser_exports, {
|
|
30
|
-
NumberValueParser: () => NumberValueParser
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(number_value_parser_exports);
|
|
33
|
-
var import_utils = require("../utils");
|
|
34
|
-
var import_base_value_parser = require("./base-value-parser");
|
|
35
|
-
const _NumberValueParser = class _NumberValueParser extends import_base_value_parser.BaseValueParser {
|
|
36
|
-
async setValue(value) {
|
|
37
|
-
if (value === null || value === void 0 || typeof value === "number") {
|
|
38
|
-
this.value = value;
|
|
39
|
-
} else if (typeof value === "string") {
|
|
40
|
-
if (!value) {
|
|
41
|
-
this.value = null;
|
|
42
|
-
} else if (["n/a", "-"].includes(value.toLowerCase())) {
|
|
43
|
-
this.value = null;
|
|
44
|
-
} else {
|
|
45
|
-
value = value.replace(/,/g, "");
|
|
46
|
-
if (value.endsWith("%")) {
|
|
47
|
-
value = (0, import_utils.percent2float)(value);
|
|
48
|
-
} else {
|
|
49
|
-
value = +value;
|
|
50
|
-
}
|
|
51
|
-
if (isNaN(value)) {
|
|
52
|
-
this.errors.push(`Invalid value - "${value}"`);
|
|
53
|
-
} else {
|
|
54
|
-
this.value = value;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
} else {
|
|
58
|
-
this.errors.push(`Invalid value - ${JSON.stringify(value)}`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
__name(_NumberValueParser, "NumberValueParser");
|
|
63
|
-
let NumberValueParser = _NumberValueParser;
|
|
64
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
-
0 && (module.exports = {
|
|
66
|
-
NumberValueParser
|
|
67
|
-
});
|
|
@@ -1,16 +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 { BaseValueParser } from './base-value-parser';
|
|
10
|
-
export declare class StringValueParser extends BaseValueParser {
|
|
11
|
-
setValue(value: any): Promise<void>;
|
|
12
|
-
getOptions(): {
|
|
13
|
-
map: Map<any, any>;
|
|
14
|
-
set: Set<unknown>;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
@@ -1,73 +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 string_value_parser_exports = {};
|
|
29
|
-
__export(string_value_parser_exports, {
|
|
30
|
-
StringValueParser: () => StringValueParser
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(string_value_parser_exports);
|
|
33
|
-
var import_base_value_parser = require("./base-value-parser");
|
|
34
|
-
const _StringValueParser = class _StringValueParser extends import_base_value_parser.BaseValueParser {
|
|
35
|
-
async setValue(value) {
|
|
36
|
-
const { map, set } = this.getOptions();
|
|
37
|
-
if (set.size > 0) {
|
|
38
|
-
if (map.has(value)) {
|
|
39
|
-
value = map.get(value);
|
|
40
|
-
}
|
|
41
|
-
if (set.has(value)) {
|
|
42
|
-
this.value = value;
|
|
43
|
-
} else {
|
|
44
|
-
this.errors.push(`No matching option found - ${JSON.stringify(value)}`);
|
|
45
|
-
}
|
|
46
|
-
} else {
|
|
47
|
-
this.value = value;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
getOptions() {
|
|
51
|
-
var _a, _b;
|
|
52
|
-
const options = ((_b = (_a = this.field.options) == null ? void 0 : _a["uiSchema"]) == null ? void 0 : _b.enum) || [];
|
|
53
|
-
const map = /* @__PURE__ */ new Map();
|
|
54
|
-
const set = /* @__PURE__ */ new Set();
|
|
55
|
-
for (const option of options) {
|
|
56
|
-
if (typeof option === "string") {
|
|
57
|
-
set.add(option);
|
|
58
|
-
map.set(option, option);
|
|
59
|
-
} else {
|
|
60
|
-
set.add(option.value);
|
|
61
|
-
set.add(option.label);
|
|
62
|
-
map.set(option.label, option.value);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return { map, set };
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
__name(_StringValueParser, "StringValueParser");
|
|
69
|
-
let StringValueParser = _StringValueParser;
|
|
70
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
71
|
-
0 && (module.exports = {
|
|
72
|
-
StringValueParser
|
|
73
|
-
});
|
|
@@ -1,21 +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 { BaseValueParser } from './base-value-parser';
|
|
10
|
-
export declare class ToManyValueParser extends BaseValueParser {
|
|
11
|
-
setAccessors: {
|
|
12
|
-
attachment: string;
|
|
13
|
-
chinaRegion: string;
|
|
14
|
-
};
|
|
15
|
-
setAttachments(value: any): Promise<void>;
|
|
16
|
-
setChinaRegion(value: any): Promise<void>;
|
|
17
|
-
setAssociations(value: any): Promise<void>;
|
|
18
|
-
setValue(value: any): Promise<void>;
|
|
19
|
-
getInterface(): string;
|
|
20
|
-
isInterface(name: string): boolean;
|
|
21
|
-
}
|
|
@@ -1,117 +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 to_many_value_parser_exports = {};
|
|
29
|
-
__export(to_many_value_parser_exports, {
|
|
30
|
-
ToManyValueParser: () => ToManyValueParser
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(to_many_value_parser_exports);
|
|
33
|
-
var import_path = require("path");
|
|
34
|
-
var import_base_value_parser = require("./base-value-parser");
|
|
35
|
-
const _ToManyValueParser = class _ToManyValueParser extends import_base_value_parser.BaseValueParser {
|
|
36
|
-
setAccessors = {
|
|
37
|
-
attachment: "setAttachments",
|
|
38
|
-
chinaRegion: "setChinaRegion"
|
|
39
|
-
};
|
|
40
|
-
async setAttachments(value) {
|
|
41
|
-
this.value = this.toArr(value).map((url) => {
|
|
42
|
-
return {
|
|
43
|
-
title: (0, import_path.basename)(url),
|
|
44
|
-
extname: (0, import_path.extname)(url),
|
|
45
|
-
filename: (0, import_path.basename)(url),
|
|
46
|
-
url
|
|
47
|
-
};
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
async setChinaRegion(value) {
|
|
51
|
-
const repository = this.field.database.getRepository(this.field.target);
|
|
52
|
-
try {
|
|
53
|
-
const values = [];
|
|
54
|
-
const names = this.toArr(value, "/");
|
|
55
|
-
let parentCode = null;
|
|
56
|
-
for (const name of names) {
|
|
57
|
-
const instance = await repository.findOne({
|
|
58
|
-
filter: {
|
|
59
|
-
name: name.trim(),
|
|
60
|
-
parentCode
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
if (!instance) {
|
|
64
|
-
throw new Error(`"${value}" does not exist`);
|
|
65
|
-
}
|
|
66
|
-
parentCode = instance.get("code");
|
|
67
|
-
values.push(parentCode);
|
|
68
|
-
}
|
|
69
|
-
if (values.length !== names.length) {
|
|
70
|
-
throw new Error(`"${value}" does not exist`);
|
|
71
|
-
}
|
|
72
|
-
this.value = values;
|
|
73
|
-
} catch (error) {
|
|
74
|
-
this.errors.push(error.message);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
async setAssociations(value) {
|
|
78
|
-
var _a, _b;
|
|
79
|
-
const dataIndex = ((_b = (_a = this.ctx) == null ? void 0 : _a.column) == null ? void 0 : _b.dataIndex) || [];
|
|
80
|
-
if (Array.isArray(dataIndex) && dataIndex.length < 2) {
|
|
81
|
-
this.errors.push(`data index invalid`);
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
const key = this.ctx.column.dataIndex[1];
|
|
85
|
-
const repository = this.field.database.getRepository(this.field.target);
|
|
86
|
-
try {
|
|
87
|
-
this.value = await Promise.all(
|
|
88
|
-
this.toArr(value).map(async (v) => {
|
|
89
|
-
const instance = await repository.findOne({ filter: { [key]: v } });
|
|
90
|
-
if (!instance) {
|
|
91
|
-
throw new Error(`"${v}" does not exist`);
|
|
92
|
-
}
|
|
93
|
-
return instance.get(this.field.targetKey || "id");
|
|
94
|
-
})
|
|
95
|
-
);
|
|
96
|
-
} catch (error) {
|
|
97
|
-
this.errors.push(error.message);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
async setValue(value) {
|
|
101
|
-
const setAccessor = this.setAccessors[this.getInterface()] || "setAssociations";
|
|
102
|
-
await this[setAccessor](value);
|
|
103
|
-
}
|
|
104
|
-
getInterface() {
|
|
105
|
-
var _a, _b;
|
|
106
|
-
return (_b = (_a = this.field) == null ? void 0 : _a.options) == null ? void 0 : _b.interface;
|
|
107
|
-
}
|
|
108
|
-
isInterface(name) {
|
|
109
|
-
return this.getInterface() === name;
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
__name(_ToManyValueParser, "ToManyValueParser");
|
|
113
|
-
let ToManyValueParser = _ToManyValueParser;
|
|
114
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
115
|
-
0 && (module.exports = {
|
|
116
|
-
ToManyValueParser
|
|
117
|
-
});
|
|
@@ -1,12 +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 { BaseValueParser } from './base-value-parser';
|
|
10
|
-
export declare class ToOneValueParser extends BaseValueParser {
|
|
11
|
-
setValue(value: any): Promise<void>;
|
|
12
|
-
}
|
|
@@ -1,57 +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 to_one_value_parser_exports = {};
|
|
29
|
-
__export(to_one_value_parser_exports, {
|
|
30
|
-
ToOneValueParser: () => ToOneValueParser
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(to_one_value_parser_exports);
|
|
33
|
-
var import_base_value_parser = require("./base-value-parser");
|
|
34
|
-
const _ToOneValueParser = class _ToOneValueParser extends import_base_value_parser.BaseValueParser {
|
|
35
|
-
async setValue(value) {
|
|
36
|
-
var _a, _b;
|
|
37
|
-
const dataIndex = ((_b = (_a = this.ctx) == null ? void 0 : _a.column) == null ? void 0 : _b.dataIndex) || [];
|
|
38
|
-
if (Array.isArray(dataIndex) && dataIndex.length < 2) {
|
|
39
|
-
this.errors.push(`data index invalid`);
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const key = this.ctx.column.dataIndex[1];
|
|
43
|
-
const repository = this.field.database.getRepository(this.field.target);
|
|
44
|
-
const instance = await repository.findOne({ filter: { [key]: this.trim(value) } });
|
|
45
|
-
if (instance) {
|
|
46
|
-
this.value = instance.get(this.field.targetKey || "id");
|
|
47
|
-
} else {
|
|
48
|
-
this.errors.push(`"${value}" does not exist`);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
__name(_ToOneValueParser, "ToOneValueParser");
|
|
53
|
-
let ToOneValueParser = _ToOneValueParser;
|
|
54
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
-
0 && (module.exports = {
|
|
56
|
-
ToOneValueParser
|
|
57
|
-
});
|
|
@@ -1,109 +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
|
-
declare const _default: {
|
|
10
|
-
postgres: {
|
|
11
|
-
'character varying': string[];
|
|
12
|
-
varchar: string[];
|
|
13
|
-
char: string[];
|
|
14
|
-
character: string;
|
|
15
|
-
text: string;
|
|
16
|
-
oid: string;
|
|
17
|
-
name: string;
|
|
18
|
-
smallint: string[];
|
|
19
|
-
integer: string[];
|
|
20
|
-
bigint: string[];
|
|
21
|
-
decimal: string;
|
|
22
|
-
numeric: string;
|
|
23
|
-
real: string;
|
|
24
|
-
'double precision': string;
|
|
25
|
-
'timestamp without time zone': string;
|
|
26
|
-
'timestamp with time zone': string;
|
|
27
|
-
'time without time zone': string;
|
|
28
|
-
date: string;
|
|
29
|
-
boolean: string;
|
|
30
|
-
json: string[];
|
|
31
|
-
jsonb: string[];
|
|
32
|
-
point: string;
|
|
33
|
-
path: string;
|
|
34
|
-
polygon: string;
|
|
35
|
-
circle: string;
|
|
36
|
-
uuid: string;
|
|
37
|
-
};
|
|
38
|
-
mysql: {
|
|
39
|
-
smallint: string[];
|
|
40
|
-
tinyint: string[];
|
|
41
|
-
mediumint: string[];
|
|
42
|
-
'smallint unsigned': string[];
|
|
43
|
-
'tinyint unsigned': string[];
|
|
44
|
-
'mediumint unsigned': string[];
|
|
45
|
-
char: string[];
|
|
46
|
-
varchar: string[];
|
|
47
|
-
date: string;
|
|
48
|
-
time: string;
|
|
49
|
-
tinytext: string;
|
|
50
|
-
text: string;
|
|
51
|
-
mediumtext: string;
|
|
52
|
-
longtext: string;
|
|
53
|
-
int: string[];
|
|
54
|
-
'int unsigned': string[];
|
|
55
|
-
integer: string[];
|
|
56
|
-
bigint: string[];
|
|
57
|
-
'bigint unsigned': string[];
|
|
58
|
-
float: string;
|
|
59
|
-
double: string;
|
|
60
|
-
boolean: string;
|
|
61
|
-
decimal: string;
|
|
62
|
-
datetime: string;
|
|
63
|
-
timestamp: string;
|
|
64
|
-
json: string[];
|
|
65
|
-
enum: string;
|
|
66
|
-
};
|
|
67
|
-
sqlite: {
|
|
68
|
-
text: string;
|
|
69
|
-
varchar: string[];
|
|
70
|
-
integer: string;
|
|
71
|
-
real: string;
|
|
72
|
-
datetime: string;
|
|
73
|
-
date: string;
|
|
74
|
-
time: string;
|
|
75
|
-
boolean: string;
|
|
76
|
-
numeric: string;
|
|
77
|
-
json: string[];
|
|
78
|
-
};
|
|
79
|
-
mariadb: {
|
|
80
|
-
smallint: string[];
|
|
81
|
-
tinyint: string[];
|
|
82
|
-
mediumint: string[];
|
|
83
|
-
'smallint unsigned': string[];
|
|
84
|
-
'tinyint unsigned': string[];
|
|
85
|
-
'mediumint unsigned': string[];
|
|
86
|
-
char: string[];
|
|
87
|
-
varchar: string[];
|
|
88
|
-
date: string;
|
|
89
|
-
time: string;
|
|
90
|
-
tinytext: string;
|
|
91
|
-
text: string;
|
|
92
|
-
mediumtext: string;
|
|
93
|
-
longtext: string;
|
|
94
|
-
int: string[];
|
|
95
|
-
'int unsigned': string[];
|
|
96
|
-
integer: string[];
|
|
97
|
-
bigint: string[];
|
|
98
|
-
'bigint unsigned': string[];
|
|
99
|
-
float: string;
|
|
100
|
-
double: string;
|
|
101
|
-
boolean: string;
|
|
102
|
-
decimal: string;
|
|
103
|
-
datetime: string;
|
|
104
|
-
timestamp: string;
|
|
105
|
-
json: string[];
|
|
106
|
-
enum: string;
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
export default _default;
|
|
@@ -1,101 +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 field_type_map_exports = {};
|
|
28
|
-
__export(field_type_map_exports, {
|
|
29
|
-
default: () => field_type_map_default
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(field_type_map_exports);
|
|
32
|
-
const postgres = {
|
|
33
|
-
"character varying": ["string", "uuid", "nanoid"],
|
|
34
|
-
varchar: ["string", "uuid", "nanoid"],
|
|
35
|
-
char: ["string", "uuid", "nanoid"],
|
|
36
|
-
character: "string",
|
|
37
|
-
text: "text",
|
|
38
|
-
oid: "string",
|
|
39
|
-
name: "string",
|
|
40
|
-
smallint: ["integer", "sort"],
|
|
41
|
-
integer: ["integer", "sort"],
|
|
42
|
-
bigint: ["bigInt", "sort"],
|
|
43
|
-
decimal: "decimal",
|
|
44
|
-
numeric: "float",
|
|
45
|
-
real: "float",
|
|
46
|
-
"double precision": "float",
|
|
47
|
-
"timestamp without time zone": "date",
|
|
48
|
-
"timestamp with time zone": "date",
|
|
49
|
-
"time without time zone": "time",
|
|
50
|
-
date: "date",
|
|
51
|
-
boolean: "boolean",
|
|
52
|
-
json: ["json", "array"],
|
|
53
|
-
jsonb: ["json", "array", "jsonb"],
|
|
54
|
-
point: "json",
|
|
55
|
-
path: "json",
|
|
56
|
-
polygon: "json",
|
|
57
|
-
circle: "json",
|
|
58
|
-
uuid: "uuid"
|
|
59
|
-
};
|
|
60
|
-
const mysql = {
|
|
61
|
-
smallint: ["integer", "boolean", "sort"],
|
|
62
|
-
tinyint: ["integer", "boolean", "sort"],
|
|
63
|
-
mediumint: ["integer", "boolean", "sort"],
|
|
64
|
-
"smallint unsigned": ["integer", "boolean", "sort"],
|
|
65
|
-
"tinyint unsigned": ["integer", "boolean", "sort"],
|
|
66
|
-
"mediumint unsigned": ["integer", "boolean", "sort"],
|
|
67
|
-
char: ["string", "uuid", "nanoid"],
|
|
68
|
-
varchar: ["string", "uuid", "nanoid"],
|
|
69
|
-
date: "date",
|
|
70
|
-
time: "time",
|
|
71
|
-
tinytext: "text",
|
|
72
|
-
text: "text",
|
|
73
|
-
mediumtext: "text",
|
|
74
|
-
longtext: "text",
|
|
75
|
-
int: ["integer", "sort"],
|
|
76
|
-
"int unsigned": ["integer", "sort"],
|
|
77
|
-
integer: ["integer", "sort"],
|
|
78
|
-
bigint: ["bigInt", "sort"],
|
|
79
|
-
"bigint unsigned": ["bigInt", "sort"],
|
|
80
|
-
float: "float",
|
|
81
|
-
double: "float",
|
|
82
|
-
boolean: "boolean",
|
|
83
|
-
decimal: "decimal",
|
|
84
|
-
datetime: "date",
|
|
85
|
-
timestamp: "date",
|
|
86
|
-
json: ["json", "array"],
|
|
87
|
-
enum: "string"
|
|
88
|
-
};
|
|
89
|
-
const sqlite = {
|
|
90
|
-
text: "text",
|
|
91
|
-
varchar: ["string", "uuid", "nanoid"],
|
|
92
|
-
integer: "integer",
|
|
93
|
-
real: "real",
|
|
94
|
-
datetime: "date",
|
|
95
|
-
date: "date",
|
|
96
|
-
time: "time",
|
|
97
|
-
boolean: "boolean",
|
|
98
|
-
numeric: "decimal",
|
|
99
|
-
json: ["json", "array"]
|
|
100
|
-
};
|
|
101
|
-
var field_type_map_default = { postgres, mysql, sqlite, mariadb: mysql };
|
|
@@ -1,40 +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 '../database';
|
|
10
|
-
type InferredField = {
|
|
11
|
-
name: string;
|
|
12
|
-
type: string;
|
|
13
|
-
source?: string;
|
|
14
|
-
};
|
|
15
|
-
type InferredFieldResult = {
|
|
16
|
-
[key: string]: InferredField;
|
|
17
|
-
};
|
|
18
|
-
export declare class ViewFieldInference {
|
|
19
|
-
static extractTypeFromDefinition(typeDefinition: any): any;
|
|
20
|
-
static inferFields(options: {
|
|
21
|
-
db: Database;
|
|
22
|
-
viewName: string;
|
|
23
|
-
viewSchema?: string;
|
|
24
|
-
}): Promise<InferredFieldResult>;
|
|
25
|
-
static inferToFieldType(options: {
|
|
26
|
-
name: string;
|
|
27
|
-
type: string;
|
|
28
|
-
dialect: string;
|
|
29
|
-
}): {
|
|
30
|
-
possibleTypes: string[];
|
|
31
|
-
type?: undefined;
|
|
32
|
-
} | {
|
|
33
|
-
type: any;
|
|
34
|
-
possibleTypes: any[];
|
|
35
|
-
} | {
|
|
36
|
-
type: any;
|
|
37
|
-
possibleTypes?: undefined;
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
export {};
|