@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
package/lib/utils.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var __create = Object.create;
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
17
|
-
var __export = (target, all) => {
|
|
18
|
-
for (var name in all)
|
|
19
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
20
|
-
};
|
|
21
|
-
var __copyProps = (to, from, except, desc) => {
|
|
22
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
-
for (let key of __getOwnPropNames(from))
|
|
24
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
25
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
26
|
-
}
|
|
27
|
-
return to;
|
|
28
|
-
};
|
|
29
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
-
mod
|
|
36
|
-
));
|
|
37
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
-
var utils_exports = {};
|
|
39
|
-
__export(utils_exports, {
|
|
40
|
-
checkIdentifier: () => checkIdentifier,
|
|
41
|
-
getTableName: () => getTableName,
|
|
42
|
-
md5: () => md5,
|
|
43
|
-
patchSequelizeQueryInterface: () => patchSequelizeQueryInterface,
|
|
44
|
-
percent2float: () => percent2float,
|
|
45
|
-
snakeCase: () => snakeCase
|
|
46
|
-
});
|
|
47
|
-
module.exports = __toCommonJS(utils_exports);
|
|
48
|
-
var import_crypto = __toESM(require("crypto"));
|
|
49
|
-
var import_identifier_error = require("./errors/identifier-error");
|
|
50
|
-
var import_lodash = __toESM(require("lodash"));
|
|
51
|
-
function md5(value) {
|
|
52
|
-
return import_crypto.default.createHash("md5").update(value).digest("hex");
|
|
53
|
-
}
|
|
54
|
-
__name(md5, "md5");
|
|
55
|
-
const MAX_IDENTIFIER_LENGTH = 63;
|
|
56
|
-
function checkIdentifier(value) {
|
|
57
|
-
if (value.length > MAX_IDENTIFIER_LENGTH) {
|
|
58
|
-
throw new import_identifier_error.IdentifierError(`Identifier ${value} is too long`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
__name(checkIdentifier, "checkIdentifier");
|
|
62
|
-
function getTableName(collectionName, options) {
|
|
63
|
-
return options.underscored ? snakeCase(collectionName) : collectionName;
|
|
64
|
-
}
|
|
65
|
-
__name(getTableName, "getTableName");
|
|
66
|
-
function snakeCase(name) {
|
|
67
|
-
return require("sequelize").Utils.underscore(name);
|
|
68
|
-
}
|
|
69
|
-
__name(snakeCase, "snakeCase");
|
|
70
|
-
function patchShowConstraintsQuery(queryGenerator, db) {
|
|
71
|
-
queryGenerator.showConstraintsQuery = (tableName, constraintName) => {
|
|
72
|
-
const lines = [
|
|
73
|
-
'SELECT constraint_catalog AS "constraintCatalog",',
|
|
74
|
-
'constraint_schema AS "constraintSchema",',
|
|
75
|
-
'constraint_name AS "constraintName",',
|
|
76
|
-
'table_catalog AS "tableCatalog",',
|
|
77
|
-
'table_schema AS "tableSchema",',
|
|
78
|
-
'table_name AS "tableName",',
|
|
79
|
-
'constraint_type AS "constraintType",',
|
|
80
|
-
'is_deferrable AS "isDeferrable",',
|
|
81
|
-
'initially_deferred AS "initiallyDeferred"',
|
|
82
|
-
"from INFORMATION_SCHEMA.table_constraints",
|
|
83
|
-
`WHERE table_name='${import_lodash.default.isPlainObject(tableName) ? tableName.tableName : tableName}'`
|
|
84
|
-
];
|
|
85
|
-
if (constraintName) {
|
|
86
|
-
lines.push(`AND constraint_name='${constraintName}'`);
|
|
87
|
-
}
|
|
88
|
-
if (import_lodash.default.isPlainObject(tableName) && tableName.schema) {
|
|
89
|
-
lines.push(`AND table_schema='${tableName.schema}'`);
|
|
90
|
-
}
|
|
91
|
-
return lines.join(" ");
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
__name(patchShowConstraintsQuery, "patchShowConstraintsQuery");
|
|
95
|
-
function patchDescribeTableQuery(queryGenerator) {
|
|
96
|
-
const describeTableQuery = /* @__PURE__ */ __name(function(tableName, schema) {
|
|
97
|
-
schema = schema || this.options.schema || "public";
|
|
98
|
-
return `SELECT pk.constraint_type as "Constraint",c.column_name as "Field", c.column_default as "Default",c.is_nullable as "Null", (CASE WHEN c.udt_name = 'hstore' THEN c.udt_name ELSE c.data_type END) || (CASE WHEN c.character_maximum_length IS NOT NULL THEN '(' || c.character_maximum_length || ')' ELSE '' END) as "Type", (SELECT array_agg(e.enumlabel) FROM pg_catalog.pg_type t JOIN pg_catalog.pg_enum e ON t.oid=e.enumtypid WHERE t.typname=c.udt_name) AS "special", (SELECT pgd.description FROM pg_catalog.pg_statio_all_tables AS st INNER JOIN pg_catalog.pg_description pgd on (pgd.objoid=st.relid) WHERE c.ordinal_position=pgd.objsubid AND c.table_name=st.relname AND st.schemaname = c.table_schema) AS "Comment" FROM information_schema.columns c LEFT JOIN (SELECT tc.table_schema, tc.table_name, cu.column_name, tc.constraint_type FROM information_schema.TABLE_CONSTRAINTS tc JOIN information_schema.KEY_COLUMN_USAGE cu ON tc.table_schema=cu.table_schema and tc.table_name=cu.table_name and tc.constraint_name=cu.constraint_name and tc.constraint_type='PRIMARY KEY') pk ON pk.table_schema=c.table_schema AND pk.table_name=c.table_name AND pk.column_name=c.column_name WHERE c.table_name = ${this.escape(tableName)} AND c.table_schema = ${this.escape(schema)}`;
|
|
99
|
-
}, "describeTableQuery");
|
|
100
|
-
queryGenerator.describeTableQuery = describeTableQuery.bind(queryGenerator);
|
|
101
|
-
}
|
|
102
|
-
__name(patchDescribeTableQuery, "patchDescribeTableQuery");
|
|
103
|
-
function patchSequelizeQueryInterface(db) {
|
|
104
|
-
if (db.inDialect("postgres")) {
|
|
105
|
-
const queryGenerator = db.sequelize.dialect.queryGenerator;
|
|
106
|
-
patchShowConstraintsQuery(queryGenerator, db);
|
|
107
|
-
patchDescribeTableQuery(queryGenerator);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
__name(patchSequelizeQueryInterface, "patchSequelizeQueryInterface");
|
|
111
|
-
function percent2float(value) {
|
|
112
|
-
if (!value.endsWith("%")) {
|
|
113
|
-
return NaN;
|
|
114
|
-
}
|
|
115
|
-
const val = value.substring(0, value.length - 1);
|
|
116
|
-
if (isNaN(+val)) {
|
|
117
|
-
return NaN;
|
|
118
|
-
}
|
|
119
|
-
const index = value.indexOf(".");
|
|
120
|
-
if (index === -1) {
|
|
121
|
-
return parseFloat(value) / 100;
|
|
122
|
-
}
|
|
123
|
-
const repeat = value.length - index - 2;
|
|
124
|
-
const v = parseInt("1" + "0".repeat(repeat));
|
|
125
|
-
return parseFloat(value) * v / (100 * v);
|
|
126
|
-
}
|
|
127
|
-
__name(percent2float, "percent2float");
|
|
128
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
129
|
-
0 && (module.exports = {
|
|
130
|
-
checkIdentifier,
|
|
131
|
-
getTableName,
|
|
132
|
-
md5,
|
|
133
|
-
patchSequelizeQueryInterface,
|
|
134
|
-
percent2float,
|
|
135
|
-
snakeCase
|
|
136
|
-
});
|
|
@@ -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 ArrayValueParser extends BaseValueParser {
|
|
11
|
-
setValue(value: any): Promise<void>;
|
|
12
|
-
getOptions(): {
|
|
13
|
-
map: Map<any, any>;
|
|
14
|
-
set: Set<unknown>;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
@@ -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 array_value_parser_exports = {};
|
|
29
|
-
__export(array_value_parser_exports, {
|
|
30
|
-
ArrayValueParser: () => ArrayValueParser
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(array_value_parser_exports);
|
|
33
|
-
var import_base_value_parser = require("./base-value-parser");
|
|
34
|
-
const _ArrayValueParser = class _ArrayValueParser extends import_base_value_parser.BaseValueParser {
|
|
35
|
-
async setValue(value) {
|
|
36
|
-
const { map, set } = this.getOptions();
|
|
37
|
-
const values = this.toArr(value);
|
|
38
|
-
if (set.size > 0) {
|
|
39
|
-
const filtered = values.map((v) => map.has(v) ? map.get(v) : v).filter((v) => set.has(v));
|
|
40
|
-
if (values.length === filtered.length) {
|
|
41
|
-
this.value = filtered;
|
|
42
|
-
} else {
|
|
43
|
-
this.errors.push(`No matching option found - ${JSON.stringify(value)}`);
|
|
44
|
-
}
|
|
45
|
-
} else {
|
|
46
|
-
this.value = values;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
getOptions() {
|
|
50
|
-
var _a, _b;
|
|
51
|
-
const options = ((_b = (_a = this.field.options) == null ? void 0 : _a["uiSchema"]) == null ? void 0 : _b.enum) || [];
|
|
52
|
-
const map = /* @__PURE__ */ new Map();
|
|
53
|
-
const set = /* @__PURE__ */ new Set();
|
|
54
|
-
for (const option of options) {
|
|
55
|
-
set.add(option.value);
|
|
56
|
-
set.add(option.label);
|
|
57
|
-
map.set(option.label, option.value);
|
|
58
|
-
}
|
|
59
|
-
return { map, set };
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
__name(_ArrayValueParser, "ArrayValueParser");
|
|
63
|
-
let ArrayValueParser = _ArrayValueParser;
|
|
64
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
-
0 && (module.exports = {
|
|
66
|
-
ArrayValueParser
|
|
67
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
export declare class BaseValueParser {
|
|
10
|
-
ctx: any;
|
|
11
|
-
field: any;
|
|
12
|
-
value: any;
|
|
13
|
-
errors: string[];
|
|
14
|
-
constructor(field: any, ctx: any);
|
|
15
|
-
trim(value: any): any;
|
|
16
|
-
toArr(value: any, splitter?: string): any[];
|
|
17
|
-
toString(): any;
|
|
18
|
-
getValue(): any;
|
|
19
|
-
setValue(value: any): Promise<void>;
|
|
20
|
-
}
|
|
@@ -1,72 +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 base_value_parser_exports = {};
|
|
29
|
-
__export(base_value_parser_exports, {
|
|
30
|
-
BaseValueParser: () => BaseValueParser
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(base_value_parser_exports);
|
|
33
|
-
const _BaseValueParser = class _BaseValueParser {
|
|
34
|
-
ctx;
|
|
35
|
-
field;
|
|
36
|
-
value;
|
|
37
|
-
errors = [];
|
|
38
|
-
constructor(field, ctx) {
|
|
39
|
-
this.field = field;
|
|
40
|
-
this.ctx = ctx;
|
|
41
|
-
this.value = null;
|
|
42
|
-
}
|
|
43
|
-
trim(value) {
|
|
44
|
-
return typeof value === "string" ? value.trim() : value;
|
|
45
|
-
}
|
|
46
|
-
toArr(value, splitter) {
|
|
47
|
-
let values = [];
|
|
48
|
-
if (!value) {
|
|
49
|
-
values = [];
|
|
50
|
-
} else if (typeof value === "string") {
|
|
51
|
-
values = value.split(splitter || /,|,|、/);
|
|
52
|
-
} else if (Array.isArray(value)) {
|
|
53
|
-
values = value;
|
|
54
|
-
}
|
|
55
|
-
return values.map((v) => this.trim(v)).filter(Boolean);
|
|
56
|
-
}
|
|
57
|
-
toString() {
|
|
58
|
-
return this.value;
|
|
59
|
-
}
|
|
60
|
-
getValue() {
|
|
61
|
-
return this.value;
|
|
62
|
-
}
|
|
63
|
-
async setValue(value) {
|
|
64
|
-
this.value = value;
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
__name(_BaseValueParser, "BaseValueParser");
|
|
68
|
-
let BaseValueParser = _BaseValueParser;
|
|
69
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
70
|
-
0 && (module.exports = {
|
|
71
|
-
BaseValueParser
|
|
72
|
-
});
|
|
@@ -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 BooleanValueParser extends BaseValueParser {
|
|
11
|
-
setValue(value: any): Promise<void>;
|
|
12
|
-
}
|
|
@@ -1,61 +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 boolean_value_parser_exports = {};
|
|
29
|
-
__export(boolean_value_parser_exports, {
|
|
30
|
-
BooleanValueParser: () => BooleanValueParser
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(boolean_value_parser_exports);
|
|
33
|
-
var import_base_value_parser = require("./base-value-parser");
|
|
34
|
-
const _BooleanValueParser = class _BooleanValueParser extends import_base_value_parser.BaseValueParser {
|
|
35
|
-
async setValue(value) {
|
|
36
|
-
if (typeof value === "boolean") {
|
|
37
|
-
this.value = value;
|
|
38
|
-
} else if (typeof value === "number" && [0, 1].includes(value)) {
|
|
39
|
-
this.value = value === 1;
|
|
40
|
-
} else if (typeof value === "string") {
|
|
41
|
-
if (!value) {
|
|
42
|
-
this.value = null;
|
|
43
|
-
}
|
|
44
|
-
if (["1", "y", "yes", "true", "\u662F"].includes(value.toLowerCase())) {
|
|
45
|
-
this.value = true;
|
|
46
|
-
} else if (["0", "n", "no", "false", "\u5426"].includes(value.toLowerCase())) {
|
|
47
|
-
this.value = false;
|
|
48
|
-
} else {
|
|
49
|
-
this.errors.push(`Invalid value - ${JSON.stringify(this.value)}`);
|
|
50
|
-
}
|
|
51
|
-
} else {
|
|
52
|
-
this.errors.push(`Invalid value - ${JSON.stringify(this.value)}`);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
__name(_BooleanValueParser, "BooleanValueParser");
|
|
57
|
-
let BooleanValueParser = _BooleanValueParser;
|
|
58
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
-
0 && (module.exports = {
|
|
60
|
-
BooleanValueParser
|
|
61
|
-
});
|
|
@@ -1,13 +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 DateValueParser extends BaseValueParser {
|
|
11
|
-
setValue(value: any): Promise<void>;
|
|
12
|
-
getProps(): any;
|
|
13
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
var __create = Object.create;
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
17
|
-
var __export = (target, all) => {
|
|
18
|
-
for (var name in all)
|
|
19
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
20
|
-
};
|
|
21
|
-
var __copyProps = (to, from, except, desc) => {
|
|
22
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
-
for (let key of __getOwnPropNames(from))
|
|
24
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
25
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
26
|
-
}
|
|
27
|
-
return to;
|
|
28
|
-
};
|
|
29
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
-
mod
|
|
36
|
-
));
|
|
37
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
-
var date_value_parser_exports = {};
|
|
39
|
-
__export(date_value_parser_exports, {
|
|
40
|
-
DateValueParser: () => DateValueParser
|
|
41
|
-
});
|
|
42
|
-
module.exports = __toCommonJS(date_value_parser_exports);
|
|
43
|
-
var import_utils = require("@nocobase/utils");
|
|
44
|
-
var import_dayjs = __toESM(require("dayjs"));
|
|
45
|
-
var import_excel_date_to_js = require("excel-date-to-js");
|
|
46
|
-
var import_base_value_parser = require("./base-value-parser");
|
|
47
|
-
function isNumeric(str) {
|
|
48
|
-
if (typeof str === "number")
|
|
49
|
-
return true;
|
|
50
|
-
if (typeof str != "string")
|
|
51
|
-
return false;
|
|
52
|
-
return !isNaN(str) && !isNaN(parseFloat(str));
|
|
53
|
-
}
|
|
54
|
-
__name(isNumeric, "isNumeric");
|
|
55
|
-
const _DateValueParser = class _DateValueParser extends import_base_value_parser.BaseValueParser {
|
|
56
|
-
async setValue(value) {
|
|
57
|
-
if (typeof value === "string") {
|
|
58
|
-
const match = /^(\d{4})[-/]?(\d{2})[-/]?(\d{2})$/.exec(value);
|
|
59
|
-
if (match) {
|
|
60
|
-
const m = (0, import_dayjs.default)(`${match[1]}-${match[2]}-${match[3]} 00:00:00.000`);
|
|
61
|
-
this.value = m.toISOString();
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
if (import_dayjs.default.isDayjs(value)) {
|
|
66
|
-
this.value = value;
|
|
67
|
-
} else if (isDate(value)) {
|
|
68
|
-
this.value = value;
|
|
69
|
-
} else if (isNumeric(value)) {
|
|
70
|
-
try {
|
|
71
|
-
this.value = (0, import_excel_date_to_js.getJsDateFromExcel)(value).toISOString();
|
|
72
|
-
} catch (error) {
|
|
73
|
-
this.errors.push(`Invalid date - ${error.message}`);
|
|
74
|
-
}
|
|
75
|
-
} else if (typeof value === "string") {
|
|
76
|
-
const props = this.getProps();
|
|
77
|
-
const m = (0, import_dayjs.default)(value);
|
|
78
|
-
if (m.isValid()) {
|
|
79
|
-
this.value = (0, import_utils.moment2str)(m, props);
|
|
80
|
-
} else {
|
|
81
|
-
this.errors.push("Invalid date");
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
getProps() {
|
|
86
|
-
var _a, _b;
|
|
87
|
-
return ((_b = (_a = this.field.options) == null ? void 0 : _a.uiSchema) == null ? void 0 : _b["x-component-props"]) || {};
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
__name(_DateValueParser, "DateValueParser");
|
|
91
|
-
let DateValueParser = _DateValueParser;
|
|
92
|
-
function isDate(v) {
|
|
93
|
-
return v instanceof Date;
|
|
94
|
-
}
|
|
95
|
-
__name(isDate, "isDate");
|
|
96
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
97
|
-
0 && (module.exports = {
|
|
98
|
-
DateValueParser
|
|
99
|
-
});
|
|
@@ -1,20 +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
|
-
import { ArrayValueParser } from './array-value-parser';
|
|
11
|
-
import { BaseValueParser } from './base-value-parser';
|
|
12
|
-
import { BooleanValueParser } from './boolean-value-parser';
|
|
13
|
-
import { DateValueParser } from './date-value-parser';
|
|
14
|
-
import { JsonValueParser } from './json-value-parser';
|
|
15
|
-
import { NumberValueParser } from './number-value-parser';
|
|
16
|
-
import { StringValueParser } from './string-value-parser';
|
|
17
|
-
import { ToManyValueParser } from './to-many-value-parser';
|
|
18
|
-
import { ToOneValueParser } from './to-one-value-parser';
|
|
19
|
-
export declare function registerFieldValueParsers(db: Database): void;
|
|
20
|
-
export { ArrayValueParser, BaseValueParser, BooleanValueParser, DateValueParser, JsonValueParser, NumberValueParser, StringValueParser, ToManyValueParser, ToOneValueParser, };
|
|
@@ -1,87 +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 value_parsers_exports = {};
|
|
29
|
-
__export(value_parsers_exports, {
|
|
30
|
-
ArrayValueParser: () => import_array_value_parser.ArrayValueParser,
|
|
31
|
-
BaseValueParser: () => import_base_value_parser.BaseValueParser,
|
|
32
|
-
BooleanValueParser: () => import_boolean_value_parser.BooleanValueParser,
|
|
33
|
-
DateValueParser: () => import_date_value_parser.DateValueParser,
|
|
34
|
-
JsonValueParser: () => import_json_value_parser.JsonValueParser,
|
|
35
|
-
NumberValueParser: () => import_number_value_parser.NumberValueParser,
|
|
36
|
-
StringValueParser: () => import_string_value_parser.StringValueParser,
|
|
37
|
-
ToManyValueParser: () => import_to_many_value_parser.ToManyValueParser,
|
|
38
|
-
ToOneValueParser: () => import_to_one_value_parser.ToOneValueParser,
|
|
39
|
-
registerFieldValueParsers: () => registerFieldValueParsers
|
|
40
|
-
});
|
|
41
|
-
module.exports = __toCommonJS(value_parsers_exports);
|
|
42
|
-
var import_array_value_parser = require("./array-value-parser");
|
|
43
|
-
var import_base_value_parser = require("./base-value-parser");
|
|
44
|
-
var import_boolean_value_parser = require("./boolean-value-parser");
|
|
45
|
-
var import_date_value_parser = require("./date-value-parser");
|
|
46
|
-
var import_json_value_parser = require("./json-value-parser");
|
|
47
|
-
var import_number_value_parser = require("./number-value-parser");
|
|
48
|
-
var import_string_value_parser = require("./string-value-parser");
|
|
49
|
-
var import_to_many_value_parser = require("./to-many-value-parser");
|
|
50
|
-
var import_to_one_value_parser = require("./to-one-value-parser");
|
|
51
|
-
function registerFieldValueParsers(db) {
|
|
52
|
-
db.registerFieldValueParsers({
|
|
53
|
-
default: import_base_value_parser.BaseValueParser,
|
|
54
|
-
array: import_array_value_parser.ArrayValueParser,
|
|
55
|
-
set: import_array_value_parser.ArrayValueParser,
|
|
56
|
-
boolean: import_boolean_value_parser.BooleanValueParser,
|
|
57
|
-
date: import_date_value_parser.DateValueParser,
|
|
58
|
-
json: import_json_value_parser.JsonValueParser,
|
|
59
|
-
jsonb: import_json_value_parser.JsonValueParser,
|
|
60
|
-
number: import_number_value_parser.NumberValueParser,
|
|
61
|
-
integer: import_number_value_parser.NumberValueParser,
|
|
62
|
-
bigInt: import_number_value_parser.NumberValueParser,
|
|
63
|
-
float: import_number_value_parser.NumberValueParser,
|
|
64
|
-
double: import_number_value_parser.NumberValueParser,
|
|
65
|
-
real: import_number_value_parser.NumberValueParser,
|
|
66
|
-
decimal: import_number_value_parser.NumberValueParser,
|
|
67
|
-
string: import_string_value_parser.StringValueParser,
|
|
68
|
-
hasOne: import_to_one_value_parser.ToOneValueParser,
|
|
69
|
-
hasMany: import_to_many_value_parser.ToManyValueParser,
|
|
70
|
-
belongsTo: import_to_one_value_parser.ToOneValueParser,
|
|
71
|
-
belongsToMany: import_to_many_value_parser.ToManyValueParser
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
__name(registerFieldValueParsers, "registerFieldValueParsers");
|
|
75
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
76
|
-
0 && (module.exports = {
|
|
77
|
-
ArrayValueParser,
|
|
78
|
-
BaseValueParser,
|
|
79
|
-
BooleanValueParser,
|
|
80
|
-
DateValueParser,
|
|
81
|
-
JsonValueParser,
|
|
82
|
-
NumberValueParser,
|
|
83
|
-
StringValueParser,
|
|
84
|
-
ToManyValueParser,
|
|
85
|
-
ToOneValueParser,
|
|
86
|
-
registerFieldValueParsers
|
|
87
|
-
});
|
|
@@ -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 JsonValueParser extends BaseValueParser {
|
|
11
|
-
setValue(value: any): Promise<void>;
|
|
12
|
-
}
|