core-3nweb-client-lib 0.25.6 → 0.27.0
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 +2 -2
- package/build/api-defs/asmail.d.ts +1 -1
- package/build/api-defs/files.d.ts +282 -70
- package/build/core/app-files.js +7 -7
- package/build/core/asmail/config/common.js +4 -4
- package/build/core/asmail/config/index.js +2 -2
- package/build/core/asmail/config/published-intro-key.js +1 -1
- package/build/core/asmail/delivery/common.js +7 -7
- package/build/core/asmail/delivery/index.js +7 -6
- package/build/core/asmail/delivery/msg.js +8 -7
- package/build/core/asmail/delivery/per-recipient-wip.js +3 -3
- package/build/core/asmail/inbox/attachments/fs.js +11 -1
- package/build/core/asmail/inbox/cached-msgs.js +3 -3
- package/build/core/asmail/inbox/inbox-events.js +5 -4
- package/build/core/asmail/inbox/index.js +12 -12
- package/build/core/asmail/inbox/msg-downloader.js +3 -3
- package/build/core/asmail/inbox/msg-indexing.js +4 -4
- package/build/core/asmail/inbox/msg-on-disk.js +7 -7
- package/build/core/asmail/index.d.ts +3 -3
- package/build/core/asmail/index.js +13 -8
- package/build/core/asmail/key-verification.js +5 -5
- package/build/core/asmail/keyring/common.js +7 -6
- package/build/core/asmail/keyring/correspondent-keys.js +8 -7
- package/build/core/asmail/keyring/id-to-email-map.js +2 -1
- package/build/core/asmail/keyring/index.d.ts +7 -8
- package/build/core/asmail/keyring/index.js +15 -14
- package/build/core/asmail/keyring/keyring-storage.js +4 -3
- package/build/core/asmail/msg/opener.js +3 -3
- package/build/core/asmail/msg/packer.js +13 -13
- package/build/core/asmail/sending-params/own-params.js +4 -4
- package/build/core/asmail/sending-params/params-from-others.js +3 -3
- package/build/core/id-manager.js +8 -5
- package/build/core/index.d.ts +2 -1
- package/build/core/index.js +14 -14
- package/build/core/sign-in.d.ts +5 -4
- package/build/core/sign-in.js +12 -14
- package/build/core/sign-up.d.ts +1 -0
- package/build/core/sign-up.js +15 -11
- package/build/core/storage/common/json-saving.d.ts +21 -0
- package/build/core/storage/common/json-saving.js +82 -0
- package/build/core/storage/common/obj-info-file.d.ts +51 -0
- package/build/core/storage/common/obj-info-file.js +153 -5
- package/build/core/storage/common/utils.d.ts +2 -0
- package/build/core/storage/common/utils.js +32 -0
- package/build/core/storage/index.d.ts +3 -17
- package/build/core/storage/index.js +57 -77
- package/build/core/storage/local/obj-files-gc.d.ts +2 -0
- package/build/core/storage/local/obj-files-gc.js +53 -39
- package/build/core/storage/local/obj-files.d.ts +6 -9
- package/build/core/storage/local/obj-files.js +16 -19
- package/build/core/storage/local/obj-status.d.ts +20 -30
- package/build/core/storage/local/obj-status.js +46 -113
- package/build/core/storage/local/storage.d.ts +15 -5
- package/build/core/storage/local/storage.js +37 -18
- package/build/core/storage/synced/downloader.js +7 -6
- package/build/core/storage/synced/obj-files-gc.d.ts +6 -1
- package/build/core/storage/synced/obj-files-gc.js +106 -13
- package/build/core/storage/synced/obj-files.d.ts +46 -47
- package/build/core/storage/synced/obj-files.js +207 -154
- package/build/core/storage/synced/obj-status.d.ts +103 -42
- package/build/core/storage/synced/obj-status.js +525 -137
- package/build/core/storage/synced/remote-events.d.ts +11 -12
- package/build/core/storage/synced/remote-events.js +80 -57
- package/build/core/storage/synced/storage.d.ts +24 -5
- package/build/core/storage/synced/storage.js +123 -38
- package/build/core/storage/synced/upload-header-file.d.ts +4 -0
- package/build/core/storage/synced/upload-header-file.js +64 -0
- package/build/core/storage/synced/upsyncer.d.ts +15 -9
- package/build/core/storage/synced/upsyncer.js +219 -246
- package/build/core/storage/system-folders/apps-data.d.ts +16 -0
- package/build/core/storage/system-folders/apps-data.js +110 -0
- package/build/core/storage/system-folders/index.d.ts +18 -0
- package/build/core/storage/system-folders/index.js +77 -0
- package/build/core-ipc/common-caps.js +3 -3
- package/build/core-ipc/generic.js +8 -8
- package/build/core-ipc/startup-caps.js +2 -2
- package/build/cryptors.js +6 -2
- package/build/ipc-via-protobuf/asmail-cap.js +67 -83
- package/build/ipc-via-protobuf/bytes.js +16 -17
- package/build/ipc-via-protobuf/connector-clients-side.d.ts +3 -0
- package/build/ipc-via-protobuf/connector-clients-side.js +62 -25
- package/build/ipc-via-protobuf/connector-services-side.js +10 -10
- package/build/ipc-via-protobuf/connector.js +4 -4
- package/build/ipc-via-protobuf/file.d.ts +48 -12
- package/build/ipc-via-protobuf/file.js +476 -120
- package/build/ipc-via-protobuf/fs.d.ts +8 -0
- package/build/ipc-via-protobuf/fs.js +592 -159
- package/build/ipc-via-protobuf/log-cap.js +2 -2
- package/build/ipc-via-protobuf/mailerid.js +3 -3
- package/build/ipc-via-protobuf/protobuf-msg.d.ts +1 -0
- package/build/ipc-via-protobuf/protobuf-msg.js +11 -7
- package/build/ipc-via-protobuf/startup-cap.js +23 -23
- package/build/ipc-via-protobuf/storage-cap.js +12 -12
- package/build/ipc.js +7 -2
- package/build/lib-client/3nstorage/exceptions.d.ts +12 -8
- package/build/lib-client/3nstorage/exceptions.js +31 -10
- package/build/lib-client/3nstorage/service.d.ts +16 -2
- package/build/lib-client/3nstorage/service.js +109 -39
- package/build/lib-client/3nstorage/util/file-based-json.d.ts +2 -1
- package/build/lib-client/3nstorage/util/file-based-json.js +1 -1
- package/build/lib-client/3nstorage/xsp-fs/attrs.js +17 -17
- package/build/lib-client/3nstorage/xsp-fs/common.d.ts +52 -14
- package/build/lib-client/3nstorage/xsp-fs/common.js +31 -16
- package/build/lib-client/3nstorage/xsp-fs/file-node.d.ts +1 -0
- package/build/lib-client/3nstorage/xsp-fs/file-node.js +18 -14
- package/build/lib-client/3nstorage/xsp-fs/file.d.ts +31 -6
- package/build/lib-client/3nstorage/xsp-fs/file.js +74 -23
- package/build/lib-client/3nstorage/xsp-fs/folder-node-serialization.js +4 -4
- package/build/lib-client/3nstorage/xsp-fs/folder-node.d.ts +24 -11
- package/build/lib-client/3nstorage/xsp-fs/folder-node.js +599 -189
- package/build/lib-client/3nstorage/xsp-fs/fs.d.ts +45 -9
- package/build/lib-client/3nstorage/xsp-fs/fs.js +326 -74
- package/build/lib-client/3nstorage/xsp-fs/link-node.d.ts +1 -0
- package/build/lib-client/3nstorage/xsp-fs/link-node.js +7 -2
- package/build/lib-client/3nstorage/xsp-fs/node-in-fs.d.ts +30 -20
- package/build/lib-client/3nstorage/xsp-fs/node-in-fs.js +239 -106
- package/build/lib-client/3nstorage/xsp-fs/node-persistence.d.ts +1 -1
- package/build/lib-client/3nstorage/xsp-fs/node-persistence.js +18 -19
- package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v1.js +5 -5
- package/build/lib-client/3nstorage/xsp-fs/xsp-payload-v2.js +56 -56
- package/build/lib-client/3nweb-signup.js +4 -4
- package/build/lib-client/asmail/recipient.js +15 -15
- package/build/lib-client/asmail/sender.js +22 -22
- package/build/lib-client/asmail/service-config.js +3 -3
- package/build/lib-client/cryptor/cryptor-in-worker.js +19 -17
- package/build/lib-client/cryptor/cryptor-wasm.js +1 -1
- package/build/lib-client/cryptor/cryptor.js +4 -2
- package/build/lib-client/cryptor/cryptor.wasm +0 -0
- package/build/lib-client/cryptor/in-proc-js.js +1 -1
- package/build/lib-client/cryptor/in-proc-wasm.js +7 -7
- package/build/lib-client/cryptor/worker-js.js +2 -2
- package/build/lib-client/cryptor/worker-wasm.js +2 -2
- package/build/lib-client/files-select.js +1 -1
- package/build/lib-client/files.d.ts +1 -1
- package/build/lib-client/files.js +71 -4
- package/build/lib-client/fs-collection.js +3 -2
- package/build/lib-client/fs-sync-utils.d.ts +5 -0
- package/build/lib-client/fs-sync-utils.js +61 -0
- package/build/lib-client/fs-view.d.ts +14 -0
- package/build/lib-client/fs-view.js +33 -0
- package/build/lib-client/key-derivation.js +1 -1
- package/build/lib-client/local-files/dev-file-sink.js +9 -9
- package/build/lib-client/local-files/dev-file-src.js +2 -2
- package/build/lib-client/local-files/device-fs.d.ts +1 -1
- package/build/lib-client/local-files/device-fs.js +56 -54
- package/build/lib-client/logging/log-to-file.d.ts +1 -1
- package/build/lib-client/logging/log-to-file.js +11 -11
- package/build/lib-client/mailer-id/login.js +7 -7
- package/build/lib-client/mailer-id/provisioner.js +12 -12
- package/build/lib-client/objs-on-disk/file-writing-proc.js +5 -5
- package/build/lib-client/objs-on-disk/obj-folders.js +33 -33
- package/build/lib-client/objs-on-disk/obj-on-disk.d.ts +13 -2
- package/build/lib-client/objs-on-disk/obj-on-disk.js +24 -9
- package/build/lib-client/request-utils.d.ts +1 -0
- package/build/lib-client/request-utils.js +14 -14
- package/build/lib-client/server-events.d.ts +3 -3
- package/build/lib-client/server-events.js +12 -10
- package/build/lib-client/service-locator.js +10 -10
- package/build/lib-client/user-with-mid-session.js +7 -7
- package/build/lib-client/user-with-pkl-session.js +25 -25
- package/build/lib-client/ws-utils.js +3 -3
- package/build/lib-common/async-cryptor-wrap.js +4 -4
- package/build/lib-common/async-fs-node.d.ts +5 -3
- package/build/lib-common/async-fs-node.js +19 -18
- package/build/lib-common/byte-streaming/pipe.js +1 -1
- package/build/lib-common/byte-streaming/wrapping.js +17 -17
- package/build/lib-common/canonical-address.js +1 -1
- package/build/lib-common/exceptions/error.d.ts +1 -0
- package/build/lib-common/exceptions/error.js +7 -6
- package/build/lib-common/exceptions/file.js +10 -1
- package/build/lib-common/ipc/generic-ipc.js +2 -2
- package/build/lib-common/ipc/ws-ipc.js +2 -2
- package/build/lib-common/json-utils.js +2 -1
- package/build/lib-common/mid-sigs-NaCl-Ed.js +14 -14
- package/build/lib-common/objs-on-disk/file-layout.d.ts +19 -0
- package/build/lib-common/objs-on-disk/file-layout.js +130 -12
- package/build/lib-common/objs-on-disk/obj-file.d.ts +13 -2
- package/build/lib-common/objs-on-disk/obj-file.js +99 -37
- package/build/lib-common/objs-on-disk/utils.d.ts +1 -0
- package/build/lib-common/objs-on-disk/utils.js +4 -4
- package/build/lib-common/objs-on-disk/v1-obj-file-format.js +14 -14
- package/build/lib-common/processes/deferred.d.ts +6 -0
- package/build/lib-common/processes/deferred.js +30 -0
- package/build/lib-common/processes/labelled-exec-pools.d.ts +33 -0
- package/build/lib-common/processes/labelled-exec-pools.js +141 -0
- package/build/lib-common/processes/pressure.d.ts +7 -0
- package/build/lib-common/processes/pressure.js +56 -0
- package/build/lib-common/processes/sleep.d.ts +1 -0
- package/build/lib-common/processes/sleep.js +26 -0
- package/build/lib-common/{processes.d.ts → processes/synced.d.ts} +0 -40
- package/build/lib-common/{processes.js → processes/synced.js} +187 -204
- package/build/lib-common/processes/timeout.d.ts +1 -0
- package/build/lib-common/processes/timeout.js +51 -0
- package/build/lib-common/random-node.js +7 -7
- package/build/lib-common/service-api/3nstorage/owner.d.ts +100 -39
- package/build/lib-common/service-api/3nstorage/owner.js +85 -42
- package/build/lib-common/service-api/asmail/delivery.js +2 -2
- package/build/lib-common/service-api/asmail/retrieval.js +1 -1
- package/build/lib-common/timed-cache.d.ts +1 -0
- package/build/lib-common/timed-non-weak-cache.d.ts +1 -0
- package/build/lib-common/timed-non-weak-cache.js +11 -0
- package/build/lib-common/utils-for-observables.d.ts +15 -1
- package/build/lib-common/utils-for-observables.js +70 -19
- package/build/lib-common/weak-cache.d.ts +1 -0
- package/build/lib-common/weak-cache.js +12 -1
- package/build/lib-index.d.ts +2 -1
- package/build/lib-index.js +10 -7
- package/build/protos/asmail.proto.js +12912 -7127
- package/build/protos/file.proto.js +4848 -2399
- package/build/protos/fs.proto.js +9230 -3445
- package/package.json +8 -7
- package/protos/file.proto +91 -11
- package/protos/fs.proto +107 -8
- package/build/core/storage/synced/upsync-status.d.ts +0 -41
- package/build/core/storage/synced/upsync-status.js +0 -158
|
@@ -55,7 +55,7 @@ class ServiceUser {
|
|
|
55
55
|
return this.uri;
|
|
56
56
|
}
|
|
57
57
|
set serviceURI(uriString) {
|
|
58
|
-
const u = url_1.parse(uriString);
|
|
58
|
+
const u = (0, url_1.parse)(uriString);
|
|
59
59
|
if (u.protocol !== 'https:') {
|
|
60
60
|
throw new Error("Url protocol must be https.");
|
|
61
61
|
}
|
|
@@ -82,40 +82,40 @@ class ServiceUser {
|
|
|
82
82
|
if (rep.status == loginApi.start.SC.ok) {
|
|
83
83
|
// set sessionid
|
|
84
84
|
if (!rep.data || (typeof rep.data.sessionId !== 'string')) {
|
|
85
|
-
throw request_utils_1.makeException(rep, 'Malformed reply to starting session');
|
|
85
|
+
throw (0, request_utils_1.makeException)(rep, 'Malformed reply to starting session');
|
|
86
86
|
}
|
|
87
87
|
this.sessionId = rep.data.sessionId;
|
|
88
88
|
// set server public key
|
|
89
89
|
if (typeof rep.data.serverPubKey !== 'string') {
|
|
90
|
-
throw request_utils_1.makeException(rep, 'Malformed reply: serverPubKey string is missing.');
|
|
90
|
+
throw (0, request_utils_1.makeException)(rep, 'Malformed reply: serverPubKey string is missing.');
|
|
91
91
|
}
|
|
92
92
|
try {
|
|
93
93
|
this.serverPubKey = buffer_utils_1.base64.open(rep.data.serverPubKey);
|
|
94
94
|
if (this.serverPubKey.length !== ecma_nacl_1.box.KEY_LENGTH) {
|
|
95
|
-
throw request_utils_1.makeException(rep, 'Malformed reply: server\'s key has a wrong size.');
|
|
95
|
+
throw (0, request_utils_1.makeException)(rep, 'Malformed reply: server\'s key has a wrong size.');
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
catch (err) {
|
|
99
|
-
throw request_utils_1.makeException(rep, `Malformed reply: bad serverPubKey string. Error: ${('string' === typeof err) ? err : err.message}`);
|
|
99
|
+
throw (0, request_utils_1.makeException)(rep, `Malformed reply: bad serverPubKey string. Error: ${('string' === typeof err) ? err : err.message}`);
|
|
100
100
|
}
|
|
101
101
|
// get encrypted session key from json body
|
|
102
102
|
if (typeof rep.data.sessionKey !== 'string') {
|
|
103
|
-
throw request_utils_1.makeException(rep, 'Malformed reply: sessionKey string is missing.');
|
|
103
|
+
throw (0, request_utils_1.makeException)(rep, 'Malformed reply: sessionKey string is missing.');
|
|
104
104
|
}
|
|
105
105
|
try {
|
|
106
106
|
this.encChallenge = buffer_utils_1.base64.open(rep.data.sessionKey);
|
|
107
107
|
if (this.encChallenge.length !==
|
|
108
108
|
(ecma_nacl_1.secret_box.NONCE_LENGTH + ecma_nacl_1.secret_box.KEY_LENGTH)) {
|
|
109
|
-
throw request_utils_1.makeException(rep, `Malformed reply: byte chunk with session key has a wrong size.`);
|
|
109
|
+
throw (0, request_utils_1.makeException)(rep, `Malformed reply: byte chunk with session key has a wrong size.`);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
catch (err) {
|
|
113
|
-
throw request_utils_1.makeException(rep, `Malformed reply: bad sessionKey string. Error: ${(typeof err === 'string') ? err : err.message}`);
|
|
113
|
+
throw (0, request_utils_1.makeException)(rep, `Malformed reply: bad sessionKey string. Error: ${(typeof err === 'string') ? err : err.message}`);
|
|
114
114
|
}
|
|
115
115
|
// get key derivation parameters for a default key
|
|
116
116
|
if (!keyId) {
|
|
117
117
|
if (typeof rep.data.keyDerivParams !== 'object') {
|
|
118
|
-
throw request_utils_1.makeException(rep, `Malformed reply: keyDerivParams string is missing.`);
|
|
118
|
+
throw (0, request_utils_1.makeException)(rep, `Malformed reply: keyDerivParams string is missing.`);
|
|
119
119
|
}
|
|
120
120
|
this.keyDerivationParams = rep.data.keyDerivParams;
|
|
121
121
|
}
|
|
@@ -124,11 +124,11 @@ class ServiceUser {
|
|
|
124
124
|
(rep.status === loginApi.start.SC.redirect)) {
|
|
125
125
|
const rd = rep.data;
|
|
126
126
|
if (!rd || ('string' !== typeof rd.redirect)) {
|
|
127
|
-
throw request_utils_1.makeException(rep, 'Malformed reply');
|
|
127
|
+
throw (0, request_utils_1.makeException)(rep, 'Malformed reply');
|
|
128
128
|
}
|
|
129
129
|
// refuse second redirect
|
|
130
130
|
if (this.redirectedFrom !== undefined) {
|
|
131
|
-
throw request_utils_1.makeException(rep, `Redirected too many times. First redirect was from ${this.redirectedFrom} to ${this.serviceURI}. Second and forbidden redirect is to ${rd.redirect}`);
|
|
131
|
+
throw (0, request_utils_1.makeException)(rep, `Redirected too many times. First redirect was from ${this.redirectedFrom} to ${this.serviceURI}. Second and forbidden redirect is to ${rd.redirect}`);
|
|
132
132
|
}
|
|
133
133
|
// set params
|
|
134
134
|
this.redirectedFrom = this.serviceURI;
|
|
@@ -137,19 +137,19 @@ class ServiceUser {
|
|
|
137
137
|
return this.startSession(keyId);
|
|
138
138
|
}
|
|
139
139
|
else if (rep.status === loginApi.start.SC.unknownUser) {
|
|
140
|
-
const exc = request_utils_1.makeException(rep);
|
|
140
|
+
const exc = (0, request_utils_1.makeException)(rep);
|
|
141
141
|
exc.unknownUser = true;
|
|
142
142
|
throw exc;
|
|
143
143
|
}
|
|
144
144
|
else {
|
|
145
|
-
throw request_utils_1.makeException(rep, 'Unexpected status');
|
|
145
|
+
throw (0, request_utils_1.makeException)(rep, 'Unexpected status');
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
openSessionKey(dhsharedKeyCalc) {
|
|
149
|
-
assert_1.assert(!!this.encChallenge);
|
|
149
|
+
(0, assert_1.assert)(!!this.encChallenge);
|
|
150
150
|
const dhsharedKey = dhsharedKeyCalc();
|
|
151
|
-
const nonce = buffer_utils_1.makeUint8ArrayCopy(this.encChallenge.subarray(0, ecma_nacl_1.secret_box.NONCE_LENGTH));
|
|
152
|
-
const sessionKey = buffer_utils_1.makeUint8ArrayCopy(this.encChallenge.subarray(ecma_nacl_1.secret_box.NONCE_LENGTH));
|
|
151
|
+
const nonce = (0, buffer_utils_1.makeUint8ArrayCopy)(this.encChallenge.subarray(0, ecma_nacl_1.secret_box.NONCE_LENGTH));
|
|
152
|
+
const sessionKey = (0, buffer_utils_1.makeUint8ArrayCopy)(this.encChallenge.subarray(ecma_nacl_1.secret_box.NONCE_LENGTH));
|
|
153
153
|
// encrypted challenge has session key packaged into WN format, with
|
|
154
154
|
// poly part cut out. Therefore, usual open method will not do as it
|
|
155
155
|
// does poly check. We should recall that cipher is a stream with data
|
|
@@ -168,15 +168,15 @@ class ServiceUser {
|
|
|
168
168
|
this.serverVerificationBytes =
|
|
169
169
|
this.serverVerificationBytes.subarray(0, ecma_nacl_1.secret_box.POLY_LENGTH);
|
|
170
170
|
ecma_nacl_1.nonce.advanceOddly(nonce);
|
|
171
|
-
this.encryptor = session_encryptor_1.makeSessionEncryptor(sessionKey, nonce);
|
|
171
|
+
this.encryptor = (0, session_encryptor_1.makeSessionEncryptor)(sessionKey, nonce);
|
|
172
172
|
// encrypt session key for completion of login exchange
|
|
173
173
|
this.encChallenge = this.encryptor.pack(sessionKey);
|
|
174
174
|
// cleanup arrays
|
|
175
175
|
ecma_nacl_1.arrays.wipe(dhsharedKey, nonce, sessionKey);
|
|
176
176
|
}
|
|
177
177
|
async completeLoginExchange() {
|
|
178
|
-
assert_1.assert(!!this.encChallenge);
|
|
179
|
-
assert_1.assert(!!this.serverVerificationBytes);
|
|
178
|
+
(0, assert_1.assert)(!!this.encChallenge);
|
|
179
|
+
(0, assert_1.assert)(!!this.serverVerificationBytes);
|
|
180
180
|
const rep = await this.net.doBinaryRequest({
|
|
181
181
|
url: `${this.serviceURI}${this.loginUrlPart}${loginApi.complete.URL_END}`,
|
|
182
182
|
method: loginApi.complete.method,
|
|
@@ -186,22 +186,22 @@ class ServiceUser {
|
|
|
186
186
|
this.encChallenge = undefined;
|
|
187
187
|
if (rep.status === loginApi.complete.SC.ok) {
|
|
188
188
|
// compare bytes to check, if server can be trusted
|
|
189
|
-
if (ecma_nacl_1.compareVectors(rep.data, this.serverVerificationBytes)) {
|
|
189
|
+
if ((0, ecma_nacl_1.compareVectors)(rep.data, this.serverVerificationBytes)) {
|
|
190
190
|
this.serverVerificationBytes = undefined;
|
|
191
191
|
}
|
|
192
192
|
else {
|
|
193
|
-
const exc = request_utils_1.makeException(rep);
|
|
193
|
+
const exc = (0, request_utils_1.makeException)(rep);
|
|
194
194
|
exc.serverNotTrusted = true;
|
|
195
195
|
throw exc;
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
else if (rep.status === loginApi.complete.SC.authFailed) {
|
|
199
|
-
const exc = request_utils_1.makeException(rep);
|
|
199
|
+
const exc = (0, request_utils_1.makeException)(rep);
|
|
200
200
|
exc.cryptoResponseNotAccepted = true;
|
|
201
201
|
throw exc;
|
|
202
202
|
}
|
|
203
203
|
else {
|
|
204
|
-
throw request_utils_1.makeException(rep, 'Unexpected status');
|
|
204
|
+
throw (0, request_utils_1.makeException)(rep, 'Unexpected status');
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
/**
|
|
@@ -216,7 +216,7 @@ class ServiceUser {
|
|
|
216
216
|
*/
|
|
217
217
|
async login(keyId) {
|
|
218
218
|
await this.startSession(keyId);
|
|
219
|
-
assert_1.assert(!!this.serverPubKey);
|
|
219
|
+
(0, assert_1.assert)(!!this.serverPubKey);
|
|
220
220
|
return {
|
|
221
221
|
keyParams: this.keyDerivationParams,
|
|
222
222
|
serverPKey: this.serverPubKey,
|
|
@@ -245,7 +245,7 @@ class ServiceUser {
|
|
|
245
245
|
this.encryptor = undefined;
|
|
246
246
|
}
|
|
247
247
|
else {
|
|
248
|
-
throw request_utils_1.makeException(rep, 'Unexpected status');
|
|
248
|
+
throw (0, request_utils_1.makeException)(rep, 'Unexpected status');
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
}
|
|
@@ -18,7 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
exports.openSocket = void 0;
|
|
19
19
|
const WebSocket = require("ws");
|
|
20
20
|
const request_utils_1 = require("./request-utils");
|
|
21
|
-
const
|
|
21
|
+
const deferred_1 = require("../lib-common/processes/deferred");
|
|
22
22
|
const http_1 = require("../lib-common/exceptions/http");
|
|
23
23
|
const https_1 = require("https");
|
|
24
24
|
function openSocket(url, sessionId) {
|
|
@@ -28,8 +28,8 @@ function openSocket(url, sessionId) {
|
|
|
28
28
|
const headers = {};
|
|
29
29
|
headers[request_utils_1.SESSION_ID_HEADER] = sessionId;
|
|
30
30
|
const ws = new WebSocket(url, { headers, agent: https_1.globalAgent });
|
|
31
|
-
const opening =
|
|
32
|
-
const initOnError = err => opening.reject(http_1.makeConnectionException(url, undefined, `Cannot open websocket connection due to error: ${err.message}`));
|
|
31
|
+
const opening = (0, deferred_1.defer)();
|
|
32
|
+
const initOnError = err => opening.reject((0, http_1.makeConnectionException)(url, undefined, `Cannot open websocket connection due to error: ${err.message}`));
|
|
33
33
|
const onNonOkReply = (req, res) => {
|
|
34
34
|
const errReply = {
|
|
35
35
|
url,
|
|
@@ -52,8 +52,8 @@ function makeEncryptor(cryptor, key, nextNonce, delta) {
|
|
|
52
52
|
else if ((delta < 1) || (delta > 255)) {
|
|
53
53
|
throw new Error("Given delta is out of bounds.");
|
|
54
54
|
}
|
|
55
|
-
key = buffer_utils_1.makeUint8ArrayCopy(key);
|
|
56
|
-
nextNonce = buffer_utils_1.makeUint8ArrayCopy(nextNonce);
|
|
55
|
+
key = (0, buffer_utils_1.makeUint8ArrayCopy)(key);
|
|
56
|
+
nextNonce = (0, buffer_utils_1.makeUint8ArrayCopy)(nextNonce);
|
|
57
57
|
let counter = 0;
|
|
58
58
|
const counterMax = Math.floor(0xfffffffffffff / delta);
|
|
59
59
|
const encryptor = {
|
|
@@ -65,7 +65,7 @@ function makeEncryptor(cryptor, key, nextNonce, delta) {
|
|
|
65
65
|
throw new Error(`This encryptor has been used too many times. Further use may lead to duplication of nonces.`);
|
|
66
66
|
}
|
|
67
67
|
const c = await cryptor.formatWN.pack(m, nextNonce, key);
|
|
68
|
-
xsp_files_1.advanceNonce(nextNonce, delta);
|
|
68
|
+
(0, xsp_files_1.advanceNonce)(nextNonce, delta);
|
|
69
69
|
counter += 1;
|
|
70
70
|
return c;
|
|
71
71
|
},
|
|
@@ -101,7 +101,7 @@ function makeDecryptor(cryptor, key) {
|
|
|
101
101
|
if (key.length !== 32) {
|
|
102
102
|
throw new Error(`Key array key should have 32 elements (bytes) in it, but it is ${key.length} elements long.`);
|
|
103
103
|
}
|
|
104
|
-
key = buffer_utils_1.makeUint8ArrayCopy(key);
|
|
104
|
+
key = (0, buffer_utils_1.makeUint8ArrayCopy)(key);
|
|
105
105
|
const decryptor = {
|
|
106
106
|
open: (c) => {
|
|
107
107
|
if (!key) {
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="node" />
|
|
2
4
|
import * as fs from 'fs';
|
|
3
5
|
import { Readable, Writable } from 'stream';
|
|
4
6
|
export { Stats } from 'fs';
|
|
5
7
|
export { FileException } from './exceptions/file';
|
|
6
8
|
export declare function readFile(filename: string, options: {
|
|
7
|
-
encoding:
|
|
9
|
+
encoding: BufferEncoding;
|
|
8
10
|
flag?: string;
|
|
9
11
|
}): Promise<string>;
|
|
10
12
|
export declare function readFile(filename: string, options?: {
|
|
11
13
|
flag?: string;
|
|
12
14
|
}): Promise<Buffer>;
|
|
13
15
|
export declare function writeFile(path: string, data: any, options?: {
|
|
14
|
-
encoding?:
|
|
16
|
+
encoding?: BufferEncoding;
|
|
15
17
|
mode?: string;
|
|
16
18
|
flag?: string;
|
|
17
19
|
}): Promise<void>;
|
|
18
20
|
export declare function appendFile(path: string, data: any, options?: {
|
|
19
|
-
encoding?:
|
|
21
|
+
encoding?: BufferEncoding;
|
|
20
22
|
mode?: string;
|
|
21
23
|
flag?: string;
|
|
22
24
|
}): Promise<void>;
|
|
@@ -16,18 +16,19 @@
|
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.ensureFolderExists = exports.copyTree = exports.copyFile = exports.streamFromFile = exports.rmDirWithContent = exports.read = exports.streamToExistingFile = exports.append = exports.write = exports.getFolderContentSize = exports.getFileSize = exports.existsFileSync = exports.existsFolderSync = exports.existsFolder = exports.createEmptyFile = exports.writeFromBuf = exports.readToBuf = exports.ftruncate = exports.truncate = exports.rename = exports.unlink = exports.rmdir = exports.readdir = exports.fstat = exports.stat = exports.lstat = exports.readlink = exports.symlink = exports.close = exports.open = exports.mkdir = exports.appendFile = exports.writeFile = exports.readFile = void 0;
|
|
19
|
+
exports.ensureFolderExists = exports.copyTree = exports.copyFile = exports.streamFromFile = exports.rmDirWithContent = exports.read = exports.streamToExistingFile = exports.append = exports.write = exports.getFolderContentSize = exports.getFileSize = exports.existsFileSync = exports.existsFolderSync = exports.existsFolder = exports.createEmptyFile = exports.writeFromBuf = exports.readToBuf = exports.ftruncate = exports.truncate = exports.rename = exports.unlink = exports.rmdir = exports.readdir = exports.fstat = exports.stat = exports.lstat = exports.readlink = exports.symlink = exports.close = exports.open = exports.mkdir = exports.appendFile = exports.writeFile = exports.readFile = exports.Stats = void 0;
|
|
20
20
|
const fs = require("fs");
|
|
21
21
|
const fs_1 = require("fs");
|
|
22
22
|
const file_1 = require("./exceptions/file");
|
|
23
|
-
const
|
|
23
|
+
const synced_1 = require("./processes/synced");
|
|
24
|
+
const deferred_1 = require("./processes/deferred");
|
|
24
25
|
const bytes_fifo_buffer_1 = require("./byte-streaming/bytes-fifo-buffer");
|
|
25
26
|
const buffer_utils_1 = require("./buffer-utils");
|
|
26
27
|
const path_1 = require("path");
|
|
27
28
|
var fs_2 = require("fs");
|
|
28
29
|
Object.defineProperty(exports, "Stats", { enumerable: true, get: function () { return fs_2.Stats; } });
|
|
29
30
|
function makeFileExceptionFromNodes(nodeExc) {
|
|
30
|
-
return file_1.makeFileException(nodeExc.code, nodeExc.path);
|
|
31
|
+
return (0, file_1.makeFileException)(nodeExc.code, nodeExc.path);
|
|
31
32
|
}
|
|
32
33
|
function readFile(path, options) {
|
|
33
34
|
return new Promise((resolve, reject) => {
|
|
@@ -306,7 +307,7 @@ async function readToBuf(fd, pos, buf) {
|
|
|
306
307
|
while (bytesRead < buf.length) {
|
|
307
308
|
const bNum = await readOrig(fd, buf, bytesRead, buf.length - bytesRead, pos);
|
|
308
309
|
if (bNum === 0) {
|
|
309
|
-
throw file_1.makeFileException(file_1.Code.endOfFile, '<file descriptor>');
|
|
310
|
+
throw (0, file_1.makeFileException)(file_1.Code.endOfFile, '<file descriptor>');
|
|
310
311
|
}
|
|
311
312
|
bytesRead += bNum;
|
|
312
313
|
pos += bNum;
|
|
@@ -378,7 +379,7 @@ async function existsFolder(path) {
|
|
|
378
379
|
return true;
|
|
379
380
|
}
|
|
380
381
|
else {
|
|
381
|
-
throw file_1.makeFileException(file_1.Code.notDirectory, path);
|
|
382
|
+
throw (0, file_1.makeFileException)(file_1.Code.notDirectory, path);
|
|
382
383
|
}
|
|
383
384
|
}
|
|
384
385
|
catch (e) {
|
|
@@ -395,11 +396,11 @@ exports.existsFolder = existsFolder;
|
|
|
395
396
|
*/
|
|
396
397
|
function existsFolderSync(path) {
|
|
397
398
|
try {
|
|
398
|
-
if (fs_1.statSync(path).isDirectory()) {
|
|
399
|
+
if ((0, fs_1.statSync)(path).isDirectory()) {
|
|
399
400
|
return true;
|
|
400
401
|
}
|
|
401
402
|
else {
|
|
402
|
-
throw file_1.makeFileException(file_1.Code.notDirectory, path);
|
|
403
|
+
throw (0, file_1.makeFileException)(file_1.Code.notDirectory, path);
|
|
403
404
|
}
|
|
404
405
|
}
|
|
405
406
|
catch (e) {
|
|
@@ -416,11 +417,11 @@ exports.existsFolderSync = existsFolderSync;
|
|
|
416
417
|
*/
|
|
417
418
|
function existsFileSync(path) {
|
|
418
419
|
try {
|
|
419
|
-
if (fs_1.statSync(path).isFile()) {
|
|
420
|
+
if ((0, fs_1.statSync)(path).isFile()) {
|
|
420
421
|
return true;
|
|
421
422
|
}
|
|
422
423
|
else {
|
|
423
|
-
throw file_1.makeFileException(file_1.Code.notFile, path);
|
|
424
|
+
throw (0, file_1.makeFileException)(file_1.Code.notFile, path);
|
|
424
425
|
}
|
|
425
426
|
}
|
|
426
427
|
catch (e) {
|
|
@@ -527,11 +528,11 @@ async function streamToExistingFile(filePath, pos, len, src, bufSize) {
|
|
|
527
528
|
if ((typeof bufSize !== 'number') || (bufSize < 1024)) {
|
|
528
529
|
throw new Error('Illegal buffer size given: ' + bufSize);
|
|
529
530
|
}
|
|
530
|
-
const writeProc = new
|
|
531
|
+
const writeProc = new synced_1.SingleProc();
|
|
531
532
|
let bytesWritten = 0;
|
|
532
533
|
let bytesRead = 0;
|
|
533
534
|
const buf = new bytes_fifo_buffer_1.BytesFIFOBuffer();
|
|
534
|
-
let deferred =
|
|
535
|
+
let deferred = (0, deferred_1.defer)();
|
|
535
536
|
let doneReading = false;
|
|
536
537
|
const complete = (err) => {
|
|
537
538
|
if (!deferred) {
|
|
@@ -568,7 +569,7 @@ async function streamToExistingFile(filePath, pos, len, src, bufSize) {
|
|
|
568
569
|
if (!bytesToWrite) {
|
|
569
570
|
return;
|
|
570
571
|
}
|
|
571
|
-
await writeToExistingFile(filePath, pos, buffer_utils_1.toBuffer(bytesToWrite));
|
|
572
|
+
await writeToExistingFile(filePath, pos, (0, buffer_utils_1.toBuffer)(bytesToWrite));
|
|
572
573
|
pos += bytesToWrite.length;
|
|
573
574
|
bytesWritten += bytesToWrite.length;
|
|
574
575
|
if (bytesWritten < len) {
|
|
@@ -585,7 +586,7 @@ async function streamToExistingFile(filePath, pos, len, src, bufSize) {
|
|
|
585
586
|
if (doneReading) {
|
|
586
587
|
return;
|
|
587
588
|
}
|
|
588
|
-
complete(file_1.makeFileException(file_1.Code.endOfFile, '<input stream>'));
|
|
589
|
+
complete((0, file_1.makeFileException)(file_1.Code.endOfFile, '<input stream>'));
|
|
589
590
|
});
|
|
590
591
|
src.on('error', (err) => {
|
|
591
592
|
complete(err);
|
|
@@ -613,7 +614,7 @@ async function read(fd, pos, buf) {
|
|
|
613
614
|
while (bytesRead < buf.length) {
|
|
614
615
|
const bNum = await readOrig(fd, buf, bytesRead, buf.length - bytesRead, pos);
|
|
615
616
|
if (bNum === 0) {
|
|
616
|
-
throw file_1.makeFileException(file_1.Code.endOfFile, '<file descriptor>');
|
|
617
|
+
throw (0, file_1.makeFileException)(file_1.Code.endOfFile, '<file descriptor>');
|
|
617
618
|
}
|
|
618
619
|
bytesRead += bNum;
|
|
619
620
|
pos += bNum;
|
|
@@ -728,8 +729,8 @@ exports.streamFromFile = streamFromFile;
|
|
|
728
729
|
*/
|
|
729
730
|
function copyFile(src, dst, overwrite = false, dstMode = '660') {
|
|
730
731
|
return new Promise((resolve, reject) => {
|
|
731
|
-
const srcStream = fs_1.createReadStream(src);
|
|
732
|
-
const dstStream = fs_1.createWriteStream(dst, {
|
|
732
|
+
const srcStream = (0, fs_1.createReadStream)(src);
|
|
733
|
+
const dstStream = (0, fs_1.createWriteStream)(dst, {
|
|
733
734
|
mode: parseInt(dstMode, 8),
|
|
734
735
|
flags: (overwrite ? 'w' : 'wx')
|
|
735
736
|
});
|
|
@@ -772,8 +773,8 @@ async function copyTree(src, dst, fileOverwrite = false) {
|
|
|
772
773
|
const srcFNames = await readdir(src);
|
|
773
774
|
const cpTasks = [];
|
|
774
775
|
for (const fName of srcFNames) {
|
|
775
|
-
const srcPath = path_1.join(src, fName);
|
|
776
|
-
const dstPath = path_1.join(dst, fName);
|
|
776
|
+
const srcPath = (0, path_1.join)(src, fName);
|
|
777
|
+
const dstPath = (0, path_1.join)(dst, fName);
|
|
777
778
|
const task = stat(srcPath)
|
|
778
779
|
.then((stats) => {
|
|
779
780
|
if (stats.isFile()) {
|
|
@@ -29,7 +29,7 @@ const sink_utils_1 = require("../obj-streaming/sink-utils");
|
|
|
29
29
|
* Default value is 64K.
|
|
30
30
|
*/
|
|
31
31
|
async function pipe(src, sink, progressCB = undefined, closeSink = true, bufSize = 64 * 1024) {
|
|
32
|
-
const contSink = sink_utils_1.makeContinuousSink(sink);
|
|
32
|
+
const contSink = (0, sink_utils_1.makeContinuousSink)(sink);
|
|
33
33
|
try {
|
|
34
34
|
let buf = await src.read(bufSize);
|
|
35
35
|
let bytesPiped = 0;
|
|
@@ -17,37 +17,37 @@
|
|
|
17
17
|
*/
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.wrapAndSyncFileSource = exports.wrapAndSyncSource = exports.wrapAndSyncFileSink = void 0;
|
|
20
|
-
const
|
|
20
|
+
const synced_1 = require("../processes/synced");
|
|
21
21
|
function wrapAndSyncFileSink(sink) {
|
|
22
|
-
const syncProc = new
|
|
22
|
+
const syncProc = new synced_1.SingleProc();
|
|
23
23
|
const w = {
|
|
24
|
-
done:
|
|
25
|
-
getSize:
|
|
26
|
-
showLayout:
|
|
27
|
-
splice:
|
|
28
|
-
truncate:
|
|
24
|
+
done: (0, synced_1.makeSyncedFunc)(syncProc, sink, sink.done),
|
|
25
|
+
getSize: (0, synced_1.makeSyncedFunc)(syncProc, sink, sink.getSize),
|
|
26
|
+
showLayout: (0, synced_1.makeSyncedFunc)(syncProc, sink, sink.showLayout),
|
|
27
|
+
splice: (0, synced_1.makeSyncedFunc)(syncProc, sink, sink.splice),
|
|
28
|
+
truncate: (0, synced_1.makeSyncedFunc)(syncProc, sink, sink.truncate)
|
|
29
29
|
};
|
|
30
30
|
return w;
|
|
31
31
|
}
|
|
32
32
|
exports.wrapAndSyncFileSink = wrapAndSyncFileSink;
|
|
33
33
|
function wrapAndSyncSource(src) {
|
|
34
|
-
const syncProc = new
|
|
34
|
+
const syncProc = new synced_1.SingleProc();
|
|
35
35
|
const w = {
|
|
36
|
-
getPosition:
|
|
37
|
-
getSize:
|
|
38
|
-
read:
|
|
39
|
-
seek:
|
|
36
|
+
getPosition: (0, synced_1.makeSyncedFunc)(syncProc, src, src.getPosition),
|
|
37
|
+
getSize: (0, synced_1.makeSyncedFunc)(syncProc, src, src.getSize),
|
|
38
|
+
read: (0, synced_1.makeSyncedFunc)(syncProc, src, src.read),
|
|
39
|
+
seek: (0, synced_1.makeSyncedFunc)(syncProc, src, src.seek)
|
|
40
40
|
};
|
|
41
41
|
return w;
|
|
42
42
|
}
|
|
43
43
|
exports.wrapAndSyncSource = wrapAndSyncSource;
|
|
44
44
|
function wrapAndSyncFileSource(src) {
|
|
45
|
-
const syncProc = new
|
|
45
|
+
const syncProc = new synced_1.SingleProc();
|
|
46
46
|
const w = {
|
|
47
|
-
getPosition:
|
|
48
|
-
getSize:
|
|
49
|
-
read:
|
|
50
|
-
seek:
|
|
47
|
+
getPosition: (0, synced_1.makeSyncedFunc)(syncProc, src, src.getPosition),
|
|
48
|
+
getSize: (0, synced_1.makeSyncedFunc)(syncProc, src, src.getSize),
|
|
49
|
+
read: (0, synced_1.makeSyncedFunc)(syncProc, src, src.read),
|
|
50
|
+
seek: (0, synced_1.makeSyncedFunc)(syncProc, src, src.seek),
|
|
51
51
|
};
|
|
52
52
|
return w;
|
|
53
53
|
}
|
|
@@ -2,4 +2,5 @@ export interface ErrorWithCause extends Error {
|
|
|
2
2
|
cause: any;
|
|
3
3
|
}
|
|
4
4
|
export declare function errWithCause(cause: any, message: string): ErrorWithCause;
|
|
5
|
+
export declare function recursiveErrJSONify(err: web3n.RuntimeException): any;
|
|
5
6
|
export declare function stringifyErr(err: any): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2016 - 2017, 2020 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2016 - 2017, 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
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
You should have received a copy of the GNU General Public License along with
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.stringifyErr = exports.errWithCause = void 0;
|
|
18
|
+
exports.stringifyErr = exports.recursiveErrJSONify = exports.errWithCause = void 0;
|
|
19
19
|
function errWithCause(cause, message) {
|
|
20
20
|
const err = new Error(message);
|
|
21
21
|
err.cause = cause;
|
|
@@ -25,13 +25,13 @@ function errWithCause(cause, message) {
|
|
|
25
25
|
return err;
|
|
26
26
|
}
|
|
27
27
|
exports.errWithCause = errWithCause;
|
|
28
|
-
function
|
|
28
|
+
function recursiveErrJSONify(err) {
|
|
29
29
|
if (!err || (typeof err !== 'object') || Array.isArray(err)) {
|
|
30
30
|
return err;
|
|
31
31
|
}
|
|
32
32
|
else if (err.runtimeException) {
|
|
33
33
|
if (err.cause) {
|
|
34
|
-
err.cause =
|
|
34
|
+
err.cause = recursiveErrJSONify(err.cause);
|
|
35
35
|
}
|
|
36
36
|
return err;
|
|
37
37
|
}
|
|
@@ -41,16 +41,17 @@ function recursiveJSONify(err) {
|
|
|
41
41
|
stack: err.stack
|
|
42
42
|
};
|
|
43
43
|
if (err.cause) {
|
|
44
|
-
jsonErr.cause =
|
|
44
|
+
jsonErr.cause = recursiveErrJSONify(err.cause);
|
|
45
45
|
}
|
|
46
46
|
return jsonErr;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
+
exports.recursiveErrJSONify = recursiveErrJSONify;
|
|
49
50
|
function stringifyErr(err) {
|
|
50
51
|
if (!err) {
|
|
51
52
|
return '';
|
|
52
53
|
}
|
|
53
|
-
let json =
|
|
54
|
+
let json = recursiveErrJSONify(err);
|
|
54
55
|
let errStr;
|
|
55
56
|
if (!json || (typeof json !== 'object') || err.runtimeException) {
|
|
56
57
|
try {
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
See the GNU General Public License for more details.
|
|
14
14
|
|
|
15
15
|
You should have received a copy of the GNU General Public License along with
|
|
16
|
-
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
17
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
19
|
exports.makeVersionMismatchExc = exports.makeNoAttrsExc = exports.ensureCorrectFS = exports.maskPathInExc = exports.makeFileException = exports.Code = void 0;
|
|
19
20
|
exports.Code = {
|
|
@@ -32,6 +33,8 @@ exports.Code = {
|
|
|
32
33
|
parsingError: 'parsing-error',
|
|
33
34
|
notImplemented: 'ENOSYS',
|
|
34
35
|
isEndless: 'is-endless',
|
|
36
|
+
storageClosed: 'storage-closed',
|
|
37
|
+
versionMismatch: 'version-mismatch',
|
|
35
38
|
};
|
|
36
39
|
Object.freeze(exports.Code);
|
|
37
40
|
function makeFileException(code, path, cause) {
|
|
@@ -87,6 +90,12 @@ function makeFileException(code, path, cause) {
|
|
|
87
90
|
else if (code === exports.Code.isEndless) {
|
|
88
91
|
err.isEndless = true;
|
|
89
92
|
}
|
|
93
|
+
else if (code === exports.Code.storageClosed) {
|
|
94
|
+
err.storageClosed = true;
|
|
95
|
+
}
|
|
96
|
+
else if (code === exports.Code.versionMismatch) {
|
|
97
|
+
err.versionMismatch = true;
|
|
98
|
+
}
|
|
90
99
|
return err;
|
|
91
100
|
}
|
|
92
101
|
exports.makeFileException = makeFileException;
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.SingleObserverWrap = exports.MultiObserverWrap = exports.makeSubscribingClient = exports.makeEventfulServer = exports.makeRequestServer = exports.makeRequestingClient = void 0;
|
|
19
19
|
const map_of_sets_1 = require("../map-of-sets");
|
|
20
|
-
const
|
|
20
|
+
const synced_1 = require("../processes/synced");
|
|
21
21
|
function toTransferrableError(e) {
|
|
22
22
|
const err = {
|
|
23
23
|
message: e.message,
|
|
@@ -556,7 +556,7 @@ class IpcEventChannels {
|
|
|
556
556
|
* These are all subscribed ipc channels.
|
|
557
557
|
*/
|
|
558
558
|
this.subscribedIpcChannels = new Set();
|
|
559
|
-
this.subscriptionProcs = new
|
|
559
|
+
this.subscriptionProcs = new synced_1.NamedProcs();
|
|
560
560
|
Object.freeze(this);
|
|
561
561
|
}
|
|
562
562
|
subscribeTo(ipcChannel) {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
You should have received a copy of the GNU General Public License along with
|
|
16
16
|
this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.makeSubscriber = void 0;
|
|
18
|
+
exports.makeSubscriber = exports.makeEventfulServer = void 0;
|
|
19
19
|
const generic_ipc_1 = require("./generic-ipc");
|
|
20
20
|
var generic_ipc_2 = require("./generic-ipc");
|
|
21
21
|
Object.defineProperty(exports, "makeEventfulServer", { enumerable: true, get: function () { return generic_ipc_2.makeEventfulServer; } });
|
|
@@ -111,7 +111,7 @@ function onError(ws, observers) {
|
|
|
111
111
|
}
|
|
112
112
|
function makeSubscriber(ws, ipcChannel) {
|
|
113
113
|
const comm = makeJsonCommPoint(ws);
|
|
114
|
-
return generic_ipc_1.makeSubscribingClient(ipcChannel, comm);
|
|
114
|
+
return (0, generic_ipc_1.makeSubscribingClient)(ipcChannel, comm);
|
|
115
115
|
}
|
|
116
116
|
exports.makeSubscriber = makeSubscriber;
|
|
117
117
|
Object.freeze(exports);
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
See the GNU General Public License for more details.
|
|
14
14
|
|
|
15
15
|
You should have received a copy of the GNU General Public License along with
|
|
16
|
-
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
17
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
19
|
exports.applyChangesToJSON = exports.deepFind = exports.deepEqual = exports.copy = void 0;
|
|
19
20
|
/**
|