@scriptdb/client 1.0.4 → 1.0.6

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.
Files changed (2) hide show
  1. package/dist/index.js +5 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -95,14 +95,16 @@ class ScriptDBClient {
95
95
  this.retries = Number.isFinite(this.options.retries) ? this.options.retries : 3;
96
96
  this.retryDelay = Number.isFinite(this.options.retryDelay) ? this.options.retryDelay : 1000;
97
97
  this.frame = this.options.frame === "length-prefix" || this.options.preferLengthPrefix ? "length-prefix" : "ndjson";
98
- const normalized = uri.replace(/^https?:\/\//i, "scriptdb://");
99
98
  let parsed;
100
99
  try {
101
- parsed = new URL(normalized);
100
+ parsed = new URL(uri);
102
101
  } catch (e) {
103
102
  throw new Error("Invalid uri");
104
103
  }
105
- this.uri = normalized;
104
+ if (parsed.protocol !== "scriptdb:") {
105
+ throw new Error("URI must use scriptdb:// protocol");
106
+ }
107
+ this.uri = uri;
106
108
  this.protocolName = parsed.protocol ? parsed.protocol.replace(":", "") : "scriptdb";
107
109
  this.username = (typeof this.options.username === "string" ? this.options.username : parsed.username) || null;
108
110
  this.password = (typeof this.options.password === "string" ? this.options.password : parsed.password) || null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scriptdb/client",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "Client module resolver for script database",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",