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 # 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) ## 2025-03-24 - 8.0.0 - BREAKING CHANGE(tsclass)
Trigger patch release with no code changes Trigger patch release with no code changes

View File

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

146
readme.md
View File

@ -1,40 +1,77 @@
# @tsclass/tsclass # @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 ```bash
npm install @tsclass/tsclass 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 ### Container
import { business, finance, content } from '@tsclass/tsclass'; - **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 ```typescript
import { business } from '@tsclass/tsclass'; import { business } from '@tsclass/tsclass';
const companyContact: business.TContact = { const companyContact: business.TCompany = {
type: 'company', type: 'company',
name: 'Example Company', name: 'Example Company',
address: { address: {
@ -44,86 +81,59 @@ const companyContact: business.TContact = {
city: 'Example City', city: 'Example City',
country: 'Exland' country: 'Exland'
}, },
description: 'An example company for demonstration purposes.', email: 'contact@example.com',
email: 'contact@example.com'
};
const exampleCompany: business.TCompany = {
name: 'Example Company',
foundedDate: { foundedDate: {
day: 1, day: 1,
month: 1, month: 1,
year: 2020 year: 2020
}, },
status: 'active', status: 'active'
contact: companyContact
}; };
``` ```
### Finance Domain ### Invoice
The finance domain provides interfaces for working with invoices, transactions, and payment information. Heres how you can define an invoice:
```typescript ```typescript
import { finance } from '@tsclass/tsclass'; import { finance, business } from '@tsclass/tsclass';
const exampleInvoice: finance.IInvoice = { const invoice: finance.TInvoiceEnvelope = {
id: 'INV12345', id: 'INV-2023-001',
billedBy: companyContact, status: 'invoice',
billedTo: companyContact, // In a real scenario, this should be a different contact. issueDate: {
status: 'draft', day: 15,
month: 3,
year: 2023
},
items: [ items: [
{ {
name: 'Product 1', name: 'Consulting Services',
unitType: 'Item', unitType: 'hour',
unitQuantity: 2, unitQuantity: 10,
unitNetPrice: 50, unitNetPrice: 150,
vatPercentage: 20, vatPercentage: 20,
currency: 'EUR' currency: 'EUR'
} }
], ],
dueInDays: 30, dueInDays: 30,
reverseCharge: false billedBy: { /* company details */ },
billedTo: { /* client details */ }
}; };
``` ```
### Network Domain ### Network Certificate
Networking interfaces, such as those for managing SSH keys or network nodes, are available under the `network` namespace:
```typescript ```typescript
import { network } from '@tsclass/tsclass'; import { network } from '@tsclass/tsclass';
const sshKey: network.ISshKey = { const certificate: network.ICert = {
keyName: 'example-ssh-key', domain: 'example.com',
public: 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD...' validFrom: { day: 1, month: 1, year: 2023 },
// Private key is typically kept secret and not included in source code 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 ## 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. 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.

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@tsclass/tsclass', 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.' description: 'Provides TypeScript definitions for various business, financial, networking, content, and other common classes.'
} }