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

@pnp/common

Package Overview
Dependencies
Maintainers
9
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.1-1 to 2.0.1-2

12

collections.js

@@ -1,6 +0,8 @@

import { isFunc } from "./util";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("./util");
/**
* Used to calculate the object properties, with polyfill if needed
*/
var objectEntries = isFunc(Object.entries) ? Object.entries : function (o) { return Object.keys(o).map(function (k) { return [k, o[k]]; }); };
var objectEntries = util_1.isFunc(Object.entries) ? Object.entries : function (o) { return Object.keys(o).map(function (k) { return [k, o[k]]; }); };
/**

@@ -11,3 +13,3 @@ * Converts the supplied object to a map

*/
export function objectToMap(o) {
function objectToMap(o) {
if (o !== undefined && o !== null) {

@@ -18,2 +20,3 @@ return new Map(objectEntries(o));

}
exports.objectToMap = objectToMap;
/**

@@ -25,3 +28,3 @@ * Merges to Map instances together, overwriting values in target with matching keys, last in wins

*/
export function mergeMaps(target) {
function mergeMaps(target) {
var maps = [];

@@ -38,2 +41,3 @@ for (var _i = 1; _i < arguments.length; _i++) {

}
exports.mergeMaps = mergeMaps;
//# sourceMappingURL=collections.js.map

@@ -1,6 +0,9 @@

export * from "./collections";
export * from "./libconfig";
export * from "./net";
export * from "./storage";
export * from "./util";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
tslib_1.__exportStar(require("./collections"), exports);
tslib_1.__exportStar(require("./libconfig"), exports);
tslib_1.__exportStar(require("./net"), exports);
tslib_1.__exportStar(require("./storage"), exports);
tslib_1.__exportStar(require("./util"), exports);
//# sourceMappingURL=index.js.map

@@ -1,5 +0,8 @@

import { mergeMaps, objectToMap } from "./collections";
export function setup(config) {
RuntimeConfig.assign(config);
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var collections_1 = require("./collections");
function setup(config) {
exports.RuntimeConfig.assign(config);
}
exports.setup = setup;
// lable mapping for known config values

@@ -33,3 +36,3 @@ var s = [

RuntimeConfigImpl.prototype.assign = function (config) {
this._v = mergeMaps(this._v, objectToMap(config));
this._v = collections_1.mergeMaps(this._v, collections_1.objectToMap(config));
};

@@ -94,5 +97,5 @@ RuntimeConfigImpl.prototype.get = function (key) {

}());
export { RuntimeConfigImpl };
exports.RuntimeConfigImpl = RuntimeConfigImpl;
var _runtimeConfig = new RuntimeConfigImpl();
export var RuntimeConfig = _runtimeConfig;
exports.RuntimeConfig = _runtimeConfig;
//# sourceMappingURL=libconfig.js.map

@@ -1,5 +0,7 @@

import { __awaiter, __extends, __generator } from "tslib";
import { assign, objectDefinedNotNull } from "./util";
export function mergeHeaders(target, source) {
if (objectDefinedNotNull(source)) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("./util");
function mergeHeaders(target, source) {
if (util_1.objectDefinedNotNull(source)) {
var temp = new Request("", { headers: source });

@@ -11,9 +13,11 @@ temp.headers.forEach(function (value, name) {

}
export function mergeOptions(target, source) {
if (objectDefinedNotNull(source)) {
var headers = assign(target.headers || {}, source.headers);
target = assign(target, source);
exports.mergeHeaders = mergeHeaders;
function mergeOptions(target, source) {
if (util_1.objectDefinedNotNull(source)) {
var headers = util_1.assign(target.headers || {}, source.headers);
target = util_1.assign(target, source);
target.headers = headers;
}
}
exports.mergeOptions = mergeOptions;
/**

@@ -24,6 +28,7 @@ * Parses out the root of the request url to use as the resource when getting the token

*/
export function getADALResource(url) {
function getADALResource(url) {
var u = new URL(url);
return u.protocol + "//" + u.hostname;
}
exports.getADALResource = getADALResource;
/**

@@ -40,3 +45,3 @@ * Makes requests using the global/window fetch API

}());
export { FetchClient };
exports.FetchClient = FetchClient;
/**

@@ -46,3 +51,3 @@ * Makes requests using the fetch API adding the supplied token to the Authorization header

var BearerTokenFetchClient = /** @class */ (function (_super) {
__extends(BearerTokenFetchClient, _super);
tslib_1.__extends(BearerTokenFetchClient, _super);
function BearerTokenFetchClient(_token) {

@@ -73,3 +78,3 @@ var _this = _super.call(this) || this;

}(FetchClient));
export { BearerTokenFetchClient };
exports.BearerTokenFetchClient = BearerTokenFetchClient;
/**

@@ -79,3 +84,3 @@ * Client wrapping the aadTokenProvider available from SPFx >= 1.6

var SPFxAdalClient = /** @class */ (function (_super) {
__extends(SPFxAdalClient, _super);
tslib_1.__extends(SPFxAdalClient, _super);
/**

@@ -97,5 +102,5 @@ *

SPFxAdalClient.prototype.fetch = function (url, options) {
return __awaiter(this, void 0, void 0, function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var token;
return __generator(this, function (_a) {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {

@@ -117,5 +122,5 @@ case 0: return [4 /*yield*/, this.getToken(getADALResource(url))];

SPFxAdalClient.prototype.getToken = function (resource) {
return __awaiter(this, void 0, void 0, function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var provider;
return __generator(this, function (_a) {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {

@@ -132,3 +137,3 @@ case 0: return [4 /*yield*/, this.context.aadTokenProviderFactory.getTokenProvider()];

}(BearerTokenFetchClient));
export { SPFxAdalClient };
exports.SPFxAdalClient = SPFxAdalClient;
//# sourceMappingURL=net.js.map
{
"name": "@pnp/common",
"version": "2.0.1-1",
"version": "2.0.1-2",
"description": "pnp - provides shared functionality across all pnp libraries",

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

@@ -0,1 +1,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=spfxcontextinterface.js.map

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

import { __awaiter, __generator } from "tslib";
import { dateAdd, getCtxCallback, jsS, objectDefinedNotNull } from "./util";
import { RuntimeConfig } from "./libconfig";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var util_1 = require("./util");
var libconfig_1 = require("./libconfig");
/**

@@ -21,3 +23,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 (libconfig_1.RuntimeConfig.enableCacheExpiration) {
this.cacheExpirationHandler();

@@ -39,3 +41,3 @@ }

var o = this.store.getItem(key);
if (!objectDefinedNotNull(o)) {
if (!util_1.objectDefinedNotNull(o)) {
return null;

@@ -82,5 +84,5 @@ }

PnPClientStorageWrapper.prototype.getOrPut = function (key, getter, expire) {
return __awaiter(this, void 0, void 0, function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var o;
return __generator(this, function (_a) {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {

@@ -107,5 +109,5 @@ case 0:

PnPClientStorageWrapper.prototype.deleteExpired = function () {
return __awaiter(this, void 0, void 0, function () {
return tslib_1.__awaiter(this, void 0, void 0, function () {
var i, key;
return __generator(this, function (_a) {
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {

@@ -157,9 +159,9 @@ case 0:

// ensure we are by default inline with the global library setting
var defaultTimeout = RuntimeConfig.defaultCachingTimeoutSeconds;
var defaultTimeout = libconfig_1.RuntimeConfig.defaultCachingTimeoutSeconds;
if (this.defaultTimeoutMinutes > 0) {
defaultTimeout = this.defaultTimeoutMinutes * 60;
}
expire = dateAdd(new Date(), "second", defaultTimeout);
expire = util_1.dateAdd(new Date(), "second", defaultTimeout);
}
return jsS({ pnp: 1, expiration: expire, value: o });
return util_1.jsS({ pnp: 1, expiration: expire, value: o });
};

@@ -176,3 +178,3 @@ /**

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

@@ -182,3 +184,3 @@ };

}());
export { PnPClientStorageWrapper };
exports.PnPClientStorageWrapper = PnPClientStorageWrapper;
/**

@@ -259,3 +261,3 @@ * A thin implementation of in-memory storage for use in nodejs

}());
export { PnPClientStorage };
exports.PnPClientStorage = PnPClientStorage;
//# sourceMappingURL=storage.js.map

@@ -0,1 +1,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/**

@@ -9,3 +11,3 @@ * Gets a callback function which will maintain context across async calls.

*/
export function getCtxCallback(context, method) {
function getCtxCallback(context, method) {
var params = [];

@@ -19,2 +21,3 @@ for (var _i = 2; _i < arguments.length; _i++) {

}
exports.getCtxCallback = getCtxCallback;
/**

@@ -29,3 +32,3 @@ * Adds a value to a date

*/
export function dateAdd(date, interval, units) {
function dateAdd(date, interval, units) {
var ret = new Date(date.toString()); // don't change original date

@@ -63,2 +66,3 @@ switch (interval.toLowerCase()) {

}
exports.dateAdd = dateAdd;
/**

@@ -69,3 +73,3 @@ * Combines an arbitrary set of paths ensuring and normalizes the slashes

*/
export function combine() {
function combine() {
var paths = [];

@@ -81,2 +85,3 @@ for (var _i = 0; _i < arguments.length; _i++) {

}
exports.combine = combine;
/**

@@ -89,3 +94,3 @@ * Gets a random string of chars length

*/
export function getRandomString(chars) {
function getRandomString(chars) {
var text = new Array(chars);

@@ -97,2 +102,3 @@ for (var i = 0; i < chars; i++) {

}
exports.getRandomString = getRandomString;
/**

@@ -104,3 +110,3 @@ * Gets a random GUID value

/* tslint:disable no-bitwise */
export function getGUID() {
function getGUID() {
var d = Date.now();

@@ -113,2 +119,3 @@ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {

}
exports.getGUID = getGUID;
/* tslint:enable */

@@ -120,5 +127,6 @@ /**

*/
export function isFunc(f) {
function isFunc(f) {
return typeof f === "function";
}
exports.isFunc = isFunc;
/**

@@ -128,11 +136,13 @@ * Determines if an object is both defined and not null

*/
export function objectDefinedNotNull(obj) {
function objectDefinedNotNull(obj) {
return typeof obj !== "undefined" && obj !== null;
}
exports.objectDefinedNotNull = objectDefinedNotNull;
/**
* @returns whether the provided parameter is a JavaScript Array or not.
*/
export function isArray(array) {
function isArray(array) {
return Array.isArray ? Array.isArray(array) : array && typeof array.length === "number" && array.constructor === Array;
}
exports.isArray = isArray;
/**

@@ -147,3 +157,3 @@ * Provides functionality to extend the given object by doing a shallow copy

*/
export function assign(target, source, noOverwrite, filter) {
function assign(target, source, noOverwrite, filter) {
if (noOverwrite === void 0) { noOverwrite = false; }

@@ -165,2 +175,3 @@ if (filter === void 0) { filter = function () { return true; }; }

}
exports.assign = assign;
/**

@@ -171,5 +182,6 @@ * Determines if a given url is absolute

*/
export function isUrlAbsolute(url) {
function isUrlAbsolute(url) {
return /^https?:\/\/|^\/\//i.test(url);
}
exports.isUrlAbsolute = isUrlAbsolute;
/**

@@ -180,5 +192,6 @@ * Determines if a string is null or empty or undefined

*/
export function stringIsNullOrEmpty(s) {
function stringIsNullOrEmpty(s) {
return s === undefined || s === null || s.length < 1;
}
exports.stringIsNullOrEmpty = stringIsNullOrEmpty;
/**

@@ -189,3 +202,3 @@ * Ensures guid values are represented consistently as "ea123463-137d-4ae3-89b8-cf3fc578ca05"

*/
export function sanitizeGuid(guid) {
function sanitizeGuid(guid) {
if (stringIsNullOrEmpty(guid)) {

@@ -197,2 +210,3 @@ return guid;

}
exports.sanitizeGuid = sanitizeGuid;
/**

@@ -203,5 +217,6 @@ * Shorthand for JSON.stringify

*/
export function jsS(o) {
function jsS(o) {
return JSON.stringify(o);
}
exports.jsS = jsS;
/**

@@ -213,5 +228,6 @@ * Shorthand for Object.hasOwnProperty

*/
export function hOP(o, p) {
function hOP(o, p) {
return Object.hasOwnProperty.call(o, p);
}
exports.hOP = hOP;
/**

@@ -223,3 +239,3 @@ * Generates a ~unique hash code

// tslint:disable:no-bitwise
export function getHashCode(s) {
function getHashCode(s) {
var hash = 0;

@@ -236,3 +252,4 @@ if (s.length === 0) {

}
exports.getHashCode = getHashCode;
// tslint:enable:no-bitwise
//# sourceMappingURL=util.js.map
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