@opra/common 1.5.2 → 1.5.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/browser/index.cjs +4 -4
- package/browser/index.mjs +4 -4
- package/cjs/document/api-document.js +2 -2
- package/cjs/document/common/document-node.js +2 -2
- package/cjs/document/data-type/api-field.js +5 -1
- package/cjs/document/data-type/complex-type-base.js +84 -9
- package/cjs/document/data-type/complex-type.js +6 -7
- package/cjs/document/data-type/data-type.js +10 -8
- package/cjs/document/data-type/mapped-type.js +2 -2
- package/cjs/document/data-type/mixin-type.js +2 -2
- package/cjs/document/data-type/simple-type.js +8 -0
- package/cjs/document/decorators/api-field-decorator.js +0 -5
- package/cjs/document/utils/test-scope-match.js +3 -1
- package/esm/document/api-document.js +2 -2
- package/esm/document/common/document-node.js +2 -2
- package/esm/document/data-type/api-field.js +5 -1
- package/esm/document/data-type/complex-type-base.js +84 -9
- package/esm/document/data-type/complex-type.js +6 -7
- package/esm/document/data-type/data-type.js +10 -8
- package/esm/document/data-type/mapped-type.js +2 -2
- package/esm/document/data-type/mixin-type.js +2 -2
- package/esm/document/data-type/simple-type.js +8 -0
- package/esm/document/decorators/api-field-decorator.js +0 -5
- package/esm/document/utils/test-scope-match.js +3 -1
- package/package.json +1 -1
- package/types/document/data-type/api-field.d.ts +2 -3
- package/types/document/data-type/complex-type-base.d.ts +5 -1
- package/types/document/data-type/data-type.d.ts +2 -2
- package/types/document/data-type/simple-type.d.ts +1 -0
- package/types/document/utils/test-scope-match.d.ts +1 -1
|
@@ -52,7 +52,7 @@ declare class ApiFieldClass extends DocumentElement {
|
|
|
52
52
|
readonly readonly?: boolean;
|
|
53
53
|
readonly writeonly?: boolean;
|
|
54
54
|
readonly examples?: any[] | Record<string, any>;
|
|
55
|
-
inScope(scope
|
|
55
|
+
inScope(scope?: string): boolean;
|
|
56
56
|
toJSON(options?: ApiDocument.ExportOptions): OpraSchema.Field;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
@@ -62,7 +62,7 @@ export declare namespace ApiField {
|
|
|
62
62
|
interface Metadata extends Combine<{
|
|
63
63
|
type?: string | OpraSchema.DataType | TypeThunkAsync | EnumType.EnumObject | EnumType.EnumArray | object;
|
|
64
64
|
}, OpraSchema.Field> {
|
|
65
|
-
scopePattern?: (string | RegExp)[];
|
|
65
|
+
scopePattern?: (string | RegExp) | (string | RegExp)[];
|
|
66
66
|
overrides?: StrictOmit<Metadata, 'overrides' | 'type' | 'isArray'>[];
|
|
67
67
|
}
|
|
68
68
|
interface Options extends Partial<StrictOmit<Metadata, 'overrides' | 'scopePattern'>> {
|
|
@@ -80,7 +80,6 @@ export declare namespace ApiField {
|
|
|
80
80
|
origin?: ComplexType | MappedType | MixinType;
|
|
81
81
|
type?: DataType;
|
|
82
82
|
}, Metadata> {
|
|
83
|
-
scopePattern?: (string | RegExp)[];
|
|
84
83
|
}
|
|
85
84
|
}
|
|
86
85
|
export {};
|
|
@@ -40,9 +40,13 @@ export declare const ComplexTypeBase: ComplexTypeBaseStatic;
|
|
|
40
40
|
*/
|
|
41
41
|
declare abstract class ComplexTypeBaseClass extends DataType {
|
|
42
42
|
readonly ctor?: Type;
|
|
43
|
-
|
|
43
|
+
protected _fields: ResponsiveMap<ApiField>;
|
|
44
44
|
readonly additionalFields?: boolean | DataType | ['error'] | ['error', string];
|
|
45
45
|
readonly keyField?: OpraSchema.Field.Name;
|
|
46
|
+
fieldCount(scope?: string): number;
|
|
47
|
+
fieldEntries(scope?: string): IterableIterator<[string, ApiField]>;
|
|
48
|
+
fields(scope?: string): IterableIterator<ApiField>;
|
|
49
|
+
fieldNames(scope?: string): IterableIterator<string>;
|
|
46
50
|
/**
|
|
47
51
|
*
|
|
48
52
|
*/
|
|
@@ -19,7 +19,7 @@ export declare namespace DataType {
|
|
|
19
19
|
scopePattern?: (string | RegExp) | (string | RegExp)[];
|
|
20
20
|
}
|
|
21
21
|
interface InitArguments extends DataType.Metadata {
|
|
22
|
-
scopePattern?: (string | RegExp)[];
|
|
22
|
+
scopePattern?: (string | RegExp) | (string | RegExp)[];
|
|
23
23
|
}
|
|
24
24
|
interface GenerateCodecOptions extends ValidationOptions {
|
|
25
25
|
documentElement?: DocumentElement;
|
|
@@ -61,7 +61,7 @@ declare abstract class DataTypeClass extends DocumentElement {
|
|
|
61
61
|
abstract generateCodec(codec: 'encode' | 'decode', options?: DataType.GenerateCodecOptions): Validator;
|
|
62
62
|
get embedded(): any;
|
|
63
63
|
abstract extendsFrom(baseType: DataType | string | Type | object): boolean;
|
|
64
|
-
inScope(scope
|
|
64
|
+
inScope(scope?: string): boolean;
|
|
65
65
|
toJSON(options?: ApiDocument.ExportOptions): OpraSchema.DataType;
|
|
66
66
|
toString(): string;
|
|
67
67
|
protected abstract _locateBase(callback: (base: DataType) => boolean): DataType | undefined;
|
|
@@ -74,5 +74,6 @@ declare abstract class SimpleTypeClass extends DataType {
|
|
|
74
74
|
extendsFrom(baseType: DataType | string | Type | object): boolean;
|
|
75
75
|
generateCodec<T extends Record<string, any> | object = object>(codec: 'encode' | 'decode', options?: DataType.GenerateCodecOptions | null, properties?: Partial<T>): Validator;
|
|
76
76
|
toJSON(options?: ApiDocument.ExportOptions): OpraSchema.SimpleType;
|
|
77
|
+
protected _locateBase(callback: (base: SimpleType) => boolean): SimpleType | undefined;
|
|
77
78
|
}
|
|
78
79
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function testScopeMatch(scope
|
|
1
|
+
export declare function testScopeMatch(scope?: string, pattern?: (string | RegExp) | (string | RegExp)[]): boolean;
|