@stack-spot/portal-network 0.184.0 → 0.185.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 +2419 -2412
  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.d.ts +63 -4
  14. package/dist/api/codeShift.d.ts.map +1 -1
  15. package/dist/api/codeShift.js +14 -1
  16. package/dist/api/codeShift.js.map +1 -1
  17. package/dist/api/content.js +1 -1
  18. package/dist/api/dataIntegration.js +1 -1
  19. package/dist/api/discover.js +1 -1
  20. package/dist/api/genAiInference.js +1 -1
  21. package/dist/api/insights.js +1 -1
  22. package/dist/api/notification.js +1 -1
  23. package/dist/api/secrets.js +1 -1
  24. package/dist/api/serviceCatalog.js +1 -1
  25. package/dist/api/workspace-ai.js +1 -1
  26. package/dist/api/workspace.js +1 -1
  27. package/dist/api/workspaceManager.js +1 -1
  28. package/dist/api/workspaceSearchEngine.js +1 -1
  29. package/dist/client/code-shift.d.ts +22 -0
  30. package/dist/client/code-shift.d.ts.map +1 -1
  31. package/dist/client/code-shift.js +28 -1
  32. package/dist/client/code-shift.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 +3567 -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 -2951
  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 +364 -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 -564
  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,19 +1,19 @@
