@narrative.io/data-collaboration-sdk-ts 4.6.0 → 4.7.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.
|
@@ -7,6 +7,13 @@ import type { ComputePoolResponse, CreateComputePoolRequest, ListComputePoolsPar
|
|
|
7
7
|
*/
|
|
8
8
|
export declare class ComputePoolsApi extends BaseApi {
|
|
9
9
|
private computePoolsResourcePath;
|
|
10
|
+
/**
|
|
11
|
+
* The company-level default lives under `/company`, not under the data
|
|
12
|
+
* plane, because the backend groups it with the company's other settings
|
|
13
|
+
* (`CompanyComputePoolRoutes`). It is a compute-pool setting to a caller,
|
|
14
|
+
* which is why the two methods that use it live on this class.
|
|
15
|
+
*/
|
|
16
|
+
private companyDefaultResourcePath;
|
|
10
17
|
/**
|
|
11
18
|
* List compute pools for a data plane.
|
|
12
19
|
*
|
|
@@ -40,4 +47,30 @@ export declare class ComputePoolsApi extends BaseApi {
|
|
|
40
47
|
* @see {@link https://docs.narrative.io/api-reference/compute-pools/archive-a-compute-pool}
|
|
41
48
|
*/
|
|
42
49
|
archiveComputePool(dataPlaneId: string, computePoolId: string): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Set the calling company's own default compute pool on one data plane.
|
|
52
|
+
*
|
|
53
|
+
* Level 3 of the pool resolution chain: what the company's jobs run on when
|
|
54
|
+
* neither the job (level 1) nor the dataset (level 2) pins a pool, taking
|
|
55
|
+
* precedence over the plane owner's default (level 4,
|
|
56
|
+
* {@link DataPlaneApi.setDefaultComputePool}). Unlike that one, this works on
|
|
57
|
+
* any plane the company can reach, not only planes it owns.
|
|
58
|
+
*
|
|
59
|
+
* `companyId` must be the authenticated company — the route answers 404 for
|
|
60
|
+
* any other. The pool must be active, live on `dataPlaneId`, and be one the
|
|
61
|
+
* company may use (owned, or shared with it through `use` collaborators),
|
|
62
|
+
* which is exactly the set `listComputePools` returns.
|
|
63
|
+
*
|
|
64
|
+
* Replaces any existing default for that plane; other planes' entries are
|
|
65
|
+
* untouched. Answers 204 and returns nothing — the new value shows up as
|
|
66
|
+
* `default_source` on the next {@link ComputePoolsApi.listComputePools}.
|
|
67
|
+
*/
|
|
68
|
+
setCompanyDefaultComputePool(companyId: number, dataPlaneId: string, computePoolId: string): Promise<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Clear the calling company's own default compute pool on one data plane,
|
|
71
|
+
* letting its jobs fall through to the plane owner's default.
|
|
72
|
+
*
|
|
73
|
+
* Idempotent: clearing when nothing is set is a no-op and still answers 204.
|
|
74
|
+
*/
|
|
75
|
+
clearCompanyDefaultComputePool(companyId: number, dataPlaneId: string): Promise<void>;
|
|
43
76
|
}
|
|
@@ -8,6 +8,15 @@ export class ComputePoolsApi extends BaseApi {
|
|
|
8
8
|
computePoolsResourcePath(dataPlaneId) {
|
|
9
9
|
return `data-planes/${dataPlaneId}/compute-pools`;
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* The company-level default lives under `/company`, not under the data
|
|
13
|
+
* plane, because the backend groups it with the company's other settings
|
|
14
|
+
* (`CompanyComputePoolRoutes`). It is a compute-pool setting to a caller,
|
|
15
|
+
* which is why the two methods that use it live on this class.
|
|
16
|
+
*/
|
|
17
|
+
companyDefaultResourcePath(companyId, dataPlaneId) {
|
|
18
|
+
return `company/${companyId}/data-planes/${dataPlaneId}/default-compute-pool`;
|
|
19
|
+
}
|
|
11
20
|
/**
|
|
12
21
|
* List compute pools for a data plane.
|
|
13
22
|
*
|
|
@@ -51,4 +60,34 @@ export class ComputePoolsApi extends BaseApi {
|
|
|
51
60
|
async archiveComputePool(dataPlaneId, computePoolId) {
|
|
52
61
|
await this.delete(`${this.computePoolsResourcePath(dataPlaneId)}/${computePoolId}`);
|
|
53
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Set the calling company's own default compute pool on one data plane.
|
|
65
|
+
*
|
|
66
|
+
* Level 3 of the pool resolution chain: what the company's jobs run on when
|
|
67
|
+
* neither the job (level 1) nor the dataset (level 2) pins a pool, taking
|
|
68
|
+
* precedence over the plane owner's default (level 4,
|
|
69
|
+
* {@link DataPlaneApi.setDefaultComputePool}). Unlike that one, this works on
|
|
70
|
+
* any plane the company can reach, not only planes it owns.
|
|
71
|
+
*
|
|
72
|
+
* `companyId` must be the authenticated company — the route answers 404 for
|
|
73
|
+
* any other. The pool must be active, live on `dataPlaneId`, and be one the
|
|
74
|
+
* company may use (owned, or shared with it through `use` collaborators),
|
|
75
|
+
* which is exactly the set `listComputePools` returns.
|
|
76
|
+
*
|
|
77
|
+
* Replaces any existing default for that plane; other planes' entries are
|
|
78
|
+
* untouched. Answers 204 and returns nothing — the new value shows up as
|
|
79
|
+
* `default_source` on the next {@link ComputePoolsApi.listComputePools}.
|
|
80
|
+
*/
|
|
81
|
+
async setCompanyDefaultComputePool(companyId, dataPlaneId, computePoolId) {
|
|
82
|
+
await this.put(`${this.companyDefaultResourcePath(companyId, dataPlaneId)}/${computePoolId}`, undefined);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Clear the calling company's own default compute pool on one data plane,
|
|
86
|
+
* letting its jobs fall through to the plane owner's default.
|
|
87
|
+
*
|
|
88
|
+
* Idempotent: clearing when nothing is set is a no-op and still answers 204.
|
|
89
|
+
*/
|
|
90
|
+
async clearCompanyDefaultComputePool(companyId, dataPlaneId) {
|
|
91
|
+
await this.delete(this.companyDefaultResourcePath(companyId, dataPlaneId));
|
|
92
|
+
}
|
|
54
93
|
}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
export type ComputePoolType = "owned" | "shared";
|
|
2
2
|
export type ComputePoolStatus = "active" | "archived";
|
|
3
|
+
/**
|
|
4
|
+
* Which level made a pool the *authenticated company's* default on its data
|
|
5
|
+
* plane.
|
|
6
|
+
*
|
|
7
|
+
* `company` is the company's own setting for that plane
|
|
8
|
+
* ({@link ComputePoolsApi.setCompanyDefaultComputePool}) and takes precedence;
|
|
9
|
+
* `data_plane` is the default the plane's owner set
|
|
10
|
+
* ({@link DataPlaneApi.setDefaultComputePool}), which every collaborating
|
|
11
|
+
* company falls through to when it has no default of its own.
|
|
12
|
+
*/
|
|
13
|
+
export type ComputePoolDefaultSource = "company" | "data_plane";
|
|
3
14
|
export type ComputePoolSize = "x_small" | "small" | "medium" | "large" | "x_large" | "2x_large" | "3x_large" | "4x_large" | "5x_large" | "6x_large";
|
|
4
15
|
export type SnowflakeWarehouseSize = ComputePoolSize;
|
|
5
16
|
/**
|
|
@@ -89,6 +100,18 @@ export interface ComputePoolOwnedResponse {
|
|
|
89
100
|
tags: string[];
|
|
90
101
|
provider: ComputePoolProvider;
|
|
91
102
|
collaborators: ComputePoolCollaborators;
|
|
103
|
+
/**
|
|
104
|
+
* Set when this pool is the one the authenticated company's jobs run on when
|
|
105
|
+
* they don't name one themselves, and says which level made it the default.
|
|
106
|
+
* `null` on every other pool, and at most one active pool per data plane
|
|
107
|
+
* carries a non-null value.
|
|
108
|
+
*
|
|
109
|
+
* Only the pool the resolution actually landed on is marked. A company that
|
|
110
|
+
* has set its own default therefore leaves the *plane's* default pool
|
|
111
|
+
* reporting `null` here — read {@link DataPlane.default_compute_pool_id} for
|
|
112
|
+
* that one.
|
|
113
|
+
*/
|
|
114
|
+
default_source: ComputePoolDefaultSource | null;
|
|
92
115
|
}
|
|
93
116
|
export interface ComputePoolSharedResponse {
|
|
94
117
|
type: "shared";
|
|
@@ -104,6 +127,8 @@ export interface ComputePoolSharedResponse {
|
|
|
104
127
|
updated_at?: string;
|
|
105
128
|
tags: string[];
|
|
106
129
|
provider: ComputePoolProvider;
|
|
130
|
+
/** Behaves exactly as it does on {@link ComputePoolOwnedResponse}. */
|
|
131
|
+
default_source: ComputePoolDefaultSource | null;
|
|
107
132
|
}
|
|
108
133
|
export type ComputePoolResponse = ComputePoolOwnedResponse | ComputePoolSharedResponse;
|
|
109
134
|
export interface CreateComputePoolRequestCommon {
|
|
@@ -58,6 +58,30 @@ export type AwsResponse = AssertTrue<IsAssignable<{
|
|
|
58
58
|
type: "none";
|
|
59
59
|
};
|
|
60
60
|
};
|
|
61
|
+
default_source: null;
|
|
62
|
+
}, ComputePoolResponse>>;
|
|
63
|
+
/**
|
|
64
|
+
* `default_source` is required, not optional. The API sends it on every pool —
|
|
65
|
+
* `null` on the ones that aren't the default — so a response missing it
|
|
66
|
+
* entirely is one the server does not produce.
|
|
67
|
+
*/
|
|
68
|
+
export type ResponseWithoutDefaultSource = AssertFalse<IsAssignable<{
|
|
69
|
+
type: "owned";
|
|
70
|
+
id: string;
|
|
71
|
+
company_id: number;
|
|
72
|
+
data_plane_id: string;
|
|
73
|
+
external_id: AwsEmrExternalId;
|
|
74
|
+
name: string;
|
|
75
|
+
display_name: string;
|
|
76
|
+
status: "active";
|
|
77
|
+
created_at: string;
|
|
78
|
+
tags: string[];
|
|
79
|
+
provider: AwsEmrProvider;
|
|
80
|
+
collaborators: {
|
|
81
|
+
use: {
|
|
82
|
+
type: "none";
|
|
83
|
+
};
|
|
84
|
+
};
|
|
61
85
|
}, ComputePoolResponse>>;
|
|
62
86
|
export type SnowflakeResponse = AssertTrue<IsAssignable<{
|
|
63
87
|
type: "shared";
|
|
@@ -71,5 +95,6 @@ export type SnowflakeResponse = AssertTrue<IsAssignable<{
|
|
|
71
95
|
created_at: string;
|
|
72
96
|
tags: string[];
|
|
73
97
|
provider: SnowflakeWarehouseProvider;
|
|
98
|
+
default_source: "data_plane";
|
|
74
99
|
}, ComputePoolResponse>>;
|
|
75
100
|
export {};
|