law-common 14.0.3-beta.3 → 14.0.3-beta.5

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.
@@ -1,4 +1,4 @@
1
- import { IReimbursementEntity, IReimbursementExpenseEntity, IUserEntity, ParentChildFlowConfig, ReimbursementActionEnum, ReimbursementExpenseActionEnum, ReimbursementExpenseState, ReimbursementStatusEnum } from "../../entities";
1
+ import { IReimbursementEntity, IReimbursementExpenseEntity, IUserEntity } from "../../entities";
2
2
  import { IProjectEntityGet } from "./project.entity.response";
3
3
  export type IReimbursementEntityGet = {
4
4
  reimbursements: IReimbursementResponse[];
@@ -7,14 +7,6 @@ export type IReimbursementEntityGet = {
7
7
  };
8
8
  projects: IProjectEntityGet;
9
9
  };
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>;
18
10
  export type IReimbursementFlowContextData = {
19
11
  expenseDetails: IReimbursementExpenseEntity[];
20
12
  };
@@ -9,10 +9,3 @@ export interface ITimesheetUpdateDto extends IEntityUpdateDto<ITimesheetEntity>
9
9
  }
10
10
  export interface ITimesheetUpdateDtoValidationData extends ITimesheetCreateDtoValidationData {
11
11
  }
12
- /**
13
- * Fields on a timesheet that, when changed via an UPDATE, reset the timesheet's
14
- * `classificationStatus` back to `PENDING`. Shared by backend (toUpdateDto) and frontend
15
- * (edit warning). `billingId` intentionally NOT included — a billing change does not reset
16
- * classification. Anything not listed here is by definition "non-reset".
17
- */
18
- export declare const TIMESHEET_CLASSIFICATION_RESET_FIELDS: (keyof ITimesheetEntity)[];
@@ -1,10 +1,2 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TIMESHEET_CLASSIFICATION_RESET_FIELDS = void 0;
4
- /**
5
- * Fields on a timesheet that, when changed via an UPDATE, reset the timesheet's
6
- * `classificationStatus` back to `PENDING`. Shared by backend (toUpdateDto) and frontend
7
- * (edit warning). `billingId` intentionally NOT included — a billing change does not reset
8
- * classification. Anything not listed here is by definition "non-reset".
9
- */
10
- exports.TIMESHEET_CLASSIFICATION_RESET_FIELDS = ["userId", "projectId", "task", "description", "dateCode", "totalDuration"];
@@ -70,17 +70,3 @@ export interface IFlowConfigActionConfig<STATUS_ENUM_TYPE extends string, CONTEX
70
70
  */
71
71
  isApplicable?: (data: CONTEXT_DATA_TYPE) => boolean;
72
72
  }
73
- /**
74
- * A flow whose parent and child rows each have their own status/action vocabulary.
75
- *
76
- * @template T context data passed to the parent's `next()`
77
- * @template CT context data passed to the child's `next()`. Defaults to `T` for flows where both
78
- * levels resolve from the same context. Reimbursement is the case that needs them to
79
- * differ: its parent derives the reimbursement status from the child rows, while its
80
- * child transitions are all fixed and its `next()` is called with no argument at all —
81
- * so the child is instantiated with `void`.
82
- */
83
- export type ParentChildFlowConfig<S extends string, A extends string, CS extends string = never, CA extends string = never, T extends Record<any, any> = never, CT = T> = {
84
- parent: FlowConfig<S, A, T>;
85
- child: FlowConfig<CS, CA, CT>;
86
- };
@@ -8,8 +8,8 @@ const base_flow_config_factory_1 = require("./base-flow-config.factory");
8
8
  * Reimbursement Expense — the child level of the reimbursement flow.
9
9
  *
10
10
  * Split out of `reimbursement_flow.config.ts` so each level can be read on its own: this file owns the
11
- * expense-row state machine, and the parent file owns the reimbursement status derivation plus the
12
- * composed `reimbursementConfigFlow` the services consume.
11
+ * expense-row state machine, and the parent file owns the reimbursement status derivation. The two are
12
+ * standalone `FlowConfig`s; each consumer imports the level it uses directly.
13
13
  *
14
14
  * Every transition here is a fixed target, and `ReimbursementExpenseService.getReimbursementNextStatusForChild`
15
15
  * calls `next()` with no argument, so the factory is instantiated with `void` — a `void` parameter may be
@@ -1,17 +1,9 @@
1
1
  import { IReimbursementFlowContextData } from "../../api";
2
2
  import { ReimbursementActionEnum } from "../enums/reimbursement_action_enum";
3
- import { ReimbursementExpenseActionEnum } from "../enums/reimbursement_expense_action_enum";
4
- import { ReimbursementExpenseState } from "../enums/reimbursement_expense_state_enum";
5
3
  import { ReimbursementStatusEnum } from "../enums/reimbursement_status_enum";
6
- import { FlowConfig, ParentChildFlowConfig } from "./flow-config.type";
4
+ import { FlowConfig } from "./flow-config.type";
7
5
  /**
8
6
  * REJECTED, DELETED and PAYMENT_DISBURSE are reachable targets but have no block of their own — a
9
7
  * reimbursement that lands in any of them is final at the parent level.
10
8
  */
