@hautechai/sdk 2.17.0 → 2.19.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 +172 -2
- package/dist/index.d.ts +172 -2
- package/dist/index.js +188 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +185 -44
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -10300,6 +10300,10 @@ var getConfig = (options) => ({
|
|
|
10300
10300
|
baseUrl: options.baseUrl ?? "https://api.hautech.ai",
|
|
10301
10301
|
baseWsUrl: options.baseWsUrl ?? options.baseUrl ?? "https://api.hautech.ai"
|
|
10302
10302
|
});
|
|
10303
|
+
var getDirectoryConfig = (options) => ({
|
|
10304
|
+
baseUrl: options.baseUrl ?? "https://api-directory.hautech.ai",
|
|
10305
|
+
authToken: options.authToken
|
|
10306
|
+
});
|
|
10303
10307
|
|
|
10304
10308
|
// src/api-utils.ts
|
|
10305
10309
|
import axios from "axios";
|
|
@@ -10311,52 +10315,56 @@ var isWrappedFn = (fn) => {
|
|
|
10311
10315
|
var isCustomWrappedFn = (fn) => {
|
|
10312
10316
|
return typeof fn === "function" && fn.__customMethodWrapper === true;
|
|
10313
10317
|
};
|
|
10314
|
-
var
|
|
10315
|
-
|
|
10316
|
-
const
|
|
10317
|
-
|
|
10318
|
-
|
|
10319
|
-
|
|
10320
|
-
Authorization: `Bearer ${token}`
|
|
10321
|
-
}
|
|
10322
|
-
};
|
|
10323
|
-
const finalArgs = [...args];
|
|
10324
|
-
const lastParamIndex = fn.length - 1;
|
|
10325
|
-
if (looksLikeAxiosRequestOptions(args[lastParamIndex])) {
|
|
10326
|
-
finalArgs[lastParamIndex] = {
|
|
10327
|
-
...args[lastParamIndex],
|
|
10328
|
-
...baseOptions,
|
|
10318
|
+
var createApiCallWrapper = (getBaseURL) => {
|
|
10319
|
+
return (fn, config) => {
|
|
10320
|
+
const wrapped = async function(...args) {
|
|
10321
|
+
const token = await config.authToken();
|
|
10322
|
+
const baseOptions = {
|
|
10323
|
+
baseURL: getBaseURL(config),
|
|
10329
10324
|
headers: {
|
|
10330
|
-
...args[lastParamIndex]?.headers ?? {},
|
|
10331
10325
|
Authorization: `Bearer ${token}`
|
|
10332
10326
|
}
|
|
10333
10327
|
};
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10339
|
-
|
|
10340
|
-
|
|
10341
|
-
|
|
10342
|
-
|
|
10343
|
-
|
|
10344
|
-
|
|
10345
|
-
|
|
10346
|
-
|
|
10347
|
-
|
|
10348
|
-
} catch {
|
|
10349
|
-
responseData = "[unserializable data]";
|
|
10328
|
+
const finalArgs = [...args];
|
|
10329
|
+
const lastParamIndex = fn.length - 1;
|
|
10330
|
+
if (looksLikeAxiosRequestOptions(args[lastParamIndex])) {
|
|
10331
|
+
finalArgs[lastParamIndex] = {
|
|
10332
|
+
...args[lastParamIndex],
|
|
10333
|
+
...baseOptions,
|
|
10334
|
+
headers: {
|
|
10335
|
+
...args[lastParamIndex]?.headers ?? {},
|
|
10336
|
+
Authorization: `Bearer ${token}`
|
|
10337
|
+
}
|
|
10338
|
+
};
|
|
10339
|
+
} else {
|
|
10340
|
+
while (finalArgs.length < fn.length - 1) {
|
|
10341
|
+
finalArgs.push(void 0);
|
|
10350
10342
|
}
|
|
10351
|
-
|
|
10343
|
+
finalArgs.push(baseOptions);
|
|
10344
|
+
}
|
|
10345
|
+
try {
|
|
10346
|
+
const res = await fn.call(this, ...finalArgs);
|
|
10347
|
+
return typeof res === "object" && "headers" in res ? res.data : res;
|
|
10348
|
+
} catch (err) {
|
|
10349
|
+
if (axios.isAxiosError(err)) {
|
|
10350
|
+
let responseData;
|
|
10351
|
+
try {
|
|
10352
|
+
responseData = err.response?.data?.message ?? (typeof err.response?.data === "string" ? err.response.data : JSON.stringify(err.response?.data));
|
|
10353
|
+
} catch {
|
|
10354
|
+
responseData = "[unserializable data]";
|
|
10355
|
+
}
|
|
10356
|
+
err.message = `Request error: ${err.message || "Unknown error"}.
|
|
10352
10357
|
${responseData}`;
|
|
10358
|
+
}
|
|
10359
|
+
throw err;
|
|
10353
10360
|
}
|
|
10354
|
-
|
|
10355
|
-
|
|
10361
|
+
};
|
|
10362
|
+
wrapped.__isWrapped = true;
|
|
10363
|
+
return wrapped;
|
|
10356
10364
|
};
|
|
10357
|
-
wrapped.__isWrapped = true;
|
|
10358
|
-
return wrapped;
|
|
10359
10365
|
};
|
|
10366
|
+
var wrapApiCall = createApiCallWrapper((config) => config.baseUrl);
|
|
10367
|
+
var wrapDirectoryApiCall = createApiCallWrapper((config) => config.baseUrl);
|
|
10360
10368
|
var wrapApiCallNullable = (fn) => {
|
|
10361
10369
|
const wrapped = async (...args) => {
|
|
10362
10370
|
try {
|
|
@@ -10381,9 +10389,9 @@ var wrapCustomMethod = (fn) => {
|
|
|
10381
10389
|
fn.__customMethodWrapper = true;
|
|
10382
10390
|
return fn;
|
|
10383
10391
|
};
|
|
10384
|
-
var wrapApiCallDeep = (obj, config, sdkContext) => {
|
|
10392
|
+
var wrapApiCallDeep = (obj, config, sdkContext, wrapper = wrapApiCall) => {
|
|
10385
10393
|
if (!isWrappedFn(obj) && !isCustomWrappedFn(obj) && typeof obj === "function") {
|
|
10386
|
-
const wrapped =
|
|
10394
|
+
const wrapped = wrapper(obj, config);
|
|
10387
10395
|
return sdkContext ? wrapped.bind(sdkContext) : wrapped;
|
|
10388
10396
|
}
|
|
10389
10397
|
if (typeof obj === "function") {
|
|
@@ -10392,12 +10400,13 @@ var wrapApiCallDeep = (obj, config, sdkContext) => {
|
|
|
10392
10400
|
if (typeof obj === "object" && obj !== null) {
|
|
10393
10401
|
const result = {};
|
|
10394
10402
|
for (const [key, value] of Object.entries(obj)) {
|
|
10395
|
-
result[key] = wrapApiCallDeep(value, config, sdkContext);
|
|
10403
|
+
result[key] = wrapApiCallDeep(value, config, sdkContext, wrapper);
|
|
10396
10404
|
}
|
|
10397
10405
|
return result;
|
|
10398
10406
|
}
|
|
10399
10407
|
return obj;
|
|
10400
10408
|
};
|
|
10409
|
+
var wrapDirectoryApiCallDeep = (obj, config, sdkContext) => wrapApiCallDeep(obj, config, sdkContext, wrapDirectoryApiCall);
|
|
10401
10410
|
var axiosMutator = async (config, options) => {
|
|
10402
10411
|
return axios.request({
|
|
10403
10412
|
...config,
|
|
@@ -12053,7 +12062,17 @@ var getAccess = () => {
|
|
|
12053
12062
|
options
|
|
12054
12063
|
);
|
|
12055
12064
|
};
|
|
12056
|
-
|
|
12065
|
+
const accessControllerListSharedV1 = (params, options) => {
|
|
12066
|
+
return axiosMutator(
|
|
12067
|
+
{
|
|
12068
|
+
url: `/v1/access/shared`,
|
|
12069
|
+
method: "GET",
|
|
12070
|
+
params
|
|
12071
|
+
},
|
|
12072
|
+
options
|
|
12073
|
+
);
|
|
12074
|
+
};
|
|
12075
|
+
return { accessControllerGrantAccessV1, accessControllerRevokeAccessV1, accessControllerAttachAccessV1, accessControllerDetachAccessV1, accessControllerAccessV1, accessControllerListSharedV1 };
|
|
12057
12076
|
};
|
|
12058
12077
|
|
|
12059
12078
|
// src/sdk/api-definitions/access.ts
|
|
@@ -12064,7 +12083,8 @@ var useAccessApi = () => {
|
|
|
12064
12083
|
detach: api.accessControllerDetachAccessV1,
|
|
12065
12084
|
grant: api.accessControllerGrantAccessV1,
|
|
12066
12085
|
revoke: api.accessControllerRevokeAccessV1,
|
|
12067
|
-
list: api.accessControllerAccessV1
|
|
12086
|
+
list: api.accessControllerAccessV1,
|
|
12087
|
+
listShared: api.accessControllerListSharedV1
|
|
12068
12088
|
});
|
|
12069
12089
|
};
|
|
12070
12090
|
|
|
@@ -12113,6 +12133,20 @@ var getPipelines = () => {
|
|
|
12113
12133
|
return { pipelinesControllerCreatePipelineV1, pipelinesControllerListPipelinesV1, pipelinesControllerCountPipelinesV1, pipelinesControllerGetPipelineV1 };
|
|
12114
12134
|
};
|
|
12115
12135
|
|
|
12136
|
+
// src/autogenerated/schemas/accessControllerListSharedV1Type.ts
|
|
12137
|
+
var AccessControllerListSharedV1Type = {
|
|
12138
|
+
collection: "collection",
|
|
12139
|
+
operation: "operation",
|
|
12140
|
+
stack: "stack",
|
|
12141
|
+
image: "image",
|
|
12142
|
+
video: "video",
|
|
12143
|
+
pose: "pose",
|
|
12144
|
+
storage: "storage",
|
|
12145
|
+
pipeline: "pipeline",
|
|
12146
|
+
workflow: "workflow",
|
|
12147
|
+
dataset: "dataset"
|
|
12148
|
+
};
|
|
12149
|
+
|
|
12116
12150
|
// src/autogenerated/schemas/accountEntityType.ts
|
|
12117
12151
|
var AccountEntityType = {
|
|
12118
12152
|
root: "root",
|
|
@@ -13778,6 +13812,20 @@ var SelfAccountDtoType = {
|
|
|
13778
13812
|
user: "user"
|
|
13779
13813
|
};
|
|
13780
13814
|
|
|
13815
|
+
// src/autogenerated/schemas/sharedResourceDtoType.ts
|
|
13816
|
+
var SharedResourceDtoType = {
|
|
13817
|
+
collection: "collection",
|
|
13818
|
+
operation: "operation",
|
|
13819
|
+
stack: "stack",
|
|
13820
|
+
image: "image",
|
|
13821
|
+
video: "video",
|
|
13822
|
+
pose: "pose",
|
|
13823
|
+
storage: "storage",
|
|
13824
|
+
pipeline: "pipeline",
|
|
13825
|
+
workflow: "workflow",
|
|
13826
|
+
dataset: "dataset"
|
|
13827
|
+
};
|
|
13828
|
+
|
|
13781
13829
|
// src/autogenerated/schemas/stackEntityKind.ts
|
|
13782
13830
|
var StackEntityKind = {
|
|
13783
13831
|
stack: "stack"
|
|
@@ -15461,6 +15509,72 @@ var useLorasApi = () => {
|
|
|
15461
15509
|
});
|
|
15462
15510
|
};
|
|
15463
15511
|
|
|
15512
|
+
// src/autogenerated/directory/user-profiles/user-profiles.ts
|
|
15513
|
+
var getUserProfiles = () => {
|
|
15514
|
+
const createUserProfile = (createUserProfileDto, options) => {
|
|
15515
|
+
return axiosMutator(
|
|
15516
|
+
{
|
|
15517
|
+
url: `/api/v1/user-profiles`,
|
|
15518
|
+
method: "POST",
|
|
15519
|
+
headers: { "Content-Type": "application/json" },
|
|
15520
|
+
data: createUserProfileDto
|
|
15521
|
+
},
|
|
15522
|
+
options
|
|
15523
|
+
);
|
|
15524
|
+
};
|
|
15525
|
+
const getUserProfiles2 = (options) => {
|
|
15526
|
+
return axiosMutator(
|
|
15527
|
+
{
|
|
15528
|
+
url: `/api/v1/user-profiles`,
|
|
15529
|
+
method: "GET"
|
|
15530
|
+
},
|
|
15531
|
+
options
|
|
15532
|
+
);
|
|
15533
|
+
};
|
|
15534
|
+
const getSelfProfile = (options) => {
|
|
15535
|
+
return axiosMutator(
|
|
15536
|
+
{
|
|
15537
|
+
url: `/api/v1/user-profiles/self`,
|
|
15538
|
+
method: "GET"
|
|
15539
|
+
},
|
|
15540
|
+
options
|
|
15541
|
+
);
|
|
15542
|
+
};
|
|
15543
|
+
const getByHandle = (handle, options) => {
|
|
15544
|
+
return axiosMutator(
|
|
15545
|
+
{
|
|
15546
|
+
url: `/api/v1/user-profiles/handle/${handle}`,
|
|
15547
|
+
method: "GET"
|
|
15548
|
+
},
|
|
15549
|
+
options
|
|
15550
|
+
);
|
|
15551
|
+
};
|
|
15552
|
+
const updateUserProfile = (id, updateUserProfileDto, options) => {
|
|
15553
|
+
return axiosMutator(
|
|
15554
|
+
{
|
|
15555
|
+
url: `/api/v1/user-profiles/${id}`,
|
|
15556
|
+
method: "PATCH",
|
|
15557
|
+
headers: { "Content-Type": "application/json" },
|
|
15558
|
+
data: updateUserProfileDto
|
|
15559
|
+
},
|
|
15560
|
+
options
|
|
15561
|
+
);
|
|
15562
|
+
};
|
|
15563
|
+
return { createUserProfile, getUserProfiles: getUserProfiles2, getSelfProfile, getByHandle, updateUserProfile };
|
|
15564
|
+
};
|
|
15565
|
+
|
|
15566
|
+
// src/sdk/api-definitions/user-profiles.ts
|
|
15567
|
+
var useUserProfilesApi = () => {
|
|
15568
|
+
const api = getUserProfiles();
|
|
15569
|
+
return useApi({
|
|
15570
|
+
create: api.createUserProfile,
|
|
15571
|
+
list: api.getUserProfiles,
|
|
15572
|
+
self: api.getSelfProfile,
|
|
15573
|
+
getByHandle: wrapApiCallNullable(api.getByHandle),
|
|
15574
|
+
update: api.updateUserProfile
|
|
15575
|
+
});
|
|
15576
|
+
};
|
|
15577
|
+
|
|
15464
15578
|
// src/sdk/ws-client.ts
|
|
15465
15579
|
import { io } from "socket.io-client";
|
|
15466
15580
|
var useWsClient = (config) => new WsClient(config);
|
|
@@ -15557,6 +15671,9 @@ var apiDefinitions = {
|
|
|
15557
15671
|
loras: useLorasApi()
|
|
15558
15672
|
};
|
|
15559
15673
|
var pipelineDefinitions = usePipelineDefinitions();
|
|
15674
|
+
var getDirectoryApiDefinitions = () => ({
|
|
15675
|
+
userProfiles: useUserProfilesApi()
|
|
15676
|
+
});
|
|
15560
15677
|
var getWsClientDefinitions = (config) => ({
|
|
15561
15678
|
ws: useWsClient(config)
|
|
15562
15679
|
});
|
|
@@ -15583,6 +15700,25 @@ var createSDK = (options) => {
|
|
|
15583
15700
|
Object.assign(sdk, wsSdk);
|
|
15584
15701
|
return sdk;
|
|
15585
15702
|
};
|
|
15703
|
+
var createDirectorySDK = (options) => {
|
|
15704
|
+
let token = void 0;
|
|
15705
|
+
const config = getDirectoryConfig(options);
|
|
15706
|
+
const authToken = config.authToken;
|
|
15707
|
+
const getAuthToken = async () => {
|
|
15708
|
+
if (token) {
|
|
15709
|
+
const decoded = decodeJwt(token);
|
|
15710
|
+
const currentTime = Math.floor(Date.now() / 1e3);
|
|
15711
|
+
if (decoded.exp && decoded.exp > currentTime) return token;
|
|
15712
|
+
}
|
|
15713
|
+
token = await authToken();
|
|
15714
|
+
return token;
|
|
15715
|
+
};
|
|
15716
|
+
config.authToken = getAuthToken;
|
|
15717
|
+
const sdk = {};
|
|
15718
|
+
const directorySdk = wrapDirectoryApiCallDeep(getDirectoryApiDefinitions(), config, sdk);
|
|
15719
|
+
Object.assign(sdk, directorySdk);
|
|
15720
|
+
return sdk;
|
|
15721
|
+
};
|
|
15586
15722
|
|
|
15587
15723
|
// src/token.ts
|
|
15588
15724
|
import * as jose from "jose";
|
|
@@ -15632,7 +15768,8 @@ var createTokenSigner = (options) => {
|
|
|
15632
15768
|
payload: {
|
|
15633
15769
|
iss: options.appId,
|
|
15634
15770
|
permissions: serializePermissions(props.permissions ?? {}),
|
|
15635
|
-
sub: props.accountId
|
|
15771
|
+
sub: props.accountId,
|
|
15772
|
+
kind: props.kind || "core-api"
|
|
15636
15773
|
}
|
|
15637
15774
|
}),
|
|
15638
15775
|
createRootToken: async (props) => createToken({
|
|
@@ -15641,12 +15778,14 @@ var createTokenSigner = (options) => {
|
|
|
15641
15778
|
expiresInSeconds: props.expiresInSeconds ?? 3600,
|
|
15642
15779
|
payload: {
|
|
15643
15780
|
iss: options.appId,
|
|
15644
|
-
permissions: ["*"]
|
|
15781
|
+
permissions: ["*"],
|
|
15782
|
+
kind: props.kind || "core-api"
|
|
15645
15783
|
}
|
|
15646
15784
|
})
|
|
15647
15785
|
};
|
|
15648
15786
|
};
|
|
15649
15787
|
export {
|
|
15788
|
+
AccessControllerListSharedV1Type,
|
|
15650
15789
|
AccountEntityType,
|
|
15651
15790
|
AccountsControllerListAccountsV1OrderBy,
|
|
15652
15791
|
AddAccountToGroupControllerParamsDtoRole,
|
|
@@ -15902,6 +16041,7 @@ export {
|
|
|
15902
16041
|
SegmentAnythingMaskV1ResponseKind,
|
|
15903
16042
|
SegmentAnythingMaskV1ResponseStatus,
|
|
15904
16043
|
SelfAccountDtoType,
|
|
16044
|
+
SharedResourceDtoType,
|
|
15905
16045
|
StackEntityKind,
|
|
15906
16046
|
StacksControllerListStacksV1OrderBy,
|
|
15907
16047
|
StorageEntityKind,
|
|
@@ -15929,6 +16069,7 @@ export {
|
|
|
15929
16069
|
Yolo11xPoseV1OutputKind,
|
|
15930
16070
|
Yolo11xPoseV1ResponseKind,
|
|
15931
16071
|
Yolo11xPoseV1ResponseStatus,
|
|
16072
|
+
createDirectorySDK,
|
|
15932
16073
|
createSDK,
|
|
15933
16074
|
createTokenSigner
|
|
15934
16075
|
};
|