cloudcms-server 3.3.1-beta.9 → 4.0.0-beta.10
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/LICENSE +1 -1
- package/README.md +1 -1
- package/broadcast/broadcast.js +6 -3
- package/broadcast/providers/redis.js +24 -49
- package/clients/nrp.js +117 -0
- package/clients/redis.js +64 -0
- package/cloudcms-server.iml +1 -0
- package/d1/index.js +629 -0
- package/d1/index.js.works +203 -0
- package/d1/package.json +86 -0
- package/d1/package.json.works +14 -0
- package/duster/helpers/sample/nyt.js +2 -1
- package/framework/controllers.js +4 -4
- package/index.js +21 -14
- package/insight/insight.js +1 -1
- package/launchpad/index.js +203 -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 +63 -9
- 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 +3 -3
- 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 +2 -2
- package/middleware/authorization/authorization.js +11 -8
- package/middleware/awareness/awareness.js +63 -38
- package/middleware/awareness/plugins/api_event.js +105 -0
- package/middleware/awareness/plugins/editorial.js +8 -7
- package/middleware/awareness/plugins/resources.js +13 -5
- 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/cache.js +4 -2
- package/middleware/cache/providers/redis.js +127 -89
- package/middleware/cache/providers/shared-memory.js +3 -3
- package/middleware/cloudcms/cloudcms.js +22 -16
- package/middleware/driver-config/driver-config.js +0 -6
- package/middleware/form/form.js +3 -3
- package/middleware/modules/modules.js +17 -8
- package/middleware/perf/perf.js +3 -2
- package/middleware/proxy/proxy.js +8 -21
- package/middleware/stores/store.js +0 -1
- package/middleware/stores/stores.js +4 -4
- package/middleware/virtual-config/virtual-config.js +11 -11
- package/middleware/virtual-files/virtual-files.js +0 -3
- package/middleware/wcm/wcm.js +4 -4
- package/middleware/welcome/welcome.js +0 -3
- package/notifications/notifications.js +74 -12
- package/notifications/providers/kafka.js +182 -0
- package/notifications/providers/stomp.js +4 -0
- package/package.json +33 -30
- package/server/index.js +508 -416
- 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 +16 -10
- package/util/cloudcms.js +108 -120
- package/util/proxy-factory.js +103 -237
- package/util/redis.js +113 -0
- package/util/renditions.js +12 -6
- package/util/request.js +12 -6
- package/util/util.js +16 -2
- package/.last_command +0 -7
- package/launchpad/launchers/sticky-cluster.js +0 -43
- package/temp/memored/.jshintrc +0 -4
- package/temp/memored/README.md +0 -240
- package/temp/memored/demo/demo1.js +0 -37
- package/temp/memored/demo/demo2.js +0 -32
- package/temp/memored/gulpfile.js +0 -8
- package/temp/memored/index.js +0 -343
- package/temp/memored/package.json +0 -54
- package/temp/memored/spec/memored.spec.js +0 -265
- package/web/cms/ice.js +0 -109
- package/web/cms/preview.js +0 -106
package/LICENSE
CHANGED
package/README.md
CHANGED
package/broadcast/broadcast.js
CHANGED
|
@@ -11,10 +11,13 @@ module.exports = function()
|
|
|
11
11
|
var self = this;
|
|
12
12
|
|
|
13
13
|
// set up defaults
|
|
14
|
-
if (!process.env.CLOUDCMS_BROADCAST_TYPE)
|
|
14
|
+
if (!process.env.CLOUDCMS_BROADCAST_TYPE)
|
|
15
|
+
{
|
|
15
16
|
process.env.CLOUDCMS_BROADCAST_TYPE = "local";
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
// auto-configure
|
|
19
|
+
if (process.env.CLOUDCMS_LAUNCHPAD_SETUP === "redis")
|
|
20
|
+
{
|
|
18
21
|
process.env.CLOUDCMS_BROADCAST_TYPE = "redis";
|
|
19
22
|
}
|
|
20
23
|
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
var
|
|
1
|
+
var redisClientFactory = require("../../clients/redis");
|
|
2
|
+
var redisHelper = require("../../util/redis");
|
|
2
3
|
|
|
3
|
-
var NRP = require(
|
|
4
|
-
|
|
5
|
-
var logFactory = require("../../util/logger");
|
|
4
|
+
var NRP = require("../../clients/nrp");
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Redis broadcast provider.
|
|
@@ -12,55 +11,31 @@ var logFactory = require("../../util/logger");
|
|
|
12
11
|
exports = module.exports = function(broadcastConfig)
|
|
13
12
|
{
|
|
14
13
|
var nrp = null;
|
|
15
|
-
|
|
16
|
-
var logger =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
// allow for global redis default
|
|
20
|
-
// allow for redis broadcast specific
|
|
21
|
-
// otherwise default to "error"
|
|
22
|
-
if (typeof(process.env.CLOUDCMS_REDIS_DEBUG_LEVEL) !== "undefined") {
|
|
23
|
-
logger.setLevel(("" + process.env.CLOUDCMS_REDIS_DEBUG_LEVEL).toLowerCase(), true);
|
|
24
|
-
}
|
|
25
|
-
else if (typeof(process.env.CLOUDCMS_BROADCAST_REDIS_DEBUG_LEVEL) !== "undefined") {
|
|
26
|
-
logger.setLevel(("" + process.env.CLOUDCMS_BROADCAST_REDIS_DEBUG_LEVEL).toLowerCase(), true);
|
|
27
|
-
}
|
|
28
|
-
|
|
14
|
+
|
|
15
|
+
var logger = redisHelper.redisLogger("REDIS_BROADCAST", "CLOUDCMS_BROADCAST_", "error")
|
|
16
|
+
|
|
29
17
|
var r = {};
|
|
30
18
|
|
|
31
19
|
r.start = function(callback)
|
|
32
20
|
{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
var nrpConfig = {
|
|
54
|
-
"port": redisPort,
|
|
55
|
-
"host": redisEndpoint,
|
|
56
|
-
"scope": "broadcast_cache"
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
logger.info("using config = " + nrpConfig);
|
|
60
|
-
|
|
61
|
-
nrp = new NRP(nrpConfig);
|
|
62
|
-
|
|
63
|
-
callback();
|
|
21
|
+
redisClientFactory.create(broadcastConfig, function(err, client) {
|
|
22
|
+
|
|
23
|
+
if (err) {
|
|
24
|
+
return callback(err);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var nrpConfig = {
|
|
28
|
+
"client": client,
|
|
29
|
+
"scope": "broadcast_cache"
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
//logger.info("using config = " + nrpConfig);
|
|
33
|
+
|
|
34
|
+
nrp = new NRP(nrpConfig);
|
|
35
|
+
nrp.connect(function(err) {
|
|
36
|
+
callback(err);
|
|
37
|
+
});
|
|
38
|
+
});
|
|
64
39
|
};
|
|
65
40
|
|
|
66
41
|
r.publish = function(topic, message, callback)
|
package/clients/nrp.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// a revision of
|
|
2
|
+
// https://raw.githubusercontent.com/louischatriot/node-redis-pubsub/master/lib/node-redis-pubsub.js
|
|
3
|
+
// that works with Redis 6+
|
|
4
|
+
|
|
5
|
+
"use strict";
|
|
6
|
+
var redis = require('redis');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Create a new NodeRedisPubsub instance that can subscribe to channels and publish messages
|
|
10
|
+
* @param {Object} options Options for the client creations:
|
|
11
|
+
* client - a connected Redis client
|
|
12
|
+
* scope - Optional, two NodeRedisPubsubs with different scopes will not share messages
|
|
13
|
+
*/
|
|
14
|
+
function NodeRedisPubsub(options)
|
|
15
|
+
{
|
|
16
|
+
if (!(this instanceof NodeRedisPubsub)){ return new NodeRedisPubsub(options); }
|
|
17
|
+
|
|
18
|
+
options || (options = {});
|
|
19
|
+
|
|
20
|
+
this.emitter = options.client.duplicate();
|
|
21
|
+
this.emitter.setMaxListeners(0);
|
|
22
|
+
this.receiver = options.client.duplicate();
|
|
23
|
+
this.receiver.setMaxListeners(0);
|
|
24
|
+
|
|
25
|
+
this.prefix = options.scope ? options.scope + ':' : '';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
NodeRedisPubsub.prototype.connect = function(callback)
|
|
29
|
+
{
|
|
30
|
+
var self = this;
|
|
31
|
+
|
|
32
|
+
(async function() {
|
|
33
|
+
await self.emitter.connect();
|
|
34
|
+
await self.receiver.connect();
|
|
35
|
+
callback();
|
|
36
|
+
})();
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Subscribe to a channel
|
|
41
|
+
* @param {String} channel The channel to subscribe to, can be a pattern e.g. 'user.*'
|
|
42
|
+
* @param {Function} handler Function to call with the received message.
|
|
43
|
+
* @param {Function} cb Optional callback to call once the handler is registered.
|
|
44
|
+
*/
|
|
45
|
+
NodeRedisPubsub.prototype.on = NodeRedisPubsub.prototype.subscribe = function(channel, handler, callback)
|
|
46
|
+
{
|
|
47
|
+
if (!callback)
|
|
48
|
+
{
|
|
49
|
+
callback = function(){};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
var self = this;
|
|
53
|
+
|
|
54
|
+
if (channel === "error")
|
|
55
|
+
{
|
|
56
|
+
self.errorHandler = handler;
|
|
57
|
+
self.emitter.on("error", handler);
|
|
58
|
+
self.receiver.on("error", handler);
|
|
59
|
+
return callback();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
var listener = function(self, handler)
|
|
63
|
+
{
|
|
64
|
+
return function(message, channel) {
|
|
65
|
+
|
|
66
|
+
var jsonmsg = message;
|
|
67
|
+
try{
|
|
68
|
+
jsonmsg = JSON.parse(message);
|
|
69
|
+
} catch (ex){
|
|
70
|
+
if(typeof self.errorHandler === 'function'){
|
|
71
|
+
return self.errorHandler("Invalid JSON received! Channel: " + self.prefix + channel + " Message: " + message);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return handler(jsonmsg, channel);
|
|
75
|
+
}
|
|
76
|
+
}(self, handler);
|
|
77
|
+
|
|
78
|
+
(async function() {
|
|
79
|
+
await self.receiver.pSubscribe(self.prefix + channel, listener);
|
|
80
|
+
})();
|
|
81
|
+
|
|
82
|
+
callback();
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Emit an event
|
|
87
|
+
* @param {String} channel Channel on which to emit the message
|
|
88
|
+
* @param {Object} message
|
|
89
|
+
*/
|
|
90
|
+
NodeRedisPubsub.prototype.emit = NodeRedisPubsub.prototype.publish = function (channel, message)
|
|
91
|
+
{
|
|
92
|
+
var self = this;
|
|
93
|
+
|
|
94
|
+
(async function() {
|
|
95
|
+
return await self.emitter.publish(self.prefix + channel, JSON.stringify(message));
|
|
96
|
+
})();
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Safely close the redis connections 'soon'
|
|
101
|
+
*/
|
|
102
|
+
NodeRedisPubsub.prototype.quit = function()
|
|
103
|
+
{
|
|
104
|
+
this.emitter.quit();
|
|
105
|
+
this.receiver.quit();
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Dangerously close the redis connections immediately
|
|
110
|
+
*/
|
|
111
|
+
NodeRedisPubsub.prototype.end = function()
|
|
112
|
+
{
|
|
113
|
+
this.emitter.end(true);
|
|
114
|
+
this.receiver.end(true);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
module.exports = NodeRedisPubsub;
|
package/clients/redis.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
//var redis = require("redis");
|
|
2
|
+
var redisHelper = require("../util/redis");
|
|
3
|
+
|
|
4
|
+
var clients = {};
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Redis client factory.
|
|
8
|
+
*
|
|
9
|
+
* @type {*}
|
|
10
|
+
*/
|
|
11
|
+
exports = module.exports = {};
|
|
12
|
+
|
|
13
|
+
var create = exports.create = function(config, baseOptions, callback)
|
|
14
|
+
{
|
|
15
|
+
if (typeof(config) === "function") {
|
|
16
|
+
callback = config;
|
|
17
|
+
config = {};
|
|
18
|
+
baseOptions = {};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (typeof(baseOptions) === "function") {
|
|
22
|
+
callback = baseOptions;
|
|
23
|
+
baseOptions = {};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (!config) {
|
|
27
|
+
config = {};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (!baseOptions) {
|
|
31
|
+
baseOptions = {};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var redisOptions = redisHelper.redisOptions(config);
|
|
35
|
+
if (baseOptions) {
|
|
36
|
+
for (var k in baseOptions) {
|
|
37
|
+
redisOptions[k] = baseOptions[k];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
var url = redisOptions.url;
|
|
42
|
+
|
|
43
|
+
// cached client?
|
|
44
|
+
var client = clients[url];
|
|
45
|
+
if (client) {
|
|
46
|
+
return callback(null, client);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// connect
|
|
50
|
+
(async function() {
|
|
51
|
+
await redisHelper.createAndConnect(redisOptions, function(err, client) {
|
|
52
|
+
|
|
53
|
+
if (err) {
|
|
54
|
+
return callback(err);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// cache it
|
|
58
|
+
clients[url] = client;
|
|
59
|
+
|
|
60
|
+
// return
|
|
61
|
+
return callback(null, client);
|
|
62
|
+
});
|
|
63
|
+
})();
|
|
64
|
+
};
|
package/cloudcms-server.iml
CHANGED