cloudcms-server 3.2.322 → 3.2.325
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/README.md +1 -7
- package/index.js +0 -17
- package/middleware/authentication/authentication.js +0 -5
- package/middleware/authentication/providers/saml.js +8 -4
- package/middleware/config/adapter.js +0 -44
- package/middleware/deployment/deployment.js +0 -10
- package/middleware/registration/registration.js +0 -5
- package/middleware/stores/engines/empty.js +0 -4
- package/middleware/stores/engines/fs-caching-adapter.js +0 -5
- package/middleware/stores/engines/fs.js +0 -9
- package/middleware/stores/engines/s3.js +0 -5
- package/middleware/stores/engines/s3fs.js +0 -5
- package/middleware/stores/multistore.js +0 -29
- package/middleware/stores/store.js +0 -9
- package/old_package.json +119 -0
- package/package.json +44 -55
- package/server/index.js +43 -84
- package/server/standalone.js +0 -5
- package/util/util.js +12 -6
- package/duster/helpers/core/cloudcms/associations.js +0 -34
- package/duster/helpers/core/cloudcms/beta/markdown.js +0 -46
- package/duster/helpers/core/cloudcms/beta/nodeAttachmentText.js +0 -46
- package/duster/helpers/core/cloudcms/beta/params.js +0 -33
- package/duster/helpers/core/cloudcms/beta/processTemplate.js +0 -82
- package/duster/helpers/core/cloudcms/content.js +0 -34
- package/duster/helpers/core/cloudcms/expand.js +0 -38
- package/duster/helpers/core/cloudcms/form.js +0 -34
- package/duster/helpers/core/cloudcms/query.js +0 -34
- package/duster/helpers/core/cloudcms/queryOne.js +0 -34
- package/duster/helpers/core/cloudcms/relatives.js +0 -34
- package/duster/helpers/core/cloudcms/search.js +0 -34
- package/duster/helpers/core/cloudcms/searchOne.js +0 -34
- package/duster/helpers/core/cloudcms/wcm/dependency.js +0 -83
- package/duster/helpers/core/cloudcms/wcm/fragment.js +0 -34
- package/duster/helpers/core/dev/debug.js +0 -42
- package/duster/helpers/core/dom/block.js +0 -49
- package/duster/helpers/core/dom/include.js +0 -38
- package/duster/helpers/core/dom/layout.js +0 -49
- package/duster/helpers/core/dom/link.js +0 -81
- package/duster/helpers/core/dom/resource.js +0 -77
- package/duster/helpers/core/engine.js +0 -1580
- package/duster/helpers/core/ice/value.js +0 -65
- package/duster/helpers/core/index.js +0 -49
- package/duster/helpers/core/operators/if.js +0 -64
- package/duster/helpers/core/operators/iter.js +0 -45
- package/duster/helpers/core/operators/iterate.js +0 -129
- package/duster/helpers/sample/nyt.js +0 -114
- package/duster/index.js +0 -319
- package/duster/support.js +0 -436
- package/duster/tracker.js +0 -262
- package/middleware/authentication/providers/cas.js +0 -73
- package/middleware/authentication/providers/facebook.js +0 -120
- package/middleware/authentication/providers/github.js +0 -88
- package/middleware/authentication/providers/linkedin.js +0 -112
- package/middleware/authentication/providers/twitter.js +0 -120
- package/middleware/server-tags/server-tags.js +0 -113
- package/middleware/wcm/wcm.js +0 -1437
- package/temp/clusterlock/README.md +0 -6
- package/temp/clusterlock/index.js +0 -198
- package/temp/clusterlock/package.json +0 -24
- package/temp/passport-saml/LICENSE +0 -23
- package/temp/passport-saml/README.md +0 -406
- package/temp/passport-saml/lib/node-saml/algorithms.d.ts +0 -5
- package/temp/passport-saml/lib/node-saml/algorithms.js +0 -41
- package/temp/passport-saml/lib/node-saml/algorithms.js.map +0 -1
- package/temp/passport-saml/lib/node-saml/index.d.ts +0 -3
- package/temp/passport-saml/lib/node-saml/index.js +0 -6
- package/temp/passport-saml/lib/node-saml/index.js.map +0 -1
- package/temp/passport-saml/lib/node-saml/inmemory-cache-provider.d.ts +0 -45
- package/temp/passport-saml/lib/node-saml/inmemory-cache-provider.js +0 -86
- package/temp/passport-saml/lib/node-saml/inmemory-cache-provider.js.map +0 -1
- package/temp/passport-saml/lib/node-saml/saml-post-signing.d.ts +0 -3
- package/temp/passport-saml/lib/node-saml/saml-post-signing.js +0 -15
- package/temp/passport-saml/lib/node-saml/saml-post-signing.js.map +0 -1
- package/temp/passport-saml/lib/node-saml/saml.d.ts +0 -77
- package/temp/passport-saml/lib/node-saml/saml.js +0 -1170
- package/temp/passport-saml/lib/node-saml/saml.js.map +0 -1
- package/temp/passport-saml/lib/node-saml/types.d.ts +0 -95
- package/temp/passport-saml/lib/node-saml/types.js +0 -8
- package/temp/passport-saml/lib/node-saml/types.js.map +0 -1
- package/temp/passport-saml/lib/node-saml/utility.d.ts +0 -3
- package/temp/passport-saml/lib/node-saml/utility.js +0 -19
- package/temp/passport-saml/lib/node-saml/utility.js.map +0 -1
- package/temp/passport-saml/lib/node-saml/xml.d.ts +0 -21
- package/temp/passport-saml/lib/node-saml/xml.js +0 -140
- package/temp/passport-saml/lib/node-saml/xml.js.map +0 -1
- package/temp/passport-saml/lib/passport-saml/index.d.ts +0 -6
- package/temp/passport-saml/lib/passport-saml/index.js +0 -11
- package/temp/passport-saml/lib/passport-saml/index.js.map +0 -1
- package/temp/passport-saml/lib/passport-saml/multiSamlStrategy.d.ts +0 -13
- package/temp/passport-saml/lib/passport-saml/multiSamlStrategy.js +0 -63
- package/temp/passport-saml/lib/passport-saml/multiSamlStrategy.js.map +0 -1
- package/temp/passport-saml/lib/passport-saml/strategy.d.ts +0 -20
- package/temp/passport-saml/lib/passport-saml/strategy.js +0 -167
- package/temp/passport-saml/lib/passport-saml/strategy.js.map +0 -1
- package/temp/passport-saml/lib/passport-saml/types.d.ts +0 -51
- package/temp/passport-saml/lib/passport-saml/types.js +0 -11
- package/temp/passport-saml/lib/passport-saml/types.js.map +0 -1
- package/temp/passport-saml/package.json +0 -96
package/server/index.js
CHANGED
|
@@ -16,8 +16,7 @@ var session = require('express-session');
|
|
|
16
16
|
var cookieParser = require('cookie-parser');
|
|
17
17
|
var flash = require("connect-flash");
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
const connectRedis = require('connect-redis');
|
|
19
|
+
const {RedisStore} = require("connect-redis");
|
|
21
20
|
|
|
22
21
|
// we don't bind a single passport - instead, we get the constructor here by hand
|
|
23
22
|
var Passport = require("passport").Passport;
|
|
@@ -33,11 +32,6 @@ var requestParam = require("request-param")();
|
|
|
33
32
|
// cloudcms app server support
|
|
34
33
|
var main = require("../index");
|
|
35
34
|
|
|
36
|
-
// duster service
|
|
37
|
-
var duster = require("../duster/index");
|
|
38
|
-
|
|
39
|
-
var coreHelpers = require("../duster/helpers/core/index");
|
|
40
|
-
|
|
41
35
|
var helmet = require("helmet");
|
|
42
36
|
|
|
43
37
|
var responseTime = require("response-time");
|
|
@@ -71,7 +65,6 @@ var SETTINGS = {
|
|
|
71
65
|
"beforeFunctions": [],
|
|
72
66
|
"afterFunctions": [],
|
|
73
67
|
"reportFunctions": [],
|
|
74
|
-
"dustFunctions": [],
|
|
75
68
|
"initFunctions": [],
|
|
76
69
|
"filterFunctions": [],
|
|
77
70
|
"driverFunctions": [],
|
|
@@ -175,11 +168,6 @@ var SETTINGS = {
|
|
|
175
168
|
"modules": "hosts_s3fs"
|
|
176
169
|
}
|
|
177
170
|
},
|
|
178
|
-
"duster": {
|
|
179
|
-
"fragments": {
|
|
180
|
-
"cache": true
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
171
|
"virtualHost": {
|
|
184
172
|
"enabled": false
|
|
185
173
|
},
|
|
@@ -317,9 +305,6 @@ var SETTINGS = {
|
|
|
317
305
|
}
|
|
318
306
|
};
|
|
319
307
|
|
|
320
|
-
// always push core tag helpers to the front
|
|
321
|
-
SETTINGS.dustFunctions.unshift(coreHelpers);
|
|
322
|
-
|
|
323
308
|
// if SETTINGS.errorFunctions is empty, plug in a default error handler
|
|
324
309
|
if (SETTINGS.errorFunctions.length === 0)
|
|
325
310
|
{
|
|
@@ -441,17 +426,6 @@ exports.error = function (fn) {
|
|
|
441
426
|
SETTINGS.errorFunctions.push(fn);
|
|
442
427
|
};
|
|
443
428
|
|
|
444
|
-
/**
|
|
445
|
-
* Adds an initialization function to set up dust.
|
|
446
|
-
*
|
|
447
|
-
* The function must have signature fn(app, dust)
|
|
448
|
-
*
|
|
449
|
-
* @param helperFn
|
|
450
|
-
*/
|
|
451
|
-
var dust = exports.dust = function(fn) {
|
|
452
|
-
SETTINGS.dustFunctions.push(fn);
|
|
453
|
-
};
|
|
454
|
-
|
|
455
429
|
/**
|
|
456
430
|
* Registers a function to run before the server starts.
|
|
457
431
|
*
|
|
@@ -740,7 +714,6 @@ var initSession = function(initDone)
|
|
|
740
714
|
var redisOptions = redisHelper.redisOptions();
|
|
741
715
|
var redisClient = new IORedis(redisOptions.url);
|
|
742
716
|
|
|
743
|
-
var RedisStore = connectRedis(session);
|
|
744
717
|
sessionConfig.store = new RedisStore({ client: redisClient });
|
|
745
718
|
initDone(null, session(sessionConfig));
|
|
746
719
|
}
|
|
@@ -821,7 +794,6 @@ var startServer = function(config, startServerFinishedFn)
|
|
|
821
794
|
//
|
|
822
795
|
// BASE CONFIGURATION
|
|
823
796
|
//
|
|
824
|
-
// Configures NodeJS app server using dustjs templating engine
|
|
825
797
|
// Runs on port 3000 by default
|
|
826
798
|
//
|
|
827
799
|
////////////////////////////////////////////////////////////////////////////
|
|
@@ -830,16 +802,7 @@ var startServer = function(config, startServerFinishedFn)
|
|
|
830
802
|
app.set('port', process.env.PORT);
|
|
831
803
|
app.set('views', process.env.CLOUDCMS_APPSERVER_BASE_PATH + "/views");
|
|
832
804
|
|
|
833
|
-
if (config.viewEngine === "
|
|
834
|
-
{
|
|
835
|
-
var cons = require('consolidate');
|
|
836
|
-
|
|
837
|
-
app.set('view engine', 'html');
|
|
838
|
-
app.set('view engine', 'dust');
|
|
839
|
-
app.engine('html', cons.dust);
|
|
840
|
-
app.engine('dust', cons.dust);
|
|
841
|
-
}
|
|
842
|
-
else if (config.viewEngine === "handlebars" || config.viewEngine === "hbs")
|
|
805
|
+
if (config.viewEngine === "handlebars" || config.viewEngine === "hbs")
|
|
843
806
|
{
|
|
844
807
|
var hbs = require('hbs');
|
|
845
808
|
|
|
@@ -1359,52 +1322,48 @@ var configureServer = function(config, app, httpServer, configureServerFinishedF
|
|
|
1359
1322
|
// SET INITIAL VALUE FOR SERVER TIMESTAMP
|
|
1360
1323
|
process.env.CLOUDCMS_APPSERVER_TIMESTAMP = Date.now();
|
|
1361
1324
|
|
|
1362
|
-
//
|
|
1363
|
-
runFunctions(config.
|
|
1364
|
-
|
|
1365
|
-
//
|
|
1366
|
-
runFunctions(config.
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
// close server connections as cleanly as we can
|
|
1381
|
-
console.log(" -> Closing server connections");
|
|
1382
|
-
}
|
|
1383
|
-
|
|
1384
|
-
try
|
|
1385
|
-
{
|
|
1386
|
-
httpServer.close();
|
|
1387
|
-
}
|
|
1388
|
-
catch (e)
|
|
1389
|
-
{
|
|
1390
|
-
console.log("Server.close produced error: " + JSON.stringify(e));
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
|
-
if (cluster.isMaster)
|
|
1394
|
-
{
|
|
1395
|
-
console.log("");
|
|
1396
|
-
}
|
|
1397
|
-
|
|
1398
|
-
// tell the process to exit
|
|
1399
|
-
process.exit();
|
|
1325
|
+
// APPLY SERVER BEFORE START FUNCTIONS
|
|
1326
|
+
runFunctions(config.beforeFunctions, [app], function (err) {
|
|
1327
|
+
|
|
1328
|
+
// AFTER SERVER START
|
|
1329
|
+
runFunctions(config.afterFunctions, [app], function (err) {
|
|
1330
|
+
|
|
1331
|
+
function cleanup() {
|
|
1332
|
+
|
|
1333
|
+
if (cluster.isMaster)
|
|
1334
|
+
{
|
|
1335
|
+
console.log("");
|
|
1336
|
+
console.log("");
|
|
1337
|
+
|
|
1338
|
+
console.log("Cloud CMS Module shutting down");
|
|
1339
|
+
|
|
1340
|
+
// close server connections as cleanly as we can
|
|
1341
|
+
console.log(" -> Closing server connections");
|
|
1400
1342
|
}
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1343
|
+
|
|
1344
|
+
try
|
|
1345
|
+
{
|
|
1346
|
+
httpServer.close();
|
|
1347
|
+
}
|
|
1348
|
+
catch (e)
|
|
1349
|
+
{
|
|
1350
|
+
console.log("Server.close produced error: " + JSON.stringify(e));
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
if (cluster.isMaster)
|
|
1354
|
+
{
|
|
1355
|
+
console.log("");
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1358
|
+
// tell the process to exit
|
|
1359
|
+
process.exit();
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
// listen for kill or interrupt so that we can shut down cleanly
|
|
1363
|
+
process.on('SIGINT', cleanup);
|
|
1364
|
+
process.on('SIGTERM', cleanup);
|
|
1365
|
+
|
|
1366
|
+
configureServerFinishedFn();
|
|
1408
1367
|
});
|
|
1409
1368
|
});
|
|
1410
1369
|
};
|
package/server/standalone.js
CHANGED
package/util/util.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
var mime = require("mime");
|
|
2
|
+
const { v4: uuidv4 } = require("uuid");
|
|
3
|
+
|
|
1
4
|
var fs = require("fs");
|
|
2
5
|
var path = require("path");
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var uuidv4 = require("uuid/v4");
|
|
6
|
+
//var mime = require("mime");
|
|
7
|
+
//var uuidv4 = require("uuid/v4");
|
|
6
8
|
var os = require("os");
|
|
7
9
|
var async = require("async");
|
|
8
10
|
var temp = require("temp");
|
|
@@ -544,7 +546,9 @@ var rmdir = exports.rmdir = function(directoryPath)
|
|
|
544
546
|
|
|
545
547
|
var mkdirs = exports.mkdirs = function(directoryPath, callback)
|
|
546
548
|
{
|
|
547
|
-
|
|
549
|
+
fs.mkdir(directoryPath, {
|
|
550
|
+
recursive: true
|
|
551
|
+
}, function(err) {
|
|
548
552
|
callback(err);
|
|
549
553
|
});
|
|
550
554
|
};
|
|
@@ -1205,7 +1209,9 @@ var handleSendFileError = exports.handleSendFileError = function(req, res, fileP
|
|
|
1205
1209
|
|
|
1206
1210
|
var createDirectory = exports.createDirectory = function(directoryPath, callback)
|
|
1207
1211
|
{
|
|
1208
|
-
|
|
1212
|
+
fs.mkdir(directoryPath, {
|
|
1213
|
+
"recursive": true
|
|
1214
|
+
}, function(err) {
|
|
1209
1215
|
|
|
1210
1216
|
if (err) {
|
|
1211
1217
|
return callback(err);
|
|
@@ -1376,7 +1382,7 @@ var isUndefined = exports.isUndefined = function(obj) {
|
|
|
1376
1382
|
var lookupMimeType = exports.lookupMimeType = function(ext) {
|
|
1377
1383
|
|
|
1378
1384
|
// rely on the mimetype library for base handling
|
|
1379
|
-
var mimetype = mime.
|
|
1385
|
+
var mimetype = mime.getType(ext);
|
|
1380
1386
|
|
|
1381
1387
|
var extension = ext;
|
|
1382
1388
|
if (extension && extension.indexOf(".") === 0)
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @associations
|
|
3
|
-
*
|
|
4
|
-
* @param app
|
|
5
|
-
* @param dust
|
|
6
|
-
* @param callback
|
|
7
|
-
*/
|
|
8
|
-
module.exports = function(app, dust, callback)
|
|
9
|
-
{
|
|
10
|
-
var engine = require("../engine")(app, dust);
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* ASSOCIATIONS
|
|
14
|
-
*
|
|
15
|
-
* Finds associations around a node.
|
|
16
|
-
*
|
|
17
|
-
* Syntax:
|
|
18
|
-
*
|
|
19
|
-
* {@associations node="<nodeId>" type="<association_type>" limit="" skip="" as=""}
|
|
20
|
-
* {+templateIdentifier/}
|
|
21
|
-
* {/associations}
|
|
22
|
-
*
|
|
23
|
-
* @param chunk
|
|
24
|
-
* @param context
|
|
25
|
-
* @param bodies
|
|
26
|
-
* @param params
|
|
27
|
-
*/
|
|
28
|
-
dust.helpers.associations = function(chunk, context, bodies, params)
|
|
29
|
-
{
|
|
30
|
-
return engine.handleAssociations(chunk, context, bodies, params);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
callback();
|
|
34
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
var marked = require("marked");
|
|
2
|
-
marked.setOptions({
|
|
3
|
-
renderer: new marked.Renderer(),
|
|
4
|
-
gfm: true,
|
|
5
|
-
tables: true,
|
|
6
|
-
breaks: false,
|
|
7
|
-
pedantic: false,
|
|
8
|
-
sanitize: true,
|
|
9
|
-
smartLists: true,
|
|
10
|
-
smartypants: false
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @markdown
|
|
15
|
-
*
|
|
16
|
-
* @param app
|
|
17
|
-
* @param dust
|
|
18
|
-
* @param callback
|
|
19
|
-
*/
|
|
20
|
-
module.exports = function(app, dust, callback)
|
|
21
|
-
{
|
|
22
|
-
/**
|
|
23
|
-
* Renders markdown into the Dust template.
|
|
24
|
-
*
|
|
25
|
-
* @param chunk
|
|
26
|
-
* @param context
|
|
27
|
-
* @param bodies
|
|
28
|
-
* @param params
|
|
29
|
-
* @returns {*}
|
|
30
|
-
*/
|
|
31
|
-
dust.helpers.markdown = function(chunk, context, bodies, params) {
|
|
32
|
-
|
|
33
|
-
params = params || {};
|
|
34
|
-
|
|
35
|
-
var text = context.resolve(params.text);
|
|
36
|
-
if (!text) {
|
|
37
|
-
return chunk;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
text = marked(text);
|
|
41
|
-
|
|
42
|
-
return chunk.write(text);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
callback();
|
|
46
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @nodeAttachmentText
|
|
3
|
-
*
|
|
4
|
-
* @param app
|
|
5
|
-
* @param dust
|
|
6
|
-
* @param callback
|
|
7
|
-
*/
|
|
8
|
-
module.exports = function(app, dust, callback)
|
|
9
|
-
{
|
|
10
|
-
var engine = require("../../engine")(app, dust);
|
|
11
|
-
|
|
12
|
-
var map = engine.map;
|
|
13
|
-
var end = engine.end;
|
|
14
|
-
|
|
15
|
-
dust.helpers.nodeAttachmentText = dust.helpers.nodeAttachmentValue = function(chunk, context, bodies, params)
|
|
16
|
-
{
|
|
17
|
-
params = params || {};
|
|
18
|
-
|
|
19
|
-
var nodeId = context.resolve(params.node);
|
|
20
|
-
var attachmentId = context.resolve(params.attachment);
|
|
21
|
-
if (!attachmentId)
|
|
22
|
-
{
|
|
23
|
-
attachmentId = "default";
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return map(chunk, function(chunk) {
|
|
27
|
-
|
|
28
|
-
var req = context.get("req");
|
|
29
|
-
req.branch(function(err, branch) {
|
|
30
|
-
|
|
31
|
-
if (err) {
|
|
32
|
-
return end(chunk, context);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
branch.readNode(nodeId).attachment(attachmentId).download(function(text) {
|
|
36
|
-
|
|
37
|
-
chunk.write(text);
|
|
38
|
-
|
|
39
|
-
end(chunk, context);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
callback();
|
|
46
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @params
|
|
3
|
-
*
|
|
4
|
-
* @param app
|
|
5
|
-
* @param dust
|
|
6
|
-
* @param callback
|
|
7
|
-
*/
|
|
8
|
-
module.exports = function(app, dust, callback)
|
|
9
|
-
{
|
|
10
|
-
/**
|
|
11
|
-
* Allows parameters to be passed into blocks or partials
|
|
12
|
-
*/
|
|
13
|
-
dust.helpers.params = function( chunk, context, bodies, params ){
|
|
14
|
-
|
|
15
|
-
var partial = {};
|
|
16
|
-
if( params)
|
|
17
|
-
{
|
|
18
|
-
for (var key in params)
|
|
19
|
-
{
|
|
20
|
-
partial[key] = params[key];
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// render
|
|
25
|
-
var newContext = context.push(partial);
|
|
26
|
-
|
|
27
|
-
//return bodies.block(chunk, dust.makeBase(partial))
|
|
28
|
-
return bodies.block(chunk, newContext);
|
|
29
|
-
};
|
|
30
|
-
dust.helpers.parameters = dust.helpers.params;
|
|
31
|
-
|
|
32
|
-
callback();
|
|
33
|
-
};
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @processTemplate
|
|
3
|
-
*
|
|
4
|
-
* @param app
|
|
5
|
-
* @param dust
|
|
6
|
-
* @param callback
|
|
7
|
-
*/
|
|
8
|
-
module.exports = function(app, dust, callback)
|
|
9
|
-
{
|
|
10
|
-
var engine = require("../../engine")(app, dust);
|
|
11
|
-
|
|
12
|
-
var map = engine.map;
|
|
13
|
-
var end = engine.end;
|
|
14
|
-
|
|
15
|
-
dust.helpers.processTemplate = function(chunk, context, bodies, params)
|
|
16
|
-
{
|
|
17
|
-
params = params || {};
|
|
18
|
-
|
|
19
|
-
var nodeId = context.resolve(params.node);
|
|
20
|
-
var attachmentId = context.resolve(params.attachment);
|
|
21
|
-
if (!attachmentId)
|
|
22
|
-
{
|
|
23
|
-
attachmentId = "default";
|
|
24
|
-
}
|
|
25
|
-
var propertyId = context.resolve(params.property);
|
|
26
|
-
var locale = context.resolve(params.locale);
|
|
27
|
-
|
|
28
|
-
return map(chunk, function(chunk) {
|
|
29
|
-
|
|
30
|
-
if (locale)
|
|
31
|
-
{
|
|
32
|
-
var gitana = context.get("gitana");
|
|
33
|
-
gitana.getDriver().setLocale(locale);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (propertyId)
|
|
37
|
-
{
|
|
38
|
-
var req = context.get("req");
|
|
39
|
-
req.branch(function(err, branch) {
|
|
40
|
-
|
|
41
|
-
if (err) {
|
|
42
|
-
return end(chunk, context);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
branch.readNode(nodeId).then(function() {
|
|
46
|
-
|
|
47
|
-
resolveVariables([this[propertyId]], context, function (err, resolutions) {
|
|
48
|
-
|
|
49
|
-
chunk.write(resolutions[0]);
|
|
50
|
-
|
|
51
|
-
end(chunk, context);
|
|
52
|
-
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
else
|
|
58
|
-
{
|
|
59
|
-
var req = context.get("req");
|
|
60
|
-
req.branch(function(err, branch) {
|
|
61
|
-
|
|
62
|
-
if (err) {
|
|
63
|
-
return end(chunk, context);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
branch.readNode(nodeId).attachment(attachmentId).download(function (text) {
|
|
67
|
-
|
|
68
|
-
resolveVariables([text], context, function (err, resolutions) {
|
|
69
|
-
|
|
70
|
-
chunk.write(resolutions[0]);
|
|
71
|
-
|
|
72
|
-
end(chunk, context);
|
|
73
|
-
|
|
74
|
-
});
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
callback();
|
|
82
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @content
|
|
3
|
-
*
|
|
4
|
-
* @param app
|
|
5
|
-
* @param dust
|
|
6
|
-
* @param callback
|
|
7
|
-
*/
|
|
8
|
-
module.exports = function(app, dust, callback)
|
|
9
|
-
{
|
|
10
|
-
var engine = require("../engine")(app, dust);
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* CONTENT
|
|
14
|
-
*
|
|
15
|
-
* Selects a single content item.
|
|
16
|
-
*
|
|
17
|
-
* Syntax:
|
|
18
|
-
*
|
|
19
|
-
* {@content id="GUID" path="/a/b/c" as=""}
|
|
20
|
-
* {+templateIdentifier/}
|
|
21
|
-
* {/content}
|
|
22
|
-
*
|
|
23
|
-
* @param chunk
|
|
24
|
-
* @param context
|
|
25
|
-
* @param bodies
|
|
26
|
-
* @param params
|
|
27
|
-
*/
|
|
28
|
-
dust.helpers.content = function(chunk, context, bodies, params)
|
|
29
|
-
{
|
|
30
|
-
return engine.handleContent(chunk, context, bodies, params);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
callback();
|
|
34
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @expand
|
|
3
|
-
*
|
|
4
|
-
* @param app
|
|
5
|
-
* @param dust
|
|
6
|
-
* @param callback
|
|
7
|
-
*/
|
|
8
|
-
module.exports = function(app, dust, callback)
|
|
9
|
-
{
|
|
10
|
-
var engine = require("../engine")(app, dust);
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* EXPAND
|
|
14
|
-
*
|
|
15
|
-
* Query for a list of nodes by their id (._doc).
|
|
16
|
-
* The list of id values can be supplied as an array of id values in
|
|
17
|
-
* the 'list' arg or as an array of node records in the 'list' arg
|
|
18
|
-
* along with a the name of a common key within each node that holds
|
|
19
|
-
* the id.
|
|
20
|
-
*
|
|
21
|
-
* Syntax:
|
|
22
|
-
* ex. 1
|
|
23
|
-
* {@expand list="components" key="editorialpage.components" as="components"}
|
|
24
|
-
* {+templateIdentifier/}
|
|
25
|
-
* {/expand}
|
|
26
|
-
*
|
|
27
|
-
* @param chunk
|
|
28
|
-
* @param context
|
|
29
|
-
* @param bodies
|
|
30
|
-
* @param params
|
|
31
|
-
*/
|
|
32
|
-
dust.helpers.expand = function(chunk, context, bodies, params)
|
|
33
|
-
{
|
|
34
|
-
return engine.handleExpand(chunk, context, bodies, params);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
callback();
|
|
38
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @form
|
|
3
|
-
*
|
|
4
|
-
* @param app
|
|
5
|
-
* @param dust
|
|
6
|
-
* @param callback
|
|
7
|
-
*/
|
|
8
|
-
module.exports = function(app, dust, callback)
|
|
9
|
-
{
|
|
10
|
-
var engine = require("../engine")(app, dust);
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* FORM
|
|
14
|
-
*
|
|
15
|
-
* Renders a form.
|
|
16
|
-
*
|
|
17
|
-
* Syntax:
|
|
18
|
-
*
|
|
19
|
-
* {@form definition="custom:type" form="formKey" list="listKeyOrId" successUrl="" errorUrl=""}
|
|
20
|
-
* {+templateIdentifier/}
|
|
21
|
-
* {/form}
|
|
22
|
-
*
|
|
23
|
-
* @param chunk
|
|
24
|
-
* @param context
|
|
25
|
-
* @param bodies
|
|
26
|
-
* @param params
|
|
27
|
-
*/
|
|
28
|
-
dust.helpers.form = function(chunk, context, bodies, params)
|
|
29
|
-
{
|
|
30
|
-
return engine.handleForm(chunk, context, bodies, params);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
callback();
|
|
34
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @query
|
|
3
|
-
*
|
|
4
|
-
* @param app
|
|
5
|
-
* @param dust
|
|
6
|
-
* @param callback
|
|
7
|
-
*/
|
|
8
|
-
module.exports = function(app, dust, callback)
|
|
9
|
-
{
|
|
10
|
-
var engine = require("../engine")(app, dust);
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* QUERY
|
|
14
|
-
*
|
|
15
|
-
* Queries for content from the content repository and renders.
|
|
16
|
-
*
|
|
17
|
-
* Syntax:
|
|
18
|
-
*
|
|
19
|
-
* {@query sort="title" scope="page" type="custom:type" limit="" skip="" as=""}
|
|
20
|
-
* {+templateIdentifier/}
|
|
21
|
-
* {/query}
|
|
22
|
-
*
|
|
23
|
-
* @param chunk
|
|
24
|
-
* @param context
|
|
25
|
-
* @param bodies
|
|
26
|
-
* @param params
|
|
27
|
-
*/
|
|
28
|
-
dust.helpers.query = function(chunk, context, bodies, params)
|
|
29
|
-
{
|
|
30
|
-
return engine.handleQuery(chunk, context, bodies, params, false);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
callback();
|
|
34
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @queryOne
|
|
3
|
-
*
|
|
4
|
-
* @param app
|
|
5
|
-
* @param dust
|
|
6
|
-
* @param callback
|
|
7
|
-
*/
|
|
8
|
-
module.exports = function(app, dust, callback)
|
|
9
|
-
{
|
|
10
|
-
var engine = require("../engine")(app, dust);
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* QUERY AND KEEP ONE
|
|
14
|
-
*
|
|
15
|
-
* Queries for content from the content repository and renders.
|
|
16
|
-
*
|
|
17
|
-
* Syntax:
|
|
18
|
-
*
|
|
19
|
-
* {@queryOne sort="title" scope="page" type="custom:type" limit="" skip="" as=""}
|
|
20
|
-
* {+templateIdentifier/}
|
|
21
|
-
* {/queryOne}
|
|
22
|
-
*
|
|
23
|
-
* @param chunk
|
|
24
|
-
* @param context
|
|
25
|
-
* @param bodies
|
|
26
|
-
* @param params
|
|
27
|
-
*/
|
|
28
|
-
dust.helpers.queryOne = function(chunk, context, bodies, params)
|
|
29
|
-
{
|
|
30
|
-
return engine.handleQuery(chunk, context, bodies, params, true);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
callback();
|
|
34
|
-
};
|