@hautechai/sdk 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,14 @@
1
+ import { AccountEntity } from '../../autogenerated';
1
2
  import { SDKOptions } from '../../types';
2
3
  declare const accounts: (options: SDKOptions) => {
3
4
  create: (props?: {
4
5
  alias?: string;
5
- }) => Promise<import("../../autogenerated").AccountEntity>;
6
+ }) => Promise<AccountEntity>;
6
7
  get: (props: {
7
8
  id: string;
8
- }) => Promise<import("../../autogenerated").AccountEntity | undefined>;
9
+ }) => Promise<AccountEntity | undefined>;
9
10
  getByAlias: (props: {
10
11
  alias: string;
11
- }) => Promise<import("../../autogenerated").AccountEntity | undefined>;
12
+ }) => Promise<AccountEntity | undefined>;
12
13
  };
13
14
  export default accounts;
@@ -1,12 +1,12 @@
1
- import { SDKOptions, ListProps } from '../../types';
2
- import { CollectionsControllerListItemsV1KindEnum } from '../../autogenerated';
1
+ import { SDKOptions, ListProps, ListResponse } from '../../types';
2
+ import { CollectionEntity, CollectionsControllerListItemsV1KindEnum, ResourceEntity } from '../../autogenerated';
3
3
  declare const collections: (options: SDKOptions) => {
4
4
  create: (props?: {
5
5
  metadata?: any;
6
- }) => Promise<import("../../types").CollectionEntity>;
6
+ }) => Promise<CollectionEntity>;
7
7
  get: (props: {
8
8
  id: string;
9
- }) => Promise<import("../../types").CollectionEntity | undefined>;
9
+ }) => Promise<CollectionEntity | undefined>;
10
10
  items: {
11
11
  add: (props: {
12
12
  collectionId: string;
@@ -15,16 +15,16 @@ declare const collections: (options: SDKOptions) => {
15
15
  list: (props: {
16
16
  collectionId: string;
17
17
  kind?: CollectionsControllerListItemsV1KindEnum;
18
- } & ListProps) => Promise<import("../../autogenerated").ListCollectionItemsDto>;
18
+ } & ListProps) => Promise<ListResponse<ResourceEntity>>;
19
19
  remove: (props: {
20
20
  collectionId: string;
21
21
  itemIds: string[];
22
22
  }) => Promise<void>;
23
23
  };
24
- list: (props?: ListProps) => Promise<import("../../autogenerated").ListCollectionsDto>;
24
+ list: (props?: ListProps) => Promise<ListResponse<CollectionEntity>>;
25
25
  updateMetadata: (props: {
26
26
  id: string;
27
27
  metadata?: any;
28
- }) => Promise<import("../../types").ResourceEntity>;
28
+ }) => Promise<void>;
29
29
  };
30
30
  export default collections;
@@ -1,5 +1,6 @@
1
- import { CollectionsApi } from '../../autogenerated';
1
+ import { CollectionsApi, } from '../../autogenerated';
2
2
  import { useAutogeneratedAPI } from '../api';
