@uipath/agent-tool 1.201.0 → 1.202.0-preview.136
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/agent-tool-OK5DK57D-hw5d866f.js +11 -0
- package/dist/{de-5KVP66U6-f7knj511.js → de-5KVP66U6-1bnf4zt5.js} +52 -52
- package/dist/{en-4KXU7N7B-66fntxa2.js → en-X3S6IZ5J-nhkg6pwn.js} +54 -60
- package/dist/{es-MX-XAVLOQW3-9b3cp9n8.js → es-MX-XAVLOQW3-q00km2y7.js} +52 -52
- package/dist/{es-VFPNVMP5-thm0z9sr.js → es-VFPNVMP5-bx2c337j.js} +52 -52
- package/dist/executor-tool.js +5 -13
- package/dist/{fr-E5MDO4EG-exvrs7ge.js → fr-E5MDO4EG-c3mkty2t.js} +52 -52
- package/dist/{index-hsadteg4.js → index-h8cph72k.js} +4 -4
- package/dist/{index-9f8q2ege.js → index-p3vk57z7.js} +27 -27
- package/dist/{index-26bymy67.js → index-vhhz1bs5.js} +160 -88
- package/dist/index.js +7 -17
- package/dist/{ja-DPO5PPLO-s2a7j3nj.js → ja-DPO5PPLO-mysfmznx.js} +52 -52
- package/dist/{js-yaml-cggj6w7q.js → js-yaml-87cdx6bm.js} +27 -19
- package/dist/{ko-ITOPNIYI-qz39kamf.js → ko-ITOPNIYI-hmxd2asd.js} +52 -52
- package/dist/{packager-tool-h5zqhhbj.js → packager-tool-0srzfhdr.js} +1089 -690
- package/dist/{packager-tool-wckvcay0.js → packager-tool-1yh8g550.js} +9 -7
- package/dist/{packager-tool-tq9q9m77.js → packager-tool-a42jnpy5.js} +3 -9
- package/dist/{packager-tool-kwp8tznh.js → packager-tool-g8yfc7ef.js} +9227 -6826
- package/dist/{packager-tool-1zt6rezn.js → packager-tool-hwy2sxr3.js} +858 -1171
- package/dist/{packager-tool-v02mthyt.js → packager-tool-vkv0j95b.js} +637 -637
- package/dist/packager-tool-y80gnt72.js +9753 -0
- package/dist/packager-tool.js +5 -6
- package/dist/{pt-BR-BXURWX4W-dqr4dnf9.js → pt-BR-BXURWX4W-bwfcwhk1.js} +52 -52
- package/dist/{pt-YI4VE4YQ-v7gjeg82.js → pt-YI4VE4YQ-wdkn2dcf.js} +52 -52
- package/dist/{ro-RKXZUG7Z-cm3xn3fj.js → ro-RKXZUG7Z-nndrrsq7.js} +52 -52
- package/dist/{ru-WBLQ5B2U-awt245ky.js → ru-WBLQ5B2U-8r3c7v6d.js} +1 -1
- package/dist/tool.js +9 -19
- package/dist/{tr-AA6O2WSR-ga1xnymp.js → tr-AA6O2WSR-86ba4bdf.js} +52 -52
- package/dist/{zh-CN-R2KLHXQV-wttmznep.js → zh-CN-R2KLHXQV-agqr45ds.js} +52 -52
- package/dist/{zh-TW-RJGCQANM-gqn0aca0.js → zh-TW-RJGCQANM-w0x3qc1p.js} +52 -52
- package/package.json +2 -2
- package/dist/agent-project-service-j4pgc7gk.js +0 -12
- package/dist/agent-tool-OK5DK57D-zenkdkdp.js +0 -12
- package/dist/browser-strategy-16yagjhr.js +0 -99
- package/dist/index-byw2z4xp.js +0 -141
- package/dist/index-k00qjyec.js +0 -2933
- package/dist/index-p50kx6jv.js +0 -48756
- package/dist/index-rqfxg3fq.js +0 -15
- package/dist/index-t82tsh16.js +0 -53
- package/dist/index.umd.min-drpc57vn.js +0 -7814
- package/dist/integration-tool-service-n214kzdn.js +0 -297
- package/dist/is-client-a1hbz77f.js +0 -124
- package/dist/node-strategy-1r3qegaf.js +0 -350
- package/dist/packager-tool-0gctz400.js +0 -17
- package/dist/packager-tool-4fge2k9c.js +0 -419
- package/dist/packager-tool-5xdkh3vm.js +0 -2573
- package/dist/packager-tool-8xv16pb3.js +0 -20663
- package/dist/packager-tool-bpegrcj1.js +0 -5336
- package/dist/packager-tool-gkvdytpj.js +0 -5085
- package/dist/packager-tool-nsrs2tm5.js +0 -114
- package/dist/packager-tool-q42rrs00.js +0 -12
- package/dist/packager-tool-qa9gftnj.js +0 -31
- package/dist/packager-tool-wzknj3dr.js +0 -394
- package/dist/packager-tool-yv3rvyas.js +0 -239
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AgentProjectService,
|
|
3
|
-
migrateLegacyToolGuardrailPolicies
|
|
4
|
-
} from "./packager-tool-wzknj3dr.js";
|
|
5
|
-
import"./packager-tool-gkvdytpj.js";
|
|
6
|
-
import"./packager-tool-nsrs2tm5.js";
|
|
7
|
-
import"./packager-tool-yv3rvyas.js";
|
|
8
|
-
import {
|
|
9
|
-
__require
|
|
10
|
-
} from "./packager-tool-wckvcay0.js";
|
|
11
|
-
|
|
12
|
-
// src/services/integration-tool-service.ts
|
|
13
|
-
class IntegrationToolService {
|
|
14
|
-
isClient;
|
|
15
|
-
projectService;
|
|
16
|
-
constructor(isClient, projectService) {
|
|
17
|
-
this.isClient = isClient;
|
|
18
|
-
this.projectService = projectService ?? new AgentProjectService;
|
|
19
|
-
}
|
|
20
|
-
async discoverTools(connectorKey, connectionId) {
|
|
21
|
-
const resources = await this.isClient.listResources(connectorKey, connectionId);
|
|
22
|
-
return resources.map((r) => ({
|
|
23
|
-
name: r.name,
|
|
24
|
-
displayName: r.displayName || r.name,
|
|
25
|
-
type: r.type,
|
|
26
|
-
path: r.path,
|
|
27
|
-
objectName: r.name
|
|
28
|
-
}));
|
|
29
|
-
}
|
|
30
|
-
async addTool(opts) {
|
|
31
|
-
const metadata = await this.isClient.getResourceMetadata(opts.connectorKey, opts.objectName, opts.connectionId);
|
|
32
|
-
const connector = await this.isClient.getConnectorByKey(opts.connectorKey);
|
|
33
|
-
let connection;
|
|
34
|
-
if (opts.connectionId) {
|
|
35
|
-
connection = await this.isClient.getConnectionById(opts.connectionId);
|
|
36
|
-
}
|
|
37
|
-
let resourceKey = await this.projectService.findSolutionConnectionResourceKey(opts.projectPath, opts.connectorKey);
|
|
38
|
-
if (!resourceKey) {
|
|
39
|
-
resourceKey = opts.connectionId ?? crypto.randomUUID();
|
|
40
|
-
await this.projectService.writeSolutionConnectionResource(opts.projectPath, {
|
|
41
|
-
connectorKey: opts.connectorKey,
|
|
42
|
-
connectorName: connector.name,
|
|
43
|
-
resourceKey
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
const parameters = this.buildParameters(metadata, opts.method ?? "POST", opts.parameterValues);
|
|
47
|
-
const { inputSchema, outputSchema } = this.buildSchemas(metadata, opts.method ?? "POST");
|
|
48
|
-
const toolPath = this.resolveToolPath(metadata, opts.objectName);
|
|
49
|
-
const toolId = crypto.randomUUID();
|
|
50
|
-
const tool = {
|
|
51
|
-
$resourceType: "tool",
|
|
52
|
-
name: opts.name,
|
|
53
|
-
description: opts.description ?? connector.name ?? "",
|
|
54
|
-
type: "integration",
|
|
55
|
-
location: "external",
|
|
56
|
-
id: toolId,
|
|
57
|
-
inputSchema,
|
|
58
|
-
outputSchema,
|
|
59
|
-
settings: {},
|
|
60
|
-
properties: {
|
|
61
|
-
toolPath,
|
|
62
|
-
objectName: opts.objectName,
|
|
63
|
-
toolDisplayName: opts.name,
|
|
64
|
-
toolDescription: opts.description ?? connector.name ?? "",
|
|
65
|
-
method: opts.method ?? "POST",
|
|
66
|
-
connection: this.buildConnectionProperties(connection, connector, resourceKey, opts.folderKey, opts.connectionId),
|
|
67
|
-
parameters,
|
|
68
|
-
bodyStructure: {
|
|
69
|
-
contentType: "json"
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
...opts.guardrailPolicies !== undefined ? {
|
|
73
|
-
guardrail: {
|
|
74
|
-
policies: opts.guardrailPolicies
|
|
75
|
-
}
|
|
76
|
-
} : {},
|
|
77
|
-
iconUrl: connector.image ?? "",
|
|
78
|
-
isPreview: false,
|
|
79
|
-
isEnabled: true
|
|
80
|
-
};
|
|
81
|
-
await this.addToBuilder(opts.projectPath, tool);
|
|
82
|
-
await this.projectService.writeResource(opts.projectPath, opts.name, tool);
|
|
83
|
-
return tool;
|
|
84
|
-
}
|
|
85
|
-
async connectTool(projectPath, toolName, connectionId) {
|
|
86
|
-
const resource = await this.projectService.readResource(projectPath, toolName);
|
|
87
|
-
if (resource.type !== "integration") {
|
|
88
|
-
throw new Error(`Tool "${toolName}" is not an integration tool`);
|
|
89
|
-
}
|
|
90
|
-
const connection = await this.isClient.getConnectionById(connectionId);
|
|
91
|
-
const connectorKey = connection.connector.key;
|
|
92
|
-
const existingKey = resource.properties?.connection?.solutionProperties?.resourceKey ?? await this.projectService.findSolutionConnectionResourceKey(projectPath, connectorKey);
|
|
93
|
-
const resourceKey = existingKey ?? crypto.randomUUID();
|
|
94
|
-
const solKey = await this.projectService.findSolutionConnectionResourceKey(projectPath, connectorKey);
|
|
95
|
-
if (!solKey) {
|
|
96
|
-
await this.projectService.writeSolutionConnectionResource(projectPath, {
|
|
97
|
-
connectorKey,
|
|
98
|
-
connectorName: connection.connector.name,
|
|
99
|
-
resourceKey
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
const properties = resource.properties ?? {};
|
|
103
|
-
properties.connection = {
|
|
104
|
-
id: connectionId,
|
|
105
|
-
name: connection.name,
|
|
106
|
-
elementInstanceId: 0,
|
|
107
|
-
apiBaseUri: "",
|
|
108
|
-
state: connection.state?.toLowerCase() ?? "enabled",
|
|
109
|
-
isDefault: false,
|
|
110
|
-
connector: {
|
|
111
|
-
key: connection.connector.key,
|
|
112
|
-
name: connection.connector.name,
|
|
113
|
-
image: "",
|
|
114
|
-
enabled: true,
|
|
115
|
-
isPreview: false
|
|
116
|
-
},
|
|
117
|
-
folder: {
|
|
118
|
-
key: connection.folder?.key ?? "00000000-0000-0000-0000-000000000000",
|
|
119
|
-
path: connection.folder?.path ?? ""
|
|
120
|
-
},
|
|
121
|
-
solutionProperties: {
|
|
122
|
-
resourceKey: connectionId
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
resource.properties = properties;
|
|
126
|
-
await this.projectService.writeResource(projectPath, toolName, resource);
|
|
127
|
-
}
|
|
128
|
-
buildConnectionProperties(connection, connector, resourceKey, folderKey, connectionId) {
|
|
129
|
-
if (connection) {
|
|
130
|
-
const actualId = connectionId ?? resourceKey;
|
|
131
|
-
return {
|
|
132
|
-
id: actualId,
|
|
133
|
-
name: connection.name,
|
|
134
|
-
elementInstanceId: 0,
|
|
135
|
-
apiBaseUri: "",
|
|
136
|
-
state: connection.state?.toLowerCase() ?? "enabled",
|
|
137
|
-
isDefault: false,
|
|
138
|
-
connector: {
|
|
139
|
-
key: connection.connector.key,
|
|
140
|
-
name: connection.connector.name,
|
|
141
|
-
image: "",
|
|
142
|
-
enabled: true,
|
|
143
|
-
isPreview: false
|
|
144
|
-
},
|
|
145
|
-
folder: {
|
|
146
|
-
key: connection.folder?.key ?? "00000000-0000-0000-0000-000000000000",
|
|
147
|
-
path: connection.folder?.path ?? ""
|
|
148
|
-
},
|
|
149
|
-
solutionProperties: {
|
|
150
|
-
resourceKey: actualId
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
return {
|
|
155
|
-
id: resourceKey,
|
|
156
|
-
name: "",
|
|
157
|
-
elementInstanceId: 0,
|
|
158
|
-
apiBaseUri: "",
|
|
159
|
-
state: "enabled",
|
|
160
|
-
isDefault: false,
|
|
161
|
-
connector: {
|
|
162
|
-
key: connector.key,
|
|
163
|
-
name: connector.name,
|
|
164
|
-
image: "",
|
|
165
|
-
enabled: true,
|
|
166
|
-
isPreview: false
|
|
167
|
-
},
|
|
168
|
-
folder: {
|
|
169
|
-
key: folderKey ?? "00000000-0000-0000-0000-000000000000",
|
|
170
|
-
path: ""
|
|
171
|
-
},
|
|
172
|
-
solutionProperties: {
|
|
173
|
-
resourceKey
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
resolveFields(metadata) {
|
|
178
|
-
const fieldsObj = metadata?.fields ?? metadata?.metadata?.fields ?? {};
|
|
179
|
-
if (Array.isArray(fieldsObj))
|
|
180
|
-
return fieldsObj;
|
|
181
|
-
if (typeof fieldsObj === "object" && fieldsObj !== null) {
|
|
182
|
-
return Object.values(fieldsObj);
|
|
183
|
-
}
|
|
184
|
-
return [];
|
|
185
|
-
}
|
|
186
|
-
buildParameters(metadata, method, parameterValues) {
|
|
187
|
-
const fields = this.resolveFields(metadata);
|
|
188
|
-
const httpMethod = method.toUpperCase();
|
|
189
|
-
const parameters = [];
|
|
190
|
-
let sortOrder = 1;
|
|
191
|
-
for (const field of fields) {
|
|
192
|
-
const methodInfo = field.method?.[httpMethod] ?? field.method?.POST;
|
|
193
|
-
if (!methodInfo?.request && !methodInfo?.requestCurated) {
|
|
194
|
-
continue;
|
|
195
|
-
}
|
|
196
|
-
const enumValues = field.enumProperty ?? (Array.isArray(field.enum) ? field.enum.map((e) => typeof e === "string" ? e : e.value ?? e.name) : undefined);
|
|
197
|
-
const isStatic = !!parameterValues?.[field.name] || enumValues && enumValues.length > 0;
|
|
198
|
-
const param = {
|
|
199
|
-
name: field.name,
|
|
200
|
-
displayName: field.displayName ?? field.name,
|
|
201
|
-
type: field.type ?? "string",
|
|
202
|
-
fieldLocation: "body",
|
|
203
|
-
value: parameterValues?.[field.name] ?? `{{prompt}}`,
|
|
204
|
-
description: field.description ?? "",
|
|
205
|
-
position: methodInfo?.requestRequired ?? false ? "primary" : "secondary",
|
|
206
|
-
sortOrder: sortOrder++,
|
|
207
|
-
required: methodInfo?.requestRequired ?? false,
|
|
208
|
-
fieldVariant: isStatic ? "static" : "dynamic",
|
|
209
|
-
isCascading: false,
|
|
210
|
-
dynamic: !isStatic,
|
|
211
|
-
enumValues: null,
|
|
212
|
-
loadReferenceOptionsByDefault: null,
|
|
213
|
-
dynamicBehavior: [],
|
|
214
|
-
reference: null
|
|
215
|
-
};
|
|
216
|
-
if (enumValues && enumValues.length > 0) {
|
|
217
|
-
param.enumValues = enumValues.map((e) => ({
|
|
218
|
-
name: e,
|
|
219
|
-
value: e
|
|
220
|
-
}));
|
|
221
|
-
if (!parameterValues?.[field.name]) {
|
|
222
|
-
param.value = enumValues[0];
|
|
223
|
-
param.fieldVariant = "static";
|
|
224
|
-
param.dynamic = false;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
parameters.push(param);
|
|
228
|
-
}
|
|
229
|
-
return parameters;
|
|
230
|
-
}
|
|
231
|
-
buildSchemas(metadata, method) {
|
|
232
|
-
const fields = this.resolveFields(metadata);
|
|
233
|
-
const httpMethod = method.toUpperCase();
|
|
234
|
-
const inputProperties = {};
|
|
235
|
-
const outputProperties = {};
|
|
236
|
-
const requiredInputs = [];
|
|
237
|
-
for (const field of fields) {
|
|
238
|
-
const methodInfo = field.method?.[httpMethod] ?? field.method?.POST;
|
|
239
|
-
if (!methodInfo)
|
|
240
|
-
continue;
|
|
241
|
-
const schemaProp = {
|
|
242
|
-
type: field.type ?? "string"
|
|
243
|
-
};
|
|
244
|
-
if (field.displayName)
|
|
245
|
-
schemaProp.title = field.displayName;
|
|
246
|
-
if (field.description)
|
|
247
|
-
schemaProp.description = field.description;
|
|
248
|
-
const schemaEnum = field.enumProperty ?? (Array.isArray(field.enum) ? field.enum.map((e) => typeof e === "string" ? e : e.value ?? e.name) : undefined);
|
|
249
|
-
if (schemaEnum && schemaEnum.length > 0) {
|
|
250
|
-
schemaProp.enum = schemaEnum;
|
|
251
|
-
}
|
|
252
|
-
if (methodInfo.request || methodInfo.requestCurated) {
|
|
253
|
-
inputProperties[field.name] = schemaProp;
|
|
254
|
-
if (methodInfo.requestRequired) {
|
|
255
|
-
requiredInputs.push(field.name);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
if (methodInfo.response || methodInfo.responseCurated) {
|
|
259
|
-
outputProperties[field.name] = schemaProp;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
return {
|
|
263
|
-
inputSchema: {
|
|
264
|
-
type: "object",
|
|
265
|
-
properties: inputProperties,
|
|
266
|
-
...requiredInputs.length > 0 ? { required: requiredInputs } : {}
|
|
267
|
-
},
|
|
268
|
-
outputSchema: {
|
|
269
|
-
type: "object",
|
|
270
|
-
properties: outputProperties
|
|
271
|
-
}
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
resolveToolPath(metadata, objectName) {
|
|
275
|
-
if (metadata?.path)
|
|
276
|
-
return metadata.path;
|
|
277
|
-
return `/${objectName.replace(/::/g, "/")}`;
|
|
278
|
-
}
|
|
279
|
-
async addToBuilder(projectPath, tool) {
|
|
280
|
-
const { getFileSystem } = await import("./index-rqfxg3fq.js");
|
|
281
|
-
const fs = getFileSystem();
|
|
282
|
-
const builderPath = fs.path.join(this.projectService.getAgentDir(projectPath), ".agent-builder", "agent.json");
|
|
283
|
-
const raw = await fs.readFile(builderPath, "utf-8");
|
|
284
|
-
const builder = JSON.parse(raw);
|
|
285
|
-
migrateLegacyToolGuardrailPolicies(builder);
|
|
286
|
-
if (!builder.resources)
|
|
287
|
-
builder.resources = [];
|
|
288
|
-
builder.resources.push(tool);
|
|
289
|
-
await fs.writeFile(builderPath, `${JSON.stringify(builder, null, 2)}
|
|
290
|
-
`);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
export {
|
|
294
|
-
IntegrationToolService
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
//# debugId=DFF44CBAF5CB546F64756E2164756E21
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
catchError
|
|
3
|
-
} from "./packager-tool-gkvdytpj.js";
|
|
4
|
-
import"./packager-tool-nsrs2tm5.js";
|
|
5
|
-
import"./packager-tool-yv3rvyas.js";
|
|
6
|
-
import {
|
|
7
|
-
__require
|
|
8
|
-
} from "./packager-tool-wckvcay0.js";
|
|
9
|
-
|
|
10
|
-
// src/services/is-client.ts
|
|
11
|
-
class IntegrationServiceClient {
|
|
12
|
-
connectorsApi;
|
|
13
|
-
connectionsApi;
|
|
14
|
-
elementsApi;
|
|
15
|
-
constructor(connectorsApi, connectionsApi, elementsApi) {
|
|
16
|
-
this.connectorsApi = connectorsApi;
|
|
17
|
-
this.connectionsApi = connectionsApi;
|
|
18
|
-
this.elementsApi = elementsApi;
|
|
19
|
-
}
|
|
20
|
-
static async create(options) {
|
|
21
|
-
const {
|
|
22
|
-
ConnectorsApi: ConnApi,
|
|
23
|
-
ConnectionsApi: ConnxApi,
|
|
24
|
-
ElementsApi: ElemApi,
|
|
25
|
-
createApiClient,
|
|
26
|
-
createElementsConfig
|
|
27
|
-
} = await import("./index-k00qjyec.js");
|
|
28
|
-
const [connectorsApi, connectionsApi, elementsApi] = await Promise.all([
|
|
29
|
-
createApiClient(ConnApi, options),
|
|
30
|
-
createApiClient(ConnxApi, options),
|
|
31
|
-
createElementsConfig(options).then((config) => new ElemApi(config))
|
|
32
|
-
]);
|
|
33
|
-
return new IntegrationServiceClient(connectorsApi, connectionsApi, elementsApi);
|
|
34
|
-
}
|
|
35
|
-
async getConnectorByKey(key) {
|
|
36
|
-
const connector = await this.connectorsApi.apiV1ConnectorsKeyOrIdGet({
|
|
37
|
-
keyOrId: key
|
|
38
|
-
});
|
|
39
|
-
return {
|
|
40
|
-
key: connector.key ?? key,
|
|
41
|
-
name: connector.name ?? "",
|
|
42
|
-
image: connector.image ?? ""
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
async getConnectionById(connectionId) {
|
|
46
|
-
const conn = await this.connectionsApi.apiV1ConnectionsConnectionIdGet({
|
|
47
|
-
connectionId
|
|
48
|
-
});
|
|
49
|
-
return {
|
|
50
|
-
id: conn.id ?? connectionId,
|
|
51
|
-
name: conn.name ?? "",
|
|
52
|
-
state: String(conn.state ?? "enabled").toLowerCase(),
|
|
53
|
-
connector: {
|
|
54
|
-
key: conn.connector?.key ?? "",
|
|
55
|
-
name: conn.connector?.name ?? "",
|
|
56
|
-
image: conn.connector?.image ?? ""
|
|
57
|
-
},
|
|
58
|
-
folder: conn.folder ? {
|
|
59
|
-
key: conn.folder.key ?? "",
|
|
60
|
-
path: "",
|
|
61
|
-
name: ""
|
|
62
|
-
} : undefined
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
async listResources(connectorKey, connectionId) {
|
|
66
|
-
if (!connectionId) {
|
|
67
|
-
const [error, defaultConn] = await catchError(this.connectorsApi.apiV1ConnectorsKeyOrIdConnectionGet({
|
|
68
|
-
keyOrId: connectorKey
|
|
69
|
-
}));
|
|
70
|
-
if (error) {
|
|
71
|
-
return [];
|
|
72
|
-
}
|
|
73
|
-
if (defaultConn.id) {
|
|
74
|
-
connectionId = defaultConn.id;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
if (!connectionId)
|
|
78
|
-
return [];
|
|
79
|
-
const objects = await this.elementsApi.getInstanceObjects({
|
|
80
|
-
connectionOrInstanceId: connectionId,
|
|
81
|
-
elementKey: connectorKey
|
|
82
|
-
});
|
|
83
|
-
if (!objects)
|
|
84
|
-
return [];
|
|
85
|
-
const entries = Array.isArray(objects) ? objects.map((o, i) => [
|
|
86
|
-
o?.name ?? String(i),
|
|
87
|
-
o
|
|
88
|
-
]) : Object.entries(objects);
|
|
89
|
-
return entries.map(([name, info]) => ({
|
|
90
|
-
name: info?.name ?? name,
|
|
91
|
-
displayName: info?.displayName ?? info?.name ?? name,
|
|
92
|
-
type: info?.type ?? "resource",
|
|
93
|
-
path: info?.path ?? `/${name.replace(/::/g, "/")}`
|
|
94
|
-
}));
|
|
95
|
-
}
|
|
96
|
-
async getResourceMetadata(connectorKey, objectName, connectionId) {
|
|
97
|
-
if (connectionId) {
|
|
98
|
-
return await this.elementsApi.getInstanceObjectMetadata({
|
|
99
|
-
connectionOrInstanceId: connectionId,
|
|
100
|
-
elementKey: connectorKey,
|
|
101
|
-
objectName
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
const [error, defaultConn] = await catchError(this.connectorsApi.apiV1ConnectorsKeyOrIdConnectionGet({
|
|
105
|
-
keyOrId: connectorKey
|
|
106
|
-
}));
|
|
107
|
-
if (error) {
|
|
108
|
-
return { fields: {} };
|
|
109
|
-
}
|
|
110
|
-
if (defaultConn.id) {
|
|
111
|
-
return await this.elementsApi.getInstanceObjectMetadata({
|
|
112
|
-
connectionOrInstanceId: defaultConn.id,
|
|
113
|
-
elementKey: connectorKey,
|
|
114
|
-
objectName
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
return { fields: {} };
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
export {
|
|
121
|
-
IntegrationServiceClient
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
//# debugId=5D620DE8D3EF714B64756E2164756E21
|