@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
|
@@ -6,8 +6,15 @@
|
|
|
6
6
|
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import { Context } from '@nocobase/actions';
|
|
10
|
+
import { DataSourceOptions } from './data-source';
|
|
11
|
+
import { DatabaseDataSource } from './database-data-source';
|
|
12
|
+
import { DatabaseIntrospector } from './database-introspector/database-introspector';
|
|
10
13
|
import { SequelizeCollectionManager } from './sequelize-collection-manager';
|
|
11
|
-
export declare class SequelizeDataSource extends
|
|
14
|
+
export declare class SequelizeDataSource<T extends DatabaseIntrospector = DatabaseIntrospector> extends DatabaseDataSource<T> {
|
|
15
|
+
collectionManager: SequelizeCollectionManager;
|
|
16
|
+
constructor(options: DataSourceOptions);
|
|
12
17
|
createCollectionManager(options?: any): SequelizeCollectionManager;
|
|
18
|
+
readTables(): Promise<any>;
|
|
19
|
+
loadTables(ctx: Context, tables: string[]): Promise<any>;
|
|
13
20
|
}
|
|
@@ -30,12 +30,22 @@ __export(sequelize_data_source_exports, {
|
|
|
30
30
|
SequelizeDataSource: () => SequelizeDataSource
|
|
31
31
|
});
|
|
32
32
|
module.exports = __toCommonJS(sequelize_data_source_exports);
|
|
33
|
-
var
|
|
33
|
+
var import_database_data_source = require("./database-data-source");
|
|
34
34
|
var import_sequelize_collection_manager = require("./sequelize-collection-manager");
|
|
35
|
-
const _SequelizeDataSource = class _SequelizeDataSource extends
|
|
35
|
+
const _SequelizeDataSource = class _SequelizeDataSource extends import_database_data_source.DatabaseDataSource {
|
|
36
|
+
constructor(options) {
|
|
37
|
+
super(options);
|
|
38
|
+
this.introspector = this.createDatabaseIntrospector(this.collectionManager.db);
|
|
39
|
+
}
|
|
36
40
|
createCollectionManager(options) {
|
|
37
41
|
return new import_sequelize_collection_manager.SequelizeCollectionManager(options.collectionManager);
|
|
38
42
|
}
|
|
43
|
+
async readTables() {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
async loadTables(ctx, tables) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
39
49
|
};
|
|
40
50
|
__name(_SequelizeDataSource, "SequelizeDataSource");
|
|
41
51
|
let SequelizeDataSource = _SequelizeDataSource;
|
package/lib/types.d.ts
CHANGED
|
@@ -7,13 +7,36 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
import { DataSource } from './data-source';
|
|
10
|
-
export type
|
|
10
|
+
export type DataSourceConstructor<T extends DataSource = DataSource> = Omit<typeof DataSource, 'prototype'> & {
|
|
11
|
+
new (...args: any[]): T;
|
|
12
|
+
};
|
|
13
|
+
export type tableInfo = {
|
|
14
|
+
tableName: string;
|
|
15
|
+
schema?: string;
|
|
16
|
+
};
|
|
17
|
+
export type PartialCollectionOptions = Partial<Omit<CollectionOptions, 'fields'> & {
|
|
18
|
+
fields?: Partial<FieldOptions>[];
|
|
19
|
+
}>;
|
|
20
|
+
export interface CollectionOptions {
|
|
11
21
|
name: string;
|
|
12
|
-
|
|
22
|
+
schema?: string;
|
|
23
|
+
tableName: string;
|
|
24
|
+
title?: string;
|
|
25
|
+
template?: string;
|
|
26
|
+
timestamps?: boolean;
|
|
13
27
|
filterTargetKey?: string | Array<string>;
|
|
14
|
-
fields:
|
|
28
|
+
fields: FieldOptions[];
|
|
29
|
+
autoGenId?: boolean;
|
|
30
|
+
view?: boolean;
|
|
31
|
+
unsupportedFields?: UnsupportedFieldOptions[];
|
|
15
32
|
[key: string]: any;
|
|
16
|
-
}
|
|
33
|
+
}
|
|
34
|
+
export interface UnsupportedFieldOptions {
|
|
35
|
+
rawType: string;
|
|
36
|
+
name: string;
|
|
37
|
+
supported: false;
|
|
38
|
+
}
|
|
39
|
+
export type FieldInferResult = FieldOptions | UnsupportedFieldOptions;
|
|
17
40
|
export type FieldOptions = {
|
|
18
41
|
name: string;
|
|
19
42
|
field: string;
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/data-source-manager",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.50",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"main": "./lib/index.js",
|
|
7
7
|
"types": "./lib/index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@nocobase/actions": "2.0.0-alpha.
|
|
10
|
-
"@nocobase/cache": "2.0.0-alpha.
|
|
11
|
-
"@nocobase/database": "2.0.0-alpha.
|
|
12
|
-
"@nocobase/resourcer": "2.0.0-alpha.
|
|
13
|
-
"@nocobase/utils": "2.0.0-alpha.
|
|
9
|
+
"@nocobase/actions": "2.0.0-alpha.50",
|
|
10
|
+
"@nocobase/cache": "2.0.0-alpha.50",
|
|
11
|
+
"@nocobase/database": "2.0.0-alpha.50",
|
|
12
|
+
"@nocobase/resourcer": "2.0.0-alpha.50",
|
|
13
|
+
"@nocobase/utils": "2.0.0-alpha.50",
|
|
14
14
|
"@types/jsonwebtoken": "^8.5.8",
|
|
15
15
|
"jsonwebtoken": "^9.0.2"
|
|
16
16
|
},
|
|
@@ -19,5 +19,5 @@
|
|
|
19
19
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
20
20
|
"directory": "packages/auth"
|
|
21
21
|
},
|
|
22
|
-
"gitHead": "
|
|
22
|
+
"gitHead": "a6eb64abf3632e116ad0b295a7f410270a1059d1"
|
|
23
23
|
}
|