3
+ import { transformToListResponse } from '../transformers';
3
4
  const collections = (options) => {
4
5
  const api = useAutogeneratedAPI({ API: CollectionsApi, options });
5
6
  return {
@@ -15,6 +16,7 @@ const collections = (options) => {
15
16
  }),
16
17
  list: async (props) => api.call({
17
18
  run: (methods) => methods.collectionsControllerListItemsV1(props.collectionId, props.cursor, props.orderBy, props.limit, props.kind),
19
+ transform: transformToListResponse,
18
20
  }),
19
21
  remove: async (props) => api.call({
20
22
  run: (methods) => methods.collectionsControllerRemoveItemsV1(props.collectionId, { itemIds: props.itemIds }),
@@ -22,6 +24,7 @@ const collections = (options) => {
22
24
  },
23
25
  list: async (props = {}) => api.call({
24
26
  run: (methods) => methods.collectionsControllerListCollectionsV1(props.orderBy, props.limit, props.cursor),
27
+ transform: transformToListResponse,
25
28
  }),
26
29
  updateMetadata: async (props) => api.call({
27
30
  run: (methods) => methods.collectionsControllerUpdateMetadataV1(props.id, { overwrite: props.metadata }),
@@ -1,5 +1,5 @@
1
1
  import { SDKOptions } from '../../types';
2
- import { AddAccountToGroupControllerParamsDtoRoleEnum, RemoveAccountFromGroupControllerParamsDtoRoleEnum } from '../../autogenerated';
2
+ import { AddAccountToGroupControllerParamsDtoRoleEnum, GroupEntity, RemoveAccountFromGroupControllerParamsDtoRoleEnum } from '../../autogenerated';
3
3
  declare const groups: (options: SDKOptions) => {
4
4
  accounts: {
5
5
  add: (props: {
@@ -13,12 +13,12 @@ declare const groups: (options: SDKOptions) => {
13
13
  role: RemoveAccountFromGroupControllerParamsDtoRoleEnum;
14
14
  }) => Promise<void>;
15
15
  };
16
- create: () => Promise<import("../../types").GroupEntity>;
16
+ create: () => Promise<GroupEntity>;
17
17
  delete: (props: {
18
18
  id: string;
19
19
  }) => Promise<void>;
20
20
  get: (props: {
21
21
  id: string;
22
- }) => Promise<import("../../types").GroupEntity | undefined>;
22
+ }) => Promise<GroupEntity | undefined>;
23
23
  };
24
24
  export default groups;
@@ -1,14 +1,15 @@
1
1
  import { SDKOptions } from '../../types';
2
+ import { ImageEntity } from '../../autogenerated';
2
3
  declare const images: (options: SDKOptions) => {
3
4
  createFromFile: (props: {
4
5
  file: any;
5
- }) => Promise<import("../../types").ImageEntity>;
6
+ }) => Promise<ImageEntity>;
6
7
  createFromUrl: (props: {
7
8
  url: string;
8
- }) => Promise<import("../../types").ImageEntity>;
9
+ }) => Promise<ImageEntity>;
9
10
  get: (props: {
10
11
  id: string;
11
- }) => Promise<import("../../types").ImageEntity | undefined>;
12
+ }) => Promise<ImageEntity | undefined>;
12
13
  getUrls: (props: {
13
14
  ids: string[];
14
15
  }) => Promise<Record<string, string>>;
@@ -36,17 +36,17 @@ export declare const createSDK: (options: SDKOptions) => {
36
36
  list: (props: {
37
37
  collectionId: string;
38
38
  kind?: import("../autogenerated").CollectionsControllerListItemsV1KindEnum;
39
- } & import("../types").ListProps) => Promise<import("../autogenerated").ListCollectionItemsDto>;
39
+ } & import("../types").ListProps) => Promise<import("../types").ListResponse<import("../types").ResourceEntity>>;
40
40
  remove: (props: {
41
41
  collectionId: string;
42
42
  itemIds: string[];
43
43
  }) => Promise<void>;
44
44
  };
45
- list: (props?: import("../types").ListProps) => Promise<import("../autogenerated").ListCollectionsDto>;
45
+ list: (props?: import("../types").ListProps) => Promise<import("../types").ListResponse<import("../types").CollectionEntity>>;
46
46
  updateMetadata: (props: {
47
47
  id: string;
48
48
  metadata?: any;
49
- }) => Promise<import("../types").ResourceEntity>;
49
+ }) => Promise<void>;
50
50
  };
