@hautechai/sdk 0.0.5 → 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,11 +1,12 @@
1
- import { SDKOptions, ListProps } from '../../types';
1
+ import { SDKOptions, ListProps, ListResponse } from '../../types';
2
+ import { CollectionEntity, CollectionsControllerListItemsV1KindEnum, ResourceEntity } from '../../autogenerated';
2
3
  declare const collections: (options: SDKOptions) => {
3
4
  create: (props?: {
4
5
  metadata?: any;
5
- }) => Promise<import("../../types").CollectionEntity>;
6
+ }) => Promise<CollectionEntity>;
6
7
  get: (props: {
7
8
  id: string;
8
- }) => Promise<import("../../types").CollectionEntity | undefined>;
9
+ }) => Promise<CollectionEntity | undefined>;
9
10
  items: {
10
11
  add: (props: {
11
12
  collectionId: string;
@@ -13,16 +14,17 @@ declare const collections: (options: SDKOptions) => {
13
14
  }) => Promise<void>;
14
15
  list: (props: {
15
16
  collectionId: string;
16
- } & ListProps) => Promise<import("../../autogenerated").ListCollectionItemsDto>;
17
+ kind?: CollectionsControllerListItemsV1KindEnum;
18
+ } & ListProps) => Promise<ListResponse<ResourceEntity>>;
17
19
  remove: (props: {
18
20
  collectionId: string;
19
21
  itemIds: string[];
20
22
  }) => Promise<void>;
21
23
  };
22
- list: (props?: ListProps) => Promise<import("../../autogenerated").ListCollectionsDto>;
24
+ list: (props?: ListProps) => Promise<ListResponse<CollectionEntity>>;
23
25
  updateMetadata: (props: {
24
26
  id: string;
25
27
  metadata?: any;
26
- }) => Promise<import("../../types").ResourceEntity>;
28
+ }) => Promise<void>;
27
29
  };
28
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 {
@@ -14,7 +15,8 @@ const collections = (options) => {
14
15
  run: (methods) => methods.collectionsControllerAddItemsV1(props.collectionId, { itemIds: props.itemIds }),
15
16
  }),
16
17
  list: async (props) => api.call({
17
- run: (methods) => methods.collectionsControllerListItemsV1(props.collectionId, props.cursor, props.orderBy, props.limit),
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>>;
@@ -35,17 +35,18 @@ export declare const createSDK: (options: SDKOptions) => {
35
35
  }) => Promise<void>;
36
36
  list: (props: {
37
37
  collectionId: string;
38
- } & import("../types").ListProps) => Promise<import("../autogenerated").ListCollectionItemsDto>;
38
+ kind?: import("../autogenerated").CollectionsControllerListItemsV1KindEnum;
39
+ } & import("../types").ListProps) => Promise<import("../types").ListResponse<import("../types").ResourceEntity>>;
39
40
  remove: (props: {
40
41
  collectionId: string;
41
42
  itemIds: string[];
42
43
  }) => Promise<void>;
43
44
  };
44
- list: (props?: import("../types").ListProps) => Promise<import("../autogenerated").ListCollectionsDto>;
45
+ list: (props?: import("../types").ListProps) => Promise<import("../types").ListResponse<import("../types").CollectionEntity>>;
45
46
  updateMetadata: (props: {
46
47
  id: string;
47
48
  metadata?: any;
48
- }) => Promise<import("../types").ResourceEntity>;
49
+ }) => Promise<void>;
49
50
  };
50
51
  groups: {
51
52
  accounts: {
@@ -143,11 +144,11 @@ export declare const createSDK: (options: SDKOptions) => {
143
144
  getMany: (props: {
144
145
  ids: string[];
145
146
  }) => Promise<import("../types").OperationEntity[]>;
146
- list: (props?: import("../types").ListProps) => Promise<import("../autogenerated").ListOperationsDto>;
147
+ list: (props?: import("../types").ListProps) => Promise<import("../types").ListResponse<import("../types").OperationEntity>>;
147
148
  updateMetadata: (props: {
148
149
  id: string;
149
150
  metadata?: any;
150
- }) => Promise<import("../types").ResourceEntity>;
151
+ }) => Promise<void>;
151
152
  updates: {
152
153
  subscribe: (props: {
153
154
  callback: (operation: import("../types").OperationEntity) => void;
@@ -159,7 +160,7 @@ export declare const createSDK: (options: SDKOptions) => {
159
160
  wait: (props: {
160
161
  id: string;
161
162
  timeoutInSeconds?: number;
162
- }) => Promise<unknown>;
163
+ }) => Promise<import("../types").OperationEntity>;
163
164
  };
164
165
  stacks: {
165
166
  create: (props?: {
@@ -168,7 +169,7 @@ export declare const createSDK: (options: SDKOptions) => {
168
169
  get: (props: {
169
170
  id: string;
170
171
  }) => Promise<import("../types").StackEntity | undefined>;
171
- list: (props?: import("../types").ListProps) => Promise<import("../autogenerated").ListStacksDto>;
172
+ list: (props?: import("../types").ListProps) => Promise<import("../types").ListResponse<import("../types").StackEntity>>;
172
173
  operations: {
173
174
  add: (props: {
174
175
  operationIds: string[];
@@ -177,12 +178,12 @@ export declare const createSDK: (options: SDKOptions) => {
177
178
  remove: (props: {
178
179
  operationIds: string[];
179
180
  stackId: string;
180
- }) => Promise<import("../types").StackEntity>;
181
+ }) => Promise<void>;
181
182
  };
182
183
  updateMetadata: (props: {
183
184
  id: string;
184
185
  metadata?: any;
185
- }) => Promise<import("../types").ResourceEntity>;
186
+ }) => Promise<void>;
186
187
  };
187
188
  storage: {
188
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.5",
3
+ "version": "0.0.7",
4
4
  "license": "MIT",
5
5
  "keywords": [],
6
6
  "repository": {