@pelican.ts/sdk 0.4.8 → 0.4.10
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/.husky/pre-commit +2 -3
- package/biome.json +42 -32
- package/bun.lock +3 -0
- package/dist/api/index.d.mts +5 -5
- package/dist/api/index.d.ts +5 -5
- package/dist/api/index.js +168 -102
- package/dist/api/index.mjs +168 -102
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +124 -70
- package/dist/index.mjs +124 -70
- package/dist/types.d.ts +1 -1
- package/package.json +60 -59
- package/scripts/create-types.ts +4 -4
- package/src/api/application/client.ts +26 -19
- package/src/api/application/database_hosts.ts +15 -20
- package/src/api/application/eggs.ts +14 -7
- package/src/api/application/mounts.ts +29 -16
- package/src/api/application/nodes.ts +34 -32
- package/src/api/application/nodes_allocations.ts +15 -11
- package/src/api/application/roles.ts +13 -27
- package/src/api/application/servers.ts +36 -27
- package/src/api/application/servers_databases.ts +11 -7
- package/src/api/application/types/container.ts +7 -8
- package/src/api/application/types/database_host.ts +8 -8
- package/src/api/application/types/egg.ts +47 -54
- package/src/api/application/types/location.ts +5 -7
- package/src/api/application/types/mount.ts +9 -9
- package/src/api/application/types/node.ts +49 -59
- package/src/api/application/types/role.ts +4 -6
- package/src/api/application/types/server.ts +21 -22
- package/src/api/application/types/server_allocation.ts +11 -12
- package/src/api/application/types/user.ts +25 -25
- package/src/api/application/users.ts +38 -27
- package/src/api/base/request.ts +28 -17
- package/src/api/base/types.ts +16 -23
- package/src/api/client/account.ts +20 -15
- package/src/api/client/client.ts +17 -18
- package/src/api/client/server.ts +24 -20
- package/src/api/client/server_activity.ts +10 -11
- package/src/api/client/server_allocations.ts +11 -6
- package/src/api/client/server_backups.ts +21 -17
- package/src/api/client/server_databases.ts +14 -8
- package/src/api/client/server_files.ts +56 -42
- package/src/api/client/server_schedules.ts +43 -19
- package/src/api/client/server_settings.ts +11 -8
- package/src/api/client/server_startup.ts +16 -8
- package/src/api/client/server_users.ts +22 -13
- package/src/api/client/server_websocket.ts +79 -33
- package/src/api/client/types/server.ts +8 -18
- package/src/api/client/types/server_allocation.ts +7 -8
- package/src/api/client/types/server_subuser.ts +10 -11
- package/src/api/client/types/user.ts +2 -5
- package/src/api/client/types/websocket.ts +12 -24
- package/src/api/common/types/egg.ts +7 -7
- package/src/api/common/types/enums.ts +1 -1
- package/src/api/common/types/server_backup.ts +4 -5
- package/src/api/common/types/server_database.ts +9 -12
- package/src/api/common/types/server_files.ts +9 -9
- package/src/api/common/types/server_limits.ts +11 -12
- package/src/api/common/types/server_power.ts +1 -1
- package/src/api/common/types/server_schedule.ts +27 -25
- package/src/api/common/types/server_startup.ts +7 -12
- package/src/api/index.ts +3 -3
- package/src/humane/Account.ts +2 -2
- package/src/humane/Client.ts +6 -6
- package/src/humane/Server.ts +31 -43
- package/src/humane/ServerAllocation.ts +3 -3
- package/src/humane/ServerBackup.ts +6 -9
- package/src/humane/ServerDatabase.ts +2 -2
- package/src/humane/ServerFile.ts +17 -11
- package/src/humane/ServerSchedule.ts +6 -6
- package/src/humane/ServerUser.ts +2 -2
- package/src/index.ts +3 -3
- package/src/utils/sized.ts +1 -1
- package/src/utils/transform.ts +5 -10
- package/src/utils/types.ts +6 -8
- package/tsconfig.json +0 -1
package/src/humane/ServerUser.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import {PelicanAPIClient} from "@/api"
|
|
2
|
+
import {Client as UserClient} from "@/humane/Client"
|
|
3
3
|
|
|
4
4
|
export const createPelicanClient = (
|
|
5
5
|
url: string,
|
|
6
6
|
token: string,
|
|
7
|
-
suffix: string = "/api"
|
|
7
|
+
suffix: string = "/api"
|
|
8
8
|
) => {
|
|
9
9
|
const client = new PelicanAPIClient(url, token, suffix)
|
|
10
10
|
return new UserClient(client)
|
package/src/utils/sized.ts
CHANGED
package/src/utils/transform.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import {string} from "zod"
|
|
2
|
-
|
|
1
|
+
import {string} from "zod"
|
|
3
2
|
|
|
4
3
|
export const ArrayQueryParams = (p: {
|
|
5
|
-
[key: string]: {
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
}): {
|
|
9
|
-
[key: string]: string
|
|
10
|
-
} => {
|
|
4
|
+
[key: string]: {[key: string]: string}
|
|
5
|
+
}): {[key: string]: string} => {
|
|
11
6
|
const params = new URLSearchParams()
|
|
12
7
|
|
|
13
8
|
const o: ReturnType<typeof ArrayQueryParams> = {}
|
|
@@ -22,5 +17,5 @@ export const ArrayQueryParams = (p: {
|
|
|
22
17
|
}
|
|
23
18
|
|
|
24
19
|
export const SortParam = (key: string, p: "asc" | "desc"): string => {
|
|
25
|
-
return `${p==="desc" ? "-" : ""}${key}`
|
|
26
|
-
}
|
|
20
|
+
return `${p === "desc" ? "-" : ""}${key}`
|
|
21
|
+
}
|
package/src/utils/types.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}[K];
|
|
1
|
+
export type ExactlyOneKey<K extends keyof any, V, KK extends keyof any = K> = {
|
|
2
|
+
[P in K]: {[Q in P]: V} & {[Q in Exclude<KK, P>]?: never} extends infer O
|
|
3
|
+
? {[Q in keyof O]: O[Q]}
|
|
4
|
+
: never
|
|
5
|
+
}[K]
|
|
7
6
|
|
|
8
7
|
export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>
|
|
9
8
|
|
|
10
|
-
|
|
11
9
|
export type Maybe<T> = T | null | undefined
|
|
12
|
-
export type Nullable<T> = T | null
|
|
10
|
+
export type Nullable<T> = T | null
|