@progress/sitefinity-webservices-sdk 1.0.4 → 1.1.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.
Files changed (167) hide show
  1. package/.eslintrc.js +30 -9
  2. package/config/helpers.ts +8 -0
  3. package/config/webpack.common.ts +39 -0
  4. package/config/webpack.dev.ts +37 -0
  5. package/config/webpack.prod.ts +17 -0
  6. package/dist/docs/assets/highlight.css +17 -3
  7. package/dist/docs/assets/main.js +4 -2
  8. package/dist/docs/assets/search.js +1 -1
  9. package/dist/docs/assets/style.css +430 -619
  10. package/dist/docs/classes/BlobBuilder.BlobBuilder.html +135 -0
  11. package/dist/docs/classes/Data.Data.html +385 -0
  12. package/dist/docs/classes/Expression.BinaryExpression.html +184 -1
  13. package/dist/docs/classes/Expression.ComplexExpression.html +139 -1
  14. package/dist/docs/classes/Expression.ExpressionBase.html +125 -1
  15. package/dist/docs/classes/OrderProperty.OrderProperty.html +130 -0
  16. package/dist/docs/classes/Query.Query.html +353 -0
  17. package/dist/docs/classes/QueryBase.QueryBase.html +185 -0
  18. package/dist/docs/classes/QueryBuilder.QueryBuilder.html +190 -0
  19. package/dist/docs/classes/Requests_BatchRequest.BatchRequest.html +731 -17
  20. package/dist/docs/classes/Requests_BatchRequest.Transaction.html +330 -17
  21. package/dist/docs/classes/Requests_ExecutableRequest.ExecutableRequest.html +342 -1
  22. package/dist/docs/classes/Requests_Request.CommitChunksRequest.html +303 -0
  23. package/dist/docs/classes/Requests_Request.CreateRelatedRequest.html +310 -1
  24. package/dist/docs/classes/Requests_Request.CreateRequest.html +309 -1
  25. package/dist/docs/classes/Requests_Request.DeleteRelatedByIdRequest.html +309 -1
  26. package/dist/docs/classes/Requests_Request.DeleteRelatedRequest.html +302 -1
  27. package/dist/docs/classes/Requests_Request.DeleteRequest.html +300 -1
  28. package/dist/docs/classes/Requests_Request.GetByIdRequest.html +300 -1
  29. package/dist/docs/classes/Requests_Request.GetRelatedByIdRequest.html +309 -1
  30. package/dist/docs/classes/Requests_Request.GetRelatedRequest.html +302 -1
  31. package/dist/docs/classes/Requests_Request.GetRequest.html +295 -1
  32. package/dist/docs/classes/Requests_Request.UpdateRequest.html +309 -1
  33. package/dist/docs/classes/Requests_Request.UploadChunkRequest.html +352 -0
  34. package/dist/docs/classes/Requests_Request.UploadRequest.html +329 -1
  35. package/dist/docs/classes/Requests_RequestBase.RequestBase.html +275 -1
  36. package/dist/docs/classes/Requests_RequestFactory.RequestFactory.html +342 -1
  37. package/dist/docs/classes/Sitefinity.Sitefinity.html +186 -0
  38. package/dist/docs/classes/WhereQuery.WhereQuery.html +410 -0
  39. package/dist/docs/classes/chunk_upload_chunk_upload_sdk.ChunkUploadSdk.html +229 -0
  40. package/dist/docs/classes/chunk_upload_chunked_file_upload_utilities.ChunkedFileUploadUtilities.html +129 -0
  41. package/dist/docs/classes/utils.utils.html +301 -0
  42. package/dist/docs/index.html +56 -2
  43. package/dist/docs/interfaces/Data.CreateRelatedRequestOptions.html +157 -1
  44. package/dist/docs/interfaces/Data.CreateRequestOptions.html +155 -1
  45. package/dist/docs/interfaces/Data.OperationsRequestOptions.html +145 -1
  46. package/dist/docs/interfaces/Data.PropertyRequestOptions.html +151 -1
  47. package/dist/docs/interfaces/Data.RequestOptionsBase.html +136 -1
  48. package/dist/docs/interfaces/Data.SingleRelatedItemRequestOptions.html +157 -1
  49. package/dist/docs/interfaces/Data.UpdateRequestOptions.html +157 -1
  50. package/dist/docs/interfaces/Data.UploadRequestOptions.html +169 -1
  51. package/dist/docs/interfaces/Requests_BatchRequest.BatchCreateRelatedRequestOptions.html +161 -1
  52. package/dist/docs/interfaces/Requests_BatchRequest.BatchCreateRequestOptions.html +153 -1
  53. package/dist/docs/interfaces/Requests_BatchRequest.BatchPropertyRequestOptions.html +153 -1
  54. package/dist/docs/interfaces/Requests_BatchRequest.BatchRequestOptionsBase.html +145 -1
  55. package/dist/docs/interfaces/Requests_BatchRequest.BatchRequestOptionsExtended.html +153 -1
  56. package/dist/docs/interfaces/Requests_BatchRequest.BatchSingleItemRequestOptions.html +145 -1
  57. package/dist/docs/interfaces/Requests_BatchRequest.BatchSingleRelatedItemRequestOptions.html +161 -1
  58. package/dist/docs/interfaces/Requests_BatchRequest.BatchUpdateRequestOptions.html +161 -1
  59. package/dist/docs/interfaces/Requests_ExecutableRequest.ResponseHandlers.html +96 -5
  60. package/dist/docs/interfaces/Requests_Request.CommitChunksRequestOptionsExtended.html +215 -0
  61. package/dist/docs/interfaces/Requests_Request.PostRequestOptionsExtended.html +161 -1
  62. package/dist/docs/interfaces/Requests_Request.PutRequestOptionsExtended.html +161 -1
  63. package/dist/docs/interfaces/Requests_Request.RelatedByIdRequestOptionsExtended.html +169 -1
  64. package/dist/docs/interfaces/Requests_Request.RelatedRequestOptionsExtended.html +165 -1
  65. package/dist/docs/interfaces/Requests_Request.UploadChunkRequestOptionsExtended.html +210 -0
  66. package/dist/docs/interfaces/Requests_Request.UploadRequestOptionsExtended.html +180 -1
  67. package/dist/docs/interfaces/Requests_RequestBase.RequestOptionsBaseExtended.html +150 -1
  68. package/dist/docs/interfaces/Sitefinity.SDKOptions.html +128 -9
  69. package/dist/docs/interfaces/Sitefinity.Token.html +92 -1
  70. package/dist/docs/interfaces/Sitefinity.TypeOptions.html +144 -13
  71. package/dist/docs/interfaces/chunk_upload_chunk_upload_sdk.ChunkUploadInfoDTO.html +157 -0
  72. package/dist/docs/interfaces/chunk_upload_chunk_upload_sdk.ChunkUploadResult.html +109 -0
  73. package/dist/docs/interfaces/chunk_upload_chunk_upload_sdk.CleanUpChunksRequestOptions.html +171 -0
  74. package/dist/docs/interfaces/chunk_upload_chunk_upload_sdk.CommitChunksRequestOptions.html +204 -0
  75. package/dist/docs/interfaces/chunk_upload_chunk_upload_sdk.GetChunkUploadInfoRequestOptions.html +166 -0
  76. package/dist/docs/interfaces/chunk_upload_chunk_upload_sdk.UploadChunkRequestOptions.html +201 -0
  77. package/dist/docs/interfaces/chunk_upload_chunked_file_upload_utilities.ChunkFileResult.html +99 -0
  78. package/dist/docs/interfaces/chunk_upload_chunked_file_upload_utilities.FileUploadChunk.html +92 -0
  79. package/dist/docs/modules/BlobBuilder.html +71 -1
  80. package/dist/docs/modules/Data.html +90 -1
  81. package/dist/docs/modules/Expression.html +75 -1
  82. package/dist/docs/modules/OrderProperty.html +71 -1
  83. package/dist/docs/modules/Query.html +71 -1
  84. package/dist/docs/modules/QueryBase.html +71 -1
  85. package/dist/docs/modules/QueryBuilder.html +71 -1
  86. package/dist/docs/modules/Requests_BatchRequest.html +92 -1
  87. package/dist/docs/modules/Requests_ExecutableRequest.html +76 -1
  88. package/dist/docs/modules/Requests_Request.html +112 -1
  89. package/dist/docs/modules/Requests_RequestBase.html +76 -1
  90. package/dist/docs/modules/Requests_RequestFactory.html +71 -1
  91. package/dist/docs/modules/Sitefinity.html +80 -1
  92. package/dist/docs/modules/WhereQuery.html +71 -1
  93. package/dist/docs/modules/chunk_upload_chunk_upload_sdk.html +86 -0
  94. package/dist/docs/modules/chunk_upload_chunked_file_upload_utilities.html +78 -0
  95. package/dist/docs/modules/constants.html +81 -1
  96. package/dist/docs/modules/utils.html +71 -1
  97. package/dist/docs/modules.html +78 -1
  98. package/dist/docs/variables/constants.CONTENT_TYPES.html +74 -0
  99. package/dist/docs/variables/constants.EXPRESSION_TYPE.html +102 -0
  100. package/dist/docs/variables/constants.HEADER_NAMES.html +100 -0
  101. package/dist/docs/variables/constants.HTTP_METHODS.html +82 -0
  102. package/dist/docs/variables/constants.ODATA_PARAMS.html +88 -0
  103. package/dist/docs/variables/constants.SF_PARAMS.html +82 -0
  104. package/dist/samples.html +235 -36
  105. package/dist/sitefinity-webservices-sdk.d.ts +0 -1
  106. package/dist/sitefinity-webservices-sdk.js +473 -117
  107. package/dist/sitefinity-webservices-sdk.js.map +1 -1
  108. package/dist/sitefinity-webservices-sdk.min.js +1 -2
  109. package/dist/src/Data.d.ts +10 -0
  110. package/dist/src/Data.spec.d.ts +1 -0
  111. package/dist/src/Query.d.ts +3 -3
  112. package/dist/src/Requests/ExecutableRequest.d.ts +3 -1
  113. package/dist/src/Requests/Request.d.ts +42 -0
  114. package/dist/src/Requests/RequestBase.d.ts +1 -2
  115. package/dist/src/Requests/RequestFactory.d.ts +3 -1
  116. package/dist/src/Requests/request.spec.d.ts +1 -0
  117. package/dist/src/Sitefinity.d.ts +2 -2
  118. package/dist/src/Sitefinity.spec.d.ts +1 -0
  119. package/dist/src/WhereQuery.d.ts +2 -2
  120. package/dist/src/chunk-upload/chunk-upload.sdk.d.ts +290 -0
  121. package/dist/src/chunk-upload/chunk-upload.sdk.spec.d.ts +1 -0
  122. package/dist/src/chunk-upload/chunked-file-upload.utilities.d.ts +13 -0
  123. package/dist/src/constants.d.ts +5 -0
  124. package/package-lock.json +3166 -6687
  125. package/package.json +24 -22
  126. package/sitefinity-webservices-sdk.ts +0 -1
  127. package/src/Data.spec.ts +12 -12
  128. package/src/Data.ts +19 -4
  129. package/src/OrderProperty.ts +7 -7
  130. package/src/Query.ts +4 -4
  131. package/src/QueryBase.ts +4 -4
  132. package/src/QueryBuilder.ts +38 -38
  133. package/src/Requests/BatchRequest.ts +25 -25
  134. package/src/Requests/ExecutableRequest.ts +30 -24
  135. package/src/Requests/Request.ts +109 -2
  136. package/src/Requests/RequestBase.ts +3 -4
  137. package/src/Requests/RequestFactory.ts +9 -1
  138. package/src/Requests/request.spec.ts +10 -10
  139. package/src/Sitefinity.spec.ts +6 -6
  140. package/src/Sitefinity.ts +5 -5
  141. package/src/WhereQuery.ts +2 -2
  142. package/src/chunk-upload/chunk-upload.sdk.spec.ts +340 -0
  143. package/src/chunk-upload/chunk-upload.sdk.ts +436 -0
  144. package/src/chunk-upload/chunked-file-upload.utilities.ts +64 -0
  145. package/src/constants.ts +35 -30
  146. package/src/utils.ts +10 -10
  147. package/template.html +189 -36
  148. package/tsconfig.json +11 -3
  149. package/type.txt +1 -1
  150. package/config/helpers.js +0 -10
  151. package/config/webpack.common.js +0 -39
  152. package/config/webpack.dev.js +0 -19
  153. package/config/webpack.prod.js +0 -25
  154. package/dist/docs/assets/icons.css +0 -1043
  155. package/dist/docs/assets/icons.png +0 -0
  156. package/dist/docs/assets/icons@2x.png +0 -0
  157. package/dist/docs/classes/BlobBuilder.BlobBuilder-1.html +0 -7
  158. package/dist/docs/classes/Data.Data-1.html +0 -65
  159. package/dist/docs/classes/OrderProperty.OrderProperty-1.html +0 -1
  160. package/dist/docs/classes/Query.Query-1.html +0 -33
  161. package/dist/docs/classes/QueryBase.QueryBase-1.html +0 -7
  162. package/dist/docs/classes/QueryBuilder.QueryBuilder-1.html +0 -1
  163. package/dist/docs/classes/Sitefinity.Sitefinity-1.html +0 -5
  164. package/dist/docs/classes/WhereQuery.WhereQuery-1.html +0 -31
  165. package/dist/docs/classes/utils.utils-1.html +0 -1
  166. package/dist/sitefinity-webservices-sdk.min.js.LICENSE.txt +0 -14
  167. package/version.txt +0 -1
