@arcote.tech/arc-host 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../host.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,aAAa,EAElB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EAGvB,KAAK,4BAA4B,EAClC,MAAM,kBAAkB,CAAC;AAI1B,cAAM,OAAQ,YAAW,4BAA4B;IAMjD,OAAO,CAAC,OAAO;IALjB,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,SAAS,CAAoB;IACrC,OAAO,CAAC,KAAK,CAAuB;gBAG1B,OAAO,EAAE,aAAa,EAC9B,SAAS,EAAE,OAAO,CAAC,eAAe,CAAC;IASrC,aAAa,CAAC,OAAO,EAAE,kBAAkB,EAAE,GAAG,IAAI;IAI5C,IAAI,CACR,gBAAgB,EAAE,CAAC,EACjB,KAAK,EACL,IAAI,GACL,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;KACd,KAAK,IAAI,GACT,OAAO,CAAC,IAAI,CAAC;YAIF,eAAe;IAS7B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAU1B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAuB1B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAM7B;;OAEG;YACW,qBAAqB;IAWnC;;OAEG;IACH,OAAO,CAAC,iBAAiB;YAwCX,aAAa;YAoDb,WAAW;YAiEX,WAAW;IAgEzB,OAAO,CAAC,WAAW;IAmEnB,OAAO,CAAC,gBAAgB;YA4BV,UAAU;YA+CV,SAAS;IAevB,OAAO,CAAC,cAAc;CAGvB;AAED,eAAO,MAAM,cAAc,YACf,aAAa,aAAa,OAAO,CAAC,eAAe,CAAC,kBAE3D,CAAC"}
1
+ {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../host.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,aAAa,EAElB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EAGvB,KAAK,4BAA4B,EAClC,MAAM,kBAAkB,CAAC;AAI1B,cAAM,OAAQ,YAAW,4BAA4B;IAMjD,OAAO,CAAC,OAAO;IALjB,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,SAAS,CAAoB;IACrC,OAAO,CAAC,KAAK,CAAuB;gBAG1B,OAAO,EAAE,aAAa,EAC9B,SAAS,EAAE,OAAO,CAAC,eAAe,CAAC;IASrC,aAAa,CAAC,OAAO,EAAE,kBAAkB,EAAE,GAAG,IAAI;IAI5C,IAAI,CACR,gBAAgB,EAAE,CAAC,EACjB,KAAK,EACL,IAAI,GACL,EAAE;QACD,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;KACd,KAAK,IAAI,GACT,OAAO,CAAC,IAAI,CAAC;YAIF,eAAe;IAS7B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAU1B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAuB1B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAM7B;;OAEG;YACW,qBAAqB;IAWnC;;OAEG;IACH,OAAO,CAAC,iBAAiB;YAwCX,aAAa;YAoDb,WAAW;YAiEX,WAAW;IAgEzB,OAAO,CAAC,WAAW;IAoEnB,OAAO,CAAC,gBAAgB;YA4BV,UAAU;YA+CV,SAAS;IAevB,OAAO,CAAC,cAAc;CAGvB;AAED,eAAO,MAAM,cAAc,YACf,aAAa,aAAa,OAAO,CAAC,eAAe,CAAC,kBAE3D,CAAC"}
package/dist/index.js CHANGED
@@ -5019,9 +5019,15 @@ class ArcDefault {
5019
5019
 
5020
5020
  class ArcAbstract {
5021
5021
  validations;
5022
+ _description;
5022
5023
  constructor(validations = []) {
5023
5024
  this.validations = validations;
5024
5025
  }
5026
+ description(description) {
5027
+ const clone = this.clone();
5028
+ clone._description = description;
5029
+ return clone;
5030
+ }
5025
5031
  default(defaultValueOrCallback) {
5026
5032
  return new ArcDefault(this, defaultValueOrCallback);
5027
5033
  }
@@ -5034,6 +5040,7 @@ class ArcAbstract {
5034
5040
  clone() {
5035
5041
  const Constructor = this.constructor;
5036
5042
  const newInstance = Object.assign(new Constructor, this);
5043
+ newInstance._description = this._description;
5037
5044
  return newInstance;
5038
5045
  }
5039
5046
  validate(value) {
@@ -5056,7 +5063,11 @@ class ArcAbstract {
5056
5063
  return newInstance;
5057
5064
  }
5058
5065
  toJsonSchema() {
5059
- return {};
5066
+ const schema = {};
5067
+ if (this._description) {
5068
+ schema.description = this._description;
5069
+ }
5070
+ return schema;
5060
5071
  }
5061
5072
  getValidations() {
5062
5073
  return this.validations;
@@ -5174,7 +5185,11 @@ class ArcString extends ArcPrimitive {
5174
5185
  });
5175
5186
  }
5176
5187
  toJsonSchema() {
5177
- return { type: "string" };
5188
+ const schema = { type: "string" };
5189
+ if (this._description) {
5190
+ schema.description = this._description;
5191
+ }
5192
+ return schema;
5178
5193
  }
5179
5194
  url() {
5180
5195
  const regex = /^(https?):\/\/(?![-0-9])(?!www\.[0-9])(?:[a-zA-Z0-9-]+(?::[a-zA-Z0-9-]+)?@)?(?:localhost|\b(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b|[a-zA-Z0-9-]+\.)?[a-zA-Z0-9-]+\.(?:[a-zA-Z]{2,}|[a-zA-Z]{2}\.[a-zA-Z]{2})(?::\d{1,5})?(?!\/\/)(?:\/[a-zA-Z0-9-._~:?#\[\]@!$&'()*+,;=]*)*(?!\/{2})(?:;[a-zA-Z0-9-._~:?#\[\]@!$&'()*+,;=]*)*(\?(?!=)[a-zA-Z0-9&=;]*)?(\#[a-zA-Z0-9-]*)?$|^(https?):\/\/(localhost|\b(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b)(?::\d{1,5})?(?!\/\/)(?:\/[a-zA-Z0-9-._~:?#\[\]@!$&'()*+,;=]*)*(?!\/{2})(?:;[a-zA-Z0-9-._~:?#\[\]@!$&'()*+,;=]*)*(\?(?!=)[a-zA-Z0-9&=;]*)?(\#[a-zA-Z0-9-]*)?$/;
@@ -5313,6 +5328,10 @@ class ArcObject extends ArcAbstract {
5313
5328
  }
5314
5329
  serializePartial(value) {
5315
5330
  return Object.entries(value).reduce((acc, [key, value2]) => {
5331
+ if (!this.rawShape[key]) {
5332
+ console.warn(`No element found for key: ${key}`);
5333
+ return acc;
5334
+ }
5316
5335
  acc[key] = this.rawShape[key].serialize(value2);
5317
5336
  return acc;
5318
5337
  }, {});
@@ -5357,6 +5376,9 @@ class ArcObject extends ArcAbstract {
5357
5376
  };
5358
5377
  if (required.length)
5359
5378
  schema.required = required;
5379
+ if (this._description) {
5380
+ schema.description = this._description;
5381
+ }
5360
5382
  return schema;
5361
5383
  }
5362
5384
  }
@@ -5444,10 +5466,14 @@ class ArcArray extends ArcAbstract {
5444
5466
  return instance;
5445
5467
  }
5446
5468
  toJsonSchema() {
5447
- return {
5469
+ const schema = {
5448
5470
  type: "array",
5449
5471
  items: this.parent.toJsonSchema?.() ?? {}
5450
5472
  };
5473
+ if (this._description) {
5474
+ schema.description = this._description;
5475
+ }
5476
+ return schema;
5451
5477
  }
5452
5478
  }
5453
5479
  class ArcBoolean extends ArcPrimitive {
@@ -5464,7 +5490,11 @@ class ArcBoolean extends ArcPrimitive {
5464
5490
  return instance;
5465
5491
  }
5466
5492
  toJsonSchema() {
5467
- return { type: "boolean" };
5493
+ const schema = { type: "boolean" };
5494
+ if (this._description) {
5495
+ schema.description = this._description;
5496
+ }
5497
+ return schema;
5468
5498
  }
5469
5499
  }
5470
5500
  var dateValidator = typeValidatorBuilder("Date", (value) => value instanceof Date);
@@ -5502,10 +5532,14 @@ class ArcDate extends ArcAbstract {
5502
5532
  return instance;
5503
5533
  }
5504
5534
  toJsonSchema() {
5505
- return {
5535
+ const schema = {
5506
5536
  type: "string",
5507
5537
  format: "date-time"
5508
5538
  };
5539
+ if (this._description) {
5540
+ schema.description = this._description;
5541
+ }
5542
+ return schema;
5509
5543
  }
5510
5544
  }
5511
5545
  var numberValidator = typeValidatorBuilder("number");
@@ -5531,7 +5565,11 @@ class ArcNumber extends ArcPrimitive {
5531
5565
  return instance;
5532
5566
  }
5533
5567
  toJsonSchema() {
5534
- return { type: "number" };
5568
+ const schema = { type: "number" };
5569
+ if (this._description) {
5570
+ schema.description = this._description;
5571
+ }
5572
+ return schema;
5535
5573
  }
5536
5574
  }
5537
5575
  function getSQLiteType(element2) {
@@ -7063,7 +7101,8 @@ class RTCHost {
7063
7101
  perMessageDeflate: true,
7064
7102
  backpressureLimit: 16 * 1024 * 1024
7065
7103
  },
7066
- port: 5005
7104
+ port: 5005,
7105
+ idleTimeout: 30
7067
7106
  });
7068
7107
  }
7069
7108
  isPublicEndpoint(pathname) {
package/host.ts CHANGED
@@ -407,6 +407,7 @@ class RTCHost implements RealTimeCommunicationAdapter {
407
407
  backpressureLimit: 16 * 1024 * 1024,
408
408
  },
409
409
  port: 5005,
410
+ idleTimeout: 30,
410
411
  });
411
412
  }
412
413
 
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
7
- "version": "0.1.8",
7
+ "version": "0.1.9",
8
8
  "private": false,
9
9
  "author": "Przemysław Krasiński [arcote.tech]",
10
10
  "dependencies": {