Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e93b686
commit 67d1bab
Showing
24 changed files
with
2,993 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
version: 2 | ||
jobs: | ||
build: | ||
working_directory: ~/mern-starter # directory where steps will run | ||
docker: # run the steps with Docker | ||
- image: circleci/node:8.11.3 | ||
steps: | ||
- checkout | ||
- run: | ||
name: update-npm | ||
command: 'sudo npm install -g npm@latest' | ||
- run: | ||
name: install-typescript | ||
command: sudo npm install -g typescript@latest | ||
- run: | ||
name: install-tslint | ||
command: sudo npm install -g tslint@latest | ||
- run: | ||
name: install-coveralls | ||
command: sudo npm install -g coveralls@latest | ||
- run: | ||
name: install-nyc | ||
command: sudo npm install -g nyc@latest | ||
- restore_cache: # special step to restore the dependency cache | ||
key: dependency-cache-{{ checksum "package.json" }} | ||
- run: | ||
name: install-deps | ||
command: npm install | ||
- save_cache: # special step to save the dependency cache | ||
key: dependency-cache-{{ checksum "package.json" }} | ||
paths: | ||
- ./node_modules | ||
- run: # run tslint | ||
name: test-code-coverage | ||
command: npm run lint | ||
- run: # run tests with code coverage | ||
name: test-code-coverage | ||
command: npm run coverage | ||
- run: # run coveralls report | ||
name: test-report-coveralls | ||
command: npm run coveralls |
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,10 @@ | ||
.vscode/ | ||
build/ | ||
node_modules/ | ||
|
||
# coverage | ||
.nyc_output/ | ||
coverage/ | ||
|
||
# Mac | ||
.DS_Store |
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,15 @@ | ||
.vscode/ | ||
test/ | ||
src/ | ||
|
||
# config files | ||
rollup.config.js | ||
tsconfig.json | ||
tslint.json | ||
|
||
# coverage | ||
.nyc_output/ | ||
coverage/ | ||
|
||
# ci | ||
.circleci/ |
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 |
---|---|---|
@@ -0,0 +1,93 @@ | ||
declare namespace XmlSchema { | ||
|
||
interface IEmptyConstructor<T> { | ||
new(): T; | ||
} | ||
|
||
type XmlParseType = Document | Element; | ||
|
||
interface IXmlConverter<Type, XmlType = any> { | ||
fromXML(value: XmlType, target: any): Type; | ||
toXML(value: Type, target: any): XmlType; | ||
} | ||
|
||
type IXmlAttributeConverter<T = any> = IXmlConverter<T, string>; | ||
type IXmlContentConverter<T = any> = IXmlConverter<T, string | null>; | ||
type IXmlItemConverter<T = any> = IXmlConverter<T, string | null>; | ||
|
||
interface IXmlConvertible { | ||
fromXML(xml: Element): this; | ||
toXML(): Element; | ||
} | ||
|
||
interface IXmlNamespaces { | ||
[prefix: string]: string; | ||
} | ||
|
||
interface IXmlSerializerOptions { | ||
name?: string; | ||
prefix?: string; | ||
namespaces?: IXmlNamespaces; | ||
} | ||
|
||
class XmlParser { | ||
public static parse<T>(data: string, schema: IEmptyConstructor<T>): T; | ||
public static fromXML<T>(target: XmlParseType, targetSchema: IEmptyConstructor<T>): T; | ||
} | ||
|
||
class XmlSerializer { | ||
public static serialize(obj: any, options?: IXmlSerializerOptions): string; | ||
public static toXML(obj: any, options?: IXmlSerializerOptions): Element; | ||
} | ||
|
||
interface IXmlElementOptions { | ||
/** | ||
* type of child element | ||
* - if value is empty, then child element is simple, use textContent from it | ||
* - if type is not empty, then use it's schema | ||
*/ | ||
type?: IEmptyConstructor<any>; | ||
optional?: boolean; | ||
defaultValue?: any; | ||
converter?: IXmlConverter<any, any>; | ||
repeated?: boolean; | ||
name?: string; | ||
prefix?: string; | ||
namespace?: string; | ||
} | ||
|
||
interface IXmlAttributeOptions { | ||
optional?: boolean; | ||
defaultValue?: any; | ||
converter?: IXmlAttributeConverter; | ||
name?: string; | ||
prefix?: string; | ||
namespace?: string; | ||
} | ||
|
||
interface IXmlTypeOptions { | ||
name?: string; | ||
prefix?: string; | ||
namespace?: string; | ||
} | ||
|
||
interface IXmlContentOptions { | ||
converter?: IXmlConverter<any, any>; | ||
} | ||
|
||
const XmlType: (options?: IXmlTypeOptions) => ClassDecorator; | ||
const XmlAttribute: (options?: IXmlAttributeOptions) => PropertyDecorator; | ||
const XmlElement: (options?: IXmlElementOptions) => PropertyDecorator; | ||
const XmlContent: (options?: IXmlContentOptions) => PropertyDecorator; | ||
|
||
const XmlStringConverter: IXmlConverter<string, string>; | ||
const XmlBooleanConverter: IXmlConverter<boolean, string>; | ||
const XmlHexBinaryConverter: IXmlConverter<ArrayBuffer, string>; | ||
const XmlBase64Converter: IXmlConverter<ArrayBuffer, string>; | ||
const XmlIntegerNumberConverter: IXmlConverter<number, string>; | ||
const XmlFloatNumberConverter: IXmlConverter<number, string>; | ||
const XmlDateTimeConverter: IXmlConverter<Date, string>; | ||
|
||
} | ||
|
||
export = XmlSchema; |
Oops, something went wrong.