@uipath/case-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/{authoring-aaaqwck3.js → authoring-cvjhkfxp.js} +74 -48
- package/dist/{browser-strategy-rkcvc6tn.js → browser-strategy-6atc7v8s.js} +3 -3
- package/dist/case-api-bwcxsbxe.js +381 -0
- package/dist/case-debug-studio-web-service-qcb328bt.js +335 -0
- package/dist/{case-pack-service-bxas5bxz.js → case-pack-service-txby2znw.js} +11 -18
- package/dist/case-validate-service-0q8krj2a.js +2114 -0
- package/dist/connector-enrichment-service-agqxam5y.js +60 -0
- package/dist/connector-lookup-service-ycgk77n0.js +22 -0
- package/dist/connector-task-spec-kdx5bv87.js +1250 -0
- package/dist/{de-5KVP66U6-t37qr521.js → de-5KVP66U6-1bnf4zt5.js} +54 -54
- package/dist/{de-5HU6GFWV-zheyw6d2.js → de-7XQXX2DK-tqdy5n2b.js} +857 -845
- package/dist/debug-service-dxx5pfev.js +57 -0
- package/dist/{en-MABQK6C4-nkzq2j8t.js → en-5ZGC5VQ3-h581y30k.js} +897 -897
- package/dist/{en-4KXU7N7B-24v330b5.js → en-X3S6IZ5J-nhkg6pwn.js} +55 -61
- package/dist/enrichment-service-ebz1f4ds.js +421 -0
- package/dist/{es-MX-POESXYP2-9538722k.js → es-MX-U2VN3SZW-anynsmd8.js} +857 -845
- package/dist/{es-MX-XAVLOQW3-47a405kf.js → es-MX-XAVLOQW3-q00km2y7.js} +54 -54
- package/dist/{es-VFPNVMP5-6sftsdxe.js → es-VFPNVMP5-bx2c337j.js} +54 -54
- package/dist/{es-LUTYN7U7-ye5zn4sn.js → es-ZGCPPOME-8gazspjj.js} +857 -845
- package/dist/{fr-E5MDO4EG-f3x1jeqw.js → fr-E5MDO4EG-c3mkty2t.js} +54 -54
- package/dist/{fr-LJIK56LW-xf3xf2kh.js → fr-T3G5GZCT-y3f7xb1q.js} +857 -845
- package/dist/{index-cncq089f.js → index-7s201ka0.js} +163 -80
- package/dist/{index-hsadteg4.js → index-h8cph72k.js} +4 -4
- package/dist/index-k4xz16db.js +63712 -0
- package/dist/{index-p50kx6jv.js → index-k5tbd184.js} +276 -276
- package/dist/index-kwxe1vep.js +143 -0
- package/dist/{index-9f8q2ege.js → index-p3vk57z7.js} +27 -27
- package/dist/index-qyf1dee9.js +630 -0
- package/dist/index.js +16 -17
- package/dist/{index.umd.min-drpc57vn.js → index.umd.min-fqefd9kn.js} +3 -3
- package/dist/input-reader-xb9vecxv.js +11 -0
- package/dist/{ja-FGEGLBJ3-w9byjhze.js → ja-BI5K3JDZ-77zat4z2.js} +857 -845
- package/dist/{ja-DPO5PPLO-fmbg7zt2.js → ja-DPO5PPLO-mysfmznx.js} +54 -54
- package/dist/{js-yaml-cggj6w7q.js → js-yaml-87cdx6bm.js} +27 -19
- package/dist/known-types-qryebm95.js +15 -0
- package/dist/{ko-ITOPNIYI-aqy82jk8.js → ko-ITOPNIYI-hmxd2asd.js} +54 -54
- package/dist/{ko-TUAK3G3A-s25w0ckg.js → ko-JOBF5V7N-4bv0mjje.js} +857 -845
- package/dist/{node-strategy-8gzp67xs.js → node-strategy-0267x5e5.js} +130 -14
- package/dist/node-sync-service-9a9ksj9s.js +38 -0
- package/dist/{packager-tool-9qecd4wb.js → packager-tool-0gctz400.js} +5 -2
- package/dist/packager-tool-0mj06yen.js +65 -0
- package/dist/{packager-tool-1cb0d5e0.js → packager-tool-0v3s8r01.js} +2 -2
- package/dist/packager-tool-134mvmcm.js +3040 -0
- package/dist/{packager-tool-wckvcay0.js → packager-tool-1yh8g550.js} +9 -7
- package/dist/{packager-tool-zqa5k9f7.js → packager-tool-37zvccmt.js} +990 -2287
- package/dist/packager-tool-3ze5vt52.js +54 -0
- package/dist/{packager-tool-w3h8xrnv.js → packager-tool-56j6keqr.js} +71 -3
- package/dist/{packager-tool-3wygxefb.js → packager-tool-58q3tvh7.js} +10 -10
- package/dist/{packager-tool-zx48pq4v.js → packager-tool-5ax2ywcg.js} +1997 -1174
- package/dist/{packager-tool-we1phz71.js → packager-tool-885mmrvr.js} +31 -3
- package/dist/packager-tool-9scn4b15.js +852 -0
- package/dist/{packager-tool-p9j43p8h.js → packager-tool-a42jnpy5.js} +3 -9
- package/dist/packager-tool-ajvse9r3.js +356 -0
- package/dist/{packager-tool-jysvpt8p.js → packager-tool-c23zrhj8.js} +2 -2
- package/dist/packager-tool-dqs5qy9s.js +2327 -0
- package/dist/packager-tool-ee5dhff3.js +6717 -0
- package/dist/{packager-tool-wvqz81mx.js → packager-tool-gtzs471w.js} +3 -2
- package/dist/packager-tool-hrr0efqc.js +546 -0
- package/dist/packager-tool-j9rfdrdm.js +1125 -0
- package/dist/{packager-tool-gq6952nc.js → packager-tool-jhdf8gt1.js} +5054 -17851
- package/dist/packager-tool-mp59jtpm.js +6865 -0
- package/dist/packager-tool-njzcfve1.js +77 -0
- package/dist/packager-tool-p7jgrm5r.js +15 -0
- package/dist/packager-tool-r84ng21s.js +57 -0
- package/dist/packager-tool-rqvr63x5.js +1217 -0
- package/dist/packager-tool-s12392rd.js +80 -0
- package/dist/packager-tool-sv0d6wb6.js +173 -0
- package/dist/packager-tool-ty1t2byf.js +27 -0
- package/dist/packager-tool-vepqrsse.js +23 -0
- package/dist/packager-tool-w5ek334f.js +4892 -0
- package/dist/{packager-tool-5arsyj36.js → packager-tool-yc4kw997.js} +4 -2
- package/dist/packager-tool.js +91 -5
- package/dist/project-artifacts-vhanbtw5.js +14 -0
- package/dist/{pt-BR-7XGDXRDJ-espnkgrj.js → pt-BR-7DYX2YPT-fqxqzqtf.js} +857 -845
- package/dist/{pt-BR-BXURWX4W-xzyndmrx.js → pt-BR-BXURWX4W-bwfcwhk1.js} +54 -54
- package/dist/{pt-TMVOOITK-myha14p9.js → pt-HTXGGX6Y-97t21dty.js} +857 -845
- package/dist/{pt-YI4VE4YQ-521681zf.js → pt-YI4VE4YQ-wdkn2dcf.js} +54 -54
- package/dist/resourcesSyncService-mrmmwaqr.js +683 -0
- package/dist/{ro-2VALF3S5-cdz5afkr.js → ro-KTNQ3MNU-y08n1x5g.js} +857 -845
- package/dist/{ro-RKXZUG7Z-pdztdafr.js → ro-RKXZUG7Z-nndrrsq7.js} +54 -54
- package/dist/{ru-GSCT4ARZ-qj8dm4dp.js → ru-GSCT4ARZ-1sa9wbr8.js} +1 -1
- package/dist/ru-WBLQ5B2U-8r3c7v6d.js +10 -0
- package/dist/strict-case-rules-303vjvas.js +377 -0
- package/dist/strict-sdd-audit-qdmc9e1y.js +1024 -0
- package/dist/tool.js +17 -18
- package/dist/{tr-AA6O2WSR-bj9n80k8.js → tr-AA6O2WSR-86ba4bdf.js} +54 -54
- package/dist/{tr-RIFCEXFH-hgkb4g8y.js → tr-XHSSPNK7-cmqyc4wd.js} +857 -845
- package/dist/trigger-enrichment-service-zdx4x92j.js +340 -0
- package/dist/{zh-CN-IP3FMXWM-1cfarhcp.js → zh-CN-2EHQT23P-mr63c4xz.js} +857 -845
- package/dist/{zh-CN-R2KLHXQV-x6gnk2n0.js → zh-CN-R2KLHXQV-agqr45ds.js} +54 -54
- package/dist/{zh-TW-AGIDXIPF-n6r6w7vy.js → zh-TW-MGZCE5BT-c4ekmrz9.js} +857 -845
- package/dist/{zh-TW-RJGCQANM-tt8j5wv2.js → zh-TW-RJGCQANM-w0x3qc1p.js} +54 -54
- package/package.json +2 -2
- package/dist/index-8bsngk9y.js +0 -247140
- package/dist/packager-tool-axcdppp9.js +0 -13607
- package/dist/ru-WBLQ5B2U-8xd4gpv2.js +0 -10
|
@@ -277,7 +277,8 @@ class ToolsFactoryRepository {
|
|
|
277
277
|
getProjectToolFactory(projectType) {
|
|
278
278
|
const factory = this.projectFactoryMap.get(projectType);
|
|
279
279
|
if (!factory) {
|
|
280
|
-
|
|
280
|
+
const known = [...this.projectFactoryMap.keys()].join(", ");
|
|
281
|
+
throw new Error(`Cannot pack project type '${projectType}': no packager is installed for it. ` + `Project types that can be packed: ${known || "none"}.`);
|
|
281
282
|
}
|
|
282
283
|
return factory;
|
|
283
284
|
}
|
|
@@ -1117,4 +1118,4 @@ I18nManager.registerTranslations("zu", zu);
|
|
|
1117
1118
|
I18nManager.setLocale("en");
|
|
1118
1119
|
export { ensureProjectId, NugetPackager, toolsFactoryRepository };
|
|
1119
1120
|
|
|
1120
|
-
//# debugId=
|
|
1121
|
+
//# debugId=EA96C0A2D58145DE64756E2164756E21
|
|
@@ -0,0 +1,546 @@
|
|
|
1
|
+
import {
|
|
2
|
+
fetchConnectorMetadata
|
|
3
|
+
} from "./packager-tool-rqvr63x5.js";
|
|
4
|
+
import {
|
|
5
|
+
fetchConnectorConnections,
|
|
6
|
+
lookupTypeCacheEntry
|
|
7
|
+
} from "./packager-tool-njzcfve1.js";
|
|
8
|
+
import {
|
|
9
|
+
ElementsApi,
|
|
10
|
+
assertActivityMetadataResolved,
|
|
11
|
+
buildInputMetadata,
|
|
12
|
+
createApiClient,
|
|
13
|
+
createConfiguredActivityClient,
|
|
14
|
+
extractMultipartParameters
|
|
15
|
+
} from "./packager-tool-mp59jtpm.js";
|
|
16
|
+
import {
|
|
17
|
+
addVarIdsToInputsOutputs,
|
|
18
|
+
buildErrorOutput
|
|
19
|
+
} from "./packager-tool-ajvse9r3.js";
|
|
20
|
+
import {
|
|
21
|
+
createConnectorBindings
|
|
22
|
+
} from "./packager-tool-0mj06yen.js";
|
|
23
|
+
import {
|
|
24
|
+
catchError
|
|
25
|
+
} from "./packager-tool-5ax2ywcg.js";
|
|
26
|
+
|
|
27
|
+
// src/services/connector-enrichment-service.ts
|
|
28
|
+
function parseEntryConfiguration(entry) {
|
|
29
|
+
if (!entry.configuration)
|
|
30
|
+
return {};
|
|
31
|
+
try {
|
|
32
|
+
return JSON.parse(entry.configuration);
|
|
33
|
+
} catch {
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async function fetchMetadataSafe(connectorKey, objectName, connectionId) {
|
|
38
|
+
const [err, result] = await catchError(fetchConnectorMetadata(connectorKey, objectName, connectionId));
|
|
39
|
+
return err ? undefined : result;
|
|
40
|
+
}
|
|
41
|
+
async function resolveActivityOperation(connectorKey, displayName, operation) {
|
|
42
|
+
const [apiError, api] = await catchError(createApiClient(ElementsApi));
|
|
43
|
+
if (apiError) {
|
|
44
|
+
return operation;
|
|
45
|
+
}
|
|
46
|
+
const [fetchError, activities] = await catchError(api.getActivities({ elementKey: connectorKey }));
|
|
47
|
+
if (fetchError) {
|
|
48
|
+
return operation;
|
|
49
|
+
}
|
|
50
|
+
if (!Array.isArray(activities)) {
|
|
51
|
+
return operation;
|
|
52
|
+
}
|
|
53
|
+
const list = activities;
|
|
54
|
+
if (operation) {
|
|
55
|
+
const match2 = list.find((a) => a.operation === operation && !a.isTrigger);
|
|
56
|
+
if (match2) {
|
|
57
|
+
return match2.name;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const match = list.find((a) => a.displayName === displayName && !a.isTrigger);
|
|
61
|
+
if (match) {
|
|
62
|
+
return match.name;
|
|
63
|
+
}
|
|
64
|
+
return operation;
|
|
65
|
+
}
|
|
66
|
+
async function fetchObjectSwaggerPath(connectorKey, objectName) {
|
|
67
|
+
const [apiError, api] = await catchError(createApiClient(ElementsApi));
|
|
68
|
+
if (apiError) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const [fetchError, swagger] = await catchError(api.getObjectSwagger({
|
|
72
|
+
elementKey: connectorKey,
|
|
73
|
+
objectName
|
|
74
|
+
}));
|
|
75
|
+
if (fetchError) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const [parseError, parsed] = catchError(() => typeof swagger === "string" ? JSON.parse(swagger) : swagger);
|
|
79
|
+
if (parseError || !parsed?.paths) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const pathKeys = Object.keys(parsed.paths).filter((k) => k.startsWith("/"));
|
|
83
|
+
return pathKeys[0];
|
|
84
|
+
}
|
|
85
|
+
async function fetchObjectMethodConfig(connectorKey, objectName, httpMethod) {
|
|
86
|
+
const [apiError, api] = await catchError(createApiClient(ElementsApi));
|
|
87
|
+
if (apiError) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const [fetchError, objects] = await catchError(api.getObjects({ elementKey: connectorKey }));
|
|
91
|
+
if (fetchError) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (!Array.isArray(objects)) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const match = objects.find((obj) => obj.name === objectName);
|
|
98
|
+
if (!match) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const metadata = match.metadata;
|
|
102
|
+
const method = httpMethod ?? "POST";
|
|
103
|
+
return metadata?.method?.[method];
|
|
104
|
+
}
|
|
105
|
+
async function buildActivityPropertyConfig(params) {
|
|
106
|
+
const { entry, uiPathActivityTypeId, connectionId } = params;
|
|
107
|
+
const instanceParameters = parseEntryConfiguration(entry);
|
|
108
|
+
const activityClient = await createConfiguredActivityClient({
|
|
109
|
+
instanceParameters,
|
|
110
|
+
connectionId
|
|
111
|
+
});
|
|
112
|
+
const { essentialConfiguration } = activityClient.getEssentialConfiguration();
|
|
113
|
+
assertActivityMetadataResolved(essentialConfiguration, connectionId);
|
|
114
|
+
const essentialConfig = { essentialConfiguration };
|
|
115
|
+
const multipartParams = extractMultipartParameters(params.objectMethodConfig?.parameters ?? []);
|
|
116
|
+
return {
|
|
117
|
+
...multipartParams.length > 0 ? { multipartParameters: multipartParams } : {},
|
|
118
|
+
configuration: `=jsonString:${JSON.stringify(essentialConfig)}`,
|
|
119
|
+
uiPathActivityTypeId,
|
|
120
|
+
errorState: { issues: [] }
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function buildInputMetadataFromParams(objectMethodConfig, resolvedOperation) {
|
|
124
|
+
const params = objectMethodConfig?.parameters ?? [];
|
|
125
|
+
const multipartParams = extractMultipartParameters(params);
|
|
126
|
+
return buildInputMetadata(multipartParams, resolvedOperation ?? "list") ?? undefined;
|
|
127
|
+
}
|
|
128
|
+
function extractFields(metadata) {
|
|
129
|
+
if (metadata.fields) {
|
|
130
|
+
return metadata.fields;
|
|
131
|
+
}
|
|
132
|
+
const extended = metadata;
|
|
133
|
+
if (extended.metadata?.fields) {
|
|
134
|
+
return extended.metadata.fields;
|
|
135
|
+
}
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
function normalizeFields(raw) {
|
|
139
|
+
if (Array.isArray(raw)) {
|
|
140
|
+
return raw;
|
|
141
|
+
}
|
|
142
|
+
return Object.values(raw);
|
|
143
|
+
}
|
|
144
|
+
var UNSAFE_KEYS = new Set(["__proto__", "constructor", "prototype"]);
|
|
145
|
+
function nestDottedKeys(flat) {
|
|
146
|
+
const result = {};
|
|
147
|
+
for (const [key, value] of Object.entries(flat)) {
|
|
148
|
+
const parts = key.split(".");
|
|
149
|
+
if (parts.some((p) => UNSAFE_KEYS.has(p)))
|
|
150
|
+
continue;
|
|
151
|
+
let current = result;
|
|
152
|
+
for (let i = 0;i < parts.length - 1; i++) {
|
|
153
|
+
if (!Object.hasOwn(current, parts[i]) || typeof current[parts[i]] !== "object" || current[parts[i]] === null) {
|
|
154
|
+
current[parts[i]] = {};
|
|
155
|
+
}
|
|
156
|
+
current = current[parts[i]];
|
|
157
|
+
}
|
|
158
|
+
current[parts[parts.length - 1]] = value;
|
|
159
|
+
}
|
|
160
|
+
return result;
|
|
161
|
+
}
|
|
162
|
+
function mapISFieldsToInputOutputs(metadata, httpMethod) {
|
|
163
|
+
const rawFields = extractFields(metadata);
|
|
164
|
+
if (!rawFields) {
|
|
165
|
+
return { inputs: [], outputs: [] };
|
|
166
|
+
}
|
|
167
|
+
const fields = normalizeFields(rawFields);
|
|
168
|
+
const method = httpMethod ?? "POST";
|
|
169
|
+
const requestFields = [];
|
|
170
|
+
const responseFields = [];
|
|
171
|
+
for (const field of fields) {
|
|
172
|
+
const methodConfig = field.method?.[method];
|
|
173
|
+
if (!methodConfig) {
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
if (methodConfig.request || methodConfig.requestCurated) {
|
|
177
|
+
requestFields.push(field);
|
|
178
|
+
}
|
|
179
|
+
if (methodConfig.response || methodConfig.responseCurated) {
|
|
180
|
+
responseFields.push(field);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
const inputs = [];
|
|
184
|
+
if (requestFields.length > 0) {
|
|
185
|
+
inputs.push({
|
|
186
|
+
name: "body",
|
|
187
|
+
type: "json",
|
|
188
|
+
target: "body",
|
|
189
|
+
body: {}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
const outputs = [];
|
|
193
|
+
if (responseFields.length > 0) {
|
|
194
|
+
const properties = {};
|
|
195
|
+
for (const f of responseFields) {
|
|
196
|
+
properties[f.name] = {
|
|
197
|
+
title: f.displayName,
|
|
198
|
+
type: f.type
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
outputs.push({
|
|
202
|
+
name: "response",
|
|
203
|
+
displayName: "Response",
|
|
204
|
+
type: "jsonSchema",
|
|
205
|
+
source: "=response",
|
|
206
|
+
_jsonSchema: {
|
|
207
|
+
$schema: "http://json-schema.org/draft-07/schema#",
|
|
208
|
+
type: "object",
|
|
209
|
+
properties,
|
|
210
|
+
definitions: {}
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
outputs.push(buildErrorOutput());
|
|
215
|
+
return { inputs, outputs };
|
|
216
|
+
}
|
|
217
|
+
function buildParameterInputs(objectMethodConfig, activityPropertyConfig) {
|
|
218
|
+
const inputs = [];
|
|
219
|
+
inputs.push({
|
|
220
|
+
name: "pathParameters",
|
|
221
|
+
type: "json",
|
|
222
|
+
target: "pathParameters",
|
|
223
|
+
body: {}
|
|
224
|
+
});
|
|
225
|
+
if (objectMethodConfig) {
|
|
226
|
+
const parameters = objectMethodConfig.parameters;
|
|
227
|
+
if (Array.isArray(parameters) && parameters.length > 0) {
|
|
228
|
+
for (const param of parameters) {
|
|
229
|
+
if (param.type === "query") {
|
|
230
|
+
inputs.push({
|
|
231
|
+
name: "queryParameters",
|
|
232
|
+
type: "json",
|
|
233
|
+
target: "queryParameters",
|
|
234
|
+
body: {}
|
|
235
|
+
});
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
if (activityPropertyConfig) {
|
|
242
|
+
const multipartParams = activityPropertyConfig.multipartParameters;
|
|
243
|
+
if (Array.isArray(multipartParams)) {
|
|
244
|
+
const hasFile = multipartParams.some((p) => p.dataType === "file");
|
|
245
|
+
if (hasFile) {
|
|
246
|
+
inputs.push({
|
|
247
|
+
name: "file",
|
|
248
|
+
type: "file",
|
|
249
|
+
target: "file"
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return inputs;
|
|
255
|
+
}
|
|
256
|
+
function httpMethodToOperationType(method) {
|
|
257
|
+
switch (method?.toUpperCase()) {
|
|
258
|
+
case "GET":
|
|
259
|
+
return "read";
|
|
260
|
+
case "POST":
|
|
261
|
+
return "create";
|
|
262
|
+
case "PUT":
|
|
263
|
+
return "replace";
|
|
264
|
+
case "PATCH":
|
|
265
|
+
return "update";
|
|
266
|
+
case "DELETE":
|
|
267
|
+
return "delete";
|
|
268
|
+
default:
|
|
269
|
+
return "";
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function buildConnectorContext(params) {
|
|
273
|
+
const {
|
|
274
|
+
config,
|
|
275
|
+
entry,
|
|
276
|
+
connectionBindingId,
|
|
277
|
+
folderKeyBindingId,
|
|
278
|
+
connectionId,
|
|
279
|
+
objectSwaggerPath,
|
|
280
|
+
connectorName,
|
|
281
|
+
activityPropertyConfig,
|
|
282
|
+
inputMetadata
|
|
283
|
+
} = params;
|
|
284
|
+
const context = [
|
|
285
|
+
{
|
|
286
|
+
name: "connectorKey",
|
|
287
|
+
value: config.connectorKey,
|
|
288
|
+
type: "string"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
name: "connection",
|
|
292
|
+
value: `=bindings.${connectionBindingId}`,
|
|
293
|
+
type: "string"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
name: "resourceKey",
|
|
297
|
+
value: connectionId,
|
|
298
|
+
type: "string"
|
|
299
|
+
}
|
|
300
|
+
];
|
|
301
|
+
if (folderKeyBindingId) {
|
|
302
|
+
context.push({
|
|
303
|
+
name: "folderKey",
|
|
304
|
+
value: `=bindings.${folderKeyBindingId}`,
|
|
305
|
+
type: "string"
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
if (config.objectName) {
|
|
309
|
+
context.push({
|
|
310
|
+
name: "objectName",
|
|
311
|
+
value: config.objectName,
|
|
312
|
+
type: "string"
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
if (config.httpMethod) {
|
|
316
|
+
context.push({
|
|
317
|
+
name: "method",
|
|
318
|
+
value: config.httpMethod,
|
|
319
|
+
type: "string"
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
if (objectSwaggerPath) {
|
|
323
|
+
context.push({
|
|
324
|
+
name: "path",
|
|
325
|
+
value: objectSwaggerPath,
|
|
326
|
+
type: "string"
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
const metadataBody = {
|
|
330
|
+
activityPropertyConfiguration: activityPropertyConfig ?? {},
|
|
331
|
+
activityMetadata: { activity: entry },
|
|
332
|
+
inputMetadata: inputMetadata ?? {},
|
|
333
|
+
telemetryData: {
|
|
334
|
+
connectorKey: config.connectorKey,
|
|
335
|
+
connectorName: connectorName ?? entry.displayName,
|
|
336
|
+
operationType: httpMethodToOperationType(config.httpMethod),
|
|
337
|
+
objectName: config.objectName ?? "",
|
|
338
|
+
objectDisplayName: entry.displayName,
|
|
339
|
+
primaryKeyName: ""
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
context.push({
|
|
343
|
+
name: "metadata",
|
|
344
|
+
type: "json",
|
|
345
|
+
body: metadataBody
|
|
346
|
+
});
|
|
347
|
+
return context;
|
|
348
|
+
}
|
|
349
|
+
async function extractFieldDefinitions(connectorKey, objectName, httpMethod, prefetched) {
|
|
350
|
+
const result = {};
|
|
351
|
+
if (!objectName)
|
|
352
|
+
return result;
|
|
353
|
+
const method = httpMethod ?? "POST";
|
|
354
|
+
const [metadata, methodConfig] = prefetched ? [prefetched.metadata, prefetched.methodConfig] : await Promise.all([
|
|
355
|
+
fetchMetadataSafe(connectorKey, objectName),
|
|
356
|
+
fetchObjectMethodConfig(connectorKey, objectName, method)
|
|
357
|
+
]);
|
|
358
|
+
if (metadata) {
|
|
359
|
+
const rawFields = extractFields(metadata);
|
|
360
|
+
if (rawFields) {
|
|
361
|
+
const fields = normalizeFields(rawFields);
|
|
362
|
+
const bodyDefs = {};
|
|
363
|
+
for (const field of fields) {
|
|
364
|
+
const mc = field.method?.[method];
|
|
365
|
+
if (!mc || !(mc.request || mc.requestCurated))
|
|
366
|
+
continue;
|
|
367
|
+
bodyDefs[field.name] = {
|
|
368
|
+
name: field.name,
|
|
369
|
+
displayName: field.displayName,
|
|
370
|
+
type: field.type,
|
|
371
|
+
required: mc.required ?? false,
|
|
372
|
+
...field.description && {
|
|
373
|
+
description: field.description
|
|
374
|
+
},
|
|
375
|
+
...field.enum?.length && { enum: field.enum },
|
|
376
|
+
...field.reference && {
|
|
377
|
+
reference: {
|
|
378
|
+
objectName: field.reference.objectName,
|
|
379
|
+
lookupValue: field.reference.lookupValue
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
if (Object.keys(bodyDefs).length > 0) {
|
|
385
|
+
result.body = bodyDefs;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
if (methodConfig) {
|
|
390
|
+
const parameters = methodConfig.parameters;
|
|
391
|
+
if (Array.isArray(parameters)) {
|
|
392
|
+
const pathDefs = {};
|
|
393
|
+
const queryDefs = {};
|
|
394
|
+
for (const param of parameters) {
|
|
395
|
+
const compact = {
|
|
396
|
+
name: param.name,
|
|
397
|
+
displayName: param.displayName ?? param.name,
|
|
398
|
+
type: param.dataType ?? "string",
|
|
399
|
+
required: !!param.required
|
|
400
|
+
};
|
|
401
|
+
if (param.type === "path") {
|
|
402
|
+
pathDefs[param.name] = compact;
|
|
403
|
+
} else if (param.type === "query") {
|
|
404
|
+
queryDefs[param.name] = compact;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
if (Object.keys(pathDefs).length > 0) {
|
|
408
|
+
result.pathParameters = pathDefs;
|
|
409
|
+
}
|
|
410
|
+
if (Object.keys(queryDefs).length > 0) {
|
|
411
|
+
result.queryParameters = queryDefs;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
return result;
|
|
416
|
+
}
|
|
417
|
+
async function enrichConnectorRegistryEntry(config, connectionId) {
|
|
418
|
+
if (!config.objectName || !config.httpMethod) {
|
|
419
|
+
return null;
|
|
420
|
+
}
|
|
421
|
+
const metadata = await fetchMetadataSafe(config.connectorKey, config.objectName, connectionId);
|
|
422
|
+
if (!metadata) {
|
|
423
|
+
return null;
|
|
424
|
+
}
|
|
425
|
+
const rawFields = extractFields(metadata);
|
|
426
|
+
if (!rawFields) {
|
|
427
|
+
return null;
|
|
428
|
+
}
|
|
429
|
+
const fields = normalizeFields(rawFields);
|
|
430
|
+
const method = config.httpMethod;
|
|
431
|
+
const inputFields = [];
|
|
432
|
+
const outputFields = [];
|
|
433
|
+
for (const field of fields) {
|
|
434
|
+
const methodInfo = field.method?.[method];
|
|
435
|
+
if (!methodInfo)
|
|
436
|
+
continue;
|
|
437
|
+
const compact = {
|
|
438
|
+
name: field.name,
|
|
439
|
+
displayName: field.displayName,
|
|
440
|
+
type: field.type,
|
|
441
|
+
required: methodInfo.required ?? false,
|
|
442
|
+
...field.description && { description: field.description },
|
|
443
|
+
...field.enum?.length && { enum: field.enum },
|
|
444
|
+
...field.reference && {
|
|
445
|
+
reference: {
|
|
446
|
+
objectName: field.reference.objectName,
|
|
447
|
+
lookupValue: field.reference.lookupValue
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
if (methodInfo.request || methodInfo.requestCurated) {
|
|
452
|
+
inputFields.push(compact);
|
|
453
|
+
}
|
|
454
|
+
if (methodInfo.response || methodInfo.responseCurated) {
|
|
455
|
+
outputFields.push({ ...compact, required: false });
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
return {
|
|
459
|
+
inputDefinition: { fields: inputFields },
|
|
460
|
+
outputDefinition: { fields: outputFields }
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
async function enrichConnectorActivity(activityTypeId, connectionId, indexType = "typecache-activities") {
|
|
464
|
+
const { entry, config } = await lookupTypeCacheEntry(activityTypeId, indexType);
|
|
465
|
+
const resolvedOperation = await resolveActivityOperation(config.connectorKey, entry.displayName, config.operation);
|
|
466
|
+
let inputs = [];
|
|
467
|
+
let outputs = [];
|
|
468
|
+
let objectSwaggerPath;
|
|
469
|
+
let inputMetadata;
|
|
470
|
+
let metadata;
|
|
471
|
+
let objectMethodConfig;
|
|
472
|
+
if (config.objectName) {
|
|
473
|
+
const [md, swaggerPath, mc] = await Promise.all([
|
|
474
|
+
fetchMetadataSafe(config.connectorKey, config.objectName),
|
|
475
|
+
fetchObjectSwaggerPath(config.connectorKey, config.objectName),
|
|
476
|
+
fetchObjectMethodConfig(config.connectorKey, config.objectName, config.httpMethod)
|
|
477
|
+
]);
|
|
478
|
+
metadata = md ?? undefined;
|
|
479
|
+
objectMethodConfig = mc ?? undefined;
|
|
480
|
+
if (metadata) {
|
|
481
|
+
const io = mapISFieldsToInputOutputs(metadata, config.httpMethod);
|
|
482
|
+
inputs = io.inputs;
|
|
483
|
+
outputs = io.outputs;
|
|
484
|
+
inputMetadata = buildInputMetadataFromParams(objectMethodConfig, resolvedOperation ?? config.operation);
|
|
485
|
+
}
|
|
486
|
+
objectSwaggerPath = swaggerPath;
|
|
487
|
+
}
|
|
488
|
+
const activityPropertyConfig = await buildActivityPropertyConfig({
|
|
489
|
+
entry,
|
|
490
|
+
config,
|
|
491
|
+
uiPathActivityTypeId: activityTypeId,
|
|
492
|
+
connectionId,
|
|
493
|
+
objectSwaggerPath,
|
|
494
|
+
objectMethodConfig
|
|
495
|
+
});
|
|
496
|
+
if (config.objectName) {
|
|
497
|
+
inputs = [
|
|
498
|
+
...inputs,
|
|
499
|
+
...buildParameterInputs(objectMethodConfig, activityPropertyConfig)
|
|
500
|
+
];
|
|
501
|
+
}
|
|
502
|
+
const connections = await fetchConnectorConnections(config.connectorKey);
|
|
503
|
+
const connection = connections.find((c) => c.id === connectionId);
|
|
504
|
+
if (!connection) {
|
|
505
|
+
throw new Error(`Connection "${connectionId}" not found for connector "${config.connectorKey}"`);
|
|
506
|
+
}
|
|
507
|
+
const folderKey = connection.folder?.key ?? undefined;
|
|
508
|
+
const connectorName = connection.connector?.name;
|
|
509
|
+
const [connectionBinding, folderKeyBinding] = createConnectorBindings(config.connectorKey, connectionId, folderKey);
|
|
510
|
+
const bindings = [connectionBinding];
|
|
511
|
+
if (folderKeyBinding) {
|
|
512
|
+
bindings.push(folderKeyBinding);
|
|
513
|
+
}
|
|
514
|
+
const context = buildConnectorContext({
|
|
515
|
+
config,
|
|
516
|
+
entry,
|
|
517
|
+
connectionBindingId: connectionBinding.id,
|
|
518
|
+
folderKeyBindingId: folderKeyBinding?.id,
|
|
519
|
+
connectionId,
|
|
520
|
+
objectSwaggerPath,
|
|
521
|
+
connectorName,
|
|
522
|
+
activityPropertyConfig,
|
|
523
|
+
inputMetadata
|
|
524
|
+
});
|
|
525
|
+
const { inputsWithVars, outputsWithVars } = addVarIdsToInputsOutputs({
|
|
526
|
+
inputs,
|
|
527
|
+
outputs
|
|
528
|
+
});
|
|
529
|
+
return {
|
|
530
|
+
entry,
|
|
531
|
+
config,
|
|
532
|
+
connectionId,
|
|
533
|
+
folderKey,
|
|
534
|
+
resolvedOperation,
|
|
535
|
+
context,
|
|
536
|
+
bindings,
|
|
537
|
+
inputs: inputsWithVars,
|
|
538
|
+
outputs: outputsWithVars,
|
|
539
|
+
_metadata: metadata,
|
|
540
|
+
_methodConfig: objectMethodConfig
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
export { parseEntryConfiguration, resolveActivityOperation, fetchObjectSwaggerPath, fetchObjectMethodConfig, extractFields, normalizeFields, UNSAFE_KEYS, nestDottedKeys, mapISFieldsToInputOutputs, buildParameterInputs, buildConnectorContext, extractFieldDefinitions, enrichConnectorRegistryEntry, enrichConnectorActivity };
|
|
545
|
+
|
|
546
|
+
//# debugId=F2D3B4FF2B4063C064756E2164756E21
|