-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from openactive/feature/restructure
- Loading branch information
Showing
57 changed files
with
74 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,3 +74,6 @@ typings/ | |
|
||
# OSX | ||
.DS_Store | ||
|
||
# Editor | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Tests | ||
spec | ||
src/**/*[sS]pec.js | ||
|
||
# Build scripts | ||
scripts | ||
|
||
# CI | ||
.travis.yml | ||
.nvmrc | ||
|
||
# Linters | ||
.eslintrc* | ||
|
||
# Editor settings | ||
.editorconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,12 @@ | ||
const contexts = require('./dist/contexts'); | ||
const versions = require('./versions'); | ||
const deriveVersion = require('./helpers/deriveVersion'); | ||
|
||
const getContext = (version) => { | ||
let localVersion = version; | ||
if (typeof localVersion === 'undefined') { | ||
localVersion = 'latest'; | ||
} | ||
if ( | ||
typeof versions[localVersion] === 'undefined' | ||
|| typeof contexts[versions[localVersion]] === 'undefined' | ||
) { | ||
const specVersion = deriveVersion(version); | ||
if (typeof contexts[specVersion] === 'undefined') { | ||
throw Error('Invalid specification version supplied'); | ||
} | ||
return contexts[versions[localVersion]]; | ||
return contexts[specVersion]; | ||
}; | ||
|
||
module.exports = getContext; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,15 @@ | ||
const specs = require('./dist/specs'); | ||
const versions = require('./versions'); | ||
const deriveVersion = require('./helpers/deriveVersion'); | ||
|
||
const getMetaData = (version) => { | ||
let localVersion = version; | ||
if (typeof localVersion === 'undefined') { | ||
localVersion = 'latest'; | ||
} | ||
const specVersion = deriveVersion(version); | ||
if ( | ||
typeof versions[localVersion] === 'undefined' | ||
|| typeof specs[versions[localVersion]] === 'undefined' | ||
|| typeof specs[versions[localVersion]].meta === 'undefined' | ||
typeof specs[specVersion] === 'undefined' | ||
|| typeof specs[specVersion].meta === 'undefined' | ||
) { | ||
throw Error('Invalid specification version supplied'); | ||
throw Error(`Invalid specification version "${specVersion}" supplied`); | ||
} | ||
return specs[versions[localVersion]].meta; | ||
return specs[specVersion].meta; | ||
}; | ||
|
||
module.exports = getMetaData; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const versions = require('../versions'); | ||
|
||
const deriveVersion = (version) => { | ||
let localVersion = version; | ||
if (typeof localVersion === 'undefined') { | ||
localVersion = 'latest'; | ||
} | ||
if (Object.values(versions).indexOf(localVersion) >= 0) { | ||
return localVersion; | ||
} | ||
if (typeof versions[localVersion] !== 'undefined') { | ||
return versions[localVersion]; | ||
} | ||
|
||
throw Error(`Invalid specification version "${version}" supplied`); | ||
}; | ||
|
||
module.exports = deriveVersion; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,10 @@ | ||
const versions = require('../versions'); | ||
const deriveVersion = require('./deriveVersion'); | ||
|
||
const loadModelCheckArgs = (name, version) => { | ||
if (!name.match(/^[A-Za-z]+$/) || name === 'model_list') { | ||
throw Error('Invalid model name supplied'); | ||
} | ||
let localVersion = version; | ||
if (typeof localVersion === 'undefined') { | ||
localVersion = 'latest'; | ||
} | ||
if (typeof versions[localVersion] === 'undefined') { | ||
throw Error('Invalid specification version supplied'); | ||
} | ||
return versions[localVersion]; | ||
return deriveVersion(version); | ||
}; | ||
|
||
module.exports = loadModelCheckArgs; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module.exports = { | ||
latest: '2.0', | ||
'2.0': '2.0', | ||
latest: '2.x', | ||
'2.0': '2.x', | ||
}; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.