@nocobase/data-source-manager 2.0.0-alpha.5 → 2.0.0-alpha.50
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/lib/data-source-factory.d.ts +5 -4
- package/lib/data-source-factory.js +1 -1
- package/lib/data-source-manager.d.ts +3 -2
- package/lib/database-data-source.d.ts +26 -0
- package/lib/database-data-source.js +106 -0
- package/lib/database-introspector/database-introspector.d.ts +57 -0
- package/lib/database-introspector/database-introspector.js +278 -0
- package/lib/database-introspector/mariadb-introspector.d.ts +12 -0
- package/lib/database-introspector/mariadb-introspector.js +47 -0
- package/lib/database-introspector/postgres-introspector.d.ts +19 -0
- package/lib/database-introspector/postgres-introspector.js +184 -0
- package/lib/database-introspector/type-interface-map.d.ts +242 -0
- package/lib/database-introspector/type-interface-map.js +234 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +4 -0
- package/lib/sequelize-data-source.d.ts +9 -2
- package/lib/sequelize-data-source.js +12 -2
- package/lib/types.d.ts +27 -4
- package/package.json +7 -7
|
@@ -0,0 +1,184 @@
|
|
|
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 postgres_introspector_exports = {};
|
|
39
|
+
__export(postgres_introspector_exports, {
|
|
40
|
+
PostgresIntrospector: () => PostgresIntrospector
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(postgres_introspector_exports);
|
|
43
|
+
var import_database_introspector = require("./database-introspector");
|
|
44
|
+
var import_lodash = __toESM(require("lodash"));
|
|
45
|
+
const _PostgresIntrospector = class _PostgresIntrospector extends import_database_introspector.DatabaseIntrospector {
|
|
46
|
+
async getTableConstraints(tableInfo2) {
|
|
47
|
+
const schema = tableInfo2.schema || "public";
|
|
48
|
+
const sql = `
|
|
49
|
+
SELECT
|
|
50
|
+
tc.constraint_schema,
|
|
51
|
+
tc.constraint_name,
|
|
52
|
+
tc.table_name,
|
|
53
|
+
kcu.column_name,
|
|
54
|
+
CASE WHEN (SELECT COUNT(*)
|
|
55
|
+
FROM information_schema.key_column_usage kcu2
|
|
56
|
+
WHERE kcu2.constraint_name = tc.constraint_name
|
|
57
|
+
AND kcu2.table_schema = tc.constraint_schema) = 1 THEN TRUE
|
|
58
|
+
ELSE FALSE END AS is_single_column
|
|
59
|
+
FROM information_schema.table_constraints AS tc
|
|
60
|
+
JOIN information_schema.key_column_usage AS kcu
|
|
61
|
+
ON tc.constraint_name = kcu.constraint_name
|
|
62
|
+
AND tc.table_schema = kcu.table_schema
|
|
63
|
+
WHERE tc.constraint_type = 'UNIQUE'
|
|
64
|
+
AND tc.table_name = :tableName
|
|
65
|
+
AND tc.table_schema = :schema
|
|
66
|
+
ORDER BY tc.constraint_name, kcu.column_name;
|
|
67
|
+
`;
|
|
68
|
+
return await this.db.sequelize.query(sql, {
|
|
69
|
+
type: "SELECT",
|
|
70
|
+
replacements: {
|
|
71
|
+
tableName: tableInfo2.tableName,
|
|
72
|
+
schema
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
async getTableColumnsInfo(tableInfo2) {
|
|
77
|
+
const columnsInfo = await this.db.sequelize.getQueryInterface().describeTable(tableInfo2);
|
|
78
|
+
const primaryKeys = await this.getPrimaryKeysOfTable(tableInfo2);
|
|
79
|
+
Object.keys(columnsInfo).forEach((columnName) => {
|
|
80
|
+
const columnInfo = columnsInfo[columnName];
|
|
81
|
+
const primaryKey = primaryKeys.find((key) => key.column_name === columnName);
|
|
82
|
+
if (primaryKey) {
|
|
83
|
+
columnInfo.primaryKey = true;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
await this.appendArrayColumnElementType(tableInfo2, columnsInfo);
|
|
87
|
+
return columnsInfo;
|
|
88
|
+
}
|
|
89
|
+
async getPrimaryKeysOfTable(tableInfo2) {
|
|
90
|
+
const schema = tableInfo2.schema || "public";
|
|
91
|
+
const sql = `
|
|
92
|
+
SELECT pg_attribute.attname AS column_name,
|
|
93
|
+
pg_constraint.conname AS constraint_name
|
|
94
|
+
FROM pg_constraint
|
|
95
|
+
JOIN pg_class ON pg_constraint.conrelid = pg_class.oid
|
|
96
|
+
JOIN pg_attribute ON pg_attribute.attnum = ANY (pg_constraint.conkey)
|
|
97
|
+
AND pg_attribute.attrelid = pg_class.oid
|
|
98
|
+
JOIN pg_namespace ON pg_namespace.oid = pg_class.relnamespace
|
|
99
|
+
WHERE pg_class.relname = :tableName
|
|
100
|
+
AND pg_namespace.nspname = :schema
|
|
101
|
+
AND pg_constraint.contype = 'p';
|
|
102
|
+
`;
|
|
103
|
+
return await this.db.sequelize.query(sql, {
|
|
104
|
+
type: "SELECT",
|
|
105
|
+
replacements: {
|
|
106
|
+
tableName: tableInfo2.tableName,
|
|
107
|
+
schema
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
columnAttribute(columnsInfo, columnName, indexes) {
|
|
112
|
+
const columnInfo = columnsInfo[columnName];
|
|
113
|
+
const attr = {
|
|
114
|
+
type: columnInfo.type,
|
|
115
|
+
allowNull: columnInfo.defaultValue ? true : columnInfo.allowNull,
|
|
116
|
+
primaryKey: columnInfo.primaryKey,
|
|
117
|
+
unique: false,
|
|
118
|
+
description: columnInfo.comment
|
|
119
|
+
};
|
|
120
|
+
if (columnInfo.defaultValue && typeof columnInfo.defaultValue === "string") {
|
|
121
|
+
const isSerial = columnInfo.defaultValue.match(/^nextval\(/);
|
|
122
|
+
const isUUID = columnInfo.defaultValue.match(/^uuid_generate_v4\(/);
|
|
123
|
+
if (isSerial || isUUID) {
|
|
124
|
+
attr.autoIncrement = true;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (columnInfo.type === "ARRAY") {
|
|
128
|
+
attr.dataType = "array";
|
|
129
|
+
if (columnInfo["elementType"]) {
|
|
130
|
+
const elementType = columnInfo["elementType"].replace(/"/g, "");
|
|
131
|
+
const { type } = this.inferFieldTypeByRawType(elementType);
|
|
132
|
+
attr.elementType = type;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
for (const index of indexes) {
|
|
136
|
+
if (index["is_single_column"] && index["column_name"] === columnName) {
|
|
137
|
+
attr.unique = true;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return attr;
|
|
141
|
+
}
|
|
142
|
+
async getArrayColumnElementType(tableInfo2, columnNames) {
|
|
143
|
+
const schema = tableInfo2.schema || "public";
|
|
144
|
+
const sql = `
|
|
145
|
+
SELECT c.column_name, e.data_type AS element_type
|
|
146
|
+
FROM information_schema.columns c LEFT JOIN information_schema.element_types e
|
|
147
|
+
ON ((c.table_catalog, c.table_schema, c.table_name, 'TABLE', c.dtd_identifier)
|
|
148
|
+
= (e.object_catalog, e.object_schema, e.object_name, e.object_type, e.collection_type_identifier))
|
|
149
|
+
WHERE c.table_schema = :schema AND c.table_name = :tableName AND c.column_name in (:columnNames);
|
|
150
|
+
`;
|
|
151
|
+
return await this.db.sequelize.query(sql, {
|
|
152
|
+
type: "SELECT",
|
|
153
|
+
replacements: {
|
|
154
|
+
schema,
|
|
155
|
+
tableName: tableInfo2.tableName,
|
|
156
|
+
columnNames
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
async appendArrayColumnElementType(tableInfo2, columnsInfo) {
|
|
161
|
+
const arrayColumns = {};
|
|
162
|
+
for (const columnName in columnsInfo) {
|
|
163
|
+
const columnInfo = columnsInfo[columnName];
|
|
164
|
+
if (columnInfo.type === "ARRAY") {
|
|
165
|
+
arrayColumns[columnName] = columnInfo;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
const columnNames = Object.keys(arrayColumns);
|
|
169
|
+
if (!columnNames.length) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
const rows = await this.getArrayColumnElementType(tableInfo2, columnNames);
|
|
173
|
+
const udtNameMap = import_lodash.default.keyBy(rows, "column_name");
|
|
174
|
+
Object.keys(arrayColumns).forEach((columnName) => {
|
|
175
|
+
columnsInfo[columnName]["elementType"] = udtNameMap[columnName].element_type;
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
__name(_PostgresIntrospector, "PostgresIntrospector");
|
|
180
|
+
let PostgresIntrospector = _PostgresIntrospector;
|
|
181
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
182
|
+
0 && (module.exports = {
|
|
183
|
+
PostgresIntrospector
|
|
184
|
+
});
|
|
@@ -0,0 +1,242 @@
|
|
|
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 const typeInterfaceMap: {
|
|
10
|
+
array: () => {
|
|
11
|
+
interface: string;
|
|
12
|
+
uiSchema: {
|
|
13
|
+
'x-component': string;
|
|
14
|
+
'x-component-props': {
|
|
15
|
+
autoSize: {
|
|
16
|
+
minRows: number;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
default: any;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
json: () => {
|
|
23
|
+
interface: string;
|
|
24
|
+
uiSchema: {
|
|
25
|
+
'x-component': string;
|
|
26
|
+
'x-component-props': {
|
|
27
|
+
autoSize: {
|
|
28
|
+
minRows: number;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
default: any;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
jsonb: () => {
|
|
35
|
+
interface: string;
|
|
36
|
+
uiSchema: {
|
|
37
|
+
'x-component': string;
|
|
38
|
+
'x-component-props': {
|
|
39
|
+
autoSize: {
|
|
40
|
+
minRows: number;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
default: any;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
date: () => {
|
|
47
|
+
interface: string;
|
|
48
|
+
uiSchema: {
|
|
49
|
+
'x-component': string;
|
|
50
|
+
'x-component-props': {
|
|
51
|
+
dateFormat: string;
|
|
52
|
+
showTime: boolean;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
datetime: () => {
|
|
57
|
+
interface: string;
|
|
58
|
+
uiSchema: {
|
|
59
|
+
'x-component': string;
|
|
60
|
+
'x-component-props': {
|
|
61
|
+
dateFormat: string;
|
|
62
|
+
showTime: boolean;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
datetimeTz: () => {
|
|
67
|
+
interface: string;
|
|
68
|
+
uiSchema: {
|
|
69
|
+
'x-component': string;
|
|
70
|
+
'x-component-props': {
|
|
71
|
+
dateFormat: string;
|
|
72
|
+
showTime: boolean;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
datetimeNoTz: () => {
|
|
77
|
+
interface: string;
|
|
78
|
+
uiSchema: {
|
|
79
|
+
type: string;
|
|
80
|
+
'x-component': string;
|
|
81
|
+
'x-component-props': {
|
|
82
|
+
showTime: boolean;
|
|
83
|
+
utc: boolean;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
dateOnly: () => {
|
|
88
|
+
interface: string;
|
|
89
|
+
uiSchema: {
|
|
90
|
+
type: string;
|
|
91
|
+
'x-component': string;
|
|
92
|
+
'x-component-props': {
|
|
93
|
+
dateOnly: boolean;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
time: () => {
|
|
98
|
+
interface: string;
|
|
99
|
+
uiSchema: {
|
|
100
|
+
type: string;
|
|
101
|
+
'x-component': string;
|
|
102
|
+
'x-component-props': {
|
|
103
|
+
format: string;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
integer: () => {
|
|
108
|
+
interface: string;
|
|
109
|
+
uiSchema: {
|
|
110
|
+
type: string;
|
|
111
|
+
'x-component': string;
|
|
112
|
+
'x-component-props': {
|
|
113
|
+
stringMode: boolean;
|
|
114
|
+
step: string;
|
|
115
|
+
};
|
|
116
|
+
'x-validator': string;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
bigInt: () => {
|
|
120
|
+
interface: string;
|
|
121
|
+
uiSchema: {
|
|
122
|
+
'x-component': string;
|
|
123
|
+
'x-component-props': {
|
|
124
|
+
style: {
|
|
125
|
+
width: string;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
float: () => {
|
|
131
|
+
interface: string;
|
|
132
|
+
uiSchema: {
|
|
133
|
+
type: string;
|
|
134
|
+
'x-component': string;
|
|
135
|
+
'x-component-props': {
|
|
136
|
+
stringMode: boolean;
|
|
137
|
+
step: string;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
double: () => {
|
|
142
|
+
interface: string;
|
|
143
|
+
uiSchema: {
|
|
144
|
+
type: string;
|
|
145
|
+
'x-component': string;
|
|
146
|
+
'x-component-props': {
|
|
147
|
+
stringMode: boolean;
|
|
148
|
+
step: string;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
real: () => {
|
|
153
|
+
interface: string;
|
|
154
|
+
uiSchema: {
|
|
155
|
+
type: string;
|
|
156
|
+
'x-component': string;
|
|
157
|
+
'x-component-props': {
|
|
158
|
+
stringMode: boolean;
|
|
159
|
+
step: string;
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
decimal: () => {
|
|
164
|
+
interface: string;
|
|
165
|
+
uiSchema: {
|
|
166
|
+
type: string;
|
|
167
|
+
'x-component': string;
|
|
168
|
+
'x-component-props': {
|
|
169
|
+
stringMode: boolean;
|
|
170
|
+
step: string;
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
};
|
|
174
|
+
string: () => {
|
|
175
|
+
interface: string;
|
|
176
|
+
uiSchema: {
|
|
177
|
+
'x-component': string;
|
|
178
|
+
'x-component-props': {
|
|
179
|
+
style: {
|
|
180
|
+
width: string;
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
text: () => {
|
|
186
|
+
interface: string;
|
|
187
|
+
uiSchema: {
|
|
188
|
+
type: string;
|
|
189
|
+
'x-component': string;
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
password: () => {
|
|
193
|
+
interface: string;
|
|
194
|
+
hidden: boolean;
|
|
195
|
+
uiSchema: {
|
|
196
|
+
type: string;
|
|
197
|
+
'x-component': string;
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
uid: () => {
|
|
201
|
+
interface: string;
|
|
202
|
+
uiSchema: {
|
|
203
|
+
'x-component': string;
|
|
204
|
+
'x-component-props': {
|
|
205
|
+
style: {
|
|
206
|
+
width: string;
|
|
207
|
+
};
|
|
208
|
+
};
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
uuid: () => {
|
|
212
|
+
interface: string;
|
|
213
|
+
uiSchema: {
|
|
214
|
+
'x-component': string;
|
|
215
|
+
'x-component-props': {
|
|
216
|
+
style: {
|
|
217
|
+
width: string;
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
boolean: () => {
|
|
223
|
+
interface: string;
|
|
224
|
+
uiSchema: {
|
|
225
|
+
type: string;
|
|
226
|
+
'x-component': string;
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
belongsTo: string;
|
|
230
|
+
belongsToMany: string;
|
|
231
|
+
hasMany: string;
|
|
232
|
+
hasOne: string;
|
|
233
|
+
context: string;
|
|
234
|
+
virtual: string;
|
|
235
|
+
radio: string;
|
|
236
|
+
set: string;
|
|
237
|
+
sort: string;
|
|
238
|
+
point: string;
|
|
239
|
+
polygon: string;
|
|
240
|
+
lineString: string;
|
|
241
|
+
circle: string;
|
|
242
|
+
};
|
|
@@ -0,0 +1,234 @@
|
|
|
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 type_interface_map_exports = {};
|
|
29
|
+
__export(type_interface_map_exports, {
|
|
30
|
+
typeInterfaceMap: () => typeInterfaceMap
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(type_interface_map_exports);
|
|
33
|
+
const typeInterfaceMap = {
|
|
34
|
+
// ---------- JSON / Structured ----------
|
|
35
|
+
array: /* @__PURE__ */ __name(() => ({
|
|
36
|
+
interface: "json",
|
|
37
|
+
uiSchema: {
|
|
38
|
+
"x-component": "Input.JSON",
|
|
39
|
+
"x-component-props": {
|
|
40
|
+
autoSize: { minRows: 5 }
|
|
41
|
+
},
|
|
42
|
+
default: null
|
|
43
|
+
}
|
|
44
|
+
}), "array"),
|
|
45
|
+
json: /* @__PURE__ */ __name(() => ({
|
|
46
|
+
interface: "json",
|
|
47
|
+
uiSchema: {
|
|
48
|
+
"x-component": "Input.JSON",
|
|
49
|
+
"x-component-props": {
|
|
50
|
+
autoSize: { minRows: 5 }
|
|
51
|
+
},
|
|
52
|
+
default: null
|
|
53
|
+
}
|
|
54
|
+
}), "json"),
|
|
55
|
+
jsonb: /* @__PURE__ */ __name(() => ({
|
|
56
|
+
interface: "json",
|
|
57
|
+
uiSchema: {
|
|
58
|
+
"x-component": "Input.JSON",
|
|
59
|
+
"x-component-props": {
|
|
60
|
+
autoSize: { minRows: 5 }
|
|
61
|
+
},
|
|
62
|
+
default: null
|
|
63
|
+
}
|
|
64
|
+
}), "jsonb"),
|
|
65
|
+
// ---------- Date / Time ----------
|
|
66
|
+
date: /* @__PURE__ */ __name(() => ({
|
|
67
|
+
interface: "datetime",
|
|
68
|
+
uiSchema: {
|
|
69
|
+
"x-component": "DatePicker",
|
|
70
|
+
"x-component-props": { dateFormat: "YYYY-MM-DD", showTime: false }
|
|
71
|
+
}
|
|
72
|
+
}), "date"),
|
|
73
|
+
datetime: /* @__PURE__ */ __name(() => ({
|
|
74
|
+
interface: "datetime",
|
|
75
|
+
uiSchema: {
|
|
76
|
+
"x-component": "DatePicker",
|
|
77
|
+
"x-component-props": { dateFormat: "YYYY-MM-DD", showTime: false }
|
|
78
|
+
}
|
|
79
|
+
}), "datetime"),
|
|
80
|
+
datetimeTz: /* @__PURE__ */ __name(() => ({
|
|
81
|
+
interface: "datetime",
|
|
82
|
+
uiSchema: {
|
|
83
|
+
"x-component": "DatePicker",
|
|
84
|
+
"x-component-props": { dateFormat: "YYYY-MM-DD", showTime: false }
|
|
85
|
+
}
|
|
86
|
+
}), "datetimeTz"),
|
|
87
|
+
datetimeNoTz: /* @__PURE__ */ __name(() => ({
|
|
88
|
+
interface: "datetimeNoTz",
|
|
89
|
+
uiSchema: {
|
|
90
|
+
type: "string",
|
|
91
|
+
"x-component": "DatePicker",
|
|
92
|
+
"x-component-props": { showTime: false, utc: false }
|
|
93
|
+
}
|
|
94
|
+
}), "datetimeNoTz"),
|
|
95
|
+
dateOnly: /* @__PURE__ */ __name(() => ({
|
|
96
|
+
interface: "dateOnly",
|
|
97
|
+
uiSchema: {
|
|
98
|
+
type: "string",
|
|
99
|
+
"x-component": "DatePicker",
|
|
100
|
+
"x-component-props": { dateOnly: true }
|
|
101
|
+
}
|
|
102
|
+
}), "dateOnly"),
|
|
103
|
+
time: /* @__PURE__ */ __name(() => ({
|
|
104
|
+
interface: "time",
|
|
105
|
+
uiSchema: {
|
|
106
|
+
type: "string",
|
|
107
|
+
"x-component": "TimePicker",
|
|
108
|
+
"x-component-props": { format: "HH:mm:ss" }
|
|
109
|
+
}
|
|
110
|
+
}), "time"),
|
|
111
|
+
// ---------- Numeric ----------
|
|
112
|
+
integer: /* @__PURE__ */ __name(() => ({
|
|
113
|
+
interface: "integer",
|
|
114
|
+
uiSchema: {
|
|
115
|
+
type: "number",
|
|
116
|
+
"x-component": "InputNumber",
|
|
117
|
+
"x-component-props": { stringMode: true, step: "1" },
|
|
118
|
+
"x-validator": "integer"
|
|
119
|
+
}
|
|
120
|
+
}), "integer"),
|
|
121
|
+
bigInt: /* @__PURE__ */ __name(() => ({
|
|
122
|
+
interface: "integer",
|
|
123
|
+
uiSchema: {
|
|
124
|
+
"x-component": "InputNumber",
|
|
125
|
+
"x-component-props": {
|
|
126
|
+
style: { width: "100%" }
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}), "bigInt"),
|
|
130
|
+
float: /* @__PURE__ */ __name(() => ({
|
|
131
|
+
interface: "number",
|
|
132
|
+
uiSchema: {
|
|
133
|
+
type: "number",
|
|
134
|
+
"x-component": "InputNumber",
|
|
135
|
+
"x-component-props": { stringMode: true, step: "1" }
|
|
136
|
+
}
|
|
137
|
+
}), "float"),
|
|
138
|
+
double: /* @__PURE__ */ __name(() => ({
|
|
139
|
+
interface: "number",
|
|
140
|
+
uiSchema: {
|
|
141
|
+
type: "number",
|
|
142
|
+
"x-component": "InputNumber",
|
|
143
|
+
"x-component-props": { stringMode: true, step: "1" }
|
|
144
|
+
}
|
|
145
|
+
}), "double"),
|
|
146
|
+
real: /* @__PURE__ */ __name(() => ({
|
|
147
|
+
interface: "number",
|
|
148
|
+
uiSchema: {
|
|
149
|
+
type: "number",
|
|
150
|
+
"x-component": "InputNumber",
|
|
151
|
+
"x-component-props": { stringMode: true, step: "1" }
|
|
152
|
+
}
|
|
153
|
+
}), "real"),
|
|
154
|
+
decimal: /* @__PURE__ */ __name(() => ({
|
|
155
|
+
interface: "number",
|
|
156
|
+
uiSchema: {
|
|
157
|
+
type: "number",
|
|
158
|
+
"x-component": "InputNumber",
|
|
159
|
+
"x-component-props": { stringMode: true, step: "1" }
|
|
160
|
+
}
|
|
161
|
+
}), "decimal"),
|
|
162
|
+
// ---------- Text / String ----------
|
|
163
|
+
string: /* @__PURE__ */ __name(() => ({
|
|
164
|
+
interface: "input",
|
|
165
|
+
uiSchema: {
|
|
166
|
+
"x-component": "Input",
|
|
167
|
+
"x-component-props": {
|
|
168
|
+
style: { width: "100%" }
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}), "string"),
|
|
172
|
+
text: /* @__PURE__ */ __name(() => ({
|
|
173
|
+
interface: "textarea",
|
|
174
|
+
uiSchema: {
|
|
175
|
+
type: "string",
|
|
176
|
+
"x-component": "Input.TextArea"
|
|
177
|
+
}
|
|
178
|
+
}), "text"),
|
|
179
|
+
password: /* @__PURE__ */ __name(() => ({
|
|
180
|
+
interface: "password",
|
|
181
|
+
hidden: true,
|
|
182
|
+
uiSchema: {
|
|
183
|
+
type: "string",
|
|
184
|
+
"x-component": "Password"
|
|
185
|
+
}
|
|
186
|
+
}), "password"),
|
|
187
|
+
uid: /* @__PURE__ */ __name(() => ({
|
|
188
|
+
interface: "input",
|
|
189
|
+
uiSchema: {
|
|
190
|
+
"x-component": "Input",
|
|
191
|
+
"x-component-props": {
|
|
192
|
+
style: { width: "100%" }
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}), "uid"),
|
|
196
|
+
uuid: /* @__PURE__ */ __name(() => ({
|
|
197
|
+
interface: "uuid",
|
|
198
|
+
uiSchema: {
|
|
199
|
+
"x-component": "Input",
|
|
200
|
+
"x-component-props": {
|
|
201
|
+
style: { width: "100%" }
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}), "uuid"),
|
|
205
|
+
// ---------- Boolean ----------
|
|
206
|
+
boolean: /* @__PURE__ */ __name(() => ({
|
|
207
|
+
interface: "checkbox",
|
|
208
|
+
uiSchema: {
|
|
209
|
+
type: "boolean",
|
|
210
|
+
"x-component": "Checkbox"
|
|
211
|
+
}
|
|
212
|
+
}), "boolean"),
|
|
213
|
+
// ---------- Placeholders (not yet implemented) ----------
|
|
214
|
+
// Relationships
|
|
215
|
+
belongsTo: "",
|
|
216
|
+
belongsToMany: "",
|
|
217
|
+
hasMany: "",
|
|
218
|
+
hasOne: "",
|
|
219
|
+
context: "",
|
|
220
|
+
virtual: "",
|
|
221
|
+
// Other
|
|
222
|
+
radio: "",
|
|
223
|
+
set: "",
|
|
224
|
+
sort: "",
|
|
225
|
+
// Geospatial
|
|
226
|
+
point: "",
|
|
227
|
+
polygon: "",
|
|
228
|
+
lineString: "",
|
|
229
|
+
circle: ""
|
|
230
|
+
};
|
|
231
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
232
|
+
0 && (module.exports = {
|
|
233
|
+
typeInterfaceMap
|
|
234
|
+
});
|
package/lib/index.d.ts
CHANGED
|
@@ -10,8 +10,10 @@ export * from './collection-manager';
|
|
|
10
10
|
export * from './collection';
|
|
11
11
|
export * from './data-source';
|
|
12
12
|
export * from './data-source-manager';
|
|
13
|
+
export * from './database-data-source';
|
|
13
14
|
export * from './sequelize-collection-manager';
|
|
14
15
|
export * from './sequelize-data-source';
|
|
15
16
|
export * from './load-default-actions';
|
|
16
17
|
export * from './types';
|
|
18
|
+
export * from './database-introspector/database-introspector';
|
|
17
19
|
export * from './utils';
|
package/lib/index.js
CHANGED
|
@@ -27,10 +27,12 @@ __reExport(src_exports, require("./collection-manager"), module.exports);
|
|
|
27
27
|
__reExport(src_exports, require("./collection"), module.exports);
|
|
28
28
|
__reExport(src_exports, require("./data-source"), module.exports);
|
|
29
29
|
__reExport(src_exports, require("./data-source-manager"), module.exports);
|
|
30
|
+
__reExport(src_exports, require("./database-data-source"), module.exports);
|
|
30
31
|
__reExport(src_exports, require("./sequelize-collection-manager"), module.exports);
|
|
31
32
|
__reExport(src_exports, require("./sequelize-data-source"), module.exports);
|
|
32
33
|
__reExport(src_exports, require("./load-default-actions"), module.exports);
|
|
33
34
|
__reExport(src_exports, require("./types"), module.exports);
|
|
35
|
+
__reExport(src_exports, require("./database-introspector/database-introspector"), module.exports);
|
|
34
36
|
__reExport(src_exports, require("./utils"), module.exports);
|
|
35
37
|
// Annotate the CommonJS export names for ESM import in node:
|
|
36
38
|
0 && (module.exports = {
|
|
@@ -38,9 +40,11 @@ __reExport(src_exports, require("./utils"), module.exports);
|
|
|
38
40
|
...require("./collection"),
|
|
39
41
|
...require("./data-source"),
|
|
40
42
|
...require("./data-source-manager"),
|
|
43
|
+
...require("./database-data-source"),
|
|
41
44
|
...require("./sequelize-collection-manager"),
|
|
42
45
|
...require("./sequelize-data-source"),
|
|
43
46
|
...require("./load-default-actions"),
|
|
44
47
|
...require("./types"),
|
|
48
|
+
...require("./database-introspector/database-introspector"),
|
|
45
49
|
...require("./utils")
|
|
46
50
|
});
|