@processfocus/runtime-local 0.1.0-next.0 → 0.1.0-next.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/README.md +3 -3
- package/dist/authentication-server.mjs +2 -2
- package/dist/{chunk-mvkr77wp.js → chunk-352j1ayk.js} +94 -36
- package/dist/{chunk-vpsm84e8.js → chunk-6ntmymmx.js} +1 -1
- package/dist/{chunk-9weqs8n8.js → chunk-yhzbn4vx.js} +1121 -1075
- package/dist/dashboard-source/apps/frontend/app/(protected)/act-on-behalf/delegations-client.tsx +5 -1
- package/dist/dashboard-source/apps/frontend/app/(protected)/executions/page.tsx +52 -10
- package/dist/dashboard-source/apps/frontend/app/(protected)/lists/[...listPath]/list-page-client.tsx +11 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/callback/route.ts +16 -0
- package/dist/dashboard-source/apps/frontend/app/api/auth/delegation/route.ts +9 -0
- package/dist/dashboard-source/apps/frontend/app/login/login-form-content.tsx +5 -0
- package/dist/dashboard-source/apps/frontend/app/login/secret-login-form.tsx +20 -5
- package/dist/dashboard-source/apps/frontend/lib/auth/session-admission-message.ts +2 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/session-admission.ts +29 -0
- package/dist/dashboard-source/apps/frontend/lib/auth/verify-passkey.ts +8 -0
- package/dist/dashboard-source/apps/frontend/lib/collections/execution.ts +7 -1
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/gql.ts +9 -9
- package/dist/dashboard-source/apps/frontend/lib/generated/gql/graphql.ts +6 -6
- package/dist/dashboard-source/apps/frontend/lib/graphql/list-queries.ts +4 -0
- package/dist/dashboard-source/apps/frontend/package.json +2 -2
- package/dist/dashboard-source/modules/aws-common/src/index.ts +1 -0
- package/dist/dashboard-source/modules/aws-common/src/lib/project-balance-admission.ts +68 -0
- package/dist/dashboard-source/modules/form/src/lib/walker.tsx +2 -7
- package/dist/dashboard-source/modules/frontend-plugin-host/src/lib/frontend-plugin-host.ts +6 -0
- package/dist/dashboard-source/modules/rxdb-collections/generated/execution-schema.json +16 -2
- package/dist/dashboard-source/modules/rxdb-collections/src/lib/rxdb-collections.ts +10 -1
- package/dist/dashboard-source.json +2 -2
- package/dist/graphql-server.mjs +3 -3
- package/dist/job-worker.mjs +2 -2
- package/dist/prepare-dashboard.mjs +2 -2
- package/dist/resources/graphql-schema/rxdb.graphql +5 -0
- package/dist/resources/graphql-schema/system.graphql +14 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -9,9 +9,9 @@ Use Bun 1.4.2 and Node.js 26 (verified on Linux with Node 26.3.1).
|
|
|
9
9
|
Install the fixed release group in your organisation project:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
bun add @processfocus/cli@0.1.0-next.
|
|
13
|
-
@processfocus/runtime-local@0.1.0-next.
|
|
14
|
-
processfocus@0.1.0-next.
|
|
12
|
+
bun add @processfocus/cli@0.1.0-next.2 \
|
|
13
|
+
@processfocus/runtime-local@0.1.0-next.2 \
|
|
14
|
+
processfocus@0.1.0-next.2
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
Define standard project scripts:
|
|
@@ -23,12 +23,12 @@ import {
|
|
|
23
23
|
LocalCedarConfigStatic,
|
|
24
24
|
LocalCedarConfigHotReload,
|
|
25
25
|
LocalCedarAuthorizationLive
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-yhzbn4vx.js";
|
|
27
27
|
import {
|
|
28
28
|
serveOnExactPort,
|
|
29
29
|
serveWithPortFallback,
|
|
30
30
|
writePortFile
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-6ntmymmx.js";
|
|
32
32
|
|
|
33
33
|
// src/authentication-server/authentication-server.ts
|
|
34
34
|
import { parseArgs as utilParseArgs } from "util";
|
|
@@ -84,6 +84,7 @@ import {
|
|
|
84
84
|
SystemStepExecutor,
|
|
85
85
|
withConcurrentTransaction,
|
|
86
86
|
getTransactionMode,
|
|
87
|
+
withReadSnapshot,
|
|
87
88
|
isSqlLockError,
|
|
88
89
|
sql,
|
|
89
90
|
eq,
|
|
@@ -171,7 +172,7 @@ import {
|
|
|
171
172
|
retryTransientSqliteError,
|
|
172
173
|
PolicyWatcherService,
|
|
173
174
|
LocalCedarConfig
|
|
174
|
-
} from "./chunk-
|
|
175
|
+
} from "./chunk-yhzbn4vx.js";
|
|
175
176
|
import {
|
|
176
177
|
__toESM,
|
|
177
178
|
__commonJS,
|
|
@@ -18819,17 +18820,22 @@ var stepCompletions = Metric.counter("pf.business.step.completions", {
|
|
|
18819
18820
|
description: "Successfully persisted step completions",
|
|
18820
18821
|
incremental: true
|
|
18821
18822
|
});
|
|
18823
|
+
var externalActions = Metric.counter("pf.business.external.actions", {
|
|
18824
|
+
description: "Successfully persisted external submissions and public Todo completions; not distinct people",
|
|
18825
|
+
incremental: true
|
|
18826
|
+
});
|
|
18822
18827
|
var tagCounter = (key, value) => (counter) => Metric.tagged(counter, key, value);
|
|
18823
|
-
var recordSuccessfulOutcome = (counter,
|
|
18828
|
+
var recordSuccessfulOutcome = (counter, outcomeLabel) => Effect2.serviceOption(BusinessMetricDimensions).pipe(Effect2.flatMap(Option.match({
|
|
18824
18829
|
onNone: () => Effect2.void,
|
|
18825
18830
|
onSome: (dimensions) => {
|
|
18826
18831
|
if (dimensions.accountScope !== "customer")
|
|
18827
18832
|
return Effect2.void;
|
|
18828
|
-
return Metric.increment(counter.pipe(tagCounter("pf_account_id", dimensions.accountId), tagCounter("pf_account_name", dimensions.accountName), tagCounter("pf_account_scope", dimensions.accountScope), tagCounter("pf_project", dimensions.project), tagCounter("pf_environment", dimensions.environment), tagCounter(
|
|
18833
|
+
return Metric.increment(counter.pipe(tagCounter("pf_account_id", dimensions.accountId), tagCounter("pf_account_name", dimensions.accountName), tagCounter("pf_account_scope", dimensions.accountScope), tagCounter("pf_project", dimensions.project), tagCounter("pf_environment", dimensions.environment), tagCounter(outcomeLabel[0], outcomeLabel[1])));
|
|
18829
18834
|
}
|
|
18830
18835
|
})));
|
|
18831
|
-
var recordSuccessfulProcessStart = (trigger) => recordSuccessfulOutcome(processStarts, trigger);
|
|
18832
|
-
var recordSuccessfulStepCompletion = (trigger) => recordSuccessfulOutcome(stepCompletions, trigger);
|
|
18836
|
+
var recordSuccessfulProcessStart = (trigger) => recordSuccessfulOutcome(processStarts, ["pf_trigger", trigger]);
|
|
18837
|
+
var recordSuccessfulStepCompletion = (trigger) => recordSuccessfulOutcome(stepCompletions, ["pf_trigger", trigger]);
|
|
18838
|
+
var recordSuccessfulExternalAction = (action) => recordSuccessfulOutcome(externalActions, ["pf_action", action]);
|
|
18833
18839
|
|
|
18834
18840
|
|
|
18835
18841
|
import { createHmac } from "crypto";
|
|
@@ -32456,6 +32462,8 @@ var assembleSteps = (execution, todos, org) => {
|
|
|
32456
32462
|
return "Completed";
|
|
32457
32463
|
case "Failed":
|
|
32458
32464
|
return "Failed";
|
|
32465
|
+
case "Not started":
|
|
32466
|
+
return execution.systemStartCompleted ? "Completed" : "Not started";
|
|
32459
32467
|
case "Abandoned":
|
|
32460
32468
|
return "Failed";
|
|
32461
32469
|
case "Running":
|
|
@@ -32485,6 +32493,7 @@ var assembleSteps = (execution, todos, org) => {
|
|
|
32485
32493
|
path: execution.startStepPath,
|
|
32486
32494
|
status: startStepStatus,
|
|
32487
32495
|
failureReason: startStepStatus === "Failed" ? execution.abandonedReason : null,
|
|
32496
|
+
notStartedReason: startStepStatus === "Not started" ? execution.notStartedReason ?? null : null,
|
|
32488
32497
|
roleId: execution.startStepRoleId,
|
|
32489
32498
|
roleName: execution.startStepRoleName,
|
|
32490
32499
|
roleOrgUnitPath: execution.startStepRoleOrgUnitPath,
|
|
@@ -32500,7 +32509,7 @@ var assembleSteps = (execution, todos, org) => {
|
|
|
32500
32509
|
startedAt: execution.processStateCreatedAt,
|
|
32501
32510
|
completedAt: isSystemStart ? startStepStatus === "Completed" || startStepStatus === "Failed" ? execution.finishedAt ?? execution.startedAt : null : execution.startedAt
|
|
32502
32511
|
});
|
|
32503
|
-
for (const todo of executionTodos.filter((t) => t.completed && t.failureReason == null)) {
|
|
32512
|
+
for (const todo of executionTodos.filter((t) => t.completed && t.failureReason == null && t.notStartedReason == null)) {
|
|
32504
32513
|
addTodoStep({
|
|
32505
32514
|
id: todo.todoId,
|
|
32506
32515
|
name: todo.stepName,
|
|
@@ -32523,14 +32532,15 @@ var assembleSteps = (execution, todos, org) => {
|
|
|
32523
32532
|
completedAt: epochMsToIsoOrNull(todo.updatedAt) ?? epochMsToIsoOrNull(todo.createdAt)
|
|
32524
32533
|
}, todo.todoId);
|
|
32525
32534
|
}
|
|
32526
|
-
const failedTodos = executionTodos.filter((t) => t.failureReason != null);
|
|
32535
|
+
const failedTodos = executionTodos.filter((t) => t.failureReason != null || t.notStartedReason != null);
|
|
32527
32536
|
for (const todo of failedTodos) {
|
|
32528
32537
|
addTodoStep({
|
|
32529
32538
|
id: todo.todoId,
|
|
32530
32539
|
name: todo.stepName,
|
|
32531
32540
|
path: todo.stepPath,
|
|
32532
|
-
status: "Failed",
|
|
32541
|
+
status: todo.notStartedReason != null ? "Not started" : "Failed",
|
|
32533
32542
|
failureReason: todo.failureReason,
|
|
32543
|
+
notStartedReason: todo.notStartedReason ?? null,
|
|
32534
32544
|
roleId: todo.roleId,
|
|
32535
32545
|
roleName: todo.roleName,
|
|
32536
32546
|
roleOrgUnitPath: todo.roleOrgUnitPath,
|
|
@@ -32571,7 +32581,7 @@ var assembleSteps = (execution, todos, org) => {
|
|
|
32571
32581
|
completedAt: null
|
|
32572
32582
|
}, todo.todoId);
|
|
32573
32583
|
}
|
|
32574
|
-
const waitingTodos = executionTodos.filter((t) => !t.completed && t.failureReason == null && t.correctionRequiredAt == null);
|
|
32584
|
+
const waitingTodos = executionTodos.filter((t) => !t.completed && t.failureReason == null && t.notStartedReason == null && t.correctionRequiredAt == null);
|
|
32575
32585
|
for (const todo of waitingTodos) {
|
|
32576
32586
|
addTodoStep({
|
|
32577
32587
|
id: todo.todoId,
|
|
@@ -32598,7 +32608,7 @@ var assembleSteps = (execution, todos, org) => {
|
|
|
32598
32608
|
const hasFailedSteps = failedTodos.length > 0;
|
|
32599
32609
|
const activeTodos = [...correctionRequiredTodos, ...waitingTodos];
|
|
32600
32610
|
let hasPotentialSteps = false;
|
|
32601
|
-
if (execution.status !== "Completed" && execution.status !== "Failed" && execution.status !== "Abandoned" && (!hasFailedSteps || activeTodos.length > 0)) {
|
|
32611
|
+
if (execution.status !== "Completed" && execution.status !== "Failed" && execution.status !== "Abandoned" && execution.status !== "Not started" && (!hasFailedSteps || activeTodos.length > 0)) {
|
|
32602
32612
|
let startPaths = [];
|
|
32603
32613
|
if (activeTodos.length > 0) {
|
|
32604
32614
|
startPaths = activeTodos.map((t) => t.stepPath);
|
|
@@ -32648,7 +32658,7 @@ var assembleSteps = (execution, todos, org) => {
|
|
|
32648
32658
|
}
|
|
32649
32659
|
}
|
|
32650
32660
|
}
|
|
32651
|
-
const correctedStatus = execution.status === "Abandoned" ? "Abandoned" : execution.status === "Completed" ? "Completed" : execution.status === "Failed" ? "Failed" : hasFailedSteps && activeTodos.length === 0 ? "Failed" : activeTodos.length === 0 && !hasPotentialSteps && execution.startStepRoleId != null ? "Completed" : "Running";
|
|
32661
|
+
const correctedStatus = execution.status === "Not started" ? "Not started" : execution.status === "Abandoned" ? "Abandoned" : execution.status === "Completed" ? "Completed" : execution.status === "Failed" ? "Failed" : hasFailedSteps && activeTodos.length === 0 ? "Failed" : activeTodos.length === 0 && !hasPotentialSteps && execution.startStepRoleId != null ? "Completed" : "Running";
|
|
32652
32662
|
return { steps, correctedStatus };
|
|
32653
32663
|
};
|
|
32654
32664
|
var mapToGraphql = (assembled) => {
|
|
@@ -32669,6 +32679,7 @@ var mapToGraphql = (assembled) => {
|
|
|
32669
32679
|
status: execution.status,
|
|
32670
32680
|
failureReason: firstFailedStep?.failureReason ?? (execution.status === "Failed" ? execution.abandonedReason : null),
|
|
32671
32681
|
abandonedReason: execution.status === "Abandoned" ? execution.abandonedReason : null,
|
|
32682
|
+
notStartedReason: execution.notStartedReason ?? null,
|
|
32672
32683
|
startedAt: execution.startedAt,
|
|
32673
32684
|
finishedAt: execution.finishedAt,
|
|
32674
32685
|
completedSteps: assembled.completedSteps,
|
|
@@ -32685,6 +32696,7 @@ var mapToGraphql = (assembled) => {
|
|
|
32685
32696
|
path: step.path,
|
|
32686
32697
|
status: step.status,
|
|
32687
32698
|
failureReason: step.failureReason,
|
|
32699
|
+
notStartedReason: step.notStartedReason ?? null,
|
|
32688
32700
|
role: step.completingRoleId ? {
|
|
32689
32701
|
id: step.completingRoleId,
|
|
32690
32702
|
name: step.completingRoleName ?? ""
|
|
@@ -45650,6 +45662,8 @@ var startProcessExecution = (processId, processPath, startStepPath, state, optio
|
|
|
45650
45662
|
const startInTransaction = sqlClient.withTransaction(Effect20.gen(function* () {
|
|
45651
45663
|
const { processStateId, stepId } = yield* processExecutionOps.insertProcessState(processId, startStepPath, state, startedByExternalParticipantId, completedByRoleId);
|
|
45652
45664
|
const executionId = yield* processExecutionOps.insertProcessExecution(processStateId, callerExecutionId, options.withoutWaiting ?? false);
|
|
45665
|
+
if (options.onSubmit)
|
|
45666
|
+
yield* options.onSubmit;
|
|
45653
45667
|
const scheduledFlowId = enqueueStartSystemStep ? undefined : yield* scheduledFlowOps.insertScheduledFlow(executionId, stepId, {
|
|
45654
45668
|
...completedByRoleId !== undefined ? { completedByRoleId } : {}
|
|
45655
45669
|
});
|
|
@@ -45687,6 +45701,9 @@ var startProcessExecution = (processId, processPath, startStepPath, state, optio
|
|
|
45687
45701
|
};
|
|
45688
45702
|
})));
|
|
45689
45703
|
if (!startResult.deduplicated) {
|
|
45704
|
+
if (options.externalParticipantEmail !== undefined) {
|
|
45705
|
+
yield* recordSuccessfulExternalAction("submission");
|
|
45706
|
+
}
|
|
45690
45707
|
yield* recordSuccessfulProcessStart(trigger);
|
|
45691
45708
|
if (!enqueueStartSystemStep) {
|
|
45692
45709
|
yield* recordSuccessfulStepCompletion(trigger);
|
|
@@ -45714,6 +45731,13 @@ var startProcessExecution = (processId, processPath, startStepPath, state, optio
|
|
|
45714
45731
|
timestamp: DateTime6.formatIso(requestTime)
|
|
45715
45732
|
};
|
|
45716
45733
|
});
|
|
45734
|
+
var executeFormSubmission = (step, input) => {
|
|
45735
|
+
if (typeof step.executeSubmit !== "function")
|
|
45736
|
+
return Effect20.void;
|
|
45737
|
+
return step.executeSubmit(input).pipe(Effect20.mapError((error) => new InputValidationError({
|
|
45738
|
+
errors: [{ field: error.field, message: error.message }]
|
|
45739
|
+
})));
|
|
45740
|
+
};
|
|
45717
45741
|
var startProcess = (processId, processPath, startStepPath, input, inputSchema, step, context, options) => Effect20.gen(function* () {
|
|
45718
45742
|
yield* checkRestrictedFieldSubmissions(context, startStepPath, input, step);
|
|
45719
45743
|
const currentProviderUser = currentProviderUserDefault(context);
|
|
@@ -45756,6 +45780,7 @@ var startProcess = (processId, processPath, startStepPath, input, inputSchema, s
|
|
|
45756
45780
|
}
|
|
45757
45781
|
return yield* startProcessExecution(processId, processPath, startStepPath, validatedInput, {
|
|
45758
45782
|
...options,
|
|
45783
|
+
onSubmit: executeFormSubmission(step, validatedInput),
|
|
45759
45784
|
trigger: processStartTriggerForSession(context.jwt?.properties),
|
|
45760
45785
|
...normalizedExternalParticipantEmail ? { externalParticipantEmail: normalizedExternalParticipantEmail } : {}
|
|
45761
45786
|
});
|
|
@@ -45965,6 +45990,7 @@ var completeStep = (todoId, input, step, inputSchema, context, options = {}) =>
|
|
|
45965
45990
|
}
|
|
45966
45991
|
}
|
|
45967
45992
|
}
|
|
45993
|
+
yield* executeFormSubmission(step, validatedInput);
|
|
45968
45994
|
const scheduledFlowId = todoInfo.barrierScheduledFlowId ? todoInfo.barrierScheduledFlowId : yield* scheduledFlowOps.insertOrGetScheduledFlow(todoId, todoInfo.processExecutionId, todoInfo.targetStepId, {
|
|
45969
45995
|
...completedByRoleId !== undefined ? { completedByRoleId } : {}
|
|
45970
45996
|
});
|
|
@@ -45995,6 +46021,9 @@ var completeStep = (todoId, input, step, inputSchema, context, options = {}) =>
|
|
|
45995
46021
|
while: isRetryableStepCompletionError
|
|
45996
46022
|
}), Effect20.catchAll((error) => Effect20.fail(isRetryableStepCompletionError(error) ? new StepCompletionConflictError({ todoId }) : error)));
|
|
45997
46023
|
if (result.kind === "completed") {
|
|
46024
|
+
if (options.source === "public" || options.externalParticipantEmail !== undefined) {
|
|
46025
|
+
yield* recordSuccessfulExternalAction("todo_completion");
|
|
46026
|
+
}
|
|
45998
46027
|
yield* recordSuccessfulStepCompletion(options.externalParticipantEmail ? "human" : processStartTriggerForSession(context.jwt?.properties));
|
|
45999
46028
|
}
|
|
46000
46029
|
if (!queueService.queueInTransaction) {
|
|
@@ -47375,7 +47404,7 @@ var requestDatabaseUploadUrl = (args, context) => Effect28.gen(function* () {
|
|
|
47375
47404
|
|
|
47376
47405
|
|
|
47377
47406
|
import { Effect as Effect29 } from "effect";
|
|
47378
|
-
var isExecutionListStatus = (status) => status === "Running" || status === "Completed" || status === "Failed" || status === "Abandoned";
|
|
47407
|
+
var isExecutionListStatus = (status) => status === "Running" || status === "Completed" || status === "Failed" || status === "Not started" || status === "Abandoned";
|
|
47379
47408
|
var parseExecutionListStatus = (status) => Effect29.gen(function* () {
|
|
47380
47409
|
if (status == null)
|
|
47381
47410
|
return;
|
|
@@ -47384,7 +47413,7 @@ var parseExecutionListStatus = (status) => Effect29.gen(function* () {
|
|
|
47384
47413
|
errors: [
|
|
47385
47414
|
{
|
|
47386
47415
|
field: "status",
|
|
47387
|
-
message: 'Status must be "Running", "Completed", "Failed", or "Abandoned".'
|
|
47416
|
+
message: 'Status must be "Running", "Completed", "Failed", "Not started", or "Abandoned".'
|
|
47388
47417
|
}
|
|
47389
47418
|
]
|
|
47390
47419
|
});
|
|
@@ -48152,7 +48181,10 @@ var systemSchema = Effect32.gen(function* () {
|
|
|
48152
48181
|
const item = todoInfo?.itemData ?? undefined;
|
|
48153
48182
|
completionMessage = yield* resolveFunctionPublicCompletionThankYou(publicCompletion.thankYou, processStateData.state, ctx, item);
|
|
48154
48183
|
}
|
|
48155
|
-
yield* completeStep(payload.tid, input, form, form.submissionEffectSchema, context,
|
|
48184
|
+
yield* completeStep(payload.tid, input, form, form.submissionEffectSchema, context, {
|
|
48185
|
+
source: "public",
|
|
48186
|
+
...payload.externalParticipantEmail ? { externalParticipantEmail: payload.externalParticipantEmail } : {}
|
|
48187
|
+
});
|
|
48156
48188
|
return {
|
|
48157
48189
|
todoId: payload.tid,
|
|
48158
48190
|
status: "COMPLETED",
|
|
@@ -48643,6 +48675,16 @@ var systemSchema = Effect32.gen(function* () {
|
|
|
48643
48675
|
}))
|
|
48644
48676
|
};
|
|
48645
48677
|
}),
|
|
48678
|
+
execution: (_parent, args, context) => Effect32.gen(function* () {
|
|
48679
|
+
const executionOps = yield* ExecutionCollectionOps;
|
|
48680
|
+
const [row] = yield* executionOps.getByIds([args.id]);
|
|
48681
|
+
if (!row)
|
|
48682
|
+
return null;
|
|
48683
|
+
const principal = yield* buildStepPrincipal(context);
|
|
48684
|
+
const document2 = yield* executionOps.mapToGraphql(row);
|
|
48685
|
+
const [authorized] = yield* filterAuthorizedExecutions([document2], principal);
|
|
48686
|
+
return authorized ?? null;
|
|
48687
|
+
}),
|
|
48646
48688
|
executions: (_parent, args, context) => Effect32.gen(function* () {
|
|
48647
48689
|
const executionOps = yield* ExecutionCollectionOps;
|
|
48648
48690
|
const principal = yield* buildStepPrincipal(context);
|
|
@@ -48905,7 +48947,11 @@ var systemSchema = Effect32.gen(function* () {
|
|
|
48905
48947
|
}
|
|
48906
48948
|
return yield* Effect32.forEach(accessibleLists, (list) => Effect32.gen(function* () {
|
|
48907
48949
|
const canCreate = list.hasCreate && (yield* auth.canCreateList(principal, new ListRef(normalizePath(list.node.path), rolePathsForList(list.roles))).pipe(Effect32.orElseSucceed(() => false)));
|
|
48950
|
+
const startProcesses = list.startProcess ? yield* filterAuthorizedProcessRows(context, [
|
|
48951
|
+
list.startProcess
|
|
48952
|
+
]) : [];
|
|
48908
48953
|
return {
|
|
48954
|
+
startProcess: startProcesses[0] ?? null,
|
|
48909
48955
|
canCreate,
|
|
48910
48956
|
id: normalizePath(list.node.path),
|
|
48911
48957
|
path: normalizePath(list.node.path),
|
|
@@ -52680,8 +52726,8 @@ var drainSystemStepFlowDispatch = (params) => Effect43.gen(function* () {
|
|
|
52680
52726
|
})));
|
|
52681
52727
|
|
|
52682
52728
|
|
|
52683
|
-
var calculateStepBusinessDuration2 = (calendarQueries, createdAtMs, completedAtMs, orgUnitId) => Effect44.gen(function* () {
|
|
52684
|
-
const calendarDataMap = yield* calendarQueries.getCalendarData([orgUnitId]);
|
|
52729
|
+
var calculateStepBusinessDuration2 = (sqlClient, calendarQueries, createdAtMs, completedAtMs, orgUnitId) => Effect44.gen(function* () {
|
|
52730
|
+
const calendarDataMap = yield* withReadSnapshot(sqlClient, calendarQueries.getCalendarData([orgUnitId]));
|
|
52685
52731
|
const calendarData = calendarDataMap.get(orgUnitId);
|
|
52686
52732
|
if (calendarData && hasCalendarConfigured(calendarData)) {
|
|
52687
52733
|
const config = yield* buildCalendarConfig(calendarData);
|
|
@@ -52731,7 +52777,7 @@ var completeSystemStep = (params) => Effect44.gen(function* () {
|
|
|
52731
52777
|
}
|
|
52732
52778
|
const requestTime = yield* getRequestTime();
|
|
52733
52779
|
const completedAtMs = DateTime11.toEpochMillis(requestTime);
|
|
52734
|
-
const businessDurationMs = yield* calculateStepBusinessDuration2(calendarQueries, todoInfo.createdAtMs, completedAtMs, todoInfo.orgUnitId);
|
|
52780
|
+
const businessDurationMs = yield* calculateStepBusinessDuration2(sqlClient, calendarQueries, todoInfo.createdAtMs, completedAtMs, todoInfo.orgUnitId);
|
|
52735
52781
|
const stateUpdate = isForEach ? null : output;
|
|
52736
52782
|
const forEachStepKey = isForEach ? getForEachStepKey(stepPath) : null;
|
|
52737
52783
|
const scheduledFlowId = yield* sqlClient.withTransaction(Effect44.gen(function* () {
|
|
@@ -52802,7 +52848,7 @@ var completeAsyncSystemStep = (params) => Effect44.gen(function* () {
|
|
|
52802
52848
|
}
|
|
52803
52849
|
const requestTime = yield* getRequestTime();
|
|
52804
52850
|
const completedAtMs = DateTime11.toEpochMillis(requestTime);
|
|
52805
|
-
const businessDurationMs = yield* calculateStepBusinessDuration2(calendarQueries, todoInfo.createdAtMs, completedAtMs, todoInfo.orgUnitId);
|
|
52851
|
+
const businessDurationMs = yield* calculateStepBusinessDuration2(sqlClient, calendarQueries, todoInfo.createdAtMs, completedAtMs, todoInfo.orgUnitId);
|
|
52806
52852
|
const stateUpdate = isForEach ? null : output;
|
|
52807
52853
|
const forEachStepKey = isForEach ? getForEachStepKey(stepPath) : null;
|
|
52808
52854
|
const scheduledFlowId = yield* sqlClient.withTransaction(Effect44.gen(function* () {
|
|
@@ -53255,12 +53301,25 @@ var handleTodoSystemStepExecution = (job) => Effect46.gen(function* () {
|
|
|
53255
53301
|
todoId,
|
|
53256
53302
|
stepPath
|
|
53257
53303
|
});
|
|
53258
|
-
const
|
|
53259
|
-
|
|
53304
|
+
const inputs = yield* withReadSnapshot(sqlClient, Effect46.gen(function* () {
|
|
53305
|
+
const todoInfo = yield* stepCompletionOps.queryTodoById(todoId);
|
|
53306
|
+
if (!todoInfo)
|
|
53307
|
+
return null;
|
|
53308
|
+
const processState = yield* stepCompletionOps.getProcessStateByTodoId(todoId);
|
|
53309
|
+
if (!processState) {
|
|
53310
|
+
return yield* new ProcessStateNotFoundError({
|
|
53311
|
+
processExecutionId: todoInfo.processExecutionId
|
|
53312
|
+
});
|
|
53313
|
+
}
|
|
53314
|
+
const completedSteps = yield* stepCompletionOps.getCompletedStepsForExecution(todoInfo.processExecutionId);
|
|
53315
|
+
return { todoInfo, processState, completedSteps };
|
|
53316
|
+
}));
|
|
53317
|
+
if (!inputs) {
|
|
53260
53318
|
yield* Effect46.logWarning("Todo not found - flow-execution may have rolled back", { todoId });
|
|
53261
53319
|
yield* completedJobOps.markJobCompleted(SYSTEM_STEP_EXECUTION_QUEUE, job.jobId);
|
|
53262
53320
|
return;
|
|
53263
53321
|
}
|
|
53322
|
+
const { todoInfo, processState, completedSteps } = inputs;
|
|
53264
53323
|
const initiatingAudit = todoInfo.createdBy;
|
|
53265
53324
|
if (initiatingAudit !== undefined) {
|
|
53266
53325
|
const actor = decodeDelegationAudit(initiatingAudit);
|
|
@@ -53269,13 +53328,6 @@ var handleTodoSystemStepExecution = (job) => Effect46.gen(function* () {
|
|
|
53269
53328
|
yield* FiberRef2.set(userDetails, { by: initiatingAudit, id: null });
|
|
53270
53329
|
}
|
|
53271
53330
|
}
|
|
53272
|
-
const processState = yield* stepCompletionOps.getProcessStateByTodoId(todoId);
|
|
53273
|
-
if (!processState) {
|
|
53274
|
-
return yield* new ProcessStateNotFoundError({
|
|
53275
|
-
processExecutionId: todoInfo.processExecutionId
|
|
53276
|
-
});
|
|
53277
|
-
}
|
|
53278
|
-
const completedSteps = yield* stepCompletionOps.getCompletedStepsForExecution(todoInfo.processExecutionId);
|
|
53279
53331
|
const ctx = buildFlowContext(todoInfo.processExecutionId, processState.processStartedAt, completedSteps);
|
|
53280
53332
|
const isForEach = todoInfo.hasForEach;
|
|
53281
53333
|
yield* Effect46.log("Executing system step", {
|
|
@@ -53490,10 +53542,21 @@ var handleStartedSystemStepExecution = (job) => Effect46.gen(function* () {
|
|
|
53490
53542
|
stepId,
|
|
53491
53543
|
stepPath
|
|
53492
53544
|
});
|
|
53493
|
-
const
|
|
53494
|
-
|
|
53495
|
-
|
|
53496
|
-
|
|
53545
|
+
const sqlClient = yield* SqlClient;
|
|
53546
|
+
const { processStateRaw, executionDetails, completedSteps } = yield* withReadSnapshot(sqlClient, Effect46.gen(function* () {
|
|
53547
|
+
const processStateRaw = yield* flowExecutionOps.getProcessStateByExecutionId(processExecutionId);
|
|
53548
|
+
if (!processStateRaw) {
|
|
53549
|
+
return yield* new ProcessStateNotFoundError({ processExecutionId });
|
|
53550
|
+
}
|
|
53551
|
+
const executionDetails = yield* flowExecutionOps.getExecutionDetailsForCompletion(processExecutionId);
|
|
53552
|
+
if (!executionDetails) {
|
|
53553
|
+
return yield* new ProcessExecutionNotFoundError({
|
|
53554
|
+
processExecutionId
|
|
53555
|
+
});
|
|
53556
|
+
}
|
|
53557
|
+
const completedSteps = yield* stepCompletionOps.getCompletedStepsForExecution(processExecutionId);
|
|
53558
|
+
return { processStateRaw, executionDetails, completedSteps };
|
|
53559
|
+
}));
|
|
53497
53560
|
const initiatingAudit = processStateRaw.createdBy;
|
|
53498
53561
|
if (initiatingAudit !== undefined && Option18.isSome(decodeDelegationAudit(initiatingAudit))) {
|
|
53499
53562
|
const userDetails = yield* UserDetails;
|
|
@@ -53503,11 +53566,6 @@ var handleStartedSystemStepExecution = (job) => Effect46.gen(function* () {
|
|
|
53503
53566
|
processExecutionId,
|
|
53504
53567
|
reason: "State is not a valid record"
|
|
53505
53568
|
})));
|
|
53506
|
-
const executionDetails = yield* flowExecutionOps.getExecutionDetailsForCompletion(processExecutionId);
|
|
53507
|
-
if (!executionDetails) {
|
|
53508
|
-
return yield* new ProcessExecutionNotFoundError({ processExecutionId });
|
|
53509
|
-
}
|
|
53510
|
-
const completedSteps = yield* stepCompletionOps.getCompletedStepsForExecution(processExecutionId);
|
|
53511
53569
|
const ctx = buildFlowContext(processExecutionId, DateTime12.unsafeMake(executionDetails.createdAtMs), completedSteps);
|
|
53512
53570
|
const exit = yield* Effect46.exit(withConfiguredSystemStepTimeout(stepPath, systemStepExecutor.execute(stepPath, processState, ctx, completedJobId, undefined, completedSteps.map((step) => step.stepPath))));
|
|
53513
53571
|
if (Exit.isFailure(exit)) {
|