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.js
CHANGED
|
@@ -718,7 +718,7 @@ var SDK_RELEASE = {
|
|
|
718
718
|
// 0.1.253 makes play-page browser opening opt-in and retires --no-open.
|
|
719
719
|
// 0.1.254 removes the internal operations tree from the published SDK CLI.
|
|
720
720
|
// Operators use the checkout-local deepline-admin binary instead.
|
|
721
|
-
version: "0.1.
|
|
721
|
+
version: "0.1.273",
|
|
722
722
|
contracts: {
|
|
723
723
|
api: {
|
|
724
724
|
name: "sdk-http-api",
|
|
@@ -2925,6 +2925,8 @@ var DeeplineClient = class {
|
|
|
2925
2925
|
db;
|
|
2926
2926
|
/** Billing namespace: subscription status/cancel and invoice history. */
|
|
2927
2927
|
billing;
|
|
2928
|
+
/** Monitors namespace: access, catalog, deploy/check, and lifecycle. */
|
|
2929
|
+
monitors;
|
|
2928
2930
|
/**
|
|
2929
2931
|
* Create a low-level SDK client.
|
|
2930
2932
|
*
|
|
@@ -2960,6 +2962,18 @@ var DeeplineClient = class {
|
|
|
2960
2962
|
list: (options2) => this.listBillingInvoices(options2)
|
|
2961
2963
|
}
|
|
2962
2964
|
};
|
|
2965
|
+
this.monitors = {
|
|
2966
|
+
status: () => this.getMonitorsAccess(),
|
|
2967
|
+
available: (toolIdOrOptions, options2) => this.getMonitorsAvailable(toolIdOrOptions, options2),
|
|
2968
|
+
check: (definition) => this.checkMonitor(definition),
|
|
2969
|
+
deploy: (definition, options2) => this.deployMonitor(definition, options2),
|
|
2970
|
+
list: (options2) => this.listMonitors(options2),
|
|
2971
|
+
get: (key) => this.getMonitor(key),
|
|
2972
|
+
dependents: (key) => this.getMonitorDependents(key),
|
|
2973
|
+
update: (key, patch) => this.updateMonitor(key, patch),
|
|
2974
|
+
delete: (key, options2) => this.deleteMonitor(key, options2),
|
|
2975
|
+
reactivate: (key, options2) => this.reactivateMonitor(key, options2)
|
|
2976
|
+
};
|
|
2963
2977
|
}
|
|
2964
2978
|
/** The resolved base URL this client is targeting (e.g. `"http://localhost:3000"`). */
|
|
2965
2979
|
get baseUrl() {
|
|
@@ -4822,6 +4836,136 @@ var DeeplineClient = class {
|
|
|
4822
4836
|
`/api/v2/billing/invoices${suffix}`
|
|
4823
4837
|
);
|
|
4824
4838
|
}
|
|
4839
|
+
// ——————————————————————————————————————————————————————————
|
|
4840
|
+
// Monitors
|
|
4841
|
+
// ——————————————————————————————————————————————————————————
|
|
4842
|
+
/**
|
|
4843
|
+
* Whether the current workspace can use Deepline Monitors. Reachable without
|
|
4844
|
+
* monitor access; a denial is a normal 200 body, not a 403. Prefer
|
|
4845
|
+
* `client.monitors.status()`.
|
|
4846
|
+
*/
|
|
4847
|
+
async getMonitorsAccess() {
|
|
4848
|
+
const payload = await this.http.request(
|
|
4849
|
+
"/api/v2/monitors/access",
|
|
4850
|
+
{ method: "GET" }
|
|
4851
|
+
);
|
|
4852
|
+
return {
|
|
4853
|
+
has_access: payload.has_access === true,
|
|
4854
|
+
...typeof payload.reason === "string" && payload.reason.trim() ? { reason: payload.reason.trim() } : {}
|
|
4855
|
+
};
|
|
4856
|
+
}
|
|
4857
|
+
/**
|
|
4858
|
+
* The deployable monitor tools catalog. Pass a tool id (positional or
|
|
4859
|
+
* `{ tool }`) to describe one tool's full payload/stream contract, or no tool
|
|
4860
|
+
* id for the compact inventory. Prefer `client.monitors.available(...)`.
|
|
4861
|
+
*/
|
|
4862
|
+
async getMonitorsAvailable(toolIdOrOptions, maybeOptions) {
|
|
4863
|
+
const positionalTool = typeof toolIdOrOptions === "string" ? toolIdOrOptions : void 0;
|
|
4864
|
+
const options = toolIdOrOptions && typeof toolIdOrOptions === "object" ? toolIdOrOptions : maybeOptions ?? {};
|
|
4865
|
+
const optionTool = toolIdOrOptions && typeof toolIdOrOptions === "object" ? toolIdOrOptions.tool : void 0;
|
|
4866
|
+
const tool = positionalTool ?? optionTool;
|
|
4867
|
+
const params = new URLSearchParams();
|
|
4868
|
+
if (options.provider) params.set("provider", options.provider);
|
|
4869
|
+
if (tool) params.set("tool", tool);
|
|
4870
|
+
if (options.search) params.set("search", options.search);
|
|
4871
|
+
if (options.limit !== void 0) params.set("limit", String(options.limit));
|
|
4872
|
+
const compactList = !tool && options.full !== true;
|
|
4873
|
+
if (compactList || options.compact) params.set("compact", "true");
|
|
4874
|
+
const query = params.toString();
|
|
4875
|
+
const suffix = query ? `?${query}` : "";
|
|
4876
|
+
return this.http.request(
|
|
4877
|
+
`/api/v2/monitors/tools${suffix}`,
|
|
4878
|
+
{ method: "GET", forbiddenAsApiError: true }
|
|
4879
|
+
);
|
|
4880
|
+
}
|
|
4881
|
+
/** Validate a monitor definition without deploying it. Prefer `client.monitors.check(...)`. */
|
|
4882
|
+
async checkMonitor(definition) {
|
|
4883
|
+
return this.http.request("/api/v2/monitors/check", {
|
|
4884
|
+
method: "POST",
|
|
4885
|
+
body: definition,
|
|
4886
|
+
forbiddenAsApiError: true
|
|
4887
|
+
});
|
|
4888
|
+
}
|
|
4889
|
+
/**
|
|
4890
|
+
* Deploy a monitor from a definition. `dryRun` validates via the check
|
|
4891
|
+
* endpoint and returns the plan without deploying. Prefer
|
|
4892
|
+
* `client.monitors.deploy(...)`.
|
|
4893
|
+
*/
|
|
4894
|
+
async deployMonitor(definition, options) {
|
|
4895
|
+
if (options?.dryRun) {
|
|
4896
|
+
return this.http.request("/api/v2/monitors/check", {
|
|
4897
|
+
method: "POST",
|
|
4898
|
+
body: definition,
|
|
4899
|
+
forbiddenAsApiError: true
|
|
4900
|
+
});
|
|
4901
|
+
}
|
|
4902
|
+
return this.http.request("/api/v2/monitors/deploy", {
|
|
4903
|
+
method: "POST",
|
|
4904
|
+
body: definition,
|
|
4905
|
+
forbiddenAsApiError: true
|
|
4906
|
+
});
|
|
4907
|
+
}
|
|
4908
|
+
/** List deployed monitors. Prefer `client.monitors.list(...)`. */
|
|
4909
|
+
async listMonitors(options) {
|
|
4910
|
+
const params = new URLSearchParams();
|
|
4911
|
+
if (options?.status) params.set("status", options.status);
|
|
4912
|
+
if (options?.limit !== void 0) params.set("limit", String(options.limit));
|
|
4913
|
+
if (options?.cursor) params.set("cursor", options.cursor);
|
|
4914
|
+
if (options?.compact) params.set("compact", "true");
|
|
4915
|
+
const query = params.toString();
|
|
4916
|
+
const suffix = query ? `?${query}` : "";
|
|
4917
|
+
return this.http.request(
|
|
4918
|
+
`/api/v2/monitors/deployed${suffix}`,
|
|
4919
|
+
{ method: "GET", forbiddenAsApiError: true }
|
|
4920
|
+
);
|
|
4921
|
+
}
|
|
4922
|
+
/** Fetch one deployed monitor by public key. Prefer `client.monitors.get(...)`. */
|
|
4923
|
+
async getMonitor(key) {
|
|
4924
|
+
return this.http.request(
|
|
4925
|
+
`/api/v2/monitors/deployed/${encodeURIComponent(key)}`,
|
|
4926
|
+
{ method: "GET", forbiddenAsApiError: true }
|
|
4927
|
+
);
|
|
4928
|
+
}
|
|
4929
|
+
/** Published plays depending on one monitor. Prefer `client.monitors.dependents(...)`. */
|
|
4930
|
+
async getMonitorDependents(key) {
|
|
4931
|
+
return this.http.request(
|
|
4932
|
+
`/api/v2/monitors/deployed/${encodeURIComponent(key)}/dependents`,
|
|
4933
|
+
{ method: "GET", forbiddenAsApiError: true }
|
|
4934
|
+
);
|
|
4935
|
+
}
|
|
4936
|
+
/** Update a deployed monitor by public key. Prefer `client.monitors.update(...)`. */
|
|
4937
|
+
async updateMonitor(key, patch) {
|
|
4938
|
+
return this.http.request(
|
|
4939
|
+
`/api/v2/monitors/deployed/${encodeURIComponent(key)}`,
|
|
4940
|
+
{ method: "PATCH", body: patch, forbiddenAsApiError: true }
|
|
4941
|
+
);
|
|
4942
|
+
}
|
|
4943
|
+
/**
|
|
4944
|
+
* Delete a deployed monitor by public key. Deprovisions the upstream provider
|
|
4945
|
+
* resource unless `localOnly`; `dryRun` returns the delete plan. Prefer
|
|
4946
|
+
* `client.monitors.delete(...)`.
|
|
4947
|
+
*/
|
|
4948
|
+
async deleteMonitor(key, options) {
|
|
4949
|
+
const params = new URLSearchParams();
|
|
4950
|
+
if (options?.localOnly) params.set("local_only", "true");
|
|
4951
|
+
if (options?.dryRun) params.set("dry_run", "true");
|
|
4952
|
+
const query = params.toString();
|
|
4953
|
+
return this.http.request(
|
|
4954
|
+
`/api/v2/monitors/deployed/${encodeURIComponent(key)}${query ? `?${query}` : ""}`,
|
|
4955
|
+
{ method: "DELETE", forbiddenAsApiError: true }
|
|
4956
|
+
);
|
|
4957
|
+
}
|
|
4958
|
+
/**
|
|
4959
|
+
* Reactivate a disabled monitor. `dryRun` returns the reactivation cost.
|
|
4960
|
+
* Prefer `client.monitors.reactivate(...)`.
|
|
4961
|
+
*/
|
|
4962
|
+
async reactivateMonitor(key, options) {
|
|
4963
|
+
const query = options?.dryRun ? "?dry_run=true" : "";
|
|
4964
|
+
return this.http.request(
|
|
4965
|
+
`/api/v2/monitors/deployed/${encodeURIComponent(key)}/reactivate${query}`,
|
|
4966
|
+
{ method: "POST", body: {}, forbiddenAsApiError: true }
|
|
4967
|
+
);
|
|
4968
|
+
}
|
|
4825
4969
|
/**
|
|
4826
4970
|
* Check API connectivity and server health.
|
|
4827
4971
|
*
|
|
@@ -24273,15 +24417,11 @@ Examples:
|
|
|
24273
24417
|
// src/cli/commands/monitors.ts
|
|
24274
24418
|
var import_node_fs12 = require("fs");
|
|
24275
24419
|
var import_promises4 = require("readline/promises");
|
|
24276
|
-
var FORBIDDEN_AS_API_ERROR = { forbiddenAsApiError: true };
|
|
24277
24420
|
var JSON_OPTION_DESCRIPTION = "Emit JSON output. Also automatic when stdout is piped";
|
|
24278
24421
|
function withJsonOption(command) {
|
|
24279
24422
|
return command.option("--json", JSON_OPTION_DESCRIPTION);
|
|
24280
24423
|
}
|
|
24281
24424
|
var COMPACT_OPTION_DESCRIPTION = "Ask the server for high-signal fields only (smaller output for agent loops)";
|
|
24282
|
-
function buildHttpClient() {
|
|
24283
|
-
return new HttpClient(resolveConfig());
|
|
24284
|
-
}
|
|
24285
24425
|
var MonitorsUsageError = class extends Error {
|
|
24286
24426
|
code = "MONITORS_USAGE_ERROR";
|
|
24287
24427
|
constructor(message) {
|
|
@@ -24422,9 +24562,6 @@ or from a file / stdin:
|
|
|
24422
24562
|
cat monitor.json | ${input2.command} --file -`
|
|
24423
24563
|
);
|
|
24424
24564
|
}
|
|
24425
|
-
function encodeKey(key) {
|
|
24426
|
-
return encodeURIComponent(key);
|
|
24427
|
-
}
|
|
24428
24565
|
function asRecord(value) {
|
|
24429
24566
|
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
24430
24567
|
}
|
|
@@ -24618,11 +24755,7 @@ Preview the plan first with:
|
|
|
24618
24755
|
);
|
|
24619
24756
|
}
|
|
24620
24757
|
async function handleMonitorsStatus(options) {
|
|
24621
|
-
const
|
|
24622
|
-
const payload = await http.request(
|
|
24623
|
-
"/api/v2/monitors/access",
|
|
24624
|
-
{ method: "GET" }
|
|
24625
|
-
);
|
|
24758
|
+
const payload = await new DeeplineClient().monitors.status();
|
|
24626
24759
|
const hasAccess = payload.has_access === true;
|
|
24627
24760
|
const reason = typeof payload.reason === "string" && payload.reason.trim() ? payload.reason.trim() : void 0;
|
|
24628
24761
|
const text = hasAccess ? `\u2713 You have access to Deepline Monitors${reason ? `
|
|
@@ -24684,6 +24817,9 @@ function renderAvailableToolsText(payload) {
|
|
|
24684
24817
|
`;
|
|
24685
24818
|
}
|
|
24686
24819
|
async function handleMonitorsAvailable(toolId, options) {
|
|
24820
|
+
process.stderr.write(
|
|
24821
|
+
"`deepline monitors available` is deprecated.\n Browse types: deepline tools list --categories monitors\n Inspect a type: deepline tools get <monitor-type>\n"
|
|
24822
|
+
);
|
|
24687
24823
|
if (toolId !== void 0 && options.tool !== void 0) {
|
|
24688
24824
|
if (toolId !== options.tool) {
|
|
24689
24825
|
throw new MonitorsUsageError(
|
|
@@ -24692,19 +24828,13 @@ async function handleMonitorsAvailable(toolId, options) {
|
|
|
24692
24828
|
}
|
|
24693
24829
|
}
|
|
24694
24830
|
const tool = toolId ?? options.tool;
|
|
24695
|
-
const
|
|
24696
|
-
|
|
24697
|
-
|
|
24698
|
-
|
|
24699
|
-
|
|
24700
|
-
|
|
24701
|
-
|
|
24702
|
-
if (compactList || options.compact) params.set("compact", "true");
|
|
24703
|
-
const query = params.toString();
|
|
24704
|
-
const payload = await http.request(
|
|
24705
|
-
`/api/v2/monitors/tools${query ? `?${query}` : ""}`,
|
|
24706
|
-
{ method: "GET", ...FORBIDDEN_AS_API_ERROR }
|
|
24707
|
-
);
|
|
24831
|
+
const payload = await new DeeplineClient().monitors.available(tool, {
|
|
24832
|
+
...options.provider ? { provider: options.provider } : {},
|
|
24833
|
+
...options.search ? { search: options.search } : {},
|
|
24834
|
+
...options.limit ? { limit: options.limit } : {},
|
|
24835
|
+
...options.full ? { full: true } : {},
|
|
24836
|
+
...options.compact ? { compact: true } : {}
|
|
24837
|
+
});
|
|
24708
24838
|
printCommandEnvelope(payload, {
|
|
24709
24839
|
json: options.json,
|
|
24710
24840
|
// Human list view shows id + name + deployed_count ("deployed: N") so
|
|
@@ -24716,9 +24846,9 @@ async function handleMonitorsAvailable(toolId, options) {
|
|
|
24716
24846
|
function renderDeployedListText(payload, requestedStatus) {
|
|
24717
24847
|
const monitors = Array.isArray(payload.monitors) ? payload.monitors : null;
|
|
24718
24848
|
if (!monitors) return void 0;
|
|
24719
|
-
const
|
|
24720
|
-
|
|
24721
|
-
];
|
|
24849
|
+
const total = asFiniteNumber(payload.total);
|
|
24850
|
+
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}):`;
|
|
24851
|
+
const lines = [header];
|
|
24722
24852
|
for (const raw of monitors) {
|
|
24723
24853
|
const entry = asRecord(raw);
|
|
24724
24854
|
const key = entry ? asString(entry.key) ?? asString(entry.monitor_key) : void 0;
|
|
@@ -24734,6 +24864,13 @@ function renderDeployedListText(payload, requestedStatus) {
|
|
|
24734
24864
|
lines.push(
|
|
24735
24865
|
`Status filter: ${applied}${requestedStatus === void 0 && applied === "active" ? " (default)" : ""} \u2014 use --status all to include disabled monitors.`
|
|
24736
24866
|
);
|
|
24867
|
+
if (payload.is_truncated === true) {
|
|
24868
|
+
const nextCursor = asString(payload.next_cursor);
|
|
24869
|
+
lines.push(
|
|
24870
|
+
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:',
|
|
24871
|
+
nextCursor ? ` deepline monitors list${requestedStatus ? ` --status ${requestedStatus}` : ""} --cursor ${nextCursor}` : " raise --limit above the reported total."
|
|
24872
|
+
);
|
|
24873
|
+
}
|
|
24737
24874
|
if (monitors.length > 0) {
|
|
24738
24875
|
lines.push("", "Inspect one: deepline monitors get <key> --json");
|
|
24739
24876
|
}
|
|
@@ -24741,48 +24878,42 @@ function renderDeployedListText(payload, requestedStatus) {
|
|
|
24741
24878
|
`;
|
|
24742
24879
|
}
|
|
24743
24880
|
async function handleMonitorsList(options) {
|
|
24744
|
-
const
|
|
24745
|
-
|
|
24746
|
-
|
|
24747
|
-
|
|
24748
|
-
|
|
24749
|
-
|
|
24750
|
-
const payload = await http.request(
|
|
24751
|
-
`/api/v2/monitors/deployed${query ? `?${query}` : ""}`,
|
|
24752
|
-
{ method: "GET", ...FORBIDDEN_AS_API_ERROR }
|
|
24753
|
-
);
|
|
24881
|
+
const payload = await new DeeplineClient().monitors.list({
|
|
24882
|
+
...options.status ? { status: options.status } : {},
|
|
24883
|
+
...options.limit ? { limit: options.limit } : {},
|
|
24884
|
+
...options.cursor ? { cursor: options.cursor } : {},
|
|
24885
|
+
...options.compact ? { compact: true } : {}
|
|
24886
|
+
});
|
|
24754
24887
|
printCommandEnvelope(payload, {
|
|
24755
24888
|
json: options.json,
|
|
24756
24889
|
text: renderDeployedListText(payload, options.status)
|
|
24757
24890
|
});
|
|
24758
24891
|
}
|
|
24759
24892
|
async function handleMonitorsCheck(definition, options) {
|
|
24760
|
-
const http = buildHttpClient();
|
|
24761
24893
|
const body = resolveMonitorJsonBody({
|
|
24762
24894
|
positional: definition,
|
|
24763
24895
|
file: options.file,
|
|
24764
24896
|
argLabel: "<definition>",
|
|
24765
24897
|
command: "deepline monitors check"
|
|
24766
24898
|
});
|
|
24767
|
-
const payload = await
|
|
24768
|
-
|
|
24769
|
-
{ method: "POST", body, ...FORBIDDEN_AS_API_ERROR }
|
|
24899
|
+
const payload = await new DeeplineClient().monitors.check(
|
|
24900
|
+
body
|
|
24770
24901
|
);
|
|
24771
24902
|
printCommandEnvelope(payload, { json: options.json });
|
|
24772
24903
|
}
|
|
24773
24904
|
async function handleMonitorsDeploy(definition, options) {
|
|
24774
|
-
const http = buildHttpClient();
|
|
24775
24905
|
const body = resolveMonitorJsonBody({
|
|
24776
24906
|
positional: definition,
|
|
24777
24907
|
file: options.file,
|
|
24778
24908
|
argLabel: "<definition>",
|
|
24779
24909
|
command: "deepline monitors deploy"
|
|
24780
24910
|
});
|
|
24911
|
+
const client2 = new DeeplineClient();
|
|
24912
|
+
const definitionArg = body;
|
|
24781
24913
|
if (options.dryRun) {
|
|
24782
|
-
const payload2 = await
|
|
24783
|
-
|
|
24784
|
-
|
|
24785
|
-
);
|
|
24914
|
+
const payload2 = await client2.monitors.deploy(definitionArg, {
|
|
24915
|
+
dryRun: true
|
|
24916
|
+
});
|
|
24786
24917
|
const valid = payload2.valid !== false;
|
|
24787
24918
|
printCommandEnvelope(
|
|
24788
24919
|
{ dry_run: true, ...payload2 },
|
|
@@ -24793,10 +24924,7 @@ async function handleMonitorsDeploy(definition, options) {
|
|
|
24793
24924
|
}
|
|
24794
24925
|
return;
|
|
24795
24926
|
}
|
|
24796
|
-
const payload = await
|
|
24797
|
-
"/api/v2/monitors/deploy",
|
|
24798
|
-
{ method: "POST", body, ...FORBIDDEN_AS_API_ERROR }
|
|
24799
|
-
);
|
|
24927
|
+
const payload = await client2.monitors.deploy(definitionArg);
|
|
24800
24928
|
printCommandEnvelope(payload, {
|
|
24801
24929
|
json: options.json,
|
|
24802
24930
|
text: renderMonitorDeployCompletion(payload)
|
|
@@ -24845,15 +24973,9 @@ function renderMonitorGet(payload) {
|
|
|
24845
24973
|
`;
|
|
24846
24974
|
}
|
|
24847
24975
|
async function handleMonitorsGet(key, options) {
|
|
24848
|
-
const
|
|
24849
|
-
const payload = await
|
|
24850
|
-
|
|
24851
|
-
{ method: "GET", ...FORBIDDEN_AS_API_ERROR }
|
|
24852
|
-
);
|
|
24853
|
-
const dependents = await http.request(
|
|
24854
|
-
`/api/v2/monitors/deployed/${encodeKey(key)}/dependents`,
|
|
24855
|
-
{ method: "GET", ...FORBIDDEN_AS_API_ERROR }
|
|
24856
|
-
);
|
|
24976
|
+
const client2 = new DeeplineClient();
|
|
24977
|
+
const payload = await client2.monitors.get(key);
|
|
24978
|
+
const dependents = await client2.monitors.dependents(key);
|
|
24857
24979
|
const detail = { ...payload, dependents };
|
|
24858
24980
|
printCommandEnvelope(detail, {
|
|
24859
24981
|
json: options.json,
|
|
@@ -24876,15 +24998,12 @@ async function confirmMonitorDelete(key, options) {
|
|
|
24876
24998
|
}
|
|
24877
24999
|
}
|
|
24878
25000
|
async function handleMonitorsDelete(key, options) {
|
|
24879
|
-
const
|
|
24880
|
-
const params = new URLSearchParams();
|
|
24881
|
-
if (options.localOnly) params.set("local_only", "true");
|
|
25001
|
+
const client2 = new DeeplineClient();
|
|
24882
25002
|
if (options.dryRun) {
|
|
24883
|
-
|
|
24884
|
-
|
|
24885
|
-
|
|
24886
|
-
|
|
24887
|
-
);
|
|
25003
|
+
const payload2 = await client2.monitors.delete(key, {
|
|
25004
|
+
...options.localOnly ? { localOnly: true } : {},
|
|
25005
|
+
dryRun: true
|
|
25006
|
+
});
|
|
24888
25007
|
assertMonitorDryRunAcknowledged(payload2, {
|
|
24889
25008
|
command: "deepline monitors delete",
|
|
24890
25009
|
mutation: "delete"
|
|
@@ -24912,34 +25031,25 @@ async function handleMonitorsDelete(key, options) {
|
|
|
24912
25031
|
return;
|
|
24913
25032
|
}
|
|
24914
25033
|
}
|
|
24915
|
-
const
|
|
24916
|
-
|
|
24917
|
-
|
|
24918
|
-
{ method: "DELETE", ...FORBIDDEN_AS_API_ERROR }
|
|
24919
|
-
);
|
|
25034
|
+
const payload = await client2.monitors.delete(key, {
|
|
25035
|
+
...options.localOnly ? { localOnly: true } : {}
|
|
25036
|
+
});
|
|
24920
25037
|
printCommandEnvelope(payload, { json: options.json });
|
|
24921
25038
|
}
|
|
24922
25039
|
async function handleMonitorsUpdate(key, patch, options) {
|
|
24923
|
-
const http = buildHttpClient();
|
|
24924
25040
|
const body = resolveMonitorJsonBody({
|
|
24925
25041
|
positional: patch,
|
|
24926
25042
|
file: options.file,
|
|
24927
25043
|
argLabel: "<patch>",
|
|
24928
25044
|
command: `deepline monitors update ${key}`
|
|
24929
25045
|
});
|
|
24930
|
-
const payload = await
|
|
24931
|
-
`/api/v2/monitors/deployed/${encodeKey(key)}`,
|
|
24932
|
-
{ method: "PATCH", body, ...FORBIDDEN_AS_API_ERROR }
|
|
24933
|
-
);
|
|
25046
|
+
const payload = await new DeeplineClient().monitors.update(key, body);
|
|
24934
25047
|
printCommandEnvelope(payload, { json: options.json });
|
|
24935
25048
|
}
|
|
24936
25049
|
async function handleMonitorsReactivate(key, options) {
|
|
24937
|
-
const
|
|
25050
|
+
const client2 = new DeeplineClient();
|
|
24938
25051
|
if (options.dryRun) {
|
|
24939
|
-
const payload2 = await
|
|
24940
|
-
`/api/v2/monitors/deployed/${encodeKey(key)}/reactivate?dry_run=true`,
|
|
24941
|
-
{ method: "POST", body: {}, ...FORBIDDEN_AS_API_ERROR }
|
|
24942
|
-
);
|
|
25052
|
+
const payload2 = await client2.monitors.reactivate(key, { dryRun: true });
|
|
24943
25053
|
assertMonitorDryRunAcknowledged(payload2, {
|
|
24944
25054
|
command: "deepline monitors reactivate",
|
|
24945
25055
|
mutation: "reactivate"
|
|
@@ -24950,10 +25060,7 @@ async function handleMonitorsReactivate(key, options) {
|
|
|
24950
25060
|
});
|
|
24951
25061
|
return;
|
|
24952
25062
|
}
|
|
24953
|
-
const payload = await
|
|
24954
|
-
`/api/v2/monitors/deployed/${encodeKey(key)}/reactivate`,
|
|
24955
|
-
{ method: "POST", body: {}, ...FORBIDDEN_AS_API_ERROR }
|
|
24956
|
-
);
|
|
25063
|
+
const payload = await client2.monitors.reactivate(key);
|
|
24957
25064
|
printCommandEnvelope(payload, { json: options.json });
|
|
24958
25065
|
}
|
|
24959
25066
|
function registerMonitorsCommands(program) {
|
|
@@ -25042,17 +25149,24 @@ Examples:
|
|
|
25042
25149
|
Notes:
|
|
25043
25150
|
Read-only. --status filters by monitor status: active (default), disabled, or
|
|
25044
25151
|
all. The output echoes the status filter that was applied. --compact returns
|
|
25045
|
-
high-signal fields only.
|
|
25152
|
+
high-signal fields only. The response reports total (the true registry count,
|
|
25153
|
+
not the page size), returned, is_truncated, and next_cursor. When is_truncated
|
|
25154
|
+
is true, page with --cursor <next_cursor> until it is false \u2014 a "no matching
|
|
25155
|
+
monitor" reuse conclusion off a truncated page deploys a duplicate paid feed.
|
|
25046
25156
|
|
|
25047
25157
|
Examples:
|
|
25048
25158
|
deepline monitors list
|
|
25049
25159
|
deepline monitors list --status all --json
|
|
25160
|
+
deepline monitors list --status all --cursor <next_cursor> --json
|
|
25050
25161
|
deepline monitors list --compact --json
|
|
25051
25162
|
`
|
|
25052
25163
|
).option(
|
|
25053
25164
|
"--status <status>",
|
|
25054
25165
|
"Filter by monitor status: active (default), disabled, or all"
|
|
25055
|
-
).option("--limit <n>", "Limit the number of deployed monitors returned").option(
|
|
25166
|
+
).option("--limit <n>", "Limit the number of deployed monitors returned").option(
|
|
25167
|
+
"--cursor <cursor>",
|
|
25168
|
+
"Page past a truncated result using the next_cursor from a prior list response"
|
|
25169
|
+
).option("--compact", COMPACT_OPTION_DESCRIPTION)
|
|
25056
25170
|
).action(monitorsAction(handleMonitorsList));
|
|
25057
25171
|
withJsonOption(
|
|
25058
25172
|
monitors.command("get <key>").description("Show a single deployed monitor by its public key.").addHelpText(
|
|
@@ -25173,7 +25287,10 @@ Examples:
|
|
|
25173
25287
|
monitors.command("deployed", { hidden: true }).description("Alias of `monitors list` (plus get/update/delete aliases).").option(
|
|
25174
25288
|
"--status <status>",
|
|
25175
25289
|
"Filter by monitor status: active (default), disabled, or all"
|
|
25176
|
-
).option("--limit <n>", "Limit the number of deployed monitors returned").option(
|
|
25290
|
+
).option("--limit <n>", "Limit the number of deployed monitors returned").option(
|
|
25291
|
+
"--cursor <cursor>",
|
|
25292
|
+
"Page past a truncated result using the next_cursor from a prior list response"
|
|
25293
|
+
).option("--compact", COMPACT_OPTION_DESCRIPTION)
|
|
25177
25294
|
).action(monitorsAction(handleMonitorsList));
|
|
25178
25295
|
withJsonOption(
|
|
25179
25296
|
deployed.command("get <key>").description("Alias of `monitors get <key>`.")
|