@opra/common 1.0.0-alpha.22 → 1.0.0-alpha.24

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
@@ -811,15 +811,15 @@ function ComplexTypeDecorator(options) {
811
811
  name = target.name.match(EXTRACT_TYPENAME_PATTERN)?.[1] || target.name;
812
812
  }
813
813
  }
814
- let metadata2 = Reflect.getOwnMetadata(DATATYPE_METADATA, target);
815
- if (!metadata2) {
816
- metadata2 = {};
817
- Reflect.defineMetadata(DATATYPE_METADATA, metadata2, target);
814
+ let metadata = Reflect.getOwnMetadata(DATATYPE_METADATA, target);
815
+ if (!metadata) {
816
+ metadata = {};
817
+ Reflect.defineMetadata(DATATYPE_METADATA, metadata, target);
818
818
  }
819
- metadata2.kind = OpraSchema.ComplexType.Kind;
820
- metadata2.name = name;
819
+ metadata.kind = OpraSchema.ComplexType.Kind;
820
+ metadata.name = name;
821
821
  if (options)
822
- Object.assign(metadata2, omit(options, ["kind", "name", "base", "fields"]));
822
+ Object.assign(metadata, omit(options, ["kind", "name", "base", "fields"]));
823
823
  };
824
824
  }
825
825
  __name(ComplexTypeDecorator, "ComplexTypeDecorator");
