@pnp/odata
Advanced tools
Comparing version 1.0.0-beta.0 to 1.0.0-beta.1
@@ -1,2 +0,2 @@ | ||
import { PnPClientStorage, RuntimeConfig, Util, mergeOptions } from '@pnp/common'; | ||
import { Dictionary, PnPClientStorage, RuntimeConfig, Util, mergeOptions } from '@pnp/common'; | ||
import { LogLevel, Logger } from '@pnp/logging'; | ||
@@ -439,2 +439,9 @@ | ||
function ODataQueryable() { | ||
this._batch = null; | ||
this._query = new Dictionary(); | ||
this._options = {}; | ||
this._url = ""; | ||
this._parentUrl = ""; | ||
this._useCaching = false; | ||
this._cachingOptions = null; | ||
} | ||
@@ -549,3 +556,3 @@ /** | ||
ODataQueryable.prototype.addBatchDependency = function () { | ||
if (this.hasBatch) { | ||
if (this._batch !== null) { | ||
return this._batch.addDependency(); | ||
@@ -552,0 +559,0 @@ } |
@@ -442,2 +442,9 @@ (function (global, factory) { | ||
function ODataQueryable() { | ||
this._batch = null; | ||
this._query = new common.Dictionary(); | ||
this._options = {}; | ||
this._url = ""; | ||
this._parentUrl = ""; | ||
this._useCaching = false; | ||
this._cachingOptions = null; | ||
} | ||
@@ -552,3 +559,3 @@ /** | ||
ODataQueryable.prototype.addBatchDependency = function () { | ||
if (this.hasBatch) { | ||
if (this._batch !== null) { | ||
return this._batch.addDependency(); | ||
@@ -555,0 +562,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@pnp/common"),require("@pnp/logging")):"function"==typeof define&&define.amd?define(["exports","@pnp/common","@pnp/logging"],t):t(e.pnp={},e.common,e.logging)}(this,function(e,t,n){"use strict";function r(e){return n.Logger.log({data:e.result,level:n.LogLevel.Verbose,message:"["+e.requestId+"] ("+(new Date).getTime()+") Returning result, see data property for value."}),Promise.resolve(e.result||null)}function o(e,t){return new Promise(function(n){e.result=t,e.hasResult=!0,n(e)})}function i(e){var t=e.pipeline.shift();return void 0!==t?t(e):Promise.resolve(e)}function u(e){return i(e).then(function(e){return r(e)}).catch(function(e){throw n.Logger.log({data:e,level:n.LogLevel.Error,message:"Error in request pipeline: "+e.message}),e})}function a(e){return void 0===e&&(e=!1),function(t,r,o){var u=o.value;o.value=function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];return!e&&o.length>0&&o[0].hasOwnProperty("hasResult")&&o[0].hasResult?(n.Logger.write("["+o[0].requestId+"] ("+(new Date).getTime()+") Skipping request pipeline method "+r+", existing result in pipeline.",n.LogLevel.Verbose),Promise.resolve(o[0])):(n.Logger.write("["+o[0].requestId+"] ("+(new Date).getTime()+") Calling request pipeline method "+r+".",n.LogLevel.Verbose),u.apply(t,o).then(function(e){return i(e)}))}}}var s=function(){function e(e){this.key=e,this.expiration=t.Util.dateAdd(new Date,"second",t.RuntimeConfig.defaultCachingTimeoutSeconds),this.storeName=t.RuntimeConfig.defaultCachingStore}return Object.defineProperty(e.prototype,"store",{get:function(){return"local"===this.storeName?e.storage.local:e.storage.session},enumerable:!0,configurable:!0}),e.storage=new t.PnPClientStorage,e}(),c=function(){function e(e,t){this._parser=e,this._cacheOptions=t}return e.prototype.parse=function(e){var t=this;return this._parser.parse(e).then(function(e){return null!==t._cacheOptions.store&&t._cacheOptions.store.put(t._cacheOptions.key,e,t._cacheOptions.expiration),e})},e}(),l=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),p=function(e){function t(t,r,o){var i=e.call(this,"Error making HttpClient request in queryable: ["+t+"] "+r)||this;return i.status=t,i.statusText=r,i.data=o,i.name="ProcessHttpClientResponseException",n.Logger.log({data:i.data,level:n.LogLevel.Error,message:i.message}),i}return l(t,e),t}(Error),f=function(e){function t(t){void 0===t&&(t="This query is already part of a batch.");var r=e.call(this,t)||this;return r.name="AlreadyInBatchException",n.Logger.log({data:{},level:n.LogLevel.Error,message:"["+r.name+"]::"+r.message}),r}return l(t,e),t}(Error),h=function(){function e(){}return e.prototype.parse=function(e){var t=this;return new Promise(function(n,r){t.handleError(e,r)&&(e.headers.has("Content-Length")&&0===parseFloat(e.headers.get("Content-Length")||"-1")||204===e.status?n({}):e.text().then(function(e){return e.replace(/\s/gi,"").length>0?JSON.parse(e):{}}).then(function(e){return n(t.parseODataJSON(e))}).catch(function(e){return r(e)}))})},e.prototype.handleError=function(e,t){return e.ok||e.json().then(function(n){var r={responseBody:n,responseHeaders:e.headers};t(new p(e.status,e.statusText,r))}).catch(function(r){n.Logger.log({data:r,level:n.LogLevel.Warning,message:"There was an error parsing the error response body. See data for details."});var o={responseBody:"[[body not available]]",responseHeaders:e.headers};t(new p(e.status,e.statusText,o))}),e.ok},e.prototype.parseODataJSON=function(e){var t=e;return e.hasOwnProperty("d")?t=e.d.hasOwnProperty("results")?e.d.results:e.d:e.hasOwnProperty("value")&&(t=e.value),t},e}(),g=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return g(t,e),t}(h),v=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return g(t,e),t.prototype.parse=function(t){return e.prototype.parse.call(this,t).then(function(e){return e})},t}(h),y=function(){function e(){}return e.prototype.parse=function(e){return e.json()},e}(),b=new y,m=function(){function e(){}return e.prototype.parse=function(e){return e.text()},e}(),L=function(){function e(){}return e.prototype.parse=function(e){return e.blob()},e}(),w=function(){function e(){}return e.prototype.parse=function(e){return e.json()},e}(),P=function(){function e(){}return e.prototype.parse=function(e){return t.Util.isFunction(e.arrayBuffer)?e.arrayBuffer():e.buffer()},e}(),O=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u},_=function(){function e(){}return e.logStart=function(e){return new Promise(function(t){n.Logger.log({data:n.Logger.activeLogLevel===n.LogLevel.Info?{}:e,level:n.LogLevel.Info,message:"["+e.requestId+"] ("+(new Date).getTime()+") Beginning "+e.verb+" request ("+e.requestAbsoluteUrl+")"}),t(e)})},e.caching=function(e){return new Promise(function(r){if("GET"===e.verb&&e.isCached){n.Logger.write("["+e.requestId+"] ("+(new Date).getTime()+") Caching is enabled for request, checking cache...",n.LogLevel.Info);var i=new s(e.requestAbsoluteUrl.toLowerCase());if(void 0!==e.cachingOptions&&(i=t.Util.extend(i,e.cachingOptions)),null!==i.store){var u=i.store.get(i.key);if(null!==u)return n.Logger.log({data:n.Logger.activeLogLevel===n.LogLevel.Info?{}:u,level:n.LogLevel.Info,message:"["+e.requestId+"] ("+(new Date).getTime()+") Value returned from cache."}),e.batchDependency(),o(e,u).then(function(e){return r(e)})}n.Logger.write("["+e.requestId+"] ("+(new Date).getTime()+") Value not found in cache.",n.LogLevel.Info),e.parser=new c(e.parser,i)}return r(e)})},e.send=function(e){return new Promise(function(r,i){if(e.isBatched){var u=e.batch.add(e.requestAbsoluteUrl,e.verb,e.options,e.parser);e.batchDependency(),n.Logger.write("["+e.requestId+"] ("+(new Date).getTime()+") Batching request in batch "+e.batch.batchId+".",n.LogLevel.Info),r(o(e,u))}else{n.Logger.write("["+e.requestId+"] ("+(new Date).getTime()+") Sending request.",n.LogLevel.Info);var a=e.clientFactory(),s=t.Util.extend(e.options||{},{method:e.verb});a.fetch(e.requestAbsoluteUrl,s).then(function(t){return e.parser.parse(t)}).then(function(t){return o(e,t)}).then(function(e){return r(e)}).catch(function(e){return i(e)})}})},e.logEnd=function(e){return new Promise(function(t){e.isBatched?n.Logger.log({data:n.Logger.activeLogLevel===n.LogLevel.Info?{}:e,level:n.LogLevel.Info,message:"["+e.requestId+"] ("+(new Date).getTime()+") "+e.verb+" request will complete in batch "+e.batch.batchId+"."}):n.Logger.log({data:n.Logger.activeLogLevel===n.LogLevel.Info?{}:e,level:n.LogLevel.Info,message:"["+e.requestId+"] ("+(new Date).getTime()+") Completing "+e.verb+" request."}),t(e)})},Object.defineProperty(e,"default",{get:function(){return[e.logStart,e.caching,e.send,e.logEnd]},enumerable:!0,configurable:!0}),O([a(!0)],e,"logStart",null),O([a()],e,"caching",null),O([a()],e,"send",null),O([a(!0)],e,"logEnd",null),e}(),q=function(){function e(){}return e.prototype.concat=function(e){return this._url+=e,this},Object.defineProperty(e.prototype,"query",{get:function(){return this._query},enumerable:!0,configurable:!0}),e.prototype.configure=function(e){return t.mergeOptions(this._options,e),this},e.prototype.usingCaching=function(e){return t.RuntimeConfig.globalCacheDisable||(this._useCaching=!0,void 0!==e&&(this._cachingOptions=e)),this},e.prototype.inBatch=function(e){if(null!==this.batch)throw new f;return this._batch=e,this},e.prototype.toUrl=function(){return this._url},e.prototype.get=function(e,t){return void 0===e&&(e=new d),void 0===t&&(t={}),this.toRequestContext("GET",t,e,_.default).then(function(e){return u(e)})},e.prototype.getAs=function(e,t){return void 0===e&&(e=new d),void 0===t&&(t={}),this.toRequestContext("GET",t,e,_.default).then(function(e){return u(e)})},e.prototype.postCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new d),this.toRequestContext("POST",e,t,_.default).then(function(e){return u(e)})},e.prototype.postAsCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new d),this.toRequestContext("POST",e,t,_.default).then(function(e){return u(e)})},e.prototype.patchCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new d),this.toRequestContext("PATCH",e,t,_.default).then(function(e){return u(e)})},e.prototype.deleteCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new d),this.toRequestContext("DELETE",e,t,_.default).then(function(e){return u(e)})},e.prototype.addBatchDependency=function(){return this.hasBatch?this._batch.addDependency():function(){return null}},Object.defineProperty(e.prototype,"hasBatch",{get:function(){return t.Util.objectDefinedNotNull(this._batch)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"batch",{get:function(){return this.hasBatch?this._batch:null},enumerable:!0,configurable:!0}),e.prototype.append=function(e){this._url=t.Util.combinePaths(this._url,e)},Object.defineProperty(e.prototype,"parentUrl",{get:function(){return this._parentUrl},enumerable:!0,configurable:!0}),e}(),C=function(){function e(e){void 0===e&&(e=t.Util.getGUID()),this._batchId=e,this._requests=[],this._dependencies=[]}return Object.defineProperty(e.prototype,"batchId",{get:function(){return this._batchId},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"requests",{get:function(){return this._requests},enumerable:!0,configurable:!0}),e.prototype.add=function(e,t,n,r){var o={method:t.toUpperCase(),options:n,parser:r,reject:null,resolve:null,url:e},i=new Promise(function(e,t){o.resolve=e,o.reject=t});return this._requests.push(o),i},e.prototype.addDependency=function(){var e=function(){},t=new Promise(function(t){e=t});return this._dependencies.push(t),e},e.prototype.execute=function(){var e=this;return Promise.all(this._dependencies).then(function(){return Promise.all(e._dependencies)}).then(function(){return e.executeImpl()})},e}();e.CachingOptions=s,e.CachingParserWrapper=c,e.ODataParserBase=h,e.ProcessHttpClientResponseException=p,e.AlreadyInBatchException=f,e.ODataDefaultParser=d,e.ODataValue=function(){return new v},e.ODataRawParserImpl=y,e.ODataRaw=b,e.TextFileParser=m,e.BlobFileParser=L,e.JSONFileParser=w,e.BufferFileParser=P,e.setResult=o,e.pipe=u,e.requestPipelineMethod=a,e.PipelineMethods=_,e.ODataQueryable=q,e.ODataBatch=C,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@pnp/common"),require("@pnp/logging")):"function"==typeof define&&define.amd?define(["exports","@pnp/common","@pnp/logging"],t):t(e.pnp={},e.common,e.logging)}(this,function(e,t,n){"use strict";function r(e){return n.Logger.log({data:e.result,level:n.LogLevel.Verbose,message:"["+e.requestId+"] ("+(new Date).getTime()+") Returning result, see data property for value."}),Promise.resolve(e.result||null)}function o(e,t){return new Promise(function(n){e.result=t,e.hasResult=!0,n(e)})}function i(e){var t=e.pipeline.shift();return void 0!==t?t(e):Promise.resolve(e)}function u(e){return i(e).then(function(e){return r(e)}).catch(function(e){throw n.Logger.log({data:e,level:n.LogLevel.Error,message:"Error in request pipeline: "+e.message}),e})}function s(e){return void 0===e&&(e=!1),function(t,r,o){var u=o.value;o.value=function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];return!e&&o.length>0&&o[0].hasOwnProperty("hasResult")&&o[0].hasResult?(n.Logger.write("["+o[0].requestId+"] ("+(new Date).getTime()+") Skipping request pipeline method "+r+", existing result in pipeline.",n.LogLevel.Verbose),Promise.resolve(o[0])):(n.Logger.write("["+o[0].requestId+"] ("+(new Date).getTime()+") Calling request pipeline method "+r+".",n.LogLevel.Verbose),u.apply(t,o).then(function(e){return i(e)}))}}}var a=function(){function e(e){this.key=e,this.expiration=t.Util.dateAdd(new Date,"second",t.RuntimeConfig.defaultCachingTimeoutSeconds),this.storeName=t.RuntimeConfig.defaultCachingStore}return Object.defineProperty(e.prototype,"store",{get:function(){return"local"===this.storeName?e.storage.local:e.storage.session},enumerable:!0,configurable:!0}),e.storage=new t.PnPClientStorage,e}(),c=function(){function e(e,t){this._parser=e,this._cacheOptions=t}return e.prototype.parse=function(e){var t=this;return this._parser.parse(e).then(function(e){return null!==t._cacheOptions.store&&t._cacheOptions.store.put(t._cacheOptions.key,e,t._cacheOptions.expiration),e})},e}(),l=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),p=function(e){function t(t,r,o){var i=e.call(this,"Error making HttpClient request in queryable: ["+t+"] "+r)||this;return i.status=t,i.statusText=r,i.data=o,i.name="ProcessHttpClientResponseException",n.Logger.log({data:i.data,level:n.LogLevel.Error,message:i.message}),i}return l(t,e),t}(Error),f=function(e){function t(t){void 0===t&&(t="This query is already part of a batch.");var r=e.call(this,t)||this;return r.name="AlreadyInBatchException",n.Logger.log({data:{},level:n.LogLevel.Error,message:"["+r.name+"]::"+r.message}),r}return l(t,e),t}(Error),h=function(){function e(){}return e.prototype.parse=function(e){var t=this;return new Promise(function(n,r){t.handleError(e,r)&&(e.headers.has("Content-Length")&&0===parseFloat(e.headers.get("Content-Length")||"-1")||204===e.status?n({}):e.text().then(function(e){return e.replace(/\s/gi,"").length>0?JSON.parse(e):{}}).then(function(e){return n(t.parseODataJSON(e))}).catch(function(e){return r(e)}))})},e.prototype.handleError=function(e,t){return e.ok||e.json().then(function(n){var r={responseBody:n,responseHeaders:e.headers};t(new p(e.status,e.statusText,r))}).catch(function(r){n.Logger.log({data:r,level:n.LogLevel.Warning,message:"There was an error parsing the error response body. See data for details."});var o={responseBody:"[[body not available]]",responseHeaders:e.headers};t(new p(e.status,e.statusText,o))}),e.ok},e.prototype.parseODataJSON=function(e){var t=e;return e.hasOwnProperty("d")?t=e.d.hasOwnProperty("results")?e.d.results:e.d:e.hasOwnProperty("value")&&(t=e.value),t},e}(),g=function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return g(t,e),t}(h),v=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return g(t,e),t.prototype.parse=function(t){return e.prototype.parse.call(this,t).then(function(e){return e})},t}(h),y=function(){function e(){}return e.prototype.parse=function(e){return e.json()},e}(),b=new y,m=function(){function e(){}return e.prototype.parse=function(e){return e.text()},e}(),L=function(){function e(){}return e.prototype.parse=function(e){return e.blob()},e}(),w=function(){function e(){}return e.prototype.parse=function(e){return e.json()},e}(),_=function(){function e(){}return e.prototype.parse=function(e){return t.Util.isFunction(e.arrayBuffer)?e.arrayBuffer():e.buffer()},e}(),O=function(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u},P=function(){function e(){}return e.logStart=function(e){return new Promise(function(t){n.Logger.log({data:n.Logger.activeLogLevel===n.LogLevel.Info?{}:e,level:n.LogLevel.Info,message:"["+e.requestId+"] ("+(new Date).getTime()+") Beginning "+e.verb+" request ("+e.requestAbsoluteUrl+")"}),t(e)})},e.caching=function(e){return new Promise(function(r){if("GET"===e.verb&&e.isCached){n.Logger.write("["+e.requestId+"] ("+(new Date).getTime()+") Caching is enabled for request, checking cache...",n.LogLevel.Info);var i=new a(e.requestAbsoluteUrl.toLowerCase());if(void 0!==e.cachingOptions&&(i=t.Util.extend(i,e.cachingOptions)),null!==i.store){var u=i.store.get(i.key);if(null!==u)return n.Logger.log({data:n.Logger.activeLogLevel===n.LogLevel.Info?{}:u,level:n.LogLevel.Info,message:"["+e.requestId+"] ("+(new Date).getTime()+") Value returned from cache."}),e.batchDependency(),o(e,u).then(function(e){return r(e)})}n.Logger.write("["+e.requestId+"] ("+(new Date).getTime()+") Value not found in cache.",n.LogLevel.Info),e.parser=new c(e.parser,i)}return r(e)})},e.send=function(e){return new Promise(function(r,i){if(e.isBatched){var u=e.batch.add(e.requestAbsoluteUrl,e.verb,e.options,e.parser);e.batchDependency(),n.Logger.write("["+e.requestId+"] ("+(new Date).getTime()+") Batching request in batch "+e.batch.batchId+".",n.LogLevel.Info),r(o(e,u))}else{n.Logger.write("["+e.requestId+"] ("+(new Date).getTime()+") Sending request.",n.LogLevel.Info);var s=e.clientFactory(),a=t.Util.extend(e.options||{},{method:e.verb});s.fetch(e.requestAbsoluteUrl,a).then(function(t){return e.parser.parse(t)}).then(function(t){return o(e,t)}).then(function(e){return r(e)}).catch(function(e){return i(e)})}})},e.logEnd=function(e){return new Promise(function(t){e.isBatched?n.Logger.log({data:n.Logger.activeLogLevel===n.LogLevel.Info?{}:e,level:n.LogLevel.Info,message:"["+e.requestId+"] ("+(new Date).getTime()+") "+e.verb+" request will complete in batch "+e.batch.batchId+"."}):n.Logger.log({data:n.Logger.activeLogLevel===n.LogLevel.Info?{}:e,level:n.LogLevel.Info,message:"["+e.requestId+"] ("+(new Date).getTime()+") Completing "+e.verb+" request."}),t(e)})},Object.defineProperty(e,"default",{get:function(){return[e.logStart,e.caching,e.send,e.logEnd]},enumerable:!0,configurable:!0}),O([s(!0)],e,"logStart",null),O([s()],e,"caching",null),O([s()],e,"send",null),O([s(!0)],e,"logEnd",null),e}(),q=function(){function e(){this._batch=null,this._query=new t.Dictionary,this._options={},this._url="",this._parentUrl="",this._useCaching=!1,this._cachingOptions=null}return e.prototype.concat=function(e){return this._url+=e,this},Object.defineProperty(e.prototype,"query",{get:function(){return this._query},enumerable:!0,configurable:!0}),e.prototype.configure=function(e){return t.mergeOptions(this._options,e),this},e.prototype.usingCaching=function(e){return t.RuntimeConfig.globalCacheDisable||(this._useCaching=!0,void 0!==e&&(this._cachingOptions=e)),this},e.prototype.inBatch=function(e){if(null!==this.batch)throw new f;return this._batch=e,this},e.prototype.toUrl=function(){return this._url},e.prototype.get=function(e,t){return void 0===e&&(e=new d),void 0===t&&(t={}),this.toRequestContext("GET",t,e,P.default).then(function(e){return u(e)})},e.prototype.getAs=function(e,t){return void 0===e&&(e=new d),void 0===t&&(t={}),this.toRequestContext("GET",t,e,P.default).then(function(e){return u(e)})},e.prototype.postCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new d),this.toRequestContext("POST",e,t,P.default).then(function(e){return u(e)})},e.prototype.postAsCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new d),this.toRequestContext("POST",e,t,P.default).then(function(e){return u(e)})},e.prototype.patchCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new d),this.toRequestContext("PATCH",e,t,P.default).then(function(e){return u(e)})},e.prototype.deleteCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new d),this.toRequestContext("DELETE",e,t,P.default).then(function(e){return u(e)})},e.prototype.addBatchDependency=function(){return null!==this._batch?this._batch.addDependency():function(){return null}},Object.defineProperty(e.prototype,"hasBatch",{get:function(){return t.Util.objectDefinedNotNull(this._batch)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"batch",{get:function(){return this.hasBatch?this._batch:null},enumerable:!0,configurable:!0}),e.prototype.append=function(e){this._url=t.Util.combinePaths(this._url,e)},Object.defineProperty(e.prototype,"parentUrl",{get:function(){return this._parentUrl},enumerable:!0,configurable:!0}),e}(),C=function(){function e(e){void 0===e&&(e=t.Util.getGUID()),this._batchId=e,this._requests=[],this._dependencies=[]}return Object.defineProperty(e.prototype,"batchId",{get:function(){return this._batchId},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"requests",{get:function(){return this._requests},enumerable:!0,configurable:!0}),e.prototype.add=function(e,t,n,r){var o={method:t.toUpperCase(),options:n,parser:r,reject:null,resolve:null,url:e},i=new Promise(function(e,t){o.resolve=e,o.reject=t});return this._requests.push(o),i},e.prototype.addDependency=function(){var e=function(){},t=new Promise(function(t){e=t});return this._dependencies.push(t),e},e.prototype.execute=function(){var e=this;return Promise.all(this._dependencies).then(function(){return Promise.all(e._dependencies)}).then(function(){return e.executeImpl()})},e}();e.CachingOptions=a,e.CachingParserWrapper=c,e.ODataParserBase=h,e.ProcessHttpClientResponseException=p,e.AlreadyInBatchException=f,e.ODataDefaultParser=d,e.ODataValue=function(){return new v},e.ODataRawParserImpl=y,e.ODataRaw=b,e.TextFileParser=m,e.BlobFileParser=L,e.JSONFileParser=w,e.BufferFileParser=_,e.setResult=o,e.pipe=u,e.requestPipelineMethod=s,e.PipelineMethods=P,e.ODataQueryable=q,e.ODataBatch=C,Object.defineProperty(e,"__esModule",{value:!0})}); |
@@ -1,2 +0,2 @@ | ||
import { PnPClientStorage, RuntimeConfig, Util, mergeOptions } from '@pnp/common'; | ||
import { Dictionary, PnPClientStorage, RuntimeConfig, Util, mergeOptions } from '@pnp/common'; | ||
import { LogLevel, Logger } from '@pnp/logging'; | ||
@@ -363,2 +363,11 @@ | ||
class ODataQueryable { | ||
constructor() { | ||
this._batch = null; | ||
this._query = new Dictionary(); | ||
this._options = {}; | ||
this._url = ""; | ||
this._parentUrl = ""; | ||
this._useCaching = false; | ||
this._cachingOptions = null; | ||
} | ||
/** | ||
@@ -456,3 +465,3 @@ * Directly concatonates the supplied string to the current url, not normalizing "/" chars | ||
addBatchDependency() { | ||
if (this.hasBatch) { | ||
if (this._batch !== null) { | ||
return this._batch.addDependency(); | ||
@@ -459,0 +468,0 @@ } |
{ | ||
"name": "@pnp/odata", | ||
"version": "1.0.0-beta.0", | ||
"version": "1.0.0-beta.1", | ||
"description": "pnp - provides shared odata functionality and base classes", | ||
@@ -9,3 +9,3 @@ "main": "./dist/odata.es5.umd.js", | ||
"peerDependencies": { | ||
"@pnp/logging": "1.0.0-beta.0" | ||
"@pnp/logging": "1.0.0-beta.1" | ||
}, | ||
@@ -12,0 +12,0 @@ "author": { |
@@ -10,3 +10,3 @@ import { Dictionary, FetchOptions, ConfigOptions } from "@pnp/common"; | ||
*/ | ||
protected _batch: BatchType; | ||
protected _batch: BatchType | null; | ||
/** | ||
@@ -35,3 +35,4 @@ * Additional options to be set before sending actual http request | ||
*/ | ||
protected _cachingOptions: ICachingOptions; | ||
protected _cachingOptions: ICachingOptions | null; | ||
constructor(); | ||
/** | ||
@@ -38,0 +39,0 @@ * Directly concatonates the supplied string to the current url, not normalizing "/" chars |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
260562
2217
1