deepline 0.1.271 → 0.1.273
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/README.md +4 -2
- package/dist/bundling-sources/sdk/src/client.ts +347 -0
- package/dist/bundling-sources/sdk/src/index.ts +22 -0
- package/dist/bundling-sources/sdk/src/monitors.ts +134 -0
- package/dist/bundling-sources/sdk/src/play.ts +2 -2
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/child-execution-strategy.ts +16 -2
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +9 -0
- package/dist/cli/index.js +208 -91
- package/dist/cli/index.mjs +208 -91
- package/dist/index.d.mts +270 -3
- package/dist/index.d.ts +270 -3
- package/dist/index.js +178 -1
- package/dist/index.mjs +177 -1
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -703,7 +703,7 @@ var SDK_RELEASE = {
|
|
|
703
703
|
// 0.1.253 makes play-page browser opening opt-in and retires --no-open.
|
|
704
704
|
// 0.1.254 removes the internal operations tree from the published SDK CLI.
|
|
705
705
|
// Operators use the checkout-local deepline-admin binary instead.
|
|
706
|
-
version: "0.1.
|
|
706
|
+
version: "0.1.273",
|
|
707
707
|
contracts: {
|
|
708
708
|
api: {
|
|
709
709
|
name: "sdk-http-api",
|
|
@@ -2910,6 +2910,8 @@ var DeeplineClient = class {
|
|
|
2910
2910
|
db;
|
|
2911
2911
|
/** Billing namespace: subscription status/cancel and invoice history. */
|
|
2912
2912
|
billing;
|
|
2913
|
+
/** Monitors namespace: access, catalog, deploy/check, and lifecycle. */
|
|
2914
|
+
monitors;
|
|
2913
2915
|
/**
|
|
2914
2916
|
* Create a low-level SDK client.
|
|
2915
2917
|
*
|
|
@@ -2945,6 +2947,18 @@ var DeeplineClient = class {
|
|
|
2945
2947
|
list: (options2) => this.listBillingInvoices(options2)
|
|
2946
2948
|
}
|
|
2947
2949
|
};
|
|
2950
|
+
this.monitors = {
|
|
2951
|
+
status: () => this.getMonitorsAccess(),
|
|
2952
|
+
available: (toolIdOrOptions, options2) => this.getMonitorsAvailable(toolIdOrOptions, options2),
|
|
2953
|
+
check: (definition) => this.checkMonitor(definition),
|
|
2954
|
+
deploy: (definition, options2) => this.deployMonitor(definition, options2),
|
|
2955
|
+
list: (options2) => this.listMonitors(options2),
|
|
2956
|
+
get: (key) => this.getMonitor(key),
|
|
2957
|
+
dependents: (key) => this.getMonitorDependents(key),
|
|
2958
|
+
update: (key, patch) => this.updateMonitor(key, patch),
|
|
2959
|
+
delete: (key, options2) => this.deleteMonitor(key, options2),
|
|
2960
|
+
reactivate: (key, options2) => this.reactivateMonitor(key, options2)
|
|
2961
|
+
};
|
|
2948
2962
|
}
|
|
2949
2963
|
/** The resolved base URL this client is targeting (e.g. `"http://localhost:3000"`). */
|
|
2950
2964
|
get baseUrl() {
|
|
@@ -4807,6 +4821,136 @@ var DeeplineClient = class {
|
|
|
4807
4821
|
`/api/v2/billing/invoices${suffix}`
|
|
4808
4822
|
);
|
|
4809
4823
|
}
|
|
4824
|
+
// ——————————————————————————————————————————————————————————
|
|
4825
|
+
// Monitors
|
|
4826
|
+
// ——————————————————————————————————————————————————————————
|
|
4827
|
+
/**
|
|
4828
|
+
* Whether the current workspace can use Deepline Monitors. Reachable without
|
|
4829
|
+
* monitor access; a denial is a normal 200 body, not a 403. Prefer
|
|
4830
|
+
* `client.monitors.status()`.
|
|
4831
|
+
*/
|
|
4832
|
+
async getMonitorsAccess() {
|
|
4833
|
+
const payload = await this.http.request(
|
|
4834
|
+
"/api/v2/monitors/access",
|
|
4835
|
+
{ method: "GET" }
|
|
4836
|
+
);
|
|
4837
|
+
return {
|
|
4838
|
+
has_access: payload.has_access === true,
|
|
4839
|
+
...typeof payload.reason === "string" && payload.reason.trim() ? { reason: payload.reason.trim() } : {}
|
|
4840
|
+
};
|
|
4841
|
+
}
|
|
4842
|
+
/**
|
|
4843
|
+
* The deployable monitor tools catalog. Pass a tool id (positional or
|
|
4844
|
+
* `{ tool }`) to describe one tool's full payload/stream contract, or no tool
|
|
4845
|
+
* id for the compact inventory. Prefer `client.monitors.available(...)`.
|
|
4846
|
+
*/
|
|
4847
|
+
async getMonitorsAvailable(toolIdOrOptions, maybeOptions) {
|
|
4848
|
+
const positionalTool = typeof toolIdOrOptions === "string" ? toolIdOrOptions : void 0;
|
|
4849
|
+
const options = toolIdOrOptions && typeof toolIdOrOptions === "object" ? toolIdOrOptions : maybeOptions ?? {};
|
|
4850
|
+
const optionTool = toolIdOrOptions && typeof toolIdOrOptions === "object" ? toolIdOrOptions.tool : void 0;
|
|
4851
|
+
const tool = positionalTool ?? optionTool;
|
|
4852
|
+
const params = new URLSearchParams();
|
|
4853
|
+
if (options.provider) params.set("provider", options.provider);
|
|
4854
|
+
if (tool) params.set("tool", tool);
|
|
4855
|
+
if (options.search) params.set("search", options.search);
|
|
4856
|
+
if (options.limit !== void 0) params.set("limit", String(options.limit));
|
|
4857
|
+
const compactList = !tool && options.full !== true;
|
|
4858
|
+
if (compactList || options.compact) params.set("compact", "true");
|
|
4859
|
+
const query = params.toString();
|
|
4860
|
+
const suffix = query ? `?${query}` : "";
|
|
4861
|
+
return this.http.request(
|
|
4862
|
+
`/api/v2/monitors/tools${suffix}`,
|
|
4863
|
+
{ method: "GET", forbiddenAsApiError: true }
|
|
4864
|
+
);
|
|
4865
|
+
}
|
|
4866
|
+
/** Validate a monitor definition without deploying it. Prefer `client.monitors.check(...)`. */
|
|
4867
|
+
async checkMonitor(definition) {
|
|
4868
|
+
return this.http.request("/api/v2/monitors/check", {
|
|
4869
|
+
method: "POST",
|
|
4870
|
+
body: definition,
|
|
4871
|
+
forbiddenAsApiError: true
|
|
4872
|
+
});
|
|
4873
|
+
}
|
|
4874
|
+
/**
|
|
4875
|
+
* Deploy a monitor from a definition. `dryRun` validates via the check
|
|
4876
|
+
* endpoint and returns the plan without deploying. Prefer
|
|
4877
|
+
* `client.monitors.deploy(...)`.
|
|
4878
|
+
*/
|
|
4879
|
+
async deployMonitor(definition, options) {
|
|
4880
|
+
if (options?.dryRun) {
|
|
4881
|
+
return this.http.request("/api/v2/monitors/check", {
|
|
4882
|
+
method: "POST",
|
|
4883
|
+
body: definition,
|
|
4884
|
+
forbiddenAsApiError: true
|
|
4885
|
+
});
|
|
4886
|
+
}
|
|
4887
|
+
return this.http.request("/api/v2/monitors/deploy", {
|
|
4888
|
+
method: "POST",
|
|
4889
|
+
body: definition,
|
|
4890
|
+
forbiddenAsApiError: true
|
|
4891
|
+
});
|
|
4892
|
+
}
|
|
4893
|
+
/** List deployed monitors. Prefer `client.monitors.list(...)`. */
|
|
4894
|
+
async listMonitors(options) {
|
|
4895
|
+
const params = new URLSearchParams();
|
|
4896
|
+
if (options?.status) params.set("status", options.status);
|
|
4897
|
+
if (options?.limit !== void 0) params.set("limit", String(options.limit));
|
|
4898
|
+
if (options?.cursor) params.set("cursor", options.cursor);
|
|
4899
|
+
if (options?.compact) params.set("compact", "true");
|
|
4900
|
+
const query = params.toString();
|
|
4901
|
+
const suffix = query ? `?${query}` : "";
|
|
4902
|
+
return this.http.request(
|
|
4903
|
+
`/api/v2/monitors/deployed${suffix}`,
|
|
4904
|
+
{ method: "GET", forbiddenAsApiError: true }
|
|
4905
|
+
);
|
|
4906
|
+
}
|
|
4907
|
+
/** Fetch one deployed monitor by public key. Prefer `client.monitors.get(...)`. */
|
|
4908
|
+
async getMonitor(key) {
|
|
4909
|
+
return this.http.request(
|
|
4910
|
+
`/api/v2/monitors/deployed/${encodeURIComponent(key)}`,
|
|
4911
|
+
{ method: "GET", forbiddenAsApiError: true }
|
|
4912
|
+
);
|
|
4913
|
+
}
|
|
4914
|
+
/** Published plays depending on one monitor. Prefer `client.monitors.dependents(...)`. */
|
|
4915
|
+
async getMonitorDependents(key) {
|
|
4916
|
+
return this.http.request(
|
|
4917
|
+
`/api/v2/monitors/deployed/${encodeURIComponent(key)}/dependents`,
|
|
4918
|
+
{ method: "GET", forbiddenAsApiError: true }
|
|
4919
|
+
);
|
|
4920
|
+
}
|
|
4921
|
+
/** Update a deployed monitor by public key. Prefer `client.monitors.update(...)`. */
|
|
4922
|
+
async updateMonitor(key, patch) {
|
|
4923
|
+
return this.http.request(
|
|
4924
|
+
`/api/v2/monitors/deployed/${encodeURIComponent(key)}`,
|
|
4925
|
+
{ method: "PATCH", body: patch, forbiddenAsApiError: true }
|
|
4926
|
+
);
|
|
4927
|
+
}
|
|
4928
|
+
/**
|
|
4929
|
+
* Delete a deployed monitor by public key. Deprovisions the upstream provider
|
|
4930
|
+
* resource unless `localOnly`; `dryRun` returns the delete plan. Prefer
|
|
4931
|
+
* `client.monitors.delete(...)`.
|
|
4932
|
+
*/
|
|
4933
|
+
async deleteMonitor(key, options) {
|
|
4934
|
+
const params = new URLSearchParams();
|
|
4935
|
+
if (options?.localOnly) params.set("local_only", "true");
|
|
4936
|
+
if (options?.dryRun) params.set("dry_run", "true");
|
|
4937
|
+
const query = params.toString();
|
|
4938
|
+
return this.http.request(
|
|
4939
|
+
`/api/v2/monitors/deployed/${encodeURIComponent(key)}${query ? `?${query}` : ""}`,
|
|
4940
|
+
{ method: "DELETE", forbiddenAsApiError: true }
|
|
4941
|
+
);
|
|
4942
|
+
}
|
|
4943
|
+
/**
|
|
4944
|
+
* Reactivate a disabled monitor. `dryRun` returns the reactivation cost.
|
|
4945
|
+
* Prefer `client.monitors.reactivate(...)`.
|
|
4946
|
+
*/
|
|
4947
|
+
async reactivateMonitor(key, options) {
|
|
4948
|
+
const query = options?.dryRun ? "?dry_run=true" : "";
|
|
4949
|
+
return this.http.request(
|
|
4950
|
+
`/api/v2/monitors/deployed/${encodeURIComponent(key)}/reactivate${query}`,
|
|
4951
|
+
{ method: "POST", body: {}, forbiddenAsApiError: true }
|
|
4952
|
+
);
|
|
4953
|
+
}
|
|
4810
4954
|
/**
|
|
4811
4955
|
* Check API connectivity and server health.
|
|
4812
4956
|
*
|
|
@@ -24309,15 +24453,11 @@ Examples:
|
|
|
24309
24453
|
// src/cli/commands/monitors.ts
|
|
24310
24454
|
import { readFileSync as readFileSync9 } from "fs";
|
|
24311
24455
|
import { createInterface } from "readline/promises";
|
|
24312
|
-
var FORBIDDEN_AS_API_ERROR = { forbiddenAsApiError: true };
|
|
24313
24456
|
var JSON_OPTION_DESCRIPTION = "Emit JSON output. Also automatic when stdout is piped";
|
|
24314
24457
|
function withJsonOption(command) {
|
|
24315
24458
|
return command.option("--json", JSON_OPTION_DESCRIPTION);
|
|
24316
24459
|
}
|
|
24317
24460
|
var COMPACT_OPTION_DESCRIPTION = "Ask the server for high-signal fields only (smaller output for agent loops)";
|
|
24318
|
-
function buildHttpClient() {
|
|
24319
|
-
return new HttpClient(resolveConfig());
|
|
24320
|
-
}
|
|
24321
24461
|
var MonitorsUsageError = class extends Error {
|
|
24322
24462
|
code = "MONITORS_USAGE_ERROR";
|
|
24323
24463
|
constructor(message) {
|
|
@@ -24458,9 +24598,6 @@ or from a file / stdin:
|
|
|
24458
24598
|
cat monitor.json | ${input2.command} --file -`
|
|
24459
24599
|
);
|
|
24460
24600
|
}
|
|
24461
|
-
function encodeKey(key) {
|
|
24462
|
-
return encodeURIComponent(key);
|
|
24463
|
-
}
|
|
24464
24601
|
function asRecord(value) {
|
|
24465
24602
|
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
24466
24603
|
}
|
|
@@ -24654,11 +24791,7 @@ Preview the plan first with:
|
|
|
24654
24791
|
);
|
|
24655
24792
|
}
|
|
24656
24793
|
async function handleMonitorsStatus(options) {
|
|
24657
|
-
const
|
|
24658
|
-
const payload = await http.request(
|
|
24659
|
-
"/api/v2/monitors/access",
|
|
24660
|
-
{ method: "GET" }
|
|
24661
|
-
);
|
|
24794
|
+
const payload = await new DeeplineClient().monitors.status();
|
|
24662
24795
|
const hasAccess = payload.has_access === true;
|
|
24663
24796
|
const reason = typeof payload.reason === "string" && payload.reason.trim() ? payload.reason.trim() : void 0;
|
|
24664
24797
|
const text = hasAccess ? `\u2713 You have access to Deepline Monitors${reason ? `
|
|
@@ -24720,6 +24853,9 @@ function renderAvailableToolsText(payload) {
|
|
|
24720
24853
|
`;
|
|
24721
24854
|
}
|
|
24722
24855
|
async function handleMonitorsAvailable(toolId, options) {
|
|
24856
|
+
process.stderr.write(
|
|
24857
|
+
"`deepline monitors available` is deprecated.\n Browse types: deepline tools list --categories monitors\n Inspect a type: deepline tools get <monitor-type>\n"
|
|
24858
|
+
);
|
|
24723
24859
|
if (toolId !== void 0 && options.tool !== void 0) {
|
|
24724
24860
|
if (toolId !== options.tool) {
|
|
24725
24861
|
throw new MonitorsUsageError(
|
|
@@ -24728,19 +24864,13 @@ async function handleMonitorsAvailable(toolId, options) {
|
|
|
24728
24864
|
}
|
|
24729
24865
|
}
|
|
24730
24866
|
const tool = toolId ?? options.tool;
|
|
24731
|
-
const
|
|
24732
|
-
|
|
24733
|
-
|
|
24734
|
-
|
|
24735
|
-
|
|
24736
|
-
|
|
24737
|
-
|
|
24738
|
-
if (compactList || options.compact) params.set("compact", "true");
|
|
24739
|
-
const query = params.toString();
|
|
24740
|
-
const payload = await http.request(
|
|
24741
|
-
`/api/v2/monitors/tools${query ? `?${query}` : ""}`,
|
|
24742
|
-
{ method: "GET", ...FORBIDDEN_AS_API_ERROR }
|
|
24743
|
-
);
|
|
24867
|
+
const payload = await new DeeplineClient().monitors.available(tool, {
|
|
24868
|
+
...options.provider ? { provider: options.provider } : {},
|
|
24869
|
+
...options.search ? { search: options.search } : {},
|
|
24870
|
+
...options.limit ? { limit: options.limit } : {},
|
|
24871
|
+
...options.full ? { full: true } : {},
|
|
24872
|
+
...options.compact ? { compact: true } : {}
|
|
24873
|
+
});
|
|
24744
24874
|
printCommandEnvelope(payload, {
|
|
24745
24875
|
json: options.json,
|
|
24746
24876
|
// Human list view shows id + name + deployed_count ("deployed: N") so
|
|
@@ -24752,9 +24882,9 @@ async function handleMonitorsAvailable(toolId, options) {
|
|
|
24752
24882
|
function renderDeployedListText(payload, requestedStatus) {
|
|
24753
24883
|
const monitors = Array.isArray(payload.monitors) ? payload.monitors : null;
|
|
24754
24884
|
if (!monitors) return void 0;
|
|
24755
|
-
const
|
|
24756
|
-
|
|
24757
|
-
];
|
|
24885
|
+
const total = asFiniteNumber(payload.total);
|
|
24886
|
+
const header = monitors.length === 0 ? "No deployed monitors matched." : total !== void 0 && total > monitors.length ? `Deployed monitors (${monitors.length} of ${total}):` : `Deployed monitors (${monitors.length}):`;
|
|
24887
|
+
const lines = [header];
|
|
24758
24888
|
for (const raw of monitors) {
|
|
24759
24889
|
const entry = asRecord(raw);
|
|
24760
24890
|
const key = entry ? asString(entry.key) ?? asString(entry.monitor_key) : void 0;
|
|
@@ -24770,6 +24900,13 @@ function renderDeployedListText(payload, requestedStatus) {
|
|
|
24770
24900
|
lines.push(
|
|
24771
24901
|
`Status filter: ${applied}${requestedStatus === void 0 && applied === "active" ? " (default)" : ""} \u2014 use --status all to include disabled monitors.`
|
|
24772
24902
|
);
|
|
24903
|
+
if (payload.is_truncated === true) {
|
|
24904
|
+
const nextCursor = asString(payload.next_cursor);
|
|
24905
|
+
lines.push(
|
|
24906
|
+
total !== void 0 ? `List truncated \u2014 showing ${monitors.length} of ${total}. Before concluding "no matching monitor exists," page the full registry:` : 'List truncated. Before concluding "no matching monitor exists," page the full registry:',
|
|
24907
|
+
nextCursor ? ` deepline monitors list${requestedStatus ? ` --status ${requestedStatus}` : ""} --cursor ${nextCursor}` : " raise --limit above the reported total."
|
|
24908
|
+
);
|
|
24909
|
+
}
|
|
24773
24910
|
if (monitors.length > 0) {
|
|
24774
24911
|
lines.push("", "Inspect one: deepline monitors get <key> --json");
|
|
24775
24912
|
}
|
|
@@ -24777,48 +24914,42 @@ function renderDeployedListText(payload, requestedStatus) {
|
|
|
24777
24914
|
`;
|
|
24778
24915
|
}
|
|
24779
24916
|
async function handleMonitorsList(options) {
|
|
24780
|
-
const
|
|
24781
|
-
|
|
24782
|
-
|
|
24783
|
-
|
|
24784
|
-
|
|
24785
|
-
|
|
24786
|
-
const payload = await http.request(
|
|
24787
|
-
`/api/v2/monitors/deployed${query ? `?${query}` : ""}`,
|
|
24788
|
-
{ method: "GET", ...FORBIDDEN_AS_API_ERROR }
|
|
24789
|
-
);
|
|
24917
|
+
const payload = await new DeeplineClient().monitors.list({
|
|
24918
|
+
...options.status ? { status: options.status } : {},
|
|
24919
|
+
...options.limit ? { limit: options.limit } : {},
|
|
24920
|
+
...options.cursor ? { cursor: options.cursor } : {},
|
|
24921
|
+
...options.compact ? { compact: true } : {}
|
|
24922
|
+
});
|
|
24790
24923
|
printCommandEnvelope(payload, {
|
|
24791
24924
|
json: options.json,
|
|
24792
24925
|
text: renderDeployedListText(payload, options.status)
|
|
24793
24926
|
});
|
|
24794
24927
|
}
|
|
24795
24928
|
async function handleMonitorsCheck(definition, options) {
|
|
24796
|
-
const http = buildHttpClient();
|
|
24797
24929
|
const body = resolveMonitorJsonBody({
|
|
24798
24930
|
positional: definition,
|
|
24799
24931
|
file: options.file,
|
|
24800
24932
|
argLabel: "<definition>",
|
|
24801
24933
|
command: "deepline monitors check"
|
|
24802
24934
|
});
|
|
24803
|
-
const payload = await
|
|
24804
|
-
|
|
24805
|
-
{ method: "POST", body, ...FORBIDDEN_AS_API_ERROR }
|
|
24935
|
+
const payload = await new DeeplineClient().monitors.check(
|
|
24936
|
+
body
|
|
24806
24937
|
);
|
|
24807
24938
|
printCommandEnvelope(payload, { json: options.json });
|
|
24808
24939
|
}
|
|
24809
24940
|
async function handleMonitorsDeploy(definition, options) {
|
|
24810
|
-
const http = buildHttpClient();
|
|
24811
24941
|
const body = resolveMonitorJsonBody({
|
|
24812
24942
|
positional: definition,
|
|
24813
24943
|
file: options.file,
|
|
24814
24944
|
argLabel: "<definition>",
|
|
24815
24945
|
command: "deepline monitors deploy"
|
|
24816
24946
|
});
|
|
24947
|
+
const client2 = new DeeplineClient();
|
|
24948
|
+
const definitionArg = body;
|
|
24817
24949
|
if (options.dryRun) {
|
|
24818
|
-
const payload2 = await
|
|
24819
|
-
|
|
24820
|
-
|
|
24821
|
-
);
|
|
24950
|
+
const payload2 = await client2.monitors.deploy(definitionArg, {
|
|
24951
|
+
dryRun: true
|
|
24952
|
+
});
|
|
24822
24953
|
const valid = payload2.valid !== false;
|
|
24823
24954
|
printCommandEnvelope(
|
|
24824
24955
|
{ dry_run: true, ...payload2 },
|
|
@@ -24829,10 +24960,7 @@ async function handleMonitorsDeploy(definition, options) {
|
|
|
24829
24960
|
}
|
|
24830
24961
|
return;
|
|
24831
24962
|
}
|
|
24832
|
-
const payload = await
|
|
24833
|
-
"/api/v2/monitors/deploy",
|
|
24834
|
-
{ method: "POST", body, ...FORBIDDEN_AS_API_ERROR }
|
|
24835
|
-
);
|
|
24963
|
+
const payload = await client2.monitors.deploy(definitionArg);
|
|
24836
24964
|
printCommandEnvelope(payload, {
|
|
24837
24965
|
json: options.json,
|
|
24838
24966
|
text: renderMonitorDeployCompletion(payload)
|
|
@@ -24881,15 +25009,9 @@ function renderMonitorGet(payload) {
|
|
|
24881
25009
|
`;
|
|
24882
25010
|
}
|
|
24883
25011
|
async function handleMonitorsGet(key, options) {
|
|
24884
|
-
const
|
|
24885
|
-
const payload = await
|
|
24886
|
-
|
|
24887
|
-
{ method: "GET", ...FORBIDDEN_AS_API_ERROR }
|
|
24888
|
-
);
|
|
24889
|
-
const dependents = await http.request(
|
|
24890
|
-
`/api/v2/monitors/deployed/${encodeKey(key)}/dependents`,
|
|
24891
|
-
{ method: "GET", ...FORBIDDEN_AS_API_ERROR }
|
|
24892
|
-
);
|
|
25012
|
+
const client2 = new DeeplineClient();
|
|
25013
|
+
const payload = await client2.monitors.get(key);
|
|
25014
|
+
const dependents = await client2.monitors.dependents(key);
|
|
24893
25015
|
const detail = { ...payload, dependents };
|
|
24894
25016
|
printCommandEnvelope(detail, {
|
|
24895
25017
|
json: options.json,
|
|
@@ -24912,15 +25034,12 @@ async function confirmMonitorDelete(key, options) {
|
|
|
24912
25034
|
}
|
|
24913
25035
|
}
|
|
24914
25036
|
async function handleMonitorsDelete(key, options) {
|
|
24915
|
-
const
|
|
24916
|
-
const params = new URLSearchParams();
|
|
24917
|
-
if (options.localOnly) params.set("local_only", "true");
|
|
25037
|
+
const client2 = new DeeplineClient();
|
|
24918
25038
|
if (options.dryRun) {
|
|
24919
|
-
|
|
24920
|
-
|
|
24921
|
-
|
|
24922
|
-
|
|
24923
|
-
);
|
|
25039
|
+
const payload2 = await client2.monitors.delete(key, {
|
|
25040
|
+
...options.localOnly ? { localOnly: true } : {},
|
|
25041
|
+
dryRun: true
|
|
25042
|
+
});
|
|
24924
25043
|
assertMonitorDryRunAcknowledged(payload2, {
|
|
24925
25044
|
command: "deepline monitors delete",
|
|
24926
25045
|
mutation: "delete"
|
|
@@ -24948,34 +25067,25 @@ async function handleMonitorsDelete(key, options) {
|
|
|
24948
25067
|
return;
|
|
24949
25068
|
}
|
|
24950
25069
|
}
|
|
24951
|
-
const
|
|
24952
|
-
|
|
24953
|
-
|
|
24954
|
-
{ method: "DELETE", ...FORBIDDEN_AS_API_ERROR }
|
|
24955
|
-
);
|
|
25070
|
+
const payload = await client2.monitors.delete(key, {
|
|
25071
|
+
...options.localOnly ? { localOnly: true } : {}
|
|
25072
|
+
});
|
|
24956
25073
|
printCommandEnvelope(payload, { json: options.json });
|
|
24957
25074
|
}
|
|
24958
25075
|
async function handleMonitorsUpdate(key, patch, options) {
|
|
24959
|
-
const http = buildHttpClient();
|
|
24960
25076
|
const body = resolveMonitorJsonBody({
|
|
24961
25077
|
positional: patch,
|
|
24962
25078
|
file: options.file,
|
|
24963
25079
|
argLabel: "<patch>",
|
|
24964
25080
|
command: `deepline monitors update ${key}`
|
|
24965
25081
|
});
|
|
24966
|
-
const payload = await
|
|
24967
|
-
`/api/v2/monitors/deployed/${encodeKey(key)}`,
|
|
24968
|
-
{ method: "PATCH", body, ...FORBIDDEN_AS_API_ERROR }
|
|
24969
|
-
);
|
|
25082
|
+
const payload = await new DeeplineClient().monitors.update(key, body);
|
|
24970
25083
|
printCommandEnvelope(payload, { json: options.json });
|
|
24971
25084
|
}
|
|
24972
25085
|
async function handleMonitorsReactivate(key, options) {
|
|
24973
|
-
const
|
|
25086
|
+
const client2 = new DeeplineClient();
|
|
24974
25087
|
if (options.dryRun) {
|
|
24975
|
-
const payload2 = await
|
|
24976
|
-
`/api/v2/monitors/deployed/${encodeKey(key)}/reactivate?dry_run=true`,
|
|
24977
|
-
{ method: "POST", body: {}, ...FORBIDDEN_AS_API_ERROR }
|
|
24978
|
-
);
|
|
25088
|
+
const payload2 = await client2.monitors.reactivate(key, { dryRun: true });
|
|
24979
25089
|
assertMonitorDryRunAcknowledged(payload2, {
|
|
24980
25090
|
command: "deepline monitors reactivate",
|
|
24981
25091
|
mutation: "reactivate"
|
|
@@ -24986,10 +25096,7 @@ async function handleMonitorsReactivate(key, options) {
|
|
|
24986
25096
|
});
|
|
24987
25097
|
return;
|
|
24988
25098
|
}
|
|
24989
|
-
const payload = await
|
|
24990
|
-
`/api/v2/monitors/deployed/${encodeKey(key)}/reactivate`,
|
|
24991
|
-
{ method: "POST", body: {}, ...FORBIDDEN_AS_API_ERROR }
|
|
24992
|
-
);
|
|
25099
|
+
const payload = await client2.monitors.reactivate(key);
|
|
24993
25100
|
printCommandEnvelope(payload, { json: options.json });
|
|
24994
25101
|
}
|
|
24995
25102
|
function registerMonitorsCommands(program) {
|
|
@@ -25078,17 +25185,24 @@ Examples:
|
|
|
25078
25185
|
Notes:
|
|
25079
25186
|
Read-only. --status filters by monitor status: active (default), disabled, or
|
|
25080
25187
|
all. The output echoes the status filter that was applied. --compact returns
|
|
25081
|
-
high-signal fields only.
|
|
25188
|
+
high-signal fields only. The response reports total (the true registry count,
|
|
25189
|
+
not the page size), returned, is_truncated, and next_cursor. When is_truncated
|
|
25190
|
+
is true, page with --cursor <next_cursor> until it is false \u2014 a "no matching
|
|
25191
|
+
monitor" reuse conclusion off a truncated page deploys a duplicate paid feed.
|
|
25082
25192
|
|
|
25083
25193
|
Examples:
|
|
25084
25194
|
deepline monitors list
|
|
25085
25195
|
deepline monitors list --status all --json
|
|
25196
|
+
deepline monitors list --status all --cursor <next_cursor> --json
|
|
25086
25197
|
deepline monitors list --compact --json
|
|
25087
25198
|
`
|
|
25088
25199
|
).option(
|
|
25089
25200
|
"--status <status>",
|
|
25090
25201
|
"Filter by monitor status: active (default), disabled, or all"
|
|
25091
|
-
).option("--limit <n>", "Limit the number of deployed monitors returned").option(
|
|
25202
|
+
).option("--limit <n>", "Limit the number of deployed monitors returned").option(
|
|
25203
|
+
"--cursor <cursor>",
|
|
25204
|
+
"Page past a truncated result using the next_cursor from a prior list response"
|
|
25205
|
+
).option("--compact", COMPACT_OPTION_DESCRIPTION)
|
|
25092
25206
|
).action(monitorsAction(handleMonitorsList));
|
|
25093
25207
|
withJsonOption(
|
|
25094
25208
|
monitors.command("get <key>").description("Show a single deployed monitor by its public key.").addHelpText(
|
|
@@ -25209,7 +25323,10 @@ Examples:
|
|
|
25209
25323
|
monitors.command("deployed", { hidden: true }).description("Alias of `monitors list` (plus get/update/delete aliases).").option(
|
|
25210
25324
|
"--status <status>",
|
|
25211
25325
|
"Filter by monitor status: active (default), disabled, or all"
|
|
25212
|
-
).option("--limit <n>", "Limit the number of deployed monitors returned").option(
|
|
25326
|
+
).option("--limit <n>", "Limit the number of deployed monitors returned").option(
|
|
25327
|
+
"--cursor <cursor>",
|
|
25328
|
+
"Page past a truncated result using the next_cursor from a prior list response"
|
|
25329
|
+
).option("--compact", COMPACT_OPTION_DESCRIPTION)
|
|
25213
25330
|
).action(monitorsAction(handleMonitorsList));
|
|
25214
25331
|
withJsonOption(
|
|
25215
25332
|
deployed.command("get <key>").description("Alias of `monitors get <key>`.")
|