@opra/common 1.5.3 → 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.
@@ -28,7 +28,11 @@ exports.ApiField = function (...args) {
28
28
  throw new Error('Field origin should be one of ComplexType, MappedType or MixinType');
29
29
  }
30
30
  _this.origin = origin;
31
- _this.scopePattern = initArgs.scopePattern;
31
+ _this.scopePattern = initArgs.scopePattern
32
+ ? Array.isArray(initArgs.scopePattern)
33
+ ? initArgs.scopePattern
34
+ : [initArgs.scopePattern]
35
+ : undefined;
32
36
  _this.type = initArgs.type || owner.node.getDataType('any');
33
37
  _this.description = initArgs.description;
34
38
  _this.isArray = initArgs.isArray;
@@ -21,7 +21,11 @@ context) {
21
21
  document_element_js_1.DocumentElement.call(this, owner);
22
22
  const _this = (0, ts_gems_1.asMutable)(this);
23
23
  _this.kind = initArgs.kind;
24
- _this.scopePattern = initArgs.scopePattern;
24
+ _this.scopePattern = initArgs.scopePattern
25
+ ? Array.isArray(initArgs.scopePattern)
26
+ ? initArgs.scopePattern
27
+ : [initArgs.scopePattern]
28
+ : undefined;
25
29
  _this.name = initArgs.name;
26
30
  _this.description = initArgs.description;
27
31
  _this.abstract = initArgs.abstract;
@@ -20,11 +20,6 @@ function ApiFieldDecoratorFactory(options) {
20
20
  const designType = Reflect.getMetadata('design:type', target, propertyKey);
21
21
  const elemMeta = (metadata.fields[propertyKey] = {
22
22
  ...options,
23
- scopePattern: options?.scopePattern
24
- ? Array.isArray(options.scopePattern)
25
- ? options.scopePattern
26
- : [options.scopePattern]
27
- : undefined,
28
23
  });
29
24
  if (designType === Array) {
30
25
  elemMeta.isArray = true;
@@ -25,7 +25,11 @@ export const ApiField = function (...args) {
25
25
  throw new Error('Field origin should be one of ComplexType, MappedType or MixinType');
26
26
  }
27
27
  _this.origin = origin;
28
- _this.scopePattern = initArgs.scopePattern;
28
+ _this.scopePattern = initArgs.scopePattern
29
+ ? Array.isArray(initArgs.scopePattern)
30
+ ? initArgs.scopePattern
31
+ : [initArgs.scopePattern]
32
+ : undefined;
29
33
  _this.type = initArgs.type || owner.node.getDataType('any');
30
34
  _this.description = initArgs.description;
31
35
  _this.isArray = initArgs.isArray;
@@ -18,7 +18,11 @@ context) {
18
18
  DocumentElement.call(this, owner);
19
19
  const _this = asMutable(this);
20
20
  _this.kind = initArgs.kind;
21
- _this.scopePattern = initArgs.scopePattern;
21
+ _this.scopePattern = initArgs.scopePattern
22
+ ? Array.isArray(initArgs.scopePattern)
23
+ ? initArgs.scopePattern
24
+ : [initArgs.scopePattern]
25
+ : undefined;
22
26
  _this.name = initArgs.name;
23
27
  _this.description = initArgs.description;
24
28
  _this.abstract = initArgs.abstract;
@@ -17,11 +17,6 @@ export function ApiFieldDecoratorFactory(options) {
17
17
  const designType = Reflect.getMetadata('design:type', target, propertyKey);
18
18
  const elemMeta = (metadata.fields[propertyKey] = {
19
19
  ...options,
20
- scopePattern: options?.scopePattern
21
- ? Array.isArray(options.scopePattern)
22
- ? options.scopePattern
23
- : [options.scopePattern]
24
- : undefined,
25
20
  });
26
21
  if (designType === Array) {
27
22
  elemMeta.isArray = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/common",
3
- "version": "1.5.3",
3
+ "version": "1.5.4",
4
4
  "description": "Opra common package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -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 {};
@@ -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;