@opra/common 0.33.8 → 0.33.9

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.js CHANGED
@@ -29,7 +29,7 @@ import promisify from "putil-promisify";
29
29
 
30
30
  // ../../build/common/esm/helpers/type-guards.js
31
31
  function isConstructor(fn) {
32
- return typeof fn === "function" && fn.prototype && fn.prototype.constructor === fn && fn.prototype.constructor.name !== "Function" && fn.prototype.constructor.name !== "anonymous";
32
+ return typeof fn === "function" && fn.prototype && fn.prototype.constructor === fn && fn.prototype.constructor.name !== "Function" && fn.prototype.constructor.name !== "embedded";
33
33
  }
34
34
  __name(isConstructor, "isConstructor");
35
35
  function isStream(stream) {
@@ -1746,7 +1746,7 @@ var DataType = class _DataType {
1746
1746
  this.own = {};
1747
1747
  this.description = init?.description;
1748
1748
  if (!this.name)
1749
- this.isAnonymous = true;
1749
+ this.isEmbedded = true;
1750
1750
  }
1751
1751
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
1752
1752
  exportSchema(options) {
@@ -1766,7 +1766,7 @@ var DataType = class _DataType {
1766
1766
  return false;
1767
1767
  }
1768
1768
  toString() {
1769
- return `[${Object.getPrototypeOf(this).constructor.name} ${this.name || "#anonymous"}]`;
1769
+ return `[${Object.getPrototypeOf(this).constructor.name} ${this.name || "#Embedded"}]`;
1770
1770
  }
1771
1771
  [nodeInspectCustom3]() {
1772
1772
  return `[${colorFgYellow + Object.getPrototypeOf(this).constructor.name + colorReset} ${colorFgMagenta + this.name + colorReset}]`;
@@ -1888,7 +1888,7 @@ var Action = class extends Endpoint {
1888
1888
  exportSchema(options) {
1889
1889
  const schema = super.exportSchema(options);
1890
1890
  if (this.returnType)
1891
- schema.returnType = this.returnType.isAnonymous ? this.returnType.exportSchema(options) : this.returnType.name;
1891
+ schema.returnType = this.returnType.isEmbedded ? this.returnType.exportSchema(options) : this.returnType.name;
1892
1892
  if (this.returnMime)
1893
1893
  schema.returnMime = this.returnMime;
1894
1894
  return schema;
@@ -1942,7 +1942,7 @@ var Resource = class _Resource {
1942
1942
  return schema;
1943
1943
  }
1944
1944
  toString() {
1945
- return `[${Object.getPrototypeOf(this).constructor.name} ${this.name || "#anonymous"}]`;
1945
+ return `[${Object.getPrototypeOf(this).constructor.name} ${this.name || "#Embedded"}]`;
1946
1946
  }
1947
1947
  [nodeInspectCustom3]() {
1948
1948
  return `[${colorFgYellow + Object.getPrototypeOf(this).constructor.name + colorReset} ${colorFgMagenta + this.name + colorReset}]`;
@@ -2175,9 +2175,9 @@ var FieldClass = class {
2175
2175
  this.partialUpdate = init.partialUpdate;
2176
2176
  }
2177
2177
  exportSchema(options) {
2178
- const isAnonymous = !this.type?.name || this.type?.kind === "ComplexType" && this.type.isAnonymous;
2178
+ const isEmbedded = !this.type?.name || this.type?.kind === "ComplexType" && this.type.isEmbedded;
2179
2179
  return omitUndefined({
2180
- type: this.type ? isAnonymous ? this.type.exportSchema(options) : this.type.name : void 0,
2180
+ type: this.type ? isEmbedded ? this.type.exportSchema(options) : this.type.name : void 0,
2181
2181
  description: this.description,
2182
2182
  isArray: this.isArray,
2183
2183
  default: this.default,
@@ -2263,14 +2263,14 @@ var ComplexTypeClass = class extends DataType {
2263
2263
  own.ctor = own.ctor || init.base.ctor;
2264
2264
  }
2265
2265
  own.additionalFields = init?.additionalFields;
2266
- own.anonymous = init?.anonymous;
2266
+ own.embedded = init?.embedded;
2267
2267
  own.fields = new ResponsiveMap();
2268
2268
  this.kind = opra_schema_ns_exports.ComplexType.Kind;
2269
2269
  this.base = init?.base;
2270
2270
  this.ctor = own.ctor || Object;
2271
2271
  this.abstract = init.abstract;
2272
2272
  this.additionalFields = own.additionalFields;
2273
- this.isAnonymous = this.isAnonymous || init.anonymous;
2273
+ this.isEmbedded = this.isEmbedded || init.embedded;
2274
2274
  if (this.base?.additionalFields === true && this.additionalFields !== true)
2275
2275
  this.additionalFields = true;
2276
2276
  else if (this.base?.additionalFields === "error" && !this.additionalFields)
@@ -3514,7 +3514,7 @@ var TypeDocumentFactory = class _TypeDocumentFactory {
3514
3514
  return dataType;
3515
3515
  throw new TypeError(`Class "${thunk.name}" doesn't have a valid DataType metadata`);
3516
3516
  }
3517
- name = metadata.anonymous ? void 0 : metadata.name;
3517
+ name = metadata.embedded ? void 0 : metadata.name;
3518
3518
  initArguments = cloneObject(metadata);
3519
3519
  ctor = thunk;
3520
3520
  } else if (typeof thunk === "object") {
@@ -3526,7 +3526,7 @@ var TypeDocumentFactory = class _TypeDocumentFactory {
3526
3526
  const metadata = thunk[DATATYPE_METADATA];
3527
3527
  if (!metadata)
3528
3528
  throw new TypeError(`No EnumType metadata found for object ${JSON.stringify(thunk).substring(0, 20)}...`);
3529
- name = metadata.anonymous ? void 0 : metadata.name;
3529
+ name = metadata.embedded ? void 0 : metadata.name;
3530
3530
  initArguments = cloneObject(metadata);
3531
3531
  initArguments.enumObject = thunk;
3532
3532
  }
@@ -24,14 +24,14 @@ class ComplexTypeClass extends data_type_js_1.DataType {
24
24
  own.ctor = own.ctor || init.base.ctor;
25
25
  }
26
26
  own.additionalFields = init?.additionalFields;
27
- own.anonymous = init?.anonymous;
27
+ own.embedded = init?.embedded;
28
28
  own.fields = new index_js_1.ResponsiveMap();
29
29
  this.kind = index_js_3.OpraSchema.ComplexType.Kind;
30
30
  this.base = init?.base;
31
31
  this.ctor = own.ctor || Object;
32
32
  this.abstract = init.abstract;
33
33
  this.additionalFields = own.additionalFields;
34
- this.isAnonymous = this.isAnonymous || init.anonymous;
34
+ this.isEmbedded = this.isEmbedded || init.embedded;
35
35
  if (this.base?.additionalFields === true && this.additionalFields !== true)
36
36
  this.additionalFields = true;
37
37
  else if (this.base?.additionalFields === 'error' && !this.additionalFields)
@@ -14,7 +14,7 @@ class DataType {
14
14
  this.own = {};
15
15
  this.description = init?.description;
16
16
  if (!this.name)
17
- this.isAnonymous = true;
17
+ this.isEmbedded = true;
18
18
  }
19
19
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
20
20
  exportSchema(options) {
@@ -34,7 +34,7 @@ class DataType {
34
34
  return false;
35
35
  }
36
36
  toString() {
37
- return `[${Object.getPrototypeOf(this).constructor.name} ${this.name || '#anonymous'}]`;
37
+ return `[${Object.getPrototypeOf(this).constructor.name} ${this.name || '#Embedded'}]`;
38
38
  }
39
39
  [inspect_util_js_1.nodeInspectCustom]() {
40
40
  return `[${inspect_util_js_1.colorFgYellow + Object.getPrototypeOf(this).constructor.name + inspect_util_js_1.colorReset}` +
@@ -26,11 +26,11 @@ class FieldClass {
26
26
  this.partialUpdate = init.partialUpdate;
27
27
  }
28
28
  exportSchema(options) {
29
- const isAnonymous = !this.type?.name ||
30
- (this.type?.kind === 'ComplexType' && this.type.isAnonymous);
29
+ const isEmbedded = !this.type?.name ||
30
+ (this.type?.kind === 'ComplexType' && this.type.isEmbedded);
31
31
  return (0, index_js_1.omitUndefined)({
32
32
  type: this.type
33
- ? (isAnonymous ? this.type.exportSchema(options) : this.type.name)
33
+ ? (isEmbedded ? this.type.exportSchema(options) : this.type.name)
34
34
  : undefined,
35
35
  description: this.description,
36
36
  isArray: this.isArray,
@@ -143,7 +143,7 @@ class TypeDocumentFactory {
143
143
  return dataType;
144
144
  throw new TypeError(`Class "${thunk.name}" doesn't have a valid DataType metadata`);
145
145
  }
146
- name = metadata.anonymous ? undefined : metadata.name;
146
+ name = metadata.embedded ? undefined : metadata.name;
147
147
  initArguments = (0, index_js_1.cloneObject)(metadata);
148
148
  ctor = thunk;
149
149
  }
@@ -158,7 +158,7 @@ class TypeDocumentFactory {
158
158
  const metadata = thunk[constants_js_1.DATATYPE_METADATA];
159
159
  if (!metadata)
160
160
  throw new TypeError(`No EnumType metadata found for object ${JSON.stringify(thunk).substring(0, 20)}...`);
161
- name = metadata.anonymous ? undefined : metadata.name;
161
+ name = metadata.embedded ? undefined : metadata.name;
162
162
  initArguments = (0, index_js_1.cloneObject)(metadata);
163
163
  initArguments.enumObject = thunk;
164
164
  }
@@ -23,7 +23,7 @@ class Action extends endpoint_js_1.Endpoint {
23
23
  exportSchema(options) {
24
24
  const schema = super.exportSchema(options);
25
25
  if (this.returnType)
26
- schema.returnType = this.returnType.isAnonymous
26
+ schema.returnType = this.returnType.isEmbedded
27
27
  ? this.returnType.exportSchema(options)
28
28
  : this.returnType.name;
29
29
  if (this.returnMime)
@@ -50,7 +50,7 @@ class Resource {
50
50
  return schema;
51
51
  }
52
52
  toString() {
53
- return `[${Object.getPrototypeOf(this).constructor.name} ${this.name || '#anonymous'}]`;
53
+ return `[${Object.getPrototypeOf(this).constructor.name} ${this.name || '#Embedded'}]`;
54
54
  }
55
55
  [inspect_util_js_1.nodeInspectCustom]() {
56
56
  return `[${inspect_util_js_1.colorFgYellow + Object.getPrototypeOf(this).constructor.name + inspect_util_js_1.colorReset}` +
@@ -5,7 +5,7 @@ function isConstructor(fn) {
5
5
  return typeof fn === 'function' && fn.prototype &&
6
6
  fn.prototype.constructor === fn &&
7
7
  fn.prototype.constructor.name !== 'Function' &&
8
- fn.prototype.constructor.name !== 'anonymous';
8
+ fn.prototype.constructor.name !== 'embedded';
9
9
  }
10
10
  exports.isConstructor = isConstructor;
11
11
  function isStream(stream) {
@@ -21,14 +21,14 @@ export class ComplexTypeClass extends DataType {
21
21
  own.ctor = own.ctor || init.base.ctor;
22
22
  }
23
23
  own.additionalFields = init?.additionalFields;
24
- own.anonymous = init?.anonymous;
24
+ own.embedded = init?.embedded;
25
25
  own.fields = new ResponsiveMap();
26
26
  this.kind = OpraSchema.ComplexType.Kind;
27
27
  this.base = init?.base;
28
28
  this.ctor = own.ctor || Object;
29
29
  this.abstract = init.abstract;
30
30
  this.additionalFields = own.additionalFields;
31
- this.isAnonymous = this.isAnonymous || init.anonymous;
31
+ this.isEmbedded = this.isEmbedded || init.embedded;
32
32
  if (this.base?.additionalFields === true && this.additionalFields !== true)
33
33
  this.additionalFields = true;
34
34
  else if (this.base?.additionalFields === 'error' && !this.additionalFields)
@@ -11,7 +11,7 @@ export class DataType {
11
11
  this.own = {};
12
12
  this.description = init?.description;
13
13
  if (!this.name)
14
- this.isAnonymous = true;
14
+ this.isEmbedded = true;
15
15
  }
16
16
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
17
17
  exportSchema(options) {
@@ -31,7 +31,7 @@ export class DataType {
31
31
  return false;
32
32
  }
33
33
  toString() {
34
- return `[${Object.getPrototypeOf(this).constructor.name} ${this.name || '#anonymous'}]`;
34
+ return `[${Object.getPrototypeOf(this).constructor.name} ${this.name || '#Embedded'}]`;
35
35
  }
36
36
  [nodeInspectCustom]() {
37
37
  return `[${colorFgYellow + Object.getPrototypeOf(this).constructor.name + colorReset}` +
@@ -23,11 +23,11 @@ export class FieldClass {
23
23
  this.partialUpdate = init.partialUpdate;
24
24
  }
25
25
  exportSchema(options) {
26
- const isAnonymous = !this.type?.name ||
27
- (this.type?.kind === 'ComplexType' && this.type.isAnonymous);
26
+ const isEmbedded = !this.type?.name ||
27
+ (this.type?.kind === 'ComplexType' && this.type.isEmbedded);
28
28
  return omitUndefined({
29
29
  type: this.type
30
- ? (isAnonymous ? this.type.exportSchema(options) : this.type.name)
30
+ ? (isEmbedded ? this.type.exportSchema(options) : this.type.name)
31
31
  : undefined,
32
32
  description: this.description,
33
33
  isArray: this.isArray,
@@ -140,7 +140,7 @@ export class TypeDocumentFactory {
140
140
  return dataType;
141
141
  throw new TypeError(`Class "${thunk.name}" doesn't have a valid DataType metadata`);
142
142
  }
143
- name = metadata.anonymous ? undefined : metadata.name;
143
+ name = metadata.embedded ? undefined : metadata.name;
144
144
  initArguments = cloneObject(metadata);
145
145
  ctor = thunk;
146
146
  }
@@ -155,7 +155,7 @@ export class TypeDocumentFactory {
155
155
  const metadata = thunk[DATATYPE_METADATA];
156
156
  if (!metadata)
157
157
  throw new TypeError(`No EnumType metadata found for object ${JSON.stringify(thunk).substring(0, 20)}...`);
158
- name = metadata.anonymous ? undefined : metadata.name;
158
+ name = metadata.embedded ? undefined : metadata.name;
159
159
  initArguments = cloneObject(metadata);
160
160
  initArguments.enumObject = thunk;
161
161
  }
@@ -20,7 +20,7 @@ export class Action extends Endpoint {
20
20
  exportSchema(options) {
21
21
  const schema = super.exportSchema(options);
22
22
  if (this.returnType)
23
- schema.returnType = this.returnType.isAnonymous
23
+ schema.returnType = this.returnType.isEmbedded
24
24
  ? this.returnType.exportSchema(options)
25
25
  : this.returnType.name;
26
26
  if (this.returnMime)
@@ -47,7 +47,7 @@ export class Resource {
47
47
  return schema;
48
48
  }
49
49
  toString() {
50
- return `[${Object.getPrototypeOf(this).constructor.name} ${this.name || '#anonymous'}]`;
50
+ return `[${Object.getPrototypeOf(this).constructor.name} ${this.name || '#Embedded'}]`;
51
51
  }
52
52
  [nodeInspectCustom]() {
53
53
  return `[${colorFgYellow + Object.getPrototypeOf(this).constructor.name + colorReset}` +
@@ -2,7 +2,7 @@ export function isConstructor(fn) {
2
2
  return typeof fn === 'function' && fn.prototype &&
3
3
  fn.prototype.constructor === fn &&
4
4
  fn.prototype.constructor.name !== 'Function' &&
5
- fn.prototype.constructor.name !== 'anonymous';
5
+ fn.prototype.constructor.name !== 'embedded';
6
6
  }
7
7
  export function isStream(stream) {
8
8
  return stream !== null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/common",
3
- "version": "0.33.8",
3
+ "version": "0.33.9",
4
4
  "description": "Opra common package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -32,16 +32,16 @@ export declare namespace ComplexType {
32
32
  base?: ComplexType | MappedType | MixinType;
33
33
  fields?: Record<string, ApiField.InitArguments>;
34
34
  additionalFields?: boolean | DataType | 'error';
35
- anonymous?: boolean;
35
+ embedded?: boolean;
36
36
  }
37
37
  interface OwnProperties extends DataType.OwnProperties {
38
38
  ctor?: Type;
39
39
  additionalFields?: boolean | DataType | 'error';
40
40
  fields: ResponsiveMap<ApiField>;
41
- anonymous?: boolean;
41
+ embedded?: boolean;
42
42
  }
43
43
  interface DecoratorOptions extends DataType.DecoratorOptions, Pick<InitArguments, 'ctor' | 'abstract'> {
44
- anonymous?: boolean;
44
+ embedded?: boolean;
45
45
  additionalFields?: boolean | 'error' | string | TypeThunkAsync;
46
46
  }
47
47
  interface Metadata extends StrictOmit<OpraSchema.ComplexType, 'fields'> {
@@ -15,7 +15,7 @@ export declare abstract class DataType {
15
15
  readonly base?: DataType;
16
16
  readonly own: DataType.OwnProperties;
17
17
  description?: string;
18
- isAnonymous?: boolean;
18
+ isEmbedded?: boolean;
19
19
  protected constructor(document: ApiDocument, init?: DataType.InitArguments);
20
20
  abstract generateCodec(codec: 'decode' | 'encode', options?: DataType.GenerateCodecOptions): Validator;
21
21
  exportSchema(options?: {