@nocobase/plugin-data-source-manager 2.1.0-beta.9 → 2.2.0-alpha.1

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.
Files changed (96) hide show
  1. package/client-v2.d.ts +2 -0
  2. package/client-v2.js +1 -0
  3. package/dist/ai/ai-employees/orin/ignored.d.ts +10 -0
  4. package/dist/ai/ai-employees/orin/ignored.js +59 -0
  5. package/dist/ai/ai-employees/orin/skills/data-modeling/SKILLS.md +245 -0
  6. package/dist/ai/{tools → ai-employees/orin/skills/data-modeling/tools}/defineCollections.js +47 -1
  7. package/dist/ai/{tools → ai-employees/orin/skills/data-modeling/tools}/intentRouter.js +1 -1
  8. package/dist/ai/{tools/data-query → common}/common.js +63 -11
  9. package/dist/ai/{tools/data-query → common}/utils.d.ts +1 -0
  10. package/dist/ai/{tools/data-query → common}/utils.js +15 -0
  11. package/dist/ai/skills/data-metadata/SKILLS.md +108 -0
  12. package/dist/ai/{tools → skills/data-metadata/tools}/getCollectionMetadata.js +2 -2
  13. package/dist/ai/{tools → skills/data-metadata/tools}/getCollectionNames.js +2 -2
  14. package/dist/ai/{tools → skills/data-metadata/tools}/getDataSources.js +2 -2
  15. package/dist/ai/{tools → skills/data-metadata/tools}/searchFieldMetadata.js +2 -2
  16. package/dist/ai/skills/data-query/SKILLS.md +245 -0
  17. package/dist/ai/skills/data-query/tools/dataQuery.js +282 -0
  18. package/dist/ai/{tools/data-query → skills/data-query/tools}/dataSourceCounting.js +12 -4
  19. package/dist/ai/skills/data-query/tools/dataSourceQuery.d.ts +10 -0
  20. package/dist/ai/{tools/data-query → skills/data-query/tools}/dataSourceQuery.js +12 -5
  21. package/dist/client/271.1374702d84646fff.js +10 -0
  22. package/dist/client/369.342f1e0231dbe482.js +10 -0
  23. package/dist/client/397.c8c6659cf3f7ac1c.js +10 -0
  24. package/dist/client/416.197712b8b93033c5.js +10 -0
  25. package/dist/client/420.a37695bbfc3bec7a.js +10 -0
  26. package/dist/client/603.d6022bceb934f5b0.js +10 -0
  27. package/dist/client/644.b98e4b39058e9c32.js +10 -0
  28. package/dist/client/936.d5ab7aecb4eb6004.js +10 -0
  29. package/dist/client/index.js +1 -1
  30. package/dist/client-v2/167.52e683be46f9cfc7.js +10 -0
  31. package/dist/client-v2/426.53e3eaee8d9dbca0.js +10 -0
  32. package/dist/client-v2/907.a0ab273516f45ac3.js +10 -0
  33. package/dist/client-v2/components/DataSourceForm.d.ts +17 -0
  34. package/dist/client-v2/field-interfaces/index.d.ts +13 -0
  35. package/dist/client-v2/index.d.ts +12 -0
  36. package/dist/client-v2/index.js +10 -0
  37. package/dist/client-v2/locale.d.ts +12 -0
  38. package/dist/client-v2/pages/DataSourceCollectionsPage.d.ts +10 -0
  39. package/dist/client-v2/pages/DataSourcesPage.d.ts +10 -0
  40. package/dist/client-v2/pages/components/CollectionsPage.d.ts +27 -0
  41. package/dist/client-v2/pages/components/FieldForm.d.ts +19 -0
  42. package/dist/client-v2/pages/components/FieldsPage.d.ts +16 -0
  43. package/dist/client-v2/pages/components/ViewCollectionConfigure.d.ts +27 -0
  44. package/dist/client-v2/pages/components/collectionFieldApi.d.ts +11 -0
  45. package/dist/client-v2/pages/components/collectionTemplateFieldInterfaces.d.ts +18 -0
  46. package/dist/client-v2/pages/permissions/DataSourcePermissionsTab.d.ts +15 -0
  47. package/dist/client-v2/pages/permissions/PermissionEditors.d.ts +45 -0
  48. package/dist/client-v2/pages/permissions/ScopeSelect.d.ts +21 -0
  49. package/dist/client-v2/pages/permissions/permissionRequests.d.ts +33 -0
  50. package/dist/client-v2/pages/permissions/types.d.ts +55 -0
  51. package/dist/client-v2/plugin.d.ts +243 -0
  52. package/dist/client-v2/registries.d.ts +36 -0
  53. package/dist/client-v2/runtime.d.ts +12 -0
  54. package/dist/client-v2/utils/compileLegacyTemplate.d.ts +16 -0
  55. package/dist/client-v2/utils/error.d.ts +11 -0
  56. package/dist/externalVersion.js +17 -13
  57. package/dist/locale/en-US.json +275 -3
  58. package/dist/locale/zh-CN.json +275 -3
  59. package/dist/node_modules/zod/index.cjs +1 -1
  60. package/dist/node_modules/zod/package.json +1 -1
  61. package/dist/server/collections/data-sources-collections.js +1 -0
  62. package/dist/server/collections/data-sources-fields.js +1 -0
  63. package/dist/server/collections/data-sources-roles-resources-actions.js +1 -0
  64. package/dist/server/collections/data-sources-roles-resources-scopes.js +1 -0
  65. package/dist/server/collections/data-sources-roles-resources.js +1 -0
  66. package/dist/server/collections/data-sources-roles.js +1 -0
  67. package/dist/server/collections/data-sources.js +1 -0
  68. package/dist/server/mcp-post-processors.d.ts +24 -0
  69. package/dist/server/mcp-post-processors.js +158 -0
  70. package/dist/server/models/data-source.js +3 -13
  71. package/dist/server/plugin.js +7 -2
  72. package/dist/server/resourcers/data-sources-collections-fields.d.ts +1 -0
  73. package/dist/server/resourcers/data-sources-collections-fields.js +19 -0
  74. package/dist/server/services/external-field-apply.d.ts +23 -0
  75. package/dist/server/services/external-field-apply.js +208 -0
  76. package/dist/server/utils.js +11 -3
  77. package/dist/swagger/index.d.ts +326 -0
  78. package/dist/swagger/index.js +385 -0
  79. package/package.json +4 -2
  80. package/dist/client/1a8cce8035a89dd9.js +0 -10
  81. package/dist/client/276bcf3de74bebd1.js +0 -10
  82. package/dist/client/2f7a418e7935984d.js +0 -10
  83. package/dist/client/689d3bec33ad2ec3.js +0 -10
  84. package/dist/client/d33eb40009bd7ec6.js +0 -10
  85. package/dist/client/dbf5ddf434ab29c0.js +0 -10
  86. package/dist/client/f528b165e77e3608.js +0 -10
  87. package/dist/client/fdae18574fda07af.js +0 -10
  88. /package/dist/ai/{tools → ai-employees/orin/skills/data-modeling/tools}/defineCollections.d.ts +0 -0
  89. /package/dist/ai/{tools → ai-employees/orin/skills/data-modeling/tools}/intentRouter.d.ts +0 -0
  90. /package/dist/ai/{tools/data-query → common}/common.d.ts +0 -0
  91. /package/dist/ai/{tools → skills/data-metadata/tools}/getCollectionMetadata.d.ts +0 -0
  92. /package/dist/ai/{tools → skills/data-metadata/tools}/getCollectionNames.d.ts +0 -0
  93. /package/dist/ai/{tools → skills/data-metadata/tools}/getDataSources.d.ts +0 -0
  94. /package/dist/ai/{tools → skills/data-metadata/tools}/searchFieldMetadata.d.ts +0 -0
  95. /package/dist/ai/{tools/data-query/dataSourceCounting.d.ts → skills/data-query/tools/dataQuery.d.ts} +0 -0
  96. /package/dist/ai/{tools/data-query/dataSourceQuery.d.ts → skills/data-query/tools/dataSourceCounting.d.ts} +0 -0
