@techspokes/typescript-wsdl-client 0.2.5 → 0.2.7
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":"schemaCompiler.d.ts","sourceRoot":"","sources":["../../src/compiler/schemaCompiler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAU3D,MAAM,MAAM,KAAK,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAElD,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,KAAK,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,GAAG,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;QAC9B,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC,CAAC;IACH,KAAK,EAAE,KAAK,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC;QAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC,CAAC;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,UAAU,CAAC,EAAE,KAAK,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,GAAG,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;QAC9B,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC,CAAC;IAEH,UA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|
function getOrCompileComplex(name, cnode, schemaNS, prefixes) {
|
|
177
177
|
const outName = pascal(name);
|
|
178
178
|
const key = `${schemaNS}|${outName}`;
|
|
179
|
-
|
|
180
|
-
if (present) {
|
|
181
|
-
return present;
|
|
182
|
-
}
|
|
183
|
-
if (inProgress.has(key)) {
|
|
184
|
-
// minimal cycle break
|
|
185
|
-
return { name: outName, ns: schemaNS, attrs: [], elems: [] };
|
|
186
|
-
}
|
|
187
|
-
inProgress.add(key);
|
|
188
|
-
// mergeAttrs: combine base attributes with local ones, overriding duplicates by name
|
|
179
|
+
// hoisted helpers for merging and collecting
|
|
189
180
|
const mergeAttrs = (into, list) => {
|
|
190
|
-
// build index of existing attribute names
|
|
191
181
|
const idx = new Map();
|
|
192
182
|
into.forEach((a, i) => idx.set(a.name, i));
|
|
193
|
-
// for each new attr, add or override existing
|
|
194
183
|
for (const a of list) {
|
|
195
184
|
const pos = idx.get(a.name);
|
|
196
185
|
if (pos == null) {
|
|
@@ -198,11 +187,10 @@ export function compileCatalog(cat, _opts) {
|
|
|
198
187
|
into.push(a);
|
|
199
188
|
}
|
|
200
189
|
else {
|
|
201
|
-
into[pos] = a;
|
|
190
|
+
into[pos] = a;
|
|
202
191
|
}
|
|
203
192
|
}
|
|
204
193
|
};
|
|
205
|
-
// mergeElems: combine base elements (particles) with local ones, preserving unique names and overriding duplicates
|
|
206
194
|
const mergeElems = (into, list) => {
|
|
207
195
|
const idx = new Map();
|
|
208
196
|
into.forEach((e, i) => idx.set(e.name, i));
|
|
@@ -213,12 +201,10 @@ export function compileCatalog(cat, _opts) {
|
|
|
213
201
|
into.push(e);
|
|
214
202
|
}
|
|
215
203
|
else {
|
|
216
|
-
into[pos] = e;
|
|
204
|
+
into[pos] = e;
|
|
217
205
|
}
|
|
218
206
|
}
|
|
219
207
|
};
|
|
220
|
-
// collectAttributes: read all <attribute> children, handle inline simpleType vs named type references
|
|
221
|
-
// maps each attribute to a TS type, tracks required vs optional via @use, and records the original declared XSD type
|
|
222
208
|
const collectAttributes = (node) => {
|
|
223
209
|
const out = [];
|
|
224
210
|
const attrs = getChildrenWithLocalName(node, "attribute");
|
|
@@ -243,9 +229,6 @@ export function compileCatalog(cat, _opts) {
|
|
|
243
229
|
}
|
|
244
230
|
return out;
|
|
245
231
|
};
|
|
246
|
-
// collectParticles: parse compositor elements (sequence, all, choice), extract <element> definitions
|
|
247
|
-
// handles inline complex/simple definitions by generating a unique inline type name
|
|
248
|
-
// resolves type refs or @ref, applies min/max occurrence and nillable flags
|
|
249
232
|
const collectParticles = (ownerTypeName, node) => {
|
|
250
233
|
const out = [];
|
|
251
234
|
// process a compositor or element container recursively
|
|
@@ -288,7 +271,21 @@ export function compileCatalog(cat, _opts) {
|
|
|
288
271
|
recurse(node);
|
|
289
272
|
return out;
|
|
290
273
|
};
|
|
291
|
-
|
|
274
|
+
const present = compiledMap.get(key);
|
|
275
|
+
if (present) {
|
|
276
|
+
// On duplicate definitions, merge new attributes and elements
|
|
277
|
+
const newAttrs = collectAttributes(cnode);
|
|
278
|
+
const newElems = collectParticles(outName, cnode);
|
|
279
|
+
mergeAttrs(present.attrs, newAttrs);
|
|
280
|
+
mergeElems(present.elems, newElems);
|
|
281
|
+
return present;
|
|
282
|
+
}
|
|
283
|
+
if (inProgress.has(key)) {
|
|
284
|
+
// minimal cycle break
|
|
285
|
+
return { name: outName, ns: schemaNS, attrs: [], elems: [] };
|
|
286
|
+
}
|
|
287
|
+
inProgress.add(key);
|
|
288
|
+
// result accumulators
|
|
292
289
|
const attrs = [];
|
|
293
290
|
const elems = [];
|
|
294
291
|
// Inheritance: complexContent
|
|
@@ -390,7 +387,7 @@ export function compileCatalog(cat, _opts) {
|
|
|
390
387
|
const tAttr = enode["@_type"];
|
|
391
388
|
if (tAttr) {
|
|
392
389
|
const q = resolveQName(tAttr, schemaNS, prefixes);
|
|
393
|
-
// If references a simple type → $value; if complex type →
|
|
390
|
+
// If references a simple type → $value; if complex type → prefer alias to avoid duplication
|
|
394
391
|
if (q.ns === XS) {
|
|
395
392
|
const label = `xs:${q.local}`;
|
|
396
393
|
const t = {
|
|
@@ -404,10 +401,24 @@ export function compileCatalog(cat, _opts) {
|
|
|
404
401
|
}
|
|
405
402
|
const baseRec = complexTypes.get(qkey(q));
|
|
406
403
|
if (baseRec) {
|
|
404
|
+
// Ensure base type is compiled
|
|
407
405
|
const base = getOrCompileComplex(baseRec.node["@_name"], baseRec.node, baseRec.tns, baseRec.prefixes);
|
|
408
|
-
|
|
409
|
-
compiledMap.
|
|
410
|
-
|
|
406
|
+
// If a concrete type with the same name already exists, avoid aliasing conflict
|
|
407
|
+
if (!compiledMap.has(key)) {
|
|
408
|
+
// record alias: ElementName -> BaseTypeName
|
|
409
|
+
const aliasKey = key;
|
|
410
|
+
const existingAlias = aliasMap.get(aliasKey);
|
|
411
|
+
const declared = `{${base.ns}}${base.name}`;
|
|
412
|
+
const aliasName = outName;
|
|
413
|
+
if (!existingAlias) {
|
|
414
|
+
aliasMap.set(aliasKey, { name: aliasName, ns: schemaNS, tsType: base.name, declared });
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
// if an alias exists but points elsewhere, keep the first one (stable) and ignore
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
// Return base so callers have a CompiledType, but do not duplicate in compiledMap for wrapper
|
|
421
|
+
return base;
|
|
411
422
|
}
|
|
412
423
|
const srec = simpleTypes.get(qkey(q));
|
|
413
424
|
if (srec) {
|
|
@@ -462,6 +473,17 @@ export function compileCatalog(cat, _opts) {
|
|
|
462
473
|
childType[t.name] = child;
|
|
463
474
|
propMeta[t.name] = meta;
|
|
464
475
|
}
|
|
476
|
+
// Add meta synonyms for element aliases that point to complex types, so runtime can use either name
|
|
477
|
+
if (aliasList.length) {
|
|
478
|
+
const typeNameSet = new Set(typesList.map(t => t.name));
|
|
479
|
+
for (const a of aliasList) {
|
|
480
|
+
if (typeNameSet.has(a.tsType) && !(a.name in childType)) {
|
|
481
|
+
childType[a.name] = childType[a.tsType];
|
|
482
|
+
propMeta[a.name] = propMeta[a.tsType];
|
|
483
|
+
attrSpec[a.name] = attrSpec[a.tsType];
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
465
487
|
// operations / soapAction (enriched)
|
|
466
488
|
// 1) Gather all binding definitions and select the SOAP binding (soap:binding or soap12:binding child).
|
|
467
489
|
// 2) Use the binding's @type to locate the matching portType in definitions.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@techspokes/typescript-wsdl-client",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
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",
|