coalesce-transform-mcp 0.1.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/LICENSE +21 -0
- package/README.md +304 -0
- package/dist/cache-dir.d.ts +26 -0
- package/dist/cache-dir.js +106 -0
- package/dist/client.d.ts +25 -0
- package/dist/client.js +212 -0
- package/dist/coalesce/api/environments.d.ts +20 -0
- package/dist/coalesce/api/environments.js +15 -0
- package/dist/coalesce/api/git-accounts.d.ts +21 -0
- package/dist/coalesce/api/git-accounts.js +21 -0
- package/dist/coalesce/api/jobs.d.ts +25 -0
- package/dist/coalesce/api/jobs.js +21 -0
- package/dist/coalesce/api/nodes.d.ts +29 -0
- package/dist/coalesce/api/nodes.js +33 -0
- package/dist/coalesce/api/projects.d.ts +22 -0
- package/dist/coalesce/api/projects.js +25 -0
- package/dist/coalesce/api/runs.d.ts +19 -0
- package/dist/coalesce/api/runs.js +34 -0
- package/dist/coalesce/api/subgraphs.d.ts +20 -0
- package/dist/coalesce/api/subgraphs.js +17 -0
- package/dist/coalesce/api/users.d.ts +30 -0
- package/dist/coalesce/api/users.js +31 -0
- package/dist/coalesce/types.d.ts +298 -0
- package/dist/coalesce/types.js +746 -0
- package/dist/generated/.gitkeep +0 -0
- package/dist/generated/node-type-corpus.json +42656 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +10 -0
- package/dist/mcp/cache.d.ts +3 -0
- package/dist/mcp/cache.js +137 -0
- package/dist/mcp/environments.d.ts +3 -0
- package/dist/mcp/environments.js +61 -0
- package/dist/mcp/git-accounts.d.ts +3 -0
- package/dist/mcp/git-accounts.js +70 -0
- package/dist/mcp/jobs.d.ts +3 -0
- package/dist/mcp/jobs.js +77 -0
- package/dist/mcp/node-type-corpus.d.ts +3 -0
- package/dist/mcp/node-type-corpus.js +173 -0
- package/dist/mcp/nodes.d.ts +3 -0
- package/dist/mcp/nodes.js +341 -0
- package/dist/mcp/pipelines.d.ts +3 -0
- package/dist/mcp/pipelines.js +342 -0
- package/dist/mcp/projects.d.ts +3 -0
- package/dist/mcp/projects.js +70 -0
- package/dist/mcp/repo-node-types.d.ts +135 -0
- package/dist/mcp/repo-node-types.js +387 -0
- package/dist/mcp/runs.d.ts +3 -0
- package/dist/mcp/runs.js +92 -0
- package/dist/mcp/subgraphs.d.ts +3 -0
- package/dist/mcp/subgraphs.js +60 -0
- package/dist/mcp/users.d.ts +3 -0
- package/dist/mcp/users.js +107 -0
- package/dist/prompts/index.d.ts +2 -0
- package/dist/prompts/index.js +58 -0
- package/dist/resources/context/aggregation-patterns.md +145 -0
- package/dist/resources/context/data-engineering-principles.md +183 -0
- package/dist/resources/context/hydrated-metadata.md +92 -0
- package/dist/resources/context/id-discovery.md +64 -0
- package/dist/resources/context/intelligent-node-configuration.md +162 -0
- package/dist/resources/context/node-creation-decision-tree.md +156 -0
- package/dist/resources/context/node-operations.md +316 -0
- package/dist/resources/context/node-payloads.md +114 -0
- package/dist/resources/context/node-type-corpus.md +166 -0
- package/dist/resources/context/node-type-selection-guide.md +96 -0
- package/dist/resources/context/overview.md +135 -0
- package/dist/resources/context/pipeline-workflows.md +355 -0
- package/dist/resources/context/run-operations.md +55 -0
- package/dist/resources/context/sql-bigquery.md +41 -0
- package/dist/resources/context/sql-databricks.md +40 -0
- package/dist/resources/context/sql-platform-selection.md +70 -0
- package/dist/resources/context/sql-snowflake.md +43 -0
- package/dist/resources/context/storage-mappings.md +49 -0
- package/dist/resources/context/tool-usage.md +98 -0
- package/dist/resources/index.d.ts +5 -0
- package/dist/resources/index.js +254 -0
- package/dist/schemas/node-payloads.d.ts +5019 -0
- package/dist/schemas/node-payloads.js +147 -0
- package/dist/server.d.ts +7 -0
- package/dist/server.js +63 -0
- package/dist/services/cache/snapshots.d.ts +108 -0
- package/dist/services/cache/snapshots.js +275 -0
- package/dist/services/config/context-analyzer.d.ts +14 -0
- package/dist/services/config/context-analyzer.js +76 -0
- package/dist/services/config/field-classifier.d.ts +23 -0
- package/dist/services/config/field-classifier.js +47 -0
- package/dist/services/config/intelligent.d.ts +55 -0
- package/dist/services/config/intelligent.js +306 -0
- package/dist/services/config/rules.d.ts +6 -0
- package/dist/services/config/rules.js +44 -0
- package/dist/services/config/schema-resolver.d.ts +18 -0
- package/dist/services/config/schema-resolver.js +80 -0
- package/dist/services/corpus/loader.d.ts +56 -0
- package/dist/services/corpus/loader.js +25 -0
- package/dist/services/corpus/search.d.ts +49 -0
- package/dist/services/corpus/search.js +69 -0
- package/dist/services/corpus/templates.d.ts +4 -0
- package/dist/services/corpus/templates.js +11 -0
- package/dist/services/pipelines/execution.d.ts +20 -0
- package/dist/services/pipelines/execution.js +290 -0
- package/dist/services/pipelines/node-type-intent.d.ts +96 -0
- package/dist/services/pipelines/node-type-intent.js +356 -0
- package/dist/services/pipelines/node-type-selection.d.ts +66 -0
- package/dist/services/pipelines/node-type-selection.js +758 -0
- package/dist/services/pipelines/planning.d.ts +543 -0
- package/dist/services/pipelines/planning.js +1839 -0
- package/dist/services/policies/sql-override.d.ts +7 -0
- package/dist/services/policies/sql-override.js +109 -0
- package/dist/services/repo/operations.d.ts +6 -0
- package/dist/services/repo/operations.js +10 -0
- package/dist/services/repo/parser.d.ts +70 -0
- package/dist/services/repo/parser.js +365 -0
- package/dist/services/repo/path.d.ts +2 -0
- package/dist/services/repo/path.js +58 -0
- package/dist/services/templates/nodes.d.ts +50 -0
- package/dist/services/templates/nodes.js +336 -0
- package/dist/services/workspace/analysis.d.ts +56 -0
- package/dist/services/workspace/analysis.js +151 -0
- package/dist/services/workspace/mutations.d.ts +150 -0
- package/dist/services/workspace/mutations.js +1718 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +7 -0
- package/dist/workflows/get-environment-overview.d.ts +9 -0
- package/dist/workflows/get-environment-overview.js +23 -0
- package/dist/workflows/get-run-details.d.ts +10 -0
- package/dist/workflows/get-run-details.js +28 -0
- package/dist/workflows/progress.d.ts +20 -0
- package/dist/workflows/progress.js +54 -0
- package/dist/workflows/retry-and-wait.d.ts +13 -0
- package/dist/workflows/retry-and-wait.js +139 -0
- package/dist/workflows/run-and-wait.d.ts +13 -0
- package/dist/workflows/run-and-wait.js +141 -0
- package/dist/workflows/run-status.d.ts +10 -0
- package/dist/workflows/run-status.js +27 -0
- package/package.json +34 -0
package/dist/client.js
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
const DEFAULT_REQUEST_TIMEOUT_MS = 30_000;
|
|
2
|
+
const DEFAULT_MAX_REQUEST_BODY_BYTES = 512 * 1024; // 512 KB
|
|
3
|
+
function getMaxRequestBodyBytes() {
|
|
4
|
+
const raw = process.env.COALESCE_MCP_MAX_REQUEST_BODY_BYTES;
|
|
5
|
+
if (!raw)
|
|
6
|
+
return DEFAULT_MAX_REQUEST_BODY_BYTES;
|
|
7
|
+
const parsed = Number.parseInt(raw, 10);
|
|
8
|
+
if (!Number.isFinite(parsed) || parsed < 1)
|
|
9
|
+
return DEFAULT_MAX_REQUEST_BODY_BYTES;
|
|
10
|
+
return parsed;
|
|
11
|
+
}
|
|
12
|
+
const MAX_RETRY_ATTEMPTS = 5;
|
|
13
|
+
const RETRY_BASE_DELAY_MS = 1_000;
|
|
14
|
+
const RETRY_MAX_DELAY_MS = 30_000;
|
|
15
|
+
const RETRYABLE_RATE_LIMIT_METHODS = new Set(["GET"]);
|
|
16
|
+
export function validateConfig() {
|
|
17
|
+
const accessToken = process.env.COALESCE_ACCESS_TOKEN;
|
|
18
|
+
const baseUrl = process.env.COALESCE_BASE_URL;
|
|
19
|
+
if (!accessToken) {
|
|
20
|
+
throw new Error("COALESCE_ACCESS_TOKEN environment variable is required. " +
|
|
21
|
+
"Generate a token from the Deploy tab in Coalesce.");
|
|
22
|
+
}
|
|
23
|
+
if (!baseUrl) {
|
|
24
|
+
throw new Error("COALESCE_BASE_URL environment variable is required. " +
|
|
25
|
+
"Example: https://app.coalescesoftware.io");
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
accessToken,
|
|
29
|
+
baseUrl: baseUrl.replace(/\/+$/, ""),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export class CoalesceApiError extends Error {
|
|
33
|
+
status;
|
|
34
|
+
detail;
|
|
35
|
+
constructor(message, status, detail) {
|
|
36
|
+
super(message);
|
|
37
|
+
this.status = status;
|
|
38
|
+
this.detail = detail;
|
|
39
|
+
this.name = "CoalesceApiError";
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function parseRetryAfterMs(header) {
|
|
43
|
+
if (!header)
|
|
44
|
+
return undefined;
|
|
45
|
+
const seconds = Number(header);
|
|
46
|
+
if (Number.isFinite(seconds) && seconds >= 0) {
|
|
47
|
+
return Math.ceil(seconds * 1000);
|
|
48
|
+
}
|
|
49
|
+
// Retry-After can also be an HTTP-date; fall back to undefined
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
function retryDelayMs(attempt, retryAfterMs) {
|
|
53
|
+
if (retryAfterMs !== undefined && retryAfterMs > 0) {
|
|
54
|
+
return Math.min(retryAfterMs, RETRY_MAX_DELAY_MS);
|
|
55
|
+
}
|
|
56
|
+
// Exponential backoff: 1s, 2s, 4s, 8s, ...
|
|
57
|
+
return Math.min(RETRY_BASE_DELAY_MS * Math.pow(2, attempt), RETRY_MAX_DELAY_MS);
|
|
58
|
+
}
|
|
59
|
+
function sleep(ms) {
|
|
60
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
61
|
+
}
|
|
62
|
+
function shouldRetryRateLimit(method) {
|
|
63
|
+
return RETRYABLE_RATE_LIMIT_METHODS.has(method);
|
|
64
|
+
}
|
|
65
|
+
async function handleResponse(response) {
|
|
66
|
+
if (response.status === 204) {
|
|
67
|
+
return { message: "Operation completed successfully" };
|
|
68
|
+
}
|
|
69
|
+
if (!response.ok) {
|
|
70
|
+
let detail;
|
|
71
|
+
try {
|
|
72
|
+
detail = await response.json();
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
detail = undefined;
|
|
76
|
+
}
|
|
77
|
+
switch (response.status) {
|
|
78
|
+
case 400:
|
|
79
|
+
// Include full validation body in error message for debugging
|
|
80
|
+
const message = detail && typeof detail === "object" && "message" in detail
|
|
81
|
+
? String(detail.message)
|
|
82
|
+
: "Bad request";
|
|
83
|
+
const fullMessage = detail && typeof detail === "object"
|
|
84
|
+
? `${message}\n\nValidation details: ${JSON.stringify(detail, null, 2)}`
|
|
85
|
+
: message;
|
|
86
|
+
throw new CoalesceApiError(fullMessage, 400, detail);
|
|
87
|
+
case 401:
|
|
88
|
+
throw new CoalesceApiError("Invalid or expired access token", 401, detail);
|
|
89
|
+
case 403:
|
|
90
|
+
throw new CoalesceApiError("Insufficient permissions for this operation", 403, detail);
|
|
91
|
+
case 404:
|
|
92
|
+
throw new CoalesceApiError("Resource not found", 404, detail);
|
|
93
|
+
case 429: {
|
|
94
|
+
const retryAfterHeader = response.headers.get("Retry-After");
|
|
95
|
+
const retryAfterMs = parseRetryAfterMs(retryAfterHeader);
|
|
96
|
+
throw new CoalesceApiError("Coalesce API rate limit exceeded", 429, { ...(retryAfterMs !== undefined ? { retryAfterMs } : {}), ...(detail && typeof detail === "object" ? detail : {}) });
|
|
97
|
+
}
|
|
98
|
+
default:
|
|
99
|
+
throw new CoalesceApiError(`Coalesce API unavailable (HTTP ${response.status})`, response.status, detail);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return response.json();
|
|
103
|
+
}
|
|
104
|
+
export function createClient(config) {
|
|
105
|
+
const defaultRequestTimeoutMs = Math.max(1, Math.floor(config.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS));
|
|
106
|
+
function buildUrl(path, params) {
|
|
107
|
+
const url = new URL(path, config.baseUrl);
|
|
108
|
+
if (params) {
|
|
109
|
+
for (const [key, value] of Object.entries(params)) {
|
|
110
|
+
if (value !== undefined) {
|
|
111
|
+
url.searchParams.set(key, String(value));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return url.toString();
|
|
116
|
+
}
|
|
117
|
+
function headers(method) {
|
|
118
|
+
const h = {
|
|
119
|
+
Authorization: `Bearer ${config.accessToken}`,
|
|
120
|
+
Accept: "application/json",
|
|
121
|
+
};
|
|
122
|
+
if (method === "POST" || method === "PUT" || method === "PATCH") {
|
|
123
|
+
h["Content-Type"] = "application/json";
|
|
124
|
+
}
|
|
125
|
+
return h;
|
|
126
|
+
}
|
|
127
|
+
function effectiveTimeoutMs(options) {
|
|
128
|
+
if (options?.timeoutMs === undefined) {
|
|
129
|
+
return defaultRequestTimeoutMs;
|
|
130
|
+
}
|
|
131
|
+
return Math.max(1, Math.min(defaultRequestTimeoutMs, Math.floor(options.timeoutMs)));
|
|
132
|
+
}
|
|
133
|
+
async function requestOnce(method, path, params, body, options) {
|
|
134
|
+
const timeoutMs = effectiveTimeoutMs(options);
|
|
135
|
+
const serializedBody = body !== undefined ? JSON.stringify(body) : undefined;
|
|
136
|
+
if (serializedBody !== undefined) {
|
|
137
|
+
const maxBytes = getMaxRequestBodyBytes();
|
|
138
|
+
const bodyBytes = Buffer.byteLength(serializedBody, "utf8");
|
|
139
|
+
if (bodyBytes > maxBytes) {
|
|
140
|
+
const sizeMB = (bodyBytes / (1024 * 1024)).toFixed(2);
|
|
141
|
+
const limitKB = Math.round(maxBytes / 1024);
|
|
142
|
+
throw new CoalesceApiError(`Request body exceeds ${limitKB} KB limit (got ${sizeMB} MB). ` +
|
|
143
|
+
`This usually means a large cached response was accidentally passed as tool input. ` +
|
|
144
|
+
`Override with COALESCE_MCP_MAX_REQUEST_BODY_BYTES if this payload is intentional.`, 413, { bodyBytes, maxBytes, method, path });
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const controller = new AbortController();
|
|
148
|
+
const timeoutHandle = setTimeout(() => controller.abort(), timeoutMs);
|
|
149
|
+
timeoutHandle.unref?.();
|
|
150
|
+
try {
|
|
151
|
+
const response = await fetch(buildUrl(path, params), {
|
|
152
|
+
method,
|
|
153
|
+
headers: headers(method),
|
|
154
|
+
body: serializedBody,
|
|
155
|
+
signal: controller.signal,
|
|
156
|
+
});
|
|
157
|
+
return await handleResponse(response);
|
|
158
|
+
}
|
|
159
|
+
catch (error) {
|
|
160
|
+
if (error instanceof CoalesceApiError) {
|
|
161
|
+
throw error;
|
|
162
|
+
}
|
|
163
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
164
|
+
throw new CoalesceApiError(`Coalesce API request timed out after ${timeoutMs}ms`, 408, { method, path });
|
|
165
|
+
}
|
|
166
|
+
throw new CoalesceApiError("Unable to reach Coalesce API", 503, error instanceof Error ? { message: error.message } : error);
|
|
167
|
+
}
|
|
168
|
+
finally {
|
|
169
|
+
clearTimeout(timeoutHandle);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
async function request(method, path, params, body, options) {
|
|
173
|
+
for (let attempt = 0; attempt < MAX_RETRY_ATTEMPTS; attempt++) {
|
|
174
|
+
try {
|
|
175
|
+
return await requestOnce(method, path, params, body, options);
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
if (error instanceof CoalesceApiError &&
|
|
179
|
+
error.status === 429 &&
|
|
180
|
+
shouldRetryRateLimit(method) &&
|
|
181
|
+
attempt < MAX_RETRY_ATTEMPTS - 1) {
|
|
182
|
+
const detail = error.detail;
|
|
183
|
+
const retryAfterMs = typeof detail?.retryAfterMs === "number"
|
|
184
|
+
? detail.retryAfterMs
|
|
185
|
+
: undefined;
|
|
186
|
+
await sleep(retryDelayMs(attempt, retryAfterMs));
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
throw error;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
// Unreachable, but satisfies TypeScript
|
|
193
|
+
throw new CoalesceApiError("Unexpected retry loop exit", 500);
|
|
194
|
+
}
|
|
195
|
+
return {
|
|
196
|
+
async get(path, params, options) {
|
|
197
|
+
return request("GET", path, params, undefined, options);
|
|
198
|
+
},
|
|
199
|
+
async post(path, body, params, options) {
|
|
200
|
+
return request("POST", path, params, body, options);
|
|
201
|
+
},
|
|
202
|
+
async put(path, body, params, options) {
|
|
203
|
+
return request("PUT", path, params, body, options);
|
|
204
|
+
},
|
|
205
|
+
async patch(path, body, params, options) {
|
|
206
|
+
return request("PATCH", path, params, body, options);
|
|
207
|
+
},
|
|
208
|
+
async delete(path, params, options) {
|
|
209
|
+
return request("DELETE", path, params, undefined, options);
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CoalesceClient, QueryParams } from "../../client.js";
|
|
2
|
+
export declare function listEnvironments(client: CoalesceClient, params: QueryParams): Promise<unknown>;
|
|
3
|
+
export declare function getEnvironment(client: CoalesceClient, params: {
|
|
4
|
+
environmentID: string;
|
|
5
|
+
}): Promise<unknown>;
|
|
6
|
+
export declare function createEnvironment(client: CoalesceClient, params: {
|
|
7
|
+
project: string;
|
|
8
|
+
name: string;
|
|
9
|
+
oauthEnabled?: boolean;
|
|
10
|
+
devEnv?: boolean;
|
|
11
|
+
connectionAccount?: string;
|
|
12
|
+
runTimeParameters?: Record<string, unknown>;
|
|
13
|
+
tagColors?: {
|
|
14
|
+
backgroundColor?: string;
|
|
15
|
+
textColor?: string;
|
|
16
|
+
};
|
|
17
|
+
}): Promise<unknown>;
|
|
18
|
+
export declare function deleteEnvironment(client: CoalesceClient, params: {
|
|
19
|
+
environmentID: string;
|
|
20
|
+
}): Promise<unknown>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { validatePathSegment } from "../types.js";
|
|
2
|
+
export async function listEnvironments(client, params) {
|
|
3
|
+
return client.get("/api/v1/environments", params);
|
|
4
|
+
}
|
|
5
|
+
export async function getEnvironment(client, params) {
|
|
6
|
+
const { environmentID } = params;
|
|
7
|
+
return client.get(`/api/v1/environments/${validatePathSegment(environmentID, "environmentID")}`, {});
|
|
8
|
+
}
|
|
9
|
+
export async function createEnvironment(client, params) {
|
|
10
|
+
return client.post("/api/v1/environments", params);
|
|
11
|
+
}
|
|
12
|
+
export async function deleteEnvironment(client, params) {
|
|
13
|
+
const { environmentID } = params;
|
|
14
|
+
return client.delete(`/api/v1/environments/${validatePathSegment(environmentID, "environmentID")}`);
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CoalesceClient } from "../../client.js";
|
|
2
|
+
export declare function listGitAccounts(client: CoalesceClient, params?: {
|
|
3
|
+
accountOwner?: string;
|
|
4
|
+
}): Promise<unknown>;
|
|
5
|
+
export declare function getGitAccount(client: CoalesceClient, params: {
|
|
6
|
+
gitAccountID: string;
|
|
7
|
+
accountOwner?: string;
|
|
8
|
+
}): Promise<unknown>;
|
|
9
|
+
export declare function createGitAccount(client: CoalesceClient, params: {
|
|
10
|
+
body: Record<string, unknown>;
|
|
11
|
+
accountOwner?: string;
|
|
12
|
+
}): Promise<unknown>;
|
|
13
|
+
export declare function updateGitAccount(client: CoalesceClient, params: {
|
|
14
|
+
gitAccountID: string;
|
|
15
|
+
body: Record<string, unknown>;
|
|
16
|
+
accountOwner?: string;
|
|
17
|
+
}): Promise<unknown>;
|
|
18
|
+
export declare function deleteGitAccount(client: CoalesceClient, params: {
|
|
19
|
+
gitAccountID: string;
|
|
20
|
+
accountOwner?: string;
|
|
21
|
+
}): Promise<unknown>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { validatePathSegment } from "../types.js";
|
|
2
|
+
export async function listGitAccounts(client, params) {
|
|
3
|
+
return client.get("/api/v1/gitAccounts", {
|
|
4
|
+
...(params?.accountOwner !== undefined ? { accountOwner: params.accountOwner } : {}),
|
|
5
|
+
});
|
|
6
|
+
}
|
|
7
|
+
export async function getGitAccount(client, params) {
|
|
8
|
+
return client.get(`/api/v1/gitAccounts/${validatePathSegment(params.gitAccountID, "gitAccountID")}`, {
|
|
9
|
+
...(params.accountOwner !== undefined ? { accountOwner: params.accountOwner } : {}),
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export async function createGitAccount(client, params) {
|
|
13
|
+
const qp = params.accountOwner ? { accountOwner: params.accountOwner } : undefined;
|
|
14
|
+
return client.post("/api/v1/gitAccounts", params.body, qp);
|
|
15
|
+
}
|
|
16
|
+
export async function updateGitAccount(client, params) {
|
|
17
|
+
return client.patch(`/api/v1/gitAccounts/${validatePathSegment(params.gitAccountID, "gitAccountID")}`, params.body, { ...(params.accountOwner !== undefined ? { accountOwner: params.accountOwner } : {}) });
|
|
18
|
+
}
|
|
19
|
+
export async function deleteGitAccount(client, params) {
|
|
20
|
+
return client.delete(`/api/v1/gitAccounts/${validatePathSegment(params.gitAccountID, "gitAccountID")}`, params.accountOwner ? { accountOwner: params.accountOwner } : undefined);
|
|
21
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CoalesceClient, QueryParams } from "../../client.js";
|
|
2
|
+
export declare function listEnvironmentJobs(client: CoalesceClient, params: {
|
|
3
|
+
environmentID: string;
|
|
4
|
+
} & QueryParams): Promise<unknown>;
|
|
5
|
+
export declare function createWorkspaceJob(client: CoalesceClient, params: {
|
|
6
|
+
workspaceID: string;
|
|
7
|
+
name: string;
|
|
8
|
+
includeSelector: string;
|
|
9
|
+
excludeSelector: string;
|
|
10
|
+
}): Promise<unknown>;
|
|
11
|
+
export declare function getEnvironmentJob(client: CoalesceClient, params: {
|
|
12
|
+
environmentID: string;
|
|
13
|
+
jobID: string;
|
|
14
|
+
}): Promise<unknown>;
|
|
15
|
+
export declare function updateWorkspaceJob(client: CoalesceClient, params: {
|
|
16
|
+
workspaceID: string;
|
|
17
|
+
jobID: string;
|
|
18
|
+
name: string;
|
|
19
|
+
includeSelector: string;
|
|
20
|
+
excludeSelector: string;
|
|
21
|
+
}): Promise<unknown>;
|
|
22
|
+
export declare function deleteWorkspaceJob(client: CoalesceClient, params: {
|
|
23
|
+
workspaceID: string;
|
|
24
|
+
jobID: string;
|
|
25
|
+
}): Promise<unknown>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { validatePathSegment } from "../types.js";
|
|
2
|
+
export async function listEnvironmentJobs(client, params) {
|
|
3
|
+
const { environmentID, ...query } = params;
|
|
4
|
+
return client.get(`/api/v1/environments/${validatePathSegment(environmentID, "environmentID")}/jobs`, query);
|
|
5
|
+
}
|
|
6
|
+
export async function createWorkspaceJob(client, params) {
|
|
7
|
+
const { workspaceID, ...body } = params;
|
|
8
|
+
return client.post(`/api/v1/workspaces/${validatePathSegment(workspaceID, "workspaceID")}/jobs`, body);
|
|
9
|
+
}
|
|
10
|
+
export async function getEnvironmentJob(client, params) {
|
|
11
|
+
const { environmentID, jobID } = params;
|
|
12
|
+
return client.get(`/api/v1/environments/${validatePathSegment(environmentID, "environmentID")}/jobs/${validatePathSegment(jobID, "jobID")}`, {});
|
|
13
|
+
}
|
|
14
|
+
export async function updateWorkspaceJob(client, params) {
|
|
15
|
+
const { workspaceID, jobID, ...body } = params;
|
|
16
|
+
return client.put(`/api/v1/workspaces/${validatePathSegment(workspaceID, "workspaceID")}/jobs/${validatePathSegment(jobID, "jobID")}`, body);
|
|
17
|
+
}
|
|
18
|
+
export async function deleteWorkspaceJob(client, params) {
|
|
19
|
+
const { workspaceID, jobID } = params;
|
|
20
|
+
return client.delete(`/api/v1/workspaces/${validatePathSegment(workspaceID, "workspaceID")}/jobs/${validatePathSegment(jobID, "jobID")}`);
|
|
21
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { CoalesceClient, QueryParams } from "../../client.js";
|
|
2
|
+
export declare function listEnvironmentNodes(client: CoalesceClient, params: QueryParams & {
|
|
3
|
+
environmentID: string;
|
|
4
|
+
}): Promise<unknown>;
|
|
5
|
+
export declare function listWorkspaceNodes(client: CoalesceClient, params: QueryParams & {
|
|
6
|
+
workspaceID: string;
|
|
7
|
+
}): Promise<unknown>;
|
|
8
|
+
export declare function getEnvironmentNode(client: CoalesceClient, params: {
|
|
9
|
+
environmentID: string;
|
|
10
|
+
nodeID: string;
|
|
11
|
+
}): Promise<unknown>;
|
|
12
|
+
export declare function getWorkspaceNode(client: CoalesceClient, params: {
|
|
13
|
+
workspaceID: string;
|
|
14
|
+
nodeID: string;
|
|
15
|
+
}): Promise<unknown>;
|
|
16
|
+
export declare function createWorkspaceNode(client: CoalesceClient, params: {
|
|
17
|
+
workspaceID: string;
|
|
18
|
+
nodeType: string;
|
|
19
|
+
predecessorNodeIDs?: string[];
|
|
20
|
+
}): Promise<unknown>;
|
|
21
|
+
export declare function setWorkspaceNode(client: CoalesceClient, params: {
|
|
22
|
+
workspaceID: string;
|
|
23
|
+
nodeID: string;
|
|
24
|
+
body: Record<string, unknown>;
|
|
25
|
+
}): Promise<unknown>;
|
|
26
|
+
export declare function deleteWorkspaceNode(client: CoalesceClient, params: {
|
|
27
|
+
workspaceID: string;
|
|
28
|
+
nodeID: string;
|
|
29
|
+
}): Promise<unknown>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { validatePathSegment } from "../types.js";
|
|
2
|
+
export async function listEnvironmentNodes(client, params) {
|
|
3
|
+
const { environmentID, ...queryParams } = params;
|
|
4
|
+
return client.get(`/api/v1/environments/${validatePathSegment(environmentID, "environmentID")}/nodes`, queryParams);
|
|
5
|
+
}
|
|
6
|
+
export async function listWorkspaceNodes(client, params) {
|
|
7
|
+
const { workspaceID, ...queryParams } = params;
|
|
8
|
+
return client.get(`/api/v1/workspaces/${validatePathSegment(workspaceID, "workspaceID")}/nodes`, queryParams);
|
|
9
|
+
}
|
|
10
|
+
export async function getEnvironmentNode(client, params) {
|
|
11
|
+
const { environmentID, nodeID } = params;
|
|
12
|
+
return client.get(`/api/v1/environments/${validatePathSegment(environmentID, "environmentID")}/nodes/${validatePathSegment(nodeID, "nodeID")}`, {});
|
|
13
|
+
}
|
|
14
|
+
export async function getWorkspaceNode(client, params) {
|
|
15
|
+
const { workspaceID, nodeID } = params;
|
|
16
|
+
return client.get(`/api/v1/workspaces/${validatePathSegment(workspaceID, "workspaceID")}/nodes/${validatePathSegment(nodeID, "nodeID")}`, {});
|
|
17
|
+
}
|
|
18
|
+
export async function createWorkspaceNode(client, params) {
|
|
19
|
+
const { workspaceID, nodeType, predecessorNodeIDs } = params;
|
|
20
|
+
const payload = { nodeType };
|
|
21
|
+
if (predecessorNodeIDs !== undefined) {
|
|
22
|
+
payload.predecessorNodeIDs = predecessorNodeIDs;
|
|
23
|
+
}
|
|
24
|
+
return client.post(`/api/v1/workspaces/${validatePathSegment(workspaceID, "workspaceID")}/nodes`, payload);
|
|
25
|
+
}
|
|
26
|
+
export async function setWorkspaceNode(client, params) {
|
|
27
|
+
const { workspaceID, nodeID, body } = params;
|
|
28
|
+
return client.put(`/api/v1/workspaces/${validatePathSegment(workspaceID, "workspaceID")}/nodes/${validatePathSegment(nodeID, "nodeID")}`, body);
|
|
29
|
+
}
|
|
30
|
+
export async function deleteWorkspaceNode(client, params) {
|
|
31
|
+
const { workspaceID, nodeID } = params;
|
|
32
|
+
return client.delete(`/api/v1/workspaces/${validatePathSegment(workspaceID, "workspaceID")}/nodes/${validatePathSegment(nodeID, "nodeID")}`);
|
|
33
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CoalesceClient } from "../../client.js";
|
|
2
|
+
export declare function listProjects(client: CoalesceClient, params?: {
|
|
3
|
+
includeWorkspaces?: boolean;
|
|
4
|
+
includeJobs?: boolean;
|
|
5
|
+
}): Promise<unknown>;
|
|
6
|
+
export declare function getProject(client: CoalesceClient, params: {
|
|
7
|
+
projectID: string;
|
|
8
|
+
includeWorkspaces?: boolean;
|
|
9
|
+
includeJobs?: boolean;
|
|
10
|
+
}): Promise<unknown>;
|
|
11
|
+
export declare function createProject(client: CoalesceClient, params: {
|
|
12
|
+
body: Record<string, unknown>;
|
|
13
|
+
}): Promise<unknown>;
|
|
14
|
+
export declare function updateProject(client: CoalesceClient, params: {
|
|
15
|
+
projectID: string;
|
|
16
|
+
body: Record<string, unknown>;
|
|
17
|
+
includeWorkspaces?: boolean;
|
|
18
|
+
includeJobs?: boolean;
|
|
19
|
+
}): Promise<unknown>;
|
|
20
|
+
export declare function deleteProject(client: CoalesceClient, params: {
|
|
21
|
+
projectID: string;
|
|
22
|
+
}): Promise<unknown>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { validatePathSegment } from "../types.js";
|
|
2
|
+
export async function listProjects(client, params) {
|
|
3
|
+
return client.get("/api/v1/projects", {
|
|
4
|
+
...(params?.includeWorkspaces !== undefined ? { includeWorkspaces: params.includeWorkspaces } : {}),
|
|
5
|
+
...(params?.includeJobs !== undefined ? { includeJobs: params.includeJobs } : {}),
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
export async function getProject(client, params) {
|
|
9
|
+
return client.get(`/api/v1/projects/${validatePathSegment(params.projectID, "projectID")}`, {
|
|
10
|
+
...(params.includeWorkspaces !== undefined ? { includeWorkspaces: params.includeWorkspaces } : {}),
|
|
11
|
+
...(params.includeJobs !== undefined ? { includeJobs: params.includeJobs } : {}),
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export async function createProject(client, params) {
|
|
15
|
+
return client.post("/api/v1/projects", params.body);
|
|
16
|
+
}
|
|
17
|
+
export async function updateProject(client, params) {
|
|
18
|
+
return client.patch(`/api/v1/projects/${validatePathSegment(params.projectID, "projectID")}`, params.body, {
|
|
19
|
+
...(params.includeWorkspaces !== undefined ? { includeWorkspaces: params.includeWorkspaces } : {}),
|
|
20
|
+
...(params.includeJobs !== undefined ? { includeJobs: params.includeJobs } : {}),
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export async function deleteProject(client, params) {
|
|
24
|
+
return client.delete(`/api/v1/projects/${validatePathSegment(params.projectID, "projectID")}`);
|
|
25
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CoalesceClient, QueryParams } from "../../client.js";
|
|
2
|
+
import type { StartRunInput, RerunInput } from "../types.js";
|
|
3
|
+
export declare function listRuns(client: CoalesceClient, params: QueryParams): Promise<unknown>;
|
|
4
|
+
export declare function getRun(client: CoalesceClient, params: {
|
|
5
|
+
runID: string;
|
|
6
|
+
}): Promise<unknown>;
|
|
7
|
+
export declare function getRunResults(client: CoalesceClient, params: {
|
|
8
|
+
runID: string;
|
|
9
|
+
}): Promise<unknown>;
|
|
10
|
+
export declare function startRun(client: CoalesceClient, params: StartRunInput): Promise<unknown>;
|
|
11
|
+
export declare function runStatus(client: CoalesceClient, params: {
|
|
12
|
+
runCounter: number;
|
|
13
|
+
}): Promise<unknown>;
|
|
14
|
+
export declare function retryRun(client: CoalesceClient, params: RerunInput): Promise<unknown>;
|
|
15
|
+
export declare function cancelRun(client: CoalesceClient, params: {
|
|
16
|
+
runID: string;
|
|
17
|
+
orgID?: string;
|
|
18
|
+
environmentID: string;
|
|
19
|
+
}): Promise<unknown>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { validatePathSegment, buildStartRunBody, buildRerunBody } from "../types.js";
|
|
2
|
+
export async function listRuns(client, params) {
|
|
3
|
+
return client.get("/api/v1/runs", params);
|
|
4
|
+
}
|
|
5
|
+
export async function getRun(client, params) {
|
|
6
|
+
const { runID } = params;
|
|
7
|
+
return client.get(`/api/v1/runs/${validatePathSegment(runID, "runID")}`, {});
|
|
8
|
+
}
|
|
9
|
+
export async function getRunResults(client, params) {
|
|
10
|
+
const { runID } = params;
|
|
11
|
+
return client.get(`/api/v1/runs/${validatePathSegment(runID, "runID")}/results`, {});
|
|
12
|
+
}
|
|
13
|
+
export async function startRun(client, params) {
|
|
14
|
+
const body = buildStartRunBody(params);
|
|
15
|
+
return client.post("/scheduler/startRun", body);
|
|
16
|
+
}
|
|
17
|
+
export async function runStatus(client, params) {
|
|
18
|
+
return client.get("/scheduler/runStatus", { runCounter: params.runCounter });
|
|
19
|
+
}
|
|
20
|
+
export async function retryRun(client, params) {
|
|
21
|
+
const body = buildRerunBody(params);
|
|
22
|
+
return client.post("/scheduler/rerun", body);
|
|
23
|
+
}
|
|
24
|
+
export async function cancelRun(client, params) {
|
|
25
|
+
const orgID = params.orgID ?? process.env.COALESCE_ORG_ID;
|
|
26
|
+
if (!orgID) {
|
|
27
|
+
throw new Error("orgID is required for cancel-run. Provide it explicitly or set COALESCE_ORG_ID.");
|
|
28
|
+
}
|
|
29
|
+
return client.post("/scheduler/cancelRun", {
|
|
30
|
+
runID: params.runID,
|
|
31
|
+
orgID,
|
|
32
|
+
environmentID: params.environmentID,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CoalesceClient } from "../../client.js";
|
|
2
|
+
export declare function getWorkspaceSubgraph(client: CoalesceClient, params: {
|
|
3
|
+
workspaceID: string;
|
|
4
|
+
subgraphID: string;
|
|
5
|
+
}): Promise<unknown>;
|
|
6
|
+
export declare function createWorkspaceSubgraph(client: CoalesceClient, params: {
|
|
7
|
+
workspaceID: string;
|
|
8
|
+
name: string;
|
|
9
|
+
steps: string[];
|
|
10
|
+
}): Promise<unknown>;
|
|
11
|
+
export declare function updateWorkspaceSubgraph(client: CoalesceClient, params: {
|
|
12
|
+
workspaceID: string;
|
|
13
|
+
subgraphID: string;
|
|
14
|
+
name: string;
|
|
15
|
+
steps: string[];
|
|
16
|
+
}): Promise<unknown>;
|
|
17
|
+
export declare function deleteWorkspaceSubgraph(client: CoalesceClient, params: {
|
|
18
|
+
workspaceID: string;
|
|
19
|
+
subgraphID: string;
|
|
20
|
+
}): Promise<unknown>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { validatePathSegment } from "../types.js";
|
|
2
|
+
export async function getWorkspaceSubgraph(client, params) {
|
|
3
|
+
const { workspaceID, subgraphID } = params;
|
|
4
|
+
return client.get(`/api/v1/workspaces/${validatePathSegment(workspaceID, "workspaceID")}/subgraphs/${validatePathSegment(subgraphID, "subgraphID")}`, {});
|
|
5
|
+
}
|
|
6
|
+
export async function createWorkspaceSubgraph(client, params) {
|
|
7
|
+
const { workspaceID, ...body } = params;
|
|
8
|
+
return client.post(`/api/v1/workspaces/${validatePathSegment(workspaceID, "workspaceID")}/subgraphs`, body);
|
|
9
|
+
}
|
|
10
|
+
export async function updateWorkspaceSubgraph(client, params) {
|
|
11
|
+
const { workspaceID, subgraphID, ...body } = params;
|
|
12
|
+
return client.put(`/api/v1/workspaces/${validatePathSegment(workspaceID, "workspaceID")}/subgraphs/${validatePathSegment(subgraphID, "subgraphID")}`, body);
|
|
13
|
+
}
|
|
14
|
+
export async function deleteWorkspaceSubgraph(client, params) {
|
|
15
|
+
const { workspaceID, subgraphID } = params;
|
|
16
|
+
return client.delete(`/api/v1/workspaces/${validatePathSegment(workspaceID, "workspaceID")}/subgraphs/${validatePathSegment(subgraphID, "subgraphID")}`);
|
|
17
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { CoalesceClient, QueryParams } from "../../client.js";
|
|
2
|
+
export declare function listOrgUsers(client: CoalesceClient, params: QueryParams): Promise<unknown>;
|
|
3
|
+
export declare function getUserRoles(client: CoalesceClient, params: {
|
|
4
|
+
userID: string;
|
|
5
|
+
projectID?: string;
|
|
6
|
+
environmentID?: string;
|
|
7
|
+
}): Promise<unknown>;
|
|
8
|
+
export declare function listUserRoles(client: CoalesceClient, params: QueryParams): Promise<unknown>;
|
|
9
|
+
export declare function setOrgRole(client: CoalesceClient, params: {
|
|
10
|
+
userID: string;
|
|
11
|
+
body: Record<string, unknown>;
|
|
12
|
+
}): Promise<unknown>;
|
|
13
|
+
export declare function setProjectRole(client: CoalesceClient, params: {
|
|
14
|
+
userID: string;
|
|
15
|
+
projectID: string;
|
|
16
|
+
body: Record<string, unknown>;
|
|
17
|
+
}): Promise<unknown>;
|
|
18
|
+
export declare function deleteProjectRole(client: CoalesceClient, params: {
|
|
19
|
+
userID: string;
|
|
20
|
+
projectID: string;
|
|
21
|
+
}): Promise<unknown>;
|
|
22
|
+
export declare function setEnvRole(client: CoalesceClient, params: {
|
|
23
|
+
userID: string;
|
|
24
|
+
environmentID: string;
|
|
25
|
+
body: Record<string, unknown>;
|
|
26
|
+
}): Promise<unknown>;
|
|
27
|
+
export declare function deleteEnvRole(client: CoalesceClient, params: {
|
|
28
|
+
userID: string;
|
|
29
|
+
environmentID: string;
|
|
30
|
+
}): Promise<unknown>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { validatePathSegment } from "../types.js";
|
|
2
|
+
export async function listOrgUsers(client, params) {
|
|
3
|
+
return client.get("/api/v1/users", params);
|
|
4
|
+
}
|
|
5
|
+
export async function getUserRoles(client, params) {
|
|
6
|
+
const { userID, ...queryParams } = params;
|
|
7
|
+
return client.get(`/api/v2/userRoles/${validatePathSegment(userID, "userID")}`, queryParams);
|
|
8
|
+
}
|
|
9
|
+
export async function listUserRoles(client, params) {
|
|
10
|
+
return client.get("/api/v2/userRoles", params);
|
|
11
|
+
}
|
|
12
|
+
export async function setOrgRole(client, params) {
|
|
13
|
+
const { userID, body } = params;
|
|
14
|
+
return client.put(`/api/v2/userRoles/${validatePathSegment(userID, "userID")}/organizationRole`, body);
|
|
15
|
+
}
|
|
16
|
+
export async function setProjectRole(client, params) {
|
|
17
|
+
const { userID, projectID, body } = params;
|
|
18
|
+
return client.put(`/api/v2/userRoles/${validatePathSegment(userID, "userID")}/projects/${validatePathSegment(projectID, "projectID")}`, body);
|
|
19
|
+
}
|
|
20
|
+
export async function deleteProjectRole(client, params) {
|
|
21
|
+
const { userID, projectID } = params;
|
|
22
|
+
return client.delete(`/api/v2/userRoles/${validatePathSegment(userID, "userID")}/projects/${validatePathSegment(projectID, "projectID")}`);
|
|
23
|
+
}
|
|
24
|
+
export async function setEnvRole(client, params) {
|
|
25
|
+
const { userID, environmentID, body } = params;
|
|
26
|
+
return client.put(`/api/v2/userRoles/${validatePathSegment(userID, "userID")}/environments/${validatePathSegment(environmentID, "environmentID")}`, body);
|
|
27
|
+
}
|
|
28
|
+
export async function deleteEnvRole(client, params) {
|
|
29
|
+
const { userID, environmentID } = params;
|
|
30
|
+
return client.delete(`/api/v2/userRoles/${validatePathSegment(userID, "userID")}/environments/${validatePathSegment(environmentID, "environmentID")}`);
|
|
31
|
+
}
|