@heyputer/puter.js 2.1.6 → 2.1.8

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 (57) hide show
  1. package/dist/puter.cjs +2 -2
  2. package/index.d.ts +103 -626
  3. package/package.json +1 -1
  4. package/src/index.js +91 -91
  5. package/src/lib/APICallLogger.js +20 -21
  6. package/src/lib/EventListener.js +10 -10
  7. package/src/lib/filesystem/APIFS.js +11 -19
  8. package/src/lib/filesystem/CacheFS.js +25 -25
  9. package/src/lib/filesystem/PostMessageFS.js +11 -11
  10. package/src/lib/filesystem/definitions.js +11 -10
  11. package/src/lib/path.js +505 -446
  12. package/src/lib/polyfills/fileReaderPoly.js +40 -0
  13. package/src/lib/polyfills/localStorage.js +30 -33
  14. package/src/lib/polyfills/xhrshim.js +206 -207
  15. package/src/lib/utils.js +160 -151
  16. package/src/lib/xdrpc.js +9 -9
  17. package/src/modules/AI.js +416 -290
  18. package/src/modules/Apps.js +56 -56
  19. package/src/modules/Auth.js +17 -17
  20. package/src/modules/Debug.js +1 -1
  21. package/src/modules/Drivers.js +41 -41
  22. package/src/modules/FSItem.js +64 -62
  23. package/src/modules/FileSystem/index.js +22 -23
  24. package/src/modules/FileSystem/operations/copy.js +7 -7
  25. package/src/modules/FileSystem/operations/deleteFSEntry.js +14 -12
  26. package/src/modules/FileSystem/operations/getReadUrl.js +16 -14
  27. package/src/modules/FileSystem/operations/mkdir.js +11 -11
  28. package/src/modules/FileSystem/operations/move.js +12 -12
  29. package/src/modules/FileSystem/operations/read.js +10 -10
  30. package/src/modules/FileSystem/operations/readdir.js +28 -28
  31. package/src/modules/FileSystem/operations/rename.js +11 -11
  32. package/src/modules/FileSystem/operations/sign.js +33 -30
  33. package/src/modules/FileSystem/operations/space.js +7 -7
  34. package/src/modules/FileSystem/operations/stat.js +25 -25
  35. package/src/modules/FileSystem/operations/symlink.js +15 -17
  36. package/src/modules/FileSystem/operations/upload.js +151 -122
  37. package/src/modules/FileSystem/operations/write.js +16 -12
  38. package/src/modules/FileSystem/utils/getAbsolutePathForApp.js +10 -6
  39. package/src/modules/Hosting.js +29 -29
  40. package/src/modules/KV.js +23 -23
  41. package/src/modules/OS.js +15 -15
  42. package/src/modules/Perms.js +19 -21
  43. package/src/modules/PuterDialog.js +46 -48
  44. package/src/modules/Threads.js +17 -20
  45. package/src/modules/UI.js +156 -156
  46. package/src/modules/Util.js +3 -3
  47. package/src/modules/Workers.js +52 -49
  48. package/src/modules/networking/PSocket.js +38 -38
  49. package/src/modules/networking/PTLS.js +54 -47
  50. package/src/modules/networking/PWispHandler.js +49 -47
  51. package/src/modules/networking/parsers.js +110 -108
  52. package/src/modules/networking/requests.js +67 -78
  53. package/src/services/APIAccess.js +9 -9
  54. package/src/services/FSRelay.js +6 -6
  55. package/src/services/Filesystem.js +8 -8
  56. package/src/services/NoPuterYet.js +2 -2
  57. package/src/services/XDIncoming.js +1 -1
@@ -19,13 +19,13 @@ export class FilesystemService extends putility.concepts.Service {
19
19
  re-initialize the socket connection whenever the
20
20
  authentication token or API origin is changed.
21
21
  `,
22
- async do() {
22
+ async do () {
23
23
  this.initializeSocket();
24
24
  },
25
25
  },
26
26
  ];
27
27
 
28
- _init() {
28
+ _init () {
29
29
  const env = this._.context.env;
30
30
 
31
31
  if ( env === 'app' ) {
@@ -40,14 +40,14 @@ export class FilesystemService extends putility.concepts.Service {
40
40
  this.initializeSocket();
41
41
  }
42
42
 
43
- init_app_fs_() {
43
+ init_app_fs_ () {
44
44
  this.fs_nocache_ = new PostMessageFilesystem({
45
45
  messageTarget: globalThis.parent,
46
46
  rpc: this._.context.util.rpc,
47
47
  }).as(TFilesystem);
48
48
  this.filesystem = this.fs_nocache_;
49
49
  }
50
- init_top_fs_() {
50
+ init_top_fs_ () {
51
51
  const api_info = this._.context.services.get('api-access').get_api_info();
52
52
  this.fs_nocache_ = new PuterAPIFilesystem({ api_info }).as(TFilesystem);
53
53
  this.fs_cache_ = new CachedFilesystem({ delegate: this.fs_nocache_ }).as(TFilesystem);
@@ -56,14 +56,14 @@ export class FilesystemService extends putility.concepts.Service {
56
56
  this.filesystem = this.fs_proxy_.as(TFilesystem);
57
57
  }
58
58
 
59
- cache_on() {
59
+ cache_on () {
60
60
  this.fs_proxy_.delegate = this.fs_cache_;
61
61
  }
62
- cache_off() {
62
+ cache_off () {
63
63
  this.fs_proxy_.delegate = this.fs_nocache_;
64
64
  }
65
65
 
66
- async initializeSocket() {
66
+ async initializeSocket () {
67
67
  if ( this.socket ) {
68
68
  this.socket.disconnect();
69
69
  }
@@ -84,7 +84,7 @@ export class FilesystemService extends putility.concepts.Service {
84
84
  this.bindSocketEvents();
85
85
  }
86
86
 
87
- bindSocketEvents() {
87
+ bindSocketEvents () {
88
88
  this.socket.on('connect', () => {
89
89
  if ( puter.debugMode )
90
90
  {
@@ -1,4 +1,4 @@
1
- import putility from "@heyputer/putility";
1
+ import putility from '@heyputer/putility';
2
2
 
3
3
  /**
4
4
  * Runs commands on the special `globalThis.when_puter_happens` global, for
@@ -16,5 +16,5 @@ export class NoPuterYetService extends putility.concepts.Service {
16
16
  for ( const fn of globalThis.when_puter_happens ) {
17
17
  fn({ context: this._.context });
18
18
  }
19
- }
19
+ }
20
20
  }
@@ -1,4 +1,4 @@
1
- import putility from "@heyputer/putility";
1
+ import putility from '@heyputer/putility';
2
2
 
3
3
  const TeePromise = putility.libs.promise.TeePromise;
4
4