51
51
  groups: {
52
52
  accounts: {
@@ -144,11 +144,11 @@ export declare const createSDK: (options: SDKOptions) => {
144
144
  getMany: (props: {
145
145
  ids: string[];
146
146
  }) => Promise<import("../types").OperationEntity[]>;
147
- list: (props?: import("../types").ListProps) => Promise<import("../autogenerated").ListOperationsDto>;
147
+ list: (props?: import("../types").ListProps) => Promise<import("../types").ListResponse<import("../types").OperationEntity>>;
148
148
  updateMetadata: (props: {
149
149
  id: string;
150
150
  metadata?: any;
151
- }) => Promise<import("../types").ResourceEntity>;
151
+ }) => Promise<void>;
152
152
  updates: {
153
153
  subscribe: (props: {
154
154
  callback: (operation: import("../types").OperationEntity) => void;
@@ -160,7 +160,7 @@ export declare const createSDK: (options: SDKOptions) => {
160
160
  wait: (props: {
161
161
  id: string;
162
162
  timeoutInSeconds?: number;
163
- }) => Promise<unknown>;
163
+ }) => Promise<import("../types").OperationEntity>;
164
164
  };
165
165
  stacks: {
166
166
  create: (props?: {
@@ -169,7 +169,7 @@ export declare const createSDK: (options: SDKOptions) => {
169
169
  get: (props: {
170
170
  id: string;
171
171
  }) => Promise<import("../types").StackEntity | undefined>;
172
- list: (props?: import("../types").ListProps) => Promise<import("../autogenerated").ListStacksDto>;
172
+ list: (props?: import("../types").ListProps) => Promise<import("../types").ListResponse<import("../types").StackEntity>>;
173
173
  operations: {
174
174
  add: (props: {
175
175
  operationIds: string[];
@@ -178,12 +178,12 @@ export declare const createSDK: (options: SDKOptions) => {
178
178
  remove: (props: {
179
179
  operationIds: string[];
180
180
  stackId: string;
181
- }) => Promise<import("../types").StackEntity>;
181
+ }) => Promise<void>;
182
182
  };
183
183
  updateMetadata: (props: {
184
184
  id: string;
185
185
  metadata?: any;
186
- }) => Promise<import("../types").ResourceEntity>;
186
+ }) => Promise<void>;
187
187
  };
188
188
  storage: {
189
189
  create: (props: {
@@ -1,5 +1,5 @@
1
1
  import { GenerateV1Input, GenerateV3Input, GPTV1Input, ImagineV1Input, InpaintV1Input, ObjectDetectionV1Input, OperationEntity, PoseEstimationV1Input, SegmentAnythingEmbeddingsV1Input, UpscaleV1Input } from '../../autogenerated';
2
- import { ListProps, SDKOptions } from '../../types';
2
+ import { ListProps, ListResponse, SDKOptions } from '../../types';
3
3
  declare const operations: (options: SDKOptions) => {
4
4
  create: {
5
5
  detect: {
@@ -61,11 +61,11 @@ declare const operations: (options: SDKOptions) => {
61
61
  getMany: (props: {
62
62
  ids: string[];
63
63
  }) => Promise<OperationEntity[]>;
64
- list: (props?: ListProps) => Promise<import("../../autogenerated").ListOperationsDto>;
64
+ list: (props?: ListProps) => Promise<ListResponse<OperationEntity>>;
65
65
  updateMetadata: (props: {
66
66
  id: string;
67
67
  metadata?: any;
68
- }) => Promise<import("../../autogenerated").ResourceEntity>;
68
+ }) => Promise<void>;
69
69
  updates: {
70
70
  subscribe: (props: {
71
71
  callback: (operation: OperationEntity) => void;
@@ -77,6 +77,6 @@ declare const operations: (options: SDKOptions) => {
77
77
  wait: (props: {
78
78
  id: string;
79
79
  timeoutInSeconds?: number;
80
- }) => Promise<unknown>;
80
+ }) => Promise<OperationEntity>;
81
81
  };
82
82
  export default operations;
@@ -1,6 +1,7 @@
1
1
  import createOperationUpdater from './updater';
2
2
  import { OperationsApi, } from '../../autogenerated';
3
3
  import { useAutogeneratedAPI } from '../api';
4
+ import { transformToListResponse } from '../transformers';
4
5
  const operations = (options) => {
5
6
  const api = useAutogeneratedAPI({ API: OperationsApi, options });
6
7
  const updates = createOperationUpdater(options);
@@ -41,6 +42,7 @@ const operations = (options) => {
41
42
  }),
42
43
  list: (props = {}) => api.call({
43
44
  run: (methods) => methods.operationsControllerListOperationsV1(props.orderBy, props.limit, props.cursor),
45
+ transform: transformToListResponse,
44
46
  }),
45
47
  updateMetadata: async (props) => api.call({
46
48
  run: (methods) => methods.operationsControllerUpdateMetadataV1(props.id, { overwrite: props.metadata }),
@@ -1,12 +1,13 @@
1
- import { SDKOptions, ListProps } from '../../types';
1
+ import { SDKOptions, ListProps, ListResponse } from '../../types';
2
+ import { StackEntity } from '../../autogenerated';
2
3
  declare const stacks: (options: SDKOptions) => {
3
4
  create: (props?: {
4
5
  metadata?: any;
5
- }) => Promise<import("../../types").StackEntity>;
6
+ }) => Promise<StackEntity>;
6
7
  get: (props: {
7
8
  id: string;
8
- }) => Promise<import("../../types").StackEntity | undefined>;
9
- list: (props?: ListProps) => Promise<import("../../autogenerated").ListStacksDto>;
9
+ }) => Promise<StackEntity | undefined>;
10
+ list: (props?: ListProps) => Promise<ListResponse<StackEntity>>;
10
11
  operations: {
11
12
  add: (props: {
12
13
  operationIds: string[];
@@ -15,11 +16,11 @@ declare const stacks: (options: SDKOptions) => {
15
16
  remove: (props: {
16
17
  operationIds: string[];
17
18
  stackId: string;
18
- }) => Promise<import("../../types").StackEntity>;
19
+ }) => Promise<void>;
19
20
  };
20
21
  updateMetadata: (props: {
21
22
  id: string;
22
23
  metadata?: any;
23
- }) => Promise<import("../../types").ResourceEntity>;
24
+ }) => Promise<void>;
24
25
  };
25
26
  export default stacks;
@@ -1,5 +1,6 @@
1
1
  import { StacksApi } from '../../autogenerated';
2
2
  import { useAutogeneratedAPI } from '../api';
3
+ import { transformToListResponse } from '../transformers';
3
4
  const stacks = (options) => {
4
5
  const api = useAutogeneratedAPI({ API: StacksApi, options });
5
6
  return {
@@ -13,6 +14,7 @@ const stacks = (options) => {
13
14
  }),
14
15
  list: async (props = {}) => api.call({
15
16
  run: (methods) => methods.stacksControllerListStacksV1(props.orderBy, props.limit, props.cursor),
17
+ transform: transformToListResponse,
16
18
  }),
17
19
  operations: {
18
20
  add: async (props) => api.call({
@@ -0,0 +1,7 @@
1
+ import { ListResponse } from '../types';
2
+ export declare const transformToListResponse: <T>(response: {
3
+ data: T[];
4
+ pageInfo: {
5
+ nextCursor: string;
6
+ };
7
+ }) => ListResponse<T>;
@@ -0,0 +1,5 @@
1
+ export const transformToListResponse = (response) => {
2
+ const array = [...response.data];
3
+ array['nextCursor'] = response.pageInfo.nextCursor;
4
+ return array;
5
+ };
package/dist/types.d.ts CHANGED
@@ -7,6 +7,9 @@ export type ListProps = {
7
7
  limit?: number;
8
8
  orderBy?: 'createdAt_ASC' | 'createdAt_DESC' | 'updatedAt_ASC' | 'updatedAt_DESC';
9
9
  };
10
+ export type ListResponse<T> = T[] & {
11
+ nextCursor: string;
12
+ };
10
13
  type Add = {
11
14
  add: boolean;
12
15
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hautechai/sdk",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "license": "MIT",
5
5
  "keywords": [],
6
6
  "repository": {