@cobaltio/cobalt-js 9.2.0-beta.5 → 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.
Files changed (47) hide show
  1. package/.claude/skills/method/SKILL.md +282 -0
  2. package/.claude/skills/review-pr/SKILL.md +80 -0
  3. package/.claude/skills/style/SKILL.md +67 -0
  4. package/.claude/skills/verify/SKILL.md +85 -0
  5. package/.github/workflows/npm-publish.yml +6 -7
  6. package/CLAUDE.md +99 -19
  7. package/cobalt.d.ts +62 -49
  8. package/cobalt.js +422 -365
  9. package/cobalt.ts +101 -121
  10. package/docs/assets/hierarchy.js +1 -1
  11. package/docs/assets/main.js +1 -1
  12. package/docs/assets/navigation.js +1 -1
  13. package/docs/assets/search.js +1 -1
  14. package/docs/classes/Cobalt.html +42 -33
  15. package/docs/enums/AuthStatus.html +2 -2
  16. package/docs/enums/AuthType.html +3 -3
  17. package/docs/hierarchy.html +1 -1
  18. package/docs/index.html +1 -1
  19. package/docs/interfaces/Application.html +16 -17
  20. package/docs/interfaces/CobaltOptions.html +3 -3
  21. package/docs/interfaces/Config.html +2 -2
  22. package/docs/interfaces/ConfigField.html +4 -4
  23. package/docs/interfaces/ConfigPayload.html +5 -5
  24. package/docs/interfaces/ConfigWorkflow.html +2 -2
  25. package/docs/interfaces/ExecuteWorkflowPayload.html +5 -5
  26. package/docs/interfaces/Execution.html +2 -2
  27. package/docs/interfaces/ExecutionFilters.html +16 -0
  28. package/docs/interfaces/GetExecutionsParams.html +19 -0
  29. package/docs/interfaces/InputField.html +10 -10
  30. package/docs/interfaces/Label.html +4 -4
  31. package/docs/interfaces/PublicWorkflow.html +9 -9
  32. package/docs/interfaces/PublicWorkflowPayload.html +5 -5
  33. package/docs/interfaces/PublicWorkflowsPayload.html +13 -2
  34. package/docs/interfaces/RuleOptions.html +2 -2
  35. package/docs/interfaces/UpdateConfigPayload.html +6 -6
  36. package/docs/interfaces/WorkflowPayload.html +5 -5
  37. package/docs/interfaces/WorkflowPayloadResponse.html +2 -2
  38. package/docs/llms.txt +260 -229
  39. package/docs/modules.html +1 -1
  40. package/docs/types/ExecutionSource.html +2 -0
  41. package/docs/types/ExecutionStatus.html +2 -0
  42. package/docs/types/ExecutionType.html +2 -0
  43. package/package.json +4 -4
  44. package/tsconfig.json +12 -12
  45. package/docs/interfaces/AuthConfig.html +0 -9
  46. package/docs/interfaces/KeyBasedParams.html +0 -7
  47. package/docs/interfaces/OAuthParams.html +0 -9
package/cobalt.d.ts CHANGED
@@ -34,8 +34,6 @@ export interface Application {
34
34
  };
35
35
  /** The list of connected accounts for this application */
