cloudcms-server 4.0.0-beta.2 → 4.0.0-beta.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +0 -5
  2. package/cloudcms-server.iml +1 -0
  3. package/index.js +58 -32
  4. package/middleware/authentication/authentication.js +40 -12
  5. package/middleware/authentication/providers/saml.js +8 -4
  6. package/middleware/awareness/awareness.js +8 -7
  7. package/middleware/awareness/plugins/api_event.js +105 -0
  8. package/middleware/awareness/plugins/editorial.js +54 -3
  9. package/middleware/awareness/plugins/resources.js +13 -5
  10. package/middleware/config/adapter.js +0 -44
  11. package/middleware/deployment/deployment.js +22 -24
  12. package/middleware/driver/driver.js +24 -1
  13. package/middleware/driver-config/driver-config.js +0 -6
  14. package/middleware/modules/modules.js +11 -5
  15. package/middleware/perf/perf.js +3 -2
  16. package/middleware/registration/registration.js +0 -5
  17. package/middleware/stores/engines/empty.js +0 -4
  18. package/middleware/stores/engines/fs-caching-adapter.js +0 -5
  19. package/middleware/stores/engines/fs.js +0 -9
  20. package/middleware/stores/engines/s3.js +0 -5
  21. package/middleware/stores/engines/s3fs.js +0 -5
  22. package/middleware/stores/multistore.js +0 -29
  23. package/middleware/stores/store.js +0 -10
  24. package/middleware/stores/stores.js +2 -2
  25. package/middleware/virtual-config/virtual-config.js +253 -206
  26. package/middleware/virtual-files/virtual-files.js +0 -3
  27. package/middleware/welcome/welcome.js +0 -3
  28. package/notifications/notifications.js +72 -10
  29. package/notifications/providers/kafka.js +182 -0
  30. package/notifications/providers/stomp.js +4 -0
  31. package/package.json +40 -56
  32. package/server/index.js +216 -123
  33. package/server/standalone.js +1 -6
  34. package/util/auth.js +10 -4
  35. package/util/cloudcms.js +77 -35
  36. package/util/loaders.js +113 -0
  37. package/util/proxy-factory.js +143 -168
  38. package/util/request.js +6 -2
  39. package/util/workqueue.js +111 -0
  40. package/.last_command +0 -7
  41. package/duster/helpers/core/cloudcms/associations.js +0 -34
  42. package/duster/helpers/core/cloudcms/beta/markdown.js +0 -46
  43. package/duster/helpers/core/cloudcms/beta/nodeAttachmentText.js +0 -46
  44. package/duster/helpers/core/cloudcms/beta/params.js +0 -33
  45. package/duster/helpers/core/cloudcms/beta/processTemplate.js +0 -82
  46. package/duster/helpers/core/cloudcms/content.js +0 -34
  47. package/duster/helpers/core/cloudcms/expand.js +0 -38
  48. package/duster/helpers/core/cloudcms/form.js +0 -34
  49. package/duster/helpers/core/cloudcms/query.js +0 -34
  50. package/duster/helpers/core/cloudcms/queryOne.js +0 -34
  51. package/duster/helpers/core/cloudcms/relatives.js +0 -34
  52. package/duster/helpers/core/cloudcms/search.js +0 -34
  53. package/duster/helpers/core/cloudcms/searchOne.js +0 -34
  54. package/duster/helpers/core/cloudcms/wcm/dependency.js +0 -83
  55. package/duster/helpers/core/cloudcms/wcm/fragment.js +0 -34
  56. package/duster/helpers/core/dev/debug.js +0 -42
  57. package/duster/helpers/core/dom/block.js +0 -49
  58. package/duster/helpers/core/dom/include.js +0 -38
  59. package/duster/helpers/core/dom/layout.js +0 -49
  60. package/duster/helpers/core/dom/link.js +0 -81
  61. package/duster/helpers/core/dom/resource.js +0 -77
  62. package/duster/helpers/core/engine.js +0 -1580
  63. package/duster/helpers/core/ice/value.js +0 -65
  64. package/duster/helpers/core/index.js +0 -49
  65. package/duster/helpers/core/operators/if.js +0 -64
  66. package/duster/helpers/core/operators/iter.js +0 -45
  67. package/duster/helpers/core/operators/iterate.js +0 -129
  68. package/duster/helpers/sample/nyt.js +0 -114
  69. package/duster/index.js +0 -319
  70. package/duster/support.js +0 -436
  71. package/duster/tracker.js +0 -262
  72. package/middleware/authentication/providers/cas.js +0 -73
  73. package/middleware/authentication/providers/facebook.js +0 -120
  74. package/middleware/authentication/providers/github.js +0 -88
  75. package/middleware/authentication/providers/linkedin.js +0 -112
  76. package/middleware/authentication/providers/twitter.js +0 -120
  77. package/middleware/server-tags/server-tags.js +0 -113
  78. package/middleware/wcm/wcm.js +0 -1437
