@samet-it/be-couchbase-common 1.1.10 → 1.3.2

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.
@@ -1,4 +1,4 @@
1
- import type { CouchbaseCommonConf } from "./index.types";
1
+ import { CouchbaseCommonConf } from "./index.types";
2
2
  /**
3
3
  * Couchbase common config
4
4
  * @config
@@ -1,4 +1,4 @@
1
- import type { EnvBase } from "@leyyo/env";
1
+ import { EnvBase } from "@leyyo/env";
2
2
  export interface CouchbaseCommonConf extends EnvBase {
3
3
  /**
4
4
  * Protocol
@@ -1,4 +1,4 @@
1
- import type { CbDirectConnectionLike, CbDirectConnOpt } from "./index.types";
1
+ import { CbDirectConnectionLike, CbDirectConnOpt } from "./index.types";
2
2
  /**
3
3
  * Crete new couchbase connection
4
4
  *
@@ -1,9 +1,8 @@
1
1
  import { CbConnection } from "./cb.connection";
2
- import { UrnDef } from "@samet-it/be-base-common";
3
- import type { DefDims, Entity, UrnDocLike, Pair, Portion, View } from "@samet-it/be-base-common";
4
- import { type CbRepoDirectOpt, type CbRepoLike } from "../repo";
5
- import type { CbDirectConnectionLike, CbDirectConnOpt } from "./index.types";
6
- import type { KeyValue, StrKey } from "@leyyo/common";
2
+ import { DefDims, Entity, Pair, Portion, UrnDef, UrnDocLike, View } from "@samet-it/be-base-common";
3
+ import { CbRepoDirectOpt, CbRepoLike } from "../repo";
4
+ import { CbDirectConnectionLike, CbDirectConnOpt } from "./index.types";
5
+ import { KeyValue, StrKey } from "@leyyo/common";
7
6
  /**
8
7
  * Couchbase connection direct class
9
8
  * */
