ofsc-utility 1.0.54 → 1.0.55
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/CHANGELOG.md
CHANGED
|
@@ -10,7 +10,7 @@ async function startActivity(clientId, clientSecret, instanceUrl, activityId, to
|
|
|
10
10
|
throw new Error("Invalid activityId. It must be a valid number.");
|
|
11
11
|
}
|
|
12
12
|
const url = `https://${instanceUrl}.fs.ocs.oraclecloud.com/rest/ofscCore/v1/activities/${Number(activityId)}/custom-actions/start`;
|
|
13
|
-
|
|
13
|
+
utilities_1.log.blue(`Starting activity by ID: ${url}`);
|
|
14
14
|
const response = await (0, utilities_1.fetchPostWithRetry)(url, clientId, clientSecret, instanceUrl, token, {});
|
|
15
15
|
return response;
|
|
16
16
|
}
|
|
@@ -19,7 +19,7 @@ async function cancelActivity(clientId, clientSecret, instanceUrl, activityId, t
|
|
|
19
19
|
throw new Error("Invalid activityId. It must be a valid number.");
|
|
20
20
|
}
|
|
21
21
|
const url = `https://${instanceUrl}.fs.ocs.oraclecloud.com/rest/ofscCore/v1/activities/${Number(activityId)}/custom-actions/cancel`;
|
|
22
|
-
|
|
22
|
+
utilities_1.log.red(`Cancelling activity by ID: ${url}`);
|
|
23
23
|
const response = await (0, utilities_1.fetchPostWithRetry)(url, clientId, clientSecret, instanceUrl, token, {});
|
|
24
24
|
return response;
|
|
25
25
|
}
|
|
@@ -28,7 +28,7 @@ async function completeActivity(clientId, clientSecret, instanceUrl, activityId,
|
|
|
28
28
|
throw new Error("Invalid activityId. It must be a valid number.");
|
|
29
29
|
}
|
|
30
30
|
const url = `https://${instanceUrl}.fs.ocs.oraclecloud.com/rest/ofscCore/v1/activities/${Number(activityId)}/custom-actions/complete`;
|
|
31
|
-
|
|
31
|
+
utilities_1.log.green(`Completing activity by ID: ${url}`);
|
|
32
32
|
const response = await (0, utilities_1.fetchPostWithRetry)(url, clientId, clientSecret, instanceUrl, token, {});
|
|
33
33
|
return response;
|
|
34
34
|
}
|
|
@@ -37,7 +37,7 @@ async function deleteActivity(clientId, clientSecret, instanceUrl, activityId, t
|
|
|
37
37
|
throw new Error("Invalid activityId. It must be a valid number.");
|
|
38
38
|
}
|
|
39
39
|
const url = `https://${instanceUrl}.fs.ocs.oraclecloud.com/rest/ofscCore/v1/activities/${Number(activityId)}`;
|
|
40
|
-
|
|
40
|
+
utilities_1.log.yellow(`Deleting activity by ID: ${url}`);
|
|
41
41
|
const response = await (0, utilities_1.deleteWithRetry)(url, clientId, clientSecret, instanceUrl, token);
|
|
42
42
|
return response;
|
|
43
43
|
}
|
|
@@ -47,4 +47,22 @@ export declare function getTimeBefore3600SecondsAlt(): string;
|
|
|
47
47
|
* Falls back to null if the value is missing/unparseable.
|
|
48
48
|
*/
|
|
49
49
|
export declare function parseOFSCDate(value: unknown): Date | null;
|
|
50
|
+
export declare const log: {
|
|
51
|
+
black: (message: string) => void;
|
|
52
|
+
red: (message: string) => void;
|
|
53
|
+
green: (message: string) => void;
|
|
54
|
+
yellow: (message: string) => void;
|
|
55
|
+
blue: (message: string) => void;
|
|
56
|
+
magenta: (message: string) => void;
|
|
57
|
+
cyan: (message: string) => void;
|
|
58
|
+
white: (message: string) => void;
|
|
59
|
+
gray: (message: string) => void;
|
|
60
|
+
brightRed: (message: string) => void;
|
|
61
|
+
brightGreen: (message: string) => void;
|
|
62
|
+
brightYellow: (message: string) => void;
|
|
63
|
+
brightBlue: (message: string) => void;
|
|
64
|
+
brightMagenta: (message: string) => void;
|
|
65
|
+
brightCyan: (message: string) => void;
|
|
66
|
+
brightWhite: (message: string) => void;
|
|
67
|
+
};
|
|
50
68
|
export {};
|
package/dist/utilities/index.js
CHANGED
|
@@ -36,7 +36,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
36
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.fetchPostWithRetry = exports.fetchPatchWithRetry = exports.deleteWithRetry = exports.fetchWithRetry = void 0;
|
|
39
|
+
exports.log = exports.fetchPostWithRetry = exports.fetchPatchWithRetry = exports.deleteWithRetry = exports.fetchWithRetry = void 0;
|
|
40
40
|
exports.saveCsv = saveCsv;
|
|
41
41
|
exports.xmlNodeToObjects = xmlNodeToObjects;
|
|
42
42
|
exports.createExcelFile = createExcelFile;
|
|
@@ -559,3 +559,43 @@ function parseOFSCDate(value) {
|
|
|
559
559
|
const d = new Date(isoLike);
|
|
560
560
|
return isNaN(d.getTime()) ? null : d;
|
|
561
561
|
}
|
|
562
|
+
const COLORS = {
|
|
563
|
+
reset: "\x1b[0m",
|
|
564
|
+
black: "\x1b[30m",
|
|
565
|
+
red: "\x1b[31m",
|
|
566
|
+
green: "\x1b[32m",
|
|
567
|
+
yellow: "\x1b[33m",
|
|
568
|
+
blue: "\x1b[34m",
|
|
569
|
+
magenta: "\x1b[35m",
|
|
570
|
+
cyan: "\x1b[36m",
|
|
571
|
+
white: "\x1b[37m",
|
|
572
|
+
gray: "\x1b[90m",
|
|
573
|
+
brightRed: "\x1b[91m",
|
|
574
|
+
brightGreen: "\x1b[92m",
|
|
575
|
+
brightYellow: "\x1b[93m",
|
|
576
|
+
brightBlue: "\x1b[94m",
|
|
577
|
+
brightMagenta: "\x1b[95m",
|
|
578
|
+
brightCyan: "\x1b[96m",
|
|
579
|
+
brightWhite: "\x1b[97m",
|
|
580
|
+
};
|
|
581
|
+
const logColor = (message, color) => {
|
|
582
|
+
console.log(`${COLORS[color]}${message}${COLORS.reset}`);
|
|
583
|
+
};
|
|
584
|
+
exports.log = {
|
|
585
|
+
black: (message) => logColor(message, "black"),
|
|
586
|
+
red: (message) => logColor(message, "red"),
|
|
587
|
+
green: (message) => logColor(message, "green"),
|
|
588
|
+
yellow: (message) => logColor(message, "yellow"),
|
|
589
|
+
blue: (message) => logColor(message, "blue"),
|
|
590
|
+
magenta: (message) => logColor(message, "magenta"),
|
|
591
|
+
cyan: (message) => logColor(message, "cyan"),
|
|
592
|
+
white: (message) => logColor(message, "white"),
|
|
593
|
+
gray: (message) => logColor(message, "gray"),
|
|
594
|
+
brightRed: (message) => logColor(message, "brightRed"),
|
|
595
|
+
brightGreen: (message) => logColor(message, "brightGreen"),
|
|
596
|
+
brightYellow: (message) => logColor(message, "brightYellow"),
|
|
597
|
+
brightBlue: (message) => logColor(message, "brightBlue"),
|
|
598
|
+
brightMagenta: (message) => logColor(message, "brightMagenta"),
|
|
599
|
+
brightCyan: (message) => logColor(message, "brightCyan"),
|
|
600
|
+
brightWhite: (message) => logColor(message, "brightWhite"),
|
|
601
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ofsc-utility",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.55",
|
|
4
4
|
"description": "TypeScript helpers for Oracle Field Service Cloud (OFSC): events, resources, inventories, metadata and CSV/Excel utilities.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|