Compare commits

..

14 Commits

Author SHA1 Message Date
a580ba53dd 1.0.21 2018-06-09 15:28:47 +02:00
e194e2a3b6 fix(packagename): fix packagename 2018-06-09 15:28:47 +02:00
0c2ded6288 1.0.20 2018-06-09 15:15:54 +02:00
6742e3ca73 fix(snyk): give snyk something to test 2018-06-09 15:15:54 +02:00
e2deb4f7b3 1.0.19 2018-06-09 15:11:38 +02:00
0d48aa8b00 BREAKING CHANGE(scope): change cope 2018-06-09 15:11:37 +02:00
bfc646c308 1.0.18 2017-11-09 12:41:51 +01:00
ab008d16e8 break out address from contact 2017-11-09 12:41:49 +01:00
7f5b86864d 1.0.17 2017-11-09 12:13:29 +01:00
825148442b update Invoice interface 2017-11-09 12:13:27 +01:00
2a18ec1555 1.0.16 2017-11-09 02:20:25 +01:00
c5284ff813 update internal structure 2017-11-09 02:20:21 +01:00
498934237d 1.0.15 2017-11-09 02:17:00 +01:00
ac73badd76 update ci 2017-11-09 02:16:56 +01:00
22 changed files with 289 additions and 74 deletions

View File

@ -3,23 +3,39 @@ image: hosttoday/ht-docker-node:npmci
cache: cache:
paths: paths:
- .yarn/ - .npmci_cache/
key: "$CI_BUILD_STAGE" key: "$CI_BUILD_STAGE"
stages: stages:
- mirror - security
- test - test
- release - release
- trigger - metadata
- pages
# ====================
# security stage
# ====================
mirror: mirror:
stage: mirror stage: security
script: script:
- npmci git mirror - npmci git mirror
tags: tags:
- docker - docker
- notpriv
snyk:
stage: security
script:
- npmci command npm install -g snyk
- npmci command npm install --ignore-scripts
- npmci command snyk test
tags:
- docker
- notpriv
# ====================
# test stage
# ====================
testLEGACY: testLEGACY:
stage: test stage: test
script: script:
@ -29,6 +45,7 @@ testLEGACY:
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
- notpriv
allow_failure: true allow_failure: true
testLTS: testLTS:
@ -40,6 +57,7 @@ testLTS:
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
- notpriv
testSTABLE: testSTABLE:
stage: test stage: test
@ -50,34 +68,60 @@ testSTABLE:
coverage: /\d+.?\d+?\%\s*coverage/ coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
- notpriv
release: release:
stage: release stage: release
script: script:
- npmci npm prepare - npmci node install stable
- npmci npm publish - npmci npm publish
only: only:
- tags - tags
tags: tags:
- docker - docker
- notpriv
# ====================
# metadata stage
# ====================
codequality:
stage: metadata
image: docker:stable
allow_failure: true
services:
- docker:stable-dind
script:
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
- docker run
--env SOURCE_CODE="$PWD"
--volume "$PWD":/code
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
artifacts:
paths: [codeclimate.json]
tags:
- docker
- priv
trigger: trigger:
stage: trigger stage: metadata
script: script:
- npmci trigger - npmci trigger
only: only:
- tags - tags
tags: tags:
- docker - docker
- notpriv
pages: pages:
image: hosttoday/ht-docker-node:npmci image: hosttoday/ht-docker-node:npmci
stage: pages stage: metadata
script: script:
- npmci command yarn global add npmpage - npmci command npm install -g npmpage
- npmci command npmpage - npmci command npmpage
tags: tags:
- docker - docker
- notpriv
only: only:
- tags - tags
artifacts: artifacts:

View File

