@amalgm/automations 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.
Files changed (41) hide show
  1. package/AXIOMS.md +32 -0
  2. package/PURPOSE.md +35 -0
  3. package/README.md +130 -0
  4. package/dist/src/automations.d.ts +27 -0
  5. package/dist/src/automations.js +199 -0
  6. package/dist/src/cli-main.d.ts +2 -0
  7. package/dist/src/cli-main.js +21 -0
  8. package/dist/src/cli.d.ts +10 -0
  9. package/dist/src/cli.js +183 -0
  10. package/dist/src/client.d.ts +7 -0
  11. package/dist/src/client.js +85 -0
  12. package/dist/src/contract.d.ts +176 -0
  13. package/dist/src/contract.js +1 -0
  14. package/dist/src/crud.d.ts +32 -0
  15. package/dist/src/crud.js +241 -0
  16. package/dist/src/errors.d.ts +17 -0
  17. package/dist/src/errors.js +32 -0
  18. package/dist/src/http.d.ts +7 -0
  19. package/dist/src/http.js +154 -0
  20. package/dist/src/index.d.ts +14 -0
  21. package/dist/src/index.js +18 -0
  22. package/dist/src/mcp-main.d.ts +2 -0
  23. package/dist/src/mcp-main.js +17 -0
  24. package/dist/src/mcp.d.ts +3 -0
  25. package/dist/src/mcp.js +88 -0
  26. package/dist/src/schedule.d.ts +2 -0
  27. package/dist/src/schedule.js +10 -0
  28. package/dist/src/schema.d.ts +236 -0
  29. package/dist/src/schema.js +119 -0
  30. package/dist/src/supabase-crud.d.ts +44 -0
  31. package/dist/src/supabase-crud.js +271 -0
  32. package/dist/src/supabase-store.d.ts +26 -0
  33. package/dist/src/supabase-store.js +123 -0
  34. package/dist/src/types.d.ts +128 -0
  35. package/dist/src/types.js +1 -0
  36. package/dist/src/validation.d.ts +11 -0
  37. package/dist/src/validation.js +69 -0
  38. package/dist/src/webhook.d.ts +18 -0
  39. package/dist/src/webhook.js +60 -0
  40. package/package.json +66 -0
  41. package/supabase/migrations/20260802000000_create_automations.sql +609 -0
