@opra/sqb 0.31.4 → 0.31.6

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.
@@ -152,10 +152,8 @@ class SqbEntityServiceBase extends core_1.ApiService {
152
152
  throw e;
153
153
  }
154
154
  }
155
- forContext(context, db) {
156
- const instance = super.forContext(context);
157
- instance.db = db || this.db;
158
- return instance;
155
+ forContext(arg0, attributes) {
156
+ return super.forContext(arg0, attributes);
159
157
  }
160
158
  async _onError(error) {
161
159
  if (this.onError)
@@ -168,5 +166,9 @@ class SqbEntityServiceBase extends core_1.ApiService {
168
166
  throw new Error(`Database not set!`);
169
167
  return this.db;
170
168
  }
169
+ _cacheMatch(service, context, attributes) {
170
+ return super._cacheMatch(service, context, attributes) &&
171
+ (!attributes?.db || service.db === attributes.db);
172
+ }
171
173
  }
172
174
  exports.SqbEntityServiceBase = SqbEntityServiceBase;
@@ -149,10 +149,8 @@ export class SqbEntityServiceBase extends ApiService {
149
149
  throw e;
150
150
  }
151
151
  }
152
- forContext(context, db) {
153
- const instance = super.forContext(context);
154
- instance.db = db || this.db;
155
- return instance;
152
+ forContext(arg0, attributes) {
153
+ return super.forContext(arg0, attributes);
156
154
  }
157
155
  async _onError(error) {
158
156
  if (this.onError)
@@ -165,4 +163,8 @@ export class SqbEntityServiceBase extends ApiService {
165
163
  throw new Error(`Database not set!`);
166
164
  return this.db;
167
165
  }
166
+ _cacheMatch(service, context, attributes) {
167
+ return super._cacheMatch(service, context, attributes) &&
168
+ (!attributes?.db || service.db === attributes.db);
169
+ }
168
170
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/sqb",
3
- "version": "0.31.4",
3
+ "version": "0.31.6",
4
4
  "description": "Opra SQB adapter package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -19,10 +19,11 @@
19
19
  "lint": "eslint . --max-warnings=0",
20
20
  "test": "jest",
21
21
  "cover": "jest --collect-coverage",
22
- "clean": "npm run clean:src && npm run clean:dist && npm run clean:cover",
23
- "clean:src": "ts-cleanup -s src --all && ts-cleanup -s test --all",
24
- "clean:dist": "rimraf ../../build/sqb",
25
- "clean:cover": "rimraf ../../coverage/sqb"
22
+ "clean": "npm run clean:src && npm run clean:test && npm run clean:dist && npm run clean:cover",
23
+ "clean:src": "ts-cleanup -s src --all",
24
+ "clean:test": "ts-cleanup -s test --all",
25
+ "clean:dist": "rimraf ../../build/client",
26
+ "clean:cover": "rimraf ../../coverage/client"
26
27
  },
27
28
  "dependencies": {
28
29
  "lodash.isnil": "^4.0.0",
@@ -30,16 +31,16 @@
30
31
  },
31
32
  "devDependencies": {
32
33
  "@faker-js/faker": "^8.3.1",
33
- "@sqb/builder": "^4.10.4",
34
- "@sqb/connect": "^4.10.4",
35
- "@sqb/postgres": "^4.10.4",
34
+ "@sqb/builder": "^4.10.5",
35
+ "@sqb/connect": "^4.10.5",
36
+ "@sqb/postgres": "^4.10.5",
36
37
  "@types/lodash.isnil": "^4.0.9",
37
38
  "@types/lodash.omitby": "^4.6.9",
38
39
  "postgresql-client": "^2.10.1",
39
40
  "ts-gems": "^2.5.0"
40
41
  },
41
42
  "peerDependencies": {
42
- "@opra/core": "^0.31.4",
43
+ "@opra/core": "^0.31.6",
43
44
  "@sqb/connect": ">= 4.9.0"
44
45
  },
45
46
  "type": "module",
@@ -22,9 +22,13 @@ export declare class SqbEntityServiceBase<T> extends ApiService {
22
22
  protected _exists(options?: Repository.ExistsOptions): Promise<boolean>;
23
23
  protected _update(keyValue: any, data: EntityInput<T>, options?: Repository.UpdateOptions): Promise<Maybe<PartialOutput<T>>>;
24
24
  protected _updateMany(data: PartialInput<T>, options?: Repository.UpdateManyOptions): Promise<number>;
25
- forContext(context: RequestContext, db?: SqbClient | SqbConnection): this;
25
+ forContext(source: ApiService): this;
26
+ forContext(context: RequestContext, attributes?: {
27
+ db?: SqbClient | SqbConnection;
28
+ }): this;
26
29
  protected _onError(error: unknown): Promise<void>;
27
30
  protected getConnection(): SqbConnection | SqbClient | Promise<SqbConnection | SqbClient>;
31
+ protected _cacheMatch(service: ApiService, context: RequestContext, attributes?: any): boolean;
28
32
  protected onError?(error: unknown): void | Promise<void>;
29
33
  protected transformData?(row: PartialOutput<T>): PartialOutput<T>;
30
34
  }