law-common 13.0.1-beta.8 → 13.0.2
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/dist/src/api/interface/bank.entity.response.d.ts +8 -11
- package/dist/src/api/interface/document_upload.create.dto.interface.d.ts +2 -1
- package/dist/src/api/interface/reimbursement.entity.response.d.ts +9 -23
- package/dist/src/api/interface/timesheet.entity.response.interface.d.ts +7 -13
- package/dist/src/api/interface/to_do_list.create.dto.interface.d.ts +3 -1
- package/dist/src/api/interface/to_do_list.update.dto.interface.d.ts +2 -1
- package/dist/src/entities/enums/document_upload_status_enum.d.ts +5 -0
- package/dist/src/entities/enums/document_upload_status_enum.js +9 -0
- package/dist/src/entities/enums/to_do_list_status_enum.d.ts +5 -0
- package/dist/src/entities/enums/to_do_list_status_enum.js +9 -0
- package/dist/src/entities/flow-configs/bank_flow.config.d.ts +9 -0
- package/dist/src/entities/flow-configs/bank_flow.config.js +110 -0
- package/dist/src/entities/flow-configs/base-flow-config.factory.d.ts +20 -1
- package/dist/src/entities/flow-configs/base-flow-config.factory.js +1 -16
- package/dist/src/entities/flow-configs/{billing.flow.config.d.ts → billing_flow.config.d.ts} +1 -1
- package/dist/src/entities/flow-configs/billing_flow.config.js +305 -0
- package/dist/src/entities/flow-configs/billing_transaction_flow.config.d.ts +24 -0
- package/dist/src/entities/flow-configs/billing_transaction_flow.config.js +111 -0
- package/dist/src/entities/flow-configs/flow-config.type.d.ts +26 -2
- package/dist/src/entities/flow-configs/leave_flow.config.d.ts +7 -0
- package/dist/src/entities/flow-configs/leave_flow.config.js +117 -65
- package/dist/src/entities/flow-configs/moving_timesheet_flow.config.js +21 -8
- package/dist/src/entities/flow-configs/reimbursement_expense_flow.config.d.ts +8 -0
- package/dist/src/entities/flow-configs/reimbursement_expense_flow.config.js +64 -0
- package/dist/src/entities/flow-configs/reimbursement_flow.config.d.ts +17 -0
- package/dist/src/entities/flow-configs/reimbursement_flow.config.js +131 -0
- package/dist/src/entities/flow-configs/timesheet_flow.config.d.ts +5 -0
- package/dist/src/entities/flow-configs/timesheet_flow.config.js +420 -0
- package/dist/src/entities/flow-configs/vendor_flow.config.js +74 -60
- package/dist/src/entities/index.d.ts +8 -2
- package/dist/src/entities/index.js +8 -2
- package/dist/src/entities/interface/document_upload.entity.interface.d.ts +2 -0
- package/dist/src/entities/interface/field-constraint/document_upload_field_constraints.interface.d.ts +1 -1
- package/dist/src/entities/interface/field-constraint/to_do_list_field_constraints.interface.d.ts +1 -1
- package/dist/src/entities/interface/to_do_list.entity.interface.d.ts +2 -0
- package/dist/src/entities/model/document_upload.entity.model.d.ts +2 -0
- package/dist/src/entities/model/document_upload.entity.model.js +2 -0
- package/dist/src/entities/model/to_do_list.entity.model.d.ts +2 -0
- package/dist/src/entities/model/to_do_list.entity.model.js +2 -0
- package/package.json +1 -1
- package/dist/src/entities/flow-configs/billing.flow.config.js +0 -209
- package/dist/src/entities/flow-configs/billing_transaction.flow.config.d.ts +0 -19
- package/dist/src/entities/flow-configs/billing_transaction.flow.config.js +0 -83
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { BankActionEnum, BankStatusEnum, IBankEntity, IIntermediaryBankEntity } from "../../entities";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
};
|
|
1
|
+
import { BankActionEnum, BankStatusEnum, FlowConfig, IBankEntity, IIntermediaryBankEntity } from "../../entities";
|
|
2
|
+
/**
|
|
3
|
+
* LW-828: this used to re-declare the flow-config shape by hand. It is now an alias of the shared
|
|
4
|
+
* `FlowConfig`, instantiated with `void` as the context type because `next` here is called with no
|
|
5
|
+
* arguments (`BankService.getBankNextStatus`). Kept as a named type so every consumer — including
|
|
6
|
+
* law-admin-web, which receives this config over `GET /bank/flow-config` — keeps compiling unchanged.
|
|
7
|
+
*/
|
|
8
|
+
export type IBankFlowConfig = FlowConfig<BankStatusEnum, BankActionEnum, void>;
|
|
12
9
|
export interface IBankEntityGet extends IBankEntity {
|
|
13
10
|
intermediaryBankDetails?: IIntermediaryBankEntity[];
|
|
14
11
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { IEntityCreateDto, Nullable } from "../../entities";
|
|
2
2
|
import { IAppFileConfig, IFilePayload, MulterFileWithUrl } from "../../misc";
|
|
3
3
|
import { IDocumentUploadEntity } from "../../entities/interface/document_upload.entity.interface";
|
|
4
|
-
|
|
4
|
+
/** status is set by the entity flow, never by the client */
|
|
5
|
+
export type IDocumentUploadCreateExclude = "gstDocument" | "additionalDocuments" | "status";
|
|
5
6
|
export interface IDocumentUploadCreateDto extends Omit<IEntityCreateDto<IDocumentUploadEntity>, IDocumentUploadCreateExclude> {
|
|
6
7
|
gstDocument?: Nullable<MulterFileWithUrl>;
|
|
7
8
|
additionalDocuments?: Nullable<MulterFileWithUrl[]>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IReimbursementEntity, IReimbursementExpenseEntity, IUserEntity, ReimbursementActionEnum, ReimbursementExpenseActionEnum, ReimbursementExpenseState, ReimbursementStatusEnum } from "../../entities";
|
|
1
|
+
import { IReimbursementEntity, IReimbursementExpenseEntity, IUserEntity, ParentChildFlowConfig, ReimbursementActionEnum, ReimbursementExpenseActionEnum, ReimbursementExpenseState, ReimbursementStatusEnum } from "../../entities";
|
|
2
2
|
import { IProjectEntityGet } from "./project.entity.response";
|
|
3
3
|
export type IReimbursementEntityGet = {
|
|
4
4
|
reimbursements: IReimbursementResponse[];
|
|
@@ -7,28 +7,14 @@ export type IReimbursementEntityGet = {
|
|
|
7
7
|
};
|
|
8
8
|
projects: IProjectEntityGet;
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
child: {
|
|
22
|
-
[key in ReimbursementExpenseState]?: {
|
|
23
|
-
actions: {
|
|
24
|
-
[key in ReimbursementExpenseActionEnum]?: {
|
|
25
|
-
permissions: string[];
|
|
26
|
-
next?: () => ReimbursementExpenseState;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
};
|
|
10
|
+
/**
|
|
11
|
+
* LW-828: this used to re-declare the parent/child flow-config shape by hand. It is now an alias of the
|
|
12
|
+
* shared `ParentChildFlowConfig`, instantiated with `IReimbursementFlowContextData` for the parent and
|
|
13
|
+
* `void` for the child — the child's `next` is called with no argument in
|
|
14
|
+
* `ReimbursementExpenseService.getReimbursementNextStatusForChild`. Kept as a named type so every
|
|
15
|
+
* existing consumer keeps compiling unchanged.
|
|
16
|
+
*/
|
|
17
|
+
export type IReimbursementFlowConfig = ParentChildFlowConfig<ReimbursementStatusEnum, ReimbursementActionEnum, ReimbursementExpenseState, ReimbursementExpenseActionEnum, IReimbursementFlowContextData, void>;
|
|
32
18
|
export type IReimbursementFlowContextData = {
|
|
33
19
|
expenseDetails: IReimbursementExpenseEntity[];
|
|
34
20
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IProjectUserMappingEntity, ITimesheetEntity, IUserEntity, TimesheetActionEnum, TimesheetEntityModel, TimesheetStatusEnum } from "../../entities";
|
|
1
|
+
import { FlowConfig, IProjectUserMappingEntity, ITimesheetEntity, IUserEntity, TimesheetActionEnum, TimesheetEntityModel, TimesheetStatusEnum } from "../../entities";
|
|
2
2
|
import { IClientApiEntityDependent } from "./client.entity.response";
|
|
3
3
|
import { IProjectApiEntityDependent } from "./project.entity.response";
|
|
4
4
|
import { ITimesheetEntityUpdateDto } from "./timesheet.update.dto.interface";
|
|
@@ -15,18 +15,12 @@ export type ITimesheetEntityGet = {
|
|
|
15
15
|
};
|
|
16
16
|
tasks: string[];
|
|
17
17
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
next: (data: ITimesheetFlowContextData) => TimesheetStatusEnum;
|
|
25
|
-
validActionPastThreshold?: boolean;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
};
|
|
18
|
+
/**
|
|
19
|
+
* LW-828: this used to re-declare the flow-config shape by hand. It is now an alias of the shared
|
|
20
|
+
* `FlowConfig`, whose action config carries the optional `isApplicable` and `validActionPastThreshold`
|
|
21
|
+
* this entity relies on. Kept as a named type so every existing consumer keeps compiling unchanged.
|
|
22
|
+
*/
|
|
23
|
+
export type ITimesheetFlowConfig = FlowConfig<TimesheetStatusEnum, TimesheetActionEnum, ITimesheetFlowContextData>;
|
|
30
24
|
export type ITimesheetFlowContextData = {
|
|
31
25
|
currentTimesheet?: TimesheetEntityModel;
|
|
32
26
|
projectUserMapping?: IProjectUserMappingEntity;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { IEntityCreateDto, IToDoListEntity } from "../../entities";
|
|
2
|
-
|
|
2
|
+
/** status is set by the entity flow, never by the client */
|
|
3
|
+
export type IToDoListExclude = "status";
|
|
4
|
+
export interface IToDoListCreateDto extends Omit<IEntityCreateDto<IToDoListEntity>, IToDoListExclude> {
|
|
3
5
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IEntityUpdateDto, IToDoListEntity } from "../../entities";
|
|
2
|
-
|
|
2
|
+
import { IToDoListExclude } from "./to_do_list.create.dto.interface";
|
|
3
|
+
export interface IToDoListUpdateDto extends Omit<IEntityUpdateDto<IToDoListEntity>, IToDoListExclude> {
|
|
3
4
|
}
|
|
4
5
|
export interface IToDoListEntityUpdateDtoValidationData {
|
|
5
6
|
toDoListEntity: IToDoListEntity;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DocumentUploadStatusEnum = void 0;
|
|
4
|
+
var DocumentUploadStatusEnum;
|
|
5
|
+
(function (DocumentUploadStatusEnum) {
|
|
6
|
+
DocumentUploadStatusEnum["APPROVED"] = "APPROVED";
|
|
7
|
+
DocumentUploadStatusEnum["DEACTIVATED"] = "DEACTIVATED";
|
|
8
|
+
DocumentUploadStatusEnum["DELETED"] = "DELETED";
|
|
9
|
+
})(DocumentUploadStatusEnum || (exports.DocumentUploadStatusEnum = DocumentUploadStatusEnum = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ToDoListStatusEnum = void 0;
|
|
4
|
+
var ToDoListStatusEnum;
|
|
5
|
+
(function (ToDoListStatusEnum) {
|
|
6
|
+
ToDoListStatusEnum["APPROVED"] = "APPROVED";
|
|
7
|
+
ToDoListStatusEnum["DEACTIVATED"] = "DEACTIVATED";
|
|
8
|
+
ToDoListStatusEnum["DELETED"] = "DELETED";
|
|
9
|
+
})(ToDoListStatusEnum || (exports.ToDoListStatusEnum = ToDoListStatusEnum = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BankActionEnum } from "../enums/bank_action_enum";
|
|
2
|
+
import { BankStatusEnum } from "../enums/bank_status_enum";
|
|
3
|
+
import { FlowConfig } from "./flow-config.type";
|
|
4
|
+
/**
|
|
5
|
+
* Typed with `FlowConfig` directly rather than importing `IBankFlowConfig` from `src/api`, so that
|
|
6
|
+
* `entities` does not reach into `api` for a type it can express itself. `IBankFlowConfig` is now an
|
|
7
|
+
* alias of this same instantiation, so the two cannot drift.
|
|
8
|
+
*/
|
|
9
|
+
export declare const bankFlowConfig: FlowConfig<BankStatusEnum, BankActionEnum, void>;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bankFlowConfig = void 0;
|
|
4
|
+
const bank_action_enum_1 = require("../enums/bank_action_enum");
|
|
5
|
+
const bank_status_enum_1 = require("../enums/bank_status_enum");
|
|
6
|
+
const base_flow_config_factory_1 = require("./base-flow-config.factory");
|
|
7
|
+
const BANK_APPROVER_PERMISSION = ["BANK_APPROVER_ORG"];
|
|
8
|
+
const BANK_UPDATE_PERMISSION = ["BANK_UPDATE_ORG"];
|
|
9
|
+
const ACTION_MAP = {
|
|
10
|
+
// VIEW and CREATE are declared on BankActionEnum but carry no transition in this flow. They are
|
|
11
|
+
// listed so the map covers every enum member; the empty reachable set makes createActionConfig
|
|
12
|
+
// uncallable for them.
|
|
13
|
+
[bank_action_enum_1.BankActionEnum.VIEW]: {
|
|
14
|
+
reachableStatues: [],
|
|
15
|
+
permissions: [],
|
|
16
|
+
},
|
|
17
|
+
[bank_action_enum_1.BankActionEnum.CREATE]: {
|
|
18
|
+
reachableStatues: [],
|
|
19
|
+
permissions: [],
|
|
20
|
+
},
|
|
21
|
+
[bank_action_enum_1.BankActionEnum.UPDATE]: {
|
|
22
|
+
reachableStatues: [bank_status_enum_1.BankStatusEnum.CREATE_APPROVAL_PENDING, bank_status_enum_1.BankStatusEnum.UPDATE_APPROVAL_PENDING],
|
|
23
|
+
permissions: BANK_UPDATE_PERMISSION,
|
|
24
|
+
},
|
|
25
|
+
[bank_action_enum_1.BankActionEnum.DELETE]: {
|
|
26
|
+
reachableStatues: [bank_status_enum_1.BankStatusEnum.DELETE_APPROVAL_PENDING, bank_status_enum_1.BankStatusEnum.DELETED],
|
|
27
|
+
permissions: BANK_UPDATE_PERMISSION,
|
|
28
|
+
},
|
|
29
|
+
[bank_action_enum_1.BankActionEnum.APPROVE]: {
|
|
30
|
+
reachableStatues: [bank_status_enum_1.BankStatusEnum.APPROVED, bank_status_enum_1.BankStatusEnum.DELETED],
|
|
31
|
+
permissions: BANK_APPROVER_PERMISSION,
|
|
32
|
+
},
|
|
33
|
+
[bank_action_enum_1.BankActionEnum.REJECT]: {
|
|
34
|
+
reachableStatues: [bank_status_enum_1.BankStatusEnum.REJECTED, bank_status_enum_1.BankStatusEnum.RESOLVED_REJECTED],
|
|
35
|
+
permissions: BANK_APPROVER_PERMISSION,
|
|
36
|
+
},
|
|
37
|
+
[bank_action_enum_1.BankActionEnum.RECALL]: {
|
|
38
|
+
reachableStatues: [bank_status_enum_1.BankStatusEnum.DELETED],
|
|
39
|
+
permissions: BANK_UPDATE_PERMISSION,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* The context type is `void` rather than `never` or an empty interface, because `IBankFlowConfig`
|
|
44
|
+
* declares `next: () => BankStatusEnum` and `BankService.getBankNextStatus` calls
|
|
45
|
+
* `matchingPermissionConfig.next()` with no arguments. A `void` parameter may be omitted at the call
|
|
46
|
+
* site, so that call keeps compiling; `never` would have required an argument nobody can produce.
|
|
47
|
+
*/
|
|
48
|
+
const { createActionConfig } = (0, base_flow_config_factory_1.createFlowConfigFactory)()(ACTION_MAP);
|
|
49
|
+
// CREATE_APPROVAL_PENDING status transitions
|
|
50
|
+
const transitionCreateApprovalPendingStatusApproveAction = createActionConfig(bank_action_enum_1.BankActionEnum.APPROVE, bank_status_enum_1.BankStatusEnum.APPROVED);
|
|
51
|
+
const transitionCreateApprovalPendingStatusUpdateAction = createActionConfig(bank_action_enum_1.BankActionEnum.UPDATE, bank_status_enum_1.BankStatusEnum.CREATE_APPROVAL_PENDING);
|
|
52
|
+
const transitionCreateApprovalPendingStatusRejectAction = createActionConfig(bank_action_enum_1.BankActionEnum.REJECT, bank_status_enum_1.BankStatusEnum.REJECTED);
|
|
53
|
+
const transitionCreateApprovalPendingStatusDeleteAction = createActionConfig(bank_action_enum_1.BankActionEnum.DELETE, bank_status_enum_1.BankStatusEnum.DELETED);
|
|
54
|
+
// UPDATE_APPROVAL_PENDING status transitions
|
|
55
|
+
const transitionUpdateApprovalPendingStatusApproveAction = createActionConfig(bank_action_enum_1.BankActionEnum.APPROVE, bank_status_enum_1.BankStatusEnum.APPROVED);
|
|
56
|
+
const transitionUpdateApprovalPendingStatusUpdateAction = createActionConfig(bank_action_enum_1.BankActionEnum.UPDATE, bank_status_enum_1.BankStatusEnum.UPDATE_APPROVAL_PENDING);
|
|
57
|
+
const transitionUpdateApprovalPendingStatusRejectAction = createActionConfig(bank_action_enum_1.BankActionEnum.REJECT, bank_status_enum_1.BankStatusEnum.RESOLVED_REJECTED);
|
|
58
|
+
const transitionUpdateApprovalPendingStatusRecallAction = createActionConfig(bank_action_enum_1.BankActionEnum.RECALL, bank_status_enum_1.BankStatusEnum.DELETED);
|
|
59
|
+
// DELETE_APPROVAL_PENDING status transitions
|
|
60
|
+
const transitionDeleteApprovalPendingStatusApproveAction = createActionConfig(bank_action_enum_1.BankActionEnum.APPROVE, bank_status_enum_1.BankStatusEnum.DELETED);
|
|
61
|
+
const transitionDeleteApprovalPendingStatusRejectAction = createActionConfig(bank_action_enum_1.BankActionEnum.REJECT, bank_status_enum_1.BankStatusEnum.RESOLVED_REJECTED);
|
|
62
|
+
const transitionDeleteApprovalPendingStatusRecallAction = createActionConfig(bank_action_enum_1.BankActionEnum.RECALL, bank_status_enum_1.BankStatusEnum.DELETED);
|
|
63
|
+
// APPROVED status transitions
|
|
64
|
+
const transitionApprovedStatusUpdateAction = createActionConfig(bank_action_enum_1.BankActionEnum.UPDATE, bank_status_enum_1.BankStatusEnum.UPDATE_APPROVAL_PENDING);
|
|
65
|
+
const transitionApprovedStatusDeleteAction = createActionConfig(bank_action_enum_1.BankActionEnum.DELETE, bank_status_enum_1.BankStatusEnum.DELETE_APPROVAL_PENDING);
|
|
66
|
+
// RESOLVED_REJECTED status transitions
|
|
67
|
+
const transitionResolvedRejectedStatusUpdateAction = createActionConfig(bank_action_enum_1.BankActionEnum.UPDATE, bank_status_enum_1.BankStatusEnum.UPDATE_APPROVAL_PENDING);
|
|
68
|
+
const transitionResolvedRejectedStatusDeleteAction = createActionConfig(bank_action_enum_1.BankActionEnum.DELETE, bank_status_enum_1.BankStatusEnum.DELETE_APPROVAL_PENDING);
|
|
69
|
+
/**
|
|
70
|
+
* Typed with `FlowConfig` directly rather than importing `IBankFlowConfig` from `src/api`, so that
|
|
71
|
+
* `entities` does not reach into `api` for a type it can express itself. `IBankFlowConfig` is now an
|
|
72
|
+
* alias of this same instantiation, so the two cannot drift.
|
|
73
|
+
*/
|
|
74
|
+
exports.bankFlowConfig = {
|
|
75
|
+
[bank_status_enum_1.BankStatusEnum.CREATE_APPROVAL_PENDING]: {
|
|
76
|
+
actions: {
|
|
77
|
+
[bank_action_enum_1.BankActionEnum.APPROVE]: transitionCreateApprovalPendingStatusApproveAction,
|
|
78
|
+
[bank_action_enum_1.BankActionEnum.UPDATE]: transitionCreateApprovalPendingStatusUpdateAction,
|
|
79
|
+
[bank_action_enum_1.BankActionEnum.REJECT]: transitionCreateApprovalPendingStatusRejectAction,
|
|
80
|
+
[bank_action_enum_1.BankActionEnum.DELETE]: transitionCreateApprovalPendingStatusDeleteAction,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
[bank_status_enum_1.BankStatusEnum.UPDATE_APPROVAL_PENDING]: {
|
|
84
|
+
actions: {
|
|
85
|
+
[bank_action_enum_1.BankActionEnum.APPROVE]: transitionUpdateApprovalPendingStatusApproveAction,
|
|
86
|
+
[bank_action_enum_1.BankActionEnum.UPDATE]: transitionUpdateApprovalPendingStatusUpdateAction,
|
|
87
|
+
[bank_action_enum_1.BankActionEnum.REJECT]: transitionUpdateApprovalPendingStatusRejectAction,
|
|
88
|
+
[bank_action_enum_1.BankActionEnum.RECALL]: transitionUpdateApprovalPendingStatusRecallAction,
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
[bank_status_enum_1.BankStatusEnum.DELETE_APPROVAL_PENDING]: {
|
|
92
|
+
actions: {
|
|
93
|
+
[bank_action_enum_1.BankActionEnum.APPROVE]: transitionDeleteApprovalPendingStatusApproveAction,
|
|
94
|
+
[bank_action_enum_1.BankActionEnum.REJECT]: transitionDeleteApprovalPendingStatusRejectAction,
|
|
95
|
+
[bank_action_enum_1.BankActionEnum.RECALL]: transitionDeleteApprovalPendingStatusRecallAction,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
[bank_status_enum_1.BankStatusEnum.APPROVED]: {
|
|
99
|
+
actions: {
|
|
100
|
+
[bank_action_enum_1.BankActionEnum.UPDATE]: transitionApprovedStatusUpdateAction,
|
|
101
|
+
[bank_action_enum_1.BankActionEnum.DELETE]: transitionApprovedStatusDeleteAction,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
[bank_status_enum_1.BankStatusEnum.RESOLVED_REJECTED]: {
|
|
105
|
+
actions: {
|
|
106
|
+
[bank_action_enum_1.BankActionEnum.UPDATE]: transitionResolvedRejectedStatusUpdateAction,
|
|
107
|
+
[bank_action_enum_1.BankActionEnum.DELETE]: transitionResolvedRejectedStatusDeleteAction,
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
};
|
|
@@ -107,8 +107,27 @@ export type ActionMap<A extends string, S extends string> = {
|
|
|
107
107
|
*
|
|
108
108
|
* @returns A function that accepts an `ActionMap` and returns `createActionConfig`.
|
|
109
109
|
*/
|
|
110
|
+
/**
|
|
111
|
+
* Optional per-transition extras. Both are spread onto the action config only when supplied, so a
|
|
112
|
+
* call site that does not pass them produces exactly the object it produced before this argument
|
|
113
|
+
* existed — the sixteen already-converted flow configs are byte-identical.
|
|
114
|
+
*
|
|
115
|
+
* @property isApplicable runtime guard evaluated against the same context as `next()`
|
|
116
|
+
* @property validActionPastThreshold whether the action survives a consumer's data-entry threshold
|
|
117
|
+
* @property description human-readable copy for this transition. Already part of
|
|
118
|
+
* `IFlowConfigActionConfig` and rendered by the entity-flow
|
|
119
|
+
* component, so a converted config must be able to emit it.
|
|
120
|
+
*/
|
|
121
|
+
export type ActionConfigOptions<CTX> = {
|
|
122
|
+
isApplicable?: (context: CTX) => boolean;
|
|
123
|
+
validActionPastThreshold?: boolean;
|
|
124
|
+
description?: string;
|
|
125
|
+
};
|
|
110
126
|
export declare function createFlowConfigFactory<CTX = never>(): <A extends string, S extends string, AM extends ActionMap<A, S>>(actionMap: AM) => {
|
|
111
|
-
createActionConfig: <Act extends A, Subset extends { [key in A]: AM[key]["reachableStatues"]; }[Act][number] = { [key in A]: AM[key]["reachableStatues"]; }[Act][number]>(action: Act, nextStatus: Subset | ((context: CTX) => Subset), overridePermissions?: string[]) => {
|
|
127
|
+
createActionConfig: <Act extends A, Subset extends { [key in A]: AM[key]["reachableStatues"]; }[Act][number] = { [key in A]: AM[key]["reachableStatues"]; }[Act][number]>(action: Act, nextStatus: Subset | ((context: CTX) => Subset), overridePermissions?: string[], options?: ActionConfigOptions<CTX>) => {
|
|
128
|
+
description?: string | undefined;
|
|
129
|
+
validActionPastThreshold?: boolean | undefined;
|
|
130
|
+
isApplicable?: ((context: CTX) => boolean) | undefined;
|
|
112
131
|
permissions: string[];
|
|
113
132
|
next: (context: CTX) => Subset;
|
|
114
133
|
};
|
|
@@ -75,18 +75,6 @@
|
|
|
75
75
|
*/
|
|
76
76
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
77
77
|
exports.createFlowConfigFactory = createFlowConfigFactory;
|
|
78
|
-
/**
|
|
79
|
-
* Curried factory — call with the context-data type first, then pass the
|
|
80
|
-
* action map. This two-step pattern lets TypeScript infer the precise action
|
|
81
|
-
* map type (preserving `as const` tuple narrowing) while still allowing the
|
|
82
|
-
* caller to set the context-data type explicitly.
|
|
83
|
-
*
|
|
84
|
-
* @template CTX - Shape of the context object passed to function-based
|
|
85
|
-
* transition resolvers. Use `never` for flows where `next()`
|
|
86
|
-
* needs no runtime data (equivalent to `() => status`).
|
|
87
|
-
*
|
|
88
|
-
* @returns A function that accepts an `ActionMap` and returns `createActionConfig`.
|
|
89
|
-
*/
|
|
90
78
|
function createFlowConfigFactory() {
|
|
91
79
|
return function (actionMap) {
|
|
92
80
|
const createTransition = (transition) => (context) => {
|
|
@@ -111,10 +99,7 @@ function createFlowConfigFactory() {
|
|
|
111
99
|
* (currentStatus, action) pair. Must be a subtype of
|
|
112
100
|
* `StatusForAction<Act>`.
|
|
113
101
|
*/
|
|
114
|
-
const createActionConfig = (action, nextStatus, overridePermissions) => ({
|
|
115
|
-
permissions: overridePermissions !== null && overridePermissions !== void 0 ? overridePermissions : actionMap[action].permissions,
|
|
116
|
-
next: createTransition(nextStatus),
|
|
117
|
-
});
|
|
102
|
+
const createActionConfig = (action, nextStatus, overridePermissions, options) => (Object.assign(Object.assign(Object.assign({ permissions: overridePermissions !== null && overridePermissions !== void 0 ? overridePermissions : actionMap[action].permissions, next: createTransition(nextStatus) }, ((options === null || options === void 0 ? void 0 : options.isApplicable) !== undefined ? { isApplicable: options.isApplicable } : {})), ((options === null || options === void 0 ? void 0 : options.validActionPastThreshold) !== undefined ? { validActionPastThreshold: options.validActionPastThreshold } : {})), ((options === null || options === void 0 ? void 0 : options.description) !== undefined ? { description: options.description } : {})));
|
|
118
103
|
return { createActionConfig, createTransition };
|
|
119
104
|
};
|
|
120
105
|
}
|
package/dist/src/entities/flow-configs/{billing.flow.config.d.ts → billing_flow.config.d.ts}
RENAMED
|
@@ -2,5 +2,5 @@ import { IBillingFlowContextData } from "../../api";
|
|
|
2
2
|
import { BillingActionsEnum } from "../enums/billing_action_enum";
|
|
3
3
|
import { BillingStatusEnum } from "../enums/billing_status_enum";
|
|
4
4
|
import { FlowConfig } from "./flow-config.type";
|
|
5
|
-
export declare
|
|
5
|
+
export declare const billingFlowConfig: FlowConfig<BillingStatusEnum, BillingActionsEnum, IBillingFlowContextData>;
|
|
6
6
|
export declare function getNextStatusTotalAmount(data: IBillingFlowContextData): BillingStatusEnum;
|