@@ -871,11 +871,11 @@ var DocumentNode = class {
871
871
  return dt;
872
872
  let name = "";
873
873
  if (typeof nameOrCtor === "function") {
874
- const metadata2 = Reflect.getMetadata(DATATYPE_METADATA, nameOrCtor);
875
- name = metadata2.name;
874
+ const metadata = Reflect.getMetadata(DATATYPE_METADATA, nameOrCtor);
875
+ name = metadata.name;
876
876
  } else if (typeof nameOrCtor === "object") {
877
- const metadata2 = nameOrCtor[DATATYPE_METADATA];
878
- name = metadata2?.name;
877
+ const metadata = nameOrCtor[DATATYPE_METADATA];
878
+ name = metadata?.name;
879
879
  }
880
880
  if (typeof nameOrCtor === "string")
881
881
  name = nameOrCtor;
@@ -980,18 +980,18 @@ function ApiFieldDecorator(options) {
980
980
  return function(target, propertyKey) {
981
981
  if (typeof propertyKey !== "string")
982
982
  throw new TypeError(`Symbol properties can't be used as a field`);
983
- const metadata2 = Reflect.getOwnMetadata(DATATYPE_METADATA, target.constructor) || {};
984
- metadata2.kind = OpraSchema.ComplexType.Kind;
985
- metadata2.fields = metadata2.fields || {};
983
+ const metadata = Reflect.getOwnMetadata(DATATYPE_METADATA, target.constructor) || {};
984
+ metadata.kind = OpraSchema.ComplexType.Kind;
985
+ metadata.fields = metadata.fields || {};
986
986
  const designType = Reflect.getMetadata("design:type", target, propertyKey);
987
- const elemMeta = metadata2.fields[propertyKey] = {
987
+ const elemMeta = metadata.fields[propertyKey] = {
988
988
  ...options
989
989
  };
990
990
  if (designType === Array) {
991
991
  elemMeta.isArray = true;
992
992
  } else
993
993
  elemMeta.type = elemMeta.type || designType;
994
- Reflect.defineMetadata(DATATYPE_METADATA, omitUndefined(metadata2), target.constructor);
994
+ Reflect.defineMetadata(DATATYPE_METADATA, omitUndefined(metadata), target.constructor);
995
995
  };
996
996
  }
997
997
  __name(ApiFieldDecorator, "ApiFieldDecorator");
@@ -1165,7 +1165,7 @@ var ComplexTypeBaseClass = class extends DataType {
1165
1165
  }
1166
1166
  }
1167
1167
  return vg.isObject(schema, {
1168
- ctor: this.ctor,
1168
+ ctor: this.name === "object" ? Object : this.ctor,
1169
1169
  additionalFields,
1170
1170
  name: this.name,
1171
1171
  coerce: true,
@@ -1200,7 +1200,7 @@ var ComplexTypeBaseClass = class extends DataType {
1200
1200
  const fn = this._generateFieldCodec(codec, field, {
1201
1201
  ...context,
1202
1202
  partial: context.partial === "deep" ? context.partial : void 0,
1203
- projection: projection !== "*" ? projection : p?.projection,
1203
+ projection,
1204
1204
  currentPath: currentPath + (currentPath ? "." : "") + fieldName
1205
1205
  });
1206
1206
  schema[fieldName] = context.partial || !field.required ? vg.optional(fn) : vg.required(fn);
@@ -1434,7 +1434,7 @@ function EnumTypeFactory(enumSource, ...args) {
1434
1434
  attributes[enumSource[k]] = omitUndefined({ alias: k, description });
1435
1435
  });
1436
1436
  }
1437
- const metadata2 = {
1437
+ const metadata = {
1438
1438
  kind: OpraSchema.EnumType.Kind,
1439
1439
  attributes,
1440
1440
  base: options.base,
@@ -1442,7 +1442,7 @@ function EnumTypeFactory(enumSource, ...args) {
1442
1442
  description: options?.description
1443
1443
  };
1444
1444
  Object.defineProperty(enumSource, DATATYPE_METADATA, {
1445
- value: metadata2,
1445
+ value: metadata,
1446
1446
  enumerable: false,
1447
1447
  configurable: true,
1448
1448
  writable: true
@@ -1618,18 +1618,18 @@ function MixinTypeFactory(...args) {
1618
1618
  }
1619
1619
  }
1620
1620
  }[className];
1621
- const metadata2 = {
1621
+ const metadata = {
1622
1622
  ...options,
1623
1623
  kind: OpraSchema.MixinType.Kind,
1624
1624
  types: []
1625
1625
  };
1626
- Reflect.defineMetadata(DATATYPE_METADATA, metadata2, MixinClass);
1626
+ Reflect.defineMetadata(DATATYPE_METADATA, metadata, MixinClass);
1627
1627
  for (const c of clasRefs) {
1628
1628
  const itemMeta = Reflect.getMetadata(DATATYPE_METADATA, c);
1629
1629
  if (!(itemMeta && (itemMeta.kind === OpraSchema.ComplexType.Kind || itemMeta.kind === OpraSchema.MixinType.Kind || itemMeta.kind === OpraSchema.MappedType.Kind))) {
1630
1630
  throw new TypeError(`Class "${c.name}" is not a ${OpraSchema.ComplexType.Kind}, ${OpraSchema.MixinType.Kind} or ${OpraSchema.MappedType.Kind}`);
1631
1631
  }
1632
- metadata2.types.push(c);
1632
+ metadata.types.push(c);
1633
1633
  mergePrototype(MixinClass.prototype, c.prototype);
1634
1634
  }
1635
1635
  return MixinClass;
@@ -1657,12 +1657,12 @@ function SimpleTypeDecoratorFactory(options) {
1657
1657
  name = name.toLowerCase();
1658
1658
  }
1659
1659
  }
1660
- const metadata2 = Reflect.getOwnMetadata(DATATYPE_METADATA, target) || {};
1661
- metadata2.kind = OpraSchema.SimpleType.Kind;
1662
- metadata2.name = name;
1660
+ const metadata = Reflect.getOwnMetadata(DATATYPE_METADATA, target) || {};
1661
+ metadata.kind = OpraSchema.SimpleType.Kind;
1662
+ metadata.name = name;
1663
1663
  if (options)
1664
- Object.assign(metadata2, omit2(options, ["kind", "name"]));
1665
- Reflect.defineMetadata(DATATYPE_METADATA, metadata2, target);
1664
+ Object.assign(metadata, omit2(options, ["kind", "name"]));
1665
+ Reflect.defineMetadata(DATATYPE_METADATA, metadata, target);
1666
1666
  }, "decorator");
1667
1667
  decorator.Example = (value, description) => {
1668
1668
  decoratorChain.push((meta) => {
@@ -1681,21 +1681,21 @@ function AttributeDecoratorFactory(options) {
1681
1681
  return (target, propertyKey) => {
1682
1682
  if (typeof propertyKey !== "string")
1683
1683
  throw new TypeError(`Symbol properties can't be decorated with Attribute`);
1684
- const metadata2 = Reflect.getOwnMetadata(DATATYPE_METADATA, target.constructor) || {};
1684
+ const metadata = Reflect.getOwnMetadata(DATATYPE_METADATA, target.constructor) || {};
1685
1685
  const designType = Reflect.getMetadata("design:type", target, propertyKey);
1686
1686
  let format = "string";
1687
1687
  if (designType === Boolean)
1688
1688
  format = "boolean";
1689
1689
  else if (designType === Number)
1690
1690
  format = "number";
1691
- metadata2.kind = OpraSchema.SimpleType.Kind;
1692
- metadata2.attributes = metadata2.attributes || {};
1693
- metadata2.attributes[propertyKey] = {
1691
+ metadata.kind = OpraSchema.SimpleType.Kind;
1692
+ metadata.attributes = metadata.attributes || {};
1693
+ metadata.attributes[propertyKey] = {
1694
1694
  format: options?.format || format,
1695
1695
  description: options?.description,
1696
1696
  deprecated: options?.deprecated
1697
1697
  };
1698
- Reflect.defineMetadata(DATATYPE_METADATA, metadata2, target.constructor);
1698
+ Reflect.defineMetadata(DATATYPE_METADATA, metadata, target.constructor);
1699
1699
  };
1700
1700
  }
1701
1701
  __name(AttributeDecoratorFactory, "AttributeDecoratorFactory");
@@ -1872,14 +1872,14 @@ var DataTypeFactory = class {
1872
1872
  for (let thunk of types) {
1873
1873
  await context.enterAsync(`$[${i++}]`, async () => {
1874
1874
  thunk = await resolveThunk(thunk);
1875
- const metadata2 = Reflect.getMetadata(DATATYPE_METADATA, thunk) || thunk[DATATYPE_METADATA];
1876
- if (!(metadata2 && metadata2.name)) {
1875
+ const metadata = Reflect.getMetadata(DATATYPE_METADATA, thunk) || thunk[DATATYPE_METADATA];
1876
+ if (!(metadata && metadata.name)) {
1877
1877
  if (typeof thunk === "function") {
1878
1878
  return context.addError(`Class "${thunk.name}" doesn't have a valid data type metadata`);
1879
1879
  }
1880
1880
  return context.addError(`Object doesn't have a valid data type metadata`);
1881
1881
  }
1882
- importQueue.set(metadata2.name, thunk);
1882
+ importQueue.set(metadata.name, thunk);
1883
1883
  });
1884
1884
  }
1885
1885
  } else {
@@ -1913,7 +1913,7 @@ var DataTypeFactory = class {
1913
1913
  const dataType = owner.node.findDataType(thunk);
1914
1914
  if (dataType instanceof DataType)
1915
1915
  return dataType.name;
1916
- let metadata2;
1916
+ let metadata;
1917
1917
  let ctor;
1918
1918
  let instance;
1919
1919
  if (typeof thunk !== "string") {
@@ -1930,25 +1930,25 @@ var DataTypeFactory = class {
1930
1930
  } else {
1931
1931
  }
1932
1932
  if (typeof thunk === "function") {
1933
- metadata2 = Reflect.getMetadata(DATATYPE_METADATA, thunk);
1934
- if (!metadata2)
1933
+ metadata = Reflect.getMetadata(DATATYPE_METADATA, thunk);
1934
+ if (!metadata)
1935
1935
  return context.addError(`Class "${thunk.name}" doesn't have a valid DataType metadata`);
1936
1936
  ctor = thunk;
1937
1937
  } else if (typeof thunk === "object") {
1938
- metadata2 = thunk[DATATYPE_METADATA];
1939
- if (metadata2) {
1938
+ metadata = thunk[DATATYPE_METADATA];
1939
+ if (metadata) {
1940
1940
  instance = thunk;
1941
- if (metadata2.kind !== OpraSchema.EnumType.Kind)
1942
- metadata2 = void 0;
1941
+ if (metadata.kind !== OpraSchema.EnumType.Kind)
1942
+ metadata = void 0;
1943
1943
  } else if (OpraSchema.isDataType(thunk)) {
1944
- metadata2 = thunk;
1945
- ctor = metadata2.ctor;
1944
+ metadata = thunk;
1945
+ ctor = metadata.ctor;
1946
1946
  } else {
1947
1947
  ctor = Object.getPrototypeOf(thunk).constructor;
1948
- metadata2 = ctor && Reflect.getMetadata(DATATYPE_METADATA, ctor);
1949
- if (metadata2) {
1950
- if (metadata2.kind === OpraSchema.SimpleType.Kind) {
1951
- const baseArgs = await this._importDataTypeArgs(context, owner, metadata2.name);
1948
+ metadata = ctor && Reflect.getMetadata(DATATYPE_METADATA, ctor);
1949
+ if (metadata) {
1950
+ if (metadata.kind === OpraSchema.SimpleType.Kind) {
1951
+ const baseArgs = await this._importDataTypeArgs(context, owner, metadata.name);
1952
1952
  if (!baseArgs)
1953
1953
  return;
1954
1954
  if (typeof baseArgs === "object" && baseArgs.kind !== OpraSchema.SimpleType.Kind) {
@@ -1964,27 +1964,27 @@ var DataTypeFactory = class {
1964
1964
  }
1965
1965
  }
1966
1966
  }
1967
- if (!metadata2)
1967
+ if (!metadata)
1968
1968
  return context.addError(`No DataType metadata found`);
1969
- return context.enterAsync(metadata2.name ? `[${metadata2.name}]` : "", async () => {
1970
- if (metadata2.name) {
1971
- const curr = initArgsMap?.get(metadata2.name);
1969
+ return context.enterAsync(metadata.name ? `[${metadata.name}]` : "", async () => {
1970
+ if (metadata.name) {
1971
+ const curr = initArgsMap?.get(metadata.name);
1972
1972
  if (curr) {
1973
1973
  if (curr[initializingSymbol])
1974
1974
  return context.addError("Circular reference detected");
1975
- return metadata2.name;
1975
+ return metadata.name;
1976
1976
  }
1977
1977
  }
1978
1978
  const out = {
1979
- kind: metadata2.kind,
1980
- name: metadata2.name
1979
+ kind: metadata.kind,
1980
+ name: metadata.name
1981
1981
  };
1982
1982
  out[initializingSymbol] = true;
1983
1983
  try {
1984
1984
  if (out.name) {
1985
1985
  if (importQueue?.has(out.name)) {
1986
- initArgsMap?.set(metadata2.name, out);
1987
- out._instance = { name: metadata2.name };
1986
+ initArgsMap?.set(metadata.name, out);
1987
+ out._instance = { name: metadata.name };
1988
1988
  out[kDataTypeMap] = owner.node[kDataTypeMap];
1989
1989
  } else {
1990
1990
  return context.addError(`Data Type (${out.name}) must be explicitly added to type list in the document scope`);
@@ -1993,24 +1993,24 @@ var DataTypeFactory = class {
1993
1993
  switch (out.kind) {
1994
1994
  case OpraSchema.ComplexType.Kind:
1995
1995
  out.ctor = ctor;
1996
- await this._prepareComplexTypeArgs(context, owner, out, metadata2);
1996
+ await this._prepareComplexTypeArgs(context, owner, out, metadata);
1997
1997
  break;
1998
1998
  case OpraSchema.EnumType.Kind:
1999
1999
  out.instance = instance;
2000
- await this._prepareEnumTypeArgs(context, owner, out, metadata2);
2000
+ await this._prepareEnumTypeArgs(context, owner, out, metadata);
2001
2001
  break;
2002
2002
  case OpraSchema.MappedType.Kind:
2003
- await this._prepareMappedTypeArgs(context, owner, out, metadata2);
2003
+ await this._prepareMappedTypeArgs(context, owner, out, metadata);
2004
2004
  break;
2005
2005
  case OpraSchema.MixinType.Kind:
2006
- await this._prepareMixinTypeArgs(context, owner, out, metadata2);
2006
+ await this._prepareMixinTypeArgs(context, owner, out, metadata);
2007
2007
  break;
2008
2008
  case OpraSchema.SimpleType.Kind:
2009
2009
  out.ctor = ctor;
2010
- await this._prepareSimpleTypeArgs(context, owner, out, metadata2);
2010
+ await this._prepareSimpleTypeArgs(context, owner, out, metadata);
2011
2011
  break;
2012
2012
  default:
2013
- return context.addError(`Invalid data type kind ${metadata2.kind}`);
2013
+ return context.addError(`Invalid data type kind ${metadata.kind}`);
2014
2014
  }
2015
2015
  } finally {
2016
2016
  if (out.name)
@@ -2020,17 +2020,17 @@ var DataTypeFactory = class {
2020
2020
  return importQueue && out.name ? out.name : out;
2021
2021
  });
2022
2022
  }
2023
- static async _prepareDataTypeArgs(context, initArgs, metadata2) {
2024
- initArgs.description = metadata2.description;
2025
- initArgs.abstract = metadata2.abstract;
2026
- initArgs.examples = metadata2.examples;
2023
+ static async _prepareDataTypeArgs(context, initArgs, metadata) {
2024
+ initArgs.description = metadata.description;
2025
+ initArgs.abstract = metadata.abstract;
2026
+ initArgs.examples = metadata.examples;
2027
2027
  }
2028
- static async _prepareComplexTypeArgs(context, owner, initArgs, metadata2) {
2029
- await this._prepareDataTypeArgs(context, initArgs, metadata2);
2028
+ static async _prepareComplexTypeArgs(context, owner, initArgs, metadata) {
2029
+ await this._prepareDataTypeArgs(context, initArgs, metadata);
2030
2030
  await context.enterAsync(".base", async () => {
2031
2031
  let baseArgs;
2032
- if (metadata2.base) {
2033
- baseArgs = await this._importDataTypeArgs(context, owner, metadata2.base);
2032
+ if (metadata.base) {
2033
+ baseArgs = await this._importDataTypeArgs(context, owner, metadata.base);
2034
2034
  } else if (initArgs.ctor) {
2035
2035
  const baseClass = Object.getPrototypeOf(initArgs.ctor.prototype).constructor;
2036
2036
  if (Reflect.hasMetadata(DATATYPE_METADATA, baseClass)) {
@@ -2042,21 +2042,21 @@ var DataTypeFactory = class {
2042
2042
  initArgs.base = preferName(baseArgs);
2043
2043
  initArgs.ctor = initArgs.ctor || baseArgs.ctor;
2044
2044
  });
2045
- if (metadata2.additionalFields != null) {
2046
- if (typeof metadata2.additionalFields === "boolean" || Array.isArray(metadata2.additionalFields)) {
2047
- initArgs.additionalFields = metadata2.additionalFields;
2045
+ if (metadata.additionalFields != null) {
2046
+ if (typeof metadata.additionalFields === "boolean" || Array.isArray(metadata.additionalFields)) {
2047
+ initArgs.additionalFields = metadata.additionalFields;
2048
2048
  } else {
2049
2049
  await context.enterAsync(".additionalFields", async () => {
2050
- const t = await this._importDataTypeArgs(context, owner, metadata2.additionalFields);
2050
+ const t = await this._importDataTypeArgs(context, owner, metadata.additionalFields);
2051
2051
  if (t)
2052
2052
  initArgs.additionalFields = preferName(t);
2053
2053
  });
2054
2054
  }
2055
2055
  }
2056
- if (metadata2.fields) {
2056
+ if (metadata.fields) {
2057
2057
  initArgs.fields = {};
2058
2058
  await context.enterAsync(".fields", async () => {
2059
- for (const [k, v] of Object.entries(metadata2.fields)) {
2059
+ for (const [k, v] of Object.entries(metadata.fields)) {
2060
2060
  await context.enterAsync(`[${k}]`, async () => {
2061
2061
  const fieldMeta = typeof v === "string" ? { type: v } : v;
2062
2062
  if (fieldMeta.isArray && !fieldMeta.type) {
@@ -2074,24 +2074,24 @@ var DataTypeFactory = class {
2074
2074
  });
2075
2075
  }
2076
2076
  }
2077
- static async _prepareEnumTypeArgs(context, owner, initArgs, metadata2) {
2078
- await this._prepareDataTypeArgs(context, initArgs, metadata2);
2079
- if (metadata2.base) {
2077
+ static async _prepareEnumTypeArgs(context, owner, initArgs, metadata) {
2078
+ await this._prepareDataTypeArgs(context, initArgs, metadata);
2079
+ if (metadata.base) {
2080
2080
  await context.enterAsync(".base", async () => {
2081
- const baseArgs = await this._importDataTypeArgs(context, owner, metadata2.base);
2081
+ const baseArgs = await this._importDataTypeArgs(context, owner, metadata.base);
2082
2082
  if (!baseArgs)
2083
2083
  return;
2084
2084
  initArgs.base = preferName(baseArgs);
2085
2085
  });
2086
2086
  }
2087
- initArgs.attributes = cloneObject(metadata2.attributes);
2087
+ initArgs.attributes = cloneObject(metadata.attributes);
2088
2088
  }
2089
- static async _prepareSimpleTypeArgs(context, owner, initArgs, metadata2) {
2090
- await this._prepareDataTypeArgs(context, initArgs, metadata2);
2089
+ static async _prepareSimpleTypeArgs(context, owner, initArgs, metadata) {
2090
+ await this._prepareDataTypeArgs(context, initArgs, metadata);
2091
2091
  await context.enterAsync(".base", async () => {
2092
2092
  let baseArgs;
2093
- if (metadata2.base) {
2094
- baseArgs = await this._importDataTypeArgs(context, owner, metadata2.base);
2093
+ if (metadata.base) {
2094
+ baseArgs = await this._importDataTypeArgs(context, owner, metadata.base);
2095
2095
  } else if (initArgs.ctor) {
2096
2096
  const baseClass = Object.getPrototypeOf(initArgs.ctor.prototype).constructor;
2097
2097
  if (Reflect.hasMetadata(DATATYPE_METADATA, baseClass)) {
@@ -2103,12 +2103,12 @@ var DataTypeFactory = class {
2103
2103
  initArgs.base = preferName(baseArgs);
2104
2104
  initArgs.ctor = initArgs.ctor || baseArgs.ctor;
2105
2105
  });
2106
- initArgs.properties = metadata2.properties;
2107
- initArgs.nameMappings = metadata2.nameMappings;
2106
+ initArgs.properties = metadata.properties;
2107
+ initArgs.nameMappings = metadata.nameMappings;
2108
2108
  if (!initArgs.properties && initArgs.ctor)
2109
2109
  initArgs.properties = new initArgs.ctor();
2110
- if (metadata2.attributes)
2111
- initArgs.attributes = cloneObject(metadata2.attributes);
2110
+ if (metadata.attributes)
2111
+ initArgs.attributes = cloneObject(metadata.attributes);
2112
2112
  if (typeof initArgs.properties?.[DECODER] === "function") {
2113
2113
  initArgs.generateDecoder = initArgs.properties?.[DECODER].bind(initArgs.properties);
2114
2114
  }
@@ -2116,12 +2116,12 @@ var DataTypeFactory = class {
2116
2116
  initArgs.generateEncoder = initArgs.properties?.[ENCODER].bind(initArgs.properties);
2117
2117
  }
2118
2118
  }
2119
- static async _prepareMappedTypeArgs(context, owner, initArgs, metadata2) {
2120
- await this._prepareDataTypeArgs(context, initArgs, metadata2);
2119
+ static async _prepareMappedTypeArgs(context, owner, initArgs, metadata) {
2120
+ await this._prepareDataTypeArgs(context, initArgs, metadata);
2121
2121
  await context.enterAsync(".base", async () => {
2122
2122
  let baseArgs;
2123
- if (metadata2.base) {
2124
- baseArgs = await this._importDataTypeArgs(context, owner, metadata2.base);
2123
+ if (metadata.base) {
2124
+ baseArgs = await this._importDataTypeArgs(context, owner, metadata.base);
2125
2125
  } else if (initArgs.ctor) {
2126
2126
  const baseClass = Object.getPrototypeOf(initArgs.ctor.prototype).constructor;
2127
2127
  if (Reflect.hasMetadata(DATATYPE_METADATA, baseClass)) {
@@ -2133,21 +2133,21 @@ var DataTypeFactory = class {
2133
2133
  initArgs.base = preferName(baseArgs);
2134
2134
  initArgs.ctor = initArgs.ctor || baseArgs.ctor;
2135
2135
  });
2136
- if (metadata2.pick)
2137
- initArgs.pick = [...metadata2.pick];
2138
- else if (metadata2.omit)
2139
- initArgs.omit = [...metadata2.omit];
2140
- else if (metadata2.partial) {
2141
- initArgs.partial = Array.isArray(metadata2.partial) ? [...metadata2.partial] : metadata2.partial;
2142
- } else if (metadata2.required) {
2143
- initArgs.required = Array.isArray(metadata2.required) ? [...metadata2.required] : metadata2.required;
2144
- }
2145
- }
2146
- static async _prepareMixinTypeArgs(context, owner, initArgs, metadata2) {
2147
- await this._prepareDataTypeArgs(context, initArgs, metadata2);
2136
+ if (metadata.pick)
2137
+ initArgs.pick = [...metadata.pick];
2138
+ else if (metadata.omit)
2139
+ initArgs.omit = [...metadata.omit];
2140
+ else if (metadata.partial) {
2141
+ initArgs.partial = Array.isArray(metadata.partial) ? [...metadata.partial] : metadata.partial;
2142
+ } else if (metadata.required) {
2143
+ initArgs.required = Array.isArray(metadata.required) ? [...metadata.required] : metadata.required;
2144
+ }
2145
+ }
2146
+ static async _prepareMixinTypeArgs(context, owner, initArgs, metadata) {
2147
+ await this._prepareDataTypeArgs(context, initArgs, metadata);
2148
2148
  initArgs.types = [];
2149
2149
  await context.enterAsync(".types", async () => {
2150
- const _initTypes = metadata2.types;
2150
+ const _initTypes = metadata.types;
2151
2151
  let i = 0;
2152
2152
  for (const t of _initTypes) {
2153
2153
  await context.enterAsync(`[${i++}]`, async () => {
@@ -2343,12 +2343,12 @@ var DataTypeMap = class {
2343
2343
  get(nameOrCtor) {
2344
2344
  let name = typeof nameOrCtor === "string" ? nameOrCtor : this[kCtorMap2].get(nameOrCtor);
2345
2345
  if (!name && typeof nameOrCtor === "function") {
2346
- const metadata2 = Reflect.getMetadata(DATATYPE_METADATA, nameOrCtor);
2347
- name = metadata2?.name;
2346
+ const metadata = Reflect.getMetadata(DATATYPE_METADATA, nameOrCtor);
2347
+ name = metadata?.name;
2348
2348
  }
2349
2349
  if (!name && typeof nameOrCtor === "object") {
2350
- const metadata2 = nameOrCtor[DATATYPE_METADATA];
2351
- name = metadata2?.name;
2350
+ const metadata = nameOrCtor[DATATYPE_METADATA];
2351
+ name = metadata?.name;
2352
2352
  }
2353
2353
  return name ? this[kMap].get(name) : void 0;
2354
2354
  }
@@ -2393,23 +2393,23 @@ function HttpControllerDecoratorFactory(options) {
2393
2393
  let name = options?.name;
2394
2394
  if (!name)
2395
2395
  name = CLASS_NAME_PATTERN2.exec(target.name)?.[1] || target.name;
2396
- const metadata2 = {};
2396
+ const metadata = {};
2397
2397
  const baseMetadata = Reflect.getOwnMetadata(HTTP_CONTROLLER_METADATA, Object.getPrototypeOf(target));
2398
2398
  if (baseMetadata)
2399
- merge2(metadata2, baseMetadata, { deep: true });
2399
+ merge2(metadata, baseMetadata, { deep: true });
2400
2400
  const oldMetadata = Reflect.getOwnMetadata(HTTP_CONTROLLER_METADATA, target);
2401
2401
  if (oldMetadata)
2402
- merge2(metadata2, oldMetadata, { deep: true });
2403
- merge2(metadata2, {
2402
+ merge2(metadata, oldMetadata, { deep: true });
2403
+ merge2(metadata, {
2404
2404
  kind: OpraSchema.HttpController.Kind,
2405
2405
  name,
2406
2406
  path: name,
2407
2407
  ...omit3(options, ["kind", "name", "instance", "endpoints", "key"])
2408
2408
  }, { deep: true });
2409
- Reflect.defineMetadata(HTTP_CONTROLLER_METADATA, metadata2, target);
2409
+ Reflect.defineMetadata(HTTP_CONTROLLER_METADATA, metadata, target);
2410
2410
  for (const fn of decoratorChain)
2411
- fn(metadata2);
2412
- Reflect.defineMetadata(HTTP_CONTROLLER_METADATA, metadata2, target);
2411
+ fn(metadata);
2412
+ Reflect.defineMetadata(HTTP_CONTROLLER_METADATA, metadata, target);
2413
2413
  }, "decorator");
2414
2414
  decorator.Cookie = (name, arg1) => {
2415
2415
  decoratorChain.push((meta) => {
@@ -2663,7 +2663,9 @@ var HttpApi = class extends ApiBase {
2663
2663
  };
2664
2664
 
2665
2665
  // ../../build/common/esm/document/http/http-media-type.js
2666
+ import typeIs from "@browsery/type-is";
2666
2667
  import { asMutable as asMutable11 } from "ts-gems";
2668
+ import { isAny as isAny2, vg as vg3 } from "valgen";
2667
2669
  var HttpMediaType = /* @__PURE__ */ __name(function(owner, initArgs) {
2668
2670
  if (!this)
2669
2671
  throw new TypeError('"this" should be passed to call class constructor');
@@ -2683,7 +2685,6 @@ var HttpMediaType = /* @__PURE__ */ __name(function(owner, initArgs) {
2683
2685
  _this.maxFiles = initArgs.maxFiles;
2684
2686
  _this.maxFileSize = initArgs.maxFileSize;
2685
2687
  _this.maxTotalFileSize = initArgs.maxTotalFileSize;
2686
- _this.minFileSize = initArgs.minFileSize;
2687
2688
  if (initArgs?.type) {
2688
2689
  _this.type = initArgs?.type instanceof DataType ? initArgs.type : _this.owner.node.getDataType(initArgs.type);
2689
2690
  }
@@ -2716,14 +2717,26 @@ var HttpMediaTypeClass = class extends DocumentElement {
2716
2717
  maxFieldsSize: this.maxFieldsSize,
2717
2718
  maxFiles: this.maxFiles,
2718
2719
  maxFileSize: this.maxFileSize,
2719
- maxTotalFileSize: this.maxTotalFileSize,
2720
- minFileSize: this.minFileSize
2720
+ maxTotalFileSize: this.maxTotalFileSize
2721
2721
  });
2722
2722
  if (this.multipartFields?.length) {
2723
2723
  out.multipartFields = this.multipartFields.map((x) => x.toJSON());
2724
2724
  }
2725
2725
  return out;
2726
2726
  }
2727
+ generateCodec(codec, options) {
2728
+ let fn;
2729
+ if (this.type) {
2730
+ fn = this.type.generateCodec(codec, options);
2731
+ } else if (this.contentType) {
2732
+ const arr = Array.isArray(this.contentType) ? this.contentType : [this.contentType];
2733
+ if (arr.find((ct) => typeIs.is(ct, ["json"]))) {
2734
+ fn = this.node.findDataType("object").generateCodec(codec);
2735
+ }
2736
+ }
2737
+ fn = fn || isAny2;
2738
+ return this.isArray ? vg3.isArray(fn) : fn;
2739
+ }
2727
2740
  };
2728
2741
  HttpMediaType.prototype = HttpMediaTypeClass.prototype;
2729
2742
 
@@ -3473,46 +3486,46 @@ var HttpApiFactory = class {
3473
3486
  }
3474
3487
  thunk = await resolveThunk(thunk);
3475
3488
  let ctor;
3476
- let metadata2;
3489
+ let metadata;
3477
3490
  let instance;
3478
3491
  if (typeof thunk === "function") {
3479
- metadata2 = Reflect.getMetadata(HTTP_CONTROLLER_METADATA, thunk);
3480
- if (!metadata2)
3492
+ metadata = Reflect.getMetadata(HTTP_CONTROLLER_METADATA, thunk);
3493
+ if (!metadata)
3481
3494
  return context.addError(`Class "${thunk.name}" doesn't have a valid HttpController metadata`);
3482
3495
  ctor = thunk;
3483
3496
  } else {
3484
3497
  ctor = Object.getPrototypeOf(thunk).constructor;
3485
- metadata2 = Reflect.getMetadata(HTTP_CONTROLLER_METADATA, ctor);
3486
- if (metadata2)
3498
+ metadata = Reflect.getMetadata(HTTP_CONTROLLER_METADATA, ctor);
3499
+ if (metadata)
3487
3500
  instance = thunk;
3488
3501
  else {
3489
- metadata2 = thunk;
3502
+ metadata = thunk;
3490
3503
  if (thunk.instance === "object") {
3491
3504
  instance = thunk.instance;
3492
3505
  ctor = Object.getPrototypeOf(instance).constructor;
3493
3506
  }
3494
3507
  }
3495
3508
  }
3496
- if (!metadata2)
3509
+ if (!metadata)
3497
3510
  return context.addError(`Class "${ctor.name}" is not decorated with HttpController()`);
3498
- name = name || metadata2.name;
3511
+ name = name || metadata.name;
3499
3512
  if (!name)
3500
3513
  throw new TypeError(`Controller name required`);
3501
3514
  const controller = new HttpController2(parent, {
3502
- ...metadata2,
3515
+ ...metadata,
3503
3516
  name,
3504
3517
  instance,
3505
3518
  ctor
3506
3519
  });
3507
- if (metadata2.types) {
3520
+ if (metadata.types) {
3508
3521
  await context.enterAsync(".types", async () => {
3509
- await DataTypeFactory.addDataTypes(context, controller, metadata2.types);
3522
+ await DataTypeFactory.addDataTypes(context, controller, metadata.types);
3510
3523
  });
3511
3524
  }
3512
- if (metadata2.parameters) {
3525
+ if (metadata.parameters) {
3513
3526
  await context.enterAsync(".parameters", async () => {
3514
3527
  let i = 0;
3515
- for (const v of metadata2.parameters) {
3528
+ for (const v of metadata.parameters) {
3516
3529
  await context.enterAsync(`[${i++}]`, async () => {
3517
3530
  const prmArgs = { ...v };
3518
3531
  await context.enterAsync(".type", async () => {
@@ -3530,9 +3543,9 @@ var HttpApiFactory = class {
3530
3543
  }
3531
3544
  });
3532
3545
  }
3533
- if (metadata2.operations) {
3546
+ if (metadata.operations) {
3534
3547
  await context.enterAsync(".operations", async () => {
3535
- for (const [k, v] of Object.entries(metadata2.operations)) {
3548
+ for (const [k, v] of Object.entries(metadata.operations)) {
3536
3549
  await context.enterAsync(`[${k}]`, async () => {
3537
3550
  const operation = new HttpOperation2(controller, { name: k, method: "GET" });
3538
3551
  await this._initHttpOperation(context, operation, v);
@@ -3541,11 +3554,11 @@ var HttpApiFactory = class {
3541
3554
  }
3542
3555
  });
3543
3556
  }
3544
- if (metadata2.controllers) {
3557
+ if (metadata.controllers) {
3545
3558
  await context.enterAsync(".controllers", async () => {
3546
- if (Array.isArray(metadata2.controllers)) {
3559
+ if (Array.isArray(metadata.controllers)) {
3547
3560
  let k = 0;
3548
- for (const v of metadata2.controllers) {
3561
+ for (const v of metadata.controllers) {
3549
3562
  await context.enterAsync(`[${k}]`, async () => {
3550
3563
  const r = await this._createController(context, controller, v);
3551
3564
  if (r) {
@@ -3557,7 +3570,7 @@ var HttpApiFactory = class {
3557
3570
  k++;
3558
3571
  }
3559
3572
  } else {
3560
- for (const [k, v] of Object.entries(metadata2.controllers)) {
3573
+ for (const [k, v] of Object.entries(metadata.controllers)) {
3561
3574
  await context.enterAsync(`[${k}]`, async () => {
3562
3575
  const r = await this._createController(context, controller, v, k);
3563
3576
  if (r) {
@@ -3579,22 +3592,22 @@ var HttpApiFactory = class {
3579
3592
  * @param metadata
3580
3593
  * @protected
3581
3594
  */
3582
- static async _initHttpOperation(context, operation, metadata2) {
3595
+ static async _initHttpOperation(context, operation, metadata) {
3583
3596
  const initArgs = {
3584
- ...metadata2,
3597
+ ...metadata,
3585
3598
  name: operation.name,
3586
3599
  types: void 0
3587
3600
  };
3588
3601
  HttpOperation2.apply(operation, [operation.owner, initArgs]);
3589
- if (metadata2.types) {
3602
+ if (metadata.types) {
3590
3603
  await context.enterAsync(".types", async () => {
3591
- await DataTypeFactory.addDataTypes(context, operation, metadata2.types);
3604
+ await DataTypeFactory.addDataTypes(context, operation, metadata.types);
3592
3605
  });
3593
3606
  }
3594
- if (metadata2.parameters) {
3607
+ if (metadata.parameters) {
3595
3608
  await context.enterAsync(".parameters", async () => {
3596
3609
  let i = 0;
3597
- for (const v of metadata2.parameters) {
3610
+ for (const v of metadata.parameters) {
3598
3611
  await context.enterAsync(`[${i++}]`, async () => {
3599
3612
  const prmArgs = { ...v };
3600
3613
  await context.enterAsync(".type", async () => {
@@ -3612,10 +3625,10 @@ var HttpApiFactory = class {
3612
3625
  }
3613
3626
  });
3614
3627
  }
3615
- if (metadata2.responses) {
3628
+ if (metadata.responses) {
3616
3629
  await context.enterAsync(".responses", async () => {
3617
3630
  let i = 0;
3618
- for (const v of metadata2.responses) {
3631
+ for (const v of metadata.responses) {
3619
3632
  await context.enterAsync(`[${i++}]`, async () => {
3620
3633
  const response = new HttpOperationResponse(operation, { statusCode: v.statusCode });
3621
3634
  await this._initHttpOperationResponse(context, response, v);
@@ -3624,10 +3637,10 @@ var HttpApiFactory = class {
3624
3637
  }
3625
3638
  });
3626
3639
  }
3627
- if (metadata2.requestBody) {
3640
+ if (metadata.requestBody) {
3628
3641
  await context.enterAsync(".requestBody", async () => {
3629
3642
  const requestBody = new HttpRequestBody(operation);
3630
- await this._initHttpRequestBody(context, requestBody, metadata2.requestBody);
3643
+ await this._initHttpRequestBody(context, requestBody, metadata.requestBody);
3631
3644
  operation.requestBody = requestBody;
3632
3645
  });
3633
3646
  }
@@ -3640,28 +3653,28 @@ var HttpApiFactory = class {
3640
3653
  * @param metadata
3641
3654
  * @protected
3642
3655
  */
3643
- static async _initHttpMediaType(context, target, metadata2) {
3656
+ static async _initHttpMediaType(context, target, metadata) {
3644
3657
  HttpMediaType.call(target, target.owner, {
3645
- ...metadata2,
3658
+ ...metadata,
3646
3659
  type: void 0,
3647
3660
  multipartFields: void 0
3648
3661
  });
3649
- if (metadata2.type) {
3662
+ if (metadata.type) {
3650
3663
  await context.enterAsync(".type", async () => {
3651
- if (metadata2.type)
3652
- target.type = target.node.findDataType(metadata2.type);
3653
- if (!target.type && (typeof metadata2.type === "object" || typeof metadata2.type === "function")) {
3654
- target.type = await DataTypeFactory.createDataType(context, target, metadata2.type);
3664
+ if (metadata.type)
3665
+ target.type = target.node.findDataType(metadata.type);
3666
+ if (!target.type && (typeof metadata.type === "object" || typeof metadata.type === "function")) {
3667
+ target.type = await DataTypeFactory.createDataType(context, target, metadata.type);
3655
3668
  }
3656
3669
  if (!target.type)
3657
3670
  target.type = target.node.getDataType("any");
3658
3671
  });
3659
3672
  }
3660
- if (metadata2.multipartFields) {
3673
+ if (metadata.multipartFields) {
3661
3674
  await context.enterAsync(".multipartFields", async () => {
3662
- for (let i = 0; i < metadata2.multipartFields.length; i++) {
3675
+ for (let i = 0; i < metadata.multipartFields.length; i++) {
3663
3676
  await context.enterAsync(`[${i}]`, async () => {
3664
- const src = metadata2.multipartFields[i];
3677
+ const src = metadata.multipartFields[i];
3665
3678
  const field = new HttpMultipartField(target, { fieldName: src.fieldName, fieldType: src.fieldType });
3666
3679
  await this._initHttpMediaType(context, field, src);
3667
3680
  target.multipartFields.push(field);
@@ -3677,13 +3690,13 @@ var HttpApiFactory = class {
3677
3690
  * @param metadata
3678
3691
  * @protected
3679
3692
  */
3680
- static async _initHttpOperationResponse(context, target, metadata2) {
3681
- await this._initHttpMediaType(context, target, metadata2);
3682
- target.partial = metadata2.partial;
3683
- if (metadata2.parameters) {
3693
+ static async _initHttpOperationResponse(context, target, metadata) {
3694
+ await this._initHttpMediaType(context, target, metadata);
3695
+ target.partial = metadata.partial;
3696
+ if (metadata.parameters) {
3684
3697
  await context.enterAsync(".parameters", async () => {
3685
3698
  let i = 0;
3686
- for (const v of metadata2.parameters) {
3699
+ for (const v of metadata.parameters) {
3687
3700
  await context.enterAsync(`[${i++}]`, async () => {
3688
3701
  const prmArgs = { ...v };
3689
3702
  await context.enterAsync(".type", async () => {
@@ -3709,17 +3722,17 @@ var HttpApiFactory = class {
3709
3722
  * @param metadata
3710
3723
  * @protected
3711
3724
  */
3712
- static async _initHttpRequestBody(context, target, metadata2) {
3713
- target.description = metadata2.description;
3714
- target.required = metadata2.required;
3715
- target.maxContentSize = metadata2.maxContentSize;
3716
- target.immediateFetch = metadata2.immediateFetch;
3717
- target.partial = metadata2.partial;
3718
- if (metadata2.content) {
3725
+ static async _initHttpRequestBody(context, target, metadata) {
3726
+ target.description = metadata.description;
3727
+ target.required = metadata.required;
3728
+ target.maxContentSize = metadata.maxContentSize;
3729
+ target.immediateFetch = metadata.immediateFetch;
3730
+ target.partial = metadata.partial;
3731
+ if (metadata.content) {
3719
3732
  await context.enterAsync(".content", async () => {
3720
- for (let i = 0; i < metadata2.content.length; i++) {
3733
+ for (let i = 0; i < metadata.content.length; i++) {
3721
3734
  await context.enterAsync(`[${i}]`, async () => {
3722
- const src = metadata2.content[i];
3735
+ const src = metadata.content[i];
3723
3736
  const field = new HttpMediaType(target, String(i));
3724
3737
  await this._initHttpMediaType(context, field, src);
3725
3738
  target.content.push(field);
@@ -3868,7 +3881,7 @@ function __metadata(metadataKey, metadataValue) {
3868
3881
  __name(__metadata, "__metadata");
3869
3882
 
3870
3883
  // ../../build/common/esm/document/data-type/extended-types/base64.type.js
3871
- import { vg as vg3 } from "valgen";
3884
+ import { vg as vg4 } from "valgen";
3872
3885
  var Base64Type = class Base64Type2 {
3873
3886
  static {
3874
3887
  __name(this, "Base64Type");
@@ -3878,10 +3891,10 @@ var Base64Type = class Base64Type2 {
3878
3891
  Object.assign(this, attributes);
3879
3892
  }
3880
3893
  [DECODER]() {
3881
- return vg3.isBase64({ coerce: true });
3894
+ return vg4.isBase64({ coerce: true });
3882
3895
  }
3883
3896
  [ENCODER]() {
3884
- return vg3.isBase64({ coerce: true });
3897
+ return vg4.isBase64({ coerce: true });
3885
3898
  }
3886
3899
  };
3887
3900
  Base64Type = __decorate([
@@ -3896,7 +3909,7 @@ Base64Type = __decorate([
3896
3909
  ], Base64Type);
3897
3910
 
3898
3911
  // ../../build/common/esm/document/data-type/extended-types/date.type.js
3899
- import { isDateString, toString, vg as vg4 } from "valgen";
3912
+ import { isDateString, toString, vg as vg5 } from "valgen";
3900
3913
  var DateType = class DateType2 {
3901
3914
  static {
3902
3915
  __name(this, "DateType");
@@ -3906,30 +3919,30 @@ var DateType = class DateType2 {
3906
3919
  Object.assign(this, attributes);
3907
3920
  }
3908
3921
  [DECODER](properties) {
3909
- const fn = vg4.isDate({ precision: "date", coerce: true });
3922
+ const fn = vg5.isDate({ precision: "date", coerce: true });
3910
3923
  const x = [];
3911
3924
  if (properties.minValue) {
3912
3925
  isDateString(properties.minValue);
3913
- x.push(toString, vg4.isGte(properties.minValue));
3926
+ x.push(toString, vg5.isGte(properties.minValue));
3914
3927
  }
3915
3928
  if (properties.maxValue) {
3916
3929
  isDateString(properties.maxValue);
3917
- x.push(toString, vg4.isLte(properties.maxValue));
3930
+ x.push(toString, vg5.isLte(properties.maxValue));
3918
3931
  }
3919
- return x.length > 0 ? vg4.pipe([fn, ...x], { returnIndex: 0 }) : fn;
3932
+ return x.length > 0 ? vg5.pipe([fn, ...x], { returnIndex: 0 }) : fn;
3920
3933
  }
3921
3934
  [ENCODER](properties) {
3922
- const fn = vg4.isDateString({ precision: "date", trim: "date", coerce: true });
3935
+ const fn = vg5.isDateString({ precision: "date", trim: "date", coerce: true });
3923
3936
  const x = [];
3924
3937
  if (properties.minValue) {
3925
3938
  isDateString(properties.minValue);
3926
- x.push(vg4.isGte(properties.minValue));
3939
+ x.push(vg5.isGte(properties.minValue));
3927
3940
  }
3928
3941
  if (properties.maxValue) {
3929
3942
  isDateString(properties.maxValue);
3930
- x.push(vg4.isLte(properties.maxValue));
3943
+ x.push(vg5.isLte(properties.maxValue));
3931
3944
  }
3932
- return x.length > 0 ? vg4.pipe([fn, ...x], { returnIndex: 0 }) : fn;
3945
+ return x.length > 0 ? vg5.pipe([fn, ...x], { returnIndex: 0 }) : fn;
3933
3946
  }
3934
3947
  };
3935
3948
  __decorate([
@@ -3956,7 +3969,7 @@ DateType = __decorate([
3956
3969
  ], DateType);
3957
3970
 
3958
3971
  // ../../build/common/esm/document/data-type/extended-types/date-string.type.js
3959
- import { vg as vg5 } from "valgen";
3972
+ import { vg as vg6 } from "valgen";
3960
3973
  var DateStringType = class DateStringType2 {
3961
3974
  static {
3962
3975
  __name(this, "DateStringType");
@@ -3966,13 +3979,13 @@ var DateStringType = class DateStringType2 {
3966
3979
  Object.assign(this, attributes);
3967
3980
  }
3968
3981
  [DECODER](properties) {
3969
- const fn = vg5.isDateString({ trim: "date", coerce: true });
3982
+ const fn = vg6.isDateString({ trim: "date", coerce: true });
3970
3983
  const x = [];
3971
3984
  if (properties.minValue)
3972
- x.push(vg5.isGte(properties.minValue));
3985
+ x.push(vg6.isGte(properties.minValue));
3973
3986
  if (properties.maxValue)
3974
- x.push(vg5.isLte(properties.maxValue));
3975
- return x.length > 0 ? vg5.pipe([fn, ...x], { returnIndex: 0 }) : fn;
3987
+ x.push(vg6.isLte(properties.maxValue));
3988
+ return x.length > 0 ? vg6.pipe([fn, ...x], { returnIndex: 0 }) : fn;
3976
3989
  }
3977
3990
  [ENCODER](properties) {
3978
3991
  return this[DECODER](properties);
@@ -4002,7 +4015,7 @@ DateStringType = __decorate([
4002
4015
  ], DateStringType);
4003
4016
 
4004
4017
  // ../../build/common/esm/document/data-type/extended-types/date-time.type.js
4005
- import { isDateString as isDateString2, toString as toString2, vg as vg6 } from "valgen";
4018
+ import { isDateString as isDateString2, toString as toString2, vg as vg7 } from "valgen";
4006
4019
  var DateTimeType = class DateTimeType2 {
4007
4020
  static {
4008
4021
  __name(this, "DateTimeType");
@@ -4012,30 +4025,30 @@ var DateTimeType = class DateTimeType2 {
4012
4025
  Object.assign(this, attributes);
4013
4026
  }
4014
4027
  [DECODER](properties) {
4015
- const fn = vg6.isDate({ precision: "time", coerce: true });
4028
+ const fn = vg7.isDate({ precision: "time", coerce: true });
4016
4029
  const x = [];
4017
4030
  if (properties.minValue) {
4018
4031
  isDateString2(properties.minValue);
4019
- x.push(toString2, vg6.isGte(properties.minValue));
4032
+ x.push(toString2, vg7.isGte(properties.minValue));
4020
4033
  }
4021
4034
  if (properties.maxValue) {
4022
4035
  isDateString2(properties.maxValue);
4023
- x.push(toString2, vg6.isLte(properties.maxValue));
4036
+ x.push(toString2, vg7.isLte(properties.maxValue));
4024
4037
  }
4025
- return x.length > 0 ? vg6.pipe([fn, ...x], { returnIndex: 0 }) : fn;
4038
+ return x.length > 0 ? vg7.pipe([fn, ...x], { returnIndex: 0 }) : fn;
4026
4039
  }
4027
4040
  [ENCODER](properties) {
4028
- const fn = vg6.isDateString({ precision: "time", trim: "time", coerce: true });
4041
+ const fn = vg7.isDateString({ precision: "time", trim: "time", coerce: true });
4029
4042
  const x = [];
4030
4043
  if (properties.minValue) {
4031
4044
  isDateString2(properties.minValue);
4032
- x.push(vg6.isGte(properties.minValue));
4045
+ x.push(vg7.isGte(properties.minValue));
4033
4046
  }
4034
4047
  if (properties.maxValue) {
4035
4048
  isDateString2(properties.maxValue);
4036
- x.push(vg6.isLte(properties.maxValue));
4049
+ x.push(vg7.isLte(properties.maxValue));
4037
4050
  }
4038
- return x.length > 0 ? vg6.pipe([fn, ...x], { returnIndex: 0 }) : fn;
4051
+ return x.length > 0 ? vg7.pipe([fn, ...x], { returnIndex: 0 }) : fn;
4039
4052
  }
4040
4053
  };
4041
4054
  __decorate([
@@ -4062,7 +4075,7 @@ DateTimeType = __decorate([
4062
4075
  ], DateTimeType);
4063
4076
 
4064
4077
  // ../../build/common/esm/document/data-type/extended-types/date-time-string.type.js
4065
- import { vg as vg7 } from "valgen";
4078
+ import { vg as vg8 } from "valgen";
4066
4079
  var DateTimeStringType = class DateTimeStringType2 {
4067
4080
  static {
4068
4081
  __name(this, "DateTimeStringType");
@@ -4072,13 +4085,13 @@ var DateTimeStringType = class DateTimeStringType2 {
4072
4085
  Object.assign(this, attributes);
4073
4086
  }
4074
4087
  [DECODER](properties) {
4075
- const fn = vg7.isDateString({ coerce: true });
4088
+ const fn = vg8.isDateString({ coerce: true });
4076
4089
  const x = [];
4077
4090
  if (properties.minValue)
4078
- x.push(vg7.isGte(properties.minValue));
4091
+ x.push(vg8.isGte(properties.minValue));
4079
4092
  if (properties.maxValue)
4080
- x.push(vg7.isLte(properties.maxValue));
4081
- return x.length > 0 ? vg7.pipe([fn, ...x]) : fn;
4093
+ x.push(vg8.isLte(properties.maxValue));
4094
+ return x.length > 0 ? vg8.pipe([fn, ...x]) : fn;
4082
4095
  }
4083
4096
  [ENCODER](properties) {
4084
4097
  return this[DECODER](properties);
@@ -4108,7 +4121,7 @@ DateTimeStringType = __decorate([
4108
4121
  ], DateTimeStringType);
4109
4122
 
4110
4123
  // ../../build/common/esm/document/data-type/extended-types/email.type.js
4111
- import { vg as vg8 } from "valgen";
4124
+ import { vg as vg9 } from "valgen";
4112
4125
  var EmailType = class EmailType2 {
4113
4126
  static {
4114
4127
  __name(this, "EmailType");
@@ -4118,10 +4131,10 @@ var EmailType = class EmailType2 {
4118
4131
  Object.assign(this, attributes);
4119
4132
  }
4120
4133
  [DECODER](properties) {
4121
- return vg8.isEmail({ ...properties, coerce: true });
4134
+ return vg9.isEmail({ ...properties, coerce: true });
4122
4135
  }
4123
4136
  [ENCODER](properties) {
4124
- return vg8.isEmail({ ...properties, coerce: true });
4137
+ return vg9.isEmail({ ...properties, coerce: true });
4125
4138
  }
4126
4139
  };
4127
4140
  __decorate([
@@ -4196,7 +4209,7 @@ EmailType = __decorate([
4196
4209
  ], EmailType);
4197
4210
 
4198
4211
  // ../../build/common/esm/document/data-type/extended-types/field-path.type.js
4199
- import { toString as toString3, validator as validator2, vg as vg9 } from "valgen";
4212
+ import { toString as toString3, validator as validator2, vg as vg10 } from "valgen";
4200
4213
  var FieldPathType = class FieldPathType2 {
4201
4214
  static {
4202
4215
  __name(this, "FieldPathType");
@@ -4209,7 +4222,7 @@ var FieldPathType = class FieldPathType2 {
4209
4222
  const dataType = properties.dataType ? element.node.getComplexType(properties.dataType) : element.node.getComplexType("object");
4210
4223
  const allowSigns = properties.allowSigns;
4211
4224
  const decodeFieldPath = validator2("decodeFieldPath", (input) => dataType.normalizeFieldPath(input, { allowSigns }));
4212
- return vg9.pipe([toString3, decodeFieldPath]);
4225
+ return vg10.pipe([toString3, decodeFieldPath]);
4213
4226
  }
4214
4227
  [ENCODER](properties, element) {
4215
4228
  return this[DECODER](properties, element);
@@ -12163,7 +12176,7 @@ var encodeFilter = validator3("encodeFilter", (input, context, _this) => {
12163
12176
  });
12164
12177
 
12165
12178
  // ../../build/common/esm/document/data-type/extended-types/object-id.type.js
12166
- import { vg as vg10 } from "valgen";
12179
+ import { vg as vg11 } from "valgen";
12167
12180
  var ObjectIdType = class ObjectIdType2 {
12168
12181
  static {
12169
12182
  __name(this, "ObjectIdType");
@@ -12173,10 +12186,10 @@ var ObjectIdType = class ObjectIdType2 {
12173
12186
  Object.assign(this, attributes);
12174
12187
  }
12175
12188
  [DECODER]() {
12176
- return vg10.isObjectId({ coerce: true });
12189
+ return vg11.isObjectId({ coerce: true });
12177
12190
  }
12178
12191
  [ENCODER]() {
12179
- return vg10.isObjectId({ coerce: true });
12192
+ return vg11.isObjectId({ coerce: true });
12180
12193
  }
12181
12194
  };
12182
12195
  ObjectIdType = __decorate([
@@ -12259,7 +12272,7 @@ OperationResult = __decorate([
12259
12272
  })(OperationResult || (OperationResult = {}));
12260
12273
 
12261
12274
  // ../../build/common/esm/document/data-type/extended-types/time.type.js
12262
- import { vg as vg11 } from "valgen";
12275
+ import { vg as vg12 } from "valgen";
12263
12276
  var TIME_PATTERN2 = /^([0-1][0-9]|2[0-4]):([0-5][0-9])(?::([0-5][0-9]))?$/;
12264
12277
  var TimeType = class TimeType2 {
12265
12278
  static {
@@ -12270,16 +12283,16 @@ var TimeType = class TimeType2 {
12270
12283
  Object.assign(this, attributes);
12271
12284
  }
12272
12285
  [DECODER](properties) {
12273
- const fn = vg11.matches(TIME_PATTERN2, {
12286
+ const fn = vg12.matches(TIME_PATTERN2, {
12274
12287
  formatName: "time",
12275
12288
  coerce: true
12276
12289
  });
12277
12290
  const x = [];
12278
12291
  if (properties.minValue)
12279
- x.push(vg11.isGte(properties.minValue));
12292
+ x.push(vg12.isGte(properties.minValue));
12280
12293
  if (properties.maxValue)
12281
- x.push(vg11.isLte(properties.maxValue));
12282
- return x.length > 0 ? vg11.pipe([fn, ...x], { returnIndex: 0 }) : fn;
12294
+ x.push(vg12.isLte(properties.maxValue));
12295
+ return x.length > 0 ? vg12.pipe([fn, ...x], { returnIndex: 0 }) : fn;
12283
12296
  }
12284
12297
  [ENCODER](properties) {
12285
12298
  return this[DECODER](properties);
@@ -12309,7 +12322,7 @@ TimeType = __decorate([
12309
12322
  ], TimeType);
12310
12323
 
12311
12324
  // ../../build/common/esm/document/data-type/extended-types/url.type.js
12312
- import { vg as vg12 } from "valgen";
12325
+ import { vg as vg13 } from "valgen";
12313
12326
  var UrlType = class UrlType2 {
12314
12327
  static {
12315
12328
  __name(this, "UrlType");
@@ -12319,10 +12332,10 @@ var UrlType = class UrlType2 {
12319
12332
  Object.assign(this, attributes);
12320
12333
  }
12321
12334
  [DECODER]() {
12322
- return vg12.isURL({ coerce: true });
12335
+ return vg13.isURL({ coerce: true });
12323
12336
  }
12324
12337
  [ENCODER]() {
12325
- return vg12.isURL({ coerce: true });
12338
+ return vg13.isURL({ coerce: true });
12326
12339
  }
12327
12340
  };
12328
12341
  UrlType = __decorate([
@@ -12337,7 +12350,7 @@ UrlType = __decorate([
12337
12350
  ], UrlType);
12338
12351
 
12339
12352
  // ../../build/common/esm/document/data-type/extended-types/uuid.type.js
12340
- import { vg as vg13 } from "valgen";
12353
+ import { vg as vg14 } from "valgen";
12341
12354
  var UuidType = class UuidType2 {
12342
12355
  static {
12343
12356
  __name(this, "UuidType");
@@ -12347,10 +12360,10 @@ var UuidType = class UuidType2 {
12347
12360
  Object.assign(this, attributes);
12348
12361
  }
12349
12362
  [DECODER](properties) {
12350
- return vg13.isUUID(properties?.version, { coerce: true });
12363
+ return vg14.isUUID(properties?.version, { coerce: true });
12351
12364
  }
12352
12365
  [ENCODER](properties) {
12353
- return vg13.isUUID(properties?.version, { coerce: true });
12366
+ return vg14.isUUID(properties?.version, { coerce: true });
12354
12367
  }
12355
12368
  };
12356
12369
  __decorate([
@@ -12393,20 +12406,20 @@ function createMappedClass(source, config, options) {
12393
12406
  throw new TypeError(`Class "${source}" is not a ${OpraSchema.ComplexType.Kind}`);
12394
12407
  }
12395
12408
  }
12396
- const metadata2 = {
12409
+ const metadata = {
12397
12410
  ...options,
12398
12411
  kind: "MappedType",
12399
12412
  base: source
12400
12413
  };
12401
12414
  if (config.pick)
12402
- metadata2.pick = config.pick;
12415
+ metadata.pick = config.pick;
12403
12416
  if (config.omit)
12404
- metadata2.omit = config.omit;
12417
+ metadata.omit = config.omit;
12405
12418
  if (config.partial)
12406
- metadata2.partial = config.partial;
12419
+ metadata.partial = config.partial;
12407
12420
  if (config.required)
12408
- metadata2.required = config.required;
12409
- Reflect.defineMetadata(DATATYPE_METADATA, metadata2, MappedClass);
12421
+ metadata.required = config.required;
12422
+ Reflect.defineMetadata(DATATYPE_METADATA, metadata, MappedClass);
12410
12423
  if (typeof source === "function") {
12411
12424
  MappedType2._applyMixin(MappedClass, source, {
12412
12425
  ...config,
@@ -12438,7 +12451,7 @@ function PickType(baseType, keys, options) {
12438
12451
  __name(PickType, "PickType");
12439
12452
 
12440
12453
  // ../../build/common/esm/document/data-type/primitive-types/any.type.js
12441
- import { isAny as isAny2 } from "valgen";
12454
+ import { isAny as isAny3 } from "valgen";
12442
12455
  var AnyType = class AnyType2 {
12443
12456
  static {
12444
12457
  __name(this, "AnyType");
@@ -12448,10 +12461,10 @@ var AnyType = class AnyType2 {
12448
12461
  Object.assign(this, properties);
12449
12462
  }
12450
12463
  [DECODER]() {
12451
- return isAny2;
12464
+ return isAny3;
12452
12465
  }
12453
12466
  [ENCODER]() {
12454
- return isAny2;
12467
+ return isAny3;
12455
12468
  }
12456
12469
  };
12457
12470
  AnyType = __decorate([
@@ -12462,10 +12475,10 @@ AnyType = __decorate([
12462
12475
  ], AnyType);
12463
12476
 
12464
12477
  // ../../build/common/esm/document/data-type/primitive-types/bigint.type.js
12465
- import { toBigint, vg as vg15 } from "valgen";
12478
+ import { toBigint, vg as vg16 } from "valgen";
12466
12479
 
12467
12480
  // ../../build/common/esm/document/data-type/primitive-types/number.type.js
12468
- import { toNumber, vg as vg14 } from "valgen";
12481
+ import { toNumber, vg as vg15 } from "valgen";
12469
12482
  var NumberType = class NumberType2 {
12470
12483
  static {
12471
12484
  __name(this, "NumberType");
@@ -12477,10 +12490,10 @@ var NumberType = class NumberType2 {
12477
12490
  [DECODER](properties) {
12478
12491
  const x = [];
12479
12492
  if (properties.minValue)
12480
- x.push(vg14.isGte(properties.minValue));
12493
+ x.push(vg15.isGte(properties.minValue));
12481
12494
  if (properties.maxValue)
12482
- x.push(vg14.isLte(properties.maxValue));
12483
- return x.length > 0 ? vg14.pipe([toNumber, ...x], { returnIndex: 0 }) : toNumber;
12495
+ x.push(vg15.isLte(properties.maxValue));
12496
+ return x.length > 0 ? vg15.pipe([toNumber, ...x], { returnIndex: 0 }) : toNumber;
12484
12497
  }
12485
12498
  [ENCODER](properties) {
12486
12499
  return this[DECODER](properties);
@@ -12520,10 +12533,10 @@ var BigintType = class BigintType2 extends NumberType {
12520
12533
  [DECODER](properties) {
12521
12534
  const x = [];
12522
12535
  if (properties.minValue)
12523
- x.push(vg15.isGte(properties.minValue));
12536
+ x.push(vg16.isGte(properties.minValue));
12524
12537
  if (properties.maxValue)
12525
- x.push(vg15.isLte(properties.maxValue));
12526
- return x.length > 0 ? vg15.pipe([toBigint, ...x], { returnIndex: 0 }) : toBigint;
12538
+ x.push(vg16.isLte(properties.maxValue));
12539
+ return x.length > 0 ? vg16.pipe([toBigint, ...x], { returnIndex: 0 }) : toBigint;
12527
12540
  }
12528
12541
  [ENCODER](properties) {
12529
12542
  return this[DECODER](properties);
@@ -12569,7 +12582,7 @@ BooleanType = __decorate([
12569
12582
  ], BooleanType);
12570
12583
 
12571
12584
  // ../../build/common/esm/document/data-type/primitive-types/integer.type.js
12572
- import { toInteger, vg as vg16 } from "valgen";
12585
+ import { toInteger, vg as vg17 } from "valgen";
12573
12586
  var IntegerType = class IntegerType2 extends NumberType {
12574
12587
  static {
12575
12588
  __name(this, "IntegerType");
@@ -12580,10 +12593,10 @@ var IntegerType = class IntegerType2 extends NumberType {
12580
12593
  [DECODER](properties) {
12581
12594
  const x = [];
12582
12595
  if (properties.minValue)
12583
- x.push(vg16.isGte(properties.minValue));
12596
+ x.push(vg17.isGte(properties.minValue));
12584
12597
  if (properties.maxValue)
12585
- x.push(vg16.isLte(properties.maxValue));
12586
- return x.length > 0 ? vg16.pipe([toInteger, ...x], { returnIndex: 0 }) : toInteger;
12598
+ x.push(vg17.isLte(properties.maxValue));
12599
+ return x.length > 0 ? vg17.pipe([toInteger, ...x], { returnIndex: 0 }) : toInteger;
12587
12600
  }
12588
12601
  [ENCODER](properties) {
12589
12602
  return this[DECODER](properties);
@@ -12646,11 +12659,9 @@ ObjectType = __decorate([
12646
12659
  }),
12647
12660
  __metadata("design:paramtypes", [Object])
12648
12661
  ], ObjectType);
12649
- var metadata = Reflect.getMetadata(DATATYPE_METADATA, ObjectType);
12650
- metadata.ctor = Object;
12651
12662
 
12652
12663
  // ../../build/common/esm/document/data-type/primitive-types/string.type.js
12653
- import { toString as toString4, vg as vg17 } from "valgen";
12664
+ import { toString as toString4, vg as vg18 } from "valgen";
12654
12665
  var StringType = class StringType2 {
12655
12666
  static {
12656
12667
  __name(this, "StringType");
@@ -12667,13 +12678,13 @@ var StringType = class StringType2 {
12667
12678
  const meta = Reflect.getMetadata(DATATYPE_METADATA, Object.getPrototypeOf(this).constructor);
12668
12679
  formatName = meta.name;
12669
12680
  }
12670
- x.push(vg17.matches(properties.pattern, { formatName }));
12681
+ x.push(vg18.matches(properties.pattern, { formatName }));
12671
12682
  }
12672
12683
  if (properties.minLength)
12673
- x.push(vg17.lengthMin(properties.minLength));
12684
+ x.push(vg18.lengthMin(properties.minLength));
12674
12685
  if (properties.maxLength)
12675
- x.push(vg17.lengthMax(properties.maxLength));
12676
- return x.length > 0 ? vg17.pipe([toString4, ...x], { returnIndex: 0 }) : toString4;
12686
+ x.push(vg18.lengthMax(properties.maxLength));
12687
+ return x.length > 0 ? vg18.pipe([toString4, ...x], { returnIndex: 0 }) : toString4;
12677
12688
  }
12678
12689
  [ENCODER](properties) {
12679
12690
  return this[DECODER](properties);
@@ -12873,7 +12884,7 @@ HttpOperation2.Entity.FindMany = function(arg0, arg1) {
12873
12884
  contentType: MimeTypes.opra_response_json
12874
12885
  }).QueryParam("limit", {
12875
12886
  description: "Determines number of returning instances",
12876
- type: new IntegerType({ minValue: 1 })
12887
+ type: new IntegerType({ minValue: 1, maxValue: args.maxLimit })
12877
12888
  }).QueryParam("skip", {
12878
12889
  description: "Determines number of returning instances",
12879
12890
  type: new IntegerType({ minValue: 1 })
@@ -13107,11 +13118,11 @@ HttpOperation2.Entity.Update = function(arg0, arg1) {
13107
13118
  function getDataTypeName(typ) {
13108
13119
  if (typeof typ === "string")
13109
13120
  return typ;
13110
- const metadata2 = Reflect.getMetadata(DATATYPE_METADATA, typ);
13111
- if (!metadata2)
13121
+ const metadata = Reflect.getMetadata(DATATYPE_METADATA, typ);
13122
+ if (!metadata)
13112
13123
  throw new TypeError(`Type (${typ}) is not decorated with any datatype decorators`);
13113
- if (metadata2?.name)
13114
- return metadata2.name;
13124
+ if (metadata?.name)
13125
+ return metadata.name;
13115
13126
  throw new TypeError(`You should provide named data type but embedded one found`);
13116
13127
  }
13117
13128
  __name(getDataTypeName, "getDataTypeName");