@opra/common 1.0.0-alpha.12 → 1.0.0-alpha.13

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
@@ -2318,6 +2318,7 @@ var ApiBase = class extends DocumentElement {
2318
2318
  };
2319
2319
 
2320
2320
  // ../../build/common/esm/document/http/http-controller.js
2321
+ import nodePath from "node:path";
2321
2322
  import { asMutable as asMutable10 } from "ts-gems";
2322
2323
 
2323
2324
  // ../../build/common/esm/document/common/data-type-map.js
@@ -2573,8 +2574,7 @@ var HttpControllerClass = class extends DocumentElement {
2573
2574
  }
2574
2575
  }
2575
2576
  getFullUrl() {
2576
- const out = this.owner instanceof HttpController2 ? this.owner.getFullUrl() : "/";
2577
- return out + this.path;
2577
+ return nodePath.posix.join(this.owner instanceof HttpController2 ? this.owner.getFullUrl() : "/", this.path);
2578
2578
  }
2579
2579
  /**
2580
2580
  *
@@ -2771,7 +2771,7 @@ var HttpMultipartField = class extends HttpMediaType {
2771
2771
  };
2772
2772
 
2773
2773
  // ../../build/common/esm/document/http/http-operation.js
2774
- import nodePath from "node:path";
2774
+ import nodePath2 from "node:path";
2775
2775
  import { asMutable as asMutable12 } from "ts-gems";
2776
2776
 
2777
2777
  // ../../build/common/esm/document/decorators/http-operation.decorator.js
@@ -3094,6 +3094,9 @@ function HttpOperationDecoratorFactory(decoratorChain, options) {
3094
3094
  responseMeta.contentType = responseMeta.contentType || MimeTypes.opra_response_json;
3095
3095
  responseMeta.contentEncoding = responseMeta.contentEncoding || "utf-8";
3096
3096
  }
3097
+ if (responseMeta.contentType === MimeTypes.opra_response_json) {
3098
+ responseMeta.contentEncoding = responseMeta.contentEncoding || "utf-8";
3099
+ }
3097
3100
  decoratorChain.push((meta) => {
3098
3101
  meta.responses = meta.responses || [];
3099
3102
  meta.responses.push(responseMeta);
@@ -3176,6 +3179,7 @@ var HttpOperation2 = /* @__PURE__ */ __name(function(...args) {
3176
3179
  _this.types = _this.node[kDataTypeMap] = new DataTypeMap();
3177
3180
  _this.name = initArgs.name;
3178
3181
  _this.path = initArgs.path;
3182
+ _this.mergePath = initArgs.mergePath;
3179
3183
  _this.method = initArgs.method || "GET";
3180
3184
  _this.description = initArgs.description;
3181
3185
  _this.composition = initArgs.composition;
@@ -3202,7 +3206,15 @@ var HttpOperationClass = class extends DocumentElement {
3202
3206
  }
3203
3207
  getFullUrl() {
3204
3208
  const out = this.owner.getFullUrl();
3205
- return out ? this.path ? nodePath.posix.join(out, this.path) : out : this.path || "/";
3209
+ if (out) {
3210
+ if (this.path) {
3211
+ if (this.mergePath)
3212
+ return out + this.path;
3213
+ return nodePath2.posix.join(out, this.path);
3214
+ }
3215
+ return out;
3216
+ }
3217
+ return this.path || "/";
3206
3218
  }
3207
3219
  toJSON() {
3208
3220
  const out = omitUndefined({
@@ -3210,6 +3222,7 @@ var HttpOperationClass = class extends DocumentElement {
3210
3222
  description: this.description,
3211
3223
  method: this.method,
3212
3224
  path: this.path,
3225
+ mergePath: this.mergePath,
3213
3226
  composition: this.composition,
3214
3227
  requestBody: this.requestBody?.toJSON()
3215
3228
  });
@@ -3276,8 +3289,11 @@ var HttpStatusRange = class {
3276
3289
  this.end = m[2] ? parseInt(m[2], 10) : this.start;
3277
3290
  }
3278
3291
  }
3279
- get distance() {
3280
- return this.end - this.start;
3292
+ includes(statusCode) {
3293
+ return statusCode >= this.start && statusCode <= this.end;
3294
+ }
3295
+ intersects(start, end) {
3296
+ return end >= this.start && start <= this.end;
3281
3297
  }
3282
3298
  toString() {
3283
3299
  if (this.start === this.end)
@@ -3713,6 +3729,7 @@ var HttpApiFactory = class {
3713
3729
  };
3714
3730
 
3715
3731
  // ../../build/common/esm/document/api-document.js
3732
+ import crypto2 from "node:crypto";
3716
3733
  var _a2;
3717
3734
  var ApiDocument = class extends DocumentElement {
3718
3735
  static {
@@ -3785,6 +3802,12 @@ var ApiDocument = class extends DocumentElement {
3785
3802
  out.api = this.api.toJSON();
3786
3803
  return out;
3787
3804
  }
3805
+ invalidate() {
3806
+ const x = this.export();
3807
+ delete x.id;
3808
+ this.id = crypto2.createHash("md5").update(JSON.stringify(x)).digest("base64url");
3809
+ this[kTypeNSMap] = /* @__PURE__ */ new WeakMap();
3810
+ }
3788
3811
  _findDataType(nameOrCtor, visitedRefs) {
3789
3812
  let result = this.types.get(nameOrCtor);
3790
3813
  if (result || !this.references.size)
@@ -3829,8 +3852,20 @@ var ApiDocument = class extends DocumentElement {
3829
3852
  };
3830
3853
  _a2 = kTypeNSMap;
3831
3854
 
3855
+ // ../../node_modules/tslib/tslib.es6.mjs
3856
+ function __decorate(decorators, target, key, desc) {
3857
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3858
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3859
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3860
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
3861
+ }
3862
+ __name(__decorate, "__decorate");
3863
+ function __metadata(metadataKey, metadataValue) {
3864
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
3865
+ }
3866
+ __name(__metadata, "__metadata");
3867
+
3832
3868
  // ../../build/common/esm/document/data-type/extended-types/base64.type.js
3833
- import { __decorate, __metadata } from "tslib";
3834
3869
  import { vg as vg3 } from "valgen";
3835
3870
  var Base64Type = class Base64Type2 {
3836
3871
  static {
@@ -3859,7 +3894,6 @@ Base64Type = __decorate([
3859
3894
  ], Base64Type);
3860
3895
 
3861
3896
  // ../../build/common/esm/document/data-type/extended-types/date.type.js
3862
- import { __decorate as __decorate2, __metadata as __metadata2 } from "tslib";
3863
3897
  import { isDateString, toString, vg as vg4 } from "valgen";
3864
3898
  var DateType = class DateType2 {
3865
3899
  static {
@@ -3896,19 +3930,19 @@ var DateType = class DateType2 {
3896
3930
  return x.length > 0 ? vg4.pipe([fn, ...x], { returnIndex: 0 }) : fn;
3897
3931
  }
3898
3932
  };
3899
- __decorate2([
3933
+ __decorate([
3900
3934
  SimpleType2.Attribute({
3901
3935
  description: "Minimum value"
3902
3936
  }),
3903
- __metadata2("design:type", String)
3937
+ __metadata("design:type", String)
3904
3938
  ], DateType.prototype, "minValue", void 0);
3905
- __decorate2([
3939
+ __decorate([
3906
3940
  SimpleType2.Attribute({
3907
3941
  description: "Maximum value"
3908
3942
  }),
3909
- __metadata2("design:type", String)
3943
+ __metadata("design:type", String)
3910
3944
  ], DateType.prototype, "maxValue", void 0);
3911
- DateType = __decorate2([
3945
+ DateType = __decorate([
3912
3946
  SimpleType2({
3913
3947
  description: "A date without time",
3914
3948
  nameMappings: {
@@ -3916,11 +3950,10 @@ DateType = __decorate2([
3916
3950
  json: "string"
3917
3951
  }
3918
3952
  }).Example("2021-04-18", "Full date value"),
3919
- __metadata2("design:paramtypes", [Object])
3953
+ __metadata("design:paramtypes", [Object])
3920
3954
  ], DateType);
3921
3955
 
3922
3956
  // ../../build/common/esm/document/data-type/extended-types/date-string.type.js
3923
- import { __decorate as __decorate3, __metadata as __metadata3 } from "tslib";
3924
3957
  import { vg as vg5 } from "valgen";
3925
3958
  var DateStringType = class DateStringType2 {
3926
3959
  static {
@@ -3943,19 +3976,19 @@ var DateStringType = class DateStringType2 {
3943
3976
  return this[DECODER](properties);
3944
3977
  }
3945
3978
  };
3946
- __decorate3([
3979
+ __decorate([
3947
3980
  SimpleType2.Attribute({
3948
3981
  description: "Minimum value"
3949
3982
  }),
3950
- __metadata3("design:type", String)
3983
+ __metadata("design:type", String)
3951
3984
  ], DateStringType.prototype, "minValue", void 0);
3952
- __decorate3([
3985
+ __decorate([
3953
3986
  SimpleType2.Attribute({
3954
3987
  description: "Maximum value"
3955
3988
  }),
3956
- __metadata3("design:type", String)
3989
+ __metadata("design:type", String)
3957
3990
  ], DateStringType.prototype, "maxValue", void 0);
3958
- DateStringType = __decorate3([
3991
+ DateStringType = __decorate([
3959
3992
  SimpleType2({
3960
3993
  description: "Date string value",
3961
3994
  nameMappings: {
@@ -3963,11 +3996,10 @@ DateStringType = __decorate3([
3963
3996
  json: "string"
3964
3997
  }
3965
3998
  }).Example("2021-04-18", "Full date value").Example("2021-04", "Date value without day").Example("2021", "Year only value"),
3966
- __metadata3("design:paramtypes", [Object])
3999
+ __metadata("design:paramtypes", [Object])
3967
4000
  ], DateStringType);
3968
4001
 
3969
4002
  // ../../build/common/esm/document/data-type/extended-types/date-time.type.js
3970
- import { __decorate as __decorate4, __metadata as __metadata4 } from "tslib";
3971
4003
  import { isDateString as isDateString2, toString as toString2, vg as vg6 } from "valgen";
3972
4004
  var DateTimeType = class DateTimeType2 {
3973
4005
  static {
@@ -4004,19 +4036,19 @@ var DateTimeType = class DateTimeType2 {
4004
4036
  return x.length > 0 ? vg6.pipe([fn, ...x], { returnIndex: 0 }) : fn;
4005
4037
  }
4006
4038
  };
4007
- __decorate4([
4039
+ __decorate([
4008
4040
  SimpleType2.Attribute({
4009
4041
  description: "Minimum value"
4010
4042
  }),
4011
- __metadata4("design:type", String)
4043
+ __metadata("design:type", String)
4012
4044
  ], DateTimeType.prototype, "minValue", void 0);
4013
- __decorate4([
4045
+ __decorate([
4014
4046
  SimpleType2.Attribute({
4015
4047
  description: "Maximum value"
4016
4048
  }),
4017
- __metadata4("design:type", String)
4049
+ __metadata("design:type", String)
4018
4050
  ], DateTimeType.prototype, "maxValue", void 0);
4019
- DateTimeType = __decorate4([
4051
+ DateTimeType = __decorate([
4020
4052
  SimpleType2({
4021
4053
  description: "A full datetime value",
4022
4054
  nameMappings: {
@@ -4024,11 +4056,10 @@ DateTimeType = __decorate4([
4024
4056
  json: "string"
4025
4057
  }
4026
4058
  }).Example("2021-04-18T22:30:15").Example("2021-04-18 22:30:15").Example("2021-04-18 22:30"),
4027
- __metadata4("design:paramtypes", [Object])
4059
+ __metadata("design:paramtypes", [Object])
4028
4060
  ], DateTimeType);
4029
4061
 
4030
4062
  // ../../build/common/esm/document/data-type/extended-types/date-time-string.type.js
4031
- import { __decorate as __decorate5, __metadata as __metadata5 } from "tslib";
4032
4063
  import { vg as vg7 } from "valgen";
4033
4064
  var DateTimeStringType = class DateTimeStringType2 {
4034
4065
  static {
@@ -4051,19 +4082,19 @@ var DateTimeStringType = class DateTimeStringType2 {
4051
4082
  return this[DECODER](properties);
4052
4083
  }
4053
4084
  };
4054
- __decorate5([
4085
+ __decorate([
4055
4086
  SimpleType2.Attribute({
4056
4087
  description: "Minimum value"
4057
4088
  }),
4058
- __metadata5("design:type", String)
4089
+ __metadata("design:type", String)
4059
4090
  ], DateTimeStringType.prototype, "minValue", void 0);
4060
- __decorate5([
4091
+ __decorate([
4061
4092
  SimpleType2.Attribute({
4062
4093
  description: "Maximum value"
4063
4094
  }),
4064
- __metadata5("design:type", String)
4095
+ __metadata("design:type", String)
4065
4096
  ], DateTimeStringType.prototype, "maxValue", void 0);
4066
- DateTimeStringType = __decorate5([
4097
+ DateTimeStringType = __decorate([
4067
4098
  SimpleType2({
4068
4099
  description: "DateTime string value",
4069
4100
  nameMappings: {
@@ -4071,11 +4102,10 @@ DateTimeStringType = __decorate5([
4071
4102
  json: "string"
4072
4103
  }
4073
4104
  }).Example("2021-04-18T22:30:15+01:00", "Full date-time value with timezone").Example("2021-04-18T22:30:15", "Full date-time value without timezone").Example("2021-04-18 22:30", "Date-time value").Example("2021-04-18", "Date value").Example("2021-04", "Date value without day").Example("2021", "Year only value"),
4074
- __metadata5("design:paramtypes", [Object])
4105
+ __metadata("design:paramtypes", [Object])
4075
4106
  ], DateTimeStringType);
4076
4107
 
4077
4108
  // ../../build/common/esm/document/data-type/extended-types/email.type.js
4078
- import { __decorate as __decorate6, __metadata as __metadata6 } from "tslib";
4079
4109
  import { vg as vg8 } from "valgen";
4080
4110
  var EmailType = class EmailType2 {
4081
4111
  static {
@@ -4092,67 +4122,67 @@ var EmailType = class EmailType2 {
4092
4122
  return vg8.isEmail({ ...properties, coerce: true });
4093
4123
  }
4094
4124
  };
4095
- __decorate6([
4125
+ __decorate([
4096
4126
  SimpleType2.Attribute({
4097
4127
  description: "If set to `true`, the validator will also match `Display Name <email-address>",
4098
4128
  default: false
4099
4129
  }),
4100
- __metadata6("design:type", Boolean)
4130
+ __metadata("design:type", Boolean)
4101
4131
  ], EmailType.prototype, "allowDisplayName", void 0);
4102
- __decorate6([
4132
+ __decorate([
4103
4133
  SimpleType2.Attribute({
4104
4134
  description: "If set to `true`, the validator will reject strings without the format `Display Name <email-address>",
4105
4135
  default: false
4106
4136
  }),
4107
- __metadata6("design:type", Boolean)
4137
+ __metadata("design:type", Boolean)
4108
4138
  ], EmailType.prototype, "requireDisplayName", void 0);
4109
- __decorate6([
4139
+ __decorate([
4110
4140
  SimpleType2.Attribute({
4111
4141
  description: "If set to `false`, the validator will not allow any non-English UTF8 character in email address's local part",
4112
4142
  default: true
4113
4143
  }),
4114
- __metadata6("design:type", Boolean)
4144
+ __metadata("design:type", Boolean)
4115
4145
  ], EmailType.prototype, "utf8LocalPart", void 0);
4116
- __decorate6([
4146
+ __decorate([
4117
4147
  SimpleType2.Attribute({
4118
4148
  description: "If set to `true`, the validator will not check for the standard max length of an email",
4119
4149
  default: false
4120
4150
  }),
4121
- __metadata6("design:type", Boolean)
4151
+ __metadata("design:type", Boolean)
4122
4152
  ], EmailType.prototype, "ignoreMaxLength", void 0);
4123
- __decorate6([
4153
+ __decorate([
4124
4154
  SimpleType2.Attribute({
4125
4155
  description: "If set to `true`, the validator will allow IP addresses in the host part",
4126
4156
  default: false
4127
4157
  }),
4128
- __metadata6("design:type", Boolean)
4158
+ __metadata("design:type", Boolean)
4129
4159
  ], EmailType.prototype, "allowIpDomain", void 0);
4130
- __decorate6([
4160
+ __decorate([
4131
4161
  SimpleType2.Attribute({
4132
4162
  description: "If set to `true`, some additional validation will be enabled, e.g. disallowing certain syntactically valid email addresses that are rejected by GMail.",
4133
4163
  default: false
4134
4164
  }),
4135
- __metadata6("design:type", Boolean)
4165
+ __metadata("design:type", Boolean)
4136
4166
  ], EmailType.prototype, "domainSpecificValidation", void 0);
4137
- __decorate6([
4167
+ __decorate([
4138
4168
  SimpleType2.Attribute({
4139
4169
  description: "If set to an array of strings and the part of the email after the @ symbol one of the strings defined in it, the validation fails."
4140
4170
  }),
4141
- __metadata6("design:type", Array)
4171
+ __metadata("design:type", Array)
4142
4172
  ], EmailType.prototype, "hostBlacklist", void 0);
4143
- __decorate6([
4173
+ __decorate([
4144
4174
  SimpleType2.Attribute({
4145
4175
  description: "If set to an array of strings and the part of the email after the @ symbol matches none of the strings defined in it, the validation fails."
4146
4176
  }),
4147
- __metadata6("design:type", Array)
4177
+ __metadata("design:type", Array)
4148
4178
  ], EmailType.prototype, "hostWhitelist", void 0);
4149
- __decorate6([
4179
+ __decorate([
4150
4180
  SimpleType2.Attribute({
4151
4181
  description: "If set to a string, then the validator will reject emails that include any of the characters in the string, in the name part."
4152
4182
  }),
4153
- __metadata6("design:type", String)
4183
+ __metadata("design:type", String)
4154
4184
  ], EmailType.prototype, "blacklistedChars", void 0);
4155
- EmailType = __decorate6([
4185
+ EmailType = __decorate([
4156
4186
  SimpleType2({
4157
4187
  description: "An email value",
4158
4188
  nameMappings: {
@@ -4160,11 +4190,10 @@ EmailType = __decorate6([
4160
4190
  json: "string"
4161
4191
  }
4162
4192
  }).Example("some.body@example.com"),
4163
- __metadata6("design:paramtypes", [Object])
4193
+ __metadata("design:paramtypes", [Object])
4164
4194
  ], EmailType);
4165
4195
 
4166
4196
  // ../../build/common/esm/document/data-type/extended-types/field-path.type.js
4167
- import { __decorate as __decorate7, __metadata as __metadata7 } from "tslib";
4168
4197
  import { toString as toString3, validator as validator2, vg as vg9 } from "valgen";
4169
4198
  var FieldPathType = class FieldPathType2 {
4170
4199
  static {
@@ -4192,19 +4221,19 @@ var FieldPathType = class FieldPathType2 {
4192
4221
  };
4193
4222
  }
4194
4223
  };
4195
- __decorate7([
4224
+ __decorate([
4196
4225
  SimpleType2.Attribute({
4197
4226
  description: "Data type which field belong to"
4198
4227
  }),
4199
- __metadata7("design:type", Object)
4228
+ __metadata("design:type", Object)
4200
4229
  ], FieldPathType.prototype, "dataType", void 0);
4201
- __decorate7([
4230
+ __decorate([
4202
4231
  SimpleType2.Attribute({
4203
4232
  description: 'Determines if signs (+,-) are allowed. If set "first" signs are allowed only beginning of the field pathIf set "each" signs are allowed at each field in the path'
4204
4233
  }),
4205
- __metadata7("design:type", String)
4234
+ __metadata("design:type", String)
4206
4235
  ], FieldPathType.prototype, "allowSigns", void 0);
4207
- FieldPathType = __decorate7([
4236
+ FieldPathType = __decorate([
4208
4237
  SimpleType2({
4209
4238
  description: "Field path",
4210
4239
  nameMappings: {
@@ -4212,11 +4241,10 @@ FieldPathType = __decorate7([
4212
4241
  json: "string"
4213
4242
  }
4214
4243
  }),
4215
- __metadata7("design:paramtypes", [Object])
4244
+ __metadata("design:paramtypes", [Object])
4216
4245
  ], FieldPathType);
4217
4246
 
4218
4247
  // ../../build/common/esm/document/data-type/extended-types/filter.type.js
4219
- import { __decorate as __decorate8, __metadata as __metadata8 } from "tslib";
4220
4248
  import { validator as validator3 } from "valgen";
4221
4249
 
4222
4250
  // ../../build/common/esm/exception/opra-http-error.js
@@ -12088,20 +12116,20 @@ var FilterType = class FilterType2 {
12088
12116
  };
12089
12117
  }
12090
12118
  };
12091
- __decorate8([
12119
+ __decorate([
12092
12120
  SimpleType2.Attribute({
12093
12121
  description: "Data type which filtering fields belong to"
12094
12122
  }),
12095
- __metadata8("design:type", Object)
12123
+ __metadata("design:type", Object)
12096
12124
  ], FilterType.prototype, "dataType", void 0);
12097
- __decorate8([
12125
+ __decorate([
12098
12126
  SimpleType2.Attribute({
12099
12127
  description: "Stringified JSON object defines filtering rules",
12100
12128
  format: "string"
12101
12129
  }),
12102
- __metadata8("design:type", Object)
12130
+ __metadata("design:type", Object)
12103
12131
  ], FilterType.prototype, "rules", void 0);
12104
- FilterType = __decorate8([
12132
+ FilterType = __decorate([
12105
12133
  SimpleType2({
12106
12134
  description: "A query filter",
12107
12135
  nameMappings: {
@@ -12109,7 +12137,7 @@ FilterType = __decorate8([
12109
12137
  json: "string"
12110
12138
  }
12111
12139
  }),
12112
- __metadata8("design:paramtypes", [Object])
12140
+ __metadata("design:paramtypes", [Object])
12113
12141
  ], FilterType);
12114
12142
  var decodeFilter = /* @__PURE__ */ __name((dataType, rules) => validator3("decodeFilter", (input, context, _this) => {
12115
12143
  if (typeof input === "string") {
@@ -12133,7 +12161,6 @@ var encodeFilter = validator3("encodeFilter", (input, context, _this) => {
12133
12161
  });
12134
12162
 
12135
12163
  // ../../build/common/esm/document/data-type/extended-types/object-id.type.js
12136
- import { __decorate as __decorate9, __metadata as __metadata9 } from "tslib";
12137
12164
  import { vg as vg10 } from "valgen";
12138
12165
  var ObjectIdType = class ObjectIdType2 {
12139
12166
  static {
@@ -12150,7 +12177,7 @@ var ObjectIdType = class ObjectIdType2 {
12150
12177
  return vg10.isObjectId({ coerce: true });
12151
12178
  }
12152
12179
  };
12153
- ObjectIdType = __decorate9([
12180
+ ObjectIdType = __decorate([
12154
12181
  SimpleType2({
12155
12182
  description: "A MongoDB ObjectID value",
12156
12183
  nameMappings: {
@@ -12158,11 +12185,10 @@ ObjectIdType = __decorate9([
12158
12185
  json: "string"
12159
12186
  }
12160
12187
  }),
12161
- __metadata9("design:paramtypes", [Object])
12188
+ __metadata("design:paramtypes", [Object])
12162
12189
  ], ObjectIdType);
12163
12190
 
12164
12191
  // ../../build/common/esm/document/data-type/extended-types/operation-result.type.js
12165
- import { __decorate as __decorate10, __metadata as __metadata10 } from "tslib";
12166
12192
  var OperationResult = class OperationResult2 {
12167
12193
  static {
12168
12194
  __name(this, "OperationResult");
@@ -12172,39 +12198,39 @@ var OperationResult = class OperationResult2 {
12172
12198
  Object.assign(this, init);
12173
12199
  }
12174
12200
  };
12175
- __decorate10([
12201
+ __decorate([
12176
12202
  ApiField(),
12177
- __metadata10("design:type", Number)
12203
+ __metadata("design:type", Number)
12178
12204
  ], OperationResult.prototype, "affected", void 0);
12179
- __decorate10([
12205
+ __decorate([
12180
12206
  ApiField(),
12181
- __metadata10("design:type", Number)
12207
+ __metadata("design:type", Number)
12182
12208
  ], OperationResult.prototype, "totalMatches", void 0);
12183
- __decorate10([
12209
+ __decorate([
12184
12210
  ApiField(),
12185
- __metadata10("design:type", String)
12211
+ __metadata("design:type", String)
12186
12212
  ], OperationResult.prototype, "context", void 0);
12187
- __decorate10([
12213
+ __decorate([
12188
12214
  ApiField(),
12189
- __metadata10("design:type", String)
12215
+ __metadata("design:type", String)
12190
12216
  ], OperationResult.prototype, "type", void 0);
12191
- __decorate10([
12217
+ __decorate([
12192
12218
  ApiField(),
12193
- __metadata10("design:type", String)
12219
+ __metadata("design:type", String)
12194
12220
  ], OperationResult.prototype, "message", void 0);
12195
- __decorate10([
12221
+ __decorate([
12196
12222
  ApiField({ type: "any" }),
12197
- __metadata10("design:type", Object)
12223
+ __metadata("design:type", Object)
12198
12224
  ], OperationResult.prototype, "payload", void 0);
12199
- __decorate10([
12225
+ __decorate([
12200
12226
  ApiField({ type: "object" }),
12201
- __metadata10("design:type", Array)
12227
+ __metadata("design:type", Array)
12202
12228
  ], OperationResult.prototype, "errors", void 0);
12203
- OperationResult = __decorate10([
12229
+ OperationResult = __decorate([
12204
12230
  ComplexType2({
12205
12231
  description: "Operation result"
12206
12232
  }),
12207
- __metadata10("design:paramtypes", [Object])
12233
+ __metadata("design:paramtypes", [Object])
12208
12234
  ], OperationResult);
12209
12235
  (function(OperationResult3) {
12210
12236
  function forPayload(type) {
@@ -12216,13 +12242,13 @@ OperationResult = __decorate10([
12216
12242
  super(...args);
12217
12243
  }
12218
12244
  };
12219
- __decorate10([
12245
+ __decorate([
12220
12246
  ApiField({ type, required: true }),
12221
- __metadata10("design:type", Object)
12247
+ __metadata("design:type", Object)
12222
12248
  ], OperationResult_.prototype, "payload", void 0);
12223
- OperationResult_ = __decorate10([
12249
+ OperationResult_ = __decorate([
12224
12250
  ComplexType2({ embedded: true }),
12225
- __metadata10("design:paramtypes", [Object])
12251
+ __metadata("design:paramtypes", [Object])
12226
12252
  ], OperationResult_);
12227
12253
  return OperationResult_;
12228
12254
  }
@@ -12231,7 +12257,6 @@ OperationResult = __decorate10([
12231
12257
  })(OperationResult || (OperationResult = {}));
12232
12258
 
12233
12259
  // ../../build/common/esm/document/data-type/extended-types/time.type.js
12234
- import { __decorate as __decorate11, __metadata as __metadata11 } from "tslib";
12235
12260
  import { vg as vg11 } from "valgen";
12236
12261
  var TIME_PATTERN2 = /^([0-1][0-9]|2[0-4]):([0-5][0-9])(?::([0-5][0-9]))?$/;
12237
12262
  var TimeType = class TimeType2 {
@@ -12258,19 +12283,19 @@ var TimeType = class TimeType2 {
12258
12283
  return this[DECODER](properties);
12259
12284
  }
12260
12285
  };
12261
- __decorate11([
12286
+ __decorate([
12262
12287
  SimpleType2.Attribute({
12263
12288
  description: "Minimum value"
12264
12289
  }),
12265
- __metadata11("design:type", String)
12290
+ __metadata("design:type", String)
12266
12291
  ], TimeType.prototype, "minValue", void 0);
12267
- __decorate11([
12292
+ __decorate([
12268
12293
  SimpleType2.Attribute({
12269
12294
  description: "Maximum value"
12270
12295
  }),
12271
- __metadata11("design:type", String)
12296
+ __metadata("design:type", String)
12272
12297
  ], TimeType.prototype, "maxValue", void 0);
12273
- TimeType = __decorate11([
12298
+ TimeType = __decorate([
12274
12299
  SimpleType2({
12275
12300
  description: "Time string in 24h format",
12276
12301
  nameMappings: {
@@ -12278,11 +12303,10 @@ TimeType = __decorate11([
12278
12303
  json: "string"
12279
12304
  }
12280
12305
  }).Example("18:23:00", "Full time value").Example("18:23:00", "Time value without seconds"),
12281
- __metadata11("design:paramtypes", [Object])
12306
+ __metadata("design:paramtypes", [Object])
12282
12307
  ], TimeType);
12283
12308
 
12284
12309
  // ../../build/common/esm/document/data-type/extended-types/url.type.js
12285
- import { __decorate as __decorate12, __metadata as __metadata12 } from "tslib";
12286
12310
  import { vg as vg12 } from "valgen";
12287
12311
  var UrlType = class UrlType2 {
12288
12312
  static {
@@ -12299,7 +12323,7 @@ var UrlType = class UrlType2 {
12299
12323
  return vg12.isURL({ coerce: true });
12300
12324
  }
12301
12325
  };
12302
- UrlType = __decorate12([
12326
+ UrlType = __decorate([
12303
12327
  SimpleType2({
12304
12328
  description: "A Uniform Resource Identifier Reference (RFC 3986 icon) value",
12305
12329
  nameMappings: {
@@ -12307,11 +12331,10 @@ UrlType = __decorate12([
12307
12331
  json: "string"
12308
12332
  }
12309
12333
  }).Example("http://tempuri.org"),
12310
- __metadata12("design:paramtypes", [Object])
12334
+ __metadata("design:paramtypes", [Object])
12311
12335
  ], UrlType);
12312
12336
 
12313
12337
  // ../../build/common/esm/document/data-type/extended-types/uuid.type.js
12314
- import { __decorate as __decorate13, __metadata as __metadata13 } from "tslib";
12315
12338
  import { vg as vg13 } from "valgen";
12316
12339
  var UuidType = class UuidType2 {
12317
12340
  static {
@@ -12328,13 +12351,13 @@ var UuidType = class UuidType2 {
12328
12351
  return vg13.isUUID(properties?.version, { coerce: true });
12329
12352
  }
12330
12353
  };
12331
- __decorate13([
12354
+ __decorate([
12332
12355
  SimpleType2.Attribute({
12333
12356
  description: "Version of the UUID"
12334
12357
  }),
12335
- __metadata13("design:type", Number)
12358
+ __metadata("design:type", Number)
12336
12359
  ], UuidType.prototype, "version", void 0);
12337
- UuidType = __decorate13([
12360
+ UuidType = __decorate([
12338
12361
  SimpleType2({
12339
12362
  description: "A Universal Unique Identifier (UUID) value",
12340
12363
  nameMappings: {
@@ -12342,7 +12365,7 @@ UuidType = __decorate13([
12342
12365
  json: "string"
12343
12366
  }
12344
12367
  }),
12345
- __metadata13("design:paramtypes", [Object])
12368
+ __metadata("design:paramtypes", [Object])
12346
12369
  ], UuidType);
12347
12370
 
12348
12371
  // ../../build/common/esm/document/data-type/utils/create-mapped-class.js
@@ -12413,7 +12436,6 @@ function PickType(baseType, keys, options) {
12413
12436
  __name(PickType, "PickType");
12414
12437
 
12415
12438
  // ../../build/common/esm/document/data-type/primitive-types/any.type.js
12416
- import { __decorate as __decorate14, __metadata as __metadata14 } from "tslib";
12417
12439
  import { isAny as isAny2 } from "valgen";
12418
12440
  var AnyType = class AnyType2 {
12419
12441
  static {
@@ -12430,19 +12452,17 @@ var AnyType = class AnyType2 {
12430
12452
  return isAny2;
12431
12453
  }
12432
12454
  };
12433
- AnyType = __decorate14([
12455
+ AnyType = __decorate([
12434
12456
  SimpleType2({
12435
12457
  description: "Represents any value"
12436
12458
  }),
12437
- __metadata14("design:paramtypes", [Object])
12459
+ __metadata("design:paramtypes", [Object])
12438
12460
  ], AnyType);
12439
12461
 
12440
12462
  // ../../build/common/esm/document/data-type/primitive-types/bigint.type.js
12441
- import { __decorate as __decorate16, __metadata as __metadata16 } from "tslib";
12442
12463
  import { toBigint, vg as vg15 } from "valgen";
12443
12464
 
12444
12465
  // ../../build/common/esm/document/data-type/primitive-types/number.type.js
12445
- import { __decorate as __decorate15, __metadata as __metadata15 } from "tslib";
12446
12466
  import { toNumber, vg as vg14 } from "valgen";
12447
12467
  var NumberType = class NumberType2 {
12448
12468
  static {
@@ -12464,19 +12484,19 @@ var NumberType = class NumberType2 {
12464
12484
  return this[DECODER](properties);
12465
12485
  }
12466
12486
  };
12467
- __decorate15([
12487
+ __decorate([
12468
12488
  SimpleType2.Attribute({
12469
12489
  description: "Determines the minimum value"
12470
12490
  }),
12471
- __metadata15("design:type", Number)
12491
+ __metadata("design:type", Number)
12472
12492
  ], NumberType.prototype, "minValue", void 0);
12473
- __decorate15([
12493
+ __decorate([
12474
12494
  SimpleType2.Attribute({
12475
12495
  description: "Determines the maximum value"
12476
12496
  }),
12477
- __metadata15("design:type", Number)
12497
+ __metadata("design:type", Number)
12478
12498
  ], NumberType.prototype, "maxValue", void 0);
12479
- NumberType = __decorate15([
12499
+ NumberType = __decorate([
12480
12500
  SimpleType2({
12481
12501
  description: "Both Integer as well as Floating-Point numbers",
12482
12502
  nameMappings: {
@@ -12484,7 +12504,7 @@ NumberType = __decorate15([
12484
12504
  json: "number"
12485
12505
  }
12486
12506
  }),
12487
- __metadata15("design:paramtypes", [Object])
12507
+ __metadata("design:paramtypes", [Object])
12488
12508
  ], NumberType);
12489
12509
 
12490
12510
  // ../../build/common/esm/document/data-type/primitive-types/bigint.type.js
@@ -12507,7 +12527,7 @@ var BigintType = class BigintType2 extends NumberType {
12507
12527
  return this[DECODER](properties);
12508
12528
  }
12509
12529
  };
12510
- BigintType = __decorate16([
12530
+ BigintType = __decorate([
12511
12531
  SimpleType2({
12512
12532
  description: "BigInt number",
12513
12533
  nameMappings: {
@@ -12515,11 +12535,10 @@ BigintType = __decorate16([
12515
12535
  json: "string"
12516
12536
  }
12517
12537
  }),
12518
- __metadata16("design:paramtypes", [Object])
12538
+ __metadata("design:paramtypes", [Object])
12519
12539
  ], BigintType);
12520
12540
 
12521
12541
  // ../../build/common/esm/document/data-type/primitive-types/boolean.type.js
12522
- import { __decorate as __decorate17, __metadata as __metadata17 } from "tslib";
12523
12542
  import { toBoolean } from "valgen";
12524
12543
  var BooleanType = class BooleanType2 {
12525
12544
  static {
@@ -12536,7 +12555,7 @@ var BooleanType = class BooleanType2 {
12536
12555
  return toBoolean;
12537
12556
  }
12538
12557
  };
12539
- BooleanType = __decorate17([
12558
+ BooleanType = __decorate([
12540
12559
  SimpleType2({
12541
12560
  description: "Simple true/false value",
12542
12561
  nameMappings: {
@@ -12544,11 +12563,10 @@ BooleanType = __decorate17([
12544
12563
  json: "boolean"
12545
12564
  }
12546
12565
  }),
12547
- __metadata17("design:paramtypes", [Object])
12566
+ __metadata("design:paramtypes", [Object])
12548
12567
  ], BooleanType);
12549
12568
 
12550
12569
  // ../../build/common/esm/document/data-type/primitive-types/integer.type.js
12551
- import { __decorate as __decorate18, __metadata as __metadata18 } from "tslib";
12552
12570
  import { toInteger, vg as vg16 } from "valgen";
12553
12571
  var IntegerType = class IntegerType2 extends NumberType {
12554
12572
  static {
@@ -12569,7 +12587,7 @@ var IntegerType = class IntegerType2 extends NumberType {
12569
12587
  return this[DECODER](properties);
12570
12588
  }
12571
12589
  };
12572
- IntegerType = __decorate18([
12590
+ IntegerType = __decorate([
12573
12591
  SimpleType2({
12574
12592
  description: "An integer number",
12575
12593
  nameMappings: {
@@ -12577,11 +12595,10 @@ IntegerType = __decorate18([
12577
12595
  json: "number"
12578
12596
  }
12579
12597
  }),
12580
- __metadata18("design:paramtypes", [Object])
12598
+ __metadata("design:paramtypes", [Object])
12581
12599
  ], IntegerType);
12582
12600
 
12583
12601
  // ../../build/common/esm/document/data-type/primitive-types/null.type.js
12584
- import { __decorate as __decorate19, __metadata as __metadata19 } from "tslib";
12585
12602
  import { isNull } from "valgen";
12586
12603
  var NullType = class NullType2 {
12587
12604
  static {
@@ -12598,7 +12615,7 @@ var NullType = class NullType2 {
12598
12615
  return isNull;
12599
12616
  }
12600
12617
  };
12601
- NullType = __decorate19([
12618
+ NullType = __decorate([
12602
12619
  SimpleType2({
12603
12620
  description: "A Null value",
12604
12621
  nameMappings: {
@@ -12606,11 +12623,10 @@ NullType = __decorate19([
12606
12623
  json: "null"
12607
12624
  }
12608
12625
  }),
12609
- __metadata19("design:paramtypes", [Object])
12626
+ __metadata("design:paramtypes", [Object])
12610
12627
  ], NullType);
12611
12628
 
12612
12629
  // ../../build/common/esm/document/data-type/primitive-types/object.type.js
12613
- import { __decorate as __decorate20, __metadata as __metadata20 } from "tslib";
12614
12630
  var ObjectType = class ObjectType2 {
12615
12631
  static {
12616
12632
  __name(this, "ObjectType");
@@ -12620,19 +12636,18 @@ var ObjectType = class ObjectType2 {
12620
12636
  Object.assign(this, properties);
12621
12637
  }
12622
12638
  };
12623
- ObjectType = __decorate20([
12639
+ ObjectType = __decorate([
12624
12640
  ComplexType2({
12625
12641
  name: "object",
12626
12642
  description: "A non modelled object",
12627
12643
  additionalFields: true
12628
12644
  }),
12629
- __metadata20("design:paramtypes", [Object])
12645
+ __metadata("design:paramtypes", [Object])
12630
12646
  ], ObjectType);
12631
12647
  var metadata = Reflect.getMetadata(DATATYPE_METADATA, ObjectType);
12632
12648
  metadata.ctor = Object;
12633
12649
 
12634
12650
  // ../../build/common/esm/document/data-type/primitive-types/string.type.js
12635
- import { __decorate as __decorate21, __metadata as __metadata21 } from "tslib";
12636
12651
  import { toString as toString4, vg as vg17 } from "valgen";
12637
12652
  var StringType = class StringType2 {
12638
12653
  static {
@@ -12662,31 +12677,31 @@ var StringType = class StringType2 {
12662
12677
  return this[DECODER](properties);
12663
12678
  }
12664
12679
  };
12665
- __decorate21([
12680
+ __decorate([
12666
12681
  SimpleType2.Attribute({
12667
12682
  description: "Regex pattern to be used for validation"
12668
12683
  }),
12669
- __metadata21("design:type", Object)
12684
+ __metadata("design:type", Object)
12670
12685
  ], StringType.prototype, "pattern", void 0);
12671
- __decorate21([
12686
+ __decorate([
12672
12687
  SimpleType2.Attribute({
12673
12688
  description: "Name of the pattern"
12674
12689
  }),
12675
- __metadata21("design:type", String)
12690
+ __metadata("design:type", String)
12676
12691
  ], StringType.prototype, "patternName", void 0);
12677
- __decorate21([
12692
+ __decorate([
12678
12693
  SimpleType2.Attribute({
12679
12694
  description: "Minimum number of characters"
12680
12695
  }),
12681
- __metadata21("design:type", Number)
12696
+ __metadata("design:type", Number)
12682
12697
  ], StringType.prototype, "minLength", void 0);
12683
- __decorate21([
12698
+ __decorate([
12684
12699
  SimpleType2.Attribute({
12685
12700
  description: "Minimum number of characters"
12686
12701
  }),
12687
- __metadata21("design:type", Number)
12702
+ __metadata("design:type", Number)
12688
12703
  ], StringType.prototype, "maxLength", void 0);
12689
- StringType = __decorate21([
12704
+ StringType = __decorate([
12690
12705
  SimpleType2({
12691
12706
  description: "A sequence of characters",
12692
12707
  nameMappings: {
@@ -12694,7 +12709,7 @@ StringType = __decorate21([
12694
12709
  json: "string"
12695
12710
  }
12696
12711
  }),
12697
- __metadata21("design:paramtypes", [Object])
12712
+ __metadata("design:paramtypes", [Object])
12698
12713
  ], StringType);
12699
12714
 
12700
12715
  // ../../build/common/esm/document/data-type/required-type.js
@@ -12741,8 +12756,6 @@ HttpOperation2.Entity.Create = function(arg0, arg1) {
12741
12756
  description: "The request was well-formed but was unable to process operation due to one or many errors.",
12742
12757
  contentType: MimeTypes.opra_response_json
12743
12758
  });
12744
- if (typeof args.type === "function")
12745
- decorator.UseType(args.type);
12746
12759
  decoratorChain.push((operationMeta) => {
12747
12760
  const compositionOptions = operationMeta.compositionOptions = operationMeta.compositionOptions || {};
12748
12761
  compositionOptions.type = getDataTypeName(args.type);
@@ -12768,8 +12781,6 @@ HttpOperation2.Entity.Delete = function(arg0, arg1) {
12768
12781
  description: "The request was well-formed but was unable to process operation due to one or many errors.",
12769
12782
  contentType: MimeTypes.opra_response_json
12770
12783
  });
12771
- if (typeof args.type === "function")
12772
- decorator.UseType(args.type);
12773
12784
  decorator.KeyParam = (name, prmOptions) => {
12774
12785
  const paramMeta = typeof prmOptions === "string" || typeof prmOptions === "function" ? {
12775
12786
  name,
@@ -12786,6 +12797,7 @@ HttpOperation2.Entity.Delete = function(arg0, arg1) {
12786
12797
  decoratorChain.push((meta) => {
12787
12798
  if (!meta.path?.includes(":" + name))
12788
12799
  meta.path = (meta.path || "") + "@:" + name;
12800
+ meta.mergePath = true;
12789
12801
  });
12790
12802
  return decorator;
12791
12803
  };
@@ -12820,8 +12832,6 @@ HttpOperation2.Entity.DeleteMany = function(arg0, arg1) {
12820
12832
  type: filterType,
12821
12833
  description: "Determines filter fields"
12822
12834
  });
12823
- if (typeof args.type === "function")
12824
- decorator.UseType(args.type);
12825
12835
  decoratorChain.push((operationMeta) => {
12826
12836
  const compositionOptions = operationMeta.compositionOptions = operationMeta.compositionOptions || {};
12827
12837
  compositionOptions.type = getDataTypeName(args.type);
@@ -12888,8 +12898,6 @@ HttpOperation2.Entity.FindMany = function(arg0, arg1) {
12888
12898
  isArray: true,
12889
12899
  arraySeparator: ","
12890
12900
  });
12891
- if (typeof args.type === "function")
12892
- decorator.UseType(args.type);
12893
12901
  decoratorChain.push((operationMeta) => {
12894
12902
  const compositionOptions = operationMeta.compositionOptions = operationMeta.compositionOptions || {};
12895
12903
  compositionOptions.type = getDataTypeName(args.type);
@@ -12948,8 +12956,6 @@ HttpOperation2.Entity.Get = function(arg0, arg1) {
12948
12956
  description: "The request was well-formed but was unable to process operation due to one or many errors.",
12949
12957
  contentType: MimeTypes.opra_response_json
12950
12958
  });
12951
- if (typeof args.type === "function")
12952
- decorator.UseType(args.type);
12953
12959
  decorator.KeyParam = (name, prmOptions) => {
12954
12960
  const paramMeta = typeof prmOptions === "string" || typeof prmOptions === "function" ? {
12955
12961
  name,
@@ -12966,6 +12972,7 @@ HttpOperation2.Entity.Get = function(arg0, arg1) {
12966
12972
  decoratorChain.push((meta) => {
12967
12973
  if (!meta.path?.includes(":" + name))
12968
12974
  meta.path = (meta.path || "") + "@:" + name;
12975
+ meta.mergePath = true;
12969
12976
  });
12970
12977
  return decorator;
12971
12978
  };
@@ -12996,10 +13003,7 @@ HttpOperation2.Entity.UpdateMany = function(arg0, arg1) {
12996
13003
  required: true
12997
13004
  }
12998
13005
  }));
12999
- decorator.RequestContent(args.requestBody?.type || args.type);
13000
- if (typeof args.type === "function")
13001
- decorator.UseType(args.type);
13002
- decorator.Response(HttpStatusCode.OK, {
13006
+ decorator.RequestContent(args.requestBody?.type || args.type).Response(HttpStatusCode.OK, {
13003
13007
  description: 'Operation is successful. Returns OperationResult with "affected" field.',
13004
13008
  contentType: MimeTypes.opra_response_json
13005
13009
  }).Response(HttpStatusCode.UNPROCESSABLE_ENTITY, {
@@ -13065,8 +13069,6 @@ HttpOperation2.Entity.Update = function(arg0, arg1) {
13065
13069
  description: "The request was well-formed but was unable to process operation due to one or many errors.",
13066
13070
  contentType: MimeTypes.opra_response_json
13067
13071
  });
13068
- if (typeof args.type === "function")
13069
- decorator.UseType(args.type);
13070
13072
  decorator.KeyParam = (name, prmOptions) => {
13071
13073
  const paramMeta = typeof prmOptions === "string" || typeof prmOptions === "function" ? {
13072
13074
  name,
@@ -13083,6 +13085,7 @@ HttpOperation2.Entity.Update = function(arg0, arg1) {
13083
13085
  decoratorChain.push((meta) => {
13084
13086
  if (!meta.path?.includes(":" + name))
13085
13087
  meta.path = (meta.path || "") + "@:" + name;
13088
+ meta.mergePath = true;
13086
13089
  });
13087
13090
  return decorator;
13088
13091
  };
@@ -13112,8 +13115,6 @@ function getDataTypeName(typ) {
13112
13115
  __name(getDataTypeName, "getDataTypeName");
13113
13116
 
13114
13117
  // ../../build/common/esm/document/factory/api-document.factory.js
13115
- import crypto2 from "node:crypto";
13116
- import { asMutable as asMutable15 } from "ts-gems";
13117
13118
  var OPRA_SPEC_URL = "https://oprajs.com/spec/v" + OpraSchema.SpecVersion;
13118
13119
  var ApiDocumentFactory = class _ApiDocumentFactory {
13119
13120
  static {
@@ -13194,7 +13195,8 @@ var ApiDocumentFactory = class _ApiDocumentFactory {
13194
13195
  if (builtinDocument)
13195
13196
  refDoc.references.set("opra", builtinDocument);
13196
13197
  await this.initDocument(refDoc, context, r);
13197
- document.references.set(ns, refDoc);
13198
+ const preDoc = document.findDocument(refDoc.id);
13199
+ document.references.set(ns, preDoc || refDoc);
13198
13200
  });
13199
13201
  }
13200
13202
  });
@@ -13214,8 +13216,7 @@ var ApiDocumentFactory = class _ApiDocumentFactory {
13214
13216
  context.addError(`Unknown service protocol (${init.api.protocol})`);
13215
13217
  });
13216
13218
  }
13217
- const x = document.export();
13218
- asMutable15(document).id = crypto2.createHash("md5").update(JSON.stringify(x)).digest("base64url");
13219
+ document.invalidate();
13219
13220
  }
13220
13221
  /**
13221
13222
  *