@@ -16,7 +16,7 @@ class CbDirectConnection extends cb_connection_1.CbConnection {
16
16
  * */
17
17
  constructor(opt) {
18
18
  super(opt);
19
- this.logger = be_base_common_1.logger.create(`CbConnection${(opt === null || opt === void 0 ? void 0 : opt.name) ? '#' + (opt === null || opt === void 0 ? void 0 : opt.name) : ''}`);
19
+ this.logger = be_base_common_1.logger.of(`CbConnection${(opt === null || opt === void 0 ? void 0 : opt.name) ? '#' + (opt === null || opt === void 0 ? void 0 : opt.name) : ''}`);
20
20
  }
21
21
  /** @inheritDoc */
22
22
  newRepo(opt) {
@@ -1,6 +1,6 @@
1
- import type { Cluster } from 'couchbase';
1
+ import { Cluster } from 'couchbase';
2
2
  import { DbConnection } from "@samet-it/be-db-common";
3
- import type { CbConnectionLike, CbConnOpt, CbConnProps } from "./index.types";
3
+ import { CbConnectionLike, CbConnOpt, CbConnProps } from "./index.types";
4
4
  /**
5
5
  * Couchbase connection abstract class
6
6
  * */
@@ -46,7 +46,7 @@ exports.CbConnection = void 0;
46
46
  const couchbase = __importStar(require("couchbase"));
47
47
  const config_1 = require("../config");
48
48
  const be_db_common_1 = require("@samet-it/be-db-common");
49
- const be_base_common_1 = require("@samet-it/be-base-common");
49
+ const common_1 = require("@leyyo/common");
50
50
  /**
51
51
  * Couchbase connection abstract class
52
52
  * */
@@ -120,7 +120,7 @@ class CbConnection extends be_db_common_1.DbConnection {
120
120
  }
121
121
  if (this._props.connectTryCount > CbConnection.CONN_TRY_COUNT) {
122
122
  const err = new be_db_common_1.DbError('Maximum try county', { tryCount: this._props.connectTryCount });
123
- this.logger.error(be_base_common_1.errorHandler.common.logText(err, 'connect'));
123
+ this.logger.error(common_1.errorCommon.text(err, 'connect'));
124
124
  return false;
125
125
  }
126
126
  try {
@@ -145,7 +145,7 @@ class CbConnection extends be_db_common_1.DbConnection {
145
145
  setTimeout(() => this.ping(true).then(), 30000);
146
146
  }
147
147
  catch (e) {
148
- this.logger.warn(be_base_common_1.errorHandler.common.logText(e, 'connection', this._props.connectTryCount));
148
+ this.logger.warn(common_1.errorCommon.text(e, 'connection', this._props.connectTryCount));
149
149
  props.connectTryCount++;
150
150
  const old = this.isConnected;
151
151
  props.isConnected = false;
@@ -165,7 +165,7 @@ class CbConnection extends be_db_common_1.DbConnection {
165
165
  }
166
166
  if (this._props.pingTryCount > CbConnection.PING_TRY_COUNT) {
167
167
  const err = new be_db_common_1.DbError('Maximum try county', { tryCount: this._props.pingTryCount });
168
- this.logger.error(be_base_common_1.errorHandler.common.logText(err, 'connect'));
168
+ this.logger.error(common_1.errorCommon.text(err, 'connect'));
169
169
  return false;
170
170
  }
171
171
  let result = false;
@@ -177,7 +177,7 @@ class CbConnection extends be_db_common_1.DbConnection {
177
177
  }
178
178
  catch (err) {
179
179
  this._props.pingTryCount++;
180
- this.logger.warn(be_base_common_1.errorHandler.common.logText(err, 'ping', this._props.pingTryCount));
180
+ this.logger.warn(common_1.errorCommon.text(err, 'ping', this._props.pingTryCount));
181
181
  setTimeout(() => this.ping(true).then(), this._pingDelay);
182
182
  next = false;
183
183
  }
@@ -1,8 +1,8 @@
1
- import type { Cluster } from "couchbase";
2
- import type { IgnoreFieldsByType, KeyValue, ReplaceType, StrKey } from "@leyyo/common";
3
- import type { CbRepoDirectOpt, CbRepoLike } from "../repo";
4
- import type { DbConnDirectOpt, DbConnectionLike, DbConnOpt, DbConnProps } from "@samet-it/be-db-common";
5
- import type { DefDims, Entity, UrnDocLike, Pair, Portion, View, UrnDef } from "@samet-it/be-base-common";
1
+ import { Cluster } from "couchbase";
2
+ import { IgnoreFieldsByType, KeyValue, ReplaceType, StrKey } from "@leyyo/common";
3
+ import { CbRepoDirectOpt, CbRepoLike } from "../repo";
4
+ import { DbConnDirectOpt, DbConnectionLike, DbConnOpt, DbConnProps } from "@samet-it/be-db-common";
5
+ import { DefDims, Entity, Pair, Portion, UrnDef, UrnDocLike, View } from "@samet-it/be-base-common";
6
6
  /**
7
7
  * Couchbase connection interface
8
8
  * */
@@ -1,2 +1,2 @@
1
- import type { CbFilterUtil } from "./index.types";
1
+ import { CbFilterUtil } from "./index.types";
2
2
  export declare const cbFilterUtil: CbFilterUtil;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.cbFilterUtil = void 0;
4
- const type_1 = require("@leyyo/type");
4
+ const common_1 = require("@leyyo/common");
5
5
  class CbFilterUtilImpl {
6
6
  _where(opt) {
7
7
  const result = opt.whereUsed ? 'AND' : 'WHERE';
@@ -10,7 +10,7 @@ class CbFilterUtilImpl {
10
10
  }
11
11
  /** @inheritDoc */
12
12
  readOne(value, fn) {
13
- if (!(0, type_1.isText)(value)) {
13
+ if (!(0, common_1.isText)(value)) {
14
14
  return undefined;
15
15
  }
16
16
  if (typeof fn === 'function') {
@@ -20,7 +20,7 @@ class CbFilterUtilImpl {
20
20
  }
21
21
  /** @inheritDoc */
22
22
  readArray(value, fn) {
23
- if (!(0, type_1.isText)(value)) {
23
+ if (!(0, common_1.isText)(value)) {
24
24
  return undefined;
25
25
  }
26
26
  if (typeof fn !== 'function') {
@@ -33,7 +33,7 @@ class CbFilterUtilImpl {
33
33
  }
34
34
  /** @inheritDoc */
35
35
  readBetween(value, fn) {
36
- if (!(0, type_1.isText)(value)) {
36
+ if (!(0, common_1.isText)(value)) {
37
37
  return undefined;
38
38
  }
39
39
  if (typeof fn !== 'function') {
@@ -1,4 +1,4 @@
1
- import type { DbLines } from "@samet-it/be-db-common";
1
+ import { DbLines } from "@samet-it/be-db-common";
2
2
  import { CbRepoLike } from "../repo";
3
3
  import { Entity } from "@samet-it/be-base-common";
4
4
  export type FilterCastLambda<T> = (v: unknown) => T;
@@ -1,8 +1,8 @@
1
1
  import { CbRepo } from "./cb.repo";
2
- import type { DefDims, Entity, Pair, Portion, UrnDef, UrnDocLike, View } from "@samet-it/be-base-common";
3
- import type { CbConnectionLike } from "../connection";
4
- import type { CbRepoDirectOpt } from "./index.types";
5
- import type { KeyValue, StrKey } from "@leyyo/common";
2
+ import { DefDims, Entity, Pair, Portion, UrnDef, UrnDocLike, View } from "@samet-it/be-base-common";
3
+ import { CbConnectionLike } from "../connection";
4
+ import { CbRepoDirectOpt } from "./index.types";
5
+ import { KeyValue, StrKey } from "@leyyo/common";
6
6
  /**
7
7
  * Couchbase repository direct class
8
8
  *
@@ -27,7 +27,7 @@ class CbDirectRepo extends cb_repo_1.CbRepo {
27
27
  var _a;
28
28
  super(conn, opt);
29
29
  const logName = (_a = opt === null || opt === void 0 ? void 0 : opt.name) !== null && _a !== void 0 ? _a : this._props.urnPrefix;
30
- this.logger = be_base_common_1.logger.create(`CbRepo${logName ? '#' + logName : ''}`);
30
+ this.logger = be_base_common_1.logger.of(`CbRepo${logName ? '#' + logName : ''}`);
31
31
  }
32
32
  }
33
33
  exports.CbDirectRepo = CbDirectRepo;
@@ -1,11 +1,10 @@
1
- import type { CbConnectionLike } from "../connection";
2
- import { Bucket, BucketSettings, type Cluster, Collection, CollectionSpec, type QueryMetaData, type QueryResult, Scope, ScopeSpec } from "couchbase";
3
- import { type IgnoreFieldsByType, KeyValue, type ReplaceType } from "@leyyo/common";
4
- import type { StrKey } from "@leyyo/common";
5
- import type { CbExistsOpt, CbGetOpt, CbInsertOpt, CbReplaceOpt, CbRepoProps, CbRepoPropsPart, CbRepoLike, CbRepoOpt, CbUpsertOpt, CbExecOpt } from "./index.types";
6
- import { type DbLines, type DbQueryResultMore, type DbQueryResultOne, DbRepo } from "@samet-it/be-db-common";
7
- import type { DefDims, Entity, Pair, Portion, UrnDef, UrnDocLike, View } from "@samet-it/be-base-common";
8
- import type { QueryRegular } from "@leyyo/query";
1
+ import { CbConnectionLike } from "../connection";
2
+ import { Bucket, BucketSettings, Cluster, Collection, CollectionSpec, QueryMetaData, QueryResult, Scope, ScopeSpec } from "couchbase";
3
+ import { IgnoreFieldsByType, KeyValue, ReplaceType, StrKey } from "@leyyo/common";
4
+ import { CbExecOpt, CbExistsOpt, CbGetOpt, CbInsertOpt, CbReplaceOpt, CbRepoLike, CbRepoOpt, CbRepoProps, CbRepoPropsPart, CbUpsertOpt } from "./index.types";
5
+ import { type DbLines, DbQueryResultMore, DbQueryResultOne, DbRepo } from "@samet-it/be-db-common";
6
+ import { DefDims, Entity, Pair, Portion, UrnDef, UrnDocLike, View } from "@samet-it/be-base-common";
7
+ import { QueryRegular } from "@leyyo/query";
9
8
  /**
10
9
  * Couchbase repository abstract class
11
10
  *
@@ -14,7 +14,6 @@ const couchbase_1 = require("couchbase");
14
14
  const common_1 = require("@leyyo/common");
15
15
  const be_db_common_1 = require("@samet-it/be-db-common");
16
16
  const type_1 = require("@leyyo/type");
17
- const type_2 = require("@leyyo/type");
18
17
  const cb_schema_error_1 = require("./cb-schema.error");
19
18
  const filter_1 = require("../filter");
20
19
  let F_URN;
@@ -57,13 +56,25 @@ class CbRepo extends be_db_common_1.DbRepo {
57
56
  props.scopeName = (_b = props.scopeName) !== null && _b !== void 0 ? _b : conn.props.scopeName;
58
57
  props.createIndices = (_c = props.createIndices) !== null && _c !== void 0 ? _c : conn.props.createIndices;
59
58
  if (!props.bucketName) {
60
- throw new be_db_common_1.DbInvalidValueError('Bucket', { where: 'CbRepo', method: 'constructor', type: typeof props.bucketName });
59
+ throw new be_db_common_1.DbInvalidValueError('Bucket', {
60
+ where: 'CbRepo',
61
+ method: 'constructor',
62
+ type: typeof props.bucketName
63
+ });
61
64
  }
62
65
  if (!props.scopeName) {
63
- throw new be_db_common_1.DbInvalidValueError('Scope', { where: 'CbRepo', method: 'constructor', type: typeof props.scopeName });
66
+ throw new be_db_common_1.DbInvalidValueError('Scope', {
67
+ where: 'CbRepo',
68
+ method: 'constructor',
69
+ type: typeof props.scopeName
70
+ });
64
71
  }
65
72
  if (!props.collectionName) {
66
- throw new be_db_common_1.DbInvalidValueError('Collection', { where: 'CbRepo', method: 'constructor', type: typeof props.collectionName });
73
+ throw new be_db_common_1.DbInvalidValueError('Collection', {
74
+ where: 'CbRepo',
75
+ method: 'constructor',
76
+ type: typeof props.collectionName
77
+ });
67
78
  }
68
79
  if (!F_URN) {
69
80
  F_URN = this.f('_urn');
@@ -103,7 +114,7 @@ class CbRepo extends be_db_common_1.DbRepo {
103
114
  const fields = [];
104
115
  if (Array.isArray(p1)) {
105
116
  const given = p1;
106
- if (!(0, type_1.isText)(name)) {
117
+ if (!(0, common_1.isText)(name)) {
107
118
  name = given.map(item => item.split('.').pop()).join('.');
108
119
  }
109
120
  fields.push(...given.map(f => this.f(f)));
@@ -184,7 +195,7 @@ class CbRepo extends be_db_common_1.DbRepo {
184
195
  _loadBucket() {
185
196
  return __awaiter(this, void 0, void 0, function* () {
186
197
  const { _props: props } = this;
187
- (0, type_2.assertText)(props.bucketName, { field: 'bucket', where: 'CbRepo', method: '_loadBucket' });
198
+ (0, type_1.assertText)(props.bucketName, { field: 'bucket', where: 'CbRepo', method: '_loadBucket' });
188
199
  let spec = Array.from(CbRepo._specs.keys())
189
200
  .find(s => s.name === props.bucketName);
190
201
  if (!spec) {
@@ -207,7 +218,7 @@ class CbRepo extends be_db_common_1.DbRepo {
207
218
  _loadScope() {
208
219
  return __awaiter(this, void 0, void 0, function* () {
209
220
  const { _props: props } = this;
210
- (0, type_2.assertText)(props.scopeName, { field: 'scopeName', where: 'CbRepo', method: '_loadScope' });
221
+ (0, type_1.assertText)(props.scopeName, { field: 'scopeName', where: 'CbRepo', method: '_loadScope' });
211
222
  let spec = CbRepo._specs.get(props.bucket.$spec)
212
223
  .find(s => s.name === props.scopeName);
213
224
  if (!spec) {
@@ -230,7 +241,7 @@ class CbRepo extends be_db_common_1.DbRepo {
230
241
  _loadCollection() {
231
242
  return __awaiter(this, void 0, void 0, function* () {
232
243
  const { _props: props } = this;
233
- (0, type_2.assertText)(props.collectionName, { field: 'collectionName', where: 'CbRepo', method: '_loadCollection' });
244
+ (0, type_1.assertText)(props.collectionName, { field: 'collectionName', where: 'CbRepo', method: '_loadCollection' });
234
245
  const spec = props.scope.$spec.collections
235
246
  .find(s => s.name === props.collectionName);
236
247
  if (!spec) {
@@ -374,7 +385,7 @@ class CbRepo extends be_db_common_1.DbRepo {
374
385
  return { success: true, rows: [] };
375
386
  }
376
387
  const opt = this.buildOpt(p1);
377
- const sql = (0, type_1.isObjectValid)(lines) ? lines.end() : lines;
388
+ const sql = (0, common_1.isObj)(lines) ? lines.end() : lines;
378
389
  if (opt.printSql) {
379
390
  this.logger.info(`${this.path} > SQL${opt.name}`, sql);
380
391
  }
@@ -403,7 +414,7 @@ class CbRepo extends be_db_common_1.DbRepo {
403
414
  return { success: true, row: undefined };
404
415
  }
405
416
  const opt = this.buildOpt(p1);
406
- const sql = (0, type_1.isObjectValid)(lines) ? lines.end() : lines;
417
+ const sql = (0, common_1.isObj)(lines) ? lines.end() : lines;
407
418
  if (opt.printSql) {
408
419
  this.logger.info(`${this.path} > SQL${opt.name}`, sql);
409
420
  }
@@ -435,7 +446,7 @@ class CbRepo extends be_db_common_1.DbRepo {
435
446
  }
436
447
  const opt = this.buildOpt(p1, '$getById');
437
448
  if (!ignoreCheck) {
438
- (0, type_2.assertText)(key, { field: 'id', where: 'CbRepo', method: '$getByPrimary' });
449
+ (0, type_1.assertText)(key, { field: 'id', where: 'CbRepo', method: '$getByPrimary' });
439
450
  }
440
451
  if (!this.hasSoftDelete) {
441
452
  if (!Array.isArray(opt.ignoredErrors)) {
@@ -467,7 +478,7 @@ class CbRepo extends be_db_common_1.DbRepo {
467
478
  (0, type_1.assertInteger)(key, { field: 'key', where: 'CbRepo', method: '$getBySecondary' });
468
479
  }
469
480
  else {
470
- (0, type_2.assertText)(key, { field: 'key', where: 'CbRepo', method: '$getBySecondary' });
481
+ (0, type_1.assertText)(key, { field: 'key', where: 'CbRepo', method: '$getBySecondary' });
471
482
  }
472
483
  }
473
484
  const opt = this.buildOpt(p1, '$getBySecondary');
@@ -492,7 +503,7 @@ class CbRepo extends be_db_common_1.DbRepo {
492
503
  return false;
493
504
  }
494
505
  if (!ignoreCheck) {
495
- (0, type_2.assertText)(key, { field: 'key', where: 'CbRepo', method: '$existsByPrimary' });
506
+ (0, type_1.assertText)(key, { field: 'key', where: 'CbRepo', method: '$existsByPrimary' });
496
507
  }
497
508
  const opt = this.buildOpt(p1, '$existsByPrimary');
498
509
  if (!this.hasSoftDelete) {
@@ -521,7 +532,7 @@ class CbRepo extends be_db_common_1.DbRepo {
521
532
  (0, type_1.assertInteger)(key, { field: 'key', where: 'CbRepo', method: '$existsBySecondary' });
522
533
  }
523
534
  else {
524
- (0, type_2.assertText)(key, { field: 'key', where: 'CbRepo', method: '$existsBySecondary' });
535
+ (0, type_1.assertText)(key, { field: 'key', where: 'CbRepo', method: '$existsBySecondary' });
525
536
  }
526
537
  }
527
538
  const opt = this.buildOpt(p1, '$existsBySecondary');
@@ -545,9 +556,9 @@ class CbRepo extends be_db_common_1.DbRepo {
545
556
  return [];
546
557
  }
547
558
  if (!ignoreCheck) {
548
- (0, type_2.assertArray)(keys, { field: 'keys', where: 'CbRepo', method: '$listByPrimary' });
559
+ (0, type_1.assertArray)(keys, { field: 'keys', where: 'CbRepo', method: '$listByPrimary' });
549
560
  keys.forEach((key, index) => {
550
- (0, type_2.assertText)(key, { field: 'key', where: 'CbRepo', method: '$listByPrimary', index });
561
+ (0, type_1.assertText)(key, { field: 'key', where: 'CbRepo', method: '$listByPrimary', index });
551
562
  });
552
563
  }
553
564
  const opt = this.buildOpt(p1, '$listByIds');
@@ -568,13 +579,13 @@ class CbRepo extends be_db_common_1.DbRepo {
568
579
  return [];
569
580
  }
570
581
  if (!ignoreCheck) {
571
- (0, type_2.assertArray)(keys, { field: 'keys', where: 'CbRepo', method: '$listBySecondary' });
582
+ (0, type_1.assertArray)(keys, { field: 'keys', where: 'CbRepo', method: '$listBySecondary' });
572
583
  keys.forEach((key, index) => {
573
584
  if (this.hasNumericId) {
574
585
  (0, type_1.assertInteger)(key, { field: 'key', where: 'CbRepo', method: '$listBySecondary', index });
575
586
  }
576
587
  else {
577
- (0, type_2.assertText)(key, { field: 'key', where: 'CbRepo', method: '$listBySecondary', index });
588
+ (0, type_1.assertText)(key, { field: 'key', where: 'CbRepo', method: '$listBySecondary', index });
578
589
  }
579
590
  });
580
591
  }
@@ -621,13 +632,13 @@ class CbRepo extends be_db_common_1.DbRepo {
621
632
  throw new be_db_common_1.DbNotSupportedError('Insert', param);
622
633
  }
623
634
  if (!ignoreCheck) {
624
- (0, type_2.assertObject)(doc, Object.assign({ field: 'doc' }, param));
625
- (0, type_2.assertText)(doc.urn, Object.assign({ field: 'doc.urn' }, param));
635
+ (0, type_1.assertObject)(doc, Object.assign({ field: 'doc' }, param));
636
+ (0, type_1.assertText)(doc.urn, Object.assign({ field: 'doc.urn' }, param));
626
637
  if (this.hasNumericId) {
627
638
  (0, type_1.assertInteger)(doc.id, Object.assign({ field: 'doc.id' }, param));
628
639
  }
629
640
  else {
630
- (0, type_2.assertText)(doc.id, Object.assign({ field: 'doc.id' }, param));
641
+ (0, type_1.assertText)(doc.id, Object.assign({ field: 'doc.id' }, param));
631
642
  }
632
643
  }
633
644
  yield this.exec(this.collection.insert(doc.urn, doc), opt);
@@ -648,13 +659,13 @@ class CbRepo extends be_db_common_1.DbRepo {
648
659
  throw new be_db_common_1.DbNotSupportedError('Update', param);
649
660
  }
650
661
  if (!ignoreCheck) {
651
- (0, type_2.assertObject)(doc, Object.assign({ field: 'doc' }, param));
652
- (0, type_2.assertText)(doc.urn, Object.assign({ field: 'doc._urn' }, param));
662
+ (0, type_1.assertObject)(doc, Object.assign({ field: 'doc' }, param));
663
+ (0, type_1.assertText)(doc.urn, Object.assign({ field: 'doc._urn' }, param));
653
664
  if (this.hasNumericId) {
654
665
  (0, type_1.assertInteger)(doc.id, Object.assign({ field: 'doc.id' }, param));
655
666
  }
656
667
  else {
657
- (0, type_2.assertText)(doc.id, Object.assign({ field: 'doc.id' }, param));
668
+ (0, type_1.assertText)(doc.id, Object.assign({ field: 'doc.id' }, param));
658
669
  }
659
670
  }
660
671
  yield this.exec(this.collection.replace(doc.urn, doc), opt);
@@ -675,13 +686,13 @@ class CbRepo extends be_db_common_1.DbRepo {
675
686
  throw new be_db_common_1.DbNotSupportedError('Upsert', param);
676
687
  }
677
688
  if (!ignoreCheck) {
678
- (0, type_2.assertObject)(doc, Object.assign({ field: 'doc' }, param));
679
- (0, type_2.assertText)(doc.urn, Object.assign({ field: 'doc._urn' }, param));
689
+ (0, type_1.assertObject)(doc, Object.assign({ field: 'doc' }, param));
690
+ (0, type_1.assertText)(doc.urn, Object.assign({ field: 'doc._urn' }, param));
680
691
  if (this.hasNumericId) {
681
692
  (0, type_1.assertInteger)(doc.id, Object.assign({ field: 'doc.id' }, param));
682
693
  }
683
694
  else {
684
- (0, type_2.assertText)(doc.id, Object.assign({ field: 'doc.id' }, param));
695
+ (0, type_1.assertText)(doc.id, Object.assign({ field: 'doc.id' }, param));
685
696
  }
686
697
  }
687
698
  yield this.exec(this.collection.upsert(doc.urn, doc), opt);
@@ -702,8 +713,8 @@ class CbRepo extends be_db_common_1.DbRepo {
702
713
  throw new be_db_common_1.DbNotSupportedError('Update', param);
703
714
  }
704
715
  if (!ignoreCheck) {
705
- (0, type_2.assertText)(key, Object.assign({ field: 'key' }, param));
706
- (0, type_2.assertObject)(doc, Object.assign({ field: 'doc' }, param));
716
+ (0, type_1.assertText)(key, Object.assign({ field: 'key' }, param));
717
+ (0, type_1.assertObject)(doc, Object.assign({ field: 'doc' }, param));
707
718
  }
708
719
  const parameters = {};
709
720
  let paramId = 0;
@@ -755,9 +766,9 @@ class CbRepo extends be_db_common_1.DbRepo {
755
766
  (0, type_1.assertInteger)(key, Object.assign({ field: 'key' }, param));
756
767
  }
757
768
  else {
758
- (0, type_2.assertText)(key, Object.assign({ field: 'key' }, param));
769
+ (0, type_1.assertText)(key, Object.assign({ field: 'key' }, param));
759
770
  }
760
- (0, type_2.assertObject)(doc, Object.assign({ field: 'doc' }, param));
771
+ (0, type_1.assertObject)(doc, Object.assign({ field: 'doc' }, param));
761
772
  }
762
773
  const parameters = {};
763
774
  let paramId = 0;
@@ -806,7 +817,7 @@ class CbRepo extends be_db_common_1.DbRepo {
806
817
  throw new be_db_common_1.DbNotSupportedError('Remove', param);
807
818
  }
808
819
  if (!ignoreCheck) {
809
- (0, type_2.assertText)(key, Object.assign({ field: 'key' }, param));
820
+ (0, type_1.assertText)(key, Object.assign({ field: 'key' }, param));
810
821
  }
811
822
  if (!this.hasSoftDelete) {
812
823
  yield this.exec(this.collection.remove(key, opt), opt);
@@ -840,7 +851,7 @@ class CbRepo extends be_db_common_1.DbRepo {
840
851
  (0, type_1.assertInteger)(key, Object.assign({ field: 'key' }, param));
841
852
  }
842
853
  else {
843
- (0, type_2.assertText)(key, Object.assign({ field: 'key' }, param));
854
+ (0, type_1.assertText)(key, Object.assign({ field: 'key' }, param));
844
855
  }
845
856
  }
846
857
  const lines = (0, be_db_common_1.dbLines)();
@@ -871,7 +882,7 @@ class CbRepo extends be_db_common_1.DbRepo {
871
882
  throw new be_db_common_1.DbNotSupportedError('Soft delete', param);
872
883
  }
873
884
  if (!ignoreCheck) {
874
- (0, type_2.assertText)(key, Object.assign({ field: 'key' }, param));
885
+ (0, type_1.assertText)(key, Object.assign({ field: 'key' }, param));
875
886
  }
876
887
  const lines = (0, be_db_common_1.dbLines)();
877
888
  lines
@@ -910,7 +921,7 @@ class CbRepo extends be_db_common_1.DbRepo {
910
921
  (0, type_1.assertInteger)(key, Object.assign({ field: 'key' }, param));
911
922
  }
912
923
  else {
913
- (0, type_2.assertText)(key, Object.assign({ field: 'key' }, param));
924
+ (0, type_1.assertText)(key, Object.assign({ field: 'key' }, param));
914
925
  }
915
926
  }
916
927
  const lines = (0, be_db_common_1.dbLines)();
@@ -1,8 +1,8 @@
1
- import type { Bucket, BucketSettings, Cluster, Collection, CollectionSpec, ExistsOptions, GetOptions, InsertOptions, QueryOptions, QueryResult, QueryMetaData, RemoveOptions, ReplaceOptions, Scope, ScopeSpec, UpsertOptions } from "couchbase";
2
- import type { CbConnectionLike } from "../connection";
3
- import type { DbExecOpt, DbRepoDirectOpt, DbRepoLike, DbRepoOpt, DbRepoProps } from "@samet-it/be-db-common";
4
- import type { DefDims, Entity, Pair, Portion, UrnDef, UrnDocLike, View } from "@samet-it/be-base-common";
5
- import type { IgnoreFieldsByType, KeyValue, ReplaceType, StrKey } from "@leyyo/common";
1
+ import { Bucket, BucketSettings, Cluster, Collection, CollectionSpec, ExistsOptions, GetOptions, InsertOptions, QueryMetaData, QueryOptions, QueryResult, RemoveOptions, ReplaceOptions, Scope, ScopeSpec, UpsertOptions } from "couchbase";
2
+ import { CbConnectionLike } from "../connection";
3
+ import { DbExecOpt, DbRepoDirectOpt, DbRepoLike, DbRepoOpt, DbRepoProps } from "@samet-it/be-db-common";
4
+ import { DefDims, Entity, Pair, Portion, UrnDef, UrnDocLike, View } from "@samet-it/be-base-common";
5
+ import { IgnoreFieldsByType, KeyValue, ReplaceType, StrKey } from "@leyyo/common";
6
6
  /**
7
7
  * Couchbase repository (collection) interface
8
8
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@samet-it/be-couchbase-common",
3
- "version": "1.1.10",
3
+ "version": "1.3.2",
4
4
  "description": "Couchbase common component",
5
5
  "keywords": [
6
6
  "Couchbase"
@@ -67,13 +67,13 @@
67
67
  }
68
68
  },
69
69
  "dependencies": {
70
- "@leyyo/common": "^1.2.4",
71
- "@leyyo/env": "^1.2.5",
72
- "@leyyo/query": "^1.2.1",
73
- "@leyyo/type": "^1.1.1",
74
- "@samet-it/be-base-common": "^1.1.5",
75
- "@samet-it/be-cache-common": "^1.1.10",
76
- "@samet-it/be-db-common": "^1.1.9",
70
+ "@leyyo/common": "^1.3.7",
71
+ "@leyyo/env": "^1.3.4",
72
+ "@leyyo/query": "^1.3.1",
73
+ "@leyyo/type": "^1.3.3",
74
+ "@samet-it/be-base-common": "^1.3.1",
75
+ "@samet-it/be-cache-common": "^1.3.1",
76
+ "@samet-it/be-db-common": "^1.3.2",
77
77
  "couchbase": "^4.6.0"
78
78
  }
79
79
  }