Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
const P = require('bluebird');
const HyperSwitch = require('hyperswitch');
const URI = HyperSwitch.URI;
const Template = HyperSwitch.Template;
const mwUtil = require('../lib/mwUtil');
const BaseFeed = require('../lib/base_feed');
const PARTS_URIS = {
tfa: {
reqTemplate: new Template({
uri: '{{options.host}}/{{domain}}/v1/page/featured/{{yyyy}}/{{mm}}/{{dd}}',
query: {
aggregated: true
}
}),
renewable: true
},
mostread: {
reqTemplate: new Template({
uri: '{{options.host}}/{{domain}}/v1/page/most-read/{{yyyy}}/{{mm}}/{{dd}}',
'use strict';
const P = require('bluebird');
const HyperSwitch = require('hyperswitch');
const Template = HyperSwitch.Template;
const BaseFeed = require('../lib/base_feed');
const mwUtil = require('../lib/mwUtil');
const POSSIBLE_PARTS = [
'selected',
'births',
'deaths',
'events',
'holidays'
];
const REQUEST_TEMPLATE = new Template({
uri: '{{options.host}}/{{domain}}/v1/feed/onthisday/{{type}}/{{mm}}/{{dd}}'
});
class Feed extends BaseFeed {
'use strict';
/*
* Simple wrapper for the PHP action API
*/
const HyperSwitch = require('hyperswitch');
const HTTPError = HyperSwitch.HTTPError;
const Template = HyperSwitch.Template;
/**
* Error translation
*/
const errDefs = {
400: { status: 400, type: 'bad_request' },
401: { status: 401, type: 'unauthorized' },
403: { status: 403, type: 'forbidden#edit' },
409: { status: 409, type: 'conflict' },
413: { status: 413, type: 'too_large' },
429: { status: 429, type: 'rate_exceeded' },
500: { status: 500, type: 'server_error' },
501: { status: 501, type: 'not_supported' }
};
const errCodes = {
'use strict';
const HyperSwitch = require('hyperswitch');
const Template = HyperSwitch.Template;
module.exports = (options) => {
options = options || {};
options.backend_host_template = options.backend_host_template || '/{domain}/sys/legacy';
const backendURITemplate = new Template({
uri: `${options.backend_host_template}/{{path}}`
});
return {
spec: {
paths: {
'/{+path}': {
'x-route-filters': options.block_external_reqs ?
[{
type: 'default',
name: 'header_match',
options: {