@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
package/package.json CHANGED
@@ -1,39 +1,41 @@
1
1
  {
2
2
  "name": "@progress/sitefinity-webservices-sdk",
3
- "version": "1.0.4",
3
+ "version": "1.1.0",
4
4
  "scripts": {
5
- "start": "webpack-dev-server --config config/webpack.dev.js",
6
- "build:dev": "webpack --config config/webpack.dev.js --progress --profile",
7
- "build:prod": "webpack --config config/webpack.prod.js --progress --profile",
8
- "build:release": "npm run build:prod & npm run build:dev & npm run docs",
5
+ "start": "webpack-dev-server --config config/webpack.dev.ts",
6
+ "build:dev": "webpack --config config/webpack.dev.ts --progress --profile",
7
+ "build:prod": "webpack --config config/webpack.prod.ts --progress --profile",
8
+ "build:release": "npm run build:dev & npm run build:prod & npm run docs",
9
9
  "test": "karma start --single_run",
10
10
  "test:debug": "karma start",
11
11
  "docs": "typedoc",
12
- "lint": "eslint . --ext .ts"
12
+ "lint": "eslint . --ext .ts",
13
+ "lint:fix": "eslint . --ext .ts --fix"
13
14
  },
14
15
  "devDependencies": {
15
- "@types/jasmine": "3.10.3",
16
+ "@types/jasmine": "4.3.0",
16
17
  "@types/jasmine-ajax": "3.3.3",
17
- "@types/node": "17.0.21",
18
- "@typescript-eslint/eslint-plugin": "5.13.0",
19
- "@typescript-eslint/parser": "5.13.0",
20
- "awesome-typescript-loader": "5.2.1",
21
- "eslint": "8.10.0",
18
+ "@types/node": "18.7.14",
19
+ "@typescript-eslint/eslint-plugin": "5.36.2",
20
+ "@typescript-eslint/parser": "5.36.2",
21
+ "eslint": "8.23.0",
22
22
  "html-webpack-plugin": "5.5.0",
23
- "jasmine": "4.0.2",
23
+ "jasmine": "4.3.0",
24
24
  "jasmine-ajax": "4.0.0",
25
25
  "jasmine-spec-reporter": "7.0.0",
26
- "karma": "6.3.17",
27
- "karma-chrome-launcher": "3.1.0",
28
- "karma-jasmine": "4.0.1",
26
+ "karma": "6.4.0",
27
+ "karma-chrome-launcher": "3.1.1",
28
+ "karma-jasmine": "5.1.0",
29
29
  "karma-jasmine-ajax": "0.1.13",
30
- "karma-spec-reporter": "0.0.33",
30
+ "karma-spec-reporter": "0.0.34",
31
31
  "karma-typescript": "5.5.3",
32
- "typedoc": "0.22.12",
33
- "typescript": "4.6.2",
34
- "webpack": "5.69.1",
35
- "webpack-cli": "4.9.2",
36
- "webpack-dev-server": "4.7.4",
32
+ "ts-loader": "9.3.1",
33
+ "ts-node": "10.9.1",
34
+ "typedoc": "0.23.11",
35
+ "typescript": "4.8.2",
36
+ "webpack": "5.74.0",
37
+ "webpack-cli": "4.10.0",
38
+ "webpack-dev-server": "4.10.1",
37
39
  "webpack-merge": "5.8.0"
38
40
  }
39
41
  }
@@ -4,7 +4,6 @@ export * from "./src/utils";
4
4
  export * from "./src/WhereQuery";
5
5
  export * from "./src/Sitefinity";
6
6
  export * from "./src/QueryBuilder";
7
- export * from "./src/QueryBase";
8
7
  export * from "./src/Query";
9
8
  export * from "./src/OrderProperty";
10
9
  export * from "./src/Expression";
