@bringg/dashboard-sdk 9.86.0 → 9.86.1
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/Analyst/Analyst.consts.d.ts +5 -0
- package/dist/Analyst/Analyst.consts.js +9 -0
- package/dist/Analyst/Analyst.consts.js.map +1 -0
- package/dist/Analyst/AnalystApi.d.ts +65 -4
- package/dist/Analyst/AnalystApi.js +140 -3
- package/dist/Analyst/AnalystApi.js.map +1 -1
- package/dist/Analyst/Chat/AnalystChat.consts.d.ts +18 -0
- package/dist/Analyst/Chat/AnalystChat.consts.js +23 -0
- package/dist/Analyst/Chat/AnalystChat.consts.js.map +1 -0
- package/dist/Analyst/Chat/AnalystChatEntity.d.ts +22 -0
- package/dist/Analyst/Chat/AnalystChatEntity.js +122 -0
- package/dist/Analyst/Chat/AnalystChatEntity.js.map +1 -0
- package/dist/Analyst/{Services → Findings}/AnalystFindingsService.d.ts +1 -1
- package/dist/Analyst/{Services → Findings}/AnalystFindingsService.js +3 -4
- package/dist/Analyst/Findings/AnalystFindingsService.js.map +1 -0
- package/dist/Analyst/index.d.ts +1 -0
- package/dist/Analyst/index.js +18 -0
- package/dist/Analyst/index.js.map +1 -0
- package/dist/bringg-dashboard-sdk-cjs2.js +373 -14
- package/dist/bringg-dashboard-sdk-cjs2.js.map +1 -1
- package/dist/bringg-dashboard-sdk.js +57 -13
- package/dist/bringg-dashboard-sdk.min.js +1 -1
- package/dist/bringg-dashboard-sdk.min.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/Analyst/Services/AnalystFindingsService.js.map +0 -1
- package/dist/Analyst/constants.d.ts +0 -1
- package/dist/Analyst/constants.js +0 -5
- package/dist/Analyst/constants.js.map +0 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FINDINGS = exports.AGENT_CHAT = exports.GATEWAY_PATH = exports.API_PREFIX = exports.SERVICE_NAME = void 0;
|
|
4
|
+
exports.SERVICE_NAME = 'analyst-service';
|
|
5
|
+
exports.API_PREFIX = '/api';
|
|
6
|
+
exports.GATEWAY_PATH = "/".concat(exports.SERVICE_NAME);
|
|
7
|
+
exports.AGENT_CHAT = 'agent-chat';
|
|
8
|
+
exports.FINDINGS = 'findings';
|
|
9
|
+
//# sourceMappingURL=Analyst.consts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Analyst.consts.js","sourceRoot":"","sources":["../../src/Analyst/Analyst.consts.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG,iBAAiB,CAAC;AAEjC,QAAA,UAAU,GAAG,MAAM,CAAC;AAEpB,QAAA,YAAY,GAAG,WAAI,oBAAY,CAAE,CAAC;AAElC,QAAA,UAAU,GAAG,YAAY,CAAC;AAC1B,QAAA,QAAQ,GAAG,UAAU,CAAC"}
|
|
@@ -1,7 +1,68 @@
|
|
|
1
|
-
import { AnalystLatestFindings } from '@bringg/types';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { AnalystChat, AnalystLatestFindings } from '@bringg/types';
|
|
2
|
+
import Session from '../Services/Identity/Session';
|
|
3
|
+
/**
|
|
4
|
+
* Connection details for the Analyst agent's protocol client.
|
|
5
|
+
*
|
|
6
|
+
* Deliberately a plain object rather than a constructed client. The consumer builds the client
|
|
7
|
+
* itself - see the note on {@link AnalystApi}.
|
|
8
|
+
*/
|
|
9
|
+
export interface AnalystClientConfig {
|
|
10
|
+
/** Host and gateway prefix, with no graph or endpoint path on it. */
|
|
11
|
+
apiUrl: string;
|
|
12
|
+
/** The exact URL a turn is posted to. Built here so no consumer concatenates the path itself. */
|
|
13
|
+
chatUrl: string;
|
|
14
|
+
/** Applied to every request. */
|
|
15
|
+
defaultHeaders: Record<string, string>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Public SDK surface for analyst-service: findings and agent chat.
|
|
19
|
+
* Everything the dashboard requests *itself* - latest findings, the thread list, one thread,
|
|
20
|
+
* cancelling a run - is an ordinary SDK call on this class.
|
|
21
|
+
*/
|
|
22
|
+
export declare class AnalystApi {
|
|
23
|
+
private readonly session;
|
|
24
|
+
private cached?;
|
|
25
|
+
private readonly chat;
|
|
26
|
+
private readonly findings;
|
|
5
27
|
constructor(session: Session);
|
|
28
|
+
/**
|
|
29
|
+
* The most recent findings run for the signed-in merchant.
|
|
30
|
+
*
|
|
31
|
+
* @returns The latest findings payload from analyst-service
|
|
32
|
+
*/
|
|
6
33
|
getLatest(): Promise<AnalystLatestFindings>;
|
|
34
|
+
/**
|
|
35
|
+
* The signed-in user's conversations, most recently active first.
|
|
36
|
+
*
|
|
37
|
+
* Carries no messages - the History list stays cheap, and opening a conversation hydrates it
|
|
38
|
+
* through {@link getThread}.
|
|
39
|
+
*/
|
|
40
|
+
listThreads(): Promise<AnalystChat.ThreadSummary[]>;
|
|
41
|
+
/**
|
|
42
|
+
* One conversation, with its messages and whether a run is executing on it right now.
|
|
43
|
+
* Rejects on 404, which is also the answer for a thread belonging to someone else: the service
|
|
44
|
+
* deliberately does not distinguish "not yours" from "not there".
|
|
45
|
+
*/
|
|
46
|
+
getThread(threadId: string): Promise<AnalystChat.ThreadDetail>;
|
|
47
|
+
/**
|
|
48
|
+
* Cancel the run in flight on a thread.
|
|
49
|
+
* A cancelled run ends with no terminal event: the stream simply closes, with neither
|
|
50
|
+
* `RUN_FINISHED` nor `RUN_ERROR`. Callers that drive their loading state off terminal events
|
|
51
|
+
* alone will hang, and must treat stream close as its own case.
|
|
52
|
+
*/
|
|
53
|
+
cancelRun(threadId: string): Promise<AnalystChat.CancelRunResponse>;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the **same object** while the values are unchanged.
|
|
56
|
+
*
|
|
57
|
+
* Referential stability is load-bearing, not a micro-optimisation: a protocol client treats its
|
|
58
|
+
* config as a dependency and rebuilds itself whenever the identity changes. A fresh object per
|
|
59
|
+
* call rebuilds on every render, which refetches, which renders again - a loop.
|
|
60
|
+
*
|
|
61
|
+
* Recomputed each call and compared by value, so a changed session (login, region switch,
|
|
62
|
+
* impersonation) still produces a new config rather than a stale one.
|
|
63
|
+
*/
|
|
64
|
+
getClientConfig(): AnalystClientConfig;
|
|
65
|
+
/** Matches the headers `ServiceRequest` builds for every other service. */
|
|
66
|
+
private getDefaultHeaders;
|
|
7
67
|
}
|
|
68
|
+
export default AnalystApi;
|
|
@@ -1,17 +1,154 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
2
38
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
40
|
};
|
|
5
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
42
|
+
exports.AnalystApi = void 0;
|
|
43
|
+
var Analyst_consts_1 = require("./Analyst.consts");
|
|
44
|
+
var AnalystChat_consts_1 = require("./Chat/AnalystChat.consts");
|
|
45
|
+
var AnalystChatEntity_1 = __importDefault(require("./Chat/AnalystChatEntity"));
|
|
46
|
+
var AnalystFindingsService_1 = __importDefault(require("./Findings/AnalystFindingsService"));
|
|
47
|
+
var isSameConfig = function (a, b) {
|
|
48
|
+
if (a.apiUrl !== b.apiUrl || a.chatUrl !== b.chatUrl) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
var keys = Object.keys(a.defaultHeaders);
|
|
52
|
+
return (keys.length === Object.keys(b.defaultHeaders).length &&
|
|
53
|
+
keys.every(function (key) { return a.defaultHeaders[key] === b.defaultHeaders[key]; }));
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Public SDK surface for analyst-service: findings and agent chat.
|
|
57
|
+
* Everything the dashboard requests *itself* - latest findings, the thread list, one thread,
|
|
58
|
+
* cancelling a run - is an ordinary SDK call on this class.
|
|
59
|
+
*/
|
|
7
60
|
var AnalystApi = /** @class */ (function () {
|
|
8
61
|
function AnalystApi(session) {
|
|
9
|
-
this.
|
|
62
|
+
this.session = session;
|
|
63
|
+
this.chat = new AnalystChatEntity_1.default(session);
|
|
64
|
+
this.findings = new AnalystFindingsService_1.default(session);
|
|
10
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* The most recent findings run for the signed-in merchant.
|
|
68
|
+
*
|
|
69
|
+
* @returns The latest findings payload from analyst-service
|
|
70
|
+
*/
|
|
11
71
|
AnalystApi.prototype.getLatest = function () {
|
|
12
|
-
return this.
|
|
72
|
+
return this.findings.latest();
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* The signed-in user's conversations, most recently active first.
|
|
76
|
+
*
|
|
77
|
+
* Carries no messages - the History list stays cheap, and opening a conversation hydrates it
|
|
78
|
+
* through {@link getThread}.
|
|
79
|
+
*/
|
|
80
|
+
AnalystApi.prototype.listThreads = function () {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
82
|
+
return __generator(this, function (_a) {
|
|
83
|
+
return [2 /*return*/, this.chat.listThreads()];
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* One conversation, with its messages and whether a run is executing on it right now.
|
|
89
|
+
* Rejects on 404, which is also the answer for a thread belonging to someone else: the service
|
|
90
|
+
* deliberately does not distinguish "not yours" from "not there".
|
|
91
|
+
*/
|
|
92
|
+
AnalystApi.prototype.getThread = function (threadId) {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
94
|
+
return __generator(this, function (_a) {
|
|
95
|
+
return [2 /*return*/, this.chat.getThread(threadId)];
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Cancel the run in flight on a thread.
|
|
101
|
+
* A cancelled run ends with no terminal event: the stream simply closes, with neither
|
|
102
|
+
* `RUN_FINISHED` nor `RUN_ERROR`. Callers that drive their loading state off terminal events
|
|
103
|
+
* alone will hang, and must treat stream close as its own case.
|
|
104
|
+
*/
|
|
105
|
+
AnalystApi.prototype.cancelRun = function (threadId) {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
107
|
+
return __generator(this, function (_a) {
|
|
108
|
+
return [2 /*return*/, this.chat.cancelRun(threadId)];
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Returns the **same object** while the values are unchanged.
|
|
114
|
+
*
|
|
115
|
+
* Referential stability is load-bearing, not a micro-optimisation: a protocol client treats its
|
|
116
|
+
* config as a dependency and rebuilds itself whenever the identity changes. A fresh object per
|
|
117
|
+
* call rebuilds on every render, which refetches, which renders again - a loop.
|
|
118
|
+
*
|
|
119
|
+
* Recomputed each call and compared by value, so a changed session (login, region switch,
|
|
120
|
+
* impersonation) still produces a new config rather than a stale one.
|
|
121
|
+
*/
|
|
122
|
+
AnalystApi.prototype.getClientConfig = function () {
|
|
123
|
+
// Resolved from the SIGNED-IN USER's region, not the environment default: a user's region can
|
|
124
|
+
// differ from it, and resolving against the default points them at the wrong cluster.
|
|
125
|
+
var apiEndpoint = this.session.config.getApiEndpoint().encode();
|
|
126
|
+
var next = {
|
|
127
|
+
apiUrl: "".concat(apiEndpoint).concat(Analyst_consts_1.GATEWAY_PATH),
|
|
128
|
+
chatUrl: "".concat(apiEndpoint).concat(AnalystChat_consts_1.Routes.CHAT),
|
|
129
|
+
defaultHeaders: this.getDefaultHeaders()
|
|
130
|
+
};
|
|
131
|
+
if (this.cached && isSameConfig(this.cached, next)) {
|
|
132
|
+
return this.cached;
|
|
133
|
+
}
|
|
134
|
+
this.cached = next;
|
|
135
|
+
return next;
|
|
136
|
+
};
|
|
137
|
+
/** Matches the headers `ServiceRequest` builds for every other service. */
|
|
138
|
+
AnalystApi.prototype.getDefaultHeaders = function () {
|
|
139
|
+
var _a;
|
|
140
|
+
var headers = {};
|
|
141
|
+
var token = (_a = this.session.user) === null || _a === void 0 ? void 0 : _a.authentication_token;
|
|
142
|
+
if (token) {
|
|
143
|
+
headers.Authorization = "Token token=".concat(token);
|
|
144
|
+
}
|
|
145
|
+
if (this.session.clientId) {
|
|
146
|
+
headers.Client = String(this.session.clientId);
|
|
147
|
+
}
|
|
148
|
+
return headers;
|
|
13
149
|
};
|
|
14
150
|
return AnalystApi;
|
|
15
151
|
}());
|
|
152
|
+
exports.AnalystApi = AnalystApi;
|
|
16
153
|
exports.default = AnalystApi;
|
|
17
154
|
//# sourceMappingURL=AnalystApi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalystApi.js","sourceRoot":"","sources":["../../src/Analyst/AnalystApi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AnalystApi.js","sourceRoot":"","sources":["../../src/Analyst/AnalystApi.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A chat URL has three parts, and only the last is the platform's to choose:
|
|
3
|
+
* /analyst-service /api/agent-chat /chat
|
|
4
|
+
* service name mount path endpoint
|
|
5
|
+
*/
|
|
6
|
+
export declare const MOUNT_PATH: string;
|
|
7
|
+
export declare const BASE_PATH: string;
|
|
8
|
+
/**
|
|
9
|
+
* `CHAT` is declared here for completeness but is **not** called from this package: it is the ag-ui
|
|
10
|
+
* protocol endpoint, opened by the consumer's `HttpAgent` as a streaming POST. It is exposed through
|
|
11
|
+
* {@link AnalystClientConfig.chatUrl} instead, so the URL is still built in one place.
|
|
12
|
+
*/
|
|
13
|
+
export declare const Routes: {
|
|
14
|
+
CHAT: string;
|
|
15
|
+
THREADS: string;
|
|
16
|
+
THREAD: string;
|
|
17
|
+
CANCEL_RUN: string;
|
|
18
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Routes = exports.BASE_PATH = exports.MOUNT_PATH = void 0;
|
|
4
|
+
var Analyst_consts_1 = require("../Analyst.consts");
|
|
5
|
+
/**
|
|
6
|
+
* A chat URL has three parts, and only the last is the platform's to choose:
|
|
7
|
+
* /analyst-service /api/agent-chat /chat
|
|
8
|
+
* service name mount path endpoint
|
|
9
|
+
*/
|
|
10
|
+
exports.MOUNT_PATH = "".concat(Analyst_consts_1.API_PREFIX, "/").concat(Analyst_consts_1.AGENT_CHAT);
|
|
11
|
+
exports.BASE_PATH = "".concat(Analyst_consts_1.GATEWAY_PATH).concat(exports.MOUNT_PATH);
|
|
12
|
+
/**
|
|
13
|
+
* `CHAT` is declared here for completeness but is **not** called from this package: it is the ag-ui
|
|
14
|
+
* protocol endpoint, opened by the consumer's `HttpAgent` as a streaming POST. It is exposed through
|
|
15
|
+
* {@link AnalystClientConfig.chatUrl} instead, so the URL is still built in one place.
|
|
16
|
+
*/
|
|
17
|
+
exports.Routes = {
|
|
18
|
+
CHAT: "".concat(exports.BASE_PATH, "/chat"),
|
|
19
|
+
THREADS: "".concat(exports.BASE_PATH, "/threads"),
|
|
20
|
+
THREAD: "".concat(exports.BASE_PATH, "/threads/{:threadId}"),
|
|
21
|
+
CANCEL_RUN: "".concat(exports.BASE_PATH, "/threads/{:threadId}/cancel")
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=AnalystChat.consts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnalystChat.consts.js","sourceRoot":"","sources":["../../../src/Analyst/Chat/AnalystChat.consts.ts"],"names":[],"mappings":";;;AAAA,oDAAyE;AAEzE;;;;GAIG;AACU,QAAA,UAAU,GAAG,UAAG,2BAAU,cAAI,2BAAU,CAAE,CAAC;AAC3C,QAAA,SAAS,GAAG,UAAG,6BAAY,SAAG,kBAAU,CAAE,CAAC;AAExD;;;;GAIG;AACU,QAAA,MAAM,GAAG;IACrB,IAAI,EAAE,UAAG,iBAAS,UAAO;IACzB,OAAO,EAAE,UAAG,iBAAS,aAAU;IAC/B,MAAM,EAAE,UAAG,iBAAS,yBAAsB;IAC1C,UAAU,EAAE,UAAG,iBAAS,gCAA6B;CACrD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AnalystChat } from '@bringg/types';
|
|
2
|
+
import Entity from '../../Core/Entity';
|
|
3
|
+
import type Session from '../../Services/Identity/Session';
|
|
4
|
+
/**
|
|
5
|
+
* The Analyst agent-chat REST surface.
|
|
6
|
+
*/
|
|
7
|
+
export default class AnalystChatEntity extends Entity<AnalystChat.ThreadSummary> {
|
|
8
|
+
constructor(session: Session);
|
|
9
|
+
/** The signed-in user's threads, most recently active first. A bare array, no envelope. */
|
|
10
|
+
listThreads(): Promise<AnalystChat.ThreadSummary[]>;
|
|
11
|
+
/**
|
|
12
|
+
* One thread, with its messages and whether a run is currently executing on it.
|
|
13
|
+
*
|
|
14
|
+
* A thread belonging to another user answers **404**, never 403 - so a rejected id is
|
|
15
|
+
* indistinguishable from a missing one, by design.
|
|
16
|
+
*/
|
|
17
|
+
getThread(threadId: string): Promise<AnalystChat.ThreadDetail>;
|
|
18
|
+
/**
|
|
19
|
+
* Cancel the run in flight on a thread.
|
|
20
|
+
*/
|
|
21
|
+
cancelRun(threadId: string): Promise<AnalystChat.CancelRunResponse>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
54
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
55
|
+
};
|
|
56
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
+
var Entity_1 = __importDefault(require("../../Core/Entity"));
|
|
58
|
+
var AnalystChat_consts_1 = require("./AnalystChat.consts");
|
|
59
|
+
/**
|
|
60
|
+
* The Analyst agent-chat REST surface.
|
|
61
|
+
*/
|
|
62
|
+
var AnalystChatEntity = /** @class */ (function (_super) {
|
|
63
|
+
__extends(AnalystChatEntity, _super);
|
|
64
|
+
function AnalystChatEntity(session) {
|
|
65
|
+
return _super.call(this, {
|
|
66
|
+
session: session,
|
|
67
|
+
entityName: 'threads',
|
|
68
|
+
routePrefix: 'analyst-service'
|
|
69
|
+
}) || this;
|
|
70
|
+
}
|
|
71
|
+
/** The signed-in user's threads, most recently active first. A bare array, no envelope. */
|
|
72
|
+
AnalystChatEntity.prototype.listThreads = function () {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
74
|
+
var threads;
|
|
75
|
+
return __generator(this, function (_a) {
|
|
76
|
+
switch (_a.label) {
|
|
77
|
+
case 0: return [4 /*yield*/, this.service.routeGenerator
|
|
78
|
+
.get(AnalystChat_consts_1.Routes.THREADS)
|
|
79
|
+
.setException('Failed to fetch analyst chat threads')
|
|
80
|
+
.invoke()];
|
|
81
|
+
case 1:
|
|
82
|
+
threads = _a.sent();
|
|
83
|
+
return [2 /*return*/, threads !== null && threads !== void 0 ? threads : []];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* One thread, with its messages and whether a run is currently executing on it.
|
|
90
|
+
*
|
|
91
|
+
* A thread belonging to another user answers **404**, never 403 - so a rejected id is
|
|
92
|
+
* indistinguishable from a missing one, by design.
|
|
93
|
+
*/
|
|
94
|
+
AnalystChatEntity.prototype.getThread = function (threadId) {
|
|
95
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
96
|
+
return __generator(this, function (_a) {
|
|
97
|
+
return [2 /*return*/, this.service.routeGenerator
|
|
98
|
+
.get(AnalystChat_consts_1.Routes.THREAD)
|
|
99
|
+
.withRouteParams({ threadId: threadId })
|
|
100
|
+
.setException('Failed to fetch analyst chat thread')
|
|
101
|
+
.invoke()];
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Cancel the run in flight on a thread.
|
|
107
|
+
*/
|
|
108
|
+
AnalystChatEntity.prototype.cancelRun = function (threadId) {
|
|
109
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
110
|
+
return __generator(this, function (_a) {
|
|
111
|
+
return [2 /*return*/, this.service.routeGenerator
|
|
112
|
+
.post(AnalystChat_consts_1.Routes.CANCEL_RUN)
|
|
113
|
+
.withRouteParams({ threadId: threadId })
|
|
114
|
+
.setException('Failed to cancel the analyst chat run')
|
|
115
|
+
.invoke()];
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
return AnalystChatEntity;
|
|
120
|
+
}(Entity_1.default));
|
|
121
|
+
exports.default = AnalystChatEntity;
|
|
122
|
+
//# sourceMappingURL=AnalystChatEntity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnalystChatEntity.js","sourceRoot":"","sources":["../../../src/Analyst/Chat/AnalystChatEntity.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,6DAAuC;AAEvC,2DAA8C;AAE9C;;GAEG;AACH;IAA+C,qCAAiC;IAC/E,2BAAY,OAAgB;eAC3B,kBAAM;YACL,OAAO,SAAA;YACP,UAAU,EAAE,SAAS;YACrB,WAAW,EAAE,iBAAiB;SAC9B,CAAC;IACH,CAAC;IAED,2FAA2F;IACrF,uCAAW,GAAjB;;;;;4BACiB,qBAAM,IAAI,CAAC,OAAO,CAAC,cAAc;6BAC/C,GAAG,CAAC,2BAAM,CAAC,OAAO,CAAC;6BACnB,YAAY,CAAC,sCAAsC,CAAC;6BACpD,MAAM,EAA4D,EAAA;;wBAH9D,OAAO,GAAG,SAGoD;wBAEpE,sBAAO,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,EAAC;;;;KACrB;IAED;;;;;OAKG;IACG,qCAAS,GAAf,UAAgB,QAAgB;;;gBAC/B,sBAAO,IAAI,CAAC,OAAO,CAAC,cAAc;yBAChC,GAAG,CAAC,2BAAM,CAAC,MAAM,CAAC;yBAClB,eAAe,CAAC,EAAE,QAAQ,UAAA,EAAE,CAAC;yBAC7B,YAAY,CAAC,qCAAqC,CAAC;yBACnD,MAAM,EAAsD,EAAC;;;KAC/D;IAED;;OAEG;IACG,qCAAS,GAAf,UAAgB,QAAgB;;;gBAC/B,sBAAO,IAAI,CAAC,OAAO,CAAC,cAAc;yBAChC,IAAI,CAAC,2BAAM,CAAC,UAAU,CAAC;yBACvB,eAAe,CAAC,EAAE,QAAQ,UAAA,EAAE,CAAC;yBAC7B,YAAY,CAAC,uCAAuC,CAAC;yBACrD,MAAM,EAAgE,EAAC;;;KACzE;IACF,wBAAC;AAAD,CAAC,AA3CD,CAA+C,gBAAM,GA2CpD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnalystFinding, AnalystLatestFindings } from '@bringg/types';
|
|
1
|
+
import type { AnalystFinding, AnalystLatestFindings } from '@bringg/types';
|
|
2
2
|
import BaseService from '../../Core/BaseService';
|
|
3
3
|
import type Session from '../../Services/Identity/Session';
|
|
4
4
|
export declare const Routes: {
|
|
@@ -56,11 +56,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
56
56
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
57
|
exports.Routes = void 0;
|
|
58
58
|
var BaseService_1 = __importDefault(require("../../Core/BaseService"));
|
|
59
|
-
var
|
|
60
|
-
var
|
|
61
|
-
var ROOT = "".concat(constants_1.API_PREFIX, "/").concat(SERVICE_NAME);
|
|
59
|
+
var Analyst_consts_1 = require("../Analyst.consts");
|
|
60
|
+
var ROOT = "".concat(Analyst_consts_1.GATEWAY_PATH).concat(Analyst_consts_1.API_PREFIX);
|
|
62
61
|
exports.Routes = {
|
|
63
|
-
LATEST: "".concat(ROOT, "/
|
|
62
|
+
LATEST: "".concat(ROOT, "/").concat(Analyst_consts_1.FINDINGS, "/latest")
|
|
64
63
|
};
|
|
65
64
|
var AnalystFindingsService = /** @class */ (function (_super) {
|
|
66
65
|
__extends(AnalystFindingsService, _super);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnalystFindingsService.js","sourceRoot":"","sources":["../../../src/Analyst/Findings/AnalystFindingsService.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,uEAAiD;AAEjD,oDAAuE;AAEvE,IAAM,IAAI,GAAG,UAAG,6BAAY,SAAG,2BAAU,CAAE,CAAC;AAE/B,QAAA,MAAM,GAAG;IACrB,MAAM,EAAE,UAAG,IAAI,cAAI,yBAAQ,YAAS;CACpC,CAAC;AAEF;IAAoD,0CAA2B;IAC9E,gCAAY,OAAgB;eAC3B,kBAAM,OAAO,EAAE,kBAAkB,CAAC;IACnC,CAAC;IAEK,uCAAM,GAAZ;;;gBACC,sBAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,cAAM,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAC;;;KACvD;IACF,6BAAC;AAAD,CAAC,AARD,CAAoD,qBAAW,GAQ9D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './AnalystApi';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./AnalystApi"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Analyst/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B"}
|