@progress/sitefinity-webservices-sdk 0.3.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +4 -0
- package/.eslintrc.js +19 -0
- package/ci/pipelines/ci.yml +219 -0
- package/config/helpers.js +0 -6
- package/config/webpack.common.js +1 -3
- package/config/webpack.dev.js +2 -9
- package/config/webpack.prod.js +5 -6
- package/dist/docs/.nojekyll +1 -0
- package/dist/docs/assets/highlight.css +57 -0
- package/dist/docs/assets/icons.css +1043 -0
- package/dist/docs/assets/icons.png +0 -0
- package/dist/docs/assets/icons@2x.png +0 -0
- package/dist/docs/assets/main.js +52 -0
- package/dist/docs/assets/search.js +1 -0
- package/dist/docs/assets/style.css +1413 -0
- package/dist/docs/assets/{images/widgets.png → widgets.png} +0 -0
- package/dist/docs/assets/{images/widgets@2x.png → widgets@2x.png} +0 -0
- package/dist/docs/classes/BlobBuilder.BlobBuilder-1.html +7 -0
- package/dist/docs/classes/Data.Data-1.html +65 -0
- package/dist/docs/classes/Expression.BinaryExpression.html +1 -0
- package/dist/docs/classes/Expression.ComplexExpression.html +1 -0
- package/dist/docs/classes/Expression.ExpressionBase.html +1 -0
- package/dist/docs/classes/OrderProperty.OrderProperty-1.html +1 -0
- package/dist/docs/classes/Query.Query-1.html +33 -0
- package/dist/docs/classes/QueryBase.QueryBase-1.html +7 -0
- package/dist/docs/classes/QueryBuilder.QueryBuilder-1.html +1 -0
- package/dist/docs/classes/Requests_BatchRequest.BatchRequest.html +17 -0
- package/dist/docs/classes/Requests_BatchRequest.Transaction.html +17 -0
- package/dist/docs/classes/Requests_ExecutableRequest.ExecutableRequest.html +1 -0
- package/dist/docs/classes/Requests_Request.CreateRelatedRequest.html +1 -0
- package/dist/docs/classes/Requests_Request.CreateRequest.html +1 -0
- package/dist/docs/classes/Requests_Request.DeleteRelatedByIdRequest.html +1 -0
- package/dist/docs/classes/Requests_Request.DeleteRelatedRequest.html +1 -0
- package/dist/docs/classes/Requests_Request.DeleteRequest.html +1 -0
- package/dist/docs/classes/Requests_Request.GetByIdRequest.html +1 -0
- package/dist/docs/classes/Requests_Request.GetRelatedByIdRequest.html +1 -0
- package/dist/docs/classes/Requests_Request.GetRelatedRequest.html +1 -0
- package/dist/docs/classes/Requests_Request.GetRequest.html +1 -0
- package/dist/docs/classes/Requests_Request.UpdateRequest.html +1 -0
- package/dist/docs/classes/Requests_Request.UploadRequest.html +1 -0
- package/dist/docs/classes/Requests_RequestBase.RequestBase.html +1 -0
- package/dist/docs/classes/Requests_RequestFactory.RequestFactory.html +1 -0
- package/dist/docs/classes/Sitefinity.Sitefinity-1.html +5 -0
- package/dist/docs/classes/WhereQuery.WhereQuery-1.html +31 -0
- package/dist/docs/classes/utils.utils-1.html +1 -0
- package/dist/docs/index.html +54 -242
- package/dist/docs/interfaces/Data.CreateRelatedRequestOptions.html +1 -0
- package/dist/docs/interfaces/Data.CreateRequestOptions.html +1 -0
- package/dist/docs/interfaces/Data.OperationsRequestOptions.html +1 -0
- package/dist/docs/interfaces/Data.PropertyRequestOptions.html +1 -0
- package/dist/docs/interfaces/Data.RequestOptionsBase.html +1 -0
- package/dist/docs/interfaces/Data.SingleRelatedItemRequestOptions.html +1 -0
- package/dist/docs/interfaces/Data.UpdateRequestOptions.html +1 -0
- package/dist/docs/interfaces/Data.UploadRequestOptions.html +1 -0
- package/dist/docs/interfaces/Requests_BatchRequest.BatchCreateRelatedRequestOptions.html +1 -0
- package/dist/docs/interfaces/Requests_BatchRequest.BatchCreateRequestOptions.html +1 -0
- package/dist/docs/interfaces/Requests_BatchRequest.BatchPropertyRequestOptions.html +1 -0
- package/dist/docs/interfaces/Requests_BatchRequest.BatchRequestOptionsBase.html +1 -0
- package/dist/docs/interfaces/Requests_BatchRequest.BatchRequestOptionsExtended.html +1 -0
- package/dist/docs/interfaces/Requests_BatchRequest.BatchSingleItemRequestOptions.html +1 -0
- package/dist/docs/interfaces/Requests_BatchRequest.BatchSingleRelatedItemRequestOptions.html +1 -0
- package/dist/docs/interfaces/Requests_BatchRequest.BatchUpdateRequestOptions.html +1 -0
- package/dist/docs/interfaces/Requests_ExecutableRequest.ResponseHandlers.html +5 -0
- package/dist/docs/interfaces/Requests_Request.PostRequestOptionsExtended.html +1 -0
- package/dist/docs/interfaces/Requests_Request.PutRequestOptionsExtended.html +1 -0
- package/dist/docs/interfaces/Requests_Request.RelatedByIdRequestOptionsExtended.html +1 -0
- package/dist/docs/interfaces/Requests_Request.RelatedRequestOptionsExtended.html +1 -0
- package/dist/docs/interfaces/Requests_Request.UploadRequestOptionsExtended.html +1 -0
- package/dist/docs/interfaces/Requests_RequestBase.RequestOptionsBaseExtended.html +1 -0
- package/dist/docs/interfaces/Sitefinity.SDKOptions.html +9 -0
- package/dist/docs/interfaces/Sitefinity.Token.html +1 -0
- package/dist/docs/interfaces/Sitefinity.TypeOptions.html +13 -0
- package/dist/docs/modules/BlobBuilder.html +1 -0
- package/dist/docs/modules/Data.html +1 -0
- package/dist/docs/modules/Expression.html +1 -0
- package/dist/docs/modules/OrderProperty.html +1 -0
- package/dist/docs/modules/Query.html +1 -0
- package/dist/docs/modules/QueryBase.html +1 -0
- package/dist/docs/modules/QueryBuilder.html +1 -0
- package/dist/docs/modules/Requests_BatchRequest.html +1 -0
- package/dist/docs/modules/Requests_ExecutableRequest.html +1 -0
- package/dist/docs/modules/Requests_Request.html +1 -0
- package/dist/docs/modules/Requests_RequestBase.html +1 -0
- package/dist/docs/modules/Requests_RequestFactory.html +1 -0
- package/dist/docs/modules/Sitefinity.html +1 -0
- package/dist/docs/modules/WhereQuery.html +1 -0
- package/dist/docs/modules/constants.html +1 -0
- package/dist/docs/modules/utils.html +1 -0
- package/dist/docs/modules.html +1 -0
- package/dist/samples.html +33 -81
- package/dist/sitefinity-webservices-sdk.d.ts +16 -0
- package/dist/sitefinity-webservices-sdk.js +1140 -1734
- package/dist/sitefinity-webservices-sdk.js.map +1 -1
- package/dist/sitefinity-webservices-sdk.min.js +2 -16
- package/dist/sitefinity-webservices-sdk.min.js.LICENSE.txt +14 -0
- package/dist/src/BlobBuilder.d.ts +14 -0
- package/dist/src/Data.d.ts +144 -0
- package/dist/src/Expression.d.ts +19 -0
- package/dist/src/OrderProperty.d.ts +8 -0
- package/dist/src/Query.d.ts +59 -0
- package/dist/src/QueryBase.d.ts +18 -0
- package/dist/src/QueryBuilder.d.ts +13 -0
- package/dist/src/Requests/BatchRequest.d.ts +146 -0
- package/dist/src/Requests/ExecutableRequest.d.ts +20 -0
- package/dist/src/Requests/Request.d.ts +88 -0
- package/dist/src/Requests/RequestBase.d.ts +28 -0
- package/dist/src/Requests/RequestFactory.d.ts +22 -0
- package/dist/src/Sitefinity.d.ts +66 -0
- package/dist/src/WhereQuery.d.ts +68 -0
- package/dist/src/constants.d.ts +55 -0
- package/dist/src/utils.d.ts +16 -0
- package/karma.conf.js +29 -0
- package/package-lock.json +16108 -6805
- package/package.json +28 -10
- package/sitefinity-webservices-sdk.ts +16 -0
- package/src/BlobBuilder.ts +7 -12
- package/src/Data.spec.ts +160 -0
- package/src/Data.ts +132 -207
- package/src/Expression.ts +0 -1
- package/src/OrderProperty.ts +4 -5
- package/src/Query.ts +52 -78
- package/src/QueryBase.ts +21 -47
- package/src/QueryBuilder.ts +68 -83
- package/src/Requests/BatchRequest.ts +312 -335
- package/src/Requests/ExecutableRequest.ts +46 -73
- package/src/Requests/Request.ts +134 -260
- package/src/Requests/RequestBase.ts +161 -0
- package/src/Requests/RequestFactory.ts +36 -54
- package/src/Requests/request.spec.ts +108 -0
- package/src/Sitefinity.spec.ts +418 -0
- package/src/Sitefinity.ts +77 -146
- package/src/WhereQuery.ts +52 -112
- package/src/constants.ts +58 -39
- package/src/utils.ts +17 -14
- package/template.html +33 -35
- package/tsconfig.json +8 -1
- package/type.txt +1 -1
- package/config/html.conf.json +0 -5
- package/dist/docs/assets/css/main.css +0 -865
- package/dist/docs/assets/css/main.css.map +0 -7
- package/dist/docs/assets/images/icons.png +0 -0
- package/dist/docs/assets/images/icons@2x.png +0 -0
- package/dist/docs/assets/js/main.js +0 -5
- package/dist/docs/assets/js/search.js +0 -3
- package/dist/docs/classes/_authentication_.authentication.html +0 -527
- package/dist/docs/classes/_blobbuilder_.blobbuilder.html +0 -351
- package/dist/docs/classes/_data_.data.html +0 -974
- package/dist/docs/classes/_expression_.binaryexpression.html +0 -450
- package/dist/docs/classes/_expression_.complexexpression.html +0 -374
- package/dist/docs/classes/_expression_.expressionbase.html +0 -336
- package/dist/docs/classes/_orderproperty_.orderproperty.html +0 -381
- package/dist/docs/classes/_query_.query.html +0 -896
- package/dist/docs/classes/_querybase_.querybase.html +0 -518
- package/dist/docs/classes/_querybuilder_.querybuilder.html +0 -493
- package/dist/docs/classes/_requests_batchrequest_.batchrequest.html +0 -1511
- package/dist/docs/classes/_requests_batchrequest_.transaction.html +0 -804
- package/dist/docs/classes/_requests_executablerequest_.executablerequest.html +0 -549
- package/dist/docs/classes/_requests_request_.createrelatedrequest.html +0 -689
- package/dist/docs/classes/_requests_request_.createrequest.html +0 -680
- package/dist/docs/classes/_requests_request_.deleterelatedbyidrequest.html +0 -687
- package/dist/docs/classes/_requests_request_.deleterelatedrequest.html +0 -673
- package/dist/docs/classes/_requests_request_.deleterequest.html +0 -666
- package/dist/docs/classes/_requests_request_.getbyidrequest.html +0 -666
- package/dist/docs/classes/_requests_request_.getrelatedbyidrequest.html +0 -687
- package/dist/docs/classes/_requests_request_.getrelatedrequest.html +0 -673
- package/dist/docs/classes/_requests_request_.getrequest.html +0 -658
- package/dist/docs/classes/_requests_request_.requestbase.html +0 -687
- package/dist/docs/classes/_requests_request_.updaterequest.html +0 -686
- package/dist/docs/classes/_requests_request_.uploadrequest.html +0 -715
- package/dist/docs/classes/_requests_requestfactory_.requestfactory.html +0 -724
- package/dist/docs/classes/_sitefinity_.sitefinity.html +0 -521
- package/dist/docs/classes/_utils_.utils.html +0 -597
- package/dist/docs/classes/_wherequery_.wherequery.html +0 -992
- package/dist/docs/globals.html +0 -238
- package/dist/docs/modules/_authentication_.html +0 -225
- package/dist/docs/modules/_blobbuilder_.html +0 -225
- package/dist/docs/modules/_constants_.html +0 -528
- package/dist/docs/modules/_contenttypes_.html +0 -248
- package/dist/docs/modules/_data_.html +0 -225
- package/dist/docs/modules/_expression_.html +0 -233
- package/dist/docs/modules/_headers_.html +0 -328
- package/dist/docs/modules/_httpmethods_.html +0 -288
- package/dist/docs/modules/_main_.html +0 -209
- package/dist/docs/modules/_orderproperty_.html +0 -225
- package/dist/docs/modules/_query_.html +0 -225
- package/dist/docs/modules/_querybase_.html +0 -225
- package/dist/docs/modules/_querybuilder_.html +0 -247
- package/dist/docs/modules/_requests_batchrequest_.html +0 -265
- package/dist/docs/modules/_requests_executablerequest_.html +0 -296
- package/dist/docs/modules/_requests_request_.html +0 -333
- package/dist/docs/modules/_requests_requestfactory_.html +0 -247
- package/dist/docs/modules/_sitefinity_.html +0 -225
- package/dist/docs/modules/_utils_.html +0 -225
- package/dist/docs/modules/_wherequery_.html +0 -247
- package/dist/index.html +0 -474
- package/src/Authentication.ts +0 -96
- package/src/ContentTypes.ts +0 -5
- package/src/Headers.ts +0 -12
- package/src/HttpMethods.ts +0 -9
- package/src/main.ts +0 -2
- package/version.txt +0 -1
|
@@ -7,447 +7,36 @@
|
|
|
7
7
|
exports["Sitefinity"] = factory();
|
|
8
8
|
else
|
|
9
9
|
root["Sitefinity"] = factory();
|
|
10
|
-
})(
|
|
11
|
-
return /******/ (
|
|
12
|
-
/******/
|
|
13
|
-
/******/ var
|
|
14
|
-
/******/
|
|
15
|
-
/******/ // The require function
|
|
16
|
-
/******/ function __webpack_require__(moduleId) {
|
|
17
|
-
/******/
|
|
18
|
-
/******/ // Check if module is in cache
|
|
19
|
-
/******/ if(installedModules[moduleId]) {
|
|
20
|
-
/******/ return installedModules[moduleId].exports;
|
|
21
|
-
/******/ }
|
|
22
|
-
/******/ // Create a new module (and put it into the cache)
|
|
23
|
-
/******/ var module = installedModules[moduleId] = {
|
|
24
|
-
/******/ i: moduleId,
|
|
25
|
-
/******/ l: false,
|
|
26
|
-
/******/ exports: {}
|
|
27
|
-
/******/ };
|
|
28
|
-
/******/
|
|
29
|
-
/******/ // Execute the module function
|
|
30
|
-
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
31
|
-
/******/
|
|
32
|
-
/******/ // Flag the module as loaded
|
|
33
|
-
/******/ module.l = true;
|
|
34
|
-
/******/
|
|
35
|
-
/******/ // Return the exports of the module
|
|
36
|
-
/******/ return module.exports;
|
|
37
|
-
/******/ }
|
|
38
|
-
/******/
|
|
39
|
-
/******/
|
|
40
|
-
/******/ // expose the modules object (__webpack_modules__)
|
|
41
|
-
/******/ __webpack_require__.m = modules;
|
|
42
|
-
/******/
|
|
43
|
-
/******/ // expose the module cache
|
|
44
|
-
/******/ __webpack_require__.c = installedModules;
|
|
45
|
-
/******/
|
|
46
|
-
/******/ // define getter function for harmony exports
|
|
47
|
-
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
48
|
-
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
49
|
-
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
50
|
-
/******/ }
|
|
51
|
-
/******/ };
|
|
52
|
-
/******/
|
|
53
|
-
/******/ // define __esModule on exports
|
|
54
|
-
/******/ __webpack_require__.r = function(exports) {
|
|
55
|
-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
56
|
-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
57
|
-
/******/ }
|
|
58
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
59
|
-
/******/ };
|
|
60
|
-
/******/
|
|
61
|
-
/******/ // create a fake namespace object
|
|
62
|
-
/******/ // mode & 1: value is a module id, require it
|
|
63
|
-
/******/ // mode & 2: merge all properties of value into the ns
|
|
64
|
-
/******/ // mode & 4: return value when already ns object
|
|
65
|
-
/******/ // mode & 8|1: behave like require
|
|
66
|
-
/******/ __webpack_require__.t = function(value, mode) {
|
|
67
|
-
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
68
|
-
/******/ if(mode & 8) return value;
|
|
69
|
-
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
70
|
-
/******/ var ns = Object.create(null);
|
|
71
|
-
/******/ __webpack_require__.r(ns);
|
|
72
|
-
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
73
|
-
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
74
|
-
/******/ return ns;
|
|
75
|
-
/******/ };
|
|
76
|
-
/******/
|
|
77
|
-
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
78
|
-
/******/ __webpack_require__.n = function(module) {
|
|
79
|
-
/******/ var getter = module && module.__esModule ?
|
|
80
|
-
/******/ function getDefault() { return module['default']; } :
|
|
81
|
-
/******/ function getModuleExports() { return module; };
|
|
82
|
-
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
83
|
-
/******/ return getter;
|
|
84
|
-
/******/ };
|
|
85
|
-
/******/
|
|
86
|
-
/******/ // Object.prototype.hasOwnProperty.call
|
|
87
|
-
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
88
|
-
/******/
|
|
89
|
-
/******/ // __webpack_public_path__
|
|
90
|
-
/******/ __webpack_require__.p = "";
|
|
91
|
-
/******/
|
|
92
|
-
/******/
|
|
93
|
-
/******/ // Load entry module and return exports
|
|
94
|
-
/******/ return __webpack_require__(__webpack_require__.s = "./src/main.ts");
|
|
95
|
-
/******/ })
|
|
96
|
-
/************************************************************************/
|
|
97
|
-
/******/ ({
|
|
98
|
-
|
|
99
|
-
/***/ "./node_modules/tslib/tslib.es6.js":
|
|
100
|
-
/*!*****************************************!*\
|
|
101
|
-
!*** ./node_modules/tslib/tslib.es6.js ***!
|
|
102
|
-
\*****************************************/
|
|
103
|
-
/*! exports provided: __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet */
|
|
104
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
105
|
-
|
|
106
|
-
"use strict";
|
|
107
|
-
__webpack_require__.r(__webpack_exports__);
|
|
108
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__extends", function() { return __extends; });
|
|
109
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; });
|
|
110
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__rest", function() { return __rest; });
|
|
111
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__decorate", function() { return __decorate; });
|
|
112
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__param", function() { return __param; });
|
|
113
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__metadata", function() { return __metadata; });
|
|
114
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__awaiter", function() { return __awaiter; });
|
|
115
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__generator", function() { return __generator; });
|
|
116
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__createBinding", function() { return __createBinding; });
|
|
117
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__exportStar", function() { return __exportStar; });
|
|
118
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__values", function() { return __values; });
|
|
119
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__read", function() { return __read; });
|
|
120
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spread", function() { return __spread; });
|
|
121
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spreadArrays", function() { return __spreadArrays; });
|
|
122
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__await", function() { return __await; });
|
|
123
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncGenerator", function() { return __asyncGenerator; });
|
|
124
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncDelegator", function() { return __asyncDelegator; });
|
|
125
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncValues", function() { return __asyncValues; });
|
|
126
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__makeTemplateObject", function() { return __makeTemplateObject; });
|
|
127
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importStar", function() { return __importStar; });
|
|
128
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importDefault", function() { return __importDefault; });
|
|
129
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldGet", function() { return __classPrivateFieldGet; });
|
|
130
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldSet", function() { return __classPrivateFieldSet; });
|
|
131
|
-
/*! *****************************************************************************
|
|
132
|
-
Copyright (c) Microsoft Corporation.
|
|
133
|
-
|
|
134
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
135
|
-
purpose with or without fee is hereby granted.
|
|
136
|
-
|
|
137
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
138
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
139
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
140
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
141
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
142
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
143
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
144
|
-
***************************************************************************** */
|
|
145
|
-
/* global Reflect, Promise */
|
|
146
|
-
|
|
147
|
-
var extendStatics = function(d, b) {
|
|
148
|
-
extendStatics = Object.setPrototypeOf ||
|
|
149
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
150
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
151
|
-
return extendStatics(d, b);
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
function __extends(d, b) {
|
|
155
|
-
extendStatics(d, b);
|
|
156
|
-
function __() { this.constructor = d; }
|
|
157
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
var __assign = function() {
|
|
161
|
-
__assign = Object.assign || function __assign(t) {
|
|
162
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
163
|
-
s = arguments[i];
|
|
164
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
165
|
-
}
|
|
166
|
-
return t;
|
|
167
|
-
}
|
|
168
|
-
return __assign.apply(this, arguments);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function __rest(s, e) {
|
|
172
|
-
var t = {};
|
|
173
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
174
|
-
t[p] = s[p];
|
|
175
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
176
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
177
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
178
|
-
t[p[i]] = s[p[i]];
|
|
179
|
-
}
|
|
180
|
-
return t;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
function __decorate(decorators, target, key, desc) {
|
|
184
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
185
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
186
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
187
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
function __param(paramIndex, decorator) {
|
|
191
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
function __metadata(metadataKey, metadataValue) {
|
|
195
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
199
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
200
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
201
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
202
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
203
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
204
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
function __generator(thisArg, body) {
|
|
209
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
210
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
211
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
212
|
-
function step(op) {
|
|
213
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
214
|
-
while (_) try {
|
|
215
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
216
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
217
|
-
switch (op[0]) {
|
|
218
|
-
case 0: case 1: t = op; break;
|
|
219
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
220
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
221
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
222
|
-
default:
|
|
223
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
224
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
225
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
226
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
227
|
-
if (t[2]) _.ops.pop();
|
|
228
|
-
_.trys.pop(); continue;
|
|
229
|
-
}
|
|
230
|
-
op = body.call(thisArg, _);
|
|
231
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
232
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
function __createBinding(o, m, k, k2) {
|
|
237
|
-
if (k2 === undefined) k2 = k;
|
|
238
|
-
o[k2] = m[k];
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
function __exportStar(m, exports) {
|
|
242
|
-
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
function __values(o) {
|
|
246
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
247
|
-
if (m) return m.call(o);
|
|
248
|
-
if (o && typeof o.length === "number") return {
|
|
249
|
-
next: function () {
|
|
250
|
-
if (o && i >= o.length) o = void 0;
|
|
251
|
-
return { value: o && o[i++], done: !o };
|
|
252
|
-
}
|
|
253
|
-
};
|
|
254
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
function __read(o, n) {
|
|
258
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
259
|
-
if (!m) return o;
|
|
260
|
-
var i = m.call(o), r, ar = [], e;
|
|
261
|
-
try {
|
|
262
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
263
|
-
}
|
|
264
|
-
catch (error) { e = { error: error }; }
|
|
265
|
-
finally {
|
|
266
|
-
try {
|
|
267
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
268
|
-
}
|
|
269
|
-
finally { if (e) throw e.error; }
|
|
270
|
-
}
|
|
271
|
-
return ar;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
function __spread() {
|
|
275
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
276
|
-
ar = ar.concat(__read(arguments[i]));
|
|
277
|
-
return ar;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
function __spreadArrays() {
|
|
281
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
282
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
283
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
284
|
-
r[k] = a[j];
|
|
285
|
-
return r;
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
function __await(v) {
|
|
289
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
293
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
294
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
295
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
296
|
-
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
297
|
-
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
298
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
299
|
-
function fulfill(value) { resume("next", value); }
|
|
300
|
-
function reject(value) { resume("throw", value); }
|
|
301
|
-
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
function __asyncDelegator(o) {
|
|
305
|
-
var i, p;
|
|
306
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
307
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
function __asyncValues(o) {
|
|
311
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
312
|
-
var m = o[Symbol.asyncIterator], i;
|
|
313
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
314
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
315
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
function __makeTemplateObject(cooked, raw) {
|
|
319
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
320
|
-
return cooked;
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
function __importStar(mod) {
|
|
324
|
-
if (mod && mod.__esModule) return mod;
|
|
325
|
-
var result = {};
|
|
326
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
327
|
-
result.default = mod;
|
|
328
|
-
return result;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
function __importDefault(mod) {
|
|
332
|
-
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
function __classPrivateFieldGet(receiver, privateMap) {
|
|
336
|
-
if (!privateMap.has(receiver)) {
|
|
337
|
-
throw new TypeError("attempted to get private field on non-instance");
|
|
338
|
-
}
|
|
339
|
-
return privateMap.get(receiver);
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
function __classPrivateFieldSet(receiver, privateMap, value) {
|
|
343
|
-
if (!privateMap.has(receiver)) {
|
|
344
|
-
throw new TypeError("attempted to set private field on non-instance");
|
|
345
|
-
}
|
|
346
|
-
privateMap.set(receiver, value);
|
|
347
|
-
return value;
|
|
348
|
-
}
|
|
10
|
+
})(self, function() {
|
|
11
|
+
return /******/ (() => { // webpackBootstrap
|
|
12
|
+
/******/ "use strict";
|
|
13
|
+
/******/ var __webpack_modules__ = ({
|
|
349
14
|
|
|
15
|
+
/***/ "./sitefinity-webservices-sdk.ts":
|
|
16
|
+
/*!***************************************!*\
|
|
17
|
+
!*** ./sitefinity-webservices-sdk.ts ***!
|
|
18
|
+
\***************************************/
|
|
19
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
350
20
|
|
|
351
|
-
/***/ }),
|
|
352
|
-
|
|
353
|
-
/***/ "./src/Authentication.ts":
|
|
354
|
-
/*!*******************************!*\
|
|
355
|
-
!*** ./src/Authentication.ts ***!
|
|
356
|
-
\*******************************/
|
|
357
|
-
/*! no static exports found */
|
|
358
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
359
21
|
|
|
360
|
-
"
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
*/
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
* @instance
|
|
379
|
-
* @param {string} username - The username.
|
|
380
|
-
* @param {string} password - The password.
|
|
381
|
-
* @param {Function} [success] - The success handler of the method.
|
|
382
|
-
* @param {Function} [failure] - The error handler of the method.
|
|
383
|
-
* @deprecated This method is deprecated and should not be used with versions of sitefinity >= 10.0
|
|
384
|
-
* @example
|
|
385
|
-
* sf.authentication.login("username", "password", successCb, failureCb);
|
|
386
|
-
*/
|
|
387
|
-
Authentication.prototype.login = function (username, password, success, failure) {
|
|
388
|
-
var that = this;
|
|
389
|
-
var request = this.factory.create({
|
|
390
|
-
data: {
|
|
391
|
-
username: username,
|
|
392
|
-
password: password
|
|
393
|
-
},
|
|
394
|
-
urlOptions: {
|
|
395
|
-
baseUrl: that._serviceUrl + 'login'
|
|
396
|
-
},
|
|
397
|
-
successCb: function (data) {
|
|
398
|
-
that.setToken(data.value);
|
|
399
|
-
if (typeof success === 'function')
|
|
400
|
-
success(data.value);
|
|
401
|
-
},
|
|
402
|
-
failureCb: failure
|
|
403
|
-
});
|
|
404
|
-
request._execute();
|
|
405
|
-
};
|
|
406
|
-
/**
|
|
407
|
-
* Logouts the user.
|
|
408
|
-
* @memberOf Authentication
|
|
409
|
-
* @instance
|
|
410
|
-
* @param {Function} [success] - The success handler of the method.
|
|
411
|
-
* @param {Function} [failure] - The error handler of the method.
|
|
412
|
-
* @deprecated This method is deprecated and should not be used with versions of sitefinity >= 10.0
|
|
413
|
-
*/
|
|
414
|
-
Authentication.prototype.logout = function (success, failure) {
|
|
415
|
-
var that = this;
|
|
416
|
-
var request = this.factory.create({
|
|
417
|
-
urlOptions: {
|
|
418
|
-
baseUrl: that._serviceUrl + 'logout',
|
|
419
|
-
token: that.getToken()
|
|
420
|
-
},
|
|
421
|
-
successCb: function (data) {
|
|
422
|
-
that.setToken(null);
|
|
423
|
-
if (typeof success === 'function')
|
|
424
|
-
success(data);
|
|
425
|
-
},
|
|
426
|
-
failureCb: failure
|
|
427
|
-
});
|
|
428
|
-
request._execute();
|
|
429
|
-
};
|
|
430
|
-
/**
|
|
431
|
-
* Sets the authentication token.
|
|
432
|
-
* @memberOf Authentication
|
|
433
|
-
* @instance
|
|
434
|
-
* @param {string} token - The token, which will be used for authentication.
|
|
435
|
-
*/
|
|
436
|
-
Authentication.prototype.setToken = function (token) {
|
|
437
|
-
this._token = token;
|
|
438
|
-
};
|
|
439
|
-
/**
|
|
440
|
-
* Gets the authentication token.
|
|
441
|
-
* @memberOf Authentication
|
|
442
|
-
* @instance
|
|
443
|
-
* @returns {string}
|
|
444
|
-
*/
|
|
445
|
-
Authentication.prototype.getToken = function () {
|
|
446
|
-
return this._token;
|
|
447
|
-
};
|
|
448
|
-
return Authentication;
|
|
449
|
-
}());
|
|
450
|
-
exports.Authentication = Authentication;
|
|
22
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
23
|
+
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
|
|
24
|
+
tslib_1.__exportStar(__webpack_require__(/*! ./src/BlobBuilder */ "./src/BlobBuilder.ts"), exports);
|
|
25
|
+
tslib_1.__exportStar(__webpack_require__(/*! ./src/constants */ "./src/constants.ts"), exports);
|
|
26
|
+
tslib_1.__exportStar(__webpack_require__(/*! ./src/utils */ "./src/utils.ts"), exports);
|
|
27
|
+
tslib_1.__exportStar(__webpack_require__(/*! ./src/WhereQuery */ "./src/WhereQuery.ts"), exports);
|
|
28
|
+
tslib_1.__exportStar(__webpack_require__(/*! ./src/Sitefinity */ "./src/Sitefinity.ts"), exports);
|
|
29
|
+
tslib_1.__exportStar(__webpack_require__(/*! ./src/QueryBuilder */ "./src/QueryBuilder.ts"), exports);
|
|
30
|
+
tslib_1.__exportStar(__webpack_require__(/*! ./src/QueryBase */ "./src/QueryBase.ts"), exports);
|
|
31
|
+
tslib_1.__exportStar(__webpack_require__(/*! ./src/Query */ "./src/Query.ts"), exports);
|
|
32
|
+
tslib_1.__exportStar(__webpack_require__(/*! ./src/OrderProperty */ "./src/OrderProperty.ts"), exports);
|
|
33
|
+
tslib_1.__exportStar(__webpack_require__(/*! ./src/Expression */ "./src/Expression.ts"), exports);
|
|
34
|
+
tslib_1.__exportStar(__webpack_require__(/*! ./src/Data */ "./src/Data.ts"), exports);
|
|
35
|
+
tslib_1.__exportStar(__webpack_require__(/*! ./src/Requests/BatchRequest */ "./src/Requests/BatchRequest.ts"), exports);
|
|
36
|
+
tslib_1.__exportStar(__webpack_require__(/*! ./src/Requests/ExecutableRequest */ "./src/Requests/ExecutableRequest.ts"), exports);
|
|
37
|
+
tslib_1.__exportStar(__webpack_require__(/*! ./src/Requests/Request */ "./src/Requests/Request.ts"), exports);
|
|
38
|
+
tslib_1.__exportStar(__webpack_require__(/*! ./src/Requests/RequestBase */ "./src/Requests/RequestBase.ts"), exports);
|
|
39
|
+
tslib_1.__exportStar(__webpack_require__(/*! ./src/Requests/RequestFactory */ "./src/Requests/RequestFactory.ts"), exports);
|
|
451
40
|
|
|
452
41
|
|
|
453
42
|
/***/ }),
|
|
@@ -456,125 +45,78 @@ exports.Authentication = Authentication;
|
|
|
456
45
|
/*!****************************!*\
|
|
457
46
|
!*** ./src/BlobBuilder.ts ***!
|
|
458
47
|
\****************************/
|
|
459
|
-
|
|
460
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
48
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
461
49
|
|
|
462
|
-
"use strict";
|
|
463
50
|
|
|
464
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
52
|
+
exports.BlobBuilder = void 0;
|
|
465
53
|
/**
|
|
466
|
-
*
|
|
467
|
-
* @class BlobBuilder
|
|
54
|
+
* The BlobBuilder class is used to generate blob objects.
|
|
468
55
|
*/
|
|
469
56
|
var BlobBuilder = /** @class */ (function () {
|
|
470
57
|
function BlobBuilder() {
|
|
471
|
-
this.
|
|
58
|
+
this.blob = new Blob();
|
|
472
59
|
}
|
|
473
60
|
/**
|
|
474
|
-
*
|
|
475
|
-
* @memberOf BlobBuilder
|
|
476
|
-
* @instance
|
|
477
|
-
* @param {object} value - The value to be appended.
|
|
61
|
+
* Appends new value to blob.
|
|
478
62
|
*/
|
|
479
63
|
BlobBuilder.prototype.append = function (value) {
|
|
480
|
-
this.
|
|
64
|
+
this.blob = new Blob([this.blob, value]);
|
|
481
65
|
};
|
|
482
66
|
/**
|
|
483
|
-
*
|
|
484
|
-
* @memberOf BlobBuilder
|
|
67
|
+
* Gets generated blob.
|
|
485
68
|
*/
|
|
486
69
|
BlobBuilder.prototype.build = function () {
|
|
487
|
-
return this.
|
|
70
|
+
return this.blob;
|
|
488
71
|
};
|
|
489
72
|
return BlobBuilder;
|
|
490
73
|
}());
|
|
491
74
|
exports.BlobBuilder = BlobBuilder;
|
|
492
75
|
|
|
493
76
|
|
|
494
|
-
/***/ }),
|
|
495
|
-
|
|
496
|
-
/***/ "./src/ContentTypes.ts":
|
|
497
|
-
/*!*****************************!*\
|
|
498
|
-
!*** ./src/ContentTypes.ts ***!
|
|
499
|
-
\*****************************/
|
|
500
|
-
/*! no static exports found */
|
|
501
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
502
|
-
|
|
503
|
-
"use strict";
|
|
504
|
-
|
|
505
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
506
|
-
var contentTypes = {
|
|
507
|
-
json: "application/json"
|
|
508
|
-
};
|
|
509
|
-
exports.default = contentTypes;
|
|
510
|
-
|
|
511
|
-
|
|
512
77
|
/***/ }),
|
|
513
78
|
|
|
514
79
|
/***/ "./src/Data.ts":
|
|
515
80
|
/*!*********************!*\
|
|
516
81
|
!*** ./src/Data.ts ***!
|
|
517
82
|
\*********************/
|
|
518
|
-
|
|
519
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
83
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
520
84
|
|
|
521
|
-
"use strict";
|
|
522
85
|
|
|
523
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
86
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
87
|
+
exports.Data = void 0;
|
|
88
|
+
var constants_1 = __webpack_require__(/*! ./constants */ "./src/constants.ts");
|
|
524
89
|
/**
|
|
525
|
-
*
|
|
526
|
-
* @classdesc The constructor of the Data object. This object is used for requesting data from Sitefinity.
|
|
527
|
-
* @param {object} urlOptions - An object containing configuration options for the {@link Data} object.
|
|
528
|
-
* @param {string} urlOptions.baseUrl - Your service url that points to the configured instance of Sitefinity service.
|
|
529
|
-
* @param {string} urlOptions.entitySet - The url name of the type.
|
|
530
|
-
* @param {object} urlOptions.SFParams - An object containing configuration options for requests.
|
|
531
|
-
* @param {string} urlOptions.SFParams.provider - The provider name to use in each request.
|
|
532
|
-
* @param {string} urlOptions.SFParams.culture - The culture name to use in each request.
|
|
90
|
+
* The constructor of the Data object. This object is used for requesting data from Sitefinity.
|
|
533
91
|
*/
|
|
534
92
|
var Data = /** @class */ (function () {
|
|
535
93
|
function Data(urlOptions, factory) {
|
|
536
94
|
this.urlOptions = urlOptions;
|
|
537
95
|
this.factory = factory;
|
|
538
96
|
}
|
|
539
|
-
// TODO: rethink this
|
|
540
97
|
/**
|
|
541
98
|
* Executes a GET request to retrieve a collection of items.
|
|
542
|
-
* @memberOf Data
|
|
543
|
-
* @instance
|
|
544
|
-
* @param {object} parameters - The parameters for the request.
|
|
545
|
-
* @param {string} parameters.action - The OData action along with its parameters.
|
|
546
|
-
* @param {object} parameters.query - The {@link WhereQuery} with which to filter the items.
|
|
547
|
-
* @param {Function} parameters.successCb - The success callback function.
|
|
548
|
-
* @param {Function} parameters.failureCb - The error callback function.
|
|
549
99
|
*/
|
|
550
100
|
Data.prototype.get = function (parameters) {
|
|
551
|
-
parameters = parameters || {};
|
|
552
|
-
// TODO: move to Request
|
|
553
|
-
if (parameters.query)
|
|
554
|
-
this.urlOptions.ODataParams = parameters.query;
|
|
555
101
|
var request = this.factory.get({
|
|
556
102
|
urlOptions: this.urlOptions,
|
|
103
|
+
query: parameters.query,
|
|
557
104
|
action: parameters.action,
|
|
558
105
|
successCb: parameters.successCb,
|
|
559
106
|
failureCb: parameters.failureCb,
|
|
560
107
|
fallbackProperties: parameters.fallbackProperties
|
|
561
108
|
});
|
|
562
|
-
request.
|
|
109
|
+
request.execute();
|
|
563
110
|
};
|
|
564
111
|
/**
|
|
565
112
|
* Executes a GET request to retrieve an/all item(s) operations.
|
|
566
|
-
* @memberOf Data
|
|
567
|
-
* @instance
|
|
568
|
-
* @param {object} parameters - The parameters for the request.
|
|
569
|
-
* @param {Function} parameters.successCb - The success callback function.
|
|
570
|
-
* @param {Function} parameters.failureCb - The error callback function.
|
|
571
113
|
*/
|
|
572
114
|
Data.prototype.getOperations = function (parameters) {
|
|
573
115
|
var request;
|
|
574
116
|
var action = "operations";
|
|
575
117
|
// Set parentId if no item key is passed
|
|
576
118
|
if (!parameters.key)
|
|
577
|
-
action += "?parentId=" + parameters.parentId;
|
|
119
|
+
action += "?".concat(constants_1.SF_PARAMS.parentId, "=") + parameters.parentId;
|
|
578
120
|
var params = {
|
|
579
121
|
urlOptions: this.urlOptions,
|
|
580
122
|
action: action,
|
|
@@ -588,79 +130,52 @@ var Data = /** @class */ (function () {
|
|
|
588
130
|
else {
|
|
589
131
|
request = this.factory.get(params);
|
|
590
132
|
}
|
|
591
|
-
request.
|
|
133
|
+
request.execute();
|
|
592
134
|
};
|
|
593
135
|
/**
|
|
594
136
|
* Executes a GET request for a single item.
|
|
595
|
-
* @memberOf Data
|
|
596
|
-
* @instance
|
|
597
|
-
* @param {object} parameters - The parameters for the request.
|
|
598
|
-
* @param {object} parameters.query - The {@link QueryBase} object containing the OData query options that should be sent to the server.
|
|
599
|
-
* @param {string} parameters.key - The identifier of the item to be retrieved.
|
|
600
|
-
* @param {string} parameters.action - The OData action along with its parameters.
|
|
601
|
-
* @param {Function} parameters.successCb - The success callback function.
|
|
602
|
-
* @param {Function} parameters.failureCb - The error callback function.
|
|
603
137
|
*/
|
|
604
138
|
Data.prototype.getSingle = function (parameters) {
|
|
605
139
|
if (!(parameters.key))
|
|
606
140
|
throw "Parameter 'key' is required!";
|
|
607
|
-
if (parameters.query)
|
|
608
|
-
this.urlOptions.ODataParams = parameters.query;
|
|
609
141
|
var request = this.factory.getSingle({
|
|
610
142
|
urlOptions: this.urlOptions,
|
|
611
143
|
key: parameters.key,
|
|
144
|
+
query: parameters.query,
|
|
612
145
|
action: parameters.action,
|
|
613
146
|
successCb: parameters.successCb,
|
|
614
147
|
failureCb: parameters.failureCb,
|
|
615
148
|
fallbackProperties: parameters.fallbackProperties
|
|
616
149
|
});
|
|
617
|
-
request.
|
|
150
|
+
request.execute();
|
|
618
151
|
};
|
|
619
152
|
/**
|
|
620
153
|
* Executes a POST request for a single item.
|
|
621
|
-
* @memberOf Data
|
|
622
|
-
* @instance
|
|
623
|
-
* @param {object} parameters - The parameters for the request.
|
|
624
|
-
* @param {string} parameters.key - The identifier of the item.
|
|
625
|
-
* @param {object} parameters.data - The payload of the request.
|
|
626
|
-
* @param {string} parameters.action - The OData action along with its parameters.
|
|
627
|
-
* @param {Function} parameters.successCb - The success callback function.
|
|
628
|
-
* @param {Function} parameters.failureCb - The error callback function.
|
|
629
154
|
*/
|
|
630
155
|
Data.prototype.create = function (parameters) {
|
|
631
156
|
if (!(parameters.data))
|
|
632
157
|
throw "Parameter 'data' is required!";
|
|
633
|
-
if (parameters.query)
|
|
634
|
-
this.urlOptions.ODataParams = parameters.query;
|
|
635
158
|
var request = this.factory.create({
|
|
636
159
|
urlOptions: this.urlOptions,
|
|
637
160
|
key: parameters.key,
|
|
161
|
+
query: parameters.query,
|
|
638
162
|
data: parameters.data,
|
|
639
163
|
action: parameters.action,
|
|
640
164
|
successCb: parameters.successCb,
|
|
641
165
|
failureCb: parameters.failureCb
|
|
642
166
|
});
|
|
643
|
-
request.
|
|
167
|
+
request.execute();
|
|
644
168
|
};
|
|
645
169
|
/**
|
|
646
170
|
* Executes a PATCH request to update a single item.
|
|
647
|
-
* @memberOf Data
|
|
648
|
-
* @instance
|
|
649
|
-
* @param {object} parameters - The parameters for the request.
|
|
650
|
-
* @param {bool} parameters.saveTemp - A flag indicating whether to save in temp.
|
|
651
|
-
* @param {string} parameters.key - The identifier of the item to be updated.
|
|
652
|
-
* @param {object} parameters.data - The payload of the request.
|
|
653
|
-
* @param {string} parameters.action - The OData action along with its parameters.
|
|
654
|
-
* @param {Function} parameters.successCb - The success callback function.
|
|
655
|
-
* @param {Function} parameters.failureCb - The error callback function.
|
|
656
171
|
* @example
|
|
657
|
-
*
|
|
658
|
-
*
|
|
659
|
-
*
|
|
660
|
-
*
|
|
172
|
+
* const data = sf.data({
|
|
173
|
+
* entitySet: "newsitems",
|
|
174
|
+
* provider: "OpenAccessDataProvider",
|
|
175
|
+
* culture: "en"
|
|
661
176
|
* });
|
|
662
177
|
*
|
|
663
|
-
*
|
|
178
|
+
* const newsItemUpdate = {
|
|
664
179
|
* "Title": 'updated news title'
|
|
665
180
|
* };
|
|
666
181
|
*
|
|
@@ -684,16 +199,10 @@ var Data = /** @class */ (function () {
|
|
|
684
199
|
successCb: parameters.successCb,
|
|
685
200
|
failureCb: parameters.failureCb
|
|
686
201
|
});
|
|
687
|
-
request.
|
|
202
|
+
request.execute();
|
|
688
203
|
};
|
|
689
204
|
/**
|
|
690
205
|
* Executes a DELETE request to delete a single item.
|
|
691
|
-
* @memberOf Data
|
|
692
|
-
* @instance
|
|
693
|
-
* @param {object} parameters - The parameters for the request.
|
|
694
|
-
* @param {string} parameters.key - The identifier of the item to be deleted.
|
|
695
|
-
* @param {Function} parameters.successCb - The success callback function.
|
|
696
|
-
* @param {Function} parameters.failureCb - The error callback function.
|
|
697
206
|
*/
|
|
698
207
|
Data.prototype.destroy = function (parameters) {
|
|
699
208
|
if (!(parameters.key))
|
|
@@ -704,17 +213,10 @@ var Data = /** @class */ (function () {
|
|
|
704
213
|
successCb: parameters.successCb,
|
|
705
214
|
failureCb: parameters.failureCb
|
|
706
215
|
});
|
|
707
|
-
request.
|
|
216
|
+
request.execute();
|
|
708
217
|
};
|
|
709
218
|
/**
|
|
710
219
|
* Executes a POST request to execute a workflow operation for single item.
|
|
711
|
-
* @memberOf Data
|
|
712
|
-
* @instance
|
|
713
|
-
* @param {object} parameters - The parameters for the request.
|
|
714
|
-
* @param {string} parameters.key - The identifier of the item.
|
|
715
|
-
* @param {object} parameters.data - The payload of the request.
|
|
716
|
-
* @param {Function} parameters.successCb - The success callback function.
|
|
717
|
-
* @param {Function} parameters.failureCb - The error callback function.
|
|
718
220
|
*/
|
|
719
221
|
Data.prototype.operation = function (parameters) {
|
|
720
222
|
if (!(parameters.key || parameters.data))
|
|
@@ -727,17 +229,10 @@ var Data = /** @class */ (function () {
|
|
|
727
229
|
successCb: parameters.successCb,
|
|
728
230
|
failureCb: parameters.failureCb
|
|
729
231
|
});
|
|
730
|
-
request.
|
|
232
|
+
request.execute();
|
|
731
233
|
};
|
|
732
234
|
/**
|
|
733
235
|
* Executes a GET request to get the property of a single item.
|
|
734
|
-
* @memberOf Data
|
|
735
|
-
* @instance
|
|
736
|
-
* @param {object} parameters - The parameters for the request.
|
|
737
|
-
* @param {string} parameters.key - The identifier of the item.
|
|
738
|
-
* @param {string} parameters.property - The name of the property to be retrieved.
|
|
739
|
-
* @param {Function} parameters.successCb - The success callback function.
|
|
740
|
-
* @param {Function} parameters.failureCb - The error callback function.
|
|
741
236
|
*/
|
|
742
237
|
Data.prototype.getProperty = function (parameters) {
|
|
743
238
|
if (!(parameters.key || parameters.property))
|
|
@@ -745,148 +240,99 @@ var Data = /** @class */ (function () {
|
|
|
745
240
|
var request = this.factory.getProperty({
|
|
746
241
|
urlOptions: this.urlOptions,
|
|
747
242
|
key: parameters.key,
|
|
748
|
-
|
|
243
|
+
property: parameters.property,
|
|
749
244
|
successCb: parameters.successCb,
|
|
750
245
|
failureCb: parameters.failureCb
|
|
751
246
|
});
|
|
752
|
-
request.
|
|
247
|
+
request.execute();
|
|
753
248
|
};
|
|
754
249
|
/**
|
|
755
250
|
* Executes a GET request to get the related property value of a single item.
|
|
756
|
-
* @memberOf Data
|
|
757
|
-
* @instance
|
|
758
|
-
* @param {object} parameters - The parameters for the request.
|
|
759
|
-
* @param {string} parameters.key - The identifier of the item.
|
|
760
|
-
* @param {string} parameters.navigationProperty - The name of the navigation property to be retrieved.
|
|
761
|
-
* @param {Function} parameters.successCb - The success callback function.
|
|
762
|
-
* @param {Function} parameters.failureCb - The error callback function.
|
|
763
251
|
*/
|
|
764
252
|
Data.prototype.getRelated = function (parameters) {
|
|
765
|
-
if (!(parameters.key || parameters.
|
|
766
|
-
throw "Parameters: 'data' and '
|
|
253
|
+
if (!(parameters.key || parameters.property))
|
|
254
|
+
throw "Parameters: 'data' and 'property' are required!";
|
|
767
255
|
var request = this.factory.getRelated({
|
|
768
256
|
urlOptions: this.urlOptions,
|
|
769
257
|
key: parameters.key,
|
|
770
|
-
|
|
258
|
+
property: parameters.property,
|
|
771
259
|
successCb: parameters.successCb,
|
|
772
260
|
failureCb: parameters.failureCb
|
|
773
261
|
});
|
|
774
|
-
request.
|
|
262
|
+
request.execute();
|
|
775
263
|
};
|
|
776
264
|
/**
|
|
777
265
|
* Executes a GET request to retrieve the related property value of a single item by the id of the related item.
|
|
778
|
-
* @memberOf Data
|
|
779
|
-
* @instance
|
|
780
|
-
* @param {object} parameters - The parameters for the request.
|
|
781
|
-
* @param {string} parameters.key - The identifier of the item.
|
|
782
|
-
* @param {string} parameters.navigationProperty - The name of the navigation property to be retrieved.
|
|
783
|
-
* @param {string} parameters.relatedKey - The identifier of the related item.
|
|
784
|
-
* @param {Function} parameters.successCb - The success callback function.
|
|
785
|
-
* @param {Function} parameters.failureCb - The error callback function.
|
|
786
266
|
*/
|
|
787
267
|
Data.prototype.getRelatedById = function (parameters) {
|
|
788
|
-
if (!(parameters.key || parameters.
|
|
789
|
-
throw "Parameters: 'data', '
|
|
268
|
+
if (!(parameters.key || parameters.property || parameters.relatedId))
|
|
269
|
+
throw "Parameters: 'data', 'relatedId' and 'property' are required!";
|
|
790
270
|
var request = this.factory.getRelatedById({
|
|
791
271
|
urlOptions: this.urlOptions,
|
|
792
272
|
key: parameters.key,
|
|
793
|
-
|
|
794
|
-
|
|
273
|
+
relatedId: parameters.relatedId,
|
|
274
|
+
property: parameters.property,
|
|
795
275
|
successCb: parameters.successCb,
|
|
796
276
|
failureCb: parameters.failureCb
|
|
797
277
|
});
|
|
798
|
-
request.
|
|
278
|
+
request.execute();
|
|
799
279
|
};
|
|
800
280
|
/**
|
|
801
281
|
* Executes a DELETE request to retrieve the delete all of the associated members in the relation property.
|
|
802
|
-
* @memberOf Data
|
|
803
|
-
* @instance
|
|
804
|
-
* @param {object} parameters - The parameters for the request.
|
|
805
|
-
* @param {string} parameters.key - The identifier of the item.
|
|
806
|
-
* @param {string} parameters.navigationProperty - The name of the navigation property.
|
|
807
|
-
* @param {Function} parameters.successCb - The success callback function.
|
|
808
|
-
* @param {Function} parameters.failureCb - The error callback function.
|
|
809
282
|
*/
|
|
810
283
|
Data.prototype.destroyRelated = function (parameters) {
|
|
811
|
-
if (!(parameters.key || parameters.
|
|
812
|
-
throw "Parameters: 'data' and '
|
|
284
|
+
if (!(parameters.key || parameters.property))
|
|
285
|
+
throw "Parameters: 'data' and 'property' are required!";
|
|
813
286
|
var request = this.factory.destroyRelated({
|
|
814
287
|
urlOptions: this.urlOptions,
|
|
815
288
|
key: parameters.key,
|
|
816
|
-
|
|
289
|
+
property: parameters.property,
|
|
817
290
|
successCb: parameters.successCb,
|
|
818
291
|
failureCb: parameters.failureCb
|
|
819
292
|
});
|
|
820
|
-
request.
|
|
293
|
+
request.execute();
|
|
821
294
|
};
|
|
822
295
|
/**
|
|
823
296
|
* Executes a DELETE request to retrieve the a single entry of the associated members in the relation property.
|
|
824
|
-
* @memberOf Data
|
|
825
|
-
* @instance
|
|
826
|
-
* @param {object} parameters - The parameters for the request.
|
|
827
|
-
* @param {string} parameters.key - The identifier of the item.
|
|
828
|
-
* @param {string} parameters.navigationProperty - The name of the navigation property.
|
|
829
|
-
* @param {string} parameters.relatedKey - The identifier of the related item.
|
|
830
|
-
* @param {Function} parameters.successCb - The success callback function.
|
|
831
|
-
* @param {Function} parameters.failureCb - The error callback function.
|
|
832
297
|
*/
|
|
833
298
|
Data.prototype.destroyRelatedById = function (parameters) {
|
|
834
|
-
if (!(parameters.key || parameters.
|
|
835
|
-
throw "Parameters: 'data', '
|
|
299
|
+
if (!(parameters.key || parameters.property || parameters.relatedId))
|
|
300
|
+
throw "Parameters: 'data', 'relatedId' and 'property' are required!";
|
|
836
301
|
var request = this.factory.destroyRelatedById({
|
|
837
302
|
urlOptions: this.urlOptions,
|
|
838
303
|
key: parameters.key,
|
|
839
|
-
|
|
840
|
-
|
|
304
|
+
relatedId: parameters.relatedId,
|
|
305
|
+
property: parameters.property,
|
|
841
306
|
successCb: parameters.successCb,
|
|
842
307
|
failureCb: parameters.failureCb
|
|
843
308
|
});
|
|
844
|
-
request.
|
|
309
|
+
request.execute();
|
|
845
310
|
};
|
|
846
311
|
/**
|
|
847
312
|
* Executes a POST request to add a related item to the property collection.
|
|
848
|
-
* @memberOf Data
|
|
849
|
-
* @instance
|
|
850
|
-
* @param {object} parameters - The parameters for the request.
|
|
851
|
-
* @param {string} parameters.key - The identifier of the item.
|
|
852
|
-
* @param {string} parameters.navigationProperty - The name of the navigation property.
|
|
853
|
-
* @param {string} parameters.link - The URL of the related item.
|
|
854
|
-
* @param {Function} parameters.successCb - The success callback function.
|
|
855
|
-
* @param {Function} parameters.failureCb - The error callback function.
|
|
856
313
|
*/
|
|
857
314
|
Data.prototype.createRelated = function (parameters) {
|
|
858
|
-
if (!(parameters.key || parameters.
|
|
859
|
-
throw "Parameters: 'data', 'link' and '
|
|
315
|
+
if (!(parameters.key || parameters.property || parameters.link))
|
|
316
|
+
throw "Parameters: 'data', 'link' and 'property' are required!";
|
|
860
317
|
var data = {
|
|
861
318
|
"@odata.id": parameters.link
|
|
862
319
|
};
|
|
863
320
|
var request = this.factory.createRelated({
|
|
864
321
|
urlOptions: this.urlOptions,
|
|
865
322
|
key: parameters.key,
|
|
866
|
-
|
|
323
|
+
property: parameters.property,
|
|
867
324
|
data: data,
|
|
868
325
|
successCb: parameters.successCb,
|
|
869
326
|
failureCb: parameters.failureCb
|
|
870
327
|
});
|
|
871
|
-
request.
|
|
328
|
+
request.execute();
|
|
872
329
|
};
|
|
873
330
|
/**
|
|
874
331
|
* Executes a POST request to upload a media item.
|
|
875
|
-
* @memberOf Data
|
|
876
|
-
* @instance
|
|
877
|
-
* @param {object} parameters - The parameters for the request.
|
|
878
|
-
* @param {string} parameters.data - The data to be uploaded.
|
|
879
|
-
* @param {string} parameters.data.content - The base64 representation of the media item.
|
|
880
|
-
* @param {string} parameters.data.contentType - The content type of the item. E.g. image/jpeg.
|
|
881
|
-
* @param {string} parameters.data.name - The name of the media item.
|
|
882
|
-
* @param {string} parameters.data.payload - Holds the JSON metadata about the image. E.g. Title, Urlname etc.
|
|
883
|
-
* @param {string} parameters.data.uploadProperties - The properties passed on upload. Must contain ParentId and can contain FolderId, Title, UrlName, etc.
|
|
884
|
-
* @param {Function} parameters.successCb - The success callback function.
|
|
885
|
-
* @param {Function} parameters.failureCb - The error callback function.
|
|
886
332
|
* @example
|
|
887
333
|
*
|
|
888
|
-
*
|
|
889
|
-
*
|
|
334
|
+
* const data = sf.data({
|
|
335
|
+
* entitySet: "images"
|
|
890
336
|
* });
|
|
891
337
|
* data.upload({
|
|
892
338
|
* data: {
|
|
@@ -895,7 +341,7 @@ var Data = /** @class */ (function () {
|
|
|
895
341
|
* name: "test.jpg",
|
|
896
342
|
* payload: {
|
|
897
343
|
* Title: "Test",
|
|
898
|
-
*
|
|
344
|
+
* entitySet: "test"
|
|
899
345
|
* },
|
|
900
346
|
* uploadProperties: {
|
|
901
347
|
* ParentId: "4BA7AD46-F29B-4E65-BE17-9BF7CE5BA1FB"
|
|
@@ -939,8 +385,7 @@ var Data = /** @class */ (function () {
|
|
|
939
385
|
});
|
|
940
386
|
}
|
|
941
387
|
batch.endTransaction(transaction);
|
|
942
|
-
|
|
943
|
-
executor._execute();
|
|
388
|
+
batch.execute();
|
|
944
389
|
};
|
|
945
390
|
return Data;
|
|
946
391
|
}());
|
|
@@ -953,12 +398,11 @@ exports.Data = Data;
|
|
|
953
398
|
/*!***************************!*\
|
|
954
399
|
!*** ./src/Expression.ts ***!
|
|
955
400
|
\***************************/
|
|
956
|
-
|
|
957
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
401
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
958
402
|
|
|
959
|
-
"use strict";
|
|
960
403
|
|
|
961
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
404
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
405
|
+
exports.ComplexExpression = exports.BinaryExpression = exports.ExpressionBase = void 0;
|
|
962
406
|
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
|
|
963
407
|
var ExpressionBase = /** @class */ (function () {
|
|
964
408
|
function ExpressionBase(type) {
|
|
@@ -1007,65 +451,17 @@ var ComplexExpression = /** @class */ (function (_super) {
|
|
|
1007
451
|
exports.ComplexExpression = ComplexExpression;
|
|
1008
452
|
|
|
1009
453
|
|
|
1010
|
-
/***/ }),
|
|
1011
|
-
|
|
1012
|
-
/***/ "./src/Headers.ts":
|
|
1013
|
-
/*!************************!*\
|
|
1014
|
-
!*** ./src/Headers.ts ***!
|
|
1015
|
-
\************************/
|
|
1016
|
-
/*! no static exports found */
|
|
1017
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1018
|
-
|
|
1019
|
-
"use strict";
|
|
1020
|
-
|
|
1021
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1022
|
-
exports.headerNames = {
|
|
1023
|
-
contentType: "Content-Type",
|
|
1024
|
-
authorization: "Authorization",
|
|
1025
|
-
contentEncoding: "Content-Encoding",
|
|
1026
|
-
operation: "X-Operation",
|
|
1027
|
-
properties: "X-Sf-Properties",
|
|
1028
|
-
fileName: "X-File-Name",
|
|
1029
|
-
serviceRequest: "X-SF-Service-Request",
|
|
1030
|
-
choicesBinaryRepresentation: "X-SF-Binary-Choice-Representation",
|
|
1031
|
-
integrationMode: "X-SF-Integration-Mode"
|
|
1032
|
-
};
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
/***/ }),
|
|
1036
|
-
|
|
1037
|
-
/***/ "./src/HttpMethods.ts":
|
|
1038
|
-
/*!****************************!*\
|
|
1039
|
-
!*** ./src/HttpMethods.ts ***!
|
|
1040
|
-
\****************************/
|
|
1041
|
-
/*! no static exports found */
|
|
1042
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1043
|
-
|
|
1044
|
-
"use strict";
|
|
1045
|
-
|
|
1046
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1047
|
-
var methods = {
|
|
1048
|
-
Get: "GET",
|
|
1049
|
-
Put: "PUT",
|
|
1050
|
-
Post: "POST",
|
|
1051
|
-
Patch: "PATCH",
|
|
1052
|
-
Delete: "DELETE"
|
|
1053
|
-
};
|
|
1054
|
-
exports.default = methods;
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
454
|
/***/ }),
|
|
1058
455
|
|
|
1059
456
|
/***/ "./src/OrderProperty.ts":
|
|
1060
457
|
/*!******************************!*\
|
|
1061
458
|
!*** ./src/OrderProperty.ts ***!
|
|
1062
459
|
\******************************/
|
|
1063
|
-
|
|
1064
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
460
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1065
461
|
|
|
1066
|
-
"use strict";
|
|
1067
462
|
|
|
1068
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
463
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
464
|
+
exports.OrderProperty = void 0;
|
|
1069
465
|
var utils_1 = __webpack_require__(/*! ./utils */ "./src/utils.ts");
|
|
1070
466
|
var OrderProperty = /** @class */ (function () {
|
|
1071
467
|
function OrderProperty(propertyPath, isDesc) {
|
|
@@ -1111,130 +507,109 @@ exports.OrderProperty = OrderProperty;
|
|
|
1111
507
|
/*!**********************!*\
|
|
1112
508
|
!*** ./src/Query.ts ***!
|
|
1113
509
|
\**********************/
|
|
1114
|
-
|
|
1115
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
510
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1116
511
|
|
|
1117
|
-
"use strict";
|
|
1118
512
|
|
|
1119
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
513
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
514
|
+
exports.Query = void 0;
|
|
1120
515
|
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
|
|
1121
516
|
var QueryBase_1 = __webpack_require__(/*! ./QueryBase */ "./src/QueryBase.ts");
|
|
1122
517
|
var WhereQuery_1 = __webpack_require__(/*! ./WhereQuery */ "./src/WhereQuery.ts");
|
|
1123
518
|
var OrderProperty_1 = __webpack_require__(/*! ./OrderProperty */ "./src/OrderProperty.ts");
|
|
1124
519
|
var QueryBuilder_1 = __webpack_require__(/*! ./QueryBuilder */ "./src/QueryBuilder.ts");
|
|
1125
520
|
/**
|
|
1126
|
-
*
|
|
1127
|
-
* @class Query
|
|
1128
|
-
* @augments QueryBase
|
|
521
|
+
* The query class is used for constructing queries.
|
|
1129
522
|
* @example
|
|
1130
|
-
*
|
|
1131
|
-
*
|
|
1132
|
-
*
|
|
1133
|
-
*
|
|
1134
|
-
*
|
|
1135
|
-
*
|
|
1136
|
-
*
|
|
1137
|
-
*
|
|
1138
|
-
*
|
|
1139
|
-
*
|
|
523
|
+
* const query = new Sitefinity.Query();
|
|
524
|
+
* const query0 = query.where().and().endsWith("Title", "Record").done().or().startsWith('Title', 'asd').done().done();
|
|
525
|
+
* const query1 = query.where().or().endsWith("Record", "Title").ne('age', '15').eq('Content', 'test').done().done();
|
|
526
|
+
* const query2 = query.where().and().endsWith("Title", "Record").done().done();
|
|
527
|
+
* const query3 = query.where().endsWith("Record", "Title").or().ne('age', '15').eq('Content', 'test').done().done();
|
|
528
|
+
* const query4 = query.where().not().endsWith("Record", "Title").done().and().not().eq('Content', 'test').done().done().done();
|
|
529
|
+
* const query5 = query.where().not().and().endsWith("Record", "Title").eq('Content', 'test').done().done().done();
|
|
530
|
+
* const query6 = query.select("Id", "Title", "Content").expand('Tags').order("Title desc").where().ne('Title', 'zzz').eq('Title', 'newTitle').done()//.count();
|
|
531
|
+
* const query7 = query.order("Title desc").where().eq('Title', 'newTitleUPDATE1').done().select("Title", "Content");
|
|
532
|
+
* const query8 = query.where().eq('Title', 'newTitleN11').done();
|
|
1140
533
|
*/
|
|
1141
534
|
var Query = /** @class */ (function (_super) {
|
|
1142
535
|
tslib_1.__extends(Query, _super);
|
|
1143
536
|
function Query() {
|
|
1144
537
|
var _this = _super.call(this) || this;
|
|
1145
|
-
_this.
|
|
1146
|
-
_this.
|
|
1147
|
-
_this.
|
|
1148
|
-
_this.
|
|
1149
|
-
_this.
|
|
1150
|
-
_this.expr = null;
|
|
538
|
+
_this.orderProperties = null;
|
|
539
|
+
_this.skipValue = null;
|
|
540
|
+
_this.takeValue = null;
|
|
541
|
+
_this.searchValue = null;
|
|
542
|
+
_this.filter = null;
|
|
1151
543
|
return _this;
|
|
1152
544
|
}
|
|
1153
545
|
/**
|
|
1154
546
|
* Begins a where clause for filtering the items.
|
|
1155
|
-
* @memberOf Query
|
|
1156
|
-
* @returns {@link WhereQuery}
|
|
1157
547
|
*/
|
|
1158
548
|
Query.prototype.where = function () {
|
|
1159
|
-
var clone = this.
|
|
1160
|
-
newObj.
|
|
549
|
+
var clone = this.clone(function (newObj) {
|
|
550
|
+
newObj.filter = new WhereQuery_1.WhereQuery(newObj);
|
|
1161
551
|
});
|
|
1162
|
-
return clone.
|
|
552
|
+
return clone.filter;
|
|
1163
553
|
};
|
|
1164
554
|
/**
|
|
1165
555
|
* Specifies the order by clause.
|
|
1166
|
-
* @memberOf Query
|
|
1167
556
|
* @example
|
|
1168
|
-
*
|
|
557
|
+
* order by single field
|
|
1169
558
|
* order("Title desc")
|
|
1170
559
|
* @example
|
|
1171
|
-
*
|
|
560
|
+
* order by multiple fields
|
|
1172
561
|
* order("Title desc", "Description asc")
|
|
1173
|
-
* @returns {@link Query}
|
|
1174
562
|
*/
|
|
1175
563
|
Query.prototype.order = function () {
|
|
1176
|
-
var
|
|
1177
|
-
|
|
1178
|
-
|
|
564
|
+
var properties = [];
|
|
565
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
566
|
+
properties[_i] = arguments[_i];
|
|
567
|
+
}
|
|
568
|
+
properties = properties !== null && properties !== void 0 ? properties : [];
|
|
569
|
+
this.validatePropertyPaths(properties);
|
|
570
|
+
return this.clone(function (newObj) {
|
|
1179
571
|
var orderItems = [];
|
|
1180
|
-
for (var i = 0; i <
|
|
1181
|
-
var member =
|
|
572
|
+
for (var i = 0; i < properties.length; i++) {
|
|
573
|
+
var member = properties[i];
|
|
1182
574
|
var orderProp = new OrderProperty_1.OrderProperty(member);
|
|
1183
575
|
orderItems.push(orderProp);
|
|
1184
576
|
}
|
|
1185
|
-
newObj.
|
|
577
|
+
newObj.orderProperties = orderItems;
|
|
1186
578
|
});
|
|
1187
579
|
};
|
|
1188
|
-
/**
|
|
1189
|
-
*
|
|
1190
|
-
* @method skip
|
|
1191
|
-
* @see [query.take]{@link query.take}
|
|
1192
|
-
* @param {number} value The number of items to skip.
|
|
1193
|
-
* @returns {Query}
|
|
580
|
+
/**
|
|
581
|
+
* Skips a certain number of items from the beginning before returning the rest of the items. Used for paging.
|
|
1194
582
|
*/
|
|
1195
583
|
Query.prototype.skip = function (value) {
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
newObj._skip = value;
|
|
584
|
+
return this.clone(function (newObj) {
|
|
585
|
+
newObj.skipValue = value;
|
|
1199
586
|
});
|
|
1200
587
|
};
|
|
1201
|
-
/**
|
|
1202
|
-
*
|
|
1203
|
-
* @param {number} value The number of items to take.
|
|
1204
|
-
* @returns {Query}
|
|
588
|
+
/**
|
|
589
|
+
* Takes a specified number of items from the query result. Used for paging.
|
|
1205
590
|
*/
|
|
1206
591
|
Query.prototype.take = function (value) {
|
|
1207
|
-
return this.
|
|
1208
|
-
newObj.
|
|
592
|
+
return this.clone(function (newObj) {
|
|
593
|
+
newObj.takeValue = value;
|
|
1209
594
|
});
|
|
1210
595
|
};
|
|
1211
|
-
/**
|
|
1212
|
-
*
|
|
1213
|
-
* @param {string} value The search expression.
|
|
1214
|
-
* @returns {Query}
|
|
596
|
+
/**
|
|
597
|
+
* Searches for the items matching the specified expression.
|
|
1215
598
|
*/
|
|
1216
599
|
Query.prototype.search = function (value) {
|
|
1217
|
-
return this.
|
|
1218
|
-
newObj.
|
|
600
|
+
return this.clone(function (newObj) {
|
|
601
|
+
newObj.searchValue = value;
|
|
1219
602
|
});
|
|
1220
603
|
};
|
|
1221
|
-
/**
|
|
1222
|
-
*
|
|
1223
|
-
* @param {inline} inline Whether to return only the count of the items with or without their JSON representation.
|
|
1224
|
-
* @returns {Query}
|
|
604
|
+
/**
|
|
605
|
+
* Returns the total item count with the result. Used for paging.
|
|
1225
606
|
*/
|
|
1226
607
|
Query.prototype.count = function (inline) {
|
|
1227
608
|
if (inline === void 0) { inline = true; }
|
|
1228
|
-
return this.
|
|
1229
|
-
newObj.
|
|
609
|
+
return this.clone(function (newObj) {
|
|
610
|
+
newObj.inlineCount = inline;
|
|
1230
611
|
});
|
|
1231
612
|
};
|
|
1232
|
-
Query.prototype._getFilter = function () {
|
|
1233
|
-
return this.expr;
|
|
1234
|
-
};
|
|
1235
|
-
Query.prototype._getOrderBy = function () {
|
|
1236
|
-
return this._order;
|
|
1237
|
-
};
|
|
1238
613
|
Query.prototype.build = function () {
|
|
1239
614
|
return new QueryBuilder_1.QueryBuilder(this).build();
|
|
1240
615
|
};
|
|
@@ -1249,64 +624,49 @@ exports.Query = Query;
|
|
|
1249
624
|
/*!**************************!*\
|
|
1250
625
|
!*** ./src/QueryBase.ts ***!
|
|
1251
626
|
\**************************/
|
|
1252
|
-
|
|
1253
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
627
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1254
628
|
|
|
1255
|
-
"use strict";
|
|
1256
629
|
|
|
1257
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
630
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
631
|
+
exports.QueryBase = void 0;
|
|
1258
632
|
var utils_1 = __webpack_require__(/*! ./utils */ "./src/utils.ts");
|
|
1259
633
|
/**
|
|
1260
|
-
*
|
|
1261
|
-
* @class QueryBase
|
|
634
|
+
* The base class for dealing with queries.
|
|
1262
635
|
*/
|
|
1263
636
|
var QueryBase = /** @class */ (function () {
|
|
1264
637
|
function QueryBase() {
|
|
1265
|
-
this.
|
|
1266
|
-
this.
|
|
638
|
+
this.selectProperties = null;
|
|
639
|
+
this.expandProperties = null;
|
|
1267
640
|
}
|
|
1268
641
|
/**
|
|
1269
642
|
* Selects which fields will be returned when querying the service.
|
|
1270
|
-
* @memberOf QueryBase
|
|
1271
|
-
* @instance
|
|
1272
|
-
* @param {string} arguments - an array of fields to include in the $select statement.
|
|
1273
|
-
* @returns {QueryBase}
|
|
1274
643
|
*/
|
|
1275
644
|
QueryBase.prototype.select = function () {
|
|
1276
|
-
var
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
645
|
+
var properties = [];
|
|
646
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
647
|
+
properties[_i] = arguments[_i];
|
|
648
|
+
}
|
|
649
|
+
properties = properties !== null && properties !== void 0 ? properties : [];
|
|
650
|
+
this.validatePropertyPaths(properties);
|
|
651
|
+
return this.clone(function (newObj) {
|
|
652
|
+
newObj.selectProperties = properties.filter(function (prop, index, props) { return props.indexOf(prop) === index; });
|
|
1280
653
|
});
|
|
1281
654
|
};
|
|
1282
655
|
/**
|
|
1283
656
|
* Selects which navigation properties will be returned when querying the service.
|
|
1284
|
-
* @memberOf QueryBase
|
|
1285
|
-
* @instance
|
|
1286
|
-
* @param {string} arguments - an array of fields to include in the $expand statement.
|
|
1287
|
-
* @returns {QueryBase}
|
|
1288
657
|
*/
|
|
1289
658
|
QueryBase.prototype.expand = function () {
|
|
1290
|
-
var
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
newObj._expand = propPaths.filter(function (prop, index, props) { return props.indexOf(prop) === index; });
|
|
1294
|
-
});
|
|
1295
|
-
};
|
|
1296
|
-
QueryBase.prototype._extractArguments = function (arg) {
|
|
1297
|
-
var values = [];
|
|
1298
|
-
for (var index = 0; index < arg.length; index++) {
|
|
1299
|
-
values.push(arg[index]);
|
|
659
|
+
var properties = [];
|
|
660
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
661
|
+
properties[_i] = arguments[_i];
|
|
1300
662
|
}
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
QueryBase.prototype._getExpand = function () {
|
|
1307
|
-
return this._expand;
|
|
663
|
+
properties = properties !== null && properties !== void 0 ? properties : [];
|
|
664
|
+
this.validatePropertyPaths(properties);
|
|
665
|
+
return this.clone(function (newObj) {
|
|
666
|
+
newObj.expandProperties = properties.filter(function (prop, index, props) { return props.indexOf(prop) === index; });
|
|
667
|
+
});
|
|
1308
668
|
};
|
|
1309
|
-
QueryBase.prototype.
|
|
669
|
+
QueryBase.prototype.validatePropertyPaths = function (propPaths, allowNested) {
|
|
1310
670
|
if (allowNested === void 0) { allowNested = false; }
|
|
1311
671
|
for (var i = 0; i < propPaths.length; i++) {
|
|
1312
672
|
var member = propPaths[i];
|
|
@@ -1318,7 +678,7 @@ var QueryBase = /** @class */ (function () {
|
|
|
1318
678
|
}
|
|
1319
679
|
}
|
|
1320
680
|
};
|
|
1321
|
-
QueryBase.prototype.
|
|
681
|
+
QueryBase.prototype.clone = function (setter) {
|
|
1322
682
|
if (setter === void 0) { setter = null; }
|
|
1323
683
|
var newObj = utils_1.utils.clone(this, new QueryBase(), setter);
|
|
1324
684
|
return newObj;
|
|
@@ -1334,74 +694,65 @@ exports.QueryBase = QueryBase;
|
|
|
1334
694
|
/*!*****************************!*\
|
|
1335
695
|
!*** ./src/QueryBuilder.ts ***!
|
|
1336
696
|
\*****************************/
|
|
1337
|
-
|
|
1338
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
697
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1339
698
|
|
|
1340
|
-
"use strict";
|
|
1341
699
|
|
|
1342
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
700
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
701
|
+
exports.QueryBuilder = void 0;
|
|
1343
702
|
var WhereQuery_1 = __webpack_require__(/*! ./WhereQuery */ "./src/WhereQuery.ts");
|
|
1344
703
|
var Expression_1 = __webpack_require__(/*! ./Expression */ "./src/Expression.ts");
|
|
1345
704
|
var OrderProperty_1 = __webpack_require__(/*! ./OrderProperty */ "./src/OrderProperty.ts");
|
|
1346
705
|
var utils_1 = __webpack_require__(/*! ./utils */ "./src/utils.ts");
|
|
1347
|
-
var
|
|
706
|
+
var constants_1 = __webpack_require__(/*! ./constants */ "./src/constants.ts");
|
|
1348
707
|
var QueryBuilder = /** @class */ (function () {
|
|
1349
708
|
function QueryBuilder(query) {
|
|
1350
709
|
this.query = query;
|
|
1351
710
|
}
|
|
1352
711
|
QueryBuilder.prototype.build = function () {
|
|
1353
712
|
var queryParameters = {};
|
|
1354
|
-
this.
|
|
1355
|
-
return queryParameters;
|
|
1356
|
-
};
|
|
1357
|
-
QueryBuilder.prototype._buildODataQueryParams = function (query, queryParameters) {
|
|
1358
|
-
var queryParams = constants.ODataParams;
|
|
1359
|
-
var whereClause = query._getFilter();
|
|
713
|
+
var whereClause = this.query.filter;
|
|
1360
714
|
if (whereClause instanceof WhereQuery_1.WhereQuery) {
|
|
1361
|
-
var expression = whereClause.
|
|
715
|
+
var expression = whereClause.getExpression();
|
|
1362
716
|
if (expression instanceof Expression_1.ComplexExpression) {
|
|
1363
|
-
var result = this.
|
|
717
|
+
var result = this.buildComplexExpression(expression, null);
|
|
1364
718
|
if (result) {
|
|
1365
|
-
queryParameters[
|
|
719
|
+
queryParameters[constants_1.ODATA_PARAMS.$filter] = result;
|
|
1366
720
|
}
|
|
1367
721
|
}
|
|
1368
722
|
}
|
|
1369
|
-
var selectClause = query.
|
|
723
|
+
var selectClause = this.query.selectProperties;
|
|
1370
724
|
if (selectClause instanceof Array) {
|
|
1371
|
-
queryParameters[
|
|
725
|
+
queryParameters[constants_1.ODATA_PARAMS.$select] = selectClause.join(', ');
|
|
1372
726
|
}
|
|
1373
|
-
var expandClause = query.
|
|
727
|
+
var expandClause = this.query.expandProperties;
|
|
1374
728
|
if (expandClause instanceof Array)
|
|
1375
|
-
queryParameters[
|
|
1376
|
-
var orderByClause = query.
|
|
729
|
+
queryParameters[constants_1.ODATA_PARAMS.$expand] = expandClause.join(', ');
|
|
730
|
+
var orderByClause = this.query.orderProperties;
|
|
1377
731
|
if (orderByClause instanceof Array) {
|
|
1378
732
|
var order = [];
|
|
1379
733
|
for (var i in orderByClause) {
|
|
1380
734
|
if (orderByClause[i] instanceof OrderProperty_1.OrderProperty)
|
|
1381
735
|
order.push(orderByClause[i].getValue());
|
|
1382
736
|
}
|
|
1383
|
-
queryParameters[
|
|
737
|
+
queryParameters[constants_1.ODATA_PARAMS.$orderby] = order.join(', ');
|
|
1384
738
|
}
|
|
1385
|
-
var take = query.
|
|
739
|
+
var take = this.query.takeValue;
|
|
1386
740
|
if (utils_1.utils.isNumber(take))
|
|
1387
|
-
queryParameters[
|
|
1388
|
-
var skip = query.
|
|
741
|
+
queryParameters[constants_1.ODATA_PARAMS.$top] = take;
|
|
742
|
+
var skip = this.query.skipValue;
|
|
1389
743
|
if (utils_1.utils.isNumber(skip))
|
|
1390
|
-
queryParameters[
|
|
1391
|
-
var search = query.
|
|
744
|
+
queryParameters[constants_1.ODATA_PARAMS.$skip] = skip;
|
|
745
|
+
var search = this.query.searchValue;
|
|
1392
746
|
if (search)
|
|
1393
|
-
queryParameters[
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
if (count !== null) {
|
|
1397
|
-
queryParameters[queryParams.$count] = count;
|
|
747
|
+
queryParameters[constants_1.ODATA_PARAMS.$search] = search;
|
|
748
|
+
if (this.query.inlineCount !== null) {
|
|
749
|
+
queryParameters[constants_1.ODATA_PARAMS.$count] = this.query.inlineCount;
|
|
1398
750
|
}
|
|
1399
751
|
return queryParameters;
|
|
1400
752
|
};
|
|
1401
|
-
QueryBuilder.prototype.
|
|
753
|
+
QueryBuilder.prototype.buildComplexExpression = function (expression, parent) {
|
|
1402
754
|
if (!(expression instanceof Expression_1.ComplexExpression))
|
|
1403
755
|
throw new Error('Invalid complex expression');
|
|
1404
|
-
var OperatorType = constants.ExpressionType;
|
|
1405
756
|
var counter = 0;
|
|
1406
757
|
var result = '';
|
|
1407
758
|
var subExpressions = expression.getExpressions();
|
|
@@ -1411,24 +762,24 @@ var QueryBuilder = /** @class */ (function () {
|
|
|
1411
762
|
while (true) {
|
|
1412
763
|
var currentExp = subExpressions[counter];
|
|
1413
764
|
if (currentExp instanceof Expression_1.BinaryExpression) {
|
|
1414
|
-
result += this.
|
|
765
|
+
result += this.buildBinaryExpression(currentExp);
|
|
1415
766
|
}
|
|
1416
767
|
else if (currentExp instanceof Expression_1.ComplexExpression) {
|
|
1417
|
-
var complexResult = this.
|
|
768
|
+
var complexResult = this.buildComplexExpression(currentExp, expression.type);
|
|
1418
769
|
if (complexResult) {
|
|
1419
770
|
result += '(' + complexResult + ')';
|
|
1420
771
|
}
|
|
1421
772
|
}
|
|
1422
|
-
if (expression.getType() ===
|
|
773
|
+
if (expression.getType() === constants_1.EXPRESSION_TYPE.not)
|
|
1423
774
|
result = expression.getType() + ' ' + result;
|
|
1424
775
|
// TODOSDK: Rethink this!
|
|
1425
|
-
if (expression.getType() ===
|
|
776
|
+
if (expression.getType() === constants_1.EXPRESSION_TYPE.any) {
|
|
1426
777
|
var exprVal = [];
|
|
1427
778
|
for (var index = 0; index < subExpressions.length; index++) {
|
|
1428
|
-
if (subExpressions[index].type ==
|
|
779
|
+
if (subExpressions[index].type == constants_1.EXPRESSION_TYPE.contains || subExpressions[index].type == constants_1.EXPRESSION_TYPE.startsWith || subExpressions[index].type == constants_1.EXPRESSION_TYPE.endsWith)
|
|
1429
780
|
exprVal.push(subExpressions[index].type.toLowerCase() + "(x, '" + subExpressions[index].constant + "')");
|
|
1430
781
|
else
|
|
1431
|
-
exprVal.push('x ' + subExpressions[index].type.toLowerCase() + ' ' + this.
|
|
782
|
+
exprVal.push('x ' + subExpressions[index].type.toLowerCase() + ' ' + this.checkType(subExpressions[index].constant));
|
|
1432
783
|
}
|
|
1433
784
|
result = currentExp.parameter + '/' + expression.getType() + '(x:' + exprVal.join(' ' + parent + ' ') + ')';
|
|
1434
785
|
}
|
|
@@ -1439,46 +790,44 @@ var QueryBuilder = /** @class */ (function () {
|
|
|
1439
790
|
}
|
|
1440
791
|
return result;
|
|
1441
792
|
};
|
|
1442
|
-
QueryBuilder.prototype.
|
|
1443
|
-
if (!(expression instanceof Expression_1.BinaryExpression))
|
|
1444
|
-
throw new Error('Invalid binary expression');
|
|
1445
|
-
var ExpressionType = constants.ExpressionType;
|
|
793
|
+
QueryBuilder.prototype.buildBinaryExpression = function (expression) {
|
|
1446
794
|
var result = null;
|
|
1447
795
|
var type = expression.getType();
|
|
1448
796
|
switch (type) {
|
|
1449
|
-
case
|
|
1450
|
-
case
|
|
1451
|
-
case
|
|
1452
|
-
case
|
|
1453
|
-
case
|
|
1454
|
-
case
|
|
797
|
+
case constants_1.EXPRESSION_TYPE.eq:
|
|
798
|
+
case constants_1.EXPRESSION_TYPE.ne:
|
|
799
|
+
case constants_1.EXPRESSION_TYPE.lt:
|
|
800
|
+
case constants_1.EXPRESSION_TYPE.le:
|
|
801
|
+
case constants_1.EXPRESSION_TYPE.gt:
|
|
802
|
+
case constants_1.EXPRESSION_TYPE.ge: {
|
|
1455
803
|
var constant = expression.getConstant();
|
|
1456
|
-
|
|
1457
|
-
if (/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(constant))
|
|
1458
|
-
template = '({0} {1} {2})';*/
|
|
1459
|
-
result = "(" + expression.getParameter() + " " + type + " " + this._checkType(constant) + ")";
|
|
804
|
+
result = "(".concat(expression.getParameter(), " ").concat(type, " ").concat(this.checkType(constant), ")");
|
|
1460
805
|
break;
|
|
1461
|
-
|
|
1462
|
-
case
|
|
1463
|
-
case
|
|
1464
|
-
case
|
|
1465
|
-
var expressionParameter = this.
|
|
1466
|
-
|
|
806
|
+
}
|
|
807
|
+
case constants_1.EXPRESSION_TYPE.contains:
|
|
808
|
+
case constants_1.EXPRESSION_TYPE.startsWith:
|
|
809
|
+
case constants_1.EXPRESSION_TYPE.endsWith: {
|
|
810
|
+
var expressionParameter = this.applyCaseSensitiveSettings(expression, expression.getParameter());
|
|
811
|
+
var expressionConstant = this.checkType(expression.getConstant());
|
|
812
|
+
var expressionValue = this.applyCaseSensitiveSettings(expression, expressionConstant);
|
|
813
|
+
result = "".concat(type.toLowerCase(), "(").concat(expressionParameter, ", ").concat(expressionValue, ")");
|
|
1467
814
|
break;
|
|
1468
|
-
|
|
1469
|
-
|
|
815
|
+
}
|
|
816
|
+
default: {
|
|
817
|
+
var msg = "Unsupported operator ".concat(type);
|
|
1470
818
|
throw new Error(msg);
|
|
819
|
+
}
|
|
1471
820
|
}
|
|
1472
821
|
return result;
|
|
1473
822
|
};
|
|
1474
|
-
QueryBuilder.prototype.
|
|
823
|
+
QueryBuilder.prototype.applyCaseSensitiveSettings = function (expression, value) {
|
|
1475
824
|
if (expression.isCaseSensitive()) {
|
|
1476
|
-
return
|
|
825
|
+
return value;
|
|
1477
826
|
}
|
|
1478
|
-
return "tolower("
|
|
827
|
+
return "tolower(".concat(value, ")");
|
|
1479
828
|
};
|
|
1480
|
-
QueryBuilder.prototype.
|
|
1481
|
-
if (this.
|
|
829
|
+
QueryBuilder.prototype.checkType = function (constant) {
|
|
830
|
+
if (this.isGuid(constant))
|
|
1482
831
|
return constant;
|
|
1483
832
|
if (constant == null)
|
|
1484
833
|
return null;
|
|
@@ -1489,7 +838,7 @@ var QueryBuilder = /** @class */ (function () {
|
|
|
1489
838
|
constant = constant.replace(/'/g, "''");
|
|
1490
839
|
return "'" + constant + "'";
|
|
1491
840
|
};
|
|
1492
|
-
QueryBuilder.prototype.
|
|
841
|
+
QueryBuilder.prototype.isGuid = function (constant) {
|
|
1493
842
|
return /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(constant);
|
|
1494
843
|
};
|
|
1495
844
|
return QueryBuilder;
|
|
@@ -1503,30 +852,25 @@ exports.QueryBuilder = QueryBuilder;
|
|
|
1503
852
|
/*!**************************************!*\
|
|
1504
853
|
!*** ./src/Requests/BatchRequest.ts ***!
|
|
1505
854
|
\**************************************/
|
|
1506
|
-
|
|
1507
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
855
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1508
856
|
|
|
1509
|
-
"use strict";
|
|
1510
857
|
|
|
1511
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
858
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
859
|
+
exports.BatchRequest = exports.Transaction = void 0;
|
|
1512
860
|
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
|
|
1513
|
-
var Request_1 = __webpack_require__(/*! ./Request */ "./src/Requests/Request.ts");
|
|
1514
861
|
var BlobBuilder_1 = __webpack_require__(/*! ../BlobBuilder */ "./src/BlobBuilder.ts");
|
|
1515
862
|
var utils_1 = __webpack_require__(/*! ../utils */ "./src/utils.ts");
|
|
1516
|
-
var
|
|
1517
|
-
var
|
|
863
|
+
var constants_1 = __webpack_require__(/*! ../constants */ "./src/constants.ts");
|
|
864
|
+
var ExecutableRequest_1 = __webpack_require__(/*! ./ExecutableRequest */ "./src/Requests/ExecutableRequest.ts");
|
|
1518
865
|
/**
|
|
1519
|
-
*
|
|
1520
|
-
* @class Transaction
|
|
1521
|
-
* @param {object} urlOptions - The url options that are passed to the {@link _factory} object.
|
|
1522
|
-
* @param {object} _factory - The factory object used for request generation.
|
|
866
|
+
* The transaction class is used to group operations that involve data manipulation together and execute them as a single atomic operation.
|
|
1523
867
|
*/
|
|
1524
868
|
var Transaction = /** @class */ (function () {
|
|
1525
|
-
function Transaction(urlOptions,
|
|
869
|
+
function Transaction(urlOptions, factory) {
|
|
1526
870
|
this.urlOptions = urlOptions;
|
|
1527
|
-
this.
|
|
1528
|
-
this.
|
|
1529
|
-
this.
|
|
871
|
+
this.factory = factory;
|
|
872
|
+
this.requests = [];
|
|
873
|
+
this.counter = 0;
|
|
1530
874
|
}
|
|
1531
875
|
Transaction.prototype.upload = function (parameters) {
|
|
1532
876
|
var urlOptions = this.urlParametersClone(parameters.entitySet);
|
|
@@ -1536,17 +880,13 @@ var Transaction = /** @class */ (function () {
|
|
|
1536
880
|
contentType: parameters.contentType,
|
|
1537
881
|
fileName: parameters.fileName,
|
|
1538
882
|
key: parameters.key,
|
|
1539
|
-
uploadProperties:
|
|
883
|
+
uploadProperties: parameters.uploadProperties
|
|
1540
884
|
};
|
|
1541
|
-
var request = this.
|
|
1542
|
-
return this.addRequest(
|
|
885
|
+
var request = this.factory.upload(options);
|
|
886
|
+
return this.addRequest(request);
|
|
1543
887
|
};
|
|
1544
888
|
/**
|
|
1545
889
|
* Adds a POST request to create a single item.
|
|
1546
|
-
* @memberOf Transaction
|
|
1547
|
-
* @instance
|
|
1548
|
-
* @param {object} parameters - The parameters for the request.
|
|
1549
|
-
* @param {object} parameters.data - The payload of the request.
|
|
1550
890
|
*/
|
|
1551
891
|
Transaction.prototype.create = function (parameters) {
|
|
1552
892
|
if (!(parameters || parameters.entitySet))
|
|
@@ -1556,19 +896,15 @@ var Transaction = /** @class */ (function () {
|
|
|
1556
896
|
key: parameters.key,
|
|
1557
897
|
action: parameters.action,
|
|
1558
898
|
urlOptions: urlOptions,
|
|
1559
|
-
data:
|
|
899
|
+
data: parameters.data
|
|
1560
900
|
};
|
|
1561
|
-
var request = this.
|
|
1562
|
-
return this.addRequest(
|
|
901
|
+
var request = this.factory.create(options);
|
|
902
|
+
return this.addRequest(request);
|
|
1563
903
|
};
|
|
1564
904
|
/**
|
|
1565
905
|
* Adds a POST request to execute an operation on single item.
|
|
1566
|
-
* @memberOf Transaction
|
|
1567
|
-
* @instance
|
|
1568
|
-
* @param {object} parameters - The parameters for the request.
|
|
1569
|
-
* @param {string} parameters.key - The identifier of the item to be updated.
|
|
1570
|
-
* @param {object} parameters.data - The payload of the request.
|
|
1571
906
|
*/
|
|
907
|
+
// TODO: Remove
|
|
1572
908
|
Transaction.prototype.operation = function (parameters) {
|
|
1573
909
|
if (!(parameters || parameters.entitySet || parameters.key || parameters.data))
|
|
1574
910
|
throw "parameters: entitySet, key and data are required!";
|
|
@@ -1577,20 +913,14 @@ var Transaction = /** @class */ (function () {
|
|
|
1577
913
|
urlOptions: urlOptions,
|
|
1578
914
|
key: parameters.key,
|
|
1579
915
|
action: 'operation',
|
|
1580
|
-
data:
|
|
916
|
+
data: parameters.data
|
|
1581
917
|
};
|
|
1582
|
-
var request = this.
|
|
1583
|
-
this.
|
|
1584
|
-
this.addRequest(
|
|
918
|
+
var request = this.factory.create(options);
|
|
919
|
+
this.overrideUrlGeneration(request, parameters.key, 'operation', options.urlOptions, options.query);
|
|
920
|
+
this.addRequest(request);
|
|
1585
921
|
};
|
|
1586
922
|
/**
|
|
1587
923
|
* Adds a PATCH request to update a single item.
|
|
1588
|
-
* @memberOf Transaction
|
|
1589
|
-
* @instance
|
|
1590
|
-
* @param {object} parameters - The parameters for the request.
|
|
1591
|
-
* @param {bool} parameters.saveTemp - A flag indicating whether to save in temp.
|
|
1592
|
-
* @param {string} parameters.key - The identifier of the item to be updated.
|
|
1593
|
-
* @param {object} parameters.data - The payload of the request.
|
|
1594
924
|
*/
|
|
1595
925
|
Transaction.prototype.update = function (parameters) {
|
|
1596
926
|
if (!(parameters || parameters.entitySet || parameters.key || parameters.data))
|
|
@@ -1600,18 +930,14 @@ var Transaction = /** @class */ (function () {
|
|
|
1600
930
|
urlOptions: urlOptions,
|
|
1601
931
|
saveTemp: parameters.saveTemp,
|
|
1602
932
|
key: parameters.key,
|
|
1603
|
-
data:
|
|
933
|
+
data: parameters.data
|
|
1604
934
|
};
|
|
1605
|
-
var request = this.
|
|
1606
|
-
this.
|
|
1607
|
-
this.addRequest(
|
|
935
|
+
var request = this.factory.update(options);
|
|
936
|
+
this.overrideUrlGeneration(request, parameters.key, undefined, options.urlOptions, options.query);
|
|
937
|
+
this.addRequest(request);
|
|
1608
938
|
};
|
|
1609
939
|
/**
|
|
1610
940
|
* Adds a DELETE request to delete a single item.
|
|
1611
|
-
* @memberOf Transaction
|
|
1612
|
-
* @instance
|
|
1613
|
-
* @param {object} parameters - The parameters for the request.
|
|
1614
|
-
* @param {string} parameters.key - The identifier of the item to be deleted.
|
|
1615
941
|
*/
|
|
1616
942
|
Transaction.prototype.destroy = function (parameters) {
|
|
1617
943
|
if (!(parameters || parameters.entitySet || parameters.key))
|
|
@@ -1621,17 +947,12 @@ var Transaction = /** @class */ (function () {
|
|
|
1621
947
|
urlOptions: urlOptions,
|
|
1622
948
|
key: parameters.key
|
|
1623
949
|
};
|
|
1624
|
-
var request = this.
|
|
1625
|
-
this.
|
|
1626
|
-
this.addRequest(
|
|
950
|
+
var request = this.factory.destroy(options);
|
|
951
|
+
this.overrideUrlGeneration(request, parameters.key, undefined, options.urlOptions, options.query);
|
|
952
|
+
this.addRequest(request);
|
|
1627
953
|
};
|
|
1628
954
|
/**
|
|
1629
|
-
* Adds a DELETE request to
|
|
1630
|
-
* @memberOf Transaction
|
|
1631
|
-
* @instance
|
|
1632
|
-
* @param {object} parameters - The parameters for the request.
|
|
1633
|
-
* @param {string} parameters.key - The identifier of the item.
|
|
1634
|
-
* @param {string} parameters.navigationProperty - The name of the navigation property.
|
|
955
|
+
* Adds a DELETE request to delete all of the associated members in the relation property.
|
|
1635
956
|
*/
|
|
1636
957
|
Transaction.prototype.destroyRelated = function (parameters) {
|
|
1637
958
|
if (!(parameters || parameters.entitySet || parameters.key))
|
|
@@ -1640,52 +961,40 @@ var Transaction = /** @class */ (function () {
|
|
|
1640
961
|
var options = {
|
|
1641
962
|
urlOptions: urlOptions,
|
|
1642
963
|
key: parameters.key,
|
|
1643
|
-
|
|
964
|
+
property: parameters.property
|
|
1644
965
|
};
|
|
1645
|
-
var request = this.
|
|
1646
|
-
var
|
|
1647
|
-
this.
|
|
1648
|
-
this.addRequest(
|
|
966
|
+
var request = this.factory.destroyRelated(options);
|
|
967
|
+
var propertyURL = request.property + '/$ref';
|
|
968
|
+
this.overrideUrlGeneration(request, parameters.key, propertyURL, options.urlOptions, options.query);
|
|
969
|
+
this.addRequest(request);
|
|
1649
970
|
};
|
|
1650
971
|
/**
|
|
1651
972
|
* Adds a DELETE request to retrieve the a single entry of the associated members in the relation property.
|
|
1652
|
-
* @memberOf Transaction
|
|
1653
|
-
* @instance
|
|
1654
|
-
* @param {object} parameters - The parameters for the request.
|
|
1655
|
-
* @param {string} parameters.key - The identifier of the item.
|
|
1656
|
-
* @param {string} parameters.navigationProperty - The name of the navigation property.
|
|
1657
|
-
* @param {string} parameters.relatedKey - The identifier of the related item.
|
|
1658
973
|
*/
|
|
1659
974
|
Transaction.prototype.destroyRelatedById = function (parameters) {
|
|
1660
|
-
if (!(parameters || parameters.entitySet || parameters.key || parameters.
|
|
1661
|
-
throw "parameters: entitySet, key,
|
|
975
|
+
if (!(parameters || parameters.entitySet || parameters.key || parameters.relatedId || parameters.property))
|
|
976
|
+
throw "parameters: entitySet, key, relatedId and property are required!";
|
|
1662
977
|
var urlOptions = this.urlParametersClone(parameters.entitySet);
|
|
1663
978
|
var options = {
|
|
1664
979
|
urlOptions: urlOptions,
|
|
1665
980
|
key: parameters.key,
|
|
1666
|
-
|
|
1667
|
-
|
|
981
|
+
relatedId: parameters.relatedId,
|
|
982
|
+
property: parameters.property
|
|
1668
983
|
};
|
|
1669
|
-
var request = this.
|
|
1670
|
-
this.addRequest(
|
|
984
|
+
var request = this.factory.destroyRelatedById(options);
|
|
985
|
+
this.addRequest(request);
|
|
1671
986
|
};
|
|
1672
987
|
/**
|
|
1673
988
|
* Adds a POST request to add a related item to the property collection.
|
|
1674
|
-
* @memberOf Transaction
|
|
1675
|
-
* @instance
|
|
1676
|
-
* @see {@link Data.createRelated}
|
|
1677
|
-
* @param {object} parameters - The parameters for the request.
|
|
1678
|
-
* @param {string} parameters.key - The identifier of the item.
|
|
1679
|
-
* @param {string} parameters.navigationProperty - The name of the navigation property
|
|
1680
989
|
*/
|
|
1681
990
|
Transaction.prototype.createRelated = function (parameters) {
|
|
1682
|
-
if (!(parameters || parameters.entitySet || parameters.key || parameters.link || parameters.
|
|
1683
|
-
throw "parameters: entitySet, key, link and
|
|
991
|
+
if (!(parameters || parameters.entitySet || parameters.key || parameters.link || parameters.property))
|
|
992
|
+
throw "parameters: entitySet, key, link and property are required!";
|
|
1684
993
|
// TODO: rethink about the urls
|
|
1685
994
|
var urlOptions = this.urlParametersClone(parameters.entitySet);
|
|
1686
|
-
for (var index = 0; index < this.
|
|
1687
|
-
if (this.
|
|
1688
|
-
parameters.link = "$" + this.
|
|
995
|
+
for (var index = 0; index < this.requests.length; index += 1) {
|
|
996
|
+
if (this.requests[index].id == parameters.link) {
|
|
997
|
+
parameters.link = "$" + this.requests[index].id;
|
|
1689
998
|
}
|
|
1690
999
|
}
|
|
1691
1000
|
var data = {
|
|
@@ -1694,26 +1003,26 @@ var Transaction = /** @class */ (function () {
|
|
|
1694
1003
|
var options = {
|
|
1695
1004
|
urlOptions: urlOptions,
|
|
1696
1005
|
key: parameters.key,
|
|
1697
|
-
|
|
1698
|
-
data:
|
|
1006
|
+
property: parameters.property,
|
|
1007
|
+
data: data
|
|
1699
1008
|
};
|
|
1700
|
-
var request = this.
|
|
1701
|
-
var
|
|
1702
|
-
this.
|
|
1703
|
-
return this.addRequest(
|
|
1009
|
+
var request = this.factory.createRelated(options);
|
|
1010
|
+
var propertyURL = request.property + '/$ref';
|
|
1011
|
+
this.overrideUrlGeneration(request, parameters.key, propertyURL, options.urlOptions, options.query);
|
|
1012
|
+
return this.addRequest(request);
|
|
1704
1013
|
};
|
|
1705
|
-
Transaction.prototype.
|
|
1014
|
+
Transaction.prototype.overrideUrlGeneration = function (request, key, additionalPropertyURL, urlOptions, query) {
|
|
1706
1015
|
// TODO: match requests with Content-ID's!
|
|
1707
|
-
// Content-ID's are the same as id's in
|
|
1708
|
-
for (var index = 0; index < this.
|
|
1709
|
-
if (this.
|
|
1710
|
-
request.
|
|
1016
|
+
// Content-ID's are the same as id's in requests.
|
|
1017
|
+
for (var index = 0; index < this.requests.length; index += 1) {
|
|
1018
|
+
if (this.requests[index].id == key) {
|
|
1019
|
+
request.buildUrl = function () {
|
|
1711
1020
|
var uri = "$" + key;
|
|
1712
1021
|
if (additionalPropertyURL !== undefined) {
|
|
1713
1022
|
uri = uri + '/' + additionalPropertyURL;
|
|
1714
1023
|
}
|
|
1715
|
-
if (
|
|
1716
|
-
var queryString = request.
|
|
1024
|
+
if (urlOptions) {
|
|
1025
|
+
var queryString = request.getQueryString(urlOptions, query);
|
|
1717
1026
|
if (queryString) {
|
|
1718
1027
|
uri = uri + queryString;
|
|
1719
1028
|
}
|
|
@@ -1723,9 +1032,9 @@ var Transaction = /** @class */ (function () {
|
|
|
1723
1032
|
}
|
|
1724
1033
|
}
|
|
1725
1034
|
};
|
|
1726
|
-
Transaction.prototype.addRequest = function (
|
|
1727
|
-
|
|
1728
|
-
return
|
|
1035
|
+
Transaction.prototype.addRequest = function (request) {
|
|
1036
|
+
this.requests.push({ id: this.counter, request: request });
|
|
1037
|
+
return this.counter++;
|
|
1729
1038
|
};
|
|
1730
1039
|
Transaction.prototype.urlParametersClone = function (entitySet) {
|
|
1731
1040
|
var options = utils_1.utils.clone(this.urlOptions);
|
|
@@ -1734,50 +1043,40 @@ var Transaction = /** @class */ (function () {
|
|
|
1734
1043
|
};
|
|
1735
1044
|
return Transaction;
|
|
1736
1045
|
}());
|
|
1046
|
+
exports.Transaction = Transaction;
|
|
1737
1047
|
/**
|
|
1738
|
-
*
|
|
1739
|
-
* @class BatchRequest
|
|
1048
|
+
* The batch request class is used for grouping requests into a single batch request to execute on the server.
|
|
1740
1049
|
*/
|
|
1741
1050
|
var BatchRequest = /** @class */ (function (_super) {
|
|
1742
1051
|
tslib_1.__extends(BatchRequest, _super);
|
|
1743
|
-
function BatchRequest(
|
|
1744
|
-
var _this = _super.call(this,
|
|
1745
|
-
_this.
|
|
1746
|
-
_this.
|
|
1747
|
-
_this.
|
|
1748
|
-
_this.boundary = _this.
|
|
1052
|
+
function BatchRequest(requestOptions, token, sdkOptions) {
|
|
1053
|
+
var _this = _super.call(this, requestOptions, token, sdkOptions) || this;
|
|
1054
|
+
_this.factory = requestOptions.factory;
|
|
1055
|
+
_this.requests = [];
|
|
1056
|
+
_this.counter = 0;
|
|
1057
|
+
_this.boundary = _this.createBoundary("sf_batch_");
|
|
1749
1058
|
_this.responseHeaderRegex = /^([^()<>@,;:\\"\/[\]?={} \t]+)\s?:\s?(.*)/;
|
|
1750
1059
|
_this.responseStatusRegex = /^HTTP\/1\.\d (\d{3}) (.*)$/i;
|
|
1751
1060
|
return _this;
|
|
1752
1061
|
}
|
|
1753
1062
|
/**
|
|
1754
1063
|
* Adds a GET request to retrieve a collection of items.
|
|
1755
|
-
* @memberOf BatchRequest
|
|
1756
|
-
* @instance
|
|
1757
|
-
* @param {object} parameters - The parameters for the request.
|
|
1758
|
-
* @param {object} parameters.query - The {@link WhereQuery} with which to filter the items
|
|
1759
1064
|
*/
|
|
1760
1065
|
BatchRequest.prototype.get = function (parameters) {
|
|
1761
1066
|
if (!(parameters || parameters.entitySet))
|
|
1762
1067
|
throw "entitySet is required!";
|
|
1763
1068
|
var urlOptions = this.urlParametersClone(parameters.entitySet);
|
|
1764
|
-
if (parameters && parameters.query)
|
|
1765
|
-
urlOptions.ODataParams = parameters.query;
|
|
1766
1069
|
var options = {
|
|
1767
1070
|
urlOptions: urlOptions,
|
|
1768
1071
|
action: parameters.action,
|
|
1769
|
-
|
|
1072
|
+
query: parameters.query,
|
|
1073
|
+
fallbackProperties: parameters.fallbackProperties
|
|
1770
1074
|
};
|
|
1771
|
-
var request = this.
|
|
1075
|
+
var request = this.factory.get(options);
|
|
1772
1076
|
this.addRequest(request);
|
|
1773
1077
|
};
|
|
1774
1078
|
/**
|
|
1775
1079
|
* Adds a GET request for the retrieval of a single item.
|
|
1776
|
-
* @memberOf BatchRequest
|
|
1777
|
-
* @instance
|
|
1778
|
-
* @param {object} parameters - The parameters for the request.
|
|
1779
|
-
* @param {object} parameters.query - The {@link QueryBase} object containing the OData query options that should be sent to the server.
|
|
1780
|
-
* @param {string} parameters.key - The identifier of the item to be retrieved.
|
|
1781
1080
|
*/
|
|
1782
1081
|
BatchRequest.prototype.getSingle = function (parameters) {
|
|
1783
1082
|
if (!(parameters || parameters.entitySet || parameters.key))
|
|
@@ -1786,20 +1085,14 @@ var BatchRequest = /** @class */ (function (_super) {
|
|
|
1786
1085
|
var options = {
|
|
1787
1086
|
urlOptions: urlOptions,
|
|
1788
1087
|
action: parameters.action,
|
|
1789
|
-
key: parameters.key
|
|
1088
|
+
key: parameters.key,
|
|
1089
|
+
query: parameters.query
|
|
1790
1090
|
};
|
|
1791
|
-
|
|
1792
|
-
options.ODataParams = parameters.query;
|
|
1793
|
-
var request = this._factory.getSingle(options);
|
|
1091
|
+
var request = this.factory.getSingle(options);
|
|
1794
1092
|
this.addRequest(request);
|
|
1795
1093
|
};
|
|
1796
1094
|
/**
|
|
1797
1095
|
* Adds a GET request to get the property of a single item.
|
|
1798
|
-
* @memberOf BatchRequest
|
|
1799
|
-
* @instance
|
|
1800
|
-
* @param {object} parameters - The parameters for the request.
|
|
1801
|
-
* @param {string} parameters.key - The identifier of the item.
|
|
1802
|
-
* @param {string} parameters.property - The name of the property to be retrieved.
|
|
1803
1096
|
*/
|
|
1804
1097
|
BatchRequest.prototype.getProperty = function (parameters) {
|
|
1805
1098
|
if (!(parameters || parameters.entitySet || parameters.key, parameters.property))
|
|
@@ -1808,132 +1101,116 @@ var BatchRequest = /** @class */ (function (_super) {
|
|
|
1808
1101
|
var options = {
|
|
1809
1102
|
urlOptions: urlOptions,
|
|
1810
1103
|
key: parameters.key,
|
|
1811
|
-
|
|
1104
|
+
property: parameters.property
|
|
1812
1105
|
};
|
|
1813
|
-
var request = this.
|
|
1106
|
+
var request = this.factory.getProperty(options);
|
|
1814
1107
|
this.addRequest(request);
|
|
1815
1108
|
};
|
|
1816
1109
|
/**
|
|
1817
1110
|
* Adds a GET request to get the related property value of a single item.
|
|
1818
|
-
* @memberOf BatchRequest
|
|
1819
|
-
* @instance
|
|
1820
|
-
* @param {object} parameters - The parameters for the request.
|
|
1821
|
-
* @param {string} parameters.key - The identifier of the item.
|
|
1822
|
-
* @param {string} parameters.navigationProperty - The name of the navigation property to be retrieved.
|
|
1823
1111
|
*/
|
|
1824
1112
|
BatchRequest.prototype.getRelated = function (parameters) {
|
|
1825
|
-
if (!(parameters || parameters.entitySet || parameters.key || parameters.
|
|
1826
|
-
throw "parameters: entitySet, key and
|
|
1113
|
+
if (!(parameters || parameters.entitySet || parameters.key || parameters.property))
|
|
1114
|
+
throw "parameters: entitySet, key and property are required!";
|
|
1827
1115
|
var urlOptions = this.urlParametersClone(parameters.entitySet);
|
|
1828
1116
|
var options = {
|
|
1829
1117
|
urlOptions: urlOptions,
|
|
1830
1118
|
key: parameters.key,
|
|
1831
|
-
|
|
1119
|
+
property: parameters.property
|
|
1832
1120
|
};
|
|
1833
|
-
var request = this.
|
|
1121
|
+
var request = this.factory.getRelated(options);
|
|
1834
1122
|
this.addRequest(request);
|
|
1835
1123
|
};
|
|
1836
1124
|
/**
|
|
1837
1125
|
* Adds a GET request to retrieve the related property value of a single item by the id of the related item.
|
|
1838
|
-
* @memberOf BatchRequest
|
|
1839
|
-
* @instance
|
|
1840
|
-
* @param {object} parameters - The parameters for the request.
|
|
1841
|
-
* @param {string} parameters.key - The identifier of the item.
|
|
1842
|
-
* @param {string} parameters.navigationProperty - The name of the navigation property to be retrieved.
|
|
1843
|
-
* @param {string} parameters.relatedKey - The identifier of the related item.
|
|
1844
1126
|
*/
|
|
1845
1127
|
BatchRequest.prototype.getRelatedById = function (parameters) {
|
|
1846
|
-
if (!(parameters || parameters.entitySet || parameters.key || parameters.
|
|
1847
|
-
throw "parameters: entitySet, key,
|
|
1128
|
+
if (!(parameters || parameters.entitySet || parameters.key || parameters.relatedId || parameters.property))
|
|
1129
|
+
throw "parameters: entitySet, key, relatedId and property are required!";
|
|
1848
1130
|
var urlOptions = this.urlParametersClone(parameters.entitySet);
|
|
1849
1131
|
var options = {
|
|
1850
1132
|
urlOptions: urlOptions,
|
|
1851
1133
|
key: parameters.key,
|
|
1852
|
-
|
|
1853
|
-
|
|
1134
|
+
relatedId: parameters.relatedId,
|
|
1135
|
+
property: parameters.property
|
|
1854
1136
|
};
|
|
1855
|
-
var request = this.
|
|
1137
|
+
var request = this.factory.getRelatedById(options);
|
|
1856
1138
|
this.addRequest(request);
|
|
1857
1139
|
};
|
|
1858
1140
|
/**
|
|
1859
1141
|
* Begins a transaction.
|
|
1860
|
-
* @memberOf BatchRequest
|
|
1861
|
-
* @instance
|
|
1862
|
-
* @returns {@link Transaction}
|
|
1863
1142
|
*/
|
|
1864
1143
|
BatchRequest.prototype.beginTransaction = function () {
|
|
1865
1144
|
var option = utils_1.utils.clone(this.urlOptions);
|
|
1866
|
-
var newTransaction = new Transaction(option, this.
|
|
1867
|
-
newTransaction.id = ++this.
|
|
1145
|
+
var newTransaction = new Transaction(option, this.factory);
|
|
1146
|
+
newTransaction.id = ++this.counter;
|
|
1868
1147
|
return newTransaction;
|
|
1869
1148
|
};
|
|
1870
1149
|
/**
|
|
1871
1150
|
* Ends a transaction.
|
|
1872
|
-
* @memberOf BatchRequest
|
|
1873
|
-
* @instance
|
|
1874
1151
|
*/
|
|
1875
1152
|
BatchRequest.prototype.endTransaction = function (transaction) {
|
|
1876
|
-
this.
|
|
1153
|
+
this.requests.push({
|
|
1877
1154
|
id: transaction.id,
|
|
1878
1155
|
request: transaction
|
|
1879
1156
|
});
|
|
1880
1157
|
};
|
|
1881
|
-
BatchRequest.prototype.
|
|
1882
|
-
return this.
|
|
1158
|
+
BatchRequest.prototype.getBody = function () {
|
|
1159
|
+
return this.buildRequestBody();
|
|
1883
1160
|
};
|
|
1884
|
-
BatchRequest.prototype.
|
|
1885
|
-
return
|
|
1161
|
+
BatchRequest.prototype.getMethod = function () {
|
|
1162
|
+
return constants_1.HTTP_METHODS.post;
|
|
1886
1163
|
};
|
|
1887
|
-
BatchRequest.prototype.
|
|
1164
|
+
BatchRequest.prototype.getHeaders = function () {
|
|
1888
1165
|
var contentType = "multipart/mixed; boundary=" + this.boundary;
|
|
1889
1166
|
var headers = {};
|
|
1890
|
-
headers[
|
|
1167
|
+
headers[constants_1.HEADER_NAMES.contentType] = contentType;
|
|
1891
1168
|
return headers;
|
|
1892
1169
|
};
|
|
1893
|
-
BatchRequest.prototype.
|
|
1170
|
+
BatchRequest.prototype.buildUrl = function () {
|
|
1894
1171
|
var url = this.urlOptions.baseUrl + "$batch";
|
|
1895
|
-
var queryString = this.
|
|
1172
|
+
var queryString = this.getQueryString(this.urlOptions, this.query);
|
|
1896
1173
|
if (queryString) {
|
|
1897
1174
|
url += queryString;
|
|
1898
1175
|
}
|
|
1899
1176
|
return url;
|
|
1900
1177
|
};
|
|
1901
|
-
BatchRequest.prototype.
|
|
1178
|
+
BatchRequest.prototype.parseResponse = function (http) {
|
|
1902
1179
|
var context = {
|
|
1903
1180
|
position: 0,
|
|
1904
1181
|
boundaries: []
|
|
1905
1182
|
};
|
|
1906
1183
|
var pos = context.position;
|
|
1907
|
-
var partHeaders = this.
|
|
1908
|
-
var partContentType = this.
|
|
1184
|
+
var partHeaders = this.readHeaders(http.getAllResponseHeaders(), context);
|
|
1185
|
+
var partContentType = this.contentType(partHeaders["content-type"]);
|
|
1909
1186
|
if (partContentType && partContentType.mediaType == "multipart/mixed") {
|
|
1910
1187
|
context.boundaries.push(partContentType.properties.boundary);
|
|
1911
1188
|
}
|
|
1912
1189
|
context.position = pos;
|
|
1913
|
-
var batchResponse = this.
|
|
1190
|
+
var batchResponse = this.parseBatchResponse(http.responseText, context);
|
|
1914
1191
|
var responseParsed = [];
|
|
1915
1192
|
for (var i = 0; i < batchResponse.length; i++) {
|
|
1916
1193
|
try {
|
|
1917
|
-
var currentRequest = this.
|
|
1194
|
+
var currentRequest = this.requests[i];
|
|
1918
1195
|
var finalResult = null;
|
|
1919
1196
|
var key = null;
|
|
1920
1197
|
var singleResponse = batchResponse[i];
|
|
1921
1198
|
var changesets = singleResponse.__changeResponses;
|
|
1922
1199
|
if (changesets) {
|
|
1923
1200
|
finalResult = [];
|
|
1924
|
-
var currentRequests = currentRequest ? currentRequest.request.
|
|
1201
|
+
var currentRequests = currentRequest ? currentRequest.request.requests : [];
|
|
1925
1202
|
for (var j = 0; j < changesets.length; j++) {
|
|
1926
|
-
key = currentRequests[j] ? currentRequests[j].request.
|
|
1203
|
+
key = currentRequests[j] ? currentRequests[j].request.key : null;
|
|
1927
1204
|
var changeset = changesets[j];
|
|
1928
1205
|
var response = changeset.response;
|
|
1929
|
-
var responseResult = this.
|
|
1206
|
+
var responseResult = this.getResponseResult(response, key);
|
|
1930
1207
|
finalResult.push(responseResult);
|
|
1931
1208
|
}
|
|
1932
1209
|
}
|
|
1933
1210
|
else {
|
|
1934
1211
|
key = currentRequest ? currentRequest.request.key : null;
|
|
1935
1212
|
var response = singleResponse.response;
|
|
1936
|
-
finalResult = this.
|
|
1213
|
+
finalResult = this.getResponseResult(response, key);
|
|
1937
1214
|
}
|
|
1938
1215
|
var statusCodeCheck = function (r) {
|
|
1939
1216
|
return r.statusCode >= 400;
|
|
@@ -1961,38 +1238,38 @@ var BatchRequest = /** @class */ (function (_super) {
|
|
|
1961
1238
|
var batchIsSuccessful = responseParsed.filter(isSuccessfulCheck).length === 0;
|
|
1962
1239
|
return { data: responseParsed, isSuccessful: batchIsSuccessful };
|
|
1963
1240
|
};
|
|
1964
|
-
BatchRequest.prototype.
|
|
1241
|
+
BatchRequest.prototype.parseBatchResponse = function (text, context) {
|
|
1965
1242
|
// get boundary from response
|
|
1966
|
-
var delimiter = "--" + this.
|
|
1967
|
-
this.
|
|
1968
|
-
this.
|
|
1243
|
+
var delimiter = "--" + this.currentBoundary(context);
|
|
1244
|
+
this.readTo(text, delimiter, context);
|
|
1245
|
+
this.readLine(text, context);
|
|
1969
1246
|
var responses = [];
|
|
1970
1247
|
var partEnd;
|
|
1971
1248
|
while (partEnd !== "--" && context.position < text.length) {
|
|
1972
|
-
var partHeaders = this.
|
|
1973
|
-
var partContentType = this.
|
|
1974
|
-
var changeResponses;
|
|
1249
|
+
var partHeaders = this.readHeaders(text, context);
|
|
1250
|
+
var partContentType = this.contentType(partHeaders["content-type"]);
|
|
1251
|
+
var changeResponses = void 0;
|
|
1975
1252
|
if (partContentType && partContentType.mediaType === "multipart/mixed") {
|
|
1976
1253
|
context.boundaries.push(partContentType.properties.boundary);
|
|
1977
1254
|
try {
|
|
1978
|
-
changeResponses = this.
|
|
1255
|
+
changeResponses = this.parseBatchResponse(text, context);
|
|
1979
1256
|
}
|
|
1980
1257
|
catch (e) {
|
|
1981
|
-
e.response = this.
|
|
1258
|
+
e.response = this.readResponse(text, context, delimiter);
|
|
1982
1259
|
changeResponses = [e];
|
|
1983
1260
|
}
|
|
1984
1261
|
responses.push({ __changeResponses: changeResponses });
|
|
1985
1262
|
context.boundaries.pop();
|
|
1986
|
-
this.
|
|
1263
|
+
this.readTo(text, "--" + this.currentBoundary(context), context);
|
|
1987
1264
|
}
|
|
1988
1265
|
else {
|
|
1989
1266
|
if (!partContentType || partContentType.mediaType !== "application/http") {
|
|
1990
1267
|
throw { message: "invalid MIME part type " };
|
|
1991
1268
|
}
|
|
1992
1269
|
// Skip empty line
|
|
1993
|
-
this.
|
|
1270
|
+
this.readLine(text, context);
|
|
1994
1271
|
// Read the response
|
|
1995
|
-
var response = this.
|
|
1272
|
+
var response = this.readResponse(text, context, delimiter);
|
|
1996
1273
|
try {
|
|
1997
1274
|
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
1998
1275
|
response = { message: response.statusCode + " Http request is OK", response: response };
|
|
@@ -2009,11 +1286,11 @@ var BatchRequest = /** @class */ (function (_super) {
|
|
|
2009
1286
|
}
|
|
2010
1287
|
partEnd = text.substr(context.position, 2);
|
|
2011
1288
|
// Ignore the incoming line.
|
|
2012
|
-
this.
|
|
1289
|
+
this.readLine(text, context);
|
|
2013
1290
|
}
|
|
2014
1291
|
return responses;
|
|
2015
1292
|
};
|
|
2016
|
-
BatchRequest.prototype.
|
|
1293
|
+
BatchRequest.prototype.getResponseResult = function (response, key) {
|
|
2017
1294
|
var responseBody = response.body;
|
|
2018
1295
|
var data = utils_1.utils.parseStringToJson(responseBody);
|
|
2019
1296
|
return {
|
|
@@ -2023,11 +1300,11 @@ var BatchRequest = /** @class */ (function (_super) {
|
|
|
2023
1300
|
headers: response.headers
|
|
2024
1301
|
};
|
|
2025
1302
|
};
|
|
2026
|
-
BatchRequest.prototype.
|
|
1303
|
+
BatchRequest.prototype.currentBoundary = function (context) {
|
|
2027
1304
|
var boundaries = context.boundaries;
|
|
2028
1305
|
return boundaries[boundaries.length - 1];
|
|
2029
1306
|
};
|
|
2030
|
-
BatchRequest.prototype.
|
|
1307
|
+
BatchRequest.prototype.contentType = function (str) {
|
|
2031
1308
|
if (!str) {
|
|
2032
1309
|
return null;
|
|
2033
1310
|
}
|
|
@@ -2040,7 +1317,7 @@ var BatchRequest = /** @class */ (function (_super) {
|
|
|
2040
1317
|
}
|
|
2041
1318
|
return { mediaType: contentTypeParts[0].replace(/^\s+|\s+$/g, ''), properties: properties };
|
|
2042
1319
|
};
|
|
2043
|
-
BatchRequest.prototype.
|
|
1320
|
+
BatchRequest.prototype.readTo = function (text, str, context) {
|
|
2044
1321
|
var start = context.position || 0;
|
|
2045
1322
|
var end = text.length;
|
|
2046
1323
|
if (str) {
|
|
@@ -2055,17 +1332,17 @@ var BatchRequest = /** @class */ (function (_super) {
|
|
|
2055
1332
|
}
|
|
2056
1333
|
return text.substring(start, end);
|
|
2057
1334
|
};
|
|
2058
|
-
BatchRequest.prototype.
|
|
2059
|
-
return this.
|
|
1335
|
+
BatchRequest.prototype.readLine = function (text, context) {
|
|
1336
|
+
return this.readTo(text, BatchRequest.constants.newLine, context);
|
|
2060
1337
|
};
|
|
2061
|
-
BatchRequest.prototype.
|
|
1338
|
+
BatchRequest.prototype.readHeaders = function (text, context) {
|
|
2062
1339
|
var headers = {};
|
|
2063
1340
|
var parts;
|
|
2064
1341
|
var line;
|
|
2065
1342
|
var pos;
|
|
2066
1343
|
do {
|
|
2067
1344
|
pos = context.position;
|
|
2068
|
-
line = this.
|
|
1345
|
+
line = this.readLine(text, context);
|
|
2069
1346
|
parts = this.responseHeaderRegex.exec(line);
|
|
2070
1347
|
if (parts !== null) {
|
|
2071
1348
|
headers[parts[1].toLowerCase()] = parts[2];
|
|
@@ -2077,18 +1354,18 @@ var BatchRequest = /** @class */ (function (_super) {
|
|
|
2077
1354
|
} while (line && parts);
|
|
2078
1355
|
return headers;
|
|
2079
1356
|
};
|
|
2080
|
-
BatchRequest.prototype.
|
|
1357
|
+
BatchRequest.prototype.readResponse = function (text, context, delimiter) {
|
|
2081
1358
|
// Read the status line.
|
|
2082
1359
|
var pos = context.position;
|
|
2083
|
-
var match = this.responseStatusRegex.exec(this.
|
|
1360
|
+
var match = this.responseStatusRegex.exec(this.readLine(text, context));
|
|
2084
1361
|
var statusCode;
|
|
2085
1362
|
var statusText;
|
|
2086
1363
|
var headers;
|
|
2087
1364
|
if (match) {
|
|
2088
1365
|
statusCode = match[1];
|
|
2089
1366
|
statusText = match[2];
|
|
2090
|
-
headers = this.
|
|
2091
|
-
this.
|
|
1367
|
+
headers = this.readHeaders(text, context);
|
|
1368
|
+
this.readLine(text, context);
|
|
2092
1369
|
}
|
|
2093
1370
|
else {
|
|
2094
1371
|
context.position = pos;
|
|
@@ -2097,71 +1374,71 @@ var BatchRequest = /** @class */ (function (_super) {
|
|
|
2097
1374
|
statusCode: statusCode,
|
|
2098
1375
|
statusText: statusText,
|
|
2099
1376
|
headers: headers,
|
|
2100
|
-
body: this.
|
|
1377
|
+
body: this.readTo(text, BatchRequest.constants.newLine + delimiter, context)
|
|
2101
1378
|
};
|
|
2102
1379
|
};
|
|
2103
|
-
BatchRequest.prototype.
|
|
1380
|
+
BatchRequest.prototype.buildRequestBody = function () {
|
|
2104
1381
|
var builder = new BlobBuilder_1.BlobBuilder();
|
|
2105
1382
|
builder.append('');
|
|
2106
|
-
for (var index = 0; index < this.
|
|
2107
|
-
var request = this.
|
|
1383
|
+
for (var index = 0; index < this.requests.length; index += 1) {
|
|
1384
|
+
var request = this.requests[index].request;
|
|
2108
1385
|
if (index != 0)
|
|
2109
1386
|
builder.append(BatchRequest.constants.newLine + BatchRequest.constants.newLine);
|
|
2110
1387
|
builder.append("--" + this.boundary);
|
|
2111
1388
|
if (request instanceof Transaction) {
|
|
2112
|
-
builder.append(this.
|
|
1389
|
+
builder.append(this.buildTransaction(request));
|
|
2113
1390
|
}
|
|
2114
1391
|
else {
|
|
2115
|
-
builder.append(this.
|
|
1392
|
+
builder.append(this.buildRequest(request));
|
|
2116
1393
|
}
|
|
2117
1394
|
}
|
|
2118
|
-
builder.append(this.
|
|
1395
|
+
builder.append(this.createDelimeter(this.boundary, true));
|
|
2119
1396
|
return builder.build();
|
|
2120
1397
|
};
|
|
2121
|
-
BatchRequest.prototype.
|
|
1398
|
+
BatchRequest.prototype.buildRequest = function (request) {
|
|
2122
1399
|
var builder = new BlobBuilder_1.BlobBuilder();
|
|
2123
1400
|
builder.append(BatchRequest.constants.newLine + 'Content-Type: application/http' +
|
|
2124
1401
|
BatchRequest.constants.newLine + 'Content-Transfer-Encoding: binary' +
|
|
2125
1402
|
BatchRequest.constants.newLine +
|
|
2126
1403
|
BatchRequest.constants.newLine +
|
|
2127
|
-
request.
|
|
2128
|
-
' ' + request.
|
|
1404
|
+
request.getMethod() +
|
|
1405
|
+
' ' + request.buildUrl() + ' HTTP/1.1');
|
|
2129
1406
|
return builder.build();
|
|
2130
1407
|
};
|
|
2131
|
-
BatchRequest.prototype.
|
|
2132
|
-
if (transaction.
|
|
1408
|
+
BatchRequest.prototype.buildTransaction = function (transaction) {
|
|
1409
|
+
if (transaction.requests.length == 0)
|
|
2133
1410
|
return;
|
|
2134
1411
|
var builder = new BlobBuilder_1.BlobBuilder();
|
|
2135
1412
|
builder.append(BatchRequest.constants.newLine);
|
|
2136
|
-
var changeset = this.
|
|
1413
|
+
var changeset = this.createBoundary("sf_changeset_");
|
|
2137
1414
|
builder.append('Content-Type: multipart/mixed; boundary=' + changeset);
|
|
2138
|
-
var changesetRequests = transaction.
|
|
1415
|
+
var changesetRequests = transaction.requests;
|
|
2139
1416
|
for (var index = 0; index < changesetRequests.length; index += 1) {
|
|
2140
1417
|
var currentRequest = changesetRequests[index].request;
|
|
2141
1418
|
// we shouldn't add new lines after blob content. Otherwise they are added to the blob and corrupt it
|
|
2142
|
-
var shouldAddNewLine = index === 0 || !utils_1.utils.isBlob(changesetRequests[index - 1].request.
|
|
2143
|
-
builder.append(this.
|
|
1419
|
+
var shouldAddNewLine = index === 0 || !utils_1.utils.isBlob(changesetRequests[index - 1].request.getBody());
|
|
1420
|
+
builder.append(this.createDelimeter(changeset, false, shouldAddNewLine) +
|
|
2144
1421
|
BatchRequest.constants.newLine + 'Content-Type: application/http' +
|
|
2145
1422
|
BatchRequest.constants.newLine + 'Content-Transfer-Encoding: binary' +
|
|
2146
1423
|
BatchRequest.constants.newLine + 'Content-ID: ' + changesetRequests[index].id);
|
|
2147
|
-
var requestUrl = currentRequest.
|
|
2148
|
-
builder.append(BatchRequest.constants.newLine + BatchRequest.constants.newLine + currentRequest.
|
|
2149
|
-
var headers = currentRequest.
|
|
1424
|
+
var requestUrl = currentRequest.buildUrl();
|
|
1425
|
+
builder.append(BatchRequest.constants.newLine + BatchRequest.constants.newLine + currentRequest.getMethod() + ' ' + requestUrl + ' HTTP/1.1');
|
|
1426
|
+
var headers = currentRequest.getHeaders();
|
|
2150
1427
|
var headerNames = Object.keys(headers);
|
|
2151
1428
|
for (var i = 0; i < headerNames.length; i++) {
|
|
2152
1429
|
var headerName = headerNames[i];
|
|
2153
1430
|
builder.append(BatchRequest.constants.newLine + headerName + ": " + headers[headerName]);
|
|
2154
1431
|
}
|
|
2155
|
-
var body = currentRequest.
|
|
1432
|
+
var body = utils_1.utils.serializeToJSON(currentRequest.getBody());
|
|
2156
1433
|
if (body) {
|
|
2157
1434
|
builder.append(BatchRequest.constants.newLine + BatchRequest.constants.newLine);
|
|
2158
1435
|
builder.append(body);
|
|
2159
1436
|
}
|
|
2160
1437
|
}
|
|
2161
|
-
builder.append(this.
|
|
1438
|
+
builder.append(this.createDelimeter(changeset, true));
|
|
2162
1439
|
return builder.build();
|
|
2163
1440
|
};
|
|
2164
|
-
BatchRequest.prototype.
|
|
1441
|
+
BatchRequest.prototype.createDelimeter = function (boundary, close, shouldAddNewLine) {
|
|
2165
1442
|
if (shouldAddNewLine === void 0) { shouldAddNewLine = true; }
|
|
2166
1443
|
var result = "";
|
|
2167
1444
|
if (shouldAddNewLine) {
|
|
@@ -2174,21 +1451,24 @@ var BatchRequest = /** @class */ (function (_super) {
|
|
|
2174
1451
|
}
|
|
2175
1452
|
return result;
|
|
2176
1453
|
};
|
|
2177
|
-
BatchRequest.prototype.
|
|
1454
|
+
BatchRequest.prototype.createBoundary = function (prefix) {
|
|
2178
1455
|
return prefix + utils_1.utils.hex16() + '-' + utils_1.utils.hex16() + '-' + utils_1.utils.hex16();
|
|
2179
1456
|
};
|
|
2180
1457
|
BatchRequest.prototype.addRequest = function (request) {
|
|
2181
|
-
|
|
1458
|
+
this.requests.push({ id: this.counter, request: request });
|
|
1459
|
+
return this.counter++;
|
|
2182
1460
|
};
|
|
2183
1461
|
BatchRequest.prototype.urlParametersClone = function (entitySet) {
|
|
2184
|
-
|
|
1462
|
+
var options = utils_1.utils.clone(this.urlOptions);
|
|
1463
|
+
options.entitySet = entitySet;
|
|
1464
|
+
return options;
|
|
2185
1465
|
};
|
|
2186
1466
|
BatchRequest.constants = {
|
|
2187
1467
|
newLine: '\r\n'
|
|
2188
1468
|
};
|
|
2189
1469
|
return BatchRequest;
|
|
2190
|
-
}(
|
|
2191
|
-
|
|
1470
|
+
}(ExecutableRequest_1.ExecutableRequest));
|
|
1471
|
+
exports.BatchRequest = BatchRequest;
|
|
2192
1472
|
|
|
2193
1473
|
|
|
2194
1474
|
/***/ }),
|
|
@@ -2197,90 +1477,70 @@ module.exports = BatchRequest;
|
|
|
2197
1477
|
/*!*******************************************!*\
|
|
2198
1478
|
!*** ./src/Requests/ExecutableRequest.ts ***!
|
|
2199
1479
|
\*******************************************/
|
|
2200
|
-
|
|
2201
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1480
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2202
1481
|
|
|
2203
|
-
"use strict";
|
|
2204
1482
|
|
|
2205
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1483
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1484
|
+
exports.ExecutableRequest = void 0;
|
|
1485
|
+
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
|
|
1486
|
+
var RequestBase_1 = __webpack_require__(/*! ./RequestBase */ "./src/Requests/RequestBase.ts");
|
|
2206
1487
|
var utils_1 = __webpack_require__(/*! ../utils */ "./src/utils.ts");
|
|
2207
|
-
var
|
|
1488
|
+
var constants_1 = __webpack_require__(/*! ../constants */ "./src/constants.ts");
|
|
2208
1489
|
var XMLHttpRequestDone = 4;
|
|
2209
|
-
function
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
var
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
return this.request._getQueryString(urlOptions);
|
|
2222
|
-
};
|
|
2223
|
-
this._buildUrl = function () {
|
|
2224
|
-
return this.request._buildUrl();
|
|
2225
|
-
};
|
|
2226
|
-
this.request = options.request;
|
|
2227
|
-
this.handlers = options.handlers;
|
|
2228
|
-
this.token = options.token;
|
|
2229
|
-
this.enableUnlimitedChoices = options.enableUnlimitedChoices;
|
|
2230
|
-
this.integrationMode = options.integrationMode;
|
|
1490
|
+
var ExecutableRequest = /** @class */ (function (_super) {
|
|
1491
|
+
tslib_1.__extends(ExecutableRequest, _super);
|
|
1492
|
+
function ExecutableRequest(requestOptions, token, sdkOptions) {
|
|
1493
|
+
var _this = this;
|
|
1494
|
+
var _a, _b;
|
|
1495
|
+
_this = _super.call(this, requestOptions) || this;
|
|
1496
|
+
_this.token = token;
|
|
1497
|
+
_this.successCb = _this.successCb || ((_a = sdkOptions.handlers) === null || _a === void 0 ? void 0 : _a.successCb);
|
|
1498
|
+
_this.failureCb = _this.failureCb || ((_b = sdkOptions.handlers) === null || _b === void 0 ? void 0 : _b.failureCb);
|
|
1499
|
+
_this.enableUnlimitedChoices = sdkOptions.enableUnlimitedChoices;
|
|
1500
|
+
_this.integrationMode = sdkOptions.integrationMode;
|
|
1501
|
+
return _this;
|
|
2231
1502
|
}
|
|
2232
1503
|
ExecutableRequest.prototype.execute = function () {
|
|
2233
|
-
this._execute();
|
|
2234
|
-
};
|
|
2235
|
-
ExecutableRequest.prototype._execute = function () {
|
|
2236
1504
|
var _this = this;
|
|
2237
1505
|
var http = new XMLHttpRequest();
|
|
2238
1506
|
http.onreadystatechange = function () {
|
|
2239
1507
|
if (http.readyState === XMLHttpRequestDone) {
|
|
2240
1508
|
if (http.status > 0) {
|
|
2241
|
-
var data = _this.
|
|
1509
|
+
var data = _this.parseResponse(http);
|
|
2242
1510
|
if (http.status >= 200 && http.status <= 206) {
|
|
2243
|
-
if (isFunction(_this.
|
|
2244
|
-
_this.
|
|
2245
|
-
}
|
|
2246
|
-
if (_this.handlers && isFunction(_this.handlers.successCb)) {
|
|
2247
|
-
_this.handlers.successCb(data);
|
|
1511
|
+
if (utils_1.utils.isFunction(_this.successCb)) {
|
|
1512
|
+
_this.successCb(data);
|
|
2248
1513
|
}
|
|
2249
1514
|
}
|
|
2250
1515
|
else if (http.status >= 400) {
|
|
2251
1516
|
// When the data is string, we save the string as message
|
|
2252
1517
|
// and convert the data to normal object with message property
|
|
2253
1518
|
if (utils_1.utils.isString(data)) {
|
|
2254
|
-
var message = data;
|
|
2255
1519
|
data = {
|
|
2256
|
-
message:
|
|
1520
|
+
message: data
|
|
2257
1521
|
};
|
|
2258
1522
|
}
|
|
2259
1523
|
data.status = http.status;
|
|
2260
1524
|
// in case of errors we would like there to be one handler for all of the errors
|
|
2261
|
-
if (isFunction(_this.
|
|
2262
|
-
_this.
|
|
2263
|
-
}
|
|
2264
|
-
if (_this.handlers && isFunction(_this.handlers.failureCb)) {
|
|
2265
|
-
_this.handlers.failureCb(data);
|
|
1525
|
+
if (utils_1.utils.isFunction(_this.failureCb)) {
|
|
1526
|
+
_this.failureCb(data);
|
|
2266
1527
|
}
|
|
2267
1528
|
}
|
|
2268
1529
|
}
|
|
2269
1530
|
}
|
|
2270
1531
|
};
|
|
2271
|
-
if (isFunction(this.
|
|
1532
|
+
if (utils_1.utils.isFunction(this.progressCb)) {
|
|
2272
1533
|
if (http.upload) {
|
|
2273
|
-
var that = this;
|
|
2274
1534
|
http.upload.onprogress = function (event) {
|
|
2275
|
-
|
|
1535
|
+
_this.progressCb(event);
|
|
2276
1536
|
};
|
|
2277
1537
|
}
|
|
2278
1538
|
}
|
|
2279
|
-
var method = this.
|
|
2280
|
-
var url = this.
|
|
1539
|
+
var method = this.getMethod();
|
|
1540
|
+
var url = this.buildUrl();
|
|
2281
1541
|
http.open(method, url, true);
|
|
2282
|
-
this.setHeaders(http, this.
|
|
2283
|
-
http.send(this.
|
|
1542
|
+
this.setHeaders(http, this.getHeaders());
|
|
1543
|
+
http.send(utils_1.utils.serializeToJSON(this.getBody()));
|
|
2284
1544
|
};
|
|
2285
1545
|
ExecutableRequest.prototype.setHeaders = function (http, headers) {
|
|
2286
1546
|
var headerKeys = Object.keys(headers);
|
|
@@ -2291,27 +1551,23 @@ var ExecutableRequest = /** @class */ (function () {
|
|
|
2291
1551
|
if (this.token) {
|
|
2292
1552
|
if (typeof this.token === 'string') {
|
|
2293
1553
|
// for backward compatibility
|
|
2294
|
-
http.setRequestHeader(
|
|
1554
|
+
http.setRequestHeader(constants_1.HEADER_NAMES.authorization, this.token);
|
|
2295
1555
|
}
|
|
2296
1556
|
else {
|
|
2297
|
-
http.setRequestHeader(
|
|
1557
|
+
http.setRequestHeader(constants_1.HEADER_NAMES.authorization, this.token.type + " " + this.token.value);
|
|
2298
1558
|
}
|
|
2299
1559
|
}
|
|
2300
1560
|
if (this.enableUnlimitedChoices) {
|
|
2301
|
-
http.setRequestHeader(
|
|
1561
|
+
http.setRequestHeader(constants_1.HEADER_NAMES.choicesBinaryRepresentation, "true");
|
|
2302
1562
|
}
|
|
2303
1563
|
if (this.integrationMode) {
|
|
2304
|
-
http.setRequestHeader(
|
|
1564
|
+
http.setRequestHeader(constants_1.HEADER_NAMES.integrationMode, "true");
|
|
2305
1565
|
}
|
|
2306
1566
|
// for backward compatibility
|
|
2307
|
-
http.setRequestHeader(
|
|
2308
|
-
};
|
|
2309
|
-
ExecutableRequest.prototype._getBody = function () {
|
|
2310
|
-
var body = utils_1.utils.serializeToJSON(this.request._getBody());
|
|
2311
|
-
return body;
|
|
1567
|
+
http.setRequestHeader(constants_1.HEADER_NAMES.serviceRequest, "true");
|
|
2312
1568
|
};
|
|
2313
1569
|
return ExecutableRequest;
|
|
2314
|
-
}());
|
|
1570
|
+
}(RequestBase_1.RequestBase));
|
|
2315
1571
|
exports.ExecutableRequest = ExecutableRequest;
|
|
2316
1572
|
|
|
2317
1573
|
|
|
@@ -2321,389 +1577,383 @@ exports.ExecutableRequest = ExecutableRequest;
|
|
|
2321
1577
|
/*!*********************************!*\
|
|
2322
1578
|
!*** ./src/Requests/Request.ts ***!
|
|
2323
1579
|
\*********************************/
|
|
2324
|
-
|
|
2325
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1580
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2326
1581
|
|
|
2327
|
-
"use strict";
|
|
2328
1582
|
|
|
2329
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1583
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1584
|
+
exports.UploadRequest = exports.CreateRelatedRequest = exports.DeleteRelatedByIdRequest = exports.DeleteRelatedRequest = exports.GetRelatedByIdRequest = exports.GetRelatedRequest = exports.CreateRequest = exports.UpdateRequest = exports.DeleteRequest = exports.GetByIdRequest = exports.GetRequest = void 0;
|
|
2330
1585
|
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
|
|
1586
|
+
var constants_1 = __webpack_require__(/*! ../constants */ "./src/constants.ts");
|
|
2331
1587
|
var utils_1 = __webpack_require__(/*! ../utils */ "./src/utils.ts");
|
|
2332
|
-
var
|
|
2333
|
-
var headerNames = __webpack_require__(/*! ../Headers */ "./src/Headers.ts").headerNames;
|
|
2334
|
-
var contentTypes = __webpack_require__(/*! ../ContentTypes */ "./src/ContentTypes.ts").default;
|
|
2335
|
-
var httpMethods = __webpack_require__(/*! ../HttpMethods */ "./src/HttpMethods.ts").default;
|
|
2336
|
-
var RequestBase = /** @class */ (function () {
|
|
2337
|
-
function RequestBase(options) {
|
|
2338
|
-
this.successCb = options.successCb;
|
|
2339
|
-
this.failureCb = options.failureCb;
|
|
2340
|
-
this.urlOptions = options.urlOptions;
|
|
2341
|
-
this.progressCb = options.progressCb;
|
|
2342
|
-
this.key = options.key;
|
|
2343
|
-
this.action = options.action;
|
|
2344
|
-
this._fallbackProperties = options.fallbackProperties;
|
|
2345
|
-
}
|
|
2346
|
-
RequestBase.prototype._getBody = function () {
|
|
2347
|
-
return undefined;
|
|
2348
|
-
};
|
|
2349
|
-
RequestBase.prototype._getMethod = function () {
|
|
2350
|
-
return null;
|
|
2351
|
-
};
|
|
2352
|
-
RequestBase.prototype._getHeaders = function () {
|
|
2353
|
-
var headers = {};
|
|
2354
|
-
headers[headerNames.contentType] = contentTypes.json;
|
|
2355
|
-
return headers;
|
|
2356
|
-
};
|
|
2357
|
-
RequestBase.prototype._getQueryParameters = function (paramDictionary, urlOptions) {
|
|
2358
|
-
if (urlOptions.ODataParams) {
|
|
2359
|
-
var query = urlOptions.ODataParams.build();
|
|
2360
|
-
if (utils_1.utils.isString(query.$filter))
|
|
2361
|
-
paramDictionary[constants.ODataParams.$filter] = query.$filter;
|
|
2362
|
-
if (utils_1.utils.isString(query.$select))
|
|
2363
|
-
paramDictionary[constants.ODataParams.$select] = query.$select;
|
|
2364
|
-
if (utils_1.utils.isString(query.$expand))
|
|
2365
|
-
paramDictionary[constants.ODataParams.$expand] = query.$expand;
|
|
2366
|
-
if (utils_1.utils.isString(query.$orderby))
|
|
2367
|
-
paramDictionary[constants.ODataParams.$orderby] = query.$orderby;
|
|
2368
|
-
if (utils_1.utils.isNumber(query.$skip))
|
|
2369
|
-
paramDictionary[constants.ODataParams.$skip] = query.$skip;
|
|
2370
|
-
if (utils_1.utils.isNumber(query.$top))
|
|
2371
|
-
paramDictionary[constants.ODataParams.$top] = query.$top;
|
|
2372
|
-
if (utils_1.utils.isString(query.$search))
|
|
2373
|
-
paramDictionary[constants.ODataParams.$search] = query.$search;
|
|
2374
|
-
// inline count
|
|
2375
|
-
if (utils_1.utils.isBoolean(query.$count) && query.$count)
|
|
2376
|
-
paramDictionary[constants.ODataParams.$count] = query.$count;
|
|
2377
|
-
}
|
|
2378
|
-
if (urlOptions.SFParams) {
|
|
2379
|
-
var sfParams = urlOptions.SFParams;
|
|
2380
|
-
if (sfParams.provider) {
|
|
2381
|
-
paramDictionary[constants.SfParams.provider] = sfParams.provider;
|
|
2382
|
-
}
|
|
2383
|
-
if (sfParams.culture) {
|
|
2384
|
-
paramDictionary[constants.SfParams.culture] = sfParams.culture;
|
|
2385
|
-
}
|
|
2386
|
-
if (sfParams.siteId) {
|
|
2387
|
-
paramDictionary[constants.SfParams.siteId] = sfParams.siteId;
|
|
2388
|
-
}
|
|
2389
|
-
}
|
|
2390
|
-
if (this._fallbackProperties) {
|
|
2391
|
-
paramDictionary["sf_fallback_prop_names"] = this._fallbackProperties.join();
|
|
2392
|
-
}
|
|
2393
|
-
if (urlOptions.additionalQueryParams) {
|
|
2394
|
-
for (var key in urlOptions.additionalQueryParams) {
|
|
2395
|
-
if (urlOptions.additionalQueryParams.hasOwnProperty(key)) {
|
|
2396
|
-
paramDictionary[key] = urlOptions.additionalQueryParams[key];
|
|
2397
|
-
}
|
|
2398
|
-
}
|
|
2399
|
-
}
|
|
2400
|
-
};
|
|
2401
|
-
RequestBase.prototype._getQueryString = function (urlOptions) {
|
|
2402
|
-
var paramDictionary = {};
|
|
2403
|
-
this._getQueryParameters(paramDictionary, urlOptions);
|
|
2404
|
-
var keys = Object.keys(paramDictionary);
|
|
2405
|
-
if (keys.length == 0)
|
|
2406
|
-
return null;
|
|
2407
|
-
var queryString = "?";
|
|
2408
|
-
for (var prop in paramDictionary) {
|
|
2409
|
-
queryString += prop + "=" + paramDictionary[prop] + "&";
|
|
2410
|
-
}
|
|
2411
|
-
queryString = queryString.substring(0, queryString.length - 1);
|
|
2412
|
-
return queryString;
|
|
2413
|
-
};
|
|
2414
|
-
RequestBase.prototype._buildUrl = function () {
|
|
2415
|
-
var url = this.urlOptions.baseUrl + (this.urlOptions.entitySet || "");
|
|
2416
|
-
url += this.key ? ("(" + this.key + ")") : "";
|
|
2417
|
-
if (this.action) {
|
|
2418
|
-
url += url.endsWith("/") ? "" : "/";
|
|
2419
|
-
url += this.action;
|
|
2420
|
-
}
|
|
2421
|
-
// including count here
|
|
2422
|
-
// not the best solution as build() is called once more in getQueryString
|
|
2423
|
-
// but not that big of an issue right now
|
|
2424
|
-
if (this.urlOptions.ODataParams) {
|
|
2425
|
-
var getCount = this.urlOptions.ODataParams.build().$count;
|
|
2426
|
-
if (utils_1.utils.isBoolean(getCount) && !getCount) {
|
|
2427
|
-
url += "/$count";
|
|
2428
|
-
}
|
|
2429
|
-
}
|
|
2430
|
-
return this._addQueryParameters(url);
|
|
2431
|
-
};
|
|
2432
|
-
RequestBase.prototype._parseResponse = function (http) {
|
|
2433
|
-
var data = utils_1.utils.parseStringToJson(http.responseText);
|
|
2434
|
-
if (data) {
|
|
2435
|
-
if (http.status >= 400 && data.error) {
|
|
2436
|
-
return data.error;
|
|
2437
|
-
}
|
|
2438
|
-
return data;
|
|
2439
|
-
}
|
|
2440
|
-
return http.responseText;
|
|
2441
|
-
};
|
|
2442
|
-
RequestBase.prototype._addQueryParameters = function (url) {
|
|
2443
|
-
var queryString = this._getQueryString(this.urlOptions);
|
|
2444
|
-
if (queryString) {
|
|
2445
|
-
if (url.indexOf("?") > -1 && queryString[0] == "?") {
|
|
2446
|
-
queryString = "&" + queryString.substring(1);
|
|
2447
|
-
}
|
|
2448
|
-
url += queryString;
|
|
2449
|
-
}
|
|
2450
|
-
return url;
|
|
2451
|
-
};
|
|
2452
|
-
return RequestBase;
|
|
2453
|
-
}());
|
|
2454
|
-
exports.RequestBase = RequestBase;
|
|
1588
|
+
var ExecutableRequest_1 = __webpack_require__(/*! ./ExecutableRequest */ "./src/Requests/ExecutableRequest.ts");
|
|
2455
1589
|
var GetRequest = /** @class */ (function (_super) {
|
|
2456
1590
|
tslib_1.__extends(GetRequest, _super);
|
|
2457
|
-
function GetRequest(
|
|
2458
|
-
return _super.call(this,
|
|
1591
|
+
function GetRequest(requestOptions, token, sdkOptions) {
|
|
1592
|
+
return _super.call(this, requestOptions, token, sdkOptions) || this;
|
|
2459
1593
|
}
|
|
2460
|
-
GetRequest.prototype.
|
|
2461
|
-
return
|
|
1594
|
+
GetRequest.prototype.getMethod = function () {
|
|
1595
|
+
return constants_1.HTTP_METHODS.get;
|
|
2462
1596
|
};
|
|
2463
1597
|
return GetRequest;
|
|
2464
|
-
}(
|
|
1598
|
+
}(ExecutableRequest_1.ExecutableRequest));
|
|
2465
1599
|
exports.GetRequest = GetRequest;
|
|
2466
1600
|
var GetByIdRequest = /** @class */ (function (_super) {
|
|
2467
1601
|
tslib_1.__extends(GetByIdRequest, _super);
|
|
2468
|
-
function GetByIdRequest(
|
|
2469
|
-
return _super.call(this,
|
|
1602
|
+
function GetByIdRequest(requestOptions, token, sdkOptions) {
|
|
1603
|
+
return _super.call(this, requestOptions, token, sdkOptions) || this;
|
|
2470
1604
|
}
|
|
2471
|
-
GetByIdRequest.prototype.
|
|
2472
|
-
return
|
|
1605
|
+
GetByIdRequest.prototype.getMethod = function () {
|
|
1606
|
+
return constants_1.HTTP_METHODS.get;
|
|
2473
1607
|
};
|
|
2474
1608
|
return GetByIdRequest;
|
|
2475
|
-
}(
|
|
1609
|
+
}(ExecutableRequest_1.ExecutableRequest));
|
|
2476
1610
|
exports.GetByIdRequest = GetByIdRequest;
|
|
2477
1611
|
var DeleteRequest = /** @class */ (function (_super) {
|
|
2478
1612
|
tslib_1.__extends(DeleteRequest, _super);
|
|
2479
|
-
function DeleteRequest(
|
|
2480
|
-
return _super.call(this,
|
|
1613
|
+
function DeleteRequest(requestOptions, token, sdkOptions) {
|
|
1614
|
+
return _super.call(this, requestOptions, token, sdkOptions) || this;
|
|
2481
1615
|
}
|
|
2482
|
-
DeleteRequest.prototype.
|
|
2483
|
-
return
|
|
1616
|
+
DeleteRequest.prototype.getMethod = function () {
|
|
1617
|
+
return constants_1.HTTP_METHODS.delete;
|
|
2484
1618
|
};
|
|
2485
1619
|
return DeleteRequest;
|
|
2486
|
-
}(
|
|
1620
|
+
}(ExecutableRequest_1.ExecutableRequest));
|
|
2487
1621
|
exports.DeleteRequest = DeleteRequest;
|
|
2488
1622
|
var UpdateRequest = /** @class */ (function (_super) {
|
|
2489
1623
|
tslib_1.__extends(UpdateRequest, _super);
|
|
2490
|
-
function UpdateRequest(
|
|
2491
|
-
var _this = _super.call(this,
|
|
2492
|
-
_this.
|
|
2493
|
-
_this.
|
|
1624
|
+
function UpdateRequest(requestOptions, token, sdkOptions) {
|
|
1625
|
+
var _this = _super.call(this, requestOptions, token, sdkOptions) || this;
|
|
1626
|
+
_this.data = requestOptions.data;
|
|
1627
|
+
_this.saveTemp = requestOptions.saveTemp;
|
|
2494
1628
|
return _this;
|
|
2495
1629
|
}
|
|
2496
|
-
UpdateRequest.prototype.
|
|
2497
|
-
return
|
|
1630
|
+
UpdateRequest.prototype.getMethod = function () {
|
|
1631
|
+
return constants_1.HTTP_METHODS.patch;
|
|
2498
1632
|
};
|
|
2499
|
-
UpdateRequest.prototype.
|
|
2500
|
-
var body = utils_1.utils.convertDateFieldToISOString(this.
|
|
1633
|
+
UpdateRequest.prototype.getBody = function () {
|
|
1634
|
+
var body = utils_1.utils.convertDateFieldToISOString(this.data);
|
|
2501
1635
|
return body;
|
|
2502
1636
|
};
|
|
2503
|
-
UpdateRequest.prototype.
|
|
2504
|
-
var headers =
|
|
2505
|
-
if (this.
|
|
2506
|
-
headers[
|
|
1637
|
+
UpdateRequest.prototype.getHeaders = function () {
|
|
1638
|
+
var headers = _super.prototype.getHeaders.call(this);
|
|
1639
|
+
if (this.saveTemp) {
|
|
1640
|
+
headers[constants_1.HEADER_NAMES.operation] = "SaveTemp";
|
|
2507
1641
|
}
|
|
2508
1642
|
return headers;
|
|
2509
1643
|
};
|
|
2510
1644
|
return UpdateRequest;
|
|
2511
|
-
}(
|
|
1645
|
+
}(ExecutableRequest_1.ExecutableRequest));
|
|
2512
1646
|
exports.UpdateRequest = UpdateRequest;
|
|
2513
1647
|
var CreateRequest = /** @class */ (function (_super) {
|
|
2514
1648
|
tslib_1.__extends(CreateRequest, _super);
|
|
2515
|
-
function CreateRequest(
|
|
2516
|
-
var _this = _super.call(this,
|
|
2517
|
-
_this.
|
|
1649
|
+
function CreateRequest(requestOptions, token, sdkOptions) {
|
|
1650
|
+
var _this = _super.call(this, requestOptions, token, sdkOptions) || this;
|
|
1651
|
+
_this.data = requestOptions.data;
|
|
2518
1652
|
return _this;
|
|
2519
1653
|
}
|
|
2520
|
-
CreateRequest.prototype.
|
|
2521
|
-
return
|
|
1654
|
+
CreateRequest.prototype.getMethod = function () {
|
|
1655
|
+
return constants_1.HTTP_METHODS.post;
|
|
2522
1656
|
};
|
|
2523
|
-
CreateRequest.prototype.
|
|
2524
|
-
var body = utils_1.utils.convertDateFieldToISOString(this.
|
|
1657
|
+
CreateRequest.prototype.getBody = function () {
|
|
1658
|
+
var body = utils_1.utils.convertDateFieldToISOString(this.data);
|
|
2525
1659
|
return body;
|
|
2526
1660
|
};
|
|
2527
1661
|
return CreateRequest;
|
|
2528
|
-
}(
|
|
1662
|
+
}(ExecutableRequest_1.ExecutableRequest));
|
|
2529
1663
|
exports.CreateRequest = CreateRequest;
|
|
2530
1664
|
var GetRelatedRequest = /** @class */ (function (_super) {
|
|
2531
1665
|
tslib_1.__extends(GetRelatedRequest, _super);
|
|
2532
|
-
function GetRelatedRequest(
|
|
2533
|
-
var _this = _super.call(this,
|
|
2534
|
-
_this.
|
|
1666
|
+
function GetRelatedRequest(requestOptions, token, sdkOptions) {
|
|
1667
|
+
var _this = _super.call(this, requestOptions, token, sdkOptions) || this;
|
|
1668
|
+
_this.property = requestOptions.property;
|
|
2535
1669
|
return _this;
|
|
2536
1670
|
}
|
|
2537
|
-
GetRelatedRequest.prototype.
|
|
2538
|
-
var url = this.urlOptions.baseUrl + this.urlOptions.entitySet + "(" + this.key + ")/" + this.
|
|
2539
|
-
return this.
|
|
1671
|
+
GetRelatedRequest.prototype.buildUrl = function () {
|
|
1672
|
+
var url = this.urlOptions.baseUrl + this.urlOptions.entitySet + "(" + this.key + ")/" + this.property;
|
|
1673
|
+
return this.addQueryParameters(url);
|
|
2540
1674
|
};
|
|
2541
1675
|
return GetRelatedRequest;
|
|
2542
1676
|
}(GetByIdRequest));
|
|
2543
1677
|
exports.GetRelatedRequest = GetRelatedRequest;
|
|
2544
1678
|
var GetRelatedByIdRequest = /** @class */ (function (_super) {
|
|
2545
1679
|
tslib_1.__extends(GetRelatedByIdRequest, _super);
|
|
2546
|
-
function GetRelatedByIdRequest(
|
|
2547
|
-
var _this = _super.call(this,
|
|
2548
|
-
_this.
|
|
2549
|
-
_this.
|
|
1680
|
+
function GetRelatedByIdRequest(requestOptions, token, sdkOptions) {
|
|
1681
|
+
var _this = _super.call(this, requestOptions, token, sdkOptions) || this;
|
|
1682
|
+
_this.property = requestOptions.property;
|
|
1683
|
+
_this.relatedId = requestOptions.relatedId;
|
|
2550
1684
|
return _this;
|
|
2551
1685
|
}
|
|
2552
|
-
GetRelatedByIdRequest.prototype.
|
|
2553
|
-
var url = this.urlOptions.baseUrl + this.urlOptions.entitySet + "(" + this.key + ")/" + this.
|
|
2554
|
-
return this.
|
|
1686
|
+
GetRelatedByIdRequest.prototype.buildUrl = function () {
|
|
1687
|
+
var url = this.urlOptions.baseUrl + this.urlOptions.entitySet + "(" + this.key + ")/" + this.property + "(" + this.relatedId + ")";
|
|
1688
|
+
return this.addQueryParameters(url);
|
|
2555
1689
|
};
|
|
2556
1690
|
return GetRelatedByIdRequest;
|
|
2557
1691
|
}(GetByIdRequest));
|
|
2558
1692
|
exports.GetRelatedByIdRequest = GetRelatedByIdRequest;
|
|
2559
1693
|
var DeleteRelatedRequest = /** @class */ (function (_super) {
|
|
2560
1694
|
tslib_1.__extends(DeleteRelatedRequest, _super);
|
|
2561
|
-
function DeleteRelatedRequest(
|
|
2562
|
-
var _this = _super.call(this,
|
|
2563
|
-
_this.
|
|
1695
|
+
function DeleteRelatedRequest(requestOptions, token, sdkOptions) {
|
|
1696
|
+
var _this = _super.call(this, requestOptions, token, sdkOptions) || this;
|
|
1697
|
+
_this.property = requestOptions.property;
|
|
2564
1698
|
return _this;
|
|
2565
1699
|
}
|
|
2566
|
-
DeleteRelatedRequest.prototype.
|
|
2567
|
-
var url = this.urlOptions.baseUrl + this.urlOptions.entitySet + "(" + this.key + ")/" + this.
|
|
2568
|
-
return this.
|
|
1700
|
+
DeleteRelatedRequest.prototype.buildUrl = function () {
|
|
1701
|
+
var url = this.urlOptions.baseUrl + this.urlOptions.entitySet + "(" + this.key + ")/" + this.property + "/$ref";
|
|
1702
|
+
return this.addQueryParameters(url);
|
|
2569
1703
|
};
|
|
2570
1704
|
return DeleteRelatedRequest;
|
|
2571
1705
|
}(DeleteRequest));
|
|
2572
1706
|
exports.DeleteRelatedRequest = DeleteRelatedRequest;
|
|
2573
1707
|
var DeleteRelatedByIdRequest = /** @class */ (function (_super) {
|
|
2574
1708
|
tslib_1.__extends(DeleteRelatedByIdRequest, _super);
|
|
2575
|
-
function DeleteRelatedByIdRequest(
|
|
2576
|
-
var _this = _super.call(this,
|
|
2577
|
-
_this.
|
|
2578
|
-
_this.
|
|
1709
|
+
function DeleteRelatedByIdRequest(requestOptions, token, sdkOptions) {
|
|
1710
|
+
var _this = _super.call(this, requestOptions, token, sdkOptions) || this;
|
|
1711
|
+
_this.property = requestOptions.property;
|
|
1712
|
+
_this.relatedId = requestOptions.relatedId;
|
|
2579
1713
|
return _this;
|
|
2580
1714
|
}
|
|
2581
|
-
DeleteRelatedByIdRequest.prototype.
|
|
2582
|
-
var url = this.urlOptions.baseUrl + this.urlOptions.entitySet + "(" + this.key + ")/" + this.
|
|
2583
|
-
return this.
|
|
1715
|
+
DeleteRelatedByIdRequest.prototype.buildUrl = function () {
|
|
1716
|
+
var url = this.urlOptions.baseUrl + this.urlOptions.entitySet + "(" + this.key + ")/" + this.property + "(" + this.relatedId + ")/$ref";
|
|
1717
|
+
return this.addQueryParameters(url);
|
|
2584
1718
|
};
|
|
2585
1719
|
return DeleteRelatedByIdRequest;
|
|
2586
1720
|
}(DeleteRequest));
|
|
2587
1721
|
exports.DeleteRelatedByIdRequest = DeleteRelatedByIdRequest;
|
|
2588
1722
|
var CreateRelatedRequest = /** @class */ (function (_super) {
|
|
2589
1723
|
tslib_1.__extends(CreateRelatedRequest, _super);
|
|
2590
|
-
function CreateRelatedRequest(
|
|
2591
|
-
var _this = _super.call(this,
|
|
2592
|
-
_this.
|
|
2593
|
-
_this.key =
|
|
1724
|
+
function CreateRelatedRequest(requestOptions, token, sdkOptions) {
|
|
1725
|
+
var _this = _super.call(this, requestOptions, token, sdkOptions) || this;
|
|
1726
|
+
_this.property = requestOptions.property;
|
|
1727
|
+
_this.key = requestOptions.key;
|
|
2594
1728
|
return _this;
|
|
2595
1729
|
}
|
|
2596
|
-
CreateRelatedRequest.prototype.
|
|
2597
|
-
var url = this.urlOptions.baseUrl + this.urlOptions.entitySet + "(" + this.key + ")/" + this.
|
|
2598
|
-
return this.
|
|
1730
|
+
CreateRelatedRequest.prototype.buildUrl = function () {
|
|
1731
|
+
var url = this.urlOptions.baseUrl + this.urlOptions.entitySet + "(" + this.key + ")/" + this.property + "/$ref";
|
|
1732
|
+
return this.addQueryParameters(url);
|
|
2599
1733
|
};
|
|
2600
1734
|
return CreateRelatedRequest;
|
|
2601
1735
|
}(CreateRequest));
|
|
2602
1736
|
exports.CreateRelatedRequest = CreateRelatedRequest;
|
|
2603
1737
|
var UploadRequest = /** @class */ (function (_super) {
|
|
2604
1738
|
tslib_1.__extends(UploadRequest, _super);
|
|
2605
|
-
function UploadRequest(
|
|
2606
|
-
var _this = _super.call(this,
|
|
2607
|
-
_this.fileName =
|
|
2608
|
-
_this.uploadProperties =
|
|
2609
|
-
_this.contentType =
|
|
1739
|
+
function UploadRequest(requestOptions, token, sdkOptions) {
|
|
1740
|
+
var _this = _super.call(this, requestOptions, token, sdkOptions) || this;
|
|
1741
|
+
_this.fileName = requestOptions.fileName;
|
|
1742
|
+
_this.uploadProperties = requestOptions.uploadProperties;
|
|
1743
|
+
_this.contentType = requestOptions.contentType;
|
|
2610
1744
|
return _this;
|
|
2611
1745
|
}
|
|
2612
|
-
UploadRequest.prototype.
|
|
2613
|
-
var headers = _super.prototype.
|
|
2614
|
-
headers[
|
|
2615
|
-
headers[
|
|
2616
|
-
headers[
|
|
2617
|
-
headers[
|
|
1746
|
+
UploadRequest.prototype.getHeaders = function () {
|
|
1747
|
+
var headers = _super.prototype.getHeaders.call(this);
|
|
1748
|
+
headers[constants_1.HEADER_NAMES.contentType] = this.contentType || "application/octet-stream";
|
|
1749
|
+
headers[constants_1.HEADER_NAMES.fileName] = this.fileName;
|
|
1750
|
+
headers[constants_1.HEADER_NAMES.properties] = JSON.stringify(this.uploadProperties);
|
|
1751
|
+
headers[constants_1.HEADER_NAMES.contentEncoding] = "identity";
|
|
2618
1752
|
return headers;
|
|
2619
1753
|
};
|
|
2620
|
-
UploadRequest.prototype.
|
|
2621
|
-
return this.
|
|
1754
|
+
UploadRequest.prototype.getBody = function () {
|
|
1755
|
+
return this.data;
|
|
2622
1756
|
};
|
|
2623
|
-
UploadRequest.prototype.
|
|
1757
|
+
UploadRequest.prototype.getMethod = function () {
|
|
2624
1758
|
if (this.key) {
|
|
2625
|
-
return
|
|
1759
|
+
return constants_1.HTTP_METHODS.patch;
|
|
2626
1760
|
}
|
|
2627
|
-
return
|
|
1761
|
+
return constants_1.HTTP_METHODS.post;
|
|
2628
1762
|
};
|
|
2629
1763
|
return UploadRequest;
|
|
2630
1764
|
}(CreateRequest));
|
|
2631
1765
|
exports.UploadRequest = UploadRequest;
|
|
2632
1766
|
|
|
2633
1767
|
|
|
1768
|
+
/***/ }),
|
|
1769
|
+
|
|
1770
|
+
/***/ "./src/Requests/RequestBase.ts":
|
|
1771
|
+
/*!*************************************!*\
|
|
1772
|
+
!*** ./src/Requests/RequestBase.ts ***!
|
|
1773
|
+
\*************************************/
|
|
1774
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1775
|
+
|
|
1776
|
+
|
|
1777
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1778
|
+
exports.RequestBase = void 0;
|
|
1779
|
+
var constants_1 = __webpack_require__(/*! ../constants */ "./src/constants.ts");
|
|
1780
|
+
var utils_1 = __webpack_require__(/*! ../utils */ "./src/utils.ts");
|
|
1781
|
+
var RequestBase = /** @class */ (function () {
|
|
1782
|
+
function RequestBase(options) {
|
|
1783
|
+
this.successCb = options.successCb;
|
|
1784
|
+
this.failureCb = options.failureCb;
|
|
1785
|
+
this.urlOptions = options.urlOptions;
|
|
1786
|
+
this.progressCb = options.progressCb;
|
|
1787
|
+
this.key = options.key;
|
|
1788
|
+
this.action = options.action;
|
|
1789
|
+
this.fallbackProperties = options.fallbackProperties;
|
|
1790
|
+
this.query = options.query;
|
|
1791
|
+
}
|
|
1792
|
+
RequestBase.prototype.getQueryString = function (urlOptions, query) {
|
|
1793
|
+
var paramDictionary = {};
|
|
1794
|
+
this.getQueryParameters(paramDictionary, urlOptions, query);
|
|
1795
|
+
var keys = Object.keys(paramDictionary);
|
|
1796
|
+
if (keys.length == 0)
|
|
1797
|
+
return null;
|
|
1798
|
+
var queryString = "?";
|
|
1799
|
+
for (var prop in paramDictionary) {
|
|
1800
|
+
queryString += prop + "=" + paramDictionary[prop] + "&";
|
|
1801
|
+
}
|
|
1802
|
+
queryString = queryString.substring(0, queryString.length - 1);
|
|
1803
|
+
return queryString;
|
|
1804
|
+
};
|
|
1805
|
+
RequestBase.prototype.getBody = function () {
|
|
1806
|
+
return undefined;
|
|
1807
|
+
};
|
|
1808
|
+
RequestBase.prototype.getMethod = function () {
|
|
1809
|
+
return null;
|
|
1810
|
+
};
|
|
1811
|
+
RequestBase.prototype.getHeaders = function () {
|
|
1812
|
+
var headers = {};
|
|
1813
|
+
headers[constants_1.HEADER_NAMES.contentType] = constants_1.CONTENT_TYPES.json;
|
|
1814
|
+
return headers;
|
|
1815
|
+
};
|
|
1816
|
+
RequestBase.prototype.buildUrl = function () {
|
|
1817
|
+
var url = this.urlOptions.baseUrl + (this.urlOptions.entitySet || "");
|
|
1818
|
+
url += this.key ? ("(" + this.key + ")") : "";
|
|
1819
|
+
if (this.action) {
|
|
1820
|
+
url += url.endsWith("/") ? "" : "/";
|
|
1821
|
+
url += this.action;
|
|
1822
|
+
}
|
|
1823
|
+
// including count here
|
|
1824
|
+
// not the best solution as build() is called once more in getQueryString
|
|
1825
|
+
// but not that big of an issue right now
|
|
1826
|
+
if (this.query) {
|
|
1827
|
+
var getCount = this.query.build().$count;
|
|
1828
|
+
if (utils_1.utils.isBoolean(getCount) && !getCount) {
|
|
1829
|
+
url += "/$count";
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
return this.addQueryParameters(url);
|
|
1833
|
+
};
|
|
1834
|
+
RequestBase.prototype.parseResponse = function (http) {
|
|
1835
|
+
var data = utils_1.utils.parseStringToJson(http.responseText);
|
|
1836
|
+
if (data) {
|
|
1837
|
+
if (http.status >= 400 && data.error) {
|
|
1838
|
+
return data.error;
|
|
1839
|
+
}
|
|
1840
|
+
return data;
|
|
1841
|
+
}
|
|
1842
|
+
return http.responseText;
|
|
1843
|
+
};
|
|
1844
|
+
RequestBase.prototype.addQueryParameters = function (url) {
|
|
1845
|
+
var queryString = this.getQueryString(this.urlOptions, this.query);
|
|
1846
|
+
if (queryString) {
|
|
1847
|
+
if (url.indexOf("?") > -1 && queryString[0] == "?") {
|
|
1848
|
+
queryString = "&" + queryString.substring(1);
|
|
1849
|
+
}
|
|
1850
|
+
url += queryString;
|
|
1851
|
+
}
|
|
1852
|
+
return url;
|
|
1853
|
+
};
|
|
1854
|
+
RequestBase.prototype.getQueryParameters = function (paramDictionary, urlOptions, query) {
|
|
1855
|
+
if (query) {
|
|
1856
|
+
var builtQuery = query.build();
|
|
1857
|
+
if (utils_1.utils.isString(builtQuery.$filter))
|
|
1858
|
+
paramDictionary[constants_1.ODATA_PARAMS.$filter] = builtQuery.$filter;
|
|
1859
|
+
if (utils_1.utils.isString(builtQuery.$select))
|
|
1860
|
+
paramDictionary[constants_1.ODATA_PARAMS.$select] = builtQuery.$select;
|
|
1861
|
+
if (utils_1.utils.isString(builtQuery.$expand))
|
|
1862
|
+
paramDictionary[constants_1.ODATA_PARAMS.$expand] = builtQuery.$expand;
|
|
1863
|
+
if (utils_1.utils.isString(builtQuery.$orderby))
|
|
1864
|
+
paramDictionary[constants_1.ODATA_PARAMS.$orderby] = builtQuery.$orderby;
|
|
1865
|
+
if (utils_1.utils.isNumber(builtQuery.$skip))
|
|
1866
|
+
paramDictionary[constants_1.ODATA_PARAMS.$skip] = builtQuery.$skip;
|
|
1867
|
+
if (utils_1.utils.isNumber(builtQuery.$top))
|
|
1868
|
+
paramDictionary[constants_1.ODATA_PARAMS.$top] = builtQuery.$top;
|
|
1869
|
+
if (utils_1.utils.isString(builtQuery.$search))
|
|
1870
|
+
paramDictionary[constants_1.ODATA_PARAMS.$search] = builtQuery.$search;
|
|
1871
|
+
// inline count
|
|
1872
|
+
if (utils_1.utils.isBoolean(builtQuery.$count) && builtQuery.$count)
|
|
1873
|
+
paramDictionary[constants_1.ODATA_PARAMS.$count] = builtQuery.$count;
|
|
1874
|
+
}
|
|
1875
|
+
if (urlOptions.provider) {
|
|
1876
|
+
paramDictionary[constants_1.SF_PARAMS.provider] = urlOptions.provider;
|
|
1877
|
+
}
|
|
1878
|
+
if (urlOptions.culture) {
|
|
1879
|
+
paramDictionary[constants_1.SF_PARAMS.culture] = urlOptions.culture;
|
|
1880
|
+
}
|
|
1881
|
+
if (urlOptions.siteId) {
|
|
1882
|
+
paramDictionary[constants_1.SF_PARAMS.siteId] = urlOptions.siteId;
|
|
1883
|
+
}
|
|
1884
|
+
if (this.fallbackProperties) {
|
|
1885
|
+
paramDictionary[constants_1.SF_PARAMS.fallbackParams] = this.fallbackProperties.join();
|
|
1886
|
+
}
|
|
1887
|
+
if (urlOptions.additionalQueryParams) {
|
|
1888
|
+
for (var key in urlOptions.additionalQueryParams) {
|
|
1889
|
+
if (urlOptions.additionalQueryParams.hasOwnProperty(key)) {
|
|
1890
|
+
paramDictionary[key] = urlOptions.additionalQueryParams[key];
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
}
|
|
1894
|
+
};
|
|
1895
|
+
return RequestBase;
|
|
1896
|
+
}());
|
|
1897
|
+
exports.RequestBase = RequestBase;
|
|
1898
|
+
|
|
1899
|
+
|
|
2634
1900
|
/***/ }),
|
|
2635
1901
|
|
|
2636
1902
|
/***/ "./src/Requests/RequestFactory.ts":
|
|
2637
1903
|
/*!****************************************!*\
|
|
2638
1904
|
!*** ./src/Requests/RequestFactory.ts ***!
|
|
2639
1905
|
\****************************************/
|
|
2640
|
-
|
|
2641
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1906
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2642
1907
|
|
|
2643
|
-
"use strict";
|
|
2644
1908
|
|
|
2645
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1909
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1910
|
+
exports.RequestFactory = void 0;
|
|
2646
1911
|
var Request_1 = __webpack_require__(/*! ./Request */ "./src/Requests/Request.ts");
|
|
2647
|
-
var
|
|
2648
|
-
var BatchRequest = __webpack_require__(/*! ./BatchRequest */ "./src/Requests/BatchRequest.ts");
|
|
1912
|
+
var BatchRequest_1 = __webpack_require__(/*! ./BatchRequest */ "./src/Requests/BatchRequest.ts");
|
|
2649
1913
|
var RequestFactory = /** @class */ (function () {
|
|
2650
1914
|
function RequestFactory(options) {
|
|
2651
|
-
this.
|
|
2652
|
-
this.handlers = options.handlers;
|
|
2653
|
-
this.enableUnlimitedChoices = options.enableUnlimitedChoices;
|
|
2654
|
-
this.integrationMode = options.integrationMode;
|
|
1915
|
+
this.options = options;
|
|
2655
1916
|
}
|
|
2656
1917
|
RequestFactory.prototype.get = function (parameters) {
|
|
2657
|
-
return
|
|
1918
|
+
return new Request_1.GetRequest(parameters, this.token, this.options);
|
|
2658
1919
|
};
|
|
2659
1920
|
RequestFactory.prototype.getSingle = function (parameters) {
|
|
2660
|
-
return
|
|
1921
|
+
return new Request_1.GetByIdRequest(parameters, this.token, this.options);
|
|
2661
1922
|
};
|
|
2662
1923
|
RequestFactory.prototype.create = function (parameters) {
|
|
2663
|
-
return
|
|
1924
|
+
return new Request_1.CreateRequest(parameters, this.token, this.options);
|
|
2664
1925
|
};
|
|
2665
1926
|
RequestFactory.prototype.update = function (parameters) {
|
|
2666
|
-
return
|
|
1927
|
+
return new Request_1.UpdateRequest(parameters, this.token, this.options);
|
|
2667
1928
|
};
|
|
2668
1929
|
RequestFactory.prototype.destroy = function (parameters) {
|
|
2669
|
-
return
|
|
1930
|
+
return new Request_1.DeleteRequest(parameters, this.token, this.options);
|
|
2670
1931
|
};
|
|
2671
1932
|
RequestFactory.prototype.getProperty = function (parameters) {
|
|
2672
|
-
return
|
|
1933
|
+
return new Request_1.GetRelatedRequest(parameters, this.token, this.options);
|
|
2673
1934
|
};
|
|
2674
1935
|
RequestFactory.prototype.getRelated = function (parameters) {
|
|
2675
|
-
return
|
|
1936
|
+
return new Request_1.GetRelatedRequest(parameters, this.token, this.options);
|
|
2676
1937
|
};
|
|
2677
1938
|
RequestFactory.prototype.getRelatedById = function (parameters) {
|
|
2678
|
-
return
|
|
1939
|
+
return new Request_1.GetRelatedByIdRequest(parameters, this.token, this.options);
|
|
2679
1940
|
};
|
|
2680
1941
|
RequestFactory.prototype.destroyRelated = function (parameters) {
|
|
2681
|
-
return
|
|
1942
|
+
return new Request_1.DeleteRelatedRequest(parameters, this.token, this.options);
|
|
2682
1943
|
};
|
|
2683
1944
|
RequestFactory.prototype.destroyRelatedById = function (parameters) {
|
|
2684
|
-
return
|
|
1945
|
+
return new Request_1.DeleteRelatedByIdRequest(parameters, this.token, this.options);
|
|
2685
1946
|
};
|
|
2686
1947
|
RequestFactory.prototype.createRelated = function (parameters) {
|
|
2687
|
-
return
|
|
2688
|
-
};
|
|
2689
|
-
RequestFactory.prototype.batch = function (parameters) {
|
|
2690
|
-
parameters._factory = this;
|
|
2691
|
-
return new BatchRequest(parameters);
|
|
1948
|
+
return new Request_1.CreateRelatedRequest(parameters, this.token, this.options);
|
|
2692
1949
|
};
|
|
2693
1950
|
RequestFactory.prototype.upload = function (parameters) {
|
|
2694
|
-
return
|
|
2695
|
-
};
|
|
2696
|
-
RequestFactory.prototype.
|
|
2697
|
-
var
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
token: this.token,
|
|
2701
|
-
enableUnlimitedChoices: this.enableUnlimitedChoices,
|
|
2702
|
-
integrationMode: this.integrationMode
|
|
2703
|
-
});
|
|
2704
|
-
// TODO
|
|
2705
|
-
executor.navigationProperty = request.navigationProperty;
|
|
2706
|
-
return executor;
|
|
1951
|
+
return new Request_1.UploadRequest(parameters, this.token, this.options);
|
|
1952
|
+
};
|
|
1953
|
+
RequestFactory.prototype.batch = function (parameters) {
|
|
1954
|
+
var batchParams = parameters;
|
|
1955
|
+
batchParams.factory = this;
|
|
1956
|
+
return new BatchRequest_1.BatchRequest(batchParams, this.token, this.options);
|
|
2707
1957
|
};
|
|
2708
1958
|
return RequestFactory;
|
|
2709
1959
|
}());
|
|
@@ -2716,170 +1966,57 @@ exports.RequestFactory = RequestFactory;
|
|
|
2716
1966
|
/*!***************************!*\
|
|
2717
1967
|
!*** ./src/Sitefinity.ts ***!
|
|
2718
1968
|
\***************************/
|
|
2719
|
-
|
|
2720
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1969
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2721
1970
|
|
|
2722
|
-
"use strict";
|
|
2723
1971
|
|
|
2724
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1972
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1973
|
+
exports.Sitefinity = void 0;
|
|
2725
1974
|
var RequestFactory_1 = __webpack_require__(/*! ./Requests/RequestFactory */ "./src/Requests/RequestFactory.ts");
|
|
2726
|
-
var Authentication_1 = __webpack_require__(/*! ./Authentication */ "./src/Authentication.ts");
|
|
2727
1975
|
var Data_1 = __webpack_require__(/*! ./Data */ "./src/Data.ts");
|
|
2728
1976
|
var Query_1 = __webpack_require__(/*! ./Query */ "./src/Query.ts");
|
|
2729
1977
|
var utils_1 = __webpack_require__(/*! ./utils */ "./src/utils.ts");
|
|
2730
|
-
/**
|
|
2731
|
-
* @class Sitefinity
|
|
2732
|
-
* @classdesc The constructor of the Sitefinity JavaScript SDK. This is the entry point for the SDK.
|
|
2733
|
-
* @property {Object} authentication - The authentication object used for authenticating to Sitefinity. See {@link Authentication}
|
|
2734
|
-
* @param {object} options - An object containing configuration options for the Setup object.
|
|
2735
|
-
* @param {string} options.serviceUrl - Your service url that points to the configured instance of Sitefinity service.
|
|
2736
|
-
* @param {string} options.siteId - The ID of the site, for which the query will be executed.
|
|
2737
|
-
* @param {string} options.handlers - The global handlers for request execution
|
|
2738
|
-
* @param {string} options.handlers.successCb - The success handler.
|
|
2739
|
-
* @param {string} options.handlers.failureCb - The failure handler.
|
|
2740
|
-
*/
|
|
2741
1978
|
var Sitefinity = /** @class */ (function () {
|
|
1979
|
+
/**
|
|
1980
|
+
* The constructor of the Sitefinity JavaScript SDK. This is the entry point for the SDK.
|
|
1981
|
+
*/
|
|
2742
1982
|
function Sitefinity(options) {
|
|
2743
|
-
this.
|
|
1983
|
+
this.baseUrl = options.baseUrl;
|
|
2744
1984
|
this.siteId = options.siteId;
|
|
2745
|
-
this.factory = new RequestFactory_1.RequestFactory(
|
|
2746
|
-
handlers: options.handlers,
|
|
2747
|
-
enableUnlimitedChoices: options.enableUnlimitedChoices,
|
|
2748
|
-
integrationMode: options.integrationMode
|
|
2749
|
-
});
|
|
2750
|
-
this.authentication = new Authentication_1.Authentication({
|
|
2751
|
-
serviceUrl: this.profileUrl,
|
|
2752
|
-
factory: this.factory
|
|
2753
|
-
});
|
|
1985
|
+
this.factory = new RequestFactory_1.RequestFactory(options);
|
|
2754
1986
|
}
|
|
2755
|
-
/**
|
|
2756
|
-
* Creates a new {@link Data} class.
|
|
2757
|
-
* @memberOf Sitefinity
|
|
2758
|
-
* @instance
|
|
2759
|
-
* @param {object} options - An object containing configuration options for the Setup object.
|
|
2760
|
-
* @param {string} options.urlName - The URL name of the type..
|
|
2761
|
-
* @param {string} [options.providerName] - The name of the provider. If empty the default provider for the site will be used.
|
|
2762
|
-
* @param {string} [options.cultureName] - The name of the culture. If empty the default culture for the site will be used.
|
|
2763
|
-
* @example
|
|
2764
|
-
* var data = sf.data({
|
|
2765
|
-
* urlName: "newsitems",
|
|
2766
|
-
* providerName: "OpenAccessDataProvider",
|
|
2767
|
-
* cultureName: "en"
|
|
2768
|
-
* });
|
|
2769
|
-
* @returns {Data}
|
|
2770
|
-
*/
|
|
2771
1987
|
Sitefinity.prototype.data = function (options) {
|
|
2772
|
-
var
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
culture: options.cultureName,
|
|
2778
|
-
siteId: options.siteId || this.siteId
|
|
2779
|
-
},
|
|
1988
|
+
var urlOptions = {
|
|
1989
|
+
baseUrl: utils_1.utils.addTrailingSlash(options.baseUrl || this.baseUrl),
|
|
1990
|
+
provider: options.provider,
|
|
1991
|
+
culture: options.culture,
|
|
1992
|
+
siteId: options.siteId || this.siteId,
|
|
2780
1993
|
additionalQueryParams: options.additionalQueryParams,
|
|
2781
|
-
entitySet: options.
|
|
1994
|
+
entitySet: options.entitySet
|
|
2782
1995
|
};
|
|
2783
|
-
|
|
2784
|
-
return new Data_1.Data(dataOptions, this.factory);
|
|
1996
|
+
return new Data_1.Data(urlOptions, this.factory);
|
|
2785
1997
|
};
|
|
2786
|
-
/**
|
|
2787
|
-
* Creates a new {@link BatchRequest} class. OData batch requests -> {@link http://docs.oasis-open.org/odata/odata/v4.0/os/part1-protocol/odata-v4.0-os-part1-protocol.html#_Toc372793748}
|
|
2788
|
-
* @memberOf Sitefinity
|
|
2789
|
-
* @instance
|
|
2790
|
-
* @param {Function} success - The success callback of the batch execution.
|
|
2791
|
-
* @param {string} options.urlName - The URL name of the type..
|
|
2792
|
-
* @param {string} [options.providerName] - The name of the provider. If empty the default provider for the site will be used.
|
|
2793
|
-
* @param {string} [options.cultureName] - The name of the culture. If empty the default culture for the site will be used.
|
|
2794
|
-
* @example
|
|
2795
|
-
* var sf = new Sitefinity({
|
|
2796
|
-
* serviceUrl: 'http://mydomain/route/service/'
|
|
2797
|
-
* });
|
|
2798
|
-
*
|
|
2799
|
-
* var batch = sf.batch(successCbBatch, failureCb);
|
|
2800
|
-
* batch.get({
|
|
2801
|
-
* entitySet: entitySet,
|
|
2802
|
-
* query: query8
|
|
2803
|
-
* });
|
|
2804
|
-
*
|
|
2805
|
-
* var transaction = batch.beginTransaction();
|
|
2806
|
-
* var createId = transaction.create({
|
|
2807
|
-
* entitySet: entitySet,
|
|
2808
|
-
* data: newsItem
|
|
2809
|
-
* });
|
|
2810
|
-
*
|
|
2811
|
-
* batch.endTransaction(transaction);
|
|
2812
|
-
*
|
|
2813
|
-
* var transaction2 = batch.beginTransaction();
|
|
2814
|
-
* var createId2 = transaction2.create({
|
|
2815
|
-
* entitySet: entitySet,
|
|
2816
|
-
* data: newsItem
|
|
2817
|
-
* });
|
|
2818
|
-
*
|
|
2819
|
-
* var updateId2 = transaction2.update({
|
|
2820
|
-
* entitySet: entitySet,
|
|
2821
|
-
* key: createId2,
|
|
2822
|
-
* data: newsItemUpdate
|
|
2823
|
-
* });
|
|
2824
|
-
*
|
|
2825
|
-
* batch.endTransaction(transaction2);
|
|
2826
|
-
*
|
|
2827
|
-
* batch.get({
|
|
2828
|
-
* entitySet: entitySet
|
|
2829
|
-
* });
|
|
2830
|
-
*
|
|
2831
|
-
* batch.execute();
|
|
2832
|
-
* @returns {BatchRequest}
|
|
2833
|
-
*/
|
|
2834
1998
|
Sitefinity.prototype.batch = function (success, failure, progress, options) {
|
|
2835
|
-
if (typeof progress !== 'function') {
|
|
2836
|
-
options = progress;
|
|
2837
|
-
progress = null;
|
|
2838
|
-
}
|
|
2839
1999
|
if (!options)
|
|
2840
2000
|
options = {};
|
|
2841
|
-
this.factory.token = this.authentication.getToken();
|
|
2842
|
-
var optionsServiceUrl = options.serviceUrl ? utils_1.utils.addTrailingSlash(options.serviceUrl) : options.serviceUrl;
|
|
2843
2001
|
var batch = this.factory.batch({
|
|
2844
2002
|
successCb: success,
|
|
2845
2003
|
failureCb: failure,
|
|
2846
2004
|
progressCb: progress,
|
|
2847
2005
|
urlOptions: {
|
|
2848
|
-
baseUrl:
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
siteId: options.siteId || this.siteId
|
|
2853
|
-
},
|
|
2006
|
+
baseUrl: utils_1.utils.addTrailingSlash(options.baseUrl || this.baseUrl),
|
|
2007
|
+
provider: options.provider,
|
|
2008
|
+
culture: options.culture,
|
|
2009
|
+
siteId: options.siteId || this.siteId,
|
|
2854
2010
|
additionalQueryParams: options.additionalQueryParams
|
|
2855
2011
|
}
|
|
2856
2012
|
});
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
executor.get = function (options) {
|
|
2865
|
-
batch.constructor.prototype.get.call(batch, options);
|
|
2866
|
-
};
|
|
2867
|
-
executor.getOperations = function (options) {
|
|
2868
|
-
batch.constructor.prototype.getOperations.call(batch, options);
|
|
2869
|
-
};
|
|
2870
|
-
executor.getSingle = function (options) {
|
|
2871
|
-
batch.constructor.prototype.getSingle.call(batch, options);
|
|
2872
|
-
};
|
|
2873
|
-
executor.getProperty = function (options) {
|
|
2874
|
-
batch.constructor.prototype.getProperty.call(batch, options);
|
|
2875
|
-
};
|
|
2876
|
-
executor.getRelated = function (options) {
|
|
2877
|
-
batch.constructor.prototype.getRelated.call(batch, options);
|
|
2878
|
-
};
|
|
2879
|
-
executor.getRelatedById = function (options) {
|
|
2880
|
-
batch.constructor.prototype.getRelatedById.call(batch, options);
|
|
2881
|
-
};
|
|
2882
|
-
return executor;
|
|
2013
|
+
return batch;
|
|
2014
|
+
};
|
|
2015
|
+
/**
|
|
2016
|
+
* Sets the authentication token.
|
|
2017
|
+
*/
|
|
2018
|
+
Sitefinity.prototype.setToken = function (token) {
|
|
2019
|
+
this.factory.token = token;
|
|
2883
2020
|
};
|
|
2884
2021
|
Sitefinity.Query = Query_1.Query;
|
|
2885
2022
|
return Sitefinity;
|
|
@@ -2893,198 +2030,129 @@ exports.Sitefinity = Sitefinity;
|
|
|
2893
2030
|
/*!***************************!*\
|
|
2894
2031
|
!*** ./src/WhereQuery.ts ***!
|
|
2895
2032
|
\***************************/
|
|
2896
|
-
|
|
2897
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2033
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2898
2034
|
|
|
2899
|
-
"use strict";
|
|
2900
2035
|
|
|
2901
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2036
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2037
|
+
exports.WhereQuery = void 0;
|
|
2902
2038
|
var Expression_1 = __webpack_require__(/*! ./Expression */ "./src/Expression.ts");
|
|
2903
|
-
var
|
|
2039
|
+
var constants_1 = __webpack_require__(/*! ./constants */ "./src/constants.ts");
|
|
2904
2040
|
/**
|
|
2905
|
-
*
|
|
2906
|
-
* @class WhereQuery
|
|
2907
|
-
* @protected
|
|
2041
|
+
* A fluent API operation for creating a filter for a query by chaining different rules.
|
|
2908
2042
|
*/
|
|
2909
2043
|
var WhereQuery = /** @class */ (function () {
|
|
2910
2044
|
function WhereQuery(parent, type) {
|
|
2911
|
-
if (type === void 0) { type =
|
|
2045
|
+
if (type === void 0) { type = constants_1.EXPRESSION_TYPE.and; }
|
|
2912
2046
|
this.parent = parent;
|
|
2913
2047
|
this.expression = new Expression_1.ComplexExpression(type, []);
|
|
2914
2048
|
}
|
|
2915
2049
|
/**
|
|
2916
2050
|
* Adds an `and` clause to the current condition and returns it for further chaining.
|
|
2917
|
-
* @method and
|
|
2918
|
-
* @memberOf WhereQuery.prototype
|
|
2919
|
-
* @returns {WhereQuery}
|
|
2920
2051
|
*/
|
|
2921
2052
|
WhereQuery.prototype.and = function () {
|
|
2922
|
-
return new WhereQuery(this,
|
|
2053
|
+
return new WhereQuery(this, constants_1.EXPRESSION_TYPE.and);
|
|
2923
2054
|
};
|
|
2924
2055
|
/**
|
|
2925
2056
|
* Adds an `or` clause to the current condition and returns it for further chaining.
|
|
2926
|
-
* @method or
|
|
2927
|
-
* @memberOf WhereQuery.prototype
|
|
2928
|
-
* @returns {WhereQuery}
|
|
2929
2057
|
*/
|
|
2930
2058
|
WhereQuery.prototype.or = function () {
|
|
2931
|
-
return new WhereQuery(this,
|
|
2059
|
+
return new WhereQuery(this, constants_1.EXPRESSION_TYPE.or);
|
|
2932
2060
|
};
|
|
2933
2061
|
/**
|
|
2934
2062
|
* Adds an `any` clause to the current condition and returns it for further chaining.
|
|
2935
|
-
* @method any
|
|
2936
|
-
* @memberOf WhereQuery.prototype
|
|
2937
|
-
* @returns {WhereQuery}
|
|
2938
2063
|
*/
|
|
2939
2064
|
WhereQuery.prototype.any = function () {
|
|
2940
|
-
return new WhereQuery(this,
|
|
2065
|
+
return new WhereQuery(this, constants_1.EXPRESSION_TYPE.any);
|
|
2941
2066
|
};
|
|
2942
2067
|
/**
|
|
2943
2068
|
* Adds a `not` clause to the current condition and returns it for further chaining.
|
|
2944
|
-
* @method not
|
|
2945
|
-
* @memberOf WhereQuery.prototype
|
|
2946
|
-
* @returns {WhereQuery}
|
|
2947
2069
|
*/
|
|
2948
2070
|
WhereQuery.prototype.not = function () {
|
|
2949
|
-
return new WhereQuery(this,
|
|
2950
|
-
};
|
|
2951
|
-
WhereQuery.prototype._simple = function (type, parameter, constant, caseSensitive) {
|
|
2952
|
-
if (caseSensitive === void 0) { caseSensitive = true; }
|
|
2953
|
-
var currentExpr = new Expression_1.BinaryExpression(type, parameter, constant, caseSensitive);
|
|
2954
|
-
var subExpressions = this.expression.getExpressions();
|
|
2955
|
-
subExpressions.push(currentExpr);
|
|
2956
|
-
if (this.expression.getType() === OperatorType.not && subExpressions.length > 1)
|
|
2957
|
-
throw new Error("Invalid operators count!");
|
|
2958
|
-
return this;
|
|
2071
|
+
return new WhereQuery(this, constants_1.EXPRESSION_TYPE.not);
|
|
2959
2072
|
};
|
|
2960
2073
|
/**
|
|
2961
2074
|
* Adds a condition that a field must be equal to a specific value.
|
|
2962
|
-
* @method eq
|
|
2963
|
-
* @memberOf WhereQuery.prototype
|
|
2964
|
-
* @param {string} field Field name.
|
|
2965
|
-
* @param {*} value Comparison value (to which the fields must be equal).
|
|
2966
|
-
* @returns {WhereQuery}
|
|
2967
2075
|
*/
|
|
2968
2076
|
WhereQuery.prototype.eq = function (parameter, constant) {
|
|
2969
|
-
return this.
|
|
2077
|
+
return this.simple(constants_1.EXPRESSION_TYPE.eq, parameter, constant);
|
|
2970
2078
|
};
|
|
2971
2079
|
/**
|
|
2972
2080
|
* Adds a condition that a field must *not* be equal to a specific value.
|
|
2973
|
-
* @method ne
|
|
2974
|
-
* @memberOf WhereQuery.prototype
|
|
2975
|
-
* @param {string} field Field name.
|
|
2976
|
-
* @param {*} value Comparison value (to which the field must not be equal).
|
|
2977
|
-
* @returns {WhereQuery}
|
|
2978
2081
|
*/
|
|
2979
2082
|
WhereQuery.prototype.ne = function (parameter, constant) {
|
|
2980
|
-
return this.
|
|
2083
|
+
return this.simple(constants_1.EXPRESSION_TYPE.ne, parameter, constant);
|
|
2981
2084
|
};
|
|
2982
2085
|
/**
|
|
2983
2086
|
* Adds a condition that a field must be `greater than` a certain value. Applicable to Number, String, and Date fields.
|
|
2984
|
-
* @method gt
|
|
2985
|
-
* @memberOf WhereQuery.prototype
|
|
2986
|
-
* @param {string} field Field name.
|
|
2987
|
-
* @param {*} value Comparison value (that the field should be greater than).
|
|
2988
|
-
* @returns {WhereQuery}
|
|
2989
2087
|
*/
|
|
2990
2088
|
WhereQuery.prototype.gt = function (parameter, constant) {
|
|
2991
|
-
return this.
|
|
2089
|
+
return this.simple(constants_1.EXPRESSION_TYPE.gt, parameter, constant);
|
|
2992
2090
|
};
|
|
2993
2091
|
/**
|
|
2994
2092
|
* Adds a condition that a field must be `greater than or equal` to a certain value. Applicable to Number, String, and Date fields.
|
|
2995
|
-
* @method gte
|
|
2996
|
-
* @memberOf WhereQuery.prototype
|
|
2997
|
-
* @param {string} field Field name.
|
|
2998
|
-
* @param {*} value Comparison value (that the field should be greater than or equal to).
|
|
2999
|
-
* @returns {WhereQuery}
|
|
3000
2093
|
*/
|
|
3001
2094
|
WhereQuery.prototype.gte = function (parameter, constant) {
|
|
3002
|
-
return this.
|
|
2095
|
+
return this.simple(constants_1.EXPRESSION_TYPE.ge, parameter, constant);
|
|
3003
2096
|
};
|
|
3004
2097
|
/**
|
|
3005
2098
|
* Adds a condition that a field must be `less than` a certain value. Applicable to Number, String, and Date fields.
|
|
3006
|
-
* @method lt
|
|
3007
|
-
* @memberOf WhereQuery.prototype
|
|
3008
|
-
* @param {string} field Field name.
|
|
3009
|
-
* @param {*} value Comparison value (that the field should be less than).
|
|
3010
|
-
* @returns {WhereQuery}
|
|
3011
2099
|
*/
|
|
3012
2100
|
WhereQuery.prototype.lt = function (parameter, constant) {
|
|
3013
|
-
return this.
|
|
2101
|
+
return this.simple(constants_1.EXPRESSION_TYPE.lt, parameter, constant);
|
|
3014
2102
|
};
|
|
3015
2103
|
/**
|
|
3016
2104
|
* Adds a condition that a field must be `less than or equal` to a certain value. Applicable to Number, String, and Date fields.
|
|
3017
|
-
* @method lte
|
|
3018
|
-
* @memberOf WhereQuery.prototype
|
|
3019
|
-
* @param {string} field Field name.
|
|
3020
|
-
* @param {*} value Comparison value (that the field should be less than or equal to).
|
|
3021
|
-
* @returns {WhereQuery}
|
|
3022
2105
|
*/
|
|
3023
2106
|
WhereQuery.prototype.lte = function (parameter, constant) {
|
|
3024
|
-
return this.
|
|
2107
|
+
return this.simple(constants_1.EXPRESSION_TYPE.le, parameter, constant);
|
|
3025
2108
|
};
|
|
3026
2109
|
/**
|
|
3027
2110
|
* Adds a condition that a field value must *start* with a specified string.
|
|
3028
|
-
* @method startsWith
|
|
3029
|
-
* @memberOf WhereQuery.prototype
|
|
3030
|
-
* @param {string} field Field name.
|
|
3031
|
-
* @param {string} value The string that the field should start with.
|
|
3032
|
-
* @param {boolean} caseSensitive A flag indicating if tolower should be applied to the parameter
|
|
3033
|
-
* @param {string} [options] A string of regex options to use. See [specs](http://docs.mongodb.org/manual/reference/operator/query/regex/#op._S_options) for a description of available options.
|
|
3034
|
-
* @returns {WhereQuery}
|
|
3035
2111
|
*/
|
|
3036
2112
|
WhereQuery.prototype.startsWith = function (parameter, constant, caseSensitive) {
|
|
3037
2113
|
if (caseSensitive === void 0) { caseSensitive = true; }
|
|
3038
|
-
return this.
|
|
2114
|
+
return this.simple(constants_1.EXPRESSION_TYPE.startsWith, parameter, constant, caseSensitive);
|
|
3039
2115
|
};
|
|
3040
2116
|
/**
|
|
3041
2117
|
* Adds a condition that a field value must *contain* a specified string.
|
|
3042
|
-
* @method startsWith
|
|
3043
|
-
* @memberOf WhereQuery.prototype
|
|
3044
|
-
* @param {string} field Field name.
|
|
3045
|
-
* @param {string} value The string that the field should start with.
|
|
3046
|
-
* @param {boolean} caseSensitive A flag indicating if tolower should be applied to the parameter
|
|
3047
|
-
* @param {string} [options] A string of regex options to use. See [specs](http://docs.mongodb.org/manual/reference/operator/query/regex/#op._S_options) for a description of available options.
|
|
3048
|
-
* @returns {WhereQuery}
|
|
3049
2118
|
*/
|
|
3050
2119
|
WhereQuery.prototype.contains = function (parameter, constant, caseSensitive) {
|
|
3051
2120
|
if (caseSensitive === void 0) { caseSensitive = true; }
|
|
3052
|
-
return this.
|
|
2121
|
+
return this.simple(constants_1.EXPRESSION_TYPE.contains, parameter, constant, caseSensitive);
|
|
3053
2122
|
};
|
|
3054
2123
|
/**
|
|
3055
2124
|
* Adds a condition that a field value must *end* with a specified string.
|
|
3056
|
-
* @method endsWith
|
|
3057
|
-
* @memberOf WhereQuery.prototype
|
|
3058
|
-
* @param {string} field Field name.
|
|
3059
|
-
* @param {string} value The string that the field should end with.
|
|
3060
|
-
* @param {boolean} caseSensitive A flag indicating if tolower should be applied to the parameter
|
|
3061
|
-
* @param {string} [options] A string of regex options to use. See [specs](http://docs.mongodb.org/manual/reference/operator/query/regex/#op._S_options) for a description of available options.
|
|
3062
|
-
* @returns {WhereQuery}
|
|
3063
2125
|
*/
|
|
3064
2126
|
WhereQuery.prototype.endsWith = function (parameter, constant, caseSensitive) {
|
|
3065
2127
|
if (caseSensitive === void 0) { caseSensitive = true; }
|
|
3066
|
-
return this.
|
|
2128
|
+
return this.simple(constants_1.EXPRESSION_TYPE.endsWith, parameter, constant, caseSensitive);
|
|
3067
2129
|
};
|
|
3068
2130
|
/**
|
|
3069
2131
|
* Ends the definition of the current WhereQuery. You need to call this method in order to continue with the definition of the parent {@link QueryBase}. All other `WhereQuery` methods return the current instance of `WhereQuery` to allow chaining.
|
|
3070
|
-
* @method done
|
|
3071
|
-
* @memberOf WhereQuery.prototype
|
|
3072
|
-
* @returns {Query}
|
|
3073
2132
|
*/
|
|
3074
2133
|
WhereQuery.prototype.done = function () {
|
|
3075
2134
|
if (this.parent instanceof WhereQuery) {
|
|
3076
|
-
this.parent.
|
|
2135
|
+
this.parent.addComplexExpression(this);
|
|
3077
2136
|
// TODO: If has and() || or() must call done() twice
|
|
3078
|
-
if (this.expression.getType() ===
|
|
2137
|
+
if (this.expression.getType() === constants_1.EXPRESSION_TYPE.not)
|
|
3079
2138
|
return this.parent;
|
|
3080
2139
|
}
|
|
3081
2140
|
return this.parent;
|
|
3082
2141
|
};
|
|
3083
|
-
WhereQuery.prototype.
|
|
2142
|
+
WhereQuery.prototype.getExpression = function () {
|
|
3084
2143
|
return this.expression;
|
|
3085
2144
|
};
|
|
3086
|
-
WhereQuery.prototype.
|
|
3087
|
-
|
|
2145
|
+
WhereQuery.prototype.simple = function (type, parameter, constant, caseSensitive) {
|
|
2146
|
+
if (caseSensitive === void 0) { caseSensitive = true; }
|
|
2147
|
+
var currentExpr = new Expression_1.BinaryExpression(type, parameter, constant, caseSensitive);
|
|
2148
|
+
var subExpressions = this.expression.getExpressions();
|
|
2149
|
+
subExpressions.push(currentExpr);
|
|
2150
|
+
if (this.expression.getType() === constants_1.EXPRESSION_TYPE.not && subExpressions.length > 1)
|
|
2151
|
+
throw new Error("Invalid operators count!");
|
|
2152
|
+
return this;
|
|
2153
|
+
};
|
|
2154
|
+
WhereQuery.prototype.addComplexExpression = function (subQuery) {
|
|
2155
|
+
var subExpression = subQuery.getExpression();
|
|
3088
2156
|
this.expression.getExpressions().push(subExpression);
|
|
3089
2157
|
};
|
|
3090
2158
|
return WhereQuery;
|
|
@@ -3098,68 +2166,66 @@ exports.WhereQuery = WhereQuery;
|
|
|
3098
2166
|
/*!**************************!*\
|
|
3099
2167
|
!*** ./src/constants.ts ***!
|
|
3100
2168
|
\**************************/
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
"
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
2169
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
2170
|
+
|
|
2171
|
+
|
|
2172
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2173
|
+
exports.CONTENT_TYPES = exports.HTTP_METHODS = exports.HEADER_NAMES = exports.SF_PARAMS = exports.ODATA_PARAMS = exports.EXPRESSION_TYPE = void 0;
|
|
2174
|
+
exports.EXPRESSION_TYPE = {
|
|
2175
|
+
query: 1,
|
|
2176
|
+
where: 100,
|
|
2177
|
+
and: 'and',
|
|
2178
|
+
or: 'or',
|
|
2179
|
+
not: 'not',
|
|
2180
|
+
eq: 'eq',
|
|
2181
|
+
ne: 'ne',
|
|
2182
|
+
lt: 'lt',
|
|
2183
|
+
le: 'le',
|
|
2184
|
+
gt: 'gt',
|
|
2185
|
+
ge: 'ge',
|
|
2186
|
+
any: 'any',
|
|
2187
|
+
contains: 'contains',
|
|
2188
|
+
startsWith: 'startsWith',
|
|
2189
|
+
endsWith: 'endsWith'
|
|
2190
|
+
};
|
|
2191
|
+
exports.ODATA_PARAMS = {
|
|
2192
|
+
$filter: '$filter',
|
|
2193
|
+
$select: '$select',
|
|
2194
|
+
$expand: '$expand',
|
|
2195
|
+
$orderby: '$orderby',
|
|
2196
|
+
$skip: '$skip',
|
|
2197
|
+
$top: '$top',
|
|
2198
|
+
$count: '$count',
|
|
2199
|
+
$search: '$search'
|
|
2200
|
+
};
|
|
2201
|
+
exports.SF_PARAMS = {
|
|
2202
|
+
provider: 'sf_provider',
|
|
2203
|
+
culture: 'sf_culture',
|
|
2204
|
+
siteId: 'sf_site',
|
|
2205
|
+
fallbackParams: "sf_fallback_prop_names",
|
|
2206
|
+
parentId: "parentId"
|
|
2207
|
+
};
|
|
2208
|
+
exports.HEADER_NAMES = {
|
|
2209
|
+
contentType: "Content-Type",
|
|
2210
|
+
authorization: "Authorization",
|
|
2211
|
+
contentEncoding: "Content-Encoding",
|
|
2212
|
+
operation: "X-Operation",
|
|
2213
|
+
properties: "X-Sf-Properties",
|
|
2214
|
+
fileName: "X-File-Name",
|
|
2215
|
+
serviceRequest: "X-SF-Service-Request",
|
|
2216
|
+
choicesBinaryRepresentation: "X-SF-Binary-Choice-Representation",
|
|
2217
|
+
integrationMode: "X-SF-Integration-Mode"
|
|
2218
|
+
};
|
|
2219
|
+
exports.HTTP_METHODS = {
|
|
2220
|
+
get: "GET",
|
|
2221
|
+
put: "PUT",
|
|
2222
|
+
post: "POST",
|
|
2223
|
+
patch: "PATCH",
|
|
2224
|
+
delete: "DELETE"
|
|
2225
|
+
};
|
|
2226
|
+
exports.CONTENT_TYPES = {
|
|
2227
|
+
json: "application/json"
|
|
3145
2228
|
};
|
|
3146
|
-
exports.default = constants;
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
/***/ }),
|
|
3150
|
-
|
|
3151
|
-
/***/ "./src/main.ts":
|
|
3152
|
-
/*!*********************!*\
|
|
3153
|
-
!*** ./src/main.ts ***!
|
|
3154
|
-
\*********************/
|
|
3155
|
-
/*! no static exports found */
|
|
3156
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
3157
|
-
|
|
3158
|
-
"use strict";
|
|
3159
|
-
|
|
3160
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3161
|
-
var Sitefinity_1 = __webpack_require__(/*! ./Sitefinity */ "./src/Sitefinity.ts");
|
|
3162
|
-
module.exports = Sitefinity_1.Sitefinity;
|
|
3163
2229
|
|
|
3164
2230
|
|
|
3165
2231
|
/***/ }),
|
|
@@ -3168,12 +2234,11 @@ module.exports = Sitefinity_1.Sitefinity;
|
|
|
3168
2234
|
/*!**********************!*\
|
|
3169
2235
|
!*** ./src/utils.ts ***!
|
|
3170
2236
|
\**********************/
|
|
3171
|
-
|
|
3172
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2237
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
3173
2238
|
|
|
3174
|
-
"use strict";
|
|
3175
2239
|
|
|
3176
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2240
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2241
|
+
exports.utils = void 0;
|
|
3177
2242
|
var utils = /** @class */ (function () {
|
|
3178
2243
|
function utils() {
|
|
3179
2244
|
}
|
|
@@ -3186,11 +2251,12 @@ var utils = /** @class */ (function () {
|
|
|
3186
2251
|
utils.isBlob = function (obj) {
|
|
3187
2252
|
return obj instanceof Blob;
|
|
3188
2253
|
};
|
|
3189
|
-
;
|
|
3190
2254
|
utils.isNumber = function (value) {
|
|
3191
2255
|
return typeof value === 'number' && isFinite(value);
|
|
3192
2256
|
};
|
|
3193
|
-
|
|
2257
|
+
utils.isFunction = function (func) {
|
|
2258
|
+
return typeof func === 'function';
|
|
2259
|
+
};
|
|
3194
2260
|
utils.serializeToJSON = function (data) {
|
|
3195
2261
|
if (!utils.isString(data) && !this.isBlob(data)) {
|
|
3196
2262
|
return JSON.stringify(data);
|
|
@@ -3213,7 +2279,20 @@ var utils = /** @class */ (function () {
|
|
|
3213
2279
|
catch (e) {
|
|
3214
2280
|
console.log("An unexpected error occurred while parsing the response from server: " + e.message + ". Response body was: '" + data + "'");
|
|
3215
2281
|
}
|
|
3216
|
-
return result;
|
|
2282
|
+
return result;
|
|
2283
|
+
};
|
|
2284
|
+
utils.convertDateFieldToISOString = function (data) {
|
|
2285
|
+
/*
|
|
2286
|
+
TODOSDK: when write tests for this try to use
|
|
2287
|
+
"Object.keys(obj).forEach(function(){})",
|
|
2288
|
+
Phantomjs does not recognize "for..in" operator.
|
|
2289
|
+
*/
|
|
2290
|
+
for (var obj in data) {
|
|
2291
|
+
if (data[obj] instanceof Date) {
|
|
2292
|
+
data[obj] = data[obj].toISOString();
|
|
2293
|
+
}
|
|
2294
|
+
}
|
|
2295
|
+
return data;
|
|
3217
2296
|
};
|
|
3218
2297
|
utils.hex16 = function () {
|
|
3219
2298
|
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substr(1);
|
|
@@ -3267,26 +2346,353 @@ var utils = /** @class */ (function () {
|
|
|
3267
2346
|
}
|
|
3268
2347
|
return date;
|
|
3269
2348
|
};
|
|
3270
|
-
utils.convertDateFieldToISOString = function (data) {
|
|
3271
|
-
/*
|
|
3272
|
-
TODOSDK: when write tests for this try to use
|
|
3273
|
-
"Object.keys(obj).forEach(function(){})",
|
|
3274
|
-
Phantomjs does not recognize "for..in" operator.
|
|
3275
|
-
*/
|
|
3276
|
-
for (var obj in data) {
|
|
3277
|
-
if (data[obj] instanceof Date) {
|
|
3278
|
-
data[obj] = data[obj].toISOString();
|
|
3279
|
-
}
|
|
3280
|
-
}
|
|
3281
|
-
return data;
|
|
3282
|
-
};
|
|
3283
2349
|
return utils;
|
|
3284
2350
|
}());
|
|
3285
2351
|
exports.utils = utils;
|
|
3286
2352
|
|
|
3287
2353
|
|
|
2354
|
+
/***/ }),
|
|
2355
|
+
|
|
2356
|
+
/***/ "./node_modules/tslib/tslib.es6.js":
|
|
2357
|
+
/*!*****************************************!*\
|
|
2358
|
+
!*** ./node_modules/tslib/tslib.es6.js ***!
|
|
2359
|
+
\*****************************************/
|
|
2360
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2361
|
+
|
|
2362
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2363
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2364
|
+
/* harmony export */ "__extends": () => (/* binding */ __extends),
|
|
2365
|
+
/* harmony export */ "__assign": () => (/* binding */ __assign),
|
|
2366
|
+
/* harmony export */ "__rest": () => (/* binding */ __rest),
|
|
2367
|
+
/* harmony export */ "__decorate": () => (/* binding */ __decorate),
|
|
2368
|
+
/* harmony export */ "__param": () => (/* binding */ __param),
|
|
2369
|
+
/* harmony export */ "__metadata": () => (/* binding */ __metadata),
|
|
2370
|
+
/* harmony export */ "__awaiter": () => (/* binding */ __awaiter),
|
|
2371
|
+
/* harmony export */ "__generator": () => (/* binding */ __generator),
|
|
2372
|
+
/* harmony export */ "__createBinding": () => (/* binding */ __createBinding),
|
|
2373
|
+
/* harmony export */ "__exportStar": () => (/* binding */ __exportStar),
|
|
2374
|
+
/* harmony export */ "__values": () => (/* binding */ __values),
|
|
2375
|
+
/* harmony export */ "__read": () => (/* binding */ __read),
|
|
2376
|
+
/* harmony export */ "__spread": () => (/* binding */ __spread),
|
|
2377
|
+
/* harmony export */ "__spreadArrays": () => (/* binding */ __spreadArrays),
|
|
2378
|
+
/* harmony export */ "__spreadArray": () => (/* binding */ __spreadArray),
|
|
2379
|
+
/* harmony export */ "__await": () => (/* binding */ __await),
|
|
2380
|
+
/* harmony export */ "__asyncGenerator": () => (/* binding */ __asyncGenerator),
|
|
2381
|
+
/* harmony export */ "__asyncDelegator": () => (/* binding */ __asyncDelegator),
|
|
2382
|
+
/* harmony export */ "__asyncValues": () => (/* binding */ __asyncValues),
|
|
2383
|
+
/* harmony export */ "__makeTemplateObject": () => (/* binding */ __makeTemplateObject),
|
|
2384
|
+
/* harmony export */ "__importStar": () => (/* binding */ __importStar),
|
|
2385
|
+
/* harmony export */ "__importDefault": () => (/* binding */ __importDefault),
|
|
2386
|
+
/* harmony export */ "__classPrivateFieldGet": () => (/* binding */ __classPrivateFieldGet),
|
|
2387
|
+
/* harmony export */ "__classPrivateFieldSet": () => (/* binding */ __classPrivateFieldSet)
|
|
2388
|
+
/* harmony export */ });
|
|
2389
|
+
/*! *****************************************************************************
|
|
2390
|
+
Copyright (c) Microsoft Corporation.
|
|
2391
|
+
|
|
2392
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
2393
|
+
purpose with or without fee is hereby granted.
|
|
2394
|
+
|
|
2395
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2396
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2397
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2398
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2399
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2400
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2401
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
2402
|
+
***************************************************************************** */
|
|
2403
|
+
/* global Reflect, Promise */
|
|
2404
|
+
|
|
2405
|
+
var extendStatics = function(d, b) {
|
|
2406
|
+
extendStatics = Object.setPrototypeOf ||
|
|
2407
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
2408
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
2409
|
+
return extendStatics(d, b);
|
|
2410
|
+
};
|
|
2411
|
+
|
|
2412
|
+
function __extends(d, b) {
|
|
2413
|
+
if (typeof b !== "function" && b !== null)
|
|
2414
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
2415
|
+
extendStatics(d, b);
|
|
2416
|
+
function __() { this.constructor = d; }
|
|
2417
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
2418
|
+
}
|
|
2419
|
+
|
|
2420
|
+
var __assign = function() {
|
|
2421
|
+
__assign = Object.assign || function __assign(t) {
|
|
2422
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
2423
|
+
s = arguments[i];
|
|
2424
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
2425
|
+
}
|
|
2426
|
+
return t;
|
|
2427
|
+
}
|
|
2428
|
+
return __assign.apply(this, arguments);
|
|
2429
|
+
}
|
|
2430
|
+
|
|
2431
|
+
function __rest(s, e) {
|
|
2432
|
+
var t = {};
|
|
2433
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
2434
|
+
t[p] = s[p];
|
|
2435
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
2436
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2437
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
2438
|
+
t[p[i]] = s[p[i]];
|
|
2439
|
+
}
|
|
2440
|
+
return t;
|
|
2441
|
+
}
|
|
2442
|
+
|
|
2443
|
+
function __decorate(decorators, target, key, desc) {
|
|
2444
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2445
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2446
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2447
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2448
|
+
}
|
|
2449
|
+
|
|
2450
|
+
function __param(paramIndex, decorator) {
|
|
2451
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
2452
|
+
}
|
|
2453
|
+
|
|
2454
|
+
function __metadata(metadataKey, metadataValue) {
|
|
2455
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
2456
|
+
}
|
|
2457
|
+
|
|
2458
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
2459
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2460
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2461
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
2462
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
2463
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
2464
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2465
|
+
});
|
|
2466
|
+
}
|
|
2467
|
+
|
|
2468
|
+
function __generator(thisArg, body) {
|
|
2469
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
2470
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
2471
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
2472
|
+
function step(op) {
|
|
2473
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
2474
|
+
while (_) try {
|
|
2475
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
2476
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
2477
|
+
switch (op[0]) {
|
|
2478
|
+
case 0: case 1: t = op; break;
|
|
2479
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
2480
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
2481
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
2482
|
+
default:
|
|
2483
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
2484
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
2485
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
2486
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
2487
|
+
if (t[2]) _.ops.pop();
|
|
2488
|
+
_.trys.pop(); continue;
|
|
2489
|
+
}
|
|
2490
|
+
op = body.call(thisArg, _);
|
|
2491
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
2492
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2495
|
+
|
|
2496
|
+
var __createBinding = Object.create ? (function(o, m, k, k2) {
|
|
2497
|
+
if (k2 === undefined) k2 = k;
|
|
2498
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
2499
|
+
}) : (function(o, m, k, k2) {
|
|
2500
|
+
if (k2 === undefined) k2 = k;
|
|
2501
|
+
o[k2] = m[k];
|
|
2502
|
+
});
|
|
2503
|
+
|
|
2504
|
+
function __exportStar(m, o) {
|
|
2505
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
|
2506
|
+
}
|
|
2507
|
+
|
|
2508
|
+
function __values(o) {
|
|
2509
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
2510
|
+
if (m) return m.call(o);
|
|
2511
|
+
if (o && typeof o.length === "number") return {
|
|
2512
|
+
next: function () {
|
|
2513
|
+
if (o && i >= o.length) o = void 0;
|
|
2514
|
+
return { value: o && o[i++], done: !o };
|
|
2515
|
+
}
|
|
2516
|
+
};
|
|
2517
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
2518
|
+
}
|
|
2519
|
+
|
|
2520
|
+
function __read(o, n) {
|
|
2521
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
2522
|
+
if (!m) return o;
|
|
2523
|
+
var i = m.call(o), r, ar = [], e;
|
|
2524
|
+
try {
|
|
2525
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
2526
|
+
}
|
|
2527
|
+
catch (error) { e = { error: error }; }
|
|
2528
|
+
finally {
|
|
2529
|
+
try {
|
|
2530
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
2531
|
+
}
|
|
2532
|
+
finally { if (e) throw e.error; }
|
|
2533
|
+
}
|
|
2534
|
+
return ar;
|
|
2535
|
+
}
|
|
2536
|
+
|
|
2537
|
+
/** @deprecated */
|
|
2538
|
+
function __spread() {
|
|
2539
|
+
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
2540
|
+
ar = ar.concat(__read(arguments[i]));
|
|
2541
|
+
return ar;
|
|
2542
|
+
}
|
|
2543
|
+
|
|
2544
|
+
/** @deprecated */
|
|
2545
|
+
function __spreadArrays() {
|
|
2546
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
2547
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
2548
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
2549
|
+
r[k] = a[j];
|
|
2550
|
+
return r;
|
|
2551
|
+
}
|
|
2552
|
+
|
|
2553
|
+
function __spreadArray(to, from, pack) {
|
|
2554
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
2555
|
+
if (ar || !(i in from)) {
|
|
2556
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
2557
|
+
ar[i] = from[i];
|
|
2558
|
+
}
|
|
2559
|
+
}
|
|
2560
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
2561
|
+
}
|
|
2562
|
+
|
|
2563
|
+
function __await(v) {
|
|
2564
|
+
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
2565
|
+
}
|
|
2566
|
+
|
|
2567
|
+
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
2568
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
2569
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
2570
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
2571
|
+
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
2572
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
2573
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
2574
|
+
function fulfill(value) { resume("next", value); }
|
|
2575
|
+
function reject(value) { resume("throw", value); }
|
|
2576
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
2577
|
+
}
|
|
2578
|
+
|
|
2579
|
+
function __asyncDelegator(o) {
|
|
2580
|
+
var i, p;
|
|
2581
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
2582
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
2583
|
+
}
|
|
2584
|
+
|
|
2585
|
+
function __asyncValues(o) {
|
|
2586
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
2587
|
+
var m = o[Symbol.asyncIterator], i;
|
|
2588
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
2589
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
2590
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2593
|
+
function __makeTemplateObject(cooked, raw) {
|
|
2594
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
2595
|
+
return cooked;
|
|
2596
|
+
};
|
|
2597
|
+
|
|
2598
|
+
var __setModuleDefault = Object.create ? (function(o, v) {
|
|
2599
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
2600
|
+
}) : function(o, v) {
|
|
2601
|
+
o["default"] = v;
|
|
2602
|
+
};
|
|
2603
|
+
|
|
2604
|
+
function __importStar(mod) {
|
|
2605
|
+
if (mod && mod.__esModule) return mod;
|
|
2606
|
+
var result = {};
|
|
2607
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
2608
|
+
__setModuleDefault(result, mod);
|
|
2609
|
+
return result;
|
|
2610
|
+
}
|
|
2611
|
+
|
|
2612
|
+
function __importDefault(mod) {
|
|
2613
|
+
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
2614
|
+
}
|
|
2615
|
+
|
|
2616
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
2617
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
2618
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
2619
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
2620
|
+
}
|
|
2621
|
+
|
|
2622
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
2623
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
2624
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
2625
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
2626
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
2627
|
+
}
|
|
2628
|
+
|
|
2629
|
+
|
|
3288
2630
|
/***/ })
|
|
3289
2631
|
|
|
3290
|
-
/******/
|
|
2632
|
+
/******/ });
|
|
2633
|
+
/************************************************************************/
|
|
2634
|
+
/******/ // The module cache
|
|
2635
|
+
/******/ var __webpack_module_cache__ = {};
|
|
2636
|
+
/******/
|
|
2637
|
+
/******/ // The require function
|
|
2638
|
+
/******/ function __webpack_require__(moduleId) {
|
|
2639
|
+
/******/ // Check if module is in cache
|
|
2640
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
2641
|
+
/******/ if (cachedModule !== undefined) {
|
|
2642
|
+
/******/ return cachedModule.exports;
|
|
2643
|
+
/******/ }
|
|
2644
|
+
/******/ // Create a new module (and put it into the cache)
|
|
2645
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
2646
|
+
/******/ // no module.id needed
|
|
2647
|
+
/******/ // no module.loaded needed
|
|
2648
|
+
/******/ exports: {}
|
|
2649
|
+
/******/ };
|
|
2650
|
+
/******/
|
|
2651
|
+
/******/ // Execute the module function
|
|
2652
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
2653
|
+
/******/
|
|
2654
|
+
/******/ // Return the exports of the module
|
|
2655
|
+
/******/ return module.exports;
|
|
2656
|
+
/******/ }
|
|
2657
|
+
/******/
|
|
2658
|
+
/************************************************************************/
|
|
2659
|
+
/******/ /* webpack/runtime/define property getters */
|
|
2660
|
+
/******/ (() => {
|
|
2661
|
+
/******/ // define getter functions for harmony exports
|
|
2662
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
2663
|
+
/******/ for(var key in definition) {
|
|
2664
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
2665
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
2666
|
+
/******/ }
|
|
2667
|
+
/******/ }
|
|
2668
|
+
/******/ };
|
|
2669
|
+
/******/ })();
|
|
2670
|
+
/******/
|
|
2671
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
2672
|
+
/******/ (() => {
|
|
2673
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
2674
|
+
/******/ })();
|
|
2675
|
+
/******/
|
|
2676
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
2677
|
+
/******/ (() => {
|
|
2678
|
+
/******/ // define __esModule on exports
|
|
2679
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
2680
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
2681
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2682
|
+
/******/ }
|
|
2683
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
2684
|
+
/******/ };
|
|
2685
|
+
/******/ })();
|
|
2686
|
+
/******/
|
|
2687
|
+
/************************************************************************/
|
|
2688
|
+
/******/
|
|
2689
|
+
/******/ // startup
|
|
2690
|
+
/******/ // Load entry module and return exports
|
|
2691
|
+
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
2692
|
+
/******/ var __webpack_exports__ = __webpack_require__("./sitefinity-webservices-sdk.ts");
|
|
2693
|
+
/******/
|
|
2694
|
+
/******/ return __webpack_exports__;
|
|
2695
|
+
/******/ })()
|
|
2696
|
+
;
|
|
3291
2697
|
});
|
|
3292
2698
|
//# sourceMappingURL=sitefinity-webservices-sdk.js.map
|