@stack-spot/portal-network 0.183.0 → 0.184.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.
Files changed (136) hide show
  1. package/CHANGELOG.md +2412 -2405
  2. package/dist/api/account.js +1 -1
  3. package/dist/api/agent-tools.js +1 -1
  4. package/dist/api/agent.js +1 -1
  5. package/dist/api/ai.js +1 -1
  6. package/dist/api/apiManagement.js +1 -1
  7. package/dist/api/apiRuntime.js +1 -1
  8. package/dist/api/cloudAccount.js +1 -1
  9. package/dist/api/cloudPlatform.js +1 -1
  10. package/dist/api/cloudPlatformHorizon.js +1 -1
  11. package/dist/api/cloudRuntimes.js +1 -1
  12. package/dist/api/cloudServices.js +1 -1
  13. package/dist/api/codeShift.js +1 -1
  14. package/dist/api/content.js +1 -1
  15. package/dist/api/dataIntegration.js +1 -1
  16. package/dist/api/discover.js +1 -1
  17. package/dist/api/genAiInference.js +1 -1
  18. package/dist/api/insights.js +1 -1
  19. package/dist/api/notification.js +1 -1
  20. package/dist/api/secrets.js +1 -1
  21. package/dist/api/serviceCatalog.js +1 -1
  22. package/dist/api/workspace-ai.js +1 -1
  23. package/dist/api/workspace.js +1 -1
  24. package/dist/api/workspaceManager.d.ts +16 -10
  25. package/dist/api/workspaceManager.d.ts.map +1 -1
  26. package/dist/api/workspaceManager.js +11 -1
  27. package/dist/api/workspaceManager.js.map +1 -1
  28. package/dist/api/workspaceSearchEngine.js +1 -1
  29. package/dist/client/workspace-manager.d.ts +6 -0
  30. package/dist/client/workspace-manager.d.ts.map +1 -1
  31. package/dist/client/workspace-manager.js +10 -1
  32. package/dist/client/workspace-manager.js.map +1 -1
  33. package/package.json +6 -6
  34. package/scripts/generate-apis.ts +134 -134
  35. package/src/api/account.ts +8367 -8367
  36. package/src/api/agent-tools.ts +2169 -2169
  37. package/src/api/agent.ts +1083 -1083
  38. package/src/api/ai.ts +3388 -3388
  39. package/src/api/apiManagement.ts +570 -570
  40. package/src/api/apiRuntime.ts +2103 -2103
  41. package/src/api/cloudAccount.ts +1239 -1239
  42. package/src/api/cloudPlatform.ts +927 -927
  43. package/src/api/cloudPlatformHorizon.ts +2655 -2655
  44. package/src/api/cloudRuntimes.ts +2043 -2043
  45. package/src/api/cloudServices.ts +1445 -1445
  46. package/src/api/codeShift.ts +3481 -3481
  47. package/src/api/content.ts +9785 -9785
  48. package/src/api/dataIntegration.ts +1657 -1657
  49. package/src/api/discover.ts +435 -435
  50. package/src/api/eventBus.ts +171 -171
  51. package/src/api/genAiInference.ts +603 -603
  52. package/src/api/insights.ts +310 -310
  53. package/src/api/notification.ts +334 -334
  54. package/src/api/secrets.ts +342 -342
  55. package/src/api/serviceCatalog.ts +2908 -2908
  56. package/src/api/workflows.ts +1669 -1669
  57. package/src/api/workspace-ai.ts +677 -677
  58. package/src/api/workspace.ts +5889 -5889
  59. package/src/api/workspaceManager.ts +2951 -2936
  60. package/src/api/workspaceSearchEngine.ts +153 -153
  61. package/src/api-addresses.ts +120 -120
  62. package/src/apis-itau.json +225 -225
  63. package/src/apis.json +225 -225
  64. package/src/client/account.ts +902 -902
  65. package/src/client/agent-tools.ts +210 -210
  66. package/src/client/agent.ts +81 -81
  67. package/src/client/ai.ts +395 -395
  68. package/src/client/api-management.ts +40 -40
  69. package/src/client/cloud-account.ts +70 -70
  70. package/src/client/cloud-platform-horizon.ts +113 -113
  71. package/src/client/cloud-platform.ts +163 -163
  72. package/src/client/cloud-runtimes.ts +129 -129
  73. package/src/client/cloud-services.ts +94 -94
  74. package/src/client/code-shift.ts +349 -349
  75. package/src/client/content.ts +538 -538
  76. package/src/client/data-integration.ts +191 -191
  77. package/src/client/discover.ts +89 -89
  78. package/src/client/event-bus.ts +84 -84
  79. package/src/client/gen-ai-inference.ts +65 -65
  80. package/src/client/insights.ts +28 -28
  81. package/src/client/notification.ts +32 -32
  82. package/src/client/runtime-manager.ts +76 -76
  83. package/src/client/secrets.ts +60 -60
  84. package/src/client/types.ts +377 -377
  85. package/src/client/workflow.ts +83 -83
  86. package/src/client/workspace-ai.ts +191 -191
  87. package/src/client/workspace-manager.ts +564 -560
  88. package/src/client/workspace-search.ts +39 -39
  89. package/src/client/workspace.ts +480 -480
  90. package/src/error/DefaultAPIError.ts +151 -151
  91. package/src/error/FileUploadError.ts +18 -18
  92. package/src/error/IgnoredErrorCodes.ts +3 -3
  93. package/src/error/StackspotAPIError.ts +101 -101
  94. package/src/error/StreamCanceledError.ts +10 -10
  95. package/src/error/StreamError.ts +7 -7
  96. package/src/error/StreamJsonError.ts +10 -10
  97. package/src/error/dictionary/account.ts +58 -58
  98. package/src/error/dictionary/action-details.ts +20 -20
  99. package/src/error/dictionary/action.ts +211 -211
  100. package/src/error/dictionary/agent-tools.ts +75 -75
  101. package/src/error/dictionary/ai-inference.ts +28 -28
  102. package/src/error/dictionary/base.ts +22 -22
  103. package/src/error/dictionary/cloud-platform.ts +82 -82
  104. package/src/error/dictionary/cnt-fields.ts +14 -14
  105. package/src/error/dictionary/cnt.ts +103 -103
  106. package/src/error/dictionary/code-shift.ts +12 -12
  107. package/src/error/dictionary/rte.ts +24 -24
  108. package/src/error/dictionary/rtm.ts +10 -10
  109. package/src/error/dictionary/secrets.ts +14 -14
  110. package/src/error/dictionary/workspace-ai.ts +10 -10
  111. package/src/error/dictionary/workspace-details.ts +15 -15
  112. package/src/error/dictionary/workspace-fields.ts +10 -10
  113. package/src/error/dictionary/workspace.ts +209 -209
  114. package/src/error/types.ts +21 -21
  115. package/src/index.ts +43 -43
  116. package/src/network/AutoInfiniteQuery.ts +115 -115
  117. package/src/network/AutoMutation.ts +27 -27
  118. package/src/network/AutoOperation.ts +73 -73
  119. package/src/network/AutoQuery.ts +75 -75
  120. package/src/network/ManualInfiniteQuery.ts +95 -95
  121. package/src/network/ManualMutation.ts +40 -40
  122. package/src/network/ManualOperation.ts +52 -52
  123. package/src/network/ManualQuery.ts +82 -82
  124. package/src/network/NetworkClient.ts +167 -167
  125. package/src/network/ReactQueryNetworkClient.ts +312 -312
  126. package/src/network/react-query-client.ts +14 -14
  127. package/src/network/types.ts +294 -294
  128. package/src/types.ts +1 -1
  129. package/src/utils/StreamedArray.tsx +146 -146
  130. package/src/utils/StreamedJson.tsx +166 -166
  131. package/src/utils/remove-authorization-param.ts +6 -6
  132. package/src/utils/string.ts +19 -19
  133. package/src/utils/use-extended-list.ts +80 -80
  134. package/src/utils/use-streamed-array.ts +17 -17
  135. package/tsconfig.build.json +4 -4
  136. package/tsconfig.json +10 -10
