@hautechai/sdk 0.3.47 → 1.0.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.
Files changed (65) hide show
  1. package/.github/workflows/release.yaml +152 -0
  2. package/CHANGELOG.md +1 -0
  3. package/package.json +49 -41
  4. package/release.config.cjs +39 -0
  5. package/scripts/generate-permissions.js +0 -0
  6. package/scripts/generate.sh +0 -0
  7. package/scripts/up-versions.sh +3 -0
  8. package/.github/workflows/main.yml +0 -38
  9. package/.github/workflows/test.yml +0 -38
  10. package/dist/autogenerated/api.d.ts +0 -11222
  11. package/dist/autogenerated/api.js +0 -11002
  12. package/dist/autogenerated/base.d.ts +0 -66
  13. package/dist/autogenerated/base.js +0 -59
  14. package/dist/autogenerated/common.d.ts +0 -65
  15. package/dist/autogenerated/common.js +0 -133
  16. package/dist/autogenerated/configuration.d.ts +0 -91
  17. package/dist/autogenerated/configuration.js +0 -39
  18. package/dist/autogenerated/index.d.ts +0 -13
  19. package/dist/autogenerated/index.js +0 -15
  20. package/dist/autogenerated/permissions.d.ts +0 -94
  21. package/dist/autogenerated/permissions.js +0 -1
  22. package/dist/index.d.ts +0 -3
  23. package/dist/index.js +0 -3
  24. package/dist/sdk/access/index.d.ts +0 -20
  25. package/dist/sdk/access/index.js +0 -23
  26. package/dist/sdk/accounts/index.d.ts +0 -16
  27. package/dist/sdk/accounts/index.js +0 -25
  28. package/dist/sdk/api.d.ts +0 -20
  29. package/dist/sdk/api.js +0 -33
  30. package/dist/sdk/balances/index.d.ts +0 -12
  31. package/dist/sdk/balances/index.js +0 -19
  32. package/dist/sdk/collections/index.d.ts +0 -33
  33. package/dist/sdk/collections/index.js +0 -34
  34. package/dist/sdk/errors/index.d.ts +0 -3
  35. package/dist/sdk/errors/index.js +0 -6
  36. package/dist/sdk/groups/index.d.ts +0 -24
  37. package/dist/sdk/groups/index.js +0 -31
  38. package/dist/sdk/images/index.d.ts +0 -17
  39. package/dist/sdk/images/index.js +0 -35
  40. package/dist/sdk/index.d.ts +0 -1585
  41. package/dist/sdk/index.js +0 -69
  42. package/dist/sdk/listeners/index.d.ts +0 -28
  43. package/dist/sdk/listeners/index.js +0 -104
  44. package/dist/sdk/operations/index.d.ts +0 -199
  45. package/dist/sdk/operations/index.js +0 -133
  46. package/dist/sdk/pipelines/index.d.ts +0 -1189
  47. package/dist/sdk/pipelines/index.js +0 -208
  48. package/dist/sdk/pipelines/pipelines.d.ts +0 -0
  49. package/dist/sdk/pipelines/pipelines.js +0 -1
  50. package/dist/sdk/poses/index.d.ts +0 -20
  51. package/dist/sdk/poses/index.js +0 -24
  52. package/dist/sdk/stacks/index.d.ts +0 -29
  53. package/dist/sdk/stacks/index.js +0 -32
  54. package/dist/sdk/storage/index.d.ts +0 -18
  55. package/dist/sdk/storage/index.js +0 -27
  56. package/dist/sdk/transformers.d.ts +0 -7
  57. package/dist/sdk/transformers.js +0 -6
  58. package/dist/sdk/utils/index.d.ts +0 -10
  59. package/dist/sdk/utils/index.js +0 -6
  60. package/dist/sdk/videos/index.d.ts +0 -11
  61. package/dist/sdk/videos/index.js +0 -15
  62. package/dist/token/index.d.ts +0 -15
  63. package/dist/token/index.js +0 -65
  64. package/dist/types.d.ts +0 -15
  65. package/dist/types.js +0 -5
