@meltstudio/meltctl 5.7.0 → 5.7.2
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/dist/index.js +129 -23
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7450,7 +7450,7 @@ var CLI_VERSION;
|
|
|
7450
7450
|
var init_version = __esm({
|
|
7451
7451
|
"src/utils/version.ts"() {
|
|
7452
7452
|
"use strict";
|
|
7453
|
-
CLI_VERSION = "5.7.
|
|
7453
|
+
CLI_VERSION = "5.7.2";
|
|
7454
7454
|
}
|
|
7455
7455
|
});
|
|
7456
7456
|
|
|
@@ -26559,8 +26559,10 @@ function createPlansResource(config2) {
|
|
|
26559
26559
|
method: "POST",
|
|
26560
26560
|
body: JSON.stringify(input)
|
|
26561
26561
|
});
|
|
26562
|
-
if (status !== 201 && status !== 200)
|
|
26563
|
-
|
|
26562
|
+
if (status !== 201 && status !== 200) {
|
|
26563
|
+
const base = data.error ?? `Failed to submit plan (${status})`;
|
|
26564
|
+
throw new Error(data.details ? `${base} \u2014 ${data.details}` : base);
|
|
26565
|
+
}
|
|
26564
26566
|
return data;
|
|
26565
26567
|
},
|
|
26566
26568
|
async list(filters) {
|
|
@@ -27083,6 +27085,22 @@ function createTrackerResource(config2) {
|
|
|
27083
27085
|
}
|
|
27084
27086
|
return data;
|
|
27085
27087
|
},
|
|
27088
|
+
/**
|
|
27089
|
+
* List the Linear teams a connection can see, independent of any project
|
|
27090
|
+
* mapping. Powers the mappings UI's board picker for a project that has no
|
|
27091
|
+
* mapping yet (the per-project `listTeams` resolves via the mapping, so a
|
|
27092
|
+
* new project's picker would be empty).
|
|
27093
|
+
*/
|
|
27094
|
+
async listConnectionTeams(connectionId) {
|
|
27095
|
+
const { data, status } = await apiFetch(config2, `/tracker/connections/${connectionId}/teams`);
|
|
27096
|
+
if (status === 403)
|
|
27097
|
+
throw new Error("Access denied. Only Team Managers can view tracker teams.");
|
|
27098
|
+
if (status !== 200) {
|
|
27099
|
+
const msg = data && typeof data === "object" && "error" in data ? data.error : void 0;
|
|
27100
|
+
throw new Error(msg ?? `Failed to list Linear teams (${status})`);
|
|
27101
|
+
}
|
|
27102
|
+
return data;
|
|
27103
|
+
},
|
|
27086
27104
|
async listJiraProjects(projectId) {
|
|
27087
27105
|
const { data, status } = await apiFetch(config2, `/tracker/jira-projects/${projectId}`);
|
|
27088
27106
|
if (status === 403)
|
|
@@ -27886,17 +27904,52 @@ function createProfileAuditsResource(config2) {
|
|
|
27886
27904
|
}
|
|
27887
27905
|
|
|
27888
27906
|
// ../sdk/dist/client.js
|
|
27907
|
+
var DEFAULT_TIMEOUT_MS = 1e4;
|
|
27908
|
+
var RETRYABLE_STATUS = /* @__PURE__ */ new Set([502, 503, 504]);
|
|
27909
|
+
function delay(ms) {
|
|
27910
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
27911
|
+
}
|
|
27912
|
+
function buildSignal(timeoutMs, caller) {
|
|
27913
|
+
const timeout = AbortSignal.timeout(timeoutMs);
|
|
27914
|
+
if (!caller)
|
|
27915
|
+
return timeout;
|
|
27916
|
+
const anyFn = AbortSignal.any;
|
|
27917
|
+
return anyFn ? anyFn([caller, timeout]) : timeout;
|
|
27918
|
+
}
|
|
27889
27919
|
async function apiFetch(config2, path9, options = {}) {
|
|
27890
|
-
const
|
|
27891
|
-
|
|
27892
|
-
|
|
27893
|
-
|
|
27894
|
-
|
|
27895
|
-
|
|
27920
|
+
const method = (options.method ?? "GET").toUpperCase();
|
|
27921
|
+
const idempotent = method === "GET" || method === "HEAD";
|
|
27922
|
+
const timeoutMs = config2.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
27923
|
+
const maxAttempts = idempotent ? 2 : 1;
|
|
27924
|
+
let lastError;
|
|
27925
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
27926
|
+
try {
|
|
27927
|
+
const response = await fetch(`${config2.baseUrl}${path9}`, {
|
|
27928
|
+
...options,
|
|
27929
|
+
signal: buildSignal(timeoutMs, options.signal),
|
|
27930
|
+
headers: {
|
|
27931
|
+
Authorization: `Bearer ${config2.token}`,
|
|
27932
|
+
"Content-Type": "application/json",
|
|
27933
|
+
...options.headers
|
|
27934
|
+
}
|
|
27935
|
+
});
|
|
27936
|
+
if (idempotent && attempt < maxAttempts && RETRYABLE_STATUS.has(response.status)) {
|
|
27937
|
+
lastError = new Error(`Upstream ${response.status}`);
|
|
27938
|
+
await delay(250 * attempt);
|
|
27939
|
+
continue;
|
|
27940
|
+
}
|
|
27941
|
+
const data = await response.json();
|
|
27942
|
+
return { data, status: response.status };
|
|
27943
|
+
} catch (err) {
|
|
27944
|
+
lastError = err;
|
|
27945
|
+
if (idempotent && attempt < maxAttempts) {
|
|
27946
|
+
await delay(250 * attempt);
|
|
27947
|
+
continue;
|
|
27948
|
+
}
|
|
27949
|
+
throw err;
|
|
27896
27950
|
}
|
|
27897
|
-
}
|
|
27898
|
-
|
|
27899
|
-
return { data, status: response.status };
|
|
27951
|
+
}
|
|
27952
|
+
throw lastError;
|
|
27900
27953
|
}
|
|
27901
27954
|
function createMeltClient(config2) {
|
|
27902
27955
|
return {
|
|
@@ -52869,8 +52922,10 @@ function createPlansResource2(config2) {
|
|
|
52869
52922
|
method: "POST",
|
|
52870
52923
|
body: JSON.stringify(input)
|
|
52871
52924
|
});
|
|
52872
|
-
if (status !== 201 && status !== 200)
|
|
52873
|
-
|
|
52925
|
+
if (status !== 201 && status !== 200) {
|
|
52926
|
+
const base = data.error ?? `Failed to submit plan (${status})`;
|
|
52927
|
+
throw new Error(data.details ? `${base} \u2014 ${data.details}` : base);
|
|
52928
|
+
}
|
|
52874
52929
|
return data;
|
|
52875
52930
|
},
|
|
52876
52931
|
async list(filters) {
|
|
@@ -53373,6 +53428,22 @@ function createTrackerResource2(config2) {
|
|
|
53373
53428
|
}
|
|
53374
53429
|
return data;
|
|
53375
53430
|
},
|
|
53431
|
+
/**
|
|
53432
|
+
* List the Linear teams a connection can see, independent of any project
|
|
53433
|
+
* mapping. Powers the mappings UI's board picker for a project that has no
|
|
53434
|
+
* mapping yet (the per-project `listTeams` resolves via the mapping, so a
|
|
53435
|
+
* new project's picker would be empty).
|
|
53436
|
+
*/
|
|
53437
|
+
async listConnectionTeams(connectionId) {
|
|
53438
|
+
const { data, status } = await apiFetch2(config2, `/tracker/connections/${connectionId}/teams`);
|
|
53439
|
+
if (status === 403)
|
|
53440
|
+
throw new Error("Access denied. Only Team Managers can view tracker teams.");
|
|
53441
|
+
if (status !== 200) {
|
|
53442
|
+
const msg = data && typeof data === "object" && "error" in data ? data.error : void 0;
|
|
53443
|
+
throw new Error(msg ?? `Failed to list Linear teams (${status})`);
|
|
53444
|
+
}
|
|
53445
|
+
return data;
|
|
53446
|
+
},
|
|
53376
53447
|
async listJiraProjects(projectId) {
|
|
53377
53448
|
const { data, status } = await apiFetch2(config2, `/tracker/jira-projects/${projectId}`);
|
|
53378
53449
|
if (status === 403)
|
|
@@ -54156,17 +54227,52 @@ function createProfileAuditsResource2(config2) {
|
|
|
54156
54227
|
}
|
|
54157
54228
|
};
|
|
54158
54229
|
}
|
|
54230
|
+
var DEFAULT_TIMEOUT_MS2 = 1e4;
|
|
54231
|
+
var RETRYABLE_STATUS2 = /* @__PURE__ */ new Set([502, 503, 504]);
|
|
54232
|
+
function delay2(ms) {
|
|
54233
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
54234
|
+
}
|
|
54235
|
+
function buildSignal2(timeoutMs, caller) {
|
|
54236
|
+
const timeout = AbortSignal.timeout(timeoutMs);
|
|
54237
|
+
if (!caller)
|
|
54238
|
+
return timeout;
|
|
54239
|
+
const anyFn = AbortSignal.any;
|
|
54240
|
+
return anyFn ? anyFn([caller, timeout]) : timeout;
|
|
54241
|
+
}
|
|
54159
54242
|
async function apiFetch2(config2, path22, options = {}) {
|
|
54160
|
-
const
|
|
54161
|
-
|
|
54162
|
-
|
|
54163
|
-
|
|
54164
|
-
|
|
54165
|
-
|
|
54243
|
+
const method = (options.method ?? "GET").toUpperCase();
|
|
54244
|
+
const idempotent = method === "GET" || method === "HEAD";
|
|
54245
|
+
const timeoutMs = config2.timeoutMs ?? DEFAULT_TIMEOUT_MS2;
|
|
54246
|
+
const maxAttempts = idempotent ? 2 : 1;
|
|
54247
|
+
let lastError;
|
|
54248
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
54249
|
+
try {
|
|
54250
|
+
const response = await fetch(`${config2.baseUrl}${path22}`, {
|
|
54251
|
+
...options,
|
|
54252
|
+
signal: buildSignal2(timeoutMs, options.signal),
|
|
54253
|
+
headers: {
|
|
54254
|
+
Authorization: `Bearer ${config2.token}`,
|
|
54255
|
+
"Content-Type": "application/json",
|
|
54256
|
+
...options.headers
|
|
54257
|
+
}
|
|
54258
|
+
});
|
|
54259
|
+
if (idempotent && attempt < maxAttempts && RETRYABLE_STATUS2.has(response.status)) {
|
|
54260
|
+
lastError = new Error(`Upstream ${response.status}`);
|
|
54261
|
+
await delay2(250 * attempt);
|
|
54262
|
+
continue;
|
|
54263
|
+
}
|
|
54264
|
+
const data = await response.json();
|
|
54265
|
+
return { data, status: response.status };
|
|
54266
|
+
} catch (err) {
|
|
54267
|
+
lastError = err;
|
|
54268
|
+
if (idempotent && attempt < maxAttempts) {
|
|
54269
|
+
await delay2(250 * attempt);
|
|
54270
|
+
continue;
|
|
54271
|
+
}
|
|
54272
|
+
throw err;
|
|
54166
54273
|
}
|
|
54167
|
-
}
|
|
54168
|
-
|
|
54169
|
-
return { data, status: response.status };
|
|
54274
|
+
}
|
|
54275
|
+
throw lastError;
|
|
54170
54276
|
}
|
|
54171
54277
|
function createMeltClient2(config2) {
|
|
54172
54278
|
return {
|
package/package.json
CHANGED