feat(tools): add demodata feature, update package metadata, tsconfig paths, CI/workflows, and bump deps
This commit is contained in:
@@ -6,19 +6,19 @@ on:
|
||||
- '**'
|
||||
|
||||
env:
|
||||
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
||||
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||
IMAGE: code.foss.global/host.today/ht-docker-node:npmci
|
||||
NPMCI_COMPUTED_REPOURL: https://${-{gitea.repository_owner}-}:${-{secrets.GITEA_TOKEN}-}@{{module.githost}}/${-{gitea.repository}-}.git
|
||||
NPMCI_TOKEN_NPM: ${-{secrets.NPMCI_TOKEN_NPM}-}
|
||||
NPMCI_TOKEN_NPM2: ${-{secrets.NPMCI_TOKEN_NPM2}-}
|
||||
NPMCI_GIT_GITHUBTOKEN: ${-{secrets.NPMCI_GIT_GITHUBTOKEN}-}
|
||||
NPMCI_URL_CLOUDLY: ${-{secrets.NPMCI_URL_CLOUDLY}-}
|
||||
|
||||
jobs:
|
||||
security:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
image: ${-{ env.IMAGE }-}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
- name: Install pnpm and npmci
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
pnpm install -g @ship.zone/npmci
|
||||
|
||||
- name: Run npm prepare
|
||||
run: npmci npm prepare
|
||||
@@ -44,11 +44,11 @@ jobs:
|
||||
continue-on-error: true
|
||||
|
||||
test:
|
||||
if: ${{ always() }}
|
||||
if: ${-{ always() }-}
|
||||
needs: security
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
image: ${-{ env.IMAGE }-}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
@@ -6,19 +6,19 @@ on:
|
||||
- '*'
|
||||
|
||||
env:
|
||||
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
||||
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||
IMAGE: code.foss.global/host.today/ht-docker-node:npmci
|
||||
NPMCI_COMPUTED_REPOURL: https://${-{gitea.repository_owner}-}:${-{secrets.GITEA_TOKEN}-}@{{module.githost}}/${-{gitea.repository}-}.git
|
||||
NPMCI_TOKEN_NPM: ${-{secrets.NPMCI_TOKEN_NPM}-}
|
||||
NPMCI_TOKEN_NPM2: ${-{secrets.NPMCI_TOKEN_NPM2}-}
|
||||
NPMCI_GIT_GITHUBTOKEN: ${-{secrets.NPMCI_GIT_GITHUBTOKEN}-}
|
||||
NPMCI_URL_CLOUDLY: ${-{secrets.NPMCI_URL_CLOUDLY}-}
|
||||
|
||||
jobs:
|
||||
security:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
image: ${-{ env.IMAGE }-}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
pnpm install -g @ship.zone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Audit production dependencies
|
||||
@@ -42,11 +42,11 @@ jobs:
|
||||
continue-on-error: true
|
||||
|
||||
test:
|
||||
if: ${{ always() }}
|
||||
if: ${-{ always() }-}
|
||||
needs: security
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
image: ${-{ env.IMAGE }-}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
@@ -54,7 +54,7 @@ jobs:
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
pnpm install -g @ship.zone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Test stable
|
||||
@@ -74,7 +74,7 @@ jobs:
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
image: ${-{ env.IMAGE }-}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
@@ -82,7 +82,7 @@ jobs:
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
pnpm install -g @ship.zone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Release
|
||||
@@ -95,7 +95,7 @@ jobs:
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
image: ${-{ env.IMAGE }-}
|
||||
continue-on-error: true
|
||||
|
||||
steps:
|
||||
@@ -104,7 +104,7 @@ jobs:
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
pnpm install -g @ship.zone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Code quality
|
||||
|
||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -3,7 +3,6 @@
|
||||
# artifacts
|
||||
coverage/
|
||||
public/
|
||||
pages/
|
||||
|
||||
# installs
|
||||
node_modules/
|
||||
@@ -17,4 +16,8 @@ node_modules/
|
||||
dist/
|
||||
dist_*/
|
||||
|
||||
# custom
|
||||
# AI
|
||||
.claude/
|
||||
.serena/
|
||||
|
||||
#------# custom
|
||||
|
||||
24
changelog.md
24
changelog.md
@@ -1,6 +1,20 @@
|
||||
# Changelog
|
||||
|
||||
## 2025-12-18 - 1.2.0 - feat(tools)
|
||||
add demodata feature, update package metadata, tsconfig paths, CI/workflows, and bump deps
|
||||
|
||||
- Add demodata subpackage (@signature.digital/demodata) and export entry
|
||||
- Introduce tsconfig path aliases for @signature.digital/tools, @signature.digital/demodata, and @signature.digital/interfaces
|
||||
- Update package.json metadata (repository, bugs, homepage), add pnpm overrides, and bump dev/deps (@git.zone/tsbuild, @git.zone/tstest, @tsclass/tsclass)
|
||||
- Rename and configure tspublish.json files to include package names and registries for publishing
|
||||
- Fix interfaces: change IInvolvedParty.contact type to plugins.tsclass.business.TContact
|
||||
- Update tests to use @git.zone/tstest/tapbundle and export tap.start()
|
||||
- Revise CI workflow files to use code.foss.global image, new secret placeholder formatting, and @ship.zone/npmci package name
|
||||
- Rework npmextra.json structure and add release registries and szci config
|
||||
- Update README and changelog content and add minor .gitignore entries for AI tools
|
||||
|
||||
## 2024-12-19 - 1.1.0 - feat(demodata)
|
||||
|
||||
Add demo data feature for contracts
|
||||
|
||||
- Introduced demo contract data for Minijob Employment Contract outlining details for employer and employee roles.
|
||||
@@ -8,26 +22,30 @@ Add demo data feature for contracts
|
||||
- Implemented new ts_demodata directory with sample contract representation.
|
||||
|
||||
## 2024-12-19 - 1.0.11 - fix(interfaces)
|
||||
|
||||
Fixed import path in ts_interfaces/index.ts
|
||||
|
||||
- Corrected import path for plugins in ts_interfaces/index.ts to prevent module resolution issues.
|
||||
|
||||
## 2024-12-18 - 1.0.10 - fix(test)
|
||||
|
||||
Add initial test for portablecontract
|
||||
|
||||
|
||||
## 2024-12-18 - 1.0.9 - fix(ts_interfaces)
|
||||
|
||||
Resolved missing exports in plugins.ts
|
||||
|
||||
- Added export statements in ts_interfaces/plugins.ts to resolve module issues.
|
||||
|
||||
## 2024-12-18 - 1.0.8 - fix(core)
|
||||
|
||||
Fixed export paths in package configuration
|
||||
|
||||
- Updated exports paths in package.json for proper module resolution.
|
||||
- Fixed export statement in ts/index.ts to reference the correct path for interface exports.
|
||||
|
||||
## 2024-12-18 - 1.0.7 - fix(project)
|
||||
|
||||
Corrected misalignment in file structure and package metadata.
|
||||
|
||||
- Updated the file export path in ts/index.ts to correct interface export location.
|
||||
@@ -36,10 +54,11 @@ Corrected misalignment in file structure and package metadata.
|
||||
- Ensured proper build script path in package.json.
|
||||
|
||||
## 2024-12-18 - 1.0.6 - fix(core)
|
||||
|
||||
No code changes detected.
|
||||
|
||||
|
||||
## 2024-12-18 - 1.0.5 - fix(core)
|
||||
|
||||
Corrected package and npm extra configuration to ensure consistent naming.
|
||||
|
||||
- Updated 'name' field in package.json from '@signature.digital/portablecontract' to '@signature.digital/tools'.
|
||||
@@ -47,6 +66,7 @@ Corrected package and npm extra configuration to ensure consistent naming.
|
||||
- Updated 'npmPackagename' in npmextra.json from '@signature.digital/portablecontract' to '@signature.digital/tools'.
|
||||
|
||||
## 2023-11-22 to 2023-11-28 - 1.0.1 to 1.0.4 - core updates
|
||||
|
||||
Fixes and updates in the core component.
|
||||
|
||||
- Updated core module to enhance performance and fix minor bugs in version 1.0.1
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"gitzone": {
|
||||
"@git.zone/cli": {
|
||||
"projectType": "npm",
|
||||
"module": {
|
||||
"githost": "gitlab.com",
|
||||
@@ -27,13 +27,16 @@
|
||||
"contract validation",
|
||||
"unit testing"
|
||||
]
|
||||
},
|
||||
"release": {
|
||||
"registries": ["https://verdaccio.lossless.digital"],
|
||||
"accessLevel": "public"
|
||||
}
|
||||
},
|
||||
"npmci": {
|
||||
"npmGlobalTools": [],
|
||||
"npmAccessLevel": "public"
|
||||
},
|
||||
"tsdoc": {
|
||||
"@git.zone/tsdoc": {
|
||||
"legal": "\n## License and Legal Information\n\nThis 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. \n\n**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.\n\n### Trademarks\n\nThis 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.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy 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.\n"
|
||||
},
|
||||
"@ship.zone/szci": {
|
||||
"npmGlobalTools": []
|
||||
}
|
||||
}
|
||||
18
package.json
18
package.json
@@ -17,24 +17,23 @@
|
||||
"buildDocs": "(tsdoc)"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@git.zone/tsbuild": "^2.2.0",
|
||||
"@git.zone/tsbuild": "^2.6.1",
|
||||
"@git.zone/tsbundle": "^2.1.0",
|
||||
"@git.zone/tsrun": "^1.3.3",
|
||||
"@git.zone/tstest": "^1.0.90",
|
||||
"@push.rocks/tapbundle": "^5.5.3",
|
||||
"@git.zone/tstest": "^1.0.96",
|
||||
"@types/node": "^22.10.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tsclass/tsclass": "^4.2.0"
|
||||
"@tsclass/tsclass": "^9.3.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://gitlab.com/signature.digital/portablecontract.git"
|
||||
"url": "https://gitlab.com/signature.digital/tools.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://gitlab.com/signature.digital/portablecontract/issues"
|
||||
"url": "https://gitlab.com/signature.digital/tools/issues"
|
||||
},
|
||||
"homepage": "https://gitlab.com/signature.digital/portablecontract#readme",
|
||||
"homepage": "https://gitlab.com/signature.digital/tools#readme",
|
||||
"browserslist": [
|
||||
"last 1 chrome versions"
|
||||
],
|
||||
@@ -67,5 +66,8 @@
|
||||
"dynamic role assignment",
|
||||
"contract validation",
|
||||
"unit testing"
|
||||
]
|
||||
],
|
||||
"pnpm": {
|
||||
"overrides": {}
|
||||
}
|
||||
}
|
||||
|
||||
8286
pnpm-lock.yaml
generated
8286
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
373
readme.md
373
readme.md
@@ -1,315 +1,184 @@
|
||||
# @signature.digital/tools
|
||||
A TypeScript package offering utility interfaces and classes for efficient digital contract management and business context integration with a modular design.
|
||||
|
||||
A TypeScript package providing utility interfaces and classes for efficient digital contract management and business context integration with a modular design. 📝
|
||||
|
||||
## Issue Reporting and Security
|
||||
|
||||
For reporting bugs, issues, or security vulnerabilities, please visit [community.foss.global/](https://community.foss.global/). This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a [code.foss.global/](https://code.foss.global/) account to submit Pull Requests directly.
|
||||
|
||||
## Install
|
||||
To install the `@signature.digital/tools` package, use your preferred package manager. For npm, run the following command:
|
||||
|
||||
Install using your preferred package manager:
|
||||
|
||||
```bash
|
||||
# Using pnpm (recommended)
|
||||
pnpm add @signature.digital/tools
|
||||
|
||||
# Using npm
|
||||
npm install @signature.digital/tools
|
||||
```
|
||||
|
||||
Alternatively, if you are using Yarn, you can add the package with:
|
||||
|
||||
```bash
|
||||
yarn add @signature.digital/tools
|
||||
```
|
||||
|
||||
Ensure your development environment supports ECMAScript Modules. In your `tsconfig.json`, you should set the `"module"` option to `"ESNext"` or a compatible module type that supports ES Modules.
|
||||
|
||||
## Usage
|
||||
|
||||
This guide details the comprehensive features of the `@signature.digital/tools` package, designed to streamline digital contract management in TypeScript applications. By using this package, you can leverage the structured capabilities of TypeScript to define, manage, and operate on digital contracts effectively.
|
||||
This package provides TypeScript interfaces for modeling digital contracts with support for roles, paragraphs, and involved parties.
|
||||
|
||||
### Introduction to the Module
|
||||
### Core Interfaces
|
||||
|
||||
The `@signature.digital/tools` package capitalizes on TypeScript's robust typing system to mold digital contract management paradigms. It encourages an interface-driven approach to designing contracts, promotes modularity, and integrates business context inherently within its structures.
|
||||
|
||||
### Key Features
|
||||
|
||||
1. **Interface-Driven Design:**
|
||||
Utilize TypeScript interfaces to clearly delineate data structures for contracts. This results in easily maintainable, testable, and scalable digital contract solutions.
|
||||
|
||||
2. **Modular Architecture:**
|
||||
Divide and conquer complex contract datasets by representing them as reusable modules.
|
||||
|
||||
3. **Business Contextualization:**
|
||||
Seamlessly integrate business metadata into your contracts to reflect real-world applications and business scenarios.
|
||||
|
||||
### Usage Scenarios
|
||||
|
||||
Below are practical examples to help you understand and leverage the full capabilities of the `@signature.digital/tools` package.
|
||||
|
||||
#### 1. Designing Contract Components
|
||||
|
||||
Begin by defining the core components of a contract using the provided interfaces. Start with `IRole`, `IInvolvedParty`, `IParagraph`, and `IPortableContract`:
|
||||
The package exports these key interfaces:
|
||||
|
||||
```typescript
|
||||
import { IPortableContract, IRole, IInvolvedParty, IParagraph } from '@signature.digital/tools';
|
||||
import { tsclass } from '@signature.digital/tools';
|
||||
import type {
|
||||
IPortableContract,
|
||||
IRole,
|
||||
IInvolvedParty,
|
||||
IParagraph,
|
||||
} from '@signature.digital/tools';
|
||||
```
|
||||
|
||||
const createRoles = (): IRole[] => [
|
||||
### Interface Overview
|
||||
|
||||
#### `IPortableContract`
|
||||
|
||||
The main contract interface containing:
|
||||
|
||||
- `title` - Contract title
|
||||
- `context` - Description of the contract context
|
||||
- `availableRoles` - Array of available roles
|
||||
- `involvedParties` - Parties involved with their contacts
|
||||
- `priorContracts` - Reference to preceding contracts
|
||||
- `paragraphs` - Contract content sections
|
||||
|
||||
#### `IRole`
|
||||
|
||||
Defines a role within the contract:
|
||||
|
||||
```typescript
|
||||
interface IRole {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
}
|
||||
```
|
||||
|
||||
#### `IParagraph`
|
||||
|
||||
Represents a contract section:
|
||||
|
||||
```typescript
|
||||
interface IParagraph {
|
||||
uniqueId: string;
|
||||
parent: IParagraph | null;
|
||||
title: string;
|
||||
content: string;
|
||||
}
|
||||
```
|
||||
|
||||
#### `IInvolvedParty`
|
||||
|
||||
Links a role to a contact:
|
||||
|
||||
```typescript
|
||||
interface IInvolvedParty {
|
||||
role: string;
|
||||
contact: TContact; // from @tsclass/tsclass
|
||||
}
|
||||
```
|
||||
|
||||
### Example: Creating a Contract
|
||||
|
||||
```typescript
|
||||
import type {
|
||||
IPortableContract,
|
||||
IRole,
|
||||
IParagraph,
|
||||
} from '@signature.digital/tools';
|
||||
|
||||
const roles: IRole[] = [
|
||||
{
|
||||
id: 'role-001',
|
||||
name: 'Legal Advisor',
|
||||
description: 'Advises on legal obligations and ensures compliance.'
|
||||
id: 'employer',
|
||||
name: 'Employer',
|
||||
description: 'The party offering the position.',
|
||||
},
|
||||
{
|
||||
id: 'role-002',
|
||||
name: 'Stakeholder',
|
||||
description: 'Interest in the outcome of the contract.'
|
||||
}
|
||||
];
|
||||
|
||||
const createContacts = (): tsclass.business.IContact[] => [
|
||||
{
|
||||
email: 'advisor@legalfirm.com',
|
||||
address: '123 Legal Firm St, Legal City'
|
||||
id: 'employee',
|
||||
name: 'Employee',
|
||||
description: 'The party accepting the position.',
|
||||
},
|
||||
{
|
||||
email: 'stakeholder@business.com',
|
||||
address: '456 Business Way, Industry City'
|
||||
}
|
||||
];
|
||||
|
||||
const createParagraphs = (): IParagraph[] => [
|
||||
const paragraphs: IParagraph[] = [
|
||||
{
|
||||
uniqueId: 'para-001',
|
||||
uniqueId: '1',
|
||||
parent: null,
|
||||
title: 'Introduction',
|
||||
content: 'Introduction to the contract, setting expectations and scope of the agreement.'
|
||||
content: 'This contract outlines the terms of employment.',
|
||||
},
|
||||
{
|
||||
uniqueId: 'para-002',
|
||||
uniqueId: '2',
|
||||
parent: null,
|
||||
title: 'Obligations',
|
||||
content: 'Details the specific obligations and responsibilities of each involved party.'
|
||||
}
|
||||
title: 'Scope of Work',
|
||||
content: 'The employee will perform the following duties...',
|
||||
},
|
||||
];
|
||||
|
||||
const createPortableContract = (): IPortableContract => {
|
||||
const roles = createRoles();
|
||||
const contacts = createContacts();
|
||||
const paragraphs = createParagraphs();
|
||||
|
||||
return {
|
||||
title: 'Digital Service Agreement',
|
||||
context: 'A digital service provision framework between organizations.',
|
||||
availableRoles: roles,
|
||||
involvedParties: [
|
||||
{ role: roles[0].name, contact: contacts[0] },
|
||||
{ role: roles[1].name, contact: contacts[1] }
|
||||
],
|
||||
priorContracts: [],
|
||||
paragraphs
|
||||
};
|
||||
};
|
||||
|
||||
const contract = createPortableContract();
|
||||
console.log(contract);
|
||||
```
|
||||
|
||||
This example highlights how you can define the roles, contacts, and paragraphs that collectively represent a comprehensive digital contract model.
|
||||
|
||||
#### 2. Expanding Contract Details
|
||||
|
||||
Extend core contracts to encapsulate more details specific to your organizational needs. You can add dates, custom attributes, or any other relevant information:
|
||||
|
||||
```typescript
|
||||
interface IExtendedPortableContract extends IPortableContract {
|
||||
startDate: Date;
|
||||
endDate: Date;
|
||||
customAttributes?: Record<string, any>;
|
||||
}
|
||||
|
||||
const createExtendedContract = (): IExtendedPortableContract => {
|
||||
const baseContract = createPortableContract();
|
||||
return {
|
||||
...baseContract,
|
||||
startDate: new Date('2023-01-01'),
|
||||
endDate: new Date('2024-01-01'),
|
||||
customAttributes: {
|
||||
department: 'Legal',
|
||||
projectCode: 'DSA2023'
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
const extendedContract = createExtendedContract();
|
||||
console.log(extendedContract);
|
||||
```
|
||||
|
||||
#### 3. Maintaining Contract History
|
||||
|
||||
Managing contractual history provides a strategic advantage in legal and administrative processes. Employ the `priorContracts` attribute to keep track of iterations:
|
||||
|
||||
```typescript
|
||||
const initialContractVersion: IPortableContract = {
|
||||
title: 'Initial Service Agreement',
|
||||
context: 'Foundation agreement before the current digital service contract.',
|
||||
availableRoles: createRoles(),
|
||||
const contract: IPortableContract = {
|
||||
title: 'Employment Contract',
|
||||
context: 'Standard employment agreement',
|
||||
availableRoles: roles,
|
||||
involvedParties: [
|
||||
{ role: 'Legal Advisor', contact: createContacts()[0] }
|
||||
{ role: 'employer', contact: null },
|
||||
{ role: 'employee', contact: null },
|
||||
],
|
||||
priorContracts: [],
|
||||
paragraphs: []
|
||||
paragraphs,
|
||||
};
|
||||
|
||||
const updatedContractVersion = {
|
||||
...initialContractVersion,
|
||||
title: 'Revised Digital Service Agreement',
|
||||
priorContracts: [initialContractVersion]
|
||||
};
|
||||
|
||||
console.log(updatedContractVersion);
|
||||
```
|
||||
|
||||
This functionality is crucial for firms that require detailed records of contractual changes over time.
|
||||
### Using Demo Data
|
||||
|
||||
#### 4. Integrating Business Entities
|
||||
|
||||
Leverage the power of `@tsclass/tsclass` to seamlessly embed business information within contracts, enhancing clarity and context:
|
||||
The package includes demo data for testing and development:
|
||||
|
||||
```typescript
|
||||
const businessParty = {
|
||||
role: 'Business Analyst',
|
||||
contact: {
|
||||
email: 'analyst@corporation.com',
|
||||
address: '123 Business Lane, Tech City'
|
||||
}
|
||||
};
|
||||
import { demoContract } from '@signature.digital/tools/demodata';
|
||||
|
||||
extendedContract.involvedParties.push(businessParty);
|
||||
console.log(extendedContract.involvedParties);
|
||||
console.log(demoContract.title); // "Minijob Employment Contract"
|
||||
```
|
||||
|
||||
This level of integration is perfect for incorporating stakeholders' information.
|
||||
### Separate Interface Import
|
||||
|
||||
#### 5. Implementing Validation Logic
|
||||
|
||||
While the package promotes interface-based design, users must implement validation patterns to ensure contract data integrity. Below is an example of how to perform basic validations:
|
||||
You can import just the interfaces without the full package:
|
||||
|
||||
```typescript
|
||||
function isValidContractStructure(contract: IPortableContract): boolean {
|
||||
return (
|
||||
contract.context !== '' &&
|
||||
contract.availableRoles.length > 0 &&
|
||||
contract.involvedParties.length > 0 &&
|
||||
contract.paragraphs.every(paragraph => paragraph.content !== '')
|
||||
);
|
||||
}
|
||||
|
||||
if (!isValidContractStructure(extendedContract)) {
|
||||
throw new Error('Invalid contract structure detected!');
|
||||
}
|
||||
import type { IPortableContract } from '@signature.digital/tools/interfaces';
|
||||
```
|
||||
|
||||
This sample function demonstrates a straightforward mechanism to verify that the contract structure adheres to defined rules and prevents incorrect data entries.
|
||||
## Module Exports
|
||||
|
||||
### Advanced Usage
|
||||
The package provides three entry points:
|
||||
|
||||
Let's delve into more intricate capabilities and scenarios that `@signature.digital/tools` can facilitate:
|
||||
|
||||
#### Asynchronous Loading and Initialization
|
||||
|
||||
For scenarios where parts of contracts or their dependencies are fetched from databases or APIs, the `@signature.digital/tools` suite can interact seamlessly with asynchronous sources:
|
||||
|
||||
```typescript
|
||||
async function fetchContractData(): Promise<IPortableContract> {
|
||||
// Simulate API call
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => resolve(createPortableContract()), 1000);
|
||||
});
|
||||
}
|
||||
|
||||
async function initializeAsyncContract() {
|
||||
try {
|
||||
const contractData = await fetchContractData();
|
||||
console.log('Loaded contract:', contractData);
|
||||
} catch (error) {
|
||||
console.error('Error fetching contract data:', error);
|
||||
}
|
||||
}
|
||||
|
||||
initializeAsyncContract();
|
||||
```
|
||||
|
||||
This approach is vital when integrating with remote contract stores or dynamically fetching contract components.
|
||||
|
||||
#### Dynamic Role Assignment
|
||||
|
||||
Business environments often require flexibility in role assignments, which can be handled dynamically within the contract configurations:
|
||||
|
||||
```typescript
|
||||
function addDynamicRoleToContract(contract: IPortableContract, roleName: string, contactInfo: tsclass.business.IContact) {
|
||||
const role: IRole = {
|
||||
id: `role-${Math.random().toString(36).substr(2, 9)}`, // Random ID generator
|
||||
name: roleName,
|
||||
description: `Dynamic role added for ${roleName}`
|
||||
};
|
||||
|
||||
contract.availableRoles.push(role);
|
||||
contract.involvedParties.push({ role: role.name, contact: contactInfo });
|
||||
console.log(`Added role: ${roleName}`);
|
||||
}
|
||||
|
||||
addDynamicRoleToContract(contract, 'Compliance Officer', {
|
||||
email: 'compliance@business.com',
|
||||
address: 'Office 42, Compliance Street'
|
||||
});
|
||||
console.log(contract);
|
||||
```
|
||||
|
||||
Dynamic role assignments are essential when handling expansive contracts with changing stakeholder roles.
|
||||
|
||||
#### Comprehensive Testing
|
||||
|
||||
You should construct extensive tests for contract components by leveraging TypeScript's compatibility with common testing frameworks. Although the test cases here are isolated, they serve as foundational templates:
|
||||
|
||||
```typescript
|
||||
import { expect } from '@push.rocks/tapbundle';
|
||||
|
||||
tap.test('Contract Initial Structure', async () => {
|
||||
const contractBase = createPortableContract();
|
||||
expect(contractBase.title).toBe('Digital Service Agreement');
|
||||
expect(contractBase.paragraphs.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
tap.test('Role Addition', async () => {
|
||||
const testContract = createPortableContract();
|
||||
const initialRoleCount = testContract.availableRoles.length;
|
||||
|
||||
const newRole: IRole = {
|
||||
id: 'role-003',
|
||||
name: 'Tester',
|
||||
description: 'Ensures quality and compliance of the contract.'
|
||||
};
|
||||
|
||||
testContract.availableRoles.push(newRole);
|
||||
expect(testContract.availableRoles.length).toBe(initialRoleCount + 1);
|
||||
});
|
||||
|
||||
tap.start();
|
||||
```
|
||||
|
||||
These examples demonstrate basic test cases to verify the functionality and resiliency of your contract management system.
|
||||
|
||||
By utilizing the `@signature.digital/tools` package, developers can construct robust, dynamic, and efficient digital contract management systems tailored to a wide array of business scenarios. The examples provided above only scratch the surface of the package's versatility and extendability, empowering developers to innovate and automate contract handling processes in TypeScript.
|
||||
| Entry Point | Description |
|
||||
| ------------------------------------- | ------------------------------- |
|
||||
| `@signature.digital/tools` | Main export with all interfaces |
|
||||
| `@signature.digital/tools/interfaces` | Interface definitions only |
|
||||
| `@signature.digital/tools/demodata` | Demo contract data |
|
||||
|
||||
## 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 licensed under the MIT License. A copy of the license can be found in the [LICENSE](./LICENSE) file.
|
||||
|
||||
**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.
|
||||
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 or third parties, 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 or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.
|
||||
|
||||
### Company Information
|
||||
|
||||
Task Venture Capital GmbH
|
||||
Registered at District court Bremen HRB 35230 HB, Germany
|
||||
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.
|
||||
For any legal inquiries or 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.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { expect, expectAsync, tap } from '@push.rocks/tapbundle';
|
||||
import { expect, tap } from '@git.zone/tstest/tapbundle';
|
||||
import * as portablecontract from '../ts/index.js'
|
||||
|
||||
tap.test('first test', async () => {
|
||||
console.log(portablecontract)
|
||||
})
|
||||
|
||||
tap.start()
|
||||
export default tap.start();
|
||||
|
||||
@@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@signature.digital/tools',
|
||||
version: '1.1.0',
|
||||
version: '1.2.0',
|
||||
description: 'A TypeScript package providing utilities for managing digital contracts with modular interfaces and business context integration.'
|
||||
}
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
// project scope
|
||||
import * as interfaces from '@signature.digital/interfaces';
|
||||
|
||||
// @tsclass scope
|
||||
import * as tsclass from '@tsclass/tsclass';
|
||||
|
||||
export {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
{
|
||||
"order": 2
|
||||
"name": "@signature.digital/tools",
|
||||
"order": 2,
|
||||
"registries": ["useBase"]
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as interfaces from '../dist_ts_interfaces/index.js';
|
||||
import * as interfaces from '@signature.digital/interfaces';
|
||||
|
||||
export {
|
||||
interfaces,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
{
|
||||
"order": 3
|
||||
"name": "@signature.digital/demodata",
|
||||
"order": 3,
|
||||
"registries": ["useBase"]
|
||||
}
|
||||
@@ -14,7 +14,7 @@ export interface IRole {
|
||||
|
||||
export interface IInvolvedParty {
|
||||
role: string;
|
||||
contact: plugins.tsclass.business.IContact;
|
||||
contact: plugins.tsclass.business.TContact;
|
||||
}
|
||||
|
||||
export interface IPortableContract {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
{
|
||||
"order": 1
|
||||
"name": "@signature.digital/interfaces",
|
||||
"order": 1,
|
||||
"registries": ["useBase"]
|
||||
}
|
||||
@@ -1,14 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"experimentalDecorators": true,
|
||||
"useDefineForClassFields": false,
|
||||
"target": "ES2022",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"esModuleInterop": true,
|
||||
"verbatimModuleSyntax": true
|
||||
"verbatimModuleSyntax": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@signature.digital/tools": ["./ts/index.js"],
|
||||
"@signature.digital/demodata": ["./ts_demodata/index.js"],
|
||||
"@signature.digital/interfaces": ["./ts_interfaces/index.js"]
|
||||
}
|
||||
},
|
||||
"exclude": [
|
||||
"dist_*/**/*.d.ts"
|
||||
]
|
||||
"exclude": ["dist_*/**/*.d.ts"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user