@cobaltio/cobalt-js 9.0.0 → 9.2.0-beta.1
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/cobalt.d.ts +56 -8
- package/cobalt.js +363 -358
- package/cobalt.ts +129 -19
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/Cobalt.html +36 -23
- package/docs/enums/AuthStatus.html +2 -2
- package/docs/enums/AuthType.html +2 -2
- package/docs/interfaces/Application.html +15 -14
- 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 +4 -4
- package/docs/interfaces/ConfigWorkflow.html +2 -2
- package/docs/interfaces/ExecuteWorkflowPayload.html +9 -0
- package/docs/interfaces/Execution.html +2 -2
- package/docs/interfaces/InputField.html +9 -9
- package/docs/interfaces/KeyBasedParams.html +7 -0
- package/docs/interfaces/Label.html +3 -3
- package/docs/interfaces/OAuthParams.html +7 -0
- package/docs/interfaces/PublicWorkflow.html +8 -8
- package/docs/interfaces/PublicWorkflowPayload.html +4 -4
- package/docs/interfaces/PublicWorkflowsPayload.html +2 -2
- package/docs/interfaces/RuleOptions.html +2 -2
- package/docs/interfaces/UpdateConfigPayload.html +5 -5
- package/docs/interfaces/WorkflowPayload.html +4 -4
- package/docs/interfaces/WorkflowPayloadResponse.html +4 -0
- package/docs/llms.txt +256 -159
- package/docs/modules.html +1 -1
- package/package.json +1 -1
- package/tsconfig.json +12 -12
package/cobalt.d.ts
CHANGED
|
@@ -34,6 +34,8 @@ export interface Application {
|
|
|
34
34
|
};
|
|
35
35
|
/** The list of connected accounts for this application */
|
|
36
36
|
connected_accounts?: {
|
|
37
|
+
/** The connection identifier of the auth config. */
|
|
38
|
+
connection_id: string;
|
|
37
39
|
/** The identifier (username, email, etc.) of the connected account. */
|
|
38
40
|
identifier: unknown;
|
|
39
41
|
/** The auth type used to connect the account. */
|
|
@@ -86,6 +88,22 @@ export interface InputField {
|
|
|
86
88
|
value: string;
|
|
87
89
|
}[];
|
|
88
90
|
}
|
|
91
|
+
export interface OAuthParams {
|
|
92
|
+
/** The application slug. */
|
|
93
|
+
slug: string;
|
|
94
|
+
/** The connection identifier. */
|
|
95
|
+
connection?: string;
|
|
96
|
+
/** The key value pairs of auth data. */
|
|
97
|
+
payload?: Record<string, string>;
|
|
98
|
+
}
|
|
99
|
+
export interface KeyBasedParams {
|
|
100
|
+
/** The application slug. */
|
|
101
|
+
slug: string;
|
|
102
|
+
/** The connection identifier. */
|
|
103
|
+
connection?: string;
|
|
104
|
+
/** The key value pairs of auth data. */
|
|
105
|
+
payload?: Record<string, string>;
|
|
106
|
+
}
|
|
89
107
|
/** The payload object for config. */
|
|
90
108
|
export interface ConfigPayload {
|
|
91
109
|
/** The application slug. */
|
|
@@ -232,6 +250,21 @@ export interface ConfigWorkflow {
|
|
|
232
250
|
enabled: boolean;
|
|
233
251
|
fields?: ConfigField[];
|
|
234
252
|
}
|
|
253
|
+
export interface WorkflowPayloadResponse {
|
|
254
|
+
payload: Record<string, any>;
|
|
255
|
+
schema?: unknown;
|
|
256
|
+
schema_interpreted?: unknown;
|
|
257
|
+
}
|
|
258
|
+
export interface ExecuteWorkflowPayload {
|
|
259
|
+
/**The workflow id or alias. */
|
|
260
|
+
worklfow: string;
|
|
261
|
+
/** The application's slug this workflow belongs to. */
|
|
262
|
+
slug?: string;
|
|
263
|
+
/** The payload to execute the workflow. */
|
|
264
|
+
payload?: Record<string, any>;
|
|
265
|
+
/** Whether to execute the workflow synchronously. */
|
|
266
|
+
sync_execution?: boolean;
|
|
267
|
+
}
|
|
235
268
|
export interface Execution {
|
|
236
269
|
_id: string;
|
|
237
270
|
id?: string;
|
|
@@ -321,23 +354,20 @@ declare class Cobalt {
|
|
|
321
354
|
* Returns the auth URL that users can use to authenticate themselves to the
|
|
322
355
|
* specified application.
|
|
323
356
|
* @private
|
|
324
|
-
* @param {
|
|
325
|
-
* @param {Object.<string, string>} [params] The key value pairs of auth data.
|
|
357
|
+
* @param {OAuthParams} params The OAuth parameters.
|
|
326
358
|
* @returns {Promise<String>} The auth URL where users can authenticate themselves.
|
|
327
359
|
*/
|
|
328
360
|
private getOAuthUrl;
|
|
329
361
|
/**
|
|
330
362
|
* Handle OAuth for the specified application.
|
|
331
363
|
* @private
|
|
332
|
-
* @param {
|
|
333
|
-
* @param {Object.<string, string>} [params] The key value pairs of auth data.
|
|
364
|
+
* @param {OAuthParams} params The OAuth parameters.
|
|
334
365
|
* @returns {Promise<Boolean>} Whether the user authenticated.
|
|
335
366
|
*/
|
|
336
367
|
private oauth;
|
|
337
368
|
/**
|
|
338
369
|
* Save auth data for the specified keybased application.
|
|
339
|
-
* @param {
|
|
340
|
-
* @param {Object.<string, string>} [payload] The key value pairs of auth data.
|
|
370
|
+
* @param {KeyBasedParams} params The key based parameters.
|
|
341
371
|
* @returns {Promise<Boolean>} Whether the auth data was saved successfully.
|
|
342
372
|
*/
|
|
343
373
|
private keybased;
|
|
@@ -345,13 +375,15 @@ declare class Cobalt {
|
|
|
345
375
|
* Connects the specified application using the provided authentication type and optional auth data.
|
|
346
376
|
* @param params - The parameters for connecting the application.
|
|
347
377
|
* @param params.slug - The application slug.
|
|
378
|
+
* @param params.connection - The connection identifier of the auth config.
|
|
348
379
|
* @param params.type - The authentication type to use. If not provided, it defaults to `keybased` if payload is provided, otherwise `oauth2`.
|
|
349
380
|
* @param params.payload - key-value pairs of authentication data required for the specified auth type.
|
|
350
381
|
* @returns A promise that resolves to true if the connection was successful, otherwise false.
|
|
351
382
|
* @throws Throws an error if the authentication type is invalid or the connection fails.
|
|
352
383
|
*/
|
|
353
|
-
connect({ slug, type, payload, }: {
|
|
384
|
+
connect({ slug, connection, type, payload, }: {
|
|
354
385
|
slug: string;
|
|
386
|
+
connection?: string;
|
|
355
387
|
type?: AuthType;
|
|
356
388
|
payload?: Record<string, string>;
|
|
357
389
|
}): Promise<boolean>;
|
|
@@ -359,9 +391,10 @@ declare class Cobalt {
|
|
|
359
391
|
* Disconnect the specified application and remove any associated data from Cobalt.
|
|
360
392
|
* @param {String} slug The application slug.
|
|
361
393
|
* @param {AuthType} [type] The authentication type to use. If not provided, it'll remove all the connected accounts.
|
|
394
|
+
* @param {String} [connection] The connection identifier of the auth config.
|
|
362
395
|
* @returns {Promise<unknown>}
|
|
363
396
|
*/
|
|
364
|
-
disconnect(slug: string, type?: AuthType): Promise<unknown>;
|
|
397
|
+
disconnect(slug: string, type?: AuthType, connection?: string): Promise<unknown>;
|
|
365
398
|
/**
|
|
366
399
|
* Returns the specified config, or creates one if it doesn't exist.
|
|
367
400
|
* @param {ConfigPayload} payload The payload object for config.
|
|
@@ -455,6 +488,21 @@ declare class Cobalt {
|
|
|
455
488
|
* @returns {Promise<unknown>}
|
|
456
489
|
*/
|
|
457
490
|
deleteWorkflow(workflowId: string): Promise<unknown>;
|
|
491
|
+
/**
|
|
492
|
+
* Returns the execution payload for the specified public workflow.
|
|
493
|
+
* @param {String} workflowId The workflow ID.
|
|
494
|
+
* @returns {Promise<WorkflowPayloadResponse>} The workflow payload response.
|
|
495
|
+
*/
|
|
496
|
+
getWorkflowPayload(workflowId: string): Promise<WorkflowPayloadResponse>;
|
|
497
|
+
/**
|
|
498
|
+
* Execute the specified public workflow.
|
|
499
|
+
* @param {ExecuteWorkflowPayload} options The execution payload.
|
|
500
|
+
* @param {String} options.worklfow The workflow id or alias.
|
|
501
|
+
* @param {String} [options.slug] The application's slug this workflow belongs to. Slug is required if you're using workflow alias.
|
|
502
|
+
* @param {Record<string, any>} [options.payload] The execution payload.
|
|
503
|
+
* @returns {Promise<unknown>}
|
|
504
|
+
*/
|
|
505
|
+
executeWorkflow(options: ExecuteWorkflowPayload): Promise<unknown>;
|
|
458
506
|
/**
|
|
459
507
|
* Returns the workflow execution logs for the linked account.
|
|
460
508
|
* @param {Object} [params]
|