@zeniai/client-epic-state 5.0.69-beta0RJ → 5.0.69-beta1RJ
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/scheduleActivityLog/scheduleActivityLogPayload.d.ts +1 -1
- package/lib/entity/scheduleActivityLog/scheduleActivityLogPayload.js +4 -2
- package/lib/entity/scheduleActivityLog/scheduleActivityLogState.d.ts +2 -9
- package/lib/entity/scheduleActivityLog/scheduleActivityLogState.js +21 -13
- package/lib/esm/entity/scheduleActivityLog/scheduleActivityLogPayload.js +4 -2
- package/lib/esm/entity/scheduleActivityLog/scheduleActivityLogState.js +21 -13
- package/lib/esm/view/scheduleActivityLogView/scheduleActivityLogViewReducer.js +4 -1
- package/lib/view/scheduleActivityLogView/scheduleActivityLogViewReducer.js +4 -1
- package/package.json +1 -1
|
@@ -31,6 +31,6 @@ export interface ScheduleActivityLogPayload {
|
|
|
31
31
|
processing_time_ms: number;
|
|
32
32
|
status_code: string;
|
|
33
33
|
}
|
|
34
|
-
export declare const toScheduleActivityLogId: (correlationId: string, eventType: string, lineId: string | null | undefined) => string;
|
|
34
|
+
export declare const toScheduleActivityLogId: (correlationId: string, eventType: string, lineId: string | null | undefined, createTime?: string) => string;
|
|
35
35
|
export declare const toScheduleActivityLogData: (data: ScheduleActivityLogDataPayload, correlationId: string, eventType?: string) => ScheduleActivityLogData;
|
|
36
36
|
export declare const toScheduleActivityLog: (payload: ScheduleActivityLogPayload) => ScheduleActivityLog;
|
|
@@ -7,7 +7,9 @@ const classPayload_1 = require("../class/classPayload");
|
|
|
7
7
|
const transactionLinePayload_1 = require("../transaction/payloadTypes/transactionLinePayload");
|
|
8
8
|
const vendorPayload_1 = require("../vendor/vendorPayload");
|
|
9
9
|
const scheduleActivityLogState_1 = require("./scheduleActivityLogState");
|
|
10
|
-
const toScheduleActivityLogId = (correlationId, eventType, lineId) =>
|
|
10
|
+
const toScheduleActivityLogId = (correlationId, eventType, lineId, createTime) => createTime != null
|
|
11
|
+
? `${correlationId}-${eventType}-${lineId ?? '1'}-${createTime}`
|
|
12
|
+
: `${correlationId}-${eventType}-${lineId ?? '1'}`;
|
|
11
13
|
exports.toScheduleActivityLogId = toScheduleActivityLogId;
|
|
12
14
|
// Phase 2: deduped one-time warns so a single malformed backend payload does
|
|
13
15
|
// not spam the console on every render. Keys are intentionally specific (id +
|
|
@@ -71,7 +73,7 @@ const toScheduleActivityLogData = (data, correlationId, eventType) => {
|
|
|
71
73
|
exports.toScheduleActivityLogData = toScheduleActivityLogData;
|
|
72
74
|
const toScheduleActivityLog = (payload) => {
|
|
73
75
|
return {
|
|
74
|
-
id: (0, exports.toScheduleActivityLogId)(payload.correlation_id, payload.event_type, payload.data?.transaction?.line_id),
|
|
76
|
+
id: (0, exports.toScheduleActivityLogId)(payload.correlation_id, payload.event_type, payload.data?.transaction?.line_id, payload.create_time),
|
|
75
77
|
data: payload.data != null
|
|
76
78
|
? (0, exports.toScheduleActivityLogData)(payload.data, payload.correlation_id, payload.event_type)
|
|
77
79
|
: null,
|
|
@@ -5,15 +5,8 @@ import { ClassBase } from '../class/classState';
|
|
|
5
5
|
import { AISummary } from '../transaction/stateTypes/transactionLine';
|
|
6
6
|
import { User } from '../user/userState';
|
|
7
7
|
import { VendorBase } from '../vendor/vendorState';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* schedule event types (schedule.created, agent_je.detected, agent_je.drafted,
|
|
11
|
-
* je.posted, schedule.user_update.<field>, etc.) once the backend contract is
|
|
12
|
-
* finalised. Keeping the union narrow lets `toScheduleActivityLogEventType`
|
|
13
|
-
* fall back to the raw string for unknown events without throwing.
|
|
14
|
-
*/
|
|
15
|
-
export declare const ALL_SCHEDULE_ACTIVITY_LOG_EVENT_TYPE: readonly ["schedule.created", "schedule.user_update", "agent_je.detected", "agent_je.eligible", "agent_je.deleted", "agent_je.drafted", "je.posted", "transaction.sync_database"];
|
|
16
|
-
export declare const toScheduleActivityLogEventType: (v: string) => "schedule.created" | "schedule.user_update" | "agent_je.detected" | "agent_je.eligible" | "agent_je.deleted" | "agent_je.drafted" | "je.posted" | "transaction.sync_database";
|
|
8
|
+
export declare const ALL_SCHEDULE_ACTIVITY_LOG_EVENT_TYPE: readonly ["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", "monthly_journal_entry.posted", "monthly_journal_entry.posting_failed", "transaction.sync_database", "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 declare const toScheduleActivityLogEventType: (v: string) => "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" | "monthly_journal_entry.posted" | "monthly_journal_entry.posting_failed" | "transaction.sync_database" | "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";
|
|
17
10
|
export type ScheduleActivityLogEventType = ReturnType<typeof toScheduleActivityLogEventType>;
|
|
18
11
|
/**
|
|
19
12
|
* Per-line snapshot fields the backend may include in original/updated_line.
|
|
@@ -2,22 +2,30 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toScheduleActivityLogEventType = exports.ALL_SCHEDULE_ACTIVITY_LOG_EVENT_TYPE = void 0;
|
|
4
4
|
const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
5
|
-
/**
|
|
6
|
-
* Phase 1 retains a small placeholder union; Phase 2 will extend with real
|
|
7
|
-
* schedule event types (schedule.created, agent_je.detected, agent_je.drafted,
|
|
8
|
-
* je.posted, schedule.user_update.<field>, etc.) once the backend contract is
|
|
9
|
-
* finalised. Keeping the union narrow lets `toScheduleActivityLogEventType`
|
|
10
|
-
* fall back to the raw string for unknown events without throwing.
|
|
11
|
-
*/
|
|
12
5
|
exports.ALL_SCHEDULE_ACTIVITY_LOG_EVENT_TYPE = [
|
|
13
|
-
|
|
6
|
+
// Schedule lifecycle
|
|
7
|
+
'schedule.draft_created',
|
|
8
|
+
'schedule.ongoing_created',
|
|
9
|
+
// Human actions
|
|
14
10
|
'schedule.user_update',
|
|
15
|
-
'
|
|
16
|
-
|
|
17
|
-
'
|
|
18
|
-
'
|
|
19
|
-
'
|
|
11
|
+
'schedule.user_read',
|
|
12
|
+
// Candidature / eligibility
|
|
13
|
+
'schedule.candidature.prepaid_expense.success',
|
|
14
|
+
'schedule.candidature.fixed_asset.success',
|
|
15
|
+
'schedule.candidature.accrual_expense.success',
|
|
16
|
+
// JE posting
|
|
17
|
+
'monthly_journal_entry.posted',
|
|
18
|
+
'monthly_journal_entry.posting_failed',
|
|
19
|
+
// System
|
|
20
20
|
'transaction.sync_database',
|
|
21
|
+
// Deletion and tampering
|
|
22
|
+
'schedule.reconcile.cleanup.draft_deleted',
|
|
23
|
+
'schedule.reconcile.cleanup.nondraft_tampered',
|
|
24
|
+
'schedule.reconcile.ongoing_schedule.deleted',
|
|
25
|
+
'schedule.reconcile.schedule.tampered',
|
|
26
|
+
'schedule.line.pending_review.draft_deleted',
|
|
27
|
+
'schedule.line.pending_review.ongoing_deleted',
|
|
28
|
+
'schedule.line.pending_review.ongoing_tampered',
|
|
21
29
|
];
|
|
22
30
|
const toScheduleActivityLogEventType = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_SCHEDULE_ACTIVITY_LOG_EVENT_TYPE);
|
|
23
31
|
exports.toScheduleActivityLogEventType = toScheduleActivityLogEventType;
|
|
@@ -4,7 +4,9 @@ import { mapClassBasePayloadToClassBase, } from '../class/classPayload';
|
|
|
4
4
|
import { toAISummary, } from '../transaction/payloadTypes/transactionLinePayload';
|
|
5
5
|
import { mapVendorBasePayloadToVendorBase, } from '../vendor/vendorPayload';
|
|
6
6
|
import { toScheduleActivityLogEventType, } from './scheduleActivityLogState';
|
|
7
|
-
export const toScheduleActivityLogId = (correlationId, eventType, lineId) =>
|
|
7
|
+
export const toScheduleActivityLogId = (correlationId, eventType, lineId, createTime) => createTime != null
|
|
8
|
+
? `${correlationId}-${eventType}-${lineId ?? '1'}-${createTime}`
|
|
9
|
+
: `${correlationId}-${eventType}-${lineId ?? '1'}`;
|
|
8
10
|
// Phase 2: deduped one-time warns so a single malformed backend payload does
|
|
9
11
|
// not spam the console on every render. Keys are intentionally specific (id +
|
|
10
12
|
// side) so distinct gaps still surface.
|
|
@@ -66,7 +68,7 @@ export const toScheduleActivityLogData = (data, correlationId, eventType) => {
|
|
|
66
68
|
};
|
|
67
69
|
export const toScheduleActivityLog = (payload) => {
|
|
68
70
|
return {
|
|
69
|
-
id: toScheduleActivityLogId(payload.correlation_id, payload.event_type, payload.data?.transaction?.line_id),
|
|
71
|
+
id: toScheduleActivityLogId(payload.correlation_id, payload.event_type, payload.data?.transaction?.line_id, payload.create_time),
|
|
70
72
|
data: payload.data != null
|
|
71
73
|
? toScheduleActivityLogData(payload.data, payload.correlation_id, payload.event_type)
|
|
72
74
|
: null,
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
import { stringToUnion } from '../../commonStateTypes/stringToUnion';
|
|
2
|
-
/**
|
|
3
|
-
* Phase 1 retains a small placeholder union; Phase 2 will extend with real
|
|
4
|
-
* schedule event types (schedule.created, agent_je.detected, agent_je.drafted,
|
|
5
|
-
* je.posted, schedule.user_update.<field>, etc.) once the backend contract is
|
|
6
|
-
* finalised. Keeping the union narrow lets `toScheduleActivityLogEventType`
|
|
7
|
-
* fall back to the raw string for unknown events without throwing.
|
|
8
|
-
*/
|
|
9
2
|
export const ALL_SCHEDULE_ACTIVITY_LOG_EVENT_TYPE = [
|
|
10
|
-
|
|
3
|
+
// Schedule lifecycle
|
|
4
|
+
'schedule.draft_created',
|
|
5
|
+
'schedule.ongoing_created',
|
|
6
|
+
// Human actions
|
|
11
7
|
'schedule.user_update',
|
|
12
|
-
'
|
|
13
|
-
|
|
14
|
-
'
|
|
15
|
-
'
|
|
16
|
-
'
|
|
8
|
+
'schedule.user_read',
|
|
9
|
+
// Candidature / eligibility
|
|
10
|
+
'schedule.candidature.prepaid_expense.success',
|
|
11
|
+
'schedule.candidature.fixed_asset.success',
|
|
12
|
+
'schedule.candidature.accrual_expense.success',
|
|
13
|
+
// JE posting
|
|
14
|
+
'monthly_journal_entry.posted',
|
|
15
|
+
'monthly_journal_entry.posting_failed',
|
|
16
|
+
// System
|
|
17
17
|
'transaction.sync_database',
|
|
18
|
+
// Deletion and tampering
|
|
19
|
+
'schedule.reconcile.cleanup.draft_deleted',
|
|
20
|
+
'schedule.reconcile.cleanup.nondraft_tampered',
|
|
21
|
+
'schedule.reconcile.ongoing_schedule.deleted',
|
|
22
|
+
'schedule.reconcile.schedule.tampered',
|
|
23
|
+
'schedule.line.pending_review.draft_deleted',
|
|
24
|
+
'schedule.line.pending_review.ongoing_deleted',
|
|
25
|
+
'schedule.line.pending_review.ongoing_tampered',
|
|
18
26
|
];
|
|
19
27
|
export const toScheduleActivityLogEventType = (v) => stringToUnion(v, ALL_SCHEDULE_ACTIVITY_LOG_EVENT_TYPE);
|
|
@@ -29,7 +29,10 @@ const scheduleActivityLogView = createSlice({
|
|
|
29
29
|
fetchState: 'Completed',
|
|
30
30
|
error: undefined,
|
|
31
31
|
};
|
|
32
|
-
|
|
32
|
+
const ids = data.map((scheduleActivityLog) => toScheduleActivityLogId(scheduleActivityLog.correlation_id, scheduleActivityLog.event_type, scheduleActivityLog.data?.transaction?.line_id, scheduleActivityLog.create_time));
|
|
33
|
+
draft.scheduleActivityLogIdsByScheduleId[scheduleId] = [
|
|
34
|
+
...new Set(ids),
|
|
35
|
+
];
|
|
33
36
|
},
|
|
34
37
|
updateScheduleActivityLogViewFetchStatus(draft, action) {
|
|
35
38
|
const { fetchState, scheduleId, error } = action.payload;
|
|
@@ -33,7 +33,10 @@ const scheduleActivityLogView = (0, toolkit_1.createSlice)({
|
|
|
33
33
|
fetchState: 'Completed',
|
|
34
34
|
error: undefined,
|
|
35
35
|
};
|
|
36
|
-
|
|
36
|
+
const ids = data.map((scheduleActivityLog) => (0, scheduleActivityLogPayload_1.toScheduleActivityLogId)(scheduleActivityLog.correlation_id, scheduleActivityLog.event_type, scheduleActivityLog.data?.transaction?.line_id, scheduleActivityLog.create_time));
|
|
37
|
+
draft.scheduleActivityLogIdsByScheduleId[scheduleId] = [
|
|
38
|
+
...new Set(ids),
|
|
39
|
+
];
|
|
37
40
|
},
|
|
38
41
|
updateScheduleActivityLogViewFetchStatus(draft, action) {
|
|
39
42
|
const { fetchState, scheduleId, error } = action.payload;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.69-
|
|
3
|
+
"version": "5.0.69-beta1RJ",
|
|
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",
|