@configdn/configdn-js
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -8,4 +8,11 @@ { | ||
"scripts": { | ||
"prepublish": "tsc" | ||
"prepublish": "build && browser", | ||
"build": "tsc -p tsconfig.json", | ||
"browser": "tsc -p tsconfig.browser.json" | ||
}, | ||
"browser": { | ||
"./lib/index-node": "./dist/dhive.js", | ||
"./src/index-node": "./dist/dhive.js", | ||
"./src/version": "./lib/version.js" | ||
}, | ||
"repository": { | ||
@@ -12,0 +19,0 @@ "type": "git", |
export declare class Settings { | ||
#private; | ||
endpoint: string; | ||
refreshInterval: number; | ||
authKey: string; | ||
/** | ||
@@ -11,2 +13,7 @@ * Creates a new instance of settings | ||
/** | ||
* Sets authorizaiton key | ||
* @param authKey Auth Key | ||
*/ | ||
setAuthKey(authKey: string): void; | ||
/** | ||
* Changes the endpoint | ||
@@ -13,0 +20,0 @@ * @param newEndpoint new endpoint to set to, must start with http/https |
"use strict"; | ||
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { | ||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); | ||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); | ||
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); | ||
}; | ||
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { | ||
if (kind === "m") throw new TypeError("Private method is not writable"); | ||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); | ||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); | ||
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; | ||
}; | ||
var _Settings_instances, _Settings_endpoint, _Settings_refreshInterval, _Settings_authKey, _Settings_setAuthKey; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -24,7 +12,6 @@ exports.Settings = void 0; | ||
constructor(authKey, endpoint, refreshInterval) { | ||
_Settings_instances.add(this); | ||
_Settings_endpoint.set(this, 'https://cdn.configdn.com/'); | ||
_Settings_refreshInterval.set(this, 60); | ||
_Settings_authKey.set(this, ''); | ||
__classPrivateFieldGet(this, _Settings_instances, "m", _Settings_setAuthKey).call(this, authKey); | ||
this.endpoint = 'https://cdn.configdn.com/'; | ||
this.refreshInterval = 60; | ||
this.authKey = ''; | ||
this.setAuthKey(authKey); | ||
this.setEndpoint(endpoint); | ||
@@ -34,2 +21,9 @@ this.changeRefreshInterval(refreshInterval); | ||
/** | ||
* Sets authorizaiton key | ||
* @param authKey Auth Key | ||
*/ | ||
setAuthKey(authKey) { | ||
this.authKey = authKey; | ||
} | ||
/** | ||
* Changes the endpoint | ||
@@ -40,3 +34,3 @@ * @param newEndpoint new endpoint to set to, must start with http/https | ||
setEndpoint(newEndpoint) { | ||
const regexExp = /[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)?/gi; | ||
const regexExp = /[-a-zA-Z0-9@:%._\+~=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~?&//=]*)?/gi; | ||
const regex = new RegExp(regexExp); | ||
@@ -49,3 +43,3 @@ if (!newEndpoint.match(regex)) { | ||
} | ||
__classPrivateFieldSet(this, _Settings_endpoint, newEndpoint, "f"); | ||
this.endpoint = newEndpoint; | ||
} | ||
@@ -61,3 +55,3 @@ /** | ||
} | ||
__classPrivateFieldSet(this, _Settings_refreshInterval, newInterval, "f"); | ||
this.refreshInterval = newInterval; | ||
} | ||
@@ -68,3 +62,3 @@ /** | ||
getEndpoint() { | ||
return __classPrivateFieldGet(this, _Settings_endpoint, "f"); | ||
return this.endpoint; | ||
} | ||
@@ -75,3 +69,3 @@ /** | ||
getRefreshInterval() { | ||
return __classPrivateFieldGet(this, _Settings_refreshInterval, "f"); | ||
return this.refreshInterval; | ||
} | ||
@@ -82,8 +76,5 @@ /** | ||
getAuthKey() { | ||
return __classPrivateFieldGet(this, _Settings_authKey, "f"); | ||
return this.authKey; | ||
} | ||
} | ||
exports.Settings = Settings; | ||
_Settings_endpoint = new WeakMap(), _Settings_refreshInterval = new WeakMap(), _Settings_authKey = new WeakMap(), _Settings_instances = new WeakSet(), _Settings_setAuthKey = function _Settings_setAuthKey(authKey) { | ||
__classPrivateFieldSet(this, _Settings_authKey, authKey, "f"); | ||
}; |
{ | ||
"name": "@configdn/configdn-js", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "ConfigDN JS Client", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"main": "dist/src/index.js", | ||
"types": "dist/src/index.d.ts", | ||
"scripts": { | ||
"prepublish": "tsc" | ||
"prepublish": "build && browser", | ||
"build": "tsc -p tsconfig.json", | ||
"browser" : "tsc -p tsconfig.browser.json" | ||
}, | ||
"browser": { | ||
"./dist/src/index.js": "./dist.browser/index.js", | ||
"./dist/src/index.d.ts": "./dist.browser/index.d.ts" | ||
}, | ||
"repository": { | ||
@@ -11,0 +18,0 @@ "type": "git", |
export class Settings { | ||
#endpoint: string = 'https://cdn.configdn.com/'; | ||
#refreshInterval: number = 60; | ||
#authKey : string = ''; | ||
endpoint: string = 'https://cdn.configdn.com/'; | ||
refreshInterval: number = 60; | ||
authKey : string = ''; | ||
@@ -13,3 +13,3 @@ /** | ||
constructor(authKey : string, endpoint : string, refreshInterval : number) { | ||
this.#setAuthKey(authKey); | ||
this.setAuthKey(authKey); | ||
this.setEndpoint(endpoint); | ||
@@ -23,4 +23,4 @@ this.changeRefreshInterval(refreshInterval) | ||
*/ | ||
#setAuthKey(authKey : string){ | ||
this.#authKey = authKey; | ||
setAuthKey(authKey : string){ | ||
this.authKey = authKey; | ||
} | ||
@@ -34,3 +34,3 @@ | ||
setEndpoint(newEndpoint: string) { | ||
const regexExp = /[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)?/gi; | ||
const regexExp = /[-a-zA-Z0-9@:%._\+~=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~?&//=]*)?/gi; | ||
const regex = new RegExp(regexExp); | ||
@@ -44,3 +44,3 @@ | ||
} | ||
this.#endpoint = newEndpoint; | ||
this.endpoint = newEndpoint; | ||
} | ||
@@ -57,3 +57,3 @@ | ||
} | ||
this.#refreshInterval = newInterval; | ||
this.refreshInterval = newInterval; | ||
} | ||
@@ -65,3 +65,3 @@ | ||
getEndpoint(): string { | ||
return this.#endpoint; | ||
return this.endpoint; | ||
} | ||
@@ -73,3 +73,3 @@ | ||
getRefreshInterval(): number { | ||
return this.#refreshInterval; | ||
return this.refreshInterval; | ||
} | ||
@@ -81,4 +81,4 @@ | ||
getAuthKey(): string { | ||
return this.#authKey; | ||
return this.authKey; | ||
} | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
51635
18
1012
1