package/src/Data.spec.ts CHANGED
@@ -44,11 +44,11 @@ describe("Data class tests", () => {
44
44
  const request = jasmine.Ajax.requests.mostRecent();
45
45
  expect(request.url).toContain(`${ODATA_PARAMS.$filter}=${queryResult}`);
46
46
  expect(request.url).toContain(`${baseUrl}${action}`);
47
- expect(request.url).toContain(`${SF_PARAMS.fallbackParams}=${fallbackProperties.join(',')}`);
47
+ expect(request.url).toContain(`${SF_PARAMS.fallbackParams}=${fallbackProperties.join(",")}`);
48
48
 
49
49
  request.respondWith({
50
50
  status: 200,
51
- responseText: '{"message":"test"}'
51
+ responseText: "{\"message\":\"test\"}"
52
52
  });
53
53
 
54
54
  expect(successCbSpy).toHaveBeenCalledOnceWith({ message: "test" });
@@ -64,10 +64,10 @@ describe("Data class tests", () => {
64
64
  const request = jasmine.Ajax.requests.mostRecent();
65
65
  request.respondWith({
66
66
  status: 400,
67
- responseText: '{"message":"test"}'
67
+ responseText: "{\"message\":\"test\"}"
68
68
  });
69
69
 
70
- expect(failureCbSpy).toHaveBeenCalledOnceWith({ message: "test", status: 400 })
70
+ expect(failureCbSpy).toHaveBeenCalledOnceWith({ message: "test", status: 400 });
71
71
  expect(successCbSpy).not.toHaveBeenCalled();
72
72
  });
73
73
 
@@ -85,7 +85,7 @@ describe("Data class tests", () => {
85
85
 
86
86
  request.respondWith({
87
87
  status: 200,
88
- responseText: '{"message":"test"}'
88
+ responseText: "{\"message\":\"test\"}"
89
89
  });
90
90
 
91
91
  expect(successCbSpy).toHaveBeenCalledOnceWith({ message: "test" });
@@ -110,10 +110,10 @@ describe("Data class tests", () => {
110
110
  const request = jasmine.Ajax.requests.mostRecent();
111
111
  request.respondWith({
112
112
  status: 400,
113
- responseText: '{"message":"test"}'
113
+ responseText: "{\"message\":\"test\"}"
114
114
  });
115
115
 
116
- expect(failureCbSpy).toHaveBeenCalledOnceWith({ message: "test", status: 400 })
116
+ expect(failureCbSpy).toHaveBeenCalledOnceWith({ message: "test", status: 400 });
117
117
  expect(successCbSpy).not.toHaveBeenCalled();
118
118
  });
119
119
 
@@ -130,11 +130,11 @@ describe("Data class tests", () => {
130
130
  const request = jasmine.Ajax.requests.mostRecent();
131
131
  expect(request.url).toContain(`${ODATA_PARAMS.$filter}=${queryResult}`);
132
132
  expect(request.url).toContain(`${baseUrl}(${key})/${action}`);
133
- expect(request.url).toContain(`${SF_PARAMS.fallbackParams}=${fallbackProperties.join(',')}`);
133
+ expect(request.url).toContain(`${SF_PARAMS.fallbackParams}=${fallbackProperties.join(",")}`);
134
134
 
135
135
  request.respondWith({
136
136
  status: 200,
137
- responseText: '{"message":"test"}'
137
+ responseText: "{\"message\":\"test\"}"
138
138
  });
139
139
 
140
140
  expect(successCbSpy).toHaveBeenCalledOnceWith({ message: "test" });
@@ -151,10 +151,10 @@ describe("Data class tests", () => {
151
151
  const request = jasmine.Ajax.requests.mostRecent();
152
152
  request.respondWith({
153
153
  status: 400,
154
- responseText: '{"message":"test"}'
154
+ responseText: "{\"message\":\"test\"}"
155
155
  });
156
156
 
157
- expect(failureCbSpy).toHaveBeenCalledOnceWith({ message: "test", status: 400 })
157
+ expect(failureCbSpy).toHaveBeenCalledOnceWith({ message: "test", status: 400 });
158
158
  expect(successCbSpy).not.toHaveBeenCalled();
159
159
  });
160
- });
160
+ });
package/src/Data.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { SF_PARAMS } from "./constants";
1
+ import { ChunkUploadSdk } from "./chunk-upload/chunk-upload.sdk";
2
+ import { SF_PARAMS } from "./constants";
2
3
  import { Query } from "./Query";
3
4
  import { ExecutableRequest } from "./Requests/ExecutableRequest";
4
5
  import { RequestFactory } from "./Requests/RequestFactory";
@@ -16,6 +17,19 @@ export class Data {
16
17
  this.factory = factory;
17
18
  }
18
19
 
20
+
21
+ /**
22
+ * Returns an instance of the @type {ChunkUploadService}
23
+ *
24
+ * @readonly
25
+ * @type {ChunkUploadSdk}
26
+ * @memberof Data
27
+ */
28
+ public get chunkUpload(): ChunkUploadSdk {
29
+ const service = new ChunkUploadSdk(this.urlOptions, this.factory);
30
+ return service;
31
+ }
32
+
19
33
  /**
20
34
  * Executes a GET request to retrieve a collection of items.
21
35
  */
@@ -275,7 +289,7 @@ export class Data {
275
289
 
276
290
  const data = {
277
291
  "@odata.id": parameters.link
278
- }
292
+ };
279
293
 
280
294
  const request = this.factory.createRelated({
281
295
  urlOptions: this.urlOptions,
@@ -322,7 +336,7 @@ export class Data {
322
336
  _factory: this.factory,
323
337
  successCb: parameters.successCb,
324
338
  failureCb: parameters.failureCb
325
- }
339
+ };
326
340
 
327
341
  const batch = this.factory.batch(options);
328
342
  const transaction = batch.beginTransaction();
@@ -353,7 +367,7 @@ export class Data {
353
367
  }
354
368
 
355
369
  batch.endTransaction(transaction);
356
- batch.execute();
370
+ return batch.execute();
357
371
  }
358
372
  }
359
373
 
@@ -362,6 +376,7 @@ export interface RequestOptionsBase {
362
376
  action?: string;
363
377
  successCb?: Function;
364
378
  failureCb?: Function;
379
+ progressCb?: Function;
365
380
  fallbackProperties?: string[];
366
381
  key?: string | number;
367
382
  }
@@ -1,19 +1,19 @@
1
- import { utils } from './utils';
1
+ import { utils } from "./utils";
2
2
 
3
3
  export class OrderProperty {
4
4
  constructor(private propertyPath: string, private isDesc: boolean = null) {
5
5
  if (!utils.isString(propertyPath))
6
- throw new Error('Property name is not a valid string');
6
+ throw new Error("Property name is not a valid string");
7
7
 
8
8
  propertyPath = propertyPath.trim();
9
9
 
10
- const parts = propertyPath.split(' ');
10
+ const parts = propertyPath.split(" ");
11
11
  // parts[0] is the propertyPath; [1] would be whether descending or not.
12
12
  if (parts.length > 1 && isDesc !== true && isDesc !== false) {
13
- isDesc = parts[1].toLowerCase() == 'desc';
13
+ isDesc = parts[1].toLowerCase() == "desc";
14
14
  if (!isDesc) {
15
15
  // isDesc is false but check to make sure its intended.
16
- const isAsc = parts[1].toLowerCase() == 'asc';
16
+ const isAsc = parts[1].toLowerCase() == "asc";
17
17
  if (!isAsc) {
18
18
  throw new Error("the second word in the propertyPath must begin with 'desc' or 'asc'");
19
19
  }
@@ -33,7 +33,7 @@ export class OrderProperty {
33
33
  }
34
34
 
35
35
  getValue(): string {
36
- const direction = (this.isDesc) ? 'desc' : 'asc';
37
- return this.propertyPath + ' ' + direction;
36
+ const direction = (this.isDesc) ? "desc" : "asc";
37
+ return this.propertyPath + " " + direction;
38
38
  }
39
39
  }
package/src/Query.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { QueryBase } from './QueryBase';
2
- import { WhereQuery } from './WhereQuery';
3
- import { OrderProperty } from './OrderProperty';
4
- import { QueryBuilder } from './QueryBuilder';
1
+ import { QueryBase } from "./QueryBase";
2
+ import { WhereQuery } from "./WhereQuery";
3
+ import { OrderProperty } from "./OrderProperty";
4
+ import { QueryBuilder } from "./QueryBuilder";
5
5
 
6
6
  /**
7
7
  * The query class is used for constructing queries.
package/src/QueryBase.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { utils } from './utils';
1
+ import { utils } from "./utils";
2
2
 
3
3
  /**
4
4
  * The base class for dealing with queries.
@@ -41,11 +41,11 @@ export class QueryBase {
41
41
  for (let i = 0; i < propPaths.length; i++) {
42
42
  const member = propPaths[i];
43
43
  if (!utils.isString(member)) {
44
- throw new Error('Invalid argument in clause');
44
+ throw new Error("Invalid argument in clause");
45
45
  }
46
46
 
47
- if (!allowNested && member.indexOf('.') > -1) {
48
- throw new Error('Invalid argument in clause');
47
+ if (!allowNested && member.indexOf(".") > -1) {
48
+ throw new Error("Invalid argument in clause");
49
49
  }
50
50
  }
51
51
  }
@@ -1,7 +1,7 @@
1
- import { WhereQuery } from './WhereQuery';
2
- import { ComplexExpression, BinaryExpression } from './Expression';
3
- import { OrderProperty } from './OrderProperty';
4
- import { utils } from './utils';
1
+ import { WhereQuery } from "./WhereQuery";
2
+ import { ComplexExpression, BinaryExpression } from "./Expression";
3
+ import { OrderProperty } from "./OrderProperty";
4
+ import { utils } from "./utils";
5
5
  import { ODATA_PARAMS, EXPRESSION_TYPE } from "./constants";
6
6
  import { Query } from "./Query";
7
7
 
@@ -24,12 +24,12 @@ export class QueryBuilder {
24
24
 
25
25
  const selectClause = this.query.selectProperties;
26
26
  if (selectClause instanceof Array) {
27
- queryParameters[ODATA_PARAMS.$select] = selectClause.join(', ');
27
+ queryParameters[ODATA_PARAMS.$select] = selectClause.join(", ");
28
28
  }
29
29
 
30
30
  const expandClause = this.query.expandProperties;
31
31
  if (expandClause instanceof Array)
32
- queryParameters[ODATA_PARAMS.$expand] = expandClause.join(', ');
32
+ queryParameters[ODATA_PARAMS.$expand] = expandClause.join(", ");
33
33
 
34
34
  const orderByClause = this.query.orderProperties;
35
35
  if (orderByClause instanceof Array) {
@@ -38,7 +38,7 @@ export class QueryBuilder {
38
38
  if (orderByClause[i] instanceof OrderProperty)
39
39
  order.push(orderByClause[i].getValue());
40
40
  }
41
- queryParameters[ODATA_PARAMS.$orderby] = order.join(', ');
41
+ queryParameters[ODATA_PARAMS.$orderby] = order.join(", ");
42
42
  }
43
43
 
44
44
  const take = this.query.takeValue;
@@ -62,10 +62,10 @@ export class QueryBuilder {
62
62
 
63
63
  private buildComplexExpression(expression: ComplexExpression, parent: string): string {
64
64
  if (!(expression instanceof ComplexExpression))
65
- throw new Error('Invalid complex expression');
65
+ throw new Error("Invalid complex expression");
66
66
 
67
67
  let counter = 0;
68
- let result = '';
68
+ let result = "";
69
69
  const subExpressions = expression.getExpressions();
70
70
  if (!subExpressions.length) {
71
71
  return result;
@@ -79,12 +79,12 @@ export class QueryBuilder {
79
79
  else if (currentExp instanceof ComplexExpression) {
80
80
  const complexResult = this.buildComplexExpression(currentExp, expression.type);
81
81
  if (complexResult) {
82
- result += '(' + complexResult + ')';
82
+ result += "(" + complexResult + ")";
83
83
  }
84
84
  }
85
85
 
86
86
  if (expression.getType() === EXPRESSION_TYPE.not)
87
- result = expression.getType() + ' ' + result;
87
+ result = expression.getType() + " " + result;
88
88
  // TODOSDK: Rethink this!
89
89
  if (expression.getType() === EXPRESSION_TYPE.any) {
90
90
  const exprVal = [];
@@ -92,16 +92,16 @@ export class QueryBuilder {
92
92
  if (subExpressions[index].type == EXPRESSION_TYPE.contains || subExpressions[index].type == EXPRESSION_TYPE.startsWith || subExpressions[index].type == EXPRESSION_TYPE.endsWith)
93
93
  exprVal.push(subExpressions[index].type.toLowerCase() + "(x, '" + (subExpressions[index] as BinaryExpression).constant + "')");
94
94
  else
95
- exprVal.push('x ' + subExpressions[index].type.toLowerCase() + ' ' + this.checkType((subExpressions[index] as BinaryExpression).constant));
95
+ exprVal.push("x " + subExpressions[index].type.toLowerCase() + " " + this.checkType((subExpressions[index] as BinaryExpression).constant));
96
96
  }
97
- result = (currentExp as BinaryExpression).parameter + '/' + expression.getType() + '(x:' + exprVal.join(' ' + parent + ' ') + ')';
97
+ result = (currentExp as BinaryExpression).parameter + "/" + expression.getType() + "(x:" + exprVal.join(" " + parent + " ") + ")";
98
98
  }
99
99
 
100
100
  counter++;
101
101
  if (counter == subExpressions.length)
102
102
  break;
103
103
 
104
- result += ' ' + expression.getType() + ' ';
104
+ result += " " + expression.getType() + " ";
105
105
  }
106
106
 
107
107
  return result;
@@ -111,30 +111,30 @@ export class QueryBuilder {
111
111
  let result: string = null;
112
112
  const type = expression.getType();
113
113
  switch (type) {
114
- case EXPRESSION_TYPE.eq:
115
- case EXPRESSION_TYPE.ne:
116
- case EXPRESSION_TYPE.lt:
117
- case EXPRESSION_TYPE.le:
118
- case EXPRESSION_TYPE.gt:
119
- case EXPRESSION_TYPE.ge: {
120
- const constant = expression.getConstant();
121
- result = `(${expression.getParameter()} ${type} ${this.checkType(constant)})`;
122
- break;
123
- }
124
- case EXPRESSION_TYPE.contains:
125
- case EXPRESSION_TYPE.startsWith:
126
- case EXPRESSION_TYPE.endsWith: {
127
- const expressionParameter = this.applyCaseSensitiveSettings(expression, expression.getParameter());
128
- const expressionConstant = this.checkType(expression.getConstant());
129
- const expressionValue = this.applyCaseSensitiveSettings(expression, expressionConstant);
130
-
131
- result = `${type.toLowerCase()}(${expressionParameter}, ${expressionValue})`;
132
- break;
133
- }
134
- default: {
135
- const msg = `Unsupported operator ${type}`;
136
- throw new Error(msg);
137
- }
114
+ case EXPRESSION_TYPE.eq:
115
+ case EXPRESSION_TYPE.ne:
116
+ case EXPRESSION_TYPE.lt:
117
+ case EXPRESSION_TYPE.le:
118
+ case EXPRESSION_TYPE.gt:
119
+ case EXPRESSION_TYPE.ge: {
120
+ const constant = expression.getConstant();
121
+ result = `(${expression.getParameter()} ${type} ${this.checkType(constant)})`;
122
+ break;
123
+ }
124
+ case EXPRESSION_TYPE.contains:
125
+ case EXPRESSION_TYPE.startsWith:
126
+ case EXPRESSION_TYPE.endsWith: {
127
+ const expressionParameter = this.applyCaseSensitiveSettings(expression, expression.getParameter());
128
+ const expressionConstant = this.checkType(expression.getConstant());
129
+ const expressionValue = this.applyCaseSensitiveSettings(expression, expressionConstant);
130
+
131
+ result = `${type.toLowerCase()}(${expressionParameter}, ${expressionValue})`;
132
+ break;
133
+ }
134
+ default: {
135
+ const msg = `Unsupported operator ${type}`;
136
+ throw new Error(msg);
137
+ }
138
138
  }
139
139
 
140
140
  return result;
@@ -1,6 +1,6 @@
1
1
  import { RequestFactory } from "./RequestFactory";
2
- import { BlobBuilder } from '../BlobBuilder';
3
- import { utils } from '../utils';
2
+ import { BlobBuilder } from "../BlobBuilder";
3
+ import { utils } from "../utils";
4
4
  import { HEADER_NAMES, HTTP_METHODS } from "../constants";
5
5
  import { ExecutableRequest } from "./ExecutableRequest";
6
6
  import { SDKOptions, Token, TypeOptions } from "../Sitefinity";
@@ -77,13 +77,13 @@ export class Transaction {
77
77
  const options: PostRequestOptionsExtended = {
78
78
  urlOptions: urlOptions,
79
79
  key: parameters.key,
80
- action: 'operation',
80
+ action: "operation",
81
81
  data: parameters.data
82
82
  };
83
83
 
84
84
  const request = this.factory.create(options);
85
85
 
86
- this.overrideUrlGeneration(request, parameters.key, 'operation', options.urlOptions, options.query);
86
+ this.overrideUrlGeneration(request, parameters.key, "operation", options.urlOptions, options.query);
87
87
  this.addRequest(request);
88
88
  }
89
89
 
@@ -147,7 +147,7 @@ export class Transaction {
147
147
 
148
148
  const request = this.factory.destroyRelated(options);
149
149
 
150
- const propertyURL = (request as any).property + '/$ref';
150
+ const propertyURL = (request as any).property + "/$ref";
151
151
  this.overrideUrlGeneration(request, parameters.key, propertyURL, options.urlOptions, options.query);
152
152
 
153
153
  this.addRequest(request);
@@ -191,8 +191,8 @@ export class Transaction {
191
191
  }
192
192
 
193
193
  const data = {
194
- '@odata.id': parameters.link
195
- }
194
+ "@odata.id": parameters.link
195
+ };
196
196
 
197
197
  const options: RelatedRequestOptionsExtended = {
198
198
  urlOptions: urlOptions,
@@ -202,7 +202,7 @@ export class Transaction {
202
202
  };
203
203
 
204
204
  const request = this.factory.createRelated(options);
205
- const propertyURL = (request as any).property + '/$ref';
205
+ const propertyURL = (request as any).property + "/$ref";
206
206
  this.overrideUrlGeneration(request, parameters.key, propertyURL, options.urlOptions, options.query);
207
207
 
208
208
  return this.addRequest(request);
@@ -216,7 +216,7 @@ export class Transaction {
216
216
  request.buildUrl = function () {
217
217
  let uri = "$" + key;
218
218
  if (additionalPropertyURL !== undefined) {
219
- uri = uri + '/' + additionalPropertyURL;
219
+ uri = uri + "/" + additionalPropertyURL;
220
220
  }
221
221
 
222
222
  if (urlOptions) {
@@ -227,7 +227,7 @@ export class Transaction {
227
227
  }
228
228
 
229
229
  return uri;
230
- }
230
+ };
231
231
  }
232
232
  }
233
233
  }
@@ -258,7 +258,7 @@ export class BatchRequest extends ExecutableRequest {
258
258
 
259
259
 
260
260
  public static constants = {
261
- newLine: '\r\n'
261
+ newLine: "\r\n"
262
262
  };
263
263
 
264
264
  constructor(requestOptions: BatchRequestOptionsExtended, token: Token, sdkOptions: SDKOptions) {
@@ -415,7 +415,7 @@ export class BatchRequest extends ExecutableRequest {
415
415
  const queryString = this.getQueryString(this.urlOptions, this.query);
416
416
 
417
417
  if (queryString) {
418
- url += queryString
418
+ url += queryString;
419
419
  }
420
420
 
421
421
  return url;
@@ -470,7 +470,7 @@ export class BatchRequest extends ExecutableRequest {
470
470
  const responseCheck = function (r) {
471
471
  let success = true;
472
472
  if (r.data && r.data.hasOwnProperty("Success")) {
473
- success = r.data.Success
473
+ success = r.data.Success;
474
474
  }
475
475
 
476
476
  return success;
@@ -582,10 +582,10 @@ export class BatchRequest extends ExecutableRequest {
582
582
  let i, len;
583
583
  for (i = 1, len = contentTypeParts.length; i < len; i++) {
584
584
  const contentTypeParams = contentTypeParts[i].split("=");
585
- properties[contentTypeParams[0].replace(/^\s+|\s+$/g, '')] = contentTypeParams[1];
585
+ properties[contentTypeParams[0].replace(/^\s+|\s+$/g, "")] = contentTypeParams[1];
586
586
  }
587
587
 
588
- return { mediaType: contentTypeParts[0].replace(/^\s+|\s+$/g, ''), properties: properties };
588
+ return { mediaType: contentTypeParts[0].replace(/^\s+|\s+$/g, ""), properties: properties };
589
589
  }
590
590
 
591
591
  private readTo(text, str, context) {
@@ -657,7 +657,7 @@ export class BatchRequest extends ExecutableRequest {
657
657
 
658
658
  private buildRequestBody() {
659
659
  const builder = new BlobBuilder();
660
- builder.append('');
660
+ builder.append("");
661
661
 
662
662
  for (let index = 0; index < this.requests.length; index += 1) {
663
663
 
@@ -681,12 +681,12 @@ export class BatchRequest extends ExecutableRequest {
681
681
 
682
682
  private buildRequest(request: RequestBase): Blob {
683
683
  const builder = new BlobBuilder();
684
- builder.append(BatchRequest.constants.newLine + 'Content-Type: application/http' +
685
- BatchRequest.constants.newLine + 'Content-Transfer-Encoding: binary' +
684
+ builder.append(BatchRequest.constants.newLine + "Content-Type: application/http" +
685
+ BatchRequest.constants.newLine + "Content-Transfer-Encoding: binary" +
686
686
  BatchRequest.constants.newLine +
687
687
  BatchRequest.constants.newLine +
688
688
  request.getMethod() +
689
- ' ' + request.buildUrl() + ' HTTP/1.1');
689
+ " " + request.buildUrl() + " HTTP/1.1");
690
690
 
691
691
  return builder.build();
692
692
  }
@@ -699,7 +699,7 @@ export class BatchRequest extends ExecutableRequest {
699
699
  builder.append(BatchRequest.constants.newLine);
700
700
 
701
701
  const changeset = this.createBoundary("sf_changeset_");
702
- builder.append('Content-Type: multipart/mixed; boundary=' + changeset);
702
+ builder.append("Content-Type: multipart/mixed; boundary=" + changeset);
703
703
 
704
704
  const changesetRequests = transaction.requests;
705
705
  for (let index = 0; index < changesetRequests.length; index += 1) {
@@ -708,12 +708,12 @@ export class BatchRequest extends ExecutableRequest {
708
708
  // we shouldn't add new lines after blob content. Otherwise they are added to the blob and corrupt it
709
709
  const shouldAddNewLine = index === 0 || !utils.isBlob(changesetRequests[index - 1].request.getBody());
710
710
  builder.append(this.createDelimeter(changeset, false, shouldAddNewLine) +
711
- BatchRequest.constants.newLine + 'Content-Type: application/http' +
712
- BatchRequest.constants.newLine + 'Content-Transfer-Encoding: binary' +
713
- BatchRequest.constants.newLine + 'Content-ID: ' + changesetRequests[index].id);
711
+ BatchRequest.constants.newLine + "Content-Type: application/http" +
712
+ BatchRequest.constants.newLine + "Content-Transfer-Encoding: binary" +
713
+ BatchRequest.constants.newLine + "Content-ID: " + changesetRequests[index].id);
714
714
 
715
715
  const requestUrl = currentRequest.buildUrl();
716
- builder.append(BatchRequest.constants.newLine + BatchRequest.constants.newLine + currentRequest.getMethod() + ' ' + requestUrl + ' HTTP/1.1');
716
+ builder.append(BatchRequest.constants.newLine + BatchRequest.constants.newLine + currentRequest.getMethod() + " " + requestUrl + " HTTP/1.1");
717
717
 
718
718
  const headers = currentRequest.getHeaders();
719
719
  const headerNames = Object.keys(headers);
@@ -749,7 +749,7 @@ export class BatchRequest extends ExecutableRequest {
749
749
  }
750
750
 
751
751
  private createBoundary(prefix) {
752
- return prefix + utils.hex16() + '-' + utils.hex16() + '-' + utils.hex16();
752
+ return prefix + utils.hex16() + "-" + utils.hex16() + "-" + utils.hex16();
753
753
  }
754
754
 
755
755
  private addRequest(request: RequestBase) {