@zeniai/client-epic-state 4.19.37-betaVR6 → 4.19.37-betaVR8

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.
@@ -4,28 +4,13 @@ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePay
4
4
  import { bulkUploadReceipts, bulkUploadReceiptsFailure, bulkUploadReceiptsSuccess, } from '../../reducers/missingReceiptsViewReducer';
5
5
  export const bulkUploadReceiptsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(bulkUploadReceipts.match), mergeMap((action) => {
6
6
  const { files } = action.payload;
7
- // #region agent log
8
- fetch('http://127.0.0.1:7645/ingest/3d281ada-4e8f-4f88-b6d6-ac0851976786', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '171bc9' }, body: JSON.stringify({ sessionId: '171bc9', location: 'bulkUploadReceiptsEpic.ts:31', message: 'files from action.payload', data: { fileCount: files?.length, filesType: typeof files, isArray: Array.isArray(files), fileDetails: files?.map((f) => ({ name: f?.name, size: f?.size, type: f?.type, isFile: f instanceof File, isBlobLike: f instanceof Blob, constructor: f?.constructor?.name })) }, timestamp: Date.now(), runId: 'run2', hypothesisId: 'H-A' }) }).catch(() => { });
9
- // #endregion
10
7
  const formData = new FormData();
11
8
  for (const file of files) {
12
9
  formData.append('files', file, file.name);
13
10
  }
14
- // #region agent log
15
- const fdEntries = [];
16
- formData.forEach((value, key) => { fdEntries.push({ key, type: typeof value, isFile: value instanceof File, isBlob: value instanceof Blob, name: value?.name, size: value?.size, constructor: value?.constructor?.name }); });
17
- fetch('http://127.0.0.1:7645/ingest/3d281ada-4e8f-4f88-b6d6-ac0851976786', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '171bc9' }, body: JSON.stringify({ sessionId: '171bc9', location: 'bulkUploadReceiptsEpic.ts:38', message: 'FormData entries before send', data: { entryCount: fdEntries.length, entries: fdEntries }, timestamp: Date.now(), runId: 'run2', hypothesisId: 'H-B' }) }).catch(() => { });
18
- // #endregion
19
- const uploadUrl = `${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/receipts/bulk-upload`;
20
- // #region agent log
21
- fetch('http://127.0.0.1:7645/ingest/3d281ada-4e8f-4f88-b6d6-ac0851976786', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '171bc9' }, body: JSON.stringify({ sessionId: '171bc9', location: 'bulkUploadReceiptsEpic.ts:42', message: 'upload URL and method', data: { url: uploadUrl, method: 'postFormData' }, timestamp: Date.now(), runId: 'run2', hypothesisId: 'H-E' }) }).catch(() => { });
22
- // #endregion
23
11
  return zeniAPI