@ -1,13 +1,16 @@
# tsclass # tsclass
common classes for TypeScript common classes for TypeScript
## Availabililty ## Availabililty
[![npm](https://tsclass.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/tsclass) [![npm](https://tsclass.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/tsclass)
[![git](https://tsclass.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/tsclass/tsclass) [![git](https://tsclass.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/tsclass/tsclass)
[![git](https://tsclass.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/tsclass/tsclass) [![git](https://tsclass.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/tsclass/tsclass)
[![docs](https://tsclass.gitlab.io/assets/repo-button-docs.svg)](https://tsclass.gitlab.io/tsclass/) [![docs](https://tsclass.gitlab.io/assets/repo-button-docs.svg)](https://tsclass.gitlab.io/tsclass/)
## Status for master ## Status for master
[![build status](https://GitLab.com/tsclass/tsclass/badges/master/build.svg)](https://GitLab.com/tsclass/tsclass/commits/master) [![build status](https://GitLab.com/tsclass/tsclass/badges/master/build.svg)](https://GitLab.com/tsclass/tsclass/commits/master)
[![coverage report](https://GitLab.com/tsclass/tsclass/badges/master/coverage.svg)](https://GitLab.com/tsclass/tsclass/commits/master) [![coverage report](https://GitLab.com/tsclass/tsclass/badges/master/coverage.svg)](https://GitLab.com/tsclass/tsclass/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/tsclass.svg)](https://www.npmjs.com/package/tsclass) [![npm downloads per month](https://img.shields.io/npm/dm/tsclass.svg)](https://www.npmjs.com/package/tsclass)
@ -19,39 +22,41 @@ common classes for TypeScript
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) [![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
## Usage ## Usage
Use TypeScript for best in class instellisense. Use TypeScript for best in class instellisense.
tsclass exposes many commonly used objects as interface to implement (-> extends keyword) by individual implementations. tsclass exposes many commonly used objects as interface to implement (-> extends keyword) by individual implementations.
They come complete with best in class intellisense and are easy to require. They come complete with best in class intellisense and are easy to require.
```javascript ```javascript
import { IInvoice } from 'tsclass' import { IInvoice } from 'tsclass';
class myOwnInvoice implements IInvoice { class myOwnInvoice implements IInvoice {
constructor(){ constructor() {
super() // you need to call super() in the constructor super(); // you need to call super() in the constructor
} }
} }
``` ```
### Time/Date ### Time/Date
* Date
* Time - Date
- Time
### Publications/Websites/Blogs ### Publications/Websites/Blogs
* Article
* Author - Article
- Author
### Finance ### Finance
* Invoice
- Invoice
> The modules in bold letters exist as own modules and can be used seperately > The modules in bold letters exist as own modules and can be used seperately
For further information read the linked docs at the top of this README. For further information read the linked docs at the top of this README.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) > MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html) > | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
[![repo-footer](https://tsclass.gitlab.io/assets/repo-footer.svg)](https://push.rocks) [![repo-footer](https://tsclass.gitlab.io/assets/repo-footer.svg)](https://push.rocks)

8
dist/business/address.d.ts vendored Normal file
View File

@ -0,0 +1,8 @@
export interface IAddress {
name?: string;
streetName: string;
houseNumber: string;
postalCode: string;
city: string;
country: string;
}

3
dist/business/address.js vendored Normal file
View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRkcmVzcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3RzL2J1c2luZXNzL2FkZHJlc3MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9

View File

@ -1,3 +1,13 @@
import { IAddress } from '../index';
export declare type TContactSalutation = 'Mr' | 'Ms' | 'Mrs';
export declare type TContactType = 'person' | 'company';
export declare type TContactTitle = 'Doctor' | 'Professor';
export interface IContact { export interface IContact {
salutation?: TContactSalutation;
type: TContactType;
title: TContactTitle;
name: string; name: string;
address: IAddress;
vatId?: string;
accountNumber?: string;
} }

View File

@ -1,3 +1,4 @@
import { IContact } from '../index';
export declare type TInvoiceStatus = 'draft' | 'invoice' | 'paid' | 'refunded'; export declare type TInvoiceStatus = 'draft' | 'invoice' | 'paid' | 'refunded';
export interface IInvoiceItem { export interface IInvoiceItem {
name: string; name: string;
@ -6,5 +7,8 @@ export interface IInvoiceItem {
vatPercentage: number; vatPercentage: number;
} }
export interface IInvoice { export interface IInvoice {
billedBy: IContact;
billedTo: IContact;
status: TInvoiceStatus; status: TInvoiceStatus;
items: IInvoiceItem[];
} }

1
dist/index.d.ts vendored
View File

@ -1,3 +1,4 @@
export * from './business/address';
export * from './business/company'; export * from './business/company';
export * from './business/contact'; export * from './business/contact';
export * from './business/invoice'; export * from './business/invoice';

View File

@ -1,7 +1,8 @@
{ {
"npmci": { "npmci": {
"globalNpmTools": [ "npmGlobalTools": [
"npmts" "npmts"
] ],
"npmAccessLevel": "public"
} }
} }

108
package-lock.json generated Normal file
View File

@ -0,0 +1,108 @@
{
"name": "tsclass",
"version": "1.0.21",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@gitzone/tsrun": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/@gitzone/tsrun/-/tsrun-1.0.5.tgz",
"integrity": "sha512-zSiRnlvNAlBmrqknwH9B0gIRx7IEegPzmN+DZ4yN3f+L62WlVbKyPLeeV09SKE8BFiGo+0VIGiQW3EV/9mXMfw==",
"dev": true,
"requires": {
"ts-node": "^6.1.0",
"typescript": "^2.9.1"
}
},
"arrify": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz",
"integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=",
"dev": true
},
"buffer-from": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.0.tgz",
"integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ==",
"dev": true
},
"diff": {
"version": "3.5.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz",
"integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==",
"dev": true
},
"make-error": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.4.tgz",
"integrity": "sha512-0Dab5btKVPhibSalc9QGXb559ED7G7iLjFXBaj9Wq8O3vorueR5K5jaE3hkG6ZQINyhA/JgG6Qk4qdFQjsYV6g==",
"dev": true
},
"minimist": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
"dev": true
},
"mkdirp": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
"dev": true,
"requires": {
"minimist": "0.0.8"
},
"dependencies": {
"minimist": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=",
"dev": true
}
}
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
},
"source-map-support": {
"version": "0.5.6",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.6.tgz",
"integrity": "sha512-N4KXEz7jcKqPf2b2vZF11lQIz9W5ZMuUcIOGj243lduidkf2fjkVKJS9vNxVWn3u/uxX38AcE8U9nnH9FPcq+g==",
"dev": true,
"requires": {
"buffer-from": "^1.0.0",
"source-map": "^0.6.0"
}
},
"ts-node": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-6.1.0.tgz",
"integrity": "sha512-mw11Bq08RZgrU/bzcVw/Ti9wNyefpOanXgWsHg008wyVHjvFhWxNatVVrciOAu8BcWSECoNOSunRzUokKH8Mmw==",
"dev": true,
"requires": {
"arrify": "^1.0.0",
"diff": "^3.1.0",
"make-error": "^1.1.1",
"minimist": "^1.2.0",
"mkdirp": "^0.5.1",
"source-map-support": "^0.5.6",
"yn": "^2.0.0"
}
},
"typescript": {
"version": "2.9.1",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.1.tgz",
"integrity": "sha512-h6pM2f/GDchCFlldnriOhs1QHuwbnmj6/v7499eMHqPeW4V2G0elua2eIc2nu8v2NdHV0Gm+tzX83Hr6nUFjQA==",
"dev": true
},
"yn": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz",
"integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=",
"dev": true
}
}
}

View File

@ -1,11 +1,13 @@
{ {
"name": "tsclass", "name": "@tsclass/tsclass",
"version": "1.0.14", "version": "1.0.21",
"private": false,
"description": "common classes for TypeScript", "description": "common classes for TypeScript",
"main": "dist/index.js", "main": "dist/index.js",
"typings": "dist/index.d.ts", "typings": "dist/index.d.ts",
"scripts": { "scripts": {
"test": "(npmts --notest)" "test": "(npmts --notest)",
"build": "echo \"Not needed for now\""
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -20,5 +22,9 @@
"bugs": { "bugs": {
"url": "https://github.com/tsclass/tsclass/issues" "url": "https://github.com/tsclass/tsclass/issues"
}, },
"homepage": "https://github.com/tsclass/tsclass#readme" "homepage": "https://github.com/tsclass/tsclass#readme",
"dependencies": {},
"devDependencies": {
"@gitzone/tsrun": "^1.0.5"
}
} }

0
test/test.ts Normal file
View File

8
ts/business/address.ts Normal file
View File

@ -0,0 +1,8 @@
export interface IAddress {
name?: string;
streetName: string;
houseNumber: string;
postalCode: string;
city: string;
country: string;
}

View File

@ -1,17 +1,17 @@
import { IContact } from '../index' import { IContact } from '../index';
import { IDate } from '../index' import { IDate } from '../index';
/** /**
* describes a company's lifecycle state * describes a company's lifecycle state
*/ */
export type TCompanyStatus = 'planed' | 'founding' | 'active' | 'liquidation' | 'closed' export type TCompanyStatus = 'planed' | 'founding' | 'active' | 'liquidation' | 'closed';
/** /**
* describes a company * describes a company
*/ */
export interface ICompany { export interface ICompany {
name: string name: string;
foundedDate: IDate foundedDate: IDate;
closedDate: IDate closedDate: IDate;
status: TCompanyStatus status: TCompanyStatus;
} }

View File

@ -1,4 +1,24 @@
import { IAddress } from '../index';
export type TContactSalutation = 'Mr' | 'Ms' | 'Mrs';
export type TContactType = 'person' | 'company';
export type TContactTitle = 'Doctor' | 'Professor';
export interface IContact { export interface IContact {
name: string // =======
// general
} // =======
salutation?: TContactSalutation;
type: TContactType;
title: TContactTitle;
name: string;
address: IAddress;
// =========
// financial
// =========
vatId?: string;
accountNumber?: string;
}

View File

@ -1,14 +1,17 @@
import { IContact } from '../index' import { IContact } from '../index';
export type TInvoiceStatus = 'draft' | 'invoice' | 'paid' | 'refunded' export type TInvoiceStatus = 'draft' | 'invoice' | 'paid' | 'refunded';
export interface IInvoiceItem { export interface IInvoiceItem {
name: string name: string;
unitType: string unitType: string;
quantity: number quantity: number;
vatPercentage: number vatPercentage: number;
} }
export interface IInvoice { export interface IInvoice {
status: TInvoiceStatus billedBy: IContact;
billedTo: IContact;
status: TInvoiceStatus;
items: IInvoiceItem[];
} }

View File

@ -1 +1 @@
export type TDnsRecord = 'A' | 'AAAA' | 'CNAME' | 'TXT' | 'SRV' | 'LOC' | 'MX' | 'NS' | 'SPF' export type TDnsRecord = 'A' | 'AAAA' | 'CNAME' | 'TXT' | 'SRV' | 'LOC' | 'MX' | 'NS' | 'SPF';

View File

@ -1,23 +1,23 @@
import { IAuthor } from '../index' import { IAuthor } from '../index';
export interface IArticle { export interface IArticle {
/** /**
* the title of an article * the title of an article
*/ */
title: string title: string;
/** /**
* the Author of an article * the Author of an article
*/ */
author: IAuthor author: IAuthor;
/** /**
* the content of an article * the content of an article
*/ */
content: string content: string;
/** /**
* the tags of an article * the tags of an article
*/ */
tags: string[] tags: string[];
} }

View File

@ -1,25 +1,24 @@
import { IDate } from '../index' import { IDate } from '../index';
import { IArticle } from '../index' import { IArticle } from '../index';
export interface IAuthor { export interface IAuthor {
/** /**
* the first name of an author * the first name of an author
*/ */
firstName: string firstName: string;
/** /**
* the surname of an author * the surname of an author
*/ */
surName: string surName: string;
/** /**
* the birthday of an author * the birthday of an author
*/ */
birthday: IDate birthday: IDate;
/** /**
* articles of an author * articles of an author
*/ */
articles: IArticle[] articles: IArticle[];
} }

View File

@ -1,5 +1,5 @@
export interface IDate { export interface IDate {
day: number day: number;
month: number month: number;
year: number year: number;
} }

View File

@ -1,3 +1 @@
export interface ITime { export interface ITime {}
}

View File

@ -1,15 +1,16 @@
// Business // Business
export * from './business/company' export * from './business/address';
export * from './business/contact' export * from './business/company';
export * from './business/invoice' export * from './business/contact';
export * from './business/invoice';
// Cloud // Cloud
export * from './cloud/dns' export * from './cloud/dns';
// Content // Content
export * from './content/article' export * from './content/article';
export * from './content/author' export * from './content/author';
// General // General
export * from './general/date' export * from './general/date';
export * from './general/time' export * from './general/time';

View File

@ -1,4 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1