@stack-spot/portal-network 0.40.1 → 0.42.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://cloud-cloud-platform-api.stg.stackspot.com",
11
+ baseUrl: "https://cloud-cloud-platform-api.dev.stackspot.com",
12
12
  };
13
13
  const oazapfts = Oazapfts.runtime(defaults);
14
14
  export const servers = {
15
- generatedServerUrl: "https://cloud-cloud-platform-api.stg.stackspot.com"
15
+ generatedServerUrl: "https://cloud-cloud-platform-api.dev.stackspot.com"
16
16
  };
17
17
  export type ReplicasConfigRequest = {
18
18
  /** Minimum number of replicas */
@@ -23,6 +23,7 @@ export type ReplicasConfigRequest = {
23
23
  };
24
24
  export type CreateDeploymentRequest = {
25
25
  applicationId?: string;
26
+ applicationName: string;
26
27
  action: "DEPLOY" | "STOP" | "START" | "RESTART" | "REDEPLOY";
27
28
  containerPort?: string;
28
29
  healthCheckPath?: string;
@@ -32,8 +33,6 @@ export type CreateDeploymentRequest = {
32
33
  imageUrl?: string;
33
34
  tag?: string;
34
35
  runtimeId?: string;
35
- runtimeTags?: string[];
36
- runtimeEnv?: string;
37
36
  mem?: number;
38
37
  cpu?: number;
39
38
  replicaNum?: ReplicasConfigRequest;
@@ -186,6 +185,12 @@ export type DeploymentHealthResponse = {
186
185
  };
187
186
  export type BasicDeploymentResponse = {
188
187
  deploymentId: string;
188
+ runtimeId: string;
189
+ runtimeName: string;
190
+ createdAt: string;
191
+ appName: string;
192
+ creator: string;
193
+ applicationId: string;
189
194
  };
190
195
  export type DeploymentResponse = {
191
196
  deploymentId?: string;
@@ -198,7 +203,7 @@ export type DeploymentResponse = {
198
203
  };
199
204
  imageUrl?: string;
200
205
  versionTag?: string;
201
- health?: "HEALTH" | "UNHEALTH";
206
+ health?: "HEALTHY" | "UNHEALTHY";
202
207
  deploymentStatus?: "UP" | "STOPPED" | "DEPLOYING";
203
208
  runtimeId?: string;
204
209
  mem?: number;
package/src/apis.json CHANGED
@@ -7,6 +7,14 @@
7
7
  },
8
8
  "docs": "/openapi.json"
9
9
  },
10
+ "agent": {
11
+ "url": {
12
+ "dev": "https://genai-ai-agent-mgmt-api.dev.stackspot.com",
13
+ "stg": "https://genai-ai-agent-mgmt-api.stg.stackspot.com",
14
+ "prd": "https://genai-ai-agent-mgmt-api.stackspot.com"
15
+ },
16
+ "docs": "/q/openapi"
17
+ },
10
18
  "workspace": {
11
19
  "url": {
12
20
  "dev": "https://workspace-workspace-api.dev.stackspot.com",
@@ -0,0 +1,35 @@
1
+ import { HttpError } from '@oazapfts/runtime'
2
+ import { defaults, getV1Agents, getV1PublicAgents } from '../api/agent'
3
+ import apis from '../apis.json'
4
+ import { StackspotAPIError } from '../error/StackspotAPIError'
5
+ import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
6
+
7
+ interface AgentError {
8
+ code?: string,
9
+ details?: string,
10
+ additionalInformation?: Record<string, any>,
11
+ }
12
+
13
+ class AgentClient extends ReactQueryNetworkClient {
14
+ constructor() {
15
+ super(apis.agent.url, defaults)
16
+ }
17
+
18
+ protected buildStackSpotError(error: HttpError): StackspotAPIError {
19
+ const errorData = error.data as AgentError | undefined
20
+ const message = [errorData?.details]
21
+ Object.keys(errorData?.additionalInformation ?? {}).forEach(k => message.push(` - ${k}: ${errorData?.additionalInformation?.[k]}`))
22
+ return new StackspotAPIError({
23
+ status: error.status,
24
+ headers: error.headers,
25
+ stack: error.stack,
26
+ code: error.data?.code,
27
+ message: message.join('\n'),
28
+ })
29
+ }
30
+
31
+ agents = this.query(getV1Agents)
32
+ publicAgents = this.query(getV1PublicAgents)
33
+ }
34
+
35
+ export const agentClient = new AgentClient()
package/src/client/ai.ts CHANGED
@@ -44,7 +44,7 @@ class AIClient extends ReactQueryNetworkClient {
44
44
  quickCommands = this.query(removeAuthorizationParam(listAllV1QuickCommandsAllGet))
45
45
  quickCommand = this.query(removeAuthorizationParam(getQuickCommandV1QuickCommandsSlugGet))
46
46
  knowledgeSources = this.query(removeAuthorizationParam(listKnowledgeSourcesV1KnowledgeSourcesGet))
47
- knowledgeSource = this.query(removeAuthorizationParam(findKnowledgeObjectByCustomIdV1KnowledgeSourcesSlugObjectsCustomIdGet))
47
+ knowledgeSourceDocument = this.query(removeAuthorizationParam(findKnowledgeObjectByCustomIdV1KnowledgeSourcesSlugObjectsCustomIdGet))
48
48
  chats = this.infiniteQuery(removeAuthorizationParam(listConversationsV1ConversationsGet))
49
49
  chat = this.query(removeAuthorizationParam(conversationHistoryV1ConversationsConversationIdGet))
50
50
  deleteChat = this.mutation(removeAuthorizationParam(deleteConversationV1ConversationsConversationIdDelete))
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { accountClient } from './client/account'
2
+ export { agentClient } from './client/agent'
2
3
  export { aiClient } from './client/ai'
3
4
  export { cloudAccountClient } from './client/cloud-account'
4
5
  export { cloudPlatformClient } from './client/cloud-platform'
@@ -23,4 +24,3 @@ export { queryClient } from './network/react-query-client'
23
24
  export { OperationResult, OperationVariables, UseQueryObjectOptions } from './network/types'
24
25
  export { StreamedJson } from './utils/StreamedJson'
25
26
  export { useExtendedList } from './utils/use-extended-list'
26
-