av6-core 2.0.3 → 2.0.4
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/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -692,6 +692,7 @@ interface StartFlowReq {
|
|
|
692
692
|
ccId: number;
|
|
693
693
|
refNo: string;
|
|
694
694
|
level?: number;
|
|
695
|
+
createdBy: number;
|
|
695
696
|
extra?: Record<string, string | number | boolean | null>;
|
|
696
697
|
}
|
|
697
698
|
interface NotificationEvent {
|
|
@@ -829,7 +830,7 @@ declare class ApprovalService {
|
|
|
829
830
|
private approvalRepo;
|
|
830
831
|
private prisma;
|
|
831
832
|
constructor(deps: ApprovalDeps);
|
|
832
|
-
startFlow(tx: PrismaClient | PrismaTransactionClient, { service, subjectType, subjectId, netTotal, ccId, refNo, level, extra }: StartFlowReq): Promise<void>;
|
|
833
|
+
startFlow(tx: PrismaClient | PrismaTransactionClient, { service, subjectType, subjectId, netTotal, ccId, refNo, level, extra, createdBy }: StartFlowReq): Promise<void>;
|
|
833
834
|
lastLevel(steps: ApprovalStep[]): Promise<number>;
|
|
834
835
|
/** Approver clicks “Approve” or “Reject”. */
|
|
835
836
|
act({ instanceId, approverId, action, ccId, comment }: ActInput): Promise<any>;
|
package/dist/index.d.ts
CHANGED
|
@@ -692,6 +692,7 @@ interface StartFlowReq {
|
|
|
692
692
|
ccId: number;
|
|
693
693
|
refNo: string;
|
|
694
694
|
level?: number;
|
|
695
|
+
createdBy: number;
|
|
695
696
|
extra?: Record<string, string | number | boolean | null>;
|
|
696
697
|
}
|
|
697
698
|
interface NotificationEvent {
|
|
@@ -829,7 +830,7 @@ declare class ApprovalService {
|
|
|
829
830
|
private approvalRepo;
|
|
830
831
|
private prisma;
|
|
831
832
|
constructor(deps: ApprovalDeps);
|
|
832
|
-
startFlow(tx: PrismaClient | PrismaTransactionClient, { service, subjectType, subjectId, netTotal, ccId, refNo, level, extra }: StartFlowReq): Promise<void>;
|
|
833
|
+
startFlow(tx: PrismaClient | PrismaTransactionClient, { service, subjectType, subjectId, netTotal, ccId, refNo, level, extra, createdBy }: StartFlowReq): Promise<void>;
|
|
833
834
|
lastLevel(steps: ApprovalStep[]): Promise<number>;
|
|
834
835
|
/** Approver clicks “Approve” or “Reject”. */
|
|
835
836
|
act({ instanceId, approverId, action, ccId, comment }: ActInput): Promise<any>;
|
package/dist/index.js
CHANGED
|
@@ -2680,9 +2680,9 @@ var ApprovalService = class {
|
|
|
2680
2680
|
deps;
|
|
2681
2681
|
approvalRepo;
|
|
2682
2682
|
prisma;
|
|
2683
|
-
async startFlow(tx, { service, subjectType, subjectId, netTotal, ccId, refNo, level = 1, extra }) {
|
|
2683
|
+
async startFlow(tx, { service, subjectType, subjectId, netTotal, ccId, refNo, level = 1, extra, createdBy }) {
|
|
2684
2684
|
const store = this.deps.requestStorage.getStore();
|
|
2685
|
-
const currentUser = store?.user?.id;
|
|
2685
|
+
const currentUser = createdBy ?? store?.user?.id;
|
|
2686
2686
|
const flow = await this.approvalRepo.findMatchingFlow(tx, subjectType, service, ccId, netTotal, level);
|
|
2687
2687
|
if (!flow) throw new Error("No approval flow configured");
|
|
2688
2688
|
await tx.approvalInstance.updateMany({
|
package/dist/index.mjs
CHANGED
|
@@ -2617,9 +2617,9 @@ var ApprovalService = class {
|
|
|
2617
2617
|
deps;
|
|
2618
2618
|
approvalRepo;
|
|
2619
2619
|
prisma;
|
|
2620
|
-
async startFlow(tx, { service, subjectType, subjectId, netTotal, ccId, refNo, level = 1, extra }) {
|
|
2620
|
+
async startFlow(tx, { service, subjectType, subjectId, netTotal, ccId, refNo, level = 1, extra, createdBy }) {
|
|
2621
2621
|
const store = this.deps.requestStorage.getStore();
|
|
2622
|
-
const currentUser = store?.user?.id;
|
|
2622
|
+
const currentUser = createdBy ?? store?.user?.id;
|
|
2623
2623
|
const flow = await this.approvalRepo.findMatchingFlow(tx, subjectType, service, ccId, netTotal, level);
|
|
2624
2624
|
if (!flow) throw new Error("No approval flow configured");
|
|
2625
2625
|
await tx.approvalInstance.updateMany({
|