@@ -7,7 +7,7 @@
7
7
  exports["Sitefinity"] = factory();
8
8
  else
9
9
  root["Sitefinity"] = factory();
10
- })(this, function() {
10
+ })(this, () => {
11
11
  return /******/ (() => { // webpackBootstrap
12
12
  /******/ "use strict";
13
13
  /******/ var __webpack_modules__ = ({
@@ -27,7 +27,6 @@ tslib_1.__exportStar(__webpack_require__(/*! ./src/utils */ "./src/utils.ts"), e
27
27
  tslib_1.__exportStar(__webpack_require__(/*! ./src/WhereQuery */ "./src/WhereQuery.ts"), exports);
28
28
  tslib_1.__exportStar(__webpack_require__(/*! ./src/Sitefinity */ "./src/Sitefinity.ts"), exports);
29
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
30
  tslib_1.__exportStar(__webpack_require__(/*! ./src/Query */ "./src/Query.ts"), exports);
32
31
  tslib_1.__exportStar(__webpack_require__(/*! ./src/OrderProperty */ "./src/OrderProperty.ts"), exports);
33
32
  tslib_1.__exportStar(__webpack_require__(/*! ./src/Expression */ "./src/Expression.ts"), exports);
@@ -85,6 +84,7 @@ exports.BlobBuilder = BlobBuilder;
85
84
 
86
85
  Object.defineProperty(exports, "__esModule", ({ value: true }));
87
86
  exports.Data = void 0;
87
+ var chunk_upload_sdk_1 = __webpack_require__(/*! ./chunk-upload/chunk-upload.sdk */ "./src/chunk-upload/chunk-upload.sdk.ts");
88
88
  var constants_1 = __webpack_require__(/*! ./constants */ "./src/constants.ts");
89
89
  /**
90
90
  * The constructor of the Data object. This object is used for requesting data from Sitefinity.
@@ -94,6 +94,21 @@ var Data = /** @class */ (function () {
94
94
  this.urlOptions = urlOptions;
95
95
  this.factory = factory;
96
96
  }
97
+ Object.defineProperty(Data.prototype, "chunkUpload", {
98
+ /**
99
+ * Returns an instance of the @type {ChunkUploadService}
100
+ *
101
+ * @readonly
102
+ * @type {ChunkUploadSdk}
103
+ * @memberof Data
104
+ */
105
+ get: function () {
106
+ var service = new chunk_upload_sdk_1.ChunkUploadSdk(this.urlOptions, this.factory);
107
+ return service;
108
+ },
109
+ enumerable: false,
110
+ configurable: true
111
+ });
97
112
  /**
98
113
  * Executes a GET request to retrieve a collection of items.
99
114
  */
@@ -385,7 +400,7 @@ var Data = /** @class */ (function () {
385
400
  });
386
401
  }
387
402
  batch.endTransaction(transaction);
388
- batch.execute();
403
+ return batch.execute();
389
404
  };
390
405
  return Data;
391
406
  }());
@@ -469,15 +484,15 @@ var OrderProperty = /** @class */ (function () {
469
484
  this.propertyPath = propertyPath;
470
485
  this.isDesc = isDesc;
471
486
  if (!utils_1.utils.isString(propertyPath))
472
- throw new Error('Property name is not a valid string');
487
+ throw new Error("Property name is not a valid string");
473
488
  propertyPath = propertyPath.trim();
474
- var parts = propertyPath.split(' ');
489
+ var parts = propertyPath.split(" ");
475
490
  // parts[0] is the propertyPath; [1] would be whether descending or not.
476
491
  if (parts.length > 1 && isDesc !== true && isDesc !== false) {
477
- isDesc = parts[1].toLowerCase() == 'desc';
492
+ isDesc = parts[1].toLowerCase() == "desc";
478
493
  if (!isDesc) {
479
494
  // isDesc is false but check to make sure its intended.
480
- var isAsc = parts[1].toLowerCase() == 'asc';
495
+ var isAsc = parts[1].toLowerCase() == "asc";
481
496
  if (!isAsc) {
482
497
  throw new Error("the second word in the propertyPath must begin with 'desc' or 'asc'");
483
498
  }
@@ -493,8 +508,8 @@ var OrderProperty = /** @class */ (function () {
493
508
  return this.isDesc;
494
509
  };
495
510
  OrderProperty.prototype.getValue = function () {
496
- var direction = (this.isDesc) ? 'desc' : 'asc';
497
- return this.propertyPath + ' ' + direction;
511
+ var direction = (this.isDesc) ? "desc" : "asc";
512
+ return this.propertyPath + " " + direction;
498
513
  };
499
514
  return OrderProperty;
500
515
  }());
@@ -671,10 +686,10 @@ var QueryBase = /** @class */ (function () {
671
686
  for (var i = 0; i < propPaths.length; i++) {
672
687
  var member = propPaths[i];
673
688
  if (!utils_1.utils.isString(member)) {
674
- throw new Error('Invalid argument in clause');
689
+ throw new Error("Invalid argument in clause");
675
690
  }
676
- if (!allowNested && member.indexOf('.') > -1) {
677
- throw new Error('Invalid argument in clause');
691
+ if (!allowNested && member.indexOf(".") > -1) {
692
+ throw new Error("Invalid argument in clause");
678
693
  }
679
694
  }
680
695
  };
@@ -722,11 +737,11 @@ var QueryBuilder = /** @class */ (function () {
722
737
  }
723
738
  var selectClause = this.query.selectProperties;
724
739
  if (selectClause instanceof Array) {
725
- queryParameters[constants_1.ODATA_PARAMS.$select] = selectClause.join(', ');
740
+ queryParameters[constants_1.ODATA_PARAMS.$select] = selectClause.join(", ");
726
741
  }
727
742
  var expandClause = this.query.expandProperties;
728
743
  if (expandClause instanceof Array)
729
- queryParameters[constants_1.ODATA_PARAMS.$expand] = expandClause.join(', ');
744
+ queryParameters[constants_1.ODATA_PARAMS.$expand] = expandClause.join(", ");
730
745
  var orderByClause = this.query.orderProperties;
731
746
  if (orderByClause instanceof Array) {
732
747
  var order = [];
@@ -734,7 +749,7 @@ var QueryBuilder = /** @class */ (function () {
734
749
  if (orderByClause[i] instanceof OrderProperty_1.OrderProperty)
735
750
  order.push(orderByClause[i].getValue());
736
751
  }
737
- queryParameters[constants_1.ODATA_PARAMS.$orderby] = order.join(', ');
752
+ queryParameters[constants_1.ODATA_PARAMS.$orderby] = order.join(", ");
738
753
  }
739
754
  var take = this.query.takeValue;
740
755
  if (utils_1.utils.isNumber(take))
@@ -752,9 +767,9 @@ var QueryBuilder = /** @class */ (function () {
752
767
  };
753
768
  QueryBuilder.prototype.buildComplexExpression = function (expression, parent) {
754
769
  if (!(expression instanceof Expression_1.ComplexExpression))
755
- throw new Error('Invalid complex expression');
770
+ throw new Error("Invalid complex expression");
756
771
  var counter = 0;
757
- var result = '';
772
+ var result = "";
758
773
  var subExpressions = expression.getExpressions();
759
774
  if (!subExpressions.length) {
760
775
  return result;
@@ -767,11 +782,11 @@ var QueryBuilder = /** @class */ (function () {
767
782
  else if (currentExp instanceof Expression_1.ComplexExpression) {
768
783
  var complexResult = this.buildComplexExpression(currentExp, expression.type);
769
784
  if (complexResult) {
770
- result += '(' + complexResult + ')';
785
+ result += "(" + complexResult + ")";
771
786
  }
772
787
  }
773
788
  if (expression.getType() === constants_1.EXPRESSION_TYPE.not)
774
- result = expression.getType() + ' ' + result;
789
+ result = expression.getType() + " " + result;
775
790
  // TODOSDK: Rethink this!
776
791
  if (expression.getType() === constants_1.EXPRESSION_TYPE.any) {
777
792
  var exprVal = [];
@@ -779,14 +794,14 @@ var QueryBuilder = /** @class */ (function () {
779
794
  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)
780
795
  exprVal.push(subExpressions[index].type.toLowerCase() + "(x, '" + subExpressions[index].constant + "')");
781
796
  else
782
- exprVal.push('x ' + subExpressions[index].type.toLowerCase() + ' ' + this.checkType(subExpressions[index].constant));
797
+ exprVal.push("x " + subExpressions[index].type.toLowerCase() + " " + this.checkType(subExpressions[index].constant));
783
798
  }
784
- result = currentExp.parameter + '/' + expression.getType() + '(x:' + exprVal.join(' ' + parent + ' ') + ')';
799
+ result = currentExp.parameter + "/" + expression.getType() + "(x:" + exprVal.join(" " + parent + " ") + ")";
785
800
  }
786
801
  counter++;
787
802
  if (counter == subExpressions.length)
788
803
  break;
789
- result += ' ' + expression.getType() + ' ';
804
+ result += " " + expression.getType() + " ";
790
805
  }
791
806
  return result;
792
807
  };
@@ -912,11 +927,11 @@ var Transaction = /** @class */ (function () {
912
927
  var options = {
913
928
  urlOptions: urlOptions,
914
929
  key: parameters.key,
915
- action: 'operation',
930
+ action: "operation",
916
931
  data: parameters.data
917
932
  };
918
933
  var request = this.factory.create(options);
919
- this.overrideUrlGeneration(request, parameters.key, 'operation', options.urlOptions, options.query);
934
+ this.overrideUrlGeneration(request, parameters.key, "operation", options.urlOptions, options.query);
920
935
  this.addRequest(request);
921
936
  };
922
937
  /**
@@ -964,7 +979,7 @@ var Transaction = /** @class */ (function () {
964
979
  property: parameters.property
965
980
  };
966
981
  var request = this.factory.destroyRelated(options);
967
- var propertyURL = request.property + '/$ref';
982
+ var propertyURL = request.property + "/$ref";
968
983
  this.overrideUrlGeneration(request, parameters.key, propertyURL, options.urlOptions, options.query);
969
984
  this.addRequest(request);
970
985
  };
@@ -998,7 +1013,7 @@ var Transaction = /** @class */ (function () {
998
1013
  }
999
1014
  }
1000
1015
  var data = {
1001
- '@odata.id': parameters.link
1016
+ "@odata.id": parameters.link
1002
1017
  };
1003
1018
  var options = {
1004
1019
  urlOptions: urlOptions,
@@ -1007,7 +1022,7 @@ var Transaction = /** @class */ (function () {
1007
1022
  data: data
1008
1023
  };
1009
1024
  var request = this.factory.createRelated(options);
1010
- var propertyURL = request.property + '/$ref';
1025
+ var propertyURL = request.property + "/$ref";
1011
1026
  this.overrideUrlGeneration(request, parameters.key, propertyURL, options.urlOptions, options.query);
1012
1027
  return this.addRequest(request);
1013
1028
  };
@@ -1019,7 +1034,7 @@ var Transaction = /** @class */ (function () {
1019
1034
  request.buildUrl = function () {
1020
1035
  var uri = "$" + key;
1021
1036
  if (additionalPropertyURL !== undefined) {
1022
- uri = uri + '/' + additionalPropertyURL;
1037
+ uri = uri + "/" + additionalPropertyURL;
1023
1038
  }
1024
1039
  if (urlOptions) {
1025
1040
  var queryString = request.getQueryString(urlOptions, query);
@@ -1313,9 +1328,9 @@ var BatchRequest = /** @class */ (function (_super) {
1313
1328
  var i, len;
1314
1329
  for (i = 1, len = contentTypeParts.length; i < len; i++) {
1315
1330
  var contentTypeParams = contentTypeParts[i].split("=");
1316
- properties[contentTypeParams[0].replace(/^\s+|\s+$/g, '')] = contentTypeParams[1];
1331
+ properties[contentTypeParams[0].replace(/^\s+|\s+$/g, "")] = contentTypeParams[1];
1317
1332
  }
1318
- return { mediaType: contentTypeParts[0].replace(/^\s+|\s+$/g, ''), properties: properties };
1333
+ return { mediaType: contentTypeParts[0].replace(/^\s+|\s+$/g, ""), properties: properties };
1319
1334
  };
1320
1335
  BatchRequest.prototype.readTo = function (text, str, context) {
1321
1336
  var start = context.position || 0;
@@ -1379,7 +1394,7 @@ var BatchRequest = /** @class */ (function (_super) {
1379
1394
  };
1380
1395
  BatchRequest.prototype.buildRequestBody = function () {
1381
1396
  var builder = new BlobBuilder_1.BlobBuilder();
1382
- builder.append('');
1397
+ builder.append("");
1383
1398
  for (var index = 0; index < this.requests.length; index += 1) {
1384
1399
  var request = this.requests[index].request;
1385
1400
  if (index != 0)
@@ -1397,12 +1412,12 @@ var BatchRequest = /** @class */ (function (_super) {
1397
1412
  };
1398
1413
  BatchRequest.prototype.buildRequest = function (request) {
1399
1414
  var builder = new BlobBuilder_1.BlobBuilder();
1400
- builder.append(BatchRequest.constants.newLine + 'Content-Type: application/http' +
1401
- BatchRequest.constants.newLine + 'Content-Transfer-Encoding: binary' +
1415
+ builder.append(BatchRequest.constants.newLine + "Content-Type: application/http" +
1416
+ BatchRequest.constants.newLine + "Content-Transfer-Encoding: binary" +
1402
1417
  BatchRequest.constants.newLine +
1403
1418
  BatchRequest.constants.newLine +
1404
1419
  request.getMethod() +
1405
- ' ' + request.buildUrl() + ' HTTP/1.1');
1420
+ " " + request.buildUrl() + " HTTP/1.1");
1406
1421
  return builder.build();
1407
1422
  };
1408
1423
  BatchRequest.prototype.buildTransaction = function (transaction) {
@@ -1411,18 +1426,18 @@ var BatchRequest = /** @class */ (function (_super) {
1411
1426
  var builder = new BlobBuilder_1.BlobBuilder();
1412
1427
  builder.append(BatchRequest.constants.newLine);
1413
1428
  var changeset = this.createBoundary("sf_changeset_");
1414
- builder.append('Content-Type: multipart/mixed; boundary=' + changeset);
1429
+ builder.append("Content-Type: multipart/mixed; boundary=" + changeset);
1415
1430
  var changesetRequests = transaction.requests;
1416
1431
  for (var index = 0; index < changesetRequests.length; index += 1) {
1417
1432
  var currentRequest = changesetRequests[index].request;
1418
1433
  // we shouldn't add new lines after blob content. Otherwise they are added to the blob and corrupt it
1419
1434
  var shouldAddNewLine = index === 0 || !utils_1.utils.isBlob(changesetRequests[index - 1].request.getBody());
1420
1435
  builder.append(this.createDelimeter(changeset, false, shouldAddNewLine) +
1421
- BatchRequest.constants.newLine + 'Content-Type: application/http' +
1422
- BatchRequest.constants.newLine + 'Content-Transfer-Encoding: binary' +
1423
- BatchRequest.constants.newLine + 'Content-ID: ' + changesetRequests[index].id);
1436
+ BatchRequest.constants.newLine + "Content-Type: application/http" +
1437
+ BatchRequest.constants.newLine + "Content-Transfer-Encoding: binary" +
1438
+ BatchRequest.constants.newLine + "Content-ID: " + changesetRequests[index].id);
1424
1439
  var requestUrl = currentRequest.buildUrl();
1425
- builder.append(BatchRequest.constants.newLine + BatchRequest.constants.newLine + currentRequest.getMethod() + ' ' + requestUrl + ' HTTP/1.1');
1440
+ builder.append(BatchRequest.constants.newLine + BatchRequest.constants.newLine + currentRequest.getMethod() + " " + requestUrl + " HTTP/1.1");
1426
1441
  var headers = currentRequest.getHeaders();
1427
1442
  var headerNames = Object.keys(headers);
1428
1443
  for (var i = 0; i < headerNames.length; i++) {
@@ -1452,7 +1467,7 @@ var BatchRequest = /** @class */ (function (_super) {
1452
1467
  return result;
1453
1468
  };
1454
1469
  BatchRequest.prototype.createBoundary = function (prefix) {
1455
- return prefix + utils_1.utils.hex16() + '-' + utils_1.utils.hex16() + '-' + utils_1.utils.hex16();
1470
+ return prefix + utils_1.utils.hex16() + "-" + utils_1.utils.hex16() + "-" + utils_1.utils.hex16();
1456
1471
  };
1457
1472
  BatchRequest.prototype.addRequest = function (request) {
1458
1473
  this.requests.push({ id: this.counter, request: request });
@@ -1464,7 +1479,7 @@ var BatchRequest = /** @class */ (function (_super) {
1464
1479
  return options;
1465
1480
  };
1466
1481
  BatchRequest.constants = {
1467
- newLine: '\r\n'
1482
+ newLine: "\r\n"
1468
1483
  };
1469
1484
  return BatchRequest;
1470
1485
  }(ExecutableRequest_1.ExecutableRequest));
@@ -1502,17 +1517,17 @@ var ExecutableRequest = /** @class */ (function (_super) {
1502
1517
  }
1503
1518
  ExecutableRequest.prototype.execute = function () {
1504
1519
  var _this = this;
1505
- var http = new XMLHttpRequest();
1506
- http.onreadystatechange = function () {
1507
- if (http.readyState === XMLHttpRequestDone) {
1508
- if (http.status > 0) {
1509
- var data = _this.parseResponse(http);
1510
- if (http.status >= 200 && http.status <= 206) {
1511
- if (utils_1.utils.isFunction(_this.successCb)) {
1520
+ this.http = new XMLHttpRequest();
1521
+ this.http.onreadystatechange = function () {
1522
+ if (_this.http.readyState === XMLHttpRequestDone) {
1523
+ if (_this.http.status > 0) {
1524
+ var data = _this.parseResponse(_this.http);
1525
+ if (_this.http.status >= 200 && _this.http.status <= 206) {
1526
+ if (_this.successCb && utils_1.utils.isFunction(_this.successCb)) {
1512
1527
  _this.successCb(data);
1513
1528
  }
1514
1529
  }
1515
- else if (http.status >= 400) {
1530
+ else if (_this.http.status >= 400) {
1516
1531
  // When the data is string, we save the string as message
1517
1532
  // and convert the data to normal object with message property
1518
1533
  if (utils_1.utils.isString(data)) {
@@ -1520,27 +1535,31 @@ var ExecutableRequest = /** @class */ (function (_super) {
1520
1535
  message: data
1521
1536
  };
1522
1537
  }
1523
- data.status = http.status;
1538
+ data.status = _this.http.status;
1524
1539
  // in case of errors we would like there to be one handler for all of the errors
1525
- if (utils_1.utils.isFunction(_this.failureCb)) {
1540
+ if (_this.failureCb && utils_1.utils.isFunction(_this.failureCb)) {
1526
1541
  _this.failureCb(data);
1527
1542
  }
1528
1543
  }
1529
1544
  }
1530
1545
  }
1531
1546
  };
1532
- if (utils_1.utils.isFunction(this.progressCb)) {
1533
- if (http.upload) {
1534
- http.upload.onprogress = function (event) {
1535
- _this.progressCb(event);
1536
- };
1537
- }
1538
- }
1547
+ this.executeProgressEvent();
1539
1548
  var method = this.getMethod();
1540
1549
  var url = this.buildUrl();
1541
- http.open(method, url, true);
1542
- this.setHeaders(http, this.getHeaders());
1543
- http.send(utils_1.utils.serializeToJSON(this.getBody()));
1550
+ this.http.open(method, url, true);
1551
+ this.setHeaders(this.http, this.getHeaders());
1552
+ this.http.send(utils_1.utils.serializeToJSON(this.getBody()));
1553
+ };
1554
+ ExecutableRequest.prototype.executeProgressEvent = function () {
1555
+ var _this = this;
1556
+ if (this.http.upload) {
1557
+ this.http.upload.onprogress = function (event) {
1558
+ if (_this.progressCb && utils_1.utils.isFunction(_this.progressCb)) {
1559
+ _this.progressCb(event);
1560
+ }
1561
+ };
1562
+ }
1544
1563
  };
1545
1564
  ExecutableRequest.prototype.setHeaders = function (http, headers) {
1546
1565
  var headerKeys = Object.keys(headers);
@@ -1549,7 +1568,7 @@ var ExecutableRequest = /** @class */ (function (_super) {
1549
1568
  http.setRequestHeader(currentHeaderName, headers[currentHeaderName]);
1550
1569
  }
1551
1570
  if (this.token) {
1552
- if (typeof this.token === 'string') {
1571
+ if (typeof this.token === "string") {
1553
1572
  // for backward compatibility
1554
1573
  http.setRequestHeader(constants_1.HEADER_NAMES.authorization, this.token);
1555
1574
  }
@@ -1581,7 +1600,7 @@ exports.ExecutableRequest = ExecutableRequest;
1581
1600
 
1582
1601
 
1583
1602
  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;
1603
+ exports.CommitChunksRequest = exports.UploadChunkRequest = exports.UploadRequest = exports.CreateRelatedRequest = exports.DeleteRelatedByIdRequest = exports.DeleteRelatedRequest = exports.GetRelatedByIdRequest = exports.GetRelatedRequest = exports.CreateRequest = exports.UpdateRequest = exports.DeleteRequest = exports.GetByIdRequest = exports.GetRequest = void 0;
1585
1604
  var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
1586
1605
  var constants_1 = __webpack_require__(/*! ../constants */ "./src/constants.ts");
1587
1606
  var utils_1 = __webpack_require__(/*! ../utils */ "./src/utils.ts");
@@ -1763,6 +1782,81 @@ var UploadRequest = /** @class */ (function (_super) {
1763
1782
  return UploadRequest;
1764
1783
  }(CreateRequest));
1765
1784
  exports.UploadRequest = UploadRequest;
1785
+ var UploadChunkRequest = /** @class */ (function (_super) {
1786
+ tslib_1.__extends(UploadChunkRequest, _super);
1787
+ function UploadChunkRequest(requestOptions, token, sdkOptions) {
1788
+ var _this = _super.call(this, requestOptions, token, sdkOptions) || this;
1789
+ _this.contentType = requestOptions.fileMimeType;
1790
+ _this.chunkOrdinal = requestOptions.chunkOrdinal;
1791
+ _this.chunkedFileUploadSessionId = requestOptions.chunkedFileUploadSessionId;
1792
+ _this.chunkSize = requestOptions.chunkSize;
1793
+ _this.numberOfChunks = requestOptions.numberOfChunks;
1794
+ _this.positionInQueue = requestOptions.positionOfChunkInQueue;
1795
+ _this.blobStorageProviderName = requestOptions.blobStorageProviderName;
1796
+ _this.data = requestOptions.chunkBlob;
1797
+ return _this;
1798
+ }
1799
+ UploadChunkRequest.prototype.getHeaders = function () {
1800
+ var headers = _super.prototype.getHeaders.call(this);
1801
+ headers[constants_1.HEADER_NAMES.contentEncoding] = "identity";
1802
+ headers[constants_1.HEADER_NAMES.contentType] = this.contentType || "application/octet-stream";
1803
+ headers[constants_1.HEADER_NAMES.chunkOrdinal] = this.chunkOrdinal.toString();
1804
+ headers[constants_1.HEADER_NAMES.chunkedFileUploadSessionId] = this.chunkedFileUploadSessionId;
1805
+ headers[constants_1.HEADER_NAMES.chunkSize] = this.chunkSize.toString();
1806
+ headers[constants_1.HEADER_NAMES.blobStorageProviderName] = this.blobStorageProviderName.toString();
1807
+ return headers;
1808
+ };
1809
+ UploadChunkRequest.prototype.getBody = function () {
1810
+ return this.data;
1811
+ };
1812
+ UploadChunkRequest.prototype.getMethod = function () {
1813
+ return constants_1.HTTP_METHODS.post;
1814
+ };
1815
+ UploadChunkRequest.prototype.executeProgressEvent = function () {
1816
+ var _this = this;
1817
+ if (this.http.upload) {
1818
+ this.http.upload.onprogress = function () {
1819
+ var payload = {
1820
+ lengthComputable: true,
1821
+ loaded: _this.positionInQueue,
1822
+ total: _this.numberOfChunks
1823
+ };
1824
+ if (_this.progressCb && utils_1.utils.isFunction(_this.progressCb)) {
1825
+ _this.progressCb(payload);
1826
+ }
1827
+ };
1828
+ }
1829
+ };
1830
+ return UploadChunkRequest;
1831
+ }(CreateRequest));
1832
+ exports.UploadChunkRequest = UploadChunkRequest;
1833
+ var CommitChunksRequest = /** @class */ (function (_super) {
1834
+ tslib_1.__extends(CommitChunksRequest, _super);
1835
+ function CommitChunksRequest(requestOptions, token, sdkOptions) {
1836
+ var _this = _super.call(this, requestOptions, token, sdkOptions) || this;
1837
+ _this.action = "Default.CommitChunks";
1838
+ _this.data = {
1839
+ // ! this must be the param name that the operation provider on the server accepts
1840
+ commitChunksDto: {
1841
+ chunkedFileUploadSessionId: requestOptions.chunkedFileUploadSessionId,
1842
+ contentType: requestOptions.contentType,
1843
+ fileTotalSize: requestOptions.fileTotalSize,
1844
+ numberOfChunks: requestOptions.numberOfChunks,
1845
+ fileName: requestOptions.fileName,
1846
+ blobStorageProviderName: requestOptions.blobStorageProviderName,
1847
+ itemId: requestOptions.itemId || null,
1848
+ // ! must be named properties
1849
+ properties: requestOptions.uploadProperties
1850
+ }
1851
+ };
1852
+ return _this;
1853
+ }
1854
+ CommitChunksRequest.prototype.getMethod = function () {
1855
+ return constants_1.HTTP_METHODS.post;
1856
+ };
1857
+ return CommitChunksRequest;
1858
+ }(CreateRequest));
1859
+ exports.CommitChunksRequest = CommitChunksRequest;
1766
1860
 
1767
1861
 
1768
1862
  /***/ }),
@@ -1782,8 +1876,8 @@ var RequestBase = /** @class */ (function () {
1782
1876
  function RequestBase(options) {
1783
1877
  this.successCb = options.successCb;
1784
1878
  this.failureCb = options.failureCb;
1785
- this.urlOptions = options.urlOptions;
1786
1879
  this.progressCb = options.progressCb;
1880
+ this.urlOptions = options.urlOptions;
1787
1881
  this.key = options.key;
1788
1882
  this.action = options.action;
1789
1883
  this.fallbackProperties = options.fallbackProperties;
@@ -1950,6 +2044,12 @@ var RequestFactory = /** @class */ (function () {
1950
2044
  RequestFactory.prototype.upload = function (parameters) {
1951
2045
  return new Request_1.UploadRequest(parameters, this.token, this.options);
1952
2046
  };
2047
+ RequestFactory.prototype.uploadChunk = function (parameters) {
2048
+ return new Request_1.UploadChunkRequest(parameters, this.token, this.options);
2049
+ };
2050
+ RequestFactory.prototype.commitChunks = function (parameters) {
2051
+ return new Request_1.CommitChunksRequest(parameters, this.token, this.options);
2052
+ };
1953
2053
  RequestFactory.prototype.batch = function (parameters) {
1954
2054
  var batchParams = parameters;
1955
2055
  batchParams.factory = this;
@@ -2128,7 +2228,7 @@ var WhereQuery = /** @class */ (function () {
2128
2228
  return this.simple(constants_1.EXPRESSION_TYPE.endsWith, parameter, constant, caseSensitive);
2129
2229
  };
2130
2230
  /**
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.
2231
+ * Ends the definition of the current WhereQuery. You need to call this method in order to continue with the definition of the parent {@link Query}. All other `WhereQuery` methods return the current instance of `WhereQuery` to allow chaining.
2132
2232
  */
2133
2233
  WhereQuery.prototype.done = function () {
2134
2234
  if (this.parent instanceof WhereQuery) {
@@ -2160,6 +2260,247 @@ var WhereQuery = /** @class */ (function () {
2160
2260
  exports.WhereQuery = WhereQuery;
2161
2261
 
2162
2262
 
2263
+ /***/ }),
2264
+
2265
+ /***/ "./src/chunk-upload/chunk-upload.sdk.ts":
2266
+ /*!**********************************************!*\
2267
+ !*** ./src/chunk-upload/chunk-upload.sdk.ts ***!
2268
+ \**********************************************/
2269
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2270
+
2271
+
2272
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
2273
+ exports.ChunkUploadSdk = void 0;
2274
+ var chunked_file_upload_utilities_1 = __webpack_require__(/*! ./chunked-file-upload.utilities */ "./src/chunk-upload/chunked-file-upload.utilities.ts");
2275
+ /**
2276
+ * @description Entry point for all chunk upload related tasks
2277
+ * @export
2278
+ * @class ChunkUploadSdk
2279
+ */
2280
+ var ChunkUploadSdk = /** @class */ (function () {
2281
+ function ChunkUploadSdk(urlOptions, factory) {
2282
+ this.urlOptions = urlOptions;
2283
+ this.factory = factory;
2284
+ }
2285
+ /**
2286
+ * @description Gets the needed information to start uploading chunks to the server
2287
+ * @param {GetChunkUploadInfoRequestOptions} parameters
2288
+ * @memberof ChunkUploadSdk
2289
+ */
2290
+ ChunkUploadSdk.prototype.getChunkUploadInfo = function (parameters) {
2291
+ Guard.isNotNull(parameters, "parameters");
2292
+ Guard.isNotNull(parameters.data, "parameters.data");
2293
+ Guard.isNotNull(parameters.data.libraryId, "parameters.data.libraryId");
2294
+ var options = {
2295
+ urlOptions: this.urlOptions,
2296
+ action: "Default.GetChunkUploadInfo(libraryId=".concat(parameters.data.libraryId, ")"),
2297
+ successCb: parameters.successCb,
2298
+ failureCb: parameters.failureCb,
2299
+ progressCb: parameters.progressCb,
2300
+ fallbackProperties: parameters.fallbackProperties,
2301
+ query: parameters.query
2302
+ };
2303
+ var request = this.factory.get(options);
2304
+ request.execute();
2305
+ };
2306
+ /**
2307
+ * @description Sends a single chunk request to the server
2308
+ * @param {UploadChunkRequestOptions} parameters
2309
+ * @memberof ChunkUploadSdk
2310
+ */
2311
+ ChunkUploadSdk.prototype.uploadChunk = function (parameters) {
2312
+ Guard.isNotNull(parameters, "parameters");
2313
+ Guard.isNotNull(parameters.data, "parameters.data");
2314
+ Guard.isNotNull(parameters.data.fileMimeType, "parameters.data.fileMimeType");
2315
+ Guard.isNotNull(parameters.data.chunkSize, "parameters.data.chunkSize");
2316
+ Guard.isNotNull(parameters.data.chunkedFileUploadSessionId, "parameters.data.chunkedFileUploadSessionId");
2317
+ Guard.isNotNull(parameters.data.chunkOrdinal, "parameters.data.chunkOrdinal");
2318
+ Guard.isNotNull(parameters.data.numberOfChunks, "parameters.data.numberOfChunks");
2319
+ Guard.isNotNull(parameters.data.chunkBlob, "parameters.data.chunkBlob");
2320
+ Guard.isNotNull(parameters.data.blobStorageProviderName, "parameters.data.blobStorageProviderName");
2321
+ var request = this.factory.uploadChunk({
2322
+ urlOptions: this.urlOptions,
2323
+ fileMimeType: parameters.data.fileMimeType,
2324
+ chunkSize: parameters.data.chunkSize,
2325
+ chunkedFileUploadSessionId: parameters.data.chunkedFileUploadSessionId,
2326
+ chunkOrdinal: parameters.data.chunkOrdinal,
2327
+ numberOfChunks: parameters.data.numberOfChunks,
2328
+ chunkBlob: parameters.data.chunkBlob,
2329
+ blobStorageProviderName: parameters.data.blobStorageProviderName,
2330
+ // optional
2331
+ positionOfChunkInQueue: parameters.data.positionOfChunkInQueue,
2332
+ successCb: parameters.successCb,
2333
+ failureCb: parameters.failureCb,
2334
+ progressCb: parameters.progressCb,
2335
+ fallbackProperties: parameters.fallbackProperties,
2336
+ query: parameters.query
2337
+ });
2338
+ request.execute();
2339
+ };
2340
+ /**
2341
+ * @description Sends the commit chunks request to the server
2342
+ * @param {CommitChunksRequestOptions} parameters
2343
+ * @memberof ChunkUploadSdk
2344
+ */
2345
+ ChunkUploadSdk.prototype.commitChunks = function (parameters) {
2346
+ Guard.isNotNull(parameters, "parameters");
2347
+ Guard.isNotNull(parameters.data, "parameters.data");
2348
+ Guard.isNotNull(parameters.data.chunkedFileUploadSessionId, "parameters.data.chunkedFileUploadSessionId");
2349
+ Guard.isNotNull(parameters.data.contentType, "parameters.data.contentType");
2350
+ Guard.isNotNull(parameters.data.name, "parameters.data.name");
2351
+ Guard.isNotNull(parameters.data.uploadProperties, "parameters.data.uploadProperties");
2352
+ Guard.isNotNull(parameters.data.numberOfChunks, "parameters.data.numberOfChunks");
2353
+ Guard.isNotNull(parameters.data.fileTotalSize, "parameters.data.fileTotalSize");
2354
+ Guard.isNotNull(parameters.data.blobStorageProviderName, "parameters.data.blobStorageProviderName");
2355
+ var options = {
2356
+ urlOptions: this.urlOptions,
2357
+ chunkedFileUploadSessionId: parameters.data.chunkedFileUploadSessionId,
2358
+ contentType: parameters.data.contentType,
2359
+ fileName: parameters.data.name,
2360
+ uploadProperties: parameters.data.uploadProperties,
2361
+ numberOfChunks: parameters.data.numberOfChunks,
2362
+ fileTotalSize: parameters.data.fileTotalSize,
2363
+ blobStorageProviderName: parameters.data.blobStorageProviderName,
2364
+ // Optional: used for update, can be null for create
2365
+ itemId: parameters.data.itemId,
2366
+ successCb: parameters.successCb,
2367
+ failureCb: parameters.failureCb,
2368
+ progressCb: parameters.progressCb,
2369
+ fallbackProperties: parameters.fallbackProperties,
2370
+ query: parameters.query
2371
+ };
2372
+ var request = this.factory.commitChunks(options);
2373
+ request.execute();
2374
+ };
2375
+ /**
2376
+ * @description This request is intended to be used when something in the chunk upload process fails to delete the sent chunks
2377
+ * @param {CleanUpChunksRequestOptions} parameters
2378
+ * @memberof ChunkUploadSdk
2379
+ */
2380
+ ChunkUploadSdk.prototype.cleanUpChunks = function (parameters) {
2381
+ Guard.isNotNull(parameters, "parameters");
2382
+ Guard.isNotNull(parameters.data, "parameters.data");
2383
+ Guard.isNotNull(parameters.data.chunkedFileUploadSessionId, "parameters.data.chunkedFileUploadSessionId");
2384
+ Guard.isNotNull(parameters.data.blobStorageProviderName, "parameters.data.blobStorageProviderName");
2385
+ var request = this.factory.create({
2386
+ urlOptions: this.urlOptions,
2387
+ action: "Default.CleanUpChunks",
2388
+ data: {
2389
+ chunkedFileUploadSessionId: parameters.data.chunkedFileUploadSessionId,
2390
+ blobStorageProviderName: parameters.data.blobStorageProviderName
2391
+ },
2392
+ successCb: parameters.successCb,
2393
+ failureCb: parameters.failureCb,
2394
+ progressCb: parameters.progressCb,
2395
+ fallbackProperties: parameters.fallbackProperties,
2396
+ query: parameters.query
2397
+ });
2398
+ request.execute();
2399
+ };
2400
+ /**
2401
+ * Chunks the provided file. If the file is a base64 string this method will convert it to a blob and then chunk it.
2402
+ *
2403
+ * @param {(Blob | string)} file
2404
+ * @param {number} chunkSize
2405
+ * @param {string} contentTypeMime
2406
+ * @return {*} {ChunkFileResult}
2407
+ * @memberof ChunkUploadService
2408
+ */
2409
+ ChunkUploadSdk.prototype.chunkFile = function (file, chunkSize, contentTypeMime) {
2410
+ Guard.isNotNull(file, "file");
2411
+ Guard.isNotNull(chunkSize, "chunkSize");
2412
+ Guard.isNotNull(contentTypeMime, "contentTypeMime");
2413
+ var utils = new chunked_file_upload_utilities_1.ChunkedFileUploadUtilities();
2414
+ return utils.chunkFile(file, chunkSize, contentTypeMime);
2415
+ };
2416
+ return ChunkUploadSdk;
2417
+ }());
2418
+ exports.ChunkUploadSdk = ChunkUploadSdk;
2419
+ var Guard = /** @class */ (function () {
2420
+ function Guard() {
2421
+ }
2422
+ Guard.isNotNull = function (value, parameterName) {
2423
+ if (typeof (value) === "number") {
2424
+ if (value === null || value === undefined) {
2425
+ Guard.throwException(parameterName);
2426
+ }
2427
+ return;
2428
+ }
2429
+ if (!value) {
2430
+ Guard.throwException(parameterName);
2431
+ }
2432
+ };
2433
+ Guard.throwException = function (parameterName) {
2434
+ throw "parameter ".concat(parameterName, " is required.");
2435
+ };
2436
+ return Guard;
2437
+ }());
2438
+ //#endregion
2439
+
2440
+
2441
+ /***/ }),
2442
+
2443
+ /***/ "./src/chunk-upload/chunked-file-upload.utilities.ts":
2444
+ /*!***********************************************************!*\
2445
+ !*** ./src/chunk-upload/chunked-file-upload.utilities.ts ***!
2446
+ \***********************************************************/
2447
+ /***/ ((__unused_webpack_module, exports) => {
2448
+
2449
+
2450
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
2451
+ exports.ChunkedFileUploadUtilities = void 0;
2452
+ var ChunkedFileUploadUtilities = /** @class */ (function () {
2453
+ function ChunkedFileUploadUtilities() {
2454
+ }
2455
+ ChunkedFileUploadUtilities.prototype.chunkFile = function (file, chunkSize, contentTypeMime) {
2456
+ var fileInternal;
2457
+ if (typeof file === "string")
2458
+ fileInternal = this.base64ToBlob(file, chunkSize, contentTypeMime);
2459
+ else {
2460
+ fileInternal = file;
2461
+ }
2462
+ var fileSize = fileInternal.size;
2463
+ var result = [];
2464
+ var chunkOrdinal = 0;
2465
+ var offset = 0;
2466
+ var currentOffset = chunkSize;
2467
+ while (offset <= fileSize) {
2468
+ var chunk = fileInternal.slice(offset, currentOffset, contentTypeMime);
2469
+ offset = currentOffset;
2470
+ currentOffset = currentOffset + chunkSize;
2471
+ result.push({
2472
+ ordinal: chunkOrdinal,
2473
+ content: chunk
2474
+ });
2475
+ chunkOrdinal++;
2476
+ }
2477
+ return {
2478
+ chunks: result,
2479
+ totalChunksCount: result.length,
2480
+ fileTotalSize: fileSize
2481
+ };
2482
+ };
2483
+ ChunkedFileUploadUtilities.prototype.base64ToBlob = function (base64String, chunkSize, contentType) {
2484
+ if (contentType === void 0) { contentType = ""; }
2485
+ var byteCharacters = atob(base64String);
2486
+ var byteArrays = [];
2487
+ for (var offset = 0; offset < byteCharacters.length; offset += chunkSize) {
2488
+ var slice = byteCharacters.slice(offset, offset + chunkSize);
2489
+ var byteNumbers = new Array(slice.length);
2490
+ for (var i = 0; i < slice.length; i++) {
2491
+ byteNumbers[i] = slice.charCodeAt(i);
2492
+ }
2493
+ var byteArray = new Uint8Array(byteNumbers);
2494
+ byteArrays.push(byteArray);
2495
+ }
2496
+ var blob = new Blob(byteArrays, { type: contentType });
2497
+ return blob;
2498
+ };
2499
+ return ChunkedFileUploadUtilities;
2500
+ }());
2501
+ exports.ChunkedFileUploadUtilities = ChunkedFileUploadUtilities;
2502
+
2503
+
2163
2504
  /***/ }),
2164
2505
 
2165
2506
  /***/ "./src/constants.ts":
@@ -2174,34 +2515,34 @@ exports.CONTENT_TYPES = exports.HTTP_METHODS = exports.HEADER_NAMES = exports.SF
2174
2515
  exports.EXPRESSION_TYPE = {
2175
2516
  query: 1,
2176
2517
  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'
2518
+ and: "and",
2519
+ or: "or",
2520
+ not: "not",
2521
+ eq: "eq",
2522
+ ne: "ne",
2523
+ lt: "lt",
2524
+ le: "le",
2525
+ gt: "gt",
2526
+ ge: "ge",
2527
+ any: "any",
2528
+ contains: "contains",
2529
+ startsWith: "startsWith",
2530
+ endsWith: "endsWith"
2190
2531
  };
2191
2532
  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'
2533
+ $filter: "$filter",
2534
+ $select: "$select",
2535
+ $expand: "$expand",
2536
+ $orderby: "$orderby",
2537
+ $skip: "$skip",
2538
+ $top: "$top",
2539
+ $count: "$count",
2540
+ $search: "$search"
2200
2541
  };
2201
2542
  exports.SF_PARAMS = {
2202
- provider: 'sf_provider',
2203
- culture: 'sf_culture',
2204
- siteId: 'sf_site',
2543
+ provider: "sf_provider",
2544
+ culture: "sf_culture",
2545
+ siteId: "sf_site",
2205
2546
  fallbackParams: "sf_fallback_prop_names",
2206
2547
  parentId: "parentId"
2207
2548
  };
@@ -2214,7 +2555,12 @@ exports.HEADER_NAMES = {
2214
2555
  fileName: "X-File-Name",
2215
2556
  serviceRequest: "X-SF-Service-Request",
2216
2557
  choicesBinaryRepresentation: "X-SF-Binary-Choice-Representation",
2217
- integrationMode: "X-SF-Integration-Mode"
2558
+ integrationMode: "X-SF-Integration-Mode",
2559
+ chunkOrdinal: "X-SF-Chunk-Ordinal",
2560
+ chunkSize: "X-SF-Chunk-Size",
2561
+ fileSize: "X-SF-File-Size",
2562
+ chunkedFileUploadSessionId: "X-SF-Chunked-File-Upload-Session-Id",
2563
+ blobStorageProviderName: "X-SF-Blob-Storage-Provider-Name"
2218
2564
  };
2219
2565
  exports.HTTP_METHODS = {
2220
2566
  get: "GET",
@@ -2243,19 +2589,19 @@ var utils = /** @class */ (function () {
2243
2589
  function utils() {
2244
2590
  }
2245
2591
  utils.isString = function (obj) {
2246
- return typeof (obj) === 'string' || obj instanceof String;
2592
+ return typeof (obj) === "string" || obj instanceof String;
2247
2593
  };
2248
2594
  utils.isBoolean = function (obj) {
2249
- return typeof (obj) === 'boolean';
2595
+ return typeof (obj) === "boolean";
2250
2596
  };
2251
2597
  utils.isBlob = function (obj) {
2252
2598
  return obj instanceof Blob;
2253
2599
  };
2254
2600
  utils.isNumber = function (value) {
2255
- return typeof value === 'number' && isFinite(value);
2601
+ return typeof value === "number" && isFinite(value);
2256
2602
  };
2257
2603
  utils.isFunction = function (func) {
2258
- return typeof func === 'function';
2604
+ return typeof func === "function";
2259
2605
  };
2260
2606
  utils.serializeToJSON = function (data) {
2261
2607
  if (!utils.isString(data) && !this.isBlob(data)) {
@@ -2299,13 +2645,13 @@ var utils = /** @class */ (function () {
2299
2645
  };
2300
2646
  utils.addTrailingSlash = function (url) {
2301
2647
  url = utils.removeSlashes(url);
2302
- url += '/';
2648
+ url += "/";
2303
2649
  return url;
2304
2650
  };
2305
2651
  utils.removeSlashes = function (url) {
2306
2652
  var ret = url;
2307
2653
  var lastChar = ret.substr(-1);
2308
- if (lastChar == '/')
2654
+ if (lastChar == "/")
2309
2655
  ret = ret.substr(0, ret.length - 1);
2310
2656
  return ret;
2311
2657
  };
@@ -2315,14 +2661,14 @@ var utils = /** @class */ (function () {
2315
2661
  if (!to)
2316
2662
  to = {};
2317
2663
  for (var property in from) {
2318
- if (from[property] && from[property].constructor && from[property].constructor === Object && typeof from[property] == 'function') {
2664
+ if (from[property] && from[property].constructor && from[property].constructor === Object && typeof from[property] == "function") {
2319
2665
  to[property] = to[property] || {};
2320
2666
  arguments.callee(to[property], from[property]);
2321
2667
  }
2322
2668
  else {
2323
2669
  to[property] = from[property];
2324
2670
  }
2325
- if (typeof action === 'function')
2671
+ if (typeof action === "function")
2326
2672
  action(to);
2327
2673
  }
2328
2674
  return to;
@@ -2358,32 +2704,33 @@ exports.utils = utils;
2358
2704
 
2359
2705
  __webpack_require__.r(__webpack_exports__);
2360
2706
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2361
- /* harmony export */ "__extends": () => (/* binding */ __extends),
2362
2707
  /* harmony export */ "__assign": () => (/* binding */ __assign),
2363
- /* harmony export */ "__rest": () => (/* binding */ __rest),
2364
- /* harmony export */ "__decorate": () => (/* binding */ __decorate),
2365
- /* harmony export */ "__param": () => (/* binding */ __param),
2366
- /* harmony export */ "__metadata": () => (/* binding */ __metadata),
2708
+ /* harmony export */ "__asyncDelegator": () => (/* binding */ __asyncDelegator),
2709
+ /* harmony export */ "__asyncGenerator": () => (/* binding */ __asyncGenerator),
2710
+ /* harmony export */ "__asyncValues": () => (/* binding */ __asyncValues),
2711
+ /* harmony export */ "__await": () => (/* binding */ __await),
2367
2712
  /* harmony export */ "__awaiter": () => (/* binding */ __awaiter),
2368
- /* harmony export */ "__generator": () => (/* binding */ __generator),
2713
+ /* harmony export */ "__classPrivateFieldGet": () => (/* binding */ __classPrivateFieldGet),
2714
+ /* harmony export */ "__classPrivateFieldIn": () => (/* binding */ __classPrivateFieldIn),
2715
+ /* harmony export */ "__classPrivateFieldSet": () => (/* binding */ __classPrivateFieldSet),
2369
2716
  /* harmony export */ "__createBinding": () => (/* binding */ __createBinding),
2717
+ /* harmony export */ "__decorate": () => (/* binding */ __decorate),
2370
2718
  /* harmony export */ "__exportStar": () => (/* binding */ __exportStar),
2371
- /* harmony export */ "__values": () => (/* binding */ __values),
2719
+ /* harmony export */ "__extends": () => (/* binding */ __extends),
2720
+ /* harmony export */ "__generator": () => (/* binding */ __generator),
2721
+ /* harmony export */ "__importDefault": () => (/* binding */ __importDefault),
2722
+ /* harmony export */ "__importStar": () => (/* binding */ __importStar),
2723
+ /* harmony export */ "__makeTemplateObject": () => (/* binding */ __makeTemplateObject),
2724
+ /* harmony export */ "__metadata": () => (/* binding */ __metadata),
2725
+ /* harmony export */ "__param": () => (/* binding */ __param),
2372
2726
  /* harmony export */ "__read": () => (/* binding */ __read),
2727
+ /* harmony export */ "__rest": () => (/* binding */ __rest),
2373
2728
  /* harmony export */ "__spread": () => (/* binding */ __spread),
2374
- /* harmony export */ "__spreadArrays": () => (/* binding */ __spreadArrays),
2375
2729
  /* harmony export */ "__spreadArray": () => (/* binding */ __spreadArray),
2376
- /* harmony export */ "__await": () => (/* binding */ __await),
2377
- /* harmony export */ "__asyncGenerator": () => (/* binding */ __asyncGenerator),
2378
- /* harmony export */ "__asyncDelegator": () => (/* binding */ __asyncDelegator),
2379
- /* harmony export */ "__asyncValues": () => (/* binding */ __asyncValues),
2380
- /* harmony export */ "__makeTemplateObject": () => (/* binding */ __makeTemplateObject),
2381
- /* harmony export */ "__importStar": () => (/* binding */ __importStar),
2382
- /* harmony export */ "__importDefault": () => (/* binding */ __importDefault),
2383
- /* harmony export */ "__classPrivateFieldGet": () => (/* binding */ __classPrivateFieldGet),
2384
- /* harmony export */ "__classPrivateFieldSet": () => (/* binding */ __classPrivateFieldSet)
2730
+ /* harmony export */ "__spreadArrays": () => (/* binding */ __spreadArrays),
2731
+ /* harmony export */ "__values": () => (/* binding */ __values)
2385
2732
  /* harmony export */ });
2386
- /*! *****************************************************************************
2733
+ /******************************************************************************
2387
2734
  Copyright (c) Microsoft Corporation.
2388
2735
 
2389
2736
  Permission to use, copy, modify, and/or distribute this software for any
@@ -2492,7 +2839,11 @@ function __generator(thisArg, body) {
2492
2839
 
2493
2840
  var __createBinding = Object.create ? (function(o, m, k, k2) {
2494
2841
  if (k2 === undefined) k2 = k;
2495
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
2842
+ var desc = Object.getOwnPropertyDescriptor(m, k);
2843
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
2844
+ desc = { enumerable: true, get: function() { return m[k]; } };
2845
+ }
2846
+ Object.defineProperty(o, k2, desc);
2496
2847
  }) : (function(o, m, k, k2) {
2497
2848
  if (k2 === undefined) k2 = k;
2498
2849
  o[k2] = m[k];
@@ -2622,6 +2973,11 @@ function __classPrivateFieldSet(receiver, state, value, kind, f) {
2622
2973
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
2623
2974
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
2624
2975
  }
2976
+
2977
+ function __classPrivateFieldIn(state, receiver) {
2978
+ if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
2979
+ return typeof state === "function" ? receiver === state : state.has(receiver);
2980
+ }
2625
2981
 
2626
2982
 
2627
2983
  /***/ })