@opsrev/acculynx-cli 1.5.0 → 1.6.0
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 +12 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -77,12 +77,13 @@ function createApiClient(config) {
|
|
|
77
77
|
body
|
|
78
78
|
});
|
|
79
79
|
if (!response.ok) {
|
|
80
|
-
const
|
|
80
|
+
const text2 = await response.text();
|
|
81
81
|
throw new Error(
|
|
82
|
-
`API error (${response.status} ${response.statusText}): ${
|
|
82
|
+
`API error (${response.status} ${response.statusText}): ${text2}`
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
|
-
|
|
85
|
+
const text = await response.text();
|
|
86
|
+
return text ? JSON.parse(text) : { status: response.status };
|
|
86
87
|
}
|
|
87
88
|
return {
|
|
88
89
|
get: doGet,
|
|
@@ -217,6 +218,14 @@ function registerJobsCommands(parentCmd, getClient2) {
|
|
|
217
218
|
);
|
|
218
219
|
console.log(JSON.stringify(result));
|
|
219
220
|
});
|
|
221
|
+
jobs.command("add-expense").argument("<jobId>", "Job ID").description("Record an additional expense on a job (pipe JSON body to stdin)").action(async (jobId) => {
|
|
222
|
+
const body = await readStdin();
|
|
223
|
+
const result = await getClient2().post(
|
|
224
|
+
`/jobs/${jobId}/payments/expense`,
|
|
225
|
+
body
|
|
226
|
+
);
|
|
227
|
+
console.log(JSON.stringify(result));
|
|
228
|
+
});
|
|
220
229
|
jobs.command("upload-document").argument("<jobId>", "Job ID").argument("<filePath>", "Path to the file to upload").requiredOption("--folder-id <id>", "Document folder ID (required)").option("--description <text>", "Brief description of the file").option("--external-id <id>", "External reference identifier").option("--external-source <source>", "External reference source").description("Upload a document to a job").action(async (jobId, filePath, opts) => {
|
|
221
230
|
const ext = extname(filePath).toLowerCase();
|
|
222
231
|
if (DISALLOWED_EXTENSIONS.has(ext)) {
|