@stack-spot/portal-network 0.202.0 → 0.203.0

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.
@@ -8,11 +8,11 @@ import * as Oazapfts from "@oazapfts/runtime";
8
8
  import * as QS from "@oazapfts/runtime/query";
9
9
  export const defaults: Oazapfts.Defaults<Oazapfts.CustomHeaders> = {
10
10
  headers: {},
11
- baseUrl: "https://discover-discover-core.stg.stackspot.com",
11
+ baseUrl: "https://discover-discover-core.dev.stackspot.com",
12
12
  };
13
13
  const oazapfts = Oazapfts.runtime(defaults);
14
14
  export const servers = {
15
- generatedServerUrl: "https://discover-discover-core.stg.stackspot.com"
15
+ generatedServerUrl: "https://discover-discover-core.dev.stackspot.com"
16
16
  };
17
17
  export type GetOpportunityResponseHypothesisResponse = {
18
18
  id: string;
@@ -146,6 +146,17 @@ export type CreateOpportunityResponse = {
146
146
  updatedAt?: string;
147
147
  chatId: string;
148
148
  };
149
+ export type InsightResponseInsightData = {
150
+ id: string;
151
+ title: string;
152
+ summary: string;
153
+ badge: string;
154
+ chartUrl: string;
155
+ };
156
+ export type InsightResponse = {
157
+ insights: InsightResponseInsightData[];
158
+ generatedAt: string;
159
+ };
149
160
  export type CreateHypothesisRequest = {
150
161
  opportunityId?: string;
151
162
  title?: string;
@@ -188,12 +199,35 @@ export type MessageRequest = {
188
199
  export type SseEmitter = {
189
200
  timeout?: number;
190
201
  };
202
+ export type AdminAgentCreateRequest = {
203
+ agentId: string;
204
+ name: string;
205
+ description: string;
206
+ schema: string;
207
+ };
208
+ export type AdminAgentResponse = {
209
+ id: string;
210
+ name: string;
211
+ description: string;
212
+ active: boolean;
213
+ createdAt: string;
214
+ updatedAt?: string;
215
+ };
216
+ export type GetInsightResponse = {
217
+ id: string;
218
+ title: string;
219
+ content: string;
220
+ chartUrl: string;
221
+ };
191
222
  export type GetArtifactResponse = {
192
223
  "type": "OPPORTUNITY" | "HYPOTHESIS" | "DOCUMENT";
193
224
  id: string;
194
225
  title: string;
195
226
  description: string;
196
227
  };
228
+ export type AdminHelloResponse = {
229
+ message: string;
230
+ };
197
231
  /**
198
232
  * Get specific Opportunity
199
233
  */
@@ -352,6 +386,30 @@ export function create({ createOpportunityRequest }: {
352
386
  body: createOpportunityRequest
353
387
  })));
354
388
  }
389
+ /**
390
+ * Fetch Insights
391
+ */
392
+ export function fetchInsights(opts?: Oazapfts.RequestOpts) {
393
+ return oazapfts.ok(oazapfts.fetchJson<{
394
+ status: 200;
395
+ data: InsightResponse;
396
+ }>("/v2/insights", {
397
+ ...opts,
398
+ method: "POST"
399
+ }));
400
+ }
401
+ /**
402
+ * Refresh Insights
403
+ */
404
+ export function refreshInsights(opts?: Oazapfts.RequestOpts) {
405
+ return oazapfts.ok(oazapfts.fetchJson<{
406
+ status: 200;
407
+ data: InsightResponse;
408
+ }>("/v2/insights/refresh", {
409
+ ...opts,
410
+ method: "POST"
411
+ }));
412
+ }
355
413
  /**
356
414
  * Get all Hypotheses
357
415
  */
@@ -428,6 +486,64 @@ export function chat({ authorization, messageRequest }: {
428
486
  })
429
487
  })));
430
488
  }