@@ -30,13 +30,18 @@ __export(utils_exports, {
30
30
  mergeOptions: () => mergeOptions
31
31
  });
32
32
  module.exports = __toCommonJS(utils_exports);
33
+ const nullableOverrideConfig = {
34
+ sort: ["scopeKey"]
35
+ };
33
36
  function mergeOptions(fieldOptions, modelOptions) {
34
37
  const newOptions = {
35
38
  ...fieldOptions,
36
39
  ...modelOptions
37
40
  };
41
+ const fieldType = modelOptions.type || fieldOptions.type;
42
+ const nullableOverrideKeys = nullableOverrideConfig[fieldType] || [];
38
43
  for (const key of Object.keys(modelOptions)) {
39
- if (modelOptions[key] === null && fieldOptions[key]) {
44
+ if (modelOptions[key] === null && fieldOptions[key] && !nullableOverrideKeys.includes(key)) {
40
45
  newOptions[key] = fieldOptions[key];
41
46
  }
42
47
  }
@@ -46,15 +51,18 @@ const mapDataSourceWithCollection = (app, dataSourceModel, appendCollections = t
46
51
  const plugin = app.pm.get("data-source-manager");
47
52
  const dataSource = app.dataSourceManager.dataSources.get(dataSourceModel.get("key"));
48
53
  const dataSourceStatus = plugin.dataSourceStatus[dataSourceModel.get("key")];
54
+ const publicOptions = dataSource == null ? void 0 : dataSource.publicOptions();
55
+ const collectionManager = dataSource == null ? void 0 : dataSource.collectionManager;
56
+ const db = collectionManager == null ? void 0 : collectionManager.db;
57
+ const isDBInstance = (db == null ? void 0 : db.isDBInstance) === false ? false : !!db;
49
58
  const item = {
50
59
  key: dataSourceModel.get("key"),
51
60
  displayName: dataSourceModel.get("displayName"),
52
61
  status: dataSourceStatus,
53
62
  type: dataSourceModel.get("type"),
54
63
  // @ts-ignore
55
- isDBInstance: !!(dataSource == null ? void 0 : dataSource.collectionManager.db)
64
+ isDBInstance
56
65
  };
57
- const publicOptions = dataSource == null ? void 0 : dataSource.publicOptions();
58
66
  if (publicOptions) {
59
67
  item["options"] = publicOptions;
60
68
  }
@@ -0,0 +1,326 @@
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
+ '/dataSources/{associatedIndex}/collections:list': {
56
+ get: {
57
+ tags: string[];
58
+ summary: string;
59
+ description: string;
60
+ parameters: ({
61
+ name: string;
62
+ in: string;
63
+ required: boolean;
64
+ description: string;
65
+ schema: {
66
+ type: string;
67
+ additionalProperties?: undefined;
68
+ };
69
+ } | {
70
+ name: string;
71
+ in: string;
72
+ required: boolean;
73
+ description: string;
74
+ schema: {
75
+ type: string;
76
+ additionalProperties: boolean;
77
+ };
78
+ } | {
79
+ name: string;
80
+ in: string;
81
+ required: boolean;
82
+ schema: {
83
+ type: string;
84
+ additionalProperties?: undefined;
85
+ };
86
+ description?: undefined;
87
+ })[];
88
+ responses: {
89
+ 200: {
90
+ description: string;
91
+ content: {
92
+ 'application/json': {
93
+ schema: {
94
+ type: string;
95
+ properties: {
96
+ data: {
97
+ type: string;
98
+ items: {
99
+ $ref: string;
100
+ };
101
+ };
102
+ meta: {
103
+ type: string;
104
+ additionalProperties: boolean;
105
+ };
106
+ };
107
+ };
108
+ };
109
+ };
110
+ };
111
+ };
112
+ };
113
+ };
114
+ '/dataSourcesCollections/{associatedIndex}/fields:list': {
115
+ get: {
116
+ tags: string[];
117
+ summary: string;
118
+ description: string;
119
+ parameters: {
120
+ name: string;
121
+ in: string;
122
+ required: boolean;
123
+ description: string;
124
+ schema: {
125
+ type: string;
126
+ };
127
+ }[];
128
+ responses: {
129
+ 200: {
130
+ description: string;
131
+ content: {
132
+ 'application/json': {
133
+ schema: {
134
+ type: string;
135
+ items: {
136
+ type: string;
137
+ additionalProperties: boolean;
138
+ };
139
+ };
140
+ };
141
+ };
142
+ };
143
+ };
144
+ };
145
+ };
146
+ '/dataSourcesCollections/{associatedIndex}/fields:apply': {
147
+ post: {
148
+ tags: string[];
149
+ summary: string;
150
+ description: string;
151
+ parameters: {
152
+ name: string;
153
+ in: string;
154
+ required: boolean;
155
+ description: string;
156
+ schema: {
157
+ type: string;
158
+ };
159
+ }[];
160
+ requestBody: {
161
+ content: {
162
+ 'application/json': {
163
+ schema: {
164
+ $ref: string;
165
+ };
166
+ };
167
+ };
168
+ };
169
+ responses: {
170
+ 200: {
171
+ description: string;
172
+ content: {
173
+ 'application/json': {
174
+ schema: {
175
+ type: string;
176
+ properties: {
177
+ data: {
178
+ $ref: string;
179
+ };
180
+ };
181
+ };
182
+ };
183
+ };
184
+ };
185
+ };
186
+ };
187
+ };
188
+ };
189
+ components: {
190
+ schemas: {
191
+ DataSourceInfo: {
192
+ type: string;
193
+ properties: {
194
+ key: {
195
+ type: string;
196
+ };
197
+ displayName: {
198
+ type: string;
199
+ };
200
+ status: {
201
+ type: string;
202
+ };
203
+ type: {
204
+ type: string;
205
+ };
206
+ isDBInstance: {
207
+ type: string;
208
+ };
209
+ options: {
210
+ type: string;
211
+ additionalProperties: boolean;
212
+ };
213
+ errorMessage: {
214
+ type: string;
215
+ };
216
+ collections: {
217
+ type: string;
218
+ items: {
219
+ $ref: string;
220
+ };
221
+ };
222
+ };
223
+ additionalProperties: boolean;
224
+ };
225
+ DataSourceCollectionInfo: {
226
+ type: string;
227
+ properties: {
228
+ name: {
229
+ type: string;
230
+ };
231
+ title: {
232
+ type: string;
233
+ };
234
+ fields: {
235
+ type: string;
236
+ items: {
237
+ type: string;
238
+ additionalProperties: boolean;
239
+ };
240
+ };
241
+ availableActions: {
242
+ type: string;
243
+ additionalProperties: boolean;
244
+ };
245
+ unavailableActions: {
246
+ type: string;
247
+ additionalProperties: boolean;
248
+ };
249
+ };
250
+ additionalProperties: boolean;
251
+ };
252
+ DataSourceFieldApplyInput: {
253
+ type: string;
254
+ required: string[];
255
+ properties: {
256
+ dataSourceKey: {
257
+ type: string;
258
+ description: string;
259
+ };
260
+ collectionName: {
261
+ type: string;
262
+ description: string;
263
+ };
264
+ name: {
265
+ type: string;
266
+ };
267
+ title: {
268
+ type: string;
269
+ };
270
+ interface: {
271
+ type: string;
272
+ description: string;
273
+ };
274
+ type: {
275
+ type: string;
276
+ description: string;
277
+ };
278
+ target: {
279
+ type: string;
280
+ };
281
+ foreignKey: {
282
+ type: string;
283
+ };
284
+ sourceKey: {
285
+ type: string;
286
+ };
287
+ targetKey: {
288
+ type: string;
289
+ };
290
+ through: {
291
+ type: string;
292
+ };
293
+ otherKey: {
294
+ type: string;
295
+ };
296
+ targetTitleField: {
297
+ type: string;
298
+ };
299
+ titleField: {
300
+ type: string;
301
+ };
302
+ uiSchema: {
303
+ type: string;
304
+ additionalProperties: boolean;
305
+ };
306
+ settings: {
307
+ type: string;
308
+ additionalProperties: boolean;
309
+ };
310
+ };
311
+ additionalProperties: boolean;
312
+ };
313
+ DataSourceFieldApplyResult: {
314
+ type: string;
315
+ properties: {
316
+ data: {
317
+ type: string;
318
+ additionalProperties: boolean;
319
+ };
320
+ };
321
+ additionalProperties: boolean;
322
+ };
323
+ };
324
+ };
325
+ };
326
+ export default _default;