@techspokes/typescript-wsdl-client 0.9.0 → 0.9.2
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/LICENSE +21 -21
- package/README.md +222 -40
- package/dist/app/generateApp.d.ts +48 -0
- package/dist/app/generateApp.d.ts.map +1 -0
- package/dist/app/generateApp.js +553 -0
- package/dist/cli.js +145 -2
- package/dist/gateway/generators.d.ts.map +1 -1
- package/dist/gateway/generators.js +6 -3
- package/dist/gateway/helpers.d.ts +18 -0
- package/dist/gateway/helpers.d.ts.map +1 -1
- package/dist/gateway/helpers.js +117 -0
- package/dist/openapi/generateSchemas.js +1 -2
- package/dist/pipeline.d.ts +9 -1
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +19 -1
- package/package.json +3 -2
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 TechSpokes, Inc.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 TechSpokes, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
[](https://github.com/techspokes)
|
|
10
10
|
[](https://github.com/sponsors/TechSpokes)
|
|
11
11
|
|
|
12
|
-
> **Mission**: Transform complex WSDL/XSD definitions into ergonomic, type-safe TypeScript SOAP clients with optional OpenAPI 3.1 specs and Fastify REST
|
|
12
|
+
> **Mission**: Transform complex WSDL/XSD definitions into ergonomic, type-safe TypeScript SOAP clients with optional OpenAPI 3.1 specs and production-ready Fastify REST gateways — enabling confident integration with legacy enterprise services.
|
|
13
13
|
|
|
14
14
|
---
|
|
15
15
|
|
|
@@ -23,15 +23,16 @@
|
|
|
23
23
|
- [6. Command: `client`](#6-command-client)
|
|
24
24
|
- [7. Command: `openapi`](#7-command-openapi)
|
|
25
25
|
- [8. Command: `gateway`](#8-command-gateway)
|
|
26
|
-
- [9. Command: `
|
|
27
|
-
- [10.
|
|
28
|
-
- [11.
|
|
29
|
-
- [12.
|
|
30
|
-
- [13.
|
|
31
|
-
- [14.
|
|
32
|
-
- [15.
|
|
33
|
-
- [16.
|
|
34
|
-
- [17.
|
|
26
|
+
- [9. Command: `app`](#9-command-app)
|
|
27
|
+
- [10. Command: `pipeline`](#10-command-pipeline)
|
|
28
|
+
- [11. Working With Generated Clients](#11-working-with-generated-clients)
|
|
29
|
+
- [12. OpenAPI Configuration](#12-openapi-configuration)
|
|
30
|
+
- [13. Programmatic API](#13-programmatic-api)
|
|
31
|
+
- [14. Advanced Topics](#14-advanced-topics)
|
|
32
|
+
- [15. Troubleshooting](#15-troubleshooting)
|
|
33
|
+
- [16. Contributing](#16-contributing)
|
|
34
|
+
- [17. License](#17-license)
|
|
35
|
+
- [18. Sponsors](#18-sponsors)
|
|
35
36
|
|
|
36
37
|
---
|
|
37
38
|
|
|
@@ -51,7 +52,7 @@ Most WSDL generators produce loosely typed stubs or expose raw XML complexity to
|
|
|
51
52
|
| **Catalog Introspection** | One JSON artifact (`catalog.json`) to drive further tooling (including OpenAPI & gateway). |
|
|
52
53
|
| **OpenAPI 3.1 Bridge** | Mirrors the exact TypeScript model with no divergence between runtime and spec. |
|
|
53
54
|
| **Standard Response Envelope** | Always-on, debuggable envelope structure (status, message, data, error) for REST gateways. |
|
|
54
|
-
| **Fastify Gateway
|
|
55
|
+
| **Fastify Gateway Generation** | Production-ready route handlers with SOAP client integration and standardized envelope responses. |
|
|
55
56
|
| **Multi-format Output** | `--openapi-format json\|yaml\|both` with always-on validation (unless disabled). |
|
|
56
57
|
| **One-Shot Pipeline** | Single pass (parse to TS to OpenAPI to Gateway) for CI & automation. |
|
|
57
58
|
|
|
@@ -104,15 +105,16 @@ npx wsdl-tsc pipeline \
|
|
|
104
105
|
|
|
105
106
|
## 4. Commands Overview
|
|
106
107
|
|
|
107
|
-
The tool provides **
|
|
108
|
+
The tool provides **six commands** for different integration scenarios:
|
|
108
109
|
|
|
109
|
-
| Command
|
|
110
|
-
|
|
111
|
-
| `compile`
|
|
112
|
-
| `client`
|
|
113
|
-
| `openapi`
|
|
114
|
-
| `gateway`
|
|
115
|
-
| `
|
|
110
|
+
| Command | Purpose | Typical Use Case |
|
|
111
|
+
|------------|----------------------------------------------------------------|-----------------------------------------------|
|
|
112
|
+
| `compile` | Parse WSDL and emit `catalog.json` only | Debugging, inspection, or multi-stage builds |
|
|
113
|
+
| `client` | Generate TypeScript SOAP client from WSDL or catalog | Standard SOAP integration (most common) |
|
|
114
|
+
| `openapi` | Generate OpenAPI 3.1 spec from WSDL or catalog | Documentation, REST proxies, API gateways |
|
|
115
|
+
| `gateway` | Generate Fastify gateway with full handlers from OpenAPI spec | Production REST gateway with SOAP integration |
|
|
116
|
+
| `app` | Generate runnable Fastify app from client + gateway + OpenAPI | Local testing, quick iteration, demos |
|
|
117
|
+
| `pipeline` | Run full pipeline: client + OpenAPI + gateway (+ app optional) | CI/CD automation, complete stack generation |
|
|
116
118
|
|
|
117
119
|
---
|
|
118
120
|
|
|
@@ -579,23 +581,21 @@ This ensures diff-friendly output for version control.
|
|
|
579
581
|
|
|
580
582
|
## 8. Command: `gateway`
|
|
581
583
|
|
|
582
|
-
**Purpose**: Generate Fastify gateway
|
|
583
|
-
|
|
584
|
-
> **Current Status (v0.8.0)**: The gateway generator produces basic scaffolding including route registration, JSON Schema validation setup, and handler stubs. Full code generation with complete handler implementations is planned for future releases. You will need to implement the business logic that calls your SOAP client and transforms responses.
|
|
584
|
+
**Purpose**: Generate a production-ready Fastify gateway with fully functional route handlers from an OpenAPI 3.1 specification. This creates a complete REST API layer over your SOAP client with automatic request/response transformation and standardized envelope responses.
|
|
585
585
|
|
|
586
586
|
**When to use**:
|
|
587
587
|
- Building a REST API gateway for legacy SOAP services
|
|
588
588
|
- Creating a modern HTTP/JSON interface for SOAP operations
|
|
589
589
|
- Setting up request/response validation with JSON Schema
|
|
590
|
-
- Establishing Fastify routing structure
|
|
590
|
+
- Establishing Fastify routing structure with full handler implementations
|
|
591
591
|
|
|
592
592
|
**What it generates**:
|
|
593
|
-
- Fastify route registration files
|
|
593
|
+
- Fastify route registration files with complete handler implementations
|
|
594
594
|
- JSON Schema models with URN-based IDs
|
|
595
595
|
- Operation schemas (request/response validation)
|
|
596
596
|
- Schema and route registration modules
|
|
597
|
-
-
|
|
598
|
-
-
|
|
597
|
+
- Runtime utilities (envelope builders, error handlers)
|
|
598
|
+
- Fastify plugin wrapper for simplified integration
|
|
599
599
|
|
|
600
600
|
### Usage
|
|
601
601
|
|
|
@@ -647,8 +647,8 @@ npx wsdl-tsc gateway \
|
|
|
647
647
|
│ ├── <operation1>.json
|
|
648
648
|
│ ├── <operation2>.json
|
|
649
649
|
│ └── ...
|
|
650
|
-
├── routes/ #
|
|
651
|
-
│ ├── <route1>.ts
|
|
650
|
+
├── routes/ # Route registration files with full handlers
|
|
651
|
+
│ ├── <route1>.ts
|
|
652
652
|
│ ├── <route2>.ts
|
|
653
653
|
│ └── ...
|
|
654
654
|
├── schemas.ts # Schema registration module
|
|
@@ -848,9 +848,9 @@ The centralized error handler (`runtime.ts`) automatically classifies errors:
|
|
|
848
848
|
| Timeout | 504 | `GATEWAY_TIMEOUT` |
|
|
849
849
|
| Other errors | 500 | `INTERNAL_ERROR` |
|
|
850
850
|
|
|
851
|
-
### Stub Handler Mode (
|
|
851
|
+
### Stub Handler Mode (Backward Compatible)
|
|
852
852
|
|
|
853
|
-
|
|
853
|
+
If you prefer to implement handler logic manually or need custom transformation logic beyond the standard SOAP-to-REST mapping, use stub mode:
|
|
854
854
|
|
|
855
855
|
```bash
|
|
856
856
|
npx wsdl-tsc gateway \
|
|
@@ -862,11 +862,193 @@ npx wsdl-tsc gateway \
|
|
|
862
862
|
--gateway-stub-handlers
|
|
863
863
|
```
|
|
864
864
|
|
|
865
|
-
This generates handler stubs that throw "Not implemented" errors, allowing you to implement custom logic.
|
|
865
|
+
This generates minimal handler stubs that throw "Not implemented" errors, allowing you to implement fully custom logic while keeping the routing and validation infrastructure.
|
|
866
|
+
|
|
867
|
+
---
|
|
868
|
+
|
|
869
|
+
## 9. Command: `app`
|
|
870
|
+
|
|
871
|
+
**Purpose**: Generate a runnable Fastify application that integrates the generated client, gateway, and OpenAPI spec. This provides an immediately executable server for testing, development, and demonstrations.
|
|
872
|
+
|
|
873
|
+
**When to use**:
|
|
874
|
+
- Local testing and development
|
|
875
|
+
- Quick iteration on gateway configurations
|
|
876
|
+
- Demonstrating the generated API
|
|
877
|
+
- CI smoke testing
|
|
878
|
+
|
|
879
|
+
### Usage
|
|
880
|
+
|
|
881
|
+
```bash
|
|
882
|
+
npx wsdl-tsc app \
|
|
883
|
+
--client-dir <path> \
|
|
884
|
+
--gateway-dir <path> \
|
|
885
|
+
--openapi-file <path> \
|
|
886
|
+
[--catalog-file <path>] \
|
|
887
|
+
[--app-dir <path>] \
|
|
888
|
+
[options]
|
|
889
|
+
```
|
|
890
|
+
|
|
891
|
+
### Required Flags
|
|
892
|
+
|
|
893
|
+
| Flag | Description |
|
|
894
|
+
|------------------|----------------------------------------------------------|
|
|
895
|
+
| `--client-dir` | Path to client directory (where `client.ts` is located) |
|
|
896
|
+
| `--gateway-dir` | Path to gateway directory (where `plugin.ts` is located) |
|
|
897
|
+
| `--openapi-file` | Path to OpenAPI specification file |
|
|
898
|
+
|
|
899
|
+
### Optional Flags
|
|
900
|
+
|
|
901
|
+
| Flag | Default | Description |
|
|
902
|
+
|-----------------------|-------------------------------|---------------------------------------------------|
|
|
903
|
+
| `--catalog-file` | `{client-dir}/catalog.json` | Path to catalog.json (for metadata extraction) |
|
|
904
|
+
| `--app-dir` | `{gateway-dir}/../app` | Output directory for generated app |
|
|
905
|
+
| `--import-extensions` | Inferred from catalog or `js` | Import-extension mode: `js`, `ts`, or `bare` |
|
|
906
|
+
| `--host` | `127.0.0.1` | Default server host |
|
|
907
|
+
| `--port` | `3000` | Default server port |
|
|
908
|
+
| `--prefix` | `""` (empty) | Route prefix |
|
|
909
|
+
| `--logger` | `true` | Enable Fastify logger |
|
|
910
|
+
| `--openapi-mode` | `copy` | How to handle OpenAPI file: `copy` or `reference` |
|
|
911
|
+
|
|
912
|
+
### Examples
|
|
913
|
+
|
|
914
|
+
#### Generate App After Pipeline
|
|
915
|
+
|
|
916
|
+
```bash
|
|
917
|
+
# First generate client, OpenAPI, and gateway
|
|
918
|
+
npx wsdl-tsc pipeline \
|
|
919
|
+
--wsdl-source weather.wsdl \
|
|
920
|
+
--client-dir ./client \
|
|
921
|
+
--openapi-file ./openapi.json \
|
|
922
|
+
--gateway-dir ./gateway \
|
|
923
|
+
--gateway-service-name weather \
|
|
924
|
+
--gateway-version-prefix v1
|
|
925
|
+
|
|
926
|
+
# Then generate runnable app
|
|
927
|
+
npx wsdl-tsc app \
|
|
928
|
+
--client-dir ./client \
|
|
929
|
+
--gateway-dir ./gateway \
|
|
930
|
+
--openapi-file ./openapi.json \
|
|
931
|
+
--app-dir ./app
|
|
932
|
+
```
|
|
933
|
+
|
|
934
|
+
#### Generate App with Custom Configuration
|
|
935
|
+
|
|
936
|
+
```bash
|
|
937
|
+
npx wsdl-tsc app \
|
|
938
|
+
--client-dir ./client \
|
|
939
|
+
--gateway-dir ./gateway \
|
|
940
|
+
--openapi-file ./openapi.json \
|
|
941
|
+
--app-dir ./my-app \
|
|
942
|
+
--host 0.0.0.0 \
|
|
943
|
+
--port 8080 \
|
|
944
|
+
--prefix /api/v1
|
|
945
|
+
```
|
|
946
|
+
|
|
947
|
+
### Generated App Structure
|
|
948
|
+
|
|
949
|
+
The `app` command generates the following files:
|
|
950
|
+
|
|
951
|
+
```
|
|
952
|
+
app/
|
|
953
|
+
├── server.js (or .ts) # Main application entry point
|
|
954
|
+
├── config.js (or .ts) # Configuration loader with env support
|
|
955
|
+
├── .env.example # Environment variable template
|
|
956
|
+
├── README.md # Usage instructions
|
|
957
|
+
└── openapi.json # OpenAPI spec (when --openapi-mode=copy)
|
|
958
|
+
```
|
|
959
|
+
|
|
960
|
+
### Running the Generated App
|
|
961
|
+
|
|
962
|
+
```bash
|
|
963
|
+
# Copy environment template
|
|
964
|
+
cd app
|
|
965
|
+
cp .env.example .env
|
|
966
|
+
|
|
967
|
+
# Edit .env to configure WSDL source and other settings
|
|
968
|
+
# vim .env
|
|
969
|
+
|
|
970
|
+
# Run the server
|
|
971
|
+
npx tsx server.js # For TypeScript files
|
|
972
|
+
# or
|
|
973
|
+
node server.js # For JavaScript files
|
|
974
|
+
```
|
|
975
|
+
|
|
976
|
+
### Configuration
|
|
977
|
+
|
|
978
|
+
The generated app loads configuration from environment variables with the following precedence:
|
|
979
|
+
|
|
980
|
+
1. **Environment variables** (runtime overrides)
|
|
981
|
+
2. **Catalog defaults** (from generation-time)
|
|
982
|
+
3. **Hard defaults** (in config file)
|
|
983
|
+
|
|
984
|
+
#### Environment Variables
|
|
985
|
+
|
|
986
|
+
| Variable | Default (from catalog or flags) | Description |
|
|
987
|
+
|-----------------|---------------------------------|--------------------------------------|
|
|
988
|
+
| `WSDL_SOURCE` | From catalog or **required** | WSDL URL or local file path |
|
|
989
|
+
| `HOST` | `127.0.0.1` | Server bind address |
|
|
990
|
+
| `PORT` | `3000` | Server listen port |
|
|
991
|
+
| `PREFIX` | `""` (empty) | Route prefix |
|
|
992
|
+
| `LOGGER` | `true` | Enable Fastify logger |
|
|
993
|
+
|
|
994
|
+
### Endpoints
|
|
995
|
+
|
|
996
|
+
The generated app serves the following endpoints:
|
|
997
|
+
|
|
998
|
+
#### Health Check
|
|
999
|
+
```bash
|
|
1000
|
+
GET /health
|
|
1001
|
+
```
|
|
1002
|
+
Returns: `{ "ok": true }`
|
|
1003
|
+
|
|
1004
|
+
#### OpenAPI Specification
|
|
1005
|
+
```bash
|
|
1006
|
+
GET /openapi.json
|
|
1007
|
+
```
|
|
1008
|
+
Returns: Complete OpenAPI 3.1 specification
|
|
1009
|
+
|
|
1010
|
+
#### Gateway Routes
|
|
1011
|
+
All SOAP operations are exposed as REST endpoints. See the OpenAPI spec for complete API documentation.
|
|
1012
|
+
|
|
1013
|
+
### Example Usage
|
|
1014
|
+
|
|
1015
|
+
```bash
|
|
1016
|
+
# Start the server
|
|
1017
|
+
cd app
|
|
1018
|
+
npx tsx server.js
|
|
1019
|
+
|
|
1020
|
+
# Test health endpoint
|
|
1021
|
+
curl http://localhost:3000/health
|
|
1022
|
+
|
|
1023
|
+
# Get OpenAPI spec
|
|
1024
|
+
curl http://localhost:3000/openapi.json | jq .
|
|
1025
|
+
|
|
1026
|
+
# Call a gateway operation (example)
|
|
1027
|
+
curl -X POST http://localhost:3000/get-weather-information \
|
|
1028
|
+
-H "Content-Type: application/json" \
|
|
1029
|
+
-d '{}'
|
|
1030
|
+
```
|
|
1031
|
+
|
|
1032
|
+
### Integration with Pipeline
|
|
1033
|
+
|
|
1034
|
+
The `app` command can also be used via the pipeline with the `--generate-app` flag:
|
|
1035
|
+
|
|
1036
|
+
```bash
|
|
1037
|
+
npx wsdl-tsc pipeline \
|
|
1038
|
+
--wsdl-source weather.wsdl \
|
|
1039
|
+
--client-dir ./client \
|
|
1040
|
+
--openapi-file ./openapi.json \
|
|
1041
|
+
--gateway-dir ./gateway \
|
|
1042
|
+
--gateway-service-name weather \
|
|
1043
|
+
--gateway-version-prefix v1 \
|
|
1044
|
+
--generate-app
|
|
1045
|
+
```
|
|
1046
|
+
|
|
1047
|
+
This generates all artifacts including the runnable app in a single command.
|
|
866
1048
|
|
|
867
1049
|
---
|
|
868
1050
|
|
|
869
|
-
##
|
|
1051
|
+
## 10. Command: `pipeline`
|
|
870
1052
|
|
|
871
1053
|
**Purpose**: Run the complete generation pipeline in a single pass: WSDL parsing → TypeScript client → OpenAPI spec → Fastify gateway.
|
|
872
1054
|
|
|
@@ -1044,7 +1226,7 @@ All steps share the same parsed WSDL and compiled catalog, ensuring consistency.
|
|
|
1044
1226
|
|
|
1045
1227
|
---
|
|
1046
1228
|
|
|
1047
|
-
##
|
|
1229
|
+
## 11. Working With Generated Clients
|
|
1048
1230
|
|
|
1049
1231
|
### Client Construction
|
|
1050
1232
|
|
|
@@ -1111,7 +1293,7 @@ result.GetCityWeatherByZIPResult.Temperature; // number | string (depends on ma
|
|
|
1111
1293
|
|
|
1112
1294
|
---
|
|
1113
1295
|
|
|
1114
|
-
##
|
|
1296
|
+
## 12. OpenAPI Configuration
|
|
1115
1297
|
|
|
1116
1298
|
### Security Configuration (`security.json`)
|
|
1117
1299
|
|
|
@@ -1170,7 +1352,7 @@ Per-operation overrides for method, summary, description, and deprecation:
|
|
|
1170
1352
|
|
|
1171
1353
|
---
|
|
1172
1354
|
|
|
1173
|
-
##
|
|
1355
|
+
## 13. Programmatic API
|
|
1174
1356
|
|
|
1175
1357
|
All CLI commands are available as TypeScript functions for programmatic usage.
|
|
1176
1358
|
|
|
@@ -1437,7 +1619,7 @@ interface PipelineOptions {
|
|
|
1437
1619
|
|
|
1438
1620
|
---
|
|
1439
1621
|
|
|
1440
|
-
##
|
|
1622
|
+
## 14. Advanced Topics
|
|
1441
1623
|
|
|
1442
1624
|
### Primitive Mapping Philosophy
|
|
1443
1625
|
|
|
@@ -1512,7 +1694,7 @@ Disable with `--openapi-validate false` or `validate: false` in API.
|
|
|
1512
1694
|
|
|
1513
1695
|
---
|
|
1514
1696
|
|
|
1515
|
-
##
|
|
1697
|
+
## 15. Troubleshooting
|
|
1516
1698
|
|
|
1517
1699
|
### Common Issues
|
|
1518
1700
|
|
|
@@ -1593,7 +1775,7 @@ The catalog is automatically placed at `./src/services/hotel/catalog.json`.
|
|
|
1593
1775
|
|
|
1594
1776
|
---
|
|
1595
1777
|
|
|
1596
|
-
##
|
|
1778
|
+
## 16. Contributing
|
|
1597
1779
|
|
|
1598
1780
|
We welcome contributions! Here's how to get started:
|
|
1599
1781
|
|
|
@@ -1667,7 +1849,7 @@ See also: [CONTRIBUTING.md](CONTRIBUTING.md), [CODE_OF_CONDUCT.md](CODE_OF_CONDU
|
|
|
1667
1849
|
|
|
1668
1850
|
---
|
|
1669
1851
|
|
|
1670
|
-
##
|
|
1852
|
+
## 17. License
|
|
1671
1853
|
|
|
1672
1854
|
MIT © TechSpokes
|
|
1673
1855
|
|
|
@@ -1677,7 +1859,7 @@ See [LICENSE](LICENSE) for full text.
|
|
|
1677
1859
|
|
|
1678
1860
|
---
|
|
1679
1861
|
|
|
1680
|
-
##
|
|
1862
|
+
## 18. Sponsors
|
|
1681
1863
|
|
|
1682
1864
|
Support ongoing development and maintenance:
|
|
1683
1865
|
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for app generation
|
|
3
|
+
*
|
|
4
|
+
* @interface GenerateAppOptions
|
|
5
|
+
* @property {string} clientDir - Path to client directory (where client.ts is located)
|
|
6
|
+
* @property {string} gatewayDir - Path to gateway directory (where plugin.ts is located)
|
|
7
|
+
* @property {string} openapiFile - Path to OpenAPI spec file
|
|
8
|
+
* @property {string} catalogFile - Path to catalog.json (required)
|
|
9
|
+
* @property {string} appDir - Output directory for generated app
|
|
10
|
+
* @property {"js"|"ts"|"bare"} [imports] - Import-extension mode (default: "js")
|
|
11
|
+
* @property {string} [host] - Default server host (default: "127.0.0.1")
|
|
12
|
+
* @property {number} [port] - Default server port (default: 3000)
|
|
13
|
+
* @property {string} [prefix] - Route prefix (default: "")
|
|
14
|
+
* @property {boolean} [logger] - Enable Fastify logger (default: true)
|
|
15
|
+
* @property {"copy"|"reference"} [openapiMode] - How to handle OpenAPI file (default: "copy")
|
|
16
|
+
*/
|
|
17
|
+
export interface GenerateAppOptions {
|
|
18
|
+
clientDir: string;
|
|
19
|
+
gatewayDir: string;
|
|
20
|
+
openapiFile: string;
|
|
21
|
+
catalogFile: string;
|
|
22
|
+
appDir: string;
|
|
23
|
+
imports?: "js" | "ts" | "bare";
|
|
24
|
+
host?: string;
|
|
25
|
+
port?: number;
|
|
26
|
+
prefix?: string;
|
|
27
|
+
logger?: boolean;
|
|
28
|
+
openapiMode?: "copy" | "reference";
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Generates a runnable Fastify application
|
|
32
|
+
*
|
|
33
|
+
* This function orchestrates the complete app generation process:
|
|
34
|
+
* 1. Validates all required inputs exist
|
|
35
|
+
* 2. Reads catalog.json for metadata
|
|
36
|
+
* 3. Creates app directory
|
|
37
|
+
* 4. Generates server.ts with Fastify setup
|
|
38
|
+
* 5. Generates config.ts with environment loading
|
|
39
|
+
* 6. Generates .env.example with configuration template
|
|
40
|
+
* 7. Generates README.md with usage instructions
|
|
41
|
+
* 8. Optionally copies OpenAPI spec into app directory
|
|
42
|
+
*
|
|
43
|
+
* @param {GenerateAppOptions} opts - App generation options
|
|
44
|
+
* @returns {Promise<void>}
|
|
45
|
+
* @throws {Error} If validation fails or required files are missing
|
|
46
|
+
*/
|
|
47
|
+
export declare function generateApp(opts: GenerateAppOptions): Promise<void>;
|
|
48
|
+
//# sourceMappingURL=generateApp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generateApp.d.ts","sourceRoot":"","sources":["../../src/app/generateApp.ts"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;CACpC;AA2gBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqCzE"}
|