bridgelist 1.1.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +119 -119
- package/dist/decorators/text-documentation.d.ts +2 -0
- package/dist/decorators/text-documentation.js +9 -0
- package/dist/decorators/text-documentation.js.map +1 -0
- package/dist/generators/doc-generator-html.d.ts +1 -1
- package/dist/generators/doc-generator-html.js +335 -308
- package/dist/generators/doc-generator-html.js.map +1 -1
- package/dist/generators/mapping-generator.js +27 -4
- package/dist/generators/mapping-generator.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +6 -0
- package/dist/utils/find-decorated-methods.js +4 -0
- package/dist/utils/find-decorated-methods.js.map +1 -1
- package/dist/utils/find-decorated-properties.d.ts +14 -0
- package/dist/utils/find-decorated-properties.js +50 -0
- package/dist/utils/find-decorated-properties.js.map +1 -0
- package/dist/utils/text-documentation-scanner.d.ts +7 -0
- package/dist/utils/text-documentation-scanner.js +53 -0
- package/dist/utils/text-documentation-scanner.js.map +1 -0
- package/package.json +41 -41
- package/tsconfig.json +23 -23
- package/dist/decorators/mapping-documentation.d.ts.map +0 -1
- package/dist/generators/html-generator.d.ts +0 -1
- package/dist/generators/html-generator.d.ts.map +0 -1
- package/dist/generators/html-generator.js +0 -278
- package/dist/generators/html-generator.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/utils/project-scanner.d.ts +0 -21
- package/dist/utils/project-scanner.js +0 -175
- package/dist/utils/project-scanner.js.map +0 -1
- package/docs/documentation.html +0 -434
package/README.md
CHANGED
|
@@ -1,119 +1,119 @@
|
|
|
1
|
-
# bridgelist
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/bridgelist)
|
|
4
|
-
[](https://opensource.org/licenses/MIT)
|
|
5
|
-
[](https://www.typescriptlang.org/)
|
|
6
|
-
|
|
7
|
-
A TypeScript-based tool for automatically documenting field mappings between different API systems. Generate documentation from your mapping code using simple decorators.
|
|
8
|
-
|
|
9
|
-

|
|
10
|
-
|
|
11
|
-
## Installation
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm install bridgelist
|
|
15
|
-
# or
|
|
16
|
-
yarn add bridgelist
|
|
17
|
-
# or
|
|
18
|
-
pnpm add bridgelist
|
|
19
|
-
```
|
|
20
|
-
## Features
|
|
21
|
-
- **Automatic Mapping Detection**: Analyzes your TypeScript code to identify mapping relationships
|
|
22
|
-
- **Decorator-based Configuration**: Add metadata to your mapping methods
|
|
23
|
-
- **HTML Documentation Generation**: Creates clear and interactive documentation
|
|
24
|
-
- **Supports Various Mapping Types**:
|
|
25
|
-
- Direct mappings
|
|
26
|
-
- Transformations
|
|
27
|
-
- Constant values
|
|
28
|
-
- Nested objects
|
|
29
|
-
|
|
30
|
-
## Usage
|
|
31
|
-
### Basic Usage
|
|
32
|
-
1. Import the necessary functions:
|
|
33
|
-
``` typescript
|
|
34
|
-
import { GenerateMappingDocumentation, generateDocumentation } from 'bridgelist';
|
|
35
|
-
```
|
|
36
|
-
2. Extend tsconfig.json settings
|
|
37
|
-
|
|
38
|
-
```json
|
|
39
|
-
{
|
|
40
|
-
"compilerOptions": {
|
|
41
|
-
|
|
42
|
-
"experimentalDecorators": true
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
```
|
|
47
|
-
3. Decorate your mapping methods:
|
|
48
|
-
``` typescript
|
|
49
|
-
class SimpleMapper {
|
|
50
|
-
@GenerateMappingDocumentation({
|
|
51
|
-
sourceSystem: 'System A',
|
|
52
|
-
targetSystem: 'System B',
|
|
53
|
-
description: 'Converts customer data from System A to System B'
|
|
54
|
-
})
|
|
55
|
-
mapCustomer(sourceData: any): any {
|
|
56
|
-
return {
|
|
57
|
-
id: sourceData.id,
|
|
58
|
-
firstName: sourceData.properties.firstname,
|
|
59
|
-
lastName: sourceData.properties.lastname,
|
|
60
|
-
// more mappings...
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
```
|
|
65
|
-
4. Generate the documentation:
|
|
66
|
-
``` typescript
|
|
67
|
-
// Scans the project and creates HTML documentation
|
|
68
|
-
generateDocumentation('./docs/api-mappings.html');
|
|
69
|
-
```
|
|
70
|
-
### Complex Mappings
|
|
71
|
-
The tool automatically recognizes different types of mappings:
|
|
72
|
-
``` typescript
|
|
73
|
-
class ComplexMapper {
|
|
74
|
-
@GenerateMappingDocumentation({
|
|
75
|
-
sourceSystem: 'CRM',
|
|
76
|
-
targetSystem: 'ERP',
|
|
77
|
-
description: 'Converts CRM contacts to ERP customers'
|
|
78
|
-
})
|
|
79
|
-
mapContactToCustomer(contact: any): any {
|
|
80
|
-
return {
|
|
81
|
-
// Direct mapping
|
|
82
|
-
customerId: contact.id,
|
|
83
|
-
|
|
84
|
-
// Constant value
|
|
85
|
-
defaultCountry: 'Germany',
|
|
86
|
-
|
|
87
|
-
// Transformation
|
|
88
|
-
fullName: `${contact.firstName} ${contact.lastName}`,
|
|
89
|
-
|
|
90
|
-
// Nested object
|
|
91
|
-
address: {
|
|
92
|
-
street: contact.address.streetName,
|
|
93
|
-
city: contact.address.city,
|
|
94
|
-
country: defaultCountry
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
```
|
|
100
|
-
## API Reference
|
|
101
|
-
### `GenerateMappingDocumentation(options)`
|
|
102
|
-
A decorator to mark mapping methods with metadata.
|
|
103
|
-
#### Parameters
|
|
104
|
-
- `options`: An object with the following properties:
|
|
105
|
-
- `sourceSystem` (string, required): Name of the source system
|
|
106
|
-
- `targetSystem` (string, required): Name of the target system
|
|
107
|
-
- `description` (string, optional): Description of the mapping
|
|
108
|
-
|
|
109
|
-
### `generateDocumentation(outputPath)`
|
|
110
|
-
Scans the project for decorated methods and generates HTML documentation.
|
|
111
|
-
#### Parameters
|
|
112
|
-
- `outputPath` (string, required): Path where the HTML documentation should be saved
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
### `scanProject(rootDir)`
|
|
116
|
-
Recursively scans a directory for TypeScript files with decorated mapping methods.
|
|
117
|
-
#### Parameters
|
|
118
|
-
- `rootDir` (string, required): Path to the root directory of the project to scan
|
|
119
|
-
|
|
1
|
+
# bridgelist
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/bridgelist)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://www.typescriptlang.org/)
|
|
6
|
+
|
|
7
|
+
A TypeScript-based tool for automatically documenting field mappings between different API systems. Generate documentation from your mapping code using simple decorators.
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install bridgelist
|
|
15
|
+
# or
|
|
16
|
+
yarn add bridgelist
|
|
17
|
+
# or
|
|
18
|
+
pnpm add bridgelist
|
|
19
|
+
```
|
|
20
|
+
## Features
|
|
21
|
+
- **Automatic Mapping Detection**: Analyzes your TypeScript code to identify mapping relationships
|
|
22
|
+
- **Decorator-based Configuration**: Add metadata to your mapping methods
|
|
23
|
+
- **HTML Documentation Generation**: Creates clear and interactive documentation
|
|
24
|
+
- **Supports Various Mapping Types**:
|
|
25
|
+
- Direct mappings
|
|
26
|
+
- Transformations
|
|
27
|
+
- Constant values
|
|
28
|
+
- Nested objects
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
### Basic Usage
|
|
32
|
+
1. Import the necessary functions:
|
|
33
|
+
``` typescript
|
|
34
|
+
import { GenerateMappingDocumentation, generateDocumentation } from 'bridgelist';
|
|
35
|
+
```
|
|
36
|
+
2. Extend tsconfig.json settings
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"compilerOptions": {
|
|
41
|
+
|
|
42
|
+
"experimentalDecorators": true
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
3. Decorate your mapping methods:
|
|
48
|
+
``` typescript
|
|
49
|
+
class SimpleMapper {
|
|
50
|
+
@GenerateMappingDocumentation({
|
|
51
|
+
sourceSystem: 'System A',
|
|
52
|
+
targetSystem: 'System B',
|
|
53
|
+
description: 'Converts customer data from System A to System B'
|
|
54
|
+
})
|
|
55
|
+
mapCustomer(sourceData: any): any {
|
|
56
|
+
return {
|
|
57
|
+
id: sourceData.id,
|
|
58
|
+
firstName: sourceData.properties.firstname,
|
|
59
|
+
lastName: sourceData.properties.lastname,
|
|
60
|
+
// more mappings...
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
4. Generate the documentation:
|
|
66
|
+
``` typescript
|
|
67
|
+
// Scans the project and creates HTML documentation
|
|
68
|
+
generateDocumentation('./docs/api-mappings.html');
|
|
69
|
+
```
|
|
70
|
+
### Complex Mappings
|
|
71
|
+
The tool automatically recognizes different types of mappings:
|
|
72
|
+
``` typescript
|
|
73
|
+
class ComplexMapper {
|
|
74
|
+
@GenerateMappingDocumentation({
|
|
75
|
+
sourceSystem: 'CRM',
|
|
76
|
+
targetSystem: 'ERP',
|
|
77
|
+
description: 'Converts CRM contacts to ERP customers'
|
|
78
|
+
})
|
|
79
|
+
mapContactToCustomer(contact: any): any {
|
|
80
|
+
return {
|
|
81
|
+
// Direct mapping
|
|
82
|
+
customerId: contact.id,
|
|
83
|
+
|
|
84
|
+
// Constant value
|
|
85
|
+
defaultCountry: 'Germany',
|
|
86
|
+
|
|
87
|
+
// Transformation
|
|
88
|
+
fullName: `${contact.firstName} ${contact.lastName}`,
|
|
89
|
+
|
|
90
|
+
// Nested object
|
|
91
|
+
address: {
|
|
92
|
+
street: contact.address.streetName,
|
|
93
|
+
city: contact.address.city,
|
|
94
|
+
country: defaultCountry
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
## API Reference
|
|
101
|
+
### `GenerateMappingDocumentation(options)`
|
|
102
|
+
A decorator to mark mapping methods with metadata.
|
|
103
|
+
#### Parameters
|
|
104
|
+
- `options`: An object with the following properties:
|
|
105
|
+
- `sourceSystem` (string, required): Name of the source system
|
|
106
|
+
- `targetSystem` (string, required): Name of the target system
|
|
107
|
+
- `description` (string, optional): Description of the mapping
|
|
108
|
+
|
|
109
|
+
### `generateDocumentation(outputPath)`
|
|
110
|
+
Scans the project for decorated methods and generates HTML documentation.
|
|
111
|
+
#### Parameters
|
|
112
|
+
- `outputPath` (string, required): Path where the HTML documentation should be saved
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
### `scanProject(rootDir)`
|
|
116
|
+
Recursively scans a directory for TypeScript files with decorated mapping methods.
|
|
117
|
+
#### Parameters
|
|
118
|
+
- `rootDir` (string, required): Path to the root directory of the project to scan
|
|
119
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GenerateTextDocumentation = GenerateTextDocumentation;
|
|
4
|
+
function GenerateTextDocumentation(options) {
|
|
5
|
+
return function (target, propertyKey) {
|
|
6
|
+
return;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=text-documentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-documentation.js","sourceRoot":"","sources":["../../src/decorators/text-documentation.ts"],"names":[],"mappings":";;AAEA,8DAOC;AAPD,SAAgB,yBAAyB,CAAC,OAAiC;IACvE,OAAO,UACH,MAAW,EACX,WAAmB;QAEnB,OAAO;IACX,CAAC,CAAA;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function generateMappingDocumentationHTML(outputPath: string, mappingMethods?: any[], arrayMethods?: any[]): void;
|
|
1
|
+
export declare function generateMappingDocumentationHTML(outputPath: string, mappingMethods?: any[], arrayMethods?: any[], textDocs?: any[]): void;
|