@squonk/data-manager-client 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/accounting/accounting.cjs +24 -8
  2. package/accounting/accounting.cjs.map +1 -1
  3. package/accounting/accounting.d.ts +19 -8
  4. package/accounting/accounting.js +26 -10
  5. package/accounting/accounting.js.map +1 -1
  6. package/admin/admin.cjs +22 -1
  7. package/admin/admin.cjs.map +1 -1
  8. package/admin/admin.d.ts +20 -2
  9. package/admin/admin.js +21 -0
  10. package/admin/admin.js.map +1 -1
  11. package/application/application.d.ts +1 -1
  12. package/{custom-instance-9873bed3.d.ts → custom-instance-eb1ebf45.d.ts} +83 -19
  13. package/dataset/dataset.d.ts +1 -1
  14. package/file/file.d.ts +1 -1
  15. package/index.cjs +23 -1
  16. package/index.cjs.map +1 -1
  17. package/index.d.ts +1 -1
  18. package/index.js +22 -0
  19. package/index.js.map +1 -1
  20. package/instance/instance.cjs +6 -0
  21. package/instance/instance.cjs.map +1 -1
  22. package/instance/instance.d.ts +1 -1
  23. package/instance/instance.js +6 -0
  24. package/instance/instance.js.map +1 -1
  25. package/job/job.d.ts +1 -1
  26. package/metadata/metadata.cjs +93 -0
  27. package/metadata/metadata.cjs.map +1 -0
  28. package/metadata/metadata.d.ts +72 -0
  29. package/metadata/metadata.js +93 -0
  30. package/metadata/metadata.js.map +1 -0
  31. package/metadata/package.json +7 -0
  32. package/package.json +1 -1
  33. package/project/project.d.ts +1 -1
  34. package/src/accounting/accounting.ts +56 -15
  35. package/src/admin/admin.ts +59 -0
  36. package/src/data-manager-api.schemas.ts +108 -20
  37. package/src/instance/instance.ts +6 -0
  38. package/src/metadata/metadata.ts +283 -0
  39. package/task/task.d.ts +1 -1
  40. package/type/type.d.ts +1 -1
  41. package/user/user.d.ts +1 -1
  42. package/annotation/annotation.cjs +0 -64
  43. package/annotation/annotation.cjs.map +0 -1
  44. package/annotation/annotation.d.ts +0 -58
  45. package/annotation/annotation.js +0 -64
  46. package/annotation/annotation.js.map +0 -1
  47. package/annotation/package.json +0 -7
  48. package/src/annotation/annotation.ts +0 -217
