ofsc-utility 1.0.21 → 1.0.22

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.
@@ -34,6 +34,10 @@ export declare function generateHash(item: {
34
34
  activityId: string | number;
35
35
  time: string;
36
36
  activityChanges: unknown;
37
+ inventoryChanges?: unknown;
38
+ resourceDetails: {
39
+ resourceId: string | number;
40
+ };
37
41
  }): string;
38
42
  /**
39
43
  * Events of last two minutes
@@ -255,9 +255,9 @@ function generateHash(item) {
255
255
  .createHash("sha256")
256
256
  .update(stableStringify({
257
257
  eventType: item.eventType,
258
- activityId: item.activityId,
258
+ activityId: item.activityId || item.resourceDetails.resourceId,
259
259
  time: item.time,
260
- activityChanges: item.activityChanges,
260
+ activityChanges: item.activityChanges || item.inventoryChanges || {},
261
261
  }))
262
262
  .digest("hex");
263
263
  }
@@ -343,6 +343,8 @@ async function downloadAllEventsOfDLastTwoMinutes(clientId, clientSecret, instan
343
343
  }
344
344
  for (let k of page.items) {
345
345
  k["uniqueId"] = generateHash(k);
346
+ k["Change"] = k.activityChanges || k.inventoryChanges || {};
347
+ k["Id"] = k.activityId || k.resourceDetails?.resourceId || '-';
346
348
  events.push(k);
347
349
  }
348
350
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ofsc-utility",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "A wrapper for Oracle Field Service REST API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",