@samet-it/be-couchbase-common 1.1.4 → 1.1.5

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,13 +1,14 @@
1
1
  import { CbConnection } from "./cb.connection";
2
+ import { UrnDef } from "@samet-it/be-base-common";
2
3
  import type { DefDims, Entity, UrnDocLike, Pair, Portion, View } from "@samet-it/be-base-common";
3
4
  import { type CbRepoDirectOpt, type CbRepoLike } from "../repo";
4
5
  import type { CbDirectConnectionLike, CbDirectConnOpt } from "./index.types";
5
- import type { KeyValue } from "@leyyo/common";
6
+ import type { KeyValue, StrKey } from "@leyyo/common";
6
7
  /**
7
8
  * Couchbase connection direct class
8
9
  * */
9
10
  export declare class CbDirectConnection extends CbConnection implements CbDirectConnectionLike {
10
11
  constructor(opt?: CbDirectConnOpt);
11
12
  /** @inheritDoc */
12
- newRepo<ID extends KeyValue, ENTITY extends Entity<ID>, URN extends UrnDocLike, KEYS extends string = string, DIMS extends DefDims = DefDims, PAIR extends Pair<ID> = Pair<ID>, VIEW extends View<ID> = View<ID>, PORTION extends Portion<ID> = Portion<ID>, R = unknown>(opt: CbRepoDirectOpt<ID, ENTITY, URN, DIMS, R>): CbRepoLike<ID, ENTITY, URN, KEYS, DIMS, PAIR, VIEW, PORTION>;
13
+ newRepo<ENTITY extends Entity<ID>, ID extends KeyValue = KeyValue, URN extends UrnDocLike = UrnDef<ID>, KEYS extends string = StrKey<ENTITY>, DIMS extends DefDims = DefDims, PAIR extends Pair<ID> = Pair<ID>, VIEW extends View<ID> = ENTITY, PORTION extends Portion<ID> = Portion<ID>, R = unknown>(opt: CbRepoDirectOpt<ENTITY, ID, URN, DIMS, R>): CbRepoLike<ENTITY, ID, URN, KEYS, DIMS, PAIR, VIEW, PORTION>;
13
14
  }
@@ -1,8 +1,8 @@
1
1
  import type { Cluster, QueryMetaData, QueryOptions, QueryResult, Scope } from "couchbase";
2
- import type { IgnoreFieldsByType, KeyValue, ReplaceType } from "@leyyo/common";
2
+ import type { IgnoreFieldsByType, KeyValue, ReplaceType, StrKey } from "@leyyo/common";
3
3
  import type { CbRepoDirectOpt, CbRepoLike } from "../repo";
4
4
  import type { DbConnectionLike, DbConnOpt, DbConnProps, DbExecOpt, DbRepoLink } from "@samet-it/be-db-common";
5
- import type { DefDims, Entity, UrnDocLike, Pair, Portion, View } from "@samet-it/be-base-common";
5
+ import type { DefDims, Entity, UrnDocLike, Pair, Portion, View, UrnDef } from "@samet-it/be-base-common";
6
6
  /**
7
7
  * Couchbase connection interface
8
8
  * */
@@ -81,7 +81,7 @@ export interface CbDirectConnectionLike extends CbConnectionLike {
81
81
  * @param {CbRepoDirectOpt} opt - options
82
82
  * @return {CbRepoLike} - created repository
83
83
  * */
84
- newRepo<ID extends KeyValue, ENTITY extends Entity<ID>, URN extends UrnDocLike, KEYS extends string = string, DIMS extends DefDims = DefDims, PAIR extends Pair<ID> = Pair<ID>, VIEW extends View<ID> = View<ID>, PORTION extends Portion<ID> = Portion<ID>, R = unknown>(opt: CbRepoDirectOpt<ID, ENTITY, URN, DIMS, R>): CbRepoLike<ID, ENTITY, URN, KEYS, DIMS, PAIR, VIEW, PORTION>;
84
+ newRepo<ENTITY extends Entity<ID>, ID extends KeyValue = KeyValue, URN extends UrnDocLike = UrnDef, KEYS extends string = StrKey<ENTITY>, DIMS extends DefDims = DefDims, PAIR extends Pair<ID> = Pair<ID>, VIEW extends View<ID> = ENTITY, PORTION extends Portion<ID> = Portion<ID>, R = unknown>(opt: CbRepoDirectOpt<ENTITY, ID, URN, DIMS, R>): CbRepoLike<ENTITY, ID, URN, KEYS, DIMS, PAIR, VIEW, PORTION>;
85
85
  }
86
86
  export type CbIgnoreDate<T> = CbReplaceType<T, Date, string>;
87
87
  export type CbIgnoreDateKeys<T> = CbIgnoreFields<T, Date>;
@@ -1,11 +1,11 @@
1
1
  import { CbRepo } from "./cb.repo";
2
- import type { DefDims, Entity, Pair, Portion, UrnDocLike, View } from "@samet-it/be-base-common";
2
+ import type { DefDims, Entity, Pair, Portion, UrnDef, UrnDocLike, View } from "@samet-it/be-base-common";
3
3
  import type { CbConnectionLike } from "../connection";
