@opra/common 1.4.3 → 1.5.0
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/browser/index.cjs +5 -5
- package/browser/index.mjs +5 -5
- package/cjs/document/api-document.js +16 -9
- package/cjs/document/common/api-base.js +4 -2
- package/cjs/document/common/data-type-map.js +14 -3
- package/cjs/document/common/document-init-context.js +5 -0
- package/cjs/document/common/document-node.js +25 -29
- package/cjs/document/common/value.js +9 -3
- package/cjs/document/constants.js +1 -2
- package/cjs/document/data-type/api-field.js +19 -4
- package/cjs/document/data-type/complex-type-base.js +24 -7
- package/cjs/document/data-type/complex-type.js +17 -6
- package/cjs/document/data-type/data-type.js +16 -1
- package/cjs/document/data-type/enum-type.js +12 -3
- package/cjs/document/data-type/extended-types/base64.type.js +1 -0
- package/cjs/document/data-type/extended-types/date-string.type.js +1 -0
- package/cjs/document/data-type/extended-types/date-time-string.type.js +1 -0
- package/cjs/document/data-type/extended-types/date-time.type.js +6 -1
- package/cjs/document/data-type/extended-types/date.type.js +6 -1
- package/cjs/document/data-type/extended-types/email.type.js +1 -0
- package/cjs/document/data-type/extended-types/field-path.type.js +9 -3
- package/cjs/document/data-type/extended-types/filter.type.js +14 -5
- package/cjs/document/data-type/extended-types/object-id.type.js +1 -0
- package/cjs/document/data-type/extended-types/operation-result.type.js +1 -0
- package/cjs/document/data-type/extended-types/time.type.js +1 -0
- package/cjs/document/data-type/extended-types/url.type.js +1 -0
- package/cjs/document/data-type/extended-types/uuid.type.js +1 -0
- package/cjs/document/data-type/mapped-type.js +21 -9
- package/cjs/document/data-type/mixin-type.js +10 -5
- package/cjs/document/data-type/primitive-types/any.type.js +1 -0
- package/cjs/document/data-type/primitive-types/bigint.type.js +4 -1
- package/cjs/document/data-type/primitive-types/boolean.type.js +1 -0
- package/cjs/document/data-type/primitive-types/integer.type.js +4 -1
- package/cjs/document/data-type/primitive-types/null.type.js +1 -0
- package/cjs/document/data-type/primitive-types/number.type.js +4 -1
- package/cjs/document/data-type/primitive-types/string.type.js +4 -1
- package/cjs/document/data-type/simple-type.js +17 -5
- package/cjs/document/data-type/utils/create-mapped-class.js +3 -1
- package/cjs/document/decorators/api-field-decorator.js +2 -1
- package/cjs/document/decorators/complex-type.decorator.js +1 -1
- package/cjs/document/decorators/http-controller.decorator.js +7 -1
- package/cjs/document/decorators/http-operation-entity.decorator.js +20 -10
- package/cjs/document/decorators/http-operation.decorator.js +23 -10
- package/cjs/document/decorators/rpc-operation.decorator.js +1 -2
- package/cjs/document/decorators/simple-type.decorator.js +3 -2
- package/cjs/document/factory/api-document.factory.js +12 -3
- package/cjs/document/factory/data-type.factory.js +19 -7
- package/cjs/document/factory/http-api.factory.js +13 -4
- package/cjs/document/http/http-api.js +2 -2
- package/cjs/document/http/http-controller.js +7 -6
- package/cjs/document/http/http-media-type.js +18 -8
- package/cjs/document/http/http-multipart-field.js +2 -2
- package/cjs/document/http/http-operation-response.js +11 -6
- package/cjs/document/http/http-operation.js +8 -6
- package/cjs/document/http/http-parameter.js +2 -2
- package/cjs/document/http/http-request-body.js +4 -2
- package/cjs/document/http/http-status-range.js +3 -1
- package/cjs/document/rpc/rpc-operation-response.js +11 -3
- package/cjs/document/rpc/rpc-operation.js +11 -3
- package/cjs/document/utils/parse-regexp.util.js +2 -2
- package/cjs/exception/opra-exception.js +3 -1
- package/cjs/filter/antlr/OpraFilterLexer.js +190 -123
- package/cjs/filter/antlr/OpraFilterParser.js +53 -35
- package/cjs/filter/ast/expressions/arithmetic-expression.js +3 -1
- package/cjs/filter/ast/terms/number-literal.js +3 -1
- package/cjs/filter/filter-rules.js +18 -8
- package/cjs/filter/filter-tree-visitor.js +2 -1
- package/cjs/filter/opra-error-listener.js +7 -1
- package/cjs/filter/parse.js +3 -1
- package/cjs/filter/utils.js +3 -1
- package/cjs/helpers/get-stack-filename.js +6 -2
- package/cjs/helpers/mixin-utils.js +7 -2
- package/cjs/helpers/object-utils.js +3 -1
- package/cjs/helpers/parse-fields-projection.js +4 -2
- package/cjs/helpers/type-guards.js +7 -2
- package/cjs/i18n/i18n.js +13 -3
- package/cjs/i18n/translate.js +3 -1
- package/cjs/polifils/array-find-last.js +0 -2
- package/esm/document/api-document.js +17 -10
- package/esm/document/common/api-base.js +4 -2
- package/esm/document/common/data-type-map.js +14 -3
- package/esm/document/common/document-init-context.js +5 -0
- package/esm/document/common/document-node.js +25 -29
- package/esm/document/common/value.js +9 -3
- package/esm/document/constants.js +0 -1
- package/esm/document/data-type/api-field.js +19 -4
- package/esm/document/data-type/complex-type-base.js +25 -8
- package/esm/document/data-type/complex-type.js +17 -6
- package/esm/document/data-type/data-type.js +17 -2
- package/esm/document/data-type/enum-type.js +12 -3
- package/esm/document/data-type/extended-types/base64.type.js +1 -0
- package/esm/document/data-type/extended-types/date-string.type.js +1 -0
- package/esm/document/data-type/extended-types/date-time-string.type.js +1 -0
- package/esm/document/data-type/extended-types/date-time.type.js +6 -1
- package/esm/document/data-type/extended-types/date.type.js +6 -1
- package/esm/document/data-type/extended-types/email.type.js +1 -0
- package/esm/document/data-type/extended-types/field-path.type.js +9 -3
- package/esm/document/data-type/extended-types/filter.type.js +14 -5
- package/esm/document/data-type/extended-types/object-id.type.js +1 -0
- package/esm/document/data-type/extended-types/operation-result.type.js +1 -0
- package/esm/document/data-type/extended-types/time.type.js +1 -0
- package/esm/document/data-type/extended-types/url.type.js +1 -0
- package/esm/document/data-type/extended-types/uuid.type.js +1 -0
- package/esm/document/data-type/mapped-type.js +21 -9
- package/esm/document/data-type/mixin-type.js +11 -6
- package/esm/document/data-type/primitive-types/any.type.js +1 -0
- package/esm/document/data-type/primitive-types/bigint.type.js +4 -1
- package/esm/document/data-type/primitive-types/boolean.type.js +1 -0
- package/esm/document/data-type/primitive-types/integer.type.js +4 -1
- package/esm/document/data-type/primitive-types/null.type.js +1 -0
- package/esm/document/data-type/primitive-types/number.type.js +4 -1
- package/esm/document/data-type/primitive-types/string.type.js +4 -1
- package/esm/document/data-type/simple-type.js +18 -6
- package/esm/document/data-type/utils/create-mapped-class.js +4 -2
- package/esm/document/decorators/api-field-decorator.js +2 -1
- package/esm/document/decorators/complex-type.decorator.js +2 -2
- package/esm/document/decorators/http-controller.decorator.js +7 -1
- package/esm/document/decorators/http-operation-entity.decorator.js +22 -12
- package/esm/document/decorators/http-operation.decorator.js +23 -10
- package/esm/document/decorators/rpc-operation.decorator.js +1 -2
- package/esm/document/decorators/simple-type.decorator.js +4 -3
- package/esm/document/factory/api-document.factory.js +12 -3
- package/esm/document/factory/data-type.factory.js +21 -9
- package/esm/document/factory/http-api.factory.js +13 -4
- package/esm/document/http/http-api.js +2 -2
- package/esm/document/http/http-controller.js +8 -7
- package/esm/document/http/http-media-type.js +18 -8
- package/esm/document/http/http-multipart-field.js +2 -2
- package/esm/document/http/http-operation-response.js +11 -6
- package/esm/document/http/http-operation.js +9 -7
- package/esm/document/http/http-parameter.js +3 -3
- package/esm/document/http/http-request-body.js +4 -2
- package/esm/document/http/http-status-range.js +3 -1
- package/esm/document/rpc/rpc-controller.js +1 -1
- package/esm/document/rpc/rpc-header.js +1 -1
- package/esm/document/rpc/rpc-operation-response.js +11 -3
- package/esm/document/rpc/rpc-operation.js +12 -4
- package/esm/document/utils/parse-regexp.util.js +2 -2
- package/esm/exception/opra-exception.js +3 -1
- package/esm/filter/antlr/OpraFilterLexer.js +190 -123
- package/esm/filter/antlr/OpraFilterParser.js +53 -35
- package/esm/filter/ast/expressions/arithmetic-expression.js +3 -1
- package/esm/filter/ast/terms/number-literal.js +3 -1
- package/esm/filter/filter-rules.js +18 -8
- package/esm/filter/filter-tree-visitor.js +2 -1
- package/esm/filter/opra-error-listener.js +8 -2
- package/esm/filter/parse.js +3 -1
- package/esm/filter/utils.js +3 -1
- package/esm/helpers/get-stack-filename.js +6 -2
- package/esm/helpers/mixin-utils.js +7 -2
- package/esm/helpers/object-utils.js +3 -1
- package/esm/helpers/parse-fields-projection.js +4 -2
- package/esm/helpers/type-guards.js +7 -2
- package/esm/i18n/i18n.js +13 -3
- package/esm/i18n/translate.js +3 -1
- package/esm/polifils/array-find-last.js +0 -2
- package/package.json +1 -1
- package/types/document/api-document.d.ts +8 -2
- package/types/document/common/api-base.d.ts +1 -1
- package/types/document/common/document-init-context.d.ts +2 -0
- package/types/document/common/document-node.d.ts +8 -14
- package/types/document/common/value.d.ts +2 -1
- package/types/document/constants.d.ts +0 -1
- package/types/document/data-type/api-field.d.ts +6 -11
- package/types/document/data-type/complex-type.d.ts +2 -1
- package/types/document/data-type/data-type.d.ts +7 -2
- package/types/document/data-type/enum-type.d.ts +2 -1
- package/types/document/data-type/extended-types/field-path.type.d.ts +2 -1
- package/types/document/data-type/extended-types/filter.type.d.ts +2 -1
- package/types/document/data-type/mapped-type.d.ts +2 -1
- package/types/document/data-type/mixin-type.d.ts +2 -1
- package/types/document/data-type/simple-type.d.ts +2 -1
- package/types/document/factory/api-document.factory.d.ts +2 -1
- package/types/document/http/http-api.d.ts +1 -1
- package/types/document/http/http-controller.d.ts +2 -1
- package/types/document/http/http-media-type.d.ts +2 -1
- package/types/document/http/http-multipart-field.d.ts +2 -1
- package/types/document/http/http-operation-response.d.ts +2 -1
- package/types/document/http/http-operation.d.ts +2 -1
- package/types/document/http/http-parameter.d.ts +2 -1
- package/types/document/http/http-request-body.d.ts +2 -1
- package/types/filter/filter-rules.d.ts +3 -3
|
@@ -29,11 +29,12 @@ export class FilterRules {
|
|
|
29
29
|
operators,
|
|
30
30
|
}));
|
|
31
31
|
}
|
|
32
|
-
normalizeFilter(filter, currentType) {
|
|
32
|
+
normalizeFilter(filter, currentType, element) {
|
|
33
33
|
const ast = typeof filter === 'string' ? parse(filter) : filter;
|
|
34
|
-
|
|
34
|
+
const doc = element?.node.getDocument();
|
|
35
|
+
return this.normalizeFilterAst(ast, [], currentType, doc?.scopes);
|
|
35
36
|
}
|
|
36
|
-
normalizeFilterAst(ast, stack, currentType) {
|
|
37
|
+
normalizeFilterAst(ast, stack, currentType, scopes) {
|
|
37
38
|
if (ast instanceof ComparisonExpression) {
|
|
38
39
|
stack.push(ast);
|
|
39
40
|
this.normalizeFilterAst(ast.left, stack, currentType);
|
|
@@ -45,7 +46,9 @@ export class FilterRules {
|
|
|
45
46
|
const rule = this._rules.get(ast.left.value);
|
|
46
47
|
if (!rule) {
|
|
47
48
|
throw new OpraException({
|
|
48
|
-
message: translate('error:UNACCEPTED_FILTER_FIELD', {
|
|
49
|
+
message: translate('error:UNACCEPTED_FILTER_FIELD', {
|
|
50
|
+
field: ast.left.value,
|
|
51
|
+
}),
|
|
49
52
|
code: 'UNACCEPTED_FILTER_FIELD',
|
|
50
53
|
details: {
|
|
51
54
|
field: ast.left.value,
|
|
@@ -55,7 +58,9 @@ export class FilterRules {
|
|
|
55
58
|
// Check if filtering endpoint accepted for given field
|
|
56
59
|
if (rule.operators && !rule.operators.includes(ast.op)) {
|
|
57
60
|
throw new OpraException({
|
|
58
|
-
message: translate('error:UNACCEPTED_FILTER_OPERATION', {
|
|
61
|
+
message: translate('error:UNACCEPTED_FILTER_OPERATION', {
|
|
62
|
+
field: ast.left.value,
|
|
63
|
+
}),
|
|
59
64
|
code: 'UNACCEPTED_FILTER_OPERATION',
|
|
60
65
|
details: {
|
|
61
66
|
field: ast.left.value,
|
|
@@ -105,20 +110,25 @@ export class FilterRules {
|
|
|
105
110
|
/** If calling for right side of comparison */
|
|
106
111
|
if (ast === comp.right || stack[compIdx + 1] === comp.right) {
|
|
107
112
|
/** Check if comparison expression left side is a field */
|
|
108
|
-
if (comp &&
|
|
113
|
+
if (comp &&
|
|
114
|
+
comp.left instanceof QualifiedIdentifier &&
|
|
115
|
+
comp.left.field) {
|
|
109
116
|
if (ast.value == null && !comp.left.field.required)
|
|
110
117
|
return ast.value;
|
|
111
118
|
let decoder;
|
|
112
|
-
if (comp.op === 'like' ||
|
|
119
|
+
if (comp.op === 'like' ||
|
|
120
|
+
comp.op === '!like' ||
|
|
121
|
+
comp.op === 'ilike' ||
|
|
122
|
+
comp.op === '!ilike') {
|
|
113
123
|
decoder = isString;
|
|
114
124
|
}
|
|
115
125
|
else
|
|
116
126
|
decoder = this._decoderCache.get(comp.left.field);
|
|
117
127
|
if (!decoder) {
|
|
118
128
|
decoder = comp.left.field.type.generateCodec('decode', {
|
|
129
|
+
scope: scopes,
|
|
119
130
|
projection: '*',
|
|
120
131
|
ignoreWriteonlyFields: true,
|
|
121
|
-
ignoreHiddenFields: true,
|
|
122
132
|
coerce: true,
|
|
123
133
|
});
|
|
124
134
|
this._decoderCache.set(comp.left.field, decoder);
|
|
@@ -42,7 +42,8 @@ export class FilterTreeVisitor extends ParseTreeVisitor {
|
|
|
42
42
|
const items = [];
|
|
43
43
|
const wrapChildren = (arr, op) => {
|
|
44
44
|
for (const c of arr) {
|
|
45
|
-
if (c instanceof LogicalExpressionContext &&
|
|
45
|
+
if (c instanceof LogicalExpressionContext &&
|
|
46
|
+
c.logicalOperator().getText() === op) {
|
|
46
47
|
wrapChildren(c.expression_list(), c.logicalOperator().getText());
|
|
47
48
|
continue;
|
|
48
49
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ErrorListener } from '@browsery/antlr4';
|
|
1
|
+
import { ErrorListener, } from '@browsery/antlr4';
|
|
2
2
|
import { FilterParseError } from './errors.js';
|
|
3
3
|
export class OpraErrorListener extends ErrorListener {
|
|
4
4
|
constructor(errors) {
|
|
@@ -6,6 +6,12 @@ export class OpraErrorListener extends ErrorListener {
|
|
|
6
6
|
this.errors = errors;
|
|
7
7
|
}
|
|
8
8
|
syntaxError(recognizer, offendingSymbol, line, column, msg, e) {
|
|
9
|
-
this.errors.push(new FilterParseError(msg, {
|
|
9
|
+
this.errors.push(new FilterParseError(msg, {
|
|
10
|
+
recognizer,
|
|
11
|
+
offendingSymbol,
|
|
12
|
+
line,
|
|
13
|
+
column,
|
|
14
|
+
e,
|
|
15
|
+
}));
|
|
10
16
|
}
|
|
11
17
|
}
|
package/esm/filter/parse.js
CHANGED
|
@@ -21,7 +21,9 @@ export function parse(text, visitor) {
|
|
|
21
21
|
const errMsgs = [];
|
|
22
22
|
for (const err of errors) {
|
|
23
23
|
errMsgs.push(err.message +
|
|
24
|
-
(text.includes('\n')
|
|
24
|
+
(text.includes('\n')
|
|
25
|
+
? ' at line: ' + err.line + ' column: ' + err.column
|
|
26
|
+
: ' at column: ' + err.column));
|
|
25
27
|
}
|
|
26
28
|
const e = new SyntaxError(errMsgs.join('\n'));
|
|
27
29
|
e.errors = errors;
|
package/esm/filter/utils.js
CHANGED
|
@@ -11,7 +11,9 @@ export function quoteFilterString(s) {
|
|
|
11
11
|
return "'" + escapeString(s).replace(quotesRegEx, "\\'") + "'";
|
|
12
12
|
}
|
|
13
13
|
export function unquoteFilterString(s) {
|
|
14
|
-
if (s &&
|
|
14
|
+
if (s &&
|
|
15
|
+
(s.startsWith("'") || s.startsWith('"')) &&
|
|
16
|
+
s.endsWith(s.charAt(0))) {
|
|
15
17
|
return unescapeString(s.substring(1, s.length - 1));
|
|
16
18
|
}
|
|
17
19
|
/* istanbul ignore next */
|
|
@@ -14,7 +14,9 @@ export function getStackFileName(position = 1) {
|
|
|
14
14
|
if (stack !== null && typeof stack === 'object') {
|
|
15
15
|
// stack[0] holds this file
|
|
16
16
|
// stack[1] holds where this function was called
|
|
17
|
-
const s = stack[position]
|
|
17
|
+
const s = stack[position]
|
|
18
|
+
? stack[position].getFileName()
|
|
19
|
+
: undefined;
|
|
18
20
|
const m = s ? PATH_PATTERN.exec(s) : undefined;
|
|
19
21
|
return m ? m[1] : '';
|
|
20
22
|
}
|
|
@@ -35,7 +37,9 @@ export function getErrorStack(position = 1) {
|
|
|
35
37
|
if (stack !== null && typeof stack === 'object') {
|
|
36
38
|
// stack[0] holds this file
|
|
37
39
|
// stack[1] holds where this function was called
|
|
38
|
-
const s = stack[position]
|
|
40
|
+
const s = stack[position]
|
|
41
|
+
? stack[position].getFileName()
|
|
42
|
+
: undefined;
|
|
39
43
|
const m = s ? PATH_PATTERN.exec(s) : undefined;
|
|
40
44
|
return m ? m[1] : '';
|
|
41
45
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export function mergePrototype(targetProto, baseProto, filter) {
|
|
2
2
|
for (const k of Object.getOwnPropertyNames(baseProto)) {
|
|
3
|
-
if (k === 'constructor' ||
|
|
3
|
+
if (k === 'constructor' ||
|
|
4
|
+
k === '__proto__' ||
|
|
5
|
+
k === 'toJSON' ||
|
|
6
|
+
k === 'toString' ||
|
|
7
|
+
(filter && !filter(k))) {
|
|
4
8
|
continue;
|
|
5
9
|
}
|
|
6
10
|
Object.defineProperty(targetProto, k, Object.getOwnPropertyDescriptor(baseProto, k) || Object.create(null));
|
|
@@ -14,7 +18,8 @@ isPropertyInherited = (key) => true) {
|
|
|
14
18
|
const tempInstance = new clazz();
|
|
15
19
|
const propertyNames = Object.getOwnPropertyNames(tempInstance);
|
|
16
20
|
propertyNames
|
|
17
|
-
.filter(propertyName => typeof tempInstance[propertyName] !== 'undefined' &&
|
|
21
|
+
.filter(propertyName => typeof tempInstance[propertyName] !== 'undefined' &&
|
|
22
|
+
typeof target[propertyName] === 'undefined')
|
|
18
23
|
.filter(propertyName => isPropertyInherited(propertyName))
|
|
19
24
|
.forEach(propertyName => {
|
|
20
25
|
target[propertyName] = tempInstance[propertyName];
|
|
@@ -7,7 +7,9 @@ export function cloneObject(obj, jsonOnly) {
|
|
|
7
7
|
ignoreUndefined: true,
|
|
8
8
|
filter(key, source) {
|
|
9
9
|
const v = source[key];
|
|
10
|
-
return !jsonOnly ||
|
|
10
|
+
return (!jsonOnly ||
|
|
11
|
+
(typeof v !== 'function' &&
|
|
12
|
+
(typeof v !== 'object' || isPlainObject(v) || Array.isArray(v))));
|
|
11
13
|
},
|
|
12
14
|
});
|
|
13
15
|
}
|
|
@@ -46,14 +46,16 @@ export function parse(input, target) {
|
|
|
46
46
|
if (!m)
|
|
47
47
|
throw new TypeError(`Invalid field path (${input})`);
|
|
48
48
|
const fieldName = m[2];
|
|
49
|
-
const treeItem = (target[fieldName] =
|
|
49
|
+
const treeItem = (target[fieldName] =
|
|
50
|
+
target[fieldName] || new FieldsProjection.Item());
|
|
50
51
|
if (m[1])
|
|
51
52
|
treeItem.sign = m[1];
|
|
52
53
|
if (i === fields.length - 1) {
|
|
53
54
|
delete treeItem.projection;
|
|
54
55
|
}
|
|
55
56
|
else {
|
|
56
|
-
target = treeItem.projection =
|
|
57
|
+
target = treeItem.projection =
|
|
58
|
+
treeItem.projection || new FieldsProjection();
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
}
|
|
@@ -2,7 +2,9 @@ export function isStream(x) {
|
|
|
2
2
|
return x !== null && typeof x === 'object' && typeof x.pipe === 'function';
|
|
3
3
|
}
|
|
4
4
|
export function isReadable(x) {
|
|
5
|
-
return isStream(x) &&
|
|
5
|
+
return (isStream(x) &&
|
|
6
|
+
typeof x._read === 'function' &&
|
|
7
|
+
typeof x._readableState === 'object');
|
|
6
8
|
}
|
|
7
9
|
export function isWritable(x) {
|
|
8
10
|
return isStream(x) && typeof x._write === 'function';
|
|
@@ -28,5 +30,8 @@ export function isFormData(x) {
|
|
|
28
30
|
typeof x.getAll === 'function');
|
|
29
31
|
}
|
|
30
32
|
export function isURL(x) {
|
|
31
|
-
return x !== null &&
|
|
33
|
+
return (x !== null &&
|
|
34
|
+
typeof x == 'object' &&
|
|
35
|
+
typeof x.host === 'string' &&
|
|
36
|
+
typeof x.href === 'string');
|
|
32
37
|
}
|
package/esm/i18n/i18n.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import i18next from '@browsery/i18next';
|
|
2
2
|
import { splitString, tokenize } from 'fast-tokenizer';
|
|
3
3
|
import { unescapeString } from './string-utils.js';
|
|
4
|
-
|
|
4
|
+
// eslint-disable-next-line import-x/no-named-as-default-member
|
|
5
|
+
export const BaseI18n = Object.getPrototypeOf(i18next.createInstance())
|
|
6
|
+
.constructor;
|
|
5
7
|
export class I18n extends BaseI18n {
|
|
6
8
|
async init(arg0, arg1) {
|
|
7
9
|
const options = typeof arg0 === 'object' ? arg0 : {};
|
|
@@ -62,12 +64,20 @@ export class I18n extends BaseI18n {
|
|
|
62
64
|
})) {
|
|
63
65
|
if (token.startsWith('$t(') && token.endsWith(')')) {
|
|
64
66
|
token = token.substring(3, token.length - 1);
|
|
65
|
-
const a = splitString(token, {
|
|
67
|
+
const a = splitString(token, {
|
|
68
|
+
delimiters: '?',
|
|
69
|
+
quotes: true,
|
|
70
|
+
brackets: { '{': '}' },
|
|
71
|
+
});
|
|
66
72
|
const fallback = unescapeString(token.substring((a[0] || '').length + 1));
|
|
67
73
|
token = a[0] || '';
|
|
68
74
|
const keys = [];
|
|
69
75
|
let opts = null;
|
|
70
|
-
for (const token2 of tokenize(token, {
|
|
76
|
+
for (const token2 of tokenize(token, {
|
|
77
|
+
delimiters: ',',
|
|
78
|
+
quotes: true,
|
|
79
|
+
brackets: { '{': '}' },
|
|
80
|
+
})) {
|
|
71
81
|
if (token2.startsWith('{')) {
|
|
72
82
|
opts = JSON.parse(token2);
|
|
73
83
|
continue;
|
package/esm/i18n/translate.js
CHANGED
|
@@ -6,6 +6,8 @@ export function translate(key, arg0, arg1) {
|
|
|
6
6
|
return ('$t(' +
|
|
7
7
|
key +
|
|
8
8
|
(options ? ',' + JSON.stringify(options) : '') +
|
|
9
|
-
(fallback
|
|
9
|
+
(fallback
|
|
10
|
+
? '?' + escapeString(fallback).replace(bracketRegEx, '\\$1')
|
|
11
|
+
: '') +
|
|
10
12
|
')');
|
|
11
13
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
if (!Array.prototype.findLast) {
|
|
2
|
-
// eslint-disable-next-line no-extend-native
|
|
3
2
|
Array.prototype.findLast = function (predicate, thisArg) {
|
|
4
3
|
const i = this.findLastIndex(predicate, thisArg);
|
|
5
4
|
return i >= 0 ? this[i] : undefined;
|
|
6
5
|
};
|
|
7
|
-
// eslint-disable-next-line no-extend-native
|
|
8
6
|
Array.prototype.findLastIndex = function (predicate, thisArg) {
|
|
9
7
|
if (this == null) {
|
|
10
8
|
throw new TypeError('this is null or not defined');
|
package/package.json
CHANGED
|
@@ -15,6 +15,7 @@ import { RpcApi } from './rpc/rpc-api.js';
|
|
|
15
15
|
export declare class ApiDocument extends DocumentElement {
|
|
16
16
|
protected [kTypeNSMap]: WeakMap<DataType, string>;
|
|
17
17
|
readonly id: string;
|
|
18
|
+
scopes?: string[];
|
|
18
19
|
url?: string;
|
|
19
20
|
info: OpraSchema.DocumentInfo;
|
|
20
21
|
references: ResponsiveMap<ApiDocument>;
|
|
@@ -33,7 +34,12 @@ export declare class ApiDocument extends DocumentElement {
|
|
|
33
34
|
/**
|
|
34
35
|
* Export as Opra schema definition object
|
|
35
36
|
*/
|
|
36
|
-
export(): OpraSchema.ApiDocument;
|
|
37
|
+
export(options?: ApiDocument.ExportOptions): OpraSchema.ApiDocument;
|
|
37
38
|
invalidate(): void;
|
|
38
|
-
protected _findDataType(nameOrCtor: string | Type | Function | EnumType.EnumArray | EnumType.EnumObject, visitedRefs?: WeakMap<ApiDocument, boolean>): DataType | undefined;
|
|
39
|
+
protected _findDataType(nameOrCtor: string | Type | Function | EnumType.EnumArray | EnumType.EnumObject, scope?: string | string[], visitedRefs?: WeakMap<ApiDocument, boolean>): DataType | undefined;
|
|
40
|
+
}
|
|
41
|
+
export declare namespace ApiDocument {
|
|
42
|
+
interface ExportOptions {
|
|
43
|
+
scopes?: string[];
|
|
44
|
+
}
|
|
39
45
|
}
|
|
@@ -13,6 +13,6 @@ export declare abstract class ApiBase extends DocumentElement {
|
|
|
13
13
|
name: string;
|
|
14
14
|
description?: string;
|
|
15
15
|
protected constructor(init: ApiBase.InitArguments);
|
|
16
|
-
toJSON(): OpraSchema.Api;
|
|
16
|
+
toJSON(options?: ApiDocument.ExportOptions): OpraSchema.Api;
|
|
17
17
|
protected _initialize(init: ApiBase.InitArguments, context: DocumentInitContext): Promise<void>;
|
|
18
18
|
}
|
|
@@ -2,6 +2,7 @@ import { OpraDocumentError } from './opra-document-error.js';
|
|
|
2
2
|
export declare namespace DocumentInitContext {
|
|
3
3
|
interface Options {
|
|
4
4
|
maxErrors?: number;
|
|
5
|
+
scopes?: string | string[];
|
|
5
6
|
}
|
|
6
7
|
}
|
|
7
8
|
export declare class DocumentInitContext {
|
|
@@ -9,6 +10,7 @@ export declare class DocumentInitContext {
|
|
|
9
10
|
error: OpraDocumentError;
|
|
10
11
|
maxErrors: number;
|
|
11
12
|
showErrorDetails: boolean;
|
|
13
|
+
scopes?: string[];
|
|
12
14
|
constructor(options?: DocumentInitContext.Options);
|
|
13
15
|
addError(error: Error | OpraDocumentError.ErrorDetail | string): void;
|
|
14
16
|
enter(path: string, fn: () => any): any;
|
|
@@ -19,47 +19,41 @@ export declare class DocumentNode {
|
|
|
19
19
|
readonly element: DocumentElement;
|
|
20
20
|
constructor(element: DocumentElement, parent?: DocumentNode);
|
|
21
21
|
getDocument(): ApiDocument;
|
|
22
|
-
hasDataType(nameOrCtor: string | Type | Function | object | any[]): boolean;
|
|
23
|
-
findDataType(nameOrCtor: string | Type | Function | object | any[]): DataType | undefined;
|
|
22
|
+
hasDataType(nameOrCtor: string | Type | Function | object | any[], scope?: string | string[]): boolean;
|
|
23
|
+
findDataType(nameOrCtor: string | Type | Function | object | any[], scope?: string | string[]): DataType | undefined;
|
|
24
24
|
/**
|
|
25
25
|
* Returns DataType instance by name or Constructor. Returns undefined if not found
|
|
26
|
-
* @param nameOrCtor
|
|
27
26
|
*/
|
|
28
|
-
getDataType(nameOrCtor: string | Type | Function | object | any[]): DataType;
|
|
27
|
+
getDataType(nameOrCtor: string | Type | Function | object | any[], scope?: string | string[]): DataType;
|
|
29
28
|
getDataTypeNameWithNs(dataType: DataType): string | undefined;
|
|
30
29
|
/**
|
|
31
30
|
* Returns ComplexType instance by name or Constructor.
|
|
32
31
|
* Returns undefined if not found
|
|
33
32
|
* Throws error if data type is not a ComplexType
|
|
34
|
-
* @param nameOrCtor
|
|
35
33
|
*/
|
|
36
|
-
getComplexType(nameOrCtor: string | Type | Function): ComplexType;
|
|
34
|
+
getComplexType(nameOrCtor: string | Type | Function, scope?: string | string[]): ComplexType;
|
|
37
35
|
/**
|
|
38
36
|
* Returns SimpleType instance by name or Constructor.
|
|
39
37
|
* Returns undefined if not found
|
|
40
38
|
* Throws error if data type is not a SimpleType
|
|
41
|
-
* @param nameOrCtor
|
|
42
39
|
*/
|
|
43
|
-
getSimpleType(nameOrCtor: string | Type): SimpleType;
|
|
40
|
+
getSimpleType(nameOrCtor: string | Type, scope?: string | string[]): SimpleType;
|
|
44
41
|
/**
|
|
45
42
|
* Returns EnumType instance by name or Constructor.
|
|
46
43
|
* Returns undefined if not found
|
|
47
44
|
* Throws error if data type is not a EnumType
|
|
48
|
-
* @param nameOrCtor
|
|
49
45
|
*/
|
|
50
|
-
getEnumType(nameOrCtor: string | object | any[]): EnumType;
|
|
46
|
+
getEnumType(nameOrCtor: string | object | any[], scope?: string | string[]): EnumType;
|
|
51
47
|
/**
|
|
52
48
|
* Returns EnumType instance by name or Constructor.
|
|
53
49
|
* Returns undefined if not found
|
|
54
50
|
* Throws error if data type is not a MappedType
|
|
55
|
-
* @param nameOrCtor
|
|
56
51
|
*/
|
|
57
|
-
getMappedType(nameOrCtor: string | object | any[]): MappedType;
|
|
52
|
+
getMappedType(nameOrCtor: string | object | any[], scope?: string | string[]): MappedType;
|
|
58
53
|
/**
|
|
59
54
|
* Returns EnumType instance by name or Constructor.
|
|
60
55
|
* Returns undefined if not found
|
|
61
56
|
* Throws error if data type is not a MixinType
|
|
62
|
-
* @param nameOrCtor
|
|
63
57
|
*/
|
|
64
|
-
getMixinType(nameOrCtor: string | object | any[]): MixinType;
|
|
58
|
+
getMixinType(nameOrCtor: string | object | any[], scope?: string | string[]): MixinType;
|
|
65
59
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Combine, StrictOmit, TypeThunkAsync } from 'ts-gems';
|
|
2
2
|
import type { OpraSchema } from '../../schema/index.js';
|
|
3
|
+
import type { ApiDocument } from '../api-document';
|
|
3
4
|
import { DataType } from '../data-type/data-type.js';
|
|
4
5
|
import type { EnumType } from '../data-type/enum-type.js';
|
|
5
6
|
import { DocumentElement } from './document-element.js';
|
|
@@ -43,6 +44,6 @@ declare class ValueClass extends DocumentElement {
|
|
|
43
44
|
description?: string;
|
|
44
45
|
examples?: any[] | Record<string, any>;
|
|
45
46
|
isArray?: boolean;
|
|
46
|
-
toJSON(): OpraSchema.Value;
|
|
47
|
+
toJSON(options?: ApiDocument.ExportOptions): OpraSchema.Value;
|
|
47
48
|
}
|
|
48
49
|
export {};
|
|
@@ -7,7 +7,6 @@ export declare const DECORATOR: unique symbol;
|
|
|
7
7
|
export declare const BUILTIN: unique symbol;
|
|
8
8
|
export declare const NAMESPACE_PATTERN: RegExp;
|
|
9
9
|
export declare const CLASS_NAME_PATTERN: RegExp;
|
|
10
|
-
export declare const EXTRACT_TYPENAME_PATTERN: RegExp;
|
|
11
10
|
export declare const kDataTypeMap: unique symbol;
|
|
12
11
|
export declare const kCtorMap: unique symbol;
|
|
13
12
|
export declare const kTypeNSMap: unique symbol;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Combine, TypeThunkAsync } from 'ts-gems';
|
|
2
2
|
import { OpraSchema } from '../../schema/index.js';
|
|
3
|
+
import type { ApiDocument } from '../api-document.js';
|
|
3
4
|
import { DocumentElement } from '../common/document-element.js';
|
|
4
5
|
import { ApiFieldDecorator } from '../decorators/api-field-decorator.js';
|
|
5
6
|
import type { ComplexType } from './complex-type.js';
|
|
@@ -14,19 +15,16 @@ export declare namespace ApiField {
|
|
|
14
15
|
interface Metadata extends Combine<{
|
|
15
16
|
type?: string | OpraSchema.DataType | TypeThunkAsync | EnumType.EnumObject | EnumType.EnumArray | object;
|
|
16
17
|
}, OpraSchema.Field> {
|
|
17
|
-
/**
|
|
18
|
-
* If set true, field will be available for server side only and
|
|
19
|
-
* will be removed while encoding to send to the client
|
|
20
|
-
*/
|
|
21
|
-
hidden?: boolean;
|
|
22
18
|
}
|
|
23
19
|
interface Options extends Partial<Metadata> {
|
|
20
|
+
scopes?: (string | RegExp)[];
|
|
24
21
|
}
|
|
25
22
|
interface InitArguments extends Combine<{
|
|
26
23
|
name: string;
|
|
27
24
|
origin?: ComplexType | MappedType | MixinType;
|
|
28
25
|
type?: DataType;
|
|
29
26
|
}, Metadata> {
|
|
27
|
+
scopes?: (string | RegExp)[];
|
|
30
28
|
}
|
|
31
29
|
}
|
|
32
30
|
/**
|
|
@@ -54,6 +52,7 @@ export declare const ApiField: ApiFieldConstructor;
|
|
|
54
52
|
declare class ApiFieldClass extends DocumentElement {
|
|
55
53
|
readonly owner: ComplexType | MappedType | MixinType;
|
|
56
54
|
readonly origin?: ComplexType | MappedType | MixinType;
|
|
55
|
+
readonly scopes?: (string | RegExp)[];
|
|
57
56
|
readonly name: string;
|
|
58
57
|
readonly type: DataType;
|
|
59
58
|
readonly description?: string;
|
|
@@ -68,11 +67,7 @@ declare class ApiFieldClass extends DocumentElement {
|
|
|
68
67
|
readonly readonly?: boolean;
|
|
69
68
|
readonly writeonly?: boolean;
|
|
70
69
|
readonly examples?: any[] | Record<string, any>;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
* will be removed while encoding to send to the client
|
|
74
|
-
*/
|
|
75
|
-
readonly hidden?: boolean;
|
|
76
|
-
toJSON(): OpraSchema.Field;
|
|
70
|
+
inScope(scopes?: string | string[]): boolean;
|
|
71
|
+
toJSON(options?: ApiDocument.ExportOptions): OpraSchema.Field;
|
|
77
72
|
}
|
|
78
73
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import type { Combine, Type, TypeThunkAsync } from 'ts-gems';
|
|
3
3
|
import { OpraSchema } from '../../schema/index.js';
|
|
4
|
+
import type { ApiDocument } from '../api-document.js';
|
|
4
5
|
import type { DocumentElement } from '../common/document-element.js';
|
|
5
6
|
import { DocumentInitContext } from '../common/document-init-context.js';
|
|
6
7
|
import { ApiField } from './api-field.js';
|
|
@@ -72,6 +73,6 @@ declare abstract class ComplexTypeClass extends ComplexTypeBase {
|
|
|
72
73
|
readonly base?: ComplexType | MappedType | MixinType;
|
|
73
74
|
readonly ctor?: Type;
|
|
74
75
|
extendsFrom(baseType: DataType | string | Type | object): boolean;
|
|
75
|
-
toJSON(): OpraSchema.ComplexType;
|
|
76
|
+
toJSON(options?: ApiDocument.ExportOptions): OpraSchema.ComplexType;
|
|
76
77
|
}
|
|
77
78
|
export {};
|
|
@@ -3,6 +3,7 @@ import type { ValidationOptions, Validator } from 'valgen';
|
|
|
3
3
|
import { FieldsProjection } from '../../helpers/index.js';
|
|
4
4
|
import type { DataTypeBase } from '../../schema/data-type/data-type.interface.js';
|
|
5
5
|
import { OpraSchema } from '../../schema/index.js';
|
|
6
|
+
import type { ApiDocument } from '../api-document.js';
|
|
6
7
|
import { DocumentElement } from '../common/document-element.js';
|
|
7
8
|
import { DocumentInitContext } from '../common/document-init-context.js';
|
|
8
9
|
import { nodeInspectCustom } from '../utils/inspect.util.js';
|
|
@@ -15,17 +16,19 @@ export declare namespace DataType {
|
|
|
15
16
|
}
|
|
16
17
|
interface Options extends Partial<StrictOmit<Metadata, 'kind' | 'examples'>> {
|
|
17
18
|
embedded?: boolean;
|
|
19
|
+
scopes?: (string | RegExp)[];
|
|
18
20
|
}
|
|
19
21
|
interface InitArguments extends DataType.Metadata {
|
|
22
|
+
scopes?: (string | RegExp)[];
|
|
20
23
|
}
|
|
21
24
|
interface GenerateCodecOptions extends ValidationOptions {
|
|
22
25
|
documentElement?: DocumentElement;
|
|
26
|
+
scope?: string | string[];
|
|
23
27
|
caseInSensitive?: boolean;
|
|
24
28
|
partial?: boolean | 'deep';
|
|
25
29
|
projection?: string[] | FieldsProjection | '*';
|
|
26
30
|
ignoreReadonlyFields?: boolean;
|
|
27
31
|
ignoreWriteonlyFields?: boolean;
|
|
28
|
-
ignoreHiddenFields?: boolean;
|
|
29
32
|
allowPatchOperators?: boolean;
|
|
30
33
|
}
|
|
31
34
|
}
|
|
@@ -50,6 +53,7 @@ export declare const DataType: DataTypeStatic;
|
|
|
50
53
|
declare abstract class DataTypeClass extends DocumentElement {
|
|
51
54
|
readonly kind: OpraSchema.DataType.Kind;
|
|
52
55
|
readonly owner: DocumentElement;
|
|
56
|
+
readonly scopes?: (string | RegExp)[];
|
|
53
57
|
readonly name?: string;
|
|
54
58
|
readonly description?: string;
|
|
55
59
|
readonly abstract?: boolean;
|
|
@@ -57,7 +61,8 @@ declare abstract class DataTypeClass extends DocumentElement {
|
|
|
57
61
|
abstract generateCodec(codec: 'encode' | 'decode', options?: DataType.GenerateCodecOptions): Validator;
|
|
58
62
|
get embedded(): any;
|
|
59
63
|
abstract extendsFrom(baseType: DataType | string | Type | object): boolean;
|
|
60
|
-
|
|
64
|
+
inScope(scopes?: string | string[]): boolean;
|
|
65
|
+
toJSON(options?: ApiDocument.ExportOptions): OpraSchema.DataType;
|
|
61
66
|
toString(): string;
|
|
62
67
|
[nodeInspectCustom](): string;
|
|
63
68
|
}
|
|
@@ -2,6 +2,7 @@ import 'reflect-metadata';
|
|
|
2
2
|
import { type Combine, type Type } from 'ts-gems';
|
|
3
3
|
import { type Validator } from 'valgen';
|
|
4
4
|
import { OpraSchema } from '../../schema/index.js';
|
|
5
|
+
import type { ApiDocument } from '../api-document.js';
|
|
5
6
|
import type { DocumentElement } from '../common/document-element.js';
|
|
6
7
|
import { DataType } from './data-type.js';
|
|
7
8
|
/**
|
|
@@ -65,6 +66,6 @@ declare class EnumTypeClass extends DataType {
|
|
|
65
66
|
readonly ownAttributes: Record<string | number, OpraSchema.EnumType.ValueInfo>;
|
|
66
67
|
extendsFrom(baseType: DataType | string | Type | object): boolean;
|
|
67
68
|
generateCodec(): Validator;
|
|
68
|
-
toJSON(): OpraSchema.EnumType;
|
|
69
|
+
toJSON(options?: ApiDocument.ExportOptions): OpraSchema.EnumType;
|
|
69
70
|
}
|
|
70
71
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Type } from 'ts-gems';
|
|
2
2
|
import { type Validator } from 'valgen';
|
|
3
|
+
import type { ApiDocument } from '../../api-document.js';
|
|
3
4
|
import { DocumentElement } from '../../common/document-element.js';
|
|
4
5
|
import { DECODER, ENCODER } from '../../constants.js';
|
|
5
6
|
export declare class FieldPathType {
|
|
@@ -8,7 +9,7 @@ export declare class FieldPathType {
|
|
|
8
9
|
allowSigns?: 'first' | 'each';
|
|
9
10
|
[DECODER](properties: Partial<this>, element: DocumentElement): Validator;
|
|
10
11
|
[ENCODER](properties: Partial<this>, element: DocumentElement): Validator;
|
|
11
|
-
toJSON(properties: Partial<FieldPathType>, element: DocumentElement): {
|
|
12
|
+
toJSON(properties: Partial<FieldPathType>, element: DocumentElement, options?: ApiDocument.ExportOptions): {
|
|
12
13
|
dataType: string | import("../../../schema/opra-schema.js").ComplexType;
|
|
13
14
|
allowSigns: "first" | "each" | undefined;
|
|
14
15
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Type } from 'ts-gems';
|
|
2
2
|
import { type Validator } from 'valgen';
|
|
3
3
|
import { FilterRules } from '../../../filter/filter-rules.js';
|
|
4
|
+
import type { ApiDocument } from '../../api-document.js';
|
|
4
5
|
import type { DocumentElement } from '../../common/document-element.js';
|
|
5
6
|
import { DECODER, ENCODER } from '../../constants.js';
|
|
6
7
|
export declare class FilterType {
|
|
@@ -9,7 +10,7 @@ export declare class FilterType {
|
|
|
9
10
|
rules?: Record<string, FilterRules.Rule>;
|
|
10
11
|
protected [DECODER](properties: Partial<this>, element: DocumentElement): Validator;
|
|
11
12
|
protected [ENCODER](): Validator;
|
|
12
|
-
toJSON(properties: Partial<FilterType>, element: DocumentElement): {
|
|
13
|
+
toJSON(properties: Partial<FilterType>, element: DocumentElement, options?: ApiDocument.ExportOptions): {
|
|
13
14
|
dataType: string | import("../../../schema/opra-schema.js").ComplexType;
|
|
14
15
|
rules: Record<string, FilterRules.Rule> | undefined;
|
|
15
16
|
};
|
|
@@ -2,6 +2,7 @@ import 'reflect-metadata';
|
|
|
2
2
|
import { type Combine, type Type } from 'ts-gems';
|
|
3
3
|
import type { Field } from '../../schema/data-type/field.interface.js';
|
|
4
4
|
import { OpraSchema } from '../../schema/index.js';
|
|
5
|
+
import type { ApiDocument } from '../api-document.js';
|
|
5
6
|
import { DocumentElement } from '../common/document-element.js';
|
|
6
7
|
import type { ComplexType } from './complex-type.js';
|
|
7
8
|
import { ComplexTypeBase } from './complex-type-base.js';
|
|
@@ -68,6 +69,6 @@ declare class MappedTypeClass extends ComplexTypeBase {
|
|
|
68
69
|
readonly partial?: Field.Name[] | boolean;
|
|
69
70
|
readonly required?: Field.Name[] | boolean;
|
|
70
71
|
extendsFrom(baseType: DataType | string | Type | object): boolean;
|
|
71
|
-
toJSON(): OpraSchema.MappedType;
|
|
72
|
+
toJSON(options?: ApiDocument.ExportOptions): OpraSchema.MappedType;
|
|
72
73
|
}
|
|
73
74
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import type { Class, Combine, Type } from 'ts-gems';
|
|
3
3
|
import { OpraSchema } from '../../schema/index.js';
|
|
4
|
+
import type { ApiDocument } from '../api-document.js';
|
|
4
5
|
import type { DocumentElement } from '../common/document-element.js';
|
|
5
6
|
import type { ComplexType } from './complex-type.js';
|
|
6
7
|
import { ComplexTypeBase } from './complex-type-base.js';
|
|
@@ -77,6 +78,6 @@ declare class MixinTypeClass extends ComplexTypeBase {
|
|
|
77
78
|
readonly kind: OpraSchema.MixinType.Kind;
|
|
78
79
|
readonly types: (ComplexType | MixinType | MappedType)[];
|
|
79
80
|
extendsFrom(baseType: DataType | string | Type | object): boolean;
|
|
80
|
-
toJSON(): OpraSchema.MixinType;
|
|
81
|
+
toJSON(options?: ApiDocument.ExportOptions): OpraSchema.MixinType;
|
|
81
82
|
}
|
|
82
83
|
export {};
|
|
@@ -2,6 +2,7 @@ import 'reflect-metadata';
|
|
|
2
2
|
import type { Combine, Type } from 'ts-gems';
|
|
3
3
|
import { type Validator } from 'valgen';
|
|
4
4
|
import { OpraSchema } from '../../schema/index.js';
|
|
5
|
+
import type { ApiDocument } from '../api-document.js';
|
|
5
6
|
import type { DocumentElement } from '../common/document-element';
|
|
6
7
|
import { DocumentInitContext } from '../common/document-init-context.js';
|
|
7
8
|
import { AttributeDecoratorFactory, SimpleTypeDecoratorFactory } from '../decorators/simple-type.decorator.js';
|
|
@@ -72,6 +73,6 @@ declare abstract class SimpleTypeClass extends DataType {
|
|
|
72
73
|
properties?: any;
|
|
73
74
|
extendsFrom(baseType: DataType | string | Type | object): boolean;
|
|
74
75
|
generateCodec<T extends Record<string, any> | object = object>(codec: 'encode' | 'decode', options?: DataType.GenerateCodecOptions | null, properties?: Partial<T>): Validator;
|
|
75
|
-
toJSON(): OpraSchema.SimpleType;
|
|
76
|
+
toJSON(options?: ApiDocument.ExportOptions): OpraSchema.SimpleType;
|
|
76
77
|
}
|
|
77
78
|
export {};
|