New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@configdn/configdn-js

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@configdn/configdn-js - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

2

dist/configdn-js.esm.js

@@ -1,2 +0,2 @@

var a=Object.defineProperty,h=(i,e,t)=>e in i?a(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,n=(i,e,t)=>(h(i,typeof e!="symbol"?e+"":e,t),t);class g{constructor(e,t,s){n(this,"endpoint","https://cdn.configdn.com/"),n(this,"refreshInterval",60),n(this,"authKey",""),this.setAuthKey(e),this.setEndpoint(t),this.changeRefreshInterval(s)}setAuthKey(e){this.authKey=e}setEndpoint(e){const t=/[-a-zA-Z0-9@:%._\+~=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~?&//=]*)?/gi,s=new RegExp(t);e.match(s),e.endsWith("/")||(e+="/"),this.endpoint=e}changeRefreshInterval(e){if(Math.sign(e)!==1)throw new Error("New interval must be a positive integer");this.refreshInterval=e}getEndpoint(){return this.endpoint}getRefreshInterval(){return this.refreshInterval}getAuthKey(){return this.authKey}}var l="@configdn/configdn-js",d="0.1.5",c="ConfigDN JS Client",f="dist/configdn-js.js",u="dist/configdn-js.esm.js",p="dist/configdn-js.d.ts",v={"./dist/configdn-js.js":"./dist/configdn-js.js","./dist/configdn-js.esm.js":"./dist/configdn-js.esm.js"},b={prepublishOnly:"npm run build",build:"npm run build:clear && rollup -c --bundleConfigAsCjs","build:watch":"tsc -w","build:clear":"rimraf dist && rimraf tsconfig.tsbuildinfo"},m={type:"git",url:"git+https://github.com/dBuidl/ConfigDN-client-js.git"},w=[],y="Rishi<rishipanthee@ryamer.com>",j="MIT",C={url:"https://github.com/dBuidl/ConfigDN-client-js/issues"},D="https://github.com/dBuidl/ConfigDN-client-js#readme",I={axios:"^1.4.0"},A={"@rollup/plugin-node-resolve":"^13.3.0",rimraf:"^5.0.1","rollup-plugin-dts":"^4.2.2","rollup-plugin-esbuild":"^4.9.1","@rollup/plugin-json":"^6.0.0","ts-loader":"^9.4.4",typescript:"^4.1.0"},E={name:l,version:d,description:c,main:f,module:u,typings:p,browser:v,scripts:b,repository:m,keywords:w,author:y,license:j,bugs:C,homepage:D,dependencies:I,devDependencies:A},R=Object.defineProperty,K=(i,e,t)=>e in i?R(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,r=(i,e,t)=>(K(i,typeof e!="symbol"?e+"":e,t),t);class N{constructor(e,t="https://cdn.configdn.com/",s=60){r(this,"settings"),r(this,"lastUpdate"),r(this,"fetchedConfig",new Map),this.settings=new g(e,t,s),this.refreshConfig(!0),this.lastUpdate=Date.now()/1e3}async refreshConfig(e=!1){await fetch(this.settings.getEndpoint()+"public_api/v1/get_config/",{method:"GET",headers:{"User-Agent":"ConfigDN-JS/"+E,Authorization:this.settings.getAuthKey(),"Content-Type":"application/json"}}).then(t=>{const s=new Map(Object.entries(t.json()));if(!s.get("s")){if(e)throw new Error("Could not download config, problem: "+s.get("e"));return}const o=s.get("d");this.fetchedConfig=new Map(Object.entries(o))}).catch(t=>{throw new Error(t)})}async get(e,t=null){return(this.fetchedConfig.size===0||this.lastUpdate+this.settings.getRefreshInterval()>Date.now()/1e3)&&await this.refreshConfig(),this.getLocal(e,t)}getLocal(e,t=null){if(this.lastUpdate+this.settings.getRefreshInterval()>Date.now()/1e3&&this.refreshConfig(),this.fetchedConfig.has(e))return this.fetchedConfig.get(e).v;if(t!==null)return t;throw new Error("Key not in config")}changeRefreshInterval(e){this.settings.changeRefreshInterval(e)}}export{N as ConfigDN};
import a from"axios";var h=Object.defineProperty,l=(i,e,t)=>e in i?h(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,s=(i,e,t)=>(l(i,typeof e!="symbol"?e+"":e,t),t);class g{constructor(e,t,n){s(this,"endpoint","https://cdn.configdn.com/"),s(this,"refreshInterval",60),s(this,"authKey",""),this.setAuthKey(e),this.setEndpoint(t),this.changeRefreshInterval(n)}setAuthKey(e){this.authKey=e}setEndpoint(e){const t=/[-a-zA-Z0-9@:%._\+~=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~?&//=]*)?/gi,n=new RegExp(t);e.match(n),e.endsWith("/")||(e+="/"),this.endpoint=e}changeRefreshInterval(e){if(Math.sign(e)!==1)throw new Error("New interval must be a positive integer");this.refreshInterval=e}getEndpoint(){return this.endpoint}getRefreshInterval(){return this.refreshInterval}getAuthKey(){return this.authKey}}var d="@configdn/configdn-js",c="0.1.6",f="ConfigDN JS Client",u="dist/configdn-js.js",p="dist/configdn-js.esm.js",v="dist/configdn-js.d.ts",m={"./dist/configdn-js.js":"./dist/configdn-js.js","./dist/configdn-js.esm.js":"./dist/configdn-js.esm.js"},b={prepublishOnly:"npm run build",build:"npm run build:clear && rollup -c --bundleConfigAsCjs","build:watch":"tsc -w","build:clear":"rimraf dist && rimraf tsconfig.tsbuildinfo"},w={type:"git",url:"git+https://github.com/dBuidl/ConfigDN-client-js.git"},y=[],j="Rishi<rishipanthee@ryamer.com>",C="MIT",D={url:"https://github.com/dBuidl/ConfigDN-client-js/issues"},I="https://github.com/dBuidl/ConfigDN-client-js#readme",E={axios:"^1.4.0"},A={"@rollup/plugin-node-resolve":"^13.3.0",rimraf:"^5.0.1","rollup-plugin-dts":"^4.2.2","rollup-plugin-esbuild":"^4.9.1","@rollup/plugin-json":"^6.0.0","ts-loader":"^9.4.4",typescript:"^4.1.0"},R={name:d,version:c,description:f,main:u,module:p,typings:v,browser:m,scripts:b,repository:w,keywords:y,author:j,license:C,bugs:D,homepage:I,dependencies:E,devDependencies:A},K=Object.defineProperty,N=(i,e,t)=>e in i?K(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,r=(i,e,t)=>(N(i,typeof e!="symbol"?e+"":e,t),t);class z{constructor(e,t="https://cdn.configdn.com/",n=60){r(this,"settings"),r(this,"lastUpdate"),r(this,"fetchedConfig",new Map),this.settings=new g(e,t,n),this.refreshConfig(!0),this.lastUpdate=Date.now()/1e3}async refreshConfig(e=!1){await a.request({method:"GET",url:this.settings.getEndpoint()+"public_api/v1/get_config/",headers:{"ConfigDN-Client-Version":"ConfigDN-JS/"+R,Authorization:this.settings.getAuthKey(),"Content-Type":"application/json"}}).then(t=>{const n=new Map(Object.entries(t.data));if(!n.get("s")){if(e)throw new Error("Could not download config, problem: "+n.get("e"));return}const o=n.get("d");this.fetchedConfig=new Map(Object.entries(o))}).catch(t=>{throw new Error(t)})}async get(e,t=null){return(this.fetchedConfig.size===0||this.lastUpdate+this.settings.getRefreshInterval()>Date.now()/1e3)&&await this.refreshConfig(),this.getLocal(e,t)}getLocal(e,t=null){if(this.lastUpdate+this.settings.getRefreshInterval()>Date.now()/1e3&&this.refreshConfig(),this.fetchedConfig.has(e))return this.fetchedConfig.get(e).v;if(t!==null)return t;throw new Error("Key not in config")}changeRefreshInterval(e){this.settings.changeRefreshInterval(e)}}export{z as ConfigDN};
//# sourceMappingURL=configdn-js.esm.js.map

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var a=Object.defineProperty,h=(i,e,t)=>e in i?a(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,n=(i,e,t)=>(h(i,typeof e!="symbol"?e+"":e,t),t);class l{constructor(e,t,s){n(this,"endpoint","https://cdn.configdn.com/"),n(this,"refreshInterval",60),n(this,"authKey",""),this.setAuthKey(e),this.setEndpoint(t),this.changeRefreshInterval(s)}setAuthKey(e){this.authKey=e}setEndpoint(e){const t=/[-a-zA-Z0-9@:%._\+~=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~?&//=]*)?/gi,s=new RegExp(t);e.match(s),e.endsWith("/")||(e+="/"),this.endpoint=e}changeRefreshInterval(e){if(Math.sign(e)!==1)throw new Error("New interval must be a positive integer");this.refreshInterval=e}getEndpoint(){return this.endpoint}getRefreshInterval(){return this.refreshInterval}getAuthKey(){return this.authKey}}var g="@configdn/configdn-js",d="0.1.5",c="ConfigDN JS Client",f="dist/configdn-js.js",u="dist/configdn-js.esm.js",p="dist/configdn-js.d.ts",v={"./dist/configdn-js.js":"./dist/configdn-js.js","./dist/configdn-js.esm.js":"./dist/configdn-js.esm.js"},b={prepublishOnly:"npm run build",build:"npm run build:clear && rollup -c --bundleConfigAsCjs","build:watch":"tsc -w","build:clear":"rimraf dist && rimraf tsconfig.tsbuildinfo"},m={type:"git",url:"git+https://github.com/dBuidl/ConfigDN-client-js.git"},w=[],y="Rishi<rishipanthee@ryamer.com>",j="MIT",C={url:"https://github.com/dBuidl/ConfigDN-client-js/issues"},D="https://github.com/dBuidl/ConfigDN-client-js#readme",I={axios:"^1.4.0"},A={"@rollup/plugin-node-resolve":"^13.3.0",rimraf:"^5.0.1","rollup-plugin-dts":"^4.2.2","rollup-plugin-esbuild":"^4.9.1","@rollup/plugin-json":"^6.0.0","ts-loader":"^9.4.4",typescript:"^4.1.0"},E={name:g,version:d,description:c,main:f,module:u,typings:p,browser:v,scripts:b,repository:m,keywords:w,author:y,license:j,bugs:C,homepage:D,dependencies:I,devDependencies:A},R=Object.defineProperty,K=(i,e,t)=>e in i?R(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,r=(i,e,t)=>(K(i,typeof e!="symbol"?e+"":e,t),t);class N{constructor(e,t="https://cdn.configdn.com/",s=60){r(this,"settings"),r(this,"lastUpdate"),r(this,"fetchedConfig",new Map),this.settings=new l(e,t,s),this.refreshConfig(!0),this.lastUpdate=Date.now()/1e3}async refreshConfig(e=!1){await fetch(this.settings.getEndpoint()+"public_api/v1/get_config/",{method:"GET",headers:{"User-Agent":"ConfigDN-JS/"+E,Authorization:this.settings.getAuthKey(),"Content-Type":"application/json"}}).then(t=>{const s=new Map(Object.entries(t.json()));if(!s.get("s")){if(e)throw new Error("Could not download config, problem: "+s.get("e"));return}const o=s.get("d");this.fetchedConfig=new Map(Object.entries(o))}).catch(t=>{throw new Error(t)})}async get(e,t=null){return(this.fetchedConfig.size===0||this.lastUpdate+this.settings.getRefreshInterval()>Date.now()/1e3)&&await this.refreshConfig(),this.getLocal(e,t)}getLocal(e,t=null){if(this.lastUpdate+this.settings.getRefreshInterval()>Date.now()/1e3&&this.refreshConfig(),this.fetchedConfig.has(e))return this.fetchedConfig.get(e).v;if(t!==null)return t;throw new Error("Key not in config")}changeRefreshInterval(e){this.settings.changeRefreshInterval(e)}}exports.ConfigDN=N;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var a=require("axios");function h(i){return i&&typeof i=="object"&&"default"in i?i:{default:i}}var l=h(a),d=Object.defineProperty,g=(i,e,t)=>e in i?d(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,s=(i,e,t)=>(g(i,typeof e!="symbol"?e+"":e,t),t);class c{constructor(e,t,n){s(this,"endpoint","https://cdn.configdn.com/"),s(this,"refreshInterval",60),s(this,"authKey",""),this.setAuthKey(e),this.setEndpoint(t),this.changeRefreshInterval(n)}setAuthKey(e){this.authKey=e}setEndpoint(e){const t=/[-a-zA-Z0-9@:%._\+~=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~?&//=]*)?/gi,n=new RegExp(t);e.match(n),e.endsWith("/")||(e+="/"),this.endpoint=e}changeRefreshInterval(e){if(Math.sign(e)!==1)throw new Error("New interval must be a positive integer");this.refreshInterval=e}getEndpoint(){return this.endpoint}getRefreshInterval(){return this.refreshInterval}getAuthKey(){return this.authKey}}var u="@configdn/configdn-js",f="0.1.6",p="ConfigDN JS Client",v="dist/configdn-js.js",b="dist/configdn-js.esm.js",m="dist/configdn-js.d.ts",y={"./dist/configdn-js.js":"./dist/configdn-js.js","./dist/configdn-js.esm.js":"./dist/configdn-js.esm.js"},w={prepublishOnly:"npm run build",build:"npm run build:clear && rollup -c --bundleConfigAsCjs","build:watch":"tsc -w","build:clear":"rimraf dist && rimraf tsconfig.tsbuildinfo"},j={type:"git",url:"git+https://github.com/dBuidl/ConfigDN-client-js.git"},C=[],D="Rishi<rishipanthee@ryamer.com>",I="MIT",E={url:"https://github.com/dBuidl/ConfigDN-client-js/issues"},A="https://github.com/dBuidl/ConfigDN-client-js#readme",N={axios:"^1.4.0"},R={"@rollup/plugin-node-resolve":"^13.3.0",rimraf:"^5.0.1","rollup-plugin-dts":"^4.2.2","rollup-plugin-esbuild":"^4.9.1","@rollup/plugin-json":"^6.0.0","ts-loader":"^9.4.4",typescript:"^4.1.0"},_={name:u,version:f,description:p,main:v,module:b,typings:m,browser:y,scripts:w,repository:j,keywords:C,author:D,license:I,bugs:E,homepage:A,dependencies:N,devDependencies:R},K=Object.defineProperty,M=(i,e,t)=>e in i?K(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,r=(i,e,t)=>(M(i,typeof e!="symbol"?e+"":e,t),t);class O{constructor(e,t="https://cdn.configdn.com/",n=60){r(this,"settings"),r(this,"lastUpdate"),r(this,"fetchedConfig",new Map),this.settings=new c(e,t,n),this.refreshConfig(!0),this.lastUpdate=Date.now()/1e3}async refreshConfig(e=!1){await l.default.request({method:"GET",url:this.settings.getEndpoint()+"public_api/v1/get_config/",headers:{"ConfigDN-Client-Version":"ConfigDN-JS/"+_,Authorization:this.settings.getAuthKey(),"Content-Type":"application/json"}}).then(t=>{const n=new Map(Object.entries(t.data));if(!n.get("s")){if(e)throw new Error("Could not download config, problem: "+n.get("e"));return}const o=n.get("d");this.fetchedConfig=new Map(Object.entries(o))}).catch(t=>{throw new Error(t)})}async get(e,t=null){return(this.fetchedConfig.size===0||this.lastUpdate+this.settings.getRefreshInterval()>Date.now()/1e3)&&await this.refreshConfig(),this.getLocal(e,t)}getLocal(e,t=null){if(this.lastUpdate+this.settings.getRefreshInterval()>Date.now()/1e3&&this.refreshConfig(),this.fetchedConfig.has(e))return this.fetchedConfig.get(e).v;if(t!==null)return t;throw new Error("Key not in config")}changeRefreshInterval(e){this.settings.changeRefreshInterval(e)}}exports.ConfigDN=O;
//# sourceMappingURL=configdn-js.js.map
{
"name": "@configdn/configdn-js",
"version": "0.1.5",
"version": "0.1.6",
"description": "ConfigDN JS Client",

@@ -5,0 +5,0 @@ "main": "dist/configdn-js.js",

import { Settings } from './settings';
import version from '../package.json';
import axios from 'axios';

@@ -10,5 +11,5 @@ interface KeyValuePair {

settings: Settings;
lastUpdate : number;
lastUpdate: number;
fetchedConfig: Map<String, Object> = new Map();
/**

@@ -31,6 +32,7 @@ * Creates a new instance

async refreshConfig(errorOnFail: boolean = false): Promise<void> {
await fetch(this.settings.getEndpoint() + 'public_api/v1/get_config/', {
await axios.request({
method: 'GET',
url: this.settings.getEndpoint() + 'public_api/v1/get_config/',
headers: {
'User-Agent': 'ConfigDN-JS/' + version,
'ConfigDN-Client-Version': 'ConfigDN-JS/' + version,
'Authorization': this.settings.getAuthKey(),

@@ -40,3 +42,3 @@ 'Content-Type': 'application/json'

}).then((response) => {
const responseMap = new Map(Object.entries(response.json()));
const responseMap = new Map(Object.entries(response.data));
if (!responseMap.get('s')) {

@@ -62,3 +64,3 @@ if (errorOnFail) {

*/
async get(key: string, defaultValue : any = null): Promise<any> {
async get(key: string, defaultValue: any = null): Promise<any> {
if (this.fetchedConfig.size === 0 || this.lastUpdate + this.settings.getRefreshInterval() > Date.now() / 1000) {

@@ -76,4 +78,4 @@ await this.refreshConfig()

*/
getLocal(key : string, defaultValue : any = null) : any {
if (this.lastUpdate + this.settings.getRefreshInterval() > Date.now() / 1000){
getLocal(key: string, defaultValue: any = null): any {
if (this.lastUpdate + this.settings.getRefreshInterval() > Date.now() / 1000) {
this.refreshConfig()

@@ -84,3 +86,3 @@ }

} else {
if (defaultValue !== null){
if (defaultValue !== null) {
return defaultValue

@@ -97,5 +99,5 @@ } else {

*/
changeRefreshInterval(newInterval : number){
changeRefreshInterval(newInterval: number) {
this.settings.changeRefreshInterval(newInterval);
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc