@pelican.ts/sdk 0.4.1 → 0.4.3
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 +2 -1
- package/dist/api/index.mjs +2 -1
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +7 -7
- package/dist/index.mjs +7 -7
- package/package.json +1 -1
- package/src/api/client/server_files.ts +5 -2
- package/src/humane/Server.ts +4 -0
- package/src/humane/ServerFile.ts +4 -7
package/dist/api/index.d.mts
CHANGED
|
@@ -261,7 +261,7 @@ declare class ServerFiles {
|
|
|
261
261
|
}[]) => Promise<void>;
|
|
262
262
|
copy: (location: string) => Promise<void>;
|
|
263
263
|
write: (path: string, content: string) => Promise<void>;
|
|
264
|
-
compress: (root: string | undefined, files: string[], archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<
|
|
264
|
+
compress: (root: string | undefined, files: string[], archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<FileObject>;
|
|
265
265
|
decompress: (root: string | undefined, file: string) => Promise<void>;
|
|
266
266
|
delete: (root: string | undefined, files: string[]) => Promise<void>;
|
|
267
267
|
createFolder: (root: string | undefined, name: string) => Promise<void>;
|
package/dist/api/index.d.ts
CHANGED
|
@@ -261,7 +261,7 @@ declare class ServerFiles {
|
|
|
261
261
|
}[]) => Promise<void>;
|
|
262
262
|
copy: (location: string) => Promise<void>;
|
|
263
263
|
write: (path: string, content: string) => Promise<void>;
|
|
264
|
-
compress: (root: string | undefined, files: string[], archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<
|
|
264
|
+
compress: (root: string | undefined, files: string[], archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<FileObject>;
|
|
265
265
|
decompress: (root: string | undefined, file: string) => Promise<void>;
|
|
266
266
|
delete: (root: string | undefined, files: string[]) => Promise<void>;
|
|
267
267
|
createFolder: (root: string | undefined, name: string) => Promise<void>;
|
package/dist/api/index.js
CHANGED
|
@@ -178,7 +178,8 @@ var ServerFiles = class {
|
|
|
178
178
|
});
|
|
179
179
|
};
|
|
180
180
|
compress = async (root = "/", files, archive_name, extension) => {
|
|
181
|
-
await this.r.post(`/servers/${this.id}/files/compress`, { root, files, archive_name, extension });
|
|
181
|
+
const { data } = await this.r.post(`/servers/${this.id}/files/compress`, { root, files, archive_name, extension });
|
|
182
|
+
return data.attributes;
|
|
182
183
|
};
|
|
183
184
|
decompress = async (root = "/", file) => {
|
|
184
185
|
await this.r.post(`/servers/${this.id}/files/decompress`, { root, file });
|
package/dist/api/index.mjs
CHANGED
|
@@ -141,7 +141,8 @@ var ServerFiles = class {
|
|
|
141
141
|
});
|
|
142
142
|
};
|
|
143
143
|
compress = async (root = "/", files, archive_name, extension) => {
|
|
144
|
-
await this.r.post(`/servers/${this.id}/files/compress`, { root, files, archive_name, extension });
|
|
144
|
+
const { data } = await this.r.post(`/servers/${this.id}/files/compress`, { root, files, archive_name, extension });
|
|
145
|
+
return data.attributes;
|
|
145
146
|
};
|
|
146
147
|
decompress = async (root = "/", file) => {
|
|
147
148
|
await this.r.post(`/servers/${this.id}/files/decompress`, { root, file });
|
package/dist/index.d.mts
CHANGED
|
@@ -408,7 +408,7 @@ declare class ServerFiles {
|
|
|
408
408
|
}[]) => Promise<void>;
|
|
409
409
|
copy: (location: string) => Promise<void>;
|
|
410
410
|
write: (path: string, content: string) => Promise<void>;
|
|
411
|
-
compress: (root: string | undefined, files: string[], archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<
|
|
411
|
+
compress: (root: string | undefined, files: string[], archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<FileObject>;
|
|
412
412
|
decompress: (root: string | undefined, file: string) => Promise<void>;
|
|
413
413
|
delete: (root: string | undefined, files: string[]) => Promise<void>;
|
|
414
414
|
createFolder: (root: string | undefined, name: string) => Promise<void>;
|
|
@@ -658,7 +658,7 @@ declare class ServerFile {
|
|
|
658
658
|
rename: (newName: string) => Promise<void>;
|
|
659
659
|
copy: () => Promise<void>;
|
|
660
660
|
write: (content: string) => Promise<void>;
|
|
661
|
-
compress: (archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<
|
|
661
|
+
compress: (archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<ServerFile>;
|
|
662
662
|
decompress: () => Promise<void>;
|
|
663
663
|
delete: () => Promise<void>;
|
|
664
664
|
chmod: (mode: number) => Promise<void>;
|
|
@@ -807,6 +807,7 @@ declare class Server {
|
|
|
807
807
|
uploadFile: (...opts: Parameters<ServerFiles["upload"]>) => Promise<void>;
|
|
808
808
|
uploadFileGetUrl: (...opts: Parameters<ServerFiles["uploadGetUrl"]>) => Promise<string>;
|
|
809
809
|
pullFileFromRemote: (...opts: Parameters<ServerFiles["pullFromRemote"]>) => Promise<void>;
|
|
810
|
+
compressMultipleFiles: (...opts: Parameters<ServerFiles["compress"]>) => Promise<FileObject>;
|
|
810
811
|
getUsers: () => Promise<ServerUser[]>;
|
|
811
812
|
createUser: (email: string, permissions: SubuserPermission[] | string[]) => Promise<ServerUser>;
|
|
812
813
|
getStartupInfo: () => Promise<CustomListResponse<StartupParams, StartupMeta>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -408,7 +408,7 @@ declare class ServerFiles {
|
|
|
408
408
|
}[]) => Promise<void>;
|
|
409
409
|
copy: (location: string) => Promise<void>;
|
|
410
410
|
write: (path: string, content: string) => Promise<void>;
|
|
411
|
-
compress: (root: string | undefined, files: string[], archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<
|
|
411
|
+
compress: (root: string | undefined, files: string[], archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<FileObject>;
|
|
412
412
|
decompress: (root: string | undefined, file: string) => Promise<void>;
|
|
413
413
|
delete: (root: string | undefined, files: string[]) => Promise<void>;
|
|
414
414
|
createFolder: (root: string | undefined, name: string) => Promise<void>;
|
|
@@ -658,7 +658,7 @@ declare class ServerFile {
|
|
|
658
658
|
rename: (newName: string) => Promise<void>;
|
|
659
659
|
copy: () => Promise<void>;
|
|
660
660
|
write: (content: string) => Promise<void>;
|
|
661
|
-
compress: (archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<
|
|
661
|
+
compress: (archive_name?: string, extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2") => Promise<ServerFile>;
|
|
662
662
|
decompress: () => Promise<void>;
|
|
663
663
|
delete: () => Promise<void>;
|
|
664
664
|
chmod: (mode: number) => Promise<void>;
|
|
@@ -807,6 +807,7 @@ declare class Server {
|
|
|
807
807
|
uploadFile: (...opts: Parameters<ServerFiles["upload"]>) => Promise<void>;
|
|
808
808
|
uploadFileGetUrl: (...opts: Parameters<ServerFiles["uploadGetUrl"]>) => Promise<string>;
|
|
809
809
|
pullFileFromRemote: (...opts: Parameters<ServerFiles["pullFromRemote"]>) => Promise<void>;
|
|
810
|
+
compressMultipleFiles: (...opts: Parameters<ServerFiles["compress"]>) => Promise<FileObject>;
|
|
810
811
|
getUsers: () => Promise<ServerUser[]>;
|
|
811
812
|
createUser: (email: string, permissions: SubuserPermission[] | string[]) => Promise<ServerUser>;
|
|
812
813
|
getStartupInfo: () => Promise<CustomListResponse<StartupParams, StartupMeta>>;
|
package/dist/index.js
CHANGED
|
@@ -186,7 +186,8 @@ var ServerFiles = class {
|
|
|
186
186
|
});
|
|
187
187
|
};
|
|
188
188
|
compress = async (root = "/", files, archive_name, extension) => {
|
|
189
|
-
await this.r.post(`/servers/${this.id}/files/compress`, { root, files, archive_name, extension });
|
|
189
|
+
const { data } = await this.r.post(`/servers/${this.id}/files/compress`, { root, files, archive_name, extension });
|
|
190
|
+
return data.attributes;
|
|
190
191
|
};
|
|
191
192
|
decompress = async (root = "/", file) => {
|
|
192
193
|
await this.r.post(`/servers/${this.id}/files/decompress`, { root, file });
|
|
@@ -1821,7 +1822,7 @@ var ServerDatabase = class {
|
|
|
1821
1822
|
|
|
1822
1823
|
// src/humane/ServerFile.ts
|
|
1823
1824
|
var import_node_path = __toESM(require("path"));
|
|
1824
|
-
var ServerFile = class {
|
|
1825
|
+
var ServerFile = class _ServerFile {
|
|
1825
1826
|
client;
|
|
1826
1827
|
dir;
|
|
1827
1828
|
path;
|
|
@@ -1868,11 +1869,9 @@ var ServerFile = class {
|
|
|
1868
1869
|
rename = async (newName) => this.client.files.rename(this.dir, [{ from: this.name, to: newName }]);
|
|
1869
1870
|
copy = async () => this.client.files.copy(this.path);
|
|
1870
1871
|
write = async (content) => this.client.files.write(this.path, content);
|
|
1871
|
-
compress = async (archive_name, extension) =>
|
|
1872
|
-
this.
|
|
1873
|
-
[this.name],
|
|
1874
|
-
archive_name,
|
|
1875
|
-
extension
|
|
1872
|
+
compress = async (archive_name, extension) => new _ServerFile(
|
|
1873
|
+
this.client,
|
|
1874
|
+
await this.client.files.compress(this.dir, [this.name], archive_name, extension)
|
|
1876
1875
|
);
|
|
1877
1876
|
decompress = async () => this.client.files.decompress(this.dir, this.name);
|
|
1878
1877
|
delete = async () => this.client.files.delete(this.dir, [this.name]);
|
|
@@ -2160,6 +2159,7 @@ var Server = class {
|
|
|
2160
2159
|
uploadFile = async (...opts) => this.client.files.upload(...opts);
|
|
2161
2160
|
uploadFileGetUrl = async (...opts) => this.client.files.uploadGetUrl(...opts);
|
|
2162
2161
|
pullFileFromRemote = async (...opts) => this.client.files.pullFromRemote(...opts);
|
|
2162
|
+
compressMultipleFiles = async (...opts) => this.client.files.compress(...opts);
|
|
2163
2163
|
getUsers = async () => {
|
|
2164
2164
|
const data = await this.client.users.list();
|
|
2165
2165
|
return data.map((d) => new ServerUser(this.client, d));
|
package/dist/index.mjs
CHANGED
|
@@ -141,7 +141,8 @@ var ServerFiles = class {
|
|
|
141
141
|
});
|
|
142
142
|
};
|
|
143
143
|
compress = async (root = "/", files, archive_name, extension) => {
|
|
144
|
-
await this.r.post(`/servers/${this.id}/files/compress`, { root, files, archive_name, extension });
|
|
144
|
+
const { data } = await this.r.post(`/servers/${this.id}/files/compress`, { root, files, archive_name, extension });
|
|
145
|
+
return data.attributes;
|
|
145
146
|
};
|
|
146
147
|
decompress = async (root = "/", file) => {
|
|
147
148
|
await this.r.post(`/servers/${this.id}/files/decompress`, { root, file });
|
|
@@ -1776,7 +1777,7 @@ var ServerDatabase = class {
|
|
|
1776
1777
|
|
|
1777
1778
|
// src/humane/ServerFile.ts
|
|
1778
1779
|
import path from "path";
|
|
1779
|
-
var ServerFile = class {
|
|
1780
|
+
var ServerFile = class _ServerFile {
|
|
1780
1781
|
client;
|
|
1781
1782
|
dir;
|
|
1782
1783
|
path;
|
|
@@ -1823,11 +1824,9 @@ var ServerFile = class {
|
|
|
1823
1824
|
rename = async (newName) => this.client.files.rename(this.dir, [{ from: this.name, to: newName }]);
|
|
1824
1825
|
copy = async () => this.client.files.copy(this.path);
|
|
1825
1826
|
write = async (content) => this.client.files.write(this.path, content);
|
|
1826
|
-
compress = async (archive_name, extension) =>
|
|
1827
|
-
this.
|
|
1828
|
-
[this.name],
|
|
1829
|
-
archive_name,
|
|
1830
|
-
extension
|
|
1827
|
+
compress = async (archive_name, extension) => new _ServerFile(
|
|
1828
|
+
this.client,
|
|
1829
|
+
await this.client.files.compress(this.dir, [this.name], archive_name, extension)
|
|
1831
1830
|
);
|
|
1832
1831
|
decompress = async () => this.client.files.decompress(this.dir, this.name);
|
|
1833
1832
|
delete = async () => this.client.files.delete(this.dir, [this.name]);
|
|
@@ -2115,6 +2114,7 @@ var Server = class {
|
|
|
2115
2114
|
uploadFile = async (...opts) => this.client.files.upload(...opts);
|
|
2116
2115
|
uploadFileGetUrl = async (...opts) => this.client.files.uploadGetUrl(...opts);
|
|
2117
2116
|
pullFileFromRemote = async (...opts) => this.client.files.pullFromRemote(...opts);
|
|
2117
|
+
compressMultipleFiles = async (...opts) => this.client.files.compress(...opts);
|
|
2118
2118
|
getUsers = async () => {
|
|
2119
2119
|
const data = await this.client.users.list();
|
|
2120
2120
|
return data.map((d) => new ServerUser(this.client, d));
|
package/package.json
CHANGED
|
@@ -69,8 +69,11 @@ export class ServerFiles {
|
|
|
69
69
|
files: string[],
|
|
70
70
|
archive_name?: string,
|
|
71
71
|
extension?: "zip" | "tgz" | "tar.gz" | "txz" | "tar.xz" | "tbz2" | "tar.bz2"
|
|
72
|
-
): Promise<
|
|
73
|
-
await this.r.post
|
|
72
|
+
): Promise<FileObject> => {
|
|
73
|
+
const {data} = await this.r.post<
|
|
74
|
+
GenericResponse<FileObject, "file_object">
|
|
75
|
+
>(`/servers/${this.id}/files/compress`, {root, files, archive_name, extension})
|
|
76
|
+
return data.attributes
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
decompress = async (
|
package/src/humane/Server.ts
CHANGED
|
@@ -186,6 +186,10 @@ export class Server {
|
|
|
186
186
|
...opts: Parameters<ServerFiles["pullFromRemote"]>
|
|
187
187
|
) => this.client.files.pullFromRemote(...opts)
|
|
188
188
|
|
|
189
|
+
compressMultipleFiles = async (
|
|
190
|
+
...opts: Parameters<ServerFiles["compress"]>
|
|
191
|
+
) => this.client.files.compress(...opts)
|
|
192
|
+
|
|
189
193
|
getUsers = async () => {
|
|
190
194
|
const data = await this.client.users.list()
|
|
191
195
|
return data.map((d) => new ServerUser(this.client, d))
|
package/src/humane/ServerFile.ts
CHANGED
|
@@ -71,13 +71,10 @@ export class ServerFile {
|
|
|
71
71
|
| "tar.xz"
|
|
72
72
|
| "tbz2"
|
|
73
73
|
| "tar.bz2",
|
|
74
|
-
) =>
|
|
75
|
-
this.client
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
archive_name,
|
|
79
|
-
extension,
|
|
80
|
-
)
|
|
74
|
+
) => new ServerFile(
|
|
75
|
+
this.client,
|
|
76
|
+
await this.client.files.compress(this.dir, [this.name], archive_name, extension)
|
|
77
|
+
)
|
|
81
78
|
|
|
82
79
|
decompress = async () => this.client.files.decompress(this.dir, this.name)
|
|
83
80
|
|