@uipath/api-workflow-tool 0.1.10 → 0.1.12
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/index.js +9 -0
- package/dist/packager-tool.js +540 -0
- package/dist/tool.js +71 -276
- package/package.json +9 -9
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { Command } from "commander";
|
|
5
|
+
import { metadata, registerCommands } from "./tool.js";
|
|
6
|
+
var program = new Command;
|
|
7
|
+
program.name(metadata.commandPrefix).description(metadata.description).version(metadata.version);
|
|
8
|
+
await registerCommands(program);
|
|
9
|
+
program.parse(process.argv);
|
|
@@ -0,0 +1,540 @@
|
|
|
1
|
+
// ../packager/packager-tool-apiworkflow/src/i18n/index.ts
|
|
2
|
+
import { I18nManager } from "@uipath/solutionpackager-tool-core";
|
|
3
|
+
// ../packager/packager-tool-apiworkflow/src/i18n/locales/de.json
|
|
4
|
+
var de_default = {
|
|
5
|
+
toolApiworkflow: {
|
|
6
|
+
info: {
|
|
7
|
+
restoreNotRequired: "Restore operation is not required for API projects",
|
|
8
|
+
validateNotRequired: "Validate operation is not required for API projects",
|
|
9
|
+
disposing: "Disposing API Workflows Tool"
|
|
10
|
+
},
|
|
11
|
+
progress: {
|
|
12
|
+
copyingFiles: "Copying files...",
|
|
13
|
+
creatingOperateFile: "Creating operate.json file...",
|
|
14
|
+
creatingPackageDescriptor: "Creating package-descriptor.json file...",
|
|
15
|
+
creatingNugetPackage: "Creating NuGet package...",
|
|
16
|
+
packageCreatedSuccessfully: "Package created successfully"
|
|
17
|
+
},
|
|
18
|
+
success: {
|
|
19
|
+
done: "done"
|
|
20
|
+
},
|
|
21
|
+
errors: {
|
|
22
|
+
buildFailed: "An error occurred while building API project files",
|
|
23
|
+
packFailed: "An error occurred while packing API project"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// ../packager/packager-tool-apiworkflow/src/i18n/locales/en.ts
|
|
29
|
+
var en = {
|
|
30
|
+
toolApiworkflow: {
|
|
31
|
+
info: {
|
|
32
|
+
restoreNotRequired: "Restore operation is not required for API projects",
|
|
33
|
+
validateNotRequired: "Validate operation is not required for API projects",
|
|
34
|
+
disposing: "Disposing API Workflows Tool"
|
|
35
|
+
},
|
|
36
|
+
progress: {
|
|
37
|
+
copyingFiles: "Copying files...",
|
|
38
|
+
creatingOperateFile: "Creating operate.json file...",
|
|
39
|
+
creatingPackageDescriptor: "Creating package-descriptor.json file...",
|
|
40
|
+
creatingNugetPackage: "Creating NuGet package...",
|
|
41
|
+
packageCreatedSuccessfully: "Package created successfully"
|
|
42
|
+
},
|
|
43
|
+
success: {
|
|
44
|
+
done: "done"
|
|
45
|
+
},
|
|
46
|
+
errors: {
|
|
47
|
+
buildFailed: "An error occurred while building API project files",
|
|
48
|
+
packFailed: "An error occurred while packing API project"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
// ../packager/packager-tool-apiworkflow/src/i18n/locales/es.json
|
|
53
|
+
var es_default = {
|
|
54
|
+
toolApiworkflow: {
|
|
55
|
+
info: {
|
|
56
|
+
restoreNotRequired: "Restore operation is not required for API projects",
|
|
57
|
+
validateNotRequired: "Validate operation is not required for API projects",
|
|
58
|
+
disposing: "Disposing API Workflows Tool"
|
|
59
|
+
},
|
|
60
|
+
progress: {
|
|
61
|
+
copyingFiles: "Copying files...",
|
|
62
|
+
creatingOperateFile: "Creating operate.json file...",
|
|
63
|
+
creatingPackageDescriptor: "Creating package-descriptor.json file...",
|
|
64
|
+
creatingNugetPackage: "Creating NuGet package...",
|
|
65
|
+
packageCreatedSuccessfully: "Package created successfully"
|
|
66
|
+
},
|
|
67
|
+
success: {
|
|
68
|
+
done: "done"
|
|
69
|
+
},
|
|
70
|
+
errors: {
|
|
71
|
+
buildFailed: "An error occurred while building API project files",
|
|
72
|
+
packFailed: "An error occurred while packing API project"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
// ../packager/packager-tool-apiworkflow/src/i18n/locales/es-MX.json
|
|
77
|
+
var es_MX_default = {
|
|
78
|
+
toolApiworkflow: {
|
|
79
|
+
info: {
|
|
80
|
+
restoreNotRequired: "Restore operation is not required for API projects",
|
|
81
|
+
validateNotRequired: "Validate operation is not required for API projects",
|
|
82
|
+
disposing: "Disposing API Workflows Tool"
|
|
83
|
+
},
|
|
84
|
+
progress: {
|
|
85
|
+
copyingFiles: "Copying files...",
|
|
86
|
+
creatingOperateFile: "Creating operate.json file...",
|
|
87
|
+
creatingPackageDescriptor: "Creating package-descriptor.json file...",
|
|
88
|
+
creatingNugetPackage: "Creating NuGet package...",
|
|
89
|
+
packageCreatedSuccessfully: "Package created successfully"
|
|
90
|
+
},
|
|
91
|
+
success: {
|
|
92
|
+
done: "done"
|
|
93
|
+
},
|
|
94
|
+
errors: {
|
|
95
|
+
buildFailed: "An error occurred while building API project files",
|
|
96
|
+
packFailed: "An error occurred while packing API project"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
// ../packager/packager-tool-apiworkflow/src/i18n/locales/fr.json
|
|
101
|
+
var fr_default = {
|
|
102
|
+
toolApiworkflow: {
|
|
103
|
+
info: {
|
|
104
|
+
restoreNotRequired: "Restore operation is not required for API projects",
|
|
105
|
+
validateNotRequired: "Validate operation is not required for API projects",
|
|
106
|
+
disposing: "Disposing API Workflows Tool"
|
|
107
|
+
},
|
|
108
|
+
progress: {
|
|
109
|
+
copyingFiles: "Copying files...",
|
|
110
|
+
creatingOperateFile: "Creating operate.json file...",
|
|
111
|
+
creatingPackageDescriptor: "Creating package-descriptor.json file...",
|
|
112
|
+
creatingNugetPackage: "Creating NuGet package...",
|
|
113
|
+
packageCreatedSuccessfully: "Package created successfully"
|
|
114
|
+
},
|
|
115
|
+
success: {
|
|
116
|
+
done: "done"
|
|
117
|
+
},
|
|
118
|
+
errors: {
|
|
119
|
+
buildFailed: "An error occurred while building API project files",
|
|
120
|
+
packFailed: "An error occurred while packing API project"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
// ../packager/packager-tool-apiworkflow/src/i18n/locales/ja.json
|
|
125
|
+
var ja_default = {
|
|
126
|
+
toolApiworkflow: {
|
|
127
|
+
info: {
|
|
128
|
+
restoreNotRequired: "Restore operation is not required for API projects",
|
|
129
|
+
validateNotRequired: "Validate operation is not required for API projects",
|
|
130
|
+
disposing: "Disposing API Workflows Tool"
|
|
131
|
+
},
|
|
132
|
+
progress: {
|
|
133
|
+
copyingFiles: "Copying files...",
|
|
134
|
+
creatingOperateFile: "Creating operate.json file...",
|
|
135
|
+
creatingPackageDescriptor: "Creating package-descriptor.json file...",
|
|
136
|
+
creatingNugetPackage: "Creating NuGet package...",
|
|
137
|
+
packageCreatedSuccessfully: "Package created successfully"
|
|
138
|
+
},
|
|
139
|
+
success: {
|
|
140
|
+
done: "done"
|
|
141
|
+
},
|
|
142
|
+
errors: {
|
|
143
|
+
buildFailed: "An error occurred while building API project files",
|
|
144
|
+
packFailed: "An error occurred while packing API project"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
// ../packager/packager-tool-apiworkflow/src/i18n/locales/ko.json
|
|
149
|
+
var ko_default = {
|
|
150
|
+
toolApiworkflow: {
|
|
151
|
+
info: {
|
|
152
|
+
restoreNotRequired: "Restore operation is not required for API projects",
|
|
153
|
+
validateNotRequired: "Validate operation is not required for API projects",
|
|
154
|
+
disposing: "Disposing API Workflows Tool"
|
|
155
|
+
},
|
|
156
|
+
progress: {
|
|
157
|
+
copyingFiles: "Copying files...",
|
|
158
|
+
creatingOperateFile: "Creating operate.json file...",
|
|
159
|
+
creatingPackageDescriptor: "Creating package-descriptor.json file...",
|
|
160
|
+
creatingNugetPackage: "Creating NuGet package...",
|
|
161
|
+
packageCreatedSuccessfully: "Package created successfully"
|
|
162
|
+
},
|
|
163
|
+
success: {
|
|
164
|
+
done: "done"
|
|
165
|
+
},
|
|
166
|
+
errors: {
|
|
167
|
+
buildFailed: "An error occurred while building API project files",
|
|
168
|
+
packFailed: "An error occurred while packing API project"
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
// ../packager/packager-tool-apiworkflow/src/i18n/locales/pt.json
|
|
173
|
+
var pt_default = {
|
|
174
|
+
toolApiworkflow: {
|
|
175
|
+
info: {
|
|
176
|
+
restoreNotRequired: "Restore operation is not required for API projects",
|
|
177
|
+
validateNotRequired: "Validate operation is not required for API projects",
|
|
178
|
+
disposing: "Disposing API Workflows Tool"
|
|
179
|
+
},
|
|
180
|
+
progress: {
|
|
181
|
+
copyingFiles: "Copying files...",
|
|
182
|
+
creatingOperateFile: "Creating operate.json file...",
|
|
183
|
+
creatingPackageDescriptor: "Creating package-descriptor.json file...",
|
|
184
|
+
creatingNugetPackage: "Creating NuGet package...",
|
|
185
|
+
packageCreatedSuccessfully: "Package created successfully"
|
|
186
|
+
},
|
|
187
|
+
success: {
|
|
188
|
+
done: "done"
|
|
189
|
+
},
|
|
190
|
+
errors: {
|
|
191
|
+
buildFailed: "An error occurred while building API project files",
|
|
192
|
+
packFailed: "An error occurred while packing API project"
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
// ../packager/packager-tool-apiworkflow/src/i18n/locales/pt-BR.json
|
|
197
|
+
var pt_BR_default = {
|
|
198
|
+
toolApiworkflow: {
|
|
199
|
+
info: {
|
|
200
|
+
restoreNotRequired: "Restore operation is not required for API projects",
|
|
201
|
+
validateNotRequired: "Validate operation is not required for API projects",
|
|
202
|
+
disposing: "Disposing API Workflows Tool"
|
|
203
|
+
},
|
|
204
|
+
progress: {
|
|
205
|
+
copyingFiles: "Copying files...",
|
|
206
|
+
creatingOperateFile: "Creating operate.json file...",
|
|
207
|
+
creatingPackageDescriptor: "Creating package-descriptor.json file...",
|
|
208
|
+
creatingNugetPackage: "Creating NuGet package...",
|
|
209
|
+
packageCreatedSuccessfully: "Package created successfully"
|
|
210
|
+
},
|
|
211
|
+
success: {
|
|
212
|
+
done: "done"
|
|
213
|
+
},
|
|
214
|
+
errors: {
|
|
215
|
+
buildFailed: "An error occurred while building API project files",
|
|
216
|
+
packFailed: "An error occurred while packing API project"
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
// ../packager/packager-tool-apiworkflow/src/i18n/locales/ro.json
|
|
221
|
+
var ro_default = {
|
|
222
|
+
toolApiworkflow: {
|
|
223
|
+
info: {
|
|
224
|
+
restoreNotRequired: "Restore operation is not required for API projects",
|
|
225
|
+
validateNotRequired: "Validate operation is not required for API projects",
|
|
226
|
+
disposing: "Disposing API Workflows Tool"
|
|
227
|
+
},
|
|
228
|
+
progress: {
|
|
229
|
+
copyingFiles: "Copying files...",
|
|
230
|
+
creatingOperateFile: "Creating operate.json file...",
|
|
231
|
+
creatingPackageDescriptor: "Creating package-descriptor.json file...",
|
|
232
|
+
creatingNugetPackage: "Creating NuGet package...",
|
|
233
|
+
packageCreatedSuccessfully: "Package created successfully"
|
|
234
|
+
},
|
|
235
|
+
success: {
|
|
236
|
+
done: "done"
|
|
237
|
+
},
|
|
238
|
+
errors: {
|
|
239
|
+
buildFailed: "An error occurred while building API project files",
|
|
240
|
+
packFailed: "An error occurred while packing API project"
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
// ../packager/packager-tool-apiworkflow/src/i18n/locales/ru.json
|
|
245
|
+
var ru_default = {
|
|
246
|
+
toolApiworkflow: {
|
|
247
|
+
info: {
|
|
248
|
+
restoreNotRequired: "Restore operation is not required for API projects",
|
|
249
|
+
validateNotRequired: "Validate operation is not required for API projects",
|
|
250
|
+
disposing: "Disposing API Workflows Tool"
|
|
251
|
+
},
|
|
252
|
+
progress: {
|
|
253
|
+
copyingFiles: "Copying files...",
|
|
254
|
+
creatingOperateFile: "Creating operate.json file...",
|
|
255
|
+
creatingPackageDescriptor: "Creating package-descriptor.json file...",
|
|
256
|
+
creatingNugetPackage: "Creating NuGet package...",
|
|
257
|
+
packageCreatedSuccessfully: "Package created successfully"
|
|
258
|
+
},
|
|
259
|
+
success: {
|
|
260
|
+
done: "done"
|
|
261
|
+
},
|
|
262
|
+
errors: {
|
|
263
|
+
buildFailed: "An error occurred while building API project files",
|
|
264
|
+
packFailed: "An error occurred while packing API project"
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
// ../packager/packager-tool-apiworkflow/src/i18n/locales/tr.json
|
|
269
|
+
var tr_default = {
|
|
270
|
+
toolApiworkflow: {
|
|
271
|
+
info: {
|
|
272
|
+
restoreNotRequired: "Restore operation is not required for API projects",
|
|
273
|
+
validateNotRequired: "Validate operation is not required for API projects",
|
|
274
|
+
disposing: "Disposing API Workflows Tool"
|
|
275
|
+
},
|
|
276
|
+
progress: {
|
|
277
|
+
copyingFiles: "Copying files...",
|
|
278
|
+
creatingOperateFile: "Creating operate.json file...",
|
|
279
|
+
creatingPackageDescriptor: "Creating package-descriptor.json file...",
|
|
280
|
+
creatingNugetPackage: "Creating NuGet package...",
|
|
281
|
+
packageCreatedSuccessfully: "Package created successfully"
|
|
282
|
+
},
|
|
283
|
+
success: {
|
|
284
|
+
done: "done"
|
|
285
|
+
},
|
|
286
|
+
errors: {
|
|
287
|
+
buildFailed: "An error occurred while building API project files",
|
|
288
|
+
packFailed: "An error occurred while packing API project"
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
// ../packager/packager-tool-apiworkflow/src/i18n/locales/zh-CN.json
|
|
293
|
+
var zh_CN_default = {
|
|
294
|
+
toolApiworkflow: {
|
|
295
|
+
info: {
|
|
296
|
+
restoreNotRequired: "Restore operation is not required for API projects",
|
|
297
|
+
validateNotRequired: "Validate operation is not required for API projects",
|
|
298
|
+
disposing: "Disposing API Workflows Tool"
|
|
299
|
+
},
|
|
300
|
+
progress: {
|
|
301
|
+
copyingFiles: "Copying files...",
|
|
302
|
+
creatingOperateFile: "Creating operate.json file...",
|
|
303
|
+
creatingPackageDescriptor: "Creating package-descriptor.json file...",
|
|
304
|
+
creatingNugetPackage: "Creating NuGet package...",
|
|
305
|
+
packageCreatedSuccessfully: "Package created successfully"
|
|
306
|
+
},
|
|
307
|
+
success: {
|
|
308
|
+
done: "done"
|
|
309
|
+
},
|
|
310
|
+
errors: {
|
|
311
|
+
buildFailed: "An error occurred while building API project files",
|
|
312
|
+
packFailed: "An error occurred while packing API project"
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
// ../packager/packager-tool-apiworkflow/src/i18n/locales/zh-TW.json
|
|
317
|
+
var zh_TW_default = {
|
|
318
|
+
toolApiworkflow: {
|
|
319
|
+
info: {
|
|
320
|
+
restoreNotRequired: "Restore operation is not required for API projects",
|
|
321
|
+
validateNotRequired: "Validate operation is not required for API projects",
|
|
322
|
+
disposing: "Disposing API Workflows Tool"
|
|
323
|
+
},
|
|
324
|
+
progress: {
|
|
325
|
+
copyingFiles: "Copying files...",
|
|
326
|
+
creatingOperateFile: "Creating operate.json file...",
|
|
327
|
+
creatingPackageDescriptor: "Creating package-descriptor.json file...",
|
|
328
|
+
creatingNugetPackage: "Creating NuGet package...",
|
|
329
|
+
packageCreatedSuccessfully: "Package created successfully"
|
|
330
|
+
},
|
|
331
|
+
success: {
|
|
332
|
+
done: "done"
|
|
333
|
+
},
|
|
334
|
+
errors: {
|
|
335
|
+
buildFailed: "An error occurred while building API project files",
|
|
336
|
+
packFailed: "An error occurred while packing API project"
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
// ../packager/packager-tool-apiworkflow/src/i18n/locales/zu.json
|
|
341
|
+
var zu_default = {
|
|
342
|
+
toolApiworkflow: {
|
|
343
|
+
info: {
|
|
344
|
+
restoreNotRequired: "Restore operation is not required for API projects",
|
|
345
|
+
validateNotRequired: "Validate operation is not required for API projects",
|
|
346
|
+
disposing: "Disposing API Workflows Tool"
|
|
347
|
+
},
|
|
348
|
+
progress: {
|
|
349
|
+
copyingFiles: "Copying files...",
|
|
350
|
+
creatingOperateFile: "Creating operate.json file...",
|
|
351
|
+
creatingPackageDescriptor: "Creating package-descriptor.json file...",
|
|
352
|
+
creatingNugetPackage: "Creating NuGet package...",
|
|
353
|
+
packageCreatedSuccessfully: "Package created successfully"
|
|
354
|
+
},
|
|
355
|
+
success: {
|
|
356
|
+
done: "done"
|
|
357
|
+
},
|
|
358
|
+
errors: {
|
|
359
|
+
buildFailed: "An error occurred while building API project files",
|
|
360
|
+
packFailed: "An error occurred while packing API project"
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
// ../packager/packager-tool-apiworkflow/src/i18n/index.ts
|
|
366
|
+
I18nManager.registerTranslations("en", en);
|
|
367
|
+
I18nManager.registerTranslations("de", de_default);
|
|
368
|
+
I18nManager.registerTranslations("es", es_default);
|
|
369
|
+
I18nManager.registerTranslations("es-MX", es_MX_default);
|
|
370
|
+
I18nManager.registerTranslations("fr", fr_default);
|
|
371
|
+
I18nManager.registerTranslations("ja", ja_default);
|
|
372
|
+
I18nManager.registerTranslations("ko", ko_default);
|
|
373
|
+
I18nManager.registerTranslations("pt", pt_default);
|
|
374
|
+
I18nManager.registerTranslations("pt-BR", pt_BR_default);
|
|
375
|
+
I18nManager.registerTranslations("ro", ro_default);
|
|
376
|
+
I18nManager.registerTranslations("ru", ru_default);
|
|
377
|
+
I18nManager.registerTranslations("tr", tr_default);
|
|
378
|
+
I18nManager.registerTranslations("zh-CN", zh_CN_default);
|
|
379
|
+
I18nManager.registerTranslations("zh-TW", zh_TW_default);
|
|
380
|
+
I18nManager.registerTranslations("zu", zu_default);
|
|
381
|
+
|
|
382
|
+
// ../packager/packager-tool-apiworkflow/src/index.ts
|
|
383
|
+
import { toolsFactoryRepository } from "@uipath/solutionpackager-tool-core";
|
|
384
|
+
|
|
385
|
+
// ../packager/packager-tool-apiworkflow/src/api-workflow-tool-factory.ts
|
|
386
|
+
import {
|
|
387
|
+
ProjectTypes as ProjectTypes2
|
|
388
|
+
} from "@uipath/solutionpackager-tool-core";
|
|
389
|
+
|
|
390
|
+
// ../packager/packager-tool-apiworkflow/src/api-workflows-tool.ts
|
|
391
|
+
import {
|
|
392
|
+
NugetConstants,
|
|
393
|
+
NugetPackager,
|
|
394
|
+
Path,
|
|
395
|
+
ProjectTool,
|
|
396
|
+
ProjectTypes,
|
|
397
|
+
TemporaryStorageService,
|
|
398
|
+
ToolErrorCodes,
|
|
399
|
+
ToolResult,
|
|
400
|
+
translate
|
|
401
|
+
} from "@uipath/solutionpackager-tool-core";
|
|
402
|
+
|
|
403
|
+
class ApiWorkflowsTool extends ProjectTool {
|
|
404
|
+
_temporaryStorage;
|
|
405
|
+
constructor(fileSystem, logger) {
|
|
406
|
+
super(fileSystem, logger);
|
|
407
|
+
this._temporaryStorage = new TemporaryStorageService(fileSystem);
|
|
408
|
+
}
|
|
409
|
+
async restoreAsync(_options, _cancellationToken) {
|
|
410
|
+
this.logger.info(translate.t("toolApiworkflow.info.restoreNotRequired"));
|
|
411
|
+
return ToolResult.success();
|
|
412
|
+
}
|
|
413
|
+
async validateAsync(_options, _cancellationToken) {
|
|
414
|
+
this.logger.info(translate.t("toolApiworkflow.info.validateNotRequired"));
|
|
415
|
+
return ToolResult.success();
|
|
416
|
+
}
|
|
417
|
+
async buildAsync(options, _cancellationToken) {
|
|
418
|
+
const tempFolder = await this._temporaryStorage.getTempFolderPath();
|
|
419
|
+
const localBuildFolder = Path.join(tempFolder, NugetConstants.OutputFolderName);
|
|
420
|
+
const contentFolder = Path.join(localBuildFolder, NugetConstants.ContentFolderName);
|
|
421
|
+
try {
|
|
422
|
+
this.logger.progress(translate.t("toolApiworkflow.progress.copyingFiles"));
|
|
423
|
+
await this.copyFiles(options.projectPath, contentFolder);
|
|
424
|
+
this.logger.progress(translate.t("toolApiworkflow.progress.creatingOperateFile"));
|
|
425
|
+
await this.createOperateFile(options, contentFolder);
|
|
426
|
+
this.logger.progress(translate.t("toolApiworkflow.progress.creatingPackageDescriptor"));
|
|
427
|
+
await this.createPackageDescriptor(localBuildFolder);
|
|
428
|
+
return new ToolResult(ToolErrorCodes.Success, translate.t("toolApiworkflow.success.done"), [localBuildFolder]);
|
|
429
|
+
} catch (error) {
|
|
430
|
+
const errorMessage = error instanceof Error ? error.toString() : String(error);
|
|
431
|
+
this.logger.error(errorMessage);
|
|
432
|
+
return ToolResult.error(ToolErrorCodes.InternalError, translate.t("toolApiworkflow.errors.buildFailed"));
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
async packAsync(options, cancellationToken) {
|
|
436
|
+
const buildResult = await this.buildAsync(options, cancellationToken);
|
|
437
|
+
if (!buildResult.isSuccess) {
|
|
438
|
+
return buildResult;
|
|
439
|
+
}
|
|
440
|
+
const localBuildFolder = buildResult.packages[0];
|
|
441
|
+
try {
|
|
442
|
+
this.logger.progress(translate.t("toolApiworkflow.progress.creatingNugetPackage"));
|
|
443
|
+
const nupkgFileName = `${options.package.id}.${options.package.version}.nupkg`;
|
|
444
|
+
const nupkgPath = Path.join(options.outputPath, nupkgFileName);
|
|
445
|
+
const packager = new NugetPackager(this.fileSystem);
|
|
446
|
+
const result = await packager.packAsync(localBuildFolder, options.package, nupkgPath);
|
|
447
|
+
this.logger.progress(translate.t("toolApiworkflow.progress.packageCreatedSuccessfully"));
|
|
448
|
+
return new ToolResult(ToolErrorCodes.Success, translate.t("toolApiworkflow.success.done"), [result.outputPath]);
|
|
449
|
+
} catch (error) {
|
|
450
|
+
const errorMessage = error instanceof Error ? error.toString() : String(error);
|
|
451
|
+
this.logger.error(errorMessage);
|
|
452
|
+
return ToolResult.error(ToolErrorCodes.InternalError, translate.t("toolApiworkflow.errors.packFailed"));
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
async dispose() {
|
|
456
|
+
this.logger.info(translate.t("toolApiworkflow.info.disposing"));
|
|
457
|
+
try {
|
|
458
|
+
await this._temporaryStorage.cleanup();
|
|
459
|
+
} catch {}
|
|
460
|
+
}
|
|
461
|
+
async copyFiles(sourcePath, destinationPath) {
|
|
462
|
+
await this.fileSystem.mkdir(destinationPath);
|
|
463
|
+
const files = await this.fileSystem.readdir(sourcePath);
|
|
464
|
+
for (const file of files) {
|
|
465
|
+
const sourceFile = Path.join(sourcePath, file);
|
|
466
|
+
const destinationFile = Path.join(destinationPath, file);
|
|
467
|
+
const stat = await this.fileSystem.stat(sourceFile);
|
|
468
|
+
if (stat?.isFile()) {
|
|
469
|
+
const content = await this.fileSystem.readFile(sourceFile);
|
|
470
|
+
if (content) {
|
|
471
|
+
await this.fileSystem.writeFile(destinationFile, content);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
async createOperateFile(options, contentFolder) {
|
|
477
|
+
const operateJsonFilePath = Path.join(contentFolder, NugetConstants.OperateFileName);
|
|
478
|
+
const exists = await this.fileSystem.exists(operateJsonFilePath);
|
|
479
|
+
if (!exists) {
|
|
480
|
+
await this.createOperateJsonFile(contentFolder, options.projectStorageId ?? "", operateJsonFilePath);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
async createOperateJsonFile(projectPath, projectId, filePath) {
|
|
484
|
+
const entryPointsFilePath = Path.join(projectPath, NugetConstants.EntryPointsFileName);
|
|
485
|
+
let mainPath = "";
|
|
486
|
+
const entryPointsExists = await this.fileSystem.exists(entryPointsFilePath);
|
|
487
|
+
if (entryPointsExists) {
|
|
488
|
+
const entryPointsContent = await this.fileSystem.readFile(entryPointsFilePath);
|
|
489
|
+
if (entryPointsContent) {
|
|
490
|
+
try {
|
|
491
|
+
const entryPointsText = new TextDecoder().decode(entryPointsContent);
|
|
492
|
+
const entryPoints = JSON.parse(entryPointsText);
|
|
493
|
+
mainPath = entryPoints.entryPoints?.[0]?.filePath ?? "";
|
|
494
|
+
} catch {}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
const operateFileModel = {
|
|
498
|
+
$schema: "https://cloud.uipath.com/draft/2024-12/operate",
|
|
499
|
+
contentType: ProjectTypes.Api,
|
|
500
|
+
projectId,
|
|
501
|
+
main: mainPath,
|
|
502
|
+
targetFramework: "Portable",
|
|
503
|
+
runtimeOptions: {
|
|
504
|
+
isAttended: false,
|
|
505
|
+
requiresUserInteraction: false
|
|
506
|
+
}
|
|
507
|
+
};
|
|
508
|
+
const operateJsonString = JSON.stringify(operateFileModel, null, 2);
|
|
509
|
+
await this.fileSystem.writeFile(filePath, operateJsonString);
|
|
510
|
+
}
|
|
511
|
+
async createPackageDescriptor(localBuildFolder) {
|
|
512
|
+
const packageDescriptor = {
|
|
513
|
+
files: {}
|
|
514
|
+
};
|
|
515
|
+
this.addFileIfExists(packageDescriptor, localBuildFolder, NugetConstants.OperateFileName, NugetConstants.OperateFileName);
|
|
516
|
+
this.addFileIfExists(packageDescriptor, localBuildFolder, NugetConstants.EntryPointsFileName, NugetConstants.EntryPointsFileName);
|
|
517
|
+
this.addFileIfExists(packageDescriptor, localBuildFolder, NugetConstants.BindingsFileId, NugetConstants.BindingsV2FileName);
|
|
518
|
+
const packageDescriptorPath = Path.join(localBuildFolder, NugetConstants.ContentFolderName, NugetConstants.PackageDescriptorFileName);
|
|
519
|
+
const packageDescriptorJson = JSON.stringify({
|
|
520
|
+
$schema: "https://cloud.uipath.com/draft/2024-12/package-descriptor",
|
|
521
|
+
...packageDescriptor
|
|
522
|
+
}, null, 2);
|
|
523
|
+
await this.fileSystem.writeFile(packageDescriptorPath, packageDescriptorJson);
|
|
524
|
+
}
|
|
525
|
+
addFileIfExists(packageDescriptor, _rootFolder, key, fileName) {
|
|
526
|
+
const relativePath = Path.join(NugetConstants.ContentFolderName, fileName);
|
|
527
|
+
packageDescriptor.files[key] = relativePath;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// ../packager/packager-tool-apiworkflow/src/api-workflow-tool-factory.ts
|
|
532
|
+
class ApiWorkflowToolFactory {
|
|
533
|
+
supportedTypes = [ProjectTypes2.Api];
|
|
534
|
+
async createAsync(logger, fileSystem) {
|
|
535
|
+
return new ApiWorkflowsTool(fileSystem, logger);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
// ../packager/packager-tool-apiworkflow/src/index.ts
|
|
540
|
+
toolsFactoryRepository.registerProjectToolFactory(new ApiWorkflowToolFactory);
|
package/dist/tool.js
CHANGED
|
@@ -22209,239 +22209,24 @@ var require_dist2 = __commonJS((exports) => {
|
|
|
22209
22209
|
} });
|
|
22210
22210
|
});
|
|
22211
22211
|
|
|
22212
|
-
//
|
|
22213
|
-
import
|
|
22214
|
-
var de_namespaceObject = JSON.parse('{"toolApiworkflow":{"info":{"restoreNotRequired":"Restore operation is not required for API projects","validateNotRequired":"Validate operation is not required for API projects","disposing":"Disposing API Workflows Tool"},"progress":{"copyingFiles":"Copying files...","creatingOperateFile":"Creating operate.json file...","creatingPackageDescriptor":"Creating package-descriptor.json file...","creatingNugetPackage":"Creating NuGet package...","packageCreatedSuccessfully":"Package created successfully"},"success":{"done":"done"},"errors":{"buildFailed":"An error occurred while building API project files","packFailed":"An error occurred while packing API project"}}}');
|
|
22215
|
-
var en = {
|
|
22216
|
-
toolApiworkflow: {
|
|
22217
|
-
info: {
|
|
22218
|
-
restoreNotRequired: "Restore operation is not required for API projects",
|
|
22219
|
-
validateNotRequired: "Validate operation is not required for API projects",
|
|
22220
|
-
disposing: "Disposing API Workflows Tool"
|
|
22221
|
-
},
|
|
22222
|
-
progress: {
|
|
22223
|
-
copyingFiles: "Copying files...",
|
|
22224
|
-
creatingOperateFile: "Creating operate.json file...",
|
|
22225
|
-
creatingPackageDescriptor: "Creating package-descriptor.json file...",
|
|
22226
|
-
creatingNugetPackage: "Creating NuGet package...",
|
|
22227
|
-
packageCreatedSuccessfully: "Package created successfully"
|
|
22228
|
-
},
|
|
22229
|
-
success: {
|
|
22230
|
-
done: "done"
|
|
22231
|
-
},
|
|
22232
|
-
errors: {
|
|
22233
|
-
buildFailed: "An error occurred while building API project files",
|
|
22234
|
-
packFailed: "An error occurred while packing API project"
|
|
22235
|
-
}
|
|
22236
|
-
}
|
|
22237
|
-
};
|
|
22238
|
-
var es_namespaceObject = JSON.parse('{"toolApiworkflow":{"info":{"restoreNotRequired":"Restore operation is not required for API projects","validateNotRequired":"Validate operation is not required for API projects","disposing":"Disposing API Workflows Tool"},"progress":{"copyingFiles":"Copying files...","creatingOperateFile":"Creating operate.json file...","creatingPackageDescriptor":"Creating package-descriptor.json file...","creatingNugetPackage":"Creating NuGet package...","packageCreatedSuccessfully":"Package created successfully"},"success":{"done":"done"},"errors":{"buildFailed":"An error occurred while building API project files","packFailed":"An error occurred while packing API project"}}}');
|
|
22239
|
-
var es_MX_namespaceObject = JSON.parse('{"toolApiworkflow":{"info":{"restoreNotRequired":"Restore operation is not required for API projects","validateNotRequired":"Validate operation is not required for API projects","disposing":"Disposing API Workflows Tool"},"progress":{"copyingFiles":"Copying files...","creatingOperateFile":"Creating operate.json file...","creatingPackageDescriptor":"Creating package-descriptor.json file...","creatingNugetPackage":"Creating NuGet package...","packageCreatedSuccessfully":"Package created successfully"},"success":{"done":"done"},"errors":{"buildFailed":"An error occurred while building API project files","packFailed":"An error occurred while packing API project"}}}');
|
|
22240
|
-
var fr_namespaceObject = JSON.parse('{"toolApiworkflow":{"info":{"restoreNotRequired":"Restore operation is not required for API projects","validateNotRequired":"Validate operation is not required for API projects","disposing":"Disposing API Workflows Tool"},"progress":{"copyingFiles":"Copying files...","creatingOperateFile":"Creating operate.json file...","creatingPackageDescriptor":"Creating package-descriptor.json file...","creatingNugetPackage":"Creating NuGet package...","packageCreatedSuccessfully":"Package created successfully"},"success":{"done":"done"},"errors":{"buildFailed":"An error occurred while building API project files","packFailed":"An error occurred while packing API project"}}}');
|
|
22241
|
-
var ja_namespaceObject = JSON.parse('{"toolApiworkflow":{"info":{"restoreNotRequired":"Restore operation is not required for API projects","validateNotRequired":"Validate operation is not required for API projects","disposing":"Disposing API Workflows Tool"},"progress":{"copyingFiles":"Copying files...","creatingOperateFile":"Creating operate.json file...","creatingPackageDescriptor":"Creating package-descriptor.json file...","creatingNugetPackage":"Creating NuGet package...","packageCreatedSuccessfully":"Package created successfully"},"success":{"done":"done"},"errors":{"buildFailed":"An error occurred while building API project files","packFailed":"An error occurred while packing API project"}}}');
|
|
22242
|
-
var ko_namespaceObject = JSON.parse('{"toolApiworkflow":{"info":{"restoreNotRequired":"Restore operation is not required for API projects","validateNotRequired":"Validate operation is not required for API projects","disposing":"Disposing API Workflows Tool"},"progress":{"copyingFiles":"Copying files...","creatingOperateFile":"Creating operate.json file...","creatingPackageDescriptor":"Creating package-descriptor.json file...","creatingNugetPackage":"Creating NuGet package...","packageCreatedSuccessfully":"Package created successfully"},"success":{"done":"done"},"errors":{"buildFailed":"An error occurred while building API project files","packFailed":"An error occurred while packing API project"}}}');
|
|
22243
|
-
var pt_namespaceObject = JSON.parse('{"toolApiworkflow":{"info":{"restoreNotRequired":"Restore operation is not required for API projects","validateNotRequired":"Validate operation is not required for API projects","disposing":"Disposing API Workflows Tool"},"progress":{"copyingFiles":"Copying files...","creatingOperateFile":"Creating operate.json file...","creatingPackageDescriptor":"Creating package-descriptor.json file...","creatingNugetPackage":"Creating NuGet package...","packageCreatedSuccessfully":"Package created successfully"},"success":{"done":"done"},"errors":{"buildFailed":"An error occurred while building API project files","packFailed":"An error occurred while packing API project"}}}');
|
|
22244
|
-
var pt_BR_namespaceObject = JSON.parse('{"toolApiworkflow":{"info":{"restoreNotRequired":"Restore operation is not required for API projects","validateNotRequired":"Validate operation is not required for API projects","disposing":"Disposing API Workflows Tool"},"progress":{"copyingFiles":"Copying files...","creatingOperateFile":"Creating operate.json file...","creatingPackageDescriptor":"Creating package-descriptor.json file...","creatingNugetPackage":"Creating NuGet package...","packageCreatedSuccessfully":"Package created successfully"},"success":{"done":"done"},"errors":{"buildFailed":"An error occurred while building API project files","packFailed":"An error occurred while packing API project"}}}');
|
|
22245
|
-
var ro_namespaceObject = JSON.parse('{"toolApiworkflow":{"info":{"restoreNotRequired":"Restore operation is not required for API projects","validateNotRequired":"Validate operation is not required for API projects","disposing":"Disposing API Workflows Tool"},"progress":{"copyingFiles":"Copying files...","creatingOperateFile":"Creating operate.json file...","creatingPackageDescriptor":"Creating package-descriptor.json file...","creatingNugetPackage":"Creating NuGet package...","packageCreatedSuccessfully":"Package created successfully"},"success":{"done":"done"},"errors":{"buildFailed":"An error occurred while building API project files","packFailed":"An error occurred while packing API project"}}}');
|
|
22246
|
-
var ru_namespaceObject = JSON.parse('{"toolApiworkflow":{"info":{"restoreNotRequired":"Restore operation is not required for API projects","validateNotRequired":"Validate operation is not required for API projects","disposing":"Disposing API Workflows Tool"},"progress":{"copyingFiles":"Copying files...","creatingOperateFile":"Creating operate.json file...","creatingPackageDescriptor":"Creating package-descriptor.json file...","creatingNugetPackage":"Creating NuGet package...","packageCreatedSuccessfully":"Package created successfully"},"success":{"done":"done"},"errors":{"buildFailed":"An error occurred while building API project files","packFailed":"An error occurred while packing API project"}}}');
|
|
22247
|
-
var tr_namespaceObject = JSON.parse('{"toolApiworkflow":{"info":{"restoreNotRequired":"Restore operation is not required for API projects","validateNotRequired":"Validate operation is not required for API projects","disposing":"Disposing API Workflows Tool"},"progress":{"copyingFiles":"Copying files...","creatingOperateFile":"Creating operate.json file...","creatingPackageDescriptor":"Creating package-descriptor.json file...","creatingNugetPackage":"Creating NuGet package...","packageCreatedSuccessfully":"Package created successfully"},"success":{"done":"done"},"errors":{"buildFailed":"An error occurred while building API project files","packFailed":"An error occurred while packing API project"}}}');
|
|
22248
|
-
var zh_CN_namespaceObject = JSON.parse('{"toolApiworkflow":{"info":{"restoreNotRequired":"Restore operation is not required for API projects","validateNotRequired":"Validate operation is not required for API projects","disposing":"Disposing API Workflows Tool"},"progress":{"copyingFiles":"Copying files...","creatingOperateFile":"Creating operate.json file...","creatingPackageDescriptor":"Creating package-descriptor.json file...","creatingNugetPackage":"Creating NuGet package...","packageCreatedSuccessfully":"Package created successfully"},"success":{"done":"done"},"errors":{"buildFailed":"An error occurred while building API project files","packFailed":"An error occurred while packing API project"}}}');
|
|
22249
|
-
var zh_TW_namespaceObject = JSON.parse('{"toolApiworkflow":{"info":{"restoreNotRequired":"Restore operation is not required for API projects","validateNotRequired":"Validate operation is not required for API projects","disposing":"Disposing API Workflows Tool"},"progress":{"copyingFiles":"Copying files...","creatingOperateFile":"Creating operate.json file...","creatingPackageDescriptor":"Creating package-descriptor.json file...","creatingNugetPackage":"Creating NuGet package...","packageCreatedSuccessfully":"Package created successfully"},"success":{"done":"done"},"errors":{"buildFailed":"An error occurred while building API project files","packFailed":"An error occurred while packing API project"}}}');
|
|
22250
|
-
var zu_namespaceObject = JSON.parse('{"toolApiworkflow":{"info":{"restoreNotRequired":"Restore operation is not required for API projects","validateNotRequired":"Validate operation is not required for API projects","disposing":"Disposing API Workflows Tool"},"progress":{"copyingFiles":"Copying files...","creatingOperateFile":"Creating operate.json file...","creatingPackageDescriptor":"Creating package-descriptor.json file...","creatingNugetPackage":"Creating NuGet package...","packageCreatedSuccessfully":"Package created successfully"},"success":{"done":"done"},"errors":{"buildFailed":"An error occurred while building API project files","packFailed":"An error occurred while packing API project"}}}');
|
|
22251
|
-
I18nManager.registerTranslations("en", en);
|
|
22252
|
-
I18nManager.registerTranslations("de", de_namespaceObject);
|
|
22253
|
-
I18nManager.registerTranslations("es", es_namespaceObject);
|
|
22254
|
-
I18nManager.registerTranslations("es-MX", es_MX_namespaceObject);
|
|
22255
|
-
I18nManager.registerTranslations("fr", fr_namespaceObject);
|
|
22256
|
-
I18nManager.registerTranslations("ja", ja_namespaceObject);
|
|
22257
|
-
I18nManager.registerTranslations("ko", ko_namespaceObject);
|
|
22258
|
-
I18nManager.registerTranslations("pt", pt_namespaceObject);
|
|
22259
|
-
I18nManager.registerTranslations("pt-BR", pt_BR_namespaceObject);
|
|
22260
|
-
I18nManager.registerTranslations("ro", ro_namespaceObject);
|
|
22261
|
-
I18nManager.registerTranslations("ru", ru_namespaceObject);
|
|
22262
|
-
I18nManager.registerTranslations("tr", tr_namespaceObject);
|
|
22263
|
-
I18nManager.registerTranslations("zh-CN", zh_CN_namespaceObject);
|
|
22264
|
-
I18nManager.registerTranslations("zh-TW", zh_TW_namespaceObject);
|
|
22265
|
-
I18nManager.registerTranslations("zu", zu_namespaceObject);
|
|
22266
|
-
function _define_property(obj, key, value) {
|
|
22267
|
-
if (key in obj)
|
|
22268
|
-
Object.defineProperty(obj, key, {
|
|
22269
|
-
value,
|
|
22270
|
-
enumerable: true,
|
|
22271
|
-
configurable: true,
|
|
22272
|
-
writable: true
|
|
22273
|
-
});
|
|
22274
|
-
else
|
|
22275
|
-
obj[key] = value;
|
|
22276
|
-
return obj;
|
|
22277
|
-
}
|
|
22278
|
-
|
|
22279
|
-
class ApiWorkflowsTool extends ProjectTool {
|
|
22280
|
-
async restoreAsync(_options, _cancellationToken) {
|
|
22281
|
-
this.logger.info(translate.t("toolApiworkflow.info.restoreNotRequired"));
|
|
22282
|
-
return ToolResult.success();
|
|
22283
|
-
}
|
|
22284
|
-
async validateAsync(_options, _cancellationToken) {
|
|
22285
|
-
this.logger.info(translate.t("toolApiworkflow.info.validateNotRequired"));
|
|
22286
|
-
return ToolResult.success();
|
|
22287
|
-
}
|
|
22288
|
-
async buildAsync(options, _cancellationToken) {
|
|
22289
|
-
const tempFolder = await this._temporaryStorage.getTempFolderPath();
|
|
22290
|
-
const localBuildFolder = Path.join(tempFolder, NugetConstants.OutputFolderName);
|
|
22291
|
-
const contentFolder = Path.join(localBuildFolder, NugetConstants.ContentFolderName);
|
|
22292
|
-
try {
|
|
22293
|
-
this.logger.progress(translate.t("toolApiworkflow.progress.copyingFiles"));
|
|
22294
|
-
await this.copyFiles(options.projectPath, contentFolder);
|
|
22295
|
-
this.logger.progress(translate.t("toolApiworkflow.progress.creatingOperateFile"));
|
|
22296
|
-
await this.createOperateFile(options, contentFolder);
|
|
22297
|
-
this.logger.progress(translate.t("toolApiworkflow.progress.creatingPackageDescriptor"));
|
|
22298
|
-
await this.createPackageDescriptor(localBuildFolder);
|
|
22299
|
-
return new ToolResult(ToolErrorCodes.Success, translate.t("toolApiworkflow.success.done"), [
|
|
22300
|
-
localBuildFolder
|
|
22301
|
-
]);
|
|
22302
|
-
} catch (error) {
|
|
22303
|
-
const errorMessage = error instanceof Error ? error.toString() : String(error);
|
|
22304
|
-
this.logger.error(errorMessage);
|
|
22305
|
-
return ToolResult.error(ToolErrorCodes.InternalError, translate.t("toolApiworkflow.errors.buildFailed"));
|
|
22306
|
-
}
|
|
22307
|
-
}
|
|
22308
|
-
async packAsync(options, cancellationToken) {
|
|
22309
|
-
const buildResult = await this.buildAsync(options, cancellationToken);
|
|
22310
|
-
if (!buildResult.isSuccess)
|
|
22311
|
-
return buildResult;
|
|
22312
|
-
const localBuildFolder = buildResult.packages[0];
|
|
22313
|
-
try {
|
|
22314
|
-
this.logger.progress(translate.t("toolApiworkflow.progress.creatingNugetPackage"));
|
|
22315
|
-
const nupkgFileName = `${options.package.id}.${options.package.version}.nupkg`;
|
|
22316
|
-
const nupkgPath = Path.join(options.outputPath, nupkgFileName);
|
|
22317
|
-
const packager = new NugetPackager(this.fileSystem);
|
|
22318
|
-
const result = await packager.packAsync(localBuildFolder, options.package, nupkgPath);
|
|
22319
|
-
this.logger.progress(translate.t("toolApiworkflow.progress.packageCreatedSuccessfully"));
|
|
22320
|
-
return new ToolResult(ToolErrorCodes.Success, translate.t("toolApiworkflow.success.done"), [
|
|
22321
|
-
result.outputPath
|
|
22322
|
-
]);
|
|
22323
|
-
} catch (error) {
|
|
22324
|
-
const errorMessage = error instanceof Error ? error.toString() : String(error);
|
|
22325
|
-
this.logger.error(errorMessage);
|
|
22326
|
-
return ToolResult.error(ToolErrorCodes.InternalError, translate.t("toolApiworkflow.errors.packFailed"));
|
|
22327
|
-
}
|
|
22328
|
-
}
|
|
22329
|
-
async dispose() {
|
|
22330
|
-
this.logger.info(translate.t("toolApiworkflow.info.disposing"));
|
|
22331
|
-
try {
|
|
22332
|
-
await this._temporaryStorage.cleanup();
|
|
22333
|
-
} catch {}
|
|
22334
|
-
}
|
|
22335
|
-
async copyFiles(sourcePath, destinationPath) {
|
|
22336
|
-
await this.fileSystem.mkdir(destinationPath);
|
|
22337
|
-
const files = await this.fileSystem.readdir(sourcePath);
|
|
22338
|
-
for (const file of files) {
|
|
22339
|
-
const sourceFile = Path.join(sourcePath, file);
|
|
22340
|
-
const destinationFile = Path.join(destinationPath, file);
|
|
22341
|
-
const stat = await this.fileSystem.stat(sourceFile);
|
|
22342
|
-
if (stat?.isFile()) {
|
|
22343
|
-
const content = await this.fileSystem.readFile(sourceFile);
|
|
22344
|
-
if (content)
|
|
22345
|
-
await this.fileSystem.writeFile(destinationFile, content);
|
|
22346
|
-
}
|
|
22347
|
-
}
|
|
22348
|
-
}
|
|
22349
|
-
async createOperateFile(options, contentFolder) {
|
|
22350
|
-
const operateJsonFilePath = Path.join(contentFolder, NugetConstants.OperateFileName);
|
|
22351
|
-
const exists = await this.fileSystem.exists(operateJsonFilePath);
|
|
22352
|
-
if (!exists)
|
|
22353
|
-
await this.createOperateJsonFile(contentFolder, options.projectStorageId ?? "", operateJsonFilePath);
|
|
22354
|
-
}
|
|
22355
|
-
async createOperateJsonFile(projectPath, projectId, filePath) {
|
|
22356
|
-
const entryPointsFilePath = Path.join(projectPath, NugetConstants.EntryPointsFileName);
|
|
22357
|
-
let mainPath = "";
|
|
22358
|
-
const entryPointsExists = await this.fileSystem.exists(entryPointsFilePath);
|
|
22359
|
-
if (entryPointsExists) {
|
|
22360
|
-
const entryPointsContent = await this.fileSystem.readFile(entryPointsFilePath);
|
|
22361
|
-
if (entryPointsContent)
|
|
22362
|
-
try {
|
|
22363
|
-
const entryPointsText = new TextDecoder().decode(entryPointsContent);
|
|
22364
|
-
const entryPoints = JSON.parse(entryPointsText);
|
|
22365
|
-
mainPath = entryPoints.entryPoints?.[0]?.filePath ?? "";
|
|
22366
|
-
} catch {}
|
|
22367
|
-
}
|
|
22368
|
-
const operateFileModel = {
|
|
22369
|
-
$schema: "https://cloud.uipath.com/draft/2024-12/operate",
|
|
22370
|
-
contentType: ProjectTypes.Api,
|
|
22371
|
-
projectId,
|
|
22372
|
-
main: mainPath,
|
|
22373
|
-
targetFramework: "Portable",
|
|
22374
|
-
runtimeOptions: {
|
|
22375
|
-
isAttended: false,
|
|
22376
|
-
requiresUserInteraction: false
|
|
22377
|
-
}
|
|
22378
|
-
};
|
|
22379
|
-
const operateJsonString = JSON.stringify(operateFileModel, null, 2);
|
|
22380
|
-
await this.fileSystem.writeFile(filePath, operateJsonString);
|
|
22381
|
-
}
|
|
22382
|
-
async createPackageDescriptor(localBuildFolder) {
|
|
22383
|
-
const packageDescriptor = {
|
|
22384
|
-
files: {}
|
|
22385
|
-
};
|
|
22386
|
-
this.addFileIfExists(packageDescriptor, localBuildFolder, NugetConstants.OperateFileName, NugetConstants.OperateFileName);
|
|
22387
|
-
this.addFileIfExists(packageDescriptor, localBuildFolder, NugetConstants.EntryPointsFileName, NugetConstants.EntryPointsFileName);
|
|
22388
|
-
this.addFileIfExists(packageDescriptor, localBuildFolder, NugetConstants.BindingsFileId, NugetConstants.BindingsV2FileName);
|
|
22389
|
-
const packageDescriptorPath = Path.join(localBuildFolder, NugetConstants.ContentFolderName, NugetConstants.PackageDescriptorFileName);
|
|
22390
|
-
const packageDescriptorJson = JSON.stringify({
|
|
22391
|
-
$schema: "https://cloud.uipath.com/draft/2024-12/package-descriptor",
|
|
22392
|
-
...packageDescriptor
|
|
22393
|
-
}, null, 2);
|
|
22394
|
-
await this.fileSystem.writeFile(packageDescriptorPath, packageDescriptorJson);
|
|
22395
|
-
}
|
|
22396
|
-
addFileIfExists(packageDescriptor, _rootFolder, key, fileName) {
|
|
22397
|
-
const relativePath = Path.join(NugetConstants.ContentFolderName, fileName);
|
|
22398
|
-
packageDescriptor.files[key] = relativePath;
|
|
22399
|
-
}
|
|
22400
|
-
constructor(fileSystem, logger) {
|
|
22401
|
-
super(fileSystem, logger), _define_property(this, "_temporaryStorage", undefined);
|
|
22402
|
-
this._temporaryStorage = new TemporaryStorageService(fileSystem);
|
|
22403
|
-
}
|
|
22404
|
-
}
|
|
22405
|
-
function api_workflow_tool_factory_define_property(obj, key, value) {
|
|
22406
|
-
if (key in obj)
|
|
22407
|
-
Object.defineProperty(obj, key, {
|
|
22408
|
-
value,
|
|
22409
|
-
enumerable: true,
|
|
22410
|
-
configurable: true,
|
|
22411
|
-
writable: true
|
|
22412
|
-
});
|
|
22413
|
-
else
|
|
22414
|
-
obj[key] = value;
|
|
22415
|
-
return obj;
|
|
22416
|
-
}
|
|
22417
|
-
|
|
22418
|
-
class ApiWorkflowToolFactory {
|
|
22419
|
-
async createAsync(logger, fileSystem) {
|
|
22420
|
-
return new ApiWorkflowsTool(fileSystem, logger);
|
|
22421
|
-
}
|
|
22422
|
-
constructor() {
|
|
22423
|
-
api_workflow_tool_factory_define_property(this, "supportedTypes", [
|
|
22424
|
-
ProjectTypes.Api
|
|
22425
|
-
]);
|
|
22426
|
-
}
|
|
22427
|
-
}
|
|
22428
|
-
toolsFactoryRepository.registerProjectToolFactory(new ApiWorkflowToolFactory);
|
|
22212
|
+
// src/tool.ts
|
|
22213
|
+
import"./packager-tool.js";
|
|
22429
22214
|
// package.json
|
|
22430
22215
|
var package_default = {
|
|
22431
22216
|
name: "@uipath/api-workflow-tool",
|
|
22432
|
-
version: "0.1.
|
|
22217
|
+
version: "0.1.12",
|
|
22433
22218
|
description: "Run UiPath API Workflows locally.",
|
|
22434
22219
|
private: false,
|
|
22435
22220
|
repository: {
|
|
22436
22221
|
type: "git",
|
|
22437
|
-
url: "https://github.com/UiPath/
|
|
22222
|
+
url: "https://github.com/UiPath/cli.git",
|
|
22438
22223
|
directory: "packages/api-workflow-tool"
|
|
22439
22224
|
},
|
|
22440
22225
|
publishConfig: {
|
|
22441
|
-
registry: "https://
|
|
22226
|
+
registry: "https://npm.pkg.github.com/@uipath"
|
|
22442
22227
|
},
|
|
22443
22228
|
keywords: [
|
|
22444
|
-
"
|
|
22229
|
+
"cli-tool"
|
|
22445
22230
|
],
|
|
22446
22231
|
type: "module",
|
|
22447
22232
|
main: "./dist/tool.js",
|
|
@@ -22452,7 +22237,7 @@ var package_default = {
|
|
|
22452
22237
|
"dist"
|
|
22453
22238
|
],
|
|
22454
22239
|
scripts: {
|
|
22455
|
-
build: "bun build ./src/tool.ts --outdir dist --format esm --target node --external commander --external @uipath/common --external @uipath/auth --external @uipath/filesystem --external @uipath/solutionpackager-tool-core",
|
|
22240
|
+
build: "bun build ./src/packager-tool.ts --outdir dist --format esm --target node --external @uipath/solutionpackager-tool-core && bun build ./src/tool.ts --outdir dist --format esm --target node --external '*/packager-tool.js' --external commander --external @uipath/common --external @uipath/auth --external @uipath/filesystem --external @uipath/solutionpackager-tool-core && bun build ./src/index.ts --outdir dist --format esm --target node --external '*/tool.js' --external commander --external @uipath/common --external @uipath/auth --external @uipath/filesystem --external @uipath/solutionpackager-tool-core",
|
|
22456
22241
|
package: "bun run build && bun pm pack",
|
|
22457
22242
|
lint: "biome check .",
|
|
22458
22243
|
"lint:fix": "biome check --write .",
|
|
@@ -22463,14 +22248,14 @@ var package_default = {
|
|
|
22463
22248
|
},
|
|
22464
22249
|
peerDependencies: {
|
|
22465
22250
|
commander: "^14.0.3",
|
|
22466
|
-
"@uipath/common": "^0.1.
|
|
22467
|
-
"@uipath/auth": "^0.1.
|
|
22251
|
+
"@uipath/common": "^0.1.12",
|
|
22252
|
+
"@uipath/auth": "^0.1.9",
|
|
22468
22253
|
"@uipath/filesystem": "^0.1.6",
|
|
22469
|
-
"@uipath/solutionpackager-tool-core": "
|
|
22254
|
+
"@uipath/solutionpackager-tool-core": "workspace:*"
|
|
22470
22255
|
},
|
|
22471
22256
|
devDependencies: {
|
|
22472
|
-
"@uipath/tool-apiworkflow": "
|
|
22473
|
-
"@types/node": "^25.
|
|
22257
|
+
"@uipath/packager-tool-apiworkflow": "workspace:*",
|
|
22258
|
+
"@types/node": "^25.5.0",
|
|
22474
22259
|
typescript: "^5"
|
|
22475
22260
|
}
|
|
22476
22261
|
};
|
|
@@ -22482,6 +22267,7 @@ import { processContext } from "@uipath/common";
|
|
|
22482
22267
|
var import_api_workflow_executor2 = __toESM(require_dist2(), 1);
|
|
22483
22268
|
import { getLoginStatusAsync } from "@uipath/auth";
|
|
22484
22269
|
import {
|
|
22270
|
+
catchError,
|
|
22485
22271
|
FailureOutput,
|
|
22486
22272
|
logger as logger2,
|
|
22487
22273
|
OutputFormatter,
|
|
@@ -22592,51 +22378,61 @@ class WorkflowRunService {
|
|
|
22592
22378
|
context.exit(1);
|
|
22593
22379
|
return;
|
|
22594
22380
|
}
|
|
22595
|
-
|
|
22596
|
-
|
|
22597
|
-
|
|
22598
|
-
|
|
22599
|
-
|
|
22600
|
-
|
|
22381
|
+
const [readError, raw] = await catchError(fs.readFile(resolvedPath, "utf-8"));
|
|
22382
|
+
if (readError) {
|
|
22383
|
+
OutputFormatter.error(new FailureOutput("Failure", `Failed to parse workflow file: ${readError.message}`, "Ensure the file contains valid JSON."));
|
|
22384
|
+
context.exit(1);
|
|
22385
|
+
return;
|
|
22386
|
+
}
|
|
22387
|
+
const [parseError, workflow] = catchError(() => JSON.parse(raw ?? ""));
|
|
22388
|
+
if (parseError) {
|
|
22389
|
+
OutputFormatter.error(new FailureOutput("Failure", `Failed to parse workflow file: ${parseError.message}`, "Ensure the file contains valid JSON."));
|
|
22601
22390
|
context.exit(1);
|
|
22602
22391
|
return;
|
|
22603
22392
|
}
|
|
22604
22393
|
let input = {};
|
|
22605
22394
|
if (options.inputArguments) {
|
|
22606
|
-
|
|
22607
|
-
|
|
22608
|
-
|
|
22609
|
-
OutputFormatter.error(new FailureOutput("Failure", `Failed to parse --input-arguments JSON: ${
|
|
22395
|
+
const rawInput = options.inputArguments;
|
|
22396
|
+
const [inputParseError, parsedInput] = catchError(() => JSON.parse(rawInput));
|
|
22397
|
+
if (inputParseError) {
|
|
22398
|
+
OutputFormatter.error(new FailureOutput("Failure", `Failed to parse --input-arguments JSON: ${inputParseError.message}`, `Provide valid JSON (e.g. '{"name": "World"}').`));
|
|
22610
22399
|
context.exit(1);
|
|
22611
22400
|
return;
|
|
22612
22401
|
}
|
|
22402
|
+
input = parsedInput;
|
|
22613
22403
|
}
|
|
22614
22404
|
const workflowLogger = createConsoleLogger();
|
|
22615
|
-
|
|
22616
|
-
|
|
22617
|
-
logger2.info(`
|
|
22618
|
-
Running workflow: ${fs.path.basename(resolvedPath)}`);
|
|
22619
|
-
if (workflowConfig.accessToken) {
|
|
22620
|
-
logger2.info(`Auth: connected to ${workflowConfig.baseUrl}`);
|
|
22621
|
-
} else {
|
|
22622
|
-
logger2.info("Auth: local mode (no credentials)");
|
|
22623
|
-
}
|
|
22624
|
-
if (Object.keys(input).length > 0) {
|
|
22625
|
-
logger2.info(`Input: ${JSON.stringify(input, null, 2)}`);
|
|
22626
|
-
}
|
|
22627
|
-
const result = await import_api_workflow_executor2.ServerlessWorkflowExecutor.execute(workflow, workflowConfig, input, { logger: workflowLogger });
|
|
22405
|
+
const [configError, workflowConfig] = await catchError(this.buildWorkflowConfig(options.auth));
|
|
22406
|
+
if (configError) {
|
|
22628
22407
|
await workflowLogger.shutdown();
|
|
22629
|
-
|
|
22630
|
-
|
|
22631
|
-
|
|
22632
|
-
|
|
22633
|
-
|
|
22634
|
-
|
|
22635
|
-
|
|
22636
|
-
}
|
|
22637
|
-
}
|
|
22408
|
+
OutputFormatter.error(new FailureOutput("Failure", `Execution error: ${configError.message}`, "Check the workflow definition and try again with --log-level debug for more details."));
|
|
22409
|
+
context.exit(1);
|
|
22410
|
+
return;
|
|
22411
|
+
}
|
|
22412
|
+
logger2.info(`
|
|
22413
|
+
Running workflow: ${fs.path.basename(resolvedPath)}`);
|
|
22414
|
+
if (workflowConfig.accessToken) {
|
|
22415
|
+
logger2.info(`Auth: connected to ${workflowConfig.baseUrl}`);
|
|
22416
|
+
} else {
|
|
22417
|
+
logger2.info("Auth: local mode (no credentials)");
|
|
22418
|
+
}
|
|
22419
|
+
if (Object.keys(input).length > 0) {
|
|
22420
|
+
logger2.info(`Input: ${JSON.stringify(input, null, 2)}`);
|
|
22421
|
+
}
|
|
22422
|
+
const [execError, result] = await catchError(import_api_workflow_executor2.ServerlessWorkflowExecutor.execute(workflow, workflowConfig, input, { logger: workflowLogger }));
|
|
22423
|
+
if (execError) {
|
|
22638
22424
|
await workflowLogger.shutdown();
|
|
22639
|
-
OutputFormatter.error(new FailureOutput("Failure", `Execution error: ${
|
|
22425
|
+
OutputFormatter.error(new FailureOutput("Failure", `Execution error: ${execError.message}`, "Check the workflow definition and try again with --log-level debug for more details."));
|
|
22426
|
+
context.exit(1);
|
|
22427
|
+
return;
|
|
22428
|
+
}
|
|
22429
|
+
await workflowLogger.shutdown();
|
|
22430
|
+
logger2.debug(`Raw response: ${JSON.stringify(result, null, 2)}`);
|
|
22431
|
+
if (result.status === "Successful") {
|
|
22432
|
+
const data = result.data ?? { message: "(no output)" };
|
|
22433
|
+
OutputFormatter.success(new SuccessOutput("WorkflowRun", data));
|
|
22434
|
+
} else {
|
|
22435
|
+
OutputFormatter.error(new FailureOutput("Failure", result.errorMessage ?? "Unknown error", "Check the workflow definition and input parameters."));
|
|
22640
22436
|
context.exit(1);
|
|
22641
22437
|
}
|
|
22642
22438
|
}
|
|
@@ -22652,24 +22448,23 @@ Running workflow: ${fs.path.basename(resolvedPath)}`);
|
|
|
22652
22448
|
logger2.debug("Auth disabled via --no-auth flag");
|
|
22653
22449
|
return localConfig;
|
|
22654
22450
|
}
|
|
22655
|
-
|
|
22656
|
-
|
|
22657
|
-
|
|
22658
|
-
|
|
22659
|
-
if (status.loginStatus === "Logged in" && status.accessToken) {
|
|
22660
|
-
return {
|
|
22661
|
-
organizationId: status.organizationId ?? "local",
|
|
22662
|
-
tenantId: status.tenantId ?? "local",
|
|
22663
|
-
accessToken: status.accessToken,
|
|
22664
|
-
baseUrl: status.baseUrl ?? "",
|
|
22665
|
-
source: "uipcli"
|
|
22666
|
-
};
|
|
22667
|
-
}
|
|
22668
|
-
logger2.debug("Not logged in, using local mode");
|
|
22669
|
-
return localConfig;
|
|
22670
|
-
} catch {
|
|
22451
|
+
const [error, status] = await catchError(getLoginStatusAsync({
|
|
22452
|
+
ensureTokenValidityMinutes: 10
|
|
22453
|
+
}));
|
|
22454
|
+
if (error) {
|
|
22671
22455
|
return localConfig;
|
|
22672
22456
|
}
|
|
22457
|
+
if (status.loginStatus === "Logged in" && status.accessToken) {
|
|
22458
|
+
return {
|
|
22459
|
+
organizationId: status.organizationId ?? "local",
|
|
22460
|
+
tenantId: status.tenantId ?? "local",
|
|
22461
|
+
accessToken: status.accessToken,
|
|
22462
|
+
baseUrl: status.baseUrl ?? "",
|
|
22463
|
+
source: "uipcli"
|
|
22464
|
+
};
|
|
22465
|
+
}
|
|
22466
|
+
logger2.debug("Not logged in, using local mode");
|
|
22467
|
+
return localConfig;
|
|
22673
22468
|
}
|
|
22674
22469
|
}
|
|
22675
22470
|
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/api-workflow-tool",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "Run UiPath API Workflows locally.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/UiPath/
|
|
8
|
+
"url": "https://github.com/UiPath/cli.git",
|
|
9
9
|
"directory": "packages/api-workflow-tool"
|
|
10
10
|
},
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"registry": "https://registry.npmjs.org/"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
|
15
|
-
"
|
|
15
|
+
"cli-tool"
|
|
16
16
|
],
|
|
17
17
|
"type": "module",
|
|
18
18
|
"main": "./dist/tool.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"dist"
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
|
-
"build": "bun build ./src/tool.ts --outdir dist --format esm --target node --external commander --external @uipath/common --external @uipath/auth --external @uipath/filesystem --external @uipath/solutionpackager-tool-core",
|
|
26
|
+
"build": "bun build ./src/packager-tool.ts --outdir dist --format esm --target node --external @uipath/solutionpackager-tool-core && bun build ./src/tool.ts --outdir dist --format esm --target node --external '*/packager-tool.js' --external commander --external @uipath/common --external @uipath/auth --external @uipath/filesystem --external @uipath/solutionpackager-tool-core && bun build ./src/index.ts --outdir dist --format esm --target node --external '*/tool.js' --external commander --external @uipath/common --external @uipath/auth --external @uipath/filesystem --external @uipath/solutionpackager-tool-core",
|
|
27
27
|
"package": "bun run build && bun pm pack",
|
|
28
28
|
"lint": "biome check .",
|
|
29
29
|
"lint:fix": "biome check --write .",
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"commander": "^14.0.3",
|
|
37
|
-
"@uipath/common": "^0.1.
|
|
38
|
-
"@uipath/auth": "^0.1.
|
|
37
|
+
"@uipath/common": "^0.1.12",
|
|
38
|
+
"@uipath/auth": "^0.1.9",
|
|
39
39
|
"@uipath/filesystem": "^0.1.6",
|
|
40
|
-
"@uipath/solutionpackager-tool-core": "
|
|
40
|
+
"@uipath/solutionpackager-tool-core": "0.0.31"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@uipath/tool-apiworkflow": "0.0.
|
|
44
|
-
"@types/node": "^25.
|
|
43
|
+
"@uipath/packager-tool-apiworkflow": "0.0.17",
|
|
44
|
+
"@types/node": "^25.5.0",
|
|
45
45
|
"typescript": "^5"
|
|
46
46
|
}
|
|
47
47
|
}
|