shoal-web-sdk 0.0.40 → 0.0.43

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.
@@ -1,5 +1,5 @@
1
1
  import type { Client, Options as Options2, TDataShape } from './client';
2
- import type { CreateEnvironmentData, CreateEnvironmentErrors, CreateEnvironmentResponses, CreateProjectData, CreateProjectErrors, CreateProjectResponses, CreateSpaceData, CreateSpaceErrors, CreateSpaceResponses, GetEnvironmentOverviewData, GetEnvironmentOverviewErrors, GetEnvironmentOverviewResponses, GetGraphOverviewData, GetGraphOverviewResponses, GetProjectOverviewData, GetProjectOverviewErrors, GetProjectOverviewResponses, GetServiceHealthData, GetServiceHealthResponses, GetSpaceBillingAgreementsData, GetSpaceBillingAgreementsErrors, GetSpaceBillingAgreementsResponses, GetSpaceOverviewData, GetSpaceOverviewErrors, GetSpaceOverviewResponses, GetUserIdentitiesData, GetUserIdentitiesErrors, GetUserIdentitiesResponses, GetUserProfileData, GetUserProfileErrors, GetUserProfileResponses, RequestAccountPasswordResetData, RequestAccountPasswordResetErrors, RequestAccountPasswordResetResponses } from './types.gen';
2
+ import type { AddEdgesData, AddEdgesErrors, AddEdgesResponses, AddNodesData, AddNodesErrors, AddNodesResponses, CreateEnvironmentData, CreateEnvironmentErrors, CreateEnvironmentResponses, CreateProjectData, CreateProjectErrors, CreateProjectResponses, CreateSpaceData, CreateSpaceErrors, CreateSpaceResponses, GetEnvironmentOverviewData, GetEnvironmentOverviewErrors, GetEnvironmentOverviewResponses, GetGraphOverviewData, GetGraphOverviewErrors, GetGraphOverviewResponses, GetProjectOverviewData, GetProjectOverviewErrors, GetProjectOverviewResponses, GetServiceHealthData, GetServiceHealthResponses, GetSpaceBillingAgreementsData, GetSpaceBillingAgreementsErrors, GetSpaceBillingAgreementsResponses, GetSpaceOverviewData, GetSpaceOverviewErrors, GetSpaceOverviewResponses, GetUserIdentitiesData, GetUserIdentitiesErrors, GetUserIdentitiesResponses, GetUserProfileData, GetUserProfileErrors, GetUserProfileResponses, RemoveEdgesData, RemoveEdgesErrors, RemoveEdgesResponses, RemoveNodesData, RemoveNodesErrors, RemoveNodesResponses, RequestAccountPasswordResetData, RequestAccountPasswordResetErrors, RequestAccountPasswordResetResponses } from './types.gen';
3
3
  export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {
4
4
  /**
5
5
  * You can provide a client instance returned by `createClient()` instead of
@@ -60,4 +60,20 @@ export declare const getEnvironmentOverview: <ThrowOnError extends boolean = fal
60
60
  /**
61
61
  * Get a graph for a version inside an environment.
62
62
  */
63
- export declare const getGraphOverview: <ThrowOnError extends boolean = false>(options: Options<GetGraphOverviewData, ThrowOnError>) => import("./client").RequestResult<GetGraphOverviewResponses, unknown, ThrowOnError, "fields">;
63
+ export declare const getGraphOverview: <ThrowOnError extends boolean = false>(options: Options<GetGraphOverviewData, ThrowOnError>) => import("./client").RequestResult<GetGraphOverviewResponses, GetGraphOverviewErrors, ThrowOnError, "fields">;
64
+ /**
65
+ * Remove nodes from a graph.
66
+ */
67
+ export declare const removeNodes: <ThrowOnError extends boolean = false>(options: Options<RemoveNodesData, ThrowOnError>) => import("./client").RequestResult<RemoveNodesResponses, RemoveNodesErrors, ThrowOnError, "fields">;
68
+ /**
69
+ * Add nodes to a graph for a version. This creates initialised node rows that must later be updated.
70
+ */
71
+ export declare const addNodes: <ThrowOnError extends boolean = false>(options: Options<AddNodesData, ThrowOnError>) => import("./client").RequestResult<AddNodesResponses, AddNodesErrors, ThrowOnError, "fields">;
72
+ /**
73
+ * Remove edges from a graph.
74
+ */
75
+ export declare const removeEdges: <ThrowOnError extends boolean = false>(options: Options<RemoveEdgesData, ThrowOnError>) => import("./client").RequestResult<RemoveEdgesResponses, RemoveEdgesErrors, ThrowOnError, "fields">;
76
+ /**
77
+ * Add edges to a graph for a version. This creates initialised edge rows that must later be updated.
78
+ */
79
+ export declare const addEdges: <ThrowOnError extends boolean = false>(options: Options<AddEdgesData, ThrowOnError>) => import("./client").RequestResult<AddEdgesResponses, AddEdgesErrors, ThrowOnError, "fields">;
@@ -188,7 +188,83 @@ export const getGraphOverview = (options) => {
188
188
  type: 'http'
189
189
  }
190
190
  ],
