deepline 0.1.271 → 0.1.272
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/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/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/child-execution-strategy.ts +16 -2
- package/dist/cli/index.js +208 -91
- package/dist/cli/index.mjs +208 -91
- package/dist/index.d.mts +268 -1
- package/dist/index.d.ts +268 -1
- package/dist/index.js +178 -1
- package/dist/index.mjs +177 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -57,6 +57,7 @@ __export(src_exports, {
|
|
|
57
57
|
SDK_API_CONTRACT: () => SDK_API_CONTRACT,
|
|
58
58
|
SDK_VERSION: () => SDK_VERSION,
|
|
59
59
|
defineInput: () => defineInput,
|
|
60
|
+
defineMonitor: () => defineMonitor,
|
|
60
61
|
definePlay: () => definePlay,
|
|
61
62
|
defineWorkflow: () => defineWorkflow,
|
|
62
63
|
extractSummaryFields: () => extractSummaryFields,
|
|
@@ -437,7 +438,7 @@ var SDK_RELEASE = {
|
|
|
437
438
|
// 0.1.253 makes play-page browser opening opt-in and retires --no-open.
|
|
438
439
|
// 0.1.254 removes the internal operations tree from the published SDK CLI.
|
|
439
440
|
// Operators use the checkout-local deepline-admin binary instead.
|
|
440
|
-
version: "0.1.
|
|
441
|
+
version: "0.1.272",
|
|
441
442
|
contracts: {
|
|
442
443
|
api: {
|
|
443
444
|
name: "sdk-http-api",
|
|
@@ -2644,6 +2645,8 @@ var DeeplineClient = class {
|
|
|
2644
2645
|
db;
|
|
2645
2646
|
/** Billing namespace: subscription status/cancel and invoice history. */
|
|
2646
2647
|
billing;
|
|
2648
|
+
/** Monitors namespace: access, catalog, deploy/check, and lifecycle. */
|
|
2649
|
+
monitors;
|
|
2647
2650
|
/**
|
|
2648
2651
|
* Create a low-level SDK client.
|
|
2649
2652
|
*
|
|
@@ -2679,6 +2682,18 @@ var DeeplineClient = class {
|
|
|
2679
2682
|
list: (options2) => this.listBillingInvoices(options2)
|
|
2680
2683
|
}
|
|
2681
2684
|
};
|
|
2685
|
+
this.monitors = {
|
|
2686
|
+
status: () => this.getMonitorsAccess(),
|
|
2687
|
+
available: (toolIdOrOptions, options2) => this.getMonitorsAvailable(toolIdOrOptions, options2),
|
|
2688
|
+
check: (definition) => this.checkMonitor(definition),
|
|
2689
|
+
deploy: (definition, options2) => this.deployMonitor(definition, options2),
|
|
2690
|
+
list: (options2) => this.listMonitors(options2),
|
|
2691
|
+
get: (key) => this.getMonitor(key),
|
|
2692
|
+
dependents: (key) => this.getMonitorDependents(key),
|
|
2693
|
+
update: (key, patch) => this.updateMonitor(key, patch),
|
|
2694
|
+
delete: (key, options2) => this.deleteMonitor(key, options2),
|
|
2695
|
+
reactivate: (key, options2) => this.reactivateMonitor(key, options2)
|
|
2696
|
+
};
|
|
2682
2697
|
}
|
|
2683
2698
|
/** The resolved base URL this client is targeting (e.g. `"http://localhost:3000"`). */
|
|
2684
2699
|
get baseUrl() {
|
|
@@ -4541,6 +4556,136 @@ var DeeplineClient = class {
|
|
|
4541
4556
|
`/api/v2/billing/invoices${suffix}`
|
|
4542
4557
|
);
|
|
4543
4558
|
}
|
|
4559
|
+
// ——————————————————————————————————————————————————————————
|
|
4560
|
+
// Monitors
|
|
4561
|
+
// ——————————————————————————————————————————————————————————
|
|
4562
|
+
/**
|
|
4563
|
+
* Whether the current workspace can use Deepline Monitors. Reachable without
|
|
4564
|
+
* monitor access; a denial is a normal 200 body, not a 403. Prefer
|
|
4565
|
+
* `client.monitors.status()`.
|
|
4566
|
+
*/
|
|
4567
|
+
async getMonitorsAccess() {
|
|
4568
|
+
const payload = await this.http.request(
|
|
4569
|
+
"/api/v2/monitors/access",
|
|
4570
|
+
{ method: "GET" }
|
|
4571
|
+
);
|
|
4572
|
+
return {
|
|
4573
|
+
has_access: payload.has_access === true,
|
|
4574
|
+
...typeof payload.reason === "string" && payload.reason.trim() ? { reason: payload.reason.trim() } : {}
|
|
4575
|
+
};
|
|
4576
|
+
}
|
|
4577
|
+
/**
|
|
4578
|
+
* The deployable monitor tools catalog. Pass a tool id (positional or
|
|
4579
|
+
* `{ tool }`) to describe one tool's full payload/stream contract, or no tool
|
|
4580
|
+
* id for the compact inventory. Prefer `client.monitors.available(...)`.
|
|
4581
|
+
*/
|
|
4582
|
+
async getMonitorsAvailable(toolIdOrOptions, maybeOptions) {
|
|
4583
|
+
const positionalTool = typeof toolIdOrOptions === "string" ? toolIdOrOptions : void 0;
|
|
4584
|
+
const options = toolIdOrOptions && typeof toolIdOrOptions === "object" ? toolIdOrOptions : maybeOptions ?? {};
|
|
4585
|
+
const optionTool = toolIdOrOptions && typeof toolIdOrOptions === "object" ? toolIdOrOptions.tool : void 0;
|
|
4586
|
+
const tool = positionalTool ?? optionTool;
|
|
4587
|
+
const params = new URLSearchParams();
|
|
4588
|
+
if (options.provider) params.set("provider", options.provider);
|
|
4589
|
+
if (tool) params.set("tool", tool);
|
|
4590
|
+
if (options.search) params.set("search", options.search);
|
|
4591
|
+
if (options.limit !== void 0) params.set("limit", String(options.limit));
|
|
4592
|
+
const compactList = !tool && options.full !== true;
|
|
4593
|
+
if (compactList || options.compact) params.set("compact", "true");
|
|
4594
|
+
const query = params.toString();
|
|
4595
|
+
const suffix = query ? `?${query}` : "";
|
|
4596
|
+
return this.http.request(
|
|
4597
|
+
`/api/v2/monitors/tools${suffix}`,
|
|
4598
|
+
{ method: "GET", forbiddenAsApiError: true }
|
|
4599
|
+
);
|
|
4600
|
+
}
|
|
4601
|
+
/** Validate a monitor definition without deploying it. Prefer `client.monitors.check(...)`. */
|
|
4602
|
+
async checkMonitor(definition) {
|
|
4603
|
+
return this.http.request("/api/v2/monitors/check", {
|
|
4604
|
+
method: "POST",
|
|
4605
|
+
body: definition,
|
|
4606
|
+
forbiddenAsApiError: true
|
|
4607
|
+
});
|
|
4608
|
+
}
|
|
4609
|
+
/**
|
|
4610
|
+
* Deploy a monitor from a definition. `dryRun` validates via the check
|
|
4611
|
+
* endpoint and returns the plan without deploying. Prefer
|
|
4612
|
+
* `client.monitors.deploy(...)`.
|
|
4613
|
+
*/
|
|
4614
|
+
async deployMonitor(definition, options) {
|
|
4615
|
+
if (options?.dryRun) {
|
|
4616
|
+
return this.http.request("/api/v2/monitors/check", {
|
|
4617
|
+
method: "POST",
|
|
4618
|
+
body: definition,
|
|
4619
|
+
forbiddenAsApiError: true
|
|
4620
|
+
});
|
|
4621
|
+
}
|
|
4622
|
+
return this.http.request("/api/v2/monitors/deploy", {
|
|
4623
|
+
method: "POST",
|
|
4624
|
+
body: definition,
|
|
4625
|
+
forbiddenAsApiError: true
|
|
4626
|
+
});
|
|
4627
|
+
}
|
|
4628
|
+
/** List deployed monitors. Prefer `client.monitors.list(...)`. */
|
|
4629
|
+
async listMonitors(options) {
|
|
4630
|
+
const params = new URLSearchParams();
|
|
4631
|
+
if (options?.status) params.set("status", options.status);
|
|
4632
|
+
if (options?.limit !== void 0) params.set("limit", String(options.limit));
|
|
4633
|
+
if (options?.cursor) params.set("cursor", options.cursor);
|
|
4634
|
+
if (options?.compact) params.set("compact", "true");
|
|
4635
|
+
const query = params.toString();
|
|
4636
|
+
const suffix = query ? `?${query}` : "";
|
|
4637
|
+
return this.http.request(
|
|
4638
|
+
`/api/v2/monitors/deployed${suffix}`,
|
|
4639
|
+
{ method: "GET", forbiddenAsApiError: true }
|
|
4640
|
+
);
|
|
4641
|
+
}
|
|
4642
|
+
/** Fetch one deployed monitor by public key. Prefer `client.monitors.get(...)`. */
|
|
4643
|
+
async getMonitor(key) {
|
|
4644
|
+
return this.http.request(
|
|
4645
|
+
`/api/v2/monitors/deployed/${encodeURIComponent(key)}`,
|
|
4646
|
+
{ method: "GET", forbiddenAsApiError: true }
|
|
4647
|
+
);
|
|
4648
|
+
}
|
|
4649
|
+
/** Published plays depending on one monitor. Prefer `client.monitors.dependents(...)`. */
|
|
4650
|
+
async getMonitorDependents(key) {
|
|
4651
|
+
return this.http.request(
|
|
4652
|
+
`/api/v2/monitors/deployed/${encodeURIComponent(key)}/dependents`,
|
|
4653
|
+
{ method: "GET", forbiddenAsApiError: true }
|
|
4654
|
+
);
|
|
4655
|
+
}
|
|
4656
|
+
/** Update a deployed monitor by public key. Prefer `client.monitors.update(...)`. */
|
|
4657
|
+
async updateMonitor(key, patch) {
|
|
4658
|
+
return this.http.request(
|
|
4659
|
+
`/api/v2/monitors/deployed/${encodeURIComponent(key)}`,
|
|
4660
|
+
{ method: "PATCH", body: patch, forbiddenAsApiError: true }
|
|
4661
|
+
);
|
|
4662
|
+
}
|
|
4663
|
+
/**
|
|
4664
|
+
* Delete a deployed monitor by public key. Deprovisions the upstream provider
|
|
4665
|
+
* resource unless `localOnly`; `dryRun` returns the delete plan. Prefer
|
|
4666
|
+
* `client.monitors.delete(...)`.
|
|
4667
|
+
*/
|
|
4668
|
+
async deleteMonitor(key, options) {
|
|
4669
|
+
const params = new URLSearchParams();
|
|
4670
|
+
if (options?.localOnly) params.set("local_only", "true");
|
|
4671
|
+
if (options?.dryRun) params.set("dry_run", "true");
|
|
4672
|
+
const query = params.toString();
|
|
4673
|
+
return this.http.request(
|
|
4674
|
+
`/api/v2/monitors/deployed/${encodeURIComponent(key)}${query ? `?${query}` : ""}`,
|
|
4675
|
+
{ method: "DELETE", forbiddenAsApiError: true }
|
|
4676
|
+
);
|
|
4677
|
+
}
|
|
4678
|
+
/**
|
|
4679
|
+
* Reactivate a disabled monitor. `dryRun` returns the reactivation cost.
|
|
4680
|
+
* Prefer `client.monitors.reactivate(...)`.
|
|
4681
|
+
*/
|
|
4682
|
+
async reactivateMonitor(key, options) {
|
|
4683
|
+
const query = options?.dryRun ? "?dry_run=true" : "";
|
|
4684
|
+
return this.http.request(
|
|
4685
|
+
`/api/v2/monitors/deployed/${encodeURIComponent(key)}/reactivate${query}`,
|
|
4686
|
+
{ method: "POST", body: {}, forbiddenAsApiError: true }
|
|
4687
|
+
);
|
|
4688
|
+
}
|
|
4544
4689
|
/**
|
|
4545
4690
|
* Check API connectivity and server health.
|
|
4546
4691
|
*
|
|
@@ -4560,6 +4705,37 @@ var DeeplineClient = class {
|
|
|
4560
4705
|
}
|
|
4561
4706
|
};
|
|
4562
4707
|
|
|
4708
|
+
// src/monitors.ts
|
|
4709
|
+
function defineMonitor(definition) {
|
|
4710
|
+
if (!definition || typeof definition !== "object") {
|
|
4711
|
+
throw new Error("defineMonitor(definition) requires a definition object.");
|
|
4712
|
+
}
|
|
4713
|
+
const key = typeof definition.key === "string" ? definition.key.trim() : "";
|
|
4714
|
+
if (!key) {
|
|
4715
|
+
throw new Error('defineMonitor(definition) requires a non-empty "key".');
|
|
4716
|
+
}
|
|
4717
|
+
const tool = typeof definition.tool === "string" ? definition.tool.trim() : "";
|
|
4718
|
+
if (!tool) {
|
|
4719
|
+
throw new Error(
|
|
4720
|
+
'defineMonitor(definition) requires a non-empty monitor tool id in "tool" (e.g. "deepline_native.company_radar").'
|
|
4721
|
+
);
|
|
4722
|
+
}
|
|
4723
|
+
if (!definition.payload || typeof definition.payload !== "object" || Array.isArray(definition.payload)) {
|
|
4724
|
+
throw new Error(
|
|
4725
|
+
'defineMonitor(definition) requires "payload" to be a JSON object.'
|
|
4726
|
+
);
|
|
4727
|
+
}
|
|
4728
|
+
if (definition.name !== void 0 && typeof definition.name !== "string") {
|
|
4729
|
+
throw new Error('defineMonitor(definition) "name" must be a string.');
|
|
4730
|
+
}
|
|
4731
|
+
if (definition.controls !== void 0 && (typeof definition.controls !== "object" || Array.isArray(definition.controls))) {
|
|
4732
|
+
throw new Error(
|
|
4733
|
+
'defineMonitor(definition) "controls" must be a JSON object.'
|
|
4734
|
+
);
|
|
4735
|
+
}
|
|
4736
|
+
return definition;
|
|
4737
|
+
}
|
|
4738
|
+
|
|
4563
4739
|
// ../shared_libs/plays/bootstrap-routes.ts
|
|
4564
4740
|
var DEEPLINE_TOOL_CATEGORIES = [
|
|
4565
4741
|
"company_search",
|
|
@@ -6792,6 +6968,7 @@ function extractSummaryFields(payload) {
|
|
|
6792
6968
|
SDK_API_CONTRACT,
|
|
6793
6969
|
SDK_VERSION,
|
|
6794
6970
|
defineInput,
|
|
6971
|
+
defineMonitor,
|
|
6795
6972
|
definePlay,
|
|
6796
6973
|
defineWorkflow,
|
|
6797
6974
|
extractSummaryFields,
|
package/dist/index.mjs
CHANGED
|
@@ -367,7 +367,7 @@ var SDK_RELEASE = {
|
|
|
367
367
|
// 0.1.253 makes play-page browser opening opt-in and retires --no-open.
|
|
368
368
|
// 0.1.254 removes the internal operations tree from the published SDK CLI.
|
|
369
369
|
// Operators use the checkout-local deepline-admin binary instead.
|
|
370
|
-
version: "0.1.
|
|
370
|
+
version: "0.1.272",
|
|
371
371
|
contracts: {
|
|
372
372
|
api: {
|
|
373
373
|
name: "sdk-http-api",
|
|
@@ -2574,6 +2574,8 @@ var DeeplineClient = class {
|
|
|
2574
2574
|
db;
|
|
2575
2575
|
/** Billing namespace: subscription status/cancel and invoice history. */
|
|
2576
2576
|
billing;
|
|
2577
|
+
/** Monitors namespace: access, catalog, deploy/check, and lifecycle. */
|
|
2578
|
+
monitors;
|
|
2577
2579
|
/**
|
|
2578
2580
|
* Create a low-level SDK client.
|
|
2579
2581
|
*
|
|
@@ -2609,6 +2611,18 @@ var DeeplineClient = class {
|
|
|
2609
2611
|
list: (options2) => this.listBillingInvoices(options2)
|
|
2610
2612
|
}
|
|
2611
2613
|
};
|
|
2614
|
+
this.monitors = {
|
|
2615
|
+
status: () => this.getMonitorsAccess(),
|
|
2616
|
+
available: (toolIdOrOptions, options2) => this.getMonitorsAvailable(toolIdOrOptions, options2),
|
|
2617
|
+
check: (definition) => this.checkMonitor(definition),
|
|
2618
|
+
deploy: (definition, options2) => this.deployMonitor(definition, options2),
|
|
2619
|
+
list: (options2) => this.listMonitors(options2),
|
|
2620
|
+
get: (key) => this.getMonitor(key),
|
|
2621
|
+
dependents: (key) => this.getMonitorDependents(key),
|
|
2622
|
+
update: (key, patch) => this.updateMonitor(key, patch),
|
|
2623
|
+
delete: (key, options2) => this.deleteMonitor(key, options2),
|
|
2624
|
+
reactivate: (key, options2) => this.reactivateMonitor(key, options2)
|
|
2625
|
+
};
|
|
2612
2626
|
}
|
|
2613
2627
|
/** The resolved base URL this client is targeting (e.g. `"http://localhost:3000"`). */
|
|
2614
2628
|
get baseUrl() {
|
|
@@ -4471,6 +4485,136 @@ var DeeplineClient = class {
|
|
|
4471
4485
|
`/api/v2/billing/invoices${suffix}`
|
|
4472
4486
|
);
|
|
4473
4487
|
}
|
|
4488
|
+
// ——————————————————————————————————————————————————————————
|
|
4489
|
+
// Monitors
|
|
4490
|
+
// ——————————————————————————————————————————————————————————
|
|
4491
|
+
/**
|
|
4492
|
+
* Whether the current workspace can use Deepline Monitors. Reachable without
|
|
4493
|
+
* monitor access; a denial is a normal 200 body, not a 403. Prefer
|
|
4494
|
+
* `client.monitors.status()`.
|
|
4495
|
+
*/
|
|
4496
|
+
async getMonitorsAccess() {
|
|
4497
|
+
const payload = await this.http.request(
|
|
4498
|
+
"/api/v2/monitors/access",
|
|
4499
|
+
{ method: "GET" }
|
|
4500
|
+
);
|
|
4501
|
+
return {
|
|
4502
|
+
has_access: payload.has_access === true,
|
|
4503
|
+
...typeof payload.reason === "string" && payload.reason.trim() ? { reason: payload.reason.trim() } : {}
|
|
4504
|
+
};
|
|
4505
|
+
}
|
|
4506
|
+
/**
|
|
4507
|
+
* The deployable monitor tools catalog. Pass a tool id (positional or
|
|
4508
|
+
* `{ tool }`) to describe one tool's full payload/stream contract, or no tool
|
|
4509
|
+
* id for the compact inventory. Prefer `client.monitors.available(...)`.
|
|
4510
|
+
*/
|
|
4511
|
+
async getMonitorsAvailable(toolIdOrOptions, maybeOptions) {
|
|
4512
|
+
const positionalTool = typeof toolIdOrOptions === "string" ? toolIdOrOptions : void 0;
|
|
4513
|
+
const options = toolIdOrOptions && typeof toolIdOrOptions === "object" ? toolIdOrOptions : maybeOptions ?? {};
|
|
4514
|
+
const optionTool = toolIdOrOptions && typeof toolIdOrOptions === "object" ? toolIdOrOptions.tool : void 0;
|
|
4515
|
+
const tool = positionalTool ?? optionTool;
|
|
4516
|
+
const params = new URLSearchParams();
|
|
4517
|
+
if (options.provider) params.set("provider", options.provider);
|
|
4518
|
+
if (tool) params.set("tool", tool);
|
|
4519
|
+
if (options.search) params.set("search", options.search);
|
|
4520
|
+
if (options.limit !== void 0) params.set("limit", String(options.limit));
|
|
4521
|
+
const compactList = !tool && options.full !== true;
|
|
4522
|
+
if (compactList || options.compact) params.set("compact", "true");
|
|
4523
|
+
const query = params.toString();
|
|
4524
|
+
const suffix = query ? `?${query}` : "";
|
|
4525
|
+
return this.http.request(
|
|
4526
|
+
`/api/v2/monitors/tools${suffix}`,
|
|
4527
|
+
{ method: "GET", forbiddenAsApiError: true }
|
|
4528
|
+
);
|
|
4529
|
+
}
|
|
4530
|
+
/** Validate a monitor definition without deploying it. Prefer `client.monitors.check(...)`. */
|
|
4531
|
+
async checkMonitor(definition) {
|
|
4532
|
+
return this.http.request("/api/v2/monitors/check", {
|
|
4533
|
+
method: "POST",
|
|
4534
|
+
body: definition,
|
|
4535
|
+
forbiddenAsApiError: true
|
|
4536
|
+
});
|
|
4537
|
+
}
|
|
4538
|
+
/**
|
|
4539
|
+
* Deploy a monitor from a definition. `dryRun` validates via the check
|
|
4540
|
+
* endpoint and returns the plan without deploying. Prefer
|
|
4541
|
+
* `client.monitors.deploy(...)`.
|
|
4542
|
+
*/
|
|
4543
|
+
async deployMonitor(definition, options) {
|
|
4544
|
+
if (options?.dryRun) {
|
|
4545
|
+
return this.http.request("/api/v2/monitors/check", {
|
|
4546
|
+
method: "POST",
|
|
4547
|
+
body: definition,
|
|
4548
|
+
forbiddenAsApiError: true
|
|
4549
|
+
});
|
|
4550
|
+
}
|
|
4551
|
+
return this.http.request("/api/v2/monitors/deploy", {
|
|
4552
|
+
method: "POST",
|
|
4553
|
+
body: definition,
|
|
4554
|
+
forbiddenAsApiError: true
|
|
4555
|
+
});
|
|
4556
|
+
}
|
|
4557
|
+
/** List deployed monitors. Prefer `client.monitors.list(...)`. */
|
|
4558
|
+
async listMonitors(options) {
|
|
4559
|
+
const params = new URLSearchParams();
|
|
4560
|
+
if (options?.status) params.set("status", options.status);
|
|
4561
|
+
if (options?.limit !== void 0) params.set("limit", String(options.limit));
|
|
4562
|
+
if (options?.cursor) params.set("cursor", options.cursor);
|
|
4563
|
+
if (options?.compact) params.set("compact", "true");
|
|
4564
|
+
const query = params.toString();
|
|
4565
|
+
const suffix = query ? `?${query}` : "";
|
|
4566
|
+
return this.http.request(
|
|
4567
|
+
`/api/v2/monitors/deployed${suffix}`,
|
|
4568
|
+
{ method: "GET", forbiddenAsApiError: true }
|
|
4569
|
+
);
|
|
4570
|
+
}
|
|
4571
|
+
/** Fetch one deployed monitor by public key. Prefer `client.monitors.get(...)`. */
|
|
4572
|
+
async getMonitor(key) {
|
|
4573
|
+
return this.http.request(
|
|
4574
|
+
`/api/v2/monitors/deployed/${encodeURIComponent(key)}`,
|
|
4575
|
+
{ method: "GET", forbiddenAsApiError: true }
|
|
4576
|
+
);
|
|
4577
|
+
}
|
|
4578
|
+
/** Published plays depending on one monitor. Prefer `client.monitors.dependents(...)`. */
|
|
4579
|
+
async getMonitorDependents(key) {
|
|
4580
|
+
return this.http.request(
|
|
4581
|
+
`/api/v2/monitors/deployed/${encodeURIComponent(key)}/dependents`,
|
|
4582
|
+
{ method: "GET", forbiddenAsApiError: true }
|
|
4583
|
+
);
|
|
4584
|
+
}
|
|
4585
|
+
/** Update a deployed monitor by public key. Prefer `client.monitors.update(...)`. */
|
|
4586
|
+
async updateMonitor(key, patch) {
|
|
4587
|
+
return this.http.request(
|
|
4588
|
+
`/api/v2/monitors/deployed/${encodeURIComponent(key)}`,
|
|
4589
|
+
{ method: "PATCH", body: patch, forbiddenAsApiError: true }
|
|
4590
|
+
);
|
|
4591
|
+
}
|
|
4592
|
+
/**
|
|
4593
|
+
* Delete a deployed monitor by public key. Deprovisions the upstream provider
|
|
4594
|
+
* resource unless `localOnly`; `dryRun` returns the delete plan. Prefer
|
|
4595
|
+
* `client.monitors.delete(...)`.
|
|
4596
|
+
*/
|
|
4597
|
+
async deleteMonitor(key, options) {
|
|
4598
|
+
const params = new URLSearchParams();
|
|
4599
|
+
if (options?.localOnly) params.set("local_only", "true");
|
|
4600
|
+
if (options?.dryRun) params.set("dry_run", "true");
|
|
4601
|
+
const query = params.toString();
|
|
4602
|
+
return this.http.request(
|
|
4603
|
+
`/api/v2/monitors/deployed/${encodeURIComponent(key)}${query ? `?${query}` : ""}`,
|
|
4604
|
+
{ method: "DELETE", forbiddenAsApiError: true }
|
|
4605
|
+
);
|
|
4606
|
+
}
|
|
4607
|
+
/**
|
|
4608
|
+
* Reactivate a disabled monitor. `dryRun` returns the reactivation cost.
|
|
4609
|
+
* Prefer `client.monitors.reactivate(...)`.
|
|
4610
|
+
*/
|
|
4611
|
+
async reactivateMonitor(key, options) {
|
|
4612
|
+
const query = options?.dryRun ? "?dry_run=true" : "";
|
|
4613
|
+
return this.http.request(
|
|
4614
|
+
`/api/v2/monitors/deployed/${encodeURIComponent(key)}/reactivate${query}`,
|
|
4615
|
+
{ method: "POST", body: {}, forbiddenAsApiError: true }
|
|
4616
|
+
);
|
|
4617
|
+
}
|
|
4474
4618
|
/**
|
|
4475
4619
|
* Check API connectivity and server health.
|
|
4476
4620
|
*
|
|
@@ -4490,6 +4634,37 @@ var DeeplineClient = class {
|
|
|
4490
4634
|
}
|
|
4491
4635
|
};
|
|
4492
4636
|
|
|
4637
|
+
// src/monitors.ts
|
|
4638
|
+
function defineMonitor(definition) {
|
|
4639
|
+
if (!definition || typeof definition !== "object") {
|
|
4640
|
+
throw new Error("defineMonitor(definition) requires a definition object.");
|
|
4641
|
+
}
|
|
4642
|
+
const key = typeof definition.key === "string" ? definition.key.trim() : "";
|
|
4643
|
+
if (!key) {
|
|
4644
|
+
throw new Error('defineMonitor(definition) requires a non-empty "key".');
|
|
4645
|
+
}
|
|
4646
|
+
const tool = typeof definition.tool === "string" ? definition.tool.trim() : "";
|
|
4647
|
+
if (!tool) {
|
|
4648
|
+
throw new Error(
|
|
4649
|
+
'defineMonitor(definition) requires a non-empty monitor tool id in "tool" (e.g. "deepline_native.company_radar").'
|
|
4650
|
+
);
|
|
4651
|
+
}
|
|
4652
|
+
if (!definition.payload || typeof definition.payload !== "object" || Array.isArray(definition.payload)) {
|
|
4653
|
+
throw new Error(
|
|
4654
|
+
'defineMonitor(definition) requires "payload" to be a JSON object.'
|
|
4655
|
+
);
|
|
4656
|
+
}
|
|
4657
|
+
if (definition.name !== void 0 && typeof definition.name !== "string") {
|
|
4658
|
+
throw new Error('defineMonitor(definition) "name" must be a string.');
|
|
4659
|
+
}
|
|
4660
|
+
if (definition.controls !== void 0 && (typeof definition.controls !== "object" || Array.isArray(definition.controls))) {
|
|
4661
|
+
throw new Error(
|
|
4662
|
+
'defineMonitor(definition) "controls" must be a JSON object.'
|
|
4663
|
+
);
|
|
4664
|
+
}
|
|
4665
|
+
return definition;
|
|
4666
|
+
}
|
|
4667
|
+
|
|
4493
4668
|
// ../shared_libs/plays/bootstrap-routes.ts
|
|
4494
4669
|
var DEEPLINE_TOOL_CATEGORIES = [
|
|
4495
4670
|
"company_search",
|
|
@@ -6727,6 +6902,7 @@ export {
|
|
|
6727
6902
|
SDK_API_CONTRACT,
|
|
6728
6903
|
SDK_VERSION,
|
|
6729
6904
|
defineInput,
|
|
6905
|
+
defineMonitor,
|
|
6730
6906
|
definePlay,
|
|
6731
6907
|
defineWorkflow,
|
|
6732
6908
|
extractSummaryFields,
|