@progress/sitefinity-webservices-sdk 1.0.4 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +30 -9
- package/README.md +28 -11
- package/config/helpers.ts +8 -0
- package/config/webpack.common.ts +39 -0
- package/config/webpack.dev.ts +37 -0
- package/config/webpack.prod.ts +17 -0
- package/dist/docs/assets/highlight.css +23 -9
- package/dist/docs/assets/main.js +58 -52
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/assets/style.css +488 -621
- package/dist/docs/classes/BlobBuilder.BlobBuilder.html +137 -0
- package/dist/docs/classes/Data.Data.html +387 -0
- package/dist/docs/classes/Expression.BinaryExpression.html +184 -1
- package/dist/docs/classes/Expression.ComplexExpression.html +146 -1
- package/dist/docs/classes/Expression.ExpressionBase.html +125 -1
- package/dist/docs/classes/OrderProperty.OrderProperty.html +151 -0
- package/dist/docs/classes/Query.Query.html +353 -0
- package/dist/docs/classes/QueryBase.QueryBase.html +185 -0
- package/dist/docs/classes/QueryBuilder.QueryBuilder.html +204 -0
- package/dist/docs/classes/Requests_BatchRequest.BatchRequest.html +731 -17
- package/dist/docs/classes/Requests_BatchRequest.Transaction.html +332 -17
- package/dist/docs/classes/Requests_ExecutableRequest.ExecutableRequest.html +340 -1
- package/dist/docs/classes/Requests_Request.CommitChunksRequest.html +303 -0
- package/dist/docs/classes/Requests_Request.CreateRelatedRequest.html +310 -1
- package/dist/docs/classes/Requests_Request.CreateRequest.html +307 -1
- package/dist/docs/classes/Requests_Request.DeleteRelatedByIdRequest.html +309 -1
- package/dist/docs/classes/Requests_Request.DeleteRelatedRequest.html +302 -1
- package/dist/docs/classes/Requests_Request.DeleteRequest.html +298 -1
- package/dist/docs/classes/Requests_Request.GetByIdRequest.html +298 -1
- package/dist/docs/classes/Requests_Request.GetRelatedByIdRequest.html +309 -1
- package/dist/docs/classes/Requests_Request.GetRelatedRequest.html +302 -1
- package/dist/docs/classes/Requests_Request.GetRequest.html +295 -1
- package/dist/docs/classes/Requests_Request.UpdateRequest.html +309 -1
- package/dist/docs/classes/Requests_Request.UploadChunkRequest.html +352 -0
- package/dist/docs/classes/Requests_Request.UploadRequest.html +329 -1
- package/dist/docs/classes/Requests_RequestBase.RequestBase.html +275 -1
- package/dist/docs/classes/Requests_RequestFactory.RequestFactory.html +344 -1
- package/dist/docs/classes/Sitefinity.Sitefinity.html +188 -0
- package/dist/docs/classes/WhereQuery.WhereQuery.html +417 -0
- package/dist/docs/classes/chunk_upload_chunk_upload_sdk.ChunkUploadSdk.html +231 -0
- package/dist/docs/classes/chunk_upload_chunked_file_upload_utilities.ChunkedFileUploadUtilities.html +131 -0
- package/dist/docs/classes/utils.utils.html +303 -0
- package/dist/docs/index.html +84 -15
- package/dist/docs/interfaces/Data.CreateRelatedRequestOptions.html +155 -1
- package/dist/docs/interfaces/Data.CreateRequestOptions.html +153 -1
- package/dist/docs/interfaces/Data.OperationsRequestOptions.html +145 -1
- package/dist/docs/interfaces/Data.PropertyRequestOptions.html +149 -1
- package/dist/docs/interfaces/Data.RequestOptionsBase.html +136 -1
- package/dist/docs/interfaces/Data.SingleRelatedItemRequestOptions.html +155 -1
- package/dist/docs/interfaces/Data.UpdateRequestOptions.html +155 -1
- package/dist/docs/interfaces/Data.UploadRequestOptions.html +169 -1
- package/dist/docs/interfaces/Requests_BatchRequest.BatchCreateRelatedRequestOptions.html +161 -1
- package/dist/docs/interfaces/Requests_BatchRequest.BatchCreateRequestOptions.html +153 -1
- package/dist/docs/interfaces/Requests_BatchRequest.BatchPropertyRequestOptions.html +153 -1
- package/dist/docs/interfaces/Requests_BatchRequest.BatchRequestOptionsBase.html +145 -1
- package/dist/docs/interfaces/Requests_BatchRequest.BatchRequestOptionsExtended.html +153 -1
- package/dist/docs/interfaces/Requests_BatchRequest.BatchSingleItemRequestOptions.html +145 -1
- package/dist/docs/interfaces/Requests_BatchRequest.BatchSingleRelatedItemRequestOptions.html +161 -1
- package/dist/docs/interfaces/Requests_BatchRequest.BatchUpdateRequestOptions.html +161 -1
- package/dist/docs/interfaces/Requests_ExecutableRequest.ResponseHandlers.html +98 -5
- package/dist/docs/interfaces/Requests_Request.CommitChunksRequestOptionsExtended.html +215 -0
- package/dist/docs/interfaces/Requests_Request.PostRequestOptionsExtended.html +159 -1
- package/dist/docs/interfaces/Requests_Request.PutRequestOptionsExtended.html +161 -1
- package/dist/docs/interfaces/Requests_Request.RelatedByIdRequestOptionsExtended.html +169 -1
- package/dist/docs/interfaces/Requests_Request.RelatedRequestOptionsExtended.html +163 -1
- package/dist/docs/interfaces/Requests_Request.UploadChunkRequestOptionsExtended.html +210 -0
- package/dist/docs/interfaces/Requests_Request.UploadRequestOptionsExtended.html +180 -1
- package/dist/docs/interfaces/Requests_RequestBase.RequestOptionsBaseExtended.html +148 -1
- package/dist/docs/interfaces/Sitefinity.SDKOptions.html +128 -9
- package/dist/docs/interfaces/Sitefinity.Token.html +94 -1
- package/dist/docs/interfaces/Sitefinity.TypeOptions.html +144 -13
- package/dist/docs/interfaces/chunk_upload_chunk_upload_sdk.ChunkUploadInfoDTO.html +159 -0
- package/dist/docs/interfaces/chunk_upload_chunk_upload_sdk.ChunkUploadResult.html +111 -0
- package/dist/docs/interfaces/chunk_upload_chunk_upload_sdk.CleanUpChunksRequestOptions.html +171 -0
- package/dist/docs/interfaces/chunk_upload_chunk_upload_sdk.CommitChunksRequestOptions.html +204 -0
- package/dist/docs/interfaces/chunk_upload_chunk_upload_sdk.GetChunkUploadInfoRequestOptions.html +166 -0
- package/dist/docs/interfaces/chunk_upload_chunk_upload_sdk.UploadChunkRequestOptions.html +201 -0
- package/dist/docs/interfaces/chunk_upload_chunked_file_upload_utilities.ChunkFileResult.html +101 -0
- package/dist/docs/interfaces/chunk_upload_chunked_file_upload_utilities.FileUploadChunk.html +94 -0
- package/dist/docs/modules/BlobBuilder.html +73 -1
- package/dist/docs/modules/Data.html +92 -1
- package/dist/docs/modules/Expression.html +77 -1
- package/dist/docs/modules/OrderProperty.html +73 -1
- package/dist/docs/modules/Query.html +73 -1
- package/dist/docs/modules/QueryBase.html +73 -1
- package/dist/docs/modules/QueryBuilder.html +73 -1
- package/dist/docs/modules/Requests_BatchRequest.html +94 -1
- package/dist/docs/modules/Requests_ExecutableRequest.html +78 -1
- package/dist/docs/modules/Requests_Request.html +114 -1
- package/dist/docs/modules/Requests_RequestBase.html +78 -1
- package/dist/docs/modules/Requests_RequestFactory.html +73 -1
- package/dist/docs/modules/Sitefinity.html +82 -1
- package/dist/docs/modules/WhereQuery.html +73 -1
- package/dist/docs/modules/chunk_upload_chunk_upload_sdk.html +88 -0
- package/dist/docs/modules/chunk_upload_chunked_file_upload_utilities.html +80 -0
- package/dist/docs/modules/constants.html +83 -1
- package/dist/docs/modules/utils.html +73 -1
- package/dist/docs/modules.html +80 -1
- package/dist/docs/variables/constants.CONTENT_TYPES.html +76 -0
- package/dist/docs/variables/constants.EXPRESSION_TYPE.html +104 -0
- package/dist/docs/variables/constants.HEADER_NAMES.html +102 -0
- package/dist/docs/variables/constants.HTTP_METHODS.html +84 -0
- package/dist/docs/variables/constants.ODATA_PARAMS.html +90 -0
- package/dist/docs/variables/constants.SF_PARAMS.html +84 -0
- package/dist/samples.html +237 -38
- package/dist/sitefinity-webservices-sdk.d.ts +0 -1
- package/dist/sitefinity-webservices-sdk.js +524 -119
- package/dist/sitefinity-webservices-sdk.js.map +1 -1
- package/dist/sitefinity-webservices-sdk.min.js +1 -2
- package/dist/src/Data.d.ts +10 -0
- package/dist/src/Data.spec.d.ts +1 -0
- package/dist/src/Query.d.ts +3 -3
- package/dist/src/Requests/ExecutableRequest.d.ts +3 -1
- package/dist/src/Requests/Request.d.ts +42 -0
- package/dist/src/Requests/RequestBase.d.ts +1 -2
- package/dist/src/Requests/RequestFactory.d.ts +3 -1
- package/dist/src/Requests/request.spec.d.ts +1 -0
- package/dist/src/Sitefinity.d.ts +2 -2
- package/dist/src/Sitefinity.spec.d.ts +1 -0
- package/dist/src/WhereQuery.d.ts +2 -2
- package/dist/src/chunk-upload/chunk-upload.sdk.d.ts +290 -0
- package/dist/src/chunk-upload/chunk-upload.sdk.spec.d.ts +1 -0
- package/dist/src/chunk-upload/chunked-file-upload.utilities.d.ts +13 -0
- package/dist/src/constants.d.ts +5 -0
- package/package.json +24 -22
- package/sitefinity-webservices-sdk.ts +0 -1
- package/src/Data.spec.ts +12 -12
- package/src/Data.ts +19 -4
- package/src/OrderProperty.ts +7 -7
- package/src/Query.ts +4 -4
- package/src/QueryBase.ts +4 -4
- package/src/QueryBuilder.ts +38 -38
- package/src/Requests/BatchRequest.ts +25 -25
- package/src/Requests/ExecutableRequest.ts +30 -24
- package/src/Requests/Request.ts +109 -2
- package/src/Requests/RequestBase.ts +3 -4
- package/src/Requests/RequestFactory.ts +9 -1
- package/src/Requests/request.spec.ts +10 -10
- package/src/Sitefinity.spec.ts +6 -6
- package/src/Sitefinity.ts +5 -5
- package/src/WhereQuery.ts +2 -2
- package/src/chunk-upload/chunk-upload.sdk.spec.ts +340 -0
- package/src/chunk-upload/chunk-upload.sdk.ts +436 -0
- package/src/chunk-upload/chunked-file-upload.utilities.ts +64 -0
- package/src/constants.ts +35 -30
- package/src/utils.ts +10 -10
- package/template.html +191 -38
- package/tsconfig.json +11 -3
- package/.npmignore +0 -92
- package/ci/pipelines/ci.yml +0 -219
- package/config/helpers.js +0 -10
- package/config/webpack.common.js +0 -39
- package/config/webpack.dev.js +0 -19
- package/config/webpack.prod.js +0 -25
- package/dist/docs/assets/icons.css +0 -1043
- package/dist/docs/assets/icons.png +0 -0
- package/dist/docs/assets/icons@2x.png +0 -0
- package/dist/docs/assets/widgets.png +0 -0
- package/dist/docs/assets/widgets@2x.png +0 -0
- package/dist/docs/classes/BlobBuilder.BlobBuilder-1.html +0 -7
- package/dist/docs/classes/Data.Data-1.html +0 -65
- package/dist/docs/classes/OrderProperty.OrderProperty-1.html +0 -1
- package/dist/docs/classes/Query.Query-1.html +0 -33
- package/dist/docs/classes/QueryBase.QueryBase-1.html +0 -7
- package/dist/docs/classes/QueryBuilder.QueryBuilder-1.html +0 -1
- package/dist/docs/classes/Sitefinity.Sitefinity-1.html +0 -5
- package/dist/docs/classes/WhereQuery.WhereQuery-1.html +0 -31
- package/dist/docs/classes/utils.utils-1.html +0 -1
- package/dist/sitefinity-webservices-sdk.min.js.LICENSE.txt +0 -14
- package/package-lock.json +0 -17487
- package/type.txt +0 -1
- package/version.txt +0 -1
package/template.html
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
3
|
+
|
|
3
4
|
<head>
|
|
4
5
|
<title></title>
|
|
5
6
|
</head>
|
|
7
|
+
|
|
6
8
|
<body>
|
|
7
9
|
<script>
|
|
8
|
-
|
|
9
10
|
function clearHtmlMessages() {
|
|
10
11
|
document.getElementById("message").innerHTML = "";
|
|
11
12
|
document.getElementById("container").innerHTML = "";
|
|
@@ -17,38 +18,10 @@
|
|
|
17
18
|
var links = document.getElementsByTagName('input');
|
|
18
19
|
|
|
19
20
|
for (var i = 0; i < links.length; i++) {
|
|
20
|
-
if(links[i].hasAttribute("onclick"))
|
|
21
|
-
|
|
21
|
+
if (links[i].hasAttribute("onclick"))
|
|
22
|
+
links[i].addEventListener('click', clearHtmlMessages, false);
|
|
22
23
|
};
|
|
23
|
-
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
var query = new Sitefinity.Sitefinity.Query();
|
|
27
|
-
|
|
28
|
-
var query0 = query.where().and().endsWith("Title", "Record").done().or().startsWith('Title', 'asd').done().done();
|
|
29
|
-
var query1 = query.where().or().endsWith("Record", "Title").ne('age', '15').eq('Content', 'test').done().done();
|
|
30
|
-
var query2 = query.where().and().endsWith("Title", "Record").done().done();
|
|
31
|
-
var query3 = query.where().endsWith("Record", "Title").or().ne('age', '15').eq('Content', 'test').done().done();
|
|
32
|
-
var query4 = query.where().not().endsWith("Record", "Title").done().and().not().eq('Content', 'test').done().done().done();
|
|
33
|
-
var query5 = query.where().not().and().endsWith("Record", "Title").eq('Content', 'test').done().done().done();
|
|
34
|
-
var query6 = query.select("Id", "Title", "Content").expand('Tags').order("Title desc").where().ne('Title', 'zzz').eq('Title', 'newTitle').done()//.count();
|
|
35
|
-
var query7 = query.order("Title desc").where().eq('Title', 'newTitleUPDATE1').done().select("Title", "Content");
|
|
36
|
-
var query8 = query.where().eq('Title', 'newTitleN11').done();
|
|
37
|
-
var query9 = query.where().eq('Title', null).done();
|
|
38
|
-
var query10 = query.count();
|
|
39
|
-
|
|
40
|
-
var queryIDs = query.select('Id');
|
|
41
|
-
console.log(query0.build());
|
|
42
|
-
console.log(query1.build());
|
|
43
|
-
console.log(query2.build());
|
|
44
|
-
console.log(query3.build());
|
|
45
|
-
console.log(query4.build());
|
|
46
|
-
console.log(query5.build());
|
|
47
|
-
console.log(query6.build());
|
|
48
|
-
console.log(query7.build());
|
|
49
|
-
console.log(query8.build());
|
|
50
|
-
console.log(query9.build());
|
|
51
|
-
console.log(query10.build());
|
|
52
25
|
//Create Item
|
|
53
26
|
var newsItem = {
|
|
54
27
|
"Title": 'newTitleN11',
|
|
@@ -69,10 +42,10 @@
|
|
|
69
42
|
var options = {
|
|
70
43
|
baseUrl: sitefinityUrl + "/api/default/",
|
|
71
44
|
handlers: {
|
|
72
|
-
failureCb: function() {
|
|
45
|
+
failureCb: function () {
|
|
73
46
|
console.log("Global error occured");
|
|
74
47
|
},
|
|
75
|
-
successCb: function() {
|
|
48
|
+
successCb: function () {
|
|
76
49
|
console.log("Success executing request");
|
|
77
50
|
}
|
|
78
51
|
}
|
|
@@ -82,6 +55,35 @@
|
|
|
82
55
|
var sf = new Sitefinity.Sitefinity(options);
|
|
83
56
|
sf.setToken("");
|
|
84
57
|
|
|
58
|
+
|
|
59
|
+
var query = new Sitefinity.Query();
|
|
60
|
+
|
|
61
|
+
var query0 = query.where().and().endsWith("Title", "Record").done().or().startsWith('Title', 'asd').done().done();
|
|
62
|
+
var query1 = query.where().or().endsWith("Record", "Title").ne('age', '15').eq('Content', 'test').done().done();
|
|
63
|
+
var query2 = query.where().and().endsWith("Title", "Record").done().done();
|
|
64
|
+
var query3 = query.where().endsWith("Record", "Title").or().ne('age', '15').eq('Content', 'test').done().done();
|
|
65
|
+
var query4 = query.where().not().endsWith("Record", "Title").done().and().not().eq('Content', 'test').done().done().done();
|
|
66
|
+
var query5 = query.where().not().and().endsWith("Record", "Title").eq('Content', 'test').done().done().done();
|
|
67
|
+
var query6 = query.select("Id", "Title", "Content").expand('Tags').order("Title desc").where().ne('Title', 'zzz').eq('Title', 'newTitle').done()//.count();
|
|
68
|
+
var query7 = query.order("Title desc").where().eq('Title', 'newTitleUPDATE1').done().select("Title", "Content");
|
|
69
|
+
var query8 = query.where().eq('Title', 'newTitleN11').done();
|
|
70
|
+
var query9 = query.where().eq('Title', null).done();
|
|
71
|
+
var query10 = query.count();
|
|
72
|
+
|
|
73
|
+
var queryIDs = query.select('Id');
|
|
74
|
+
console.log(query0.build());
|
|
75
|
+
console.log(query1.build());
|
|
76
|
+
console.log(query2.build());
|
|
77
|
+
console.log(query3.build());
|
|
78
|
+
console.log(query4.build());
|
|
79
|
+
console.log(query5.build());
|
|
80
|
+
console.log(query6.build());
|
|
81
|
+
console.log(query7.build());
|
|
82
|
+
console.log(query8.build());
|
|
83
|
+
console.log(query9.build());
|
|
84
|
+
console.log(query10.build());
|
|
85
|
+
|
|
86
|
+
|
|
85
87
|
var inputElement = document.getElementById('getGuid');
|
|
86
88
|
var that = this;
|
|
87
89
|
// Success and Failure CB's
|
|
@@ -89,7 +91,7 @@
|
|
|
89
91
|
document.getElementById("container").innerHTML = JSON.stringify(data);
|
|
90
92
|
}
|
|
91
93
|
|
|
92
|
-
var successCbBatch = function(data) {
|
|
94
|
+
var successCbBatch = function (data) {
|
|
93
95
|
document.getElementById("container").innerHTML = JSON.stringify(data);
|
|
94
96
|
}
|
|
95
97
|
|
|
@@ -394,13 +396,13 @@
|
|
|
394
396
|
}
|
|
395
397
|
|
|
396
398
|
function login() {
|
|
397
|
-
var url = sitefinityUrl + "/
|
|
399
|
+
var url = sitefinityUrl + "/sitefinity/oauth/token";
|
|
398
400
|
var data = {
|
|
399
401
|
username: "",
|
|
400
402
|
password: "",
|
|
401
403
|
grant_type: "password",
|
|
402
|
-
client_id: "
|
|
403
|
-
client_secret: "
|
|
404
|
+
client_id: "",
|
|
405
|
+
client_secret: ""
|
|
404
406
|
};
|
|
405
407
|
|
|
406
408
|
var body = "";
|
|
@@ -433,6 +435,151 @@
|
|
|
433
435
|
xhr.send(body);
|
|
434
436
|
}
|
|
435
437
|
|
|
438
|
+
var typeOptions = {
|
|
439
|
+
entitySet: "images"
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
var sfData = sf.data(typeOptions);
|
|
443
|
+
var chunkSdk = sfData.chunkUpload;
|
|
444
|
+
|
|
445
|
+
function chunkUpload() {
|
|
446
|
+
var chunkUploadIndicator = document.getElementById("chunkUploadIndicator");
|
|
447
|
+
var acceptedFiles = ["gif", "jpg", "jpeg", "png", "webp", "bmp"];
|
|
448
|
+
var file = document.getElementById("chunkUploadInput").files[0];
|
|
449
|
+
|
|
450
|
+
if (!file) {
|
|
451
|
+
chunkUploadIndicator.textContent = "Please select an image.";
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
var extension = file.name.split('.').pop();
|
|
456
|
+
|
|
457
|
+
const showError = (error) => {
|
|
458
|
+
chunkUploadIndicator.textContent = error.message;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
if (!acceptedFiles.includes(extension)) {
|
|
462
|
+
chunkUploadIndicator.textContent = "This upload is only for the image types: .gif, .jpg, .jpeg, .png, .webp, .bmp";
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
var imgElement = document.createElement("img");
|
|
467
|
+
imgElement.addEventListener("load", function (ev) {
|
|
468
|
+
var width = imgElement.width;
|
|
469
|
+
var height = imgElement.height;
|
|
470
|
+
imgElement.remove();
|
|
471
|
+
|
|
472
|
+
var libraryId = "4ba7ad46-f29b-4e65-be17-9bf7ce5ba1fb";
|
|
473
|
+
var getChunkUploadInfoRequestOptions = {
|
|
474
|
+
data: {
|
|
475
|
+
libraryId
|
|
476
|
+
},
|
|
477
|
+
failureCb: err => showError(err),
|
|
478
|
+
successCb: uploadInfo => {
|
|
479
|
+
if (uploadInfo.ProviderSupportsChunkUpload) {
|
|
480
|
+
var chunksResult = chunkSdk.chunkFile(file, uploadInfo.ChunkSize, file.type);
|
|
481
|
+
let successfullyUploadedChunks = 0;
|
|
482
|
+
|
|
483
|
+
chunksResult.chunks.forEach(chunk => {
|
|
484
|
+
var parameters = {
|
|
485
|
+
data: {
|
|
486
|
+
fileMimeType: file.type,
|
|
487
|
+
chunkedFileUploadSessionId: uploadInfo.ChunkedFileUploadSessionId,
|
|
488
|
+
chunkSize: chunk.content.size,
|
|
489
|
+
chunkOrdinal: chunk.ordinal,
|
|
490
|
+
numberOfChunks: chunksResult.totalChunksCount,
|
|
491
|
+
chunkBlob: chunk.content,
|
|
492
|
+
blobStorageProviderName: uploadInfo.BlobStorageProviderName,
|
|
493
|
+
positionOfChunkInQueue: chunk.ordinal
|
|
494
|
+
},
|
|
495
|
+
successCb: chunkUploadResult => {
|
|
496
|
+
if (chunkUploadResult.SuccessfullyUploaded) {
|
|
497
|
+
successfullyUploadedChunks++;
|
|
498
|
+
|
|
499
|
+
if (successfullyUploadedChunks === chunksResult.totalChunksCount) {
|
|
500
|
+
var uploadProperties = {
|
|
501
|
+
Title: "Test",
|
|
502
|
+
UrlName: "test",
|
|
503
|
+
ParentId: libraryId,
|
|
504
|
+
Height: height,
|
|
505
|
+
Width: width,
|
|
506
|
+
// FolderId: GUID of the folder you would like to have the image uploaded
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
var commitChunksOptions = {
|
|
510
|
+
data: {
|
|
511
|
+
chunkedFileUploadSessionId: uploadInfo.ChunkedFileUploadSessionId,
|
|
512
|
+
contentType: file.type,
|
|
513
|
+
fileTotalSize: chunksResult.fileTotalSize,
|
|
514
|
+
numberOfChunks: chunksResult.totalChunksCount,
|
|
515
|
+
name: file.name,
|
|
516
|
+
uploadProperties: uploadProperties,
|
|
517
|
+
blobStorageProviderName: uploadInfo.BlobStorageProviderName,
|
|
518
|
+
itemId: undefined // set item id of the file you would like to replace
|
|
519
|
+
},
|
|
520
|
+
failureCb: err => showError(err),
|
|
521
|
+
successCb: commitChunksResult => {
|
|
522
|
+
|
|
523
|
+
var createdItemId = commitChunksResult.Id;
|
|
524
|
+
var directUpload = true; // false if you are replacing the image
|
|
525
|
+
|
|
526
|
+
sfData.operation({
|
|
527
|
+
key: createdItemId,
|
|
528
|
+
data: {
|
|
529
|
+
action: "Publish",
|
|
530
|
+
actionParameters: {
|
|
531
|
+
directUpload
|
|
532
|
+
}
|
|
533
|
+
},
|
|
534
|
+
successCb: operationResult => {
|
|
535
|
+
chunkUploadIndicator.textContent = "Published";
|
|
536
|
+
},
|
|
537
|
+
failureCb: err => showError(err)
|
|
538
|
+
});
|
|
539
|
+
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
chunkSdk.commitChunks(commitChunksOptions);
|
|
544
|
+
}
|
|
545
|
+
} else {
|
|
546
|
+
// handle single chunk upload failure
|
|
547
|
+
// this is good place to try uploading the chunk again
|
|
548
|
+
// here is also a good place to use the following code, to clean up the chunks
|
|
549
|
+
// before committing the chunks, this call will delete all chunks from this session
|
|
550
|
+
|
|
551
|
+
// var cleanUpChunksRequestOptions: CleanUpChunksRequestOptions = {
|
|
552
|
+
// data: {
|
|
553
|
+
// chunkedFileUploadSessionId: uploadInfo.ChunkedFileUploadSessionId,
|
|
554
|
+
// blobStorageProviderName: uploadInfo.BlobStorageProviderName
|
|
555
|
+
// }
|
|
556
|
+
// };
|
|
557
|
+
// chunkSdk.cleanUpChunks(cleanUpChunksRequestOptions);
|
|
558
|
+
}
|
|
559
|
+
},
|
|
560
|
+
progressCb: (progressEv) => {
|
|
561
|
+
var percentComplete = (successfullyUploadedChunks / chunksResult.totalChunksCount) * 100;
|
|
562
|
+
chunkUploadIndicator.textContent = `Progress: ${percentComplete}%`;
|
|
563
|
+
},
|
|
564
|
+
failureCb: err => showError(err)
|
|
565
|
+
};
|
|
566
|
+
|
|
567
|
+
var chunkUploadHandlers = chunkSdk.uploadChunk(parameters);
|
|
568
|
+
});
|
|
569
|
+
} else {
|
|
570
|
+
chunkUploadIndicator.textContent = "The currently selected blob storage provider does not support uploading in chunks.";
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
chunkSdk.getChunkUploadInfo(getChunkUploadInfoRequestOptions)
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
imgElement.src = window.URL.createObjectURL(file);
|
|
581
|
+
}
|
|
582
|
+
|
|
436
583
|
</script>
|
|
437
584
|
Usage: <br /><code>
|
|
438
585
|
<b>
|
|
@@ -457,11 +604,16 @@
|
|
|
457
604
|
<br />
|
|
458
605
|
<br />
|
|
459
606
|
<input type="text" id="getGuid" value="00000000-0000-0000-0000-000000000000" size="50" />
|
|
460
|
-
<span>related ID</span><input type="text" id="getRelatedGuid" value="00000000-0000-0000-0000-000000000000"
|
|
607
|
+
<span>related ID</span><input type="text" id="getRelatedGuid" value="00000000-0000-0000-0000-000000000000"
|
|
608
|
+
size="50" />
|
|
461
609
|
<br />
|
|
462
610
|
<br />
|
|
463
611
|
<input type="file" name="photo" id="photo">
|
|
464
612
|
<input type="button" value="Upload" onclick="upload()">
|
|
613
|
+
<hr>
|
|
614
|
+
<input type="file" name="chunkUploadInput" id="chunkUploadInput" accept=".gif, .jpg, .jpeg, .png, .webp, .bmp">
|
|
615
|
+
<input type="button" id="chunkUploadBtn" value="Chunked upload" onclick="chunkUpload()">
|
|
616
|
+
<span id="chunkUploadIndicator">Progress: not started</span>
|
|
465
617
|
<div id="some_container_div"></div>
|
|
466
618
|
<br />
|
|
467
619
|
<br />
|
|
@@ -469,4 +621,5 @@
|
|
|
469
621
|
<div id="container" style="color: green; border: 1px solid;"></div>
|
|
470
622
|
<div id="containerErr" style="color: red; border: 1px solid;"></div>
|
|
471
623
|
</body>
|
|
624
|
+
|
|
472
625
|
</html>
|
package/tsconfig.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"declaration": true,
|
|
7
7
|
"outDir": "dist",
|
|
8
8
|
"sourceMap": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
9
10
|
"emitDecoratorMetadata": true,
|
|
10
11
|
"experimentalDecorators": true,
|
|
11
12
|
"removeComments": false,
|
|
@@ -18,12 +19,19 @@
|
|
|
18
19
|
"node_modules/@types"
|
|
19
20
|
],
|
|
20
21
|
"lib": [
|
|
21
|
-
"
|
|
22
|
-
"
|
|
22
|
+
"dom",
|
|
23
|
+
"es2020"
|
|
23
24
|
]
|
|
24
25
|
},
|
|
26
|
+
"exclude": [
|
|
27
|
+
"config",
|
|
28
|
+
"node_modules"
|
|
29
|
+
],
|
|
25
30
|
"typedocOptions": {
|
|
26
|
-
"entryPoints": [
|
|
31
|
+
"entryPoints": [
|
|
32
|
+
"./src"
|
|
33
|
+
],
|
|
34
|
+
"exclude": "**/*+(.spec|.e2e).ts",
|
|
27
35
|
"out": "dist/docs",
|
|
28
36
|
"entryPointStrategy": "expand"
|
|
29
37
|
}
|
package/.npmignore
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
# Logs
|
|
2
|
-
logs
|
|
3
|
-
*.log
|
|
4
|
-
npm-debug.log*
|
|
5
|
-
|
|
6
|
-
# Runtime data
|
|
7
|
-
pids
|
|
8
|
-
*.pid
|
|
9
|
-
*.seed
|
|
10
|
-
|
|
11
|
-
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
12
|
-
lib-cov
|
|
13
|
-
|
|
14
|
-
# Coverage directory used by tools like istanbul
|
|
15
|
-
coverage
|
|
16
|
-
|
|
17
|
-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
|
18
|
-
.grunt
|
|
19
|
-
|
|
20
|
-
# node-waf configuration
|
|
21
|
-
.lock-wscript
|
|
22
|
-
|
|
23
|
-
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
|
24
|
-
build/Release
|
|
25
|
-
|
|
26
|
-
# Dependency directories
|
|
27
|
-
node_modules
|
|
28
|
-
jspm_packages
|
|
29
|
-
|
|
30
|
-
# Optional npm cache directory
|
|
31
|
-
.npm
|
|
32
|
-
|
|
33
|
-
# Optional REPL history
|
|
34
|
-
.node_repl_history
|
|
35
|
-
|
|
36
|
-
# Compilation SDK directories
|
|
37
|
-
release
|
|
38
|
-
test_results
|
|
39
|
-
|
|
40
|
-
# =========================
|
|
41
|
-
# Operating System Files
|
|
42
|
-
# =========================
|
|
43
|
-
|
|
44
|
-
# OSX
|
|
45
|
-
# =========================
|
|
46
|
-
|
|
47
|
-
.DS_Store
|
|
48
|
-
.AppleDouble
|
|
49
|
-
.LSOverride
|
|
50
|
-
|
|
51
|
-
# Thumbnails
|
|
52
|
-
._*
|
|
53
|
-
|
|
54
|
-
# Files that might appear in the root of a volume
|
|
55
|
-
.DocumentRevisions-V100
|
|
56
|
-
.fseventsd
|
|
57
|
-
.Spotlight-V100
|
|
58
|
-
.TemporaryItems
|
|
59
|
-
.Trashes
|
|
60
|
-
.VolumeIcon.icns
|
|
61
|
-
|
|
62
|
-
# Directories potentially created on remote AFP share
|
|
63
|
-
.AppleDB
|
|
64
|
-
.AppleDesktop
|
|
65
|
-
Network Trash Folder
|
|
66
|
-
Temporary Items
|
|
67
|
-
.apdisk
|
|
68
|
-
|
|
69
|
-
# Windows
|
|
70
|
-
# =========================
|
|
71
|
-
|
|
72
|
-
# Windows image file caches
|
|
73
|
-
Thumbs.db
|
|
74
|
-
ehthumbs.db
|
|
75
|
-
|
|
76
|
-
# Folder config file
|
|
77
|
-
Desktop.ini
|
|
78
|
-
|
|
79
|
-
# Recycle Bin used on file shares
|
|
80
|
-
$RECYCLE.BIN/
|
|
81
|
-
|
|
82
|
-
# Windows Installer files
|
|
83
|
-
*.cab
|
|
84
|
-
*.msi
|
|
85
|
-
*.msm
|
|
86
|
-
*.msp
|
|
87
|
-
|
|
88
|
-
# Windows shortcuts
|
|
89
|
-
*.lnk
|
|
90
|
-
|
|
91
|
-
# Pull request readme
|
|
92
|
-
PULL_REQUEST_README.md
|
package/ci/pipelines/ci.yml
DELETED
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
trigger:
|
|
2
|
-
branches:
|
|
3
|
-
include:
|
|
4
|
-
- refs/heads/master
|
|
5
|
-
jobs:
|
|
6
|
-
- job: Job_1
|
|
7
|
-
displayName: Build and publish artifact
|
|
8
|
-
pool:
|
|
9
|
-
name: IrisVMware
|
|
10
|
-
steps:
|
|
11
|
-
- checkout: self
|
|
12
|
-
- task: UseNode@1
|
|
13
|
-
displayName: Use Node $(node.version)
|
|
14
|
-
inputs:
|
|
15
|
-
version: $(node.version)
|
|
16
|
-
- task: PowerShell@2
|
|
17
|
-
displayName: Verify Commit Type
|
|
18
|
-
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'))
|
|
19
|
-
inputs:
|
|
20
|
-
targetType: inline
|
|
21
|
-
script: |
|
|
22
|
-
$pullrequestId = $(System.PullRequest.PullRequestId)
|
|
23
|
-
$azureDevOpsProject = "https://prgs-sitefinity.visualstudio.com/sitefinity"
|
|
24
|
-
$headers = @{}
|
|
25
|
-
$headers.Add("Content-Type", "application/json");
|
|
26
|
-
$headers.Add("Authorization", "Basic $(VstsRestApiToken)");
|
|
27
|
-
$pullRequestUrl = "${azureDevOpsProject}/_apis/git/repositories/sitefinity-webservices-sdk/pullrequests/${pullrequestId}?api-version=4.1"
|
|
28
|
-
$response = Invoke-WebRequest -URI $pullRequestUrl -Headers $headers
|
|
29
|
-
$responseJsonObject = $response | ConvertFrom-Json
|
|
30
|
-
$pullRequestTitle = $responseJsonObject.title
|
|
31
|
-
$semicolonIndex = $pullRequestTitle.IndexOf(":")
|
|
32
|
-
|
|
33
|
-
if($semicolonIndex -eq -1)
|
|
34
|
-
{
|
|
35
|
-
throw (new-object "Exception" @("Please specify pull request type. Check readme file for more information"))
|
|
36
|
-
exit 1
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
$prType = $pullRequestTitle.Substring(0, $semicolonIndex)
|
|
40
|
-
$versionType = ""
|
|
41
|
-
|
|
42
|
-
switch ($prType)
|
|
43
|
-
{
|
|
44
|
-
"build" { $versionType = "patch"; break}
|
|
45
|
-
"test" { $versionType = "patch"; break}
|
|
46
|
-
"fix" { $versionType = "patch"; break}
|
|
47
|
-
"feat" { $versionType = "minor"; break}
|
|
48
|
-
"BREAKING CHANGE" { $versionType = "major"; break}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if($versionType -eq "")
|
|
52
|
-
{
|
|
53
|
-
throw (new-object "Exception" @("Unsupported pull request type '$prType'. Check readme file for more information"))
|
|
54
|
-
exit 1
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
$tb="$(System.PullRequest.TargetBranch)"
|
|
58
|
-
$bnRegex = $tb -match "refs/heads/(.*)"
|
|
59
|
-
$bn = $Matches[1]
|
|
60
|
-
Write-Output "Target branch name is $bn"
|
|
61
|
-
|
|
62
|
-
if(($versionType -eq "major") -and ($bn -ne "master"))
|
|
63
|
-
{
|
|
64
|
-
throw (new-object "Exception" @("Cannot release BREAKING CHANGE from branch different than master."))
|
|
65
|
-
exit 1
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
Write-Output "Version type is $versionType"
|
|
69
|
-
"$versionType" | Out-File "$(Build.SourcesDirectory)/type.txt"
|
|
70
|
-
Write-Output "##vso[task.setvariable variable=VersionType]$versionType"
|
|
71
|
-
- task: PowerShell@2
|
|
72
|
-
displayName: Save Commit Type
|
|
73
|
-
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
|
|
74
|
-
inputs:
|
|
75
|
-
targetType: inline
|
|
76
|
-
script: |
|
|
77
|
-
$releaseBranches = ConvertFrom-Json -InputObject "$(SitefinitySdkReleaseBranches)"
|
|
78
|
-
|
|
79
|
-
if ($releaseBranches -contains "$(Build.SourceBranch)") {
|
|
80
|
-
"$(Build.SourceVersionMessage)" -match "Merged PR \d+: (.*)"
|
|
81
|
-
$pullRequestTitle = $Matches[1]
|
|
82
|
-
Write-Output "Pull request title is '$pullRequestTitle'"
|
|
83
|
-
$semicolonIndex = $pullRequestTitle.IndexOf(":")
|
|
84
|
-
if($semicolonIndex -eq -1)
|
|
85
|
-
{
|
|
86
|
-
Write-Error "Please specify pull request type. Check readme file for more information"
|
|
87
|
-
exit 1
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
$prType = $pullRequestTitle.Substring(0, $semicolonIndex)
|
|
91
|
-
$versionType = ""
|
|
92
|
-
switch ($prType)
|
|
93
|
-
{
|
|
94
|
-
"build" { $versionType = "patch"; break}
|
|
95
|
-
"test" { $versionType = "patch"; break}
|
|
96
|
-
"fix" { $versionType = "patch"; break}
|
|
97
|
-
"feat" { $versionType = "minor"; break}
|
|
98
|
-
"BREAKING CHANGE" { $versionType = "major"; break}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
Write-Output "##vso[task.setvariable variable=VersionType]$versionType"
|
|
102
|
-
|
|
103
|
-
if($versionType -eq "")
|
|
104
|
-
{
|
|
105
|
-
Write-Error "Unsupported pull request type '$prType'. Check readme file for more information"
|
|
106
|
-
exit 1
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
Write-Output "Version type is $versionType"
|
|
110
|
-
"$versionType" | Out-File "$(Build.SourcesDirectory)/type.txt"
|
|
111
|
-
Write-Output "##vso[task.setvariable variable=VersionType]$versionType"
|
|
112
|
-
|
|
113
|
-
} else {
|
|
114
|
-
Write-Output ""$(Build.SourceBranch)" branch is missing from the release branches $releaseBranches . Skipping this step"
|
|
115
|
-
}
|
|
116
|
-
- task: PublishPipelineArtifact@1
|
|
117
|
-
displayName: Create Commit Data Artifact
|
|
118
|
-
inputs:
|
|
119
|
-
path: type.txt
|
|
120
|
-
artifactName: commit-data-drop
|
|
121
|
-
- task: Npm@1
|
|
122
|
-
displayName: Npm install (CI)
|
|
123
|
-
inputs:
|
|
124
|
-
command: custom
|
|
125
|
-
customCommand: ci
|
|
126
|
-
- task: Npm@1
|
|
127
|
-
displayName: Run lint
|
|
128
|
-
inputs:
|
|
129
|
-
command: custom
|
|
130
|
-
verbose: true
|
|
131
|
-
customCommand: run lint
|
|
132
|
-
- task: Bash@3
|
|
133
|
-
displayName: Run Tests
|
|
134
|
-
inputs:
|
|
135
|
-
targetType: inline
|
|
136
|
-
script: >-
|
|
137
|
-
export DISPLAY=':99.0'
|
|
138
|
-
|
|
139
|
-
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
|
|
140
|
-
|
|
141
|
-
cd $(Build.SourcesDirectory)
|
|
142
|
-
|
|
143
|
-
npm run test
|
|
144
|
-
- task: Npm@1
|
|
145
|
-
displayName: Build
|
|
146
|
-
inputs:
|
|
147
|
-
command: custom
|
|
148
|
-
verbose: false
|
|
149
|
-
customCommand: run build:release
|
|
150
|
-
- task: PublishPipelineArtifact@1
|
|
151
|
-
displayName: Publish Pipeline Artifact
|
|
152
|
-
inputs:
|
|
153
|
-
path: $(Pipeline.Workspace)/s
|
|
154
|
-
artifactName: sitefinity-webservices-sdk-drop
|
|
155
|
-
- task: PowerShell@2
|
|
156
|
-
displayName: Calculate release version
|
|
157
|
-
inputs:
|
|
158
|
-
targetType: inline
|
|
159
|
-
script: |
|
|
160
|
-
$version=git describe --long --tags
|
|
161
|
-
$version=$version.Replace('-', '.')
|
|
162
|
-
|
|
163
|
-
$versionSegments="$version".Split('.')
|
|
164
|
-
$major = [int]$versionSegments[0]
|
|
165
|
-
$minor = [int]$versionSegments[1]
|
|
166
|
-
$patch = [int]$versionSegments[2]
|
|
167
|
-
$latestVersion = "$major.$minor.$patch"
|
|
168
|
-
Write-Output "Currently published version is $latestVersion"
|
|
169
|
-
|
|
170
|
-
switch ("$(VersionType)")
|
|
171
|
-
{
|
|
172
|
-
"major" { $major = $major + 1; $minor = 0; $patch = 0; break}
|
|
173
|
-
"minor" { $minor = $minor + 1; $patch = 0; break}
|
|
174
|
-
"patch" { $patch = $patch + 1; break}
|
|
175
|
-
default {Write-Error "Version type not supported. Check Readme"; exit 1}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
$newVersion = "$major.$minor.$patch"
|
|
179
|
-
Write-Output "Releasing version $newVersion"
|
|
180
|
-
|
|
181
|
-
$validVersion = $newVersion -match "(\d){1,2}\.(\d){1,2}\.(\d){1,2}"
|
|
182
|
-
if(-not $validVersion)
|
|
183
|
-
{
|
|
184
|
-
Write-Error "Invalid version $newVersion aborting publish"
|
|
185
|
-
exit 1
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
Write-Output "Version number is $newVersion "
|
|
189
|
-
"$newVersion " | Out-File "$(Build.SourcesDirectory)/version.txt"
|
|
190
|
-
|
|
191
|
-
Write-Output "##vso[task.setvariable variable=ReleaseVersion]$newVersion"
|
|
192
|
-
- task: PublishPipelineArtifact@1
|
|
193
|
-
displayName: Publish release version artifact
|
|
194
|
-
inputs:
|
|
195
|
-
path: version.txt
|
|
196
|
-
artifactName: commit-data-drop-version
|
|
197
|
-
- task: PowerShell@2
|
|
198
|
-
displayName: Tag sitefinity-webservices-sdk repo
|
|
199
|
-
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'))
|
|
200
|
-
inputs:
|
|
201
|
-
targetType: inline
|
|
202
|
-
script: |
|
|
203
|
-
$releaseBranches = ConvertFrom-Json -InputObject "$(SitefinitySdkReleaseBranches)"
|
|
204
|
-
|
|
205
|
-
if ($releaseBranches -contains "$(Build.SourceBranch)") {
|
|
206
|
-
$token = "$(VstsRestApiToken)"
|
|
207
|
-
Write-Host "##vso[task.logissue type=warning;] Releasing Sitefinity webservices sdk - "$(ReleaseVersion)""
|
|
208
|
-
|
|
209
|
-
$postParams = @{name="$(ReleaseVersion)";taggedObject=@{objectId="$(Build.SourceVersion)"};message='Sitefinity webservices sdk release'}
|
|
210
|
-
$json = $postParams | ConvertTo-Json
|
|
211
|
-
|
|
212
|
-
$headers = @{'Content-Type'='application/json'; 'Authorization'="Basic $token"}
|
|
213
|
-
$tagUrl = "https://prgs-sitefinity.visualstudio.com/sitefinity/_apis/git/repositories/sitefinity-webservices-sdk/annotatedtags?api-version=4.1-preview.1"
|
|
214
|
-
|
|
215
|
-
Invoke-WebRequest -Uri $tagUrl -Method POST -Body $json -Headers $headers
|
|
216
|
-
} else {
|
|
217
|
-
Write-Error "Cannot tag the branch with the new release since it is missing from the list with release branches. Please review the whitelisted branches"
|
|
218
|
-
exit 1
|
|
219
|
-
}
|