@hautechai/sdk 1.2.0 → 1.4.0
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.
- package/dist/index.d.mts +7968 -0
- package/dist/index.d.ts +7968 -3
- package/dist/index.js +9030 -3
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +8991 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +8 -2
- package/.env.example +0 -4
- package/.github/workflows/release.yaml +0 -103
- package/.prettierignore +0 -1
- package/CHANGELOG.md +0 -6
- package/dist/autogenerated/api.d.ts +0 -12069
- package/dist/autogenerated/api.js +0 -11598
- package/dist/autogenerated/base.d.ts +0 -66
- package/dist/autogenerated/base.js +0 -59
- package/dist/autogenerated/common.d.ts +0 -65
- package/dist/autogenerated/common.js +0 -133
- package/dist/autogenerated/configuration.d.ts +0 -91
- package/dist/autogenerated/configuration.js +0 -39
- package/dist/autogenerated/index.d.ts +0 -13
- package/dist/autogenerated/index.js +0 -15
- package/dist/autogenerated/permissions.d.ts +0 -100
- package/dist/autogenerated/permissions.js +0 -1
- package/dist/sdk/access/index.d.ts +0 -20
- package/dist/sdk/access/index.js +0 -23
- package/dist/sdk/accounts/index.d.ts +0 -16
- package/dist/sdk/accounts/index.js +0 -25
- package/dist/sdk/api.d.ts +0 -20
- package/dist/sdk/api.js +0 -33
- package/dist/sdk/balances/index.d.ts +0 -12
- package/dist/sdk/balances/index.js +0 -19
- package/dist/sdk/collections/index.d.ts +0 -33
- package/dist/sdk/collections/index.js +0 -34
- package/dist/sdk/errors/index.d.ts +0 -3
- package/dist/sdk/errors/index.js +0 -6
- package/dist/sdk/groups/index.d.ts +0 -24
- package/dist/sdk/groups/index.js +0 -31
- package/dist/sdk/images/index.d.ts +0 -17
- package/dist/sdk/images/index.js +0 -35
- package/dist/sdk/index.d.ts +0 -1611
- package/dist/sdk/index.js +0 -69
- package/dist/sdk/listeners/index.d.ts +0 -28
- package/dist/sdk/listeners/index.js +0 -104
- package/dist/sdk/operations/index.d.ts +0 -205
- package/dist/sdk/operations/index.js +0 -136
- package/dist/sdk/pipelines/index.d.ts +0 -1209
- package/dist/sdk/pipelines/index.js +0 -211
- package/dist/sdk/pipelines/pipelines.d.ts +0 -0
- package/dist/sdk/pipelines/pipelines.js +0 -1
- package/dist/sdk/poses/index.d.ts +0 -20
- package/dist/sdk/poses/index.js +0 -24
- package/dist/sdk/stacks/index.d.ts +0 -29
- package/dist/sdk/stacks/index.js +0 -32
- package/dist/sdk/storage/index.d.ts +0 -18
- package/dist/sdk/storage/index.js +0 -27
- package/dist/sdk/transformers.d.ts +0 -7
- package/dist/sdk/transformers.js +0 -6
- package/dist/sdk/utils/index.d.ts +0 -10
- package/dist/sdk/utils/index.js +0 -6
- package/dist/sdk/videos/index.d.ts +0 -11
- package/dist/sdk/videos/index.js +0 -15
- package/dist/token/index.d.ts +0 -15
- package/dist/token/index.js +0 -65
- package/dist/types.d.ts +0 -15
- package/dist/types.js +0 -5
- package/openapitools.json +0 -7
- package/release.config.cjs +0 -39
- package/scripts/generate-permissions.js +0 -54
- package/scripts/generate.sh +0 -19
- package/scripts/up-versions.sh +0 -6
- package/tsconfig.json +0 -14
|
@@ -1,211 +0,0 @@
|
|
|
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
|
-
creatomate: {
|
|
69
|
-
v1: callMethod((methods) => methods.callControllerCallOperationsRunAnimateCreatomateV1V1),
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
edit: {
|
|
73
|
-
flux_kontext_dev: {
|
|
74
|
-
v1: callMethod((methods) => methods.callControllerCallOperationsRunEditFluxKontextDevV1V1),
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
haute: {
|
|
78
|
-
linda: {
|
|
79
|
-
v1: callMethod((methods) => methods.callControllerCallOperationsRunHauteLindaV1V1),
|
|
80
|
-
},
|
|
81
|
-
naomi: {
|
|
82
|
-
v1: callMethod((methods) => methods.callControllerCallOperationsRunHauteNaomiV1V1),
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
inpaint: {
|
|
86
|
-
kate: {
|
|
87
|
-
v1: callMethod((methods) => methods.callControllerCallOperationsRunInpaintKateV1V1),
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
gpt: {
|
|
91
|
-
v1: callMethod((methods) => methods.callControllerCallOperationsRunGptV1V1),
|
|
92
|
-
v2: callMethod((methods) => methods.callControllerCallOperationsRunGptV2V1),
|
|
93
|
-
},
|
|
94
|
-
math: {
|
|
95
|
-
v1: callMethod((methods) => methods.callControllerCallOperationsRunMathV1V1),
|
|
96
|
-
},
|
|
97
|
-
translate: {
|
|
98
|
-
v1: callMethod((methods) => methods.callControllerCallOperationsRunTranslateV1V1),
|
|
99
|
-
},
|
|
100
|
-
imagine: {
|
|
101
|
-
kate: {
|
|
102
|
-
v1: callMethod((methods) => methods.callControllerCallOperationsRunImagineKateV1V1),
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
upscale: {
|
|
106
|
-
v1: callMethod((methods) => methods.callControllerCallOperationsRunUpscaleV1V1),
|
|
107
|
-
},
|
|
108
|
-
objectDetection: {
|
|
109
|
-
v1: callMethod((methods) => methods.callControllerCallOperationsRunObjectDetectionV1V1),
|
|
110
|
-
},
|
|
111
|
-
segmentAnything: {
|
|
112
|
-
embeddings: {
|
|
113
|
-
v1: callMethod((methods) => methods.callControllerCallOperationsRunSegmentAnythingEmbeddingsV1V1),
|
|
114
|
-
},
|
|
115
|
-
mask: {
|
|
116
|
-
v1: callMethod((methods) => methods.callControllerCallOperationsRunSegmentAnythingMaskV1V1),
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
poseEstimation: {
|
|
120
|
-
v1: callMethod((methods) => methods.callControllerCallOperationsRunPoseEstimationV1V1),
|
|
121
|
-
},
|
|
122
|
-
cut: {
|
|
123
|
-
v1: callMethod((methods) => methods.callControllerCallOperationsRunCutV1V1),
|
|
124
|
-
},
|
|
125
|
-
crop: {
|
|
126
|
-
v1: callMethod((methods) => methods.callControllerCallOperationsRunCropV1V1),
|
|
127
|
-
},
|
|
128
|
-
noise: {
|
|
129
|
-
v1: callMethod((methods) => methods.callControllerCallOperationsRunNoiseV1V1),
|
|
130
|
-
},
|
|
131
|
-
contrast: {
|
|
132
|
-
v1: callMethod((methods) => methods.callControllerCallOperationsRunContrastV1V1),
|
|
133
|
-
},
|
|
134
|
-
composite: {
|
|
135
|
-
v1: callMethod((methods) => methods.callControllerCallOperationsRunCompositeV1V1),
|
|
136
|
-
},
|
|
137
|
-
vton: {
|
|
138
|
-
gisele: {
|
|
139
|
-
v1: callMethod((methods) => methods.callControllerCallOperationsRunVtonGiseleV1V1),
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
negateImage: {
|
|
143
|
-
v1: callMethod((methods) => methods.callControllerCallOperationsRunNegateImageV1V1),
|
|
144
|
-
},
|
|
145
|
-
resize: {
|
|
146
|
-
v1: callMethod((methods) => methods.callControllerCallOperationsRunResizeV1V1),
|
|
147
|
-
},
|
|
148
|
-
strings: {
|
|
149
|
-
template: {
|
|
150
|
-
v1: callMethod((methods) => methods.callControllerCallOperationsRunStringsTemplateV1V1),
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
wait: callMethod((methods) => methods.callControllerCallOperationsWaitV1),
|
|
155
|
-
},
|
|
156
|
-
poses: {
|
|
157
|
-
get: callMethod((methods) => methods.callControllerCallPosesGetV1),
|
|
158
|
-
list: callMethod((methods) => methods.callControllerCallPosesListV1),
|
|
159
|
-
},
|
|
160
|
-
stacks: {
|
|
161
|
-
create: callMethod((methods) => methods.callControllerCallStacksCreateV1),
|
|
162
|
-
get: callMethod((methods) => methods.callControllerCallStacksGetV1),
|
|
163
|
-
list: callMethod((methods) => methods.callControllerCallStacksListV1),
|
|
164
|
-
updateMetadata: callMethod((methods) => methods.callControllerCallStacksMetadataUpdateV1),
|
|
165
|
-
items: {
|
|
166
|
-
add: callMethod((methods) => methods.callControllerCallStacksItemsAddV1),
|
|
167
|
-
remove: callMethod((methods) => methods.callControllerCallStacksItemsRemoveV1),
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
storage: {
|
|
171
|
-
create: callMethod((methods) => methods.callControllerCallStorageCreateV1),
|
|
172
|
-
delete: callMethod((methods) => methods.callControllerCallStorageDeleteV1),
|
|
173
|
-
getMany: callMethod((methods) => methods.callControllerCallStorageGetManyV1),
|
|
174
|
-
update: callMethod((methods) => methods.callControllerCallStorageUpdateV1),
|
|
175
|
-
},
|
|
176
|
-
});
|
|
177
|
-
return {
|
|
178
|
-
constructTemplate: (consructPipeline) => consructPipeline(createPipeline()),
|
|
179
|
-
create: async (props) => api.call({
|
|
180
|
-
run: (methods) => methods.pipelinesControllerCreatePipelineV1({
|
|
181
|
-
metadata: props.metadata,
|
|
182
|
-
tasks: (props.template?.tasks ?? props.tasks),
|
|
183
|
-
state: props.state,
|
|
184
|
-
}),
|
|
185
|
-
}),
|
|
186
|
-
get: async (props) => api.callWithReturningUndefinedOn404({
|
|
187
|
-
run: (methods) => methods.pipelinesControllerGetPipelineV1(props.id),
|
|
188
|
-
}),
|
|
189
|
-
list: (props = {}) => api.call({
|
|
190
|
-
run: (methods) => methods.pipelinesControllerListPipelinesV1(props.orderBy, props.limit, props.cursor),
|
|
191
|
-
transform: transformToListResponse,
|
|
192
|
-
}),
|
|
193
|
-
wait: async (props) => new Promise((resolve, reject) => {
|
|
194
|
-
const initialDelay = 5000;
|
|
195
|
-
const delay = 2000;
|
|
196
|
-
let timeoutId;
|
|
197
|
-
const poll = async () => {
|
|
198
|
-
const pipeline = (await api.call({
|
|
199
|
-
run: (methods) => methods.pipelinesControllerGetPipelineV1(props.id),
|
|
200
|
-
}));
|
|
201
|
-
if (pipeline.status === 'completed')
|
|
202
|
-
return resolve(pipeline);
|
|
203
|
-
if (pipeline.status === 'failed')
|
|
204
|
-
return resolve(pipeline);
|
|
205
|
-
timeoutId = setTimeout(poll, delay);
|
|
206
|
-
};
|
|
207
|
-
timeoutId = setTimeout(poll, initialDelay);
|
|
208
|
-
}),
|
|
209
|
-
};
|
|
210
|
-
};
|
|
211
|
-
export default pipelines;
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
@@ -1,20 +0,0 @@
|
|
|
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;
|
package/dist/sdk/poses/index.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
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;
|
|
@@ -1,29 +0,0 @@
|
|
|
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;
|
package/dist/sdk/stacks/index.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
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;
|
|
@@ -1,18 +0,0 @@
|
|
|
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;
|
|
@@ -1,27 +0,0 @@
|
|
|
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;
|
package/dist/sdk/transformers.js
DELETED
package/dist/sdk/utils/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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;
|
package/dist/sdk/videos/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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;
|
package/dist/token/index.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
};
|
package/dist/token/index.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
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
|
-
};
|
package/dist/types.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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
DELETED
package/openapitools.json
DELETED
package/release.config.cjs
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @type {import('semantic-release').GlobalConfig}
|
|
3
|
-
*/
|
|
4
|
-
module.exports = {
|
|
5
|
-
branches: ['main'],
|
|
6
|
-
plugins: [
|
|
7
|
-
[
|
|
8
|
-
'@semantic-release/commit-analyzer',
|
|
9
|
-
{
|
|
10
|
-
preset: 'angular',
|
|
11
|
-
releaseRules: [
|
|
12
|
-
{
|
|
13
|
-
type: 'docs',
|
|
14
|
-
release: 'patch',
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
type: 'feat',
|
|
18
|
-
release: 'minor',
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
type: 'chore',
|
|
22
|
-
release: 'patch',
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
message: '**',
|
|
26
|
-
release: 'patch',
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
parserOpts: {
|
|
30
|
-
noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES'],
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
"@semantic-release/release-notes-generator",
|
|
35
|
-
"@semantic-release/changelog",
|
|
36
|
-
"@semantic-release/npm",
|
|
37
|
-
"@semantic-release/github"
|
|
38
|
-
],
|
|
39
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
#!/bin/node
|
|
2
|
-
|
|
3
|
-
const url = process.argv[2];
|
|
4
|
-
const outputFilePath = process.argv[3];
|
|
5
|
-
|
|
6
|
-
const loadPermissions = async () => {
|
|
7
|
-
const response = await fetch(url);
|
|
8
|
-
const data = await response.json();
|
|
9
|
-
|
|
10
|
-
const output = {};
|
|
11
|
-
|
|
12
|
-
// Process each permission string into nested structure
|
|
13
|
-
data.forEach((permission) => {
|
|
14
|
-
const parts = permission.split(':');
|
|
15
|
-
let current = output;
|
|
16
|
-
|
|
17
|
-
// Build nested objects for each part
|
|
18
|
-
for (let i = 0; i < parts.length - 1; i++) {
|
|
19
|
-
const part = parts[i];
|
|
20
|
-
if (!current[part]) {
|
|
21
|
-
current[part] = {};
|
|
22
|
-
}
|
|
23
|
-
current = current[part];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Set the final property to boolean type
|
|
27
|
-
const lastPart = parts[parts.length - 1];
|
|
28
|
-
current[lastPart] = 'boolean';
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
// Convert to TypeScript interface string
|
|
32
|
-
const generateTypeString = (obj, indent = '') => {
|
|
33
|
-
const entries = Object.entries(obj);
|
|
34
|
-
if (entries.length === 0) return '{}';
|
|
35
|
-
|
|
36
|
-
return `{\n${entries
|
|
37
|
-
.map(([key, value]) => {
|
|
38
|
-
const valueStr = typeof value === 'string' ? value : generateTypeString(value, indent + ' ');
|
|
39
|
-
return `${indent} ${key}: ${valueStr};`;
|
|
40
|
-
})
|
|
41
|
-
.join('\n')}\n${indent}}`;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const typeString = generateTypeString(output);
|
|
45
|
-
|
|
46
|
-
const fs = require('fs');
|
|
47
|
-
|
|
48
|
-
const fileContent = `// This file is auto-generated. Do not edit manually.
|
|
49
|
-
export type MethodsPermissions = ${typeString};`;
|
|
50
|
-
|
|
51
|
-
fs.writeFileSync(outputFilePath, fileContent);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
loadPermissions();
|
package/scripts/generate.sh
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# This script generates TypeScript code from the Hautech API
|
|
4
|
-
#
|
|
5
|
-
# Usage:
|
|
6
|
-
# ./scripts/generate.sh [API_URL]
|
|
7
|
-
# npm run generate [-- API_URL]
|
|
8
|
-
#
|
|
9
|
-
# Examples:
|
|
10
|
-
# ./scripts/generate.sh # Uses default API URL
|
|
11
|
-
# ./scripts/generate.sh https://custom-api.com # Uses custom API URL
|
|
12
|
-
# npm run generate # Uses default API URL
|
|
13
|
-
# npm run generate -- https://custom-api.com # Uses custom API URL
|
|
14
|
-
#
|
|
15
|
-
# Use the first argument as API_URL if provided, otherwise use the default
|
|
16
|
-
API_URL=${1:-"https://api.hautech.ai"}
|
|
17
|
-
|
|
18
|
-
./node_modules/.bin/openapi-generator-cli generate -i $API_URL/swagger.json -g typescript-axios -o ./src/autogenerated
|
|
19
|
-
node ./scripts/generate-permissions.js $API_URL/v1/permissions/available ./src/autogenerated/permissions.ts
|