@stack-spot/portal-network 1.0.0-betaadp.2 → 1.0.0-dev.1768422812092
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/CHANGELOG.md +633 -0
- package/dist/api/account.d.ts +413 -277
- package/dist/api/account.d.ts.map +1 -1
- package/dist/api/account.js +261 -176
- package/dist/api/account.js.map +1 -1
- package/dist/api/accountAssetManager.d.ts +309 -0
- package/dist/api/accountAssetManager.d.ts.map +1 -0
- package/dist/api/accountAssetManager.js +169 -0
- package/dist/api/accountAssetManager.js.map +1 -0
- package/dist/api/agent-tools.d.ts +243 -149
- package/dist/api/agent-tools.d.ts.map +1 -1
- package/dist/api/agent-tools.js +77 -5
- package/dist/api/agent-tools.js.map +1 -1
- package/dist/api/agent.d.ts +55 -55
- package/dist/api/agent.d.ts.map +1 -1
- package/dist/api/ai.d.ts +487 -98
- package/dist/api/ai.d.ts.map +1 -1
- package/dist/api/ai.js +427 -146
- package/dist/api/ai.js.map +1 -1
- package/dist/api/cloudPlatform.d.ts +374 -221
- package/dist/api/cloudPlatform.d.ts.map +1 -1
- package/dist/api/cloudPlatform.js +299 -93
- package/dist/api/cloudPlatform.js.map +1 -1
- package/dist/api/cloudPlatformHorizon.d.ts +178 -9
- package/dist/api/cloudPlatformHorizon.d.ts.map +1 -1
- package/dist/api/cloudPlatformHorizon.js +69 -1
- package/dist/api/cloudPlatformHorizon.js.map +1 -1
- package/dist/api/codeShift.d.ts +1125 -83
- package/dist/api/codeShift.d.ts.map +1 -1
- package/dist/api/codeShift.js +538 -16
- package/dist/api/codeShift.js.map +1 -1
- package/dist/api/dataIntegration.d.ts +291 -1
- package/dist/api/dataIntegration.d.ts.map +1 -1
- package/dist/api/dataIntegration.js +254 -0
- package/dist/api/dataIntegration.js.map +1 -1
- package/dist/api/discover.d.ts +380 -0
- package/dist/api/discover.d.ts.map +1 -0
- package/dist/api/discover.js +256 -0
- package/dist/api/discover.js.map +1 -0
- package/dist/api/edpBfa.d.ts +215 -0
- package/dist/api/edpBfa.d.ts.map +1 -0
- package/dist/api/edpBfa.js +87 -0
- package/dist/api/edpBfa.js.map +1 -0
- package/dist/api/genAiInference.d.ts +22 -2
- package/dist/api/genAiInference.d.ts.map +1 -1
- package/dist/api/genAiInference.js +22 -3
- package/dist/api/genAiInference.js.map +1 -1
- package/dist/api/workflows.d.ts +68 -5
- package/dist/api/workflows.d.ts.map +1 -1
- package/dist/api/workflows.js +16 -0
- package/dist/api/workflows.js.map +1 -1
- package/dist/api/workspaceManager.d.ts +16 -10
- package/dist/api/workspaceManager.d.ts.map +1 -1
- package/dist/api/workspaceManager.js +10 -0
- package/dist/api/workspaceManager.js.map +1 -1
- package/dist/api-addresses.d.ts +20 -18
- package/dist/api-addresses.d.ts.map +1 -1
- package/dist/api-addresses.js +81 -21
- package/dist/api-addresses.js.map +1 -1
- package/dist/apis-itau.json +241 -0
- package/dist/apis.json +18 -2
- package/dist/client/account-asset-manager.d.ts +112 -0
- package/dist/client/account-asset-manager.d.ts.map +1 -0
- package/dist/client/account-asset-manager.js +160 -0
- package/dist/client/account-asset-manager.js.map +1 -0
- package/dist/client/account.d.ts +265 -242
- package/dist/client/account.d.ts.map +1 -1
- package/dist/client/account.js +80 -34
- package/dist/client/account.js.map +1 -1
- package/dist/client/agent-tools.d.ts +166 -119
- package/dist/client/agent-tools.d.ts.map +1 -1
- package/dist/client/agent-tools.js +62 -11
- package/dist/client/agent-tools.js.map +1 -1
- package/dist/client/agent.d.ts +46 -46
- package/dist/client/agent.d.ts.map +1 -1
- package/dist/client/ai.d.ts +266 -79
- package/dist/client/ai.d.ts.map +1 -1
- package/dist/client/ai.js +262 -20
- package/dist/client/ai.js.map +1 -1
- package/dist/client/api-management.d.ts +10 -1
- package/dist/client/api-management.d.ts.map +1 -1
- package/dist/client/api-management.js +11 -2
- package/dist/client/api-management.js.map +1 -1
- package/dist/client/cloud-account.d.ts +13 -13
- package/dist/client/cloud-platform-horizon.d.ts +38 -19
- package/dist/client/cloud-platform-horizon.d.ts.map +1 -1
- package/dist/client/cloud-platform-horizon.js +19 -1
- package/dist/client/cloud-platform-horizon.js.map +1 -1
- package/dist/client/cloud-platform.d.ts +213 -46
- package/dist/client/cloud-platform.d.ts.map +1 -1
- package/dist/client/cloud-platform.js +168 -33
- package/dist/client/cloud-platform.js.map +1 -1
- package/dist/client/cloud-runtimes.d.ts +4 -4
- package/dist/client/cloud-services.d.ts +17 -17
- package/dist/client/cloud-services.d.ts.map +1 -1
- package/dist/client/code-shift.d.ts +535 -162
- package/dist/client/code-shift.d.ts.map +1 -1
- package/dist/client/code-shift.js +296 -7
- package/dist/client/code-shift.js.map +1 -1
- package/dist/client/content.d.ts +127 -132
- package/dist/client/content.d.ts.map +1 -1
- package/dist/client/data-integration.d.ts +92 -53
- package/dist/client/data-integration.d.ts.map +1 -1
- package/dist/client/data-integration.js +38 -2
- package/dist/client/data-integration.js.map +1 -1
- package/dist/client/discover.d.ts +84 -0
- package/dist/client/discover.d.ts.map +1 -0
- package/dist/client/discover.js +359 -0
- package/dist/client/discover.js.map +1 -0
- package/dist/client/edp-bfa.d.ts +16 -0
- package/dist/client/edp-bfa.d.ts.map +1 -0
- package/dist/client/edp-bfa.js +24 -0
- package/dist/client/edp-bfa.js.map +1 -0
- package/dist/client/event-bus.d.ts.map +1 -1
- package/dist/client/gen-ai-inference.d.ts +20 -20
- package/dist/client/insights.d.ts +7 -7
- package/dist/client/notification.d.ts +17 -10
- package/dist/client/notification.d.ts.map +1 -1
- package/dist/client/notification.js +10 -1
- package/dist/client/notification.js.map +1 -1
- package/dist/client/runtime-manager.d.ts +8 -8
- package/dist/client/secrets.d.ts.map +1 -1
- package/dist/client/secrets.js +1 -1
- package/dist/client/secrets.js.map +1 -1
- package/dist/client/types.d.ts +50 -7
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/workflow.d.ts +10 -10
- package/dist/client/workspace-ai.d.ts +53 -53
- package/dist/client/workspace-ai.d.ts.map +1 -1
- package/dist/client/workspace-ai.js +3 -7
- package/dist/client/workspace-ai.js.map +1 -1
- package/dist/client/workspace-manager.d.ts +115 -76
- package/dist/client/workspace-manager.d.ts.map +1 -1
- package/dist/client/workspace-manager.js +47 -2
- package/dist/client/workspace-manager.js.map +1 -1
- package/dist/client/workspace-search.d.ts +2 -2
- package/dist/client/workspace.d.ts +58 -105
- package/dist/client/workspace.d.ts.map +1 -1
- package/dist/error/DefaultAPIError.d.ts.map +1 -1
- package/dist/error/DefaultAPIError.js.map +1 -1
- package/dist/error/StackspotAPIError.d.ts +3 -4
- package/dist/error/StackspotAPIError.d.ts.map +1 -1
- package/dist/error/StackspotAPIError.js +3 -3
- package/dist/error/StackspotAPIError.js.map +1 -1
- package/dist/error/dictionary/accountAssetManager.d.ts +11 -0
- package/dist/error/dictionary/accountAssetManager.d.ts.map +1 -0
- package/dist/error/dictionary/accountAssetManager.js +11 -0
- package/dist/error/dictionary/accountAssetManager.js.map +1 -0
- package/dist/error/dictionary/cloud-platform.d.ts +76 -8
- package/dist/error/dictionary/cloud-platform.d.ts.map +1 -1
- package/dist/error/dictionary/cloud-platform.js +80 -12
- package/dist/error/dictionary/cloud-platform.js.map +1 -1
- package/dist/error/dictionary/workspace-ai.d.ts +9 -0
- package/dist/error/dictionary/workspace-ai.d.ts.map +1 -0
- package/dist/error/dictionary/workspace-ai.js +9 -0
- package/dist/error/dictionary/workspace-ai.js.map +1 -0
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/network/NetworkClient.d.ts +4 -2
- package/dist/network/NetworkClient.d.ts.map +1 -1
- package/dist/network/NetworkClient.js +16 -4
- package/dist/network/NetworkClient.js.map +1 -1
- package/dist/network/types.d.ts +2 -0
- package/dist/network/types.d.ts.map +1 -1
- package/dist/utils/StreamedJson.d.ts +3 -1
- package/dist/utils/StreamedJson.d.ts.map +1 -1
- package/dist/utils/StreamedJson.js +23 -3
- package/dist/utils/StreamedJson.js.map +1 -1
- package/package.dev.json +3 -0
- package/package.json +10 -9
- package/package.stg.json +3 -0
- package/readme.md +40 -1
- package/src/api/account.ts +701 -540
- package/src/api/accountAssetManager.ts +771 -0
- package/src/api/agent-tools.ts +332 -151
- package/src/api/ai.ts +891 -170
- package/src/api/cloudPlatform.ts +667 -298
- package/src/api/cloudPlatformHorizon.ts +412 -9
- package/src/api/codeShift.ts +2088 -97
- package/src/api/dataIntegration.ts +635 -1
- package/src/api/discover.ts +601 -0
- package/src/api/edpBfa.ts +472 -0
- package/src/api/genAiInference.ts +47 -4
- package/src/api/workflows.ts +100 -5
- package/src/api/workspaceManager.ts +25 -10
- package/src/api-addresses.ts +113 -38
- package/src/apis-itau.json +241 -0
- package/src/apis.json +18 -2
- package/src/client/account-asset-manager.ts +100 -0
- package/src/client/account.ts +71 -40
- package/src/client/agent-tools.ts +57 -17
- package/src/client/ai.ts +232 -20
- package/src/client/api-management.ts +7 -2
- package/src/client/cloud-platform-horizon.ts +12 -4
- package/src/client/cloud-platform.ts +101 -27
- package/src/client/code-shift.ts +196 -8
- package/src/client/data-integration.ts +28 -1
- package/src/client/discover.ts +319 -0
- package/src/client/edp-bfa.ts +24 -0
- package/src/client/notification.ts +6 -1
- package/src/client/secrets.ts +1 -1
- package/src/client/types.ts +55 -9
- package/src/client/workspace-ai.ts +19 -23
- package/src/client/workspace-manager.ts +31 -2
- package/src/error/DefaultAPIError.ts +5 -5
- package/src/error/StackspotAPIError.ts +4 -4
- package/src/error/dictionary/accountAssetManager.ts +12 -0
- package/src/error/dictionary/cloud-platform.ts +80 -12
- package/src/error/dictionary/workspace-ai.ts +10 -0
- package/src/index.ts +7 -4
- package/src/network/NetworkClient.ts +18 -6
- package/src/network/types.ts +3 -0
- package/src/utils/StreamedJson.tsx +19 -4
- package/dist/api/discovery.d.ts +0 -494
- package/dist/api/discovery.d.ts.map +0 -1
- package/dist/api/discovery.js +0 -205
- package/dist/api/discovery.js.map +0 -1
- package/dist/client/adp-mock.d.ts +0 -89
- package/dist/client/adp-mock.d.ts.map +0 -1
- package/dist/client/adp-mock.js +0 -246
- package/dist/client/adp-mock.js.map +0 -1
- package/dist/client/discovery.d.ts +0 -110
- package/dist/client/discovery.d.ts.map +0 -1
- package/dist/client/discovery.js +0 -133
- package/dist/client/discovery.js.map +0 -1
- package/src/api/discovery.ts +0 -729
- package/src/client/adp-mock.ts +0 -244
- package/src/client/discovery.ts +0 -73
package/src/client/adp-mock.ts
DELETED
|
@@ -1,244 +0,0 @@
|
|
|
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/client/discovery.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { HttpError } from '@oazapfts/runtime'
|
|
2
|
-
import { attach, createHypothesis, defaults, deleteV1DocumentsByDocumentIdHypothesesAndHypothesisNumber, download, findHypothesisByNumber, getAll, getById, list1, list2, listAllDocumentsWithHypotheses, listHypothesis, listVersions, upload } from '../api/discovery'
|
|
3
|
-
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
4
|
-
import { baseDictionary } from '../error/dictionary/base'
|
|
5
|
-
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
6
|
-
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
7
|
-
import { removeAuthorizationParam } from '../utils/remove-authorization-param'
|
|
8
|
-
import { getApiAddresses } from '../api-addresses'
|
|
9
|
-
|
|
10
|
-
class DiscoveryClient extends ReactQueryNetworkClient {
|
|
11
|
-
|
|
12
|
-
constructor() {
|
|
13
|
-
super(getApiAddresses().discovery.url, defaults)
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
protected buildStackSpotError(error: HttpError): StackspotAPIError {
|
|
17
|
-
return new DefaultAPIError(error.data, error.status, baseDictionary, error.headers)
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Get list of hypotheses
|
|
21
|
-
*/
|
|
22
|
-
listHypotheses = this.query(listHypothesis)
|
|
23
|
-
/**
|
|
24
|
-
* Get details of an hypothesis by id
|
|
25
|
-
*/
|
|
26
|
-
getHypothesisById = this.query(findHypothesisByNumber)
|
|
27
|
-
/**
|
|
28
|
-
* Get list of hypothesis documents
|
|
29
|
-
*/
|
|
30
|
-
listDocumentsByHypothesis = this.query(list2)
|
|
31
|
-
/**
|
|
32
|
-
* Get list of all documents
|
|
33
|
-
*/
|
|
34
|
-
listAllDocuments = this.query(listAllDocumentsWithHypotheses)
|
|
35
|
-
/**
|
|
36
|
-
* Get document details by id
|
|
37
|
-
*/
|
|
38
|
-
getDocumentById = this.query(getById)
|
|
39
|
-
/**
|
|
40
|
-
* Get list of opportunities
|
|
41
|
-
*/
|
|
42
|
-
listOpportunities = this.query(list1)
|
|
43
|
-
/**
|
|
44
|
-
* Get list of document types
|
|
45
|
-
*/
|
|
46
|
-
listDocumentTypes = this.query(getAll)
|
|
47
|
-
/**
|
|
48
|
-
* Create an hypothesis
|
|
49
|
-
*/
|
|
50
|
-
createHypothesis = this.mutation(removeAuthorizationParam(createHypothesis))
|
|
51
|
-
/**
|
|
52
|
-
* Create an document
|
|
53
|
-
*/
|
|
54
|
-
createDocument = this.mutation(removeAuthorizationParam(upload))
|
|
55
|
-
/**
|
|
56
|
-
* Attach a existing document in an hypothesis
|
|
57
|
-
*/
|
|
58
|
-
attachExistingDocument = this.mutation(removeAuthorizationParam(attach))
|
|
59
|
-
/**
|
|
60
|
-
* Delete an document
|
|
61
|
-
*/
|
|
62
|
-
deleteDocument = this.mutation(removeAuthorizationParam(deleteV1DocumentsByDocumentIdHypothesesAndHypothesisNumber))
|
|
63
|
-
/**
|
|
64
|
-
* Download an document
|
|
65
|
-
*/
|
|
66
|
-
downloadDocument = this.query(removeAuthorizationParam(download))
|
|
67
|
-
/**
|
|
68
|
-
* List versions of a document
|
|
69
|
-
*/
|
|
70
|
-
listDocumentVersions = this.query(removeAuthorizationParam(listVersions))
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export const discoveryClient = new DiscoveryClient()
|