neo4j-driver 6.3.0 → 6.3.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.
@@ -12063,6 +12063,8 @@ encryptedValue.isEnc = EncryptedValue.isEncryptedValue;
12063
12063
 
12064
12064
  var encapsulatedKeyManager = {};
12065
12065
 
12066
+ var encryptionProfile = {};
12067
+
12066
12068
  /**
12067
12069
  * Copyright (c) "Neo4j"
12068
12070
  * Neo4j Sweden AB [https://neo4j.com]
@@ -12115,9 +12117,298 @@ var __generator$i = (commonjsGlobal && commonjsGlobal.__generator) || function (
12115
12117
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
12116
12118
  }
12117
12119
  };
12120
+ Object.defineProperty(encryptionProfile, "__esModule", { value: true });
12121
+ encryptionProfile.EnvelopeEncryptionProfile = void 0;
12122
+ var error_1$8 = error;
12123
+ var integer_1$1 = integer;
12124
+ var json_1$2 = json$3;
12125
+ /**
12126
+ * An encryption profile that enables Envelope Encryption for Neo4j Property Encryption.
12127
+ *
12128
+ * @since 6.3.0
12129
+ * @experimental Part of the Client-Side Encrytion preview feature
12130
+ */
12131
+ var EnvelopeEncryptionProfile = /** @class */ (function () {
12132
+ /**
12133
+ *
12134
+ * @param {Object} config - Configurations
12135
+ * @param {string} config.name - Name of the profile, must be the same on all drivers used to access the encrypted data.
12136
+ * @param {KeyEncapsulationService} config.encapsulationService - Encapsulation service used to encapsulate and dencapsulate keys. The driver ships with {@link LocalKeyEncapsulationService}, other implementations can be found as separate packages.
12137
+ * @param {EncapsulatedKeyRecordRepository} config.keyRepository - Implementation of the {@link EncapsulatedKeyRecordRepository} interface, must be implemented so that the driver can access your key repository.
12138
+ * @param {number} config.keyCacheTTL - How How long in milliseconds to keep a retrieved encapsulated keys cached by Id - defaults to 15 minutes
12139
+ * @param {number} config.keyCacheMaxSize - How many items to keep in the key cache before pruning the oldest, setting to 0 will disable the cache - defaults to 100
12140
+ * @param {number} config.keyAliasIndexTTL - How How long in milliseconds to keep the mapping of alias to key cached - defaults to 15 seconds
12141
+ * @param {number} config.keyAliasIndexMaxSize - How many items to keep in the alias cache before pruning the oldest, setting to 0 will disable the index - defaults to 100
12142
+ */
12143
+ function EnvelopeEncryptionProfile(config) {
12144
+ var _a, _b, _c, _d;
12145
+ this.name = config.name;
12146
+ this.encapsulationService = config.encapsulationService;
12147
+ this.keyRepository = config.keyRepository;
12148
+ if (config.keyCacheMaxSize !== 0) {
12149
+ this._keyCache = new Map();
12150
+ }
12151
+ this._keyCacheTTL = (_a = config.keyCacheTTL) !== null && _a !== void 0 ? _a : 15 * 60 * 1000;
12152
+ this._keyCacheMaxSize = (_b = config.keyCacheMaxSize) !== null && _b !== void 0 ? _b : 100;
12153
+ if (this._keyCache != null && config.keyAliasIndexMaxSize !== 0) {
12154
+ this._aliasIndex = new Map();
12155
+ }
12156
+ this._keyAliasIndexTTL = (_c = config.keyAliasIndexTTL) !== null && _c !== void 0 ? _c : 15 * 1000;
12157
+ this._keyAliasIndexMaxSize = (_d = config.keyAliasIndexMaxSize) !== null && _d !== void 0 ? _d : 100;
12158
+ this.type = 'ENVELOPE';
12159
+ this.version = (0, integer_1$1.int)(1);
12160
+ }
12161
+ /**
12162
+ * @private
12163
+ */
12164
+ EnvelopeEncryptionProfile.prototype.findKey = function (options) {
12165
+ return __awaiter$g(this, void 0, void 0, function () {
12166
+ var key;
12167
+ return __generator$i(this, function (_a) {
12168
+ switch (_a.label) {
12169
+ case 0:
12170
+ if (!(typeof options === 'string')) return [3 /*break*/, 2];
12171
+ return [4 /*yield*/, this._findById(options)];
12172
+ case 1:
12173
+ key = _a.sent();
12174
+ return [3 /*break*/, 7];
12175
+ case 2:
12176
+ if (!(options.id != null)) return [3 /*break*/, 4];
12177
+ return [4 /*yield*/, this._findById(options.id)];
12178
+ case 3:
12179
+ key = _a.sent();
12180
+ return [3 /*break*/, 7];
12181
+ case 4:
12182
+ if (!(options.alias != null)) return [3 /*break*/, 6];
12183
+ return [4 /*yield*/, this._findByAlias(options.alias)];
12184
+ case 5:
12185
+ key = _a.sent();
12186
+ return [3 /*break*/, 7];
12187
+ case 6: throw (0, error_1$8.newError)("invalid key options: ".concat((0, json_1$2.stringify)(options)));
12188
+ case 7: return [2 /*return*/, key];
12189
+ }
12190
+ });
12191
+ });
12192
+ };
12193
+ /**
12194
+ * @private
12195
+ */
12196
+ EnvelopeEncryptionProfile.prototype.saveKey = function (alias, encapsulation, metadata) {
12197
+ return __awaiter$g(this, void 0, void 0, function () {
12198
+ var key, e_1;
12199
+ return __generator$i(this, function (_a) {
12200
+ switch (_a.label) {
12201
+ case 0:
12202
+ _a.trys.push([0, 2, , 3]);
12203
+ return [4 /*yield*/, this.keyRepository.create(alias, encapsulation, metadata)];
12204
+ case 1:
12205
+ key = _a.sent();
12206
+ if (this._keyCache != null) {
12207
+ this._keyCache.set(key.id(), { entry: key, retrieved: new Date() });
12208
+ this._pruneCache(this._keyCache, this._keyCacheMaxSize);
12209
+ if (this._aliasIndex != null && alias != null) {
12210
+ this._aliasIndex.set(alias, { entry: key.id(), retrieved: new Date() });
12211
+ this._pruneCache(this._aliasIndex, this._keyAliasIndexMaxSize);
12212
+ }
12213
+ }
12214
+ return [2 /*return*/, key];
12215
+ case 2:
12216
+ e_1 = _a.sent();
12217
+ throw (0, error_1$8.newError)('Call to EncapsulatedKeyRepository.create threw error, see cause', '50N42', e_1);
12218
+ case 3: return [2 /*return*/];
12219
+ }
12220
+ });
12221
+ });
12222
+ };
12223
+ /**
12224
+ * @private
12225
+ */
12226
+ EnvelopeEncryptionProfile.prototype._findById = function (id) {
12227
+ return __awaiter$g(this, void 0, void 0, function () {
12228
+ var entry, key, e_2;
12229
+ var _a, _b;
12230
+ return __generator$i(this, function (_c) {
12231
+ switch (_c.label) {
12232
+ case 0:
12233
+ if (this._keyCache != null) {
12234
+ entry = this._keyCache.get(id);
12235
+ if (entry != null) {
12236
+ if (new Date().getTime() - ((_a = entry === null || entry === void 0 ? void 0 : entry.retrieved.getTime()) !== null && _a !== void 0 ? _a : 0) < ((_b = this._keyCacheTTL) !== null && _b !== void 0 ? _b : 0)) {
12237
+ return [2 /*return*/, entry === null || entry === void 0 ? void 0 : entry.entry];
12238
+ }
12239
+ else {
12240
+ this._keyCache.delete(id);
12241
+ }
12242
+ }
12243
+ }
12244
+ _c.label = 1;
12245
+ case 1:
12246
+ _c.trys.push([1, 3, , 4]);
12247
+ return [4 /*yield*/, this.keyRepository.findById(id)];
12248
+ case 2:
12249
+ key = _c.sent();
12250
+ return [3 /*break*/, 4];
12251
+ case 3:
12252
+ e_2 = _c.sent();
12253
+ throw (0, error_1$8.newError)('Call to EncapsulatedKeyRepository.findById threw error, see cause', '50N42', e_2);
12254
+ case 4:
12255
+ if (key == null) {
12256
+ return [2 /*return*/, undefined];
12257
+ }
12258
+ if (this._keyCache != null) {
12259
+ this._keyCache.set(id, { entry: key, retrieved: new Date() });
12260
+ this._pruneCache(this._keyCache, this._keyCacheMaxSize);
12261
+ }
12262
+ return [2 /*return*/, key];
12263
+ }
12264
+ });
12265
+ });
12266
+ };
12267
+ /**
12268
+ * @private
12269
+ */
12270
+ EnvelopeEncryptionProfile.prototype._findByAlias = function (alias) {
12271
+ return __awaiter$g(this, void 0, void 0, function () {
12272
+ var entry, key, e_3;
12273
+ var _a, _b;
12274
+ return __generator$i(this, function (_c) {
12275
+ switch (_c.label) {
12276
+ case 0:
12277
+ if (!(this._aliasIndex != null)) return [3 /*break*/, 3];
12278
+ entry = this._aliasIndex.get(alias);
12279
+ if (!(entry != null)) return [3 /*break*/, 3];
12280
+ if (!(new Date().getTime() - ((_a = entry === null || entry === void 0 ? void 0 : entry.retrieved.getTime()) !== null && _a !== void 0 ? _a : 0) < ((_b = this._keyAliasIndexTTL) !== null && _b !== void 0 ? _b : 0))) return [3 /*break*/, 2];
12281
+ return [4 /*yield*/, this._findById(entry === null || entry === void 0 ? void 0 : entry.entry)];
12282
+ case 1: return [2 /*return*/, _c.sent()];
12283
+ case 2:
12284
+ this._aliasIndex.delete(alias);
12285
+ _c.label = 3;
12286
+ case 3:
12287
+ _c.trys.push([3, 5, , 6]);
12288
+ return [4 /*yield*/, this.keyRepository.findByAlias(alias)];
12289
+ case 4:
12290
+ key = _c.sent();
12291
+ return [3 /*break*/, 6];
12292
+ case 5:
12293
+ e_3 = _c.sent();
12294
+ throw (0, error_1$8.newError)('Call to EncapsulatedKeyRepository.findByAlias threw error, see cause', '50N42', e_3);
12295
+ case 6:
12296
+ if (key == null) {
12297
+ return [2 /*return*/, undefined];
12298
+ }
12299
+ if (this._keyCache != null) {
12300
+ this._keyCache.set(key.id(), { entry: key, retrieved: new Date() });
12301
+ this._pruneCache(this._keyCache, this._keyCacheMaxSize);
12302
+ if (this._aliasIndex != null) {
12303
+ this._aliasIndex.set(alias, { entry: key.id(), retrieved: new Date() });
12304
+ this._pruneCache(this._aliasIndex, this._keyAliasIndexMaxSize);
12305
+ }
12306
+ }
12307
+ return [2 /*return*/, key];
12308
+ }
12309
+ });
12310
+ });
12311
+ };
12312
+ /**
12313
+ * @private
12314
+ */
12315
+ EnvelopeEncryptionProfile.prototype._pruneCache = function (cache, maxSize) {
12316
+ if (cache.size > maxSize) {
12317
+ var entries = Array.from(cache.entries());
12318
+ entries.sort(function (a, b) { return a[1].retrieved.getTime() - b[1].retrieved.getTime(); });
12319
+ var i = 0;
12320
+ while (cache.size > maxSize) {
12321
+ cache.delete(entries[i][0]);
12322
+ i++;
12323
+ }
12324
+ }
12325
+ };
12326
+ /**
12327
+ * @private
12328
+ */
12329
+ EnvelopeEncryptionProfile.prototype.removeFromKeyCache = function (id) {
12330
+ if (this._keyCache != null) {
12331
+ this._keyCache.delete(id);
12332
+ this.setAliasIndexEntry(id, undefined);
12333
+ }
12334
+ };
12335
+ EnvelopeEncryptionProfile.prototype.setAliasIndexEntry = function (id, alias) {
12336
+ var _this = this;
12337
+ var _a;
12338
+ (_a = this._keyCache) === null || _a === void 0 ? void 0 : _a.delete(id);
12339
+ if (this._aliasIndex != null) {
12340
+ this._aliasIndex.forEach(function (val, key) {
12341
+ if (val.entry === id) {
12342
+ if (_this._aliasIndex != null) {
12343
+ _this._aliasIndex.delete(key);
12344
+ }
12345
+ }
12346
+ });
12347
+ if (alias != null) {
12348
+ this._aliasIndex.set(alias, { entry: id, retrieved: new Date() });
12349
+ }
12350
+ }
12351
+ };
12352
+ return EnvelopeEncryptionProfile;
12353
+ }());
12354
+ encryptionProfile.EnvelopeEncryptionProfile = EnvelopeEncryptionProfile;
12355
+
12356
+ /**
12357
+ * Copyright (c) "Neo4j"
12358
+ * Neo4j Sweden AB [https://neo4j.com]
12359
+ *
12360
+ * Licensed under the Apache License, Version 2.0 (the "License");
12361
+ * you may not use this file except in compliance with the License.
12362
+ * You may obtain a copy of the License at
12363
+ *
12364
+ * http://www.apache.org/licenses/LICENSE-2.0
12365
+ *
12366
+ * Unless required by applicable law or agreed to in writing, software
12367
+ * distributed under the License is distributed on an "AS IS" BASIS,
12368
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12369
+ * See the License for the specific language governing permissions and
12370
+ * limitations under the License.
12371
+ */
12372
+ var __awaiter$f = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
12373
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
12374
+ return new (P || (P = Promise))(function (resolve, reject) {
12375
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
12376
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
12377
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
12378
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
12379
+ });
12380
+ };
12381
+ var __generator$h = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
12382
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12383
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
12384
+ function verb(n) { return function (v) { return step([n, v]); }; }
12385
+ function step(op) {
12386
+ if (f) throw new TypeError("Generator is already executing.");
12387
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
12388
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
12389
+ if (y = 0, t) op = [op[0] & 2, t.value];
12390
+ switch (op[0]) {
12391
+ case 0: case 1: t = op; break;
12392
+ case 4: _.label++; return { value: op[1], done: false };
12393
+ case 5: _.label++; y = op[1]; op = [0]; continue;
12394
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
12395
+ default:
12396
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
12397
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
12398
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
12399
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
12400
+ if (t[2]) _.ops.pop();
12401
+ _.trys.pop(); continue;
12402
+ }
12403
+ op = body.call(thisArg, _);
12404
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
12405
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
12406
+ }
12407
+ };
12118
12408
  Object.defineProperty(encapsulatedKeyManager, "__esModule", { value: true });
