@hautechai/sdk 1.0.3 → 1.0.5

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 (60) hide show
  1. package/.github/workflows/release.yaml +4 -53
  2. package/CHANGELOG.md +1 -1
  3. package/dist/autogenerated/api.d.ts +11397 -0
  4. package/dist/autogenerated/api.js +11002 -0
  5. package/dist/autogenerated/base.d.ts +66 -0
  6. package/dist/autogenerated/base.js +59 -0
  7. package/dist/autogenerated/common.d.ts +65 -0
  8. package/dist/autogenerated/common.js +133 -0
  9. package/dist/autogenerated/configuration.d.ts +91 -0
  10. package/dist/autogenerated/configuration.js +39 -0
  11. package/dist/autogenerated/index.d.ts +13 -0
  12. package/dist/autogenerated/index.js +15 -0
  13. package/dist/autogenerated/permissions.d.ts +94 -0
  14. package/dist/autogenerated/permissions.js +1 -0
  15. package/dist/index.d.ts +3 -0
  16. package/dist/index.js +3 -0
  17. package/dist/sdk/access/index.d.ts +20 -0
  18. package/dist/sdk/access/index.js +23 -0
  19. package/dist/sdk/accounts/index.d.ts +16 -0
  20. package/dist/sdk/accounts/index.js +25 -0
  21. package/dist/sdk/api.d.ts +20 -0
  22. package/dist/sdk/api.js +33 -0
  23. package/dist/sdk/balances/index.d.ts +12 -0
  24. package/dist/sdk/balances/index.js +19 -0
  25. package/dist/sdk/collections/index.d.ts +33 -0
  26. package/dist/sdk/collections/index.js +34 -0
  27. package/dist/sdk/errors/index.d.ts +3 -0
  28. package/dist/sdk/errors/index.js +6 -0
  29. package/dist/sdk/groups/index.d.ts +24 -0
  30. package/dist/sdk/groups/index.js +31 -0
  31. package/dist/sdk/images/index.d.ts +17 -0
  32. package/dist/sdk/images/index.js +35 -0
  33. package/dist/sdk/index.d.ts +1585 -0
  34. package/dist/sdk/index.js +69 -0
  35. package/dist/sdk/listeners/index.d.ts +28 -0
  36. package/dist/sdk/listeners/index.js +104 -0
  37. package/dist/sdk/operations/index.d.ts +199 -0
  38. package/dist/sdk/operations/index.js +133 -0
  39. package/dist/sdk/pipelines/index.d.ts +1189 -0
  40. package/dist/sdk/pipelines/index.js +208 -0
  41. package/dist/sdk/pipelines/pipelines.d.ts +0 -0
  42. package/dist/sdk/pipelines/pipelines.js +1 -0
  43. package/dist/sdk/poses/index.d.ts +20 -0
  44. package/dist/sdk/poses/index.js +24 -0
  45. package/dist/sdk/stacks/index.d.ts +29 -0
  46. package/dist/sdk/stacks/index.js +32 -0
  47. package/dist/sdk/storage/index.d.ts +18 -0
  48. package/dist/sdk/storage/index.js +27 -0
  49. package/dist/sdk/transformers.d.ts +7 -0
  50. package/dist/sdk/transformers.js +6 -0
  51. package/dist/sdk/utils/index.d.ts +10 -0
  52. package/dist/sdk/utils/index.js +6 -0
  53. package/dist/sdk/videos/index.d.ts +11 -0
  54. package/dist/sdk/videos/index.js +15 -0
  55. package/dist/token/index.d.ts +15 -0
  56. package/dist/token/index.js +65 -0
  57. package/dist/types.d.ts +15 -0
  58. package/dist/types.js +5 -0
  59. package/package.json +1 -1
  60. package/scripts/up-versions.sh +4 -1