489
+ export function createAgent({ adminAgentCreateRequest }: {
490
+ adminAgentCreateRequest: AdminAgentCreateRequest;
491
+ }, opts?: Oazapfts.RequestOpts) {
492
+ return oazapfts.ok(oazapfts.fetchJson<{
493
+ status: 200;
494
+ data: AdminAgentResponse;
495
+ }>("/v2/admin/agents", oazapfts.json({
496
+ ...opts,
497
+ method: "POST",
498
+ body: adminAgentCreateRequest
499
+ })));
500
+ }
501
+ export function deactivateAgent({ schema, agentId }: {
502
+ schema: string;
503
+ agentId: string;
504
+ }, opts?: Oazapfts.RequestOpts) {
505
+ return oazapfts.ok(oazapfts.fetchText(`/v2/admin/agents/${encodeURIComponent(schema)}/${encodeURIComponent(agentId)}/deactivate`, {
506
+ ...opts,
507
+ method: "PATCH"
508
+ }));
509
+ }
510
+ export function activateAgent({ schema, agentId }: {
511
+ schema: string;
512
+ agentId: string;
513
+ }, opts?: Oazapfts.RequestOpts) {
514
+ return oazapfts.ok(oazapfts.fetchJson<{
515
+ status: 200;
516
+ data: AdminAgentResponse;
517
+ }>(`/v2/admin/agents/${encodeURIComponent(schema)}/${encodeURIComponent(agentId)}/activate`, {
518
+ ...opts,
519
+ method: "PATCH"
520
+ }));
521
+ }
522
+ export function getAndCacheData({ key }: {
523
+ key: string;
524
+ }, opts?: Oazapfts.RequestOpts) {
525
+ return oazapfts.ok(oazapfts.fetchJson<{
526
+ status: 200;
527
+ data: {
528
+ [key: string]: object;
529
+ };
530
+ }>(`/v2/redis/hello-world-persist-redis/${encodeURIComponent(key)}`, {
531
+ ...opts
532
+ }));
533
+ }
534
+ /**
535
+ * Get specific Insight
536
+ */
537
+ export function getInsightById({ insightId }: {
538
+ insightId: string;
539
+ }, opts?: Oazapfts.RequestOpts) {
540
+ return oazapfts.ok(oazapfts.fetchJson<{
541
+ status: 200;
542
+ data: GetInsightResponse;
543
+ }>(`/v2/insights/${encodeURIComponent(insightId)}`, {
544
+ ...opts
545
+ }));
546
+ }
431
547
  /**
432
548
  * Get specific Document content
433
549
  */
@@ -456,3 +572,30 @@ export function getAll2({ chatId }: {
456
572
  ...opts
457
573
  }));
458
574
  }
575
+ export function hello(opts?: Oazapfts.RequestOpts) {
576
+ return oazapfts.ok(oazapfts.fetchJson<{
577
+ status: 200;
578
+ data: AdminHelloResponse;
579
+ }>("/v2/admin/hello", {
580
+ ...opts
581
+ }));
582
+ }
583
+ export function listAgents({ schema }: {
584
+ schema: string;
585
+ }, opts?: Oazapfts.RequestOpts) {
586
+ return oazapfts.ok(oazapfts.fetchJson<{
587
+ status: 200;
588
+ data: AdminAgentResponse[];
589
+ }>(`/v2/admin/agents/${encodeURIComponent(schema)}`, {
590
+ ...opts
591
+ }));
592
+ }
593
+ export function deleteAgent({ schema, agentId }: {
594
+ schema: string;
595
+ agentId: string;
596
+ }, opts?: Oazapfts.RequestOpts) {
597
+ return oazapfts.ok(oazapfts.fetchText(`/v2/admin/agents/${encodeURIComponent(schema)}/${encodeURIComponent(agentId)}`, {
598
+ ...opts,
599
+ method: "DELETE"
600
+ }));
601
+ }
@@ -1,4 +1,5 @@
1
1
  import { HttpError } from '@oazapfts/runtime'