12119
12409
  encapsulatedKeyManager.EncapsulatedKeyManager = void 0;
12120
- var error_1$8 = error;
12410
+ var encryption_profile_1 = encryptionProfile;
12411
+ var error_1$7 = error;
12121
12412
  /**
12122
12413
  * A manager for encapsulated keys.
12123
12414
  *
@@ -12143,9 +12434,9 @@ var EncapsulatedKeyManager = /** @class */ (function () {
12143
12434
  * @returns {Promise<void>} Promise that resolves when the key is created, saved and ready to use.
12144
12435
  */
12145
12436
  EncapsulatedKeyManager.prototype.create = function (name) {
12146
- return __awaiter$g(this, void 0, void 0, function () {
12437
+ return __awaiter$f(this, void 0, void 0, function () {
12147
12438
  var encapulated;
12148
- return __generator$i(this, function (_a) {
12439
+ return __generator$h(this, function (_a) {
12149
12440
  switch (_a.label) {
12150
12441
  case 0: return [4 /*yield*/, this._keyEncapsulationService.encapsulate({})];
12151
12442
  case 1:
@@ -12163,9 +12454,9 @@ var EncapsulatedKeyManager = /** @class */ (function () {
12163
12454
  * @return the encapsulated key or undefined when no key with the given id exists
12164
12455
  */
12165
12456
  EncapsulatedKeyManager.prototype.findById = function (id) {
12166
- return __awaiter$g(this, void 0, void 0, function () {
12457
+ return __awaiter$f(this, void 0, void 0, function () {
12167
12458
  var record;
12168
- return __generator$i(this, function (_a) {
12459
+ return __generator$h(this, function (_a) {
12169
12460
  switch (_a.label) {
12170
12461
  case 0: return [4 /*yield*/, this._profile.findKey({ id: id })];
12171
12462
  case 1:
@@ -12187,9 +12478,9 @@ var EncapsulatedKeyManager = /** @class */ (function () {
12187
12478
  * @return the encapsulated key or undefined when no key with the given alias exists
12188
12479
  */
12189
12480
  EncapsulatedKeyManager.prototype.findByAlias = function (alias) {
12190
- return __awaiter$g(this, void 0, void 0, function () {
12481
+ return __awaiter$f(this, void 0, void 0, function () {
12191
12482
  var record;
12192
- return __generator$i(this, function (_a) {
12483
+ return __generator$h(this, function (_a) {
12193
12484
  switch (_a.label) {
12194
12485
  case 0: return [4 /*yield*/, this._profile.findKey({ alias: alias })];
12195
12486
  case 1:
@@ -12212,17 +12503,22 @@ var EncapsulatedKeyManager = /** @class */ (function () {
12212
12503
  * @param {string | undefined} alias the new key alias
12213
12504
  */
12214
12505
  EncapsulatedKeyManager.prototype.setAliasById = function (id, alias) {
12215
- return __awaiter$g(this, void 0, void 0, function () {
12506
+ return __awaiter$f(this, void 0, void 0, function () {
12216
12507
  var e_1;
12217
- return __generator$i(this, function (_a) {
12508
+ return __generator$h(this, function (_a) {
12218
12509
  switch (_a.label) {
12219
12510
  case 0:
12220
12511
  _a.trys.push([0, 2, , 3]);
12221
12512
  return [4 /*yield*/, this._profile.keyRepository.setAliasById(id, alias)];
12222
- case 1: return [2 /*return*/, _a.sent()];
12513
+ case 1:
12514
+ _a.sent();
12515
+ if (this._profile instanceof encryption_profile_1.EnvelopeEncryptionProfile) {
12516
+ this._profile.setAliasIndexEntry(id, alias);
12517
+ }
12518
+ return [3 /*break*/, 3];
12223
12519
  case 2:
12224
12520
  e_1 = _a.sent();
12225
- throw (0, error_1$8.newError)('Call to EncapsulatedKeyRepository.setAliasById threw error, see cause', '50N42', e_1);
12521
+ throw (0, error_1$7.newError)('Call to EncapsulatedKeyRepository.setAliasById threw error, see cause', '50N42', e_1);
12226
12522
  case 3: return [2 /*return*/];
12227
12523
  }
12228
12524
  });
@@ -12234,8 +12530,8 @@ var EncapsulatedKeyManager = /** @class */ (function () {
12234
12530
  * @param {string} id the key id
12235
12531
  */
12236
12532
  EncapsulatedKeyManager.prototype.deleteAliasById = function (id) {
12237
- return __awaiter$g(this, void 0, void 0, function () {
12238
- return __generator$i(this, function (_a) {
12533
+ return __awaiter$f(this, void 0, void 0, function () {
12534
+ return __generator$h(this, function (_a) {
12239
12535
  switch (_a.label) {
12240
12536
  case 0: return [4 /*yield*/, this.setAliasById(id, undefined)];
12241
12537
  case 1: return [2 /*return*/, _a.sent()];
@@ -12249,17 +12545,22 @@ var EncapsulatedKeyManager = /** @class */ (function () {
12249
12545
  * @param {string} id the key id, must not be {@literal null}
12250
12546
  */
12251
12547
  EncapsulatedKeyManager.prototype.deleteById = function (id) {
12252
- return __awaiter$g(this, void 0, void 0, function () {
12548
+ return __awaiter$f(this, void 0, void 0, function () {
12253
12549
  var e_2;
12254
- return __generator$i(this, function (_a) {
12550
+ return __generator$h(this, function (_a) {
12255
12551
  switch (_a.label) {
12256
12552
  case 0:
12257
12553
  _a.trys.push([0, 2, , 3]);
12258
12554
  return [4 /*yield*/, this._profile.keyRepository.deleteById(id)];
12259
- case 1: return [2 /*return*/, _a.sent()];
12555
+ case 1:
12556
+ _a.sent();
12557
+ if (this._profile instanceof encryption_profile_1.EnvelopeEncryptionProfile) {
12558
+ this._profile.removeFromKeyCache(id);
12559
+ }
12560
+ return [3 /*break*/, 3];
12260
12561
  case 2:
12261
12562
  e_2 = _a.sent();
12262
- throw (0, error_1$8.newError)('Call to EncapsulatedKeyRepository.deleteById threw error, see cause', '50N42', e_2);
12563
+ throw (0, error_1$7.newError)('Call to EncapsulatedKeyRepository.deleteById threw error, see cause', '50N42', e_2);
12263
12564
  case 3: return [2 /*return*/];
12264
12565
  }
12265
12566
  });
@@ -12287,7 +12588,7 @@ var crypto = {};
12287
12588
  * See the License for the specific language governing permissions and
12288
12589
  * limitations under the License.
12289
12590
  */
12290
- var __awaiter$f = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
12591
+ var __awaiter$e = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
12291
12592
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
12292
12593
  return new (P || (P = Promise))(function (resolve, reject) {
12293
12594
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -12296,7 +12597,7 @@ var __awaiter$f = (commonjsGlobal && commonjsGlobal.__awaiter) || function (this
12296
12597
  step((generator = generator.apply(thisArg, _arguments || [])).next());
12297
12598
  });
12298
12599
  };
12299
- var __generator$h = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
12600
+ var __generator$g = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
12300
12601
  var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12301
12602
  return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
12302
12603
  function verb(n) { return function (v) { return step([n, v]); }; }
@@ -12331,10 +12632,10 @@ var CryptoProvider = /** @class */ (function () {
12331
12632
  function CryptoProvider() {
12332
12633
  }
12333
12634
  CryptoProvider.prototype.encrypt = function (key, message, aad) {
12334
- return __awaiter$f(this, void 0, void 0, function () {
12635
+ return __awaiter$e(this, void 0, void 0, function () {
12335
12636
  var iv, _a, _b, _c;
12336
12637
  var _d;
12337
- return __generator$h(this, function (_e) {
12638
+ return __generator$g(this, function (_e) {
12338
12639
  switch (_e.label) {
12339
12640
  case 0:
12340
12641
  iv = this.getRandomValues(12);
@@ -12362,9 +12663,9 @@ var CryptoProvider = /** @class */ (function () {
12362
12663
  });
12363
12664
  };
12364
12665
  CryptoProvider.prototype.decrypt = function (key, iv, message, aad) {
12365
- return __awaiter$f(this, void 0, void 0, function () {
12666
+ return __awaiter$e(this, void 0, void 0, function () {
12366
12667
  var _a, _b, _c;
12367
- return __generator$h(this, function (_d) {
12668
+ return __generator$g(this, function (_d) {
12368
12669
  switch (_d.label) {
12369
12670
  case 0:
12370
12671
  _b = (_a = window.crypto.subtle).decrypt;
@@ -12415,7 +12716,7 @@ var vector$1 = {};
12415
12716
  Object.defineProperty(vector$1, "__esModule", { value: true });
12416
12717
  vector$1.vector = vector;
12417
12718
  vector$1.isVector = isVector;
12418
- var error_1$7 = error;
12719
+ var error_1$6 = error;
12419
12720
  var VECTOR_IDENTIFIER_PROPERTY = '__isVector__';
12420
12721
  /**
12421
12722
  * @typedef {'INT8' | 'INT16' | 'INT32' | 'INT64' | 'FLOAT32' | 'FLOAT64'} VectorType
@@ -12461,7 +12762,7 @@ var Vector = /** @class */ (function () {
12461
12762
  this._type = vectorTypes.FLOAT64;
12462
12763
  }
12463
12764
  else {
12464
- throw (0, error_1$7.newError)("Invalid argument type passed to Vector constructor: should be signed integer or float TypedArray, got: ".concat((_b = (_a = typedArray === null || typedArray === void 0 ? void 0 : typedArray.constructor) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : 'undefined or type without constructor name'));
12765
+ throw (0, error_1$6.newError)("Invalid argument type passed to Vector constructor: should be signed integer or float TypedArray, got: ".concat((_b = (_a = typedArray === null || typedArray === void 0 ? void 0 : typedArray.constructor) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : 'undefined or type without constructor name'));
12465
12766
  }
12466
12767
  this._typedArray = typedArray;
12467
12768
  }
@@ -12500,7 +12801,7 @@ function getTypeString(type) {
12500
12801
  case 'FLOAT64':
12501
12802
  return 'FLOAT NOT NULL';
12502
12803
  default:
12503
- throw (0, error_1$7.newError)("Cannot stringify vector with unsupported type. Got type: ".concat(type));
12804
+ throw (0, error_1$6.newError)("Cannot stringify vector with unsupported type. Got type: ".concat(type));
12504
12805
  }
12505
12806
  }
12506
12807
  Object.defineProperty(Vector.prototype, VECTOR_IDENTIFIER_PROPERTY, {
@@ -12521,7 +12822,7 @@ function vector(typedArray) {
12521
12822
  return new Vector(typedArray);
12522
12823
  }
12523
12824
  catch (_c) {
12524
- throw (0, error_1$7.newError)("Invalid argument type passed to vector constructor function: should be signed integer or float TypedArray, got: ".concat((_b = (_a = typedArray === null || typedArray === void 0 ? void 0 : typedArray.constructor) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : 'undefined or type without constructor name'));
12825
+ throw (0, error_1$6.newError)("Invalid argument type passed to vector constructor function: should be signed integer or float TypedArray, got: ".concat((_b = (_a = typedArray === null || typedArray === void 0 ? void 0 : typedArray.constructor) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : 'undefined or type without constructor name'));
12525
12826
  }
12526
12827
  }
12527
12828
  /**
@@ -12554,7 +12855,7 @@ var uuid$1 = {};
12554
12855
  Object.defineProperty(uuid$1, "__esModule", { value: true });
12555
12856
  uuid$1.uuid = uuid;
12556
12857
  uuid$1.isUUID = isUUID;
12557
- var error_1$6 = error;
12858
+ var error_1$5 = error;
12558
12859
  var UUID_IDENTIFIER_PROPERTY = '__isUUID__';
12559
12860
  var uuidV4DashLocations = [3, 5, 7, 9];
12560
12861
  /**
@@ -12569,7 +12870,7 @@ var uuidV4DashLocations = [3, 5, 7, 9];
12569
12870
  var UUID = /** @class */ (function () {
12570
12871
  function UUID(typedArray) {
12571
12872
  if (typedArray.length !== 16) {
12572
- throw (0, error_1$6.newError)("Uint8Array representation of UUID must be of length 16, got ".concat(typedArray.toString()));
12873
+ throw (0, error_1$5.newError)("Uint8Array representation of UUID must be of length 16, got ".concat(typedArray.toString()));
12573
12874
  }
12574
12875
  this._typedArray = typedArray;
12575
12876
  Object.freeze(this);
@@ -12605,7 +12906,7 @@ var UUID = /** @class */ (function () {
12605
12906
  UUID.fromString = function (uuidString) {
12606
12907
  if (uuidString.match(/^[\da-fA-F]{32}$/) === null &&
12607
12908
  uuidString.match(/^[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}$/) === null) {
12608
- throw (0, error_1$6.newError)("UUID string base16 encoded should be of format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx or without any dashes, got: ".concat(uuidString));
12909
+ throw (0, error_1$5.newError)("UUID string base16 encoded should be of format xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx or without any dashes, got: ".concat(uuidString));
12609
12910
  }
12610
12911
  uuidString = uuidString.replace(/-/g, '');
12611
12912
  var result = [];
@@ -12640,7 +12941,7 @@ function uuid(rawUUID) {
12640
12941
  return new UUID(rawUUID);
12641
12942
  }
12642
12943
  // @ts-expect-error
12643
- throw (0, error_1$6.newError)("Invalid argument type passed to UUID constructor function: expected Uint8Array or uuid string, got: ".concat((_b = (_a = rawUUID === null || rawUUID === void 0 ? void 0 : rawUUID.constructor) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : 'undefined or type without constructor name'));
12944
+ throw (0, error_1$5.newError)("Invalid argument type passed to UUID constructor function: expected Uint8Array or uuid string, got: ".concat((_b = (_a = rawUUID === null || rawUUID === void 0 ? void 0 : rawUUID.constructor) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : 'undefined or type without constructor name'));
12644
12945
  }
12645
12946
  /**
12646
12947
  * Test if given object is an instance of the {@link UUID} class.
@@ -12776,7 +13077,7 @@ var __importStar$6 = (commonjsGlobal && commonjsGlobal.__importStar) || (functio
12776
13077
  return result;
12777
13078
  };
12778
13079
  })();
12779
- var __awaiter$e = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
13080
+ var __awaiter$d = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
12780
13081
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
12781
13082
  return new (P || (P = Promise))(function (resolve, reject) {
12782
13083
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -12785,7 +13086,7 @@ var __awaiter$e = (commonjsGlobal && commonjsGlobal.__awaiter) || function (this
12785
13086
  step((generator = generator.apply(thisArg, _arguments || [])).next());
12786
13087
  });
12787
13088
  };
12788
- var __generator$g = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
13089
+ var __generator$f = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
12789
13090
  var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12790
13091
  return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
12791
13092
  function verb(n) { return function (v) { return step([n, v]); }; }
@@ -12816,7 +13117,7 @@ var __importDefault$10 = (commonjsGlobal && commonjsGlobal.__importDefault) || f
12816
13117
  return (mod && mod.__esModule) ? mod : { "default": mod };
12817
13118
  };
12818
13119
  Object.defineProperty(encryption, "__esModule", { value: true });
12819
- var integer_1$1 = __importStar$6(integer);
13120
+ var integer_1 = __importStar$6(integer);
12820
13121
  var encrypted_value_1 = encryptedValue;
12821
13122
  var encapsulated_key_manager_1 = encapsulatedKeyManager;
12822
13123
  var crypto_1$1 = __importDefault$10(crypto);
@@ -12824,8 +13125,8 @@ var temporal_types_1 = temporalTypes;
12824
13125
  var vector_1 = vector$1;
12825
13126
  var spatial_types_1 = spatialTypes;
12826
13127
  var uuid_1 = uuid$1;
12827
- var error_1$5 = error;
12828
- var json_1$2 = json$3;
13128
+ var error_1$4 = error;
13129
+ var json_1$1 = json$3;
12829
13130
  var protocol_version_1 = protocolVersion;
12830
13131
  var unsupported_type_1$1 = __importDefault$10(unsupportedType);
12831
13132
  var supportedAADTypes = ['BOOLEAN', 'DATE', 'INTEGER', 'LOCAL TIME', 'POINT', 'STRING', 'ZONED TIME', 'UUID', 'BYTES'];
@@ -12845,7 +13146,7 @@ var EncryptionService = /** @class */ (function () {
12845
13146
  this._profiles = new Map();
12846
13147
  profiles.forEach(function (profile) {
12847
13148
  if (_this._profiles.has(profile.name)) {
12848
- throw (0, error_1$5.newError)("Multiple profiles with name ".concat(profile.name, " configured, each profile must have a unique name."));
13149
+ throw (0, error_1$4.newError)("Multiple profiles with name ".concat(profile.name, " configured, each profile must have a unique name."));
12849
13150
  }
12850
13151
  _this._profiles.set(profile.name, { profile: profile, keyManager: new encapsulated_key_manager_1.EncapsulatedKeyManager(profile, profile.encapsulationService) });
12851
13152
  });
@@ -12864,9 +13165,9 @@ var EncryptionService = /** @class */ (function () {
12864
13165
  * @returns {Promise<Int8Array>} A Int8Array that can be stored as a ByteArray in a Neo4j database.
12865
13166
  */
12866
13167
  EncryptionService.prototype.encrypt = function (encryptRequest) {
12867
- return __awaiter$e(this, void 0, void 0, function () {
13168
+ return __awaiter$d(this, void 0, void 0, function () {
12868
13169
  var profile, _a, typeName, typeProtocolMajor, typeProtocolMinor, encodedValue, encodedAAD, aadType, key, decapsulatedKey, _b, cyphertext, iv, metadata, e_1;
12869
- return __generator$g(this, function (_c) {
13170
+ return __generator$f(this, function (_c) {
12870
13171
  switch (_c.label) {
12871
13172
  case 0:
12872
13173
  profile = this._getProfile(encryptRequest.encryptionProfile);
@@ -12875,7 +13176,7 @@ var EncryptionService = /** @class */ (function () {
12875
13176
  if (encryptRequest.aad !== undefined) {
12876
13177
  aadType = this._identifyType(encryptRequest.aad);
12877
13178
  if (!supportedAADTypes.includes(aadType.typeName)) {
12878
- throw (0, error_1$5.newError)("Unsupported AAD property type ".concat(aadType.typeName, ", supported values are ").concat(supportedAADTypes.toString()));
13179
+ throw (0, error_1$4.newError)("Unsupported AAD property type ".concat(aadType.typeName, ", supported values are ").concat(supportedAADTypes.toString()));
12879
13180
  }
12880
13181
  encodedAAD = this._boltProvider.encodeValue(encryptRequest.aad);
12881
13182
  }
@@ -12901,7 +13202,7 @@ var EncryptionService = /** @class */ (function () {
12901
13202
  return [2 /*return*/, this._boltProvider.encodeObject(new encrypted_value_1.EncryptedValue(new Int8Array(cyphertext), profile.profile.name, profile.profile.type, profile.profile.version, typeName, typeProtocolMajor, typeProtocolMinor, metadata))];
12902
13203
  case 5:
12903
13204
  e_1 = _c.sent();
12904
- throw (0, error_1$5.newError)('Property encryption failed due to internal error, see cause.', '50N42', e_1);
13205
+ throw (0, error_1$4.newError)('Property encryption failed due to internal error, see cause.', '50N42', e_1);
12905
13206
  case 6: return [2 /*return*/];
12906
13207
  }
12907
13208
  });
@@ -12918,26 +13219,28 @@ var EncryptionService = /** @class */ (function () {
12918
13219
  * @returns {Promise<T | UnsupportedType>} The decrypted property or an {@link UnsupportedType} if decoding the decrypted bytes failed.
12919
13220
  */
12920
13221
  EncryptionService.prototype.decrypt = function (decryptRequest) {
12921
- return __awaiter$e(this, void 0, void 0, function () {
13222
+ return __awaiter$d(this, void 0, void 0, function () {
12922
13223
  var encodedAAD, struct, aadType, profile, key, decapsulatedKey, decodedValue, _a, _b, type, e_2;
12923
- return __generator$g(this, function (_c) {
13224
+ return __generator$f(this, function (_c) {
12924
13225
  switch (_c.label) {
12925
13226
  case 0:
12926
13227
  struct = this._boltProvider.decodeObject(decryptRequest.ciphertext);
12927
- if (struct.typeProtocolMajor.notEquals((0, integer_1$1.int)(1)) || struct.typeProtocolMinor.greaterThan((0, integer_1$1.int)(0))) {
13228
+ if (struct.typeProtocolMajor.notEquals((0, integer_1.int)(1)) || struct.typeProtocolMinor.greaterThan((0, integer_1.int)(0))) {
12928
13229
  return [2 /*return*/, new unsupported_type_1$1.default('Undecryptable Value', struct.typeProtocolMajor.toNumber(), struct.typeProtocolMinor.toNumber(), 'Encrypted value was encoded with a newer driver, you must update your driver version to decode it.')];
12929
13230
  }
12930
- if (!(struct.profileType === 'ENVELOPE' && struct.profileVersion.equals((0, integer_1$1.int)(1)))) return [3 /*break*/, 7];
13231
+ if (!(struct.profileType === 'ENVELOPE' && struct.profileVersion.equals((0, integer_1.int)(1)))) return [3 /*break*/, 7];
12931
13232
  if (decryptRequest.usePersistedAad === true) {
12932
13233
  encodedAAD = struct.metadata.aad !== undefined ? struct.metadata.aad.buffer : undefined;
12933
13234
  }
12934
13235
  else if (decryptRequest.aad !== undefined) {
12935
13236
  aadType = this._identifyType(decryptRequest.aad);
12936
- if (aadType.typeProtocolMajor !== struct.metadata.aad_encoding_scheme_major || aadType.typeProtocolMinor !== struct.metadata.aad_encoding_scheme_minor) {
12937
- encodedAAD = this._boltProvider.encodeAAD(decryptRequest.aad, new protocol_version_1.ProtocolVersion(struct.metadata.aad_encoding_scheme_major, struct.metadata.aad_encoding_scheme_minor));
13237
+ // The below if statement functions until there are multiple major version encoding schemes.
13238
+ if (struct.metadata.aad_encoding_scheme_major == null || struct.metadata.aad_encoding_scheme_minor == null ||
13239
+ aadType.typeProtocolMajor.equals(struct.metadata.aad_encoding_scheme_major) || aadType.typeProtocolMinor.equals(struct.metadata.aad_encoding_scheme_minor)) {
13240
+ encodedAAD = this._boltProvider.encodeAAD(decryptRequest.aad, new protocol_version_1.ProtocolVersion(aadType.typeProtocolMajor.toNumber(), aadType.typeProtocolMinor.toNumber()));
12938
13241
  }
12939
13242
  else {
12940
- throw (0, error_1$5.newError)('AAD used to encrypt was encoded with a newer encoding scheme than this driver supports');
13243
+ throw (0, error_1$4.newError)('AAD used to encrypt was encoded with a different encoding scheme than this driver supports');
12941
13244
  }
12942
13245
  }
12943
13246
  profile = this._getProfile(struct.profileName);
@@ -12963,9 +13266,9 @@ var EncryptionService = /** @class */ (function () {
12963
13266
  }
12964
13267
  case 5:
12965
13268
  e_2 = _c.sent();
12966
- throw (0, error_1$5.newError)('Property decryption failed due to internal error, see cause.', '50N42', e_2);
13269
+ throw (0, error_1$4.newError)('Property decryption failed due to internal error, see cause.', '50N42', e_2);
12967
13270
  case 6: return [3 /*break*/, 8];
12968
- case 7: throw (0, error_1$5.newError)("Unsupported encryption profile version ".concat(struct.profileVersion.toString(), " of profile type ").concat(struct.profileType, "."));
13271
+ case 7: throw (0, error_1$4.newError)("Unsupported encryption profile version ".concat(struct.profileVersion.toString(), " of profile type ").concat(struct.profileType, "."));
12969
13272
  case 8: return [2 /*return*/];
12970
13273
  }
12971
13274
  });
@@ -12984,88 +13287,88 @@ var EncryptionService = /** @class */ (function () {
12984
13287
  // This function will need to be dynamic based on which version of the encoding is being used, currently only 1.0 (based on bolt 6.1) exists.
12985
13288
  EncryptionService.prototype._identifyType = function (value) {
12986
13289
  if (value === null) {
12987
- var verification = function (_) { throw (0, error_1$5.newError)('Encrypted arrays cannot contain null values'); };
12988
- return { typeName: 'NULL', typeProtocolMajor: (0, integer_1$1.int)(1), typeProtocolMinor: (0, integer_1$1.int)(0), verification: verification };
13290
+ var verification = function (_) { throw (0, error_1$4.newError)('Encrypted arrays cannot contain null values'); };
13291
+ return { typeName: 'NULL', typeProtocolMajor: (0, integer_1.int)(1), typeProtocolMinor: (0, integer_1.int)(0), verification: verification };
12989
13292
  }
12990
13293
  if (typeof value === 'string') {
12991
13294
  var verification = function (value) { return typeof value === 'string'; };
12992
- return { typeName: 'STRING', typeProtocolMajor: (0, integer_1$1.int)(1), typeProtocolMinor: (0, integer_1$1.int)(0), verification: verification };
13295
+ return { typeName: 'STRING', typeProtocolMajor: (0, integer_1.int)(1), typeProtocolMinor: (0, integer_1.int)(0), verification: verification };
12993
13296
  }
12994
13297
  if (typeof value === 'boolean') {
12995
13298
  var verification = function (value) { return typeof value === 'boolean'; };
12996
- return { typeName: 'BOOLEAN', typeProtocolMajor: (0, integer_1$1.int)(1), typeProtocolMinor: (0, integer_1$1.int)(0), verification: verification };
13299
+ return { typeName: 'BOOLEAN', typeProtocolMajor: (0, integer_1.int)(1), typeProtocolMinor: (0, integer_1.int)(0), verification: verification };
12997
13300
  }
12998
13301
  if (typeof value === 'number') {
12999
13302
  var verification = function (value) { return typeof value === 'number'; };
13000
- return { typeName: 'FLOAT', typeProtocolMajor: (0, integer_1$1.int)(1), typeProtocolMinor: (0, integer_1$1.int)(0), verification: verification };
13303
+ return { typeName: 'FLOAT', typeProtocolMajor: (0, integer_1.int)(1), typeProtocolMinor: (0, integer_1.int)(0), verification: verification };
13001
13304
  }
13002
13305
  if (typeof value === 'bigint') {
13003
13306
  var verification = function (value) { return typeof value === 'bigint'; };
13004
- return { typeName: 'INTEGER', typeProtocolMajor: (0, integer_1$1.int)(1), typeProtocolMinor: (0, integer_1$1.int)(0), verification: verification };
13307
+ return { typeName: 'INTEGER', typeProtocolMajor: (0, integer_1.int)(1), typeProtocolMinor: (0, integer_1.int)(0), verification: verification };
13005
13308
  }
13006
- if ((0, integer_1$1.isInt)(value)) {
13007
- var verification = function (value) { return (0, integer_1$1.isInt)(value); };
13008
- return { typeName: 'INTEGER', typeProtocolMajor: (0, integer_1$1.int)(1), typeProtocolMinor: (0, integer_1$1.int)(0), verification: verification };
13309
+ if ((0, integer_1.isInt)(value)) {
13310
+ var verification = function (value) { return (0, integer_1.isInt)(value); };
13311
+ return { typeName: 'INTEGER', typeProtocolMajor: (0, integer_1.int)(1), typeProtocolMinor: (0, integer_1.int)(0), verification: verification };
13009
13312
  }
13010
13313
  if ((0, temporal_types_1.isDate)(value)) {
13011
13314
  var verification = function (value) { return (0, temporal_types_1.isDate)(value); };
13012
- return { typeName: 'DATE', typeProtocolMajor: (0, integer_1$1.int)(1), typeProtocolMinor: (0, integer_1$1.int)(0), verification: verification };
13315
+ return { typeName: 'DATE', typeProtocolMajor: (0, integer_1.int)(1), typeProtocolMinor: (0, integer_1.int)(0), verification: verification };
13013
13316
  }
13014
13317
  if ((0, temporal_types_1.isDuration)(value)) {
13015
13318
  var verification = function (value) { return (0, temporal_types_1.isDuration)(value); };
13016
- return { typeName: 'DURATION', typeProtocolMajor: (0, integer_1$1.int)(1), typeProtocolMinor: (0, integer_1$1.int)(0), verification: verification };
13319
+ return { typeName: 'DURATION', typeProtocolMajor: (0, integer_1.int)(1), typeProtocolMinor: (0, integer_1.int)(0), verification: verification };
13017
13320
  }
13018
13321
  if ((0, vector_1.isVector)(value)) {
13019
- var verification = function (_) { throw (0, error_1$5.newError)('Encrypted arrays cannot contain vector values'); };
13020
- return { typeName: 'VECTOR', typeProtocolMajor: (0, integer_1$1.int)(1), typeProtocolMinor: (0, integer_1$1.int)(0), verification: verification };
13322
+ var verification = function (_) { throw (0, error_1$4.newError)('Encrypted arrays cannot contain vector values'); };
13323
+ return { typeName: 'VECTOR', typeProtocolMajor: (0, integer_1.int)(1), typeProtocolMinor: (0, integer_1.int)(0), verification: verification };
13021
13324
  }
13022
13325
  if (value instanceof Int8Array) {
13023
13326
  var verification = function (value) { return value instanceof Int8Array; };
13024
- return { typeName: 'BYTES', typeProtocolMajor: (0, integer_1$1.int)(1), typeProtocolMinor: (0, integer_1$1.int)(0), verification: verification };
13327
+ return { typeName: 'BYTES', typeProtocolMajor: (0, integer_1.int)(1), typeProtocolMinor: (0, integer_1.int)(0), verification: verification };
13025
13328
  }
13026
13329
  if ((0, temporal_types_1.isLocalDateTime)(value)) {
13027
13330
  var verification = function (value) { return (0, temporal_types_1.isLocalDateTime)(value); };
13028
- return { typeName: 'LOCAL DATETIME', typeProtocolMajor: (0, integer_1$1.int)(1), typeProtocolMinor: (0, integer_1$1.int)(0), verification: verification };
13331
+ return { typeName: 'LOCAL DATETIME', typeProtocolMajor: (0, integer_1.int)(1), typeProtocolMinor: (0, integer_1.int)(0), verification: verification };
13029
13332
  }
13030
13333
  if ((0, temporal_types_1.isLocalTime)(value)) {
13031
13334
  var verification = function (value) { return (0, temporal_types_1.isLocalTime)(value); };
13032
- return { typeName: 'LOCAL TIME', typeProtocolMajor: (0, integer_1$1.int)(1), typeProtocolMinor: (0, integer_1$1.int)(0), verification: verification };
13335
+ return { typeName: 'LOCAL TIME', typeProtocolMajor: (0, integer_1.int)(1), typeProtocolMinor: (0, integer_1.int)(0), verification: verification };
13033
13336
  }
13034
13337
  if ((0, temporal_types_1.isDateTime)(value)) {
13035
13338
  var verification = function (value) { return (0, temporal_types_1.isDateTime)(value); };
13036
- return { typeName: 'ZONED DATETIME', typeProtocolMajor: (0, integer_1$1.int)(1), typeProtocolMinor: (0, integer_1$1.int)(0), verification: verification };
13339
+ return { typeName: 'ZONED DATETIME', typeProtocolMajor: (0, integer_1.int)(1), typeProtocolMinor: (0, integer_1.int)(0), verification: verification };
13037
13340
  }
13038
13341
  if ((0, temporal_types_1.isTime)(value)) {
13039
13342
  var verification = function (value) { return (0, temporal_types_1.isTime)(value); };
13040
- return { typeName: 'ZONED TIME', typeProtocolMajor: (0, integer_1$1.int)(1), typeProtocolMinor: (0, integer_1$1.int)(0), verification: verification };
13343
+ return { typeName: 'ZONED TIME', typeProtocolMajor: (0, integer_1.int)(1), typeProtocolMinor: (0, integer_1.int)(0), verification: verification };
13041
13344
  }
13042
13345
  if ((0, spatial_types_1.isPoint)(value)) {
13043
13346
  var verification = function (point) {
13044
13347
  if ((0, spatial_types_1.isPoint)(point)) {
13045
- if ((point.srid instanceof BigInt ? integer_1$1.default.fromString(point.srid.toString()) : (0, integer_1$1.int)(point.srid))
13046
- .notEquals(value.srid instanceof BigInt ? integer_1$1.default.fromString(value.srid.toString()) : (0, integer_1$1.int)(value.srid))) {
13047
- throw (0, error_1$5.newError)('Encrypted arrays of Points must only contain Points with identical srids');
13348
+ if ((point.srid instanceof BigInt ? integer_1.default.fromString(point.srid.toString()) : (0, integer_1.int)(point.srid))
13349
+ .notEquals(value.srid instanceof BigInt ? integer_1.default.fromString(value.srid.toString()) : (0, integer_1.int)(value.srid))) {
13350
+ throw (0, error_1$4.newError)('Encrypted arrays of Points must only contain Points with identical srids');
13048
13351
  }
13049
13352
  if ((point.z == null && value.z != null) || (point.z != null && value.z == null)) {
13050
- throw (0, error_1$5.newError)('Encrypted arrays of Points must only contain Points of the same dimensionality.');
13353
+ throw (0, error_1$4.newError)('Encrypted arrays of Points must only contain Points of the same dimensionality.');
13051
13354
  }
13052
13355
  return true;
13053
13356
  }
13054
13357
  return false;
13055
13358
  };
13056
- return { typeName: 'POINT', typeProtocolMajor: (0, integer_1$1.int)(1), typeProtocolMinor: (0, integer_1$1.int)(0), verification: verification };
13359
+ return { typeName: 'POINT', typeProtocolMajor: (0, integer_1.int)(1), typeProtocolMinor: (0, integer_1.int)(0), verification: verification };
13057
13360
  }
13058
13361
  if ((0, uuid_1.isUUID)(value)) {
13059
13362
  var verification = function (value) { return (0, uuid_1.isUUID)(value); };
13060
- return { typeName: 'UUID', typeProtocolMajor: (0, integer_1$1.int)(1), typeProtocolMinor: (0, integer_1$1.int)(0), verification: verification };
13363
+ return { typeName: 'UUID', typeProtocolMajor: (0, integer_1.int)(1), typeProtocolMinor: (0, integer_1.int)(0), verification: verification };
13061
13364
  }
13062
13365
  if (Array.isArray(value)) {
13063
13366
  var type_1 = this._identifyType(value[0]);
13064
13367
  if (!value.map(function (element) { return type_1.verification(element); }).every(function (element) { return element; })) {
13065
- throw (0, error_1$5.newError)('Every element of an encrypted array must be of the same property type');
13368
+ throw (0, error_1$4.newError)('Every element of an encrypted array must be of the same property type');
13066
13369
  }
13067
- var major = (0, integer_1$1.int)(1);
13068
- var minor = (0, integer_1$1.int)(0);
13370
+ var major = (0, integer_1.int)(1);
13371
+ var minor = (0, integer_1.int)(0);
13069
13372
  if (type_1.typeProtocolMajor.greaterThan(major) || (type_1.typeProtocolMajor.equals(major) && type_1.typeProtocolMinor.greaterThan(minor))) {
13070
13373
  major = type_1.typeProtocolMajor;
13071
13374
  minor = type_1.typeProtocolMinor;
@@ -13073,7 +13376,7 @@ var EncryptionService = /** @class */ (function () {
13073
13376
  var verification = function (_) { return false; };
13074
13377
  return { typeName: 'LIST', typeProtocolMajor: major, typeProtocolMinor: minor, verification: verification };
13075
13378
  }
13076
- throw (0, error_1$5.newError)("could not identify type of: ".concat((0, json_1$2.stringify)(value)));
13379
+ throw (0, error_1$4.newError)("could not identify type of: ".concat((0, json_1$1.stringify)(value)));
13077
13380
  };
13078
13381
  EncryptionService.prototype._getProfile = function (name) {
13079
13382
  if (name == null) {
@@ -13082,27 +13385,27 @@ var EncryptionService = /** @class */ (function () {
13082
13385
  return this._profiles.get(this._profiles.keys().next().value);
13083
13386
  }
13084
13387
  else {
13085
- throw (0, error_1$5.newError)('When using a driver with multiple encryption profiles configured, which encryption profile to use must be explicitly provided');
13388
+ throw (0, error_1$4.newError)('When using a driver with multiple encryption profiles configured, which encryption profile to use must be explicitly provided');
13086
13389
  }
13087
13390
  }
13088
13391
  else {
13089
13392
  var profile = this._profiles.get(name);
13090
13393
  if (profile === undefined) {
13091
- throw (0, error_1$5.newError)("Could not find encryption profile with name ".concat(name));
13394
+ throw (0, error_1$4.newError)("Could not find encryption profile with name ".concat(name));
13092
13395
  }
13093
13396
  return profile;
13094
13397
  }
13095
13398
  };
13096
13399
  EncryptionService.prototype._getKeyRecord = function (profile, options) {
13097
- return __awaiter$e(this, void 0, void 0, function () {
13400
+ return __awaiter$d(this, void 0, void 0, function () {
13098
13401
  var key;
13099
- return __generator$g(this, function (_a) {
13402
+ return __generator$f(this, function (_a) {
13100
13403
  switch (_a.label) {
13101
13404
  case 0: return [4 /*yield*/, profile.findKey(options)];
13102
13405
  case 1:
13103
13406
  key = _a.sent();
13104
13407
  if (key == null) {
13105
- throw (0, error_1$5.newError)("Could not find key with key options: ".concat((0, json_1$2.stringify)(options)));
13408
+ throw (0, error_1$4.newError)("Could not find key with key options: ".concat((0, json_1$1.stringify)(options)));
13106
13409
  }
13107
13410
  return [2 /*return*/, key];
13108
13411
  }
@@ -13110,15 +13413,15 @@ var EncryptionService = /** @class */ (function () {
13110
13413
  });
13111
13414
  };
13112
13415
  EncryptionService.prototype._decapsulateKey = function (profile, key) {
13113
- return __awaiter$e(this, void 0, void 0, function () {
13416
+ return __awaiter$d(this, void 0, void 0, function () {
13114
13417
  var decapsulatedKey;
13115
- return __generator$g(this, function (_a) {
13418
+ return __generator$f(this, function (_a) {
13116
13419
  switch (_a.label) {
13117
13420
  case 0: return [4 /*yield*/, profile.encapsulationService.decapsulate(key.encapsulation(), key.metadata())];
13118
13421
  case 1:
13119
13422
  decapsulatedKey = _a.sent();
13120
13423
  if (decapsulatedKey.length !== 32) {
13121
- throw (0, error_1$5.newError)("Expected decapulated key to be 32 bytes, found ".concat(decapsulatedKey.length));
13424
+ throw (0, error_1$4.newError)("Expected decapulated key to be 32 bytes, found ".concat(decapsulatedKey.length));
13122
13425
  }
13123
13426
  return [2 /*return*/, decapsulatedKey];
13124
13427
  }
@@ -13140,7 +13443,7 @@ var __assign$w = (commonjsGlobal && commonjsGlobal.__assign) || function () {
13140
13443
  };
13141
13444
  return __assign$w.apply(this, arguments);
13142
13445
  };
13143
- var __awaiter$d = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
13446
+ var __awaiter$c = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
13144
13447
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
13145
13448
  return new (P || (P = Promise))(function (resolve, reject) {
13146
13449
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -13149,7 +13452,7 @@ var __awaiter$d = (commonjsGlobal && commonjsGlobal.__awaiter) || function (this
13149
13452
  step((generator = generator.apply(thisArg, _arguments || [])).next());
13150
13453
  });
13151
13454
  };
13152
- var __generator$f = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
13455
+ var __generator$e = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
13153
13456
  var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13154
13457
  return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13155
13458
  function verb(n) { return function (v) { return step([n, v]); }; }
@@ -13190,7 +13493,7 @@ var util_1 = util$4;
13190
13493
  var bookmark_manager_1 = bookmarkManager$1;
13191
13494
  var result_transformers_1 = __importDefault$$(resultTransformers$1);
13192
13495
  var query_executor_1 = __importDefault$$(queryExecutor);
13193
- var error_1$4 = error;
13496
+ var error_1$3 = error;
13194
13497
  var homedb_cache_1 = __importDefault$$(homedbCache);
13195
13498
  var auth_util_1 = authUtil;
13196
13499
  var encryption_1 = __importDefault$$(encryption);
@@ -13688,18 +13991,18 @@ var Driver$1 = /** @class */ (function () {
13688
13991
  * @see {@link resultTransformers} for provided result transformers.
13689
13992
  */
13690
13993
  Driver.prototype.executeQuery = function (query_1, parameters_1) {
13691
- return __awaiter$d(this, arguments, void 0, function (query, parameters, config, parameterRules) {
13994
+ return __awaiter$c(this, arguments, void 0, function (query, parameters, config, parameterRules) {
13692
13995
  var bookmarkManager, resultTransformer, routingConfig;
13693
13996
  var _a, _b, _c;
13694
13997
  if (config === void 0) { config = {}; }
13695
- return __generator$f(this, function (_d) {
13998
+ return __generator$e(this, function (_d) {
13696
13999
  switch (_d.label) {
13697
14000
  case 0:
13698
14001
  bookmarkManager = config.bookmarkManager === null ? undefined : ((_a = config.bookmarkManager) !== null && _a !== void 0 ? _a : this.executeQueryBookmarkManager);
13699
14002
  resultTransformer = ((_b = config.resultTransformer) !== null && _b !== void 0 ? _b : result_transformers_1.default.eager());
13700
14003
  routingConfig = (_c = config.routing) !== null && _c !== void 0 ? _c : routing.WRITE;
13701
14004
  if (routingConfig !== routing.READ && routingConfig !== routing.WRITE) {
13702
- throw (0, error_1$4.newError)("Illegal query routing config: \"".concat(routingConfig, "\""));
14005
+ throw (0, error_1$3.newError)("Illegal query routing config: \"".concat(routingConfig, "\""));
13703
14006
  }
13704
14007
  return [4 /*yield*/, this._queryExecutor.execute({
13705
14008
  resultTransformer: resultTransformer,
@@ -13743,10 +14046,10 @@ var Driver$1 = /** @class */ (function () {
13743
14046
  * authentication issue and rejected with error if non-authentication error happens.
13744
14047
  */
13745
14048
  Driver.prototype.verifyAuthentication = function () {
13746
- return __awaiter$d(this, arguments, void 0, function (_a) {
14049
+ return __awaiter$c(this, arguments, void 0, function (_a) {
13747
14050
  var connectionProvider;
13748
14051
  var _b = _a === void 0 ? {} : _a, database = _b.database, auth = _b.auth;
13749
- return __generator$f(this, function (_c) {
14052
+ return __generator$e(this, function (_c) {
13750
14053
  switch (_c.label) {
13751
14054
  case 0:
13752
14055
  connectionProvider = this._getOrCreateConnectionProvider();
@@ -14100,9 +14403,9 @@ var auth$1 = {};
14100
14403
  * See the License for the specific language governing permissions and
14101
14404
  * limitations under the License.
14102
14405
  */
14103
- Object.defineProperty(auth$1, "__esModule", { value: true });
14104
- var error_1$3 = error;
14105
- var json_1$1 = json$3;
14406
+ Object.defineProperty(auth$1, "__esModule", { value: true });
14407
+ var error_1$2 = error;
14408
+ var json_1 = json$3;
14106
14409
  /**
14107
14410
  * @property {function(username: string, password: string, realm: ?string)} basic the function to create a
14108
14411
  * basic authentication token.
@@ -14158,12 +14461,12 @@ var auth = {
14158
14461
  }
14159
14462
  if (isNotEmpty(parameters)) {
14160
14463
  try {
14161
- (0, json_1$1.stringify)(parameters);
14464
+ (0, json_1.stringify)(parameters);
14162
14465
  }
14163
14466
  catch (e) {
14164
14467
  // eslint-disable-next-line
14165
14468
  // @ts-ignore
14166
- throw (0, error_1$3.newError)('Circular references in custom auth token parameters', undefined, e);
14469
+ throw (0, error_1$2.newError)('Circular references in custom auth token parameters', undefined, e);
14167
14470
  }
14168
14471
  output.parameters = parameters;
14169
14472
  }
@@ -14196,7 +14499,7 @@ var authTokenManager = {};
14196
14499
  * See the License for the specific language governing permissions and
14197
14500
  * limitations under the License.
14198
14501
  */
14199
- var __awaiter$c = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
14502
+ var __awaiter$b = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
14200
14503
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14201
14504
  return new (P || (P = Promise))(function (resolve, reject) {
14202
14505
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -14205,7 +14508,7 @@ var __awaiter$c = (commonjsGlobal && commonjsGlobal.__awaiter) || function (this
14205
14508
  step((generator = generator.apply(thisArg, _arguments || [])).next());
14206
14509
  });
14207
14510
  };
14208
- var __generator$e = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
14511
+ var __generator$d = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
14209
14512
  var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
14210
14513
  return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14211
14514
  function verb(n) { return function (v) { return step([n, v]); }; }
@@ -14346,9 +14649,9 @@ var AuthTokenManagers = /** @class */ (function () {
14346
14649
  if (typeof tokenProvider !== 'function') {
14347
14650
  throw new TypeError("tokenProvider should be function, but got: ".concat(typeof tokenProvider));
14348
14651
  }
14349
- return new ExpirationBasedAuthTokenManager(function () { return __awaiter$c(_this, void 0, void 0, function () {
14652
+ return new ExpirationBasedAuthTokenManager(function () { return __awaiter$b(_this, void 0, void 0, function () {
14350
14653
  var _a;
14351
- return __generator$e(this, function (_b) {
14654
+ return __generator$d(this, function (_b) {
14352
14655
  switch (_b.label) {
14353
14656
  case 0:
14354
14657
  _a = {};
@@ -14402,9 +14705,9 @@ var ExpirationBasedAuthTokenManager = /** @class */ (function () {
14402
14705
  this._refreshObservable = _refreshObservable;
14403
14706
  }
14404
14707
  ExpirationBasedAuthTokenManager.prototype.getToken = function () {
14405
- return __awaiter$c(this, void 0, void 0, function () {
14708
+ return __awaiter$b(this, void 0, void 0, function () {
14406
14709
  var _a;
14407
- return __generator$e(this, function (_b) {
14710
+ return __generator$d(this, function (_b) {
14408
14711
  switch (_b.label) {
14409
14712
  case 0:
14410
14713
  if (!(this._currentAuthData === undefined ||
@@ -14453,9 +14756,9 @@ var ExpirationBasedAuthTokenManager = /** @class */ (function () {
14453
14756
  }
14454
14757
  };
14455
14758
  ExpirationBasedAuthTokenManager.prototype._refreshAuthToken = function () {
14456
- return __awaiter$c(this, void 0, void 0, function () {
14759
+ return __awaiter$b(this, void 0, void 0, function () {
14457
14760
  var _this = this;
14458
- return __generator$e(this, function (_a) {
14761
+ return __generator$d(this, function (_a) {
14459
14762
  switch (_a.label) {
14460
14763
  case 0: return [4 /*yield*/, new Promise(function (resolve, reject) {
14461
14764
  _this._scheduleRefreshAuthToken({
@@ -16131,7 +16434,7 @@ var __importDefault$Z = (commonjsGlobal && commonjsGlobal.__importDefault) || fu
16131
16434
  };
16132
16435
  Object.defineProperty(boltProvider, "__esModule", { value: true });
16133
16436
  boltProvider.BoltProvider = void 0;
16134
- var error_1$2 = error;
16437
+ var error_1$1 = error;
16135
16438
  var unsupported_type_1 = __importDefault$Z(unsupportedType);
16136
16439
  var BoltProvider = /** @class */ (function () {
16137
16440
  function BoltProvider(boltVersions, defaultVersion, alloc) {
@@ -16155,7 +16458,7 @@ var BoltProvider = /** @class */ (function () {
16155
16458
  packer.packable(value, this._defaultBolt.transformer.toStructure)();
16156
16459
  return buf.buffer();
16157
16460
  }
16158
- throw (0, error_1$2.newError)('Could not encode provided AAD as it was encoded with an unsupported encoding scheme');
16461
+ throw (0, error_1$1.newError)('Could not encode provided AAD as it was encoded with an unsupported encoding scheme');
16159
16462
  };
16160
16463
  BoltProvider.prototype.decodeValue = function (buffer, protocolVersion) {
16161
16464
  var version = this._boltVersions.get(protocolVersion.getMajor().toString());
@@ -16175,19 +16478,19 @@ var BoltProvider = /** @class */ (function () {
16175
16478
  };
16176
16479
  BoltProvider.prototype.decodeObject = function (buffer) {
16177
16480
  if (buffer.length === 0) {
16178
- throw (0, error_1$2.newError)('Empty byte array provided as ciphertext to decryption.');
16481
+ throw (0, error_1$1.newError)('Empty byte array provided as ciphertext to decryption.');
16179
16482
  }
16180
16483
  if (buffer[0] === 1) {
16181
16484
  var transformer = this._defaultBolt.transformer;
16182
16485
  var packBuf = this._alloc(buffer.buffer.slice(1));
16183
16486
  var struct = this._defaultBolt.unpack(packBuf);
16184
16487
  if (packBuf.hasRemaining() !== false) {
16185
- throw (0, error_1$2.newError)('Found data remaining after decoding ciphertext and metadata, unclean decode.');
16488
+ throw (0, error_1$1.newError)('Found data remaining after decoding ciphertext and metadata, unclean decode.');
16186
16489
  }
16187
16490
  return transformer.fromStructure(struct);
16188
16491
  }
16189
16492
  else {
16190
- throw (0, error_1$2.newError)("Object is encoded with version ".concat(buffer[0], ", this driver only supports version 1."));
16493
+ throw (0, error_1$1.newError)("Object is encoded with version ".concat(buffer[0], ", this driver only supports version 1."));
16191
16494
  }
16192
16495
  };
16193
16496
  return BoltProvider;
@@ -16266,7 +16569,7 @@ var localKeyEncapsulation = {};
16266
16569
  * See the License for the specific language governing permissions and
16267
16570
  * limitations under the License.
16268
16571
  */
16269
- var __awaiter$b = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
16572
+ var __awaiter$a = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
16270
16573
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16271
16574
  return new (P || (P = Promise))(function (resolve, reject) {
16272
16575
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -16275,7 +16578,7 @@ var __awaiter$b = (commonjsGlobal && commonjsGlobal.__awaiter) || function (this
16275
16578
  step((generator = generator.apply(thisArg, _arguments || [])).next());
16276
16579
  });
16277
16580
  };
16278
- var __generator$d = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
16581
+ var __generator$c = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
16279
16582
  var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
16280
16583
  return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
16281
16584
  function verb(n) { return function (v) { return step([n, v]); }; }
@@ -16333,7 +16636,7 @@ var __importDefault$Y = (commonjsGlobal && commonjsGlobal.__importDefault) || fu
16333
16636
  Object.defineProperty(localKeyEncapsulation, "__esModule", { value: true });
16334
16637
  localKeyEncapsulation.LocalEncapsulationResult = localKeyEncapsulation.LocalKeyEncapsulationService = void 0;
16335
16638
  localKeyEncapsulation.localKeyEncapsulationService = localKeyEncapsulationService;
16336
- var error_1$1 = error;
16639
+ var error_1 = error;
16337
16640
  var crypto_1 = __importDefault$Y(crypto);
16338
16641
  function u8ToB64(u) {
16339
16642
  return btoa(String.fromCharCode.apply(String, __spreadArray$l([], __read$q(u), false)));
@@ -16349,7 +16652,7 @@ function b64Tou8(b) {
16349
16652
  var LocalKeyEncapsulationService = /** @class */ (function () {
16350
16653
  function LocalKeyEncapsulationService(kek) {
16351
16654
  if (kek.byteLength !== 32) {
16352
- throw (0, error_1$1.newError)("LocalKeyEncapsualationService master key must be of byteLength 32 (256 bits), got ".concat(kek.byteLength, " (").concat(kek.byteLength * 8, " bits)"));
16655
+ throw (0, error_1.newError)("LocalKeyEncapsualationService master key must be of byteLength 32 (256 bits), got ".concat(kek.byteLength, " (").concat(kek.byteLength * 8, " bits)"));
16353
16656
  }
16354
16657
  this._kek = kek;
16355
16658
  this._cryptoProvider = new crypto_1.default();
@@ -16362,9 +16665,9 @@ var LocalKeyEncapsulationService = /** @class */ (function () {
16362
16665
  * @experimental Part of the Client-Side Encrytion preview feature
16363
16666
  */
16364
16667
  LocalKeyEncapsulationService.prototype.encapsulate = function (options) {
16365
- return __awaiter$b(this, void 0, void 0, function () {
16668
+ return __awaiter$a(this, void 0, void 0, function () {
16366
16669
  var DEK, encapulatedDEK;
16367
- return __generator$d(this, function (_a) {
16670
+ return __generator$c(this, function (_a) {
16368
16671
  switch (_a.label) {
16369
16672
  case 0:
16370
16673
  DEK = this._cryptoProvider.getRandomValues(32);
@@ -16385,9 +16688,9 @@ var LocalKeyEncapsulationService = /** @class */ (function () {
16385
16688
  * @experimental Part of the Client-Side Encrytion preview feature
16386
16689
  */
16387
16690
  LocalKeyEncapsulationService.prototype.decapsulate = function (encapsulation, metadata) {
16388
- return __awaiter$b(this, void 0, void 0, function () {
16691
+ return __awaiter$a(this, void 0, void 0, function () {
16389
16692
  var _a;
16390
- return __generator$d(this, function (_b) {
16693
+ return __generator$c(this, function (_b) {
16391
16694
  switch (_b.label) {
16392
16695
  case 0:
16393
16696
  _a = Uint8Array.bind;
@@ -16433,257 +16736,6 @@ function localKeyEncapsulationService(masterKey) {
16433
16736
  return new LocalKeyEncapsulationService(masterKey);
16434
16737
  }
16435
16738
 
16436
- var encryptionProfile = {};
16437
-
16438
- /**
16439
- * Copyright (c) "Neo4j"
16440
- * Neo4j Sweden AB [https://neo4j.com]
16441
- *
16442
- * Licensed under the Apache License, Version 2.0 (the "License");
16443
- * you may not use this file except in compliance with the License.
16444
- * You may obtain a copy of the License at
16445
- *
16446
- * http://www.apache.org/licenses/LICENSE-2.0
16447
- *
16448
- * Unless required by applicable law or agreed to in writing, software
16449
- * distributed under the License is distributed on an "AS IS" BASIS,
16450
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16451
- * See the License for the specific language governing permissions and
16452
- * limitations under the License.
16453
- */
16454
- var __awaiter$a = (commonjsGlobal && commonjsGlobal.__awaiter) || function (thisArg, _arguments, P, generator) {
16455
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16456
- return new (P || (P = Promise))(function (resolve, reject) {
16457
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16458
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
16459
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
16460
- step((generator = generator.apply(thisArg, _arguments || [])).next());
16461
- });
16462
- };
16463
- var __generator$c = (commonjsGlobal && commonjsGlobal.__generator) || function (thisArg, body) {
16464
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
16465
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
16466
- function verb(n) { return function (v) { return step([n, v]); }; }
16467
- function step(op) {
16468
- if (f) throw new TypeError("Generator is already executing.");
16469
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
16470
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
16471
- if (y = 0, t) op = [op[0] & 2, t.value];
16472
- switch (op[0]) {
16473
- case 0: case 1: t = op; break;
16474
- case 4: _.label++; return { value: op[1], done: false };
16475
- case 5: _.label++; y = op[1]; op = [0]; continue;
16476
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
16477
- default:
16478
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
16479
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
16480
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
16481
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
16482
- if (t[2]) _.ops.pop();
16483
- _.trys.pop(); continue;
16484
- }
16485
- op = body.call(thisArg, _);
16486
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
16487
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
16488
- }
16489
- };
16490
- Object.defineProperty(encryptionProfile, "__esModule", { value: true });
16491
- encryptionProfile.EnvelopeEncryptionProfile = void 0;
16492
- var error_1 = error;
16493
- var integer_1 = integer;
16494
- var json_1 = json$3;
16495
- /**
16496
- * An encryption profile that enables Envelope Encryption for Neo4j Property Encryption.
16497
- *
16498
- * @since 6.3.0
16499
- * @experimental Part of the Client-Side Encrytion preview feature
16500
- */
16501
- var EnvelopeEncryptionProfile = /** @class */ (function () {
16502
- /**
16503
- *
16504
- * @param {Object} config - Configurations
16505
- * @param {string} config.name - Name of the profile, must be the same on all drivers used to access the encrypted data.
16506
- * @param {KeyEncapsulationService} config.encapsulationService - Encapsulation service used to encapsulate and dencapsulate keys. The driver ships with {@link LocalKeyEncapsulationService}, other implementations can be found as separate packages.
16507
- * @param {EncapsulatedKeyRecordRepository} config.keyRepository - Implementation of the {@link EncapsulatedKeyRecordRepository} interface, must be implemented so that the driver can access your key repository.
16508
- * @param {number} config.keyCacheTTL - How How long in milliseconds to keep a retrieved encapsulated keys cached by Id - defaults to 15 minutes
16509
- * @param {number} config.keyCacheMaxSize - How many items to keep in the key cache before pruning the oldest, setting to 0 will disable the cache - defaults to 100
16510
- * @param {number} config.keyAliasIndexTTL - How How long in milliseconds to keep the mapping of alias to key cached - defaults to 15 seconds
16511
- * @param {number} config.keyAliasIndexMaxSize - How many items to keep in the alias cache before pruning the oldest, setting to 0 will disable the index - defaults to 100
16512
- */
16513
- function EnvelopeEncryptionProfile(config) {
16514
- var _a, _b, _c, _d;
16515
- this.name = config.name;
16516
- this.encapsulationService = config.encapsulationService;
16517
- this.keyRepository = config.keyRepository;
16518
- this._keyCacheEnabled = config.keyCacheMaxSize !== 0;
16519
- this._keyCacheTTL = (_a = config.keyCacheTTL) !== null && _a !== void 0 ? _a : 15 * 60 * 1000;
16520
- this._keyCacheMaxSize = (_b = config.keyCacheMaxSize) !== null && _b !== void 0 ? _b : 100;
16521
- this._keyCache = new Map();
16522
- if (this._keyCacheEnabled) {
16523
- this._keyAliasIndexEnabled = config.keyAliasIndexMaxSize !== 0;
16524
- }
16525
- else {
16526
- this._keyAliasIndexEnabled = false;
16527
- }
16528
- this._keyAliasIndexTTL = (_c = config.keyAliasIndexTTL) !== null && _c !== void 0 ? _c : 15 * 1000;
16529
- this._keyAliasIndexMaxSize = (_d = config.keyAliasIndexMaxSize) !== null && _d !== void 0 ? _d : 100;
16530
- this._aliasIndex = new Map();
16531
- this.type = 'ENVELOPE';
16532
- this.version = (0, integer_1.int)(1);
16533
- }
16534
- /**
16535
- * @private
16536
- */
16537
- EnvelopeEncryptionProfile.prototype.findKey = function (options) {
16538
- return __awaiter$a(this, void 0, void 0, function () {
16539
- var key;
16540
- return __generator$c(this, function (_a) {
16541
- switch (_a.label) {
16542
- case 0:
16543
- if (!(typeof options === 'string')) return [3 /*break*/, 2];
16544
- return [4 /*yield*/, this._findById(options)];
16545
- case 1:
16546
- key = _a.sent();
16547
- return [3 /*break*/, 7];
16548
- case 2:
16549
- if (!(options.id != null)) return [3 /*break*/, 4];
16550
- return [4 /*yield*/, this._findById(options.id)];
16551
- case 3:
16552
- key = _a.sent();
16553
- return [3 /*break*/, 7];
16554
- case 4:
16555
- if (!(options.alias != null)) return [3 /*break*/, 6];
16556
- return [4 /*yield*/, this._findByAlias(options.alias)];
16557
- case 5:
16558
- key = _a.sent();
16559
- return [3 /*break*/, 7];
16560
- case 6: throw (0, error_1.newError)("invalid key options: ".concat((0, json_1.stringify)(options)));
16561
- case 7: return [2 /*return*/, key];
16562
- }
16563
- });
16564
- });
16565
- };
16566
- /**
16567
- * @private
16568
- */
16569
- EnvelopeEncryptionProfile.prototype.saveKey = function (alias, encapsulation, metadata) {
16570
- return __awaiter$a(this, void 0, void 0, function () {
16571
- var e_1;
16572
- return __generator$c(this, function (_a) {
16573
- switch (_a.label) {
16574
- case 0:
16575
- _a.trys.push([0, 2, , 3]);
16576
- return [4 /*yield*/, this.keyRepository.create(alias, encapsulation, metadata)];
16577
- case 1: return [2 /*return*/, _a.sent()];
16578
- case 2:
16579
- e_1 = _a.sent();
16580
- throw (0, error_1.newError)('Call to EncapsulatedKeyRepository.create threw error, see cause', '50N42', e_1);
16581
- case 3: return [2 /*return*/];
16582
- }
16583
- });
16584
- });
16585
- };
16586
- /**
16587
- * @private
16588
- */
16589
- EnvelopeEncryptionProfile.prototype._findById = function (id) {
16590
- return __awaiter$a(this, void 0, void 0, function () {
16591
- var entry, key, e_2;
16592
- var _a, _b;
16593
- return __generator$c(this, function (_c) {
16594
- switch (_c.label) {
16595
- case 0:
16596
- if (this._keyCacheEnabled) {
16597
- entry = this._keyCache.get(id);
16598
- if (entry != null) {
16599
- if (new Date().getTime() - ((_a = entry === null || entry === void 0 ? void 0 : entry.retrieved.getTime()) !== null && _a !== void 0 ? _a : 0) < ((_b = this._keyCacheTTL) !== null && _b !== void 0 ? _b : 0)) {
16600
- return [2 /*return*/, entry === null || entry === void 0 ? void 0 : entry.entry];
16601
- }
16602
- else {
16603
- this._keyCache.delete(id);
16604
- }
16605
- }
16606
- }
16607
- _c.label = 1;
16608
- case 1:
16609
- _c.trys.push([1, 3, , 4]);
16610
- return [4 /*yield*/, this.keyRepository.findById(id)];
16611
- case 2:
16612
- key = _c.sent();
16613
- return [3 /*break*/, 4];
16614
- case 3:
16615
- e_2 = _c.sent();
16616
- throw (0, error_1.newError)('Call to EncapsulatedKeyRepository.findById threw error, see cause', '50N42', e_2);
16617
- case 4:
16618
- if (key == null) {
16619
- return [2 /*return*/, undefined];
16620
- }
16621
- this._keyCache.set(id, { entry: key, retrieved: new Date() });
16622
- this._pruneCache(this._keyCache, this._keyCacheMaxSize);
16623
- return [2 /*return*/, key];
16624
- }
16625
- });
16626
- });
16627
- };
16628
- /**
16629
- * @private
16630
- */
16631
- EnvelopeEncryptionProfile.prototype._findByAlias = function (alias) {
16632
- return __awaiter$a(this, void 0, void 0, function () {
16633
- var entry, key, e_3;
16634
- var _a, _b;
16635
- return __generator$c(this, function (_c) {
16636
- switch (_c.label) {
16637
- case 0:
16638
- if (!this._keyAliasIndexEnabled) return [3 /*break*/, 3];
16639
- entry = this._aliasIndex.get(alias);
16640
- if (!(entry != null)) return [3 /*break*/, 3];
16641
- if (!(new Date().getTime() - ((_a = entry === null || entry === void 0 ? void 0 : entry.retrieved.getTime()) !== null && _a !== void 0 ? _a : 0) < ((_b = this._keyAliasIndexTTL) !== null && _b !== void 0 ? _b : 0))) return [3 /*break*/, 2];
16642
- return [4 /*yield*/, this._findById(entry === null || entry === void 0 ? void 0 : entry.entry)];
16643
- case 1: return [2 /*return*/, _c.sent()];
16644
- case 2:
16645
- this._aliasIndex.delete(alias);
16646
- _c.label = 3;
16647
- case 3:
16648
- _c.trys.push([3, 5, , 6]);
16649
- return [4 /*yield*/, this.keyRepository.findByAlias(alias)];
16650
- case 4:
16651
- key = _c.sent();
16652
- return [3 /*break*/, 6];
16653
- case 5:
16654
- e_3 = _c.sent();
16655
- throw (0, error_1.newError)('Call to EncapsulatedKeyRepository.findByAlias threw error, see cause', '50N42', e_3);
16656
- case 6:
16657
- if (key == null) {
16658
- return [2 /*return*/, undefined];
16659
- }
16660
- this._aliasIndex.set(alias, { entry: key.id(), retrieved: new Date() });
16661
- this._keyCache.set(key.id(), { entry: key, retrieved: new Date() });
16662
- this._pruneCache(this._aliasIndex, this._keyAliasIndexMaxSize);
16663
- this._pruneCache(this._keyCache, this._keyCacheMaxSize);
16664
- return [2 /*return*/, key];
16665
- }
16666
- });
16667
- });
16668
- };
16669
- /**
16670
- * @private
16671
- */
16672
- EnvelopeEncryptionProfile.prototype._pruneCache = function (cache, maxSize) {
16673
- if (cache.size > maxSize) {
16674
- var entries = Array.from(cache.entries());
16675
- entries.sort(function (a, b) { return a[1].retrieved.getTime() - b[1].retrieved.getTime(); });
16676
- var i = 0;
16677
- while (cache.size > maxSize) {
16678
- cache.delete(entries[i][0]);
16679
- i++;
16680
- }
16681
- }
16682
- };
16683
- return EnvelopeEncryptionProfile;
16684
- }());
16685
- encryptionProfile.EnvelopeEncryptionProfile = EnvelopeEncryptionProfile;
16686
-
16687
16739
  (function (exports) {
16688
16740
  /**
16689
16741
  * Copyright (c) "Neo4j"
@@ -25963,7 +26015,7 @@ Object.defineProperty(version$1, "__esModule", { value: true });
25963
26015
  // This is set up this way to keep the version in the code in
25964
26016
  // sync with the npm package version, and to allow the build
25965
26017
  // system to control version names at packaging time.
25966
- version$1.default = '6.3.0';
26018
+ version$1.default = '6.3.1';
25967
26019
 
25968
26020
  var lib = {};
25969
26021