core-3nweb-client-lib 0.26.0 → 0.27.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 (199) hide show
  1. package/build/api-defs/asmail.d.ts +1 -1
  2. package/build/api-defs/files.d.ts +278 -69
  3. package/build/core/app-files.js +7 -7
  4. package/build/core/asmail/config/common.js +2 -2
  5. package/build/core/asmail/config/index.js +2 -2
  6. package/build/core/asmail/config/published-intro-key.js +1 -1
  7. package/build/core/asmail/delivery/common.js +7 -7
  8. package/build/core/asmail/delivery/index.js +5 -5
  9. package/build/core/asmail/delivery/msg.js +4 -4
  10. package/build/core/asmail/delivery/per-recipient-wip.js +1 -1
  11. package/build/core/asmail/inbox/attachments/fs.js +5 -1
  12. package/build/core/asmail/inbox/cached-msgs.js +1 -1
  13. package/build/core/asmail/inbox/inbox-events.js +4 -4
  14. package/build/core/asmail/inbox/index.js +10 -10
  15. package/build/core/asmail/inbox/msg-downloader.js +1 -1
  16. package/build/core/asmail/inbox/msg-indexing.js +1 -1
  17. package/build/core/asmail/inbox/msg-on-disk.js +5 -5
  18. package/build/core/asmail/index.d.ts +3 -3
  19. package/build/core/asmail/index.js +13 -8
  20. package/build/core/asmail/key-verification.js +5 -5
  21. package/build/core/asmail/keyring/common.js +7 -6
  22. package/build/core/asmail/keyring/correspondent-keys.js +8 -7
  23. package/build/core/asmail/keyring/id-to-email-map.js +2 -1
  24. package/build/core/asmail/keyring/index.d.ts +7 -8
  25. package/build/core/asmail/keyring/index.js +15 -14
  26. package/build/core/asmail/keyring/keyring-storage.js +2 -1
  27. package/build/core/asmail/msg/opener.js +3 -3
  28. package/build/core/asmail/msg/packer.js +13 -13
  29. package/build/core/asmail/sending-params/own-params.js +2 -2
  30. package/build/core/asmail/sending-params/params-from-others.js +1 -1
  31. package/build/core/id-manager.js +6 -3
  32. package/build/core/index.d.ts +2 -1
  33. package/build/core/index.js +14 -14
  34. package/build/core/sign-in.js +5 -5
  35. package/build/core/sign-up.js +9 -9
  36. package/build/core/storage/common/json-saving.js +2 -2
  37. package/build/core/storage/common/obj-info-file.d.ts +12 -4
  38. package/build/core/storage/common/obj-info-file.js +66 -34
  39. package/build/core/storage/common/utils.d.ts +2 -0
  40. package/build/core/storage/common/utils.js +32 -0
  41. package/build/core/storage/index.d.ts +3 -17
  42. package/build/core/storage/index.js +56 -76
  43. package/build/core/storage/local/obj-files-gc.d.ts +2 -0
  44. package/build/core/storage/local/obj-files-gc.js +49 -37
  45. package/build/core/storage/local/obj-files.d.ts +4 -7
  46. package/build/core/storage/local/obj-files.js +7 -10
  47. package/build/core/storage/local/obj-status.d.ts +12 -6
  48. package/build/core/storage/local/obj-status.js +24 -9
  49. package/build/core/storage/local/storage.d.ts +9 -6
  50. package/build/core/storage/local/storage.js +29 -18
  51. package/build/core/storage/synced/downloader.js +1 -1
  52. package/build/core/storage/synced/obj-files-gc.d.ts +5 -1
  53. package/build/core/storage/synced/obj-files-gc.js +91 -37
  54. package/build/core/storage/synced/obj-files.d.ts +42 -36
  55. package/build/core/storage/synced/obj-files.js +178 -147
  56. package/build/core/storage/synced/obj-status.d.ts +87 -85
  57. package/build/core/storage/synced/obj-status.js +463 -259
  58. package/build/core/storage/synced/remote-events.d.ts +11 -12
  59. package/build/core/storage/synced/remote-events.js +73 -56
  60. package/build/core/storage/synced/storage.d.ts +18 -9
  61. package/build/core/storage/synced/storage.js +108 -48
  62. package/build/core/storage/synced/upload-header-file.d.ts +4 -0
  63. package/build/core/storage/synced/upload-header-file.js +64 -0
  64. package/build/core/storage/synced/upsyncer.d.ts +12 -7
  65. package/build/core/storage/synced/upsyncer.js +204 -280
  66. package/build/core/storage/system-folders/apps-data.d.ts +16 -0
  67. package/build/core/storage/system-folders/apps-data.js +110 -0
  68. package/build/core/storage/system-folders/index.d.ts +18 -0
  69. package/build/core/storage/system-folders/index.js +77 -0
  70. package/build/core-ipc/common-caps.js +3 -3
  71. package/build/core-ipc/generic.js +8 -8
  72. package/build/core-ipc/startup-caps.js +2 -2
  73. package/build/cryptors.js +6 -2
  74. package/build/ipc-via-protobuf/asmail-cap.js +58 -57
  75. package/build/ipc-via-protobuf/bytes.js +16 -17
  76. package/build/ipc-via-protobuf/connector-clients-side.d.ts +3 -0
  77. package/build/ipc-via-protobuf/connector-clients-side.js +61 -24
  78. package/build/ipc-via-protobuf/connector-services-side.js +10 -10
  79. package/build/ipc-via-protobuf/connector.js +4 -4
  80. package/build/ipc-via-protobuf/file.d.ts +48 -12
  81. package/build/ipc-via-protobuf/file.js +474 -126
  82. package/build/ipc-via-protobuf/fs.d.ts +8 -0
  83. package/build/ipc-via-protobuf/fs.js +577 -142
  84. package/build/ipc-via-protobuf/log-cap.js +2 -2
  85. package/build/ipc-via-protobuf/mailerid.js +3 -3
  86. package/build/ipc-via-protobuf/protobuf-msg.d.ts +1 -0
  87. package/build/ipc-via-protobuf/protobuf-msg.js +11 -7
  88. package/build/ipc-via-protobuf/startup-cap.js +21 -21
  89. package/build/ipc-via-protobuf/storage-cap.js +12 -12
  90. package/build/ipc.js +7 -2
  91. package/build/lib-client/3nstorage/exceptions.d.ts +3 -0
  92. package/build/lib-client/3nstorage/exceptions.js +13 -1
  93. package/build/lib-client/3nstorage/service.d.ts +15 -2
  94. package/build/lib-client/3nstorage/service.js +104 -38
  95. package/build/lib-client/3nstorage/util/file-based-json.d.ts +2 -1
  96. package/build/lib-client/3nstorage/util/file-based-json.js +1 -1
  97. package/build/lib-client/3nstorage/xsp-fs/attrs.js +17 -17
  98. package/build/lib-client/3nstorage/xsp-fs/common.d.ts +42 -18
  99. package/build/lib-client/3nstorage/xsp-fs/common.js +29 -19
  100. package/build/lib-client/3nstorage/xsp-fs/file-node.d.ts +1 -0
  101. package/build/lib-client/3nstorage/xsp-fs/file-node.js +17 -13
  102. package/build/lib-client/3nstorage/xsp-fs/file.d.ts +31 -6
  103. package/build/lib-client/3nstorage/xsp-fs/file.js +73 -25
  104. package/build/lib-client/3nstorage/xsp-fs/folder-node-serialization.js +4 -4
  105. package/build/lib-client/3nstorage/xsp-fs/folder-node.d.ts +24 -11
  106. package/build/lib-client/3nstorage/xsp-fs/folder-node.js +575 -179
  107. package/build/lib-client/3nstorage/xsp-fs/fs.d.ts +35 -4
  108. package/build/lib-client/3nstorage/xsp-fs/fs.js +231 -110
  109. package/build/lib-client/3nstorage/xsp-fs/link-node.d.ts +1 -0
  110. package/build/lib-client/3nstorage/xsp-fs/link-node.js +7 -2
  111. package/build/lib-client/3nstorage/xsp-fs/node-in-fs.d.ts +30 -24
  112. package/build/lib-client/3nstorage/xsp-fs/node-in-fs.js +229 -123
  113. package/build/lib-client/3nstorage/xsp-fs/node-persistence.d.ts +1 -1
  114. package/build/lib-client/3nstorage/xsp-fs/node-persistence.js +17 -18
  115. package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v1.js +3 -3
  116. package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v2.js +53 -53
  117. package/build/lib-client/3nweb-signup.js +4 -4
  118. package/build/lib-client/asmail/recipient.js +15 -15
  119. package/build/lib-client/asmail/sender.js +22 -22
  120. package/build/lib-client/asmail/service-config.js +3 -3
  121. package/build/lib-client/cryptor/cryptor-in-worker.js +18 -16
  122. package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
  123. package/build/lib-client/cryptor/cryptor.js +4 -2
  124. package/build/lib-client/cryptor/cryptor.wasm +0 -0
  125. package/build/lib-client/cryptor/in-proc-js.js +1 -1
  126. package/build/lib-client/cryptor/in-proc-wasm.js +6 -6
  127. package/build/lib-client/cryptor/worker-js.js +2 -2
  128. package/build/lib-client/cryptor/worker-wasm.js +2 -2
  129. package/build/lib-client/files-select.js +1 -1
  130. package/build/lib-client/files.d.ts +1 -1
  131. package/build/lib-client/files.js +71 -6
  132. package/build/lib-client/fs-collection.js +1 -1
  133. package/build/lib-client/fs-sync-utils.d.ts +5 -0
  134. package/build/lib-client/fs-sync-utils.js +61 -0
  135. package/build/lib-client/fs-view.d.ts +14 -0
  136. package/build/lib-client/fs-view.js +33 -0
  137. package/build/lib-client/key-derivation.js +1 -1
  138. package/build/lib-client/local-files/dev-file-sink.js +9 -9
  139. package/build/lib-client/local-files/dev-file-src.js +2 -2
  140. package/build/lib-client/local-files/device-fs.d.ts +1 -1
  141. package/build/lib-client/local-files/device-fs.js +56 -54
  142. package/build/lib-client/logging/log-to-file.d.ts +1 -1
  143. package/build/lib-client/logging/log-to-file.js +7 -7
  144. package/build/lib-client/mailer-id/login.js +7 -7
  145. package/build/lib-client/mailer-id/provisioner.js +12 -12
  146. package/build/lib-client/objs-on-disk/file-writing-proc.js +3 -3
  147. package/build/lib-client/objs-on-disk/obj-folders.js +31 -31
  148. package/build/lib-client/objs-on-disk/obj-on-disk.d.ts +13 -2
  149. package/build/lib-client/objs-on-disk/obj-on-disk.js +24 -9
  150. package/build/lib-client/request-utils.d.ts +1 -0
  151. package/build/lib-client/request-utils.js +13 -13
  152. package/build/lib-client/server-events.d.ts +3 -3
  153. package/build/lib-client/server-events.js +9 -8
  154. package/build/lib-client/service-locator.js +10 -10
  155. package/build/lib-client/user-with-mid-session.js +7 -7
  156. package/build/lib-client/user-with-pkl-session.js +25 -25
  157. package/build/lib-client/ws-utils.js +2 -2
  158. package/build/lib-common/async-cryptor-wrap.js +4 -4
  159. package/build/lib-common/async-fs-node.d.ts +5 -3
  160. package/build/lib-common/async-fs-node.js +16 -16
  161. package/build/lib-common/byte-streaming/pipe.js +1 -1
  162. package/build/lib-common/byte-streaming/wrapping.js +13 -13
  163. package/build/lib-common/canonical-address.js +1 -1
  164. package/build/lib-common/exceptions/error.d.ts +1 -0
  165. package/build/lib-common/exceptions/error.js +7 -6
  166. package/build/lib-common/exceptions/file.js +4 -0
  167. package/build/lib-common/ipc/ws-ipc.js +2 -2
  168. package/build/lib-common/mid-sigs-NaCl-Ed.js +14 -14
  169. package/build/lib-common/objs-on-disk/file-layout.d.ts +19 -0
  170. package/build/lib-common/objs-on-disk/file-layout.js +130 -12
  171. package/build/lib-common/objs-on-disk/obj-file.d.ts +13 -2
  172. package/build/lib-common/objs-on-disk/obj-file.js +96 -35
  173. package/build/lib-common/objs-on-disk/utils.d.ts +1 -0
  174. package/build/lib-common/objs-on-disk/utils.js +3 -3
  175. package/build/lib-common/objs-on-disk/v1-obj-file-format.js +14 -14
  176. package/build/lib-common/processes/labelled-exec-pools.d.ts +1 -1
  177. package/build/lib-common/processes/labelled-exec-pools.js +1 -1
  178. package/build/lib-common/processes/pressure.js +2 -2
  179. package/build/lib-common/processes/synced.js +1 -1
  180. package/build/lib-common/processes/timeout.js +2 -2
  181. package/build/lib-common/random-node.js +7 -7
  182. package/build/lib-common/service-api/3nstorage/owner.d.ts +95 -39
  183. package/build/lib-common/service-api/3nstorage/owner.js +82 -40
  184. package/build/lib-common/service-api/asmail/delivery.js +2 -2
  185. package/build/lib-common/service-api/asmail/retrieval.js +1 -1
  186. package/build/lib-common/timed-cache.d.ts +1 -0
  187. package/build/lib-common/timed-non-weak-cache.d.ts +1 -0
  188. package/build/lib-common/timed-non-weak-cache.js +11 -0
  189. package/build/lib-common/utils-for-observables.js +4 -4
  190. package/build/lib-common/weak-cache.d.ts +1 -0
  191. package/build/lib-common/weak-cache.js +12 -1
  192. package/build/lib-index.d.ts +2 -1
  193. package/build/lib-index.js +10 -7
  194. package/build/protos/asmail.proto.js +12955 -7496
  195. package/build/protos/file.proto.js +4867 -2744
  196. package/build/protos/fs.proto.js +9227 -3768
  197. package/package.json +6 -5
  198. package/protos/file.proto +91 -19
  199. package/protos/fs.proto +107 -8
