@nocobase/plugin-data-source-manager 2.1.0-alpha.13 → 2.1.0-alpha.15
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/skills/data-query/SKILLS.md +77 -70
- package/dist/ai/skills/data-query/tools/dataQuery.d.ts +10 -0
- package/dist/ai/skills/data-query/tools/dataQuery.js +272 -0
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +11 -11
- package/dist/locale/en-US.json +3 -1
- package/dist/locale/zh-CN.json +3 -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 +1 -1
- package/dist/server/plugin.js +2 -0
- package/package.json +2 -2
|
@@ -1,85 +1,95 @@
|
|
|
1
1
|
---
|
|
2
2
|
scope: GENERAL
|
|
3
3
|
name: data-query
|
|
4
|
-
description:
|
|
4
|
+
description: Inspect schemas, retrieve records, and run aggregate queries on specified datasources
|
|
5
|
+
tools:
|
|
6
|
+
- getDataSources
|
|
7
|
+
- getCollectionNames
|
|
8
|
+
- getCollectionMetadata
|
|
9
|
+
- searchFieldMetadata
|
|
5
10
|
introduction:
|
|
6
11
|
title: '{{t("ai.skills.dataQuery.title", { ns: "@nocobase/plugin-data-source-manager" })}}'
|
|
7
12
|
about: '{{t("ai.skills.dataQuery.about", { ns: "@nocobase/plugin-data-source-manager" })}}'
|
|
8
13
|
---
|
|
9
14
|
You are a professional data query assistant for NocoBase.
|
|
10
15
|
|
|
11
|
-
You help users
|
|
16
|
+
You help users inspect schemas, retrieve records, and run aggregate queries on NocoBase collections.
|
|
12
17
|
|
|
13
18
|
# Primary Workflows
|
|
14
19
|
|
|
15
|
-
This skill focuses on
|
|
20
|
+
This skill focuses on safe read-only data access.
|
|
16
21
|
|
|
17
|
-
##
|
|
22
|
+
## Schema-first Querying
|
|
18
23
|
|
|
19
|
-
When
|
|
24
|
+
When the user does not provide an exact collection or field name:
|
|
20
25
|
|
|
21
|
-
1.
|
|
22
|
-
|
|
23
|
-
|
|
26
|
+
1. Call `getDataSources` if the target data source is unclear.
|
|
27
|
+
2. Call `getCollectionNames` to find the right collection.
|
|
28
|
+
3. Call `getCollectionMetadata` or `searchFieldMetadata` to confirm field names, relation paths, and data types.
|
|
29
|
+
4. Only then run a data tool.
|
|
24
30
|
|
|
25
|
-
|
|
26
|
-
- Identify which fields to return in the results
|
|
31
|
+
Do not guess collection names, measure aliases, or dotted relation paths.
|
|
27
32
|
|
|
28
|
-
|
|
29
|
-
- Call `dataSourceQuery` with appropriate parameters
|
|
30
|
-
- Default limit is 50, maximum is 1000
|
|
33
|
+
## Raw Record Query
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
- Format the returned data clearly
|
|
34
|
-
- Show pagination info if there are more records
|
|
35
|
+
Use `dataSourceQuery` when the user wants actual records rather than grouped statistics.
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
Typical cases:
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
- list rows
|
|
40
|
+
- inspect recent records
|
|
41
|
+
- fetch selected fields
|
|
42
|
+
- browse data with filter, sort, and pagination
|
|
39
43
|
|
|
40
|
-
|
|
41
|
-
- Determine which collection to count from
|
|
42
|
-
- Apply any filter conditions if specified
|
|
44
|
+
## Aggregate Query
|
|
43
45
|
|
|
44
|
-
|
|
45
|
-
- Call `dataSourceCounting` to get total count
|
|
46
|
+
Use `dataQuery` when the user wants:
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
- counts, sums, averages, min, max
|
|
49
|
+
- grouped statistics
|
|
50
|
+
- rankings
|
|
51
|
+
- trend buckets
|
|
52
|
+
- post-aggregation filtering with `having`
|
|
49
53
|
|
|
50
|
-
|
|
54
|
+
Prefer `dataQuery` over `dataSourceCounting` whenever the request can be expressed as a measure query, because it is closer to the repository `query` capability used by charts, actions, ACL, and MCP.
|
|
51
55
|
|
|
52
|
-
|
|
56
|
+
## Count Records
|
|
53
57
|
|
|
54
|
-
|
|
55
|
-
- Use the filter parameter to define query conditions
|
|
56
|
-
- Support operators: `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`, `$like`, `$in`, `$nin`, `$exists`, etc.
|
|
57
|
-
- Use `$and` and `$or` for complex conditions
|
|
58
|
+
Use `dataSourceCounting` only for a simple total when grouped output is unnecessary.
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
- Use the `sort` parameter to order results
|
|
61
|
-
- Format: `["field1", "-field2"]` (minus for descending)
|
|
60
|
+
## Query Construction Rules
|
|
62
61
|
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
1. `filter` is applied before aggregation.
|
|
63
|
+
2. `having` is applied after aggregation and should reference selected aliases or selected field paths.
|
|
64
|
+
3. For grouped results, put grouping fields in `dimensions`.
|
|
65
|
+
4. For metrics, put aggregate definitions in `measures`.
|
|
66
|
+
5. Use aliases when the user clearly needs stable output keys.
|
|
67
|
+
6. For dotted relation fields, prefer the exact field path confirmed from metadata, such as `createdBy.nickname`.
|
|
68
|
+
7. Default row limit is 50 and the tool caps the limit at 100.
|
|
65
69
|
|
|
66
70
|
# Available Tools
|
|
67
71
|
|
|
72
|
+
- `getDataSources`: Lists all available data sources.
|
|
73
|
+
- `getCollectionNames`: Lists all collections in a data source.
|
|
74
|
+
- `getCollectionMetadata`: Returns field metadata for collections.
|
|
75
|
+
- `searchFieldMetadata`: Searches fields by keyword.
|
|
68
76
|
- `dataSourceQuery`: Query data from a specified collection in a data source. Supports filtering, sorting, field selection, and pagination. Returns paged results with total count.
|
|
77
|
+
- `dataQuery`: Run aggregate repository queries with measures, dimensions, orders, filter, and having.
|
|
69
78
|
- `dataSourceCounting`: Get the total count of records matching the specified filter conditions in a collection.
|
|
70
79
|
|
|
71
|
-
# Query Parameters
|
|
80
|
+
# Aggregate Query Parameters
|
|
72
81
|
|
|
73
82
|
| Parameter | Type | Description |
|
|
74
83
|
| ---------------- | -------- | ------------------------------------------------------------ |
|
|
75
|
-
| `
|
|
84
|
+
| `dataSource` | string | The data source key (default: `main`) |
|
|
76
85
|
| `collectionName` | string | The collection name to query |
|
|
77
|
-
| `
|
|
78
|
-
| `
|
|
79
|
-
| `
|
|
80
|
-
| `
|
|
81
|
-
| `
|
|
82
|
-
| `
|
|
86
|
+
| `measures` | array | Aggregate definitions, such as count / sum / avg |
|
|
87
|
+
| `dimensions` | array | Group-by field definitions |
|
|
88
|
+
| `orders` | array | Result ordering definitions |
|
|
89
|
+
| `filter` | object | Query conditions applied before aggregation |
|
|
90
|
+
| `having` | object | Query conditions applied after aggregation |
|
|
91
|
+
| `offset` | number | Number of rows to skip |
|
|
92
|
+
| `limit` | number | Maximum number of rows to return (default: 50, max: 100) |
|
|
83
93
|
|
|
84
94
|
# Filter Operators
|
|
85
95
|
|
|
@@ -141,28 +151,28 @@ User: "Show me all users"
|
|
|
141
151
|
Action: Call dataSourceQuery with collectionName="users"
|
|
142
152
|
```
|
|
143
153
|
|
|
144
|
-
##
|
|
154
|
+
## Aggregate Count
|
|
145
155
|
```
|
|
146
|
-
User: "
|
|
147
|
-
Action: Call
|
|
156
|
+
User: "How many active users are there?"
|
|
157
|
+
Action: Call dataQuery with collectionName="users", measures=[{ field: "id", aggregation: "count", alias: "count" }], filter={ status: { $eq: "active" } }
|
|
148
158
|
```
|
|
149
159
|
|
|
150
|
-
##
|
|
160
|
+
## Grouped Statistics
|
|
151
161
|
```
|
|
152
|
-
User: "
|
|
153
|
-
Action: Call
|
|
162
|
+
User: "Count orders by status"
|
|
163
|
+
Action: Call dataQuery with collectionName="orders", dimensions=[{ field: "status", alias: "status" }], measures=[{ field: "id", aggregation: "count", alias: "count" }]
|
|
154
164
|
```
|
|
155
165
|
|
|
156
|
-
##
|
|
166
|
+
## Having Query
|
|
157
167
|
```
|
|
158
|
-
User: "Show
|
|
159
|
-
Action: Call
|
|
168
|
+
User: "Show statuses with more than 10 orders"
|
|
169
|
+
Action: Call dataQuery with collectionName="orders", dimensions=[{ field: "status", alias: "status" }], measures=[{ field: "id", aggregation: "count", alias: "count" }], having={ count: { $gt: 10 } }
|
|
160
170
|
```
|
|
161
171
|
|
|
162
|
-
##
|
|
172
|
+
## Raw Record Query
|
|
163
173
|
```
|
|
164
|
-
User: "Show me
|
|
165
|
-
Action: Call dataSourceQuery with collectionName="
|
|
174
|
+
User: "Show me 20 latest paid orders"
|
|
175
|
+
Action: Call dataSourceQuery with collectionName="orders", filter={ status: { $eq: "paid" } }, sort=["-createdAt"], limit=20
|
|
166
176
|
```
|
|
167
177
|
|
|
168
178
|
## Count Records
|
|
@@ -171,22 +181,19 @@ User: "How many active users are there?"
|
|
|
171
181
|
Action: Call dataSourceCounting with collectionName="users", filter={ status: { $eq: 'active' } }
|
|
172
182
|
```
|
|
173
183
|
|
|
174
|
-
##
|
|
184
|
+
## Metadata First
|
|
175
185
|
```
|
|
176
|
-
User: "Show
|
|
177
|
-
Action:
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
]
|
|
182
|
-
}
|
|
186
|
+
User: "Show monthly revenue by salesperson"
|
|
187
|
+
Action:
|
|
188
|
+
1. Call getCollectionNames / searchFieldMetadata to locate the correct collection and amount field.
|
|
189
|
+
2. Call getCollectionMetadata if date or relation paths are unclear.
|
|
190
|
+
3. Call dataQuery with the confirmed fields.
|
|
183
191
|
```
|
|
184
192
|
|
|
185
193
|
# Notes
|
|
186
194
|
|
|
187
|
-
- Always validate
|
|
188
|
-
-
|
|
189
|
-
-
|
|
190
|
-
-
|
|
191
|
-
-
|
|
192
|
-
- Format results in a clear, readable manner
|
|
195
|
+
- Always validate collection and field names before querying.
|
|
196
|
+
- Prefer metadata tools first when the request is ambiguous.
|
|
197
|
+
- Prefer `dataQuery` for analysis and metrics.
|
|
198
|
+
- Use `dataSourceQuery` for raw rows and `dataSourceCounting` for the simplest count case.
|
|
199
|
+
- Respect user permissions; if the tool returns `No permissions`, explain that the current role cannot access the requested data.
|
|
@@ -0,0 +1,10 @@
|
|
|
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: import("@nocobase/ai").ToolsOptions;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,272 @@
|
|
|
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 __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
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
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
+
var dataQuery_exports = {};
|
|
38
|
+
__export(dataQuery_exports, {
|
|
39
|
+
default: () => dataQuery_default
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(dataQuery_exports);
|
|
42
|
+
var import_acl = require("@nocobase/acl");
|
|
43
|
+
var import_ai = require("@nocobase/ai");
|
|
44
|
+
var import_plugin_acl = require("@nocobase/plugin-acl");
|
|
45
|
+
var import_utils = require("../../../common/utils");
|
|
46
|
+
var import_package = __toESM(require("../../../../../package.json"));
|
|
47
|
+
const queryFieldSchema = {
|
|
48
|
+
anyOf: [
|
|
49
|
+
{ type: "string" },
|
|
50
|
+
{
|
|
51
|
+
type: "array",
|
|
52
|
+
items: { type: "string" },
|
|
53
|
+
minItems: 1
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
};
|
|
57
|
+
const queryMeasureSchema = {
|
|
58
|
+
type: "object",
|
|
59
|
+
additionalProperties: true,
|
|
60
|
+
required: ["field"],
|
|
61
|
+
properties: {
|
|
62
|
+
field: queryFieldSchema,
|
|
63
|
+
type: {
|
|
64
|
+
type: "string",
|
|
65
|
+
description: "Optional field type hint."
|
|
66
|
+
},
|
|
67
|
+
aggregation: {
|
|
68
|
+
type: "string",
|
|
69
|
+
description: "Aggregation function, such as count, sum, avg, max, or min."
|
|
70
|
+
},
|
|
71
|
+
alias: {
|
|
72
|
+
type: "string",
|
|
73
|
+
description: "Output field alias."
|
|
74
|
+
},
|
|
75
|
+
distinct: {
|
|
76
|
+
type: "boolean",
|
|
77
|
+
description: "Whether to apply distinct before aggregation."
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const queryDimensionSchema = {
|
|
82
|
+
type: "object",
|
|
83
|
+
additionalProperties: true,
|
|
84
|
+
required: ["field"],
|
|
85
|
+
properties: {
|
|
86
|
+
field: queryFieldSchema,
|
|
87
|
+
type: {
|
|
88
|
+
type: "string",
|
|
89
|
+
description: "Optional field type hint."
|
|
90
|
+
},
|
|
91
|
+
alias: {
|
|
92
|
+
type: "string",
|
|
93
|
+
description: "Output field alias."
|
|
94
|
+
},
|
|
95
|
+
format: {
|
|
96
|
+
type: "string",
|
|
97
|
+
description: "Optional output format, usually for date and time dimensions."
|
|
98
|
+
},
|
|
99
|
+
options: {
|
|
100
|
+
type: "object",
|
|
101
|
+
description: "Additional formatter options.",
|
|
102
|
+
additionalProperties: true
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
const queryOrderSchema = {
|
|
107
|
+
type: "object",
|
|
108
|
+
additionalProperties: true,
|
|
109
|
+
required: ["field"],
|
|
110
|
+
properties: {
|
|
111
|
+
field: queryFieldSchema,
|
|
112
|
+
alias: {
|
|
113
|
+
type: "string",
|
|
114
|
+
description: "Alias to sort by when the selected field is projected with an alias."
|
|
115
|
+
},
|
|
116
|
+
order: {
|
|
117
|
+
type: "string",
|
|
118
|
+
enum: ["asc", "desc"],
|
|
119
|
+
description: "Sort direction."
|
|
120
|
+
},
|
|
121
|
+
nulls: {
|
|
122
|
+
type: "string",
|
|
123
|
+
enum: ["default", "first", "last"],
|
|
124
|
+
description: "Null value ordering."
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const AggregateQuerySchema = {
|
|
129
|
+
type: "object",
|
|
130
|
+
additionalProperties: false,
|
|
131
|
+
required: ["collectionName"],
|
|
132
|
+
properties: {
|
|
133
|
+
dataSource: {
|
|
134
|
+
type: "string",
|
|
135
|
+
description: "Data source key. Defaults to main."
|
|
136
|
+
},
|
|
137
|
+
datasource: {
|
|
138
|
+
type: "string",
|
|
139
|
+
description: "Legacy alias of dataSource. Defaults to main."
|
|
140
|
+
},
|
|
141
|
+
collectionName: {
|
|
142
|
+
type: "string",
|
|
143
|
+
description: "Collection name to query."
|
|
144
|
+
},
|
|
145
|
+
measures: {
|
|
146
|
+
type: "array",
|
|
147
|
+
description: "Measure definitions for aggregate query.",
|
|
148
|
+
items: queryMeasureSchema
|
|
149
|
+
},
|
|
150
|
+
dimensions: {
|
|
151
|
+
type: "array",
|
|
152
|
+
description: "Dimension definitions for grouped query.",
|
|
153
|
+
items: queryDimensionSchema
|
|
154
|
+
},
|
|
155
|
+
orders: {
|
|
156
|
+
type: "array",
|
|
157
|
+
description: "Order definitions for aggregate query.",
|
|
158
|
+
items: queryOrderSchema
|
|
159
|
+
},
|
|
160
|
+
filter: {
|
|
161
|
+
type: "object",
|
|
162
|
+
description: "Filter object applied before aggregation.",
|
|
163
|
+
additionalProperties: true
|
|
164
|
+
},
|
|
165
|
+
having: {
|
|
166
|
+
type: "object",
|
|
167
|
+
description: "Having object applied after grouping.",
|
|
168
|
+
additionalProperties: true
|
|
169
|
+
},
|
|
170
|
+
offset: {
|
|
171
|
+
type: "number",
|
|
172
|
+
description: "Offset for query result rows."
|
|
173
|
+
},
|
|
174
|
+
limit: {
|
|
175
|
+
type: "number",
|
|
176
|
+
description: `Maximum number of rows to return. Defaults to 50 and is capped at ${import_utils.MAX_QUERY_LIMIT}.`
|
|
177
|
+
},
|
|
178
|
+
timezone: {
|
|
179
|
+
type: "string",
|
|
180
|
+
description: "Optional timezone override for date formatting."
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
function getDataSourceKey(args) {
|
|
185
|
+
return args.dataSource || args.datasource || "main";
|
|
186
|
+
}
|
|
187
|
+
function getTimezone(ctx, args) {
|
|
188
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
189
|
+
const value = args.timezone || ((_a = ctx.get) == null ? void 0 : _a.call(ctx, "x-timezone")) || ((_c = (_b = ctx.request) == null ? void 0 : _b.get) == null ? void 0 : _c.call(_b, "x-timezone")) || ((_e = (_d = ctx.request) == null ? void 0 : _d.header) == null ? void 0 : _e["x-timezone"]) || ((_g = (_f = ctx.req) == null ? void 0 : _f.headers) == null ? void 0 : _g["x-timezone"]);
|
|
190
|
+
return Array.isArray(value) ? value[0] : value;
|
|
191
|
+
}
|
|
192
|
+
var dataQuery_default = (0, import_ai.defineTools)({
|
|
193
|
+
scope: "SPECIFIED",
|
|
194
|
+
defaultPermission: "ALLOW",
|
|
195
|
+
introduction: {
|
|
196
|
+
title: `{{t("ai.tools.dataQueryAggregate.title", { ns: "${import_package.default.name}" })}}`,
|
|
197
|
+
about: `{{t("ai.tools.dataQueryAggregate.about", { ns: "${import_package.default.name}" })}}`
|
|
198
|
+
},
|
|
199
|
+
definition: {
|
|
200
|
+
name: "dataQuery",
|
|
201
|
+
description: "Run the repository query action on a collection with measures, dimensions, orders, filter, and having.",
|
|
202
|
+
schema: AggregateQuerySchema
|
|
203
|
+
},
|
|
204
|
+
invoke: async (ctx, args) => {
|
|
205
|
+
var _a, _b, _c, _d, _e;
|
|
206
|
+
const dataSourceKey = getDataSourceKey(args);
|
|
207
|
+
const ds = ctx.app.dataSourceManager.get(dataSourceKey);
|
|
208
|
+
if (!ds) {
|
|
209
|
+
return {
|
|
210
|
+
status: "error",
|
|
211
|
+
content: `Data source "${dataSourceKey}" not found`
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
const collection = ds.collectionManager.getCollection(args.collectionName);
|
|
215
|
+
if (!collection) {
|
|
216
|
+
return {
|
|
217
|
+
status: "error",
|
|
218
|
+
content: `Collection "${args.collectionName}" not found in data source "${dataSourceKey}"`
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
const { limit, offset } = (0, import_utils.normalizeLimitOffset)(args, { defaultLimit: 50, maxLimit: import_utils.MAX_QUERY_LIMIT });
|
|
222
|
+
const timezone = getTimezone(ctx, args);
|
|
223
|
+
if (!((_a = args.measures) == null ? void 0 : _a.length) && !((_b = args.dimensions) == null ? void 0 : _b.length)) {
|
|
224
|
+
return {
|
|
225
|
+
status: "error",
|
|
226
|
+
content: "Aggregate query requires at least one measure or dimension"
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
try {
|
|
230
|
+
const db = ds.collectionManager.db || ctx.db;
|
|
231
|
+
const result = await (0, import_plugin_acl.applyQueryPermission)({
|
|
232
|
+
acl: ds.acl || ctx.app.acl,
|
|
233
|
+
db,
|
|
234
|
+
resourceName: args.collectionName,
|
|
235
|
+
query: {
|
|
236
|
+
measures: args.measures,
|
|
237
|
+
dimensions: args.dimensions,
|
|
238
|
+
orders: args.orders,
|
|
239
|
+
filter: args.filter,
|
|
240
|
+
having: args.having,
|
|
241
|
+
limit,
|
|
242
|
+
offset
|
|
243
|
+
},
|
|
244
|
+
currentUser: (_c = ctx.state) == null ? void 0 : _c.currentUser,
|
|
245
|
+
currentRole: (_d = ctx.state) == null ? void 0 : _d.currentRole,
|
|
246
|
+
currentRoles: (_e = ctx.state) == null ? void 0 : _e.currentRoles,
|
|
247
|
+
timezone,
|
|
248
|
+
state: ctx.state
|
|
249
|
+
});
|
|
250
|
+
const queryResult = await db.getRepository(args.collectionName).query({
|
|
251
|
+
...result.query,
|
|
252
|
+
context: ctx,
|
|
253
|
+
timezone
|
|
254
|
+
});
|
|
255
|
+
return {
|
|
256
|
+
status: "success",
|
|
257
|
+
content: JSON.stringify((0, import_utils.truncateLongStrings)(queryResult))
|
|
258
|
+
};
|
|
259
|
+
} catch (error) {
|
|
260
|
+
if (error instanceof import_acl.NoPermissionError) {
|
|
261
|
+
return {
|
|
262
|
+
status: "error",
|
|
263
|
+
content: "No permissions"
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
return {
|
|
267
|
+
status: "error",
|
|
268
|
+
content: (error == null ? void 0 : error.message) || "Aggregate query failed"
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
});
|
package/dist/client/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@emotion/css"),require("react-router-dom"),require("@formily/antd-v5"),require("@formily/reactive"),require("@formily/react"),require("@nocobase/plugin-acl/client"),require("@dnd-kit/core"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("@formily/core"),require("@formily/shared"),require("react"),require("antd"),require("@nocobase/client"),require("antd-style"),require("@nocobase/utils/client"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-data-source-manager",["react-i18next","@emotion/css","react-router-dom","@formily/antd-v5","@formily/reactive","@formily/react","@nocobase/plugin-acl/client","@dnd-kit/core","@ant-design/icons","@nocobase/flow-engine","@formily/core","@formily/shared","react","antd","@nocobase/client","antd-style","@nocobase/utils/client","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-data-source-manager"]=t(require("react-i18next"),require("@emotion/css"),require("react-router-dom"),require("@formily/antd-v5"),require("@formily/reactive"),require("@formily/react"),require("@nocobase/plugin-acl/client"),require("@dnd-kit/core"),require("@ant-design/icons"),require("@nocobase/flow-engine"),require("@formily/core"),require("@formily/shared"),require("react"),require("antd"),require("@nocobase/client"),require("antd-style"),require("@nocobase/utils/client"),require("lodash")):e["@nocobase/plugin-data-source-manager"]=t(e["react-i18next"],e["@emotion/css"],e["react-router-dom"],e["@formily/antd-v5"],e["@formily/reactive"],e["@formily/react"],e["@nocobase/plugin-acl/client"],e["@dnd-kit/core"],e["@ant-design/icons"],e["@nocobase/flow-engine"],e["@formily/core"],e["@formily/shared"],e.react,e.antd,e["@nocobase/client"],e["antd-style"],e["@nocobase/utils/client"],e.lodash)}(self,function(e,t,n,r,o,a,i,c,u,l,s,f,p,d,b,y,g,h){return function(){"use strict";var m,v,w,O={719:function(e,t,n){n.r(t),n.d(t,{PluginDataSourceManagerClient:function(){return M}});var r=n(342),o=n(79),a=n.n(o),i=n(768),c=n(155),u=n.n(c),l=n(135),s=n(872);function f(e,t,n,r,o,a,i){try{var c=e[a](i),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function p(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){f(a,r,o,i,c,"next",e)}function c(e){f(a,r,o,i,c,"throw",e)}i(void 0)})}}function d(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function b(e,t,n){return(b=O()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&v(o,n.prototype),o}).apply(null,arguments)}function y(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function g(e,t,n){return t&&y(e.prototype,t),n&&y(e,n),e}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function w(e){var t="function"==typeof Map?new Map:void 0;return(w=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return b(e,arguments,m(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),v(n,e)})(e)}function O(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(O=function(){return!!e})()}function P(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(i,"next",{value:u(0)}),c(i,"throw",{value:u(1)}),c(i,"return",{value:u(2)}),"function"==typeof Symbol&&c(i,Symbol.iterator,{value:function(){return this}}),i;function u(c){return function(u){var l=[c,u];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,r=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){a.label=l[1];break}if(6===l[0]&&a.label<o[1]){a.label=o[1],o=l;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(l);break}o[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var S=(0,r.lazy)(function(){return n.e("936").then(n.bind(n,35))},"DatabaseConnectionProvider").DatabaseConnectionProvider,C=(0,r.lazy)(function(){return Promise.all([n.e("936"),n.e("397")]).then(n.bind(n,620))},"BreadcumbTitle").BreadcumbTitle,j=(0,r.lazy)(function(){return Promise.all([n.e("936"),n.e("369"),n.e("420")]).then(n.bind(n,111))},"CollectionManagerPage").CollectionManagerPage,x=(0,r.lazy)(function(){return Promise.all([n.e("936"),n.e("271")]).then(n.bind(n,61))},"DatabaseConnectionManagerPane").DatabaseConnectionManagerPane,k=(0,r.lazy)(function(){return Promise.all([n.e("936"),n.e("369"),n.e("644")]).then(n.bind(n,687))},"MainDataSourceManager").MainDataSourceManager,q=(0,r.lazy)(function(){return n.e("603").then(n.bind(n,886))},"DataSourcePermissionManager").DataSourcePermissionManager,_=(0,r.lazy)(function(){return n.e("416").then(n.bind(n,819))},"CollectionMainProvider").CollectionMainProvider,T=function(){function e(t){d(this,e),h(this,"plugin",void 0),h(this,"componentRegistry",void 0),this.plugin=t,this.componentRegistry=new i.Registry}return g(e,[{key:"registerManagerAction",value:function(e){var t=e.order,n=e.component,r="managerAction";this.componentRegistry.get(r)||this.componentRegistry.register(r,[]),this.componentRegistry.get(r).push({order:null!=t?t:0,component:n})}},{key:"getManagerActions",value:function(){var e;return null!=(e=this.componentRegistry.get("managerAction"))?e:[]}}]),e}(),M=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(){var e,n,r;return d(this,t),n=t,r=arguments,n=m(n),h(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,O()?Reflect.construct(n,r||[],m(this).constructor):n.apply(this,r)),"types",new Map),h(e,"extensionManager",new T(e)),h(e,"extendedTabs",{}),e}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&v(t,e),g(t,[{key:"getExtendedTabs",value:function(){return this.extendedTabs}},{key:"registerPermissionTab",value:function(e){this.extendedTabs[(0,i.uid)()]=e}},{key:"load",value:function(){return p(function(){return P(this,function(e){return this.app.pm.get(a()).settingsUI.addPermissionsTab(function(e){var t=e.t,n=e.TabLayout,r=e.activeRole;return{key:"dataSource",label:t("Data sources"),sort:15,children:u().createElement(n,null,u().createElement(q,{role:r}))}}),this.app.use(S),this.app.pluginSettingsManager.add(s.CU,{title:'{{t("Data sources", { ns: "'.concat(s.CU,'" })}}'),icon:"ClusterOutlined",isPinned:!0,sort:100,showTabs:!1,aclSnippet:"pm.data-source-manager*"}),this.app.pluginSettingsManager.add("".concat(s.CU,".list"),{title:'{{t("Data sources", { ns: "'.concat(s.CU,'" })}}'),Component:x,sort:1,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager"}),this.app.pluginSettingsManager.add("".concat(s.CU,"/:name"),{title:u().createElement(C,null),icon:"ClusterOutlined",isTopLevel:!1,sort:100,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager"}),this.app.pluginSettingsManager.add("".concat(s.CU,"/main"),{title:u().createElement(C,null),icon:"ClusterOutlined",isTopLevel:!1,sort:100,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main",Component:_}),this.app.pluginSettingsManager.add("".concat(s.CU,"/main.collections"),{title:'{{t("Collections", { ns: "'.concat(s.CU,'" })}}'),Component:k,topLevelName:"".concat(s.CU,"/main"),pluginKey:s.CU,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),this.app.pluginSettingsManager.add("".concat(s.CU,"/:name.collections"),{title:'{{t("Collections", { ns: "'.concat(s.CU,'" })}}'),Component:j,topLevelName:"".concat(s.CU,"/:name"),pluginKey:s.CU,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),this.app.dataSourceManager.addDataSources(this.getThirdDataSource.bind(this),l.J),[2]})}).call(this)}},{key:"setDataSources",value:function(){return p(function(){var e,t;return P(this,function(n){switch(n.label){case 0:return[4,this.app.apiClient.request({resource:"dataSources",action:"listEnabled",params:{paginate:!1}})];case 1:return[2,null==(t=n.sent())||null==(e=t.data)?void 0:e.data]}})}).call(this)}},{key:"getThirdDataSource",value:function(){return p(function(){var e,t;return P(this,function(n){switch(n.label){case 0:return[4,this.app.apiClient.request({resource:"dataSources",action:"listEnabled",params:{paginate:!1,appends:["collections"]}})];case 1:return[2,null==(t=n.sent())||null==(e=t.data)?void 0:e.data]}})}).call(this)}},{key:"registerType",value:function(e,t){this.types.set(e,t)}}]),t}(w(r.Plugin));t.default=M},135:function(e,t,n){n.d(t,{J:function(){return u}});var r=n(342);function o(e,t,n,r,o,a,i){try{var c=e[a](i),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}var u=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=a(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,c()?Reflect.construct(e,t||[],a(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&i(n,e),t=[{key:"getDataSource",value:function(){var e;return(e=function(){return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(i,"next",{value:u(0)}),c(i,"throw",{value:u(1)}),c(i,"return",{value:u(2)}),"function"==typeof Symbol&&c(i,Symbol.iterator,{value:function(){return this}}),i;function u(c){return function(u){var l=[c,u];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,r=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){a.label=l[1];break}if(6===l[0]&&a.label<o[1]){a.label=o[1],o=l;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(l);break}o[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){switch(e.label){case 0:return[4,this.app.apiClient.request({url:"dataSources:get/".concat(this.key),params:{appends:["collections"]}})];case 1:return[2,e.sent().data.data]}})},function(){var t=this,n=arguments;return new Promise(function(r,a){var i=e.apply(t,n);function c(e){o(i,r,a,c,u,"next",e)}function u(e){o(i,r,a,c,u,"throw",e)}c(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(r.DataSource)},872:function(e,t,n){n.d(t,{CU:function(){return a},VP:function(){return c},vV:function(){return i}});var r=n(342),o=n(953),a="data-source-manager";function i(e){var t,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r.i18n.t(e,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},o),n=n={ns:a},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))}function c(){return(0,o.useTranslation)([a,"client"],{nsMode:"fallback"})}},375:function(e){e.exports=u},799:function(e){e.exports=c},477:function(e){e.exports=t},418:function(e){e.exports=r},452:function(e){e.exports=s},230:function(e){e.exports=a},992:function(e){e.exports=o},166:function(e){e.exports=f},342:function(e){e.exports=b},694:function(e){e.exports=l},79:function(e){e.exports=i},768:function(e){e.exports=g},59:function(e){e.exports=d},235:function(e){e.exports=y},773:function(e){e.exports=h},155:function(e){e.exports=p},953:function(t){t.exports=e},442:function(e){e.exports=n},835:function(e,t,n){var r=window.__nocobase_public_path__||"";if(!r&&window.location&&window.location.pathname){var o=window.location.pathname||"/",a=o.indexOf("/v2/");r=a>=0?o.slice(0,a+1):"/"}r&&(r=r.replace(/\/v2\/?$/,"/")),r||(r="/"),"/"!==r.charAt(r.length-1)&&(r+="/"),n.p=r+"static/plugins/@nocobase/plugin-data-source-manager/dist/client/"}},P={};function S(e){var t=P[e];if(void 0!==t)return t.exports;var n=P[e]={exports:{}};return O[e](n,n.exports,S),n.exports}S.m=O,S.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return S.d(t,{a:t}),t},S.d=function(e,t){for(var n in t)S.o(t,n)&&!S.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},S.f={},S.e=function(e){return Promise.all(Object.keys(S.f).reduce(function(t,n){return S.f[n](e,t),t},[]))},S.u=function(e){return""+({271:"fa3e4378130aae67",369:"c6568af61b73d4ad",397:"acfbf29a3a591994",416:"bd5678ab7ccc4395",420:"1ee628ced380272f",603:"65f41527bfe3a32a",644:"6b850ca935afda51",936:"6052d2d233279406"})[e]+".js"},S.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),S.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},C={},S.l=function(e,t,n,r){if(C[e])return void C[e].push(t);if(void 0!==n)for(var o,a,i=document.getElementsByTagName("script"),c=0;c<i.length;c++){var u=i[c];if(u.getAttribute("src")==e||u.getAttribute("data-rspack")=="@nocobase/plugin-data-source-manager:"+n){o=u;break}}o||(a=!0,(o=document.createElement("script")).timeout=120,S.nc&&o.setAttribute("nonce",S.nc),o.setAttribute("data-rspack","@nocobase/plugin-data-source-manager:"+n),o.src=e),C[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=C[e];if(delete C[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),a&&document.head.appendChild(o)},S.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},S.g.importScripts&&(j=S.g.location+"");var C,j,x=S.g.document;if(!j&&x&&(x.currentScript&&"SCRIPT"===x.currentScript.tagName.toUpperCase()&&(j=x.currentScript.src),!j)){var k=x.getElementsByTagName("script");if(k.length)for(var q=k.length-1;q>-1&&(!j||!/^http(s?):/.test(j));)j=k[q--].src}if(!j)throw Error("Automatic publicPath is not supported in this browser");return S.p=j.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),m={889:0},S.f.j=function(e,t){var n=S.o(m,e)?m[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=m[e]=[t,r]});t.push(n[2]=r);var o=S.p+S.u(e),a=Error();S.l(o,function(t){if(S.o(m,e)&&(0!==(n=m[e])&&(m[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;a.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",a.name="ChunkLoadError",a.type=r,a.request=o,n[1](a)}},"chunk-"+e,e)}},v=function(e,t){var n,r,o=t[0],a=t[1],i=t[2],c=0;if(o.some(function(e){return 0!==m[e]})){for(n in a)S.o(a,n)&&(S.m[n]=a[n]);i&&i(S)}for(e&&e(t);c<o.length;c++)r=o[c],S.o(m,r)&&m[r]&&m[r][0](),m[r]=0},(w=self.webpackChunk_nocobase_plugin_data_source_manager=self.webpackChunk_nocobase_plugin_data_source_manager||[]).forEach(v.bind(null,0)),w.push=v.bind(null,w.push.bind(w)),S(835),S(719)}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@emotion/css"),require("react-router-dom"),require("@formily/antd-v5"),require("@formily/reactive"),require("@formily/react"),require("@nocobase/plugin-acl/client"),require("@dnd-kit/core"),require("@nocobase/flow-engine"),require("@ant-design/icons"),require("@formily/core"),require("@formily/shared"),require("react"),require("antd"),require("@nocobase/client"),require("antd-style"),require("@nocobase/utils/client"),require("lodash")):"function"==typeof define&&define.amd?define("@nocobase/plugin-data-source-manager",["react-i18next","@emotion/css","react-router-dom","@formily/antd-v5","@formily/reactive","@formily/react","@nocobase/plugin-acl/client","@dnd-kit/core","@nocobase/flow-engine","@ant-design/icons","@formily/core","@formily/shared","react","antd","@nocobase/client","antd-style","@nocobase/utils/client","lodash"],t):"object"==typeof exports?exports["@nocobase/plugin-data-source-manager"]=t(require("react-i18next"),require("@emotion/css"),require("react-router-dom"),require("@formily/antd-v5"),require("@formily/reactive"),require("@formily/react"),require("@nocobase/plugin-acl/client"),require("@dnd-kit/core"),require("@nocobase/flow-engine"),require("@ant-design/icons"),require("@formily/core"),require("@formily/shared"),require("react"),require("antd"),require("@nocobase/client"),require("antd-style"),require("@nocobase/utils/client"),require("lodash")):e["@nocobase/plugin-data-source-manager"]=t(e["react-i18next"],e["@emotion/css"],e["react-router-dom"],e["@formily/antd-v5"],e["@formily/reactive"],e["@formily/react"],e["@nocobase/plugin-acl/client"],e["@dnd-kit/core"],e["@nocobase/flow-engine"],e["@ant-design/icons"],e["@formily/core"],e["@formily/shared"],e.react,e.antd,e["@nocobase/client"],e["antd-style"],e["@nocobase/utils/client"],e.lodash)}(self,function(e,t,n,r,o,a,i,c,u,l,s,p,f,d,b,y,g,h){return function(){"use strict";var m,v,w,O={719:function(e,t,n){n.r(t),n.d(t,{PluginDataSourceManagerClient:function(){return M}});var r=n(342),o=n(79),a=n.n(o),i=n(768),c=n(155),u=n.n(c),l=n(135),s=n(872);function p(e,t,n,r,o,a,i){try{var c=e[a](i),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function f(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){p(a,r,o,i,c,"next",e)}function c(e){p(a,r,o,i,c,"throw",e)}i(void 0)})}}function d(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function b(e,t,n){return(b=O()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&v(o,n.prototype),o}).apply(null,arguments)}function y(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function g(e,t,n){return t&&y(e.prototype,t),n&&y(e,n),e}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function w(e){var t="function"==typeof Map?new Map:void 0;return(w=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return b(e,arguments,m(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),v(n,e)})(e)}function O(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(O=function(){return!!e})()}function P(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(i,"next",{value:u(0)}),c(i,"throw",{value:u(1)}),c(i,"return",{value:u(2)}),"function"==typeof Symbol&&c(i,Symbol.iterator,{value:function(){return this}}),i;function u(c){return function(u){var l=[c,u];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,r=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){a.label=l[1];break}if(6===l[0]&&a.label<o[1]){a.label=o[1],o=l;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(l);break}o[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var S=(0,r.lazy)(function(){return n.e("936").then(n.bind(n,35))},"DatabaseConnectionProvider").DatabaseConnectionProvider,C=(0,r.lazy)(function(){return Promise.all([n.e("936"),n.e("397")]).then(n.bind(n,620))},"BreadcumbTitle").BreadcumbTitle,j=(0,r.lazy)(function(){return Promise.all([n.e("936"),n.e("369"),n.e("420")]).then(n.bind(n,111))},"CollectionManagerPage").CollectionManagerPage,x=(0,r.lazy)(function(){return Promise.all([n.e("936"),n.e("271")]).then(n.bind(n,61))},"DatabaseConnectionManagerPane").DatabaseConnectionManagerPane,k=(0,r.lazy)(function(){return Promise.all([n.e("936"),n.e("369"),n.e("644")]).then(n.bind(n,687))},"MainDataSourceManager").MainDataSourceManager,_=(0,r.lazy)(function(){return n.e("603").then(n.bind(n,886))},"DataSourcePermissionManager").DataSourcePermissionManager,q=(0,r.lazy)(function(){return n.e("416").then(n.bind(n,819))},"CollectionMainProvider").CollectionMainProvider,T=function(){function e(t){d(this,e),h(this,"plugin",void 0),h(this,"componentRegistry",void 0),this.plugin=t,this.componentRegistry=new i.Registry}return g(e,[{key:"registerManagerAction",value:function(e){var t=e.order,n=e.component,r="managerAction";this.componentRegistry.get(r)||this.componentRegistry.register(r,[]),this.componentRegistry.get(r).push({order:null!=t?t:0,component:n})}},{key:"getManagerActions",value:function(){var e;return null!=(e=this.componentRegistry.get("managerAction"))?e:[]}}]),e}(),M=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(){var e,n,r;return d(this,t),n=t,r=arguments,n=m(n),h(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,O()?Reflect.construct(n,r||[],m(this).constructor):n.apply(this,r)),"types",new Map),h(e,"extensionManager",new T(e)),h(e,"extendedTabs",{}),e}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&v(t,e),g(t,[{key:"getExtendedTabs",value:function(){return this.extendedTabs}},{key:"registerPermissionTab",value:function(e){this.extendedTabs[(0,i.uid)()]=e}},{key:"load",value:function(){return f(function(){return P(this,function(e){return this.app.pm.get(a()).settingsUI.addPermissionsTab(function(e){var t=e.t,n=e.TabLayout,r=e.activeRole;return{key:"dataSource",label:t("Data sources"),sort:15,children:u().createElement(n,null,u().createElement(_,{role:r}))}}),this.app.use(S),this.app.pluginSettingsManager.add(s.CU,{title:'{{t("Data sources", { ns: "'.concat(s.CU,'" })}}'),icon:"ClusterOutlined",isPinned:!0,sort:100,showTabs:!1,aclSnippet:"pm.data-source-manager*"}),this.app.pluginSettingsManager.add("".concat(s.CU,".list"),{title:'{{t("Data sources", { ns: "'.concat(s.CU,'" })}}'),Component:x,sort:1,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager"}),this.app.pluginSettingsManager.add("".concat(s.CU,"/:name"),{title:u().createElement(C,null),icon:"ClusterOutlined",isTopLevel:!1,sort:100,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager"}),this.app.pluginSettingsManager.add("".concat(s.CU,"/main"),{title:u().createElement(C,null),icon:"ClusterOutlined",isTopLevel:!1,sort:100,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main",Component:q}),this.app.pluginSettingsManager.add("".concat(s.CU,"/main.collections"),{title:'{{t("Collections", { ns: "'.concat(s.CU,'" })}}'),Component:k,topLevelName:"".concat(s.CU,"/main"),pluginKey:s.CU,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),this.app.pluginSettingsManager.add("".concat(s.CU,"/:name.collections"),{title:'{{t("Collections", { ns: "'.concat(s.CU,'" })}}'),Component:j,topLevelName:"".concat(s.CU,"/:name"),pluginKey:s.CU,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),this.app.dataSourceManager.addDataSources(this.getThirdDataSource.bind(this),l.J),[2]})}).call(this)}},{key:"setDataSources",value:function(){return f(function(){var e,t;return P(this,function(n){switch(n.label){case 0:return[4,this.app.apiClient.request({resource:"dataSources",action:"listEnabled",params:{paginate:!1}})];case 1:return[2,null==(t=n.sent())||null==(e=t.data)?void 0:e.data]}})}).call(this)}},{key:"getThirdDataSource",value:function(){return f(function(){var e,t;return P(this,function(n){switch(n.label){case 0:return[4,this.app.apiClient.request({resource:"dataSources",action:"listEnabled",params:{paginate:!1,appends:["collections"]}})];case 1:return[2,null==(t=n.sent())||null==(e=t.data)?void 0:e.data]}})}).call(this)}},{key:"registerType",value:function(e,t){this.types.set(e,t)}}]),t}(w(r.Plugin));t.default=M},135:function(e,t,n){n.d(t,{J:function(){return u}});var r=n(342);function o(e,t,n,r,o,a,i){try{var c=e[a](i),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}var u=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return e=n,t=arguments,e=a(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,c()?Reflect.construct(e,t||[],a(this).constructor):e.apply(this,t))}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&i(n,e),t=[{key:"getDataSource",value:function(){var e;return(e=function(){return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(i,"next",{value:u(0)}),c(i,"throw",{value:u(1)}),c(i,"return",{value:u(2)}),"function"==typeof Symbol&&c(i,Symbol.iterator,{value:function(){return this}}),i;function u(c){return function(u){var l=[c,u];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return a.label++,{value:l[1],done:!1};case 5:a.label++,r=l[1],l=[0];continue;case 7:l=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){a=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){a.label=l[1];break}if(6===l[0]&&a.label<o[1]){a.label=o[1],o=l;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(l);break}o[2]&&a.ops.pop(),a.trys.pop();continue}l=t.call(e,a)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){switch(e.label){case 0:return[4,this.app.apiClient.request({url:"dataSources:get/".concat(this.key),params:{appends:["collections"]}})];case 1:return[2,e.sent().data.data]}})},function(){var t=this,n=arguments;return new Promise(function(r,a){var i=e.apply(t,n);function c(e){o(i,r,a,c,u,"next",e)}function u(e){o(i,r,a,c,u,"throw",e)}c(void 0)})}).call(this)}}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}(n.prototype,t),n}(r.DataSource)},872:function(e,t,n){n.d(t,{CU:function(){return a},VP:function(){return c},vV:function(){return i}});var r=n(342),o=n(953),a="data-source-manager";function i(e){var t,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r.i18n.t(e,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},o),n=n={ns:a},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))}function c(){return(0,o.useTranslation)([a,"client"],{nsMode:"fallback"})}},375:function(e){e.exports=l},799:function(e){e.exports=c},477:function(e){e.exports=t},418:function(e){e.exports=r},452:function(e){e.exports=s},230:function(e){e.exports=a},992:function(e){e.exports=o},166:function(e){e.exports=p},342:function(e){e.exports=b},694:function(e){e.exports=u},79:function(e){e.exports=i},768:function(e){e.exports=g},59:function(e){e.exports=d},235:function(e){e.exports=y},773:function(e){e.exports=h},155:function(e){e.exports=f},953:function(t){t.exports=e},442:function(e){e.exports=n},634:function(e,t,n){var r="",o="u">typeof document?document.currentScript:null;if(o&&o.src&&(r=o.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/")),!r){var a=window.__webpack_public_path__||"";a&&("/"!==a.charAt(a.length-1)&&(a+="/"),r=a+"static/plugins/@nocobase/plugin-data-source-manager/dist/client/")}if(!r){if(!(r=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var i=window.location.pathname||"/",c=i.indexOf("/v2/");r=c>=0?i.slice(0,c+1):"/"}r&&(r=r.replace(/\/v2\/?$/,"/")),r||(r="/"),"/"!==r.charAt(r.length-1)&&(r+="/"),r+="static/plugins/@nocobase/plugin-data-source-manager/dist/client/"}n.p=r}},P={};function S(e){var t=P[e];if(void 0!==t)return t.exports;var n=P[e]={exports:{}};return O[e](n,n.exports,S),n.exports}S.m=O,S.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return S.d(t,{a:t}),t},S.d=function(e,t){for(var n in t)S.o(t,n)&&!S.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},S.f={},S.e=function(e){return Promise.all(Object.keys(S.f).reduce(function(t,n){return S.f[n](e,t),t},[]))},S.u=function(e){return""+({271:"fa3e4378130aae67",369:"c6568af61b73d4ad",397:"acfbf29a3a591994",416:"bd5678ab7ccc4395",420:"1ee628ced380272f",603:"65f41527bfe3a32a",644:"6b850ca935afda51",936:"6052d2d233279406"})[e]+".js"},S.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),S.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},C={},S.l=function(e,t,n,r){if(C[e])return void C[e].push(t);if(void 0!==n)for(var o,a,i=document.getElementsByTagName("script"),c=0;c<i.length;c++){var u=i[c];if(u.getAttribute("src")==e||u.getAttribute("data-rspack")=="@nocobase/plugin-data-source-manager:"+n){o=u;break}}o||(a=!0,(o=document.createElement("script")).timeout=120,S.nc&&o.setAttribute("nonce",S.nc),o.setAttribute("data-rspack","@nocobase/plugin-data-source-manager:"+n),o.src=e),C[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=C[e];if(delete C[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),a&&document.head.appendChild(o)},S.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},S.g.importScripts&&(j=S.g.location+"");var C,j,x=S.g.document;if(!j&&x&&(x.currentScript&&"SCRIPT"===x.currentScript.tagName.toUpperCase()&&(j=x.currentScript.src),!j)){var k=x.getElementsByTagName("script");if(k.length)for(var _=k.length-1;_>-1&&(!j||!/^http(s?):/.test(j));)j=k[_--].src}if(!j)throw Error("Automatic publicPath is not supported in this browser");return S.p=j.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),m={889:0},S.f.j=function(e,t){var n=S.o(m,e)?m[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=m[e]=[t,r]});t.push(n[2]=r);var o=S.p+S.u(e),a=Error();S.l(o,function(t){if(S.o(m,e)&&(0!==(n=m[e])&&(m[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;a.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",a.name="ChunkLoadError",a.type=r,a.request=o,n[1](a)}},"chunk-"+e,e)}},v=function(e,t){var n,r,o=t[0],a=t[1],i=t[2],c=0;if(o.some(function(e){return 0!==m[e]})){for(n in a)S.o(a,n)&&(S.m[n]=a[n]);i&&i(S)}for(e&&e(t);c<o.length;c++)r=o[c],S.o(m,r)&&m[r]&&m[r][0](),m[r]=0},(w=self.webpackChunk_nocobase_plugin_data_source_manager=self.webpackChunk_nocobase_plugin_data_source_manager||[]).forEach(v.bind(null,0)),w.push=v.bind(null,w.push.bind(w)),S(634),S(719)}()});
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,27 +8,27 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.1.0-alpha.
|
|
11
|
+
"@nocobase/client": "2.1.0-alpha.15",
|
|
12
12
|
"react": "18.2.0",
|
|
13
|
-
"@nocobase/plugin-acl": "2.1.0-alpha.
|
|
14
|
-
"@nocobase/utils": "2.1.0-alpha.
|
|
15
|
-
"@nocobase/
|
|
16
|
-
"@nocobase/
|
|
13
|
+
"@nocobase/plugin-acl": "2.1.0-alpha.15",
|
|
14
|
+
"@nocobase/utils": "2.1.0-alpha.15",
|
|
15
|
+
"@nocobase/ai": "2.1.0-alpha.15",
|
|
16
|
+
"@nocobase/server": "2.1.0-alpha.15",
|
|
17
|
+
"@nocobase/data-source-manager": "2.1.0-alpha.15",
|
|
17
18
|
"lodash": "4.17.21",
|
|
18
|
-
"@nocobase/acl": "2.1.0-alpha.
|
|
19
|
-
"@nocobase/database": "2.1.0-alpha.
|
|
19
|
+
"@nocobase/acl": "2.1.0-alpha.15",
|
|
20
|
+
"@nocobase/database": "2.1.0-alpha.15",
|
|
20
21
|
"@ant-design/icons": "5.6.1",
|
|
21
22
|
"antd": "5.24.2",
|
|
22
23
|
"react-router-dom": "6.30.1",
|
|
23
|
-
"@nocobase/flow-engine": "2.1.0-alpha.
|
|
24
|
+
"@nocobase/flow-engine": "2.1.0-alpha.15",
|
|
24
25
|
"@formily/shared": "2.3.7",
|
|
25
26
|
"@formily/react": "2.3.7",
|
|
26
27
|
"react-i18next": "11.18.6",
|
|
27
28
|
"@emotion/css": "11.13.0",
|
|
28
|
-
"@nocobase/actions": "2.1.0-alpha.
|
|
29
|
+
"@nocobase/actions": "2.1.0-alpha.15",
|
|
29
30
|
"sequelize": "6.35.2",
|
|
30
|
-
"@nocobase/
|
|
31
|
-
"@nocobase/test": "2.1.0-alpha.13",
|
|
31
|
+
"@nocobase/test": "2.1.0-alpha.15",
|
|
32
32
|
"@formily/antd-v5": "1.2.3",
|
|
33
33
|
"@formily/core": "2.3.7",
|
|
34
34
|
"@formily/reactive": "2.3.7",
|
package/dist/locale/en-US.json
CHANGED
|
@@ -59,6 +59,8 @@
|
|
|
59
59
|
"ai.tools.searchFieldMetadata.about": "Search fields in data models by keyword (english first). Returns either search results or a suggested query.",
|
|
60
60
|
"ai.tools.dataSourceQuery.title": "Data source query",
|
|
61
61
|
"ai.tools.dataSourceQuery.about": "Use dataSource, collectionName, and collection fields to query data from the database",
|
|
62
|
+
"ai.tools.dataQueryAggregate.title": "Data query",
|
|
63
|
+
"ai.tools.dataQueryAggregate.about": "Run aggregate repository queries with measures, dimensions, orders, filter, and having",
|
|
62
64
|
"ai.tools.dataSourceCounting.title": "Data source records counting",
|
|
63
65
|
"ai.tools.dataSourceCounting.about": "Use dataSource, collectionName, and collection fields to query data from the database, get total count of records",
|
|
64
66
|
"ai.tools.dataQuery.args.datasource": "Data source key",
|
|
@@ -69,7 +71,7 @@
|
|
|
69
71
|
"ai.tools.dataQuery.args.offset": "Offset of records to be queried",
|
|
70
72
|
"ai.tools.dataQuery.args.limit": "Maximum number of records to be queried",
|
|
71
73
|
"ai.skills.dataQuery.title": "Data query",
|
|
72
|
-
"ai.skills.dataQuery.about": "
|
|
74
|
+
"ai.skills.dataQuery.about": "Use tools to inspect metadata, query records, and run aggregate analysis on specified data sources",
|
|
73
75
|
"ai.skills.dataModeling.title": "Data modeling",
|
|
74
76
|
"ai.skills.dataModeling.about": "helps translate business scenarios into normalized database schemas with table declarations and relationship diagrams.",
|
|
75
77
|
"ai.skills.dataMetadata.title": "Data metadata",
|
package/dist/locale/zh-CN.json
CHANGED
|
@@ -59,6 +59,8 @@
|
|
|
59
59
|
"ai.tools.searchFieldMetadata.about": "通过关键词搜索数据模型字段(优先英文)。返回搜索结果或建议的查询。",
|
|
60
60
|
"ai.tools.dataSourceQuery.title": "数据源查询操作",
|
|
61
61
|
"ai.tools.dataSourceQuery.about": "使用 dataSource、collectionName 和 collection fields 从数据库中查询数据。",
|
|
62
|
+
"ai.tools.dataQueryAggregate.title": "数据查询",
|
|
63
|
+
"ai.tools.dataQueryAggregate.about": "使用 measures、dimensions、orders、filter 和 having 执行聚合查询",
|
|
62
64
|
"ai.tools.dataSourceCounting.title": "数据源记录数统计",
|
|
63
65
|
"ai.tools.dataSourceCounting.about": "使用 dataSource、collectionName 和 collection fields 从数据库中获取记录总数",
|
|
64
66
|
"ai.tools.dataQuery.args.datasource": "数据源标识",
|
|
@@ -69,7 +71,7 @@
|
|
|
69
71
|
"ai.tools.dataQuery.args.offset": "查询记录的偏移量",
|
|
70
72
|
"ai.tools.dataQuery.args.limit": "查询记录的最大数量",
|
|
71
73
|
"ai.skills.dataQuery.title": "数据查询",
|
|
72
|
-
"ai.skills.dataQuery.about": "
|
|
74
|
+
"ai.skills.dataQuery.about": "使用工具查看元数据、查询记录并对指定数据源执行聚合分析",
|
|
73
75
|
"ai.skills.dataModeling.title": "数据建模",
|
|
74
76
|
"ai.skills.dataModeling.about": "帮助将业务场景转换为带有表声明和关系图的规范化数据库模式。",
|
|
75
77
|
"ai.skills.dataMetadata.title": "获取数据模型元信息",
|
|
@@ -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-
|
|
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-10T12:40:12.859Z"}
|
|
@@ -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
|
+
});
|
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) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-data-source-manager",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.15",
|
|
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": "7c86e75b0af4b9f532c8ebf5ef96a7423b0ab60e",
|
|
24
24
|
"license": "Apache-2.0"
|
|
25
25
|
}
|