@karibulab/wsdl2tsx 0.27.0 → 0.28.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/dist/cli.js +34 -14
- package/dist/templates/component.hbs +6 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -24048,14 +24048,17 @@ function prepareTags(key, elementObject, namespacesTypeMapping, baseNamespacePre
|
|
|
24048
24048
|
const tagLocalName = extractLocalName(key);
|
|
24049
24049
|
const tagCamelCase = toCamelCase2(tagLocalName);
|
|
24050
24050
|
const isQualified = shouldHavePrefix(elementObject);
|
|
24051
|
-
const openTag = isQualified ? `<${namespacePrefix}.${tagLocalName}>` :
|
|
24052
|
-
const closeTag = isQualified ? `</${namespacePrefix}.${tagLocalName}>` :
|
|
24051
|
+
const openTag = isQualified ? `<${namespacePrefix}.${tagLocalName}>` : `<${tagLocalName}>`;
|
|
24052
|
+
const closeTag = isQualified ? `</${namespacePrefix}.${tagLocalName}>` : `</${tagLocalName}>`;
|
|
24053
24053
|
if (tagUsageCollector && isQualified) {
|
|
24054
24054
|
tagUsageCollector.tagToPrefix.set(tagLocalName, namespacePrefix);
|
|
24055
24055
|
if (prefixesMapping && prefixesMapping[namespacePrefix]) {
|
|
24056
24056
|
tagUsageCollector.prefixToNamespace.set(namespacePrefix, prefixesMapping[namespacePrefix]);
|
|
24057
24057
|
}
|
|
24058
24058
|
}
|
|
24059
|
+
if (tagUsageCollector && !isQualified) {
|
|
24060
|
+
tagUsageCollector.unqualifiedTags.add(tagLocalName);
|
|
24061
|
+
}
|
|
24059
24062
|
return {
|
|
24060
24063
|
namespacePrefix,
|
|
24061
24064
|
tagLocalName,
|
|
@@ -24181,8 +24184,11 @@ function generateReferenceWrapper(referencedType, elementObject, key, tagLocalNa
|
|
|
24181
24184
|
}
|
|
24182
24185
|
}
|
|
24183
24186
|
const wrapperIsQualified = referencedElement.$qualified !== false;
|
|
24184
|
-
const wrapperOpenTag = wrapperIsQualified ? `<${wrapperNamespacePrefix}.${tagLocalName}>` :
|
|
24185
|
-
const wrapperCloseTag = wrapperIsQualified ? `</${wrapperNamespacePrefix}.${tagLocalName}>` :
|
|
24187
|
+
const wrapperOpenTag = wrapperIsQualified ? `<${wrapperNamespacePrefix}.${tagLocalName}>` : `<${tagLocalName}>`;
|
|
24188
|
+
const wrapperCloseTag = wrapperIsQualified ? `</${wrapperNamespacePrefix}.${tagLocalName}>` : `</${tagLocalName}>`;
|
|
24189
|
+
if (tagUsageCollector && !wrapperIsQualified) {
|
|
24190
|
+
tagUsageCollector.unqualifiedTags.add(tagLocalName);
|
|
24191
|
+
}
|
|
24186
24192
|
if (tagUsageCollector && wrapperIsQualified) {
|
|
24187
24193
|
tagUsageCollector.tagToPrefix.set(tagLocalName, wrapperNamespacePrefix);
|
|
24188
24194
|
if (prefixesMapping && prefixesMapping[wrapperNamespacePrefix]) {
|
|
@@ -24275,7 +24281,7 @@ function generateReferenceWrapper(referencedType, elementObject, key, tagLocalNa
|
|
|
24275
24281
|
}
|
|
24276
24282
|
|
|
24277
24283
|
// src/codegen/xml-generator/xml-property/array-property.ts
|
|
24278
|
-
function generateArrayPropertyCode(elementObject, keys, openTag, closeTag, propertyPath, currentPropertyPath, namespacesTypeMapping, baseNamespacePrefix, key, isQualified, prefixesMapping, schemaObject, allComplexTypes) {
|
|
24284
|
+
function generateArrayPropertyCode(elementObject, keys, openTag, closeTag, propertyPath, currentPropertyPath, namespacesTypeMapping, baseNamespacePrefix, key, isQualified, prefixesMapping, schemaObject, allComplexTypes, tagUsageCollector) {
|
|
24279
24285
|
const nestedProperties = keys.map((elementKey) => {
|
|
24280
24286
|
const nestedElement = elementObject.type[elementKey];
|
|
24281
24287
|
if (typeof nestedElement === "object" && nestedElement !== null) {
|
|
@@ -24292,7 +24298,8 @@ function generateArrayPropertyCode(elementObject, keys, openTag, closeTag, prope
|
|
|
24292
24298
|
isQualified,
|
|
24293
24299
|
prefixesMapping,
|
|
24294
24300
|
schemaObject,
|
|
24295
|
-
allComplexTypes
|
|
24301
|
+
allComplexTypes,
|
|
24302
|
+
tagUsageCollector
|
|
24296
24303
|
);
|
|
24297
24304
|
} else {
|
|
24298
24305
|
const nestedTagLocalName = extractLocalName(elementKey);
|
|
@@ -24309,7 +24316,10 @@ function generateArrayPropertyCode(elementObject, keys, openTag, closeTag, prope
|
|
|
24309
24316
|
);
|
|
24310
24317
|
return `<${nestedNamespacePrefix}.${nestedTagLocalName}>{item.${nestedTagCamelCase}}</${nestedNamespacePrefix}.${nestedTagLocalName}>`;
|
|
24311
24318
|
} else {
|
|
24312
|
-
|
|
24319
|
+
if (tagUsageCollector) {
|
|
24320
|
+
tagUsageCollector.unqualifiedTags.add(nestedTagLocalName);
|
|
24321
|
+
}
|
|
24322
|
+
return `<${nestedTagLocalName}>{item.${nestedTagCamelCase}}</${nestedTagLocalName}>`;
|
|
24313
24323
|
}
|
|
24314
24324
|
}
|
|
24315
24325
|
}
|
|
@@ -24366,7 +24376,8 @@ function routeByType(elementObject, keys, isArray2, openTag, closeTag, propertyP
|
|
|
24366
24376
|
isQualified,
|
|
24367
24377
|
prefixesMapping,
|
|
24368
24378
|
schemaObject,
|
|
24369
|
-
allComplexTypes
|
|
24379
|
+
allComplexTypes,
|
|
24380
|
+
tagUsageCollector
|
|
24370
24381
|
);
|
|
24371
24382
|
} else {
|
|
24372
24383
|
return generateComplexPropertyCode(
|
|
@@ -24620,8 +24631,11 @@ function processStringElement(element, key, propsInterfaceName, namespacesTypeMa
|
|
|
24620
24631
|
prefixesMapping
|
|
24621
24632
|
);
|
|
24622
24633
|
const isQualified = shouldHavePrefix(referencedElement);
|
|
24623
|
-
const wrapperOpenTag = isQualified ? `<${namespacePrefix2}.${keyLocalName3}>` :
|
|
24624
|
-
const wrapperCloseTag = isQualified ? `</${namespacePrefix2}.${keyLocalName3}>` :
|
|
24634
|
+
const wrapperOpenTag = isQualified ? `<${namespacePrefix2}.${keyLocalName3}>` : `<${keyLocalName3}>`;
|
|
24635
|
+
const wrapperCloseTag = isQualified ? `</${namespacePrefix2}.${keyLocalName3}>` : `</${keyLocalName3}>`;
|
|
24636
|
+
if (tagUsageCollector && !isQualified) {
|
|
24637
|
+
tagUsageCollector.unqualifiedTags.add(keyLocalName3);
|
|
24638
|
+
}
|
|
24625
24639
|
return `${wrapperOpenTag}
|
|
24626
24640
|
${nestedProperties}
|
|
24627
24641
|
${wrapperCloseTag}`;
|
|
@@ -24880,7 +24894,8 @@ function extractAllNamespaceMappings(baseTypeName, baseTypeObject, schemaObject,
|
|
|
24880
24894
|
}
|
|
24881
24895
|
const tagUsageCollector = {
|
|
24882
24896
|
tagToPrefix: /* @__PURE__ */ new Map(),
|
|
24883
|
-
prefixToNamespace: /* @__PURE__ */ new Map()
|
|
24897
|
+
prefixToNamespace: /* @__PURE__ */ new Map(),
|
|
24898
|
+
unqualifiedTags: /* @__PURE__ */ new Set()
|
|
24884
24899
|
};
|
|
24885
24900
|
generateXmlBodyCode(
|
|
24886
24901
|
baseNamespacePrefix,
|
|
@@ -24934,10 +24949,12 @@ function extractAllNamespaceMappings(baseTypeName, baseTypeObject, schemaObject,
|
|
|
24934
24949
|
}
|
|
24935
24950
|
}
|
|
24936
24951
|
Object.assign(tagsMapping, newTagsMapping);
|
|
24952
|
+
const unqualifiedTags = Array.from(tagUsageCollector.unqualifiedTags).sort();
|
|
24937
24953
|
return {
|
|
24938
24954
|
tagsMapping,
|
|
24939
24955
|
prefixesMapping,
|
|
24940
|
-
typesMapping
|
|
24956
|
+
typesMapping,
|
|
24957
|
+
unqualifiedTags
|
|
24941
24958
|
};
|
|
24942
24959
|
}
|
|
24943
24960
|
|
|
@@ -26211,7 +26228,7 @@ function prepareTypesForInterfaces(requestTypeObject, headersInfo, allTypesForIn
|
|
|
26211
26228
|
}
|
|
26212
26229
|
|
|
26213
26230
|
// src/codegen/data-preparer/template-data.ts
|
|
26214
|
-
function prepareTemplateData(requestType, requestTypeObject, namespacesTagsMapping, namespacesPrefixMapping, namespacesTypeMapping, soapNamespaceURI, baseNamespacePrefix, allTypesForInterfaces, schemaObject, allComplexTypes, headersInfo, responseType, responseTypeObject, responseAllTypesForInterfaces) {
|
|
26231
|
+
function prepareTemplateData(requestType, requestTypeObject, namespacesTagsMapping, namespacesPrefixMapping, namespacesTypeMapping, soapNamespaceURI, baseNamespacePrefix, allTypesForInterfaces, schemaObject, allComplexTypes, headersInfo, responseType, responseTypeObject, responseAllTypesForInterfaces, unqualifiedTags) {
|
|
26215
26232
|
const simpleTypes = prepareSimpleTypesData(requestTypeObject, XML_SCHEMA_URI);
|
|
26216
26233
|
const propsInterface = preparePropsInterfaceData(requestType, requestTypeObject, allTypesForInterfaces, schemaObject, allComplexTypes);
|
|
26217
26234
|
const typesForInterfaces = requestTypeObject;
|
|
@@ -26305,6 +26322,7 @@ function prepareTemplateData(requestType, requestTypeObject, namespacesTagsMappi
|
|
|
26305
26322
|
return {
|
|
26306
26323
|
requestType: requestTypeLocalName,
|
|
26307
26324
|
namespaces: filteredNamespaces,
|
|
26325
|
+
unqualifiedTags: unqualifiedTags && unqualifiedTags.length > 0 ? unqualifiedTags : void 0,
|
|
26308
26326
|
simpleTypes,
|
|
26309
26327
|
propsInterface,
|
|
26310
26328
|
interfaces,
|
|
@@ -26534,6 +26552,7 @@ function processOperation(operationNode, definitionsNode, schemaObject, allCompl
|
|
|
26534
26552
|
const namespacesTagsMapping = namespaceMappings.tagsMapping;
|
|
26535
26553
|
const namespacesPrefixMapping = namespaceMappings.prefixesMapping;
|
|
26536
26554
|
const namespacesTypeMapping = namespaceMappings.typesMapping;
|
|
26555
|
+
const unqualifiedTags = namespaceMappings.unqualifiedTags;
|
|
26537
26556
|
const baseNamespacePrefix = namespacesTypeMapping[requestType].prefix;
|
|
26538
26557
|
let responseType;
|
|
26539
26558
|
let responseTypeObject;
|
|
@@ -26608,8 +26627,9 @@ function processOperation(operationNode, definitionsNode, schemaObject, allCompl
|
|
|
26608
26627
|
// Pasar tipo de respuesta si existe
|
|
26609
26628
|
responseTypeObject,
|
|
26610
26629
|
// Pasar objeto de tipo de respuesta si existe
|
|
26611
|
-
responseAllTypesForInterfaces
|
|
26630
|
+
responseAllTypesForInterfaces,
|
|
26612
26631
|
// Pasar tipos referenciados del response
|
|
26632
|
+
unqualifiedTags
|
|
26613
26633
|
);
|
|
26614
26634
|
const generatedCode = compileTemplate(templateData);
|
|
26615
26635
|
const typeNameForFile = opName;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { soap, ns
|
|
1
|
+
import { soap, ns } from "@karibulab/wsdl2tsx-runtime";
|
|
2
2
|
|
|
3
3
|
{{#each namespaces}}
|
|
4
4
|
const {{@key}} = ns("{{@key}}", [{{tagNamesArray this}}] as const);
|
|
@@ -31,6 +31,11 @@ export interface {{pascalCase responseType}}Props {
|
|
|
31
31
|
{{/if}}
|
|
32
32
|
|
|
33
33
|
export function {{pascalCase requestType}}(props: {{pascalCase requestType}}Props) {
|
|
34
|
+
{{#if unqualifiedTags}}
|
|
35
|
+
{{#each unqualifiedTags}}
|
|
36
|
+
const {{this}} = () => "{{this}}";
|
|
37
|
+
{{/each}}
|
|
38
|
+
{{/if}}
|
|
34
39
|
return <soap.Envelope xmlns:soap="{{soapNamespaceURI}}"
|
|
35
40
|
{{xmlnsAttributes xmlnsAttributes}}>
|
|
36
41
|
<soap.Header>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@karibulab/wsdl2tsx",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "Generador de código TSX desde archivos WSDL",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": "./dist/cli.js",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"start": "node dist/cli.js"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@karibulab/wsdl2tsx-runtime": "0.
|
|
16
|
+
"@karibulab/wsdl2tsx-runtime": "0.28.0",
|
|
17
17
|
"axios": "^1.7.9",
|
|
18
18
|
"fast-xml-parser": "5.3.3",
|
|
19
19
|
"handlebars": "4.7.8"
|