@stack-spot/portal-network 0.184.0 → 0.185.0-beta.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/CHANGELOG.md +2444 -2412
- package/dist/api/account.js +1 -1
- package/dist/api/agent-tools.js +1 -1
- package/dist/api/agent.js +1 -1
- package/dist/api/ai.js +1 -1
- package/dist/api/apiManagement.js +1 -1
- package/dist/api/apiRuntime.js +1 -1
- package/dist/api/cloudAccount.js +1 -1
- package/dist/api/cloudPlatform.js +1 -1
- package/dist/api/cloudPlatformHorizon.js +1 -1
- package/dist/api/cloudRuntimes.js +1 -1
- package/dist/api/cloudServices.js +1 -1
- package/dist/api/codeShift.d.ts +63 -4
- package/dist/api/codeShift.d.ts.map +1 -1
- package/dist/api/codeShift.js +14 -1
- package/dist/api/codeShift.js.map +1 -1
- package/dist/api/content.js +1 -1
- package/dist/api/dataIntegration.js +1 -1
- package/dist/api/discover.js +1 -1
- package/dist/api/genAiInference.js +1 -1
- package/dist/api/insights.js +1 -1
- package/dist/api/notification.js +1 -1
- package/dist/api/secrets.js +1 -1
- package/dist/api/serviceCatalog.js +1 -1
- package/dist/api/workspace-ai.js +1 -1
- package/dist/api/workspace.js +1 -1
- package/dist/api/workspaceManager.js +1 -1
- package/dist/api/workspaceSearchEngine.js +1 -1
- package/dist/client/ai.d.ts.map +1 -1
- package/dist/client/ai.js +84 -14
- package/dist/client/ai.js.map +1 -1
- package/dist/client/code-shift.d.ts +30 -0
- package/dist/client/code-shift.d.ts.map +1 -1
- package/dist/client/code-shift.js +37 -1
- package/dist/client/code-shift.js.map +1 -1
- package/dist/client/types.d.ts +26 -6
- package/dist/client/types.d.ts.map +1 -1
- package/package.json +7 -7
- package/readme.md +1 -1
- package/scripts/generate-apis.ts +134 -134
- package/src/api/account.ts +8368 -8367
- package/src/api/agent-tools.ts +2172 -2169
- package/src/api/agent.ts +1085 -1083
- package/src/api/ai.ts +3388 -3388
- package/src/api/apiManagement.ts +570 -570
- package/src/api/apiRuntime.ts +2103 -2103
- package/src/api/cloudAccount.ts +1239 -1239
- package/src/api/cloudPlatform.ts +927 -927
- package/src/api/cloudPlatformHorizon.ts +2655 -2655
- package/src/api/cloudRuntimes.ts +2043 -2043
- package/src/api/cloudServices.ts +1445 -1445
- package/src/api/codeShift.ts +3567 -3481
- package/src/api/content.ts +9785 -9785
- package/src/api/dataIntegration.ts +1657 -1657
- package/src/api/discover.ts +435 -435
- package/src/api/eventBus.ts +171 -171
- package/src/api/genAiInference.ts +603 -603
- package/src/api/insights.ts +310 -310
- package/src/api/notification.ts +336 -334
- package/src/api/secrets.ts +342 -342
- package/src/api/serviceCatalog.ts +2908 -2908
- package/src/api/workflows.ts +1669 -1669
- package/src/api/workspace-ai.ts +677 -677
- package/src/api/workspace.ts +5889 -5889
- package/src/api/workspaceManager.ts +2951 -2951
- package/src/api/workspaceSearchEngine.ts +153 -153
- package/src/api-addresses.ts +120 -120
- package/src/apis-itau.json +225 -225
- package/src/apis.json +225 -225
- package/src/client/account.ts +902 -902
- package/src/client/agent-tools.ts +210 -210
- package/src/client/agent.ts +81 -81
- package/src/client/ai.ts +469 -395
- package/src/client/api-management.ts +40 -40
- package/src/client/cloud-account.ts +70 -70
- package/src/client/cloud-platform-horizon.ts +113 -113
- package/src/client/cloud-platform.ts +163 -163
- package/src/client/cloud-runtimes.ts +129 -129
- package/src/client/cloud-services.ts +94 -94
- package/src/client/code-shift.ts +371 -349
- package/src/client/content.ts +538 -538
- package/src/client/data-integration.ts +191 -191
- package/src/client/discover.ts +89 -89
- package/src/client/event-bus.ts +84 -84
- package/src/client/gen-ai-inference.ts +65 -65
- package/src/client/insights.ts +28 -28
- package/src/client/notification.ts +32 -32
- package/src/client/runtime-manager.ts +76 -76
- package/src/client/secrets.ts +60 -60
- package/src/client/types.ts +398 -377
- package/src/client/workflow.ts +83 -83
- package/src/client/workspace-ai.ts +191 -191
- package/src/client/workspace-manager.ts +564 -564
- package/src/client/workspace-search.ts +39 -39
- package/src/client/workspace.ts +480 -480
- package/src/error/DefaultAPIError.ts +151 -151
- package/src/error/FileUploadError.ts +18 -18
- package/src/error/IgnoredErrorCodes.ts +3 -3
- package/src/error/StackspotAPIError.ts +101 -101
- package/src/error/StreamCanceledError.ts +10 -10
- package/src/error/StreamError.ts +7 -7
- package/src/error/StreamJsonError.ts +10 -10
- package/src/error/dictionary/account.ts +58 -58
- package/src/error/dictionary/action-details.ts +20 -20
- package/src/error/dictionary/action.ts +211 -211
- package/src/error/dictionary/agent-tools.ts +75 -75
- package/src/error/dictionary/ai-inference.ts +28 -28
- package/src/error/dictionary/base.ts +22 -22
- package/src/error/dictionary/cloud-platform.ts +82 -82
- package/src/error/dictionary/cnt-fields.ts +14 -14
- package/src/error/dictionary/cnt.ts +103 -103
- package/src/error/dictionary/code-shift.ts +12 -12
- package/src/error/dictionary/rte.ts +24 -24
- package/src/error/dictionary/rtm.ts +10 -10
- package/src/error/dictionary/secrets.ts +14 -14
- package/src/error/dictionary/workspace-ai.ts +10 -10
- package/src/error/dictionary/workspace-details.ts +15 -15
- package/src/error/dictionary/workspace-fields.ts +10 -10
- package/src/error/dictionary/workspace.ts +209 -209
- package/src/error/types.ts +21 -21
- package/src/index.ts +43 -43
- package/src/network/AutoInfiniteQuery.ts +115 -115
- package/src/network/AutoMutation.ts +27 -27
- package/src/network/AutoOperation.ts +73 -73
- package/src/network/AutoQuery.ts +75 -75
- package/src/network/ManualInfiniteQuery.ts +95 -95
- package/src/network/ManualMutation.ts +40 -40
- package/src/network/ManualOperation.ts +52 -52
- package/src/network/ManualQuery.ts +82 -82
- package/src/network/NetworkClient.ts +167 -167
- package/src/network/ReactQueryNetworkClient.ts +312 -312
- package/src/network/react-query-client.ts +14 -14
- package/src/network/types.ts +294 -294
- package/src/types.ts +1 -1
- package/src/utils/StreamedArray.tsx +146 -146
- package/src/utils/StreamedJson.tsx +166 -166
- package/src/utils/remove-authorization-param.ts +6 -6
- package/src/utils/string.ts +19 -19
- package/src/utils/use-extended-list.ts +80 -80
- package/src/utils/use-streamed-array.ts +17 -17
- package/tsconfig.build.json +4 -4
- package/tsconfig.json +10 -10
|
@@ -1,191 +1,191 @@
|
|
|
1
|
-
import { HttpError } from '@oazapfts/runtime'
|
|
2
|
-
import {
|
|
3
|
-
addFavoriteV1KnowledgeSourcesSlugFavoritePost,
|
|
4
|
-
createKsV1KnowledgeSourcesPost,
|
|
5
|
-
defaults,
|
|
6
|
-
deleteFavoriteV1KnowledgeSourcesSlugFavoriteDelete,
|
|
7
|
-
deleteKoByIdV1KnowledgeSourcesKsSlugObjectsKoIdDelete,
|
|
8
|
-
FileUploadType,
|
|
9
|
-
findKoByIdV1KnowledgeSourcesKsSlugObjectsKoIdGet,
|
|
10
|
-
findKsV1KnowledgeSourcesSlugGet,
|
|
11
|
-
forkKsV1KnowledgeSourcesSlugForkPost,
|
|
12
|
-
getFileUploadStatusV1FileUploadFileUploadIdGet,
|
|
13
|
-
getIndexedFilesV1KnowledgeSourcesKsSlugFilesGet,
|
|
14
|
-
getUploadFormV1FileUploadFormPost,
|
|
15
|
-
getUploadFormV2V2FileUploadFormPost,
|
|
16
|
-
listKosV1KnowledgeSourcesKsSlugObjectsGet,
|
|
17
|
-
listKsV1KnowledgeSourcesGet,
|
|
18
|
-
publishKsV1KnowledgeSourcesSlugPublishPost,
|
|
19
|
-
resetKosV1KnowledgeSourcesKsSlugObjectsDelete,
|
|
20
|
-
saveChunkedFilesDeprecatedV1FileUploadFileUploadIdPost,
|
|
21
|
-
saveChunkedFilesV1FileUploadFileUploadIdKnowledgeObjectsPost,
|
|
22
|
-
searchKsV1KnowledgeSourcesSearchPost,
|
|
23
|
-
searchObjectsV1SearchPost,
|
|
24
|
-
shareKsV1KnowledgeSourcesSlugSharePost,
|
|
25
|
-
splitUploadedFilePreviewV1FileUploadFileUploadIdSplitPreviewSplitStrategyGet,
|
|
26
|
-
splitUploadedFileV1FileUploadFileUploadIdSplitPost,
|
|
27
|
-
updateKsV1KnowledgeSourcesSlugPatch,
|
|
28
|
-
} from '../api/dataIntegration'
|
|
29
|
-
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
30
|
-
import { baseDictionary } from '../error/dictionary/base'
|
|
31
|
-
import { FileUploadError } from '../error/FileUploadError'
|
|
32
|
-
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
33
|
-
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
34
|
-
import { removeAuthorizationParam } from '../utils/remove-authorization-param'
|
|
35
|
-
import { getApiAddresses } from '../api-addresses'
|
|
36
|
-
|
|
37
|
-
class DataIntegrationClient extends ReactQueryNetworkClient {
|
|
38
|
-
constructor() {
|
|
39
|
-
super(getApiAddresses().dataIntegration.url, defaults)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
protected buildStackSpotError(error: HttpError): StackspotAPIError {
|
|
43
|
-
return new DefaultAPIError(error.data, error.status, baseDictionary, error.headers)
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Generates a url to upload the file
|
|
47
|
-
*/
|
|
48
|
-
generateUrlToFileUpload = this.mutation(removeAuthorizationParam(getUploadFormV2V2FileUploadFormPost))
|
|
49
|
-
/**
|
|
50
|
-
* Get file processing status by id
|
|
51
|
-
*/
|
|
52
|
-
getFileProcessingStatusById = this.query(removeAuthorizationParam(getFileUploadStatusV1FileUploadFileUploadIdGet))
|
|
53
|
-
/**
|
|
54
|
-
* @deprecated Use saveChunkedKnowledgeObjects instead.
|
|
55
|
-
* Save the splitted knowledge objects
|
|
56
|
-
*/
|
|
57
|
-
saveKnowledgeObjects = this.mutation(removeAuthorizationParam(saveChunkedFilesDeprecatedV1FileUploadFileUploadIdPost))
|
|
58
|
-
/**
|
|
59
|
-
* Save the splitted knowledge objects
|
|
60
|
-
*/
|
|
61
|
-
saveChunkedKnowledgeObjects = this.mutation(removeAuthorizationParam(saveChunkedFilesV1FileUploadFileUploadIdKnowledgeObjectsPost))
|
|
62
|
-
/**
|
|
63
|
-
* Splits the file with the passed settings
|
|
64
|
-
*/
|
|
65
|
-
splitFile = this.mutation(removeAuthorizationParam(splitUploadedFileV1FileUploadFileUploadIdSplitPost))
|
|
66
|
-
/**
|
|
67
|
-
* Generate a preview with splitted objects
|
|
68
|
-
*/
|
|
69
|
-
streamPreviewFromSplit(
|
|
70
|
-
fileUploadId: string,
|
|
71
|
-
splitStrategy: string,
|
|
72
|
-
options?: { signal?: AbortSignal },
|
|
73
|
-
) {
|
|
74
|
-
const url = `/v1/file-upload/${fileUploadId}/split/preview/${splitStrategy}`
|
|
75
|
-
|
|
76
|
-
return this.stream(this.resolveURL(url), {
|
|
77
|
-
method: 'GET',
|
|
78
|
-
headers: {
|
|
79
|
-
'Content-Type': 'application/json',
|
|
80
|
-
'Accept': 'text/event-stream',
|
|
81
|
-
},
|
|
82
|
-
signal: options?.signal,
|
|
83
|
-
})
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Generate a preview with splitted objects
|
|
87
|
-
*/
|
|
88
|
-
previewFromSplit = this.query(removeAuthorizationParam(splitUploadedFilePreviewV1FileUploadFileUploadIdSplitPreviewSplitStrategyGet))
|
|
89
|
-
/**
|
|
90
|
-
* List of knowledge sources
|
|
91
|
-
*/
|
|
92
|
-
knowledgeSources = this.query(removeAuthorizationParam(listKsV1KnowledgeSourcesGet))
|
|
93
|
-
/**
|
|
94
|
-
* Adds the resource of type Knowledge Source to the list of favorites.
|
|
95
|
-
*/
|
|
96
|
-
addFavoriteKnowledgeSource = this.mutation(removeAuthorizationParam(addFavoriteV1KnowledgeSourcesSlugFavoritePost))
|
|
97
|
-
/**
|
|
98
|
-
* Removes the resource of type Knowledge Source from the list of favorites.
|
|
99
|
-
*/
|
|
100
|
-
removeFavoriteKnowledgeSource = this.mutation(removeAuthorizationParam(deleteFavoriteV1KnowledgeSourcesSlugFavoriteDelete))
|
|
101
|
-
/**
|
|
102
|
-
* List knowledge objects from a knowledge source
|
|
103
|
-
*/
|
|
104
|
-
listKnowledgeObjects = this.query(removeAuthorizationParam(listKosV1KnowledgeSourcesKsSlugObjectsGet))
|
|
105
|
-
/**
|
|
106
|
-
* Get a knowledge object by id
|
|
107
|
-
*/
|
|
108
|
-
getKnowledgeObjectById = this.query(removeAuthorizationParam(findKoByIdV1KnowledgeSourcesKsSlugObjectsKoIdGet))
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
uploadFiles = this.mutation({
|
|
112
|
-
name: 'uploadFiles',
|
|
113
|
-
request: (abortSignal, params: { files: File[], type: FileUploadType, targetId?: string }) => (
|
|
114
|
-
Promise.all(params.files.map(async (f) => {
|
|
115
|
-
try {
|
|
116
|
-
const { id, url, form } = await getUploadFormV2V2FileUploadFormPost({
|
|
117
|
-
authorization: '',
|
|
118
|
-
newFileUploadRequest: { file_name: f.name, target_type: params.type, target_id: params.targetId ?? '' },
|
|
119
|
-
}, { signal: abortSignal })
|
|
120
|
-
const formData = new FormData()
|
|
121
|
-
Object.entries(form).forEach(([key, value]) => {
|
|
122
|
-
formData.append(key, value)
|
|
123
|
-
})
|
|
124
|
-
formData.append('file', f)
|
|
125
|
-
const response = await fetch(url, { method: 'post', body: formData, signal: abortSignal })
|
|
126
|
-
if (!response.ok) throw new StackspotAPIError({ status: response.status, headers: response.headers, message: 'Failed to upload' })
|
|
127
|
-
return id
|
|
128
|
-
} catch (e: any) {
|
|
129
|
-
throw new FileUploadError(f.name, e)
|
|
130
|
-
}
|
|
131
|
-
}))
|
|
132
|
-
),
|
|
133
|
-
})
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Uploads a KO file
|
|
137
|
-
*/
|
|
138
|
-
fileUploadFormKnowledgeObject = this.mutation(
|
|
139
|
-
removeAuthorizationParam(getUploadFormV1FileUploadFormPost))
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Create Ks
|
|
143
|
-
*/
|
|
144
|
-
createKnowledgeSource = this.mutation(removeAuthorizationParam(createKsV1KnowledgeSourcesPost))
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Search Ks
|
|
148
|
-
*/
|
|
149
|
-
listKnowledgeSourcesDataByIds = this.query(removeAuthorizationParam(searchKsV1KnowledgeSourcesSearchPost))
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Gets a knowledge source by its slug.
|
|
153
|
-
*/
|
|
154
|
-
findKnowledgeSourceBySlug = this.query(removeAuthorizationParam(findKsV1KnowledgeSourcesSlugGet))
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* Search Objects
|
|
158
|
-
*/
|
|
159
|
-
searchObjects = this.mutation(removeAuthorizationParam(searchObjectsV1SearchPost))
|
|
160
|
-
/**
|
|
161
|
-
* Update Knowledge Source
|
|
162
|
-
*/
|
|
163
|
-
updateKnowledgeSource = this.mutation(removeAuthorizationParam(updateKsV1KnowledgeSourcesSlugPatch))
|
|
164
|
-
/**
|
|
165
|
-
* Share Knowledge Source
|
|
166
|
-
*/
|
|
167
|
-
shareKnowledgeSource = this.mutation(removeAuthorizationParam(shareKsV1KnowledgeSourcesSlugSharePost))
|
|
168
|
-
/**
|
|
169
|
-
* Publish Knowledge Source
|
|
170
|
-
*/
|
|
171
|
-
publishKnowledgeSource = this.mutation(removeAuthorizationParam(publishKsV1KnowledgeSourcesSlugPublishPost))
|
|
172
|
-
/**
|
|
173
|
-
* Fork Knowledge Source
|
|
174
|
-
*/
|
|
175
|
-
forkKnowledgeSource = this.mutation(removeAuthorizationParam(forkKsV1KnowledgeSourcesSlugForkPost))
|
|
176
|
-
/**
|
|
177
|
-
* Delete Knowledge Objects by Standalone
|
|
178
|
-
*/
|
|
179
|
-
deleteKnowledgeObjectsByStandalone = this.mutation(removeAuthorizationParam(resetKosV1KnowledgeSourcesKsSlugObjectsDelete))
|
|
180
|
-
/**
|
|
181
|
-
* Delete Knowledge Object from Knowledge Source
|
|
182
|
-
*/
|
|
183
|
-
deleteKnowledgeObjectFromKnowledgeSource = this.mutation(removeAuthorizationParam(deleteKoByIdV1KnowledgeSourcesKsSlugObjectsKoIdDelete))
|
|
184
|
-
/**
|
|
185
|
-
* Get Indexed Files
|
|
186
|
-
*/
|
|
187
|
-
listIndexedProjectFiles = this.query(removeAuthorizationParam(getIndexedFilesV1KnowledgeSourcesKsSlugFilesGet))
|
|
188
|
-
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
export const dataIntegrationClient = new DataIntegrationClient()
|
|
1
|
+
import { HttpError } from '@oazapfts/runtime'
|
|
2
|
+
import {
|
|
3
|
+
addFavoriteV1KnowledgeSourcesSlugFavoritePost,
|
|
4
|
+
createKsV1KnowledgeSourcesPost,
|
|
5
|
+
defaults,
|
|
6
|
+
deleteFavoriteV1KnowledgeSourcesSlugFavoriteDelete,
|
|
7
|
+
deleteKoByIdV1KnowledgeSourcesKsSlugObjectsKoIdDelete,
|
|
8
|
+
FileUploadType,
|
|
9
|
+
findKoByIdV1KnowledgeSourcesKsSlugObjectsKoIdGet,
|
|
10
|
+
findKsV1KnowledgeSourcesSlugGet,
|
|
11
|
+
forkKsV1KnowledgeSourcesSlugForkPost,
|
|
12
|
+
getFileUploadStatusV1FileUploadFileUploadIdGet,
|
|
13
|
+
getIndexedFilesV1KnowledgeSourcesKsSlugFilesGet,
|
|
14
|
+
getUploadFormV1FileUploadFormPost,
|
|
15
|
+
getUploadFormV2V2FileUploadFormPost,
|
|
16
|
+
listKosV1KnowledgeSourcesKsSlugObjectsGet,
|
|
17
|
+
listKsV1KnowledgeSourcesGet,
|
|
18
|
+
publishKsV1KnowledgeSourcesSlugPublishPost,
|
|
19
|
+
resetKosV1KnowledgeSourcesKsSlugObjectsDelete,
|
|
20
|
+
saveChunkedFilesDeprecatedV1FileUploadFileUploadIdPost,
|
|
21
|
+
saveChunkedFilesV1FileUploadFileUploadIdKnowledgeObjectsPost,
|
|
22
|
+
searchKsV1KnowledgeSourcesSearchPost,
|
|
23
|
+
searchObjectsV1SearchPost,
|
|
24
|
+
shareKsV1KnowledgeSourcesSlugSharePost,
|
|
25
|
+
splitUploadedFilePreviewV1FileUploadFileUploadIdSplitPreviewSplitStrategyGet,
|
|
26
|
+
splitUploadedFileV1FileUploadFileUploadIdSplitPost,
|
|
27
|
+
updateKsV1KnowledgeSourcesSlugPatch,
|
|
28
|
+
} from '../api/dataIntegration'
|
|
29
|
+
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
30
|
+
import { baseDictionary } from '../error/dictionary/base'
|
|
31
|
+
import { FileUploadError } from '../error/FileUploadError'
|
|
32
|
+
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
33
|
+
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
34
|
+
import { removeAuthorizationParam } from '../utils/remove-authorization-param'
|
|
35
|
+
import { getApiAddresses } from '../api-addresses'
|
|
36
|
+
|
|
37
|
+
class DataIntegrationClient extends ReactQueryNetworkClient {
|
|
38
|
+
constructor() {
|
|
39
|
+
super(getApiAddresses().dataIntegration.url, defaults)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
protected buildStackSpotError(error: HttpError): StackspotAPIError {
|
|
43
|
+
return new DefaultAPIError(error.data, error.status, baseDictionary, error.headers)
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Generates a url to upload the file
|
|
47
|
+
*/
|
|
48
|
+
generateUrlToFileUpload = this.mutation(removeAuthorizationParam(getUploadFormV2V2FileUploadFormPost))
|
|
49
|
+
/**
|
|
50
|
+
* Get file processing status by id
|
|
51
|
+
*/
|
|
52
|
+
getFileProcessingStatusById = this.query(removeAuthorizationParam(getFileUploadStatusV1FileUploadFileUploadIdGet))
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated Use saveChunkedKnowledgeObjects instead.
|
|
55
|
+
* Save the splitted knowledge objects
|
|
56
|
+
*/
|
|
57
|
+
saveKnowledgeObjects = this.mutation(removeAuthorizationParam(saveChunkedFilesDeprecatedV1FileUploadFileUploadIdPost))
|
|
58
|
+
/**
|
|
59
|
+
* Save the splitted knowledge objects
|
|
60
|
+
*/
|
|
61
|
+
saveChunkedKnowledgeObjects = this.mutation(removeAuthorizationParam(saveChunkedFilesV1FileUploadFileUploadIdKnowledgeObjectsPost))
|
|
62
|
+
/**
|
|
63
|
+
* Splits the file with the passed settings
|
|
64
|
+
*/
|
|
65
|
+
splitFile = this.mutation(removeAuthorizationParam(splitUploadedFileV1FileUploadFileUploadIdSplitPost))
|
|
66
|
+
/**
|
|
67
|
+
* Generate a preview with splitted objects
|
|
68
|
+
*/
|
|
69
|
+
streamPreviewFromSplit(
|
|
70
|
+
fileUploadId: string,
|
|
71
|
+
splitStrategy: string,
|
|
72
|
+
options?: { signal?: AbortSignal },
|
|
73
|
+
) {
|
|
74
|
+
const url = `/v1/file-upload/${fileUploadId}/split/preview/${splitStrategy}`
|
|
75
|
+
|
|
76
|
+
return this.stream(this.resolveURL(url), {
|
|
77
|
+
method: 'GET',
|
|
78
|
+
headers: {
|
|
79
|
+
'Content-Type': 'application/json',
|
|
80
|
+
'Accept': 'text/event-stream',
|
|
81
|
+
},
|
|
82
|
+
signal: options?.signal,
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Generate a preview with splitted objects
|
|
87
|
+
*/
|
|
88
|
+
previewFromSplit = this.query(removeAuthorizationParam(splitUploadedFilePreviewV1FileUploadFileUploadIdSplitPreviewSplitStrategyGet))
|
|
89
|
+
/**
|
|
90
|
+
* List of knowledge sources
|
|
91
|
+
*/
|
|
92
|
+
knowledgeSources = this.query(removeAuthorizationParam(listKsV1KnowledgeSourcesGet))
|
|
93
|
+
/**
|
|
94
|
+
* Adds the resource of type Knowledge Source to the list of favorites.
|
|
95
|
+
*/
|
|
96
|
+
addFavoriteKnowledgeSource = this.mutation(removeAuthorizationParam(addFavoriteV1KnowledgeSourcesSlugFavoritePost))
|
|
97
|
+
/**
|
|
98
|
+
* Removes the resource of type Knowledge Source from the list of favorites.
|
|
99
|
+
*/
|
|
100
|
+
removeFavoriteKnowledgeSource = this.mutation(removeAuthorizationParam(deleteFavoriteV1KnowledgeSourcesSlugFavoriteDelete))
|
|
101
|
+
/**
|
|
102
|
+
* List knowledge objects from a knowledge source
|
|
103
|
+
*/
|
|
104
|
+
listKnowledgeObjects = this.query(removeAuthorizationParam(listKosV1KnowledgeSourcesKsSlugObjectsGet))
|
|
105
|
+
/**
|
|
106
|
+
* Get a knowledge object by id
|
|
107
|
+
*/
|
|
108
|
+
getKnowledgeObjectById = this.query(removeAuthorizationParam(findKoByIdV1KnowledgeSourcesKsSlugObjectsKoIdGet))
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
uploadFiles = this.mutation({
|
|
112
|
+
name: 'uploadFiles',
|
|
113
|
+
request: (abortSignal, params: { files: File[], type: FileUploadType, targetId?: string }) => (
|
|
114
|
+
Promise.all(params.files.map(async (f) => {
|
|
115
|
+
try {
|
|
116
|
+
const { id, url, form } = await getUploadFormV2V2FileUploadFormPost({
|
|
117
|
+
authorization: '',
|
|
118
|
+
newFileUploadRequest: { file_name: f.name, target_type: params.type, target_id: params.targetId ?? '' },
|
|
119
|
+
}, { signal: abortSignal })
|
|
120
|
+
const formData = new FormData()
|
|
121
|
+
Object.entries(form).forEach(([key, value]) => {
|
|
122
|
+
formData.append(key, value)
|
|
123
|
+
})
|
|
124
|
+
formData.append('file', f)
|
|
125
|
+
const response = await fetch(url, { method: 'post', body: formData, signal: abortSignal })
|
|
126
|
+
if (!response.ok) throw new StackspotAPIError({ status: response.status, headers: response.headers, message: 'Failed to upload' })
|
|
127
|
+
return id
|
|
128
|
+
} catch (e: any) {
|
|
129
|
+
throw new FileUploadError(f.name, e)
|
|
130
|
+
}
|
|
131
|
+
}))
|
|
132
|
+
),
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Uploads a KO file
|
|
137
|
+
*/
|
|
138
|
+
fileUploadFormKnowledgeObject = this.mutation(
|
|
139
|
+
removeAuthorizationParam(getUploadFormV1FileUploadFormPost))
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Create Ks
|
|
143
|
+
*/
|
|
144
|
+
createKnowledgeSource = this.mutation(removeAuthorizationParam(createKsV1KnowledgeSourcesPost))
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Search Ks
|
|
148
|
+
*/
|
|
149
|
+
listKnowledgeSourcesDataByIds = this.query(removeAuthorizationParam(searchKsV1KnowledgeSourcesSearchPost))
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Gets a knowledge source by its slug.
|
|
153
|
+
*/
|
|
154
|
+
findKnowledgeSourceBySlug = this.query(removeAuthorizationParam(findKsV1KnowledgeSourcesSlugGet))
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Search Objects
|
|
158
|
+
*/
|
|
159
|
+
searchObjects = this.mutation(removeAuthorizationParam(searchObjectsV1SearchPost))
|
|
160
|
+
/**
|
|
161
|
+
* Update Knowledge Source
|
|
162
|
+
*/
|
|
163
|
+
updateKnowledgeSource = this.mutation(removeAuthorizationParam(updateKsV1KnowledgeSourcesSlugPatch))
|
|
164
|
+
/**
|
|
165
|
+
* Share Knowledge Source
|
|
166
|
+
*/
|
|
167
|
+
shareKnowledgeSource = this.mutation(removeAuthorizationParam(shareKsV1KnowledgeSourcesSlugSharePost))
|
|
168
|
+
/**
|
|
169
|
+
* Publish Knowledge Source
|
|
170
|
+
*/
|
|
171
|
+
publishKnowledgeSource = this.mutation(removeAuthorizationParam(publishKsV1KnowledgeSourcesSlugPublishPost))
|
|
172
|
+
/**
|
|
173
|
+
* Fork Knowledge Source
|
|
174
|
+
*/
|
|
175
|
+
forkKnowledgeSource = this.mutation(removeAuthorizationParam(forkKsV1KnowledgeSourcesSlugForkPost))
|
|
176
|
+
/**
|
|
177
|
+
* Delete Knowledge Objects by Standalone
|
|
178
|
+
*/
|
|
179
|
+
deleteKnowledgeObjectsByStandalone = this.mutation(removeAuthorizationParam(resetKosV1KnowledgeSourcesKsSlugObjectsDelete))
|
|
180
|
+
/**
|
|
181
|
+
* Delete Knowledge Object from Knowledge Source
|
|
182
|
+
*/
|
|
183
|
+
deleteKnowledgeObjectFromKnowledgeSource = this.mutation(removeAuthorizationParam(deleteKoByIdV1KnowledgeSourcesKsSlugObjectsKoIdDelete))
|
|
184
|
+
/**
|
|
185
|
+
* Get Indexed Files
|
|
186
|
+
*/
|
|
187
|
+
listIndexedProjectFiles = this.query(removeAuthorizationParam(getIndexedFilesV1KnowledgeSourcesKsSlugFilesGet))
|
|
188
|
+
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export const dataIntegrationClient = new DataIntegrationClient()
|
package/src/client/discover.ts
CHANGED
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
import { HttpError } from '@oazapfts/runtime'
|
|
2
|
-
import { getApiAddresses } from '../api-addresses'
|
|
3
|
-
import { ConversationResponse } from '../api/ai'
|
|
4
|
-
import { create, create1, create2, defaults, deleteById, deleteById1, deleteById2, getAll, getAll1, getAll2, getAllByHypothesis, getById, getById1, getById2, GetOpportunityResponse } from '../api/discover'
|
|
5
|
-
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
6
|
-
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
7
|
-
import { baseDictionary } from '../error/dictionary/base'
|
|
8
|
-
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
9
|
-
import { aiClient } from './ai'
|
|
10
|
-
|
|
11
|
-
export interface ChatConversionDetails extends ConversationResponse {
|
|
12
|
-
opportunityName?: string,
|
|
13
|
-
hypothesisCount?: number,
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
class DiscoverClient extends ReactQueryNetworkClient {
|
|
17
|
-
constructor() {
|
|
18
|
-
super(getApiAddresses().discover.url, defaults)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
protected buildStackSpotError(error: HttpError): StackspotAPIError {
|
|
22
|
-
return new DefaultAPIError(error.data, error.status, baseDictionary, error.headers)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
opportunities = this.query(getAll)
|
|
26
|
-
|
|
27
|
-
opportunity = this.query(getById)
|
|
28
|
-
|
|
29
|
-
hypotheses = this.query(getAll1)
|
|
30
|
-
|
|
31
|
-
hypothesisById = this.query(getById1)
|
|
32
|
-
|
|
33
|
-
documents = this.query(getAllByHypothesis)
|
|
34
|
-
|
|
35
|
-
document = this.query(getById2)
|
|
36
|
-
|
|
37
|
-
artifacts = this.query(getAll2)
|
|
38
|
-
|
|
39
|
-
createOpportunity = this.mutation(create)
|
|
40
|
-
|
|
41
|
-
createHypothesis = this.mutation(create1)
|
|
42
|
-
|
|
43
|
-
createDocument = this.mutation(create2)
|
|
44
|
-
|
|
45
|
-
deleteOpportunity = this.mutation(deleteById)
|
|
46
|
-
|
|
47
|
-
deleteHypothesis = this.mutation(deleteById1)
|
|
48
|
-
|
|
49
|
-
deleteDocument = this.mutation(deleteById2)
|
|
50
|
-
|
|
51
|
-
chats = this.query({
|
|
52
|
-
name: 'chats',
|
|
53
|
-
request: async (_signal, variables: { filter?: string, page?: number, size?: number }) => {
|
|
54
|
-
const opportunities = await this.opportunities.query({})
|
|
55
|
-
|
|
56
|
-
const opportunitiesByChatId: Record<string, any> = opportunities.content.reduce(
|
|
57
|
-
(acc, opp: GetOpportunityResponse) => {
|
|
58
|
-
if (opp.chatId) {
|
|
59
|
-
acc[opp.chatId] = opp
|
|
60
|
-
}
|
|
61
|
-
return acc
|
|
62
|
-
},
|
|
63
|
-
{} as Record<string, any>,
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
const chatsHistory = await aiClient.chats.query(
|
|
67
|
-
{ ...variables, page: variables.page, size: variables.size ?? 40 },
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
const filteredItems = variables.filter
|
|
71
|
-
? chatsHistory.filter((chat) => chat.title.toLowerCase().includes(variables.filter!.toLowerCase()))
|
|
72
|
-
: chatsHistory
|
|
73
|
-
|
|
74
|
-
const enrichedChats = filteredItems?.map(chat => {
|
|
75
|
-
const relatedOpportunity = opportunitiesByChatId[chat.id]
|
|
76
|
-
|
|
77
|
-
return {
|
|
78
|
-
...chat,
|
|
79
|
-
opportunityName: relatedOpportunity?.title ?? null,
|
|
80
|
-
hypothesisCount: relatedOpportunity?.hypotheses?.length ?? 0,
|
|
81
|
-
}
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
return enrichedChats as ChatConversionDetails[]
|
|
85
|
-
},
|
|
86
|
-
})
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export const discoverClient = new DiscoverClient()
|
|
1
|
+
import { HttpError } from '@oazapfts/runtime'
|
|
2
|
+
import { getApiAddresses } from '../api-addresses'
|
|
3
|
+
import { ConversationResponse } from '../api/ai'
|
|
4
|
+
import { create, create1, create2, defaults, deleteById, deleteById1, deleteById2, getAll, getAll1, getAll2, getAllByHypothesis, getById, getById1, getById2, GetOpportunityResponse } from '../api/discover'
|
|
5
|
+
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
6
|
+
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
7
|
+
import { baseDictionary } from '../error/dictionary/base'
|
|
8
|
+
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
9
|
+
import { aiClient } from './ai'
|
|
10
|
+
|
|
11
|
+
export interface ChatConversionDetails extends ConversationResponse {
|
|
12
|
+
opportunityName?: string,
|
|
13
|
+
hypothesisCount?: number,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
class DiscoverClient extends ReactQueryNetworkClient {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(getApiAddresses().discover.url, defaults)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
protected buildStackSpotError(error: HttpError): StackspotAPIError {
|
|
22
|
+
return new DefaultAPIError(error.data, error.status, baseDictionary, error.headers)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
opportunities = this.query(getAll)
|
|
26
|
+
|
|
27
|
+
opportunity = this.query(getById)
|
|
28
|
+
|
|
29
|
+
hypotheses = this.query(getAll1)
|
|
30
|
+
|
|
31
|
+
hypothesisById = this.query(getById1)
|
|
32
|
+
|
|
33
|
+
documents = this.query(getAllByHypothesis)
|
|
34
|
+
|
|
35
|
+
document = this.query(getById2)
|
|
36
|
+
|
|
37
|
+
artifacts = this.query(getAll2)
|
|
38
|
+
|
|
39
|
+
createOpportunity = this.mutation(create)
|
|
40
|
+
|
|
41
|
+
createHypothesis = this.mutation(create1)
|
|
42
|
+
|
|
43
|
+
createDocument = this.mutation(create2)
|
|
44
|
+
|
|
45
|
+
deleteOpportunity = this.mutation(deleteById)
|
|
46
|
+
|
|
47
|
+
deleteHypothesis = this.mutation(deleteById1)
|
|
48
|
+
|
|
49
|
+
deleteDocument = this.mutation(deleteById2)
|
|
50
|
+
|
|
51
|
+
chats = this.query({
|
|
52
|
+
name: 'chats',
|
|
53
|
+
request: async (_signal, variables: { filter?: string, page?: number, size?: number }) => {
|
|
54
|
+
const opportunities = await this.opportunities.query({})
|
|
55
|
+
|
|
56
|
+
const opportunitiesByChatId: Record<string, any> = opportunities.content.reduce(
|
|
57
|
+
(acc, opp: GetOpportunityResponse) => {
|
|
58
|
+
if (opp.chatId) {
|
|
59
|
+
acc[opp.chatId] = opp
|
|
60
|
+
}
|
|
61
|
+
return acc
|
|
62
|
+
},
|
|
63
|
+
{} as Record<string, any>,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
const chatsHistory = await aiClient.chats.query(
|
|
67
|
+
{ ...variables, page: variables.page, size: variables.size ?? 40 },
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
const filteredItems = variables.filter
|
|
71
|
+
? chatsHistory.filter((chat) => chat.title.toLowerCase().includes(variables.filter!.toLowerCase()))
|
|
72
|
+
: chatsHistory
|
|
73
|
+
|
|
74
|
+
const enrichedChats = filteredItems?.map(chat => {
|
|
75
|
+
const relatedOpportunity = opportunitiesByChatId[chat.id]
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
...chat,
|
|
79
|
+
opportunityName: relatedOpportunity?.title ?? null,
|
|
80
|
+
hypothesisCount: relatedOpportunity?.hypotheses?.length ?? 0,
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
return enrichedChats as ChatConversionDetails[]
|
|
85
|
+
},
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export const discoverClient = new DiscoverClient()
|