@@ -1,538 +1,538 @@
1
- import { HttpError } from '@oazapfts/runtime'
2
- import {
3
- addAction,
4
- addLink,
5
- addWorkflow,
6
- addWorkspace,
7
- archiveStackVersion,
8
- associateActionToPlugin,
9
- changeVisibility,
10
- createStudio,
11
- defaults,
12
- deleteAction,
13
- deleteActionVersion,
14
- deleteLink,
15
- deletePluginVersion,
16
- deleteStudio,
17
- deleteV1StacksVersionsByStackVersionId,
18
- delWorkspace,
19
- deprecateActionVersion,
20
- deprecatePluginVersion,
21
- deprecateStackVersionBy,
22
- deprecateWorkflowVersion,
23
- downloadAction1,
24
- getActionBySlug,
25
- getActionsVersions,
26
- getActionVersionById,
27
- getAllActionVersions,
28
- getApplicationDetailsView,
29
- getApplicationsUsesPlugin,
30
- getAvailableActionVersionsByActionSlug,
31
- getAvailableWorkflowVersionsByWorkflowSlug,
32
- getDependentPluginsVersions,
33
- getDependentWorkflowVersions,
34
- getGetPluginView,
35
- getInfrastructureEnvironmentsUsesPlugin,
36
- getInputs1,
37
- getListOfInputs,
38
- getPlugin,
39
- getPluginInfrastructureView,
40
- getPluginModalView,
41
- getPluginVersions,
42
- getPluginVersionsNotInUse,
43
- getPluginVersionUsageSummary,
44
- getStackBySlugV2,
45
- getStackUsesPlugin,
46
- getStackUsesWorkflow,
47
- getStackVersionById,
48
- getStackVersionListByIds,
49
- getStackWorkspaceDetailView,
50
- getStackWorkspaces,
51
- getStarterStackVersionsAndPluginsVersions,
52
- getStarterUsesPlugin,
53
- getStudioByIdOrSlug,
54
- getStudios,
55
- getStudios1,
56
- getStudiosToCreateButton,
57
- getStudioTabs,
58
- getUnusedStackVersions,
59
- getWorkflow,
60
- getWorkflowByStudioSlug,
61
- getWorkflowDoc,
62
- getWorkflowPluginUsage,
63
- getWorkflowStackUsage,
64
- getWorkflowsUsingPlugin,
65
- getWorkflowUsageOfWorkflow,
66
- getWorkflowUsageSummary,
67
- getWorkflowVersionsNotInUse,
68
- getWorkflowVersionUsageSummary,
69
- listAccountWorkflow,
70
- listActions,
71
- listActions1,
72
- listActions2,
73
- listActionsByFilters1,
74
- listConnectionInterfaceTypes,
75
- listLinksByStackVersion,
76
- listMostUsedStackVersions,
77
- listPlugins,
78
- listPlugins1,
79
- listPluginVersionByIdsController,
80
- listReasons,
81
- listStacks,
82
- listStacks1,
83
- listStacksByFilters,
84
- listStacksByFiltersV2,
85
- listStackVersions,
86
- listStarters,
87
- listWorkflows,
88
- listWorkflowVersion,
89
- listWorkspaces,
90
- Pageable,
91
- patchStarterV2,
92
- removeActionFromPlugin,
93
- removeStackWorkflow,
94
- stackModalViewSummary,
95
- stackVersionUsageSummary,
96
- unpublishWorkflowVersion,
97
- updateStudio,
98
- updateStudioTabs,
99
- } from '../api/content'
100
- import { DefaultAPIError } from '../error/DefaultAPIError'
101
- import { cntDictionary } from '../error/dictionary/cnt'
102
- import { StackspotAPIError } from '../error/StackspotAPIError'
103
- import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
104
- import { OperationObject } from '../network/types'
105
- import { removeAuthorizationParam } from '../utils/remove-authorization-param'
106
- import { getApiAddresses } from '../api-addresses'
107
-
108
- const getStudiosWithoutAuthorization = removeAuthorizationParam(getStudios)
109
-
110
- class ContentClient extends ReactQueryNetworkClient {
111
- constructor() {
112
- super(getApiAddresses().content.url, defaults)
113
- }
114
-
115
- protected buildStackSpotError(error: HttpError): StackspotAPIError {
116
- return new DefaultAPIError(error.data, error.status, cntDictionary, error.headers)
117
- }
118
- /**
119
- * Gets links in a stack
120
- */
121
- linksInStack = this.query(listLinksByStackVersion)
122
- /**
123
- * Adds a link in a stack
124
- */
125
- addLinkInStack = this.mutation(addLink)
126
- /**
127
- * Adds a link in a stack
128
- */
129
- deleteLinkFromStack = this.mutation(deleteLink)
130
- /**
131
- * Gets all stack version by a list of ids
132
- */
133
- allStackVersionByIds = this.query(getStackVersionListByIds)
134
- /**
135
- * Gets all studios
136
- */
137
- studios = this.query(removeAuthorizationParam(getStudios1))
138
- /**
139
- * Gets all studios
140
- */
141
- studiosWithPagination = this.infiniteQuery(getStudiosWithoutAuthorization,
142
- {
143
- accumulator: 'content',
144
- initialPageParam: { page: 0 },
145
- pageParamName: 'pageable.page',
146
- getNextPageParam: ({ variables, lastPage, lastPageParam }) => {
147
- const size = variables.pageable.size ?? 1
148
- const parsedLastPageParam = (lastPageParam as Pageable)?.page ?? 0
149
- return lastPage.content && lastPage.content.length < size ? undefined : { page: parsedLastPageParam + 1 }
150
- },
151
- },
152
- )
153
- /**
154
- * Gets all studios
155
- */
156
- studiosUserHasCreatePermission = this.query(removeAuthorizationParam(getStudiosToCreateButton))
157
- /**
158
- * Gets a studio
159
- */
160
- studio = this.query(getStudioByIdOrSlug)
161
- /**
162
- * Creates a studio
163
- */
164
- createStudio = this.mutation(removeAuthorizationParam(createStudio))
165
- /**
166
- * Updates a studio
167
- */
168
- updateStudio = this.mutation(updateStudio)
169
- /**
170
- * Deletes a studio
171
- */
172
- deleteStudio = this.mutation(deleteStudio)
173
- /**
174
- * Changes studio visibility
175
- */
176
- changeStudioVisibility = this.mutation(changeVisibility)
177
- /**
178
- * Adds a workspace to a studio
179
- */
180
- addWorkspaceToStudio = this.mutation(addWorkspace)
181
- /**
182
- * Removes a given workspace from a studio
183
- */
184
- removeWorkspaceFromStudio = this.mutation(delWorkspace)
185
- /**
186
- * Gets all workspaces associated with a given studio
187
- */
188
- workspacesAssociatedToStudio = this.query(listWorkspaces)
189
- /**
190
- * Gets studio tabs
191
- */
192
- studioTabs = this.query(getStudioTabs)
193
- /**
194
- * Updates studio tabs
195
- */
196
- updateStudioTabs = this.mutation(updateStudioTabs)
197
- /**
198
- * Gets content deprecation reasons
199
- */
200
- deprecationReasons = this.query(listReasons)
201
- /**
202
- * @deprecated use stacksFromStudio instead
203
- * Gets stacks from a given studio
204
- */
205
- stacksFromStudios = this.query(listStacksByFilters)
206
- /**
207
- * Gets stacks from a given studio
208
- */
209
- stacksFromStudio = this.query(listStacksByFiltersV2)
210
- /**
211
- * Retrieves a specific stack (by slug) from a studio.
212
- */
213
- stackFromStudio = this.query(getStackBySlugV2)
214
- /**
215
- * Lists all versions of a Stack
216
- */
217
- versionsOfStack = this.query(listStackVersions)
218
-
219
- //Workflow
220
- /**
221
- * Gets workflows from a given studio
222
- */
223
- workflowsFromStudio = this.infiniteQuery(getWorkflowByStudioSlug, {
224
- accumulator: 'content',
225
- pageParamName: 'pageable.page',
226
- initialPageParam: { page: 0 },
227
- getNextPageParam: ({ variables, lastPage, lastPageParam }) => {
228
- const size = variables.pageable.size ?? 1
229
- const parsedLastPageParam = (lastPageParam as Pageable)?.page ?? 0
230
- return lastPage.content && lastPage.content.length < size ? undefined : { page: parsedLastPageParam + 1 }
231
- },
232
- })
233
-
234
- /**
235
- * Gets list of Stacks using the workflow.
236
- */
237
- stacksUsesWorkflow = this.query(getStackUsesWorkflow)
238
-
239
- /**
240
- * Get list of workflow by stack.
241
- */
242
- workflowsFromStackUsage = this.query(getWorkflowStackUsage)
243
-
244
- /**
245
- * Gets list of workflow versions not used by any Content.
246
- *
247
- */
248
- workflowVersionsNotInUse = this.query(getWorkflowVersionsNotInUse)
249
-
250
- /**
251
- * Gets list of workflow that are used by a specific workflow.
252
- */
253
- workflowsUsageOfWorkflow = this.query(getWorkflowUsageOfWorkflow)
254
-
255
- /**
256
- * Gets list of workflow versions that are used by a specific workflow.
257
- */
258
- workflowVersionsUsedByWorkflow = this.query(getDependentWorkflowVersions)
259
-
260
- /**
261
- * Gets all account workflows
262
- */
263
- accountWorkflows = this.infiniteQuery(listAccountWorkflow, { accumulator: 'content', initialPageParam: 0 })
264
- /**
265
- * Gets workflow doc
266
- */
267
- workflowDoc = this.query(getWorkflowDoc)
268
- /**
269
- * Gets a workflow by slug
270
- */
271
- workflow = this.query(getWorkflow)
272
- /**
273
- * Gets all the versions of a workflow
274
- */
275
- workflowVersions = this.query(listWorkflowVersion)
276
- /**
277
- * Gets workflows of a stack version
278
- */
279
- workflowsFromStackVersion = this.query(listWorkflows)
280
- /**
281
- * Removes a workflow from a stack version
282
- */
283
- removeWorkflowsFromStack = this.mutation(removeStackWorkflow)
284
- /**
285
- * Adds a workflow from a stack version
286
- */
287
- addWorkflowToStack = this.mutation(addWorkflow)
288
- /**
289
- * Gets workflow doc
290
- */
291
- availableWorkflowVersionsBySlug = this.query(getAvailableWorkflowVersionsByWorkflowSlug)
292
- /**
293
- * Gets usage summary of stack
294
- */
295
- stackUsageSummary = this.query(stackModalViewSummary)
296
- /**
297
- * Gets list of Workspaces using the Stack
298
- */
299
- workspacesUsingStack = this.query(getStackWorkspaces)
300
- /**
301
- * Gets list StackVersions used by Workspace
302
- */
303
- stackVersionsUsedByWorkspace = this.query(getStackWorkspaceDetailView)
304
- /**
305
- * Gets list of StackVersions not used by any Content
306
- */
307
- stackVersionsNotInUse = this.query(getUnusedStackVersions)
308
- /**
309
- * Get usage summary of plugin
310
- */
311
- pluginUsageSummary = this.query(getPluginModalView)
312
-
313
- /**
314
- * Gets list of Workflow versions using the plugin
315
- */
316
- workflowVersionsPluginUsage = this.query(getWorkflowPluginUsage)
317
-
318
- /**
319
- * Gets list of Stacks using the plugin
320
- */
321
- stacksUsingPlugin = this.query(getStackUsesPlugin)
322
- /**
323
- * Gets list of PluginVersions used by Stack
324
- */
325
- pluginVersionsUsedByStack = this.query(getPluginVersions)
326
- /**
327
- * Gets list of Plugin that requires the plugin
328
- */
329
- pluginsRequiresPlugin = this.query(getGetPluginView)
330
- /**
331
- * Gets list of PluginVersions used by Plugin
332
- */
333
- pluginVersionsUsedByPlugin = this.query(getDependentPluginsVersions)
334
- /**
335
- * Gets list of Starter using the plugin
336
- */
337
- starterUsingPlugin = this.query(getStarterUsesPlugin)
338
- /**
339
- * Gets list of PluginVersions used by Starter
340
- */
341
- pluginVersionsUsedByStarter = this.query(getStarterStackVersionsAndPluginsVersions)
342
- /**
343
- * Gets list of Infrastructure using the plugin
344
- */
345
- infrastructureUsingPlugin = this.query(getPluginInfrastructureView)
346
- /**
347
- * Gets list of PluginVersions used by Infrastructure
348
- */
349
- pluginVersionsUsedByInfrastructure = this.query(getInfrastructureEnvironmentsUsesPlugin)
350
- /**
351
- * Gets list of Application using the plugin
352
- */
353
- applicationUsingPlugin = this.query(getApplicationsUsesPlugin)
354
- /**
355
- * Gets list of workflow using the plugin
356
- */
357
- workflowsUsingPlugin = this.query(getWorkflowsUsingPlugin)
358
- /**
359
- * Gets list of PluginVersions used by Applications
360
- */
361
- pluginVersionsUsedByApplication = this.query(getApplicationDetailsView)
362
- /**
363
- * Gets list of PluginVersions not used by any Content
364
- */
365
- pluginVersionsNotInUse = this.query(getPluginVersionsNotInUse)
366
- /**
367
- * Get Stack Version Usage Summary
368
- */
369
- stackVersionsUsageSummary = this.query(stackVersionUsageSummary)
370
- /**
371
- * Get Plugin Version Usage Summary
372
- */
373
- pluginVersionUsageSummary = this.query(getPluginVersionUsageSummary)
374
- /**
375
- * Deprecate a stack version
376
- */
377
- deprecateStackVersion = this.mutation(removeAuthorizationParam(deprecateStackVersionBy))
378
- /**
379
- * Archive a stack version
380
- */
381
- archiveStackVersion = this.mutation(archiveStackVersion)
382
- /**
383
- * Delete a stack version of type draft or unpublish
384
- */
385
- deleteStackVersion = this.mutation(deleteV1StacksVersionsByStackVersionId)
386
- /**
387
- * Deprecate a plugin version
388
- */
389
- deprecatePluginVersion = this.mutation(removeAuthorizationParam(deprecatePluginVersion))
390
- /**
391
- * Delete a Plugin version of type draft or unpublish
392
- */
393
- deletePluginVersion = this.mutation(deletePluginVersion)
394
- /**
395
- * Gets Action by Slug and Studio
396
- */
397
- action = this.query(getActionBySlug)
398
- /**
399
- * Gets all Versions of Action
400
- */
401
- actionVersions = this.query(getAllActionVersions)
402
- /**
403
- * Gets Action by Action Version Id
404
- */
405
- actionByActionVersionId = this.query(getActionVersionById)
406
- /**
407
- * Gets list of Actions V2
408
- */
409
- actionsV2 = this.infiniteQuery(listActions, {
410
- accumulator: 'content',
411
- initialPageParam: { page: 0 },
412
- pageParamName: 'pageable.page',
413
- getNextPageParam: ({ variables, lastPage, lastPageParam }) => {
414
- const size = variables.pageable.size ?? 1
415
- const parsedLastPageParam = (lastPageParam as Pageable)?.page ?? 0
416
- return lastPage.content && lastPage.content.length < size ? undefined : { page: parsedLastPageParam + 1 }
417
- },
418
- })
419
- /**
420
- * Gets list of Actions V1
421
- */
422
- actions = this.query(listActions2)
423
- /**
424
- * Get list of Actions in Stack
425
- */
426
- actionsInStack = this.query(listActions1)
427
- /**
428
- * Add Action to Stack Version
429
- */
430
- addActionsToStackVersion = this.mutation(addAction)
431
- /**
432
- * Add Action to Plugin Version
433
- */
434
- addActionsToPluginVersion = this.mutation(associateActionToPlugin)
435
- /**
436
- * Remove Action Version from Stack
437
- */
438
- removeActionVersionFromStack = this.mutation(deleteAction)
439
- /**
440
- * Remove Action Version from Plugin
441
- */
442
- removeActionVersionFromPlugin = this.mutation(removeActionFromPlugin)
443
- /**
444
- * Delete Action Version
445
- */
446
- deleteActionVersion = this.mutation(deleteActionVersion)
447
- /**
448
- * Deprecate Action Version
449
- */
450
- deprecateActionVersion = this.mutation(deprecateActionVersion)
451
- /**
452
- * Download Action Version
453
- */
454
- downloadActionVersion = this.query(downloadAction1)
455
- /**
456
- * Get Action Version range by Action Slug
457
- */
458
- actionVersionRange = this.query(getAvailableActionVersionsByActionSlug)
459
- /**
460
- * Get Actions from Stack
461
- */
462
- actionsFromStack = this.query(listActionsByFilters1)
463
- /*
464
- * Update starter
465
- */
466
- updateStarter = this.mutation(patchStarterV2)
467
- /**
468
- * Gets connection interface types
469
- */
470
- connectionInterfaceTypes = this.query(listConnectionInterfaceTypes)
471
- /**
472
- * Gets a list of plugin versions from list of ids.
473
- */
474
- pluginVersionsByIds = this.query(listPluginVersionByIdsController)
475
- /**
476
- * Gets plugins from a stack version
477
- */
478
- listPluginsFromStack = this.query(listPlugins1)
479
- /**
480
- * Gets the inputs of a specific Action. This fn is only used for permission purposes.
481
- */
482
- actionInputs = this.query(getListOfInputs) as
483
- OperationObject<Parameters<typeof getListOfInputs>[0]>
484
- /**
485
- * Gets action versions by ids
486
- */
487
- actionsVersions = this.query(getActionsVersions)
488
- /**
489
- * Gets all starters from a stack version id
490
- */
491
- startersInStackVersion = this.query(listStarters)
492
- /**
493
- * Gets a stack from a stack version id
494
- */
495
- getStackByVersionId = this.query(getStackVersionById)
496
- /**
497
- * View all stacks V3 by account
498
- */
499
- getAllStacksV3 = this.query(listStacks)
500
- /**
501
- * View all stacks by account
502
- */
503
- getAllStacks = this.query(listStacks1)
504
- /**
505
- * List most used stack versions
506
- */
507
- listMostUsedStackVersions = this.query(listMostUsedStackVersions)
508
- /**
509
- * List plugins v2
510
- */
511
- pluginsV2 = this.infiniteQuery(listPlugins, { accumulator: 'content', initialPageParam: 0 })
512
- /**
513
- * Get plugin
514
- */
515
- plugin = this.query(getPlugin)
516
- /**
517
- * Deprecate workflow version
518
- */
519
- deprecateWorkflowVersion = this.mutation(deprecateWorkflowVersion)
520
- /**
521
- * Unpublish workflow version
522
- */
523
- unpublishWorkflowVersion = this.mutation(unpublishWorkflowVersion)
524
- /**
525
- * Get usage summary of workflow
526
- */
527
- workflowUsageSummary = this.query(getWorkflowUsageSummary)
528
- /**
529
- * Get usage summary of workflow version
530
- */
531
- workflowVersionUsageSummary = this.query(getWorkflowVersionUsageSummary)
532
- /**
533
- * Get list of inputs of a workflow
534
- */
535
- workflowInputs = this.query(getInputs1)
536
- }
537
-
538
- export const contentClient = new ContentClient()
1
+ import { HttpError } from '@oazapfts/runtime'
2
+ import {
3
+ addAction,
4
+ addLink,
5
+ addWorkflow,
6
+ addWorkspace,
7
+ archiveStackVersion,
8
+ associateActionToPlugin,
9
+ changeVisibility,
10
+ createStudio,
11
+ defaults,
12
+ deleteAction,
13
+ deleteActionVersion,
14
+ deleteLink,
15
+ deletePluginVersion,
16
+ deleteStudio,
17
+ deleteV1StacksVersionsByStackVersionId,
18
+ delWorkspace,
19
+ deprecateActionVersion,
20
+ deprecatePluginVersion,
21
+ deprecateStackVersionBy,
22
+ deprecateWorkflowVersion,
23
+ downloadAction1,
24
+ getActionBySlug,
25
+ getActionsVersions,
26
+ getActionVersionById,
27
+ getAllActionVersions,
28
+ getApplicationDetailsView,
29
+ getApplicationsUsesPlugin,
30
+ getAvailableActionVersionsByActionSlug,
31
+ getAvailableWorkflowVersionsByWorkflowSlug,
32
+ getDependentPluginsVersions,
33
+ getDependentWorkflowVersions,
34
+ getGetPluginView,
35
+ getInfrastructureEnvironmentsUsesPlugin,
36
+ getInputs1,
37
+ getListOfInputs,
38
+ getPlugin,
39
+ getPluginInfrastructureView,
40
+ getPluginModalView,
41
+ getPluginVersions,
42
+ getPluginVersionsNotInUse,
43
+ getPluginVersionUsageSummary,
44
+ getStackBySlugV2,
45
+ getStackUsesPlugin,
46
+ getStackUsesWorkflow,
47
+ getStackVersionById,
48
+ getStackVersionListByIds,
49
+ getStackWorkspaceDetailView,
50
+ getStackWorkspaces,
51
+ getStarterStackVersionsAndPluginsVersions,
52
+ getStarterUsesPlugin,
53
+ getStudioByIdOrSlug,
54
+ getStudios,
55
+ getStudios1,
56
+ getStudiosToCreateButton,
57
+ getStudioTabs,
58
+ getUnusedStackVersions,
59
+ getWorkflow,
60
+ getWorkflowByStudioSlug,
61
+ getWorkflowDoc,
62
+ getWorkflowPluginUsage,
63
+ getWorkflowStackUsage,
64
+ getWorkflowsUsingPlugin,
65
+ getWorkflowUsageOfWorkflow,
66
+ getWorkflowUsageSummary,
67
+ getWorkflowVersionsNotInUse,
68
+ getWorkflowVersionUsageSummary,
69
+ listAccountWorkflow,
70
+ listActions,
71
+ listActions1,
72
+ listActions2,
73
+ listActionsByFilters1,
74
+ listConnectionInterfaceTypes,
75
+ listLinksByStackVersion,
76
+ listMostUsedStackVersions,
77
+ listPlugins,
78
+ listPlugins1,
79
+ listPluginVersionByIdsController,
80
+ listReasons,
81
+ listStacks,
82
+ listStacks1,
83
+ listStacksByFilters,
84
+ listStacksByFiltersV2,
85
+ listStackVersions,
86
+ listStarters,
87
+ listWorkflows,
88
+ listWorkflowVersion,
89
+ listWorkspaces,
90
+ Pageable,
91
+ patchStarterV2,
92
+ removeActionFromPlugin,
93
+ removeStackWorkflow,
94
+ stackModalViewSummary,
95
+ stackVersionUsageSummary,
96
+ unpublishWorkflowVersion,
97
+ updateStudio,
98
+ updateStudioTabs,
99
+ } from '../api/content'
100
+ import { DefaultAPIError } from '../error/DefaultAPIError'
101
+ import { cntDictionary } from '../error/dictionary/cnt'
102
+ import { StackspotAPIError } from '../error/StackspotAPIError'
103
+ import { ReactQueryNetworkClient } from '../network/ReactQueryNetworkClient'
104
+ import { OperationObject } from '../network/types'
105
+ import { removeAuthorizationParam } from '../utils/remove-authorization-param'
106
+ import { getApiAddresses } from '../api-addresses'
107
+
108
+ const getStudiosWithoutAuthorization = removeAuthorizationParam(getStudios)
109
+
110
+ class ContentClient extends ReactQueryNetworkClient {
111
+ constructor() {
112
+ super(getApiAddresses().content.url, defaults)
113
+ }
114
+
115
+ protected buildStackSpotError(error: HttpError): StackspotAPIError {
116
+ return new DefaultAPIError(error.data, error.status, cntDictionary, error.headers)
117
+ }
118
+ /**
119
+ * Gets links in a stack
120
+ */
121
+ linksInStack = this.query(listLinksByStackVersion)
122
+ /**
123
+ * Adds a link in a stack
124
+ */
125
+ addLinkInStack = this.mutation(addLink)
126
+ /**
127
+ * Adds a link in a stack
128
+ */
129
+ deleteLinkFromStack = this.mutation(deleteLink)
130
+ /**
131
+ * Gets all stack version by a list of ids
132
+ */
133
+ allStackVersionByIds = this.query(getStackVersionListByIds)
134
+ /**
135
+ * Gets all studios
136
+ */
137
+ studios = this.query(removeAuthorizationParam(getStudios1))
138
+ /**
139
+ * Gets all studios
140
+ */
141
+ studiosWithPagination = this.infiniteQuery(getStudiosWithoutAuthorization,
142
+ {
143
+ accumulator: 'content',
144
+ initialPageParam: { page: 0 },
145
+ pageParamName: 'pageable.page',
146
+ getNextPageParam: ({ variables, lastPage, lastPageParam }) => {
147
+ const size = variables.pageable.size ?? 1
148
+ const parsedLastPageParam = (lastPageParam as Pageable)?.page ?? 0
149
+ return lastPage.content && lastPage.content.length < size ? undefined : { page: parsedLastPageParam + 1 }
150
+ },
151
+ },
152
+ )
153
+ /**
154
+ * Gets all studios
155
+ */
156
+ studiosUserHasCreatePermission = this.query(removeAuthorizationParam(getStudiosToCreateButton))
157
+ /**
158
+ * Gets a studio
159
+ */
160
+ studio = this.query(getStudioByIdOrSlug)
161
+ /**
162
+ * Creates a studio
163
+ */
164
+ createStudio = this.mutation(removeAuthorizationParam(createStudio))
165
+ /**
166
+ * Updates a studio
167
+ */
168
+ updateStudio = this.mutation(updateStudio)
169
+ /**
170
+ * Deletes a studio
171
+ */
172
+ deleteStudio = this.mutation(deleteStudio)
173
+ /**
174
+ * Changes studio visibility
175
+ */
176
+ changeStudioVisibility = this.mutation(changeVisibility)
177
+ /**
178
+ * Adds a workspace to a studio
179
+ */
180
+ addWorkspaceToStudio = this.mutation(addWorkspace)
181
+ /**
182
+ * Removes a given workspace from a studio
183
+ */
184
+ removeWorkspaceFromStudio = this.mutation(delWorkspace)
185
+ /**
186
+ * Gets all workspaces associated with a given studio
187
+ */
188
+ workspacesAssociatedToStudio = this.query(listWorkspaces)
189
+ /**
190
+ * Gets studio tabs
191
+ */
192
+ studioTabs = this.query(getStudioTabs)
193
+ /**
194
+ * Updates studio tabs
195
+ */
196
+ updateStudioTabs = this.mutation(updateStudioTabs)
197
+ /**
198
+ * Gets content deprecation reasons
199
+ */
200
+ deprecationReasons = this.query(listReasons)
201
+ /**
202
+ * @deprecated use stacksFromStudio instead
203
+ * Gets stacks from a given studio
204
+ */
205
+ stacksFromStudios = this.query(listStacksByFilters)
206
+ /**
207
+ * Gets stacks from a given studio
208
+ */
209
+ stacksFromStudio = this.query(listStacksByFiltersV2)
210
+ /**
211
+ * Retrieves a specific stack (by slug) from a studio.
212
+ */
213
+ stackFromStudio = this.query(getStackBySlugV2)
214
+ /**
215
+ * Lists all versions of a Stack
216
+ */
217
+ versionsOfStack = this.query(listStackVersions)
218
+
219
+ //Workflow
220
+ /**
221
+ * Gets workflows from a given studio
222
+ */
223
+ workflowsFromStudio = this.infiniteQuery(getWorkflowByStudioSlug, {
224
+ accumulator: 'content',
225
+ pageParamName: 'pageable.page',
226
+ initialPageParam: { page: 0 },
227
+ getNextPageParam: ({ variables, lastPage, lastPageParam }) => {
228
+ const size = variables.pageable.size ?? 1
229
+ const parsedLastPageParam = (lastPageParam as Pageable)?.page ?? 0
230
+ return lastPage.content && lastPage.content.length < size ? undefined : { page: parsedLastPageParam + 1 }
231
+ },
232
+ })
233
+
234
+ /**
235
+ * Gets list of Stacks using the workflow.
236
+ */
237
+ stacksUsesWorkflow = this.query(getStackUsesWorkflow)
238
+
239
+ /**
240
+ * Get list of workflow by stack.
241
+ */
242
+ workflowsFromStackUsage = this.query(getWorkflowStackUsage)
243
+
244
+ /**
245
+ * Gets list of workflow versions not used by any Content.
246
+ *
247
+ */
248
+ workflowVersionsNotInUse = this.query(getWorkflowVersionsNotInUse)
249
+
250
+ /**
251
+ * Gets list of workflow that are used by a specific workflow.
252
+ */
253
+ workflowsUsageOfWorkflow = this.query(getWorkflowUsageOfWorkflow)
254
+
255
+ /**
256
+ * Gets list of workflow versions that are used by a specific workflow.
257
+ */
258
+ workflowVersionsUsedByWorkflow = this.query(getDependentWorkflowVersions)
259
+
260
+ /**
261
+ * Gets all account workflows
262
+ */
263
+ accountWorkflows = this.infiniteQuery(listAccountWorkflow, { accumulator: 'content', initialPageParam: 0 })
264
+ /**
265
+ * Gets workflow doc
266
+ */
267
+ workflowDoc = this.query(getWorkflowDoc)
268
+ /**
269
+ * Gets a workflow by slug
270
+ */
271
+ workflow = this.query(getWorkflow)
272
+ /**
273
+ * Gets all the versions of a workflow
274
+ */
275
+ workflowVersions = this.query(listWorkflowVersion)
276
+ /**
277
+ * Gets workflows of a stack version
278
+ */
279
+ workflowsFromStackVersion = this.query(listWorkflows)
280
+ /**
281
+ * Removes a workflow from a stack version
282
+ */
283
+ removeWorkflowsFromStack = this.mutation(removeStackWorkflow)
284
+ /**
285
+ * Adds a workflow from a stack version
286
+ */
287
+ addWorkflowToStack = this.mutation(addWorkflow)
288
+ /**
289
+ * Gets workflow doc
290
+ */
291
+ availableWorkflowVersionsBySlug = this.query(getAvailableWorkflowVersionsByWorkflowSlug)
292
+ /**
293
+ * Gets usage summary of stack
294
+ */
295
+ stackUsageSummary = this.query(stackModalViewSummary)
296
+ /**
297
+ * Gets list of Workspaces using the Stack
298
+ */
299
+ workspacesUsingStack = this.query(getStackWorkspaces)
300
+ /**
301
+ * Gets list StackVersions used by Workspace
302
+ */
303
+ stackVersionsUsedByWorkspace = this.query(getStackWorkspaceDetailView)
304
+ /**
305
+ * Gets list of StackVersions not used by any Content
306
+ */
307
+ stackVersionsNotInUse = this.query(getUnusedStackVersions)
308
+ /**
309
+ * Get usage summary of plugin
310
+ */
311
+ pluginUsageSummary = this.query(getPluginModalView)
312
+
313
+ /**
314
+ * Gets list of Workflow versions using the plugin
315
+ */
316
+ workflowVersionsPluginUsage = this.query(getWorkflowPluginUsage)
317
+
318
+ /**
319
+ * Gets list of Stacks using the plugin
320
+ */
321
+ stacksUsingPlugin = this.query(getStackUsesPlugin)
322
+ /**
323
+ * Gets list of PluginVersions used by Stack
324
+ */
325
+ pluginVersionsUsedByStack = this.query(getPluginVersions)
326
+ /**
327
+ * Gets list of Plugin that requires the plugin
328
+ */
329
+ pluginsRequiresPlugin = this.query(getGetPluginView)
330
+ /**
331
+ * Gets list of PluginVersions used by Plugin
332
+ */
333
+ pluginVersionsUsedByPlugin = this.query(getDependentPluginsVersions)
334
+ /**
335
+ * Gets list of Starter using the plugin
336
+ */
337
+ starterUsingPlugin = this.query(getStarterUsesPlugin)
338
+ /**
339
+ * Gets list of PluginVersions used by Starter
340
+ */
341
+ pluginVersionsUsedByStarter = this.query(getStarterStackVersionsAndPluginsVersions)
342
+ /**
343
+ * Gets list of Infrastructure using the plugin
344
+ */
345
+ infrastructureUsingPlugin = this.query(getPluginInfrastructureView)
346
+ /**
347
+ * Gets list of PluginVersions used by Infrastructure
348
+ */
349
+ pluginVersionsUsedByInfrastructure = this.query(getInfrastructureEnvironmentsUsesPlugin)
350
+ /**
351
+ * Gets list of Application using the plugin
352
+ */
353
+ applicationUsingPlugin = this.query(getApplicationsUsesPlugin)
354
+ /**
355
+ * Gets list of workflow using the plugin
356
+ */
357
+ workflowsUsingPlugin = this.query(getWorkflowsUsingPlugin)
358
+ /**
359
+ * Gets list of PluginVersions used by Applications
360
+ */
361
+ pluginVersionsUsedByApplication = this.query(getApplicationDetailsView)
362
+ /**
363
+ * Gets list of PluginVersions not used by any Content
364
+ */
365
+ pluginVersionsNotInUse = this.query(getPluginVersionsNotInUse)
366
+ /**
367
+ * Get Stack Version Usage Summary
368
+ */
369
+ stackVersionsUsageSummary = this.query(stackVersionUsageSummary)
370
+ /**
371
+ * Get Plugin Version Usage Summary
372
+ */
373
+ pluginVersionUsageSummary = this.query(getPluginVersionUsageSummary)
374
+ /**
375
+ * Deprecate a stack version
376
+ */
377
+ deprecateStackVersion = this.mutation(removeAuthorizationParam(deprecateStackVersionBy))
378
+ /**
379
+ * Archive a stack version
380
+ */
381
+ archiveStackVersion = this.mutation(archiveStackVersion)
382
+ /**
383
+ * Delete a stack version of type draft or unpublish
384
+ */
385
+ deleteStackVersion = this.mutation(deleteV1StacksVersionsByStackVersionId)
386
+ /**
387
+ * Deprecate a plugin version
388
+ */
389
+ deprecatePluginVersion = this.mutation(removeAuthorizationParam(deprecatePluginVersion))
390
+ /**
391
+ * Delete a Plugin version of type draft or unpublish
392
+ */
393
+ deletePluginVersion = this.mutation(deletePluginVersion)
394
+ /**
395
+ * Gets Action by Slug and Studio
396
+ */
397
+ action = this.query(getActionBySlug)
398
+ /**
399
+ * Gets all Versions of Action
400
+ */
401
+ actionVersions = this.query(getAllActionVersions)
402
+ /**
403
+ * Gets Action by Action Version Id
404
+ */
405
+ actionByActionVersionId = this.query(getActionVersionById)
406
+ /**
407
+ * Gets list of Actions V2
408
+ */
409
+ actionsV2 = this.infiniteQuery(listActions, {
410
+ accumulator: 'content',
411
+ initialPageParam: { page: 0 },
412
+ pageParamName: 'pageable.page',
413
+ getNextPageParam: ({ variables, lastPage, lastPageParam }) => {
414
+ const size = variables.pageable.size ?? 1
415
+ const parsedLastPageParam = (lastPageParam as Pageable)?.page ?? 0
416
+ return lastPage.content && lastPage.content.length < size ? undefined : { page: parsedLastPageParam + 1 }
417
+ },
418
+ })
419
+ /**
420
+ * Gets list of Actions V1
421
+ */
422
+ actions = this.query(listActions2)
423
+ /**
424
+ * Get list of Actions in Stack
425
+ */
426
+ actionsInStack = this.query(listActions1)
427
+ /**
428
+ * Add Action to Stack Version
429
+ */
430
+ addActionsToStackVersion = this.mutation(addAction)
431
+ /**
432
+ * Add Action to Plugin Version
433
+ */
434
+ addActionsToPluginVersion = this.mutation(associateActionToPlugin)
435
+ /**
436
+ * Remove Action Version from Stack
437
+ */
438
+ removeActionVersionFromStack = this.mutation(deleteAction)
439
+ /**
440
+ * Remove Action Version from Plugin
441
+ */
442
+ removeActionVersionFromPlugin = this.mutation(removeActionFromPlugin)
443
+ /**
444
+ * Delete Action Version
445
+ */
446
+ deleteActionVersion = this.mutation(deleteActionVersion)
447
+ /**
448
+ * Deprecate Action Version
449
+ */
450
+ deprecateActionVersion = this.mutation(deprecateActionVersion)
451
+ /**
452
+ * Download Action Version
453
+ */
454
+ downloadActionVersion = this.query(downloadAction1)
455
+ /**
456
+ * Get Action Version range by Action Slug
457
+ */
458
+ actionVersionRange = this.query(getAvailableActionVersionsByActionSlug)
459
+ /**
460
+ * Get Actions from Stack
461
+ */
462
+ actionsFromStack = this.query(listActionsByFilters1)
463
+ /*
464
+ * Update starter
465
+ */
466
+ updateStarter = this.mutation(patchStarterV2)
467
+ /**
468
+ * Gets connection interface types
469
+ */
470
+ connectionInterfaceTypes = this.query(listConnectionInterfaceTypes)
471
+ /**
472
+ * Gets a list of plugin versions from list of ids.
473
+ */
474
+ pluginVersionsByIds = this.query(listPluginVersionByIdsController)
475
+ /**
476
+ * Gets plugins from a stack version
477
+ */
478
+ listPluginsFromStack = this.query(listPlugins1)
479
+ /**
480
+ * Gets the inputs of a specific Action. This fn is only used for permission purposes.
481
+ */
482
+ actionInputs = this.query(getListOfInputs) as
483
+ OperationObject<Parameters<typeof getListOfInputs>[0]>
484
+ /**
485
+ * Gets action versions by ids
486
+ */
487
+ actionsVersions = this.query(getActionsVersions)
488
+ /**
489
+ * Gets all starters from a stack version id
490
+ */
491
+ startersInStackVersion = this.query(listStarters)
492
+ /**
493
+ * Gets a stack from a stack version id
494
+ */
495
+ getStackByVersionId = this.query(getStackVersionById)
496
+ /**
497
+ * View all stacks V3 by account
498
+ */
499
+ getAllStacksV3 = this.query(listStacks)
500
+ /**
501
+ * View all stacks by account
502
+ */
503
+ getAllStacks = this.query(listStacks1)
504
+ /**
505
+ * List most used stack versions
506
+ */
507
+ listMostUsedStackVersions = this.query(listMostUsedStackVersions)
508
+ /**
509
+ * List plugins v2
510
+ */
511
+ pluginsV2 = this.infiniteQuery(listPlugins, { accumulator: 'content', initialPageParam: 0 })
512
+ /**
513
+ * Get plugin
514
+ */
515
+ plugin = this.query(getPlugin)
516
+ /**
517
+ * Deprecate workflow version
518
+ */
519
+ deprecateWorkflowVersion = this.mutation(deprecateWorkflowVersion)
520
+ /**
521
+ * Unpublish workflow version
522
+ */
523
+ unpublishWorkflowVersion = this.mutation(unpublishWorkflowVersion)
524
+ /**
525
+ * Get usage summary of workflow
526
+ */
527
+ workflowUsageSummary = this.query(getWorkflowUsageSummary)
528
+ /**
529
+ * Get usage summary of workflow version
530
+ */
531
+ workflowVersionUsageSummary = this.query(getWorkflowVersionUsageSummary)
532
+ /**
533
+ * Get list of inputs of a workflow
534
+ */
535
+ workflowInputs = this.query(getInputs1)
536
+ }
537
+
538
+ export const contentClient = new ContentClient()