@pnp/odata
Advanced tools
Comparing version 2.0.10 to 2.1.0-beta0
@@ -10,4 +10,4 @@ import { IODataParser } from "./parsers"; | ||
key: string; | ||
storeName: "session" | "local"; | ||
expiration: Date; | ||
storeName?: "session" | "local"; | ||
expiration?: Date; | ||
protected static storage: PnPClientStorage; | ||
@@ -14,0 +14,0 @@ constructor(key: string, storeName?: "session" | "local", expiration?: Date); |
@@ -1,6 +0,4 @@ | ||
import { RuntimeConfig, dateAdd, PnPClientStorage } from "@pnp/common"; | ||
import { PnPClientStorage } from "@pnp/common"; | ||
var CachingOptions = /** @class */ (function () { | ||
function CachingOptions(key, storeName, expiration) { | ||
if (storeName === void 0) { storeName = RuntimeConfig.defaultCachingStore; } | ||
if (expiration === void 0) { expiration = dateAdd(new Date(), "second", RuntimeConfig.defaultCachingTimeoutSeconds); } | ||
this.key = key; | ||
@@ -7,0 +5,0 @@ this.storeName = storeName; |
import { __read, __spread } from "tslib"; | ||
import { RuntimeConfig } from "@pnp/common"; | ||
import { DefaultRuntime } from "@pnp/common"; | ||
import { extensionOrDefault, applyFactoryExtensions } from "./invokable-extensions"; | ||
@@ -21,3 +21,4 @@ var invokableBinder = function (invoker) { return function (constructor) { | ||
}; | ||
if (RuntimeConfig.ie11) { | ||
// ie11 setting is always global | ||
if (DefaultRuntime.get("ie11") || false) { | ||
return factory(args); | ||
@@ -24,0 +25,0 @@ } |
{ | ||
"name": "@pnp/odata", | ||
"version": "2.0.10", | ||
"version": "2.1.0-beta0", | ||
"description": "pnp - provides shared odata functionality and base classes", | ||
@@ -9,4 +9,4 @@ "main": "./index.js", | ||
"tslib": "2.0.0", | ||
"@pnp/logging": "2.0.10", | ||
"@pnp/common": "2.0.10" | ||
"@pnp/logging": "2.1.0-beta0", | ||
"@pnp/common": "2.1.0-beta0" | ||
}, | ||
@@ -13,0 +13,0 @@ "author": { |
@@ -1,2 +0,2 @@ | ||
import { IFetchOptions, IConfigOptions, IRequestClient } from "@pnp/common"; | ||
import { IFetchOptions, IConfigOptions, IRequestClient, ITypedHash, Runtime } from "@pnp/common"; | ||
import { ICachingOptions } from "./caching"; | ||
@@ -39,8 +39,14 @@ import { Batch } from "./batch"; | ||
defaultAction(options?: IFetchOptions): Promise<DefaultActionType>; | ||
getRuntime(): Runtime; | ||
setRuntime(runtime: Runtime): this; | ||
setRuntime(cloneGlobal: boolean, additionalConfig?: ITypedHash<any>): this; | ||
} | ||
export declare abstract class Queryable<DefaultActionType = any> implements IQueryable<DefaultActionType> { | ||
private _data; | ||
private _runtime; | ||
constructor(dataSeed?: Partial<IQueryableData<DefaultActionType>>); | ||
get data(): Partial<IQueryableData<DefaultActionType>>; | ||
set data(value: Partial<IQueryableData<DefaultActionType>>); | ||
getRuntime(): Runtime; | ||
setRuntime(...args: [runtime: Runtime] | [cloneGlobal: boolean, additionalConfig?: ITypedHash<any>]): this; | ||
/** | ||
@@ -88,3 +94,3 @@ * Gets the full url with query information | ||
*/ | ||
usingCaching(options?: ICachingOptions): this; | ||
usingCaching(options?: string | ICachingOptions): this; | ||
usingParser(parser: IODataParser<any>): this; | ||
@@ -91,0 +97,0 @@ /** |
import { __read, __spread } from "tslib"; | ||
import { combine, RuntimeConfig, mergeOptions, objectDefinedNotNull, assign, } from "@pnp/common"; | ||
import { combine, mergeOptions, objectDefinedNotNull, assign, Runtime, DefaultRuntime, dateAdd, stringIsNullOrEmpty, } from "@pnp/common"; | ||
import { ODataParser } from "./parsers"; | ||
@@ -17,9 +17,5 @@ export function cloneQueryableData(source) { | ||
case "batch": | ||
return "-"; | ||
case "batchDependency": | ||
return "-"; | ||
case "cachingOptions": | ||
return "-"; | ||
case "clientFactory": | ||
return "-"; | ||
case "parser": | ||
@@ -36,11 +32,7 @@ return "-"; | ||
case "batch": | ||
return source.batch; | ||
case "batchDependency": | ||
return source.batchDependency; | ||
case "cachingOptions": | ||
return source.cachingOptions; | ||
case "clientFactory": | ||
return source.clientFactory; | ||
case "parser": | ||
return source.parser; | ||
return source[key]; | ||
default: | ||
@@ -68,2 +60,3 @@ return value; | ||
}, cloneQueryableData(dataSeed)); | ||
this._runtime = null; | ||
} | ||
@@ -80,2 +73,24 @@ Object.defineProperty(Queryable.prototype, "data", { | ||
}); | ||
Queryable.prototype.getRuntime = function () { | ||
if (this._runtime === null) { | ||
return DefaultRuntime; | ||
} | ||
return this._runtime; | ||
}; | ||
Queryable.prototype.setRuntime = function () { | ||
var args = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
args[_i] = arguments[_i]; | ||
} | ||
if (args[0] instanceof Runtime) { | ||
this._runtime = args[0]; | ||
} | ||
else { | ||
this._runtime = args[0] ? new Runtime(DefaultRuntime.export()) : new Runtime(); | ||
if (args.length > 1 && objectDefinedNotNull(args[1])) { | ||
this._runtime.assign(args[1]); | ||
} | ||
} | ||
return this; | ||
}; | ||
/** | ||
@@ -124,2 +139,6 @@ * Gets the current url | ||
mergeOptions(this.data.options, o.data.options); | ||
var sourceRuntime = o.getRuntime(); | ||
if (!sourceRuntime.get("__isDefault__")) { | ||
this.setRuntime(sourceRuntime); | ||
} | ||
return this; | ||
@@ -133,7 +152,18 @@ }; | ||
Queryable.prototype.usingCaching = function (options) { | ||
if (!RuntimeConfig.globalCacheDisable) { | ||
var runtime = this.getRuntime(); | ||
if (!runtime.get("globalCacheDisable")) { | ||
this.data.useCaching = true; | ||
if (options !== undefined) { | ||
this.data.cachingOptions = options; | ||
// handle getting just the key | ||
if (typeof options === "string") { | ||
if (stringIsNullOrEmpty(options)) { | ||
throw Error("Cache key cannot be empty."); | ||
} | ||
options = { key: options }; | ||
} | ||
// this uses our local options if they are defined as defaults | ||
var defaultOpts = { | ||
expiration: dateAdd(new Date(), "second", runtime.get("defaultCachingTimeoutSeconds")), | ||
storeName: runtime.get("defaultCachingStore"), | ||
}; | ||
this.data.cachingOptions = assign(defaultOpts, options); | ||
} | ||
@@ -140,0 +170,0 @@ return this; |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
106251
1557
1
+ Added@pnp/common@2.1.0-beta0(transitive)
+ Added@pnp/logging@2.1.0-beta0(transitive)
- Removed@pnp/common@2.0.10(transitive)
- Removed@pnp/logging@2.0.10(transitive)
Updated@pnp/common@2.1.0-beta0
Updated@pnp/logging@2.1.0-beta0