191
- url: '/auth/{spaceHandle}/{projectHandle}/{environmentHandle}/{versionNumber}/graph',
191
+ url: '/auth/{spaceHandle}/{projectHandle}/{environmentHandle}/{version}/graph',
192
192
  ...options
193
193
  });
194
194
  };
195
+ /**
196
+ * Remove nodes from a graph.
197
+ */
198
+ export const removeNodes = (options) => {
199
+ return (options.client ?? client).delete({
200
+ security: [
201
+ {
202
+ scheme: 'bearer',
203
+ type: 'http'
204
+ }
205
+ ],
206
+ url: '/auth/{spaceHandle}/{projectHandle}/{environmentHandle}/{version}/nodes',
207
+ ...options,
208
+ headers: {
209
+ 'Content-Type': 'application/json',
210
+ ...options.headers
211
+ }
212
+ });
213
+ };
214
+ /**
215
+ * Add nodes to a graph for a version. This creates initialised node rows that must later be updated.
216
+ */
217
+ export const addNodes = (options) => {
218
+ return (options.client ?? client).post({
219
+ security: [
220
+ {
221
+ scheme: 'bearer',
222
+ type: 'http'
223
+ }
224
+ ],
225
+ url: '/auth/{spaceHandle}/{projectHandle}/{environmentHandle}/{version}/nodes',
226
+ ...options,
227
+ headers: {
228
+ 'Content-Type': 'application/json',
229
+ ...options.headers
230
+ }
231
+ });
232
+ };
233
+ /**
234
+ * Remove edges from a graph.
235
+ */
236
+ export const removeEdges = (options) => {
237
+ return (options.client ?? client).delete({
238
+ security: [
239
+ {
240
+ scheme: 'bearer',
241
+ type: 'http'
242
+ }
243
+ ],
244
+ url: '/auth/{spaceHandle}/{projectHandle}/{environmentHandle}/{version}/edges',
245
+ ...options,
246
+ headers: {
247
+ 'Content-Type': 'application/json',
248
+ ...options.headers
249
+ }
250
+ });
251
+ };
252
+ /**
253
+ * Add edges to a graph for a version. This creates initialised edge rows that must later be updated.
254
+ */
255
+ export const addEdges = (options) => {
256
+ return (options.client ?? client).post({
257
+ security: [
258
+ {
259
+ scheme: 'bearer',
260
+ type: 'http'
261
+ }
262
+ ],
263
+ url: '/auth/{spaceHandle}/{projectHandle}/{environmentHandle}/{version}/edges',
264
+ ...options,
265
+ headers: {
266
+ 'Content-Type': 'application/json',
267
+ ...options.headers
268
+ }
269
+ });
270
+ };
@@ -1,5 +1,5 @@
1
1
  export type ClientOptions = {
2
- baseUrl: 'http://localhost:8080/core-service' | 'https://shoal-dev.platform48.com/core-service' | (string & {});
2
+ baseUrl: 'http://localhost:8080/core-service' | 'https://api-dev.shoalstack.com/core-service' | (string & {});
3
3
  };
