@squonk/data-manager-client 0.7.10 → 0.7.11-rc.3
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 +10 -8
- package/accounting/accounting.cjs.map +1 -1
- package/accounting/accounting.d.ts +9 -8
- package/accounting/accounting.js +10 -8
- package/accounting/accounting.js.map +1 -1
- package/admin/admin.cjs +17 -17
- package/admin/admin.cjs.map +1 -1
- package/admin/admin.d.ts +13 -12
- package/admin/admin.js +17 -17
- package/admin/admin.js.map +1 -1
- package/application/application.cjs +12 -8
- package/application/application.cjs.map +1 -1
- package/application/application.d.ts +9 -8
- package/application/application.js +12 -8
- package/application/application.js.map +1 -1
- package/{custom-instance-6e6b0801.d.ts → custom-instance-da4fff1f.d.ts} +144 -116
- package/dataset/dataset.cjs +42 -30
- package/dataset/dataset.cjs.map +1 -1
- package/dataset/dataset.d.ts +19 -18
- package/dataset/dataset.js +42 -30
- package/dataset/dataset.js.map +1 -1
- package/file/file.cjs +18 -14
- package/file/file.cjs.map +1 -1
- package/file/file.d.ts +11 -10
- package/file/file.js +18 -14
- package/file/file.js.map +1 -1
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -1
- package/index.js.map +1 -1
- package/instance/instance.cjs +35 -15
- package/instance/instance.cjs.map +1 -1
- package/instance/instance.d.ts +33 -10
- package/instance/instance.js +34 -14
- package/instance/instance.js.map +1 -1
- package/job/job.cjs +12 -8
- package/job/job.cjs.map +1 -1
- package/job/job.d.ts +9 -8
- package/job/job.js +12 -8
- package/job/job.js.map +1 -1
- package/metadata/metadata.cjs +18 -12
- package/metadata/metadata.cjs.map +1 -1
- package/metadata/metadata.d.ts +10 -9
- package/metadata/metadata.js +18 -12
- package/metadata/metadata.js.map +1 -1
- package/package.json +9 -9
- package/project/project.cjs +52 -25
- package/project/project.cjs.map +1 -1
- package/project/project.d.ts +35 -15
- package/project/project.js +51 -24
- package/project/project.js.map +1 -1
- package/src/accounting/accounting.ts +29 -25
- package/src/admin/admin.ts +55 -57
- package/src/application/application.ts +30 -29
- package/src/data-manager-api.schemas.ts +178 -180
- package/src/dataset/dataset.ts +113 -90
- package/src/file/file.ts +54 -47
- package/src/instance/instance.ts +118 -51
- package/src/job/job.ts +30 -25
- package/src/metadata/metadata.ts +50 -41
- package/src/project/project.ts +163 -78
- package/src/task/task.ts +40 -31
- package/src/type/type.ts +23 -20
- package/src/user/user.ts +55 -48
- package/task/task.cjs +14 -10
- package/task/task.cjs.map +1 -1
- package/task/task.d.ts +9 -8
- package/task/task.js +14 -10
- package/task/task.js.map +1 -1
- package/type/type.cjs +6 -4
- package/type/type.cjs.map +1 -1
- package/type/type.d.ts +7 -6
- package/type/type.js +6 -4
- package/type/type.js.map +1 -1
- package/user/user.cjs +20 -14
- package/user/user.cjs.map +1 -1
- package/user/user.d.ts +11 -10
- package/user/user.js +20 -14
- package/user/user.js.map +1 -1
package/instance/instance.cjs
CHANGED
|
@@ -20,6 +20,9 @@ var createInstance = (instancePostBodyBody, options) => {
|
|
|
20
20
|
if (instancePostBodyBody.callback_context !== void 0) {
|
|
21
21
|
formData.append("callback_context", instancePostBodyBody.callback_context);
|
|
22
22
|
}
|
|
23
|
+
if (instancePostBodyBody.generate_callback_token !== void 0) {
|
|
24
|
+
formData.append("generate_callback_token", instancePostBodyBody.generate_callback_token.toString());
|
|
25
|
+
}
|
|
23
26
|
if (instancePostBodyBody.debug !== void 0) {
|
|
24
27
|
formData.append("debug", instancePostBodyBody.debug);
|
|
25
28
|
}
|
|
@@ -34,39 +37,43 @@ var createInstance = (instancePostBodyBody, options) => {
|
|
|
34
37
|
}, options);
|
|
35
38
|
};
|
|
36
39
|
var useCreateInstance = (options) => {
|
|
37
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
40
|
+
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
38
41
|
const mutationFn = (props) => {
|
|
39
|
-
const { data } = props
|
|
42
|
+
const { data } = _nullishCoalesce(props, () => ( {}));
|
|
40
43
|
return createInstance(data, requestOptions);
|
|
41
44
|
};
|
|
42
45
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
43
46
|
};
|
|
44
|
-
var getInstances = (params, options) => {
|
|
45
|
-
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/instance`, method: "get", params }, options);
|
|
47
|
+
var getInstances = (params, options, signal) => {
|
|
48
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/instance`, method: "get", signal, params }, options);
|
|
46
49
|
};
|
|
47
50
|
var getGetInstancesQueryKey = (params) => [
|
|
48
51
|
`/instance`,
|
|
49
52
|
...params ? [params] : []
|
|
50
53
|
];
|
|
51
54
|
var useGetInstances = (params, options) => {
|
|
52
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
55
|
+
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
53
56
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetInstancesQueryKey(params)));
|
|
54
|
-
const queryFn = (
|
|
57
|
+
const queryFn = ({
|
|
58
|
+
signal
|
|
59
|
+
}) => getInstances(params, requestOptions, signal);
|
|
55
60
|
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
|
|
56
61
|
return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
|
|
57
62
|
queryKey
|
|
58
63
|
}, query);
|
|
59
64
|
};
|
|
60
|
-
var getInstance = (instanceId, options) => {
|
|
61
|
-
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/instance/${instanceId}`, method: "get" }, options);
|
|
65
|
+
var getInstance = (instanceId, options, signal) => {
|
|
66
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/instance/${instanceId}`, method: "get", signal }, options);
|
|
62
67
|
};
|
|
63
68
|
var getGetInstanceQueryKey = (instanceId) => [
|
|
64
69
|
`/instance/${instanceId}`
|
|
65
70
|
];
|
|
66
71
|
var useGetInstance = (instanceId, options) => {
|
|
67
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
72
|
+
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
68
73
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetInstanceQueryKey(instanceId)));
|
|
69
|
-
const queryFn = (
|
|
74
|
+
const queryFn = ({
|
|
75
|
+
signal
|
|
76
|
+
}) => getInstance(instanceId, requestOptions, signal);
|
|
70
77
|
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkNGBTCJWScjs.__spreadValues.call(void 0, { enabled: !!instanceId }, queryOptions));
|
|
71
78
|
return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
|
|
72
79
|
queryKey
|
|
@@ -76,9 +83,9 @@ var terminateInstance = (instanceId, options) => {
|
|
|
76
83
|
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/instance/${instanceId}`, method: "delete" }, options);
|
|
77
84
|
};
|
|
78
85
|
var useTerminateInstance = (options) => {
|
|
79
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
86
|
+
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
80
87
|
const mutationFn = (props) => {
|
|
81
|
-
const { instanceId } = props
|
|
88
|
+
const { instanceId } = _nullishCoalesce(props, () => ( {}));
|
|
82
89
|
return terminateInstance(instanceId, requestOptions);
|
|
83
90
|
};
|
|
84
91
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
@@ -87,13 +94,26 @@ var patchInstance = (instanceId, params, options) => {
|
|
|
87
94
|
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/instance/${instanceId}`, method: "patch", params }, options);
|
|
88
95
|
};
|
|
89
96
|
var usePatchInstance = (options) => {
|
|
90
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
97
|
+
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
91
98
|
const mutationFn = (props) => {
|
|
92
|
-
const { instanceId, params } = props
|
|
99
|
+
const { instanceId, params } = _nullishCoalesce(props, () => ( {}));
|
|
93
100
|
return patchInstance(instanceId, params, requestOptions);
|
|
94
101
|
};
|
|
95
102
|
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
96
103
|
};
|
|
104
|
+
var deleteInstanceToken = (instanceId, token, options) => {
|
|
105
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/instance/${instanceId}/token/${token}`, method: "delete" }, options);
|
|
106
|
+
};
|
|
107
|
+
var useDeleteInstanceToken = (options) => {
|
|
108
|
+
const { mutation: mutationOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
109
|
+
const mutationFn = (props) => {
|
|
110
|
+
const { instanceId, token } = _nullishCoalesce(props, () => ( {}));
|
|
111
|
+
return deleteInstanceToken(instanceId, token, requestOptions);
|
|
112
|
+
};
|
|
113
|
+
return _reactquery.useMutation.call(void 0, mutationFn, mutationOptions);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
|
|
97
117
|
|
|
98
118
|
|
|
99
119
|
|
|
@@ -107,5 +127,5 @@ var usePatchInstance = (options) => {
|
|
|
107
127
|
|
|
108
128
|
|
|
109
129
|
|
|
110
|
-
exports.createInstance = createInstance; exports.getGetInstanceQueryKey = getGetInstanceQueryKey; exports.getGetInstancesQueryKey = getGetInstancesQueryKey; exports.getInstance = getInstance; exports.getInstances = getInstances; exports.patchInstance = patchInstance; exports.terminateInstance = terminateInstance; exports.useCreateInstance = useCreateInstance; exports.useGetInstance = useGetInstance; exports.useGetInstances = useGetInstances; exports.usePatchInstance = usePatchInstance; exports.useTerminateInstance = useTerminateInstance;
|
|
130
|
+
exports.createInstance = createInstance; exports.deleteInstanceToken = deleteInstanceToken; exports.getGetInstanceQueryKey = getGetInstanceQueryKey; exports.getGetInstancesQueryKey = getGetInstancesQueryKey; exports.getInstance = getInstance; exports.getInstances = getInstances; exports.patchInstance = patchInstance; exports.terminateInstance = terminateInstance; exports.useCreateInstance = useCreateInstance; exports.useDeleteInstanceToken = useDeleteInstanceToken; exports.useGetInstance = useGetInstance; exports.useGetInstances = useGetInstances; exports.usePatchInstance = usePatchInstance; exports.useTerminateInstance = useTerminateInstance;
|
|
111
131
|
//# sourceMappingURL=instance.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/instance/instance.ts"],"names":[],"mappings":";;;;;;AAUA;AAAA;AAAA;AAAA;AAgDO,IAAM,iBAAiB,CAC5B,sBACA,YACG;AACH,QAAM,WAAW,IAAI,SAAS;AAC9B,WAAS,OAAO,kBAAkB,qBAAqB,cAAc;AACrE,WAAS,OACP,uBACA,qBAAqB,mBACvB;AACA,WAAS,OAAO,cAAc,qBAAqB,UAAU;AAC7D,WAAS,OAAO,WAAW,qBAAqB,OAAO;AACvD,MAAI,qBAAqB,iBAAiB,QAAW;AACnD,aAAS,OAAO,gBAAgB,qBAAqB,YAAY;AAAA,EACnE;AACA,MAAI,qBAAqB,qBAAqB,QAAW;AACvD,aAAS,OAAO,oBAAoB,qBAAqB,gBAAgB;AAAA,EAC3E;AACA,MAAI,qBAAqB,UAAU,QAAW;AAC5C,aAAS,OAAO,SAAS,qBAAqB,KAAK;AAAA,EACrD;AACA,MAAI,qBAAqB,kBAAkB,QAAW;AACpD,aAAS,OAAO,iBAAiB,qBAAqB,aAAa;AAAA,EACrE;AAEA,SAAO,eACL;AAAA,IACE,KAAK;AAAA,IACL,QAAQ;AAAA,IACR,SAAS,EAAE,gBAAgB,sBAAsB;AAAA,IACjD,MAAM;AAAA,EACR,GACA,OACF;AACF;AAQO,IAAM,oBAAoB,CAG/B,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,SAAS,SAAS,CAAC;AAE3B,WAAO,eAAe,MAAM,c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AE,eAAe,SAAS,CAAC;AAEjC,WAAO,kBAAkB,YAAY,cAAc;AAAA,EACrD;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAQO,IAAM,gBAAgB,CAC3B,YACA,QACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,aAAa,cAAc,QAAQ,SAAS,OAAO,GAC1D,OACF;AACF;AAQO,IAAM,mBAAmB,CAG9B,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,YAAY,WAAW,SAAS,CAAC;AAEzC,WAAO,cAAc,YAAY,QAAQ,cAAc;AAAA,EACzD;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B","sourcesContent":["/**\n * Generated by orval v6.7.1 🍺\n * Do not edit manually.\n * Dataset Manager API\n * The Dataset Manager API service.\n\nA service that allows *registered* users to make **Datasets** and associated **Metadata** available to **Applications** and **Jobs** using **Projects** and **Files**.\n\n * OpenAPI spec version: 0.7\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n InstancePostResponse,\n DmError,\n InstancePostBodyBody,\n InstancesGetResponse,\n GetInstancesParams,\n InstanceGetResponse,\n InstanceDeleteResponse,\n PatchInstanceParams,\n} from \"../data-manager-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Launches a new Application or Job instance, returning an Instance and Task ID. The Task ID should be used against the `/task` endpoint to determine the availability of the the running instance.\n\nInstance behaviour is controlled using the `specification`. You will need to consult individual applications to determine what can be placed in the specification. Applications typically provide a `template` describing its **options**.\n\nAn Application instance is not Ready for use until the corresponding **TaskState** is `STARTED`.\n\nA Job instance typically runs to completion, reahcing the **TaskState** `SUCCESS` when successful and `FAILURE` is unsuccessul.\n\n * @summary Creates a new application instance\n */\nexport const createInstance = (\n instancePostBodyBody: InstancePostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n formData.append(\"application_id\", instancePostBodyBody.application_id);\n formData.append(\n \"application_version\",\n instancePostBodyBody.application_version\n );\n formData.append(\"project_id\", instancePostBodyBody.project_id);\n formData.append(\"as_name\", instancePostBodyBody.as_name);\n if (instancePostBodyBody.callback_url !== undefined) {\n formData.append(\"callback_url\", instancePostBodyBody.callback_url);\n }\n if (instancePostBodyBody.callback_context !== undefined) {\n formData.append(\"callback_context\", instancePostBodyBody.callback_context);\n }\n if (instancePostBodyBody.debug !== undefined) {\n formData.append(\"debug\", instancePostBodyBody.debug);\n }\n if (instancePostBodyBody.specification !== undefined) {\n formData.append(\"specification\", instancePostBodyBody.specification);\n }\n\n return customInstance<InstancePostResponse>(\n {\n url: `/instance`,\n method: \"post\",\n headers: { \"Content-Type\": \"multipart/form-data\" },\n data: formData,\n },\n options\n );\n};\n\nexport type CreateInstanceMutationResult = NonNullable<\n AsyncReturnType<typeof createInstance>\n>;\nexport type CreateInstanceMutationBody = InstancePostBodyBody;\nexport type CreateInstanceMutationError = ErrorType<void | DmError>;\n\nexport const useCreateInstance = <\n TError = ErrorType<void | DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof createInstance>,\n TError,\n { data: InstancePostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof createInstance>,\n { data: InstancePostBodyBody }\n > = (props) => {\n const { data } = props || {};\n\n return createInstance(data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof createInstance>,\n TError,\n { data: InstancePostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Returns a summary of all running instances. Insatnces can be running as an Application or as a Job. The response will contain an `application_type` field that is either `job` or `application`\n\n * @summary Get summary information about all application instances\n */\nexport const getInstances = (\n params?: GetInstancesParams,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<InstancesGetResponse>(\n { url: `/instance`, method: \"get\", params },\n options\n );\n};\n\nexport const getGetInstancesQueryKey = (params?: GetInstancesParams) => [\n `/instance`,\n ...(params ? [params] : []),\n];\n\nexport type GetInstancesQueryResult = NonNullable<\n AsyncReturnType<typeof getInstances>\n>;\nexport type GetInstancesQueryError = ErrorType<void | DmError>;\n\nexport const useGetInstances = <\n TData = AsyncReturnType<typeof getInstances>,\n TError = ErrorType<void | DmError>\n>(\n params?: GetInstancesParams,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getInstances>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetInstancesQueryKey(params);\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getInstances>> = () =>\n getInstances(params, requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getInstances>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * The instance information will be returned if available.\n\n * @summary Get detailed information about a specific instance\n */\nexport const getInstance = (\n instanceId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<InstanceGetResponse>(\n { url: `/instance/${instanceId}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetInstanceQueryKey = (instanceId: string) => [\n `/instance/${instanceId}`,\n];\n\nexport type GetInstanceQueryResult = NonNullable<\n AsyncReturnType<typeof getInstance>\n>;\nexport type GetInstanceQueryError = ErrorType<void | DmError>;\n\nexport const useGetInstance = <\n TData = AsyncReturnType<typeof getInstance>,\n TError = ErrorType<void | DmError>\n>(\n instanceId: string,\n options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getInstance>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetInstanceQueryKey(instanceId);\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getInstance>> = () =>\n getInstance(instanceId, requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getInstance>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!instanceId, ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * The Application or Job instance is terminated.\n\nYou must be the `owner` or an `editor` of the instance to delete it\n\n * @summary Delete an application instance\n */\nexport const terminateInstance = (\n instanceId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<InstanceDeleteResponse>(\n { url: `/instance/${instanceId}`, method: \"delete\" },\n options\n );\n};\n\nexport type TerminateInstanceMutationResult = NonNullable<\n AsyncReturnType<typeof terminateInstance>\n>;\n\nexport type TerminateInstanceMutationError = ErrorType<void | DmError>;\n\nexport const useTerminateInstance = <\n TError = ErrorType<void | DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof terminateInstance>,\n TError,\n { instanceId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof terminateInstance>,\n { instanceId: string }\n > = (props) => {\n const { instanceId } = props || {};\n\n return terminateInstance(instanceId, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof terminateInstance>,\n TError,\n { instanceId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * The Application or Job instance is updated according to the patch parameters.\n\nYou must be the `owner` or an `editor` of the instance to patch it\n\n * @summary Update an application instance\n */\nexport const patchInstance = (\n instanceId: string,\n params?: PatchInstanceParams,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/instance/${instanceId}`, method: \"patch\", params },\n options\n );\n};\n\nexport type PatchInstanceMutationResult = NonNullable<\n AsyncReturnType<typeof patchInstance>\n>;\n\nexport type PatchInstanceMutationError = ErrorType<DmError>;\n\nexport const usePatchInstance = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof patchInstance>,\n TError,\n { instanceId: string; params?: PatchInstanceParams },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof patchInstance>,\n { instanceId: string; params?: PatchInstanceParams }\n > = (props) => {\n const { instanceId, params } = props || {};\n\n return patchInstance(instanceId, params, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof patchInstance>,\n TError,\n { instanceId: string; params?: PatchInstanceParams },\n TContext\n >(mutationFn, mutationOptions);\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/instance/instance.ts"],"names":[],"mappings":";;;;;;AAUA;AAAA;AAAA;AAAA;AA6CO,IAAM,iBAAiB,CAC5B,sBACA,YACG;AACH,QAAM,WAAW,IAAI,SAAS;AAC9B,WAAS,OAAO,kBAAkB,qBAAqB,cAAc;AACrE,WAAS,OACP,uBACA,qBAAqB,mBACvB;AACA,WAAS,OAAO,cAAc,qBAAqB,UAAU;AAC7D,WAAS,OAAO,WAAW,qBAAqB,OAAO;AACvD,MAAI,qBAAqB,iBAAiB,QAAW;AACnD,aAAS,OAAO,gBAAgB,qBAAqB,YAAY;AAAA,EACnE;AACA,MAAI,qBAAqB,qBAAqB,QAAW;AACvD,aAAS,OAAO,oBAAoB,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ACH,SAAO,eACL,EAAE,KAAK,aAAa,oBAAoB,SAAS,QAAQ,SAAS,GAClE,OACF;AACF;AAQO,IAAM,yBAAyB,CAGpC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,YAAY,UAAU,SAAS,CAAC;AAExC,WAAO,oBAAoB,YAAY,OAAO,cAAc;AAAA,EAC9D;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B","sourcesContent":["/**\n * Generated by orval v6.8.0 🍺\n * Do not edit manually.\n * Dataset Manager API\n * The Dataset Manager API service.\n\nA service that allows *registered* users to make **Datasets** and associated **Metadata** available to **Applications** and **Jobs** using **Projects** and **Files**.\n\n * OpenAPI spec version: 0.7\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n InstancePostResponse,\n DmError,\n InstancePostBodyBody,\n InstancesGetResponse,\n GetInstancesParams,\n InstanceGetResponse,\n InstanceDeleteResponse,\n PatchInstanceParams,\n} from \"../data-manager-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\nexport type AwaitedInput<T> = PromiseLike<T> | T;\n\nexport type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Launches a new Application or Job instance, returning an Instance and Task ID. The Task ID should be used against the `/task` endpoint to determine the availability of the the running instance.\n\nInstance behaviour is controlled using the `specification`. You will need to consult individual applications to determine what can be placed in the specification. Applications typically provide a `template` describing its **options**.\n\nAn Application instance is not Ready for use until the corresponding **TaskState** is `STARTED`.\n\nA Job instance typically runs to completion, reahcing the **TaskState** `SUCCESS` when successful and `FAILURE` is unsuccessul.\n\n * @summary Creates a new application instance\n */\nexport const createInstance = (\n instancePostBodyBody: InstancePostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n formData.append(\"application_id\", instancePostBodyBody.application_id);\n formData.append(\n \"application_version\",\n instancePostBodyBody.application_version\n );\n formData.append(\"project_id\", instancePostBodyBody.project_id);\n formData.append(\"as_name\", instancePostBodyBody.as_name);\n if (instancePostBodyBody.callback_url !== undefined) {\n formData.append(\"callback_url\", instancePostBodyBody.callback_url);\n }\n if (instancePostBodyBody.callback_context !== undefined) {\n formData.append(\"callback_context\", instancePostBodyBody.callback_context);\n }\n if (instancePostBodyBody.generate_callback_token !== undefined) {\n formData.append(\n \"generate_callback_token\",\n instancePostBodyBody.generate_callback_token.toString()\n );\n }\n if (instancePostBodyBody.debug !== undefined) {\n formData.append(\"debug\", instancePostBodyBody.debug);\n }\n if (instancePostBodyBody.specification !== undefined) {\n formData.append(\"specification\", instancePostBodyBody.specification);\n }\n\n return customInstance<InstancePostResponse>(\n {\n url: `/instance`,\n method: \"post\",\n headers: { \"Content-Type\": \"multipart/form-data\" },\n data: formData,\n },\n options\n );\n};\n\nexport type CreateInstanceMutationResult = NonNullable<\n Awaited<ReturnType<typeof createInstance>>\n>;\nexport type CreateInstanceMutationBody = InstancePostBodyBody;\nexport type CreateInstanceMutationError = ErrorType<void | DmError>;\n\nexport const useCreateInstance = <\n TError = ErrorType<void | DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createInstance>>,\n TError,\n { data: InstancePostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createInstance>>,\n { data: InstancePostBodyBody }\n > = (props) => {\n const { data } = props ?? {};\n\n return createInstance(data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof createInstance>>,\n TError,\n { data: InstancePostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Returns a summary of all running instances. Insatnces can be running as an Application or as a Job. The response will contain an `application_type` field that is either `job` or `application`\n\n * @summary Get summary information about all application instances\n */\nexport const getInstances = (\n params?: GetInstancesParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<InstancesGetResponse>(\n { url: `/instance`, method: \"get\", signal, params },\n options\n );\n};\n\nexport const getGetInstancesQueryKey = (params?: GetInstancesParams) => [\n `/instance`,\n ...(params ? [params] : []),\n];\n\nexport type GetInstancesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getInstances>>\n>;\nexport type GetInstancesQueryError = ErrorType<void | DmError>;\n\nexport const useGetInstances = <\n TData = Awaited<ReturnType<typeof getInstances>>,\n TError = ErrorType<void | DmError>\n>(\n params?: GetInstancesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getInstances>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetInstancesQueryKey(params);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getInstances>>> = ({\n signal,\n }) => getInstances(params, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getInstances>>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * The instance information will be returned if available.\n\n * @summary Get detailed information about a specific instance\n */\nexport const getInstance = (\n instanceId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<InstanceGetResponse>(\n { url: `/instance/${instanceId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetInstanceQueryKey = (instanceId: string) => [\n `/instance/${instanceId}`,\n];\n\nexport type GetInstanceQueryResult = NonNullable<\n Awaited<ReturnType<typeof getInstance>>\n>;\nexport type GetInstanceQueryError = ErrorType<void | DmError>;\n\nexport const useGetInstance = <\n TData = Awaited<ReturnType<typeof getInstance>>,\n TError = ErrorType<void | DmError>\n>(\n instanceId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getInstance>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetInstanceQueryKey(instanceId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getInstance>>> = ({\n signal,\n }) => getInstance(instanceId, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getInstance>>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!instanceId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * The Application or Job instance is terminated.\n\nYou must be the `owner` or an `editor` of the instance to delete it\n\n * @summary Delete an application instance\n */\nexport const terminateInstance = (\n instanceId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<InstanceDeleteResponse>(\n { url: `/instance/${instanceId}`, method: \"delete\" },\n options\n );\n};\n\nexport type TerminateInstanceMutationResult = NonNullable<\n Awaited<ReturnType<typeof terminateInstance>>\n>;\n\nexport type TerminateInstanceMutationError = ErrorType<void | DmError>;\n\nexport const useTerminateInstance = <\n TError = ErrorType<void | DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof terminateInstance>>,\n TError,\n { instanceId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof terminateInstance>>,\n { instanceId: string }\n > = (props) => {\n const { instanceId } = props ?? {};\n\n return terminateInstance(instanceId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof terminateInstance>>,\n TError,\n { instanceId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * The Application or Job instance is updated according to the patch parameters.\n\nYou must be the `owner` or an `editor` of the instance to patch it\n\n * @summary Update an application instance\n */\nexport const patchInstance = (\n instanceId: string,\n params?: PatchInstanceParams,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/instance/${instanceId}`, method: \"patch\", params },\n options\n );\n};\n\nexport type PatchInstanceMutationResult = NonNullable<\n Awaited<ReturnType<typeof patchInstance>>\n>;\n\nexport type PatchInstanceMutationError = ErrorType<DmError>;\n\nexport const usePatchInstance = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchInstance>>,\n TError,\n { instanceId: string; params?: PatchInstanceParams },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof patchInstance>>,\n { instanceId: string; params?: PatchInstanceParams }\n > = (props) => {\n const { instanceId, params } = props ?? {};\n\n return patchInstance(instanceId, params, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof patchInstance>>,\n TError,\n { instanceId: string; params?: PatchInstanceParams },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * This revokes the instance **Token**, which was optionally generated when the instance was laucnhed. No authenitcation is required to use this endpoint, whcih is typcially used by a remote system driven by instance callbacks.\n\nTokens automatically expre after a period of time but can be revoked instantly with this endpoint.\n\nThe remote system will revoke the token when it's finished with it\n\n * @summary Delete (revoke) the instance token\n */\nexport const deleteInstanceToken = (\n instanceId: string,\n token: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/instance/${instanceId}/token/${token}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteInstanceTokenMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteInstanceToken>>\n>;\n\nexport type DeleteInstanceTokenMutationError = ErrorType<DmError>;\n\nexport const useDeleteInstanceToken = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteInstanceToken>>,\n TError,\n { instanceId: string; token: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteInstanceToken>>,\n { instanceId: string; token: string }\n > = (props) => {\n const { instanceId, token } = props ?? {};\n\n return deleteInstanceToken(instanceId, token, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteInstanceToken>>,\n TError,\n { instanceId: string; token: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n"]}
|
package/instance/instance.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { N as InstancePostBodyBody, bd as customInstance, aW as InstancePostResponse, be as ErrorType, b9 as DmError, b as GetInstancesParams, aQ as InstancesGetResponse, aT as InstanceGetResponse, a4 as TaskIdentity, P as PatchInstanceParams } from '../custom-instance-da4fff1f.js';
|
|
2
2
|
import * as react_query from 'react-query';
|
|
3
3
|
import { UseMutationOptions, UseQueryOptions, QueryKey, UseQueryResult } from 'react-query';
|
|
4
4
|
import 'axios';
|
|
5
5
|
|
|
6
|
-
declare type
|
|
6
|
+
declare type AwaitedInput<T> = PromiseLike<T> | T;
|
|
7
|
+
declare type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
7
8
|
declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
|
|
8
9
|
/**
|
|
9
10
|
* Launches a new Application or Job instance, returning an Instance and Task ID. The Task ID should be used against the `/task` endpoint to determine the availability of the the running instance.
|
|
@@ -17,7 +18,7 @@ A Job instance typically runs to completion, reahcing the **TaskState** `SUCCESS
|
|
|
17
18
|
* @summary Creates a new application instance
|
|
18
19
|
*/
|
|
19
20
|
declare const createInstance: (instancePostBodyBody: InstancePostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<InstancePostResponse>;
|
|
20
|
-
declare type CreateInstanceMutationResult = NonNullable<
|
|
21
|
+
declare type CreateInstanceMutationResult = NonNullable<Awaited<ReturnType<typeof createInstance>>>;
|
|
21
22
|
declare type CreateInstanceMutationBody = InstancePostBodyBody;
|
|
22
23
|
declare type CreateInstanceMutationError = ErrorType<void | DmError>;
|
|
23
24
|
declare const useCreateInstance: <TError = ErrorType<void | DmError>, TContext = unknown>(options?: {
|
|
@@ -33,9 +34,9 @@ declare const useCreateInstance: <TError = ErrorType<void | DmError>, TContext =
|
|
|
33
34
|
|
|
34
35
|
* @summary Get summary information about all application instances
|
|
35
36
|
*/
|
|
36
|
-
declare const getInstances: (params?: GetInstancesParams | undefined, options?: SecondParameter<typeof customInstance
|
|
37
|
+
declare const getInstances: (params?: GetInstancesParams | undefined, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal | undefined) => Promise<InstancesGetResponse>;
|
|
37
38
|
declare const getGetInstancesQueryKey: (params?: GetInstancesParams | undefined) => (string | GetInstancesParams)[];
|
|
38
|
-
declare type GetInstancesQueryResult = NonNullable<
|
|
39
|
+
declare type GetInstancesQueryResult = NonNullable<Awaited<ReturnType<typeof getInstances>>>;
|
|
39
40
|
declare type GetInstancesQueryError = ErrorType<void | DmError>;
|
|
40
41
|
declare const useGetInstances: <TData = InstancesGetResponse, TError = ErrorType<void | DmError>>(params?: GetInstancesParams | undefined, options?: {
|
|
41
42
|
query?: UseQueryOptions<InstancesGetResponse, TError, TData, QueryKey> | undefined;
|
|
@@ -48,9 +49,9 @@ declare const useGetInstances: <TData = InstancesGetResponse, TError = ErrorType
|
|
|
48
49
|
|
|
49
50
|
* @summary Get detailed information about a specific instance
|
|
50
51
|
*/
|
|
51
|
-
declare const getInstance: (instanceId: string, options?: SecondParameter<typeof customInstance
|
|
52
|
+
declare const getInstance: (instanceId: string, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal | undefined) => Promise<InstanceGetResponse>;
|
|
52
53
|
declare const getGetInstanceQueryKey: (instanceId: string) => string[];
|
|
53
|
-
declare type GetInstanceQueryResult = NonNullable<
|
|
54
|
+
declare type GetInstanceQueryResult = NonNullable<Awaited<ReturnType<typeof getInstance>>>;
|
|
54
55
|
declare type GetInstanceQueryError = ErrorType<void | DmError>;
|
|
55
56
|
declare const useGetInstance: <TData = InstanceGetResponse, TError = ErrorType<void | DmError>>(instanceId: string, options?: {
|
|
56
57
|
query?: UseQueryOptions<InstanceGetResponse, TError, TData, QueryKey> | undefined;
|
|
@@ -66,7 +67,7 @@ You must be the `owner` or an `editor` of the instance to delete it
|
|
|
66
67
|
* @summary Delete an application instance
|
|
67
68
|
*/
|
|
68
69
|
declare const terminateInstance: (instanceId: string, options?: SecondParameter<typeof customInstance>) => Promise<TaskIdentity>;
|
|
69
|
-
declare type TerminateInstanceMutationResult = NonNullable<
|
|
70
|
+
declare type TerminateInstanceMutationResult = NonNullable<Awaited<ReturnType<typeof terminateInstance>>>;
|
|
70
71
|
declare type TerminateInstanceMutationError = ErrorType<void | DmError>;
|
|
71
72
|
declare const useTerminateInstance: <TError = ErrorType<void | DmError>, TContext = unknown>(options?: {
|
|
72
73
|
mutation?: UseMutationOptions<TaskIdentity, TError, {
|
|
@@ -84,7 +85,7 @@ You must be the `owner` or an `editor` of the instance to patch it
|
|
|
84
85
|
* @summary Update an application instance
|
|
85
86
|
*/
|
|
86
87
|
declare const patchInstance: (instanceId: string, params?: PatchInstanceParams | undefined, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
87
|
-
declare type PatchInstanceMutationResult = NonNullable<
|
|
88
|
+
declare type PatchInstanceMutationResult = NonNullable<Awaited<ReturnType<typeof patchInstance>>>;
|
|
88
89
|
declare type PatchInstanceMutationError = ErrorType<DmError>;
|
|
89
90
|
declare const usePatchInstance: <TError = ErrorType<DmError>, TContext = unknown>(options?: {
|
|
90
91
|
mutation?: UseMutationOptions<void, TError, {
|
|
@@ -96,5 +97,27 @@ declare const usePatchInstance: <TError = ErrorType<DmError>, TContext = unknown
|
|
|
96
97
|
instanceId: string;
|
|
97
98
|
params?: PatchInstanceParams | undefined;
|
|
98
99
|
}, TContext>;
|
|
100
|
+
/**
|
|
101
|
+
* This revokes the instance **Token**, which was optionally generated when the instance was laucnhed. No authenitcation is required to use this endpoint, whcih is typcially used by a remote system driven by instance callbacks.
|
|
102
|
+
|
|
103
|
+
Tokens automatically expre after a period of time but can be revoked instantly with this endpoint.
|
|
104
|
+
|
|
105
|
+
The remote system will revoke the token when it's finished with it
|
|
106
|
+
|
|
107
|
+
* @summary Delete (revoke) the instance token
|
|
108
|
+
*/
|
|
109
|
+
declare const deleteInstanceToken: (instanceId: string, token: string, options?: SecondParameter<typeof customInstance>) => Promise<void>;
|
|
110
|
+
declare type DeleteInstanceTokenMutationResult = NonNullable<Awaited<ReturnType<typeof deleteInstanceToken>>>;
|
|
111
|
+
declare type DeleteInstanceTokenMutationError = ErrorType<DmError>;
|
|
112
|
+
declare const useDeleteInstanceToken: <TError = ErrorType<DmError>, TContext = unknown>(options?: {
|
|
113
|
+
mutation?: UseMutationOptions<void, TError, {
|
|
114
|
+
instanceId: string;
|
|
115
|
+
token: string;
|
|
116
|
+
}, TContext> | undefined;
|
|
117
|
+
request?: SecondParameter<typeof customInstance>;
|
|
118
|
+
} | undefined) => react_query.UseMutationResult<void, TError, {
|
|
119
|
+
instanceId: string;
|
|
120
|
+
token: string;
|
|
121
|
+
}, TContext>;
|
|
99
122
|
|
|
100
|
-
export { CreateInstanceMutationBody, CreateInstanceMutationError, CreateInstanceMutationResult, GetInstanceQueryError, GetInstanceQueryResult, GetInstancesQueryError, GetInstancesQueryResult, PatchInstanceMutationError, PatchInstanceMutationResult, TerminateInstanceMutationError, TerminateInstanceMutationResult, createInstance, getGetInstanceQueryKey, getGetInstancesQueryKey, getInstance, getInstances, patchInstance, terminateInstance, useCreateInstance, useGetInstance, useGetInstances, usePatchInstance, useTerminateInstance };
|
|
123
|
+
export { Awaited, AwaitedInput, CreateInstanceMutationBody, CreateInstanceMutationError, CreateInstanceMutationResult, DeleteInstanceTokenMutationError, DeleteInstanceTokenMutationResult, GetInstanceQueryError, GetInstanceQueryResult, GetInstancesQueryError, GetInstancesQueryResult, PatchInstanceMutationError, PatchInstanceMutationResult, TerminateInstanceMutationError, TerminateInstanceMutationResult, createInstance, deleteInstanceToken, getGetInstanceQueryKey, getGetInstancesQueryKey, getInstance, getInstances, patchInstance, terminateInstance, useCreateInstance, useDeleteInstanceToken, useGetInstance, useGetInstances, usePatchInstance, useTerminateInstance };
|
package/instance/instance.js
CHANGED
|
@@ -20,6 +20,9 @@ var createInstance = (instancePostBodyBody, options) => {
|
|
|
20
20
|
if (instancePostBodyBody.callback_context !== void 0) {
|
|
21
21
|
formData.append("callback_context", instancePostBodyBody.callback_context);
|
|
22
22
|
}
|
|
23
|
+
if (instancePostBodyBody.generate_callback_token !== void 0) {
|
|
24
|
+
formData.append("generate_callback_token", instancePostBodyBody.generate_callback_token.toString());
|
|
25
|
+
}
|
|
23
26
|
if (instancePostBodyBody.debug !== void 0) {
|
|
24
27
|
formData.append("debug", instancePostBodyBody.debug);
|
|
25
28
|
}
|
|
@@ -34,39 +37,43 @@ var createInstance = (instancePostBodyBody, options) => {
|
|
|
34
37
|
}, options);
|
|
35
38
|
};
|
|
36
39
|
var useCreateInstance = (options) => {
|
|
37
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
40
|
+
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
38
41
|
const mutationFn = (props) => {
|
|
39
|
-
const { data } = props
|
|
42
|
+
const { data } = props ?? {};
|
|
40
43
|
return createInstance(data, requestOptions);
|
|
41
44
|
};
|
|
42
45
|
return useMutation(mutationFn, mutationOptions);
|
|
43
46
|
};
|
|
44
|
-
var getInstances = (params, options) => {
|
|
45
|
-
return customInstance({ url: `/instance`, method: "get", params }, options);
|
|
47
|
+
var getInstances = (params, options, signal) => {
|
|
48
|
+
return customInstance({ url: `/instance`, method: "get", signal, params }, options);
|
|
46
49
|
};
|
|
47
50
|
var getGetInstancesQueryKey = (params) => [
|
|
48
51
|
`/instance`,
|
|
49
52
|
...params ? [params] : []
|
|
50
53
|
];
|
|
51
54
|
var useGetInstances = (params, options) => {
|
|
52
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
55
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
53
56
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetInstancesQueryKey(params);
|
|
54
|
-
const queryFn = (
|
|
57
|
+
const queryFn = ({
|
|
58
|
+
signal
|
|
59
|
+
}) => getInstances(params, requestOptions, signal);
|
|
55
60
|
const query = useQuery(queryKey, queryFn, queryOptions);
|
|
56
61
|
return __spreadValues({
|
|
57
62
|
queryKey
|
|
58
63
|
}, query);
|
|
59
64
|
};
|
|
60
|
-
var getInstance = (instanceId, options) => {
|
|
61
|
-
return customInstance({ url: `/instance/${instanceId}`, method: "get" }, options);
|
|
65
|
+
var getInstance = (instanceId, options, signal) => {
|
|
66
|
+
return customInstance({ url: `/instance/${instanceId}`, method: "get", signal }, options);
|
|
62
67
|
};
|
|
63
68
|
var getGetInstanceQueryKey = (instanceId) => [
|
|
64
69
|
`/instance/${instanceId}`
|
|
65
70
|
];
|
|
66
71
|
var useGetInstance = (instanceId, options) => {
|
|
67
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
72
|
+
const { query: queryOptions, request: requestOptions } = options ?? {};
|
|
68
73
|
const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetInstanceQueryKey(instanceId);
|
|
69
|
-
const queryFn = (
|
|
74
|
+
const queryFn = ({
|
|
75
|
+
signal
|
|
76
|
+
}) => getInstance(instanceId, requestOptions, signal);
|
|
70
77
|
const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!instanceId }, queryOptions));
|
|
71
78
|
return __spreadValues({
|
|
72
79
|
queryKey
|
|
@@ -76,9 +83,9 @@ var terminateInstance = (instanceId, options) => {
|
|
|
76
83
|
return customInstance({ url: `/instance/${instanceId}`, method: "delete" }, options);
|
|
77
84
|
};
|
|
78
85
|
var useTerminateInstance = (options) => {
|
|
79
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
86
|
+
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
80
87
|
const mutationFn = (props) => {
|
|
81
|
-
const { instanceId } = props
|
|
88
|
+
const { instanceId } = props ?? {};
|
|
82
89
|
return terminateInstance(instanceId, requestOptions);
|
|
83
90
|
};
|
|
84
91
|
return useMutation(mutationFn, mutationOptions);
|
|
@@ -87,15 +94,27 @@ var patchInstance = (instanceId, params, options) => {
|
|
|
87
94
|
return customInstance({ url: `/instance/${instanceId}`, method: "patch", params }, options);
|
|
88
95
|
};
|
|
89
96
|
var usePatchInstance = (options) => {
|
|
90
|
-
const { mutation: mutationOptions, request: requestOptions } = options
|
|
97
|
+
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
91
98
|
const mutationFn = (props) => {
|
|
92
|
-
const { instanceId, params } = props
|
|
99
|
+
const { instanceId, params } = props ?? {};
|
|
93
100
|
return patchInstance(instanceId, params, requestOptions);
|
|
94
101
|
};
|
|
95
102
|
return useMutation(mutationFn, mutationOptions);
|
|
96
103
|
};
|
|
104
|
+
var deleteInstanceToken = (instanceId, token, options) => {
|
|
105
|
+
return customInstance({ url: `/instance/${instanceId}/token/${token}`, method: "delete" }, options);
|
|
106
|
+
};
|
|
107
|
+
var useDeleteInstanceToken = (options) => {
|
|
108
|
+
const { mutation: mutationOptions, request: requestOptions } = options ?? {};
|
|
109
|
+
const mutationFn = (props) => {
|
|
110
|
+
const { instanceId, token } = props ?? {};
|
|
111
|
+
return deleteInstanceToken(instanceId, token, requestOptions);
|
|
112
|
+
};
|
|
113
|
+
return useMutation(mutationFn, mutationOptions);
|
|
114
|
+
};
|
|
97
115
|
export {
|
|
98
116
|
createInstance,
|
|
117
|
+
deleteInstanceToken,
|
|
99
118
|
getGetInstanceQueryKey,
|
|
100
119
|
getGetInstancesQueryKey,
|
|
101
120
|
getInstance,
|
|
@@ -103,6 +122,7 @@ export {
|
|
|
103
122
|
patchInstance,
|
|
104
123
|
terminateInstance,
|
|
105
124
|
useCreateInstance,
|
|
125
|
+
useDeleteInstanceToken,
|
|
106
126
|
useGetInstance,
|
|
107
127
|
useGetInstances,
|
|
108
128
|
usePatchInstance,
|
package/instance/instance.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/instance/instance.ts"],"sourcesContent":["/**\n * Generated by orval v6.7.1 🍺\n * Do not edit manually.\n * Dataset Manager API\n * The Dataset Manager API service.\n\nA service that allows *registered* users to make **Datasets** and associated **Metadata** available to **Applications** and **Jobs** using **Projects** and **Files**.\n\n * OpenAPI spec version: 0.7\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n InstancePostResponse,\n DmError,\n InstancePostBodyBody,\n InstancesGetResponse,\n GetInstancesParams,\n InstanceGetResponse,\n InstanceDeleteResponse,\n PatchInstanceParams,\n} from \"../data-manager-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (\n ...args: any\n) => Promise<infer R>\n ? R\n : any;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Launches a new Application or Job instance, returning an Instance and Task ID. The Task ID should be used against the `/task` endpoint to determine the availability of the the running instance.\n\nInstance behaviour is controlled using the `specification`. You will need to consult individual applications to determine what can be placed in the specification. Applications typically provide a `template` describing its **options**.\n\nAn Application instance is not Ready for use until the corresponding **TaskState** is `STARTED`.\n\nA Job instance typically runs to completion, reahcing the **TaskState** `SUCCESS` when successful and `FAILURE` is unsuccessul.\n\n * @summary Creates a new application instance\n */\nexport const createInstance = (\n instancePostBodyBody: InstancePostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n formData.append(\"application_id\", instancePostBodyBody.application_id);\n formData.append(\n \"application_version\",\n instancePostBodyBody.application_version\n );\n formData.append(\"project_id\", instancePostBodyBody.project_id);\n formData.append(\"as_name\", instancePostBodyBody.as_name);\n if (instancePostBodyBody.callback_url !== undefined) {\n formData.append(\"callback_url\", instancePostBodyBody.callback_url);\n }\n if (instancePostBodyBody.callback_context !== undefined) {\n formData.append(\"callback_context\", instancePostBodyBody.callback_context);\n }\n if (instancePostBodyBody.debug !== undefined) {\n formData.append(\"debug\", instancePostBodyBody.debug);\n }\n if (instancePostBodyBody.specification !== undefined) {\n formData.append(\"specification\", instancePostBodyBody.specification);\n }\n\n return customInstance<InstancePostResponse>(\n {\n url: `/instance`,\n method: \"post\",\n headers: { \"Content-Type\": \"multipart/form-data\" },\n data: formData,\n },\n options\n );\n};\n\nexport type CreateInstanceMutationResult = NonNullable<\n AsyncReturnType<typeof createInstance>\n>;\nexport type CreateInstanceMutationBody = InstancePostBodyBody;\nexport type CreateInstanceMutationError = ErrorType<void | DmError>;\n\nexport const useCreateInstance = <\n TError = ErrorType<void | DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof createInstance>,\n TError,\n { data: InstancePostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof createInstance>,\n { data: InstancePostBodyBody }\n > = (props) => {\n const { data } = props || {};\n\n return createInstance(data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof createInstance>,\n TError,\n { data: InstancePostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Returns a summary of all running instances. Insatnces can be running as an Application or as a Job. The response will contain an `application_type` field that is either `job` or `application`\n\n * @summary Get summary information about all application instances\n */\nexport const getInstances = (\n params?: GetInstancesParams,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<InstancesGetResponse>(\n { url: `/instance`, method: \"get\", params },\n options\n );\n};\n\nexport const getGetInstancesQueryKey = (params?: GetInstancesParams) => [\n `/instance`,\n ...(params ? [params] : []),\n];\n\nexport type GetInstancesQueryResult = NonNullable<\n AsyncReturnType<typeof getInstances>\n>;\nexport type GetInstancesQueryError = ErrorType<void | DmError>;\n\nexport const useGetInstances = <\n TData = AsyncReturnType<typeof getInstances>,\n TError = ErrorType<void | DmError>\n>(\n params?: GetInstancesParams,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getInstances>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetInstancesQueryKey(params);\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getInstances>> = () =>\n getInstances(params, requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getInstances>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * The instance information will be returned if available.\n\n * @summary Get detailed information about a specific instance\n */\nexport const getInstance = (\n instanceId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<InstanceGetResponse>(\n { url: `/instance/${instanceId}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetInstanceQueryKey = (instanceId: string) => [\n `/instance/${instanceId}`,\n];\n\nexport type GetInstanceQueryResult = NonNullable<\n AsyncReturnType<typeof getInstance>\n>;\nexport type GetInstanceQueryError = ErrorType<void | DmError>;\n\nexport const useGetInstance = <\n TData = AsyncReturnType<typeof getInstance>,\n TError = ErrorType<void | DmError>\n>(\n instanceId: string,\n options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getInstance>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options || {};\n\n const queryKey = queryOptions?.queryKey ?? getGetInstanceQueryKey(instanceId);\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getInstance>> = () =>\n getInstance(instanceId, requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getInstance>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!instanceId, ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * The Application or Job instance is terminated.\n\nYou must be the `owner` or an `editor` of the instance to delete it\n\n * @summary Delete an application instance\n */\nexport const terminateInstance = (\n instanceId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<InstanceDeleteResponse>(\n { url: `/instance/${instanceId}`, method: \"delete\" },\n options\n );\n};\n\nexport type TerminateInstanceMutationResult = NonNullable<\n AsyncReturnType<typeof terminateInstance>\n>;\n\nexport type TerminateInstanceMutationError = ErrorType<void | DmError>;\n\nexport const useTerminateInstance = <\n TError = ErrorType<void | DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof terminateInstance>,\n TError,\n { instanceId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof terminateInstance>,\n { instanceId: string }\n > = (props) => {\n const { instanceId } = props || {};\n\n return terminateInstance(instanceId, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof terminateInstance>,\n TError,\n { instanceId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * The Application or Job instance is updated according to the patch parameters.\n\nYou must be the `owner` or an `editor` of the instance to patch it\n\n * @summary Update an application instance\n */\nexport const patchInstance = (\n instanceId: string,\n params?: PatchInstanceParams,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/instance/${instanceId}`, method: \"patch\", params },\n options\n );\n};\n\nexport type PatchInstanceMutationResult = NonNullable<\n AsyncReturnType<typeof patchInstance>\n>;\n\nexport type PatchInstanceMutationError = ErrorType<DmError>;\n\nexport const usePatchInstance = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof patchInstance>,\n TError,\n { instanceId: string; params?: PatchInstanceParams },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof patchInstance>,\n { instanceId: string; params?: PatchInstanceParams }\n > = (props) => {\n const { instanceId, params } = props || {};\n\n return patchInstance(instanceId, params, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof patchInstance>,\n TError,\n { instanceId: string; params?: PatchInstanceParams },\n TContext\n >(mutationFn, mutationOptions);\n};\n"],"mappings":";;;;;;AAUA;AAAA;AAAA;AAAA;AAgDO,IAAM,iBAAiB,CAC5B,sBACA,YACG;AACH,QAAM,WAAW,IAAI,SAAS;AAC9B,WAAS,OAAO,kBAAkB,qBAAqB,cAAc;AACrE,WAAS,OACP,uBACA,qBAAqB,mBACvB;AACA,WAAS,OAAO,cAAc,qBAAqB,UAAU;AAC7D,WAAS,OAAO,WAAW,qBAAqB,OAAO;AACvD,MAAI,qBAAqB,iBAAiB,QAAW;AACnD,aAAS,OAAO,gBAAgB,qBAAqB,YAAY;AAAA,EACnE;AACA,MAAI,qBAAqB,qBAAqB,QAAW;AACvD,aAAS,OAAO,oBAAoB,qBAAqB,gBAAgB;AAAA,EAC3E;AACA,MAAI,qBAAqB,UAAU,QAAW;AAC5C,aAAS,OAAO,SAAS,qBAAqB,KAAK;AAAA,EACrD;AACA,MA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AAE5E,QAAM,UAA8D,MAClE,YAAY,YAAY,cAAc;AAExC,QAAM,QAAQ,SACZ,UACA,SACA,iBAAE,SAAS,CAAC,CAAC,cAAe,aAC9B;AAEA,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AASO,IAAM,oBAAoB,CAC/B,YACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,aAAa,cAAc,QAAQ,SAAS,GACnD,OACF;AACF;AAQO,IAAM,uBAAuB,CAGlC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,eAAe,SAAS,CAAC;AAEjC,WAAO,kBAAkB,YAAY,cAAc;AAAA,EACrD;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAQO,IAAM,gBAAgB,CAC3B,YACA,QACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,aAAa,cAAc,QAAQ,SAAS,OAAO,GAC1D,OACF;AACF;AAQO,IAAM,mBAAmB,CAG9B,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,YAAY,WAAW,SAAS,CAAC;AAEzC,WAAO,cAAc,YAAY,QAAQ,cAAc;AAAA,EACzD;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/instance/instance.ts"],"sourcesContent":["/**\n * Generated by orval v6.8.0 🍺\n * Do not edit manually.\n * Dataset Manager API\n * The Dataset Manager API service.\n\nA service that allows *registered* users to make **Datasets** and associated **Metadata** available to **Applications** and **Jobs** using **Projects** and **Files**.\n\n * OpenAPI spec version: 0.7\n */\nimport {\n useQuery,\n useMutation,\n UseQueryOptions,\n UseMutationOptions,\n QueryFunction,\n MutationFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n InstancePostResponse,\n DmError,\n InstancePostBodyBody,\n InstancesGetResponse,\n GetInstancesParams,\n InstanceGetResponse,\n InstanceDeleteResponse,\n PatchInstanceParams,\n} from \"../data-manager-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\nexport type AwaitedInput<T> = PromiseLike<T> | T;\n\nexport type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Launches a new Application or Job instance, returning an Instance and Task ID. The Task ID should be used against the `/task` endpoint to determine the availability of the the running instance.\n\nInstance behaviour is controlled using the `specification`. You will need to consult individual applications to determine what can be placed in the specification. Applications typically provide a `template` describing its **options**.\n\nAn Application instance is not Ready for use until the corresponding **TaskState** is `STARTED`.\n\nA Job instance typically runs to completion, reahcing the **TaskState** `SUCCESS` when successful and `FAILURE` is unsuccessul.\n\n * @summary Creates a new application instance\n */\nexport const createInstance = (\n instancePostBodyBody: InstancePostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n formData.append(\"application_id\", instancePostBodyBody.application_id);\n formData.append(\n \"application_version\",\n instancePostBodyBody.application_version\n );\n formData.append(\"project_id\", instancePostBodyBody.project_id);\n formData.append(\"as_name\", instancePostBodyBody.as_name);\n if (instancePostBodyBody.callback_url !== undefined) {\n formData.append(\"callback_url\", instancePostBodyBody.callback_url);\n }\n if (instancePostBodyBody.callback_context !== undefined) {\n formData.append(\"callback_context\", instancePostBodyBody.callback_context);\n }\n if (instancePostBodyBody.generate_callback_token !== undefined) {\n formData.append(\n \"generate_callback_token\",\n instancePostBodyBody.generate_callback_token.toString()\n );\n }\n if (instancePostBodyBody.debug !== undefined) {\n formData.append(\"debug\", instancePostBodyBody.debug);\n }\n if (instancePostBodyBody.specification !== undefined) {\n formData.append(\"specification\", instancePostBodyBody.specification);\n }\n\n return customInstance<InstancePostResponse>(\n {\n url: `/instance`,\n method: \"post\",\n headers: { \"Content-Type\": \"multipart/form-data\" },\n data: formData,\n },\n options\n );\n};\n\nexport type CreateInstanceMutationResult = NonNullable<\n Awaited<ReturnType<typeof createInstance>>\n>;\nexport type CreateInstanceMutationBody = InstancePostBodyBody;\nexport type CreateInstanceMutationError = ErrorType<void | DmError>;\n\nexport const useCreateInstance = <\n TError = ErrorType<void | DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof createInstance>>,\n TError,\n { data: InstancePostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof createInstance>>,\n { data: InstancePostBodyBody }\n > = (props) => {\n const { data } = props ?? {};\n\n return createInstance(data, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof createInstance>>,\n TError,\n { data: InstancePostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Returns a summary of all running instances. Insatnces can be running as an Application or as a Job. The response will contain an `application_type` field that is either `job` or `application`\n\n * @summary Get summary information about all application instances\n */\nexport const getInstances = (\n params?: GetInstancesParams,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<InstancesGetResponse>(\n { url: `/instance`, method: \"get\", signal, params },\n options\n );\n};\n\nexport const getGetInstancesQueryKey = (params?: GetInstancesParams) => [\n `/instance`,\n ...(params ? [params] : []),\n];\n\nexport type GetInstancesQueryResult = NonNullable<\n Awaited<ReturnType<typeof getInstances>>\n>;\nexport type GetInstancesQueryError = ErrorType<void | DmError>;\n\nexport const useGetInstances = <\n TData = Awaited<ReturnType<typeof getInstances>>,\n TError = ErrorType<void | DmError>\n>(\n params?: GetInstancesParams,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getInstances>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetInstancesQueryKey(params);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getInstances>>> = ({\n signal,\n }) => getInstances(params, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getInstances>>,\n TError,\n TData\n >(queryKey, queryFn, queryOptions);\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * The instance information will be returned if available.\n\n * @summary Get detailed information about a specific instance\n */\nexport const getInstance = (\n instanceId: string,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<InstanceGetResponse>(\n { url: `/instance/${instanceId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetInstanceQueryKey = (instanceId: string) => [\n `/instance/${instanceId}`,\n];\n\nexport type GetInstanceQueryResult = NonNullable<\n Awaited<ReturnType<typeof getInstance>>\n>;\nexport type GetInstanceQueryError = ErrorType<void | DmError>;\n\nexport const useGetInstance = <\n TData = Awaited<ReturnType<typeof getInstance>>,\n TError = ErrorType<void | DmError>\n>(\n instanceId: string,\n options?: {\n query?: UseQueryOptions<\n Awaited<ReturnType<typeof getInstance>>,\n TError,\n TData\n >;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetInstanceQueryKey(instanceId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getInstance>>> = ({\n signal,\n }) => getInstance(instanceId, requestOptions, signal);\n\n const query = useQuery<\n Awaited<ReturnType<typeof getInstance>>,\n TError,\n TData\n >(queryKey, queryFn, { enabled: !!instanceId, ...queryOptions });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * The Application or Job instance is terminated.\n\nYou must be the `owner` or an `editor` of the instance to delete it\n\n * @summary Delete an application instance\n */\nexport const terminateInstance = (\n instanceId: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<InstanceDeleteResponse>(\n { url: `/instance/${instanceId}`, method: \"delete\" },\n options\n );\n};\n\nexport type TerminateInstanceMutationResult = NonNullable<\n Awaited<ReturnType<typeof terminateInstance>>\n>;\n\nexport type TerminateInstanceMutationError = ErrorType<void | DmError>;\n\nexport const useTerminateInstance = <\n TError = ErrorType<void | DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof terminateInstance>>,\n TError,\n { instanceId: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof terminateInstance>>,\n { instanceId: string }\n > = (props) => {\n const { instanceId } = props ?? {};\n\n return terminateInstance(instanceId, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof terminateInstance>>,\n TError,\n { instanceId: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * The Application or Job instance is updated according to the patch parameters.\n\nYou must be the `owner` or an `editor` of the instance to patch it\n\n * @summary Update an application instance\n */\nexport const patchInstance = (\n instanceId: string,\n params?: PatchInstanceParams,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/instance/${instanceId}`, method: \"patch\", params },\n options\n );\n};\n\nexport type PatchInstanceMutationResult = NonNullable<\n Awaited<ReturnType<typeof patchInstance>>\n>;\n\nexport type PatchInstanceMutationError = ErrorType<DmError>;\n\nexport const usePatchInstance = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof patchInstance>>,\n TError,\n { instanceId: string; params?: PatchInstanceParams },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof patchInstance>>,\n { instanceId: string; params?: PatchInstanceParams }\n > = (props) => {\n const { instanceId, params } = props ?? {};\n\n return patchInstance(instanceId, params, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof patchInstance>>,\n TError,\n { instanceId: string; params?: PatchInstanceParams },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * This revokes the instance **Token**, which was optionally generated when the instance was laucnhed. No authenitcation is required to use this endpoint, whcih is typcially used by a remote system driven by instance callbacks.\n\nTokens automatically expre after a period of time but can be revoked instantly with this endpoint.\n\nThe remote system will revoke the token when it's finished with it\n\n * @summary Delete (revoke) the instance token\n */\nexport const deleteInstanceToken = (\n instanceId: string,\n token: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<void>(\n { url: `/instance/${instanceId}/token/${token}`, method: \"delete\" },\n options\n );\n};\n\nexport type DeleteInstanceTokenMutationResult = NonNullable<\n Awaited<ReturnType<typeof deleteInstanceToken>>\n>;\n\nexport type DeleteInstanceTokenMutationError = ErrorType<DmError>;\n\nexport const useDeleteInstanceToken = <\n TError = ErrorType<DmError>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n Awaited<ReturnType<typeof deleteInstanceToken>>,\n TError,\n { instanceId: string; token: string },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options ?? {};\n\n const mutationFn: MutationFunction<\n Awaited<ReturnType<typeof deleteInstanceToken>>,\n { instanceId: string; token: string }\n > = (props) => {\n const { instanceId, token } = props ?? {};\n\n return deleteInstanceToken(instanceId, token, requestOptions);\n };\n\n return useMutation<\n Awaited<ReturnType<typeof deleteInstanceToken>>,\n TError,\n { instanceId: string; token: string },\n TContext\n >(mutationFn, mutationOptions);\n};\n"],"mappings":";;;;;;AAUA;AAAA;AAAA;AAAA;AA6CO,IAAM,iBAAiB,CAC5B,sBACA,YACG;AACH,QAAM,WAAW,IAAI,SAAS;AAC9B,WAAS,OAAO,k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M,mBAAmB,CAG9B,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,YAAY,WAAW,SAAS,CAAC;AAEzC,WAAO,cAAc,YAAY,QAAQ,cAAc;AAAA,EACzD;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;AAUO,IAAM,sBAAsB,CACjC,YACA,OACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,aAAa,oBAAoB,SAAS,QAAQ,SAAS,GAClE,OACF;AACF;AAQO,IAAM,yBAAyB,CAGpC,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW,CAAC;AAE3E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,YAAY,UAAU,SAAS,CAAC;AAExC,WAAO,oBAAoB,YAAY,OAAO,cAAc;AAAA,EAC9D;AAEA,SAAO,YAKL,YAAY,eAAe;AAC/B;","names":[]}
|
package/job/job.cjs
CHANGED
|
@@ -7,27 +7,31 @@ var _chunkNGBTCJWScjs = require('../chunk-NGBTCJWS.cjs');
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _reactquery = require('react-query');
|
|
10
|
-
var getJobs = (options) => {
|
|
11
|
-
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/job`, method: "get" }, options);
|
|
10
|
+
var getJobs = (options, signal) => {
|
|
11
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/job`, method: "get", signal }, options);
|
|
12
12
|
};
|
|
13
13
|
var getGetJobsQueryKey = () => [`/job`];
|
|
14
14
|
var useGetJobs = (options) => {
|
|
15
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
15
|
+
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
16
16
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetJobsQueryKey()));
|
|
17
|
-
const queryFn = (
|
|
17
|
+
const queryFn = ({
|
|
18
|
+
signal
|
|
19
|
+
}) => getJobs(requestOptions, signal);
|
|
18
20
|
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, queryOptions);
|
|
19
21
|
return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
|
|
20
22
|
queryKey
|
|
21
23
|
}, query);
|
|
22
24
|
};
|
|
23
|
-
var getJob = (jobId, options) => {
|
|
24
|
-
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/job/${jobId}`, method: "get" }, options);
|
|
25
|
+
var getJob = (jobId, options, signal) => {
|
|
26
|
+
return _chunkNGBTCJWScjs.customInstance.call(void 0, { url: `/job/${jobId}`, method: "get", signal }, options);
|
|
25
27
|
};
|
|
26
28
|
var getGetJobQueryKey = (jobId) => [`/job/${jobId}`];
|
|
27
29
|
var useGetJob = (jobId, options) => {
|
|
28
|
-
const { query: queryOptions, request: requestOptions } = options
|
|
30
|
+
const { query: queryOptions, request: requestOptions } = _nullishCoalesce(options, () => ( {}));
|
|
29
31
|
const queryKey = _nullishCoalesce((queryOptions == null ? void 0 : queryOptions.queryKey), () => ( getGetJobQueryKey(jobId)));
|
|
30
|
-
const queryFn = (
|
|
32
|
+
const queryFn = ({
|
|
33
|
+
signal
|
|
34
|
+
}) => getJob(jobId, requestOptions, signal);
|
|
31
35
|
const query = _reactquery.useQuery.call(void 0, queryKey, queryFn, _chunkNGBTCJWScjs.__spreadValues.call(void 0, { enabled: !!jobId }, queryOptions));
|
|
32
36
|
return _chunkNGBTCJWScjs.__spreadValues.call(void 0, {
|
|
33
37
|
queryKey
|
package/job/job.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/job/job.ts"],"names":[],"mappings":";;;;;;AAUA;AAAA;AAAA;
|
|
1
|
+
{"version":3,"sources":["../../src/job/job.ts"],"names":[],"mappings":";;;;;;AAUA;AAAA;AAAA;AAiCO,IAAM,UAAU,CACrB,SACA,WACG;AACH,SAAO,eACL,EAAE,KAAK,QAAQ,QAAQ,OAAO,OAAO,GACrC,OACF;AACF;AAEO,IAAM,qBAAqB,MAAM,CAAC,MAAM;AAOxC,IAAM,aAAa,CAGxB,YAG4D;AAC5D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,mBAAmB;AAE9D,QAAM,UAA8D,CAAC;AAAA,IACnE;AAAA,QACI,QAAQ,gBAAgB,MAAM;AAEpC,QAAM,QAAQ,SACZ,UACA,SACA,YACF;AAEA,SAAO;AAAA,IACL;AAAA,KACG;AAEP;AASO,IAAM,SAAS,CACpB,OACA,SACA,WACG;AACH,SAAO,eACL,EAAE,KAAK,QAAQ,SAAS,QAAQ,OAAO,OAAO,GAC9C,OACF;AACF;AAEO,IAAM,oBAAoB,CAAC,UAAkB,CAAC,QAAQ,OAAO;AAK7D,IAAM,YAAY,CAIvB,OACA,YAI2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW,CAAC;AAErE,QAAM,WAAW,8CAAc,aAAY,kBAAkB,KAAK;AAElE,QAAM,UAA6D,CAAC;AAAA,IAClE;AAAA,QACI,OAAO,OAAO,gBAAgB,MAAM;AAE1C,QAAM,QAAQ,SACZ,UACA,SACA,iBAAE,SAAS,CAAC,CAAC,SAAU,aACzB;AAEA,SAAO;AAAA,IACL;AAAA,KACG;AAEP","sourcesContent":["/**\n * Generated by orval v6.8.0 🍺\n * Do not edit manually.\n * Dataset Manager API\n * The Dataset Manager API service.\n\nA service that allows *registered* users to make **Datasets** and associated **Metadata** available to **Applications** and **Jobs** using **Projects** and **Files**.\n\n * OpenAPI spec version: 0.7\n */\nimport {\n useQuery,\n UseQueryOptions,\n QueryFunction,\n UseQueryResult,\n QueryKey,\n} from \"react-query\";\nimport type {\n JobsGetResponse,\n DmError,\n JobGetResponse,\n} from \"../data-manager-api.schemas\";\nimport { customInstance, ErrorType } from \".././custom-instance\";\n\nexport type AwaitedInput<T> = PromiseLike<T> | T;\n\nexport type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype SecondParameter<T extends (...args: any) => any> = T extends (\n config: any,\n args: infer P\n) => any\n ? P\n : never;\n\n/**\n * Get a list of all jobs available to you that can be instantiated via the `/instance` endpoint.\n\nJob availability will vary as Jobs are added to the cluster.\n\n * @summary Get all Jobs available to you\n */\nexport const getJobs = (\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<JobsGetResponse>(\n { url: `/job`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetJobsQueryKey = () => [`/job`];\n\nexport type GetJobsQueryResult = NonNullable<\n Awaited<ReturnType<typeof getJobs>>\n>;\nexport type GetJobsQueryError = ErrorType<DmError>;\n\nexport const useGetJobs = <\n TData = Awaited<ReturnType<typeof getJobs>>,\n TError = ErrorType<DmError>\n>(options?: {\n query?: UseQueryOptions<Awaited<ReturnType<typeof getJobs>>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n}): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetJobsQueryKey();\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getJobs>>> = ({\n signal,\n }) => getJobs(requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getJobs>>, TError, TData>(\n queryKey,\n queryFn,\n queryOptions\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Get details of a specific job available to you that can be instantiated.\n\nTo run a job you need to use the `/instance` endpoint. The Job is controlled through the `specification` field, a JSON string. You will need to identify the Job using its `collection`, `job` and `version` as well as providing any variables in the specification required by the Job's command.\n\n * @summary Get details of a specific Job\n */\nexport const getJob = (\n jobId: number,\n options?: SecondParameter<typeof customInstance>,\n signal?: AbortSignal\n) => {\n return customInstance<JobGetResponse>(\n { url: `/job/${jobId}`, method: \"get\", signal },\n options\n );\n};\n\nexport const getGetJobQueryKey = (jobId: number) => [`/job/${jobId}`];\n\nexport type GetJobQueryResult = NonNullable<Awaited<ReturnType<typeof getJob>>>;\nexport type GetJobQueryError = ErrorType<void | DmError>;\n\nexport const useGetJob = <\n TData = Awaited<ReturnType<typeof getJob>>,\n TError = ErrorType<void | DmError>\n>(\n jobId: number,\n options?: {\n query?: UseQueryOptions<Awaited<ReturnType<typeof getJob>>, TError, TData>;\n request?: SecondParameter<typeof customInstance>;\n }\n): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {\n const { query: queryOptions, request: requestOptions } = options ?? {};\n\n const queryKey = queryOptions?.queryKey ?? getGetJobQueryKey(jobId);\n\n const queryFn: QueryFunction<Awaited<ReturnType<typeof getJob>>> = ({\n signal,\n }) => getJob(jobId, requestOptions, signal);\n\n const query = useQuery<Awaited<ReturnType<typeof getJob>>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!jobId, ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n"]}
|
package/job/job.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { UseQueryOptions, QueryKey, UseQueryResult } from 'react-query';
|
|
2
|
-
import {
|
|
2
|
+
import { bd as customInstance, aL as JobsGetResponse, be as ErrorType, b9 as DmError, aN as JobGetResponse } from '../custom-instance-da4fff1f.js';
|
|
3
3
|
import 'axios';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Generated by orval v6.
|
|
6
|
+
* Generated by orval v6.8.0 🍺
|
|
7
7
|
* Do not edit manually.
|
|
8
8
|
* Dataset Manager API
|
|
9
9
|
* The Dataset Manager API service.
|
|
@@ -13,7 +13,8 @@ A service that allows *registered* users to make **Datasets** and associated **M
|
|
|
13
13
|
* OpenAPI spec version: 0.7
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
declare type
|
|
16
|
+
declare type AwaitedInput<T> = PromiseLike<T> | T;
|
|
17
|
+
declare type Awaited<O> = O extends AwaitedInput<infer T> ? T : never;
|
|
17
18
|
declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
|
|
18
19
|
/**
|
|
19
20
|
* Get a list of all jobs available to you that can be instantiated via the `/instance` endpoint.
|
|
@@ -22,9 +23,9 @@ Job availability will vary as Jobs are added to the cluster.
|
|
|
22
23
|
|
|
23
24
|
* @summary Get all Jobs available to you
|
|
24
25
|
*/
|
|
25
|
-
declare const getJobs: (options?: SecondParameter<typeof customInstance
|
|
26
|
+
declare const getJobs: (options?: SecondParameter<typeof customInstance>, signal?: AbortSignal | undefined) => Promise<JobsGetResponse>;
|
|
26
27
|
declare const getGetJobsQueryKey: () => string[];
|
|
27
|
-
declare type GetJobsQueryResult = NonNullable<
|
|
28
|
+
declare type GetJobsQueryResult = NonNullable<Awaited<ReturnType<typeof getJobs>>>;
|
|
28
29
|
declare type GetJobsQueryError = ErrorType<DmError>;
|
|
29
30
|
declare const useGetJobs: <TData = JobsGetResponse, TError = ErrorType<DmError>>(options?: {
|
|
30
31
|
query?: UseQueryOptions<JobsGetResponse, TError, TData, QueryKey> | undefined;
|
|
@@ -39,9 +40,9 @@ To run a job you need to use the `/instance` endpoint. The Job is controlled thr
|
|
|
39
40
|
|
|
40
41
|
* @summary Get details of a specific Job
|
|
41
42
|
*/
|
|
42
|
-
declare const getJob: (jobId: number, options?: SecondParameter<typeof customInstance
|
|
43
|
+
declare const getJob: (jobId: number, options?: SecondParameter<typeof customInstance>, signal?: AbortSignal | undefined) => Promise<JobGetResponse>;
|
|
43
44
|
declare const getGetJobQueryKey: (jobId: number) => string[];
|
|
44
|
-
declare type GetJobQueryResult = NonNullable<
|
|
45
|
+
declare type GetJobQueryResult = NonNullable<Awaited<ReturnType<typeof getJob>>>;
|
|
45
46
|
declare type GetJobQueryError = ErrorType<void | DmError>;
|
|
46
47
|
declare const useGetJob: <TData = JobGetResponse, TError = ErrorType<void | DmError>>(jobId: number, options?: {
|
|
47
48
|
query?: UseQueryOptions<JobGetResponse, TError, TData, QueryKey> | undefined;
|
|
@@ -50,4 +51,4 @@ declare const useGetJob: <TData = JobGetResponse, TError = ErrorType<void | DmEr
|
|
|
50
51
|
queryKey: QueryKey;
|
|
51
52
|
};
|
|
52
53
|
|
|
53
|
-
export { GetJobQueryError, GetJobQueryResult, GetJobsQueryError, GetJobsQueryResult, getGetJobQueryKey, getGetJobsQueryKey, getJob, getJobs, useGetJob, useGetJobs };
|
|
54
|
+
export { Awaited, AwaitedInput, GetJobQueryError, GetJobQueryResult, GetJobsQueryError, GetJobsQueryResult, getGetJobQueryKey, getGetJobsQueryKey, getJob, getJobs, useGetJob, useGetJobs };
|