@stack-spot/portal-network 0.89.0 → 0.91.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.
@@ -0,0 +1,31 @@
1
+ import apisJson from './apis.json'
2
+ import { NetworkClient } from './network/NetworkClient'
3
+ import { Env } from './network/types'
4
+
5
+ type ApiConfig = {
6
+ url: Record<Env, string>,
7
+ docs?: string,
8
+ }
9
+
10
+ interface Apis {
11
+ [api: string]: ApiConfig,
12
+ }
13
+
14
+ type ApiAddress = {
15
+ [api: string]: string,
16
+ }
17
+
18
+ function transformApisToApiAddress(apis: Apis, env: Env): ApiAddress {
19
+ const apiAddress: ApiAddress = {}
20
+
21
+ for (const api in apis) {
22
+ apiAddress[api] = apis[api].url[env]
23
+ }
24
+
25
+ return apiAddress
26
+ }
27
+
28
+ export const apiAddresses = () => {
29
+ const env = NetworkClient.getEnv()
30
+ return transformApisToApiAddress(apisJson, env)
31
+ }
@@ -57,6 +57,7 @@ import {
57
57
  getWorkflowByStudioSlug,
58
58
  getWorkflowDoc,
59
59
  getWorkflowUsageSummary,
60
+ getWorkflowVersionUsageSummary,
60
61
  listAccountWorkflow,
61
62
  listActions,
62
63
  listActions1,
@@ -464,6 +465,10 @@ class ContentClient extends ReactQueryNetworkClient {
464
465
  * Get usage summary of workflow
465
466
  */
466
467
  workflowUsageSummary = this.query(getWorkflowUsageSummary)
468
+ /**
469
+ * Get usage summary of workflow version
470
+ */
471
+ workflowVersionUsageSummary = this.query(getWorkflowVersionUsageSummary)
467
472
  }
468
473
 
469
474
  export const contentClient = new ContentClient()
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { CancelledError } from '@tanstack/react-query'
2
+ export { apiAddresses } from './api-addresses'
2
3
  export { accountClient } from './client/account'
3
4
  export { agentClient } from './client/agent'
4
5
  export { aiClient } from './client/ai'
@@ -38,6 +38,18 @@ export abstract class NetworkClient {
38
38
  NetworkClient.env = env
39
39
  }
40
40
 
41
+ /**
42
+ * Retrieves the current environment configuration.
43
+ *
44
+ * This method returns the environment setting for the `NetworkClient`.
45
+ * If no environment is explicitly set, it defaults to `'prd'` (production).
46
+ *
47
+ * @returns {Env} The current environment configuration, either the value of `NetworkClient.env` or `'prd'` if not set.
48
+ */
49
+ static getEnv(): Env {
50
+ return NetworkClient.env || 'prd'
51
+ }
52
+
41
53
  private uninitializedError() {
42
54
  return new Error('Please, call "NetworkClient.setup(sessionManager, env)" before attempting to make a request.')
43
55
  }