@stack-spot/portal-network 0.2.0 → 0.3.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.
Files changed (164) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/api/account.d.ts +2368 -0
  3. package/dist/api/account.d.ts.map +1 -0
  4. package/dist/api/account.js +1521 -0
  5. package/dist/api/account.js.map +1 -0
  6. package/dist/api/ai.d.ts +1432 -0
  7. package/dist/api/ai.d.ts.map +1 -0
  8. package/dist/api/ai.js +1342 -0
  9. package/dist/api/ai.js.map +1 -0
  10. package/dist/api/apiRuntime.d.ts +922 -0
  11. package/dist/api/apiRuntime.d.ts.map +1 -0
  12. package/dist/api/apiRuntime.js +599 -0
  13. package/dist/api/apiRuntime.js.map +1 -0
  14. package/dist/api/cloudAccount.d.ts +473 -0
  15. package/dist/api/cloudAccount.d.ts.map +1 -0
  16. package/dist/api/cloudAccount.js +300 -0
  17. package/dist/api/cloudAccount.js.map +1 -0
  18. package/dist/api/cloudServices.d.ts +1233 -0
  19. package/dist/api/cloudServices.d.ts.map +1 -0
  20. package/dist/api/cloudServices.js +715 -0
  21. package/dist/api/cloudServices.js.map +1 -0
  22. package/dist/api/insights.d.ts +123 -0
  23. package/dist/api/insights.d.ts.map +1 -0
  24. package/dist/api/insights.js +112 -0
  25. package/dist/api/insights.js.map +1 -0
  26. package/dist/api/serviceCatalog.d.ts +737 -0
  27. package/dist/api/serviceCatalog.d.ts.map +1 -0
  28. package/dist/api/serviceCatalog.js +611 -0
  29. package/dist/api/serviceCatalog.js.map +1 -0
  30. package/dist/api/workflows.d.ts +366 -0
  31. package/dist/api/workflows.d.ts.map +1 -0
  32. package/dist/api/workflows.js +175 -0
  33. package/dist/api/workflows.js.map +1 -0
  34. package/dist/api/workspace.js +1476 -0
  35. package/dist/api/workspace.js.map +1 -0
  36. package/dist/api/workspaceManager.d.ts +1121 -0
  37. package/dist/api/workspaceManager.d.ts.map +1 -0
  38. package/dist/api/workspaceManager.js +357 -0
  39. package/dist/api/workspaceManager.js.map +1 -0
  40. package/dist/api/workspaceSearchEngine.d.ts +93 -0
  41. package/dist/api/workspaceSearchEngine.d.ts.map +1 -0
  42. package/dist/api/workspaceSearchEngine.js +55 -0
  43. package/dist/api/workspaceSearchEngine.js.map +1 -0
  44. package/dist/apis.json +121 -0
  45. package/dist/client/account.d.ts +217 -0
  46. package/dist/client/account.d.ts.map +1 -0
  47. package/dist/client/account.js +276 -0
  48. package/dist/client/account.js.map +1 -0
  49. package/dist/error/CanceledError.d.ts +8 -0
  50. package/dist/error/CanceledError.d.ts.map +1 -0
  51. package/dist/error/CanceledError.js +10 -0
  52. package/dist/error/CanceledError.js.map +1 -0
  53. package/dist/error/DefaultAPIError.d.ts +34 -0
  54. package/dist/error/DefaultAPIError.d.ts.map +1 -0
  55. package/dist/error/DefaultAPIError.js +82 -0
  56. package/dist/error/DefaultAPIError.js.map +1 -0
  57. package/dist/error/StackspotAPIError.d.ts +50 -0
  58. package/dist/error/StackspotAPIError.d.ts.map +1 -0
  59. package/dist/error/StackspotAPIError.js +54 -0
  60. package/dist/error/StackspotAPIError.js.map +1 -0
  61. package/dist/error/dictionary/account.d.ts +55 -0
  62. package/dist/error/dictionary/account.d.ts.map +1 -0
  63. package/dist/error/dictionary/account.js +55 -0
  64. package/dist/error/dictionary/account.js.map +1 -0
  65. package/dist/error/dictionary/action.d.ts +163 -0
  66. package/dist/error/dictionary/action.d.ts.map +1 -0
  67. package/dist/error/dictionary/action.js +163 -0
  68. package/dist/error/dictionary/action.js.map +1 -0
  69. package/dist/error/dictionary/base.d.ts +21 -0
  70. package/dist/error/dictionary/base.d.ts.map +1 -0
  71. package/dist/error/dictionary/base.js +21 -0
  72. package/dist/error/dictionary/base.js.map +1 -0
  73. package/dist/error/dictionary/cnt-fields.d.ts +13 -0
  74. package/dist/error/dictionary/cnt-fields.d.ts.map +1 -0
  75. package/dist/error/dictionary/cnt-fields.js +13 -0
  76. package/dist/error/dictionary/cnt-fields.js.map +1 -0
  77. package/dist/error/dictionary/cnt.d.ts +79 -0
  78. package/dist/error/dictionary/cnt.d.ts.map +1 -0
  79. package/dist/error/dictionary/cnt.js +79 -0
  80. package/dist/error/dictionary/cnt.js.map +1 -0
  81. package/dist/error/dictionary/rte.d.ts +23 -0
  82. package/dist/error/dictionary/rte.d.ts.map +1 -0
  83. package/dist/error/dictionary/rte.js +23 -0
  84. package/dist/error/dictionary/rte.js.map +1 -0
  85. package/dist/error/dictionary/rtm.d.ts +9 -0
  86. package/dist/error/dictionary/rtm.d.ts.map +1 -0
  87. package/dist/error/dictionary/rtm.js +9 -0
  88. package/dist/error/dictionary/rtm.js.map +1 -0
  89. package/dist/error/dictionary/workspace-fields.d.ts +9 -0
  90. package/dist/error/dictionary/workspace-fields.d.ts.map +1 -0
  91. package/dist/error/dictionary/workspace-fields.js +9 -0
  92. package/dist/error/dictionary/workspace-fields.js.map +1 -0
  93. package/dist/error/dictionary/workspace.d.ts +99 -0
  94. package/dist/error/dictionary/workspace.d.ts.map +1 -0
  95. package/dist/error/dictionary/workspace.js +99 -0
  96. package/dist/error/dictionary/workspace.js.map +1 -0
  97. package/dist/index.d.ts +7 -0
  98. package/dist/index.d.ts.map +1 -0
  99. package/dist/index.js +7 -0
  100. package/dist/index.js.map +1 -0
  101. package/dist/network/AutoInfiniteQuery.d.ts +23 -0
  102. package/dist/network/AutoInfiniteQuery.d.ts.map +1 -0
  103. package/dist/network/AutoInfiniteQuery.js +70 -0
  104. package/dist/network/AutoInfiniteQuery.js.map +1 -0
  105. package/dist/network/AutoMutation.d.ts +10 -0
  106. package/dist/network/AutoMutation.d.ts.map +1 -0
  107. package/dist/network/AutoMutation.js +20 -0
  108. package/dist/network/AutoMutation.js.map +1 -0
  109. package/dist/network/AutoOperation.d.ts +19 -0
  110. package/dist/network/AutoOperation.d.ts.map +1 -0
  111. package/dist/network/AutoOperation.js +105 -0
  112. package/dist/network/AutoOperation.js.map +1 -0
  113. package/dist/network/AutoQuery.d.ts +19 -0
  114. package/dist/network/AutoQuery.d.ts.map +1 -0
  115. package/dist/network/AutoQuery.js +70 -0
  116. package/dist/network/AutoQuery.js.map +1 -0
  117. package/dist/network/ManualInfiniteQuery.d.ts +25 -0
  118. package/dist/network/ManualInfiniteQuery.d.ts.map +1 -0
  119. package/dist/network/ManualInfiniteQuery.js +62 -0
  120. package/dist/network/ManualInfiniteQuery.js.map +1 -0
  121. package/dist/network/ManualMutation.d.ts +11 -0
  122. package/dist/network/ManualMutation.d.ts.map +1 -0
  123. package/dist/network/ManualMutation.js +32 -0
  124. package/dist/network/ManualMutation.js.map +1 -0
  125. package/dist/network/ManualOperation.d.ts +13 -0
  126. package/dist/network/ManualOperation.d.ts.map +1 -0
  127. package/dist/network/ManualOperation.js +53 -0
  128. package/dist/network/ManualOperation.js.map +1 -0
  129. package/dist/network/ManualQuery.d.ts +20 -0
  130. package/dist/network/ManualQuery.d.ts.map +1 -0
  131. package/dist/network/ManualQuery.js +77 -0
  132. package/dist/network/ManualQuery.js.map +1 -0
  133. package/dist/network/NetworkClient.d.ts +58 -0
  134. package/dist/network/NetworkClient.d.ts.map +1 -0
  135. package/dist/network/NetworkClient.js +107 -0
  136. package/dist/network/NetworkClient.js.map +1 -0
  137. package/dist/network/ReactQueryNetworkClient.d.ts +78 -0
  138. package/dist/network/ReactQueryNetworkClient.d.ts.map +1 -0
  139. package/dist/network/ReactQueryNetworkClient.js +144 -0
  140. package/dist/network/ReactQueryNetworkClient.js.map +1 -0
  141. package/dist/network/react-query-client.d.ts +6 -0
  142. package/dist/network/react-query-client.d.ts.map +1 -0
  143. package/dist/network/react-query-client.js +6 -0
  144. package/dist/network/react-query-client.js.map +1 -0
  145. package/dist/network/types.d.ts +234 -0
  146. package/dist/network/types.d.ts.map +1 -0
  147. package/dist/network/types.js +2 -0
  148. package/dist/network/types.js.map +1 -0
  149. package/dist/utils/use-extended-list.d.ts +39 -0
  150. package/dist/utils/use-extended-list.d.ts.map +1 -0
  151. package/dist/utils/use-extended-list.js +36 -0
  152. package/dist/utils/use-extended-list.js.map +1 -0
  153. package/package.json +1 -1
  154. package/src/client/account.ts +79 -14
  155. package/src/error/DefaultAPIError.ts +2 -3
  156. package/src/error/StackspotAPIError.ts +1 -1
  157. package/src/index.ts +1 -0
  158. package/src/network/AutoInfiniteQuery.ts +7 -0
  159. package/src/network/AutoOperation.ts +7 -1
  160. package/src/network/ManualInfiniteQuery.ts +7 -0
  161. package/src/network/NetworkClient.ts +16 -70
  162. package/src/network/ReactQueryNetworkClient.ts +18 -38
  163. package/src/network/types.ts +0 -10
  164. package/src/utils/use-extended-list.ts +80 -0
