@techspokes/typescript-wsdl-client 0.10.2 → 0.11.0
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 +28 -2
- package/dist/app/generateApp.d.ts +11 -5
- package/dist/app/generateApp.d.ts.map +1 -1
- package/dist/app/generateApp.js +262 -157
- package/dist/cli.js +67 -9
- package/dist/client/generateOperations.d.ts +13 -0
- package/dist/client/generateOperations.d.ts.map +1 -0
- package/dist/client/generateOperations.js +71 -0
- package/dist/compiler/schemaCompiler.d.ts.map +1 -1
- package/dist/compiler/schemaCompiler.js +15 -1
- package/dist/gateway/generateGateway.d.ts +1 -0
- package/dist/gateway/generateGateway.d.ts.map +1 -1
- package/dist/gateway/generateGateway.js +4 -2
- package/dist/gateway/generators.d.ts +2 -15
- package/dist/gateway/generators.d.ts.map +1 -1
- package/dist/gateway/generators.js +111 -27
- package/dist/gateway/helpers.d.ts +4 -2
- package/dist/gateway/helpers.d.ts.map +1 -1
- package/dist/gateway/helpers.js +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/loader/wsdlLoader.d.ts.map +1 -1
- package/dist/loader/wsdlLoader.js +30 -4
- package/dist/openapi/generateOpenAPI.d.ts +1 -0
- package/dist/openapi/generateOpenAPI.d.ts.map +1 -1
- package/dist/openapi/generateOpenAPI.js +1 -0
- package/dist/openapi/generateSchemas.d.ts +1 -0
- package/dist/openapi/generateSchemas.d.ts.map +1 -1
- package/dist/openapi/generateSchemas.js +4 -3
- package/dist/pipeline.d.ts +4 -0
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +10 -1
- package/dist/util/builder.d.ts.map +1 -1
- package/dist/util/builder.js +1 -0
- package/dist/util/cli.d.ts +3 -2
- package/dist/util/cli.d.ts.map +1 -1
- package/dist/util/cli.js +14 -4
- package/dist/util/errors.d.ts +37 -0
- package/dist/util/errors.d.ts.map +1 -0
- package/dist/util/errors.js +37 -0
- package/docs/README.md +1 -0
- package/docs/architecture.md +1 -1
- package/docs/cli-reference.md +46 -14
- package/docs/concepts.md +29 -2
- package/docs/gateway-guide.md +36 -2
- package/docs/generated-code.md +56 -0
- package/docs/testing.md +193 -0
- package/package.json +19 -13
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ npx wsdl-tsc pipeline \
|
|
|
35
35
|
--gateway-dir ./tmp/gateway \
|
|
36
36
|
--gateway-service-name weather \
|
|
37
37
|
--gateway-version-prefix v1 \
|
|
38
|
-
--
|
|
38
|
+
--init-app
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
This parses the WSDL, generates a typed SOAP client, creates an OpenAPI 3.1 spec, builds Fastify gateway handlers, and creates a runnable application.
|
|
@@ -43,7 +43,7 @@ This parses the WSDL, generates a typed SOAP client, creates an OpenAPI 3.1 spec
|
|
|
43
43
|
### Run and Test
|
|
44
44
|
|
|
45
45
|
```bash
|
|
46
|
-
cd tmp/app && cp .env.example .env &&
|
|
46
|
+
cd tmp/app && npm install && cp .env.example .env && npm start
|
|
47
47
|
```
|
|
48
48
|
|
|
49
49
|
```bash
|
|
@@ -62,6 +62,31 @@ curl -X POST http://localhost:3000/get-weather-information \
|
|
|
62
62
|
| Fastify Gateway | plugin.ts, routes/, schemas/ | Production REST handlers |
|
|
63
63
|
| Catalog | catalog.json | Compiled WSDL (debuggable, cacheable) |
|
|
64
64
|
|
|
65
|
+
## Testing With Generated Code
|
|
66
|
+
|
|
67
|
+
The generated `operations.ts` provides a typed interface for mocking the SOAP client without importing the concrete class or the `soap` package:
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
import type { WeatherOperations } from "./generated/client/operations.js";
|
|
71
|
+
|
|
72
|
+
const mockClient: WeatherOperations = {
|
|
73
|
+
GetCityWeatherByZIP: async (args) => ({
|
|
74
|
+
response: { GetCityWeatherByZIPResult: { Success: true, City: "Test" } },
|
|
75
|
+
headers: {},
|
|
76
|
+
}),
|
|
77
|
+
// ... other operations
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// Use with the gateway plugin
|
|
81
|
+
import Fastify from "fastify";
|
|
82
|
+
import { weatherGateway } from "./generated/gateway/plugin.js";
|
|
83
|
+
|
|
84
|
+
const app = Fastify();
|
|
85
|
+
await app.register(weatherGateway, { client: mockClient, prefix: "/v1/weather" });
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
See [Testing Guide](docs/testing.md) for integration test patterns and mock examples.
|
|
89
|
+
|
|
65
90
|
## Commands
|
|
66
91
|
|
|
67
92
|
| Command | Purpose |
|
|
@@ -85,6 +110,7 @@ See [CLI Reference](docs/cli-reference.md) for all flags and examples.
|
|
|
85
110
|
| [Gateway Guide](docs/gateway-guide.md) | Fastify integration and error handling |
|
|
86
111
|
| [Configuration](docs/configuration.md) | Security, tags, operations config files |
|
|
87
112
|
| [Production Guide](docs/production.md) | CI/CD, validation, logging, limitations |
|
|
113
|
+
| [Testing Guide](docs/testing.md) | Testing patterns and mock client examples |
|
|
88
114
|
| [Troubleshooting](docs/troubleshooting.md) | Common issues and debugging |
|
|
89
115
|
| [Working With Generated Code](docs/generated-code.md) | Using clients and types |
|
|
90
116
|
| [Architecture](docs/architecture.md) | Internal pipeline for contributors |
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* @property {string} [prefix] - Route prefix (default: "")
|
|
14
14
|
* @property {boolean} [logger] - Enable Fastify logger (default: true)
|
|
15
15
|
* @property {"copy"|"reference"} [openapiMode] - How to handle OpenAPI file (default: "copy")
|
|
16
|
+
* @property {boolean} [force] - Overwrite existing scaffold files (default: false)
|
|
16
17
|
*/
|
|
17
18
|
export interface GenerateAppOptions {
|
|
18
19
|
clientDir: string;
|
|
@@ -26,19 +27,24 @@ export interface GenerateAppOptions {
|
|
|
26
27
|
prefix?: string;
|
|
27
28
|
logger?: boolean;
|
|
28
29
|
openapiMode?: "copy" | "reference";
|
|
30
|
+
force?: boolean;
|
|
29
31
|
}
|
|
30
32
|
/**
|
|
31
|
-
* Generates a runnable Fastify application
|
|
33
|
+
* Generates a runnable Fastify application scaffold
|
|
32
34
|
*
|
|
33
|
-
* This function orchestrates the complete app
|
|
35
|
+
* This function orchestrates the complete app scaffold process:
|
|
34
36
|
* 1. Validates all required inputs exist
|
|
35
37
|
* 2. Reads catalog.json for metadata
|
|
36
38
|
* 3. Creates app directory
|
|
37
39
|
* 4. Generates server.ts with Fastify setup
|
|
38
40
|
* 5. Generates config.ts with environment loading
|
|
39
|
-
* 6. Generates .
|
|
40
|
-
* 7. Generates
|
|
41
|
-
* 8.
|
|
41
|
+
* 6. Generates package.json with dependencies
|
|
42
|
+
* 7. Generates tsconfig.json with TypeScript settings
|
|
43
|
+
* 8. Generates .env.example with configuration template
|
|
44
|
+
* 9. Generates README.md with usage instructions
|
|
45
|
+
* 10. Optionally copies OpenAPI spec into app directory
|
|
46
|
+
*
|
|
47
|
+
* Files that already exist are skipped unless force is true.
|
|
42
48
|
*
|
|
43
49
|
* @param {GenerateAppOptions} opts - App generation options
|
|
44
50
|
* @returns {Promise<void>}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateApp.d.ts","sourceRoot":"","sources":["../../src/app/generateApp.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generateApp.d.ts","sourceRoot":"","sources":["../../src/app/generateApp.ts"],"names":[],"mappings":"AA6BA;;;;;;;;;;;;;;;;GAgBG;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;IACnC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAymBD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiDzE"}
|