@@ -0,0 +1,208 @@
1
+ import { Pipeline } from '@hautechai/pipelines';
2
+ import { CallApi, PipelinesApi, } from '../../autogenerated';
3
+ import { useAutogeneratedAPI } from '../api';
4
+ import { transformToListResponse } from '../transformers';
5
+ const pipelines = (options) => {
6
+ const api = useAutogeneratedAPI({ API: PipelinesApi, options });
7
+ const callAPI = useAutogeneratedAPI({ API: CallApi, options });
8
+ const callMethod = (method) =>
9
+ // Type intersection is used as a type check assistance to prevent accidental passing of raw TaskOutput.
10
+ (params) => callAPI.call({
11
+ run: (methods) => method(methods)(params),
12
+ });
13
+ const createPipeline = () => new Pipeline({
14
+ access: {
15
+ attach: callMethod((methods) => methods.callControllerCallAccessAttachV1),
16
+ grant: callMethod((methods) => methods.callControllerCallAccessGrantV1),
17
+ },
18
+ accounts: {
19
+ create: callMethod((methods) => methods.callControllerCallAccountsCreateV1),
20
+ get: callMethod((methods) => methods.callControllerCallAccountsGetV1),
21
+ list: callMethod((methods) => methods.callControllerCallAccountsListV1),
22
+ },
23
+ balances: {
24
+ add: callMethod((methods) => methods.callControllerCallAccountsBalanceAddV1),
25
+ get: callMethod((methods) => methods.callControllerCallAccountsBalanceGetV1),
26
+ getSelf: callMethod((methods) => methods.callControllerCallAccountsBalanceSelfV1),
27
+ },
28
+ collections: {
29
+ create: callMethod((methods) => methods.callControllerCallCollectionsCreateV1),
30
+ items: {
31
+ add: callMethod((methods) => methods.callControllerCallCollectionsItemsAddV1),
32
+ list: callMethod((methods) => methods.callControllerCallCollectionsItemsListV1),
33
+ remove: callMethod((methods) => methods.callControllerCallCollectionsItemsRemoveV1),
34
+ },
35
+ get: callMethod((methods) => methods.callControllerCallCollectionsGetV1),
36
+ list: callMethod((methods) => methods.callControllerCallCollectionsListV1),
37
+ updateMetadata: callMethod((methods) => methods.callControllerCallCollectionsMetadataUpdateV1),
38
+ },
39
+ groups: {
40
+ accounts: {
41
+ add: callMethod((methods) => methods.callControllerCallGroupsAccountsAddV1),
42
+ remove: callMethod((methods) => methods.callControllerCallGroupsAccountsRemoveV1),
43
+ },
44
+ create: callMethod((methods) => methods.callControllerCallGroupsCreateV1),
45
+ delete: callMethod((methods) => methods.callControllerCallGroupsDeleteV1),
46
+ get: callMethod((methods) => methods.callControllerCallGroupsGetV1),
47
+ },
48
+ images: {
49
+ get: callMethod((methods) => methods.callControllerCallImagesGetV1),
50
+ getUrls: callMethod((methods) => methods.callControllerCallImagesGetManyV1),
51
+ },
52
+ videos: {
53
+ get: callMethod((methods) => methods.callControllerCallVideosGetV1),
54
+ getUrls: callMethod((methods) => methods.callControllerCallVideosGetManyV1),
55
+ },
56
+ operations: {
57
+ get: callMethod((methods) => methods.callControllerCallOperationsGetV1),
58
+ list: callMethod((methods) => methods.callControllerCallOperationsListV1),
59
+ updateMetadata: callMethod((methods) => methods.callControllerCallOperationsMetadataUpdateV1),
60
+ run: {
61
+ animate: {
62
+ kling_1_6_pro: {
63
+ v1: callMethod((methods) => methods.callControllerCallOperationsRunAnimateKling16ProV1V1),
64
+ },
65
+ kling_2_1: {
66
+ v1: callMethod((methods) => methods.callControllerCallOperationsRunAnimateKling21V1V1),
67
+ },
68
+ },
69
+ edit: {
70
+ flux_kontext_dev: {
71
+ v1: callMethod((methods) => methods.callControllerCallOperationsRunEditFluxKontextDevV1V1),
72
+ },
73
+ },
74
+ haute: {
75
+ linda: {
76
+ v1: callMethod((methods) => methods.callControllerCallOperationsRunHauteLindaV1V1),
77
+ },
78
+ naomi: {
79
+ v1: callMethod((methods) => methods.callControllerCallOperationsRunHauteNaomiV1V1),
80
+ },
81
+ },
82
+ inpaint: {
83
+ kate: {
84
+ v1: callMethod((methods) => methods.callControllerCallOperationsRunInpaintKateV1V1),
85
+ },
86
+ },
87
+ gpt: {
88
+ v1: callMethod((methods) => methods.callControllerCallOperationsRunGptV1V1),
89
+ v2: callMethod((methods) => methods.callControllerCallOperationsRunGptV2V1),
90
+ },
91
+ math: {
92
+ v1: callMethod((methods) => methods.callControllerCallOperationsRunMathV1V1),
93
+ },
94
+ translate: {
95
+ v1: callMethod((methods) => methods.callControllerCallOperationsRunTranslateV1V1),
96
+ },
97
+ imagine: {
98
+ kate: {
99
+ v1: callMethod((methods) => methods.callControllerCallOperationsRunImagineKateV1V1),
100
+ },
101
+ },
102
+ upscale: {
103
+ v1: callMethod((methods) => methods.callControllerCallOperationsRunUpscaleV1V1),
104
+ },
105
+ objectDetection: {
106
+ v1: callMethod((methods) => methods.callControllerCallOperationsRunObjectDetectionV1V1),
107
+ },
108
+ segmentAnything: {
109
+ embeddings: {
110
+ v1: callMethod((methods) => methods.callControllerCallOperationsRunSegmentAnythingEmbeddingsV1V1),
111
+ },
112
+ mask: {
113
+ v1: callMethod((methods) => methods.callControllerCallOperationsRunSegmentAnythingMaskV1V1),
114
+ },
115
+ },
116
+ poseEstimation: {
117
+ v1: callMethod((methods) => methods.callControllerCallOperationsRunPoseEstimationV1V1),
118
+ },
119
+ cut: {
120
+ v1: callMethod((methods) => methods.callControllerCallOperationsRunCutV1V1),
121
+ },
122
+ crop: {
123
+ v1: callMethod((methods) => methods.callControllerCallOperationsRunCropV1V1),
124
+ },
125
+ noise: {
126
+ v1: callMethod((methods) => methods.callControllerCallOperationsRunNoiseV1V1),
127
+ },
128
+ contrast: {
129
+ v1: callMethod((methods) => methods.callControllerCallOperationsRunContrastV1V1),
130
+ },
131
+ composite: {
132
+ v1: callMethod((methods) => methods.callControllerCallOperationsRunCompositeV1V1),
133
+ },
134
+ vton: {
135
+ gisele: {
136
+ v1: callMethod((methods) => methods.callControllerCallOperationsRunVtonGiseleV1V1),
137
+ },
138
+ },
139
+ negateImage: {
140
+ v1: callMethod((methods) => methods.callControllerCallOperationsRunNegateImageV1V1),
141
+ },
142
+ resize: {
143
+ v1: callMethod((methods) => methods.callControllerCallOperationsRunResizeV1V1),
144
+ },
145
+ strings: {
146
+ template: {
147
+ v1: callMethod((methods) => methods.callControllerCallOperationsRunStringsTemplateV1V1),
148
+ },
149
+ },
150
+ },
151
+ wait: callMethod((methods) => methods.callControllerCallOperationsWaitV1),
152
+ },
153
+ poses: {
154
+ get: callMethod((methods) => methods.callControllerCallPosesGetV1),
155
+ list: callMethod((methods) => methods.callControllerCallPosesListV1),
156
+ },
157
+ stacks: {
158
+ create: callMethod((methods) => methods.callControllerCallStacksCreateV1),
159
+ get: callMethod((methods) => methods.callControllerCallStacksGetV1),
160
+ list: callMethod((methods) => methods.callControllerCallStacksListV1),
161
+ updateMetadata: callMethod((methods) => methods.callControllerCallStacksMetadataUpdateV1),
162
+ items: {
163
+ add: callMethod((methods) => methods.callControllerCallStacksItemsAddV1),
164
+ remove: callMethod((methods) => methods.callControllerCallStacksItemsRemoveV1),
165
+ },
166
+ },
167
+ storage: {
168
+ create: callMethod((methods) => methods.callControllerCallStorageCreateV1),
169
+ delete: callMethod((methods) => methods.callControllerCallStorageDeleteV1),
170
+ getMany: callMethod((methods) => methods.callControllerCallStorageGetManyV1),
171
+ update: callMethod((methods) => methods.callControllerCallStorageUpdateV1),
172
+ },
173
+ });
174
+ return {
175
+ constructTemplate: (consructPipeline) => consructPipeline(createPipeline()),
176
+ create: async (props) => api.call({
177
+ run: (methods) => methods.pipelinesControllerCreatePipelineV1({
178
+ metadata: props.metadata,
179
+ tasks: (props.template?.tasks ?? props.tasks),
180
+ state: props.state,
181
+ }),
182
+ }),
183
+ get: async (props) => api.callWithReturningUndefinedOn404({
184
+ run: (methods) => methods.pipelinesControllerGetPipelineV1(props.id),
185
+ }),
186
+ list: (props = {}) => api.call({
187
+ run: (methods) => methods.pipelinesControllerListPipelinesV1(props.orderBy, props.limit, props.cursor),
188
+ transform: transformToListResponse,
189
+ }),
190
+ wait: async (props) => new Promise((resolve, reject) => {
191
+ const initialDelay = 5000;
192
+ const delay = 2000;
193
+ let timeoutId;
194
+ const poll = async () => {
195
+ const pipeline = (await api.call({
196
+ run: (methods) => methods.pipelinesControllerGetPipelineV1(props.id),
197
+ }));
198
+ if (pipeline.status === 'completed')
199
+ return resolve(pipeline);
200
+ if (pipeline.status === 'failed')
201
+ return resolve(pipeline);
202
+ timeoutId = setTimeout(poll, delay);
203
+ };
204
+ timeoutId = setTimeout(poll, initialDelay);
205
+ }),
206
+ };
207
+ };
208
+ export default pipelines;
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,20 @@
1
+ import { ListPosesParamsDto, PoseEntity } from '../../autogenerated';
2
+ import { ListResponse, SDKOptions } from '../../types';
3
+ import { PoseMetadata } from '../index';
4
+ import { AddMetadata } from '../utils';
5
+ type PoseEntityWithMetadata = AddMetadata<PoseEntity, PoseMetadata>;
6
+ declare const poses: (options: SDKOptions) => {
7
+ putPreview: (props: {
8
+ id: string;
9
+ previewImageId: string;
10
+ }) => Promise<void>;
11
+ get: (props: {
12
+ id: string;
13
+ }) => Promise<PoseEntityWithMetadata | undefined>;
14
+ list: (props: ListPosesParamsDto) => Promise<ListResponse<PoseEntityWithMetadata>>;
15
+ updateMetadata: (props: {
16
+ id: string;
17
+ metadata?: PoseMetadata;
18
+ }) => Promise<void>;
19
+ };
20
+ export default poses;
@@ -0,0 +1,24 @@
1
+ import { PosesApi } from '../../autogenerated';
2
+ import { useAutogeneratedAPI } from '../api';
3
+ import { transformToListResponse } from '../transformers';
4
+ const poses = (options) => {
5
+ const api = useAutogeneratedAPI({ API: PosesApi, options });
6
+ return {
7
+ putPreview: async (props) => api.call({
8
+ run: (methods) => methods.posesControllerSetPosePreviewV1(props.id, {
9
+ previewImageId: props.previewImageId,
10
+ }),
11
+ }),
12
+ get: async (props) => api.callWithReturningUndefinedOn404({
13
+ run: (methods) => methods.posesControllerGetPoseV1(props.id),
14
+ }),
15
+ list: async (props) => api.call({
16
+ run: (methods) => methods.posesControllerListPosesV1(props.orderBy, props.limit, props.cursor),
17
+ transform: transformToListResponse,
18
+ }),
19
+ updateMetadata: async (props) => api.call({
20
+ run: (methods) => methods.posesControllerUpdateMetadataV1(props.id, { overwrite: props.metadata ?? {} }),
21
+ }),
22
+ };
23
+ };
24
+ export default poses;
@@ -0,0 +1,29 @@
1
+ import { SDKOptions, ListProps, ListResponse } from '../../types';
2
+ import { StackEntity } from '../../autogenerated';
3
+ import { StackMetadata } from '../index';
4
+ import { AddMetadata } from '../utils';
5
+ type StackEntityWithMetadata = AddMetadata<StackEntity, StackMetadata>;
6
+ declare const stacks: (options: SDKOptions) => {
7
+ create: (props?: {
8
+ metadata?: StackMetadata;
9
+ }) => Promise<StackEntity>;
10
+ get: (props: {
11
+ id: string;
12
+ }) => Promise<StackEntityWithMetadata | undefined>;
13
+ list: (props?: ListProps) => Promise<ListResponse<StackEntityWithMetadata>>;
14
+ items: {
15
+ add: (props: {
16
+ itemIds: string[];
17
+ stackId: string;
18
+ }) => Promise<void>;
19
+ remove: (props: {
20
+ itemIds: string[];
21
+ stackId: string;
22
+ }) => Promise<void>;
23
+ };
24
+ updateMetadata: (props: {
25
+ id: string;
26
+ metadata?: StackMetadata;
27
+ }) => Promise<void>;
28
+ };
29
+ export default stacks;
@@ -0,0 +1,32 @@
1
+ import { StacksApi } from '../../autogenerated';
2
+ import { useAutogeneratedAPI } from '../api';
3
+ import { transformToListResponse } from '../transformers';
4
+ const stacks = (options) => {
5
+ const api = useAutogeneratedAPI({ API: StacksApi, options });
6
+ return {
7
+ create: async (props = {}) => api.call({
8
+ run: (methods) => methods.stacksControllerCreateStackV1({
9
+ metadata: props.metadata,
10
+ }),
11
+ }),
12
+ get: async (props) => api.callWithReturningUndefinedOn404({
13
+ run: (methods) => methods.stacksControllerGetStackV1(props.id),
14
+ }),
15
+ list: async (props = {}) => api.call({
16
+ run: (methods) => methods.stacksControllerListStacksV1(props.orderBy, props.limit, props.cursor),
17
+ transform: transformToListResponse,
18
+ }),
19
+ items: {
20
+ add: async (props) => api.call({
21
+ run: (methods) => methods.stacksControllerAddItemsV1(props.stackId, { itemIds: props.itemIds }),
22
+ }),
23
+ remove: async (props) => api.call({
24
+ run: (methods) => methods.stacksControllerRemoveItemsV1(props.stackId, { itemIds: props.itemIds }),
25
+ }),
26
+ },
27
+ updateMetadata: async (props) => api.call({
28
+ run: (methods) => methods.stacksControllerUpdateMetadataV1(props.id, { overwrite: props.metadata ?? {} }),
29
+ }),
30
+ };
31
+ };
32
+ export default stacks;
@@ -0,0 +1,18 @@
1
+ import { SDKOptions } from '../../types';
2
+ declare const storage: (options: SDKOptions) => {
3
+ create: (props: {
4
+ key: string;
5
+ value: any;
6
+ }) => Promise<any>;
7
+ delete: (props: {
8
+ key: string;
9
+ }) => Promise<void>;
10
+ getMany: (props: {
11
+ keys: string[];
12
+ }) => Promise<Record<string, any>>;
13
+ update: (props: {
14
+ key: string;
15
+ value: any;
16
+ }) => Promise<any>;
17
+ };
18
+ export default storage;
@@ -0,0 +1,27 @@
1
+ import { StorageApi } from '../../autogenerated';
2
+ import { useAutogeneratedAPI } from '../api';
3
+ const storage = (options) => {
4
+ const api = useAutogeneratedAPI({ API: StorageApi, options });
5
+ return {
6
+ create: async (props) => api.call({
7
+ run: (methods) => methods.storageControllerCreateRecordV1({
8
+ key: props.key,
9
+ value: props.value,
10
+ }),
11
+ }),
12
+ delete: async (props) => api.call({
13
+ run: (methods) => methods.storageControllerDeleteRecordV1({ key: props.key }),
14
+ }),
15
+ getMany: async (props) => api.call({
16
+ run: (methods) => methods.storageControllerGetRecordsV1({ keys: props.keys }),
17
+ transform: (response) => response.reduce((acc, item) => {
18
+ acc[item.key] = item.value;
19
+ return acc;
20
+ }, {}),
21
+ }),
22
+ update: async (props) => api.call({
23
+ run: (methods) => methods.storageControllerUpdateRecordV1({ key: props.key, value: props.value }),
24
+ }),
25
+ };
26
+ };
27
+ export default storage;
@@ -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,6 @@
1
+ import { ListResponse } from '../types';
2
+ export const transformToListResponse = (response) => {
3
+ const array = new ListResponse(...response.data);
4
+ array.nextCursor = response.pageInfo.nextCursor;
5
+ return array;
6
+ };
@@ -0,0 +1,10 @@
1
+ import { SDKOptions } from '../../types';
2
+ declare const utils: (options: SDKOptions) => {
3
+ seed: () => number;
4
+ };
5
+ export type AddMetadata<T extends {
6
+ metadata: unknown;
7
+ }, M> = Omit<T, 'metadata'> & {
8
+ metadata: M;
9
+ };
10
+ export default utils;
@@ -0,0 +1,6 @@
1
+ const utils = (options) => {
2
+ return {
3
+ seed: () => Math.floor(Math.random() * Number.MAX_SAFE_INTEGER),
4
+ };
5
+ };
6
+ export default utils;
@@ -0,0 +1,11 @@
1
+ import { VideoEntity } from '../../autogenerated';
2
+ import { SDKOptions } from '../../types';
3
+ declare const videos: (options: SDKOptions) => {
4
+ get: (props: {
5
+ id: string;
6
+ }) => Promise<VideoEntity | undefined>;
7
+ getUrls: (props: {
8
+ ids: string[];
9
+ }) => Promise<Record<string, string>>;
10
+ };
11
+ export default videos;
@@ -0,0 +1,15 @@
1
+ import { VideosApi } from '../../autogenerated';
2
+ import { useAutogeneratedAPI } from '../api';
3
+ const videos = (options) => {
4
+ const api = useAutogeneratedAPI({ API: VideosApi, options });
5
+ return {
6
+ get: async (props) => api.callWithReturningUndefinedOn404({
7
+ run: (methods) => methods.videosControllerGetVideoV1(props.id),
8
+ }),
9
+ getUrls: async (props) => api.call({
10
+ run: (methods) => methods.videosControllerGetUrlsV1({ ids: props.ids }),
11
+ transform: (data) => data.reduce((acc, { id, url }) => ({ ...acc, [id]: url }), {}),
12
+ }),
13
+ };
14
+ };
15
+ export default videos;
@@ -0,0 +1,15 @@
1
+ import { MethodsPermissions } from '../autogenerated/permissions';
2
+ export declare const createTokenSigner: (options: {
3
+ appId: string;
4
+ appKeyId: string;
5
+ appKeySecret: string;
6
+ }) => {
7
+ createAccountToken: (props: {
8
+ accountId: string;
9
+ expiresInSeconds: number;
10
+ permissions?: Partial<MethodsPermissions>;
11
+ }) => Promise<string>;
12
+ createRootToken: (props: {
13
+ expiresInSeconds: number;
14
+ }) => Promise<string>;
15
+ };
@@ -0,0 +1,65 @@
1
+ import * as jose from 'jose';
2
+ const createPrivateKey = (key) => {
3
+ const header = `-----BEGIN PRIVATE KEY-----\n`;
4
+ const footer = `\n-----END PRIVATE KEY-----`;
5
+ // @ts-ignore
6
+ const keyBody = key.match(/.{1,64}/g).join('\n');
7
+ return header + keyBody + footer;
8
+ };
9
+ const createToken = async (props) => {
10
+ const alg = 'RS256';
11
+ const pkcs8 = createPrivateKey(props.appKeySecret);
12
+ const privateKey = await jose.importPKCS8(pkcs8, alg);
13
+ return await new jose.SignJWT(props.payload)
14
+ .setIssuedAt()
15
+ .setExpirationTime(`${props.expiresInSeconds}s`)
16
+ .setProtectedHeader({ alg, kid: props.appKeyId })
17
+ .sign(privateKey);
18
+ };
19
+ const serializePermissions = (permissions) => {
20
+ const result = [];
21
+ const traverse = (obj, path = []) => {
22
+ for (const [key, value] of Object.entries(obj)) {
23
+ if (typeof value === 'boolean' && value === true) {
24
+ result.push(path.concat(key).join(':'));
25
+ }
26
+ else if (typeof value === 'object') {
27
+ traverse(value, path.concat(key));
28
+ }
29
+ }
30
+ };
31
+ traverse(permissions);
32
+ return result;
33
+ };
34
+ export const createTokenSigner = (options) => {
35
+ if (!options.appId || options.appId.length === 0) {
36
+ throw new Error('appId is required');
37
+ }
38
+ if (!options.appKeyId || options.appKeyId.length === 0) {
39
+ throw new Error('appKeyId is required');
40
+ }
41
+ if (!options.appKeySecret || options.appKeySecret.length === 0) {
42
+ throw new Error('appKeySecret is required');
43
+ }
44
+ return {
45
+ createAccountToken: async (props) => createToken({
46
+ appKeyId: options.appKeyId,
47
+ appKeySecret: options.appKeySecret,
48
+ expiresInSeconds: props.expiresInSeconds,
49
+ payload: {
50
+ iss: options.appId,
51
+ permissions: serializePermissions(props.permissions ?? {}),
52
+ sub: props.accountId,
53
+ },
54
+ }),
55
+ createRootToken: async (props) => createToken({
56
+ appKeyId: options.appKeyId,
57
+ appKeySecret: options.appKeySecret,
58
+ expiresInSeconds: props.expiresInSeconds ?? 3600,
59
+ payload: {
60
+ iss: options.appId,
61
+ permissions: ['*'],
62
+ },
63
+ }),
64
+ };
65
+ };
@@ -0,0 +1,15 @@
1
+ export interface SDKOptions {
2
+ authToken: () => string | Promise<string>;
3
+ endpoint?: string;
4
+ useWebsocket?: boolean;
5
+ allowPollingFallback?: boolean;
6
+ }
7
+ export type ListProps = {
8
+ cursor?: string;
9
+ limit?: number;
10
+ orderBy?: 'createdAt_ASC' | 'createdAt_DESC' | 'updatedAt_ASC' | 'updatedAt_DESC';
11
+ };
12
+ export declare class ListResponse<T> extends Array<T> {
13
+ nextCursor?: string;
14
+ }
15
+ export { AccountEntity, CollectionEntity, GroupEntity, ImageEntity, OperationEntity, PipelineDto, PipelinePreviewDto, ResourceEntity, StackEntity, StorageEntity, } from './autogenerated/api';
package/dist/types.js ADDED
@@ -0,0 +1,5 @@
1
+ export class ListResponse extends Array {
2
+ }
3
+ // ------------------------------------------------------------
4
+ // AUTOGENERATED TYPES END
5
+ // ------------------------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hautechai/sdk",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "license": "MIT",
5
5
  "keywords": [],
6
6
  "repository": {
@@ -1,3 +1,6 @@
1
1
  #!/bin/bash
2
2
 
3
- pnpm semantic-release -t "${TAG_PREFIX}/${APP_NAME}@\${version}" --no-ci
3
+ # Extract package name from package.json
4
+ PACKAGE_NAME=$(node -p "require('./package.json').name")
5
+
6
+ pnpm semantic-release -t "${PACKAGE_NAME}@\${version}" --no-ci