@stack-spot/portal-network 0.202.0 → 0.203.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 +254 -0
- package/dist/api/account.d.ts +344 -91
- package/dist/api/account.d.ts.map +1 -1
- package/dist/api/account.js +203 -46
- package/dist/api/account.js.map +1 -1
- package/dist/api/accountAssetManager.d.ts +309 -0
- package/dist/api/accountAssetManager.d.ts.map +1 -0
- package/dist/api/accountAssetManager.js +169 -0
- package/dist/api/accountAssetManager.js.map +1 -0
- package/dist/api/agent-tools.d.ts +623 -141
- package/dist/api/agent-tools.d.ts.map +1 -1
- package/dist/api/agent-tools.js +168 -45
- package/dist/api/agent-tools.js.map +1 -1
- package/dist/api/ai.d.ts +135 -24
- package/dist/api/ai.d.ts.map +1 -1
- package/dist/api/ai.js +79 -26
- package/dist/api/ai.js.map +1 -1
- package/dist/api/codeShift.d.ts +127 -9
- package/dist/api/codeShift.d.ts.map +1 -1
- package/dist/api/codeShift.js +73 -6
- package/dist/api/codeShift.js.map +1 -1
- package/dist/api/dataIntegration.d.ts +291 -1
- package/dist/api/dataIntegration.d.ts.map +1 -1
- package/dist/api/dataIntegration.js +254 -0
- package/dist/api/dataIntegration.js.map +1 -1
- package/dist/api/discover.d.ts +79 -4
- package/dist/api/discover.d.ts.map +1 -1
- package/dist/api/discover.js +73 -7
- package/dist/api/discover.js.map +1 -1
- package/dist/api/edpBfa.d.ts +215 -0
- package/dist/api/edpBfa.d.ts.map +1 -0
- package/dist/api/edpBfa.js +87 -0
- package/dist/api/edpBfa.js.map +1 -0
- package/dist/api/workspace-ai.d.ts +41 -0
- package/dist/api/workspace-ai.d.ts.map +1 -1
- package/dist/api/workspace-ai.js +34 -0
- package/dist/api/workspace-ai.js.map +1 -1
- package/dist/api-addresses.d.ts +13 -20
- package/dist/api-addresses.d.ts.map +1 -1
- package/dist/api-addresses.js +60 -17
- package/dist/api-addresses.js.map +1 -1
- package/dist/apis-itau.json +16 -0
- package/dist/apis.json +16 -0
- package/dist/client/account-asset-manager.d.ts +112 -0
- package/dist/client/account-asset-manager.d.ts.map +1 -0
- package/dist/client/account-asset-manager.js +160 -0
- package/dist/client/account-asset-manager.js.map +1 -0
- package/dist/client/account.d.ts +11 -9
- package/dist/client/account.d.ts.map +1 -1
- package/dist/client/account.js +11 -8
- package/dist/client/account.js.map +1 -1
- package/dist/client/agent-tools.d.ts +108 -3
- package/dist/client/agent-tools.d.ts.map +1 -1
- package/dist/client/agent-tools.js +95 -10
- package/dist/client/agent-tools.js.map +1 -1
- package/dist/client/ai.d.ts +148 -1
- package/dist/client/ai.d.ts.map +1 -1
- package/dist/client/ai.js +149 -17
- package/dist/client/ai.js.map +1 -1
- package/dist/client/code-shift.d.ts +54 -3
- package/dist/client/code-shift.d.ts.map +1 -1
- package/dist/client/code-shift.js +46 -1
- package/dist/client/code-shift.js.map +1 -1
- package/dist/client/data-integration.d.ts +30 -0
- package/dist/client/data-integration.d.ts.map +1 -1
- package/dist/client/data-integration.js +29 -2
- package/dist/client/data-integration.js.map +1 -1
- package/dist/client/discover.d.ts +16 -2
- package/dist/client/discover.d.ts.map +1 -1
- package/dist/client/discover.js +28 -1
- package/dist/client/discover.js.map +1 -1
- package/dist/client/edp-bfa.d.ts +16 -0
- package/dist/client/edp-bfa.d.ts.map +1 -0
- package/dist/client/edp-bfa.js +24 -0
- package/dist/client/edp-bfa.js.map +1 -0
- package/dist/client/notification.d.ts +7 -0
- package/dist/client/notification.d.ts.map +1 -1
- package/dist/client/notification.js +10 -1
- package/dist/client/notification.js.map +1 -1
- package/dist/client/types.d.ts +11 -3
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/workspace-ai.d.ts +13 -3
- package/dist/client/workspace-ai.d.ts.map +1 -1
- package/dist/client/workspace-ai.js +17 -3
- package/dist/client/workspace-ai.js.map +1 -1
- package/dist/client/workspace-manager.d.ts +15 -0
- package/dist/client/workspace-manager.d.ts.map +1 -1
- package/dist/client/workspace-manager.js +19 -1
- package/dist/client/workspace-manager.js.map +1 -1
- package/dist/error/dictionary/accountAssetManager.d.ts +11 -0
- package/dist/error/dictionary/accountAssetManager.d.ts.map +1 -0
- package/dist/error/dictionary/accountAssetManager.js +11 -0
- package/dist/error/dictionary/accountAssetManager.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/network/NetworkClient.d.ts.map +1 -1
- package/dist/network/NetworkClient.js +12 -2
- package/dist/network/NetworkClient.js.map +1 -1
- package/dist/network/types.d.ts +1 -0
- package/dist/network/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/readme.md +39 -1
- package/src/api/account.ts +592 -165
- package/src/api/accountAssetManager.ts +771 -0
- package/src/api/agent-tools.ts +824 -188
- package/src/api/ai.ts +206 -38
- package/src/api/codeShift.ts +233 -12
- package/src/api/dataIntegration.ts +635 -1
- package/src/api/discover.ts +153 -10
- package/src/api/edpBfa.ts +472 -0
- package/src/api/workspace-ai.ts +83 -0
- package/src/api-addresses.ts +93 -37
- package/src/apis-itau.json +16 -0
- package/src/apis.json +16 -0
- package/src/client/account-asset-manager.ts +100 -0
- package/src/client/account.ts +11 -7
- package/src/client/agent-tools.ts +64 -16
- package/src/client/ai.ts +129 -19
- package/src/client/code-shift.ts +29 -0
- package/src/client/data-integration.ts +23 -2
- package/src/client/discover.ts +15 -2
- package/src/client/edp-bfa.ts +24 -0
- package/src/client/notification.ts +6 -1
- package/src/client/types.ts +12 -3
- package/src/client/workspace-ai.ts +21 -6
- package/src/client/workspace-manager.ts +13 -0
- package/src/error/dictionary/accountAssetManager.ts +12 -0
- package/src/index.ts +4 -1
- package/src/network/NetworkClient.ts +13 -4
- package/src/network/types.ts +1 -0
package/src/api/workspace-ai.ts
CHANGED
|
@@ -84,6 +84,13 @@ export type ListWksContentsResponse = {
|
|
|
84
84
|
[key: string]: any;
|
|
85
85
|
}[] | null;
|
|
86
86
|
};
|
|
87
|
+
export type ContentVersion = {
|
|
88
|
+
core_id: string;
|
|
89
|
+
version_number?: number | null;
|
|
90
|
+
};
|
|
91
|
+
export type AddWorkspaceContentRequestV2 = {
|
|
92
|
+
content_identifier: ContentVersion[];
|
|
93
|
+
};
|
|
87
94
|
export type ActionShared = "VIEW" | "EDIT" | "GRANT_ACESS";
|
|
88
95
|
export type PermissionForSharedRequest = {
|
|
89
96
|
userId: string;
|
|
@@ -100,6 +107,12 @@ export type ResourceMembersResponse = {
|
|
|
100
107
|
name: string;
|
|
101
108
|
actions: string[];
|
|
102
109
|
};
|
|
110
|
+
export type ResourceMembersPaginatedResponse = {
|
|
111
|
+
items: ResourceMembersResponse[];
|
|
112
|
+
page: number;
|
|
113
|
+
size: number;
|
|
114
|
+
total_pages: number;
|
|
115
|
+
};
|
|
103
116
|
/**
|
|
104
117
|
* Create Workspace
|
|
105
118
|
*/
|
|
@@ -534,6 +547,36 @@ export function listAllContentsV1WorkspacesWorkspaceIdContentsGet({ workspaceId,
|
|
|
534
547
|
})
|
|
535
548
|
}));
|
|
536
549
|
}
|
|
550
|
+
/**
|
|
551
|
+
* Add Content
|
|
552
|
+
*/
|
|
553
|
+
export function addContentV2WorkspacesWorkspaceIdContentTypePost({ workspaceId, contentType, authorization, xAccountId, addWorkspaceContentRequestV2 }: {
|
|
554
|
+
workspaceId: string;
|
|
555
|
+
contentType: ContentType;
|
|
556
|
+
authorization: string;
|
|
557
|
+
xAccountId?: string | null;
|
|
558
|
+
addWorkspaceContentRequestV2: AddWorkspaceContentRequestV2;
|
|
559
|
+
}, opts?: Oazapfts.RequestOpts) {
|
|
560
|
+
return oazapfts.ok(oazapfts.fetchJson<{
|
|
561
|
+
status: 200;
|
|
562
|
+
data: {
|
|
563
|
+
[key: string]: any;
|
|
564
|
+
};
|
|
565
|
+
} | {
|
|
566
|
+
status: 404;
|
|
567
|
+
} | {
|
|
568
|
+
status: 422;
|
|
569
|
+
data: HttpValidationError;
|
|
570
|
+
}>(`/v2/workspaces/${encodeURIComponent(workspaceId)}/${encodeURIComponent(contentType)}`, oazapfts.json({
|
|
571
|
+
...opts,
|
|
572
|
+
method: "POST",
|
|
573
|
+
body: addWorkspaceContentRequestV2,
|
|
574
|
+
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
575
|
+
authorization,
|
|
576
|
+
"x-account-id": xAccountId
|
|
577
|
+
})
|
|
578
|
+
})));
|
|
579
|
+
}
|
|
537
580
|
/**
|
|
538
581
|
* Use Shareable Link
|
|
539
582
|
*/
|
|
@@ -653,6 +696,46 @@ export function listMembersV1ResourceTypeResourceTypeResourcesResourceIdentifier
|
|
|
653
696
|
})
|
|
654
697
|
}));
|
|
655
698
|
}
|
|
699
|
+
/**
|
|
700
|
+
* List Members
|
|
701
|
+
*/
|
|
702
|
+
export function listMembersV2ResourceTypeResourceTypeResourcesResourceIdentifierMembersGet({ resourceType, resourceIdentifier, search, filterBy, filterValue, sortBy, page, size, order, authorization, xAccountId }: {
|
|
703
|
+
resourceType: ContentType;
|
|
704
|
+
resourceIdentifier: string;
|
|
705
|
+
search?: string | null;
|
|
706
|
+
filterBy?: string | null;
|
|
707
|
+
filterValue?: string | null;
|
|
708
|
+
sortBy?: SortBy | null;
|
|
709
|
+
page?: number;
|
|
710
|
+
size?: number;
|
|
711
|
+
order?: OrderEnum;
|
|
712
|
+
authorization: string;
|
|
713
|
+
xAccountId?: string | null;
|
|
714
|
+
}, opts?: Oazapfts.RequestOpts) {
|
|
715
|
+
return oazapfts.ok(oazapfts.fetchJson<{
|
|
716
|
+
status: 200;
|
|
717
|
+
data: ResourceMembersPaginatedResponse;
|
|
718
|
+
} | {
|
|
719
|
+
status: 404;
|
|
720
|
+
} | {
|
|
721
|
+
status: 422;
|
|
722
|
+
data: HttpValidationError;
|
|
723
|
+
}>(`/v2/resource-type/${encodeURIComponent(resourceType)}/resources/${encodeURIComponent(resourceIdentifier)}/members${QS.query(QS.explode({
|
|
724
|
+
search,
|
|
725
|
+
filter_by: filterBy,
|
|
726
|
+
filter_value: filterValue,
|
|
727
|
+
sort_by: sortBy,
|
|
728
|
+
page,
|
|
729
|
+
size,
|
|
730
|
+
order
|
|
731
|
+
}))}`, {
|
|
732
|
+
...opts,
|
|
733
|
+
headers: oazapfts.mergeHeaders(opts?.headers, {
|
|
734
|
+
authorization,
|
|
735
|
+
"x-account-id": xAccountId
|
|
736
|
+
})
|
|
737
|
+
}));
|
|
738
|
+
}
|
|
656
739
|
/**
|
|
657
740
|
* Healthz
|
|
658
741
|
*/
|
package/src/api-addresses.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { APIMap } from '@stack-spot/opa'
|
|
1
2
|
import apisItauJson from './apis-itau.json' assert { type: 'json' }
|
|
2
3
|
import apisJson from './apis.json' assert { type: 'json' }
|
|
3
4
|
import { NetworkClient } from './network/NetworkClient'
|
|
@@ -5,26 +6,29 @@ import { Env, Tenant } from './network/types'
|
|
|
5
6
|
|
|
6
7
|
type ApisKeys = keyof typeof apisJson;
|
|
7
8
|
|
|
9
|
+
type APIName = APIMap[string]
|
|
10
|
+
type ExceptionAPIName = Exclude<APIName, keyof Apis>
|
|
11
|
+
|
|
12
|
+
declare global {
|
|
13
|
+
interface ImportMeta {
|
|
14
|
+
readonly env: {
|
|
15
|
+
VITE_NETWORK_OVERRIDES: string,
|
|
16
|
+
DEV: boolean,
|
|
17
|
+
PROD: boolean,
|
|
18
|
+
},
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
8
22
|
type ApiConfig = {
|
|
9
23
|
url: Record<Env, string>,
|
|
10
24
|
docs?: string,
|
|
11
25
|
}
|
|
12
26
|
|
|
13
|
-
type PartialApiConfig = {
|
|
14
|
-
url: Partial<Record<Env, string>>,
|
|
15
|
-
docs?: string
|
|
16
|
-
}
|
|
17
|
-
|
|
18
27
|
type Apis = Record<ApisKeys, ApiConfig>;
|
|
19
28
|
|
|
20
|
-
type
|
|
21
|
-
|
|
22
|
-
type ApiAddress = {
|
|
23
|
-
[api: string]: string,
|
|
24
|
-
}
|
|
29
|
+
type ApiAddress = Record<ApisKeys, string>
|
|
25
30
|
|
|
26
|
-
|
|
27
|
-
let overrideApis: PartialApis = {};
|
|
31
|
+
const defaultApis: Apis = apisJson
|
|
28
32
|
|
|
29
33
|
const apis: Record<Tenant, Apis> = {
|
|
30
34
|
'stackspot': apisJson,
|
|
@@ -37,12 +41,12 @@ const apis: Record<Tenant, Apis> = {
|
|
|
37
41
|
* @param tenant The current tenant (e.g., 'stackspot', 'itau').
|
|
38
42
|
* @returns API catalog containing the URLs per environment.
|
|
39
43
|
*/
|
|
40
|
-
|
|
44
|
+
function getApisByTenant(tenant: Tenant) {
|
|
41
45
|
return apis[tenant]
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
function transformApisToApiAddress(apis: Apis, env: Env): ApiAddress {
|
|
45
|
-
const apiAddress
|
|
49
|
+
const apiAddress = {} as ApiAddress
|
|
46
50
|
|
|
47
51
|
for (const api in apis) {
|
|
48
52
|
const key = api as ApisKeys
|
|
@@ -59,14 +63,28 @@ function transformApisToApiAddress(apis: Apis, env: Env): ApiAddress {
|
|
|
59
63
|
* @returns {boolean} true if the URL is found, otherwise false.
|
|
60
64
|
*/
|
|
61
65
|
function matchesBaseUrl(baseUrl: Record<Env, string>, candidate: Record<Env, string>): boolean {
|
|
62
|
-
const envs: Env[] = ['dev', 'stg', 'prd']
|
|
66
|
+
const envs: Env[] = ['dev', 'stg', 'prd']
|
|
63
67
|
|
|
64
68
|
return envs.every(e => {
|
|
65
69
|
if (candidate[e]) {
|
|
66
|
-
return baseUrl[e] === candidate[e]
|
|
70
|
+
return baseUrl[e] === candidate[e]
|
|
67
71
|
}
|
|
68
|
-
return true
|
|
69
|
-
})
|
|
72
|
+
return true
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const getApiOverride = () => {
|
|
77
|
+
const envs = import.meta.env
|
|
78
|
+
|
|
79
|
+
let overrideAPIsURL = {} as ApiAddress
|
|
80
|
+
if (envs.PROD) return overrideAPIsURL
|
|
81
|
+
|
|
82
|
+
try {
|
|
83
|
+
overrideAPIsURL= JSON.parse(envs.VITE_NETWORK_OVERRIDES)
|
|
84
|
+
return overrideAPIsURL
|
|
85
|
+
} catch {
|
|
86
|
+
return overrideAPIsURL
|
|
87
|
+
}
|
|
70
88
|
}
|
|
71
89
|
|
|
72
90
|
/**
|
|
@@ -77,44 +95,82 @@ function matchesBaseUrl(baseUrl: Record<Env, string>, candidate: Record<Env, str
|
|
|
77
95
|
* @param tenant the current tenant.
|
|
78
96
|
* @returns {string} the base URL for the given environment and tenant, applying any overrides if available.
|
|
79
97
|
*/
|
|
80
|
-
export const getBaseUrlByTenantWithOverride = (baseUrl: Record<Env, string>, targetEnv: Env = 'prd',
|
|
81
|
-
|
|
98
|
+
export const getBaseUrlByTenantWithOverride = (baseUrl: Record<Env, string>, targetEnv: Env = 'prd',
|
|
99
|
+
tenant: Tenant = 'stackspot'): string => {
|
|
100
|
+
let matchesApiName: ApisKeys | null = null
|
|
82
101
|
|
|
83
102
|
for (const [apiName, config] of Object.entries(defaultApis) as [ApisKeys, ApiConfig][]) {
|
|
84
103
|
if (matchesBaseUrl(baseUrl, config.url)) {
|
|
85
|
-
matchesApiName = apiName
|
|
86
|
-
break
|
|
104
|
+
matchesApiName = apiName
|
|
105
|
+
break
|
|
87
106
|
}
|
|
88
107
|
}
|
|
89
108
|
|
|
90
109
|
if (!matchesApiName) return ''
|
|
91
110
|
|
|
92
|
-
const
|
|
93
|
-
if (overrideUrl) {
|
|
94
|
-
return overrideUrl;
|
|
95
|
-
}
|
|
96
|
-
|
|
111
|
+
const overrides = getApiOverride()
|
|
97
112
|
const apis = getApisByTenant(tenant)
|
|
98
|
-
|
|
113
|
+
const api = apis[matchesApiName]
|
|
114
|
+
return overrides?.[matchesApiName] ?? api?.url?.[targetEnv]
|
|
99
115
|
}
|
|
100
116
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
117
|
+
export const getApisBaseUrlConfig = (env: Env = 'prd', tenant: Tenant = 'stackspot'): ApiAddress => {
|
|
118
|
+
const overrides = getApiOverride()
|
|
119
|
+
const apis = getApisByTenant(tenant)
|
|
120
|
+
const apiMap = {} as ApiAddress
|
|
121
|
+
|
|
122
|
+
for (const [key, value] of Object.entries(apis)) {
|
|
123
|
+
if (value?.url && value.url?.[env]) {
|
|
124
|
+
const url = value.url[env]
|
|
125
|
+
const api = key as ApisKeys
|
|
126
|
+
apiMap[api] = url
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return { ...apiMap, ...overrides }
|
|
107
131
|
}
|
|
108
132
|
|
|
133
|
+
|
|
109
134
|
/**
|
|
110
135
|
* Sets the default APIs addresses for each environments.
|
|
111
136
|
* @returns {Apis} an object containing APIs URLs grouped by api name and enviroments.
|
|
112
137
|
*/
|
|
113
|
-
export const getApiAddresses = (): Apis =>
|
|
114
|
-
return defaultApis;
|
|
115
|
-
}
|
|
138
|
+
export const getApiAddresses = (): Apis => defaultApis
|
|
116
139
|
|
|
117
140
|
export const apiAddresses = () => {
|
|
118
141
|
const env = NetworkClient.getEnv()
|
|
119
142
|
return transformApisToApiAddress(defaultApis, env)
|
|
120
143
|
}
|
|
144
|
+
|
|
145
|
+
const networkApiNameToOpaApiName = {
|
|
146
|
+
ai: 'code-buddy',
|
|
147
|
+
dataIntegration: 'data-integration',
|
|
148
|
+
workspaceManager: 'workspace-manager',
|
|
149
|
+
cloudServices: 'cloud-services',
|
|
150
|
+
cloudAccount: 'cloud-account',
|
|
151
|
+
cloudPlatformHorizon: 'cloud-platform-horizon',
|
|
152
|
+
codeShift: 'code-shift',
|
|
153
|
+
genAiInference: 'ai-inference',
|
|
154
|
+
apiRuntime: 'runtime-manager',
|
|
155
|
+
serviceCatalog: 'catalog',
|
|
156
|
+
accountAssetManager: 'account-asset-manager',
|
|
157
|
+
} as const satisfies Partial<Record<keyof Apis, ExceptionAPIName>>
|
|
158
|
+
|
|
159
|
+
function resolveApiName(name: keyof Apis): APIName {
|
|
160
|
+
return (networkApiNameToOpaApiName as Record<string, ExceptionAPIName>)[name] ?? name
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function generateApiMap(apis: ApiAddress) {
|
|
164
|
+
const apiMap: APIMap = {}
|
|
165
|
+
for (const [key, url] of Object.entries(apis)) {
|
|
166
|
+
if (url) {
|
|
167
|
+
apiMap[url] = resolveApiName(key as keyof Apis)
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return apiMap
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export function getPermissionsAPIMap(env: Env, tenant: Tenant = 'stackspot'): APIMap {
|
|
174
|
+
const apis = getApisBaseUrlConfig(env, tenant)
|
|
175
|
+
return generateApiMap(apis)
|
|
176
|
+
}
|
package/src/apis-itau.json
CHANGED
|
@@ -221,5 +221,21 @@
|
|
|
221
221
|
"prd": "https://discover-core.stackspot.com"
|
|
222
222
|
},
|
|
223
223
|
"docs": "/v3/api-docs"
|
|
224
|
+
},
|
|
225
|
+
"accountAssetManager" : {
|
|
226
|
+
"url": {
|
|
227
|
+
"dev": "https://account-asset-manager.dev.stackspot.com",
|
|
228
|
+
"stg": "https://account-asset-manager.stg.stackspot.com",
|
|
229
|
+
"prd": "https://account-asset-manager.stackspot.com"
|
|
230
|
+
},
|
|
231
|
+
"docs": "/v3/api-docs"
|
|
232
|
+
},
|
|
233
|
+
"edpBfa": {
|
|
234
|
+
"url": {
|
|
235
|
+
"dev": "https://adp-development-edp-bfa.dev.stackspot.com",
|
|
236
|
+
"stg": "https://adp-development-edp-bfa.stg.stackspot.com",
|
|
237
|
+
"prd": "https://edp-bfa.stackspot.com"
|
|
238
|
+
},
|
|
239
|
+
"docs": "/openapi.json"
|
|
224
240
|
}
|
|
225
241
|
}
|
package/src/apis.json
CHANGED
|
@@ -221,5 +221,21 @@
|
|
|
221
221
|
"prd": "https://discover-core.stackspot.com"
|
|
222
222
|
},
|
|
223
223
|
"docs": "/v3/api-docs"
|
|
224
|
+
},
|
|
225
|
+
"accountAssetManager" : {
|
|
226
|
+
"url": {
|
|
227
|
+
"dev": "https://account-asset-manager.dev.stackspot.com",
|
|
228
|
+
"stg": "https://account-asset-manager.stg.stackspot.com",
|
|
229
|
+
"prd": "https://account-asset-manager.stackspot.com"
|
|
230
|
+
},
|
|
231
|
+
"docs": "/v3/api-docs"
|
|
232
|
+
},
|
|
233
|
+
"edpBfa": {
|
|
234
|
+
"url": {
|
|
235
|
+
"dev": "https://adp-development-edp-bfa.dev.stackspot.com",
|
|
236
|
+
"stg": "https://adp-development-edp-bfa.stg.stackspot.com",
|
|
237
|
+
"prd": "https://edp-bfa.stackspot.com"
|
|
238
|
+
},
|
|
239
|
+
"docs": "/openapi.json"
|
|
224
240
|
}
|
|
225
241
|
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { HttpError } from '@oazapfts/runtime'
|
|
2
|
+
import { getApiAddresses } from '../api-addresses'
|
|
3
|
+
import { defaults, deleteAssetType, deleteFolder, deleteProject, disassociateProjectAsset, getFolderDetails, getProjectDetails, listAssetTypes, listFolders, saveAssetType, saveFolder, saveProject, updateAsset, updateAssetType, updateFolders, updateProject } from '../api/accountAssetManager'
|
|
4
|
+
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
5
|
+
import { accountAssetManagerDictionary } from '../error/dictionary/accountAssetManager'
|
|
6
|
+
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
7
|
+
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
8
|
+
import { removeAuthorizationParam } from '../utils/remove-authorization-param'
|
|
9
|
+
|
|
10
|
+
class AccountAssetManagerClient extends ReactQueryNetworkClient {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(getApiAddresses().accountAssetManager.url, defaults)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
protected buildStackSpotError(error: HttpError): StackspotAPIError {
|
|
16
|
+
return new DefaultAPIError(error.data, error.status, accountAssetManagerDictionary, error.headers)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Save project
|
|
21
|
+
*/
|
|
22
|
+
saveProject = this.mutation(removeAuthorizationParam(saveProject))
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Get project details
|
|
26
|
+
*/
|
|
27
|
+
getProjectDetails = this.query(removeAuthorizationParam(getProjectDetails))
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Delete project
|
|
31
|
+
*/
|
|
32
|
+
deleteProject = this.mutation(removeAuthorizationParam(deleteProject))
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Update project
|
|
36
|
+
*/
|
|
37
|
+
updateProject = this.mutation(removeAuthorizationParam(updateProject))
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Disassociate project asset
|
|
41
|
+
*/
|
|
42
|
+
disassociateProjectAsset = this.mutation(removeAuthorizationParam(disassociateProjectAsset))
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* List account folders
|
|
46
|
+
*/
|
|
47
|
+
folders = this.query(removeAuthorizationParam(listFolders))
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Create new folder in account
|
|
51
|
+
*/
|
|
52
|
+
createFolder = this.mutation(removeAuthorizationParam(saveFolder))
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Get folder details
|
|
56
|
+
*/
|
|
57
|
+
folderDetails = this.query(removeAuthorizationParam(getFolderDetails))
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Delete folder
|
|
61
|
+
*/
|
|
62
|
+
deleteFolder = this.mutation(removeAuthorizationParam(deleteFolder))
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Update folder
|
|
66
|
+
*/
|
|
67
|
+
updateFolder = this.mutation(removeAuthorizationParam(updateFolders))
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Create asset
|
|
71
|
+
*/
|
|
72
|
+
createAsset = this.mutation(removeAuthorizationParam(saveAssetType))
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Update asset
|
|
76
|
+
*/
|
|
77
|
+
updateAsset = this.mutation(removeAuthorizationParam(updateAsset))
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* List all asset types
|
|
81
|
+
*/
|
|
82
|
+
assetTypes = this.query(removeAuthorizationParam(listAssetTypes))
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Save asset type
|
|
86
|
+
*/
|
|
87
|
+
saveAssetType = this.mutation(removeAuthorizationParam(saveAssetType))
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Delete asset type
|
|
91
|
+
*/
|
|
92
|
+
deleteAssetType = this.mutation(removeAuthorizationParam(deleteAssetType))
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Update asset type
|
|
96
|
+
*/
|
|
97
|
+
updateAssetType = this.mutation(removeAuthorizationParam(updateAssetType))
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export const accountAssetManagerClient = new AccountAssetManagerClient()
|
package/src/client/account.ts
CHANGED
|
@@ -102,8 +102,8 @@ import {
|
|
|
102
102
|
isCreatedScmCredentials1,
|
|
103
103
|
listAccountMemberFavorites,
|
|
104
104
|
listExtensionLinks,
|
|
105
|
-
listExtensions,
|
|
106
105
|
listExtensionVersions,
|
|
106
|
+
listManageableExtensions,
|
|
107
107
|
listMemberFavoritesByResource,
|
|
108
108
|
listScmCredentials1,
|
|
109
109
|
listScmCredentials2, partialUpdateSso, personalAccessTokenAuthorization,
|
|
@@ -145,8 +145,12 @@ import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
|
145
145
|
import { accountDictionary } from '../error/dictionary/account'
|
|
146
146
|
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
147
147
|
import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
|
|
148
|
+
import { removeAuthorizationParam } from '../utils/remove-authorization-param'
|
|
148
149
|
import { CreateSCMRequest, SCMStatus, UpdateSCMRequest } from './types'
|
|
149
150
|
|
|
151
|
+
const listAllResourcesOfGroup = removeAuthorizationParam(getGroupResources)
|
|
152
|
+
const getsListAllResourcesOfGroup = removeAuthorizationParam(getResources)
|
|
153
|
+
|
|
150
154
|
class AccountClient extends ReactQueryNetworkClient {
|
|
151
155
|
constructor() {
|
|
152
156
|
super(getApiAddresses().account.url, defaults)
|
|
@@ -324,9 +328,9 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
324
328
|
*/
|
|
325
329
|
removeRoleFromGroup = this.mutation(deleteRole)
|
|
326
330
|
/**
|
|
327
|
-
*
|
|
331
|
+
* Get all resources by groups with pagination.
|
|
328
332
|
*/
|
|
329
|
-
|
|
333
|
+
allResourcesByGroupWithPagination = this.infiniteQuery(listAllResourcesOfGroup, { accumulator: 'items' })
|
|
330
334
|
/**
|
|
331
335
|
* Adds several resources to a group.
|
|
332
336
|
*/
|
|
@@ -393,7 +397,7 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
393
397
|
/**
|
|
394
398
|
* Gets all resources (paginated)
|
|
395
399
|
*/
|
|
396
|
-
allResources = this.infiniteQuery(
|
|
400
|
+
allResources = this.infiniteQuery(getsListAllResourcesOfGroup, { accumulator: 'items' })
|
|
397
401
|
/**
|
|
398
402
|
* Gets all resource types (paginated)
|
|
399
403
|
*/
|
|
@@ -649,9 +653,9 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
649
653
|
*/
|
|
650
654
|
allRolesByGroupWithPagination = this.query(getRoles5)
|
|
651
655
|
/**
|
|
652
|
-
*
|
|
656
|
+
* Gets all resources of a group (paginated)
|
|
653
657
|
*/
|
|
654
|
-
|
|
658
|
+
groupResources = this.query(getGroupResources1)
|
|
655
659
|
/**
|
|
656
660
|
* Get all roles account with pagination
|
|
657
661
|
*/
|
|
@@ -687,7 +691,7 @@ class AccountClient extends ReactQueryNetworkClient {
|
|
|
687
691
|
/**
|
|
688
692
|
* Lists all extensions.
|
|
689
693
|
*/
|
|
690
|
-
extensions = this.query(
|
|
694
|
+
extensions = this.query(listManageableExtensions)
|
|
691
695
|
|
|
692
696
|
/**
|
|
693
697
|
* Lists all versions of an extension.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HttpError } from '@oazapfts/runtime'
|
|
2
2
|
import { getApiAddresses } from '../api-addresses'
|
|
3
|
-
import { addFavoriteV1AgentsAgentIdFavoritePost, AgentVisibilityLevelEnum, createAgentV1AgentsPost, createToolkitToolsV1ToolkitsToolkitIdToolsPost, createToolkitV1ToolkitsPost, defaults, deleteAgentV1AgentsAgentIdDelete, deleteFavoriteV1AgentsAgentIdFavoriteDelete, deleteToolkitToolsV1ToolkitsToolkitIdToolsDelete, deleteToolkitV1ToolkitsToolkitIdDelete, editToolkitToolV1ToolkitsToolkitIdToolsToolIdPut, forkAgentV1AgentsAgentIdForkPost, forkToolkitV1ToolkitsToolkitIdForkPost, getAgentV1AgentsAgentIdGet, getPublicToolKitsV1BuiltinToolkitGet, getToolkitToolV1ToolkitsToolkitIdToolsToolIdGet, getToolkitV1ToolkitsToolkitIdGet, listAgentsUsingToolsV1ToolkitsToolkitIdToolsAgentsPost, listAgentsV1AgentsGet, listAgentsV3AgentsGet, listMcpToolsV1McpToolsToolkitIdGet, listMultiAgentsV1AgentsMultiAgentsGet, listToolkitsV1ToolkitsGet, publishAgentV1AgentsAgentIdPublishPost,
|
|
3
|
+
import { addFavoriteV1AgentsAgentIdFavoritePost, AgentVisibilityLevelEnum, createAgentV1AgentsPost, createAgentV2AgentsPost, createToolkitToolsV1ToolkitsToolkitIdToolsPost, createToolkitV1ToolkitsPost, createVersionV1AgentsAgentCoreIdVersionsPost, defaults, deleteAgentV1AgentsAgentIdDelete, deleteFavoriteV1AgentsAgentIdFavoriteDelete, deleteToolkitToolsV1ToolkitsToolkitIdToolsDelete, deleteToolkitV1ToolkitsToolkitIdDelete, deleteVersionV1AgentsAgentCoreIdVersionsVersionNumberDelete, editToolkitToolV1ToolkitsToolkitIdToolsToolIdPut, findByAgentCoreIdV2AgentsAgentCoreIdGet, forkAgentV1AgentsAgentIdForkPost, forkToolkitV1ToolkitsToolkitIdForkPost, getAgentV1AgentsAgentIdGet, getPublicToolKitsV1BuiltinToolkitGet, getToolkitToolV1ToolkitsToolkitIdToolsToolIdGet, getToolkitV1ToolkitsToolkitIdGet, listAgentsUsingToolsV1ToolkitsToolkitIdToolsAgentsPost, listAgentsV1AgentsGet, listAgentsV3AgentsGet, listMcpToolsV1McpToolsToolkitIdGet, listMultiAgentsV1AgentsMultiAgentsGet, listToolkitsV1ToolkitsGet, listToolkitsV2ToolkitsGet, listVersionsOfAgentCoreV1AgentsAgentCoreIdVersionsGet, patchVersionRecommendedV1AgentsAgentCoreIdVersionsVersionNumberPatch, publishAgentV1AgentsAgentIdPublishPost, searchAgentsByIdsV1AgentsSearchPost, shareV1AgentsAgentIdSharePost, updateAgentV1AgentsAgentIdPatch, updateAgentV2AgentsAgentIdPatch, updateToolkitV1ToolkitsToolkitIdPatch, VisibilityLevelEnum } from '../api/agent-tools'
|
|
4
4
|
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
5
5
|
import { agentToolsDictionary } from '../error/dictionary/agent-tools'
|
|
6
6
|
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
@@ -13,6 +13,7 @@ import { workspaceAiClient } from './workspace-ai'
|
|
|
13
13
|
|
|
14
14
|
const AGENT_DEFAULT_SLUG = 'stk_flex'
|
|
15
15
|
const listAgentsV3AgentsWithoutAuthorization = removeAuthorizationParam(listAgentsV3AgentsGet)
|
|
16
|
+
const listToolkitsAuthorization = removeAuthorizationParam(listToolkitsV2ToolkitsGet)
|
|
16
17
|
|
|
17
18
|
class AgentToolsClient extends ReactQueryNetworkClient {
|
|
18
19
|
constructor() {
|
|
@@ -29,6 +30,7 @@ class AgentToolsClient extends ReactQueryNetworkClient {
|
|
|
29
30
|
tools = this.query(removeAuthorizationParam(getPublicToolKitsV1BuiltinToolkitGet))
|
|
30
31
|
|
|
31
32
|
/**
|
|
33
|
+
* @deprecated
|
|
32
34
|
* Create agent
|
|
33
35
|
*/
|
|
34
36
|
createAgent = this.mutation(removeAuthorizationParam(createAgentV1AgentsPost))
|
|
@@ -39,6 +41,7 @@ class AgentToolsClient extends ReactQueryNetworkClient {
|
|
|
39
41
|
deleteAgent = this.mutation(removeAuthorizationParam(deleteAgentV1AgentsAgentIdDelete))
|
|
40
42
|
|
|
41
43
|
/**
|
|
44
|
+
* @deprecated
|
|
42
45
|
* Updates an agent
|
|
43
46
|
*/
|
|
44
47
|
updateAgent = this.mutation(removeAuthorizationParam(updateAgentV1AgentsAgentIdPatch))
|
|
@@ -84,7 +87,7 @@ class AgentToolsClient extends ReactQueryNetworkClient {
|
|
|
84
87
|
/**
|
|
85
88
|
* Gets agents by ids
|
|
86
89
|
*/
|
|
87
|
-
agentsByIds = this.query(removeAuthorizationParam(
|
|
90
|
+
agentsByIds = this.query(removeAuthorizationParam(searchAgentsByIdsV1AgentsSearchPost))
|
|
88
91
|
|
|
89
92
|
/**
|
|
90
93
|
* Gets the default agent slug
|
|
@@ -97,11 +100,11 @@ class AgentToolsClient extends ReactQueryNetworkClient {
|
|
|
97
100
|
agentDefault = this.query({
|
|
98
101
|
name: 'agentDefault',
|
|
99
102
|
request: async (signal) => {
|
|
100
|
-
const agentDefault = await
|
|
101
|
-
{
|
|
103
|
+
const agentDefault = await listAgentsV3AgentsGet(
|
|
104
|
+
{ filters: { visibility_list: ['built_in'], slug: this.agentDefaultSlug }, authorization: '' }, { signal },
|
|
102
105
|
)
|
|
103
106
|
|
|
104
|
-
const agentId = agentDefault?.find((agent) => agent.slug === this.agentDefaultSlug)?.id
|
|
107
|
+
const agentId = agentDefault?.items?.find((agent) => agent.slug === this.agentDefaultSlug)?.id
|
|
105
108
|
const agent = agentId ? await this.agent.query({ agentId }) : undefined
|
|
106
109
|
return agent
|
|
107
110
|
},
|
|
@@ -112,32 +115,44 @@ class AgentToolsClient extends ReactQueryNetworkClient {
|
|
|
112
115
|
*/
|
|
113
116
|
allAgents = this.query({
|
|
114
117
|
name: 'allAgents',
|
|
115
|
-
request: async (signal, variables: { visibilities: (AgentVisibilityLevel | 'all')[] }) => {
|
|
118
|
+
request: async (signal, variables: { visibilities: (AgentVisibilityLevel | 'all')[], filter?: string }) => {
|
|
116
119
|
const allVisibilities = ['account', 'built_in', 'recently_used', 'favorite', 'personal', 'shared', 'workspace'] as const
|
|
117
|
-
const visibilities = variables.visibilities.includes('all')
|
|
120
|
+
const visibilities = !variables.visibilities || variables.visibilities?.includes('all')
|
|
118
121
|
? allVisibilities
|
|
119
122
|
: variables.visibilities as Array<AgentVisibilityLevelEnum | VisibilityLevelEnum>
|
|
120
|
-
|
|
121
123
|
const shouldFetchWorkspaceAgents = visibilities.includes('workspace')
|
|
122
|
-
|
|
124
|
+
|
|
123
125
|
const workspaceAgentsPromise = shouldFetchWorkspaceAgents
|
|
124
126
|
? workspaceAiClient.workspacesContentsByType.query({ contentType: 'agent' })
|
|
125
127
|
: Promise.resolve([])
|
|
126
128
|
|
|
127
|
-
const
|
|
129
|
+
const listAgentsVisibilities = visibilities.filter((visibility) => visibility!=='workspace')
|
|
130
|
+
const listAgentsPromise = listAgentsVisibilities.length
|
|
131
|
+
? listAgentsV3AgentsGet({ filters: {
|
|
132
|
+
visibility_list: listAgentsVisibilities as (AgentVisibilityLevelEnum | VisibilityLevelEnum)[],
|
|
133
|
+
name: variables.filter,
|
|
134
|
+
},
|
|
135
|
+
authorization: '' }, { signal })
|
|
136
|
+
: Promise.resolve({ items: [] })
|
|
137
|
+
|
|
138
|
+
const [workspaceAgents, agentsByVisibility] = await Promise.all([
|
|
128
139
|
workspaceAgentsPromise,
|
|
129
|
-
|
|
140
|
+
listAgentsPromise,
|
|
130
141
|
])
|
|
131
142
|
|
|
132
143
|
const workspaceAgentsWithSpaceName = workspaceAgents.flatMap(({ agents, space_name }) =>
|
|
133
144
|
agents?.map((agent) => ({ ...agent, spaceName: space_name, builtIn: false }))) as AgentResponseWithBuiltIn[]
|
|
134
|
-
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
145
|
+
|
|
146
|
+
const filteredWorkspaceAgents = variables.filter ? workspaceAgentsWithSpaceName.filter((agent) =>
|
|
147
|
+
agent.name.toLowerCase().includes(variables.filter!)) :
|
|
148
|
+
workspaceAgentsWithSpaceName
|
|
149
|
+
|
|
150
|
+
const allAgents: AgentResponseWithBuiltIn[] = filteredWorkspaceAgents ?? []
|
|
151
|
+
|
|
152
|
+
agentsByVisibility.items?.forEach(agent => allAgents.push(({
|
|
138
153
|
...agent,
|
|
139
154
|
builtIn: agent?.visibility_level === 'built_in',
|
|
140
|
-
})))
|
|
155
|
+
})))
|
|
141
156
|
|
|
142
157
|
return allAgents
|
|
143
158
|
},
|
|
@@ -147,6 +162,10 @@ class AgentToolsClient extends ReactQueryNetworkClient {
|
|
|
147
162
|
* Lists all custom toolkits.
|
|
148
163
|
*/
|
|
149
164
|
toolkits = this.query(removeAuthorizationParam(listToolkitsV1ToolkitsGet))
|
|
165
|
+
/**
|
|
166
|
+
* Get list of Toolkits V2
|
|
167
|
+
*/
|
|
168
|
+
toolkitsV2 = this.infiniteQuery(listToolkitsAuthorization, { accumulator: 'items' })
|
|
150
169
|
/**
|
|
151
170
|
* Lists all tools of an MCP toolkit.
|
|
152
171
|
*/
|
|
@@ -183,6 +202,7 @@ class AgentToolsClient extends ReactQueryNetworkClient {
|
|
|
183
202
|
* Delete tool from Toolkit
|
|
184
203
|
*/
|
|
185
204
|
deleteToolFromToolkit = this.mutation(removeAuthorizationParam(deleteToolkitToolsV1ToolkitsToolkitIdToolsDelete))
|
|
205
|
+
|
|
186
206
|
/**
|
|
187
207
|
* Previews an uploaded open api file as a stream where each array item is an OpenAPI operation.
|
|
188
208
|
*/
|
|
@@ -220,6 +240,34 @@ class AgentToolsClient extends ReactQueryNetworkClient {
|
|
|
220
240
|
* remove an agent from favorites
|
|
221
241
|
*/
|
|
222
242
|
removeFavorite = this.mutation(removeAuthorizationParam(deleteFavoriteV1AgentsAgentIdFavoriteDelete))
|
|
243
|
+
/**
|
|
244
|
+
* Creates an agent version
|
|
245
|
+
*/
|
|
246
|
+
createAgentVersion = this.mutation(removeAuthorizationParam(createVersionV1AgentsAgentCoreIdVersionsPost))
|
|
247
|
+
/**
|
|
248
|
+
* V2 of agent creation
|
|
249
|
+
*/
|
|
250
|
+
createAgentV2 = this.mutation(removeAuthorizationParam(createAgentV2AgentsPost))
|
|
251
|
+
/**
|
|
252
|
+
* V2 of agent update
|
|
253
|
+
*/
|
|
254
|
+
updateAgentV2 = this.mutation(removeAuthorizationParam(updateAgentV2AgentsAgentIdPatch))
|
|
255
|
+
/**
|
|
256
|
+
* Update agent recommended version
|
|
257
|
+
*/
|
|
258
|
+
updateRecommendedVersion = this.mutation(removeAuthorizationParam(patchVersionRecommendedV1AgentsAgentCoreIdVersionsVersionNumberPatch))
|
|
259
|
+
/**
|
|
260
|
+
* V2 of get agent by id
|
|
261
|
+
*/
|
|
262
|
+
agentV2 = this.query(removeAuthorizationParam(findByAgentCoreIdV2AgentsAgentCoreIdGet))
|
|
263
|
+
/**
|
|
264
|
+
* Gets agent versions
|
|
265
|
+
*/
|
|
266
|
+
listAgentVersions = this.query(removeAuthorizationParam(listVersionsOfAgentCoreV1AgentsAgentCoreIdVersionsGet))
|
|
267
|
+
/**
|
|
268
|
+
* Deletes an agent version
|
|
269
|
+
*/
|
|
270
|
+
deleteVersion = this.mutation(removeAuthorizationParam(deleteVersionV1AgentsAgentCoreIdVersionsVersionNumberDelete))
|
|
223
271
|
}
|
|
224
272
|
|
|
225
273
|
export const agentToolsClient = new AgentToolsClient()
|