11
9
  export declare const reimbursementFlowConfig: FlowConfig<ReimbursementStatusEnum, ReimbursementActionEnum, IReimbursementFlowContextData>;
12
- /**
13
- * The two levels composed into the shape the services consume — `ReimbursementService` reads
14
- * `.parent` and `ReimbursementExpenseService` reads `.child`. Kept so splitting the files is invisible
15
- * to every consumer; each level can now also be imported on its own.
16
- */
17
- export declare const reimbursementConfigFlow: ParentChildFlowConfig<ReimbursementStatusEnum, ReimbursementActionEnum, ReimbursementExpenseState, ReimbursementExpenseActionEnum, IReimbursementFlowContextData, void>;
@@ -1,16 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.reimbursementConfigFlow = exports.reimbursementFlowConfig = void 0;
3
+ exports.reimbursementFlowConfig = void 0;
4
4
  const reimbursement_action_enum_1 = require("../enums/reimbursement_action_enum");
5
5
  const reimbursement_expense_state_enum_1 = require("../enums/reimbursement_expense_state_enum");
6
6
  const reimbursement_status_enum_1 = require("../enums/reimbursement_status_enum");
7
7
  const base_flow_config_factory_1 = require("./base-flow-config.factory");
8
- const reimbursement_expense_flow_config_1 = require("./reimbursement_expense_flow.config");
9
8
  /**
10
9
  * Reimbursement — the parent level of the reimbursement flow.
11
10
  *
12
- * The child level lives in `reimbursement_expense_flow.config.ts`; the two are composed at the bottom
13
- * of this file into `reimbursementConfigFlow`, which is what the services consume.
11
+ * The child level lives in `reimbursement_expense_flow.config.ts`; the two are standalone
12
+ * `FlowConfig`s and each consumer imports the level it uses directly.
14
13
  *
15
14
  * The parent takes `IReimbursementFlowContextData` because its UPDATE derives the reimbursement status
16
15
  * from the states of its expense rows — the helpers at the bottom of this file. The child takes `void`,
@@ -101,15 +100,6 @@ exports.reimbursementFlowConfig = {
101
100
  },
102
101
  },
103
102
  };
104
- /**
105
- * The two levels composed into the shape the services consume — `ReimbursementService` reads
106
- * `.parent` and `ReimbursementExpenseService` reads `.child`. Kept so splitting the files is invisible
107
- * to every consumer; each level can now also be imported on its own.
108
- */
109
- exports.reimbursementConfigFlow = {
110
- parent: exports.reimbursementFlowConfig,
111
- child: reimbursement_expense_flow_config_1.reimbursementExpenseFlowConfig,
112
- };
113
103
  function areAllRowApproved(data) {
114
104
  const { expenseDetails } = data;
115
105
  return expenseDetails.length > 0 ? expenseDetails.every((row) => row.state === reimbursement_expense_state_enum_1.ReimbursementExpenseState.APPROVED) : false;
@@ -1,7 +1,6 @@
1
1
  import { TimesheetClassificationStatusEnum } from "../enums/timesheet_classification_status_enum";
2
2
  import { TimesheetStatusEnum } from "../enums/timesheet_status_enum";
3
3
  import { IEntityAuditColumn } from "./entity-audit-columns.interface";
4
- import { Nullable } from "./entity.utils.interface";
5
4
  export interface ITimesheetEntity extends IEntityAuditColumn {
6
5
  id: number;
7
6
  userId: number;
@@ -16,6 +15,6 @@ export interface ITimesheetEntity extends IEntityAuditColumn {
16
15
  billedDuration?: number;
17
16
  notBilledDuration?: number;
18
17
  classificationStatus: TimesheetClassificationStatusEnum;
19
- classifiedBy?: Nullable<number>;
18
+ classifiedBy?: number;
20
19
  }
21
20
  export type PendingApprovalStatus = TimesheetStatusEnum.CREATE_APPROVAL_PENDING | TimesheetStatusEnum.UPDATE_APPROVAL_PENDING | TimesheetStatusEnum.DELETE_APPROVAL_PENDING | TimesheetStatusEnum.RESOLVED_REJECTED;
@@ -84,10 +84,8 @@ class TimesheetEntityModel extends base_entity_model_1.BaseEntityModel {
84
84
  return false;
85
85
  if (actionKey === timesheet_action_enum_1.TimesheetActionEnum.CLASSIFY)
86
86
  return false;
87
- // LW-842: allow UPDATE regardless of classification status — the backend now resets
88
- // classificationStatus to PENDING in toUpdateDto when a reset-field changes.
89
- // if (actionKey === TimesheetActionEnum.UPDATE && this.classificationStatus && this.classificationStatus !== TimesheetClassificationStatusEnum.PENDING)
90
- // return false;
87
+ if (actionKey === timesheet_action_enum_1.TimesheetActionEnum.UPDATE && this.classificationStatus && this.classificationStatus !== timesheet_classification_status_enum_1.TimesheetClassificationStatusEnum.PENDING)
88
+ return false;
91
89
  return true;
92
90
  })
93
91
  .map(([actionKey, actionConfig]) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "law-common",
3
- "version": "14.0.3-beta.3",
3
+ "version": "14.0.3-beta.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "files": [