ofsc-utility 1.0.7 → 1.0.9

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.
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Fetches all activities from the OFSC instance.
3
+ *
4
+ * @param {string} clientId - The OFSC client ID.
5
+ * @param {string} clientSecret - The OFSC client secret.
6
+ * @param {string} instanceUrl - The OFSC instance URL.
7
+ * @param {string} [q] - The query string to filter activities.
8
+ * @param {string} [resources] - The resources to filter activities by. Required.
9
+ * @param {string} [fields] - The fields to include in the response.
10
+ * @param {string} [dateFrom] - The date from which to filter activities.
11
+ * @param {string} [dateTo] - The date to which to filter activities.
12
+ * @returns {Promise<any[]>} A promise which resolves to an array of activity objects.
13
+ * @throws {Error} If the date format is invalid or if the resources parameter is missing.
14
+ */
15
+ export declare function getAllActivities(clientId: string, clientSecret: string, instanceUrl: string, resources: string, dateFrom: string, dateTo: string, q?: string, fields?: string): Promise<any[]>;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAllActivities = getAllActivities;
4
+ const oauthTokenService_1 = require("../oauthTokenService");
5
+ // Validate YYYY-MM-DD format
6
+ const isValidDate = (date) => /^\d{4}-\d{2}-\d{2}$/.test(date);
7
+ /**
8
+ * Fetches all activities from the OFSC instance.
9
+ *
10
+ * @param {string} clientId - The OFSC client ID.
11
+ * @param {string} clientSecret - The OFSC client secret.
12
+ * @param {string} instanceUrl - The OFSC instance URL.
13
+ * @param {string} [q] - The query string to filter activities.
14
+ * @param {string} [resources] - The resources to filter activities by. Required.
15
+ * @param {string} [fields] - The fields to include in the response.
16
+ * @param {string} [dateFrom] - The date from which to filter activities.
17
+ * @param {string} [dateTo] - The date to which to filter activities.
18
+ * @returns {Promise<any[]>} A promise which resolves to an array of activity objects.
19
+ * @throws {Error} If the date format is invalid or if the resources parameter is missing.
20
+ */
21
+ async function getAllActivities(clientId, clientSecret, instanceUrl, resources, dateFrom, dateTo, q, fields) {
22
+ // Validate date inputs
23
+ if (!isValidDate(dateFrom) || !isValidDate(dateTo)) {
24
+ throw new Error(`❌ Invalid date format. Expected YYYY-MM-DD.`);
25
+ }
26
+ const limit = 100;
27
+ let offset = 0;
28
+ const allItems = [];
29
+ // Prepare reusable token
30
+ const token = await (0, oauthTokenService_1.getOAuthToken)(clientId, clientSecret, instanceUrl);
31
+ while (true) {
32
+ // Build URL cleanly
33
+ const params = new URLSearchParams({
34
+ offset: offset.toString(),
35
+ limit: limit.toString()
36
+ });
37
+ if (q)
38
+ params.append("q", q);
39
+ if (resources)
40
+ params.append("resources", resources);
41
+ if (fields)
42
+ params.append("fields", fields);
43
+ if (dateFrom)
44
+ params.append("dateFrom", dateFrom);
45
+ if (dateTo)
46
+ params.append("dateTo", dateTo);
47
+ const url = `https://${instanceUrl}.fs.ocs.oraclecloud.com/rest/ofscCore/v1/activities/?${params.toString()}`;
48
+ console.error(url);
49
+ console.log(`➡️ Fetching offset=${offset}, limit=${limit}`);
50
+ const res = await fetch(url, {
51
+ method: "GET",
52
+ headers: {
53
+ Authorization: `Bearer ${token}`,
54
+ Accept: "application/json"
55
+ }
56
+ });
57
+ if (!res.ok) {
58
+ const data = (await res.json());
59
+ throw new Error(`❌ Fetch failed: ${res.status} ${res.statusText}\n` +
60
+ `Response: ${JSON.stringify(data, null, 2)}`);
61
+ }
62
+ const data = (await res.json());
63
+ if (!data.items || data.items.length === 0) {
64
+ console.log("✔ No more items found. Stopping pagination.");
65
+ break;
66
+ }
67
+ allItems.push(...data.items);
68
+ console.log(` ✔ Received ${data.items.length} items (Total: ${allItems.length})`);
69
+ offset += limit;
70
+ }
71
+ return allItems;
72
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Fetches all customer inventories related to the given activity.
3
+ *
4
+ * @param {string} clientId - The OFSC client ID.
5
+ * @param {string} clientSecret - The OFSC client secret.
6
+ * @param {string} instanceUrl - The OFSC instance URL.
7
+ * @param {string} activityId - The ID of the activity to fetch customer inventories for.
8
+ *
9
+ * @returns {Promise<any[]>} A promise which resolves to an array of customer inventory objects.
10
+ */
11
+ export declare function getActivityCustomerInventories(clientId: string, clientSecret: string, instanceUrl: string, activityId: string): Promise<any[]>;
12
+ /**
13
+ * Creates a new customer inventory related to the given activity.
14
+ *
15
+ * @param {string} clientId - The OFSC client ID.
16
+ * @param {string} clientSecret - The OFSC client secret.
17
+ * @param {string} instanceUrl - The OFSC instance URL.
18
+ * @param {string} activityId - The ID of the activity to create a customer inventory for.
19
+ * @param {object} payload - The customer inventory payload.
20
+ *
21
+ * @returns {Promise<object>} A promise which resolves to the created customer inventory object.
22
+ */
23
+ export declare function createActivityCustomerInventories(clientId: string, clientSecret: string, instanceUrl: string, activityId: string, payload: {}): Promise<{}>;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getActivityCustomerInventories = getActivityCustomerInventories;
4
+ exports.createActivityCustomerInventories = createActivityCustomerInventories;
5
+ const oauthTokenService_1 = require("../oauthTokenService");
6
+ const utilities_1 = require("../utilities");
7
+ /**
8
+ * Fetches all customer inventories related to the given activity.
9
+ *
10
+ * @param {string} clientId - The OFSC client ID.
11
+ * @param {string} clientSecret - The OFSC client secret.
12
+ * @param {string} instanceUrl - The OFSC instance URL.
13
+ * @param {string} activityId - The ID of the activity to fetch customer inventories for.
14
+ *
15
+ * @returns {Promise<any[]>} A promise which resolves to an array of customer inventory objects.
16
+ */
17
+ async function getActivityCustomerInventories(clientId, clientSecret, instanceUrl, activityId) {
18
+ const limit = 100;
19
+ let offset = 0;
20
+ let token = await (0, oauthTokenService_1.getOAuthToken)(clientId, clientSecret, instanceUrl);
21
+ const allItems = [];
22
+ const fetchCustomerInventories = async (offset) => {
23
+ const params = new URLSearchParams({
24
+ offset: offset.toString(),
25
+ limit: limit.toString()
26
+ });
27
+ const url = `https://${instanceUrl}.fs.ocs.oraclecloud.com/rest/ofscCore/v1/activities/${activityId}/customerInventories?${params}`;
28
+ console.log(`➡️ Fetching offset=${offset}, limit=${limit}`);
29
+ const response = await (0, utilities_1.fetchWithRetry)(url, clientId, clientSecret, instanceUrl, token);
30
+ token = response.token;
31
+ const data = response.data;
32
+ if (!data.items || data.items.length === 0) {
33
+ // console.log("✔ No more items found. Stopping pagination.");
34
+ return;
35
+ }
36
+ allItems.push(...data.items);
37
+ console.log(` ✔ Received ${data.items.length} items (Total: ${allItems.length}) for activity ${activityId}`);
38
+ await fetchCustomerInventories(offset + limit);
39
+ };
40
+ await fetchCustomerInventories(offset);
41
+ return allItems;
42
+ }
43
+ /**
44
+ * Creates a new customer inventory related to the given activity.
45
+ *
46
+ * @param {string} clientId - The OFSC client ID.
47
+ * @param {string} clientSecret - The OFSC client secret.
48
+ * @param {string} instanceUrl - The OFSC instance URL.
49
+ * @param {string} activityId - The ID of the activity to create a customer inventory for.
50
+ * @param {object} payload - The customer inventory payload.
51
+ *
52
+ * @returns {Promise<object>} A promise which resolves to the created customer inventory object.
53
+ */
54
+ async function createActivityCustomerInventories(clientId, clientSecret, instanceUrl, activityId, payload) {
55
+ const url = `https://${instanceUrl}.fs.ocs.oraclecloud.com/rest/ofscCore/v1/activities/${activityId}/customerInventories`;
56
+ const token = await (0, oauthTokenService_1.getOAuthToken)(clientId, clientSecret, instanceUrl);
57
+ const res = await fetch(url, {
58
+ method: "POST",
59
+ headers: {
60
+ Authorization: `Bearer ${token}`,
61
+ Accept: "application/json",
62
+ "Content-Type": "application/json"
63
+ },
64
+ body: JSON.stringify(payload)
65
+ });
66
+ if (!res.ok) {
67
+ throw new Error(`❌ POST failed: ${res.status} ${res.statusText}`);
68
+ }
69
+ return await res.json();
70
+ }
package/dist/index.d.ts CHANGED
@@ -1,7 +1,10 @@
1
+ export * as Activity from './activities';
2
+ export * as ActivityInventories from './activityInventories';
1
3
  export * as InventoryType from './inventoryTypes';
2
4
  export * as OauthTokenService from './oauthTokenService';
3
5
  export * as Resource from './resources';
4
6
  export * as User from './users';
7
+ export * as CSV from './utilities';
5
8
  export * as WorkZone from './workZones';
6
9
  export * from './types';
7
10
  export { getOAuthToken } from './oauthTokenService';
@@ -9,6 +12,8 @@ export { downloadWorkZoneCSV } from './workZones';
9
12
  export { downloadAllResourcesCSV } from './resources';
10
13
  export { downloadAllUsersCSV } from './users';
11
14
  export { downloadAllInventoryTypesCSV, getInventoryTypesDetail, updateCreateInventoryType } from './inventoryTypes';
15
+ export { getAllActivities } from './activities';
16
+ export { createActivityCustomerInventories, getActivityCustomerInventories } from './activityInventories';
12
17
  declare const OfscUtility: {
13
18
  getOAuthToken: any;
14
19
  downloadWorkZoneCSV: any;
@@ -17,5 +22,8 @@ declare const OfscUtility: {
17
22
  downloadAllInventoryTypesCSV: any;
18
23
  getInventoryTypesDetail: any;
19
24
  updateInventoryType: any;
25
+ getAllActivities: any;
26
+ getActivityCustomerInventories: any;
27
+ createActivityCustomerInventories: any;
20
28
  };
21
29
  export default OfscUtility;
package/dist/index.js CHANGED
@@ -36,12 +36,15 @@ 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.updateCreateInventoryType = exports.getInventoryTypesDetail = exports.downloadAllInventoryTypesCSV = exports.downloadAllUsersCSV = exports.downloadAllResourcesCSV = exports.downloadWorkZoneCSV = exports.getOAuthToken = exports.WorkZone = exports.User = exports.Resource = exports.OauthTokenService = exports.InventoryType = void 0;
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;
40
40
  // Export all methods grouped by category
41
+ exports.Activity = __importStar(require("./activities"));
42
+ exports.ActivityInventories = __importStar(require("./activityInventories"));
41
43
  exports.InventoryType = __importStar(require("./inventoryTypes"));
42
44
  exports.OauthTokenService = __importStar(require("./oauthTokenService"));
43
45
  exports.Resource = __importStar(require("./resources"));
44
46
  exports.User = __importStar(require("./users"));
47
+ exports.CSV = __importStar(require("./utilities"));
45
48
  exports.WorkZone = __importStar(require("./workZones"));
46
49
  // Export types
47
50
  __exportStar(require("./types"), exports);
@@ -58,15 +61,22 @@ var inventoryTypes_1 = require("./inventoryTypes");
58
61
  Object.defineProperty(exports, "downloadAllInventoryTypesCSV", { enumerable: true, get: function () { return inventoryTypes_1.downloadAllInventoryTypesCSV; } });
59
62
  Object.defineProperty(exports, "getInventoryTypesDetail", { enumerable: true, get: function () { return inventoryTypes_1.getInventoryTypesDetail; } });
60
63
  Object.defineProperty(exports, "updateCreateInventoryType", { enumerable: true, get: function () { return inventoryTypes_1.updateCreateInventoryType; } });
64
+ var activities_1 = require("./activities");
65
+ Object.defineProperty(exports, "getAllActivities", { enumerable: true, get: function () { return activities_1.getAllActivities; } });
66
+ var activityInventories_1 = require("./activityInventories");
67
+ Object.defineProperty(exports, "createActivityCustomerInventories", { enumerable: true, get: function () { return activityInventories_1.createActivityCustomerInventories; } });
68
+ Object.defineProperty(exports, "getActivityCustomerInventories", { enumerable: true, get: function () { return activityInventories_1.getActivityCustomerInventories; } });
61
69
  // Default export with all functionality
62
70
  const OfscUtility = {
63
- // Case converters
64
71
  getOAuthToken: require('./oauthTokenService').getOAuthToken,
65
72
  downloadWorkZoneCSV: require('./workZones').downloadWorkZoneCSV,
66
73
  downloadAllResourcesCSV: require('./resources').downloadAllResourcesCSV,
67
74
  downloadAllUsersCSV: require('./resources').downloadAllUsersCSV,
68
75
  downloadAllInventoryTypesCSV: require('./inventoryTypes').downloadAllInventoryTypesCSV,
69
76
  getInventoryTypesDetail: require('./inventoryTypes').getInventoryTypesDetail,
70
- updateInventoryType: require('./inventoryTypes').updateInventoryType
77
+ updateInventoryType: require('./inventoryTypes').updateInventoryType,
78
+ getAllActivities: require('./activities').getAllActivities,
79
+ getActivityCustomerInventories: require('./activityInventories').getActivityCustomerInventories,
80
+ createActivityCustomerInventories: require('./activityInventories').createActivityCustomerInventories
71
81
  };
72
82
  exports.default = OfscUtility;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Fetches a URL with retry logic for expired tokens.
3
+ *
4
+ * @param {string} url - The URL to fetch.
5
+ * @param {string} clientId - The OFSC client ID.
6
+ * @param {string} clientSecret - The OFSC client secret.
7
+ * @param {string} instanceUrl - The OFSC instance URL.
8
+ * @param {string} token - The current OAuth token.
9
+ *
10
+ * @returns {Promise<{ data: any; token: string }>} A promise which resolves to an object containing the parsed JSON data and the latest OAuth token.
11
+ */
12
+ export declare const fetchWithRetry: (url: string, clientId: string, clientSecret: string, instanceUrl: string, token: string) => Promise<{
13
+ data: any;
14
+ token: string;
15
+ }>;
16
+ export declare function saveCsv<T extends Record<string, any>>(rows: T[], filePath: string): void;
@@ -1 +1,83 @@
1
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.fetchWithRetry = void 0;
7
+ exports.saveCsv = saveCsv;
8
+ const oauthTokenService_1 = require("../oauthTokenService");
9
+ /**
10
+ * Fetches a URL with retry logic for expired tokens.
11
+ *
12
+ * @param {string} url - The URL to fetch.
13
+ * @param {string} clientId - The OFSC client ID.
14
+ * @param {string} clientSecret - The OFSC client secret.
15
+ * @param {string} instanceUrl - The OFSC instance URL.
16
+ * @param {string} token - The current OAuth token.
17
+ *
18
+ * @returns {Promise<{ data: any; token: string }>} A promise which resolves to an object containing the parsed JSON data and the latest OAuth token.
19
+ */
20
+ const fetchWithRetry = async (url, clientId, clientSecret, instanceUrl, token) => {
21
+ const doFetch = async (bearer) => {
22
+ return fetch(url, {
23
+ method: "GET",
24
+ headers: {
25
+ Authorization: `Bearer ${bearer}`,
26
+ Accept: "application/json"
27
+ }
28
+ });
29
+ };
30
+ // Try with the current token
31
+ let res = await doFetch(token);
32
+ // If 401 → renew and retry
33
+ if (res.status === 401) {
34
+ console.warn("⚠️ Token expired — renewing token…");
35
+ token = await (0, oauthTokenService_1.getOAuthToken)(clientId, clientSecret, instanceUrl);
36
+ res = await doFetch(token);
37
+ }
38
+ // If still not OK → fail
39
+ if (!res.ok) {
40
+ const body = await res.text();
41
+ throw new Error(`❌ Request failed: ${res.status} ${res.statusText}\n${body}`);
42
+ }
43
+ // Return parsed JSON + latest token
44
+ return {
45
+ data: await res.json(),
46
+ token
47
+ };
48
+ };
49
+ exports.fetchWithRetry = fetchWithRetry;
50
+ const fs_1 = __importDefault(require("fs"));
51
+ const path_1 = __importDefault(require("path"));
52
+ function saveCsv(rows, filePath) {
53
+ if (!rows || rows.length === 0) {
54
+ throw new Error("CSV creation failed: no rows provided.");
55
+ }
56
+ // Extract headers from the first row
57
+ const headers = Object.keys(rows[0]);
58
+ // Build CSV content
59
+ const csvLines = [
60
+ headers.join(","), // header row
61
+ ...rows.map(row => headers.map(h => escapeCsvValue(row[h])).join(","))
62
+ ];
63
+ const csvContent = csvLines.join("\n");
64
+ // Ensure directory exists
65
+ const dir = path_1.default.dirname(filePath);
66
+ if (!fs_1.default.existsSync(dir)) {
67
+ fs_1.default.mkdirSync(dir, { recursive: true });
68
+ }
69
+ // Write the file
70
+ fs_1.default.writeFileSync(filePath, csvContent);
71
+ console.log(`CSV saved: ${filePath}`);
72
+ }
73
+ // Escape CSV fields
74
+ function escapeCsvValue(value) {
75
+ if (value == null)
76
+ return "";
77
+ const str = String(value);
78
+ // Wrap in quotes if needed
79
+ if (str.includes(",") || str.includes('"') || str.includes("\n")) {
80
+ return `"${str.replace(/"/g, '""')}"`;
81
+ }
82
+ return str;
83
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ofsc-utility",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "A wrapper for Oracle Field Service REST API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/readme.md CHANGED
@@ -21,37 +21,36 @@ npm install ofsc-utility
21
21
 
22
22
  ### Download
23
23
 
24
- #### csv
24
+ Please see the code snippet below.
25
+
26
+ #### csv
25
27
 
26
28
  downloadWorkZoneCSV("clientId", "clientSecret", "instanceId")
27
29
  downloadAllResourcesCSV("clientId", "clientSecret", "instanceId")
28
30
  downloadAllUsersCSV("clientId", "clientSecret", "instanceId")
29
31
  downloadAllInventoryTypesCSV("clientId", "clientSecret", "instanceId")
30
-
31
-
32
- #### records
32
+
33
+ #### records
33
34
 
34
35
  getOAuthToken("clientId", "clientSecret", "instanceId")
35
36
  getInventoryTypesDetail("clientId", "clientSecret", "instanceId"."inventory_label")
36
-
37
-
37
+ updateCreateInventoryType("clientId", "clientSecret", "instanceId"."inventory_label")
38
+ getAllActivities("clientId", "clientSecret", "instanceId"."resources","dateFrom","dateTo","q","fields")
39
+ getActivityCustomerInventories("clientId", "clientSecret", "instanceId"."activityId")
40
+ createActivityCustomerInventories( "clientId", "clientSecret", "instanceId"."activityId","payload")
38
41
 
39
42
  ## Usage
40
43
 
41
- downloadWorkZoneCSV("bot", "XXXXXXXXX", "compXXX.test")
44
+ downloadWorkZoneCSV("bot", "XXXXXXXXX", "compXXX.test")
42
45
 
43
46
  ### CommonJS
44
47
 
45
48
  ```js
46
-
47
- async function run (){
48
- let data = await ofs.InventoryType.getInventoryTypesDetail(
49
- "clientId", "clientSecret", "instanceId", "inventory_label");
50
- console.error(data);
49
+ async function run() {
50
+ let data = await ofs.InventoryType.getInventoryTypesDetail("clientId", "clientSecret", "instanceId", "inventory_label");
51
+ console.error(data);
51
52
  }
52
53
  run();
53
-
54
-
55
54
  ```
56
55
 
57
56
  ```js
@@ -106,44 +105,67 @@ ofs
106
105
  ```
107
106
 
108
107
  ```js
109
- const ofs = require('ofsc-utility');
108
+ const ofs = require("ofsc-utility");
110
109
 
111
110
  async function run() {
112
- const payload = {
113
- label: "inventory_label",
111
+ const payload = {
112
+ label: "inventory_label",
113
+ name: "Ordered Part",
114
+ unitOfMeasurement: "ea",
115
+ active: true,
116
+ nonSerialized: true,
117
+ modelProperty: "part_item_number_rev",
118
+ quantityPrecision: 0,
119
+ translations: [
120
+ {
121
+ language: "en",
114
122
  name: "Ordered Part",
115
123
  unitOfMeasurement: "ea",
116
- active: true,
117
- nonSerialized: true,
118
- modelProperty: "part_item_number_rev",
119
- quantityPrecision: 0,
120
- translations: [
121
- {
122
- language: "en",
123
- name: "Ordered Part",
124
- unitOfMeasurement: "ea",
125
- languageISO: "en-US"
126
- }
127
- ]
128
- };
129
-
130
- try {
131
- const result = await updateCreateInventoryType(
132
- "CLIENT_ID",
133
- "CLIENT_SECRET",
134
- "INSTANCE_URL",
135
- "inventory_label",
136
- payload
137
- );
138
-
139
- console.log("Updated:", result);
140
- } catch (err) {
141
- console.error(err);
142
- }
124
+ languageISO: "en-US",
125
+ },
126
+ ],
127
+ };
128
+
129
+ try {
130
+ const result = await updateCreateInventoryType("CLIENT_ID", "CLIENT_SECRET", "INSTANCE_URL", "inventory_label", payload);
131
+
132
+ console.log("Updated:", result);
133
+ } catch (err) {
134
+ console.error(err);
135
+ }
136
+ }
137
+
138
+ run();
139
+ ```
140
+
141
+ ```js
142
+ const ofs = require("ofsc-utility");
143
+ async function run() {
144
+ try {
145
+ const result = await ofs.getAllActivities(
146
+ (clientId = "CLIENT_ID"),
147
+ (clientSecret = "CLIENT_SECRET"),
148
+ (instanceUrl = "INSTANCE_URL"),
149
+ (resources = "US"),
150
+ (dateFrom = "2025-11-05"),
151
+ (dateTo = "2025-12-05"),
152
+ (q = "status=='pending' and ACTIVITY_NOTES!=''"),
153
+ (fields = "ACTIVITY_NOTES,status,activityId,activityType,date,resourceId")
154
+ );
155
+
156
+ console.log("Updated:", result);
157
+ } catch (err) {
158
+ console.error(err);
159
+ }
143
160
  }
144
161
 
145
162
  run();
163
+ ```
146
164
 
165
+ ```js
166
+ ofs.getActivityCustomerInventories("CLIENT_ID", "CLIENT_SECRET", "INSTANCE_URL", "activityId").then((data) => {
167
+ console.log(data);
168
+ });
147
169
  ```
148
170
 
149
171
  ## License