@stack-spot/portal-network 0.173.1 → 1.0.0-betaadp.2

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.
@@ -0,0 +1,89 @@
1
+ import { ConversationResponse } from '../api/ai.js';
2
+ import { StackspotAPIError } from '../error/StackspotAPIError.js';
3
+ import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient.js';
4
+ interface Resource {
5
+ title: string;
6
+ description: string;
7
+ }
8
+ interface PersistedResource extends Resource {
9
+ id: string;
10
+ createdAt: string;
11
+ updatedAt: string;
12
+ createdBy: {
13
+ id: string;
14
+ name: string;
15
+ };
16
+ type: 'opportunity' | 'hypothesis' | 'document';
17
+ }
18
+ export interface Opportunity extends PersistedResource {
19
+ type: 'opportunity';
20
+ conversationId: string;
21
+ }
22
+ export interface Hypothesis extends PersistedResource {
23
+ type: 'hypothesis';
24
+ opportunityId: string;
25
+ conversationId: string;
26
+ }
27
+ export interface Document extends PersistedResource {
28
+ type: 'document';
29
+ hypothesisId: string;
30
+ }
31
+ export type Artifact = Opportunity | Hypothesis | Document;
32
+ export interface ChatConversionDetails extends ConversationResponse {
33
+ opportunityName?: string;
34
+ hypothesisCount?: number;
35
+ }
36
+ declare class AdpMockClient extends ReactQueryNetworkClient {
37
+ constructor();
38
+ protected buildStackSpotError(error: any): StackspotAPIError;
39
+ opportunities: Omit<import("../network/types.js").QueryObject<void | Record<string, any>, Opportunity[]>, "isAllowed" | "useAllowed" | "getPermissionKey">;
40
+ opportunity: Omit<import("../network/types.js").QueryObject<{
41
+ id: string;
42
+ }, Opportunity>, "isAllowed" | "useAllowed" | "getPermissionKey">;
43
+ hypothesis: Omit<import("../network/types.js").QueryObject<{
44
+ opportunityId: string;
45
+ }, Hypothesis[]>, "isAllowed" | "useAllowed" | "getPermissionKey">;
46
+ hypothesisById: Omit<import("../network/types.js").QueryObject<{
47
+ id: string;
48
+ }, Hypothesis>, "isAllowed" | "useAllowed" | "getPermissionKey">;
49
+ documents: Omit<import("../network/types.js").QueryObject<{
50
+ hypothesisId: string;
51
+ }, Document[]>, "isAllowed" | "useAllowed" | "getPermissionKey">;
52
+ document: Omit<import("../network/types.js").QueryObject<{
53
+ id: string;
54
+ }, Document>, "isAllowed" | "useAllowed" | "getPermissionKey">;
55
+ artifacts: Omit<import("../network/types.js").QueryObject<{
56
+ conversationId: string;
57
+ }, Artifact[]>, "isAllowed" | "useAllowed" | "getPermissionKey">;
58
+ createOpportunity: Omit<import("../network/types.js").MutationObject<{
59
+ opportunity: Resource;
60
+ conversationId: string;
61
+ }, Opportunity>, keyof import("../network/types.js").OperationObject<any>>;
62
+ createHypothesis: Omit<import("../network/types.js").MutationObject<{
63
+ hypothesis: Resource;
64
+ opportunityId: string;
65
+ conversationId: string;
66
+ }, Hypothesis>, keyof import("../network/types.js").OperationObject<any>>;
67
+ createDocument: Omit<import("../network/types.js").MutationObject<{
68
+ document: Resource;
69
+ hypothesisId: string;
70
+ }, Document>, keyof import("../network/types.js").OperationObject<any>>;
71
+ private deleteArtifact;
72
+ deleteOpportunity: Omit<import("../network/types.js").MutationObject<{
73
+ id: string;
74
+ }, void>, keyof import("../network/types.js").OperationObject<any>>;
75
+ deleteHypothesis: Omit<import("../network/types.js").MutationObject<{
76
+ id: string;
77
+ }, void>, keyof import("../network/types.js").OperationObject<any>>;
78
+ deleteDocument: Omit<import("../network/types.js").MutationObject<{
79
+ id: string;
80
+ }, void>, keyof import("../network/types.js").OperationObject<any>>;
81
+ chats: Omit<import("../network/types.js").QueryObject<{
82
+ filter?: string | undefined;
83
+ page?: number | undefined;
84
+ size?: number | undefined;
85
+ }, ChatConversionDetails[]>, "isAllowed" | "useAllowed" | "getPermissionKey">;
86
+ }
87
+ export declare const adpMockClient: AdpMockClient;
88
+ export {};
89
+ //# sourceMappingURL=adp-mock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adp-mock.d.ts","sourceRoot":"","sources":["../../src/client/adp-mock.ts"],"names":[],"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oD,MAAM;uEAIlE;IAEF,cAAc;YAE0B,MAAM;qEAI5C;IAEF,SAAS;sBAEmD,MAAM;qEAIhE;IAEF,QAAQ;YAEgC,MAAM;mEAI5C;IAEF,SAAS;wBAEuD,MAAM;qEAOpE;IAEF,iBAAiB;qBAEyD,QAAQ;wBAAkB,MAAM;4EAOxG;IAEF,gBAAgB;oBAIiD,QAAQ;uBAAiB,MAAM;wBAAkB,MAAM;2EAQtH;IAEF,cAAc;kBAEoD,QAAQ;sBAAgB,MAAM;yEAO9F;IAEF,OAAO,CAAC,cAAc,CAGrB;IAED,iBAAiB;YALkD,MAAM;qEAQvE;IAEF,gBAAgB;YAVmD,MAAM;qEAavE;IAEF,cAAc;YAfqD,MAAM;qEAkBvE;IAEF,KAAK;;;;kFAqCH;CACH;AAED,eAAO,MAAM,aAAa,eAAsB,CAAA"}
@@ -0,0 +1,246 @@
1
+ import { random } from 'lodash';
2
+ import { getApiAddresses } from '../api-addresses.js';
3
+ import { defaults } from '../api/discovery.js';
4
+ import { StackspotAPIError } from '../error/StackspotAPIError.js';
5
+ import { NetworkClient } from '../network/NetworkClient.js';
6
+ import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient.js';
7
+ import { aiClient } from './ai.js';
8
+ const key = 'mock-adp-api';
9
+ function delay() {
10
+ return new Promise((resolve) => {
11
+ setTimeout(resolve, random(500, 1500));
12
+ });
13
+ }
14
+ async function load() {
15
+ await delay();
16
+ const fromStorage = localStorage.getItem(key);
17
+ return fromStorage ? JSON.parse(fromStorage) : [];
18
+ }
19
+ async function save(data) {
20
+ await delay();
21
+ localStorage.setItem(key, JSON.stringify(data));
22
+ }
23
+ function createResource(data) {
24
+ const tokenData = NetworkClient.sessionManager?.getSession().getTokenData();
25
+ return {
26
+ ...data,
27
+ id: `${Math.random()}`,
28
+ createdAt: new Date().toISOString(),
29
+ updatedAt: new Date().toISOString(),
30
+ createdBy: {
31
+ id: tokenData?.account_id_v2 ?? '',
32
+ name: tokenData?.name ?? '',
33
+ },
34
+ };
35
+ }
36
+ class AdpMockClient extends ReactQueryNetworkClient {
37
+ constructor() {
38
+ super(getApiAddresses().discovery.url, defaults);
39
+ Object.defineProperty(this, "opportunities", {
40
+ enumerable: true,
41
+ configurable: true,
42
+ writable: true,
43
+ value: this.query({
44
+ name: 'opportunities',
45
+ request: async () => {
46
+ const artifacts = await load();
47
+ return artifacts.filter(a => a.type === 'opportunity');
48
+ },
49
+ })
50
+ });
51
+ Object.defineProperty(this, "opportunity", {
52
+ enumerable: true,
53
+ configurable: true,
54
+ writable: true,
55
+ value: this.query({
56
+ name: 'opportunity',
57
+ request: async (_abort, { id }) => {
58
+ const artifacts = await load();
59
+ return artifacts.find(a => a.type === 'opportunity' && a.id === id);
60
+ },
61
+ })
62
+ });
63
+ Object.defineProperty(this, "hypothesis", {
64
+ enumerable: true,
65
+ configurable: true,
66
+ writable: true,
67
+ value: this.query({
68
+ name: 'hypothesis',
69
+ request: async (_abort, { opportunityId }) => {
70
+ const artifacts = await load();
71
+ return artifacts.filter(a => a.type === 'hypothesis' && a.opportunityId === opportunityId);
72
+ },
73
+ })
74
+ });
75
+ Object.defineProperty(this, "hypothesisById", {
76
+ enumerable: true,
77
+ configurable: true,
78
+ writable: true,
79
+ value: this.query({
80
+ name: 'hypothesisById',
81
+ request: async (_abort, { id }) => {
82
+ const artifacts = await load();
83
+ return artifacts.find(a => a.type === 'hypothesis' && a.id === id);
84
+ },
85
+ })
86
+ });
87
+ Object.defineProperty(this, "documents", {
88
+ enumerable: true,
89
+ configurable: true,
90
+ writable: true,
91
+ value: this.query({
92
+ name: 'documents',
93
+ request: async (_abort, { hypothesisId }) => {
94
+ const artifacts = await load();
95
+ return artifacts.filter(a => a.type === 'document' && a.hypothesisId === hypothesisId);
96
+ },
97
+ })
98
+ });
99
+ Object.defineProperty(this, "document", {
100
+ enumerable: true,
101
+ configurable: true,
102
+ writable: true,
103
+ value: this.query({
104
+ name: 'document',
105
+ request: async (_abort, { id }) => {
106
+ const artifacts = await load();
107
+ return artifacts.find(a => a.type === 'document' && a.id === id);
108
+ },
109
+ })
110
+ });
111
+ Object.defineProperty(this, "artifacts", {
112
+ enumerable: true,
113
+ configurable: true,
114
+ writable: true,
115
+ value: this.query({
116
+ name: 'artifacts',
117
+ request: async (_abort, { conversationId }) => {
118
+ const artifacts = await load();
119
+ const opportunities = artifacts.filter(a => a.type === 'opportunity' && a.conversationId === conversationId);
120
+ const hypotheses = artifacts.filter(a => a.type === 'hypothesis' && opportunities.some(o => o.id === a.opportunityId));
121
+ const documents = artifacts.filter(a => a.type === 'document' && hypotheses.some(h => h.id === a.hypothesisId));
122
+ return [...opportunities, ...hypotheses, ...documents];
123
+ },
124
+ })
125
+ });
126
+ Object.defineProperty(this, "createOpportunity", {
127
+ enumerable: true,
128
+ configurable: true,
129
+ writable: true,
130
+ value: this.mutation({
131
+ name: 'createOpportunity',
132
+ request: async (_abort, { conversationId, opportunity }) => {
133
+ const artifacts = await load();
134
+ const created = { ...createResource(opportunity), type: 'opportunity', conversationId };
135
+ artifacts.push(created);
136
+ await save(artifacts);
137
+ return created;
138
+ },
139
+ })
140
+ });
141
+ Object.defineProperty(this, "createHypothesis", {
142
+ enumerable: true,
143
+ configurable: true,
144
+ writable: true,
145
+ value: this.mutation({
146
+ name: 'createHypothesis',
147
+ request: async (_abort, { hypothesis, opportunityId, conversationId }) => {
148
+ const artifacts = await load();
149
+ const created = { ...createResource(hypothesis), type: 'hypothesis', opportunityId, conversationId };
150
+ artifacts.push(created);
151
+ await save(artifacts);
152
+ return created;
153
+ },
154
+ })
155
+ });
156
+ Object.defineProperty(this, "createDocument", {
157
+ enumerable: true,
158
+ configurable: true,
159
+ writable: true,
160
+ value: this.mutation({
161
+ name: 'createDocument',
162
+ request: async (_abort, { document, hypothesisId }) => {
163
+ const artifacts = await load();
164
+ const created = { ...createResource(document), type: 'document', hypothesisId };
165
+ artifacts.push(created);
166
+ await save(artifacts);
167
+ return created;
168
+ },
169
+ })
170
+ });
171
+ Object.defineProperty(this, "deleteArtifact", {
172
+ enumerable: true,
173
+ configurable: true,
174
+ writable: true,
175
+ value: async (_abort, { id }) => {
176
+ const artifacts = await load();
177
+ await save(artifacts.filter(a => a.id !== id));
178
+ }
179
+ });
180
+ Object.defineProperty(this, "deleteOpportunity", {
181
+ enumerable: true,
182
+ configurable: true,
183
+ writable: true,
184
+ value: this.mutation({
185
+ name: 'deleteOpportunity',
186
+ request: this.deleteArtifact,
187
+ })
188
+ });
189
+ Object.defineProperty(this, "deleteHypothesis", {
190
+ enumerable: true,
191
+ configurable: true,
192
+ writable: true,
193
+ value: this.mutation({
194
+ name: 'deleteHypothesis',
195
+ request: this.deleteArtifact,
196
+ })
197
+ });
198
+ Object.defineProperty(this, "deleteDocument", {
199
+ enumerable: true,
200
+ configurable: true,
201
+ writable: true,
202
+ value: this.mutation({
203
+ name: 'deleteDocument',
204
+ request: this.deleteArtifact,
205
+ })
206
+ });
207
+ Object.defineProperty(this, "chats", {
208
+ enumerable: true,
209
+ configurable: true,
210
+ writable: true,
211
+ value: this.query({
212
+ name: 'chats',
213
+ request: async (_signal, variables) => {
214
+ const artifacts = await load();
215
+ const groupedByConversionId = artifacts.reduce((acc, item) => {
216
+ if (!acc[item.conversationId]) {
217
+ acc[item.conversationId] = [];
218
+ }
219
+ acc[item.conversationId].push(item);
220
+ return acc;
221
+ }, {});
222
+ const chatsHistory = await aiClient.chats.query({ ...variables, page: variables.page, size: variables.size ?? 40 });
223
+ const filteredItems = variables.filter ?
224
+ chatsHistory.filter((chat) => chat.title.toLowerCase().includes(variables.filter.toLowerCase())) : chatsHistory;
225
+ const enrichedChats = filteredItems?.map(chat => {
226
+ const relatedArtifacts = groupedByConversionId[chat.id];
227
+ const opportunity = relatedArtifacts?.find(a => a.type === 'opportunity');
228
+ const opportunityName = opportunity?.title ?? null;
229
+ const hypothesisCount = relatedArtifacts?.filter(a => a.type === 'hypothesis').length ?? 0;
230
+ return {
231
+ ...chat,
232
+ opportunityName,
233
+ hypothesisCount,
234
+ };
235
+ });
236
+ return enrichedChats;
237
+ },
238
+ })
239
+ });
240
+ }
241
+ buildStackSpotError(error) {
242
+ return new StackspotAPIError({ status: 0, message: error?.message });
243
+ }
244
+ }
245
+ export const adpMockClient = new AdpMockClient();
246
+ //# sourceMappingURL=adp-mock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adp-mock.js","sourceRoot":"","sources":["../../src/client/adp-mock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAA;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AAuC/B,MAAM,GAAG,GAAG,cAAc,CAAA;AAE1B,SAAS,KAAK;IACZ,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAA;IACxC,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,MAAM,KAAK,EAAE,CAAA;IACb,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAC7C,OAAO,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AACnD,CAAC;AAED,KAAK,UAAU,IAAI,CAAC,IAAgB;IAClC,MAAM,KAAK,EAAE,CAAA;IACb,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,SAA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AE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;IACtE,CAAC;CA2JF;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,aAAa,EAAE,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { CancelledError } from '@tanstack/react-query';
2
2
  export { apiAddresses, getApiAddresses, getBaseUrlWithOverride, setApisOverride } from './api-addresses.js';
