@vandenberghinc/volt 1.1.3 → 1.1.5

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.
@@ -99,7 +99,8 @@ class Collection {
99
99
  if (this.ttl_enabled) {
100
100
  this.col.dropIndex("_ttl_timestamp_1")
101
101
  .catch(err => {
102
- if (err.codeName !== 'IndexNotFound') {
102
+ if (err.codeName !== 'IndexNotFound' && err.codeName !== 'NamespaceNotFound') {
103
+ err.stack = new Error(err.message).stack;
103
104
  throw err;
104
105
  }
105
106
  })
@@ -1848,7 +1849,13 @@ class Database {
1848
1849
  }
1849
1850
  // Initialize client.
1850
1851
  if (this.uri) {
1851
- this.client = new mongodb_1.MongoClient(this.uri, this.client_opts || {});
1852
+ const opts = this.client_opts ?? {};
1853
+ opts.serverApi ??= {
1854
+ version: mongodb_1.ServerApiVersion.v1,
1855
+ strict: true,
1856
+ deprecationErrors: true,
1857
+ };
1858
+ this.client = new mongodb_1.MongoClient(this.uri, opts);
1852
1859
  }
1853
1860
  // Connect.
1854
1861
  await this.connect();
@@ -196,7 +196,7 @@ class FileWatcher {
196
196
  // Check if the excluded paths exist for user mistakes, these happen often.
197
197
  this.excluded.forEach(path => {
198
198
  if (!new _vinc_1.vlib.Path(path).exists()) {
199
- logger_js_1.logger.warn(0, this.log_source, `Excluded file watcher path ${path} does not exist.`);
199
+ logger_js_1.logger.warn(1, this.log_source, `Excluded file watcher path ${path} does not exist.`);
200
200
  }
201
201
  });
202
202
  // Attributes.
@@ -224,7 +224,7 @@ class FileWatcher {
224
224
  this.excluded.push(add);
225
225
  }
226
226
  catch (e) {
227
- logger_js_1.logger.warn(0, this.log_source, `Excluded file watcher path ${path.toString()} does not exist.`);
227
+ logger_js_1.logger.warn(1, this.log_source, `Excluded file watcher path ${path.toString()} does not exist.`);
228
228
  }
229
229
  }
230
230
  // Start.
@@ -6,7 +6,7 @@
6
6
  // Libraries.
7
7
  import { spawn } from "child_process";
8
8
  import { deserialize, serialize } from "bson";
9
- import { MongoClient } from 'mongodb';
9
+ import { MongoClient, ServerApiVersion } from 'mongodb';
10
10
  import { logger, LogSource } from "./logger.js";
11
11
  import { vlib } from "./vinc.js";
12
12
  const log_source = new LogSource("Database");
@@ -96,7 +96,8 @@ class Collection {
96
96
  if (this.ttl_enabled) {
97
97
  this.col.dropIndex("_ttl_timestamp_1")
98
98
  .catch(err => {
99
- if (err.codeName !== 'IndexNotFound') {
99
+ if (err.codeName !== 'IndexNotFound' && err.codeName !== 'NamespaceNotFound') {
100
+ err.stack = new Error(err.message).stack;
100
101
  throw err;
101
102
  }
102
103
  })
@@ -1843,7 +1844,13 @@ class Database {
1843
1844
  }
1844
1845
  // Initialize client.
1845
1846
  if (this.uri) {
1846
- this.client = new MongoClient(this.uri, this.client_opts || {});
1847
+ const opts = this.client_opts ?? {};
1848
+ opts.serverApi ??= {
1849
+ version: ServerApiVersion.v1,
1850
+ strict: true,
1851
+ deprecationErrors: true,
1852
+ };
1853
+ this.client = new MongoClient(this.uri, opts);
1847
1854
  }
1848
1855
  // Connect.
1849
1856
  await this.connect();
@@ -159,7 +159,7 @@ class FileWatcher {
159
159
  // Check if the excluded paths exist for user mistakes, these happen often.
160
160
  this.excluded.forEach(path => {
161
161
  if (!new vlib.Path(path).exists()) {
162
- logger.warn(0, this.log_source, `Excluded file watcher path ${path} does not exist.`);
162
+ logger.warn(1, this.log_source, `Excluded file watcher path ${path} does not exist.`);
163
163
  }
164
164
  });
165
165
  // Attributes.
@@ -187,7 +187,7 @@ class FileWatcher {
187
187
  this.excluded.push(add);
188
188
  }
189
189
  catch (e) {
190
- logger.warn(0, this.log_source, `Excluded file watcher path ${path.toString()} does not exist.`);
190
+ logger.warn(1, this.log_source, `Excluded file watcher path ${path.toString()} does not exist.`);
191
191
  }
192
192
  }
193
193
  // Start.
@@ -6,7 +6,7 @@
6
6
  // Libraries.
7
7
  import { spawn } from "child_process";
8
8
  import { deserialize, serialize } from "bson";
9
- import { MongoClient } from 'mongodb';
9
+ import { MongoClient, ServerApiVersion } from 'mongodb';
10
10
  import { logger, LogSource } from "./logger.js";
11
11
  import { vlib } from "/Users/administrator/persistance/private/dev/vinc/volt/backend/./src/vinc.dev.js";
12
12
  const log_source = new LogSource("Database");
@@ -96,7 +96,8 @@ class Collection {
96
96
  if (this.ttl_enabled) {
97
97
  this.col.dropIndex("_ttl_timestamp_1")
98
98
  .catch(err => {
99
- if (err.codeName !== 'IndexNotFound') {
99
+ if (err.codeName !== 'IndexNotFound' && err.codeName !== 'NamespaceNotFound') {
100
+ err.stack = new Error(err.message).stack;
100
101
  throw err;
101
102
  }
102
103
  })
@@ -1843,7 +1844,13 @@ class Database {
1843
1844
  }
1844
1845
  // Initialize client.
1845
1846
  if (this.uri) {
1846
- this.client = new MongoClient(this.uri, this.client_opts || {});
1847
+ const opts = this.client_opts ?? {};
1848
+ opts.serverApi ??= {
1849
+ version: ServerApiVersion.v1,
1850
+ strict: true,
1851
+ deprecationErrors: true,
1852
+ };
1853
+ this.client = new MongoClient(this.uri, opts);
1847
1854
  }
1848
1855
  // Connect.
1849
1856
  await this.connect();
@@ -159,7 +159,7 @@ class FileWatcher {
159
159
  // Check if the excluded paths exist for user mistakes, these happen often.
160
160
  this.excluded.forEach(path => {
161
161
  if (!new vlib.Path(path).exists()) {
162
- logger.warn(0, this.log_source, `Excluded file watcher path ${path} does not exist.`);
162
+ logger.warn(1, this.log_source, `Excluded file watcher path ${path} does not exist.`);
163
163
  }
164
164
  });
165
165
  // Attributes.
@@ -187,7 +187,7 @@ class FileWatcher {
187
187
  this.excluded.push(add);
188
188
  }
189
189
  catch (e) {
190
- logger.warn(0, this.log_source, `Excluded file watcher path ${path.toString()} does not exist.`);
190
+ logger.warn(1, this.log_source, `Excluded file watcher path ${path.toString()} does not exist.`);
191
191
  }
192
192
  }
193
193
  // Start.
@@ -9,7 +9,7 @@
9
9
  import { ChildProcess, spawn } from "child_process";
10
10
  import { deserialize, serialize } from "bson";
11
11
  import { Transform } from 'stream';
12
- import { MongoClient, Collection as MongoCollection, ObjectId } from 'mongodb';
12
+ import { MongoClient, Collection as MongoCollection, ObjectId, ServerApiVersion } from 'mongodb';
13
13
  import { logger, LogSource } from "./logger.js";
14
14
  import { Status } from "./status.js";
15
15
  import { vlib } from "@vinc";
@@ -120,7 +120,8 @@ class Collection {
120
120
  if (this.ttl_enabled) {
121
121
  this.col.dropIndex("_ttl_timestamp_1")
122
122
  .catch(err => {
123
- if (err.codeName !== 'IndexNotFound') {
123
+ if (err.codeName !== 'IndexNotFound' && err.codeName !== 'NamespaceNotFound') {
124
+ err.stack = new Error(err.message).stack;
124
125
  throw err;
125
126
  }
126
127
  })
@@ -2098,7 +2099,13 @@ class Database {
2098
2099
 
2099
2100
  // Initialize client.
2100
2101
  if (this.uri) {
2101
- this.client = new MongoClient(this.uri, this.client_opts || {});
2102
+ const opts = this.client_opts ?? {};
2103
+ opts.serverApi ??= {
2104
+ version: ServerApiVersion.v1,
2105
+ strict: true,
2106
+ deprecationErrors: true,
2107
+ };
2108
+ this.client = new MongoClient(this.uri, opts);
2102
2109
  }
2103
2110
 
2104
2111
  // Connect.
@@ -193,7 +193,7 @@ class FileWatcher {
193
193
  // Check if the excluded paths exist for user mistakes, these happen often.
194
194
  this.excluded.forEach(path => {
195
195
  if (!new vlib.Path(path).exists()) {
196
- logger.warn(0, this.log_source, `Excluded file watcher path ${path} does not exist.`);
196
+ logger.warn(1, this.log_source, `Excluded file watcher path ${path} does not exist.`);
197
197
  }
198
198
  })
199
199
 
@@ -222,7 +222,7 @@ class FileWatcher {
222
222
  logger.log(2, this.log_source, "Add file watcher exclude", add)
223
223
  this.excluded.push(add)
224
224
  } catch (e) {
225
- logger.warn(0, this.log_source, `Excluded file watcher path ${path.toString()} does not exist.`);
225
+ logger.warn(1, this.log_source, `Excluded file watcher path ${path.toString()} does not exist.`);
226
226
  }
227
227
  }
228
228
 
@@ -469,7 +469,7 @@ export declare abstract class VElement extends HTMLElement {
469
469
  * or four values for top, right, bottom, and left.
470
470
  * @return:
471
471
  * @description Returns the instance of the element for chaining.
472
- * @funcs: 4
472
+ * @funcs: 4
473
473
  */
474
474
  padding(): string;
475
475
  padding(value: undefstrnr): this;
@@ -540,7 +540,7 @@ export declare abstract class VElement extends HTMLElement {
540
540
  * @descr: The values for the margin. Can be a single value, two values for vertical and horizontal margins, or four values for each side.
541
541
  * @return:
542
542
  * @description Returns the instance of the element for chaining.
543
- * @funcs: 4
543
+ * @funcs: 4
544
544
  */
545
545
  margin(): string;
546
546
  margin(value: undefstrnr): this;
@@ -697,9 +697,9 @@ export declare abstract class VElement extends HTMLElement {
697
697
  * @param:
698
698
  * @name: to
699
699
  * @descr: Indicates whether to enable or disable ellipsis. If `null`, it returns the current state.
700
- * @param:
701
- * @name: after_lines
702
- * @descr: The number of lines after which ellipsis should be applied. Only relevant when `to` is `true`.
700
+ * @param:
701
+ * @name: after_lines
702
+ * @descr: The number of lines after which ellipsis should be applied. Only relevant when `to` is `true`.
703
703
  * @return:
704
704
  * @description Returns the instance of the element for chaining.
705
705
  * @funcs: 2
@@ -2403,7 +2403,7 @@ export declare abstract class VElement extends HTMLElement {
2403
2403
  * @descr: The parent node from which to calculate the offset.
2404
2404
  * @return:
2405
2405
  * @description Returns the accumulated vertical offset from the current node to the parent node, or null if the parent wasn't found.
2406
- * @deprecated: This function may not work properly in all cases.
2406
+ * @deprecated: true
2407
2407
  */
2408
2408
  get_y_offset_from_parent(parent: HTMLElement): number | null;
2409
2409
  /**
@@ -2627,7 +2627,7 @@ export declare abstract class VElement extends HTMLElement {
2627
2627
  /**
2628
2628
  * @docs:
2629
2629
  * @title: Animation Name
2630
- * @desc: Specifies a name for the @keyframes animation, equivalent to the CSS attribute `animationName`.
2630
+ * @desc: Specifies a name for the \@keyframes animation, equivalent to the CSS attribute `animationName`.
2631
2631
  * When the parameter `value` is null, it retrieves the current attribute value.
2632
2632
  * @param:
2633
2633
  * @name: value
@@ -4271,7 +4271,7 @@ export declare abstract class VElement extends HTMLElement {
4271
4271
  /**
4272
4272
  * @docs:
4273
4273
  * @title: Font variant alternates
4274
- * @desc: Controls the usage of alternate glyphs associated to alternative names defined in @font-feature-values.
4274
+ * @desc: Controls the usage of alternate glyphs associated to alternative names defined in \@font-feature-values.
4275
4275
  * The equivalent of CSS attribute `fontVariantAlternates`.
4276
4276
  * @param:
4277
4277
  * @name: value
@@ -5191,7 +5191,7 @@ export declare abstract class VElement extends HTMLElement {
5191
5191
  /**
5192
5192
  * @docs:
5193
5193
  * @title: Mask type
5194
- * @desc: Specifies whether an SVG <mask> element is treated as a luminance mask or as an alpha mask.
5194
+ * @desc: Specifies whether an SVG \<mask> element is treated as a luminance mask or as an alpha mask.
5195
5195
  * The equivalent of CSS attribute `maskType`. Returns the attribute value when parameter `value` is `null`.
5196
5196
  * @param:
5197
5197
  * @name: value
@@ -6961,7 +6961,7 @@ export declare abstract class VElement extends HTMLElement {
6961
6961
  /**
6962
6962
  * @docs:
6963
6963
  * @title: Auto complete
6964
- * @desc: Specifies whether the <form> or the <input> element should have autocomplete enabled.
6964
+ * @desc: Specifies whether the \<form> or the \<input> element should have autocomplete enabled.
6965
6965
  * The equivalent of HTML attribute `autocomplete`. Returns the attribute value when parameter `value` is `null`.
6966
6966
  * @param:
6967
6967
  * @name: value
@@ -7434,7 +7434,7 @@ export declare abstract class VElement extends HTMLElement {
7434
7434
  /**
7435
7435
  * @docs:
7436
7436
  * @title: List
7437
- * @desc: Refers to a <datalist> element that contains pre-defined options for an <input> element.
7437
+ * @desc: Refers to a \<datalist> element that contains pre-defined options for an \<input> element.
7438
7438
  * The equivalent of HTML attribute `list`. Returns the attribute value when parameter `value` is `null`.
7439
7439
  * @param:
7440
7440
  * @name: value
@@ -7602,7 +7602,7 @@ export declare abstract class VElement extends HTMLElement {
7602
7602
  /**
7603
7603
  * @docs:
7604
7604
  * @title: Pattern
7605
- * @desc: Specifies a regular expression that an <input> element's value is checked against.
7605
+ * @desc: Specifies a regular expression that an \<input> element's value is checked against.
7606
7606
  * The equivalent of HTML attribute `pattern`. Returns the attribute value when parameter `value` is `null`.
7607
7607
  * @param:
7608
7608
  * @name: value
@@ -7733,7 +7733,7 @@ export declare abstract class VElement extends HTMLElement {
7733
7733
  /**
7734
7734
  * @docs:
7735
7735
  * @title: Sandbox
7736
- * @desc: Enables an extra set of restrictions for the content in an <iframe>. The equivalent of HTML attribute `sandbox`.
7736
+ * @desc: Enables an extra set of restrictions for the content in an \<iframe>. The equivalent of HTML attribute `sandbox`.
7737
7737
  * Returns the attribute value when parameter `value` is `null`.
7738
7738
  * @param:
7739
7739
  * @name: value
@@ -7790,7 +7790,7 @@ export declare abstract class VElement extends HTMLElement {
7790
7790
  /**
7791
7791
  * @docs:
7792
7792
  * @title: Size
7793
- * @desc: Specifies the width, in characters (for <input>) or specifies the number of visible options (for <select>).
7793
+ * @desc: Specifies the width, in characters (for \<input>) or specifies the number of visible options (for \<select>).
7794
7794
  * The equivalent of HTML attribute `size`. Returns the attribute value when parameter `value` is `null`.
7795
7795
  * @param:
7796
7796
  * @name: value
@@ -7861,7 +7861,7 @@ export declare abstract class VElement extends HTMLElement {
7861
7861
  /**
7862
7862
  * @docs:
7863
7863
  * @title: Src doc
7864
- * @desc: Specifies the HTML content of the page to show in the <iframe>. The equivalent of HTML attribute `srcdoc`.
7864
+ * @desc: Specifies the HTML content of the page to show in the \<iframe>. The equivalent of HTML attribute `srcdoc`.
7865
7865
  * Returns the attribute value when parameter `value` is `null`.
7866
7866
  * @param:
7867
7867
  * @name: value
@@ -8628,7 +8628,7 @@ export declare abstract class VElement extends HTMLElement {
8628
8628
  /**
8629
8629
  * @docs:
8630
8630
  * @title: On Cue Change
8631
- * @desc: Script to be run when the cue changes in a <track> element.
8631
+ * @desc: Script to be run when the cue changes in a \<track> element.
8632
8632
  * The equivalent of HTML attribute `oncuechange`.
8633
8633
  * The first parameter of the callback is the `VElement` object.
8634
8634
  * @param:
@@ -8913,7 +8913,7 @@ export declare abstract class VElement extends HTMLElement {
8913
8913
  /**
8914
8914
  * @docs:
8915
8915
  * @title: On toggle
8916
- * @desc: Fires when the user opens or closes the <details> element.
8916
+ * @desc: Fires when the user opens or closes the \<details> element.
8917
8917
  * The equivalent of HTML attribute `ontoggle`.
8918
8918
  * The first parameter of the callback is the `VElement` object.
8919
8919
  * @param:
@@ -4194,7 +4194,7 @@ export class VElement extends HTMLElement {
4194
4194
  * @descr: The parent node from which to calculate the offset.
4195
4195
  * @return:
4196
4196
  * @description Returns the accumulated vertical offset from the current node to the parent node, or null if the parent wasn't found.
4197
- * @deprecated: This function may not work properly in all cases.
4197
+ * @deprecated: true
4198
4198
  */
4199
4199
  get_y_offset_from_parent(parent) {
4200
4200
  let offset = 0;
@@ -201,14 +201,13 @@ const Colors = {
201
201
  a: rgb.a
202
202
  };
203
203
  // Return in same format as input
204
- if (typeof color === 'string') {
205
- return this.rgb.to_str(darkened.r, darkened.g, darkened.b, darkened.a);
206
- }
207
- else {
208
- return color.length > 3
209
- ? [darkened.r, darkened.g, darkened.b, darkened.a]
210
- : [darkened.r, darkened.g, darkened.b];
211
- }
204
+ // if (typeof color === 'string') {
205
+ return this.rgb.to_str(darkened.r, darkened.g, darkened.b, darkened.a);
206
+ // } else {
207
+ // return color.length > 3
208
+ // ? [darkened.r, darkened.g, darkened.b, darkened.a]
209
+ // : [darkened.r, darkened.g, darkened.b];
210
+ // }
212
211
  },
213
212
  // Lighten the color by interpolating toward white (#FFFFFF)
214
213
  lighten(color, percent = 0.5) {
@@ -230,14 +229,13 @@ const Colors = {
230
229
  a: rgb.a
231
230
  };
232
231
  // Return in same format as input
233
- if (typeof color === 'string') {
234
- return this.rgb.to_str(lightened.r, lightened.g, lightened.b, lightened.a);
235
- }
236
- else {
237
- return color.length > 3
238
- ? [lightened.r, lightened.g, lightened.b, lightened.a]
239
- : [lightened.r, lightened.g, lightened.b];
240
- }
232
+ // if (typeof color === 'string') {
233
+ return this.rgb.to_str(lightened.r, lightened.g, lightened.b, lightened.a);
234
+ // } else {
235
+ // return color.length > 3
236
+ // ? [lightened.r, lightened.g, lightened.b, lightened.a]
237
+ // : [lightened.r, lightened.g, lightened.b];
238
+ // }
241
239
  },
242
240
  // Interpolate.
243
241
  interpolate(start, end, percent = 0.5, alpha = 1.0) {
@@ -354,7 +354,7 @@ export const Scheme = {
354
354
  if (scheme_item.type && scheme_item.type !== "any") {
355
355
  const is_required = scheme_item.required ?? true;
356
356
  // Skip when value is `null / undefined` and default is `null`.
357
- if (scheme_item.default === null && object[key] == null) {
357
+ if ((scheme_item.default == null || !is_required) && object[key] == null) {
358
358
  }
359
359
  // Multiple types supported.
360
360
  else if (Array.isArray(scheme_item.type)) {
@@ -396,7 +396,7 @@ export const Scheme = {
396
396
  const is_required = scheme_item.required ?? true;
397
397
 
398
398
  // Skip when value is `null / undefined` and default is `null`.
399
- if (scheme_item.default === null && object[key] == null) {
399
+ if ((scheme_item.default == null || !is_required) && object[key] == null) {
400
400
  }
401
401
 
402
402
  // Multiple types supported.
package/package.json CHANGED
@@ -1,15 +1,20 @@
1
1
  {
2
2
  "author": "Daan van den Bergh",
3
3
  "name": "@vandenberghinc/volt",
4
- "version": "1.1.3",
4
+ "version": "1.1.5",
5
5
  "description": "",
6
6
  "type": "module",
7
7
  "types": "./backend/dist/esm/volt.d.ts",
8
8
  "main": "./backend/dist/cjs/volt.js",
9
9
  "module": "./backend/dist/esm/volt.js",
10
10
  "exports": {
11
- "require": "./backend/dist/cjs/volt.js",
12
- "import": "./backend/dist/esm/volt.js"
11
+ ".": {
12
+ "require": "./backend/dist/cjs/volt.js",
13
+ "import": "./backend/dist/esm/volt.js"
14
+ },
15
+ "./frontend": {
16
+ "import": "./frontend/dist/volt.js"
17
+ }
13
18
  },
14
19
  "scripts": {
15
20
  "start": "node start.js",