Go to file
2024-06-28 18:56:02 +02:00
.vscode BREAKING CHANGE(core): switch to esm 2022-04-28 12:18:26 +02:00
test fix(core): update 2023-09-13 13:31:30 +02:00
ts fix(saas): Refactor IProduct to separate IProductFeature interface 2024-06-28 18:56:01 +02:00
.gitignore fix(core): update 2020-03-22 22:21:47 +00:00
.npmignore improve 2016-11-16 19:52:33 +01:00
changelog.md fix(saas): Refactor IProduct to separate IProductFeature interface 2024-06-28 18:56:01 +02:00
license fix(core): update 2022-04-28 12:20:27 +02:00
npmextra.json update documentation 2024-04-16 18:40:54 +02:00
package.json 4.0.63 2024-06-28 18:56:02 +02:00
pnpm-lock.yaml fix(saas): Refactor IProduct to separate IProductFeature interface 2024-06-28 18:56:01 +02:00
readme.hints.md update documentation 2024-04-16 18:40:54 +02:00
readme.md update documentation 2024-04-16 18:40:54 +02:00
tsconfig.json update documentation 2024-04-16 18:40:54 +02:00

@tsclass/tsclass

common classes for TypeScript

Install

To install @tsclass/tsclass, run the following command in your project directory:

npm install @tsclass/tsclass

This will add @tsclass/tsclass to your project's dependencies.

Usage

@tsclass/tsclass offers a comprehensive TypeScript library that provides common classes and interfaces for various domains, including business, finance, content, networking, and more. The package utilizes ESM syntax and is intended for use with TypeScript for optimal developer experience.

Getting Started

First, ensure that you are using ES Modules in your TypeScript project by having "type": "module" in your package.json, and install the package as described above.

Importing Classes and Interfaces

You can import classes and interfaces from @tsclass/tsclass as follows:

import { business, finance, content } from '@tsclass/tsclass';

Business Domain

The business domain includes classes for managing contacts, companies, and projects. Here is how you can work with a company and contact classes:

import { business } from '@tsclass/tsclass';

const companyContact: business.IContact = {
  type: 'company',
  name: 'Example Company',
  address: {
    streetName: 'Main St',
    houseNumber: '123',
    postalCode: '12345',
    city: 'Example City',
    country: 'Exland'
  },
  description: 'An example company for demonstration purposes.',
  email: 'contact@example.com'
};

const exampleCompany: business.ICompany = {
  name: 'Example Company',
  foundedDate: {
    day: 1,
    month: 1,
    year: 2020
  },
  status: 'active',
  contact: companyContact
};

Finance Domain

The finance domain provides interfaces for working with invoices, transactions, and payment information. Heres how you can define an invoice:

import { finance } from '@tsclass/tsclass';

const exampleInvoice: finance.IInvoice = {
  id: 'INV12345',
  billedBy: companyContact,
  billedTo: companyContact, // In a real scenario, this should be a different contact.
  status: 'draft',
  items: [
    {
      name: 'Product 1',
      unitType: 'Item',
      unitQuantity: 2,
      unitNetPrice: 50,
      vatPercentage: 20,
      currency: 'EUR'
    }
  ],
  dueInDays: 30,
  reverseCharge: false
};

Network Domain

Networking interfaces, such as those for managing SSH keys or network nodes, are available under the network namespace:

import { network } from '@tsclass/tsclass';

const sshKey: network.ISshKey = {
  keyName: 'example-ssh-key',
  public: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD...'
  // Private key is typically kept secret and not included in source code
};

Storage Domain

Interfaces for storage management, such as S3 descriptors, can be found under the storage namespace:

import { storage } from '@tsclass/tsclass';

const s3Descriptor: storage.IS3Descriptor = {
  endpoint: 's3.example.com',
  accessKey: 'AKIAIOSFODNN7EXAMPLE',
  accessSecret: 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY',
  useSsl: true
};

Content and More

@tsclass/tsclass also provides classes for the content domain (e.g., articles, authors) and many other utilities across different fields. The examples above only scratch the surface of what @tsclass/tsclass offers. Depending on your project's needs, explore other domains and interfaces provided by the library.

Remember, while @tsclass/tsclass aims to streamline the TypeScript development process by providing ready-to-use classes and interfaces, it is crucial to adapt these examples to your specific project requirements, ensuring that all aspects, such as security (especially for networking and storage operations), are adequately handled.

For a deeper look into all available classes and interfaces, refer to the TypeScript definitions in the package. This will also give you insight into additional functionalities such as content management, events, authentication, and more detailed use cases within each domain.

This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the license file within this repository.

Please note: The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.

Trademarks

This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.

Company Information

Task Venture Capital GmbH
Registered at District court Bremen HRB 35230 HB, Germany

For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.

By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.