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

@pnp/queryable

Package Overview
Dependencies
Maintainers
13
Versions
980
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pnp/queryable - npm Package Compare versions

Comparing version 3.0.0-v3nightly.20220014 to 3.0.0-v3nightly.20220017

12

behaviors/browser-fetch.d.ts
import { Queryable } from "../queryable.js";
import { TimelinePipe } from "@pnp/core";
export declare function BrowserFetch(): TimelinePipe<Queryable>;
export declare function BrowserFetchWithRetry(retries?: number, interval?: number): TimelinePipe<Queryable>;
interface BrowserFetchProps {
replace?: boolean;
}
export declare function BrowserFetch(props?: BrowserFetchProps): TimelinePipe<Queryable>;
interface BrowserFetchWithRetryProps extends BrowserFetchProps {
retries?: number;
interval?: number;
}
export declare function BrowserFetchWithRetry(props?: BrowserFetchWithRetryProps): TimelinePipe<Queryable>;
export {};
//# sourceMappingURL=browser-fetch.d.ts.map
import { delay } from "@pnp/core";
import { HttpRequestError } from "./parsers.js";
export function BrowserFetch() {
export function BrowserFetch(props) {
const { replace } = {
replace: true,
...props,
};
return (instance) => {
instance.on.send.replace(function (url, init) {
if (replace) {
instance.on.send.clear();
}
instance.on.send(function (url, init) {
this.log(`Fetch: ${init.method} ${url.toString()}`, 0);

@@ -12,5 +19,14 @@ return fetch(url.toString(), init);

}
export function BrowserFetchWithRetry(retries = 3, interval = 200) {
export function BrowserFetchWithRetry(props) {
const { interval, replace, retries } = {
replace: true,
interval: 200,
retries: 3,
...props,
};
return (instance) => {
instance.on.send.replace(function (url, init) {
if (replace) {
instance.on.send.clear();
}
instance.on.send(function (url, init) {
let response;

@@ -17,0 +33,0 @@ let wait = interval;

@@ -5,3 +5,8 @@ import { Queryable } from "../queryable.js";

export declare type CacheExpireFunc = (url: string) => Date;
export declare function Caching(store?: "local" | "session", keyFactory?: CacheKeyFactory, expireFunc?: CacheExpireFunc): TimelinePipe<Queryable>;
export interface ICachingProps {
store?: "local" | "session";
keyFactory?: CacheKeyFactory;
expireFunc?: CacheExpireFunc;
}
export declare function Caching(props?: ICachingProps): TimelinePipe<Queryable>;
//# sourceMappingURL=caching.d.ts.map

16

behaviors/caching.js

@@ -1,11 +0,11 @@

import { isFunc, getHashCode, PnPClientStorage, dateAdd } from "@pnp/core";
export function Caching(store = "session", keyFactory, expireFunc) {
import { getHashCode, PnPClientStorage, dateAdd } from "@pnp/core";
export function Caching(props) {
const storage = new PnPClientStorage();
const { store, keyFactory, expireFunc } = {
store: "local",
keyFactory: (url) => getHashCode(url.toLowerCase()).toString(),
expireFunc: () => dateAdd(new Date(), "minute", 5),
...props,
};
const s = store === "session" ? storage.session : storage.local;
if (!isFunc(keyFactory)) {
keyFactory = (url) => getHashCode(url.toLowerCase()).toString();
}
if (!isFunc(expireFunc)) {
expireFunc = () => dateAdd(new Date(), "minute", 5);
}
return (instance) => {

@@ -12,0 +12,0 @@ instance.on.pre(async function (url, init, result) {

@@ -32,3 +32,4 @@ import { hOP } from "@pnp/core";

// within observers we just throw to indicate an unrecoverable error within the pipeline
throw await HttpRequestError.init(response);
const y = await HttpRequestError.init(response);
throw y;
}

@@ -35,0 +36,0 @@ return [url, response, result];

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

import { objectDefinedNotNull } from "@pnp/core";
function ensureInit(method, init) {
if (!objectDefinedNotNull(init)) {
init = { headers: {} };
}
init.method = method;
return init;
function ensureInit(method, init = { headers: {} }) {
return { method, ...init, headers: { ...init.headers } };
}

@@ -9,0 +4,0 @@ export function get(init) {

{
"name": "@pnp/queryable",
"version": "3.0.0-v3nightly.20220014",
"version": "3.0.0-v3nightly.20220017",
"description": "pnp - provides shared odata functionality and base classes",

@@ -9,3 +9,3 @@ "main": "./index.js",

"tslib": "2.3.1",
"@pnp/core": "3.0.0-v3nightly.20220014"
"@pnp/core": "3.0.0-v3nightly.20220017"
},

@@ -12,0 +12,0 @@ "author": {

@@ -87,3 +87,3 @@ import { __decorate } from "tslib";

// eslint-disable-next-line prefer-const
let [url, init, result] = await this.emit.pre(this.toRequestUrl(), {}, undefined);
let [url, init, result] = await this.emit.pre(this.toRequestUrl(), userInit || {}, undefined);
log(`Url: ${url}`, 1);

@@ -90,0 +90,0 @@ if (typeof result !== "undefined") {

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

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

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