Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pnp/common

Package Overview
Dependencies
Maintainers
12
Versions
155
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pnp/common - npm Package Compare versions

Comparing version 2.0.10 to 2.1.0-beta0

31

libconfig.d.ts

@@ -33,21 +33,24 @@ import { ITypedHash } from "./collections";

}
export declare function setup(config: ILibraryConfiguration): void;
export declare class RuntimeConfigImpl {
export declare function setup<T = ILibraryConfiguration>(config: T, runtime?: Runtime): void;
export declare function onRuntimeCreate(hook: (runtime: Runtime) => void): void;
export declare class Runtime {
private _v;
constructor(_v?: Map<string, any>);
constructor(_v?: Map<string | number | symbol, any>);
/**
*
* @param config The set of properties to add to the globa configuration instance
* @param config The set of properties to add to this runtime instance
*/
assign(config: ITypedHash<any>): void;
get(key: string): any;
get defaultCachingStore(): "session" | "local";
get defaultCachingTimeoutSeconds(): number;
get globalCacheDisable(): boolean;
get enableCacheExpiration(): boolean;
get cacheExpirationIntervalMilliseconds(): number;
get spfxContext(): ISPFXContext;
get ie11(): boolean;
assign<T = ITypedHash<any>>(config: T): void;
/**
* Gets a runtime value using T to define the available keys, and R to define the type returned by that key
*
* @param key
*/
get<T = ILibraryConfiguration, R = any>(key: keyof T): R;
/**
* Exports the internal Map representing this runtime
*/
export(): Map<string | number | symbol, any>;
}
export declare let RuntimeConfig: RuntimeConfigImpl;
export declare let DefaultRuntime: Runtime;
//# sourceMappingURL=libconfig.d.ts.map

@@ -0,4 +1,6 @@

import { __read, __values } from "tslib";
import { mergeMaps, objectToMap } from "./collections";
export function setup(config) {
RuntimeConfig.assign(config);
export function setup(config, runtime) {
if (runtime === void 0) { runtime = DefaultRuntime; }
runtime.assign(config);
}

@@ -15,4 +17,13 @@ // lable mapping for known config values

];
var RuntimeConfigImpl = /** @class */ (function () {
function RuntimeConfigImpl(_v) {
var runtimeCreateHooks = [];
export function onRuntimeCreate(hook) {
if (runtimeCreateHooks.indexOf(hook) < 0) {
// apply hook logic to default runtime
hook(DefaultRuntime);
runtimeCreateHooks.push(hook);
}
}
var Runtime = /** @class */ (function () {
function Runtime(_v) {
var _this = this;
if (_v === void 0) { _v = new Map(); }

@@ -28,67 +39,48 @@ this._v = _v;

this._v.set(s[6], false);
runtimeCreateHooks.forEach(function (hook) { return hook(_this); });
}
/**
*
* @param config The set of properties to add to the globa configuration instance
* @param config The set of properties to add to this runtime instance
*/
RuntimeConfigImpl.prototype.assign = function (config) {
Runtime.prototype.assign = function (config) {
this._v = mergeMaps(this._v, objectToMap(config));
};
RuntimeConfigImpl.prototype.get = function (key) {
/**
* Gets a runtime value using T to define the available keys, and R to define the type returned by that key
*
* @param key
*/
Runtime.prototype.get = function (key) {
return this._v.get(key);
};
Object.defineProperty(RuntimeConfigImpl.prototype, "defaultCachingStore", {
get: function () {
return this.get(s[0]);
},
enumerable: false,
configurable: true
});
Object.defineProperty(RuntimeConfigImpl.prototype, "defaultCachingTimeoutSeconds", {
get: function () {
return this.get(s[1]);
},
enumerable: false,
configurable: true
});
Object.defineProperty(RuntimeConfigImpl.prototype, "globalCacheDisable", {
get: function () {
return this.get(s[2]);
},
enumerable: false,
configurable: true
});
Object.defineProperty(RuntimeConfigImpl.prototype, "enableCacheExpiration", {
get: function () {
return this.get(s[3]);
},
enumerable: false,
configurable: true
});
Object.defineProperty(RuntimeConfigImpl.prototype, "cacheExpirationIntervalMilliseconds", {
get: function () {
return this.get(s[4]);
},
enumerable: false,
configurable: true
});
Object.defineProperty(RuntimeConfigImpl.prototype, "spfxContext", {
get: function () {
return this.get(s[5]);
},
enumerable: false,
configurable: true
});
Object.defineProperty(RuntimeConfigImpl.prototype, "ie11", {
get: function () {
return this.get(s[6]);
},
enumerable: false,
configurable: true
});
return RuntimeConfigImpl;
/**
* Exports the internal Map representing this runtime
*/
Runtime.prototype.export = function () {
var e_1, _a;
var expt = new Map();
try {
for (var _b = __values(this._v), _c = _b.next(); !_c.done; _c = _b.next()) {
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
if (key !== "__isDefault__") {
expt.set(key, value);
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
}
finally { if (e_1) throw e_1.error; }
}
return expt;
};
return Runtime;
}());
export { RuntimeConfigImpl };
var _runtimeConfig = new RuntimeConfigImpl();
export var RuntimeConfig = _runtimeConfig;
export { Runtime };
// default runtime used globally
var _runtime = new Runtime(new Map([["__isDefault__", true]]));
export var DefaultRuntime = _runtime;
//# sourceMappingURL=libconfig.js.map
{
"name": "@pnp/common",
"version": "2.0.10",
"version": "2.1.0-beta0",
"description": "pnp - provides shared functionality across all pnp libraries",

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

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

export {};
//# sourceMappingURL=spfxcontextinterface.js.map
import { __awaiter, __generator } from "tslib";
import { dateAdd, getCtxCallback, jsS, objectDefinedNotNull } from "./util";
import { RuntimeConfig } from "./libconfig";
import { DefaultRuntime } from "./libconfig";
/**

@@ -21,3 +21,3 @@ * A wrapper class to provide a consistent interface to browser based storage

// this will clear any expired items and set the timeout function
if (RuntimeConfig.enableCacheExpiration) {
if (DefaultRuntime.get("enableCacheExpiration")) {
this.cacheExpirationHandler();

@@ -154,3 +154,3 @@ }

// ensure we are by default inline with the global library setting
var defaultTimeout = RuntimeConfig.defaultCachingTimeoutSeconds;
var defaultTimeout = DefaultRuntime.get("defaultCachingTimeoutSeconds");
if (this.defaultTimeoutMinutes > 0) {

@@ -173,3 +173,3 @@ defaultTimeout = this.defaultTimeoutMinutes * 60;

// call ourself in the future
setTimeout(getCtxCallback(_this, _this.cacheExpirationHandler), RuntimeConfig.cacheExpirationIntervalMilliseconds);
setTimeout(getCtxCallback(_this, _this.cacheExpirationHandler), DefaultRuntime.get("cacheExpirationIntervalMilliseconds"));
}).catch(console.error);

@@ -176,0 +176,0 @@ };

Sorry, the diff of this file is not supported yet

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