@heyputer/puter.js 1.0.1 → 2.0.1

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.
Files changed (74) hide show
  1. package/README.md +14 -43
  2. package/index.d.ts +479 -0
  3. package/package.json +13 -3
  4. package/APACHE_LICENSE.txt +0 -201
  5. package/doc/devlog.md +0 -49
  6. package/src/bg.png +0 -0
  7. package/src/bg.webp +0 -0
  8. package/src/lib/APICallLogger.js +0 -110
  9. package/src/lib/EventListener.js +0 -51
  10. package/src/lib/RequestError.js +0 -6
  11. package/src/lib/filesystem/APIFS.js +0 -73
  12. package/src/lib/filesystem/CacheFS.js +0 -243
  13. package/src/lib/filesystem/PostMessageFS.js +0 -40
  14. package/src/lib/filesystem/definitions.js +0 -39
  15. package/src/lib/path.js +0 -509
  16. package/src/lib/polyfills/localStorage.js +0 -92
  17. package/src/lib/polyfills/xhrshim.js +0 -233
  18. package/src/lib/socket.io/socket.io.esm.min.js +0 -7
  19. package/src/lib/socket.io/socket.io.esm.min.js.map +0 -1
  20. package/src/lib/socket.io/socket.io.js +0 -4385
  21. package/src/lib/socket.io/socket.io.js.map +0 -1
  22. package/src/lib/socket.io/socket.io.min.js +0 -7
  23. package/src/lib/socket.io/socket.io.min.js.map +0 -1
  24. package/src/lib/socket.io/socket.io.msgpack.min.js +0 -7
  25. package/src/lib/socket.io/socket.io.msgpack.min.js.map +0 -1
  26. package/src/lib/utils.js +0 -620
  27. package/src/lib/xdrpc.js +0 -104
  28. package/src/modules/AI.js +0 -680
  29. package/src/modules/Apps.js +0 -215
  30. package/src/modules/Auth.js +0 -171
  31. package/src/modules/Debug.js +0 -39
  32. package/src/modules/Drivers.js +0 -278
  33. package/src/modules/FSItem.js +0 -139
  34. package/src/modules/FileSystem/index.js +0 -187
  35. package/src/modules/FileSystem/operations/copy.js +0 -64
  36. package/src/modules/FileSystem/operations/deleteFSEntry.js +0 -59
  37. package/src/modules/FileSystem/operations/getReadUrl.js +0 -42
  38. package/src/modules/FileSystem/operations/mkdir.js +0 -62
  39. package/src/modules/FileSystem/operations/move.js +0 -75
  40. package/src/modules/FileSystem/operations/read.js +0 -46
  41. package/src/modules/FileSystem/operations/readdir.js +0 -102
  42. package/src/modules/FileSystem/operations/rename.js +0 -58
  43. package/src/modules/FileSystem/operations/sign.js +0 -103
  44. package/src/modules/FileSystem/operations/space.js +0 -40
  45. package/src/modules/FileSystem/operations/stat.js +0 -95
  46. package/src/modules/FileSystem/operations/symlink.js +0 -55
  47. package/src/modules/FileSystem/operations/upload.js +0 -440
  48. package/src/modules/FileSystem/operations/write.js +0 -65
  49. package/src/modules/FileSystem/utils/getAbsolutePathForApp.js +0 -21
  50. package/src/modules/Hosting.js +0 -138
  51. package/src/modules/KV.js +0 -301
  52. package/src/modules/OS.js +0 -95
  53. package/src/modules/Perms.js +0 -109
  54. package/src/modules/PuterDialog.js +0 -481
  55. package/src/modules/Threads.js +0 -75
  56. package/src/modules/UI.js +0 -1555
  57. package/src/modules/Util.js +0 -38
  58. package/src/modules/Workers.js +0 -120
  59. package/src/modules/networking/PSocket.js +0 -87
  60. package/src/modules/networking/PTLS.js +0 -100
  61. package/src/modules/networking/PWispHandler.js +0 -89
  62. package/src/modules/networking/parsers.js +0 -157
  63. package/src/modules/networking/requests.js +0 -282
  64. package/src/services/APIAccess.js +0 -46
  65. package/src/services/FSRelay.js +0 -20
  66. package/src/services/Filesystem.js +0 -122
  67. package/src/services/NoPuterYet.js +0 -20
  68. package/src/services/XDIncoming.js +0 -44
  69. package/test/ai.test.js +0 -214
  70. package/test/fs.test.js +0 -798
  71. package/test/index.html +0 -1183
  72. package/test/kv.test.js +0 -548
  73. package/test/txt2speech.test.js +0 -178
  74. package/webpack.config.js +0 -25
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Puter.js
2
2
 
3
- The official JavaScript SDK for [Puter.com](https://puter.com) — access cloud and AI features directly from your frontend code.
3
+ The official JavaScript SDK for [Puter.com](https://puter.com) — Free, Serverless, Cloud and AI from the frontend code.
4
4
 
5
5
  ---
6
6
 
@@ -21,7 +21,15 @@ import '@heyputer/puter.js';
21
21
  #### CommonJS
22
22
 
23
23
  ```js
24
- require('@heyputer/puter.js');
24
+ const puter = require('@heyputer/puter.js');
25
+ ```
26
+
27
+ #### CDN
28
+
29
+ Include Puter.js directly in your HTML via CDN in the `<head>` section:
30
+
31
+ ```html
32
+ <script src="https://js.puter.com/v2/"></script>
25
33
  ```
26
34
 
27
35
  ## Usage Example
@@ -32,7 +40,7 @@ After importing, you can use the global `puter` object:
32
40
  // Print a message
33
41
  puter.print('Hello from Puter.js!');
34
42
 
35
- // Chat with GPT-3.5 Turbo
43
+ // Chat with GPT-5 nano
36
44
  puter.ai.chat('What color was Napoleon\'s white horse?').then(response => {
37
45
  puter.print(response);
38
46
  });
@@ -40,49 +48,12 @@ puter.ai.chat('What color was Napoleon\'s white horse?').then(response => {
40
48
 
41
49
  ---
42
50
 
43
- ## CDN Usage
44
-
45
- Include Puter.js directly in your HTML via CDN:
46
-
47
- ```html
48
- <script src="https://js.puter.com/v2/"></script>
49
- <script>
50
- puter.print('Hello from Puter.js via CDN!');
51
- puter.ai.chat('What color was Napoleon\'s white horse?').then(response => {
52
- puter.print(response);
53
- });
54
- </script>
55
- ```
56
-
57
- ---
58
-
59
51
  ## Documentation & Community
60
52
 
61
- - [Docs](https://docs.puter.com)
53
+ - [Developer Site](https://developer.puter.com)
54
+ - [API Docs](https://docs.puter.com)
62
55
  - [Live Demo](https://docs.puter.com/playground/)
63
56
  - [Puter.com](https://puter.com)
64
57
  - [Discord](https://discord.com/invite/PQcx7Teh8u)
65
58
  - [Reddit](https://reddit.com/r/puter)
66
- - [X (Twitter)](https://twitter.com/HeyPuter)
67
-
68
- ---
69
-
70
- ## Local Development Example
71
-
72
- Make sure the development server is running.
73
-
74
- ```html
75
- <html>
76
- <body>
77
- <script src="http://puter.localhost:4100/sdk/puter.dev.js"></script>
78
- <script>
79
- // Loading ...
80
- puter.print(`Loading...`);
81
-
82
- // Chat with GPT-3.5 Turbo
83
- puter.ai.chat(`What color was Napoleon's white horse?`).then((response) => {
84
- puter.print(response);
85
- });
86
- </script>
87
- </body>
88
- </html>
59
+ - [X (Twitter)](https://twitter.com/HeyPuter)
package/index.d.ts ADDED
@@ -0,0 +1,479 @@
1
+ declare global {
2
+ interface Window {
3
+ puter: Puter;
4
+ }
5
+ }
6
+
7
+ declare namespace Puter {
8
+ // Main Puter interface
9
+ interface Puter {
10
+ // Properties
11
+ appID: string;
12
+ env: 'app' | 'web' | 'gui';
13
+
14
+ // Utility methods
15
+ print(text: string, options?: { code?: boolean }): void;
16
+ randName(separator?: string): string;
17
+ exit(statusCode?: number): void;
18
+
19
+ // Sub-modules
20
+ ai: AI;
21
+ apps: Apps;
22
+ auth: Auth;
23
+ drivers: Drivers;
24
+ fs: FileSystem;
25
+ hosting: Hosting;
26
+ kv: KeyValue;
27
+ net: Networking;
28
+ perms: Permissions;
29
+ ui: UI;
30
+ workers: Workers;
31
+ }
32
+
33
+ // AI Module
34
+ interface AI {
35
+ chat(prompt: string, options?: ChatOptions): Promise<ChatResponse>;
36
+ chat(prompt: string, testMode?: boolean, options?: ChatOptions): Promise<ChatResponse>;
37
+ chat(prompt: string, imageURL?: string, testMode?: boolean, options?: ChatOptions): Promise<ChatResponse>;
38
+ chat(prompt: string, imageURLArray?: string[], testMode?: boolean, options?: ChatOptions): Promise<ChatResponse>;
39
+ chat(messages: ChatMessage[], testMode?: boolean, options?: ChatOptions): Promise<ChatResponse>;
40
+
41
+ img2txt(image: string | File | Blob, testMode?: boolean): Promise<string>;
42
+
43
+ txt2img(prompt: string, testMode?: boolean): Promise<HTMLImageElement>;
44
+ txt2img(prompt: string, options?: Txt2ImgOptions): Promise<HTMLImageElement>;
45
+
46
+ txt2speech(text: string): Promise<HTMLAudioElement>;
47
+ txt2speech(text: string, options?: Txt2SpeechOptions): Promise<HTMLAudioElement>;
48
+ txt2speech(text: string, language?: string): Promise<HTMLAudioElement>;
49
+ txt2speech(text: string, language?: string, voice?: string): Promise<HTMLAudioElement>;
50
+ txt2speech(text: string, language?: string, voice?: string, engine?: string): Promise<HTMLAudioElement>;
51
+ }
52
+
53
+ interface ChatOptions {
54
+ model?: string;
55
+ stream?: boolean;
56
+ max_tokens?: number;
57
+ temperature?: number;
58
+ tools?: ToolDefinition[];
59
+ }
60
+
61
+ interface ToolDefinition {
62
+ type: 'function';
63
+ function: {
64
+ name: string;
65
+ description: string;
66
+ parameters: object;
67
+ strict?: boolean;
68
+ };
69
+ }
70
+
71
+ interface ChatMessage {
72
+ role: 'system' | 'assistant' | 'user' | 'function' | 'tool';
73
+ content: string | ContentObject[];
74
+ tool_call_id?: string;
75
+ }
76
+
77
+ interface ContentObject {
78
+ type: 'text' | 'file';
79
+ text?: string;
80
+ puter_path?: string;
81
+ }
82
+
83
+ interface ChatResponse {
84
+ message: {
85
+ role: string;
86
+ content: string;
87
+ tool_calls?: ToolCall[];
88
+ };
89
+ }
90
+
91
+ interface ToolCall {
92
+ id: string;
93
+ function: {
94
+ name: string;
95
+ arguments: string;
96
+ };
97
+ }
98
+
99
+ interface Txt2ImgOptions {
100
+ model?: 'gpt-image-1' | 'gemini-2.5-flash-image-preview' | 'dall-e-3';
101
+ quality?: 'high' | 'medium' | 'low' | 'hd' | 'standard';
102
+ input_image?: string;
103
+ input_image_mime_type?: string;
104
+ }
105
+
106
+ interface Txt2SpeechOptions {
107
+ language?: string;
108
+ voice?: string;
109
+ engine?: 'standard' | 'neural' | 'generative';
110
+ }
111
+
112
+ // Apps Module
113
+ interface Apps {
114
+ create(name: string, indexURL: string): Promise<App>;
115
+ create(name: string, indexURL: string, title?: string): Promise<App>;
116
+ create(name: string, indexURL: string, title?: string, description?: string): Promise<App>;
117
+ create(options: CreateAppOptions): Promise<App>;
118
+
119
+ delete(name: string): Promise<App>;
120
+ get(name: string, options?: GetAppOptions): Promise<App>;
121
+ list(options?: ListAppOptions): Promise<App[]>;
122
+ update(name: string, attributes: UpdateAppAttributes): Promise<App>;
123
+ }
124
+
125
+ interface CreateAppOptions {
126
+ name: string;
127
+ indexURL: string;
128
+ title?: string;
129
+ description?: string;
130
+ icon?: string;
131
+ maximizeOnStart?: boolean;
132
+ filetypeAssociations?: string[];
133
+ }
134
+
135
+ interface GetAppOptions {
136
+ stats_period?: StatsPeriod;
137
+ icon_size?: null | 16 | 32 | 64 | 128 | 256 | 512;
138
+ }
139
+
140
+ interface ListAppOptions extends GetAppOptions { }
141
+
142
+ interface UpdateAppAttributes {
143
+ name?: string;
144
+ indexURL?: string;
145
+ title?: string;
146
+ description?: string;
147
+ icon?: string;
148
+ maximizeOnStart?: boolean;
149
+ filetypeAssociations?: string[];
150
+ }
151
+
152
+ type StatsPeriod = 'all' | 'today' | 'yesterday' | '7d' | '30d' | 'this_month' | 'last_month' | 'this_year' | 'last_year' | 'month_to_date' | 'year_to_date' | 'last_12_months';
153
+
154
+ interface App {
155
+ uid: string;
156
+ name: string;
157
+ icon: string;
158
+ description: string;
159
+ title: string;
160
+ maximize_on_start: boolean;
161
+ index_url: string;
162
+ created_at: string;
163
+ background: boolean;
164
+ filetype_associations: string[];
165
+ open_count: number;
166
+ user_count: number;
167
+ }
168
+
169
+ // Auth Module
170
+ interface Auth {
171
+ signIn(options?: { attempt_temp_user_creation?: boolean }): Promise<boolean>;
172
+ signOut(): void;
173
+ isSignedIn(): boolean;
174
+ getUser(): Promise<User>;
175
+ }
176
+
177
+ interface User {
178
+ uuid: string;
179
+ username: string;
180
+ email_confirmed: boolean;
181
+ }
182
+
183
+ // Drivers Module
184
+ interface Drivers {
185
+ call(interface: string, driver: string, method: string, args?: object): Promise<any>;
186
+ }
187
+
188
+ // FileSystem Module
189
+ interface FileSystem {
190
+ copy(source: string, destination: string, options?: CopyOptions): Promise<FSItem>;
191
+ delete(path: string, options?: DeleteOptions): Promise<void>;
192
+ getReadURL(path: string, expiresIn?: number): Promise<string>;
193
+ mkdir(path: string, options?: MkdirOptions): Promise<FSItem>;
194
+ move(source: string, destination: string, options?: MoveOptions): Promise<FSItem>;
195
+ read(path: string, options?: ReadOptions): Promise<Blob>;
196
+ readdir(path: string, options?: ReaddirOptions): Promise<FSItem[]>;
197
+ readdir(options?: ReaddirOptions): Promise<FSItem[]>;
198
+ rename(path: string, newName: string): Promise<FSItem>;
199
+ space(): Promise<SpaceInfo>;
200
+ stat(path: string): Promise<FSItem>;
201
+ upload(items: FileList | File[] | Blob[], dirPath?: string, options?: object): Promise<FSItem[]>;
202
+ write(path: string, data?: string | File | Blob, options?: WriteOptions): Promise<FSItem>;
203
+ }
204
+
205
+ interface CopyOptions {
206
+ overwrite?: boolean;
207
+ dedupeName?: boolean;
208
+ newName?: string;
209
+ }
210
+
211
+ interface DeleteOptions {
212
+ recursive?: boolean;
213
+ descendantsOnly?: boolean;
214
+ }
215
+
216
+ interface MkdirOptions {
217
+ overwrite?: boolean;
218
+ dedupeName?: boolean;
219
+ createMissingParents?: boolean;
220
+ }
221
+
222
+ interface MoveOptions extends CopyOptions {
223
+ createMissingParents?: boolean;
224
+ }
225
+
226
+ interface ReadOptions {
227
+ offset?: number;
228
+ byte_count?: number;
229
+ }
230
+
231
+ interface ReaddirOptions {
232
+ path?: string;
233
+ uid?: string;
234
+ }
235
+
236
+ interface WriteOptions {
237
+ overwrite?: boolean;
238
+ dedupeName?: boolean;
239
+ createMissingParents?: boolean;
240
+ }
241
+
242
+ interface SpaceInfo {
243
+ capacity: number;
244
+ used: number;
245
+ }
246
+
247
+ interface FSItem {
248
+ id: string;
249
+ uid: string;
250
+ name: string;
251
+ path: string;
252
+ is_dir: boolean;
253
+ parent_id: string;
254
+ parent_uid: string;
255
+ created: number;
256
+ modified: number;
257
+ accessed: number;
258
+ size: number | null;
259
+ writable: boolean;
260
+ read(): Promise<Blob>;
261
+ readdir(): Promise<FSItem[]>;
262
+ }
263
+
264
+ // Hosting Module
265
+ interface Hosting {
266
+ create(subdomain: string, dirPath?: string): Promise<Subdomain>;
267
+ delete(subdomain: string): Promise<boolean>;
268
+ get(subdomain: string): Promise<Subdomain>;
269
+ list(): Promise<Subdomain[]>;
270
+ update(subdomain: string, dirPath?: string): Promise<Subdomain>;
271
+ }
272
+
273
+ interface Subdomain {
274
+ uid: string;
275
+ subdomain: string;
276
+ root_dir: FSItem;
277
+ }
278
+
279
+ // KeyValue Module
280
+ interface KeyValue {
281
+ set(key: string, value: string | number | boolean | object | any[]): Promise<boolean>;
282
+ get(key: string): Promise<any>;
283
+ del(key: string): Promise<boolean>;
284
+ incr(key: string, amount?: number): Promise<number>;
285
+ decr(key: string, amount?: number): Promise<number>;
286
+ list(pattern?: string, returnValues?: boolean): Promise<string[] | KeyValuePair[]>;
287
+ list(returnValues?: boolean): Promise<string[] | KeyValuePair[]>;
288
+ flush(): Promise<boolean>;
289
+ }
290
+
291
+ interface KeyValuePair {
292
+ key: string;
293
+ value: any;
294
+ }
295
+
296
+ // Networking Module
297
+ interface Networking {
298
+ fetch(url: string, options?: RequestInit): Promise<Response>;
299
+ Socket: typeof Socket;
300
+ tls: {
301
+ TLSSocket: typeof TLSSocket;
302
+ };
303
+ }
304
+
305
+ class Socket {
306
+ constructor(hostname: string, port: number);
307
+ write(data: ArrayBuffer | Uint8Array | string): void;
308
+ close(): void;
309
+ on(event: 'open', callback: () => void): void;
310
+ on(event: 'data', callback: (buffer: Uint8Array) => void): void;
311
+ on(event: 'error', callback: (reason: string) => void): void;
312
+ on(event: 'close', callback: (hadError: boolean) => void): void;
313
+ }
314
+
315
+ class TLSSocket extends Socket {
316
+ constructor(hostname: string, port: number);
317
+ }
318
+
319
+ // Permissions Module
320
+ interface Permissions {
321
+ grantApp(app_uid: string, permissionString: string): Promise<object>;
322
+ grantAppAnyUser(app_uid: string, permissionString: string): Promise<object>;
323
+ grantGroup(group_uid: string, permissionString: string): Promise<object>;
324
+ grantOrigin(origin: string, permissionString: string): Promise<object>;
325
+ grantUser(username: string, permissionString: string): Promise<object>;
326
+ revokeApp(app_uid: string, permissionString: string): Promise<object>;
327
+ revokeAppAnyUser(app_uid: string, permissionString: string): Promise<object>;
328
+ revokeGroup(group_uid: string, permissionString: string): Promise<object>;
329
+ revokeOrigin(origin: string, permissionString: string): Promise<object>;
330
+ revokeUser(username: string, permissionString: string): Promise<object>;
331
+ }
332
+
333
+ // UI Module
334
+ interface UI {
335
+ alert(message?: string, buttons?: AlertButton[]): Promise<string>;
336
+ prompt(message?: string, defaultValue?: string): Promise<string | null>;
337
+ authenticateWithPuter(): Promise<boolean>;
338
+ contextMenu(options: ContextMenuOptions): void;
339
+ createWindow(options?: WindowOptions): void;
340
+ exit(statusCode?: number): void;
341
+ getLanguage(): Promise<string>;
342
+ hideSpinner(): void;
343
+ launchApp(appName?: string, args?: object): Promise<AppConnection>;
344
+ launchApp(options: LaunchAppOptions): Promise<AppConnection>;
345
+ on(eventName: 'localeChanged', handler: (data: { language: string }) => void): void;
346
+ on(eventName: 'themeChanged', handler: (data: ThemeData) => void): void;
347
+ onItemsOpened(handler: (items: FSItem[]) => void): void;
348
+ onLaunchedWithItems(handler: (items: FSItem[]) => void): void;
349
+ onWindowClose(handler: () => void): void;
350
+ parentApp(): AppConnection | null;
351
+ setMenubar(options: MenubarOptions): void;
352
+ setWindowHeight(height: number): void;
353
+ setWindowPosition(x: number, y: number): void;
354
+ setWindowSize(width: number, height: number): void;
355
+ setWindowTitle(title: string): void;
356
+ setWindowWidth(width: number): void;
357
+ setWindowX(x: number): void;
358
+ setWindowY(y: number): void;
359
+ showColorPicker(defaultColor?: string): Promise<string>;
360
+ showColorPicker(options?: object): Promise<string>;
361
+ showDirectoryPicker(options?: { multiple?: boolean }): Promise<FSItem | FSItem[]>;
362
+ showFontPicker(defaultFont?: string): Promise<{ fontFamily: string }>;
363
+ showFontPicker(options?: object): Promise<{ fontFamily: string }>;
364
+ showOpenFilePicker(options?: FilePickerOptions): Promise<FSItem | FSItem[]>;
365
+ showSaveFilePicker(data?: any, defaultFileName?: string): Promise<FSItem>;
366
+ showSpinner(): void;
367
+ socialShare(url: string, message?: string, options?: { left?: number; top?: number }): void;
368
+ wasLaunchedWithItems(): boolean;
369
+ }
370
+
371
+ interface AlertButton {
372
+ label: string;
373
+ value?: string;
374
+ type?: 'primary' | 'success' | 'info' | 'warning' | 'danger';
375
+ }
376
+
377
+ interface ContextMenuOptions {
378
+ items: (ContextMenuItem | '-')[];
379
+ }
380
+
381
+ interface ContextMenuItem {
382
+ label: string;
383
+ action?: () => void;
384
+ icon?: string;
385
+ icon_active?: string;
386
+ disabled?: boolean;
387
+ items?: (ContextMenuItem | '-')[];
388
+ }
389
+
390
+ interface WindowOptions {
391
+ center?: boolean;
392
+ content?: string;
393
+ disable_parent_window?: boolean;
394
+ has_head?: boolean;
395
+ height?: number;
396
+ is_resizable?: boolean;
397
+ show_in_taskbar?: boolean;
398
+ title?: string;
399
+ width?: number;
400
+ }
401
+
402
+ interface LaunchAppOptions {
403
+ name?: string;
404
+ args?: object;
405
+ }
406
+
407
+ interface ThemeData {
408
+ palette: {
409
+ primaryHue: number;
410
+ primarySaturation: string;
411
+ primaryLightness: string;
412
+ primaryAlpha: number;
413
+ primaryColor: string;
414
+ };
415
+ }
416
+
417
+ interface MenubarOptions {
418
+ items: MenuItem[];
419
+ }
420
+
421
+ interface MenuItem {
422
+ label: string;
423
+ action?: () => void;
424
+ items?: MenuItem[];
425
+ }
426
+
427
+ interface FilePickerOptions {
428
+ multiple?: boolean;
429
+ accept?: string | string[];
430
+ }
431
+
432
+ interface AppConnection {
433
+ usesSDK: boolean;
434
+ on(eventName: 'message', handler: (message: any) => void): void;
435
+ on(eventName: 'close', handler: (data: { appInstanceID: string }) => void): void;
436
+ off(eventName: string, handler: Function): void;
437
+ postMessage(message: any): void;
438
+ close(): void;
439
+ }
440
+
441
+ // Workers Module
442
+ interface Workers {
443
+ create(workerName: string, filePath: string): Promise<WorkerDeployment>;
444
+ delete(workerName: string): Promise<boolean>;
445
+ exec(workerURL: string, options?: WorkerExecOptions): Promise<Response>;
446
+ get(workerName: string): Promise<WorkerInfo>;
447
+ list(): Promise<WorkerInfo[]>;
448
+ }
449
+
450
+ interface WorkerDeployment {
451
+ success: boolean;
452
+ url: string;
453
+ errors: any[];
454
+ }
455
+
456
+ interface WorkerExecOptions extends RequestInit {
457
+ method?: string;
458
+ headers?: object;
459
+ body?: string | object;
460
+ cache?: RequestCache;
461
+ credentials?: RequestCredentials;
462
+ mode?: RequestMode;
463
+ redirect?: RequestRedirect;
464
+ referrer?: string;
465
+ signal?: AbortSignal;
466
+ }
467
+
468
+ interface WorkerInfo {
469
+ name: string;
470
+ url: string;
471
+ file_path: string;
472
+ file_uid: string;
473
+ created_at: string;
474
+ }
475
+ }
476
+
477
+ declare const puter: Puter.Puter;
478
+
479
+ export = Puter;
package/package.json CHANGED
@@ -1,8 +1,14 @@
1
1
  {
2
2
  "name": "@heyputer/puter.js",
3
- "version": "1.0.1",
3
+ "version": "2.0.1",
4
4
  "description": "Puter.js - A JavaScript library for interacting with Puter services.",
5
- "main": "./src/index.js",
5
+ "main": "src/index.js",
6
+ "types": "index.d.ts",
7
+ "typings": "index.d.ts",
8
+ "files": [
9
+ "src/index.js",
10
+ "index.d.ts"
11
+ ],
6
12
  "type": "module",
7
13
  "publishConfig": {
8
14
  "registry": "https://registry.npmjs.org/"
@@ -11,13 +17,17 @@
11
17
  "type": "git",
12
18
  "url": "git+https://github.com/HeyPuter/puter.git"
13
19
  },
20
+ "keywords": [
21
+ "puter",
22
+ "puter.js",
23
+ "puterjs"
24
+ ],
14
25
  "scripts": {
15
26
  "start-server": "npx http-server --cors -c-1",
16
27
  "start-webpack": "webpack && webpack --output-filename puter.dev.js --watch --devtool source-map",
17
28
  "start": "concurrently \"npm run start-server\" \"npm run start-webpack\"",
18
29
  "build": "webpack && { echo \"// Copyright 2024-present Puter Technologies Inc. All rights reserved.\"; echo \"// Generated on $(date '+%Y-%m-%d %H:%M')\n\"; cat ./dist/puter.js; } > temp && mv temp ./dist/puter.js"
19
30
  },
20
- "keywords": [],
21
31
  "author": "Puter Technologies Inc.",
22
32
  "license": "Apache-2.0",
23
33
  "devDependencies": {