@pisell/private-materials 6.12.167 → 6.12.169
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +10 -10
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +10 -10
- package/es/components/HDLKiosk/{contracts → app/contracts}/config.js +1 -1
- package/es/components/HDLKiosk/app/manifest.js +11 -11
- package/es/components/HDLKiosk/app/operations.js +92 -0
- package/es/components/HDLKiosk/app/workflow/barcode.js +11 -13
- package/es/components/HDLKiosk/app/workflow/index.js +16 -0
- package/es/components/HDLKiosk/app/workflow/predicates.js +1 -1
- package/es/components/HDLKiosk/app/workflow/quick.js +1 -1
- package/es/components/HDLKiosk/app/workflow/registry.js +4 -4
- package/es/components/HDLKiosk/app/workflow/scale.js +5 -1
- package/es/components/HDLKiosk/docs/00-/346/226/207/344/273/266/345/257/274/350/210/252.md +104 -167
- package/es/components/HDLKiosk/docs/01-/346/240/270/345/277/203/350/277/220/350/241/214/346/234/272/345/210/266.md +105 -101
- package/es/components/HDLKiosk/docs/03-/344/270/232/345/212/241/346/265/201/347/250/213/344/270/216/344/272/244/344/272/222/350/247/204/345/210/231.md +2 -2
- package/es/components/HDLKiosk/docs/04-/350/256/276/345/244/207/344/270/216/347/247/260/351/207/215.md +43 -26
- package/es/components/HDLKiosk/docs/05-/344/272/244/346/230/223/345/256/211/345/205/250.md +2 -0
- package/es/components/HDLKiosk/docs/07-/345/220/216/347/273/255/345/267/245/344/275/234.md +1 -1
- package/es/components/HDLKiosk/docs/08-/346/227/240/345/244/264Application/350/277/220/350/241/214/346/227/266/351/207/215/346/236/204/350/256/276/350/256/241.md +719 -0
- package/es/components/HDLKiosk/docs/09-Entry/350/256/276/345/244/207/344/272/213/344/273/266/351/207/215/346/236/204/344/277/256/345/244/215/346/212/245/345/221/212.md +187 -0
- package/es/components/HDLKiosk/docs/README.md +6 -2
- package/es/components/HDLKiosk/docs//345/256/236/346/226/275/350/277/233/345/272/246.md +8 -7
- package/es/components/HDLKiosk/docs//346/236/266/346/236/204/350/256/276/350/256/241.md +16 -18
- package/es/components/HDLKiosk/index.js +22 -28
- package/es/components/HDLKiosk/index.less +1 -1
- package/es/components/HDLKiosk/kernel/README.md +14 -13
- package/es/components/HDLKiosk/kernel/application/defineApplication.js +63 -24
- package/es/components/HDLKiosk/kernel/application/defineSlice.js +6 -6
- package/es/components/HDLKiosk/kernel/application/runtime.js +237 -0
- package/es/components/HDLKiosk/kernel/operations/coordinator.js +1 -1
- package/es/components/HDLKiosk/kernel/operations/registry.js +3 -3
- package/es/components/HDLKiosk/kernel/operations/sessionEpoch.js +1 -1
- package/es/components/HDLKiosk/kernel/operations/types.js +7 -3
- package/es/components/HDLKiosk/kernel/workflow/actor.js +51 -22
- package/es/components/HDLKiosk/kernel/workflow/compiler.js +23 -30
- package/es/components/HDLKiosk/runtime/createRuntime.js +238 -0
- package/es/components/HDLKiosk/{devices → runtime/devices}/dedupeStore.js +1 -1
- package/es/components/HDLKiosk/{devices → runtime/devices}/scaleIngress.js +1 -1
- package/es/components/HDLKiosk/{devices/scale/runtime.js → runtime/devices/scaleStore.js} +18 -24
- package/es/components/HDLKiosk/{devices → runtime/devices}/scannerIngress.js +1 -1
- package/es/components/HDLKiosk/runtime/devices/scannerSessionPort.js +60 -0
- package/es/components/HDLKiosk/runtime/devices/scannerSessionRouter.js +212 -0
- package/es/components/HDLKiosk/runtime/operations/barcode.js +18 -0
- package/es/components/HDLKiosk/runtime/operations/cart.js +44 -0
- package/es/components/HDLKiosk/{app → runtime}/operations/cartConsistency.js +1 -1
- package/es/components/HDLKiosk/{app → runtime}/operations/checkout.js +95 -110
- package/es/components/HDLKiosk/{app → runtime}/operations/checkoutRequirements.js +1 -1
- package/es/components/HDLKiosk/{app → runtime}/operations/checkoutSafety.js +1 -1
- package/es/components/HDLKiosk/{app → runtime}/operations/coordinator.js +2 -2
- package/es/components/HDLKiosk/runtime/operations/customization.js +70 -0
- package/es/components/HDLKiosk/{app → runtime}/operations/errors.js +1 -1
- package/es/components/HDLKiosk/runtime/operations/fulfillment.js +6 -0
- package/es/components/HDLKiosk/runtime/operations/identity.js +55 -0
- package/es/components/HDLKiosk/runtime/operations/registry.js +34 -0
- package/es/components/HDLKiosk/runtime/operations/session.js +29 -0
- package/es/components/HDLKiosk/runtime/operations/types.js +13 -0
- package/es/components/HDLKiosk/runtime/session/blockPolicy.js +14 -0
- package/es/components/HDLKiosk/runtime/{createWorkflowSession.js → session/createSession.js} +67 -17
- package/es/components/HDLKiosk/runtime/{domainTransitionRunner.js → session/transitionRunner.js} +10 -5
- package/es/components/HDLKiosk/runtime/{workflowContext.js → session/workflowContext.js} +2 -2
- package/es/components/HDLKiosk/runtime/{workflowLifecycle.js → session/workflowLifecycle.js} +2 -2
- package/es/components/HDLKiosk/runtime/triggers.js +28 -0
- package/es/components/HDLKiosk/slices/catalog/Screen/index.js +15 -8
- package/es/components/HDLKiosk/slices/catalog/Screen/index.less +74 -13
- package/es/components/HDLKiosk/slices/catalog/slice.js +2 -2
- package/es/components/HDLKiosk/slices/customization/Screen/index.js +37 -38
- package/es/components/HDLKiosk/slices/customization/Screen/index.less +5 -0
- package/es/components/HDLKiosk/slices/customization/slice.js +3 -4
- package/es/components/HDLKiosk/slices/fulfillment/slice.js +2 -2
- package/es/components/HDLKiosk/slices/fulfillment/view.js +1 -1
- package/es/components/HDLKiosk/slices/identity/Screen/index.js +2 -2
- package/es/components/HDLKiosk/slices/identity/slice.js +3 -3
- package/es/components/HDLKiosk/slices/identity/view.js +1 -1
- package/es/components/HDLKiosk/slices/payment/slice.js +3 -3
- package/es/components/HDLKiosk/slices/primaryProductPrompt/slice.js +2 -2
- package/es/components/HDLKiosk/slices/primaryProductPrompt/view.js +2 -2
- package/es/components/HDLKiosk/{runtime → ui}/HDLKioskWorkflowView.js +45 -131
- package/es/components/HDLKiosk/ui/ScaleSimulatorConsole/index.js +387 -0
- package/es/components/HDLKiosk/ui/ScaleSimulatorConsole/index.less +621 -0
- package/es/components/HDLKiosk/{app → ui}/ScreenRenderer.js +7 -7
- package/es/components/HDLKiosk/ui/controllers/useHDLKioskActionDispatcher.js +66 -0
- package/es/components/HDLKiosk/{runtime → ui}/controllers/useHDLKioskCustomerController.js +1 -1
- package/es/components/HDLKiosk/ui/controllers/useHDLKioskDeviceController.js +25 -0
- package/es/components/HDLKiosk/ui/controllers/useHDLKioskExitController.js +53 -0
- package/es/components/HDLKiosk/{runtime → ui}/controllers/useHDLKioskScreenData.js +1 -1
- package/es/components/HDLKiosk/ui/controllers/useHDLKioskSessionController.js +39 -0
- package/es/components/HDLKiosk/{app → ui}/entry/Screen/index.js +8 -6
- package/es/components/HDLKiosk/{app → ui}/entry/model.js +2 -2
- package/es/components/HDLKiosk/ui/scale.js +20 -0
- package/es/components/HDLKiosk/{runtime/useHostSnapshot.js → ui/snapshots.js} +6 -8
- package/es/components/HDLKiosk/{app → ui}/views.js +1 -1
- package/es/components/HDLKiosk/{runtime → ui}/workflowEvent.js +1 -1
- package/es/components/HDLKiosk/utils.js +4 -4
- package/es/components/bigSale/templates/HDLKiosk/adapter/HDLKioskPaymentRuntime.js +2 -1
- package/es/components/bigSale/templates/HDLKiosk/adapter/capabilities.js +1 -1
- package/es/components/bigSale/templates/HDLKiosk/adapter/projection.js +21 -11
- package/es/components/bigSale/templates/HDLKiosk/adapter/sales.js +21 -3
- package/es/components/bigSale/templates/HDLKiosk/adapter/scaleTrigger.js +20 -5
- package/es/components/bigSale/templates/HDLKiosk/adapter/useBigSaleHDLKioskHost.js +3 -0
- package/es/components/bigSale/templates/HDLKiosk/index.js +3 -3
- package/lib/components/HDLKiosk/{contracts → app/contracts}/config.js +1 -1
- package/lib/components/HDLKiosk/app/manifest.js +18 -19
- package/lib/components/HDLKiosk/app/operations.js +105 -0
- package/lib/components/HDLKiosk/app/workflow/barcode.js +11 -13
- package/lib/components/HDLKiosk/app/workflow/index.js +16 -0
- package/lib/components/HDLKiosk/app/workflow/predicates.js +1 -0
- package/lib/components/HDLKiosk/app/workflow/quick.js +1 -1
- package/lib/components/HDLKiosk/app/workflow/registry.js +3 -3
- package/lib/components/HDLKiosk/app/workflow/scale.js +5 -1
- package/lib/components/HDLKiosk/docs/00-/346/226/207/344/273/266/345/257/274/350/210/252.md +104 -167
- package/lib/components/HDLKiosk/docs/01-/346/240/270/345/277/203/350/277/220/350/241/214/346/234/272/345/210/266.md +105 -101
- package/lib/components/HDLKiosk/docs/03-/344/270/232/345/212/241/346/265/201/347/250/213/344/270/216/344/272/244/344/272/222/350/247/204/345/210/231.md +2 -2
- package/lib/components/HDLKiosk/docs/04-/350/256/276/345/244/207/344/270/216/347/247/260/351/207/215.md +43 -26
- package/lib/components/HDLKiosk/docs/05-/344/272/244/346/230/223/345/256/211/345/205/250.md +2 -0
- package/lib/components/HDLKiosk/docs/07-/345/220/216/347/273/255/345/267/245/344/275/234.md +1 -1
- package/lib/components/HDLKiosk/docs/08-/346/227/240/345/244/264Application/350/277/220/350/241/214/346/227/266/351/207/215/346/236/204/350/256/276/350/256/241.md +719 -0
- package/lib/components/HDLKiosk/docs/09-Entry/350/256/276/345/244/207/344/272/213/344/273/266/351/207/215/346/236/204/344/277/256/345/244/215/346/212/245/345/221/212.md +187 -0
- package/lib/components/HDLKiosk/docs/README.md +6 -2
- package/lib/components/HDLKiosk/docs//345/256/236/346/226/275/350/277/233/345/272/246.md +8 -7
- package/lib/components/HDLKiosk/docs//346/236/266/346/236/204/350/256/276/350/256/241.md +16 -18
- package/lib/components/HDLKiosk/index.js +25 -31
- package/lib/components/HDLKiosk/index.less +1 -1
- package/lib/components/HDLKiosk/kernel/README.md +14 -13
- package/lib/components/HDLKiosk/kernel/application/defineApplication.js +65 -25
- package/lib/components/HDLKiosk/kernel/application/defineSlice.js +6 -6
- package/lib/components/HDLKiosk/kernel/application/runtime.js +237 -0
- package/lib/components/HDLKiosk/kernel/operations/coordinator.js +1 -1
- package/lib/components/HDLKiosk/kernel/operations/registry.js +3 -3
- package/lib/components/HDLKiosk/kernel/operations/sessionEpoch.js +1 -1
- package/lib/components/HDLKiosk/kernel/operations/types.js +8 -3
- package/lib/components/HDLKiosk/kernel/workflow/actor.js +51 -22
- package/lib/components/HDLKiosk/kernel/workflow/compiler.js +23 -30
- package/lib/components/HDLKiosk/runtime/createRuntime.js +239 -0
- package/lib/components/HDLKiosk/{devices → runtime/devices}/dedupeStore.js +1 -1
- package/lib/components/HDLKiosk/{devices → runtime/devices}/scaleIngress.js +1 -1
- package/lib/components/HDLKiosk/{devices/scale/runtime.js → runtime/devices/scaleStore.js} +17 -27
- package/lib/components/HDLKiosk/{devices → runtime/devices}/scannerIngress.js +1 -1
- package/lib/components/HDLKiosk/runtime/devices/scannerSessionPort.js +60 -0
- package/lib/components/HDLKiosk/runtime/devices/scannerSessionRouter.js +212 -0
- package/lib/components/HDLKiosk/runtime/operations/barcode.js +17 -0
- package/lib/components/HDLKiosk/runtime/operations/cart.js +46 -0
- package/lib/components/HDLKiosk/{app → runtime}/operations/cartConsistency.js +1 -1
- package/lib/components/HDLKiosk/{app → runtime}/operations/checkout.js +97 -112
- package/lib/components/HDLKiosk/{app → runtime}/operations/checkoutRequirements.js +1 -1
- package/lib/components/HDLKiosk/{app → runtime}/operations/checkoutSafety.js +1 -1
- package/lib/components/HDLKiosk/{app → runtime}/operations/coordinator.js +2 -2
- package/lib/components/HDLKiosk/runtime/operations/customization.js +73 -0
- package/lib/components/HDLKiosk/{app → runtime}/operations/errors.js +1 -1
- package/lib/components/HDLKiosk/runtime/operations/fulfillment.js +5 -0
- package/lib/components/HDLKiosk/runtime/operations/identity.js +55 -0
- package/lib/components/HDLKiosk/runtime/operations/registry.js +34 -0
- package/lib/components/HDLKiosk/runtime/operations/session.js +30 -0
- package/lib/components/HDLKiosk/runtime/operations/types.js +14 -0
- package/lib/components/HDLKiosk/runtime/session/blockPolicy.js +14 -0
- package/lib/components/HDLKiosk/runtime/{createWorkflowSession.js → session/createSession.js} +71 -21
- package/lib/components/HDLKiosk/runtime/{domainTransitionRunner.js → session/transitionRunner.js} +10 -5
- package/lib/components/HDLKiosk/runtime/{workflowContext.js → session/workflowContext.js} +2 -2
- package/lib/components/HDLKiosk/runtime/{workflowLifecycle.js → session/workflowLifecycle.js} +2 -2
- package/lib/components/HDLKiosk/runtime/triggers.js +28 -0
- package/lib/components/HDLKiosk/slices/catalog/Screen/index.js +15 -8
- package/lib/components/HDLKiosk/slices/catalog/Screen/index.less +74 -13
- package/lib/components/HDLKiosk/slices/catalog/slice.js +3 -3
- package/lib/components/HDLKiosk/slices/customization/Screen/index.js +38 -39
- package/lib/components/HDLKiosk/slices/customization/Screen/index.less +5 -0
- package/lib/components/HDLKiosk/slices/customization/slice.js +5 -6
- package/lib/components/HDLKiosk/slices/fulfillment/slice.js +3 -3
- package/lib/components/HDLKiosk/slices/fulfillment/view.js +1 -1
- package/lib/components/HDLKiosk/slices/identity/Screen/index.js +2 -2
- package/lib/components/HDLKiosk/slices/identity/slice.js +4 -4
- package/lib/components/HDLKiosk/slices/identity/view.js +1 -1
- package/lib/components/HDLKiosk/slices/payment/slice.js +5 -5
- package/lib/components/HDLKiosk/slices/primaryProductPrompt/slice.js +2 -2
- package/lib/components/HDLKiosk/slices/primaryProductPrompt/view.js +2 -2
- package/lib/components/HDLKiosk/{runtime → ui}/HDLKioskWorkflowView.js +46 -132
- package/lib/components/HDLKiosk/ui/ScaleSimulatorConsole/index.js +390 -0
- package/lib/components/HDLKiosk/ui/ScaleSimulatorConsole/index.less +621 -0
- package/lib/components/HDLKiosk/{app → ui}/ScreenRenderer.js +7 -7
- package/lib/components/HDLKiosk/ui/controllers/useHDLKioskActionDispatcher.js +67 -0
- package/lib/components/HDLKiosk/{runtime → ui}/controllers/useHDLKioskCustomerController.js +1 -1
- package/lib/components/HDLKiosk/ui/controllers/useHDLKioskDeviceController.js +26 -0
- package/lib/components/HDLKiosk/ui/controllers/useHDLKioskExitController.js +54 -0
- package/lib/components/HDLKiosk/{runtime → ui}/controllers/useHDLKioskScreenData.js +1 -1
- package/lib/components/HDLKiosk/ui/controllers/useHDLKioskSessionController.js +40 -0
- package/lib/components/HDLKiosk/{app → ui}/entry/Screen/index.js +8 -6
- package/lib/components/HDLKiosk/{app → ui}/entry/model.js +2 -2
- package/lib/components/HDLKiosk/ui/scale.js +24 -0
- package/lib/components/HDLKiosk/{runtime/useHostSnapshot.js → ui/snapshots.js} +6 -7
- package/lib/components/HDLKiosk/{app → ui}/views.js +1 -1
- package/lib/components/HDLKiosk/{runtime → ui}/workflowEvent.js +1 -1
- package/lib/components/HDLKiosk/utils.js +4 -4
- package/lib/components/bigSale/templates/HDLKiosk/adapter/HDLKioskPaymentRuntime.js +2 -1
- package/lib/components/bigSale/templates/HDLKiosk/adapter/capabilities.js +1 -1
- package/lib/components/bigSale/templates/HDLKiosk/adapter/projection.js +21 -10
- package/lib/components/bigSale/templates/HDLKiosk/adapter/sales.js +20 -2
- package/lib/components/bigSale/templates/HDLKiosk/adapter/scaleTrigger.js +19 -4
- package/lib/components/bigSale/templates/HDLKiosk/adapter/useBigSaleHDLKioskHost.js +3 -0
- package/lib/components/bigSale/templates/HDLKiosk/index.js +4 -4
- package/package.json +2 -2
- package/es/components/HDLKiosk/app/constants.js +0 -9
- package/es/components/HDLKiosk/app/operations/barcode.js +0 -22
- package/es/components/HDLKiosk/app/operations/cart.js +0 -60
- package/es/components/HDLKiosk/app/operations/fulfillment.js +0 -11
- package/es/components/HDLKiosk/app/operations/session.js +0 -41
- package/es/components/HDLKiosk/app/operations/types.js +0 -11
- package/es/components/HDLKiosk/devices/entryArbiter.js +0 -33
- package/es/components/HDLKiosk/runtime/controllers/useHDLKioskDeviceController.js +0 -75
- package/es/components/HDLKiosk/runtime/controllers/useHDLKioskScannerController.js +0 -160
- package/es/components/HDLKiosk/runtime/controllers/useHDLKioskSessionController.js +0 -185
- package/es/components/HDLKiosk/runtime/useWorkflowSnapshot.js +0 -12
- package/es/components/HDLKiosk/slices/customization/operation.js +0 -80
- package/es/components/HDLKiosk/slices/identity/operation.js +0 -60
- package/lib/components/HDLKiosk/app/constants.js +0 -9
- package/lib/components/HDLKiosk/app/operations/barcode.js +0 -21
- package/lib/components/HDLKiosk/app/operations/cart.js +0 -62
- package/lib/components/HDLKiosk/app/operations/fulfillment.js +0 -10
- package/lib/components/HDLKiosk/app/operations/session.js +0 -42
- package/lib/components/HDLKiosk/app/operations/types.js +0 -12
- package/lib/components/HDLKiosk/devices/entryArbiter.js +0 -33
- package/lib/components/HDLKiosk/runtime/controllers/useHDLKioskDeviceController.js +0 -76
- package/lib/components/HDLKiosk/runtime/controllers/useHDLKioskScannerController.js +0 -161
- package/lib/components/HDLKiosk/runtime/controllers/useHDLKioskSessionController.js +0 -186
- package/lib/components/HDLKiosk/runtime/useWorkflowSnapshot.js +0 -13
- package/lib/components/HDLKiosk/slices/customization/operation.js +0 -83
- package/lib/components/HDLKiosk/slices/identity/operation.js +0 -60
- /package/es/components/HDLKiosk/{app → ui}/entry/Screen/index.less +0 -0
- /package/lib/components/HDLKiosk/{app → ui}/entry/Screen/index.less +0 -0
|
@@ -1,31 +1,51 @@
|
|
|
1
1
|
import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
2
2
|
import { _objectWithoutProperties } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectWithoutProperties.js";
|
|
3
3
|
//#region src/components/HDLKiosk/kernel/application/defineApplication.ts
|
|
4
|
-
const _excluded = ["slice"];
|
|
5
|
-
function
|
|
4
|
+
const _excluded = ["start"], _excluded2 = ["slice"];
|
|
5
|
+
function getSliceNavigationGuardId(sliceId, phase) {
|
|
6
6
|
return `${sliceId}.${phase}`;
|
|
7
7
|
}
|
|
8
8
|
function isWorkflowStep(value) {
|
|
9
9
|
return "slice" in value;
|
|
10
10
|
}
|
|
11
11
|
function defineWorkflow(workflow) {
|
|
12
|
-
if (!workflow.id.trim()) throw new Error("
|
|
13
|
-
if (workflow.steps.length === 0) throw new Error(`
|
|
14
|
-
return Object.freeze(_objectSpread2(_objectSpread2({}, workflow), {}, { steps: Object.freeze([...workflow.steps]) }));
|
|
12
|
+
if (!workflow.id.trim()) throw new Error("Workflow id cannot be empty");
|
|
13
|
+
if (workflow.steps.length === 0) throw new Error(`Workflow ${workflow.id} must contain steps`);
|
|
14
|
+
return Object.freeze(_objectSpread2(_objectSpread2(_objectSpread2({}, workflow), workflow.start ? { start: Object.freeze(_objectSpread2({}, workflow.start)) } : {}), {}, { steps: Object.freeze([...workflow.steps]) }));
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const manualTrigger = Object.freeze({
|
|
17
|
+
id: "manual",
|
|
18
|
+
mode: "manual"
|
|
19
|
+
});
|
|
20
|
+
function defineTrigger(trigger) {
|
|
21
|
+
if (!trigger.id.trim()) throw new Error("Application Trigger id cannot be empty");
|
|
22
|
+
return Object.freeze(_objectSpread2({}, trigger));
|
|
23
|
+
}
|
|
24
|
+
function resolveWorkflowStartBinding(workflow) {
|
|
25
|
+
var _workflow$start;
|
|
26
|
+
const start = (_workflow$start = workflow.start) !== null && _workflow$start !== void 0 ? _workflow$start : {
|
|
27
|
+
trigger: manualTrigger.id,
|
|
28
|
+
channel: workflow.id
|
|
29
|
+
};
|
|
30
|
+
if (!start.trigger.trim()) throw new Error(`Workflow ${workflow.id} trigger cannot be empty`);
|
|
31
|
+
if (!start.channel.trim()) throw new Error(`Workflow ${workflow.id} trigger channel cannot be empty`);
|
|
32
|
+
return Object.freeze(_objectSpread2({}, start));
|
|
33
|
+
}
|
|
34
|
+
function defineApplication(definition) {
|
|
35
|
+
var _definition$operation, _definition$triggers;
|
|
36
|
+
if (!definition.id.trim()) throw new Error("Application id cannot be empty");
|
|
19
37
|
const slices = /* @__PURE__ */ new Map();
|
|
20
38
|
const operations = /* @__PURE__ */ new Map();
|
|
39
|
+
const triggers = new Map([[manualTrigger.id, manualTrigger]]);
|
|
40
|
+
const workflowStarts = /* @__PURE__ */ new Map();
|
|
21
41
|
const registerOperation = (operation) => {
|
|
22
42
|
const existing = operations.get(operation.id);
|
|
23
|
-
if (existing && existing !== operation) throw new Error(`Duplicate
|
|
43
|
+
if (existing && existing !== operation) throw new Error(`Duplicate Operation: ${operation.id}`);
|
|
24
44
|
operations.set(operation.id, operation);
|
|
25
45
|
};
|
|
26
46
|
definition.slices.forEach((slice) => {
|
|
27
47
|
var _slice$commands;
|
|
28
|
-
if (slices.has(slice.id)) throw new Error(`Duplicate
|
|
48
|
+
if (slices.has(slice.id)) throw new Error(`Duplicate Slice: ${slice.id}`);
|
|
29
49
|
const operationIds = /* @__PURE__ */ new Set();
|
|
30
50
|
Object.values(slice.intents).forEach((intent) => {
|
|
31
51
|
if (intent.kind !== "effect") return;
|
|
@@ -42,22 +62,41 @@ function defineKioskApplication(definition) {
|
|
|
42
62
|
}));
|
|
43
63
|
});
|
|
44
64
|
(_definition$operation = definition.operations) === null || _definition$operation === void 0 || _definition$operation.forEach(registerOperation);
|
|
65
|
+
(_definition$triggers = definition.triggers) === null || _definition$triggers === void 0 || _definition$triggers.forEach((trigger) => {
|
|
66
|
+
if (triggers.has(trigger.id)) throw new Error(`Duplicate Application Trigger: ${trigger.id}`);
|
|
67
|
+
if (!trigger.id.trim()) throw new Error("Application Trigger id cannot be empty");
|
|
68
|
+
triggers.set(trigger.id, Object.freeze(_objectSpread2({}, trigger)));
|
|
69
|
+
});
|
|
70
|
+
const automaticTriggerOwners = /* @__PURE__ */ new Map();
|
|
45
71
|
Object.values(definition.workflows).forEach((workflow) => {
|
|
72
|
+
if (workflowStarts.has(workflow.id)) throw new Error(`Duplicate Workflow: ${workflow.id}`);
|
|
73
|
+
const start = resolveWorkflowStartBinding(workflow);
|
|
74
|
+
const trigger = triggers.get(start.trigger);
|
|
75
|
+
if (!trigger) throw new Error(`Workflow ${workflow.id} references unknown Trigger ${start.trigger}`);
|
|
76
|
+
if (trigger.mode === "automatic") {
|
|
77
|
+
const owner = automaticTriggerOwners.get(trigger.id);
|
|
78
|
+
if (owner) throw new Error(`Automatic Trigger ${trigger.id} is already bound to Workflow ${owner}`);
|
|
79
|
+
automaticTriggerOwners.set(trigger.id, workflow.id);
|
|
80
|
+
}
|
|
81
|
+
workflowStarts.set(workflow.id, start);
|
|
46
82
|
workflow.steps.forEach((rawStep) => {
|
|
47
83
|
var _slices$get;
|
|
48
84
|
const slice = isWorkflowStep(rawStep) ? rawStep.slice : rawStep;
|
|
49
|
-
if (((_slices$get = slices.get(slice.id)) === null || _slices$get === void 0 ? void 0 : _slices$get.definition) !== slice) throw new Error(`
|
|
85
|
+
if (((_slices$get = slices.get(slice.id)) === null || _slices$get === void 0 ? void 0 : _slices$get.definition) !== slice) throw new Error(`Workflow ${workflow.id} references unregistered Slice ${slice.id}`);
|
|
50
86
|
});
|
|
51
87
|
});
|
|
52
88
|
return Object.freeze({
|
|
53
89
|
id: definition.id,
|
|
54
90
|
slices,
|
|
55
91
|
operations,
|
|
92
|
+
triggers,
|
|
93
|
+
workflowStarts,
|
|
56
94
|
workflows: Object.freeze(_objectSpread2({}, definition.workflows))
|
|
57
95
|
});
|
|
58
96
|
}
|
|
59
|
-
function
|
|
60
|
-
|
|
97
|
+
function normalizeApplicationWorkflow(workflow) {
|
|
98
|
+
const { start: _start } = workflow, structure = _objectWithoutProperties(workflow, _excluded);
|
|
99
|
+
return Object.freeze(_objectSpread2(_objectSpread2({}, structure), {}, { steps: Object.freeze(workflow.steps.map((rawStep) => {
|
|
61
100
|
if (!isWorkflowStep(rawStep)) {
|
|
62
101
|
const authoringOverrides = rawStep;
|
|
63
102
|
return Object.freeze({
|
|
@@ -65,10 +104,10 @@ function normalizeKioskWorkflow(workflow) {
|
|
|
65
104
|
presentation: typeof authoringOverrides.presentation === "object" ? authoringOverrides.presentation : void 0,
|
|
66
105
|
readiness: authoringOverrides.readiness,
|
|
67
106
|
on: authoringOverrides.on,
|
|
68
|
-
|
|
107
|
+
isTerminal: authoringOverrides.isTerminal
|
|
69
108
|
});
|
|
70
109
|
}
|
|
71
|
-
const { slice } = rawStep, step = _objectWithoutProperties(rawStep,
|
|
110
|
+
const { slice } = rawStep, step = _objectWithoutProperties(rawStep, _excluded2);
|
|
72
111
|
return Object.freeze(_objectSpread2(_objectSpread2({}, step), {}, { activity: slice.id }));
|
|
73
112
|
})) }));
|
|
74
113
|
}
|
|
@@ -76,7 +115,7 @@ function normalizeKioskWorkflow(workflow) {
|
|
|
76
115
|
function createApplicationActivityRegistry(application) {
|
|
77
116
|
const contracts = /* @__PURE__ */ new Map();
|
|
78
117
|
application.slices.forEach(({ definition }) => {
|
|
79
|
-
var _definition$presentat, _definition$additiona;
|
|
118
|
+
var _definition$presentat, _definition$surface$i, _definition$surface, _definition$additiona;
|
|
80
119
|
const exitPolicies = {};
|
|
81
120
|
Object.entries(definition.intents).forEach(([intent, behavior]) => {
|
|
82
121
|
let policy;
|
|
@@ -90,12 +129,12 @@ function createApplicationActivityRegistry(application) {
|
|
|
90
129
|
const primaryPresentation = (_definition$presentat = definition.presentation) !== null && _definition$presentat !== void 0 ? _definition$presentat : "page";
|
|
91
130
|
contracts.set(definition.id, Object.freeze({
|
|
92
131
|
id: definition.id,
|
|
93
|
-
|
|
132
|
+
surfaceId: (_definition$surface$i = (_definition$surface = definition.surface) === null || _definition$surface === void 0 ? void 0 : _definition$surface.id) !== null && _definition$surface$i !== void 0 ? _definition$surface$i : definition.id,
|
|
94
133
|
intents: Object.freeze(Object.keys(definition.intents)),
|
|
95
134
|
exitPolicies: Object.freeze(exitPolicies),
|
|
96
135
|
navigationGuards: definition.guards ? Object.freeze(Object.keys(definition.guards).reduce((guards, rawPhase) => {
|
|
97
136
|
const phase = rawPhase;
|
|
98
|
-
guards[phase] =
|
|
137
|
+
guards[phase] = getSliceNavigationGuardId(definition.id, phase);
|
|
99
138
|
return guards;
|
|
100
139
|
}, {})) : void 0,
|
|
101
140
|
allowedPresentations: Object.freeze([...new Set([primaryPresentation, ...(_definition$additiona = definition.additionalPresentations) !== null && _definition$additiona !== void 0 ? _definition$additiona : []])]),
|
|
@@ -108,7 +147,7 @@ function createApplicationActivityRegistry(application) {
|
|
|
108
147
|
has: (id) => contracts.has(id),
|
|
109
148
|
require: (id) => {
|
|
110
149
|
const contract = contracts.get(id);
|
|
111
|
-
if (!contract) throw new Error(`Unknown
|
|
150
|
+
if (!contract) throw new Error(`Unknown Slice: ${id}`);
|
|
112
151
|
return contract;
|
|
113
152
|
}
|
|
114
153
|
});
|
|
@@ -123,8 +162,8 @@ function createApplicationNavigationGuardRegistry(application) {
|
|
|
123
162
|
var _definition$guards;
|
|
124
163
|
Object.entries((_definition$guards = definition.guards) !== null && _definition$guards !== void 0 ? _definition$guards : {}).forEach(([rawPhase, guard]) => {
|
|
125
164
|
const phase = rawPhase;
|
|
126
|
-
const id =
|
|
127
|
-
if (navigationGuards.has(id)) throw new Error(`Duplicate
|
|
165
|
+
const id = getSliceNavigationGuardId(definition.id, phase);
|
|
166
|
+
if (navigationGuards.has(id)) throw new Error(`Duplicate Navigation Guard: ${id}`);
|
|
128
167
|
navigationGuards.set(id, guard);
|
|
129
168
|
});
|
|
130
169
|
});
|
|
@@ -133,8 +172,8 @@ function createApplicationNavigationGuardRegistry(application) {
|
|
|
133
172
|
has: (id) => navigationGuards.has(id),
|
|
134
173
|
evaluate: (id, context) => {
|
|
135
174
|
const navigationGuard = navigationGuards.get(id);
|
|
136
|
-
if (!navigationGuard) throw new Error(`Unknown
|
|
137
|
-
if (context.to.kind !== "step") throw new Error(`
|
|
175
|
+
if (!navigationGuard) throw new Error(`Unknown Navigation Guard: ${id}`);
|
|
176
|
+
if (context.to.kind !== "step") throw new Error(`Slice Navigation Guard ${id} requires a Step target`);
|
|
138
177
|
return navigationGuard(_objectSpread2(_objectSpread2({}, context), {}, {
|
|
139
178
|
workflow: context.context,
|
|
140
179
|
to: context.to
|
|
@@ -143,4 +182,4 @@ function createApplicationNavigationGuardRegistry(application) {
|
|
|
143
182
|
});
|
|
144
183
|
}
|
|
145
184
|
//#endregion
|
|
146
|
-
export { createApplicationActivityRegistry, createApplicationNavigationGuardRegistry,
|
|
185
|
+
export { createApplicationActivityRegistry, createApplicationNavigationGuardRegistry, defineApplication, defineTrigger, defineWorkflow, normalizeApplicationWorkflow };
|
|
@@ -13,17 +13,17 @@ const effect = (operation, options = {}) => Object.freeze({
|
|
|
13
13
|
});
|
|
14
14
|
function defineSlice(slice) {
|
|
15
15
|
var _slice$guards;
|
|
16
|
-
if (!slice.id.trim()) throw new Error("
|
|
17
|
-
if (!slice.
|
|
16
|
+
if (!slice.id.trim()) throw new Error("Slice id cannot be empty");
|
|
17
|
+
if (slice.surface && !slice.surface.id.trim()) throw new Error(`Slice ${slice.id} surface id cannot be empty`);
|
|
18
18
|
Object.entries(slice.intents).forEach(([intent]) => {
|
|
19
|
-
if (!intent.trim()) throw new Error(`
|
|
19
|
+
if (!intent.trim()) throw new Error(`Slice ${slice.id} has an empty intent`);
|
|
20
20
|
});
|
|
21
21
|
Object.entries((_slice$guards = slice.guards) !== null && _slice$guards !== void 0 ? _slice$guards : {}).forEach(([phase, navigationGuard]) => {
|
|
22
|
-
if (phase !== "beforeEnter") throw new Error(`
|
|
23
|
-
if (typeof navigationGuard !== "function") throw new Error(`
|
|
22
|
+
if (phase !== "beforeEnter") throw new Error(`Slice ${slice.id} has an unknown navigation guard phase: ${phase}`);
|
|
23
|
+
if (typeof navigationGuard !== "function") throw new Error(`Slice ${slice.id} guard ${phase} must be a function`);
|
|
24
24
|
});
|
|
25
25
|
return Object.freeze(_objectSpread2(_objectSpread2({}, slice), {}, {
|
|
26
|
-
|
|
26
|
+
surface: slice.surface ? Object.freeze(_objectSpread2({}, slice.surface)) : void 0,
|
|
27
27
|
intents: Object.freeze(_objectSpread2({}, slice.intents)),
|
|
28
28
|
guards: slice.guards ? Object.freeze(_objectSpread2({}, slice.guards)) : void 0,
|
|
29
29
|
commands: slice.commands ? Object.freeze(_objectSpread2({}, slice.commands)) : void 0,
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
2
|
+
import { _asyncToGenerator } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js";
|
|
3
|
+
//#region src/components/HDLKiosk/kernel/application/runtime.ts
|
|
4
|
+
function createApplicationRuntime({ definition, sessionFactory, triggerAdapters = [], maxActiveSessions = Number.POSITIVE_INFINITY }) {
|
|
5
|
+
if (maxActiveSessions <= 0) throw new Error("Application Runtime maxActiveSessions must be positive");
|
|
6
|
+
const workflowsByTrigger = /* @__PURE__ */ new Map();
|
|
7
|
+
definition.workflowStarts.forEach((start, workflowId) => {
|
|
8
|
+
if (start.trigger === "manual") return;
|
|
9
|
+
if (workflowsByTrigger.has(start.trigger)) throw new Error(`Automatic Trigger ${start.trigger} has multiple Workflow bindings`);
|
|
10
|
+
workflowsByTrigger.set(start.trigger, {
|
|
11
|
+
workflowId,
|
|
12
|
+
start
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
const adapters = /* @__PURE__ */ new Map();
|
|
16
|
+
triggerAdapters.forEach((adapter) => {
|
|
17
|
+
if (adapters.has(adapter.trigger)) throw new Error(`Duplicate Trigger Adapter: ${adapter.trigger}`);
|
|
18
|
+
const contract = definition.triggers.get(adapter.trigger);
|
|
19
|
+
if (!contract || contract.mode !== "automatic") throw new Error(`Unknown automatic Trigger Adapter: ${adapter.trigger}`);
|
|
20
|
+
adapters.set(adapter.trigger, adapter);
|
|
21
|
+
});
|
|
22
|
+
const sessions = /* @__PURE__ */ new Map();
|
|
23
|
+
const ownedSessionIds = /* @__PURE__ */ new Set();
|
|
24
|
+
const sessionListeners = /* @__PURE__ */ new Set();
|
|
25
|
+
const occurrenceSessions = /* @__PURE__ */ new Map();
|
|
26
|
+
const pendingOccurrences = /* @__PURE__ */ new Map();
|
|
27
|
+
const cleanups = [];
|
|
28
|
+
let state = "inactive";
|
|
29
|
+
let activationEpoch = 0;
|
|
30
|
+
let manualSequence = 0;
|
|
31
|
+
let pendingStartCount = 0;
|
|
32
|
+
const publishSessionEvent = (event) => {
|
|
33
|
+
sessionListeners.forEach((listener) => listener(event));
|
|
34
|
+
};
|
|
35
|
+
const create = function() {
|
|
36
|
+
var _ref = _asyncToGenerator(function* (input) {
|
|
37
|
+
if (state !== "active") return {
|
|
38
|
+
status: "rejected",
|
|
39
|
+
reason: "runtimeInactive"
|
|
40
|
+
};
|
|
41
|
+
const occurrenceKey = `${input.cause.trigger}\u0000${input.cause.occurrenceId}`;
|
|
42
|
+
const existingId = occurrenceSessions.get(occurrenceKey);
|
|
43
|
+
const existing = existingId ? sessions.get(existingId) : void 0;
|
|
44
|
+
if (existing) return {
|
|
45
|
+
status: "duplicate",
|
|
46
|
+
session: existing
|
|
47
|
+
};
|
|
48
|
+
const pending = pendingOccurrences.get(occurrenceKey);
|
|
49
|
+
if (pending) return pending;
|
|
50
|
+
if (ownedSessionIds.size + pendingStartCount >= maxActiveSessions) return {
|
|
51
|
+
status: "rejected",
|
|
52
|
+
reason: "admissionRejected"
|
|
53
|
+
};
|
|
54
|
+
const startActivationEpoch = activationEpoch;
|
|
55
|
+
pendingStartCount += 1;
|
|
56
|
+
const promise = sessionFactory.create(input).then((session) => {
|
|
57
|
+
if (state !== "active" || activationEpoch !== startActivationEpoch) {
|
|
58
|
+
session.dispose();
|
|
59
|
+
return {
|
|
60
|
+
status: "rejected",
|
|
61
|
+
reason: "runtimeInactive"
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
if (session.workflowId !== input.workflowId) {
|
|
65
|
+
session.dispose();
|
|
66
|
+
return {
|
|
67
|
+
status: "rejected",
|
|
68
|
+
reason: "sessionStartFailed",
|
|
69
|
+
error: /* @__PURE__ */ new Error(`Session Workflow ${session.workflowId} does not match ${input.workflowId}`)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (sessions.has(session.id)) {
|
|
73
|
+
session.dispose();
|
|
74
|
+
return {
|
|
75
|
+
status: "rejected",
|
|
76
|
+
reason: "sessionStartFailed",
|
|
77
|
+
error: /* @__PURE__ */ new Error(`Duplicate Workflow Session: ${session.id}`)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
sessions.set(session.id, session);
|
|
81
|
+
ownedSessionIds.add(session.id);
|
|
82
|
+
occurrenceSessions.set(occurrenceKey, session.id);
|
|
83
|
+
publishSessionEvent({
|
|
84
|
+
type: "started",
|
|
85
|
+
session
|
|
86
|
+
});
|
|
87
|
+
try {
|
|
88
|
+
var _sessionFactory$onSta;
|
|
89
|
+
(_sessionFactory$onSta = sessionFactory.onStarted) === null || _sessionFactory$onSta === void 0 || _sessionFactory$onSta.call(sessionFactory, _objectSpread2({ session }, input));
|
|
90
|
+
} catch (error) {
|
|
91
|
+
sessions.delete(session.id);
|
|
92
|
+
ownedSessionIds.delete(session.id);
|
|
93
|
+
occurrenceSessions.delete(occurrenceKey);
|
|
94
|
+
session.dispose();
|
|
95
|
+
publishSessionEvent({
|
|
96
|
+
type: "disposed",
|
|
97
|
+
sessionId: session.id
|
|
98
|
+
});
|
|
99
|
+
return {
|
|
100
|
+
status: "rejected",
|
|
101
|
+
reason: "sessionStartFailed",
|
|
102
|
+
error
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
status: "started",
|
|
107
|
+
session
|
|
108
|
+
};
|
|
109
|
+
}).catch((error) => ({
|
|
110
|
+
status: "rejected",
|
|
111
|
+
reason: "sessionStartFailed",
|
|
112
|
+
error
|
|
113
|
+
})).finally(() => {
|
|
114
|
+
pendingStartCount -= 1;
|
|
115
|
+
pendingOccurrences.delete(occurrenceKey);
|
|
116
|
+
});
|
|
117
|
+
pendingOccurrences.set(occurrenceKey, promise);
|
|
118
|
+
return promise;
|
|
119
|
+
});
|
|
120
|
+
return function create(_x) {
|
|
121
|
+
return _ref.apply(this, arguments);
|
|
122
|
+
};
|
|
123
|
+
}();
|
|
124
|
+
const emitAutomatic = (trigger, occurrence) => {
|
|
125
|
+
var _occurrence$correlati;
|
|
126
|
+
const binding = workflowsByTrigger.get(trigger);
|
|
127
|
+
if (!binding || binding.start.channel !== occurrence.channel) return Promise.resolve({
|
|
128
|
+
status: "rejected",
|
|
129
|
+
reason: "unknownChannel"
|
|
130
|
+
});
|
|
131
|
+
return create({
|
|
132
|
+
workflowId: binding.workflowId,
|
|
133
|
+
payload: occurrence.payload,
|
|
134
|
+
cause: Object.freeze({
|
|
135
|
+
trigger,
|
|
136
|
+
channel: occurrence.channel,
|
|
137
|
+
occurrenceId: occurrence.occurrenceId,
|
|
138
|
+
correlationId: (_occurrence$correlati = occurrence.correlationId) !== null && _occurrence$correlati !== void 0 ? _occurrence$correlati : `${definition.id}:${trigger}:${occurrence.occurrenceId}`
|
|
139
|
+
})
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
const registry = Object.freeze({
|
|
143
|
+
get: (sessionId) => sessions.get(sessionId),
|
|
144
|
+
list: () => Object.freeze([...sessions.values()]),
|
|
145
|
+
listActive: () => Object.freeze([...sessions.values()].filter((session) => session.isActive())),
|
|
146
|
+
subscribe: (listener) => {
|
|
147
|
+
sessionListeners.add(listener);
|
|
148
|
+
return () => sessionListeners.delete(listener);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
const runtime = {
|
|
152
|
+
id: definition.id,
|
|
153
|
+
sessions: registry,
|
|
154
|
+
activate: () => {
|
|
155
|
+
if (state === "disposed") throw new Error(`Application Runtime ${definition.id} is disposed`);
|
|
156
|
+
if (state === "active") return;
|
|
157
|
+
workflowsByTrigger.forEach((_binding, trigger) => {
|
|
158
|
+
if (!adapters.has(trigger)) throw new Error(`Missing Trigger Adapter: ${trigger}`);
|
|
159
|
+
});
|
|
160
|
+
activationEpoch += 1;
|
|
161
|
+
state = "active";
|
|
162
|
+
try {
|
|
163
|
+
adapters.forEach((adapter) => {
|
|
164
|
+
const cleanup = adapter.activate({ emit: (occurrence) => emitAutomatic(adapter.trigger, occurrence) });
|
|
165
|
+
if (cleanup) cleanups.push(cleanup);
|
|
166
|
+
});
|
|
167
|
+
} catch (error) {
|
|
168
|
+
var _cleanups$pop;
|
|
169
|
+
state = "inactive";
|
|
170
|
+
while (cleanups.length > 0) (_cleanups$pop = cleanups.pop()) === null || _cleanups$pop === void 0 || _cleanups$pop();
|
|
171
|
+
throw error;
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
deactivate: () => {
|
|
175
|
+
var _cleanups$pop2;
|
|
176
|
+
if (state !== "active") return;
|
|
177
|
+
state = "inactive";
|
|
178
|
+
while (cleanups.length > 0) (_cleanups$pop2 = cleanups.pop()) === null || _cleanups$pop2 === void 0 || _cleanups$pop2();
|
|
179
|
+
},
|
|
180
|
+
workflow: (workflowId) => {
|
|
181
|
+
if (!definition.workflowStarts.get(workflowId)) throw new Error(`Unknown Workflow: ${workflowId}`);
|
|
182
|
+
return Object.freeze({
|
|
183
|
+
id: workflowId,
|
|
184
|
+
start: function() {
|
|
185
|
+
var _ref2 = _asyncToGenerator(function* (payload) {
|
|
186
|
+
if (start.trigger !== "manual") throw new Error(`Workflow ${workflowId} cannot be started through manual Trigger`);
|
|
187
|
+
manualSequence += 1;
|
|
188
|
+
const occurrenceId = `${workflowId}:${manualSequence}`;
|
|
189
|
+
const result = yield create({
|
|
190
|
+
workflowId,
|
|
191
|
+
payload,
|
|
192
|
+
cause: Object.freeze({
|
|
193
|
+
trigger: "manual",
|
|
194
|
+
channel: start.channel,
|
|
195
|
+
occurrenceId,
|
|
196
|
+
correlationId: `${definition.id}:manual:${occurrenceId}`
|
|
197
|
+
})
|
|
198
|
+
});
|
|
199
|
+
if (result.status === "started" || result.status === "duplicate") return result.session;
|
|
200
|
+
throw result.error instanceof Error ? result.error : /* @__PURE__ */ new Error(`Workflow ${workflowId} start rejected: ${result.reason}`);
|
|
201
|
+
});
|
|
202
|
+
return function start(_x2) {
|
|
203
|
+
return _ref2.apply(this, arguments);
|
|
204
|
+
};
|
|
205
|
+
}()
|
|
206
|
+
});
|
|
207
|
+
},
|
|
208
|
+
disposeSession: (sessionId) => {
|
|
209
|
+
const session = sessions.get(sessionId);
|
|
210
|
+
if (!session) return false;
|
|
211
|
+
if (!ownedSessionIds.delete(sessionId)) return false;
|
|
212
|
+
sessions.delete(sessionId);
|
|
213
|
+
const occurrenceKey = `${session.cause.trigger}\u0000${session.cause.occurrenceId}`;
|
|
214
|
+
if (occurrenceSessions.get(occurrenceKey) === sessionId) occurrenceSessions.delete(occurrenceKey);
|
|
215
|
+
session.dispose();
|
|
216
|
+
publishSessionEvent({
|
|
217
|
+
type: "disposed",
|
|
218
|
+
sessionId
|
|
219
|
+
});
|
|
220
|
+
return true;
|
|
221
|
+
},
|
|
222
|
+
dispose: () => {
|
|
223
|
+
var _cleanups$pop3;
|
|
224
|
+
if (state === "disposed") return;
|
|
225
|
+
state = "disposed";
|
|
226
|
+
while (cleanups.length > 0) (_cleanups$pop3 = cleanups.pop()) === null || _cleanups$pop3 === void 0 || _cleanups$pop3();
|
|
227
|
+
sessions.forEach((session) => session.dispose());
|
|
228
|
+
ownedSessionIds.clear();
|
|
229
|
+
sessions.clear();
|
|
230
|
+
pendingOccurrences.clear();
|
|
231
|
+
sessionListeners.clear();
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
return Object.freeze(runtime);
|
|
235
|
+
}
|
|
236
|
+
//#endregion
|
|
237
|
+
export { createApplicationRuntime };
|
|
@@ -16,7 +16,7 @@ function createKernelOperationCoordinator(registry, policy, options = {}) {
|
|
|
16
16
|
const queue = [];
|
|
17
17
|
const active = /* @__PURE__ */ new Set();
|
|
18
18
|
const queueLimit = policy.queueLimit;
|
|
19
|
-
if (queueLimit && (!Number.isSafeInteger(queueLimit.max) || queueLimit.max < 1)) throw new Error("
|
|
19
|
+
if (queueLimit && (!Number.isSafeInteger(queueLimit.max) || queueLimit.max < 1)) throw new Error("Operation queue limit must be a positive integer");
|
|
20
20
|
let disposed = false;
|
|
21
21
|
const metadata = (execution) => {
|
|
22
22
|
var _execution$operation$;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
function createKernelOperationRegistry(operations) {
|
|
3
3
|
const definitions = /* @__PURE__ */ new Map();
|
|
4
4
|
operations.forEach((operation) => {
|
|
5
|
-
if (definitions.has(operation.id)) throw new Error(`Duplicate
|
|
6
|
-
if (operation.timeoutMs !== void 0 && (!Number.isFinite(operation.timeoutMs) || operation.timeoutMs <= 0)) throw new Error(`Invalid timeout for
|
|
5
|
+
if (definitions.has(operation.id)) throw new Error(`Duplicate Operation: ${operation.id}`);
|
|
6
|
+
if (operation.timeoutMs !== void 0 && (!Number.isFinite(operation.timeoutMs) || operation.timeoutMs <= 0)) throw new Error(`Invalid timeout for Operation: ${operation.id}`);
|
|
7
7
|
definitions.set(operation.id, operation);
|
|
8
8
|
});
|
|
9
9
|
return Object.freeze({
|
|
@@ -12,7 +12,7 @@ function createKernelOperationRegistry(operations) {
|
|
|
12
12
|
get: (id) => definitions.get(id),
|
|
13
13
|
require: (id) => {
|
|
14
14
|
const operation = definitions.get(id);
|
|
15
|
-
if (!operation) throw new Error(`Unknown
|
|
15
|
+
if (!operation) throw new Error(`Unknown Operation: ${id}`);
|
|
16
16
|
return operation;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/components/HDLKiosk/kernel/operations/sessionEpoch.ts
|
|
2
2
|
function createSessionEpochController(initialEpoch = 1) {
|
|
3
|
-
if (!Number.isSafeInteger(initialEpoch) || initialEpoch < 1) throw new Error("
|
|
3
|
+
if (!Number.isSafeInteger(initialEpoch) || initialEpoch < 1) throw new Error("Session epoch must be a positive integer");
|
|
4
4
|
let epoch = initialEpoch;
|
|
5
5
|
return Object.freeze({
|
|
6
6
|
current: () => epoch,
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { _objectSpread2 } from "../../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
|
|
1
2
|
//#region src/components/HDLKiosk/kernel/operations/types.ts
|
|
2
|
-
function
|
|
3
|
-
return Object.freeze(
|
|
3
|
+
function defineKernelOperationContract(contract) {
|
|
4
|
+
return Object.freeze(contract);
|
|
5
|
+
}
|
|
6
|
+
function bindKernelOperation(contract, handler) {
|
|
7
|
+
return Object.freeze(_objectSpread2(_objectSpread2({}, contract), handler));
|
|
4
8
|
}
|
|
5
9
|
//#endregion
|
|
6
|
-
export {
|
|
10
|
+
export { bindKernelOperation, defineKernelOperationContract };
|