@plusscommunities/pluss-maintenance-aws-forms 2.1.23 → 2.1.24

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.
@@ -128,6 +128,7 @@ class ArchibusStrategy extends IntegrationStrategy {
128
128
  InternalId: request.id,
129
129
  ExternalId: response.data.wrId,
130
130
  TrackedData: {},
131
+ SystemType: "Archibus",
131
132
  });
132
133
 
133
134
  // Save the Archibus ID as the job number and add history entry
@@ -145,6 +146,7 @@ class ArchibusStrategy extends IntegrationStrategy {
145
146
  displayName: "Archibus Integration",
146
147
  id: "system",
147
148
  },
149
+ systemType: "Archibus",
148
150
  });
149
151
 
150
152
  await editRef(values.tableNameMaintenance, "id", request.id, {
@@ -181,6 +183,7 @@ class ArchibusStrategy extends IntegrationStrategy {
181
183
  displayName: "Archibus Integration",
182
184
  id: "system",
183
185
  },
186
+ systemType: "Archibus",
184
187
  });
185
188
 
186
189
  await editRef(values.tableNameMaintenance, "id", request.id, {
package/package-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-maintenance-aws-forms",
3
- "version": "2.1.23",
3
+ "version": "2.1.24",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-maintenance-aws-forms",
3
- "version": "2.1.23",
3
+ "version": "2.1.24",
4
4
  "description": "Extension package to enable maintenance on Pluss Communities Platform",
5
5
  "scripts": {
6
6
  "gc": "node ../../tools/gc ./",
@@ -100,51 +100,27 @@ module.exports = async (event, params) => {
100
100
 
101
101
  log("getExternalSync", "Authorised", true, logId);
102
102
 
103
- // Query externalentities table for this request
104
- // Check both SeeStuff and Archibus entity types
105
- const entityTypes = [
106
- `${values.serviceKey}_SeeStuff`,
107
- `${values.serviceKey}_Archibus`,
108
- ];
109
-
110
- log("getExternalSync", "CheckingEntityTypes", entityTypes, logId);
111
-
112
103
  let externalSync = null;
104
+ const query = await indexQuery("externalentities", {
105
+ IndexName: "OnlyInternalIdIndex",
106
+ KeyConditionExpression: "InternalId = :internalId",
107
+ ExpressionAttributeValues: {
108
+ ":internalId": request.id,
109
+ },
110
+ });
111
+
112
+ log("getExternalSync", "Results", query.Items.length, logId);
113
+
114
+ if (query.Items && query.Items.length > 0) {
115
+ const item = query.Items[0];
116
+ externalSync = {
117
+ systemType: item.SystemType,
118
+ externalId: item.ExternalId,
119
+ syncedAt: item.LastUpdated,
120
+ trackedData: item.TrackedData || {},
121
+ };
113
122
 
114
- // Check each external system type
115
- for (const entityType of entityTypes) {
116
- const query = await indexQuery("externalentities", {
117
- IndexName: "InternalIdIndex",
118
- KeyConditionExpression:
119
- "EntityType = :entityType AND InternalId = :internalId",
120
- ExpressionAttributeValues: {
121
- ":entityType": entityType,
122
- ":internalId": request.id,
123
- },
124
- });
125
-
126
- log(
127
- "getExternalSync",
128
- `${entityType}_Results`,
129
- query.Items.length,
130
- logId
131
- );
132
-
133
- if (query.Items && query.Items.length > 0) {
134
- const item = query.Items[0];
135
- // Extract system name from entity type (e.g., "maintenance_SeeStuff" -> "SeeStuff")
136
- const systemName = entityType.split("_")[1];
137
-
138
- externalSync = {
139
- externalSystem: systemName,
140
- externalId: item.ExternalId,
141
- syncedAt: item.LastUpdated,
142
- trackedData: item.TrackedData || {},
143
- };
144
-
145
- log("getExternalSync", "FoundSync", externalSync, logId);
146
- break; // Stop after finding first match
147
- }
123
+ log("getExternalSync", "FoundSync", externalSync, logId);
148
124
  }
149
125
 
150
126
  // If no external sync found, return 404
@@ -67,6 +67,7 @@ module.exports = async (event, data) => {
67
67
  LastUpdated: moment().valueOf(),
68
68
  TrackedData: data.trackedData || {},
69
69
  Site: job.site, // Store for site-specific queries
70
+ SystemType: data.systemType,
70
71
  });
71
72
 
72
73
  log(action, "ExternalEntityCreated", externalEntity, logId);
@@ -78,6 +79,7 @@ module.exports = async (event, data) => {
78
79
  EntryType: "ExternalIDSet",
79
80
  externalId: data.externalId,
80
81
  user,
82
+ systemType: data.systemType,
81
83
  });
82
84
 
83
85
  // 8. Update job with history and optionally update job number for system parity