Skip to content

Commit

Permalink
chore(prettier): run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
zeevo committed Sep 29, 2020
1 parent b09ab33 commit 20f5530
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 112 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,51 +8,49 @@ let getConformanceResource = () => {
return resolveSchema('1_0_2', 'conformance');
};

module.exports.makeStatement = function(resources) {
module.exports.makeStatement = function (resources) {
let Conformance = getConformanceResource();

return new Conformance({
status: 'active',
date: moment()
.tz('America/New_York')
.format(),
date: moment().tz('America/New_York').format(),
publisher: 'Not provided',
kind: 'instance',
software: {
name: 'FHIR Server',
version: '1.4.0'
version: '1.4.0',
},
implementation: {
description: 'FHIR Test Server (DSTU2)'
description: 'FHIR Test Server (DSTU2)',
},
fhirVersion: '1.0.2',
acceptUnknown: 'extensions',
format: ['application/json+fhir'],
rest: [resources]
rest: [resources],
});
};

/**
* @name exports
* @summary Capability statement shell
*/
module.exports.securityStatement = securityUrls => ({
module.exports.securityStatement = (securityUrls) => ({
cors: true,
service: [
{
coding: [
{
system: 'http://hl7.org/fhir/restful-security-service',
code: 'SMART-on-FHIR'
}
code: 'SMART-on-FHIR',
},
],
text: 'Custom OAuth2 using SMART-on-FHIR profile (see http://docs.smarthealthit.org)'
}
text: 'Custom OAuth2 using SMART-on-FHIR profile (see http://docs.smarthealthit.org)',
},
],
extension: [
{
url: 'http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris',
extension: securityUrls
}
]
extension: securityUrls,
},
],
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,51 +8,49 @@ let getCapabilityStatementResource = () => {
return resolveSchema('3_0_1', 'capabilitystatement');
};

module.exports.makeStatement = function(resources) {
module.exports.makeStatement = function (resources) {
let CapabilityStatement = getCapabilityStatementResource();

return new CapabilityStatement({
status: 'active',
date: moment()
.tz('America/New_York')
.format(),
date: moment().tz('America/New_York').format(),
publisher: 'Not provided',
kind: 'instance',
software: {
name: 'FHIR Server',
version: '1.4.0'
version: '1.4.0',
},
implementation: {
description: 'FHIR Test Server (STU3)'
description: 'FHIR Test Server (STU3)',
},
fhirVersion: '3.0.1',
acceptUnknown: 'extensions',
format: ['application/fhir+json'],
rest: [resources]
rest: [resources],
});
};

/**
* @name exports
* @summary Capability statement shell
*/
module.exports.securityStatement = securityUrls => ({
module.exports.securityStatement = (securityUrls) => ({
cors: true,
service: [
{
coding: [
{
system: 'http://hl7.org/fhir/restful-security-service',
code: 'SMART-on-FHIR'
}
code: 'SMART-on-FHIR',
},
],
text: 'OAuth2 using SMART-on-FHIR profile (see http://docs.smarthealthit.org)'
}
text: 'OAuth2 using SMART-on-FHIR profile (see http://docs.smarthealthit.org)',
},
],
extension: [
{
url: 'http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris',
extension: securityUrls
}
]
extension: securityUrls,
},
],
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,51 +8,49 @@ let getCapabilityStatementResource = () => {
return resolveSchema('4_0_0', 'capabilitystatement');
};

module.exports.makeStatement = function(resources) {
module.exports.makeStatement = function (resources) {
let CapabilityStatement = getCapabilityStatementResource();

return new CapabilityStatement({
status: 'active',
date: moment()
.tz('America/New_York')
.format(),
date: moment().tz('America/New_York').format(),
publisher: 'Not provided',
kind: 'instance',
software: {
name: 'FHIR Server',
version: '1.4.0'
version: '1.4.0',
},
implementation: {
description: 'FHIR Test Server (R4)'
description: 'FHIR Test Server (R4)',
},
fhirVersion: '4.0.0',
acceptUnknown: 'extensions',
format: ['application/fhir+json'],
rest: [resources]
rest: [resources],
});
};

/**
* @name exports
* @summary Capability statement shell
*/
module.exports.securityStatement = securityUrls => ({
module.exports.securityStatement = (securityUrls) => ({
cors: true,
service: [
{
coding: [
{
system: 'http://hl7.org/fhir/restful-security-service',
code: 'SMART-on-FHIR'
}
code: 'SMART-on-FHIR',
},
],
text: 'Custom OAuth2 using SMART-on-FHIR profile (see http://docs.smarthealthit.org)'
}
text: 'Custom OAuth2 using SMART-on-FHIR profile (see http://docs.smarthealthit.org)',
},
],
extension: [
{
url: 'http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris',
extension: securityUrls
}
]
extension: securityUrls,
},
],
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ const { routeArgs: routeArgs } = require('../route.config.js');
let route = {
path: '/:base_version/metadata',
corsOptions: {
methods: ['GET']
methods: ['GET'],
},
args: [routeArgs.BASE],
controller: controller.getCapabilityStatement
controller: controller.getCapabilityStatement,
};

/**
* @name exports
* @summary Metadata config
*/
module.exports = {
route
route,
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ module.exports.getCapabilityStatement = ({ profiles, security, statementGenerato
fhirVersion: fhirVersion || VERSIONS['4_0_0'],
profiles,
security,
statementGenerator
statementGenerator,
})
.then(statement => res.status(200).json(statement))
.catch(err => next(err));
.then((statement) => res.status(200).json(statement))
.catch((err) => next(err));
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let logger = container.get('default');
/**
* Load the correct statement generators for the right version
*/
let getStatementGenerators = base_version => {
let getStatementGenerators = (base_version) => {
if (base_version) {
return require(`./capability.${base_version}`);
} else {
Expand All @@ -29,24 +29,24 @@ let generateCapabilityStatement = ({
fhirVersion,
profiles,
security,
statementGenerator = getStatementGenerators
statementGenerator = getStatementGenerators,
}) =>
new Promise((resolve, reject) => {
logger.info('Metadata.generateCapabilityStatement');

// create profile list
let keys = Object.keys(profiles);
let active_profiles = keys
.map(profile_name => {
.map((profile_name) => {
return {
key: profile_name,
makeResource: conformanceTemplate.resource,
versions: profiles[profile_name] && profiles[profile_name].versions,
service: profiles[profile_name] && profiles[profile_name].serviceModule,
metadata: profiles[profile_name] && profiles[profile_name].metadata
metadata: profiles[profile_name] && profiles[profile_name].metadata,
};
})
.filter(profile => profile.versions.indexOf(fhirVersion) !== -1);
.filter((profile) => profile.versions.indexOf(fhirVersion) !== -1);

// TODO: REMOVE: Logger deprecatedLogger
let deprecatedLogger = deprecate(
Expand All @@ -65,7 +65,7 @@ let generateCapabilityStatement = ({

// Let's start building our confromance/capability statement
const serverStatement = {
mode: 'server'
mode: 'server',
};

// Add security information if available
Expand All @@ -77,14 +77,14 @@ let generateCapabilityStatement = ({
let operations = keys.reduce((ops, profile_name) => {
const opsInProfile = profiles[profile_name].operation;
if (opsInProfile && opsInProfile.length) {
opsInProfile.forEach(opInProfile => {
opsInProfile.forEach((opInProfile) => {
const op = {
name: opInProfile.name,
definition: {
reference: opInProfile.reference
? opInProfile.reference
: `/OperationOutcome/${opInProfile.name}`
}
: `/OperationOutcome/${opInProfile.name}`,
},
};
ops.push(op);
});
Expand All @@ -99,7 +99,7 @@ let generateCapabilityStatement = ({

// Make the resource and give it the version so it can only include valid search params
let customMakeResource = null;
serverStatement.resource = active_profiles.map(profile => {
serverStatement.resource = active_profiles.map((profile) => {
if (profile.metadata) {
customMakeResource = require(profile.metadata).makeResource;
} else {
Expand All @@ -122,5 +122,5 @@ let generateCapabilityStatement = ({
* @summary Metadata service
*/
module.exports = {
generateCapabilityStatement
generateCapabilityStatement,
};
Loading

0 comments on commit 20f5530

Please sign in to comment.