3
3
  export { accountClient } from './client/account.js';
4
+ export * from './client/adp-mock.js';
4
5
  export { agentClient } from './client/agent.js';
5
6
  export { agentToolsClient } from './client/agent-tools.js';
6
7
  export { aiClient } from './client/ai.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxG,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,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AAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA"}
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export { CancelledError } from '@tanstack/react-query';
2
2
  export { apiAddresses, getApiAddresses, getBaseUrlWithOverride, setApisOverride } from './api-addresses.js';
3
3
  export { accountClient } from './client/account.js';
4
+ export * from './client/adp-mock.js';
4
5
  export { agentClient } from './client/agent.js';
5
6
  export { agentToolsClient } from './client/agent-tools.js';
6
7
  export { aiClient } from './client/ai.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxG,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,qBAAqB,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;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,cAAc,gBAAgB,CAAA;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAG1D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stack-spot/portal-network",
3
- "version": "0.173.1",
3
+ "version": "1.0.0-betaadp.2",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -9,11 +9,6 @@
9
9
  "./package.json": "./package.json",
10
10
  "./api/*": "./dist/api/*.js"
11
11
  },
12
- "scripts": {
13
- "build": "rimraf dist && tsc-silent -p tsconfig.build.json --suppress @/src/api/ && tsc-esm-fix --target='dist'",
14
- "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
15
- "generate": "tsx ./scripts/generate-apis.ts"
16
- },
17
12
  "peerDependencies": {
18
13
  "@stack-spot/auth": "^5.3.3",
19
14
  "@stack-spot/opa": "^2.6.1",
@@ -55,5 +50,10 @@
55
50
  "@oazapfts/runtime": "^1.0.3",
56
51
  "fetch-event-stream": "^0.1.5",
57
52
  "lodash": "^4.17.21"
53
+ },
54
+ "scripts": {
55
+ "build": "rimraf dist && tsc-silent -p tsconfig.build.json --suppress @/src/api/ && tsc-esm-fix --target='dist'",
56
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
57
+ "generate": "tsx ./scripts/generate-apis.ts"
58
58
  }