@@ -21,7 +21,7 @@ const deferred_1 = require("./deferred");
21
21
  const sleep_1 = require("./sleep");
22
22
  function callWithTimeout(f, timeout, timeoutErr) {
23
23
  let isDone = false;
24
- const deferred = deferred_1.defer();
24
+ const deferred = (0, deferred_1.defer)();
25
25
  f().then(res => {
26
26
  if (isDone) {
27
27
  return;
@@ -35,7 +35,7 @@ function callWithTimeout(f, timeout, timeoutErr) {
35
35
  isDone = true;
36
36
  deferred.reject(err);
37
37
  });
38
- sleep_1.sleep(timeout).then(() => {
38
+ (0, sleep_1.sleep)(timeout).then(() => {
39
39
  if (isDone) {
40
40
  return;
41
41
  }
@@ -19,11 +19,11 @@ exports.stringOfB64Chars = exports.stringOfB64UrlSafeChars = exports.stringOfB64
19
19
  const buffer_utils_1 = require("./buffer-utils");
20
20
  const crypto_1 = require("crypto");
21
21
  function bytesSync(numOfBytes) {
22
- return crypto_1.randomBytes(numOfBytes);
22
+ return (0, crypto_1.randomBytes)(numOfBytes);
23
23
  }
24
24
  exports.bytesSync = bytesSync;
25
25
  function bytes(numOfBytes) {
26
- return new Promise((res, rej) => crypto_1.randomBytes(numOfBytes, (err, buf) => {
26
+ return new Promise((res, rej) => (0, crypto_1.randomBytes)(numOfBytes, (err, buf) => {
27
27
  if (err) {
28
28
  rej(err);
29
29
  }
@@ -34,15 +34,15 @@ function bytes(numOfBytes) {
34
34
  }
35
35
  exports.bytes = bytes;
36
36
  function uint8Sync() {
37
- return crypto_1.randomBytes(1)[0];
37
+ return (0, crypto_1.randomBytes)(1)[0];
38
38
  }
39
39
  exports.uint8Sync = uint8Sync;
40
40
  async function uint8() {
41
- return (await crypto_1.randomBytes(1))[0];
41
+ return (await (0, crypto_1.randomBytes)(1))[0];
42
42
  }
43
43
  exports.uint8 = uint8;
44
44
  function uint48Sync() {
45
- const b = crypto_1.randomBytes(6);
45
+ const b = (0, crypto_1.randomBytes)(6);
46
46
  const l = b[0] + (b[1] << 8) + (b[2] << 16) + (b[3] << 24);
47
47
  const h = b[4] + (b[5] << 8);
48
48
  return h * 0x100000000 + l;
@@ -57,13 +57,13 @@ async function uint48() {
57
57
  exports.uint48 = uint48;
58
58
  function stringOfB64UrlSafeCharsSync(numOfChars) {
59
59
  const numOfbytes = 3 * (1 + Math.floor(numOfChars / 4));
60
- const byteArr = crypto_1.randomBytes(numOfbytes);
60
+ const byteArr = (0, crypto_1.randomBytes)(numOfbytes);
61
61
  return buffer_utils_1.base64urlSafe.pack(byteArr).substring(0, numOfChars);
62
62
  }
63
63
  exports.stringOfB64UrlSafeCharsSync = stringOfB64UrlSafeCharsSync;
64
64
  function stringOfB64CharsSync(numOfChars) {
65
65
  const numOfbytes = 3 * (1 + Math.floor(numOfChars / 4));
66
- return crypto_1.randomBytes(numOfbytes).toString('base64').substring(0, numOfChars);
66
+ return (0, crypto_1.randomBytes)(numOfbytes).toString('base64').substring(0, numOfChars);
67
67
  }
68
68
  exports.stringOfB64CharsSync = stringOfB64CharsSync;
69
69
  async function stringOfB64UrlSafeChars(numOfChars) {
@@ -66,10 +66,6 @@ export interface GetObjQueryOpts {
66
66
  ver?: number;
67
67
  }
68
68
  export interface PutObjFirstQueryOpts {
69
- /**
70
- * This is a flag to indicate that new object should be created.
71
- */
72
- create?: boolean;
73
69
  /**
74
70
  * This parameter is object's new version.
75
71
  */
@@ -109,6 +105,7 @@ export interface PutObjSecondQueryOpts {
109
105
  export declare namespace currentObj {
110
106
  const EXPRESS_URL_END = "obj/:objId/current";
111
107
  function getReqUrlEnd(objId: string, opts?: GetObjQueryOpts): string;
108
+ function delReqUrlEnd(objId: string, ver?: number): string;
112
109
  function firstPutReqUrlEnd(objId: string, opts: PutObjFirstQueryOpts): string;
113
110
  function secondPutReqUrlEnd(objId: string, opts: PutObjSecondQueryOpts): string;
114
111
  interface ReplyToPut {
@@ -157,24 +154,20 @@ export declare namespace currentRootObj {
157
154
  }
158
155
  export declare namespace archivedObjVersion {
159
156
  const EXPRESS_URL_END = "/obj/:objId/archived";
160
- function getReqUrlEnd(objId: string, version: number, opts?: GetObjQueryOpts): string;
157
+ function getReqUrlEnd(objId: string, opts: GetObjQueryOpts): string;
161
158
  const SC: {
162
159
  okGet: number;
163
- okDelete: number;
164
- missing: number;
165
- concurrentTransaction: number;
166
- incompatibleObjState: number;
160
+ unknownObj: number;
161
+ unknownObjVer: number;
167
162
  };
168
163
  }
169
164
  export declare namespace archivedRootVersion {
170
165
  const EXPRESS_URL_END = "root/archived";
171
- function getReqUrlEnd(version: number, opts?: GetObjQueryOpts): string;
166
+ function getReqUrlEnd(opts: GetObjQueryOpts): string;
172
167
  const SC: {
173
168
  okGet: number;
174
- okDelete: number;
175
- missing: number;
176
- concurrentTransaction: number;
177
- incompatibleObjState: number;
169
+ unknownObj: number;
170
+ unknownObjVer: number;
178
171
  };
179
172
  }
180
173
  export interface DiffInfo {
@@ -218,21 +211,48 @@ export declare namespace cancelRootTransaction {
218
211
  missing: number;
219
212
  };
220
213
  }
214
+ export interface ObjStatus {
215
+ current?: number;
216
+ archived?: number[];
217
+ }
218
+ export declare namespace objStatus {
219
+ const EXPRESS_URL_END = "obj/:objId/status";
220
+ function getReqUrlEnd(objId: string): string;
221
+ type Reply = ObjStatus;
222
+ const SC: {
223
+ ok: number;
224
+ unknownObj: number;
225
+ };
226
+ }
227
+ export declare namespace rootStatus {
228
+ const EXPRESS_URL_END = "root/status";
229
+ function getReqUrlEnd(): string;
230
+ type Reply = ObjStatus;
231
+ const SC: {
232
+ ok: number;
233
+ unknownObj: number;
234
+ };
235
+ }
221
236
  export declare namespace archiveObj {
222
237
  const EXPRESS_URL_END = "obj/:objId/archive";
223
- function getReqUrlEnd(objId: string): string;
238
+ function postAndDelReqUrlEnd(objId: string, version: number): string;
239
+ type VersionsList = number[];
224
240
  const SC: {
225
- okGet: number;
226
- okPut: number;
227
- missing: number;
241
+ okPost: number;
242
+ okDelete: number;
243
+ unknownObj: number;
244
+ unknownObjVer: number;
228
245
  };
229
246
  }
230
247
  export declare namespace archiveRoot {
231
- const URL_END = "root/archive";
248
+ const EXPRESS_URL_END = "root/archive";
249
+ function postAndDelReqUrlEnd(version: number): string;
250
+ type VersionsList = archiveObj.VersionsList;
232
251
  const SC: {
233
- okGet: number;
234
- okPut: number;
235
- missing: number;
252
+ okPost: number;
253
+ okDelete: number;
254
+ unknownObj: number;
255
+ unknownObjVer: number;
236
256
  };
237
257
  }
238
258
  export interface ErrorReply {
@@ -244,23 +264,59 @@ export declare namespace wsEventChannel {
244
264
  ok: number;
245
265
  };
246
266
  }
247
- export declare namespace objChanged {
248
- const EVENT_NAME = "obj-changed";
249
- interface Event {
250
- /**
251
- * This indentifies a non-root object by its string id, while null value
252
- * identifies root object.
253
- */
254
- objId: string | null;
255
- newVer: number;
267
+ export declare namespace events {
268
+ namespace objChanged {
269
+ const EVENT_NAME = "obj-changed";
270
+ interface Event {
271
+ /**
272
+ * This indentifies a non-root object by its string id, while null
273
+ * value identifies root object.
274
+ */
275
+ objId: string | null;
276
+ /**
277
+ * New current version on the server.
278
+ */
279
+ newVer: number;
280
+ }
256
281
  }
257
- }
258
- export declare namespace objRemoved {
259
- const EVENT_NAME = "obj-removed";
260
- interface Event {
261
- /**
262
- * This indentifies a removed non-root object by its string id.
263
- */
264
- objId: string;
282
+ namespace objRemoved {
283
+ const EVENT_NAME = "obj-removed";
284
+ interface Event {
285
+ /**
286
+ * This indentifies a removed non-root object by its string id.
287
+ */
288
+ objId: string;
289
+ }
290
+ }
291
+ namespace objVersionArchived {
292
+ const EVENT_NAME = "obj-ver-archived";
293
+ interface Event {
294
+ /**
295
+ * This indentifies a non-root object by its string id, while null
296
+ * value identifies root object.
297
+ */
298
+ objId: string | null;
299
+ /**
300
+ * Version that was set archived on the server.
301
+ */
302
+ archivedVer: number;
303
+ }
304
+ }
305
+ namespace objArchivedVersionRemoved {
306
+ const EVENT_NAME = "obj-ver-removed";
307
+ interface Event {
308
+ /**
309
+ * This indentifies a non-root object by its string id, while null
310
+ * value identifies root object.
311
+ */
312
+ objId: string | null;
313
+ /**
314
+ * Archived version that was removed on the server.
315
+ */
316
+ archivedVer: number;
317
+ }
265
318
  }
319
+ const all: string[];
320
+ type EventNameType = (typeof objChanged.EVENT_NAME) | (typeof objRemoved.EVENT_NAME) | (typeof objVersionArchived.EVENT_NAME) | (typeof objArchivedVersionRemoved.EVENT_NAME);
321
+ type AllTypes = objChanged.Event | objRemoved.Event | objVersionArchived.Event | objArchivedVersionRemoved.Event;
266
322
  }
@@ -16,7 +16,7 @@
16
16
  this program. If not, see <http://www.gnu.org/licenses/>.
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.objRemoved = exports.objChanged = exports.wsEventChannel = exports.archiveRoot = exports.archiveObj = exports.cancelRootTransaction = exports.cancelTransaction = exports.addDiffSectionTo = exports.sanitizedDiff = exports.archivedRootVersion = exports.archivedObjVersion = exports.currentRootObj = exports.currentObj = exports.keyDerivParams = exports.PARAM_SC = exports.sessionParams = exports.closeSession = exports.midLogin = exports.BIN_TYPE = exports.HTTP_HEADER = exports.ERR_SC = void 0;
19
+ exports.events = exports.wsEventChannel = exports.archiveRoot = exports.archiveObj = exports.rootStatus = exports.objStatus = exports.cancelRootTransaction = exports.cancelTransaction = exports.addDiffSectionTo = exports.sanitizedDiff = exports.archivedRootVersion = exports.archivedObjVersion = exports.currentRootObj = exports.currentObj = exports.keyDerivParams = exports.PARAM_SC = exports.sessionParams = exports.closeSession = exports.midLogin = exports.BIN_TYPE = exports.HTTP_HEADER = exports.ERR_SC = void 0;
20
20
  /**
21
21
  * This defines interfaces for 3nstorage owner's requests.
22
22
  */
@@ -76,15 +76,19 @@ var currentObj;
76
76
  (function (currentObj) {
77
77
  currentObj.EXPRESS_URL_END = 'obj/:objId/current';
78
78
  function getReqUrlEnd(objId, opts) {
79
- return `obj/${objId}/current${opts ? `?${querystring_1.stringify(opts)}` : ''}`;
79
+ return `obj/${objId}/current${opts ? `?${(0, querystring_1.stringify)(opts)}` : ''}`;
80
80
  }
81
81
  currentObj.getReqUrlEnd = getReqUrlEnd;
82
+ function delReqUrlEnd(objId, ver) {
83
+ return `obj/${objId}/current${ver ? `?${(0, querystring_1.stringify)({ ver })}` : ''}`;
84
+ }
85
+ currentObj.delReqUrlEnd = delReqUrlEnd;
82
86
  function firstPutReqUrlEnd(objId, opts) {
83
- return `obj/${objId}/current?${querystring_1.stringify(opts)}`;
87
+ return `obj/${objId}/current?${(0, querystring_1.stringify)(opts)}`;
84
88
  }
85
89
  currentObj.firstPutReqUrlEnd = firstPutReqUrlEnd;
86
90
  function secondPutReqUrlEnd(objId, opts) {
87
- return `obj/${objId}/current?${querystring_1.stringify(opts)}`;
91
+ return `obj/${objId}/current?${(0, querystring_1.stringify)(opts)}`;
88
92
  }
89
93
  currentObj.secondPutReqUrlEnd = secondPutReqUrlEnd;
90
94
  currentObj.SC = {
@@ -106,15 +110,15 @@ var currentRootObj;
106
110
  (function (currentRootObj) {
107
111
  currentRootObj.EXPRESS_URL_END = 'root/current';
108
112
  function getReqUrlEnd(opts) {
109
- return `root/current${opts ? `?${querystring_1.stringify(opts)}` : ''}`;
113
+ return `root/current${opts ? `?${(0, querystring_1.stringify)(opts)}` : ''}`;
110
114
  }
111
115
  currentRootObj.getReqUrlEnd = getReqUrlEnd;
112
116
  function firstPutReqUrlEnd(opts) {
113
- return `root/current?${querystring_1.stringify(opts)}`;
117
+ return `root/current?${(0, querystring_1.stringify)(opts)}`;
114
118
  }
115
119
  currentRootObj.firstPutReqUrlEnd = firstPutReqUrlEnd;
116
120
  function secondPutReqUrlEnd(opts) {
117
- return `root/current?${querystring_1.stringify(opts)}`;
121
+ return `root/current?${(0, querystring_1.stringify)(opts)}`;
118
122
  }
119
123
  currentRootObj.secondPutReqUrlEnd = secondPutReqUrlEnd;
120
124
  currentRootObj.SC = currentObj.SC;
@@ -123,32 +127,22 @@ Object.freeze(currentRootObj);
123
127
  var archivedObjVersion;
124
128
  (function (archivedObjVersion) {
125
129
  archivedObjVersion.EXPRESS_URL_END = '/obj/:objId/archived';
126
- function getReqUrlEnd(objId, version, opts) {
127
- if (opts) {
128
- opts.ver = version;
129
- }
130
- const query = (opts ? `?${querystring_1.stringify(opts)}` : '');
131
- return `/obj/${objId}/archived${query}`;
130
+ function getReqUrlEnd(objId, opts) {
131
+ return `/obj/${objId}/archived?${(0, querystring_1.stringify)(opts)}`;
132
132
  }
133
133
  archivedObjVersion.getReqUrlEnd = getReqUrlEnd;
134
134
  archivedObjVersion.SC = {
135
135
  okGet: 200,
136
- okDelete: 200,
137
- missing: 474,
138
- concurrentTransaction: 483,
139
- incompatibleObjState: 484
136
+ unknownObj: 474,
137
+ unknownObjVer: 494
140
138
  };
141
139
  })(archivedObjVersion = exports.archivedObjVersion || (exports.archivedObjVersion = {}));
142
140
  Object.freeze(archivedObjVersion);
143
141
  var archivedRootVersion;
144
142
  (function (archivedRootVersion) {
145
143
  archivedRootVersion.EXPRESS_URL_END = 'root/archived';
146
- function getReqUrlEnd(version, opts) {
147
- if (opts) {
148
- opts.ver = version;
149
- }
150
- const query = (opts ? `?${querystring_1.stringify(opts)}` : '');
151
- return `root/archived${query}`;
144
+ function getReqUrlEnd(opts) {
145
+ return `root/archived?${(0, querystring_1.stringify)(opts)}`;
152
146
  }
153
147
  archivedRootVersion.getReqUrlEnd = getReqUrlEnd;
154
148
  archivedRootVersion.SC = archivedObjVersion.SC;
@@ -230,23 +224,51 @@ var cancelRootTransaction;
230
224
  cancelRootTransaction.SC = cancelTransaction.SC;
231
225
  })(cancelRootTransaction = exports.cancelRootTransaction || (exports.cancelRootTransaction = {}));
232
226
  Object.freeze(cancelRootTransaction);
227
+ var objStatus;
228
+ (function (objStatus) {
229
+ objStatus.EXPRESS_URL_END = 'obj/:objId/status';
230
+ function getReqUrlEnd(objId) {
231
+ return `obj/${objId}/status`;
232
+ }
233
+ objStatus.getReqUrlEnd = getReqUrlEnd;
234
+ objStatus.SC = {
235
+ ok: 200,
236
+ unknownObj: 474,
237
+ };
238
+ })(objStatus = exports.objStatus || (exports.objStatus = {}));
239
+ Object.freeze(objStatus);
240
+ var rootStatus;
241
+ (function (rootStatus) {
242
+ rootStatus.EXPRESS_URL_END = 'root/status';
243
+ function getReqUrlEnd() {
244
+ return 'root/status';
245
+ }
246
+ rootStatus.getReqUrlEnd = getReqUrlEnd;
247
+ rootStatus.SC = objStatus.SC;
248
+ })(rootStatus = exports.rootStatus || (exports.rootStatus = {}));
249
+ Object.freeze(rootStatus);
233
250
  var archiveObj;
234
251
  (function (archiveObj) {
235
252
  archiveObj.EXPRESS_URL_END = 'obj/:objId/archive';
236
- function getReqUrlEnd(objId) {
237
- return `obj/${objId}/archive`;
253
+ function postAndDelReqUrlEnd(objId, version) {
254
+ return `obj/${objId}/archive?ver=${version}`;
238
255
  }
239
- archiveObj.getReqUrlEnd = getReqUrlEnd;
256
+ archiveObj.postAndDelReqUrlEnd = postAndDelReqUrlEnd;
240
257
  archiveObj.SC = {
241
- okGet: 200,
242
- okPut: 201,
243
- missing: 474
258
+ okPost: 200,
259
+ okDelete: 200,
260
+ unknownObj: 474,
261
+ unknownObjVer: 494
244
262
  };
245
263
  })(archiveObj = exports.archiveObj || (exports.archiveObj = {}));
246
264
  Object.freeze(archiveObj);
247
265
  var archiveRoot;
248
266
  (function (archiveRoot) {
249
- archiveRoot.URL_END = 'root/archive';
267
+ archiveRoot.EXPRESS_URL_END = 'root/archive';
268
+ function postAndDelReqUrlEnd(version) {
269
+ return `root/archive?ver=${version}`;
270
+ }
271
+ archiveRoot.postAndDelReqUrlEnd = postAndDelReqUrlEnd;
250
272
  archiveRoot.SC = archiveObj.SC;
251
273
  })(archiveRoot = exports.archiveRoot || (exports.archiveRoot = {}));
252
274
  Object.freeze(archiveRoot);
@@ -259,14 +281,34 @@ var wsEventChannel;
259
281
  Object.freeze(wsEventChannel.SC);
260
282
  })(wsEventChannel = exports.wsEventChannel || (exports.wsEventChannel = {}));
261
283
  Object.freeze(wsEventChannel);
262
- var objChanged;
263
- (function (objChanged) {
264
- objChanged.EVENT_NAME = 'obj-changed';
265
- })(objChanged = exports.objChanged || (exports.objChanged = {}));
266
- Object.freeze(objChanged);
267
- var objRemoved;
268
- (function (objRemoved) {
269
- objRemoved.EVENT_NAME = 'obj-removed';
270
- })(objRemoved = exports.objRemoved || (exports.objRemoved = {}));
271
- Object.freeze(objChanged);
284
+ var events;
285
+ (function (events) {
286
+ let objChanged;
287
+ (function (objChanged) {
288
+ objChanged.EVENT_NAME = 'obj-changed';
289
+ })(objChanged = events.objChanged || (events.objChanged = {}));
290
+ Object.freeze(objChanged);
291
+ let objRemoved;
292
+ (function (objRemoved) {
293
+ objRemoved.EVENT_NAME = 'obj-removed';
294
+ })(objRemoved = events.objRemoved || (events.objRemoved = {}));
295
+ Object.freeze(objRemoved);
296
+ let objVersionArchived;
297
+ (function (objVersionArchived) {
298
+ objVersionArchived.EVENT_NAME = 'obj-ver-archived';
299
+ })(objVersionArchived = events.objVersionArchived || (events.objVersionArchived = {}));
300
+ Object.freeze(objVersionArchived);
301
+ let objArchivedVersionRemoved;
302
+ (function (objArchivedVersionRemoved) {
303
+ objArchivedVersionRemoved.EVENT_NAME = 'obj-ver-removed';
304
+ })(objArchivedVersionRemoved = events.objArchivedVersionRemoved || (events.objArchivedVersionRemoved = {}));
305
+ Object.freeze(objArchivedVersionRemoved);
306
+ events.all = [
307
+ objChanged.EVENT_NAME,
308
+ objRemoved.EVENT_NAME,
309
+ objVersionArchived.EVENT_NAME,
310
+ objArchivedVersionRemoved.EVENT_NAME,
311
+ ];
312
+ })(events = exports.events || (exports.events = {}));
313
+ Object.freeze(events);
272
314
  Object.freeze(exports);
@@ -97,11 +97,11 @@ var msgObj;
97
97
  (function (msgObj) {
98
98
  msgObj.EXPRESS_URL_END = 'msg/obj/:objId';
99
99
  function firstPutReqUrlEnd(objId, opts) {
100
- return `msg/obj/${objId}?${querystring_1.stringify(opts)}`;
100
+ return `msg/obj/${objId}?${(0, querystring_1.stringify)(opts)}`;
101
101
  }
102
102
  msgObj.firstPutReqUrlEnd = firstPutReqUrlEnd;
103
103
  function secondPutReqUrlEnd(objId, opts) {
104
- return `msg/obj/${objId}?${querystring_1.stringify(opts)}`;
104
+ return `msg/obj/${objId}?${(0, querystring_1.stringify)(opts)}`;
105
105
  }
106
106
  msgObj.secondPutReqUrlEnd = secondPutReqUrlEnd;
107
107
  msgObj.SC = {
@@ -114,7 +114,7 @@ var msgObj;
114
114
  (function (msgObj) {
115
115
  msgObj.EXPRESS_URL_END = 'msg/:msgId/obj/:objId';
116
116
  function genUrlEnd(msgId, objId, opts) {
117
- let optStr = (opts ? '?' + querystring_1.stringify(opts) : '');
117
+ let optStr = (opts ? '?' + (0, querystring_1.stringify)(opts) : '');
118
118
  return `msg/${msgId}/obj/${objId}${optStr}`;
119
119
  }
120
120
  msgObj.genUrlEnd = genUrlEnd;
@@ -4,6 +4,7 @@ export interface TimedCache<TKey, TVal> {
4
4
  resetLifeTimeOf(key: TKey): boolean;
5
5
  set(key: TKey, val: TVal): void;
6
6
  delete(key: TKey): void;
7
+ keys(): TKey[];
7
8
  clear(): void;
8
9
  destroy(): void;
9
10
  }
@@ -10,6 +10,7 @@ export declare class TimeWindowCache<TKey, TVal> implements TimedCache<TKey, TVa
10
10
  has(key: TKey): boolean;
11
11
  set(key: TKey, val: TVal): void;
12
12
  delete(key: TKey): void;
13
+ keys(): TKey[];
13
14
  clear(): void;
14
15
  destroy(): void;
15
16
  }
@@ -43,6 +43,7 @@ class TimeWindowCache {
43
43
  }
44
44
  v = this.waiting.get(key);
45
45
  if (v !== undefined) {
46
+ this.waiting.delete(key);
46
47
  this.filling.set(key, v);
47
48
  }
48
49
  return v;
@@ -57,6 +58,16 @@ class TimeWindowCache {
57
58
  this.filling.delete(key);
58
59
  this.waiting.delete(key);
59
60
  }
61
+ keys() {
62
+ const allKeys = [];
63
+ for (const key of this.filling.keys()) {
64
+ allKeys.push(key);
65
+ }
66
+ for (const key of this.waiting.keys()) {
67
+ allKeys.push(key);
68
+ }
69
+ return allKeys;
70
+ }
60
71
  clear() {
61
72
  this.filling.clear();
62
73
  this.waiting.clear();
@@ -46,15 +46,15 @@ function allowOnlySingleStart() {
46
46
  throw new Error(`Attempt to subscribe, when process hasn't completed indicates that functional closure is captured and called somewhere else, not in accordance with expected rxjs processing.`);
47
47
  }
48
48
  if (okCompletion) {
49
- return rxjs_1.of().subscribe(downstream);
49
+ return (0, rxjs_1.of)().subscribe(downstream);
50
50
  }
51
51
  else {
52
- return rxjs_1.throwError(err).subscribe(downstream);
52
+ return (0, rxjs_1.throwError)(err).subscribe(downstream);
53
53
  }
54
54
  }
55
55
  else {
56
56
  wasStarted = true;
57
- return src.pipe(operators_1.tap({
57
+ return src.pipe((0, operators_1.tap)({
58
58
  error: e => {
59
59
  isComplete = true;
60
60
  err = e;
@@ -113,7 +113,7 @@ function noop() { }
113
113
  class Broadcast {
114
114
  constructor() {
115
115
  this.src = new rxjs_1.Subject();
116
- this.event$ = this.src.asObservable().pipe(operators_1.share());
116
+ this.event$ = this.src.asObservable().pipe((0, operators_1.share)());
117
117
  this.sub = this.event$.subscribe(toRxObserver({}));
118
118
  Object.seal(this);
119
119
  }
@@ -21,6 +21,7 @@ export declare class WeakCacheWithMinLifeTime<TKey, TVal> implements TimedCache<
21
21
  resetLifeTimeOf(key: TKey): boolean;
22
22
  set(key: TKey, val: TVal): void;
23
23
  delete(key: TKey): void;
24
+ keys(): TKey[];
24
25
  clear(): void;
25
26
  destroy(): void;
26
27
  }
@@ -48,7 +48,7 @@ class WeakCache {
48
48
  return (this.get(key) !== undefined);
49
49
  }
50
50
  set(key, val) {
51
- const wRef = weakref_1.makeWeakRefFor(val);
51
+ const wRef = (0, weakref_1.makeWeakRefFor)(val);
52
52
  wRef.addCallback(this.makeCB(key, wRef));
53
53
  this.wRefs.set(key, wRef);
54
54
  }
@@ -91,6 +91,7 @@ class WeakCacheWithMinLifeTime {
91
91
  }
92
92
  v = this.waiting.get(key);
93
93
  if (v !== undefined) {
94
+ this.waiting.delete(key);
94
95
  this.filling.set(key, v);
95
96
  return v;
96
97
  }
@@ -117,6 +118,16 @@ class WeakCacheWithMinLifeTime {
117
118
  this.waiting.delete(key);
118
119
  this.wCache.delete(key);
119
120
  }
121
+ keys() {
122
+ const allKeys = [];
123
+ for (const key of this.filling.keys()) {
124
+ allKeys.push(key);
125
+ }
126
+ for (const key of this.waiting.keys()) {
127
+ allKeys.push(key);
128
+ }
129
+ return allKeys;
130
+ }
120
131
  clear() {
121
132
  this.filling.clear();
122
133
  this.waiting.clear();
@@ -2,7 +2,8 @@
2
2
  export * from "./core";
3
3
  export { makeServiceLocator, ServiceLocatorMaker } from "./lib-client/service-locator";
4
4
  export { makeNetClient } from "./lib-client/request-utils";
5
- export { sysFolders, initSysFolders, FactoryOfFSs, PerAppStorage, sysFilesOnDevice, userFilesOnDevice, reverseDomain } from "./core/storage";
5
+ export { FactoryOfFSs, PerAppStorage, reverseDomain } from "./core/storage";
6
+ export { sysFolders } from "./core/storage/system-folders";
6
7
  export { DeviceFS } from './lib-client/local-files/device-fs';
7
8
  export { appDirs } from './core/app-files';
8
9
  export { makeLogger } from './lib-client/logging/log-to-file';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /*
3
- Copyright (C) 2020 - 2021 3NSoft Inc.
3
+ Copyright (C) 2020 - 2022 3NSoft Inc.
4
4
 
5
5
  This program is free software: you can redistribute it and/or modify it under
6
6
  the terms of the GNU General Public License as published by the Free Software
@@ -17,27 +17,30 @@
17
17
  */
18
18
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
19
19
  if (k2 === undefined) k2 = k;
20
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
+ var desc = Object.getOwnPropertyDescriptor(m, k);
21
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
22
+ desc = { enumerable: true, get: function() { return m[k]; } };
23
+ }
24
+ Object.defineProperty(o, k2, desc);
21
25
  }) : (function(o, m, k, k2) {
22
26
  if (k2 === undefined) k2 = k;
23
27
  o[k2] = m[k];
24
28
  }));
25
29
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
30
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
31
  };
28
32
  Object.defineProperty(exports, "__esModule", { value: true });
33
+ exports.makeLogger = exports.appDirs = exports.DeviceFS = exports.sysFolders = exports.reverseDomain = exports.PerAppStorage = exports.makeNetClient = exports.makeServiceLocator = void 0;
29
34
  __exportStar(require("./core"), exports);
30
35
  var service_locator_1 = require("./lib-client/service-locator");
31
36
  Object.defineProperty(exports, "makeServiceLocator", { enumerable: true, get: function () { return service_locator_1.makeServiceLocator; } });
32
37
  var request_utils_1 = require("./lib-client/request-utils");
33
38
  Object.defineProperty(exports, "makeNetClient", { enumerable: true, get: function () { return request_utils_1.makeNetClient; } });
34
39
  var storage_1 = require("./core/storage");
35
- Object.defineProperty(exports, "sysFolders", { enumerable: true, get: function () { return storage_1.sysFolders; } });
36
- Object.defineProperty(exports, "initSysFolders", { enumerable: true, get: function () { return storage_1.initSysFolders; } });
37
40
  Object.defineProperty(exports, "PerAppStorage", { enumerable: true, get: function () { return storage_1.PerAppStorage; } });
38
- Object.defineProperty(exports, "sysFilesOnDevice", { enumerable: true, get: function () { return storage_1.sysFilesOnDevice; } });
39
- Object.defineProperty(exports, "userFilesOnDevice", { enumerable: true, get: function () { return storage_1.userFilesOnDevice; } });
40
41
  Object.defineProperty(exports, "reverseDomain", { enumerable: true, get: function () { return storage_1.reverseDomain; } });
42
+ var system_folders_1 = require("./core/storage/system-folders");
43
+ Object.defineProperty(exports, "sysFolders", { enumerable: true, get: function () { return system_folders_1.sysFolders; } });
41
44
  var device_fs_1 = require("./lib-client/local-files/device-fs");
42
45
  Object.defineProperty(exports, "DeviceFS", { enumerable: true, get: function () { return device_fs_1.DeviceFS; } });
43
46
  var app_files_1 = require("./core/app-files");