package/dist/sdk/api.d.ts DELETED
@@ -1,20 +0,0 @@
1
- import { AxiosPromise } from 'axios';
2
- import { BaseAPI } from '../autogenerated/base';
3
- import { SDKOptions } from '../types';
4
- import { Configuration } from '../autogenerated';
5
- export declare const getBaseUrl: (options: SDKOptions) => string;
6
- export declare const getAPI: <T>(API: new (configuration?: Configuration, basePath?: string, axios?: any) => T, options: SDKOptions) => Promise<T>;
7
- export declare const useAutogeneratedAPI: <T extends BaseAPI>(baseProps: {
8
- API: new (configuration?: Configuration, basePath?: string, axios?: any) => T;
9
- options: SDKOptions;
10
- }) => {
11
- call: <ResponseEntity, ReturnType = ResponseEntity>(props: {
12
- returnUndefinedOn404?: boolean;
13
- run: (api: T) => AxiosPromise<ResponseEntity>;
14
- transform?: (response: ResponseEntity) => ReturnType;
15
- }) => Promise<ReturnType>;
16
- callWithReturningUndefinedOn404: <ResponseEntity, ReturnType_1 = ResponseEntity>(props: {
17
- run: (api: T) => AxiosPromise<ResponseEntity>;
18
- transform?: (response: ResponseEntity) => ReturnType_1;
19
- }) => Promise<ReturnType_1 | undefined>;
20
- };
package/dist/sdk/api.js DELETED
@@ -1,33 +0,0 @@
1
- import { HautechError } from './errors';
2
- export const getBaseUrl = (options) => options.endpoint ?? 'https://api.hautech.ai';
3
- export const getAPI = async (API, options) => {
4
- const config = {
5
- accessToken: await options.authToken(),
6
- basePath: getBaseUrl(options),
7
- isJsonMime: (mime) => true,
8
- };
9
- return new API(config);
10
- };
11
- export const useAutogeneratedAPI = (baseProps) => {
12
- const call = async (props) => {
13
- const api = await getAPI(baseProps.API, baseProps.options);
14
- try {
15
- const response = await props.run(api);
16
- if (props.returnUndefinedOn404 && response.status === 404)
17
- return undefined;
18
- if (response.status < 200 || response.status >= 300)
19
- throw new HautechError(`API call failed with status code ${response.status}`);
20
- return props.transform ? props.transform(response.data) : response.data;
21
- }
22
- catch (error) {
23
- if (props.returnUndefinedOn404 && error?.response?.status === 404)
24
- return undefined;
25
- throw new HautechError(error.message, { cause: error });
26
- }
27
- };
28
- const callWithReturningUndefinedOn404 = async (props) => call({ ...props, returnUndefinedOn404: true });
29
- return {
30
- call,
31
- callWithReturningUndefinedOn404,
32
- };
33
- };
@@ -1,12 +0,0 @@
1
- import { SDKOptions } from '../../types';
2
- declare const balances: (options: SDKOptions) => {
3
- add: (props: {
4
- accountId: string;
5
- amount: string;
6
- }) => Promise<void>;
7
- get: () => Promise<string>;
8
- getByAccountId: (props: {
9
- accountId: string;
10
- }) => Promise<string>;
11
- };
12
- export default balances;
@@ -1,19 +0,0 @@
1
- import { BalancesApi } from '../../autogenerated';
2
- import { useAutogeneratedAPI } from '../api';
3
- const balances = (options) => {
4
- const api = useAutogeneratedAPI({ API: BalancesApi, options });
5
- return {
6
- add: async (props) => api.call({
7
- run: (methods) => methods.balancesControllerAddBalanceV1(props.accountId, { amount: props.amount }),
8
- }),
9
- get: async () => api.call({
10
- run: (methods) => methods.balancesControllerGetBalanceForSelfV1(),
11
- transform: (data) => data.balance,
12
- }),
13
- getByAccountId: async (props) => api.call({
14
- run: (methods) => methods.balancesControllerGetBalanceV1(props.accountId),
15
- transform: (data) => data.balance,
16
- }),
17
- };
18
- };
19
- export default balances;
@@ -1,33 +0,0 @@
1
- import { SDKOptions, ListProps, ListResponse } from '../../types';
2
- import { CollectionEntity, CollectionsControllerListItemsV1KindEnum, ResourceEntity } from '../../autogenerated';
3
- import { CollectionMetadata } from '../index';
4
- import { AddMetadata } from '../utils';
5
- type CollectionEntityWithMetadata = AddMetadata<CollectionEntity, CollectionMetadata>;
6
- declare const collections: (options: SDKOptions) => {
7
- create: (props?: {
8
- metadata?: CollectionMetadata;
9
- }) => Promise<CollectionEntityWithMetadata>;
10
- get: (props: {
11
- id: string;
12
- }) => Promise<CollectionEntityWithMetadata | undefined>;
13
- items: {
14
- add: (props: {
15
- collectionId: string;
16
- itemIds: string[];
17
- }) => Promise<void>;
18
- list: (props: {
19
- collectionId: string;
20
- kind?: CollectionsControllerListItemsV1KindEnum;
21
- } & ListProps) => Promise<ListResponse<ResourceEntity>>;
22
- remove: (props: {
23
- collectionId: string;
24
- itemIds: string[];
25
- }) => Promise<void>;
26
- };
27
- list: (props?: ListProps) => Promise<ListResponse<CollectionEntityWithMetadata>>;
28
- updateMetadata: (props: {
29
- id: string;
30
- metadata?: Partial<CollectionMetadata>;
31
- }) => Promise<void>;
32
- };
33
- export default collections;
@@ -1,34 +0,0 @@
1
- import { CollectionsApi, } from '../../autogenerated';
2
- import { useAutogeneratedAPI } from '../api';
3
- import { transformToListResponse } from '../transformers';
4
- const collections = (options) => {
5
- const api = useAutogeneratedAPI({ API: CollectionsApi, options });
6
- return {
7
- create: async (props = {}) => api.call({
8
- run: (methods) => methods.collectionsControllerCreateCollectionV1({ metadata: props.metadata }),
9
- }),
10
- get: async (props) => api.callWithReturningUndefinedOn404({
11
- run: (methods) => methods.collectionsControllerGetCollectionV1(props.id),
12
- }),
13
- items: {
14
- add: async (props) => api.call({
15
- run: (methods) => methods.collectionsControllerAddItemsV1(props.collectionId, { itemIds: props.itemIds }),
16
- }),
17
- list: async (props) => api.call({
18
- run: (methods) => methods.collectionsControllerListItemsV1(props.collectionId, props.cursor, props.orderBy, props.limit, props.kind),
19
- transform: transformToListResponse,
20
- }),
21
- remove: async (props) => api.call({
22
- run: (methods) => methods.collectionsControllerRemoveItemsV1(props.collectionId, { itemIds: props.itemIds }),
23
- }),
24
- },
25
- list: (props = {}) => api.call({
26
- run: (methods) => methods.collectionsControllerListCollectionsV1(props.orderBy, props.limit, props.cursor),
27
- transform: transformToListResponse,
28
- }),
29
- updateMetadata: async (props) => api.call({
30
- run: (methods) => methods.collectionsControllerUpdateMetadataV1(props.id, { overwrite: props.metadata ?? {} }),
31
- }),
32
- };
33
- };
34
- export default collections;
@@ -1,3 +0,0 @@
1
- export declare class HautechError extends Error {
2
- constructor(message: string, options?: ErrorOptions);
3
- }
@@ -1,6 +0,0 @@
1
- export class HautechError extends Error {
2
- constructor(message, options) {
3
- super(message, options);
4
- this.name = 'HautechException';
5
- }
6
- }
@@ -1,24 +0,0 @@
1
- import { SDKOptions } from '../../types';
2
- import { AddAccountToGroupControllerParamsDtoRoleEnum, GroupEntity, RemoveAccountFromGroupControllerParamsDtoRoleEnum } from '../../autogenerated';
3
- declare const groups: (options: SDKOptions) => {
4
- accounts: {
5
- add: (props: {
6
- accountId: string;
7
- groupId: string;
8
- role: AddAccountToGroupControllerParamsDtoRoleEnum;
9
- }) => Promise<void>;
10
- remove: (props: {
11
- accountId: string;
12
- groupId: string;
13
- role: RemoveAccountFromGroupControllerParamsDtoRoleEnum;
14
- }) => Promise<void>;
15
- };
16
- create: () => Promise<GroupEntity>;
17
- delete: (props: {
18
- id: string;
19
- }) => Promise<void>;
20
- get: (props: {
21
- id: string;
22
- }) => Promise<GroupEntity | undefined>;
23
- };
24
- export default groups;
@@ -1,31 +0,0 @@
1
- import { GroupsApi, } from '../../autogenerated';
2
- import { useAutogeneratedAPI } from '../api';
3
- const groups = (options) => {
4
- const api = useAutogeneratedAPI({ API: GroupsApi, options });
5
- return {
6
- accounts: {
7
- add: async (props) => api.call({
8
- run: (methods) => methods.groupsControllerAddAccountV1(props.groupId, {
9
- accountId: props.accountId,
10
- role: props.role,
11
- }),
12
- }),
13
- remove: async (props) => api.call({
14
- run: (methods) => methods.groupsControllerRemoveAccountV1(props.groupId, {
15
- accountId: props.accountId,
16
- role: props.role,
17
- }),
18
- }),
19
- },
20
- create: async () => api.call({
21
- run: (methods) => methods.groupsControllerCreateGroupV1(),
22
- }),
23
- delete: async (props) => api.call({
24
- run: (methods) => methods.groupsControllerDeleteGroupV1(props.id),
25
- }),
26
- get: (props) => api.callWithReturningUndefinedOn404({
27
- run: (methods) => methods.groupsControllerGetGroupV1(props.id),
28
- }),
29
- };
30
- };
31
- export default groups;
@@ -1,17 +0,0 @@
1
- import { SDKOptions } from '../../types';
2
- import { ImageEntity } from '../../autogenerated';
3
- declare const images: (options: SDKOptions) => {
4
- createFromFile: (props: {
5
- file: Blob;
6
- }) => Promise<ImageEntity>;
7
- createFromUrl: (props: {
8
- url: string;
9
- }) => Promise<ImageEntity>;
10
- get: (props: {
11
- id: string;
12
- }) => Promise<ImageEntity | undefined>;
13
- getUrls: (props: {
14
- ids: string[];
15
- }) => Promise<Record<string, string>>;
16
- };
17
- export default images;
@@ -1,35 +0,0 @@
1
- import axios from 'axios';
2
- import { ImagesApi } from '../../autogenerated';
3
- import { useAutogeneratedAPI } from '../api';
4
- const images = (options) => {
5
- const api = useAutogeneratedAPI({ API: ImagesApi, options });
6
- const createFromFile = async (props) => {
7
- const uploadUrl = await api.call({
8
- run: (methods) => methods.imagesControllerStartUploadV1(),
9
- transform: (data) => data.uploadUrl,
10
- });
11
- const formData = new FormData();
12
- formData.append('file', props.file);
13
- const response = await axios.put(uploadUrl, formData, {
14
- headers: { 'Content-Type': 'multipart/form-data' },
15
- });
16
- const fileToken = response.data.fileToken;
17
- return await api.call({ run: (methods) => methods.imagesControllerFinalizeUploadV1({ fileToken }) });
18
- };
19
- return {
20
- createFromFile,
21
- createFromUrl: async (props) => {
22
- const response = await axios.get(props.url, { responseType: 'arraybuffer' });
23
- const file = new Blob([response.data], { type: response.headers['content-type'] });
24
- return createFromFile({ file });
25
- },
26
- get: async (props) => api.callWithReturningUndefinedOn404({
27
- run: (methods) => methods.imagesControllerGetImageV1(props.id),
28
- }),
29
- getUrls: async (props) => api.call({
30
- run: (methods) => methods.imagesControllerGetUrlsV1({ ids: props.ids }),
31
- transform: (data) => data.reduce((acc, { id, url }) => ({ ...acc, [id]: url }), {}),
32
- }),
33
- };
34
- };
35
- export default images;