@epilot/cli 0.1.58 → 0.1.59

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 CHANGED
@@ -29,7 +29,7 @@ npm install -g @epilot/cli
29
29
 
30
30
  <!-- usage-help -->
31
31
  ```
32
- epilot v0.1.58 — CLI for epilot APIs
32
+ epilot v0.1.59 — CLI for epilot APIs
33
33
 
34
34
  USAGE
35
35
  epilot <api> <operationId> [params...] [flags]
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.0.3",
3
3
  "info": {
4
4
  "title": "Integration Toolkit API",
5
- "version": "1.5.1",
5
+ "version": "1.5.3",
6
6
  "description": "API for integrating with external systems in a standardised way."
7
7
  },
8
8
  "tags": [
@@ -1997,6 +1997,72 @@
1997
1997
  }
1998
1998
  }
1999
1999
  },
2000
+ "/v2/integrations/{integrationId}/notifications/status": {
2001
+ "get": {
2002
+ "operationId": "getNotificationStatus",
2003
+ "summary": "getNotificationStatus",
2004
+ "description": "Returns the live per-rule alert state and (for 'auto' rules) the current\nhour-of-week baseline band for an integration's notification monitoring.\nReflects the latest 5-minute sweep — near-real-time, not live.\nRequires the `integration:view` permission on the integration's organization.\n",
2005
+ "tags": [
2006
+ "integrations"
2007
+ ],
2008
+ "security": [
2009
+ {
2010
+ "EpilotAuth": []
2011
+ }
2012
+ ],
2013
+ "parameters": [
2014
+ {
2015
+ "name": "integrationId",
2016
+ "in": "path",
2017
+ "required": true,
2018
+ "description": "The integration ID",
2019
+ "schema": {
2020
+ "type": "string",
2021
+ "format": "uuid"
2022
+ }
2023
+ },
2024
+ {
2025
+ "name": "include",
2026
+ "in": "query",
2027
+ "required": false,
2028
+ "description": "Add `baseline_series` to also return all 168 hour-of-week buckets per\n'auto' rule (heavier; omit for just the current-bucket markers).\n",
2029
+ "schema": {
2030
+ "type": "string",
2031
+ "enum": [
2032
+ "baseline_series"
2033
+ ]
2034
+ }
2035
+ }
2036
+ ],
2037
+ "responses": {
2038
+ "200": {
2039
+ "description": "Live notification status",
2040
+ "content": {
2041
+ "application/json": {
2042
+ "schema": {
2043
+ "$ref": "#/components/schemas/NotificationStatusResponse"
2044
+ }
2045
+ }
2046
+ }
2047
+ },
2048
+ "400": {
2049
+ "$ref": "#/components/responses/BadRequest"
2050
+ },
2051
+ "401": {
2052
+ "$ref": "#/components/responses/Unauthorized"
2053
+ },
2054
+ "403": {
2055
+ "$ref": "#/components/responses/Forbidden"
2056
+ },
2057
+ "404": {
2058
+ "$ref": "#/components/responses/NotFound"
2059
+ },
2060
+ "500": {
2061
+ "$ref": "#/components/responses/InternalServerError"
2062
+ }
2063
+ }
2064
+ }
2065
+ },
2000
2066
  "/v2/integrations/{integrationId}/use-cases/{useCaseId}/secure-proxy-whitelist": {
2001
2067
  "get": {
2002
2068
  "operationId": "getSecureProxyWhitelist",
@@ -3720,6 +3786,150 @@
3720
3786
  }
3721
3787
  }
3722
3788
  },
3789
+ "NotificationStatusResponse": {
3790
+ "type": "object",
3791
+ "required": [
3792
+ "health",
3793
+ "rules"
3794
+ ],
3795
+ "properties": {
3796
+ "health": {
3797
+ "type": "string",
3798
+ "enum": [
3799
+ "healthy",
3800
+ "alerting",
3801
+ "muted"
3802
+ ],
3803
+ "description": "Rolled-up live status: `muted` when muteUntil is in the future; else `alerting` if any rule is currently ALERTING; else `healthy`.\n"
3804
+ },
3805
+ "evaluated_at": {
3806
+ "type": "string",
3807
+ "format": "date-time",
3808
+ "nullable": true,
3809
+ "description": "Most recent per-rule evaluation instant (max lastEvaluatedAt), or null when no rule has been evaluated. Updates on the 5-minute sweep tick.\n"
3810
+ },
3811
+ "rules": {
3812
+ "type": "array",
3813
+ "description": "Per-rule status, one entry per configured rule.",
3814
+ "items": {
3815
+ "$ref": "#/components/schemas/NotificationRuleStatus"
3816
+ }
3817
+ }
3818
+ }
3819
+ },
3820
+ "NotificationRuleStatus": {
3821
+ "type": "object",
3822
+ "required": [
3823
+ "rule_id",
3824
+ "state"
3825
+ ],
3826
+ "properties": {
3827
+ "rule_id": {
3828
+ "type": "string",
3829
+ "description": "The rule's stable id (matches the configured rule id)."
3830
+ },
3831
+ "state": {
3832
+ "type": "string",
3833
+ "enum": [
3834
+ "ok",
3835
+ "alerting",
3836
+ "recovered"
3837
+ ],
3838
+ "description": "The rule's live AlertState (defaults to `ok` when never evaluated)."
3839
+ },
3840
+ "last_fired_at": {
3841
+ "type": "string",
3842
+ "format": "date-time",
3843
+ "nullable": true,
3844
+ "description": "ISO instant the rule last entered ALERTING."
3845
+ },
3846
+ "last_cleared_at": {
3847
+ "type": "string",
3848
+ "format": "date-time",
3849
+ "nullable": true,
3850
+ "description": "ISO instant the rule last cleared back to OK."
3851
+ },
3852
+ "baseline": {
3853
+ "nullable": true,
3854
+ "description": "Present only for enabled 'auto'-threshold rules; null otherwise.",
3855
+ "allOf": [
3856
+ {
3857
+ "$ref": "#/components/schemas/RuleBaselineStatus"
3858
+ }
3859
+ ]
3860
+ }
3861
+ }
3862
+ },
3863
+ "RuleBaselineStatus": {
3864
+ "type": "object",
3865
+ "required": [
3866
+ "is_mature"
3867
+ ],
3868
+ "properties": {
3869
+ "is_mature": {
3870
+ "type": "boolean",
3871
+ "description": "False during cold start; the sweeper uses the static fallbackThreshold until the baseline's history span is mature.\n"
3872
+ },
3873
+ "computed_at": {
3874
+ "type": "string",
3875
+ "format": "date-time",
3876
+ "nullable": true,
3877
+ "description": "ISO instant the baseline was last computed."
3878
+ },
3879
+ "median": {
3880
+ "type": "number",
3881
+ "nullable": true,
3882
+ "description": "Typical in-scope event volume for the current hour-of-week bucket."
3883
+ },
3884
+ "mad": {
3885
+ "type": "number",
3886
+ "nullable": true,
3887
+ "description": "Median absolute deviation for the current hour-of-week bucket."
3888
+ },
3889
+ "upper": {
3890
+ "type": "number",
3891
+ "nullable": true,
3892
+ "description": "Dynamic alert threshold (median + k·MAD, k by sensitivity) for the current hour-of-week, or null when the bucket is uncovered.\n"
3893
+ },
3894
+ "buckets": {
3895
+ "type": "array",
3896
+ "nullable": true,
3897
+ "description": "Full 168-bucket series; only present when ?include=baseline_series.",
3898
+ "items": {
3899
+ "$ref": "#/components/schemas/RuleBaselineBucket"
3900
+ }
3901
+ }
3902
+ }
3903
+ },
3904
+ "RuleBaselineBucket": {
3905
+ "type": "object",
3906
+ "required": [
3907
+ "dow",
3908
+ "hour",
3909
+ "median",
3910
+ "mad"
3911
+ ],
3912
+ "properties": {
3913
+ "dow": {
3914
+ "type": "integer",
3915
+ "minimum": 1,
3916
+ "maximum": 7,
3917
+ "description": "Day of week, 1=Monday … 7=Sunday."
3918
+ },
3919
+ "hour": {
3920
+ "type": "integer",
3921
+ "minimum": 0,
3922
+ "maximum": 23,
3923
+ "description": "Hour of day, 0 … 23 (UTC)."
3924
+ },
3925
+ "median": {
3926
+ "type": "number"
3927
+ },
3928
+ "mad": {
3929
+ "type": "number"
3930
+ }
3931
+ }
3932
+ },
3723
3933
  "ErrorResponseBase": {
3724
3934
  "type": "object",
3725
3935
  "properties": {
@@ -4399,7 +4609,8 @@
4399
4609
  "muteUntil": {
4400
4610
  "type": "string",
4401
4611
  "format": "date-time",
4402
- "description": "ISO instant; snooze all non-digest alerts until this time."
4612
+ "nullable": true,
4613
+ "description": "ISO instant; snooze all non-digest alerts until this time. `null` means not muted."
4403
4614
  }
4404
4615
  }
4405
4616
  },
@@ -21,7 +21,7 @@ var auth_default = defineCommand({
21
21
  description: "Manage authentication"
22
22
  },
23
23
  subCommands: {
24
- login: () => import("./auth-login-NHWG3STD.js").then((m) => m.default),
24
+ login: () => import("./auth-login-7EWYCAZ7.js").then((m) => m.default),
25
25
  token: () => import("./auth-token-APXLIQAO.js").then((m) => m.default),
26
26
  logout: defineCommand({
27
27
  meta: { name: "logout", description: "Remove stored credentials" },
@@ -60,6 +60,7 @@ var auth_default = defineCommand({
60
60
  const adminEmail = claims?.admin_email;
61
61
  const tokenUse = claims?.token_use;
62
62
  const roles = claims?.assume_roles;
63
+ const readOnly = claims?.read_only === true;
63
64
  if (name) process.stdout.write(` Name: ${name}
