core-3nweb-client-lib 0.30.1 → 0.30.3

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.
@@ -88,8 +88,12 @@ class ObjFolders {
88
88
  throw new Error(`Missing a can-move predicate when generations are present`);
89
89
  }
90
90
  this.generationsFolder = (0, path_1.join)(this.path, GENERATIONS_DIR);
91
- this.rotationsProc = new RotationsProc(this.accessFolder, this.generationsFolder, this.generations, this.syncProcs, canMove, this.saveCfg, this.logError);
92
- this.rotationsProc.scheduleStart(10 * 60);
91
+ // XXX rotation process is disabled, till its error is fixed
92
+ // this.rotationsProc = new RotationsProc(
93
+ // this.accessFolder, this.generationsFolder,
94
+ // this.generations, this.syncProcs, canMove, this.saveCfg,
95
+ // this.logError);
96
+ // this.rotationsProc.scheduleStart(10*60);
93
97
  }
94
98
  Object.freeze(this);
95
99
  }
@@ -172,19 +172,57 @@ function noServiceRecordExc(address) {
172
172
  */
173
173
  function extractPair(txtRecords, serviceLabel) {
174
174
  for (const txtRecord of txtRecords) {
175
- const txt = txtRecord.join(' ');
176
- const eqPos = txt.indexOf('=');
177
- if (eqPos < 0) {
178
- continue;
179
- }
180
- const name = txt.substring(0, eqPos).trim();
181
- if (name === serviceLabel) {
182
- const value = txt.substring(eqPos + 1).trim();
183
- return value;
175
+ let joinedTXTstanzas = txtRecord.join('');
176
+ let record = getRecordAtStartOf(joinedTXTstanzas);
177
+ while (record) {
178
+ if (record.service === serviceLabel) {
179
+ const value = record.value.trim();
180
+ if (value.length > 0) {
181
+ return value;
182
+ }
183
+ }
184
+ if (record.txtTail) {
185
+ record = getRecordAtStartOf(record.txtTail);
186
+ }
187
+ else {
188
+ break;
189
+ }
184
190
  }
185
191
  }
186
192
  return;
187
193
  }
194
+ const recordsStarts = {
195
+ "3nstorage": '3nstorage=',
196
+ asmail: 'asmail=',
197
+ mailerid: 'mailerid='
198
+ };
199
+ function getRecordAtStartOf(txt) {
200
+ let service = undefined;
201
+ for (const [label, startSeq] of Object.entries(recordsStarts)) {
202
+ if (txt.startsWith(startSeq)) {
203
+ service = label;
204
+ txt = txt.substring(startSeq.length);
205
+ break;
206
+ }
207
+ }
208
+ if (!service) {
209
+ return;
210
+ }
211
+ for (const delimiter of Object.values(recordsStarts)) {
212
+ const endPos = txt.indexOf(delimiter);
213
+ if (endPos >= 0) {
214
+ return {
215
+ service,
216
+ value: txt.substring(0, endPos),
217
+ txtTail: txt.substring(endPos)
218
+ };
219
+ }
220
+ }
221
+ return {
222
+ service,
223
+ value: txt
224
+ };
225
+ }
188
226
  const DNS_ERR_CODE = {
189
227
  NODATA: 'ENODATA',
190
228
  NOTFOUND: 'ENOTFOUND'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "core-3nweb-client-lib",
3
- "version": "0.30.1",
3
+ "version": "0.30.3",
4
4
  "description": "3NWeb client core library, embeddable into different environments",
5
5
  "main": "build/lib-index.js",
6
6
  "types": "build/lib-index.d.ts",
@@ -41,7 +41,7 @@
41
41
  "@types/ws": "^7.4.7",
42
42
  "jasmine": "^3.9.0",
43
43
  "protobufjs-cli": "^1.0.2",
44
- "spec-3nweb-server": "^1.6.3",
44
+ "spec-3nweb-server": "^1.7.0",
45
45
  "tsuml2": "^0.6.1",
46
46
  "typescript": "^4.7.4"
47
47
  }