@squonk/data-manager-client 4.3.0 → 5.0.0-5-0.2173777171
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.
- package/accounting/accounting.cjs +55 -10
- package/accounting/accounting.cjs.map +1 -1
- package/accounting/accounting.d.cts +58 -1
- package/accounting/accounting.d.ts +58 -1
- package/accounting/accounting.js +46 -1
- package/accounting/accounting.js.map +1 -1
- package/admin/admin.cjs +15 -15
- package/admin/admin.cjs.map +1 -1
- package/admin/admin.d.cts +2 -0
- package/admin/admin.d.ts +2 -0
- package/admin/admin.js +1 -1
- package/admin/admin.js.map +1 -1
- package/application/application.cjs +5 -5
- package/application/application.cjs.map +1 -1
- package/application/application.js +1 -1
- package/application/application.js.map +1 -1
- package/{chunk-OYRETEBZ.js → chunk-76ADQBHZ.js} +3 -3
- package/chunk-76ADQBHZ.js.map +1 -0
- package/{chunk-ZLY5XEOQ.cjs → chunk-KHB5TJT7.cjs} +3 -3
- package/chunk-KHB5TJT7.cjs.map +1 -0
- package/chunk-RB2KVIEK.cjs.map +1 -1
- package/configuration/configuration.cjs +5 -5
- package/configuration/configuration.cjs.map +1 -1
- package/configuration/configuration.d.cts +1 -1
- package/configuration/configuration.d.ts +1 -1
- package/configuration/configuration.js +1 -1
- package/configuration/configuration.js.map +1 -1
- package/dataset/dataset.cjs +14 -14
- package/dataset/dataset.cjs.map +1 -1
- package/dataset/dataset.js +1 -1
- package/dataset/dataset.js.map +1 -1
- package/digest/digest.cjs +3 -3
- package/digest/digest.cjs.map +1 -1
- package/digest/digest.js +1 -1
- package/digest/digest.js.map +1 -1
- package/file-and-path/file-and-path.cjs +139 -17
- package/file-and-path/file-and-path.cjs.map +1 -1
- package/file-and-path/file-and-path.d.cts +162 -2
- package/file-and-path/file-and-path.d.ts +162 -2
- package/file-and-path/file-and-path.js +123 -1
- package/file-and-path/file-and-path.js.map +1 -1
- package/index.cjs +4 -2
- package/index.cjs.map +1 -1
- package/index.d.cts +53 -37
- package/index.d.ts +53 -37
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/instance/instance.cjs +10 -10
- package/instance/instance.cjs.map +1 -1
- package/instance/instance.js +1 -1
- package/instance/instance.js.map +1 -1
- package/inventory/inventory.cjs +3 -3
- package/inventory/inventory.cjs.map +1 -1
- package/inventory/inventory.js +1 -1
- package/inventory/inventory.js.map +1 -1
- package/job/job.cjs +124 -8
- package/job/job.cjs.map +1 -1
- package/job/job.d.cts +159 -3
- package/job/job.d.ts +159 -3
- package/job/job.js +119 -3
- package/job/job.js.map +1 -1
- package/metadata/metadata.cjs +7 -7
- package/metadata/metadata.cjs.map +1 -1
- package/metadata/metadata.js +1 -1
- package/metadata/metadata.js.map +1 -1
- package/package.json +1 -1
- package/project/project.cjs +15 -137
- package/project/project.cjs.map +1 -1
- package/project/project.d.cts +3 -163
- package/project/project.d.ts +3 -163
- package/project/project.js +1 -123
- package/project/project.js.map +1 -1
- package/src/{data-manager-api.schemas.ts → API_TARGET_NAME.schemas.ts} +52 -43
- package/src/accounting/accounting.ts +244 -2
- package/src/admin/admin.ts +4 -2
- package/src/application/application.ts +2 -2
- package/src/configuration/configuration.ts +5 -9
- package/src/dataset/dataset.ts +2 -2
- package/src/digest/digest.ts +2 -2
- package/src/file-and-path/file-and-path.ts +602 -2
- package/src/index.ts +2 -2
- package/src/instance/instance.ts +2 -2
- package/src/inventory/inventory.ts +2 -2
- package/src/job/job.ts +599 -3
- package/src/metadata/metadata.ts +2 -2
- package/src/options-mutator.ts +2 -2
- package/src/project/project.ts +5 -604
- package/src/task/task.ts +2 -2
- package/src/type/type.ts +2 -2
- package/src/user/user.ts +2 -2
- package/src/workflow/workflow.ts +5 -3
- package/task/task.cjs +6 -6
- package/task/task.cjs.map +1 -1
- package/task/task.js +1 -1
- package/task/task.js.map +1 -1
- package/type/type.cjs +3 -3
- package/type/type.cjs.map +1 -1
- package/type/type.js +1 -1
- package/type/type.js.map +1 -1
- package/user/user.cjs +10 -10
- package/user/user.cjs.map +1 -1
- package/user/user.js +1 -1
- package/user/user.js.map +1 -1
- package/workflow/workflow.cjs +20 -20
- package/workflow/workflow.cjs.map +1 -1
- package/workflow/workflow.d.cts +3 -1
- package/workflow/workflow.d.ts +3 -1
- package/workflow/workflow.js +1 -1
- package/workflow/workflow.js.map +1 -1
- package/chunk-OYRETEBZ.js.map +0 -1
- package/chunk-ZLY5XEOQ.cjs.map +0 -1
- package/exchange-rate/exchange-rate.cjs +0 -255
- package/exchange-rate/exchange-rate.cjs.map +0 -1
- package/exchange-rate/exchange-rate.d.cts +0 -319
- package/exchange-rate/exchange-rate.d.ts +0 -319
- package/exchange-rate/exchange-rate.js +0 -255
- package/exchange-rate/exchange-rate.js.map +0 -1
- package/exchange-rate/package.json +0 -7
- package/src/exchange-rate/exchange-rate.ts +0 -1276
package/src/job/job.ts
CHANGED
|
@@ -6,17 +6,20 @@
|
|
|
6
6
|
|
|
7
7
|
A service that allows *registered* users to make **Datasets** and associated **Metadata** available to **Applications**, **Jobs**, and **Workflows** using **Projects** and **Files**.
|
|
8
8
|
|
|
9
|
-
* OpenAPI spec version:
|
|
9
|
+
* OpenAPI spec version: 5.0
|
|
10
10
|
*/
|
|
11
|
-
import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
11
|
+
import { useMutation, useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
12
12
|
import type {
|
|
13
13
|
DataTag,
|
|
14
14
|
DefinedInitialDataOptions,
|
|
15
15
|
DefinedUseQueryResult,
|
|
16
|
+
MutationFunction,
|
|
16
17
|
QueryClient,
|
|
17
18
|
QueryFunction,
|
|
18
19
|
QueryKey,
|
|
19
20
|
UndefinedInitialDataOptions,
|
|
21
|
+
UseMutationOptions,
|
|
22
|
+
UseMutationResult,
|
|
20
23
|
UseQueryOptions,
|
|
21
24
|
UseQueryResult,
|
|
22
25
|
UseSuspenseQueryOptions,
|
|
@@ -25,16 +28,22 @@ import type {
|
|
|
25
28
|
|
|
26
29
|
import type {
|
|
27
30
|
DmError,
|
|
31
|
+
ExchangeRatePutBodyBody,
|
|
32
|
+
GetAllExchangeRatesResponse,
|
|
33
|
+
GetAllJobExchangeRatesParams,
|
|
34
|
+
GetExchangeRatesResponse,
|
|
28
35
|
GetJobByVersionParams,
|
|
36
|
+
GetJobExchangeRatesParams,
|
|
29
37
|
GetJobParams,
|
|
30
38
|
GetJobsParams,
|
|
31
39
|
JobGetResponse,
|
|
32
40
|
JobsGetResponse,
|
|
33
|
-
} from "../
|
|
41
|
+
} from "../API_TARGET_NAME.schemas";
|
|
34
42
|
|
|
35
43
|
import { customInstance } from ".././custom-instance";
|
|
36
44
|
import type { ErrorType } from ".././custom-instance";
|
|
37
45
|
import { queryMutator } from ".././options-mutator";
|
|
46
|
+
import { mutationMutator } from ".././options-mutator";
|
|
38
47
|
|
|
39
48
|
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
40
49
|
|
|
@@ -698,3 +707,590 @@ export function useGetJobSuspense<
|
|
|
698
707
|
|
|
699
708
|
return query;
|
|
700
709
|
}
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* For every Job that has an exchange rate the current rate is returned. If you want a list of all Jobs that have no exchange rate, set the `only_undefined` query option.
|
|
713
|
+
|
|
714
|
+
* @summary Gets Exchange Rates for all Jobs
|
|
715
|
+
*/
|
|
716
|
+
export const getAllJobExchangeRates = (
|
|
717
|
+
params?: GetAllJobExchangeRatesParams,
|
|
718
|
+
options?: SecondParameter<typeof customInstance>,
|
|
719
|
+
signal?: AbortSignal,
|
|
720
|
+
) => {
|
|
721
|
+
return customInstance<GetAllExchangeRatesResponse>(
|
|
722
|
+
{ url: `/job-exchange-rates`, method: "GET", params, signal },
|
|
723
|
+
options,
|
|
724
|
+
);
|
|
725
|
+
};
|
|
726
|
+
|
|
727
|
+
export const getGetAllJobExchangeRatesQueryKey = (params?: GetAllJobExchangeRatesParams) => {
|
|
728
|
+
return [`/job-exchange-rates`, ...(params ? [params] : [])] as const;
|
|
729
|
+
};
|
|
730
|
+
|
|
731
|
+
export const useGetAllJobExchangeRatesQueryOptions = <
|
|
732
|
+
TData = Awaited<ReturnType<typeof getAllJobExchangeRates>>,
|
|
733
|
+
TError = ErrorType<void | DmError>,
|
|
734
|
+
>(
|
|
735
|
+
params?: GetAllJobExchangeRatesParams,
|
|
736
|
+
options?: {
|
|
737
|
+
query?: Partial<
|
|
738
|
+
UseQueryOptions<Awaited<ReturnType<typeof getAllJobExchangeRates>>, TError, TData>
|
|
739
|
+
>;
|
|
740
|
+
request?: SecondParameter<typeof customInstance>;
|
|
741
|
+
},
|
|
742
|
+
) => {
|
|
743
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
744
|
+
|
|
745
|
+
const queryKey = queryOptions?.queryKey ?? getGetAllJobExchangeRatesQueryKey(params);
|
|
746
|
+
|
|
747
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getAllJobExchangeRates>>> = ({ signal }) =>
|
|
748
|
+
getAllJobExchangeRates(params, requestOptions, signal);
|
|
749
|
+
|
|
750
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
751
|
+
|
|
752
|
+
return customOptions as UseQueryOptions<
|
|
753
|
+
Awaited<ReturnType<typeof getAllJobExchangeRates>>,
|
|
754
|
+
TError,
|
|
755
|
+
TData
|
|
756
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
757
|
+
};
|
|
758
|
+
|
|
759
|
+
export type GetAllJobExchangeRatesQueryResult = NonNullable<
|
|
760
|
+
Awaited<ReturnType<typeof getAllJobExchangeRates>>
|
|
761
|
+
>;
|
|
762
|
+
export type GetAllJobExchangeRatesQueryError = ErrorType<void | DmError>;
|
|
763
|
+
|
|
764
|
+
export function useGetAllJobExchangeRates<
|
|
765
|
+
TData = Awaited<ReturnType<typeof getAllJobExchangeRates>>,
|
|
766
|
+
TError = ErrorType<void | DmError>,
|
|
767
|
+
>(
|
|
768
|
+
params: undefined | GetAllJobExchangeRatesParams,
|
|
769
|
+
options: {
|
|
770
|
+
query: Partial<
|
|
771
|
+
UseQueryOptions<Awaited<ReturnType<typeof getAllJobExchangeRates>>, TError, TData>
|
|
772
|
+
> &
|
|
773
|
+
Pick<
|
|
774
|
+
DefinedInitialDataOptions<
|
|
775
|
+
Awaited<ReturnType<typeof getAllJobExchangeRates>>,
|
|
776
|
+
TError,
|
|
777
|
+
Awaited<ReturnType<typeof getAllJobExchangeRates>>
|
|
778
|
+
>,
|
|
779
|
+
"initialData"
|
|
780
|
+
>;
|
|
781
|
+
request?: SecondParameter<typeof customInstance>;
|
|
782
|
+
},
|
|
783
|
+
queryClient?: QueryClient,
|
|
784
|
+
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
785
|
+
export function useGetAllJobExchangeRates<
|
|
786
|
+
TData = Awaited<ReturnType<typeof getAllJobExchangeRates>>,
|
|
787
|
+
TError = ErrorType<void | DmError>,
|
|
788
|
+
>(
|
|
789
|
+
params?: GetAllJobExchangeRatesParams,
|
|
790
|
+
options?: {
|
|
791
|
+
query?: Partial<
|
|
792
|
+
UseQueryOptions<Awaited<ReturnType<typeof getAllJobExchangeRates>>, TError, TData>
|
|
793
|
+
> &
|
|
794
|
+
Pick<
|
|
795
|
+
UndefinedInitialDataOptions<
|
|
796
|
+
Awaited<ReturnType<typeof getAllJobExchangeRates>>,
|
|
797
|
+
TError,
|
|
798
|
+
Awaited<ReturnType<typeof getAllJobExchangeRates>>
|
|
799
|
+
>,
|
|
800
|
+
"initialData"
|
|
801
|
+
>;
|
|
802
|
+
request?: SecondParameter<typeof customInstance>;
|
|
803
|
+
},
|
|
804
|
+
queryClient?: QueryClient,
|
|
805
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
806
|
+
export function useGetAllJobExchangeRates<
|
|
807
|
+
TData = Awaited<ReturnType<typeof getAllJobExchangeRates>>,
|
|
808
|
+
TError = ErrorType<void | DmError>,
|
|
809
|
+
>(
|
|
810
|
+
params?: GetAllJobExchangeRatesParams,
|
|
811
|
+
options?: {
|
|
812
|
+
query?: Partial<
|
|
813
|
+
UseQueryOptions<Awaited<ReturnType<typeof getAllJobExchangeRates>>, TError, TData>
|
|
814
|
+
>;
|
|
815
|
+
request?: SecondParameter<typeof customInstance>;
|
|
816
|
+
},
|
|
817
|
+
queryClient?: QueryClient,
|
|
818
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
819
|
+
/**
|
|
820
|
+
* @summary Gets Exchange Rates for all Jobs
|
|
821
|
+
*/
|
|
822
|
+
|
|
823
|
+
export function useGetAllJobExchangeRates<
|
|
824
|
+
TData = Awaited<ReturnType<typeof getAllJobExchangeRates>>,
|
|
825
|
+
TError = ErrorType<void | DmError>,
|
|
826
|
+
>(
|
|
827
|
+
params?: GetAllJobExchangeRatesParams,
|
|
828
|
+
options?: {
|
|
829
|
+
query?: Partial<
|
|
830
|
+
UseQueryOptions<Awaited<ReturnType<typeof getAllJobExchangeRates>>, TError, TData>
|
|
831
|
+
>;
|
|
832
|
+
request?: SecondParameter<typeof customInstance>;
|
|
833
|
+
},
|
|
834
|
+
queryClient?: QueryClient,
|
|
835
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
836
|
+
const queryOptions = useGetAllJobExchangeRatesQueryOptions(params, options);
|
|
837
|
+
|
|
838
|
+
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
|
|
839
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
840
|
+
};
|
|
841
|
+
|
|
842
|
+
query.queryKey = queryOptions.queryKey;
|
|
843
|
+
|
|
844
|
+
return query;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
export const useGetAllJobExchangeRatesSuspenseQueryOptions = <
|
|
848
|
+
TData = Awaited<ReturnType<typeof getAllJobExchangeRates>>,
|
|
849
|
+
TError = ErrorType<void | DmError>,
|
|
850
|
+
>(
|
|
851
|
+
params?: GetAllJobExchangeRatesParams,
|
|
852
|
+
options?: {
|
|
853
|
+
query?: Partial<
|
|
854
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getAllJobExchangeRates>>, TError, TData>
|
|
855
|
+
>;
|
|
856
|
+
request?: SecondParameter<typeof customInstance>;
|
|
857
|
+
},
|
|
858
|
+
) => {
|
|
859
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
860
|
+
|
|
861
|
+
const queryKey = queryOptions?.queryKey ?? getGetAllJobExchangeRatesQueryKey(params);
|
|
862
|
+
|
|
863
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getAllJobExchangeRates>>> = ({ signal }) =>
|
|
864
|
+
getAllJobExchangeRates(params, requestOptions, signal);
|
|
865
|
+
|
|
866
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
867
|
+
|
|
868
|
+
return customOptions as UseSuspenseQueryOptions<
|
|
869
|
+
Awaited<ReturnType<typeof getAllJobExchangeRates>>,
|
|
870
|
+
TError,
|
|
871
|
+
TData
|
|
872
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
873
|
+
};
|
|
874
|
+
|
|
875
|
+
export type GetAllJobExchangeRatesSuspenseQueryResult = NonNullable<
|
|
876
|
+
Awaited<ReturnType<typeof getAllJobExchangeRates>>
|
|
877
|
+
>;
|
|
878
|
+
export type GetAllJobExchangeRatesSuspenseQueryError = ErrorType<void | DmError>;
|
|
879
|
+
|
|
880
|
+
export function useGetAllJobExchangeRatesSuspense<
|
|
881
|
+
TData = Awaited<ReturnType<typeof getAllJobExchangeRates>>,
|
|
882
|
+
TError = ErrorType<void | DmError>,
|
|
883
|
+
>(
|
|
884
|
+
params: undefined | GetAllJobExchangeRatesParams,
|
|
885
|
+
options: {
|
|
886
|
+
query: Partial<
|
|
887
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getAllJobExchangeRates>>, TError, TData>
|
|
888
|
+
>;
|
|
889
|
+
request?: SecondParameter<typeof customInstance>;
|
|
890
|
+
},
|
|
891
|
+
queryClient?: QueryClient,
|
|
892
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
893
|
+
export function useGetAllJobExchangeRatesSuspense<
|
|
894
|
+
TData = Awaited<ReturnType<typeof getAllJobExchangeRates>>,
|
|
895
|
+
TError = ErrorType<void | DmError>,
|
|
896
|
+
>(
|
|
897
|
+
params?: GetAllJobExchangeRatesParams,
|
|
898
|
+
options?: {
|
|
899
|
+
query?: Partial<
|
|
900
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getAllJobExchangeRates>>, TError, TData>
|
|
901
|
+
>;
|
|
902
|
+
request?: SecondParameter<typeof customInstance>;
|
|
903
|
+
},
|
|
904
|
+
queryClient?: QueryClient,
|
|
905
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
906
|
+
export function useGetAllJobExchangeRatesSuspense<
|
|
907
|
+
TData = Awaited<ReturnType<typeof getAllJobExchangeRates>>,
|
|
908
|
+
TError = ErrorType<void | DmError>,
|
|
909
|
+
>(
|
|
910
|
+
params?: GetAllJobExchangeRatesParams,
|
|
911
|
+
options?: {
|
|
912
|
+
query?: Partial<
|
|
913
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getAllJobExchangeRates>>, TError, TData>
|
|
914
|
+
>;
|
|
915
|
+
request?: SecondParameter<typeof customInstance>;
|
|
916
|
+
},
|
|
917
|
+
queryClient?: QueryClient,
|
|
918
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
919
|
+
/**
|
|
920
|
+
* @summary Gets Exchange Rates for all Jobs
|
|
921
|
+
*/
|
|
922
|
+
|
|
923
|
+
export function useGetAllJobExchangeRatesSuspense<
|
|
924
|
+
TData = Awaited<ReturnType<typeof getAllJobExchangeRates>>,
|
|
925
|
+
TError = ErrorType<void | DmError>,
|
|
926
|
+
>(
|
|
927
|
+
params?: GetAllJobExchangeRatesParams,
|
|
928
|
+
options?: {
|
|
929
|
+
query?: Partial<
|
|
930
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getAllJobExchangeRates>>, TError, TData>
|
|
931
|
+
>;
|
|
932
|
+
request?: SecondParameter<typeof customInstance>;
|
|
933
|
+
},
|
|
934
|
+
queryClient?: QueryClient,
|
|
935
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
936
|
+
const queryOptions = useGetAllJobExchangeRatesSuspenseQueryOptions(params, options);
|
|
937
|
+
|
|
938
|
+
const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
|
|
939
|
+
TData,
|
|
940
|
+
TError
|
|
941
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
942
|
+
|
|
943
|
+
query.queryKey = queryOptions.queryKey;
|
|
944
|
+
|
|
945
|
+
return query;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
/**
|
|
949
|
+
* Sets the Exchange Rate for a specific job. The rate replaces any existing rate for the Job and applies immediately and future job executions for this Job will inherit this rate.
|
|
950
|
+
|
|
951
|
+
Exchange rates are divided by an internal **scale factor** prior to being applied. The scale factor has a value of 1,000. The scale factor is used to make the exchange rates a little easier to digest, because without this on some jobs we would need to support values ike '0.00001'. With a scale factor of `1,000` the exchange rate is a much more humanly-digestible, e.g. '0.00001' becomes '0.01'.
|
|
952
|
+
|
|
953
|
+
If a Job has no specific rate it adopts the current value of the default Job Exchange Rate.
|
|
954
|
+
|
|
955
|
+
You need `admin` privilege to use this method.
|
|
956
|
+
|
|
957
|
+
* @summary Sets the Exchange Rate for a specific Job
|
|
958
|
+
*/
|
|
959
|
+
export const setJobPricing = (
|
|
960
|
+
jobId: number,
|
|
961
|
+
exchangeRatePutBodyBody: ExchangeRatePutBodyBody,
|
|
962
|
+
options?: SecondParameter<typeof customInstance>,
|
|
963
|
+
) => {
|
|
964
|
+
const formUrlEncoded = new URLSearchParams();
|
|
965
|
+
formUrlEncoded.append(`rate`, exchangeRatePutBodyBody.rate);
|
|
966
|
+
if (exchangeRatePutBodyBody.comment !== undefined) {
|
|
967
|
+
formUrlEncoded.append(`comment`, exchangeRatePutBodyBody.comment);
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
return customInstance<void>(
|
|
971
|
+
{
|
|
972
|
+
url: `/job/${jobId}/exchange-rate`,
|
|
973
|
+
method: "PUT",
|
|
974
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
975
|
+
data: formUrlEncoded,
|
|
976
|
+
},
|
|
977
|
+
options,
|
|
978
|
+
);
|
|
979
|
+
};
|
|
980
|
+
|
|
981
|
+
export const useSetJobPricingMutationOptions = <
|
|
982
|
+
TError = ErrorType<void | DmError>,
|
|
983
|
+
TContext = unknown,
|
|
984
|
+
>(options?: {
|
|
985
|
+
mutation?: UseMutationOptions<
|
|
986
|
+
Awaited<ReturnType<typeof setJobPricing>>,
|
|
987
|
+
TError,
|
|
988
|
+
{ jobId: number; data: ExchangeRatePutBodyBody },
|
|
989
|
+
TContext
|
|
990
|
+
>;
|
|
991
|
+
request?: SecondParameter<typeof customInstance>;
|
|
992
|
+
}): UseMutationOptions<
|
|
993
|
+
Awaited<ReturnType<typeof setJobPricing>>,
|
|
994
|
+
TError,
|
|
995
|
+
{ jobId: number; data: ExchangeRatePutBodyBody },
|
|
996
|
+
TContext
|
|
997
|
+
> => {
|
|
998
|
+
const mutationKey = ["setJobPricing"];
|
|
999
|
+
const { mutation: mutationOptions, request: requestOptions } = options
|
|
1000
|
+
? options.mutation && "mutationKey" in options.mutation && options.mutation.mutationKey
|
|
1001
|
+
? options
|
|
1002
|
+
: { ...options, mutation: { ...options.mutation, mutationKey } }
|
|
1003
|
+
: { mutation: { mutationKey }, request: undefined };
|
|
1004
|
+
|
|
1005
|
+
const mutationFn: MutationFunction<
|
|
1006
|
+
Awaited<ReturnType<typeof setJobPricing>>,
|
|
1007
|
+
{ jobId: number; data: ExchangeRatePutBodyBody }
|
|
1008
|
+
> = (props) => {
|
|
1009
|
+
const { jobId, data } = props ?? {};
|
|
1010
|
+
|
|
1011
|
+
return setJobPricing(jobId, data, requestOptions);
|
|
1012
|
+
};
|
|
1013
|
+
|
|
1014
|
+
const customOptions = mutationMutator({ ...mutationOptions, mutationFn });
|
|
1015
|
+
|
|
1016
|
+
return customOptions;
|
|
1017
|
+
};
|
|
1018
|
+
|
|
1019
|
+
export type SetJobPricingMutationResult = NonNullable<Awaited<ReturnType<typeof setJobPricing>>>;
|
|
1020
|
+
export type SetJobPricingMutationBody = ExchangeRatePutBodyBody;
|
|
1021
|
+
export type SetJobPricingMutationError = ErrorType<void | DmError>;
|
|
1022
|
+
|
|
1023
|
+
/**
|
|
1024
|
+
* @summary Sets the Exchange Rate for a specific Job
|
|
1025
|
+
*/
|
|
1026
|
+
export const useSetJobPricing = <TError = ErrorType<void | DmError>, TContext = unknown>(
|
|
1027
|
+
options?: {
|
|
1028
|
+
mutation?: UseMutationOptions<
|
|
1029
|
+
Awaited<ReturnType<typeof setJobPricing>>,
|
|
1030
|
+
TError,
|
|
1031
|
+
{ jobId: number; data: ExchangeRatePutBodyBody },
|
|
1032
|
+
TContext
|
|
1033
|
+
>;
|
|
1034
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1035
|
+
},
|
|
1036
|
+
queryClient?: QueryClient,
|
|
1037
|
+
): UseMutationResult<
|
|
1038
|
+
Awaited<ReturnType<typeof setJobPricing>>,
|
|
1039
|
+
TError,
|
|
1040
|
+
{ jobId: number; data: ExchangeRatePutBodyBody },
|
|
1041
|
+
TContext
|
|
1042
|
+
> => {
|
|
1043
|
+
const mutationOptions = useSetJobPricingMutationOptions(options);
|
|
1044
|
+
|
|
1045
|
+
return useMutation(mutationOptions, queryClient);
|
|
1046
|
+
};
|
|
1047
|
+
/**
|
|
1048
|
+
* Gets all the exchange rate history for a specific Job. Rates are returned in reverse chronological order, with the most recent rate, the current rate, as the first entry in the list.
|
|
1049
|
+
|
|
1050
|
+
* @summary Gets Job Exchange Rates
|
|
1051
|
+
*/
|
|
1052
|
+
export const getJobExchangeRates = (
|
|
1053
|
+
jobId: number,
|
|
1054
|
+
params?: GetJobExchangeRatesParams,
|
|
1055
|
+
options?: SecondParameter<typeof customInstance>,
|
|
1056
|
+
signal?: AbortSignal,
|
|
1057
|
+
) => {
|
|
1058
|
+
return customInstance<GetExchangeRatesResponse>(
|
|
1059
|
+
{ url: `/job/${jobId}/exchange-rate`, method: "GET", params, signal },
|
|
1060
|
+
options,
|
|
1061
|
+
);
|
|
1062
|
+
};
|
|
1063
|
+
|
|
1064
|
+
export const getGetJobExchangeRatesQueryKey = (
|
|
1065
|
+
jobId: number,
|
|
1066
|
+
params?: GetJobExchangeRatesParams,
|
|
1067
|
+
) => {
|
|
1068
|
+
return [`/job/${jobId}/exchange-rate`, ...(params ? [params] : [])] as const;
|
|
1069
|
+
};
|
|
1070
|
+
|
|
1071
|
+
export const useGetJobExchangeRatesQueryOptions = <
|
|
1072
|
+
TData = Awaited<ReturnType<typeof getJobExchangeRates>>,
|
|
1073
|
+
TError = ErrorType<void | DmError>,
|
|
1074
|
+
>(
|
|
1075
|
+
jobId: number,
|
|
1076
|
+
params?: GetJobExchangeRatesParams,
|
|
1077
|
+
options?: {
|
|
1078
|
+
query?: Partial<
|
|
1079
|
+
UseQueryOptions<Awaited<ReturnType<typeof getJobExchangeRates>>, TError, TData>
|
|
1080
|
+
>;
|
|
1081
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1082
|
+
},
|
|
1083
|
+
) => {
|
|
1084
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1085
|
+
|
|
1086
|
+
const queryKey = queryOptions?.queryKey ?? getGetJobExchangeRatesQueryKey(jobId, params);
|
|
1087
|
+
|
|
1088
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getJobExchangeRates>>> = ({ signal }) =>
|
|
1089
|
+
getJobExchangeRates(jobId, params, requestOptions, signal);
|
|
1090
|
+
|
|
1091
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
1092
|
+
|
|
1093
|
+
return customOptions as UseQueryOptions<
|
|
1094
|
+
Awaited<ReturnType<typeof getJobExchangeRates>>,
|
|
1095
|
+
TError,
|
|
1096
|
+
TData
|
|
1097
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1098
|
+
};
|
|
1099
|
+
|
|
1100
|
+
export type GetJobExchangeRatesQueryResult = NonNullable<
|
|
1101
|
+
Awaited<ReturnType<typeof getJobExchangeRates>>
|
|
1102
|
+
>;
|
|
1103
|
+
export type GetJobExchangeRatesQueryError = ErrorType<void | DmError>;
|
|
1104
|
+
|
|
1105
|
+
export function useGetJobExchangeRates<
|
|
1106
|
+
TData = Awaited<ReturnType<typeof getJobExchangeRates>>,
|
|
1107
|
+
TError = ErrorType<void | DmError>,
|
|
1108
|
+
>(
|
|
1109
|
+
jobId: number,
|
|
1110
|
+
params: undefined | GetJobExchangeRatesParams,
|
|
1111
|
+
options: {
|
|
1112
|
+
query: Partial<
|
|
1113
|
+
UseQueryOptions<Awaited<ReturnType<typeof getJobExchangeRates>>, TError, TData>
|
|
1114
|
+
> &
|
|
1115
|
+
Pick<
|
|
1116
|
+
DefinedInitialDataOptions<
|
|
1117
|
+
Awaited<ReturnType<typeof getJobExchangeRates>>,
|
|
1118
|
+
TError,
|
|
1119
|
+
Awaited<ReturnType<typeof getJobExchangeRates>>
|
|
1120
|
+
>,
|
|
1121
|
+
"initialData"
|
|
1122
|
+
>;
|
|
1123
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1124
|
+
},
|
|
1125
|
+
queryClient?: QueryClient,
|
|
1126
|
+
): DefinedUseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1127
|
+
export function useGetJobExchangeRates<
|
|
1128
|
+
TData = Awaited<ReturnType<typeof getJobExchangeRates>>,
|
|
1129
|
+
TError = ErrorType<void | DmError>,
|
|
1130
|
+
>(
|
|
1131
|
+
jobId: number,
|
|
1132
|
+
params?: GetJobExchangeRatesParams,
|
|
1133
|
+
options?: {
|
|
1134
|
+
query?: Partial<
|
|
1135
|
+
UseQueryOptions<Awaited<ReturnType<typeof getJobExchangeRates>>, TError, TData>
|
|
1136
|
+
> &
|
|
1137
|
+
Pick<
|
|
1138
|
+
UndefinedInitialDataOptions<
|
|
1139
|
+
Awaited<ReturnType<typeof getJobExchangeRates>>,
|
|
1140
|
+
TError,
|
|
1141
|
+
Awaited<ReturnType<typeof getJobExchangeRates>>
|
|
1142
|
+
>,
|
|
1143
|
+
"initialData"
|
|
1144
|
+
>;
|
|
1145
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1146
|
+
},
|
|
1147
|
+
queryClient?: QueryClient,
|
|
1148
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1149
|
+
export function useGetJobExchangeRates<
|
|
1150
|
+
TData = Awaited<ReturnType<typeof getJobExchangeRates>>,
|
|
1151
|
+
TError = ErrorType<void | DmError>,
|
|
1152
|
+
>(
|
|
1153
|
+
jobId: number,
|
|
1154
|
+
params?: GetJobExchangeRatesParams,
|
|
1155
|
+
options?: {
|
|
1156
|
+
query?: Partial<
|
|
1157
|
+
UseQueryOptions<Awaited<ReturnType<typeof getJobExchangeRates>>, TError, TData>
|
|
1158
|
+
>;
|
|
1159
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1160
|
+
},
|
|
1161
|
+
queryClient?: QueryClient,
|
|
1162
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1163
|
+
/**
|
|
1164
|
+
* @summary Gets Job Exchange Rates
|
|
1165
|
+
*/
|
|
1166
|
+
|
|
1167
|
+
export function useGetJobExchangeRates<
|
|
1168
|
+
TData = Awaited<ReturnType<typeof getJobExchangeRates>>,
|
|
1169
|
+
TError = ErrorType<void | DmError>,
|
|
1170
|
+
>(
|
|
1171
|
+
jobId: number,
|
|
1172
|
+
params?: GetJobExchangeRatesParams,
|
|
1173
|
+
options?: {
|
|
1174
|
+
query?: Partial<
|
|
1175
|
+
UseQueryOptions<Awaited<ReturnType<typeof getJobExchangeRates>>, TError, TData>
|
|
1176
|
+
>;
|
|
1177
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1178
|
+
},
|
|
1179
|
+
queryClient?: QueryClient,
|
|
1180
|
+
): UseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
1181
|
+
const queryOptions = useGetJobExchangeRatesQueryOptions(jobId, params, options);
|
|
1182
|
+
|
|
1183
|
+
const query = useQuery(queryOptions, queryClient) as UseQueryResult<TData, TError> & {
|
|
1184
|
+
queryKey: DataTag<QueryKey, TData, TError>;
|
|
1185
|
+
};
|
|
1186
|
+
|
|
1187
|
+
query.queryKey = queryOptions.queryKey;
|
|
1188
|
+
|
|
1189
|
+
return query;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
export const useGetJobExchangeRatesSuspenseQueryOptions = <
|
|
1193
|
+
TData = Awaited<ReturnType<typeof getJobExchangeRates>>,
|
|
1194
|
+
TError = ErrorType<void | DmError>,
|
|
1195
|
+
>(
|
|
1196
|
+
jobId: number,
|
|
1197
|
+
params?: GetJobExchangeRatesParams,
|
|
1198
|
+
options?: {
|
|
1199
|
+
query?: Partial<
|
|
1200
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getJobExchangeRates>>, TError, TData>
|
|
1201
|
+
>;
|
|
1202
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1203
|
+
},
|
|
1204
|
+
) => {
|
|
1205
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
1206
|
+
|
|
1207
|
+
const queryKey = queryOptions?.queryKey ?? getGetJobExchangeRatesQueryKey(jobId, params);
|
|
1208
|
+
|
|
1209
|
+
const queryFn: QueryFunction<Awaited<ReturnType<typeof getJobExchangeRates>>> = ({ signal }) =>
|
|
1210
|
+
getJobExchangeRates(jobId, params, requestOptions, signal);
|
|
1211
|
+
|
|
1212
|
+
const customOptions = queryMutator({ ...queryOptions, queryKey, queryFn });
|
|
1213
|
+
|
|
1214
|
+
return customOptions as UseSuspenseQueryOptions<
|
|
1215
|
+
Awaited<ReturnType<typeof getJobExchangeRates>>,
|
|
1216
|
+
TError,
|
|
1217
|
+
TData
|
|
1218
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1219
|
+
};
|
|
1220
|
+
|
|
1221
|
+
export type GetJobExchangeRatesSuspenseQueryResult = NonNullable<
|
|
1222
|
+
Awaited<ReturnType<typeof getJobExchangeRates>>
|
|
1223
|
+
>;
|
|
1224
|
+
export type GetJobExchangeRatesSuspenseQueryError = ErrorType<void | DmError>;
|
|
1225
|
+
|
|
1226
|
+
export function useGetJobExchangeRatesSuspense<
|
|
1227
|
+
TData = Awaited<ReturnType<typeof getJobExchangeRates>>,
|
|
1228
|
+
TError = ErrorType<void | DmError>,
|
|
1229
|
+
>(
|
|
1230
|
+
jobId: number,
|
|
1231
|
+
params: undefined | GetJobExchangeRatesParams,
|
|
1232
|
+
options: {
|
|
1233
|
+
query: Partial<
|
|
1234
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getJobExchangeRates>>, TError, TData>
|
|
1235
|
+
>;
|
|
1236
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1237
|
+
},
|
|
1238
|
+
queryClient?: QueryClient,
|
|
1239
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1240
|
+
export function useGetJobExchangeRatesSuspense<
|
|
1241
|
+
TData = Awaited<ReturnType<typeof getJobExchangeRates>>,
|
|
1242
|
+
TError = ErrorType<void | DmError>,
|
|
1243
|
+
>(
|
|
1244
|
+
jobId: number,
|
|
1245
|
+
params?: GetJobExchangeRatesParams,
|
|
1246
|
+
options?: {
|
|
1247
|
+
query?: Partial<
|
|
1248
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getJobExchangeRates>>, TError, TData>
|
|
1249
|
+
>;
|
|
1250
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1251
|
+
},
|
|
1252
|
+
queryClient?: QueryClient,
|
|
1253
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1254
|
+
export function useGetJobExchangeRatesSuspense<
|
|
1255
|
+
TData = Awaited<ReturnType<typeof getJobExchangeRates>>,
|
|
1256
|
+
TError = ErrorType<void | DmError>,
|
|
1257
|
+
>(
|
|
1258
|
+
jobId: number,
|
|
1259
|
+
params?: GetJobExchangeRatesParams,
|
|
1260
|
+
options?: {
|
|
1261
|
+
query?: Partial<
|
|
1262
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getJobExchangeRates>>, TError, TData>
|
|
1263
|
+
>;
|
|
1264
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1265
|
+
},
|
|
1266
|
+
queryClient?: QueryClient,
|
|
1267
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1268
|
+
/**
|
|
1269
|
+
* @summary Gets Job Exchange Rates
|
|
1270
|
+
*/
|
|
1271
|
+
|
|
1272
|
+
export function useGetJobExchangeRatesSuspense<
|
|
1273
|
+
TData = Awaited<ReturnType<typeof getJobExchangeRates>>,
|
|
1274
|
+
TError = ErrorType<void | DmError>,
|
|
1275
|
+
>(
|
|
1276
|
+
jobId: number,
|
|
1277
|
+
params?: GetJobExchangeRatesParams,
|
|
1278
|
+
options?: {
|
|
1279
|
+
query?: Partial<
|
|
1280
|
+
UseSuspenseQueryOptions<Awaited<ReturnType<typeof getJobExchangeRates>>, TError, TData>
|
|
1281
|
+
>;
|
|
1282
|
+
request?: SecondParameter<typeof customInstance>;
|
|
1283
|
+
},
|
|
1284
|
+
queryClient?: QueryClient,
|
|
1285
|
+
): UseSuspenseQueryResult<TData, TError> & { queryKey: DataTag<QueryKey, TData, TError> } {
|
|
1286
|
+
const queryOptions = useGetJobExchangeRatesSuspenseQueryOptions(jobId, params, options);
|
|
1287
|
+
|
|
1288
|
+
const query = useSuspenseQuery(queryOptions, queryClient) as UseSuspenseQueryResult<
|
|
1289
|
+
TData,
|
|
1290
|
+
TError
|
|
1291
|
+
> & { queryKey: DataTag<QueryKey, TData, TError> };
|
|
1292
|
+
|
|
1293
|
+
query.queryKey = queryOptions.queryKey;
|
|
1294
|
+
|
|
1295
|
+
return query;
|
|
1296
|
+
}
|
package/src/metadata/metadata.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
A service that allows *registered* users to make **Datasets** and associated **Metadata** available to **Applications**, **Jobs**, and **Workflows** using **Projects** and **Files**.
|
|
8
8
|
|
|
9
|
-
* OpenAPI spec version:
|
|
9
|
+
* OpenAPI spec version: 5.0
|
|
10
10
|
*/
|
|
11
11
|
import { useMutation, useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
12
12
|
import type {
|
|
@@ -31,7 +31,7 @@ import type {
|
|
|
31
31
|
DatasetMetaPostBodyBody,
|
|
32
32
|
DatasetVersionMetaPostBodyBody,
|
|
33
33
|
DmError,
|
|
34
|
-
} from "../
|
|
34
|
+
} from "../API_TARGET_NAME.schemas";
|
|
35
35
|
|
|
36
36
|
import { customInstance } from ".././custom-instance";
|
|
37
37
|
import type { ErrorType } from ".././custom-instance";
|
package/src/options-mutator.ts
CHANGED
|
@@ -4,7 +4,7 @@ export const queryMutator = <TQueryFnData, TError, TData>({
|
|
|
4
4
|
queryKey,
|
|
5
5
|
...queryOptions
|
|
6
6
|
}: UseQueryOptions<TQueryFnData, TError, TData>): UseQueryOptions<TQueryFnData, TError, TData> => {
|
|
7
|
-
const newQueryKey = ["
|
|
7
|
+
const newQueryKey = ["API_TARGET_NAME", ...queryKey];
|
|
8
8
|
return { queryKey: newQueryKey, ...queryOptions };
|
|
9
9
|
};
|
|
10
10
|
|
|
@@ -18,7 +18,7 @@ export const mutationMutator = <TData, TError, TVariables, TContext>({
|
|
|
18
18
|
TContext
|
|
19
19
|
> => {
|
|
20
20
|
if (Array.isArray(mutationKey)) {
|
|
21
|
-
const newMutationKey = ["
|
|
21
|
+
const newMutationKey = ["API_TARGET_NAME", ...mutationKey];
|
|
22
22
|
return { mutationKey: newMutationKey, ...mutationOptions };
|
|
23
23
|
}
|
|
24
24
|
return { mutationKey: undefined, ...mutationOptions };
|