@zeniai/client-epic-state 5.0.69-beta2RJ → 5.0.69-betaAR1
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/entity/account/accountSelector.d.ts +26 -0
- package/lib/entity/account/accountSelector.js +47 -1
- package/lib/entity/account/accountState.d.ts +5 -0
- package/lib/entity/account/accountState.js +11 -4
- package/lib/entity/class/classSelector.d.ts +35 -0
- package/lib/entity/class/classSelector.js +50 -0
- package/lib/epic.d.ts +1 -2
- package/lib/epic.js +1 -2
- package/lib/esm/entity/account/accountSelector.js +46 -1
- package/lib/esm/entity/account/accountState.js +7 -1
- package/lib/esm/entity/class/classSelector.js +48 -0
- package/lib/esm/epic.js +1 -2
- package/lib/esm/index.js +10 -6
- package/lib/esm/reducer.js +0 -6
- package/lib/esm/view/companyHealthMetricView/companyHealthMetricViewSelector.js +1 -1
- package/lib/esm/view/companyView/helpers/cockpitHelpers.js +1 -1
- package/lib/esm/view/companyView/selector/companyManagementViewSelector.js +1 -1
- package/lib/esm/view/companyView/selector/companyPortfolioViewSelector.js +1 -1
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +11 -1
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +69 -12
- package/lib/esm/view/expenseAutomationView/transactionFilterHelpers.js +228 -0
- package/lib/esm/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsPageEpic.js +0 -4
- package/lib/esm/view/spendManagement/spendManagementFilterHelpers.js +4 -2
- package/lib/esm/view/subscriptionView/subscriptionViewSelector.js +1 -1
- package/lib/esm/view/taskManager/taskListView/taskListReducer.js +1 -1
- package/lib/index.d.ts +7 -9
- package/lib/index.js +41 -37
- package/lib/reducer.d.ts +0 -6
- package/lib/reducer.js +0 -6
- package/lib/view/companyHealthMetricView/companyHealthMetricViewSelector.js +1 -1
- package/lib/view/companyView/helpers/cockpitHelpers.js +1 -1
- package/lib/view/companyView/selector/companyManagementViewSelector.js +1 -1
- package/lib/view/companyView/selector/companyPortfolioViewSelector.js +1 -1
- package/lib/view/companyView/types/cockpitTypes.d.ts +1 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +5 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +12 -2
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.d.ts +4 -1
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +71 -12
- package/lib/view/expenseAutomationView/transactionFilterHelpers.d.ts +65 -0
- package/lib/view/expenseAutomationView/transactionFilterHelpers.js +232 -0
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +2 -0
- package/lib/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsPageEpic.d.ts +1 -2
- package/lib/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsPageEpic.js +0 -4
- package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistory.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
- package/lib/view/spendManagement/spendManagementFilterHelpers.d.ts +1 -1
- package/lib/view/spendManagement/spendManagementFilterHelpers.js +4 -2
- package/lib/view/subscriptionView/subscriptionViewSelector.js +1 -1
- package/lib/view/taskManager/taskListView/taskList.d.ts +1 -1
- package/lib/view/taskManager/taskListView/taskListReducer.js +1 -1
- package/package.json +1 -1
- package/lib/entity/scheduleActivityLog/scheduleActivityLogPayload.d.ts +0 -68
- package/lib/entity/scheduleActivityLog/scheduleActivityLogPayload.js +0 -132
- package/lib/entity/scheduleActivityLog/scheduleActivityLogReducer.d.ts +0 -6
- package/lib/entity/scheduleActivityLog/scheduleActivityLogReducer.js +0 -27
- package/lib/entity/scheduleActivityLog/scheduleActivityLogSelector.d.ts +0 -4
- package/lib/entity/scheduleActivityLog/scheduleActivityLogSelector.js +0 -17
- package/lib/entity/scheduleActivityLog/scheduleActivityLogState.d.ts +0 -67
- package/lib/entity/scheduleActivityLog/scheduleActivityLogState.js +0 -39
- package/lib/esm/entity/scheduleActivityLog/scheduleActivityLogPayload.js +0 -126
- package/lib/esm/entity/scheduleActivityLog/scheduleActivityLogReducer.js +0 -23
- package/lib/esm/entity/scheduleActivityLog/scheduleActivityLogSelector.js +0 -10
- package/lib/esm/entity/scheduleActivityLog/scheduleActivityLogState.js +0 -35
- package/lib/esm/view/scheduleActivityLogView/fetchScheduleActivityLogEpic.js +0 -67
- package/lib/esm/view/scheduleActivityLogView/scheduleActivityLogViewPayload.js +0 -1
- package/lib/esm/view/scheduleActivityLogView/scheduleActivityLogViewReducer.js +0 -50
- package/lib/esm/view/scheduleActivityLogView/scheduleActivityLogViewSelector.js +0 -33
- package/lib/esm/view/scheduleActivityLogView/scheduleActivityLogViewState.js +0 -1
- package/lib/view/scheduleActivityLogView/fetchScheduleActivityLogEpic.d.ts +0 -11
- package/lib/view/scheduleActivityLogView/fetchScheduleActivityLogEpic.js +0 -72
- package/lib/view/scheduleActivityLogView/scheduleActivityLogViewPayload.d.ts +0 -8
- package/lib/view/scheduleActivityLogView/scheduleActivityLogViewPayload.js +0 -2
- package/lib/view/scheduleActivityLogView/scheduleActivityLogViewReducer.d.ts +0 -17
- package/lib/view/scheduleActivityLogView/scheduleActivityLogViewReducer.js +0 -54
- package/lib/view/scheduleActivityLogView/scheduleActivityLogViewSelector.d.ts +0 -8
- package/lib/view/scheduleActivityLogView/scheduleActivityLogViewSelector.js +0 -36
- package/lib/view/scheduleActivityLogView/scheduleActivityLogViewState.d.ts +0 -5
- package/lib/view/scheduleActivityLogView/scheduleActivityLogViewState.js +0 -2
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { AccountBasePayload } from '../account/accountPayload';
|
|
2
|
-
import { ClassBasePayload } from '../class/classPayload';
|
|
3
|
-
import { VendorBasePayload } from '../vendor/vendorPayload';
|
|
4
|
-
import { ScheduleActivityLog, ScheduleActivityLogData } from './scheduleActivityLogState';
|
|
5
|
-
export interface ScheduleActivityLogTransactionNodePayload {
|
|
6
|
-
attachment_count?: number;
|
|
7
|
-
creation_source?: string;
|
|
8
|
-
is_deleted?: boolean;
|
|
9
|
-
lines_count?: number;
|
|
10
|
-
sync_token?: number;
|
|
11
|
-
}
|
|
12
|
-
export interface ScheduleActivityLogLineDetailPayload {
|
|
13
|
-
account?: AccountBasePayload | null;
|
|
14
|
-
accounting_class?: ClassBasePayload | null;
|
|
15
|
-
billable_status?: string | null;
|
|
16
|
-
posting_type?: string | null;
|
|
17
|
-
vendor?: VendorBasePayload | null;
|
|
18
|
-
}
|
|
19
|
-
export interface ScheduleActivityLogLineNodePayload {
|
|
20
|
-
amount?: number;
|
|
21
|
-
categorization_status?: string;
|
|
22
|
-
line_description?: string;
|
|
23
|
-
line_detail?: ScheduleActivityLogLineDetailPayload;
|
|
24
|
-
line_detail_type?: string;
|
|
25
|
-
line_id?: string;
|
|
26
|
-
line_type?: string;
|
|
27
|
-
linked_transactions?: unknown[];
|
|
28
|
-
}
|
|
29
|
-
export interface ScheduleActivityLogScheduleNodePayload {
|
|
30
|
-
balance?: number;
|
|
31
|
-
base_transaction_amount?: number;
|
|
32
|
-
base_transaction_id?: string;
|
|
33
|
-
je_schedule_id?: string;
|
|
34
|
-
je_schedule_type?: string;
|
|
35
|
-
period?: number;
|
|
36
|
-
status_code?: string;
|
|
37
|
-
vendor_id?: string;
|
|
38
|
-
}
|
|
39
|
-
export interface ScheduleActivityLogAISummaryPayload {
|
|
40
|
-
confidence_score?: number;
|
|
41
|
-
reasoning?: string;
|
|
42
|
-
schedule_type?: string;
|
|
43
|
-
status_code?: string;
|
|
44
|
-
}
|
|
45
|
-
export interface ScheduleActivityLogInferenceParamPayload {
|
|
46
|
-
key: string;
|
|
47
|
-
value: string;
|
|
48
|
-
reasoning?: string;
|
|
49
|
-
}
|
|
50
|
-
export interface ScheduleActivityLogDataPayload {
|
|
51
|
-
ai_summaries?: ScheduleActivityLogAISummaryPayload[];
|
|
52
|
-
inference_params?: ScheduleActivityLogInferenceParamPayload[];
|
|
53
|
-
line_node?: ScheduleActivityLogLineNodePayload;
|
|
54
|
-
schedule_node?: ScheduleActivityLogScheduleNodePayload;
|
|
55
|
-
transaction_node?: ScheduleActivityLogTransactionNodePayload;
|
|
56
|
-
user_id?: string;
|
|
57
|
-
}
|
|
58
|
-
export interface ScheduleActivityLogPayload {
|
|
59
|
-
correlation_id: string;
|
|
60
|
-
create_time: string;
|
|
61
|
-
event_type: string;
|
|
62
|
-
data?: ScheduleActivityLogDataPayload | null;
|
|
63
|
-
processing_time_ms?: number;
|
|
64
|
-
status_code?: string;
|
|
65
|
-
}
|
|
66
|
-
export declare const toScheduleActivityLogId: (correlationId: string, eventType: string, createTime?: string) => string;
|
|
67
|
-
export declare const toScheduleActivityLogData: (data: ScheduleActivityLogDataPayload, correlationId: string, eventType?: string) => ScheduleActivityLogData;
|
|
68
|
-
export declare const toScheduleActivityLog: (payload: ScheduleActivityLogPayload) => ScheduleActivityLog;
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toScheduleActivityLog = exports.toScheduleActivityLogData = exports.toScheduleActivityLogId = void 0;
|
|
4
|
-
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
5
|
-
const accountPayload_1 = require("../account/accountPayload");
|
|
6
|
-
const classPayload_1 = require("../class/classPayload");
|
|
7
|
-
const vendorPayload_1 = require("../vendor/vendorPayload");
|
|
8
|
-
const scheduleActivityLogState_1 = require("./scheduleActivityLogState");
|
|
9
|
-
// ---------------------------------------------------------------------------
|
|
10
|
-
// ID generation
|
|
11
|
-
// ---------------------------------------------------------------------------
|
|
12
|
-
const toScheduleActivityLogId = (correlationId, eventType, createTime) => createTime != null
|
|
13
|
-
? `${correlationId}-${eventType}-${createTime}`
|
|
14
|
-
: `${correlationId}-${eventType}`;
|
|
15
|
-
exports.toScheduleActivityLogId = toScheduleActivityLogId;
|
|
16
|
-
// ---------------------------------------------------------------------------
|
|
17
|
-
// Deduped one-time warns
|
|
18
|
-
// ---------------------------------------------------------------------------
|
|
19
|
-
const warnedPayloadKeys = new Set();
|
|
20
|
-
const warnPayloadOnce = (key, message, payload) => {
|
|
21
|
-
if (warnedPayloadKeys.has(key)) {
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
warnedPayloadKeys.add(key);
|
|
25
|
-
console.warn(message, payload);
|
|
26
|
-
};
|
|
27
|
-
// ---------------------------------------------------------------------------
|
|
28
|
-
// Mappers — payload → domain
|
|
29
|
-
// ---------------------------------------------------------------------------
|
|
30
|
-
const toTransactionNode = (payload) => {
|
|
31
|
-
if (payload == null) {
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
|
-
return {
|
|
35
|
-
attachmentCount: payload.attachment_count,
|
|
36
|
-
creationSource: payload.creation_source,
|
|
37
|
-
isDeleted: payload.is_deleted,
|
|
38
|
-
linesCount: payload.lines_count,
|
|
39
|
-
syncToken: payload.sync_token,
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
const toLineNode = (payload) => {
|
|
43
|
-
if (payload == null) {
|
|
44
|
-
return undefined;
|
|
45
|
-
}
|
|
46
|
-
const detail = payload.line_detail;
|
|
47
|
-
return {
|
|
48
|
-
amount: payload.amount,
|
|
49
|
-
categorizationStatus: payload.categorization_status,
|
|
50
|
-
lineDescription: payload.line_description,
|
|
51
|
-
lineId: payload.line_id,
|
|
52
|
-
account: detail?.account
|
|
53
|
-
? (0, accountPayload_1.mapAccountBasePayloadToAccountBase)(detail.account)
|
|
54
|
-
: undefined,
|
|
55
|
-
class: detail?.accounting_class
|
|
56
|
-
? (0, classPayload_1.mapClassBasePayloadToClassBase)(detail.accounting_class)
|
|
57
|
-
: undefined,
|
|
58
|
-
vendor: detail?.vendor
|
|
59
|
-
? (0, vendorPayload_1.mapVendorBasePayloadToVendorBase)(detail.vendor)
|
|
60
|
-
: undefined,
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
const toScheduleNode = (payload) => {
|
|
64
|
-
if (payload == null) {
|
|
65
|
-
return undefined;
|
|
66
|
-
}
|
|
67
|
-
return {
|
|
68
|
-
balance: payload.balance,
|
|
69
|
-
baseTransactionAmount: payload.base_transaction_amount,
|
|
70
|
-
baseTransactionId: payload.base_transaction_id,
|
|
71
|
-
jeScheduleId: payload.je_schedule_id,
|
|
72
|
-
jeScheduleType: payload.je_schedule_type,
|
|
73
|
-
period: payload.period,
|
|
74
|
-
statusCode: payload.status_code,
|
|
75
|
-
vendorId: payload.vendor_id,
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
const toAISummaries = (payload) => {
|
|
79
|
-
if (payload == null || payload.length === 0) {
|
|
80
|
-
return undefined;
|
|
81
|
-
}
|
|
82
|
-
return payload.map((item) => ({
|
|
83
|
-
confidenceScore: item.confidence_score,
|
|
84
|
-
reasoning: item.reasoning,
|
|
85
|
-
scheduleType: item.schedule_type,
|
|
86
|
-
statusCode: item.status_code,
|
|
87
|
-
}));
|
|
88
|
-
};
|
|
89
|
-
const toInferenceParams = (payload) => {
|
|
90
|
-
if (payload == null || payload.length === 0) {
|
|
91
|
-
return undefined;
|
|
92
|
-
}
|
|
93
|
-
return payload.map((item) => ({
|
|
94
|
-
key: item.key,
|
|
95
|
-
reasoning: item.reasoning,
|
|
96
|
-
value: item.value,
|
|
97
|
-
}));
|
|
98
|
-
};
|
|
99
|
-
const toScheduleActivityLogData = (data, correlationId, eventType) => {
|
|
100
|
-
const hasAnyNode = data.transaction_node != null ||
|
|
101
|
-
data.line_node != null ||
|
|
102
|
-
data.schedule_node != null ||
|
|
103
|
-
data.ai_summaries != null ||
|
|
104
|
-
data.inference_params != null;
|
|
105
|
-
if (!hasAnyNode) {
|
|
106
|
-
warnPayloadOnce(`emptyData:${correlationId}`, '[scheduleActivityLog] data present but contains no known nodes', { correlationId, eventType });
|
|
107
|
-
}
|
|
108
|
-
return {
|
|
109
|
-
transactionNode: toTransactionNode(data.transaction_node),
|
|
110
|
-
lineNode: toLineNode(data.line_node),
|
|
111
|
-
scheduleNode: toScheduleNode(data.schedule_node),
|
|
112
|
-
aiSummaries: toAISummaries(data.ai_summaries),
|
|
113
|
-
inferenceParams: toInferenceParams(data.inference_params),
|
|
114
|
-
userId: data.user_id,
|
|
115
|
-
user: undefined,
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
exports.toScheduleActivityLogData = toScheduleActivityLogData;
|
|
119
|
-
const toScheduleActivityLog = (payload) => {
|
|
120
|
-
return {
|
|
121
|
-
id: (0, exports.toScheduleActivityLogId)(payload.correlation_id, payload.event_type, payload.create_time),
|
|
122
|
-
correlationId: payload.correlation_id,
|
|
123
|
-
data: payload.data != null
|
|
124
|
-
? (0, exports.toScheduleActivityLogData)(payload.data, payload.correlation_id, payload.event_type)
|
|
125
|
-
: null,
|
|
126
|
-
eventType: (0, scheduleActivityLogState_1.toScheduleActivityLogEventType)(payload.event_type),
|
|
127
|
-
createTime: (0, zeniDayJS_1.date)(payload.create_time),
|
|
128
|
-
processingTimeMs: payload.processing_time_ms,
|
|
129
|
-
statusCode: payload.status_code,
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
exports.toScheduleActivityLog = toScheduleActivityLog;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ScheduleActivityLogPayload } from './scheduleActivityLogPayload';
|
|
2
|
-
import { ScheduleActivityLogState } from './scheduleActivityLogState';
|
|
3
|
-
export declare const initialState: ScheduleActivityLogState;
|
|
4
|
-
export declare const updateScheduleActivityLogs: import("@reduxjs/toolkit").ActionCreatorWithPayload<ScheduleActivityLogPayload[], "scheduleActivityLog/updateScheduleActivityLogs">, clearAllScheduleActivityLogs: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"scheduleActivityLog/clearAllScheduleActivityLogs">;
|
|
5
|
-
declare const _default: import("redux").Reducer<ScheduleActivityLogState>;
|
|
6
|
-
export default _default;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearAllScheduleActivityLogs = exports.updateScheduleActivityLogs = exports.initialState = void 0;
|
|
5
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
-
const scheduleActivityLogPayload_1 = require("./scheduleActivityLogPayload");
|
|
7
|
-
exports.initialState = {
|
|
8
|
-
scheduleActivityLogById: {},
|
|
9
|
-
};
|
|
10
|
-
const scheduleActivityLog = (0, toolkit_1.createSlice)({
|
|
11
|
-
name: 'scheduleActivityLog',
|
|
12
|
-
initialState: exports.initialState,
|
|
13
|
-
reducers: {
|
|
14
|
-
updateScheduleActivityLogs(draft, action) {
|
|
15
|
-
action.payload.forEach((scheduleActivityLogPayload) => {
|
|
16
|
-
const scheduleActivityLog = (0, scheduleActivityLogPayload_1.toScheduleActivityLog)(scheduleActivityLogPayload);
|
|
17
|
-
draft.scheduleActivityLogById[scheduleActivityLog.id] =
|
|
18
|
-
scheduleActivityLog;
|
|
19
|
-
});
|
|
20
|
-
},
|
|
21
|
-
clearAllScheduleActivityLogs(draft) {
|
|
22
|
-
draft.scheduleActivityLogById = {};
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
_a = scheduleActivityLog.actions, exports.updateScheduleActivityLogs = _a.updateScheduleActivityLogs, exports.clearAllScheduleActivityLogs = _a.clearAllScheduleActivityLogs;
|
|
27
|
-
exports.default = scheduleActivityLog.reducer;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
import { ScheduleActivityLog, ScheduleActivityLogState } from './scheduleActivityLogState';
|
|
3
|
-
export declare function getScheduleActivityLogsByIds(scheduleActivityLogState: ScheduleActivityLogState, scheduleActivityLogIds: ID[]): ScheduleActivityLog[];
|
|
4
|
-
export declare function getScheduleActivityLogById(scheduleActivityLogState: ScheduleActivityLogState, scheduleActivityLogId: ID): ScheduleActivityLog | undefined;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getScheduleActivityLogsByIds = getScheduleActivityLogsByIds;
|
|
7
|
-
exports.getScheduleActivityLogById = getScheduleActivityLogById;
|
|
8
|
-
const get_1 = __importDefault(require("lodash/get"));
|
|
9
|
-
function getScheduleActivityLogsByIds(scheduleActivityLogState, scheduleActivityLogIds) {
|
|
10
|
-
const scheduleActivityLogs = scheduleActivityLogIds
|
|
11
|
-
.map((scheduleActivityLogId) => getScheduleActivityLogById(scheduleActivityLogState, scheduleActivityLogId))
|
|
12
|
-
.filter((value) => value != null);
|
|
13
|
-
return scheduleActivityLogs;
|
|
14
|
-
}
|
|
15
|
-
function getScheduleActivityLogById(scheduleActivityLogState, scheduleActivityLogId) {
|
|
16
|
-
return (0, get_1.default)(scheduleActivityLogState.scheduleActivityLogById, scheduleActivityLogId, undefined);
|
|
17
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
import { ZeniDate } from '../../zeniDayJS';
|
|
3
|
-
import { AccountBase } from '../account/accountState';
|
|
4
|
-
import { ClassBase } from '../class/classState';
|
|
5
|
-
import { User } from '../user/userState';
|
|
6
|
-
import { VendorBase } from '../vendor/vendorState';
|
|
7
|
-
export declare const ALL_SCHEDULE_ACTIVITY_LOG_EVENT_TYPE: readonly ["transaction.schedule_processing_starts", "transaction.schedule_processing_completed", "schedule.line.processing_started", "schedule.draft_created", "schedule.ongoing_created", "schedule.user_update", "schedule.user_read", "schedule.candidature.prepaid_expense.success", "schedule.candidature.fixed_asset.success", "schedule.candidature.accrual_expense.success", "schedule.inference.failure", "schedule.inference.prepaid_expense.success", "schedule.inference.fixed_asset.success", "schedule.inference.accrual_expense.success", "monthly_journal_entry.posted", "monthly_journal_entry.posting_failed", "schedule.reconcile.cleanup.draft_deleted", "schedule.reconcile.cleanup.nondraft_tampered", "schedule.reconcile.ongoing_schedule.deleted", "schedule.reconcile.schedule.tampered", "schedule.line.pending_review.draft_deleted", "schedule.line.pending_review.ongoing_deleted", "schedule.line.pending_review.ongoing_tampered"];
|
|
8
|
-
export declare const toScheduleActivityLogEventType: (v: string) => "transaction.schedule_processing_starts" | "transaction.schedule_processing_completed" | "schedule.line.processing_started" | "schedule.draft_created" | "schedule.ongoing_created" | "schedule.user_update" | "schedule.user_read" | "schedule.candidature.prepaid_expense.success" | "schedule.candidature.fixed_asset.success" | "schedule.candidature.accrual_expense.success" | "schedule.inference.failure" | "schedule.inference.prepaid_expense.success" | "schedule.inference.fixed_asset.success" | "schedule.inference.accrual_expense.success" | "monthly_journal_entry.posted" | "monthly_journal_entry.posting_failed" | "schedule.reconcile.cleanup.draft_deleted" | "schedule.reconcile.cleanup.nondraft_tampered" | "schedule.reconcile.ongoing_schedule.deleted" | "schedule.reconcile.schedule.tampered" | "schedule.line.pending_review.draft_deleted" | "schedule.line.pending_review.ongoing_deleted" | "schedule.line.pending_review.ongoing_tampered";
|
|
9
|
-
export type ScheduleActivityLogEventType = ReturnType<typeof toScheduleActivityLogEventType>;
|
|
10
|
-
export interface ScheduleActivityTransactionNode {
|
|
11
|
-
attachmentCount?: number;
|
|
12
|
-
creationSource?: string;
|
|
13
|
-
isDeleted?: boolean;
|
|
14
|
-
linesCount?: number;
|
|
15
|
-
syncToken?: number;
|
|
16
|
-
}
|
|
17
|
-
export interface ScheduleActivityLineNode {
|
|
18
|
-
account?: AccountBase;
|
|
19
|
-
amount?: number;
|
|
20
|
-
categorizationStatus?: string;
|
|
21
|
-
class?: ClassBase;
|
|
22
|
-
lineDescription?: string;
|
|
23
|
-
lineId?: string;
|
|
24
|
-
vendor?: VendorBase;
|
|
25
|
-
}
|
|
26
|
-
export interface ScheduleActivityScheduleNode {
|
|
27
|
-
balance?: number;
|
|
28
|
-
baseTransactionAmount?: number;
|
|
29
|
-
baseTransactionId?: string;
|
|
30
|
-
jeScheduleId?: string;
|
|
31
|
-
jeScheduleType?: string;
|
|
32
|
-
period?: number;
|
|
33
|
-
statusCode?: string;
|
|
34
|
-
vendorId?: string;
|
|
35
|
-
}
|
|
36
|
-
export interface ScheduleActivityAISummary {
|
|
37
|
-
confidenceScore?: number;
|
|
38
|
-
reasoning?: string;
|
|
39
|
-
scheduleType?: string;
|
|
40
|
-
statusCode?: string;
|
|
41
|
-
}
|
|
42
|
-
export interface ScheduleActivityInferenceParam {
|
|
43
|
-
key: string;
|
|
44
|
-
value: string;
|
|
45
|
-
reasoning?: string;
|
|
46
|
-
}
|
|
47
|
-
export interface ScheduleActivityLogData {
|
|
48
|
-
aiSummaries?: ScheduleActivityAISummary[];
|
|
49
|
-
inferenceParams?: ScheduleActivityInferenceParam[];
|
|
50
|
-
lineNode?: ScheduleActivityLineNode;
|
|
51
|
-
scheduleNode?: ScheduleActivityScheduleNode;
|
|
52
|
-
transactionNode?: ScheduleActivityTransactionNode;
|
|
53
|
-
user?: User;
|
|
54
|
-
userId?: string;
|
|
55
|
-
}
|
|
56
|
-
export interface ScheduleActivityLog {
|
|
57
|
-
correlationId: string;
|
|
58
|
-
createTime: ZeniDate;
|
|
59
|
-
data: ScheduleActivityLogData | null;
|
|
60
|
-
eventType: ScheduleActivityLogEventType;
|
|
61
|
-
id: ID;
|
|
62
|
-
processingTimeMs?: number;
|
|
63
|
-
statusCode?: string;
|
|
64
|
-
}
|
|
65
|
-
export interface ScheduleActivityLogState {
|
|
66
|
-
scheduleActivityLogById: Record<ID, ScheduleActivityLog>;
|
|
67
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toScheduleActivityLogEventType = exports.ALL_SCHEDULE_ACTIVITY_LOG_EVENT_TYPE = void 0;
|
|
4
|
-
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
5
|
-
exports.ALL_SCHEDULE_ACTIVITY_LOG_EVENT_TYPE = [
|
|
6
|
-
// Transaction processing
|
|
7
|
-
'transaction.schedule_processing_starts',
|
|
8
|
-
'transaction.schedule_processing_completed',
|
|
9
|
-
// Line processing
|
|
10
|
-
'schedule.line.processing_started',
|
|
11
|
-
// Schedule lifecycle
|
|
12
|
-
'schedule.draft_created',
|
|
13
|
-
'schedule.ongoing_created',
|
|
14
|
-
// Human actions
|
|
15
|
-
'schedule.user_update',
|
|
16
|
-
'schedule.user_read',
|
|
17
|
-
// Candidature / eligibility
|
|
18
|
-
'schedule.candidature.prepaid_expense.success',
|
|
19
|
-
'schedule.candidature.fixed_asset.success',
|
|
20
|
-
'schedule.candidature.accrual_expense.success',
|
|
21
|
-
// Inference
|
|
22
|
-
'schedule.inference.failure',
|
|
23
|
-
'schedule.inference.prepaid_expense.success',
|
|
24
|
-
'schedule.inference.fixed_asset.success',
|
|
25
|
-
'schedule.inference.accrual_expense.success',
|
|
26
|
-
// JE posting
|
|
27
|
-
'monthly_journal_entry.posted',
|
|
28
|
-
'monthly_journal_entry.posting_failed',
|
|
29
|
-
// Deletion and tampering
|
|
30
|
-
'schedule.reconcile.cleanup.draft_deleted',
|
|
31
|
-
'schedule.reconcile.cleanup.nondraft_tampered',
|
|
32
|
-
'schedule.reconcile.ongoing_schedule.deleted',
|
|
33
|
-
'schedule.reconcile.schedule.tampered',
|
|
34
|
-
'schedule.line.pending_review.draft_deleted',
|
|
35
|
-
'schedule.line.pending_review.ongoing_deleted',
|
|
36
|
-
'schedule.line.pending_review.ongoing_tampered',
|
|
37
|
-
];
|
|
38
|
-
const toScheduleActivityLogEventType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_SCHEDULE_ACTIVITY_LOG_EVENT_TYPE);
|
|
39
|
-
exports.toScheduleActivityLogEventType = toScheduleActivityLogEventType;
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { date } from '../../zeniDayJS';
|
|
2
|
-
import { mapAccountBasePayloadToAccountBase, } from '../account/accountPayload';
|
|
3
|
-
import { mapClassBasePayloadToClassBase, } from '../class/classPayload';
|
|
4
|
-
import { mapVendorBasePayloadToVendorBase, } from '../vendor/vendorPayload';
|
|
5
|
-
import { toScheduleActivityLogEventType, } from './scheduleActivityLogState';
|
|
6
|
-
// ---------------------------------------------------------------------------
|
|
7
|
-
// ID generation
|
|
8
|
-
// ---------------------------------------------------------------------------
|
|
9
|
-
export const toScheduleActivityLogId = (correlationId, eventType, createTime) => createTime != null
|
|
10
|
-
? `${correlationId}-${eventType}-${createTime}`
|
|
11
|
-
: `${correlationId}-${eventType}`;
|
|
12
|
-
// ---------------------------------------------------------------------------
|
|
13
|
-
// Deduped one-time warns
|
|
14
|
-
// ---------------------------------------------------------------------------
|
|
15
|
-
const warnedPayloadKeys = new Set();
|
|
16
|
-
const warnPayloadOnce = (key, message, payload) => {
|
|
17
|
-
if (warnedPayloadKeys.has(key)) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
warnedPayloadKeys.add(key);
|
|
21
|
-
console.warn(message, payload);
|
|
22
|
-
};
|
|
23
|
-
// ---------------------------------------------------------------------------
|
|
24
|
-
// Mappers — payload → domain
|
|
25
|
-
// ---------------------------------------------------------------------------
|
|
26
|
-
const toTransactionNode = (payload) => {
|
|
27
|
-
if (payload == null) {
|
|
28
|
-
return undefined;
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
attachmentCount: payload.attachment_count,
|
|
32
|
-
creationSource: payload.creation_source,
|
|
33
|
-
isDeleted: payload.is_deleted,
|
|
34
|
-
linesCount: payload.lines_count,
|
|
35
|
-
syncToken: payload.sync_token,
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
const toLineNode = (payload) => {
|
|
39
|
-
if (payload == null) {
|
|
40
|
-
return undefined;
|
|
41
|
-
}
|
|
42
|
-
const detail = payload.line_detail;
|
|
43
|
-
return {
|
|
44
|
-
amount: payload.amount,
|
|
45
|
-
categorizationStatus: payload.categorization_status,
|
|
46
|
-
lineDescription: payload.line_description,
|
|
47
|
-
lineId: payload.line_id,
|
|
48
|
-
account: detail?.account
|
|
49
|
-
? mapAccountBasePayloadToAccountBase(detail.account)
|
|
50
|
-
: undefined,
|
|
51
|
-
class: detail?.accounting_class
|
|
52
|
-
? mapClassBasePayloadToClassBase(detail.accounting_class)
|
|
53
|
-
: undefined,
|
|
54
|
-
vendor: detail?.vendor
|
|
55
|
-
? mapVendorBasePayloadToVendorBase(detail.vendor)
|
|
56
|
-
: undefined,
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
const toScheduleNode = (payload) => {
|
|
60
|
-
if (payload == null) {
|
|
61
|
-
return undefined;
|
|
62
|
-
}
|
|
63
|
-
return {
|
|
64
|
-
balance: payload.balance,
|
|
65
|
-
baseTransactionAmount: payload.base_transaction_amount,
|
|
66
|
-
baseTransactionId: payload.base_transaction_id,
|
|
67
|
-
jeScheduleId: payload.je_schedule_id,
|
|
68
|
-
jeScheduleType: payload.je_schedule_type,
|
|
69
|
-
period: payload.period,
|
|
70
|
-
statusCode: payload.status_code,
|
|
71
|
-
vendorId: payload.vendor_id,
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
const toAISummaries = (payload) => {
|
|
75
|
-
if (payload == null || payload.length === 0) {
|
|
76
|
-
return undefined;
|
|
77
|
-
}
|
|
78
|
-
return payload.map((item) => ({
|
|
79
|
-
confidenceScore: item.confidence_score,
|
|
80
|
-
reasoning: item.reasoning,
|
|
81
|
-
scheduleType: item.schedule_type,
|
|
82
|
-
statusCode: item.status_code,
|
|
83
|
-
}));
|
|
84
|
-
};
|
|
85
|
-
const toInferenceParams = (payload) => {
|
|
86
|
-
if (payload == null || payload.length === 0) {
|
|
87
|
-
return undefined;
|
|
88
|
-
}
|
|
89
|
-
return payload.map((item) => ({
|
|
90
|
-
key: item.key,
|
|
91
|
-
reasoning: item.reasoning,
|
|
92
|
-
value: item.value,
|
|
93
|
-
}));
|
|
94
|
-
};
|
|
95
|
-
export const toScheduleActivityLogData = (data, correlationId, eventType) => {
|
|
96
|
-
const hasAnyNode = data.transaction_node != null ||
|
|
97
|
-
data.line_node != null ||
|
|
98
|
-
data.schedule_node != null ||
|
|
99
|
-
data.ai_summaries != null ||
|
|
100
|
-
data.inference_params != null;
|
|
101
|
-
if (!hasAnyNode) {
|
|
102
|
-
warnPayloadOnce(`emptyData:${correlationId}`, '[scheduleActivityLog] data present but contains no known nodes', { correlationId, eventType });
|
|
103
|
-
}
|
|
104
|
-
return {
|
|
105
|
-
transactionNode: toTransactionNode(data.transaction_node),
|
|
106
|
-
lineNode: toLineNode(data.line_node),
|
|
107
|
-
scheduleNode: toScheduleNode(data.schedule_node),
|
|
108
|
-
aiSummaries: toAISummaries(data.ai_summaries),
|
|
109
|
-
inferenceParams: toInferenceParams(data.inference_params),
|
|
110
|
-
userId: data.user_id,
|
|
111
|
-
user: undefined,
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
export const toScheduleActivityLog = (payload) => {
|
|
115
|
-
return {
|
|
116
|
-
id: toScheduleActivityLogId(payload.correlation_id, payload.event_type, payload.create_time),
|
|
117
|
-
correlationId: payload.correlation_id,
|
|
118
|
-
data: payload.data != null
|
|
119
|
-
? toScheduleActivityLogData(payload.data, payload.correlation_id, payload.event_type)
|
|
120
|
-
: null,
|
|
121
|
-
eventType: toScheduleActivityLogEventType(payload.event_type),
|
|
122
|
-
createTime: date(payload.create_time),
|
|
123
|
-
processingTimeMs: payload.processing_time_ms,
|
|
124
|
-
statusCode: payload.status_code,
|
|
125
|
-
};
|
|
126
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
import { toScheduleActivityLog, } from './scheduleActivityLogPayload';
|
|
3
|
-
export const initialState = {
|
|
4
|
-
scheduleActivityLogById: {},
|
|
5
|
-
};
|
|
6
|
-
const scheduleActivityLog = createSlice({
|
|
7
|
-
name: 'scheduleActivityLog',
|
|
8
|
-
initialState,
|
|
9
|
-
reducers: {
|
|
10
|
-
updateScheduleActivityLogs(draft, action) {
|
|
11
|
-
action.payload.forEach((scheduleActivityLogPayload) => {
|
|
12
|
-
const scheduleActivityLog = toScheduleActivityLog(scheduleActivityLogPayload);
|
|
13
|
-
draft.scheduleActivityLogById[scheduleActivityLog.id] =
|
|
14
|
-
scheduleActivityLog;
|
|
15
|
-
});
|
|
16
|
-
},
|
|
17
|
-
clearAllScheduleActivityLogs(draft) {
|
|
18
|
-
draft.scheduleActivityLogById = {};
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
export const { updateScheduleActivityLogs, clearAllScheduleActivityLogs } = scheduleActivityLog.actions;
|
|
23
|
-
export default scheduleActivityLog.reducer;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import recordGet from 'lodash/get';
|
|
2
|
-
export function getScheduleActivityLogsByIds(scheduleActivityLogState, scheduleActivityLogIds) {
|
|
3
|
-
const scheduleActivityLogs = scheduleActivityLogIds
|
|
4
|
-
.map((scheduleActivityLogId) => getScheduleActivityLogById(scheduleActivityLogState, scheduleActivityLogId))
|
|
5
|
-
.filter((value) => value != null);
|
|
6
|
-
return scheduleActivityLogs;
|
|
7
|
-
}
|
|
8
|
-
export function getScheduleActivityLogById(scheduleActivityLogState, scheduleActivityLogId) {
|
|
9
|
-
return recordGet(scheduleActivityLogState.scheduleActivityLogById, scheduleActivityLogId, undefined);
|
|
10
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { stringToUnion } from '../../commonStateTypes/stringToUnion';
|
|
2
|
-
export const ALL_SCHEDULE_ACTIVITY_LOG_EVENT_TYPE = [
|
|
3
|
-
// Transaction processing
|
|
4
|
-
'transaction.schedule_processing_starts',
|
|
5
|
-
'transaction.schedule_processing_completed',
|
|
6
|
-
// Line processing
|
|
7
|
-
'schedule.line.processing_started',
|
|
8
|
-
// Schedule lifecycle
|
|
9
|
-
'schedule.draft_created',
|
|
10
|
-
'schedule.ongoing_created',
|
|
11
|
-
// Human actions
|
|
12
|
-
'schedule.user_update',
|
|
13
|
-
'schedule.user_read',
|
|
14
|
-
// Candidature / eligibility
|
|
15
|
-
'schedule.candidature.prepaid_expense.success',
|
|
16
|
-
'schedule.candidature.fixed_asset.success',
|
|
17
|
-
'schedule.candidature.accrual_expense.success',
|
|
18
|
-
// Inference
|
|
19
|
-
'schedule.inference.failure',
|
|
20
|
-
'schedule.inference.prepaid_expense.success',
|
|
21
|
-
'schedule.inference.fixed_asset.success',
|
|
22
|
-
'schedule.inference.accrual_expense.success',
|
|
23
|
-
// JE posting
|
|
24
|
-
'monthly_journal_entry.posted',
|
|
25
|
-
'monthly_journal_entry.posting_failed',
|
|
26
|
-
// Deletion and tampering
|
|
27
|
-
'schedule.reconcile.cleanup.draft_deleted',
|
|
28
|
-
'schedule.reconcile.cleanup.nondraft_tampered',
|
|
29
|
-
'schedule.reconcile.ongoing_schedule.deleted',
|
|
30
|
-
'schedule.reconcile.schedule.tampered',
|
|
31
|
-
'schedule.line.pending_review.draft_deleted',
|
|
32
|
-
'schedule.line.pending_review.ongoing_deleted',
|
|
33
|
-
'schedule.line.pending_review.ongoing_tampered',
|
|
34
|
-
];
|
|
35
|
-
export const toScheduleActivityLogEventType = (v) => stringToUnion(v, ALL_SCHEDULE_ACTIVITY_LOG_EVENT_TYPE);
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { from, of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
|
-
import { updateScheduleActivityLogs } from '../../entity/scheduleActivityLog/scheduleActivityLogReducer';
|
|
4
|
-
import { updateAllUsers } from '../../entity/user/userReducer';
|
|
5
|
-
import { createZeniAPIStatus, isSuccessResponse } from '../../responsePayload';
|
|
6
|
-
import { fetchScheduleActivityLog, updateScheduleActivityLogViewFetchStatus, updateScheduleActivityLogViewOnSuccess, } from './scheduleActivityLogViewReducer';
|
|
7
|
-
// Drop any payload that lacks the three top-level fields the entity pipeline
|
|
8
|
-
// strictly needs (`event_type`, `correlation_id`, `create_time`). Surfaces each
|
|
9
|
-
// drop as a console.warn so the next backend iteration has a list of gaps to
|
|
10
|
-
// tighten. Returns the kept items so the rest of the timeline still renders.
|
|
11
|
-
export const filterValidScheduleActivityPayloads = (rawActivity) => {
|
|
12
|
-
const safe = [];
|
|
13
|
-
for (const item of rawActivity) {
|
|
14
|
-
if (typeof item?.event_type !== 'string') {
|
|
15
|
-
console.warn('[scheduleActivityLog] dropping payload: missing event_type', item);
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
if (typeof item?.correlation_id !== 'string') {
|
|
19
|
-
console.warn('[scheduleActivityLog] dropping payload: missing correlation_id', item);
|
|
20
|
-
continue;
|
|
21
|
-
}
|
|
22
|
-
if (typeof item?.create_time !== 'string') {
|
|
23
|
-
console.warn('[scheduleActivityLog] dropping payload: missing create_time', item);
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
safe.push(item);
|
|
27
|
-
}
|
|
28
|
-
return safe;
|
|
29
|
-
};
|
|
30
|
-
export const fetchScheduleActivityLogEpic = (actions$, _, zeniAPI) => actions$.pipe(filter(fetchScheduleActivityLog.match), switchMap((action) => {
|
|
31
|
-
const { scheduleId } = action.payload;
|
|
32
|
-
return zeniAPI
|
|
33
|
-
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules/${scheduleId}/activity`)
|
|
34
|
-
.pipe(mergeMap((response) => {
|
|
35
|
-
if (isSuccessResponse(response) &&
|
|
36
|
-
response.data != null &&
|
|
37
|
-
response.data.activity != null) {
|
|
38
|
-
const safeActivity = filterValidScheduleActivityPayloads(response.data.activity);
|
|
39
|
-
const updateActions = [];
|
|
40
|
-
if (response.data.users != null &&
|
|
41
|
-
response.data.users.length > 0) {
|
|
42
|
-
updateActions.push(updateAllUsers({
|
|
43
|
-
users: response.data.users,
|
|
44
|
-
updateType: 'merge',
|
|
45
|
-
}));
|
|
46
|
-
}
|
|
47
|
-
updateActions.push(updateScheduleActivityLogs(safeActivity));
|
|
48
|
-
updateActions.push(updateScheduleActivityLogViewOnSuccess({
|
|
49
|
-
data: safeActivity,
|
|
50
|
-
scheduleId,
|
|
51
|
-
}));
|
|
52
|
-
return from(updateActions);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
return of(updateScheduleActivityLogViewFetchStatus({
|
|
56
|
-
fetchState: 'Error',
|
|
57
|
-
error: response.status,
|
|
58
|
-
scheduleId,
|
|
59
|
-
}));
|
|
60
|
-
}
|
|
61
|
-
}), catchError((error) => of(updateScheduleActivityLogViewFetchStatus({
|
|
62
|
-
scheduleId,
|
|
63
|
-
fetchState: 'Error',
|
|
64
|
-
error: createZeniAPIStatus('Unexpected Error', 'fetch schedule activity log REST API call errored out' +
|
|
65
|
-
JSON.stringify(error)),
|
|
66
|
-
}))));
|
|
67
|
-
}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|