@stack-spot/portal-network 0.173.1 → 1.0.0-betaadp.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.
@@ -0,0 +1,87 @@
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
+ }
26
+ export interface Document extends PersistedResource {
27
+ type: 'document';
28
+ hypothesisId: string;
29
+ }
30
+ export type Artifact = Opportunity | Hypothesis | Document;
31
+ export interface ChatConversionDetails extends ConversationResponse {
32
+ opportunityName?: string;
33
+ hypothesisCount?: number;
34
+ }
35
+ declare class AdpMockClient extends ReactQueryNetworkClient {
36
+ constructor();
37
+ protected buildStackSpotError(error: any): StackspotAPIError;
38
+ opportunities: Omit<import("../network/types.js").QueryObject<void | Record<string, any>, Opportunity[]>, "isAllowed" | "useAllowed" | "getPermissionKey">;
39
+ opportunity: Omit<import("../network/types.js").QueryObject<{
40
+ id: string;
41
+ }, Opportunity>, "isAllowed" | "useAllowed" | "getPermissionKey">;
42
+ hypothesis: Omit<import("../network/types.js").QueryObject<{
43
+ opportunityId: string;
44
+ }, Hypothesis[]>, "isAllowed" | "useAllowed" | "getPermissionKey">;
45
+ hypothesisById: Omit<import("../network/types.js").QueryObject<{
46
+ id: string;
47
+ }, Hypothesis>, "isAllowed" | "useAllowed" | "getPermissionKey">;
48
+ documents: Omit<import("../network/types.js").QueryObject<{
49
+ hypothesisId: string;
50
+ }, Document[]>, "isAllowed" | "useAllowed" | "getPermissionKey">;
51
+ document: Omit<import("../network/types.js").QueryObject<{
52
+ id: string;
53
+ }, Document>, "isAllowed" | "useAllowed" | "getPermissionKey">;
54
+ artifacts: Omit<import("../network/types.js").QueryObject<{
55
+ conversationId: string;
56
+ }, Artifact[]>, "isAllowed" | "useAllowed" | "getPermissionKey">;
57
+ createOpportunity: Omit<import("../network/types.js").MutationObject<{
58
+ opportunity: Resource;
59
+ conversationId: string;
60
+ }, Opportunity>, keyof import("../network/types.js").OperationObject<any>>;
61
+ createHypothesis: Omit<import("../network/types.js").MutationObject<{
62
+ hypothesis: Resource;
63
+ opportunityId: string;
64
+ }, Hypothesis>, keyof import("../network/types.js").OperationObject<any>>;
65
+ createDocument: Omit<import("../network/types.js").MutationObject<{
66
+ document: Resource;
67
+ hypothesisId: string;
68
+ }, Document>, keyof import("../network/types.js").OperationObject<any>>;
69
+ private deleteArtifact;
70
+ deleteOpportunity: Omit<import("../network/types.js").MutationObject<{
71
+ id: string;
72
+ }, void>, keyof import("../network/types.js").OperationObject<any>>;
73
+ deleteHypothesis: Omit<import("../network/types.js").MutationObject<{
74
+ id: string;
75
+ }, void>, keyof import("../network/types.js").OperationObject<any>>;
76
+ deleteDocument: Omit<import("../network/types.js").MutationObject<{
77
+ id: string;
78
+ }, void>, keyof import("../network/types.js").OperationObject<any>>;
79
+ chats: Omit<import("../network/types.js").QueryObject<{
80
+ filter?: string | undefined;
81
+ page?: number | undefined;
82
+ size?: number | undefined;
83
+ }, ChatConversionDetails[]>, "isAllowed" | "useAllowed" | "getPermissionKey">;
84
+ }
85
+ export declare const adpMockClient: AdpMockClient;
86
+ export {};
87
+ //# 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":[],"mappings":"AAEA,OAAO,EAAE,oBAA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AAS;sBAEmD,MAAM;qEAIhE;IAEF,QAAQ;YAEgC,MAAM;mEAI5C;IAEF,SAAS;wBAEuD,MAAM;qEAOpE;IAEF,iBAAiB;qBAEyD,QAAQ;wBAAkB,MAAM;4EAOxG;IAEF,gBAAgB;oBAEuD,QAAQ;uBAAiB,MAAM;2EAOpG;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 }) => {
148
+ const artifacts = await load();
149
+ const created = { ...createResource(hypothesis), type: 'hypothesis', opportunityId };
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;AAsC/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,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;AACjD,CAAC;AAED,SAAS,cAAc,CAAC,IAAc;IACpC,MAAM,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AAE,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,CAAA;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAA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 @@
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,EAAE,MAAM,2BAA2B,CAAA;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,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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.1",
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,240 @@
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
+ }
32
+
33
+ export interface Document extends PersistedResource {
34
+ type: 'document',
35
+ hypothesisId: string,
36
+ }
37
+
38
+ export type Artifact = Opportunity | Hypothesis | Document
39
+
40
+ export interface ChatConversionDetails extends ConversationResponse {
41
+ opportunityName?: string,
42
+ hypothesisCount?: number,
43
+ }
44
+
45
+
46
+ const key = 'mock-adp-api'
47
+
48
+ function delay() {
49
+ return new Promise((resolve) => {
50
+ setTimeout(resolve, random(500, 1500))
51
+ })
52
+ }
53
+
54
+ async function load(): Promise<Artifact[]> {
55
+ await delay()
56
+ const fromStorage = localStorage.getItem(key)
57
+ return fromStorage ? JSON.parse(fromStorage) : []
58
+ }
59
+
60
+ async function save(data: Artifact[]) {
61
+ await delay()
62
+ localStorage.setItem(key, JSON.stringify(data))
63
+ }
64
+
65
+ function createResource(data: Resource): Omit<PersistedResource, 'type'> {
66
+ const tokenData = NetworkClient.sessionManager?.getSession().getTokenData()
67
+ return {
68
+ ...data,
69
+ id: `${Math.random()}`,
70
+ createdAt: new Date().toISOString(),
71
+ updatedAt: new Date().toISOString(),
72
+ createdBy: {
73
+ id: tokenData?.account_id_v2 ?? '',
74
+ name: tokenData?.name ?? '',
75
+ },
76
+ }
77
+ }
78
+
79
+ class AdpMockClient extends ReactQueryNetworkClient {
80
+ constructor() {
81
+ super(getApiAddresses().discovery.url, defaults)
82
+ }
83
+
84
+ protected buildStackSpotError(error: any): StackspotAPIError {
85
+ return new StackspotAPIError({ status: 0, message: error?.message })
86
+ }
87
+
88
+ opportunities = this.query({
89
+ name: 'opportunities',
90
+ request: async () => {
91
+ const artifacts = await load()
92
+ return artifacts.filter(a => a.type === 'opportunity') as Opportunity[]
93
+ },
94
+ })
95
+
96
+ opportunity = this.query({
97
+ name: 'opportunity',
98
+ request: async (_abort, { id }: { id: string }) => {
99
+ const artifacts = await load()
100
+ return artifacts.find(a => a.type === 'opportunity' && a.id === id) as Opportunity
101
+ },
102
+ })
103
+
104
+ hypothesis = this.query({
105
+ name: 'hypothesis',
106
+ request: async (_abort, { opportunityId }: { opportunityId: string }) => {
107
+ const artifacts = await load()
108
+ return artifacts.filter(a => a.type === 'hypothesis' && a.opportunityId === opportunityId) as Hypothesis[]
109
+ },
110
+ })
111
+
112
+ hypothesisById = this.query({
113
+ name: 'hypothesisById',
114
+ request: async (_abort, { id }: { id: string }) => {
115
+ const artifacts = await load()
116
+ return artifacts.find(a => a.type === 'hypothesis' && a.id === id) as Hypothesis
117
+ },
118
+ })
119
+
120
+ documents = this.query({
121
+ name: 'documents',
122
+ request: async (_abort, { hypothesisId }: { hypothesisId: string }) => {
123
+ const artifacts = await load()
124
+ return artifacts.filter(a => a.type === 'document' && a.hypothesisId === hypothesisId) as Document[]
125
+ },
126
+ })
127
+
128
+ document = this.query({
129
+ name: 'document',
130
+ request: async (_abort, { id }: { id: string }) => {
131
+ const artifacts = await load()
132
+ return artifacts.find(a => a.type === 'document' && a.id === id) as Document
133
+ },
134
+ })
135
+
136
+ artifacts = this.query({
137
+ name: 'artifacts',
138
+ request: async (_abort, { conversationId }: { conversationId: string }) => {
139
+ const artifacts = await load()
140
+ const opportunities = artifacts.filter(a => a.type === 'opportunity' && a.conversationId === conversationId)
141
+ const hypotheses = artifacts.filter(a => a.type === 'hypothesis' && opportunities.some(o => o.id === a.opportunityId))
142
+ const documents = artifacts.filter(a => a.type === 'document' && hypotheses.some(h => h.id === a.hypothesisId))
143
+ return [...opportunities, ...hypotheses, ...documents]
144
+ },
145
+ })
146
+
147
+ createOpportunity = this.mutation({
148
+ name: 'createOpportunity',
149
+ request: async (_abort, { conversationId, opportunity }: { opportunity: Resource, conversationId: string }) => {
150
+ const artifacts = await load()
151
+ const created: Opportunity = { ...createResource(opportunity), type: 'opportunity', conversationId }
152
+ artifacts.push(created)
153
+ await save(artifacts)
154
+ return created
155
+ },
156
+ })
157
+
158
+ createHypothesis = this.mutation({
159
+ name: 'createHypothesis',
160
+ request: async (_abort, { hypothesis, opportunityId }: { hypothesis: Resource, opportunityId: string }) => {
161
+ const artifacts = await load()
162
+ const created: Hypothesis = { ...createResource(hypothesis), type: 'hypothesis', opportunityId }
163
+ artifacts.push(created)
164
+ await save(artifacts)
165
+ return created
166
+ },
167
+ })
168
+
169
+ createDocument = this.mutation({
170
+ name: 'createDocument',
171
+ request: async (_abort, { document, hypothesisId }: { document: Resource, hypothesisId: string }) => {
172
+ const artifacts = await load()
173
+ const created: Document = { ...createResource(document), type: 'document', hypothesisId }
174
+ artifacts.push(created)
175
+ await save(artifacts)
176
+ return created
177
+ },
178
+ })
179
+
180
+ private deleteArtifact = async (_abort: AbortSignal, { id }: { id: string }) => {
181
+ const artifacts = await load()
182
+ await save(artifacts.filter(a => a.id !== id))
183
+ }
184
+
185
+ deleteOpportunity = this.mutation({
186
+ name: 'deleteOpportunity',
187
+ request: this.deleteArtifact,
188
+ })
189
+
190
+ deleteHypothesis = this.mutation({
191
+ name: 'deleteHypothesis',
192
+ request: this.deleteArtifact,
193
+ })
194
+
195
+ deleteDocument = this.mutation({
196
+ name: 'deleteDocument',
197
+ request: this.deleteArtifact,
198
+ })
199
+
200
+ chats = this.query({
201
+ name: 'chats',
202
+ request: async (_signal, variables: { filter?: string, page?: number, size?: number }) => {
203
+ const artifacts = await load()
204
+
205
+ const groupedByConversionId: Record<string, any[]> = artifacts.reduce(
206
+ (acc, item: any) => {
207
+ if (!acc[item.conversationId]) {
208
+ acc[item.conversationId] = []
209
+ }
210
+ acc[item.conversationId].push(item)
211
+ return acc
212
+ },
213
+ {} as Record<string, any[]>,
214
+ )
215
+
216
+ const chatsHistory = await aiClient.chats.query(
217
+ { ...variables, page: variables.page, size: variables.size ?? 40 },
218
+ )
219
+
220
+ const filteredItems = variables.filter ?
221
+ chatsHistory.filter((chat) => chat.title.toLowerCase().includes(variables.filter!.toLowerCase())) : chatsHistory
222
+
223
+ const enrichedChats = filteredItems?.map(chat => {
224
+ const relatedArtifacts = groupedByConversionId[chat.id]
225
+ const opportunity = relatedArtifacts?.find(a => a.type === 'opportunity')
226
+ const opportunityName = opportunity?.title ?? null
227
+ const hypothesisCount = relatedArtifacts?.filter(a => a.type === 'hypothesis').length ?? 0
228
+
229
+ return {
230
+ ...chat,
231
+ opportunityName,
232
+ hypothesisCount,
233
+ }
234
+ })
235
+ return enrichedChats as ChatConversionDetails[]
236
+ },
237
+ })
238
+ }
239
+
240
+ 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'