shoal-web-sdk 0.0.41 → 0.0.44

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">;
@@ -192,3 +192,79 @@ export const getGraphOverview = (options) => {
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,12 +1,12 @@
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;
6
6
  };
7
7
  export type ErrorResponse = {
8
8
  message: string;
9
- internalCode: unknown;
9
+ internalCode: number;
10
10
  };
11
11
  export type CreateProject = {
12
12
  name: string;
@@ -49,7 +49,7 @@ export type EnvironmentOverview = {
49
49
  description?: string;
50
50
  createdAt: string;
51
51
  updatedAt: string;
52
- versions: unknown;
52
+ versions: number;
53
53
  };
54
54
  export type AccountIdentity = {
55
55
  id: string;
@@ -57,7 +57,7 @@ export type AccountIdentity = {
57
57
  is_confirmed: boolean;
58
58
  created_on: string;
59
59
  last_login_on: string;
60
- total_logins: unknown;
60
+ total_logins: number;
61
61
  name: string;
62
62
  email: string;
63
63
  is_primary: boolean;
@@ -73,8 +73,8 @@ export type AccountProfile = {
73
73
  lastName: string;
74
74
  isSuspended: boolean;
75
75
  picture: string;
76
- totalSignIns: unknown;
77
- failedSignIns: unknown;
76
+ totalSignIns: number;
77
+ failedSignIns: number;
78
78
  lastSignedIn: string;
79
79
  createdOn: string;
80
80
  };
@@ -126,13 +126,25 @@ export type BillingAgreements = {
126
126
  }>;
127
127
  }>;
128
128
  };
129
- export type CreateEdge = {
129
+ export type EdgeVertices = {
130
130
  src: string;
131
131
  dst: string;
132
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
+ };
133
145
  export type CreateNode = {
134
- x: unknown;
135
- y: unknown;
146
+ x: number;
147
+ y: number;
136
148
  typ: NodeType;
137
149
  };
138
150
  export type NodeType = 'cache' | 'comment' | 'container' | 'cronjob' | 'database' | 'function' | 'message_queue' | 'proxy' | 'vm';
@@ -169,15 +181,15 @@ export type Edge = {
169
181
  dst: string;
170
182
  };
171
183
  export type Graph = {
172
- nodes?: Array<Node>;
184
+ nodes: Array<Node>;
173
185
  };
174
186
  export type BaseNode = {
175
187
  id: string;
176
188
  versionId: string;
177
189
  name: string;
178
190
  description: string;
179
- x: unknown;
180
- y: unknown;
191
+ x: number;
192
+ y: number;
181
193
  edges: Array<Edge>;
182
194
  };
183
195
  export type CommentNode = BaseNode & {
@@ -217,23 +229,23 @@ export type VmNode = BaseNode & {
217
229
  props: VmNodeProps;
218
230
  };
219
231
  export type Node = ({
220
- typ: 'CommentNode';
232
+ typ: 'comment';
221
233
  } & CommentNode) | ({
222
- typ: 'CacheNode';
234
+ typ: 'cache';
223
235
  } & CacheNode) | ({
224
- typ: 'ContainerNode';
236
+ typ: 'container';
225
237
  } & ContainerNode) | ({
226
- typ: 'CronJobNode';
238
+ typ: 'cronjob';
227
239
  } & CronJobNode) | ({
228
- typ: 'DatabaseNode';
240
+ typ: 'database';
229
241
  } & DatabaseNode) | ({
230
- typ: 'FunctionNode';
242
+ typ: 'function';
231
243
  } & FunctionNode) | ({
232
- typ: 'MessageQueueNode';
244
+ typ: 'message_queue';
233
245
  } & MessageQueueNode) | ({
234
- typ: 'ProxyNode';
246
+ typ: 'proxy';
235
247
  } & ProxyNode) | ({
236
- typ: 'VMNode';
248
+ typ: 'vm';
237
249
  } & VmNode);
238
250
  /**
239
251
  * A version number with in an environment.
@@ -640,6 +652,25 @@ export type GetGraphOverviewData = {
640
652
  query?: never;
641
653
  url: '/auth/{spaceHandle}/{projectHandle}/{environmentHandle}/{version}/graph';
642
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;
672
+ };
673
+ export type GetGraphOverviewError = GetGraphOverviewErrors[keyof GetGraphOverviewErrors];
643
674
  export type GetGraphOverviewResponses = {
644
675
  /**
645
676
  * A graph overview.
@@ -647,3 +678,199 @@ export type GetGraphOverviewResponses = {
647
678
  200: Graph;
648
679
  };
649
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 };
@@ -247,3 +247,79 @@ export const useGetGraphOverview = (options) => {
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.41",
3
+ "version": "0.0.44",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "build-hooks": "npx tsx tanstack-codegen/generator.ts",