sp-dev-fx-webparts/samples/angular-ngofficeuifabric-fi.../lib/webparts/angularFileUpload/app/services/baseSvc.js.map

1 line
12 KiB
Plaintext

{"version":3,"sources":["webparts/angularFileUpload/app/services/baseSvc.ts"],"names":[],"mappings":";AACA,iCAAmC;AAKnC;IAIE,qBAAoB,KAAsB,EAAU,EAAgB,EAAU,WAAe;QAAzE,UAAK,GAAL,KAAK,CAAiB;QAAU,OAAE,GAAF,EAAE,CAAc;QAAU,gBAAW,GAAX,WAAW,CAAI;QAC3F,IAAI,CAAC,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC;IAC7C,CAAC;IAEM,gCAAU,GAAjB,UAAkB,KAAc,EAAE,QAAiB;QACjD,IAAM,QAAQ,GAAsB,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;QACpD,IAAI,CAAC,KAAK,CAAC;YACT,GAAG,EAAE,QAAQ,IAAI,IAAI,CAAC,OAAO,GAAG,KAAK;YACrC,MAAM,EAAE,KAAK;YACb,OAAO,EAAE;gBACP,QAAQ,EAAE,gCAAgC;gBAC1C,cAAc,EAAE,gCAAgC;aACjD;SACF,CAAC,CAAC,IAAI,CAAC,UAAC,QAAa;YACpB,EAAE,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;gBAC5B,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YAC5C,CAAC;YAAC,IAAI,CAAC,CAAC;gBACN,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACpC,CAAC;QACH,CAAC,EAAE,UAAC,KAAU;YACZ,IAAM,MAAM,GAAW;gBACrB,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI;gBAC3B,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK;g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,IAAI;gBAC3B,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK;gBACvC,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,UAAU,EAAE,KAAK,CAAC,UAAU;aAC7B,CAAC;YACF,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;QAEL,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;IAC1B,CAAC;IACH,kBAAC;AAAD,CA9KA,AA8KC;AA7Ke,mBAAO,GAAa,CAAC,OAAO,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;AADtD,kCAAW","file":"webparts/angularFileUpload/app/services/baseSvc.js","sourcesContent":["import { IError } from \"../../interfaces/IError\";\r\nimport * as angular from 'angular';\r\nimport { IWebPartContext } from '@microsoft/sp-webpart-base';\r\nimport { ServiceKey, ServiceScope } from '@microsoft/sp-core-library';\r\n\r\n\r\nexport class BaseService {\r\n public static $inject: string[] = [\"$http\", \"$q\", \"pageContext\"];\r\n public baseUrl: string;\r\n\r\n constructor(private $http: ng.IHttpService, private $q: ng.IQService, private pageContext:any) {\r\n this.baseUrl = pageContext.web.absoluteUrl;\r\n }\r\n\r\n public getRequest(query?: string, endPoint?: string): ng.IPromise<any> {\r\n const deferred: ng.IDeferred<any> = this.$q.defer();\r\n this.$http({\r\n url: endPoint || this.baseUrl + query,\r\n method: \"GET\",\r\n headers: {\r\n \"accept\": \"application/json;odata=verbose\",\r\n \"content-Type\": \"application/json;odata=verbose\"\r\n }\r\n }).then((response: any): void => {\r\n if (response.data.d.results) {\r\n deferred.resolve(response.data.d.results);\r\n } else {\r\n deferred.resolve(response.data.d);\r\n }\r\n }, (error: any) => {\r\n const iError: IError = {\r\n code: error.data.error.code,\r\n message: error.data.error.message.value,\r\n status: error.status,\r\n statusText: error.statusText\r\n };\r\n deferred.reject(iError);\r\n });\r\n return deferred.promise;\r\n }\r\n\r\n public postRequest(url: string, requestBody: any, endPoint?: string): ng.IPromise<any> {\r\n const deferred: ng.IDeferred<any> = this.$q.defer();\r\n this.getFormDigestValue(this.baseUrl)\r\n .then((requestDigest: string): ng.IPromise<ng.IHttpPromiseCallbackArg<any>> => {\r\n return this.$http({\r\n url: endPoint || this.baseUrl + url,\r\n method: \"POST\",\r\n headers: {\r\n \"accept\": \"application/json;odata=verbose\",\r\n \"X-RequestDigest\": requestDigest,\r\n \"content-Type\": \"application/json;odata=verbose\"\r\n },\r\n data: JSON.stringify(requestBody)\r\n });\r\n }).then((response: ng.IHttpPromiseCallbackArg<any>): void => {\r\n deferred.resolve(response.data);\r\n }, (error: any): void => {\r\n const iError: IError = {\r\n code: error.data.error.code,\r\n message: error.data.error.message.value,\r\n status: error.status,\r\n statusText: error.statusText\r\n };\r\n deferred.reject(iError);\r\n });\r\n return deferred.promise;\r\n }\r\n\r\n public updateRequest(url: string, requestBody: any, eTag: string, endPoint?: string): ng.IPromise<{}> {\r\n const deferred: ng.IDeferred<any> = this.$q.defer();\r\n this.getFormDigestValue(this.baseUrl)\r\n .then((requestDigest: string): ng.IPromise<ng.IHttpPromiseCallbackArg<any>> => {\r\n return this.$http({\r\n url: endPoint || this.baseUrl + url,\r\n method: \"POST\",\r\n headers: {\r\n \"accept\": \"application/json;odata=verbose\",\r\n \"X-RequestDigest\": requestDigest,\r\n \"content-Type\": \"application/json;odata=verbose\",\r\n 'IF-MATCH': eTag,\r\n 'X-HTTP-Method': 'MERGE'\r\n },\r\n data: JSON.stringify(requestBody)\r\n });\r\n }).then((response: {}): void => {\r\n deferred.resolve();\r\n }, (error: any): void => {\r\n const iError: IError = {\r\n code: error.data.error.code,\r\n message: error.data.error.message.value,\r\n status: error.status,\r\n statusText: error.statusText\r\n };\r\n deferred.reject(iError);\r\n });\r\n return deferred.promise;\r\n }\r\n\r\n public deleteRequest(url: string, eTag: string, endPoint?: string): ng.IPromise<{}> {\r\n const deferred: ng.IDeferred<any> = this.$q.defer();\r\n this.getFormDigestValue(this.baseUrl)\r\n .then((requestDigest: string): ng.IPromise<ng.IHttpPromiseCallbackArg<any>> => {\r\n return this.$http({\r\n url: endPoint || this.baseUrl + url,\r\n method: \"POST\",\r\n headers: {\r\n 'Accept': 'application/json;odata=nometadata',\r\n 'X-RequestDigest': requestDigest,\r\n 'IF-MATCH': eTag,\r\n 'X-HTTP-Method': 'DELETE'\r\n }\r\n });\r\n }).then((response: {}): void => {\r\n deferred.resolve();\r\n }, (error: any): void => {\r\n const iError: IError = {\r\n code: error.data.error.code,\r\n message: error.data.error.message.value,\r\n status: error.status,\r\n statusText: error.statusText\r\n };\r\n deferred.reject(iError);\r\n });\r\n return deferred.promise;\r\n }\r\n\r\n public fileUploadRequest(url: string, file: ArrayBuffer, endPoint?: string): ng.IPromise<any> {\r\n const deferred: ng.IDeferred<any> = this.$q.defer();\r\n this.getFormDigestValue(this.baseUrl)\r\n .then((requestDigest: string): ng.IPromise<ng.IHttpPromiseCallbackArg<any>> => {\r\n return this.$http({\r\n url: endPoint || this.baseUrl + url,\r\n method: \"POST\",\r\n transformRequest: angular.identity,\r\n headers: {\r\n \"accept\": \"application/json;odata=verbose\",\r\n \"X-RequestDigest\": requestDigest,\r\n \"content-Type\": undefined\r\n },\r\n data: ArrayBuffer\r\n });\r\n }).then((response: ng.IHttpPromiseCallbackArg<any>): void => {\r\n deferred.resolve(response.data);\r\n }, (error: any): void => {\r\n const iError: IError = {\r\n code: error.data.error.code,\r\n message: error.data.error.message.value,\r\n status: error.status,\r\n statusText: error.statusText\r\n };\r\n deferred.reject(iError);\r\n });\r\n return deferred.promise;\r\n }\r\n\r\n private getFormDigestValue(webUrl: string): ng.IPromise<string> {\r\n const deferred: ng.IDeferred<string> = this.$q.defer();\r\n\r\n this.$http({\r\n url: webUrl + '/_api/contextinfo',\r\n method: 'POST',\r\n headers: {\r\n 'Accept': 'application/json;odata=nometadata'\r\n }\r\n })\r\n .then((digestResult: ng.IHttpPromiseCallbackArg<{ FormDigestValue: string }>): void => {\r\n deferred.resolve(digestResult.data.FormDigestValue);\r\n }, (error: any): void => {\r\n const iError: IError = {\r\n code: error.data.error.code,\r\n message: error.data.error.message.value,\r\n status: error.status,\r\n statusText: error.statusText\r\n };\r\n deferred.reject(iError);\r\n });\r\n\r\n return deferred.promise;\r\n }\r\n}"],"sourceRoot":"..\\..\\..\\..\\..\\src"}