@pelican.ts/sdk 0.4.12 → 0.4.14
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/api/index.d.mts +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +1 -1
- package/dist/api/index.mjs +1 -1
- package/dist/index.d.mts +139 -139
- package/dist/index.d.ts +139 -139
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/types.d.ts +258 -258
- package/package.json +1 -1
- package/.husky/pre-commit +0 -2
- package/scripts/create-types.ts +0 -24
- package/src/api/application/client.ts +0 -70
- package/src/api/application/database_hosts.ts +0 -65
- package/src/api/application/eggs.ts +0 -43
- package/src/api/application/mounts.ts +0 -109
- package/src/api/application/nodes.ts +0 -126
- package/src/api/application/nodes_allocations.ts +0 -47
- package/src/api/application/roles.ts +0 -39
- package/src/api/application/servers.ts +0 -145
- package/src/api/application/servers_databases.ts +0 -53
- package/src/api/application/types/container.ts +0 -9
- package/src/api/application/types/database_host.ts +0 -11
- package/src/api/application/types/egg.ts +0 -65
- package/src/api/application/types/index.ts +0 -10
- package/src/api/application/types/location.ts +0 -7
- package/src/api/application/types/mount.ts +0 -12
- package/src/api/application/types/node.ts +0 -58
- package/src/api/application/types/role.ts +0 -6
- package/src/api/application/types/server.ts +0 -24
- package/src/api/application/types/server_allocation.ts +0 -20
- package/src/api/application/types/user.ts +0 -34
- package/src/api/application/users.ts +0 -146
- package/src/api/base/request.ts +0 -44
- package/src/api/base/types.ts +0 -40
- package/src/api/client/account.ts +0 -77
- package/src/api/client/client.ts +0 -56
- package/src/api/client/server.ts +0 -74
- package/src/api/client/server_activity.ts +0 -25
- package/src/api/client/server_allocations.ts +0 -50
- package/src/api/client/server_backups.ts +0 -82
- package/src/api/client/server_databases.ts +0 -51
- package/src/api/client/server_files.ts +0 -145
- package/src/api/client/server_schedules.ts +0 -130
- package/src/api/client/server_settings.ts +0 -36
- package/src/api/client/server_startup.ts +0 -41
- package/src/api/client/server_users.ts +0 -55
- package/src/api/client/server_websocket.ts +0 -570
- package/src/api/client/types/index.ts +0 -5
- package/src/api/client/types/server.ts +0 -72
- package/src/api/client/types/server_allocation.ts +0 -10
- package/src/api/client/types/server_subuser.ts +0 -55
- package/src/api/client/types/user.ts +0 -31
- package/src/api/client/types/websocket.ts +0 -138
- package/src/api/common/types/egg.ts +0 -9
- package/src/api/common/types/enums.ts +0 -21
- package/src/api/common/types/index.ts +0 -9
- package/src/api/common/types/server_backup.ts +0 -13
- package/src/api/common/types/server_database.ts +0 -13
- package/src/api/common/types/server_files.ts +0 -11
- package/src/api/common/types/server_limits.ts +0 -18
- package/src/api/common/types/server_power.ts +0 -1
- package/src/api/common/types/server_schedule.ts +0 -37
- package/src/api/common/types/server_startup.ts +0 -11
- package/src/api/index.ts +0 -17
- package/src/humane/Account.ts +0 -60
- package/src/humane/Client.ts +0 -44
- package/src/humane/Server.ts +0 -206
- package/src/humane/ServerAllocation.ts +0 -41
- package/src/humane/ServerBackup.ts +0 -44
- package/src/humane/ServerDatabase.ts +0 -37
- package/src/humane/ServerFile.ts +0 -91
- package/src/humane/ServerSchedule.ts +0 -160
- package/src/humane/ServerUser.ts +0 -44
- package/src/index.ts +0 -21
- package/src/types.ts +0 -3
- package/src/utils/sized.ts +0 -13
- package/src/utils/transform.ts +0 -21
- package/src/utils/types.ts +0 -10
package/dist/types.d.ts
CHANGED
|
@@ -2,100 +2,6 @@ import z from 'zod';
|
|
|
2
2
|
import { AxiosInstance } from 'axios';
|
|
3
3
|
import WebSocket from 'isomorphic-ws';
|
|
4
4
|
|
|
5
|
-
type ServerSignalOption = "start" | "stop" | "restart" | "kill";
|
|
6
|
-
|
|
7
|
-
type GenericResponse<T, N extends string = string, M = undefined> = {
|
|
8
|
-
object: N;
|
|
9
|
-
attributes: T;
|
|
10
|
-
meta?: M;
|
|
11
|
-
};
|
|
12
|
-
type PaginationMeta = {
|
|
13
|
-
total: number;
|
|
14
|
-
count: number;
|
|
15
|
-
per_page: number;
|
|
16
|
-
current_page: number;
|
|
17
|
-
total_pages: number;
|
|
18
|
-
links: any;
|
|
19
|
-
};
|
|
20
|
-
type GenericListResponse<T> = {
|
|
21
|
-
object: "list";
|
|
22
|
-
data: T[];
|
|
23
|
-
meta?: {
|
|
24
|
-
pagination: PaginationMeta;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
type ServerDatabase = {
|
|
29
|
-
id: string;
|
|
30
|
-
host: {
|
|
31
|
-
address: string;
|
|
32
|
-
port: number;
|
|
33
|
-
};
|
|
34
|
-
name: string;
|
|
35
|
-
username: string;
|
|
36
|
-
connections_from: string;
|
|
37
|
-
max_connections: number;
|
|
38
|
-
relationships?: {
|
|
39
|
-
password: GenericResponse<{
|
|
40
|
-
password: string;
|
|
41
|
-
}, "database_password">;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
type Nullable<T> = T | null;
|
|
46
|
-
|
|
47
|
-
type ServerLimits = {
|
|
48
|
-
memory: number;
|
|
49
|
-
swap: number;
|
|
50
|
-
disk: number;
|
|
51
|
-
io: number;
|
|
52
|
-
cpu: number;
|
|
53
|
-
threads: Nullable<number | string>;
|
|
54
|
-
oom_disabled: boolean;
|
|
55
|
-
oom_killer: boolean;
|
|
56
|
-
};
|
|
57
|
-
type FeatureLimits = {
|
|
58
|
-
databases: number;
|
|
59
|
-
allocations: number;
|
|
60
|
-
backups: number;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
type StartupParams = {
|
|
64
|
-
name: string;
|
|
65
|
-
description: string;
|
|
66
|
-
env_variables: string;
|
|
67
|
-
default_value: string;
|
|
68
|
-
server_value: string;
|
|
69
|
-
is_editable: boolean;
|
|
70
|
-
rules: string;
|
|
71
|
-
};
|
|
72
|
-
type StartupMeta = {
|
|
73
|
-
startup_command: string;
|
|
74
|
-
raw_startup_command: string;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
type ServerBackup = {
|
|
78
|
-
uuid: string;
|
|
79
|
-
is_successful: boolean;
|
|
80
|
-
is_locked: boolean;
|
|
81
|
-
name: string;
|
|
82
|
-
ignored_files: string[];
|
|
83
|
-
checksum: Nullable<string>;
|
|
84
|
-
bytes: number;
|
|
85
|
-
created_at: string;
|
|
86
|
-
completed_at: Nullable<string>;
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
type EggVariable = {
|
|
90
|
-
name: string;
|
|
91
|
-
description: string;
|
|
92
|
-
env_variable: string;
|
|
93
|
-
default_value: string;
|
|
94
|
-
server_value: string;
|
|
95
|
-
is_editable: boolean;
|
|
96
|
-
rules: string;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
5
|
type FileObject = {
|
|
100
6
|
name: string;
|
|
101
7
|
mode: string;
|
|
@@ -668,6 +574,90 @@ declare const timezonesSchema: z.ZodEnum<{
|
|
|
668
574
|
}>;
|
|
669
575
|
type TimezonesType = z.infer<typeof timezonesSchema>;
|
|
670
576
|
|
|
577
|
+
type GenericResponse<T, N extends string = string, M = undefined> = {
|
|
578
|
+
object: N;
|
|
579
|
+
attributes: T;
|
|
580
|
+
meta?: M;
|
|
581
|
+
};
|
|
582
|
+
type PaginationMeta = {
|
|
583
|
+
total: number;
|
|
584
|
+
count: number;
|
|
585
|
+
per_page: number;
|
|
586
|
+
current_page: number;
|
|
587
|
+
total_pages: number;
|
|
588
|
+
links: any;
|
|
589
|
+
};
|
|
590
|
+
type GenericListResponse<T> = {
|
|
591
|
+
object: "list";
|
|
592
|
+
data: T[];
|
|
593
|
+
meta?: {
|
|
594
|
+
pagination: PaginationMeta;
|
|
595
|
+
};
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
type ServerDatabase = {
|
|
599
|
+
id: string;
|
|
600
|
+
host: {
|
|
601
|
+
address: string;
|
|
602
|
+
port: number;
|
|
603
|
+
};
|
|
604
|
+
name: string;
|
|
605
|
+
username: string;
|
|
606
|
+
connections_from: string;
|
|
607
|
+
max_connections: number;
|
|
608
|
+
relationships?: {
|
|
609
|
+
password: GenericResponse<{
|
|
610
|
+
password: string;
|
|
611
|
+
}, "database_password">;
|
|
612
|
+
};
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
type Nullable<T> = T | null;
|
|
616
|
+
|
|
617
|
+
type ServerBackup = {
|
|
618
|
+
uuid: string;
|
|
619
|
+
is_successful: boolean;
|
|
620
|
+
is_locked: boolean;
|
|
621
|
+
name: string;
|
|
622
|
+
ignored_files: string[];
|
|
623
|
+
checksum: Nullable<string>;
|
|
624
|
+
bytes: number;
|
|
625
|
+
created_at: string;
|
|
626
|
+
completed_at: Nullable<string>;
|
|
627
|
+
};
|
|
628
|
+
|
|
629
|
+
type ServerSignalOption = "start" | "stop" | "restart" | "kill";
|
|
630
|
+
|
|
631
|
+
type ServerLimits = {
|
|
632
|
+
memory: number;
|
|
633
|
+
swap: number;
|
|
634
|
+
disk: number;
|
|
635
|
+
io: number;
|
|
636
|
+
cpu: number;
|
|
637
|
+
threads: Nullable<number | string>;
|
|
638
|
+
oom_disabled: boolean;
|
|
639
|
+
oom_killer: boolean;
|
|
640
|
+
};
|
|
641
|
+
type FeatureLimits = {
|
|
642
|
+
databases: number;
|
|
643
|
+
allocations: number;
|
|
644
|
+
backups: number;
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
type StartupParams = {
|
|
648
|
+
name: string;
|
|
649
|
+
description: string;
|
|
650
|
+
env_variables: string;
|
|
651
|
+
default_value: string;
|
|
652
|
+
server_value: string;
|
|
653
|
+
is_editable: boolean;
|
|
654
|
+
rules: string;
|
|
655
|
+
};
|
|
656
|
+
type StartupMeta = {
|
|
657
|
+
startup_command: string;
|
|
658
|
+
raw_startup_command: string;
|
|
659
|
+
};
|
|
660
|
+
|
|
671
661
|
type Schedule = {
|
|
672
662
|
id: number;
|
|
673
663
|
name: string;
|
|
@@ -700,6 +690,35 @@ type ScheduleTask = {
|
|
|
700
690
|
updated_at: Nullable<string>;
|
|
701
691
|
};
|
|
702
692
|
|
|
693
|
+
type EggVariable = {
|
|
694
|
+
name: string;
|
|
695
|
+
description: string;
|
|
696
|
+
env_variable: string;
|
|
697
|
+
default_value: string;
|
|
698
|
+
server_value: string;
|
|
699
|
+
is_editable: boolean;
|
|
700
|
+
rules: string;
|
|
701
|
+
};
|
|
702
|
+
|
|
703
|
+
type Mount = {
|
|
704
|
+
id: number;
|
|
705
|
+
uuid: string;
|
|
706
|
+
name: string;
|
|
707
|
+
description: Nullable<string>;
|
|
708
|
+
source: string;
|
|
709
|
+
target: string;
|
|
710
|
+
read_only: boolean;
|
|
711
|
+
user_mountable: boolean;
|
|
712
|
+
};
|
|
713
|
+
|
|
714
|
+
type Location = {
|
|
715
|
+
id: number;
|
|
716
|
+
short: string;
|
|
717
|
+
long: string;
|
|
718
|
+
created_at: string;
|
|
719
|
+
updated_at: string | null;
|
|
720
|
+
};
|
|
721
|
+
|
|
703
722
|
type Container = {
|
|
704
723
|
startup_command: string;
|
|
705
724
|
image: string;
|
|
@@ -731,29 +750,6 @@ type ApplicationServer = {
|
|
|
731
750
|
updated_at: Nullable<string>;
|
|
732
751
|
};
|
|
733
752
|
|
|
734
|
-
type Allocation = {
|
|
735
|
-
id: number;
|
|
736
|
-
ip: string;
|
|
737
|
-
alias: Nullable<string>;
|
|
738
|
-
port: number;
|
|
739
|
-
notes: Nullable<string>;
|
|
740
|
-
assigned: boolean;
|
|
741
|
-
};
|
|
742
|
-
type AllocationRel = Allocation & {
|
|
743
|
-
relationships?: {
|
|
744
|
-
node?: GenericResponse<Node, "node">;
|
|
745
|
-
server?: GenericResponse<ApplicationServer, "server">;
|
|
746
|
-
};
|
|
747
|
-
};
|
|
748
|
-
|
|
749
|
-
type Location = {
|
|
750
|
-
id: number;
|
|
751
|
-
short: string;
|
|
752
|
-
long: string;
|
|
753
|
-
created_at: string;
|
|
754
|
-
updated_at: string | null;
|
|
755
|
-
};
|
|
756
|
-
|
|
757
753
|
type Node = {
|
|
758
754
|
id: number;
|
|
759
755
|
uuid: string;
|
|
@@ -815,32 +811,59 @@ type NodeConfiguration = {
|
|
|
815
811
|
remote: string;
|
|
816
812
|
};
|
|
817
813
|
|
|
818
|
-
type
|
|
814
|
+
type Allocation = {
|
|
819
815
|
id: number;
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
816
|
+
ip: string;
|
|
817
|
+
alias: Nullable<string>;
|
|
818
|
+
port: number;
|
|
819
|
+
notes: Nullable<string>;
|
|
820
|
+
assigned: boolean;
|
|
821
|
+
};
|
|
822
|
+
type AllocationRel = Allocation & {
|
|
823
|
+
relationships?: {
|
|
824
|
+
node?: GenericResponse<Node, "node">;
|
|
825
|
+
server?: GenericResponse<ApplicationServer, "server">;
|
|
826
|
+
};
|
|
827
827
|
};
|
|
828
828
|
|
|
829
|
-
type
|
|
829
|
+
type ApplicationUser = {
|
|
830
830
|
id: number;
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
831
|
+
external_id: Nullable<string>;
|
|
832
|
+
uuid: string;
|
|
833
|
+
username: string;
|
|
834
|
+
email: string;
|
|
835
|
+
language: string;
|
|
836
|
+
root_admin: string;
|
|
837
|
+
"2fa_enabled": boolean;
|
|
838
|
+
"2fa": boolean;
|
|
835
839
|
created_at: string;
|
|
836
840
|
updated_at: Nullable<string>;
|
|
841
|
+
relationships?: {
|
|
842
|
+
servers: GenericListResponse<GenericResponse<ApplicationServer>>;
|
|
843
|
+
};
|
|
844
|
+
};
|
|
845
|
+
type ApplicationUserApiKey = {
|
|
846
|
+
id: number;
|
|
847
|
+
user_id: number;
|
|
848
|
+
key_type: 1;
|
|
849
|
+
identifier: string;
|
|
850
|
+
memo: string;
|
|
851
|
+
allowed_ips: Array<string>;
|
|
852
|
+
permissions: [];
|
|
853
|
+
last_used_at: Nullable<string>;
|
|
854
|
+
expires_at: Nullable<string>;
|
|
855
|
+
created_at: string;
|
|
856
|
+
updated_at: string;
|
|
837
857
|
};
|
|
838
858
|
|
|
839
|
-
type
|
|
859
|
+
type DatabaseHost = {
|
|
840
860
|
id: number;
|
|
841
861
|
name: string;
|
|
862
|
+
host: string;
|
|
863
|
+
port: number;
|
|
864
|
+
username: string;
|
|
842
865
|
created_at: string;
|
|
843
|
-
updated_at: string
|
|
866
|
+
updated_at: Nullable<string>;
|
|
844
867
|
};
|
|
845
868
|
|
|
846
869
|
type Egg = {
|
|
@@ -910,35 +933,122 @@ type ExportedEgg = {
|
|
|
910
933
|
variables: ApplicationEggVariable[];
|
|
911
934
|
};
|
|
912
935
|
|
|
913
|
-
type
|
|
936
|
+
type Role = {
|
|
914
937
|
id: number;
|
|
915
|
-
|
|
938
|
+
name: string;
|
|
939
|
+
created_at: string;
|
|
940
|
+
updated_at: string;
|
|
941
|
+
};
|
|
942
|
+
|
|
943
|
+
type ServerSubuser = {
|
|
916
944
|
uuid: string;
|
|
917
945
|
username: string;
|
|
918
946
|
email: string;
|
|
919
947
|
language: string;
|
|
920
|
-
|
|
948
|
+
image: string;
|
|
949
|
+
admin: false;
|
|
950
|
+
root_admin: false;
|
|
921
951
|
"2fa_enabled": boolean;
|
|
922
|
-
"2fa": boolean;
|
|
923
952
|
created_at: string;
|
|
924
|
-
|
|
925
|
-
relationships?: {
|
|
926
|
-
servers: GenericListResponse<GenericResponse<ApplicationServer>>;
|
|
927
|
-
};
|
|
953
|
+
permissions: SubuserPermission[] | string[];
|
|
928
954
|
};
|
|
929
|
-
type
|
|
955
|
+
type SubuserPermission = "activity.read" | "allocation.create" | "allocation.delete" | "allocation.read" | "allocation.update" | "backup.create" | "backup.delete" | "backup.download" | "backup.read" | "backup.restore" | "control.console" | "control.restart" | "control.start" | "control.stop" | "database.create" | "database.delete" | "database.read" | "database.update" | "database.view-password" | "file.archive" | "file.create" | "file.delete" | "file.read" | "file.read-content" | "file.sftp" | "file.update" | "schedule.create" | "schedule.delete" | "schedule.read" | "schedule.update" | "settings.description" | "settings.reinstall" | "settings.rename" | "startup.docker-image" | "startup.read" | "startup.update" | "user.create" | "user.delete" | "user.read" | "user.update" | "websocket.connect";
|
|
956
|
+
|
|
957
|
+
type ServerAllocation = {
|
|
930
958
|
id: number;
|
|
931
|
-
|
|
932
|
-
|
|
959
|
+
ip: string;
|
|
960
|
+
ip_alias: Nullable<string>;
|
|
961
|
+
port: number;
|
|
962
|
+
notes: Nullable<string>;
|
|
963
|
+
is_default: boolean;
|
|
964
|
+
};
|
|
965
|
+
|
|
966
|
+
type Server = {
|
|
967
|
+
server_owner: boolean;
|
|
933
968
|
identifier: string;
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
969
|
+
internal_id?: number;
|
|
970
|
+
uuid: string;
|
|
971
|
+
name: string;
|
|
972
|
+
node: string;
|
|
973
|
+
is_node_under_maintenance: boolean;
|
|
974
|
+
sftp_details: {
|
|
975
|
+
ip: string;
|
|
976
|
+
alias: Nullable<string>;
|
|
977
|
+
port: number;
|
|
978
|
+
};
|
|
979
|
+
description: string;
|
|
980
|
+
limits: ServerLimits;
|
|
981
|
+
invocation: string;
|
|
982
|
+
docker_image: string;
|
|
983
|
+
egg_features: Nullable<string[]>;
|
|
984
|
+
feature_limits: FeatureLimits;
|
|
985
|
+
status: Nullable<unknown>;
|
|
986
|
+
is_suspended: boolean;
|
|
987
|
+
is_installing: boolean;
|
|
988
|
+
is_transferring: boolean;
|
|
989
|
+
relationships: {
|
|
990
|
+
allocations: GenericListResponse<GenericResponse<ServerAllocation, "allocation">>;
|
|
991
|
+
variables: GenericListResponse<GenericResponse<EggVariable, "egg_variable">>;
|
|
992
|
+
egg?: GenericResponse<{
|
|
993
|
+
uuid: string;
|
|
994
|
+
name: string;
|
|
995
|
+
}, "egg">;
|
|
996
|
+
subusers?: GenericListResponse<GenericResponse<ServerSubuser, "server_subuser">>;
|
|
997
|
+
};
|
|
998
|
+
};
|
|
999
|
+
type ServerStats = {
|
|
1000
|
+
current_state: "installing" | "install_failed" | "reinstall_failed" | "suspended" | "restoring_backup" | "running" | "stopped" | "offline";
|
|
1001
|
+
is_suspended: boolean;
|
|
1002
|
+
resources: ServerResources;
|
|
1003
|
+
};
|
|
1004
|
+
type ServerResources = {
|
|
1005
|
+
memory_bytes: number;
|
|
1006
|
+
cpu_absolute: number;
|
|
1007
|
+
disk_bytes: number;
|
|
1008
|
+
network_tx_bytes: number;
|
|
1009
|
+
network_rx_bytes: number;
|
|
1010
|
+
uptime: number;
|
|
1011
|
+
};
|
|
1012
|
+
type ServerActivityLog = {
|
|
1013
|
+
id: string;
|
|
1014
|
+
event: string;
|
|
1015
|
+
is_api: boolean;
|
|
1016
|
+
ip: string;
|
|
1017
|
+
description: Nullable<string>;
|
|
1018
|
+
properties: Record<string, string>;
|
|
1019
|
+
has_additional_metadata: boolean;
|
|
1020
|
+
timestamp: string;
|
|
1021
|
+
};
|
|
1022
|
+
|
|
1023
|
+
type User = {
|
|
1024
|
+
uuid: string;
|
|
1025
|
+
username: string;
|
|
1026
|
+
email: string;
|
|
1027
|
+
language: string;
|
|
1028
|
+
image: string;
|
|
1029
|
+
admin: boolean;
|
|
1030
|
+
root_admin: boolean;
|
|
1031
|
+
"2fa_enabled": boolean;
|
|
939
1032
|
created_at: string;
|
|
940
1033
|
updated_at: string;
|
|
941
1034
|
};
|
|
1035
|
+
type APIKey = {
|
|
1036
|
+
identifier: string;
|
|
1037
|
+
description: string;
|
|
1038
|
+
allowed_ips: string[];
|
|
1039
|
+
last_used_at: Nullable<string>;
|
|
1040
|
+
created_at: string;
|
|
1041
|
+
};
|
|
1042
|
+
type SSHKey = {
|
|
1043
|
+
name: string;
|
|
1044
|
+
fingerprint: string;
|
|
1045
|
+
pubic_key: string;
|
|
1046
|
+
created_at: string;
|
|
1047
|
+
};
|
|
1048
|
+
type Permission = {
|
|
1049
|
+
description: string;
|
|
1050
|
+
keys: Record<string, string>;
|
|
1051
|
+
};
|
|
942
1052
|
|
|
943
1053
|
type SocketEventPayloadMap = {
|
|
944
1054
|
[SOCKET_EVENT.AUTH_SUCCESS]: undefined;
|
|
@@ -1111,114 +1221,4 @@ type JwtErrorEvent = {
|
|
|
1111
1221
|
args: [string];
|
|
1112
1222
|
};
|
|
1113
1223
|
|
|
1114
|
-
type ServerAllocation = {
|
|
1115
|
-
id: number;
|
|
1116
|
-
ip: string;
|
|
1117
|
-
ip_alias: Nullable<string>;
|
|
1118
|
-
port: number;
|
|
1119
|
-
notes: Nullable<string>;
|
|
1120
|
-
is_default: boolean;
|
|
1121
|
-
};
|
|
1122
|
-
|
|
1123
|
-
type ServerSubuser = {
|
|
1124
|
-
uuid: string;
|
|
1125
|
-
username: string;
|
|
1126
|
-
email: string;
|
|
1127
|
-
language: string;
|
|
1128
|
-
image: string;
|
|
1129
|
-
admin: false;
|
|
1130
|
-
root_admin: false;
|
|
1131
|
-
"2fa_enabled": boolean;
|
|
1132
|
-
created_at: string;
|
|
1133
|
-
permissions: SubuserPermission[] | string[];
|
|
1134
|
-
};
|
|
1135
|
-
type SubuserPermission = "activity.read" | "allocation.create" | "allocation.delete" | "allocation.read" | "allocation.update" | "backup.create" | "backup.delete" | "backup.download" | "backup.read" | "backup.restore" | "control.console" | "control.restart" | "control.start" | "control.stop" | "database.create" | "database.delete" | "database.read" | "database.update" | "database.view-password" | "file.archive" | "file.create" | "file.delete" | "file.read" | "file.read-content" | "file.sftp" | "file.update" | "schedule.create" | "schedule.delete" | "schedule.read" | "schedule.update" | "settings.description" | "settings.reinstall" | "settings.rename" | "startup.docker-image" | "startup.read" | "startup.update" | "user.create" | "user.delete" | "user.read" | "user.update" | "websocket.connect";
|
|
1136
|
-
|
|
1137
|
-
type Server = {
|
|
1138
|
-
server_owner: boolean;
|
|
1139
|
-
identifier: string;
|
|
1140
|
-
internal_id?: number;
|
|
1141
|
-
uuid: string;
|
|
1142
|
-
name: string;
|
|
1143
|
-
node: string;
|
|
1144
|
-
is_node_under_maintenance: boolean;
|
|
1145
|
-
sftp_details: {
|
|
1146
|
-
ip: string;
|
|
1147
|
-
alias: Nullable<string>;
|
|
1148
|
-
port: number;
|
|
1149
|
-
};
|
|
1150
|
-
description: string;
|
|
1151
|
-
limits: ServerLimits;
|
|
1152
|
-
invocation: string;
|
|
1153
|
-
docker_image: string;
|
|
1154
|
-
egg_features: Nullable<string[]>;
|
|
1155
|
-
feature_limits: FeatureLimits;
|
|
1156
|
-
status: Nullable<unknown>;
|
|
1157
|
-
is_suspended: boolean;
|
|
1158
|
-
is_installing: boolean;
|
|
1159
|
-
is_transferring: boolean;
|
|
1160
|
-
relationships: {
|
|
1161
|
-
allocations: GenericListResponse<GenericResponse<ServerAllocation, "allocation">>;
|
|
1162
|
-
variables: GenericListResponse<GenericResponse<EggVariable, "egg_variable">>;
|
|
1163
|
-
egg?: GenericResponse<{
|
|
1164
|
-
uuid: string;
|
|
1165
|
-
name: string;
|
|
1166
|
-
}, "egg">;
|
|
1167
|
-
subusers?: GenericListResponse<GenericResponse<ServerSubuser, "server_subuser">>;
|
|
1168
|
-
};
|
|
1169
|
-
};
|
|
1170
|
-
type ServerStats = {
|
|
1171
|
-
current_state: "installing" | "install_failed" | "reinstall_failed" | "suspended" | "restoring_backup" | "running" | "stopped" | "offline";
|
|
1172
|
-
is_suspended: boolean;
|
|
1173
|
-
resources: ServerResources;
|
|
1174
|
-
};
|
|
1175
|
-
type ServerResources = {
|
|
1176
|
-
memory_bytes: number;
|
|
1177
|
-
cpu_absolute: number;
|
|
1178
|
-
disk_bytes: number;
|
|
1179
|
-
network_tx_bytes: number;
|
|
1180
|
-
network_rx_bytes: number;
|
|
1181
|
-
uptime: number;
|
|
1182
|
-
};
|
|
1183
|
-
type ServerActivityLog = {
|
|
1184
|
-
id: string;
|
|
1185
|
-
event: string;
|
|
1186
|
-
is_api: boolean;
|
|
1187
|
-
ip: string;
|
|
1188
|
-
description: Nullable<string>;
|
|
1189
|
-
properties: Record<string, string>;
|
|
1190
|
-
has_additional_metadata: boolean;
|
|
1191
|
-
timestamp: string;
|
|
1192
|
-
};
|
|
1193
|
-
|
|
1194
|
-
type User = {
|
|
1195
|
-
uuid: string;
|
|
1196
|
-
username: string;
|
|
1197
|
-
email: string;
|
|
1198
|
-
language: string;
|
|
1199
|
-
image: string;
|
|
1200
|
-
admin: boolean;
|
|
1201
|
-
root_admin: boolean;
|
|
1202
|
-
"2fa_enabled": boolean;
|
|
1203
|
-
created_at: string;
|
|
1204
|
-
updated_at: string;
|
|
1205
|
-
};
|
|
1206
|
-
type APIKey = {
|
|
1207
|
-
identifier: string;
|
|
1208
|
-
description: string;
|
|
1209
|
-
allowed_ips: string[];
|
|
1210
|
-
last_used_at: Nullable<string>;
|
|
1211
|
-
created_at: string;
|
|
1212
|
-
};
|
|
1213
|
-
type SSHKey = {
|
|
1214
|
-
name: string;
|
|
1215
|
-
fingerprint: string;
|
|
1216
|
-
pubic_key: string;
|
|
1217
|
-
created_at: string;
|
|
1218
|
-
};
|
|
1219
|
-
type Permission = {
|
|
1220
|
-
description: string;
|
|
1221
|
-
keys: Record<string, string>;
|
|
1222
|
-
};
|
|
1223
|
-
|
|
1224
1224
|
export { type APIKey, type Allocation, type AllocationRel, type ApplicationEggVariable, type ApplicationServer, type ApplicationUser, type ApplicationUserApiKey, type AuthSuccessWsEvent, type BackupCompletedEvent, type BackupCompletedJson, type BackupRestoreCompletedEvent, type ConsoleLogWsEvent, type Container, type DaemonErrorEvent, type DaemonMessageEvent, type DatabaseHost, type Egg, type EggVariable, type ExportedEgg, type FeatureLimits, type FileObject, type InstallCompletedEvent, type InstallOutputEvent, type InstallStartedEvent, type JwtErrorEvent, type LanguagesType, type Location, type Mount, type Node, type NodeConfiguration, type Permission, type PowerState, type Role, SERVER_SIGNAL, SOCKET_EVENT, type SSHKey, type Schedule, type ScheduleTask, type Server, type ServerActivityLog, type ServerAllocation, type ServerBackup, type ServerDatabase, type ServerLimits, type ServerSignalOption, type ServerStats, type ServerStatus, type ServerSubuser, ServerWebsocket, type StartupMeta, type StartupParams, type StatsWsEvent, type StatsWsJson, type StatusWsEvent, type SubuserPermission, type TimezonesType, type TokenExpiredWsEvent, type TokenExpiringWsEvent, type TransferLogsEvent, type TransferStatusEvent, type User, type WebsocketEvent, languagesSchema, timezonesSchema };
|
package/package.json
CHANGED
package/.husky/pre-commit
DELETED
package/scripts/create-types.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import fs from "fs"
|
|
2
|
-
import path from "path"
|
|
3
|
-
|
|
4
|
-
const typesPaths = [
|
|
5
|
-
"./api/common/types",
|
|
6
|
-
"./api/application/types",
|
|
7
|
-
"./api/client/types"
|
|
8
|
-
]
|
|
9
|
-
|
|
10
|
-
typesPaths.forEach(p => {
|
|
11
|
-
const prefix = path.join(__dirname, "../src", p)
|
|
12
|
-
const files = fs
|
|
13
|
-
.readdirSync(prefix)
|
|
14
|
-
.filter(f => f !== "index.ts")
|
|
15
|
-
.map(f => f.replace(/\.ts$/, ""))
|
|
16
|
-
const strings: Array<string> = []
|
|
17
|
-
files.forEach(f => {
|
|
18
|
-
strings.push(`export * from "./${f}"`)
|
|
19
|
-
})
|
|
20
|
-
fs.writeFileSync(path.join(prefix, "index.ts"), strings.join("\n"))
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
const strings = typesPaths.map(p => `export * from "${p}"`)
|
|
24
|
-
fs.writeFileSync(path.join(__dirname, "../src/types.ts"), strings.join("\n"))
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import {AxiosInstance} from "axios"
|
|
2
|
-
import {Users} from "@/api/application/users"
|
|
3
|
-
import {Nodes} from "@/api/application/nodes"
|
|
4
|
-
import {GenericListResponse, GenericResponse} from "@/api/base/types"
|
|
5
|
-
import {ApplicationServer} from "@/api/application/types/server"
|
|
6
|
-
import {CreateServerSchema, Servers} from "@/api/application/servers"
|
|
7
|
-
import z from "zod"
|
|
8
|
-
import {DatabaseHosts} from "@/api/application/database_hosts"
|
|
9
|
-
import {Roles} from "@/api/application/roles"
|
|
10
|
-
import {Eggs} from "@/api/application/eggs"
|
|
11
|
-
import {Mounts} from "@/api/application/mounts"
|
|
12
|
-
|
|
13
|
-
export class Client {
|
|
14
|
-
private readonly r: AxiosInstance
|
|
15
|
-
users: Users
|
|
16
|
-
nodes: Nodes
|
|
17
|
-
databaseHosts: DatabaseHosts
|
|
18
|
-
roles: Roles
|
|
19
|
-
eggs: Eggs
|
|
20
|
-
mounts: Mounts
|
|
21
|
-
|
|
22
|
-
constructor(requester: AxiosInstance) {
|
|
23
|
-
this.r = requester
|
|
24
|
-
|
|
25
|
-
this.users = new Users(requester)
|
|
26
|
-
this.nodes = new Nodes(requester)
|
|
27
|
-
this.databaseHosts = new DatabaseHosts(requester)
|
|
28
|
-
this.roles = new Roles(requester)
|
|
29
|
-
this.eggs = new Eggs(requester)
|
|
30
|
-
this.mounts = new Mounts(requester)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
get $r(): AxiosInstance {
|
|
34
|
-
return this.r
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
listServers = async (
|
|
38
|
-
search?: string,
|
|
39
|
-
page: number = 1
|
|
40
|
-
): Promise<ApplicationServer[]> => {
|
|
41
|
-
const {data} = await this.r.get<
|
|
42
|
-
GenericListResponse<GenericResponse<ApplicationServer, "server">>
|
|
43
|
-
>("/servers", {params: {search, page}})
|
|
44
|
-
return data.data.map(s => s.attributes)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
createServer = async (
|
|
48
|
-
opts: z.infer<typeof CreateServerSchema>
|
|
49
|
-
): Promise<ApplicationServer> => {
|
|
50
|
-
opts = CreateServerSchema.parse(opts)
|
|
51
|
-
const {data} = await this.r.post<
|
|
52
|
-
GenericResponse<ApplicationServer, "server">
|
|
53
|
-
>("/servers", opts)
|
|
54
|
-
return data.attributes
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
getServerByExternalId = async (
|
|
58
|
-
external_id: string,
|
|
59
|
-
include?: ("egg" | "subusers")[]
|
|
60
|
-
): Promise<ApplicationServer> => {
|
|
61
|
-
const {data} = await this.r.get<
|
|
62
|
-
GenericResponse<ApplicationServer, "server">
|
|
63
|
-
>(`/servers/external/${external_id}`, {
|
|
64
|
-
params: {include: include?.join(",")}
|
|
65
|
-
})
|
|
66
|
-
return data.attributes
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
servers = (server_id: number) => new Servers(this.r, server_id)
|
|
70
|
-
}
|