cloudcms-server 0.9.301 → 3.2.280
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/.last_command +7 -0
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/broadcast/providers/redis.js +24 -49
- package/clients/nrp.js +117 -0
- package/clients/redis.js +64 -0
- package/framework/controllers.js +4 -4
- package/index.js +13 -10
- package/insight/insight.js +1 -1
- package/launchpad/index.js +174 -11
- package/launchpad/launchers/cluster.js +103 -110
- package/launchpad/launchers/redis.js +70 -0
- package/launchpad/launchers/single.js +36 -22
- package/locks/locks.js +53 -7
- package/locks/providers/cluster.js +3 -1
- package/locks/providers/memory.js +10 -7
- package/locks/providers/redis.js +62 -82
- package/middleware/admin/admin.js +2 -2
- package/middleware/authentication/adapters/session.js +11 -8
- package/middleware/authentication/authentication.js +28 -16
- package/middleware/authentication/authenticators/default.js +5 -2
- package/middleware/authentication/authenticators/session.js +5 -2
- package/middleware/authentication/providers/saml.js +1 -1
- package/middleware/authorization/authorization.js +11 -8
- package/middleware/awareness/awareness.js +51 -29
- package/middleware/awareness/plugins/editorial.js +4 -4
- package/middleware/awareness/providers/abstract-async.js +107 -84
- package/middleware/awareness/providers/abstract.js +1 -1
- package/middleware/awareness/providers/memory.js +0 -14
- package/middleware/awareness/providers/redis.js +186 -279
- package/middleware/cache/providers/redis.js +127 -89
- package/middleware/cloudcms/cloudcms.js +22 -16
- package/middleware/form/form.js +2 -2
- package/middleware/proxy/proxy.js +7 -21
- package/middleware/stores/stores.js +2 -2
- package/middleware/virtual-config/virtual-config.js +7 -7
- package/middleware/wcm/wcm.js +4 -4
- package/package.json +54 -52
- package/server/index.js +517 -399
- package/server/standalone.js +9 -0
- package/temp/clusterlock/index.js +3 -3
- package/temp/clusterlock/package.json +1 -1
- package/temp/passport-saml/LICENSE +23 -0
- package/temp/passport-saml/README.md +406 -0
- package/temp/passport-saml/lib/node-saml/algorithms.d.ts +5 -0
- package/temp/passport-saml/lib/node-saml/algorithms.js +41 -0
- package/temp/passport-saml/lib/node-saml/algorithms.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/index.d.ts +3 -0
- package/temp/passport-saml/lib/node-saml/index.js +6 -0
- package/temp/passport-saml/lib/node-saml/index.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/inmemory-cache-provider.d.ts +45 -0
- package/temp/passport-saml/lib/node-saml/inmemory-cache-provider.js +86 -0
- package/temp/passport-saml/lib/node-saml/inmemory-cache-provider.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/saml-post-signing.d.ts +3 -0
- package/temp/passport-saml/lib/node-saml/saml-post-signing.js +15 -0
- package/temp/passport-saml/lib/node-saml/saml-post-signing.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/saml.d.ts +77 -0
- package/temp/passport-saml/lib/node-saml/saml.js +1170 -0
- package/temp/passport-saml/lib/node-saml/saml.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/types.d.ts +95 -0
- package/temp/passport-saml/lib/node-saml/types.js +8 -0
- package/temp/passport-saml/lib/node-saml/types.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/utility.d.ts +3 -0
- package/temp/passport-saml/lib/node-saml/utility.js +19 -0
- package/temp/passport-saml/lib/node-saml/utility.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/xml.d.ts +21 -0
- package/temp/passport-saml/lib/node-saml/xml.js +140 -0
- package/temp/passport-saml/lib/node-saml/xml.js.map +1 -0
- package/temp/passport-saml/lib/passport-saml/index.d.ts +6 -0
- package/temp/passport-saml/lib/passport-saml/index.js +11 -0
- package/temp/passport-saml/lib/passport-saml/index.js.map +1 -0
- package/temp/passport-saml/lib/passport-saml/multiSamlStrategy.d.ts +13 -0
- package/temp/passport-saml/lib/passport-saml/multiSamlStrategy.js +63 -0
- package/temp/passport-saml/lib/passport-saml/multiSamlStrategy.js.map +1 -0
- package/temp/passport-saml/lib/passport-saml/strategy.d.ts +20 -0
- package/temp/passport-saml/lib/passport-saml/strategy.js +167 -0
- package/temp/passport-saml/lib/passport-saml/strategy.js.map +1 -0
- package/temp/passport-saml/lib/passport-saml/types.d.ts +51 -0
- package/temp/passport-saml/lib/passport-saml/types.js +11 -0
- package/temp/passport-saml/lib/passport-saml/types.js.map +1 -0
- package/temp/passport-saml/package.json +96 -0
- package/util/auth.js +1 -1
- package/util/cloudcms.js +72 -93
- package/util/proxy-factory.js +230 -260
- package/util/redis.js +113 -0
- package/util/renditions.js +1 -1
- package/util/util.js +15 -2
- package/launchpad/launchers/sticky-cluster.js +0 -43
- package/web/cms/ice.js +0 -109
- package/web/cms/preview.js +0 -106
- package/web/socket.io/socket.io.js +0 -2
package/util/cloudcms.js
CHANGED
|
@@ -68,26 +68,23 @@ exports = module.exports = function()
|
|
|
68
68
|
{
|
|
69
69
|
if (!repositoryId)
|
|
70
70
|
{
|
|
71
|
-
callback({
|
|
71
|
+
return callback({
|
|
72
72
|
"message": "Missing repositoryId in ensureContentDirectory()"
|
|
73
73
|
});
|
|
74
|
-
return;
|
|
75
74
|
}
|
|
76
75
|
|
|
77
76
|
if (!branchId)
|
|
78
77
|
{
|
|
79
|
-
callback({
|
|
78
|
+
return callback({
|
|
80
79
|
"message": "Missing branchId in ensureContentDirectory()"
|
|
81
80
|
});
|
|
82
|
-
return;
|
|
83
81
|
}
|
|
84
82
|
|
|
85
83
|
if (!locale)
|
|
86
84
|
{
|
|
87
|
-
callback({
|
|
85
|
+
return callback({
|
|
88
86
|
"message": "Missing locale in ensureContentDirectory()"
|
|
89
87
|
});
|
|
90
|
-
return;
|
|
91
88
|
}
|
|
92
89
|
|
|
93
90
|
var contentDirectoryPath = path.join(repositoryId, branchId, nodeId, locale);
|
|
@@ -148,21 +145,17 @@ exports = module.exports = function()
|
|
|
148
145
|
if (err)
|
|
149
146
|
{
|
|
150
147
|
// nothing found
|
|
151
|
-
callback({
|
|
148
|
+
return callback({
|
|
152
149
|
"message": "Nothing cached on disk"
|
|
153
150
|
});
|
|
154
|
-
|
|
155
|
-
return;
|
|
156
151
|
}
|
|
157
152
|
|
|
158
153
|
if (!cacheInfoString)
|
|
159
154
|
{
|
|
160
155
|
// nothing found
|
|
161
|
-
callback({
|
|
156
|
+
return callback({
|
|
162
157
|
"message": "Nothing cached on disk"
|
|
163
158
|
});
|
|
164
|
-
|
|
165
|
-
return;
|
|
166
159
|
}
|
|
167
160
|
|
|
168
161
|
var invalidate = function () {
|
|
@@ -346,25 +339,40 @@ exports = module.exports = function()
|
|
|
346
339
|
{
|
|
347
340
|
if (attemptCount === maxAttemptsAllowed)
|
|
348
341
|
{
|
|
349
|
-
cb({
|
|
342
|
+
return cb({
|
|
350
343
|
"message": "Maximum number of connection attempts exceeded(" + maxAttemptsAllowed + ")",
|
|
351
344
|
"err": previousError
|
|
352
345
|
});
|
|
353
|
-
|
|
354
|
-
return;
|
|
355
346
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
347
|
+
|
|
348
|
+
var failFast = function(contentStore, filePath, cb) {
|
|
349
|
+
var triggered = false;
|
|
350
|
+
|
|
351
|
+
return function(tempStream, err)
|
|
360
352
|
{
|
|
353
|
+
// don't allow this to be called twice
|
|
354
|
+
if (triggered) {
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
triggered = true;
|
|
359
|
+
|
|
361
360
|
// ensure stream is closed
|
|
362
|
-
|
|
363
|
-
|
|
361
|
+
if (tempStream) {
|
|
362
|
+
closeWriteStream(tempStream);
|
|
363
|
+
}
|
|
364
|
+
|
|
364
365
|
// ensure cleanup
|
|
365
366
|
return safeRemove(contentStore, filePath, function () {
|
|
366
367
|
cb(err);
|
|
367
368
|
});
|
|
369
|
+
};
|
|
370
|
+
}(contentStore, filePath, cb);
|
|
371
|
+
|
|
372
|
+
contentStore.writeStream(filePath, function(err, tempStream) {
|
|
373
|
+
|
|
374
|
+
if (err) {
|
|
375
|
+
return failFast(tempStream, err);
|
|
368
376
|
}
|
|
369
377
|
|
|
370
378
|
var cacheFilePath = toCacheFilePath(filePath);
|
|
@@ -382,7 +390,7 @@ exports = module.exports = function()
|
|
|
382
390
|
agent = https.globalAgent;
|
|
383
391
|
}
|
|
384
392
|
|
|
385
|
-
var URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT) + uri;
|
|
393
|
+
var URL = util.asURL(process.env.GITANA_PROXY_SCHEME, process.env.GITANA_PROXY_HOST, process.env.GITANA_PROXY_PORT, process.env.GITANA_PROXY_PATH) + uri;
|
|
386
394
|
request({
|
|
387
395
|
"method": "GET",
|
|
388
396
|
"url": URL,
|
|
@@ -398,18 +406,10 @@ exports = module.exports = function()
|
|
|
398
406
|
{
|
|
399
407
|
response.pipe(tempStream).on("close", function (err) {
|
|
400
408
|
|
|
401
|
-
// TODO: not needed here?
|
|
402
|
-
// ensure stream is closed
|
|
403
|
-
// closeWriteStream(tempStream);
|
|
404
|
-
|
|
405
409
|
if (err)
|
|
406
410
|
{
|
|
407
411
|
// some went wrong at disk io level?
|
|
408
|
-
return
|
|
409
|
-
cb({
|
|
410
|
-
"message": "Failed to download: " + JSON.stringify(err)
|
|
411
|
-
});
|
|
412
|
-
});
|
|
412
|
+
return failFast(tempStream, err);
|
|
413
413
|
}
|
|
414
414
|
|
|
415
415
|
contentStore.existsFile(filePath, function (exists) {
|
|
@@ -418,55 +418,39 @@ exports = module.exports = function()
|
|
|
418
418
|
|
|
419
419
|
// write cache file
|
|
420
420
|
var cacheInfo = buildCacheInfo(response);
|
|
421
|
-
if (cacheInfo)
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
});
|
|
421
|
+
if (!cacheInfo) {
|
|
422
|
+
return cb(null, filePath, null);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
contentStore.writeFile(cacheFilePath, JSON.stringify(cacheInfo, null, " "), function (err) {
|
|
426
|
+
|
|
427
|
+
if (err)
|
|
428
|
+
{
|
|
429
|
+
// failed to write cache file, thus the whole thing is invalid
|
|
430
|
+
return safeRemove(contentStore, cacheFilePath, function () {
|
|
431
|
+
failFast(tempStream, {
|
|
432
|
+
"message": "Failed to write cache file: " + cacheFilePath + ", err: " + JSON.stringify(err)
|
|
434
433
|
});
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
{
|
|
438
|
-
cb(null, filePath, cacheInfo);
|
|
439
|
-
}
|
|
434
|
+
});
|
|
435
|
+
}
|
|
440
436
|
|
|
441
|
-
});
|
|
442
|
-
}
|
|
443
|
-
else
|
|
444
|
-
{
|
|
445
437
|
cb(null, filePath, cacheInfo);
|
|
446
|
-
}
|
|
438
|
+
});
|
|
447
439
|
}
|
|
448
440
|
else
|
|
449
441
|
{
|
|
450
|
-
//process.log("WARN: exists false, " + filePath);
|
|
451
|
-
|
|
452
442
|
// for some reason, file wasn't found
|
|
453
443
|
// roll back the whole thing
|
|
454
444
|
safeRemove(contentStore, cacheFilePath, function () {
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
"message": "Failed to verify written cached file: " + filePath
|
|
458
|
-
});
|
|
445
|
+
failFast(tempStream, {
|
|
446
|
+
"message": "Failed to verify written cached file: " + filePath
|
|
459
447
|
});
|
|
460
448
|
});
|
|
461
449
|
}
|
|
462
450
|
});
|
|
463
451
|
|
|
464
452
|
}).on("error", function (err) {
|
|
465
|
-
|
|
466
|
-
// ensure stream is closed
|
|
467
|
-
closeWriteStream(tempStream);
|
|
468
|
-
|
|
469
|
-
process.log("Pipe error: " + err);
|
|
453
|
+
failFast(tempStream, err);
|
|
470
454
|
});
|
|
471
455
|
}
|
|
472
456
|
else
|
|
@@ -480,10 +464,7 @@ exports = module.exports = function()
|
|
|
480
464
|
});
|
|
481
465
|
|
|
482
466
|
response.on('end', function () {
|
|
483
|
-
|
|
484
|
-
// ensure stream is closed
|
|
485
|
-
closeWriteStream(tempStream);
|
|
486
|
-
|
|
467
|
+
|
|
487
468
|
var afterCleanup = function () {
|
|
488
469
|
|
|
489
470
|
// see if it is "invalid_token"
|
|
@@ -518,9 +499,11 @@ exports = module.exports = function()
|
|
|
518
499
|
"code": response.statusCode,
|
|
519
500
|
"body": body
|
|
520
501
|
});
|
|
521
|
-
|
|
522
502
|
};
|
|
523
|
-
|
|
503
|
+
|
|
504
|
+
// ensure stream is closed
|
|
505
|
+
closeWriteStream(tempStream);
|
|
506
|
+
|
|
524
507
|
// clean things up
|
|
525
508
|
safeRemove(contentStore, cacheFilePath, function () {
|
|
526
509
|
safeRemove(contentStore, filePath, function () {
|
|
@@ -532,12 +515,8 @@ exports = module.exports = function()
|
|
|
532
515
|
}
|
|
533
516
|
|
|
534
517
|
}).on('error', function (e) {
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
closeWriteStream(tempStream);
|
|
538
|
-
|
|
539
|
-
process.log("_writeToDisk request timed out");
|
|
540
|
-
process.log(e)
|
|
518
|
+
failFast(tempStream, e);
|
|
519
|
+
|
|
541
520
|
}).on('end', function (e) {
|
|
542
521
|
|
|
543
522
|
// ensure stream is closed
|
|
@@ -548,9 +527,11 @@ exports = module.exports = function()
|
|
|
548
527
|
tempStream.on("error", function (e) {
|
|
549
528
|
process.log("Temp stream errored out");
|
|
550
529
|
process.log(e);
|
|
530
|
+
|
|
531
|
+
failFast(tempStream, e);
|
|
551
532
|
|
|
552
533
|
// ensure stream is closed
|
|
553
|
-
closeWriteStream(tempStream);
|
|
534
|
+
//closeWriteStream(tempStream);
|
|
554
535
|
|
|
555
536
|
});
|
|
556
537
|
});
|
|
@@ -608,8 +589,7 @@ exports = module.exports = function()
|
|
|
608
589
|
readFromDisk(contentStore, filePath, function (err, cacheInfo) {
|
|
609
590
|
|
|
610
591
|
if (!err && cacheInfo) {
|
|
611
|
-
callback(err, filePath, cacheInfo);
|
|
612
|
-
return;
|
|
592
|
+
return callback(err, filePath, cacheInfo);
|
|
613
593
|
}
|
|
614
594
|
|
|
615
595
|
// either there was an error (in which case things were cleaned up)
|
|
@@ -631,13 +611,12 @@ exports = module.exports = function()
|
|
|
631
611
|
|
|
632
612
|
if (err) {
|
|
633
613
|
process.log("writeToDisk error, err: " + err.message + ", body: " + err.body);
|
|
634
|
-
callback(err);
|
|
635
|
-
}
|
|
636
|
-
else {
|
|
637
|
-
//process.log("Fetched: " + assetPath);
|
|
638
|
-
//process.log("Retrieved from server: " + filePath);
|
|
639
|
-
callback(null, filePath, cacheInfo);
|
|
614
|
+
return callback(err);
|
|
640
615
|
}
|
|
616
|
+
|
|
617
|
+
//process.log("Fetched: " + assetPath);
|
|
618
|
+
//process.log("Retrieved from server: " + filePath);
|
|
619
|
+
callback(null, filePath, cacheInfo);
|
|
641
620
|
});
|
|
642
621
|
});
|
|
643
622
|
};
|
|
@@ -749,6 +728,7 @@ exports = module.exports = function()
|
|
|
749
728
|
writeToDisk(contentStore, gitana, uri, filePath, function (err, filePath, responseHeaders) {
|
|
750
729
|
|
|
751
730
|
if (err) {
|
|
731
|
+
|
|
752
732
|
if (err.code === 404) {
|
|
753
733
|
return callback();
|
|
754
734
|
}
|
|
@@ -1072,7 +1052,7 @@ exports = module.exports = function()
|
|
|
1072
1052
|
r.download = function(contentStore, gitana, repositoryId, branchId, nodeId, attachmentId, nodePath, locale, forceReload, callback)
|
|
1073
1053
|
{
|
|
1074
1054
|
// claim a lock around this node for this server
|
|
1075
|
-
_LOCK(contentStore, _lock_identifier(repositoryId, branchId, nodeId), function(releaseLockFn) {
|
|
1055
|
+
_LOCK(contentStore, _lock_identifier(repositoryId, branchId, nodeId), function(err, releaseLockFn) {
|
|
1076
1056
|
|
|
1077
1057
|
// workhorse - pass releaseLockFn back to callback
|
|
1078
1058
|
downloadNode(contentStore, gitana, repositoryId, branchId, nodeId, attachmentId, nodePath, locale, forceReload, function (err, filePath, cacheInfo) {
|
|
@@ -1085,7 +1065,7 @@ exports = module.exports = function()
|
|
|
1085
1065
|
r.preview = function(contentStore, gitana, repositoryId, branchId, nodeId, nodePath, attachmentId, locale, previewId, size, mimetype, forceReload, callback)
|
|
1086
1066
|
{
|
|
1087
1067
|
// claim a lock around this node for this server
|
|
1088
|
-
_LOCK(contentStore, _lock_identifier(repositoryId, branchId, nodeId), function(releaseLockFn) {
|
|
1068
|
+
_LOCK(contentStore, _lock_identifier(repositoryId, branchId, nodeId), function(err, releaseLockFn) {
|
|
1089
1069
|
|
|
1090
1070
|
// workhorse - pass releaseLockFn back to callback
|
|
1091
1071
|
previewNode(contentStore, gitana, repositoryId, branchId, nodeId, nodePath, attachmentId, locale, previewId, size, mimetype, forceReload, function(err, filePath, cacheInfo) {
|
|
@@ -1098,10 +1078,9 @@ exports = module.exports = function()
|
|
|
1098
1078
|
r.invalidate = function(contentStore, repositoryId, branchId, nodeId, paths, callback)
|
|
1099
1079
|
{
|
|
1100
1080
|
// claim a lock around this node for this server
|
|
1101
|
-
_LOCK(contentStore, _lock_identifier(repositoryId, branchId, nodeId), function(releaseLockFn) {
|
|
1081
|
+
_LOCK(contentStore, _lock_identifier(repositoryId, branchId, nodeId), function(err, releaseLockFn) {
|
|
1102
1082
|
|
|
1103
1083
|
invalidateNode(contentStore, repositoryId, branchId, nodeId, function () {
|
|
1104
|
-
|
|
1105
1084
|
invalidateNodePaths(contentStore, repositoryId, branchId, paths, function() {
|
|
1106
1085
|
|
|
1107
1086
|
// release lock
|
|
@@ -1118,7 +1097,7 @@ exports = module.exports = function()
|
|
|
1118
1097
|
r.downloadAttachable = function(contentStore, gitana, datastoreTypeId, datastoreId, objectTypeId, objectId, attachmentId, locale, forceReload, callback)
|
|
1119
1098
|
{
|
|
1120
1099
|
// claim a lock around this node for this server
|
|
1121
|
-
_LOCK(contentStore, _lock_identifier(datastoreId, objectId), function(releaseLockFn) {
|
|
1100
|
+
_LOCK(contentStore, _lock_identifier(datastoreId, objectId), function(err, releaseLockFn) {
|
|
1122
1101
|
|
|
1123
1102
|
// workhorse - pass releaseLockFn back to callback
|
|
1124
1103
|
downloadAttachable(contentStore, gitana, datastoreTypeId, datastoreId, objectTypeId, objectId, attachmentId, locale, forceReload, function(err, filePath, cacheInfo) {
|
|
@@ -1131,7 +1110,7 @@ exports = module.exports = function()
|
|
|
1131
1110
|
r.previewAttachable = function(contentStore, gitana, datastoreTypeId, datastoreId, objectTypeId, objectId, attachmentId, locale, previewId, size, mimetype, forceReload, callback)
|
|
1132
1111
|
{
|
|
1133
1112
|
// claim a lock around this node for this server
|
|
1134
|
-
_LOCK(contentStore, _lock_identifier(datastoreId, objectId), function(releaseLockFn) {
|
|
1113
|
+
_LOCK(contentStore, _lock_identifier(datastoreId, objectId), function(err, releaseLockFn) {
|
|
1135
1114
|
|
|
1136
1115
|
// workhorse - pass releaseLockFn back to callback
|
|
1137
1116
|
previewAttachable(contentStore, gitana, datastoreTypeId, datastoreId, objectTypeId, objectId, attachmentId, locale, previewId, size, mimetype, forceReload, function (err, filePath, cacheInfo) {
|
|
@@ -1144,7 +1123,7 @@ exports = module.exports = function()
|
|
|
1144
1123
|
r.invalidateAttachable = function(contentStore, datastoreTypeId, datastoreId, objectTypeId, objectId, callback)
|
|
1145
1124
|
{
|
|
1146
1125
|
// claim a lock around this node for this server
|
|
1147
|
-
_LOCK(contentStore, _lock_identifier(datastoreId, objectId), function(releaseLockFn) {
|
|
1126
|
+
_LOCK(contentStore, _lock_identifier(datastoreId, objectId), function(err, releaseLockFn) {
|
|
1148
1127
|
|
|
1149
1128
|
// TODO: not implemented
|
|
1150
1129
|
callback();
|