@bluecopa/core 0.1.57 → 0.1.58

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.
@@ -21,3 +21,4 @@ export * as permissions from './permissions';
21
21
  export * as clientIp from './clientIp';
22
22
  export * as emailEngine from './emailEngine';
23
23
  export * as tcn from './tcn';
24
+ export * as webcron from './webcron';
@@ -0,0 +1,4 @@
1
+ import { Execution, ListExecutionsParams } from './types';
2
+ export declare function listExecutions(params?: ListExecutionsParams): Promise<Execution[]>;
3
+ export declare function getExecution(id: string): Promise<Execution>;
4
+ export declare function retryExecution(id: string): Promise<Execution>;
@@ -0,0 +1,7 @@
1
+ export * from './types';
2
+ export * from './webhooks';
3
+ export * from './schedules';
4
+ export * from './executions';
5
+ export * from './tasks';
6
+ export * from './inspection';
7
+ export * from './trigger';
@@ -0,0 +1,7 @@
1
+ import { InspectionBin, CreateInspectionBinRequest, InspectionRequest, PaginationParams } from './types';
2
+ export declare function listBins(): Promise<InspectionBin[]>;
3
+ export declare function createBin(data: CreateInspectionBinRequest): Promise<InspectionBin>;
4
+ export declare function getBin(id: string): Promise<InspectionBin>;
5
+ export declare function deleteBin(id: string): Promise<void>;
6
+ export declare function getBinRequests(id: string, params?: PaginationParams): Promise<InspectionRequest[]>;
7
+ export declare function clearBinRequests(id: string): Promise<void>;
@@ -0,0 +1,9 @@
1
+ import { Schedule, UpdateScheduleRequest } from './types';
2
+ export declare function getSchedule(id: string): Promise<Schedule>;
3
+ export declare function updateSchedule(id: string, data: UpdateScheduleRequest): Promise<Schedule>;
4
+ export declare function deleteSchedule(id: string): Promise<void>;
5
+ export declare function pauseSchedule(id: string): Promise<Schedule>;
6
+ export declare function resumeSchedule(id: string): Promise<Schedule>;
7
+ export declare function triggerSchedule(id: string): Promise<{
8
+ executionId: string;
9
+ }>;
@@ -0,0 +1,10 @@
1
+ import { Task, CreateTaskRequest, TaskProgressRequest, TaskSignalRequest } from './types';
2
+ export declare function listTasks(): Promise<Task[]>;
3
+ export declare function createTask(data: CreateTaskRequest): Promise<Task>;
4
+ export declare function getTask(id: string): Promise<Task>;
5
+ export declare function cancelTask(id: string): Promise<Task>;
6
+ export declare function retryTask(id: string): Promise<{
7
+ taskId: string;
8
+ }>;
9
+ export declare function progressTask(id: string, data: TaskProgressRequest): Promise<void>;
10
+ export declare function signalTask(id: string, data: TaskSignalRequest, branchId?: string): Promise<Task>;
@@ -0,0 +1,15 @@
1
+ export interface TriggerWorkflowRequest {
2
+ triggerData?: Record<string, unknown>;
3
+ }
4
+ export interface TriggerWorkflowResponse {
5
+ workflow_id: string;
6
+ trigger_id: string;
7
+ workflow_instance_id: string;
8
+ }
9
+ /**
10
+ * Triggers a workflow execution by process sheet ID
11
+ * @param id - The workflow/process sheet ID
12
+ * @param data - Optional trigger data payload
13
+ * @returns Trigger response with workflow instance details
14
+ */
15
+ export declare function triggerWorkflowById(id: string, data?: TriggerWorkflowRequest): Promise<TriggerWorkflowResponse[]>;
@@ -0,0 +1,170 @@
1
+ export interface Webhook {
2
+ id: string;
3
+ name: string;
4
+ description?: string;
5
+ url: string;
6
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
7
+ headers?: Record<string, string>;
8
+ body?: string;
9
+ maxRetries: number;
10
+ retryDelaySeconds: number;
11
+ timeoutSeconds: number;
12
+ authType?: ("hmac" | "basic" | "bearer")[];
13
+ notificationUrl?: string;
14
+ notifyOnSuccess: boolean;
15
+ notifyOnFailure: boolean;
16
+ isActive: boolean;
17
+ createdAt: string;
18
+ updatedAt: string;
19
+ }
20
+ export interface CreateWebhookRequest {
21
+ name: string;
22
+ description?: string;
23
+ url: string;
24
+ method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
25
+ headers?: Record<string, string>;
26
+ body?: string;
27
+ maxRetries?: number;
28
+ retryDelaySeconds?: number;
29
+ timeoutSeconds?: number;
30
+ authType?: ("hmac" | "basic" | "bearer")[];
31
+ signingSecret?: string;
32
+ basicAuthUsername?: string;
33
+ basicAuthPassword?: string;
34
+ bearerToken?: string;
35
+ notificationUrl?: string;
36
+ notifyOnSuccess?: boolean;
37
+ notifyOnFailure?: boolean;
38
+ isActive?: boolean;
39
+ }
40
+ export interface UpdateWebhookRequest extends Partial<CreateWebhookRequest> {
41
+ }
42
+ export interface Schedule {
43
+ id: string;
44
+ webhookId: string;
45
+ type: "one_time" | "recurring";
46
+ scheduledAt?: string;
47
+ cronExpression?: string;
48
+ timezone?: string;
49
+ status: "active" | "paused" | "completed" | "cancelled";
50
+ lastRunAt?: string;
51
+ nextRunAt?: string;
52
+ runCount: string;
53
+ createdAt: string;
54
+ updatedAt: string;
55
+ }
56
+ export interface CreateScheduleRequest {
57
+ type: "one_time" | "recurring";
58
+ scheduledAt?: string;
59
+ cronExpression?: string;
60
+ timezone?: string;
61
+ }
62
+ export interface UpdateScheduleRequest {
63
+ cronExpression?: string;
64
+ timezone?: string;
65
+ }
66
+ export interface Execution {
67
+ id: string;
68
+ webhookId: string;
69
+ scheduleId?: string;
70
+ status: "pending" | "running" | "success" | "failed" | "retrying";
71
+ attemptNumber: number;
72
+ maxAttempts: number;
73
+ requestUrl: string;
74
+ requestMethod: string;
75
+ requestHeaders?: Record<string, string>;
76
+ requestBody?: string;
77
+ responseStatus?: number;
78
+ responseHeaders?: Record<string, string>;
79
+ responseBody?: string;
80
+ startedAt?: string;
81
+ completedAt?: string;
82
+ durationMs?: number;
83
+ errorMessage?: string;
84
+ errorCode?: string;
85
+ createdAt: string;
86
+ updatedAt: string;
87
+ }
88
+ export interface ListExecutionsParams {
89
+ limit?: number;
90
+ offset?: number;
91
+ status?: string;
92
+ webhookId?: string;
93
+ from?: string;
94
+ to?: string;
95
+ }
96
+ export interface Task {
97
+ id: string;
98
+ status: "pending" | "running" | "waiting" | "sleeping" | "fan_out" | "complete" | "failed" | "cancelled";
99
+ webhookId: string;
100
+ initialInput?: Record<string, unknown>;
101
+ continuation?: Record<string, unknown>;
102
+ currentStep: number;
103
+ form?: Record<string, unknown>;
104
+ result?: Record<string, unknown>;
105
+ error?: string;
106
+ errorCode?: string;
107
+ parentTaskId?: string;
108
+ branchId?: string;
109
+ createdAt: string;
110
+ updatedAt: string;
111
+ completedAt?: string;
112
+ }
113
+ export interface CreateTaskRequest {
114
+ webhookId: string;
115
+ initialInput?: Record<string, unknown>;
116
+ maxSteps?: number;
117
+ stepTimeoutMs?: number;
118
+ }
119
+ export interface TaskProgressRequest {
120
+ message: string;
121
+ details?: Record<string, unknown>;
122
+ }
123
+ export interface TaskSignalRequest {
124
+ payload: Record<string, unknown>;
125
+ }
126
+ export interface InspectionBin {
127
+ id: string;
128
+ name: string;
129
+ slug: string;
130
+ responseStatusCode: number;
131
+ responseHeaders?: Record<string, string>;
132
+ responseBody?: string;
133
+ responseDelayMs: number;
134
+ maxRequests: number;
135
+ requestCount: number;
136
+ expiresAt?: string;
137
+ isActive: boolean;
138
+ createdAt: string;
139
+ updatedAt: string;
140
+ }
141
+ export interface CreateInspectionBinRequest {
142
+ name: string;
143
+ responseStatusCode?: number;
144
+ responseHeaders?: Record<string, string>;
145
+ responseBody?: string;
146
+ responseDelayMs?: number;
147
+ maxRequests?: number;
148
+ }
149
+ export interface InspectionRequest {
150
+ id: string;
151
+ binId: string;
152
+ method: string;
153
+ path: string;
154
+ queryString?: string;
155
+ headers: Record<string, string>;
156
+ body?: string;
157
+ contentType?: string;
158
+ clientIp?: string;
159
+ userAgent?: string;
160
+ receivedAt: string;
161
+ }
162
+ export interface PaginationParams {
163
+ limit?: number;
164
+ offset?: number;
165
+ }
166
+ export interface WebcronHealth {
167
+ status: string;
168
+ database: string;
169
+ timestamp: string;
170
+ }
@@ -0,0 +1,12 @@
1
+ import { Webhook, CreateWebhookRequest, UpdateWebhookRequest, Schedule, Execution, CreateScheduleRequest, PaginationParams } from './types';
2
+ export declare function listWebhooks(): Promise<Webhook[]>;
3
+ export declare function createWebhook(data: CreateWebhookRequest): Promise<Webhook>;
4
+ export declare function getWebhook(id: string): Promise<Webhook>;
5
+ export declare function updateWebhook(id: string, data: UpdateWebhookRequest): Promise<Webhook>;
6
+ export declare function deleteWebhook(id: string): Promise<void>;
7
+ export declare function testWebhook(id: string): Promise<{
8
+ executionId: string;
9
+ }>;
10
+ export declare function getWebhookExecutions(id: string, params?: PaginationParams): Promise<Execution[]>;
11
+ export declare function getWebhookSchedules(id: string): Promise<Schedule[]>;
12
+ export declare function createWebhookSchedule(webhookId: string, data: CreateScheduleRequest): Promise<Schedule>;
package/dist/index.d.ts CHANGED
@@ -44,3 +44,5 @@ export type { TcnProcessDialData } from './api/tcn/processManualDial';
44
44
  export type { TcnConnectedParty } from './api/tcn/agentGetConnectedParty';
45
45
  export type { TcnCallData } from './api/tcn/getCallData';
46
46
  export type { FilterOnSenderId, EmailMessage, PageChunkEmailMessage, } from './api/emailEngine/getMessageBySenderId';
47
+ export type { Webhook, CreateWebhookRequest, UpdateWebhookRequest, Schedule, CreateScheduleRequest, UpdateScheduleRequest, Execution, ListExecutionsParams, Task, CreateTaskRequest, TaskProgressRequest, TaskSignalRequest, InspectionBin, CreateInspectionBinRequest, InspectionRequest, PaginationParams, WebcronHealth, } from './api/webcron/types';
48
+ export type { TriggerWorkflowRequest, TriggerWorkflowResponse, } from './api/webcron/trigger';