@opra/common 1.26.3 → 1.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/README.md +24 -1
- package/browser.js +3 -3
- package/document/api-document.js +4 -4
- package/document/common/document-node.js +2 -0
- package/document/data-type/api-field.d.ts +0 -1
- package/document/data-type/complex-type-base.js +7 -7
- package/document/data-type/complex-type.js +2 -2
- package/document/data-type/data-type.js +1 -1
- package/document/data-type/extended-types/field-path.type.js +1 -1
- package/document/data-type/extended-types/filter.type.js +1 -1
- package/document/data-type/mapped-type.js +1 -1
- package/document/decorators/http-operation-entity-create.decorator.js +1 -1
- package/document/decorators/http-operation-entity-delete-many.decorator.js +1 -1
- package/document/decorators/http-operation-entity-delete.decorator.js +1 -1
- package/document/decorators/http-operation-entity-find-many.decorator.js +1 -1
- package/document/decorators/http-operation-entity-get.decorator.js +1 -1
- package/document/decorators/http-operation-entity-replace.decorator.js +1 -1
- package/document/decorators/http-operation-entity-update-many.decorator.js +1 -1
- package/document/decorators/http-operation-entity-update.decorator.js +1 -1
- package/document/decorators/http-operation-entity.decorator.d.ts +0 -9
- package/document/decorators/http-operation-entity.decorator.js +1 -1
- package/document/factory/api-document.factory.js +3 -3
- package/document/factory/data-type.factory.js +7 -7
- package/document/http/http-controller.js +2 -2
- package/document/mq/mq-api.js +2 -2
- package/document/ws/ws-api.js +2 -2
- package/filter/filter-rules.js +3 -3
- package/helpers/parse-fields-projection.js +1 -1
- package/package.json +1 -1
- package/schema/types.d.ts +1 -11
package/document/api-document.js
CHANGED
|
@@ -120,11 +120,11 @@ export class ApiDocument extends DocumentElement {
|
|
|
120
120
|
return out;
|
|
121
121
|
}
|
|
122
122
|
invalidate() {
|
|
123
|
-
|
|
123
|
+
/* Generate id */
|
|
124
124
|
const x = this.export({});
|
|
125
125
|
delete x.id;
|
|
126
126
|
this.id = md5(JSON.stringify(x));
|
|
127
|
-
|
|
127
|
+
/* Clear [kTypeNSMap] */
|
|
128
128
|
this[kTypeNSMap] = new WeakMap();
|
|
129
129
|
}
|
|
130
130
|
_findDataType(nameOrCtor, scope, visitedRefs) {
|
|
@@ -155,7 +155,7 @@ export class ApiDocument extends DocumentElement {
|
|
|
155
155
|
visitedRefs = visitedRefs || new WeakMap();
|
|
156
156
|
visitedRefs.set(this, true);
|
|
157
157
|
const references = Array.from(this.references.keys()).reverse();
|
|
158
|
-
|
|
158
|
+
/* First step, lookup for own types */
|
|
159
159
|
for (const refNs of references) {
|
|
160
160
|
const ref = this.references.get(refNs);
|
|
161
161
|
result = ref?.types.get(nameOrCtor);
|
|
@@ -164,7 +164,7 @@ export class ApiDocument extends DocumentElement {
|
|
|
164
164
|
return result;
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
|
|
167
|
+
/* If not found lookup for child references */
|
|
168
168
|
for (const refNs of references) {
|
|
169
169
|
const ref = this.references.get(refNs);
|
|
170
170
|
visitedRefs.set(ref, true);
|
|
@@ -47,6 +47,8 @@ export class DocumentNode {
|
|
|
47
47
|
}
|
|
48
48
|
else if (typeof nameOrCtor === 'object') {
|
|
49
49
|
const metadata = nameOrCtor[DATATYPE_METADATA];
|
|
50
|
+
if (!metadata)
|
|
51
|
+
throw new TypeError(`OPRA Metadata not found for data type (${nameOrCtor})`);
|
|
50
52
|
name = metadata?.name;
|
|
51
53
|
}
|
|
52
54
|
if (!name) {
|
|
@@ -251,12 +251,12 @@ class ComplexTypeBaseClass extends DataType {
|
|
|
251
251
|
let fieldName;
|
|
252
252
|
for (const field of this.fields('*')) {
|
|
253
253
|
if (
|
|
254
|
-
|
|
254
|
+
/* Ignore field if required scope(s) do not match field scopes */
|
|
255
255
|
!field.inScope(context.scope) ||
|
|
256
256
|
(!(context.keepKeyFields && this.keyField) &&
|
|
257
|
-
|
|
257
|
+
/* Ignore field if readonly and ignoreReadonlyFields option true */
|
|
258
258
|
((context.ignoreReadonlyFields && field.readonly) ||
|
|
259
|
-
|
|
259
|
+
/* Ignore field if writeonly and ignoreWriteonlyFields option true */
|
|
260
260
|
(context.ignoreWriteonlyFields && field.writeonly)))) {
|
|
261
261
|
schema[field.name] = vg.isUndefined({ coerce: true });
|
|
262
262
|
continue;
|
|
@@ -266,11 +266,11 @@ class ComplexTypeBaseClass extends DataType {
|
|
|
266
266
|
if (projection !== '*') {
|
|
267
267
|
p = projection?.[fieldName.toLowerCase()];
|
|
268
268
|
if (
|
|
269
|
-
|
|
269
|
+
/* Ignore if field is omitted */
|
|
270
270
|
p?.sign === '-' ||
|
|
271
|
-
|
|
271
|
+
/* Ignore if default fields ignored and field is not in projection */
|
|
272
272
|
(pickList && !p) ||
|
|
273
|
-
|
|
273
|
+
/* Ignore if default fields enabled and fields is exclusive */
|
|
274
274
|
(!pickList && field.exclusive && !p)) {
|
|
275
275
|
schema[field.name] = vg.isUndefined({ coerce: true });
|
|
276
276
|
continue;
|
|
@@ -288,7 +288,7 @@ class ComplexTypeBaseClass extends DataType {
|
|
|
288
288
|
context.fieldCache.set(field, cacheItem);
|
|
289
289
|
}
|
|
290
290
|
let fn = cacheItem[cacheKey];
|
|
291
|
-
|
|
291
|
+
/* If in progress (circular) */
|
|
292
292
|
if (fn === null) {
|
|
293
293
|
// Temporary set any
|
|
294
294
|
fn = vg.isAny();
|
|
@@ -32,7 +32,7 @@ export const ComplexType = function (...args) {
|
|
|
32
32
|
_this.base = initArgs.base;
|
|
33
33
|
_this.additionalFields = _this.base.additionalFields;
|
|
34
34
|
_this.keyField = _this.base.keyField;
|
|
35
|
-
|
|
35
|
+
/* Copy fields from base */
|
|
36
36
|
for (const v of _this.base.fields('*')) {
|
|
37
37
|
_this._fields.set(v.name, new ApiField(this, v));
|
|
38
38
|
}
|
|
@@ -43,7 +43,7 @@ export const ComplexType = function (...args) {
|
|
|
43
43
|
if (initArgs.keyField !== undefined)
|
|
44
44
|
_this.keyField = initArgs.keyField;
|
|
45
45
|
_this.ctor = initArgs.ctor || _this.base?.ctor;
|
|
46
|
-
|
|
46
|
+
/* Add own fields */
|
|
47
47
|
if (initArgs.fields) {
|
|
48
48
|
context.enter('.fields', () => {
|
|
49
49
|
for (const [k, v] of Object.entries(initArgs.fields)) {
|
|
@@ -40,7 +40,7 @@ class DataTypeClass extends DocumentElement {
|
|
|
40
40
|
return testScopeMatch(scope, this.scopePattern);
|
|
41
41
|
}
|
|
42
42
|
toJSON(options) {
|
|
43
|
-
|
|
43
|
+
/* Locate base model which is not available for given scope */
|
|
44
44
|
const outOfScope = this._locateBase(dt => !dt.inScope(options?.scope));
|
|
45
45
|
if (outOfScope) {
|
|
46
46
|
const baseName = this.node.getDataTypeNameWithNs(outOfScope);
|
|
@@ -25,7 +25,7 @@ let FieldPathType = class FieldPathType {
|
|
|
25
25
|
const dataType = properties.dataType
|
|
26
26
|
? element.node.getComplexType(properties.dataType)
|
|
27
27
|
: element.node.getComplexType('object');
|
|
28
|
-
|
|
28
|
+
/* Test scope */
|
|
29
29
|
DataType.prototype.toJSON.call(dataType, options);
|
|
30
30
|
const typeName = dataType
|
|
31
31
|
? element.node.getDataTypeNameWithNs(dataType)
|
|
@@ -28,7 +28,7 @@ let FilterType = class FilterType {
|
|
|
28
28
|
const dataType = properties.dataType
|
|
29
29
|
? element.node.getComplexType(properties.dataType)
|
|
30
30
|
: element.node.getComplexType('object');
|
|
31
|
-
|
|
31
|
+
/* Test scope */
|
|
32
32
|
DataType.prototype.toJSON.call(dataType, options);
|
|
33
33
|
const typeName = dataType
|
|
34
34
|
? element.node.getDataTypeNameWithNs(dataType)
|
|
@@ -38,7 +38,7 @@ export const MappedType = function (...args) {
|
|
|
38
38
|
? initArgs.required.map(f => _this.base.normalizeFieldPath(f))
|
|
39
39
|
: initArgs.required;
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
/* Copy fields from base */
|
|
42
42
|
const isInheritedPredicate = getIsInheritedPredicateFn(_this.pick, _this.omit);
|
|
43
43
|
const partial = Array.isArray(_this.partial)
|
|
44
44
|
? _this.partial.map(x => x.toLowerCase())
|
|
@@ -14,7 +14,7 @@ HttpOperation.Entity.Create = function (arg0, arg1) {
|
|
|
14
14
|
}
|
|
15
15
|
else
|
|
16
16
|
args = { ...arg1, type: arg0 };
|
|
17
|
-
|
|
17
|
+
/* Initialize the decorator and the chain */
|
|
18
18
|
const decoratorChain = [];
|
|
19
19
|
const decorator = HttpOperationDecoratorFactory(decoratorChain, {
|
|
20
20
|
method: 'POST',
|
|
@@ -13,7 +13,7 @@ HttpOperation.Entity.DeleteMany = function (arg0, arg1) {
|
|
|
13
13
|
}
|
|
14
14
|
else
|
|
15
15
|
args = { ...arg1, type: arg0 };
|
|
16
|
-
|
|
16
|
+
/* Initialize the decorator and the chain */
|
|
17
17
|
const decoratorChain = [];
|
|
18
18
|
const decorator = HttpOperationDecoratorFactory(decoratorChain, {
|
|
19
19
|
method: 'DELETE',
|
|
@@ -13,7 +13,7 @@ HttpOperation.Entity.Delete = function (arg0, arg1) {
|
|
|
13
13
|
}
|
|
14
14
|
else
|
|
15
15
|
args = { ...arg1, type: arg0 };
|
|
16
|
-
|
|
16
|
+
/* Initialize the decorator and the chain */
|
|
17
17
|
const decoratorChain = [];
|
|
18
18
|
const decorator = HttpOperationDecoratorFactory(decoratorChain, {
|
|
19
19
|
method: 'DELETE',
|
|
@@ -15,7 +15,7 @@ HttpOperation.Entity.FindMany = function (arg0, arg1) {
|
|
|
15
15
|
}
|
|
16
16
|
else
|
|
17
17
|
args = { ...arg1, type: arg0 };
|
|
18
|
-
|
|
18
|
+
/* Initialize the decorator and the chain */
|
|
19
19
|
const decoratorChain = [];
|
|
20
20
|
const decorator = HttpOperationDecoratorFactory(decoratorChain, {
|
|
21
21
|
method: 'GET',
|
|
@@ -14,7 +14,7 @@ HttpOperation.Entity.Get = function (arg0, arg1) {
|
|
|
14
14
|
}
|
|
15
15
|
else
|
|
16
16
|
args = { ...arg1, type: arg0 };
|
|
17
|
-
|
|
17
|
+
/* Initialize the decorator and the chain */
|
|
18
18
|
const decoratorChain = [];
|
|
19
19
|
const decorator = HttpOperationDecoratorFactory(decoratorChain, {
|
|
20
20
|
method: 'GET',
|
|
@@ -14,7 +14,7 @@ HttpOperation.Entity.Replace = function (arg0, arg1) {
|
|
|
14
14
|
}
|
|
15
15
|
else
|
|
16
16
|
args = { ...arg1, type: arg0 };
|
|
17
|
-
|
|
17
|
+
/* Initialize the decorator and the chain */
|
|
18
18
|
const decoratorChain = [];
|
|
19
19
|
const decorator = HttpOperationDecoratorFactory(decoratorChain, {
|
|
20
20
|
method: 'POST',
|
|
@@ -13,7 +13,7 @@ HttpOperation.Entity.UpdateMany = function (arg0, arg1) {
|
|
|
13
13
|
}
|
|
14
14
|
else
|
|
15
15
|
args = { ...arg1, type: arg0 };
|
|
16
|
-
|
|
16
|
+
/* Initialize the decorator and the chain */
|
|
17
17
|
const decoratorChain = [];
|
|
18
18
|
const decorator = HttpOperationDecoratorFactory(decoratorChain, {
|
|
19
19
|
method: 'PATCH',
|
|
@@ -14,7 +14,7 @@ HttpOperation.Entity.Update = function (arg0, arg1) {
|
|
|
14
14
|
}
|
|
15
15
|
else
|
|
16
16
|
args = { ...arg1, type: arg0 };
|
|
17
|
-
|
|
17
|
+
/* Initialize the decorator and the chain */
|
|
18
18
|
const decoratorChain = [];
|
|
19
19
|
const decorator = HttpOperationDecoratorFactory(decoratorChain, {
|
|
20
20
|
method: 'PATCH',
|
|
@@ -5,7 +5,6 @@ import { HttpOperation } from '../http/http-operation.js';
|
|
|
5
5
|
import type { HttpParameter } from '../http/http-parameter.js';
|
|
6
6
|
import { HttpRequestBody } from '../http/http-request-body.js';
|
|
7
7
|
import { type HttpOperationDecorator } from './http-operation.decorator.js';
|
|
8
|
-
/** Augmentation **/
|
|
9
8
|
declare module '../http/http-operation.js' {
|
|
10
9
|
/**
|
|
11
10
|
* HttpOperationStatic
|
|
@@ -33,7 +32,6 @@ declare module '../http/http-operation.js' {
|
|
|
33
32
|
}
|
|
34
33
|
namespace HttpOperation {
|
|
35
34
|
namespace Entity {
|
|
36
|
-
/** Create */
|
|
37
35
|
interface CreateDecorator extends HttpOperationDecorator {
|
|
38
36
|
}
|
|
39
37
|
interface CreateArgs extends StrictOmit<HttpOperation.Options, 'method' | 'requestBody'> {
|
|
@@ -43,14 +41,12 @@ declare module '../http/http-operation.js' {
|
|
|
43
41
|
immediateFetch?: boolean;
|
|
44
42
|
};
|
|
45
43
|
}
|
|
46
|
-
/** Delete */
|
|
47
44
|
interface DeleteDecorator extends HttpOperationDecorator {
|
|
48
45
|
KeyParam(name: string, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync): this;
|
|
49
46
|
}
|
|
50
47
|
interface DeleteArgs extends StrictOmit<HttpOperation.Options, 'method' | 'requestBody'> {
|
|
51
48
|
type: Type | string;
|
|
52
49
|
}
|
|
53
|
-
/** DeleteMany */
|
|
54
50
|
interface FilterOptions {
|
|
55
51
|
mappedField?: string;
|
|
56
52
|
operators?: OpraFilter.ComparisonOperator[];
|
|
@@ -64,7 +60,6 @@ declare module '../http/http-operation.js' {
|
|
|
64
60
|
interface DeleteManyArgs extends StrictOmit<HttpOperation.Options, 'method' | 'requestBody'> {
|
|
65
61
|
type: Type | string;
|
|
66
62
|
}
|
|
67
|
-
/** FindMany */
|
|
68
63
|
interface FindManyDecorator extends HttpOperationDecorator {
|
|
69
64
|
SortFields(...fields: OpraSchema.Field.QualifiedName[]): FindManyDecorator;
|
|
70
65
|
SortFields(fieldsMap: Record<OpraSchema.Field.QualifiedName, OpraSchema.Field.QualifiedName>): FindManyDecorator;
|
|
@@ -78,21 +73,18 @@ declare module '../http/http-operation.js' {
|
|
|
78
73
|
defaultProjection?: string[];
|
|
79
74
|
maxLimit?: number;
|
|
80
75
|
}
|
|
81
|
-
/** Get */
|
|
82
76
|
interface GetDecorator extends HttpOperationDecorator {
|
|
83
77
|
KeyParam(name: string, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync): this;
|
|
84
78
|
}
|
|
85
79
|
interface GetArgs extends StrictOmit<HttpOperation.Options, 'method' | 'requestBody'> {
|
|
86
80
|
type: Type | string;
|
|
87
81
|
}
|
|
88
|
-
/** Replace */
|
|
89
82
|
interface ReplaceDecorator extends HttpOperationDecorator {
|
|
90
83
|
KeyParam(name: string, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync): this;
|
|
91
84
|
}
|
|
92
85
|
interface ReplaceArgs extends StrictOmit<HttpOperation.Options, 'method' | 'requestBody'> {
|
|
93
86
|
type: Type | string;
|
|
94
87
|
}
|
|
95
|
-
/** Update */
|
|
96
88
|
interface UpdateDecorator extends HttpOperationDecorator {
|
|
97
89
|
KeyParam(name: string, optionsOrType?: StrictOmit<HttpParameter.Options, 'location'> | string | TypeThunkAsync): this;
|
|
98
90
|
Filter(field: OpraSchema.Field.QualifiedName, operators?: OpraFilter.ComparisonOperator[] | string): this;
|
|
@@ -106,7 +98,6 @@ declare module '../http/http-operation.js' {
|
|
|
106
98
|
allowPatchOperators?: boolean;
|
|
107
99
|
};
|
|
108
100
|
}
|
|
109
|
-
/** UpdateMany */
|
|
110
101
|
interface UpdateManyDecorator extends HttpOperationDecorator {
|
|
111
102
|
Filter(field: OpraSchema.Field.QualifiedName, operators?: OpraFilter.ComparisonOperator[] | string): this;
|
|
112
103
|
Filter(field: string, options?: FilterOptions): this;
|
|
@@ -4,7 +4,7 @@ import { FIELD_PATH_PATTERN } from '../data-type/complex-type-base.js';
|
|
|
4
4
|
import { EnumType } from '../data-type/enum-type.js';
|
|
5
5
|
import { FilterType } from '../data-type/extended-types/index.js';
|
|
6
6
|
import { HttpOperation } from '../http/http-operation.js';
|
|
7
|
-
|
|
7
|
+
/* Implementation **/
|
|
8
8
|
HttpOperation.Entity = {};
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
@@ -82,7 +82,7 @@ export class ApiDocumentFactory {
|
|
|
82
82
|
document.url = init.url;
|
|
83
83
|
if (init.info)
|
|
84
84
|
document.info = { ...init.info };
|
|
85
|
-
|
|
85
|
+
/* Add references */
|
|
86
86
|
if (init.references) {
|
|
87
87
|
await context.enterAsync('.references', async () => {
|
|
88
88
|
let ns;
|
|
@@ -141,7 +141,7 @@ export class ApiDocumentFactory {
|
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
document.invalidate();
|
|
144
|
-
|
|
144
|
+
/* Add document to global registry */
|
|
145
145
|
if (!this._allDocuments[document.id])
|
|
146
146
|
this._allDocuments[document.id] = document;
|
|
147
147
|
}
|
|
@@ -158,7 +158,7 @@ export class ApiDocumentFactory {
|
|
|
158
158
|
version: OpraSchema.SpecVersion,
|
|
159
159
|
title: 'Opra built-in types',
|
|
160
160
|
license: {
|
|
161
|
-
url: 'https://github.com/
|
|
161
|
+
url: 'https://github.com/panates/opra/blob/main/LICENSE',
|
|
162
162
|
name: 'MIT',
|
|
163
163
|
},
|
|
164
164
|
},
|
|
@@ -38,9 +38,9 @@ export class DataTypeFactory {
|
|
|
38
38
|
return dt;
|
|
39
39
|
}
|
|
40
40
|
if (v) {
|
|
41
|
-
|
|
41
|
+
/* To throw not found error */
|
|
42
42
|
const dt = owner.node.getDataType(v);
|
|
43
|
-
|
|
43
|
+
/* istanbul ignore next */
|
|
44
44
|
if (dt)
|
|
45
45
|
return dt;
|
|
46
46
|
}
|
|
@@ -222,7 +222,7 @@ export class DataTypeFactory {
|
|
|
222
222
|
return context.addError(`No DataType metadata found`);
|
|
223
223
|
}
|
|
224
224
|
return context.enterAsync(metadata.name ? `[${metadata.name}]` : '', async () => {
|
|
225
|
-
|
|
225
|
+
/* Check for circular dependencies */
|
|
226
226
|
if (metadata.name) {
|
|
227
227
|
const curr = initArgsMap?.get(metadata.name);
|
|
228
228
|
if (curr) {
|
|
@@ -235,7 +235,7 @@ export class DataTypeFactory {
|
|
|
235
235
|
kind: metadata.kind,
|
|
236
236
|
name: metadata.name,
|
|
237
237
|
};
|
|
238
|
-
|
|
238
|
+
/* Mark "out" object as initializing. This will help us to detect circular dependencies */
|
|
239
239
|
out[initializingSymbol] = true;
|
|
240
240
|
try {
|
|
241
241
|
if (out.name) {
|
|
@@ -274,7 +274,7 @@ export class DataTypeFactory {
|
|
|
274
274
|
await this._prepareUnionTypeArgs(context, owner, out, metadata);
|
|
275
275
|
break;
|
|
276
276
|
default:
|
|
277
|
-
|
|
277
|
+
/* istanbul ignore next */
|
|
278
278
|
return context.addError(`Invalid data type kind ${metadata.kind}`);
|
|
279
279
|
}
|
|
280
280
|
}
|
|
@@ -522,7 +522,7 @@ export class DataTypeFactory {
|
|
|
522
522
|
initArgs.base = this._createDataType(context, owner, args.base);
|
|
523
523
|
});
|
|
524
524
|
}
|
|
525
|
-
|
|
525
|
+
/* Set additionalFields */
|
|
526
526
|
if (args.additionalFields) {
|
|
527
527
|
context.enter('.additionalFields', () => {
|
|
528
528
|
if (typeof args.additionalFields === 'boolean' ||
|
|
@@ -534,7 +534,7 @@ export class DataTypeFactory {
|
|
|
534
534
|
}
|
|
535
535
|
});
|
|
536
536
|
}
|
|
537
|
-
|
|
537
|
+
/* Add own fields */
|
|
538
538
|
initArgs.fields = {};
|
|
539
539
|
if (args.fields) {
|
|
540
540
|
context.enter('.fields', () => {
|
|
@@ -47,11 +47,11 @@ class HttpControllerClass extends DocumentElement {
|
|
|
47
47
|
}
|
|
48
48
|
findController(arg0) {
|
|
49
49
|
if (typeof arg0 === 'function') {
|
|
50
|
-
|
|
50
|
+
/* Check for cached mapping */
|
|
51
51
|
let controller = this._controllerReverseMap.get(arg0);
|
|
52
52
|
if (controller != null)
|
|
53
53
|
return controller;
|
|
54
|
-
|
|
54
|
+
/* Lookup for ctor in all controllers */
|
|
55
55
|
for (const c of this.controllers.values()) {
|
|
56
56
|
if (c.ctor === arg0) {
|
|
57
57
|
this._controllerReverseMap.set(arg0, c);
|
package/document/mq/mq-api.js
CHANGED
|
@@ -15,11 +15,11 @@ export class MQApi extends ApiBase {
|
|
|
15
15
|
}
|
|
16
16
|
findController(arg0) {
|
|
17
17
|
if (typeof arg0 === 'function') {
|
|
18
|
-
|
|
18
|
+
/* Check for cached mapping */
|
|
19
19
|
const controller = this._controllerReverseMap.get(arg0);
|
|
20
20
|
if (controller != null)
|
|
21
21
|
return controller;
|
|
22
|
-
|
|
22
|
+
/* Lookup for ctor in all controllers */
|
|
23
23
|
for (const c of this.controllers.values()) {
|
|
24
24
|
if (c.ctor === arg0) {
|
|
25
25
|
this._controllerReverseMap.set(arg0, c);
|
package/document/ws/ws-api.js
CHANGED
|
@@ -13,11 +13,11 @@ export class WSApi extends ApiBase {
|
|
|
13
13
|
}
|
|
14
14
|
findController(arg0) {
|
|
15
15
|
if (typeof arg0 === 'function') {
|
|
16
|
-
|
|
16
|
+
/* Check for cached mapping */
|
|
17
17
|
const controller = this._controllerReverseMap.get(arg0);
|
|
18
18
|
if (controller != null)
|
|
19
19
|
return controller;
|
|
20
|
-
|
|
20
|
+
/* Lookup for ctor in all controllers */
|
|
21
21
|
for (const c of this.controllers.values()) {
|
|
22
22
|
if (c.ctor === arg0) {
|
|
23
23
|
this._controllerReverseMap.set(arg0, c);
|
package/filter/filter-rules.js
CHANGED
|
@@ -100,13 +100,13 @@ export class FilterRules {
|
|
|
100
100
|
return ast;
|
|
101
101
|
}
|
|
102
102
|
if (ast instanceof Literal) {
|
|
103
|
-
|
|
103
|
+
/* Check if comparison expression has in stack */
|
|
104
104
|
const compIdx = stack.findLastIndex(x => x instanceof ComparisonExpression);
|
|
105
105
|
if (compIdx >= 0) {
|
|
106
106
|
const comp = stack[compIdx];
|
|
107
|
-
|
|
107
|
+
/* If calling for right side of comparison */
|
|
108
108
|
if (ast === comp.right || stack[compIdx + 1] === comp.right) {
|
|
109
|
-
|
|
109
|
+
/* Check if comparison expression left side is a field */
|
|
110
110
|
if (comp &&
|
|
111
111
|
comp.left instanceof QualifiedIdentifier &&
|
|
112
112
|
comp.left.field) {
|
|
@@ -23,7 +23,7 @@ export function parseFieldsProjection(projection, keepCase) {
|
|
|
23
23
|
return out;
|
|
24
24
|
}
|
|
25
25
|
export function parse(input, target) {
|
|
26
|
-
|
|
26
|
+
/* Add dot before brackets which is required to split fields */
|
|
27
27
|
input = input.replace(NO_DOT_BRACKET_PATTERN, s => s.charAt(0) + '.' + s.substring(1));
|
|
28
28
|
const fields = splitString(input, {
|
|
29
29
|
delimiters: '.',
|
package/package.json
CHANGED
package/schema/types.d.ts
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
1
1
|
export type HttpMethod = 'DELETE' | 'GET' | 'HEAD' | 'OPTIONS' | 'POST' | 'PUT' | 'PATCH' | 'SEARCH';
|
|
2
2
|
export type HttpParameterLocation = 'cookie' | 'header' | 'query' | 'path';
|
|
3
3
|
export type HttpMultipartFieldType = 'field' | 'file';
|
|
4
|
-
export type Transport =
|
|
5
|
-
/** Custom **/
|
|
6
|
-
'custom'
|
|
7
|
-
/** HTTP **/
|
|
8
|
-
| 'http'
|
|
9
|
-
/** WebSocket*/
|
|
10
|
-
| 'ws'
|
|
11
|
-
/** Message Queue (Kafka, RabbitMQ, MQTT etc) */
|
|
12
|
-
| 'mq'
|
|
13
|
-
/** Remote Procedure Call (gRPC etc) */
|
|
14
|
-
| 'rpc';
|
|
4
|
+
export type Transport = 'custom' | 'http' | 'ws' | 'mq' | 'rpc';
|