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
@@ -1,73 +0,0 @@
1
- var auth = require("../../../util/auth");
2
-
3
- var CasStrategy = require('passport-cas').Strategy;
4
- var AbstractProvider = require("./abstract");
5
-
6
- /**
7
- * "cas" Authentication Provider
8
- *
9
- * Provider-specific configuration:
10
- *
11
- * "ssoBaseURL": "http://www.example.com/",
12
- * "serverBaseURL": "http://localhost:3000",
13
- * "validateURL": <for cas 2.0>
14
- */
15
- class CasProvider extends AbstractProvider
16
- {
17
- constructor(req, config)
18
- {
19
- super(req, config);
20
-
21
- if (!config.properties) {
22
- config.properties = {};
23
- }
24
- if (!config.properties.id) {
25
- config.properties.id = "name";
26
- }
27
-
28
- // passport
29
- this.casStrategy = new CasStrategy({
30
- "ssoBaseURL": config.ssoBaseURL,
31
- "serverBaseURL": config.serverBaseURL,
32
- "validateURL": config.validateURL,
33
- "passReqToCallback": true
34
- }, auth.buildPassportCallback(config, this));
35
-
36
- req.passport.use(this.casStrategy);
37
- };
38
-
39
- /**
40
- * @override
41
- */
42
- handleAuth(req, res, next)
43
- {
44
- req.passport.authenticate("cas")(req, res, next);
45
- };
46
-
47
- /**
48
- * @override
49
- */
50
- handleAuthCallback(req, res, next, cb)
51
- {
52
- req.passport.authenticate("cas", {
53
- session: false
54
- }, cb)(req, res, next);
55
- };
56
-
57
- /**
58
- * @override
59
- */
60
- load(properties, callback)
61
- {
62
- this.casStrategy.userProfile(properties.token, function(err, profile) {
63
-
64
- if (err) {
65
- return callback(err);
66
- }
67
-
68
- callback(null, profile);
69
- });
70
- };
71
- }
72
-
73
- module.exports = CasProvider;
@@ -1,120 +0,0 @@
1
- var auth = require("../../../util/auth");
2
-
3
- var FacebookStrategy = require('passport-facebook').Strategy;
4
- var AbstractProvider = require("./abstract");
5
-
6
- if (!process.configuration) {
7
- process.configuration = {};
8
- }
9
- if (!process.configuration.providers) {
10
- process.configuration.providers = {};
11
- }
12
- if (!process.configuration.providers.facebook) {
13
- process.configuration.providers.facebook = {};
14
- }
15
- if (process.env.CLOUDCMS_AUTH_PROVIDERS_FACEBOOK_ENABLED === "true") {
16
- process.configuration.providers.facebook.enabled = true;
17
- }
18
-
19
- /**
20
- * "facebook" Authentication Provider
21
- *
22
- * Provider-specific configuration:
23
- *
24
- * "appId": "Application ID",
25
- * "appSecret": "Application secret",
26
- *
27
- */
28
- class FacebookProvider extends AbstractProvider
29
- {
30
- constructor(req, config)
31
- {
32
- super(req, config);
33
-
34
- if (!config.properties) {
35
- config.properties = {};
36
- }
37
- if (!config.properties.id) {
38
- config.properties.id = "id";
39
- }
40
-
41
- // passport
42
- this.facebookStrategy = new FacebookStrategy({
43
- clientID: config.appId,
44
- clientSecret: config.appSecret,
45
- callbackURL: config.callbackURL,
46
- passReqToCallback: true
47
- }, auth.buildPassportCallback(config, this));
48
-
49
- req.passport.use(this.facebookStrategy);
50
- }
51
-
52
- /**
53
- * @override
54
- */
55
- handleAuth(req, res, next)
56
- {
57
- req.passport.authenticate("facebook")(req, res, next);
58
- };
59
-
60
- /**
61
- * @override
62
- */
63
- handleAuthCallback(req, res, next, cb)
64
- {
65
- req.passport.authenticate("facebook", {
66
- session: false
67
- }, cb)(req, res, next);
68
- };
69
-
70
- /**
71
- * @override
72
- */
73
- parseProfile(req, profile, callback)
74
- {
75
- super.parseProfile(req, profile, function(err, userObject, groupsArray, mandatoryGroupsArray) {
76
-
77
- if (err) {
78
- return callback(err);
79
- }
80
-
81
- var name = profile.displayName;
82
- if (profile._json && profile._json.name)
83
- {
84
- name = profile._json.name;
85
- }
86
- if (name)
87
- {
88
- var x = name.split(" ");
89
- if (x.length == 2)
90
- {
91
- userObject.firstName = x[0];
92
- userObject.lastName = x[1];
93
- }
94
- }
95
-
96
- userObject.facebookId = profile.id;
97
-
98
- callback(null, userObject, groupsArray, mandatoryGroupsArray);
99
- });
100
- };
101
-
102
- /**
103
- * @override
104
- */
105
- load(properties, callback)
106
- {
107
- this.facebookStrategy.userProfile(properties.token, function(err, profile) {
108
-
109
- if (err) {
110
- return callback(err);
111
- }
112
-
113
- callback(null, profile);
114
- });
115
- };
116
-
117
-
118
- }
119
-
120
- module.exports = FacebookProvider;
@@ -1,88 +0,0 @@
1
- var auth = require("../../../util/auth");
2
-
3
- var GithubStrategy = require('passport-github').Strategy;
4
- var AbstractProvider = require("./abstract");
5
-
6
- if (!process.configuration) {
7
- process.configuration = {};
8
- }
9
- if (!process.configuration.providers) {
10
- process.configuration.providers = {};
11
- }
12
- if (!process.configuration.providers.github) {
13
- process.configuration.providers.github = {};
14
- }
15
- if (process.env.CLOUDCMS_AUTH_PROVIDERS_GITHUB_ENABLED === "true") {
16
- process.configuration.providers.github.enabled = true;
17
- }
18
-
19
- /**
20
- * "github" Authentication Provider
21
- *
22
- * Provider-specific configuration:
23
- *
24
- * "clientID": "[OAuth2 Client ID]",
25
- * "clientSecret": "[OAuth2 Client Secret]",
26
- *
27
- */
28
- class GithubProvider extends AbstractProvider
29
- {
30
- constructor(req, config)
31
- {
32
- super(req, config);
33
-
34
- if (!config.properties) {
35
- config.properties = {};
36
- }
37
- if (!config.properties.id) {
38
- config.properties.id = "id";
39
- }
40
-
41
- // passport
42
- this.githubStrategy = new GithubStrategy({
43
- clientID: config.clientID,
44
- clientSecret: config.clientSecret,
45
- callbackURL: config.callbackURL,
46
- passReqToCallback: true
47
- }, auth.buildPassportCallback(config, this));
48
-
49
- req.passport.use(this.githubStrategy);
50
- }
51
-
52
- /**
53
- * @override
54
- */
55
- handleAuth(req, res, next)
56
- {
57
- req.passport.authenticate("github",{
58
- scope: ['user']
59
- })(req, res, next);
60
- };
61
-
62
- /**
63
- * @override
64
- */
65
- handleAuthCallback(req, res, next, cb)
66
- {
67
- req.passport.authenticate("github", {
68
- session: false
69
- }, cb)(req, res, next);
70
- };
71
-
72
- /**
73
- * @override
74
- */
75
- load(properties, callback)
76
- {
77
- this.githubStrategy.userProfile(properties.token, function(err, profile) {
78
-
79
- if (err) {
80
- return callback(err);
81
- }
82
-
83
- callback(null, profile);
84
- });
85
- };
86
- }
87
-
88
- module.exports = GithubProvider;
@@ -1,112 +0,0 @@
1
- var auth = require("../../../util/auth");
2
-
3
- var LinkedInStrategy = require('passport-linkedin').Strategy;
4
- var AbstractProvider = require("./abstract");
5
-
6
- if (!process.configuration) {
7
- process.configuration = {};
8
- }
9
- if (!process.configuration.providers) {
10
- process.configuration.providers = {};
11
- }
12
- if (!process.configuration.providers.linkedin) {
13
- process.configuration.providers.linkedin = {};
14
- }
15
- if (process.env.CLOUDCMS_AUTH_PROVIDERS_LINKEDIN_ENABLED === "true") {
16
- process.configuration.providers.linkedin.enabled = true;
17
- }
18
-
19
- /**
20
- * "linkedin" Authentication Provider
21
- *
22
- * Provider-specific configuration:
23
- *
24
- * "apiKey": "",
25
- * "apiSecret": "",
26
- *
27
- * @return {Function}
28
- */
29
- class LinkedInProvider extends AbstractProvider
30
- {
31
- constructor(req, config)
32
- {
33
- super(req, config);
34
-
35
- if (!config.properties) {
36
- config.properties = {};
37
- }
38
- if (!config.properties.id) {
39
- config.properties.id = "id";
40
- }
41
-
42
- this.linkedinStrategy = new LinkedInStrategy({
43
- consumerKey: config.apiKey,
44
- consumerSecret: config.apiSecret,
45
- callbackURL: config.callbackURL,
46
- passReqToCallback: true
47
- }, auth.buildPassportCallback(config, provider));
48
-
49
- req.passport.use(this.linkedinStrategy);
50
- }
51
-
52
- /**
53
- * @override
54
- */
55
- handleAuth(req, res, next)
56
- {
57
- req.passport.authenticate("linkedin")(req, res, next);
58
- };
59
-
60
- /**
61
- * @override
62
- */
63
- handleAuthCallback(req, res, next, cb)
64
- {
65
- req.passport.authenticate("linkedin", {
66
- session: false
67
- }, cb)(req, res, next);
68
- };
69
-
70
- /**
71
- * @override
72
- */
73
- parseProfile(req, profile, callback)
74
- {
75
- super.parseProfile(req, profile, function(err, userObject, groupsArray, mandatoryGroupsArray) {
76
-
77
- if (err) {
78
- return callback(err);
79
- }
80
-
81
- if (!userObject.firstName)
82
- {
83
- userObject.firstName = profile._json.firstName;
84
- }
85
-
86
- if (!userObject.lastName)
87
- {
88
- userObject.lastName = profile._json.lastName;
89
- }
90
-
91
- callback(null, userObject, groupsArray, mandatoryGroupsArray);
92
- });
93
- };
94
-
95
- /**
96
- * @override
97
- */
98
- load(properties, callback)
99
- {
100
- this.linkedinStrategy.userProfile(properties.token, function(err, profile) {
101
-
102
- if (err) {
103
- return callback(err);
104
- }
105
-
106
- callback(null, profile);
107
-
108
- });
109
- };
110
- }
111
-
112
- module.exports = LinkedInProvider;
@@ -1,120 +0,0 @@
1
- var auth = require("../../../util/auth");
2
-
3
- var TwitterStrategy = require('passport-twitter').Strategy;
4
- var AbstractProvider = require("./abstract");
5
-
6
- if (!process.configuration) {
7
- process.configuration = {};
8
- }
9
- if (!process.configuration.providers) {
10
- process.configuration.providers = {};
11
- }
12
- if (!process.configuration.providers.twitter) {
13
- process.configuration.providers.twitter = {};
14
- }
15
- if (process.env.CLOUDCMS_AUTH_PROVIDERS_TWITTER_ENABLED === "true") {
16
- process.configuration.providers.twitter.enabled = true;
17
- }
18
-
19
- /**
20
- * "twitter" Authentication Provider
21
- *
22
- * Provider-specific configuration:
23
- *
24
- * "consumerKey": "",
25
- * "consumerSecret": ""
26
- *
27
- * @return {Function}
28
- */
29
- class TwitterProvider extends AbstractProvider
30
- {
31
- constructor(req, config)
32
- {
33
- super(req, config);
34
-
35
- if (!config.properties) {
36
- config.properties = {};
37
- }
38
- if (!config.properties.id) {
39
- config.properties.id = "id";
40
- }
41
-
42
- // passport
43
- this.twitterStrategy = new TwitterStrategy({
44
- consumerKey: config.consumerKey,
45
- consumerSecret: config.consumerSecret,
46
- callbackURL: config.callbackURL,
47
- passReqToCallback: true
48
- }, auth.buildPassportCallback(config, provider));
49
-
50
- req.passport.use(this.twitterStrategy);
51
- }
52
-
53
- /**
54
- * @override
55
- */
56
- handleAuth(req, res, next)
57
- {
58
- req.passport.authenticate("twitter")(req, res, next);
59
- };
60
-
61
- /**
62
- * @override
63
- */
64
- handleAuthCallback(req, res, next, cb)
65
- {
66
- req.passport.authenticate("twitter", {
67
- session: false
68
- }, cb)(req, res, next);
69
- };
70
-
71
- /**
72
- * @override
73
- */
74
- parseProfile(req, profile, callback)
75
- {
76
- super.parseProfile(req, profile, function(err, userObject, groupsArray, mandatoryGroupsArray) {
77
- return callback(err, userObject, groupsArray, mandatoryGroupsArray);
78
- });
79
- };
80
-
81
- /**
82
- * @override
83
- */
84
- syncAvatar(gitanaUser, profile, callback)
85
- {
86
- // sync avatar photo
87
- if (profile && profile.photos && profile.photos.length > 0)
88
- {
89
- // use the 0th one as the avatar
90
- var photoUrl = profile.photos[0].value;
91
-
92
- // download and attach to user
93
- auth.syncAttachment(gitanaUser, "avatar", photoUrl, function(err) {
94
- callback(err);
95
- });
96
-
97
- return;
98
- }
99
-
100
- callback();
101
- };
102
-
103
- /**
104
- * @override
105
- */
106
- load(properties, callback)
107
- {
108
- this.twitterStrategy.userProfile(properties.token, function(err, profile) {
109
-
110
- if (err) {
111
- return callback(err);
112
- }
113
-
114
- callback(null, profile);
115
-
116
- });
117
- };
118
- }
119
-
120
- module.exports = TwitterProvider;
@@ -1,113 +0,0 @@
1
- var path = require('path');
2
- var fs = require('fs');
3
- var http = require('http');
4
-
5
- var util = require("../../util/util");
6
-
7
- var duster = require("../../duster/index");
8
-
9
-
10
- /**
11
- * Server Tags Middleware.
12
- *
13
- * Performs variable and token substitution on some text files that find themselves being served.
14
- * This includes any HTML file and the gitana.js driver.
15
- */
16
- exports = module.exports = function()
17
- {
18
- //////////////////////////////////////////////////////////////////////////////////////////////////////////////
19
- //
20
- // RESULTING OBJECT
21
- //
22
- //////////////////////////////////////////////////////////////////////////////////////////////////////////////
23
-
24
- var r = {};
25
-
26
- r.interceptor = function()
27
- {
28
- return util.createInterceptor("serverTags", function(req, res, next, stores, cache, configuration) {
29
-
30
- var webStore = stores.web;
31
-
32
- var doParse = false;
33
- if (req.path.indexOf(".html") !== -1)
34
- {
35
- doParse = true;
36
- }
37
-
38
- if (doParse)
39
- {
40
- if (!req.model) {
41
- req.model = {};
42
- }
43
-
44
- wrapWithDustParser(webStore, req, res, next);
45
-
46
- return next();
47
- }
48
-
49
- // otherwise, we don't bother
50
- next();
51
- });
52
- };
53
-
54
- var wrapWithDustParser = function(webStore, req, res, next)
55
- {
56
- var _sendFile = res.sendFile;
57
- var _send = res.send;
58
- var _status = res.status;
59
-
60
- res.sendFile = function(filePath, options, fn)
61
- {
62
- // path to the html file
63
- var fullFilePath = filePath;
64
- if (options.root) {
65
- fullFilePath = path.join(options.root, fullFilePath);
66
- }
67
-
68
- var rebasedPath = webStore.pathWithinStore(filePath);
69
- if (rebasedPath)
70
- {
71
- fullFilePath = rebasedPath;
72
- }
73
-
74
- // read the file
75
- webStore.readFile(fullFilePath, function(err, text) {
76
-
77
- if (!text)
78
- {
79
- return _sendFile.call(res, filePath, options, fn);
80
- }
81
-
82
- text = text.toString();
83
-
84
- var z = text.indexOf("{@");
85
- if (z === -1)
86
- {
87
- return _sendFile.call(res, filePath, options, fn);
88
- }
89
-
90
- var model = req.model;
91
- if (!model) {
92
- model = {};
93
- }
94
-
95
- duster.execute(req, webStore, fullFilePath, model, function (err, text) {
96
-
97
- if (err)
98
- {
99
- // propagate error out to error page
100
- return next(err);
101
- }
102
-
103
- _status.call(res, 200);
104
- _send.call(res, text);
105
- });
106
-
107
- });
108
- };
109
- };
110
-
111
- return r;
112
- }();
113
-