@@ -0,0 +1,72 @@
1
+ import * as react_query from 'react-query';
2
+ import { UseMutationOptions, UseQueryOptions, QueryKey, UseQueryResult } from 'react-query';
3
+ import { O as DatasetVersionMetaPostBodyBody, bb as customInstance, a$ as DatasetMetaGetResponse, bc as ErrorType, b7 as DmError, R as DatasetMetaPostBodyBody } from '../custom-instance-eb1ebf45';
4
+ import 'axios';
5
+
6
+ declare type SecondParameter<T extends (...args: any) => any> = T extends (config: any, args: infer P) => any ? P : never;
7
+ /**
8
+ * Update parameters or add new annotations of the specified type(s) and to the metadata for the version of the dataset.
9
+ The parameters are provided in a list in keyword/arguments
10
+ The annotations are provided in a list in JSON format. For details of the annotations that can be created, see the data-manager-metadata library,
11
+
12
+ * @summary Update Metadata for the Dataset version
13
+ */
14
+ declare const addMetadataVersion: (datasetid: string, datasetversion: number, datasetVersionMetaPostBodyBody: DatasetVersionMetaPostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<DatasetMetaGetResponse>;
15
+ declare const useAddMetadataVersion: <TError = ErrorType<void | DmError>, TContext = unknown>(options?: {
16
+ mutation?: UseMutationOptions<DatasetMetaGetResponse, TError, {
17
+ datasetid: string;
18
+ datasetversion: number;
19
+ data: DatasetVersionMetaPostBodyBody;
20
+ }, TContext> | undefined;
21
+ request?: SecondParameter<typeof customInstance>;
22
+ } | undefined) => react_query.UseMutationResult<DatasetMetaGetResponse, TError, {
23
+ datasetid: string;
24
+ datasetversion: number;
25
+ data: DatasetVersionMetaPostBodyBody;
26
+ }, TContext>;
27
+ /**
28
+ * Returns the metadata for a Dataset version in JSON format.
29
+
30
+ * @summary Gets the metadata for a specific Dataset version
31
+ */
32
+ declare const getMetadataVersion: (datasetid: string, datasetversion: number, options?: SecondParameter<typeof customInstance>) => Promise<DatasetMetaGetResponse>;
33
+ declare const getGetMetadataVersionQueryKey: (datasetid: string, datasetversion: number) => string[];
34
+ declare const useGetMetadataVersion: <TData = DatasetMetaGetResponse, TError = ErrorType<void | DmError>>(datasetid: string, datasetversion: number, options?: {
35
+ query?: UseQueryOptions<DatasetMetaGetResponse, TError, TData, QueryKey> | undefined;
36
+ request?: SecondParameter<typeof customInstance>;
37
+ } | undefined) => UseQueryResult<TData, TError> & {
38
+ queryKey: QueryKey;
39
+ };
40
+ /**
41
+ * Update default parameters or add new labels to the metadata for the dataset.
42
+ The parameters are provided in a list in keyword/arguments
43
+ The labels are provided in a list in JSON format. For details of the label format, see the data-manager-metadata library,
44
+
45
+ * @summary Update Metadata for the Dataset
46
+ */
47
+ declare const addMetadata: (datasetid: string, datasetMetaPostBodyBody: DatasetMetaPostBodyBody, options?: SecondParameter<typeof customInstance>) => Promise<DatasetMetaGetResponse>;
48
+ declare const useAddMetadata: <TError = ErrorType<void | DmError>, TContext = unknown>(options?: {
49
+ mutation?: UseMutationOptions<DatasetMetaGetResponse, TError, {
50
+ datasetid: string;
51
+ data: DatasetMetaPostBodyBody;
52
+ }, TContext> | undefined;
53
+ request?: SecondParameter<typeof customInstance>;
54
+ } | undefined) => react_query.UseMutationResult<DatasetMetaGetResponse, TError, {
55
+ datasetid: string;
56
+ data: DatasetMetaPostBodyBody;
57
+ }, TContext>;
58
+ /**
59
+ * Returns the metadata for a Dataset in JSON format.
60
+
61
+ * @summary Gets the metadata for a specific Dataset
62
+ */
63
+ declare const getMetadata: (datasetid: string, options?: SecondParameter<typeof customInstance>) => Promise<DatasetMetaGetResponse>;
64
+ declare const getGetMetadataQueryKey: (datasetid: string) => string[];
65
+ declare const useGetMetadata: <TData = DatasetMetaGetResponse, TError = ErrorType<void | DmError>>(datasetid: string, options?: {
66
+ query?: UseQueryOptions<DatasetMetaGetResponse, TError, TData, QueryKey> | undefined;
67
+ request?: SecondParameter<typeof customInstance>;
68
+ } | undefined) => UseQueryResult<TData, TError> & {
69
+ queryKey: QueryKey;
70
+ };
71
+
72
+ export { addMetadata, addMetadataVersion, getGetMetadataQueryKey, getGetMetadataVersionQueryKey, getMetadata, getMetadataVersion, useAddMetadata, useAddMetadataVersion, useGetMetadata, useGetMetadataVersion };
@@ -0,0 +1,93 @@
1
+ import {
2
+ __spreadValues,
3
+ customInstance
4
+ } from "../chunk-JR7F532L.js";
5
+
6
+ // src/metadata/metadata.ts
7
+ import {
8
+ useQuery,
9
+ useMutation
10
+ } from "react-query";
11
+ var addMetadataVersion = (datasetid, datasetversion, datasetVersionMetaPostBodyBody, options) => {
12
+ const formData = new FormData();
13
+ if (datasetVersionMetaPostBodyBody.meta_properties !== void 0) {
14
+ formData.append("meta_properties", datasetVersionMetaPostBodyBody.meta_properties);
15
+ }
16
+ if (datasetVersionMetaPostBodyBody.annotations !== void 0) {
17
+ formData.append("annotations", datasetVersionMetaPostBodyBody.annotations);
18
+ }
19
+ return customInstance({
20
+ url: `/dataset/${datasetid}/meta/${datasetversion}`,
21
+ method: "post",
22
+ data: formData
23
+ }, options);
24
+ };
25
+ var useAddMetadataVersion = (options) => {
26
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
27
+ const mutationFn = (props) => {
28
+ const { datasetid, datasetversion, data } = props || {};
29
+ return addMetadataVersion(datasetid, datasetversion, data, requestOptions);
30
+ };
31
+ return useMutation(mutationFn, mutationOptions);
32
+ };
33
+ var getMetadataVersion = (datasetid, datasetversion, options) => {
34
+ return customInstance({ url: `/dataset/${datasetid}/meta/${datasetversion}`, method: "get" }, options);
35
+ };
36
+ var getGetMetadataVersionQueryKey = (datasetid, datasetversion) => [`/dataset/${datasetid}/meta/${datasetversion}`];
37
+ var useGetMetadataVersion = (datasetid, datasetversion, options) => {
38
+ const { query: queryOptions, request: requestOptions } = options || {};
39
+ const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetMetadataVersionQueryKey(datasetid, datasetversion);
40
+ const queryFn = () => getMetadataVersion(datasetid, datasetversion, requestOptions);
41
+ const query = useQuery(queryKey, queryFn, __spreadValues({
42
+ enabled: !!(datasetid && datasetversion)
43
+ }, queryOptions));
44
+ return __spreadValues({
45
+ queryKey
46
+ }, query);
47
+ };
48
+ var addMetadata = (datasetid, datasetMetaPostBodyBody, options) => {
49
+ const formData = new FormData();
50
+ if (datasetMetaPostBodyBody.meta_properties !== void 0) {
51
+ formData.append("meta_properties", datasetMetaPostBodyBody.meta_properties);
52
+ }
53
+ if (datasetMetaPostBodyBody.labels !== void 0) {
54
+ formData.append("labels", datasetMetaPostBodyBody.labels);
55
+ }
56
+ return customInstance({ url: `/dataset/${datasetid}/meta`, method: "post", data: formData }, options);
57
+ };
58
+ var useAddMetadata = (options) => {
59
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
60
+ const mutationFn = (props) => {
61
+ const { datasetid, data } = props || {};
62
+ return addMetadata(datasetid, data, requestOptions);
63
+ };
64
+ return useMutation(mutationFn, mutationOptions);
65
+ };
66
+ var getMetadata = (datasetid, options) => {
67
+ return customInstance({ url: `/dataset/${datasetid}/meta`, method: "get" }, options);
68
+ };
69
+ var getGetMetadataQueryKey = (datasetid) => [
70
+ `/dataset/${datasetid}/meta`
71
+ ];
72
+ var useGetMetadata = (datasetid, options) => {
73
+ const { query: queryOptions, request: requestOptions } = options || {};
74
+ const queryKey = (queryOptions == null ? void 0 : queryOptions.queryKey) ?? getGetMetadataQueryKey(datasetid);
75
+ const queryFn = () => getMetadata(datasetid, requestOptions);
76
+ const query = useQuery(queryKey, queryFn, __spreadValues({ enabled: !!datasetid }, queryOptions));
77
+ return __spreadValues({
78
+ queryKey
79
+ }, query);
80
+ };
81
+ export {
82
+ addMetadata,
83
+ addMetadataVersion,
84
+ getGetMetadataQueryKey,
85
+ getGetMetadataVersionQueryKey,
86
+ getMetadata,
87
+ getMetadataVersion,
88
+ useAddMetadata,
89
+ useAddMetadataVersion,
90
+ useGetMetadata,
91
+ useGetMetadataVersion
92
+ };
93
+ //# sourceMappingURL=metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/metadata/metadata.ts"],"sourcesContent":["/**\n * Generated by orval v6.6.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 DatasetMetaGetResponse,\n DmError,\n DatasetVersionMetaPostBodyBody,\n DatasetMetaPostBodyBody,\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 * Update parameters or add new annotations of the specified type(s) and to the metadata for the version of the dataset.\nThe parameters are provided in a list in keyword/arguments\nThe annotations are provided in a list in JSON format. For details of the annotations that can be created, see the data-manager-metadata library,\n\n * @summary Update Metadata for the Dataset version\n */\nexport const addMetadataVersion = (\n datasetid: string,\n datasetversion: number,\n datasetVersionMetaPostBodyBody: DatasetVersionMetaPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n if (datasetVersionMetaPostBodyBody.meta_properties !== undefined) {\n formData.append(\n \"meta_properties\",\n datasetVersionMetaPostBodyBody.meta_properties\n );\n }\n if (datasetVersionMetaPostBodyBody.annotations !== undefined) {\n formData.append(\"annotations\", datasetVersionMetaPostBodyBody.annotations);\n }\n\n return customInstance<DatasetMetaGetResponse>(\n {\n url: `/dataset/${datasetid}/meta/${datasetversion}`,\n method: \"post\",\n data: formData,\n },\n options\n );\n};\n\nexport const useAddMetadataVersion = <\n TError = ErrorType<DmError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof addMetadataVersion>,\n TError,\n {\n datasetid: string;\n datasetversion: number;\n data: DatasetVersionMetaPostBodyBody;\n },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof addMetadataVersion>,\n {\n datasetid: string;\n datasetversion: number;\n data: DatasetVersionMetaPostBodyBody;\n }\n > = (props) => {\n const { datasetid, datasetversion, data } = props || {};\n\n return addMetadataVersion(datasetid, datasetversion, data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof addMetadataVersion>,\n TError,\n {\n datasetid: string;\n datasetversion: number;\n data: DatasetVersionMetaPostBodyBody;\n },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Returns the metadata for a Dataset version in JSON format.\n\n * @summary Gets the metadata for a specific Dataset version\n */\nexport const getMetadataVersion = (\n datasetid: string,\n datasetversion: number,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<DatasetMetaGetResponse>(\n { url: `/dataset/${datasetid}/meta/${datasetversion}`, method: \"get\" },\n options\n );\n};\n\nexport const getGetMetadataVersionQueryKey = (\n datasetid: string,\n datasetversion: number\n) => [`/dataset/${datasetid}/meta/${datasetversion}`];\n\nexport const useGetMetadataVersion = <\n TData = AsyncReturnType<typeof getMetadataVersion>,\n TError = ErrorType<void | DmError>\n>(\n datasetid: string,\n datasetversion: number,\n options?: {\n query?: UseQueryOptions<\n AsyncReturnType<typeof getMetadataVersion>,\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 =\n queryOptions?.queryKey ??\n getGetMetadataVersionQueryKey(datasetid, datasetversion);\n\n const queryFn: QueryFunction<\n AsyncReturnType<typeof getMetadataVersion>\n > = () => getMetadataVersion(datasetid, datasetversion, requestOptions);\n\n const query = useQuery<\n AsyncReturnType<typeof getMetadataVersion>,\n TError,\n TData\n >(queryKey, queryFn, {\n enabled: !!(datasetid && datasetversion),\n ...queryOptions,\n });\n\n return {\n queryKey,\n ...query,\n };\n};\n\n/**\n * Update default parameters or add new labels to the metadata for the dataset.\nThe parameters are provided in a list in keyword/arguments\nThe labels are provided in a list in JSON format. For details of the label format, see the data-manager-metadata library,\n\n * @summary Update Metadata for the Dataset\n */\nexport const addMetadata = (\n datasetid: string,\n datasetMetaPostBodyBody: DatasetMetaPostBodyBody,\n options?: SecondParameter<typeof customInstance>\n) => {\n const formData = new FormData();\n if (datasetMetaPostBodyBody.meta_properties !== undefined) {\n formData.append(\"meta_properties\", datasetMetaPostBodyBody.meta_properties);\n }\n if (datasetMetaPostBodyBody.labels !== undefined) {\n formData.append(\"labels\", datasetMetaPostBodyBody.labels);\n }\n\n return customInstance<DatasetMetaGetResponse>(\n { url: `/dataset/${datasetid}/meta`, method: \"post\", data: formData },\n options\n );\n};\n\nexport const useAddMetadata = <\n TError = ErrorType<DmError | void>,\n TContext = unknown\n>(options?: {\n mutation?: UseMutationOptions<\n AsyncReturnType<typeof addMetadata>,\n TError,\n { datasetid: string; data: DatasetMetaPostBodyBody },\n TContext\n >;\n request?: SecondParameter<typeof customInstance>;\n}) => {\n const { mutation: mutationOptions, request: requestOptions } = options || {};\n\n const mutationFn: MutationFunction<\n AsyncReturnType<typeof addMetadata>,\n { datasetid: string; data: DatasetMetaPostBodyBody }\n > = (props) => {\n const { datasetid, data } = props || {};\n\n return addMetadata(datasetid, data, requestOptions);\n };\n\n return useMutation<\n AsyncReturnType<typeof addMetadata>,\n TError,\n { datasetid: string; data: DatasetMetaPostBodyBody },\n TContext\n >(mutationFn, mutationOptions);\n};\n/**\n * Returns the metadata for a Dataset in JSON format.\n\n * @summary Gets the metadata for a specific Dataset\n */\nexport const getMetadata = (\n datasetid: string,\n options?: SecondParameter<typeof customInstance>\n) => {\n return customInstance<DatasetMetaGetResponse>(\n { url: `/dataset/${datasetid}/meta`, method: \"get\" },\n options\n );\n};\n\nexport const getGetMetadataQueryKey = (datasetid: string) => [\n `/dataset/${datasetid}/meta`,\n];\n\nexport const useGetMetadata = <\n TData = AsyncReturnType<typeof getMetadata>,\n TError = ErrorType<void | DmError>\n>(\n datasetid: string,\n options?: {\n query?: UseQueryOptions<AsyncReturnType<typeof getMetadata>, 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 ?? getGetMetadataQueryKey(datasetid);\n\n const queryFn: QueryFunction<AsyncReturnType<typeof getMetadata>> = () =>\n getMetadata(datasetid, requestOptions);\n\n const query = useQuery<AsyncReturnType<typeof getMetadata>, TError, TData>(\n queryKey,\n queryFn,\n { enabled: !!datasetid, ...queryOptions }\n );\n\n return {\n queryKey,\n ...query,\n };\n};\n"],"mappings":";;;;;;AAUA;AAAA;AAAA;AAAA;AAwCO,IAAM,qBAAqB,CAChC,WACA,gBACA,gCACA,YACG;AACH,QAAM,WAAW,IAAI;AACrB,MAAI,+BAA+B,oBAAoB,QAAW;AAChE,aAAS,OACP,mBACA,+BAA+B;AAAA;AAGnC,MAAI,+BAA+B,gBAAgB,QAAW;AAC5D,aAAS,OAAO,eAAe,+BAA+B;AAAA;AAGhE,SAAO,eACL;AAAA,IACE,KAAK,YAAY,kBAAkB;AAAA,IACnC,QAAQ;AAAA,IACR,MAAM;AAAA,KAER;AAAA;AAIG,IAAM,wBAAwB,CAGnC,YAYI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW;AAE1E,QAAM,aAOF,CAAC,UAAU;AACb,UAAM,EAAE,WAAW,gBAAgB,SAAS,SAAS;AAErD,WAAO,mBAAmB,WAAW,gBAAgB,MAAM;AAAA;AAG7D,SAAO,YASL,YAAY;AAAA;AAOT,IAAM,qBAAqB,CAChC,WACA,gBACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,kBAAkB,kBAAkB,QAAQ,SAC/D;AAAA;AAIG,IAAM,gCAAgC,CAC3C,WACA,mBACG,CAAC,YAAY,kBAAkB;AAE7B,IAAM,wBAAwB,CAInC,WACA,gBACA,YAQ2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW;AAEpE,QAAM,WACJ,8CAAc,aACd,8BAA8B,WAAW;AAE3C,QAAM,UAEF,MAAM,mBAAmB,WAAW,gBAAgB;AAExD,QAAM,QAAQ,SAIZ,UAAU,SAAS;AAAA,IACnB,SAAS,CAAC,CAAE,cAAa;AAAA,KACtB;AAGL,SAAO;AAAA,IACL;AAAA,KACG;AAAA;AAWA,IAAM,cAAc,CACzB,WACA,yBACA,YACG;AACH,QAAM,WAAW,IAAI;AACrB,MAAI,wBAAwB,oBAAoB,QAAW;AACzD,aAAS,OAAO,mBAAmB,wBAAwB;AAAA;AAE7D,MAAI,wBAAwB,WAAW,QAAW;AAChD,aAAS,OAAO,UAAU,wBAAwB;AAAA;AAGpD,SAAO,eACL,EAAE,KAAK,YAAY,kBAAkB,QAAQ,QAAQ,MAAM,YAC3D;AAAA;AAIG,IAAM,iBAAiB,CAG5B,YAQI;AACJ,QAAM,EAAE,UAAU,iBAAiB,SAAS,mBAAmB,WAAW;AAE1E,QAAM,aAGF,CAAC,UAAU;AACb,UAAM,EAAE,WAAW,SAAS,SAAS;AAErC,WAAO,YAAY,WAAW,MAAM;AAAA;AAGtC,SAAO,YAKL,YAAY;AAAA;AAOT,IAAM,cAAc,CACzB,WACA,YACG;AACH,SAAO,eACL,EAAE,KAAK,YAAY,kBAAkB,QAAQ,SAC7C;AAAA;AAIG,IAAM,yBAAyB,CAAC,cAAsB;AAAA,EAC3D,YAAY;AAAA;AAGP,IAAM,iBAAiB,CAI5B,WACA,YAI2D;AAC3D,QAAM,EAAE,OAAO,cAAc,SAAS,mBAAmB,WAAW;AAEpE,QAAM,WAAW,8CAAc,aAAY,uBAAuB;AAElE,QAAM,UAA8D,MAClE,YAAY,WAAW;AAEzB,QAAM,QAAQ,SACZ,UACA,SACA,iBAAE,SAAS,CAAC,CAAC,aAAc;AAG7B,SAAO;AAAA,IACL;AAAA,KACG;AAAA;","names":[]}
@@ -0,0 +1,7 @@
1
+ {
2
+ "module": "./metadata.js",
3
+ "main": "./metadata.cjs",
4
+ "types": "./metadata.d.ts",
5
+ "sideEffects": false,
6
+ "type": "module"
7
+ }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.7.0",
2
+ "version": "0.7.1",
3
3
  "author": "Oliver Dudgeon",
4
4
  "name": "@squonk/data-manager-client",
5
5
  "private": false,
@@ -1,4 +1,4 @@
1
- import { b7 as customInstance, aB as ProjectsGetResponse, b8 as ErrorType, b3 as DmError, H as ProjectPostBodyBody, aC as ProjectPostResponse, a6 as ProjectDetail, I as ProjectPatchBodyBody, a0 as TaskIdentity, h as GetProjectFileParams, J as ProjectFilePutBodyBody } from '../custom-instance-9873bed3';
1
+ import { bb as customInstance, aF as ProjectsGetResponse, bc as ErrorType, b7 as DmError, H as ProjectPostBodyBody, aG as ProjectPostResponse, a8 as ProjectDetail, I as ProjectPatchBodyBody, a2 as TaskIdentity, g as GetProjectFileParams, J as ProjectFilePutBodyBody } from '../custom-instance-eb1ebf45';
2
2
  import * as react_query from 'react-query';
3
3
  import { UseQueryOptions, QueryKey, UseQueryResult, UseMutationOptions } from 'react-query';
4
4
  import 'axios';
@@ -16,8 +16,9 @@ import {
16
16
  QueryKey,
17
17
  } from "react-query";
18
18
  import type {
19
- AccountServerGetHostanmeResponse,
19
+ AccountServerGetNamespaceResponse,
20
20
  DmError,
21
+ VersionGetResponse,
21
22
  } from "../data-manager-api.schemas";
22
23
  import { customInstance, ErrorType } from ".././custom-instance";
23
24
 
@@ -37,29 +38,29 @@ type SecondParameter<T extends (...args: any) => any> = T extends (
37
38
  : never;
38
39
 
39
40
  /**
40
- * If an Account Server is configured its hostanme, e.g. `example.com`, is returned, otherwise an empty string is returned
41
+ * If an Account Server is configured its namespace, e.g. `account-server`, is returned, otherwise an empty string is returned
41
42
 
42
- * @summary Gets the Account Server hostname
43
+ * @summary Gets the Account Server cluster namespace
43
44
  */
44
- export const getAccountServerHostname = (
45
+ export const getAccountServerNamespace = (
45
46
  options?: SecondParameter<typeof customInstance>
46
47
  ) => {
47
- return customInstance<AccountServerGetHostanmeResponse>(
48
- { url: `/account-server/hostname`, method: "get" },
48
+ return customInstance<AccountServerGetNamespaceResponse>(
49
+ { url: `/account-server/namespace`, method: "get" },
49
50
  options
50
51
  );
51
52
  };
52
53
 
53
- export const getGetAccountServerHostnameQueryKey = () => [
54
- `/account-server/hostname`,
54
+ export const getGetAccountServerNamespaceQueryKey = () => [
55
+ `/account-server/namespace`,
55
56
  ];
56
57
 
57
- export const useGetAccountServerHostname = <
58
- TData = AsyncReturnType<typeof getAccountServerHostname>,
58
+ export const useGetAccountServerNamespace = <
59
+ TData = AsyncReturnType<typeof getAccountServerNamespace>,
59
60
  TError = ErrorType<void | DmError>
60
61
  >(options?: {
61
62
  query?: UseQueryOptions<
62
- AsyncReturnType<typeof getAccountServerHostname>,
63
+ AsyncReturnType<typeof getAccountServerNamespace>,
63
64
  TError,
64
65
  TData
65
66
  >;
@@ -68,14 +69,14 @@ export const useGetAccountServerHostname = <
68
69
  const { query: queryOptions, request: requestOptions } = options || {};
69
70
 
70
71
  const queryKey =
71
- queryOptions?.queryKey ?? getGetAccountServerHostnameQueryKey();
72
+ queryOptions?.queryKey ?? getGetAccountServerNamespaceQueryKey();
72
73
 
73
74
  const queryFn: QueryFunction<
74
- AsyncReturnType<typeof getAccountServerHostname>
75
- > = () => getAccountServerHostname(requestOptions);
75
+ AsyncReturnType<typeof getAccountServerNamespace>
76
+ > = () => getAccountServerNamespace(requestOptions);
76
77
 
77
78
  const query = useQuery<
78
- AsyncReturnType<typeof getAccountServerHostname>,
79
+ AsyncReturnType<typeof getAccountServerNamespace>,
79
80
  TError,
80
81
  TData
81
82
  >(queryKey, queryFn, queryOptions);
@@ -85,3 +86,43 @@ export const useGetAccountServerHostname = <
85
86
  ...query,
86
87
  };
87
88
  };
89
+
90
+ /**
91
+ * @summary Gets the Data Manager version that's running behind the API
92
+ */
93
+ export const getVersion = (
94
+ options?: SecondParameter<typeof customInstance>
95
+ ) => {
96
+ return customInstance<VersionGetResponse>(
97
+ { url: `/version`, method: "get" },
98
+ options
99
+ );
100
+ };
101
+
102
+ export const getGetVersionQueryKey = () => [`/version`];
103
+
104
+ export const useGetVersion = <
105
+ TData = AsyncReturnType<typeof getVersion>,
106
+ TError = ErrorType<void | DmError>
107
+ >(options?: {
108
+ query?: UseQueryOptions<AsyncReturnType<typeof getVersion>, TError, TData>;
109
+ request?: SecondParameter<typeof customInstance>;
110
+ }): UseQueryResult<TData, TError> & { queryKey: QueryKey } => {
111
+ const { query: queryOptions, request: requestOptions } = options || {};
112
+
113
+ const queryKey = queryOptions?.queryKey ?? getGetVersionQueryKey();
114
+
115
+ const queryFn: QueryFunction<AsyncReturnType<typeof getVersion>> = () =>
116
+ getVersion(requestOptions);
117
+
118
+ const query = useQuery<AsyncReturnType<typeof getVersion>, TError, TData>(
119
+ queryKey,
120
+ queryFn,
121
+ queryOptions
122
+ );
123
+
124
+ return {
125
+ queryKey,
126
+ ...query,
127
+ };
128
+ };
@@ -25,6 +25,7 @@ import type {
25
25
  AdminUserPutResponse,
26
26
  UserPatchBodyBody,
27
27
  AdminJobManifestLoadPutResponse,
28
+ JobManifestPutBodyBody,
28
29
  } from "../data-manager-api.schemas";
29
30
  import { customInstance, ErrorType } from ".././custom-instance";
30
31
 
@@ -340,6 +341,64 @@ export const useAdminPatchUser = <
340
341
  TContext
341
342
  >(mutationFn, mutationOptions);
342
343
  };
344
+ /**
345
+ * This endpoint is used to add (or update an existing manifest). Manifests are the soirce of Job defintions. Once added the manifest is inspected and any Jobs it refers to are loaded.
346
+
347
+ A limited number of manifest origins (URLs) are supported. At the moment we support basic GitHib and GitLab URLs, i.e. those that begin `https://raw.githubusercontent.com/` and `https://gitlab.com/api/v4/projects/`.
348
+
349
+ You will need **admin** rights to use this endpoint
350
+
351
+ * @summary Adds a manifest and triggers the download of Job Definitions
352
+ */
353
+ export const adminJobManifestPut = (
354
+ jobManifestPutBodyBody: JobManifestPutBodyBody,
355
+ options?: SecondParameter<typeof customInstance>
356
+ ) => {
357
+ const formData = new FormData();
358
+ formData.append("url", jobManifestPutBodyBody.url);
359
+ if (jobManifestPutBodyBody.header !== undefined) {
360
+ formData.append("header", jobManifestPutBodyBody.header);
361
+ }
362
+ if (jobManifestPutBodyBody.params !== undefined) {
363
+ formData.append("params", jobManifestPutBodyBody.params);
364
+ }
365
+
366
+ return customInstance<AdminJobManifestLoadPutResponse>(
367
+ { url: `/admin/job-manifest`, method: "put", data: formData },
368
+ options
369
+ );
370
+ };
371
+
372
+ export const useAdminJobManifestPut = <
373
+ TError = ErrorType<void | DmError>,
374
+ TContext = unknown
375
+ >(options?: {
376
+ mutation?: UseMutationOptions<
377
+ AsyncReturnType<typeof adminJobManifestPut>,
378
+ TError,
379
+ { data: JobManifestPutBodyBody },
380
+ TContext
381
+ >;
382
+ request?: SecondParameter<typeof customInstance>;
383
+ }) => {
384
+ const { mutation: mutationOptions, request: requestOptions } = options || {};
385
+
386
+ const mutationFn: MutationFunction<
387
+ AsyncReturnType<typeof adminJobManifestPut>,
388
+ { data: JobManifestPutBodyBody }
389
+ > = (props) => {
390
+ const { data } = props || {};
391
+
392
+ return adminJobManifestPut(data, requestOptions);
393
+ };
394
+
395
+ return useMutation<
396
+ AsyncReturnType<typeof adminJobManifestPut>,
397
+ TError,
398
+ { data: JobManifestPutBodyBody },
399
+ TContext
400
+ >(mutationFn, mutationOptions);
401
+ };
343
402
  /**
344
403
  * This endpoint is used to trigger the Data Manager to re-inspect the internal Job **Manifest** table and download the manifests and reprocess the related job definitions. This is normally done by an administrator when the Manifest table has been modified or if external job defitnions are known to have changed in the referenced repositories.
345
404
 
@@ -17,10 +17,6 @@ export type GetUserApiLogParams = {
17
17
  until?: QUntilParameter;
18
18
  };
19
19
 
20
- export type GetUserAccountParams = {
21
- do_not_impersonate?: QDoNotImpersonateParameter;
22
- };
23
-
24
20
  export type PatchInstanceParams = { archive?: QInstanceArchiveParameter };
25
21
 
26
22
  export type GetInstancesParams = { project_id?: QProjectIdParameter };
@@ -189,6 +185,10 @@ export type QDatasetMimeTypeParameter = string;
189
185
  */
190
186
  export type QDoNotImpersonateParameter = boolean;
191
187
 
188
+ export type GetUserAccountParams = {
189
+ do_not_impersonate?: QDoNotImpersonateParameter;
190
+ };
191
+
192
192
  export type UserPatchBodyBody = {
193
193
  /** If set to a message the user account is suspended, with the user receiving this message when they try and use the API. A suspended user accont can be restored by setting the message to `/restore`
194
194
  */
@@ -243,6 +243,15 @@ export type ProjectFilePutBodyBody = {
243
243
  path?: string;
244
244
  };
245
245
 
246
+ export type JobManifestPutBodyBody = {
247
+ /** The URL of the Job Manifest */
248
+ url: string;
249
+ /** Optional URL header values (a JSON string) */
250
+ header?: string;
251
+ /** Optional URL parameter values (a JSON string) */
252
+ params?: string;
253
+ };
254
+
246
255
  export type InstancePostBodyBody = {
247
256
  /** A supported application. Applications instances are managed using pre-deployed Kubernetes **Operators**. The application ID is a combination of the operator _plural_ and _group_.
248
257
  */
@@ -256,6 +265,12 @@ export type InstancePostBodyBody = {
256
265
  /** The name to use for the instance
257
266
  */
258
267
  as_name: string;
268
+ /** A URL the DM will use to PUT job progress messages as the requested instance runs. Used, at the moment, for Job execution
269
+ */
270
+ callback_url?: string;
271
+ /** Used in conjunction with the `callback_url` any value provided here will be passed back in the message payload that's delivered to the callback URL. It can be used by the recipient to provide a context that's meaningful
272
+ */
273
+ callback_context?: string;
259
274
  /** A debug value that may be used by the instance.
260
275
 
261
276
  For Data Manager **Job** applications setting this to anything other zero ('0') prevents the Job's Pod from being deleted automatically, allowing a developer to inspect the Pod's log for example.
@@ -265,11 +280,11 @@ The behaviour of **Application** instances using this property is undefined. It
265
280
  debug?: string;
266
281
  /** The instance specification. A JSON string that's application-specific and controls the application's behaviour.
267
282
 
268
- When laucnhing a Data Manager **Job** Application you must identify the Job using the properties `collection`, `job` and `version`, e.g. `{"collection":"blob","job":"filter","version":"1.0.0"}`
283
+ When laucnhing a Data Manager **Job** Application you must identify the Job using the properties `collection`, `job` and `version`, e.g. `{"collection":"im-test","job":"nop","version":"1.0.0"}`
269
284
 
270
285
  Jobs that offer commands will often advertise a series of **inputs** and **options** where the values can be provided using a **variables** map in the specification. Something like `"variables":{"x":7}`.
271
286
 
272
- Jobs start in a Job-specific **working directory** but the starting directory for any Job can be adjusted by defining a `sub_path`. For example, if you want the Job to start in the path `foo/bar` (inside the Job's built-in working directory) you can provide `"sub_path":"foo/bar"` in the specification. In this instance the Job will start in the directory `/data/foo/bar` with the Data Manager creating the directory if it does not exist. You can only use a sub-path for a Job if the Job defines a working directory.
287
+ Jobs start in a Job-specific **working directory** but the starting directory for any Job can be adjusted by defining a `sub_path` to the root specification. For example, if you want the Job to start in the path `foo/bar` (inside the Job's built-in working directory) you can add `"sub_path":"foo/bar"` to the specification. You can only use a sub-path for a Job if the Job defines a working directory and `sub-path` cannot begin or end with a path separator (`/`).
273
288
  */
274
289
  specification?: string;
275
290
  };
@@ -328,10 +343,22 @@ export type DatasetPutBodyBody = {
328
343
  unit_id?: string;
329
344
  };
330
345
 
331
- export type DatasetAnnotationsPostBodyBody = {
332
- /** JSON string containing a list of annotations. The format of these annotations is expected to have been created using the data-manager-metadata library. The same library will be used to created the annotation object(s) that is added to the metadata for the dataset, so the formats should match.
346
+ export type DatasetVersionMetaPostBodyBody = {
347
+ /** JSON string containing a list of parameter changes to the metadata. Only the description is currently allowed.
333
348
  */
334
- annotations: string;
349
+ meta_properties?: string;
350
+ /** JSON string containing a list of annotations. The format of the labels should match either the Fields Descriptor or Service Execution annotation formats described in the data-manager-metadata library.
351
+ */
352
+ annotations?: string;
353
+ };
354
+
355
+ export type DatasetMetaPostBodyBody = {
356
+ /** JSON string containing a list of parameter changes to the metadata. Only the description is currently allowed.
357
+ */
358
+ meta_properties?: string;
359
+ /** JSON string containing a list of labels. The format of the labels should match the label annotation format described in the data-manager-metadata library.
360
+ */
361
+ labels?: string;
335
362
  };
336
363
 
337
364
  export type DatasetPostBodyBody = {
@@ -730,6 +757,33 @@ export const InstanceSummaryJobImageType = {
730
757
  NEXTFLOW: "NEXTFLOW" as InstanceSummaryJobImageType,
731
758
  };
732
759
 
760
+ /**
761
+ * The phase of the application. This is a string, one of a limited number of values that are defined internally within the Data Manager.
762
+ The initial phase, indicating that the Instance is preparring to run, is `PENDING`. The instance is running when the phase is `RUNNING`. `COMPLETED` indicates the Instance has finished successfully and `FAILED` when it's finished but unsuccesfully.
763
+
764
+ */
765
+ export type InstanceSummaryPhase =
766
+ | "COMPLETED"
767
+ | "CRASH_LOOP_BACKOFF"
768
+ | "FAILED"
769
+ | "IMAGE_PULL_BACKOFF"
770
+ | "PENDING"
771
+ | "RUNNING"
772
+ | "SUCCEEDED"
773
+ | "UNKNOWN";
774
+
775
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
776
+ export const InstanceSummaryPhase = {
777
+ COMPLETED: "COMPLETED" as InstanceSummaryPhase,
778
+ CRASH_LOOP_BACKOFF: "CRASH_LOOP_BACKOFF" as InstanceSummaryPhase,
779
+ FAILED: "FAILED" as InstanceSummaryPhase,
780
+ IMAGE_PULL_BACKOFF: "IMAGE_PULL_BACKOFF" as InstanceSummaryPhase,
781
+ PENDING: "PENDING" as InstanceSummaryPhase,
782
+ RUNNING: "RUNNING" as InstanceSummaryPhase,
783
+ SUCCEEDED: "SUCCEEDED" as InstanceSummaryPhase,
784
+ UNKNOWN: "UNKNOWN" as InstanceSummaryPhase,
785
+ };
786
+
733
787
  /**
734
788
  * The type of Application, which can be a `job` or an `application`
735
789
 
@@ -762,8 +816,9 @@ export interface InstanceSummary {
762
816
  */
763
817
  authorisation_code?: number;
764
818
  /** The phase of the application. This is a string, one of a limited number of values that are defined internally within the Data Manager.
765
- */
766
- phase: string;
819
+ The initial phase, indicating that the Instance is preparring to run, is `PENDING`. The instance is running when the phase is `RUNNING`. `COMPLETED` indicates the Instance has finished successfully and `FAILED` when it's finished but unsuccesfully.
820
+ */
821
+ phase: InstanceSummaryPhase;
767
822
  /** The data and time (UTC) the instance was laucnhed
768
823
  */
769
824
  launched: string;
@@ -1074,6 +1129,12 @@ export interface ApiLogDetail {
1074
1129
  impersonator?: string;
1075
1130
  }
1076
1131
 
1132
+ export interface VersionGetResponse {
1133
+ /** The Data Manager version. This is guaranteed to be a valid semantic version for official (tagged) images. The version value format for unofficial images is a string but otherwise undefined
1134
+ */
1135
+ version: string;
1136
+ }
1137
+
1077
1138
  export interface UsersGetResponse {
1078
1139
  /** A list of Users that have used the Data Manager
1079
1140
  */
@@ -1260,6 +1321,33 @@ export interface InstancesGetResponse {
1260
1321
  instances: InstanceSummary[];
1261
1322
  }
1262
1323
 
1324
+ /**
1325
+ * The phase of the application. This is a string, one of a limited number of values that are defined internally within the Data Manager.
1326
+ The initial phase, indicating that the Instance is preparring to run, is `PENDING`. The instance is running when the phase is `RUNNING`. `COMPLETED` indicates the Instance has finished successfully and `FAILED` when it's finished but unsuccesfully.
1327
+
1328
+ */
1329
+ export type InstanceGetResponsePhase =
1330
+ | "COMPLETED"
1331
+ | "CRASH_LOOP_BACKOFF"
1332
+ | "FAILED"
1333
+ | "IMAGE_PULL_BACKOFF"
1334
+ | "PENDING"
1335
+ | "RUNNING"
1336
+ | "SUCCEEDED"
1337
+ | "UNKNOWN";
1338
+
1339
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
1340
+ export const InstanceGetResponsePhase = {
1341
+ COMPLETED: "COMPLETED" as InstanceGetResponsePhase,
1342
+ CRASH_LOOP_BACKOFF: "CRASH_LOOP_BACKOFF" as InstanceGetResponsePhase,
1343
+ FAILED: "FAILED" as InstanceGetResponsePhase,
1344
+ IMAGE_PULL_BACKOFF: "IMAGE_PULL_BACKOFF" as InstanceGetResponsePhase,
1345
+ PENDING: "PENDING" as InstanceGetResponsePhase,
1346
+ RUNNING: "RUNNING" as InstanceGetResponsePhase,
1347
+ SUCCEEDED: "SUCCEEDED" as InstanceGetResponsePhase,
1348
+ UNKNOWN: "UNKNOWN" as InstanceGetResponsePhase,
1349
+ };
1350
+
1263
1351
  /**
1264
1352
  * The type of Application, which can be a `job` or an `application`
1265
1353
 
@@ -1301,8 +1389,9 @@ export interface InstanceGetResponse {
1301
1389
  */
1302
1390
  launched: string;
1303
1391
  /** The phase of the application. This is a string, one of a limited number of values that are defined internally within the Data Manager.
1304
- */
1305
- phase: string;
1392
+ The initial phase, indicating that the Instance is preparring to run, is `PENDING`. The instance is running when the phase is `RUNNING`. `COMPLETED` indicates the Instance has finished successfully and `FAILED` when it's finished but unsuccesfully.
1393
+ */
1394
+ phase: InstanceGetResponsePhase;
1306
1395
  /** The application endpoint
1307
1396
  */
1308
1397
  url?: string;
@@ -1417,6 +1506,9 @@ export interface DatasetMetaGetResponse {
1417
1506
  /** The Metadata's annotations
1418
1507
  */
1419
1508
  annotations: unknown[];
1509
+ /** The Metadata's labels
1510
+ */
1511
+ labels: unknown[];
1420
1512
  }
1421
1513
 
1422
1514
  export interface DatasetDigestGetResponse {
@@ -1440,10 +1532,6 @@ export interface DatasetPutPostResponse {
1440
1532
  task_id: string;
1441
1533
  }
1442
1534
 
1443
- export interface DatasetAnnotationsPostResponse {
1444
- annotations: unknown[];
1445
- }
1446
-
1447
1535
  export interface ApplicationsGetResponse {
1448
1536
  /** A list of installed appications, which are application-compliant Kubernetes "operators"
1449
1537
  */
@@ -1488,10 +1576,10 @@ export interface AdminJobManifestLoadPutResponse {
1488
1576
  jobs_inspected: number;
1489
1577
  }
1490
1578
 
1491
- export interface AccountServerGetHostanmeResponse {
1492
- /** The configured Account Server hostname, which will be an empty string if one is not configured
1579
+ export interface AccountServerGetNamespaceResponse {
1580
+ /** The configured Account Server namespace, which will be an empty string if one is not configured. The AS API is expected as the service `as-api` in this namespace.
1493
1581
  */
1494
- hostname: string;
1582
+ namespace: string;
1495
1583
  /** The name of this Data Manager instance, used to distinguish itself on calls to the Account Server. Every Data Manager is deployed with a unique name, regardless of the Account Server that's being used.
1496
1584
  */
1497
1585
  data_manager_name: string;
@@ -68,6 +68,12 @@ export const createInstance = (
68
68
  );
69
69
  formData.append("project_id", instancePostBodyBody.project_id);
70
70
  formData.append("as_name", instancePostBodyBody.as_name);
71
+ if (instancePostBodyBody.callback_url !== undefined) {
72
+ formData.append("callback_url", instancePostBodyBody.callback_url);
73
+ }
74
+ if (instancePostBodyBody.callback_context !== undefined) {
75
+ formData.append("callback_context", instancePostBodyBody.callback_context);
76
+ }
71
77
  if (instancePostBodyBody.debug !== undefined) {
72
78
  formData.append("debug", instancePostBodyBody.debug);
73
79
  }