@@ -0,0 +1,154 @@
1
+ import { AutomationError } from './errors.js';
2
+ import { parseCreateAutomation, parseCreateScheduleTrigger, parseCreateWebhookTrigger, parseCreateWorkflow, parseListAutomations, parseListRuns, parsePageQuery, parseUpdateAutomation, parseUpdateScheduleTrigger, parseUpdateWebhookTrigger, parseUpdateWorkflow, } from './schema.js';
3
+ export function createAutomationApi(options) {
4
+ return async (request) => {
5
+ try {
6
+ const principal = await options.authenticate(request);
7
+ const sdk = options.service.for(principal);
8
+ const url = new URL(request.url);
9
+ const parts = url.pathname.split('/').filter(Boolean).map(decodeURIComponent);
10
+ if (parts[0] !== 'v1' || parts[1] !== 'automations')
11
+ return response(404, { error: 'Not found' });
12
+ const method = request.method.toUpperCase();
13
+ const query = pageQuery(url);
14
+ if (parts.length === 2 && method === 'POST')
15
+ return response(201, await sdk.automations.create(parseCreateAutomation(await body(request))));
16
+ if (parts.length === 2 && method === 'GET') {
17
+ return response(200, await sdk.automations.list(parseListAutomations({
18
+ ...query,
19
+ ...(url.searchParams.has('targetId') ? { targetId: url.searchParams.get('targetId') || '' } : {}),
20
+ ...(url.searchParams.has('enabled') ? { enabled: booleanQuery(url, 'enabled') } : {}),
21
+ })));
22
+ }
23
+ const automationId = parts[2];
24
+ if (!automationId)
25
+ return response(404, { error: 'Not found' });
26
+ if (parts.length === 3 && method === 'GET')
27
+ return nullable(await sdk.automations.get(automationId));
28
+ if (parts.length === 3 && method === 'PATCH')
29
+ return response(200, await sdk.automations.update(automationId, parseUpdateAutomation(await body(request))));
30
+ if (parts.length === 3 && method === 'DELETE') {
31
+ await sdk.automations.delete(automationId);
32
+ return new Response(null, { status: 204 });
33
+ }
34
+ if (parts[3] === 'triggers' && parts.length === 4 && method === 'GET') {
35
+ return response(200, await sdk.triggers.list(automationId));
36
+ }
37
+ if (parts[3] === 'triggers' && parts[4] && parts[4] !== 'schedules' && parts[4] !== 'webhooks') {
38
+ return response(404, { error: 'Not found' });
39
+ }
40
+ const triggerKind = parts[4];
41
+ if (parts[3] === 'triggers' && triggerKind === 'schedules') {
42
+ if (parts.length === 5 && method === 'POST')
43
+ return response(201, await sdk.triggers.schedule.create(automationId, parseCreateScheduleTrigger(await body(request))));
44
+ if (parts.length === 5 && method === 'GET')
45
+ return response(200, await sdk.triggers.schedule.list(automationId, parsePageQuery(query)));
46
+ const triggerId = parts[5];
47
+ if (!triggerId)
48
+ return response(404, { error: 'Not found' });
49
+ if (parts.length === 6 && method === 'GET')
50
+ return nullable(await sdk.triggers.schedule.get(automationId, triggerId));
51
+ if (parts.length === 6 && method === 'PATCH')
52
+ return response(200, await sdk.triggers.schedule.update(automationId, triggerId, parseUpdateScheduleTrigger(await body(request))));
53
+ if (parts.length === 6 && method === 'DELETE') {
54
+ await sdk.triggers.schedule.delete(automationId, triggerId);
55
+ return new Response(null, { status: 204 });
56
+ }
57
+ }
58
+ if (parts[3] === 'triggers' && triggerKind === 'webhooks') {
59
+ if (parts.length === 5 && method === 'POST')
60
+ return response(201, await sdk.triggers.webhook.create(automationId, parseCreateWebhookTrigger(await body(request))));
61
+ if (parts.length === 5 && method === 'GET')
62
+ return response(200, await sdk.triggers.webhook.list(automationId, parsePageQuery(query)));
63
+ const triggerId = parts[5];
64
+ if (!triggerId)
65
+ return response(404, { error: 'Not found' });
66
+ if (parts.length === 6 && method === 'GET')
67
+ return nullable(await sdk.triggers.webhook.get(automationId, triggerId));
68
+ if (parts.length === 6 && method === 'PATCH')
69
+ return response(200, await sdk.triggers.webhook.update(automationId, triggerId, parseUpdateWebhookTrigger(await body(request))));
70
+ if (parts.length === 6 && method === 'DELETE') {
71
+ await sdk.triggers.webhook.delete(automationId, triggerId);
72
+ return new Response(null, { status: 204 });
73
+ }
74
+ }
75
+ if (parts[3] === 'workflow' && parts.length === 4) {
76
+ if (method === 'POST')
77
+ return response(201, await sdk.workflow.create(automationId, parseCreateWorkflow(await body(request))));
78
+ if (method === 'GET')
79
+ return nullable(await sdk.workflow.get(automationId));
80
+ if (method === 'PATCH')
81
+ return response(200, await sdk.workflow.update(automationId, parseUpdateWorkflow(await body(request))));
82
+ if (method === 'DELETE') {
83
+ await sdk.workflow.delete(automationId);
84
+ return new Response(null, { status: 204 });
85
+ }
86
+ }
87
+ if (parts[3] === 'runs') {
88
+ if (parts.length === 4 && method === 'GET') {
89
+ return response(200, await sdk.runs.list(automationId, parseListRuns({
90
+ ...query,
91
+ ...(url.searchParams.has('status') ? { status: url.searchParams.get('status') } : {}),
92
+ })));
93
+ }
94
+ if (parts.length === 5 && method === 'GET')
95
+ return nullable(await sdk.runs.get(automationId, parts[4]));
96
+ }
97
+ return response(405, { error: 'Method not allowed' });
98
+ }
99
+ catch (error) {
100
+ if (error instanceof AutomationError)
101
+ return response(status(error), { error: error.message, code: error.code });
102
+ return response(500, { error: 'Automations service failed' });
103
+ }
104
+ };
105
+ }
106
+ async function body(request) {
107
+ const value = await request.json().catch(() => {
108
+ throw new AutomationError('validation', 'Request body must be JSON');
109
+ });
110
+ if (!value || typeof value !== 'object' || Array.isArray(value)) {
111
+ throw new AutomationError('validation', 'Request body must be an object');
112
+ }
113
+ return value;
114
+ }
115
+ function pageQuery(url) {
116
+ return {
117
+ ...(url.searchParams.has('limit') ? { limit: numberQuery(url, 'limit') } : {}),
118
+ ...(url.searchParams.has('offset') ? { offset: numberQuery(url, 'offset') } : {}),
119
+ };
120
+ }
121
+ function numberQuery(url, name) {
122
+ const value = Number(url.searchParams.get(name));
123
+ if (!Number.isInteger(value))
124
+ throw new AutomationError('validation', `${name} must be an integer`);
125
+ return value;
126
+ }
127
+ function booleanQuery(url, name) {
128
+ const value = url.searchParams.get(name);
129
+ if (value === 'true')
130
+ return true;
131
+ if (value === 'false')
132
+ return false;
133
+ throw new AutomationError('validation', `${name} must be true or false`);
134
+ }
135
+ function nullable(value) {
136
+ return value === null ? response(404, { error: 'Not found', code: 'not_found' }) : response(200, value);
137
+ }
138
+ function response(status, body) {
139
+ return new Response(JSON.stringify(body), {
140
+ status,
141
+ headers: { 'content-type': 'application/json; charset=utf-8', 'cache-control': 'no-store' },
142
+ });
143
+ }
144
+ function status(error) {
145
+ if (error.code === 'validation')
146
+ return 400;
147
+ if (error.code === 'forbidden')
148
+ return 403;
149
+ if (error.code === 'conflict')
150
+ return 409;
151
+ if (error.code === 'internal')
152
+ return 500;
153
+ return 404;
154
+ }
@@ -0,0 +1,14 @@
1
+ export { createAutomationClient, type AutomationAuthorization } from './client.js';
2
+ export { AutomationCrudService, type AutomationCrudRepository } from './crud.js';
3
+ export { AutomationError, ConflictError, ForbiddenError, NotFoundError, ValidationError, type AutomationErrorCode, } from './errors.js';
4
+ export { createAutomationApi, type AuthenticateAutomationRequest, type AutomationApi } from './http.js';
5
+ export { runAutomationCli } from './cli.js';
6
+ export { createAutomationMcpServer } from './mcp.js';
7
+ export { SupabaseAutomationCrudRepository, type SupabaseRpcClient } from './supabase-crud.js';
8
+ export type { Automation, AutomationCrud, AutomationCrudService as AutomationCrudServiceContract, AutomationPrincipal, AutomationRun, AutomationScope, CreateAutomation, CreateScheduleTrigger, CreateWebhookTrigger, CreateWorkflow, Json, ListAutomations, ListRuns, Page, PageQuery, RunStatus, ScheduleTrigger, Trigger, UpdateAutomation, UpdateScheduleTrigger, UpdateWebhookTrigger, UpdateWorkflow, WebhookTrigger, Workflow, } from './contract.js';
9
+ export { Automations, EventRejectedError } from './automations.js';
10
+ export { nextCronAt, validateCron } from './schedule.js';
11
+ export { eventReference, eventReferences, matchesEvent, normalizeHeaders, verifyEventSecret, } from './webhook.js';
12
+ export { SupabaseStore } from './supabase-store.js';
13
+ export type { SupabaseRpcClient as SupabaseStoreRpcClient } from './supabase-store.js';
14
+ export type { AutomationDefinition, AutomationLog, AutomationRun as AutomationRunRecord, AutomationStore, AutomationTarget, AutomationTransport, CronTrigger, DueCronTrigger, EventTrigger, PreparedAutomation, PreparedTrigger, RunInput, RunUpdate, StoredEventTrigger, Trigger as StoreTrigger, WorkflowDefinition, } from './types.js';
@@ -0,0 +1,18 @@
1
+ // The automation product has two composable halves:
2
+ // - the configuration service (contract/crud/http/mcp/cli) — Supabase owns
3
+ // everything except execution;
4
+ // - the delivery rail (automations/webhook/schedule/store) — the receipt,
5
+ // lease, and retry laws that decide when a run happens.
6
+ // Colliding names keep the contract's spelling; the rail's store-level
7
+ // records are exported under Store-scoped aliases.
8
+ export { createAutomationClient } from './client.js';
9
+ export { AutomationCrudService } from './crud.js';
10
+ export { AutomationError, ConflictError, ForbiddenError, NotFoundError, ValidationError, } from './errors.js';
11
+ export { createAutomationApi } from './http.js';
12
+ export { runAutomationCli } from './cli.js';
13
+ export { createAutomationMcpServer } from './mcp.js';
14
+ export { SupabaseAutomationCrudRepository } from './supabase-crud.js';
15
+ export { Automations, EventRejectedError } from './automations.js';
16
+ export { nextCronAt, validateCron } from './schedule.js';
17
+ export { eventReference, eventReferences, matchesEvent, normalizeHeaders, verifyEventSecret, } from './webhook.js';
18
+ export { SupabaseStore } from './supabase-store.js';
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
3
+ import { createAutomationClient } from './client.js';
4
+ import { createAutomationMcpServer } from './mcp.js';
5
+ const baseUrl = process.env.AMALGM_AUTOMATIONS_API_URL;
6
+ const authorization = process.env.AMALGM_AUTOMATIONS_AUTHORIZATION;
7
+ if (!baseUrl || !authorization) {
8
+ process.stderr.write('AMALGM_AUTOMATIONS_API_URL and AMALGM_AUTOMATIONS_AUTHORIZATION are required.\n');
9
+ process.exitCode = 1;
10
+ }
11
+ else {
12
+ const server = createAutomationMcpServer(createAutomationClient({
13
+ baseUrl,
14
+ authorization: () => authorization,
15
+ }));
16
+ await server.connect(new StdioServerTransport());
17
+ }
@@ -0,0 +1,3 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import type { AutomationCrud } from './contract.js';
3
+ export declare function createAutomationMcpServer(sdk: AutomationCrud): McpServer;
@@ -0,0 +1,88 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { z } from 'zod/v3';
3
+ import { createAutomationSchema, createScheduleTriggerSchema, createWebhookTriggerSchema, createWorkflowSchema, identifierSchema, listAutomationsSchema, listRunsSchema, pageQuerySchema, updateAutomationSchema, updateScheduleTriggerSchema, updateWebhookTriggerSchema, updateWorkflowSchema, } from './schema.js';
4
+ const resultSchema = { result: z.unknown() };
5
+ const automationIdInput = { automation_id: identifierSchema };
6
+ const triggerIdInput = { ...automationIdInput, trigger_id: identifierSchema };
7
+ const runIdInput = { ...automationIdInput, run_id: identifierSchema };
8
+ export function createAutomationMcpServer(sdk) {
9
+ const server = new McpServer({ name: 'amalgm-automations-mcp-server', version: '0.1.0' });
10
+ register(server, 'amalgm_automations_create', 'Create automation', 'Create an automation configuration without triggers or workflow.', { input: createAutomationSchema }, write(false), ({ input }) => sdk.automations.create(input));
11
+ register(server, 'amalgm_automations_list', 'List automations', 'List the caller\'s automations with optional target and enabled filters.', { query: listAutomationsSchema.optional() }, read(), ({ query }) => sdk.automations.list(query));
12
+ register(server, 'amalgm_automations_get', 'Get automation', 'Get one automation by id.', automationIdInput, read(), ({ automation_id }) => sdk.automations.get(automation_id));
13
+ register(server, 'amalgm_automations_update', 'Update automation', 'Update automation metadata, target, or enabled state.', { automation_id: identifierSchema, patch: updateAutomationSchema }, write(true), ({ automation_id, patch }) => sdk.automations.update(automation_id, patch));
14
+ register(server, 'amalgm_automations_delete', 'Delete automation', 'Delete an automation and its current triggers and workflow. Historical runs remain.', automationIdInput, destructive(), async ({ automation_id }) => {
15
+ await sdk.automations.delete(automation_id);
16
+ return { deleted: automation_id };
17
+ });
18
+ register(server, 'amalgm_automation_triggers_list', 'List automation triggers', 'List all schedule and webhook triggers belonging to one automation.', automationIdInput, read(), ({ automation_id }) => sdk.triggers.list(automation_id));
19
+ register(server, 'amalgm_schedule_triggers_create', 'Create schedule trigger', 'Create a cron schedule trigger for one automation.', { automation_id: identifierSchema, input: createScheduleTriggerSchema }, write(false), ({ automation_id, input }) => sdk.triggers.schedule.create(automation_id, input));
20
+ register(server, 'amalgm_schedule_triggers_list', 'List schedule triggers', 'List schedule triggers for one automation.', { automation_id: identifierSchema, query: pageQuerySchema.optional() }, read(), ({ automation_id, query }) => sdk.triggers.schedule.list(automation_id, query));
21
+ register(server, 'amalgm_schedule_triggers_get', 'Get schedule trigger', 'Get one schedule trigger by automation and trigger id.', triggerIdInput, read(), ({ automation_id, trigger_id }) => sdk.triggers.schedule.get(automation_id, trigger_id));
22
+ register(server, 'amalgm_schedule_triggers_update', 'Update schedule trigger', 'Update a cron schedule trigger without changing its type.', { automation_id: identifierSchema, trigger_id: identifierSchema, patch: updateScheduleTriggerSchema }, write(true), ({ automation_id, trigger_id, patch }) => sdk.triggers.schedule.update(automation_id, trigger_id, patch));
23
+ register(server, 'amalgm_schedule_triggers_delete', 'Delete schedule trigger', 'Delete one schedule trigger. The automation and its workflow remain.', triggerIdInput, destructive(), async ({ automation_id, trigger_id }) => {
24
+ await sdk.triggers.schedule.delete(automation_id, trigger_id);
25
+ return { deleted: trigger_id };
26
+ });
27
+ register(server, 'amalgm_webhook_triggers_create', 'Create webhook trigger', 'Create a webhook trigger. The secret is accepted only on writes and never returned.', { automation_id: identifierSchema, input: createWebhookTriggerSchema }, write(false), ({ automation_id, input }) => sdk.triggers.webhook.create(automation_id, input));
28
+ register(server, 'amalgm_webhook_triggers_list', 'List webhook triggers', 'List webhook triggers for one automation. Secrets are never returned.', { automation_id: identifierSchema, query: pageQuerySchema.optional() }, read(), ({ automation_id, query }) => sdk.triggers.webhook.list(automation_id, query));
29
+ register(server, 'amalgm_webhook_triggers_get', 'Get webhook trigger', 'Get one webhook trigger by automation and trigger id. The secret is never returned.', triggerIdInput, read(), ({ automation_id, trigger_id }) => sdk.triggers.webhook.get(automation_id, trigger_id));
30
+ register(server, 'amalgm_webhook_triggers_update', 'Update webhook trigger', 'Update webhook matching, secret, or enabled state without changing its type.', { automation_id: identifierSchema, trigger_id: identifierSchema, patch: updateWebhookTriggerSchema }, write(true), ({ automation_id, trigger_id, patch }) => sdk.triggers.webhook.update(automation_id, trigger_id, patch));
31
+ register(server, 'amalgm_webhook_triggers_delete', 'Delete webhook trigger', 'Delete one webhook trigger. The automation and its workflow remain.', triggerIdInput, destructive(), async ({ automation_id, trigger_id }) => {
32
+ await sdk.triggers.webhook.delete(automation_id, trigger_id);
33
+ return { deleted: trigger_id };
34
+ });
35
+ register(server, 'amalgm_workflow_create', 'Create automation workflow', 'Create the one workflow script owned by an automation.', { automation_id: identifierSchema, input: createWorkflowSchema }, write(false), ({ automation_id, input }) => sdk.workflow.create(automation_id, input));
36
+ register(server, 'amalgm_workflow_get', 'Get automation workflow', 'Get the workflow script owned by an automation.', automationIdInput, read(), ({ automation_id }) => sdk.workflow.get(automation_id));
37
+ register(server, 'amalgm_workflow_update', 'Update automation workflow', 'Update the workflow script or its configuration.', { automation_id: identifierSchema, patch: updateWorkflowSchema }, write(true), ({ automation_id, patch }) => sdk.workflow.update(automation_id, patch));
38
+ register(server, 'amalgm_workflow_delete', 'Delete automation workflow', 'Delete the workflow script. The automation and its triggers remain.', automationIdInput, destructive(), async ({ automation_id }) => {
39
+ await sdk.workflow.delete(automation_id);
40
+ return { deleted: automation_id };
41
+ });
42
+ register(server, 'amalgm_automation_runs_list', 'List automation runs', 'List historical runs for one automation. This tool never changes run state.', { automation_id: identifierSchema, query: listRunsSchema.optional() }, read(), ({ automation_id, query }) => sdk.runs.list(automation_id, query));
43
+ register(server, 'amalgm_automation_runs_get', 'Get automation run', 'Get one historical run for an automation. This tool never changes run state.', runIdInput, read(), ({ automation_id, run_id }) => sdk.runs.get(automation_id, run_id));
44
+ return server;
45
+ }
46
+ function register(server, name, title, description, inputSchema, annotations, handler) {
47
+ registerUnchecked(server, name, title, description, inputSchema, annotations, async (input) => {
48
+ return handler(input);
49
+ });
50
+ }
51
+ function registerUnchecked(server, name, title, description, inputSchema, annotations, handler) {
52
+ server.registerTool(name, {
53
+ title,
54
+ description,
55
+ inputSchema,
56
+ outputSchema: resultSchema,
57
+ annotations,
58
+ }, async (input) => {
59
+ try {
60
+ const result = await handler(input);
61
+ return toolSuccess(result);
62
+ }
63
+ catch (error) {
64
+ return toolFailure(error);
65
+ }
66
+ });
67
+ }
68
+ function toolSuccess(result) {
69
+ return {
70
+ content: [{ type: 'text', text: JSON.stringify(result) }],
71
+ structuredContent: { result },
72
+ };
73
+ }
74
+ function toolFailure(error) {
75
+ return {
76
+ isError: true,
77
+ content: [{ type: 'text', text: error instanceof Error ? error.message : String(error) }],
78
+ };
79
+ }
80
+ function read() {
81
+ return { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
82
+ }
83
+ function write(idempotentHint) {
84
+ return { readOnlyHint: false, destructiveHint: false, idempotentHint, openWorldHint: false };
85
+ }
86
+ function destructive() {
87
+ return { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false };
88
+ }
@@ -0,0 +1,2 @@
1
+ export declare function nextCronAt(cron: string, timezone: string, after: Date | string): string;
2
+ export declare function validateCron(cron: string, timezone: string): void;
@@ -0,0 +1,10 @@
1
+ import { CronExpressionParser } from 'cron-parser';
2
+ export function nextCronAt(cron, timezone, after) {
3
+ return CronExpressionParser.parse(cron, {
4
+ currentDate: after,
5
+ tz: timezone,
6
+ }).next().toDate().toISOString();
7
+ }
8
+ export function validateCron(cron, timezone) {
9
+ nextCronAt(cron, timezone, new Date(0));
10
+ }
@@ -0,0 +1,236 @@
1
+ import { z } from 'zod/v3';
2
+ import type { CreateAutomation, CreateScheduleTrigger, CreateWebhookTrigger, CreateWorkflow, Json, ListAutomations, ListRuns, PageQuery, UpdateAutomation, UpdateScheduleTrigger, UpdateWebhookTrigger, UpdateWorkflow } from './contract.js';
3
+ export declare const identifierSchema: z.ZodString;
4
+ export declare const pageQuerySchema: z.ZodObject<{
5
+ limit: z.ZodOptional<z.ZodNumber>;
6
+ offset: z.ZodOptional<z.ZodNumber>;
7
+ }, "strict", z.ZodTypeAny, {
8
+ limit?: number | undefined;
9
+ offset?: number | undefined;
10
+ }, {
11
+ limit?: number | undefined;
12
+ offset?: number | undefined;
13
+ }>;
14
+ export declare const createAutomationSchema: z.ZodObject<{
15
+ id: z.ZodOptional<z.ZodString>;
16
+ targetId: z.ZodString;
17
+ name: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
18
+ description: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
19
+ enabled: z.ZodOptional<z.ZodBoolean>;
20
+ }, "strict", z.ZodTypeAny, {
21
+ id?: string | undefined;
22
+ targetId: string;
23
+ name?: string | undefined;
24
+ description?: string | undefined;
25
+ enabled?: boolean | undefined;
26
+ }, {
27
+ id?: string | undefined;
28
+ targetId: string;
29
+ name?: string | undefined;
30
+ description?: string | undefined;
31
+ enabled?: boolean | undefined;
32
+ }>;
33
+ export declare const updateAutomationSchema: z.ZodEffects<z.ZodObject<{
34
+ targetId: z.ZodOptional<z.ZodString>;
35
+ name: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
36
+ description: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
37
+ enabled: z.ZodOptional<z.ZodBoolean>;
38
+ }, "strict", z.ZodTypeAny, {
39
+ targetId?: string | undefined;
40
+ name?: string | null | undefined;
41
+ description?: string | null | undefined;
42
+ enabled?: boolean | undefined;
43
+ }, {
44
+ targetId?: string | undefined;
45
+ name?: string | null | undefined;
46
+ description?: string | null | undefined;
47
+ enabled?: boolean | undefined;
48
+ }>, {
49
+ targetId?: string | undefined;
50
+ name?: string | null | undefined;
51
+ description?: string | null | undefined;
52
+ enabled?: boolean | undefined;
53
+ }, {
54
+ targetId?: string | undefined;
55
+ name?: string | null | undefined;
56
+ description?: string | null | undefined;
57
+ enabled?: boolean | undefined;
58
+ }>;
59
+ export declare const listAutomationsSchema: z.ZodObject<{
60
+ limit: z.ZodOptional<z.ZodNumber>;
61
+ offset: z.ZodOptional<z.ZodNumber>;
62
+ } & {
63
+ targetId: z.ZodOptional<z.ZodString>;
64
+ enabled: z.ZodOptional<z.ZodBoolean>;
65
+ }, "strict", z.ZodTypeAny, {
66
+ limit?: number | undefined;
67
+ offset?: number | undefined;
68
+ targetId?: string | undefined;
69
+ enabled?: boolean | undefined;
70
+ }, {
71
+ limit?: number | undefined;
72
+ offset?: number | undefined;
73
+ targetId?: string | undefined;
74
+ enabled?: boolean | undefined;
75
+ }>;
76
+ export declare const createScheduleTriggerSchema: z.ZodObject<{
77
+ id: z.ZodOptional<z.ZodString>;
78
+ cron: z.ZodEffects<z.ZodString, string, string>;
79
+ timezone: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
80
+ enabled: z.ZodOptional<z.ZodBoolean>;
81
+ }, "strict", z.ZodTypeAny, {
82
+ id?: string | undefined;
83
+ cron: string;
84
+ timezone?: string | undefined;
85
+ enabled?: boolean | undefined;
86
+ }, {
87
+ id?: string | undefined;
88
+ cron: string;
89
+ timezone?: string | undefined;
90
+ enabled?: boolean | undefined;
91
+ }>;
92
+ export declare const updateScheduleTriggerSchema: z.ZodEffects<z.ZodObject<{
93
+ cron: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
94
+ timezone: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
95
+ enabled: z.ZodOptional<z.ZodBoolean>;
96
+ }, "strict", z.ZodTypeAny, {
97
+ cron?: string | undefined;
98
+ timezone?: string | undefined;
99
+ enabled?: boolean | undefined;
100
+ }, {
101
+ cron?: string | undefined;
102
+ timezone?: string | undefined;
103
+ enabled?: boolean | undefined;
104
+ }>, {
105
+ cron?: string | undefined;
106
+ timezone?: string | undefined;
107
+ enabled?: boolean | undefined;
108
+ }, {
109
+ cron?: string | undefined;
110
+ timezone?: string | undefined;
111
+ enabled?: boolean | undefined;
112
+ }>;
113
+ export declare const createWebhookTriggerSchema: z.ZodObject<{
114
+ id: z.ZodOptional<z.ZodString>;
115
+ source: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
116
+ event: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
117
+ secret: z.ZodString;
118
+ enabled: z.ZodOptional<z.ZodBoolean>;
119
+ }, "strict", z.ZodTypeAny, {
120
+ id?: string | undefined;
121
+ source?: string | undefined;
122
+ event?: string | undefined;
123
+ secret: string;
124
+ enabled?: boolean | undefined;
125
+ }, {
126
+ id?: string | undefined;
127
+ source?: string | undefined;
128
+ event?: string | undefined;
129
+ secret: string;
130
+ enabled?: boolean | undefined;
131
+ }>;
132
+ export declare const updateWebhookTriggerSchema: z.ZodEffects<z.ZodObject<{
133
+ source: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
134
+ event: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
135
+ secret: z.ZodOptional<z.ZodString>;
136
+ enabled: z.ZodOptional<z.ZodBoolean>;
137
+ }, "strict", z.ZodTypeAny, {
138
+ source?: string | undefined;
139
+ event?: string | undefined;
140
+ secret?: string | undefined;
141
+ enabled?: boolean | undefined;
142
+ }, {
143
+ source?: string | undefined;
144
+ event?: string | undefined;
145
+ secret?: string | undefined;
146
+ enabled?: boolean | undefined;
147
+ }>, {
148
+ source?: string | undefined;
149
+ event?: string | undefined;
150
+ secret?: string | undefined;
151
+ enabled?: boolean | undefined;
152
+ }, {
153
+ source?: string | undefined;
154
+ event?: string | undefined;
155
+ secret?: string | undefined;
156
+ enabled?: boolean | undefined;
157
+ }>;
158
+ export declare const createWorkflowSchema: z.ZodObject<{
159
+ id: z.ZodOptional<z.ZodString>;
160
+ name: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
161
+ script: z.ZodEffects<z.ZodString, string, string>;
162
+ compiled: z.ZodOptional<z.ZodType<Json, z.ZodTypeDef, Json>>;
163
+ allowlist: z.ZodOptional<z.ZodType<Json, z.ZodTypeDef, Json>>;
164
+ limits: z.ZodOptional<z.ZodType<Json, z.ZodTypeDef, Json>>;
165
+ }, "strict", z.ZodTypeAny, {
166
+ id?: string | undefined;
167
+ name?: string | undefined;
168
+ script: string;
169
+ compiled?: Json | undefined;
170
+ allowlist?: Json | undefined;
171
+ limits?: Json | undefined;
172
+ }, {
173
+ id?: string | undefined;
174
+ name?: string | undefined;
175
+ script: string;
176
+ compiled?: Json | undefined;
177
+ allowlist?: Json | undefined;
178
+ limits?: Json | undefined;
179
+ }>;
180
+ export declare const updateWorkflowSchema: z.ZodEffects<z.ZodObject<{
181
+ name: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
182
+ script: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
183
+ compiled: z.ZodOptional<z.ZodNullable<z.ZodType<Json, z.ZodTypeDef, Json>>>;
184
+ allowlist: z.ZodOptional<z.ZodNullable<z.ZodType<Json, z.ZodTypeDef, Json>>>;
185
+ limits: z.ZodOptional<z.ZodNullable<z.ZodType<Json, z.ZodTypeDef, Json>>>;
186
+ }, "strict", z.ZodTypeAny, {
187
+ name?: string | null | undefined;
188
+ script?: string | undefined;
189
+ compiled?: Json | undefined;
190
+ allowlist?: Json | undefined;
191
+ limits?: Json | undefined;
192
+ }, {
193
+ name?: string | null | undefined;
194
+ script?: string | undefined;
195
+ compiled?: Json | undefined;
196
+ allowlist?: Json | undefined;
197
+ limits?: Json | undefined;
198
+ }>, {
199
+ name?: string | null | undefined;
200
+ script?: string | undefined;
201
+ compiled?: Json | undefined;
202
+ allowlist?: Json | undefined;
203
+ limits?: Json | undefined;
204
+ }, {
205
+ name?: string | null | undefined;
206
+ script?: string | undefined;
207
+ compiled?: Json | undefined;
208
+ allowlist?: Json | undefined;
209
+ limits?: Json | undefined;
210
+ }>;
211
+ export declare const listRunsSchema: z.ZodObject<{
212
+ limit: z.ZodOptional<z.ZodNumber>;
213
+ offset: z.ZodOptional<z.ZodNumber>;
214
+ } & {
215
+ status: z.ZodOptional<z.ZodEnum<["pending", "sent", "running", "completed", "failed"]>>;
216
+ }, "strict", z.ZodTypeAny, {
217
+ limit?: number | undefined;
218
+ offset?: number | undefined;
219
+ status?: "completed" | "failed" | "pending" | "running" | "sent" | undefined;
220
+ }, {
221
+ limit?: number | undefined;
222
+ offset?: number | undefined;
223
+ status?: "completed" | "failed" | "pending" | "running" | "sent" | undefined;
224
+ }>;
225
+ export declare function parseCreateAutomation(value: unknown): CreateAutomation;
226
+ export declare function parseUpdateAutomation(value: unknown): UpdateAutomation;
227
+ export declare function parseListAutomations(value: unknown): ListAutomations;
228
+ export declare function parseCreateScheduleTrigger(value: unknown): CreateScheduleTrigger;
229
+ export declare function parseUpdateScheduleTrigger(value: unknown): UpdateScheduleTrigger;
230
+ export declare function parseCreateWebhookTrigger(value: unknown): CreateWebhookTrigger;
231
+ export declare function parseUpdateWebhookTrigger(value: unknown): UpdateWebhookTrigger;
232
+ export declare function parseCreateWorkflow(value: unknown): CreateWorkflow;
233
+ export declare function parseUpdateWorkflow(value: unknown): UpdateWorkflow;
234
+ export declare function parsePageQuery(value: unknown): PageQuery;
235
+ export declare function parseListRuns(value: unknown): ListRuns;
236
+ export declare function parse<T>(schema: z.ZodType<T>, value: unknown): T;