@nocobase/plugin-data-source-manager 2.1.0-beta.15 → 2.1.0-beta.16
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/dist/ai/ai-employees/orin/index.d.ts +10 -0
- package/dist/ai/ai-employees/orin/index.js +58 -0
- package/dist/ai/ai-employees/orin/skills/data-modeling/SKILLS.md +245 -0
- package/dist/ai/{tools → ai-employees/orin/skills/data-modeling/tools}/defineCollections.js +1 -1
- package/dist/ai/{tools → ai-employees/orin/skills/data-modeling/tools}/intentRouter.js +1 -1
- package/dist/ai/{tools/data-query → common}/common.js +63 -11
- package/dist/ai/{tools/data-query → common}/utils.d.ts +1 -0
- package/dist/ai/{tools/data-query → common}/utils.js +15 -0
- package/dist/ai/skills/data-metadata/SKILLS.md +108 -0
- package/dist/ai/{tools → skills/data-metadata/tools}/getCollectionMetadata.js +2 -2
- package/dist/ai/{tools → skills/data-metadata/tools}/getCollectionNames.js +2 -2
- package/dist/ai/{tools → skills/data-metadata/tools}/getDataSources.js +2 -2
- package/dist/ai/{tools → skills/data-metadata/tools}/searchFieldMetadata.js +2 -2
- package/dist/ai/skills/data-query/SKILLS.md +222 -0
- package/dist/ai/skills/data-query/tools/dataQuery.js +282 -0
- package/dist/ai/{tools/data-query → skills/data-query/tools}/dataSourceCounting.js +12 -4
- package/dist/ai/skills/data-query/tools/dataSourceQuery.d.ts +10 -0
- package/dist/ai/{tools/data-query → skills/data-query/tools}/dataSourceQuery.js +12 -5
- package/dist/client/271.b3c0013cf976adf0.js +10 -0
- package/dist/client/369.6025f2112454fab1.js +10 -0
- package/dist/client/397.c8c6659cf3f7ac1c.js +10 -0
- package/dist/client/416.197712b8b93033c5.js +10 -0
- package/dist/client/420.0c3e3c9888e0ba31.js +10 -0
- package/dist/client/603.d6022bceb934f5b0.js +10 -0
- package/dist/client/644.b98e4b39058e9c32.js +10 -0
- package/dist/client/936.d5ab7aecb4eb6004.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +11 -11
- package/dist/locale/en-US.json +11 -3
- package/dist/locale/zh-CN.json +11 -3
- package/dist/node_modules/zod/index.cjs +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/mcp-post-processors.d.ts +24 -0
- package/dist/server/mcp-post-processors.js +158 -0
- package/dist/server/models/data-source.js +3 -13
- package/dist/server/plugin.js +2 -0
- package/dist/swagger/index.d.ts +122 -0
- package/dist/swagger/index.js +146 -0
- package/package.json +2 -2
- package/dist/client/10.dbc11c4479ec0262.js +0 -10
- package/dist/client/236.f7fbbbeb687fdeac.js +0 -10
- package/dist/client/296.255678bb116011b8.js +0 -10
- package/dist/client/398.24f81afefe0fcbc3.js +0 -10
- package/dist/client/65.3859ac7ded866603.js +0 -10
- package/dist/client/674.fc041eca1d68ccaa.js +0 -10
- package/dist/client/746.58b84c1c2e6f99df.js +0 -10
- package/dist/client/843.f47754f6f7d3351e.js +0 -10
- /package/dist/ai/{tools → ai-employees/orin/skills/data-modeling/tools}/defineCollections.d.ts +0 -0
- /package/dist/ai/{tools → ai-employees/orin/skills/data-modeling/tools}/intentRouter.d.ts +0 -0
- /package/dist/ai/{tools/data-query → common}/common.d.ts +0 -0
- /package/dist/ai/{tools → skills/data-metadata/tools}/getCollectionMetadata.d.ts +0 -0
- /package/dist/ai/{tools → skills/data-metadata/tools}/getCollectionNames.d.ts +0 -0
- /package/dist/ai/{tools → skills/data-metadata/tools}/getDataSources.d.ts +0 -0
- /package/dist/ai/{tools → skills/data-metadata/tools}/searchFieldMetadata.d.ts +0 -0
- /package/dist/ai/{tools/data-query/dataSourceCounting.d.ts → skills/data-query/tools/dataQuery.d.ts} +0 -0
- /package/dist/ai/{tools/data-query/dataSourceQuery.d.ts → skills/data-query/tools/dataSourceCounting.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"zod","version":"4.3.5","type":"module","license":"MIT","author":"Colin McDonnell <zod@colinhacks.com>","description":"TypeScript-first schema declaration and validation library with static type inference","homepage":"https://zod.dev","llms":"https://zod.dev/llms.txt","llmsFull":"https://zod.dev/llms-full.txt","mcpServer":"https://mcp.inkeep.com/zod/mcp","funding":"https://github.com/sponsors/colinhacks","sideEffects":false,"files":["src","**/*.js","**/*.mjs","**/*.cjs","**/*.d.ts","**/*.d.mts","**/*.d.cts","**/package.json"],"keywords":["typescript","schema","validation","type","inference"],"main":"./index.cjs","types":"./index.d.cts","module":"./index.js","zshy":{"exports":{"./package.json":"./package.json",".":"./src/index.ts","./mini":"./src/mini/index.ts","./locales":"./src/locales/index.ts","./v3":"./src/v3/index.ts","./v4":"./src/v4/index.ts","./v4-mini":"./src/v4-mini/index.ts","./v4/mini":"./src/v4/mini/index.ts","./v4/core":"./src/v4/core/index.ts","./v4/locales":"./src/v4/locales/index.ts","./v4/locales/*":"./src/v4/locales/*"},"conditions":{"@zod/source":"src"}},"exports":{"./package.json":"./package.json",".":{"@zod/source":"./src/index.ts","types":"./index.d.cts","import":"./index.js","require":"./index.cjs"},"./mini":{"@zod/source":"./src/mini/index.ts","types":"./mini/index.d.cts","import":"./mini/index.js","require":"./mini/index.cjs"},"./locales":{"@zod/source":"./src/locales/index.ts","types":"./locales/index.d.cts","import":"./locales/index.js","require":"./locales/index.cjs"},"./v3":{"@zod/source":"./src/v3/index.ts","types":"./v3/index.d.cts","import":"./v3/index.js","require":"./v3/index.cjs"},"./v4":{"@zod/source":"./src/v4/index.ts","types":"./v4/index.d.cts","import":"./v4/index.js","require":"./v4/index.cjs"},"./v4-mini":{"@zod/source":"./src/v4-mini/index.ts","types":"./v4-mini/index.d.cts","import":"./v4-mini/index.js","require":"./v4-mini/index.cjs"},"./v4/mini":{"@zod/source":"./src/v4/mini/index.ts","types":"./v4/mini/index.d.cts","import":"./v4/mini/index.js","require":"./v4/mini/index.cjs"},"./v4/core":{"@zod/source":"./src/v4/core/index.ts","types":"./v4/core/index.d.cts","import":"./v4/core/index.js","require":"./v4/core/index.cjs"},"./v4/locales":{"@zod/source":"./src/v4/locales/index.ts","types":"./v4/locales/index.d.cts","import":"./v4/locales/index.js","require":"./v4/locales/index.cjs"},"./v4/locales/*":{"@zod/source":"./src/v4/locales/*","types":"./v4/locales/*","import":"./v4/locales/*","require":"./v4/locales/*"}},"repository":{"type":"git","url":"git+https://github.com/colinhacks/zod.git"},"bugs":{"url":"https://github.com/colinhacks/zod/issues"},"support":{"backing":{"npm-funding":true}},"scripts":{"clean":"git clean -xdf . -e node_modules","build":"zshy --project tsconfig.build.json","postbuild":"tsx ../../scripts/write-stub-package-jsons.ts && pnpm biome check --write .","test:watch":"pnpm vitest","test":"pnpm vitest run","prepublishOnly":"tsx ../../scripts/check-versions.ts"},"_lastModified":"2026-04-
|
|
1
|
+
{"name":"zod","version":"4.3.5","type":"module","license":"MIT","author":"Colin McDonnell <zod@colinhacks.com>","description":"TypeScript-first schema declaration and validation library with static type inference","homepage":"https://zod.dev","llms":"https://zod.dev/llms.txt","llmsFull":"https://zod.dev/llms-full.txt","mcpServer":"https://mcp.inkeep.com/zod/mcp","funding":"https://github.com/sponsors/colinhacks","sideEffects":false,"files":["src","**/*.js","**/*.mjs","**/*.cjs","**/*.d.ts","**/*.d.mts","**/*.d.cts","**/package.json"],"keywords":["typescript","schema","validation","type","inference"],"main":"./index.cjs","types":"./index.d.cts","module":"./index.js","zshy":{"exports":{"./package.json":"./package.json",".":"./src/index.ts","./mini":"./src/mini/index.ts","./locales":"./src/locales/index.ts","./v3":"./src/v3/index.ts","./v4":"./src/v4/index.ts","./v4-mini":"./src/v4-mini/index.ts","./v4/mini":"./src/v4/mini/index.ts","./v4/core":"./src/v4/core/index.ts","./v4/locales":"./src/v4/locales/index.ts","./v4/locales/*":"./src/v4/locales/*"},"conditions":{"@zod/source":"src"}},"exports":{"./package.json":"./package.json",".":{"@zod/source":"./src/index.ts","types":"./index.d.cts","import":"./index.js","require":"./index.cjs"},"./mini":{"@zod/source":"./src/mini/index.ts","types":"./mini/index.d.cts","import":"./mini/index.js","require":"./mini/index.cjs"},"./locales":{"@zod/source":"./src/locales/index.ts","types":"./locales/index.d.cts","import":"./locales/index.js","require":"./locales/index.cjs"},"./v3":{"@zod/source":"./src/v3/index.ts","types":"./v3/index.d.cts","import":"./v3/index.js","require":"./v3/index.cjs"},"./v4":{"@zod/source":"./src/v4/index.ts","types":"./v4/index.d.cts","import":"./v4/index.js","require":"./v4/index.cjs"},"./v4-mini":{"@zod/source":"./src/v4-mini/index.ts","types":"./v4-mini/index.d.cts","import":"./v4-mini/index.js","require":"./v4-mini/index.cjs"},"./v4/mini":{"@zod/source":"./src/v4/mini/index.ts","types":"./v4/mini/index.d.cts","import":"./v4/mini/index.js","require":"./v4/mini/index.cjs"},"./v4/core":{"@zod/source":"./src/v4/core/index.ts","types":"./v4/core/index.d.cts","import":"./v4/core/index.js","require":"./v4/core/index.cjs"},"./v4/locales":{"@zod/source":"./src/v4/locales/index.ts","types":"./v4/locales/index.d.cts","import":"./v4/locales/index.js","require":"./v4/locales/index.cjs"},"./v4/locales/*":{"@zod/source":"./src/v4/locales/*","types":"./v4/locales/*","import":"./v4/locales/*","require":"./v4/locales/*"}},"repository":{"type":"git","url":"git+https://github.com/colinhacks/zod.git"},"bugs":{"url":"https://github.com/colinhacks/zod/issues"},"support":{"backing":{"npm-funding":true}},"scripts":{"clean":"git clean -xdf . -e node_modules","build":"zshy --project tsconfig.build.json","postbuild":"tsx ../../scripts/write-stub-package-jsons.ts && pnpm biome check --write .","test:watch":"pnpm vitest","test":"pnpm vitest run","prepublishOnly":"tsx ../../scripts/check-versions.ts"},"_lastModified":"2026-04-24T10:36:07.729Z"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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 type { McpToolsManager } from '@nocobase/ai';
|
|
10
|
+
export declare function simplifyDataSourceListResult(result: any): {
|
|
11
|
+
data: any;
|
|
12
|
+
meta: any;
|
|
13
|
+
};
|
|
14
|
+
export declare function simplifyDataSourceCollectionsListResult(result: any): {
|
|
15
|
+
data: any;
|
|
16
|
+
meta: any;
|
|
17
|
+
};
|
|
18
|
+
export declare function simplifyDataSourceFieldsListResult(result: any, options?: {
|
|
19
|
+
args?: Record<string, any>;
|
|
20
|
+
}): {
|
|
21
|
+
data: any;
|
|
22
|
+
meta: any;
|
|
23
|
+
};
|
|
24
|
+
export declare function registerDataSourceManagerMcpPostProcessors(manager: McpToolsManager): void;
|
|
@@ -0,0 +1,158 @@
|
|
|
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 __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var mcp_post_processors_exports = {};
|
|
28
|
+
__export(mcp_post_processors_exports, {
|
|
29
|
+
registerDataSourceManagerMcpPostProcessors: () => registerDataSourceManagerMcpPostProcessors,
|
|
30
|
+
simplifyDataSourceCollectionsListResult: () => simplifyDataSourceCollectionsListResult,
|
|
31
|
+
simplifyDataSourceFieldsListResult: () => simplifyDataSourceFieldsListResult,
|
|
32
|
+
simplifyDataSourceListResult: () => simplifyDataSourceListResult
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(mcp_post_processors_exports);
|
|
35
|
+
function toArray(value) {
|
|
36
|
+
if (Array.isArray(value)) {
|
|
37
|
+
return value;
|
|
38
|
+
}
|
|
39
|
+
if (Array.isArray(value == null ? void 0 : value.data)) {
|
|
40
|
+
return value.data;
|
|
41
|
+
}
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
function parseAssociatedIndex(value) {
|
|
45
|
+
if (typeof value !== "string") {
|
|
46
|
+
return {};
|
|
47
|
+
}
|
|
48
|
+
const separatorIndex = value.indexOf(".");
|
|
49
|
+
if (separatorIndex === -1) {
|
|
50
|
+
return {};
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
dataSourceKey: value.slice(0, separatorIndex),
|
|
54
|
+
collectionName: value.slice(separatorIndex + 1)
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function pickDataSourceSummary(item) {
|
|
58
|
+
const summary = {
|
|
59
|
+
displayName: item == null ? void 0 : item.displayName,
|
|
60
|
+
key: item == null ? void 0 : item.key,
|
|
61
|
+
type: item == null ? void 0 : item.type,
|
|
62
|
+
status: item == null ? void 0 : item.status
|
|
63
|
+
};
|
|
64
|
+
if (Array.isArray(item == null ? void 0 : item.collections)) {
|
|
65
|
+
summary.collections = item.collections.map((collection) => {
|
|
66
|
+
const nextCollection = pickCollectionSummary({
|
|
67
|
+
...collection,
|
|
68
|
+
dataSourceKey: (collection == null ? void 0 : collection.dataSourceKey) ?? (item == null ? void 0 : item.key)
|
|
69
|
+
});
|
|
70
|
+
if (Array.isArray(collection == null ? void 0 : collection.fields)) {
|
|
71
|
+
nextCollection.fields = collection.fields.map(
|
|
72
|
+
(field) => pickRemoteFieldSummary(field, {
|
|
73
|
+
dataSourceKey: (collection == null ? void 0 : collection.dataSourceKey) ?? (item == null ? void 0 : item.key),
|
|
74
|
+
collectionName: collection == null ? void 0 : collection.name
|
|
75
|
+
})
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
return nextCollection;
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return summary;
|
|
82
|
+
}
|
|
83
|
+
function pickCollectionSummary(item) {
|
|
84
|
+
var _a, _b;
|
|
85
|
+
return {
|
|
86
|
+
name: item == null ? void 0 : item.name,
|
|
87
|
+
title: (item == null ? void 0 : item.title) ?? ((_a = item == null ? void 0 : item.options) == null ? void 0 : _a.title) ?? (item == null ? void 0 : item.displayName),
|
|
88
|
+
description: (item == null ? void 0 : item.description) ?? ((_b = item == null ? void 0 : item.options) == null ? void 0 : _b.description),
|
|
89
|
+
dataSourceKey: item == null ? void 0 : item.dataSourceKey
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function pickFieldSummary(item) {
|
|
93
|
+
var _a;
|
|
94
|
+
return {
|
|
95
|
+
name: item == null ? void 0 : item.name,
|
|
96
|
+
type: item == null ? void 0 : item.type,
|
|
97
|
+
title: (_a = item == null ? void 0 : item.uiSchema) == null ? void 0 : _a.title,
|
|
98
|
+
description: item == null ? void 0 : item.description,
|
|
99
|
+
dataSourceKey: item == null ? void 0 : item.dataSourceKey,
|
|
100
|
+
collectionName: item == null ? void 0 : item.collectionName
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function pickRemoteFieldSummary(item, defaults) {
|
|
104
|
+
var _a;
|
|
105
|
+
return {
|
|
106
|
+
name: item == null ? void 0 : item.name,
|
|
107
|
+
type: item == null ? void 0 : item.type,
|
|
108
|
+
title: (_a = item == null ? void 0 : item.uiSchema) == null ? void 0 : _a.title,
|
|
109
|
+
description: item == null ? void 0 : item.description,
|
|
110
|
+
dataSourceKey: item == null ? void 0 : item.dataSourceKey,
|
|
111
|
+
collectionName: item == null ? void 0 : item.collectionName,
|
|
112
|
+
...defaults
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function simplifyDataSourceListResult(result) {
|
|
116
|
+
const items = toArray(result);
|
|
117
|
+
return {
|
|
118
|
+
data: items.map((item) => pickDataSourceSummary(item)),
|
|
119
|
+
meta: result == null ? void 0 : result.meta
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function simplifyDataSourceCollectionsListResult(result) {
|
|
123
|
+
const items = toArray(result);
|
|
124
|
+
return {
|
|
125
|
+
data: items.map((item) => pickCollectionSummary(item)),
|
|
126
|
+
meta: result == null ? void 0 : result.meta
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
function simplifyDataSourceFieldsListResult(result, options) {
|
|
130
|
+
var _a;
|
|
131
|
+
const items = toArray(result);
|
|
132
|
+
const defaults = parseAssociatedIndex((_a = options == null ? void 0 : options.args) == null ? void 0 : _a.associatedIndex);
|
|
133
|
+
return {
|
|
134
|
+
data: items.map(
|
|
135
|
+
(item) => (item == null ? void 0 : item.dataSourceKey) || (item == null ? void 0 : item.collectionName) ? pickFieldSummary(item) : pickRemoteFieldSummary(item, defaults)
|
|
136
|
+
),
|
|
137
|
+
meta: result == null ? void 0 : result.meta
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
function registerDataSourceManagerMcpPostProcessors(manager) {
|
|
141
|
+
manager.registerToolResultPostProcessor("dataSources", "list", simplifyDataSourceListResult);
|
|
142
|
+
manager.registerToolResultPostProcessor("dataSources", "listEnabled", simplifyDataSourceListResult);
|
|
143
|
+
manager.registerToolResultPostProcessor("dataSources.collections", "list", simplifyDataSourceCollectionsListResult);
|
|
144
|
+
manager.registerToolResultPostProcessor(
|
|
145
|
+
"dataSourcesCollections.fields",
|
|
146
|
+
"list",
|
|
147
|
+
(result, context) => simplifyDataSourceFieldsListResult(result, {
|
|
148
|
+
args: context == null ? void 0 : context.args
|
|
149
|
+
})
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
153
|
+
0 && (module.exports = {
|
|
154
|
+
registerDataSourceManagerMcpPostProcessors,
|
|
155
|
+
simplifyDataSourceCollectionsListResult,
|
|
156
|
+
simplifyDataSourceFieldsListResult,
|
|
157
|
+
simplifyDataSourceListResult
|
|
158
|
+
});
|
|
@@ -7,11 +7,9 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
var __create = Object.create;
|
|
11
10
|
var __defProp = Object.defineProperty;
|
|
12
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
15
13
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
14
|
var __export = (target, all) => {
|
|
17
15
|
for (var name in all)
|
|
@@ -25,14 +23,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
25
23
|
}
|
|
26
24
|
return to;
|
|
27
25
|
};
|
|
28
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
-
mod
|
|
35
|
-
));
|
|
36
26
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
27
|
var data_source_exports = {};
|
|
38
28
|
__export(data_source_exports, {
|
|
@@ -41,7 +31,7 @@ __export(data_source_exports, {
|
|
|
41
31
|
module.exports = __toCommonJS(data_source_exports);
|
|
42
32
|
var import_database = require("@nocobase/database");
|
|
43
33
|
var import_plugin_acl = require("@nocobase/plugin-acl");
|
|
44
|
-
var
|
|
34
|
+
var import_utils = require("@nocobase/utils");
|
|
45
35
|
const availableActions = {
|
|
46
36
|
create: {
|
|
47
37
|
displayName: '{{t("Add new")}}',
|
|
@@ -62,7 +52,7 @@ const availableActions = {
|
|
|
62
52
|
view: {
|
|
63
53
|
displayName: '{{t("View")}}',
|
|
64
54
|
type: "old-data",
|
|
65
|
-
aliases: ["get", "list"],
|
|
55
|
+
aliases: ["get", "list", "query"],
|
|
66
56
|
allowConfigureFields: true
|
|
67
57
|
},
|
|
68
58
|
update: {
|
|
@@ -117,7 +107,7 @@ class DataSourceModel extends import_database.Model {
|
|
|
117
107
|
logger: app.logger.child({ dataSourceKey }),
|
|
118
108
|
sqlLogger: app.sqlLogger.child({ dataSourceKey }),
|
|
119
109
|
cache: app.cache,
|
|
120
|
-
storagePath:
|
|
110
|
+
storagePath: (0, import_utils.storagePathJoin)("cache", "apps", app.name),
|
|
121
111
|
databaseInstance
|
|
122
112
|
});
|
|
123
113
|
dataSource.on("loadingProgress", (progress) => {
|
package/dist/server/plugin.js
CHANGED
|
@@ -57,6 +57,7 @@ var import_data_source = require("./models/data-source");
|
|
|
57
57
|
var import_data_sources_roles_model = require("./models/data-sources-roles-model");
|
|
58
58
|
var import_acl = require("@nocobase/acl");
|
|
59
59
|
var import_load_tables = require("./middlewares/load-tables");
|
|
60
|
+
var import_mcp_post_processors = require("./mcp-post-processors");
|
|
60
61
|
class PluginDataSourceManagerServer extends import_server.Plugin {
|
|
61
62
|
dataSourceErrors = {};
|
|
62
63
|
dataSourceStatus = {};
|
|
@@ -313,6 +314,7 @@ class PluginDataSourceManagerServer extends import_server.Plugin {
|
|
|
313
314
|
await next();
|
|
314
315
|
});
|
|
315
316
|
this.app.resourceManager.use(import_load_tables.loadDataSourceTablesIntoCollections);
|
|
317
|
+
(0, import_mcp_post_processors.registerDataSourceManagerMcpPostProcessors)(this.ai.mcpToolsManager);
|
|
316
318
|
this.app.use(async function handleAppendDataSourceCollection(ctx, next) {
|
|
317
319
|
await next();
|
|
318
320
|
if (!ctx.action) {
|
|
@@ -0,0 +1,122 @@
|
|
|
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
|
+
declare const _default: {
|
|
10
|
+
openapi: string;
|
|
11
|
+
info: {
|
|
12
|
+
title: string;
|
|
13
|
+
};
|
|
14
|
+
paths: {
|
|
15
|
+
'/dataSources:listEnabled': {
|
|
16
|
+
get: {
|
|
17
|
+
tags: string[];
|
|
18
|
+
summary: string;
|
|
19
|
+
description: string;
|
|
20
|
+
parameters: {
|
|
21
|
+
name: string;
|
|
22
|
+
in: string;
|
|
23
|
+
description: string;
|
|
24
|
+
required: boolean;
|
|
25
|
+
schema: {
|
|
26
|
+
type: string;
|
|
27
|
+
};
|
|
28
|
+
}[];
|
|
29
|
+
responses: {
|
|
30
|
+
200: {
|
|
31
|
+
description: string;
|
|
32
|
+
content: {
|
|
33
|
+
'application/json': {
|
|
34
|
+
schema: {
|
|
35
|
+
type: string;
|
|
36
|
+
properties: {
|
|
37
|
+
data: {
|
|
38
|
+
type: string;
|
|
39
|
+
items: {
|
|
40
|
+
$ref: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
meta: {
|
|
44
|
+
type: string;
|
|
45
|
+
additionalProperties: boolean;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
components: {
|
|
57
|
+
schemas: {
|
|
58
|
+
DataSourceInfo: {
|
|
59
|
+
type: string;
|
|
60
|
+
properties: {
|
|
61
|
+
key: {
|
|
62
|
+
type: string;
|
|
63
|
+
};
|
|
64
|
+
displayName: {
|
|
65
|
+
type: string;
|
|
66
|
+
};
|
|
67
|
+
status: {
|
|
68
|
+
type: string;
|
|
69
|
+
};
|
|
70
|
+
type: {
|
|
71
|
+
type: string;
|
|
72
|
+
};
|
|
73
|
+
isDBInstance: {
|
|
74
|
+
type: string;
|
|
75
|
+
};
|
|
76
|
+
options: {
|
|
77
|
+
type: string;
|
|
78
|
+
additionalProperties: boolean;
|
|
79
|
+
};
|
|
80
|
+
errorMessage: {
|
|
81
|
+
type: string;
|
|
82
|
+
};
|
|
83
|
+
collections: {
|
|
84
|
+
type: string;
|
|
85
|
+
items: {
|
|
86
|
+
$ref: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
additionalProperties: boolean;
|
|
91
|
+
};
|
|
92
|
+
DataSourceCollectionInfo: {
|
|
93
|
+
type: string;
|
|
94
|
+
properties: {
|
|
95
|
+
name: {
|
|
96
|
+
type: string;
|
|
97
|
+
};
|
|
98
|
+
title: {
|
|
99
|
+
type: string;
|
|
100
|
+
};
|
|
101
|
+
fields: {
|
|
102
|
+
type: string;
|
|
103
|
+
items: {
|
|
104
|
+
type: string;
|
|
105
|
+
additionalProperties: boolean;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
availableActions: {
|
|
109
|
+
type: string;
|
|
110
|
+
additionalProperties: boolean;
|
|
111
|
+
};
|
|
112
|
+
unavailableActions: {
|
|
113
|
+
type: string;
|
|
114
|
+
additionalProperties: boolean;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
additionalProperties: boolean;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
export default _default;
|
|
@@ -0,0 +1,146 @@
|
|
|
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 __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var swagger_exports = {};
|
|
28
|
+
__export(swagger_exports, {
|
|
29
|
+
default: () => swagger_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(swagger_exports);
|
|
32
|
+
var swagger_default = {
|
|
33
|
+
openapi: "3.0.2",
|
|
34
|
+
info: {
|
|
35
|
+
title: "NocoBase API - Data source manager plugin"
|
|
36
|
+
},
|
|
37
|
+
paths: {
|
|
38
|
+
"/dataSources:listEnabled": {
|
|
39
|
+
get: {
|
|
40
|
+
tags: ["dataSources"],
|
|
41
|
+
summary: "List enabled external data sources",
|
|
42
|
+
description: "Return enabled non-main data sources, optionally including loaded collections.",
|
|
43
|
+
parameters: [
|
|
44
|
+
{
|
|
45
|
+
name: "appends",
|
|
46
|
+
in: "query",
|
|
47
|
+
description: "Append related data, for example `collections`.",
|
|
48
|
+
required: false,
|
|
49
|
+
schema: {
|
|
50
|
+
type: "string"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
responses: {
|
|
55
|
+
200: {
|
|
56
|
+
description: "OK",
|
|
57
|
+
content: {
|
|
58
|
+
"application/json": {
|
|
59
|
+
schema: {
|
|
60
|
+
type: "object",
|
|
61
|
+
properties: {
|
|
62
|
+
data: {
|
|
63
|
+
type: "array",
|
|
64
|
+
items: {
|
|
65
|
+
$ref: "#/components/schemas/DataSourceInfo"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
meta: {
|
|
69
|
+
type: "object",
|
|
70
|
+
additionalProperties: true
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
components: {
|
|
82
|
+
schemas: {
|
|
83
|
+
DataSourceInfo: {
|
|
84
|
+
type: "object",
|
|
85
|
+
properties: {
|
|
86
|
+
key: {
|
|
87
|
+
type: "string"
|
|
88
|
+
},
|
|
89
|
+
displayName: {
|
|
90
|
+
type: "string"
|
|
91
|
+
},
|
|
92
|
+
status: {
|
|
93
|
+
type: "string"
|
|
94
|
+
},
|
|
95
|
+
type: {
|
|
96
|
+
type: "string"
|
|
97
|
+
},
|
|
98
|
+
isDBInstance: {
|
|
99
|
+
type: "boolean"
|
|
100
|
+
},
|
|
101
|
+
options: {
|
|
102
|
+
type: "object",
|
|
103
|
+
additionalProperties: true
|
|
104
|
+
},
|
|
105
|
+
errorMessage: {
|
|
106
|
+
type: "string"
|
|
107
|
+
},
|
|
108
|
+
collections: {
|
|
109
|
+
type: "array",
|
|
110
|
+
items: {
|
|
111
|
+
$ref: "#/components/schemas/DataSourceCollectionInfo"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
additionalProperties: true
|
|
116
|
+
},
|
|
117
|
+
DataSourceCollectionInfo: {
|
|
118
|
+
type: "object",
|
|
119
|
+
properties: {
|
|
120
|
+
name: {
|
|
121
|
+
type: "string"
|
|
122
|
+
},
|
|
123
|
+
title: {
|
|
124
|
+
type: "string"
|
|
125
|
+
},
|
|
126
|
+
fields: {
|
|
127
|
+
type: "array",
|
|
128
|
+
items: {
|
|
129
|
+
type: "object",
|
|
130
|
+
additionalProperties: true
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
availableActions: {
|
|
134
|
+
type: "object",
|
|
135
|
+
additionalProperties: true
|
|
136
|
+
},
|
|
137
|
+
unavailableActions: {
|
|
138
|
+
type: "object",
|
|
139
|
+
additionalProperties: true
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
additionalProperties: true
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-data-source-manager",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.16",
|
|
4
4
|
"main": "dist/server/index.js",
|
|
5
5
|
"displayName": "Data source manager",
|
|
6
6
|
"displayName.ru-RU": "Менеджер управления источниками данных",
|
|
@@ -20,6 +20,6 @@
|
|
|
20
20
|
"keywords": [
|
|
21
21
|
"Data model tools"
|
|
22
22
|
],
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "b9a191705a440a336c85d82fd877fdf152bec70f",
|
|
24
24
|
"license": "Apache-2.0"
|
|
25
25
|
}
|