@narrative.io/data-collaboration-sdk-ts 2.93.0 → 2.94.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/build/compute-pools/index.d.ts +10 -0
- package/build/compute-pools/index.js +21 -0
- package/build/compute-pools/types.d.ts +97 -0
- package/build/compute-pools/types.js +1 -0
- package/build/data-planes/index.d.ts +2 -0
- package/build/data-planes/index.js +6 -0
- package/build/data-planes/types.d.ts +12 -2
- package/build/index.d.ts +7 -1
- package/build/index.js +8 -0
- package/build/workflows/index.d.ts +66 -0
- package/build/workflows/index.js +78 -0
- package/build/workflows/types.d.ts +54 -0
- package/build/workflows/types.js +1 -0
- package/package.json +8 -8
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseApi } from "../base-api";
|
|
2
|
+
import type { ComputePoolResponse, CreateComputePoolRequest, ListComputePoolsParams, ListComputePoolsResponse, UpdateComputePoolRequest } from "./types";
|
|
3
|
+
export declare class ComputePoolsApi extends BaseApi {
|
|
4
|
+
private computePoolsResourcePath;
|
|
5
|
+
listComputePools(dataPlaneId: string, params?: ListComputePoolsParams): Promise<ListComputePoolsResponse>;
|
|
6
|
+
createComputePool(dataPlaneId: string, request: CreateComputePoolRequest): Promise<ComputePoolResponse>;
|
|
7
|
+
getComputePool(dataPlaneId: string, computePoolId: string): Promise<ComputePoolResponse>;
|
|
8
|
+
updateComputePool(dataPlaneId: string, computePoolId: string, request: UpdateComputePoolRequest): Promise<ComputePoolResponse>;
|
|
9
|
+
archiveComputePool(dataPlaneId: string, computePoolId: string): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseApi } from "../base-api";
|
|
2
|
+
export class ComputePoolsApi extends BaseApi {
|
|
3
|
+
computePoolsResourcePath(dataPlaneId) {
|
|
4
|
+
return `data-planes/${dataPlaneId}/compute-pools`;
|
|
5
|
+
}
|
|
6
|
+
async listComputePools(dataPlaneId, params) {
|
|
7
|
+
return await this.get(this.computePoolsResourcePath(dataPlaneId), params);
|
|
8
|
+
}
|
|
9
|
+
async createComputePool(dataPlaneId, request) {
|
|
10
|
+
return await this.post(this.computePoolsResourcePath(dataPlaneId), request);
|
|
11
|
+
}
|
|
12
|
+
async getComputePool(dataPlaneId, computePoolId) {
|
|
13
|
+
return await this.get(`${this.computePoolsResourcePath(dataPlaneId)}/${computePoolId}`);
|
|
14
|
+
}
|
|
15
|
+
async updateComputePool(dataPlaneId, computePoolId, request) {
|
|
16
|
+
return await this.put(`${this.computePoolsResourcePath(dataPlaneId)}/${computePoolId}`, request);
|
|
17
|
+
}
|
|
18
|
+
async archiveComputePool(dataPlaneId, computePoolId) {
|
|
19
|
+
await this.delete(`${this.computePoolsResourcePath(dataPlaneId)}/${computePoolId}`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
export type ComputePoolType = "owned" | "shared";
|
|
2
|
+
export type ComputePoolStatus = "active" | "archived";
|
|
3
|
+
export type SnowflakeWarehouseSize = "x-small" | "small" | "medium" | "large" | "x-large" | "2x-large" | "3x-large" | "4x-large" | "5x-large" | "6x-large";
|
|
4
|
+
export type SnowflakeWarehouseType = "standard" | "snowpark_optimized";
|
|
5
|
+
export type ScalingPolicy = "standard" | "economy";
|
|
6
|
+
export interface SnowflakeWarehouseExternalId {
|
|
7
|
+
type: "snowflake_warehouse";
|
|
8
|
+
name: string;
|
|
9
|
+
alias: string;
|
|
10
|
+
}
|
|
11
|
+
export type ComputePoolExternalId = SnowflakeWarehouseExternalId;
|
|
12
|
+
export interface SnowflakeWarehouseProvider {
|
|
13
|
+
type: "snowflake_warehouse";
|
|
14
|
+
size?: SnowflakeWarehouseSize;
|
|
15
|
+
warehouse_type?: SnowflakeWarehouseType;
|
|
16
|
+
auto_suspend?: number;
|
|
17
|
+
auto_resume?: boolean;
|
|
18
|
+
min_cluster_count?: number;
|
|
19
|
+
max_cluster_count?: number;
|
|
20
|
+
scaling_policy?: ScalingPolicy;
|
|
21
|
+
max_concurrency_level?: number;
|
|
22
|
+
statement_timeout_in_seconds?: number;
|
|
23
|
+
statement_queued_timeout_in_seconds?: number;
|
|
24
|
+
enable_query_acceleration?: boolean;
|
|
25
|
+
query_acceleration_max_scale_factor?: number;
|
|
26
|
+
resource_constraint?: string;
|
|
27
|
+
comment?: string;
|
|
28
|
+
}
|
|
29
|
+
export type ComputePoolProvider = SnowflakeWarehouseProvider;
|
|
30
|
+
export interface ParticipantsAll {
|
|
31
|
+
type: "all";
|
|
32
|
+
}
|
|
33
|
+
export interface ParticipantsNone {
|
|
34
|
+
type: "none";
|
|
35
|
+
}
|
|
36
|
+
export interface ParticipantsInclusion {
|
|
37
|
+
type: "inclusion";
|
|
38
|
+
company_ids: number[];
|
|
39
|
+
}
|
|
40
|
+
export type Participants = ParticipantsAll | ParticipantsNone | ParticipantsInclusion;
|
|
41
|
+
export interface ComputePoolCollaborators {
|
|
42
|
+
use: Participants;
|
|
43
|
+
}
|
|
44
|
+
export interface ComputePoolOwnedResponse {
|
|
45
|
+
type: "owned";
|
|
46
|
+
id: string;
|
|
47
|
+
company_id: number;
|
|
48
|
+
data_plane_id: string;
|
|
49
|
+
external_id: ComputePoolExternalId;
|
|
50
|
+
name: string;
|
|
51
|
+
display_name: string;
|
|
52
|
+
description?: string;
|
|
53
|
+
status: ComputePoolStatus;
|
|
54
|
+
created_at: string;
|
|
55
|
+
updated_at?: string;
|
|
56
|
+
tags: string[];
|
|
57
|
+
provider: ComputePoolProvider;
|
|
58
|
+
collaborators: ComputePoolCollaborators;
|
|
59
|
+
}
|
|
60
|
+
export interface ComputePoolSharedResponse {
|
|
61
|
+
type: "shared";
|
|
62
|
+
id: string;
|
|
63
|
+
company_id: number;
|
|
64
|
+
data_plane_id: string;
|
|
65
|
+
external_id: ComputePoolExternalId;
|
|
66
|
+
name: string;
|
|
67
|
+
display_name: string;
|
|
68
|
+
description?: string;
|
|
69
|
+
status: ComputePoolStatus;
|
|
70
|
+
created_at: string;
|
|
71
|
+
updated_at?: string;
|
|
72
|
+
tags: string[];
|
|
73
|
+
provider: ComputePoolProvider;
|
|
74
|
+
}
|
|
75
|
+
export type ComputePoolResponse = ComputePoolOwnedResponse | ComputePoolSharedResponse;
|
|
76
|
+
export interface CreateComputePoolRequest {
|
|
77
|
+
external_id: ComputePoolExternalId;
|
|
78
|
+
name: string;
|
|
79
|
+
display_name: string;
|
|
80
|
+
description?: string;
|
|
81
|
+
tags?: string[];
|
|
82
|
+
collaborators?: ComputePoolCollaborators;
|
|
83
|
+
provider: ComputePoolProvider;
|
|
84
|
+
}
|
|
85
|
+
export interface UpdateComputePoolRequest {
|
|
86
|
+
display_name?: string;
|
|
87
|
+
description?: string;
|
|
88
|
+
tags?: string[];
|
|
89
|
+
provider?: ComputePoolProvider;
|
|
90
|
+
collaborators?: ComputePoolCollaborators;
|
|
91
|
+
}
|
|
92
|
+
export interface ListComputePoolsResponse {
|
|
93
|
+
records: ComputePoolResponse[];
|
|
94
|
+
}
|
|
95
|
+
export type ListComputePoolsParams = {
|
|
96
|
+
status?: ComputePoolStatus;
|
|
97
|
+
} & Record<string, unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,4 +4,6 @@ import type { DataPlane } from "./types";
|
|
|
4
4
|
export declare class DataPlaneApi extends BaseApi {
|
|
5
5
|
getDataPlanes(): Promise<ApiRecords<DataPlane>>;
|
|
6
6
|
getDataPlane(dataPlaneId: string): Promise<DataPlane>;
|
|
7
|
+
setDefaultComputePool(dataPlaneId: string, computePoolId: string): Promise<DataPlane>;
|
|
8
|
+
clearDefaultComputePool(dataPlaneId: string): Promise<void>;
|
|
7
9
|
}
|
|
@@ -7,4 +7,10 @@ export class DataPlaneApi extends BaseApi {
|
|
|
7
7
|
async getDataPlane(dataPlaneId) {
|
|
8
8
|
return await this.get(`${resourceName}/${dataPlaneId}`);
|
|
9
9
|
}
|
|
10
|
+
async setDefaultComputePool(dataPlaneId, computePoolId) {
|
|
11
|
+
return await this.put(`${resourceName}/${dataPlaneId}/default-compute-pool/${computePoolId}`, undefined);
|
|
12
|
+
}
|
|
13
|
+
async clearDefaultComputePool(dataPlaneId) {
|
|
14
|
+
await this.delete(`${resourceName}/${dataPlaneId}/default-compute-pool`);
|
|
15
|
+
}
|
|
10
16
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { ComputePoolResponse, Participants } from "../compute-pools/types";
|
|
1
2
|
export type DataPlaneType = "owned" | "shared";
|
|
2
|
-
export type DataPlaneStatus = "active" | "inactive";
|
|
3
|
-
export type DataPlanePlatformType = "platform_snowflake" | "platform_aws" | "platform_shared_aws";
|
|
3
|
+
export type DataPlaneStatus = "active" | "inactive" | "archived";
|
|
4
|
+
export type DataPlanePlatformType = "platform_snowflake" | "platform_shared_snowflake" | "platform_aws" | "platform_shared_aws";
|
|
4
5
|
export type DataPlaneRegionType = "region_aws";
|
|
5
6
|
export interface DataPlanePlatformRegion {
|
|
6
7
|
type: DataPlaneRegionType;
|
|
@@ -13,6 +14,9 @@ export interface DataPlanePlatform {
|
|
|
13
14
|
organization_name: string;
|
|
14
15
|
region: DataPlanePlatformRegion;
|
|
15
16
|
}
|
|
17
|
+
export interface DataPlaneCollaborators {
|
|
18
|
+
use: Participants;
|
|
19
|
+
}
|
|
16
20
|
export interface DataPlane {
|
|
17
21
|
type: DataPlaneType;
|
|
18
22
|
id: string;
|
|
@@ -23,4 +27,10 @@ export interface DataPlane {
|
|
|
23
27
|
platform: DataPlanePlatform;
|
|
24
28
|
status: DataPlaneStatus;
|
|
25
29
|
updated_at: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
tags?: string[];
|
|
32
|
+
last_heartbeat_at?: string;
|
|
33
|
+
default_compute_pool_id?: string;
|
|
34
|
+
compute_pools?: ComputePoolResponse[];
|
|
35
|
+
collaborators?: DataPlaneCollaborators;
|
|
26
36
|
}
|
package/build/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export * from "./authentication";
|
|
|
7
7
|
export * from "./base-api";
|
|
8
8
|
export * from "./collaboration-policy";
|
|
9
9
|
export * from "./company-info";
|
|
10
|
+
export * from "./compute-pools";
|
|
11
|
+
export * from "./compute-pools/types";
|
|
10
12
|
export * from "./connections";
|
|
11
13
|
export * from "./contracts";
|
|
12
14
|
export * from "./data-planes";
|
|
@@ -48,6 +50,8 @@ export { applyMixins } from "./utils";
|
|
|
48
50
|
export * from "./views";
|
|
49
51
|
export * from "./whoami";
|
|
50
52
|
export * from "./whoami/types";
|
|
53
|
+
export * from "./workflows";
|
|
54
|
+
export * from "./workflows/types";
|
|
51
55
|
import { AccessRulesApi } from "./access-rules/";
|
|
52
56
|
import { AccessTokensApi } from "./access-tokens";
|
|
53
57
|
import { AppsApi } from "./apps";
|
|
@@ -55,6 +59,7 @@ import { AttributeApi, AttributeApiV2 } from "./attributes";
|
|
|
55
59
|
import { AuthenticationApi } from "./authentication";
|
|
56
60
|
import { BaseApi } from "./base-api";
|
|
57
61
|
import { CompanyInfoApi } from "./company-info";
|
|
62
|
+
import { ComputePoolsApi } from "./compute-pools";
|
|
58
63
|
import { ConnectionsApi } from "./connections";
|
|
59
64
|
import { ContractsApi } from "./contracts";
|
|
60
65
|
import { DataPlaneApi } from "./data-planes";
|
|
@@ -78,8 +83,9 @@ import { SubscriptionsApi } from "./subscriptions";
|
|
|
78
83
|
import { UploadsApi } from "./uploads";
|
|
79
84
|
import { ViewsApi } from "./views";
|
|
80
85
|
import { WhoAmIApi } from "./whoami";
|
|
86
|
+
import { WorkflowsApi } from "./workflows";
|
|
81
87
|
declare class NarrativeApi extends BaseApi {
|
|
82
88
|
}
|
|
83
|
-
interface NarrativeApi extends BaseApi, HealthCheckApi, AccessTokensApi, DataPlaneApi, DatasetApi, RosettaStoneApi, AttributeApi, AttributeApiV2, PingApi, CompanyInfoApi, InstallationsApi, ConnectionsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, MappingsApi, AccessRulesApi, AppsApi, SubscriptionsApi, JobsApi, QueriesApi, ViewsApi, ModelsApi, ModelTrainingApi, ModelInferenceApi, EncryptionMaterialApi, WhoAmIApi {
|
|
89
|
+
interface NarrativeApi extends BaseApi, HealthCheckApi, AccessTokensApi, DataPlaneApi, DatasetApi, RosettaStoneApi, AttributeApi, AttributeApiV2, PingApi, CompanyInfoApi, InstallationsApi, ConnectionsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, MappingsApi, AccessRulesApi, AppsApi, SubscriptionsApi, JobsApi, QueriesApi, ViewsApi, ModelsApi, ModelTrainingApi, ModelInferenceApi, EncryptionMaterialApi, WhoAmIApi, WorkflowsApi, ComputePoolsApi {
|
|
84
90
|
}
|
|
85
91
|
export { NarrativeApi };
|
package/build/index.js
CHANGED
|
@@ -7,6 +7,8 @@ export * from "./authentication";
|
|
|
7
7
|
export * from "./base-api";
|
|
8
8
|
export * from "./collaboration-policy";
|
|
9
9
|
export * from "./company-info";
|
|
10
|
+
export * from "./compute-pools";
|
|
11
|
+
export * from "./compute-pools/types";
|
|
10
12
|
export * from "./connections";
|
|
11
13
|
export * from "./contracts";
|
|
12
14
|
export * from "./data-planes";
|
|
@@ -48,6 +50,8 @@ export { applyMixins } from "./utils";
|
|
|
48
50
|
export * from "./views";
|
|
49
51
|
export * from "./whoami";
|
|
50
52
|
export * from "./whoami/types";
|
|
53
|
+
export * from "./workflows";
|
|
54
|
+
export * from "./workflows/types";
|
|
51
55
|
import { AccessRulesApi } from "./access-rules/";
|
|
52
56
|
import { AccessTokensApi } from "./access-tokens";
|
|
53
57
|
import { AppsApi } from "./apps";
|
|
@@ -56,6 +60,7 @@ import { AuthenticationApi } from "./authentication";
|
|
|
56
60
|
// Handle the NarrativeApi class with mixins
|
|
57
61
|
import { BaseApi } from "./base-api";
|
|
58
62
|
import { CompanyInfoApi } from "./company-info";
|
|
63
|
+
import { ComputePoolsApi } from "./compute-pools";
|
|
59
64
|
import { ConnectionsApi } from "./connections";
|
|
60
65
|
import { ContractsApi } from "./contracts";
|
|
61
66
|
import { DataPlaneApi } from "./data-planes";
|
|
@@ -80,6 +85,7 @@ import { UploadsApi } from "./uploads";
|
|
|
80
85
|
import { applyMixins } from "./utils";
|
|
81
86
|
import { ViewsApi } from "./views";
|
|
82
87
|
import { WhoAmIApi } from "./whoami";
|
|
88
|
+
import { WorkflowsApi } from "./workflows";
|
|
83
89
|
class NarrativeApi extends BaseApi {
|
|
84
90
|
}
|
|
85
91
|
applyMixins(NarrativeApi, [
|
|
@@ -114,5 +120,7 @@ applyMixins(NarrativeApi, [
|
|
|
114
120
|
ModelInferenceApi,
|
|
115
121
|
EncryptionMaterialApi,
|
|
116
122
|
WhoAmIApi,
|
|
123
|
+
WorkflowsApi,
|
|
124
|
+
ComputePoolsApi,
|
|
117
125
|
]);
|
|
118
126
|
export { NarrativeApi };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { BaseApi } from "../base-api";
|
|
2
|
+
import type { PaginationOptions } from "../types";
|
|
3
|
+
type WorkflowPaginationOptions = PaginationOptions & Record<string, unknown>;
|
|
4
|
+
import type { CreateWorkflowRequest, CreateWorkflowResponse, ListRunsParams, ListRunsResponse, ListWorkflowsResponse, ScheduleWorkflowRequest, ScheduleWorkflowResponse, TriggerWorkflowResponse, WorkflowResponse, WorkflowRun, WorkflowRunStatus, WorkflowStatus } from "./types";
|
|
5
|
+
/**
|
|
6
|
+
* @module WorkflowsApi
|
|
7
|
+
* @description This module provides methods for creating, scheduling, triggering, and archiving workflows.
|
|
8
|
+
* @extends BaseApi
|
|
9
|
+
*/
|
|
10
|
+
declare class WorkflowsApi extends BaseApi {
|
|
11
|
+
/**
|
|
12
|
+
* List all active workflows for the authenticated company.
|
|
13
|
+
*
|
|
14
|
+
* @param {PaginationOptions} [params] - Optional pagination parameters.
|
|
15
|
+
* @returns {Promise<ListWorkflowsResponse>} A promise that resolves to a paginated list of workflows.
|
|
16
|
+
*/
|
|
17
|
+
listWorkflows(params?: WorkflowPaginationOptions): Promise<ListWorkflowsResponse>;
|
|
18
|
+
/**
|
|
19
|
+
* Create a new workflow from a YAML specification.
|
|
20
|
+
* The specification is parsed and validated before the workflow is persisted.
|
|
21
|
+
*
|
|
22
|
+
* @param {CreateWorkflowRequest} request - The workflow creation request.
|
|
23
|
+
* @returns {Promise<CreateWorkflowResponse>} A promise that resolves to the created workflow.
|
|
24
|
+
*/
|
|
25
|
+
createWorkflow(request: CreateWorkflowRequest): Promise<CreateWorkflowResponse>;
|
|
26
|
+
/**
|
|
27
|
+
* Retrieve a workflow by its ID.
|
|
28
|
+
*
|
|
29
|
+
* @param {string} workflowId - The unique identifier for the workflow.
|
|
30
|
+
* @returns {Promise<WorkflowResponse>} A promise that resolves to the workflow.
|
|
31
|
+
*/
|
|
32
|
+
getWorkflow(workflowId: string): Promise<WorkflowResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* Archive a workflow. This terminates any active schedule and running execution,
|
|
35
|
+
* then marks the workflow as archived.
|
|
36
|
+
*
|
|
37
|
+
* @param {string} workflowId - The unique identifier for the workflow to archive.
|
|
38
|
+
* @returns {Promise<void>} A promise that resolves when the workflow is archived.
|
|
39
|
+
*/
|
|
40
|
+
archiveWorkflow(workflowId: string): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Trigger an immediate execution of a workflow.
|
|
43
|
+
*
|
|
44
|
+
* @param {string} workflowId - The unique identifier for the workflow to trigger.
|
|
45
|
+
* @returns {Promise<TriggerWorkflowResponse>} A promise that resolves to the run ID of the new execution.
|
|
46
|
+
*/
|
|
47
|
+
triggerWorkflow(workflowId: string): Promise<TriggerWorkflowResponse>;
|
|
48
|
+
/**
|
|
49
|
+
* Create a schedule for a workflow based on the cron expression defined in its specification.
|
|
50
|
+
* Optionally, the workflow can also be triggered immediately.
|
|
51
|
+
*
|
|
52
|
+
* @param {string} workflowId - The unique identifier for the workflow to schedule.
|
|
53
|
+
* @param {ScheduleWorkflowRequest} [request] - Optional request body with trigger_immediately flag.
|
|
54
|
+
* @returns {Promise<ScheduleWorkflowResponse>} A promise that resolves to the schedule response.
|
|
55
|
+
*/
|
|
56
|
+
scheduleWorkflow(workflowId: string, request?: ScheduleWorkflowRequest): Promise<ScheduleWorkflowResponse>;
|
|
57
|
+
/**
|
|
58
|
+
* List execution runs for a workflow. Results are ordered by start time descending.
|
|
59
|
+
*
|
|
60
|
+
* @param {string} workflowId - The unique identifier for the workflow.
|
|
61
|
+
* @param {ListRunsParams} [params] - Optional pagination parameters (pageSize, pageToken).
|
|
62
|
+
* @returns {Promise<ListRunsResponse>} A promise that resolves to a paginated list of workflow runs.
|
|
63
|
+
*/
|
|
64
|
+
listWorkflowRuns(workflowId: string, params?: ListRunsParams): Promise<ListRunsResponse>;
|
|
65
|
+
}
|
|
66
|
+
export { WorkflowsApi, type CreateWorkflowRequest, type CreateWorkflowResponse, type ListRunsParams, type ListRunsResponse, type ListWorkflowsResponse, type ScheduleWorkflowRequest, type ScheduleWorkflowResponse, type TriggerWorkflowResponse, type WorkflowResponse, type WorkflowRun, type WorkflowRunStatus, type WorkflowStatus, };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { BaseApi } from "../base-api";
|
|
2
|
+
const resourceName = "workflows";
|
|
3
|
+
/**
|
|
4
|
+
* @module WorkflowsApi
|
|
5
|
+
* @description This module provides methods for creating, scheduling, triggering, and archiving workflows.
|
|
6
|
+
* @extends BaseApi
|
|
7
|
+
*/
|
|
8
|
+
class WorkflowsApi extends BaseApi {
|
|
9
|
+
/**
|
|
10
|
+
* List all active workflows for the authenticated company.
|
|
11
|
+
*
|
|
12
|
+
* @param {PaginationOptions} [params] - Optional pagination parameters.
|
|
13
|
+
* @returns {Promise<ListWorkflowsResponse>} A promise that resolves to a paginated list of workflows.
|
|
14
|
+
*/
|
|
15
|
+
async listWorkflows(params) {
|
|
16
|
+
return await this.get(resourceName, params);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create a new workflow from a YAML specification.
|
|
20
|
+
* The specification is parsed and validated before the workflow is persisted.
|
|
21
|
+
*
|
|
22
|
+
* @param {CreateWorkflowRequest} request - The workflow creation request.
|
|
23
|
+
* @returns {Promise<CreateWorkflowResponse>} A promise that resolves to the created workflow.
|
|
24
|
+
*/
|
|
25
|
+
async createWorkflow(request) {
|
|
26
|
+
return await this.post(resourceName, request);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Retrieve a workflow by its ID.
|
|
30
|
+
*
|
|
31
|
+
* @param {string} workflowId - The unique identifier for the workflow.
|
|
32
|
+
* @returns {Promise<WorkflowResponse>} A promise that resolves to the workflow.
|
|
33
|
+
*/
|
|
34
|
+
async getWorkflow(workflowId) {
|
|
35
|
+
return await this.get(`${resourceName}/${workflowId}`);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Archive a workflow. This terminates any active schedule and running execution,
|
|
39
|
+
* then marks the workflow as archived.
|
|
40
|
+
*
|
|
41
|
+
* @param {string} workflowId - The unique identifier for the workflow to archive.
|
|
42
|
+
* @returns {Promise<void>} A promise that resolves when the workflow is archived.
|
|
43
|
+
*/
|
|
44
|
+
async archiveWorkflow(workflowId) {
|
|
45
|
+
await this.delete(`${resourceName}/${workflowId}`);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Trigger an immediate execution of a workflow.
|
|
49
|
+
*
|
|
50
|
+
* @param {string} workflowId - The unique identifier for the workflow to trigger.
|
|
51
|
+
* @returns {Promise<TriggerWorkflowResponse>} A promise that resolves to the run ID of the new execution.
|
|
52
|
+
*/
|
|
53
|
+
async triggerWorkflow(workflowId) {
|
|
54
|
+
return await this.post(`${resourceName}/${workflowId}/trigger`);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Create a schedule for a workflow based on the cron expression defined in its specification.
|
|
58
|
+
* Optionally, the workflow can also be triggered immediately.
|
|
59
|
+
*
|
|
60
|
+
* @param {string} workflowId - The unique identifier for the workflow to schedule.
|
|
61
|
+
* @param {ScheduleWorkflowRequest} [request] - Optional request body with trigger_immediately flag.
|
|
62
|
+
* @returns {Promise<ScheduleWorkflowResponse>} A promise that resolves to the schedule response.
|
|
63
|
+
*/
|
|
64
|
+
async scheduleWorkflow(workflowId, request) {
|
|
65
|
+
return await this.post(`${resourceName}/${workflowId}/schedule`, request);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* List execution runs for a workflow. Results are ordered by start time descending.
|
|
69
|
+
*
|
|
70
|
+
* @param {string} workflowId - The unique identifier for the workflow.
|
|
71
|
+
* @param {ListRunsParams} [params] - Optional pagination parameters (pageSize, pageToken).
|
|
72
|
+
* @returns {Promise<ListRunsResponse>} A promise that resolves to a paginated list of workflow runs.
|
|
73
|
+
*/
|
|
74
|
+
async listWorkflowRuns(workflowId, params) {
|
|
75
|
+
return await this.get(`${resourceName}/${workflowId}/runs`, params);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
export { WorkflowsApi, };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export type WorkflowStatus = "active" | "archived";
|
|
2
|
+
export type WorkflowRunStatus = "running" | "completed" | "failed" | "canceled" | "terminated" | "unknown";
|
|
3
|
+
export interface WorkflowResponse {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
specification: string;
|
|
7
|
+
data_plane_id: string;
|
|
8
|
+
company_id: number;
|
|
9
|
+
created_at: string;
|
|
10
|
+
created_by: number;
|
|
11
|
+
updated_at: string;
|
|
12
|
+
status: WorkflowStatus;
|
|
13
|
+
archived_at?: string | null;
|
|
14
|
+
}
|
|
15
|
+
export interface CreateWorkflowRequest {
|
|
16
|
+
specification: string;
|
|
17
|
+
data_plane_id: string;
|
|
18
|
+
trigger_immediately?: boolean | null;
|
|
19
|
+
schedule_immediately?: boolean | null;
|
|
20
|
+
}
|
|
21
|
+
export interface CreateWorkflowResponse extends WorkflowResponse {
|
|
22
|
+
run_id?: string | null;
|
|
23
|
+
}
|
|
24
|
+
export interface TriggerWorkflowResponse {
|
|
25
|
+
run_id: string;
|
|
26
|
+
}
|
|
27
|
+
export interface ScheduleWorkflowRequest {
|
|
28
|
+
trigger_immediately?: boolean | null;
|
|
29
|
+
}
|
|
30
|
+
export interface ScheduleWorkflowResponse {
|
|
31
|
+
run_id?: string | null;
|
|
32
|
+
}
|
|
33
|
+
export interface ListWorkflowsResponse {
|
|
34
|
+
records: WorkflowResponse[];
|
|
35
|
+
prev_page?: number | null;
|
|
36
|
+
current_page: number;
|
|
37
|
+
next_page?: number | null;
|
|
38
|
+
total_records: number;
|
|
39
|
+
total_pages: number;
|
|
40
|
+
}
|
|
41
|
+
export interface WorkflowRun {
|
|
42
|
+
run_id: string;
|
|
43
|
+
status: WorkflowRunStatus;
|
|
44
|
+
start_time: string;
|
|
45
|
+
close_time?: string | null;
|
|
46
|
+
}
|
|
47
|
+
export interface ListRunsResponse {
|
|
48
|
+
runs: WorkflowRun[];
|
|
49
|
+
next_page_token?: string | null;
|
|
50
|
+
}
|
|
51
|
+
export interface ListRunsParams extends Record<string, unknown> {
|
|
52
|
+
pageSize?: number;
|
|
53
|
+
pageToken?: string;
|
|
54
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@narrative.io/data-collaboration-sdk-ts",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.94.1",
|
|
4
4
|
"main": "build/index.js",
|
|
5
5
|
"repository": "github:narrative-io/data-collaboration-sdk-ts",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -25,21 +25,21 @@
|
|
|
25
25
|
"author": "",
|
|
26
26
|
"license": "ISC",
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@babel/core": "7.
|
|
29
|
-
"@babel/preset-env": "7.
|
|
28
|
+
"@babel/core": "7.29.0",
|
|
29
|
+
"@babel/preset-env": "7.29.0",
|
|
30
30
|
"@babel/preset-typescript": "7.28.5",
|
|
31
|
-
"@biomejs/biome": "2.3.
|
|
32
|
-
"@commitlint/cli": "20.
|
|
33
|
-
"@commitlint/config-conventional": "20.
|
|
31
|
+
"@biomejs/biome": "2.3.14",
|
|
32
|
+
"@commitlint/cli": "20.4.1",
|
|
33
|
+
"@commitlint/config-conventional": "20.4.1",
|
|
34
34
|
"@types/jest": "30.0.0",
|
|
35
35
|
"babel-jest": "30.2.0",
|
|
36
36
|
"jest": "30.2.0",
|
|
37
|
-
"lefthook": "2.0
|
|
37
|
+
"lefthook": "2.1.0",
|
|
38
38
|
"ts-jest": "29.4.6"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"mande": "2.0.9",
|
|
42
|
-
"zod": "4.3.
|
|
42
|
+
"zod": "4.3.6",
|
|
43
43
|
"bignumber.js": "9.3.1"
|
|
44
44
|
},
|
|
45
45
|
"overrides": {
|