@tachybase/module-data-source 0.23.8
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/.turbo/turbo-build.log +14 -0
- package/LICENSE +201 -0
- package/README.md +1 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/DatabaseConnectionProvider.d.ts +3 -0
- package/dist/client/ThridDataSource.d.ts +4 -0
- package/dist/client/component/BreadcumbTitle.d.ts +2 -0
- package/dist/client/component/CollectionsManager/AddFieldAction.d.ts +5 -0
- package/dist/client/component/CollectionsManager/CollectionFields.d.ts +8 -0
- package/dist/client/component/CollectionsManager/ConfigurationTable.d.ts +2 -0
- package/dist/client/component/CollectionsManager/ConfigurationTabs.d.ts +2 -0
- package/dist/client/component/CollectionsManager/EditCollectionAction.d.ts +6 -0
- package/dist/client/component/CollectionsManager/EditFieldAction.d.ts +2 -0
- package/dist/client/component/CollectionsManager/components/CollectionFieldInterfaceSelect.d.ts +2 -0
- package/dist/client/component/CollectionsManager/components/CollectionName.d.ts +1 -0
- package/dist/client/component/CollectionsManager/components/FieldTitleInput.d.ts +2 -0
- package/dist/client/component/CollectionsManager/components/FieldType.d.ts +2 -0
- package/dist/client/component/CollectionsManager/components/TitleField.d.ts +2 -0
- package/dist/client/component/CollectionsManager/components/UnSupportFields.d.ts +2 -0
- package/dist/client/component/CollectionsManager/components/index.d.ts +6 -0
- package/dist/client/component/CollectionsManager/hooks.d.ts +12 -0
- package/dist/client/component/CollectionsManager/index.d.ts +2 -0
- package/dist/client/component/CollectionsManager/schema/collectionFields.d.ts +4 -0
- package/dist/client/component/CollectionsManager/schema/collections.d.ts +8 -0
- package/dist/client/component/CreateDatabaseConnectAction.d.ts +2 -0
- package/dist/client/component/DatabaseConnectionManager.d.ts +2 -0
- package/dist/client/component/DatasourceLink.d.ts +2 -0
- package/dist/client/component/EditDatabaseConnectionAction.d.ts +2 -0
- package/dist/client/component/MainDataSourceManager/Configuration/AddCategoryAction.d.ts +3 -0
- package/dist/client/component/MainDataSourceManager/Configuration/CollectionFields.d.ts +2 -0
- package/dist/client/component/MainDataSourceManager/Configuration/CollectionFieldsTable.d.ts +15 -0
- package/dist/client/component/MainDataSourceManager/Configuration/CollectionFieldsTableArray.d.ts +8 -0
- package/dist/client/component/MainDataSourceManager/Configuration/ConfigurationTable.d.ts +2 -0
- package/dist/client/component/MainDataSourceManager/Configuration/ConfigurationTabs.d.ts +2 -0
- package/dist/client/component/MainDataSourceManager/Configuration/EditCategoryAction.d.ts +3 -0
- package/dist/client/component/MainDataSourceManager/Configuration/index.d.ts +6 -0
- package/dist/client/component/MainDataSourceManager/Configuration/interfaces.d.ts +16 -0
- package/dist/client/component/MainDataSourceManager/Configuration/schemas/collectionFields.d.ts +5 -0
- package/dist/client/component/MainDataSourceManager/Configuration/schemas/collections.d.ts +7 -0
- package/dist/client/component/MainDataSourceManager/index.d.ts +2 -0
- package/dist/client/component/PermissionManager/DataSourceTable.d.ts +3 -0
- package/dist/client/component/PermissionManager/PermisionProvider.d.ts +5 -0
- package/dist/client/component/PermissionManager/RoleConfigure.d.ts +2 -0
- package/dist/client/component/PermissionManager/RolesResourcesActions.d.ts +3 -0
- package/dist/client/component/PermissionManager/ScopeSelect.d.ts +3 -0
- package/dist/client/component/PermissionManager/StrategyActions.d.ts +2 -0
- package/dist/client/component/PermissionManager/index.d.ts +3 -0
- package/dist/client/component/PermissionManager/schemas/dataSourceTable.d.ts +2 -0
- package/dist/client/component/PermissionManager/schemas/roleCollections.d.ts +2 -0
- package/dist/client/component/PermissionManager/schemas/scopes.d.ts +11 -0
- package/dist/client/component/PermissionManager/schemas/useRoleResourceValues.d.ts +8 -0
- package/dist/client/component/PermissionManager/schemas/useSaveRoleResourceAction.d.ts +3 -0
- package/dist/client/component/PermissionManager/style.d.ts +1 -0
- package/dist/client/component/ViewDatabaseConnectionAction.d.ts +2 -0
- package/dist/client/constant.d.ts +4 -0
- package/dist/client/hooks/index.d.ts +6 -0
- package/dist/client/index.d.ts +9 -0
- package/dist/client/index.js +56 -0
- package/dist/client/locale/index.d.ts +3 -0
- package/dist/client/schema/index.d.ts +7 -0
- package/dist/externalVersion.js +19 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +39 -0
- package/dist/locale/zh-CN.json +35 -0
- package/dist/server/collections/data-sources-collections.d.ts +2 -0
- package/dist/server/collections/data-sources-collections.js +66 -0
- package/dist/server/collections/data-sources-fields.d.ts +2 -0
- package/dist/server/collections/data-sources-fields.js +87 -0
- package/dist/server/collections/data-sources-roles-resources-actions.d.ts +2 -0
- package/dist/server/collections/data-sources-roles-resources-actions.js +52 -0
- package/dist/server/collections/data-sources-roles-resources-scopes.d.ts +2 -0
- package/dist/server/collections/data-sources-roles-resources-scopes.js +56 -0
- package/dist/server/collections/data-sources-roles-resources.d.ts +2 -0
- package/dist/server/collections/data-sources-roles-resources.js +62 -0
- package/dist/server/collections/data-sources-roles.d.ts +2 -0
- package/dist/server/collections/data-sources-roles.js +54 -0
- package/dist/server/collections/data-sources.d.ts +2 -0
- package/dist/server/collections/data-sources.js +71 -0
- package/dist/server/errors/type-infer-error.d.ts +2 -0
- package/dist/server/errors/type-infer-error.js +28 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.js +39 -0
- package/dist/server/migrations/20240301164024-migrate-acl-resources.d.ts +7 -0
- package/dist/server/migrations/20240301164024-migrate-acl-resources.js +117 -0
- package/dist/server/models/connections-roles-resources-action.d.ts +3 -0
- package/dist/server/models/connections-roles-resources-action.js +29 -0
- package/dist/server/models/connections-roles-resources.d.ts +3 -0
- package/dist/server/models/connections-roles-resources.js +29 -0
- package/dist/server/models/data-source.d.ts +18 -0
- package/dist/server/models/data-source.js +170 -0
- package/dist/server/models/data-sources-collection-model.d.ts +7 -0
- package/dist/server/models/data-sources-collection-model.js +37 -0
- package/dist/server/models/data-sources-field-model.d.ts +10 -0
- package/dist/server/models/data-sources-field-model.js +54 -0
- package/dist/server/models/data-sources-roles-model.d.ts +13 -0
- package/dist/server/models/data-sources-roles-model.js +58 -0
- package/dist/server/plugin.d.ts +13 -0
- package/dist/server/plugin.js +448 -0
- package/dist/server/resourcers/data-sources-collections-fields.d.ts +11 -0
- package/dist/server/resourcers/data-sources-collections-fields.js +131 -0
- package/dist/server/resourcers/data-sources-collections.d.ts +8 -0
- package/dist/server/resourcers/data-sources-collections.js +106 -0
- package/dist/server/resourcers/data-sources-resources.d.ts +9 -0
- package/dist/server/resourcers/data-sources-resources.js +88 -0
- package/dist/server/resourcers/data-sources-roles.d.ts +8 -0
- package/dist/server/resourcers/data-sources-roles.js +89 -0
- package/dist/server/resourcers/roles-data-sources-collections.d.ts +7 -0
- package/dist/server/resourcers/roles-data-sources-collections.js +102 -0
- package/dist/server/services/collection-manager.d.ts +6 -0
- package/dist/server/services/collection-manager.js +33 -0
- package/dist/server/services/database-introspector.d.ts +70 -0
- package/dist/server/services/database-introspector.js +235 -0
- package/dist/server/services/full-data-repository.d.ts +8 -0
- package/dist/server/services/full-data-repository.js +51 -0
- package/dist/server/services/type-interface-map.d.ts +183 -0
- package/dist/server/services/type-interface-map.js +243 -0
- package/dist/server/utils.d.ts +1 -0
- package/dist/server/utils.js +38 -0
- package/package.json +36 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var database_introspector_exports = {};
|
|
29
|
+
__export(database_introspector_exports, {
|
|
30
|
+
DatabaseIntrospector: () => DatabaseIntrospector
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(database_introspector_exports);
|
|
33
|
+
var import_database = require("@tachybase/database");
|
|
34
|
+
var import_lodash = __toESM(require("lodash"));
|
|
35
|
+
var import_type_interface_map = __toESM(require("./type-interface-map"));
|
|
36
|
+
class DatabaseIntrospector {
|
|
37
|
+
constructor(db) {
|
|
38
|
+
this.db = db;
|
|
39
|
+
}
|
|
40
|
+
async getCollections(options = {}) {
|
|
41
|
+
const tableList = await this.db.sequelize.getQueryInterface().showAllTables();
|
|
42
|
+
const batchSize = 5;
|
|
43
|
+
const results = [];
|
|
44
|
+
for (let i = 0; i < tableList.length; i += batchSize) {
|
|
45
|
+
const batch = tableList.slice(i, i + batchSize);
|
|
46
|
+
const batchResults = await Promise.all(
|
|
47
|
+
batch.map(async (tableName) => {
|
|
48
|
+
var _a;
|
|
49
|
+
const tableInfo = {
|
|
50
|
+
tableName
|
|
51
|
+
};
|
|
52
|
+
const collectionOptions = this.tableInfoToCollectionOptions(tableInfo);
|
|
53
|
+
const localOptions = (_a = options.localData) == null ? void 0 : _a[collectionOptions.name];
|
|
54
|
+
try {
|
|
55
|
+
return await this.getCollection({
|
|
56
|
+
tableInfo,
|
|
57
|
+
localOptions
|
|
58
|
+
});
|
|
59
|
+
} catch (e) {
|
|
60
|
+
if (e.message.includes("No description found for")) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
throw e;
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
);
|
|
67
|
+
results.push(...batchResults);
|
|
68
|
+
}
|
|
69
|
+
return results.filter(Boolean);
|
|
70
|
+
}
|
|
71
|
+
async getCollection(options) {
|
|
72
|
+
const { tableInfo } = options;
|
|
73
|
+
const columnsInfo = await this.db.sequelize.getQueryInterface().describeTable(tableInfo);
|
|
74
|
+
const collectionOptions = this.tableInfoToCollectionOptions(tableInfo);
|
|
75
|
+
const constraints = await this.db.sequelize.getQueryInterface().showIndex(this.db.inDialect("postgres") ? tableInfo : tableInfo.tableName);
|
|
76
|
+
try {
|
|
77
|
+
const fields = Object.keys(columnsInfo).map((columnName) => {
|
|
78
|
+
return this.columnInfoToFieldOptions(columnsInfo, columnName, constraints);
|
|
79
|
+
});
|
|
80
|
+
const unsupportedFields = fields.filter((field) => {
|
|
81
|
+
return field.supported === false;
|
|
82
|
+
});
|
|
83
|
+
const supportFields = fields.filter((field) => {
|
|
84
|
+
return field.supported !== false;
|
|
85
|
+
});
|
|
86
|
+
const remoteCollectionInfo = {
|
|
87
|
+
...collectionOptions,
|
|
88
|
+
...this.collectionOptionsByFields(supportFields),
|
|
89
|
+
fields: supportFields
|
|
90
|
+
};
|
|
91
|
+
if (unsupportedFields.length) {
|
|
92
|
+
remoteCollectionInfo.unsupportedFields = unsupportedFields;
|
|
93
|
+
}
|
|
94
|
+
return this.mergeLocalDataIntoCollectionOptions(remoteCollectionInfo, options.localOptions);
|
|
95
|
+
} catch (e) {
|
|
96
|
+
throw new Error(`table ${tableInfo.tableName} introspection error: ${e.message}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
loadCollection(options) {
|
|
100
|
+
this.db.collection({
|
|
101
|
+
...options,
|
|
102
|
+
introspected: true
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
loadCollections(options) {
|
|
106
|
+
options.collections.forEach((collection) => {
|
|
107
|
+
this.loadCollection(collection);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
tableInfoToCollectionOptions(tableInfo) {
|
|
111
|
+
return {
|
|
112
|
+
name: tableInfo.tableName,
|
|
113
|
+
title: tableInfo.tableName,
|
|
114
|
+
schema: tableInfo.schema,
|
|
115
|
+
tableName: tableInfo.tableName
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
collectionOptionsByFields(fields) {
|
|
119
|
+
const options = {
|
|
120
|
+
timestamps: false
|
|
121
|
+
};
|
|
122
|
+
const autoIncrementField = fields.find((field) => field.autoIncrement);
|
|
123
|
+
if (autoIncrementField) {
|
|
124
|
+
options.filterTargetKey = autoIncrementField.name;
|
|
125
|
+
}
|
|
126
|
+
const primaryKeys = fields.filter((field) => field.primaryKey);
|
|
127
|
+
if (!options.filterTargetKey && primaryKeys.length === 1) {
|
|
128
|
+
options.filterTargetKey = primaryKeys[0].name;
|
|
129
|
+
}
|
|
130
|
+
const uniques = fields.filter((field) => field.unique);
|
|
131
|
+
if (!options.filterTargetKey && uniques.length === 1) {
|
|
132
|
+
options.filterTargetKey = uniques[0].name;
|
|
133
|
+
}
|
|
134
|
+
return options;
|
|
135
|
+
}
|
|
136
|
+
mergeLocalDataIntoCollectionOptions(collectionOptions, localData) {
|
|
137
|
+
var _a;
|
|
138
|
+
if (!localData) {
|
|
139
|
+
return collectionOptions;
|
|
140
|
+
}
|
|
141
|
+
const collectionFields = collectionOptions.fields || [];
|
|
142
|
+
const localFieldsAsObject = import_lodash.default.keyBy(localData.fields, "name");
|
|
143
|
+
const newFields = collectionFields.map((field) => {
|
|
144
|
+
const localField = localFieldsAsObject[field.name];
|
|
145
|
+
if (!localField) {
|
|
146
|
+
return field;
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
...field,
|
|
150
|
+
...localField
|
|
151
|
+
};
|
|
152
|
+
});
|
|
153
|
+
const localAssociationFields = (_a = localData.fields) == null ? void 0 : _a.filter((field) => {
|
|
154
|
+
return ["belongsTo", "belongsToMany", "hasMany", "hasOne"].includes(field.type);
|
|
155
|
+
});
|
|
156
|
+
if (localAssociationFields) {
|
|
157
|
+
newFields.push(...localAssociationFields);
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
...collectionOptions,
|
|
161
|
+
...import_lodash.default.omit(localData, ["fields"]),
|
|
162
|
+
fields: newFields
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
columnInfoToFieldOptions(columnsInfo, columnName, indexes) {
|
|
166
|
+
const columnInfo = columnsInfo[columnName];
|
|
167
|
+
let fieldOptions = {
|
|
168
|
+
...this.columnAttribute(columnsInfo, columnName, indexes),
|
|
169
|
+
...import_database.ViewFieldInference.inferToFieldType({
|
|
170
|
+
dialect: this.db.options.dialect,
|
|
171
|
+
type: columnInfo.type,
|
|
172
|
+
name: columnName
|
|
173
|
+
}),
|
|
174
|
+
rawType: columnInfo.type,
|
|
175
|
+
name: columnName
|
|
176
|
+
};
|
|
177
|
+
const interfaceConfig = this.getDefaultInterfaceByType(columnsInfo, columnName, fieldOptions.type);
|
|
178
|
+
if (typeof interfaceConfig === "string") {
|
|
179
|
+
fieldOptions.interface = interfaceConfig;
|
|
180
|
+
} else {
|
|
181
|
+
fieldOptions = {
|
|
182
|
+
...fieldOptions,
|
|
183
|
+
...interfaceConfig
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
if (!fieldOptions.type) {
|
|
187
|
+
return {
|
|
188
|
+
rawType: columnInfo.type,
|
|
189
|
+
name: columnName,
|
|
190
|
+
supported: false
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
import_lodash.default.set(fieldOptions, "uiSchema.title", columnName);
|
|
194
|
+
return fieldOptions;
|
|
195
|
+
}
|
|
196
|
+
getDefaultInterfaceByType(columnsInfo, columnName, type) {
|
|
197
|
+
const interfaceConfig = import_type_interface_map.default[type];
|
|
198
|
+
if (typeof interfaceConfig === "function") {
|
|
199
|
+
return interfaceConfig(columnsInfo[columnName]);
|
|
200
|
+
}
|
|
201
|
+
return interfaceConfig;
|
|
202
|
+
}
|
|
203
|
+
columnAttribute(columnsInfo, columnName, indexes) {
|
|
204
|
+
const columnInfo = columnsInfo[columnName];
|
|
205
|
+
const attr = {
|
|
206
|
+
type: columnInfo.type,
|
|
207
|
+
allowNull: columnInfo.allowNull,
|
|
208
|
+
primaryKey: columnInfo.primaryKey,
|
|
209
|
+
unique: false
|
|
210
|
+
};
|
|
211
|
+
if (columnInfo.defaultValue && typeof columnInfo.defaultValue === "string") {
|
|
212
|
+
const isSerial = columnInfo.defaultValue.match(/^nextval\(/);
|
|
213
|
+
const isUUID = columnInfo.defaultValue.match(/^uuid_generate_v4\(/);
|
|
214
|
+
if (!isSerial && !isUUID) {
|
|
215
|
+
attr.defaultValue = columnInfo.defaultValue;
|
|
216
|
+
}
|
|
217
|
+
if (isSerial || isUUID) {
|
|
218
|
+
attr.autoIncrement = true;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
for (const index of indexes) {
|
|
222
|
+
if (index.fields.length === 1 && index.fields[0].attribute === columnName && index.unique) {
|
|
223
|
+
attr.unique = true;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
if (attr.primaryKey && columnName === "id") {
|
|
227
|
+
attr.autoIncrement = true;
|
|
228
|
+
}
|
|
229
|
+
return attr;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
233
|
+
0 && (module.exports = {
|
|
234
|
+
DatabaseIntrospector
|
|
235
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CountOptions, FindOptions } from '@tachybase/database';
|
|
2
|
+
export declare class FullDataRepository<T> {
|
|
3
|
+
data: Array<T>;
|
|
4
|
+
constructor(data: Array<T>);
|
|
5
|
+
count(countOptions?: CountOptions): Promise<number>;
|
|
6
|
+
find(options?: FindOptions): Promise<Array<T>>;
|
|
7
|
+
findAndCount(options?: {}): Promise<[Array<T>, number]>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var full_data_repository_exports = {};
|
|
19
|
+
__export(full_data_repository_exports, {
|
|
20
|
+
FullDataRepository: () => FullDataRepository
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(full_data_repository_exports);
|
|
23
|
+
class FullDataRepository {
|
|
24
|
+
data = [];
|
|
25
|
+
constructor(data) {
|
|
26
|
+
this.data = data;
|
|
27
|
+
}
|
|
28
|
+
async count(countOptions) {
|
|
29
|
+
return this.data.length;
|
|
30
|
+
}
|
|
31
|
+
async find(options) {
|
|
32
|
+
const { limit, offset } = options || {};
|
|
33
|
+
let results = this.data;
|
|
34
|
+
if (offset) {
|
|
35
|
+
results = results.slice(offset);
|
|
36
|
+
}
|
|
37
|
+
if (limit) {
|
|
38
|
+
results = results.slice(0, limit);
|
|
39
|
+
}
|
|
40
|
+
return results;
|
|
41
|
+
}
|
|
42
|
+
async findAndCount(options = {}) {
|
|
43
|
+
const count = await this.count();
|
|
44
|
+
const results = count ? await this.find(options) : [];
|
|
45
|
+
return [results, count];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
FullDataRepository
|
|
51
|
+
});
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
declare const typeInterfaceMap: {
|
|
2
|
+
array: string;
|
|
3
|
+
belongsTo: string;
|
|
4
|
+
belongsToMany: string;
|
|
5
|
+
boolean: () => {
|
|
6
|
+
interface: string;
|
|
7
|
+
uiSchema: {
|
|
8
|
+
type: string;
|
|
9
|
+
'x-component': string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
context: string;
|
|
13
|
+
date: () => {
|
|
14
|
+
interface: string;
|
|
15
|
+
uiSchema: {
|
|
16
|
+
'x-component': string;
|
|
17
|
+
'x-component-props': {
|
|
18
|
+
dateFormat: string;
|
|
19
|
+
showTime: boolean;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
hasMany: string;
|
|
24
|
+
hasOne: string;
|
|
25
|
+
json: () => {
|
|
26
|
+
interface: string;
|
|
27
|
+
uiSchema: {
|
|
28
|
+
'x-component': string;
|
|
29
|
+
'x-component-props': {
|
|
30
|
+
autoSize: {
|
|
31
|
+
minRows: number;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
default: any;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
jsonb: () => {
|
|
38
|
+
interface: string;
|
|
39
|
+
uiSchema: {
|
|
40
|
+
'x-component': string;
|
|
41
|
+
'x-component-props': {
|
|
42
|
+
autoSize: {
|
|
43
|
+
minRows: number;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
default: any;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
integer: () => {
|
|
50
|
+
interface: string;
|
|
51
|
+
uiSchema: {
|
|
52
|
+
type: string;
|
|
53
|
+
'x-component': string;
|
|
54
|
+
'x-component-props': {
|
|
55
|
+
stringMode: boolean;
|
|
56
|
+
step: string;
|
|
57
|
+
};
|
|
58
|
+
'x-validator': string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
bigInt: (columnInfo: any) => {
|
|
62
|
+
interface: string;
|
|
63
|
+
uiSchema: {
|
|
64
|
+
'x-component': string;
|
|
65
|
+
'x-component-props': {
|
|
66
|
+
style: {
|
|
67
|
+
width: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
float: () => {
|
|
73
|
+
interface: string;
|
|
74
|
+
uiSchema: {
|
|
75
|
+
type: string;
|
|
76
|
+
'x-component': string;
|
|
77
|
+
'x-component-props': {
|
|
78
|
+
stringMode: boolean;
|
|
79
|
+
step: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
double: () => {
|
|
84
|
+
interface: string;
|
|
85
|
+
uiSchema: {
|
|
86
|
+
type: string;
|
|
87
|
+
'x-component': string;
|
|
88
|
+
'x-component-props': {
|
|
89
|
+
stringMode: boolean;
|
|
90
|
+
step: string;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
real: () => {
|
|
95
|
+
interface: string;
|
|
96
|
+
uiSchema: {
|
|
97
|
+
type: string;
|
|
98
|
+
'x-component': string;
|
|
99
|
+
'x-component-props': {
|
|
100
|
+
stringMode: boolean;
|
|
101
|
+
step: string;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
decimal: () => {
|
|
106
|
+
interface: string;
|
|
107
|
+
uiSchema: {
|
|
108
|
+
type: string;
|
|
109
|
+
'x-component': string;
|
|
110
|
+
'x-component-props': {
|
|
111
|
+
stringMode: boolean;
|
|
112
|
+
step: string;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
password: () => {
|
|
117
|
+
interface: string;
|
|
118
|
+
hidden: boolean;
|
|
119
|
+
uiSchema: {
|
|
120
|
+
type: string;
|
|
121
|
+
'x-component': string;
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
radio: string;
|
|
125
|
+
set: string;
|
|
126
|
+
sort: string;
|
|
127
|
+
string: () => {
|
|
128
|
+
interface: string;
|
|
129
|
+
uiSchema: {
|
|
130
|
+
'x-component': string;
|
|
131
|
+
'x-component-props': {
|
|
132
|
+
style: {
|
|
133
|
+
width: string;
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
text: () => {
|
|
139
|
+
interface: string;
|
|
140
|
+
uiSchema: {
|
|
141
|
+
type: string;
|
|
142
|
+
'x-component': string;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
time: () => {
|
|
146
|
+
interface: string;
|
|
147
|
+
uiSchema: {
|
|
148
|
+
type: string;
|
|
149
|
+
'x-component': string;
|
|
150
|
+
'x-component-props': {
|
|
151
|
+
format: string;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
uid: () => {
|
|
156
|
+
interface: string;
|
|
157
|
+
uiSchema: {
|
|
158
|
+
'x-component': string;
|
|
159
|
+
'x-component-props': {
|
|
160
|
+
style: {
|
|
161
|
+
width: string;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
uuid: () => {
|
|
167
|
+
interface: string;
|
|
168
|
+
uiSchema: {
|
|
169
|
+
'x-component': string;
|
|
170
|
+
'x-component-props': {
|
|
171
|
+
style: {
|
|
172
|
+
width: string;
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
virtual: string;
|
|
178
|
+
point: string;
|
|
179
|
+
polygon: string;
|
|
180
|
+
lineString: string;
|
|
181
|
+
circle: string;
|
|
182
|
+
};
|
|
183
|
+
export default typeInterfaceMap;
|