ofsc-utility 1.0.23 → 1.0.25

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.
@@ -39,6 +39,10 @@ export declare function generateHash(item: {
39
39
  resourceId: string | number;
40
40
  };
41
41
  requestChanges?: unknown;
42
+ userDetails?: {
43
+ login: string;
44
+ status: string;
45
+ };
42
46
  }): string;
43
47
  /**
44
48
  * Events of last two minutes
@@ -116,7 +116,7 @@ function processEventItems(items, sinceDate, output) {
116
116
  // Add activityId as first level field
117
117
  const activityId = item.activityDetails?.activityId ?? null;
118
118
  item["uniqueId"] = generateHash(item);
119
- item["Change"] = item.activityChanges || item.inventoryChanges || item.requestChanges || {};
119
+ item["Change"] = item.activityChanges || item.inventoryChanges || item.requestChanges || item.userChanges || {};
120
120
  item["Id"] = item.activityId || item.resourceDetails?.resourceId || '-';
121
121
  output.push({ activityId, ...item });
122
122
  }
@@ -258,7 +258,7 @@ function generateHash(item) {
258
258
  .createHash("sha256")
259
259
  .update(stableStringify({
260
260
  eventType: item.eventType,
261
- activityId: item.activityId || item.resourceDetails.resourceId,
261
+ activityId: item.activityId || item.resourceDetails?.resourceId || item.userDetails?.login || '-',
262
262
  time: item.time,
263
263
  activityChanges: item.activityChanges || item.inventoryChanges || item.requestChanges || {},
264
264
  }))
@@ -346,8 +346,8 @@ async function downloadAllEventsOfDLastTwoMinutes(clientId, clientSecret, instan
346
346
  }
347
347
  for (let k of page.items) {
348
348
  k["uniqueId"] = generateHash(k);
349
- k["Change"] = k.activityChanges || k.inventoryChanges || k.requestChanges || {};
350
- k["Id"] = k.activityId || k.resourceDetails?.resourceId || '-';
349
+ k["Change"] = k.activityChanges || k.inventoryChanges || k.requestChanges || k.userChanges || {};
350
+ k["Id"] = k.activityId || k.resourceDetails?.resourceId || `${k.userDetails?.login}(${k.userDetails?.status})` || '-';
351
351
  events.push(k);
352
352
  }
353
353
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ofsc-utility",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "A wrapper for Oracle Field Service REST API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",