ofsc-utility 1.0.9 → 1.0.11
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/activityInventories/index.js +4 -3
- package/dist/events/index.d.ts +7 -0
- package/dist/events/index.js +114 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +10 -2
- package/dist/types.d.ts +5 -0
- package/dist/users/collaborationGroups.d.ts +1 -0
- package/dist/users/collaborationGroups.js +70 -0
- package/dist/users/index.d.ts +6 -0
- package/dist/users/index.js +8 -0
- package/dist/utilities/index.js +3 -0
- package/package.json +1 -1
- package/readme.md +29 -4
|
@@ -63,8 +63,9 @@ async function createActivityCustomerInventories(clientId, clientSecret, instanc
|
|
|
63
63
|
},
|
|
64
64
|
body: JSON.stringify(payload)
|
|
65
65
|
});
|
|
66
|
-
if (!res.ok) {
|
|
67
|
-
|
|
68
|
-
}
|
|
66
|
+
// if (!res.ok) {
|
|
67
|
+
// return await res.json();
|
|
68
|
+
// throw new Error(`❌ POST failed: ${res.status} ${res.statusText}`);
|
|
69
|
+
// }
|
|
69
70
|
return await res.json();
|
|
70
71
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type AnyObject = {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
};
|
|
4
|
+
export declare function flattenObject(obj: AnyObject, parentKey?: string, result?: AnyObject): AnyObject;
|
|
5
|
+
export declare function downloadAllEventsOfDay(clientId: string, clientSecret: string, instanceUrl: string, subscriptionId: string, sinceDate: string, onlyData: boolean): Promise<any[]>;
|
|
6
|
+
export declare function downloadAllEventsOfDayCSV(clientId: string, clientSecret: string, instanceUrl: string, subscriptionId: string, sinceDate: string, onlyData: boolean): Promise<any[]>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.flattenObject = flattenObject;
|
|
7
|
+
exports.downloadAllEventsOfDay = downloadAllEventsOfDay;
|
|
8
|
+
exports.downloadAllEventsOfDayCSV = downloadAllEventsOfDayCSV;
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const index_1 = require("../oauthTokenService/index");
|
|
11
|
+
const utilities_1 = require("../utilities");
|
|
12
|
+
function flattenObject(obj, parentKey = "", result = {}) {
|
|
13
|
+
for (const key in obj) {
|
|
14
|
+
const newKey = parentKey ? `${parentKey}_${key}` : key;
|
|
15
|
+
if (typeof obj[key] === "object" &&
|
|
16
|
+
obj[key] !== null &&
|
|
17
|
+
!Array.isArray(obj[key])) {
|
|
18
|
+
flattenObject(obj[key], newKey, result);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
result[newKey] = obj[key];
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
async function fetchEventsPage(url, token, clientId, clientSecret, instanceUrl) {
|
|
27
|
+
const res = await (0, utilities_1.fetchWithRetry)(url, clientId, clientSecret, instanceUrl, token);
|
|
28
|
+
return {
|
|
29
|
+
token: res.token,
|
|
30
|
+
data: res.data
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function processEventItems(items, sinceDate, output) {
|
|
34
|
+
for (const item of items) {
|
|
35
|
+
const eventTime = item.time;
|
|
36
|
+
// Stop if date changes
|
|
37
|
+
if (!eventTime.startsWith(sinceDate)) {
|
|
38
|
+
console.log("Stopping at different event date:", eventTime);
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
// Add activityId as first level field
|
|
42
|
+
const activityId = item.activityDetails?.activityId ?? null;
|
|
43
|
+
output.push({ activityId, ...item });
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
async function downloadAllEventsOfDay(clientId, clientSecret, instanceUrl, subscriptionId, sinceDate, onlyData) {
|
|
48
|
+
console.log("Downloading events...OnlyData:", onlyData);
|
|
49
|
+
let data = await downloadAllEventsOfDayCSV(clientId, clientSecret, instanceUrl, subscriptionId, sinceDate, onlyData);
|
|
50
|
+
return data;
|
|
51
|
+
}
|
|
52
|
+
async function downloadAllEventsOfDayCSV(clientId, clientSecret, instanceUrl, subscriptionId, sinceDate, onlyData) {
|
|
53
|
+
// All collected events
|
|
54
|
+
const events = [];
|
|
55
|
+
// Build initial request URL
|
|
56
|
+
const baseUrl = `https://${instanceUrl}.fs.ocs.oraclecloud.com/rest/ofscCore/v1/events`;
|
|
57
|
+
const initialUrl = `${baseUrl}?subscriptionId=${encodeURIComponent(subscriptionId)}&since=${encodeURIComponent(sinceDate + " 00:00:00")}`;
|
|
58
|
+
let token = await (0, index_1.getOAuthToken)(clientId, clientSecret, instanceUrl);
|
|
59
|
+
// Get first page
|
|
60
|
+
let firstPage = await fetchEventsPage(initialUrl, token, clientId, clientSecret, instanceUrl);
|
|
61
|
+
token = firstPage.token;
|
|
62
|
+
let nextPage = firstPage.data.nextPage;
|
|
63
|
+
let found = firstPage.data.found;
|
|
64
|
+
// Controls infinite loop
|
|
65
|
+
let lastSeenPage = nextPage;
|
|
66
|
+
let repeatedPageCount = 0;
|
|
67
|
+
// Loop through pages
|
|
68
|
+
while (found && nextPage) {
|
|
69
|
+
const pageUrl = new URL(baseUrl);
|
|
70
|
+
pageUrl.search = new URLSearchParams({
|
|
71
|
+
subscriptionId,
|
|
72
|
+
page: nextPage,
|
|
73
|
+
limit: "1000",
|
|
74
|
+
}).toString();
|
|
75
|
+
const finalUrl = pageUrl.toString();
|
|
76
|
+
const result = await fetchEventsPage(finalUrl, token, clientId, clientSecret, instanceUrl);
|
|
77
|
+
token = result.token;
|
|
78
|
+
const page = result.data;
|
|
79
|
+
found = page.found;
|
|
80
|
+
nextPage = page.nextPage;
|
|
81
|
+
console.error("nextPage", nextPage, "Records:", page.items?.length, "Time:", page.items?.[0]?.time);
|
|
82
|
+
// Prevent infinite looping
|
|
83
|
+
if (nextPage === lastSeenPage) {
|
|
84
|
+
repeatedPageCount++;
|
|
85
|
+
if (repeatedPageCount > 10) {
|
|
86
|
+
console.warn("⚠️ Pagination repeating same page more than 10 times. Stopping.");
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
lastSeenPage = nextPage;
|
|
92
|
+
repeatedPageCount = 0;
|
|
93
|
+
}
|
|
94
|
+
// Add events
|
|
95
|
+
if (page.items) {
|
|
96
|
+
if (!processEventItems(page.items, sinceDate, events)) {
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
console.warn("⚠️ No items found in page. Stopping.");
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// Save CSV
|
|
106
|
+
const ts = Math.floor(Date.now() / 1000);
|
|
107
|
+
const filename = `events-${sinceDate}_${ts}.csv`;
|
|
108
|
+
const fullPath = path_1.default.resolve(filename);
|
|
109
|
+
if (!onlyData) {
|
|
110
|
+
(0, utilities_1.saveCsv)(events, fullPath);
|
|
111
|
+
console.log(`✅ Saved ${events.length} events to: ${fullPath}`);
|
|
112
|
+
}
|
|
113
|
+
return events;
|
|
114
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * as Activity from './activities';
|
|
2
2
|
export * as ActivityInventories from './activityInventories';
|
|
3
|
+
export * as Events from './events';
|
|
3
4
|
export * as InventoryType from './inventoryTypes';
|
|
4
5
|
export * as OauthTokenService from './oauthTokenService';
|
|
5
6
|
export * as Resource from './resources';
|
|
@@ -10,10 +11,11 @@ export * from './types';
|
|
|
10
11
|
export { getOAuthToken } from './oauthTokenService';
|
|
11
12
|
export { downloadWorkZoneCSV } from './workZones';
|
|
12
13
|
export { downloadAllResourcesCSV } from './resources';
|
|
13
|
-
export { downloadAllUsersCSV } from './users';
|
|
14
|
+
export { downloadAllUsersCSV, generateUsersCollaborationCSV } from './users';
|
|
14
15
|
export { downloadAllInventoryTypesCSV, getInventoryTypesDetail, updateCreateInventoryType } from './inventoryTypes';
|
|
15
16
|
export { getAllActivities } from './activities';
|
|
16
17
|
export { createActivityCustomerInventories, getActivityCustomerInventories } from './activityInventories';
|
|
18
|
+
export { downloadAllEventsOfDay, downloadAllEventsOfDayCSV } from './events';
|
|
17
19
|
declare const OfscUtility: {
|
|
18
20
|
getOAuthToken: any;
|
|
19
21
|
downloadWorkZoneCSV: any;
|
|
@@ -25,5 +27,8 @@ declare const OfscUtility: {
|
|
|
25
27
|
getAllActivities: any;
|
|
26
28
|
getActivityCustomerInventories: any;
|
|
27
29
|
createActivityCustomerInventories: any;
|
|
30
|
+
downloadAllEventsOfDayCSV: any;
|
|
31
|
+
downloadAllEventsOfDay: any;
|
|
32
|
+
generateUsersCollaborationCSV: any;
|
|
28
33
|
};
|
|
29
34
|
export default OfscUtility;
|
package/dist/index.js
CHANGED
|
@@ -36,10 +36,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
36
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.getActivityCustomerInventories = exports.createActivityCustomerInventories = exports.getAllActivities = exports.updateCreateInventoryType = exports.getInventoryTypesDetail = exports.downloadAllInventoryTypesCSV = exports.downloadAllUsersCSV = exports.downloadAllResourcesCSV = exports.downloadWorkZoneCSV = exports.getOAuthToken = exports.WorkZone = exports.CSV = exports.User = exports.Resource = exports.OauthTokenService = exports.InventoryType = exports.ActivityInventories = exports.Activity = void 0;
|
|
39
|
+
exports.downloadAllEventsOfDayCSV = exports.downloadAllEventsOfDay = exports.getActivityCustomerInventories = exports.createActivityCustomerInventories = exports.getAllActivities = exports.updateCreateInventoryType = exports.getInventoryTypesDetail = exports.downloadAllInventoryTypesCSV = exports.generateUsersCollaborationCSV = exports.downloadAllUsersCSV = exports.downloadAllResourcesCSV = exports.downloadWorkZoneCSV = exports.getOAuthToken = exports.WorkZone = exports.CSV = exports.User = exports.Resource = exports.OauthTokenService = exports.InventoryType = exports.Events = exports.ActivityInventories = exports.Activity = void 0;
|
|
40
40
|
// Export all methods grouped by category
|
|
41
41
|
exports.Activity = __importStar(require("./activities"));
|
|
42
42
|
exports.ActivityInventories = __importStar(require("./activityInventories"));
|
|
43
|
+
exports.Events = __importStar(require("./events"));
|
|
43
44
|
exports.InventoryType = __importStar(require("./inventoryTypes"));
|
|
44
45
|
exports.OauthTokenService = __importStar(require("./oauthTokenService"));
|
|
45
46
|
exports.Resource = __importStar(require("./resources"));
|
|
@@ -57,6 +58,7 @@ var resources_1 = require("./resources");
|
|
|
57
58
|
Object.defineProperty(exports, "downloadAllResourcesCSV", { enumerable: true, get: function () { return resources_1.downloadAllResourcesCSV; } });
|
|
58
59
|
var users_1 = require("./users");
|
|
59
60
|
Object.defineProperty(exports, "downloadAllUsersCSV", { enumerable: true, get: function () { return users_1.downloadAllUsersCSV; } });
|
|
61
|
+
Object.defineProperty(exports, "generateUsersCollaborationCSV", { enumerable: true, get: function () { return users_1.generateUsersCollaborationCSV; } });
|
|
60
62
|
var inventoryTypes_1 = require("./inventoryTypes");
|
|
61
63
|
Object.defineProperty(exports, "downloadAllInventoryTypesCSV", { enumerable: true, get: function () { return inventoryTypes_1.downloadAllInventoryTypesCSV; } });
|
|
62
64
|
Object.defineProperty(exports, "getInventoryTypesDetail", { enumerable: true, get: function () { return inventoryTypes_1.getInventoryTypesDetail; } });
|
|
@@ -66,6 +68,9 @@ Object.defineProperty(exports, "getAllActivities", { enumerable: true, get: func
|
|
|
66
68
|
var activityInventories_1 = require("./activityInventories");
|
|
67
69
|
Object.defineProperty(exports, "createActivityCustomerInventories", { enumerable: true, get: function () { return activityInventories_1.createActivityCustomerInventories; } });
|
|
68
70
|
Object.defineProperty(exports, "getActivityCustomerInventories", { enumerable: true, get: function () { return activityInventories_1.getActivityCustomerInventories; } });
|
|
71
|
+
var events_1 = require("./events");
|
|
72
|
+
Object.defineProperty(exports, "downloadAllEventsOfDay", { enumerable: true, get: function () { return events_1.downloadAllEventsOfDay; } });
|
|
73
|
+
Object.defineProperty(exports, "downloadAllEventsOfDayCSV", { enumerable: true, get: function () { return events_1.downloadAllEventsOfDayCSV; } });
|
|
69
74
|
// Default export with all functionality
|
|
70
75
|
const OfscUtility = {
|
|
71
76
|
getOAuthToken: require('./oauthTokenService').getOAuthToken,
|
|
@@ -77,6 +82,9 @@ const OfscUtility = {
|
|
|
77
82
|
updateInventoryType: require('./inventoryTypes').updateInventoryType,
|
|
78
83
|
getAllActivities: require('./activities').getAllActivities,
|
|
79
84
|
getActivityCustomerInventories: require('./activityInventories').getActivityCustomerInventories,
|
|
80
|
-
createActivityCustomerInventories: require('./activityInventories').createActivityCustomerInventories
|
|
85
|
+
createActivityCustomerInventories: require('./activityInventories').createActivityCustomerInventories,
|
|
86
|
+
downloadAllEventsOfDayCSV: require('./events').downloadAllEventsOfDayCSV,
|
|
87
|
+
downloadAllEventsOfDay: require('./events').downloadAllEventsOfDay,
|
|
88
|
+
generateUsersCollaborationCSV: require('./users').generateUsersCollaborationCSV
|
|
81
89
|
};
|
|
82
90
|
exports.default = OfscUtility;
|
package/dist/types.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function generateUsersCollaborationCSV(clientId: string, clientSecret: string, instanceUrl: string): Promise<void>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateUsersCollaborationCSV = generateUsersCollaborationCSV;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const utilities_1 = require("../utilities");
|
|
9
|
+
async function generateUsersCollaborationCSV(clientId, clientSecret, instanceUrl) {
|
|
10
|
+
let offset = 0;
|
|
11
|
+
const limit = 100;
|
|
12
|
+
const allUsers = [];
|
|
13
|
+
let token = "";
|
|
14
|
+
console.log("🚀 Starting Users Collaboration Groups export...");
|
|
15
|
+
console.log("--------------------------------------------------");
|
|
16
|
+
while (true) {
|
|
17
|
+
const usersUrl = `https://${instanceUrl}.fs.ocs.oraclecloud.com/rest/ofscCore/v1/users/?offset=${offset}&limit=${limit}`;
|
|
18
|
+
console.log(`➡️ Fetching users offset=${offset}`);
|
|
19
|
+
const res = await (0, utilities_1.fetchWithRetry)(usersUrl, clientId, clientSecret, instanceUrl, token);
|
|
20
|
+
token = res.token;
|
|
21
|
+
const data = res.data;
|
|
22
|
+
if (!data?.items?.length) {
|
|
23
|
+
console.warn("⚠ No user items returned. Breaking.");
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
allUsers.push(...data.items);
|
|
27
|
+
console.log(` ✔ Received ${data.items.length} users (Total: ${allUsers.length})`);
|
|
28
|
+
if (offset + limit >= data.totalResults)
|
|
29
|
+
break;
|
|
30
|
+
offset += limit;
|
|
31
|
+
}
|
|
32
|
+
console.log("--------------------------------------------------");
|
|
33
|
+
console.log(`🧩 Total users to process: ${allUsers.length}`);
|
|
34
|
+
console.log("--------------------------------------------------");
|
|
35
|
+
// 2. Fetch collaboration groups for each user
|
|
36
|
+
const rows = [];
|
|
37
|
+
for (const user of allUsers) {
|
|
38
|
+
console.log(`👤 Fetching groups for ${user.login}`);
|
|
39
|
+
if (user.status !== "active") {
|
|
40
|
+
console.log(` ⚠ Skipping inactive user ${user.login}`);
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
const groupUrl = `https://${instanceUrl}.fs.ocs.oraclecloud.com/rest/ofscCore/v1/users/${user.login}/collaborationGroups`;
|
|
45
|
+
const res = await (0, utilities_1.fetchWithRetry)(groupUrl, clientId, clientSecret, instanceUrl, token);
|
|
46
|
+
token = res.token;
|
|
47
|
+
const groupData = res.data;
|
|
48
|
+
const groups = groupData?.items ?? [];
|
|
49
|
+
if (groups.length === 0) {
|
|
50
|
+
console.log(` ⚠ No groups found for ${user.login}`);
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
for (const group of groups) {
|
|
54
|
+
rows.push({ ...group, login: user.login, userType: user.userType, timeZoneIANA: user.timeZoneIANA, userName: user.name });
|
|
55
|
+
}
|
|
56
|
+
console.log(` ✔ Found ${groups.length} groups`);
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
console.error(`❌ Error fetching groups for ${user.login}:`, err);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
console.log("--------------------------------------------------");
|
|
63
|
+
console.log(`📦 Total rows: ${rows.length}`);
|
|
64
|
+
console.log("--------------------------------------------------");
|
|
65
|
+
const ts = Math.floor(Date.now() / 1000);
|
|
66
|
+
const filename = `collaborationGroups_${ts}.csv`;
|
|
67
|
+
const fullPath = path_1.default.resolve(filename);
|
|
68
|
+
(0, utilities_1.saveCsv)(rows, filename);
|
|
69
|
+
console.log(`📁 CSV saved: ${fullPath}`);
|
|
70
|
+
}
|
package/dist/users/index.d.ts
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
1
|
export declare function downloadAllUsersCSV(clientId: string, clientSecret: string, instanceUrl: string): Promise<void>;
|
|
2
|
+
export { generateUsersCollaborationCSV } from './collaborationGroups';
|
|
3
|
+
declare const OfscUserUtility: {
|
|
4
|
+
generateUsersCollaborationCSV: any;
|
|
5
|
+
downloadAllUsersCSV: typeof downloadAllUsersCSV;
|
|
6
|
+
};
|
|
7
|
+
export default OfscUserUtility;
|
package/dist/users/index.js
CHANGED
|
@@ -36,6 +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.generateUsersCollaborationCSV = void 0;
|
|
39
40
|
exports.downloadAllUsersCSV = downloadAllUsersCSV;
|
|
40
41
|
const fs = __importStar(require("fs"));
|
|
41
42
|
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
@@ -113,3 +114,10 @@ async function downloadAllUsersCSV(clientId, clientSecret, instanceUrl) {
|
|
|
113
114
|
console.log(`🧩 Date Time: ${new Date()}`);
|
|
114
115
|
console.log("-------------------------------------");
|
|
115
116
|
}
|
|
117
|
+
var collaborationGroups_1 = require("./collaborationGroups");
|
|
118
|
+
Object.defineProperty(exports, "generateUsersCollaborationCSV", { enumerable: true, get: function () { return collaborationGroups_1.generateUsersCollaborationCSV; } });
|
|
119
|
+
const OfscUserUtility = {
|
|
120
|
+
generateUsersCollaborationCSV: require('./collaborationGroups').generateUsersCollaborationCSV,
|
|
121
|
+
downloadAllUsersCSV
|
|
122
|
+
};
|
|
123
|
+
exports.default = OfscUserUtility;
|
package/dist/utilities/index.js
CHANGED
|
@@ -74,6 +74,9 @@ function saveCsv(rows, filePath) {
|
|
|
74
74
|
function escapeCsvValue(value) {
|
|
75
75
|
if (value == null)
|
|
76
76
|
return "";
|
|
77
|
+
if (typeof value === "object") {
|
|
78
|
+
value = JSON.stringify(value);
|
|
79
|
+
}
|
|
77
80
|
const str = String(value);
|
|
78
81
|
// Wrap in quotes if needed
|
|
79
82
|
if (str.includes(",") || str.includes('"') || str.includes("\n")) {
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -25,10 +25,12 @@ Please see the code snippet below.
|
|
|
25
25
|
|
|
26
26
|
#### csv
|
|
27
27
|
|
|
28
|
-
downloadWorkZoneCSV(
|
|
29
|
-
downloadAllResourcesCSV(
|
|
30
|
-
downloadAllUsersCSV(
|
|
31
|
-
downloadAllInventoryTypesCSV(
|
|
28
|
+
downloadWorkZoneCSV(process.env.clientID, process.env.clientSecreat, process.env.instanceId)
|
|
29
|
+
downloadAllResourcesCSV(process.env.clientID, process.env.clientSecreat, process.env.instanceId)
|
|
30
|
+
downloadAllUsersCSV(process.env.clientID, process.env.clientSecreat, process.env.instanceId)
|
|
31
|
+
downloadAllInventoryTypesCSV(process.env.clientID, process.env.clientSecreat, process.env.instanceId)
|
|
32
|
+
downloadAllEventsOfDayCSV(process.env.clientID, process.env.clientSecreat, process.env.instanceId, process.env.subscriptionId,"2025-12-05")
|
|
33
|
+
generateUsersCollaborationCSV(process.env.clientID, process.env.clientSecreat, process.env.instanceId) // all Collaboration groups of a user
|
|
32
34
|
|
|
33
35
|
#### records
|
|
34
36
|
|
|
@@ -38,6 +40,7 @@ Please see the code snippet below.
|
|
|
38
40
|
getAllActivities("clientId", "clientSecret", "instanceId"."resources","dateFrom","dateTo","q","fields")
|
|
39
41
|
getActivityCustomerInventories("clientId", "clientSecret", "instanceId"."activityId")
|
|
40
42
|
createActivityCustomerInventories( "clientId", "clientSecret", "instanceId"."activityId","payload")
|
|
43
|
+
downloadAllEventsOfDay(process.env.clientID, process.env.clientSecreat, process.env.instanceId, process.env.subscriptionId,"2025-12-05")
|
|
41
44
|
|
|
42
45
|
## Usage
|
|
43
46
|
|
|
@@ -45,6 +48,17 @@ downloadWorkZoneCSV("bot", "XXXXXXXXX", "compXXX.test")
|
|
|
45
48
|
|
|
46
49
|
### CommonJS
|
|
47
50
|
|
|
51
|
+
```js
|
|
52
|
+
const ofs = require("ofsc-utility");
|
|
53
|
+
|
|
54
|
+
ofs.User.generateUsersCollaborationCSV(
|
|
55
|
+
process.env.clientID,
|
|
56
|
+
process.env.clientSecreat,
|
|
57
|
+
process.env.instanceId,
|
|
58
|
+
process.env.subscriptionId
|
|
59
|
+
);
|
|
60
|
+
```
|
|
61
|
+
|
|
48
62
|
```js
|
|
49
63
|
async function run() {
|
|
50
64
|
let data = await ofs.InventoryType.getInventoryTypesDetail("clientId", "clientSecret", "instanceId", "inventory_label");
|
|
@@ -168,6 +182,17 @@ ofs.getActivityCustomerInventories("CLIENT_ID", "CLIENT_SECRET", "INSTANCE_URL",
|
|
|
168
182
|
});
|
|
169
183
|
```
|
|
170
184
|
|
|
185
|
+
```js
|
|
186
|
+
const ofs = require("ofsc-utility");
|
|
187
|
+
ofs.Events.downloadAllEventsOfDayCSV(
|
|
188
|
+
process.env.clientID,
|
|
189
|
+
process.env.clientSecreat,
|
|
190
|
+
process.env.instanceId,
|
|
191
|
+
process.env.subscriptionId,
|
|
192
|
+
"2025-12-05"
|
|
193
|
+
);
|
|
194
|
+
```
|
|
195
|
+
|
|
171
196
|
## License
|
|
172
197
|
|
|
173
198
|
MIT
|