@stack-spot/portal-network 0.58.3 → 0.58.5
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 +15 -0
- package/dist/api/cloudRuntimes.d.ts +34 -21
- package/dist/api/cloudRuntimes.d.ts.map +1 -1
- package/dist/api/cloudRuntimes.js +12 -0
- package/dist/api/cloudRuntimes.js.map +1 -1
- package/dist/api/content.d.ts +32 -32
- package/dist/api/content.d.ts.map +1 -1
- package/dist/api/workspaceManager.d.ts +69 -126
- package/dist/api/workspaceManager.d.ts.map +1 -1
- package/dist/api/workspaceManager.js +40 -84
- package/dist/api/workspaceManager.js.map +1 -1
- package/dist/client/account.d.ts +41 -0
- package/dist/client/account.d.ts.map +1 -1
- package/dist/client/account.js +55 -1
- package/dist/client/account.js.map +1 -1
- package/dist/client/cloud-runtimes.d.ts +6 -0
- package/dist/client/cloud-runtimes.d.ts.map +1 -1
- package/dist/client/cloud-runtimes.js +10 -1
- package/dist/client/cloud-runtimes.js.map +1 -1
- package/dist/client/content.d.ts +52 -22
- package/dist/client/content.d.ts.map +1 -1
- package/dist/client/content.js +38 -3
- package/dist/client/content.js.map +1 -1
- package/dist/client/workspace-manager.d.ts +42 -2
- package/dist/client/workspace-manager.d.ts.map +1 -1
- package/dist/client/workspace-manager.js +32 -5
- package/dist/client/workspace-manager.js.map +1 -1
- package/dist/client/workspace.d.ts +14 -2
- package/dist/client/workspace.d.ts.map +1 -1
- package/dist/client/workspace.js +10 -1
- package/dist/client/workspace.js.map +1 -1
- package/dist/network/AutoInfiniteQuery.d.ts.map +1 -1
- package/dist/network/AutoInfiniteQuery.js +2 -1
- package/dist/network/AutoInfiniteQuery.js.map +1 -1
- package/dist/network/ManualInfiniteQuery.d.ts.map +1 -1
- package/dist/network/ManualInfiniteQuery.js +2 -1
- package/dist/network/ManualInfiniteQuery.js.map +1 -1
- package/dist/network/ReactQueryNetworkClient.d.ts +8 -0
- package/dist/network/ReactQueryNetworkClient.d.ts.map +1 -1
- package/dist/network/ReactQueryNetworkClient.js.map +1 -1
- package/dist/network/types.d.ts +1 -1
- package/package.json +1 -1
- package/src/api/cloudRuntimes.ts +98 -21
- package/src/api/content.ts +32 -32
- package/src/api/workspaceManager.ts +108 -209
- package/src/client/account.ts +36 -1
- package/src/client/cloud-runtimes.ts +5 -0
- package/src/client/content.ts +99 -16
- package/src/client/workspace-manager.ts +30 -13
- package/src/client/workspace.ts +6 -1
- package/src/network/AutoInfiniteQuery.ts +3 -2
- package/src/network/ManualInfiniteQuery.ts +3 -3
- package/src/network/ReactQueryNetworkClient.ts +16 -0
- package/src/network/types.ts +1 -1
package/src/client/content.ts
CHANGED
|
@@ -1,22 +1,81 @@
|
|
|
1
1
|
import { HttpError } from '@oazapfts/runtime'
|
|
2
2
|
import {
|
|
3
|
-
addAction,
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
addAction,
|
|
4
|
+
addLink,
|
|
5
|
+
addWorkflow,
|
|
6
|
+
addWorkspace,
|
|
7
|
+
associateActionToPlugin,
|
|
8
|
+
changeVisibility,
|
|
9
|
+
createStudio,
|
|
10
|
+
defaults,
|
|
11
|
+
deleteAction,
|
|
12
|
+
deleteActionVersion,
|
|
13
|
+
deleteLink,
|
|
14
|
+
deletePluginVersion,
|
|
15
|
+
deleteStudio,
|
|
16
|
+
deleteV1StacksVersionsByStackVersionId,
|
|
17
|
+
delWorkspace,
|
|
18
|
+
deprecateActionVersion,
|
|
19
|
+
deprecatePluginVersion,
|
|
20
|
+
deprecateStackVersionBy,
|
|
21
|
+
downloadAction,
|
|
22
|
+
getActionBySlug,
|
|
23
|
+
getActionsVersions,
|
|
24
|
+
getActionVersionById,
|
|
25
|
+
getAllActionVersions,
|
|
26
|
+
getApplicationDetailsView,
|
|
27
|
+
getApplicationsUsesPlugin,
|
|
28
|
+
getAvailableActionVersionsByActionSlug,
|
|
29
|
+
getDependentPluginsVersions,
|
|
30
|
+
getGetPluginView,
|
|
31
|
+
getInfrastructureEnvironmentsUsesPlugin,
|
|
32
|
+
getListOfInputs,
|
|
33
|
+
getPluginInfrastructureView,
|
|
34
|
+
getPluginModalView,
|
|
35
|
+
getPluginVersions,
|
|
36
|
+
getPluginVersionsNotInUse,
|
|
37
|
+
getPluginVersionUsageSummary,
|
|
38
|
+
getStackUsesPlugin,
|
|
39
|
+
getStackVersionById,
|
|
40
|
+
getStackVersionListByIds,
|
|
41
|
+
getStackWorkspaceDetailView,
|
|
42
|
+
getStackWorkspaces,
|
|
43
|
+
getStarterStackVersionsAndPluginsVersions,
|
|
44
|
+
getStarterUsesPlugin,
|
|
45
|
+
getStudioByIdOrSlug,
|
|
46
|
+
getStudios,
|
|
47
|
+
getStudios1,
|
|
48
|
+
getStudiosToCreateButton,
|
|
49
|
+
getStudioTabs,
|
|
50
|
+
getUnusedStackVersions,
|
|
51
|
+
getWorkflow,
|
|
52
|
+
getWorkflowByStudioSlug,
|
|
53
|
+
getWorkflowDoc,
|
|
54
|
+
listActions,
|
|
13
55
|
listActions1,
|
|
14
56
|
listActions2,
|
|
15
|
-
listActionsByFilters1,
|
|
57
|
+
listActionsByFilters1,
|
|
58
|
+
listConnectionInterfaceTypes,
|
|
59
|
+
listLinksByStackVersion,
|
|
60
|
+
listMostUsedStackVersions,
|
|
61
|
+
listPlugins,
|
|
62
|
+
listPluginVersionByIdsController,
|
|
16
63
|
listReasons,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
64
|
+
listStacks,
|
|
65
|
+
listStacks1,
|
|
66
|
+
listStacksByFilters,
|
|
67
|
+
listStarters,
|
|
68
|
+
listWorkflows,
|
|
69
|
+
listWorkflowVersion,
|
|
70
|
+
listWorkspaces,
|
|
71
|
+
Pageable,
|
|
72
|
+
patchStarterV2,
|
|
73
|
+
removeActionFromPlugin,
|
|
74
|
+
removeStackWorkflow,
|
|
75
|
+
stackModalViewSummary,
|
|
76
|
+
stackVersionUsageSummary,
|
|
77
|
+
updateStudio,
|
|
78
|
+
updateStudioTabs,
|
|
20
79
|
} from '../api/content'
|
|
21
80
|
import apis from '../apis.json'
|
|
22
81
|
import { DefaultAPIError } from '../error/DefaultAPIError'
|
|
@@ -115,7 +174,15 @@ class ContentClient extends ReactQueryNetworkClient {
|
|
|
115
174
|
/**
|
|
116
175
|
* Gets workflows from a given studio
|
|
117
176
|
*/
|
|
118
|
-
workflowsFromStudio = this.infiniteQuery(getWorkflowByStudioSlug, { accumulator: 'content'
|
|
177
|
+
workflowsFromStudio = this.infiniteQuery(getWorkflowByStudioSlug, { accumulator: 'content',
|
|
178
|
+
pageParamName: 'pageable.page',
|
|
179
|
+
initialPageParam: { page: 0 },
|
|
180
|
+
getNextPageParam: ({ variables, lastPage, lastPageParam }) => {
|
|
181
|
+
const size = variables.pageable.size ?? 1
|
|
182
|
+
const parsedLastPageParam = (lastPageParam as Pageable)?.page ?? 0
|
|
183
|
+
return lastPage.content && lastPage.content.length < size ? undefined : { page: parsedLastPageParam + 1 }
|
|
184
|
+
},
|
|
185
|
+
})
|
|
119
186
|
/**
|
|
120
187
|
* Gets workflows from a given studio
|
|
121
188
|
*/
|
|
@@ -241,7 +308,11 @@ class ContentClient extends ReactQueryNetworkClient {
|
|
|
241
308
|
*/
|
|
242
309
|
actionByActionVersionId = this.query(getActionVersionById)
|
|
243
310
|
/**
|
|
244
|
-
* Gets list of Actions
|
|
311
|
+
* Gets list of Actions V2
|
|
312
|
+
*/
|
|
313
|
+
actionsV2 = this.query(listActions)
|
|
314
|
+
/**
|
|
315
|
+
* Gets list of Actions V1
|
|
245
316
|
*/
|
|
246
317
|
actions = this.query(listActions2)
|
|
247
318
|
/**
|
|
@@ -317,10 +388,22 @@ class ContentClient extends ReactQueryNetworkClient {
|
|
|
317
388
|
* Gets a stack from a stack version id
|
|
318
389
|
*/
|
|
319
390
|
getStackByVersionId = this.query(getStackVersionById)
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* View all stacks V3 by account
|
|
394
|
+
*/
|
|
395
|
+
getAllStacksV3 = this.query(listStacks)
|
|
396
|
+
|
|
320
397
|
/**
|
|
321
398
|
* View all stacks by account
|
|
322
399
|
*/
|
|
323
400
|
getAllStacks = this.query(listStacks1)
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* List most used stack versions
|
|
404
|
+
*/
|
|
405
|
+
|
|
406
|
+
listMostUsedStackVersions = this.query(listMostUsedStackVersions)
|
|
324
407
|
}
|
|
325
408
|
|
|
326
409
|
export const contentClient = new ContentClient()
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/* eslint-disable max-len */
|
|
2
2
|
import { HttpError } from '@oazapfts/runtime'
|
|
3
3
|
import {
|
|
4
|
+
accountApplicationControllergetAccountApplicationPage,
|
|
5
|
+
accountSharedInfraControllergetAccountSharedInfraPage,
|
|
4
6
|
applicationControllerV2GetApplicationActivities,
|
|
5
7
|
applicationControllerV2GetApplicationAppliedPlugins,
|
|
6
8
|
applicationControllergetApplicationDetails,
|
|
@@ -13,9 +15,9 @@ import {
|
|
|
13
15
|
contextControllerupsertPluginAccountContext,
|
|
14
16
|
contextControllerupsertPluginWorkspaceContext,
|
|
15
17
|
contextControllerupsertWorkspaceActionsInputContext,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
contextControllergetAccountPluginInputs,
|
|
19
|
+
contextControllergetConsolidatedPluginInputs,
|
|
20
|
+
contextgetConsolidatedPluginInputsWithConnectionInterfaces,
|
|
19
21
|
defaults,
|
|
20
22
|
managerRunControllerdeleteApplication,
|
|
21
23
|
managerRunControllerdeleteSharedInfra,
|
|
@@ -98,11 +100,11 @@ class WorkspaceManagerClient extends ReactQueryNetworkClient {
|
|
|
98
100
|
*/
|
|
99
101
|
pluginInputsInWorkspace = this.query({
|
|
100
102
|
name: 'pluginInputsInWorkspace',
|
|
101
|
-
request: async (signal, variables: Parameters<typeof
|
|
102
|
-
const data = await
|
|
103
|
-
return data as FixedFullInputContextResponse
|
|
103
|
+
request: async (signal, variables: Parameters<typeof contextControllergetConsolidatedPluginInputs>[0]) => {
|
|
104
|
+
const data = await contextControllergetConsolidatedPluginInputs(variables, { signal })
|
|
105
|
+
return data as unknown as FixedFullInputContextResponse
|
|
104
106
|
},
|
|
105
|
-
permission: async ({ workspaceId, stackVersionId }: Parameters<typeof
|
|
107
|
+
permission: async ({ workspaceId, stackVersionId }: Parameters<typeof contextControllergetConsolidatedPluginInputs>[0]) => {
|
|
106
108
|
const canViewContext = await workspaceClient.listConsolidatedWorkspaceContext.isAllowed({ $type: 'plugin', workspaceId, stackVersionId })
|
|
107
109
|
const canGetConnectionInterfaceTypes = await contentClient.connectionInterfaceTypes.isAllowed()
|
|
108
110
|
const canGetPluginVersions = await contentClient.pluginVersionsByIds.isAllowed({})
|
|
@@ -114,11 +116,11 @@ class WorkspaceManagerClient extends ReactQueryNetworkClient {
|
|
|
114
116
|
*/
|
|
115
117
|
pluginInputsAccount = this.query({
|
|
116
118
|
name: 'pluginInputsAccount',
|
|
117
|
-
request: async (signal, variables: Parameters<typeof
|
|
118
|
-
const data = await
|
|
119
|
-
return data as FixedFullInputContextResponse
|
|
119
|
+
request: async (signal, variables: Parameters<typeof contextControllergetAccountPluginInputs>[0]) => {
|
|
120
|
+
const data = await contextControllergetAccountPluginInputs(variables, { signal })
|
|
121
|
+
return data as unknown as FixedFullInputContextResponse
|
|
120
122
|
},
|
|
121
|
-
permission: async ({ stackVersionId }: Parameters<typeof
|
|
123
|
+
permission: async ({ stackVersionId }: Parameters<typeof contextControllergetAccountPluginInputs>[0]) => {
|
|
122
124
|
const canViewContext = await workspaceClient.listConsolidatedContext.isAllowed({ $type: 'plugin', stackVersionId })
|
|
123
125
|
const canGetConnectionInterfaceTypes = await contentClient.connectionInterfaceTypes.isAllowed()
|
|
124
126
|
const canGetPluginVersions = await contentClient.pluginVersionsByIds.isAllowed({})
|
|
@@ -164,7 +166,7 @@ class WorkspaceManagerClient extends ReactQueryNetworkClient {
|
|
|
164
166
|
/**
|
|
165
167
|
* Gets plugin inputs and connection interface from a plugin in a stack version in workspace
|
|
166
168
|
*/
|
|
167
|
-
pluginInputsWithConnectionInterfaces = this.query(
|
|
169
|
+
pluginInputsWithConnectionInterfaces = this.query(contextgetConsolidatedPluginInputsWithConnectionInterfaces as unknown as ReplaceResult<typeof contextgetConsolidatedPluginInputsWithConnectionInterfaces, FixedPluginForAppCreationV2Response>)
|
|
168
170
|
/**
|
|
169
171
|
* Gets workflows from a given stack and workflow type
|
|
170
172
|
*/
|
|
@@ -287,9 +289,24 @@ class WorkspaceManagerClient extends ReactQueryNetworkClient {
|
|
|
287
289
|
*/
|
|
288
290
|
filterStacksFromApplicationInWorkspace = this.query(applicationControllergetApplicationFilters)
|
|
289
291
|
/**
|
|
290
|
-
* Get all stacks used to create infra in a workspace
|
|
292
|
+
* Get all stacks used to create infra in a workspace.
|
|
291
293
|
*/
|
|
292
294
|
filterStacksFromInfraInWorkspace = this.query(sharedInfraControllergetSharedInfraFilters)
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Get all workspaces associated with an account.
|
|
298
|
+
*/
|
|
299
|
+
getAccountWorkspaces = this.query(workspaceControllergetWorkspaces)
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Get all applications associated with an account.
|
|
303
|
+
*/
|
|
304
|
+
getAccountApplications = this.query(accountApplicationControllergetAccountApplicationPage)
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Get all shared infrastructures associated with an account.
|
|
308
|
+
*/
|
|
309
|
+
getAccountSharedInfra = this.query(accountSharedInfraControllergetAccountSharedInfraPage)
|
|
293
310
|
}
|
|
294
311
|
|
|
295
312
|
export const workspaceManagerClient = new WorkspaceManagerClient()
|
package/src/client/workspace.ts
CHANGED
|
@@ -73,6 +73,7 @@ import {
|
|
|
73
73
|
workspaceStackControllerdeleteStack,
|
|
74
74
|
workspaceStackControllergetStackById,
|
|
75
75
|
workspaceStackControllergetStacks,
|
|
76
|
+
workspaceV2ControllergetWorkspacesWithoutStackFilter,
|
|
76
77
|
workspaceVariableV2ControllerfindAll,
|
|
77
78
|
workspaceVariableV2ControllerfindByName,
|
|
78
79
|
workspaceVariableV2Controllerupsert,
|
|
@@ -266,7 +267,7 @@ class WorkspaceClient extends ReactQueryNetworkClient {
|
|
|
266
267
|
* Gets the dependencies of a shared infra
|
|
267
268
|
*/
|
|
268
269
|
sharedInfraDependencies = this.query(workspaceSharedInfrastructureControllergetDependencyTree)
|
|
269
|
-
|
|
270
|
+
|
|
270
271
|
/**
|
|
271
272
|
* Updates an application
|
|
272
273
|
*/
|
|
@@ -443,6 +444,10 @@ class WorkspaceClient extends ReactQueryNetworkClient {
|
|
|
443
444
|
* Gets the detail of an infra. This fn is only used for permission purposes.
|
|
444
445
|
*/
|
|
445
446
|
infraDetail = this.query(workspaceSharedInfrastructureControllergetSharedInfrastructure) as OperationObject<Parameters<typeof workspaceSharedInfrastructureControllergetSharedInfrastructure>[0]>
|
|
447
|
+
/**
|
|
448
|
+
* Get all workspaces without stack version and favorites filter
|
|
449
|
+
*/
|
|
450
|
+
getWorkspacesWithoutStackFilter = this.query(workspaceV2ControllergetWorkspacesWithoutStackFilter)
|
|
446
451
|
}
|
|
447
452
|
|
|
448
453
|
export const workspaceClient = new WorkspaceClient()
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
useInfiniteQuery,
|
|
7
7
|
useSuspenseInfiniteQuery,
|
|
8
8
|
} from '@tanstack/react-query'
|
|
9
|
+
import { get, set } from 'lodash'
|
|
9
10
|
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
10
11
|
import { AutoQuery } from './AutoQuery'
|
|
11
12
|
import { queryClient } from './react-query-client'
|
|
@@ -35,8 +36,8 @@ export class AutoInfiniteQuery<Variables, Result, PageParamName extends keyof Va
|
|
|
35
36
|
return ({ pageParam, signal }) => {
|
|
36
37
|
const paginatedVariables = {
|
|
37
38
|
...variables,
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
}
|
|
40
|
+
set(paginatedVariables, this.options.pageParamName, pageParam ?? get(variables, this.options.pageParamName))
|
|
40
41
|
return this.callFn(paginatedVariables, signal)
|
|
41
42
|
}
|
|
42
43
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable react-hooks/rules-of-hooks */
|
|
2
|
-
|
|
3
2
|
import { InfiniteData, QueryFunctionContext, QueryKey, UseInfiniteQueryResult, useInfiniteQuery, useSuspenseInfiniteQuery } from '@tanstack/react-query'
|
|
3
|
+
import { get, set } from 'lodash'
|
|
4
4
|
import { StackspotAPIError } from '../error/StackspotAPIError'
|
|
5
5
|
import { ManualQuery } from './ManualQuery'
|
|
6
6
|
import { queryClient } from './react-query-client'
|
|
@@ -29,8 +29,8 @@ export class ManualInfiniteQuery<
|
|
|
29
29
|
return ({ pageParam, signal }) => {
|
|
30
30
|
const paginatedVariables = {
|
|
31
31
|
...variables,
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
}
|
|
33
|
+
set(paginatedVariables, this.getConfig().pageParamName, pageParam ?? get(variables, this.getConfig().pageParamName))
|
|
34
34
|
return this.makeRequest(paginatedVariables, signal)
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -218,6 +218,22 @@ export abstract class ReactQueryNetworkClient extends NetworkClient {
|
|
|
218
218
|
fn: (variables: Variables, opts?: RequestOpts) => Promise<Result>,
|
|
219
219
|
options?: Partial<InfiniteQueryOptions<Variables, Result, PageParamName, Accumulator>>,
|
|
220
220
|
): InfiniteQueryObject<Variables, Result, Accumulator>
|
|
221
|
+
/**
|
|
222
|
+
* Builds a query automatically by using a function generated by oazapfts in which the variables `pageParamName` is a string
|
|
223
|
+
* which can be used for dynamic indexing.
|
|
224
|
+
* @param fn the oazapfts function that returns an array.
|
|
225
|
+
* @param options optional configuration for the infinite query. By default, it will use the variables page and size of the function
|
|
226
|
+
* passed in the first parameter.
|
|
227
|
+
*/
|
|
228
|
+
protected infiniteQuery<
|
|
229
|
+
Variables extends Record<string, any>,
|
|
230
|
+
Result,
|
|
231
|
+
PageParamName extends string,
|
|
232
|
+
Accumulator extends keyof Result,
|
|
233
|
+
>(
|
|
234
|
+
fn: (variables: Variables, opts?: RequestOpts) => Promise<Result>,
|
|
235
|
+
options: Partial<InfiniteQueryOptions<Variables, Result, PageParamName, Accumulator>>,
|
|
236
|
+
): InfiniteQueryObject<Variables, Result, Accumulator>
|
|
221
237
|
protected infiniteQuery(
|
|
222
238
|
fnOrConfig: any, options?: Partial<InfiniteQueryOptions<any, any, any, any>>,
|
|
223
239
|
): InfiniteQueryObject<any, any, any> {
|
package/src/network/types.ts
CHANGED
|
@@ -57,7 +57,7 @@ export interface InfiniteQueryOptions<Variables, Result, PageParamName extends k
|
|
|
57
57
|
defaultVariables?: Partial<Variables>,
|
|
58
58
|
/**
|
|
59
59
|
* A function that determines the value of the page variable in order to get the next page.
|
|
60
|
-
* @
|
|
60
|
+
* @param context the current context with the variables and page details.
|
|
61
61
|
* @returns undefined or null if there are no more pages. The next value for the page variable otherwise.
|
|
62
62
|
*/
|
|
63
63
|
getNextPageParam: (context: {
|