2
+ import { getApiAddresses } from '../api-addresses'
2
3
  import {
3
4
  addFavoriteV1KnowledgeSourcesSlugFavoritePost,
4
5
  createKsV1KnowledgeSourcesPost,
@@ -14,7 +15,9 @@ import {
14
15
  getUploadFormV1FileUploadFormPost,
15
16
  getUploadFormV2V2FileUploadFormPost,
16
17
  listKosV1KnowledgeSourcesKsSlugObjectsGet,
18
+ listKosV2KnowledgeSourcesKsSlugObjectsGet,
17
19
  listKsV1KnowledgeSourcesGet,
20
+ listKsV2KnowledgeSourcesGet,
18
21
  publishKsV1KnowledgeSourcesSlugPublishPost,
19
22
  resetKosV1KnowledgeSourcesKsSlugObjectsDelete,
20
23
  saveChunkedFilesDeprecatedV1FileUploadFileUploadIdPost,
@@ -32,7 +35,10 @@ import { FileUploadError } from '../error/FileUploadError'
32
35
  import { StackspotAPIError } from '../error/StackspotAPIError'
33
36
  import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
34
37
  import { removeAuthorizationParam } from '../utils/remove-authorization-param'
35
- import { getApiAddresses } from '../api-addresses'
38
+
39
+ const listKSV2WithoutAuthorization = removeAuthorizationParam(listKsV2KnowledgeSourcesGet)
40
+ const listKOV2WithoutAuthorization = removeAuthorizationParam(listKosV2KnowledgeSourcesKsSlugObjectsGet)
41
+
36
42
 
37
43
  class DataIntegrationClient extends ReactQueryNetworkClient {
38
44
  constructor() {
@@ -90,6 +96,10 @@ class DataIntegrationClient extends ReactQueryNetworkClient {
90
96
  * List of knowledge sources
91
97
  */
92
98
  knowledgeSources = this.query(removeAuthorizationParam(listKsV1KnowledgeSourcesGet))
99
+ /**
100
+ * List of knowledge sources with pagination
101
+ */
102
+ knowledgeSourcesV2 = this.infiniteQuery(listKSV2WithoutAuthorization, { accumulator: 'items' })
93
103
  /**
94
104
  * Adds the resource of type Knowledge Source to the list of favorites.
95
105
  */
@@ -102,6 +112,10 @@ class DataIntegrationClient extends ReactQueryNetworkClient {
102
112
  * List knowledge objects from a knowledge source
103
113
  */
104
114
  listKnowledgeObjects = this.query(removeAuthorizationParam(listKosV1KnowledgeSourcesKsSlugObjectsGet))
115
+ /**
116
+ * List knowledge objects from a knowledge source with pagination
117
+ */
118
+ listKnowledgeObjectsV2 = this.infiniteQuery(listKOV2WithoutAuthorization, { accumulator: 'items' })
105
119
  /**
106
120
  * Get a knowledge object by id
107
121
  */
@@ -2,7 +2,7 @@ import { HttpError } from '@oazapfts/runtime'
2
2
  import { findLast, last } from 'lodash'
3
3
  import { getApiAddresses } from '../api-addresses'
4
4
  import { ConversationResponse } from '../api/ai'
5
- import { create, create1, create2, defaults, deleteById, deleteById1, deleteById2, getAll, getAll1, getAll2, getAllByHypothesis, getById, getById1, getById2, GetOpportunityResponse, MessageRequest } from '../api/discover'
5
+ import { create, create1, create2, defaults, deleteById, deleteById1, deleteById2, fetchInsights, getAll, getAll1, getAll2, getAllByHypothesis, getById, getById1, getById2, getInsightById, GetOpportunityResponse, MessageRequest, refreshInsights } from '../api/discover'
6
6
  import { DefaultAPIError } from '../error/DefaultAPIError'
7
7
  import { StackspotAPIError } from '../error/StackspotAPIError'
8
8
  import { StreamedJson } from '../utils/StreamedJson'
@@ -53,6 +53,19 @@ class DiscoverClient extends ReactQueryNetworkClient {
53
53
 
54
54
  deleteDocument = this.mutation(deleteById2)
55
55
 
56
+ /**
57
+ * Fetch insights
58
+ */
59
+ insights = this.query(fetchInsights)
60
+ /**
61
+ * Refresh insights
62
+ */
63
+ refreshInsights = this.mutation(refreshInsights)
64
+ /**
65
+ * Get Insight by Id
66
+ */
67
+ insightById = this.query(getInsightById)
68
+
56
69
  chats = this.query({
57
70
  name: 'chats',
58
71
  request: async (_signal, variables: { filter?: string, page?: number, size?: number }) => {