@plusscommunities/pluss-maintenance-aws-forms 2.1.9-auth.0 → 2.1.10

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/editNote.js CHANGED
@@ -24,7 +24,7 @@ module.exports.editNote = (event, context, callback) => {
24
24
  }
25
25
  switch (data.action) {
26
26
  case "AddNote":
27
- if (!data.note && !data.attachments) {
27
+ if (!data.note && !data.attachments && !data.images) {
28
28
  return callback(
29
29
  null,
30
30
  generateJsonResponse(422, { error: { message: "Incomplete data" } })
@@ -40,7 +40,7 @@ module.exports.editNote = (event, context, callback) => {
40
40
  }
41
41
  break;
42
42
  case "EditNote":
43
- if ((!data.note && !data.attachments) || !data.noteId) {
43
+ if ((!data.note && !data.attachments && !data.images) || !data.noteId) {
44
44
  return callback(
45
45
  null,
46
46
  generateJsonResponse(422, { error: { message: "Incomplete data" } })
@@ -76,6 +76,7 @@ module.exports.editNote = (event, context, callback) => {
76
76
  User: user,
77
77
  Note: data.note,
78
78
  Attachments: data.attachments,
79
+ Images: data.images,
79
80
  });
80
81
  activityAction = values.activityAddMaintenanceNote;
81
82
  break;
@@ -99,6 +100,7 @@ module.exports.editNote = (event, context, callback) => {
99
100
  }
100
101
  note.Note = data.note;
101
102
  note.Attachments = data.attachments;
103
+ note.Images = data.images;
102
104
  activityAction = values.activityEditMaintenanceNote;
103
105
  break;
104
106
  default:
@@ -26,6 +26,21 @@ class IntegrationStrategy {
26
26
  return null;
27
27
  };
28
28
 
29
+ // actions taken when a request's status has changed
30
+ onStatusChanged = async (request) => {
31
+ return null;
32
+ };
33
+
34
+ // actions taken when a comment has been added to a request
35
+ onCommentAdded = async (request) => {
36
+ return null;
37
+ };
38
+
39
+ // actions taken when a note has been added to a request
40
+ onNotesAdded = async (request) => {
41
+ return null;
42
+ };
43
+
29
44
  // actions taken when a request is marked as completed
30
45
  onCompleteRequest = async (request) => {
31
46
  return null;
@@ -55,37 +55,40 @@ class ArchibusStrategy extends IntegrationStrategy {
55
55
  * Creates a request from the Archibus system
56
56
  *
57
57
  * @param {Object} request - Request definition on Pluss
58
+ * @param {Object} mockResponse - Mock response from Archibus to simulate response
58
59
  * @returns {Boolean} Whether the request was created on Archibus
59
60
  */
60
- createRequest = async (request) => {
61
+ createRequest = async (request, mockResponse = null) => {
61
62
  const logId = log("Archibus:CreateRequest", "Start", request);
62
63
  try {
63
- const response = await axios({
64
- method: "PUT",
65
- url: `${this.baseUrl}/createWorkRequest`,
66
- timeout: 15000,
67
- headers: {
68
- [this.apiKeyHeader]: this.apiKey,
69
- "Content-Type": "application/json",
70
- Host: this.host,
71
- },
72
- data: {
73
- prob_type: "1.ON-SITE|1. MAINTENANCE",
74
- requestor: "PLUSS",
75
- description: `${request.title}${
76
- _.isEmpty(request.description) ? "" : `\n\n${request.description}`
77
- }${_.isEmpty(request.room) ? "" : `\n\nLocation: ${request.room}`}${
78
- _.isEmpty(request.userName) ? "" : `\n\nName: ${request.userName}`
79
- }${_.isEmpty(request.phone) ? "" : `\n\nPhone: ${request.phone}`}${
80
- _.isEmpty(request.type) ? "" : `\n\nJob Type: ${request.type}`
81
- }${
82
- _.isEmpty(request.images)
83
- ? ""
84
- : `\n\nImages: ${request.images.join("\n")}`
85
- }`,
86
- site_id: "2025", //TODO need to do site mapping 2025 is WooloowareShores in prod
87
- },
88
- });
64
+ const response =
65
+ mockResponse ??
66
+ (await axios({
67
+ method: "PUT",
68
+ url: `${this.baseUrl}/createWorkRequest`,
69
+ timeout: 15000,
70
+ headers: {
71
+ [this.apiKeyHeader]: this.apiKey,
72
+ "Content-Type": "application/json",
73
+ Host: this.host,
74
+ },
75
+ data: {
76
+ prob_type: "1.ON-SITE|1. MAINTENANCE",
77
+ requestor: "PLUSS",
78
+ description: `${request.title}${
79
+ _.isEmpty(request.description) ? "" : `\n\n${request.description}`
80
+ }${_.isEmpty(request.room) ? "" : `\n\nLocation: ${request.room}`}${
81
+ _.isEmpty(request.userName) ? "" : `\n\nName: ${request.userName}`
82
+ }${_.isEmpty(request.phone) ? "" : `\n\nPhone: ${request.phone}`}${
83
+ _.isEmpty(request.type) ? "" : `\n\nJob Type: ${request.type}`
84
+ }${
85
+ _.isEmpty(request.images)
86
+ ? ""
87
+ : `\n\nImages: ${request.images.join("\n")}`
88
+ }`,
89
+ site_id: "2025", //TODO need to do site mapping 2025 is WooloowareShores in prod
90
+ },
91
+ }));
89
92
  log("Archibus:CreateRequest", "Response", response.data, logId);
90
93
 
91
94
  // Save the ID to external entities for future reference
@@ -105,7 +108,7 @@ class ArchibusStrategy extends IntegrationStrategy {
105
108
  });
106
109
 
107
110
  // add images
108
- if (!_.isEmpty(request.images)) {
111
+ if (!mockResponse && !_.isEmpty(request.images)) {
109
112
  const imagePromises = [];
110
113
  request.images.forEach((url) => {
111
114
  imagePromises.push(this.addFileToRequest(response.data.wrId, url));
@@ -350,114 +353,210 @@ class ArchibusStrategy extends IntegrationStrategy {
350
353
  };
351
354
 
352
355
  /**
356
+ * Get Archibus Id of the request
353
357
  *
354
358
  * @param {Object} request - Request definition on Pluss
355
- * @returns {Boolean} Represents whether the actions were successful
359
+ * @returns {Number} Id of the request on Archibus (null if not exists)
356
360
  */
357
- onCompleteRequest = async (request) => {
358
- const logId = log("Archibus:OnComplete", "Start", {
359
- Id: request.id,
361
+ getExternalId = async (request) => {
362
+ const logId = log("Archibus:GetExternalId", "Start", { Id: request.id });
363
+
364
+ // get external id
365
+ const externalEntityQuery = await indexQuery("externalentities", {
366
+ IndexName: "InternalIdIndex",
367
+ KeyConditionExpression:
368
+ "EntityType = :entityType AND InternalId = :internalId",
369
+ ExpressionAttributeValues: {
370
+ ":entityType": this.getEntityType(),
371
+ ":internalId": request.id,
372
+ },
360
373
  });
361
- try {
362
- // get external id
363
- const externalEntityQuery = await indexQuery("externalentities", {
364
- IndexName: "InternalIdIndex",
365
- KeyConditionExpression:
366
- "EntityType = :entityType AND InternalId = :internalId",
367
- ExpressionAttributeValues: {
368
- ":entityType": this.getEntityType(),
369
- ":internalId": request.id,
370
- },
371
- });
372
374
 
373
- log(
374
- "Archibus:OnComplete",
375
- "ExternalLength",
376
- externalEntityQuery.Items.length,
377
- logId
378
- );
379
- if (_.isEmpty(externalEntityQuery.Items)) {
380
- return true;
381
- }
375
+ log(
376
+ "Archibus:GetExternalId",
377
+ "ExternalLength",
378
+ externalEntityQuery.Items.length,
379
+ logId
380
+ );
381
+ if (_.isEmpty(externalEntityQuery.Items)) {
382
+ return null;
383
+ }
382
384
 
383
- const externalId = externalEntityQuery.Items[0].ExternalId;
384
- log("Archibus:OnComplete", "ExternalId", externalId, logId);
385
+ const externalId = externalEntityQuery.Items[0].ExternalId;
386
+ log("Archibus:GetExternalId", "ExternalId", externalId, logId);
385
387
 
386
- // get comments
387
- const commentsQuery = {
388
- IndexName: "CommentsEntityIdIndex",
389
- KeyConditionExpression: "EntityId = :groupId",
390
- ExpressionAttributeValues: {
391
- ":groupId": getRowId(request.id, values.serviceKey),
392
- },
393
- };
388
+ return externalId;
389
+ };
390
+
391
+ /**
392
+ * Get latest comment for a request
393
+ *
394
+ * @param {Object} request - Request definition on Pluss
395
+ * @param {String} entityKey - Request entity key (e.g. maintenancerequest)
396
+ * @returns {Object} Latest comment (null if not exists)
397
+ */
398
+ getLatestComment = async (request, entityKey) => {
399
+ const logId = log("Archibus:GetLatestComment", "Start", { Id: request.id });
400
+
401
+ // get comments
402
+ const commentsQuery = {
403
+ IndexName: "CommentsEntityIdIndex",
404
+ KeyConditionExpression: "EntityId = :groupId",
405
+ ExpressionAttributeValues: {
406
+ ":groupId": getRowId(request.id, entityKey),
407
+ },
408
+ };
409
+
410
+ const commentsQueryRes = await indexQuery("comments", commentsQuery);
411
+ const comments = _.orderBy(commentsQueryRes.Items, "Timestamp", "desc");
412
+ log(
413
+ "Archibus:GetLatestComment",
414
+ `CommentsLength - ${entityKey}`,
415
+ comments.length,
416
+ logId
417
+ );
394
418
 
395
- const commentsQueryRes = await indexQuery("comments", commentsQuery);
396
- const comments = commentsQueryRes.Items;
397
- log("Archibus:OnComplete", "CommentsLength", comments.length, logId);
419
+ return comments.length > 0 ? comments[0] : null;
420
+ };
398
421
 
399
- const promises = [];
422
+ /**
423
+ * Perform actions when a task's status has changed
424
+ *
425
+ * @param {Object} request - Request definition on Pluss
426
+ * @returns {Boolean} Represents whether the actions were successful
427
+ */
428
+ onStatusChanged = async (request) => {
429
+ const logId = log("Archibus:OnStatusChanged", "Start", { Id: request.id });
400
430
 
401
- // save history as a comment
402
- if (!_.isEmpty(request.history)) {
403
- const historyComment = _.map(request.history, (entry) => {
404
- if (entry.EntryType === "assignment") {
405
- return "";
406
- }
407
- const time = moment(Number.parseFloat(entry.timestamp + "")).format(
408
- "D MMM YYYY HH:mm:ss"
409
- );
410
- const user = entry.user ? ` by ${entry.user.displayName}` : "";
411
- return `${time}: Marked ${entry.status}${user}`;
412
- }).join("\n");
413
- promises.push(this.addCommentToRequest(externalId, historyComment));
414
- }
431
+ try {
432
+ const externalId = await this.getExternalId(request);
433
+ if (_.isNil(externalId)) return true;
434
+
435
+ const statues = _.orderBy(
436
+ (request.history ?? []).filter(
437
+ (entry) => entry.EntryType !== "assignment"
438
+ ),
439
+ "timestamp",
440
+ "desc"
441
+ );
442
+ const latest = statues.length > 0 ? statues[0] : null;
415
443
 
416
- // save history as a comment
417
- if (!_.isEmpty(request.Notes)) {
418
- // format comment to save
419
- const notesComment = _.map(request.Notes, (entry) => {
420
- const time = moment(Number.parseFloat(entry.Timestamp + "")).format(
421
- "YYYY-MM-DD HH:mm:ss"
422
- );
423
- const user = entry.User ? entry.User.displayName : "Unknown User";
424
- const note = entry.Note ? `Note: ${entry.Note}` : "No Note";
425
- if (!_.isEmpty(entry.Attachments)) {
426
- entry.Attachments.forEach((att) => {
427
- promises.push(this.addFileToRequest(externalId, att.Source));
428
- });
429
- }
430
- const attachments =
431
- entry.Attachments && entry.Attachments.length > 0
432
- ? `Attachments: ${entry.Attachments.map(
433
- (att) => `${att.Title} (${att.Source})`
434
- ).join(", ")}`
435
- : "No Attachments";
436
- return `${time} by ${user}\n${note}\n${attachments}`;
437
- }).join("\n\n");
438
- // save comment
439
- promises.push(this.addCommentToRequest(externalId, notesComment));
444
+ if (latest) {
445
+ const time = moment(Number.parseFloat(latest.timestamp + "")).format(
446
+ "D MMM YYYY HH:mm:ss"
447
+ );
448
+ const user = latest.user ? ` by ${latest.user.displayName}` : "";
449
+ const comment = `${time}: Marked ${latest.status}${user}`;
450
+ await this.addCommentToRequest(externalId, comment);
440
451
  }
441
452
 
442
- // save comments to Archibus
443
- comments.forEach((comment) => {
453
+ return true;
454
+ } catch (error) {
455
+ log("Archibus:OnStatusChanged", "Error", error.toString(), logId);
456
+ }
457
+ return false;
458
+ };
459
+
460
+ /**
461
+ * Perform actions when a a comment has been added to a task
462
+ *
463
+ * @param {Object} request - Request definition on Pluss
464
+ * @returns {Boolean} Represents whether the actions were successful
465
+ */
466
+ onCommentAdded = async (request) => {
467
+ const logId = log("Archibus:OnCommentAdded", "Start", {
468
+ Id: request.id,
469
+ });
470
+
471
+ try {
472
+ const externalId = await this.getExternalId(request);
473
+ if (_.isNil(externalId)) return true;
474
+
475
+ let comment = await this.getLatestComment(request, values.serviceKey);
476
+ if (!comment)
477
+ comment = await this.getLatestComment(request, values.entityKey);
478
+
479
+ if (comment) {
444
480
  const commentText = `${comment.User.displayName}:\n\n${
445
481
  comment.Comment
446
482
  }${!_.isEmpty(comment.Image) ? `\n\nImage: ${comment.Image}` : ""}}`;
447
483
  const commentTime = moment(comment.Timestamp);
448
- promises.push(
449
- this.addCommentToRequest(externalId, commentText, commentTime)
450
- );
451
- });
484
+ await this.addCommentToRequest(externalId, commentText, commentTime);
485
+ }
452
486
 
453
- await Promise.all(promises);
487
+ return true;
488
+ } catch (error) {
489
+ log("Archibus:OnCommentAdded", "Error", error.toString(), logId);
490
+ }
491
+ return false;
492
+ };
493
+
494
+ /**
495
+ * Perform actions when a note has been added to a task
496
+ *
497
+ * @param {Object} request - Request definition on Pluss
498
+ * @returns {Boolean} Represents whether the actions were successful
499
+ */
500
+ onNotesAdded = async (request) => {
501
+ const logId = log("Archibus:OnNotesAdded", "Start", { Id: request.id });
502
+
503
+ try {
504
+ const externalId = await this.getExternalId(request);
505
+ if (_.isNil(externalId)) return true;
506
+
507
+ const notes = _.orderBy(request.Notes ?? [], "Timestamp", "desc");
508
+ const latest = notes.length > 0 ? notes[0] : null;
509
+
510
+ if (latest) {
511
+ const promises = [];
512
+
513
+ const time = moment(Number.parseFloat(latest.Timestamp + "")).format(
514
+ "YYYY-MM-DD HH:mm:ss"
515
+ );
516
+ const user = latest.User ? latest.User.displayName : "Unknown User";
517
+ const note = latest.Note ? `Note: ${latest.Note}` : "No Note";
518
+ if (!_.isEmpty(latest.Attachments)) {
519
+ latest.Attachments.forEach((att) => {
520
+ promises.push(this.addFileToRequest(externalId, att.Source));
521
+ });
522
+ }
523
+ const attachments =
524
+ latest.Attachments && latest.Attachments.length > 0
525
+ ? `Attachments: ${latest.Attachments.map(
526
+ (att) => `${att.Title} (${att.Source})`
527
+ ).join(", ")}`
528
+ : "No Attachments";
529
+ if (!_.isEmpty(latest.Images)) {
530
+ latest.Images.forEach((image) => {
531
+ promises.push(this.addFileToRequest(externalId, image));
532
+ });
533
+ }
534
+ const images =
535
+ latest.Images && latest.Images.length > 0
536
+ ? `Images: ${latest.Images.map((image) => image).join(", ")}`
537
+ : "No Images";
538
+ const comment = `${time} by ${user}\n${note}\n${attachments}\n${images}`;
539
+ promises.push(this.addCommentToRequest(externalId, comment));
540
+
541
+ await Promise.all(promises);
542
+ }
454
543
 
455
544
  return true;
456
545
  } catch (error) {
457
- log("Archibus:OnComplete", "Error", error.toString(), logId);
546
+ log("Archibus:OnNotesAdded", "Error", error.toString(), logId);
458
547
  }
459
548
  return false;
460
549
  };
550
+
551
+ /**
552
+ * Perform completion actions when a task is completed
553
+ *
554
+ * @param {Object} request - Request definition on Pluss
555
+ * @returns {Boolean} Represents whether the actions were successful
556
+ */
557
+ onCompleteRequest = async (request) => {
558
+ return true;
559
+ };
461
560
  }
462
561
 
463
562
  module.exports = ArchibusStrategy;
@@ -19,7 +19,9 @@ exports.getStrategy = async (site) => {
19
19
  default:
20
20
  return new IntegrationStrategy();
21
21
  }
22
- } catch (e) {}
22
+ } catch (e) {
23
+ log("getStrategy", "Error", e, logId);
24
+ }
23
25
 
24
26
  return new IntegrationStrategy();
25
27
  };
package/jobChanged.js CHANGED
@@ -1,21 +1,38 @@
1
+ const moment = require("moment");
2
+ const _ = require("lodash");
1
3
  const { Marshaller } = require("@aws/dynamodb-auto-marshaller");
2
4
  const config = require("./config.json");
3
5
  const { init } = require("@plusscommunities/pluss-core-aws/config");
4
6
  const logUpdate = require("@plusscommunities/pluss-core-aws/db/strings/logUpdate");
5
7
  const { getStrategy } = require("./integration");
6
8
  const { log } = require("@plusscommunities/pluss-core-aws/helper");
9
+ const triggerAutomatedAction = require("@plusscommunities/pluss-core-aws/helper/triggerAutomatedAction");
7
10
  const { values } = require("./values.config");
8
11
 
9
12
  const marshaller = new Marshaller();
10
13
 
11
14
  const pushRequestToIntegration = async (request) => {
12
15
  const integrationStrategy = await getStrategy(request.site);
16
+ // const mockRes = {
17
+ // data: { wrId: moment().valueOf() },
18
+ // };
19
+ // await integrationStrategy.createRequest(request, mockRes);
13
20
  await integrationStrategy.createRequest(request);
14
21
  };
15
22
 
16
- const onCompletedRequest = async (request) => {
23
+ const onStatusChanged = async (request) => {
17
24
  const integrationStrategy = await getStrategy(request.site);
18
- await integrationStrategy.onCompleteRequest(request);
25
+ await integrationStrategy.onStatusChanged(request);
26
+ };
27
+
28
+ const onCommentAdded = async (request) => {
29
+ const integrationStrategy = await getStrategy(request.site);
30
+ await integrationStrategy.onCommentAdded(request);
31
+ };
32
+
33
+ const onNotesAdded = async (request) => {
34
+ const integrationStrategy = await getStrategy(request.site);
35
+ await integrationStrategy.onNotesAdded(request);
19
36
  };
20
37
 
21
38
  /**
@@ -32,9 +49,45 @@ const checkIntegrationActions = async (request, prevRequest) => {
32
49
  await pushRequestToIntegration(request);
33
50
  }
34
51
 
35
- if (request.status === "Completed" && prevRequest.status !== "Completed") {
36
- log("checkIntegrationActions", "CompletedRequest", true);
37
- await onCompletedRequest(request);
52
+ if (request.status !== prevRequest.status) {
53
+ log("checkIntegrationActions", "StatusChanaged", {
54
+ new: request.status,
55
+ old: prevRequest.status,
56
+ });
57
+ await onStatusChanged(request);
58
+ }
59
+
60
+ if (request.commentCount > prevRequest.commentCount) {
61
+ log("checkIntegrationActions", "CommentCountChanged", {
62
+ new: request.commentCount,
63
+ old: prevRequest.commentCount,
64
+ });
65
+ await onCommentAdded(request);
66
+ }
67
+
68
+ if ((request.Notes ?? []).length > (prevRequest.Notes ?? []).length) {
69
+ log("checkIntegrationActions", "NotesAdded", {
70
+ new: (request.Notes ?? []).length,
71
+ old: (prevRequest.Notes ?? []).length,
72
+ });
73
+ await onNotesAdded(request);
74
+ }
75
+ };
76
+
77
+ const checkAutomatedActions = async (request, prevRequest) => {
78
+ if (request.status !== prevRequest.status) {
79
+ log("checkAutomatedActions", "StatusChanaged", {
80
+ new: request.status,
81
+ old: prevRequest.status,
82
+ });
83
+ await triggerAutomatedAction(
84
+ request.site,
85
+ values.triggerMaintenanceStatusChanged,
86
+ {
87
+ JobNumber: request.jobNo,
88
+ status: request.status,
89
+ }
90
+ );
38
91
  }
39
92
  };
40
93
 
@@ -59,6 +112,7 @@ module.exports.jobChanged = (event, context, callback) => {
59
112
  console.log("Old record: ", JSON.stringify(previousData));
60
113
 
61
114
  checkIntegrationActions(data, previousData);
115
+ checkAutomatedActions(data, previousData);
62
116
 
63
117
  site = data.site;
64
118
  } else if (record.eventName == "REMOVE") {
package/package-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-maintenance-aws-forms",
3
- "version": "2.1.9-auth.0",
3
+ "version": "2.1.10",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
@@ -94,26 +94,11 @@
94
94
  "semver": "^6.3.1"
95
95
  },
96
96
  "dependencies": {
97
- "lru-cache": {
98
- "version": "5.1.1",
99
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
100
- "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
101
- "dev": true,
102
- "requires": {
103
- "yallist": "^3.0.2"
104
- }
105
- },
106
97
  "semver": {
107
98
  "version": "6.3.1",
108
99
  "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
109
100
  "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
110
101
  "dev": true
111
- },
112
- "yallist": {
113
- "version": "3.1.1",
114
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
115
- "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
116
- "dev": true
117
102
  }
118
103
  }
119
104
  },
@@ -1483,9 +1468,9 @@
1483
1468
  }
1484
1469
  },
1485
1470
  "@plusscommunities/pluss-core-aws": {
1486
- "version": "2.0.18-auth.0",
1487
- "resolved": "https://registry.npmjs.org/@plusscommunities/pluss-core-aws/-/pluss-core-aws-2.0.18-auth.0.tgz",
1488
- "integrity": "sha512-JcMCn06BQ9Qv2/38W3ve6l8CIuvpGFIGWI/wk9uTwxe4gBAFua9TrLgitccfGhylyAMA3/sPlG3h6GLiIulvUg==",
1471
+ "version": "2.0.20-beta.1",
1472
+ "resolved": "https://registry.npmjs.org/@plusscommunities/pluss-core-aws/-/pluss-core-aws-2.0.20-beta.1.tgz",
1473
+ "integrity": "sha512-9PEkZ3UPiSK84d+fsr0jkNhHfZ6FuvY1ujjdmsULDi7XS2eUCBA770BRBPPoRiXaaGr0RJ1euBVrZmmqVvfxRw==",
1489
1474
  "requires": {
1490
1475
  "@aws/dynamodb-auto-marshaller": "^0.7.1",
1491
1476
  "amazon-cognito-identity-js": "^2.0.19",
@@ -1494,8 +1479,6 @@
1494
1479
  "expo-server-sdk": "^3.0.1",
1495
1480
  "html-entities": "^2.3.2",
1496
1481
  "https": "^1.0.0",
1497
- "jsonwebtoken": "^9.0.2",
1498
- "jwks-rsa": "^3.1.0",
1499
1482
  "lodash": "^4.17.10",
1500
1483
  "moment": "^2.30.1",
1501
1484
  "moment-timezone": "^0.5.41",
@@ -1504,35 +1487,6 @@
1504
1487
  "nodemailer": "^6.9.12",
1505
1488
  "twilio": "^3.18.0",
1506
1489
  "uuid": "^2.0.3"
1507
- },
1508
- "dependencies": {
1509
- "jsonwebtoken": {
1510
- "version": "9.0.2",
1511
- "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.2.tgz",
1512
- "integrity": "sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==",
1513
- "requires": {
1514
- "jws": "^3.2.2",
1515
- "lodash.includes": "^4.3.0",
1516
- "lodash.isboolean": "^3.0.3",
1517
- "lodash.isinteger": "^4.0.4",
1518
- "lodash.isnumber": "^3.0.3",
1519
- "lodash.isplainobject": "^4.0.6",
1520
- "lodash.isstring": "^4.0.1",
1521
- "lodash.once": "^4.0.0",
1522
- "ms": "^2.1.1",
1523
- "semver": "^7.5.4"
1524
- }
1525
- },
1526
- "ms": {
1527
- "version": "2.1.3",
1528
- "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
1529
- "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
1530
- },
1531
- "semver": {
1532
- "version": "7.7.1",
1533
- "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz",
1534
- "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA=="
1535
- }
1536
1490
  }
1537
1491
  },
1538
1492
  "@sinclair/typebox": {
@@ -1600,45 +1554,6 @@
1600
1554
  "@babel/types": "^7.20.7"
1601
1555
  }
1602
1556
  },
1603
- "@types/body-parser": {
1604
- "version": "1.19.5",
1605
- "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.5.tgz",
1606
- "integrity": "sha512-fB3Zu92ucau0iQ0JMCFQE7b/dv8Ot07NI3KaZIkIUNXq82k4eBAqUaneXfleGY9JWskeS9y+u0nXMyspcuQrCg==",
1607
- "requires": {
1608
- "@types/connect": "*",
1609
- "@types/node": "*"
1610
- }
1611
- },
1612
- "@types/connect": {
1613
- "version": "3.4.38",
1614
- "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.38.tgz",
1615
- "integrity": "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==",
1616
- "requires": {
1617
- "@types/node": "*"
1618
- }
1619
- },
1620
- "@types/express": {
1621
- "version": "4.17.21",
1622
- "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz",
1623
- "integrity": "sha512-ejlPM315qwLpaQlQDTjPdsUFSc6ZsP4AN6AlWnogPjQ7CVi7PYF3YVz+CY3jE2pwYf7E/7HlDAN0rV2GxTG0HQ==",
1624
- "requires": {
1625
- "@types/body-parser": "*",
1626
- "@types/express-serve-static-core": "^4.17.33",
1627
- "@types/qs": "*",
1628
- "@types/serve-static": "*"
1629
- }
1630
- },
1631
- "@types/express-serve-static-core": {
1632
- "version": "4.19.6",
1633
- "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.6.tgz",
1634
- "integrity": "sha512-N4LZ2xG7DatVqhCZzOGb1Yi5lMbXSZcmdLDe9EzSndPV2HpWYWzRbaerl2n27irrm94EPpprqa8KpskPT085+A==",
1635
- "requires": {
1636
- "@types/node": "*",
1637
- "@types/qs": "*",
1638
- "@types/range-parser": "*",
1639
- "@types/send": "*"
1640
- }
1641
- },
1642
1557
  "@types/graceful-fs": {
1643
1558
  "version": "4.1.9",
1644
1559
  "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz",
@@ -1648,11 +1563,6 @@
1648
1563
  "@types/node": "*"
1649
1564
  }
1650
1565
  },
1651
- "@types/http-errors": {
1652
- "version": "2.0.4",
1653
- "resolved": "https://registry.npmjs.org/@types/http-errors/-/http-errors-2.0.4.tgz",
1654
- "integrity": "sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA=="
1655
- },
1656
1566
  "@types/istanbul-lib-coverage": {
1657
1567
  "version": "2.0.6",
1658
1568
  "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz",
@@ -1687,67 +1597,13 @@
1687
1597
  "pretty-format": "^26.0.0"
1688
1598
  }
1689
1599
  },
1690
- "@types/jsonwebtoken": {
1691
- "version": "9.0.9",
1692
- "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.9.tgz",
1693
- "integrity": "sha512-uoe+GxEuHbvy12OUQct2X9JenKM3qAscquYymuQN4fMWG9DBQtykrQEFcAbVACF7qaLw9BePSodUL0kquqBJpQ==",
1694
- "requires": {
1695
- "@types/ms": "*",
1696
- "@types/node": "*"
1697
- }
1698
- },
1699
- "@types/mime": {
1700
- "version": "1.3.5",
1701
- "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.5.tgz",
1702
- "integrity": "sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w=="
1703
- },
1704
- "@types/ms": {
1705
- "version": "2.1.0",
1706
- "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz",
1707
- "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA=="
1708
- },
1709
1600
  "@types/node": {
1710
1601
  "version": "22.2.0",
1711
1602
  "resolved": "https://registry.npmjs.org/@types/node/-/node-22.2.0.tgz",
1712
1603
  "integrity": "sha512-bm6EG6/pCpkxDf/0gDNDdtDILMOHgaQBVOJGdwsqClnxA3xL6jtMv76rLBc006RVMWbmaf0xbmom4Z/5o2nRkQ==",
1604
+ "dev": true,
1713
1605
  "requires": {
1714
1606
  "undici-types": "~6.13.0"
1715
- },
1716
- "dependencies": {
1717
- "undici-types": {
1718
- "version": "6.13.0",
1719
- "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.13.0.tgz",
1720
- "integrity": "sha512-xtFJHudx8S2DSoujjMd1WeWvn7KKWFRESZTMeL1RptAYERu29D6jphMjjY+vn96jvN3kVPDNxU/E13VTaXj6jg=="
1721
- }
1722
- }
1723
- },
1724
- "@types/qs": {
1725
- "version": "6.9.18",
1726
- "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.18.tgz",
1727
- "integrity": "sha512-kK7dgTYDyGqS+e2Q4aK9X3D7q234CIZ1Bv0q/7Z5IwRDoADNU81xXJK/YVyLbLTZCoIwUoDoffFeF+p/eIklAA=="
1728
- },
1729
- "@types/range-parser": {
1730
- "version": "1.2.7",
1731
- "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.7.tgz",
1732
- "integrity": "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ=="
1733
- },
1734
- "@types/send": {
1735
- "version": "0.17.4",
1736
- "resolved": "https://registry.npmjs.org/@types/send/-/send-0.17.4.tgz",
1737
- "integrity": "sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==",
1738
- "requires": {
1739
- "@types/mime": "^1",
1740
- "@types/node": "*"
1741
- }
1742
- },
1743
- "@types/serve-static": {
1744
- "version": "1.15.7",
1745
- "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.15.7.tgz",
1746
- "integrity": "sha512-W8Ym+h8nhuRwaKPaDw34QUkwsGi6Rc4yYqvKFo5rm2FUEhCFbzVWrxXUxuKK8TASjWsysJY0nsmNCGhCOIsrOw==",
1747
- "requires": {
1748
- "@types/http-errors": "*",
1749
- "@types/node": "*",
1750
- "@types/send": "*"
1751
1607
  }
1752
1608
  },
1753
1609
  "@types/stack-utils": {
@@ -1899,9 +1755,9 @@
1899
1755
  }
1900
1756
  },
1901
1757
  "aws-sdk": {
1902
- "version": "2.1591.0",
1903
- "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1591.0.tgz",
1904
- "integrity": "sha512-9HbejaKZM89OK4YpE5TpjJItAtU1xhsFvy2p9qZN7nEpfx3G0FpepaW2fdpHu51gFeUn1+g0XUwekyq2N/Xagw==",
1758
+ "version": "2.1665.0",
1759
+ "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1665.0.tgz",
1760
+ "integrity": "sha512-IhEcdGmiplF3l/pCROxEYIdi0s+LZ2VkbMAq3RgoXTHxY5cgqVRNaqsEsgIHev2Clxa9V08HttnIERTIUqb1+Q==",
1905
1761
  "requires": {
1906
1762
  "buffer": "4.9.2",
1907
1763
  "events": "1.1.1",
@@ -1938,25 +1794,13 @@
1938
1794
  }
1939
1795
  },
1940
1796
  "axios": {
1941
- "version": "1.6.8",
1942
- "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz",
1943
- "integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==",
1797
+ "version": "1.7.2",
1798
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz",
1799
+ "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==",
1944
1800
  "requires": {
1945
1801
  "follow-redirects": "^1.15.6",
1946
1802
  "form-data": "^4.0.0",
1947
1803
  "proxy-from-env": "^1.1.0"
1948
- },
1949
- "dependencies": {
1950
- "form-data": {
1951
- "version": "4.0.0",
1952
- "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
1953
- "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
1954
- "requires": {
1955
- "asynckit": "^0.4.0",
1956
- "combined-stream": "^1.0.8",
1957
- "mime-types": "^2.1.12"
1958
- }
1959
- }
1960
1804
  }
1961
1805
  },
1962
1806
  "babel-code-frame": {
@@ -2682,6 +2526,7 @@
2682
2526
  "version": "4.3.6",
2683
2527
  "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.6.tgz",
2684
2528
  "integrity": "sha512-O/09Bd4Z1fBrU4VzkhFqVgpPzaGbw6Sm9FEkBT1A/YBXQFGuuSxa1dN2nxgxS34JmKXqYx8CZAwEVoJFImUXIg==",
2529
+ "dev": true,
2685
2530
  "requires": {
2686
2531
  "ms": "2.1.2"
2687
2532
  },
@@ -2689,7 +2534,8 @@
2689
2534
  "ms": {
2690
2535
  "version": "2.1.2",
2691
2536
  "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
2692
- "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
2537
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
2538
+ "dev": true
2693
2539
  }
2694
2540
  }
2695
2541
  },
@@ -3405,6 +3251,16 @@
3405
3251
  "is-callable": "^1.1.3"
3406
3252
  }
3407
3253
  },
3254
+ "form-data": {
3255
+ "version": "4.0.0",
3256
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
3257
+ "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
3258
+ "requires": {
3259
+ "asynckit": "^0.4.0",
3260
+ "combined-stream": "^1.0.8",
3261
+ "mime-types": "^2.1.12"
3262
+ }
3263
+ },
3408
3264
  "fs.realpath": {
3409
3265
  "version": "1.0.0",
3410
3266
  "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@@ -6031,11 +5887,6 @@
6031
5887
  "resolved": "https://registry.npmjs.org/jmespath/-/jmespath-0.16.0.tgz",
6032
5888
  "integrity": "sha512-9FzQjJ7MATs1tSpnco1K6ayiYE3figslrXA72G2HQ/n76RzvYlofyi5QM+iX4YRs/pu3yzxlVQSST23+dMDknw=="
6033
5889
  },
6034
- "jose": {
6035
- "version": "4.15.9",
6036
- "resolved": "https://registry.npmjs.org/jose/-/jose-4.15.9.tgz",
6037
- "integrity": "sha512-1vUQX+IdDMVPj4k8kOxgUqlcK518yluMuGZwqlr44FS1ppZB/5GWh4rZG89erpOBOJjU/OBsnCVFfapsRz6nEA=="
6038
- },
6039
5890
  "js-cookie": {
6040
5891
  "version": "2.2.1",
6041
5892
  "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-2.2.1.tgz",
@@ -6136,19 +5987,6 @@
6136
5987
  "safe-buffer": "^5.0.1"
6137
5988
  }
6138
5989
  },
6139
- "jwks-rsa": {
6140
- "version": "3.2.0",
6141
- "resolved": "https://registry.npmjs.org/jwks-rsa/-/jwks-rsa-3.2.0.tgz",
6142
- "integrity": "sha512-PwchfHcQK/5PSydeKCs1ylNym0w/SSv8a62DgHJ//7x2ZclCoinlsjAfDxAAbpoTPybOum/Jgy+vkvMmKz89Ww==",
6143
- "requires": {
6144
- "@types/express": "^4.17.20",
6145
- "@types/jsonwebtoken": "^9.0.4",
6146
- "debug": "^4.3.4",
6147
- "jose": "^4.15.4",
6148
- "limiter": "^1.1.5",
6149
- "lru-memoizer": "^2.2.0"
6150
- }
6151
- },
6152
5990
  "jws": {
6153
5991
  "version": "3.2.2",
6154
5992
  "resolved": "https://registry.npmjs.org/jws/-/jws-3.2.2.tgz",
@@ -6180,11 +6018,6 @@
6180
6018
  "type-check": "~0.3.2"
6181
6019
  }
6182
6020
  },
6183
- "limiter": {
6184
- "version": "1.1.5",
6185
- "resolved": "https://registry.npmjs.org/limiter/-/limiter-1.1.5.tgz",
6186
- "integrity": "sha512-FWWMIEOxz3GwUI4Ts/IvgVy6LPvoMPgjMdQ185nN6psJyBJ4yOpzqm695/h5umdLJg2vW3GR5iG11MAkR2AzJA=="
6187
- },
6188
6021
  "lines-and-columns": {
6189
6022
  "version": "1.2.4",
6190
6023
  "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
@@ -6211,11 +6044,6 @@
6211
6044
  "integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=",
6212
6045
  "dev": true
6213
6046
  },
6214
- "lodash.clonedeep": {
6215
- "version": "4.5.0",
6216
- "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz",
6217
- "integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ=="
6218
- },
6219
6047
  "lodash.cond": {
6220
6048
  "version": "4.5.2",
6221
6049
  "resolved": "https://registry.npmjs.org/lodash.cond/-/lodash.cond-4.5.2.tgz",
@@ -6302,20 +6130,12 @@
6302
6130
  }
6303
6131
  },
6304
6132
  "lru-cache": {
6305
- "version": "6.0.0",
6306
- "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
6307
- "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
6308
- "requires": {
6309
- "yallist": "^4.0.0"
6310
- }
6311
- },
6312
- "lru-memoizer": {
6313
- "version": "2.3.0",
6314
- "resolved": "https://registry.npmjs.org/lru-memoizer/-/lru-memoizer-2.3.0.tgz",
6315
- "integrity": "sha512-GXn7gyHAMhO13WSKrIiNfztwxodVsP8IoZ3XfrJV4yH2x0/OeTO/FIaAHTY5YekdGgW94njfuKmyyt1E0mR6Ug==",
6133
+ "version": "5.1.1",
6134
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
6135
+ "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
6136
+ "dev": true,
6316
6137
  "requires": {
6317
- "lodash.clonedeep": "^4.5.0",
6318
- "lru-cache": "6.0.0"
6138
+ "yallist": "^3.0.2"
6319
6139
  }
6320
6140
  },
6321
6141
  "make-dir": {
@@ -6351,9 +6171,9 @@
6351
6171
  "dev": true
6352
6172
  },
6353
6173
  "micromatch": {
6354
- "version": "4.0.8",
6355
- "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
6356
- "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
6174
+ "version": "4.0.7",
6175
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.7.tgz",
6176
+ "integrity": "sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q==",
6357
6177
  "dev": true,
6358
6178
  "requires": {
6359
6179
  "braces": "^3.0.3",
@@ -6496,9 +6316,9 @@
6496
6316
  "dev": true
6497
6317
  },
6498
6318
  "nodemailer": {
6499
- "version": "6.9.13",
6500
- "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.13.tgz",
6501
- "integrity": "sha512-7o38Yogx6krdoBf3jCAqnIN4oSQFx+fMa0I7dK1D+me9kBxx12D+/33wSb+fhOCtIxvYJ+4x4IMEhmhCKfAiOA=="
6319
+ "version": "6.9.14",
6320
+ "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.14.tgz",
6321
+ "integrity": "sha512-Dobp/ebDKBvz91sbtRKhcznLThrKxKt97GI2FAlAyy+fk19j73Uz3sBXolVtmcXjaorivqsbbbjDY+Jkt4/bQA=="
6502
6322
  },
6503
6323
  "normalize-path": {
6504
6324
  "version": "3.0.0",
@@ -6813,6 +6633,11 @@
6813
6633
  "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
6814
6634
  "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
6815
6635
  },
6636
+ "punycode": {
6637
+ "version": "1.3.2",
6638
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz",
6639
+ "integrity": "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw=="
6640
+ },
6816
6641
  "pure-rand": {
6817
6642
  "version": "6.1.0",
6818
6643
  "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz",
@@ -7464,6 +7289,12 @@
7464
7289
  "which-boxed-primitive": "^1.0.2"
7465
7290
  }
7466
7291
  },
7292
+ "undici-types": {
7293
+ "version": "6.13.0",
7294
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.13.0.tgz",
7295
+ "integrity": "sha512-xtFJHudx8S2DSoujjMd1WeWvn7KKWFRESZTMeL1RptAYERu29D6jphMjjY+vn96jvN3kVPDNxU/E13VTaXj6jg==",
7296
+ "dev": true
7297
+ },
7467
7298
  "update-browserslist-db": {
7468
7299
  "version": "1.1.0",
7469
7300
  "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz",
@@ -7481,13 +7312,6 @@
7481
7312
  "requires": {
7482
7313
  "punycode": "1.3.2",
7483
7314
  "querystring": "0.2.0"
7484
- },
7485
- "dependencies": {
7486
- "punycode": {
7487
- "version": "1.3.2",
7488
- "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz",
7489
- "integrity": "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw=="
7490
- }
7491
7315
  }
7492
7316
  },
7493
7317
  "url-parse": {
@@ -7768,9 +7592,10 @@
7768
7592
  "dev": true
7769
7593
  },
7770
7594
  "yallist": {
7771
- "version": "4.0.0",
7772
- "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
7773
- "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
7595
+ "version": "3.1.1",
7596
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
7597
+ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
7598
+ "dev": true
7774
7599
  },
7775
7600
  "yargs": {
7776
7601
  "version": "17.7.2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plusscommunities/pluss-maintenance-aws-forms",
3
- "version": "2.1.9-auth.0",
3
+ "version": "2.1.10",
4
4
  "description": "Extension package to enable maintenance on Pluss Communities Platform",
5
5
  "scripts": {
6
6
  "gc": "node ../../tools/gc ./",
@@ -10,9 +10,6 @@
10
10
  "deploy": "npm run gc && npm run gs && serverless deploy",
11
11
  "betaupload": "rm -rf .serverless && npm i && npm publish --access public --tag beta",
12
12
  "betaupload:p": "npm run betapatch && npm run betaupload",
13
- "authpatch": "npm version prepatch --preid=auth",
14
- "authupload": "npm i && npm i && npm publish --access public --tag auth",
15
- "authupload:p": "npm run authpatch && npm run authupload",
16
13
  "upload": "rm -rf .serverless && npm i && npm publish --access public",
17
14
  "upload:p": "npm run patch && npm run upload",
18
15
  "copy:add": "run(){ ext=${1:-default}; test -f values.config.$ext.js || cp values.config.default.js values.config.$ext.js; }; run",
@@ -20,7 +17,6 @@
20
17
  "copy:set": "run(){ target='\\@plusscommunities\\/pluss-maintenance-aws'; ext=${1:-default}; [ $ext == 'default' ] && replace=$target || replace=$target'-'$ext; echo 'Setting target to '$replace; test -f values.config.$ext.js && cp -f values.config.$ext.js values.config.js; sed -i '' -e 's/'$target'.*\"/'$replace'\"/g' package.json; }; run",
21
18
  "copy:deploy": "for file in `ls ./values.config.*.js`; do dup=`echo $file | sed 's/.*values\\.config\\.\\(.*\\)\\.js/\\1/'`; npm run copy:set $dup; npm run deploy; done; npm run copy:set; npm run gs;",
22
19
  "copy:betaupload": "npm run betapatch; for file in `ls ./values.config.*.js`; do dup=`echo $file | sed 's/.*values\\.config\\.\\(.*\\)\\.js/\\1/'`; npm run copy:set $dup; npm run betaupload; done; npm run copy:set;",
23
- "copy:authupload": "npm run authpatch; for file in `ls ./values.config.*.js`; do dup=`echo $file | sed 's/.*values\\.config\\.\\(.*\\)\\.js/\\1/'`; npm run copy:set $dup; npm run authupload; done; npm run copy:set;",
24
20
  "copy:upload": "npm run patch; for file in `ls ./values.config.*.js`; do dup=`echo $file | sed 's/.*values\\.config\\.\\(.*\\)\\.js/\\1/'`; npm run copy:set $dup; npm run upload; done; npm run copy:set;",
25
21
  "test": "jest tests -i"
26
22
  },
@@ -28,7 +24,7 @@
28
24
  "license": "ISC",
29
25
  "dependencies": {
30
26
  "@aws/dynamodb-auto-marshaller": "^0.7.1",
31
- "@plusscommunities/pluss-core-aws": "2.0.18-auth.0",
27
+ "@plusscommunities/pluss-core-aws": "2.0.20-beta.1",
32
28
  "amazon-cognito-identity-js": "^2.0.19",
33
29
  "aws-sdk": "^2.1591.0",
34
30
  "axios": "^1.6.8",
@@ -81,6 +81,12 @@ module.exports = async (event) => {
81
81
  log("getRequests", "FilteredOnStatus", jobs.length, logId);
82
82
  }
83
83
 
84
+ // filter on priority
85
+ if (qParams.priority) {
86
+ jobs = jobs.filter((j) => qParams.priority.includes(j.priority));
87
+ log("getRequests", "FilterOnPriority", jobs.length, logId);
88
+ }
89
+
84
90
  // filter on type
85
91
  if (qParams.type) {
86
92
  jobs = jobs.filter((j) => qParams.type.includes(j.type));
@@ -0,0 +1,46 @@
1
+ const validateMasterAuth = require("@plusscommunities/pluss-core-aws/helper/auth/validateMasterAuth");
2
+ const getRef = require("@plusscommunities/pluss-core-aws/db/common/getRef");
3
+ const editMaintenanceJob = require("../db/maintenance/editMaintenanceJob");
4
+ const isValidAssignee = require("./helper/isValidAssignee");
5
+ const { log } = require("@plusscommunities/pluss-core-aws/helper");
6
+ const { values } = require("../values.config");
7
+
8
+ module.exports = async (event, data) => {
9
+ const logId = log("updatePriority", "data", data);
10
+ // check required data
11
+ const requiredKeys = ["id", "priority"];
12
+ if (!data || requiredKeys.some((prop) => !data.hasOwnProperty(prop))) {
13
+ log("updatePriority", "InsufficientInput", 422, logId);
14
+ return { status: 422, data: { error: "Insufficient input" } };
15
+ }
16
+
17
+ const job = await getRef(values.tableNameMaintenance, "id", data.id);
18
+ log("updatePriority", "job", job, logId);
19
+ log("updatePriority", "site", job.site, logId);
20
+
21
+ // validate authorisation
22
+ const valid = await validateMasterAuth(
23
+ event,
24
+ values.permissionMaintenanceTracking,
25
+ job.site
26
+ );
27
+ log("updatePriority", "valid", valid, logId);
28
+ if (!valid) {
29
+ const validAssignee = await isValidAssignee(
30
+ event,
31
+ job.site,
32
+ job.AssigneeId
33
+ );
34
+ log("updatePriority", "validAssignee", validAssignee, logId);
35
+ if (!validAssignee) {
36
+ log("updatePriority", "NotAuthorised", 403, logId);
37
+ return { status: 403, data: { error: "Not authorised" } };
38
+ }
39
+ }
40
+
41
+ job.priority = data.priority;
42
+ const result = await editMaintenanceJob(job);
43
+
44
+ log("updatePriority", "result", result, logId);
45
+ return { status: 200, data: { job: result } };
46
+ };
package/updateData.js CHANGED
@@ -3,6 +3,7 @@ const generateJsonResponse = require("@plusscommunities/pluss-core-aws/helper/ge
3
3
  const { init } = require("@plusscommunities/pluss-core-aws/config");
4
4
  const config = require("./config.json");
5
5
  const assignRequest = require("./requests/assignRequest");
6
+ const updatePriority = require("./requests/updatePriority");
6
7
 
7
8
  module.exports.updateData = async (event, context, callback) => {
8
9
  init(config);
@@ -17,6 +18,9 @@ module.exports.updateData = async (event, context, callback) => {
17
18
  case "assign":
18
19
  response = await assignRequest(event, data);
19
20
  break;
21
+ case "priority":
22
+ response = await updatePriority(event, data);
23
+ break;
20
24
  default:
21
25
  break;
22
26
  }
@@ -22,5 +22,6 @@ const values = {
22
22
  activityDeleteMaintenanceNote: "DeleteMaintenanceNoteA",
23
23
  activityEditMaintenanceNote: "EditMaintenanceNoteA",
24
24
  textJobEmailTitle: "Service Request",
25
+ triggerMaintenanceStatusChanged: "MaintenanceStatusChangedA",
25
26
  };
26
27
  exports.values = values;
@@ -24,5 +24,6 @@ const values = {
24
24
  activityEditMaintenanceNote: "EditMaintenanceNote",
25
25
  textJobEmailTitle: "Service Request",
26
26
  allowGeneralType: true,
27
+ triggerMaintenanceStatusChanged: "MaintenanceStatusChanged",
27
28
  };
28
29
  exports.values = values;
@@ -24,5 +24,6 @@ const values = {
24
24
  activityEditMaintenanceNote: "EditMaintenanceNoteForms",
25
25
  textJobEmailTitle: "Form Submission",
26
26
  allowGeneralType: false,
27
+ triggerMaintenanceStatusChanged: "MaintenanceStatusChangedForms",
27
28
  };
28
29
  exports.values = values;
package/values.config.js CHANGED
@@ -24,5 +24,6 @@ const values = {
24
24
  activityEditMaintenanceNote: "EditMaintenanceNoteForms",
25
25
  textJobEmailTitle: "Form Submission",
26
26
  allowGeneralType: false,
27
+ triggerMaintenanceStatusChanged: "MaintenanceStatusChangedForms",
27
28
  };
28
29
  exports.values = values;
@@ -1,26 +0,0 @@
1
- const values = {
2
- entityKey: "maintenancerequestB",
3
- serviceKey: "maintenanceB",
4
- updateKey: "jobsB",
5
- tableKeyJobTypes: "jobtypesB",
6
- tableKeyMaintenance: "maintenanceB",
7
- tableKeySupportTickets: "supportticketsB",
8
- tableNameJobTypes: "jobTypesB",
9
- tableNameMaintenance: "maintenanceB",
10
- tableNameSupportTickets: "supportticketsB",
11
- permissionMaintenanceTracking: "maintenanceTrackingB",
12
- permissionMaintenanceAssignment: "maintenanceAssignmentB",
13
- permissionMaintenanceTypes: "maintenanceTypesB",
14
- routeEntityPath: "/requestsHubB/jobDetails/:id",
15
- screenMaintenanceDetail: "requestDetailB",
16
- notificationMaintenanceJobAssigned: "MaintenanceJobAssignedB",
17
- notificationMaintenanceJobUnassigned: "MaintenanceJobUnassignedB",
18
- activityDeleteMaintenanceJob: "DeleteMaintenanceJobB",
19
- activityEditMaintenanceJob: "EditMaintenanceJobB",
20
- activityMaintenanceJobStatusChanged: "MaintenanceJobStatusChangedB",
21
- activityAddMaintenanceNote: "AddMaintenanceNoteB",
22
- activityDeleteMaintenanceNote: "DeleteMaintenanceNoteB",
23
- activityEditMaintenanceNote: "EditMaintenanceNoteB",
24
- textJobEmailTitle: "Service Request",
25
- };
26
- exports.values = values;
@@ -1,26 +0,0 @@
1
- const values = {
2
- entityKey: "maintenancerequestC",
3
- serviceKey: "maintenanceC",
4
- updateKey: "jobsC",
5
- tableKeyJobTypes: "jobtypesC",
6
- tableKeyMaintenance: "maintenanceC",
7
- tableKeySupportTickets: "supportticketsC",
8
- tableNameJobTypes: "jobTypesC",
9
- tableNameMaintenance: "maintenanceC",
10
- tableNameSupportTickets: "supportticketsC",
11
- permissionMaintenanceTracking: "maintenanceTrackingC",
12
- permissionMaintenanceAssignment: "maintenanceAssignmentC",
13
- permissionMaintenanceTypes: "maintenanceTypesC",
14
- routeEntityPath: "/requestsHubC/jobDetails/:id",
15
- screenMaintenanceDetail: "requestDetailC",
16
- notificationMaintenanceJobAssigned: "MaintenanceJobAssignedC",
17
- notificationMaintenanceJobUnassigned: "MaintenanceJobUnassignedC",
18
- activityDeleteMaintenanceJob: "DeleteMaintenanceJobC",
19
- activityEditMaintenanceJob: "EditMaintenanceJobC",
20
- activityMaintenanceJobStatusChanged: "MaintenanceJobStatusChangedC",
21
- activityAddMaintenanceNote: "AddMaintenanceNoteC",
22
- activityDeleteMaintenanceNote: "DeleteMaintenanceNoteC",
23
- activityEditMaintenanceNote: "EditMaintenanceNoteC",
24
- textJobEmailTitle: "Service Request",
25
- };
26
- exports.values = values;
@@ -1,26 +0,0 @@
1
- const values = {
2
- entityKey: "maintenancerequestD",
3
- serviceKey: "maintenanceD",
4
- updateKey: "jobsD",
5
- tableKeyJobTypes: "jobtypesD",
6
- tableKeyMaintenance: "maintenanceD",
7
- tableKeySupportTickets: "supportticketsD",
8
- tableNameJobTypes: "jobTypesD",
9
- tableNameMaintenance: "maintenanceD",
10
- tableNameSupportTickets: "supportticketsD",
11
- permissionMaintenanceTracking: "maintenanceTrackingD",
12
- permissionMaintenanceAssignment: "maintenanceAssignmentD",
13
- permissionMaintenanceTypes: "maintenanceTypesD",
14
- routeEntityPath: "/requestsHubD/jobDetails/:id",
15
- screenMaintenanceDetail: "requestDetailD",
16
- notificationMaintenanceJobAssigned: "MaintenanceJobAssignedD",
17
- notificationMaintenanceJobUnassigned: "MaintenanceJobUnassignedD",
18
- activityDeleteMaintenanceJob: "DeleteMaintenanceJobD",
19
- activityEditMaintenanceJob: "EditMaintenanceJobD",
20
- activityMaintenanceJobStatusChanged: "MaintenanceJobStatusChangedD",
21
- activityAddMaintenanceNote: "AddMaintenanceNoteD",
22
- activityDeleteMaintenanceNote: "DeleteMaintenanceNoteD",
23
- activityEditMaintenanceNote: "EditMaintenanceNoteD",
24
- textJobEmailTitle: "Service Request",
25
- };
26
- exports.values = values;