@opra/sqb 0.26.1 → 0.26.4
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.
- package/cjs/sqb-collection.js +18 -14
- package/cjs/sqb-entity-service.js +9 -10
- package/cjs/sqb-singleton.js +13 -9
- package/esm/sqb-collection.js +18 -14
- package/esm/sqb-entity-service.js +9 -10
- package/esm/sqb-singleton.js +13 -9
- package/package.json +2 -2
- package/types/sqb-adapter.d.ts +3 -2
- package/types/sqb-collection.d.ts +13 -10
- package/types/sqb-entity-service.d.ts +12 -12
- package/types/sqb-singleton.d.ts +10 -7
package/cjs/sqb-collection.js
CHANGED
|
@@ -10,37 +10,37 @@ class SqbCollection {
|
|
|
10
10
|
this.defaultLimit = options?.defaultLimit || 100;
|
|
11
11
|
}
|
|
12
12
|
async create(ctx) {
|
|
13
|
-
const prepared =
|
|
13
|
+
const prepared = await this._prepare(ctx);
|
|
14
14
|
const service = await this.getService(ctx);
|
|
15
|
-
return service.
|
|
15
|
+
return service.create(prepared.data, prepared.options);
|
|
16
16
|
}
|
|
17
17
|
async delete(ctx) {
|
|
18
|
-
const prepared =
|
|
18
|
+
const prepared = await this._prepare(ctx);
|
|
19
19
|
const service = await this.getService(ctx);
|
|
20
|
-
return service.
|
|
20
|
+
return service.delete(prepared.key, prepared.options);
|
|
21
21
|
}
|
|
22
22
|
async deleteMany(ctx) {
|
|
23
|
-
const prepared =
|
|
23
|
+
const prepared = await this._prepare(ctx);
|
|
24
24
|
const service = await this.getService(ctx);
|
|
25
|
-
return service.
|
|
25
|
+
return service.deleteMany(prepared.options);
|
|
26
26
|
}
|
|
27
27
|
async get(ctx) {
|
|
28
|
-
const prepared =
|
|
28
|
+
const prepared = await this._prepare(ctx);
|
|
29
29
|
const service = await this.getService(ctx);
|
|
30
|
-
return service.
|
|
30
|
+
return service.find(prepared.key, prepared.options);
|
|
31
31
|
}
|
|
32
32
|
async update(ctx) {
|
|
33
|
-
const prepared =
|
|
33
|
+
const prepared = await this._prepare(ctx);
|
|
34
34
|
const service = await this.getService(ctx);
|
|
35
|
-
return service.
|
|
35
|
+
return service.update(prepared.key, prepared.data, prepared.options);
|
|
36
36
|
}
|
|
37
37
|
async updateMany(ctx) {
|
|
38
|
-
const prepared =
|
|
38
|
+
const prepared = await this._prepare(ctx);
|
|
39
39
|
const service = await this.getService(ctx);
|
|
40
|
-
return service.
|
|
40
|
+
return service.updateMany(prepared.data, prepared.options);
|
|
41
41
|
}
|
|
42
42
|
async findMany(ctx) {
|
|
43
|
-
const prepared =
|
|
43
|
+
const prepared = await this._prepare(ctx);
|
|
44
44
|
const service = await this.getService(ctx);
|
|
45
45
|
if (prepared.options.count) {
|
|
46
46
|
const [items, count] = await Promise.all([
|
|
@@ -51,7 +51,11 @@ class SqbCollection {
|
|
|
51
51
|
return items;
|
|
52
52
|
}
|
|
53
53
|
else
|
|
54
|
-
return service.
|
|
54
|
+
return service.findMany(prepared.options);
|
|
55
|
+
}
|
|
56
|
+
async _prepare(ctx) {
|
|
57
|
+
const prepared = sqb_adapter_js_1.SQBAdapter.transformRequest(ctx.request);
|
|
58
|
+
return (this.onPrepare && await this.onPrepare(ctx, prepared)) || prepared;
|
|
55
59
|
}
|
|
56
60
|
}
|
|
57
61
|
exports.SqbCollection = SqbCollection;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SqbEntityService = void 0;
|
|
4
|
+
const core_1 = require("@opra/core");
|
|
4
5
|
const connect_1 = require("@sqb/connect");
|
|
5
|
-
class SqbEntityService {
|
|
6
|
+
class SqbEntityService extends core_1.ApiService {
|
|
6
7
|
constructor(typeClass, options) {
|
|
8
|
+
super();
|
|
7
9
|
this.typeClass = typeClass;
|
|
8
10
|
const metadata = connect_1.EntityMetadata.get(typeClass);
|
|
9
11
|
if (!metadata)
|
|
@@ -43,7 +45,7 @@ class SqbEntityService {
|
|
|
43
45
|
const conn = await this.getConnection();
|
|
44
46
|
const repo = conn.getRepository(this.typeClass);
|
|
45
47
|
try {
|
|
46
|
-
return await repo.delete(keyValue, options);
|
|
48
|
+
return await repo.delete(keyValue, options) ? 1 : 0;
|
|
47
49
|
}
|
|
48
50
|
catch (e) {
|
|
49
51
|
await this._onError(e);
|
|
@@ -151,14 +153,11 @@ class SqbEntityService {
|
|
|
151
153
|
}
|
|
152
154
|
}
|
|
153
155
|
with(context, db) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
instance.db = db;
|
|
160
|
-
}
|
|
161
|
-
Object.setPrototypeOf(instance, this);
|
|
156
|
+
return this.forContext(context, db);
|
|
157
|
+
}
|
|
158
|
+
forContext(context, db) {
|
|
159
|
+
const instance = super.forContext(context);
|
|
160
|
+
instance.db = db || this.db;
|
|
162
161
|
return instance;
|
|
163
162
|
}
|
|
164
163
|
async _onError(error) {
|
package/cjs/sqb-singleton.js
CHANGED
|
@@ -6,25 +6,29 @@ const common_1 = require("@opra/common");
|
|
|
6
6
|
const sqb_adapter_js_1 = require("./sqb-adapter.js");
|
|
7
7
|
class SqbSingleton {
|
|
8
8
|
async create(ctx) {
|
|
9
|
-
const prepared =
|
|
9
|
+
const prepared = await this._prepare(ctx);
|
|
10
10
|
const service = await this.getService(ctx);
|
|
11
|
-
return service.
|
|
11
|
+
return service.create(prepared.data, prepared.options);
|
|
12
12
|
}
|
|
13
13
|
async delete(ctx) {
|
|
14
|
-
const prepared =
|
|
14
|
+
const prepared = await this._prepare(ctx);
|
|
15
15
|
const service = await this.getService(ctx);
|
|
16
|
-
return
|
|
16
|
+
return await service.deleteMany(prepared.options);
|
|
17
17
|
}
|
|
18
18
|
async get(ctx) {
|
|
19
|
-
const prepared =
|
|
19
|
+
const prepared = await this._prepare(ctx);
|
|
20
20
|
const service = await this.getService(ctx);
|
|
21
|
-
return service.
|
|
21
|
+
return service.findOne(prepared.options);
|
|
22
22
|
}
|
|
23
23
|
async update(ctx) {
|
|
24
|
-
const prepared =
|
|
24
|
+
const prepared = await this._prepare(ctx);
|
|
25
25
|
const service = await this.getService(ctx);
|
|
26
|
-
await service.
|
|
27
|
-
return service.
|
|
26
|
+
await service.updateMany(prepared.data, prepared.options);
|
|
27
|
+
return service.findOne(prepared.options);
|
|
28
|
+
}
|
|
29
|
+
async _prepare(ctx) {
|
|
30
|
+
const prepared = sqb_adapter_js_1.SQBAdapter.transformRequest(ctx.request);
|
|
31
|
+
return (this.onPrepare && await this.onPrepare(ctx, prepared)) || prepared;
|
|
28
32
|
}
|
|
29
33
|
}
|
|
30
34
|
exports.SqbSingleton = SqbSingleton;
|
package/esm/sqb-collection.js
CHANGED
|
@@ -7,37 +7,37 @@ export class SqbCollection {
|
|
|
7
7
|
this.defaultLimit = options?.defaultLimit || 100;
|
|
8
8
|
}
|
|
9
9
|
async create(ctx) {
|
|
10
|
-
const prepared =
|
|
10
|
+
const prepared = await this._prepare(ctx);
|
|
11
11
|
const service = await this.getService(ctx);
|
|
12
|
-
return service.
|
|
12
|
+
return service.create(prepared.data, prepared.options);
|
|
13
13
|
}
|
|
14
14
|
async delete(ctx) {
|
|
15
|
-
const prepared =
|
|
15
|
+
const prepared = await this._prepare(ctx);
|
|
16
16
|
const service = await this.getService(ctx);
|
|
17
|
-
return service.
|
|
17
|
+
return service.delete(prepared.key, prepared.options);
|
|
18
18
|
}
|
|
19
19
|
async deleteMany(ctx) {
|
|
20
|
-
const prepared =
|
|
20
|
+
const prepared = await this._prepare(ctx);
|
|
21
21
|
const service = await this.getService(ctx);
|
|
22
|
-
return service.
|
|
22
|
+
return service.deleteMany(prepared.options);
|
|
23
23
|
}
|
|
24
24
|
async get(ctx) {
|
|
25
|
-
const prepared =
|
|
25
|
+
const prepared = await this._prepare(ctx);
|
|
26
26
|
const service = await this.getService(ctx);
|
|
27
|
-
return service.
|
|
27
|
+
return service.find(prepared.key, prepared.options);
|
|
28
28
|
}
|
|
29
29
|
async update(ctx) {
|
|
30
|
-
const prepared =
|
|
30
|
+
const prepared = await this._prepare(ctx);
|
|
31
31
|
const service = await this.getService(ctx);
|
|
32
|
-
return service.
|
|
32
|
+
return service.update(prepared.key, prepared.data, prepared.options);
|
|
33
33
|
}
|
|
34
34
|
async updateMany(ctx) {
|
|
35
|
-
const prepared =
|
|
35
|
+
const prepared = await this._prepare(ctx);
|
|
36
36
|
const service = await this.getService(ctx);
|
|
37
|
-
return service.
|
|
37
|
+
return service.updateMany(prepared.data, prepared.options);
|
|
38
38
|
}
|
|
39
39
|
async findMany(ctx) {
|
|
40
|
-
const prepared =
|
|
40
|
+
const prepared = await this._prepare(ctx);
|
|
41
41
|
const service = await this.getService(ctx);
|
|
42
42
|
if (prepared.options.count) {
|
|
43
43
|
const [items, count] = await Promise.all([
|
|
@@ -48,7 +48,11 @@ export class SqbCollection {
|
|
|
48
48
|
return items;
|
|
49
49
|
}
|
|
50
50
|
else
|
|
51
|
-
return service.
|
|
51
|
+
return service.findMany(prepared.options);
|
|
52
|
+
}
|
|
53
|
+
async _prepare(ctx) {
|
|
54
|
+
const prepared = SQBAdapter.transformRequest(ctx.request);
|
|
55
|
+
return (this.onPrepare && await this.onPrepare(ctx, prepared)) || prepared;
|
|
52
56
|
}
|
|
53
57
|
}
|
|
54
58
|
__decorate([
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { ApiService } from '@opra/core';
|
|
1
2
|
import { EntityMetadata } from '@sqb/connect';
|
|
2
|
-
export class SqbEntityService {
|
|
3
|
+
export class SqbEntityService extends ApiService {
|
|
3
4
|
constructor(typeClass, options) {
|
|
5
|
+
super();
|
|
4
6
|
this.typeClass = typeClass;
|
|
5
7
|
const metadata = EntityMetadata.get(typeClass);
|
|
6
8
|
if (!metadata)
|
|
@@ -40,7 +42,7 @@ export class SqbEntityService {
|
|
|
40
42
|
const conn = await this.getConnection();
|
|
41
43
|
const repo = conn.getRepository(this.typeClass);
|
|
42
44
|
try {
|
|
43
|
-
return await repo.delete(keyValue, options);
|
|
45
|
+
return await repo.delete(keyValue, options) ? 1 : 0;
|
|
44
46
|
}
|
|
45
47
|
catch (e) {
|
|
46
48
|
await this._onError(e);
|
|
@@ -148,14 +150,11 @@ export class SqbEntityService {
|
|
|
148
150
|
}
|
|
149
151
|
}
|
|
150
152
|
with(context, db) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
instance.db = db;
|
|
157
|
-
}
|
|
158
|
-
Object.setPrototypeOf(instance, this);
|
|
153
|
+
return this.forContext(context, db);
|
|
154
|
+
}
|
|
155
|
+
forContext(context, db) {
|
|
156
|
+
const instance = super.forContext(context);
|
|
157
|
+
instance.db = db || this.db;
|
|
159
158
|
return instance;
|
|
160
159
|
}
|
|
161
160
|
async _onError(error) {
|
package/esm/sqb-singleton.js
CHANGED
|
@@ -3,25 +3,29 @@ import { Singleton } from '@opra/common';
|
|
|
3
3
|
import { SQBAdapter } from './sqb-adapter.js';
|
|
4
4
|
export class SqbSingleton {
|
|
5
5
|
async create(ctx) {
|
|
6
|
-
const prepared =
|
|
6
|
+
const prepared = await this._prepare(ctx);
|
|
7
7
|
const service = await this.getService(ctx);
|
|
8
|
-
return service.
|
|
8
|
+
return service.create(prepared.data, prepared.options);
|
|
9
9
|
}
|
|
10
10
|
async delete(ctx) {
|
|
11
|
-
const prepared =
|
|
11
|
+
const prepared = await this._prepare(ctx);
|
|
12
12
|
const service = await this.getService(ctx);
|
|
13
|
-
return
|
|
13
|
+
return await service.deleteMany(prepared.options);
|
|
14
14
|
}
|
|
15
15
|
async get(ctx) {
|
|
16
|
-
const prepared =
|
|
16
|
+
const prepared = await this._prepare(ctx);
|
|
17
17
|
const service = await this.getService(ctx);
|
|
18
|
-
return service.
|
|
18
|
+
return service.findOne(prepared.options);
|
|
19
19
|
}
|
|
20
20
|
async update(ctx) {
|
|
21
|
-
const prepared =
|
|
21
|
+
const prepared = await this._prepare(ctx);
|
|
22
22
|
const service = await this.getService(ctx);
|
|
23
|
-
await service.
|
|
24
|
-
return service.
|
|
23
|
+
await service.updateMany(prepared.data, prepared.options);
|
|
24
|
+
return service.findOne(prepared.options);
|
|
25
|
+
}
|
|
26
|
+
async _prepare(ctx) {
|
|
27
|
+
const prepared = SQBAdapter.transformRequest(ctx.request);
|
|
28
|
+
return (this.onPrepare && await this.onPrepare(ctx, prepared)) || prepared;
|
|
25
29
|
}
|
|
26
30
|
}
|
|
27
31
|
__decorate([
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/sqb",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.4",
|
|
4
4
|
"description": "Opra SQB adapter package",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"ts-gems": "^2.5.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@opra/core": "^0.26.
|
|
40
|
+
"@opra/core": "^0.26.4",
|
|
41
41
|
"@sqb/connect": ">= 4.9.0"
|
|
42
42
|
},
|
|
43
43
|
"type": "module",
|
package/types/sqb-adapter.d.ts
CHANGED
|
@@ -4,11 +4,12 @@ import _transformKeyValues from './transform-key-values.js';
|
|
|
4
4
|
export declare namespace SQBAdapter {
|
|
5
5
|
const transformFilter: typeof _transformFilter;
|
|
6
6
|
const transformKeyValues: typeof _transformKeyValues;
|
|
7
|
-
|
|
7
|
+
interface TransformedRequest {
|
|
8
8
|
method: 'create' | 'delete' | 'deleteMany' | 'find' | 'findOne' | 'findMany' | 'update' | 'updateMany';
|
|
9
9
|
key?: any;
|
|
10
10
|
data?: any;
|
|
11
11
|
options: any;
|
|
12
12
|
args: any[];
|
|
13
|
-
}
|
|
13
|
+
}
|
|
14
|
+
function transformRequest(request: Request): TransformedRequest;
|
|
14
15
|
}
|
|
@@ -1,21 +1,24 @@
|
|
|
1
1
|
import { Maybe } from 'ts-gems';
|
|
2
|
-
import { PartialOutput } from '@opra/common';
|
|
2
|
+
import { ICollection, PartialOutput } from '@opra/common';
|
|
3
3
|
import { RequestContext } from '@opra/core';
|
|
4
|
+
import { SQBAdapter } from './sqb-adapter.js';
|
|
4
5
|
import { SqbEntityService } from './sqb-entity-service.js';
|
|
5
6
|
export declare namespace SqbCollection {
|
|
6
7
|
interface Options {
|
|
7
8
|
defaultLimit?: number;
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
|
-
export declare abstract class SqbCollection<T
|
|
11
|
+
export declare abstract class SqbCollection<T> implements ICollection<T> {
|
|
11
12
|
defaultLimit?: number;
|
|
12
13
|
constructor(options?: SqbCollection.Options);
|
|
13
|
-
create(ctx: RequestContext): Promise<
|
|
14
|
-
delete(ctx: RequestContext): Promise<
|
|
15
|
-
deleteMany(ctx: RequestContext): Promise<number>;
|
|
16
|
-
get(ctx: RequestContext): Promise<Maybe<
|
|
17
|
-
update(ctx: RequestContext): Promise<Maybe<
|
|
18
|
-
updateMany(ctx: RequestContext): Promise<number>;
|
|
19
|
-
findMany(ctx: RequestContext): Promise<
|
|
20
|
-
|
|
14
|
+
create?(ctx: RequestContext): Promise<PartialOutput<T>>;
|
|
15
|
+
delete?(ctx: RequestContext): Promise<number>;
|
|
16
|
+
deleteMany?(ctx: RequestContext): Promise<number>;
|
|
17
|
+
get?(ctx: RequestContext): Promise<Maybe<PartialOutput<T>>>;
|
|
18
|
+
update?(ctx: RequestContext): Promise<Maybe<PartialOutput<T>>>;
|
|
19
|
+
updateMany?(ctx: RequestContext): Promise<number>;
|
|
20
|
+
findMany?(ctx: RequestContext): Promise<PartialOutput<T>[]>;
|
|
21
|
+
protected _prepare(ctx: RequestContext): Promise<SQBAdapter.TransformedRequest>;
|
|
22
|
+
onPrepare?(ctx: RequestContext, prepared: SQBAdapter.TransformedRequest): SQBAdapter.TransformedRequest | Promise<SQBAdapter.TransformedRequest>;
|
|
23
|
+
protected abstract getService(ctx: RequestContext): SqbEntityService<T> | Promise<SqbEntityService<T>>;
|
|
21
24
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Maybe, Type } from 'ts-gems';
|
|
2
|
-
import { PartialInput, PartialOutput, RequestContext } from '@opra/core';
|
|
2
|
+
import { ApiService, PartialInput, PartialOutput, RequestContext } from '@opra/core';
|
|
3
3
|
import { EntityInput, Repository, SqbClient, SqbConnection } from '@sqb/connect';
|
|
4
4
|
export declare namespace SqbEntityService {
|
|
5
5
|
interface Options {
|
|
@@ -7,25 +7,25 @@ export declare namespace SqbEntityService {
|
|
|
7
7
|
defaultLimit?: number;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
export declare class SqbEntityService<T
|
|
10
|
+
export declare class SqbEntityService<T> extends ApiService {
|
|
11
11
|
readonly typeClass: Type<T>;
|
|
12
|
-
context: RequestContext;
|
|
13
12
|
defaultLimit: number;
|
|
14
13
|
db?: SqbClient | SqbConnection;
|
|
15
14
|
constructor(typeClass: Type<T>, options?: SqbEntityService.Options);
|
|
16
15
|
count(options?: Repository.CountOptions): Promise<number>;
|
|
17
|
-
create(data: PartialInput<T>, options?: Repository.CreateOptions): Promise<
|
|
18
|
-
delete(keyValue: any, options?: Repository.
|
|
19
|
-
deleteMany(options?: Repository.
|
|
20
|
-
find(keyValue: any, options?: Repository.FindOptions): Promise<Maybe<
|
|
21
|
-
findOne(options?: Repository.FindOneOptions): Promise<Maybe<
|
|
22
|
-
findMany(options?: Repository.FindManyOptions): Promise<
|
|
16
|
+
create(data: PartialInput<T>, options?: Repository.CreateOptions): Promise<PartialOutput<T>>;
|
|
17
|
+
delete(keyValue: any, options?: Repository.DeleteOptions): Promise<number>;
|
|
18
|
+
deleteMany(options?: Repository.DeleteManyOptions): Promise<number>;
|
|
19
|
+
find(keyValue: any, options?: Repository.FindOptions): Promise<Maybe<PartialOutput<T>>>;
|
|
20
|
+
findOne(options?: Repository.FindOneOptions): Promise<Maybe<PartialOutput<T>>>;
|
|
21
|
+
findMany(options?: Repository.FindManyOptions): Promise<PartialOutput<T>[]>;
|
|
23
22
|
exists(options?: Repository.ExistsOptions): Promise<boolean>;
|
|
24
|
-
update(keyValue: any, data: EntityInput<T>, options?: Repository.UpdateOptions): Promise<Maybe<
|
|
23
|
+
update(keyValue: any, data: EntityInput<T>, options?: Repository.UpdateOptions): Promise<Maybe<PartialOutput<T>>>;
|
|
25
24
|
updateMany(data: PartialInput<T>, options?: Repository.UpdateManyOptions): Promise<number>;
|
|
26
|
-
with(context: RequestContext, db?: SqbClient | SqbConnection): SqbEntityService<T
|
|
25
|
+
with(context: RequestContext, db?: SqbClient | SqbConnection): SqbEntityService<T>;
|
|
26
|
+
forContext(context: RequestContext, db?: SqbClient | SqbConnection): typeof this;
|
|
27
27
|
protected _onError(error: unknown): Promise<void>;
|
|
28
28
|
protected getConnection(): SqbConnection | SqbClient | Promise<SqbConnection | SqbClient>;
|
|
29
29
|
protected onError?(error: unknown): void | Promise<void>;
|
|
30
|
-
protected transformData?(row:
|
|
30
|
+
protected transformData?(row: PartialOutput<T>): PartialOutput<T>;
|
|
31
31
|
}
|
package/types/sqb-singleton.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { Maybe } from 'ts-gems';
|
|
2
|
-
import { PartialOutput } from '@opra/common';
|
|
2
|
+
import { ISingleton, PartialOutput } from '@opra/common';
|
|
3
3
|
import { RequestContext } from '@opra/core';
|
|
4
|
+
import { SQBAdapter } from './sqb-adapter.js';
|
|
4
5
|
import { SqbEntityService } from './sqb-entity-service.js';
|
|
5
|
-
export declare abstract class SqbSingleton<T> {
|
|
6
|
-
create(ctx: RequestContext): Promise<PartialOutput<T>>;
|
|
7
|
-
delete(ctx: RequestContext): Promise<
|
|
8
|
-
get(ctx: RequestContext): Promise<Maybe<PartialOutput<T>>>;
|
|
9
|
-
update(ctx: RequestContext): Promise<Maybe<PartialOutput<T>>>;
|
|
10
|
-
|
|
6
|
+
export declare abstract class SqbSingleton<T> implements ISingleton<T> {
|
|
7
|
+
create?(ctx: RequestContext): Promise<PartialOutput<T>>;
|
|
8
|
+
delete?(ctx: RequestContext): Promise<number>;
|
|
9
|
+
get?(ctx: RequestContext): Promise<Maybe<PartialOutput<T>>>;
|
|
10
|
+
update?(ctx: RequestContext): Promise<Maybe<PartialOutput<T>>>;
|
|
11
|
+
protected _prepare(ctx: RequestContext): Promise<SQBAdapter.TransformedRequest>;
|
|
12
|
+
onPrepare?(ctx: RequestContext, prepared: SQBAdapter.TransformedRequest): SQBAdapter.TransformedRequest | Promise<SQBAdapter.TransformedRequest>;
|
|
13
|
+
protected abstract getService(ctx: RequestContext): SqbEntityService<T> | Promise<SqbEntityService<T>>;
|
|
11
14
|
}
|