@antelopejs/dms-automation 0.0.1
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/LICENSE +190 -0
- package/README.md +95 -0
- package/dist/cluster/bus.d.ts +17 -0
- package/dist/cluster/bus.js +82 -0
- package/dist/cluster/bus.js.map +1 -0
- package/dist/cluster/instance.d.ts +1 -0
- package/dist/cluster/instance.js +6 -0
- package/dist/cluster/instance.js.map +1 -0
- package/dist/cluster/leader.d.ts +7 -0
- package/dist/cluster/leader.js +123 -0
- package/dist/cluster/leader.js.map +1 -0
- package/dist/cluster/mode.d.ts +3 -0
- package/dist/cluster/mode.js +25 -0
- package/dist/cluster/mode.js.map +1 -0
- package/dist/data/procedures-table.d.ts +66 -0
- package/dist/data/procedures-table.js +271 -0
- package/dist/data/procedures-table.js.map +1 -0
- package/dist/data/runs-table.d.ts +23 -0
- package/dist/data/runs-table.js +125 -0
- package/dist/data/runs-table.js.map +1 -0
- package/dist/db/index.d.ts +7 -0
- package/dist/db/index.js +24 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/models/automation_template.model.d.ts +58 -0
- package/dist/db/models/automation_template.model.js +134 -0
- package/dist/db/models/automation_template.model.js.map +1 -0
- package/dist/db/models/index.d.ts +3 -0
- package/dist/db/models/index.js +20 -0
- package/dist/db/models/index.js.map +1 -0
- package/dist/db/models/procedure.model.d.ts +25 -0
- package/dist/db/models/procedure.model.js +28 -0
- package/dist/db/models/procedure.model.js.map +1 -0
- package/dist/db/models/procedure_run.model.d.ts +34 -0
- package/dist/db/models/procedure_run.model.js +39 -0
- package/dist/db/models/procedure_run.model.js.map +1 -0
- package/dist/db/models/stats.model.d.ts +73 -0
- package/dist/db/models/stats.model.js +267 -0
- package/dist/db/models/stats.model.js.map +1 -0
- package/dist/db/models/type_config.model.d.ts +47 -0
- package/dist/db/models/type_config.model.js +51 -0
- package/dist/db/models/type_config.model.js.map +1 -0
- package/dist/db/tables/action_type_config.table.d.ts +7 -0
- package/dist/db/tables/action_type_config.table.js +35 -0
- package/dist/db/tables/action_type_config.table.js.map +1 -0
- package/dist/db/tables/automation_template.table.d.ts +11 -0
- package/dist/db/tables/automation_template.table.js +52 -0
- package/dist/db/tables/automation_template.table.js.map +1 -0
- package/dist/db/tables/index.d.ts +5 -0
- package/dist/db/tables/index.js +22 -0
- package/dist/db/tables/index.js.map +1 -0
- package/dist/db/tables/procedure.table.d.ts +10 -0
- package/dist/db/tables/procedure.table.js +48 -0
- package/dist/db/tables/procedure.table.js.map +1 -0
- package/dist/db/tables/procedure_run.table.d.ts +13 -0
- package/dist/db/tables/procedure_run.table.js +57 -0
- package/dist/db/tables/procedure_run.table.js.map +1 -0
- package/dist/db/tables/trigger_type_config.table.d.ts +7 -0
- package/dist/db/tables/trigger_type_config.table.js +35 -0
- package/dist/db/tables/trigger_type_config.table.js.map +1 -0
- package/dist/implementations/dms-automation/index.d.ts +19 -0
- package/dist/implementations/dms-automation/index.js +50 -0
- package/dist/implementations/dms-automation/index.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +121 -0
- package/dist/index.js.map +1 -0
- package/dist/pages/builder.d.ts +10 -0
- package/dist/pages/builder.js +28 -0
- package/dist/pages/builder.js.map +1 -0
- package/dist/pages/category.d.ts +1 -0
- package/dist/pages/category.js +10 -0
- package/dist/pages/category.js.map +1 -0
- package/dist/pages/index.d.ts +6 -0
- package/dist/pages/index.js +9 -0
- package/dist/pages/index.js.map +1 -0
- package/dist/pages/library.d.ts +10 -0
- package/dist/pages/library.js +28 -0
- package/dist/pages/library.js.map +1 -0
- package/dist/pages/overview.d.ts +10 -0
- package/dist/pages/overview.js +28 -0
- package/dist/pages/overview.js.map +1 -0
- package/dist/pages/procedures.d.ts +10 -0
- package/dist/pages/procedures.js +72 -0
- package/dist/pages/procedures.js.map +1 -0
- package/dist/pages/runs.d.ts +11 -0
- package/dist/pages/runs.js +61 -0
- package/dist/pages/runs.js.map +1 -0
- package/dist/routes/action-types.d.ts +23 -0
- package/dist/routes/action-types.js +80 -0
- package/dist/routes/action-types.js.map +1 -0
- package/dist/routes/data-node-types.d.ts +6 -0
- package/dist/routes/data-node-types.js +36 -0
- package/dist/routes/data-node-types.js.map +1 -0
- package/dist/routes/graphSchema.d.ts +92 -0
- package/dist/routes/graphSchema.js +60 -0
- package/dist/routes/graphSchema.js.map +1 -0
- package/dist/routes/index.d.ts +8 -0
- package/dist/routes/index.js +11 -0
- package/dist/routes/index.js.map +1 -0
- package/dist/routes/node-kinds.d.ts +9 -0
- package/dist/routes/node-kinds.js +35 -0
- package/dist/routes/node-kinds.js.map +1 -0
- package/dist/routes/procedures.d.ts +23 -0
- package/dist/routes/procedures.js +181 -0
- package/dist/routes/procedures.js.map +1 -0
- package/dist/routes/runs.d.ts +7 -0
- package/dist/routes/runs.js +81 -0
- package/dist/routes/runs.js.map +1 -0
- package/dist/routes/stats.d.ts +6 -0
- package/dist/routes/stats.js +35 -0
- package/dist/routes/stats.js.map +1 -0
- package/dist/routes/templates.d.ts +20 -0
- package/dist/routes/templates.js +243 -0
- package/dist/routes/templates.js.map +1 -0
- package/dist/routes/trigger-types.d.ts +24 -0
- package/dist/routes/trigger-types.js +80 -0
- package/dist/routes/trigger-types.js.map +1 -0
- package/dist/routes/typeConfigShared.d.ts +22 -0
- package/dist/routes/typeConfigShared.js +37 -0
- package/dist/routes/typeConfigShared.js.map +1 -0
- package/dist/runtime/builtins/actions/http.d.ts +13 -0
- package/dist/runtime/builtins/actions/http.js +47 -0
- package/dist/runtime/builtins/actions/http.js.map +1 -0
- package/dist/runtime/builtins/actions/index.d.ts +2 -0
- package/dist/runtime/builtins/actions/index.js +7 -0
- package/dist/runtime/builtins/actions/index.js.map +1 -0
- package/dist/runtime/builtins/actions/log.d.ts +13 -0
- package/dist/runtime/builtins/actions/log.js +49 -0
- package/dist/runtime/builtins/actions/log.js.map +1 -0
- package/dist/runtime/builtins/data/boolean.d.ts +2 -0
- package/dist/runtime/builtins/data/boolean.js +39 -0
- package/dist/runtime/builtins/data/boolean.js.map +1 -0
- package/dist/runtime/builtins/data/compare.d.ts +2 -0
- package/dist/runtime/builtins/data/compare.js +29 -0
- package/dist/runtime/builtins/data/compare.js.map +1 -0
- package/dist/runtime/builtins/data/constant.d.ts +2 -0
- package/dist/runtime/builtins/data/constant.js +29 -0
- package/dist/runtime/builtins/data/constant.js.map +1 -0
- package/dist/runtime/builtins/data/index.d.ts +2 -0
- package/dist/runtime/builtins/data/index.js +20 -0
- package/dist/runtime/builtins/data/index.js.map +1 -0
- package/dist/runtime/builtins/data/json.d.ts +2 -0
- package/dist/runtime/builtins/data/json.js +46 -0
- package/dist/runtime/builtins/data/json.js.map +1 -0
- package/dist/runtime/builtins/data/math.d.ts +2 -0
- package/dist/runtime/builtins/data/math.js +53 -0
- package/dist/runtime/builtins/data/math.js.map +1 -0
- package/dist/runtime/builtins/data/object.d.ts +2 -0
- package/dist/runtime/builtins/data/object.js +121 -0
- package/dist/runtime/builtins/data/object.js.map +1 -0
- package/dist/runtime/builtins/data/string.d.ts +2 -0
- package/dist/runtime/builtins/data/string.js +143 -0
- package/dist/runtime/builtins/data/string.js.map +1 -0
- package/dist/runtime/builtins/index.d.ts +17 -0
- package/dist/runtime/builtins/index.js +24 -0
- package/dist/runtime/builtins/index.js.map +1 -0
- package/dist/runtime/builtins/nodes/action.d.ts +1 -0
- package/dist/runtime/builtins/nodes/action.js +36 -0
- package/dist/runtime/builtins/nodes/action.js.map +1 -0
- package/dist/runtime/builtins/nodes/data.d.ts +1 -0
- package/dist/runtime/builtins/nodes/data.js +28 -0
- package/dist/runtime/builtins/nodes/data.js.map +1 -0
- package/dist/runtime/builtins/nodes/delay.d.ts +1 -0
- package/dist/runtime/builtins/nodes/delay.js +41 -0
- package/dist/runtime/builtins/nodes/delay.js.map +1 -0
- package/dist/runtime/builtins/nodes/forRange.d.ts +1 -0
- package/dist/runtime/builtins/nodes/forRange.js +52 -0
- package/dist/runtime/builtins/nodes/forRange.js.map +1 -0
- package/dist/runtime/builtins/nodes/foreach.d.ts +1 -0
- package/dist/runtime/builtins/nodes/foreach.js +31 -0
- package/dist/runtime/builtins/nodes/foreach.js.map +1 -0
- package/dist/runtime/builtins/nodes/groupInput.d.ts +1 -0
- package/dist/runtime/builtins/nodes/groupInput.js +11 -0
- package/dist/runtime/builtins/nodes/groupInput.js.map +1 -0
- package/dist/runtime/builtins/nodes/groupOutput.d.ts +1 -0
- package/dist/runtime/builtins/nodes/groupOutput.js +11 -0
- package/dist/runtime/builtins/nodes/groupOutput.js.map +1 -0
- package/dist/runtime/builtins/nodes/if.d.ts +1 -0
- package/dist/runtime/builtins/nodes/if.js +23 -0
- package/dist/runtime/builtins/nodes/if.js.map +1 -0
- package/dist/runtime/builtins/nodes/parallel.d.ts +1 -0
- package/dist/runtime/builtins/nodes/parallel.js +34 -0
- package/dist/runtime/builtins/nodes/parallel.js.map +1 -0
- package/dist/runtime/builtins/nodes/retry.d.ts +1 -0
- package/dist/runtime/builtins/nodes/retry.js +46 -0
- package/dist/runtime/builtins/nodes/retry.js.map +1 -0
- package/dist/runtime/builtins/nodes/setVariable.d.ts +1 -0
- package/dist/runtime/builtins/nodes/setVariable.js +31 -0
- package/dist/runtime/builtins/nodes/setVariable.js.map +1 -0
- package/dist/runtime/builtins/nodes/switch.d.ts +1 -0
- package/dist/runtime/builtins/nodes/switch.js +33 -0
- package/dist/runtime/builtins/nodes/switch.js.map +1 -0
- package/dist/runtime/builtins/nodes/trigger.d.ts +1 -0
- package/dist/runtime/builtins/nodes/trigger.js +25 -0
- package/dist/runtime/builtins/nodes/trigger.js.map +1 -0
- package/dist/runtime/builtins/nodes/tryCatch.d.ts +1 -0
- package/dist/runtime/builtins/nodes/tryCatch.js +35 -0
- package/dist/runtime/builtins/nodes/tryCatch.js.map +1 -0
- package/dist/runtime/builtins/triggers/cron.d.ts +9 -0
- package/dist/runtime/builtins/triggers/cron.js +52 -0
- package/dist/runtime/builtins/triggers/cron.js.map +1 -0
- package/dist/runtime/builtins/triggers/index.d.ts +2 -0
- package/dist/runtime/builtins/triggers/index.js +12 -0
- package/dist/runtime/builtins/triggers/index.js.map +1 -0
- package/dist/runtime/builtins/triggers/manual.d.ts +3 -0
- package/dist/runtime/builtins/triggers/manual.js +20 -0
- package/dist/runtime/builtins/triggers/manual.js.map +1 -0
- package/dist/runtime/builtins/triggers/webhook.d.ts +14 -0
- package/dist/runtime/builtins/triggers/webhook.js +90 -0
- package/dist/runtime/builtins/triggers/webhook.js.map +1 -0
- package/dist/runtime/executionResult.d.ts +6 -0
- package/dist/runtime/executionResult.js +3 -0
- package/dist/runtime/executionResult.js.map +1 -0
- package/dist/runtime/executor.d.ts +9 -0
- package/dist/runtime/executor.js +300 -0
- package/dist/runtime/executor.js.map +1 -0
- package/dist/runtime/flatten.d.ts +3 -0
- package/dist/runtime/flatten.js +188 -0
- package/dist/runtime/flatten.js.map +1 -0
- package/dist/runtime/nodeKinds.d.ts +64 -0
- package/dist/runtime/nodeKinds.js +43 -0
- package/dist/runtime/nodeKinds.js.map +1 -0
- package/dist/runtime/reconcileDiff.d.ts +9 -0
- package/dist/runtime/reconcileDiff.js +26 -0
- package/dist/runtime/reconcileDiff.js.map +1 -0
- package/dist/runtime/registry.d.ts +19 -0
- package/dist/runtime/registry.js +47 -0
- package/dist/runtime/registry.js.map +1 -0
- package/dist/runtime/resolveInputs.d.ts +14 -0
- package/dist/runtime/resolveInputs.js +64 -0
- package/dist/runtime/resolveInputs.js.map +1 -0
- package/dist/runtime/resolveSubgraph.d.ts +7 -0
- package/dist/runtime/resolveSubgraph.js +15 -0
- package/dist/runtime/resolveSubgraph.js.map +1 -0
- package/dist/runtime/subscriptions.d.ts +16 -0
- package/dist/runtime/subscriptions.js +419 -0
- package/dist/runtime/subscriptions.js.map +1 -0
- package/dist/runtime/subwalk.d.ts +17 -0
- package/dist/runtime/subwalk.js +74 -0
- package/dist/runtime/subwalk.js.map +1 -0
- package/dist/runtime/topo.d.ts +3 -0
- package/dist/runtime/topo.js +75 -0
- package/dist/runtime/topo.js.map +1 -0
- package/dist/runtime/typeOrigin.d.ts +7 -0
- package/dist/runtime/typeOrigin.js +24 -0
- package/dist/runtime/typeOrigin.js.map +1 -0
- package/dist/runtime/validate.d.ts +10 -0
- package/dist/runtime/validate.js +185 -0
- package/dist/runtime/validate.js.map +1 -0
- package/dist/runtime/validateTemplate.d.ts +3 -0
- package/dist/runtime/validateTemplate.js +54 -0
- package/dist/runtime/validateTemplate.js.map +1 -0
- package/dist/types/constants.d.ts +6 -0
- package/dist/types/constants.js +10 -0
- package/dist/types/constants.js.map +1 -0
- package/dist/types/graph.d.ts +51 -0
- package/dist/types/graph.js +23 -0
- package/dist/types/graph.js.map +1 -0
- package/dist/types/pagination.d.ts +8 -0
- package/dist/types/pagination.js +3 -0
- package/dist/types/pagination.js.map +1 -0
- package/dist/types/runLog.d.ts +26 -0
- package/dist/types/runLog.js +3 -0
- package/dist/types/runLog.js.map +1 -0
- package/frontend-vue/.prettierignore +4 -0
- package/frontend-vue/app/components/Actions.vue +141 -0
- package/frontend-vue/app/components/Catalog/TypeConfigForm.vue +166 -0
- package/frontend-vue/app/components/Catalog/TypeList.vue +198 -0
- package/frontend-vue/app/components/DataNodes.vue +259 -0
- package/frontend-vue/app/components/Editor/BuilderPalette.vue +234 -0
- package/frontend-vue/app/components/Editor/GraphCanvas.vue +994 -0
- package/frontend-vue/app/components/Editor/GroupPortEditor.vue +289 -0
- package/frontend-vue/app/components/Editor/JsonField.vue +63 -0
- package/frontend-vue/app/components/Editor/NodeInspector.vue +356 -0
- package/frontend-vue/app/components/Editor/ProcedureList.vue +156 -0
- package/frontend-vue/app/components/Editor/RunsDrawer.vue +312 -0
- package/frontend-vue/app/components/Editor/WiredField.vue +42 -0
- package/frontend-vue/app/components/Editor/nodes/GenericNode.vue +161 -0
- package/frontend-vue/app/components/Editor/nodes/GroupInputNode.vue +19 -0
- package/frontend-vue/app/components/Editor/nodes/GroupNode.vue +200 -0
- package/frontend-vue/app/components/Editor/nodes/GroupOutputNode.vue +19 -0
- package/frontend-vue/app/components/Editor/nodes/GroupSentinel.vue +161 -0
- package/frontend-vue/app/components/Editor/nodes/styles.ts +53 -0
- package/frontend-vue/app/components/Editor.vue +2504 -0
- package/frontend-vue/app/components/Library.vue +67 -0
- package/frontend-vue/app/components/Overview.vue +503 -0
- package/frontend-vue/app/components/RunDetailDrawer.vue +165 -0
- package/frontend-vue/app/components/RunFireTree.vue +170 -0
- package/frontend-vue/app/components/RunTraceDrawer.vue +59 -0
- package/frontend-vue/app/components/RunsStats.vue +126 -0
- package/frontend-vue/app/components/RunsTimelineDisplay.vue +287 -0
- package/frontend-vue/app/components/Templates.vue +663 -0
- package/frontend-vue/app/components/Triggers.vue +137 -0
- package/frontend-vue/app/composables/useAutomationNodeKinds.ts +48 -0
- package/frontend-vue/app/composables/useAutomationRuns.ts +75 -0
- package/frontend-vue/app/composables/useGraphConnect.ts +542 -0
- package/frontend-vue/app/plugins/runs-timeline-display.client.ts +16 -0
- package/frontend-vue/app/utils/automation.ts +51 -0
- package/frontend-vue/dms.frontend.ts +26 -0
- package/frontend-vue/eslint.config.mjs +24 -0
- package/frontend-vue/i18n/locales/dms-automation-en-GB.json +369 -0
- package/frontend-vue/i18n/locales/dms-automation-fr-FR.json +369 -0
- package/frontend-vue/package.json +33 -0
- package/frontend-vue/pnpm-lock.yaml +6483 -0
- package/frontend-vue/pnpm-workspace.yaml +2 -0
- package/package.json +81 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright (c) 2025-present - AntelopeJS Team
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# @antelopejs/dms-automation
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
<a href="./LICENSE"><img alt="License" src="https://img.shields.io/badge/license-Apache--2.0-blue?style=for-the-badge&labelColor=000000"></a>
|
|
5
|
+
<a href="https://discord.gg/sjK28QHrA7"><img src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000" alt="Discord"></a>
|
|
6
|
+
<a href="https://antelopejs.com"><img src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000" alt="Documentation"></a>
|
|
7
|
+
</div>
|
|
8
|
+
|
|
9
|
+
AntelopeJS DMS module that provides a visual automation builder under `/module/automation`. Author procedures as node graphs (triggers, actions, data nodes), wire trigger and data edges, and run them in response to events such as cron schedules and webhooks.
|
|
10
|
+
|
|
11
|
+
## Vue frontend
|
|
12
|
+
|
|
13
|
+
The module registers `frontend-vue` through `AddFrontendModule` with the Vue 3 renderer. `dms.frontend.ts` registers the Automation components and the client-only timeline display plugin. The generated Inertia application discovers the English and French locale files, while the host DMS provides shared composables and UI components.
|
|
14
|
+
|
|
15
|
+
The playground uses the published DMS and Inertia frontend packages. To build or typecheck the module frontend directly, first generate an Inertia workspace, set `DMS_FRONTEND_WORKSPACE` to its absolute path, then run:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pnpm --dir frontend-vue build
|
|
19
|
+
pnpm --dir frontend-vue typecheck
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`pnpm test:frontend-registration` checks backend registration and configuration without starting database services or automation triggers.
|
|
23
|
+
|
|
24
|
+
## Interface
|
|
25
|
+
|
|
26
|
+
The public contract lives in a dedicated interface package,
|
|
27
|
+
[`@antelopejs/interface-dms-automation`](https://github.com/AntelopeJS/dms-automation/tree/main/packages/interface-dms-automation),
|
|
28
|
+
which this module `implements`. Any DMS module can declare its own automation nodes
|
|
29
|
+
(triggers, actions, data nodes) by depending on the interface package only — never on
|
|
30
|
+
this implementation module. Add it to `optionalDependencies` and call
|
|
31
|
+
`RegisterTriggerType` / `RegisterActionType` / `RegisterDataNodeType`; when
|
|
32
|
+
dms-automation is absent from the project the registrations are inert no-ops. See the
|
|
33
|
+
interface package README for the full guide and examples.
|
|
34
|
+
|
|
35
|
+
The builder's block palette groups each category by the module that registered its
|
|
36
|
+
entries: the built-ins shipped with dms-automation come first, unlabeled, followed by
|
|
37
|
+
one section per external module, labelled with the module's id as named in the
|
|
38
|
+
project's `antelope.config.ts`.
|
|
39
|
+
|
|
40
|
+
The interface package is released before dms-automation because the latter depends on
|
|
41
|
+
it. Both are published to npmjs from their own manually dispatched GitHub workflow:
|
|
42
|
+
run `Release DMS automation interface` first, then `Release DMS automation module`,
|
|
43
|
+
which refuses to run until the interface version wired as `workspace:*` is resolvable
|
|
44
|
+
on npmjs. Published package manifests replace the local `workspace:*` dependency with
|
|
45
|
+
the interface package version. Existing consumers of the old standalone interface must
|
|
46
|
+
move to `@antelopejs/interface-dms-automation` and update their `implements` or
|
|
47
|
+
optional-dependency wiring; no compatibility alias is provided.
|
|
48
|
+
|
|
49
|
+
## Clustering
|
|
50
|
+
|
|
51
|
+
By default dms-automation runs **standalone**: a single instance owns every trigger and there is nothing to configure.
|
|
52
|
+
|
|
53
|
+
To run multiple instances against shared state, wire `@antelopejs/interface-redis` in the consuming project's `antelope.config.ts` and start more than one instance. With Redis available the module coordinates the instances automatically — no per-instance config needed.
|
|
54
|
+
|
|
55
|
+
Mode resolution can be overridden with the optional `cluster.driver` config:
|
|
56
|
+
|
|
57
|
+
- `auto` (default) — use Redis if the `@antelopejs/interface-redis` interface is provided, otherwise run standalone.
|
|
58
|
+
- `redis` — force clustered mode; if the interface is absent it logs a warning and falls back to standalone.
|
|
59
|
+
- `memory` — force standalone mode even when Redis is wired.
|
|
60
|
+
|
|
61
|
+
### Firing semantics
|
|
62
|
+
|
|
63
|
+
Each trigger type declares how it behaves across a cluster:
|
|
64
|
+
|
|
65
|
+
- **`singleton`** (e.g. cron) — must fire exactly once cluster-wide. Only the elected leader activates it; followers stay idle. Leadership is a renewable Redis lock, so if the leader stops another instance takes over.
|
|
66
|
+
- **`replicated`** (e.g. webhook) — every instance activates it. The load balancer in front of the cluster already routes each incoming event to exactly one instance.
|
|
67
|
+
|
|
68
|
+
Procedure and template edits made on one instance propagate to the others over Redis pub/sub, so every instance reconciles its active triggers without a restart.
|
|
69
|
+
|
|
70
|
+
### Known limitations
|
|
71
|
+
|
|
72
|
+
Leadership uses a TTL'd Redis lock, so singleton triggers are **fire-once under
|
|
73
|
+
normal operation but not transactionally exactly-once** across leadership
|
|
74
|
+
changes. If a singleton trigger must never run twice, make its downstream effect
|
|
75
|
+
idempotent.
|
|
76
|
+
|
|
77
|
+
- **Missed occurrence on ungraceful leader death.** If the leader process dies without releasing its lock, a cron occurrence that falls inside the takeover window (up to the lock TTL, ≤30s) is missed; firing resumes once a new leader is elected. (A graceful shutdown releases the lock immediately, so this only applies to crashes/kills.)
|
|
78
|
+
- **Brief double-fire on handover.** When leadership moves, the new leader arms its singletons as soon as it acquires the lock, while the old leader only deactivates its copies on its next tick (≤ one tick interval) — or, for a stall/GC-pause longer than the lock TTL, after it notices it lost the lock. An occurrence landing in that overlap can fire on both. The window is bounded by the tick interval (and by the TTL for stalls), never unbounded.
|
|
79
|
+
- **No timeout on Redis itself.** Leader renewal and pub/sub ride the shared Redis client; a Redis server that accepts connections but stops responding (no command timeout configured) can stall a renew. The leader tolerates transient errors up to the TTL before stepping down, so this degrades to the missed-occurrence case rather than a hang.
|
|
80
|
+
- **Very slow promotion can self-evict.** When an instance wins the lock it activates its singletons before the renewal loop resumes; if that activation took longer than the lock TTL (≤30s) the lock could expire mid-promotion. Built-in trigger activation is sub-millisecond, so this only matters for a custom trigger whose `activate` blocks for tens of seconds — keep trigger `activate`/`deactivate` fast and non-blocking.
|
|
81
|
+
|
|
82
|
+
## Breaking changes in 0.0.1
|
|
83
|
+
|
|
84
|
+
This is the first release under the `@antelopejs` scope, renamed from the CMS
|
|
85
|
+
product. Every identifier that carried the old name moved with it, and there is
|
|
86
|
+
no compatibility path: a deployment is recreated from scratch, not migrated.
|
|
87
|
+
|
|
88
|
+
- Database `cms-automation` -> `dms-automation`, schema `cms_automation` ->
|
|
89
|
+
`dms_automation`. Existing collections are invisible to this version.
|
|
90
|
+
- Module config key `cmsAutomation` -> `dmsAutomation` in `antelope.config.ts`.
|
|
91
|
+
- Frontend i18n namespace `cms-automation-<locale>` -> `dms-automation-<locale>`;
|
|
92
|
+
a host overriding those keys has to rename its own entries.
|
|
93
|
+
- The contract lives in `@antelopejs/interface-dms-automation`, which this
|
|
94
|
+
module `implements`. Import it from there, never from the runtime package,
|
|
95
|
+
and note that `TriggerType` requires a `cluster` field.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type ChangeMessage = {
|
|
2
|
+
kind: "procedure";
|
|
3
|
+
} | {
|
|
4
|
+
kind: "template-change";
|
|
5
|
+
id: string;
|
|
6
|
+
} | {
|
|
7
|
+
kind: "template-delete";
|
|
8
|
+
id: string;
|
|
9
|
+
};
|
|
10
|
+
export type BusMessage = ChangeMessage & {
|
|
11
|
+
origin: string;
|
|
12
|
+
};
|
|
13
|
+
type Handler = (msg: BusMessage) => void;
|
|
14
|
+
export declare function start(handler: Handler): Promise<void>;
|
|
15
|
+
export declare function publish(msg: ChangeMessage): Promise<void>;
|
|
16
|
+
export declare function close(): Promise<void>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.start = start;
|
|
4
|
+
exports.publish = publish;
|
|
5
|
+
exports.close = close;
|
|
6
|
+
const logging_1 = require("@antelopejs/interface-core/logging");
|
|
7
|
+
const interface_redis_1 = require("@antelopejs/interface-redis");
|
|
8
|
+
const instance_1 = require("./instance");
|
|
9
|
+
const CHANNEL = "dms-automation:reconcile";
|
|
10
|
+
function isBusMessage(value) {
|
|
11
|
+
if (!value || typeof value !== "object")
|
|
12
|
+
return false;
|
|
13
|
+
const m = value;
|
|
14
|
+
if (typeof m.origin !== "string")
|
|
15
|
+
return false;
|
|
16
|
+
if (m.kind === "procedure")
|
|
17
|
+
return true;
|
|
18
|
+
if (m.kind === "template-change" || m.kind === "template-delete") {
|
|
19
|
+
return typeof m.id === "string";
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
let publisher;
|
|
24
|
+
let subscriber;
|
|
25
|
+
let started = false;
|
|
26
|
+
async function start(handler) {
|
|
27
|
+
if (started)
|
|
28
|
+
return;
|
|
29
|
+
started = true;
|
|
30
|
+
let sub;
|
|
31
|
+
try {
|
|
32
|
+
const client = await (0, interface_redis_1.GetClient)();
|
|
33
|
+
sub = client.duplicate();
|
|
34
|
+
sub.on("message", (_channel, raw) => {
|
|
35
|
+
try {
|
|
36
|
+
const msg = JSON.parse(raw);
|
|
37
|
+
if (!isBusMessage(msg)) {
|
|
38
|
+
logging_1.Logging.Error("[dms-automation] bus: malformed message dropped:", raw);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
handler(msg);
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
logging_1.Logging.Error("[dms-automation] bus: bad message dropped:", err);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
await sub.subscribe(CHANNEL);
|
|
48
|
+
publisher = client;
|
|
49
|
+
subscriber = sub;
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
started = false;
|
|
53
|
+
if (sub)
|
|
54
|
+
await sub.quit().catch(() => { });
|
|
55
|
+
throw err;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async function publish(msg) {
|
|
59
|
+
if (!started || !publisher)
|
|
60
|
+
return;
|
|
61
|
+
try {
|
|
62
|
+
await publisher.publish(CHANNEL, JSON.stringify({ ...msg, origin: instance_1.instanceId }));
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
logging_1.Logging.Error("[dms-automation] bus: publish failed (best-effort):", err);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async function close() {
|
|
69
|
+
if (subscriber) {
|
|
70
|
+
try {
|
|
71
|
+
await subscriber.unsubscribe(CHANNEL);
|
|
72
|
+
await subscriber.quit();
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
logging_1.Logging.Error("[dms-automation] bus: close failed:", err);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
publisher = undefined;
|
|
79
|
+
subscriber = undefined;
|
|
80
|
+
started = false;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=bus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bus.js","sourceRoot":"","sources":["../../src/cluster/bus.ts"],"names":[],"mappings":";;AAsCA,sBAmCC;AAGD,0BAUC;AAED,sBAYC;AApGD,gEAA6D;AAC7D,iEAAwD;AACxD,yCAAwC;AAIxC,MAAM,OAAO,GAAG,0BAA0B,CAAC;AAgB3C,SAAS,YAAY,CAAC,KAAc;IAClC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,CAAC,GAAG,KAAgC,CAAC;IAC3C,IAAI,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC/C,IAAI,CAAC,CAAC,IAAI,KAAK,WAAW;QAAE,OAAO,IAAI,CAAC;IACxC,IAAI,CAAC,CAAC,IAAI,KAAK,iBAAiB,IAAI,CAAC,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;QACjE,OAAO,OAAO,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAC;IAClC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,IAAI,SAAkC,CAAC;AACvC,IAAI,UAAmC,CAAC;AACxC,IAAI,OAAO,GAAG,KAAK,CAAC;AAGb,KAAK,UAAU,KAAK,CAAC,OAAgB;IAC1C,IAAI,OAAO;QAAE,OAAO;IAIpB,OAAO,GAAG,IAAI,CAAC;IACf,IAAI,GAA4B,CAAC;IACjC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,IAAA,2BAAS,GAAE,CAAC;QACjC,GAAG,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;QACzB,GAAG,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,QAAgB,EAAE,GAA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WAAW,CAAC,OAAO,CAAC,CAAC;YACtC,MAAM,UAAU,CAAC,IAAI,EAAE,CAAC;QAC1B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,iBAAO,CAAC,KAAK,CAAC,qCAAqC,EAAE,GAAG,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC;IACD,SAAS,GAAG,SAAS,CAAC;IACtB,UAAU,GAAG,SAAS,CAAC;IACvB,OAAO,GAAG,KAAK,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const instanceId: `${string}-${string}-${string}-${string}-${string}`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instance.js","sourceRoot":"","sources":["../../src/cluster/instance.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAG5B,QAAA,UAAU,GAAG,IAAA,wBAAU,GAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface LeaderTransitions {
|
|
2
|
+
onBecameLeader(): Promise<void>;
|
|
3
|
+
onLostLeadership(): Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
export declare function isLeader(): boolean;
|
|
6
|
+
export declare function start(t: LeaderTransitions): Promise<void>;
|
|
7
|
+
export declare function stop(): Promise<void>;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isLeader = isLeader;
|
|
4
|
+
exports.start = start;
|
|
5
|
+
exports.stop = stop;
|
|
6
|
+
const logging_1 = require("@antelopejs/interface-core/logging");
|
|
7
|
+
const interface_redis_1 = require("@antelopejs/interface-redis");
|
|
8
|
+
const instance_1 = require("./instance");
|
|
9
|
+
const LOCK_KEY = "dms-automation:leader";
|
|
10
|
+
const TTL_MS = 30_000;
|
|
11
|
+
const TICK_MS = TTL_MS / 3;
|
|
12
|
+
const SHUTDOWN_GRACE_MS = 5_000;
|
|
13
|
+
const RENEW_LUA = "if redis.call('get', KEYS[1]) == ARGV[1] then return redis.call('pexpire', KEYS[1], ARGV[2]) else return 0 end";
|
|
14
|
+
const RELEASE_LUA = "if redis.call('get', KEYS[1]) == ARGV[1] then return redis.call('del', KEYS[1]) else return 0 end";
|
|
15
|
+
let client;
|
|
16
|
+
let timer;
|
|
17
|
+
let holdsLock = false;
|
|
18
|
+
let transitions;
|
|
19
|
+
let ticking = false;
|
|
20
|
+
let currentTick;
|
|
21
|
+
let lastHeldAt = 0;
|
|
22
|
+
function isLeader() {
|
|
23
|
+
return holdsLock;
|
|
24
|
+
}
|
|
25
|
+
async function stepDown() {
|
|
26
|
+
holdsLock = false;
|
|
27
|
+
try {
|
|
28
|
+
await transitions?.onLostLeadership();
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
logging_1.Logging.Error("[dms-automation] leader: onLostLeadership failed:", err);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async function release() {
|
|
35
|
+
if (!client)
|
|
36
|
+
return;
|
|
37
|
+
try {
|
|
38
|
+
await client.eval(RELEASE_LUA, 1, LOCK_KEY, instance_1.instanceId);
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
logging_1.Logging.Error("[dms-automation] leader: release failed:", err);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async function promote(t) {
|
|
45
|
+
holdsLock = true;
|
|
46
|
+
lastHeldAt = Date.now();
|
|
47
|
+
try {
|
|
48
|
+
await t.onBecameLeader();
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
logging_1.Logging.Error("[dms-automation] leader: promotion failed, releasing lock:", err);
|
|
52
|
+
holdsLock = false;
|
|
53
|
+
await release();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async function tick() {
|
|
57
|
+
if (!client || !transitions || ticking)
|
|
58
|
+
return;
|
|
59
|
+
const t = transitions;
|
|
60
|
+
ticking = true;
|
|
61
|
+
try {
|
|
62
|
+
if (holdsLock) {
|
|
63
|
+
const renewed = Number(await client.eval(RENEW_LUA, 1, LOCK_KEY, instance_1.instanceId, String(TTL_MS)));
|
|
64
|
+
if (renewed === 0)
|
|
65
|
+
await stepDown();
|
|
66
|
+
else
|
|
67
|
+
lastHeldAt = Date.now();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if ((await client.set(LOCK_KEY, instance_1.instanceId, "PX", TTL_MS, "NX")) === "OK") {
|
|
71
|
+
await promote(t);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
logging_1.Logging.Error("[dms-automation] leader: tick failed:", err);
|
|
76
|
+
if (holdsLock && Date.now() - lastHeldAt > TTL_MS)
|
|
77
|
+
await stepDown();
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
ticking = false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function runTick() {
|
|
84
|
+
if (ticking)
|
|
85
|
+
return;
|
|
86
|
+
const p = tick().finally(() => {
|
|
87
|
+
if (currentTick === p)
|
|
88
|
+
currentTick = undefined;
|
|
89
|
+
});
|
|
90
|
+
currentTick = p;
|
|
91
|
+
}
|
|
92
|
+
async function start(t) {
|
|
93
|
+
if (timer)
|
|
94
|
+
return;
|
|
95
|
+
transitions = t;
|
|
96
|
+
client = await (0, interface_redis_1.GetClient)();
|
|
97
|
+
runTick();
|
|
98
|
+
timer = setInterval(runTick, TICK_MS);
|
|
99
|
+
}
|
|
100
|
+
async function stop() {
|
|
101
|
+
if (timer) {
|
|
102
|
+
clearInterval(timer);
|
|
103
|
+
timer = undefined;
|
|
104
|
+
}
|
|
105
|
+
if (currentTick) {
|
|
106
|
+
let graceTimer;
|
|
107
|
+
const grace = new Promise((resolve) => {
|
|
108
|
+
graceTimer = setTimeout(resolve, SHUTDOWN_GRACE_MS);
|
|
109
|
+
graceTimer.unref?.();
|
|
110
|
+
});
|
|
111
|
+
await Promise.race([currentTick, grace]);
|
|
112
|
+
if (graceTimer)
|
|
113
|
+
clearTimeout(graceTimer);
|
|
114
|
+
}
|
|
115
|
+
if (holdsLock) {
|
|
116
|
+
await release();
|
|
117
|
+
}
|
|
118
|
+
holdsLock = false;
|
|
119
|
+
ticking = false;
|
|
120
|
+
client = undefined;
|
|
121
|
+
transitions = undefined;
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=leader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"leader.js","sourceRoot":"","sources":["../../src/cluster/leader.ts"],"names":[],"mappings":";;AA2CA,4BAEC;AAqFD,sBASC;AAGD,oBAuBC;AArKD,gEAA6D;AAC7D,iEAAwD;AACxD,yCAAwC;AAIxC,MAAM,QAAQ,GAAG,uBAAuB,CAAC;AACzC,MAAM,MAAM,GAAG,MAAM,CAAC;AACtB,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,CAAC;AAG3B,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAGhC,MAAM,SAAS,GACb,gHAAgH,CAAC;AAEnH,MAAM,WAAW,GACf,mGAAmG,CAAC;AAOtG,IAAI,MAA+B,CAAC;AACpC,IAAI,KAAiC,CAAC;AAItC,IAAI,SAAS,GAAG,KAAK,CAAC;AACtB,IAAI,WAA0C,CAAC;AAC/C,IAAI,OAAO,GAAG,KAAK,CAAC;AAGpB,IAAI,WAAsC,CAAC;AAK3C,IAAI,UAAU,GAAG,CAAC,CAAC;AAGnB,SAAgB,QAAQ;IACtB,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,KAAK,UAAU,QAAQ;IACrB,SAAS,GAAG,KAAK,CAAC;IAElB,IAAI,CAAC;QACH,MAAM,WAAW,EAAE,gBAAgB,EAAE,CAAC;IACxC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,iBAAO,CAAC,KAAK,CAAC,mDAAmD,EAAE,GAAG,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC;AAKD,KAAK,UAAU,OAAO;IACpB,IAAI,CAAC,MAAM;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AAM,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;QACzC,IAAI,UAAU;YAAE,YAAY,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;IACD,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,OAAO,EAAE,CAAC;IAClB,CAAC;IACD,SAAS,GAAG,KAAK,CAAC;IAClB,OAAO,GAAG,KAAK,CAAC;IAChB,MAAM,GAAG,SAAS,CAAC;IACnB,WAAW,GAAG,SAAS,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveClusterMode = resolveClusterMode;
|
|
4
|
+
const interface_core_1 = require("@antelopejs/interface-core");
|
|
5
|
+
const logging_1 = require("@antelopejs/interface-core/logging");
|
|
6
|
+
const REDIS_INTERFACE_ID = "@antelopejs/interface-redis";
|
|
7
|
+
function redisAvailable() {
|
|
8
|
+
try {
|
|
9
|
+
return (0, interface_core_1.GetInterfaceInstances)(REDIS_INTERFACE_ID).length > 0;
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function resolveClusterMode(driver = "auto") {
|
|
16
|
+
if (driver === "memory")
|
|
17
|
+
return "memory";
|
|
18
|
+
const available = redisAvailable();
|
|
19
|
+
if (driver === "redis" && !available) {
|
|
20
|
+
logging_1.Logging.Warn("[dms-automation] cluster.driver=redis but @antelopejs/interface-redis is not provided; falling back to standalone (memory) mode");
|
|
21
|
+
return "memory";
|
|
22
|
+
}
|
|
23
|
+
return available ? "redis" : "memory";
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mode.js","sourceRoot":"","sources":["../../src/cluster/mode.ts"],"names":[],"mappings":";;AAsBA,gDAYC;AAlCD,+DAAmE;AACnE,gEAA6D;AAK7D,MAAM,kBAAkB,GAAG,6BAA6B,CAAC;AAEzD,SAAS,cAAc;IACrB,IAAI,CAAC;QACH,OAAO,IAAA,sCAAqB,EAAC,kBAAkB,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IAC9D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAQD,SAAgB,kBAAkB,CAChC,SAAwB,MAAM;IAE9B,IAAI,MAAM,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC;IACzC,MAAM,SAAS,GAAG,cAAc,EAAE,CAAC;IACnC,IAAI,MAAM,KAAK,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC;QACrC,iBAAO,CAAC,IAAI,CACV,iIAAiI,CAClI,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,OAAO,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { User } from "@antelopejs/interface-dms/auth/db";
|
|
2
|
+
import { ProcedureModel } from "../db/models/procedure.model";
|
|
3
|
+
import { type ProcedureSummaryRow } from "../db/models/stats.model";
|
|
4
|
+
import { Procedure } from "../db/tables/procedure.table";
|
|
5
|
+
declare const ProceduresTableAPI_base: import("@antelopejs/interface-core/decorators").Class<import("@antelopejs/interface-data-api").ExtractDefCallbacks<{
|
|
6
|
+
select: {
|
|
7
|
+
method: string;
|
|
8
|
+
args: (import("@antelopejs/interface-core/decorators").PropertyDecorator & import("@antelopejs/interface-core/decorators").ParameterDecorator)[];
|
|
9
|
+
func: (_user: User, search?: string, offset?: string, limit?: string) => Promise<{
|
|
10
|
+
results: {
|
|
11
|
+
procedureId: string;
|
|
12
|
+
name: string;
|
|
13
|
+
}[];
|
|
14
|
+
total: number;
|
|
15
|
+
offset: number;
|
|
16
|
+
limit: number;
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
19
|
+
get: {
|
|
20
|
+
method: string;
|
|
21
|
+
args: (import("@antelopejs/interface-core/decorators").PropertyDecorator & import("@antelopejs/interface-core/decorators").ParameterDecorator)[];
|
|
22
|
+
func: (_user: User, params: {
|
|
23
|
+
id: string;
|
|
24
|
+
}) => Promise<ProcedureSummaryRow>;
|
|
25
|
+
};
|
|
26
|
+
list: {
|
|
27
|
+
method: string;
|
|
28
|
+
args: (import("@antelopejs/interface-core/decorators").PropertyDecorator & import("@antelopejs/interface-core/decorators").ParameterDecorator)[];
|
|
29
|
+
func: (_user: User, offset?: string, limit?: string, sortKey?: string, sortDirection?: string, search?: string, filterStatus?: string) => Promise<{
|
|
30
|
+
results: ProcedureSummaryRow[];
|
|
31
|
+
total: number;
|
|
32
|
+
offset: number;
|
|
33
|
+
limit: number;
|
|
34
|
+
}>;
|
|
35
|
+
};
|
|
36
|
+
count: {
|
|
37
|
+
method: string;
|
|
38
|
+
args: (import("@antelopejs/interface-core/decorators").PropertyDecorator & import("@antelopejs/interface-core/decorators").ParameterDecorator)[];
|
|
39
|
+
func: (_user: User, search?: string, filterStatus?: string) => Promise<{
|
|
40
|
+
total: number;
|
|
41
|
+
}>;
|
|
42
|
+
};
|
|
43
|
+
delete: {
|
|
44
|
+
method: string;
|
|
45
|
+
args: (import("@antelopejs/interface-core/decorators").PropertyDecorator & import("@antelopejs/interface-core/decorators").ParameterDecorator)[];
|
|
46
|
+
func: (_user: User, params: {
|
|
47
|
+
id: string | string[];
|
|
48
|
+
}) => Promise<number>;
|
|
49
|
+
};
|
|
50
|
+
}> & {
|
|
51
|
+
table: Procedure;
|
|
52
|
+
}> & import("@antelopejs/interface-core/decorators").Class<object> & {
|
|
53
|
+
extend: <T extends import("@antelopejs/interface-api").ControllerClass>(this: T, location: string) => T;
|
|
54
|
+
location: string;
|
|
55
|
+
};
|
|
56
|
+
export declare class ProceduresTableAPI extends ProceduresTableAPI_base {
|
|
57
|
+
model: ProcedureModel;
|
|
58
|
+
name: string;
|
|
59
|
+
trigger: string;
|
|
60
|
+
status: string;
|
|
61
|
+
lastRunAt: string;
|
|
62
|
+
successRate: number;
|
|
63
|
+
avgDurationMs: number;
|
|
64
|
+
runs: number;
|
|
65
|
+
}
|
|
66
|
+
export {};
|