4
4
  import type { CbRepoDirectOpt } from "./index.types";
5
- import type { KeyValue } from "@leyyo/common";
5
+ import type { KeyValue, StrKey } from "@leyyo/common";
6
6
  /**
7
7
  * Couchbase repository direct class
8
8
  * */
9
- export declare class CbDirectRepo<ID extends KeyValue, ENTITY extends Entity<ID>, URN extends UrnDocLike, KEYS extends string = string, DIMS extends DefDims = DefDims, PAIR extends Pair<ID> = Pair<ID>, VIEW extends View<ID> = View<ID>, PORTION extends Portion<ID> = Portion<ID>> extends CbRepo<ID, ENTITY, URN, KEYS, DIMS, PAIR, VIEW, PORTION> {
10
- constructor(conn: CbConnectionLike, opt: CbRepoDirectOpt<ID, ENTITY, URN, DIMS>);
9
+ export declare class CbDirectRepo<ENTITY extends Entity<ID>, ID extends KeyValue = KeyValue, URN extends UrnDocLike = UrnDef<ID>, KEYS extends string = StrKey<ENTITY>, DIMS extends DefDims = DefDims, PAIR extends Pair<ID> = Pair<ID>, VIEW extends View<ID> = ENTITY, PORTION extends Portion<ID> = Portion<ID>> extends CbRepo<ENTITY, ID, URN, KEYS, DIMS, PAIR, VIEW, PORTION> {
10
+ constructor(conn: CbConnectionLike, opt: CbRepoDirectOpt<ENTITY, ID, URN, DIMS>);
11
11
  }
@@ -3,16 +3,16 @@ import type { KeyValue } from "@leyyo/common";
3
3
  import type { StrKey } from "@leyyo/common";
4
4
  import type { CbExistsOpt, CbGetOpt, CbInsertOpt, CbReplaceOpt, CbRepoProps, CbRepoLike, CbRepoOpt } from "./index.types";
5
5
  import { DbRepo } from "@samet-it/be-db-common";
6
- import type { DefDims, Entity, Pair, Portion, UrnDocLike, View } from "@samet-it/be-base-common";
6
+ import type { DefDims, Entity, Pair, Portion, UrnDef, UrnDocLike, View } from "@samet-it/be-base-common";
7
7
  import type { QueryRegular } from "@leyyo/query";
8
8
  /**
9
9
  * Couchbase repository abstract class
10
10
  * */
11
- export declare abstract class CbRepo<ID extends KeyValue, ENTITY extends Entity<ID>, URN extends UrnDocLike, KEYS extends string = string, DIMS extends DefDims = DefDims, PAIR extends Pair<ID> = Pair<ID>, VIEW extends View<ID> = View<ID>, PORTION extends Portion<ID> = Portion<ID>> extends DbRepo<CbConnectionLike, CbExecOpt, ID, ENTITY, URN, KEYS, DIMS, PAIR, VIEW, PORTION> implements CbRepoLike<ID, ENTITY, URN, KEYS, DIMS, PAIR, VIEW, PORTION> {
11
+ export declare abstract class CbRepo<ENTITY extends Entity<ID>, ID extends KeyValue = KeyValue, URN extends UrnDocLike = UrnDef<ID>, KEYS extends string = StrKey<ENTITY>, DIMS extends DefDims = DefDims, PAIR extends Pair<ID> = Pair<ID>, VIEW extends View<ID> = ENTITY, PORTION extends Portion<ID> = Portion<ID>> extends DbRepo<CbConnectionLike, CbExecOpt, ID, ENTITY, URN, KEYS, DIMS, PAIR, VIEW, PORTION> implements CbRepoLike<ENTITY, ID, URN, KEYS, DIMS, PAIR, VIEW, PORTION> {
12
12
  private static _specs;
13
13
  /** @inheritDoc */
14
- protected _props: CbRepoProps<ID, ENTITY>;
15
- protected constructor(conn: CbConnectionLike, opt?: CbRepoOpt<ID, ENTITY>);
14
+ protected _props: CbRepoProps<ENTITY, ID>;
15
+ protected constructor(conn: CbConnectionLike, opt?: CbRepoOpt<ENTITY, ID>);
16
16
  /**
17
17
  * Check property name
18
18
  *
@@ -65,7 +65,7 @@ export declare abstract class CbRepo<ID extends KeyValue, ENTITY extends Entity<
65
65
  * */
66
66
  protected $createIndices(): Promise<void>;
67
67
  /** @inheritDoc */
68
- get props(): Readonly<CbRepoProps<ID, ENTITY>>;
68
+ get props(): Readonly<CbRepoProps<ENTITY, ID>>;
69
69
  /** @inheritDoc */
70
70
  $getByPrimary(key: string, p1?: CbGetOpt | string, ignoreCheck?: boolean): Promise<ENTITY | undefined>;
71
71
  /** @inheritDoc */
@@ -1,10 +1,10 @@
1
1
  import type { Bucket, BucketSettings, Cluster, Collection, CollectionSpec, RemoveOptions, Scope, ScopeSpec } from "couchbase";
2
2
  import type { CbConnectionLike, CbExecOpt } from "../connection";
3
3
  import type { DbRepoLike, DbRepoOpt, DbRepoToDim, DbRepoToUrnTuple } from "@samet-it/be-db-common";
4
- import type { DefDims, Entity, Pair, Portion, UrnDocLike, View } from "@samet-it/be-base-common";
4
+ import type { DefDims, Entity, Pair, Portion, UrnDef, UrnDocLike, View } from "@samet-it/be-base-common";
5
5
  import type { ExistsOptions, GetOptions, InsertOptions, ReplaceOptions } from "couchbase";
6
6
  import type { DbRepoProps } from "@samet-it/be-db-common";
7
- import type { KeyValue } from "@leyyo/common";
7
+ import type { KeyValue, StrKey } from "@leyyo/common";
8
8
  /**
9
9
  * General result for mutable queries to return key
10
10
  * */
@@ -18,9 +18,9 @@ export interface CbResultX {
18
18
  * Couchbase repository (collection) interface
19
19
  * @abstract
20
20
  * */
21
- export interface CbRepoLike<ID extends KeyValue, ENTITY extends Entity<ID>, URN extends UrnDocLike, KEYS extends string = string, DIMS extends DefDims = DefDims, PAIR extends Pair<ID> = Pair<ID>, VIEW extends View<ID> = View<ID>, PORTION extends Portion<ID> = Portion<ID>> extends DbRepoLike<CbConnectionLike, CbExecOpt, ID, ENTITY, URN, KEYS, DIMS, PAIR, VIEW, PORTION> {
21
+ export interface CbRepoLike<ENTITY extends Entity<ID>, ID extends KeyValue = KeyValue, URN extends UrnDocLike = UrnDef<ID>, KEYS extends string = StrKey<ENTITY>, DIMS extends DefDims = DefDims, PAIR extends Pair<ID> = Pair<ID>, VIEW extends View<ID> = ENTITY, PORTION extends Portion<ID> = Portion<ID>> extends DbRepoLike<CbConnectionLike, CbExecOpt, ID, ENTITY, URN, KEYS, DIMS, PAIR, VIEW, PORTION> {
22
22
  /** @inheritDoc */
23
- get props(): Readonly<CbRepoProps<ID, ENTITY>>;
23
+ get props(): Readonly<CbRepoProps<ENTITY, ID>>;
24
24
  /** @inheritDoc */
25
25
  insert(doc: ENTITY, opt?: CbInsertOpt | string, ignoreCheck?: boolean): Promise<string>;
26
26
  /** @inheritDoc */
@@ -45,7 +45,7 @@ export interface CbRepoLike<ID extends KeyValue, ENTITY extends Entity<ID>, URN
45
45
  /**
46
46
  * Couchbase repository (collection) option
47
47
  * */
48
- export interface CbRepoOpt<ID extends KeyValue, ENTITY extends Entity<ID>> extends DbRepoOpt<ID, ENTITY> {
48
+ export interface CbRepoOpt<ENTITY extends Entity<ID>, ID extends KeyValue = KeyValue> extends DbRepoOpt<ID, ENTITY> {
49
49
  /**
50
50
  * Bucket name
51
51
  *
@@ -74,7 +74,7 @@ export interface CbRepoOpt<ID extends KeyValue, ENTITY extends Entity<ID>> exten
74
74
  /**
75
75
  * Couchbase repository (collection) props
76
76
  * */
77
- export interface CbRepoProps<ID extends KeyValue, ENTITY extends Entity<ID>> extends CbRepoOpt<ID, ENTITY>, DbRepoProps<CbConnectionLike, ID, ENTITY> {
77
+ export interface CbRepoProps<ENTITY extends Entity<ID>, ID extends KeyValue = KeyValue> extends CbRepoOpt<ENTITY, ID>, DbRepoProps<CbConnectionLike, ID, ENTITY> {
78
78
  /**
79
79
  * Cluster
80
80
  *
@@ -118,7 +118,7 @@ export interface CbRepoPropsPart<S> {
118
118
  /**
119
119
  * Couchbase direct repository (collection) option
120
120
  * */
121
- export interface CbRepoDirectOpt<ID extends KeyValue, ENTITY extends Entity<ID>, URN extends UrnDocLike, DIMS extends DefDims = DefDims, R = unknown> extends CbRepoOpt<ID, ENTITY> {
121
+ export interface CbRepoDirectOpt<ENTITY extends Entity<ID>, ID extends KeyValue = KeyValue, URN extends UrnDocLike = UrnDef<ID>, DIMS extends DefDims = DefDims, R = unknown> extends CbRepoOpt<ENTITY, ID> {
122
122
  /**
123
123
  * Name of logger class
124
124
  * */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@samet-it/be-couchbase-common",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "Couchbase common component",
5
5
  "keywords": [
6
6
  "Couchbase"