@opra/sqb 0.31.4 → 0.31.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.
@@ -152,10 +152,11 @@ 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(context, options) {
156
+ return super.forContext(context, {
157
+ newInstance: options?.newInstance ||
158
+ (options?.db && this.db !== options.db)
159
+ });
159
160
  }
160
161
  async _onError(error) {
161
162
  if (this.onError)
@@ -149,10 +149,11 @@ 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(context, options) {
153
+ return super.forContext(context, {
154
+ newInstance: options?.newInstance ||
155
+ (options?.db && this.db !== options.db)
156
+ });
156
157
  }
157
158
  async _onError(error) {
158
159
  if (this.onError)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/sqb",
3
- "version": "0.31.4",
3
+ "version": "0.31.5",
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",
@@ -39,7 +40,7 @@
39
40
  "ts-gems": "^2.5.0"
40
41
  },
41
42
  "peerDependencies": {
42
- "@opra/core": "^0.31.4",
43
+ "@opra/core": "^0.31.5",
43
44
  "@sqb/connect": ">= 4.9.0"
44
45
  },
45
46
  "type": "module",
@@ -22,7 +22,10 @@ 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(context: RequestContext, options?: {
26
+ newInstance?: boolean;
27
+ db?: SqbClient | SqbConnection;
28
+ }): this;
26
29
  protected _onError(error: unknown): Promise<void>;
27
30
  protected getConnection(): SqbConnection | SqbClient | Promise<SqbConnection | SqbClient>;
28
31
  protected onError?(error: unknown): void | Promise<void>;