1
- /**
2
- * If the parameter is a string and it's a valid json, it's formatted with proper line breaks and indentation. If it's not a valid json,
3
- * the original string is returned.
4
- *
5
- * If the parameter is not a string, a formatted JSON string representation of it is returned.
6
- *
7
- * @param data the data to format.
8
- * @returns the formatted json string or the original string if not a valid json.
9
- */
10
- export function formatJson(data: any): string {
11
- if (typeof data === 'string') {
12
- try {
13
- return JSON.stringify(JSON.parse(data), null, 2)
14
- } catch {
15
- return data
16
- }
17
- }
18
- return JSON.stringify(data, null, 2)
19
- }
1
+ /**
2
+ * If the parameter is a string and it's a valid json, it's formatted with proper line breaks and indentation. If it's not a valid json,
3
+ * the original string is returned.
4
+ *
5
+ * If the parameter is not a string, a formatted JSON string representation of it is returned.
6
+ *
7
+ * @param data the data to format.
8
+ * @returns the formatted json string or the original string if not a valid json.
9
+ */
10
+ export function formatJson(data: any): string {
11
+ if (typeof data === 'string') {
12
+ try {
13
+ return JSON.stringify(JSON.parse(data), null, 2)
14
+ } catch {
15
+ return data
16
+ }
17
+ }
18
+ return JSON.stringify(data, null, 2)
19
+ }
@@ -1,80 +1,80 @@
1
- import { useEffect, useRef, useState } from 'react'
2
-
3
- type ExtensionMap<T> = Record<string, (item: T) => any>
4
-
5
- type Unpromisify<T> = T extends Promise<infer R> ? R : T
6
-
7
- type Extension<E extends ExtensionMap<any>> = { [K in keyof E]?: Unpromisify<ReturnType<E[K]>> }
8
-
9
- type ItemWithExtensions<T, E extends ExtensionMap<T>> = T & Extension<E>
10
-
11
- /**
12
- * Computes the given extensions for the items in the list passed as parameter. An extension will, most of the times, return a promise,
13
- * but it can return whatever you'd like.
14
- *
15
- * If the extensions are promises and are still loading, the items won't have the corresponding keys.
16
- *
17
- * Attention: once an extension is calculated for an item, it's never calculated again. An item is identified by the parameter "idProp"
18
- * (3rd), which is "id" by default.
19
- *
20
- * @example
21
- * ```
22
- * const [groups] = accountClient.memberGroups.useInfiniteQuery({ memberId: 'someId' })
23
- * const extendedGroups = useExtendedList(groups, {
24
- * canRemoveMemberFromGroup: group => accountClient.removeMemberFromGroup.isAllowed({ groupId: group.id, memberId: 'someId' }),
25
- * title: group => `${group.name} (${group.totalUsers})`,
26
- * })
27
- * ```
28
- * Above, each item in `extendedGroups` will have the properties `canRemoveMemberFromGroup` and `title`, once all permission have been
29
- * fetched.
30
- *
31
- * @param list the items to compute extensions for.
32
- * @param extensions an object where the keys are the extension names and the values are functions that return the value of the extension.
33
- * @param idProp the name of the property that can be used as an id. 'id' by default.
34
- * @returns an array with 2 items:
35
- * - [0]: the list with the permission properties.
36
- * - [1]: true if waiting for a promise, false otherwise.
37
- */
38
- export function useExtendedList<T, E extends ExtensionMap<T>>(
39
- list: T[], extensions: E, idProp: keyof T,
40
- ): [ItemWithExtensions<T, E>[], boolean]
41
- export function useExtendedList<T extends { id: string }, E extends ExtensionMap<T>>(
42
- list: T[], extensions: E, idProp?: keyof T,
43
- ): [ItemWithExtensions<T, E>[], boolean]
44
- export function useExtendedList<T, E extends ExtensionMap<T>>(
45
- list: T[], extensions: E, idProp = 'id' as keyof T,
46
- ): [ItemWithExtensions<T, E>[], boolean] {
47
- const [listWithExtensions, setListWithExtensions] = useState(list as ItemWithExtensions<T, E>[])
48
- const [isLoading, setLoading] = useState(true)
49
- const extensionMap = useRef(new Map<any, Extension<E>>())
50
- const listId = list.map(i => i[idProp]).join(';')
51
-
52
- useEffect(() => {
53
- async function update() {
54
- setLoading(true)
55
- const newList = await Promise.all(list.map(async (item) => {
56
- const itemExtensions: Extension<E> = extensionMap.current.get(item[idProp]) ?? {}
57
- if (Object.keys(itemExtensions).length === 0) {
58
- await Promise.all(Object.keys(extensions).map(async (key: keyof E) => {
59
- try {
60
- // "await" because it might be a promise
61
- itemExtensions[key] = await extensions[key](item)
62
- } catch (error) {
63
- // eslint-disable-next-line no-console
64
- console.error(`Failed to compute extension "${String(key)}" for item with id "${item[idProp]}". It will have undefined as its value, which may cause errors ahead. Caused by the error below:`)
65
- // eslint-disable-next-line no-console
66
- console.error(error)
67
- }
68
- }))
69
- extensionMap.current.set(item[idProp], itemExtensions)
70
- }
71
- return { ...item, ...itemExtensions }
72
- }))
73
- setLoading(false)
74
- setListWithExtensions(newList)
75
- }
76
- update()
77
- }, [listId])
78
-
79
- return [listWithExtensions.length ? listWithExtensions : list as ItemWithExtensions<T, E>[], isLoading]
80
- }
1
+ import { useEffect, useRef, useState } from 'react'
2
+
3
+ type ExtensionMap<T> = Record<string, (item: T) => any>
4
+
5
+ type Unpromisify<T> = T extends Promise<infer R> ? R : T
6
+
7
+ type Extension<E extends ExtensionMap<any>> = { [K in keyof E]?: Unpromisify<ReturnType<E[K]>> }
8
+
9
+ type ItemWithExtensions<T, E extends ExtensionMap<T>> = T & Extension<E>
10
+
11
+ /**
12
+ * Computes the given extensions for the items in the list passed as parameter. An extension will, most of the times, return a promise,
13
+ * but it can return whatever you'd like.
14
+ *
15
+ * If the extensions are promises and are still loading, the items won't have the corresponding keys.
16
+ *
17
+ * Attention: once an extension is calculated for an item, it's never calculated again. An item is identified by the parameter "idProp"
18
+ * (3rd), which is "id" by default.
19
+ *
20
+ * @example
21
+ * ```
22
+ * const [groups] = accountClient.memberGroups.useInfiniteQuery({ memberId: 'someId' })
23
+ * const extendedGroups = useExtendedList(groups, {
24
+ * canRemoveMemberFromGroup: group => accountClient.removeMemberFromGroup.isAllowed({ groupId: group.id, memberId: 'someId' }),
25
+ * title: group => `${group.name} (${group.totalUsers})`,
26
+ * })
27
+ * ```
28
+ * Above, each item in `extendedGroups` will have the properties `canRemoveMemberFromGroup` and `title`, once all permission have been
29
+ * fetched.
30
+ *
31
+ * @param list the items to compute extensions for.
32
+ * @param extensions an object where the keys are the extension names and the values are functions that return the value of the extension.
33
+ * @param idProp the name of the property that can be used as an id. 'id' by default.
34
+ * @returns an array with 2 items:
35
+ * - [0]: the list with the permission properties.
36
+ * - [1]: true if waiting for a promise, false otherwise.
37
+ */
38
+ export function useExtendedList<T, E extends ExtensionMap<T>>(
39
+ list: T[], extensions: E, idProp: keyof T,
40
+ ): [ItemWithExtensions<T, E>[], boolean]
41
+ export function useExtendedList<T extends { id: string }, E extends ExtensionMap<T>>(
42
+ list: T[], extensions: E, idProp?: keyof T,
43
+ ): [ItemWithExtensions<T, E>[], boolean]
44
+ export function useExtendedList<T, E extends ExtensionMap<T>>(
45
+ list: T[], extensions: E, idProp = 'id' as keyof T,
46
+ ): [ItemWithExtensions<T, E>[], boolean] {
47
+ const [listWithExtensions, setListWithExtensions] = useState(list as ItemWithExtensions<T, E>[])
48
+ const [isLoading, setLoading] = useState(true)
49
+ const extensionMap = useRef(new Map<any, Extension<E>>())
50
+ const listId = list.map(i => i[idProp]).join(';')
51
+
52
+ useEffect(() => {
53
+ async function update() {
54
+ setLoading(true)
55
+ const newList = await Promise.all(list.map(async (item) => {
56
+ const itemExtensions: Extension<E> = extensionMap.current.get(item[idProp]) ?? {}
57
+ if (Object.keys(itemExtensions).length === 0) {
58
+ await Promise.all(Object.keys(extensions).map(async (key: keyof E) => {
59
+ try {
60
+ // "await" because it might be a promise
61
+ itemExtensions[key] = await extensions[key](item)
62
+ } catch (error) {
63
+ // eslint-disable-next-line no-console
64
+ console.error(`Failed to compute extension "${String(key)}" for item with id "${item[idProp]}". It will have undefined as its value, which may cause errors ahead. Caused by the error below:`)
65
+ // eslint-disable-next-line no-console
66
+ console.error(error)
67
+ }
68
+ }))
69
+ extensionMap.current.set(item[idProp], itemExtensions)
70
+ }
71
+ return { ...item, ...itemExtensions }
72
+ }))
73
+ setLoading(false)
74
+ setListWithExtensions(newList)
75
+ }
76
+ update()
77
+ }, [listId])
78
+
79
+ return [listWithExtensions.length ? listWithExtensions : list as ItemWithExtensions<T, E>[], isLoading]
80
+ }
@@ -1,17 +1,17 @@
1
- import { useEffect, useState } from 'react'
2
- import { StreamingStatus } from '../types'
3
- import { StreamedArray } from './StreamedArray'
4
-
5
- export function useStreamedArray<T>(stream: StreamedArray<T> | undefined) {
6
- const [array, setArray] = useState<T[]>(stream?.getPartialValue() ?? [])
7
- const [status, setStatus] = useState<StreamingStatus>(stream?.getStatus() ?? 'pending')
8
- useEffect(() => {
9
- setArray(stream?.getPartialValue() ?? [])
10
- setStatus(stream?.getStatus() ?? 'pending')
11
- return stream?.onChange((values) => {
12
- setArray(values)
13
- setStatus(stream.getStatus())
14
- })
15
- }, [stream])
16
- return [array, status]
17
- }
1
+ import { useEffect, useState } from 'react'
2
+ import { StreamingStatus } from '../types'
3
+ import { StreamedArray } from './StreamedArray'
4
+
5
+ export function useStreamedArray<T>(stream: StreamedArray<T> | undefined) {
6
+ const [array, setArray] = useState<T[]>(stream?.getPartialValue() ?? [])
7
+ const [status, setStatus] = useState<StreamingStatus>(stream?.getStatus() ?? 'pending')
8
+ useEffect(() => {
9
+ setArray(stream?.getPartialValue() ?? [])
10
+ setStatus(stream?.getStatus() ?? 'pending')
11
+ return stream?.onChange((values) => {
12
+ setArray(values)
13
+ setStatus(stream.getStatus())
14
+ })
15
+ }, [stream])
16
+ return [array, status]
17
+ }
@@ -1,4 +1,4 @@
1
- {
2
- "extends": "./tsconfig",
3
- "include": ["src"]
4
- }
1
+ {
2
+ "extends": "./tsconfig",
3
+ "include": ["src"]
4
+ }
package/tsconfig.json CHANGED
@@ -1,10 +1,10 @@
1
- {
2
- "extends": "../../tsconfig",
3
- "compilerOptions": {
4
- "module": "ESNext",
5
- "outDir": "dist",
6
- "esModuleInterop": true,
7
- "stripInternal": true,
8
- },
9
- "include": ["src", "scripts"]
10
- }
1
+ {
2
+ "extends": "../../tsconfig",
3
+ "compilerOptions": {
4
+ "module": "ESNext",
5
+ "outDir": "dist",
6
+ "esModuleInterop": true,
7
+ "stripInternal": true,
8
+ },
9
+ "include": ["src", "scripts"]
10
+ }