24
- .postFormData(uploadUrl, formData)
12
+ .postFormData(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/receipts/bulk-upload`, formData)
25
13
  .pipe(mergeMap((response) => {
26
- // #region agent log
27
- fetch('http://127.0.0.1:7645/ingest/3d281ada-4e8f-4f88-b6d6-ac0851976786', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '171bc9' }, body: JSON.stringify({ sessionId: '171bc9', location: 'bulkUploadReceiptsEpic.ts:response', message: 'API response received', data: { isSuccess: isSuccessResponse(response), hasData: response.data != null, status: response.status, fullResponse: response }, timestamp: Date.now(), runId: 'run2', hypothesisId: 'H-H' }) }).catch(() => { });
28
- // #endregion
29
14
  if (isSuccessResponse(response) && response.data != null) {
30
15
  return of(bulkUploadReceiptsSuccess({
31
16
  batchId: response.data.batch_id,
@@ -81,22 +81,12 @@ export class ZeniAPIClient {
81
81
  postFormData(restEndPoint, formData, signal) {
82
82
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
83
83
  const { 'Content-Type': _contentType, ...headers } = this.apiHeaders();
84
- // #region agent log
85
- fetch('http://127.0.0.1:7645/ingest/3d281ada-4e8f-4f88-b6d6-ac0851976786', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '171bc9' }, body: JSON.stringify({ sessionId: '171bc9', location: 'zeniAPI.ts:postFormData', message: 'postFormData headers and URL', data: { url: restEndPoint, headersKeys: Object.keys(headers), headersValues: headers }, timestamp: Date.now(), runId: 'run2', hypothesisId: 'H-G' }) }).catch(() => { });
86
- // #endregion
87
84
  const promise = fetch(restEndPoint, {
88
85
  method: 'POST',
89
86
  body: formData,
90
87
  headers,
91
88
  signal,
92
- }).then((response) => {
93
- // #region agent log
94
- const rh = {};
95
- response.headers.forEach((v, k) => { rh[k] = v; });
96
- fetch('http://127.0.0.1:7645/ingest/3d281ada-4e8f-4f88-b6d6-ac0851976786', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '171bc9' }, body: JSON.stringify({ sessionId: '171bc9', location: 'zeniAPI.ts:postFormData:response', message: 'fetch response metadata', data: { status: response.status, statusText: response.statusText, redirected: response.redirected, responseUrl: response.url, requestUrl: restEndPoint, urlMatch: response.url === restEndPoint, responseType: response.type, responseHeaders: rh }, timestamp: Date.now(), runId: 'run2', hypothesisId: 'H-F' }) }).catch(() => { });
97
- // #endregion
98
- return this.processJsonResponse(response);
99
- });
89
+ }).then((response) => this.processJsonResponse(response));
100
90
  return from(promise);
101
91
  }
102
92
  postFormDataWithProgress(restEndPoint, formData, signal) {
@@ -7,28 +7,13 @@ const responsePayload_1 = require("../../../../responsePayload");
7
7
  const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
8
8
  const bulkUploadReceiptsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.bulkUploadReceipts.match), (0, operators_1.mergeMap)((action) => {
9
9
  const { files } = action.payload;
10
- // #region agent log
11
- fetch('http://127.0.0.1:7645/ingest/3d281ada-4e8f-4f88-b6d6-ac0851976786', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '171bc9' }, body: JSON.stringify({ sessionId: '171bc9', location: 'bulkUploadReceiptsEpic.ts:31', message: 'files from action.payload', data: { fileCount: files?.length, filesType: typeof files, isArray: Array.isArray(files), fileDetails: files?.map((f) => ({ name: f?.name, size: f?.size, type: f?.type, isFile: f instanceof File, isBlobLike: f instanceof Blob, constructor: f?.constructor?.name })) }, timestamp: Date.now(), runId: 'run2', hypothesisId: 'H-A' }) }).catch(() => { });
12
- // #endregion
13
10
  const formData = new FormData();
14
11
  for (const file of files) {
15
12
  formData.append('files', file, file.name);
16
13
  }
17
- // #region agent log
18
- const fdEntries = [];
19
- formData.forEach((value, key) => { fdEntries.push({ key, type: typeof value, isFile: value instanceof File, isBlob: value instanceof Blob, name: value?.name, size: value?.size, constructor: value?.constructor?.name }); });
20
- fetch('http://127.0.0.1:7645/ingest/3d281ada-4e8f-4f88-b6d6-ac0851976786', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '171bc9' }, body: JSON.stringify({ sessionId: '171bc9', location: 'bulkUploadReceiptsEpic.ts:38', message: 'FormData entries before send', data: { entryCount: fdEntries.length, entries: fdEntries }, timestamp: Date.now(), runId: 'run2', hypothesisId: 'H-B' }) }).catch(() => { });
21
- // #endregion
22
- const uploadUrl = `${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/receipts/bulk-upload`;
23
- // #region agent log
24
- fetch('http://127.0.0.1:7645/ingest/3d281ada-4e8f-4f88-b6d6-ac0851976786', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '171bc9' }, body: JSON.stringify({ sessionId: '171bc9', location: 'bulkUploadReceiptsEpic.ts:42', message: 'upload URL and method', data: { url: uploadUrl, method: 'postFormData' }, timestamp: Date.now(), runId: 'run2', hypothesisId: 'H-E' }) }).catch(() => { });
25
- // #endregion
26
14
  return zeniAPI
27
- .postFormData(uploadUrl, formData)
15
+ .postFormData(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/receipts/bulk-upload`, formData)
28
16
  .pipe((0, operators_1.mergeMap)((response) => {
29
- // #region agent log
30
- fetch('http://127.0.0.1:7645/ingest/3d281ada-4e8f-4f88-b6d6-ac0851976786', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '171bc9' }, body: JSON.stringify({ sessionId: '171bc9', location: 'bulkUploadReceiptsEpic.ts:response', message: 'API response received', data: { isSuccess: (0, responsePayload_1.isSuccessResponse)(response), hasData: response.data != null, status: response.status, fullResponse: response }, timestamp: Date.now(), runId: 'run2', hypothesisId: 'H-H' }) }).catch(() => { });
31
- // #endregion
32
17
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
33
18
  return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.bulkUploadReceiptsSuccess)({
34
19
  batchId: response.data.batch_id,
package/lib/zeniAPI.js CHANGED
@@ -84,22 +84,12 @@ class ZeniAPIClient {
84
84
  postFormData(restEndPoint, formData, signal) {
85
85
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
86
86
  const { 'Content-Type': _contentType, ...headers } = this.apiHeaders();
87
- // #region agent log
88
- (0, cross_fetch_1.fetch)('http://127.0.0.1:7645/ingest/3d281ada-4e8f-4f88-b6d6-ac0851976786', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '171bc9' }, body: JSON.stringify({ sessionId: '171bc9', location: 'zeniAPI.ts:postFormData', message: 'postFormData headers and URL', data: { url: restEndPoint, headersKeys: Object.keys(headers), headersValues: headers }, timestamp: Date.now(), runId: 'run2', hypothesisId: 'H-G' }) }).catch(() => { });
89
- // #endregion
90
87
  const promise = (0, cross_fetch_1.fetch)(restEndPoint, {
91
88
  method: 'POST',
92
89
  body: formData,
93
90
  headers,
94
91
  signal,
95
- }).then((response) => {
96
- // #region agent log
97
- const rh = {};
98
- response.headers.forEach((v, k) => { rh[k] = v; });
99
- (0, cross_fetch_1.fetch)('http://127.0.0.1:7645/ingest/3d281ada-4e8f-4f88-b6d6-ac0851976786', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-Debug-Session-Id': '171bc9' }, body: JSON.stringify({ sessionId: '171bc9', location: 'zeniAPI.ts:postFormData:response', message: 'fetch response metadata', data: { status: response.status, statusText: response.statusText, redirected: response.redirected, responseUrl: response.url, requestUrl: restEndPoint, urlMatch: response.url === restEndPoint, responseType: response.type, responseHeaders: rh }, timestamp: Date.now(), runId: 'run2', hypothesisId: 'H-F' }) }).catch(() => { });
100
- // #endregion
101
- return this.processJsonResponse(response);
102
- });
92
+ }).then((response) => this.processJsonResponse(response));
103
93
  return (0, rxjs_1.from)(promise);
104
94
  }
105
95
  postFormDataWithProgress(restEndPoint, formData, signal) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.19.37-betaVR6",
3
+ "version": "4.19.37-betaVR8",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",