@karibulab/wsdl2tsx 0.8.1 → 0.10.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 +206 -177
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -16721,7 +16721,7 @@ var require_lib = __commonJS({
|
|
|
16721
16721
|
}
|
|
16722
16722
|
});
|
|
16723
16723
|
|
|
16724
|
-
// src/wsdl.ts
|
|
16724
|
+
// src/wsdl/loader.ts
|
|
16725
16725
|
var import_fs = __toESM(require("fs"));
|
|
16726
16726
|
var import_path = __toESM(require("path"));
|
|
16727
16727
|
|
|
@@ -21788,7 +21788,7 @@ var XMLParser = class {
|
|
|
21788
21788
|
}
|
|
21789
21789
|
};
|
|
21790
21790
|
|
|
21791
|
-
// src/wsdl.ts
|
|
21791
|
+
// src/wsdl/loader.ts
|
|
21792
21792
|
var loadXml = async (xmlPath) => {
|
|
21793
21793
|
let xmlContentString;
|
|
21794
21794
|
if (xmlPath.match(/^http(s)?:\/\//)) {
|
|
@@ -21844,15 +21844,155 @@ var loadXsd = async (wsdlFile, xsdPath) => {
|
|
|
21844
21844
|
const wsdlDir = import_path.default.dirname(wsdlFile);
|
|
21845
21845
|
return await loadXml(import_path.default.resolve(wsdlDir, xsdPath));
|
|
21846
21846
|
};
|
|
21847
|
-
|
|
21848
|
-
|
|
21849
|
-
|
|
21850
|
-
|
|
21851
|
-
|
|
21847
|
+
|
|
21848
|
+
// src/wsdl/node-extractors.ts
|
|
21849
|
+
var getSequenceNode = (node) => {
|
|
21850
|
+
if (!node || typeof node !== "object") {
|
|
21851
|
+
return void 0;
|
|
21852
|
+
}
|
|
21853
|
+
const sequenceField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?sequence/));
|
|
21854
|
+
return sequenceField ? node[sequenceField] : void 0;
|
|
21855
|
+
};
|
|
21856
|
+
var getChoiceNode = (node) => {
|
|
21857
|
+
if (!node || typeof node !== "object") {
|
|
21858
|
+
return void 0;
|
|
21859
|
+
}
|
|
21860
|
+
const choiceField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?choice/));
|
|
21861
|
+
return choiceField ? node[choiceField] : void 0;
|
|
21862
|
+
};
|
|
21863
|
+
var getAllNode = (node) => {
|
|
21864
|
+
if (!node || typeof node !== "object") {
|
|
21865
|
+
return void 0;
|
|
21866
|
+
}
|
|
21867
|
+
const allField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?all/));
|
|
21868
|
+
return allField ? node[allField] : void 0;
|
|
21869
|
+
};
|
|
21870
|
+
var getGroupNode = (node) => {
|
|
21871
|
+
if (!node || typeof node !== "object") {
|
|
21872
|
+
return void 0;
|
|
21873
|
+
}
|
|
21874
|
+
const groupField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?group/));
|
|
21875
|
+
return groupField ? node[groupField] : void 0;
|
|
21876
|
+
};
|
|
21877
|
+
var getSimpleContentNode = (node) => {
|
|
21878
|
+
if (!node || typeof node !== "object") {
|
|
21879
|
+
return void 0;
|
|
21880
|
+
}
|
|
21881
|
+
const simpleContentField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?simpleContent/));
|
|
21882
|
+
return simpleContentField ? node[simpleContentField] : void 0;
|
|
21883
|
+
};
|
|
21884
|
+
var getComplexContentNode = (node) => {
|
|
21885
|
+
if (!node || typeof node !== "object") {
|
|
21886
|
+
return void 0;
|
|
21887
|
+
}
|
|
21888
|
+
const complexContentField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?complexContent/));
|
|
21889
|
+
return complexContentField ? node[complexContentField] : void 0;
|
|
21890
|
+
};
|
|
21891
|
+
var getExtensionNode = (node) => {
|
|
21892
|
+
if (!node || typeof node !== "object") {
|
|
21893
|
+
return void 0;
|
|
21894
|
+
}
|
|
21895
|
+
const extensionField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?extension/));
|
|
21896
|
+
return extensionField ? node[extensionField] : void 0;
|
|
21897
|
+
};
|
|
21898
|
+
var getRestrictionNode = (node) => {
|
|
21899
|
+
if (!node || typeof node !== "object") {
|
|
21900
|
+
return void 0;
|
|
21901
|
+
}
|
|
21902
|
+
const restrictionField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?restriction/));
|
|
21903
|
+
return restrictionField ? node[restrictionField] : void 0;
|
|
21904
|
+
};
|
|
21905
|
+
var getAttributeNode = (node) => {
|
|
21906
|
+
const attributeField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?attribute/));
|
|
21907
|
+
return node[attributeField];
|
|
21908
|
+
};
|
|
21909
|
+
var getSchemaNode = (node) => {
|
|
21910
|
+
const schemaField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?schema/));
|
|
21911
|
+
return node[schemaField];
|
|
21912
|
+
};
|
|
21913
|
+
var getAllSchemaNodes = (node) => {
|
|
21914
|
+
const schemas = [];
|
|
21915
|
+
for (const key of Object.keys(node)) {
|
|
21916
|
+
if (key.match(/([a-zA-z0-9]*:)?schema/)) {
|
|
21917
|
+
const schemaValue = node[key];
|
|
21918
|
+
if (Array.isArray(schemaValue)) {
|
|
21919
|
+
schemas.push(...schemaValue);
|
|
21920
|
+
} else if (schemaValue !== void 0) {
|
|
21921
|
+
schemas.push(schemaValue);
|
|
21922
|
+
}
|
|
21852
21923
|
}
|
|
21853
21924
|
}
|
|
21854
|
-
return
|
|
21925
|
+
return schemas;
|
|
21926
|
+
};
|
|
21927
|
+
var getElementNode = (node) => {
|
|
21928
|
+
if (Array.isArray(node)) {
|
|
21929
|
+
const elementNodes = [];
|
|
21930
|
+
for (const item of node) {
|
|
21931
|
+
const elementNode = getElementNode(item);
|
|
21932
|
+
if (elementNode !== void 0) {
|
|
21933
|
+
elementNodes.push(elementNode);
|
|
21934
|
+
}
|
|
21935
|
+
}
|
|
21936
|
+
return elementNodes;
|
|
21937
|
+
}
|
|
21938
|
+
const elementField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?element/));
|
|
21939
|
+
return node[elementField];
|
|
21855
21940
|
};
|
|
21941
|
+
var getComplexTypeNode = (node) => {
|
|
21942
|
+
const complexTypeField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?complexType/));
|
|
21943
|
+
return node[complexTypeField];
|
|
21944
|
+
};
|
|
21945
|
+
var getDefinitionsNode = (node) => {
|
|
21946
|
+
const definitionsField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?definitions/));
|
|
21947
|
+
return node[definitionsField];
|
|
21948
|
+
};
|
|
21949
|
+
var getTypesNode = (node) => {
|
|
21950
|
+
const typesField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?types/));
|
|
21951
|
+
return node[typesField];
|
|
21952
|
+
};
|
|
21953
|
+
var getImportNode = (node) => {
|
|
21954
|
+
const importField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?import/));
|
|
21955
|
+
return node[importField];
|
|
21956
|
+
};
|
|
21957
|
+
var getMessageNode = (node) => {
|
|
21958
|
+
const messageField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?message/));
|
|
21959
|
+
const messageValue = node[messageField];
|
|
21960
|
+
return Array.isArray(messageValue) ? messageValue : [messageValue];
|
|
21961
|
+
};
|
|
21962
|
+
var getPortTypeNode = (node) => {
|
|
21963
|
+
const portTypeField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?portType/));
|
|
21964
|
+
return node[portTypeField];
|
|
21965
|
+
};
|
|
21966
|
+
var getOperationNodes = (node) => {
|
|
21967
|
+
const operationField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?operation/));
|
|
21968
|
+
if (!operationField) return [];
|
|
21969
|
+
const operationValue = node[operationField];
|
|
21970
|
+
return Array.isArray(operationValue) ? operationValue : operationValue ? [operationValue] : [];
|
|
21971
|
+
};
|
|
21972
|
+
var getInputNode = (node) => {
|
|
21973
|
+
const inputField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?input/));
|
|
21974
|
+
return node[inputField];
|
|
21975
|
+
};
|
|
21976
|
+
var getPartNode = (node) => {
|
|
21977
|
+
const partField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?part/));
|
|
21978
|
+
return node[partField];
|
|
21979
|
+
};
|
|
21980
|
+
var getNamespacesFromNode = (node) => {
|
|
21981
|
+
const namespaces = /* @__PURE__ */ new Map();
|
|
21982
|
+
if (node.targetNamespace !== void 0) {
|
|
21983
|
+
namespaces.set("targetNamespace", node.targetNamespace);
|
|
21984
|
+
}
|
|
21985
|
+
for (const key of Object.keys(node)) {
|
|
21986
|
+
const match = key.match(/xmlns:([a-zA-z0-9]*)/);
|
|
21987
|
+
if (match !== null) {
|
|
21988
|
+
const value = node[key];
|
|
21989
|
+
namespaces.set(match[1], value);
|
|
21990
|
+
}
|
|
21991
|
+
}
|
|
21992
|
+
return namespaces;
|
|
21993
|
+
};
|
|
21994
|
+
|
|
21995
|
+
// src/wsdl/processors.ts
|
|
21856
21996
|
var processSingleElement = (node, namespaces, complexTypes, targetNamespace, isQualified = false) => {
|
|
21857
21997
|
if (node.type === void 0) {
|
|
21858
21998
|
return "xsd:anyType";
|
|
@@ -21892,6 +22032,15 @@ var processSingleElement = (node, namespaces, complexTypes, targetNamespace, isQ
|
|
|
21892
22032
|
return namespace + ":" + node.type;
|
|
21893
22033
|
}
|
|
21894
22034
|
};
|
|
22035
|
+
var fillObject = (object, namespaces, complexTypes) => {
|
|
22036
|
+
for (const item of Object.keys(object)) {
|
|
22037
|
+
const value = object[item];
|
|
22038
|
+
if (complexTypes !== void 0 && complexTypes[value.type] !== void 0) {
|
|
22039
|
+
object[item] = fillObject(complexTypes[value.type], namespaces, complexTypes);
|
|
22040
|
+
}
|
|
22041
|
+
}
|
|
22042
|
+
return object;
|
|
22043
|
+
};
|
|
21895
22044
|
var processElementsToObject = (elementNode, namespaces, complexTypes, targetNamespace, isQualified = false) => {
|
|
21896
22045
|
if (elementNode === void 0) {
|
|
21897
22046
|
const object = {};
|
|
@@ -22100,102 +22249,6 @@ var complexContentToObject = (node, namespaces, complexTypes, targetNamespace, i
|
|
|
22100
22249
|
}
|
|
22101
22250
|
return object;
|
|
22102
22251
|
};
|
|
22103
|
-
var getSequenceNode = (node) => {
|
|
22104
|
-
if (!node || typeof node !== "object") {
|
|
22105
|
-
return void 0;
|
|
22106
|
-
}
|
|
22107
|
-
const sequenceField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?sequence/));
|
|
22108
|
-
return sequenceField ? node[sequenceField] : void 0;
|
|
22109
|
-
};
|
|
22110
|
-
var getChoiceNode = (node) => {
|
|
22111
|
-
if (!node || typeof node !== "object") {
|
|
22112
|
-
return void 0;
|
|
22113
|
-
}
|
|
22114
|
-
const choiceField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?choice/));
|
|
22115
|
-
return choiceField ? node[choiceField] : void 0;
|
|
22116
|
-
};
|
|
22117
|
-
var getAllNode = (node) => {
|
|
22118
|
-
if (!node || typeof node !== "object") {
|
|
22119
|
-
return void 0;
|
|
22120
|
-
}
|
|
22121
|
-
const allField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?all/));
|
|
22122
|
-
return allField ? node[allField] : void 0;
|
|
22123
|
-
};
|
|
22124
|
-
var getGroupNode = (node) => {
|
|
22125
|
-
if (!node || typeof node !== "object") {
|
|
22126
|
-
return void 0;
|
|
22127
|
-
}
|
|
22128
|
-
const groupField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?group/));
|
|
22129
|
-
return groupField ? node[groupField] : void 0;
|
|
22130
|
-
};
|
|
22131
|
-
var getSimpleContentNode = (node) => {
|
|
22132
|
-
if (!node || typeof node !== "object") {
|
|
22133
|
-
return void 0;
|
|
22134
|
-
}
|
|
22135
|
-
const simpleContentField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?simpleContent/));
|
|
22136
|
-
return simpleContentField ? node[simpleContentField] : void 0;
|
|
22137
|
-
};
|
|
22138
|
-
var getComplexContentNode = (node) => {
|
|
22139
|
-
if (!node || typeof node !== "object") {
|
|
22140
|
-
return void 0;
|
|
22141
|
-
}
|
|
22142
|
-
const complexContentField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?complexContent/));
|
|
22143
|
-
return complexContentField ? node[complexContentField] : void 0;
|
|
22144
|
-
};
|
|
22145
|
-
var getExtensionNode = (node) => {
|
|
22146
|
-
if (!node || typeof node !== "object") {
|
|
22147
|
-
return void 0;
|
|
22148
|
-
}
|
|
22149
|
-
const extensionField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?extension/));
|
|
22150
|
-
return extensionField ? node[extensionField] : void 0;
|
|
22151
|
-
};
|
|
22152
|
-
var getRestrictionNode = (node) => {
|
|
22153
|
-
if (!node || typeof node !== "object") {
|
|
22154
|
-
return void 0;
|
|
22155
|
-
}
|
|
22156
|
-
const restrictionField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?restriction/));
|
|
22157
|
-
return restrictionField ? node[restrictionField] : void 0;
|
|
22158
|
-
};
|
|
22159
|
-
var getAttributeNode = (node) => {
|
|
22160
|
-
const attributeField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?attribute/));
|
|
22161
|
-
return node[attributeField];
|
|
22162
|
-
};
|
|
22163
|
-
var getSchemaNode = (node) => {
|
|
22164
|
-
const schemaField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?schema/));
|
|
22165
|
-
return node[schemaField];
|
|
22166
|
-
};
|
|
22167
|
-
var getAllSchemaNodes = (node) => {
|
|
22168
|
-
const schemas = [];
|
|
22169
|
-
for (const key of Object.keys(node)) {
|
|
22170
|
-
if (key.match(/([a-zA-z0-9]*:)?schema/)) {
|
|
22171
|
-
const schemaValue = node[key];
|
|
22172
|
-
if (Array.isArray(schemaValue)) {
|
|
22173
|
-
schemas.push(...schemaValue);
|
|
22174
|
-
} else if (schemaValue !== void 0) {
|
|
22175
|
-
schemas.push(schemaValue);
|
|
22176
|
-
}
|
|
22177
|
-
}
|
|
22178
|
-
}
|
|
22179
|
-
return schemas;
|
|
22180
|
-
};
|
|
22181
|
-
var getElementNode = (node) => {
|
|
22182
|
-
if (Array.isArray(node)) {
|
|
22183
|
-
const elementNodes = [];
|
|
22184
|
-
for (const item of node) {
|
|
22185
|
-
const elementNode = getElementNode(item);
|
|
22186
|
-
if (elementNode !== void 0) {
|
|
22187
|
-
elementNodes.push(elementNode);
|
|
22188
|
-
}
|
|
22189
|
-
}
|
|
22190
|
-
return elementNodes;
|
|
22191
|
-
}
|
|
22192
|
-
const elementField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?element/));
|
|
22193
|
-
return node[elementField];
|
|
22194
|
-
};
|
|
22195
|
-
var getComplexTypeNode = (node) => {
|
|
22196
|
-
const complexTypeField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?complexType/));
|
|
22197
|
-
return node[complexTypeField];
|
|
22198
|
-
};
|
|
22199
22252
|
var complexTypeToObject = (node, namespaces, complexTypes, targetNamespace, isQualified = false) => {
|
|
22200
22253
|
if (!node) {
|
|
22201
22254
|
const object = {};
|
|
@@ -22299,6 +22352,8 @@ var complexTypeToObject = (node, namespaces, complexTypes, targetNamespace, isQu
|
|
|
22299
22352
|
throw new Error("No se encontr\xF3 nodo sequence, choice, all, group, simpleContent o complexContent");
|
|
22300
22353
|
}
|
|
22301
22354
|
};
|
|
22355
|
+
|
|
22356
|
+
// src/wsdl/complex-types.ts
|
|
22302
22357
|
var complexTypesFromSchema = async (wsdlFile, node, namespaces) => {
|
|
22303
22358
|
const targetNamespace = node.targetNamespace;
|
|
22304
22359
|
const isQualified = node.elementFormDefault === "qualified";
|
|
@@ -22457,44 +22512,11 @@ var schemaToObject = (node, namespaces, complexTypes) => {
|
|
|
22457
22512
|
object["$qualified"] = isQualified;
|
|
22458
22513
|
return object;
|
|
22459
22514
|
};
|
|
22460
|
-
|
|
22461
|
-
|
|
22462
|
-
return node[definitionsField];
|
|
22463
|
-
};
|
|
22464
|
-
var getTypesNode = (node) => {
|
|
22465
|
-
const typesField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?types/));
|
|
22466
|
-
return node[typesField];
|
|
22467
|
-
};
|
|
22468
|
-
var getImportNode = (node) => {
|
|
22469
|
-
const importField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?import/));
|
|
22470
|
-
return node[importField];
|
|
22471
|
-
};
|
|
22472
|
-
var getMessageNode = (node) => {
|
|
22473
|
-
const messageField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?message/));
|
|
22474
|
-
const messageValue = node[messageField];
|
|
22475
|
-
return Array.isArray(messageValue) ? messageValue : [messageValue];
|
|
22476
|
-
};
|
|
22477
|
-
var getPortTypeNode = (node) => {
|
|
22478
|
-
const portTypeField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?portType/));
|
|
22479
|
-
return node[portTypeField];
|
|
22480
|
-
};
|
|
22481
|
-
var getOperationNodes = (node) => {
|
|
22482
|
-
const operationField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?operation/));
|
|
22483
|
-
if (!operationField) return [];
|
|
22484
|
-
const operationValue = node[operationField];
|
|
22485
|
-
return Array.isArray(operationValue) ? operationValue : operationValue ? [operationValue] : [];
|
|
22486
|
-
};
|
|
22515
|
+
|
|
22516
|
+
// src/wsdl/operations.ts
|
|
22487
22517
|
var getOperationName = (operationNode) => {
|
|
22488
22518
|
return operationNode.name || "UnknownOperation";
|
|
22489
22519
|
};
|
|
22490
|
-
var getInputNode = (node) => {
|
|
22491
|
-
const inputField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?input/));
|
|
22492
|
-
return node[inputField];
|
|
22493
|
-
};
|
|
22494
|
-
var getPartNode = (node) => {
|
|
22495
|
-
const partField = Object.keys(node).find((objectField) => objectField.match(/([a-zA-z0-9]*:)?part/));
|
|
22496
|
-
return node[partField];
|
|
22497
|
-
};
|
|
22498
22520
|
var getRequestTypeFromOperation = (operationNode, definitionsNode, schemaObject) => {
|
|
22499
22521
|
const operationName = getOperationName(operationNode);
|
|
22500
22522
|
const inputNode = getInputNode(operationNode);
|
|
@@ -22541,30 +22563,8 @@ var getRequestTypeFromOperation = (operationNode, definitionsNode, schemaObject)
|
|
|
22541
22563
|
}
|
|
22542
22564
|
return { operationName, requestType };
|
|
22543
22565
|
};
|
|
22544
|
-
var getNamespacesFromNode = (node) => {
|
|
22545
|
-
const namespaces = /* @__PURE__ */ new Map();
|
|
22546
|
-
if (node.targetNamespace !== void 0) {
|
|
22547
|
-
namespaces.set("targetNamespace", node.targetNamespace);
|
|
22548
|
-
}
|
|
22549
|
-
for (const key of Object.keys(node)) {
|
|
22550
|
-
const match = key.match(/xmlns:([a-zA-z0-9]*)/);
|
|
22551
|
-
if (match !== null) {
|
|
22552
|
-
const value = node[key];
|
|
22553
|
-
namespaces.set(match[1], value);
|
|
22554
|
-
}
|
|
22555
|
-
}
|
|
22556
|
-
return namespaces;
|
|
22557
|
-
};
|
|
22558
22566
|
|
|
22559
|
-
// src/
|
|
22560
|
-
var toPascalCase = (str) => {
|
|
22561
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
22562
|
-
};
|
|
22563
|
-
var toCamelCase2 = (str) => {
|
|
22564
|
-
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
22565
|
-
};
|
|
22566
|
-
|
|
22567
|
-
// src/template.ts
|
|
22567
|
+
// src/codegen/constants.ts
|
|
22568
22568
|
var XML_SCHEMA_TYPES = {
|
|
22569
22569
|
"string": "string",
|
|
22570
22570
|
"int": "number",
|
|
@@ -22585,6 +22585,16 @@ var XML_SCHEMA_TYPES = {
|
|
|
22585
22585
|
var NAMESPACE_KEY = "$namespace";
|
|
22586
22586
|
var XML_SCHEMA_URI = "http://www.w3.org/2001/XMLSchema";
|
|
22587
22587
|
var DEFAULT_OCCURS = "1";
|
|
22588
|
+
|
|
22589
|
+
// src/util.ts
|
|
22590
|
+
var toPascalCase = (str) => {
|
|
22591
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
22592
|
+
};
|
|
22593
|
+
var toCamelCase2 = (str) => {
|
|
22594
|
+
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
22595
|
+
};
|
|
22596
|
+
|
|
22597
|
+
// src/codegen/utils.ts
|
|
22588
22598
|
var namespacePrefixCache = /* @__PURE__ */ new Map();
|
|
22589
22599
|
var stringSplitCache = /* @__PURE__ */ new Map();
|
|
22590
22600
|
var filteredKeysCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -22672,6 +22682,8 @@ function extractNamespacePrefix(namespace) {
|
|
|
22672
22682
|
namespacePrefixCache.set(namespace, prefix);
|
|
22673
22683
|
return prefix;
|
|
22674
22684
|
}
|
|
22685
|
+
|
|
22686
|
+
// src/codegen/namespaces.ts
|
|
22675
22687
|
function extractAllNamespaceMappings(baseTypeName, baseTypeObject) {
|
|
22676
22688
|
const tagsMapping = {};
|
|
22677
22689
|
const prefixesMapping = {};
|
|
@@ -22810,6 +22822,8 @@ function shouldHavePrefix(elementObject) {
|
|
|
22810
22822
|
}
|
|
22811
22823
|
return false;
|
|
22812
22824
|
}
|
|
22825
|
+
|
|
22826
|
+
// src/codegen/xml-generator.ts
|
|
22813
22827
|
function generateXmlPropertyCode(namespacesTypeMapping, baseNamespacePrefix, key, elementObject, parentKey = null, propertyPath = "", parentIsQualified = true) {
|
|
22814
22828
|
const namespacePrefix = getNamespacePrefix(
|
|
22815
22829
|
namespacesTypeMapping,
|
|
@@ -22894,13 +22908,12 @@ function generateXmlPropertyCode(namespacesTypeMapping, baseNamespacePrefix, key
|
|
|
22894
22908
|
function generateXmlBodyCode(baseNamespacePrefix, namespacesTypeMapping, baseTypeName, baseTypeObject, propsInterfaceName) {
|
|
22895
22909
|
const keys = getFilteredKeys(baseTypeObject);
|
|
22896
22910
|
const baseTypeLocalName = extractLocalName(baseTypeName);
|
|
22897
|
-
const initialPropertyPath = propsInterfaceName ? toCamelCase2(propsInterfaceName) : "";
|
|
22898
22911
|
const properties = keys.map((key) => {
|
|
22899
22912
|
const element = baseTypeObject[key];
|
|
22900
22913
|
if (typeof element === "object" && element !== null) {
|
|
22901
22914
|
const keyLocalName = extractLocalName(key);
|
|
22902
22915
|
const keyCamelCase = toCamelCase2(keyLocalName);
|
|
22903
|
-
const propertyPath =
|
|
22916
|
+
const propertyPath = keyCamelCase;
|
|
22904
22917
|
return generateXmlPropertyCode(
|
|
22905
22918
|
namespacesTypeMapping,
|
|
22906
22919
|
baseNamespacePrefix,
|
|
@@ -22918,6 +22931,8 @@ function generateXmlBodyCode(baseNamespacePrefix, namespacesTypeMapping, baseTyp
|
|
|
22918
22931
|
${properties}
|
|
22919
22932
|
</${baseNamespacePrefix}.${baseTypeLocalName}>`;
|
|
22920
22933
|
}
|
|
22934
|
+
|
|
22935
|
+
// src/codegen/data-preparer.ts
|
|
22921
22936
|
function prepareSimpleTypesData(typeObject, xmlSchemaUri) {
|
|
22922
22937
|
return Object.keys(typeObject).filter((key) => {
|
|
22923
22938
|
if (key === NAMESPACE_KEY) return false;
|
|
@@ -23040,14 +23055,12 @@ function extractNestedComplexTypes(typeObject, namespaceKey, xmlSchemaUri, visit
|
|
|
23040
23055
|
}
|
|
23041
23056
|
return result;
|
|
23042
23057
|
}
|
|
23043
|
-
function prepareInterfacesData(requestTypeObject, namespaceKey, xmlSchemaUri, allTypesForInterfaces) {
|
|
23058
|
+
function prepareInterfacesData(requestTypeObject, namespaceKey, xmlSchemaUri, allTypesForInterfaces, simpleTypeNames) {
|
|
23044
23059
|
const visited = /* @__PURE__ */ new Set();
|
|
23045
23060
|
const interfaces = [];
|
|
23046
23061
|
const allKeys = Object.keys(requestTypeObject).filter((k) => k !== namespaceKey);
|
|
23047
23062
|
const extractionVisited = /* @__PURE__ */ new Set();
|
|
23048
23063
|
const allComplexTypes = extractNestedComplexTypes(requestTypeObject, namespaceKey, xmlSchemaUri, extractionVisited);
|
|
23049
|
-
if (allComplexTypes.length > 0) {
|
|
23050
|
-
}
|
|
23051
23064
|
const topLevelKeys = Object.keys(requestTypeObject).filter((key) => {
|
|
23052
23065
|
if (key === namespaceKey) return false;
|
|
23053
23066
|
const typeDef = requestTypeObject[key];
|
|
@@ -23060,17 +23073,21 @@ function prepareInterfacesData(requestTypeObject, namespaceKey, xmlSchemaUri, al
|
|
|
23060
23073
|
}
|
|
23061
23074
|
return false;
|
|
23062
23075
|
});
|
|
23063
|
-
if (topLevelKeys.length > 0) {
|
|
23064
|
-
}
|
|
23065
23076
|
for (const key of topLevelKeys) {
|
|
23066
23077
|
const localName = extractLocalName(key);
|
|
23067
23078
|
const interfaceName = toPascalCase(localName);
|
|
23079
|
+
if (simpleTypeNames && simpleTypeNames.has(interfaceName)) {
|
|
23080
|
+
continue;
|
|
23081
|
+
}
|
|
23068
23082
|
if (!visited.has(interfaceName) && !interfaces.some((i) => i.name === interfaceName)) {
|
|
23069
23083
|
visited.add(interfaceName);
|
|
23070
23084
|
interfaces.push(prepareInterfaceData(interfaceName, requestTypeObject[key], allTypesForInterfaces));
|
|
23071
23085
|
}
|
|
23072
23086
|
}
|
|
23073
23087
|
for (const { interfaceName, typeObject } of allComplexTypes) {
|
|
23088
|
+
if (simpleTypeNames && simpleTypeNames.has(interfaceName)) {
|
|
23089
|
+
continue;
|
|
23090
|
+
}
|
|
23074
23091
|
if (!visited.has(interfaceName) && !interfaces.some((i) => i.name === interfaceName)) {
|
|
23075
23092
|
visited.add(interfaceName);
|
|
23076
23093
|
interfaces.push(prepareInterfaceData(interfaceName, { type: typeObject }, allTypesForInterfaces));
|
|
@@ -23097,6 +23114,9 @@ function prepareInterfacesData(requestTypeObject, namespaceKey, xmlSchemaUri, al
|
|
|
23097
23114
|
for (const key of remainingKeys) {
|
|
23098
23115
|
const localName = extractLocalName(key);
|
|
23099
23116
|
const interfaceName = toPascalCase(localName);
|
|
23117
|
+
if (simpleTypeNames && simpleTypeNames.has(interfaceName)) {
|
|
23118
|
+
continue;
|
|
23119
|
+
}
|
|
23100
23120
|
if (!visited.has(interfaceName) && !interfaces.some((i) => i.name === interfaceName)) {
|
|
23101
23121
|
visited.add(interfaceName);
|
|
23102
23122
|
const typeDef = requestTypeObject[key];
|
|
@@ -23119,6 +23139,9 @@ function prepareInterfacesData(requestTypeObject, namespaceKey, xmlSchemaUri, al
|
|
|
23119
23139
|
for (const key of missingKeys) {
|
|
23120
23140
|
const localName = extractLocalName(key);
|
|
23121
23141
|
const interfaceName = toPascalCase(localName);
|
|
23142
|
+
if (simpleTypeNames && simpleTypeNames.has(interfaceName)) {
|
|
23143
|
+
continue;
|
|
23144
|
+
}
|
|
23122
23145
|
if (!visited.has(interfaceName) && !interfaces.some((i) => i.name === interfaceName)) {
|
|
23123
23146
|
visited.add(interfaceName);
|
|
23124
23147
|
const typeDef = allTypesForInterfaces[key];
|
|
@@ -23139,8 +23162,6 @@ function prepareInterfacesData(requestTypeObject, namespaceKey, xmlSchemaUri, al
|
|
|
23139
23162
|
}
|
|
23140
23163
|
}
|
|
23141
23164
|
}
|
|
23142
|
-
if (interfaces.length > 0) {
|
|
23143
|
-
}
|
|
23144
23165
|
return interfaces;
|
|
23145
23166
|
}
|
|
23146
23167
|
function resolveTypeName(referencedType, propName2, allTypesForInterfaces) {
|
|
@@ -23183,7 +23204,6 @@ function resolveTypeName(referencedType, propName2, allTypesForInterfaces) {
|
|
|
23183
23204
|
if (matchingTypeKey) {
|
|
23184
23205
|
const resolvedName = toPascalCase(extractLocalName(matchingTypeKey));
|
|
23185
23206
|
return resolvedName;
|
|
23186
|
-
} else {
|
|
23187
23207
|
}
|
|
23188
23208
|
}
|
|
23189
23209
|
const fallbackName = toPascalCase(propName2);
|
|
@@ -23192,8 +23212,12 @@ function resolveTypeName(referencedType, propName2, allTypesForInterfaces) {
|
|
|
23192
23212
|
function prepareTemplateData(requestType, requestTypeObject, namespacesTagsMapping, namespacesPrefixMapping, namespacesTypeMapping, soapNamespaceURI, baseNamespacePrefix, allTypesForInterfaces) {
|
|
23193
23213
|
const simpleTypes = prepareSimpleTypesData(requestTypeObject, XML_SCHEMA_URI);
|
|
23194
23214
|
const propsInterface = preparePropsInterfaceData(requestType, requestTypeObject, allTypesForInterfaces);
|
|
23195
|
-
const typesForInterfaces =
|
|
23196
|
-
const
|
|
23215
|
+
const typesForInterfaces = requestTypeObject;
|
|
23216
|
+
const simpleTypeNames = new Set(simpleTypes.map((st) => {
|
|
23217
|
+
const localName = extractLocalName(st.name);
|
|
23218
|
+
return toPascalCase(localName);
|
|
23219
|
+
}));
|
|
23220
|
+
const interfaces = prepareInterfacesData(typesForInterfaces, NAMESPACE_KEY, XML_SCHEMA_URI, allTypesForInterfaces, simpleTypeNames);
|
|
23197
23221
|
const mainPropName = propsInterface.properties.length > 0 ? propsInterface.properties[0].name : void 0;
|
|
23198
23222
|
const xmlBody = generateXmlBodyCode(baseNamespacePrefix, namespacesTypeMapping, requestType, requestTypeObject, mainPropName);
|
|
23199
23223
|
const requestTypeLocalName = extractLocalName(requestType);
|
|
@@ -23475,9 +23499,14 @@ Schema [${i}] (targetNamespace: ${schemaNode.targetNamespace || "no definido"}):
|
|
|
23475
23499
|
allTypesForInterfaces[typeName] = allComplexTypes[typeName];
|
|
23476
23500
|
}
|
|
23477
23501
|
}
|
|
23478
|
-
|
|
23479
|
-
|
|
23480
|
-
|
|
23502
|
+
const responseTypeName = `${opName}Response`;
|
|
23503
|
+
const responseTypeKeys = Object.keys(allComplexTypes).filter((k) => {
|
|
23504
|
+
const localName = extractLocalName(k);
|
|
23505
|
+
return localName === responseTypeName || localName.toLowerCase() === responseTypeName.toLowerCase();
|
|
23506
|
+
});
|
|
23507
|
+
for (const responseTypeKey of responseTypeKeys) {
|
|
23508
|
+
if (!allTypesForInterfaces[responseTypeKey] && allComplexTypes[responseTypeKey]) {
|
|
23509
|
+
allTypesForInterfaces[responseTypeKey] = allComplexTypes[responseTypeKey];
|
|
23481
23510
|
}
|
|
23482
23511
|
}
|
|
23483
23512
|
const namespaceMappings = extractAllNamespaceMappings(requestType, requestTypeObject);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@karibulab/wsdl2tsx",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.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.10.0",
|
|
17
17
|
"axios": "^1.7.9",
|
|
18
18
|
"fast-xml-parser": "5.3.3",
|
|
19
19
|
"handlebars": "4.7.8"
|