@omnigraph/soap 1.0.0-alpha-20230523155104-df277a22b → 1.0.0-alpha-20230523160518-5443a1139
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/cjs/SOAPLoader.js +33 -25
- package/esm/SOAPLoader.js +33 -25
- package/package.json +3 -6
package/cjs/SOAPLoader.js
CHANGED
|
@@ -151,13 +151,14 @@ class SOAPLoader {
|
|
|
151
151
|
return namespaceMessageMap;
|
|
152
152
|
}
|
|
153
153
|
async loadSchema(schemaObj, parentAliasMap = new Map()) {
|
|
154
|
+
var _a, _b;
|
|
154
155
|
const schemaNamespace = schemaObj.attributes.targetNamespace;
|
|
155
156
|
const aliasMap = this.getAliasMapFromAttributes(schemaObj.attributes);
|
|
156
157
|
let typePrefix = this.namespaceTypePrefixMap.get(schemaNamespace);
|
|
157
158
|
if (!typePrefix) {
|
|
158
159
|
typePrefix =
|
|
159
160
|
schemaObj.attributes.id ||
|
|
160
|
-
[...aliasMap.entries()].find(([, namespace]) => namespace === schemaNamespace)
|
|
161
|
+
((_a = [...aliasMap.entries()].find(([, namespace]) => namespace === schemaNamespace)) === null || _a === void 0 ? void 0 : _a[0]);
|
|
161
162
|
this.namespaceTypePrefixMap.set(schemaNamespace, typePrefix);
|
|
162
163
|
}
|
|
163
164
|
for (const [alias, namespace] of parentAliasMap) {
|
|
@@ -209,7 +210,7 @@ class SOAPLoader {
|
|
|
209
210
|
this.aliasMap.set(simpleType, aliasMap);
|
|
210
211
|
}
|
|
211
212
|
}
|
|
212
|
-
if (elementObj.attributes
|
|
213
|
+
if ((_b = elementObj.attributes) === null || _b === void 0 ? void 0 : _b.type) {
|
|
213
214
|
const [refTypeNamespaceAlias, refTypeName] = elementObj.attributes.type.split(':');
|
|
214
215
|
const refTypeNamespace = aliasMap.get(refTypeNamespaceAlias);
|
|
215
216
|
if (!refTypeNamespace) {
|
|
@@ -426,6 +427,7 @@ class SOAPLoader {
|
|
|
426
427
|
return aliasMap;
|
|
427
428
|
}
|
|
428
429
|
getTypeForSimpleType(simpleType, simpleTypeNamespace) {
|
|
430
|
+
var _a;
|
|
429
431
|
let simpleTypeTC = this.simpleTypeTCMap.get(simpleType);
|
|
430
432
|
if (!simpleTypeTC) {
|
|
431
433
|
const simpleTypeName = simpleType.attributes.name;
|
|
@@ -460,7 +462,7 @@ class SOAPLoader {
|
|
|
460
462
|
if (!baseTypeNamespace) {
|
|
461
463
|
throw new Error(`Invalid base type namespace: ${baseTypeNamespaceAlias}`);
|
|
462
464
|
}
|
|
463
|
-
const baseType = this.getNamespaceSimpleTypeMap(baseTypeNamespace)
|
|
465
|
+
const baseType = (_a = this.getNamespaceSimpleTypeMap(baseTypeNamespace)) === null || _a === void 0 ? void 0 : _a.get(baseTypeName);
|
|
464
466
|
if (!baseType) {
|
|
465
467
|
throw new Error(`Simple Type: ${baseTypeName} couldn't be found in ${baseTypeNamespace} needed for ${simpleTypeName}`);
|
|
466
468
|
}
|
|
@@ -471,17 +473,19 @@ class SOAPLoader {
|
|
|
471
473
|
return simpleTypeTC;
|
|
472
474
|
}
|
|
473
475
|
getInputTypeForTypeNameInNamespace({ typeName, typeNamespace, }) {
|
|
474
|
-
|
|
476
|
+
var _a, _b;
|
|
477
|
+
const complexType = (_a = this.getNamespaceComplexTypeMap(typeNamespace)) === null || _a === void 0 ? void 0 : _a.get(typeName);
|
|
475
478
|
if (complexType) {
|
|
476
479
|
return this.getInputTypeForComplexType(complexType, typeNamespace);
|
|
477
480
|
}
|
|
478
|
-
const simpleType = this.getNamespaceSimpleTypeMap(typeNamespace)
|
|
481
|
+
const simpleType = (_b = this.getNamespaceSimpleTypeMap(typeNamespace)) === null || _b === void 0 ? void 0 : _b.get(typeName);
|
|
479
482
|
if (simpleType) {
|
|
480
483
|
return this.getTypeForSimpleType(simpleType, typeNamespace);
|
|
481
484
|
}
|
|
482
485
|
throw new Error(`Type: ${typeName} couldn't be found in ${typeNamespace}`);
|
|
483
486
|
}
|
|
484
487
|
getInputTypeForComplexType(complexType, complexTypeNamespace) {
|
|
488
|
+
var _a, _b, _c;
|
|
485
489
|
let complexTypeTC = this.complexTypeInputTCMap.get(complexType);
|
|
486
490
|
if (!complexTypeTC) {
|
|
487
491
|
const complexTypeName = complexType.attributes.name;
|
|
@@ -499,9 +503,10 @@ class SOAPLoader {
|
|
|
499
503
|
if (fieldName) {
|
|
500
504
|
fieldMap[fieldName] = {
|
|
501
505
|
type: () => {
|
|
502
|
-
|
|
503
|
-
const
|
|
504
|
-
const
|
|
506
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
507
|
+
const maxOccurs = ((_a = sequenceOrChoiceObj.attributes) === null || _a === void 0 ? void 0 : _a.maxOccurs) || ((_b = elementObj.attributes) === null || _b === void 0 ? void 0 : _b.maxOccurs);
|
|
508
|
+
const minOccurs = ((_c = sequenceOrChoiceObj.attributes) === null || _c === void 0 ? void 0 : _c.minOccurs) || ((_d = elementObj.attributes) === null || _d === void 0 ? void 0 : _d.minOccurs);
|
|
509
|
+
const nillable = ((_e = sequenceOrChoiceObj.attributes) === null || _e === void 0 ? void 0 : _e.nillable) || ((_f = elementObj.attributes) === null || _f === void 0 ? void 0 : _f.nillable);
|
|
505
510
|
const isPlural = maxOccurs != null && maxOccurs !== '1';
|
|
506
511
|
let isNullable = false;
|
|
507
512
|
if (minOccurs == null || minOccurs === '0') {
|
|
@@ -513,7 +518,7 @@ class SOAPLoader {
|
|
|
513
518
|
if (nillable === 'false') {
|
|
514
519
|
isNullable = false;
|
|
515
520
|
}
|
|
516
|
-
if (elementObj.attributes
|
|
521
|
+
if ((_g = elementObj.attributes) === null || _g === void 0 ? void 0 : _g.type) {
|
|
517
522
|
const [typeNamespaceAlias, typeName] = elementObj.attributes.type.split(':');
|
|
518
523
|
let typeNamespace;
|
|
519
524
|
if (elementObj.attributes[typeNamespaceAlias]) {
|
|
@@ -582,7 +587,7 @@ class SOAPLoader {
|
|
|
582
587
|
};
|
|
583
588
|
}
|
|
584
589
|
else {
|
|
585
|
-
if (elementObj.attributes
|
|
590
|
+
if ((_a = elementObj.attributes) === null || _a === void 0 ? void 0 : _a.ref) {
|
|
586
591
|
console.warn(`element.ref isn't supported yet.`);
|
|
587
592
|
}
|
|
588
593
|
else {
|
|
@@ -593,7 +598,7 @@ class SOAPLoader {
|
|
|
593
598
|
}
|
|
594
599
|
if (sequenceOrChoiceObj.any) {
|
|
595
600
|
for (const anyObj of sequenceOrChoiceObj.any) {
|
|
596
|
-
const anyNamespace = anyObj.attributes
|
|
601
|
+
const anyNamespace = (_b = anyObj.attributes) === null || _b === void 0 ? void 0 : _b.namespace;
|
|
597
602
|
if (anyNamespace) {
|
|
598
603
|
const anyTypeTC = this.getInputTypeForTypeNameInNamespace({
|
|
599
604
|
typeName: complexTypeName,
|
|
@@ -622,7 +627,7 @@ class SOAPLoader {
|
|
|
622
627
|
if (!baseTypeNamespace) {
|
|
623
628
|
throw new Error(`Namespace alias: ${baseTypeNamespaceAlias} is undefined!`);
|
|
624
629
|
}
|
|
625
|
-
const baseType = this.getNamespaceComplexTypeMap(baseTypeNamespace)
|
|
630
|
+
const baseType = (_c = this.getNamespaceComplexTypeMap(baseTypeNamespace)) === null || _c === void 0 ? void 0 : _c.get(baseTypeName);
|
|
626
631
|
if (!baseType) {
|
|
627
632
|
throw new Error(`Complex Type: ${baseTypeName} couldn't be found in ${baseTypeNamespace} needed for ${complexTypeName}`);
|
|
628
633
|
}
|
|
@@ -667,7 +672,8 @@ class SOAPLoader {
|
|
|
667
672
|
return complexTypeTC;
|
|
668
673
|
}
|
|
669
674
|
getOutputFieldTypeFromElement(elementObj, aliasMap, namespace) {
|
|
670
|
-
|
|
675
|
+
var _a;
|
|
676
|
+
if ((_a = elementObj.attributes) === null || _a === void 0 ? void 0 : _a.type) {
|
|
671
677
|
const [typeNamespaceAlias, typeName] = elementObj.attributes.type.split(':');
|
|
672
678
|
let typeNamespace;
|
|
673
679
|
if (elementObj.attributes[typeNamespaceAlias]) {
|
|
@@ -712,6 +718,7 @@ class SOAPLoader {
|
|
|
712
718
|
throw new Error(`Invalid element type definition: ${elementObj.attributes.name}`);
|
|
713
719
|
}
|
|
714
720
|
getOutputTypeForComplexType(complexType, complexTypeNamespace) {
|
|
721
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
715
722
|
let complexTypeTC = this.complexTypeOutputTCMap.get(complexType);
|
|
716
723
|
if (!complexTypeTC) {
|
|
717
724
|
const complexTypeName = complexType.attributes.name;
|
|
@@ -727,9 +734,9 @@ class SOAPLoader {
|
|
|
727
734
|
for (const elementObj of choiceOrSequenceObj.element) {
|
|
728
735
|
const fieldName = elementObj.attributes.name;
|
|
729
736
|
if (fieldName) {
|
|
730
|
-
const maxOccurs = choiceOrSequenceObj.attributes
|
|
731
|
-
const minOccurs = choiceOrSequenceObj.attributes
|
|
732
|
-
const nillable = choiceOrSequenceObj.attributes
|
|
737
|
+
const maxOccurs = ((_a = choiceOrSequenceObj.attributes) === null || _a === void 0 ? void 0 : _a.maxOccurs) || ((_b = elementObj.attributes) === null || _b === void 0 ? void 0 : _b.maxOccurs);
|
|
738
|
+
const minOccurs = ((_c = choiceOrSequenceObj.attributes) === null || _c === void 0 ? void 0 : _c.minOccurs) || ((_d = elementObj.attributes) === null || _d === void 0 ? void 0 : _d.minOccurs);
|
|
739
|
+
const nillable = ((_e = choiceOrSequenceObj.attributes) === null || _e === void 0 ? void 0 : _e.nillable) || ((_f = elementObj.attributes) === null || _f === void 0 ? void 0 : _f.nillable);
|
|
733
740
|
const isPlural = maxOccurs != null && maxOccurs !== '1';
|
|
734
741
|
let isNullable = false;
|
|
735
742
|
if (minOccurs == null || minOccurs === '0') {
|
|
@@ -755,8 +762,8 @@ class SOAPLoader {
|
|
|
755
762
|
};
|
|
756
763
|
}
|
|
757
764
|
else {
|
|
758
|
-
if (elementObj.attributes
|
|
759
|
-
console.warn(`element.ref isn't supported yet.`, elementObj.attributes
|
|
765
|
+
if ((_g = elementObj.attributes) === null || _g === void 0 ? void 0 : _g.ref) {
|
|
766
|
+
console.warn(`element.ref isn't supported yet.`, (_h = elementObj.attributes) === null || _h === void 0 ? void 0 : _h.ref);
|
|
760
767
|
}
|
|
761
768
|
else {
|
|
762
769
|
console.warn(`Element doesn't have a name in ${complexTypeName}. Ignoring...`);
|
|
@@ -766,7 +773,7 @@ class SOAPLoader {
|
|
|
766
773
|
}
|
|
767
774
|
if (choiceOrSequenceObj.any) {
|
|
768
775
|
for (const anyObj of choiceOrSequenceObj.any) {
|
|
769
|
-
const anyNamespace = anyObj.attributes
|
|
776
|
+
const anyNamespace = (_j = anyObj.attributes) === null || _j === void 0 ? void 0 : _j.namespace;
|
|
770
777
|
if (anyNamespace) {
|
|
771
778
|
const anyTypeTC = this.getOutputTypeForTypeNameInNamespace({
|
|
772
779
|
typeName: complexTypeName,
|
|
@@ -790,7 +797,7 @@ class SOAPLoader {
|
|
|
790
797
|
if (!baseTypeNamespace) {
|
|
791
798
|
throw new Error(`Namespace alias: ${baseTypeNamespaceAlias} is undefined!`);
|
|
792
799
|
}
|
|
793
|
-
const baseType = this.getNamespaceComplexTypeMap(baseTypeNamespace)
|
|
800
|
+
const baseType = (_k = this.getNamespaceComplexTypeMap(baseTypeNamespace)) === null || _k === void 0 ? void 0 : _k.get(baseTypeName);
|
|
794
801
|
if (!baseType) {
|
|
795
802
|
throw new Error(`Complex Type: ${baseTypeName} couldn't be found in ${baseTypeNamespace} needed for ${complexTypeName}`);
|
|
796
803
|
}
|
|
@@ -807,9 +814,9 @@ class SOAPLoader {
|
|
|
807
814
|
for (const choiceOrSequenceObj of choiceOrSequenceObjects) {
|
|
808
815
|
for (const elementObj of choiceOrSequenceObj.element) {
|
|
809
816
|
const fieldName = elementObj.attributes.name;
|
|
810
|
-
const maxOccurs = choiceOrSequenceObj.attributes
|
|
811
|
-
const minOccurs = choiceOrSequenceObj.attributes
|
|
812
|
-
const nillable = choiceOrSequenceObj.attributes
|
|
817
|
+
const maxOccurs = ((_l = choiceOrSequenceObj.attributes) === null || _l === void 0 ? void 0 : _l.maxOccurs) || ((_m = elementObj.attributes) === null || _m === void 0 ? void 0 : _m.maxOccurs);
|
|
818
|
+
const minOccurs = ((_o = choiceOrSequenceObj.attributes) === null || _o === void 0 ? void 0 : _o.minOccurs) || ((_p = elementObj.attributes) === null || _p === void 0 ? void 0 : _p.minOccurs);
|
|
819
|
+
const nillable = ((_q = choiceOrSequenceObj.attributes) === null || _q === void 0 ? void 0 : _q.nillable) || ((_r = elementObj.attributes) === null || _r === void 0 ? void 0 : _r.nillable);
|
|
813
820
|
const isPlural = maxOccurs != null && maxOccurs !== '1';
|
|
814
821
|
let isNullable = false;
|
|
815
822
|
if (minOccurs == null || minOccurs === '0') {
|
|
@@ -852,11 +859,12 @@ class SOAPLoader {
|
|
|
852
859
|
return complexTypeTC;
|
|
853
860
|
}
|
|
854
861
|
getOutputTypeForTypeNameInNamespace({ typeName, typeNamespace, }) {
|
|
855
|
-
|
|
862
|
+
var _a, _b;
|
|
863
|
+
const complexType = (_a = this.getNamespaceComplexTypeMap(typeNamespace)) === null || _a === void 0 ? void 0 : _a.get(typeName);
|
|
856
864
|
if (complexType) {
|
|
857
865
|
return this.getOutputTypeForComplexType(complexType, typeNamespace);
|
|
858
866
|
}
|
|
859
|
-
const simpleType = this.getNamespaceSimpleTypeMap(typeNamespace)
|
|
867
|
+
const simpleType = (_b = this.getNamespaceSimpleTypeMap(typeNamespace)) === null || _b === void 0 ? void 0 : _b.get(typeName);
|
|
860
868
|
if (simpleType) {
|
|
861
869
|
return this.getTypeForSimpleType(simpleType, typeNamespace);
|
|
862
870
|
}
|
package/esm/SOAPLoader.js
CHANGED
|
@@ -148,13 +148,14 @@ export class SOAPLoader {
|
|
|
148
148
|
return namespaceMessageMap;
|
|
149
149
|
}
|
|
150
150
|
async loadSchema(schemaObj, parentAliasMap = new Map()) {
|
|
151
|
+
var _a, _b;
|
|
151
152
|
const schemaNamespace = schemaObj.attributes.targetNamespace;
|
|
152
153
|
const aliasMap = this.getAliasMapFromAttributes(schemaObj.attributes);
|
|
153
154
|
let typePrefix = this.namespaceTypePrefixMap.get(schemaNamespace);
|
|
154
155
|
if (!typePrefix) {
|
|
155
156
|
typePrefix =
|
|
156
157
|
schemaObj.attributes.id ||
|
|
157
|
-
[...aliasMap.entries()].find(([, namespace]) => namespace === schemaNamespace)
|
|
158
|
+
((_a = [...aliasMap.entries()].find(([, namespace]) => namespace === schemaNamespace)) === null || _a === void 0 ? void 0 : _a[0]);
|
|
158
159
|
this.namespaceTypePrefixMap.set(schemaNamespace, typePrefix);
|
|
159
160
|
}
|
|
160
161
|
for (const [alias, namespace] of parentAliasMap) {
|
|
@@ -206,7 +207,7 @@ export class SOAPLoader {
|
|
|
206
207
|
this.aliasMap.set(simpleType, aliasMap);
|
|
207
208
|
}
|
|
208
209
|
}
|
|
209
|
-
if (elementObj.attributes
|
|
210
|
+
if ((_b = elementObj.attributes) === null || _b === void 0 ? void 0 : _b.type) {
|
|
210
211
|
const [refTypeNamespaceAlias, refTypeName] = elementObj.attributes.type.split(':');
|
|
211
212
|
const refTypeNamespace = aliasMap.get(refTypeNamespaceAlias);
|
|
212
213
|
if (!refTypeNamespace) {
|
|
@@ -423,6 +424,7 @@ export class SOAPLoader {
|
|
|
423
424
|
return aliasMap;
|
|
424
425
|
}
|
|
425
426
|
getTypeForSimpleType(simpleType, simpleTypeNamespace) {
|
|
427
|
+
var _a;
|
|
426
428
|
let simpleTypeTC = this.simpleTypeTCMap.get(simpleType);
|
|
427
429
|
if (!simpleTypeTC) {
|
|
428
430
|
const simpleTypeName = simpleType.attributes.name;
|
|
@@ -457,7 +459,7 @@ export class SOAPLoader {
|
|
|
457
459
|
if (!baseTypeNamespace) {
|
|
458
460
|
throw new Error(`Invalid base type namespace: ${baseTypeNamespaceAlias}`);
|
|
459
461
|
}
|
|
460
|
-
const baseType = this.getNamespaceSimpleTypeMap(baseTypeNamespace)
|
|
462
|
+
const baseType = (_a = this.getNamespaceSimpleTypeMap(baseTypeNamespace)) === null || _a === void 0 ? void 0 : _a.get(baseTypeName);
|
|
461
463
|
if (!baseType) {
|
|
462
464
|
throw new Error(`Simple Type: ${baseTypeName} couldn't be found in ${baseTypeNamespace} needed for ${simpleTypeName}`);
|
|
463
465
|
}
|
|
@@ -468,17 +470,19 @@ export class SOAPLoader {
|
|
|
468
470
|
return simpleTypeTC;
|
|
469
471
|
}
|
|
470
472
|
getInputTypeForTypeNameInNamespace({ typeName, typeNamespace, }) {
|
|
471
|
-
|
|
473
|
+
var _a, _b;
|
|
474
|
+
const complexType = (_a = this.getNamespaceComplexTypeMap(typeNamespace)) === null || _a === void 0 ? void 0 : _a.get(typeName);
|
|
472
475
|
if (complexType) {
|
|
473
476
|
return this.getInputTypeForComplexType(complexType, typeNamespace);
|
|
474
477
|
}
|
|
475
|
-
const simpleType = this.getNamespaceSimpleTypeMap(typeNamespace)
|
|
478
|
+
const simpleType = (_b = this.getNamespaceSimpleTypeMap(typeNamespace)) === null || _b === void 0 ? void 0 : _b.get(typeName);
|
|
476
479
|
if (simpleType) {
|
|
477
480
|
return this.getTypeForSimpleType(simpleType, typeNamespace);
|
|
478
481
|
}
|
|
479
482
|
throw new Error(`Type: ${typeName} couldn't be found in ${typeNamespace}`);
|
|
480
483
|
}
|
|
481
484
|
getInputTypeForComplexType(complexType, complexTypeNamespace) {
|
|
485
|
+
var _a, _b, _c;
|
|
482
486
|
let complexTypeTC = this.complexTypeInputTCMap.get(complexType);
|
|
483
487
|
if (!complexTypeTC) {
|
|
484
488
|
const complexTypeName = complexType.attributes.name;
|
|
@@ -496,9 +500,10 @@ export class SOAPLoader {
|
|
|
496
500
|
if (fieldName) {
|
|
497
501
|
fieldMap[fieldName] = {
|
|
498
502
|
type: () => {
|
|
499
|
-
|
|
500
|
-
const
|
|
501
|
-
const
|
|
503
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
504
|
+
const maxOccurs = ((_a = sequenceOrChoiceObj.attributes) === null || _a === void 0 ? void 0 : _a.maxOccurs) || ((_b = elementObj.attributes) === null || _b === void 0 ? void 0 : _b.maxOccurs);
|
|
505
|
+
const minOccurs = ((_c = sequenceOrChoiceObj.attributes) === null || _c === void 0 ? void 0 : _c.minOccurs) || ((_d = elementObj.attributes) === null || _d === void 0 ? void 0 : _d.minOccurs);
|
|
506
|
+
const nillable = ((_e = sequenceOrChoiceObj.attributes) === null || _e === void 0 ? void 0 : _e.nillable) || ((_f = elementObj.attributes) === null || _f === void 0 ? void 0 : _f.nillable);
|
|
502
507
|
const isPlural = maxOccurs != null && maxOccurs !== '1';
|
|
503
508
|
let isNullable = false;
|
|
504
509
|
if (minOccurs == null || minOccurs === '0') {
|
|
@@ -510,7 +515,7 @@ export class SOAPLoader {
|
|
|
510
515
|
if (nillable === 'false') {
|
|
511
516
|
isNullable = false;
|
|
512
517
|
}
|
|
513
|
-
if (elementObj.attributes
|
|
518
|
+
if ((_g = elementObj.attributes) === null || _g === void 0 ? void 0 : _g.type) {
|
|
514
519
|
const [typeNamespaceAlias, typeName] = elementObj.attributes.type.split(':');
|
|
515
520
|
let typeNamespace;
|
|
516
521
|
if (elementObj.attributes[typeNamespaceAlias]) {
|
|
@@ -579,7 +584,7 @@ export class SOAPLoader {
|
|
|
579
584
|
};
|
|
580
585
|
}
|
|
581
586
|
else {
|
|
582
|
-
if (elementObj.attributes
|
|
587
|
+
if ((_a = elementObj.attributes) === null || _a === void 0 ? void 0 : _a.ref) {
|
|
583
588
|
console.warn(`element.ref isn't supported yet.`);
|
|
584
589
|
}
|
|
585
590
|
else {
|
|
@@ -590,7 +595,7 @@ export class SOAPLoader {
|
|
|
590
595
|
}
|
|
591
596
|
if (sequenceOrChoiceObj.any) {
|
|
592
597
|
for (const anyObj of sequenceOrChoiceObj.any) {
|
|
593
|
-
const anyNamespace = anyObj.attributes
|
|
598
|
+
const anyNamespace = (_b = anyObj.attributes) === null || _b === void 0 ? void 0 : _b.namespace;
|
|
594
599
|
if (anyNamespace) {
|
|
595
600
|
const anyTypeTC = this.getInputTypeForTypeNameInNamespace({
|
|
596
601
|
typeName: complexTypeName,
|
|
@@ -619,7 +624,7 @@ export class SOAPLoader {
|
|
|
619
624
|
if (!baseTypeNamespace) {
|
|
620
625
|
throw new Error(`Namespace alias: ${baseTypeNamespaceAlias} is undefined!`);
|
|
621
626
|
}
|
|
622
|
-
const baseType = this.getNamespaceComplexTypeMap(baseTypeNamespace)
|
|
627
|
+
const baseType = (_c = this.getNamespaceComplexTypeMap(baseTypeNamespace)) === null || _c === void 0 ? void 0 : _c.get(baseTypeName);
|
|
623
628
|
if (!baseType) {
|
|
624
629
|
throw new Error(`Complex Type: ${baseTypeName} couldn't be found in ${baseTypeNamespace} needed for ${complexTypeName}`);
|
|
625
630
|
}
|
|
@@ -664,7 +669,8 @@ export class SOAPLoader {
|
|
|
664
669
|
return complexTypeTC;
|
|
665
670
|
}
|
|
666
671
|
getOutputFieldTypeFromElement(elementObj, aliasMap, namespace) {
|
|
667
|
-
|
|
672
|
+
var _a;
|
|
673
|
+
if ((_a = elementObj.attributes) === null || _a === void 0 ? void 0 : _a.type) {
|
|
668
674
|
const [typeNamespaceAlias, typeName] = elementObj.attributes.type.split(':');
|
|
669
675
|
let typeNamespace;
|
|
670
676
|
if (elementObj.attributes[typeNamespaceAlias]) {
|
|
@@ -709,6 +715,7 @@ export class SOAPLoader {
|
|
|
709
715
|
throw new Error(`Invalid element type definition: ${elementObj.attributes.name}`);
|
|
710
716
|
}
|
|
711
717
|
getOutputTypeForComplexType(complexType, complexTypeNamespace) {
|
|
718
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
712
719
|
let complexTypeTC = this.complexTypeOutputTCMap.get(complexType);
|
|
713
720
|
if (!complexTypeTC) {
|
|
714
721
|
const complexTypeName = complexType.attributes.name;
|
|
@@ -724,9 +731,9 @@ export class SOAPLoader {
|
|
|
724
731
|
for (const elementObj of choiceOrSequenceObj.element) {
|
|
725
732
|
const fieldName = elementObj.attributes.name;
|
|
726
733
|
if (fieldName) {
|
|
727
|
-
const maxOccurs = choiceOrSequenceObj.attributes
|
|
728
|
-
const minOccurs = choiceOrSequenceObj.attributes
|
|
729
|
-
const nillable = choiceOrSequenceObj.attributes
|
|
734
|
+
const maxOccurs = ((_a = choiceOrSequenceObj.attributes) === null || _a === void 0 ? void 0 : _a.maxOccurs) || ((_b = elementObj.attributes) === null || _b === void 0 ? void 0 : _b.maxOccurs);
|
|
735
|
+
const minOccurs = ((_c = choiceOrSequenceObj.attributes) === null || _c === void 0 ? void 0 : _c.minOccurs) || ((_d = elementObj.attributes) === null || _d === void 0 ? void 0 : _d.minOccurs);
|
|
736
|
+
const nillable = ((_e = choiceOrSequenceObj.attributes) === null || _e === void 0 ? void 0 : _e.nillable) || ((_f = elementObj.attributes) === null || _f === void 0 ? void 0 : _f.nillable);
|
|
730
737
|
const isPlural = maxOccurs != null && maxOccurs !== '1';
|
|
731
738
|
let isNullable = false;
|
|
732
739
|
if (minOccurs == null || minOccurs === '0') {
|
|
@@ -752,8 +759,8 @@ export class SOAPLoader {
|
|
|
752
759
|
};
|
|
753
760
|
}
|
|
754
761
|
else {
|
|
755
|
-
if (elementObj.attributes
|
|
756
|
-
console.warn(`element.ref isn't supported yet.`, elementObj.attributes
|
|
762
|
+
if ((_g = elementObj.attributes) === null || _g === void 0 ? void 0 : _g.ref) {
|
|
763
|
+
console.warn(`element.ref isn't supported yet.`, (_h = elementObj.attributes) === null || _h === void 0 ? void 0 : _h.ref);
|
|
757
764
|
}
|
|
758
765
|
else {
|
|
759
766
|
console.warn(`Element doesn't have a name in ${complexTypeName}. Ignoring...`);
|
|
@@ -763,7 +770,7 @@ export class SOAPLoader {
|
|
|
763
770
|
}
|
|
764
771
|
if (choiceOrSequenceObj.any) {
|
|
765
772
|
for (const anyObj of choiceOrSequenceObj.any) {
|
|
766
|
-
const anyNamespace = anyObj.attributes
|
|
773
|
+
const anyNamespace = (_j = anyObj.attributes) === null || _j === void 0 ? void 0 : _j.namespace;
|
|
767
774
|
if (anyNamespace) {
|
|
768
775
|
const anyTypeTC = this.getOutputTypeForTypeNameInNamespace({
|
|
769
776
|
typeName: complexTypeName,
|
|
@@ -787,7 +794,7 @@ export class SOAPLoader {
|
|
|
787
794
|
if (!baseTypeNamespace) {
|
|
788
795
|
throw new Error(`Namespace alias: ${baseTypeNamespaceAlias} is undefined!`);
|
|
789
796
|
}
|
|
790
|
-
const baseType = this.getNamespaceComplexTypeMap(baseTypeNamespace)
|
|
797
|
+
const baseType = (_k = this.getNamespaceComplexTypeMap(baseTypeNamespace)) === null || _k === void 0 ? void 0 : _k.get(baseTypeName);
|
|
791
798
|
if (!baseType) {
|
|
792
799
|
throw new Error(`Complex Type: ${baseTypeName} couldn't be found in ${baseTypeNamespace} needed for ${complexTypeName}`);
|
|
793
800
|
}
|
|
@@ -804,9 +811,9 @@ export class SOAPLoader {
|
|
|
804
811
|
for (const choiceOrSequenceObj of choiceOrSequenceObjects) {
|
|
805
812
|
for (const elementObj of choiceOrSequenceObj.element) {
|
|
806
813
|
const fieldName = elementObj.attributes.name;
|
|
807
|
-
const maxOccurs = choiceOrSequenceObj.attributes
|
|
808
|
-
const minOccurs = choiceOrSequenceObj.attributes
|
|
809
|
-
const nillable = choiceOrSequenceObj.attributes
|
|
814
|
+
const maxOccurs = ((_l = choiceOrSequenceObj.attributes) === null || _l === void 0 ? void 0 : _l.maxOccurs) || ((_m = elementObj.attributes) === null || _m === void 0 ? void 0 : _m.maxOccurs);
|
|
815
|
+
const minOccurs = ((_o = choiceOrSequenceObj.attributes) === null || _o === void 0 ? void 0 : _o.minOccurs) || ((_p = elementObj.attributes) === null || _p === void 0 ? void 0 : _p.minOccurs);
|
|
816
|
+
const nillable = ((_q = choiceOrSequenceObj.attributes) === null || _q === void 0 ? void 0 : _q.nillable) || ((_r = elementObj.attributes) === null || _r === void 0 ? void 0 : _r.nillable);
|
|
810
817
|
const isPlural = maxOccurs != null && maxOccurs !== '1';
|
|
811
818
|
let isNullable = false;
|
|
812
819
|
if (minOccurs == null || minOccurs === '0') {
|
|
@@ -849,11 +856,12 @@ export class SOAPLoader {
|
|
|
849
856
|
return complexTypeTC;
|
|
850
857
|
}
|
|
851
858
|
getOutputTypeForTypeNameInNamespace({ typeName, typeNamespace, }) {
|
|
852
|
-
|
|
859
|
+
var _a, _b;
|
|
860
|
+
const complexType = (_a = this.getNamespaceComplexTypeMap(typeNamespace)) === null || _a === void 0 ? void 0 : _a.get(typeName);
|
|
853
861
|
if (complexType) {
|
|
854
862
|
return this.getOutputTypeForComplexType(complexType, typeNamespace);
|
|
855
863
|
}
|
|
856
|
-
const simpleType = this.getNamespaceSimpleTypeMap(typeNamespace)
|
|
864
|
+
const simpleType = (_b = this.getNamespaceSimpleTypeMap(typeNamespace)) === null || _b === void 0 ? void 0 : _b.get(typeName);
|
|
857
865
|
if (simpleType) {
|
|
858
866
|
return this.getTypeForSimpleType(simpleType, typeNamespace);
|
|
859
867
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omnigraph/soap",
|
|
3
|
-
"version": "1.0.0-alpha-
|
|
3
|
+
"version": "1.0.0-alpha-20230523160518-5443a1139",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@graphql-mesh/types": "1.0.0-alpha-
|
|
7
|
-
"@graphql-mesh/utils": "1.0.0-alpha-
|
|
6
|
+
"@graphql-mesh/types": "1.0.0-alpha-20230523160518-5443a1139",
|
|
7
|
+
"@graphql-mesh/utils": "1.0.0-alpha-20230523160518-5443a1139",
|
|
8
8
|
"@graphql-tools/utils": "^9.2.1",
|
|
9
9
|
"graphql": "*"
|
|
10
10
|
},
|
|
@@ -14,9 +14,6 @@
|
|
|
14
14
|
"graphql-scalars": "^1.20.4"
|
|
15
15
|
},
|
|
16
16
|
"license": "MIT",
|
|
17
|
-
"engines": {
|
|
18
|
-
"node": ">=16.0.0"
|
|
19
|
-
},
|
|
20
17
|
"main": "cjs/index.js",
|
|
21
18
|
"module": "esm/index.js",
|
|
22
19
|
"typings": "typings/index.d.ts",
|