@stackfactor/client-api 1.2.3 → 1.2.6
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/cjs/lib/actionNotifications.d.ts +42 -0
- package/dist/cjs/lib/actionNotifications.d.ts.map +1 -1
- package/dist/cjs/lib/actionNotifications.js +107 -1
- package/dist/cjs/lib/actionNotifications.js.map +1 -1
- package/dist/cjs/lib/avatar.js +1 -1
- package/dist/cjs/lib/avatar.js.map +1 -1
- package/dist/cjs/lib/constants.d.ts +4 -0
- package/dist/cjs/lib/constants.d.ts.map +1 -1
- package/dist/cjs/lib/constants.js +11 -0
- package/dist/cjs/lib/constants.js.map +1 -1
- package/dist/cjs/lib/incident.d.ts +235 -0
- package/dist/cjs/lib/incident.d.ts.map +1 -0
- package/dist/cjs/lib/incident.js +298 -0
- package/dist/cjs/lib/incident.js.map +1 -0
- package/dist/cjs/lib/index.d.ts +1 -0
- package/dist/cjs/lib/index.d.ts.map +1 -1
- package/dist/cjs/lib/index.js +3 -2
- package/dist/cjs/lib/index.js.map +1 -1
- package/dist/cjs/lib/integration.d.ts.map +1 -1
- package/dist/cjs/lib/integration.js +17 -2
- package/dist/cjs/lib/integration.js.map +1 -1
- package/dist/cjs/lib/utils.d.ts.map +1 -1
- package/dist/cjs/lib/utils.js +11 -0
- package/dist/cjs/lib/utils.js.map +1 -1
- package/dist/cjs/package.json +1 -1
- package/dist/esm/lib/actionNotifications.d.ts +42 -0
- package/dist/esm/lib/actionNotifications.d.ts.map +1 -1
- package/dist/esm/lib/actionNotifications.js +104 -0
- package/dist/esm/lib/actionNotifications.js.map +1 -1
- package/dist/esm/lib/avatar.js +1 -1
- package/dist/esm/lib/avatar.js.map +1 -1
- package/dist/esm/lib/constants.d.ts +4 -0
- package/dist/esm/lib/constants.d.ts.map +1 -1
- package/dist/esm/lib/constants.js +11 -0
- package/dist/esm/lib/constants.js.map +1 -1
- package/dist/esm/lib/incident.d.ts +235 -0
- package/dist/esm/lib/incident.d.ts.map +1 -0
- package/dist/esm/lib/incident.js +272 -0
- package/dist/esm/lib/incident.js.map +1 -0
- package/dist/esm/lib/index.d.ts +1 -0
- package/dist/esm/lib/index.d.ts.map +1 -1
- package/dist/esm/lib/index.js +1 -0
- package/dist/esm/lib/index.js.map +1 -1
- package/dist/esm/lib/integration.d.ts.map +1 -1
- package/dist/esm/lib/integration.js +17 -2
- package/dist/esm/lib/integration.js.map +1 -1
- package/dist/esm/lib/utils.d.ts.map +1 -1
- package/dist/esm/lib/utils.js +11 -0
- package/dist/esm/lib/utils.js.map +1 -1
- package/dist/esm/package.json +1 -1
- package/package.json +11 -4
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { client } from "./axiosClient.js";
|
|
2
|
+
import { getBaseUrl } from "./utils.js";
|
|
3
|
+
import { io } from "socket.io-client";
|
|
2
4
|
/**
|
|
3
5
|
* Get all permissions
|
|
4
6
|
* @param {String} token The authentication token
|
|
@@ -18,6 +20,28 @@ export const getAllUserNotifications = (token) => {
|
|
|
18
20
|
});
|
|
19
21
|
});
|
|
20
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* Get one notification's full per-user view — including the heavy `details`
|
|
25
|
+
* and `data` payloads the list deliberately omits. Called on demand when a
|
|
26
|
+
* notification is opened.
|
|
27
|
+
* @param {String} id The notification id
|
|
28
|
+
* @param {String} token The authentication token
|
|
29
|
+
* @returns {Promise<object>}
|
|
30
|
+
*/
|
|
31
|
+
export const getUserNotificationDetails = (id, token) => {
|
|
32
|
+
return new Promise((resolve, reject) => {
|
|
33
|
+
const request = client.get(`/api/v1/actionnotifications/${id}`, {
|
|
34
|
+
headers: { authorization: token },
|
|
35
|
+
});
|
|
36
|
+
request
|
|
37
|
+
.then((response) => {
|
|
38
|
+
resolve(response.data);
|
|
39
|
+
})
|
|
40
|
+
.catch((error) => {
|
|
41
|
+
reject(error);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
};
|
|
21
45
|
/**
|
|
22
46
|
* Mark notifications as open or viewed
|
|
23
47
|
* @param {Array<String>} ids The id of the notifications to be marked
|
|
@@ -64,4 +88,84 @@ export const processNotification = (id, action, comments, authToken) => {
|
|
|
64
88
|
});
|
|
65
89
|
});
|
|
66
90
|
};
|
|
91
|
+
/** Socket event the backend uses to push a user's full notification list. */
|
|
92
|
+
export const NOTIFICATIONS_LIST_EVENT = "notifications:list";
|
|
93
|
+
// Retry cadence for handshake rejections (socket.io does not auto-reconnect
|
|
94
|
+
// after a middleware error, so the client must re-dial itself — with a fresh
|
|
95
|
+
// token, since an expired one is the most likely cause).
|
|
96
|
+
const HANDSHAKE_RETRY_BASE_MS = 2000;
|
|
97
|
+
const HANDSHAKE_RETRY_MAX_MS = 60000;
|
|
98
|
+
/**
|
|
99
|
+
* Opens a persistent realtime subscription to the current user's action
|
|
100
|
+
* notifications. Unlike the per-operation sockets in this package, this
|
|
101
|
+
* connection reconnects automatically and stays open for the lifetime of the
|
|
102
|
+
* session.
|
|
103
|
+
*
|
|
104
|
+
* The backend sends the full current notification list (the same shape as
|
|
105
|
+
* `getAllUserNotifications`) on every connect and reconnect, and again
|
|
106
|
+
* whenever the list changes — so the consumer simply replaces its state with
|
|
107
|
+
* each `onList` payload and needs no polling and no merge logic.
|
|
108
|
+
*
|
|
109
|
+
* @param getToken Called before every (re)connect attempt so the handshake
|
|
110
|
+
* always carries a fresh token — pass an accessor that refreshes the
|
|
111
|
+
* short-lived bearer token, never a captured value.
|
|
112
|
+
* @param onList Receives the user's full notification list on every push.
|
|
113
|
+
* @param onConnectionChange Optional; observes socket connectivity so the
|
|
114
|
+
* consumer can fall back to polling while disconnected.
|
|
115
|
+
*/
|
|
116
|
+
export const subscribeToUserNotifications = ({ getToken, onList, onConnectionChange, }) => {
|
|
117
|
+
let closed = false;
|
|
118
|
+
let retryTimer = null;
|
|
119
|
+
let retryDelay = HANDSHAKE_RETRY_BASE_MS;
|
|
120
|
+
const socket = io(getBaseUrl(), {
|
|
121
|
+
// Function form: evaluated on every connection attempt, so reconnects
|
|
122
|
+
// after a token expiry pick up the refreshed token.
|
|
123
|
+
auth: (cb) => {
|
|
124
|
+
Promise.resolve(getToken()).then((token) => cb({ token }));
|
|
125
|
+
},
|
|
126
|
+
path: `/api/v1/realtime`,
|
|
127
|
+
transports: ["websocket"],
|
|
128
|
+
withCredentials: true,
|
|
129
|
+
reconnection: true,
|
|
130
|
+
reconnectionDelay: 1000,
|
|
131
|
+
reconnectionDelayMax: 30000,
|
|
132
|
+
});
|
|
133
|
+
socket.on("connect", () => {
|
|
134
|
+
retryDelay = HANDSHAKE_RETRY_BASE_MS;
|
|
135
|
+
if (onConnectionChange)
|
|
136
|
+
onConnectionChange(true);
|
|
137
|
+
});
|
|
138
|
+
socket.on("disconnect", () => {
|
|
139
|
+
if (onConnectionChange)
|
|
140
|
+
onConnectionChange(false);
|
|
141
|
+
});
|
|
142
|
+
// A handshake rejection (invalid/expired token) closes the socket without
|
|
143
|
+
// automatic reconnection — re-dial with backoff and a fresh token.
|
|
144
|
+
socket.on("connect_error", () => {
|
|
145
|
+
if (onConnectionChange)
|
|
146
|
+
onConnectionChange(false);
|
|
147
|
+
if (closed || socket.active)
|
|
148
|
+
return;
|
|
149
|
+
if (retryTimer)
|
|
150
|
+
clearTimeout(retryTimer);
|
|
151
|
+
retryTimer = setTimeout(() => {
|
|
152
|
+
retryTimer = null;
|
|
153
|
+
if (!closed)
|
|
154
|
+
socket.connect();
|
|
155
|
+
}, retryDelay);
|
|
156
|
+
retryDelay = Math.min(retryDelay * 2, HANDSHAKE_RETRY_MAX_MS);
|
|
157
|
+
});
|
|
158
|
+
socket.on(NOTIFICATIONS_LIST_EVENT, (notifications) => {
|
|
159
|
+
onList(notifications);
|
|
160
|
+
});
|
|
161
|
+
return {
|
|
162
|
+
disconnect: () => {
|
|
163
|
+
closed = true;
|
|
164
|
+
if (retryTimer)
|
|
165
|
+
clearTimeout(retryTimer);
|
|
166
|
+
socket.disconnect();
|
|
167
|
+
},
|
|
168
|
+
socket,
|
|
169
|
+
};
|
|
170
|
+
};
|
|
67
171
|
//# sourceMappingURL=actionNotifications.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actionNotifications.js","sourceRoot":"","sources":["../../../src/lib/actionNotifications.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"actionNotifications.js","sourceRoot":"","sources":["../../../src/lib/actionNotifications.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,EAAE,EAAe,MAAM,kBAAkB,CAAC;AAEnD;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,KAAa,EAAmB,EAAE;IACxE,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,6BAA6B,EAAE;YACxD,OAAO,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE;SAClC,CAAC,CAAC;QACH,OAAO;aACJ,IAAI,CAAC,CAAC,QAAuB,EAAE,EAAE;YAChC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,KAAiB,EAAE,EAAE;YAC3B,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,EAAU,EACV,KAAa,EACI,EAAE;IACnB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,+BAA+B,EAAE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CAAC,CAAC"}
|
package/dist/esm/lib/avatar.js
CHANGED
|
@@ -11,7 +11,7 @@ import { client } from "./axiosClient.js";
|
|
|
11
11
|
*/
|
|
12
12
|
export const getAvatar = (elementId, type, width, height, token, title = "") => {
|
|
13
13
|
return new Promise((resolve, reject) => {
|
|
14
|
-
const confirmationRequest = client.get(`/api/v1/avatar/getavatar/${elementId}/${type}/${width}/${height}${title?.length > 0 ? `/${title}` : ""}`, {
|
|
14
|
+
const confirmationRequest = client.get(`/api/v1/avatar/getavatar/${elementId}/${type}/${width}/${height}${title?.length > 0 ? `/${encodeURIComponent(title)}` : ""}`, {
|
|
15
15
|
headers: {
|
|
16
16
|
authorization: token,
|
|
17
17
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"avatar.js","sourceRoot":"","sources":["../../../src/lib/avatar.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,SAAiB,EACjB,IAAY,EACZ,KAAa,EACb,MAAc,EACd,KAAa,EACb,QAAgB,EAAE,EACH,EAAE;IACjB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CACpC,4BAA4B,SAAS,IAAI,IAAI,IAAI,KAAK,IAAI,MAAM,GAAG,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"avatar.js","sourceRoot":"","sources":["../../../src/lib/avatar.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,SAAiB,EACjB,IAAY,EACZ,KAAa,EACb,MAAc,EACd,KAAa,EACb,QAAgB,EAAE,EACH,EAAE;IACjB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,mBAAmB,GAAG,MAAM,CAAC,GAAG,CACpC,4BAA4B,SAAS,IAAI,IAAI,IAAI,KAAK,IAAI,MAAM,GAAG,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAC7H;YACE,OAAO,EAAE;gBACP,aAAa,EAAE,KAAK;aACrB;YACD,YAAY,EAAE,MAAM;SACrB,CACF,CAAC;QACF,mBAAmB;aAChB,IAAI,CAAC,CAAC,QAAuB,EAAE,EAAE;YAChC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC,CAAC;aACD,KAAK,CAAC,GAAG,EAAE;YACV,MAAM,CAAC,sBAAsB,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -83,6 +83,10 @@ export declare const PERMISSIONS: {
|
|
|
83
83
|
readonly ADMIN_KNOWLEDGE_BASE: "8ad63643098109cdc48f7dbe";
|
|
84
84
|
readonly RELEASE_QUARANTINE: "7cf80c6b1ea8c0d7d6893afd";
|
|
85
85
|
readonly MANAGE_COMPLIANCE: "f86e5d976f93ea849af69eea";
|
|
86
|
+
readonly INCIDENTS_READ: "1c99552174c5f22e6db345c6";
|
|
87
|
+
readonly INCIDENTS_MANAGE: "1f9247689c96be15a9d49781";
|
|
88
|
+
readonly INCIDENTS_INTAKE_ADMIN: "1e5316c54a779f85c4a1e29c";
|
|
89
|
+
readonly INCIDENTS_CLOSE: "1503b88282a7fa822a295b65";
|
|
86
90
|
};
|
|
87
91
|
/**
|
|
88
92
|
* Quota units used by billing profile quota entries.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB;;;CAGnB,CAAC;AAEX,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmChB,CAAC;AAEX;;;;;;GAMG;AACH,eAAO,MAAM,IAAI;;;;;CAKP,CAAC;AAEX,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB;;;CAGnB,CAAC;AAEX,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmChB,CAAC;AAEX;;;;;;GAMG;AACH,eAAO,MAAM,IAAI;;;;;CAKP,CAAC;AAEX,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCd,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,UAAU;;;CAGb,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8CtB,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CA0C5D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc;IACzB,oBAAoB;;;;;;IAMpB,uBAAuB;;;;;;;IAOvB,8BAA8B;;;;;;IAM9B,yCAAyC;;;;;;;;;IASzC,kCAAkC;;;;;;IAMlC,6EAA6E;;;;;;;IAO7E,yCAAyC;;;;;;;CAOjC,CAAC"}
|
|
@@ -83,6 +83,13 @@ export const PERMISSIONS = {
|
|
|
83
83
|
ADMIN_KNOWLEDGE_BASE: "8ad63643098109cdc48f7dbe",
|
|
84
84
|
RELEASE_QUARANTINE: "7cf80c6b1ea8c0d7d6893afd",
|
|
85
85
|
MANAGE_COMPLIANCE: "f86e5d976f93ea849af69eea",
|
|
86
|
+
// Shield Incident Management. These are the FIRST SHIELD-exclusive permissions
|
|
87
|
+
// on the platform, and they mirror backend-core's groupsConstants.constants —
|
|
88
|
+
// the ObjectIds are the contract and must not drift.
|
|
89
|
+
INCIDENTS_READ: "1c99552174c5f22e6db345c6",
|
|
90
|
+
INCIDENTS_MANAGE: "1f9247689c96be15a9d49781",
|
|
91
|
+
INCIDENTS_INTAKE_ADMIN: "1e5316c54a779f85c4a1e29c",
|
|
92
|
+
INCIDENTS_CLOSE: "1503b88282a7fa822a295b65",
|
|
86
93
|
};
|
|
87
94
|
/**
|
|
88
95
|
* Quota units used by billing profile quota entries.
|
|
@@ -173,6 +180,10 @@ export const PERMISSION_DESCRIPTIONS = {
|
|
|
173
180
|
[PERMISSIONS.ADMIN_KNOWLEDGE_BASE]: "Knowledge Base - Admin",
|
|
174
181
|
[PERMISSIONS.RELEASE_QUARANTINE]: "Knowledge Base - Release Quarantine",
|
|
175
182
|
[PERMISSIONS.MANAGE_COMPLIANCE]: "Knowledge Base - Manage Compliance",
|
|
183
|
+
[PERMISSIONS.INCIDENTS_READ]: "Incidents - View",
|
|
184
|
+
[PERMISSIONS.INCIDENTS_MANAGE]: "Incidents - Manage",
|
|
185
|
+
[PERMISSIONS.INCIDENTS_INTAKE_ADMIN]: "Incidents - Manage Intake",
|
|
186
|
+
[PERMISSIONS.INCIDENTS_CLOSE]: "Incidents - Verify and Close",
|
|
176
187
|
};
|
|
177
188
|
/**
|
|
178
189
|
* Knowledge Base enums (mirrors `@stackfactor/backend-core` const `KNOWLEDGE_BASE`).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/lib/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,KAAK,EAAE,OAAO;IACd,SAAS,EAAE,WAAW;CACd,CAAC;AAEX,MAAM,CAAC,MAAM,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E,8BAA8B;CAC9D,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,oBAAoB;IACpB,UAAU,EAAE;QACV,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,QAAQ;KACjB;IACD,uBAAuB;IACvB,WAAW,EAAE;QACX,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,QAAQ;QAChB,WAAW,EAAE,aAAa;QAC1B,MAAM,EAAE,QAAQ;KACjB;IACD,8BAA8B;IAC9B,YAAY,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,MAAM;KACb;IACD,yCAAyC;IACzC,eAAe,EAAE;QACf,OAAO,EAAE,CAAC;QACV,UAAU,EAAE,CAAC;QACb,SAAS,EAAE,CAAC;QACZ,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,CAAC;QACV,WAAW,EAAE,CAAC;KACf;IACD,kCAAkC;IAClC,kBAAkB,EAAE;QAClB,eAAe,EAAE,iBAAiB;QAClC,UAAU,EAAE,YAAY;QACxB,IAAI,EAAE,MAAM;KACb;IACD,6EAA6E;IAC7E,WAAW,EAAE;QACX,KAAK,EAAE,OAAO;QACd,WAAW,EAAE,aAAa;QAC1B,aAAa,EAAE,eAAe;QAC9B,kBAAkB,EAAE,oBAAoB;KACzC;IACD,yCAAyC;IACzC,sBAAsB,EAAE;QACtB,WAAW,EAAE,aAAa;QAC1B,WAAW,EAAE,aAAa;QAC1B,YAAY,EAAE,cAAc;QAC5B,mBAAmB,EAAE,qBAAqB;KAC3C;CACO,CAAC"}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
/** A queue filter set. Every field is optional; unknown values widen rather than error. */
|
|
2
|
+
export interface IncidentQueueFilters {
|
|
3
|
+
status?: string | string[];
|
|
4
|
+
severity?: string | string[];
|
|
5
|
+
/** Tenant-configured business-process key. Not a fixed enum, by design. */
|
|
6
|
+
process?: string;
|
|
7
|
+
frameworkTag?: string;
|
|
8
|
+
sourceKind?: string | string[];
|
|
9
|
+
senderId?: string;
|
|
10
|
+
ownerId?: string;
|
|
11
|
+
controlId?: string;
|
|
12
|
+
/** Incidents with no owner, which is a distinct filter rather than an empty ownerId. */
|
|
13
|
+
unassigned?: boolean;
|
|
14
|
+
slaBreached?: boolean;
|
|
15
|
+
/** ISO-8601. Filters on ingestion time, matching how the SLA clock is measured. */
|
|
16
|
+
from?: string;
|
|
17
|
+
to?: string;
|
|
18
|
+
/** Free text. A value like "INC-2043" or a bare number matches the human id exactly. */
|
|
19
|
+
q?: string;
|
|
20
|
+
page?: number;
|
|
21
|
+
limit?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Incident queue, with filters, free-text search and pagination.
|
|
25
|
+
* @param {IncidentQueueFilters} filters
|
|
26
|
+
* @param {String} token Authorization token
|
|
27
|
+
* @returns {Promise<object>} `{ items, page, limit, total, totalPages }`
|
|
28
|
+
*/
|
|
29
|
+
export declare const getIncidents: (filters: IncidentQueueFilters, token: string) => Promise<object>;
|
|
30
|
+
/**
|
|
31
|
+
* One incident, complete. Tasks, training, timeline, evidence and agent runs are
|
|
32
|
+
* embedded, so the detail view needs no follow-up calls.
|
|
33
|
+
* @param {String} id
|
|
34
|
+
* @param {String} token Authorization token
|
|
35
|
+
* @returns {Promise<object>}
|
|
36
|
+
*/
|
|
37
|
+
export declare const getIncident: (id: string, token: string) => Promise<object>;
|
|
38
|
+
/**
|
|
39
|
+
* Dashboard tiles. Note that `medianTimeToRemediateMs` is null rather than 0 when
|
|
40
|
+
* nothing closed in the window, and that severity/process buckets can carry a
|
|
41
|
+
* null key for incidents not yet triaged.
|
|
42
|
+
* @param {Number} windowDays Trailing window for the trend and median tiles
|
|
43
|
+
* @param {String} token Authorization token
|
|
44
|
+
* @returns {Promise<object>}
|
|
45
|
+
*/
|
|
46
|
+
export declare const getIncidentDashboard: (windowDays: number | undefined, token: string) => Promise<object>;
|
|
47
|
+
/**
|
|
48
|
+
* The signed-in user's own corrective actions and training assignments.
|
|
49
|
+
* Authenticated but not permission-gated: an assignee can see their work without
|
|
50
|
+
* holding read over the whole queue.
|
|
51
|
+
* @param {Boolean} includeCompleted
|
|
52
|
+
* @param {String} token Authorization token
|
|
53
|
+
* @returns {Promise<object>} `{ tasks, training }`
|
|
54
|
+
*/
|
|
55
|
+
export declare const getMyIncidentWork: (includeCompleted: boolean | undefined, token: string) => Promise<object>;
|
|
56
|
+
/**
|
|
57
|
+
* Tenant incident settings: severity mapping, SLA hours, dedup window, the
|
|
58
|
+
* business-process list, the AI-triage toggle and the remediation-agent mode.
|
|
59
|
+
* Read-gated rather than admin-gated, because the queue's process filter needs
|
|
60
|
+
* the process list.
|
|
61
|
+
* @param {String} token Authorization token
|
|
62
|
+
* @returns {Promise<object>}
|
|
63
|
+
*/
|
|
64
|
+
export declare const getIncidentSettings: (token: string) => Promise<object>;
|
|
65
|
+
/**
|
|
66
|
+
* Update tenant incident settings. Requires INCIDENTS_INTAKE_ADMIN.
|
|
67
|
+
* @param {Object} settings Partial settings; unknown keys are ignored
|
|
68
|
+
* @param {String} token Authorization token
|
|
69
|
+
* @returns {Promise<object>} The effective settings after the write
|
|
70
|
+
*/
|
|
71
|
+
export declare const updateIncidentSettings: (settings: object, token: string) => Promise<object>;
|
|
72
|
+
/**
|
|
73
|
+
* File an incident by hand. Takes the same normalized event contract the public
|
|
74
|
+
* intake endpoint accepts, so a manual incident and an ingested one are
|
|
75
|
+
* indistinguishable afterwards apart from their source.
|
|
76
|
+
* @param {Object} event `{ source, title, occurred_at, ... }`
|
|
77
|
+
* @param {String} token Authorization token
|
|
78
|
+
* @returns {Promise<object>} `{ incidentId, humanId, deduplicated }`
|
|
79
|
+
*/
|
|
80
|
+
export declare const createIncident: (event: object, token: string) => Promise<object>;
|
|
81
|
+
/**
|
|
82
|
+
* File an incident as an integration's webhook handler.
|
|
83
|
+
*
|
|
84
|
+
* For agent code, not the browser. A provider's webhook lands on the platform's
|
|
85
|
+
* `/webhooks/...` receiver, the connector's handler maps that payload onto the
|
|
86
|
+
* normalized event contract, and this is where it puts the result.
|
|
87
|
+
*
|
|
88
|
+
* Authenticated by the API token the delivery itself was authenticated with —
|
|
89
|
+
* `request.authToken` inside a handler — which already carries the System -
|
|
90
|
+
* Dispatch Events permission. There is no separate intake credential to
|
|
91
|
+
* provision or rotate for this path.
|
|
92
|
+
*
|
|
93
|
+
* `integrationId` is required and should come from `params.data.integration._id`.
|
|
94
|
+
* It attributes the incident to the connector that filed it; it is self-asserted
|
|
95
|
+
* (the token names a user, never an integration) and is checked against the
|
|
96
|
+
* tenant's enabled integrations, so treat it as a correlation label rather than
|
|
97
|
+
* as proof of origin.
|
|
98
|
+
*
|
|
99
|
+
* Resolves on `202` — durably stored, with triage enrichment and remediation
|
|
100
|
+
* dispatch still to run.
|
|
101
|
+
* @param {Object} event `{ integrationId, source, title, occurred_at, ... }`
|
|
102
|
+
* @param {String} token Authorization token; a handler's `request.authToken`
|
|
103
|
+
* @returns {Promise<object>} `{ incidentId, humanId, deduplicated }`
|
|
104
|
+
*/
|
|
105
|
+
export declare const ingestIncident: (event: object, token: string) => Promise<object>;
|
|
106
|
+
/**
|
|
107
|
+
* Edit whitelisted fields. Status and severity are deliberately not among them:
|
|
108
|
+
* they move through `transitionIncident` and `changeIncidentSeverity`, so neither
|
|
109
|
+
* the state machine nor the reason requirement can be bypassed by an edit.
|
|
110
|
+
* @param {Object} data Must carry `_id`
|
|
111
|
+
* @param {String} token Authorization token
|
|
112
|
+
* @returns {Promise<object>}
|
|
113
|
+
*/
|
|
114
|
+
export declare const updateIncident: (data: object, token: string) => Promise<object>;
|
|
115
|
+
/**
|
|
116
|
+
* Move an incident through the lifecycle. Enforces the legal-transition table,
|
|
117
|
+
* requires a root cause before verification, a reason to dismiss, and refuses
|
|
118
|
+
* closure while corrective actions or training remain outstanding.
|
|
119
|
+
* @param {String} id
|
|
120
|
+
* @param {Object} data `{ to, note?, dismissReason? }`
|
|
121
|
+
* @param {String} token Authorization token
|
|
122
|
+
* @returns {Promise<object>}
|
|
123
|
+
*/
|
|
124
|
+
export declare const transitionIncident: (id: string, data: object, token: string) => Promise<object>;
|
|
125
|
+
/**
|
|
126
|
+
* Change severity. The reason is mandatory and audit-logged, and the SLA
|
|
127
|
+
* deadline is recomputed to match.
|
|
128
|
+
* @param {String} id
|
|
129
|
+
* @param {Object} data `{ severity, reason }`
|
|
130
|
+
* @param {String} token Authorization token
|
|
131
|
+
* @returns {Promise<object>}
|
|
132
|
+
*/
|
|
133
|
+
export declare const changeIncidentSeverity: (id: string, data: object, token: string) => Promise<object>;
|
|
134
|
+
/**
|
|
135
|
+
* Attach evidence.
|
|
136
|
+
* @param {String} id
|
|
137
|
+
* @param {Object} data `{ type: "url" | "fileRef" | "text", ref }`
|
|
138
|
+
* @param {String} token Authorization token
|
|
139
|
+
* @returns {Promise<object>}
|
|
140
|
+
*/
|
|
141
|
+
export declare const addIncidentEvidence: (id: string, data: object, token: string) => Promise<object>;
|
|
142
|
+
/**
|
|
143
|
+
* Add a corrective-action task.
|
|
144
|
+
* @param {String} id
|
|
145
|
+
* @param {Object} data `{ title, description?, assigneeId?, dueAt? }`
|
|
146
|
+
* @param {String} token Authorization token
|
|
147
|
+
* @returns {Promise<object>}
|
|
148
|
+
*/
|
|
149
|
+
export declare const addIncidentTask: (id: string, data: object, token: string) => Promise<object>;
|
|
150
|
+
/**
|
|
151
|
+
* Update a task, including completing or reopening it. Reopening clears the
|
|
152
|
+
* completion stamp.
|
|
153
|
+
* @param {String} id
|
|
154
|
+
* @param {Object} data `{ taskId, done?, title?, assigneeId?, dueAt? }`
|
|
155
|
+
* @param {String} token Authorization token
|
|
156
|
+
* @returns {Promise<object>}
|
|
157
|
+
*/
|
|
158
|
+
export declare const updateIncidentTask: (id: string, data: object, token: string) => Promise<object>;
|
|
159
|
+
/**
|
|
160
|
+
* Assign training by hand. The Remediation Agent is the normal path once it
|
|
161
|
+
* exists; this produces the identical record, marked as user-created.
|
|
162
|
+
* @param {String} id
|
|
163
|
+
* @param {Object} data `{ assigneeId, learningPathId?, dueAt? }`
|
|
164
|
+
* @param {String} token Authorization token
|
|
165
|
+
* @returns {Promise<object>}
|
|
166
|
+
*/
|
|
167
|
+
export declare const assignIncidentTraining: (id: string, data: object, token: string) => Promise<object>;
|
|
168
|
+
/**
|
|
169
|
+
* Retract a training assignment, including one the agent created. The assignment
|
|
170
|
+
* is removed so it stops blocking closure; the timeline keeps a record of it.
|
|
171
|
+
* @param {String} id
|
|
172
|
+
* @param {Object} data `{ assignmentId, reason? }`
|
|
173
|
+
* @param {String} token Authorization token
|
|
174
|
+
* @returns {Promise<object>}
|
|
175
|
+
*/
|
|
176
|
+
export declare const retractIncidentTraining: (id: string, data: object, token: string) => Promise<object>;
|
|
177
|
+
/**
|
|
178
|
+
* Waive a training assignment. Requires INCIDENTS_CLOSE, not merely manage,
|
|
179
|
+
* because waiving is the only way an incident closes without the training
|
|
180
|
+
* actually being completed. The reason is mandatory.
|
|
181
|
+
* @param {String} id
|
|
182
|
+
* @param {Object} data `{ assignmentId, reason }`
|
|
183
|
+
* @param {String} token Authorization token
|
|
184
|
+
* @returns {Promise<object>}
|
|
185
|
+
*/
|
|
186
|
+
export declare const waiveIncidentTraining: (id: string, data: object, token: string) => Promise<object>;
|
|
187
|
+
/**
|
|
188
|
+
* Accept, modify or reject an AI triage suggestion. Accepting applies it and
|
|
189
|
+
* stamps the applied value with its AI provenance; nothing the AI proposes takes
|
|
190
|
+
* effect until a human decides. A suggestion can only be decided once.
|
|
191
|
+
* @param {String} id
|
|
192
|
+
* @param {Object} data `{ suggestionId, disposition, edits? }`
|
|
193
|
+
* @param {String} token Authorization token
|
|
194
|
+
* @returns {Promise<object>}
|
|
195
|
+
*/
|
|
196
|
+
export declare const decideIncidentSuggestion: (id: string, data: object, token: string) => Promise<object>;
|
|
197
|
+
/**
|
|
198
|
+
* Auditor export: whole incidents including timeline, agent runs and evidence,
|
|
199
|
+
* matching the same filters the queue uses. Capped server-side.
|
|
200
|
+
* @param {IncidentQueueFilters} filters
|
|
201
|
+
* @param {String} token Authorization token
|
|
202
|
+
* @returns {Promise<object>} `{ items, total, truncated }`
|
|
203
|
+
*/
|
|
204
|
+
export declare const exportIncidents: (filters: IncidentQueueFilters, token: string) => Promise<object>;
|
|
205
|
+
/**
|
|
206
|
+
* Soft-delete an incident. Requires INCIDENTS_CLOSE. The record is retained and
|
|
207
|
+
* simply leaves the queue; there is no hard delete.
|
|
208
|
+
* @param {String} id
|
|
209
|
+
* @param {String} token Authorization token
|
|
210
|
+
* @returns {Promise<object>}
|
|
211
|
+
*/
|
|
212
|
+
export declare const deleteIncident: (id: string, token: string) => Promise<object>;
|
|
213
|
+
/**
|
|
214
|
+
* List intake credentials. Never returns secret material.
|
|
215
|
+
* @param {String} token Authorization token
|
|
216
|
+
* @returns {Promise<object>}
|
|
217
|
+
*/
|
|
218
|
+
export declare const getIntakeKeys: (token: string) => Promise<object>;
|
|
219
|
+
/**
|
|
220
|
+
* Create an intake credential. The plaintext key is in this response and nowhere
|
|
221
|
+
* else, ever; only its hash is stored. A caller that loses it must issue a new one.
|
|
222
|
+
* @param {Object} data `{ name }`
|
|
223
|
+
* @param {String} token Authorization token
|
|
224
|
+
* @returns {Promise<object>} `{ key, record }`
|
|
225
|
+
*/
|
|
226
|
+
export declare const createIntakeKey: (data: object, token: string) => Promise<object>;
|
|
227
|
+
/**
|
|
228
|
+
* Revoke an intake credential. The record is kept so historical incidents can
|
|
229
|
+
* still resolve which credential delivered them.
|
|
230
|
+
* @param {String} id
|
|
231
|
+
* @param {String} token Authorization token
|
|
232
|
+
* @returns {Promise<object>}
|
|
233
|
+
*/
|
|
234
|
+
export declare const revokeIntakeKey: (id: string, token: string) => Promise<object>;
|
|
235
|
+
//# sourceMappingURL=incident.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"incident.d.ts","sourceRoot":"","sources":["../../../src/lib/incident.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