59
59
  }
@@ -0,0 +1,244 @@
1
+ import { random } from 'lodash'
2
+ import { getApiAddresses } from '../api-addresses'
3
+ import { ConversationResponse } from '../api/ai'
4
+ import { defaults } from '../api/discovery'
5
+ import { StackspotAPIError } from '../error/StackspotAPIError'
6
+ import { NetworkClient } from '../network/NetworkClient'
7
+ import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
8
+ import { aiClient } from './ai'
9
+
10
+ interface Resource {
11
+ title: string,
12
+ description: string,
13
+ }
14
+
15
+ interface PersistedResource extends Resource {
16
+ id: string,
17
+ createdAt: string,
18
+ updatedAt: string,
19
+ createdBy: { id: string, name: string },
20
+ type: 'opportunity' | 'hypothesis' | 'document',
21
+ }
22
+
23
+ export interface Opportunity extends PersistedResource {
24
+ type: 'opportunity',
25
+ conversationId: string,
26
+ }
27
+
28
+ export interface Hypothesis extends PersistedResource {
29
+ type: 'hypothesis',
30
+ opportunityId: string,
31
+ conversationId: string,
32
+ }
33
+
34
+ export interface Document extends PersistedResource {
35
+ type: 'document',
36
+ hypothesisId: string,
37
+ }
38
+
39
+ export type Artifact = Opportunity | Hypothesis | Document
40
+
41
+ export interface ChatConversionDetails extends ConversationResponse {
42
+ opportunityName?: string,
43
+ hypothesisCount?: number,
44
+ }
45
+
46
+
47
+ const key = 'mock-adp-api'
48
+
49
+ function delay() {
50
+ return new Promise((resolve) => {
51
+ setTimeout(resolve, random(500, 1500))
52
+ })
53
+ }
54
+
55
+ async function load(): Promise<Artifact[]> {
56
+ await delay()
57
+ const fromStorage = localStorage.getItem(key)
58
+ return fromStorage ? JSON.parse(fromStorage) : []
59
+ }
60
+
61
+ async function save(data: Artifact[]) {
62
+ await delay()
63
+ localStorage.setItem(key, JSON.stringify(data))
64
+ }
65
+
66
+ function createResource(data: Resource): Omit<PersistedResource, 'type'> {
67
+ const tokenData = NetworkClient.sessionManager?.getSession().getTokenData()
68
+ return {
69
+ ...data,
70
+ id: `${Math.random()}`,
71
+ createdAt: new Date().toISOString(),
72
+ updatedAt: new Date().toISOString(),
73
+ createdBy: {
74
+ id: tokenData?.account_id_v2 ?? '',
75
+ name: tokenData?.name ?? '',
76
+ },
77
+ }
78
+ }
79
+
80
+ class AdpMockClient extends ReactQueryNetworkClient {
81
+ constructor() {
82
+ super(getApiAddresses().discovery.url, defaults)
83
+ }
84
+
85
+ protected buildStackSpotError(error: any): StackspotAPIError {
86
+ return new StackspotAPIError({ status: 0, message: error?.message })
87
+ }
88
+
89
+ opportunities = this.query({
90
+ name: 'opportunities',
91
+ request: async () => {
92
+ const artifacts = await load()
93
+ return artifacts.filter(a => a.type === 'opportunity') as Opportunity[]
94
+ },
95
+ })
96
+
97
+ opportunity = this.query({
98
+ name: 'opportunity',
99
+ request: async (_abort, { id }: { id: string }) => {
100
+ const artifacts = await load()
101
+ return artifacts.find(a => a.type === 'opportunity' && a.id === id) as Opportunity
102
+ },
103
+ })
104
+
105
+ hypothesis = this.query({
106
+ name: 'hypothesis',
107
+ request: async (_abort, { opportunityId }: { opportunityId: string }) => {
108
+ const artifacts = await load()
109
+ return artifacts.filter(a => a.type === 'hypothesis' && a.opportunityId === opportunityId) as Hypothesis[]
110
+ },
111
+ })
112
+
113
+ hypothesisById = this.query({
114
+ name: 'hypothesisById',
115
+ request: async (_abort, { id }: { id: string }) => {
116
+ const artifacts = await load()
117
+ return artifacts.find(a => a.type === 'hypothesis' && a.id === id) as Hypothesis
118
+ },
119
+ })
120
+
121
+ documents = this.query({
122
+ name: 'documents',
123
+ request: async (_abort, { hypothesisId }: { hypothesisId: string }) => {
124
+ const artifacts = await load()
125
+ return artifacts.filter(a => a.type === 'document' && a.hypothesisId === hypothesisId) as Document[]
126
+ },
127
+ })
128
+
129
+ document = this.query({
130
+ name: 'document',
131
+ request: async (_abort, { id }: { id: string }) => {
132
+ const artifacts = await load()
133
+ return artifacts.find(a => a.type === 'document' && a.id === id) as Document
134
+ },
135
+ })
136
+
137
+ artifacts = this.query({
138
+ name: 'artifacts',
139
+ request: async (_abort, { conversationId }: { conversationId: string }) => {
140
+ const artifacts = await load()
141
+ const opportunities = artifacts.filter(a => a.type === 'opportunity' && a.conversationId === conversationId)
142
+ const hypotheses = artifacts.filter(a => a.type === 'hypothesis' && opportunities.some(o => o.id === a.opportunityId))
143
+ const documents = artifacts.filter(a => a.type === 'document' && hypotheses.some(h => h.id === a.hypothesisId))
144
+ return [...opportunities, ...hypotheses, ...documents]
145
+ },
146
+ })
147
+
148
+ createOpportunity = this.mutation({
149
+ name: 'createOpportunity',
150
+ request: async (_abort, { conversationId, opportunity }: { opportunity: Resource, conversationId: string }) => {
151
+ const artifacts = await load()
152
+ const created: Opportunity = { ...createResource(opportunity), type: 'opportunity', conversationId }
153
+ artifacts.push(created)
154
+ await save(artifacts)
155
+ return created
156
+ },
157
+ })
158
+
159
+ createHypothesis = this.mutation({
160
+ name: 'createHypothesis',
161
+ request: async (
162
+ _abort,
163
+ { hypothesis, opportunityId, conversationId }: { hypothesis: Resource, opportunityId: string, conversationId: string },
164
+ ) => {
165
+ const artifacts = await load()
166
+ const created: Hypothesis = { ...createResource(hypothesis), type: 'hypothesis', opportunityId, conversationId }
167
+ artifacts.push(created)
168
+ await save(artifacts)
169
+ return created
170
+ },
171
+ })
172
+
173
+ createDocument = this.mutation({
174
+ name: 'createDocument',
175
+ request: async (_abort, { document, hypothesisId }: { document: Resource, hypothesisId: string }) => {
176
+ const artifacts = await load()
177
+ const created: Document = { ...createResource(document), type: 'document', hypothesisId }
178
+ artifacts.push(created)
179
+ await save(artifacts)
180
+ return created
181
+ },
182
+ })
183
+
184
+ private deleteArtifact = async (_abort: AbortSignal, { id }: { id: string }) => {
185
+ const artifacts = await load()
186
+ await save(artifacts.filter(a => a.id !== id))
187
+ }
188
+
189
+ deleteOpportunity = this.mutation({
190
+ name: 'deleteOpportunity',
191
+ request: this.deleteArtifact,
192
+ })
193
+
194
+ deleteHypothesis = this.mutation({
195
+ name: 'deleteHypothesis',
196
+ request: this.deleteArtifact,
197
+ })
198
+
199
+ deleteDocument = this.mutation({
200
+ name: 'deleteDocument',
201
+ request: this.deleteArtifact,
202
+ })
203
+
204
+ chats = this.query({
205
+ name: 'chats',
206
+ request: async (_signal, variables: { filter?: string, page?: number, size?: number }) => {
207
+ const artifacts = await load()
208
+
209
+ const groupedByConversionId: Record<string, any[]> = artifacts.reduce(
210
+ (acc, item: any) => {
211
+ if (!acc[item.conversationId]) {
212
+ acc[item.conversationId] = []
213
+ }
214
+ acc[item.conversationId].push(item)
215
+ return acc
216
+ },
217
+ {} as Record<string, any[]>,
218
+ )
219
+
220
+ const chatsHistory = await aiClient.chats.query(
221
+ { ...variables, page: variables.page, size: variables.size ?? 40 },
222
+ )
223
+
224
+ const filteredItems = variables.filter ?
225
+ chatsHistory.filter((chat) => chat.title.toLowerCase().includes(variables.filter!.toLowerCase())) : chatsHistory
226
+
227
+ const enrichedChats = filteredItems?.map(chat => {
228
+ const relatedArtifacts = groupedByConversionId[chat.id]
229
+ const opportunity = relatedArtifacts?.find(a => a.type === 'opportunity')
230
+ const opportunityName = opportunity?.title ?? null
231
+ const hypothesisCount = relatedArtifacts?.filter(a => a.type === 'hypothesis').length ?? 0
232
+
233
+ return {
234
+ ...chat,
235
+ opportunityName,
236
+ hypothesisCount,
237
+ }
238
+ })
239
+ return enrichedChats as ChatConversionDetails[]
240
+ },
241
+ })
242
+ }
243
+
244
+ export const adpMockClient = new AdpMockClient()
package/src/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export { CancelledError } from '@tanstack/react-query'
2
2
  export { apiAddresses, getApiAddresses, getBaseUrlWithOverride, setApisOverride } from './api-addresses'
3
3
  export { accountClient } from './client/account'
4
+ export * from './client/adp-mock'
4
5
  export { agentClient } from './client/agent'
5
6
  export { agentToolsClient } from './client/agent-tools'
6
7
  export { aiClient } from './client/ai'