@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.js
CHANGED
|
@@ -10315,6 +10315,7 @@ var require_form_data = __commonJS({
|
|
|
10315
10315
|
// src/index.ts
|
|
10316
10316
|
var index_exports = {};
|
|
10317
10317
|
__export(index_exports, {
|
|
10318
|
+
AccessControllerListSharedV1Type: () => AccessControllerListSharedV1Type,
|
|
10318
10319
|
AccountEntityType: () => AccountEntityType,
|
|
10319
10320
|
AccountsControllerListAccountsV1OrderBy: () => AccountsControllerListAccountsV1OrderBy,
|
|
10320
10321
|
AddAccountToGroupControllerParamsDtoRole: () => AddAccountToGroupControllerParamsDtoRole,
|
|
@@ -10570,6 +10571,7 @@ __export(index_exports, {
|
|
|
10570
10571
|
SegmentAnythingMaskV1ResponseKind: () => SegmentAnythingMaskV1ResponseKind,
|
|
10571
10572
|
SegmentAnythingMaskV1ResponseStatus: () => SegmentAnythingMaskV1ResponseStatus,
|
|
10572
10573
|
SelfAccountDtoType: () => SelfAccountDtoType,
|
|
10574
|
+
SharedResourceDtoType: () => SharedResourceDtoType,
|
|
10573
10575
|
StackEntityKind: () => StackEntityKind,
|
|
10574
10576
|
StacksControllerListStacksV1OrderBy: () => StacksControllerListStacksV1OrderBy,
|
|
10575
10577
|
StorageEntityKind: () => StorageEntityKind,
|
|
@@ -10597,6 +10599,7 @@ __export(index_exports, {
|
|
|
10597
10599
|
Yolo11xPoseV1OutputKind: () => Yolo11xPoseV1OutputKind,
|
|
10598
10600
|
Yolo11xPoseV1ResponseKind: () => Yolo11xPoseV1ResponseKind,
|
|
10599
10601
|
Yolo11xPoseV1ResponseStatus: () => Yolo11xPoseV1ResponseStatus,
|
|
10602
|
+
createDirectorySDK: () => createDirectorySDK,
|
|
10600
10603
|
createSDK: () => createSDK,
|
|
10601
10604
|
createTokenSigner: () => createTokenSigner
|
|
10602
10605
|
});
|
|
@@ -10611,6 +10614,10 @@ var getConfig = (options) => ({
|
|
|
10611
10614
|
baseUrl: options.baseUrl ?? "https://api.hautech.ai",
|
|
10612
10615
|
baseWsUrl: options.baseWsUrl ?? options.baseUrl ?? "https://api.hautech.ai"
|
|
10613
10616
|
});
|
|
10617
|
+
var getDirectoryConfig = (options) => ({
|
|
10618
|
+
baseUrl: options.baseUrl ?? "https://api-directory.hautech.ai",
|
|
10619
|
+
authToken: options.authToken
|
|
10620
|
+
});
|
|
10614
10621
|
|
|
10615
10622
|
// src/api-utils.ts
|
|
10616
10623
|
var import_axios = __toESM(require("axios"));
|
|
@@ -10622,52 +10629,56 @@ var isWrappedFn = (fn) => {
|
|
|
10622
10629
|
var isCustomWrappedFn = (fn) => {
|
|
10623
10630
|
return typeof fn === "function" && fn.__customMethodWrapper === true;
|
|
10624
10631
|
};
|
|
10625
|
-
var
|
|
10626
|
-
|
|
10627
|
-
const
|
|
10628
|
-
|
|
10629
|
-
|
|
10630
|
-
|
|
10631
|
-
Authorization: `Bearer ${token}`
|
|
10632
|
-
}
|
|
10633
|
-
};
|
|
10634
|
-
const finalArgs = [...args];
|
|
10635
|
-
const lastParamIndex = fn.length - 1;
|
|
10636
|
-
if (looksLikeAxiosRequestOptions(args[lastParamIndex])) {
|
|
10637
|
-
finalArgs[lastParamIndex] = {
|
|
10638
|
-
...args[lastParamIndex],
|
|
10639
|
-
...baseOptions,
|
|
10632
|
+
var createApiCallWrapper = (getBaseURL) => {
|
|
10633
|
+
return (fn, config) => {
|
|
10634
|
+
const wrapped = async function(...args) {
|
|
10635
|
+
const token = await config.authToken();
|
|
10636
|
+
const baseOptions = {
|
|
10637
|
+
baseURL: getBaseURL(config),
|
|
10640
10638
|
headers: {
|
|
10641
|
-
...args[lastParamIndex]?.headers ?? {},
|
|
10642
10639
|
Authorization: `Bearer ${token}`
|
|
10643
10640
|
}
|
|
10644
10641
|
};
|
|
10645
|
-
|
|
10646
|
-
|
|
10647
|
-
|
|
10648
|
-
|
|
10649
|
-
|
|
10650
|
-
|
|
10651
|
-
|
|
10652
|
-
|
|
10653
|
-
|
|
10654
|
-
|
|
10655
|
-
|
|
10656
|
-
|
|
10657
|
-
|
|
10658
|
-
|
|
10659
|
-
} catch {
|
|
10660
|
-
responseData = "[unserializable data]";
|
|
10642
|
+
const finalArgs = [...args];
|
|
10643
|
+
const lastParamIndex = fn.length - 1;
|
|
10644
|
+
if (looksLikeAxiosRequestOptions(args[lastParamIndex])) {
|
|
10645
|
+
finalArgs[lastParamIndex] = {
|
|
10646
|
+
...args[lastParamIndex],
|
|
10647
|
+
...baseOptions,
|
|
10648
|
+
headers: {
|
|
10649
|
+
...args[lastParamIndex]?.headers ?? {},
|
|
10650
|
+
Authorization: `Bearer ${token}`
|
|
10651
|
+
}
|
|
10652
|
+
};
|
|
10653
|
+
} else {
|
|
10654
|
+
while (finalArgs.length < fn.length - 1) {
|
|
10655
|
+
finalArgs.push(void 0);
|
|
10661
10656
|
}
|
|
10662
|
-
|
|
10657
|
+
finalArgs.push(baseOptions);
|
|
10658
|
+
}
|
|
10659
|
+
try {
|
|
10660
|
+
const res = await fn.call(this, ...finalArgs);
|
|
10661
|
+
return typeof res === "object" && "headers" in res ? res.data : res;
|
|
10662
|
+
} catch (err) {
|
|
10663
|
+
if (import_axios.default.isAxiosError(err)) {
|
|
10664
|
+
let responseData;
|
|
10665
|
+
try {
|
|
10666
|
+
responseData = err.response?.data?.message ?? (typeof err.response?.data === "string" ? err.response.data : JSON.stringify(err.response?.data));
|
|
10667
|
+
} catch {
|
|
10668
|
+
responseData = "[unserializable data]";
|
|
10669
|
+
}
|
|
10670
|
+
err.message = `Request error: ${err.message || "Unknown error"}.
|
|
10663
10671
|
${responseData}`;
|
|
10672
|
+
}
|
|
10673
|
+
throw err;
|
|
10664
10674
|
}
|
|
10665
|
-
|
|
10666
|
-
|
|
10675
|
+
};
|
|
10676
|
+
wrapped.__isWrapped = true;
|
|
10677
|
+
return wrapped;
|
|
10667
10678
|
};
|
|
10668
|
-
wrapped.__isWrapped = true;
|
|
10669
|
-
return wrapped;
|
|
10670
10679
|
};
|
|
10680
|
+
var wrapApiCall = createApiCallWrapper((config) => config.baseUrl);
|
|
10681
|
+
var wrapDirectoryApiCall = createApiCallWrapper((config) => config.baseUrl);
|
|
10671
10682
|
var wrapApiCallNullable = (fn) => {
|
|
10672
10683
|
const wrapped = async (...args) => {
|
|
10673
10684
|
try {
|
|
@@ -10692,9 +10703,9 @@ var wrapCustomMethod = (fn) => {
|
|
|
10692
10703
|
fn.__customMethodWrapper = true;
|
|
10693
10704
|
return fn;
|
|
10694
10705
|
};
|
|
10695
|
-
var wrapApiCallDeep = (obj, config, sdkContext) => {
|
|
10706
|
+
var wrapApiCallDeep = (obj, config, sdkContext, wrapper = wrapApiCall) => {
|
|
10696
10707
|
if (!isWrappedFn(obj) && !isCustomWrappedFn(obj) && typeof obj === "function") {
|
|
10697
|
-
const wrapped =
|
|
10708
|
+
const wrapped = wrapper(obj, config);
|
|
10698
10709
|
return sdkContext ? wrapped.bind(sdkContext) : wrapped;
|
|
10699
10710
|
}
|
|
10700
10711
|
if (typeof obj === "function") {
|
|
@@ -10703,12 +10714,13 @@ var wrapApiCallDeep = (obj, config, sdkContext) => {
|
|
|
10703
10714
|
if (typeof obj === "object" && obj !== null) {
|
|
10704
10715
|
const result = {};
|
|
10705
10716
|
for (const [key, value] of Object.entries(obj)) {
|
|
10706
|
-
result[key] = wrapApiCallDeep(value, config, sdkContext);
|
|
10717
|
+
result[key] = wrapApiCallDeep(value, config, sdkContext, wrapper);
|
|
10707
10718
|
}
|
|
10708
10719
|
return result;
|
|
10709
10720
|
}
|
|
10710
10721
|
return obj;
|
|
10711
10722
|
};
|
|
10723
|
+
var wrapDirectoryApiCallDeep = (obj, config, sdkContext) => wrapApiCallDeep(obj, config, sdkContext, wrapDirectoryApiCall);
|
|
10712
10724
|
var axiosMutator = async (config, options) => {
|
|
10713
10725
|
return import_axios.default.request({
|
|
10714
10726
|
...config,
|
|
@@ -12364,7 +12376,17 @@ var getAccess = () => {
|
|
|
12364
12376
|
options
|
|
12365
12377
|
);
|
|
12366
12378
|
};
|
|
12367
|
-
|
|
12379
|
+
const accessControllerListSharedV1 = (params, options) => {
|
|
12380
|
+
return axiosMutator(
|
|
12381
|
+
{
|
|
12382
|
+
url: `/v1/access/shared`,
|
|
12383
|
+
method: "GET",
|
|
12384
|
+
params
|
|
12385
|
+
},
|
|
12386
|
+
options
|
|
12387
|
+
);
|
|
12388
|
+
};
|
|
12389
|
+
return { accessControllerGrantAccessV1, accessControllerRevokeAccessV1, accessControllerAttachAccessV1, accessControllerDetachAccessV1, accessControllerAccessV1, accessControllerListSharedV1 };
|
|
12368
12390
|
};
|
|
12369
12391
|
|
|
12370
12392
|
// src/sdk/api-definitions/access.ts
|
|
@@ -12375,7 +12397,8 @@ var useAccessApi = () => {
|
|
|
12375
12397
|
detach: api.accessControllerDetachAccessV1,
|
|
12376
12398
|
grant: api.accessControllerGrantAccessV1,
|
|
12377
12399
|
revoke: api.accessControllerRevokeAccessV1,
|
|
12378
|
-
list: api.accessControllerAccessV1
|
|
12400
|
+
list: api.accessControllerAccessV1,
|
|
12401
|
+
listShared: api.accessControllerListSharedV1
|
|
12379
12402
|
});
|
|
12380
12403
|
};
|
|
12381
12404
|
|
|
@@ -12424,6 +12447,20 @@ var getPipelines = () => {
|
|
|
12424
12447
|
return { pipelinesControllerCreatePipelineV1, pipelinesControllerListPipelinesV1, pipelinesControllerCountPipelinesV1, pipelinesControllerGetPipelineV1 };
|
|
12425
12448
|
};
|
|
12426
12449
|
|
|
12450
|
+
// src/autogenerated/schemas/accessControllerListSharedV1Type.ts
|
|
12451
|
+
var AccessControllerListSharedV1Type = {
|
|
12452
|
+
collection: "collection",
|
|
12453
|
+
operation: "operation",
|
|
12454
|
+
stack: "stack",
|
|
12455
|
+
image: "image",
|
|
12456
|
+
video: "video",
|
|
12457
|
+
pose: "pose",
|
|
12458
|
+
storage: "storage",
|
|
12459
|
+
pipeline: "pipeline",
|
|
12460
|
+
workflow: "workflow",
|
|
12461
|
+
dataset: "dataset"
|
|
12462
|
+
};
|
|
12463
|
+
|
|
12427
12464
|
// src/autogenerated/schemas/accountEntityType.ts
|
|
12428
12465
|
var AccountEntityType = {
|
|
12429
12466
|
root: "root",
|
|
@@ -14089,6 +14126,20 @@ var SelfAccountDtoType = {
|
|
|
14089
14126
|
user: "user"
|
|
14090
14127
|
};
|
|
14091
14128
|
|
|
14129
|
+
// src/autogenerated/schemas/sharedResourceDtoType.ts
|
|
14130
|
+
var SharedResourceDtoType = {
|
|
14131
|
+
collection: "collection",
|
|
14132
|
+
operation: "operation",
|
|
14133
|
+
stack: "stack",
|
|
14134
|
+
image: "image",
|
|
14135
|
+
video: "video",
|
|
14136
|
+
pose: "pose",
|
|
14137
|
+
storage: "storage",
|
|
14138
|
+
pipeline: "pipeline",
|
|
14139
|
+
workflow: "workflow",
|
|
14140
|
+
dataset: "dataset"
|
|
14141
|
+
};
|
|
14142
|
+
|
|
14092
14143
|
// src/autogenerated/schemas/stackEntityKind.ts
|
|
14093
14144
|
var StackEntityKind = {
|
|
14094
14145
|
stack: "stack"
|
|
@@ -15772,6 +15823,72 @@ var useLorasApi = () => {
|
|
|
15772
15823
|
});
|
|
15773
15824
|
};
|
|
15774
15825
|
|
|
15826
|
+
// src/autogenerated/directory/user-profiles/user-profiles.ts
|
|
15827
|
+
var getUserProfiles = () => {
|
|
15828
|
+
const createUserProfile = (createUserProfileDto, options) => {
|
|
15829
|
+
return axiosMutator(
|
|
15830
|
+
{
|
|
15831
|
+
url: `/api/v1/user-profiles`,
|
|
15832
|
+
method: "POST",
|
|
15833
|
+
headers: { "Content-Type": "application/json" },
|
|
15834
|
+
data: createUserProfileDto
|
|
15835
|
+
},
|
|
15836
|
+
options
|
|
15837
|
+
);
|
|
15838
|
+
};
|
|
15839
|
+
const getUserProfiles2 = (options) => {
|
|
15840
|
+
return axiosMutator(
|
|
15841
|
+
{
|
|
15842
|
+
url: `/api/v1/user-profiles`,
|
|
15843
|
+
method: "GET"
|
|
15844
|
+
},
|
|
15845
|
+
options
|
|
15846
|
+
);
|
|
15847
|
+
};
|
|
15848
|
+
const getSelfProfile = (options) => {
|
|
15849
|
+
return axiosMutator(
|
|
15850
|
+
{
|
|
15851
|
+
url: `/api/v1/user-profiles/self`,
|
|
15852
|
+
method: "GET"
|
|
15853
|
+
},
|
|
15854
|
+
options
|
|
15855
|
+
);
|
|
15856
|
+
};
|
|
15857
|
+
const getByHandle = (handle, options) => {
|
|
15858
|
+
return axiosMutator(
|
|
15859
|
+
{
|
|
15860
|
+
url: `/api/v1/user-profiles/handle/${handle}`,
|
|
15861
|
+
method: "GET"
|
|
15862
|
+
},
|
|
15863
|
+
options
|
|
15864
|
+
);
|
|
15865
|
+
};
|
|
15866
|
+
const updateUserProfile = (id, updateUserProfileDto, options) => {
|
|
15867
|
+
return axiosMutator(
|
|
15868
|
+
{
|
|
15869
|
+
url: `/api/v1/user-profiles/${id}`,
|
|
15870
|
+
method: "PATCH",
|
|
15871
|
+
headers: { "Content-Type": "application/json" },
|
|
15872
|
+
data: updateUserProfileDto
|
|
15873
|
+
},
|
|
15874
|
+
options
|
|
15875
|
+
);
|
|
15876
|
+
};
|
|
15877
|
+
return { createUserProfile, getUserProfiles: getUserProfiles2, getSelfProfile, getByHandle, updateUserProfile };
|
|
15878
|
+
};
|
|
15879
|
+
|
|
15880
|
+
// src/sdk/api-definitions/user-profiles.ts
|
|
15881
|
+
var useUserProfilesApi = () => {
|
|
15882
|
+
const api = getUserProfiles();
|
|
15883
|
+
return useApi({
|
|
15884
|
+
create: api.createUserProfile,
|
|
15885
|
+
list: api.getUserProfiles,
|
|
15886
|
+
self: api.getSelfProfile,
|
|
15887
|
+
getByHandle: wrapApiCallNullable(api.getByHandle),
|
|
15888
|
+
update: api.updateUserProfile
|
|
15889
|
+
});
|
|
15890
|
+
};
|
|
15891
|
+
|
|
15775
15892
|
// src/sdk/ws-client.ts
|
|
15776
15893
|
var import_socket = require("socket.io-client");
|
|
15777
15894
|
var useWsClient = (config) => new WsClient(config);
|
|
@@ -15868,6 +15985,9 @@ var apiDefinitions = {
|
|
|
15868
15985
|
loras: useLorasApi()
|
|
15869
15986
|
};
|
|
15870
15987
|
var pipelineDefinitions = usePipelineDefinitions();
|
|
15988
|
+
var getDirectoryApiDefinitions = () => ({
|
|
15989
|
+
userProfiles: useUserProfilesApi()
|
|
15990
|
+
});
|
|
15871
15991
|
var getWsClientDefinitions = (config) => ({
|
|
15872
15992
|
ws: useWsClient(config)
|
|
15873
15993
|
});
|
|
@@ -15894,6 +16014,25 @@ var createSDK = (options) => {
|
|
|
15894
16014
|
Object.assign(sdk, wsSdk);
|
|
15895
16015
|
return sdk;
|
|
15896
16016
|
};
|
|
16017
|
+
var createDirectorySDK = (options) => {
|
|
16018
|
+
let token = void 0;
|
|
16019
|
+
const config = getDirectoryConfig(options);
|
|
16020
|
+
const authToken = config.authToken;
|
|
16021
|
+
const getAuthToken = async () => {
|
|
16022
|
+
if (token) {
|
|
16023
|
+
const decoded = (0, import_jose.decodeJwt)(token);
|
|
16024
|
+
const currentTime = Math.floor(Date.now() / 1e3);
|
|
16025
|
+
if (decoded.exp && decoded.exp > currentTime) return token;
|
|
16026
|
+
}
|
|
16027
|
+
token = await authToken();
|
|
16028
|
+
return token;
|
|
16029
|
+
};
|
|
16030
|
+
config.authToken = getAuthToken;
|
|
16031
|
+
const sdk = {};
|
|
16032
|
+
const directorySdk = wrapDirectoryApiCallDeep(getDirectoryApiDefinitions(), config, sdk);
|
|
16033
|
+
Object.assign(sdk, directorySdk);
|
|
16034
|
+
return sdk;
|
|
16035
|
+
};
|
|
15897
16036
|
|
|
15898
16037
|
// src/token.ts
|
|
15899
16038
|
var jose = __toESM(require("jose"));
|
|
@@ -15943,7 +16082,8 @@ var createTokenSigner = (options) => {
|
|
|
15943
16082
|
payload: {
|
|
15944
16083
|
iss: options.appId,
|
|
15945
16084
|
permissions: serializePermissions(props.permissions ?? {}),
|
|
15946
|
-
sub: props.accountId
|
|
16085
|
+
sub: props.accountId,
|
|
16086
|
+
kind: props.kind || "core-api"
|
|
15947
16087
|
}
|
|
15948
16088
|
}),
|
|
15949
16089
|
createRootToken: async (props) => createToken({
|
|
@@ -15952,13 +16092,15 @@ var createTokenSigner = (options) => {
|
|
|
15952
16092
|
expiresInSeconds: props.expiresInSeconds ?? 3600,
|
|
15953
16093
|
payload: {
|
|
15954
16094
|
iss: options.appId,
|
|
15955
|
-
permissions: ["*"]
|
|
16095
|
+
permissions: ["*"],
|
|
16096
|
+
kind: props.kind || "core-api"
|
|
15956
16097
|
}
|
|
15957
16098
|
})
|
|
15958
16099
|
};
|
|
15959
16100
|
};
|
|
15960
16101
|
// Annotate the CommonJS export names for ESM import in node:
|
|
15961
16102
|
0 && (module.exports = {
|
|
16103
|
+
AccessControllerListSharedV1Type,
|
|
15962
16104
|
AccountEntityType,
|
|
15963
16105
|
AccountsControllerListAccountsV1OrderBy,
|
|
15964
16106
|
AddAccountToGroupControllerParamsDtoRole,
|
|
@@ -16214,6 +16356,7 @@ var createTokenSigner = (options) => {
|
|
|
16214
16356
|
SegmentAnythingMaskV1ResponseKind,
|
|
16215
16357
|
SegmentAnythingMaskV1ResponseStatus,
|
|
16216
16358
|
SelfAccountDtoType,
|
|
16359
|
+
SharedResourceDtoType,
|
|
16217
16360
|
StackEntityKind,
|
|
16218
16361
|
StacksControllerListStacksV1OrderBy,
|
|
16219
16362
|
StorageEntityKind,
|
|
@@ -16241,6 +16384,7 @@ var createTokenSigner = (options) => {
|
|
|
16241
16384
|
Yolo11xPoseV1OutputKind,
|
|
16242
16385
|
Yolo11xPoseV1ResponseKind,
|
|
16243
16386
|
Yolo11xPoseV1ResponseStatus,
|
|
16387
|
+
createDirectorySDK,
|
|
16244
16388
|
createSDK,
|
|
16245
16389
|
createTokenSigner
|
|
16246
16390
|
});
|