@loopstack/contracts 0.16.0 → 0.16.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/.github/workflows/publish-npm.yml +1 -1
- package/.husky/pre-commit +3 -0
- package/.prettierignore +15 -0
- package/dist/enums/registry.enum.d.ts +4 -7
- package/dist/enums/registry.enum.js +6 -12
- package/dist/schemas/document.schema.js +33 -48
- package/dist/schemas/json-schema.schema.js +6 -4
- package/dist/schemas/main.schema.js +3 -3
- package/dist/schemas/pipeline.schema.js +5 -10
- package/dist/schemas/startup.schema.js +19 -12
- package/dist/schemas/template-expression.schema.js +3 -1
- package/dist/schemas/tool-config.schema.js +1 -1
- package/dist/schemas/ui-form-element.schema.js +6 -4
- package/dist/schemas/ui-form.schema.js +9 -8
- package/dist/schemas/workflow-transition.schema.js +11 -10
- package/dist/schemas/workflow.schema.js +2 -2
- package/dist/types/interfaces/workflow.interface.d.ts +1 -1
- package/dist/types/types/json-schema-config.type.d.ts +1 -2
- package/dist/types/types/ui-properties.type.d.ts +1 -2
- package/eslint.config.mjs +21 -0
- package/package.json +23 -2
- package/prettier.config.mjs +19 -0
package/.prettierignore
ADDED
|
@@ -5,14 +5,11 @@ export declare enum RegistryEntryStatus {
|
|
|
5
5
|
INACTIVE = "inactive"
|
|
6
6
|
}
|
|
7
7
|
export declare enum RegistryEntryCategory {
|
|
8
|
-
FULL_AUTOMATIONS = "full-automations",
|
|
9
8
|
TOOLS = "tools",
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
INTEGRATIONS = "integrations",
|
|
15
|
-
AGENTS = "agents"
|
|
9
|
+
EXAMPLES = "examples",
|
|
10
|
+
BUNDLES = "bundles",
|
|
11
|
+
MODULES = "modules",
|
|
12
|
+
INTEGRATIONS = "integrations"
|
|
16
13
|
}
|
|
17
14
|
export type RegistryCategory = `${RegistryEntryCategory}`;
|
|
18
15
|
export declare const REGISTRY_CATEGORIES: RegistryCategory[];
|
|
@@ -10,22 +10,16 @@ var RegistryEntryStatus;
|
|
|
10
10
|
})(RegistryEntryStatus || (exports.RegistryEntryStatus = RegistryEntryStatus = {}));
|
|
11
11
|
var RegistryEntryCategory;
|
|
12
12
|
(function (RegistryEntryCategory) {
|
|
13
|
-
RegistryEntryCategory["FULL_AUTOMATIONS"] = "full-automations";
|
|
14
13
|
RegistryEntryCategory["TOOLS"] = "tools";
|
|
15
|
-
RegistryEntryCategory["
|
|
16
|
-
RegistryEntryCategory["
|
|
17
|
-
RegistryEntryCategory["
|
|
18
|
-
RegistryEntryCategory["STARTER_TEMPLATES"] = "starter-templates";
|
|
14
|
+
RegistryEntryCategory["EXAMPLES"] = "examples";
|
|
15
|
+
RegistryEntryCategory["BUNDLES"] = "bundles";
|
|
16
|
+
RegistryEntryCategory["MODULES"] = "modules";
|
|
19
17
|
RegistryEntryCategory["INTEGRATIONS"] = "integrations";
|
|
20
|
-
RegistryEntryCategory["AGENTS"] = "agents";
|
|
21
18
|
})(RegistryEntryCategory || (exports.RegistryEntryCategory = RegistryEntryCategory = {}));
|
|
22
19
|
exports.REGISTRY_CATEGORIES = [
|
|
23
|
-
RegistryEntryCategory.FULL_AUTOMATIONS,
|
|
24
20
|
RegistryEntryCategory.TOOLS,
|
|
25
|
-
RegistryEntryCategory.
|
|
26
|
-
RegistryEntryCategory.
|
|
27
|
-
RegistryEntryCategory.
|
|
28
|
-
RegistryEntryCategory.STARTER_TEMPLATES,
|
|
21
|
+
RegistryEntryCategory.EXAMPLES,
|
|
22
|
+
RegistryEntryCategory.BUNDLES,
|
|
23
|
+
RegistryEntryCategory.MODULES,
|
|
29
24
|
RegistryEntryCategory.INTEGRATIONS,
|
|
30
|
-
RegistryEntryCategory.AGENTS,
|
|
31
25
|
];
|
|
@@ -2,54 +2,40 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DocumentMessageSchema = exports.DocumentMessageContentSchema = exports.DocumentSchema = exports.DocumentConfigSchema = exports.MimeTypeSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const template_expression_schema_1 = require("./template-expression.schema");
|
|
6
5
|
const block_schema_1 = require("./block.schema");
|
|
6
|
+
const template_expression_schema_1 = require("./template-expression.schema");
|
|
7
7
|
const ui_form_schema_1 = require("./ui-form.schema");
|
|
8
8
|
exports.MimeTypeSchema = zod_1.z.enum([
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
'text/plain',
|
|
10
|
+
'text/html',
|
|
11
|
+
'text/css',
|
|
12
|
+
'text/xml',
|
|
13
|
+
'text/markdown',
|
|
14
|
+
'application/javascript',
|
|
15
|
+
'application/typescript',
|
|
16
|
+
'application/json',
|
|
17
|
+
'application/xml',
|
|
18
|
+
'application/yaml',
|
|
19
19
|
]);
|
|
20
20
|
exports.DocumentConfigSchema = block_schema_1.BlockSchema.extend({
|
|
21
21
|
type: zod_1.z.literal('document').default('document').optional(),
|
|
22
22
|
description: zod_1.z.string().optional(),
|
|
23
23
|
content: zod_1.z.any().optional(),
|
|
24
24
|
ui: ui_form_schema_1.UiFormSchema.optional(),
|
|
25
|
-
tags: zod_1.z.union([
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
template_expression_schema_1.TemplateExpression,
|
|
33
|
-
|
|
34
|
-
mimeType: zod_1.z.union([
|
|
35
|
-
exports.MimeTypeSchema,
|
|
36
|
-
template_expression_schema_1.TemplateExpression,
|
|
37
|
-
]).optional(),
|
|
38
|
-
invalidate: zod_1.z.union([
|
|
39
|
-
zod_1.z.boolean(),
|
|
40
|
-
template_expression_schema_1.TemplateExpression,
|
|
41
|
-
]).optional(),
|
|
42
|
-
level: zod_1.z.union([
|
|
43
|
-
template_expression_schema_1.TemplateExpression,
|
|
44
|
-
zod_1.z.literal('debug'),
|
|
45
|
-
zod_1.z.literal('info'),
|
|
46
|
-
zod_1.z.literal('warning'),
|
|
47
|
-
zod_1.z.literal('error'),
|
|
48
|
-
]).optional(),
|
|
25
|
+
tags: zod_1.z.union([template_expression_schema_1.TemplateExpression, zod_1.z.array(zod_1.z.string())]).optional(),
|
|
26
|
+
meta: zod_1.z
|
|
27
|
+
.object({
|
|
28
|
+
hidden: zod_1.z.union([zod_1.z.boolean(), template_expression_schema_1.TemplateExpression]).optional(),
|
|
29
|
+
mimeType: zod_1.z.union([exports.MimeTypeSchema, template_expression_schema_1.TemplateExpression]).optional(),
|
|
30
|
+
invalidate: zod_1.z.union([zod_1.z.boolean(), template_expression_schema_1.TemplateExpression]).optional(),
|
|
31
|
+
level: zod_1.z
|
|
32
|
+
.union([template_expression_schema_1.TemplateExpression, zod_1.z.literal('debug'), zod_1.z.literal('info'), zod_1.z.literal('warning'), zod_1.z.literal('error')])
|
|
33
|
+
.optional(),
|
|
49
34
|
enableAtPlaces: zod_1.z.array(zod_1.z.string()).optional(),
|
|
50
35
|
hideAtPlaces: zod_1.z.array(zod_1.z.string()).optional(),
|
|
51
36
|
data: zod_1.z.any().optional(),
|
|
52
|
-
})
|
|
37
|
+
})
|
|
38
|
+
.optional(),
|
|
53
39
|
});
|
|
54
40
|
exports.DocumentSchema = zod_1.z.object({
|
|
55
41
|
type: zod_1.z.literal('document').default('document').optional(),
|
|
@@ -57,32 +43,31 @@ exports.DocumentSchema = zod_1.z.object({
|
|
|
57
43
|
content: zod_1.z.any().optional(),
|
|
58
44
|
ui: ui_form_schema_1.UiFormSchema.optional(),
|
|
59
45
|
tags: zod_1.z.array(zod_1.z.string()).optional(),
|
|
60
|
-
meta: zod_1.z
|
|
46
|
+
meta: zod_1.z
|
|
47
|
+
.object({
|
|
61
48
|
hidden: zod_1.z.boolean().optional(),
|
|
62
49
|
mimeType: exports.MimeTypeSchema.optional(),
|
|
63
50
|
invalidate: zod_1.z.boolean().optional(),
|
|
64
|
-
level: zod_1.z.union([
|
|
65
|
-
zod_1.z.literal('debug'),
|
|
66
|
-
zod_1.z.literal('info'),
|
|
67
|
-
zod_1.z.literal('warning'),
|
|
68
|
-
zod_1.z.literal('error'),
|
|
69
|
-
]).optional(),
|
|
51
|
+
level: zod_1.z.union([zod_1.z.literal('debug'), zod_1.z.literal('info'), zod_1.z.literal('warning'), zod_1.z.literal('error')]).optional(),
|
|
70
52
|
enableAtPlaces: zod_1.z.array(zod_1.z.string()).optional(),
|
|
71
53
|
hideAtPlaces: zod_1.z.array(zod_1.z.string()).optional(),
|
|
72
54
|
data: zod_1.z.any().optional(),
|
|
73
|
-
})
|
|
55
|
+
})
|
|
56
|
+
.optional(),
|
|
74
57
|
});
|
|
75
58
|
exports.DocumentMessageContentSchema = zod_1.z.object({
|
|
76
|
-
role: zod_1.z.enum([
|
|
59
|
+
role: zod_1.z.enum(['user', 'assistant', 'system']),
|
|
77
60
|
content: zod_1.z.string().optional(),
|
|
78
|
-
tool_calls: zod_1.z
|
|
61
|
+
tool_calls: zod_1.z
|
|
62
|
+
.array(zod_1.z.object({
|
|
79
63
|
id: zod_1.z.string(),
|
|
80
64
|
type: zod_1.z.string(),
|
|
81
65
|
function: zod_1.z.object({
|
|
82
66
|
name: zod_1.z.string(),
|
|
83
67
|
arguments: zod_1.z.string().optional(),
|
|
84
|
-
})
|
|
85
|
-
}))
|
|
68
|
+
}),
|
|
69
|
+
}))
|
|
70
|
+
.optional(),
|
|
86
71
|
animation: zod_1.z.string().optional(),
|
|
87
72
|
icon: zod_1.z.string().optional(),
|
|
88
73
|
});
|
|
@@ -4,10 +4,12 @@ exports.JSONSchemaType = void 0;
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
exports.JSONSchemaType = zod_1.z.lazy(() => zod_1.z.object({
|
|
6
6
|
// Type validators
|
|
7
|
-
type: zod_1.z
|
|
8
|
-
|
|
9
|
-
zod_1.z.
|
|
10
|
-
|
|
7
|
+
type: zod_1.z
|
|
8
|
+
.union([
|
|
9
|
+
zod_1.z.enum(['string', 'number', 'integer', 'boolean', 'array', 'object', 'null', 'any']),
|
|
10
|
+
zod_1.z.array(zod_1.z.enum(['string', 'number', 'integer', 'boolean', 'array', 'object', 'null'])),
|
|
11
|
+
])
|
|
12
|
+
.optional(),
|
|
11
13
|
// Core schema metadata
|
|
12
14
|
$id: zod_1.z.string().optional(),
|
|
13
15
|
$schema: zod_1.z.string().optional(),
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BlockConfigSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const
|
|
5
|
+
const document_schema_1 = require("./document.schema");
|
|
6
6
|
const pipeline_schema_1 = require("./pipeline.schema");
|
|
7
|
-
const workflow_schema_1 = require("./workflow.schema");
|
|
8
7
|
const tool_config_schema_1 = require("./tool-config.schema");
|
|
9
|
-
const
|
|
8
|
+
const workflow_schema_1 = require("./workflow.schema");
|
|
9
|
+
const workspace_schema_1 = require("./workspace.schema");
|
|
10
10
|
exports.BlockConfigSchema = zod_1.z.discriminatedUnion('type', [
|
|
11
11
|
pipeline_schema_1.PipelineFactoryConfigSchema,
|
|
12
12
|
pipeline_schema_1.PipelineSequenceSchema,
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PipelineSequenceSchema = exports.PipelineFactorySchema = exports.PipelineFactoryIteratorSchema = exports.PipelineFactoryConfigSchema = exports.PipelineFactoryIteratorConfigSchema = exports.PipelineItemSchema = exports.PipelineItemConfigSchema = exports.PipelineBaseSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const workflow_schema_1 = require("./workflow.schema");
|
|
6
|
-
const template_expression_schema_1 = require("./template-expression.schema");
|
|
7
5
|
const block_schema_1 = require("./block.schema");
|
|
6
|
+
const template_expression_schema_1 = require("./template-expression.schema");
|
|
8
7
|
const ui_form_schema_1 = require("./ui-form.schema");
|
|
8
|
+
const workflow_schema_1 = require("./workflow.schema");
|
|
9
9
|
exports.PipelineBaseSchema = block_schema_1.BlockSchema.extend({
|
|
10
10
|
title: zod_1.z.string().optional(),
|
|
11
11
|
description: zod_1.z.string().optional(),
|
|
12
12
|
namespace: workflow_schema_1.NamespacePropsSchema.optional(),
|
|
13
|
-
ui: ui_form_schema_1.UiFormSchema.optional()
|
|
13
|
+
ui: ui_form_schema_1.UiFormSchema.optional(),
|
|
14
14
|
});
|
|
15
15
|
exports.PipelineItemConfigSchema = zod_1.z.object({
|
|
16
16
|
id: zod_1.z.string().optional(),
|
|
@@ -24,16 +24,11 @@ exports.PipelineItemConfigSchema = zod_1.z.object({
|
|
|
24
24
|
exports.PipelineItemSchema = zod_1.z.object({
|
|
25
25
|
id: zod_1.z.string().optional(),
|
|
26
26
|
block: zod_1.z.string(),
|
|
27
|
-
condition: zod_1.z
|
|
28
|
-
.union([zod_1.z.boolean(), zod_1.z.string()])
|
|
29
|
-
.optional(),
|
|
27
|
+
condition: zod_1.z.union([zod_1.z.boolean(), zod_1.z.string()]).optional(),
|
|
30
28
|
args: zod_1.z.any().optional(),
|
|
31
29
|
});
|
|
32
30
|
exports.PipelineFactoryIteratorConfigSchema = zod_1.z.object({
|
|
33
|
-
source: zod_1.z.union([
|
|
34
|
-
template_expression_schema_1.TemplateExpression,
|
|
35
|
-
zod_1.z.array(zod_1.z.string()),
|
|
36
|
-
]),
|
|
31
|
+
source: zod_1.z.union([template_expression_schema_1.TemplateExpression, zod_1.z.array(zod_1.z.string())]),
|
|
37
32
|
});
|
|
38
33
|
exports.PipelineFactoryConfigSchema = exports.PipelineBaseSchema.extend({
|
|
39
34
|
type: zod_1.z.literal('factory').default('factory'),
|
|
@@ -4,25 +4,32 @@ exports.ScheduledTaskSchema = exports.StartupTaskSchema = exports.RunPipelineTas
|
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const transition_payload_schema_1 = require("./transition-payload.schema");
|
|
6
6
|
const RepeatOptionsSchema = zod_1.z.object({
|
|
7
|
-
every: zod_1.z.number().nonnegative().optional()
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
every: zod_1.z.number().nonnegative().optional().describe('Repeat every X milliseconds. Example: 60000 for every minute'),
|
|
8
|
+
startDate: zod_1.z
|
|
9
|
+
.string()
|
|
10
|
+
.optional()
|
|
10
11
|
.describe('ISO string or timestamp when to start repeating. Example: "2025-01-01T00:00:00.000Z" or Date.now()'),
|
|
11
|
-
endDate: zod_1.z
|
|
12
|
+
endDate: zod_1.z
|
|
13
|
+
.string()
|
|
14
|
+
.optional()
|
|
12
15
|
.describe('ISO string or timestamp when to stop repeating. Example: "2025-12-31T23:59:59.999Z"'),
|
|
13
|
-
limit: zod_1.z.number().nonnegative().optional()
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
.
|
|
17
|
-
|
|
16
|
+
limit: zod_1.z.number().nonnegative().optional().describe('Maximum number of times to repeat. Example: 100'),
|
|
17
|
+
immediately: zod_1.z.boolean().optional().describe('Whether to run the job immediately when created. Default: false'),
|
|
18
|
+
pattern: zod_1.z
|
|
19
|
+
.string()
|
|
20
|
+
.optional()
|
|
18
21
|
.describe('Cron pattern for scheduling. Examples: "0 2 * * *" (daily at 2am), "*/15 * * * *" (every 15 min), "0 9 * * MON-FRI" (weekdays at 9am)'),
|
|
19
|
-
tz: zod_1.z
|
|
22
|
+
tz: zod_1.z
|
|
23
|
+
.string()
|
|
24
|
+
.optional()
|
|
20
25
|
.describe('IANA timezone for cron pattern. Examples: "UTC", "America/New_York", "Europe/London", "Asia/Tokyo", "Australia/Sydney"'),
|
|
21
26
|
});
|
|
22
|
-
exports.JobsScheduleSchema = zod_1.z
|
|
27
|
+
exports.JobsScheduleSchema = zod_1.z
|
|
28
|
+
.object({
|
|
23
29
|
delay: zod_1.z.number().nonnegative().optional(),
|
|
24
30
|
repeat: RepeatOptionsSchema.optional(),
|
|
25
|
-
})
|
|
31
|
+
})
|
|
32
|
+
.partial();
|
|
26
33
|
exports.BaseStartupTaskSchema = zod_1.z.object({
|
|
27
34
|
name: zod_1.z.string(),
|
|
28
35
|
title: zod_1.z.string().optional(),
|
|
@@ -2,4 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TemplateExpression = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
exports.TemplateExpression = zod_1.z
|
|
5
|
+
exports.TemplateExpression = zod_1.z
|
|
6
|
+
.string()
|
|
7
|
+
.regex(/^(?:\||>)?(?:[-+])?\s*\$\{([\s\S]*?)\}\s*$/, "Must be an expression in format '${ expression }'");
|
|
@@ -7,5 +7,5 @@ const ui_form_schema_1 = require("./ui-form.schema");
|
|
|
7
7
|
exports.ToolConfigSchema = block_schema_1.BlockSchema.extend({
|
|
8
8
|
type: zod_1.z.literal('tool').default('tool'),
|
|
9
9
|
description: zod_1.z.string().optional(),
|
|
10
|
-
ui: ui_form_schema_1.UiFormSchema.optional()
|
|
10
|
+
ui: ui_form_schema_1.UiFormSchema.optional(),
|
|
11
11
|
});
|
|
@@ -14,16 +14,18 @@ exports.UiElementSchema = zod_1.z.object({
|
|
|
14
14
|
emptyValue: zod_1.z.any().optional(),
|
|
15
15
|
help: zod_1.z.string().optional(),
|
|
16
16
|
title: zod_1.z.string().optional(),
|
|
17
|
-
enumOptions: zod_1.z
|
|
17
|
+
enumOptions: zod_1.z
|
|
18
|
+
.union([
|
|
18
19
|
zod_1.z.array(zod_1.z.union([
|
|
19
20
|
zod_1.z.object({
|
|
20
21
|
label: zod_1.z.string(),
|
|
21
|
-
value: zod_1.z.any()
|
|
22
|
+
value: zod_1.z.any(),
|
|
22
23
|
}),
|
|
23
24
|
zod_1.z.string(),
|
|
24
25
|
])),
|
|
25
|
-
zod_1.z.string()
|
|
26
|
-
])
|
|
26
|
+
zod_1.z.string(),
|
|
27
|
+
])
|
|
28
|
+
.optional(),
|
|
27
29
|
titleFormat: zod_1.z.string().optional(),
|
|
28
30
|
addable: zod_1.z.boolean().optional(),
|
|
29
31
|
removable: zod_1.z.boolean().optional(),
|
|
@@ -16,23 +16,24 @@ exports.UiFormButtonOptionsSchema = zod_1.z.object({
|
|
|
16
16
|
});
|
|
17
17
|
exports.UiFormButtonSchema = exports.UiFormBaseSchema.extend({
|
|
18
18
|
type: zod_1.z.literal('button'),
|
|
19
|
-
options: zod_1.z
|
|
19
|
+
options: zod_1.z
|
|
20
|
+
.object({
|
|
20
21
|
position: zod_1.z.number().optional(),
|
|
21
22
|
label: zod_1.z.string().optional(),
|
|
22
23
|
props: zod_1.z.record(zod_1.z.any()).optional(),
|
|
23
|
-
})
|
|
24
|
+
})
|
|
25
|
+
.optional(),
|
|
24
26
|
});
|
|
25
27
|
exports.UiFormCustomSchema = exports.UiFormBaseSchema.extend({
|
|
26
28
|
type: zod_1.z.literal('custom'),
|
|
27
|
-
options: zod_1.z
|
|
29
|
+
options: zod_1.z
|
|
30
|
+
.object({
|
|
28
31
|
label: zod_1.z.string().optional(),
|
|
29
32
|
props: zod_1.z.record(zod_1.z.any()).optional(),
|
|
30
|
-
})
|
|
33
|
+
})
|
|
34
|
+
.optional(),
|
|
31
35
|
});
|
|
32
|
-
exports.UiWidgetSchema = (0, zod_1.discriminatedUnion)('type', [
|
|
33
|
-
exports.UiFormButtonSchema,
|
|
34
|
-
exports.UiFormCustomSchema,
|
|
35
|
-
]);
|
|
36
|
+
exports.UiWidgetSchema = (0, zod_1.discriminatedUnion)('type', [exports.UiFormButtonSchema, exports.UiFormCustomSchema]);
|
|
36
37
|
exports.UiFormSchema = zod_1.z.object({
|
|
37
38
|
actions: zod_1.z.array(exports.UiWidgetSchema).optional(),
|
|
38
39
|
form: ui_properties_schema_1.UiPropertiesSchema.optional(),
|
|
@@ -2,26 +2,27 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WorkflowTransitionSchema = exports.WorkflowTransitionConfigSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const tool_call_schema_1 = require("./tool-call.schema");
|
|
6
5
|
const template_expression_schema_1 = require("./template-expression.schema");
|
|
7
|
-
|
|
6
|
+
const tool_call_schema_1 = require("./tool-call.schema");
|
|
7
|
+
exports.WorkflowTransitionConfigSchema = zod_1.z
|
|
8
|
+
.object({
|
|
8
9
|
id: zod_1.z.string(),
|
|
9
10
|
from: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())]),
|
|
10
11
|
to: zod_1.z.string(),
|
|
11
12
|
if: zod_1.z.union([template_expression_schema_1.TemplateExpression, zod_1.z.string(), zod_1.z.literal('true'), zod_1.z.literal('false')]).optional(),
|
|
12
|
-
trigger: zod_1.z.union([
|
|
13
|
-
zod_1.z.enum(["manual", "onEntry"]),
|
|
14
|
-
template_expression_schema_1.TemplateExpression,
|
|
15
|
-
]).optional(),
|
|
13
|
+
trigger: zod_1.z.union([zod_1.z.enum(['manual', 'onEntry']), template_expression_schema_1.TemplateExpression]).optional(),
|
|
16
14
|
call: zod_1.z.array(tool_call_schema_1.ToolCallConfigSchema).optional(),
|
|
17
15
|
onError: zod_1.z.string().optional(),
|
|
18
|
-
})
|
|
19
|
-
|
|
16
|
+
})
|
|
17
|
+
.strict();
|
|
18
|
+
exports.WorkflowTransitionSchema = zod_1.z
|
|
19
|
+
.object({
|
|
20
20
|
id: zod_1.z.string(),
|
|
21
21
|
from: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())]),
|
|
22
22
|
to: zod_1.z.string(),
|
|
23
23
|
if: zod_1.z.union([zod_1.z.string(), zod_1.z.literal('true'), zod_1.z.literal('false')]).optional(),
|
|
24
|
-
trigger: zod_1.z.enum([
|
|
24
|
+
trigger: zod_1.z.enum(['manual', 'onEntry']).optional(),
|
|
25
25
|
call: zod_1.z.array(tool_call_schema_1.ToolCallSchema).optional(),
|
|
26
26
|
onError: zod_1.z.string().optional(),
|
|
27
|
-
})
|
|
27
|
+
})
|
|
28
|
+
.strict();
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WorkflowSchema = exports.WorkflowBaseSchema = exports.NamespacePropsSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const workflow_transition_schema_1 = require("./workflow-transition.schema");
|
|
6
5
|
const block_schema_1 = require("./block.schema");
|
|
7
6
|
const ui_form_schema_1 = require("./ui-form.schema");
|
|
7
|
+
const workflow_transition_schema_1 = require("./workflow-transition.schema");
|
|
8
8
|
exports.NamespacePropsSchema = zod_1.z.object({
|
|
9
9
|
label: zod_1.z.string(),
|
|
10
10
|
});
|
|
11
11
|
exports.WorkflowBaseSchema = block_schema_1.BlockSchema.extend({
|
|
12
12
|
title: zod_1.z.string().optional(),
|
|
13
13
|
description: zod_1.z.string().optional(),
|
|
14
|
-
ui: ui_form_schema_1.UiFormSchema.optional()
|
|
14
|
+
ui: ui_form_schema_1.UiFormSchema.optional(),
|
|
15
15
|
});
|
|
16
16
|
exports.WorkflowSchema = exports.WorkflowBaseSchema.extend({
|
|
17
17
|
type: zod_1.z.literal('workflow').default('workflow'),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { WorkflowState } from '../../enums';
|
|
2
|
-
import { HistoryTransition } from './history-transition.interface';
|
|
3
2
|
import { JSONSchemaConfigType } from '../types/json-schema-config.type';
|
|
4
3
|
import { UiFormType } from '../types/ui-form.type';
|
|
5
4
|
import { WorkflowTransitionType } from '../types/workflow-transition.type';
|
|
5
|
+
import { HistoryTransition } from './history-transition.interface';
|
|
6
6
|
export interface WorkflowInterface {
|
|
7
7
|
id: string;
|
|
8
8
|
blockName: string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import js from '@eslint/js';
|
|
2
|
+
import prettier from 'eslint-plugin-prettier/recommended';
|
|
3
|
+
import { defineConfig, globalIgnores } from 'eslint/config';
|
|
4
|
+
import globals from 'globals';
|
|
5
|
+
import tseslint from 'typescript-eslint';
|
|
6
|
+
|
|
7
|
+
export default defineConfig([
|
|
8
|
+
globalIgnores(['dist', 'src/components/ai-elements']),
|
|
9
|
+
{
|
|
10
|
+
files: ['**/*.{ts,tsx}'],
|
|
11
|
+
extends: [js.configs.recommended, tseslint.configs.recommended, prettier],
|
|
12
|
+
languageOptions: {
|
|
13
|
+
ecmaVersion: 2020,
|
|
14
|
+
globals: globals.browser,
|
|
15
|
+
},
|
|
16
|
+
rules: {
|
|
17
|
+
//for now we ignore this, fix later
|
|
18
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
]);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@loopstack/contracts",
|
|
3
3
|
"displayName": "Loopstack Contracts",
|
|
4
4
|
"description": "A collection of types and schemas shared between projects",
|
|
5
|
-
"version": "0.16.
|
|
5
|
+
"version": "0.16.1",
|
|
6
6
|
"license": "BSL",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Jakob Klippel",
|
|
@@ -40,14 +40,35 @@
|
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "tsc -p tsconfig.json",
|
|
42
42
|
"watch": "tsc --watch",
|
|
43
|
-
"compile": "tsc --noEmit"
|
|
43
|
+
"compile": "tsc --noEmit",
|
|
44
|
+
"lint": "eslint .",
|
|
45
|
+
"format": "prettier --write .",
|
|
46
|
+
"prepare": "husky"
|
|
44
47
|
},
|
|
45
48
|
"peerDependencies": {
|
|
46
49
|
"zod": "^3.25.76"
|
|
47
50
|
},
|
|
48
51
|
"devDependencies": {
|
|
52
|
+
"@eslint/js": "^9.39.1",
|
|
53
|
+
"@trivago/prettier-plugin-sort-imports": "^6.0.1",
|
|
49
54
|
"@types/node": "^22.13.4",
|
|
55
|
+
"eslint": "^9.39.1",
|
|
56
|
+
"eslint-config-prettier": "^10.1.5",
|
|
57
|
+
"eslint-plugin-prettier": "^5.4.1",
|
|
58
|
+
"globals": "^16.5.0",
|
|
59
|
+
"husky": "^9.1.7",
|
|
60
|
+
"lint-staged": "^16.2.7",
|
|
61
|
+
"prettier": "^3.7.4",
|
|
50
62
|
"typescript": "^5.7.3",
|
|
63
|
+
"typescript-eslint": "^8.46.3",
|
|
51
64
|
"zod": "^3.25.76"
|
|
65
|
+
},
|
|
66
|
+
"lint-staged": {
|
|
67
|
+
"*.{ts,tsx}": [
|
|
68
|
+
"eslint"
|
|
69
|
+
],
|
|
70
|
+
"*.{json,md,css,yaml,yml}": [
|
|
71
|
+
"prettier --check"
|
|
72
|
+
]
|
|
52
73
|
}
|
|
53
74
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
plugins: ['@trivago/prettier-plugin-sort-imports'],
|
|
3
|
+
importOrder: [
|
|
4
|
+
'<THIRD_PARTY_MODULES>', // Imports not matched by other special phrases
|
|
5
|
+
'^@loopstack/(.*)$', // Internal packages
|
|
6
|
+
'^@/(.*)$', // Path aliases
|
|
7
|
+
'^[./]', // Relative imports
|
|
8
|
+
],
|
|
9
|
+
importOrderSortSpecifiers: true,
|
|
10
|
+
importOrderParserPlugins: ['typescript', 'jsx', 'decorators-legacy'],
|
|
11
|
+
printWidth: 120,
|
|
12
|
+
singleQuote: true,
|
|
13
|
+
trailingComma: 'all',
|
|
14
|
+
semi: true,
|
|
15
|
+
tabWidth: 2,
|
|
16
|
+
bracketSpacing: true,
|
|
17
|
+
arrowParens: 'always',
|
|
18
|
+
endOfLine: 'lf',
|
|
19
|
+
};
|