4
4
  export type HealthResponse = {
5
5
  status: string;
@@ -126,6 +126,27 @@ export type BillingAgreements = {
126
126
  }>;
127
127
  }>;
128
128
  };
129
+ export type EdgeVertices = {
130
+ src: string;
131
+ dst: string;
132
+ };
133
+ export type AddEdges = {
134
+ edges: Array<EdgeVertices>;
135
+ };
136
+ export type RemoveEdges = {
137
+ edges: Array<EdgeVertices>;
138
+ };
139
+ export type AddNodes = {
140
+ nodes: Array<CreateNode>;
141
+ };
142
+ export type RemoveNodes = {
143
+ ids: Array<string>;
144
+ };
145
+ export type CreateNode = {
146
+ x: unknown;
147
+ y: unknown;
148
+ typ: NodeType;
149
+ };
129
150
  export type NodeType = 'cache' | 'comment' | 'container' | 'cronjob' | 'database' | 'function' | 'message_queue' | 'proxy' | 'vm';
130
151
  export type CommentNodeProps = {
131
152
  [key: string]: unknown;
@@ -160,7 +181,7 @@ export type Edge = {
160
181
  dst: string;
161
182
  };
162
183
  export type Graph = {
163
- nodes?: Array<Node>;
184
+ nodes: Array<Node>;
164
185
  };
165
186
  export type BaseNode = {
166
187
  id: string;
@@ -229,7 +250,7 @@ export type Node = ({
229
250
  /**
230
251
  * A version number with in an environment.
231
252
  */
232
- export type VersionNumber = unknown;
253
+ export type Version = string;
233
254
  /**
234
255
  * An environment name (e.g., dev, prod, foo-bar). This must be unique to a project.
235
256
  */
@@ -626,11 +647,30 @@ export type GetGraphOverviewData = {
626
647
  /**
627
648
  * A version number with in an environment.
628
649
  */
629
- versionNumber: unknown;
650
+ version: string;
630
651
  };
631
652
  query?: never;
632
- url: '/auth/{spaceHandle}/{projectHandle}/{environmentHandle}/{versionNumber}/graph';
653
+ url: '/auth/{spaceHandle}/{projectHandle}/{environmentHandle}/{version}/graph';
654
+ };
655
+ export type GetGraphOverviewErrors = {
656
+ /**
657
+ * Unauthorised user.
658
+ */
659
+ 401: ErrorResponse;
660
+ /**
661
+ * Invalid credentials.
662
+ */
663
+ 403: ErrorResponse;
664
+ /**
665
+ * Related content not found.
666
+ */
667
+ 404: ErrorResponse;
668
+ /**
669
+ * Unexpected error.
670
+ */
671
+ 500: ErrorResponse;
633
672
  };
673
+ export type GetGraphOverviewError = GetGraphOverviewErrors[keyof GetGraphOverviewErrors];
634
674
  export type GetGraphOverviewResponses = {
635
675
  /**
636
676
  * A graph overview.
@@ -638,3 +678,199 @@ export type GetGraphOverviewResponses = {
638
678
  200: Graph;
639
679
  };
640
680
  export type GetGraphOverviewResponse = GetGraphOverviewResponses[keyof GetGraphOverviewResponses];
681
+ export type RemoveNodesData = {
682
+ body: RemoveNodes;
683
+ path: {
684
+ /**
685
+ * The space handle. This must be globally unique.
686
+ */
687
+ spaceHandle: string;
688
+ /**
689
+ * A project name. This must be unique to a space.
690
+ */
691
+ projectHandle: string;
692
+ /**
693
+ * An environment name (e.g., dev, prod, foo-bar). This must be unique to a project.
694
+ */
695
+ environmentHandle: string;
696
+ /**
697
+ * A version number with in an environment.
698
+ */
699
+ version: string;
700
+ };
701
+ query?: never;
702
+ url: '/auth/{spaceHandle}/{projectHandle}/{environmentHandle}/{version}/nodes';
703
+ };
704
+ export type RemoveNodesErrors = {
705
+ /**
706
+ * Unauthorised user.
707
+ */
708
+ 401: ErrorResponse;
709
+ /**
710
+ * Invalid credentials.
711
+ */
712
+ 403: ErrorResponse;
713
+ /**
714
+ * Related content not found.
715
+ */
716
+ 404: ErrorResponse;
717
+ /**
718
+ * Unexpected error.
719
+ */
720
+ 500: ErrorResponse;
721
+ };
722
+ export type RemoveNodesError = RemoveNodesErrors[keyof RemoveNodesErrors];
723
+ export type RemoveNodesResponses = {
724
+ /**
725
+ * A graph overview.
726
+ */
727
+ 200: Graph;
728
+ };
729
+ export type RemoveNodesResponse = RemoveNodesResponses[keyof RemoveNodesResponses];
730
+ export type AddNodesData = {
731
+ body: AddNodes;
732
+ path: {
733
+ /**
734
+ * The space handle. This must be globally unique.
735
+ */
736
+ spaceHandle: string;
737
+ /**
738
+ * A project name. This must be unique to a space.
739
+ */
740
+ projectHandle: string;
741
+ /**
742
+ * An environment name (e.g., dev, prod, foo-bar). This must be unique to a project.
743
+ */
744
+ environmentHandle: string;
745
+ /**
746
+ * A version number with in an environment.
747
+ */
748
+ version: string;
749
+ };
750
+ query?: never;
751
+ url: '/auth/{spaceHandle}/{projectHandle}/{environmentHandle}/{version}/nodes';
752
+ };
753
+ export type AddNodesErrors = {
754
+ /**
755
+ * Unauthorised user.
756
+ */
757
+ 401: ErrorResponse;
758
+ /**
759
+ * Invalid credentials.
760
+ */
761
+ 403: ErrorResponse;
762
+ /**
763
+ * Related content not found.
764
+ */
765
+ 404: ErrorResponse;
766
+ /**
767
+ * Unexpected error.
768
+ */
769
+ 500: ErrorResponse;
770
+ };
771
+ export type AddNodesError = AddNodesErrors[keyof AddNodesErrors];
772
+ export type AddNodesResponses = {
773
+ /**
774
+ * A graph overview.
775
+ */
776
+ 200: Graph;
777
+ };
778
+ export type AddNodesResponse = AddNodesResponses[keyof AddNodesResponses];
779
+ export type RemoveEdgesData = {
780
+ body: RemoveEdges;
781
+ path: {
782
+ /**
783
+ * The space handle. This must be globally unique.
784
+ */
785
+ spaceHandle: string;
786
+ /**
787
+ * A project name. This must be unique to a space.
788
+ */
789
+ projectHandle: string;
790
+ /**
791
+ * An environment name (e.g., dev, prod, foo-bar). This must be unique to a project.
792
+ */
793
+ environmentHandle: string;
794
+ /**
795
+ * A version number with in an environment.
796
+ */
797
+ version: string;
798
+ };
799
+ query?: never;
800
+ url: '/auth/{spaceHandle}/{projectHandle}/{environmentHandle}/{version}/edges';
801
+ };
802
+ export type RemoveEdgesErrors = {
803
+ /**
804
+ * Unauthorised user.
805
+ */
806
+ 401: ErrorResponse;
807
+ /**
808
+ * Invalid credentials.
809
+ */
810
+ 403: ErrorResponse;
811
+ /**
812
+ * Related content not found.
813
+ */
814
+ 404: ErrorResponse;
815
+ /**
816
+ * Unexpected error.
817
+ */
818
+ 500: ErrorResponse;
819
+ };
820
+ export type RemoveEdgesError = RemoveEdgesErrors[keyof RemoveEdgesErrors];
821
+ export type RemoveEdgesResponses = {
822
+ /**
823
+ * A graph overview.
824
+ */
825
+ 200: Graph;
826
+ };
827
+ export type RemoveEdgesResponse = RemoveEdgesResponses[keyof RemoveEdgesResponses];
828
+ export type AddEdgesData = {
829
+ body: AddEdges;
830
+ path: {
831
+ /**
832
+ * The space handle. This must be globally unique.
833
+ */
834
+ spaceHandle: string;
835
+ /**
836
+ * A project name. This must be unique to a space.
837
+ */
838
+ projectHandle: string;
839
+ /**
840
+ * An environment name (e.g., dev, prod, foo-bar). This must be unique to a project.
841
+ */
842
+ environmentHandle: string;
843
+ /**
844
+ * A version number with in an environment.
845
+ */
846
+ version: string;
847
+ };
848
+ query?: never;
849
+ url: '/auth/{spaceHandle}/{projectHandle}/{environmentHandle}/{version}/edges';
850
+ };
851
+ export type AddEdgesErrors = {
852
+ /**
853
+ * Unauthorised user.
854
+ */
855
+ 401: ErrorResponse;
856
+ /**
857
+ * Invalid credentials.
858
+ */
859
+ 403: ErrorResponse;
860
+ /**
861
+ * Related content not found.
862
+ */
863
+ 404: ErrorResponse;
864
+ /**
865
+ * Unexpected error.
866
+ */
867
+ 500: ErrorResponse;
868
+ };
869
+ export type AddEdgesError = AddEdgesErrors[keyof AddEdgesErrors];
870
+ export type AddEdgesResponses = {
871
+ /**
872
+ * A graph overview.
873
+ */
874
+ 200: Graph;
875
+ };
876
+ export type AddEdgesResponse = AddEdgesResponses[keyof AddEdgesResponses];
@@ -1,6 +1,6 @@
1
1
  import { useMutation } from "@tanstack/react-query";
2
2
  import { GetSuccessResponse } from "../util";
3
- import { GetServiceHealthData, RequestAccountPasswordResetData, RequestAccountPasswordResetResponses, GetUserProfileData, GetUserIdentitiesData, CreateSpaceData, CreateSpaceResponses, GetSpaceOverviewData, GetSpaceBillingAgreementsData, CreateProjectData, CreateProjectResponses, GetProjectOverviewData, CreateEnvironmentData, CreateEnvironmentResponses, GetEnvironmentOverviewData, GetGraphOverviewData } from "../../sdk/types.gen";
3
+ import { GetServiceHealthData, RequestAccountPasswordResetData, RequestAccountPasswordResetResponses, GetUserProfileData, GetUserIdentitiesData, CreateSpaceData, CreateSpaceResponses, GetSpaceOverviewData, GetSpaceBillingAgreementsData, CreateProjectData, CreateProjectResponses, GetProjectOverviewData, CreateEnvironmentData, CreateEnvironmentResponses, GetEnvironmentOverviewData, GetGraphOverviewData, RemoveNodesData, RemoveNodesResponses, AddNodesData, AddNodesResponses, RemoveEdgesData, RemoveEdgesResponses, AddEdgesData, AddEdgesResponses } from "../../sdk/types.gen";
4
4
  export declare const useGetServiceHealth: (options?: Omit<GetServiceHealthData, "url"> & {
5
5
  enabled?: boolean;
6
6
  }) => import("@tanstack/react-query").UseQueryResult<import("../../sdk/types.gen").HealthResponse | undefined, Error>;
@@ -45,3 +45,23 @@ export declare const useGetEnvironmentOverview: (options: Omit<GetEnvironmentOve
45
45
  export declare const useGetGraphOverview: (options: Omit<GetGraphOverviewData, "url"> & {
46
46
  enabled?: boolean;
47
47
  }) => import("@tanstack/react-query").UseQueryResult<import("../../sdk/types.gen").Graph | undefined, Error>;
48
+ export declare const useRemoveNodes: (config?: {
49
+ onSuccess?: (data: GetSuccessResponse<RemoveNodesResponses>) => void;
50
+ onError?: Parameters<typeof useMutation>["0"]["onError"];
51
+ retry?: boolean;
52
+ }) => import("@tanstack/react-query").UseMutationResult<import("../../sdk/types.gen").Graph | undefined, unknown, Omit<RemoveNodesData, "url">, unknown>;
53
+ export declare const useAddNodes: (config?: {
54
+ onSuccess?: (data: GetSuccessResponse<AddNodesResponses>) => void;
55
+ onError?: Parameters<typeof useMutation>["0"]["onError"];
56
+ retry?: boolean;
57
+ }) => import("@tanstack/react-query").UseMutationResult<import("../../sdk/types.gen").Graph | undefined, unknown, Omit<AddNodesData, "url">, unknown>;
58
+ export declare const useRemoveEdges: (config?: {
59
+ onSuccess?: (data: GetSuccessResponse<RemoveEdgesResponses>) => void;
60
+ onError?: Parameters<typeof useMutation>["0"]["onError"];
61
+ retry?: boolean;
62
+ }) => import("@tanstack/react-query").UseMutationResult<import("../../sdk/types.gen").Graph | undefined, unknown, Omit<RemoveEdgesData, "url">, unknown>;
63
+ export declare const useAddEdges: (config?: {
64
+ onSuccess?: (data: GetSuccessResponse<AddEdgesResponses>) => void;
65
+ onError?: Parameters<typeof useMutation>["0"]["onError"];
66
+ retry?: boolean;
67
+ }) => import("@tanstack/react-query").UseMutationResult<import("../../sdk/types.gen").Graph | undefined, unknown, Omit<AddEdgesData, "url">, unknown>;
@@ -2,7 +2,7 @@
2
2
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
3
3
  import { isPromise } from "../util";
4
4
  import { useToken } from "../../provider/token-provider";
5
- import { getServiceHealth, requestAccountPasswordReset, getUserProfile, getUserIdentities, createSpace, getSpaceOverview, getSpaceBillingAgreements, createProject, getProjectOverview, createEnvironment, getEnvironmentOverview, getGraphOverview } from "../../sdk/sdk.gen";
5
+ import { getServiceHealth, requestAccountPasswordReset, getUserProfile, getUserIdentities, createSpace, getSpaceOverview, getSpaceBillingAgreements, createProject, getProjectOverview, createEnvironment, getEnvironmentOverview, getGraphOverview, removeNodes, addNodes, removeEdges, addEdges } from "../../sdk/sdk.gen";
6
6
  export const useGetServiceHealth = (options) => {
7
7
  const token = useToken();
8
8
  let { enabled, ...rest } = options || { enabled: true };
@@ -229,7 +229,7 @@ export const useGetEnvironmentOverview = (options) => {
229
229
  export const useGetGraphOverview = (options) => {
230
230
  const token = useToken();
231
231
  let { enabled, ...rest } = options || { enabled: true };
232
- const opts = { throwOnError: true, url: "/auth/{spaceHandle}/{projectHandle}/{environmentHandle}/{versionNumber}/graph" };
232
+ const opts = { throwOnError: true, url: "/auth/{spaceHandle}/{projectHandle}/{environmentHandle}/{version}/graph" };
233
233
  const funcer = async () => {
234
234
  const auth = isPromise(token) ? (await token) || "" : token || "";
235
235
  if (isPromise(token) && !token)
@@ -240,10 +240,86 @@ export const useGetGraphOverview = (options) => {
240
240
  if (!token)
241
241
  enabled = false;
242
242
  return useQuery({
243
- queryKey: [options?.path?.spaceHandle, options?.path?.projectHandle, options?.path?.environmentHandle, options?.path?.versionNumber, "graph", options.query ?? {}],
243
+ queryKey: [options?.path?.spaceHandle, options?.path?.projectHandle, options?.path?.environmentHandle, options?.path?.version, "graph", options.query ?? {}],
244
244
  queryFn: funcer,
245
245
  enabled,
246
246
  retry: false,
247
247
  staleTime: 600000
248
248
  });
249
249
  };
250
+ export const useRemoveNodes = (config) => {
251
+ const token = useToken();
252
+ const queryClient = useQueryClient();
253
+ const opts = { throwOnError: true, url: "/auth/{spaceHandle}/{projectHandle}/{environmentHandle}/{version}/nodes" };
254
+ const funcer = async (options) => {
255
+ const auth = isPromise(token) ? (await token) || "" : token || "";
256
+ const res = await removeNodes({ ...opts, ...options, auth });
257
+ return res?.data;
258
+ };
259
+ return useMutation({
260
+ mutationFn: funcer,
261
+ onSuccess: (res, options, c, ctx) => {
262
+ queryClient.invalidateQueries({ queryKey: [options?.path?.spaceHandle, options?.path?.projectHandle, options?.path?.environmentHandle, options?.path?.version, "nodes"] });
263
+ config?.onSuccess && config.onSuccess(res);
264
+ },
265
+ onError: config?.onError,
266
+ retry: config?.retry
267
+ });
268
+ };
269
+ export const useAddNodes = (config) => {
270
+ const token = useToken();
271
+ const queryClient = useQueryClient();
272
+ const opts = { throwOnError: true, url: "/auth/{spaceHandle}/{projectHandle}/{environmentHandle}/{version}/nodes" };
273
+ const funcer = async (options) => {
274
+ const auth = isPromise(token) ? (await token) || "" : token || "";
275
+ const res = await addNodes({ ...opts, ...options, auth });
276
+ return res?.data;
277
+ };
278
+ return useMutation({
279
+ mutationFn: funcer,
280
+ onSuccess: (res, options, c, ctx) => {
281
+ queryClient.invalidateQueries({ queryKey: [options?.path?.spaceHandle, options?.path?.projectHandle, options?.path?.environmentHandle, options?.path?.version, "nodes"] });
282
+ config?.onSuccess && config.onSuccess(res);
283
+ },
284
+ onError: config?.onError,
285
+ retry: config?.retry
286
+ });
287
+ };
288
+ export const useRemoveEdges = (config) => {
289
+ const token = useToken();
290
+ const queryClient = useQueryClient();
291
+ const opts = { throwOnError: true, url: "/auth/{spaceHandle}/{projectHandle}/{environmentHandle}/{version}/edges" };
292
+ const funcer = async (options) => {
293
+ const auth = isPromise(token) ? (await token) || "" : token || "";
294
+ const res = await removeEdges({ ...opts, ...options, auth });
295
+ return res?.data;
296
+ };
297
+ return useMutation({
298
+ mutationFn: funcer,
299
+ onSuccess: (res, options, c, ctx) => {
300
+ queryClient.invalidateQueries({ queryKey: [options?.path?.spaceHandle, options?.path?.projectHandle, options?.path?.environmentHandle, options?.path?.version, "edges"] });
301
+ config?.onSuccess && config.onSuccess(res);
302
+ },
303
+ onError: config?.onError,
304
+ retry: config?.retry
305
+ });
306
+ };
307
+ export const useAddEdges = (config) => {
308
+ const token = useToken();
309
+ const queryClient = useQueryClient();
310
+ const opts = { throwOnError: true, url: "/auth/{spaceHandle}/{projectHandle}/{environmentHandle}/{version}/edges" };
311
+ const funcer = async (options) => {
312
+ const auth = isPromise(token) ? (await token) || "" : token || "";
313
+ const res = await addEdges({ ...opts, ...options, auth });
314
+ return res?.data;
315
+ };
316
+ return useMutation({
317
+ mutationFn: funcer,
318
+ onSuccess: (res, options, c, ctx) => {
319
+ queryClient.invalidateQueries({ queryKey: [options?.path?.spaceHandle, options?.path?.projectHandle, options?.path?.environmentHandle, options?.path?.version, "edges"] });
320
+ config?.onSuccess && config.onSuccess(res);
321
+ },
322
+ onError: config?.onError,
323
+ retry: config?.retry
324
+ });
325
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shoal-web-sdk",
3
- "version": "0.0.40",
3
+ "version": "0.0.43",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "build-hooks": "npx tsx tanstack-codegen/generator.ts",