stow-cli 2.1.0 → 2.2.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/dist/app-Q6EW7VSM.js +249 -0
- package/dist/backfill-EVZT7RH6.js +67 -0
- package/dist/backfill-JCNPLFJU.js +67 -0
- package/dist/backfill-VAORMLMY.js +67 -0
- package/dist/buckets-AFNX7FV3.js +137 -0
- package/dist/buckets-VYI2QVLO.js +137 -0
- package/dist/buckets-ZHP3LBLC.js +137 -0
- package/dist/chunk-3BLL5SQJ.js +27 -0
- package/dist/chunk-5BVMPHKH.js +147 -0
- package/dist/chunk-5IX3ASXH.js +153 -0
- package/dist/chunk-FZGOTXTE.js +45 -0
- package/dist/chunk-P2BKGBQE.js +136 -0
- package/dist/chunk-PLZFHPLC.js +52 -0
- package/dist/cli.js +80 -53
- package/dist/delete-YEXSMG4I.js +34 -0
- package/dist/describe-CU5FBHZS.js +79 -0
- package/dist/describe-HSEHMJVD.js +79 -0
- package/dist/describe-J4ZMUXK7.js +79 -0
- package/dist/drops-5VIEW3XZ.js +39 -0
- package/dist/files-CFOTEASC.js +206 -0
- package/dist/files-UQODXWNT.js +206 -0
- package/dist/files-XU6MDPP4.js +206 -0
- package/dist/health-RICGWQGN.js +61 -0
- package/dist/health-SH6T6DZS.js +61 -0
- package/dist/health-YLNNKAFP.js +61 -0
- package/dist/jobs-PTV2W5PJ.js +102 -0
- package/dist/jobs-RMRGXLAA.js +90 -0
- package/dist/jobs-ROJFRPMR.js +90 -0
- package/dist/jobs-TND5AHCL.js +102 -0
- package/dist/jobs-TOLVGN6K.js +102 -0
- package/dist/jobs-ZWSEXNFA.js +90 -0
- package/dist/maintenance-6XNJ56LL.js +79 -0
- package/dist/maintenance-V2TXPXQE.js +79 -0
- package/dist/maintenance-ZJW2ES4L.js +79 -0
- package/dist/profiles-CHBGKQOE.js +53 -0
- package/dist/profiles-MB3TZQE4.js +53 -0
- package/dist/profiles-NVCJCYXR.js +53 -0
- package/dist/queues-AUGTAFBT.js +61 -0
- package/dist/queues-EZ2VZGXQ.js +61 -0
- package/dist/queues-NR25TGT7.js +61 -0
- package/dist/search-ETC2EXKM.js +135 -0
- package/dist/search-ICJO264J.js +135 -0
- package/dist/search-TRTPX2SQ.js +135 -0
- package/dist/tags-75SSHS26.js +90 -0
- package/dist/tags-TBFPDHIQ.js +90 -0
- package/dist/tags-VH44BGQL.js +90 -0
- package/dist/upload-OS6Q6LW5.js +126 -0
- package/dist/whoami-TVRKBM74.js +28 -0
- package/package.json +1 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import {
|
|
2
|
+
adminRequest
|
|
3
|
+
} from "./chunk-QF7PVPWQ.js";
|
|
4
|
+
import {
|
|
5
|
+
isJsonOutput,
|
|
6
|
+
output
|
|
7
|
+
} from "./chunk-5BVMPHKH.js";
|
|
8
|
+
import {
|
|
9
|
+
formatTable
|
|
10
|
+
} from "./chunk-FZGOTXTE.js";
|
|
11
|
+
import "./chunk-TOADDO2F.js";
|
|
12
|
+
|
|
13
|
+
// src/commands/admin/jobs.ts
|
|
14
|
+
function formatTimestamp(ts) {
|
|
15
|
+
return new Date(ts).toISOString().replace("T", " ").slice(0, 19);
|
|
16
|
+
}
|
|
17
|
+
async function listAdminJobs(options) {
|
|
18
|
+
const params = new URLSearchParams();
|
|
19
|
+
if (options.org) {
|
|
20
|
+
params.set("orgId", options.org);
|
|
21
|
+
}
|
|
22
|
+
if (options.bucket) {
|
|
23
|
+
params.set("bucketId", options.bucket);
|
|
24
|
+
}
|
|
25
|
+
if (options.status) {
|
|
26
|
+
params.set("status", options.status);
|
|
27
|
+
}
|
|
28
|
+
if (options.queue) {
|
|
29
|
+
params.set("queue", options.queue);
|
|
30
|
+
}
|
|
31
|
+
if (options.limit) {
|
|
32
|
+
params.set("limit", options.limit);
|
|
33
|
+
}
|
|
34
|
+
const qs = params.toString();
|
|
35
|
+
const result = await adminRequest({
|
|
36
|
+
method: "GET",
|
|
37
|
+
path: `/admin/jobs${qs ? `?${qs}` : ""}`
|
|
38
|
+
});
|
|
39
|
+
if (result.jobs.length === 0) {
|
|
40
|
+
if (isJsonOutput() || options.json) {
|
|
41
|
+
output(result.jobs, void 0, { json: options.json });
|
|
42
|
+
} else {
|
|
43
|
+
console.log("No jobs found.");
|
|
44
|
+
}
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
output(
|
|
48
|
+
result.jobs,
|
|
49
|
+
() => {
|
|
50
|
+
const rows = result.jobs.map((job) => [
|
|
51
|
+
job.jobId,
|
|
52
|
+
job.queueName,
|
|
53
|
+
job.status,
|
|
54
|
+
`${job.data.fileId.slice(0, 8)}...`,
|
|
55
|
+
`${job.data.orgId.slice(0, 8)}...`,
|
|
56
|
+
formatTimestamp(job.timestamp),
|
|
57
|
+
job.failedReason ? job.failedReason.slice(0, 40) : ""
|
|
58
|
+
]);
|
|
59
|
+
return formatTable(
|
|
60
|
+
["ID", "Queue", "Status", "File", "Org", "Created", "Error"],
|
|
61
|
+
rows
|
|
62
|
+
);
|
|
63
|
+
},
|
|
64
|
+
{ json: options.json }
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
async function retryAdminJob(jobId, options) {
|
|
68
|
+
const result = await adminRequest({
|
|
69
|
+
method: "POST",
|
|
70
|
+
path: `/admin/jobs/${jobId}/retry`,
|
|
71
|
+
body: { queue: options.queue }
|
|
72
|
+
});
|
|
73
|
+
if (result.retried) {
|
|
74
|
+
console.log(`Job ${jobId} retried.`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async function deleteAdminJob(jobId, options) {
|
|
78
|
+
const result = await adminRequest({
|
|
79
|
+
method: "DELETE",
|
|
80
|
+
path: `/admin/jobs/${jobId}?queue=${encodeURIComponent(options.queue)}`
|
|
81
|
+
});
|
|
82
|
+
if (result.deleted) {
|
|
83
|
+
console.log(`Job ${jobId} removed.`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
deleteAdminJob,
|
|
88
|
+
listAdminJobs,
|
|
89
|
+
retryAdminJob
|
|
90
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import {
|
|
2
|
+
adminRequest
|
|
3
|
+
} from "./chunk-QF7PVPWQ.js";
|
|
4
|
+
import {
|
|
5
|
+
isJsonOutput,
|
|
6
|
+
output
|
|
7
|
+
} from "./chunk-5IX3ASXH.js";
|
|
8
|
+
import {
|
|
9
|
+
formatTable
|
|
10
|
+
} from "./chunk-FZGOTXTE.js";
|
|
11
|
+
import "./chunk-TOADDO2F.js";
|
|
12
|
+
|
|
13
|
+
// src/commands/admin/jobs.ts
|
|
14
|
+
function formatTimestamp(ts) {
|
|
15
|
+
return new Date(ts).toISOString().replace("T", " ").slice(0, 19);
|
|
16
|
+
}
|
|
17
|
+
async function listAdminJobs(options) {
|
|
18
|
+
const params = new URLSearchParams();
|
|
19
|
+
if (options.org) {
|
|
20
|
+
params.set("orgId", options.org);
|
|
21
|
+
}
|
|
22
|
+
if (options.bucket) {
|
|
23
|
+
params.set("bucketId", options.bucket);
|
|
24
|
+
}
|
|
25
|
+
if (options.status) {
|
|
26
|
+
params.set("status", options.status);
|
|
27
|
+
}
|
|
28
|
+
if (options.queue) {
|
|
29
|
+
params.set("queue", options.queue);
|
|
30
|
+
}
|
|
31
|
+
if (options.limit) {
|
|
32
|
+
params.set("limit", options.limit);
|
|
33
|
+
}
|
|
34
|
+
const qs = params.toString();
|
|
35
|
+
const result = await adminRequest({
|
|
36
|
+
method: "GET",
|
|
37
|
+
path: `/admin/jobs${qs ? `?${qs}` : ""}`
|
|
38
|
+
});
|
|
39
|
+
if (result.jobs.length === 0) {
|
|
40
|
+
if (isJsonOutput() || options.json) {
|
|
41
|
+
output(result.jobs, void 0, { json: options.json });
|
|
42
|
+
} else {
|
|
43
|
+
console.log("No jobs found.");
|
|
44
|
+
}
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
output(
|
|
48
|
+
result.jobs,
|
|
49
|
+
() => {
|
|
50
|
+
const rows = result.jobs.map((job) => [
|
|
51
|
+
job.jobId,
|
|
52
|
+
job.queueName,
|
|
53
|
+
job.status,
|
|
54
|
+
`${job.data.fileId.slice(0, 8)}...`,
|
|
55
|
+
`${job.data.orgId.slice(0, 8)}...`,
|
|
56
|
+
formatTimestamp(job.timestamp),
|
|
57
|
+
job.failedReason ? job.failedReason.slice(0, 40) : ""
|
|
58
|
+
]);
|
|
59
|
+
return formatTable(
|
|
60
|
+
["ID", "Queue", "Status", "File", "Org", "Created", "Error"],
|
|
61
|
+
rows
|
|
62
|
+
);
|
|
63
|
+
},
|
|
64
|
+
{ json: options.json }
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
async function retryAdminJob(jobId, options) {
|
|
68
|
+
const result = await adminRequest({
|
|
69
|
+
method: "POST",
|
|
70
|
+
path: `/admin/jobs/${jobId}/retry`,
|
|
71
|
+
body: { queue: options.queue }
|
|
72
|
+
});
|
|
73
|
+
if (result.retried) {
|
|
74
|
+
console.log(`Job ${jobId} retried.`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async function deleteAdminJob(jobId, options) {
|
|
78
|
+
const result = await adminRequest({
|
|
79
|
+
method: "DELETE",
|
|
80
|
+
path: `/admin/jobs/${jobId}?queue=${encodeURIComponent(options.queue)}`
|
|
81
|
+
});
|
|
82
|
+
if (result.deleted) {
|
|
83
|
+
console.log(`Job ${jobId} removed.`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
deleteAdminJob,
|
|
88
|
+
listAdminJobs,
|
|
89
|
+
retryAdminJob
|
|
90
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isJsonOutput,
|
|
3
|
+
output
|
|
4
|
+
} from "./chunk-5IX3ASXH.js";
|
|
5
|
+
import {
|
|
6
|
+
formatTable
|
|
7
|
+
} from "./chunk-FZGOTXTE.js";
|
|
8
|
+
import {
|
|
9
|
+
getApiKey,
|
|
10
|
+
getBaseUrl
|
|
11
|
+
} from "./chunk-TOADDO2F.js";
|
|
12
|
+
|
|
13
|
+
// src/commands/jobs.ts
|
|
14
|
+
async function bucketRequest(opts) {
|
|
15
|
+
const baseUrl = getBaseUrl();
|
|
16
|
+
const apiKey = getApiKey();
|
|
17
|
+
const res = await fetch(`${baseUrl}${opts.path}`, {
|
|
18
|
+
method: opts.method,
|
|
19
|
+
headers: {
|
|
20
|
+
"x-api-key": apiKey,
|
|
21
|
+
...opts.body ? { "Content-Type": "application/json" } : {}
|
|
22
|
+
},
|
|
23
|
+
...opts.body ? { body: JSON.stringify(opts.body) } : {}
|
|
24
|
+
});
|
|
25
|
+
if (!res.ok) {
|
|
26
|
+
const body = await res.json().catch(() => ({ error: res.statusText }));
|
|
27
|
+
const message = body.error ?? `HTTP ${res.status}`;
|
|
28
|
+
throw new Error(message);
|
|
29
|
+
}
|
|
30
|
+
return await res.json();
|
|
31
|
+
}
|
|
32
|
+
function formatTimestamp(ts) {
|
|
33
|
+
return new Date(ts).toISOString().replace("T", " ").slice(0, 19);
|
|
34
|
+
}
|
|
35
|
+
async function listJobs(bucketId, options) {
|
|
36
|
+
const params = new URLSearchParams();
|
|
37
|
+
if (options.status) {
|
|
38
|
+
params.set("status", options.status);
|
|
39
|
+
}
|
|
40
|
+
if (options.queue) {
|
|
41
|
+
params.set("queue", options.queue);
|
|
42
|
+
}
|
|
43
|
+
if (options.limit) {
|
|
44
|
+
params.set("limit", options.limit);
|
|
45
|
+
}
|
|
46
|
+
const qs = params.toString();
|
|
47
|
+
const path = `/buckets/${bucketId}/jobs${qs ? `?${qs}` : ""}`;
|
|
48
|
+
const result = await bucketRequest({
|
|
49
|
+
method: "GET",
|
|
50
|
+
path
|
|
51
|
+
});
|
|
52
|
+
if (result.jobs.length === 0) {
|
|
53
|
+
if (isJsonOutput() || options.json) {
|
|
54
|
+
output(result.jobs);
|
|
55
|
+
} else {
|
|
56
|
+
console.log("No jobs found.");
|
|
57
|
+
}
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
output(
|
|
61
|
+
result.jobs,
|
|
62
|
+
() => {
|
|
63
|
+
const rows = result.jobs.map((job) => [
|
|
64
|
+
job.jobId,
|
|
65
|
+
job.queueName,
|
|
66
|
+
job.status,
|
|
67
|
+
`${job.data.fileId.slice(0, 8)}...`,
|
|
68
|
+
formatTimestamp(job.timestamp),
|
|
69
|
+
job.failedReason ? job.failedReason.slice(0, 40) : ""
|
|
70
|
+
]);
|
|
71
|
+
return formatTable(
|
|
72
|
+
["ID", "Queue", "Status", "File", "Created", "Error"],
|
|
73
|
+
rows
|
|
74
|
+
);
|
|
75
|
+
},
|
|
76
|
+
{ json: options.json }
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
async function retryJob(jobId, options) {
|
|
80
|
+
const result = await bucketRequest({
|
|
81
|
+
method: "POST",
|
|
82
|
+
path: `/buckets/${options.bucket}/jobs/${jobId}/retry`,
|
|
83
|
+
body: { queue: options.queue }
|
|
84
|
+
});
|
|
85
|
+
if (result.retried) {
|
|
86
|
+
console.log(`Job ${jobId} retried.`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async function deleteJob(jobId, options) {
|
|
90
|
+
const result = await bucketRequest({
|
|
91
|
+
method: "DELETE",
|
|
92
|
+
path: `/buckets/${options.bucket}/jobs/${jobId}?queue=${encodeURIComponent(options.queue)}`
|
|
93
|
+
});
|
|
94
|
+
if (result.deleted) {
|
|
95
|
+
console.log(`Job ${jobId} removed.`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export {
|
|
99
|
+
deleteJob,
|
|
100
|
+
listJobs,
|
|
101
|
+
retryJob
|
|
102
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isJsonOutput,
|
|
3
|
+
output
|
|
4
|
+
} from "./chunk-5BVMPHKH.js";
|
|
5
|
+
import {
|
|
6
|
+
formatTable
|
|
7
|
+
} from "./chunk-FZGOTXTE.js";
|
|
8
|
+
import {
|
|
9
|
+
getApiKey,
|
|
10
|
+
getBaseUrl
|
|
11
|
+
} from "./chunk-TOADDO2F.js";
|
|
12
|
+
|
|
13
|
+
// src/commands/jobs.ts
|
|
14
|
+
async function bucketRequest(opts) {
|
|
15
|
+
const baseUrl = getBaseUrl();
|
|
16
|
+
const apiKey = getApiKey();
|
|
17
|
+
const res = await fetch(`${baseUrl}${opts.path}`, {
|
|
18
|
+
method: opts.method,
|
|
19
|
+
headers: {
|
|
20
|
+
"x-api-key": apiKey,
|
|
21
|
+
...opts.body ? { "Content-Type": "application/json" } : {}
|
|
22
|
+
},
|
|
23
|
+
...opts.body ? { body: JSON.stringify(opts.body) } : {}
|
|
24
|
+
});
|
|
25
|
+
if (!res.ok) {
|
|
26
|
+
const body = await res.json().catch(() => ({ error: res.statusText }));
|
|
27
|
+
const message = body.error ?? `HTTP ${res.status}`;
|
|
28
|
+
throw new Error(message);
|
|
29
|
+
}
|
|
30
|
+
return await res.json();
|
|
31
|
+
}
|
|
32
|
+
function formatTimestamp(ts) {
|
|
33
|
+
return new Date(ts).toISOString().replace("T", " ").slice(0, 19);
|
|
34
|
+
}
|
|
35
|
+
async function listJobs(bucketId, options) {
|
|
36
|
+
const params = new URLSearchParams();
|
|
37
|
+
if (options.status) {
|
|
38
|
+
params.set("status", options.status);
|
|
39
|
+
}
|
|
40
|
+
if (options.queue) {
|
|
41
|
+
params.set("queue", options.queue);
|
|
42
|
+
}
|
|
43
|
+
if (options.limit) {
|
|
44
|
+
params.set("limit", options.limit);
|
|
45
|
+
}
|
|
46
|
+
const qs = params.toString();
|
|
47
|
+
const path = `/buckets/${bucketId}/jobs${qs ? `?${qs}` : ""}`;
|
|
48
|
+
const result = await bucketRequest({
|
|
49
|
+
method: "GET",
|
|
50
|
+
path
|
|
51
|
+
});
|
|
52
|
+
if (result.jobs.length === 0) {
|
|
53
|
+
if (isJsonOutput() || options.json) {
|
|
54
|
+
output(result.jobs);
|
|
55
|
+
} else {
|
|
56
|
+
console.log("No jobs found.");
|
|
57
|
+
}
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
output(
|
|
61
|
+
result.jobs,
|
|
62
|
+
() => {
|
|
63
|
+
const rows = result.jobs.map((job) => [
|
|
64
|
+
job.jobId,
|
|
65
|
+
job.queueName,
|
|
66
|
+
job.status,
|
|
67
|
+
`${job.data.fileId.slice(0, 8)}...`,
|
|
68
|
+
formatTimestamp(job.timestamp),
|
|
69
|
+
job.failedReason ? job.failedReason.slice(0, 40) : ""
|
|
70
|
+
]);
|
|
71
|
+
return formatTable(
|
|
72
|
+
["ID", "Queue", "Status", "File", "Created", "Error"],
|
|
73
|
+
rows
|
|
74
|
+
);
|
|
75
|
+
},
|
|
76
|
+
{ json: options.json }
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
async function retryJob(jobId, options) {
|
|
80
|
+
const result = await bucketRequest({
|
|
81
|
+
method: "POST",
|
|
82
|
+
path: `/buckets/${options.bucket}/jobs/${jobId}/retry`,
|
|
83
|
+
body: { queue: options.queue }
|
|
84
|
+
});
|
|
85
|
+
if (result.retried) {
|
|
86
|
+
console.log(`Job ${jobId} retried.`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async function deleteJob(jobId, options) {
|
|
90
|
+
const result = await bucketRequest({
|
|
91
|
+
method: "DELETE",
|
|
92
|
+
path: `/buckets/${options.bucket}/jobs/${jobId}?queue=${encodeURIComponent(options.queue)}`
|
|
93
|
+
});
|
|
94
|
+
if (result.deleted) {
|
|
95
|
+
console.log(`Job ${jobId} removed.`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export {
|
|
99
|
+
deleteJob,
|
|
100
|
+
listJobs,
|
|
101
|
+
retryJob
|
|
102
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import {
|
|
2
|
+
adminRequest
|
|
3
|
+
} from "./chunk-QF7PVPWQ.js";
|
|
4
|
+
import {
|
|
5
|
+
isJsonOutput,
|
|
6
|
+
output
|
|
7
|
+
} from "./chunk-P2BKGBQE.js";
|
|
8
|
+
import {
|
|
9
|
+
formatTable
|
|
10
|
+
} from "./chunk-FZGOTXTE.js";
|
|
11
|
+
import "./chunk-TOADDO2F.js";
|
|
12
|
+
|
|
13
|
+
// src/commands/admin/jobs.ts
|
|
14
|
+
function formatTimestamp(ts) {
|
|
15
|
+
return new Date(ts).toISOString().replace("T", " ").slice(0, 19);
|
|
16
|
+
}
|
|
17
|
+
async function listAdminJobs(options) {
|
|
18
|
+
const params = new URLSearchParams();
|
|
19
|
+
if (options.org) {
|
|
20
|
+
params.set("orgId", options.org);
|
|
21
|
+
}
|
|
22
|
+
if (options.bucket) {
|
|
23
|
+
params.set("bucketId", options.bucket);
|
|
24
|
+
}
|
|
25
|
+
if (options.status) {
|
|
26
|
+
params.set("status", options.status);
|
|
27
|
+
}
|
|
28
|
+
if (options.queue) {
|
|
29
|
+
params.set("queue", options.queue);
|
|
30
|
+
}
|
|
31
|
+
if (options.limit) {
|
|
32
|
+
params.set("limit", options.limit);
|
|
33
|
+
}
|
|
34
|
+
const qs = params.toString();
|
|
35
|
+
const result = await adminRequest({
|
|
36
|
+
method: "GET",
|
|
37
|
+
path: `/admin/jobs${qs ? `?${qs}` : ""}`
|
|
38
|
+
});
|
|
39
|
+
if (result.jobs.length === 0) {
|
|
40
|
+
if (isJsonOutput() || options.json) {
|
|
41
|
+
output(result.jobs, void 0, { json: options.json });
|
|
42
|
+
} else {
|
|
43
|
+
console.log("No jobs found.");
|
|
44
|
+
}
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
output(
|
|
48
|
+
result.jobs,
|
|
49
|
+
() => {
|
|
50
|
+
const rows = result.jobs.map((job) => [
|
|
51
|
+
job.jobId,
|
|
52
|
+
job.queueName,
|
|
53
|
+
job.status,
|
|
54
|
+
`${job.data.fileId.slice(0, 8)}...`,
|
|
55
|
+
`${job.data.orgId.slice(0, 8)}...`,
|
|
56
|
+
formatTimestamp(job.timestamp),
|
|
57
|
+
job.failedReason ? job.failedReason.slice(0, 40) : ""
|
|
58
|
+
]);
|
|
59
|
+
return formatTable(
|
|
60
|
+
["ID", "Queue", "Status", "File", "Org", "Created", "Error"],
|
|
61
|
+
rows
|
|
62
|
+
);
|
|
63
|
+
},
|
|
64
|
+
{ json: options.json }
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
async function retryAdminJob(jobId, options) {
|
|
68
|
+
const result = await adminRequest({
|
|
69
|
+
method: "POST",
|
|
70
|
+
path: `/admin/jobs/${jobId}/retry`,
|
|
71
|
+
body: { queue: options.queue }
|
|
72
|
+
});
|
|
73
|
+
if (result.retried) {
|
|
74
|
+
console.log(`Job ${jobId} retried.`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async function deleteAdminJob(jobId, options) {
|
|
78
|
+
const result = await adminRequest({
|
|
79
|
+
method: "DELETE",
|
|
80
|
+
path: `/admin/jobs/${jobId}?queue=${encodeURIComponent(options.queue)}`
|
|
81
|
+
});
|
|
82
|
+
if (result.deleted) {
|
|
83
|
+
console.log(`Job ${jobId} removed.`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
export {
|
|
87
|
+
deleteAdminJob,
|
|
88
|
+
listAdminJobs,
|
|
89
|
+
retryAdminJob
|
|
90
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
adminRequest
|
|
3
|
+
} from "./chunk-QF7PVPWQ.js";
|
|
4
|
+
import {
|
|
5
|
+
output
|
|
6
|
+
} from "./chunk-5BVMPHKH.js";
|
|
7
|
+
import "./chunk-TOADDO2F.js";
|
|
8
|
+
|
|
9
|
+
// src/commands/admin/maintenance.ts
|
|
10
|
+
async function cleanupDrops(options) {
|
|
11
|
+
const params = new URLSearchParams();
|
|
12
|
+
if (options.maxAgeHours) {
|
|
13
|
+
params.set("maxAgeHours", options.maxAgeHours);
|
|
14
|
+
}
|
|
15
|
+
if (options.dryRun) {
|
|
16
|
+
params.set("dryRun", "true");
|
|
17
|
+
}
|
|
18
|
+
const qs = params.toString();
|
|
19
|
+
const result = await adminRequest({
|
|
20
|
+
method: "POST",
|
|
21
|
+
path: `/admin/cleanup-drops${qs ? `?${qs}` : ""}`
|
|
22
|
+
});
|
|
23
|
+
output(
|
|
24
|
+
result,
|
|
25
|
+
() => options.dryRun ? `[dry run] Would clean up ${result.count ?? 0} drops` : `Cleaned up ${result.deleted ?? 0} drops`,
|
|
26
|
+
{ json: options.json }
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
async function purgeEvents(options) {
|
|
30
|
+
const params = new URLSearchParams();
|
|
31
|
+
if (options.dryRun) {
|
|
32
|
+
params.set("dryRun", "true");
|
|
33
|
+
}
|
|
34
|
+
const qs = params.toString();
|
|
35
|
+
const result = await adminRequest({
|
|
36
|
+
method: "POST",
|
|
37
|
+
path: `/admin/purge-events${qs ? `?${qs}` : ""}`
|
|
38
|
+
});
|
|
39
|
+
output(
|
|
40
|
+
result,
|
|
41
|
+
() => options.dryRun ? `[dry run] Would purge ${result.count ?? 0} events` : `Purged ${result.deleted ?? 0} events`,
|
|
42
|
+
{ json: options.json }
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
async function reconcileFiles(options) {
|
|
46
|
+
const params = new URLSearchParams({ bucketId: options.bucket });
|
|
47
|
+
if (options.dryRun) {
|
|
48
|
+
params.set("dryRun", "true");
|
|
49
|
+
}
|
|
50
|
+
const result = await adminRequest({
|
|
51
|
+
method: "POST",
|
|
52
|
+
path: `/admin/reconcile-files?${params}`
|
|
53
|
+
});
|
|
54
|
+
output(
|
|
55
|
+
result,
|
|
56
|
+
() => {
|
|
57
|
+
if (options.dryRun) {
|
|
58
|
+
return `[dry run] ${result.mismatched ?? 0} files need reconciliation`;
|
|
59
|
+
}
|
|
60
|
+
return `Reconciled ${result.reconciled ?? 0} files`;
|
|
61
|
+
},
|
|
62
|
+
{ json: options.json }
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
async function retrySyncFailures(options) {
|
|
66
|
+
const result = await adminRequest({
|
|
67
|
+
method: "POST",
|
|
68
|
+
path: "/admin/retry-sync-failures"
|
|
69
|
+
});
|
|
70
|
+
output(result, () => `Retried ${result.retried ?? 0} sync failures`, {
|
|
71
|
+
json: options.json
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
cleanupDrops,
|
|
76
|
+
purgeEvents,
|
|
77
|
+
reconcileFiles,
|
|
78
|
+
retrySyncFailures
|
|
79
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
adminRequest
|
|
3
|
+
} from "./chunk-QF7PVPWQ.js";
|
|
4
|
+
import {
|
|
5
|
+
output
|
|
6
|
+
} from "./chunk-5IX3ASXH.js";
|
|
7
|
+
import "./chunk-TOADDO2F.js";
|
|
8
|
+
|
|
9
|
+
// src/commands/admin/maintenance.ts
|
|
10
|
+
async function cleanupDrops(options) {
|
|
11
|
+
const params = new URLSearchParams();
|
|
12
|
+
if (options.maxAgeHours) {
|
|
13
|
+
params.set("maxAgeHours", options.maxAgeHours);
|
|
14
|
+
}
|
|
15
|
+
if (options.dryRun) {
|
|
16
|
+
params.set("dryRun", "true");
|
|
17
|
+
}
|
|
18
|
+
const qs = params.toString();
|
|
19
|
+
const result = await adminRequest({
|
|
20
|
+
method: "POST",
|
|
21
|
+
path: `/admin/cleanup-drops${qs ? `?${qs}` : ""}`
|
|
22
|
+
});
|
|
23
|
+
output(
|
|
24
|
+
result,
|
|
25
|
+
() => options.dryRun ? `[dry run] Would clean up ${result.count ?? 0} drops` : `Cleaned up ${result.deleted ?? 0} drops`,
|
|
26
|
+
{ json: options.json }
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
async function purgeEvents(options) {
|
|
30
|
+
const params = new URLSearchParams();
|
|
31
|
+
if (options.dryRun) {
|
|
32
|
+
params.set("dryRun", "true");
|
|
33
|
+
}
|
|
34
|
+
const qs = params.toString();
|
|
35
|
+
const result = await adminRequest({
|
|
36
|
+
method: "POST",
|
|
37
|
+
path: `/admin/purge-events${qs ? `?${qs}` : ""}`
|
|
38
|
+
});
|
|
39
|
+
output(
|
|
40
|
+
result,
|
|
41
|
+
() => options.dryRun ? `[dry run] Would purge ${result.count ?? 0} events` : `Purged ${result.deleted ?? 0} events`,
|
|
42
|
+
{ json: options.json }
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
async function reconcileFiles(options) {
|
|
46
|
+
const params = new URLSearchParams({ bucketId: options.bucket });
|
|
47
|
+
if (options.dryRun) {
|
|
48
|
+
params.set("dryRun", "true");
|
|
49
|
+
}
|
|
50
|
+
const result = await adminRequest({
|
|
51
|
+
method: "POST",
|
|
52
|
+
path: `/admin/reconcile-files?${params}`
|
|
53
|
+
});
|
|
54
|
+
output(
|
|
55
|
+
result,
|
|
56
|
+
() => {
|
|
57
|
+
if (options.dryRun) {
|
|
58
|
+
return `[dry run] ${result.mismatched ?? 0} files need reconciliation`;
|
|
59
|
+
}
|
|
60
|
+
return `Reconciled ${result.reconciled ?? 0} files`;
|
|
61
|
+
},
|
|
62
|
+
{ json: options.json }
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
async function retrySyncFailures(options) {
|
|
66
|
+
const result = await adminRequest({
|
|
67
|
+
method: "POST",
|
|
68
|
+
path: "/admin/retry-sync-failures"
|
|
69
|
+
});
|
|
70
|
+
output(result, () => `Retried ${result.retried ?? 0} sync failures`, {
|
|
71
|
+
json: options.json
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
cleanupDrops,
|
|
76
|
+
purgeEvents,
|
|
77
|
+
reconcileFiles,
|
|
78
|
+
retrySyncFailures
|
|
79
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
adminRequest
|
|
3
|
+
} from "./chunk-QF7PVPWQ.js";
|
|
4
|
+
import {
|
|
5
|
+
output
|
|
6
|
+
} from "./chunk-P2BKGBQE.js";
|
|
7
|
+
import "./chunk-TOADDO2F.js";
|
|
8
|
+
|
|
9
|
+
// src/commands/admin/maintenance.ts
|
|
10
|
+
async function cleanupDrops(options) {
|
|
11
|
+
const params = new URLSearchParams();
|
|
12
|
+
if (options.maxAgeHours) {
|
|
13
|
+
params.set("maxAgeHours", options.maxAgeHours);
|
|
14
|
+
}
|
|
15
|
+
if (options.dryRun) {
|
|
16
|
+
params.set("dryRun", "true");
|
|
17
|
+
}
|
|
18
|
+
const qs = params.toString();
|
|
19
|
+
const result = await adminRequest({
|
|
20
|
+
method: "POST",
|
|
21
|
+
path: `/admin/cleanup-drops${qs ? `?${qs}` : ""}`
|
|
22
|
+
});
|
|
23
|
+
output(
|
|
24
|
+
result,
|
|
25
|
+
() => options.dryRun ? `[dry run] Would clean up ${result.count ?? 0} drops` : `Cleaned up ${result.deleted ?? 0} drops`,
|
|
26
|
+
{ json: options.json }
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
async function purgeEvents(options) {
|
|
30
|
+
const params = new URLSearchParams();
|
|
31
|
+
if (options.dryRun) {
|
|
32
|
+
params.set("dryRun", "true");
|
|
33
|
+
}
|
|
34
|
+
const qs = params.toString();
|
|
35
|
+
const result = await adminRequest({
|
|
36
|
+
method: "POST",
|
|
37
|
+
path: `/admin/purge-events${qs ? `?${qs}` : ""}`
|
|
38
|
+
});
|
|
39
|
+
output(
|
|
40
|
+
result,
|
|
41
|
+
() => options.dryRun ? `[dry run] Would purge ${result.count ?? 0} events` : `Purged ${result.deleted ?? 0} events`,
|
|
42
|
+
{ json: options.json }
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
async function reconcileFiles(options) {
|
|
46
|
+
const params = new URLSearchParams({ bucketId: options.bucket });
|
|
47
|
+
if (options.dryRun) {
|
|
48
|
+
params.set("dryRun", "true");
|
|
49
|
+
}
|
|
50
|
+
const result = await adminRequest({
|
|
51
|
+
method: "POST",
|
|
52
|
+
path: `/admin/reconcile-files?${params}`
|
|
53
|
+
});
|
|
54
|
+
output(
|
|
55
|
+
result,
|
|
56
|
+
() => {
|
|
57
|
+
if (options.dryRun) {
|
|
58
|
+
return `[dry run] ${result.mismatched ?? 0} files need reconciliation`;
|
|
59
|
+
}
|
|
60
|
+
return `Reconciled ${result.reconciled ?? 0} files`;
|
|
61
|
+
},
|
|
62
|
+
{ json: options.json }
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
async function retrySyncFailures(options) {
|
|
66
|
+
const result = await adminRequest({
|
|
67
|
+
method: "POST",
|
|
68
|
+
path: "/admin/retry-sync-failures"
|
|
69
|
+
});
|
|
70
|
+
output(result, () => `Retried ${result.retried ?? 0} sync failures`, {
|
|
71
|
+
json: options.json
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
cleanupDrops,
|
|
76
|
+
purgeEvents,
|
|
77
|
+
reconcileFiles,
|
|
78
|
+
retrySyncFailures
|
|
79
|
+
};
|