@pelican.ts/sdk 0.4.16-next.3 → 0.5.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/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: unknown;
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,134 @@ 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: unknown;
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
+ /**
632
+ * Server limits indicate how many resources can be used by the server
633
+ */
634
+ type ServerLimits = {
635
+ /**
636
+ * Memory limit in megabytes, 0 = unlimited
637
+ * @remarks
638
+ * This is not a pterodactyl's MiB, it's a MB (multiple of 1000).
639
+ * That means to set 8GB RAM, you should set 8000 instead of 8192
640
+ */
641
+ memory: number;
642
+ /**
643
+ * Swap limit in megabytes, 0 = disabled, -1 = unlimited
644
+ * @see memory
645
+ */
646
+ swap: number;
647
+ /**
648
+ * Disk limit in megabytes, 0 = unlimited
649
+ * @see memory
650
+ */
651
+ disk: number;
652
+ /**
653
+ * IO is an arbitrary value indicating IO importance relative to other servers
654
+ */
655
+ io: number;
656
+ /**
657
+ * CPU limit in percentage, 0 = unlimited (1 core = 100%)
658
+ */
659
+ cpu: number;
660
+ /**
661
+ * CPU pinning (Optional)
662
+ * @usage
663
+ * ```
664
+ * 1 or 1,2,4 or 1-4
665
+ * ```
666
+ * @remarks
667
+ * Can be useful to pin workloads to P-cores and avoid E-cores or HT/SMT cores
668
+ * @see https://superuser.com/questions/122536/what-is-hyper-threading-and-how-does-it-work
669
+ */
670
+ threads: Nullable<number | string>;
671
+ /**
672
+ * If OOM killer should be disabled, opposite of {@link oom_killer}
673
+ * @deprecated use {@link oom_killer}
674
+ */
675
+ oom_disabled: boolean;
676
+ /**
677
+ * If OOM killer should be enabled, opposite of {@link oom_disabled}
678
+ */
679
+ oom_killer: boolean;
680
+ };
681
+ /**
682
+ * Feature limits indicate how many features can user enable by themselves. It doesn't include features assigned
683
+ * by admins
684
+ */
685
+ type FeatureLimits = {
686
+ databases: number;
687
+ allocations: number;
688
+ backups: number;
689
+ };
690
+
691
+ type StartupParams = {
692
+ name: string;
693
+ description: string;
694
+ env_variables: string;
695
+ default_value: string;
696
+ server_value: string;
697
+ is_editable: boolean;
698
+ rules: string;
699
+ };
700
+ type StartupMeta = {
701
+ startup_command: string;
702
+ raw_startup_command: string;
703
+ };
704
+
671
705
  type Schedule = {
672
706
  id: number;
673
707
  name: string;
@@ -700,6 +734,27 @@ type ScheduleTask = {
700
734
  updated_at: Nullable<string>;
701
735
  };
702
736
 
737
+ type EggVariable = {
738
+ name: string;
739
+ description: string;
740
+ env_variable: string;
741
+ default_value: string;
742
+ server_value: string;
743
+ is_editable: boolean;
744
+ rules: string;
745
+ };
746
+
747
+ type Mount = {
748
+ id: number;
749
+ uuid: string;
750
+ name: string;
751
+ description: Nullable<string>;
752
+ source: string;
753
+ target: string;
754
+ read_only: boolean;
755
+ user_mountable: boolean;
756
+ };
757
+
703
758
  type Container = {
704
759
  startup_command: string;
705
760
  image: string;
@@ -731,21 +786,6 @@ type ApplicationServer = {
731
786
  updated_at: Nullable<string>;
732
787
  };
733
788
 
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
789
  type Node = {
750
790
  id: number;
751
791
  uuid: string;
@@ -806,32 +846,60 @@ type NodeConfiguration = {
806
846
  remote: string;
807
847
  };
808
848
 
809
- type Mount = {
849
+ type Allocation = {
810
850
  id: number;
811
- uuid: string;
812
- name: string;
813
- description: Nullable<string>;
814
- source: string;
815
- target: string;
816
- read_only: boolean;
817
- user_mountable: boolean;
851
+ ip: string;
852
+ alias: Nullable<string>;
853
+ port: number;
854
+ notes: Nullable<string>;
855
+ assigned: boolean;
856
+ };
857
+ type AllocationRel = Allocation & {
858
+ relationships?: {
859
+ node?: GenericResponse<Node, "node">;
860
+ server?: GenericResponse<ApplicationServer, "server">;
861
+ };
818
862
  };
819
863
 
820
- type DatabaseHost = {
864
+ type ApplicationUser = {
821
865
  id: number;
822
- name: string;
823
- host: string;
824
- port: number;
866
+ external_id: Nullable<string>;
867
+ is_managed_externally: boolean;
868
+ uuid: string;
825
869
  username: string;
870
+ email: string;
871
+ language: string;
872
+ root_admin: string;
873
+ "2fa_enabled": boolean;
874
+ "2fa": boolean;
826
875
  created_at: string;
827
876
  updated_at: Nullable<string>;
877
+ relationships?: {
878
+ servers: GenericListResponse<GenericResponse<ApplicationServer>>;
879
+ };
880
+ };
881
+ type ApplicationUserApiKey = {
882
+ id: number;
883
+ user_id: number;
884
+ key_type: 1;
885
+ identifier: string;
886
+ memo: string;
887
+ allowed_ips: Array<string>;
888
+ permissions: [];
889
+ last_used_at: Nullable<string>;
890
+ expires_at: Nullable<string>;
891
+ created_at: string;
892
+ updated_at: string;
828
893
  };
829
894
 
830
- type Role = {
895
+ type DatabaseHost = {
831
896
  id: number;
832
897
  name: string;
898
+ host: string;
899
+ port: number;
900
+ username: string;
833
901
  created_at: string;
834
- updated_at: string;
902
+ updated_at: Nullable<string>;
835
903
  };
836
904
 
837
905
  type Egg = {
@@ -901,34 +969,121 @@ type ExportedEgg = {
901
969
  variables: ApplicationEggVariable[];
902
970
  };
903
971
 
904
- type ApplicationUser = {
972
+ type Role = {
905
973
  id: number;
906
- external_id: Nullable<string>;
974
+ name: string;
975
+ created_at: string;
976
+ updated_at: string;
977
+ };
978
+
979
+ type ServerAllocation = {
980
+ id: number;
981
+ ip: string;
982
+ ip_alias: Nullable<string>;
983
+ port: number;
984
+ notes: Nullable<string>;
985
+ is_default: boolean;
986
+ };
987
+
988
+ type ServerSubuser = {
907
989
  uuid: string;
908
990
  username: string;
909
991
  email: string;
910
992
  language: string;
911
- root_admin: string;
993
+ image: string;
994
+ admin: false;
995
+ root_admin: false;
912
996
  "2fa_enabled": boolean;
913
- "2fa": boolean;
914
997
  created_at: string;
915
- updated_at: Nullable<string>;
916
- relationships?: {
917
- servers: GenericListResponse<GenericResponse<ApplicationServer>>;
998
+ permissions: SubuserPermission[] | string[];
999
+ };
1000
+ 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";
1001
+
1002
+ type Server = {
1003
+ server_owner: boolean;
1004
+ identifier: string;
1005
+ internal_id?: number;
1006
+ uuid: string;
1007
+ name: string;
1008
+ node: string;
1009
+ is_node_under_maintenance: boolean;
1010
+ sftp_details: {
1011
+ ip: string;
1012
+ alias: Nullable<string>;
1013
+ port: number;
1014
+ };
1015
+ description: string;
1016
+ limits: ServerLimits;
1017
+ invocation: string;
1018
+ docker_image: string;
1019
+ egg_features: Nullable<string[]>;
1020
+ feature_limits: FeatureLimits;
1021
+ status: Nullable<ServerStats["current_state"]>;
1022
+ is_suspended: boolean;
1023
+ is_installing: boolean;
1024
+ is_transferring: boolean;
1025
+ relationships: {
1026
+ allocations: GenericListResponse<GenericResponse<ServerAllocation, "allocation">>;
1027
+ variables: GenericListResponse<GenericResponse<EggVariable, "egg_variable">>;
1028
+ egg?: GenericResponse<{
1029
+ uuid: string;
1030
+ name: string;
1031
+ }, "egg">;
1032
+ subusers?: GenericListResponse<GenericResponse<ServerSubuser, "server_subuser">>;
918
1033
  };
919
1034
  };
920
- type ApplicationUserApiKey = {
921
- id: number;
922
- user_id: number;
923
- key_type: 1;
1035
+ type ServerStats = {
1036
+ current_state: "installing" | "install_failed" | "reinstall_failed" | "suspended" | "restoring_backup" | "running" | "stopped" | "offline";
1037
+ is_suspended: boolean;
1038
+ resources: ServerResources;
1039
+ };
1040
+ type ServerResources = {
1041
+ memory_bytes: number;
1042
+ cpu_absolute: number;
1043
+ disk_bytes: number;
1044
+ network_tx_bytes: number;
1045
+ network_rx_bytes: number;
1046
+ uptime: number;
1047
+ };
1048
+ type ServerActivityLog = {
1049
+ id: string;
1050
+ event: string;
1051
+ is_api: boolean;
1052
+ ip: string;
1053
+ description: Nullable<string>;
1054
+ properties: Record<string, string>;
1055
+ has_additional_metadata: boolean;
1056
+ timestamp: string;
1057
+ };
1058
+
1059
+ type User = {
1060
+ uuid: string;
1061
+ username: string;
1062
+ email: string;
1063
+ language: string;
1064
+ image: string;
1065
+ admin: boolean;
1066
+ root_admin: boolean;
1067
+ "2fa_enabled": boolean;
1068
+ created_at: string;
1069
+ updated_at: string;
1070
+ };
1071
+ type APIKey = {
924
1072
  identifier: string;
925
- memo: string;
926
- allowed_ips: Array<string>;
927
- permissions: [];
1073
+ description: string;
1074
+ allowed_ips: string[];
928
1075
  last_used_at: Nullable<string>;
929
- expires_at: Nullable<string>;
930
1076
  created_at: string;
931
- updated_at: string;
1077
+ };
1078
+ type SSHKey = {
1079
+ name: string;
1080
+ fingerprint: string;
1081
+ pubic_key: string;
1082
+ created_at: string;
1083
+ };
1084
+ type Permission = {
1085
+ description: string;
1086
+ keys: Record<string, string>;
932
1087
  };
933
1088
 
934
1089
  type SocketEventPayloadMap = {
@@ -1102,114 +1257,4 @@ type JwtErrorEvent = {
1102
1257
  args: [string];
1103
1258
  };
1104
1259
 
1105
- type ServerAllocation = {
1106
- id: number;
1107
- ip: string;
1108
- ip_alias: Nullable<string>;
1109
- port: number;
1110
- notes: Nullable<string>;
1111
- is_default: boolean;
1112
- };
1113
-
1114
- type ServerSubuser = {
1115
- uuid: string;
1116
- username: string;
1117
- email: string;
1118
- language: string;
1119
- image: string;
1120
- admin: false;
1121
- root_admin: false;
1122
- "2fa_enabled": boolean;
1123
- created_at: string;
1124
- permissions: SubuserPermission[] | string[];
1125
- };
1126
- 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";
1127
-
1128
- type Server = {
1129
- server_owner: boolean;
1130
- identifier: string;
1131
- internal_id?: number;
1132
- uuid: string;
1133
- name: string;
1134
- node: string;
1135
- is_node_under_maintenance: boolean;
1136
- sftp_details: {
1137
- ip: string;
1138
- alias: Nullable<string>;
1139
- port: number;
1140
- };
1141
- description: string;
1142
- limits: ServerLimits;
1143
- invocation: string;
1144
- docker_image: string;
1145
- egg_features: Nullable<string[]>;
1146
- feature_limits: FeatureLimits;
1147
- status: Nullable<unknown>;
1148
- is_suspended: boolean;
1149
- is_installing: boolean;
1150
- is_transferring: boolean;
1151
- relationships: {
1152
- allocations: GenericListResponse<GenericResponse<ServerAllocation, "allocation">>;
1153
- variables: GenericListResponse<GenericResponse<EggVariable, "egg_variable">>;
1154
- egg?: GenericResponse<{
1155
- uuid: string;
1156
- name: string;
1157
- }, "egg">;
1158
- subusers?: GenericListResponse<GenericResponse<ServerSubuser, "server_subuser">>;
1159
- };
1160
- };
1161
- type ServerStats = {
1162
- current_state: "installing" | "install_failed" | "reinstall_failed" | "suspended" | "restoring_backup" | "running" | "stopped" | "offline";
1163
- is_suspended: boolean;
1164
- resources: ServerResources;
1165
- };
1166
- type ServerResources = {
1167
- memory_bytes: number;
1168
- cpu_absolute: number;
1169
- disk_bytes: number;
1170
- network_tx_bytes: number;
1171
- network_rx_bytes: number;
1172
- uptime: number;
1173
- };
1174
- type ServerActivityLog = {
1175
- id: string;
1176
- event: string;
1177
- is_api: boolean;
1178
- ip: string;
1179
- description: Nullable<string>;
1180
- properties: Record<string, string>;
1181
- has_additional_metadata: boolean;
1182
- timestamp: string;
1183
- };
1184
-
1185
- type User = {
1186
- uuid: string;
1187
- username: string;
1188
- email: string;
1189
- language: string;
1190
- image: string;
1191
- admin: boolean;
1192
- root_admin: boolean;
1193
- "2fa_enabled": boolean;
1194
- created_at: string;
1195
- updated_at: string;
1196
- };
1197
- type APIKey = {
1198
- identifier: string;
1199
- description: string;
1200
- allowed_ips: string[];
1201
- last_used_at: Nullable<string>;
1202
- created_at: string;
1203
- };
1204
- type SSHKey = {
1205
- name: string;
1206
- fingerprint: string;
1207
- pubic_key: string;
1208
- created_at: string;
1209
- };
1210
- type Permission = {
1211
- description: string;
1212
- keys: Record<string, string>;
1213
- };
1214
-
1215
1260
  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 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pelican.ts/sdk",
3
- "version": "0.4.16-next.3",
3
+ "version": "0.5.0",
4
4
  "description": "Pelican panel SDK for TypeScript",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",