@tachybase/data-source 1.3.38 → 1.3.39
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { DataSourceCollection } from './collection';
|
|
2
|
+
import { DataSourceCollectionOptions, ICollection, ICollectionManager, IRepository, MergeOptions } from './types';
|
|
3
3
|
export declare class CollectionManager implements ICollectionManager {
|
|
4
4
|
protected collections: Map<string, ICollection>;
|
|
5
5
|
protected repositories: Map<string, IRepository>;
|
|
@@ -14,13 +14,13 @@ export declare class CollectionManager implements ICollectionManager {
|
|
|
14
14
|
registerCollectionTemplates(): void;
|
|
15
15
|
registerModels(models: Record<string, any>): void;
|
|
16
16
|
registerRepositories(repositories: Record<string, any>): void;
|
|
17
|
-
defineCollection(options:
|
|
18
|
-
extendCollection(collectionOptions:
|
|
17
|
+
defineCollection(options: DataSourceCollectionOptions): ICollection;
|
|
18
|
+
extendCollection(collectionOptions: DataSourceCollectionOptions, mergeOptions?: MergeOptions): ICollection;
|
|
19
19
|
hasCollection(name: string): boolean;
|
|
20
20
|
getCollection(name: string): ICollection;
|
|
21
21
|
getCollections(): Array<ICollection>;
|
|
22
22
|
getRepository(name: string, sourceId?: string | number): IRepository;
|
|
23
23
|
sync(): Promise<void>;
|
|
24
24
|
removeCollection(name: string): void;
|
|
25
|
-
protected newCollection(options: any):
|
|
25
|
+
protected newCollection(options: any): DataSourceCollection;
|
|
26
26
|
}
|
|
@@ -85,7 +85,7 @@ const _CollectionManager = class _CollectionManager {
|
|
|
85
85
|
this.collections.delete(name);
|
|
86
86
|
}
|
|
87
87
|
newCollection(options) {
|
|
88
|
-
return new import_collection.
|
|
88
|
+
return new import_collection.DataSourceCollection(options, this);
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
91
|
__name(_CollectionManager, "CollectionManager");
|
package/lib/collection.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { CollectionField } from './collection-field';
|
|
2
|
-
import {
|
|
3
|
-
export declare class
|
|
4
|
-
protected options:
|
|
2
|
+
import { DataSourceCollectionOptions, ICollection, ICollectionManager, IField, IRepository } from './types';
|
|
3
|
+
export declare class DataSourceCollection implements ICollection {
|
|
4
|
+
protected options: DataSourceCollectionOptions;
|
|
5
5
|
protected collectionManager: ICollectionManager;
|
|
6
6
|
repository: IRepository;
|
|
7
7
|
fields: Map<string, IField>;
|
|
8
|
-
constructor(options:
|
|
9
|
-
updateOptions(options:
|
|
8
|
+
constructor(options: DataSourceCollectionOptions, collectionManager: ICollectionManager);
|
|
9
|
+
updateOptions(options: DataSourceCollectionOptions, mergeOptions?: any): this;
|
|
10
10
|
setField(name: string, options: any): CollectionField;
|
|
11
11
|
removeField(name: string): void;
|
|
12
12
|
getField(name: string): IField;
|
package/lib/collection.js
CHANGED
|
@@ -28,13 +28,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var collection_exports = {};
|
|
30
30
|
__export(collection_exports, {
|
|
31
|
-
|
|
31
|
+
DataSourceCollection: () => DataSourceCollection
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(collection_exports);
|
|
34
34
|
var import_deepmerge = __toESM(require("deepmerge"));
|
|
35
35
|
var import_lodash = __toESM(require("lodash"));
|
|
36
36
|
var import_collection_field = require("./collection-field");
|
|
37
|
-
const
|
|
37
|
+
const _DataSourceCollection = class _DataSourceCollection {
|
|
38
38
|
constructor(options, collectionManager) {
|
|
39
39
|
this.options = options;
|
|
40
40
|
this.collectionManager = collectionManager;
|
|
@@ -81,9 +81,9 @@ const _Collection = class _Collection {
|
|
|
81
81
|
this.repository = this.collectionManager.getRegisteredRepository(repository || "Repository");
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
|
-
__name(
|
|
85
|
-
let
|
|
84
|
+
__name(_DataSourceCollection, "DataSourceCollection");
|
|
85
|
+
let DataSourceCollection = _DataSourceCollection;
|
|
86
86
|
// Annotate the CommonJS export names for ESM import in node:
|
|
87
87
|
0 && (module.exports = {
|
|
88
|
-
|
|
88
|
+
DataSourceCollection
|
|
89
89
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Database from '@tachybase/database';
|
|
2
|
-
import {
|
|
2
|
+
import { DataSourceCollectionOptions, ICollection, ICollectionManager, IRepository, MergeOptions } from './types';
|
|
3
3
|
export declare class SequelizeCollectionManager implements ICollectionManager {
|
|
4
4
|
db: Database;
|
|
5
5
|
options: any;
|
|
@@ -12,8 +12,8 @@ export declare class SequelizeCollectionManager implements ICollectionManager {
|
|
|
12
12
|
registerModels(models: Record<string, any>): void;
|
|
13
13
|
registerRepositories(repositories: Record<string, any>): void;
|
|
14
14
|
getRegisteredRepository(key: any): any;
|
|
15
|
-
defineCollection(options:
|
|
16
|
-
extendCollection(collectionOptions:
|
|
15
|
+
defineCollection(options: DataSourceCollectionOptions): import("@tachybase/database").Collection<any, any>;
|
|
16
|
+
extendCollection(collectionOptions: DataSourceCollectionOptions, mergeOptions?: MergeOptions): ICollection;
|
|
17
17
|
hasCollection(name: string): boolean;
|
|
18
18
|
getCollection(name: string): import("@tachybase/database").Collection<any, any>;
|
|
19
19
|
removeCollection(name: string): void;
|
package/lib/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type DataSourceCollectionOptions = {
|
|
2
2
|
name: string;
|
|
3
3
|
repository?: string;
|
|
4
4
|
fields: any[];
|
|
@@ -56,8 +56,8 @@ export interface ICollectionManager {
|
|
|
56
56
|
registerModels(models: Record<string, any>): void;
|
|
57
57
|
registerRepositories(repositories: Record<string, any>): void;
|
|
58
58
|
getRegisteredRepository(key: string): IRepository;
|
|
59
|
-
defineCollection(options:
|
|
60
|
-
extendCollection(collectionOptions:
|
|
59
|
+
defineCollection(options: DataSourceCollectionOptions): ICollection;
|
|
60
|
+
extendCollection(collectionOptions: DataSourceCollectionOptions, mergeOptions?: MergeOptions): ICollection;
|
|
61
61
|
hasCollection(name: string): boolean;
|
|
62
62
|
getCollection(name: string): ICollection;
|
|
63
63
|
getCollections(): Array<ICollection>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/data-source",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.39",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
"deepmerge": "^4.3.1",
|
|
10
10
|
"koa-compose": "^4.1.0",
|
|
11
11
|
"lodash": "4.17.21",
|
|
12
|
-
"@tachybase/
|
|
13
|
-
"@tachybase/
|
|
14
|
-
"@tachybase/
|
|
15
|
-
"@tachybase/
|
|
16
|
-
"@tachybase/
|
|
12
|
+
"@tachybase/acl": "1.3.39",
|
|
13
|
+
"@tachybase/resourcer": "1.3.39",
|
|
14
|
+
"@tachybase/utils": "1.3.39",
|
|
15
|
+
"@tachybase/actions": "1.3.39",
|
|
16
|
+
"@tachybase/database": "1.3.39"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@types/koa": "^2.15.0",
|