@omega-flow/types 0.1.0

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) omega-flow contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,166 @@
1
+ import { Node, Edge } from '@xyflow/react';
2
+ export { Edge, Node } from '@xyflow/react';
3
+
4
+ interface WorkflowFrequency {
5
+ type: "one_time" | "every_rematch";
6
+ interval?: number;
7
+ }
8
+ interface WorkflowOptions {
9
+ frequency?: WorkflowFrequency;
10
+ [key: string]: any;
11
+ }
12
+ interface Workflow {
13
+ id: string;
14
+ name: string;
15
+ flow: {
16
+ nodes: Node[];
17
+ edges: Edge[];
18
+ };
19
+ options: WorkflowOptions;
20
+ }
21
+ declare enum WorkflowStatus {
22
+ Idle = "idle",
23
+ Waiting = "waiting",
24
+ Processing = "processing",
25
+ Transforming = "transforming",
26
+ Completed = "completed"
27
+ }
28
+ declare const WorkflowSchema: {
29
+ type: string;
30
+ required: string[];
31
+ properties: {
32
+ id: {
33
+ type: string;
34
+ };
35
+ flow: {
36
+ type: string;
37
+ required: string[];
38
+ properties: {
39
+ nodes: {
40
+ type: string;
41
+ minItems: number;
42
+ };
43
+ edges: {
44
+ type: string;
45
+ minItems: number;
46
+ };
47
+ };
48
+ };
49
+ options: {
50
+ type: string;
51
+ };
52
+ };
53
+ };
54
+
55
+ interface Event {
56
+ id: string;
57
+ time: number;
58
+ type: string;
59
+ data?: any;
60
+ }
61
+ declare const EventSchema: {
62
+ type: string;
63
+ required: string[];
64
+ properties: {
65
+ id: {
66
+ type: string;
67
+ };
68
+ time: {
69
+ type: string;
70
+ };
71
+ type: {
72
+ type: string;
73
+ };
74
+ data: {};
75
+ };
76
+ };
77
+
78
+ interface NodeState {
79
+ [key: string]: any;
80
+ }
81
+ interface WorkflowHistoryItem {
82
+ time: number;
83
+ type: "started" | "step" | "completed";
84
+ fromNodeId?: string | null;
85
+ toNodeId?: string | null;
86
+ }
87
+ interface Context {
88
+ workflowId: string;
89
+ instanceId: string;
90
+ currentNodeId: string | null;
91
+ nodeState: NodeState;
92
+ history: WorkflowHistoryItem[];
93
+ isCompleted?: boolean;
94
+ startedAt: number;
95
+ }
96
+ declare const ContextSchema: {
97
+ type: string;
98
+ required: string[];
99
+ properties: {
100
+ workflowId: {
101
+ type: string;
102
+ };
103
+ instanceId: {
104
+ type: string;
105
+ };
106
+ currentNodeId: {
107
+ type: string[];
108
+ };
109
+ nodeState: {
110
+ type: string;
111
+ };
112
+ history: {
113
+ type: string;
114
+ items: {
115
+ type: string;
116
+ required: string[];
117
+ properties: {
118
+ time: {
119
+ type: string;
120
+ };
121
+ type: {
122
+ type: string;
123
+ };
124
+ fromNodeId: {
125
+ type: string[];
126
+ };
127
+ toNodeId: {
128
+ type: string[];
129
+ };
130
+ };
131
+ };
132
+ };
133
+ isCompleted: {
134
+ type: string;
135
+ };
136
+ startedAt: {
137
+ type: string;
138
+ };
139
+ };
140
+ };
141
+
142
+ /**
143
+ * Condition format shared between the editor and the engine.
144
+ *
145
+ * Top level is implicitly OR between groups; each group is AND (`all`) or
146
+ * OR (`any`) of leaf rules. There is no deeper nesting.
147
+ */
148
+ type ConditionOperator = "equal" | "notEqual" | "greaterThan" | "greaterThanInclusive" | "lessThan" | "lessThanInclusive" | "in" | "notIn" | "contains" | "doesNotContain";
149
+ interface ConditionRule {
150
+ fact: string;
151
+ operator: ConditionOperator | string;
152
+ value: unknown;
153
+ }
154
+ interface ConditionGroup {
155
+ operator: "all" | "any";
156
+ conditions: ConditionRule[];
157
+ }
158
+ interface Conditions {
159
+ groups: ConditionGroup[];
160
+ }
161
+
162
+ declare function nodeHasType(node: Node): node is Node & {
163
+ type: string;
164
+ };
165
+
166
+ export { type ConditionGroup, type ConditionOperator, type ConditionRule, type Conditions, type Context, ContextSchema, type Event, EventSchema, type NodeState, type Workflow, type WorkflowFrequency, type WorkflowHistoryItem, type WorkflowOptions, WorkflowSchema, WorkflowStatus, nodeHasType };
@@ -0,0 +1,166 @@
1
+ import { Node, Edge } from '@xyflow/react';
2
+ export { Edge, Node } from '@xyflow/react';
3
+
4
+ interface WorkflowFrequency {
5
+ type: "one_time" | "every_rematch";
6
+ interval?: number;
7
+ }
8
+ interface WorkflowOptions {
9
+ frequency?: WorkflowFrequency;
10
+ [key: string]: any;
11
+ }
12
+ interface Workflow {
13
+ id: string;
14
+ name: string;
15
+ flow: {
16
+ nodes: Node[];
17
+ edges: Edge[];
18
+ };
19
+ options: WorkflowOptions;
20
+ }
21
+ declare enum WorkflowStatus {
22
+ Idle = "idle",
23
+ Waiting = "waiting",
24
+ Processing = "processing",
25
+ Transforming = "transforming",
26
+ Completed = "completed"
27
+ }
28
+ declare const WorkflowSchema: {
29
+ type: string;
30
+ required: string[];
31
+ properties: {
32
+ id: {
33
+ type: string;
34
+ };
35
+ flow: {
36
+ type: string;
37
+ required: string[];
38
+ properties: {
39
+ nodes: {
40
+ type: string;
41
+ minItems: number;
42
+ };
43
+ edges: {
44
+ type: string;
45
+ minItems: number;
46
+ };
47
+ };
48
+ };
49
+ options: {
50
+ type: string;
51
+ };
52
+ };
53
+ };
54
+
55
+ interface Event {
56
+ id: string;
57
+ time: number;
58
+ type: string;
59
+ data?: any;
60
+ }
61
+ declare const EventSchema: {
62
+ type: string;
63
+ required: string[];
64
+ properties: {
65
+ id: {
66
+ type: string;
67
+ };
68
+ time: {
69
+ type: string;
70
+ };
71
+ type: {
72
+ type: string;
73
+ };
74
+ data: {};
75
+ };
76
+ };
77
+
78
+ interface NodeState {
79
+ [key: string]: any;
80
+ }
81
+ interface WorkflowHistoryItem {
82
+ time: number;
83
+ type: "started" | "step" | "completed";
84
+ fromNodeId?: string | null;
85
+ toNodeId?: string | null;
86
+ }
87
+ interface Context {
88
+ workflowId: string;
89
+ instanceId: string;
90
+ currentNodeId: string | null;
91
+ nodeState: NodeState;
92
+ history: WorkflowHistoryItem[];
93
+ isCompleted?: boolean;
94
+ startedAt: number;
95
+ }
96
+ declare const ContextSchema: {
97
+ type: string;
98
+ required: string[];
99
+ properties: {
100
+ workflowId: {
101
+ type: string;
102
+ };
103
+ instanceId: {
104
+ type: string;
105
+ };
106
+ currentNodeId: {
107
+ type: string[];
108
+ };
109
+ nodeState: {
110
+ type: string;
111
+ };
112
+ history: {
113
+ type: string;
114
+ items: {
115
+ type: string;
116
+ required: string[];
117
+ properties: {
118
+ time: {
119
+ type: string;
120
+ };
121
+ type: {
122
+ type: string;
123
+ };
124
+ fromNodeId: {
125
+ type: string[];
126
+ };
127
+ toNodeId: {
128
+ type: string[];
129
+ };
130
+ };
131
+ };
132
+ };
133
+ isCompleted: {
134
+ type: string;
135
+ };
136
+ startedAt: {
137
+ type: string;
138
+ };
139
+ };
140
+ };
141
+
142
+ /**
143
+ * Condition format shared between the editor and the engine.
144
+ *
145
+ * Top level is implicitly OR between groups; each group is AND (`all`) or
146
+ * OR (`any`) of leaf rules. There is no deeper nesting.
147
+ */
148
+ type ConditionOperator = "equal" | "notEqual" | "greaterThan" | "greaterThanInclusive" | "lessThan" | "lessThanInclusive" | "in" | "notIn" | "contains" | "doesNotContain";
149
+ interface ConditionRule {
150
+ fact: string;
151
+ operator: ConditionOperator | string;
152
+ value: unknown;
153
+ }
154
+ interface ConditionGroup {
155
+ operator: "all" | "any";
156
+ conditions: ConditionRule[];
157
+ }
158
+ interface Conditions {
159
+ groups: ConditionGroup[];
160
+ }
161
+
162
+ declare function nodeHasType(node: Node): node is Node & {
163
+ type: string;
164
+ };
165
+
166
+ export { type ConditionGroup, type ConditionOperator, type ConditionRule, type Conditions, type Context, ContextSchema, type Event, EventSchema, type NodeState, type Workflow, type WorkflowFrequency, type WorkflowHistoryItem, type WorkflowOptions, WorkflowSchema, WorkflowStatus, nodeHasType };
package/dist/index.js ADDED
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ ContextSchema: () => ContextSchema,
24
+ EventSchema: () => EventSchema,
25
+ WorkflowSchema: () => WorkflowSchema,
26
+ WorkflowStatus: () => WorkflowStatus,
27
+ nodeHasType: () => nodeHasType
28
+ });
29
+ module.exports = __toCommonJS(index_exports);
30
+
31
+ // src/workflow.ts
32
+ var WorkflowStatus = /* @__PURE__ */ ((WorkflowStatus2) => {
33
+ WorkflowStatus2["Idle"] = "idle";
34
+ WorkflowStatus2["Waiting"] = "waiting";
35
+ WorkflowStatus2["Processing"] = "processing";
36
+ WorkflowStatus2["Transforming"] = "transforming";
37
+ WorkflowStatus2["Completed"] = "completed";
38
+ return WorkflowStatus2;
39
+ })(WorkflowStatus || {});
40
+ var WorkflowSchema = {
41
+ type: "object",
42
+ required: ["id", "flow", "options"],
43
+ properties: {
44
+ id: { type: "string" },
45
+ flow: {
46
+ type: "object",
47
+ required: ["nodes", "edges"],
48
+ properties: {
49
+ nodes: {
50
+ type: "array",
51
+ minItems: 1
52
+ },
53
+ edges: {
54
+ type: "array",
55
+ minItems: 0
56
+ }
57
+ }
58
+ },
59
+ options: { type: "object" }
60
+ }
61
+ };
62
+
63
+ // src/event.ts
64
+ var EventSchema = {
65
+ type: "object",
66
+ required: ["id", "time", "type"],
67
+ properties: {
68
+ id: { type: "string" },
69
+ time: { type: "number" },
70
+ type: { type: "string" },
71
+ data: {}
72
+ }
73
+ };
74
+
75
+ // src/context.ts
76
+ var ContextSchema = {
77
+ type: "object",
78
+ required: [
79
+ "workflowId",
80
+ "instanceId",
81
+ "currentNodeId",
82
+ "nodeState",
83
+ "history",
84
+ "startedAt"
85
+ ],
86
+ properties: {
87
+ workflowId: { type: "string" },
88
+ instanceId: { type: "string" },
89
+ currentNodeId: { type: ["string", "null"] },
90
+ nodeState: { type: "object" },
91
+ history: {
92
+ type: "array",
93
+ items: {
94
+ type: "object",
95
+ required: ["time", "type"],
96
+ properties: {
97
+ time: { type: "number" },
98
+ type: { type: "string" },
99
+ fromNodeId: { type: ["string", "null"] },
100
+ toNodeId: { type: ["string", "null"] }
101
+ }
102
+ }
103
+ },
104
+ isCompleted: { type: "boolean" },
105
+ startedAt: { type: "number" }
106
+ }
107
+ };
108
+
109
+ // src/index.ts
110
+ function nodeHasType(node) {
111
+ return node.type !== void 0;
112
+ }
113
+ // Annotate the CommonJS export names for ESM import in node:
114
+ 0 && (module.exports = {
115
+ ContextSchema,
116
+ EventSchema,
117
+ WorkflowSchema,
118
+ WorkflowStatus,
119
+ nodeHasType
120
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,89 @@
1
+ // src/workflow.ts
2
+ var WorkflowStatus = /* @__PURE__ */ ((WorkflowStatus2) => {
3
+ WorkflowStatus2["Idle"] = "idle";
4
+ WorkflowStatus2["Waiting"] = "waiting";
5
+ WorkflowStatus2["Processing"] = "processing";
6
+ WorkflowStatus2["Transforming"] = "transforming";
7
+ WorkflowStatus2["Completed"] = "completed";
8
+ return WorkflowStatus2;
9
+ })(WorkflowStatus || {});
10
+ var WorkflowSchema = {
11
+ type: "object",
12
+ required: ["id", "flow", "options"],
13
+ properties: {
14
+ id: { type: "string" },
15
+ flow: {
16
+ type: "object",
17
+ required: ["nodes", "edges"],
18
+ properties: {
19
+ nodes: {
20
+ type: "array",
21
+ minItems: 1
22
+ },
23
+ edges: {
24
+ type: "array",
25
+ minItems: 0
26
+ }
27
+ }
28
+ },
29
+ options: { type: "object" }
30
+ }
31
+ };
32
+
33
+ // src/event.ts
34
+ var EventSchema = {
35
+ type: "object",
36
+ required: ["id", "time", "type"],
37
+ properties: {
38
+ id: { type: "string" },
39
+ time: { type: "number" },
40
+ type: { type: "string" },
41
+ data: {}
42
+ }
43
+ };
44
+
45
+ // src/context.ts
46
+ var ContextSchema = {
47
+ type: "object",
48
+ required: [
49
+ "workflowId",
50
+ "instanceId",
51
+ "currentNodeId",
52
+ "nodeState",
53
+ "history",
54
+ "startedAt"
55
+ ],
56
+ properties: {
57
+ workflowId: { type: "string" },
58
+ instanceId: { type: "string" },
59
+ currentNodeId: { type: ["string", "null"] },
60
+ nodeState: { type: "object" },
61
+ history: {
62
+ type: "array",
63
+ items: {
64
+ type: "object",
65
+ required: ["time", "type"],
66
+ properties: {
67
+ time: { type: "number" },
68
+ type: { type: "string" },
69
+ fromNodeId: { type: ["string", "null"] },
70
+ toNodeId: { type: ["string", "null"] }
71
+ }
72
+ }
73
+ },
74
+ isCompleted: { type: "boolean" },
75
+ startedAt: { type: "number" }
76
+ }
77
+ };
78
+
79
+ // src/index.ts
80
+ function nodeHasType(node) {
81
+ return node.type !== void 0;
82
+ }
83
+ export {
84
+ ContextSchema,
85
+ EventSchema,
86
+ WorkflowSchema,
87
+ WorkflowStatus,
88
+ nodeHasType
89
+ };
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@omega-flow/types",
3
+ "version": "0.1.0",
4
+ "description": "Workflow types for Omega Flow",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.esm.js",
7
+ "types": "dist/index.d.ts",
8
+ "license": "MIT",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/omega-flow/omega-flow.git",
12
+ "directory": "packages/types"
13
+ },
14
+ "homepage": "https://omega-flow.github.io/omega-flow/",
15
+ "bugs": "https://github.com/omega-flow/omega-flow/issues",
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "devDependencies": {},
23
+ "dependencies": {
24
+ "@xyflow/react": "^12.10.0"
25
+ },
26
+ "scripts": {
27
+ "build": "tsup src/index.ts --format cjs,esm --dts",
28
+ "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
29
+ "test": "jest --passWithNoTests",
30
+ "test:coverage": "jest --coverage --passWithNoTests"
31
+ }
32
+ }