@zeniai/client-epic-state 4.19.37-betaVR4 → 4.19.37-betaVR6
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/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +16 -1
- package/lib/esm/zeniAPI.js +11 -1
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +16 -1
- package/lib/zeniAPI.js +11 -1
- package/package.json +2 -2
- package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
|
@@ -4,13 +4,28 @@ 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
|
|
7
10
|
const formData = new FormData();
|
|
8
11
|
for (const file of files) {
|
|
9
12
|
formData.append('files', file, file.name);
|
|
10
13
|
}
|
|
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
|
|
11
23
|
return zeniAPI
|
|
12
|
-
.postFormData(
|
|
24
|
+
.postFormData(uploadUrl, formData)
|
|
13
25
|
.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
|
|
14
29
|
if (isSuccessResponse(response) && response.data != null) {
|
|
15
30
|
return of(bulkUploadReceiptsSuccess({
|
|
16
31
|
batchId: response.data.batch_id,
|
package/lib/esm/zeniAPI.js
CHANGED
|
@@ -81,12 +81,22 @@ 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
|
|
84
87
|
const promise = fetch(restEndPoint, {
|
|
85
88
|
method: 'POST',
|
|
86
89
|
body: formData,
|
|
87
90
|
headers,
|
|
88
91
|
signal,
|
|
89
|
-
}).then((response) =>
|
|
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
|
+
});
|
|
90
100
|
return from(promise);
|
|
91
101
|
}
|
|
92
102
|
postFormDataWithProgress(restEndPoint, formData, signal) {
|
|
@@ -7,13 +7,28 @@ 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
|
|
10
13
|
const formData = new FormData();
|
|
11
14
|
for (const file of files) {
|
|
12
15
|
formData.append('files', file, file.name);
|
|
13
16
|
}
|
|
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
|
|
14
26
|
return zeniAPI
|
|
15
|
-
.postFormData(
|
|
27
|
+
.postFormData(uploadUrl, formData)
|
|
16
28
|
.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
|
|
17
32
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
18
33
|
return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.bulkUploadReceiptsSuccess)({
|
|
19
34
|
batchId: response.data.batch_id,
|
package/lib/zeniAPI.js
CHANGED
|
@@ -84,12 +84,22 @@ 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
|
|
87
90
|
const promise = (0, cross_fetch_1.fetch)(restEndPoint, {
|
|
88
91
|
method: 'POST',
|
|
89
92
|
body: formData,
|
|
90
93
|
headers,
|
|
91
94
|
signal,
|
|
92
|
-
}).then((response) =>
|
|
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
|
+
});
|
|
93
103
|
return (0, rxjs_1.from)(promise);
|
|
94
104
|
}
|
|
95
105
|
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-
|
|
3
|
+
"version": "4.19.37-betaVR6",
|
|
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",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"find-dead-code": "ts-prune | grep -v '(used in module)'",
|
|
112
112
|
"find-unused-exports": "ts-unused-exports ./tsconfig.json",
|
|
113
113
|
"circular-dependency": "npx madge --circular --extensions ts ./src",
|
|
114
|
-
"build": "concurrently --kill-others-on-fail --handle-input \"echo 'Running ESLint...' && eslint . --ext .js,.jsx,.ts,.tsx\" \"echo 'TypeScript build in progress...' && time tsc && echo 'ESM build...' && tsc -p tsconfig.esm.json\"
|
|
114
|
+
"build": "concurrently --kill-others-on-fail --handle-input \"echo 'Running ESLint...' && eslint . --ext .js,.jsx,.ts,.tsx\" \"echo 'TypeScript build in progress...' && time tsc && echo 'ESM build...' && tsc -p tsconfig.esm.json\"",
|
|
115
115
|
"only-build": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc && tsc -p tsconfig.esm.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
|
|
116
116
|
"format": "prettier --write --ignore-unknown \"src/**/*\" && pnpm lint",
|
|
117
117
|
"format-watch": "(git diff --name-only --diff-filter=ACM && git ls-files --others --exclude-standard) | grep -E '\\.(ts|tsx)$' | xargs prettier --write",
|