36
36
  connected_accounts?: {
37
- /** The identifier of the auth config. */
38
- auth_config_id: string;
39
37
  /** The identifier (username, email, etc.) of the connected account. */
40
38
  identifier: unknown;
41
39
  /** The auth type used to connect the account. */
@@ -66,16 +64,6 @@ export interface Application {
66
64
  */
67
65
  auth_input_map?: InputField[];
68
66
  }
69
- export interface AuthConfig {
70
- /** The auth config ID. */
71
- _id: string;
72
- /** The display name of the auth config. */
73
- name: string;
74
- /** The description of the auth config. */
75
- description?: string;
76
- /** Whether the auth config is the default auth config for the application. */
77
- is_default?: boolean;
78
- }
79
67
  /** An Input field to take input from the user. */
80
68
  export interface InputField {
81
69
  /** Key name of the field. */
@@ -98,24 +86,6 @@ export interface InputField {
98
86
  value: string;
99
87
  }[];
100
88
  }
101
- export interface OAuthParams {
102
- /** The application slug. */
103
- slug: string;
104
- /** The identifier of the auth config. */
105
- authConfig?: string;
106
- /** The key value pairs of auth data. */
107
- payload?: Record<string, string>;
108
- /** Whether to close the authentication window automatically. */
109
- autoClose?: boolean;
110
- }
111
- export interface KeyBasedParams {
112
- /** The application slug. */
113
- slug: string;
114
- /** The identifier of the auth config. */
115
- authConfig?: string;
116
- /** The key value pairs of auth data. */
117
- payload?: Record<string, string>;
118
- }
119
89
  /** The payload object for config. */
120
90
  export interface ConfigPayload {
121
91
  /** The application slug. */
@@ -203,13 +173,53 @@ export interface PublicWorkflowPayload {
203
173
  /** The application slug in which this workflow should be created. */
204
174
  slug?: string;
205
175
  }
176
+ /** Parameters for filtering and paginating the list of workflows. */
206
177
  export interface PublicWorkflowsPayload extends PaginationProps {
178
+ /** Filter workflows by the application slug. */
207
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;
208
190
  }
209
191
  interface PaginationProps {
210
192
  page?: number;
211
193
  limit?: number;
212
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
+ }
213
223
  interface PaginatedResponse<T> {
214
224
  docs: T[];
215
225
  totalDocs: number;
@@ -287,7 +297,7 @@ export interface Execution {
287
297
  name: string;
288
298
  icon?: string;
289
299
  };
290
- status: "COMPLETED" | "RUNNING" | "ERRORED" | "STOPPED" | "STOPPING" | "TIMED_OUT";
300
+ status: ExecutionStatus;
291
301
  associated_workflow: {
292
302
  _id: string;
293
303
  name: string;
@@ -362,30 +372,27 @@ declare class Cobalt {
362
372
  * @returns {Promise<Application[]>} The list of applications.
363
373
  */
364
374
  getApps(): Promise<Application[]>;
365
- /**
366
- * Returns the auth configs for the specified application.
367
- * @param {String} slug The application slug.
368
- * @returns {Promise<AuthConfig[]>} The auth configs.
369
- */
370
- getAuthConfigs(slug: string): Promise<AuthConfig[]>;
371
375
  /**
372
376
  * Returns the auth URL that users can use to authenticate themselves to the
373
377
  * specified application.
374
378
  * @private
375
- * @param {OAuthParams} params The OAuth parameters.
379
+ * @param {String} slug The application slug.
380
+ * @param {Object.<string, string>} [params] The key value pairs of auth data.
376
381
  * @returns {Promise<String>} The auth URL where users can authenticate themselves.
377
382
  */
378
383
  private getOAuthUrl;
379
384
  /**
380
385
  * Handle OAuth for the specified application.
381
386
  * @private
382
- * @param {OAuthParams} params The OAuth parameters.
387
+ * @param {String} slug The application slug.
388
+ * @param {Object.<string, string>} [params] The key value pairs of auth data.
383
389
  * @returns {Promise<Boolean>} Whether the user authenticated.
384
390
  */
385
391
  private oauth;
386
392
  /**
387
393
  * Save auth data for the specified keybased application.
388
- * @param {KeyBasedParams} params The key based parameters.
394
+ * @param {String} slug The application slug.
395
+ * @param {Object.<string, string>} [payload] The key value pairs of auth data.
389
396
  * @returns {Promise<Boolean>} Whether the auth data was saved successfully.
390
397
  */
391
398
  private keybased;
@@ -393,28 +400,23 @@ declare class Cobalt {
393
400
  * Connects the specified application using the provided authentication type and optional auth data.
394
401
  * @param params - The parameters for connecting the application.
395
402
  * @param params.slug - The application slug.
396
- * @param params.authConfig - The identifier of the auth config.
397
403
  * @param params.type - The authentication type to use. If not provided, it defaults to `keybased` if payload is provided, otherwise `oauth2`.
398
404
  * @param params.payload - key-value pairs of authentication data required for the specified auth type.
399
- * @param params.autoClose - Whether to close the authentication window automatically. If not provided, it defaults to `true`.
400
405
  * @returns A promise that resolves to true if the connection was successful, otherwise false.
401
406
  * @throws Throws an error if the authentication type is invalid or the connection fails.
402
407
  */
403
- connect({ slug, authConfig, type, payload, autoClose, }: {
408
+ connect({ slug, type, payload, }: {
404
409
  slug: string;
405
- authConfig?: string;
406
410
  type?: AuthType;
407
411
  payload?: Record<string, string>;
408
- autoClose?: boolean;
409
412
  }): Promise<boolean>;
410
413
  /**
411
414
  * Disconnect the specified application and remove any associated data from Cobalt.
412
415
  * @param {String} slug The application slug.
413
416
  * @param {AuthType} [type] The authentication type to use. If not provided, it'll remove all the connected accounts.
414
- * @param {String} [authConfig] The identifier of the auth config.
415
417
  * @returns {Promise<unknown>}
416
418
  */
417
- disconnect(slug: string, type?: AuthType, authConfig?: string): Promise<unknown>;
419
+ disconnect(slug: string, type?: AuthType): Promise<unknown>;
418
420
  /**
419
421
  * Returns the specified config, or creates one if it doesn't exist.
420
422
  * @param {ConfigPayload} payload The payload object for config.
@@ -487,11 +489,15 @@ declare class Cobalt {
487
489
  * Returns the private workflows for the specified application.
488
490
  * @param {Object} params
489
491
  * @param {String} [params.slug]
492
+ * @param {String} [params.name]
490
493
  * @param {Number} [params.page]
491
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.
492
498
  * @returns
493
499
  */
494
- getWorkflows(params?: PublicWorkflowsPayload): Promise<PaginatedResponse<PublicWorkflow>>;
500
+ getWorkflows({ page, limit, ...rest }?: PublicWorkflowsPayload): Promise<PaginatedResponse<PublicWorkflow>>;
495
501
  /**
496
502
  * Create a public workflow for the linked account.
497
503
  * @param {Object} params
@@ -528,9 +534,16 @@ declare class Cobalt {
528
534
  * @param {Object} [params]
529
535
  * @param {Number} [params.page]
530
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)
531
544
  * @returns {Promise<PaginatedResponse<Execution>>} The paginated workflow execution logs.
532
545
  */
533
- getExecutions({ page, limit }?: PaginationProps): Promise<PaginatedResponse<Execution>>;
546
+ getExecutions({ page, limit, ...rest }?: GetExecutionsParams): Promise<PaginatedResponse<Execution>>;
534
547
  /**
535
548
  * Returns the specified workflow execution log.
536
549
  * @param {String} executionId The execution ID.