Compare commits

...

2 Commits

Author SHA1 Message Date
170163ec73 8.0.1 2025-03-24 08:11:36 +00:00
76a47f737f fix(documentation): Improve documentation clarity and update package metadata 2025-03-24 08:11:36 +00:00
4 changed files with 88 additions and 72 deletions

View File

@ -1,5 +1,11 @@
# Changelog
## 2025-03-24 - 8.0.1 - fix(documentation)
Improve documentation clarity and update package metadata
- Correct author field in package.json to 'Task Venture Capital GmbH'
- Enhance readme.md with comprehensive usage examples and detailed type structure for better guidance
## 2025-03-24 - 8.0.0 - BREAKING CHANGE(tsclass)
Trigger patch release with no code changes

View File

@ -1,6 +1,6 @@
{
"name": "@tsclass/tsclass",
"version": "8.0.0",
"version": "8.0.1",
"private": false,
"description": "Provides TypeScript definitions for various business, financial, networking, content, and other common classes.",
"main": "dist_ts/index.js",
@ -30,7 +30,7 @@
"Authentication",
"Web Development"
],
"author": "Lossless GmbH",
"author": "Task Venture Capital GmbH",
"license": "MIT",
"bugs": {
"url": "https://github.com/tsclass/tsclass/issues"

148
readme.md
View File

@ -1,40 +1,77 @@
# @tsclass/tsclass
common classes for TypeScript
## Install
A comprehensive TypeScript library providing well-structured type definitions for various domains including business, finance, networking, content management, and more.
To install `@tsclass/tsclass`, run the following command in your project directory:
## Installation
```bash
npm install @tsclass/tsclass
```
This will add `@tsclass/tsclass` to your project's dependencies.
## Overview
## Usage
This library offers a rich collection of TypeScript interfaces and types designed to provide consistent structures for common business and development needs. It's organized into domain-specific modules to maintain clarity and separation of concerns.
`@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.
## Type Structure
### Getting Started
### Authentication
- **IClaim**: Authentication claims with user and role data
- **IProcessedClaim**: Processed JWT claims with verification status
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.
### Business
- **TDocumentEnvelope**: Base type for all document types
- **IAddress**: Physical/postal address structure
- **TContact**: Person and company contact information
- **TContractEnvelope**: Various contract types (Employment, NDA, Service, Lease)
- **TLetterEnvelope**: Letter document types
- **IPdf**: PDF document with metadata
### Importing Classes and Interfaces
### Finance
- **TCurrency**: Currency representation
- **TInvoiceEnvelope**: Invoice document structure
- **TInvoiceItem**: Line items for invoices
- **IPaymentOptionInfo**: Banking and payment method details
You can import classes and interfaces from `@tsclass/tsclass` as follows:
### Network
- **INetworkNode**: Network device representation
- **ICert**: Certificate management
- **IJWT**: JWT token structure
- **IDnsChallenge**: DNS verification challenges
```typescript
import { business, finance, content } from '@tsclass/tsclass';
```
### Container
- **IContainer**: Container configuration
- **IVolumeMount**: Volume mount specification
### Business Domain
### Database
- **IMongoDescriptor**: MongoDB connection details
- **IObjectAction**: Document lifecycle tracking
The business domain includes classes for managing contacts, companies, and projects. Here is how you can work with a company and contact classes:
### Content
- **IArticle**: Content article structure
- **IAuthor**: Content author metadata
- **IDocumentationSet**: Documentation collections
### Code
- **ICommitInfo**: Code commit information
- **IStatusObject**: Status tracking object
### Website
- **ILink**: Website link structure
- **ILinkBlock**: Link collection
- **IMenuItem**: Navigation menu items
### SaaS
- **IProduct**: SaaS product definition
- **ISubscriptionPlan**: Subscription plan details
## Usage Examples
### Business Contact
```typescript
import { business } from '@tsclass/tsclass';
const companyContact: business.TContact = {
const companyContact: business.TCompany = {
type: 'company',
name: 'Example Company',
address: {
@ -44,86 +81,59 @@ const companyContact: business.TContact = {
city: 'Example City',
country: 'Exland'
},
description: 'An example company for demonstration purposes.',
email: 'contact@example.com'
};
const exampleCompany: business.TCompany = {
name: 'Example Company',
email: 'contact@example.com',
foundedDate: {
day: 1,
month: 1,
year: 2020
},
status: 'active',
contact: companyContact
status: 'active'
};
```
### Finance Domain
The finance domain provides interfaces for working with invoices, transactions, and payment information. Heres how you can define an invoice:
### Invoice
```typescript
import { finance } from '@tsclass/tsclass';
import { finance, business } 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',
const invoice: finance.TInvoiceEnvelope = {
id: 'INV-2023-001',
status: 'invoice',
issueDate: {
day: 15,
month: 3,
year: 2023
},
items: [
{
name: 'Product 1',
unitType: 'Item',
unitQuantity: 2,
unitNetPrice: 50,
name: 'Consulting Services',
unitType: 'hour',
unitQuantity: 10,
unitNetPrice: 150,
vatPercentage: 20,
currency: 'EUR'
}
],
dueInDays: 30,
reverseCharge: false
billedBy: { /* company details */ },
billedTo: { /* client details */ }
};
```
### Network Domain
Networking interfaces, such as those for managing SSH keys or network nodes, are available under the `network` namespace:
### Network Certificate
```typescript
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
const certificate: network.ICert = {
domain: 'example.com',
validFrom: { day: 1, month: 1, year: 2023 },
validTo: { day: 1, month: 1, year: 2024 },
issuer: 'Let\'s Encrypt',
certificateBody: '-----BEGIN CERTIFICATE-----\n...'
};
```
### Storage Domain
Interfaces for storage management, such as S3 descriptors, can be found under the `storage` namespace:
```typescript
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.
## License and Legal Information
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](license) file within this repository.
@ -141,4 +151,4 @@ 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.
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.

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@tsclass/tsclass',
version: '8.0.0',
version: '8.0.1',
description: 'Provides TypeScript definitions for various business, financial, networking, content, and other common classes.'
}