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