cloudcms-server 3.3.1-beta.9 → 4.0.0-beta.2
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/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 +1 -1
- package/middleware/authorization/authorization.js +11 -8
- package/middleware/awareness/awareness.js +55 -31
- 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/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/form/form.js +3 -3
- package/middleware/modules/modules.js +6 -3
- package/middleware/proxy/proxy.js +8 -21
- package/middleware/stores/stores.js +2 -2
- package/middleware/virtual-config/virtual-config.js +11 -8
- package/middleware/wcm/wcm.js +4 -4
- package/notifications/notifications.js +2 -2
- package/package.json +29 -25
- package/server/index.js +504 -415
- 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 +6 -6
- package/util/cloudcms.js +106 -118
- package/util/proxy-factory.js +159 -268
- 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/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
|
@@ -14,28 +14,33 @@ class AbstractAsyncProvider extends AbstractProvider
|
|
|
14
14
|
{
|
|
15
15
|
super(config);
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
_lock(lockKey, workFunction)
|
|
19
|
+
{
|
|
20
|
+
process.locks.lock(lockKey, workFunction);
|
|
21
|
+
}
|
|
22
|
+
|
|
18
23
|
readOrCreateChannel(channelId, callback) {
|
|
19
24
|
|
|
20
25
|
var self = this;
|
|
21
26
|
|
|
22
27
|
self.readChannel(channelId, function(err, channel) {
|
|
23
|
-
|
|
28
|
+
|
|
24
29
|
if (err) {
|
|
25
30
|
return callback(err);
|
|
26
31
|
}
|
|
27
|
-
|
|
32
|
+
|
|
28
33
|
if (channel) {
|
|
29
34
|
return callback(null, channel);
|
|
30
35
|
}
|
|
31
36
|
|
|
32
37
|
var channel = {};
|
|
33
38
|
self.writeChannel(channelId, channel, function(err) {
|
|
34
|
-
|
|
39
|
+
|
|
35
40
|
if (err) {
|
|
36
41
|
return callback(err);
|
|
37
42
|
}
|
|
38
|
-
|
|
43
|
+
|
|
39
44
|
callback(null, channel);
|
|
40
45
|
});
|
|
41
46
|
});
|
|
@@ -46,26 +51,44 @@ class AbstractAsyncProvider extends AbstractProvider
|
|
|
46
51
|
register(channelId, user, callback)
|
|
47
52
|
{
|
|
48
53
|
var self = this;
|
|
49
|
-
|
|
54
|
+
|
|
55
|
+
self.doRegister(channelId, user, function(err) {
|
|
56
|
+
callback(err);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Workhorse method.
|
|
62
|
+
*
|
|
63
|
+
* @param channelId
|
|
64
|
+
* @param user
|
|
65
|
+
* @param callback
|
|
66
|
+
* @private
|
|
67
|
+
*/
|
|
68
|
+
doRegister(channelId, user, callback)
|
|
69
|
+
{
|
|
70
|
+
var self = this;
|
|
71
|
+
|
|
50
72
|
self.readOrCreateChannel(channelId, function (err, channel) {
|
|
51
|
-
|
|
73
|
+
|
|
52
74
|
if (err) {
|
|
53
75
|
return callback(err);
|
|
54
76
|
}
|
|
55
|
-
|
|
77
|
+
|
|
56
78
|
if (!channel.users) {
|
|
57
79
|
channel.users = {};
|
|
58
80
|
}
|
|
59
|
-
|
|
81
|
+
|
|
60
82
|
channel.users[user.id] = {
|
|
61
83
|
"user": user,
|
|
62
84
|
"time": new Date().getTime()
|
|
63
85
|
};
|
|
64
|
-
|
|
86
|
+
|
|
65
87
|
self.writeChannel(channelId, channel, function (err) {
|
|
66
88
|
callback(err);
|
|
67
89
|
});
|
|
68
90
|
});
|
|
91
|
+
|
|
69
92
|
}
|
|
70
93
|
|
|
71
94
|
discover(channelId, callback)
|
|
@@ -101,123 +124,121 @@ class AbstractAsyncProvider extends AbstractProvider
|
|
|
101
124
|
});
|
|
102
125
|
}
|
|
103
126
|
|
|
104
|
-
|
|
127
|
+
checkRegistered(channelId, userId, callback)
|
|
105
128
|
{
|
|
106
129
|
var self = this;
|
|
107
130
|
|
|
108
|
-
self.
|
|
131
|
+
self.readChannel(channelId, function(err, channel) {
|
|
109
132
|
|
|
110
133
|
if (err) {
|
|
111
134
|
return callback(err);
|
|
112
135
|
}
|
|
113
136
|
|
|
137
|
+
if (!channel) {
|
|
138
|
+
return callback(null, false);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (!channel.users) {
|
|
142
|
+
return callback(null, false);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (channel.users[userId]) {
|
|
146
|
+
return callback(null, true);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
callback(null, false);
|
|
150
|
+
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
expire(beforeMs, callback)
|
|
155
|
+
{
|
|
156
|
+
var self = this;
|
|
157
|
+
|
|
158
|
+
self.listChannelIds(function(err, channelIds) {
|
|
159
|
+
|
|
160
|
+
if (err) {
|
|
161
|
+
return callback(err);
|
|
162
|
+
}
|
|
163
|
+
|
|
114
164
|
if (!channelIds || channelIds.length === 0) {
|
|
115
165
|
return callback(null, [], {});
|
|
116
166
|
}
|
|
117
|
-
|
|
167
|
+
|
|
118
168
|
// a list of channel IDs whose memberships were updated
|
|
119
169
|
var updatedMembershipChannelIds = [];
|
|
120
170
|
var expiredUserIdsByChannelId = {};
|
|
121
|
-
|
|
171
|
+
|
|
122
172
|
var fns = [];
|
|
123
|
-
|
|
173
|
+
|
|
124
174
|
for (var i = 0; i < channelIds.length; i++)
|
|
125
175
|
{
|
|
126
176
|
var channelId = channelIds[i];
|
|
127
|
-
|
|
177
|
+
|
|
128
178
|
var fn = function (channelId, updatedMembershipChannelIds, expiredUserIdsByChannelId, beforeMs) {
|
|
129
179
|
return function (done) {
|
|
130
|
-
|
|
180
|
+
|
|
131
181
|
self.readChannel(channelId, function(err, channel) {
|
|
132
|
-
|
|
182
|
+
|
|
133
183
|
if (err) {
|
|
134
184
|
return done(err);
|
|
135
185
|
}
|
|
136
|
-
|
|
186
|
+
|
|
137
187
|
if (!channel) {
|
|
138
188
|
return done();
|
|
139
189
|
}
|
|
190
|
+
|
|
191
|
+
if (!channel.users || Object.keys(channel.users).length === 0)
|
|
192
|
+
{
|
|
193
|
+
return done();
|
|
194
|
+
}
|
|
140
195
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
196
|
+
// populate all of the user IDs that need to be removed
|
|
197
|
+
var userIdsToRemove = [];
|
|
198
|
+
for (var userId in channel.users)
|
|
144
199
|
{
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
for (var userId in channel.users)
|
|
200
|
+
var entry = channel.users[userId];
|
|
201
|
+
if (entry.time < beforeMs)
|
|
148
202
|
{
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
var expiredUserIds = expiredUserIdsByChannelId[channelId]
|
|
156
|
-
if (!expiredUserIds) {
|
|
157
|
-
expiredUserIds = expiredUserIdsByChannelId[channelId] = [];
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
expiredUserIds.push(userId);
|
|
203
|
+
updatedMembershipChannelIds.push(channelId);
|
|
204
|
+
userIdsToRemove.push(userId);
|
|
205
|
+
|
|
206
|
+
var expiredUserIds = expiredUserIdsByChannelId[channelId]
|
|
207
|
+
if (!expiredUserIds) {
|
|
208
|
+
expiredUserIds = expiredUserIdsByChannelId[channelId] = [];
|
|
161
209
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
// remove the user IDs
|
|
165
|
-
for (var i = 0; i < userIdsToRemove.length; i++)
|
|
166
|
-
{
|
|
167
|
-
delete channel.users[userIdsToRemove[i]];
|
|
210
|
+
|
|
211
|
+
expiredUserIds.push(userId);
|
|
168
212
|
}
|
|
169
213
|
}
|
|
170
|
-
|
|
171
|
-
|
|
214
|
+
|
|
215
|
+
// remove the user IDs
|
|
216
|
+
for (var i = 0; i < userIdsToRemove.length; i++)
|
|
172
217
|
{
|
|
173
|
-
|
|
218
|
+
delete channel.users[userIdsToRemove[i]];
|
|
174
219
|
}
|
|
175
|
-
|
|
176
|
-
|
|
220
|
+
|
|
221
|
+
self.writeChannel(channelId, channel, function() {
|
|
222
|
+
done();
|
|
223
|
+
});
|
|
224
|
+
|
|
177
225
|
});
|
|
178
226
|
};
|
|
179
227
|
}(channelId, updatedMembershipChannelIds, expiredUserIdsByChannelId, beforeMs);
|
|
180
228
|
fns.push(fn);
|
|
181
229
|
}
|
|
182
|
-
|
|
230
|
+
|
|
183
231
|
async.parallel(fns, function(err) {
|
|
184
|
-
|
|
232
|
+
|
|
185
233
|
if (err) {
|
|
186
234
|
return callback(err);
|
|
187
235
|
}
|
|
188
|
-
|
|
236
|
+
|
|
189
237
|
callback(null, updatedMembershipChannelIds, expiredUserIdsByChannelId);
|
|
190
238
|
});
|
|
191
239
|
});
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
checkRegistered(channelId, userId, callback)
|
|
195
|
-
{
|
|
196
|
-
var self = this;
|
|
197
|
-
|
|
198
|
-
self.readChannel(channelId, function(err, channel) {
|
|
199
|
-
|
|
200
|
-
if (err) {
|
|
201
|
-
return callback(err);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
if (!channel) {
|
|
205
|
-
return callback(null, false);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
if (!channel.users) {
|
|
209
|
-
return callback(null, false);
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
if (channel.users[userId]) {
|
|
213
|
-
return callback(null, true);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
callback(null, false);
|
|
217
|
-
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
|
|
240
|
+
};
|
|
241
|
+
|
|
221
242
|
acquireLock(channelId, user, callback)
|
|
222
243
|
{
|
|
223
244
|
var self = this;
|
|
@@ -303,14 +324,16 @@ class AbstractAsyncProvider extends AbstractProvider
|
|
|
303
324
|
callback(null, lock);
|
|
304
325
|
});
|
|
305
326
|
}
|
|
306
|
-
|
|
307
|
-
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
308
331
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
309
332
|
//
|
|
310
333
|
// ABSTRACT METHODS
|
|
311
334
|
//
|
|
312
335
|
//////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
313
|
-
|
|
336
|
+
|
|
314
337
|
// ABSTRACT
|
|
315
338
|
readChannel(channelId, callback)
|
|
316
339
|
{
|
|
@@ -328,7 +351,7 @@ class AbstractAsyncProvider extends AbstractProvider
|
|
|
328
351
|
{
|
|
329
352
|
throw new Error("listChannelIds() method is not implemented");
|
|
330
353
|
}
|
|
331
|
-
|
|
354
|
+
|
|
332
355
|
// ABSTRACT
|
|
333
356
|
readLock(lockId, callback)
|
|
334
357
|
{
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Abstract class for an Awareness Provider.
|
|
3
3
|
*
|
|
4
4
|
* This class provides an interface or base functions that any implementation class must implement in order to
|
|
5
|
-
* work with the Awareness Service.
|
|
5
|
+
* work with the Awareness Service.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
class AbstractProvider
|
|
@@ -24,20 +24,6 @@ class MemoryProvider extends AbstractAsyncProvider
|
|
|
24
24
|
callback();
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
readOrCreateChannel(channelId, callback)
|
|
28
|
-
{
|
|
29
|
-
var self = this;
|
|
30
|
-
|
|
31
|
-
var channel = self.channelMap[channelId];
|
|
32
|
-
if (channel) {
|
|
33
|
-
return callback(null, channel);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
channel = self.channelMap[channelId] = {};
|
|
37
|
-
|
|
38
|
-
callback(null, channel);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
27
|
readChannel(channelId, callback)
|
|
42
28
|
{
|
|
43
29
|
var self = this;
|