@openstapps/core-converter
Advanced tools
Comparing version 0.0.1 to 0.1.0
@@ -1,2 +0,2 @@ | ||
## 0.0.1 (2018-11-29) | ||
# [0.1.0](https://gitlab.com/openstapps/core-converter/compare/v0.0.1...v0.1.0) (2018-11-29) | ||
@@ -6,2 +6,11 @@ | ||
* parameterize cli ([0ef3124](https://gitlab.com/openstapps/core-converter/commit/0ef3124)) | ||
## [0.0.1](https://gitlab.com/openstapps/core-converter/compare/2b1ab00...v0.0.1) (2018-11-29) | ||
### Features | ||
* add core converter ([2b1ab00](https://gitlab.com/openstapps/core-converter/commit/2b1ab00)) | ||
@@ -8,0 +17,0 @@ |
var typedoc = typedoc || {}; | ||
typedoc.search = typedoc.search || {}; | ||
typedoc.search.data = {"kinds":{"1":"External module","32":"Variable","64":"Function","128":"Class","256":"Interface","512":"Constructor","1024":"Property","2048":"Method","65536":"Type literal"},"rows":[{"id":0,"kind":1,"name":"\"converter\"","url":"modules/_converter_.html","classes":"tsd-kind-external-module"},{"id":1,"kind":256,"name":"SchemaWithDefinitions","url":"interfaces/_converter_.schemawithdefinitions.html","classes":"tsd-kind-interface tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"converter\""},{"id":2,"kind":1024,"name":"definitions","url":"interfaces/_converter_.schemawithdefinitions.html#definitions","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-overwrite tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":3,"kind":65536,"name":"__type","url":"interfaces/_converter_.schemawithdefinitions.html#definitions.__type","classes":"tsd-kind-type-literal tsd-parent-kind-property tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions.definitions"},{"id":4,"kind":1024,"name":"id","url":"interfaces/_converter_.schemawithdefinitions.html#id","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":5,"kind":1024,"name":"$schema","url":"interfaces/_converter_.schemawithdefinitions.html#_schema","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":6,"kind":1024,"name":"$ref","url":"interfaces/_converter_.schemawithdefinitions.html#_ref","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":7,"kind":1024,"name":"title","url":"interfaces/_converter_.schemawithdefinitions.html#title","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":8,"kind":1024,"name":"description","url":"interfaces/_converter_.schemawithdefinitions.html#description","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":9,"kind":1024,"name":"multipleOf","url":"interfaces/_converter_.schemawithdefinitions.html#multipleof","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":10,"kind":1024,"name":"maximum","url":"interfaces/_converter_.schemawithdefinitions.html#maximum","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":11,"kind":1024,"name":"exclusiveMaximum","url":"interfaces/_converter_.schemawithdefinitions.html#exclusivemaximum","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":12,"kind":1024,"name":"minimum","url":"interfaces/_converter_.schemawithdefinitions.html#minimum","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":13,"kind":1024,"name":"exclusiveMinimum","url":"interfaces/_converter_.schemawithdefinitions.html#exclusiveminimum","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":14,"kind":1024,"name":"maxLength","url":"interfaces/_converter_.schemawithdefinitions.html#maxlength","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":15,"kind":1024,"name":"minLength","url":"interfaces/_converter_.schemawithdefinitions.html#minlength","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":16,"kind":1024,"name":"pattern","url":"interfaces/_converter_.schemawithdefinitions.html#pattern","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":17,"kind":1024,"name":"additionalItems","url":"interfaces/_converter_.schemawithdefinitions.html#additionalitems","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":18,"kind":1024,"name":"items","url":"interfaces/_converter_.schemawithdefinitions.html#items","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":19,"kind":1024,"name":"maxItems","url":"interfaces/_converter_.schemawithdefinitions.html#maxitems","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":20,"kind":1024,"name":"minItems","url":"interfaces/_converter_.schemawithdefinitions.html#minitems","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":21,"kind":1024,"name":"uniqueItems","url":"interfaces/_converter_.schemawithdefinitions.html#uniqueitems","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":22,"kind":1024,"name":"maxProperties","url":"interfaces/_converter_.schemawithdefinitions.html#maxproperties","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":23,"kind":1024,"name":"minProperties","url":"interfaces/_converter_.schemawithdefinitions.html#minproperties","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":24,"kind":1024,"name":"required","url":"interfaces/_converter_.schemawithdefinitions.html#required","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":25,"kind":1024,"name":"additionalProperties","url":"interfaces/_converter_.schemawithdefinitions.html#additionalproperties","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":26,"kind":1024,"name":"properties","url":"interfaces/_converter_.schemawithdefinitions.html#properties","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":27,"kind":1024,"name":"patternProperties","url":"interfaces/_converter_.schemawithdefinitions.html#patternproperties","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":28,"kind":1024,"name":"dependencies","url":"interfaces/_converter_.schemawithdefinitions.html#dependencies","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":29,"kind":1024,"name":"enum","url":"interfaces/_converter_.schemawithdefinitions.html#enum","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":30,"kind":1024,"name":"type","url":"interfaces/_converter_.schemawithdefinitions.html#type","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":31,"kind":1024,"name":"format","url":"interfaces/_converter_.schemawithdefinitions.html#format","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":32,"kind":1024,"name":"allOf","url":"interfaces/_converter_.schemawithdefinitions.html#allof","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":33,"kind":1024,"name":"anyOf","url":"interfaces/_converter_.schemawithdefinitions.html#anyof","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":34,"kind":1024,"name":"oneOf","url":"interfaces/_converter_.schemawithdefinitions.html#oneof","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":35,"kind":1024,"name":"not","url":"interfaces/_converter_.schemawithdefinitions.html#not","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":36,"kind":128,"name":"SCConverter","url":"classes/_converter_.scconverter.html","classes":"tsd-kind-class tsd-parent-kind-external-module","parent":"\"converter\""},{"id":37,"kind":1024,"name":"generator","url":"classes/_converter_.scconverter.html#generator","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-private","parent":"\"converter\".SCConverter"},{"id":38,"kind":512,"name":"constructor","url":"classes/_converter_.scconverter.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"\"converter\".SCConverter"},{"id":39,"kind":2048,"name":"getSchema","url":"classes/_converter_.scconverter.html#getschema","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"converter\".SCConverter"},{"id":40,"kind":32,"name":"logger","url":"modules/_converter_.html#logger","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"converter\""},{"id":41,"kind":64,"name":"isSchemaWithDefinitions","url":"modules/_converter_.html#isschemawithdefinitions","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"converter\""},{"id":42,"kind":64,"name":"isString","url":"modules/_converter_.html#isstring","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"converter\""},{"id":43,"kind":64,"name":"isStringArray","url":"modules/_converter_.html#isstringarray","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"converter\""},{"id":44,"kind":64,"name":"convertFiles","url":"modules/_converter_.html#convertfiles","classes":"tsd-kind-function tsd-parent-kind-external-module","parent":"\"converter\""},{"id":45,"kind":1,"name":"\"cli\"","url":"modules/_cli_.html","classes":"tsd-kind-external-module"},{"id":46,"kind":32,"name":"pkgJson","url":"modules/_cli_.html#pkgjson","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"cli\""},{"id":47,"kind":32,"name":"logger","url":"modules/_cli_.html#logger","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"cli\""}]}; | ||
typedoc.search.data = {"kinds":{"1":"External module","32":"Variable","64":"Function","128":"Class","256":"Interface","512":"Constructor","1024":"Property","2048":"Method","65536":"Type literal"},"rows":[{"id":0,"kind":1,"name":"\"converter\"","url":"modules/_converter_.html","classes":"tsd-kind-external-module"},{"id":1,"kind":256,"name":"SchemaWithDefinitions","url":"interfaces/_converter_.schemawithdefinitions.html","classes":"tsd-kind-interface tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"converter\""},{"id":2,"kind":1024,"name":"definitions","url":"interfaces/_converter_.schemawithdefinitions.html#definitions","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-overwrite tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":3,"kind":65536,"name":"__type","url":"interfaces/_converter_.schemawithdefinitions.html#definitions.__type","classes":"tsd-kind-type-literal tsd-parent-kind-property tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions.definitions"},{"id":4,"kind":1024,"name":"id","url":"interfaces/_converter_.schemawithdefinitions.html#id","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":5,"kind":1024,"name":"$schema","url":"interfaces/_converter_.schemawithdefinitions.html#_schema","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":6,"kind":1024,"name":"$ref","url":"interfaces/_converter_.schemawithdefinitions.html#_ref","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":7,"kind":1024,"name":"title","url":"interfaces/_converter_.schemawithdefinitions.html#title","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":8,"kind":1024,"name":"description","url":"interfaces/_converter_.schemawithdefinitions.html#description","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":9,"kind":1024,"name":"multipleOf","url":"interfaces/_converter_.schemawithdefinitions.html#multipleof","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":10,"kind":1024,"name":"maximum","url":"interfaces/_converter_.schemawithdefinitions.html#maximum","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":11,"kind":1024,"name":"exclusiveMaximum","url":"interfaces/_converter_.schemawithdefinitions.html#exclusivemaximum","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":12,"kind":1024,"name":"minimum","url":"interfaces/_converter_.schemawithdefinitions.html#minimum","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":13,"kind":1024,"name":"exclusiveMinimum","url":"interfaces/_converter_.schemawithdefinitions.html#exclusiveminimum","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":14,"kind":1024,"name":"maxLength","url":"interfaces/_converter_.schemawithdefinitions.html#maxlength","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":15,"kind":1024,"name":"minLength","url":"interfaces/_converter_.schemawithdefinitions.html#minlength","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":16,"kind":1024,"name":"pattern","url":"interfaces/_converter_.schemawithdefinitions.html#pattern","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":17,"kind":1024,"name":"additionalItems","url":"interfaces/_converter_.schemawithdefinitions.html#additionalitems","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":18,"kind":1024,"name":"items","url":"interfaces/_converter_.schemawithdefinitions.html#items","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":19,"kind":1024,"name":"maxItems","url":"interfaces/_converter_.schemawithdefinitions.html#maxitems","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":20,"kind":1024,"name":"minItems","url":"interfaces/_converter_.schemawithdefinitions.html#minitems","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":21,"kind":1024,"name":"uniqueItems","url":"interfaces/_converter_.schemawithdefinitions.html#uniqueitems","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":22,"kind":1024,"name":"maxProperties","url":"interfaces/_converter_.schemawithdefinitions.html#maxproperties","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":23,"kind":1024,"name":"minProperties","url":"interfaces/_converter_.schemawithdefinitions.html#minproperties","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":24,"kind":1024,"name":"required","url":"interfaces/_converter_.schemawithdefinitions.html#required","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":25,"kind":1024,"name":"additionalProperties","url":"interfaces/_converter_.schemawithdefinitions.html#additionalproperties","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":26,"kind":1024,"name":"properties","url":"interfaces/_converter_.schemawithdefinitions.html#properties","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":27,"kind":1024,"name":"patternProperties","url":"interfaces/_converter_.schemawithdefinitions.html#patternproperties","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":28,"kind":1024,"name":"dependencies","url":"interfaces/_converter_.schemawithdefinitions.html#dependencies","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":29,"kind":1024,"name":"enum","url":"interfaces/_converter_.schemawithdefinitions.html#enum","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":30,"kind":1024,"name":"type","url":"interfaces/_converter_.schemawithdefinitions.html#type","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":31,"kind":1024,"name":"format","url":"interfaces/_converter_.schemawithdefinitions.html#format","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":32,"kind":1024,"name":"allOf","url":"interfaces/_converter_.schemawithdefinitions.html#allof","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":33,"kind":1024,"name":"anyOf","url":"interfaces/_converter_.schemawithdefinitions.html#anyof","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":34,"kind":1024,"name":"oneOf","url":"interfaces/_converter_.schemawithdefinitions.html#oneof","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":35,"kind":1024,"name":"not","url":"interfaces/_converter_.schemawithdefinitions.html#not","classes":"tsd-kind-property tsd-parent-kind-interface tsd-is-inherited tsd-is-not-exported","parent":"\"converter\".SchemaWithDefinitions"},{"id":36,"kind":128,"name":"SCConverter","url":"classes/_converter_.scconverter.html","classes":"tsd-kind-class tsd-parent-kind-external-module","parent":"\"converter\""},{"id":37,"kind":1024,"name":"generator","url":"classes/_converter_.scconverter.html#generator","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-private","parent":"\"converter\".SCConverter"},{"id":38,"kind":512,"name":"constructor","url":"classes/_converter_.scconverter.html#constructor","classes":"tsd-kind-constructor tsd-parent-kind-class","parent":"\"converter\".SCConverter"},{"id":39,"kind":2048,"name":"getSchema","url":"classes/_converter_.scconverter.html#getschema","classes":"tsd-kind-method tsd-parent-kind-class","parent":"\"converter\".SCConverter"},{"id":40,"kind":32,"name":"logger","url":"modules/_converter_.html#logger","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"converter\""},{"id":41,"kind":64,"name":"isSchemaWithDefinitions","url":"modules/_converter_.html#isschemawithdefinitions","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"converter\""},{"id":42,"kind":64,"name":"isString","url":"modules/_converter_.html#isstring","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"converter\""},{"id":43,"kind":64,"name":"isStringArray","url":"modules/_converter_.html#isstringarray","classes":"tsd-kind-function tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"converter\""},{"id":44,"kind":64,"name":"convertFiles","url":"modules/_converter_.html#convertfiles","classes":"tsd-kind-function tsd-parent-kind-external-module","parent":"\"converter\""},{"id":45,"kind":1,"name":"\"cli\"","url":"modules/_cli_.html","classes":"tsd-kind-external-module"},{"id":46,"kind":32,"name":"pkgJson","url":"modules/_cli_.html#pkgjson","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"cli\""},{"id":47,"kind":32,"name":"path","url":"modules/_cli_.html#path","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"cli\""},{"id":48,"kind":32,"name":"outDir","url":"modules/_cli_.html#outdir","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"cli\""},{"id":49,"kind":32,"name":"inDirs","url":"modules/_cli_.html#indirs","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"cli\""},{"id":50,"kind":32,"name":"logger","url":"modules/_cli_.html#logger","classes":"tsd-kind-variable tsd-parent-kind-external-module tsd-is-not-exported","parent":"\"cli\""}]}; |
@@ -1,15 +0,1 @@ | ||
/* | ||
* Copyright (C) 2018 StApps | ||
* This program is free software: you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the Free | ||
* Software Foundation, version 3. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with | ||
* this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
export {}; |
#!/usr/bin/env node | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
* Copyright (C) 2018 StApps | ||
* This program is free software: you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the Free | ||
* Software Foundation, version 3. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with | ||
* this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
const logger_1 = require("@openstapps/logger"); | ||
@@ -10,2 +24,5 @@ const commander = require("commander"); | ||
const pkgJson = JSON.parse(fs_1.readFileSync(path_1.join(__dirname, '..', 'package.json')).toString()); | ||
let path = ''; | ||
let outDir = ''; | ||
let inDirs = []; | ||
const logger = new logger_1.Logger(); | ||
@@ -16,8 +33,8 @@ commander | ||
.description('create JSON schema files from TypeScript models') | ||
.option('-p, --path [path]', 'Path to schema files', './') | ||
.action((cmd) => { | ||
converter_1.convertFiles(cmd.path, [ | ||
'things', | ||
'protocol/**', | ||
]).then(() => { | ||
.arguments('<path> <outdir> <indirs...>') | ||
.action((p, o, i) => { | ||
path = p; | ||
outDir = o; | ||
inDirs = i; | ||
converter_1.convertFiles(path, inDirs, outDir).then(() => { | ||
logger.ok('Finished conversion.'); | ||
@@ -29,2 +46,8 @@ }, (err) => { | ||
commander.parse(process.argv); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xpLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2NsaS50cyJdLCJuYW1lc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UFFO1FBQzNDLE1BQU0sQ0FBQyxFQUFFLENBQUMsc0JBQXNCLENBQUMsQ0FBQztJQUNwQyxDQUFDLEVBQUUsQ0FBQyxHQUFVLEVBQUUsRUFBRTtRQUNoQixNQUFNLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFDO0lBQ3BCLENBQUMsQ0FBQyxDQUFDO0FBQ0wsQ0FBQyxDQUFDLENBQUM7QUFFTCxTQUFTLENBQUMsS0FBSyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQztBQUU5QixDQUFDLElBQUksRUFBRSxNQUFNLEVBQUUsTUFBTSxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUMsR0FBRyxFQUFFLEVBQUU7SUFDckMsSUFBSSxHQUFHLENBQUMsTUFBTSxLQUFLLENBQUMsRUFBRTtRQUNwQixNQUFNLENBQUMsS0FBSyxDQUFDLHlCQUF5QixDQUFDLENBQUM7UUFDeEMsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQztLQUNqQjtBQUNILENBQUMsQ0FBQyxDQUFDIn0= |
@@ -1,15 +0,1 @@ | ||
/* | ||
* Copyright (C) 2018 StApps | ||
* This program is free software: you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the Free | ||
* Software Foundation, version 3. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with | ||
* this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
import { Schema as JSONSchema } from 'jsonschema'; | ||
@@ -26,5 +12,5 @@ /** | ||
* | ||
* @param {string=} path Path to the project | ||
* @param path Path to the project | ||
*/ | ||
constructor(path?: string); | ||
constructor(path: string); | ||
/** | ||
@@ -42,6 +28,7 @@ * Get schema for specific StAppsCore type | ||
* | ||
* @param givenPath {string} Path to project | ||
* @param givenDirectories {string[]} Directories (relative paths to the path argument) to get source files from | ||
* @returns {Promise<number>} Promise that resolves with the amount of converted files | ||
* @param path Path to the project (where used *.ts files are, e.g. 'src/core') | ||
* @param inputDirs Directories (relative paths) to get source files from | ||
* @param outputDir Directory (relative path) to save output files to | ||
* @returns Promise that resolves with the amount of converted files | ||
*/ | ||
export declare function convertFiles(givenPath?: string, givenDirectories?: string[]): Promise<number>; | ||
export declare function convertFiles(path: string, inputDirs: string[], outputDir: string): Promise<number>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* | ||
* Copyright (C) 2018 StApps | ||
* This program is free software: you can redistribute it and/or modify it | ||
* under the terms of the GNU General Public License as published by the Free | ||
* Software Foundation, version 3. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
* more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with | ||
* this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
const logger_1 = require("@openstapps/logger"); | ||
@@ -21,3 +35,3 @@ const async_1 = require("async"); | ||
function isStringArray(obj) { | ||
return Array.isArray(obj) && obj.every((str) => typeof str === 'string'); | ||
return Array.isArray(obj) && obj.length > 0 && obj.every((str) => typeof str === 'string'); | ||
} | ||
@@ -33,9 +47,5 @@ /** | ||
* | ||
* @param {string=} path Path to the project | ||
* @param path Path to the project | ||
*/ | ||
constructor(path) { | ||
// set default value for path | ||
if (typeof path !== 'string') { | ||
path = path_1.join(__dirname, '..'); | ||
} | ||
// set config for schema generator | ||
@@ -45,3 +55,3 @@ const config = Object.assign({}, ts_json_schema_generator_1.DEFAULT_CONFIG, { | ||
// jsDoc: 'extended' as any, | ||
path: path_1.join(path, 'src', 'core', '**/*.ts'), sortProps: true, topRef: false, type: 'SC' }); | ||
path: path_1.join(path, '**/*.ts'), sortProps: true, topRef: false, type: 'SC' }); | ||
// create TypeScript program from config | ||
@@ -75,29 +85,22 @@ const program = program_1.createProgram(config); | ||
* | ||
* @param givenPath {string} Path to project | ||
* @param givenDirectories {string[]} Directories (relative paths to the path argument) to get source files from | ||
* @returns {Promise<number>} Promise that resolves with the amount of converted files | ||
* @param path Path to the project (where used *.ts files are, e.g. 'src/core') | ||
* @param inputDirs Directories (relative paths) to get source files from | ||
* @param outputDir Directory (relative path) to save output files to | ||
* @returns Promise that resolves with the amount of converted files | ||
*/ | ||
function convertFiles(givenPath, givenDirectories) { | ||
let path; | ||
// set default value for path | ||
if (!isString(givenPath)) { | ||
path = path_1.join(__dirname, '..'); | ||
function convertFiles(path, inputDirs, outputDir) { | ||
// check if correct source directories paths are provided | ||
if (!isStringArray(inputDirs)) { | ||
return Promise.reject('Invalid source directories provided'); | ||
} | ||
else { | ||
path = givenPath; | ||
// check if correct output directory path is provided | ||
if (!isString(outputDir)) { | ||
return Promise.reject('Invalid output directory provided'); | ||
} | ||
let directories; | ||
// set default value for directories | ||
if (!isStringArray(givenDirectories)) { | ||
directories = ['things']; | ||
} | ||
else { | ||
directories = givenDirectories; | ||
} | ||
return new Promise((promiseResolve, promiseReject) => { | ||
// read package json | ||
const pkgJson = JSON.parse(fs_1.readFileSync(path_1.join(path, 'package.json')).toString()); | ||
const pkgJson = JSON.parse(fs_1.readFileSync('package.json').toString()); | ||
// create schema directory if it does not exist | ||
if (!fs_1.existsSync(path_1.join(path, 'lib', 'schema'))) { | ||
fs_1.mkdirSync(path_1.join(path, 'lib', 'schema')); | ||
if (!fs_1.existsSync(outputDir)) { | ||
fs_1.mkdirSync(outputDir); | ||
} | ||
@@ -110,5 +113,5 @@ logger.info('Create a new converter...'); | ||
// convert things and query (protocol) types (validation of the input from the client) | ||
async_1.each(directories, (directory, callback) => { | ||
async_1.each(inputDirs, (inputDir, callback) => { | ||
// find all TypeScript files in path | ||
glob(path_1.resolve(path, 'src', 'core', directory, '*.ts'), {}, (err, files) => { | ||
glob(path_1.resolve(inputDir, '**/*.ts'), {}, (err, files) => { | ||
if (err) { | ||
@@ -126,4 +129,4 @@ promiseReject(err); | ||
// write schema to file | ||
fs.writeFileSync(path_1.join(path, 'lib', 'schema', type + '.json'), stringifiedSchema); | ||
logger.log('Converted ' + file + ' and saved as `' + path_1.join(path, 'lib', 'schema', type + '.json') + '`.'); | ||
fs.writeFileSync(path_1.join(outputDir, type + '.json'), stringifiedSchema); | ||
logger.log('Converted ' + file + ' and saved as `' + path_1.join(outputDir, type + '.json') + '`.'); | ||
totalFiles = totalFiles + files.length; | ||
@@ -145,2 +148,2 @@ }); | ||
exports.convertFiles = convertFiles; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udmVydGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2NvbnZlcnRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLCtDQUEwQztBQUMxQyxpQ0FBMkI7QUFDM0IseUJBQXlCO0FBQ3pCLDJCQUF1RDtBQUN2RCw2QkFBNkI7QUFFN0IsK0JBQTZDO0FBQzdDLHVFQUFxRjtBQUNyRiwrRUFBZ0Y7QUFDaEYseUVBQTBFO0FBQzFFLDJFQUE0RTtBQUc1RSxNQUFNLE1BQU0sR0FBRyxJQUFJLGVBQU0sRUFBRSxDQUFDO0FBTTVCLFNBQVMsdUJBQXVCLENBQUMsTUFBa0I7SUFDakQsT0FBTyxPQUFPLE1BQU0sQ0FBQyxXQUFXLEtBQUssV0FBVyxDQUFDO0FBQ25ELENBQUM7QUFFRCxTQUFTLFFBQVEsQ0FBQyxHQUF1QjtJQUN2QyxPQUFPLE9BQU8sR0FBRyxLQUFLLFFBQVEsQ0FBQztBQUNqQyxDQUFDO0FBRUQsU0FBUyxhQUFhLENBQUMsR0FBeUI7SUFDOUMsT0FBTyxLQUFLLENBQUMsT0FBTyxDQUFD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QUFDLEdBQUcsSUFBSSxDQUFDLENBQUM7b0JBQzdGLFVBQVUsR0FBRyxVQUFVLEdBQUcsS0FBSyxDQUFDLE1BQU0sQ0FBQztnQkFDekMsQ0FBQyxDQUFDLENBQUM7Z0JBQ0gsUUFBUSxFQUFFLENBQUM7WUFDYixDQUFDLENBQUMsQ0FBQztRQUNMLENBQUMsRUFBRSxDQUFDLEdBQUcsRUFBRSxFQUFFO1lBQ1QsSUFBSSxHQUFHLEVBQUU7Z0JBQ1AsYUFBYSxDQUFDLEdBQUcsQ0FBQyxDQUFDO2dCQUNuQixPQUFPO2FBQ1I7aUJBQU07Z0JBQ0wsY0FBYyxDQUFDLFVBQVUsQ0FBQyxDQUFDO2FBQzVCO1FBQ0gsQ0FBQyxDQUFDLENBQUM7SUFDTCxDQUFDLENBQUMsQ0FBQztBQUNMLENBQUM7QUEvREQsb0NBK0RDIn0= |
{ | ||
"name": "@openstapps/core-converter", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "StAppsCore Converter - converter of TypeScript models into JSON schema files", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -18,1 +18,26 @@ # README | ||
JSON schema files are needed for run-time validation of SC-type objects, as this is a tedious task to do using SC-types defined in TypeScript (not possible without additional coding). That said, StAppsCore Converter practically prepares SC-types to be used for object validation (determining wether an JavaScript/JSON object is a valid object of the corresponding SC-type) using StAppsCore Validator. | ||
## How to use StAppsCore Converter? | ||
Installation of the npm package (using `npm install`) makes the tool available as an executable with the name `stapps-convert`. | ||
The command `stapps-convert` can then be called using 3 required arguments: | ||
```bash | ||
node_modules/.bin/stapps-convert <path> <outdir> <indirs...> | ||
``` | ||
where: | ||
- `<path>` is path to the project (where used *.ts files are, e.g. 'src/core', | ||
- `<outdir>` is directory (relative path) to save output files to, e.g. `lib/schema`, | ||
- `<indirs...>` are directories (relative paths) to get source files from, e.g. `src/core/things` `src/core/protocol/`. | ||
Complete command with the example arguments is then: | ||
```bash | ||
node_modules/.bin/stapps-convert src/core lib/schema src/core/things src/core/protocol/ | ||
``` | ||
Inside of a script in `package.json` or if the npm package is installed globally, the tool `stapps-convert` can be called without its local path (`node_modules/.bin`): | ||
```bash | ||
stapps-convert <path> <outdir> <indirs...> | ||
``` |
@@ -22,2 +22,5 @@ /* | ||
const pkgJson = JSON.parse(readFileSync(join(__dirname, '..', 'package.json')).toString()); | ||
let path: string = ''; | ||
let outDir: string = ''; | ||
let inDirs: string[] = []; | ||
@@ -31,8 +34,8 @@ const logger = new Logger(); | ||
.description('create JSON schema files from TypeScript models') | ||
.option('-p, --path [path]', 'Path to schema files', './') | ||
.action((cmd) => { | ||
convertFiles(cmd.path, [ | ||
'things', | ||
'protocol/**', | ||
]).then(() => { | ||
.arguments('<path> <outdir> <indirs...>') | ||
.action((p, o, i) => { | ||
path = p; | ||
outDir = o; | ||
inDirs = i; | ||
convertFiles(path, inDirs, outDir).then(() => { | ||
logger.ok('Finished conversion.'); | ||
@@ -45,1 +48,8 @@ }, (err: Error) => { | ||
commander.parse(process.argv); | ||
[path, outDir, inDirs].forEach((arg) => { | ||
if (arg.length === 0) { | ||
logger.error('Arguments are required.'); | ||
process.exit(1); | ||
} | ||
}); |
@@ -43,3 +43,3 @@ /* | ||
function isStringArray(obj: string[] | undefined): obj is string[] { | ||
return Array.isArray(obj) && obj.every((str) => typeof str === 'string'); | ||
return Array.isArray(obj) && obj.length > 0 && obj.every((str) => typeof str === 'string'); | ||
} | ||
@@ -58,10 +58,5 @@ | ||
* | ||
* @param {string=} path Path to the project | ||
* @param path Path to the project | ||
*/ | ||
constructor(path?: string) { | ||
// set default value for path | ||
if (typeof path !== 'string') { | ||
path = join(__dirname, '..'); | ||
} | ||
constructor(path: string) { | ||
// set config for schema generator | ||
@@ -72,3 +67,3 @@ const config = { | ||
// jsDoc: 'extended' as any, | ||
path: join(path, 'src', 'core', '**/*.ts'), | ||
path: join(path, '**/*.ts'), | ||
sortProps: true, | ||
@@ -116,24 +111,16 @@ topRef: false, | ||
* | ||
* @param givenPath {string} Path to project | ||
* @param givenDirectories {string[]} Directories (relative paths to the path argument) to get source files from | ||
* @returns {Promise<number>} Promise that resolves with the amount of converted files | ||
* @param path Path to the project (where used *.ts files are, e.g. 'src/core') | ||
* @param inputDirs Directories (relative paths) to get source files from | ||
* @param outputDir Directory (relative path) to save output files to | ||
* @returns Promise that resolves with the amount of converted files | ||
*/ | ||
export function convertFiles(givenPath?: string, givenDirectories?: string[]): Promise<number> { | ||
let path: string; | ||
// set default value for path | ||
if (!isString(givenPath)) { | ||
path = join(__dirname, '..'); | ||
} else { | ||
path = givenPath; | ||
export function convertFiles(path: string, inputDirs: string[], outputDir: string): Promise<number> { | ||
// check if correct source directories paths are provided | ||
if (!isStringArray(inputDirs)) { | ||
return Promise.reject('Invalid source directories provided'); | ||
} | ||
let directories: string[]; | ||
// set default value for directories | ||
if (!isStringArray(givenDirectories)) { | ||
directories = ['things']; | ||
} else { | ||
directories = givenDirectories; | ||
// check if correct output directory path is provided | ||
if (!isString(outputDir)) { | ||
return Promise.reject('Invalid output directory provided'); | ||
} | ||
@@ -143,7 +130,7 @@ | ||
// read package json | ||
const pkgJson = JSON.parse(readFileSync(join(path, 'package.json')).toString()); | ||
const pkgJson = JSON.parse(readFileSync('package.json').toString()); | ||
// create schema directory if it does not exist | ||
if (!existsSync(join(path, 'lib', 'schema'))) { | ||
mkdirSync(join(path, 'lib', 'schema')); | ||
if (!existsSync(outputDir)) { | ||
mkdirSync(outputDir); | ||
} | ||
@@ -159,5 +146,5 @@ | ||
// convert things and query (protocol) types (validation of the input from the client) | ||
each(directories, (directory, callback) => { | ||
each(inputDirs, (inputDir, callback) => { | ||
// find all TypeScript files in path | ||
glob(resolve(path, 'src', 'core', directory, '*.ts'), {}, (err, files) => { | ||
glob(resolve(inputDir, '**/*.ts'), {}, (err, files) => { | ||
if (err) { | ||
@@ -179,5 +166,5 @@ promiseReject(err); | ||
// write schema to file | ||
fs.writeFileSync(join(path, 'lib', 'schema', type + '.json'), stringifiedSchema); | ||
fs.writeFileSync(join(outputDir, type + '.json'), stringifiedSchema); | ||
logger.log('Converted ' + file + ' and saved as `' + join(path, 'lib', 'schema', type + '.json') + '`.'); | ||
logger.log('Converted ' + file + ' and saved as `' + join(outputDir, type + '.json') + '`.'); | ||
totalFiles = totalFiles + files.length; | ||
@@ -184,0 +171,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
542807
43
3391