@pelican.ts/sdk 0.2.3 → 0.2.4
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/README.md +11 -8
- package/dist/index.d.mts +905 -64
- package/dist/index.d.ts +905 -64
- package/dist/index.js +943 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +943 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
- package/src/api/application/client.ts +40 -0
- package/src/api/application/database_hosts.ts +70 -0
- package/src/api/application/nodes.ts +72 -45
- package/src/api/application/nodes_allocations.ts +4 -6
- package/src/api/application/roles.ts +53 -0
- package/src/api/application/servers.ts +135 -0
- package/src/api/application/servers_databases.ts +49 -0
- package/src/api/application/types/container.ts +1 -3
- package/src/api/application/types/database_host.ts +11 -0
- package/src/api/application/types/node.ts +39 -4
- package/src/api/application/types/role.ts +8 -0
- package/src/api/application/types/server.ts +4 -4
- package/src/api/{common/types/server_allocations.ts → application/types/server_allocation.ts} +3 -2
- package/src/api/application/types/user.ts +4 -4
- package/src/api/application/users.ts +28 -18
- package/src/api/base/request.ts +3 -3
- package/src/api/client/server_allocations.ts +1 -1
- package/src/api/client/server_databases.ts +7 -7
- package/src/api/client/types/server.ts +1 -1
- package/src/api/client/types/server_allocation.ts +11 -0
- package/src/api/common/types/enums.ts +21 -0
- package/src/api/common/types/server_database.ts +1 -1
- package/src/index.ts +4 -4
package/dist/index.js
CHANGED
|
@@ -916,7 +916,7 @@ var Client = class {
|
|
|
916
916
|
};
|
|
917
917
|
|
|
918
918
|
// src/api/application/users.ts
|
|
919
|
-
var
|
|
919
|
+
var import_zod7 = __toESM(require("zod"));
|
|
920
920
|
|
|
921
921
|
// src/utils/transform.ts
|
|
922
922
|
var ArrayQueryParams = (p) => {
|
|
@@ -933,14 +933,574 @@ var SortParam = (key, p) => {
|
|
|
933
933
|
return `${p === "desc" ? "-" : ""}${key}`;
|
|
934
934
|
};
|
|
935
935
|
|
|
936
|
+
// src/api/common/types/enums.ts
|
|
937
|
+
var import_zod6 = __toESM(require("zod"));
|
|
938
|
+
var languagesSchema = import_zod6.default.enum([
|
|
939
|
+
"af",
|
|
940
|
+
"ak",
|
|
941
|
+
"am",
|
|
942
|
+
"ar",
|
|
943
|
+
"as",
|
|
944
|
+
"az",
|
|
945
|
+
"be",
|
|
946
|
+
"bg",
|
|
947
|
+
"bm",
|
|
948
|
+
"bn",
|
|
949
|
+
"bo",
|
|
950
|
+
"br",
|
|
951
|
+
"bs",
|
|
952
|
+
"ca",
|
|
953
|
+
"ce",
|
|
954
|
+
"cs",
|
|
955
|
+
"cv",
|
|
956
|
+
"cy",
|
|
957
|
+
"da",
|
|
958
|
+
"de",
|
|
959
|
+
"dz",
|
|
960
|
+
"ee",
|
|
961
|
+
"el",
|
|
962
|
+
"en",
|
|
963
|
+
"eo",
|
|
964
|
+
"es",
|
|
965
|
+
"et",
|
|
966
|
+
"eu",
|
|
967
|
+
"fa",
|
|
968
|
+
"ff",
|
|
969
|
+
"fi",
|
|
970
|
+
"fo",
|
|
971
|
+
"fr",
|
|
972
|
+
"fy",
|
|
973
|
+
"ga",
|
|
974
|
+
"gd",
|
|
975
|
+
"gl",
|
|
976
|
+
"gu",
|
|
977
|
+
"gv",
|
|
978
|
+
"ha",
|
|
979
|
+
"he",
|
|
980
|
+
"hi",
|
|
981
|
+
"hr",
|
|
982
|
+
"hu",
|
|
983
|
+
"hy",
|
|
984
|
+
"ia",
|
|
985
|
+
"id",
|
|
986
|
+
"ig",
|
|
987
|
+
"ii",
|
|
988
|
+
"is",
|
|
989
|
+
"it",
|
|
990
|
+
"ja",
|
|
991
|
+
"jv",
|
|
992
|
+
"ka",
|
|
993
|
+
"ki",
|
|
994
|
+
"kk",
|
|
995
|
+
"kl",
|
|
996
|
+
"km",
|
|
997
|
+
"kn",
|
|
998
|
+
"ko",
|
|
999
|
+
"ks",
|
|
1000
|
+
"ku",
|
|
1001
|
+
"kw",
|
|
1002
|
+
"ky",
|
|
1003
|
+
"lb",
|
|
1004
|
+
"lg",
|
|
1005
|
+
"ln",
|
|
1006
|
+
"lo",
|
|
1007
|
+
"lt",
|
|
1008
|
+
"lu",
|
|
1009
|
+
"lv",
|
|
1010
|
+
"mg",
|
|
1011
|
+
"mi",
|
|
1012
|
+
"mk",
|
|
1013
|
+
"ml",
|
|
1014
|
+
"mn",
|
|
1015
|
+
"mr",
|
|
1016
|
+
"ms",
|
|
1017
|
+
"mt",
|
|
1018
|
+
"my",
|
|
1019
|
+
"nb",
|
|
1020
|
+
"nd",
|
|
1021
|
+
"ne",
|
|
1022
|
+
"nl",
|
|
1023
|
+
"nn",
|
|
1024
|
+
"no",
|
|
1025
|
+
"om",
|
|
1026
|
+
"or",
|
|
1027
|
+
"os",
|
|
1028
|
+
"pa",
|
|
1029
|
+
"pl",
|
|
1030
|
+
"ps",
|
|
1031
|
+
"pt",
|
|
1032
|
+
"qu",
|
|
1033
|
+
"rm",
|
|
1034
|
+
"rn",
|
|
1035
|
+
"ro",
|
|
1036
|
+
"ru",
|
|
1037
|
+
"rw",
|
|
1038
|
+
"sa",
|
|
1039
|
+
"sc",
|
|
1040
|
+
"sd",
|
|
1041
|
+
"se",
|
|
1042
|
+
"sg",
|
|
1043
|
+
"si",
|
|
1044
|
+
"sk",
|
|
1045
|
+
"sl",
|
|
1046
|
+
"sn",
|
|
1047
|
+
"so",
|
|
1048
|
+
"sq",
|
|
1049
|
+
"sr",
|
|
1050
|
+
"su",
|
|
1051
|
+
"sv",
|
|
1052
|
+
"sw",
|
|
1053
|
+
"ta",
|
|
1054
|
+
"te",
|
|
1055
|
+
"tg",
|
|
1056
|
+
"th",
|
|
1057
|
+
"ti",
|
|
1058
|
+
"tk",
|
|
1059
|
+
"to",
|
|
1060
|
+
"tr",
|
|
1061
|
+
"tt",
|
|
1062
|
+
"ug",
|
|
1063
|
+
"uk",
|
|
1064
|
+
"ur",
|
|
1065
|
+
"uz",
|
|
1066
|
+
"vi",
|
|
1067
|
+
"wo",
|
|
1068
|
+
"xh",
|
|
1069
|
+
"yi",
|
|
1070
|
+
"yo",
|
|
1071
|
+
"zh",
|
|
1072
|
+
"zu"
|
|
1073
|
+
]);
|
|
1074
|
+
var timezonesSchema = import_zod6.default.enum([
|
|
1075
|
+
"Africa/Abidjan",
|
|
1076
|
+
"Africa/Accra",
|
|
1077
|
+
"Africa/Addis_Ababa",
|
|
1078
|
+
"Africa/Algiers",
|
|
1079
|
+
"Africa/Asmara",
|
|
1080
|
+
"Africa/Bamako",
|
|
1081
|
+
"Africa/Bangui",
|
|
1082
|
+
"Africa/Banjul",
|
|
1083
|
+
"Africa/Bissau",
|
|
1084
|
+
"Africa/Blantyre",
|
|
1085
|
+
"Africa/Brazzaville",
|
|
1086
|
+
"Africa/Bujumbura",
|
|
1087
|
+
"Africa/Cairo",
|
|
1088
|
+
"Africa/Casablanca",
|
|
1089
|
+
"Africa/Ceuta",
|
|
1090
|
+
"Africa/Conakry",
|
|
1091
|
+
"Africa/Dakar",
|
|
1092
|
+
"Africa/Dar_es_Salaam",
|
|
1093
|
+
"Africa/Djibouti",
|
|
1094
|
+
"Africa/Douala",
|
|
1095
|
+
"Africa/El_Aaiun",
|
|
1096
|
+
"Africa/Freetown",
|
|
1097
|
+
"Africa/Gaborone",
|
|
1098
|
+
"Africa/Harare",
|
|
1099
|
+
"Africa/Johannesburg",
|
|
1100
|
+
"Africa/Juba",
|
|
1101
|
+
"Africa/Kampala",
|
|
1102
|
+
"Africa/Khartoum",
|
|
1103
|
+
"Africa/Kigali",
|
|
1104
|
+
"Africa/Kinshasa",
|
|
1105
|
+
"Africa/Lagos",
|
|
1106
|
+
"Africa/Libreville",
|
|
1107
|
+
"Africa/Lome",
|
|
1108
|
+
"Africa/Luanda",
|
|
1109
|
+
"Africa/Lubumbashi",
|
|
1110
|
+
"Africa/Lusaka",
|
|
1111
|
+
"Africa/Malabo",
|
|
1112
|
+
"Africa/Maputo",
|
|
1113
|
+
"Africa/Maseru",
|
|
1114
|
+
"Africa/Mbabane",
|
|
1115
|
+
"Africa/Mogadishu",
|
|
1116
|
+
"Africa/Monrovia",
|
|
1117
|
+
"Africa/Nairobi",
|
|
1118
|
+
"Africa/Ndjamena",
|
|
1119
|
+
"Africa/Niamey",
|
|
1120
|
+
"Africa/Nouakchott",
|
|
1121
|
+
"Africa/Ouagadougou",
|
|
1122
|
+
"Africa/Porto-Novo",
|
|
1123
|
+
"Africa/Sao_Tome",
|
|
1124
|
+
"Africa/Tripoli",
|
|
1125
|
+
"Africa/Tunis",
|
|
1126
|
+
"Africa/Windhoek",
|
|
1127
|
+
"America/Adak",
|
|
1128
|
+
"America/Anchorage",
|
|
1129
|
+
"America/Anguilla",
|
|
1130
|
+
"America/Antigua",
|
|
1131
|
+
"America/Araguaina",
|
|
1132
|
+
"America/Argentina/Buenos_Aires",
|
|
1133
|
+
"America/Argentina/Catamarca",
|
|
1134
|
+
"America/Argentina/Cordoba",
|
|
1135
|
+
"America/Argentina/Jujuy",
|
|
1136
|
+
"America/Argentina/La_Rioja",
|
|
1137
|
+
"America/Argentina/Mendoza",
|
|
1138
|
+
"America/Argentina/Rio_Gallegos",
|
|
1139
|
+
"America/Argentina/Salta",
|
|
1140
|
+
"America/Argentina/San_Juan",
|
|
1141
|
+
"America/Argentina/San_Luis",
|
|
1142
|
+
"America/Argentina/Tucuman",
|
|
1143
|
+
"America/Argentina/Ushuaia",
|
|
1144
|
+
"America/Aruba",
|
|
1145
|
+
"America/Asuncion",
|
|
1146
|
+
"America/Atikokan",
|
|
1147
|
+
"America/Bahia",
|
|
1148
|
+
"America/Bahia_Banderas",
|
|
1149
|
+
"America/Barbados",
|
|
1150
|
+
"America/Belem",
|
|
1151
|
+
"America/Belize",
|
|
1152
|
+
"America/Blanc-Sablon",
|
|
1153
|
+
"America/Boa_Vista",
|
|
1154
|
+
"America/Bogota",
|
|
1155
|
+
"America/Boise",
|
|
1156
|
+
"America/Cambridge_Bay",
|
|
1157
|
+
"America/Campo_Grande",
|
|
1158
|
+
"America/Cancun",
|
|
1159
|
+
"America/Caracas",
|
|
1160
|
+
"America/Cayenne",
|
|
1161
|
+
"America/Cayman",
|
|
1162
|
+
"America/Chicago",
|
|
1163
|
+
"America/Chihuahua",
|
|
1164
|
+
"America/Ciudad_Juarez",
|
|
1165
|
+
"America/Costa_Rica",
|
|
1166
|
+
"America/Coyhaique",
|
|
1167
|
+
"America/Creston",
|
|
1168
|
+
"America/Cuiaba",
|
|
1169
|
+
"America/Curacao",
|
|
1170
|
+
"America/Danmarkshavn",
|
|
1171
|
+
"America/Dawson",
|
|
1172
|
+
"America/Dawson_Creek",
|
|
1173
|
+
"America/Denver",
|
|
1174
|
+
"America/Detroit",
|
|
1175
|
+
"America/Dominica",
|
|
1176
|
+
"America/Edmonton",
|
|
1177
|
+
"America/Eirunepe",
|
|
1178
|
+
"America/El_Salvador",
|
|
1179
|
+
"America/Fort_Nelson",
|
|
1180
|
+
"America/Fortaleza",
|
|
1181
|
+
"America/Glace_Bay",
|
|
1182
|
+
"America/Goose_Bay",
|
|
1183
|
+
"America/Grand_Turk",
|
|
1184
|
+
"America/Grenada",
|
|
1185
|
+
"America/Guadeloupe",
|
|
1186
|
+
"America/Guatemala",
|
|
1187
|
+
"America/Guayaquil",
|
|
1188
|
+
"America/Guyana",
|
|
1189
|
+
"America/Halifax",
|
|
1190
|
+
"America/Havana",
|
|
1191
|
+
"America/Hermosillo",
|
|
1192
|
+
"America/Indiana/Indianapolis",
|
|
1193
|
+
"America/Indiana/Knox",
|
|
1194
|
+
"America/Indiana/Marengo",
|
|
1195
|
+
"America/Indiana/Petersburg",
|
|
1196
|
+
"America/Indiana/Tell_City",
|
|
1197
|
+
"America/Indiana/Vevay",
|
|
1198
|
+
"America/Indiana/Vincennes",
|
|
1199
|
+
"America/Indiana/Winamac",
|
|
1200
|
+
"America/Inuvik",
|
|
1201
|
+
"America/Iqaluit",
|
|
1202
|
+
"America/Jamaica",
|
|
1203
|
+
"America/Juneau",
|
|
1204
|
+
"America/Kentucky/Louisville",
|
|
1205
|
+
"America/Kentucky/Monticello",
|
|
1206
|
+
"America/Kralendijk",
|
|
1207
|
+
"America/La_Paz",
|
|
1208
|
+
"America/Lima",
|
|
1209
|
+
"America/Los_Angeles",
|
|
1210
|
+
"America/Lower_Princes",
|
|
1211
|
+
"America/Maceio",
|
|
1212
|
+
"America/Managua",
|
|
1213
|
+
"America/Manaus",
|
|
1214
|
+
"America/Marigot",
|
|
1215
|
+
"America/Martinique",
|
|
1216
|
+
"America/Matamoros",
|
|
1217
|
+
"America/Mazatlan",
|
|
1218
|
+
"America/Menominee",
|
|
1219
|
+
"America/Merida",
|
|
1220
|
+
"America/Metlakatla",
|
|
1221
|
+
"America/Mexico_City",
|
|
1222
|
+
"America/Miquelon",
|
|
1223
|
+
"America/Moncton",
|
|
1224
|
+
"America/Monterrey",
|
|
1225
|
+
"America/Montevideo",
|
|
1226
|
+
"America/Montserrat",
|
|
1227
|
+
"America/Nassau",
|
|
1228
|
+
"America/New_York",
|
|
1229
|
+
"America/Nome",
|
|
1230
|
+
"America/Noronha",
|
|
1231
|
+
"America/North_Dakota/Beulah",
|
|
1232
|
+
"America/North_Dakota/Center",
|
|
1233
|
+
"America/North_Dakota/New_Salem",
|
|
1234
|
+
"America/Nuuk",
|
|
1235
|
+
"America/Ojinaga",
|
|
1236
|
+
"America/Panama",
|
|
1237
|
+
"America/Paramaribo",
|
|
1238
|
+
"America/Phoenix",
|
|
1239
|
+
"America/Port-au-Prince",
|
|
1240
|
+
"America/Port_of_Spain",
|
|
1241
|
+
"America/Porto_Velho",
|
|
1242
|
+
"America/Puerto_Rico",
|
|
1243
|
+
"America/Punta_Arenas",
|
|
1244
|
+
"America/Rankin_Inlet",
|
|
1245
|
+
"America/Recife",
|
|
1246
|
+
"America/Regina",
|
|
1247
|
+
"America/Resolute",
|
|
1248
|
+
"America/Rio_Branco",
|
|
1249
|
+
"America/Santarem",
|
|
1250
|
+
"America/Santiago",
|
|
1251
|
+
"America/Santo_Domingo",
|
|
1252
|
+
"America/Sao_Paulo",
|
|
1253
|
+
"America/Scoresbysund",
|
|
1254
|
+
"America/Sitka",
|
|
1255
|
+
"America/St_Barthelemy",
|
|
1256
|
+
"America/St_Johns",
|
|
1257
|
+
"America/St_Kitts",
|
|
1258
|
+
"America/St_Lucia",
|
|
1259
|
+
"America/St_Thomas",
|
|
1260
|
+
"America/St_Vincent",
|
|
1261
|
+
"America/Swift_Current",
|
|
1262
|
+
"America/Tegucigalpa",
|
|
1263
|
+
"America/Thule",
|
|
1264
|
+
"America/Tijuana",
|
|
1265
|
+
"America/Toronto",
|
|
1266
|
+
"America/Tortola",
|
|
1267
|
+
"America/Vancouver",
|
|
1268
|
+
"America/Whitehorse",
|
|
1269
|
+
"America/Winnipeg",
|
|
1270
|
+
"America/Yakutat",
|
|
1271
|
+
"Antarctica/Casey",
|
|
1272
|
+
"Antarctica/Davis",
|
|
1273
|
+
"Antarctica/DumontDUrville",
|
|
1274
|
+
"Antarctica/Macquarie",
|
|
1275
|
+
"Antarctica/Mawson",
|
|
1276
|
+
"Antarctica/McMurdo",
|
|
1277
|
+
"Antarctica/Palmer",
|
|
1278
|
+
"Antarctica/Rothera",
|
|
1279
|
+
"Antarctica/Syowa",
|
|
1280
|
+
"Antarctica/Troll",
|
|
1281
|
+
"Antarctica/Vostok",
|
|
1282
|
+
"Arctic/Longyearbyen",
|
|
1283
|
+
"Asia/Aden",
|
|
1284
|
+
"Asia/Almaty",
|
|
1285
|
+
"Asia/Amman",
|
|
1286
|
+
"Asia/Anadyr",
|
|
1287
|
+
"Asia/Aqtau",
|
|
1288
|
+
"Asia/Aqtobe",
|
|
1289
|
+
"Asia/Ashgabat",
|
|
1290
|
+
"Asia/Atyrau",
|
|
1291
|
+
"Asia/Baghdad",
|
|
1292
|
+
"Asia/Bahrain",
|
|
1293
|
+
"Asia/Baku",
|
|
1294
|
+
"Asia/Bangkok",
|
|
1295
|
+
"Asia/Barnaul",
|
|
1296
|
+
"Asia/Beirut",
|
|
1297
|
+
"Asia/Bishkek",
|
|
1298
|
+
"Asia/Brunei",
|
|
1299
|
+
"Asia/Chita",
|
|
1300
|
+
"Asia/Colombo",
|
|
1301
|
+
"Asia/Damascus",
|
|
1302
|
+
"Asia/Dhaka",
|
|
1303
|
+
"Asia/Dili",
|
|
1304
|
+
"Asia/Dubai",
|
|
1305
|
+
"Asia/Dushanbe",
|
|
1306
|
+
"Asia/Famagusta",
|
|
1307
|
+
"Asia/Gaza",
|
|
1308
|
+
"Asia/Hebron",
|
|
1309
|
+
"Asia/Ho_Chi_Minh",
|
|
1310
|
+
"Asia/Hong_Kong",
|
|
1311
|
+
"Asia/Hovd",
|
|
1312
|
+
"Asia/Irkutsk",
|
|
1313
|
+
"Asia/Jakarta",
|
|
1314
|
+
"Asia/Jayapura",
|
|
1315
|
+
"Asia/Jerusalem",
|
|
1316
|
+
"Asia/Kabul",
|
|
1317
|
+
"Asia/Kamchatka",
|
|
1318
|
+
"Asia/Karachi",
|
|
1319
|
+
"Asia/Kathmandu",
|
|
1320
|
+
"Asia/Khandyga",
|
|
1321
|
+
"Asia/Kolkata",
|
|
1322
|
+
"Asia/Krasnoyarsk",
|
|
1323
|
+
"Asia/Kuala_Lumpur",
|
|
1324
|
+
"Asia/Kuching",
|
|
1325
|
+
"Asia/Kuwait",
|
|
1326
|
+
"Asia/Macau",
|
|
1327
|
+
"Asia/Magadan",
|
|
1328
|
+
"Asia/Makassar",
|
|
1329
|
+
"Asia/Manila",
|
|
1330
|
+
"Asia/Muscat",
|
|
1331
|
+
"Asia/Nicosia",
|
|
1332
|
+
"Asia/Novokuznetsk",
|
|
1333
|
+
"Asia/Novosibirsk",
|
|
1334
|
+
"Asia/Omsk",
|
|
1335
|
+
"Asia/Oral",
|
|
1336
|
+
"Asia/Phnom_Penh",
|
|
1337
|
+
"Asia/Pontianak",
|
|
1338
|
+
"Asia/Pyongyang",
|
|
1339
|
+
"Asia/Qatar",
|
|
1340
|
+
"Asia/Qostanay",
|
|
1341
|
+
"Asia/Qyzylorda",
|
|
1342
|
+
"Asia/Riyadh",
|
|
1343
|
+
"Asia/Sakhalin",
|
|
1344
|
+
"Asia/Samarkand",
|
|
1345
|
+
"Asia/Seoul",
|
|
1346
|
+
"Asia/Shanghai",
|
|
1347
|
+
"Asia/Singapore",
|
|
1348
|
+
"Asia/Srednekolymsk",
|
|
1349
|
+
"Asia/Taipei",
|
|
1350
|
+
"Asia/Tashkent",
|
|
1351
|
+
"Asia/Tbilisi",
|
|
1352
|
+
"Asia/Tehran",
|
|
1353
|
+
"Asia/Thimphu",
|
|
1354
|
+
"Asia/Tokyo",
|
|
1355
|
+
"Asia/Tomsk",
|
|
1356
|
+
"Asia/Ulaanbaatar",
|
|
1357
|
+
"Asia/Urumqi",
|
|
1358
|
+
"Asia/Ust-Nera",
|
|
1359
|
+
"Asia/Vientiane",
|
|
1360
|
+
"Asia/Vladivostok",
|
|
1361
|
+
"Asia/Yakutsk",
|
|
1362
|
+
"Asia/Yangon",
|
|
1363
|
+
"Asia/Yekaterinburg",
|
|
1364
|
+
"Asia/Yerevan",
|
|
1365
|
+
"Atlantic/Azores",
|
|
1366
|
+
"Atlantic/Bermuda",
|
|
1367
|
+
"Atlantic/Canary",
|
|
1368
|
+
"Atlantic/Cape_Verde",
|
|
1369
|
+
"Atlantic/Faroe",
|
|
1370
|
+
"Atlantic/Madeira",
|
|
1371
|
+
"Atlantic/Reykjavik",
|
|
1372
|
+
"Atlantic/South_Georgia",
|
|
1373
|
+
"Atlantic/St_Helena",
|
|
1374
|
+
"Atlantic/Stanley",
|
|
1375
|
+
"Australia/Adelaide",
|
|
1376
|
+
"Australia/Brisbane",
|
|
1377
|
+
"Australia/Broken_Hill",
|
|
1378
|
+
"Australia/Darwin",
|
|
1379
|
+
"Australia/Eucla",
|
|
1380
|
+
"Australia/Hobart",
|
|
1381
|
+
"Australia/Lindeman",
|
|
1382
|
+
"Australia/Lord_Howe",
|
|
1383
|
+
"Australia/Melbourne",
|
|
1384
|
+
"Australia/Perth",
|
|
1385
|
+
"Australia/Sydney",
|
|
1386
|
+
"Europe/Amsterdam",
|
|
1387
|
+
"Europe/Andorra",
|
|
1388
|
+
"Europe/Astrakhan",
|
|
1389
|
+
"Europe/Athens",
|
|
1390
|
+
"Europe/Belgrade",
|
|
1391
|
+
"Europe/Berlin",
|
|
1392
|
+
"Europe/Bratislava",
|
|
1393
|
+
"Europe/Brussels",
|
|
1394
|
+
"Europe/Bucharest",
|
|
1395
|
+
"Europe/Budapest",
|
|
1396
|
+
"Europe/Busingen",
|
|
1397
|
+
"Europe/Chisinau",
|
|
1398
|
+
"Europe/Copenhagen",
|
|
1399
|
+
"Europe/Dublin",
|
|
1400
|
+
"Europe/Gibraltar",
|
|
1401
|
+
"Europe/Guernsey",
|
|
1402
|
+
"Europe/Helsinki",
|
|
1403
|
+
"Europe/Isle_of_Man",
|
|
1404
|
+
"Europe/Istanbul",
|
|
1405
|
+
"Europe/Jersey",
|
|
1406
|
+
"Europe/Kaliningrad",
|
|
1407
|
+
"Europe/Kirov",
|
|
1408
|
+
"Europe/Kyiv",
|
|
1409
|
+
"Europe/Lisbon",
|
|
1410
|
+
"Europe/Ljubljana",
|
|
1411
|
+
"Europe/London",
|
|
1412
|
+
"Europe/Luxembourg",
|
|
1413
|
+
"Europe/Madrid",
|
|
1414
|
+
"Europe/Malta",
|
|
1415
|
+
"Europe/Mariehamn",
|
|
1416
|
+
"Europe/Minsk",
|
|
1417
|
+
"Europe/Monaco",
|
|
1418
|
+
"Europe/Moscow",
|
|
1419
|
+
"Europe/Oslo",
|
|
1420
|
+
"Europe/Paris",
|
|
1421
|
+
"Europe/Podgorica",
|
|
1422
|
+
"Europe/Prague",
|
|
1423
|
+
"Europe/Riga",
|
|
1424
|
+
"Europe/Rome",
|
|
1425
|
+
"Europe/Samara",
|
|
1426
|
+
"Europe/San_Marino",
|
|
1427
|
+
"Europe/Sarajevo",
|
|
1428
|
+
"Europe/Saratov",
|
|
1429
|
+
"Europe/Simferopol",
|
|
1430
|
+
"Europe/Skopje",
|
|
1431
|
+
"Europe/Sofia",
|
|
1432
|
+
"Europe/Stockholm",
|
|
1433
|
+
"Europe/Tallinn",
|
|
1434
|
+
"Europe/Tirane",
|
|
1435
|
+
"Europe/Ulyanovsk",
|
|
1436
|
+
"Europe/Vaduz",
|
|
1437
|
+
"Europe/Vatican",
|
|
1438
|
+
"Europe/Vienna",
|
|
1439
|
+
"Europe/Vilnius",
|
|
1440
|
+
"Europe/Volgograd",
|
|
1441
|
+
"Europe/Warsaw",
|
|
1442
|
+
"Europe/Zagreb",
|
|
1443
|
+
"Europe/Zurich",
|
|
1444
|
+
"Indian/Antananarivo",
|
|
1445
|
+
"Indian/Chagos",
|
|
1446
|
+
"Indian/Christmas",
|
|
1447
|
+
"Indian/Cocos",
|
|
1448
|
+
"Indian/Comoro",
|
|
1449
|
+
"Indian/Kerguelen",
|
|
1450
|
+
"Indian/Mahe",
|
|
1451
|
+
"Indian/Maldives",
|
|
1452
|
+
"Indian/Mauritius",
|
|
1453
|
+
"Indian/Mayotte",
|
|
1454
|
+
"Indian/Reunion",
|
|
1455
|
+
"Pacific/Apia",
|
|
1456
|
+
"Pacific/Auckland",
|
|
1457
|
+
"Pacific/Bougainville",
|
|
1458
|
+
"Pacific/Chatham",
|
|
1459
|
+
"Pacific/Chuuk",
|
|
1460
|
+
"Pacific/Easter",
|
|
1461
|
+
"Pacific/Efate",
|
|
1462
|
+
"Pacific/Fakaofo",
|
|
1463
|
+
"Pacific/Fiji",
|
|
1464
|
+
"Pacific/Funafuti",
|
|
1465
|
+
"Pacific/Galapagos",
|
|
1466
|
+
"Pacific/Gambier",
|
|
1467
|
+
"Pacific/Guadalcanal",
|
|
1468
|
+
"Pacific/Guam",
|
|
1469
|
+
"Pacific/Honolulu",
|
|
1470
|
+
"Pacific/Kanton",
|
|
1471
|
+
"Pacific/Kiritimati",
|
|
1472
|
+
"Pacific/Kosrae",
|
|
1473
|
+
"Pacific/Kwajalein",
|
|
1474
|
+
"Pacific/Majuro",
|
|
1475
|
+
"Pacific/Marquesas",
|
|
1476
|
+
"Pacific/Midway",
|
|
1477
|
+
"Pacific/Nauru",
|
|
1478
|
+
"Pacific/Niue",
|
|
1479
|
+
"Pacific/Norfolk",
|
|
1480
|
+
"Pacific/Noumea",
|
|
1481
|
+
"Pacific/Pago_Pago",
|
|
1482
|
+
"Pacific/Palau",
|
|
1483
|
+
"Pacific/Pitcairn",
|
|
1484
|
+
"Pacific/Pohnpei",
|
|
1485
|
+
"Pacific/Port_Moresby",
|
|
1486
|
+
"Pacific/Rarotonga",
|
|
1487
|
+
"Pacific/Saipan",
|
|
1488
|
+
"Pacific/Tahiti",
|
|
1489
|
+
"Pacific/Tarawa",
|
|
1490
|
+
"Pacific/Tongatapu",
|
|
1491
|
+
"Pacific/Wake",
|
|
1492
|
+
"Pacific/Wallis",
|
|
1493
|
+
"UTC"
|
|
1494
|
+
]);
|
|
1495
|
+
|
|
936
1496
|
// src/api/application/users.ts
|
|
937
1497
|
var Users = class {
|
|
938
1498
|
r;
|
|
939
1499
|
constructor(requester) {
|
|
940
1500
|
this.r = requester;
|
|
941
1501
|
}
|
|
942
|
-
list = async (
|
|
943
|
-
|
|
1502
|
+
list = async (opts, page = 1) => {
|
|
1503
|
+
import_zod7.default.number().positive().parse(page);
|
|
944
1504
|
const { data } = await this.r.get("/users", {
|
|
945
1505
|
params: {
|
|
946
1506
|
include: opts.include?.join(","),
|
|
@@ -952,43 +1512,409 @@ var Users = class {
|
|
|
952
1512
|
return data.data.map((d) => d.attributes);
|
|
953
1513
|
};
|
|
954
1514
|
info = async (id, { include }) => {
|
|
955
|
-
|
|
1515
|
+
import_zod7.default.number().positive().parse(id);
|
|
956
1516
|
const { data } = await this.r.get(`/users/${id}`, {
|
|
957
1517
|
params: { include: include?.join(",") }
|
|
958
1518
|
});
|
|
959
1519
|
return data.attributes;
|
|
960
1520
|
};
|
|
961
1521
|
infoByExternal = async (external_id, { include }) => {
|
|
962
|
-
const { data } = await this.r.get(`/users/external/${external_id}
|
|
1522
|
+
const { data } = await this.r.get(`/users/external/${external_id}`, {
|
|
1523
|
+
params: { include: include?.join(",") }
|
|
1524
|
+
});
|
|
963
1525
|
return data.attributes;
|
|
964
1526
|
};
|
|
965
1527
|
create = async (user) => {
|
|
1528
|
+
user = CreateSchema.parse(user);
|
|
966
1529
|
const { data } = await this.r.post("/users", user);
|
|
967
1530
|
return data.attributes;
|
|
968
1531
|
};
|
|
969
1532
|
update = async (id, user) => {
|
|
970
|
-
|
|
971
|
-
const { data } = await this.r.
|
|
1533
|
+
user = CreateSchema.parse(user);
|
|
1534
|
+
const { data } = await this.r.patch(`/users/${id}`, user);
|
|
972
1535
|
return data.attributes;
|
|
973
1536
|
};
|
|
974
1537
|
delete = async (id) => {
|
|
975
|
-
|
|
1538
|
+
import_zod7.default.number().positive().parse(id);
|
|
976
1539
|
await this.r.delete(`/users/${id}`);
|
|
977
1540
|
};
|
|
1541
|
+
addRoles = async (id, roles) => {
|
|
1542
|
+
import_zod7.default.number().positive().parse(id);
|
|
1543
|
+
await this.r.patch(`/users/${id}/roles/assign`, { roles });
|
|
1544
|
+
};
|
|
1545
|
+
removeRoles = async (id, roles) => {
|
|
1546
|
+
import_zod7.default.number().positive().parse(id);
|
|
1547
|
+
await this.r.patch(`/users/${id}/roles/remove`, { roles });
|
|
1548
|
+
};
|
|
1549
|
+
};
|
|
1550
|
+
var CreateSchema = import_zod7.default.object({
|
|
1551
|
+
email: import_zod7.default.email(),
|
|
1552
|
+
external_id: import_zod7.default.string().max(255).optional(),
|
|
1553
|
+
username: import_zod7.default.string().min(1).max(255),
|
|
1554
|
+
password: import_zod7.default.string().optional(),
|
|
1555
|
+
language: languagesSchema,
|
|
1556
|
+
timezone: timezonesSchema
|
|
1557
|
+
});
|
|
1558
|
+
|
|
1559
|
+
// src/api/application/nodes_allocations.ts
|
|
1560
|
+
var import_zod8 = __toESM(require("zod"));
|
|
1561
|
+
var NodesAllocations = class {
|
|
1562
|
+
r;
|
|
1563
|
+
id;
|
|
1564
|
+
constructor(requester, id) {
|
|
1565
|
+
this.r = requester;
|
|
1566
|
+
this.id = id;
|
|
1567
|
+
}
|
|
1568
|
+
list = async (include) => {
|
|
1569
|
+
const { data } = await this.r.get(`/nodes/${this.id}/allocations`, {
|
|
1570
|
+
params: { include: include?.join(",") }
|
|
1571
|
+
});
|
|
1572
|
+
return data.data.map((d) => d.attributes);
|
|
1573
|
+
};
|
|
1574
|
+
create = async (ip, ports, alias) => {
|
|
1575
|
+
import_zod8.default.ipv4().parse(ip);
|
|
1576
|
+
import_zod8.default.ipv4().or(import_zod8.default.url().max(255)).optional().parse(alias);
|
|
1577
|
+
import_zod8.default.array(import_zod8.default.number()).or(import_zod8.default.string().regex(/\d+-\d+/)).parse(ports);
|
|
1578
|
+
await this.r.post(`/nodes/${this.id}/allocations`, {
|
|
1579
|
+
ip,
|
|
1580
|
+
ports,
|
|
1581
|
+
alias
|
|
1582
|
+
});
|
|
1583
|
+
};
|
|
1584
|
+
delete = async (alloc_id) => {
|
|
1585
|
+
await this.r.delete(`/nodes/${this.id}/allocations/${alloc_id}`);
|
|
1586
|
+
};
|
|
1587
|
+
};
|
|
1588
|
+
|
|
1589
|
+
// src/api/application/nodes.ts
|
|
1590
|
+
var import_zod9 = __toESM(require("zod"));
|
|
1591
|
+
var Nodes = class {
|
|
1592
|
+
r;
|
|
1593
|
+
constructor(requester) {
|
|
1594
|
+
this.r = requester;
|
|
1595
|
+
}
|
|
1596
|
+
list = async (include, page = 1) => {
|
|
1597
|
+
import_zod9.default.number().positive().parse(page);
|
|
1598
|
+
const { data } = await this.r.get("/nodes", {
|
|
1599
|
+
params: { include: include?.join(","), page }
|
|
1600
|
+
});
|
|
1601
|
+
return data.data.map((s) => s.attributes);
|
|
1602
|
+
};
|
|
1603
|
+
listDeployable = async (filters, include, page = 1) => {
|
|
1604
|
+
import_zod9.default.number().positive().parse(page);
|
|
1605
|
+
const { data } = await this.r.get("/nodes/deployable", {
|
|
1606
|
+
params: {
|
|
1607
|
+
include: include?.join(","),
|
|
1608
|
+
disk: filters.disk,
|
|
1609
|
+
memory: filters.memory,
|
|
1610
|
+
cpu: filters.cpu,
|
|
1611
|
+
location_ids: filters.location_ids,
|
|
1612
|
+
tags: filters.tags,
|
|
1613
|
+
page
|
|
1614
|
+
}
|
|
1615
|
+
});
|
|
1616
|
+
return data.data.map((s) => s.attributes);
|
|
1617
|
+
};
|
|
1618
|
+
info = async (id, include) => {
|
|
1619
|
+
import_zod9.default.number().positive().parse(id);
|
|
1620
|
+
const { data } = await this.r.get(`/nodes/${id}`, {
|
|
1621
|
+
params: { include: include?.join(",") }
|
|
1622
|
+
});
|
|
1623
|
+
return data.attributes;
|
|
1624
|
+
};
|
|
1625
|
+
create = async (node) => {
|
|
1626
|
+
node = NodeCreateSchema.parse(node);
|
|
1627
|
+
const { data } = await this.r.post("/nodes", node);
|
|
1628
|
+
return data.attributes;
|
|
1629
|
+
};
|
|
1630
|
+
get_configuration = async (id) => {
|
|
1631
|
+
import_zod9.default.number().positive().parse(id);
|
|
1632
|
+
const { data } = await this.r.get(`/nodes/${id}/configuration`);
|
|
1633
|
+
return data;
|
|
1634
|
+
};
|
|
1635
|
+
update = async (id, node) => {
|
|
1636
|
+
import_zod9.default.number().positive().parse(id);
|
|
1637
|
+
node = NodeCreateSchema.parse(node);
|
|
1638
|
+
const { data } = await this.r.patch(`/nodes/${id}`, node);
|
|
1639
|
+
return data.attributes;
|
|
1640
|
+
};
|
|
1641
|
+
delete = async (id) => {
|
|
1642
|
+
import_zod9.default.number().positive().parse(id);
|
|
1643
|
+
await this.r.delete(`/nodes/${id}`);
|
|
1644
|
+
};
|
|
1645
|
+
allocations = (server_id) => new NodesAllocations(this.r, server_id);
|
|
1646
|
+
};
|
|
1647
|
+
var NodeCreateSchema = import_zod9.default.object({
|
|
1648
|
+
name: import_zod9.default.string().min(1).max(100),
|
|
1649
|
+
description: import_zod9.default.string().optional(),
|
|
1650
|
+
public: import_zod9.default.boolean().optional(),
|
|
1651
|
+
fqdn: import_zod9.default.string().nonempty(),
|
|
1652
|
+
scheme: import_zod9.default.enum(["http", "https"]),
|
|
1653
|
+
behind_proxy: import_zod9.default.boolean().optional(),
|
|
1654
|
+
memory: import_zod9.default.number().min(0),
|
|
1655
|
+
memory_overallocate: import_zod9.default.number().min(-1),
|
|
1656
|
+
disk: import_zod9.default.number().min(0),
|
|
1657
|
+
disk_overallocate: import_zod9.default.number().min(-1),
|
|
1658
|
+
cpu: import_zod9.default.number().min(0),
|
|
1659
|
+
cpu_overallocate: import_zod9.default.number().min(-1),
|
|
1660
|
+
daemon_base: import_zod9.default.string().nonempty().optional(),
|
|
1661
|
+
daemon_sftp: import_zod9.default.number().min(1).max(65535),
|
|
1662
|
+
daemon_sftp_alias: import_zod9.default.string().optional(),
|
|
1663
|
+
daemon_listen: import_zod9.default.number().min(1).max(65535),
|
|
1664
|
+
daemon_connect: import_zod9.default.number().min(1).max(65535),
|
|
1665
|
+
maintenance_mode: import_zod9.default.boolean().optional(),
|
|
1666
|
+
upload_size: import_zod9.default.number().min(1).max(1024),
|
|
1667
|
+
tags: import_zod9.default.array(import_zod9.default.string()).optional()
|
|
1668
|
+
});
|
|
1669
|
+
|
|
1670
|
+
// src/api/application/servers.ts
|
|
1671
|
+
var import_zod11 = __toESM(require("zod"));
|
|
1672
|
+
|
|
1673
|
+
// src/api/application/servers_databases.ts
|
|
1674
|
+
var import_zod10 = __toESM(require("zod"));
|
|
1675
|
+
var ServersDatabases = class {
|
|
1676
|
+
r;
|
|
1677
|
+
id;
|
|
1678
|
+
constructor(r, server_id) {
|
|
1679
|
+
this.r = r;
|
|
1680
|
+
this.id = server_id;
|
|
1681
|
+
}
|
|
1682
|
+
list = async () => {
|
|
1683
|
+
const { data } = await this.r.get(`/servers/${this.id}/databases`);
|
|
1684
|
+
return data.data.map((d) => d.attributes);
|
|
1685
|
+
};
|
|
1686
|
+
create = async (database, remote, host) => {
|
|
1687
|
+
database = import_zod10.default.string().min(1).max(48).parse(database);
|
|
1688
|
+
const { data } = await this.r.post(`/servers/${this.id}/databases`, { database, remote, host });
|
|
1689
|
+
return data.attributes;
|
|
1690
|
+
};
|
|
1691
|
+
info = async (database_id) => {
|
|
1692
|
+
const { data } = await this.r.get(`/servers/${this.id}/databases/${database_id}`);
|
|
1693
|
+
return data.attributes;
|
|
1694
|
+
};
|
|
1695
|
+
delete = async (database_id) => {
|
|
1696
|
+
await this.r.delete(`/servers/${this.id}/databases/${database_id}`);
|
|
1697
|
+
};
|
|
1698
|
+
resetPassword = async (database_id) => {
|
|
1699
|
+
await this.r.post(`/servers/${this.id}/databases/${database_id}/reset-password`);
|
|
1700
|
+
};
|
|
1701
|
+
};
|
|
1702
|
+
|
|
1703
|
+
// src/api/application/servers.ts
|
|
1704
|
+
var Servers = class {
|
|
1705
|
+
r;
|
|
1706
|
+
id;
|
|
1707
|
+
databases;
|
|
1708
|
+
constructor(r, server_id) {
|
|
1709
|
+
this.r = r;
|
|
1710
|
+
this.id = server_id;
|
|
1711
|
+
this.databases = new ServersDatabases(this.r, this.id);
|
|
1712
|
+
}
|
|
1713
|
+
info = async (include) => {
|
|
1714
|
+
const { data } = await this.r.get(`/servers/${this.id}`, {
|
|
1715
|
+
params: { include: include?.join(",") }
|
|
1716
|
+
});
|
|
1717
|
+
return data.attributes;
|
|
1718
|
+
};
|
|
1719
|
+
delete = async (force = false) => {
|
|
1720
|
+
await this.r.delete(`/servers/${this.id}${force ? "/force" : ""}`);
|
|
1721
|
+
};
|
|
1722
|
+
updateDetails = async (opts) => {
|
|
1723
|
+
opts = UpdateDetailsSchema.parse(opts);
|
|
1724
|
+
await this.r.patch(`/servers/${this.id}/details`, opts);
|
|
1725
|
+
};
|
|
1726
|
+
updateBuild = async (opts) => {
|
|
1727
|
+
opts = UpdateBuildSchema.parse(opts);
|
|
1728
|
+
await this.r.patch(`/servers/${this.id}/build`, opts);
|
|
1729
|
+
};
|
|
1730
|
+
updateStartup = async (opts) => {
|
|
1731
|
+
opts = UpdateStartupSchema.parse(opts);
|
|
1732
|
+
await this.r.patch(`/servers/${this.id}/startup`, opts);
|
|
1733
|
+
};
|
|
1734
|
+
suspend = async () => {
|
|
1735
|
+
await this.r.post(`/servers/${this.id}/suspend`);
|
|
1736
|
+
};
|
|
1737
|
+
unsuspend = async () => {
|
|
1738
|
+
await this.r.post(`/servers/${this.id}/unsuspend`);
|
|
1739
|
+
};
|
|
1740
|
+
reinstall = async () => {
|
|
1741
|
+
await this.r.post(`/servers/${this.id}/reinstall`);
|
|
1742
|
+
};
|
|
1743
|
+
transferStart = async (node_id, allocation_id, allocation_additional) => {
|
|
1744
|
+
await this.r.post(`/servers/${this.id}/transfer`, {
|
|
1745
|
+
node_id,
|
|
1746
|
+
allocation_id,
|
|
1747
|
+
allocation_additional
|
|
1748
|
+
});
|
|
1749
|
+
};
|
|
1750
|
+
transferCancel = async () => {
|
|
1751
|
+
await this.r.post(`/servers/${this.id}/transfer/cancel`);
|
|
1752
|
+
};
|
|
1753
|
+
};
|
|
1754
|
+
var CreateServerSchema = import_zod11.default.object({
|
|
1755
|
+
external_id: import_zod11.default.string().min(1).max(255).optional(),
|
|
1756
|
+
name: import_zod11.default.string().min(1).max(255),
|
|
1757
|
+
description: import_zod11.default.string().optional(),
|
|
1758
|
+
user: import_zod11.default.number(),
|
|
1759
|
+
egg: import_zod11.default.number(),
|
|
1760
|
+
docker_image: import_zod11.default.string().optional(),
|
|
1761
|
+
startup: import_zod11.default.string().optional(),
|
|
1762
|
+
environment: import_zod11.default.array(import_zod11.default.string()),
|
|
1763
|
+
skip_scripts: import_zod11.default.boolean().optional(),
|
|
1764
|
+
oom_killer: import_zod11.default.boolean().optional(),
|
|
1765
|
+
start_on_completion: import_zod11.default.boolean().optional(),
|
|
1766
|
+
limits: import_zod11.default.object({
|
|
1767
|
+
memory: import_zod11.default.number().min(0),
|
|
1768
|
+
swap: import_zod11.default.number().min(-1),
|
|
1769
|
+
disk: import_zod11.default.number().min(0),
|
|
1770
|
+
io: import_zod11.default.number().min(0),
|
|
1771
|
+
threads: import_zod11.default.string().optional(),
|
|
1772
|
+
cpu: import_zod11.default.number().min(0)
|
|
1773
|
+
}),
|
|
1774
|
+
feature_limits: import_zod11.default.object({
|
|
1775
|
+
databases: import_zod11.default.number().min(0),
|
|
1776
|
+
allocations: import_zod11.default.number().min(0),
|
|
1777
|
+
backups: import_zod11.default.number().min(0)
|
|
1778
|
+
}),
|
|
1779
|
+
allocation: import_zod11.default.object({
|
|
1780
|
+
default: import_zod11.default.string(),
|
|
1781
|
+
additional: import_zod11.default.array(import_zod11.default.string()).optional()
|
|
1782
|
+
}).optional(),
|
|
1783
|
+
deploy: import_zod11.default.object({
|
|
1784
|
+
tags: import_zod11.default.array(import_zod11.default.string()).optional(),
|
|
1785
|
+
dedicated_ip: import_zod11.default.boolean().optional(),
|
|
1786
|
+
port_range: import_zod11.default.array(import_zod11.default.string()).optional()
|
|
1787
|
+
}).optional()
|
|
1788
|
+
});
|
|
1789
|
+
var UpdateDetailsSchema = CreateServerSchema.pick({
|
|
1790
|
+
external_id: true,
|
|
1791
|
+
name: true,
|
|
1792
|
+
user: true,
|
|
1793
|
+
description: true
|
|
1794
|
+
});
|
|
1795
|
+
var UpdateBuildSchema = CreateServerSchema.pick({
|
|
1796
|
+
oom_killer: true,
|
|
1797
|
+
limits: true,
|
|
1798
|
+
feature_limits: true
|
|
1799
|
+
}).extend({
|
|
1800
|
+
allocation: import_zod11.default.number().optional(),
|
|
1801
|
+
add_allocations: import_zod11.default.array(import_zod11.default.string()).optional(),
|
|
1802
|
+
remove_allocations: import_zod11.default.array(import_zod11.default.string()).optional()
|
|
1803
|
+
});
|
|
1804
|
+
var UpdateStartupSchema = CreateServerSchema.pick({
|
|
1805
|
+
startup: true,
|
|
1806
|
+
environment: true,
|
|
1807
|
+
egg: true,
|
|
1808
|
+
skip_scripts: true
|
|
1809
|
+
}).extend({
|
|
1810
|
+
image: import_zod11.default.string().optional()
|
|
1811
|
+
});
|
|
1812
|
+
|
|
1813
|
+
// src/api/application/database_hosts.ts
|
|
1814
|
+
var import_zod12 = __toESM(require("zod"));
|
|
1815
|
+
var DatabaseHosts = class {
|
|
1816
|
+
r;
|
|
1817
|
+
constructor(r) {
|
|
1818
|
+
this.r = r;
|
|
1819
|
+
}
|
|
1820
|
+
list = async (page = 1) => {
|
|
1821
|
+
const { data } = await this.r.get("/database-hosts", {
|
|
1822
|
+
params: { page }
|
|
1823
|
+
});
|
|
1824
|
+
return data.data.map((d) => d.attributes);
|
|
1825
|
+
};
|
|
1826
|
+
info = async (id) => {
|
|
1827
|
+
const { data } = await this.r.get(`/database-hosts/${id}`);
|
|
1828
|
+
return data.attributes;
|
|
1829
|
+
};
|
|
1830
|
+
// TODO: find out why API returns 500
|
|
1831
|
+
create = async (opts) => {
|
|
1832
|
+
opts = CreateDBHostSchema.parse(opts);
|
|
1833
|
+
await this.r.post("/database-hosts", opts).catch((e) => {
|
|
1834
|
+
});
|
|
1835
|
+
};
|
|
1836
|
+
update = async (id, opts) => {
|
|
1837
|
+
opts = CreateDBHostSchema.parse(opts);
|
|
1838
|
+
const { data } = await this.r.patch(`/database-hosts/${id}`, opts);
|
|
1839
|
+
return data.attributes;
|
|
1840
|
+
};
|
|
1841
|
+
delete = async (id) => {
|
|
1842
|
+
await this.r.delete(`/database-hosts/${id}`);
|
|
1843
|
+
};
|
|
1844
|
+
};
|
|
1845
|
+
var CreateDBHostSchema = import_zod12.default.object({
|
|
1846
|
+
name: import_zod12.default.string().min(1).max(255),
|
|
1847
|
+
host: import_zod12.default.string(),
|
|
1848
|
+
port: import_zod12.default.number().min(1).max(65535),
|
|
1849
|
+
username: import_zod12.default.string().min(1).max(255),
|
|
1850
|
+
password: import_zod12.default.string().optional(),
|
|
1851
|
+
node_ids: import_zod12.default.array(import_zod12.default.string()).optional(),
|
|
1852
|
+
max_databases: import_zod12.default.number().optional()
|
|
1853
|
+
});
|
|
1854
|
+
|
|
1855
|
+
// src/api/application/roles.ts
|
|
1856
|
+
var Roles = class {
|
|
1857
|
+
r;
|
|
1858
|
+
constructor(r) {
|
|
1859
|
+
this.r = r;
|
|
1860
|
+
}
|
|
1861
|
+
list = async (page = 1) => {
|
|
1862
|
+
const { data } = await this.r.get(`/roles`, {
|
|
1863
|
+
params: { page }
|
|
1864
|
+
});
|
|
1865
|
+
return data.data.map((r) => r.attributes);
|
|
1866
|
+
};
|
|
1867
|
+
info = async (id) => {
|
|
1868
|
+
const { data } = await this.r.get(`/roles/${id}`);
|
|
1869
|
+
return data.attributes;
|
|
1870
|
+
};
|
|
1871
|
+
create = async (opts) => {
|
|
1872
|
+
await this.r.post(`/roles`, opts);
|
|
1873
|
+
};
|
|
1874
|
+
update = async (id, opts) => {
|
|
1875
|
+
await this.r.patch(`/roles/${id}`, opts);
|
|
1876
|
+
};
|
|
1877
|
+
delete = async (id) => {
|
|
1878
|
+
await this.r.delete(`/roles/${id}`);
|
|
1879
|
+
};
|
|
978
1880
|
};
|
|
979
1881
|
|
|
980
1882
|
// src/api/application/client.ts
|
|
981
1883
|
var Client2 = class {
|
|
982
1884
|
r;
|
|
983
1885
|
users;
|
|
1886
|
+
nodes;
|
|
1887
|
+
databaseHosts;
|
|
1888
|
+
roles;
|
|
984
1889
|
constructor(requester) {
|
|
985
1890
|
this.r = requester;
|
|
986
1891
|
this.users = new Users(requester);
|
|
1892
|
+
this.nodes = new Nodes(requester);
|
|
1893
|
+
this.databaseHosts = new DatabaseHosts(requester);
|
|
1894
|
+
this.roles = new Roles(requester);
|
|
987
1895
|
}
|
|
1896
|
+
listServers = async (search, page = 1) => {
|
|
1897
|
+
const { data } = await this.r.get("/servers", {
|
|
1898
|
+
params: { search, page }
|
|
1899
|
+
});
|
|
1900
|
+
return data.data.map((s) => s.attributes);
|
|
1901
|
+
};
|
|
1902
|
+
createServer = async (opts) => {
|
|
1903
|
+
opts = CreateServerSchema.parse(opts);
|
|
1904
|
+
const { data } = await this.r.post("/servers", opts);
|
|
1905
|
+
return data.attributes;
|
|
1906
|
+
};
|
|
1907
|
+
getServerByExternalId = async (external_id, include) => {
|
|
1908
|
+
const { data } = await this.r.get(`/servers/external/${external_id}`, {
|
|
1909
|
+
params: { include: include?.join(",") }
|
|
1910
|
+
});
|
|
1911
|
+
return data.attributes;
|
|
1912
|
+
};
|
|
1913
|
+
servers = (server_id) => new Servers(this.r, server_id);
|
|
988
1914
|
};
|
|
989
1915
|
|
|
990
1916
|
// src/api/base/request.ts
|
|
991
|
-
var
|
|
1917
|
+
var import_zod13 = __toESM(require("zod"));
|
|
992
1918
|
var import_axios3 = __toESM(require("axios"));
|
|
993
1919
|
|
|
994
1920
|
// src/api/base/types.ts
|
|
@@ -1007,11 +1933,11 @@ var Agent = class {
|
|
|
1007
1933
|
base_url;
|
|
1008
1934
|
token;
|
|
1009
1935
|
requester;
|
|
1010
|
-
constructor(url, token, type) {
|
|
1011
|
-
this.base_url =
|
|
1012
|
-
this.token =
|
|
1936
|
+
constructor(url, token, type, suffix = "/api") {
|
|
1937
|
+
this.base_url = import_zod13.default.url("Invalid URL Schema").transform((url2) => new URL(url2).href).parse(url);
|
|
1938
|
+
this.token = import_zod13.default.string().regex(/^(ptl[ac]|pacc|papp)_.+$/, "Invalid token type").parse(token);
|
|
1013
1939
|
this.requester = import_axios3.default.create({
|
|
1014
|
-
baseURL: this.base_url.replace(/\/+$/, "") +
|
|
1940
|
+
baseURL: this.base_url.replace(/\/+$/, "") + `${suffix}/${type}`,
|
|
1015
1941
|
timeout: 3e3,
|
|
1016
1942
|
headers: {
|
|
1017
1943
|
Authorization: `Bearer ${this.token}`
|
|
@@ -1032,14 +1958,14 @@ var Agent = class {
|
|
|
1032
1958
|
|
|
1033
1959
|
// src/index.ts
|
|
1034
1960
|
var PelicanClient = class extends Client {
|
|
1035
|
-
constructor(url, token) {
|
|
1036
|
-
const ax = new Agent(url, token, "client");
|
|
1961
|
+
constructor(url, token, suffix = "/api") {
|
|
1962
|
+
const ax = new Agent(url, token, "client", suffix);
|
|
1037
1963
|
super(ax.requester);
|
|
1038
1964
|
}
|
|
1039
1965
|
};
|
|
1040
1966
|
var PelicanApplication = class extends Client2 {
|
|
1041
|
-
constructor(url, token) {
|
|
1042
|
-
const ax = new Agent(url, token, "application");
|
|
1967
|
+
constructor(url, token, suffix = "/api") {
|
|
1968
|
+
const ax = new Agent(url, token, "application", suffix);
|
|
1043
1969
|
super(ax.requester);
|
|
1044
1970
|
}
|
|
1045
1971
|
};
|