@heyputer/puter.js 2.1.10 → 2.1.15
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 +1 -1
- package/dist/puter.cjs +2 -2
- package/index.d.ts +2 -2
- package/package.json +4 -2
- package/src/index.js +1 -0
- package/src/modules/Perms.js +239 -0
- package/src/modules/UI.js +17 -12
- package/types/modules/ai.d.ts +143 -36
- package/types/modules/auth.d.ts +25 -11
- package/types/modules/filesystem.d.ts +83 -25
- package/types/modules/hosting.d.ts +8 -11
- package/types/modules/kv.d.ts +0 -5
- package/types/puter.d.ts +2 -2
|
@@ -7,37 +7,43 @@ export interface SpaceInfo {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export interface CopyOptions extends RequestCallbacks<FSItem> {
|
|
10
|
-
source
|
|
11
|
-
destination
|
|
10
|
+
source?: string;
|
|
11
|
+
destination?: string;
|
|
12
12
|
overwrite?: boolean;
|
|
13
13
|
newName?: string;
|
|
14
14
|
createMissingParents?: boolean;
|
|
15
15
|
dedupeName?: boolean;
|
|
16
16
|
newMetadata?: Record<string, unknown>;
|
|
17
17
|
excludeSocketID?: string;
|
|
18
|
+
original_client_socket_id?: string;
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export interface MoveOptions extends RequestCallbacks<FSItem> {
|
|
21
|
-
source
|
|
22
|
-
destination
|
|
22
|
+
source?: string;
|
|
23
|
+
destination?: string;
|
|
23
24
|
overwrite?: boolean;
|
|
24
25
|
newName?: string;
|
|
25
26
|
createMissingParents?: boolean;
|
|
26
27
|
newMetadata?: Record<string, unknown>;
|
|
27
28
|
excludeSocketID?: string;
|
|
29
|
+
original_client_socket_id?: string;
|
|
28
30
|
}
|
|
29
31
|
|
|
30
32
|
export interface MkdirOptions extends RequestCallbacks<FSItem> {
|
|
31
33
|
path?: string;
|
|
32
34
|
overwrite?: boolean;
|
|
33
35
|
dedupeName?: boolean;
|
|
36
|
+
rename?: boolean;
|
|
34
37
|
createMissingParents?: boolean;
|
|
38
|
+
recursive?: boolean;
|
|
39
|
+
shortcutTo?: string;
|
|
35
40
|
}
|
|
36
41
|
|
|
37
42
|
export interface DeleteOptions extends RequestCallbacks<void> {
|
|
38
|
-
|
|
43
|
+
paths?: string | string[];
|
|
39
44
|
recursive?: boolean;
|
|
40
45
|
descendantsOnly?: boolean;
|
|
46
|
+
descendants_only?: boolean;
|
|
41
47
|
}
|
|
42
48
|
|
|
43
49
|
export interface ReadOptions extends RequestCallbacks<Blob> {
|
|
@@ -57,24 +63,48 @@ export interface ReaddirOptions extends RequestCallbacks<FSItem[]> {
|
|
|
57
63
|
export interface RenameOptions extends RequestCallbacks<FSItem> {
|
|
58
64
|
uid?: string;
|
|
59
65
|
path?: string;
|
|
60
|
-
newName
|
|
66
|
+
newName?: string;
|
|
67
|
+
excludeSocketID?: string;
|
|
68
|
+
original_client_socket_id?: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface StatOptions extends RequestCallbacks<FSItem> {
|
|
72
|
+
path?: string;
|
|
73
|
+
uid?: string;
|
|
74
|
+
consistency?: 'strong' | 'eventual';
|
|
75
|
+
returnSubdomains?: boolean;
|
|
76
|
+
returnPermissions?: boolean;
|
|
77
|
+
returnVersions?: boolean;
|
|
78
|
+
returnSize?: boolean;
|
|
61
79
|
}
|
|
62
80
|
|
|
63
|
-
export interface UploadOptions extends RequestCallbacks<FSItem[]> {
|
|
81
|
+
export interface UploadOptions extends RequestCallbacks<FSItem | FSItem[]> {
|
|
64
82
|
overwrite?: boolean;
|
|
65
83
|
dedupeName?: boolean;
|
|
66
84
|
name?: string;
|
|
67
85
|
parsedDataTransferItems?: boolean;
|
|
68
86
|
createFileParent?: boolean;
|
|
87
|
+
createMissingAncestors?: boolean;
|
|
88
|
+
createMissingParents?: boolean;
|
|
89
|
+
shortcutTo?: string;
|
|
90
|
+
appUID?: string;
|
|
91
|
+
strict?: boolean;
|
|
69
92
|
init?: (operationId: string, xhr: XMLHttpRequest) => void;
|
|
70
|
-
|
|
93
|
+
start?: () => void;
|
|
94
|
+
progress?: (operationId: string, progress: number) => void;
|
|
95
|
+
abort?: (operationId: string) => void;
|
|
71
96
|
}
|
|
72
97
|
|
|
73
98
|
export interface WriteOptions extends RequestCallbacks<FSItem> {
|
|
74
99
|
overwrite?: boolean;
|
|
75
100
|
dedupeName?: boolean;
|
|
76
101
|
createMissingParents?: boolean;
|
|
102
|
+
createMissingAncestors?: boolean;
|
|
77
103
|
name?: string;
|
|
104
|
+
init?: (operationId: string, xhr: XMLHttpRequest) => void;
|
|
105
|
+
start?: () => void;
|
|
106
|
+
progress?: (operationId: string, progress: number) => void;
|
|
107
|
+
abort?: (operationId: string) => void;
|
|
78
108
|
}
|
|
79
109
|
|
|
80
110
|
export interface SignResult<T = Record<string, unknown>> {
|
|
@@ -82,23 +112,51 @@ export interface SignResult<T = Record<string, unknown>> {
|
|
|
82
112
|
items: T | T[];
|
|
83
113
|
}
|
|
84
114
|
|
|
85
|
-
export
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
space (
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
115
|
+
export type UploadItems = DataTransferItemList | DataTransferItem | FileList | File[] | Blob[] | Blob | File | string | unknown[];
|
|
116
|
+
|
|
117
|
+
export class FS {
|
|
118
|
+
space (): Promise<SpaceInfo>;
|
|
119
|
+
space (options: RequestCallbacks<SpaceInfo>): Promise<SpaceInfo>;
|
|
120
|
+
space (success: (value: SpaceInfo) => void, error?: (reason: unknown) => void): Promise<SpaceInfo>;
|
|
121
|
+
|
|
122
|
+
mkdir (options: MkdirOptions): Promise<FSItem>;
|
|
123
|
+
mkdir (path: string, options?: MkdirOptions): Promise<FSItem>;
|
|
124
|
+
mkdir (path: string, options: MkdirOptions, success: (value: FSItem) => void, error?: (reason: unknown) => void): Promise<FSItem>;
|
|
125
|
+
mkdir (path: string, success: (value: FSItem) => void, error?: (reason: unknown) => void): Promise<FSItem>;
|
|
126
|
+
|
|
127
|
+
copy (options: CopyOptions): Promise<FSItem>;
|
|
128
|
+
copy (source: string, destination: string, options?: CopyOptions): Promise<FSItem>;
|
|
129
|
+
copy (source: string, destination: string, options: CopyOptions | undefined, success: (value: FSItem) => void, error?: (reason: unknown) => void): Promise<FSItem>;
|
|
130
|
+
|
|
131
|
+
move (options: MoveOptions): Promise<FSItem>;
|
|
132
|
+
move (source: string, destination: string, options?: MoveOptions): Promise<FSItem>;
|
|
133
|
+
|
|
134
|
+
rename (options: RenameOptions): Promise<FSItem>;
|
|
135
|
+
rename (path: string, newName: string, success?: (value: FSItem) => void, error?: (reason: unknown) => void): Promise<FSItem>;
|
|
136
|
+
|
|
137
|
+
read (options: ReadOptions): Promise<Blob>;
|
|
138
|
+
read (path: string, options?: ReadOptions): Promise<Blob>;
|
|
139
|
+
read (path: string, success: (value: Blob) => void, error?: (reason: unknown) => void): Promise<Blob>;
|
|
140
|
+
|
|
141
|
+
readdir (options: ReaddirOptions): Promise<FSItem[]>;
|
|
142
|
+
readdir (path: string, success?: (value: FSItem[]) => void, error?: (reason: unknown) => void): Promise<FSItem[]>;
|
|
143
|
+
|
|
144
|
+
stat (options: StatOptions): Promise<FSItem>;
|
|
145
|
+
stat (path: string, options?: StatOptions): Promise<FSItem>;
|
|
146
|
+
stat (path: string, options: StatOptions, success: (value: FSItem) => void, error?: (reason: unknown) => void): Promise<FSItem>;
|
|
147
|
+
stat (path: string, success: (value: FSItem) => void, error?: (reason: unknown) => void): Promise<FSItem>;
|
|
148
|
+
|
|
149
|
+
delete (options: DeleteOptions): Promise<void>;
|
|
150
|
+
delete (paths: string | string[], options?: DeleteOptions): Promise<void>;
|
|
151
|
+
|
|
152
|
+
upload (items: UploadItems, dirPath?: string, options?: UploadOptions): Promise<FSItem | FSItem[]>;
|
|
153
|
+
|
|
154
|
+
write (file: File): Promise<FSItem>;
|
|
155
|
+
write (path: string, data: string | File | Blob | ArrayBuffer | ArrayBufferView, options?: WriteOptions): Promise<FSItem>;
|
|
156
|
+
|
|
97
157
|
sign (appUid: string, items: unknown | unknown[], success?: (result: SignResult) => void, error?: (reason: unknown) => void): Promise<SignResult>;
|
|
98
|
-
symlink (targetPath: string, linkPath: string, options?: Record<string, unknown>): Promise<FSItem>;
|
|
99
|
-
getReadURL (path: string, expiresIn?: number): Promise<string>;
|
|
100
|
-
readdir (pathOrOptions?: string | ReaddirOptions, options?: ReaddirOptions): Promise<FSItem[]>;
|
|
101
|
-
stat (pathOrUid: string, options?: Record<string, unknown>): Promise<FSItem>;
|
|
102
158
|
|
|
103
|
-
|
|
159
|
+
symlink (target: string, linkPath: string): Promise<void>;
|
|
160
|
+
|
|
161
|
+
getReadURL (path: string, expiresIn?: string): Promise<string>;
|
|
104
162
|
}
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
import type { RequestCallbacks } from '../shared.d.ts';
|
|
2
1
|
import type { FSItem } from './fs-item.d.ts';
|
|
3
2
|
|
|
4
|
-
export interface Subdomain
|
|
3
|
+
export interface Subdomain {
|
|
5
4
|
uid: string;
|
|
6
5
|
subdomain: string;
|
|
7
|
-
root_dir
|
|
6
|
+
root_dir: FSItem;
|
|
8
7
|
}
|
|
9
8
|
|
|
10
9
|
export class Hosting {
|
|
11
|
-
constructor (context: { authToken?: string; APIOrigin: string; appID?: string });
|
|
12
|
-
|
|
13
|
-
setAuthToken (authToken: string): void;
|
|
14
|
-
setAPIOrigin (APIOrigin: string): void;
|
|
15
|
-
|
|
16
10
|
list (): Promise<Subdomain[]>;
|
|
17
|
-
|
|
18
|
-
create (subdomain: string, dirPath
|
|
19
|
-
create (options: { subdomain: string; root_dir?: string
|
|
11
|
+
|
|
12
|
+
create (subdomain: string, dirPath?: string): Promise<Subdomain>;
|
|
13
|
+
create (options: { subdomain: string; root_dir?: string }): Promise<Subdomain>;
|
|
14
|
+
|
|
20
15
|
update (subdomain: string, dirPath?: string | null): Promise<Subdomain>;
|
|
16
|
+
|
|
21
17
|
get (subdomain: string): Promise<Subdomain>;
|
|
18
|
+
|
|
22
19
|
delete (subdomain: string): Promise<boolean>;
|
|
23
20
|
}
|
package/types/modules/kv.d.ts
CHANGED
|
@@ -11,14 +11,9 @@ export interface KVIncrementPath {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export class KV {
|
|
14
|
-
constructor (context: { authToken?: string; APIOrigin: string; appID?: string });
|
|
15
|
-
|
|
16
14
|
readonly MAX_KEY_SIZE: number;
|
|
17
15
|
readonly MAX_VALUE_SIZE: number;
|
|
18
16
|
|
|
19
|
-
setAuthToken (authToken: string): void;
|
|
20
|
-
setAPIOrigin (APIOrigin: string): void;
|
|
21
|
-
|
|
22
17
|
set<T = KVScalar>(key: string, value: T, expireAt?: number): Promise<boolean>;
|
|
23
18
|
get<T = unknown>(key: string): Promise<T | undefined>;
|
|
24
19
|
del (key: string): Promise<boolean>;
|
package/types/puter.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { Apps } from './modules/apps.d.ts';
|
|
|
3
3
|
import type { Auth } from './modules/auth.d.ts';
|
|
4
4
|
import type { Debug } from './modules/debug.d.ts';
|
|
5
5
|
import type { Drivers } from './modules/drivers.d.ts';
|
|
6
|
-
import type {
|
|
6
|
+
import type { FS } from './modules/filesystem.d.ts';
|
|
7
7
|
import type { FSItem } from './modules/fs-item.d.ts';
|
|
8
8
|
import type { Hosting } from './modules/hosting.d.ts';
|
|
9
9
|
import type { KV } from './modules/kv.d.ts';
|
|
@@ -51,7 +51,7 @@ export class Puter {
|
|
|
51
51
|
apps: Apps;
|
|
52
52
|
auth: Auth;
|
|
53
53
|
os: OS;
|
|
54
|
-
fs:
|
|
54
|
+
fs: FS;
|
|
55
55
|
ui: UI;
|
|
56
56
|
hosting: Hosting;
|
|
57
57
|
kv: KV;
|