@progress/sitefinity-webservices-sdk 1.0.3 → 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.
- package/.eslintrc.js +30 -9
- 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 +17 -3
- package/dist/docs/assets/main.js +4 -2
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/assets/style.css +430 -619
- package/dist/docs/classes/BlobBuilder.BlobBuilder.html +135 -0
- package/dist/docs/classes/Data.Data.html +385 -0
- package/dist/docs/classes/Expression.BinaryExpression.html +184 -1
- package/dist/docs/classes/Expression.ComplexExpression.html +139 -1
- package/dist/docs/classes/Expression.ExpressionBase.html +125 -1
- package/dist/docs/classes/OrderProperty.OrderProperty.html +130 -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 +190 -0
- package/dist/docs/classes/Requests_BatchRequest.BatchRequest.html +731 -17
- package/dist/docs/classes/Requests_BatchRequest.Transaction.html +330 -17
- package/dist/docs/classes/Requests_ExecutableRequest.ExecutableRequest.html +342 -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 +309 -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 +300 -1
- package/dist/docs/classes/Requests_Request.GetByIdRequest.html +300 -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 +342 -1
- package/dist/docs/classes/Sitefinity.Sitefinity.html +186 -0
- package/dist/docs/classes/WhereQuery.WhereQuery.html +410 -0
- package/dist/docs/classes/chunk_upload_chunk_upload_sdk.ChunkUploadSdk.html +229 -0
- package/dist/docs/classes/chunk_upload_chunked_file_upload_utilities.ChunkedFileUploadUtilities.html +129 -0
- package/dist/docs/classes/utils.utils.html +301 -0
- package/dist/docs/index.html +56 -2
- package/dist/docs/interfaces/Data.CreateRelatedRequestOptions.html +157 -1
- package/dist/docs/interfaces/Data.CreateRequestOptions.html +155 -1
- package/dist/docs/interfaces/Data.OperationsRequestOptions.html +145 -1
- package/dist/docs/interfaces/Data.PropertyRequestOptions.html +151 -1
- package/dist/docs/interfaces/Data.RequestOptionsBase.html +136 -1
- package/dist/docs/interfaces/Data.SingleRelatedItemRequestOptions.html +157 -1
- package/dist/docs/interfaces/Data.UpdateRequestOptions.html +157 -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 +96 -5
- package/dist/docs/interfaces/Requests_Request.CommitChunksRequestOptionsExtended.html +215 -0
- package/dist/docs/interfaces/Requests_Request.PostRequestOptionsExtended.html +161 -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 +165 -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 +150 -1
- package/dist/docs/interfaces/Sitefinity.SDKOptions.html +128 -9
- package/dist/docs/interfaces/Sitefinity.Token.html +92 -1
- package/dist/docs/interfaces/Sitefinity.TypeOptions.html +144 -13
- package/dist/docs/interfaces/chunk_upload_chunk_upload_sdk.ChunkUploadInfoDTO.html +157 -0
- package/dist/docs/interfaces/chunk_upload_chunk_upload_sdk.ChunkUploadResult.html +109 -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 +99 -0
- package/dist/docs/interfaces/chunk_upload_chunked_file_upload_utilities.FileUploadChunk.html +92 -0
- package/dist/docs/modules/BlobBuilder.html +71 -1
- package/dist/docs/modules/Data.html +90 -1
- package/dist/docs/modules/Expression.html +75 -1
- package/dist/docs/modules/OrderProperty.html +71 -1
- package/dist/docs/modules/Query.html +71 -1
- package/dist/docs/modules/QueryBase.html +71 -1
- package/dist/docs/modules/QueryBuilder.html +71 -1
- package/dist/docs/modules/Requests_BatchRequest.html +92 -1
- package/dist/docs/modules/Requests_ExecutableRequest.html +76 -1
- package/dist/docs/modules/Requests_Request.html +112 -1
- package/dist/docs/modules/Requests_RequestBase.html +76 -1
- package/dist/docs/modules/Requests_RequestFactory.html +71 -1
- package/dist/docs/modules/Sitefinity.html +80 -1
- package/dist/docs/modules/WhereQuery.html +71 -1
- package/dist/docs/modules/chunk_upload_chunk_upload_sdk.html +86 -0
- package/dist/docs/modules/chunk_upload_chunked_file_upload_utilities.html +78 -0
- package/dist/docs/modules/constants.html +81 -1
- package/dist/docs/modules/utils.html +71 -1
- package/dist/docs/modules.html +78 -1
- package/dist/docs/variables/constants.CONTENT_TYPES.html +74 -0
- package/dist/docs/variables/constants.EXPRESSION_TYPE.html +102 -0
- package/dist/docs/variables/constants.HEADER_NAMES.html +100 -0
- package/dist/docs/variables/constants.HTTP_METHODS.html +82 -0
- package/dist/docs/variables/constants.ODATA_PARAMS.html +88 -0
- package/dist/docs/variables/constants.SF_PARAMS.html +82 -0
- package/dist/samples.html +235 -36
- package/dist/sitefinity-webservices-sdk.d.ts +0 -1
- package/dist/sitefinity-webservices-sdk.js +473 -117
- 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-lock.json +3166 -6687
- 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 +189 -36
- package/tsconfig.json +11 -3
- package/type.txt +1 -1
- package/config/helpers.js +0 -10
- package/config/webpack.common.js +0 -38
- 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/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/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,7 +396,7 @@
|
|
|
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: "",
|
|
@@ -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/type.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
minor
|
package/config/helpers.js
DELETED
package/config/webpack.common.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
// For instructions about this file refer to
|
|
2
|
-
// webpack and webpack-hot-middleware documentation
|
|
3
|
-
const webpack = require("webpack");
|
|
4
|
-
const helpers = require("./helpers");
|
|
5
|
-
|
|
6
|
-
module.exports = function(options) {
|
|
7
|
-
return {
|
|
8
|
-
mode: 'development',
|
|
9
|
-
entry: {
|
|
10
|
-
"app": helpers.root("sitefinity-webservices-sdk"),
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
output: {
|
|
14
|
-
path: helpers.root("dist"),
|
|
15
|
-
filename: "sitefinity-webservices-sdk.js",
|
|
16
|
-
chunkFilename: "sitefinity-webservices-sdk.js",
|
|
17
|
-
libraryTarget: "umd",
|
|
18
|
-
library: "Sitefinity"
|
|
19
|
-
},
|
|
20
|
-
plugins: [
|
|
21
|
-
//Skipping the error emitting phase (and recording phase) during compilation, so there are no assets emitted that include errors
|
|
22
|
-
new webpack.NoEmitOnErrorsPlugin()
|
|
23
|
-
],
|
|
24
|
-
|
|
25
|
-
resolve: {
|
|
26
|
-
extensions: [".ts", ".js", ".json", ".html"]
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
module: {
|
|
30
|
-
rules: [
|
|
31
|
-
{
|
|
32
|
-
test: /\.ts$/,
|
|
33
|
-
use: ["awesome-typescript-loader"]
|
|
34
|
-
}
|
|
35
|
-
]
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
};
|
package/config/webpack.dev.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// For instructions about this file refer to
|
|
2
|
-
// webpack and webpack-hot-middleware documentation
|
|
3
|
-
const { merge } = require("webpack-merge"); // used to merge webpack configs
|
|
4
|
-
const commonConfig = require("./webpack.common"); // the settings that are common to prod and dev
|
|
5
|
-
|
|
6
|
-
module.exports = merge(commonConfig({ env: "dev" }), {
|
|
7
|
-
devtool: "source-map",
|
|
8
|
-
|
|
9
|
-
output: {
|
|
10
|
-
pathinfo: true
|
|
11
|
-
},
|
|
12
|
-
|
|
13
|
-
devServer: {
|
|
14
|
-
inline: true,
|
|
15
|
-
port: 4000,
|
|
16
|
-
historyApiFallback: true,
|
|
17
|
-
stats: "normal"
|
|
18
|
-
},
|
|
19
|
-
});
|
package/config/webpack.prod.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
// For instructions about this file refer to
|
|
2
|
-
// webpack and webpack-hot-middleware documentation
|
|
3
|
-
const { merge } = require("webpack-merge"); // used to merge webpack configs
|
|
4
|
-
const commonConfig = require("./webpack.common"); // the settings that are common to prod and dev
|
|
5
|
-
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
6
|
-
|
|
7
|
-
module.exports =
|
|
8
|
-
merge(commonConfig({ env: "prod" }), {
|
|
9
|
-
mode: 'production',
|
|
10
|
-
output: {
|
|
11
|
-
filename: "sitefinity-webservices-sdk.min.js"
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
plugins: [
|
|
15
|
-
new HtmlWebpackPlugin({
|
|
16
|
-
"filename": "../dist/samples.html",
|
|
17
|
-
"template": "template.html",
|
|
18
|
-
"inject": "head",
|
|
19
|
-
"scriptLoading": "blocking"
|
|
20
|
-
})
|
|
21
|
-
],
|
|
22
|
-
optimization: {
|
|
23
|
-
minimize: true
|
|
24
|
-
}
|
|
25
|
-
});
|