@techspokes/typescript-wsdl-client 0.4.1 → 0.5.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.
@@ -1 +1 @@
1
- {"version":3,"file":"clientEmitter.d.ts","sourceRoot":"","sources":["../../src/emit/clientEmitter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,+BAA+B,CAAC;AAGnE,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,QA4VpE"}
1
+ {"version":3,"file":"clientEmitter.d.ts","sourceRoot":"","sources":["../../src/emit/clientEmitter.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,+BAA+B,CAAC;AAGnE,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,QAuWpE"}
@@ -23,6 +23,10 @@ export function emitClient(outFile, compiled) {
23
23
  : `[${JSON.stringify(op.name)}]`;
24
24
  const inTypeName = op.inputElement ? pascal(op.inputElement.local) : undefined;
25
25
  const outTypeName = op.outputElement ? pascal(op.outputElement.local) : undefined;
26
+ if (!inTypeName && !outTypeName) {
27
+ console.warn(`Operation ${op.name} has no input or output type defined. Skipping method generation.`);
28
+ continue;
29
+ }
26
30
  const inTs = inTypeName ? `T.${inTypeName}` : `any`;
27
31
  const outTs = outTypeName ? `T.${outTypeName}` : `any`;
28
32
  const secHints = Array.isArray(op.security) && op.security.length ? op.security : [];
@@ -41,7 +45,8 @@ export function emitClient(outFile, compiled) {
41
45
  return this.call<${inTs}, ${outTs}, HeadersType>(
42
46
  args,
43
47
  ${JSON.stringify(m)},
44
- ${JSON.stringify(m)}
48
+ ${inTypeName ? JSON.stringify(inTypeName) : "undefined"},
49
+ ${outTypeName ? JSON.stringify(outTypeName) : "undefined"}
45
50
  );
46
51
  }`;
47
52
  methods.push(methodTemplate);
@@ -130,10 +135,14 @@ export class ${clientName} {
130
135
  attributesKeyOut?: string
131
136
  }) {
132
137
  this.source = options.source;
133
- this.options = options.options ?? undefined;
134
- this.security = options.security ?? undefined;
135
138
  this.attributesKeyIn = options.attributesKeyIn ?? "$attributes";
136
139
  this.attributesKeyOut = options.attributesKeyOut ?? "attributes";
140
+ if (options.options) {
141
+ this.options = options.options;
142
+ }
143
+ if (options.security) {
144
+ this.security = options.security;
145
+ }
137
146
  }
138
147
 
139
148
  /**
@@ -147,7 +156,7 @@ export class ${clientName} {
147
156
  // If client is not initialized or has no WSDL source, create a new one
148
157
  if (!this.client || !this.client.wsdl) {
149
158
  // Note: source can be a URL or a local WSDL file path
150
- if (!this.source || (typeof this.source !== "string")) {
159
+ if (!this.source) {
151
160
  throw new Error("WSDL source must be a non-empty string URL or file path.");
152
161
  }
153
162
  try {
@@ -169,6 +178,7 @@ ${methodsBody}
169
178
  *
170
179
  * @param args - The request arguments/payload for the operation.
171
180
  * @param operation - The name of the SOAP operation to invoke.
181
+ * @param requestType - The metadata type name for request serialization.
172
182
  * @param responseType - The metadata type name for response deserialization.
173
183
  * @returns A promise resolving to the operation response containing data, headers, and raw XML.
174
184
  * @throws Error if the specified operation is not found on the SOAP client.
@@ -176,6 +186,7 @@ ${methodsBody}
176
186
  protected async call<RequestType, ResponseType, HeadersType>(
177
187
  args: RequestType,
178
188
  operation: string,
189
+ requestType: string,
179
190
  responseType: string
180
191
  ): Promise<${clientName}Response<ResponseType, HeadersType>> {
181
192
  const client = await this.soapClient();
@@ -183,7 +194,7 @@ ${methodsBody}
183
194
  throw new Error("Operation not found on SOAP client: " + operation);
184
195
  }
185
196
  // Convert TypeScript object to the format expected by node-soap
186
- const soapArgs = this.toSoapArgs(args, responseType);
197
+ const soapArgs = this.toSoapArgs(args, requestType);
187
198
  return new Promise((resolve, reject) => {
188
199
  client[operation](soapArgs, (err: any, result: any, rawResponse: string, soapHeader: any, rawRequest: string) => {
189
200
  if (err) {
@@ -20,7 +20,7 @@ export interface ${clientName}DataTypes {
20
20
  Attributes: Record<string, readonly string[]>;
21
21
  /** Maps type names to their child element types for recursive processing */
22
22
  ChildrenTypes: Record<string, Readonly<Record<string, string>>>;
23
- };
23
+ }
24
24
 
25
25
  export const ${clientConstant}_DATA_TYPES: ${clientName}DataTypes = ${metas} as const;\n`;
26
26
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@techspokes/typescript-wsdl-client",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
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",