@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.
- package/CHANGELOG.md +14 -0
- package/dist/api/content.d.ts +10 -0
- package/dist/api/content.d.ts.map +1 -1
- package/dist/api/content.js +8 -0
- package/dist/api/content.js.map +1 -1
- package/dist/api-addresses.d.ts +6 -0
- package/dist/api-addresses.d.ts.map +1 -0
- package/dist/api-addresses.js +14 -0
- package/dist/api-addresses.js.map +1 -0
- package/dist/client/content.d.ts +6 -0
- package/dist/client/content.d.ts.map +1 -1
- package/dist/client/content.js +10 -1
- package/dist/client/content.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/network/NetworkClient.d.ts +9 -0
- package/dist/network/NetworkClient.d.ts.map +1 -1
- package/dist/network/NetworkClient.js +11 -0
- package/dist/network/NetworkClient.js.map +1 -1
- package/package.json +1 -1
- package/src/api/content.ts +39 -0
- package/src/api-addresses.ts +31 -0
- package/src/client/content.ts +5 -0
- package/src/index.ts +1 -0
- package/src/network/NetworkClient.ts +12 -0
|
@@ -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
|
+
}
|
package/src/client/content.ts
CHANGED
|
@@ -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
|
@@ -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
|
}
|