@techspokes/typescript-wsdl-client 0.7.15 → 0.8.14
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 +1504 -263
- package/dist/cli.js +423 -270
- package/dist/{emit/clientEmitter.d.ts → client/generateClient.d.ts} +2 -2
- package/dist/client/generateClient.d.ts.map +1 -0
- package/dist/{emit/clientEmitter.js → client/generateClient.js} +5 -5
- package/dist/{emit/typesEmitter.d.ts → client/generateTypes.d.ts} +4 -4
- package/dist/client/generateTypes.d.ts.map +1 -0
- package/dist/{emit/typesEmitter.js → client/generateTypes.js} +6 -6
- package/dist/{emit/utilsEmitter.d.ts → client/generateUtils.d.ts} +4 -4
- package/dist/client/generateUtils.d.ts.map +1 -0
- package/dist/{emit/utilsEmitter.js → client/generateUtils.js} +7 -7
- package/dist/{emit/catalogEmitter.d.ts → compiler/generateCatalog.d.ts} +4 -4
- package/dist/compiler/generateCatalog.d.ts.map +1 -0
- package/dist/{emit/catalogEmitter.js → compiler/generateCatalog.js} +5 -5
- package/dist/compiler/schemaCompiler.d.ts +1 -1
- package/dist/compiler/schemaCompiler.js +1 -1
- package/dist/config.d.ts +13 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +17 -0
- package/dist/gateway/generateGateway.d.ts +73 -0
- package/dist/gateway/generateGateway.d.ts.map +1 -0
- package/dist/gateway/generateGateway.js +135 -0
- package/dist/gateway/generators.d.ts +90 -0
- package/dist/gateway/generators.d.ts.map +1 -0
- package/dist/gateway/generators.js +270 -0
- package/dist/gateway/helpers.d.ts +115 -0
- package/dist/gateway/helpers.d.ts.map +1 -0
- package/dist/gateway/helpers.js +224 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -18
- package/dist/loader/wsdlLoader.d.ts.map +1 -1
- package/dist/loader/wsdlLoader.js +1 -3
- package/dist/openapi/generateOpenAPI.d.ts +25 -1
- package/dist/openapi/generateOpenAPI.d.ts.map +1 -1
- package/dist/openapi/generateOpenAPI.js +28 -27
- package/dist/openapi/{buildPaths.d.ts → generatePaths.d.ts} +6 -6
- package/dist/openapi/generatePaths.d.ts.map +1 -0
- package/dist/openapi/{buildPaths.js → generatePaths.js} +1 -1
- package/dist/openapi/{buildSchemas.d.ts → generateSchemas.d.ts} +10 -10
- package/dist/openapi/generateSchemas.d.ts.map +1 -0
- package/dist/openapi/{buildSchemas.js → generateSchemas.js} +5 -5
- package/dist/openapi/security.d.ts.map +1 -1
- package/dist/openapi/security.js +2 -1
- package/dist/pipeline.d.ts +21 -7
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +66 -32
- package/dist/util/builder.d.ts +25 -0
- package/dist/util/builder.d.ts.map +1 -0
- package/dist/util/builder.js +52 -0
- package/dist/util/cli.d.ts +106 -0
- package/dist/util/cli.d.ts.map +1 -0
- package/dist/util/cli.js +164 -0
- package/package.json +11 -8
- package/dist/emit/catalogEmitter.d.ts.map +0 -1
- package/dist/emit/clientEmitter.d.ts.map +0 -1
- package/dist/emit/typesEmitter.d.ts.map +0 -1
- package/dist/emit/utilsEmitter.d.ts.map +0 -1
- package/dist/openapi/buildPaths.d.ts.map +0 -1
- package/dist/openapi/buildSchemas.d.ts.map +0 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builder Utilities for CLI Option Mapping
|
|
3
|
+
*
|
|
4
|
+
* This module provides helper functions to map CLI arguments to internal option structures,
|
|
5
|
+
* reducing redundancy across different CLI subcommands.
|
|
6
|
+
*/
|
|
7
|
+
import type { CompilerOptions } from "../config.js";
|
|
8
|
+
import type { GenerateOpenAPIOptions } from "../openapi/generateOpenAPI.js";
|
|
9
|
+
/**
|
|
10
|
+
* Build compiler options from parsed CLI arguments
|
|
11
|
+
*
|
|
12
|
+
* @param argv - Parsed yargs arguments containing compiler flags
|
|
13
|
+
* @returns Partial compiler options ready for resolveCompilerOptions
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildCompilerOptionsFromArgv(argv: any): Partial<CompilerOptions>;
|
|
16
|
+
/**
|
|
17
|
+
* Build OpenAPI generation options from parsed CLI arguments
|
|
18
|
+
*
|
|
19
|
+
* @param argv - Parsed yargs arguments containing OpenAPI flags
|
|
20
|
+
* @param format - Resolved format option
|
|
21
|
+
* @param servers - Parsed server URLs (from parseServers)
|
|
22
|
+
* @returns Partial OpenAPI options (excluding wsdl/catalogFile/compiledCatalog/outFile)
|
|
23
|
+
*/
|
|
24
|
+
export declare function buildOpenApiOptionsFromArgv(argv: any, format: "json" | "yaml" | "both" | undefined, servers: string[]): Omit<GenerateOpenAPIOptions, "wsdl" | "catalogFile" | "compiledCatalog" | "outFile">;
|
|
25
|
+
//# sourceMappingURL=builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/util/builder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,+BAA+B,CAAC;AAE1E;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,eAAe,CAAC,CAgBhF;AAED;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,EAC5C,OAAO,EAAE,MAAM,EAAE,GAChB,IAAI,CAAC,sBAAsB,EAAE,MAAM,GAAG,aAAa,GAAG,iBAAiB,GAAG,SAAS,CAAC,CAoBtF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Build compiler options from parsed CLI arguments
|
|
3
|
+
*
|
|
4
|
+
* @param argv - Parsed yargs arguments containing compiler flags
|
|
5
|
+
* @returns Partial compiler options ready for resolveCompilerOptions
|
|
6
|
+
*/
|
|
7
|
+
export function buildCompilerOptionsFromArgv(argv) {
|
|
8
|
+
return {
|
|
9
|
+
imports: argv["import-extensions"],
|
|
10
|
+
catalog: argv.catalog,
|
|
11
|
+
primitive: {
|
|
12
|
+
int64As: argv["client-int64-as"],
|
|
13
|
+
bigIntegerAs: argv["client-bigint-as"],
|
|
14
|
+
decimalAs: argv["client-decimal-as"],
|
|
15
|
+
dateAs: argv["client-date-as"],
|
|
16
|
+
},
|
|
17
|
+
choice: argv["client-choice-mode"],
|
|
18
|
+
failOnUnresolved: argv["client-fail-on-unresolved"],
|
|
19
|
+
attributesKey: argv["client-attributes-key"],
|
|
20
|
+
clientName: argv["client-class-name"],
|
|
21
|
+
nillableAsOptional: argv["client-nillable-as-optional"],
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Build OpenAPI generation options from parsed CLI arguments
|
|
26
|
+
*
|
|
27
|
+
* @param argv - Parsed yargs arguments containing OpenAPI flags
|
|
28
|
+
* @param format - Resolved format option
|
|
29
|
+
* @param servers - Parsed server URLs (from parseServers)
|
|
30
|
+
* @returns Partial OpenAPI options (excluding wsdl/catalogFile/compiledCatalog/outFile)
|
|
31
|
+
*/
|
|
32
|
+
export function buildOpenApiOptionsFromArgv(argv, format, servers) {
|
|
33
|
+
return {
|
|
34
|
+
basePath: argv["openapi-base-path"],
|
|
35
|
+
closedSchemas: argv["openapi-closed-schemas"],
|
|
36
|
+
defaultMethod: argv["openapi-default-method"],
|
|
37
|
+
envelopeNamespace: argv["openapi-envelope-namespace"],
|
|
38
|
+
errorNamespace: argv["openapi-error-namespace"],
|
|
39
|
+
format,
|
|
40
|
+
opsFile: argv["openapi-ops-file"],
|
|
41
|
+
pathStyle: argv["openapi-path-style"],
|
|
42
|
+
pruneUnusedSchemas: argv["openapi-prune-unused-schemas"],
|
|
43
|
+
securityConfigFile: argv["openapi-security-file"],
|
|
44
|
+
servers,
|
|
45
|
+
skipValidate: false, // Always validate
|
|
46
|
+
tagStyle: argv["openapi-tag-style"],
|
|
47
|
+
tagsFile: argv["openapi-tags-file"],
|
|
48
|
+
title: argv["openapi-title"],
|
|
49
|
+
version: argv["openapi-version-tag"],
|
|
50
|
+
asYaml: format === "yaml",
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse comma-separated status codes from CLI argument
|
|
3
|
+
*
|
|
4
|
+
* @param value - Comma-separated string of status codes
|
|
5
|
+
* @param flagName - Name of the CLI flag (for error messages)
|
|
6
|
+
* @returns Array of validated integer status codes
|
|
7
|
+
* @throws Error if any value is not a valid integer
|
|
8
|
+
*/
|
|
9
|
+
export declare function parseStatusCodes(value: string, flagName: string): number[];
|
|
10
|
+
/**
|
|
11
|
+
* Parse comma-separated server URLs from CLI argument
|
|
12
|
+
*
|
|
13
|
+
* @param value - Comma-separated string of server URLs
|
|
14
|
+
* @returns Array of trimmed, non-empty server URLs
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseServers(value: string | undefined): string[];
|
|
17
|
+
/**
|
|
18
|
+
* Standardized Console Logging Functions
|
|
19
|
+
*
|
|
20
|
+
* These functions provide consistent console output formatting across the codebase.
|
|
21
|
+
* All messages follow a standard pattern:
|
|
22
|
+
* - Errors: [ERROR] {message} (output to stderr)
|
|
23
|
+
* - Warnings: [WARNING] {message} (output to stderr)
|
|
24
|
+
* - Success: [SUCCESS] {message} (output to stdout)
|
|
25
|
+
* - Info: {message} (output to stdout, no prefix for general logs)
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Log an error message to stderr
|
|
29
|
+
*
|
|
30
|
+
* @param message - Error message to display
|
|
31
|
+
*/
|
|
32
|
+
export declare function error(message: string): void;
|
|
33
|
+
/**
|
|
34
|
+
* Log a warning message to stderr
|
|
35
|
+
*
|
|
36
|
+
* @param message - Warning message to display
|
|
37
|
+
*/
|
|
38
|
+
export declare function warn(message: string): void;
|
|
39
|
+
/**
|
|
40
|
+
* Log a success message to stdout
|
|
41
|
+
*
|
|
42
|
+
* @param message - Success message to display
|
|
43
|
+
*/
|
|
44
|
+
export declare function success(message: string): void;
|
|
45
|
+
/**
|
|
46
|
+
* Log an informational message to stdout
|
|
47
|
+
*
|
|
48
|
+
* @param message - Info message to display (no prefix added)
|
|
49
|
+
*/
|
|
50
|
+
export declare function info(message: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Handle CLI errors consistently
|
|
53
|
+
*
|
|
54
|
+
* Prints error message to stderr and exits with appropriate code.
|
|
55
|
+
* This centralizes error handling for better consistency and testability.
|
|
56
|
+
*
|
|
57
|
+
* @param errorObj - Error object or string
|
|
58
|
+
* @param exitCode - Process exit code (default: 1)
|
|
59
|
+
*/
|
|
60
|
+
export declare function handleCLIError(errorObj: unknown, exitCode?: number): never;
|
|
61
|
+
/**
|
|
62
|
+
* Handle CLI errors consistently
|
|
63
|
+
*
|
|
64
|
+
*
|
|
65
|
+
* @param result - Result from generateOpenAPI containing jsonPath and yamlPath
|
|
66
|
+
*/
|
|
67
|
+
export declare function reportOpenApiSuccess(result: {
|
|
68
|
+
jsonPath?: string;
|
|
69
|
+
yamlPath?: string;
|
|
70
|
+
}): void;
|
|
71
|
+
/**
|
|
72
|
+
* Report compilation statistics for user visibility
|
|
73
|
+
*
|
|
74
|
+
* @param wsdlCatalog - Loaded WSDL catalog with schemas
|
|
75
|
+
* @param compiled - Compiled catalog with types and operations
|
|
76
|
+
*/
|
|
77
|
+
export declare function reportCompilationStats(wsdlCatalog: {
|
|
78
|
+
schemas: any[];
|
|
79
|
+
}, compiled: {
|
|
80
|
+
types: any[];
|
|
81
|
+
operations: any[];
|
|
82
|
+
}): void;
|
|
83
|
+
/**
|
|
84
|
+
* Emit TypeScript client artifacts (client.ts, types.ts, utils.ts)
|
|
85
|
+
*
|
|
86
|
+
* Note: catalog.json is NOT emitted by this function - it should be handled
|
|
87
|
+
* separately by the caller using generateCatalog() with explicit --catalog-file path.
|
|
88
|
+
*
|
|
89
|
+
* @param outDir - Output directory for client artifacts
|
|
90
|
+
* @param compiled - Compiled catalog
|
|
91
|
+
* @param generateClient - Client generator function
|
|
92
|
+
* @param generateTypes - Types generator function
|
|
93
|
+
* @param generateUtils - Utils generator function
|
|
94
|
+
*/
|
|
95
|
+
export declare function emitClientArtifacts(outDir: string, compiled: any, generateClient: (path: string, compiled: any) => void, generateTypes: (path: string, compiled: any) => void, generateUtils: (path: string, compiled: any) => void): void;
|
|
96
|
+
/**
|
|
97
|
+
* Validate gateway generation requirements
|
|
98
|
+
*
|
|
99
|
+
* @param gatewayDir - Gateway output directory (if provided)
|
|
100
|
+
* @param openapiFile - OpenAPI output path (if provided)
|
|
101
|
+
* @param gatewayServiceName - Gateway service name (if provided)
|
|
102
|
+
* @param gatewayVersionPrefix - Gateway version prefix (if provided)
|
|
103
|
+
* @throws Error if requirements are not met
|
|
104
|
+
*/
|
|
105
|
+
export declare function validateGatewayRequirements(gatewayDir: string | undefined, openapiFile: string | undefined, gatewayServiceName: string | undefined, gatewayVersionPrefix: string | undefined): void;
|
|
106
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/util/cli.ts"],"names":[],"mappings":"AAWA;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAc1E;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,EAAE,CAMhE;AAED;;;;;;;;;GASG;AAEH;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE3C;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,GAAE,MAAU,GAAG,KAAK,CAI7E;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,IAAI,CASP;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE;IAAE,OAAO,EAAE,GAAG,EAAE,CAAA;CAAE,EAC/B,QAAQ,EAAE;IAAE,KAAK,EAAE,GAAG,EAAE,CAAC;IAAC,UAAU,EAAE,GAAG,EAAE,CAAA;CAAE,GAC5C,IAAI,CAIN;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,GAAG,EACb,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,IAAI,EACrD,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,IAAI,EACpD,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,IAAI,GACnD,IAAI,CASN;AAED;;;;;;;;GAQG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,kBAAkB,EAAE,MAAM,GAAG,SAAS,EACtC,oBAAoB,EAAE,MAAM,GAAG,SAAS,GACvC,IAAI,CAUN"}
|
package/dist/util/cli.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared CLI Utilities
|
|
3
|
+
*
|
|
4
|
+
* This module provides common utilities for CLI argument parsing, validation, and path resolution.
|
|
5
|
+
* It centralizes patterns that were previously duplicated across subcommands, improving
|
|
6
|
+
* maintainability and consistency.
|
|
7
|
+
*/
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
import fs from "node:fs";
|
|
10
|
+
/**
|
|
11
|
+
* Parse comma-separated status codes from CLI argument
|
|
12
|
+
*
|
|
13
|
+
* @param value - Comma-separated string of status codes
|
|
14
|
+
* @param flagName - Name of the CLI flag (for error messages)
|
|
15
|
+
* @returns Array of validated integer status codes
|
|
16
|
+
* @throws Error if any value is not a valid integer
|
|
17
|
+
*/
|
|
18
|
+
export function parseStatusCodes(value, flagName) {
|
|
19
|
+
return value
|
|
20
|
+
.split(",")
|
|
21
|
+
.map((v) => v.trim())
|
|
22
|
+
.filter(Boolean)
|
|
23
|
+
.map((v) => {
|
|
24
|
+
const n = Number(v);
|
|
25
|
+
if (!Number.isInteger(n)) {
|
|
26
|
+
throw new Error(`Invalid status code in ${flagName}: '${v}' (must be an integer)`);
|
|
27
|
+
}
|
|
28
|
+
return n;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Parse comma-separated server URLs from CLI argument
|
|
33
|
+
*
|
|
34
|
+
* @param value - Comma-separated string of server URLs
|
|
35
|
+
* @returns Array of trimmed, non-empty server URLs
|
|
36
|
+
*/
|
|
37
|
+
export function parseServers(value) {
|
|
38
|
+
if (!value)
|
|
39
|
+
return [];
|
|
40
|
+
return value
|
|
41
|
+
.split(",")
|
|
42
|
+
.map((s) => s.trim())
|
|
43
|
+
.filter(Boolean);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Standardized Console Logging Functions
|
|
47
|
+
*
|
|
48
|
+
* These functions provide consistent console output formatting across the codebase.
|
|
49
|
+
* All messages follow a standard pattern:
|
|
50
|
+
* - Errors: [ERROR] {message} (output to stderr)
|
|
51
|
+
* - Warnings: [WARNING] {message} (output to stderr)
|
|
52
|
+
* - Success: [SUCCESS] {message} (output to stdout)
|
|
53
|
+
* - Info: {message} (output to stdout, no prefix for general logs)
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* Log an error message to stderr
|
|
57
|
+
*
|
|
58
|
+
* @param message - Error message to display
|
|
59
|
+
*/
|
|
60
|
+
export function error(message) {
|
|
61
|
+
console.error(`[ERROR] ${message}`);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Log a warning message to stderr
|
|
65
|
+
*
|
|
66
|
+
* @param message - Warning message to display
|
|
67
|
+
*/
|
|
68
|
+
export function warn(message) {
|
|
69
|
+
console.warn(`[WARNING] ${message}`);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Log a success message to stdout
|
|
73
|
+
*
|
|
74
|
+
* @param message - Success message to display
|
|
75
|
+
*/
|
|
76
|
+
export function success(message) {
|
|
77
|
+
console.log(`[SUCCESS] ${message}`);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Log an informational message to stdout
|
|
81
|
+
*
|
|
82
|
+
* @param message - Info message to display (no prefix added)
|
|
83
|
+
*/
|
|
84
|
+
export function info(message) {
|
|
85
|
+
console.log(message);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Handle CLI errors consistently
|
|
89
|
+
*
|
|
90
|
+
* Prints error message to stderr and exits with appropriate code.
|
|
91
|
+
* This centralizes error handling for better consistency and testability.
|
|
92
|
+
*
|
|
93
|
+
* @param errorObj - Error object or string
|
|
94
|
+
* @param exitCode - Process exit code (default: 1)
|
|
95
|
+
*/
|
|
96
|
+
export function handleCLIError(errorObj, exitCode = 1) {
|
|
97
|
+
const message = errorObj instanceof Error ? errorObj.message : String(errorObj);
|
|
98
|
+
error(message);
|
|
99
|
+
process.exit(exitCode);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Handle CLI errors consistently
|
|
103
|
+
*
|
|
104
|
+
*
|
|
105
|
+
* @param result - Result from generateOpenAPI containing jsonPath and yamlPath
|
|
106
|
+
*/
|
|
107
|
+
export function reportOpenApiSuccess(result) {
|
|
108
|
+
const generatedFiles = [result.jsonPath, result.yamlPath].filter(Boolean);
|
|
109
|
+
if (generatedFiles.length > 0) {
|
|
110
|
+
const outputPath = generatedFiles.length === 1
|
|
111
|
+
? path.resolve(generatedFiles[0])
|
|
112
|
+
: path.resolve(path.dirname(generatedFiles[0]));
|
|
113
|
+
success(`Generated OpenAPI specification in ${outputPath}`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Report compilation statistics for user visibility
|
|
118
|
+
*
|
|
119
|
+
* @param wsdlCatalog - Loaded WSDL catalog with schemas
|
|
120
|
+
* @param compiled - Compiled catalog with types and operations
|
|
121
|
+
*/
|
|
122
|
+
export function reportCompilationStats(wsdlCatalog, compiled) {
|
|
123
|
+
info(`Schemas discovered: ${wsdlCatalog.schemas.length}`);
|
|
124
|
+
info(`Compiled types: ${compiled.types.length}`);
|
|
125
|
+
info(`Operations: ${compiled.operations.length}`);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Emit TypeScript client artifacts (client.ts, types.ts, utils.ts)
|
|
129
|
+
*
|
|
130
|
+
* Note: catalog.json is NOT emitted by this function - it should be handled
|
|
131
|
+
* separately by the caller using generateCatalog() with explicit --catalog-file path.
|
|
132
|
+
*
|
|
133
|
+
* @param outDir - Output directory for client artifacts
|
|
134
|
+
* @param compiled - Compiled catalog
|
|
135
|
+
* @param generateClient - Client generator function
|
|
136
|
+
* @param generateTypes - Types generator function
|
|
137
|
+
* @param generateUtils - Utils generator function
|
|
138
|
+
*/
|
|
139
|
+
export function emitClientArtifacts(outDir, compiled, generateClient, generateTypes, generateUtils) {
|
|
140
|
+
fs.mkdirSync(outDir, { recursive: true });
|
|
141
|
+
generateClient(path.join(outDir, "client.ts"), compiled);
|
|
142
|
+
generateTypes(path.join(outDir, "types.ts"), compiled);
|
|
143
|
+
generateUtils(path.join(outDir, "utils.ts"), compiled);
|
|
144
|
+
success(`Generated TypeScript client in ${outDir}`);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Validate gateway generation requirements
|
|
148
|
+
*
|
|
149
|
+
* @param gatewayDir - Gateway output directory (if provided)
|
|
150
|
+
* @param openapiFile - OpenAPI output path (if provided)
|
|
151
|
+
* @param gatewayServiceName - Gateway service name (if provided)
|
|
152
|
+
* @param gatewayVersionPrefix - Gateway version prefix (if provided)
|
|
153
|
+
* @throws Error if requirements are not met
|
|
154
|
+
*/
|
|
155
|
+
export function validateGatewayRequirements(gatewayDir, openapiFile, gatewayServiceName, gatewayVersionPrefix) {
|
|
156
|
+
if (!gatewayDir)
|
|
157
|
+
return; // Gateway not requested, no validation needed
|
|
158
|
+
if (!openapiFile) {
|
|
159
|
+
handleCLIError("Gateway generation requires OpenAPI generation. Provide --openapi-file.");
|
|
160
|
+
}
|
|
161
|
+
if (!gatewayServiceName || !gatewayVersionPrefix) {
|
|
162
|
+
handleCLIError("When --gateway-dir is specified, both --gateway-service-name and --gateway-version-prefix must be provided.");
|
|
163
|
+
}
|
|
164
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@techspokes/typescript-wsdl-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.14",
|
|
4
4
|
"description": "TypeScript WSDL → SOAP client generator with full xs:attribute support, complex types, sequences, inheritance, and namespace-collision merging.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"wsdl",
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
"xml",
|
|
12
12
|
"xsd"
|
|
13
13
|
],
|
|
14
|
-
"homepage": "https://github.com/
|
|
14
|
+
"homepage": "https://github.com/TechSpokes/typescript-wsdl-client#readme",
|
|
15
15
|
"bugs": {
|
|
16
|
-
"url": "https://github.com/
|
|
16
|
+
"url": "https://github.com/TechSpokes/typescript-wsdl-client/issues"
|
|
17
17
|
},
|
|
18
18
|
"repository": {
|
|
19
19
|
"type": "git",
|
|
20
|
-
"url": "git+https://github.com/
|
|
20
|
+
"url": "git+https://github.com/TechSpokes/typescript-wsdl-client.git"
|
|
21
21
|
},
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"author": "TechSpokes <contact@techspokes.com> (https://www.techspokes.com)",
|
|
@@ -53,15 +53,18 @@
|
|
|
53
53
|
"typecheck": "tsc --noEmit",
|
|
54
54
|
"prepublishOnly": "npm run clean && npm run build",
|
|
55
55
|
"test": "exit 0",
|
|
56
|
-
"smoke": "tsx src/cli.ts --
|
|
57
|
-
"smoke:
|
|
58
|
-
"smoke:
|
|
59
|
-
"
|
|
56
|
+
"smoke:compile": "rimraf tmp && tsx src/cli.ts compile --wsdl-source examples/minimal/weather.wsdl --catalog-file tmp/catalog.json",
|
|
57
|
+
"smoke:client": "rimraf tmp && tsx src/cli.ts client --wsdl-source examples/minimal/weather.wsdl --client-dir tmp/client && tsc -p tsconfig.smoke.json",
|
|
58
|
+
"smoke:openapi": "rimraf tmp && tsx src/cli.ts openapi --wsdl-source examples/minimal/weather.wsdl --openapi-file tmp/openapi.json --openapi-format json && tsc -p tsconfig.smoke.json",
|
|
59
|
+
"smoke:gateway": "rimraf tmp && tsx src/cli.ts client --wsdl-source examples/minimal/weather.wsdl --client-dir tmp/client && tsx src/cli.ts openapi --catalog-file tmp/client/catalog.json --openapi-file tmp/openapi.json --openapi-format json && tsx src/cli.ts gateway --openapi-file tmp/openapi.json --client-dir tmp/client --gateway-dir tmp/gateway --gateway-service-name weather --gateway-version-prefix v1 && tsc -p tsconfig.smoke.json",
|
|
60
|
+
"smoke:pipeline": "rimraf tmp && tsx src/cli.ts pipeline --wsdl-source examples/minimal/weather.wsdl --client-dir tmp/client --openapi-file tmp/openapi.json --gateway-dir tmp/gateway --gateway-service-name weather --gateway-version-prefix v1 --openapi-format json --openapi-servers https://example.com/api && tsc -p tsconfig.smoke.json",
|
|
61
|
+
"ci": "npm run build && npm run typecheck && npm run smoke:pipeline"
|
|
60
62
|
},
|
|
61
63
|
"devDependencies": {
|
|
62
64
|
"@types/js-yaml": "^4.0.9",
|
|
63
65
|
"@types/node": "^24.3.0",
|
|
64
66
|
"@types/yargs": "^17.0.33",
|
|
67
|
+
"fastify": "^5.2.0",
|
|
65
68
|
"rimraf": "^6.0.0",
|
|
66
69
|
"tsx": "^4.20.0",
|
|
67
70
|
"typescript": "^5.6.3"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"catalogEmitter.d.ts","sourceRoot":"","sources":["../../src/emit/catalogEmitter.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,+BAA+B,CAAC;AAEnE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,QAOrE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clientEmitter.d.ts","sourceRoot":"","sources":["../../src/emit/clientEmitter.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,+BAA+B,CAAC;AAGnE;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,QAuWpE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"typesEmitter.d.ts","sourceRoot":"","sources":["../../src/emit/typesEmitter.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAC,eAAe,EAAe,MAAM,+BAA+B,CAAC;AAEjF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,QAgJnE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utilsEmitter.d.ts","sourceRoot":"","sources":["../../src/emit/utilsEmitter.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,+BAA+B,CAAC;AAGnE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,QAiCnE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildPaths.d.ts","sourceRoot":"","sources":["../../src/openapi/buildPaths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAG3C;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,gBAAgB;IAC/B,CAAC,MAAM,EAAE,MAAM,GAAG;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAE9B,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,SAAS,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC,CAAC;IAC9C,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAC9C;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,iBAAiB,uBAyD5E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildSchemas.d.ts","sourceRoot":"","sources":["../../src/openapi/buildSchemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAgB,eAAe,EAAe,MAAM,+BAA+B,CAAC;AAEhG;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAmIpD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,eAAe,EAAE,IAAI,EAAE,mBAAmB,GAAG,iBAAiB,CA8CpG"}
|