@progress/sitefinity-webservices-sdk 0.3.1 → 1.0.3
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 +1139 -1738
- 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 +64 -82
- 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 +451 -0
- package/src/Sitefinity.ts +77 -146
- package/src/WhereQuery.ts +52 -112
- package/src/constants.ts +58 -39
- package/src/utils.ts +16 -16
- package/template.html +33 -35
- package/tsconfig.json +8 -1
- package/version.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 -496
- 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
|
@@ -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,48 +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
|
-
var expressionConstant = this.
|
|
1467
|
-
var expressionValue = this.
|
|
1468
|
-
result = type.toLowerCase()
|
|
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, ")");
|
|
1469
814
|
break;
|
|
1470
|
-
|
|
1471
|
-
|
|
815
|
+
}
|
|
816
|
+
default: {
|
|
817
|
+
var msg = "Unsupported operator ".concat(type);
|
|
1472
818
|
throw new Error(msg);
|
|
819
|
+
}
|
|
1473
820
|
}
|
|
1474
821
|
return result;
|
|
1475
822
|
};
|
|
1476
|
-
QueryBuilder.prototype.
|
|
823
|
+
QueryBuilder.prototype.applyCaseSensitiveSettings = function (expression, value) {
|
|
1477
824
|
if (expression.isCaseSensitive()) {
|
|
1478
825
|
return value;
|
|
1479
826
|
}
|
|
1480
|
-
return "tolower("
|
|
827
|
+
return "tolower(".concat(value, ")");
|
|
1481
828
|
};
|
|
1482
|
-
QueryBuilder.prototype.
|
|
1483
|
-
if (this.
|
|
829
|
+
QueryBuilder.prototype.checkType = function (constant) {
|
|
830
|
+
if (this.isGuid(constant))
|
|
1484
831
|
return constant;
|
|
1485
832
|
if (constant == null)
|
|
1486
833
|
return null;
|
|
@@ -1491,7 +838,7 @@ var QueryBuilder = /** @class */ (function () {
|
|
|
1491
838
|
constant = constant.replace(/'/g, "''");
|
|
1492
839
|
return "'" + constant + "'";
|
|
1493
840
|
};
|
|
1494
|
-
QueryBuilder.prototype.
|
|
841
|
+
QueryBuilder.prototype.isGuid = function (constant) {
|
|
1495
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);
|
|
1496
843
|
};
|
|
1497
844
|
return QueryBuilder;
|
|
@@ -1505,30 +852,25 @@ exports.QueryBuilder = QueryBuilder;
|
|
|
1505
852
|
/*!**************************************!*\
|
|
1506
853
|
!*** ./src/Requests/BatchRequest.ts ***!
|
|
1507
854
|
\**************************************/
|
|
1508
|
-
|
|
1509
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
855
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
1510
856
|
|
|
1511
|
-
"use strict";
|
|
1512
857
|
|
|
1513
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
858
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
859
|
+
exports.BatchRequest = exports.Transaction = void 0;
|
|
1514
860
|
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
|
|
1515
|
-
var Request_1 = __webpack_require__(/*! ./Request */ "./src/Requests/Request.ts");
|
|
1516
861
|
var BlobBuilder_1 = __webpack_require__(/*! ../BlobBuilder */ "./src/BlobBuilder.ts");
|
|
1517
862
|
var utils_1 = __webpack_require__(/*! ../utils */ "./src/utils.ts");
|
|
1518
|
-
var
|
|
1519
|
-
var
|
|
863
|
+
var constants_1 = __webpack_require__(/*! ../constants */ "./src/constants.ts");
|
|
864
|
+
var ExecutableRequest_1 = __webpack_require__(/*! ./ExecutableRequest */ "./src/Requests/ExecutableRequest.ts");
|
|
1520
865
|
/**
|
|
1521
|
-
*
|
|
1522
|
-
* @class Transaction
|
|
1523
|
-
* @param {object} urlOptions - The url options that are passed to the {@link _factory} object.
|
|
1524
|
-
* @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.
|
|
1525
867
|
*/
|
|
1526
868
|
var Transaction = /** @class */ (function () {
|
|
1527
|
-
function Transaction(urlOptions,
|
|
869
|
+
function Transaction(urlOptions, factory) {
|
|
1528
870
|
this.urlOptions = urlOptions;
|
|
1529
|
-
this.
|
|
1530
|
-
this.
|
|
1531
|
-
this.
|
|
871
|
+
this.factory = factory;
|
|
872
|
+
this.requests = [];
|
|
873
|
+
this.counter = 0;
|
|
1532
874
|
}
|
|
1533
875
|
Transaction.prototype.upload = function (parameters) {
|
|
1534
876
|
var urlOptions = this.urlParametersClone(parameters.entitySet);
|
|
@@ -1538,17 +880,13 @@ var Transaction = /** @class */ (function () {
|
|
|
1538
880
|
contentType: parameters.contentType,
|
|
1539
881
|
fileName: parameters.fileName,
|
|
1540
882
|
key: parameters.key,
|
|
1541
|
-
uploadProperties:
|
|
883
|
+
uploadProperties: parameters.uploadProperties
|
|
1542
884
|
};
|
|
1543
|
-
var request = this.
|
|
1544
|
-
return this.addRequest(
|
|
885
|
+
var request = this.factory.upload(options);
|
|
886
|
+
return this.addRequest(request);
|
|
1545
887
|
};
|
|
1546
888
|
/**
|
|
1547
889
|
* Adds a POST request to create a single item.
|
|
1548
|
-
* @memberOf Transaction
|
|
1549
|
-
* @instance
|
|
1550
|
-
* @param {object} parameters - The parameters for the request.
|
|
1551
|
-
* @param {object} parameters.data - The payload of the request.
|
|
1552
890
|
*/
|
|
1553
891
|
Transaction.prototype.create = function (parameters) {
|
|
1554
892
|
if (!(parameters || parameters.entitySet))
|
|
@@ -1558,19 +896,15 @@ var Transaction = /** @class */ (function () {
|
|
|
1558
896
|
key: parameters.key,
|
|
1559
897
|
action: parameters.action,
|
|
1560
898
|
urlOptions: urlOptions,
|
|
1561
|
-
data:
|
|
899
|
+
data: parameters.data
|
|
1562
900
|
};
|
|
1563
|
-
var request = this.
|
|
1564
|
-
return this.addRequest(
|
|
901
|
+
var request = this.factory.create(options);
|
|
902
|
+
return this.addRequest(request);
|
|
1565
903
|
};
|
|
1566
904
|
/**
|
|
1567
905
|
* Adds a POST request to execute an operation on single item.
|
|
1568
|
-
* @memberOf Transaction
|
|
1569
|
-
* @instance
|
|
1570
|
-
* @param {object} parameters - The parameters for the request.
|
|
1571
|
-
* @param {string} parameters.key - The identifier of the item to be updated.
|
|
1572
|
-
* @param {object} parameters.data - The payload of the request.
|
|
1573
906
|
*/
|
|
907
|
+
// TODO: Remove
|
|
1574
908
|
Transaction.prototype.operation = function (parameters) {
|
|
1575
909
|
if (!(parameters || parameters.entitySet || parameters.key || parameters.data))
|
|
1576
910
|
throw "parameters: entitySet, key and data are required!";
|
|
@@ -1579,20 +913,14 @@ var Transaction = /** @class */ (function () {
|
|
|
1579
913
|
urlOptions: urlOptions,
|
|
1580
914
|
key: parameters.key,
|
|
1581
915
|
action: 'operation',
|
|
1582
|
-
data:
|
|
916
|
+
data: parameters.data
|
|
1583
917
|
};
|
|
1584
|
-
var request = this.
|
|
1585
|
-
this.
|
|
1586
|
-
this.addRequest(
|
|
918
|
+
var request = this.factory.create(options);
|
|
919
|
+
this.overrideUrlGeneration(request, parameters.key, 'operation', options.urlOptions, options.query);
|
|
920
|
+
this.addRequest(request);
|
|
1587
921
|
};
|
|
1588
922
|
/**
|
|
1589
923
|
* Adds a PATCH request to update a single item.
|
|
1590
|
-
* @memberOf Transaction
|
|
1591
|
-
* @instance
|
|
1592
|
-
* @param {object} parameters - The parameters for the request.
|
|
1593
|
-
* @param {bool} parameters.saveTemp - A flag indicating whether to save in temp.
|
|
1594
|
-
* @param {string} parameters.key - The identifier of the item to be updated.
|
|
1595
|
-
* @param {object} parameters.data - The payload of the request.
|
|
1596
924
|
*/
|
|
1597
925
|
Transaction.prototype.update = function (parameters) {
|
|
1598
926
|
if (!(parameters || parameters.entitySet || parameters.key || parameters.data))
|
|
@@ -1602,18 +930,14 @@ var Transaction = /** @class */ (function () {
|
|
|
1602
930
|
urlOptions: urlOptions,
|
|
1603
931
|
saveTemp: parameters.saveTemp,
|
|
1604
932
|
key: parameters.key,
|
|
1605
|
-
data:
|
|
933
|
+
data: parameters.data
|
|
1606
934
|
};
|
|
1607
|
-
var request = this.
|
|
1608
|
-
this.
|
|
1609
|
-
this.addRequest(
|
|
935
|
+
var request = this.factory.update(options);
|
|
936
|
+
this.overrideUrlGeneration(request, parameters.key, undefined, options.urlOptions, options.query);
|
|
937
|
+
this.addRequest(request);
|
|
1610
938
|
};
|
|
1611
939
|
/**
|
|
1612
940
|
* Adds a DELETE request to delete a single item.
|
|
1613
|
-
* @memberOf Transaction
|
|
1614
|
-
* @instance
|
|
1615
|
-
* @param {object} parameters - The parameters for the request.
|
|
1616
|
-
* @param {string} parameters.key - The identifier of the item to be deleted.
|
|
1617
941
|
*/
|
|
1618
942
|
Transaction.prototype.destroy = function (parameters) {
|
|
1619
943
|
if (!(parameters || parameters.entitySet || parameters.key))
|
|
@@ -1623,17 +947,12 @@ var Transaction = /** @class */ (function () {
|
|
|
1623
947
|
urlOptions: urlOptions,
|
|
1624
948
|
key: parameters.key
|
|
1625
949
|
};
|
|
1626
|
-
var request = this.
|
|
1627
|
-
this.
|
|
1628
|
-
this.addRequest(
|
|
950
|
+
var request = this.factory.destroy(options);
|
|
951
|
+
this.overrideUrlGeneration(request, parameters.key, undefined, options.urlOptions, options.query);
|
|
952
|
+
this.addRequest(request);
|
|
1629
953
|
};
|
|
1630
954
|
/**
|
|
1631
|
-
* Adds a DELETE request to
|
|
1632
|
-
* @memberOf Transaction
|
|
1633
|
-
* @instance
|
|
1634
|
-
* @param {object} parameters - The parameters for the request.
|
|
1635
|
-
* @param {string} parameters.key - The identifier of the item.
|
|
1636
|
-
* @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.
|
|
1637
956
|
*/
|
|
1638
957
|
Transaction.prototype.destroyRelated = function (parameters) {
|
|
1639
958
|
if (!(parameters || parameters.entitySet || parameters.key))
|
|
@@ -1642,52 +961,40 @@ var Transaction = /** @class */ (function () {
|
|
|
1642
961
|
var options = {
|
|
1643
962
|
urlOptions: urlOptions,
|
|
1644
963
|
key: parameters.key,
|
|
1645
|
-
|
|
964
|
+
property: parameters.property
|
|
1646
965
|
};
|
|
1647
|
-
var request = this.
|
|
1648
|
-
var
|
|
1649
|
-
this.
|
|
1650
|
-
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);
|
|
1651
970
|
};
|
|
1652
971
|
/**
|
|
1653
972
|
* Adds a DELETE request to retrieve the a single entry of the associated members in the relation property.
|
|
1654
|
-
* @memberOf Transaction
|
|
1655
|
-
* @instance
|
|
1656
|
-
* @param {object} parameters - The parameters for the request.
|
|
1657
|
-
* @param {string} parameters.key - The identifier of the item.
|
|
1658
|
-
* @param {string} parameters.navigationProperty - The name of the navigation property.
|
|
1659
|
-
* @param {string} parameters.relatedKey - The identifier of the related item.
|
|
1660
973
|
*/
|
|
1661
974
|
Transaction.prototype.destroyRelatedById = function (parameters) {
|
|
1662
|
-
if (!(parameters || parameters.entitySet || parameters.key || parameters.
|
|
1663
|
-
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!";
|
|
1664
977
|
var urlOptions = this.urlParametersClone(parameters.entitySet);
|
|
1665
978
|
var options = {
|
|
1666
979
|
urlOptions: urlOptions,
|
|
1667
980
|
key: parameters.key,
|
|
1668
|
-
|
|
1669
|
-
|
|
981
|
+
relatedId: parameters.relatedId,
|
|
982
|
+
property: parameters.property
|
|
1670
983
|
};
|
|
1671
|
-
var request = this.
|
|
1672
|
-
this.addRequest(
|
|
984
|
+
var request = this.factory.destroyRelatedById(options);
|
|
985
|
+
this.addRequest(request);
|
|
1673
986
|
};
|
|
1674
987
|
/**
|
|
1675
988
|
* Adds a POST request to add a related item to the property collection.
|
|
1676
|
-
* @memberOf Transaction
|
|
1677
|
-
* @instance
|
|
1678
|
-
* @see {@link Data.createRelated}
|
|
1679
|
-
* @param {object} parameters - The parameters for the request.
|
|
1680
|
-
* @param {string} parameters.key - The identifier of the item.
|
|
1681
|
-
* @param {string} parameters.navigationProperty - The name of the navigation property
|
|
1682
989
|
*/
|
|
1683
990
|
Transaction.prototype.createRelated = function (parameters) {
|
|
1684
|
-
if (!(parameters || parameters.entitySet || parameters.key || parameters.link || parameters.
|
|
1685
|
-
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!";
|
|
1686
993
|
// TODO: rethink about the urls
|
|
1687
994
|
var urlOptions = this.urlParametersClone(parameters.entitySet);
|
|
1688
|
-
for (var index = 0; index < this.
|
|
1689
|
-
if (this.
|
|
1690
|
-
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;
|
|
1691
998
|
}
|
|
1692
999
|
}
|
|
1693
1000
|
var data = {
|
|
@@ -1696,26 +1003,26 @@ var Transaction = /** @class */ (function () {
|
|
|
1696
1003
|
var options = {
|
|
1697
1004
|
urlOptions: urlOptions,
|
|
1698
1005
|
key: parameters.key,
|
|
1699
|
-
|
|
1700
|
-
data:
|
|
1006
|
+
property: parameters.property,
|
|
1007
|
+
data: data
|
|
1701
1008
|
};
|
|
1702
|
-
var request = this.
|
|
1703
|
-
var
|
|
1704
|
-
this.
|
|
1705
|
-
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);
|
|
1706
1013
|
};
|
|
1707
|
-
Transaction.prototype.
|
|
1014
|
+
Transaction.prototype.overrideUrlGeneration = function (request, key, additionalPropertyURL, urlOptions, query) {
|
|
1708
1015
|
// TODO: match requests with Content-ID's!
|
|
1709
|
-
// Content-ID's are the same as id's in
|
|
1710
|
-
for (var index = 0; index < this.
|
|
1711
|
-
if (this.
|
|
1712
|
-
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 () {
|
|
1713
1020
|
var uri = "$" + key;
|
|
1714
1021
|
if (additionalPropertyURL !== undefined) {
|
|
1715
1022
|
uri = uri + '/' + additionalPropertyURL;
|
|
1716
1023
|
}
|
|
1717
|
-
if (
|
|
1718
|
-
var queryString = request.
|
|
1024
|
+
if (urlOptions) {
|
|
1025
|
+
var queryString = request.getQueryString(urlOptions, query);
|
|
1719
1026
|
if (queryString) {
|
|
1720
1027
|
uri = uri + queryString;
|
|
1721
1028
|
}
|
|
@@ -1725,9 +1032,9 @@ var Transaction = /** @class */ (function () {
|
|
|
1725
1032
|
}
|
|
1726
1033
|
}
|
|
1727
1034
|
};
|
|
1728
|
-
Transaction.prototype.addRequest = function (
|
|
1729
|
-
|
|
1730
|
-
return
|
|
1035
|
+
Transaction.prototype.addRequest = function (request) {
|
|
1036
|
+
this.requests.push({ id: this.counter, request: request });
|
|
1037
|
+
return this.counter++;
|
|
1731
1038
|
};
|
|
1732
1039
|
Transaction.prototype.urlParametersClone = function (entitySet) {
|
|
1733
1040
|
var options = utils_1.utils.clone(this.urlOptions);
|
|
@@ -1736,50 +1043,40 @@ var Transaction = /** @class */ (function () {
|
|
|
1736
1043
|
};
|
|
1737
1044
|
return Transaction;
|
|
1738
1045
|
}());
|
|
1046
|
+
exports.Transaction = Transaction;
|
|
1739
1047
|
/**
|
|
1740
|
-
*
|
|
1741
|
-
* @class BatchRequest
|
|
1048
|
+
* The batch request class is used for grouping requests into a single batch request to execute on the server.
|
|
1742
1049
|
*/
|
|
1743
1050
|
var BatchRequest = /** @class */ (function (_super) {
|
|
1744
1051
|
tslib_1.__extends(BatchRequest, _super);
|
|
1745
|
-
function BatchRequest(
|
|
1746
|
-
var _this = _super.call(this,
|
|
1747
|
-
_this.
|
|
1748
|
-
_this.
|
|
1749
|
-
_this.
|
|
1750
|
-
_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_");
|
|
1751
1058
|
_this.responseHeaderRegex = /^([^()<>@,;:\\"\/[\]?={} \t]+)\s?:\s?(.*)/;
|
|
1752
1059
|
_this.responseStatusRegex = /^HTTP\/1\.\d (\d{3}) (.*)$/i;
|
|
1753
1060
|
return _this;
|
|
1754
1061
|
}
|
|
1755
1062
|
/**
|
|
1756
1063
|
* Adds a GET request to retrieve a collection of items.
|
|
1757
|
-
* @memberOf BatchRequest
|
|
1758
|
-
* @instance
|
|
1759
|
-
* @param {object} parameters - The parameters for the request.
|
|
1760
|
-
* @param {object} parameters.query - The {@link WhereQuery} with which to filter the items
|
|
1761
1064
|
*/
|
|
1762
1065
|
BatchRequest.prototype.get = function (parameters) {
|
|
1763
1066
|
if (!(parameters || parameters.entitySet))
|
|
1764
1067
|
throw "entitySet is required!";
|
|
1765
1068
|
var urlOptions = this.urlParametersClone(parameters.entitySet);
|
|
1766
|
-
if (parameters && parameters.query)
|
|
1767
|
-
urlOptions.ODataParams = parameters.query;
|
|
1768
1069
|
var options = {
|
|
1769
1070
|
urlOptions: urlOptions,
|
|
1770
1071
|
action: parameters.action,
|
|
1771
|
-
|
|
1072
|
+
query: parameters.query,
|
|
1073
|
+
fallbackProperties: parameters.fallbackProperties
|
|
1772
1074
|
};
|
|
1773
|
-
var request = this.
|
|
1075
|
+
var request = this.factory.get(options);
|
|
1774
1076
|
this.addRequest(request);
|
|
1775
1077
|
};
|
|
1776
1078
|
/**
|
|
1777
1079
|
* Adds a GET request for the retrieval of a single item.
|
|
1778
|
-
* @memberOf BatchRequest
|
|
1779
|
-
* @instance
|
|
1780
|
-
* @param {object} parameters - The parameters for the request.
|
|
1781
|
-
* @param {object} parameters.query - The {@link QueryBase} object containing the OData query options that should be sent to the server.
|
|
1782
|
-
* @param {string} parameters.key - The identifier of the item to be retrieved.
|
|
1783
1080
|
*/
|
|
1784
1081
|
BatchRequest.prototype.getSingle = function (parameters) {
|
|
1785
1082
|
if (!(parameters || parameters.entitySet || parameters.key))
|
|
@@ -1788,20 +1085,14 @@ var BatchRequest = /** @class */ (function (_super) {
|
|
|
1788
1085
|
var options = {
|
|
1789
1086
|
urlOptions: urlOptions,
|
|
1790
1087
|
action: parameters.action,
|
|
1791
|
-
key: parameters.key
|
|
1088
|
+
key: parameters.key,
|
|
1089
|
+
query: parameters.query
|
|
1792
1090
|
};
|
|
1793
|
-
|
|
1794
|
-
options.ODataParams = parameters.query;
|
|
1795
|
-
var request = this._factory.getSingle(options);
|
|
1091
|
+
var request = this.factory.getSingle(options);
|
|
1796
1092
|
this.addRequest(request);
|
|
1797
1093
|
};
|
|
1798
1094
|
/**
|
|
1799
1095
|
* Adds a GET request to get the property of a single item.
|
|
1800
|
-
* @memberOf BatchRequest
|
|
1801
|
-
* @instance
|
|
1802
|
-
* @param {object} parameters - The parameters for the request.
|
|
1803
|
-
* @param {string} parameters.key - The identifier of the item.
|
|
1804
|
-
* @param {string} parameters.property - The name of the property to be retrieved.
|
|
1805
1096
|
*/
|
|
1806
1097
|
BatchRequest.prototype.getProperty = function (parameters) {
|
|
1807
1098
|
if (!(parameters || parameters.entitySet || parameters.key, parameters.property))
|
|
@@ -1810,132 +1101,116 @@ var BatchRequest = /** @class */ (function (_super) {
|
|
|
1810
1101
|
var options = {
|
|
1811
1102
|
urlOptions: urlOptions,
|
|
1812
1103
|
key: parameters.key,
|
|
1813
|
-
|
|
1104
|
+
property: parameters.property
|
|
1814
1105
|
};
|
|
1815
|
-
var request = this.
|
|
1106
|
+
var request = this.factory.getProperty(options);
|
|
1816
1107
|
this.addRequest(request);
|
|
1817
1108
|
};
|
|
1818
1109
|
/**
|
|
1819
1110
|
* Adds a GET request to get the related property value of a single item.
|
|
1820
|
-
* @memberOf BatchRequest
|
|
1821
|
-
* @instance
|
|
1822
|
-
* @param {object} parameters - The parameters for the request.
|
|
1823
|
-
* @param {string} parameters.key - The identifier of the item.
|
|
1824
|
-
* @param {string} parameters.navigationProperty - The name of the navigation property to be retrieved.
|
|
1825
1111
|
*/
|
|
1826
1112
|
BatchRequest.prototype.getRelated = function (parameters) {
|
|
1827
|
-
if (!(parameters || parameters.entitySet || parameters.key || parameters.
|
|
1828
|
-
throw "parameters: entitySet, key and
|
|
1113
|
+
if (!(parameters || parameters.entitySet || parameters.key || parameters.property))
|
|
1114
|
+
throw "parameters: entitySet, key and property are required!";
|
|
1829
1115
|
var urlOptions = this.urlParametersClone(parameters.entitySet);
|
|
1830
1116
|
var options = {
|
|
1831
1117
|
urlOptions: urlOptions,
|
|
1832
1118
|
key: parameters.key,
|
|
1833
|
-
|
|
1119
|
+
property: parameters.property
|
|
1834
1120
|
};
|
|
1835
|
-
var request = this.
|
|
1121
|
+
var request = this.factory.getRelated(options);
|
|
1836
1122
|
this.addRequest(request);
|
|
1837
1123
|
};
|
|
1838
1124
|
/**
|
|
1839
1125
|
* Adds a GET request to retrieve the related property value of a single item by the id of the related item.
|
|
1840
|
-
* @memberOf BatchRequest
|
|
1841
|
-
* @instance
|
|
1842
|
-
* @param {object} parameters - The parameters for the request.
|
|
1843
|
-
* @param {string} parameters.key - The identifier of the item.
|
|
1844
|
-
* @param {string} parameters.navigationProperty - The name of the navigation property to be retrieved.
|
|
1845
|
-
* @param {string} parameters.relatedKey - The identifier of the related item.
|
|
1846
1126
|
*/
|
|
1847
1127
|
BatchRequest.prototype.getRelatedById = function (parameters) {
|
|
1848
|
-
if (!(parameters || parameters.entitySet || parameters.key || parameters.
|
|
1849
|
-
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!";
|
|
1850
1130
|
var urlOptions = this.urlParametersClone(parameters.entitySet);
|
|
1851
1131
|
var options = {
|
|
1852
1132
|
urlOptions: urlOptions,
|
|
1853
1133
|
key: parameters.key,
|
|
1854
|
-
|
|
1855
|
-
|
|
1134
|
+
relatedId: parameters.relatedId,
|
|
1135
|
+
property: parameters.property
|
|
1856
1136
|
};
|
|
1857
|
-
var request = this.
|
|
1137
|
+
var request = this.factory.getRelatedById(options);
|
|
1858
1138
|
this.addRequest(request);
|
|
1859
1139
|
};
|
|
1860
1140
|
/**
|
|
1861
1141
|
* Begins a transaction.
|
|
1862
|
-
* @memberOf BatchRequest
|
|
1863
|
-
* @instance
|
|
1864
|
-
* @returns {@link Transaction}
|
|
1865
1142
|
*/
|
|
1866
1143
|
BatchRequest.prototype.beginTransaction = function () {
|
|
1867
1144
|
var option = utils_1.utils.clone(this.urlOptions);
|
|
1868
|
-
var newTransaction = new Transaction(option, this.
|
|
1869
|
-
newTransaction.id = ++this.
|
|
1145
|
+
var newTransaction = new Transaction(option, this.factory);
|
|
1146
|
+
newTransaction.id = ++this.counter;
|
|
1870
1147
|
return newTransaction;
|
|
1871
1148
|
};
|
|
1872
1149
|
/**
|
|
1873
1150
|
* Ends a transaction.
|
|
1874
|
-
* @memberOf BatchRequest
|
|
1875
|
-
* @instance
|
|
1876
1151
|
*/
|
|
1877
1152
|
BatchRequest.prototype.endTransaction = function (transaction) {
|
|
1878
|
-
this.
|
|
1153
|
+
this.requests.push({
|
|
1879
1154
|
id: transaction.id,
|
|
1880
1155
|
request: transaction
|
|
1881
1156
|
});
|
|
1882
1157
|
};
|
|
1883
|
-
BatchRequest.prototype.
|
|
1884
|
-
return this.
|
|
1158
|
+
BatchRequest.prototype.getBody = function () {
|
|
1159
|
+
return this.buildRequestBody();
|
|
1885
1160
|
};
|
|
1886
|
-
BatchRequest.prototype.
|
|
1887
|
-
return
|
|
1161
|
+
BatchRequest.prototype.getMethod = function () {
|
|
1162
|
+
return constants_1.HTTP_METHODS.post;
|
|
1888
1163
|
};
|
|
1889
|
-
BatchRequest.prototype.
|
|
1164
|
+
BatchRequest.prototype.getHeaders = function () {
|
|
1890
1165
|
var contentType = "multipart/mixed; boundary=" + this.boundary;
|
|
1891
1166
|
var headers = {};
|
|
1892
|
-
headers[
|
|
1167
|
+
headers[constants_1.HEADER_NAMES.contentType] = contentType;
|
|
1893
1168
|
return headers;
|
|
1894
1169
|
};
|
|
1895
|
-
BatchRequest.prototype.
|
|
1170
|
+
BatchRequest.prototype.buildUrl = function () {
|
|
1896
1171
|
var url = this.urlOptions.baseUrl + "$batch";
|
|
1897
|
-
var queryString = this.
|
|
1172
|
+
var queryString = this.getQueryString(this.urlOptions, this.query);
|
|
1898
1173
|
if (queryString) {
|
|
1899
1174
|
url += queryString;
|
|
1900
1175
|
}
|
|
1901
1176
|
return url;
|
|
1902
1177
|
};
|
|
1903
|
-
BatchRequest.prototype.
|
|
1178
|
+
BatchRequest.prototype.parseResponse = function (http) {
|
|
1904
1179
|
var context = {
|
|
1905
1180
|
position: 0,
|
|
1906
1181
|
boundaries: []
|
|
1907
1182
|
};
|
|
1908
1183
|
var pos = context.position;
|
|
1909
|
-
var partHeaders = this.
|
|
1910
|
-
var partContentType = this.
|
|
1184
|
+
var partHeaders = this.readHeaders(http.getAllResponseHeaders(), context);
|
|
1185
|
+
var partContentType = this.contentType(partHeaders["content-type"]);
|
|
1911
1186
|
if (partContentType && partContentType.mediaType == "multipart/mixed") {
|
|
1912
1187
|
context.boundaries.push(partContentType.properties.boundary);
|
|
1913
1188
|
}
|
|
1914
1189
|
context.position = pos;
|
|
1915
|
-
var batchResponse = this.
|
|
1190
|
+
var batchResponse = this.parseBatchResponse(http.responseText, context);
|
|
1916
1191
|
var responseParsed = [];
|
|
1917
1192
|
for (var i = 0; i < batchResponse.length; i++) {
|
|
1918
1193
|
try {
|
|
1919
|
-
var currentRequest = this.
|
|
1194
|
+
var currentRequest = this.requests[i];
|
|
1920
1195
|
var finalResult = null;
|
|
1921
1196
|
var key = null;
|
|
1922
1197
|
var singleResponse = batchResponse[i];
|
|
1923
1198
|
var changesets = singleResponse.__changeResponses;
|
|
1924
1199
|
if (changesets) {
|
|
1925
1200
|
finalResult = [];
|
|
1926
|
-
var currentRequests = currentRequest ? currentRequest.request.
|
|
1201
|
+
var currentRequests = currentRequest ? currentRequest.request.requests : [];
|
|
1927
1202
|
for (var j = 0; j < changesets.length; j++) {
|
|
1928
|
-
key = currentRequests[j] ? currentRequests[j].request.
|
|
1203
|
+
key = currentRequests[j] ? currentRequests[j].request.key : null;
|
|
1929
1204
|
var changeset = changesets[j];
|
|
1930
1205
|
var response = changeset.response;
|
|
1931
|
-
var responseResult = this.
|
|
1206
|
+
var responseResult = this.getResponseResult(response, key);
|
|
1932
1207
|
finalResult.push(responseResult);
|
|
1933
1208
|
}
|
|
1934
1209
|
}
|
|
1935
1210
|
else {
|
|
1936
1211
|
key = currentRequest ? currentRequest.request.key : null;
|
|
1937
1212
|
var response = singleResponse.response;
|
|
1938
|
-
finalResult = this.
|
|
1213
|
+
finalResult = this.getResponseResult(response, key);
|
|
1939
1214
|
}
|
|
1940
1215
|
var statusCodeCheck = function (r) {
|
|
1941
1216
|
return r.statusCode >= 400;
|
|
@@ -1963,38 +1238,38 @@ var BatchRequest = /** @class */ (function (_super) {
|
|
|
1963
1238
|
var batchIsSuccessful = responseParsed.filter(isSuccessfulCheck).length === 0;
|
|
1964
1239
|
return { data: responseParsed, isSuccessful: batchIsSuccessful };
|
|
1965
1240
|
};
|
|
1966
|
-
BatchRequest.prototype.
|
|
1241
|
+
BatchRequest.prototype.parseBatchResponse = function (text, context) {
|
|
1967
1242
|
// get boundary from response
|
|
1968
|
-
var delimiter = "--" + this.
|
|
1969
|
-
this.
|
|
1970
|
-
this.
|
|
1243
|
+
var delimiter = "--" + this.currentBoundary(context);
|
|
1244
|
+
this.readTo(text, delimiter, context);
|
|
1245
|
+
this.readLine(text, context);
|
|
1971
1246
|
var responses = [];
|
|
1972
1247
|
var partEnd;
|
|
1973
1248
|
while (partEnd !== "--" && context.position < text.length) {
|
|
1974
|
-
var partHeaders = this.
|
|
1975
|
-
var partContentType = this.
|
|
1976
|
-
var changeResponses;
|
|
1249
|
+
var partHeaders = this.readHeaders(text, context);
|
|
1250
|
+
var partContentType = this.contentType(partHeaders["content-type"]);
|
|
1251
|
+
var changeResponses = void 0;
|
|
1977
1252
|
if (partContentType && partContentType.mediaType === "multipart/mixed") {
|
|
1978
1253
|
context.boundaries.push(partContentType.properties.boundary);
|
|
1979
1254
|
try {
|
|
1980
|
-
changeResponses = this.
|
|
1255
|
+
changeResponses = this.parseBatchResponse(text, context);
|
|
1981
1256
|
}
|
|
1982
1257
|
catch (e) {
|
|
1983
|
-
e.response = this.
|
|
1258
|
+
e.response = this.readResponse(text, context, delimiter);
|
|
1984
1259
|
changeResponses = [e];
|
|
1985
1260
|
}
|
|
1986
1261
|
responses.push({ __changeResponses: changeResponses });
|
|
1987
1262
|
context.boundaries.pop();
|
|
1988
|
-
this.
|
|
1263
|
+
this.readTo(text, "--" + this.currentBoundary(context), context);
|
|
1989
1264
|
}
|
|
1990
1265
|
else {
|
|
1991
1266
|
if (!partContentType || partContentType.mediaType !== "application/http") {
|
|
1992
1267
|
throw { message: "invalid MIME part type " };
|
|
1993
1268
|
}
|
|
1994
1269
|
// Skip empty line
|
|
1995
|
-
this.
|
|
1270
|
+
this.readLine(text, context);
|
|
1996
1271
|
// Read the response
|
|
1997
|
-
var response = this.
|
|
1272
|
+
var response = this.readResponse(text, context, delimiter);
|
|
1998
1273
|
try {
|
|
1999
1274
|
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
2000
1275
|
response = { message: response.statusCode + " Http request is OK", response: response };
|
|
@@ -2011,11 +1286,11 @@ var BatchRequest = /** @class */ (function (_super) {
|
|
|
2011
1286
|
}
|
|
2012
1287
|
partEnd = text.substr(context.position, 2);
|
|
2013
1288
|
// Ignore the incoming line.
|
|
2014
|
-
this.
|
|
1289
|
+
this.readLine(text, context);
|
|
2015
1290
|
}
|
|
2016
1291
|
return responses;
|
|
2017
1292
|
};
|
|
2018
|
-
BatchRequest.prototype.
|
|
1293
|
+
BatchRequest.prototype.getResponseResult = function (response, key) {
|
|
2019
1294
|
var responseBody = response.body;
|
|
2020
1295
|
var data = utils_1.utils.parseStringToJson(responseBody);
|
|
2021
1296
|
return {
|
|
@@ -2025,11 +1300,11 @@ var BatchRequest = /** @class */ (function (_super) {
|
|
|
2025
1300
|
headers: response.headers
|
|
2026
1301
|
};
|
|
2027
1302
|
};
|
|
2028
|
-
BatchRequest.prototype.
|
|
1303
|
+
BatchRequest.prototype.currentBoundary = function (context) {
|
|
2029
1304
|
var boundaries = context.boundaries;
|
|
2030
1305
|
return boundaries[boundaries.length - 1];
|
|
2031
1306
|
};
|
|
2032
|
-
BatchRequest.prototype.
|
|
1307
|
+
BatchRequest.prototype.contentType = function (str) {
|
|
2033
1308
|
if (!str) {
|
|
2034
1309
|
return null;
|
|
2035
1310
|
}
|
|
@@ -2042,7 +1317,7 @@ var BatchRequest = /** @class */ (function (_super) {
|
|
|
2042
1317
|
}
|
|
2043
1318
|
return { mediaType: contentTypeParts[0].replace(/^\s+|\s+$/g, ''), properties: properties };
|
|
2044
1319
|
};
|
|
2045
|
-
BatchRequest.prototype.
|
|
1320
|
+
BatchRequest.prototype.readTo = function (text, str, context) {
|
|
2046
1321
|
var start = context.position || 0;
|
|
2047
1322
|
var end = text.length;
|
|
2048
1323
|
if (str) {
|
|
@@ -2057,17 +1332,17 @@ var BatchRequest = /** @class */ (function (_super) {
|
|
|
2057
1332
|
}
|
|
2058
1333
|
return text.substring(start, end);
|
|
2059
1334
|
};
|
|
2060
|
-
BatchRequest.prototype.
|
|
2061
|
-
return this.
|
|
1335
|
+
BatchRequest.prototype.readLine = function (text, context) {
|
|
1336
|
+
return this.readTo(text, BatchRequest.constants.newLine, context);
|
|
2062
1337
|
};
|
|
2063
|
-
BatchRequest.prototype.
|
|
1338
|
+
BatchRequest.prototype.readHeaders = function (text, context) {
|
|
2064
1339
|
var headers = {};
|
|
2065
1340
|
var parts;
|
|
2066
1341
|
var line;
|
|
2067
1342
|
var pos;
|
|
2068
1343
|
do {
|
|
2069
1344
|
pos = context.position;
|
|
2070
|
-
line = this.
|
|
1345
|
+
line = this.readLine(text, context);
|
|
2071
1346
|
parts = this.responseHeaderRegex.exec(line);
|
|
2072
1347
|
if (parts !== null) {
|
|
2073
1348
|
headers[parts[1].toLowerCase()] = parts[2];
|
|
@@ -2079,18 +1354,18 @@ var BatchRequest = /** @class */ (function (_super) {
|
|
|
2079
1354
|
} while (line && parts);
|
|
2080
1355
|
return headers;
|
|
2081
1356
|
};
|
|
2082
|
-
BatchRequest.prototype.
|
|
1357
|
+
BatchRequest.prototype.readResponse = function (text, context, delimiter) {
|
|
2083
1358
|
// Read the status line.
|
|
2084
1359
|
var pos = context.position;
|
|
2085
|
-
var match = this.responseStatusRegex.exec(this.
|
|
1360
|
+
var match = this.responseStatusRegex.exec(this.readLine(text, context));
|
|
2086
1361
|
var statusCode;
|
|
2087
1362
|
var statusText;
|
|
2088
1363
|
var headers;
|
|
2089
1364
|
if (match) {
|
|
2090
1365
|
statusCode = match[1];
|
|
2091
1366
|
statusText = match[2];
|
|
2092
|
-
headers = this.
|
|
2093
|
-
this.
|
|
1367
|
+
headers = this.readHeaders(text, context);
|
|
1368
|
+
this.readLine(text, context);
|
|
2094
1369
|
}
|
|
2095
1370
|
else {
|
|
2096
1371
|
context.position = pos;
|
|
@@ -2099,71 +1374,71 @@ var BatchRequest = /** @class */ (function (_super) {
|
|
|
2099
1374
|
statusCode: statusCode,
|
|
2100
1375
|
statusText: statusText,
|
|
2101
1376
|
headers: headers,
|
|
2102
|
-
body: this.
|
|
1377
|
+
body: this.readTo(text, BatchRequest.constants.newLine + delimiter, context)
|
|
2103
1378
|
};
|
|
2104
1379
|
};
|
|
2105
|
-
BatchRequest.prototype.
|
|
1380
|
+
BatchRequest.prototype.buildRequestBody = function () {
|
|
2106
1381
|
var builder = new BlobBuilder_1.BlobBuilder();
|
|
2107
1382
|
builder.append('');
|
|
2108
|
-
for (var index = 0; index < this.
|
|
2109
|
-
var request = this.
|
|
1383
|
+
for (var index = 0; index < this.requests.length; index += 1) {
|
|
1384
|
+
var request = this.requests[index].request;
|
|
2110
1385
|
if (index != 0)
|
|
2111
1386
|
builder.append(BatchRequest.constants.newLine + BatchRequest.constants.newLine);
|
|
2112
1387
|
builder.append("--" + this.boundary);
|
|
2113
1388
|
if (request instanceof Transaction) {
|
|
2114
|
-
builder.append(this.
|
|
1389
|
+
builder.append(this.buildTransaction(request));
|
|
2115
1390
|
}
|
|
2116
1391
|
else {
|
|
2117
|
-
builder.append(this.
|
|
1392
|
+
builder.append(this.buildRequest(request));
|
|
2118
1393
|
}
|
|
2119
1394
|
}
|
|
2120
|
-
builder.append(this.
|
|
1395
|
+
builder.append(this.createDelimeter(this.boundary, true));
|
|
2121
1396
|
return builder.build();
|
|
2122
1397
|
};
|
|
2123
|
-
BatchRequest.prototype.
|
|
1398
|
+
BatchRequest.prototype.buildRequest = function (request) {
|
|
2124
1399
|
var builder = new BlobBuilder_1.BlobBuilder();
|
|
2125
1400
|
builder.append(BatchRequest.constants.newLine + 'Content-Type: application/http' +
|
|
2126
1401
|
BatchRequest.constants.newLine + 'Content-Transfer-Encoding: binary' +
|
|
2127
1402
|
BatchRequest.constants.newLine +
|
|
2128
1403
|
BatchRequest.constants.newLine +
|
|
2129
|
-
request.
|
|
2130
|
-
' ' + request.
|
|
1404
|
+
request.getMethod() +
|
|
1405
|
+
' ' + request.buildUrl() + ' HTTP/1.1');
|
|
2131
1406
|
return builder.build();
|
|
2132
1407
|
};
|
|
2133
|
-
BatchRequest.prototype.
|
|
2134
|
-
if (transaction.
|
|
1408
|
+
BatchRequest.prototype.buildTransaction = function (transaction) {
|
|
1409
|
+
if (transaction.requests.length == 0)
|
|
2135
1410
|
return;
|
|
2136
1411
|
var builder = new BlobBuilder_1.BlobBuilder();
|
|
2137
1412
|
builder.append(BatchRequest.constants.newLine);
|
|
2138
|
-
var changeset = this.
|
|
1413
|
+
var changeset = this.createBoundary("sf_changeset_");
|
|
2139
1414
|
builder.append('Content-Type: multipart/mixed; boundary=' + changeset);
|
|
2140
|
-
var changesetRequests = transaction.
|
|
1415
|
+
var changesetRequests = transaction.requests;
|
|
2141
1416
|
for (var index = 0; index < changesetRequests.length; index += 1) {
|
|
2142
1417
|
var currentRequest = changesetRequests[index].request;
|
|
2143
1418
|
// we shouldn't add new lines after blob content. Otherwise they are added to the blob and corrupt it
|
|
2144
|
-
var shouldAddNewLine = index === 0 || !utils_1.utils.isBlob(changesetRequests[index - 1].request.
|
|
2145
|
-
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) +
|
|
2146
1421
|
BatchRequest.constants.newLine + 'Content-Type: application/http' +
|
|
2147
1422
|
BatchRequest.constants.newLine + 'Content-Transfer-Encoding: binary' +
|
|
2148
1423
|
BatchRequest.constants.newLine + 'Content-ID: ' + changesetRequests[index].id);
|
|
2149
|
-
var requestUrl = currentRequest.
|
|
2150
|
-
builder.append(BatchRequest.constants.newLine + BatchRequest.constants.newLine + currentRequest.
|
|
2151
|
-
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();
|
|
2152
1427
|
var headerNames = Object.keys(headers);
|
|
2153
1428
|
for (var i = 0; i < headerNames.length; i++) {
|
|
2154
1429
|
var headerName = headerNames[i];
|
|
2155
1430
|
builder.append(BatchRequest.constants.newLine + headerName + ": " + headers[headerName]);
|
|
2156
1431
|
}
|
|
2157
|
-
var body = currentRequest.
|
|
1432
|
+
var body = utils_1.utils.serializeToJSON(currentRequest.getBody());
|
|
2158
1433
|
if (body) {
|
|
2159
1434
|
builder.append(BatchRequest.constants.newLine + BatchRequest.constants.newLine);
|
|
2160
1435
|
builder.append(body);
|
|
2161
1436
|
}
|
|
2162
1437
|
}
|
|
2163
|
-
builder.append(this.
|
|
1438
|
+
builder.append(this.createDelimeter(changeset, true));
|
|
2164
1439
|
return builder.build();
|
|
2165
1440
|
};
|
|
2166
|
-
BatchRequest.prototype.
|
|
1441
|
+
BatchRequest.prototype.createDelimeter = function (boundary, close, shouldAddNewLine) {
|
|
2167
1442
|
if (shouldAddNewLine === void 0) { shouldAddNewLine = true; }
|
|
2168
1443
|
var result = "";
|
|
2169
1444
|
if (shouldAddNewLine) {
|
|
@@ -2176,21 +1451,24 @@ var BatchRequest = /** @class */ (function (_super) {
|
|
|
2176
1451
|
}
|
|
2177
1452
|
return result;
|
|
2178
1453
|
};
|
|
2179
|
-
BatchRequest.prototype.
|
|
1454
|
+
BatchRequest.prototype.createBoundary = function (prefix) {
|
|
2180
1455
|
return prefix + utils_1.utils.hex16() + '-' + utils_1.utils.hex16() + '-' + utils_1.utils.hex16();
|
|
2181
1456
|
};
|
|
2182
1457
|
BatchRequest.prototype.addRequest = function (request) {
|
|
2183
|
-
|
|
1458
|
+
this.requests.push({ id: this.counter, request: request });
|
|
1459
|
+
return this.counter++;
|
|
2184
1460
|
};
|
|
2185
1461
|
BatchRequest.prototype.urlParametersClone = function (entitySet) {
|
|
2186
|
-
|
|
1462
|
+
var options = utils_1.utils.clone(this.urlOptions);
|
|
1463
|
+
options.entitySet = entitySet;
|
|
1464
|
+
return options;
|
|
2187
1465
|
};
|
|
2188
1466
|
BatchRequest.constants = {
|
|
2189
1467
|
newLine: '\r\n'
|
|
2190
1468
|
};
|
|
2191
1469
|
return BatchRequest;
|
|
2192
|
-
}(
|
|
2193
|
-
|
|
1470
|
+
}(ExecutableRequest_1.ExecutableRequest));
|
|
1471
|
+
exports.BatchRequest = BatchRequest;
|
|
2194
1472
|
|
|
2195
1473
|
|
|
2196
1474
|
/***/ }),
|
|
@@ -2199,90 +1477,70 @@ module.exports = BatchRequest;
|
|
|
2199
1477
|
/*!*******************************************!*\
|
|
2200
1478
|
!*** ./src/Requests/ExecutableRequest.ts ***!
|
|
2201
1479
|
\*******************************************/
|
|
2202
|
-
|
|
2203
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1480
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2204
1481
|
|
|
2205
|
-
"use strict";
|
|
2206
1482
|
|
|
2207
|
-
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");
|
|
2208
1487
|
var utils_1 = __webpack_require__(/*! ../utils */ "./src/utils.ts");
|
|
2209
|
-
var
|
|
1488
|
+
var constants_1 = __webpack_require__(/*! ../constants */ "./src/constants.ts");
|
|
2210
1489
|
var XMLHttpRequestDone = 4;
|
|
2211
|
-
function
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
var
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
return this.request._getQueryString(urlOptions);
|
|
2224
|
-
};
|
|
2225
|
-
this._buildUrl = function () {
|
|
2226
|
-
return this.request._buildUrl();
|
|
2227
|
-
};
|
|
2228
|
-
this.request = options.request;
|
|
2229
|
-
this.handlers = options.handlers;
|
|
2230
|
-
this.token = options.token;
|
|
2231
|
-
this.enableUnlimitedChoices = options.enableUnlimitedChoices;
|
|
2232
|
-
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;
|
|
2233
1502
|
}
|
|
2234
1503
|
ExecutableRequest.prototype.execute = function () {
|
|
2235
|
-
this._execute();
|
|
2236
|
-
};
|
|
2237
|
-
ExecutableRequest.prototype._execute = function () {
|
|
2238
1504
|
var _this = this;
|
|
2239
1505
|
var http = new XMLHttpRequest();
|
|
2240
1506
|
http.onreadystatechange = function () {
|
|
2241
1507
|
if (http.readyState === XMLHttpRequestDone) {
|
|
2242
1508
|
if (http.status > 0) {
|
|
2243
|
-
var data = _this.
|
|
1509
|
+
var data = _this.parseResponse(http);
|
|
2244
1510
|
if (http.status >= 200 && http.status <= 206) {
|
|
2245
|
-
if (isFunction(_this.
|
|
2246
|
-
_this.
|
|
2247
|
-
}
|
|
2248
|
-
if (_this.handlers && isFunction(_this.handlers.successCb)) {
|
|
2249
|
-
_this.handlers.successCb(data);
|
|
1511
|
+
if (utils_1.utils.isFunction(_this.successCb)) {
|
|
1512
|
+
_this.successCb(data);
|
|
2250
1513
|
}
|
|
2251
1514
|
}
|
|
2252
1515
|
else if (http.status >= 400) {
|
|
2253
1516
|
// When the data is string, we save the string as message
|
|
2254
1517
|
// and convert the data to normal object with message property
|
|
2255
1518
|
if (utils_1.utils.isString(data)) {
|
|
2256
|
-
var message = data;
|
|
2257
1519
|
data = {
|
|
2258
|
-
message:
|
|
1520
|
+
message: data
|
|
2259
1521
|
};
|
|
2260
1522
|
}
|
|
2261
1523
|
data.status = http.status;
|
|
2262
1524
|
// in case of errors we would like there to be one handler for all of the errors
|
|
2263
|
-
if (isFunction(_this.
|
|
2264
|
-
_this.
|
|
2265
|
-
}
|
|
2266
|
-
if (_this.handlers && isFunction(_this.handlers.failureCb)) {
|
|
2267
|
-
_this.handlers.failureCb(data);
|
|
1525
|
+
if (utils_1.utils.isFunction(_this.failureCb)) {
|
|
1526
|
+
_this.failureCb(data);
|
|
2268
1527
|
}
|
|
2269
1528
|
}
|
|
2270
1529
|
}
|
|
2271
1530
|
}
|
|
2272
1531
|
};
|
|
2273
|
-
if (isFunction(this.
|
|
1532
|
+
if (utils_1.utils.isFunction(this.progressCb)) {
|
|
2274
1533
|
if (http.upload) {
|
|
2275
|
-
var that = this;
|
|
2276
1534
|
http.upload.onprogress = function (event) {
|
|
2277
|
-
|
|
1535
|
+
_this.progressCb(event);
|
|
2278
1536
|
};
|
|
2279
1537
|
}
|
|
2280
1538
|
}
|
|
2281
|
-
var method = this.
|
|
2282
|
-
var url = this.
|
|
1539
|
+
var method = this.getMethod();
|
|
1540
|
+
var url = this.buildUrl();
|
|
2283
1541
|
http.open(method, url, true);
|
|
2284
|
-
this.setHeaders(http, this.
|
|
2285
|
-
http.send(this.
|
|
1542
|
+
this.setHeaders(http, this.getHeaders());
|
|
1543
|
+
http.send(utils_1.utils.serializeToJSON(this.getBody()));
|
|
2286
1544
|
};
|
|
2287
1545
|
ExecutableRequest.prototype.setHeaders = function (http, headers) {
|
|
2288
1546
|
var headerKeys = Object.keys(headers);
|
|
@@ -2293,27 +1551,23 @@ var ExecutableRequest = /** @class */ (function () {
|
|
|
2293
1551
|
if (this.token) {
|
|
2294
1552
|
if (typeof this.token === 'string') {
|
|
2295
1553
|
// for backward compatibility
|
|
2296
|
-
http.setRequestHeader(
|
|
1554
|
+
http.setRequestHeader(constants_1.HEADER_NAMES.authorization, this.token);
|
|
2297
1555
|
}
|
|
2298
1556
|
else {
|
|
2299
|
-
http.setRequestHeader(
|
|
1557
|
+
http.setRequestHeader(constants_1.HEADER_NAMES.authorization, this.token.type + " " + this.token.value);
|
|
2300
1558
|
}
|
|
2301
1559
|
}
|
|
2302
1560
|
if (this.enableUnlimitedChoices) {
|
|
2303
|
-
http.setRequestHeader(
|
|
1561
|
+
http.setRequestHeader(constants_1.HEADER_NAMES.choicesBinaryRepresentation, "true");
|
|
2304
1562
|
}
|
|
2305
1563
|
if (this.integrationMode) {
|
|
2306
|
-
http.setRequestHeader(
|
|
1564
|
+
http.setRequestHeader(constants_1.HEADER_NAMES.integrationMode, "true");
|
|
2307
1565
|
}
|
|
2308
1566
|
// for backward compatibility
|
|
2309
|
-
http.setRequestHeader(
|
|
2310
|
-
};
|
|
2311
|
-
ExecutableRequest.prototype._getBody = function () {
|
|
2312
|
-
var body = utils_1.utils.serializeToJSON(this.request._getBody());
|
|
2313
|
-
return body;
|
|
1567
|
+
http.setRequestHeader(constants_1.HEADER_NAMES.serviceRequest, "true");
|
|
2314
1568
|
};
|
|
2315
1569
|
return ExecutableRequest;
|
|
2316
|
-
}());
|
|
1570
|
+
}(RequestBase_1.RequestBase));
|
|
2317
1571
|
exports.ExecutableRequest = ExecutableRequest;
|
|
2318
1572
|
|
|
2319
1573
|
|
|
@@ -2323,389 +1577,383 @@ exports.ExecutableRequest = ExecutableRequest;
|
|
|
2323
1577
|
/*!*********************************!*\
|
|
2324
1578
|
!*** ./src/Requests/Request.ts ***!
|
|
2325
1579
|
\*********************************/
|
|
2326
|
-
|
|
2327
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1580
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2328
1581
|
|
|
2329
|
-
"use strict";
|
|
2330
1582
|
|
|
2331
|
-
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;
|
|
2332
1585
|
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
|
|
1586
|
+
var constants_1 = __webpack_require__(/*! ../constants */ "./src/constants.ts");
|
|
2333
1587
|
var utils_1 = __webpack_require__(/*! ../utils */ "./src/utils.ts");
|
|
2334
|
-
var
|
|
2335
|
-
var headerNames = __webpack_require__(/*! ../Headers */ "./src/Headers.ts").headerNames;
|
|
2336
|
-
var contentTypes = __webpack_require__(/*! ../ContentTypes */ "./src/ContentTypes.ts").default;
|
|
2337
|
-
var httpMethods = __webpack_require__(/*! ../HttpMethods */ "./src/HttpMethods.ts").default;
|
|
2338
|
-
var RequestBase = /** @class */ (function () {
|
|
2339
|
-
function RequestBase(options) {
|
|
2340
|
-
this.successCb = options.successCb;
|
|
2341
|
-
this.failureCb = options.failureCb;
|
|
2342
|
-
this.urlOptions = options.urlOptions;
|
|
2343
|
-
this.progressCb = options.progressCb;
|
|
2344
|
-
this.key = options.key;
|
|
2345
|
-
this.action = options.action;
|
|
2346
|
-
this._fallbackProperties = options.fallbackProperties;
|
|
2347
|
-
}
|
|
2348
|
-
RequestBase.prototype._getBody = function () {
|
|
2349
|
-
return undefined;
|
|
2350
|
-
};
|
|
2351
|
-
RequestBase.prototype._getMethod = function () {
|
|
2352
|
-
return null;
|
|
2353
|
-
};
|
|
2354
|
-
RequestBase.prototype._getHeaders = function () {
|
|
2355
|
-
var headers = {};
|
|
2356
|
-
headers[headerNames.contentType] = contentTypes.json;
|
|
2357
|
-
return headers;
|
|
2358
|
-
};
|
|
2359
|
-
RequestBase.prototype._getQueryParameters = function (paramDictionary, urlOptions) {
|
|
2360
|
-
if (urlOptions.ODataParams) {
|
|
2361
|
-
var query = urlOptions.ODataParams.build();
|
|
2362
|
-
if (utils_1.utils.isString(query.$filter))
|
|
2363
|
-
paramDictionary[constants.ODataParams.$filter] = query.$filter;
|
|
2364
|
-
if (utils_1.utils.isString(query.$select))
|
|
2365
|
-
paramDictionary[constants.ODataParams.$select] = query.$select;
|
|
2366
|
-
if (utils_1.utils.isString(query.$expand))
|
|
2367
|
-
paramDictionary[constants.ODataParams.$expand] = query.$expand;
|
|
2368
|
-
if (utils_1.utils.isString(query.$orderby))
|
|
2369
|
-
paramDictionary[constants.ODataParams.$orderby] = query.$orderby;
|
|
2370
|
-
if (utils_1.utils.isNumber(query.$skip))
|
|
2371
|
-
paramDictionary[constants.ODataParams.$skip] = query.$skip;
|
|
2372
|
-
if (utils_1.utils.isNumber(query.$top))
|
|
2373
|
-
paramDictionary[constants.ODataParams.$top] = query.$top;
|
|
2374
|
-
if (utils_1.utils.isString(query.$search))
|
|
2375
|
-
paramDictionary[constants.ODataParams.$search] = query.$search;
|
|
2376
|
-
// inline count
|
|
2377
|
-
if (utils_1.utils.isBoolean(query.$count) && query.$count)
|
|
2378
|
-
paramDictionary[constants.ODataParams.$count] = query.$count;
|
|
2379
|
-
}
|
|
2380
|
-
if (urlOptions.SFParams) {
|
|
2381
|
-
var sfParams = urlOptions.SFParams;
|
|
2382
|
-
if (sfParams.provider) {
|
|
2383
|
-
paramDictionary[constants.SfParams.provider] = sfParams.provider;
|
|
2384
|
-
}
|
|
2385
|
-
if (sfParams.culture) {
|
|
2386
|
-
paramDictionary[constants.SfParams.culture] = sfParams.culture;
|
|
2387
|
-
}
|
|
2388
|
-
if (sfParams.siteId) {
|
|
2389
|
-
paramDictionary[constants.SfParams.siteId] = sfParams.siteId;
|
|
2390
|
-
}
|
|
2391
|
-
}
|
|
2392
|
-
if (this._fallbackProperties) {
|
|
2393
|
-
paramDictionary["sf_fallback_prop_names"] = this._fallbackProperties.join();
|
|
2394
|
-
}
|
|
2395
|
-
if (urlOptions.additionalQueryParams) {
|
|
2396
|
-
for (var key in urlOptions.additionalQueryParams) {
|
|
2397
|
-
if (urlOptions.additionalQueryParams.hasOwnProperty(key)) {
|
|
2398
|
-
paramDictionary[key] = urlOptions.additionalQueryParams[key];
|
|
2399
|
-
}
|
|
2400
|
-
}
|
|
2401
|
-
}
|
|
2402
|
-
};
|
|
2403
|
-
RequestBase.prototype._getQueryString = function (urlOptions) {
|
|
2404
|
-
var paramDictionary = {};
|
|
2405
|
-
this._getQueryParameters(paramDictionary, urlOptions);
|
|
2406
|
-
var keys = Object.keys(paramDictionary);
|
|
2407
|
-
if (keys.length == 0)
|
|
2408
|
-
return null;
|
|
2409
|
-
var queryString = "?";
|
|
2410
|
-
for (var prop in paramDictionary) {
|
|
2411
|
-
queryString += prop + "=" + paramDictionary[prop] + "&";
|
|
2412
|
-
}
|
|
2413
|
-
queryString = queryString.substring(0, queryString.length - 1);
|
|
2414
|
-
return queryString;
|
|
2415
|
-
};
|
|
2416
|
-
RequestBase.prototype._buildUrl = function () {
|
|
2417
|
-
var url = this.urlOptions.baseUrl + (this.urlOptions.entitySet || "");
|
|
2418
|
-
url += this.key ? ("(" + this.key + ")") : "";
|
|
2419
|
-
if (this.action) {
|
|
2420
|
-
url += url.endsWith("/") ? "" : "/";
|
|
2421
|
-
url += this.action;
|
|
2422
|
-
}
|
|
2423
|
-
// including count here
|
|
2424
|
-
// not the best solution as build() is called once more in getQueryString
|
|
2425
|
-
// but not that big of an issue right now
|
|
2426
|
-
if (this.urlOptions.ODataParams) {
|
|
2427
|
-
var getCount = this.urlOptions.ODataParams.build().$count;
|
|
2428
|
-
if (utils_1.utils.isBoolean(getCount) && !getCount) {
|
|
2429
|
-
url += "/$count";
|
|
2430
|
-
}
|
|
2431
|
-
}
|
|
2432
|
-
return this._addQueryParameters(url);
|
|
2433
|
-
};
|
|
2434
|
-
RequestBase.prototype._parseResponse = function (http) {
|
|
2435
|
-
var data = utils_1.utils.parseStringToJson(http.responseText);
|
|
2436
|
-
if (data) {
|
|
2437
|
-
if (http.status >= 400 && data.error) {
|
|
2438
|
-
return data.error;
|
|
2439
|
-
}
|
|
2440
|
-
return data;
|
|
2441
|
-
}
|
|
2442
|
-
return http.responseText;
|
|
2443
|
-
};
|
|
2444
|
-
RequestBase.prototype._addQueryParameters = function (url) {
|
|
2445
|
-
var queryString = this._getQueryString(this.urlOptions);
|
|
2446
|
-
if (queryString) {
|
|
2447
|
-
if (url.indexOf("?") > -1 && queryString[0] == "?") {
|
|
2448
|
-
queryString = "&" + queryString.substring(1);
|
|
2449
|
-
}
|
|
2450
|
-
url += queryString;
|
|
2451
|
-
}
|
|
2452
|
-
return url;
|
|
2453
|
-
};
|
|
2454
|
-
return RequestBase;
|
|
2455
|
-
}());
|
|
2456
|
-
exports.RequestBase = RequestBase;
|
|
1588
|
+
var ExecutableRequest_1 = __webpack_require__(/*! ./ExecutableRequest */ "./src/Requests/ExecutableRequest.ts");
|
|
2457
1589
|
var GetRequest = /** @class */ (function (_super) {
|
|
2458
1590
|
tslib_1.__extends(GetRequest, _super);
|
|
2459
|
-
function GetRequest(
|
|
2460
|
-
return _super.call(this,
|
|
1591
|
+
function GetRequest(requestOptions, token, sdkOptions) {
|
|
1592
|
+
return _super.call(this, requestOptions, token, sdkOptions) || this;
|
|
2461
1593
|
}
|
|
2462
|
-
GetRequest.prototype.
|
|
2463
|
-
return
|
|
1594
|
+
GetRequest.prototype.getMethod = function () {
|
|
1595
|
+
return constants_1.HTTP_METHODS.get;
|
|
2464
1596
|
};
|
|
2465
1597
|
return GetRequest;
|
|
2466
|
-
}(
|
|
1598
|
+
}(ExecutableRequest_1.ExecutableRequest));
|
|
2467
1599
|
exports.GetRequest = GetRequest;
|
|
2468
1600
|
var GetByIdRequest = /** @class */ (function (_super) {
|
|
2469
1601
|
tslib_1.__extends(GetByIdRequest, _super);
|
|
2470
|
-
function GetByIdRequest(
|
|
2471
|
-
return _super.call(this,
|
|
1602
|
+
function GetByIdRequest(requestOptions, token, sdkOptions) {
|
|
1603
|
+
return _super.call(this, requestOptions, token, sdkOptions) || this;
|
|
2472
1604
|
}
|
|
2473
|
-
GetByIdRequest.prototype.
|
|
2474
|
-
return
|
|
1605
|
+
GetByIdRequest.prototype.getMethod = function () {
|
|
1606
|
+
return constants_1.HTTP_METHODS.get;
|
|
2475
1607
|
};
|
|
2476
1608
|
return GetByIdRequest;
|
|
2477
|
-
}(
|
|
1609
|
+
}(ExecutableRequest_1.ExecutableRequest));
|
|
2478
1610
|
exports.GetByIdRequest = GetByIdRequest;
|
|
2479
1611
|
var DeleteRequest = /** @class */ (function (_super) {
|
|
2480
1612
|
tslib_1.__extends(DeleteRequest, _super);
|
|
2481
|
-
function DeleteRequest(
|
|
2482
|
-
return _super.call(this,
|
|
1613
|
+
function DeleteRequest(requestOptions, token, sdkOptions) {
|
|
1614
|
+
return _super.call(this, requestOptions, token, sdkOptions) || this;
|
|
2483
1615
|
}
|
|
2484
|
-
DeleteRequest.prototype.
|
|
2485
|
-
return
|
|
1616
|
+
DeleteRequest.prototype.getMethod = function () {
|
|
1617
|
+
return constants_1.HTTP_METHODS.delete;
|
|
2486
1618
|
};
|
|
2487
1619
|
return DeleteRequest;
|
|
2488
|
-
}(
|
|
1620
|
+
}(ExecutableRequest_1.ExecutableRequest));
|
|
2489
1621
|
exports.DeleteRequest = DeleteRequest;
|
|
2490
1622
|
var UpdateRequest = /** @class */ (function (_super) {
|
|
2491
1623
|
tslib_1.__extends(UpdateRequest, _super);
|
|
2492
|
-
function UpdateRequest(
|
|
2493
|
-
var _this = _super.call(this,
|
|
2494
|
-
_this.
|
|
2495
|
-
_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;
|
|
2496
1628
|
return _this;
|
|
2497
1629
|
}
|
|
2498
|
-
UpdateRequest.prototype.
|
|
2499
|
-
return
|
|
1630
|
+
UpdateRequest.prototype.getMethod = function () {
|
|
1631
|
+
return constants_1.HTTP_METHODS.patch;
|
|
2500
1632
|
};
|
|
2501
|
-
UpdateRequest.prototype.
|
|
2502
|
-
var body = utils_1.utils.convertDateFieldToISOString(this.
|
|
1633
|
+
UpdateRequest.prototype.getBody = function () {
|
|
1634
|
+
var body = utils_1.utils.convertDateFieldToISOString(this.data);
|
|
2503
1635
|
return body;
|
|
2504
1636
|
};
|
|
2505
|
-
UpdateRequest.prototype.
|
|
2506
|
-
var headers =
|
|
2507
|
-
if (this.
|
|
2508
|
-
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";
|
|
2509
1641
|
}
|
|
2510
1642
|
return headers;
|
|
2511
1643
|
};
|
|
2512
1644
|
return UpdateRequest;
|
|
2513
|
-
}(
|
|
1645
|
+
}(ExecutableRequest_1.ExecutableRequest));
|
|
2514
1646
|
exports.UpdateRequest = UpdateRequest;
|
|
2515
1647
|
var CreateRequest = /** @class */ (function (_super) {
|
|
2516
1648
|
tslib_1.__extends(CreateRequest, _super);
|
|
2517
|
-
function CreateRequest(
|
|
2518
|
-
var _this = _super.call(this,
|
|
2519
|
-
_this.
|
|
1649
|
+
function CreateRequest(requestOptions, token, sdkOptions) {
|
|
1650
|
+
var _this = _super.call(this, requestOptions, token, sdkOptions) || this;
|
|
1651
|
+
_this.data = requestOptions.data;
|
|
2520
1652
|
return _this;
|
|
2521
1653
|
}
|
|
2522
|
-
CreateRequest.prototype.
|
|
2523
|
-
return
|
|
1654
|
+
CreateRequest.prototype.getMethod = function () {
|
|
1655
|
+
return constants_1.HTTP_METHODS.post;
|
|
2524
1656
|
};
|
|
2525
|
-
CreateRequest.prototype.
|
|
2526
|
-
var body = utils_1.utils.convertDateFieldToISOString(this.
|
|
1657
|
+
CreateRequest.prototype.getBody = function () {
|
|
1658
|
+
var body = utils_1.utils.convertDateFieldToISOString(this.data);
|
|
2527
1659
|
return body;
|
|
2528
1660
|
};
|
|
2529
1661
|
return CreateRequest;
|
|
2530
|
-
}(
|
|
1662
|
+
}(ExecutableRequest_1.ExecutableRequest));
|
|
2531
1663
|
exports.CreateRequest = CreateRequest;
|
|
2532
1664
|
var GetRelatedRequest = /** @class */ (function (_super) {
|
|
2533
1665
|
tslib_1.__extends(GetRelatedRequest, _super);
|
|
2534
|
-
function GetRelatedRequest(
|
|
2535
|
-
var _this = _super.call(this,
|
|
2536
|
-
_this.
|
|
1666
|
+
function GetRelatedRequest(requestOptions, token, sdkOptions) {
|
|
1667
|
+
var _this = _super.call(this, requestOptions, token, sdkOptions) || this;
|
|
1668
|
+
_this.property = requestOptions.property;
|
|
2537
1669
|
return _this;
|
|
2538
1670
|
}
|
|
2539
|
-
GetRelatedRequest.prototype.
|
|
2540
|
-
var url = this.urlOptions.baseUrl + this.urlOptions.entitySet + "(" + this.key + ")/" + this.
|
|
2541
|
-
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);
|
|
2542
1674
|
};
|
|
2543
1675
|
return GetRelatedRequest;
|
|
2544
1676
|
}(GetByIdRequest));
|
|
2545
1677
|
exports.GetRelatedRequest = GetRelatedRequest;
|
|
2546
1678
|
var GetRelatedByIdRequest = /** @class */ (function (_super) {
|
|
2547
1679
|
tslib_1.__extends(GetRelatedByIdRequest, _super);
|
|
2548
|
-
function GetRelatedByIdRequest(
|
|
2549
|
-
var _this = _super.call(this,
|
|
2550
|
-
_this.
|
|
2551
|
-
_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;
|
|
2552
1684
|
return _this;
|
|
2553
1685
|
}
|
|
2554
|
-
GetRelatedByIdRequest.prototype.
|
|
2555
|
-
var url = this.urlOptions.baseUrl + this.urlOptions.entitySet + "(" + this.key + ")/" + this.
|
|
2556
|
-
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);
|
|
2557
1689
|
};
|
|
2558
1690
|
return GetRelatedByIdRequest;
|
|
2559
1691
|
}(GetByIdRequest));
|
|
2560
1692
|
exports.GetRelatedByIdRequest = GetRelatedByIdRequest;
|
|
2561
1693
|
var DeleteRelatedRequest = /** @class */ (function (_super) {
|
|
2562
1694
|
tslib_1.__extends(DeleteRelatedRequest, _super);
|
|
2563
|
-
function DeleteRelatedRequest(
|
|
2564
|
-
var _this = _super.call(this,
|
|
2565
|
-
_this.
|
|
1695
|
+
function DeleteRelatedRequest(requestOptions, token, sdkOptions) {
|
|
1696
|
+
var _this = _super.call(this, requestOptions, token, sdkOptions) || this;
|
|
1697
|
+
_this.property = requestOptions.property;
|
|
2566
1698
|
return _this;
|
|
2567
1699
|
}
|
|
2568
|
-
DeleteRelatedRequest.prototype.
|
|
2569
|
-
var url = this.urlOptions.baseUrl + this.urlOptions.entitySet + "(" + this.key + ")/" + this.
|
|
2570
|
-
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);
|
|
2571
1703
|
};
|
|
2572
1704
|
return DeleteRelatedRequest;
|
|
2573
1705
|
}(DeleteRequest));
|
|
2574
1706
|
exports.DeleteRelatedRequest = DeleteRelatedRequest;
|
|
2575
1707
|
var DeleteRelatedByIdRequest = /** @class */ (function (_super) {
|
|
2576
1708
|
tslib_1.__extends(DeleteRelatedByIdRequest, _super);
|
|
2577
|
-
function DeleteRelatedByIdRequest(
|
|
2578
|
-
var _this = _super.call(this,
|
|
2579
|
-
_this.
|
|
2580
|
-
_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;
|
|
2581
1713
|
return _this;
|
|
2582
1714
|
}
|
|
2583
|
-
DeleteRelatedByIdRequest.prototype.
|
|
2584
|
-
var url = this.urlOptions.baseUrl + this.urlOptions.entitySet + "(" + this.key + ")/" + this.
|
|
2585
|
-
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);
|
|
2586
1718
|
};
|
|
2587
1719
|
return DeleteRelatedByIdRequest;
|
|
2588
1720
|
}(DeleteRequest));
|
|
2589
1721
|
exports.DeleteRelatedByIdRequest = DeleteRelatedByIdRequest;
|
|
2590
1722
|
var CreateRelatedRequest = /** @class */ (function (_super) {
|
|
2591
1723
|
tslib_1.__extends(CreateRelatedRequest, _super);
|
|
2592
|
-
function CreateRelatedRequest(
|
|
2593
|
-
var _this = _super.call(this,
|
|
2594
|
-
_this.
|
|
2595
|
-
_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;
|
|
2596
1728
|
return _this;
|
|
2597
1729
|
}
|
|
2598
|
-
CreateRelatedRequest.prototype.
|
|
2599
|
-
var url = this.urlOptions.baseUrl + this.urlOptions.entitySet + "(" + this.key + ")/" + this.
|
|
2600
|
-
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);
|
|
2601
1733
|
};
|
|
2602
1734
|
return CreateRelatedRequest;
|
|
2603
1735
|
}(CreateRequest));
|
|
2604
1736
|
exports.CreateRelatedRequest = CreateRelatedRequest;
|
|
2605
1737
|
var UploadRequest = /** @class */ (function (_super) {
|
|
2606
1738
|
tslib_1.__extends(UploadRequest, _super);
|
|
2607
|
-
function UploadRequest(
|
|
2608
|
-
var _this = _super.call(this,
|
|
2609
|
-
_this.fileName =
|
|
2610
|
-
_this.uploadProperties =
|
|
2611
|
-
_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;
|
|
2612
1744
|
return _this;
|
|
2613
1745
|
}
|
|
2614
|
-
UploadRequest.prototype.
|
|
2615
|
-
var headers = _super.prototype.
|
|
2616
|
-
headers[
|
|
2617
|
-
headers[
|
|
2618
|
-
headers[
|
|
2619
|
-
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";
|
|
2620
1752
|
return headers;
|
|
2621
1753
|
};
|
|
2622
|
-
UploadRequest.prototype.
|
|
2623
|
-
return this.
|
|
1754
|
+
UploadRequest.prototype.getBody = function () {
|
|
1755
|
+
return this.data;
|
|
2624
1756
|
};
|
|
2625
|
-
UploadRequest.prototype.
|
|
1757
|
+
UploadRequest.prototype.getMethod = function () {
|
|
2626
1758
|
if (this.key) {
|
|
2627
|
-
return
|
|
1759
|
+
return constants_1.HTTP_METHODS.patch;
|
|
2628
1760
|
}
|
|
2629
|
-
return
|
|
1761
|
+
return constants_1.HTTP_METHODS.post;
|
|
2630
1762
|
};
|
|
2631
1763
|
return UploadRequest;
|
|
2632
1764
|
}(CreateRequest));
|
|
2633
1765
|
exports.UploadRequest = UploadRequest;
|
|
2634
1766
|
|
|
2635
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
|
+
|
|
2636
1900
|
/***/ }),
|
|
2637
1901
|
|
|
2638
1902
|
/***/ "./src/Requests/RequestFactory.ts":
|
|
2639
1903
|
/*!****************************************!*\
|
|
2640
1904
|
!*** ./src/Requests/RequestFactory.ts ***!
|
|
2641
1905
|
\****************************************/
|
|
2642
|
-
|
|
2643
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1906
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2644
1907
|
|
|
2645
|
-
"use strict";
|
|
2646
1908
|
|
|
2647
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1909
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1910
|
+
exports.RequestFactory = void 0;
|
|
2648
1911
|
var Request_1 = __webpack_require__(/*! ./Request */ "./src/Requests/Request.ts");
|
|
2649
|
-
var
|
|
2650
|
-
var BatchRequest = __webpack_require__(/*! ./BatchRequest */ "./src/Requests/BatchRequest.ts");
|
|
1912
|
+
var BatchRequest_1 = __webpack_require__(/*! ./BatchRequest */ "./src/Requests/BatchRequest.ts");
|
|
2651
1913
|
var RequestFactory = /** @class */ (function () {
|
|
2652
1914
|
function RequestFactory(options) {
|
|
2653
|
-
this.
|
|
2654
|
-
this.handlers = options.handlers;
|
|
2655
|
-
this.enableUnlimitedChoices = options.enableUnlimitedChoices;
|
|
2656
|
-
this.integrationMode = options.integrationMode;
|
|
1915
|
+
this.options = options;
|
|
2657
1916
|
}
|
|
2658
1917
|
RequestFactory.prototype.get = function (parameters) {
|
|
2659
|
-
return
|
|
1918
|
+
return new Request_1.GetRequest(parameters, this.token, this.options);
|
|
2660
1919
|
};
|
|
2661
1920
|
RequestFactory.prototype.getSingle = function (parameters) {
|
|
2662
|
-
return
|
|
1921
|
+
return new Request_1.GetByIdRequest(parameters, this.token, this.options);
|
|
2663
1922
|
};
|
|
2664
1923
|
RequestFactory.prototype.create = function (parameters) {
|
|
2665
|
-
return
|
|
1924
|
+
return new Request_1.CreateRequest(parameters, this.token, this.options);
|
|
2666
1925
|
};
|
|
2667
1926
|
RequestFactory.prototype.update = function (parameters) {
|
|
2668
|
-
return
|
|
1927
|
+
return new Request_1.UpdateRequest(parameters, this.token, this.options);
|
|
2669
1928
|
};
|
|
2670
1929
|
RequestFactory.prototype.destroy = function (parameters) {
|
|
2671
|
-
return
|
|
1930
|
+
return new Request_1.DeleteRequest(parameters, this.token, this.options);
|
|
2672
1931
|
};
|
|
2673
1932
|
RequestFactory.prototype.getProperty = function (parameters) {
|
|
2674
|
-
return
|
|
1933
|
+
return new Request_1.GetRelatedRequest(parameters, this.token, this.options);
|
|
2675
1934
|
};
|
|
2676
1935
|
RequestFactory.prototype.getRelated = function (parameters) {
|
|
2677
|
-
return
|
|
1936
|
+
return new Request_1.GetRelatedRequest(parameters, this.token, this.options);
|
|
2678
1937
|
};
|
|
2679
1938
|
RequestFactory.prototype.getRelatedById = function (parameters) {
|
|
2680
|
-
return
|
|
1939
|
+
return new Request_1.GetRelatedByIdRequest(parameters, this.token, this.options);
|
|
2681
1940
|
};
|
|
2682
1941
|
RequestFactory.prototype.destroyRelated = function (parameters) {
|
|
2683
|
-
return
|
|
1942
|
+
return new Request_1.DeleteRelatedRequest(parameters, this.token, this.options);
|
|
2684
1943
|
};
|
|
2685
1944
|
RequestFactory.prototype.destroyRelatedById = function (parameters) {
|
|
2686
|
-
return
|
|
1945
|
+
return new Request_1.DeleteRelatedByIdRequest(parameters, this.token, this.options);
|
|
2687
1946
|
};
|
|
2688
1947
|
RequestFactory.prototype.createRelated = function (parameters) {
|
|
2689
|
-
return
|
|
2690
|
-
};
|
|
2691
|
-
RequestFactory.prototype.batch = function (parameters) {
|
|
2692
|
-
parameters._factory = this;
|
|
2693
|
-
return new BatchRequest(parameters);
|
|
1948
|
+
return new Request_1.CreateRelatedRequest(parameters, this.token, this.options);
|
|
2694
1949
|
};
|
|
2695
1950
|
RequestFactory.prototype.upload = function (parameters) {
|
|
2696
|
-
return
|
|
2697
|
-
};
|
|
2698
|
-
RequestFactory.prototype.
|
|
2699
|
-
var
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
token: this.token,
|
|
2703
|
-
enableUnlimitedChoices: this.enableUnlimitedChoices,
|
|
2704
|
-
integrationMode: this.integrationMode
|
|
2705
|
-
});
|
|
2706
|
-
// TODO
|
|
2707
|
-
executor.navigationProperty = request.navigationProperty;
|
|
2708
|
-
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);
|
|
2709
1957
|
};
|
|
2710
1958
|
return RequestFactory;
|
|
2711
1959
|
}());
|
|
@@ -2718,170 +1966,57 @@ exports.RequestFactory = RequestFactory;
|
|
|
2718
1966
|
/*!***************************!*\
|
|
2719
1967
|
!*** ./src/Sitefinity.ts ***!
|
|
2720
1968
|
\***************************/
|
|
2721
|
-
|
|
2722
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
1969
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2723
1970
|
|
|
2724
|
-
"use strict";
|
|
2725
1971
|
|
|
2726
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1972
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1973
|
+
exports.Sitefinity = void 0;
|
|
2727
1974
|
var RequestFactory_1 = __webpack_require__(/*! ./Requests/RequestFactory */ "./src/Requests/RequestFactory.ts");
|
|
2728
|
-
var Authentication_1 = __webpack_require__(/*! ./Authentication */ "./src/Authentication.ts");
|
|
2729
1975
|
var Data_1 = __webpack_require__(/*! ./Data */ "./src/Data.ts");
|
|
2730
1976
|
var Query_1 = __webpack_require__(/*! ./Query */ "./src/Query.ts");
|
|
2731
1977
|
var utils_1 = __webpack_require__(/*! ./utils */ "./src/utils.ts");
|
|
2732
|
-
/**
|
|
2733
|
-
* @class Sitefinity
|
|
2734
|
-
* @classdesc The constructor of the Sitefinity JavaScript SDK. This is the entry point for the SDK.
|
|
2735
|
-
* @property {Object} authentication - The authentication object used for authenticating to Sitefinity. See {@link Authentication}
|
|
2736
|
-
* @param {object} options - An object containing configuration options for the Setup object.
|
|
2737
|
-
* @param {string} options.serviceUrl - Your service url that points to the configured instance of Sitefinity service.
|
|
2738
|
-
* @param {string} options.siteId - The ID of the site, for which the query will be executed.
|
|
2739
|
-
* @param {string} options.handlers - The global handlers for request execution
|
|
2740
|
-
* @param {string} options.handlers.successCb - The success handler.
|
|
2741
|
-
* @param {string} options.handlers.failureCb - The failure handler.
|
|
2742
|
-
*/
|
|
2743
1978
|
var Sitefinity = /** @class */ (function () {
|
|
1979
|
+
/**
|
|
1980
|
+
* The constructor of the Sitefinity JavaScript SDK. This is the entry point for the SDK.
|
|
1981
|
+
*/
|
|
2744
1982
|
function Sitefinity(options) {
|
|
2745
|
-
this.
|
|
1983
|
+
this.baseUrl = options.baseUrl;
|
|
2746
1984
|
this.siteId = options.siteId;
|
|
2747
|
-
this.factory = new RequestFactory_1.RequestFactory(
|
|
2748
|
-
handlers: options.handlers,
|
|
2749
|
-
enableUnlimitedChoices: options.enableUnlimitedChoices,
|
|
2750
|
-
integrationMode: options.integrationMode
|
|
2751
|
-
});
|
|
2752
|
-
this.authentication = new Authentication_1.Authentication({
|
|
2753
|
-
serviceUrl: this.profileUrl,
|
|
2754
|
-
factory: this.factory
|
|
2755
|
-
});
|
|
1985
|
+
this.factory = new RequestFactory_1.RequestFactory(options);
|
|
2756
1986
|
}
|
|
2757
|
-
/**
|
|
2758
|
-
* Creates a new {@link Data} class.
|
|
2759
|
-
* @memberOf Sitefinity
|
|
2760
|
-
* @instance
|
|
2761
|
-
* @param {object} options - An object containing configuration options for the Setup object.
|
|
2762
|
-
* @param {string} options.urlName - The URL name of the type..
|
|
2763
|
-
* @param {string} [options.providerName] - The name of the provider. If empty the default provider for the site will be used.
|
|
2764
|
-
* @param {string} [options.cultureName] - The name of the culture. If empty the default culture for the site will be used.
|
|
2765
|
-
* @example
|
|
2766
|
-
* var data = sf.data({
|
|
2767
|
-
* urlName: "newsitems",
|
|
2768
|
-
* providerName: "OpenAccessDataProvider",
|
|
2769
|
-
* cultureName: "en"
|
|
2770
|
-
* });
|
|
2771
|
-
* @returns {Data}
|
|
2772
|
-
*/
|
|
2773
1987
|
Sitefinity.prototype.data = function (options) {
|
|
2774
|
-
var
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
culture: options.cultureName,
|
|
2780
|
-
siteId: options.siteId || this.siteId
|
|
2781
|
-
},
|
|
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,
|
|
2782
1993
|
additionalQueryParams: options.additionalQueryParams,
|
|
2783
|
-
entitySet: options.
|
|
1994
|
+
entitySet: options.entitySet
|
|
2784
1995
|
};
|
|
2785
|
-
|
|
2786
|
-
return new Data_1.Data(dataOptions, this.factory);
|
|
1996
|
+
return new Data_1.Data(urlOptions, this.factory);
|
|
2787
1997
|
};
|
|
2788
|
-
/**
|
|
2789
|
-
* 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}
|
|
2790
|
-
* @memberOf Sitefinity
|
|
2791
|
-
* @instance
|
|
2792
|
-
* @param {Function} success - The success callback of the batch execution.
|
|
2793
|
-
* @param {string} options.urlName - The URL name of the type..
|
|
2794
|
-
* @param {string} [options.providerName] - The name of the provider. If empty the default provider for the site will be used.
|
|
2795
|
-
* @param {string} [options.cultureName] - The name of the culture. If empty the default culture for the site will be used.
|
|
2796
|
-
* @example
|
|
2797
|
-
* var sf = new Sitefinity({
|
|
2798
|
-
* serviceUrl: 'http://mydomain/route/service/'
|
|
2799
|
-
* });
|
|
2800
|
-
*
|
|
2801
|
-
* var batch = sf.batch(successCbBatch, failureCb);
|
|
2802
|
-
* batch.get({
|
|
2803
|
-
* entitySet: entitySet,
|
|
2804
|
-
* query: query8
|
|
2805
|
-
* });
|
|
2806
|
-
*
|
|
2807
|
-
* var transaction = batch.beginTransaction();
|
|
2808
|
-
* var createId = transaction.create({
|
|
2809
|
-
* entitySet: entitySet,
|
|
2810
|
-
* data: newsItem
|
|
2811
|
-
* });
|
|
2812
|
-
*
|
|
2813
|
-
* batch.endTransaction(transaction);
|
|
2814
|
-
*
|
|
2815
|
-
* var transaction2 = batch.beginTransaction();
|
|
2816
|
-
* var createId2 = transaction2.create({
|
|
2817
|
-
* entitySet: entitySet,
|
|
2818
|
-
* data: newsItem
|
|
2819
|
-
* });
|
|
2820
|
-
*
|
|
2821
|
-
* var updateId2 = transaction2.update({
|
|
2822
|
-
* entitySet: entitySet,
|
|
2823
|
-
* key: createId2,
|
|
2824
|
-
* data: newsItemUpdate
|
|
2825
|
-
* });
|
|
2826
|
-
*
|
|
2827
|
-
* batch.endTransaction(transaction2);
|
|
2828
|
-
*
|
|
2829
|
-
* batch.get({
|
|
2830
|
-
* entitySet: entitySet
|
|
2831
|
-
* });
|
|
2832
|
-
*
|
|
2833
|
-
* batch.execute();
|
|
2834
|
-
* @returns {BatchRequest}
|
|
2835
|
-
*/
|
|
2836
1998
|
Sitefinity.prototype.batch = function (success, failure, progress, options) {
|
|
2837
|
-
if (typeof progress !== 'function') {
|
|
2838
|
-
options = progress;
|
|
2839
|
-
progress = null;
|
|
2840
|
-
}
|
|
2841
1999
|
if (!options)
|
|
2842
2000
|
options = {};
|
|
2843
|
-
this.factory.token = this.authentication.getToken();
|
|
2844
|
-
var optionsServiceUrl = options.serviceUrl ? utils_1.utils.addTrailingSlash(options.serviceUrl) : options.serviceUrl;
|
|
2845
2001
|
var batch = this.factory.batch({
|
|
2846
2002
|
successCb: success,
|
|
2847
2003
|
failureCb: failure,
|
|
2848
2004
|
progressCb: progress,
|
|
2849
2005
|
urlOptions: {
|
|
2850
|
-
baseUrl:
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
siteId: options.siteId || this.siteId
|
|
2855
|
-
},
|
|
2006
|
+
baseUrl: utils_1.utils.addTrailingSlash(options.baseUrl || this.baseUrl),
|
|
2007
|
+
provider: options.provider,
|
|
2008
|
+
culture: options.culture,
|
|
2009
|
+
siteId: options.siteId || this.siteId,
|
|
2856
2010
|
additionalQueryParams: options.additionalQueryParams
|
|
2857
2011
|
}
|
|
2858
2012
|
});
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
executor.get = function (options) {
|
|
2867
|
-
batch.constructor.prototype.get.call(batch, options);
|
|
2868
|
-
};
|
|
2869
|
-
executor.getOperations = function (options) {
|
|
2870
|
-
batch.constructor.prototype.getOperations.call(batch, options);
|
|
2871
|
-
};
|
|
2872
|
-
executor.getSingle = function (options) {
|
|
2873
|
-
batch.constructor.prototype.getSingle.call(batch, options);
|
|
2874
|
-
};
|
|
2875
|
-
executor.getProperty = function (options) {
|
|
2876
|
-
batch.constructor.prototype.getProperty.call(batch, options);
|
|
2877
|
-
};
|
|
2878
|
-
executor.getRelated = function (options) {
|
|
2879
|
-
batch.constructor.prototype.getRelated.call(batch, options);
|
|
2880
|
-
};
|
|
2881
|
-
executor.getRelatedById = function (options) {
|
|
2882
|
-
batch.constructor.prototype.getRelatedById.call(batch, options);
|
|
2883
|
-
};
|
|
2884
|
-
return executor;
|
|
2013
|
+
return batch;
|
|
2014
|
+
};
|
|
2015
|
+
/**
|
|
2016
|
+
* Sets the authentication token.
|
|
2017
|
+
*/
|
|
2018
|
+
Sitefinity.prototype.setToken = function (token) {
|
|
2019
|
+
this.factory.token = token;
|
|
2885
2020
|
};
|
|
2886
2021
|
Sitefinity.Query = Query_1.Query;
|
|
2887
2022
|
return Sitefinity;
|
|
@@ -2895,198 +2030,129 @@ exports.Sitefinity = Sitefinity;
|
|
|
2895
2030
|
/*!***************************!*\
|
|
2896
2031
|
!*** ./src/WhereQuery.ts ***!
|
|
2897
2032
|
\***************************/
|
|
2898
|
-
|
|
2899
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2033
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
2900
2034
|
|
|
2901
|
-
"use strict";
|
|
2902
2035
|
|
|
2903
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2036
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2037
|
+
exports.WhereQuery = void 0;
|
|
2904
2038
|
var Expression_1 = __webpack_require__(/*! ./Expression */ "./src/Expression.ts");
|
|
2905
|
-
var
|
|
2039
|
+
var constants_1 = __webpack_require__(/*! ./constants */ "./src/constants.ts");
|
|
2906
2040
|
/**
|
|
2907
|
-
*
|
|
2908
|
-
* @class WhereQuery
|
|
2909
|
-
* @protected
|
|
2041
|
+
* A fluent API operation for creating a filter for a query by chaining different rules.
|
|
2910
2042
|
*/
|
|
2911
2043
|
var WhereQuery = /** @class */ (function () {
|
|
2912
2044
|
function WhereQuery(parent, type) {
|
|
2913
|
-
if (type === void 0) { type =
|
|
2045
|
+
if (type === void 0) { type = constants_1.EXPRESSION_TYPE.and; }
|
|
2914
2046
|
this.parent = parent;
|
|
2915
2047
|
this.expression = new Expression_1.ComplexExpression(type, []);
|
|
2916
2048
|
}
|
|
2917
2049
|
/**
|
|
2918
2050
|
* Adds an `and` clause to the current condition and returns it for further chaining.
|
|
2919
|
-
* @method and
|
|
2920
|
-
* @memberOf WhereQuery.prototype
|
|
2921
|
-
* @returns {WhereQuery}
|
|
2922
2051
|
*/
|
|
2923
2052
|
WhereQuery.prototype.and = function () {
|
|
2924
|
-
return new WhereQuery(this,
|
|
2053
|
+
return new WhereQuery(this, constants_1.EXPRESSION_TYPE.and);
|
|
2925
2054
|
};
|
|
2926
2055
|
/**
|
|
2927
2056
|
* Adds an `or` clause to the current condition and returns it for further chaining.
|
|
2928
|
-
* @method or
|
|
2929
|
-
* @memberOf WhereQuery.prototype
|
|
2930
|
-
* @returns {WhereQuery}
|
|
2931
2057
|
*/
|
|
2932
2058
|
WhereQuery.prototype.or = function () {
|
|
2933
|
-
return new WhereQuery(this,
|
|
2059
|
+
return new WhereQuery(this, constants_1.EXPRESSION_TYPE.or);
|
|
2934
2060
|
};
|
|
2935
2061
|
/**
|
|
2936
2062
|
* Adds an `any` clause to the current condition and returns it for further chaining.
|
|
2937
|
-
* @method any
|
|
2938
|
-
* @memberOf WhereQuery.prototype
|
|
2939
|
-
* @returns {WhereQuery}
|
|
2940
2063
|
*/
|
|
2941
2064
|
WhereQuery.prototype.any = function () {
|
|
2942
|
-
return new WhereQuery(this,
|
|
2065
|
+
return new WhereQuery(this, constants_1.EXPRESSION_TYPE.any);
|
|
2943
2066
|
};
|
|
2944
2067
|
/**
|
|
2945
2068
|
* Adds a `not` clause to the current condition and returns it for further chaining.
|
|
2946
|
-
* @method not
|
|
2947
|
-
* @memberOf WhereQuery.prototype
|
|
2948
|
-
* @returns {WhereQuery}
|
|
2949
2069
|
*/
|
|
2950
2070
|
WhereQuery.prototype.not = function () {
|
|
2951
|
-
return new WhereQuery(this,
|
|
2952
|
-
};
|
|
2953
|
-
WhereQuery.prototype._simple = function (type, parameter, constant, caseSensitive) {
|
|
2954
|
-
if (caseSensitive === void 0) { caseSensitive = true; }
|
|
2955
|
-
var currentExpr = new Expression_1.BinaryExpression(type, parameter, constant, caseSensitive);
|
|
2956
|
-
var subExpressions = this.expression.getExpressions();
|
|
2957
|
-
subExpressions.push(currentExpr);
|
|
2958
|
-
if (this.expression.getType() === OperatorType.not && subExpressions.length > 1)
|
|
2959
|
-
throw new Error("Invalid operators count!");
|
|
2960
|
-
return this;
|
|
2071
|
+
return new WhereQuery(this, constants_1.EXPRESSION_TYPE.not);
|
|
2961
2072
|
};
|
|
2962
2073
|
/**
|
|
2963
2074
|
* Adds a condition that a field must be equal to a specific value.
|
|
2964
|
-
* @method eq
|
|
2965
|
-
* @memberOf WhereQuery.prototype
|
|
2966
|
-
* @param {string} field Field name.
|
|
2967
|
-
* @param {*} value Comparison value (to which the fields must be equal).
|
|
2968
|
-
* @returns {WhereQuery}
|
|
2969
2075
|
*/
|
|
2970
2076
|
WhereQuery.prototype.eq = function (parameter, constant) {
|
|
2971
|
-
return this.
|
|
2077
|
+
return this.simple(constants_1.EXPRESSION_TYPE.eq, parameter, constant);
|
|
2972
2078
|
};
|
|
2973
2079
|
/**
|
|
2974
2080
|
* Adds a condition that a field must *not* be equal to a specific value.
|
|
2975
|
-
* @method ne
|
|
2976
|
-
* @memberOf WhereQuery.prototype
|
|
2977
|
-
* @param {string} field Field name.
|
|
2978
|
-
* @param {*} value Comparison value (to which the field must not be equal).
|
|
2979
|
-
* @returns {WhereQuery}
|
|
2980
2081
|
*/
|
|
2981
2082
|
WhereQuery.prototype.ne = function (parameter, constant) {
|
|
2982
|
-
return this.
|
|
2083
|
+
return this.simple(constants_1.EXPRESSION_TYPE.ne, parameter, constant);
|
|
2983
2084
|
};
|
|
2984
2085
|
/**
|
|
2985
2086
|
* Adds a condition that a field must be `greater than` a certain value. Applicable to Number, String, and Date fields.
|
|
2986
|
-
* @method gt
|
|
2987
|
-
* @memberOf WhereQuery.prototype
|
|
2988
|
-
* @param {string} field Field name.
|
|
2989
|
-
* @param {*} value Comparison value (that the field should be greater than).
|
|
2990
|
-
* @returns {WhereQuery}
|
|
2991
2087
|
*/
|
|
2992
2088
|
WhereQuery.prototype.gt = function (parameter, constant) {
|
|
2993
|
-
return this.
|
|
2089
|
+
return this.simple(constants_1.EXPRESSION_TYPE.gt, parameter, constant);
|
|
2994
2090
|
};
|
|
2995
2091
|
/**
|
|
2996
2092
|
* Adds a condition that a field must be `greater than or equal` to a certain value. Applicable to Number, String, and Date fields.
|
|
2997
|
-
* @method gte
|
|
2998
|
-
* @memberOf WhereQuery.prototype
|
|
2999
|
-
* @param {string} field Field name.
|
|
3000
|
-
* @param {*} value Comparison value (that the field should be greater than or equal to).
|
|
3001
|
-
* @returns {WhereQuery}
|
|
3002
2093
|
*/
|
|
3003
2094
|
WhereQuery.prototype.gte = function (parameter, constant) {
|
|
3004
|
-
return this.
|
|
2095
|
+
return this.simple(constants_1.EXPRESSION_TYPE.ge, parameter, constant);
|
|
3005
2096
|
};
|
|
3006
2097
|
/**
|
|
3007
2098
|
* Adds a condition that a field must be `less than` a certain value. Applicable to Number, String, and Date fields.
|
|
3008
|
-
* @method lt
|
|
3009
|
-
* @memberOf WhereQuery.prototype
|
|
3010
|
-
* @param {string} field Field name.
|
|
3011
|
-
* @param {*} value Comparison value (that the field should be less than).
|
|
3012
|
-
* @returns {WhereQuery}
|
|
3013
2099
|
*/
|
|
3014
2100
|
WhereQuery.prototype.lt = function (parameter, constant) {
|
|
3015
|
-
return this.
|
|
2101
|
+
return this.simple(constants_1.EXPRESSION_TYPE.lt, parameter, constant);
|
|
3016
2102
|
};
|
|
3017
2103
|
/**
|
|
3018
2104
|
* Adds a condition that a field must be `less than or equal` to a certain value. Applicable to Number, String, and Date fields.
|
|
3019
|
-
* @method lte
|
|
3020
|
-
* @memberOf WhereQuery.prototype
|
|
3021
|
-
* @param {string} field Field name.
|
|
3022
|
-
* @param {*} value Comparison value (that the field should be less than or equal to).
|
|
3023
|
-
* @returns {WhereQuery}
|
|
3024
2105
|
*/
|
|
3025
2106
|
WhereQuery.prototype.lte = function (parameter, constant) {
|
|
3026
|
-
return this.
|
|
2107
|
+
return this.simple(constants_1.EXPRESSION_TYPE.le, parameter, constant);
|
|
3027
2108
|
};
|
|
3028
2109
|
/**
|
|
3029
2110
|
* Adds a condition that a field value must *start* with a specified string.
|
|
3030
|
-
* @method startsWith
|
|
3031
|
-
* @memberOf WhereQuery.prototype
|
|
3032
|
-
* @param {string} field Field name.
|
|
3033
|
-
* @param {string} value The string that the field should start with.
|
|
3034
|
-
* @param {boolean} caseSensitive A flag indicating if tolower should be applied to the parameter
|
|
3035
|
-
* @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.
|
|
3036
|
-
* @returns {WhereQuery}
|
|
3037
2111
|
*/
|
|
3038
2112
|
WhereQuery.prototype.startsWith = function (parameter, constant, caseSensitive) {
|
|
3039
2113
|
if (caseSensitive === void 0) { caseSensitive = true; }
|
|
3040
|
-
return this.
|
|
2114
|
+
return this.simple(constants_1.EXPRESSION_TYPE.startsWith, parameter, constant, caseSensitive);
|
|
3041
2115
|
};
|
|
3042
2116
|
/**
|
|
3043
2117
|
* Adds a condition that a field value must *contain* a specified string.
|
|
3044
|
-
* @method startsWith
|
|
3045
|
-
* @memberOf WhereQuery.prototype
|
|
3046
|
-
* @param {string} field Field name.
|
|
3047
|
-
* @param {string} value The string that the field should start with.
|
|
3048
|
-
* @param {boolean} caseSensitive A flag indicating if tolower should be applied to the parameter
|
|
3049
|
-
* @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.
|
|
3050
|
-
* @returns {WhereQuery}
|
|
3051
2118
|
*/
|
|
3052
2119
|
WhereQuery.prototype.contains = function (parameter, constant, caseSensitive) {
|
|
3053
2120
|
if (caseSensitive === void 0) { caseSensitive = true; }
|
|
3054
|
-
return this.
|
|
2121
|
+
return this.simple(constants_1.EXPRESSION_TYPE.contains, parameter, constant, caseSensitive);
|
|
3055
2122
|
};
|
|
3056
2123
|
/**
|
|
3057
2124
|
* Adds a condition that a field value must *end* with a specified string.
|
|
3058
|
-
* @method endsWith
|
|
3059
|
-
* @memberOf WhereQuery.prototype
|
|
3060
|
-
* @param {string} field Field name.
|
|
3061
|
-
* @param {string} value The string that the field should end with.
|
|
3062
|
-
* @param {boolean} caseSensitive A flag indicating if tolower should be applied to the parameter
|
|
3063
|
-
* @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.
|
|
3064
|
-
* @returns {WhereQuery}
|
|
3065
2125
|
*/
|
|
3066
2126
|
WhereQuery.prototype.endsWith = function (parameter, constant, caseSensitive) {
|
|
3067
2127
|
if (caseSensitive === void 0) { caseSensitive = true; }
|
|
3068
|
-
return this.
|
|
2128
|
+
return this.simple(constants_1.EXPRESSION_TYPE.endsWith, parameter, constant, caseSensitive);
|
|
3069
2129
|
};
|
|
3070
2130
|
/**
|
|
3071
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.
|
|
3072
|
-
* @method done
|
|
3073
|
-
* @memberOf WhereQuery.prototype
|
|
3074
|
-
* @returns {Query}
|
|
3075
2132
|
*/
|
|
3076
2133
|
WhereQuery.prototype.done = function () {
|
|
3077
2134
|
if (this.parent instanceof WhereQuery) {
|
|
3078
|
-
this.parent.
|
|
2135
|
+
this.parent.addComplexExpression(this);
|
|
3079
2136
|
// TODO: If has and() || or() must call done() twice
|
|
3080
|
-
if (this.expression.getType() ===
|
|
2137
|
+
if (this.expression.getType() === constants_1.EXPRESSION_TYPE.not)
|
|
3081
2138
|
return this.parent;
|
|
3082
2139
|
}
|
|
3083
2140
|
return this.parent;
|
|
3084
2141
|
};
|
|
3085
|
-
WhereQuery.prototype.
|
|
2142
|
+
WhereQuery.prototype.getExpression = function () {
|
|
3086
2143
|
return this.expression;
|
|
3087
2144
|
};
|
|
3088
|
-
WhereQuery.prototype.
|
|
3089
|
-
|
|
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();
|
|
3090
2156
|
this.expression.getExpressions().push(subExpression);
|
|
3091
2157
|
};
|
|
3092
2158
|
return WhereQuery;
|
|
@@ -3100,68 +2166,66 @@ exports.WhereQuery = WhereQuery;
|
|
|
3100
2166
|
/*!**************************!*\
|
|
3101
2167
|
!*** ./src/constants.ts ***!
|
|
3102
2168
|
\**************************/
|
|
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
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
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"
|
|
3147
2228
|
};
|
|
3148
|
-
exports.default = constants;
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
/***/ }),
|
|
3152
|
-
|
|
3153
|
-
/***/ "./src/main.ts":
|
|
3154
|
-
/*!*********************!*\
|
|
3155
|
-
!*** ./src/main.ts ***!
|
|
3156
|
-
\*********************/
|
|
3157
|
-
/*! no static exports found */
|
|
3158
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
3159
|
-
|
|
3160
|
-
"use strict";
|
|
3161
|
-
|
|
3162
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3163
|
-
var Sitefinity_1 = __webpack_require__(/*! ./Sitefinity */ "./src/Sitefinity.ts");
|
|
3164
|
-
module.exports = Sitefinity_1.Sitefinity;
|
|
3165
2229
|
|
|
3166
2230
|
|
|
3167
2231
|
/***/ }),
|
|
@@ -3170,12 +2234,11 @@ module.exports = Sitefinity_1.Sitefinity;
|
|
|
3170
2234
|
/*!**********************!*\
|
|
3171
2235
|
!*** ./src/utils.ts ***!
|
|
3172
2236
|
\**********************/
|
|
3173
|
-
|
|
3174
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
2237
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
3175
2238
|
|
|
3176
|
-
"use strict";
|
|
3177
2239
|
|
|
3178
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2240
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
2241
|
+
exports.utils = void 0;
|
|
3179
2242
|
var utils = /** @class */ (function () {
|
|
3180
2243
|
function utils() {
|
|
3181
2244
|
}
|
|
@@ -3188,11 +2251,12 @@ var utils = /** @class */ (function () {
|
|
|
3188
2251
|
utils.isBlob = function (obj) {
|
|
3189
2252
|
return obj instanceof Blob;
|
|
3190
2253
|
};
|
|
3191
|
-
;
|
|
3192
2254
|
utils.isNumber = function (value) {
|
|
3193
2255
|
return typeof value === 'number' && isFinite(value);
|
|
3194
2256
|
};
|
|
3195
|
-
|
|
2257
|
+
utils.isFunction = function (func) {
|
|
2258
|
+
return typeof func === 'function';
|
|
2259
|
+
};
|
|
3196
2260
|
utils.serializeToJSON = function (data) {
|
|
3197
2261
|
if (!utils.isString(data) && !this.isBlob(data)) {
|
|
3198
2262
|
return JSON.stringify(data);
|
|
@@ -3215,7 +2279,20 @@ var utils = /** @class */ (function () {
|
|
|
3215
2279
|
catch (e) {
|
|
3216
2280
|
console.log("An unexpected error occurred while parsing the response from server: " + e.message + ". Response body was: '" + data + "'");
|
|
3217
2281
|
}
|
|
3218
|
-
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;
|
|
3219
2296
|
};
|
|
3220
2297
|
utils.hex16 = function () {
|
|
3221
2298
|
return Math.floor((1 + Math.random()) * 0x10000).toString(16).substr(1);
|
|
@@ -3227,9 +2304,6 @@ var utils = /** @class */ (function () {
|
|
|
3227
2304
|
};
|
|
3228
2305
|
utils.removeSlashes = function (url) {
|
|
3229
2306
|
var ret = url;
|
|
3230
|
-
var fistChar = ret.substr(0, 1);
|
|
3231
|
-
if (fistChar == '/')
|
|
3232
|
-
ret = ret.substr(1);
|
|
3233
2307
|
var lastChar = ret.substr(-1);
|
|
3234
2308
|
if (lastChar == '/')
|
|
3235
2309
|
ret = ret.substr(0, ret.length - 1);
|
|
@@ -3269,26 +2343,353 @@ var utils = /** @class */ (function () {
|
|
|
3269
2343
|
}
|
|
3270
2344
|
return date;
|
|
3271
2345
|
};
|
|
3272
|
-
utils.convertDateFieldToISOString = function (data) {
|
|
3273
|
-
/*
|
|
3274
|
-
TODOSDK: when write tests for this try to use
|
|
3275
|
-
"Object.keys(obj).forEach(function(){})",
|
|
3276
|
-
Phantomjs does not recognize "for..in" operator.
|
|
3277
|
-
*/
|
|
3278
|
-
for (var obj in data) {
|
|
3279
|
-
if (data[obj] instanceof Date) {
|
|
3280
|
-
data[obj] = data[obj].toISOString();
|
|
3281
|
-
}
|
|
3282
|
-
}
|
|
3283
|
-
return data;
|
|
3284
|
-
};
|
|
3285
2346
|
return utils;
|
|
3286
2347
|
}());
|
|
3287
2348
|
exports.utils = utils;
|
|
3288
2349
|
|
|
3289
2350
|
|
|
2351
|
+
/***/ }),
|
|
2352
|
+
|
|
2353
|
+
/***/ "./node_modules/tslib/tslib.es6.js":
|
|
2354
|
+
/*!*****************************************!*\
|
|
2355
|
+
!*** ./node_modules/tslib/tslib.es6.js ***!
|
|
2356
|
+
\*****************************************/
|
|
2357
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
2358
|
+
|
|
2359
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2360
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2361
|
+
/* harmony export */ "__extends": () => (/* binding */ __extends),
|
|
2362
|
+
/* harmony export */ "__assign": () => (/* binding */ __assign),
|
|
2363
|
+
/* harmony export */ "__rest": () => (/* binding */ __rest),
|
|
2364
|
+
/* harmony export */ "__decorate": () => (/* binding */ __decorate),
|
|
2365
|
+
/* harmony export */ "__param": () => (/* binding */ __param),
|
|
2366
|
+
/* harmony export */ "__metadata": () => (/* binding */ __metadata),
|
|
2367
|
+
/* harmony export */ "__awaiter": () => (/* binding */ __awaiter),
|
|
2368
|
+
/* harmony export */ "__generator": () => (/* binding */ __generator),
|
|
2369
|
+
/* harmony export */ "__createBinding": () => (/* binding */ __createBinding),
|
|
2370
|
+
/* harmony export */ "__exportStar": () => (/* binding */ __exportStar),
|
|
2371
|
+
/* harmony export */ "__values": () => (/* binding */ __values),
|
|
2372
|
+
/* harmony export */ "__read": () => (/* binding */ __read),
|
|
2373
|
+
/* harmony export */ "__spread": () => (/* binding */ __spread),
|
|
2374
|
+
/* harmony export */ "__spreadArrays": () => (/* binding */ __spreadArrays),
|
|
2375
|
+
/* harmony export */ "__spreadArray": () => (/* binding */ __spreadArray),
|
|
2376
|
+
/* harmony export */ "__await": () => (/* binding */ __await),
|
|
2377
|
+
/* harmony export */ "__asyncGenerator": () => (/* binding */ __asyncGenerator),
|
|
2378
|
+
/* harmony export */ "__asyncDelegator": () => (/* binding */ __asyncDelegator),
|
|
2379
|
+
/* harmony export */ "__asyncValues": () => (/* binding */ __asyncValues),
|
|
2380
|
+
/* harmony export */ "__makeTemplateObject": () => (/* binding */ __makeTemplateObject),
|
|
2381
|
+
/* harmony export */ "__importStar": () => (/* binding */ __importStar),
|
|
2382
|
+
/* harmony export */ "__importDefault": () => (/* binding */ __importDefault),
|
|
2383
|
+
/* harmony export */ "__classPrivateFieldGet": () => (/* binding */ __classPrivateFieldGet),
|
|
2384
|
+
/* harmony export */ "__classPrivateFieldSet": () => (/* binding */ __classPrivateFieldSet)
|
|
2385
|
+
/* harmony export */ });
|
|
2386
|
+
/*! *****************************************************************************
|
|
2387
|
+
Copyright (c) Microsoft Corporation.
|
|
2388
|
+
|
|
2389
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
2390
|
+
purpose with or without fee is hereby granted.
|
|
2391
|
+
|
|
2392
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
2393
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
2394
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
2395
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
2396
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
2397
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
2398
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
2399
|
+
***************************************************************************** */
|
|
2400
|
+
/* global Reflect, Promise */
|
|
2401
|
+
|
|
2402
|
+
var extendStatics = function(d, b) {
|
|
2403
|
+
extendStatics = Object.setPrototypeOf ||
|
|
2404
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
2405
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
2406
|
+
return extendStatics(d, b);
|
|
2407
|
+
};
|
|
2408
|
+
|
|
2409
|
+
function __extends(d, b) {
|
|
2410
|
+
if (typeof b !== "function" && b !== null)
|
|
2411
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
2412
|
+
extendStatics(d, b);
|
|
2413
|
+
function __() { this.constructor = d; }
|
|
2414
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
2415
|
+
}
|
|
2416
|
+
|
|
2417
|
+
var __assign = function() {
|
|
2418
|
+
__assign = Object.assign || function __assign(t) {
|
|
2419
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
2420
|
+
s = arguments[i];
|
|
2421
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
2422
|
+
}
|
|
2423
|
+
return t;
|
|
2424
|
+
}
|
|
2425
|
+
return __assign.apply(this, arguments);
|
|
2426
|
+
}
|
|
2427
|
+
|
|
2428
|
+
function __rest(s, e) {
|
|
2429
|
+
var t = {};
|
|
2430
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
2431
|
+
t[p] = s[p];
|
|
2432
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
2433
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
2434
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
2435
|
+
t[p[i]] = s[p[i]];
|
|
2436
|
+
}
|
|
2437
|
+
return t;
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2440
|
+
function __decorate(decorators, target, key, desc) {
|
|
2441
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2442
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
2443
|
+
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;
|
|
2444
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2447
|
+
function __param(paramIndex, decorator) {
|
|
2448
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
2449
|
+
}
|
|
2450
|
+
|
|
2451
|
+
function __metadata(metadataKey, metadataValue) {
|
|
2452
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
2453
|
+
}
|
|
2454
|
+
|
|
2455
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
2456
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
2457
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
2458
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
2459
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
2460
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
2461
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
2462
|
+
});
|
|
2463
|
+
}
|
|
2464
|
+
|
|
2465
|
+
function __generator(thisArg, body) {
|
|
2466
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
2467
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
2468
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
2469
|
+
function step(op) {
|
|
2470
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
2471
|
+
while (_) try {
|
|
2472
|
+
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;
|
|
2473
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
2474
|
+
switch (op[0]) {
|
|
2475
|
+
case 0: case 1: t = op; break;
|
|
2476
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
2477
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
2478
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
2479
|
+
default:
|
|
2480
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
2481
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
2482
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
2483
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
2484
|
+
if (t[2]) _.ops.pop();
|
|
2485
|
+
_.trys.pop(); continue;
|
|
2486
|
+
}
|
|
2487
|
+
op = body.call(thisArg, _);
|
|
2488
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
2489
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
2490
|
+
}
|
|
2491
|
+
}
|
|
2492
|
+
|
|
2493
|
+
var __createBinding = Object.create ? (function(o, m, k, k2) {
|
|
2494
|
+
if (k2 === undefined) k2 = k;
|
|
2495
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
2496
|
+
}) : (function(o, m, k, k2) {
|
|
2497
|
+
if (k2 === undefined) k2 = k;
|
|
2498
|
+
o[k2] = m[k];
|
|
2499
|
+
});
|
|
2500
|
+
|
|
2501
|
+
function __exportStar(m, o) {
|
|
2502
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
|
|
2503
|
+
}
|
|
2504
|
+
|
|
2505
|
+
function __values(o) {
|
|
2506
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
2507
|
+
if (m) return m.call(o);
|
|
2508
|
+
if (o && typeof o.length === "number") return {
|
|
2509
|
+
next: function () {
|
|
2510
|
+
if (o && i >= o.length) o = void 0;
|
|
2511
|
+
return { value: o && o[i++], done: !o };
|
|
2512
|
+
}
|
|
2513
|
+
};
|
|
2514
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
2515
|
+
}
|
|
2516
|
+
|
|
2517
|
+
function __read(o, n) {
|
|
2518
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
2519
|
+
if (!m) return o;
|
|
2520
|
+
var i = m.call(o), r, ar = [], e;
|
|
2521
|
+
try {
|
|
2522
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
2523
|
+
}
|
|
2524
|
+
catch (error) { e = { error: error }; }
|
|
2525
|
+
finally {
|
|
2526
|
+
try {
|
|
2527
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
2528
|
+
}
|
|
2529
|
+
finally { if (e) throw e.error; }
|
|
2530
|
+
}
|
|
2531
|
+
return ar;
|
|
2532
|
+
}
|
|
2533
|
+
|
|
2534
|
+
/** @deprecated */
|
|
2535
|
+
function __spread() {
|
|
2536
|
+
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
2537
|
+
ar = ar.concat(__read(arguments[i]));
|
|
2538
|
+
return ar;
|
|
2539
|
+
}
|
|
2540
|
+
|
|
2541
|
+
/** @deprecated */
|
|
2542
|
+
function __spreadArrays() {
|
|
2543
|
+
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
2544
|
+
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
2545
|
+
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
2546
|
+
r[k] = a[j];
|
|
2547
|
+
return r;
|
|
2548
|
+
}
|
|
2549
|
+
|
|
2550
|
+
function __spreadArray(to, from, pack) {
|
|
2551
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
2552
|
+
if (ar || !(i in from)) {
|
|
2553
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
2554
|
+
ar[i] = from[i];
|
|
2555
|
+
}
|
|
2556
|
+
}
|
|
2557
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
2558
|
+
}
|
|
2559
|
+
|
|
2560
|
+
function __await(v) {
|
|
2561
|
+
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
2562
|
+
}
|
|
2563
|
+
|
|
2564
|
+
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
2565
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
2566
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
2567
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
2568
|
+
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); }); }; }
|
|
2569
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
2570
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
2571
|
+
function fulfill(value) { resume("next", value); }
|
|
2572
|
+
function reject(value) { resume("throw", value); }
|
|
2573
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
function __asyncDelegator(o) {
|
|
2577
|
+
var i, p;
|
|
2578
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
2579
|
+
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; }
|
|
2580
|
+
}
|
|
2581
|
+
|
|
2582
|
+
function __asyncValues(o) {
|
|
2583
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
2584
|
+
var m = o[Symbol.asyncIterator], i;
|
|
2585
|
+
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);
|
|
2586
|
+
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); }); }; }
|
|
2587
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
2588
|
+
}
|
|
2589
|
+
|
|
2590
|
+
function __makeTemplateObject(cooked, raw) {
|
|
2591
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
2592
|
+
return cooked;
|
|
2593
|
+
};
|
|
2594
|
+
|
|
2595
|
+
var __setModuleDefault = Object.create ? (function(o, v) {
|
|
2596
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
2597
|
+
}) : function(o, v) {
|
|
2598
|
+
o["default"] = v;
|
|
2599
|
+
};
|
|
2600
|
+
|
|
2601
|
+
function __importStar(mod) {
|
|
2602
|
+
if (mod && mod.__esModule) return mod;
|
|
2603
|
+
var result = {};
|
|
2604
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
2605
|
+
__setModuleDefault(result, mod);
|
|
2606
|
+
return result;
|
|
2607
|
+
}
|
|
2608
|
+
|
|
2609
|
+
function __importDefault(mod) {
|
|
2610
|
+
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
2611
|
+
}
|
|
2612
|
+
|
|
2613
|
+
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
2614
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
2615
|
+
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");
|
|
2616
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
2617
|
+
}
|
|
2618
|
+
|
|
2619
|
+
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
2620
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
2621
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
2622
|
+
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");
|
|
2623
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
2624
|
+
}
|
|
2625
|
+
|
|
2626
|
+
|
|
3290
2627
|
/***/ })
|
|
3291
2628
|
|
|
3292
|
-
/******/
|
|
2629
|
+
/******/ });
|
|
2630
|
+
/************************************************************************/
|
|
2631
|
+
/******/ // The module cache
|
|
2632
|
+
/******/ var __webpack_module_cache__ = {};
|
|
2633
|
+
/******/
|
|
2634
|
+
/******/ // The require function
|
|
2635
|
+
/******/ function __webpack_require__(moduleId) {
|
|
2636
|
+
/******/ // Check if module is in cache
|
|
2637
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
2638
|
+
/******/ if (cachedModule !== undefined) {
|
|
2639
|
+
/******/ return cachedModule.exports;
|
|
2640
|
+
/******/ }
|
|
2641
|
+
/******/ // Create a new module (and put it into the cache)
|
|
2642
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
2643
|
+
/******/ // no module.id needed
|
|
2644
|
+
/******/ // no module.loaded needed
|
|
2645
|
+
/******/ exports: {}
|
|
2646
|
+
/******/ };
|
|
2647
|
+
/******/
|
|
2648
|
+
/******/ // Execute the module function
|
|
2649
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
2650
|
+
/******/
|
|
2651
|
+
/******/ // Return the exports of the module
|
|
2652
|
+
/******/ return module.exports;
|
|
2653
|
+
/******/ }
|
|
2654
|
+
/******/
|
|
2655
|
+
/************************************************************************/
|
|
2656
|
+
/******/ /* webpack/runtime/define property getters */
|
|
2657
|
+
/******/ (() => {
|
|
2658
|
+
/******/ // define getter functions for harmony exports
|
|
2659
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
2660
|
+
/******/ for(var key in definition) {
|
|
2661
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
2662
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
2663
|
+
/******/ }
|
|
2664
|
+
/******/ }
|
|
2665
|
+
/******/ };
|
|
2666
|
+
/******/ })();
|
|
2667
|
+
/******/
|
|
2668
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
2669
|
+
/******/ (() => {
|
|
2670
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
2671
|
+
/******/ })();
|
|
2672
|
+
/******/
|
|
2673
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
2674
|
+
/******/ (() => {
|
|
2675
|
+
/******/ // define __esModule on exports
|
|
2676
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
2677
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
2678
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2679
|
+
/******/ }
|
|
2680
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
2681
|
+
/******/ };
|
|
2682
|
+
/******/ })();
|
|
2683
|
+
/******/
|
|
2684
|
+
/************************************************************************/
|
|
2685
|
+
/******/
|
|
2686
|
+
/******/ // startup
|
|
2687
|
+
/******/ // Load entry module and return exports
|
|
2688
|
+
/******/ // This entry module is referenced by other modules so it can't be inlined
|
|
2689
|
+
/******/ var __webpack_exports__ = __webpack_require__("./sitefinity-webservices-sdk.ts");
|
|
2690
|
+
/******/
|
|
2691
|
+
/******/ return __webpack_exports__;
|
|
2692
|
+
/******/ })()
|
|
2693
|
+
;
|
|
3293
2694
|
});
|
|
3294
2695
|
//# sourceMappingURL=sitefinity-webservices-sdk.js.map
|