octopian-apis 1.0.40 → 1.0.42

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "octopian-apis",
3
- "version": "1.0.40",
3
+ "version": "1.0.42",
4
4
  "description": "Transaction APIs SDK that implements Octopian Services which will be used for any node project typescript or javascript",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  RequestsAPIConstants,
3
3
  RequestStepsAPIConstants,
4
+ StorageAPIConstants,
4
5
  } from "../web-services/apiConstants";
5
6
  import * as apiHandler from "../web-services/apiHandler";
6
- import { CreateReadSAS } from "./storageServices";
7
-
7
+ import { CreateReadSAS, GetOnPremiseReadSAS, GetOnPremiseWriteSAS } from "./storageServices";
8
+ import { SetStorageType, GetConfig, decodeBase64ToJson } from "../sdkUtilities";
8
9
  /**
9
10
  * @description
10
11
  * Retrieves the list of Correspondences for the current user.
@@ -63,7 +64,9 @@ export async function GetMyApprovedCorrespondenceRequests(
63
64
  let notes = "";
64
65
  let ImagePath = "";
65
66
  let ProcessFlow = [];
66
- let ToName = '';
67
+ let ToName = "";
68
+ let GeneratedDocument = "";
69
+ let Attachments = [];
67
70
  if (element.Request.RequestAttributeList?.length > 0) {
68
71
  element.Request.RequestAttributeList.forEach((attribute) => {
69
72
  if (attribute.Alias === "Subject") {
@@ -78,6 +81,47 @@ export async function GetMyApprovedCorrespondenceRequests(
78
81
  if (attribute.Alias === "To") {
79
82
  ToName = attribute.Value;
80
83
  }
84
+ if (attribute.AttributeTypeValueTypeName === "Attachment" && !attribute.IsRequesterVisible) {
85
+ // if(attribute.Value && ReadSASResult?.Result)
86
+ // {
87
+ // GeneratedDocument = ReadSASResult.Result.split("?")[0] +
88
+ // "/" +
89
+ // attribute.Value +
90
+ // "?" +
91
+ // ReadSASResult.Result.split("?")[1];
92
+ // }
93
+ GeneratedDocument = attribute.Value;
94
+ }
95
+ if(attribute.Alias === "Attachments" && !attribute.IsRequesterVisible)
96
+ {
97
+ if(attribute.Value)
98
+ {
99
+ let DecodedAttachmentsRecordList = decodeBase64ToJson(
100
+ attribute.Value
101
+ );
102
+ for (let attributeGroup of DecodedAttachmentsRecordList) {
103
+ for (let group of attributeGroup) {
104
+ for (let attribute of group.RequestAttributeDtos) {
105
+ if (
106
+ attribute.AttributeTypeValueTypeName ===
107
+ AttributeTypeValueTypeNames.Attachment
108
+ ) {
109
+ Attachments.push({
110
+ id: attribute.RequestAttributeId || 0,
111
+ name: attribute.Name || "",
112
+ type: attribute.Value?.split(".").pop() || "",
113
+ url: ReadSASResult?.Result? (ReadSASResult.Result.split("?")[0] +
114
+ "/" +
115
+ attribute.Value +
116
+ "?" +
117
+ ReadSASResult.Result.split("?")[1]): "",
118
+ });
119
+ }
120
+ }
121
+ }
122
+ }
123
+ }
124
+ }
81
125
  });
82
126
  }
83
127
  if (element.ProviderImagePath) {
@@ -114,7 +158,7 @@ export async function GetMyApprovedCorrespondenceRequests(
114
158
  });
115
159
  });
116
160
  }
117
- if(element.CurrentActiveRequestStep){
161
+ if (element.CurrentActiveRequestStep) {
118
162
  ProcessFlow.push({
119
163
  Id: element.CurrentActiveRequestStep.RequestStepId,
120
164
  ImagePath: "",
@@ -122,21 +166,25 @@ export async function GetMyApprovedCorrespondenceRequests(
122
166
  Comment: "",
123
167
  SubmitDate: element.CurrentActiveRequestStep.StartDate,
124
168
  });
125
- };
126
-
169
+ }
170
+
127
171
  MappedResult.push({
128
172
  RequestId: element.RequestId,
129
173
  StepId: element.RequestStepId,
130
174
  RequesterImagePath: ImagePath,
131
175
  RequesterName: element.Request.InteractorName,
132
176
  ToName: ToName,
133
- CategoryColor: element.Request.ExtraLine1 ? element.Request.ExtraLine1 : "#FB4C2F",
177
+ CategoryColor: element.Request.ExtraLine1
178
+ ? element.Request.ExtraLine1
179
+ : "#FB4C2F",
134
180
  CategoryName: element.Request.ServiceSubCategoryName,
135
181
  SubmitDate: element.StartDate,
136
182
  Subject: subject,
137
183
  Notes: notes,
138
184
  IsRead: true,
139
185
  ProcessFlow: ProcessFlow,
186
+ GeneratedDocument: GeneratedDocument,
187
+ Attachments: Attachments,
140
188
  });
141
189
  });
142
190
  APIResponse.Result = MappedResult;
@@ -202,7 +250,9 @@ export async function GetMyRejectedCorrespondenceRequests(
202
250
  let notes = "";
203
251
  let ImagePath = "";
204
252
  let ProcessFlow = [];
205
- let ToName = '';
253
+ let ToName = "";
254
+ let GeneratedDocument = "";
255
+ let Attachments = [];
206
256
  if (element.Request.RequestAttributeList?.length > 0) {
207
257
  element.Request.RequestAttributeList.forEach((attribute) => {
208
258
  if (attribute.Alias === "Subject") {
@@ -217,6 +267,48 @@ export async function GetMyRejectedCorrespondenceRequests(
217
267
  if (attribute.Alias === "To") {
218
268
  ToName = attribute.Value;
219
269
  }
270
+ if (attribute.AttributeTypeValueTypeName === "Attachment" && !attribute.IsRequesterVisible) {
271
+ // if(attribute.Value && ReadSASResult?.Result)
272
+ // {
273
+ // GeneratedDocument = ReadSASResult.Result.split("?")[0] +
274
+ // "/" +
275
+ // attribute.Value +
276
+ // "?" +
277
+ // ReadSASResult.Result.split("?")[1];
278
+ // }
279
+ GeneratedDocument = attribute.Value;
280
+
281
+ }
282
+ if(attribute.Alias === "Attachments" && !attribute.IsRequesterVisible)
283
+ {
284
+ if(attribute.Value)
285
+ {
286
+ let DecodedAttachmentsRecordList = decodeBase64ToJson(
287
+ attribute.Value
288
+ );
289
+ for (let attributeGroup of DecodedAttachmentsRecordList) {
290
+ for (let group of attributeGroup) {
291
+ for (let attribute of group.RequestAttributeDtos) {
292
+ if (
293
+ attribute.AttributeTypeValueTypeName ===
294
+ AttributeTypeValueTypeNames.Attachment
295
+ ) {
296
+ Attachments.push({
297
+ id: attribute.RequestAttributeId || 0,
298
+ name: attribute.Name || "",
299
+ type: attribute.Value?.split(".").pop() || "",
300
+ url: ReadSASResult?.Result? (ReadSASResult.Result.split("?")[0] +
301
+ "/" +
302
+ attribute.Value +
303
+ "?" +
304
+ ReadSASResult.Result.split("?")[1]): "",
305
+ });
306
+ }
307
+ }
308
+ }
309
+ }
310
+ }
311
+ }
220
312
  });
221
313
  }
222
314
  if (element.ProviderImagePath) {
@@ -259,13 +351,17 @@ export async function GetMyRejectedCorrespondenceRequests(
259
351
  RequesterImagePath: ImagePath,
260
352
  RequesterName: element.Request.InteractorName,
261
353
  ToName: ToName,
262
- CategoryColor: element.Request.ExtraLine1 ? element.Request.ExtraLine1 : "#FB4C2F",
354
+ CategoryColor: element.Request.ExtraLine1
355
+ ? element.Request.ExtraLine1
356
+ : "#FB4C2F",
263
357
  CategoryName: element.Request.ServiceSubCategoryName,
264
358
  SubmitDate: element.StartDate,
265
359
  Subject: subject,
266
360
  Notes: notes,
267
361
  IsRead: true,
268
362
  ProcessFlow: ProcessFlow,
363
+ GeneratedDocument: GeneratedDocument,
364
+ Attachments: Attachments,
269
365
  });
270
366
  });
271
367
  APIResponse.Result = MappedResult;
@@ -329,7 +425,9 @@ export async function GetMyDraftCorrespondenceRequests(
329
425
  let subject = element.ServiceName;
330
426
  let notes = "";
331
427
  let ImagePath = "";
332
- let ToName = '';
428
+ let ToName = "";
429
+ let GeneratedDocument = "";
430
+ let Attachments = [];
333
431
  if (element.RequestAttributeList?.length > 0) {
334
432
  element.RequestAttributeList.forEach((attribute) => {
335
433
  if (attribute.Alias === "Subject") {
@@ -344,6 +442,193 @@ export async function GetMyDraftCorrespondenceRequests(
344
442
  if (attribute.Alias === "To") {
345
443
  ToName = attribute.Value;
346
444
  }
445
+ if (attribute.AttributeTypeValueTypeName === "Attachment" && !attribute.IsRequesterVisible) {
446
+ // if(attribute.Value && ReadSASResult?.Result)
447
+ // {
448
+ // GeneratedDocument = ReadSASResult.Result.split("?")[0] +
449
+ // "/" +
450
+ // attribute.Value +
451
+ // "?" +
452
+ // ReadSASResult.Result.split("?")[1];
453
+ // }
454
+ GeneratedDocument = attribute.Value;
455
+ }
456
+ if(attribute.Alias === "Attachments" && !attribute.IsRequesterVisible)
457
+ {
458
+ if(attribute.Value)
459
+ {
460
+ let DecodedAttachmentsRecordList = decodeBase64ToJson(
461
+ attribute.Value
462
+ );
463
+ for (let attributeGroup of DecodedAttachmentsRecordList) {
464
+ for (let group of attributeGroup) {
465
+ for (let attribute of group.RequestAttributeDtos) {
466
+ if (
467
+ attribute.AttributeTypeValueTypeName ===
468
+ AttributeTypeValueTypeNames.Attachment
469
+ ) {
470
+ Attachments.push({
471
+ id: attribute.RequestAttributeId || 0,
472
+ name: attribute.Name || "",
473
+ type: attribute.Value?.split(".").pop() || "",
474
+ url: ReadSASResult?.Result? (ReadSASResult.Result.split("?")[0] +
475
+ "/" +
476
+ attribute.Value +
477
+ "?" +
478
+ ReadSASResult.Result.split("?")[1]): "",
479
+ });
480
+ }
481
+ }
482
+ }
483
+ }
484
+ }
485
+ }
486
+ });
487
+ }
488
+ if (ImagePath && ReadSASResult.StatusCode === 200) {
489
+ ImagePath =
490
+ ReadSASResult.Result.split("?")[0] +
491
+ "/" +
492
+ ImagePath +
493
+ "?" +
494
+ ReadSASResult.Result.split("?")[1];
495
+ }
496
+ MappedResult.push({
497
+ RequestId: element.RequestId,
498
+ StepId: 0,
499
+ RequesterImagePath: ImagePath,
500
+ RequesterName: element.InteractorName,
501
+ ToName: ToName,
502
+ CategoryColor: element.ExtraLine1 ? element.ExtraLine1 : "#FB4C2F",
503
+ CategoryName: element.ServiceSubCategoryName,
504
+ SubmitDate: element.SubmitDate,
505
+ Subject: subject,
506
+ Notes: notes,
507
+ IsRead: true,
508
+ ProcessFlow: [],
509
+ GeneratedDocument: GeneratedDocument,
510
+ Attachments: Attachments,
511
+ });
512
+ });
513
+ APIResponse.Result = MappedResult;
514
+ }
515
+ return APIResponse;
516
+ }
517
+
518
+ /**
519
+ * @description
520
+ * Retrieves the list of Correspondences for the current user.
521
+ *
522
+ * @param {object} getMyCorrespondenceListDTO
523
+ * Data object containing fields necessary for retrieving the list of requests.
524
+ * PageSize: number
525
+ * PageIndex: number
526
+ * IsAscendingOrder?: boolean (Optional)
527
+ * FromFinishDate?: string (Optional)
528
+ * ToFinishDate?: string (Optional)
529
+ * FromStartDate?: string (Optional)
530
+ * ToStartDate?: string (Optional)
531
+ *
532
+ * @param {string} AuthToken
533
+ * Authentication token for authorization purposes.
534
+ *
535
+ * @param {number} Timeout
536
+ * Time in milliseconds to wait before the request times out. Default is 30000.
537
+ *
538
+ * @returns
539
+ * An object containing the response from the Get My Request List request, including
540
+ * success message, status code, and any additional data returned by the API.
541
+ * {
542
+ * Message: string,
543
+ * StatusCode: number,
544
+ * Result: {
545
+ * -- request data based on selection criteria wether grouped or not--
546
+ * }
547
+ * }
548
+ */
549
+ export async function GetInProcessCorrespondenceRequests(
550
+ GetMyCorrespondenceListDTO,
551
+ AuthToken = null,
552
+ Timeout = 30000,
553
+ RequiredHeaderValue = null
554
+ ) {
555
+ GetMyCorrespondenceListDTO["RequestStatus"] = "InProcess";
556
+ GetMyCorrespondenceListDTO["WithRequestStep"] = true;
557
+ GetMyCorrespondenceListDTO["WithRequestStepAttribute"] = true;
558
+ GetMyCorrespondenceListDTO["WithRequestAttribute"] = true;
559
+
560
+ let APIResponse = await apiHandler.PostMethod(
561
+ RequestsAPIConstants.uriGetMyRequestList(),
562
+ GetMyCorrespondenceListDTO,
563
+ AuthToken,
564
+ Timeout,
565
+ RequiredHeaderValue
566
+ );
567
+ let MappedResult = [];
568
+ let ReadSASResult = await CreateReadSAS(AuthToken, Timeout);
569
+ if (APIResponse.StatusCode === 200 && APIResponse.Result?.length > 0) {
570
+ APIResponse.Result.forEach((element) => {
571
+ let subject = element.ServiceName;
572
+ let notes = "";
573
+ let ImagePath = "";
574
+ let ToName = "";
575
+ let GeneratedDocument = "";
576
+ let Attachments = [];
577
+ if (element.RequestAttributeList?.length > 0) {
578
+ element.RequestAttributeList.forEach((attribute) => {
579
+ if (attribute.Alias === "Subject") {
580
+ subject = attribute.Value;
581
+ }
582
+ if (attribute.Alias === "Notes") {
583
+ notes = attribute.Value;
584
+ }
585
+ if (attribute.Alias === "InteractorImagePath") {
586
+ ImagePath = attribute.Value;
587
+ }
588
+ if (attribute.Alias === "To") {
589
+ ToName = attribute.Value;
590
+ }
591
+ if (attribute.AttributeTypeValueTypeName === "Attachment" && !attribute.IsRequesterVisible) {
592
+ // if(attribute.Value && ReadSASResult?.Result)
593
+ // {
594
+ // GeneratedDocument = ReadSASResult.Result.split("?")[0] +
595
+ // "/" +
596
+ // attribute.Value +
597
+ // "?" +
598
+ // ReadSASResult.Result.split("?")[1];
599
+ // }
600
+ GeneratedDocument = attribute.Value;
601
+ }
602
+ if(attribute.Alias === "Attachments" && !attribute.IsRequesterVisible)
603
+ {
604
+ if(attribute.Value)
605
+ {
606
+ let DecodedAttachmentsRecordList = decodeBase64ToJson(
607
+ attribute.Value
608
+ );
609
+ for (let attributeGroup of DecodedAttachmentsRecordList) {
610
+ for (let group of attributeGroup) {
611
+ for (let attribute of group.RequestAttributeDtos) {
612
+ if (
613
+ attribute.AttributeTypeValueTypeName ===
614
+ AttributeTypeValueTypeNames.Attachment
615
+ ) {
616
+ Attachments.push({
617
+ id: attribute.RequestAttributeId || 0,
618
+ name: attribute.Name || "",
619
+ type: attribute.Value?.split(".").pop() || "",
620
+ url: ReadSASResult?.Result? (ReadSASResult.Result.split("?")[0] +
621
+ "/" +
622
+ attribute.Value +
623
+ "?" +
624
+ ReadSASResult.Result.split("?")[1]): "",
625
+ });
626
+ }
627
+ }
628
+ }
629
+ }
630
+ }
631
+ }
347
632
  });
348
633
  }
349
634
  if (ImagePath && ReadSASResult.StatusCode === 200) {
@@ -367,6 +652,8 @@ export async function GetMyDraftCorrespondenceRequests(
367
652
  Notes: notes,
368
653
  IsRead: true,
369
654
  ProcessFlow: [],
655
+ GeneratedDocument: GeneratedDocument,
656
+ Attachments: Attachments,
370
657
  });
371
658
  });
372
659
  APIResponse.Result = MappedResult;
@@ -432,7 +719,9 @@ export async function GetMyClosedCorrespondenceRequests(
432
719
  let notes = "";
433
720
  let ImagePath = "";
434
721
  let ProcessFlow = [];
435
- let ToName = '';
722
+ let ToName = "";
723
+ let GeneratedDocument = "";
724
+ let Attachments = [];
436
725
  if (element.Request.RequestAttributeList?.length > 0) {
437
726
  element.Request.RequestAttributeList.forEach((attribute) => {
438
727
  if (attribute.Alias === "Subject") {
@@ -447,6 +736,47 @@ export async function GetMyClosedCorrespondenceRequests(
447
736
  if (attribute.Alias === "To") {
448
737
  ToName = attribute.Value;
449
738
  }
739
+ if (attribute.AttributeTypeValueTypeName === "Attachment" && !attribute.IsRequesterVisible) {
740
+ // if(attribute.Value && ReadSASResult?.Result)
741
+ // {
742
+ // GeneratedDocument = ReadSASResult.Result.split("?")[0] +
743
+ // "/" +
744
+ // attribute.Value +
745
+ // "?" +
746
+ // ReadSASResult.Result.split("?")[1];
747
+ // }
748
+ GeneratedDocument = attribute.Value;
749
+ }
750
+ if(attribute.Alias === "Attachments" && !attribute.IsRequesterVisible)
751
+ {
752
+ if(attribute.Value)
753
+ {
754
+ let DecodedAttachmentsRecordList = decodeBase64ToJson(
755
+ attribute.Value
756
+ );
757
+ for (let attributeGroup of DecodedAttachmentsRecordList) {
758
+ for (let group of attributeGroup) {
759
+ for (let attribute of group.RequestAttributeDtos) {
760
+ if (
761
+ attribute.AttributeTypeValueTypeName ===
762
+ AttributeTypeValueTypeNames.Attachment
763
+ ) {
764
+ Attachments.push({
765
+ id: attribute.RequestAttributeId || 0,
766
+ name: attribute.Name || "",
767
+ type: attribute.Value?.split(".").pop() || "",
768
+ url: ReadSASResult?.Result? (ReadSASResult.Result.split("?")[0] +
769
+ "/" +
770
+ attribute.Value +
771
+ "?" +
772
+ ReadSASResult.Result.split("?")[1]): "",
773
+ });
774
+ }
775
+ }
776
+ }
777
+ }
778
+ }
779
+ }
450
780
  });
451
781
  }
452
782
  if (element.ProviderImagePath) {
@@ -489,13 +819,17 @@ export async function GetMyClosedCorrespondenceRequests(
489
819
  RequesterImagePath: ImagePath,
490
820
  RequesterName: element.Request.InteractorName,
491
821
  ToName: ToName,
492
- CategoryColor: element.Request.ExtraLine1 ? element.Request.ExtraLine1 : "#FB4C2F",
822
+ CategoryColor: element.Request.ExtraLine1
823
+ ? element.Request.ExtraLine1
824
+ : "#FB4C2F",
493
825
  CategoryName: element.Request.ServiceSubCategoryName,
494
826
  SubmitDate: element.StartDate,
495
827
  Subject: subject,
496
828
  Notes: notes,
497
829
  IsRead: true,
498
830
  ProcessFlow: ProcessFlow,
831
+ GeneratedDocument: GeneratedDocument,
832
+ Attachments: Attachments,
499
833
  });
500
834
  });
501
835
  APIResponse.Result = MappedResult;
@@ -666,7 +1000,7 @@ export async function GetMyInboxCorrespondenceRequests(
666
1000
  AuthToken = null,
667
1001
  Timeout = 30000,
668
1002
  RequiredHeaderValue = null
669
- ) {
1003
+ ) {
670
1004
  GetMyCorrespondenceListDTO["WithRequest"] = true;
671
1005
  GetMyCorrespondenceListDTO["WithRequestStepAttributes"] = true;
672
1006
  GetMyCorrespondenceListDTO["WithRequestAttributes"] = true;
@@ -688,6 +1022,8 @@ export async function GetMyInboxCorrespondenceRequests(
688
1022
  let notes = "";
689
1023
  let ImagePath = "";
690
1024
  let ProcessFlow = [];
1025
+ let GeneratedDocument = "";
1026
+ let Attachments = [];
691
1027
  if (element.Request?.RequestAttributeList?.length > 0) {
692
1028
  element.Request.RequestAttributeList.forEach((attribute) => {
693
1029
  if (attribute.Alias === "Subject") {
@@ -699,6 +1035,47 @@ export async function GetMyInboxCorrespondenceRequests(
699
1035
  if (attribute.Alias === "InteractorImagePath") {
700
1036
  ImagePath = attribute.Value;
701
1037
  }
1038
+ if (attribute.AttributeTypeValueTypeName === "Attachment" && !attribute.IsRequesterVisible) {
1039
+ // if(attribute.Value && ReadSASResult?.Result)
1040
+ // {
1041
+ // GeneratedDocument = ReadSASResult.Result.split("?")[0] +
1042
+ // "/" +
1043
+ // attribute.Value +
1044
+ // "?" +
1045
+ // ReadSASResult.Result.split("?")[1];
1046
+ // }
1047
+ GeneratedDocument = attribute.Value;
1048
+ }
1049
+ if(attribute.Alias === "Attachments" && !attribute.IsRequesterVisible)
1050
+ {
1051
+ if(attribute.Value)
1052
+ {
1053
+ let DecodedAttachmentsRecordList = decodeBase64ToJson(
1054
+ attribute.Value
1055
+ );
1056
+ for (let attributeGroup of DecodedAttachmentsRecordList) {
1057
+ for (let group of attributeGroup) {
1058
+ for (let attribute of group.RequestAttributeDtos) {
1059
+ if (
1060
+ attribute.AttributeTypeValueTypeName ===
1061
+ AttributeTypeValueTypeNames.Attachment
1062
+ ) {
1063
+ Attachments.push({
1064
+ id: attribute.RequestAttributeId || 0,
1065
+ name: attribute.Name || "",
1066
+ type: attribute.Value?.split(".").pop() || "",
1067
+ url: ReadSASResult?.Result? (ReadSASResult.Result.split("?")[0] +
1068
+ "/" +
1069
+ attribute.Value +
1070
+ "?" +
1071
+ ReadSASResult.Result.split("?")[1]): "",
1072
+ });
1073
+ }
1074
+ }
1075
+ }
1076
+ }
1077
+ }
1078
+ }
702
1079
  });
703
1080
  }
704
1081
  if (element.ProviderImagePath) {
@@ -749,6 +1126,8 @@ export async function GetMyInboxCorrespondenceRequests(
749
1126
  Notes: notes,
750
1127
  IsRead: element.IsCheckedOut,
751
1128
  ProcessFlow: ProcessFlow,
1129
+ GeneratedDocument: GeneratedDocument,
1130
+ Attachments: Attachments,
752
1131
  });
753
1132
  });
754
1133
  APIResponse.Result = MappedResult;
@@ -789,3 +1168,57 @@ export async function GetMyInboxCategoryWithCounts(
789
1168
  );
790
1169
  return APIResponse;
791
1170
  }
1171
+ export async function GetStorageType(AuthToken = null, Timeout = 30000) {
1172
+ let StorageType = GetConfig("StorageType");
1173
+ if (StorageType) {
1174
+ return StorageType;
1175
+ }
1176
+ let APIResponse = await apiHandler.GetMethod(
1177
+ StorageAPIConstants.uriGetStorageType(),
1178
+ AuthToken,
1179
+ Timeout
1180
+ );
1181
+ if (APIResponse.StatusCode === 200) {
1182
+ SetStorageType(APIResponse.Result.StorageType);
1183
+ return APIResponse.Result.StorageType;
1184
+ } else {
1185
+ return 0;
1186
+ }
1187
+ }
1188
+ export async function CreateCorrespondenceReadSAS(AuthToken = null, Timeout = 30000) {
1189
+ let StorageType = await GetStorageType(AuthToken, Timeout);
1190
+ if (StorageType === 0) {
1191
+ let APIResponse = await apiHandler.GetMethod(
1192
+ StorageAPIConstants.uriCreateReadSAS(),
1193
+ AuthToken,
1194
+ Timeout
1195
+ );
1196
+ return APIResponse;
1197
+ } else {
1198
+ let APIResponse = await GetOnPremiseReadSAS(AuthToken, Timeout);
1199
+ if (APIResponse.StatusCode === 200) {
1200
+ APIResponse.Result =
1201
+ APIResponse.Result.Uri + "/" + APIResponse.Result.RequestDownloadKey;
1202
+ }
1203
+ return APIResponse;
1204
+ }
1205
+ }
1206
+
1207
+ export async function CreateCorrespondenceWriteSAS(AuthToken = null, Timeout = 30000) {
1208
+ let StorageType = await GetStorageType(AuthToken, Timeout);
1209
+ if (StorageType === 0) {
1210
+ let APIResponse = await apiHandler.GetMethod(
1211
+ StorageAPIConstants.uriCreateWriteSAS(),
1212
+ AuthToken,
1213
+ Timeout
1214
+ );
1215
+ return APIResponse;
1216
+ } else {
1217
+ let APIResponse = await GetOnPremiseWriteSAS(AuthToken, Timeout);
1218
+ if (APIResponse.StatusCode === 200) {
1219
+ APIResponse.Result =
1220
+ APIResponse.Result.Uri + "/" + APIResponse.Result.RequestUpdateKey;
1221
+ }
1222
+ return APIResponse;
1223
+ }
1224
+ }
package/src/config.js CHANGED
@@ -13,6 +13,9 @@ class Config {
13
13
  setToken(AuthToken) {
14
14
  this.settings["Token"] = AuthToken;
15
15
  }
16
+ setStorageType(StorageType) {
17
+ this.settings["StorageType"] = StorageType;
18
+ }
16
19
  getConfig(key) {
17
20
  return key ? this.settings[key] : this.settings;
18
21
  }
package/src/index.d.ts CHANGED
@@ -258,7 +258,7 @@ import { GetMyCorrespondenceListDTO } from "./modals/input-modals/correspondence
258
258
  import { CorrespondenceSubmitDraftInput } from "./modals/input-modals/correspondence-modals/CorrespondenceSubmitDraftInput";
259
259
  import { GenerateDocumentInput } from "./modals/input-modals/transaction-catalog-modals/GenerateDocumentInput";
260
260
  import { GetProviderStepTypeCountOutput } from "./modals/output-modals/request-step-modals/GetProviderStepTypeCountOutput";
261
- import { GetMyCorrespondenceOutput } from "./modals/output-modals/correspondence-modals/GetMyCorrespondenceOutput";
261
+ import { GetMyCorrespondenceOutput, Attachment } from "./modals/output-modals/correspondence-modals/GetMyCorrespondenceOutput";
262
262
  import { RequestStepAssignableRoleInput } from "./modals/input-modals/request-step-modals/RequestStepAssignableRoleInput";
263
263
  import { RequestStepAssignableRoleOutput } from "./modals/output-modals/request-step-modals/RequestStepAssignableRoleOutput";
264
264
  import { ProcessStepSpecialActionInput } from "./modals/input-modals/request-step-modals/ProcessStepSpecialActionInput";
@@ -6398,6 +6398,43 @@ interface CorrespondenceServices {
6398
6398
  Timeout?: number | null
6399
6399
  ) => BaseResponse<GetMyCorrespondenceOutput[] | BaseErrorResponse>;
6400
6400
 
6401
+ /**
6402
+ * @description
6403
+ * Retrieves the list of Correspondences for the current user.
6404
+ *
6405
+ * @param {object} getMyCorrespondenceListDTO
6406
+ * Data object containing fields necessary for retrieving the list of requests.
6407
+ * PageSize: number
6408
+ * PageIndex: number
6409
+ * IsAscendingOrder?: boolean (Optional)
6410
+ * FromFinishDate?: string (Optional)
6411
+ * ToFinishDate?: string (Optional)
6412
+ * FromStartDate?: string (Optional)
6413
+ * ToStartDate?: string (Optional)
6414
+ *
6415
+ * @param {string} AuthToken
6416
+ * Authentication token for authorization purposes.
6417
+ *
6418
+ * @param {number} Timeout
6419
+ * Time in milliseconds to wait before the request times out. Default is 30000.
6420
+ *
6421
+ * @returns
6422
+ * An object containing the response from the Get My Correspondence List request, including
6423
+ * success message, status code, and any additional data returned by the API.
6424
+ * {
6425
+ * Message: string,
6426
+ * StatusCode: number,
6427
+ * Result: {
6428
+ * -- request data based on selection criteria wether grouped or not--
6429
+ * }
6430
+ * }
6431
+ */
6432
+ GetInProcessCorrespondenceRequests: (
6433
+ Input: GetMyCorrespondenceListDTO,
6434
+ AuthToken?: string | null,
6435
+ Timeout?: number | null
6436
+ ) => BaseResponse<GetMyCorrespondenceOutput[] | BaseErrorResponse>;
6437
+
6401
6438
  /**
6402
6439
  * @description
6403
6440
  * Retrieves the list of Correspondences for the current user.
@@ -6594,6 +6631,53 @@ interface CorrespondenceServices {
6594
6631
  AuthToken?: string | null,
6595
6632
  Timeout?: number | null
6596
6633
  ) => BaseResponse<SubmitCartOrderOutput | BaseErrorResponse>;
6634
+
6635
+ /**
6636
+ * @description
6637
+ * Generates a Shared Access Signature (SAS) for writing to the storage.
6638
+ *
6639
+ * @param {string} AuthToken
6640
+ * Authentication token for authorization purposes.
6641
+ *
6642
+ * @param {number} Timeout
6643
+ * Optional Timeout in milliseconds for the request.
6644
+ *
6645
+ * @returns
6646
+ * An object containing the generated write SAS, including
6647
+ * success message, status code, and any additional data returned by the API.
6648
+ * {
6649
+ * Message: Success,
6650
+ * StatusCode: 200,
6651
+ * Result: string
6652
+ * }
6653
+ */
6654
+ CreateCorrespondenceWriteSAS: (
6655
+ AuthToken?: string | null,
6656
+ Timeout?: number | null
6657
+ ) => BaseResponse<string | BaseErrorResponse>;
6658
+ /**
6659
+ * @description
6660
+ * Generates a Shared Access Signature (SAS) for reading from the storage.
6661
+ *
6662
+ * @param {string} AuthToken
6663
+ * Authentication token for authorization purposes.
6664
+ *
6665
+ * @param {number} Timeout
6666
+ * Optional Timeout in milliseconds for the request.
6667
+ *
6668
+ * @returns
6669
+ * An object containing the generated read SAS, including
6670
+ * success message, status code, and any additional data returned by the API.
6671
+ * {
6672
+ * Message: Success,
6673
+ * StatusCode: 200,
6674
+ * Result: string
6675
+ * }
6676
+ */
6677
+ CreateCorrespondenceReadSAS: (
6678
+ AuthToken?: string | null,
6679
+ Timeout?: number | null
6680
+ ) => BaseResponse<string | BaseErrorResponse>;
6597
6681
  }
6598
6682
  interface OctopianSDKConfig {
6599
6683
  /**
@@ -6887,5 +6971,6 @@ export {
6887
6971
  RequestStepAssignableRoleInput,
6888
6972
  RequestStepAssignableRoleOutput,
6889
6973
  ProcessStepSpecialActionInput,
6890
- LinkedLoginOutput
6974
+ LinkedLoginOutput,
6975
+ Attachment
6891
6976
  };
package/src/index.js CHANGED
@@ -405,7 +405,11 @@ const {
405
405
  SubmitDraftCorrespondence,
406
406
  GetMyInboxCorrespondenceRequests,
407
407
  GetMyRejectedCorrespondenceRequests,
408
- GetMyInboxCategoryWithCounts
408
+ GetMyInboxCategoryWithCounts,
409
+ GetInProcessCorrespondenceRequests,
410
+ CreateCorrespondenceReadSAS,
411
+ CreateCorrespondenceWriteSAS,
412
+ GetStorageType,
409
413
  } = require('./CoreServices/correspondenceServices')
410
414
 
411
415
  const CorrespondenceServices = {
@@ -417,7 +421,11 @@ const CorrespondenceServices = {
417
421
  SubmitDraftCorrespondence,
418
422
  GetMyInboxCorrespondenceRequests,
419
423
  GetMyRejectedCorrespondenceRequests,
420
- GetMyInboxCategoryWithCounts
424
+ GetMyInboxCategoryWithCounts,
425
+ GetInProcessCorrespondenceRequests,
426
+ CreateCorrespondenceReadSAS,
427
+ CreateCorrespondenceWriteSAS,
428
+ GetStorageType,
421
429
  }
422
430
  //#region DarAlBer
423
431
  const {
@@ -27,5 +27,9 @@ export interface GetMyRequestInput {
27
27
  GroupByBatch?: boolean
28
28
  FilterDismissedRequest?: boolean
29
29
  ParentRequestId?: number
30
+ requesterName?: string;
31
+ requesterEmail?: string;
32
+ requesterMobile?: string;
33
+ requesterExternalId?: string;
30
34
  }
31
35
 
@@ -34,6 +34,11 @@ export interface GetRequestStepListInput {
34
34
  PrivilegeLevel?: number
35
35
  IsSimpleResult?: boolean
36
36
  StepTypeName?: string
37
+ requesterName?: string;
38
+ requesterEmail?: string;
39
+ requesterMobile?: string;
40
+ requesterExternalId?: string;
41
+ serviceId?: number;
37
42
  }
38
43
 
39
44
 
@@ -11,6 +11,8 @@
11
11
  Notes:string
12
12
  IsRead: boolean
13
13
  ProcessFlow: ProcessFlow[]
14
+ GeneratedDocument: string
15
+ Attachments: Attachment[]
14
16
  }
15
17
 
16
18
  export interface ProcessFlow {
@@ -20,5 +22,10 @@
20
22
  Comment: string
21
23
  SubmitDate: string
22
24
  }
23
-
25
+ export interface Attachment {
26
+ id: number
27
+ name: string
28
+ type: string
29
+ url: string
30
+ }
24
31
 
@@ -17,6 +17,33 @@ export function Init(APIKey, DomainName) {
17
17
  Config.setToken(Token);
18
18
  }
19
19
 
20
+ export function SetStorageType(StorageType) {
21
+ Config.setStorageType(StorageType);
22
+ }
23
+
20
24
  export function GetConfig(Key) {
21
25
  return Config.getConfig(Key);
22
- }
26
+ }
27
+
28
+ export const decodeBase64ToJson = (base64) => {
29
+ try {
30
+ if (base64 === '') {
31
+ return [];
32
+ }
33
+
34
+ // Decode the Base64 string
35
+ const binaryString = atob(base64);
36
+ const len = binaryString.length;
37
+ const bytes = new Uint8Array(len);
38
+ for (let i = 0; i < len; i++) {
39
+ bytes[i] = binaryString.charCodeAt(i);
40
+ }
41
+ // Decode Uint8Array to string
42
+ const decodedString = new TextDecoder("utf-8").decode(bytes);
43
+ // Parse the decoded string into JSON
44
+ return JSON.parse(decodedString);
45
+ } catch (error) {
46
+ console.error('Error decoding Base64 to JSON:', error);
47
+ return [];
48
+ }
49
+ };
@@ -651,6 +651,9 @@ export class StorageAPIConstants {
651
651
  static uriGetOnPremiseWriteSAS() {
652
652
  return storageURI + "/api/OnPremStorage/GenerateUploadSas";
653
653
  }
654
+ static uriGetStorageType(){
655
+ return storageURI + "/api/OnPremStorage/GetStorageType";
656
+ }
654
657
  }
655
658
 
656
659
  export class TaxiAPIConstants {