@cobaltio/cobalt-js 9.2.0-beta.6 → 9.2.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/.claude/skills/method/SKILL.md +282 -0
- package/.claude/skills/review-pr/SKILL.md +80 -0
- package/.claude/skills/style/SKILL.md +67 -0
- package/.claude/skills/verify/SKILL.md +85 -0
- package/.github/workflows/npm-publish.yml +6 -7
- package/CLAUDE.md +99 -19
- package/cobalt.d.ts +72 -63
- package/cobalt.js +422 -365
- package/cobalt.ts +101 -123
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/main.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/Cobalt.html +42 -33
- package/docs/enums/AuthStatus.html +2 -2
- package/docs/enums/AuthType.html +3 -3
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +1 -1
- package/docs/interfaces/Application.html +19 -15
- package/docs/interfaces/CobaltOptions.html +3 -3
- package/docs/interfaces/Config.html +2 -2
- package/docs/interfaces/ConfigField.html +4 -4
- package/docs/interfaces/ConfigPayload.html +5 -5
- package/docs/interfaces/ConfigWorkflow.html +2 -2
- package/docs/interfaces/ExecuteWorkflowPayload.html +5 -5
- package/docs/interfaces/Execution.html +2 -2
- package/docs/interfaces/ExecutionFilters.html +16 -0
- package/docs/interfaces/GetExecutionsParams.html +19 -0
- package/docs/interfaces/InputField.html +10 -10
- package/docs/interfaces/Label.html +4 -4
- package/docs/interfaces/PublicWorkflow.html +9 -9
- package/docs/interfaces/PublicWorkflowPayload.html +5 -5
- package/docs/interfaces/PublicWorkflowsPayload.html +13 -2
- package/docs/interfaces/RuleOptions.html +2 -2
- package/docs/interfaces/UpdateConfigPayload.html +6 -6
- package/docs/interfaces/WorkflowPayload.html +5 -5
- package/docs/interfaces/WorkflowPayloadResponse.html +2 -2
- package/docs/llms.txt +260 -248
- package/docs/modules.html +1 -1
- package/docs/types/ExecutionSource.html +2 -0
- package/docs/types/ExecutionStatus.html +2 -0
- package/docs/types/ExecutionType.html +2 -0
- package/package.json +4 -4
- package/tsconfig.json +12 -12
- package/docs/interfaces/AuthConfig.html +0 -9
- package/docs/interfaces/ConnectedAccount.html +0 -14
- package/docs/interfaces/KeyBasedParams.html +0 -7
- package/docs/interfaces/OAuthParams.html +0 -9
package/cobalt.d.ts
CHANGED
|
@@ -9,21 +9,6 @@ export declare enum AuthStatus {
|
|
|
9
9
|
Active = "active",
|
|
10
10
|
Expired = "expired"
|
|
11
11
|
}
|
|
12
|
-
/** A connected account for an application. */
|
|
13
|
-
export interface ConnectedAccount {
|
|
14
|
-
/** The unique identifier for this connected account. */
|
|
15
|
-
connection_id: string;
|
|
16
|
-
/** The identifier of the auth config. */
|
|
17
|
-
auth_config_id: string;
|
|
18
|
-
/** The identifier (username, email, etc.) of the connected account. */
|
|
19
|
-
identifier: unknown;
|
|
20
|
-
/** The auth type used to connect the account. */
|
|
21
|
-
auth_type: AuthType;
|
|
22
|
-
/** The timestamp at which the account was connected. */
|
|
23
|
-
connectedAt: string;
|
|
24
|
-
/** The current status of the connection. */
|
|
25
|
-
status?: AuthStatus;
|
|
26
|
-
}
|
|
27
12
|
/** An application in Cobalt. */
|
|
28
13
|
export interface Application {
|
|
29
14
|
/** Application ID */
|
|
@@ -48,7 +33,16 @@ export interface Application {
|
|
|
48
33
|
[key in AuthType]: InputField[];
|
|
49
34
|
};
|
|
50
35
|
/** The list of connected accounts for this application */
|
|
51
|
-
connected_accounts?:
|
|
36
|
+
connected_accounts?: {
|
|
37
|
+
/** The identifier (username, email, etc.) of the connected account. */
|
|
38
|
+
identifier: unknown;
|
|
39
|
+
/** The auth type used to connect the account. */
|
|
40
|
+
auth_type: AuthType;
|
|
41
|
+
/** The timestamp at which the account was connected. */
|
|
42
|
+
connectedAt: string;
|
|
43
|
+
/** The current status of the connection. */
|
|
44
|
+
status?: AuthStatus;
|
|
45
|
+
}[];
|
|
52
46
|
/**
|
|
53
47
|
* The type of auth used by application.
|
|
54
48
|
* @deprecated Check `auth_type_options` and `connected_accounts` for multiple auth types support.
|
|
@@ -70,16 +64,6 @@ export interface Application {
|
|
|
70
64
|
*/
|
|
71
65
|
auth_input_map?: InputField[];
|
|
72
66
|
}
|
|
73
|
-
export interface AuthConfig {
|
|
74
|
-
/** The auth config ID. */
|
|
75
|
-
_id: string;
|
|
76
|
-
/** The display name of the auth config. */
|
|
77
|
-
name: string;
|
|
78
|
-
/** The description of the auth config. */
|
|
79
|
-
description?: string;
|
|
80
|
-
/** Whether the auth config is the default auth config for the application. */
|
|
81
|
-
is_default?: boolean;
|
|
82
|
-
}
|
|
83
67
|
/** An Input field to take input from the user. */
|
|
84
68
|
export interface InputField {
|
|
85
69
|
/** Key name of the field. */
|
|
@@ -102,24 +86,6 @@ export interface InputField {
|
|
|
102
86
|
value: string;
|
|
103
87
|
}[];
|
|
104
88
|
}
|
|
105
|
-
export interface OAuthParams {
|
|
106
|
-
/** The application slug. */
|
|
107
|
-
slug: string;
|
|
108
|
-
/** The identifier of the auth config. */
|
|
109
|
-
authConfig?: string;
|
|
110
|
-
/** The key value pairs of auth data. */
|
|
111
|
-
payload?: Record<string, string>;
|
|
112
|
-
/** Whether to close the authentication window automatically. */
|
|
113
|
-
autoClose?: boolean;
|
|
114
|
-
}
|
|
115
|
-
export interface KeyBasedParams {
|
|
116
|
-
/** The application slug. */
|
|
117
|
-
slug: string;
|
|
118
|
-
/** The identifier of the auth config. */
|
|
119
|
-
authConfig?: string;
|
|
120
|
-
/** The key value pairs of auth data. */
|
|
121
|
-
payload?: Record<string, string>;
|
|
122
|
-
}
|
|
123
89
|
/** The payload object for config. */
|
|
124
90
|
export interface ConfigPayload {
|
|
125
91
|
/** The application slug. */
|
|
@@ -207,13 +173,53 @@ export interface PublicWorkflowPayload {
|
|
|
207
173
|
/** The application slug in which this workflow should be created. */
|
|
208
174
|
slug?: string;
|
|
209
175
|
}
|
|
176
|
+
/** Parameters for filtering and paginating the list of workflows. */
|
|
210
177
|
export interface PublicWorkflowsPayload extends PaginationProps {
|
|
178
|
+
/** Filter workflows by the application slug. */
|
|
211
179
|
slug?: string;
|
|
180
|
+
/** Filter workflows by name (partial match). */
|
|
181
|
+
name?: string;
|
|
182
|
+
/** Filter workflows created on or after this ISO 8601 date string. */
|
|
183
|
+
start_date?: string;
|
|
184
|
+
/** Filter workflows created on or before this ISO 8601 date string. */
|
|
185
|
+
end_date?: string;
|
|
186
|
+
/** Filter by workflow published status. `true` returns only published workflows, `false` returns only drafts. */
|
|
187
|
+
published?: boolean;
|
|
188
|
+
/** Any additional filter keys supported by the API. */
|
|
189
|
+
[key: string]: string | number | boolean | undefined;
|
|
212
190
|
}
|
|
213
191
|
interface PaginationProps {
|
|
214
192
|
page?: number;
|
|
215
193
|
limit?: number;
|
|
216
194
|
}
|
|
195
|
+
/** The current status of a workflow execution. */
|
|
196
|
+
export type ExecutionStatus = "COMPLETED" | "RUNNING" | "ERRORED" | "STOPPED" | "STOPPING" | "TIMED_OUT";
|
|
197
|
+
/** The trigger source that initiated a workflow execution. */
|
|
198
|
+
export type ExecutionSource = "Event" | "Schedule" | "API Call";
|
|
199
|
+
/** Whether a workflow execution runs synchronously (waits for result) or asynchronously (fire-and-forget). */
|
|
200
|
+
export type ExecutionType = "SYNC" | "ASYNC";
|
|
201
|
+
/** Filters for narrowing down the list of workflow executions. */
|
|
202
|
+
export interface ExecutionFilters {
|
|
203
|
+
/** Filter executions by their current status. */
|
|
204
|
+
status?: ExecutionStatus;
|
|
205
|
+
/** Filter executions by workflow name (partial match). */
|
|
206
|
+
workflow_name?: string;
|
|
207
|
+
/** Filter executions by workflow ID. */
|
|
208
|
+
workflow_id?: string;
|
|
209
|
+
/** Filter executions that started on or after this ISO 8601 date string. */
|
|
210
|
+
start_date?: string;
|
|
211
|
+
/** Filter executions that started on or before this ISO 8601 date string. */
|
|
212
|
+
end_date?: string;
|
|
213
|
+
/** Filter by how the execution was invoked — synchronously or asynchronously. */
|
|
214
|
+
execution_type?: ExecutionType;
|
|
215
|
+
/** Filter by the trigger source that initiated the execution. */
|
|
216
|
+
execution_source?: ExecutionSource;
|
|
217
|
+
}
|
|
218
|
+
/** Parameters for filtering and paginating the list of workflow executions. */
|
|
219
|
+
export interface GetExecutionsParams extends PaginationProps, ExecutionFilters {
|
|
220
|
+
/** Any additional filter keys supported by the API. */
|
|
221
|
+
[key: string]: string | number | undefined;
|
|
222
|
+
}
|
|
217
223
|
interface PaginatedResponse<T> {
|
|
218
224
|
docs: T[];
|
|
219
225
|
totalDocs: number;
|
|
@@ -291,7 +297,7 @@ export interface Execution {
|
|
|
291
297
|
name: string;
|
|
292
298
|
icon?: string;
|
|
293
299
|
};
|
|
294
|
-
status:
|
|
300
|
+
status: ExecutionStatus;
|
|
295
301
|
associated_workflow: {
|
|
296
302
|
_id: string;
|
|
297
303
|
name: string;
|
|
@@ -366,30 +372,27 @@ declare class Cobalt {
|
|
|
366
372
|
* @returns {Promise<Application[]>} The list of applications.
|
|
367
373
|
*/
|
|
368
374
|
getApps(): Promise<Application[]>;
|
|
369
|
-
/**
|
|
370
|
-
* Returns the auth configs for the specified application.
|
|
371
|
-
* @param {String} slug The application slug.
|
|
372
|
-
* @returns {Promise<AuthConfig[]>} The auth configs.
|
|
373
|
-
*/
|
|
374
|
-
getAuthConfigs(slug: string): Promise<AuthConfig[]>;
|
|
375
375
|
/**
|
|
376
376
|
* Returns the auth URL that users can use to authenticate themselves to the
|
|
377
377
|
* specified application.
|
|
378
378
|
* @private
|
|
379
|
-
* @param {
|
|
379
|
+
* @param {String} slug The application slug.
|
|
380
|
+
* @param {Object.<string, string>} [params] The key value pairs of auth data.
|
|
380
381
|
* @returns {Promise<String>} The auth URL where users can authenticate themselves.
|
|
381
382
|
*/
|
|
382
383
|
private getOAuthUrl;
|
|
383
384
|
/**
|
|
384
385
|
* Handle OAuth for the specified application.
|
|
385
386
|
* @private
|
|
386
|
-
* @param {
|
|
387
|
+
* @param {String} slug The application slug.
|
|
388
|
+
* @param {Object.<string, string>} [params] The key value pairs of auth data.
|
|
387
389
|
* @returns {Promise<Boolean>} Whether the user authenticated.
|
|
388
390
|
*/
|
|
389
391
|
private oauth;
|
|
390
392
|
/**
|
|
391
393
|
* Save auth data for the specified keybased application.
|
|
392
|
-
* @param {
|
|
394
|
+
* @param {String} slug The application slug.
|
|
395
|
+
* @param {Object.<string, string>} [payload] The key value pairs of auth data.
|
|
393
396
|
* @returns {Promise<Boolean>} Whether the auth data was saved successfully.
|
|
394
397
|
*/
|
|
395
398
|
private keybased;
|
|
@@ -397,28 +400,23 @@ declare class Cobalt {
|
|
|
397
400
|
* Connects the specified application using the provided authentication type and optional auth data.
|
|
398
401
|
* @param params - The parameters for connecting the application.
|
|
399
402
|
* @param params.slug - The application slug.
|
|
400
|
-
* @param params.authConfig - The identifier of the auth config.
|
|
401
403
|
* @param params.type - The authentication type to use. If not provided, it defaults to `keybased` if payload is provided, otherwise `oauth2`.
|
|
402
404
|
* @param params.payload - key-value pairs of authentication data required for the specified auth type.
|
|
403
|
-
* @param params.autoClose - Whether to close the authentication window automatically. If not provided, it defaults to `true`.
|
|
404
405
|
* @returns A promise that resolves to true if the connection was successful, otherwise false.
|
|
405
406
|
* @throws Throws an error if the authentication type is invalid or the connection fails.
|
|
406
407
|
*/
|
|
407
|
-
connect({ slug,
|
|
408
|
+
connect({ slug, type, payload, }: {
|
|
408
409
|
slug: string;
|
|
409
|
-
authConfig?: string;
|
|
410
410
|
type?: AuthType;
|
|
411
411
|
payload?: Record<string, string>;
|
|
412
|
-
autoClose?: boolean;
|
|
413
412
|
}): Promise<boolean>;
|
|
414
413
|
/**
|
|
415
414
|
* Disconnect the specified application and remove any associated data from Cobalt.
|
|
416
415
|
* @param {String} slug The application slug.
|
|
417
416
|
* @param {AuthType} [type] The authentication type to use. If not provided, it'll remove all the connected accounts.
|
|
418
|
-
* @param {String} [authConfig] The identifier of the auth config.
|
|
419
417
|
* @returns {Promise<unknown>}
|
|
420
418
|
*/
|
|
421
|
-
disconnect(slug: string, type?: AuthType
|
|
419
|
+
disconnect(slug: string, type?: AuthType): Promise<unknown>;
|
|
422
420
|
/**
|
|
423
421
|
* Returns the specified config, or creates one if it doesn't exist.
|
|
424
422
|
* @param {ConfigPayload} payload The payload object for config.
|
|
@@ -491,11 +489,15 @@ declare class Cobalt {
|
|
|
491
489
|
* Returns the private workflows for the specified application.
|
|
492
490
|
* @param {Object} params
|
|
493
491
|
* @param {String} [params.slug]
|
|
492
|
+
* @param {String} [params.name]
|
|
494
493
|
* @param {Number} [params.page]
|
|
495
494
|
* @param {Number} [params.limit]
|
|
495
|
+
* @param {String} [params.start_date] ISO date string — filter workflows created on or after this date.
|
|
496
|
+
* @param {String} [params.end_date] ISO date string — filter workflows created on or before this date.
|
|
497
|
+
* @param {Boolean} [params.published] Filter by workflow published status.
|
|
496
498
|
* @returns
|
|
497
499
|
*/
|
|
498
|
-
getWorkflows(
|
|
500
|
+
getWorkflows({ page, limit, ...rest }?: PublicWorkflowsPayload): Promise<PaginatedResponse<PublicWorkflow>>;
|
|
499
501
|
/**
|
|
500
502
|
* Create a public workflow for the linked account.
|
|
501
503
|
* @param {Object} params
|
|
@@ -532,9 +534,16 @@ declare class Cobalt {
|
|
|
532
534
|
* @param {Object} [params]
|
|
533
535
|
* @param {Number} [params.page]
|
|
534
536
|
* @param {Number} [params.limit]
|
|
537
|
+
* @param {String} [params.status] - Filter by execution status (COMPLETED, RUNNING, ERRORED, STOPPED, STOPPING, TIMED_OUT)
|
|
538
|
+
* @param {String} [params.workflow_name] - Filter by workflow name
|
|
539
|
+
* @param {String} [params.workflow_id] - Filter by workflow ID
|
|
540
|
+
* @param {String} [params.start_date] - Filter executions after this date
|
|
541
|
+
* @param {String} [params.end_date] - Filter executions before this date
|
|
542
|
+
* @param {String} [params.execution_type] - Filter by execution type (SYNC, ASYNC)
|
|
543
|
+
* @param {String} [params.execution_source] - Filter by execution source (Event, Schedule, API Call)
|
|
535
544
|
* @returns {Promise<PaginatedResponse<Execution>>} The paginated workflow execution logs.
|
|
536
545
|
*/
|
|
537
|
-
getExecutions({ page, limit }?:
|
|
546
|
+
getExecutions({ page, limit, ...rest }?: GetExecutionsParams): Promise<PaginatedResponse<Execution>>;
|
|
538
547
|
/**
|
|
539
548
|
* Returns the specified workflow execution log.
|
|
540
549
|
* @param {String} executionId The execution ID.
|