64
65
  `);
65
66
  if (adminEmail && adminEmail !== name) process.stdout.write(` Email: ${adminEmail}
@@ -73,6 +74,8 @@ var auth_default = defineCommand({
73
74
  if (tokenUse) process.stdout.write(` Use: ${tokenUse}
74
75
  `);
75
76
  if (roles?.length) process.stdout.write(` Roles: ${roles.join(", ")}
77
+ `);
78
+ process.stdout.write(` Access: ${readOnly ? `${YELLOW}read-only${RESET}` : `${GREEN}read-write${RESET}`}
76
79
  `);
77
80
  if (creds.expires_at) {
78
81
  const expiry = new Date(creds.expires_at);
@@ -39,12 +39,14 @@ var auth_login_default = defineCommand({
39
39
  args: {
40
40
  token: { type: "string", description: "Manually provide a token instead of browser login" },
41
41
  profile: { type: "string", description: "Save credentials to this profile" },
42
+ readonly: { type: "boolean", description: "Generate a read-only token (cannot perform write actions)" },
42
43
  "use-dev": { type: "boolean", description: "Use dev environment (portal.dev.epilot.cloud)" },
43
44
  "use-staging": { type: "boolean", description: "Use staging environment (portal.staging.epilot.cloud)" }
44
45
  },
45
46
  run: async ({ args }) => {
46
47
  const profileName = args.profile || process.env.EPILOT_PROFILE;
47
48
  const env = resolveEnvironment(args["use-dev"], args["use-staging"]);
49
+ const readonly = Boolean(args.readonly);
48
50
  if (args.token) {
49
51
  saveCredentials({ token: args.token }, profileName);
50
52
  const suffix = profileName ? ` to profile "${profileName}"` : "";
@@ -61,7 +63,7 @@ var auth_login_default = defineCommand({
61
63
  );
62
64
  process.exit(1);
63
65
  }
64
- const token = await browserLogin(profileName, env);
66
+ const token = await browserLogin(profileName, env, readonly);
65
67
  if (token) {
66
68
  process.stdout.write(`${GREEN}${BOLD}Login successful!${RESET}
67
69
  `);
@@ -72,7 +74,7 @@ var auth_login_default = defineCommand({
72
74
  }
73
75
  }
74
76
  });
75
- var browserLogin = async (profileName, env = "production") => {
77
+ var browserLogin = async (profileName, env = "production", readonly = false) => {
76
78
  const state = randomBytes(32).toString("hex");
77
79
  const verificationCode = randomBytes(3).toString("hex").toUpperCase();
78
80
  const suffix = profileName ? ` ${DIM}(profile: ${profileName})${RESET}` : "";
@@ -81,6 +83,12 @@ ${BOLD}epilot CLI Login${RESET}${suffix}
81
83
 
82
84
  `);
83
85
  process.stdout.write("This will open your browser to authenticate with epilot.\n");
86
+ if (readonly) {
87
+ process.stdout.write(
88
+ `${YELLOW}Read-only mode: the CLI session will not be able to perform write actions.${RESET}
89
+ `
90
+ );
91
+ }
84
92
  process.stdout.write("\n");
85
93
  process.stdout.write(` ${YELLOW}Verification code: ${BOLD}${verificationCode}${RESET}
86
94
  `);
@@ -117,7 +125,7 @@ ${BOLD}epilot CLI Login${RESET}${suffix}
117
125
  const port = address.port;
118
126
  const callbackUrl = `http://localhost:${port}/callback`;
119
127
  const portalUrl = getPortalUrl(env);
120
- const loginUrl = `${portalUrl}/login?cli_callback=${encodeURIComponent(callbackUrl)}&state=${state}&code=${verificationCode}`;
128
+ const loginUrl = `${portalUrl}/login?cli_callback=${encodeURIComponent(callbackUrl)}&state=${state}&code=${verificationCode}` + (readonly ? `&readonly=true` : "");
121
129
  process.stdout.write(`
122
130
  ${DIM}Login URL: ${loginUrl}${RESET}
123
131
 
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  API_LIST
4
- } from "../chunk-XSH56QUG.js";
4
+ } from "../chunk-TDSY46F2.js";
5
5
 
6
6
  // bin/epilot.ts
7
7
  import { runMain } from "citty";
@@ -11,7 +11,7 @@ import { defineCommand } from "citty";
11
11
  var main = defineCommand({
12
12
  meta: {
13
13
  name: "epilot",
14
- version: "0.1.58",
14
+ version: "0.1.59",
15
15
  description: "CLI for epilot APIs"
16
16
  },
17
17
  args: {
@@ -27,11 +27,11 @@ var main = defineCommand({
27
27
  jsonata: { type: "string", description: "JSONata expression" }
28
28
  },
29
29
  subCommands: {
30
- auth: () => import("../auth-CN5EFFDE.js").then((m) => m.default),
30
+ auth: () => import("../auth-4HG7B2GC.js").then((m) => m.default),
31
31
  profile: () => import("../profile-OZJL5ZPT.js").then((m) => m.default),
32
32
  config: () => import("../config-DGZIMLZK.js").then((m) => m.default),
33
- completion: () => import("../completion-WEFTQNAT.js").then((m) => m.default),
34
- upgrade: () => import("../upgrade-TKHFV6J7.js").then((m) => m.default),
33
+ completion: () => import("../completion-DHCNR5MW.js").then((m) => m.default),
34
+ upgrade: () => import("../upgrade-ROKJNTFP.js").then((m) => m.default),
35
35
  "access-token": () => import("../access-token-WWE6BDJH.js").then((m) => m.default),
36
36
  address: () => import("../address-EH3C4CVB.js").then((m) => m.default),
37
37
  "address-suggestions": () => import("../address-suggestions-RRSLOBFW.js").then((m) => m.default),
@@ -134,13 +134,13 @@ process.stderr.on("error", (err) => {
134
134
  if (err.code === "EPIPE") process.exit(0);
135
135
  throw err;
136
136
  });
137
- var VERSION = true ? "0.1.58" : (await null).default.version;
137
+ var VERSION = true ? "0.1.59" : (await null).default.version;
138
138
  var reorderedArgv = hoistFlagsAfterSubcommand(process.argv.slice(2));
139
139
  process.argv = [process.argv[0], process.argv[1], ...reorderedArgv];
140
140
  var args = process.argv.slice(2);
141
141
  var completionsIdx = args.indexOf("--_completions");
142
142
  if (completionsIdx >= 0) {
143
- const { handleCompletions } = await import("../completion-WEFTQNAT.js");
143
+ const { handleCompletions } = await import("../completion-DHCNR5MW.js");
144
144
  handleCompletions(args[completionsIdx + 1], args[completionsIdx + 2]);
145
145
  process.exit(0);
146
146
  }
@@ -760,7 +760,7 @@ var API_LIST = [
760
760
  kebabName: "integration-toolkit",
761
761
  title: "Integration Toolkit API",
762
762
  serverUrl: "https://integration-toolkit.sls.epilot.io",
763
- operationCount: 53,
763
+ operationCount: 54,
764
764
  operationIds: [
765
765
  "acknowledgeTracking",
766
766
  "triggerErp",
@@ -789,6 +789,7 @@ var API_LIST = [
789
789
  "deleteIntegrationV2",
790
790
  "listNotificationHistory",
791
791
  "testSendNotification",
792
+ "getNotificationStatus",
792
793
  "getSecureProxyWhitelist",
793
794
  "updateSecureProxyWhitelist",
794
795
  "listSecureProxyWhitelistHistory",
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  API_LIST
4
- } from "./chunk-XSH56QUG.js";
4
+ } from "./chunk-TDSY46F2.js";
5
5
  import {
6
6
  DIM,
7
7
  GREEN,
@@ -72,7 +72,7 @@ ${GREEN}${BOLD}Upgraded to @epilot/cli@${latest}${RESET}
72
72
  }
73
73
  });
74
74
  var getCurrentVersion = () => {
75
- if (true) return "0.1.58";
75
+ if (true) return "0.1.59";
76
76
  try {
77
77
  const output = execSync("npm ls -g @epilot/cli --depth=0 --json 2>/dev/null", {
78
78
  encoding: "utf-8",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/cli",
3
- "version": "0.1.58",
3
+ "version": "0.1.59",
4
4
  "description": "CLI for epilot APIs",
5
5
  "type": "module",
6
6
  "bin": {