@hatchet-dev/typescript-sdk 0.16.0-alpha.4 → 0.16.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/clients/dispatcher/dispatcher-client.d.ts +2 -1
- package/clients/dispatcher/dispatcher-client.js +10 -1
- package/clients/event/event-client.js +13 -8
- package/clients/hatchet-client/client-config.d.ts +0 -6
- package/clients/hatchet-client/client-config.js +0 -2
- package/clients/hatchet-client/features/cron-client.d.ts +79 -0
- package/clients/hatchet-client/features/cron-client.js +127 -0
- package/clients/hatchet-client/features/schedule-client.d.ts +76 -0
- package/clients/hatchet-client/features/schedule-client.js +120 -0
- package/clients/hatchet-client/hatchet-client.d.ts +4 -2
- package/clients/hatchet-client/hatchet-client.js +6 -25
- package/clients/listener/child-listener-client.js +16 -13
- package/clients/rest/api.d.ts +0 -3
- package/clients/rest/api.js +0 -10
- package/clients/rest/generated/Api.d.ts +152 -2
- package/clients/rest/generated/Api.js +81 -1
- package/clients/rest/generated/data-contracts.d.ts +86 -0
- package/clients/rest/generated/data-contracts.js +27 -1
- package/clients/rest/index.d.ts +2 -2
- package/clients/rest/index.js +21 -10
- package/clients/worker/handler.js +16 -11
- package/clients/worker/worker.d.ts +2 -10
- package/clients/worker/worker.js +21 -37
- package/examples/crons/cron-worker.d.ts +2 -0
- package/examples/crons/cron-worker.js +48 -0
- package/examples/crons/programatic-crons.js +55 -0
- package/examples/on-failure.js +15 -10
- package/examples/scheduled-runs/programatic-schedules.d.ts +1 -0
- package/examples/scheduled-runs/programatic-schedules.js +54 -0
- package/examples/simple-worker.d.ts +2 -1
- package/examples/simple-worker.js +6 -3
- package/package.json +7 -8
- package/protoc/dispatcher/dispatcher.js +1 -1
- package/protoc/events/events.js +1 -1
- package/protoc/google/protobuf/timestamp.js +1 -1
- package/protoc/google/protobuf/wrappers.js +17 -7
- package/protoc/workflows/workflows.d.ts +13 -0
- package/protoc/workflows/workflows.js +160 -7
- package/step.d.ts +0 -122
- package/step.js +17 -9
- package/util/config-loader/config-loader.js +18 -26
- package/util/retrier.js +8 -3
- package/version.d.ts +1 -0
- package/version.js +4 -0
- package/workflow.d.ts +0 -462
- package/workflow.js +17 -7
- package/clients/rest/generated/cloud/Api.d.ts +0 -377
- package/clients/rest/generated/cloud/Api.js +0 -326
- package/clients/rest/generated/cloud/data-contracts.d.ts +0 -468
- package/clients/rest/generated/cloud/data-contracts.js +0 -68
- package/clients/rest/generated/cloud/http-client.d.ts +0 -41
- package/clients/rest/generated/cloud/http-client.js +0 -102
- package/clients/worker/compute/compute-config.d.ts +0 -156
- package/clients/worker/compute/compute-config.js +0 -82
- package/clients/worker/compute/managed-compute.d.ts +0 -15
- package/clients/worker/compute/managed-compute.js +0 -104
- package/examples/managed-worker.js +0 -65
- /package/examples/{managed-worker.d.ts → crons/programatic-crons.d.ts} +0 -0
package/clients/rest/api.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from 'axios';
|
|
2
2
|
import { Api } from './generated/Api';
|
|
3
|
-
import { Api as CloudApi } from './generated/cloud/Api';
|
|
4
3
|
declare const api: (serverUrl: string, token: string, axiosOpts?: AxiosRequestConfig) => Api<unknown>;
|
|
5
|
-
export declare const cloudApi: (serverUrl: string, token: string, axiosOpts?: AxiosRequestConfig) => CloudApi<unknown>;
|
|
6
|
-
export { api, CloudApi };
|
|
7
4
|
export default api;
|
package/clients/rest/api.js
CHANGED
|
@@ -3,21 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CloudApi = exports.api = exports.cloudApi = void 0;
|
|
7
6
|
const qs_1 = __importDefault(require("qs"));
|
|
8
7
|
const Api_1 = require("./generated/Api");
|
|
9
|
-
const Api_2 = require("./generated/cloud/Api");
|
|
10
|
-
Object.defineProperty(exports, "CloudApi", { enumerable: true, get: function () { return Api_2.Api; } });
|
|
11
8
|
const api = (serverUrl, token, axiosOpts) => {
|
|
12
9
|
return new Api_1.Api(Object.assign({ baseURL: serverUrl, headers: {
|
|
13
10
|
Authorization: `Bearer ${token}`,
|
|
14
11
|
}, paramsSerializer: (params) => qs_1.default.stringify(params, { arrayFormat: 'repeat' }) }, axiosOpts));
|
|
15
12
|
};
|
|
16
|
-
exports.api = api;
|
|
17
|
-
const cloudApi = (serverUrl, token, axiosOpts) => {
|
|
18
|
-
return new Api_2.Api(Object.assign({ baseURL: serverUrl, headers: {
|
|
19
|
-
Authorization: `Bearer ${token}`,
|
|
20
|
-
}, paramsSerializer: (params) => qs_1.default.stringify(params, { arrayFormat: 'repeat' }) }, axiosOpts));
|
|
21
|
-
};
|
|
22
|
-
exports.cloudApi = cloudApi;
|
|
23
13
|
exports.default = api;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AcceptInviteRequest, APIErrors, APIMeta, BulkCreateEventRequest, BulkCreateEventResponse, CancelEventRequest, CreateAPITokenRequest, CreateAPITokenResponse, CreateEventRequest, CreateSNSIntegrationRequest, CreateTenantAlertEmailGroupRequest, CreateTenantInviteRequest, CreateTenantRequest, Event, EventData, EventKey, EventKeyList, EventList, EventOrderByDirection, EventOrderByField, EventSearch, ListAPIMetaIntegration, ListAPITokensResponse, ListSlackWebhooks, ListSNSIntegrations, LogLineLevelField, LogLineList, LogLineOrderByDirection, LogLineOrderByField, LogLineSearch, RateLimitList, RateLimitOrderByDirection, RateLimitOrderByField, RejectInviteRequest, ReplayEventRequest, ReplayWorkflowRunsRequest, ReplayWorkflowRunsResponse, RerunStepRunRequest, SNSIntegration, StepRun, StepRunArchiveList, StepRunEventList, Tenant, TenantAlertEmailGroup, TenantAlertEmailGroupList, TenantAlertingSettings, TenantInvite, TenantInviteList, TenantMember, TenantMemberList, TenantQueueMetrics, TenantResourcePolicy, TenantStepRunQueueMetrics, TriggerWorkflowRunRequest, UpdateTenantAlertEmailGroupRequest, UpdateTenantInviteRequest, UpdateTenantRequest, UpdateWorkerRequest, User, UserChangePasswordRequest, UserLoginRequest, UserRegisterRequest, UserTenantMembershipsList, WebhookWorkerCreated, WebhookWorkerCreateRequest, WebhookWorkerListResponse, WebhookWorkerRequestListResponse, Worker, WorkerList, Workflow, WorkflowID, WorkflowKindList, WorkflowList, WorkflowMetrics, WorkflowRun, WorkflowRunList, WorkflowRunOrderByDirection, WorkflowRunOrderByField, WorkflowRunsCancelRequest, WorkflowRunShape, WorkflowRunsMetrics, WorkflowRunStatus, WorkflowRunStatusList, WorkflowUpdateRequest, WorkflowVersion, WorkflowWorkersCount } from './data-contracts';
|
|
1
|
+
import { AcceptInviteRequest, APIErrors, APIMeta, BulkCreateEventRequest, BulkCreateEventResponse, CancelEventRequest, CreateAPITokenRequest, CreateAPITokenResponse, CreateCronWorkflowTriggerRequest, CreateEventRequest, CreateSNSIntegrationRequest, CreateTenantAlertEmailGroupRequest, CreateTenantInviteRequest, CreateTenantRequest, CronWorkflows, CronWorkflowsList, CronWorkflowsOrderByField, Event, EventData, EventKey, EventKeyList, EventList, EventOrderByDirection, EventOrderByField, EventSearch, ListAPIMetaIntegration, ListAPITokensResponse, ListSlackWebhooks, ListSNSIntegrations, LogLineLevelField, LogLineList, LogLineOrderByDirection, LogLineOrderByField, LogLineSearch, RateLimitList, RateLimitOrderByDirection, RateLimitOrderByField, RejectInviteRequest, ReplayEventRequest, ReplayWorkflowRunsRequest, ReplayWorkflowRunsResponse, RerunStepRunRequest, ScheduledRunStatus, ScheduledWorkflows, ScheduledWorkflowsList, ScheduledWorkflowsOrderByField, ScheduleWorkflowRunRequest, SNSIntegration, StepRun, StepRunArchiveList, StepRunEventList, Tenant, TenantAlertEmailGroup, TenantAlertEmailGroupList, TenantAlertingSettings, TenantInvite, TenantInviteList, TenantMember, TenantMemberList, TenantQueueMetrics, TenantResourcePolicy, TenantStepRunQueueMetrics, TriggerWorkflowRunRequest, UpdateTenantAlertEmailGroupRequest, UpdateTenantInviteRequest, UpdateTenantRequest, UpdateWorkerRequest, User, UserChangePasswordRequest, UserLoginRequest, UserRegisterRequest, UserTenantMembershipsList, WebhookWorkerCreated, WebhookWorkerCreateRequest, WebhookWorkerListResponse, WebhookWorkerRequestListResponse, Worker, WorkerList, Workflow, WorkflowID, WorkflowKindList, WorkflowList, WorkflowMetrics, WorkflowRun, WorkflowRunList, WorkflowRunOrderByDirection, WorkflowRunOrderByField, WorkflowRunsCancelRequest, WorkflowRunShape, WorkflowRunsMetrics, WorkflowRunStatus, WorkflowRunStatusList, WorkflowUpdateRequest, WorkflowVersion, WorkflowWorkersCount } from './data-contracts';
|
|
2
2
|
import { HttpClient, RequestParams } from './http-client';
|
|
3
3
|
export declare class Api<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
|
|
4
4
|
/**
|
|
@@ -595,6 +595,156 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
595
595
|
* @secure
|
|
596
596
|
*/
|
|
597
597
|
workflowList: (tenant: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<WorkflowList, any>>;
|
|
598
|
+
/**
|
|
599
|
+
* @description Schedule a new workflow run for a tenant
|
|
600
|
+
*
|
|
601
|
+
* @tags Workflow Run
|
|
602
|
+
* @name ScheduledWorkflowRunCreate
|
|
603
|
+
* @summary Trigger workflow run
|
|
604
|
+
* @request POST:/api/v1/tenants/{tenant}/workflows/{workflow}/scheduled
|
|
605
|
+
* @secure
|
|
606
|
+
*/
|
|
607
|
+
scheduledWorkflowRunCreate: (tenant: string, workflow: string, data: ScheduleWorkflowRunRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<ScheduledWorkflows, any>>;
|
|
608
|
+
/**
|
|
609
|
+
* @description Get all scheduled workflow runs for a tenant
|
|
610
|
+
*
|
|
611
|
+
* @tags Workflow
|
|
612
|
+
* @name WorkflowScheduledList
|
|
613
|
+
* @summary Get scheduled workflow runs
|
|
614
|
+
* @request GET:/api/v1/tenants/{tenant}/workflows/scheduled
|
|
615
|
+
* @secure
|
|
616
|
+
*/
|
|
617
|
+
workflowScheduledList: (tenant: string, query?: {
|
|
618
|
+
/**
|
|
619
|
+
* The number to skip
|
|
620
|
+
* @format int64
|
|
621
|
+
*/
|
|
622
|
+
offset?: number;
|
|
623
|
+
/**
|
|
624
|
+
* The number to limit by
|
|
625
|
+
* @format int64
|
|
626
|
+
*/
|
|
627
|
+
limit?: number;
|
|
628
|
+
/** The order by field */
|
|
629
|
+
orderByField?: ScheduledWorkflowsOrderByField;
|
|
630
|
+
/** The order by direction */
|
|
631
|
+
orderByDirection?: WorkflowRunOrderByDirection;
|
|
632
|
+
/**
|
|
633
|
+
* The workflow id to get runs for.
|
|
634
|
+
* @format uuid
|
|
635
|
+
* @minLength 36
|
|
636
|
+
* @maxLength 36
|
|
637
|
+
*/
|
|
638
|
+
workflowId?: string;
|
|
639
|
+
/**
|
|
640
|
+
* The parent workflow run id
|
|
641
|
+
* @format uuid
|
|
642
|
+
* @minLength 36
|
|
643
|
+
* @maxLength 36
|
|
644
|
+
*/
|
|
645
|
+
parentWorkflowRunId?: string;
|
|
646
|
+
/**
|
|
647
|
+
* The parent step run id
|
|
648
|
+
* @format uuid
|
|
649
|
+
* @minLength 36
|
|
650
|
+
* @maxLength 36
|
|
651
|
+
*/
|
|
652
|
+
parentStepRunId?: string;
|
|
653
|
+
/**
|
|
654
|
+
* A list of metadata key value pairs to filter by
|
|
655
|
+
* @example ["key1:value1","key2:value2"]
|
|
656
|
+
*/
|
|
657
|
+
additionalMetadata?: string[];
|
|
658
|
+
/** A list of scheduled run statuses to filter by */
|
|
659
|
+
statuses?: ScheduledRunStatus[];
|
|
660
|
+
}, params?: RequestParams) => Promise<import("axios").AxiosResponse<ScheduledWorkflowsList, any>>;
|
|
661
|
+
/**
|
|
662
|
+
* @description Get a scheduled workflow run for a tenant
|
|
663
|
+
*
|
|
664
|
+
* @tags Workflow
|
|
665
|
+
* @name WorkflowScheduledGet
|
|
666
|
+
* @summary Get scheduled workflow run
|
|
667
|
+
* @request GET:/api/v1/tenants/{tenant}/workflows/scheduled/{scheduled-workflow-run}
|
|
668
|
+
* @secure
|
|
669
|
+
*/
|
|
670
|
+
workflowScheduledGet: (tenant: string, scheduledWorkflowRun: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<ScheduledWorkflows, any>>;
|
|
671
|
+
/**
|
|
672
|
+
* @description Delete a scheduled workflow run for a tenant
|
|
673
|
+
*
|
|
674
|
+
* @tags Workflow
|
|
675
|
+
* @name WorkflowScheduledDelete
|
|
676
|
+
* @summary Delete scheduled workflow run
|
|
677
|
+
* @request DELETE:/api/v1/tenants/{tenant}/workflows/scheduled/{scheduled-workflow-run}
|
|
678
|
+
* @secure
|
|
679
|
+
*/
|
|
680
|
+
workflowScheduledDelete: (tenant: string, scheduledWorkflowRun: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any>>;
|
|
681
|
+
/**
|
|
682
|
+
* @description Create a new cron job workflow trigger for a tenant
|
|
683
|
+
*
|
|
684
|
+
* @tags Workflow Run
|
|
685
|
+
* @name CronWorkflowTriggerCreate
|
|
686
|
+
* @summary Create cron job workflow trigger
|
|
687
|
+
* @request POST:/api/v1/tenants/{tenant}/workflows/{workflow}/crons
|
|
688
|
+
* @secure
|
|
689
|
+
*/
|
|
690
|
+
cronWorkflowTriggerCreate: (tenant: string, workflow: string, data: CreateCronWorkflowTriggerRequest, params?: RequestParams) => Promise<import("axios").AxiosResponse<CronWorkflows, any>>;
|
|
691
|
+
/**
|
|
692
|
+
* @description Get all cron job workflow triggers for a tenant
|
|
693
|
+
*
|
|
694
|
+
* @tags Workflow
|
|
695
|
+
* @name CronWorkflowList
|
|
696
|
+
* @summary Get cron job workflows
|
|
697
|
+
* @request GET:/api/v1/tenants/{tenant}/workflows/crons
|
|
698
|
+
* @secure
|
|
699
|
+
*/
|
|
700
|
+
cronWorkflowList: (tenant: string, query?: {
|
|
701
|
+
/**
|
|
702
|
+
* The number to skip
|
|
703
|
+
* @format int64
|
|
704
|
+
*/
|
|
705
|
+
offset?: number;
|
|
706
|
+
/**
|
|
707
|
+
* The number to limit by
|
|
708
|
+
* @format int64
|
|
709
|
+
*/
|
|
710
|
+
limit?: number;
|
|
711
|
+
/**
|
|
712
|
+
* The workflow id to get runs for.
|
|
713
|
+
* @format uuid
|
|
714
|
+
* @minLength 36
|
|
715
|
+
* @maxLength 36
|
|
716
|
+
*/
|
|
717
|
+
workflowId?: string;
|
|
718
|
+
/**
|
|
719
|
+
* A list of metadata key value pairs to filter by
|
|
720
|
+
* @example ["key1:value1","key2:value2"]
|
|
721
|
+
*/
|
|
722
|
+
additionalMetadata?: string[];
|
|
723
|
+
/** The order by field */
|
|
724
|
+
orderByField?: CronWorkflowsOrderByField;
|
|
725
|
+
/** The order by direction */
|
|
726
|
+
orderByDirection?: WorkflowRunOrderByDirection;
|
|
727
|
+
}, params?: RequestParams) => Promise<import("axios").AxiosResponse<CronWorkflowsList, any>>;
|
|
728
|
+
/**
|
|
729
|
+
* @description Get a cron job workflow run for a tenant
|
|
730
|
+
*
|
|
731
|
+
* @tags Workflow
|
|
732
|
+
* @name WorkflowCronGet
|
|
733
|
+
* @summary Get cron job workflow run
|
|
734
|
+
* @request GET:/api/v1/tenants/{tenant}/workflows/crons/{cron-workflow}
|
|
735
|
+
* @secure
|
|
736
|
+
*/
|
|
737
|
+
workflowCronGet: (tenant: string, cronWorkflow: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<CronWorkflows, any>>;
|
|
738
|
+
/**
|
|
739
|
+
* @description Delete a cron job workflow run for a tenant
|
|
740
|
+
*
|
|
741
|
+
* @tags Workflow
|
|
742
|
+
* @name WorkflowCronDelete
|
|
743
|
+
* @summary Delete cron job workflow run
|
|
744
|
+
* @request DELETE:/api/v1/tenants/{tenant}/workflows/crons/{cron-workflow}
|
|
745
|
+
* @secure
|
|
746
|
+
*/
|
|
747
|
+
workflowCronDelete: (tenant: string, cronWorkflow: string, params?: RequestParams) => Promise<import("axios").AxiosResponse<void, any>>;
|
|
598
748
|
/**
|
|
599
749
|
* @description Cancel a batch of workflow runs
|
|
600
750
|
*
|
|
@@ -886,7 +1036,7 @@ export declare class Api<SecurityDataType = unknown> extends HttpClient<Security
|
|
|
886
1036
|
*
|
|
887
1037
|
* @tags Workflow
|
|
888
1038
|
* @name WorkflowRunGetMetrics
|
|
889
|
-
* @summary Get workflow runs
|
|
1039
|
+
* @summary Get workflow runs metrics
|
|
890
1040
|
* @request GET:/api/v1/tenants/{tenant}/workflows/runs/metrics
|
|
891
1041
|
* @secure
|
|
892
1042
|
*/
|
|
@@ -552,6 +552,86 @@ class Api extends http_client_1.HttpClient {
|
|
|
552
552
|
* @secure
|
|
553
553
|
*/
|
|
554
554
|
this.workflowList = (tenant, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/workflows`, method: 'GET', secure: true, format: 'json' }, params));
|
|
555
|
+
/**
|
|
556
|
+
* @description Schedule a new workflow run for a tenant
|
|
557
|
+
*
|
|
558
|
+
* @tags Workflow Run
|
|
559
|
+
* @name ScheduledWorkflowRunCreate
|
|
560
|
+
* @summary Trigger workflow run
|
|
561
|
+
* @request POST:/api/v1/tenants/{tenant}/workflows/{workflow}/scheduled
|
|
562
|
+
* @secure
|
|
563
|
+
*/
|
|
564
|
+
this.scheduledWorkflowRunCreate = (tenant, workflow, data, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/workflows/${workflow}/scheduled`, method: 'POST', body: data, secure: true, type: http_client_1.ContentType.Json, format: 'json' }, params));
|
|
565
|
+
/**
|
|
566
|
+
* @description Get all scheduled workflow runs for a tenant
|
|
567
|
+
*
|
|
568
|
+
* @tags Workflow
|
|
569
|
+
* @name WorkflowScheduledList
|
|
570
|
+
* @summary Get scheduled workflow runs
|
|
571
|
+
* @request GET:/api/v1/tenants/{tenant}/workflows/scheduled
|
|
572
|
+
* @secure
|
|
573
|
+
*/
|
|
574
|
+
this.workflowScheduledList = (tenant, query, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/workflows/scheduled`, method: 'GET', query: query, secure: true, format: 'json' }, params));
|
|
575
|
+
/**
|
|
576
|
+
* @description Get a scheduled workflow run for a tenant
|
|
577
|
+
*
|
|
578
|
+
* @tags Workflow
|
|
579
|
+
* @name WorkflowScheduledGet
|
|
580
|
+
* @summary Get scheduled workflow run
|
|
581
|
+
* @request GET:/api/v1/tenants/{tenant}/workflows/scheduled/{scheduled-workflow-run}
|
|
582
|
+
* @secure
|
|
583
|
+
*/
|
|
584
|
+
this.workflowScheduledGet = (tenant, scheduledWorkflowRun, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/workflows/scheduled/${scheduledWorkflowRun}`, method: 'GET', secure: true, format: 'json' }, params));
|
|
585
|
+
/**
|
|
586
|
+
* @description Delete a scheduled workflow run for a tenant
|
|
587
|
+
*
|
|
588
|
+
* @tags Workflow
|
|
589
|
+
* @name WorkflowScheduledDelete
|
|
590
|
+
* @summary Delete scheduled workflow run
|
|
591
|
+
* @request DELETE:/api/v1/tenants/{tenant}/workflows/scheduled/{scheduled-workflow-run}
|
|
592
|
+
* @secure
|
|
593
|
+
*/
|
|
594
|
+
this.workflowScheduledDelete = (tenant, scheduledWorkflowRun, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/workflows/scheduled/${scheduledWorkflowRun}`, method: 'DELETE', secure: true }, params));
|
|
595
|
+
/**
|
|
596
|
+
* @description Create a new cron job workflow trigger for a tenant
|
|
597
|
+
*
|
|
598
|
+
* @tags Workflow Run
|
|
599
|
+
* @name CronWorkflowTriggerCreate
|
|
600
|
+
* @summary Create cron job workflow trigger
|
|
601
|
+
* @request POST:/api/v1/tenants/{tenant}/workflows/{workflow}/crons
|
|
602
|
+
* @secure
|
|
603
|
+
*/
|
|
604
|
+
this.cronWorkflowTriggerCreate = (tenant, workflow, data, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/workflows/${workflow}/crons`, method: 'POST', body: data, secure: true, type: http_client_1.ContentType.Json, format: 'json' }, params));
|
|
605
|
+
/**
|
|
606
|
+
* @description Get all cron job workflow triggers for a tenant
|
|
607
|
+
*
|
|
608
|
+
* @tags Workflow
|
|
609
|
+
* @name CronWorkflowList
|
|
610
|
+
* @summary Get cron job workflows
|
|
611
|
+
* @request GET:/api/v1/tenants/{tenant}/workflows/crons
|
|
612
|
+
* @secure
|
|
613
|
+
*/
|
|
614
|
+
this.cronWorkflowList = (tenant, query, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/workflows/crons`, method: 'GET', query: query, secure: true, format: 'json' }, params));
|
|
615
|
+
/**
|
|
616
|
+
* @description Get a cron job workflow run for a tenant
|
|
617
|
+
*
|
|
618
|
+
* @tags Workflow
|
|
619
|
+
* @name WorkflowCronGet
|
|
620
|
+
* @summary Get cron job workflow run
|
|
621
|
+
* @request GET:/api/v1/tenants/{tenant}/workflows/crons/{cron-workflow}
|
|
622
|
+
* @secure
|
|
623
|
+
*/
|
|
624
|
+
this.workflowCronGet = (tenant, cronWorkflow, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/workflows/crons/${cronWorkflow}`, method: 'GET', secure: true, format: 'json' }, params));
|
|
625
|
+
/**
|
|
626
|
+
* @description Delete a cron job workflow run for a tenant
|
|
627
|
+
*
|
|
628
|
+
* @tags Workflow
|
|
629
|
+
* @name WorkflowCronDelete
|
|
630
|
+
* @summary Delete cron job workflow run
|
|
631
|
+
* @request DELETE:/api/v1/tenants/{tenant}/workflows/crons/{cron-workflow}
|
|
632
|
+
* @secure
|
|
633
|
+
*/
|
|
634
|
+
this.workflowCronDelete = (tenant, cronWorkflow, params = {}) => this.request(Object.assign({ path: `/api/v1/tenants/${tenant}/workflows/crons/${cronWorkflow}`, method: 'DELETE', secure: true }, params));
|
|
555
635
|
/**
|
|
556
636
|
* @description Cancel a batch of workflow runs
|
|
557
637
|
*
|
|
@@ -697,7 +777,7 @@ class Api extends http_client_1.HttpClient {
|
|
|
697
777
|
*
|
|
698
778
|
* @tags Workflow
|
|
699
779
|
* @name WorkflowRunGetMetrics
|
|
700
|
-
* @summary Get workflow runs
|
|
780
|
+
* @summary Get workflow runs metrics
|
|
701
781
|
* @request GET:/api/v1/tenants/{tenant}/workflows/runs/metrics
|
|
702
782
|
* @secure
|
|
703
783
|
*/
|
|
@@ -672,6 +672,67 @@ export interface WorkflowRunList {
|
|
|
672
672
|
rows?: WorkflowRun[];
|
|
673
673
|
pagination?: PaginationResponse;
|
|
674
674
|
}
|
|
675
|
+
export interface ScheduledWorkflows {
|
|
676
|
+
metadata: APIResourceMeta;
|
|
677
|
+
tenantId: string;
|
|
678
|
+
workflowVersionId: string;
|
|
679
|
+
workflowId: string;
|
|
680
|
+
workflowName: string;
|
|
681
|
+
/** @format date-time */
|
|
682
|
+
triggerAt: string;
|
|
683
|
+
input?: Record<string, any>;
|
|
684
|
+
additionalMetadata?: Record<string, any>;
|
|
685
|
+
/** @format date-time */
|
|
686
|
+
workflowRunCreatedAt?: string;
|
|
687
|
+
workflowRunName?: string;
|
|
688
|
+
workflowRunStatus?: WorkflowRunStatus;
|
|
689
|
+
/**
|
|
690
|
+
* @format uuid
|
|
691
|
+
* @minLength 36
|
|
692
|
+
* @maxLength 36
|
|
693
|
+
* @example "bb214807-246e-43a5-a25d-41761d1cff9e"
|
|
694
|
+
*/
|
|
695
|
+
workflowRunId?: string;
|
|
696
|
+
method: 'DEFAULT' | 'API';
|
|
697
|
+
}
|
|
698
|
+
export interface ScheduledWorkflowsList {
|
|
699
|
+
rows?: ScheduledWorkflows[];
|
|
700
|
+
pagination?: PaginationResponse;
|
|
701
|
+
}
|
|
702
|
+
export declare enum ScheduledWorkflowsOrderByField {
|
|
703
|
+
TriggerAt = "triggerAt",
|
|
704
|
+
CreatedAt = "createdAt"
|
|
705
|
+
}
|
|
706
|
+
export declare enum ScheduledRunStatus {
|
|
707
|
+
PENDING = "PENDING",
|
|
708
|
+
RUNNING = "RUNNING",
|
|
709
|
+
SUCCEEDED = "SUCCEEDED",
|
|
710
|
+
FAILED = "FAILED",
|
|
711
|
+
CANCELLED = "CANCELLED",
|
|
712
|
+
QUEUED = "QUEUED",
|
|
713
|
+
SCHEDULED = "SCHEDULED"
|
|
714
|
+
}
|
|
715
|
+
export interface CronWorkflows {
|
|
716
|
+
metadata: APIResourceMeta;
|
|
717
|
+
tenantId: string;
|
|
718
|
+
workflowVersionId: string;
|
|
719
|
+
workflowId: string;
|
|
720
|
+
workflowName: string;
|
|
721
|
+
cron: string;
|
|
722
|
+
name?: string;
|
|
723
|
+
input?: Record<string, any>;
|
|
724
|
+
additionalMetadata?: Record<string, any>;
|
|
725
|
+
enabled: boolean;
|
|
726
|
+
method: 'DEFAULT' | 'API';
|
|
727
|
+
}
|
|
728
|
+
export interface CronWorkflowsList {
|
|
729
|
+
rows?: CronWorkflows[];
|
|
730
|
+
pagination?: PaginationResponse;
|
|
731
|
+
}
|
|
732
|
+
export declare enum CronWorkflowsOrderByField {
|
|
733
|
+
Name = "name",
|
|
734
|
+
CreatedAt = "createdAt"
|
|
735
|
+
}
|
|
675
736
|
export declare enum WorkflowRunOrderByField {
|
|
676
737
|
CreatedAt = "createdAt",
|
|
677
738
|
StartedAt = "startedAt",
|
|
@@ -859,6 +920,18 @@ export interface StepRunArchiveList {
|
|
|
859
920
|
pagination?: PaginationResponse;
|
|
860
921
|
rows?: StepRunArchive[];
|
|
861
922
|
}
|
|
923
|
+
export interface WorkerRuntimeInfo {
|
|
924
|
+
sdkVersion?: string;
|
|
925
|
+
language?: WorkerRuntimeSDKs;
|
|
926
|
+
languageVersion?: string;
|
|
927
|
+
os?: string;
|
|
928
|
+
runtimeExtra?: string;
|
|
929
|
+
}
|
|
930
|
+
export declare enum WorkerRuntimeSDKs {
|
|
931
|
+
GOLANG = "GOLANG",
|
|
932
|
+
PYTHON = "PYTHON",
|
|
933
|
+
TYPESCRIPT = "TYPESCRIPT"
|
|
934
|
+
}
|
|
862
935
|
export interface WorkerList {
|
|
863
936
|
pagination?: PaginationResponse;
|
|
864
937
|
rows?: Worker[];
|
|
@@ -948,6 +1021,7 @@ export interface Worker {
|
|
|
948
1021
|
* @format uuid
|
|
949
1022
|
*/
|
|
950
1023
|
webhookId?: string;
|
|
1024
|
+
runtimeInfo?: WorkerRuntimeInfo;
|
|
951
1025
|
}
|
|
952
1026
|
export interface WorkerLabel {
|
|
953
1027
|
metadata: APIResourceMeta;
|
|
@@ -997,6 +1071,18 @@ export interface TriggerWorkflowRunRequest {
|
|
|
997
1071
|
input: object;
|
|
998
1072
|
additionalMetadata?: object;
|
|
999
1073
|
}
|
|
1074
|
+
export interface ScheduleWorkflowRunRequest {
|
|
1075
|
+
input: object;
|
|
1076
|
+
additionalMetadata: object;
|
|
1077
|
+
/** @format date-time */
|
|
1078
|
+
triggerAt: string;
|
|
1079
|
+
}
|
|
1080
|
+
export interface CreateCronWorkflowTriggerRequest {
|
|
1081
|
+
input: object;
|
|
1082
|
+
additionalMetadata: object;
|
|
1083
|
+
cronName: string;
|
|
1084
|
+
cronExpression: string;
|
|
1085
|
+
}
|
|
1000
1086
|
export interface CreatePullRequestFromStepRun {
|
|
1001
1087
|
branchName: string;
|
|
1002
1088
|
}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* ---------------------------------------------------------------
|
|
11
11
|
*/
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.WebhookWorkerRequestMethod = exports.LogLineOrderByDirection = exports.LogLineOrderByField = exports.LogLineLevel = exports.PullRequestState = exports.StepRunEventSeverity = exports.StepRunEventReason = exports.StepRunStatus = exports.JobRunStatus = exports.WorkflowKind = exports.WorkflowRunStatus = exports.WorkflowRunOrderByDirection = exports.WorkflowRunOrderByField = exports.RateLimitOrderByDirection = exports.RateLimitOrderByField = exports.EventOrderByDirection = exports.EventOrderByField = exports.TenantResource = exports.TenantMemberRole = void 0;
|
|
13
|
+
exports.WebhookWorkerRequestMethod = exports.LogLineOrderByDirection = exports.LogLineOrderByField = exports.LogLineLevel = exports.PullRequestState = exports.WorkerRuntimeSDKs = exports.StepRunEventSeverity = exports.StepRunEventReason = exports.StepRunStatus = exports.JobRunStatus = exports.WorkflowKind = exports.WorkflowRunStatus = exports.WorkflowRunOrderByDirection = exports.WorkflowRunOrderByField = exports.CronWorkflowsOrderByField = exports.ScheduledRunStatus = exports.ScheduledWorkflowsOrderByField = exports.RateLimitOrderByDirection = exports.RateLimitOrderByField = exports.EventOrderByDirection = exports.EventOrderByField = exports.TenantResource = exports.TenantMemberRole = void 0;
|
|
14
14
|
var TenantMemberRole;
|
|
15
15
|
(function (TenantMemberRole) {
|
|
16
16
|
TenantMemberRole["OWNER"] = "OWNER";
|
|
@@ -45,6 +45,26 @@ var RateLimitOrderByDirection;
|
|
|
45
45
|
RateLimitOrderByDirection["Asc"] = "asc";
|
|
46
46
|
RateLimitOrderByDirection["Desc"] = "desc";
|
|
47
47
|
})(RateLimitOrderByDirection || (exports.RateLimitOrderByDirection = RateLimitOrderByDirection = {}));
|
|
48
|
+
var ScheduledWorkflowsOrderByField;
|
|
49
|
+
(function (ScheduledWorkflowsOrderByField) {
|
|
50
|
+
ScheduledWorkflowsOrderByField["TriggerAt"] = "triggerAt";
|
|
51
|
+
ScheduledWorkflowsOrderByField["CreatedAt"] = "createdAt";
|
|
52
|
+
})(ScheduledWorkflowsOrderByField || (exports.ScheduledWorkflowsOrderByField = ScheduledWorkflowsOrderByField = {}));
|
|
53
|
+
var ScheduledRunStatus;
|
|
54
|
+
(function (ScheduledRunStatus) {
|
|
55
|
+
ScheduledRunStatus["PENDING"] = "PENDING";
|
|
56
|
+
ScheduledRunStatus["RUNNING"] = "RUNNING";
|
|
57
|
+
ScheduledRunStatus["SUCCEEDED"] = "SUCCEEDED";
|
|
58
|
+
ScheduledRunStatus["FAILED"] = "FAILED";
|
|
59
|
+
ScheduledRunStatus["CANCELLED"] = "CANCELLED";
|
|
60
|
+
ScheduledRunStatus["QUEUED"] = "QUEUED";
|
|
61
|
+
ScheduledRunStatus["SCHEDULED"] = "SCHEDULED";
|
|
62
|
+
})(ScheduledRunStatus || (exports.ScheduledRunStatus = ScheduledRunStatus = {}));
|
|
63
|
+
var CronWorkflowsOrderByField;
|
|
64
|
+
(function (CronWorkflowsOrderByField) {
|
|
65
|
+
CronWorkflowsOrderByField["Name"] = "name";
|
|
66
|
+
CronWorkflowsOrderByField["CreatedAt"] = "createdAt";
|
|
67
|
+
})(CronWorkflowsOrderByField || (exports.CronWorkflowsOrderByField = CronWorkflowsOrderByField = {}));
|
|
48
68
|
var WorkflowRunOrderByField;
|
|
49
69
|
(function (WorkflowRunOrderByField) {
|
|
50
70
|
WorkflowRunOrderByField["CreatedAt"] = "createdAt";
|
|
@@ -117,6 +137,12 @@ var StepRunEventSeverity;
|
|
|
117
137
|
StepRunEventSeverity["WARNING"] = "WARNING";
|
|
118
138
|
StepRunEventSeverity["CRITICAL"] = "CRITICAL";
|
|
119
139
|
})(StepRunEventSeverity || (exports.StepRunEventSeverity = StepRunEventSeverity = {}));
|
|
140
|
+
var WorkerRuntimeSDKs;
|
|
141
|
+
(function (WorkerRuntimeSDKs) {
|
|
142
|
+
WorkerRuntimeSDKs["GOLANG"] = "GOLANG";
|
|
143
|
+
WorkerRuntimeSDKs["PYTHON"] = "PYTHON";
|
|
144
|
+
WorkerRuntimeSDKs["TYPESCRIPT"] = "TYPESCRIPT";
|
|
145
|
+
})(WorkerRuntimeSDKs || (exports.WorkerRuntimeSDKs = WorkerRuntimeSDKs = {}));
|
|
120
146
|
var PullRequestState;
|
|
121
147
|
(function (PullRequestState) {
|
|
122
148
|
PullRequestState["Open"] = "open";
|
package/clients/rest/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import api
|
|
1
|
+
import api from './api';
|
|
2
2
|
import { Api } from './generated/Api';
|
|
3
3
|
import { Worker as _Worker, Workflow as _Workflow } from './generated/data-contracts';
|
|
4
4
|
import * as APIContracts from './generated/data-contracts';
|
|
5
5
|
type ApiWorker = _Worker;
|
|
6
6
|
type ApiWorkflow = _Workflow;
|
|
7
|
-
export { ApiWorker, ApiWorkflow, APIContracts, Api
|
|
7
|
+
export { ApiWorker, ApiWorkflow, APIContracts, Api };
|
|
8
8
|
export default api;
|
package/clients/rest/index.js
CHANGED
|
@@ -15,18 +15,29 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
37
|
};
|
|
25
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
27
|
-
const api_1 =
|
|
28
|
-
Object.defineProperty(exports, "cloudApi", { enumerable: true, get: function () { return api_1.cloudApi; } });
|
|
29
|
-
Object.defineProperty(exports, "CloudApi", { enumerable: true, get: function () { return api_1.CloudApi; } });
|
|
39
|
+
exports.Api = exports.APIContracts = void 0;
|
|
40
|
+
const api_1 = __importDefault(require("./api"));
|
|
30
41
|
const Api_1 = require("./generated/Api");
|
|
31
42
|
Object.defineProperty(exports, "Api", { enumerable: true, get: function () { return Api_1.Api; } });
|
|
32
43
|
const APIContracts = __importStar(require("./generated/data-contracts"));
|
|
@@ -79,33 +79,38 @@ class WebhookHandler {
|
|
|
79
79
|
expressHandler({ secret }) {
|
|
80
80
|
return (req, res) => {
|
|
81
81
|
if (req.method === 'GET') {
|
|
82
|
-
res.
|
|
83
|
-
res.send(okMessage);
|
|
82
|
+
res.status(200).send(okMessage);
|
|
84
83
|
return;
|
|
85
84
|
}
|
|
86
85
|
if (req.method === 'PUT') {
|
|
87
|
-
|
|
86
|
+
let { body } = req;
|
|
87
|
+
if (typeof body !== 'string') {
|
|
88
|
+
body = JSON.stringify(body);
|
|
89
|
+
}
|
|
90
|
+
this.getHealthcheckResponse(body, req.headers['x-hatchet-signature'], secret)
|
|
88
91
|
.then((resp) => {
|
|
89
|
-
res.
|
|
90
|
-
res.json(resp);
|
|
92
|
+
res.status(200).json(resp);
|
|
91
93
|
})
|
|
92
94
|
.catch((err) => {
|
|
93
|
-
res.
|
|
95
|
+
res.status(500);
|
|
94
96
|
this.worker.logger.error(`Error handling request: ${err.message}`);
|
|
95
97
|
});
|
|
96
98
|
return;
|
|
97
99
|
}
|
|
98
100
|
if (req.method !== 'POST') {
|
|
99
|
-
res.
|
|
100
|
-
res.json({ error: 'Method not allowed' });
|
|
101
|
+
res.status(405).json({ error: 'Method not allowed' });
|
|
101
102
|
return;
|
|
102
103
|
}
|
|
103
|
-
|
|
104
|
+
let action = req.body;
|
|
105
|
+
if (typeof action !== 'string') {
|
|
106
|
+
action = JSON.stringify(action);
|
|
107
|
+
}
|
|
108
|
+
this.handle(action, req.headers['x-hatchet-signature'], secret)
|
|
104
109
|
.then(() => {
|
|
105
|
-
res.
|
|
110
|
+
res.status(200);
|
|
106
111
|
})
|
|
107
112
|
.catch((err) => {
|
|
108
|
-
res.
|
|
113
|
+
res.status(500);
|
|
109
114
|
this.worker.logger.error(`Error handling request: ${err.message}`);
|
|
110
115
|
});
|
|
111
116
|
};
|
|
@@ -6,16 +6,9 @@ import { Workflow } from '../../workflow';
|
|
|
6
6
|
import { Logger } from '../../util/logger';
|
|
7
7
|
import { WebhookHandler } from './handler';
|
|
8
8
|
import { WebhookWorkerCreateRequest } from '../rest/generated/data-contracts';
|
|
9
|
-
import { z } from 'zod';
|
|
10
9
|
import { Context, StepRunFunction } from '../../step';
|
|
11
10
|
import { WorkerLabels } from '../dispatcher/dispatcher-client';
|
|
12
|
-
|
|
13
|
-
type ActionFunction = StepRunFunction<any, any> | ((ctx: any) => string | Promise<string>);
|
|
14
|
-
type ActionRegistryRecord = {
|
|
15
|
-
func: ActionFunction;
|
|
16
|
-
compute?: z.infer<typeof ComputeSchema>;
|
|
17
|
-
};
|
|
18
|
-
export type ActionRegistry = Record<Action['actionId'], ActionRegistryRecord>;
|
|
11
|
+
export type ActionRegistry = Record<Action['actionId'], Function>;
|
|
19
12
|
export interface WorkerOpts {
|
|
20
13
|
name: string;
|
|
21
14
|
handleKill?: boolean;
|
|
@@ -51,7 +44,7 @@ export declare class Worker {
|
|
|
51
44
|
*/
|
|
52
45
|
register_workflow(initWorkflow: Workflow): Promise<void>;
|
|
53
46
|
registerWorkflow(initWorkflow: Workflow): Promise<void>;
|
|
54
|
-
registerAction<T, K>(actionId: string, action: StepRunFunction<T, K
|
|
47
|
+
registerAction<T, K>(actionId: string, action: StepRunFunction<T, K>): void;
|
|
55
48
|
handleStartStepRun(action: Action): Promise<void>;
|
|
56
49
|
handleStartGroupKeyRun(action: Action): Promise<void>;
|
|
57
50
|
getStepActionEvent(action: Action, eventType: StepActionEventType, payload?: any): StepActionEvent;
|
|
@@ -63,4 +56,3 @@ export declare class Worker {
|
|
|
63
56
|
handleAction(action: Action): Promise<void>;
|
|
64
57
|
upsertLabels(labels: WorkerLabels): Promise<WorkerLabels>;
|
|
65
58
|
}
|
|
66
|
-
export {};
|