@nocobase/data-source-manager 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 CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@nocobase/data-source-manager",
3
- "version": "1.2.13-alpha",
3
+ "version": "1.3.0-alpha.20240710084543",
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": "1.2.13-alpha",
10
- "@nocobase/cache": "1.2.13-alpha",
11
- "@nocobase/database": "1.2.13-alpha",
12
- "@nocobase/resourcer": "1.2.13-alpha",
13
- "@nocobase/utils": "1.2.13-alpha",
9
+ "@nocobase/actions": "1.3.0-alpha.20240710084543",
10
+ "@nocobase/cache": "1.3.0-alpha.20240710084543",
11
+ "@nocobase/database": "1.3.0-alpha.20240710084543",
12
+ "@nocobase/resourcer": "1.3.0-alpha.20240710084543",
13
+ "@nocobase/utils": "1.3.0-alpha.20240710084543",
14
14
  "@types/jsonwebtoken": "^8.5.8",
15
15
  "jsonwebtoken": "^8.5.1"
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": "b6a1c2ee330b47c2581ea2ce15ee46210e6220f2"
22
+ "gitHead": "07a8b596fc64a9779a194cb9b0dc2ca7570ed9d4"
23
23
  }
@@ -1,15 +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 { FieldOptions, IField } from './types';
10
- export declare class CollectionField implements IField {
11
- options: FieldOptions;
12
- constructor(options: FieldOptions);
13
- updateOptions(options: any): void;
14
- isRelationField(): boolean;
15
- }
@@ -1,53 +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 collection_field_exports = {};
29
- __export(collection_field_exports, {
30
- CollectionField: () => CollectionField
31
- });
32
- module.exports = __toCommonJS(collection_field_exports);
33
- const _CollectionField = class _CollectionField {
34
- options;
35
- constructor(options) {
36
- this.updateOptions(options);
37
- }
38
- updateOptions(options) {
39
- this.options = {
40
- ...this.options,
41
- ...options
42
- };
43
- }
44
- isRelationField() {
45
- return false;
46
- }
47
- };
48
- __name(_CollectionField, "CollectionField");
49
- let CollectionField = _CollectionField;
50
- // Annotate the CommonJS export names for ESM import in node:
51
- 0 && (module.exports = {
52
- CollectionField
53
- });
@@ -1,36 +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 { CollectionOptions, ICollection, ICollectionManager, IFieldInterface, IRepository, MergeOptions } from './types';
10
- export declare class CollectionManager implements ICollectionManager {
11
- protected collections: Map<string, ICollection>;
12
- protected repositories: Map<string, IRepository>;
13
- protected models: Map<string, any>;
14
- constructor(options?: {});
15
- getRegisteredFieldType(type: any): void;
16
- getRegisteredFieldInterface(key: string): void;
17
- getRegisteredModel(key: string): any;
18
- getRegisteredRepository(key: any): any;
19
- registerFieldTypes(): void;
20
- registerFieldInterfaces(interfaces: Record<string, new (options: any) => IFieldInterface>): void;
21
- registerFieldInterface(name: string, fieldInterface: new (options: any) => IFieldInterface): void;
22
- getFieldInterface(name: string): {
23
- new (options: any): IFieldInterface | undefined;
24
- };
25
- registerCollectionTemplates(): void;
26
- registerModels(models: Record<string, any>): void;
27
- registerRepositories(repositories: Record<string, any>): void;
28
- defineCollection(options: CollectionOptions): ICollection;
29
- extendCollection(collectionOptions: CollectionOptions, mergeOptions?: MergeOptions): ICollection;
30
- hasCollection(name: string): boolean;
31
- getCollection(name: string): ICollection;
32
- getCollections(): Array<ICollection>;
33
- getRepository(name: string, sourceId?: string | number): IRepository;
34
- sync(): Promise<void>;
35
- protected newCollection(options: any): ICollection;
36
- }
@@ -1,116 +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 collection_manager_exports = {};
29
- __export(collection_manager_exports, {
30
- CollectionManager: () => CollectionManager
31
- });
32
- module.exports = __toCommonJS(collection_manager_exports);
33
- var import_collection = require("./collection");
34
- const _CollectionManager = class _CollectionManager {
35
- collections = /* @__PURE__ */ new Map();
36
- repositories = /* @__PURE__ */ new Map();
37
- models = /* @__PURE__ */ new Map();
38
- constructor(options = {}) {
39
- }
40
- /* istanbul ignore next -- @preserve */
41
- getRegisteredFieldType(type) {
42
- }
43
- /* istanbul ignore next -- @preserve */
44
- getRegisteredFieldInterface(key) {
45
- }
46
- /* istanbul ignore next -- @preserve */
47
- getRegisteredModel(key) {
48
- return this.models.get(key);
49
- }
50
- getRegisteredRepository(key) {
51
- if (typeof key !== "string") {
52
- return key;
53
- }
54
- return this.repositories.get(key);
55
- }
56
- /* istanbul ignore next -- @preserve */
57
- registerFieldTypes() {
58
- }
59
- registerFieldInterfaces(interfaces) {
60
- Object.keys(interfaces).forEach((key) => {
61
- this.registerFieldInterface(key, interfaces[key]);
62
- });
63
- }
64
- registerFieldInterface(name, fieldInterface) {
65
- }
66
- getFieldInterface(name) {
67
- return;
68
- }
69
- /* istanbul ignore next -- @preserve */
70
- registerCollectionTemplates() {
71
- }
72
- registerModels(models) {
73
- Object.keys(models).forEach((key) => {
74
- this.models.set(key, models[key]);
75
- });
76
- }
77
- registerRepositories(repositories) {
78
- Object.keys(repositories).forEach((key) => {
79
- this.repositories.set(key, repositories[key]);
80
- });
81
- }
82
- defineCollection(options) {
83
- const collection = this.newCollection(options);
84
- this.collections.set(options.name, collection);
85
- return collection;
86
- }
87
- extendCollection(collectionOptions, mergeOptions) {
88
- const collection = this.getCollection(collectionOptions.name);
89
- collection.updateOptions(collectionOptions, mergeOptions);
90
- return collection;
91
- }
92
- hasCollection(name) {
93
- return !!this.getCollection(name);
94
- }
95
- getCollection(name) {
96
- return this.collections.get(name);
97
- }
98
- getCollections() {
99
- return [...this.collections.values()];
100
- }
101
- getRepository(name, sourceId) {
102
- const collection = this.getCollection(name);
103
- return collection.repository;
104
- }
105
- async sync() {
106
- }
107
- newCollection(options) {
108
- return new import_collection.Collection(options, this);
109
- }
110
- };
111
- __name(_CollectionManager, "CollectionManager");
112
- let CollectionManager = _CollectionManager;
113
- // Annotate the CommonJS export names for ESM import in node:
114
- 0 && (module.exports = {
115
- CollectionManager
116
- });
@@ -1,24 +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 { CollectionOptions, ICollection, ICollectionManager, IField, IRepository } from './types';
10
- import { CollectionField } from './collection-field';
11
- export declare class Collection implements ICollection {
12
- protected options: CollectionOptions;
13
- protected collectionManager: ICollectionManager;
14
- repository: IRepository;
15
- fields: Map<string, IField>;
16
- constructor(options: CollectionOptions, collectionManager: ICollectionManager);
17
- updateOptions(options: CollectionOptions, mergeOptions?: any): this;
18
- setFields(fields: any[]): void;
19
- setField(name: string, options: any): CollectionField;
20
- removeField(name: string): void;
21
- getField(name: string): IField;
22
- getFields(): IField[];
23
- protected setRepository(repository: any): void;
24
- }
package/lib/collection.js DELETED
@@ -1,95 +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 __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 collection_exports = {};
39
- __export(collection_exports, {
40
- Collection: () => Collection
41
- });
42
- module.exports = __toCommonJS(collection_exports);
43
- var import_lodash = __toESM(require("lodash"));
44
- var import_deepmerge = __toESM(require("deepmerge"));
45
- var import_collection_field = require("./collection-field");
46
- const _Collection = class _Collection {
47
- constructor(options, collectionManager) {
48
- this.options = options;
49
- this.collectionManager = collectionManager;
50
- this.setRepository(options.repository);
51
- if (options.fields) {
52
- this.setFields(options.fields);
53
- }
54
- }
55
- repository;
56
- fields = /* @__PURE__ */ new Map();
57
- updateOptions(options, mergeOptions) {
58
- let newOptions = import_lodash.default.cloneDeep(options);
59
- newOptions = (0, import_deepmerge.default)(this.options, newOptions, mergeOptions);
60
- this.options = newOptions;
61
- this.setFields(newOptions.fields || []);
62
- if (options.repository) {
63
- this.setRepository(options.repository);
64
- }
65
- return this;
66
- }
67
- setFields(fields) {
68
- for (const field of fields) {
69
- this.setField(field.name, field);
70
- }
71
- }
72
- setField(name, options) {
73
- const field = new import_collection_field.CollectionField(options);
74
- this.fields.set(name, field);
75
- return field;
76
- }
77
- removeField(name) {
78
- this.fields.delete(name);
79
- }
80
- getField(name) {
81
- return this.fields.get(name);
82
- }
83
- getFields() {
84
- return [...this.fields.values()];
85
- }
86
- setRepository(repository) {
87
- this.repository = this.collectionManager.getRegisteredRepository(repository || "Repository");
88
- }
89
- };
90
- __name(_Collection, "Collection");
91
- let Collection = _Collection;
92
- // Annotate the CommonJS export names for ESM import in node:
93
- 0 && (module.exports = {
94
- Collection
95
- });
@@ -1,15 +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 { DataSource } from './data-source';
10
- export declare class DataSourceFactory {
11
- collectionTypes: Map<string, typeof DataSource>;
12
- register(type: string, dataSourceClass: typeof DataSource): void;
13
- getClass(type: string): typeof DataSource;
14
- create(type: string, options?: any): DataSource;
15
- }
@@ -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
-
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 data_source_factory_exports = {};
29
- __export(data_source_factory_exports, {
30
- DataSourceFactory: () => DataSourceFactory
31
- });
32
- module.exports = __toCommonJS(data_source_factory_exports);
33
- const _DataSourceFactory = class _DataSourceFactory {
34
- collectionTypes = /* @__PURE__ */ new Map();
35
- register(type, dataSourceClass) {
36
- this.collectionTypes.set(type, dataSourceClass);
37
- }
38
- getClass(type) {
39
- return this.collectionTypes.get(type);
40
- }
41
- create(type, options = {}) {
42
- const klass = this.collectionTypes.get(type);
43
- if (!klass) {
44
- throw new Error(`Data source type "${type}" not found`);
45
- }
46
- return new klass(options);
47
- }
48
- };
49
- __name(_DataSourceFactory, "DataSourceFactory");
50
- let DataSourceFactory = _DataSourceFactory;
51
- // Annotate the CommonJS export names for ESM import in node:
52
- 0 && (module.exports = {
53
- DataSourceFactory
54
- });
@@ -1,35 +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 { ToposortOptions } from '@nocobase/utils';
10
- import { DataSource } from './data-source';
11
- import { DataSourceFactory } from './data-source-factory';
12
- type DataSourceHook = (dataSource: DataSource) => void;
13
- export declare class DataSourceManager {
14
- options: {};
15
- dataSources: Map<string, DataSource>;
16
- /**
17
- * @internal
18
- */
19
- factory: DataSourceFactory;
20
- protected middlewares: any[];
21
- private onceHooks;
22
- private beforeAddHooks;
23
- constructor(options?: {});
24
- get(dataSourceKey: string): DataSource;
25
- add(dataSource: DataSource, options?: any): Promise<void>;
26
- use(fn: any, options?: ToposortOptions): void;
27
- middleware(): (ctx: any, next: any) => Promise<any>;
28
- registerDataSourceType(type: string, DataSourceClass: typeof DataSource): void;
29
- getDataSourceType(type: string): typeof DataSource | undefined;
30
- buildDataSourceByType(type: string, options?: any): DataSource;
31
- beforeAddDataSource(hook: DataSourceHook): void;
32
- afterAddDataSource(hook: DataSourceHook): void;
33
- private addHookAndRun;
34
- }
35
- export {};
@@ -1,105 +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 data_source_manager_exports = {};
29
- __export(data_source_manager_exports, {
30
- DataSourceManager: () => DataSourceManager
31
- });
32
- module.exports = __toCommonJS(data_source_manager_exports);
33
- var import_data_source_factory = require("./data-source-factory");
34
- const _DataSourceManager = class _DataSourceManager {
35
- constructor(options = {}) {
36
- this.options = options;
37
- this.dataSources = /* @__PURE__ */ new Map();
38
- this.middlewares = [];
39
- }
40
- dataSources;
41
- /**
42
- * @internal
43
- */
44
- factory = new import_data_source_factory.DataSourceFactory();
45
- middlewares = [];
46
- onceHooks = [];
47
- beforeAddHooks = [];
48
- get(dataSourceKey) {
49
- return this.dataSources.get(dataSourceKey);
50
- }
51
- async add(dataSource, options = {}) {
52
- for (const hook of this.beforeAddHooks) {
53
- hook(dataSource);
54
- }
55
- await dataSource.load(options);
56
- this.dataSources.set(dataSource.name, dataSource);
57
- for (const hook of this.onceHooks) {
58
- hook(dataSource);
59
- }
60
- }
61
- use(fn, options) {
62
- this.middlewares.push([fn, options]);
63
- }
64
- middleware() {
65
- return async (ctx, next) => {
66
- const name = ctx.get("x-data-source") || "main";
67
- if (!this.dataSources.has(name)) {
68
- ctx.throw(`data source ${name} does not exist`);
69
- }
70
- const ds = this.dataSources.get(name);
71
- ctx.dataSource = ds;
72
- return ds.middleware(this.middlewares)(ctx, next);
73
- };
74
- }
75
- registerDataSourceType(type, DataSourceClass) {
76
- this.factory.register(type, DataSourceClass);
77
- }
78
- getDataSourceType(type) {
79
- return this.factory.getClass(type);
80
- }
81
- buildDataSourceByType(type, options = {}) {
82
- return this.factory.create(type, options);
83
- }
84
- beforeAddDataSource(hook) {
85
- this.beforeAddHooks.push(hook);
86
- for (const dataSource of this.dataSources.values()) {
87
- hook(dataSource);
88
- }
89
- }
90
- afterAddDataSource(hook) {
91
- this.addHookAndRun(hook);
92
- }
93
- addHookAndRun(hook) {
94
- this.onceHooks.push(hook);
95
- for (const dataSource of this.dataSources.values()) {
96
- hook(dataSource);
97
- }
98
- }
99
- };
100
- __name(_DataSourceManager, "DataSourceManager");
101
- let DataSourceManager = _DataSourceManager;
102
- // Annotate the CommonJS export names for ESM import in node:
103
- 0 && (module.exports = {
104
- DataSourceManager
105
- });
@@ -1,30 +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
- /// <reference types="node" />
10
- import { ACL } from '@nocobase/acl';
11
- import { ResourceManager } from '@nocobase/resourcer';
12
- import EventEmitter from 'events';
13
- import { ICollectionManager } from './types';
14
- export type DataSourceOptions = any;
15
- export declare abstract class DataSource extends EventEmitter {
16
- protected options: DataSourceOptions;
17
- collectionManager: ICollectionManager;
18
- resourceManager: ResourceManager;
19
- acl: ACL;
20
- constructor(options: DataSourceOptions);
21
- get name(): any;
22
- static testConnection(options?: any): Promise<boolean>;
23
- init(options?: DataSourceOptions): void;
24
- middleware(middlewares?: any): (ctx: any, next: any) => Promise<any>;
25
- createACL(): ACL;
26
- createResourceManager(options: any): ResourceManager;
27
- load(options?: any): Promise<void>;
28
- abstract createCollectionManager(options?: any): ICollectionManager;
29
- protected collectionToResourceMiddleware(): (ctx: any, next: any) => Promise<any>;
30
- }