@@ -0,0 +1,144 @@
1
+ /* eslint-disable react-hooks/rules-of-hooks */
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var _ReactQueryNetworkClient_instances, _ReactQueryNetworkClient_parseErrorData, _ReactQueryNetworkClient_transformError, _ReactQueryNetworkClient_withErrorTreatment, _ReactQueryNetworkClient_onFetchPermission;
8
+ import { HttpError } from '@oazapfts/runtime';
9
+ import { StackspotAPIError } from '../error/StackspotAPIError.js';
10
+ import { AutoInfiniteQuery } from './AutoInfiniteQuery.js';
11
+ import { AutoMutation } from './AutoMutation.js';
12
+ import { AutoQuery } from './AutoQuery.js';
13
+ import { ManualInfiniteQuery } from './ManualInfiniteQuery.js';
14
+ import { ManualMutation } from './ManualMutation.js';
15
+ import { ManualQuery } from './ManualQuery.js';
16
+ import { NetworkClient } from './NetworkClient.js';
17
+ const DUMMY_ULID = '01HSTZ5471CBG4AW9BFJ0VTVG9';
18
+ const PERMISSION_ERROR = 'permission-error';
19
+ export const DEFAULT_PAGE_SIZE = 20;
20
+ /**
21
+ * A Network Client that uses oazapfts for making requests and React Query for managing responses.
22
+ */
23
+ export class ReactQueryNetworkClient extends NetworkClient {
24
+ /**
25
+ * @param baseURL An object with the keys "dev", "stg" and "prd". The values must be the url for each of these environments.
26
+ * @param defaults the `default` object of the API this client is for (provided by the code generated by oazapfts).
27
+ */
28
+ constructor(baseURL, defaults) {
29
+ super(baseURL);
30
+ _ReactQueryNetworkClient_instances.add(this);
31
+ _ReactQueryNetworkClient_withErrorTreatment.set(this, (block) => (async (...args) => {
32
+ try {
33
+ return await block(...args);
34
+ }
35
+ catch (error) {
36
+ throw __classPrivateFieldGet(this, _ReactQueryNetworkClient_instances, "m", _ReactQueryNetworkClient_transformError).call(this, error);
37
+ }
38
+ })
39
+ /**
40
+ * Receives an HttpError and returns a StackspotAPIError.
41
+ * @param error the original HttpError created by oazapfts.
42
+ */
43
+ );
44
+ defaults.baseUrl = '';
45
+ defaults.fetch = (...args) => this.fetch(...args);
46
+ }
47
+ query(fnOrConfig) {
48
+ return typeof fnOrConfig === 'function'
49
+ ? new AutoQuery({
50
+ apiName: this.constructor.name,
51
+ fn: fnOrConfig,
52
+ onFetchPermission: (...args) => __classPrivateFieldGet(this, _ReactQueryNetworkClient_instances, "m", _ReactQueryNetworkClient_onFetchPermission).call(this, ...args),
53
+ transformError: error => __classPrivateFieldGet(this, _ReactQueryNetworkClient_instances, "m", _ReactQueryNetworkClient_transformError).call(this, error),
54
+ })
55
+ : new ManualQuery({
56
+ ...fnOrConfig,
57
+ apiName: this.constructor.name,
58
+ request: __classPrivateFieldGet(this, _ReactQueryNetworkClient_withErrorTreatment, "f").call(this, fnOrConfig.request),
59
+ permission: fnOrConfig.permission ? __classPrivateFieldGet(this, _ReactQueryNetworkClient_withErrorTreatment, "f").call(this, fnOrConfig.permission) : undefined,
60
+ });
61
+ }
62
+ infiniteQuery(fnOrConfig, options) {
63
+ return typeof fnOrConfig === 'function'
64
+ ? new AutoInfiniteQuery({
65
+ apiName: this.constructor.name,
66
+ fn: fnOrConfig,
67
+ onFetchPermission: (...args) => __classPrivateFieldGet(this, _ReactQueryNetworkClient_instances, "m", _ReactQueryNetworkClient_onFetchPermission).call(this, ...args),
68
+ transformError: error => __classPrivateFieldGet(this, _ReactQueryNetworkClient_instances, "m", _ReactQueryNetworkClient_transformError).call(this, error),
69
+ }, {
70
+ accumulator: options?.accumulator ?? '',
71
+ pageParamName: options?.pageParamName ?? 'page',
72
+ initialPageParam: options?.initialPageParam ?? 1,
73
+ defaultVariables: options?.defaultVariables ?? { size: DEFAULT_PAGE_SIZE },
74
+ getNextPageParam: options?.getNextPageParam ?? (({ variables, lastPage, lastPageParam }) => {
75
+ const size = variables.size ?? 1;
76
+ const isLastPageTheLast = lastPage && ((Array.isArray(lastPage) && lastPage.length < size)
77
+ || (options?.accumulator !== undefined && options?.accumulator !== '' && lastPage[options?.accumulator]?.length < size));
78
+ return isLastPageTheLast ? undefined : lastPageParam + 1;
79
+ }),
80
+ })
81
+ : new ManualInfiniteQuery({
82
+ ...fnOrConfig,
83
+ apiName: this.constructor.name,
84
+ request: __classPrivateFieldGet(this, _ReactQueryNetworkClient_withErrorTreatment, "f").call(this, fnOrConfig.request),
85
+ permission: fnOrConfig.permission ? __classPrivateFieldGet(this, _ReactQueryNetworkClient_withErrorTreatment, "f").call(this, fnOrConfig.permission) : undefined,
86
+ });
87
+ }
88
+ mutation(fnOrConfig) {
89
+ if (typeof fnOrConfig === 'function') {
90
+ return new AutoMutation({
91
+ apiName: this.constructor.name,
92
+ fn: fnOrConfig,
93
+ onFetchPermission: (...args) => __classPrivateFieldGet(this, _ReactQueryNetworkClient_instances, "m", _ReactQueryNetworkClient_onFetchPermission).call(this, ...args),
94
+ transformError: error => __classPrivateFieldGet(this, _ReactQueryNetworkClient_instances, "m", _ReactQueryNetworkClient_transformError).call(this, error),
95
+ });
96
+ }
97
+ return new ManualMutation({
98
+ ...fnOrConfig,
99
+ apiName: this.constructor.name,
100
+ request: __classPrivateFieldGet(this, _ReactQueryNetworkClient_withErrorTreatment, "f").call(this, fnOrConfig.request),
101
+ permission: fnOrConfig.permission ? __classPrivateFieldGet(this, _ReactQueryNetworkClient_withErrorTreatment, "f").call(this, fnOrConfig.permission) : undefined,
102
+ });
103
+ }
104
+ }
105
+ _ReactQueryNetworkClient_withErrorTreatment = new WeakMap(), _ReactQueryNetworkClient_instances = new WeakSet(), _ReactQueryNetworkClient_parseErrorData = function _ReactQueryNetworkClient_parseErrorData(error) {
106
+ if (typeof error.data === 'string') {
107
+ try {
108
+ return JSON.parse(error.data);
109
+ }
110
+ catch { /* empty */ }
111
+ }
112
+ return error.data;
113
+ }, _ReactQueryNetworkClient_transformError = function _ReactQueryNetworkClient_transformError(error) {
114
+ if (!(error instanceof HttpError))
115
+ throw new StackspotAPIError({ status: 0, message: error?.message || `${error}`, stack: error.stack });
116
+ const data = __classPrivateFieldGet(this, _ReactQueryNetworkClient_instances, "m", _ReactQueryNetworkClient_parseErrorData).call(this, error);
117
+ if (data.type === PERMISSION_ERROR) {
118
+ // eslint-disable-next-line no-console
119
+ console.error('Error while validating permissions:', data.message);
120
+ return new StackspotAPIError({
121
+ status: 500,
122
+ stack: error.stack,
123
+ message: language => language === 'pt'
124
+ ? 'Ocorreu um erro ao validar as permissões.'
125
+ : 'There was an error while validating permissions.',
126
+ });
127
+ }
128
+ return this.buildStackSpotError(error);
129
+ }, _ReactQueryNetworkClient_onFetchPermission = async function _ReactQueryNetworkClient_onFetchPermission(input, init) {
130
+ const [path, method, body] = input instanceof Request
131
+ ? [input.url, input.method, input.body]
132
+ : [`${input}`, (init?.method?.toLowerCase() || 'get'), init?.body];
133
+ try {
134
+ /* We allow the dev not to pass any variable when validating a permission. For this reason, oazapfts might generate a path with
135
+ "undefined". If this happens, we must replace the undefined text with a dummy ULID. */
136
+ const fixedPath = path.replace(/\/undefined(\/|$)/g, `/${DUMMY_ULID}$1`);
137
+ const isAllowed = await this.requestPermission(method, fixedPath, body);
138
+ return new Response(`${isAllowed}`, { headers: { 'Content-Type': 'application/json' } });
139
+ }
140
+ catch (error) {
141
+ return new Response(JSON.stringify({ type: PERMISSION_ERROR, message: error.message || `${error}` }), { status: 500 });
142
+ }
143
+ };
144
+ //# sourceMappingURL=ReactQueryNetworkClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactQueryNetworkClient.js","sourceRoot":"","sources":["../../src/network/ReactQueryNetworkClient.ts"],"names":[],"mappings":"AAAA,+CAA+C;;;;;;;AAE/C,OAAO,EAAY,SAAS,EAAe,MAAM,mBAAmB,CAAA;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAG/C,MAAM,UAAU,GAAG,4BAA4B,CAAA;AAC/C,MAAM,gBAAgB,GAAG,kBAAkB,CAAA;AAC3C,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAA;AAEnC;;GAEG;AACH,MAAM,OAAgB,uBAAwB,SAAQ,aAAa;IACjE;;;OAGG;IACH,YAAY,OAA4B,EAAE,QAAuB;QAC/D,KAAK,CAAC,OAAO,CAAC,CAAA;;QA+BhB,sDAAsB,CAA6B,KAAyC,EAAwC,EAAE,CAAC,CACrI,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE;YAChB,IAAI,CAAC;gBACH,OAAO,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,CAAA;YAC7B,CAAC;YAAC,OAAO,KA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O,CAAC,oBAAoB,EAAE,IAAI,UAAU,IAAI,CAAC,CAAA;QACxE,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,IAAW,CAAC,CAAA;QAC9E,OAAO,IAAI,QAAQ,CAAC,GAAG,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,EAAE,CAAC,CAAA;IAC1F,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,GAAG,KAAK,EAAE,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;IACxH,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { QueryClient } from '@tanstack/react-query';
2
+ /**
3
+ * The global, unique, Query Client for React Query.
4
+ */
5
+ export declare const queryClient: QueryClient;
6
+ //# sourceMappingURL=react-query-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-query-client.d.ts","sourceRoot":"","sources":["../../src/network/react-query-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEnD;;GAEG;AACH,eAAO,MAAM,WAAW,aAA8F,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { QueryClient } from '@tanstack/react-query';
2
+ /**
3
+ * The global, unique, Query Client for React Query.
4
+ */
5
+ export const queryClient = new QueryClient({ defaultOptions: { queries: { refetchOnWindowFocus: false, retry: 3 } } });
6
+ //# sourceMappingURL=react-query-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react-query-client.js","sourceRoot":"","sources":["../../src/network/react-query-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAEnD;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,EAAE,cAAc,EAAE,EAAE,OAAO,EAAE,EAAE,oBAAoB,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA"}
@@ -0,0 +1,234 @@
1
+ import type { RequestOpts } from '@oazapfts/runtime';
2
+ import { Session } from '@stack-spot/auth';
3
+ import { InfiniteData, MutateOptions, UseInfiniteQueryOptions, UseInfiniteQueryResult, UseMutationOptions, UseMutationResult, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
4
+ import { StackspotAPIError } from '../error/StackspotAPIError.js';
5
+ export interface SessionManager {
6
+ hasSession(): boolean;
7
+ endSession(): void;
8
+ getSession(): Session;
9
+ }
10
+ export type Env = 'dev' | 'stg' | 'prd';
11
+ export type HTTPMethod = 'post' | 'patch' | 'delete' | 'put' | 'get';
12
+ export interface OperationConfig<Args extends [AbortSignal, Record<string, any>] | [AbortSignal], Result> {
13
+ /**
14
+ * The operation name. To be used as key in React Query.
15
+ */
16
+ name: string;
17
+ /**
18
+ * The function to run once the operation is called.
19
+ * @param abortSignal the AbortSignal to pass to any request made.
20
+ * @param variables if this operation accepts variables, the second parameter is the variables object.
21
+ * @returns the operation result (this should not be a Response object, but it could be its body).
22
+ */
23
+ request: (...args: Args) => Promise<Result>;
24
+ /**
25
+ * The function to run once one asks if the operation is allowed.
26
+ * @param variables if this operation accepts variables, the single parameter is the variables object.
27
+ * @returns a promise that resolves to true if the operation is allowed and false otherwise.
28
+ */
29
+ permission: (...args: Args extends [AbortSignal] ? [] : [Args[1]]) => Promise<boolean>;
30
+ }
31
+ export interface InfiniteQueryOptions<Variables, Result, PageParamName extends keyof Variables, Accumulator extends keyof Result | ''> {
32
+ /**
33
+ * The name of the variable that controls the current page.
34
+ */
35
+ pageParamName: PageParamName;
36
+ /**
37
+ * The name of the property in the Result that contains the items of a page. If the result itself is the array of items, use an empty
38
+ * string ('').
39
+ */
40
+ accumulator?: Accumulator;
41
+ /**
42
+ * The initial value for page variable.
43
+ */
44
+ initialPageParam: Variables[PageParamName];
45
+ /**
46
+ * Some defaults to be used when a variable is not specified.
47
+ */
48
+ defaultVariables?: Partial<Variables>;
49
+ /**
50
+ * A function that determines the value of the page variable in order to get the next page.
51
+ * @parar context the current context with the variables and page details.
52
+ * @returns undefined or null if there are no more pages. The next value for the page variable otherwise.
53
+ */
54
+ getNextPageParam: (context: {
55
+ /**
56
+ * the original set of variables passed to the hook `useInfiniteQuery`.
57
+ */
58
+ variables: Variables;
59
+ /**
60
+ * the last page Result.
61
+ */
62
+ lastPage: Result;
63
+ /**
64
+ * the Results of each page.
65
+ */
66
+ allPages: Result[];
67
+ /**
68
+ * the value of the page variable used to retrieve the last page.
69
+ */
70
+ lastPageParam: Variables[PageParamName];
71
+ /**
72
+ * the values of the page variable for requesting each of the pages.
73
+ */
74
+ allPageParams: Variables[PageParamName][];
75
+ }) => Variables[PageParamName] | undefined | null;
76
+ }
77
+ export interface FullOperationConfig<Args extends [AbortSignal, Record<string, any>] | [AbortSignal], Result> extends OperationConfig<Args, Result> {
78
+ /**
79
+ * The name of the API where this operation is called: used for composing a query key.
80
+ */
81
+ apiName: string;
82
+ }
83
+ export type InfiniteQueryConfig<Variables extends Record<string, any>, Result, PageParamName extends keyof Variables, Accumulator extends keyof Result | ''> = OperationConfig<[AbortSignal, Variables], Result> & InfiniteQueryOptions<Variables, Result, PageParamName, Accumulator>;
84
+ export interface OperationObject<Variables> {
85
+ /**
86
+ * Checks if this operation is allowed for the user currently logged in.
87
+ * @param variables the variables for the operation, if a required url parameter is not provided, it's replaced by a default string.
88
+ * @returns a promise that resolves to true if the operation is allowed or false otherwise.
89
+ * @throws `StackspotAPIError`
90
+ */
91
+ isAllowed: (...args: Variables extends void ? [] : [variables?: Partial<Variables>]) => Promise<boolean>;
92
+ /**
93
+ * Same as `isAllowed`, but a React Hook instead.
94
+ * @param args if this operation accepts variables, the first argument should be the variables and the second the query options
95
+ * (optional). If it doesn't accept variables, the single optional argument must be the query options. Moreover, if a required url
96
+ * parameter is not provided, it's replaced by a default string.
97
+ * @returns an array with 4 items:
98
+ * - [0]: true if allowed, false if not allowed, undefined if not fetched.
99
+ * - [1]: true if pending, false otherwise.
100
+ * - [2]: a StackspotAPIError if an error happens, null or undefined otherwise.
101
+ * - [3]: the original UseQueryResult object, from ReactQuery.
102
+ */
103
+ useAllowed: (...args: Variables extends void ? [options?: Omit<UseQueryOptions, 'queryFn' | 'queryKey'>] : [variables?: Partial<Variables>, options?: Omit<UseQueryOptions, 'queryFn' | 'queryKey'>]) => Readonly<[boolean | undefined, boolean, StackspotAPIError | null | undefined, UseQueryResult<boolean, StackspotAPIError>]>;
104
+ /**
105
+ * Gets the key for the query used to verify if this operation is allowed.
106
+ *
107
+ * Attention: invalidating this key won't clear the cache, since the `@stack-spot/opa` library doesn't support individual cache
108
+ * invalidation.
109
+ * @param args if this operation accepts variables, the first argument should be the variables and the second the query options
110
+ * (optional). If it doesn't accept variables, the single optional argument must be the query options. Moreover, if a required url
111
+ * parameter is not provided, it's replaced by a default string.
112
+ * @returns the query key.
113
+ */
114
+ getPermissionKey: (...args: Variables extends void ? [] : [variables?: Partial<Variables>]) => any[];
115
+ /**
116
+ * Cancels the request if it hasn't finished yet.
117
+ *
118
+ * A canceled request will fail by throwing a `CanceledError`.
119
+ *
120
+ * @param variables the variables for the operation. If not provided, this will cancel all requests in progress for this operation.
121
+ * @returns true if any request has been canceled, false otherwise.
122
+ */
123
+ cancel: (variables?: Partial<Variables>) => boolean;
124
+ }
125
+ export interface QueryObject<Variables, Result> extends OperationObject<Variables> {
126
+ /**
127
+ * Runs the query operation.
128
+ * @param variables the request variables if this query accepts variables.
129
+ * @returns a Promise with the response data
130
+ * @throws `StackspotAPIError`
131
+ */
132
+ query: (...args: Variables extends void ? [] : [variables: Variables]) => Promise<Result>;
133
+ /**
134
+ * Same as `query`, but, instead of an async function, this is a React Hook that expects a React Suspense environment.
135
+ *
136
+ * If you want a hook that performs a stateful query instead of relying in Suspense, call `useStatefulQuery` instead.
137
+ *
138
+ * @param args if this query accepts variables, the first argument should be the variables and the second the query options
139
+ * (optional). If it doesn't accept variables, the single optional argument must be the query options.
140
+ * @returns the response data or undefined if not fetched.
141
+ * @throws `StackspotAPIError`
142
+ * @throws `Promise<Result>`
143
+ */
144
+ useQuery: (...args: Variables extends void ? [options?: Omit<UseQueryOptions, 'queryFn' | 'queryKey'>] : [variables: Variables, options?: Omit<UseQueryOptions, 'queryFn' | 'queryKey'>]) => Result | undefined;
145
+ /**
146
+ * Same as `query`, but a React Hook instead.
147
+ * @param args if this query accepts variables, the first argument should be the variables and the second the query options
148
+ * (optional). If it doesn't accept variables, the single optional argument must be the query options.
149
+ * @returns an array with 4 items:
150
+ * - [0]: the response data or undefined if not fetched.
151
+ * - [1]: true if pending, false otherwise.
152
+ * - [2]: a StackspotAPIError if an error happens, null or undefined otherwise.
153
+ * - [3]: the original UseQueryResult object, from ReactQuery.
154
+ */
155
+ useStatefulQuery: (...args: Variables extends void ? [options?: Omit<UseQueryOptions, 'queryFn' | 'queryKey'>] : [variables: Variables, options?: Omit<UseQueryOptions, 'queryFn' | 'queryKey'>]) => Readonly<[Result | undefined, boolean, StackspotAPIError | null | undefined, UseQueryResult<Result, StackspotAPIError>]>;
156
+ /**
157
+ * Invalidates the cache for this query. A specific query can be invalidated by passing an argument (variables).
158
+ * @param variables if this query accepts variables, a query with specific variables can be invalidated.
159
+ * @returns a promise that resolves once the cache is invalidated.
160
+ */
161
+ invalidate: (...args: Variables extends void ? [] : [variables?: Partial<Variables>]) => Promise<void>;
162
+ /**
163
+ * Gets the key for this query.
164
+ * @param variables the variables for the query.
165
+ * @returns the query key.
166
+ */
167
+ getKey: (...args: Variables extends void ? [] : [variables?: Partial<Variables>]) => any[];
168
+ }
169
+ export type UseInfiniteQueryObjectOptions = Omit<UseInfiniteQueryOptions, 'queryFn' | 'queryKey' | 'getNextPageParam' | 'initialPageParam'>;
170
+ export interface InfiniteQueryObject<Variables, Result, Accumulator extends keyof Result | ''> extends QueryObject<Variables, Result> {
171
+ /**
172
+ * Builds up a list with the result of multiple pages. This relies on React Suspense for error and first-loading feedbacks.
173
+ *
174
+ * Equivalent to React Query's `useSuspenseInfiniteQuery`.
175
+ * @param variables the variables for the query.
176
+ * @param options the options for the query.
177
+ * @returns an array with 2 items:
178
+ * - [0]: the list of items.
179
+ * - [1]: the original UseInfiniteQueryResult object, from ReactQuery.
180
+ */
181
+ useInfiniteQuery: (...args: Partial<Variables> extends Variables ? [variables?: Variables, options?: UseInfiniteQueryObjectOptions] : [variables: Variables, options?: UseInfiniteQueryObjectOptions]) => Readonly<[
182
+ (Accumulator extends keyof Result ? Result[Accumulator] : Result) | undefined,
183
+ UseInfiniteQueryResult<InfiniteData<Result>, StackspotAPIError>
184
+ ]>;
185
+ /**
186
+ * Builds up a list with the result of multiple pages.
187
+ *
188
+ * Equivalent to React Query's `useInfiniteQuery`.
189
+ * @param variables the variables for the query.
190
+ * @param options the options for the query.
191
+ * @returns an array with 4 items:
192
+ * - [0]: the list of items.
193
+ * - [1]: true if fetching the first page, false otherwise.
194
+ * - [2]: a StackspotAPIError if an error happens, null or undefined otherwise.
195
+ * - [3]: the original UseInfiniteQueryResult object, from ReactQuery.
196
+ */
197
+ useStatefulInfiniteQuery: (...args: Partial<Variables> extends Variables ? [variables?: Variables, options?: Omit<UseInfiniteQueryOptions, 'queryFn' | 'queryKey' | 'getNextPageParam' | 'initialPageParam'>] : [variables: Variables, options?: Omit<UseInfiniteQueryOptions, 'queryFn' | 'queryKey' | 'getNextPageParam' | 'initialPageParam'>]) => Readonly<[
198
+ (Accumulator extends keyof Result ? Result[Accumulator] : Result) | undefined,
199
+ boolean,
200
+ StackspotAPIError | undefined | null,
201
+ UseInfiniteQueryResult<InfiniteData<Result>, StackspotAPIError>
202
+ ]>;
203
+ }
204
+ export interface AutoQueryObjectParams<Variables, Result> {
205
+ apiName: string;
206
+ fn: ((variables: Variables, opts?: RequestOpts) => Promise<Result>) | ((opts?: RequestOpts) => Promise<Result>);
207
+ onFetchPermission: typeof fetch;
208
+ transformError?: (error: any) => StackspotAPIError;
209
+ }
210
+ export interface MutationObject<Variables, Result> extends OperationObject<Variables> {
211
+ /**
212
+ * Runs the mutation and returns a promise.
213
+ * @param args the variables for the mutation.
214
+ * @returns a promise that resolves to the response's data.
215
+ */
216
+ mutate: (...args: Variables extends void ? [] : [variables: Variables]) => Promise<Result>;
217
+ /**
218
+ * A React hook equivalent to React Query's `useMutation`. It creates a mutation function and the mutation states.
219
+ * @param options the options for `useMutation`
220
+ * @returns an array with 4 items:
221
+ * - [0]: the mutation function (equivalent to `mutateAsync` from the result of a `useMutation`).
222
+ * - [1]: true if pending, false otherwise.
223
+ * - [2]: a StackspotAPIError if an error happens, undefined otherwise.
224
+ * - [3]: the original UseMutationResult object, from ReactQuery.
225
+ *
226
+ */
227
+ useMutation: (options?: Omit<UseMutationOptions<Result, StackspotAPIError, Variables>, 'mutationFn'>) => Readonly<[
228
+ (...args: Variables extends void ? [options?: MutateOptions<Result, StackspotAPIError>] : [variables: Variables, options?: MutateOptions<Result, StackspotAPIError, Variables>]) => Promise<Result>,
229
+ boolean,
230
+ StackspotAPIError | undefined,
231
+ UseMutationResult<Result, StackspotAPIError, Variables>
232
+ ]>;
233
+ }
234
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/network/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC5L,OAAO,EAAE,iBAAiB,EAAE,MA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AAS,CAAC;IACnF;;;;OAIG;IACH,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,SAAS,SAAS,IAAI,GAAG,EAAE,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3F;;;;;;;;;OASG;IACH,WAAW,EAAE,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,iBAAiB,EAAE,SAAS,CAAC,EAAE,YAAY,CAAC,KAClG,QAAQ,CAAC;QACP,CAAC,GAAG,IAAI,EAAE,SAAS,SAAS,IAAI,GAC5B,CAAC,OAAO,CAAC,EAAG,aAAa,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,GACrD,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,aAAa,CAAC,MAAM,EAAE,iBAAiB,EAAE,SAAS,CAAC,CAAC,KACpF,OAAO,CAAC,MAAM,CAAC;QACpB,OAAO;QACP,iBAAiB,GAAG,SAAS;QAC7B,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,EAAE,SAAS,CAAC;KACxD,CAAC,CAAC;CACN"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/network/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,39 @@
1
+ type ExtensionMap<T> = Record<string, (item: T) => any>;
2
+ type Unpromisify<T> = T extends Promise<infer R> ? R : T;
3
+ type Extension<E extends ExtensionMap<any>> = {
4
+ [K in keyof E]?: Unpromisify<ReturnType<E[K]>>;
5
+ };
6
+ type ItemWithExtensions<T, E extends ExtensionMap<T>> = T & Extension<E>;
7
+ /**
8
+ * Computes the given extensions for the items in the list passed as parameter. An extension will, most of the times, return a promise,
9
+ * but it can return whatever you'd like.
10
+ *
11
+ * If the extensions are promises and are still loading, the items won't have the corresponding keys.
12
+ *
13
+ * Attention: once an extension is calculated for an item, it's never calculated again. An item is identified by the parameter "idProp"
14
+ * (3rd), which is "id" by default.
15
+ *
16
+ * @example
17
+ * ```
18
+ * const [groups] = accountClient.memberGroups.useInfiniteQuery({ memberId: 'someId' })
19
+ * const extendedGroups = useExtendedList(groups, {
20
+ * canRemoveMemberFromGroup: group => accountClient.removeMemberFromGroup.isAllowed({ groupId: group.id, memberId: 'someId' }),
21
+ * title: group => `${group.name} (${group.totalUsers})`,
22
+ * })
23
+ * ```
24
+ * Above, each item in `extendedGroups` will have the properties `canRemoveMemberFromGroup` and `title`, once all permission have been
25
+ * fetched.
26
+ *
27
+ * @param list the items to compute extensions for.
28
+ * @param extensions an object where the keys are the extension names and the values are functions that return the value of the extension.
29
+ * @param idProp the name of the property that can be used as an id. 'id' by default.
30
+ * @returns an array with 2 items:
31
+ * - [0]: the list with the permission properties.
32
+ * - [1]: true if waiting for a promise, false otherwise.
33
+ */
34
+ export declare function useExtendedList<T, E extends ExtensionMap<T>>(list: T[], extensions: E, idProp: keyof T): [ItemWithExtensions<T, E>[], boolean];
35
+ export declare function useExtendedList<T extends {
36
+ id: string;
37
+ }, E extends ExtensionMap<T>>(list: T[], extensions: E, idProp?: keyof T): [ItemWithExtensions<T, E>[], boolean];
38
+ export {};
39
+ //# sourceMappingURL=use-extended-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-extended-list.d.ts","sourceRoot":"","sources":["../../src/utils/use-extended-list.ts"],"names":[],"mappings":"AAEA,KAAK,YAAY,CAAC,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,GAAG,CAAC,CAAA;AAEvD,KAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAExD,KAAK,SAAS,CAAC,CAAC,SAAS,YAAY,CAAC,GAAG,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAA;AAEhG,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,SAAS,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAA;AAExE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,CAAC,SAAS,YAAY,CAAC,CAAC,CAAC,EAC1D,IAAI,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,GACxC,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;AACxC,wBAAgB,eAAe,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,SAAS,YAAY,CAAC,CAAC,CAAC,EACjF,IAAI,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,GACzC,CAAC,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA"}
@@ -0,0 +1,36 @@
1
+ import { useEffect, useRef, useState } from 'react';
2
+ export function useExtendedList(list, extensions, idProp = 'id') {
3
+ const [listWithExtensions, setListWithExtensions] = useState(list);
4
+ const [isLoading, setLoading] = useState(true);
5
+ const extensionMap = useRef(new Map());
6
+ const listId = list.map(i => i[idProp]).join(';');
7
+ useEffect(() => {
8
+ async function update() {
9
+ setLoading(true);
10
+ const newList = await Promise.all(list.map(async (item) => {
11
+ const itemExtensions = extensionMap.current.get(item[idProp]) ?? {};
12
+ if (Object.keys(itemExtensions).length === 0) {
13
+ await Promise.all(Object.keys(extensions).map(async (key) => {
14
+ try {
15
+ // "await" because it might be a promise
16
+ itemExtensions[key] = await extensions[key](item);
17
+ }
18
+ catch (error) {
19
+ // eslint-disable-next-line no-console
20
+ 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:`);
21
+ // eslint-disable-next-line no-console
22
+ console.error(error);
23
+ }
24
+ }));
25
+ extensionMap.current.set(item[idProp], itemExtensions);
26
+ }
27
+ return { ...item, ...itemExtensions };
28
+ }));
29
+ setLoading(false);
30
+ setListWithExtensions(newList);
31
+ }
32
+ update();
33
+ }, [listId]);
34
+ return [listWithExtensions.length ? listWithExtensions : list, isLoading];
35
+ }
36
+ //# sourceMappingURL=use-extended-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-extended-list.js","sourceRoot":"","sources":["../../src/utils/use-extended-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AA2CnD,MAAM,UAAU,eAAe,CAC7B,IAAS,EAAE,UAAa,EAAE,SAAS,IAAe;IAElD,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAC,IAAkC,CAAC,CAAA;IAChG,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAA;IAC9C,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,GAAG,EAAqB,CAAC,CAAA;IACzD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAEjD,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,UAAU,MAAM;YACnB,UAAU,CAAC,IAAI,CAAC,CAAA;YAChB,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;gBACxD,MAAM,cAAc,GAAiB,YAAY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-spot/portal-network",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",