@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,159 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
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 has_one_field_exports = {};
|
|
29
|
-
__export(has_one_field_exports, {
|
|
30
|
-
HasOneField: () => HasOneField
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(has_one_field_exports);
|
|
33
|
-
var import_lodash = require("lodash");
|
|
34
|
-
var import_sequelize = require("sequelize");
|
|
35
|
-
var import_references_map = require("../features/references-map");
|
|
36
|
-
var import_utils = require("../utils");
|
|
37
|
-
var import_relation_field = require("./relation-field");
|
|
38
|
-
const _HasOneField = class _HasOneField extends import_relation_field.RelationField {
|
|
39
|
-
get dataType() {
|
|
40
|
-
return "HasOne";
|
|
41
|
-
}
|
|
42
|
-
get target() {
|
|
43
|
-
const { target, name } = this.options;
|
|
44
|
-
return target || import_sequelize.Utils.pluralize(name);
|
|
45
|
-
}
|
|
46
|
-
get foreignKey() {
|
|
47
|
-
const foreignKey = (() => {
|
|
48
|
-
if (this.options.foreignKey) {
|
|
49
|
-
return this.options.foreignKey;
|
|
50
|
-
}
|
|
51
|
-
const { model } = this.context.collection;
|
|
52
|
-
return import_sequelize.Utils.camelize([model.options.name.singular, model.primaryKeyAttribute].join("_"));
|
|
53
|
-
})();
|
|
54
|
-
return foreignKey;
|
|
55
|
-
}
|
|
56
|
-
reference(association) {
|
|
57
|
-
const sourceKey = association.sourceKey;
|
|
58
|
-
return (0, import_references_map.buildReference)({
|
|
59
|
-
sourceCollectionName: this.database.modelCollection.get(association.target).name,
|
|
60
|
-
sourceField: association.foreignKey,
|
|
61
|
-
targetField: sourceKey,
|
|
62
|
-
targetCollectionName: this.database.modelCollection.get(association.source).name,
|
|
63
|
-
onDelete: this.options.onDelete
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
checkAssociationKeys() {
|
|
67
|
-
let { foreignKey, sourceKey } = this.options;
|
|
68
|
-
if (!sourceKey) {
|
|
69
|
-
sourceKey = this.collection.model.primaryKeyAttribute;
|
|
70
|
-
}
|
|
71
|
-
if (!foreignKey) {
|
|
72
|
-
foreignKey = import_sequelize.Utils.camelize([import_sequelize.Utils.singularize(this.name), this.collection.model.primaryKeyAttribute].join("_"));
|
|
73
|
-
}
|
|
74
|
-
const foreignKeyAttribute = this.TargetModel.rawAttributes[foreignKey];
|
|
75
|
-
const sourceKeyAttribute = this.collection.model.rawAttributes[sourceKey];
|
|
76
|
-
if (!foreignKeyAttribute || !sourceKeyAttribute) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
const foreignKeyType = foreignKeyAttribute.type.constructor.toString();
|
|
80
|
-
const sourceKeyType = sourceKeyAttribute.type.constructor.toString();
|
|
81
|
-
if (!this.keyPairsTypeMatched(foreignKeyType, sourceKeyType)) {
|
|
82
|
-
throw new Error(
|
|
83
|
-
`Foreign key "${foreignKey}" type "${foreignKeyType}" does not match source key "${sourceKey}" type "${sourceKeyType}" in has one relation "${this.name}" of collection "${this.collection.name}"`
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
bind() {
|
|
88
|
-
const { database, collection } = this.context;
|
|
89
|
-
const Target = this.TargetModel;
|
|
90
|
-
if (!Target) {
|
|
91
|
-
database.addPendingField(this);
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
this.checkAssociationKeys();
|
|
95
|
-
const association = collection.model.hasOne(Target, {
|
|
96
|
-
constraints: false,
|
|
97
|
-
...(0, import_lodash.omit)(this.options, ["name", "type", "target", "onDelete"]),
|
|
98
|
-
as: this.name,
|
|
99
|
-
foreignKey: this.foreignKey
|
|
100
|
-
});
|
|
101
|
-
database.removePendingField(this);
|
|
102
|
-
if (!this.options.foreignKey) {
|
|
103
|
-
this.options.foreignKey = association.foreignKey;
|
|
104
|
-
}
|
|
105
|
-
if (!this.options.sourceKey) {
|
|
106
|
-
this.options.sourceKey = association.sourceKey;
|
|
107
|
-
}
|
|
108
|
-
try {
|
|
109
|
-
(0, import_utils.checkIdentifier)(this.options.foreignKey);
|
|
110
|
-
} catch (error) {
|
|
111
|
-
this.unbind();
|
|
112
|
-
throw error;
|
|
113
|
-
}
|
|
114
|
-
if (!this.options.sourceKey) {
|
|
115
|
-
this.options.sourceKey = association.sourceKey;
|
|
116
|
-
}
|
|
117
|
-
let tcoll;
|
|
118
|
-
if (this.target === collection.name) {
|
|
119
|
-
tcoll = collection;
|
|
120
|
-
} else {
|
|
121
|
-
tcoll = database.getCollection(this.target);
|
|
122
|
-
}
|
|
123
|
-
if (tcoll) {
|
|
124
|
-
tcoll.addIndex([this.options.foreignKey]);
|
|
125
|
-
}
|
|
126
|
-
this.database.referenceMap.addReference(this.reference(association));
|
|
127
|
-
return true;
|
|
128
|
-
}
|
|
129
|
-
unbind() {
|
|
130
|
-
const { database, collection } = this.context;
|
|
131
|
-
database.removePendingField(this);
|
|
132
|
-
const tcoll = database.collections.get(this.target);
|
|
133
|
-
if (tcoll && !this.options.inherit) {
|
|
134
|
-
const foreignKey = this.options.foreignKey;
|
|
135
|
-
const field = tcoll.findField((field2) => {
|
|
136
|
-
if (field2.name === foreignKey) {
|
|
137
|
-
return true;
|
|
138
|
-
}
|
|
139
|
-
return field2.type === "belongsTo" && field2.foreignKey === foreignKey;
|
|
140
|
-
});
|
|
141
|
-
if (!field) {
|
|
142
|
-
tcoll.model.removeAttribute(foreignKey);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
const association = collection.model.associations[this.name];
|
|
146
|
-
if (association && !this.options.inherit) {
|
|
147
|
-
this.database.referenceMap.removeReference(this.reference(association));
|
|
148
|
-
}
|
|
149
|
-
this.clearAccessors();
|
|
150
|
-
delete collection.model.associations[this.name];
|
|
151
|
-
collection.model.refreshAttributes();
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
__name(_HasOneField, "HasOneField");
|
|
155
|
-
let HasOneField = _HasOneField;
|
|
156
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
157
|
-
0 && (module.exports = {
|
|
158
|
-
HasOneField
|
|
159
|
-
});
|
package/lib/fields/index.d.ts
DELETED
|
@@ -1,54 +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 { ArrayFieldOptions } from './array-field';
|
|
10
|
-
import { BelongsToFieldOptions } from './belongs-to-field';
|
|
11
|
-
import { BelongsToManyFieldOptions } from './belongs-to-many-field';
|
|
12
|
-
import { BooleanFieldOptions } from './boolean-field';
|
|
13
|
-
import { ContextFieldOptions } from './context-field';
|
|
14
|
-
import { DateFieldOptions } from './date-field';
|
|
15
|
-
import { BaseFieldOptions } from './field';
|
|
16
|
-
import { HasManyFieldOptions } from './has-many-field';
|
|
17
|
-
import { HasOneFieldOptions } from './has-one-field';
|
|
18
|
-
import { JsonbFieldOptions, JsonFieldOptions } from './json-field';
|
|
19
|
-
import { DecimalFieldOptions, DoubleFieldOptions, FloatFieldOptions, IntegerFieldOptions, RealFieldOptions } from './number-field';
|
|
20
|
-
import { PasswordFieldOptions } from './password-field';
|
|
21
|
-
import { RadioFieldOptions } from './radio-field';
|
|
22
|
-
import { SetFieldOptions } from './set-field';
|
|
23
|
-
import { SortFieldOptions } from './sort-field';
|
|
24
|
-
import { StringFieldOptions } from './string-field';
|
|
25
|
-
import { TextFieldOptions } from './text-field';
|
|
26
|
-
import { TimeFieldOptions } from './time-field';
|
|
27
|
-
import { UidFieldOptions } from './uid-field';
|
|
28
|
-
import { UUIDFieldOptions } from './uuid-field';
|
|
29
|
-
import { VirtualFieldOptions } from './virtual-field';
|
|
30
|
-
import { NanoidFieldOptions } from './nanoid-field';
|
|
31
|
-
export * from './array-field';
|
|
32
|
-
export * from './belongs-to-field';
|
|
33
|
-
export * from './belongs-to-many-field';
|
|
34
|
-
export * from './boolean-field';
|
|
35
|
-
export * from './context-field';
|
|
36
|
-
export * from './date-field';
|
|
37
|
-
export * from './field';
|
|
38
|
-
export * from './has-many-field';
|
|
39
|
-
export * from './has-one-field';
|
|
40
|
-
export * from './json-field';
|
|
41
|
-
export * from './number-field';
|
|
42
|
-
export * from './password-field';
|
|
43
|
-
export * from './radio-field';
|
|
44
|
-
export * from './relation-field';
|
|
45
|
-
export * from './set-field';
|
|
46
|
-
export * from './sort-field';
|
|
47
|
-
export * from './string-field';
|
|
48
|
-
export * from './text-field';
|
|
49
|
-
export * from './time-field';
|
|
50
|
-
export * from './uid-field';
|
|
51
|
-
export * from './uuid-field';
|
|
52
|
-
export * from './virtual-field';
|
|
53
|
-
export * from './nanoid-field';
|
|
54
|
-
export type FieldOptions = BaseFieldOptions | StringFieldOptions | IntegerFieldOptions | FloatFieldOptions | DecimalFieldOptions | DoubleFieldOptions | RealFieldOptions | JsonFieldOptions | JsonbFieldOptions | BooleanFieldOptions | RadioFieldOptions | SortFieldOptions | TextFieldOptions | VirtualFieldOptions | ArrayFieldOptions | SetFieldOptions | TimeFieldOptions | DateFieldOptions | UidFieldOptions | UUIDFieldOptions | NanoidFieldOptions | PasswordFieldOptions | ContextFieldOptions | BelongsToFieldOptions | HasOneFieldOptions | HasManyFieldOptions | BelongsToManyFieldOptions;
|
package/lib/fields/index.js
DELETED
|
@@ -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 __copyProps = (to, from, except, desc) => {
|
|
15
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
-
for (let key of __getOwnPropNames(from))
|
|
17
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
23
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
-
var fields_exports = {};
|
|
25
|
-
module.exports = __toCommonJS(fields_exports);
|
|
26
|
-
__reExport(fields_exports, require("./array-field"), module.exports);
|
|
27
|
-
__reExport(fields_exports, require("./belongs-to-field"), module.exports);
|
|
28
|
-
__reExport(fields_exports, require("./belongs-to-many-field"), module.exports);
|
|
29
|
-
__reExport(fields_exports, require("./boolean-field"), module.exports);
|
|
30
|
-
__reExport(fields_exports, require("./context-field"), module.exports);
|
|
31
|
-
__reExport(fields_exports, require("./date-field"), module.exports);
|
|
32
|
-
__reExport(fields_exports, require("./field"), module.exports);
|
|
33
|
-
__reExport(fields_exports, require("./has-many-field"), module.exports);
|
|
34
|
-
__reExport(fields_exports, require("./has-one-field"), module.exports);
|
|
35
|
-
__reExport(fields_exports, require("./json-field"), module.exports);
|
|
36
|
-
__reExport(fields_exports, require("./number-field"), module.exports);
|
|
37
|
-
__reExport(fields_exports, require("./password-field"), module.exports);
|
|
38
|
-
__reExport(fields_exports, require("./radio-field"), module.exports);
|
|
39
|
-
__reExport(fields_exports, require("./relation-field"), module.exports);
|
|
40
|
-
__reExport(fields_exports, require("./set-field"), module.exports);
|
|
41
|
-
__reExport(fields_exports, require("./sort-field"), module.exports);
|
|
42
|
-
__reExport(fields_exports, require("./string-field"), module.exports);
|
|
43
|
-
__reExport(fields_exports, require("./text-field"), module.exports);
|
|
44
|
-
__reExport(fields_exports, require("./time-field"), module.exports);
|
|
45
|
-
__reExport(fields_exports, require("./uid-field"), module.exports);
|
|
46
|
-
__reExport(fields_exports, require("./uuid-field"), module.exports);
|
|
47
|
-
__reExport(fields_exports, require("./virtual-field"), module.exports);
|
|
48
|
-
__reExport(fields_exports, require("./nanoid-field"), module.exports);
|
|
49
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
-
0 && (module.exports = {
|
|
51
|
-
...require("./array-field"),
|
|
52
|
-
...require("./belongs-to-field"),
|
|
53
|
-
...require("./belongs-to-many-field"),
|
|
54
|
-
...require("./boolean-field"),
|
|
55
|
-
...require("./context-field"),
|
|
56
|
-
...require("./date-field"),
|
|
57
|
-
...require("./field"),
|
|
58
|
-
...require("./has-many-field"),
|
|
59
|
-
...require("./has-one-field"),
|
|
60
|
-
...require("./json-field"),
|
|
61
|
-
...require("./number-field"),
|
|
62
|
-
...require("./password-field"),
|
|
63
|
-
...require("./radio-field"),
|
|
64
|
-
...require("./relation-field"),
|
|
65
|
-
...require("./set-field"),
|
|
66
|
-
...require("./sort-field"),
|
|
67
|
-
...require("./string-field"),
|
|
68
|
-
...require("./text-field"),
|
|
69
|
-
...require("./time-field"),
|
|
70
|
-
...require("./uid-field"),
|
|
71
|
-
...require("./uuid-field"),
|
|
72
|
-
...require("./virtual-field"),
|
|
73
|
-
...require("./nanoid-field")
|
|
74
|
-
});
|
|
@@ -1,22 +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 { DataTypes } from 'sequelize';
|
|
10
|
-
import { BaseColumnFieldOptions, Field } from './field';
|
|
11
|
-
export declare class JsonField extends Field {
|
|
12
|
-
get dataType(): DataTypes.AbstractDataTypeConstructor;
|
|
13
|
-
}
|
|
14
|
-
export interface JsonFieldOptions extends BaseColumnFieldOptions {
|
|
15
|
-
type: 'json';
|
|
16
|
-
}
|
|
17
|
-
export declare class JsonbField extends Field {
|
|
18
|
-
get dataType(): DataTypes.AbstractDataTypeConstructor;
|
|
19
|
-
}
|
|
20
|
-
export interface JsonbFieldOptions extends BaseColumnFieldOptions {
|
|
21
|
-
type: 'jsonb';
|
|
22
|
-
}
|
package/lib/fields/json-field.js
DELETED
|
@@ -1,63 +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_field_exports = {};
|
|
29
|
-
__export(json_field_exports, {
|
|
30
|
-
JsonField: () => JsonField,
|
|
31
|
-
JsonbField: () => JsonbField
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(json_field_exports);
|
|
34
|
-
var import_sequelize = require("sequelize");
|
|
35
|
-
var import_field = require("./field");
|
|
36
|
-
const _JsonField = class _JsonField extends import_field.Field {
|
|
37
|
-
get dataType() {
|
|
38
|
-
const dialect = this.context.database.sequelize.getDialect();
|
|
39
|
-
const { jsonb } = this.options;
|
|
40
|
-
if (dialect === "postgres" && jsonb) {
|
|
41
|
-
return import_sequelize.DataTypes.JSONB;
|
|
42
|
-
}
|
|
43
|
-
return import_sequelize.DataTypes.JSON;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
__name(_JsonField, "JsonField");
|
|
47
|
-
let JsonField = _JsonField;
|
|
48
|
-
const _JsonbField = class _JsonbField extends import_field.Field {
|
|
49
|
-
get dataType() {
|
|
50
|
-
const dialect = this.context.database.sequelize.getDialect();
|
|
51
|
-
if (dialect === "postgres") {
|
|
52
|
-
return import_sequelize.DataTypes.JSONB;
|
|
53
|
-
}
|
|
54
|
-
return import_sequelize.DataTypes.JSON;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
__name(_JsonbField, "JsonbField");
|
|
58
|
-
let JsonbField = _JsonbField;
|
|
59
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
-
0 && (module.exports = {
|
|
61
|
-
JsonField,
|
|
62
|
-
JsonbField
|
|
63
|
-
});
|
|
@@ -1,22 +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 { DataTypes } from 'sequelize';
|
|
10
|
-
import { BaseColumnFieldOptions, Field } from './field';
|
|
11
|
-
export declare class NanoidField extends Field {
|
|
12
|
-
get dataType(): DataTypes.StringDataTypeConstructor;
|
|
13
|
-
init(): void;
|
|
14
|
-
bind(): void;
|
|
15
|
-
unbind(): void;
|
|
16
|
-
}
|
|
17
|
-
export interface NanoidFieldOptions extends BaseColumnFieldOptions {
|
|
18
|
-
type: 'nanoid';
|
|
19
|
-
size?: number;
|
|
20
|
-
customAlphabet?: string;
|
|
21
|
-
autoFill?: boolean;
|
|
22
|
-
}
|
|
@@ -1,65 +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 nanoid_field_exports = {};
|
|
29
|
-
__export(nanoid_field_exports, {
|
|
30
|
-
NanoidField: () => NanoidField
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(nanoid_field_exports);
|
|
33
|
-
var import_sequelize = require("sequelize");
|
|
34
|
-
var import_field = require("./field");
|
|
35
|
-
var import_nanoid = require("nanoid");
|
|
36
|
-
const DEFAULT_SIZE = 12;
|
|
37
|
-
const _NanoidField = class _NanoidField extends import_field.Field {
|
|
38
|
-
get dataType() {
|
|
39
|
-
return import_sequelize.DataTypes.STRING;
|
|
40
|
-
}
|
|
41
|
-
init() {
|
|
42
|
-
const { name, size, customAlphabet: customAlphabetOptions, autoFill } = this.options;
|
|
43
|
-
this.listener = async (instance) => {
|
|
44
|
-
const value = instance.get(name);
|
|
45
|
-
if (!value && autoFill !== false) {
|
|
46
|
-
const nanoIdFunc = customAlphabetOptions ? (0, import_nanoid.customAlphabet)(customAlphabetOptions) : import_nanoid.nanoid;
|
|
47
|
-
instance.set(name, nanoIdFunc(size || DEFAULT_SIZE));
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
bind() {
|
|
52
|
-
super.bind();
|
|
53
|
-
this.on("beforeValidate", this.listener);
|
|
54
|
-
}
|
|
55
|
-
unbind() {
|
|
56
|
-
super.unbind();
|
|
57
|
-
this.off("beforeValidate", this.listener);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
__name(_NanoidField, "NanoidField");
|
|
61
|
-
let NanoidField = _NanoidField;
|
|
62
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
-
0 && (module.exports = {
|
|
64
|
-
NanoidField
|
|
65
|
-
});
|
|
@@ -1,49 +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 { DataTypes } from 'sequelize';
|
|
10
|
-
import { BaseColumnFieldOptions, Field } from './field';
|
|
11
|
-
declare abstract class NumberField extends Field {
|
|
12
|
-
}
|
|
13
|
-
export declare class IntegerField extends NumberField {
|
|
14
|
-
get dataType(): DataTypes.IntegerDataTypeConstructor;
|
|
15
|
-
}
|
|
16
|
-
export interface IntegerFieldOptions extends BaseColumnFieldOptions {
|
|
17
|
-
type: 'integer';
|
|
18
|
-
}
|
|
19
|
-
export declare class BigIntField extends NumberField {
|
|
20
|
-
get dataType(): DataTypes.BigIntDataTypeConstructor;
|
|
21
|
-
}
|
|
22
|
-
export interface BigIntFieldOptions extends BaseColumnFieldOptions {
|
|
23
|
-
type: 'bigInt';
|
|
24
|
-
}
|
|
25
|
-
export declare class FloatField extends NumberField {
|
|
26
|
-
get dataType(): DataTypes.FloatDataTypeConstructor;
|
|
27
|
-
}
|
|
28
|
-
export interface FloatFieldOptions extends BaseColumnFieldOptions {
|
|
29
|
-
type: 'float';
|
|
30
|
-
}
|
|
31
|
-
export declare class DoubleField extends NumberField {
|
|
32
|
-
get dataType(): DataTypes.DoubleDataTypeConstructor;
|
|
33
|
-
}
|
|
34
|
-
export interface DoubleFieldOptions extends BaseColumnFieldOptions {
|
|
35
|
-
type: 'double';
|
|
36
|
-
}
|
|
37
|
-
export declare class RealField extends NumberField {
|
|
38
|
-
get dataType(): DataTypes.RealDataTypeConstructor;
|
|
39
|
-
}
|
|
40
|
-
export interface RealFieldOptions extends BaseColumnFieldOptions {
|
|
41
|
-
type: 'real';
|
|
42
|
-
}
|
|
43
|
-
export declare class DecimalField extends NumberField {
|
|
44
|
-
get dataType(): DataTypes.DecimalDataTypeConstructor;
|
|
45
|
-
}
|
|
46
|
-
export interface DecimalFieldOptions extends BaseColumnFieldOptions {
|
|
47
|
-
type: 'decimal';
|
|
48
|
-
}
|
|
49
|
-
export {};
|
|
@@ -1,94 +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_field_exports = {};
|
|
29
|
-
__export(number_field_exports, {
|
|
30
|
-
BigIntField: () => BigIntField,
|
|
31
|
-
DecimalField: () => DecimalField,
|
|
32
|
-
DoubleField: () => DoubleField,
|
|
33
|
-
FloatField: () => FloatField,
|
|
34
|
-
IntegerField: () => IntegerField,
|
|
35
|
-
RealField: () => RealField
|
|
36
|
-
});
|
|
37
|
-
module.exports = __toCommonJS(number_field_exports);
|
|
38
|
-
var import_sequelize = require("sequelize");
|
|
39
|
-
var import_field = require("./field");
|
|
40
|
-
const _NumberField = class _NumberField extends import_field.Field {
|
|
41
|
-
};
|
|
42
|
-
__name(_NumberField, "NumberField");
|
|
43
|
-
let NumberField = _NumberField;
|
|
44
|
-
const _IntegerField = class _IntegerField extends NumberField {
|
|
45
|
-
get dataType() {
|
|
46
|
-
return import_sequelize.DataTypes.INTEGER;
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
__name(_IntegerField, "IntegerField");
|
|
50
|
-
let IntegerField = _IntegerField;
|
|
51
|
-
const _BigIntField = class _BigIntField extends NumberField {
|
|
52
|
-
get dataType() {
|
|
53
|
-
return import_sequelize.DataTypes.BIGINT;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
__name(_BigIntField, "BigIntField");
|
|
57
|
-
let BigIntField = _BigIntField;
|
|
58
|
-
const _FloatField = class _FloatField extends NumberField {
|
|
59
|
-
get dataType() {
|
|
60
|
-
return import_sequelize.DataTypes.FLOAT;
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
__name(_FloatField, "FloatField");
|
|
64
|
-
let FloatField = _FloatField;
|
|
65
|
-
const _DoubleField = class _DoubleField extends NumberField {
|
|
66
|
-
get dataType() {
|
|
67
|
-
return import_sequelize.DataTypes.DOUBLE;
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
__name(_DoubleField, "DoubleField");
|
|
71
|
-
let DoubleField = _DoubleField;
|
|
72
|
-
const _RealField = class _RealField extends NumberField {
|
|
73
|
-
get dataType() {
|
|
74
|
-
return import_sequelize.DataTypes.REAL;
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
__name(_RealField, "RealField");
|
|
78
|
-
let RealField = _RealField;
|
|
79
|
-
const _DecimalField = class _DecimalField extends NumberField {
|
|
80
|
-
get dataType() {
|
|
81
|
-
return import_sequelize.DataTypes.DECIMAL;
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
__name(_DecimalField, "DecimalField");
|
|
85
|
-
let DecimalField = _DecimalField;
|
|
86
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
87
|
-
0 && (module.exports = {
|
|
88
|
-
BigIntField,
|
|
89
|
-
DecimalField,
|
|
90
|
-
DoubleField,
|
|
91
|
-
FloatField,
|
|
92
|
-
IntegerField,
|
|
93
|
-
RealField
|
|
94
|
-
});
|
|
@@ -1,29 +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 { DataTypes } from 'sequelize';
|
|
10
|
-
import { BaseColumnFieldOptions, Field } from './field';
|
|
11
|
-
export interface PasswordFieldOptions extends BaseColumnFieldOptions {
|
|
12
|
-
type: 'password';
|
|
13
|
-
/**
|
|
14
|
-
* @default 64
|
|
15
|
-
*/
|
|
16
|
-
length?: number;
|
|
17
|
-
/**
|
|
18
|
-
* @default 8
|
|
19
|
-
*/
|
|
20
|
-
randomBytesSize?: number;
|
|
21
|
-
}
|
|
22
|
-
export declare class PasswordField extends Field {
|
|
23
|
-
get dataType(): DataTypes.StringDataTypeConstructor;
|
|
24
|
-
verify(password: string, hash: string): Promise<unknown>;
|
|
25
|
-
hash(password: string): Promise<unknown>;
|
|
26
|
-
init(): void;
|
|
27
|
-
bind(): void;
|
|
28
|
-
unbind(): void;
|
|
29
|
-
}
|