@nocobase/data-source-manager 1.2.12-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 +7 -7
- package/lib/collection-field.d.ts +0 -15
- package/lib/collection-field.js +0 -53
- package/lib/collection-manager.d.ts +0 -36
- package/lib/collection-manager.js +0 -116
- package/lib/collection.d.ts +0 -24
- package/lib/collection.js +0 -95
- package/lib/data-source-factory.d.ts +0 -15
- package/lib/data-source-factory.js +0 -54
- package/lib/data-source-manager.d.ts +0 -35
- package/lib/data-source-manager.js +0 -105
- package/lib/data-source.d.ts +0 -30
- package/lib/data-source.js +0 -136
- package/lib/default-actions/list.d.ts +0 -10
- package/lib/default-actions/list.js +0 -103
- package/lib/default-actions/move.d.ts +0 -10
- package/lib/default-actions/move.js +0 -52
- package/lib/default-actions/proxy-to-repository.d.ts +0 -10
- package/lib/default-actions/proxy-to-repository.js +0 -62
- package/lib/default-actions/utils.d.ts +0 -12
- package/lib/default-actions/utils.js +0 -43
- package/lib/index.d.ts +0 -16
- package/lib/index.js +0 -44
- package/lib/load-default-actions.d.ts +0 -13
- package/lib/load-default-actions.js +0 -120
- package/lib/repository.d.ts +0 -18
- package/lib/repository.js +0 -75
- package/lib/sequelize-collection-manager.d.ts +0 -34
- package/lib/sequelize-collection-manager.js +0 -112
- package/lib/sequelize-data-source.d.ts +0 -13
- package/lib/sequelize-data-source.js +0 -45
- package/lib/types.d.ts +0 -86
- package/lib/types.js +0 -24
- package/lib/utils.d.ts +0 -10
- package/lib/utils.js +0 -55
package/lib/repository.js
DELETED
|
@@ -1,75 +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 repository_exports = {};
|
|
39
|
-
__export(repository_exports, {
|
|
40
|
-
Repository: () => Repository
|
|
41
|
-
});
|
|
42
|
-
module.exports = __toCommonJS(repository_exports);
|
|
43
|
-
var console = __toESM(require("console"));
|
|
44
|
-
/* istanbul ignore file -- @preserve */
|
|
45
|
-
const _Repository = class _Repository {
|
|
46
|
-
async create(options) {
|
|
47
|
-
console.log("Repository.create....");
|
|
48
|
-
}
|
|
49
|
-
async update(options) {
|
|
50
|
-
}
|
|
51
|
-
async find(options) {
|
|
52
|
-
return [];
|
|
53
|
-
}
|
|
54
|
-
async findOne(options) {
|
|
55
|
-
return {
|
|
56
|
-
toJSON() {
|
|
57
|
-
return {};
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
async destroy(options) {
|
|
62
|
-
}
|
|
63
|
-
count(options) {
|
|
64
|
-
return Promise.resolve(void 0);
|
|
65
|
-
}
|
|
66
|
-
findAndCount(options) {
|
|
67
|
-
return Promise.resolve([[], void 0]);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
__name(_Repository, "Repository");
|
|
71
|
-
let Repository = _Repository;
|
|
72
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
73
|
-
0 && (module.exports = {
|
|
74
|
-
Repository
|
|
75
|
-
});
|
|
@@ -1,34 +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 { Database } from '@nocobase/database';
|
|
10
|
-
import { CollectionOptions, ICollection, ICollectionManager, IFieldInterface, IRepository, MergeOptions } from './types';
|
|
11
|
-
export declare class SequelizeCollectionManager implements ICollectionManager {
|
|
12
|
-
db: Database;
|
|
13
|
-
options: any;
|
|
14
|
-
constructor(options: any);
|
|
15
|
-
collectionsFilter(): any;
|
|
16
|
-
createDB(options?: any): any;
|
|
17
|
-
registerFieldTypes(types: Record<string, any>): void;
|
|
18
|
-
registerFieldInterfaces(): void;
|
|
19
|
-
registerCollectionTemplates(): void;
|
|
20
|
-
registerModels(models: Record<string, any>): void;
|
|
21
|
-
registerRepositories(repositories: Record<string, any>): void;
|
|
22
|
-
getRegisteredRepository(key: any): any;
|
|
23
|
-
defineCollection(options: CollectionOptions): import("@nocobase/database").Collection<any, any>;
|
|
24
|
-
extendCollection(collectionOptions: CollectionOptions, mergeOptions?: MergeOptions): ICollection;
|
|
25
|
-
hasCollection(name: string): boolean;
|
|
26
|
-
getCollection(name: string): import("@nocobase/database").Collection<any, any>;
|
|
27
|
-
getCollections(): import("@nocobase/database").Collection<any, any>[];
|
|
28
|
-
getRepository<R = IRepository>(name: string, sourceId?: string | number): R;
|
|
29
|
-
sync(): Promise<void>;
|
|
30
|
-
registerFieldInterface(name: string, fieldInterface: new (options: any) => IFieldInterface): void;
|
|
31
|
-
getFieldInterface(name: string): {
|
|
32
|
-
new (options: any): IFieldInterface | undefined;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
@@ -1,112 +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 sequelize_collection_manager_exports = {};
|
|
29
|
-
__export(sequelize_collection_manager_exports, {
|
|
30
|
-
SequelizeCollectionManager: () => SequelizeCollectionManager
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(sequelize_collection_manager_exports);
|
|
33
|
-
var import_database = require("@nocobase/database");
|
|
34
|
-
/* istanbul ignore file -- @preserve */
|
|
35
|
-
const _SequelizeCollectionManager = class _SequelizeCollectionManager {
|
|
36
|
-
db;
|
|
37
|
-
options;
|
|
38
|
-
constructor(options) {
|
|
39
|
-
this.db = this.createDB(options);
|
|
40
|
-
this.options = options;
|
|
41
|
-
}
|
|
42
|
-
collectionsFilter() {
|
|
43
|
-
if (this.options.collectionsFilter) {
|
|
44
|
-
return this.options.collectionsFilter;
|
|
45
|
-
}
|
|
46
|
-
return (collection) => {
|
|
47
|
-
return collection.options.introspected;
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
createDB(options = {}) {
|
|
51
|
-
if (options.database instanceof import_database.Database) {
|
|
52
|
-
return options.database;
|
|
53
|
-
}
|
|
54
|
-
return new import_database.Database(options);
|
|
55
|
-
}
|
|
56
|
-
registerFieldTypes(types) {
|
|
57
|
-
this.db.registerFieldTypes(types);
|
|
58
|
-
}
|
|
59
|
-
registerFieldInterfaces() {
|
|
60
|
-
}
|
|
61
|
-
registerCollectionTemplates() {
|
|
62
|
-
}
|
|
63
|
-
registerModels(models) {
|
|
64
|
-
return this.db.registerModels(models);
|
|
65
|
-
}
|
|
66
|
-
registerRepositories(repositories) {
|
|
67
|
-
return this.db.registerModels(repositories);
|
|
68
|
-
}
|
|
69
|
-
getRegisteredRepository(key) {
|
|
70
|
-
if (typeof key !== "string") {
|
|
71
|
-
return key;
|
|
72
|
-
}
|
|
73
|
-
return this.db.repositories.get(key);
|
|
74
|
-
}
|
|
75
|
-
defineCollection(options) {
|
|
76
|
-
const collection = this.db.collection(options);
|
|
77
|
-
collection.model.refreshAttributes();
|
|
78
|
-
collection.model._findAutoIncrementAttribute();
|
|
79
|
-
return collection;
|
|
80
|
-
}
|
|
81
|
-
extendCollection(collectionOptions, mergeOptions) {
|
|
82
|
-
return this.db.extendCollection(collectionOptions, mergeOptions);
|
|
83
|
-
}
|
|
84
|
-
hasCollection(name) {
|
|
85
|
-
return this.db.hasCollection(name);
|
|
86
|
-
}
|
|
87
|
-
getCollection(name) {
|
|
88
|
-
return this.db.getCollection(name);
|
|
89
|
-
}
|
|
90
|
-
getCollections() {
|
|
91
|
-
const collectionsFilter = this.collectionsFilter();
|
|
92
|
-
return [...this.db.collections.values()].filter((collection) => collectionsFilter(collection));
|
|
93
|
-
}
|
|
94
|
-
getRepository(name, sourceId) {
|
|
95
|
-
return this.db.getRepository(name, sourceId);
|
|
96
|
-
}
|
|
97
|
-
async sync() {
|
|
98
|
-
await this.db.sync();
|
|
99
|
-
}
|
|
100
|
-
registerFieldInterface(name, fieldInterface) {
|
|
101
|
-
this.db.interfaceManager.registerInterfaceType(name, fieldInterface);
|
|
102
|
-
}
|
|
103
|
-
getFieldInterface(name) {
|
|
104
|
-
return this.db.interfaceManager.getInterfaceType(name);
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
__name(_SequelizeCollectionManager, "SequelizeCollectionManager");
|
|
108
|
-
let SequelizeCollectionManager = _SequelizeCollectionManager;
|
|
109
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
110
|
-
0 && (module.exports = {
|
|
111
|
-
SequelizeCollectionManager
|
|
112
|
-
});
|
|
@@ -1,13 +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
|
-
import { SequelizeCollectionManager } from './sequelize-collection-manager';
|
|
11
|
-
export declare class SequelizeDataSource extends DataSource {
|
|
12
|
-
createCollectionManager(options?: any): SequelizeCollectionManager;
|
|
13
|
-
}
|
|
@@ -1,45 +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 sequelize_data_source_exports = {};
|
|
29
|
-
__export(sequelize_data_source_exports, {
|
|
30
|
-
SequelizeDataSource: () => SequelizeDataSource
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(sequelize_data_source_exports);
|
|
33
|
-
var import_data_source = require("./data-source");
|
|
34
|
-
var import_sequelize_collection_manager = require("./sequelize-collection-manager");
|
|
35
|
-
const _SequelizeDataSource = class _SequelizeDataSource extends import_data_source.DataSource {
|
|
36
|
-
createCollectionManager(options) {
|
|
37
|
-
return new import_sequelize_collection_manager.SequelizeCollectionManager(options.collectionManager);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
__name(_SequelizeDataSource, "SequelizeDataSource");
|
|
41
|
-
let SequelizeDataSource = _SequelizeDataSource;
|
|
42
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
-
0 && (module.exports = {
|
|
44
|
-
SequelizeDataSource
|
|
45
|
-
});
|
package/lib/types.d.ts
DELETED
|
@@ -1,86 +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
|
-
export type CollectionOptions = {
|
|
10
|
-
name: string;
|
|
11
|
-
repository?: string;
|
|
12
|
-
fields: any[];
|
|
13
|
-
[key: string]: any;
|
|
14
|
-
};
|
|
15
|
-
export type FieldOptions = {
|
|
16
|
-
name: string;
|
|
17
|
-
field: string;
|
|
18
|
-
rawType: string;
|
|
19
|
-
type: string;
|
|
20
|
-
description?: string;
|
|
21
|
-
interface?: string;
|
|
22
|
-
uiSchema?: any;
|
|
23
|
-
possibleTypes?: string[];
|
|
24
|
-
defaultValue?: any;
|
|
25
|
-
primaryKey: boolean;
|
|
26
|
-
unique: boolean;
|
|
27
|
-
allowNull?: boolean;
|
|
28
|
-
autoIncrement?: boolean;
|
|
29
|
-
[key: string]: any;
|
|
30
|
-
};
|
|
31
|
-
export interface IField {
|
|
32
|
-
options: FieldOptions;
|
|
33
|
-
isRelationField(): boolean;
|
|
34
|
-
}
|
|
35
|
-
export interface IRelationField extends IField {
|
|
36
|
-
targetCollection(): ICollection;
|
|
37
|
-
}
|
|
38
|
-
export interface IFieldInterface {
|
|
39
|
-
options: FieldOptions;
|
|
40
|
-
toString(value: any, ctx?: any): string;
|
|
41
|
-
toValue(str: string, ctx?: any): any;
|
|
42
|
-
}
|
|
43
|
-
export type FindOptions = any;
|
|
44
|
-
export interface ICollection {
|
|
45
|
-
repository: IRepository;
|
|
46
|
-
updateOptions(options: CollectionOptions, mergeOptions?: MergeOptions): void;
|
|
47
|
-
setField(name: string, options: any): IField;
|
|
48
|
-
removeField(name: string): void;
|
|
49
|
-
getFields(): Array<IField>;
|
|
50
|
-
getField(name: string): IField;
|
|
51
|
-
[key: string]: any;
|
|
52
|
-
}
|
|
53
|
-
export interface IModel {
|
|
54
|
-
toJSON: () => any;
|
|
55
|
-
[key: string]: any;
|
|
56
|
-
}
|
|
57
|
-
export interface IRepository {
|
|
58
|
-
find(options?: FindOptions): Promise<IModel[]>;
|
|
59
|
-
findOne(options?: any): Promise<IModel>;
|
|
60
|
-
count(options?: any): Promise<Number>;
|
|
61
|
-
findAndCount(options?: any): Promise<[IModel[], Number]>;
|
|
62
|
-
create(options: any): any;
|
|
63
|
-
update(options: any): any;
|
|
64
|
-
destroy(options: any): any;
|
|
65
|
-
[key: string]: any;
|
|
66
|
-
}
|
|
67
|
-
export type MergeOptions = {
|
|
68
|
-
[key: string]: any;
|
|
69
|
-
};
|
|
70
|
-
export interface ICollectionManager {
|
|
71
|
-
registerFieldTypes(types: Record<string, any>): void;
|
|
72
|
-
registerFieldInterfaces(interfaces: Record<string, new (options: any) => IFieldInterface>): void;
|
|
73
|
-
registerFieldInterface(name: string, fieldInterface: new (options: any) => IFieldInterface): void;
|
|
74
|
-
getFieldInterface(name: string): new (options: any) => IFieldInterface | undefined;
|
|
75
|
-
registerCollectionTemplates(templates: Record<string, any>): void;
|
|
76
|
-
registerModels(models: Record<string, any>): void;
|
|
77
|
-
registerRepositories(repositories: Record<string, any>): void;
|
|
78
|
-
getRegisteredRepository(key: string): IRepository;
|
|
79
|
-
defineCollection(options: CollectionOptions): ICollection;
|
|
80
|
-
extendCollection(collectionOptions: CollectionOptions, mergeOptions?: MergeOptions): ICollection;
|
|
81
|
-
hasCollection(name: string): boolean;
|
|
82
|
-
getCollection(name: string): ICollection;
|
|
83
|
-
getCollections(): Array<ICollection>;
|
|
84
|
-
getRepository(name: string, sourceId?: string | number): IRepository;
|
|
85
|
-
sync(): Promise<void>;
|
|
86
|
-
}
|
package/lib/types.js
DELETED
|
@@ -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
|
-
|
|
10
|
-
var __defProp = Object.defineProperty;
|
|
11
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
-
var __copyProps = (to, from, except, desc) => {
|
|
15
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
-
for (let key of __getOwnPropNames(from))
|
|
17
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
23
|
-
var types_exports = {};
|
|
24
|
-
module.exports = __toCommonJS(types_exports);
|
package/lib/utils.d.ts
DELETED
|
@@ -1,10 +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
|
-
export declare function parseCollectionName(collection: string): string[];
|
|
10
|
-
export declare function joinCollectionName(dataSourceName: string, collectionName: string): string;
|
package/lib/utils.js
DELETED
|
@@ -1,55 +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 utils_exports = {};
|
|
29
|
-
__export(utils_exports, {
|
|
30
|
-
joinCollectionName: () => joinCollectionName,
|
|
31
|
-
parseCollectionName: () => parseCollectionName
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(utils_exports);
|
|
34
|
-
function parseCollectionName(collection) {
|
|
35
|
-
if (!collection) {
|
|
36
|
-
return [];
|
|
37
|
-
}
|
|
38
|
-
const dataSourceCollection = collection.split(":");
|
|
39
|
-
const collectionName = dataSourceCollection.pop();
|
|
40
|
-
const dataSourceName = dataSourceCollection[0] ?? "main";
|
|
41
|
-
return [dataSourceName, collectionName];
|
|
42
|
-
}
|
|
43
|
-
__name(parseCollectionName, "parseCollectionName");
|
|
44
|
-
function joinCollectionName(dataSourceName, collectionName) {
|
|
45
|
-
if (!dataSourceName || dataSourceName === "main") {
|
|
46
|
-
return collectionName;
|
|
47
|
-
}
|
|
48
|
-
return `${dataSourceName}:${collectionName}`;
|
|
49
|
-
}
|
|
50
|
-
__name(joinCollectionName, "joinCollectionName");
|
|
51
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
52
|
-
0 && (module.exports = {
|
|
53
|
-
joinCollectionName,
|
|
54
|
-
parseCollectionName
|
|
55
|
-
});
|