@hautechai/sdk 0.0.13 → 0.0.15
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/autogenerated/api.d.ts +122 -27
- package/dist/autogenerated/api.js +172 -1
- package/dist/autogenerated/permissions.d.ts +76 -0
- package/dist/autogenerated/permissions.js +1 -0
- package/dist/sdk/index.d.ts +31 -0
- package/dist/sdk/index.js +4 -2
- package/dist/sdk/pipelines/index.d.ts +35 -0
- package/dist/sdk/pipelines/index.js +53 -0
- package/dist/token/index.d.ts +3 -3
- package/dist/token/index.js +29 -13
- package/dist/token/permissions.d.ts +1 -1
- package/dist/types.d.ts +0 -42
- package/dist/types.js +2 -0
- package/package.json +3 -3
- package/scripts/generate-permissions.js +54 -0
- package/scripts/generate.sh +4 -1
- package/jest.setup.js +0 -5
|
@@ -520,31 +520,31 @@ export interface GenerateV1Input {
|
|
|
520
520
|
* @type {number}
|
|
521
521
|
* @memberof GenerateV1Input
|
|
522
522
|
*/
|
|
523
|
-
'imageWeight'
|
|
523
|
+
'imageWeight'?: number;
|
|
524
524
|
/**
|
|
525
525
|
*
|
|
526
526
|
* @type {string}
|
|
527
527
|
* @memberof GenerateV1Input
|
|
528
528
|
*/
|
|
529
|
-
'negativePrompt'
|
|
529
|
+
'negativePrompt'?: string;
|
|
530
530
|
/**
|
|
531
531
|
*
|
|
532
532
|
* @type {number}
|
|
533
533
|
* @memberof GenerateV1Input
|
|
534
534
|
*/
|
|
535
|
-
'inferenceSteps'
|
|
535
|
+
'inferenceSteps'?: number;
|
|
536
536
|
/**
|
|
537
537
|
*
|
|
538
538
|
* @type {number}
|
|
539
539
|
* @memberof GenerateV1Input
|
|
540
540
|
*/
|
|
541
|
-
'guidanceScale'
|
|
541
|
+
'guidanceScale'?: number;
|
|
542
542
|
/**
|
|
543
543
|
*
|
|
544
544
|
* @type {number}
|
|
545
545
|
* @memberof GenerateV1Input
|
|
546
546
|
*/
|
|
547
|
-
'strength'
|
|
547
|
+
'strength'?: number;
|
|
548
548
|
}
|
|
549
549
|
export declare const GenerateV1InputAspectRatioEnum: {
|
|
550
550
|
readonly _11: "1:1";
|
|
@@ -630,19 +630,19 @@ export interface GenerateV3Input {
|
|
|
630
630
|
* @type {number}
|
|
631
631
|
* @memberof GenerateV3Input
|
|
632
632
|
*/
|
|
633
|
-
'textGuidanceScale'
|
|
633
|
+
'textGuidanceScale'?: number;
|
|
634
634
|
/**
|
|
635
635
|
*
|
|
636
636
|
* @type {number}
|
|
637
637
|
* @memberof GenerateV3Input
|
|
638
638
|
*/
|
|
639
|
-
'imageGuidanceScale'
|
|
639
|
+
'imageGuidanceScale'?: number;
|
|
640
640
|
/**
|
|
641
641
|
*
|
|
642
642
|
* @type {number}
|
|
643
643
|
* @memberof GenerateV3Input
|
|
644
644
|
*/
|
|
645
|
-
'numInferenceSteps'
|
|
645
|
+
'numInferenceSteps'?: number;
|
|
646
646
|
}
|
|
647
647
|
/**
|
|
648
648
|
*
|
|
@@ -941,7 +941,7 @@ export interface InpaintV1Input {
|
|
|
941
941
|
* @type {number}
|
|
942
942
|
* @memberof InpaintV1Input
|
|
943
943
|
*/
|
|
944
|
-
'maskSpread'
|
|
944
|
+
'maskSpread'?: number;
|
|
945
945
|
/**
|
|
946
946
|
*
|
|
947
947
|
* @type {string}
|
|
@@ -977,13 +977,13 @@ export interface InpaintV1Input {
|
|
|
977
977
|
* @type {number}
|
|
978
978
|
* @memberof InpaintV1Input
|
|
979
979
|
*/
|
|
980
|
-
'numInferenceSteps'
|
|
980
|
+
'numInferenceSteps'?: number;
|
|
981
981
|
/**
|
|
982
982
|
*
|
|
983
983
|
* @type {number}
|
|
984
984
|
* @memberof InpaintV1Input
|
|
985
985
|
*/
|
|
986
|
-
'guidanceScale'
|
|
986
|
+
'guidanceScale'?: number;
|
|
987
987
|
}
|
|
988
988
|
/**
|
|
989
989
|
*
|
|
@@ -1058,19 +1058,19 @@ export interface ListOperationsDto {
|
|
|
1058
1058
|
/**
|
|
1059
1059
|
*
|
|
1060
1060
|
* @export
|
|
1061
|
-
* @interface
|
|
1061
|
+
* @interface ListPipelinesDto
|
|
1062
1062
|
*/
|
|
1063
|
-
export interface
|
|
1063
|
+
export interface ListPipelinesDto {
|
|
1064
1064
|
/**
|
|
1065
1065
|
*
|
|
1066
|
-
* @type {Array<
|
|
1067
|
-
* @memberof
|
|
1066
|
+
* @type {Array<PipelineEntity>}
|
|
1067
|
+
* @memberof ListPipelinesDto
|
|
1068
1068
|
*/
|
|
1069
|
-
'data': Array<
|
|
1069
|
+
'data': Array<PipelineEntity>;
|
|
1070
1070
|
/**
|
|
1071
1071
|
*
|
|
1072
1072
|
* @type {ListCollectionsDtoPageInfo}
|
|
1073
|
-
* @memberof
|
|
1073
|
+
* @memberof ListPipelinesDto
|
|
1074
1074
|
*/
|
|
1075
1075
|
'pageInfo': ListCollectionsDtoPageInfo;
|
|
1076
1076
|
}
|
|
@@ -1325,7 +1325,6 @@ export declare const PipelineEntityKindEnum: {
|
|
|
1325
1325
|
export type PipelineEntityKindEnum = typeof PipelineEntityKindEnum[keyof typeof PipelineEntityKindEnum];
|
|
1326
1326
|
export declare const PipelineEntityStatusEnum: {
|
|
1327
1327
|
readonly Pending: "pending";
|
|
1328
|
-
readonly InProgress: "in_progress";
|
|
1329
1328
|
readonly Completed: "completed";
|
|
1330
1329
|
readonly Failed: "failed";
|
|
1331
1330
|
};
|
|
@@ -3436,6 +3435,57 @@ export declare const OperationsControllerListOperationsV1OrderByEnum: {
|
|
|
3436
3435
|
readonly UpdatedAtDesc: "updatedAt_DESC";
|
|
3437
3436
|
};
|
|
3438
3437
|
export type OperationsControllerListOperationsV1OrderByEnum = typeof OperationsControllerListOperationsV1OrderByEnum[keyof typeof OperationsControllerListOperationsV1OrderByEnum];
|
|
3438
|
+
/**
|
|
3439
|
+
* PermissionsApi - axios parameter creator
|
|
3440
|
+
* @export
|
|
3441
|
+
*/
|
|
3442
|
+
export declare const PermissionsApiAxiosParamCreator: (configuration?: Configuration) => {
|
|
3443
|
+
/**
|
|
3444
|
+
*
|
|
3445
|
+
* @param {*} [options] Override http request option.
|
|
3446
|
+
* @throws {RequiredError}
|
|
3447
|
+
*/
|
|
3448
|
+
permissionsControllerListAvailablePermissionsV1: (options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
|
|
3449
|
+
};
|
|
3450
|
+
/**
|
|
3451
|
+
* PermissionsApi - functional programming interface
|
|
3452
|
+
* @export
|
|
3453
|
+
*/
|
|
3454
|
+
export declare const PermissionsApiFp: (configuration?: Configuration) => {
|
|
3455
|
+
/**
|
|
3456
|
+
*
|
|
3457
|
+
* @param {*} [options] Override http request option.
|
|
3458
|
+
* @throws {RequiredError}
|
|
3459
|
+
*/
|
|
3460
|
+
permissionsControllerListAvailablePermissionsV1(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Array<string>>>;
|
|
3461
|
+
};
|
|
3462
|
+
/**
|
|
3463
|
+
* PermissionsApi - factory interface
|
|
3464
|
+
* @export
|
|
3465
|
+
*/
|
|
3466
|
+
export declare const PermissionsApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => {
|
|
3467
|
+
/**
|
|
3468
|
+
*
|
|
3469
|
+
* @param {*} [options] Override http request option.
|
|
3470
|
+
* @throws {RequiredError}
|
|
3471
|
+
*/
|
|
3472
|
+
permissionsControllerListAvailablePermissionsV1(options?: RawAxiosRequestConfig): AxiosPromise<Array<string>>;
|
|
3473
|
+
};
|
|
3474
|
+
/**
|
|
3475
|
+
* PermissionsApi - object-oriented interface
|
|
3476
|
+
* @export
|
|
3477
|
+
* @class PermissionsApi
|
|
3478
|
+
* @extends {BaseAPI}
|
|
3479
|
+
*/
|
|
3480
|
+
export declare class PermissionsApi extends BaseAPI {
|
|
3481
|
+
/**
|
|
3482
|
+
*
|
|
3483
|
+
* @param {*} [options] Override http request option.
|
|
3484
|
+
* @throws {RequiredError}
|
|
3485
|
+
* @memberof PermissionsApi
|
|
3486
|
+
*/
|
|
3487
|
+
permissionsControllerListAvailablePermissionsV1(options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<string[], any>>;
|
|
3488
|
+
}
|
|
3439
3489
|
/**
|
|
3440
3490
|
* PipelinesApi - axios parameter creator
|
|
3441
3491
|
* @export
|
|
@@ -3455,6 +3505,15 @@ export declare const PipelinesApiAxiosParamCreator: (configuration?: Configurati
|
|
|
3455
3505
|
* @throws {RequiredError}
|
|
3456
3506
|
*/
|
|
3457
3507
|
pipelinesControllerGetPipelineV1: (id: string, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
|
|
3508
|
+
/**
|
|
3509
|
+
*
|
|
3510
|
+
* @param {PipelinesControllerListPipelinesV1OrderByEnum} [orderBy]
|
|
3511
|
+
* @param {number} [limit]
|
|
3512
|
+
* @param {string} [cursor]
|
|
3513
|
+
* @param {*} [options] Override http request option.
|
|
3514
|
+
* @throws {RequiredError}
|
|
3515
|
+
*/
|
|
3516
|
+
pipelinesControllerListPipelinesV1: (orderBy?: PipelinesControllerListPipelinesV1OrderByEnum, limit?: number, cursor?: string, options?: RawAxiosRequestConfig) => Promise<RequestArgs>;
|
|
3458
3517
|
};
|
|
3459
3518
|
/**
|
|
3460
3519
|
* PipelinesApi - functional programming interface
|
|
@@ -3474,7 +3533,16 @@ export declare const PipelinesApiFp: (configuration?: Configuration) => {
|
|
|
3474
3533
|
* @param {*} [options] Override http request option.
|
|
3475
3534
|
* @throws {RequiredError}
|
|
3476
3535
|
*/
|
|
3477
|
-
pipelinesControllerGetPipelineV1(id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<
|
|
3536
|
+
pipelinesControllerGetPipelineV1(id: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PipelineEntity>>;
|
|
3537
|
+
/**
|
|
3538
|
+
*
|
|
3539
|
+
* @param {PipelinesControllerListPipelinesV1OrderByEnum} [orderBy]
|
|
3540
|
+
* @param {number} [limit]
|
|
3541
|
+
* @param {string} [cursor]
|
|
3542
|
+
* @param {*} [options] Override http request option.
|
|
3543
|
+
* @throws {RequiredError}
|
|
3544
|
+
*/
|
|
3545
|
+
pipelinesControllerListPipelinesV1(orderBy?: PipelinesControllerListPipelinesV1OrderByEnum, limit?: number, cursor?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListPipelinesDto>>;
|
|
3478
3546
|
};
|
|
3479
3547
|
/**
|
|
3480
3548
|
* PipelinesApi - factory interface
|
|
@@ -3494,7 +3562,16 @@ export declare const PipelinesApiFactory: (configuration?: Configuration, basePa
|
|
|
3494
3562
|
* @param {*} [options] Override http request option.
|
|
3495
3563
|
* @throws {RequiredError}
|
|
3496
3564
|
*/
|
|
3497
|
-
pipelinesControllerGetPipelineV1(id: string, options?: RawAxiosRequestConfig): AxiosPromise<
|
|
3565
|
+
pipelinesControllerGetPipelineV1(id: string, options?: RawAxiosRequestConfig): AxiosPromise<PipelineEntity>;
|
|
3566
|
+
/**
|
|
3567
|
+
*
|
|
3568
|
+
* @param {PipelinesControllerListPipelinesV1OrderByEnum} [orderBy]
|
|
3569
|
+
* @param {number} [limit]
|
|
3570
|
+
* @param {string} [cursor]
|
|
3571
|
+
* @param {*} [options] Override http request option.
|
|
3572
|
+
* @throws {RequiredError}
|
|
3573
|
+
*/
|
|
3574
|
+
pipelinesControllerListPipelinesV1(orderBy?: PipelinesControllerListPipelinesV1OrderByEnum, limit?: number, cursor?: string, options?: RawAxiosRequestConfig): AxiosPromise<ListPipelinesDto>;
|
|
3498
3575
|
};
|
|
3499
3576
|
/**
|
|
3500
3577
|
* PipelinesApi - object-oriented interface
|
|
@@ -3518,8 +3595,26 @@ export declare class PipelinesApi extends BaseAPI {
|
|
|
3518
3595
|
* @throws {RequiredError}
|
|
3519
3596
|
* @memberof PipelinesApi
|
|
3520
3597
|
*/
|
|
3521
|
-
pipelinesControllerGetPipelineV1(id: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<
|
|
3598
|
+
pipelinesControllerGetPipelineV1(id: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<PipelineEntity, any>>;
|
|
3599
|
+
/**
|
|
3600
|
+
*
|
|
3601
|
+
* @param {PipelinesControllerListPipelinesV1OrderByEnum} [orderBy]
|
|
3602
|
+
* @param {number} [limit]
|
|
3603
|
+
* @param {string} [cursor]
|
|
3604
|
+
* @param {*} [options] Override http request option.
|
|
3605
|
+
* @throws {RequiredError}
|
|
3606
|
+
* @memberof PipelinesApi
|
|
3607
|
+
*/
|
|
3608
|
+
pipelinesControllerListPipelinesV1(orderBy?: PipelinesControllerListPipelinesV1OrderByEnum, limit?: number, cursor?: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<ListPipelinesDto, any>>;
|
|
3522
3609
|
}
|
|
3610
|
+
/**
|
|
3611
|
+
* @export
|
|
3612
|
+
*/
|
|
3613
|
+
export declare const PipelinesControllerListPipelinesV1OrderByEnum: {
|
|
3614
|
+
readonly Asc: "createdAt_ASC";
|
|
3615
|
+
readonly Desc: "createdAt_DESC";
|
|
3616
|
+
};
|
|
3617
|
+
export type PipelinesControllerListPipelinesV1OrderByEnum = typeof PipelinesControllerListPipelinesV1OrderByEnum[keyof typeof PipelinesControllerListPipelinesV1OrderByEnum];
|
|
3523
3618
|
/**
|
|
3524
3619
|
* PosesApi - axios parameter creator
|
|
3525
3620
|
* @export
|
|
@@ -3562,7 +3657,7 @@ export declare const PosesApiFp: (configuration?: Configuration) => {
|
|
|
3562
3657
|
* @param {*} [options] Override http request option.
|
|
3563
3658
|
* @throws {RequiredError}
|
|
3564
3659
|
*/
|
|
3565
|
-
posesControllerListPosesV1(orderBy?: PosesControllerListPosesV1OrderByEnum, limit?: number, cursor?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<
|
|
3660
|
+
posesControllerListPosesV1(orderBy?: PosesControllerListPosesV1OrderByEnum, limit?: number, cursor?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListPipelinesDto>>;
|
|
3566
3661
|
};
|
|
3567
3662
|
/**
|
|
3568
3663
|
* PosesApi - factory interface
|
|
@@ -3584,7 +3679,7 @@ export declare const PosesApiFactory: (configuration?: Configuration, basePath?:
|
|
|
3584
3679
|
* @param {*} [options] Override http request option.
|
|
3585
3680
|
* @throws {RequiredError}
|
|
3586
3681
|
*/
|
|
3587
|
-
posesControllerListPosesV1(orderBy?: PosesControllerListPosesV1OrderByEnum, limit?: number, cursor?: string, options?: RawAxiosRequestConfig): AxiosPromise<
|
|
3682
|
+
posesControllerListPosesV1(orderBy?: PosesControllerListPosesV1OrderByEnum, limit?: number, cursor?: string, options?: RawAxiosRequestConfig): AxiosPromise<ListPipelinesDto>;
|
|
3588
3683
|
};
|
|
3589
3684
|
/**
|
|
3590
3685
|
* PosesApi - object-oriented interface
|
|
@@ -3610,7 +3705,7 @@ export declare class PosesApi extends BaseAPI {
|
|
|
3610
3705
|
* @throws {RequiredError}
|
|
3611
3706
|
* @memberof PosesApi
|
|
3612
3707
|
*/
|
|
3613
|
-
posesControllerListPosesV1(orderBy?: PosesControllerListPosesV1OrderByEnum, limit?: number, cursor?: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<
|
|
3708
|
+
posesControllerListPosesV1(orderBy?: PosesControllerListPosesV1OrderByEnum, limit?: number, cursor?: string, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<ListPipelinesDto, any>>;
|
|
3614
3709
|
}
|
|
3615
3710
|
/**
|
|
3616
3711
|
* @export
|
|
@@ -3895,7 +3990,7 @@ export declare const StorageApiFp: (configuration?: Configuration) => {
|
|
|
3895
3990
|
* @param {*} [options] Override http request option.
|
|
3896
3991
|
* @throws {RequiredError}
|
|
3897
3992
|
*/
|
|
3898
|
-
storageControllerCreateRecordV1(createStorageRecordParamsDto: CreateStorageRecordParamsDto, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<
|
|
3993
|
+
storageControllerCreateRecordV1(createStorageRecordParamsDto: CreateStorageRecordParamsDto, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<StorageEntity>>;
|
|
3899
3994
|
/**
|
|
3900
3995
|
*
|
|
3901
3996
|
* @param {DeleteStorageParamsDto} deleteStorageParamsDto
|
|
@@ -3929,7 +4024,7 @@ export declare const StorageApiFactory: (configuration?: Configuration, basePath
|
|
|
3929
4024
|
* @param {*} [options] Override http request option.
|
|
3930
4025
|
* @throws {RequiredError}
|
|
3931
4026
|
*/
|
|
3932
|
-
storageControllerCreateRecordV1(createStorageRecordParamsDto: CreateStorageRecordParamsDto, options?: RawAxiosRequestConfig): AxiosPromise<
|
|
4027
|
+
storageControllerCreateRecordV1(createStorageRecordParamsDto: CreateStorageRecordParamsDto, options?: RawAxiosRequestConfig): AxiosPromise<StorageEntity>;
|
|
3933
4028
|
/**
|
|
3934
4029
|
*
|
|
3935
4030
|
* @param {DeleteStorageParamsDto} deleteStorageParamsDto
|
|
@@ -3966,7 +4061,7 @@ export declare class StorageApi extends BaseAPI {
|
|
|
3966
4061
|
* @throws {RequiredError}
|
|
3967
4062
|
* @memberof StorageApi
|
|
3968
4063
|
*/
|
|
3969
|
-
storageControllerCreateRecordV1(createStorageRecordParamsDto: CreateStorageRecordParamsDto, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<
|
|
4064
|
+
storageControllerCreateRecordV1(createStorageRecordParamsDto: CreateStorageRecordParamsDto, options?: RawAxiosRequestConfig): Promise<import("axios").AxiosResponse<StorageEntity, any>>;
|
|
3970
4065
|
/**
|
|
3971
4066
|
*
|
|
3972
4067
|
* @param {DeleteStorageParamsDto} deleteStorageParamsDto
|
|
@@ -98,7 +98,6 @@ export const PipelineEntityKindEnum = {
|
|
|
98
98
|
};
|
|
99
99
|
export const PipelineEntityStatusEnum = {
|
|
100
100
|
Pending: 'pending',
|
|
101
|
-
InProgress: 'in_progress',
|
|
102
101
|
Completed: 'completed',
|
|
103
102
|
Failed: 'failed'
|
|
104
103
|
};
|
|
@@ -3443,6 +3442,95 @@ export const OperationsControllerListOperationsV1OrderByEnum = {
|
|
|
3443
3442
|
UpdatedAtAsc: 'updatedAt_ASC',
|
|
3444
3443
|
UpdatedAtDesc: 'updatedAt_DESC'
|
|
3445
3444
|
};
|
|
3445
|
+
/**
|
|
3446
|
+
* PermissionsApi - axios parameter creator
|
|
3447
|
+
* @export
|
|
3448
|
+
*/
|
|
3449
|
+
export const PermissionsApiAxiosParamCreator = function (configuration) {
|
|
3450
|
+
return {
|
|
3451
|
+
/**
|
|
3452
|
+
*
|
|
3453
|
+
* @param {*} [options] Override http request option.
|
|
3454
|
+
* @throws {RequiredError}
|
|
3455
|
+
*/
|
|
3456
|
+
permissionsControllerListAvailablePermissionsV1: async (options = {}) => {
|
|
3457
|
+
const localVarPath = `/v1/permissions/available`;
|
|
3458
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
3459
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
3460
|
+
let baseOptions;
|
|
3461
|
+
if (configuration) {
|
|
3462
|
+
baseOptions = configuration.baseOptions;
|
|
3463
|
+
}
|
|
3464
|
+
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
|
|
3465
|
+
const localVarHeaderParameter = {};
|
|
3466
|
+
const localVarQueryParameter = {};
|
|
3467
|
+
// authentication bearer required
|
|
3468
|
+
// http bearer authentication required
|
|
3469
|
+
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
3470
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
3471
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
3472
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
3473
|
+
return {
|
|
3474
|
+
url: toPathString(localVarUrlObj),
|
|
3475
|
+
options: localVarRequestOptions,
|
|
3476
|
+
};
|
|
3477
|
+
},
|
|
3478
|
+
};
|
|
3479
|
+
};
|
|
3480
|
+
/**
|
|
3481
|
+
* PermissionsApi - functional programming interface
|
|
3482
|
+
* @export
|
|
3483
|
+
*/
|
|
3484
|
+
export const PermissionsApiFp = function (configuration) {
|
|
3485
|
+
const localVarAxiosParamCreator = PermissionsApiAxiosParamCreator(configuration);
|
|
3486
|
+
return {
|
|
3487
|
+
/**
|
|
3488
|
+
*
|
|
3489
|
+
* @param {*} [options] Override http request option.
|
|
3490
|
+
* @throws {RequiredError}
|
|
3491
|
+
*/
|
|
3492
|
+
async permissionsControllerListAvailablePermissionsV1(options) {
|
|
3493
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.permissionsControllerListAvailablePermissionsV1(options);
|
|
3494
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
3495
|
+
const localVarOperationServerBasePath = operationServerMap['PermissionsApi.permissionsControllerListAvailablePermissionsV1']?.[localVarOperationServerIndex]?.url;
|
|
3496
|
+
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
3497
|
+
},
|
|
3498
|
+
};
|
|
3499
|
+
};
|
|
3500
|
+
/**
|
|
3501
|
+
* PermissionsApi - factory interface
|
|
3502
|
+
* @export
|
|
3503
|
+
*/
|
|
3504
|
+
export const PermissionsApiFactory = function (configuration, basePath, axios) {
|
|
3505
|
+
const localVarFp = PermissionsApiFp(configuration);
|
|
3506
|
+
return {
|
|
3507
|
+
/**
|
|
3508
|
+
*
|
|
3509
|
+
* @param {*} [options] Override http request option.
|
|
3510
|
+
* @throws {RequiredError}
|
|
3511
|
+
*/
|
|
3512
|
+
permissionsControllerListAvailablePermissionsV1(options) {
|
|
3513
|
+
return localVarFp.permissionsControllerListAvailablePermissionsV1(options).then((request) => request(axios, basePath));
|
|
3514
|
+
},
|
|
3515
|
+
};
|
|
3516
|
+
};
|
|
3517
|
+
/**
|
|
3518
|
+
* PermissionsApi - object-oriented interface
|
|
3519
|
+
* @export
|
|
3520
|
+
* @class PermissionsApi
|
|
3521
|
+
* @extends {BaseAPI}
|
|
3522
|
+
*/
|
|
3523
|
+
export class PermissionsApi extends BaseAPI {
|
|
3524
|
+
/**
|
|
3525
|
+
*
|
|
3526
|
+
* @param {*} [options] Override http request option.
|
|
3527
|
+
* @throws {RequiredError}
|
|
3528
|
+
* @memberof PermissionsApi
|
|
3529
|
+
*/
|
|
3530
|
+
permissionsControllerListAvailablePermissionsV1(options) {
|
|
3531
|
+
return PermissionsApiFp(this.configuration).permissionsControllerListAvailablePermissionsV1(options).then((request) => request(this.axios, this.basePath));
|
|
3532
|
+
}
|
|
3533
|
+
}
|
|
3446
3534
|
/**
|
|
3447
3535
|
* PipelinesApi - axios parameter creator
|
|
3448
3536
|
* @export
|
|
@@ -3512,6 +3600,45 @@ export const PipelinesApiAxiosParamCreator = function (configuration) {
|
|
|
3512
3600
|
options: localVarRequestOptions,
|
|
3513
3601
|
};
|
|
3514
3602
|
},
|
|
3603
|
+
/**
|
|
3604
|
+
*
|
|
3605
|
+
* @param {PipelinesControllerListPipelinesV1OrderByEnum} [orderBy]
|
|
3606
|
+
* @param {number} [limit]
|
|
3607
|
+
* @param {string} [cursor]
|
|
3608
|
+
* @param {*} [options] Override http request option.
|
|
3609
|
+
* @throws {RequiredError}
|
|
3610
|
+
*/
|
|
3611
|
+
pipelinesControllerListPipelinesV1: async (orderBy, limit, cursor, options = {}) => {
|
|
3612
|
+
const localVarPath = `/v1/pipelines`;
|
|
3613
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
3614
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
3615
|
+
let baseOptions;
|
|
3616
|
+
if (configuration) {
|
|
3617
|
+
baseOptions = configuration.baseOptions;
|
|
3618
|
+
}
|
|
3619
|
+
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
|
|
3620
|
+
const localVarHeaderParameter = {};
|
|
3621
|
+
const localVarQueryParameter = {};
|
|
3622
|
+
// authentication bearer required
|
|
3623
|
+
// http bearer authentication required
|
|
3624
|
+
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
3625
|
+
if (orderBy !== undefined) {
|
|
3626
|
+
localVarQueryParameter['orderBy'] = orderBy;
|
|
3627
|
+
}
|
|
3628
|
+
if (limit !== undefined) {
|
|
3629
|
+
localVarQueryParameter['limit'] = limit;
|
|
3630
|
+
}
|
|
3631
|
+
if (cursor !== undefined) {
|
|
3632
|
+
localVarQueryParameter['cursor'] = cursor;
|
|
3633
|
+
}
|
|
3634
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
3635
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
3636
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
3637
|
+
return {
|
|
3638
|
+
url: toPathString(localVarUrlObj),
|
|
3639
|
+
options: localVarRequestOptions,
|
|
3640
|
+
};
|
|
3641
|
+
},
|
|
3515
3642
|
};
|
|
3516
3643
|
};
|
|
3517
3644
|
/**
|
|
@@ -3545,6 +3672,20 @@ export const PipelinesApiFp = function (configuration) {
|
|
|
3545
3672
|
const localVarOperationServerBasePath = operationServerMap['PipelinesApi.pipelinesControllerGetPipelineV1']?.[localVarOperationServerIndex]?.url;
|
|
3546
3673
|
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
3547
3674
|
},
|
|
3675
|
+
/**
|
|
3676
|
+
*
|
|
3677
|
+
* @param {PipelinesControllerListPipelinesV1OrderByEnum} [orderBy]
|
|
3678
|
+
* @param {number} [limit]
|
|
3679
|
+
* @param {string} [cursor]
|
|
3680
|
+
* @param {*} [options] Override http request option.
|
|
3681
|
+
* @throws {RequiredError}
|
|
3682
|
+
*/
|
|
3683
|
+
async pipelinesControllerListPipelinesV1(orderBy, limit, cursor, options) {
|
|
3684
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.pipelinesControllerListPipelinesV1(orderBy, limit, cursor, options);
|
|
3685
|
+
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
|
|
3686
|
+
const localVarOperationServerBasePath = operationServerMap['PipelinesApi.pipelinesControllerListPipelinesV1']?.[localVarOperationServerIndex]?.url;
|
|
3687
|
+
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
|
|
3688
|
+
},
|
|
3548
3689
|
};
|
|
3549
3690
|
};
|
|
3550
3691
|
/**
|
|
@@ -3572,6 +3713,17 @@ export const PipelinesApiFactory = function (configuration, basePath, axios) {
|
|
|
3572
3713
|
pipelinesControllerGetPipelineV1(id, options) {
|
|
3573
3714
|
return localVarFp.pipelinesControllerGetPipelineV1(id, options).then((request) => request(axios, basePath));
|
|
3574
3715
|
},
|
|
3716
|
+
/**
|
|
3717
|
+
*
|
|
3718
|
+
* @param {PipelinesControllerListPipelinesV1OrderByEnum} [orderBy]
|
|
3719
|
+
* @param {number} [limit]
|
|
3720
|
+
* @param {string} [cursor]
|
|
3721
|
+
* @param {*} [options] Override http request option.
|
|
3722
|
+
* @throws {RequiredError}
|
|
3723
|
+
*/
|
|
3724
|
+
pipelinesControllerListPipelinesV1(orderBy, limit, cursor, options) {
|
|
3725
|
+
return localVarFp.pipelinesControllerListPipelinesV1(orderBy, limit, cursor, options).then((request) => request(axios, basePath));
|
|
3726
|
+
},
|
|
3575
3727
|
};
|
|
3576
3728
|
};
|
|
3577
3729
|
/**
|
|
@@ -3601,7 +3753,26 @@ export class PipelinesApi extends BaseAPI {
|
|
|
3601
3753
|
pipelinesControllerGetPipelineV1(id, options) {
|
|
3602
3754
|
return PipelinesApiFp(this.configuration).pipelinesControllerGetPipelineV1(id, options).then((request) => request(this.axios, this.basePath));
|
|
3603
3755
|
}
|
|
3756
|
+
/**
|
|
3757
|
+
*
|
|
3758
|
+
* @param {PipelinesControllerListPipelinesV1OrderByEnum} [orderBy]
|
|
3759
|
+
* @param {number} [limit]
|
|
3760
|
+
* @param {string} [cursor]
|
|
3761
|
+
* @param {*} [options] Override http request option.
|
|
3762
|
+
* @throws {RequiredError}
|
|
3763
|
+
* @memberof PipelinesApi
|
|
3764
|
+
*/
|
|
3765
|
+
pipelinesControllerListPipelinesV1(orderBy, limit, cursor, options) {
|
|
3766
|
+
return PipelinesApiFp(this.configuration).pipelinesControllerListPipelinesV1(orderBy, limit, cursor, options).then((request) => request(this.axios, this.basePath));
|
|
3767
|
+
}
|
|
3604
3768
|
}
|
|
3769
|
+
/**
|
|
3770
|
+
* @export
|
|
3771
|
+
*/
|
|
3772
|
+
export const PipelinesControllerListPipelinesV1OrderByEnum = {
|
|
3773
|
+
Asc: 'createdAt_ASC',
|
|
3774
|
+
Desc: 'createdAt_DESC'
|
|
3775
|
+
};
|
|
3605
3776
|
/**
|
|
3606
3777
|
* PosesApi - axios parameter creator
|
|
3607
3778
|
* @export
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export type MethodsPermissions = {
|
|
2
|
+
access: {
|
|
3
|
+
add: boolean;
|
|
4
|
+
read: boolean;
|
|
5
|
+
remove: boolean;
|
|
6
|
+
};
|
|
7
|
+
accounts: {
|
|
8
|
+
create: boolean;
|
|
9
|
+
read: boolean;
|
|
10
|
+
};
|
|
11
|
+
balances: {
|
|
12
|
+
read: boolean;
|
|
13
|
+
update: boolean;
|
|
14
|
+
self: {
|
|
15
|
+
read: boolean;
|
|
16
|
+
update: boolean;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
collections: {
|
|
20
|
+
create: boolean;
|
|
21
|
+
read: boolean;
|
|
22
|
+
update: boolean;
|
|
23
|
+
items: {
|
|
24
|
+
add: boolean;
|
|
25
|
+
read: boolean;
|
|
26
|
+
remove: boolean;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
groups: {
|
|
30
|
+
create: boolean;
|
|
31
|
+
read: boolean;
|
|
32
|
+
delete: boolean;
|
|
33
|
+
accounts: {
|
|
34
|
+
add: boolean;
|
|
35
|
+
remove: boolean;
|
|
36
|
+
read: boolean;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
images: {
|
|
40
|
+
create: boolean;
|
|
41
|
+
read: boolean;
|
|
42
|
+
};
|
|
43
|
+
operations: {
|
|
44
|
+
create: boolean;
|
|
45
|
+
read: boolean;
|
|
46
|
+
metadata: {
|
|
47
|
+
update: boolean;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
pipelines: {
|
|
51
|
+
create: boolean;
|
|
52
|
+
read: boolean;
|
|
53
|
+
update: boolean;
|
|
54
|
+
};
|
|
55
|
+
poses: {
|
|
56
|
+
create: boolean;
|
|
57
|
+
read: boolean;
|
|
58
|
+
};
|
|
59
|
+
stacks: {
|
|
60
|
+
create: boolean;
|
|
61
|
+
read: boolean;
|
|
62
|
+
items: {
|
|
63
|
+
add: boolean;
|
|
64
|
+
remove: boolean;
|
|
65
|
+
};
|
|
66
|
+
metadata: {
|
|
67
|
+
update: boolean;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
storage: {
|
|
71
|
+
create: boolean;
|
|
72
|
+
delete: boolean;
|
|
73
|
+
read: boolean;
|
|
74
|
+
update: boolean;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -162,6 +162,37 @@ export declare const createSDK: (options: SDKOptions) => {
|
|
|
162
162
|
timeoutInSeconds?: number;
|
|
163
163
|
}) => Promise<import("../types").OperationEntity>;
|
|
164
164
|
};
|
|
165
|
+
pipelines: {
|
|
166
|
+
create: (props: {
|
|
167
|
+
metadata?: any;
|
|
168
|
+
tasks: (pipeline: ReturnType<() => import("@hautechai/pipelines").Pipeline<{
|
|
169
|
+
collections: {
|
|
170
|
+
create: (params: import("../autogenerated").CreateCollectionParamsDto) => Promise<import("../types").CollectionEntity>;
|
|
171
|
+
get: (params: import("../autogenerated").GetCollectionParamsDto) => Promise<import("../types").CollectionEntity>;
|
|
172
|
+
};
|
|
173
|
+
stacks: {
|
|
174
|
+
create: (params: import("../autogenerated").CreateStackParamsDto) => Promise<import("../types").StackEntity>;
|
|
175
|
+
get: (params: import("../autogenerated").ListStacksParamsDto) => Promise<import("../types").StackEntity>;
|
|
176
|
+
};
|
|
177
|
+
}>>) => ReturnType<() => import("@hautechai/pipelines").Pipeline<{
|
|
178
|
+
collections: {
|
|
179
|
+
create: (params: import("../autogenerated").CreateCollectionParamsDto) => Promise<import("../types").CollectionEntity>;
|
|
180
|
+
get: (params: import("../autogenerated").GetCollectionParamsDto) => Promise<import("../types").CollectionEntity>;
|
|
181
|
+
};
|
|
182
|
+
stacks: {
|
|
183
|
+
create: (params: import("../autogenerated").CreateStackParamsDto) => Promise<import("../types").StackEntity>;
|
|
184
|
+
get: (params: import("../autogenerated").ListStacksParamsDto) => Promise<import("../types").StackEntity>;
|
|
185
|
+
};
|
|
186
|
+
}>>;
|
|
187
|
+
}) => Promise<import("../types").PipelineEntity>;
|
|
188
|
+
get: (props: {
|
|
189
|
+
id: string;
|
|
190
|
+
}) => Promise<import("../types").PipelineEntity | undefined>;
|
|
191
|
+
wait: (props: {
|
|
192
|
+
id: string;
|
|
193
|
+
timeoutInSeconds?: number;
|
|
194
|
+
}) => Promise<import("../types").PipelineEntity>;
|
|
195
|
+
};
|
|
165
196
|
stacks: {
|
|
166
197
|
create: (props?: {
|
|
167
198
|
metadata?: any;
|
package/dist/sdk/index.js
CHANGED
|
@@ -3,8 +3,9 @@ import balances from './balances';
|
|
|
3
3
|
import collections from './collections';
|
|
4
4
|
import groups from './groups';
|
|
5
5
|
import images from './images';
|
|
6
|
-
import {
|
|
6
|
+
import { decodeJwt } from 'jose';
|
|
7
7
|
import operations from './operations';
|
|
8
|
+
import pipelines from './pipelines';
|
|
8
9
|
import stacks from './stacks';
|
|
9
10
|
import storage from './storage';
|
|
10
11
|
import utils from './utils';
|
|
@@ -12,7 +13,7 @@ export const createSDK = (options) => {
|
|
|
12
13
|
let token = undefined;
|
|
13
14
|
const authToken = async () => {
|
|
14
15
|
if (token) {
|
|
15
|
-
const decoded =
|
|
16
|
+
const decoded = decodeJwt(token);
|
|
16
17
|
const currentTime = Math.floor(Date.now() / 1000);
|
|
17
18
|
if (decoded.exp && decoded.exp > currentTime)
|
|
18
19
|
return token;
|
|
@@ -28,6 +29,7 @@ export const createSDK = (options) => {
|
|
|
28
29
|
groups: groups(optionsWithTokenRefresher),
|
|
29
30
|
images: images(optionsWithTokenRefresher),
|
|
30
31
|
operations: operations(optionsWithTokenRefresher),
|
|
32
|
+
pipelines: pipelines(optionsWithTokenRefresher),
|
|
31
33
|
stacks: stacks(optionsWithTokenRefresher),
|
|
32
34
|
storage: storage(optionsWithTokenRefresher),
|
|
33
35
|
utils: utils(optionsWithTokenRefresher),
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { CollectionEntity, CreateCollectionParamsDto, CreateStackParamsDto, GetCollectionParamsDto, ListStacksParamsDto, PipelineEntity, StackEntity } from '../../autogenerated';
|
|
2
|
+
import { SDKOptions } from '../../types';
|
|
3
|
+
import { Pipeline } from '@hautechai/pipelines';
|
|
4
|
+
declare const pipelines: (options: SDKOptions) => {
|
|
5
|
+
create: (props: {
|
|
6
|
+
metadata?: any;
|
|
7
|
+
tasks: (pipeline: ReturnType<() => Pipeline<{
|
|
8
|
+
collections: {
|
|
9
|
+
create: (params: CreateCollectionParamsDto) => Promise<CollectionEntity>;
|
|
10
|
+
get: (params: GetCollectionParamsDto) => Promise<CollectionEntity>;
|
|
11
|
+
};
|
|
12
|
+
stacks: {
|
|
13
|
+
create: (params: CreateStackParamsDto) => Promise<StackEntity>;
|
|
14
|
+
get: (params: ListStacksParamsDto) => Promise<StackEntity>;
|
|
15
|
+
};
|
|
16
|
+
}>>) => ReturnType<() => Pipeline<{
|
|
17
|
+
collections: {
|
|
18
|
+
create: (params: CreateCollectionParamsDto) => Promise<CollectionEntity>;
|
|
19
|
+
get: (params: GetCollectionParamsDto) => Promise<CollectionEntity>;
|
|
20
|
+
};
|
|
21
|
+
stacks: {
|
|
22
|
+
create: (params: CreateStackParamsDto) => Promise<StackEntity>;
|
|
23
|
+
get: (params: ListStacksParamsDto) => Promise<StackEntity>;
|
|
24
|
+
};
|
|
25
|
+
}>>;
|
|
26
|
+
}) => Promise<PipelineEntity>;
|
|
27
|
+
get: (props: {
|
|
28
|
+
id: string;
|
|
29
|
+
}) => Promise<PipelineEntity | undefined>;
|
|
30
|
+
wait: (props: {
|
|
31
|
+
id: string;
|
|
32
|
+
timeoutInSeconds?: number;
|
|
33
|
+
}) => Promise<PipelineEntity>;
|
|
34
|
+
};
|
|
35
|
+
export default pipelines;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { CallApi, PipelinesApi, } from '../../autogenerated';
|
|
2
|
+
import { Pipeline } from '@hautechai/pipelines';
|
|
3
|
+
import { useAutogeneratedAPI } from '../api';
|
|
4
|
+
const pipelines = (options) => {
|
|
5
|
+
const api = useAutogeneratedAPI({ API: PipelinesApi, options });
|
|
6
|
+
const callAPI = useAutogeneratedAPI({ API: CallApi, options });
|
|
7
|
+
const createPipeline = () => new Pipeline({
|
|
8
|
+
collections: {
|
|
9
|
+
create: (params) => callAPI.call({
|
|
10
|
+
run: (methods) => methods.callControllerCallCollectionsCreateV1(params),
|
|
11
|
+
}),
|
|
12
|
+
get: (params) => callAPI.call({
|
|
13
|
+
run: (methods) => methods.callControllerCallCollectionsGetV1(params),
|
|
14
|
+
}),
|
|
15
|
+
},
|
|
16
|
+
stacks: {
|
|
17
|
+
create: (params) => callAPI.call({
|
|
18
|
+
run: (methods) => methods.callControllerCallStacksCreateV1(params),
|
|
19
|
+
}),
|
|
20
|
+
get: (params) => callAPI.call({
|
|
21
|
+
run: (methods) => methods.callControllerCallStacksListV1(params),
|
|
22
|
+
}),
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
return {
|
|
26
|
+
create: async (props) => api.call({
|
|
27
|
+
run: (methods) => methods.pipelinesControllerCreatePipelineV1({
|
|
28
|
+
metadata: props.metadata,
|
|
29
|
+
tasks: props.tasks(createPipeline()).tasks,
|
|
30
|
+
}),
|
|
31
|
+
}),
|
|
32
|
+
get: async (props) => api.callWithReturningUndefinedOn404({
|
|
33
|
+
run: (methods) => methods.pipelinesControllerGetPipelineV1(props.id),
|
|
34
|
+
}),
|
|
35
|
+
wait: async (props) => new Promise((resolve, reject) => {
|
|
36
|
+
const initialDelay = 5000;
|
|
37
|
+
const delay = 2000;
|
|
38
|
+
let timeoutId;
|
|
39
|
+
const poll = async () => {
|
|
40
|
+
const pipeline = (await api.call({
|
|
41
|
+
run: (methods) => methods.pipelinesControllerGetPipelineV1(props.id),
|
|
42
|
+
}));
|
|
43
|
+
if (pipeline.status === 'completed')
|
|
44
|
+
return resolve(pipeline);
|
|
45
|
+
if (pipeline.status === 'failed')
|
|
46
|
+
return reject(pipeline);
|
|
47
|
+
timeoutId = setTimeout(poll, delay);
|
|
48
|
+
};
|
|
49
|
+
timeoutId = setTimeout(poll, initialDelay);
|
|
50
|
+
}),
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
export default pipelines;
|
package/dist/token/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MethodsPermissions } from '../
|
|
1
|
+
import { MethodsPermissions } from '../autogenerated/permissions';
|
|
2
2
|
export declare const createTokenSigner: (options: {
|
|
3
3
|
appId: string;
|
|
4
4
|
appKeyId: string;
|
|
@@ -8,8 +8,8 @@ export declare const createTokenSigner: (options: {
|
|
|
8
8
|
accountId: string;
|
|
9
9
|
expiresInSeconds: number;
|
|
10
10
|
permissions?: Partial<MethodsPermissions>;
|
|
11
|
-
}) =>
|
|
11
|
+
}) => Promise<string>;
|
|
12
12
|
createRootToken: (props: {
|
|
13
13
|
expiresInSeconds: number;
|
|
14
|
-
}) =>
|
|
14
|
+
}) => Promise<string>;
|
|
15
15
|
};
|
package/dist/token/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { defaultPermissions, defaultRootPermissions } from './permissions';
|
|
2
|
+
import * as jose from 'jose';
|
|
2
3
|
const createPrivateKey = (key) => {
|
|
3
4
|
const header = `-----BEGIN PRIVATE KEY-----\n`;
|
|
4
5
|
const footer = `\n-----END PRIVATE KEY-----`;
|
|
@@ -6,34 +7,49 @@ const createPrivateKey = (key) => {
|
|
|
6
7
|
const keyBody = key.match(/.{1,64}/g).join('\n');
|
|
7
8
|
return header + keyBody + footer;
|
|
8
9
|
};
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const privateKey =
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
const createToken = async (props) => {
|
|
11
|
+
const alg = 'RS256';
|
|
12
|
+
const pkcs8 = createPrivateKey(props.appKeySecret);
|
|
13
|
+
const privateKey = await jose.importPKCS8(pkcs8, alg);
|
|
14
|
+
return await new jose.SignJWT(props.payload)
|
|
15
|
+
.setIssuedAt()
|
|
16
|
+
.setExpirationTime(`${props.expiresInSeconds}s`)
|
|
17
|
+
.setProtectedHeader({ alg, kid: props.appKeyId })
|
|
18
|
+
.sign(privateKey);
|
|
19
|
+
};
|
|
20
|
+
const serializePermissions = (permissions) => {
|
|
21
|
+
const result = [];
|
|
22
|
+
const traverse = (obj, path = []) => {
|
|
23
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
24
|
+
if (typeof value === 'boolean' && value === true) {
|
|
25
|
+
result.push(path.concat(key).join(':'));
|
|
26
|
+
}
|
|
27
|
+
else if (typeof value === 'object') {
|
|
28
|
+
traverse(value, path.concat(key));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
traverse(permissions);
|
|
33
|
+
return result;
|
|
18
34
|
};
|
|
19
35
|
export const createTokenSigner = (options) => ({
|
|
20
|
-
createAccountToken: (props) => createToken({
|
|
36
|
+
createAccountToken: async (props) => createToken({
|
|
21
37
|
appKeyId: options.appKeyId,
|
|
22
38
|
appKeySecret: options.appKeySecret,
|
|
23
39
|
expiresInSeconds: props.expiresInSeconds,
|
|
24
40
|
payload: {
|
|
25
41
|
iss: options.appId,
|
|
26
|
-
permissions: { ...defaultPermissions, ...(props.permissions ?? {}) },
|
|
42
|
+
permissions: serializePermissions({ ...defaultPermissions, ...(props.permissions ?? {}) }),
|
|
27
43
|
sub: props.accountId,
|
|
28
44
|
},
|
|
29
45
|
}),
|
|
30
|
-
createRootToken: (props) => createToken({
|
|
46
|
+
createRootToken: async (props) => createToken({
|
|
31
47
|
appKeyId: options.appKeyId,
|
|
32
48
|
appKeySecret: options.appKeySecret,
|
|
33
49
|
expiresInSeconds: props.expiresInSeconds ?? 3600,
|
|
34
50
|
payload: {
|
|
35
51
|
iss: options.appId,
|
|
36
|
-
permissions: defaultRootPermissions,
|
|
52
|
+
permissions: serializePermissions(defaultRootPermissions),
|
|
37
53
|
},
|
|
38
54
|
}),
|
|
39
55
|
});
|
package/dist/types.d.ts
CHANGED
|
@@ -10,46 +10,4 @@ export type ListProps = {
|
|
|
10
10
|
export declare class ListResponse<T> extends Array<T> {
|
|
11
11
|
nextCursor?: string;
|
|
12
12
|
}
|
|
13
|
-
type Add = {
|
|
14
|
-
add: boolean;
|
|
15
|
-
};
|
|
16
|
-
type Remove = {
|
|
17
|
-
remove: boolean;
|
|
18
|
-
};
|
|
19
|
-
type Create = {
|
|
20
|
-
create: boolean;
|
|
21
|
-
};
|
|
22
|
-
type Delete = {
|
|
23
|
-
delete: boolean;
|
|
24
|
-
};
|
|
25
|
-
type Read = {
|
|
26
|
-
read: boolean;
|
|
27
|
-
};
|
|
28
|
-
type Update = {
|
|
29
|
-
update: boolean;
|
|
30
|
-
};
|
|
31
|
-
export interface MethodsPermissions {
|
|
32
|
-
access: Add & Read & Remove;
|
|
33
|
-
accounts: Create & Read;
|
|
34
|
-
balances: Read & Update & {
|
|
35
|
-
self: Read & Update;
|
|
36
|
-
};
|
|
37
|
-
collections: Create & Read & Update & {
|
|
38
|
-
items: Add & Read & Remove;
|
|
39
|
-
};
|
|
40
|
-
groups: Create & Read & Delete & {
|
|
41
|
-
accounts: Add & Remove & Read;
|
|
42
|
-
};
|
|
43
|
-
images: Create & Read;
|
|
44
|
-
operations: Create & Read & {
|
|
45
|
-
metadata: Update;
|
|
46
|
-
};
|
|
47
|
-
pipelines: Create & Read & Update;
|
|
48
|
-
poses: Create & Read;
|
|
49
|
-
stacks: Create & Read & {
|
|
50
|
-
items: Add & Remove;
|
|
51
|
-
metadata: Update;
|
|
52
|
-
};
|
|
53
|
-
storage: Create & Delete & Read & Update;
|
|
54
|
-
}
|
|
55
13
|
export { AccountEntity, CollectionEntity, GroupEntity, ImageEntity, OperationEntity, PipelineEntity, ResourceEntity, StackEntity, StorageEntity, } from './autogenerated/api';
|
package/dist/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hautechai/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"repository": {
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
},
|
|
18
18
|
"description": "Hautech SDK",
|
|
19
19
|
"dependencies": {
|
|
20
|
+
"@hautechai/pipelines": "0.1.0",
|
|
20
21
|
"axios": "1.6.1",
|
|
21
|
-
"
|
|
22
|
-
"jwt-decode": "4.0.0",
|
|
22
|
+
"jose": "5.9.6",
|
|
23
23
|
"pusher-js": "8.4.0-rc2"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
@@ -0,0 +1,54 @@
|
|
|
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
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
API_URL="https://api.dev.hautech.ai"
|
|
4
|
+
|
|
5
|
+
./node_modules/.bin/openapi-generator-cli generate -i $API_URL/swagger.json -g typescript-axios -o ./src/autogenerated
|
|
6
|
+
node ./scripts/generate-permissions.js $API_URL/v1/permissions/available ./src/autogenerated/permissions.ts
|