@opra/sqb 1.5.1 → 1.5.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.
|
@@ -34,8 +34,11 @@ class SqbEntityService extends sqb_service_base_js_1.SqbServiceBase {
|
|
|
34
34
|
* @throws {NotAcceptableError} If the data type is not a ComplexType.
|
|
35
35
|
*/
|
|
36
36
|
get dataType() {
|
|
37
|
+
if (this._dataType && this._dataTypeScope !== this.scope)
|
|
38
|
+
this._dataType = undefined;
|
|
37
39
|
if (!this._dataType)
|
|
38
40
|
this._dataType = this.context.documentNode.getComplexType(this._dataType_);
|
|
41
|
+
this._dataTypeScope = this.scope;
|
|
39
42
|
return this._dataType;
|
|
40
43
|
}
|
|
41
44
|
/**
|
|
@@ -99,7 +102,10 @@ class SqbEntityService extends sqb_service_base_js_1.SqbServiceBase {
|
|
|
99
102
|
let validator = this._inputCodecs[operation];
|
|
100
103
|
if (validator)
|
|
101
104
|
return validator;
|
|
102
|
-
const options = {
|
|
105
|
+
const options = {
|
|
106
|
+
projection: '*',
|
|
107
|
+
scope: this._dataTypeScope,
|
|
108
|
+
};
|
|
103
109
|
if (operation === 'update')
|
|
104
110
|
options.partial = 'deep';
|
|
105
111
|
const dataType = this.dataType;
|
|
@@ -117,6 +123,7 @@ class SqbEntityService extends sqb_service_base_js_1.SqbServiceBase {
|
|
|
117
123
|
const options = {
|
|
118
124
|
projection: '*',
|
|
119
125
|
partial: 'deep',
|
|
126
|
+
scope: this._dataTypeScope,
|
|
120
127
|
};
|
|
121
128
|
const dataType = this.dataType;
|
|
122
129
|
validator = dataType.generateCodec('decode', options);
|
|
@@ -31,8 +31,11 @@ export class SqbEntityService extends SqbServiceBase {
|
|
|
31
31
|
* @throws {NotAcceptableError} If the data type is not a ComplexType.
|
|
32
32
|
*/
|
|
33
33
|
get dataType() {
|
|
34
|
+
if (this._dataType && this._dataTypeScope !== this.scope)
|
|
35
|
+
this._dataType = undefined;
|
|
34
36
|
if (!this._dataType)
|
|
35
37
|
this._dataType = this.context.documentNode.getComplexType(this._dataType_);
|
|
38
|
+
this._dataTypeScope = this.scope;
|
|
36
39
|
return this._dataType;
|
|
37
40
|
}
|
|
38
41
|
/**
|
|
@@ -96,7 +99,10 @@ export class SqbEntityService extends SqbServiceBase {
|
|
|
96
99
|
let validator = this._inputCodecs[operation];
|
|
97
100
|
if (validator)
|
|
98
101
|
return validator;
|
|
99
|
-
const options = {
|
|
102
|
+
const options = {
|
|
103
|
+
projection: '*',
|
|
104
|
+
scope: this._dataTypeScope,
|
|
105
|
+
};
|
|
100
106
|
if (operation === 'update')
|
|
101
107
|
options.partial = 'deep';
|
|
102
108
|
const dataType = this.dataType;
|
|
@@ -114,6 +120,7 @@ export class SqbEntityService extends SqbServiceBase {
|
|
|
114
120
|
const options = {
|
|
115
121
|
projection: '*',
|
|
116
122
|
partial: 'deep',
|
|
123
|
+
scope: this._dataTypeScope,
|
|
117
124
|
};
|
|
118
125
|
const dataType = this.dataType;
|
|
119
126
|
validator = dataType.generateCodec('decode', options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/sqb",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "Opra SQB adapter package",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"valgen": "^5.12.0"
|
|
11
11
|
},
|
|
12
12
|
"peerDependencies": {
|
|
13
|
-
"@opra/core": "^1.5.
|
|
14
|
-
"@opra/http": "^1.5.
|
|
13
|
+
"@opra/core": "^1.5.2",
|
|
14
|
+
"@opra/http": "^1.5.2",
|
|
15
15
|
"@sqb/connect": ">= 4.19.1"
|
|
16
16
|
},
|
|
17
17
|
"type": "module",
|
|
@@ -14,6 +14,7 @@ export declare namespace SqbEntityService {
|
|
|
14
14
|
onError?: SqbEntityService<any>['onError'];
|
|
15
15
|
commonFilter?: SqbEntityService<any>['commonFilter'];
|
|
16
16
|
interceptor?: SqbEntityService<any>['interceptor'];
|
|
17
|
+
scope?: SqbEntityService<any>['scope'];
|
|
17
18
|
}
|
|
18
19
|
type CrudOp = 'create' | 'read' | 'update' | 'delete';
|
|
19
20
|
interface CommandInfo {
|
|
@@ -154,12 +155,17 @@ export interface SqbEntityService {
|
|
|
154
155
|
* @template T - The data type class type of the resource
|
|
155
156
|
*/
|
|
156
157
|
export declare class SqbEntityService<T extends object = object> extends SqbServiceBase {
|
|
158
|
+
protected _dataTypeScope?: string;
|
|
157
159
|
protected _dataType_: Type | string;
|
|
158
160
|
protected _dataType?: ComplexType;
|
|
159
161
|
protected _dataTypeClass?: Type;
|
|
160
162
|
protected _entityMetadata?: EntityMetadata;
|
|
161
163
|
protected _inputCodecs: Record<string, IsObject.Validator<T>>;
|
|
162
164
|
protected _outputCodecs: Record<string, IsObject.Validator<T>>;
|
|
165
|
+
/**
|
|
166
|
+
* Defines comma delimited scopes for api document
|
|
167
|
+
*/
|
|
168
|
+
scope?: string;
|
|
163
169
|
/**
|
|
164
170
|
* Represents the name of a resource.
|
|
165
171
|
* @type {string}
|