@@ -72,11 +72,11 @@ var handleNotificationMessages = function(items, callback) {
72
72
  var fns = [];
73
73
  for (var i = 0; i < items.length; i++)
74
74
  {
75
- var fn = function(item, i) {
75
+ var fn = function(item, index) {
76
76
  return function(done) {
77
77
 
78
78
  //logFn("WORKING ON ITEM: " + i + ", item: " + JSON.stringify(item, null, " "));
79
- console.log("WORKING ON ITEM: " + i + ", item: " + JSON.stringify(item, null, " "));
79
+ console.log("WORKING ON ITEM: " + index + ", item: " + JSON.stringify(item, null, " "));
80
80
 
81
81
  var operation = item.operation;
82
82
 
@@ -540,6 +540,8 @@ var handleNotificationMessages = function(items, callback) {
540
540
 
541
541
  var host = determineHost(item);
542
542
 
543
+ var _fns = [];
544
+
543
545
  var deployments = item.deployments;
544
546
  if (deployments && deployments.length > 0)
545
547
  {
@@ -554,17 +556,77 @@ var handleNotificationMessages = function(items, callback) {
554
556
  "host": host,
555
557
  "deployment": deployment
556
558
  };
557
-
558
- // broadcast event
559
- process.broadcast.publish("deployment_synced", message, function(err) {
560
- if (err) {
561
- logInfo("published deployment_synced message. err:" + err + "\nmessage: " + JSON.stringify(message,null,2));
559
+
560
+ var _fn = function(message) {
561
+ return function(d) {
562
+ // broadcast event
563
+ process.broadcast.publish("deployment_synced", message, function(err) {
564
+ if (err) {
565
+ logInfo("published deployment_synced message. err:" + err + "\nmessage: " + JSON.stringify(message,null,2));
566
+ }
567
+ return done(err);
568
+ });
562
569
  }
563
- return done(err);
564
- });
565
-
570
+ }(message);
571
+ _fns.push(_fn);
566
572
  }
567
573
  }
574
+
575
+ async.parallelLimit(_fns, 4, function(err) {
576
+ done(err);
577
+ });
578
+ }
579
+ else if (operation === "api_event")
580
+ {
581
+ var eventType = item.type;
582
+ var eventId = item.id;
583
+ var objects = item.objects;
584
+
585
+ var host = determineHost(item);
586
+
587
+ var _fns = [];
588
+ if (objects && objects.length > 0)
589
+ {
590
+ for (var z = 0; z < objects.length; z++)
591
+ {
592
+ var object = objects[z];
593
+
594
+ var applicationId = object.applicationId;
595
+ var deploymentKey = item.deploymentKey;
596
+
597
+ var objectType = object.type; // sidekickMessage
598
+ var objectId = object.id;
599
+ var objectRef = object.ref;
600
+
601
+ var publishMessage = {
602
+ "applicationId": applicationId,
603
+ "deploymentKey": deploymentKey,
604
+ "host": host,
605
+ "eventType": eventType,
606
+ "eventId": eventId,
607
+ "objectType": objectType,
608
+ "objectId": objectId,
609
+ "objectRef": objectRef,
610
+ "object": object.object
611
+ };
612
+
613
+ var _fn = function(publishMessage) {
614
+ return function(d) {
615
+ // broadcast event
616
+ process.broadcast.publish("api_event", publishMessage, function(err) {
617
+ if (err) {
618
+ logInfo("published api_event message. err:" + err + "\nmessage: " + JSON.stringify(publishMessage,null,2));
619
+ }
620
+ return d(err);
621
+ });
622
+ }
623
+ }(publishMessage);
624
+ _fns.push(_fn);
625
+ }
626
+ }
627
+ async.parallelLimit(_fns, 4, function(err) {
628
+ done(err);
629
+ });
568
630
  }
569
631
  else
570
632
  {
@@ -0,0 +1,182 @@
1
+ const { Kafka } = require("kafkajs");
2
+ const util = require("../../util/util");
3
+
4
+ var holder = {};
5
+
6
+ module.exports = {};
7
+ module.exports.start = function(configuration, callback)
8
+ {
9
+ // clientId
10
+ if (!configuration.clientId)
11
+ {
12
+ if (process.env.CLOUDCMS_NOTIFICATIONS_KAFKA_CLIENT_ID)
13
+ {
14
+ configuration.clientId = process.env.CLOUDCMS_NOTIFICATIONS_KAFKA_CLIENT_ID;
15
+ }
16
+ }
17
+ if (!configuration.clientId)
18
+ {
19
+ configuration.clientId = "cloudcms-ui-kafka-notifications-client";
20
+ }
21
+
22
+ // topic
23
+ if (!configuration.topic)
24
+ {
25
+ if (process.env.CLOUDCMS_NOTIFICATIONS_KAFKA_TOPIC)
26
+ {
27
+ configuration.topic = process.env.CLOUDCMS_NOTIFICATIONS_KAFKA_TOPIC;
28
+ }
29
+ }
30
+ if (!configuration.topic)
31
+ {
32
+ configuration.topic = "cloudcms.ui.topic";
33
+ }
34
+
35
+ // group
36
+ if (!configuration.group)
37
+ {
38
+ if (process.env.CLOUDCMS_NOTIFICATIONS_KAFKA_GROUP)
39
+ {
40
+ configuration.group = process.env.CLOUDCMS_NOTIFICATIONS_KAFKA_GROUP;
41
+ }
42
+ }
43
+ if (!configuration.group) {
44
+ configuration.group = "cloudcms-ui-kafka-notifications-group";
45
+ }
46
+
47
+ // brokers
48
+ if (!configuration.brokers)
49
+ {
50
+ if (process.env.CLOUDCMS_NOTIFICATIONS_KAFKA_BROKERS)
51
+ {
52
+ configuration.brokers = process.env.CLOUDCMS_NOTIFICATIONS_KAFKA_BROKERS;
53
+ }
54
+ }
55
+
56
+ var clientId = configuration.clientId;
57
+ var brokers = configuration.brokers.split(",");
58
+ var topic = configuration.topic;
59
+ var group = configuration.group;
60
+
61
+ process.log("Connecting to kafka, client ID: " + clientId + ", brokers: " + brokers + ", topic: " + topic + ", group: " + group);
62
+
63
+ if (holder.consumer)
64
+ {
65
+ return callback();
66
+ }
67
+
68
+ // console.log("a1");
69
+ var kafka = new Kafka({
70
+ clientId: clientId,
71
+ brokers: brokers
72
+ });
73
+ // console.log("a2: " + kafka);
74
+ // console.log("a3: " + kafka.consumer);
75
+
76
+ var consumer = holder.consumer = kafka.consumer({ groupId: group });
77
+
78
+ // connect
79
+ (async function() {
80
+ await consumer.connect()
81
+ }());
82
+
83
+ (async function() {
84
+ await consumer.subscribe({topic: topic, fromBeginning: true})
85
+ }());
86
+
87
+ callback();
88
+ };
89
+
90
+ module.exports.process = function(callback)
91
+ {
92
+ var consumer = holder.consumer;
93
+ if (!consumer)
94
+ {
95
+ return callback();
96
+ }
97
+
98
+ (async function() {
99
+ await consumer.run({
100
+ eachMessage: async ({ topic, partition, message, heartbeat, pause }) => {
101
+ handleMessage(topic, partition, message, heartbeat, pause, callback);
102
+ }
103
+ });
104
+ }());
105
+ };
106
+
107
+ var handleMessage = function(topic, partition, messageObject, heartbeat, pause, callback)
108
+ {
109
+ // console.log("Topic: " + topic);
110
+ // console.log("Partition: " + partition);
111
+ // console.log("Message: " + JSON.stringify(messageObject, null, 2));
112
+
113
+ if (!messageObject || !messageObject.value)
114
+ {
115
+ return;
116
+ }
117
+
118
+ //var key = message.key.toString();
119
+ var valueString = messageObject.value.toString();
120
+ var headers = messageObject.headers || {};
121
+
122
+ var json = null;
123
+ if (valueString) {
124
+ json = JSON.parse("" + valueString);
125
+ }
126
+
127
+ // console.log("b1: " + valueString);
128
+ // console.log("b2: " + data);
129
+
130
+ if (json)
131
+ {
132
+ console.log("JSON: " + JSON.stringify(json));
133
+ console.log("HEADERS: " + JSON.stringify(headers));
134
+
135
+ /**
136
+ * kafka1-ui-1 | VAL: {"subject":"invalidate_objects:aea334cb8accb0bd698e","message":"","data":"{\"operation\":\"invalidate_objects\",\"invalidations\":[{\"applicationId\":\"1785c4b13f74b3aa4b31\",\"ref\":\"application://826a3ebefe4c1e006a60/1785c4b13f74b3aa4b31\",\"id\":\"1785c4b13f74b3aa4b31\",\"type\":\"application\",\"stackId\":\"a17879ca0923f6d9696b\",\"stackMembers\":{\"archives\":{\"typeId\":\"vault\",\"id\":\"385e37eb07bc3d16dca1\"},\"console\":{\"typeId\":\"application\",\"id\":\"1785c4b13f74b3aa4b31\"},\"content\":{\"typeId\":\"repository\",\"id\":\"9904550a6b2a2a71f015\"},\"hosting\":{\"typeId\":\"webhost\",\"id\":\"5d2db66ced26608dc355\"},\"oneteam\":{\"typeId\":\"application\",\"id\":\"8d5ba57420ce31a3172c\"},\"principals\":{\"typeId\":\"domain\",\"id\":\"32cbffafe9f2de4d1b9a\"},\"root\":{\"typeId\":\"directory\",\"id\":\"6db38348323d001c2c10\"}}}]}"}
137
+ * kafka1-ui-1 | HEADERS: [object Object]
138
+ * @type {*[]}
139
+ */
140
+
141
+ var subject = json.subject;
142
+ var message = json.message;
143
+
144
+ // build out the notification message items
145
+ var items = [];
146
+
147
+ if (json.data)
148
+ {
149
+ var data = JSON.parse("" + json.data);
150
+
151
+ // timestamp from headers
152
+ //var timestamp = parseInt(headers.timestamp);
153
+ var timestamp = new Date().getTime();
154
+
155
+ // copy data as item
156
+ var item = util.clone(data, true);
157
+ if (!item)
158
+ {
159
+ item = {};
160
+ }
161
+
162
+ // other properties
163
+ item.timestamp = timestamp;
164
+ item.sentTimestamp = timestamp;
165
+ item.subject = subject;
166
+
167
+ // raw message
168
+ item.rawMessage = json.data; // string
169
+
170
+ items.push(item);
171
+
172
+ //console.log("ITEM: " + JSON.stringify(item));
173
+ }
174
+ }
175
+
176
+ // call back to notifications engine to process these items
177
+ // when they're done processing, our callback is fired so that we can handle deletes and things
178
+ // we call the done() method when we're finished
179
+ callback(null, items, function(err, items, done) {
180
+ done(err, items, items);
181
+ });
182
+ };
@@ -63,6 +63,7 @@ module.exports.start = function(configuration, callback)
63
63
  var MessageConsumer = function MessageConsumer() { };
64
64
  MessageConsumer.prototype.init = function init(done) {
65
65
  console.log("STOMP client initializing to host: " + host + ", port: " + port);
66
+ var self = this;
66
67
  var stompClient = new Stomp({
67
68
  "host": host,
68
69
  "port": port,
@@ -85,6 +86,9 @@ module.exports.start = function(configuration, callback)
85
86
  });
86
87
 
87
88
  done();
89
+ }, function(err) {
90
+ console.error("STOMP Error: " + err);
91
+ done(err);
88
92
  });
89
93
  };
90
94
  holder.consumer = new MessageConsumer();
package/package.json CHANGED
@@ -1,107 +1,91 @@
1
1
  {
2
2
  "author": {
3
3
  "name": "Gitana Software, Inc.",
4
- "email": "info@cloudcms.com",
5
- "url": "https://www.cloudcms.com"
4
+ "email": "info@gitana.io",
5
+ "url": "https://gitana.io"
6
6
  },
7
7
  "name": "cloudcms-server",
8
8
  "description": "Cloud CMS Application Server Module",
9
- "version": "4.0.0-beta.2",
9
+ "version": "4.0.0-beta.21",
10
10
  "repository": {
11
11
  "type": "git",
12
12
  "url": "git://github.com/gitana/cloudcms-server.git"
13
13
  },
14
14
  "dependencies": {
15
- "@socket.io/cluster-adapter": "^0.2.0",
16
- "@socket.io/redis-adapter": "^7.2.0",
17
- "@socket.io/sticky": "^1.0.1",
15
+ "@socket.io/cluster-adapter": "^0.2.2",
16
+ "@socket.io/redis-adapter": "^8.3.0",
17
+ "@socket.io/sticky": "^1.0.4",
18
18
  "accepts": "^1.3.8",
19
- "agentkeepalive": "^4.2.1",
19
+ "agentkeepalive": "^4.5.0",
20
20
  "alpaca": "^1.5.27",
21
- "archiver": "^5.1.0",
22
- "async": "^3.2.3",
23
- "async-lock": "^1.3.2",
24
- "aws-sdk": "^2.1208.0",
25
- "axios": "^0.21.0",
21
+ "archiver": "^7.0.1",
22
+ "async": "^3.2.6",
23
+ "async-lock": "^1.4.1",
24
+ "aws-sdk": "^2.1692.0",
25
+ "axios": "^1.7.9",
26
26
  "basic-auth": "^2.0.1",
27
- "body-parser": "^1.20.0",
28
- "bytes": "^3.1.0",
27
+ "body-parser": "^1.20.3",
28
+ "bytes": "^3.1.2",
29
+ "cacheable-lookup": "^6.1.0",
29
30
  "canoe": "^0.3.3",
30
31
  "clone": "^2.1.2",
31
32
  "connect-flash": "^0.1.1",
32
33
  "connect-multiparty": "^2.2.0",
33
- "connect-redis": "^6.1.3",
34
- "consolidate": "^0.16.0",
34
+ "connect-redis": "^8.0.1",
35
35
  "cookie-parser": "^1.4.5",
36
36
  "debug": "^4.3.1",
37
- "dustjs-helpers": "^1.7.4",
38
- "dustjs-linkedin": "^3.0.1",
39
37
  "errorhandler": "^1.5.1",
40
- "express": "^4.18.1",
41
- "express-session": "^1.17.3",
38
+ "express": "^4.21.2",
39
+ "express-session": "^1.18.1",
42
40
  "express-useragent": "^1.0.15",
43
- "extend-with-super": "^2.0.0",
44
- "finalhandler": "^1.2.0",
45
- "form-data": "^2.3.3",
46
- "gitana": "^1.0.322",
47
- "handlebars": "^4.7.6",
48
- "hbs": "^4.1.1",
49
- "helmet": "^4.6.0",
50
- "http2-proxy": "^5.0.53",
51
- "ioredis": "4.28.5",
52
- "json5": "^2.1.3",
53
- "jsonwebtoken": "^8.5.1",
54
- "klaw": "^3.0.0",
55
- "lru-cache": "^6.0.0",
56
- "marked": "^4.0.14",
41
+ "fast-proxy": "^2.2.0",
42
+ "gitana": "^1.0.331",
43
+ "handlebars": "^4.7.8",
44
+ "hbs": "^4.2.0",
45
+ "helmet": "^8.0.0",
46
+ "ioredis": "5.4.1",
47
+ "json5": "^2.2.3",
48
+ "jsonwebtoken": "^9.0.2",
49
+ "kafkajs": "^2.2.4",
50
+ "klaw": "^4.1.0",
51
+ "lru-cache": "^7.14.0",
52
+ "marked": "^15.0.4",
57
53
  "memored": "^1.1.1",
58
54
  "memorystore": "^1.6.4",
59
55
  "mime": "^2.4.6",
60
- "mkdirp": "^0.5.1",
61
- "moment": "^2.29.1",
56
+ "moment": "^2.30.1",
62
57
  "morgan": "^1.10.0",
63
- "object-hash": "^2.0.3",
58
+ "object-hash": "^3.0.0",
64
59
  "object-merge": "^2.5.1",
65
60
  "on-headers": "^1.0.2",
66
- "passport": "^0.4.1",
67
- "passport-cas": "^0.1.1",
68
- "passport-facebook": "^3.0.0",
69
- "passport-github": "^1.1.0",
61
+ "passport": "^0.7.0",
70
62
  "passport-google-oauth": "^2.0.0",
71
- "passport-linkedin": "^1.0.0",
72
63
  "passport-local": "^1.0.0",
73
64
  "passport-oauth": "^1.0.0",
74
- "passport-saml": "^2.2.0",
75
- "passport-twitter": "^0.1.5",
65
+ "@node-saml/passport-saml": "5.0.0",
76
66
  "pkginfo": "^0.4.1",
77
67
  "random-js": "^2.1.0",
78
- "recursive-readdir": "^2.2.2",
79
- "redis": "^4.2.0",
68
+ "recursive-readdir": "^2.2.3",
69
+ "redis": "^4.7.0",
80
70
  "redlock": "4.2.0",
81
71
  "request-param": "^1.0.1",
82
- "response-time": "^2.3.2",
83
- "semver": "^7.3.7",
72
+ "response-time": "^2.3.3",
73
+ "semver": "^7.6.3",
84
74
  "serve-favicon": "^2.5.0",
85
75
  "session-file-store": "^1.5.0",
86
76
  "sha1": "^1.1.1",
87
- "socket.io": "^4.5.1",
77
+ "socket.io": "^4.8.1",
88
78
  "ssl-root-cas": "^1.3.1",
89
79
  "stomp-client": "^0.9.0",
90
80
  "targz": "^1.0.1",
91
81
  "temp": "^0.9.4",
92
- "uuid": "^8.3.2",
93
- "vm2": "^3.9.2",
94
- "watch": "^0.13.0",
82
+ "uuid": "^11.0.3",
95
83
  "winston": "^3.3.3"
96
84
  },
97
85
  "contributors": [
98
86
  {
99
87
  "name": "Michael Uzquiano",
100
88
  "email": "uzi@cloudcms.com"
101
- },
102
- {
103
- "name": "Harry Moore",
104
- "email": "harry.moore@cloudcms.com"
105
89
  }
106
90
  ],
107
91
  "keywords": [