soap 0.45.0 → 1.0.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/History.md +7 -0
- package/Readme.md +12 -0
- package/lib/client.d.ts +1 -0
- package/lib/client.js +168 -187
- package/lib/client.js.map +1 -1
- package/lib/http.d.ts +1 -0
- package/lib/http.js +91 -101
- package/lib/http.js.map +1 -1
- package/lib/nscontext.js +38 -40
- package/lib/nscontext.js.map +1 -1
- package/lib/security/BasicAuthSecurity.js +11 -12
- package/lib/security/BasicAuthSecurity.js.map +1 -1
- package/lib/security/BearerSecurity.js +11 -12
- package/lib/security/BearerSecurity.js.map +1 -1
- package/lib/security/ClientSSLSecurity.js +12 -13
- package/lib/security/ClientSSLSecurity.js.map +1 -1
- package/lib/security/ClientSSLSecurityPFX.js +11 -12
- package/lib/security/ClientSSLSecurityPFX.js.map +1 -1
- package/lib/security/NTLMSecurity.js +12 -13
- package/lib/security/NTLMSecurity.js.map +1 -1
- package/lib/security/WSSecurity.js +21 -22
- package/lib/security/WSSecurity.js.map +1 -1
- package/lib/security/WSSecurityCert.d.ts +1 -0
- package/lib/security/WSSecurityCert.js +74 -56
- package/lib/security/WSSecurityCert.js.map +1 -1
- package/lib/security/WSSecurityPlusCert.d.ts +9 -0
- package/lib/security/WSSecurityPlusCert.js +17 -0
- package/lib/security/WSSecurityPlusCert.js.map +1 -0
- package/lib/security/index.d.ts +1 -0
- package/lib/security/index.js +8 -3
- package/lib/security/index.js.map +1 -1
- package/lib/server.d.ts +1 -0
- package/lib/server.js +189 -209
- package/lib/server.js.map +1 -1
- package/lib/soap.d.ts +1 -1
- package/lib/soap.js +45 -40
- package/lib/soap.js.map +1 -1
- package/lib/types.d.ts +1 -0
- package/lib/types.js +1 -1
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js +55 -53
- package/lib/utils.js.map +1 -1
- package/lib/wsdl/elements.js +393 -515
- package/lib/wsdl/elements.js.map +1 -1
- package/lib/wsdl/index.js +322 -322
- package/lib/wsdl/index.js.map +1 -1
- package/package.json +8 -7
- package/tsconfig.json +2 -1
package/lib/wsdl/elements.js
CHANGED
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
exports.__esModule = true;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
3
|
exports.ImportElement = exports.IncludeElement = exports.BodyElement = exports.DefinitionsElement = exports.ServiceElement = exports.PortElement = exports.BindingElement = exports.PortTypeElement = exports.OperationElement = exports.TypesElement = exports.SchemaElement = exports.DocumentationElement = exports.MessageElement = exports.AllElement = exports.SequenceElement = exports.SimpleContentElement = exports.ComplexContentElement = exports.ComplexTypeElement = exports.EnumerationElement = exports.ChoiceElement = exports.ExtensionElement = exports.RestrictionElement = exports.SimpleTypeElement = exports.OutputElement = exports.InputElement = exports.AnyElement = exports.ElementElement = exports.Element = void 0;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
4
|
+
const assert_1 = require("assert");
|
|
5
|
+
const debugBuilder = require("debug");
|
|
6
|
+
const _ = require("lodash");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
const debug = debugBuilder('node-soap');
|
|
9
|
+
const Primitives = {
|
|
23
10
|
string: 1,
|
|
24
11
|
boolean: 1,
|
|
25
12
|
decimal: 1,
|
|
@@ -51,13 +38,13 @@ var Primitives = {
|
|
|
51
38
|
base64Binary: 0,
|
|
52
39
|
anyURI: 0,
|
|
53
40
|
QName: 0,
|
|
54
|
-
NOTATION: 0
|
|
41
|
+
NOTATION: 0,
|
|
55
42
|
};
|
|
56
|
-
|
|
57
|
-
|
|
43
|
+
class Element {
|
|
44
|
+
constructor(nsName, attrs, options, schemaAttrs) {
|
|
58
45
|
this.allowedChildren = {};
|
|
59
46
|
this.children = [];
|
|
60
|
-
|
|
47
|
+
const parts = (0, utils_1.splitQName)(nsName);
|
|
61
48
|
this.nsName = nsName;
|
|
62
49
|
this.prefix = parts.prefix;
|
|
63
50
|
this.name = parts.name;
|
|
@@ -65,8 +52,8 @@ var Element = /** @class */ (function () {
|
|
|
65
52
|
this.xmlns = {};
|
|
66
53
|
this.schemaXmlns = {};
|
|
67
54
|
this._initializeOptions(options);
|
|
68
|
-
for (
|
|
69
|
-
|
|
55
|
+
for (const key in attrs) {
|
|
56
|
+
const match = /^xmlns:?(.*)$/.exec(key);
|
|
70
57
|
if (match) {
|
|
71
58
|
this.xmlns[match[1] ? match[1] : utils_1.TNS_PREFIX] = attrs[key];
|
|
72
59
|
}
|
|
@@ -79,8 +66,8 @@ var Element = /** @class */ (function () {
|
|
|
79
66
|
}
|
|
80
67
|
}
|
|
81
68
|
}
|
|
82
|
-
for (
|
|
83
|
-
|
|
69
|
+
for (const schemaKey in schemaAttrs) {
|
|
70
|
+
const schemaMatch = /^xmlns:?(.*)$/.exec(schemaKey);
|
|
84
71
|
if (schemaMatch && schemaMatch[1]) {
|
|
85
72
|
this.schemaXmlns[schemaMatch[1]] = schemaAttrs[schemaKey];
|
|
86
73
|
}
|
|
@@ -91,54 +78,54 @@ var Element = /** @class */ (function () {
|
|
|
91
78
|
}
|
|
92
79
|
this.init();
|
|
93
80
|
}
|
|
94
|
-
|
|
81
|
+
deleteFixedAttrs() {
|
|
95
82
|
this.children && this.children.length === 0 && delete this.children;
|
|
96
83
|
this.xmlns && Object.keys(this.xmlns).length === 0 && delete this.xmlns;
|
|
97
84
|
delete this.nsName;
|
|
98
85
|
delete this.prefix;
|
|
99
86
|
delete this.name;
|
|
100
|
-
}
|
|
101
|
-
|
|
87
|
+
}
|
|
88
|
+
startElement(stack, nsName, attrs, options, schemaXmlns) {
|
|
102
89
|
if (!this.allowedChildren) {
|
|
103
90
|
return;
|
|
104
91
|
}
|
|
105
|
-
|
|
92
|
+
const ChildClass = this.allowedChildren[(0, utils_1.splitQName)(nsName).name];
|
|
106
93
|
if (ChildClass) {
|
|
107
|
-
|
|
94
|
+
const child = new ChildClass(nsName, attrs, options, schemaXmlns);
|
|
108
95
|
child.init();
|
|
109
96
|
stack.push(child);
|
|
110
97
|
}
|
|
111
98
|
else {
|
|
112
99
|
this.unexpected(nsName);
|
|
113
100
|
}
|
|
114
|
-
}
|
|
115
|
-
|
|
101
|
+
}
|
|
102
|
+
endElement(stack, nsName) {
|
|
116
103
|
if (this.nsName === nsName) {
|
|
117
104
|
if (stack.length < 2) {
|
|
118
105
|
return;
|
|
119
106
|
}
|
|
120
|
-
|
|
107
|
+
const parent = stack[stack.length - 2];
|
|
121
108
|
if (this !== stack[0]) {
|
|
122
109
|
_.defaultsDeep(stack[0].xmlns, this.xmlns);
|
|
123
110
|
// delete this.xmlns;
|
|
124
|
-
|
|
125
|
-
|
|
111
|
+
parent.children.push(this);
|
|
112
|
+
parent.addChild(this);
|
|
126
113
|
}
|
|
127
114
|
stack.pop();
|
|
128
115
|
}
|
|
129
|
-
}
|
|
130
|
-
|
|
116
|
+
}
|
|
117
|
+
addChild(child) {
|
|
131
118
|
return;
|
|
132
|
-
}
|
|
133
|
-
|
|
119
|
+
}
|
|
120
|
+
unexpected(name) {
|
|
134
121
|
throw new Error('Found unexpected element (' + name + ') inside ' + this.nsName);
|
|
135
|
-
}
|
|
136
|
-
|
|
122
|
+
}
|
|
123
|
+
description(definitions, xmlns) {
|
|
137
124
|
return this.$name || this.name;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
125
|
+
}
|
|
126
|
+
init() {
|
|
127
|
+
}
|
|
128
|
+
_initializeOptions(options) {
|
|
142
129
|
if (options) {
|
|
143
130
|
this.valueKey = options.valueKey || '$value';
|
|
144
131
|
this.xmlKey = options.xmlKey || '$xml';
|
|
@@ -149,28 +136,25 @@ var Element = /** @class */ (function () {
|
|
|
149
136
|
this.xmlKey = '$xml';
|
|
150
137
|
this.ignoredNamespaces = [];
|
|
151
138
|
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
}());
|
|
139
|
+
}
|
|
140
|
+
}
|
|
155
141
|
exports.Element = Element;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
_this.allowedChildren = buildAllowedChildren([
|
|
142
|
+
class ElementElement extends Element {
|
|
143
|
+
constructor() {
|
|
144
|
+
super(...arguments);
|
|
145
|
+
this.allowedChildren = buildAllowedChildren([
|
|
161
146
|
'annotation',
|
|
162
147
|
'complexType',
|
|
163
148
|
'simpleType',
|
|
164
149
|
]);
|
|
165
|
-
return _this;
|
|
166
150
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
151
|
+
description(definitions, xmlns) {
|
|
152
|
+
let element = {};
|
|
153
|
+
let name = this.$name;
|
|
170
154
|
// Check minOccurs / maxOccurs attributes to see if this element is a list
|
|
171
155
|
// These are default values for an element
|
|
172
|
-
|
|
173
|
-
|
|
156
|
+
let minOccurs = 1;
|
|
157
|
+
let maxOccurs = 1;
|
|
174
158
|
if (this.$maxOccurs === 'unbounded') {
|
|
175
159
|
maxOccurs = Infinity;
|
|
176
160
|
}
|
|
@@ -180,50 +164,50 @@ var ElementElement = /** @class */ (function (_super) {
|
|
|
180
164
|
if (Boolean(this.$minOccurs)) {
|
|
181
165
|
minOccurs = parseInt(this.$minOccurs, 10);
|
|
182
166
|
}
|
|
183
|
-
|
|
167
|
+
const isMany = maxOccurs > 1;
|
|
184
168
|
if (isMany) {
|
|
185
169
|
name += '[]';
|
|
186
170
|
}
|
|
187
171
|
if (xmlns && xmlns[utils_1.TNS_PREFIX]) {
|
|
188
172
|
this.$targetNamespace = xmlns[utils_1.TNS_PREFIX];
|
|
189
173
|
}
|
|
190
|
-
|
|
174
|
+
let type = this.$type || this.$ref;
|
|
191
175
|
if (type) {
|
|
192
|
-
type = utils_1.splitQName(type);
|
|
193
|
-
|
|
194
|
-
|
|
176
|
+
type = (0, utils_1.splitQName)(type);
|
|
177
|
+
const typeName = type.name;
|
|
178
|
+
const ns = xmlns && xmlns[type.prefix] ||
|
|
195
179
|
((definitions.xmlns[type.prefix] !== undefined || definitions.xmlns[this.targetNSAlias] !== undefined) && this.schemaXmlns[type.prefix]) ||
|
|
196
180
|
definitions.xmlns[type.prefix];
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
181
|
+
const schema = definitions.schemas[ns];
|
|
182
|
+
const typeElement = schema && (this.$type ? schema.complexTypes[typeName] || schema.types[typeName] : schema.elements[typeName]);
|
|
183
|
+
const typeStorage = this.$type ? definitions.descriptions.types : definitions.descriptions.elements;
|
|
200
184
|
if (ns && definitions.schemas[ns]) {
|
|
201
185
|
xmlns = definitions.schemas[ns].xmlns;
|
|
202
186
|
}
|
|
203
187
|
if (typeElement && !(typeName in Primitives)) {
|
|
204
188
|
if (!(typeName in typeStorage)) {
|
|
205
|
-
|
|
206
|
-
typeStorage[typeName] =
|
|
207
|
-
|
|
208
|
-
if (typeof
|
|
209
|
-
|
|
189
|
+
let elem = {};
|
|
190
|
+
typeStorage[typeName] = elem;
|
|
191
|
+
const description = typeElement.description(definitions, xmlns);
|
|
192
|
+
if (typeof description === 'string') {
|
|
193
|
+
elem = description;
|
|
210
194
|
}
|
|
211
195
|
else {
|
|
212
|
-
Object.keys(
|
|
213
|
-
|
|
196
|
+
Object.keys(description).forEach((key) => {
|
|
197
|
+
elem[key] = description[key];
|
|
214
198
|
});
|
|
215
199
|
}
|
|
216
200
|
if (this.$ref) {
|
|
217
|
-
element =
|
|
201
|
+
element = elem;
|
|
218
202
|
}
|
|
219
203
|
else {
|
|
220
|
-
element[name] =
|
|
204
|
+
element[name] = elem;
|
|
221
205
|
}
|
|
222
|
-
if (typeof
|
|
223
|
-
|
|
224
|
-
|
|
206
|
+
if (typeof elem === 'object') {
|
|
207
|
+
elem.targetNSAlias = type.prefix;
|
|
208
|
+
elem.targetNamespace = ns;
|
|
225
209
|
}
|
|
226
|
-
typeStorage[typeName] =
|
|
210
|
+
typeStorage[typeName] = elem;
|
|
227
211
|
}
|
|
228
212
|
else {
|
|
229
213
|
if (this.$ref) {
|
|
@@ -239,41 +223,32 @@ var ElementElement = /** @class */ (function (_super) {
|
|
|
239
223
|
}
|
|
240
224
|
}
|
|
241
225
|
else {
|
|
242
|
-
|
|
226
|
+
const children = this.children;
|
|
243
227
|
element[name] = {};
|
|
244
|
-
for (
|
|
245
|
-
var child = children_1[_i];
|
|
228
|
+
for (const child of children) {
|
|
246
229
|
if (child instanceof ComplexTypeElement || child instanceof SimpleTypeElement) {
|
|
247
230
|
element[name] = child.description(definitions, xmlns);
|
|
248
231
|
}
|
|
249
232
|
}
|
|
250
233
|
}
|
|
251
234
|
return element;
|
|
252
|
-
};
|
|
253
|
-
return ElementElement;
|
|
254
|
-
}(Element));
|
|
255
|
-
exports.ElementElement = ElementElement;
|
|
256
|
-
var AnyElement = /** @class */ (function (_super) {
|
|
257
|
-
__extends(AnyElement, _super);
|
|
258
|
-
function AnyElement() {
|
|
259
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
260
235
|
}
|
|
261
|
-
|
|
262
|
-
|
|
236
|
+
}
|
|
237
|
+
exports.ElementElement = ElementElement;
|
|
238
|
+
class AnyElement extends Element {
|
|
239
|
+
}
|
|
263
240
|
exports.AnyElement = AnyElement;
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
_this.allowedChildren = buildAllowedChildren([
|
|
241
|
+
class InputElement extends Element {
|
|
242
|
+
constructor() {
|
|
243
|
+
super(...arguments);
|
|
244
|
+
this.allowedChildren = buildAllowedChildren([
|
|
269
245
|
'body',
|
|
270
246
|
'documentation',
|
|
271
247
|
'header',
|
|
272
248
|
'SecuritySpecRef',
|
|
273
249
|
]);
|
|
274
|
-
return _this;
|
|
275
250
|
}
|
|
276
|
-
|
|
251
|
+
addChild(child) {
|
|
277
252
|
if (child instanceof BodyElement) {
|
|
278
253
|
this.use = child.$use;
|
|
279
254
|
if (this.use === 'encoded') {
|
|
@@ -281,23 +256,20 @@ var InputElement = /** @class */ (function (_super) {
|
|
|
281
256
|
}
|
|
282
257
|
this.children.pop();
|
|
283
258
|
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
}(Element));
|
|
259
|
+
}
|
|
260
|
+
}
|
|
287
261
|
exports.InputElement = InputElement;
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
_this.allowedChildren = buildAllowedChildren([
|
|
262
|
+
class OutputElement extends Element {
|
|
263
|
+
constructor() {
|
|
264
|
+
super(...arguments);
|
|
265
|
+
this.allowedChildren = buildAllowedChildren([
|
|
293
266
|
'body',
|
|
294
267
|
'documentation',
|
|
295
268
|
'header',
|
|
296
269
|
'SecuritySpecRef',
|
|
297
270
|
]);
|
|
298
|
-
return _this;
|
|
299
271
|
}
|
|
300
|
-
|
|
272
|
+
addChild(child) {
|
|
301
273
|
if (child instanceof BodyElement) {
|
|
302
274
|
this.use = child.$use;
|
|
303
275
|
if (this.use === 'encoded') {
|
|
@@ -305,158 +277,136 @@ var OutputElement = /** @class */ (function (_super) {
|
|
|
305
277
|
}
|
|
306
278
|
this.children.pop();
|
|
307
279
|
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
}(Element));
|
|
280
|
+
}
|
|
281
|
+
}
|
|
311
282
|
exports.OutputElement = OutputElement;
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
_this.allowedChildren = buildAllowedChildren([
|
|
283
|
+
class SimpleTypeElement extends Element {
|
|
284
|
+
constructor() {
|
|
285
|
+
super(...arguments);
|
|
286
|
+
this.allowedChildren = buildAllowedChildren([
|
|
317
287
|
'restriction',
|
|
318
288
|
]);
|
|
319
|
-
return _this;
|
|
320
289
|
}
|
|
321
|
-
|
|
322
|
-
for (
|
|
323
|
-
var child = _a[_i];
|
|
290
|
+
description(definitions) {
|
|
291
|
+
for (const child of this.children) {
|
|
324
292
|
if (child instanceof RestrictionElement) {
|
|
325
293
|
return [this.$name, child.description()].filter(Boolean).join('|');
|
|
326
294
|
}
|
|
327
295
|
}
|
|
328
296
|
return {};
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
}(Element));
|
|
297
|
+
}
|
|
298
|
+
}
|
|
332
299
|
exports.SimpleTypeElement = SimpleTypeElement;
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
_this.allowedChildren = buildAllowedChildren([
|
|
300
|
+
class RestrictionElement extends Element {
|
|
301
|
+
constructor() {
|
|
302
|
+
super(...arguments);
|
|
303
|
+
this.allowedChildren = buildAllowedChildren([
|
|
338
304
|
'all',
|
|
339
305
|
'choice',
|
|
340
306
|
'enumeration',
|
|
341
307
|
'sequence',
|
|
342
308
|
]);
|
|
343
|
-
return _this;
|
|
344
309
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
for (
|
|
310
|
+
description(definitions, xmlns) {
|
|
311
|
+
const children = this.children;
|
|
312
|
+
let desc;
|
|
313
|
+
for (let i = 0, child; child = children[i]; i++) {
|
|
349
314
|
if (child instanceof SequenceElement || child instanceof ChoiceElement) {
|
|
350
315
|
desc = child.description(definitions, xmlns);
|
|
351
316
|
break;
|
|
352
317
|
}
|
|
353
318
|
}
|
|
354
319
|
if (desc && this.$base) {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
desc.getBase =
|
|
361
|
-
return
|
|
320
|
+
const type = (0, utils_1.splitQName)(this.$base);
|
|
321
|
+
const typeName = type.name;
|
|
322
|
+
const ns = xmlns && xmlns[type.prefix] || definitions.xmlns[type.prefix];
|
|
323
|
+
const schema = definitions.schemas[ns];
|
|
324
|
+
const typeElement = schema && (schema.complexTypes[typeName] || schema.types[typeName] || schema.elements[typeName]);
|
|
325
|
+
desc.getBase = () => {
|
|
326
|
+
return typeElement.description(definitions, schema.xmlns);
|
|
362
327
|
};
|
|
363
328
|
return desc;
|
|
364
329
|
}
|
|
365
330
|
// then simple element
|
|
366
|
-
|
|
367
|
-
|
|
331
|
+
const base = this.$base ? this.$base + '|' : '';
|
|
332
|
+
const restrictions = this.children.map((child) => {
|
|
368
333
|
return child.description();
|
|
369
334
|
}).join(',');
|
|
370
335
|
return [this.$base, restrictions].filter(Boolean).join('|');
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
}(Element));
|
|
336
|
+
}
|
|
337
|
+
}
|
|
374
338
|
exports.RestrictionElement = RestrictionElement;
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
_this.allowedChildren = buildAllowedChildren([
|
|
339
|
+
class ExtensionElement extends Element {
|
|
340
|
+
constructor() {
|
|
341
|
+
super(...arguments);
|
|
342
|
+
this.allowedChildren = buildAllowedChildren([
|
|
380
343
|
'all',
|
|
381
344
|
'choice',
|
|
382
345
|
'sequence',
|
|
383
346
|
]);
|
|
384
|
-
return _this;
|
|
385
347
|
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
for (
|
|
389
|
-
var child = _a[_i];
|
|
348
|
+
description(definitions, xmlns) {
|
|
349
|
+
let desc = {};
|
|
350
|
+
for (const child of this.children) {
|
|
390
351
|
if (child instanceof SequenceElement || child instanceof ChoiceElement) {
|
|
391
352
|
desc = child.description(definitions, xmlns);
|
|
392
353
|
}
|
|
393
354
|
}
|
|
394
355
|
if (this.$base) {
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
356
|
+
const type = (0, utils_1.splitQName)(this.$base);
|
|
357
|
+
const typeName = type.name;
|
|
358
|
+
const ns = xmlns && xmlns[type.prefix] || definitions.xmlns[type.prefix];
|
|
359
|
+
const schema = definitions.schemas[ns];
|
|
399
360
|
if (typeName in Primitives) {
|
|
400
361
|
return this.$base;
|
|
401
362
|
}
|
|
402
363
|
else {
|
|
403
|
-
|
|
364
|
+
const typeElement = schema && (schema.complexTypes[typeName] ||
|
|
404
365
|
schema.types[typeName] ||
|
|
405
366
|
schema.elements[typeName]);
|
|
406
367
|
if (typeElement) {
|
|
407
|
-
|
|
368
|
+
const base = typeElement.description(definitions, schema.xmlns);
|
|
408
369
|
desc = typeof base === 'string' ? base : _.defaults(base, desc);
|
|
409
370
|
}
|
|
410
371
|
}
|
|
411
372
|
}
|
|
412
373
|
return desc;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
}(Element));
|
|
374
|
+
}
|
|
375
|
+
}
|
|
416
376
|
exports.ExtensionElement = ExtensionElement;
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
_this.allowedChildren = buildAllowedChildren([
|
|
377
|
+
class ChoiceElement extends Element {
|
|
378
|
+
constructor() {
|
|
379
|
+
super(...arguments);
|
|
380
|
+
this.allowedChildren = buildAllowedChildren([
|
|
422
381
|
'any',
|
|
423
382
|
'choice',
|
|
424
383
|
'element',
|
|
425
384
|
'sequence',
|
|
426
385
|
]);
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
var description = child.description(definitions, xmlns);
|
|
434
|
-
for (var key in description) {
|
|
386
|
+
}
|
|
387
|
+
description(definitions, xmlns) {
|
|
388
|
+
const choice = {};
|
|
389
|
+
for (const child of this.children) {
|
|
390
|
+
const description = child.description(definitions, xmlns);
|
|
391
|
+
for (const key in description) {
|
|
435
392
|
choice[key] = description[key];
|
|
436
393
|
}
|
|
437
394
|
}
|
|
438
395
|
return choice;
|
|
439
|
-
};
|
|
440
|
-
return ChoiceElement;
|
|
441
|
-
}(Element));
|
|
442
|
-
exports.ChoiceElement = ChoiceElement;
|
|
443
|
-
var EnumerationElement = /** @class */ (function (_super) {
|
|
444
|
-
__extends(EnumerationElement, _super);
|
|
445
|
-
function EnumerationElement() {
|
|
446
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
447
396
|
}
|
|
397
|
+
}
|
|
398
|
+
exports.ChoiceElement = ChoiceElement;
|
|
399
|
+
class EnumerationElement extends Element {
|
|
448
400
|
// no children
|
|
449
|
-
|
|
401
|
+
description() {
|
|
450
402
|
return this[this.valueKey];
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
}(Element));
|
|
403
|
+
}
|
|
404
|
+
}
|
|
454
405
|
exports.EnumerationElement = EnumerationElement;
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
_this.allowedChildren = buildAllowedChildren([
|
|
406
|
+
class ComplexTypeElement extends Element {
|
|
407
|
+
constructor() {
|
|
408
|
+
super(...arguments);
|
|
409
|
+
this.allowedChildren = buildAllowedChildren([
|
|
460
410
|
'all',
|
|
461
411
|
'annotation',
|
|
462
412
|
'choice',
|
|
@@ -464,12 +414,10 @@ var ComplexTypeElement = /** @class */ (function (_super) {
|
|
|
464
414
|
'sequence',
|
|
465
415
|
'simpleContent',
|
|
466
416
|
]);
|
|
467
|
-
return _this;
|
|
468
417
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
for (
|
|
472
|
-
var child = children_2[_i];
|
|
418
|
+
description(definitions, xmlns) {
|
|
419
|
+
const children = this.children || [];
|
|
420
|
+
for (const child of children) {
|
|
473
421
|
if (child instanceof ChoiceElement ||
|
|
474
422
|
child instanceof SequenceElement ||
|
|
475
423
|
child instanceof AllElement ||
|
|
@@ -479,125 +427,105 @@ var ComplexTypeElement = /** @class */ (function (_super) {
|
|
|
479
427
|
}
|
|
480
428
|
}
|
|
481
429
|
return {};
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
}(Element));
|
|
430
|
+
}
|
|
431
|
+
}
|
|
485
432
|
exports.ComplexTypeElement = ComplexTypeElement;
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
_this.allowedChildren = buildAllowedChildren([
|
|
433
|
+
class ComplexContentElement extends Element {
|
|
434
|
+
constructor() {
|
|
435
|
+
super(...arguments);
|
|
436
|
+
this.allowedChildren = buildAllowedChildren([
|
|
491
437
|
'extension',
|
|
492
438
|
]);
|
|
493
|
-
return _this;
|
|
494
439
|
}
|
|
495
|
-
|
|
496
|
-
for (
|
|
497
|
-
var child = _a[_i];
|
|
440
|
+
description(definitions, xmlns) {
|
|
441
|
+
for (const child of this.children) {
|
|
498
442
|
if (child instanceof ExtensionElement) {
|
|
499
443
|
return child.description(definitions, xmlns);
|
|
500
444
|
}
|
|
501
445
|
}
|
|
502
446
|
return {};
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
}(Element));
|
|
447
|
+
}
|
|
448
|
+
}
|
|
506
449
|
exports.ComplexContentElement = ComplexContentElement;
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
_this.allowedChildren = buildAllowedChildren([
|
|
450
|
+
class SimpleContentElement extends Element {
|
|
451
|
+
constructor() {
|
|
452
|
+
super(...arguments);
|
|
453
|
+
this.allowedChildren = buildAllowedChildren([
|
|
512
454
|
'extension',
|
|
513
455
|
]);
|
|
514
|
-
return _this;
|
|
515
456
|
}
|
|
516
|
-
|
|
517
|
-
for (
|
|
518
|
-
var child = _a[_i];
|
|
457
|
+
description(definitions, xmlns) {
|
|
458
|
+
for (const child of this.children) {
|
|
519
459
|
if (child instanceof ExtensionElement) {
|
|
520
460
|
return child.description(definitions, xmlns);
|
|
521
461
|
}
|
|
522
462
|
}
|
|
523
463
|
return {};
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
}(Element));
|
|
464
|
+
}
|
|
465
|
+
}
|
|
527
466
|
exports.SimpleContentElement = SimpleContentElement;
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
_this.allowedChildren = buildAllowedChildren([
|
|
467
|
+
class SequenceElement extends Element {
|
|
468
|
+
constructor() {
|
|
469
|
+
super(...arguments);
|
|
470
|
+
this.allowedChildren = buildAllowedChildren([
|
|
533
471
|
'any',
|
|
534
472
|
'choice',
|
|
535
473
|
'element',
|
|
536
474
|
'sequence',
|
|
537
475
|
]);
|
|
538
|
-
return _this;
|
|
539
476
|
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
for (
|
|
543
|
-
var child = _a[_i];
|
|
477
|
+
description(definitions, xmlns) {
|
|
478
|
+
const sequence = {};
|
|
479
|
+
for (const child of this.children) {
|
|
544
480
|
if (child instanceof AnyElement) {
|
|
545
481
|
continue;
|
|
546
482
|
}
|
|
547
|
-
|
|
548
|
-
for (
|
|
483
|
+
const description = child.description(definitions, xmlns);
|
|
484
|
+
for (const key in description) {
|
|
549
485
|
sequence[key] = description[key];
|
|
550
486
|
}
|
|
551
487
|
}
|
|
552
488
|
return sequence;
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
}(Element));
|
|
489
|
+
}
|
|
490
|
+
}
|
|
556
491
|
exports.SequenceElement = SequenceElement;
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
_this.allowedChildren = buildAllowedChildren([
|
|
492
|
+
class AllElement extends Element {
|
|
493
|
+
constructor() {
|
|
494
|
+
super(...arguments);
|
|
495
|
+
this.allowedChildren = buildAllowedChildren([
|
|
562
496
|
'choice',
|
|
563
497
|
'element',
|
|
564
498
|
]);
|
|
565
|
-
return _this;
|
|
566
499
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
for (
|
|
570
|
-
var child = _a[_i];
|
|
500
|
+
description(definitions, xmlns) {
|
|
501
|
+
const sequence = {};
|
|
502
|
+
for (const child of this.children) {
|
|
571
503
|
if (child instanceof AnyElement) {
|
|
572
504
|
continue;
|
|
573
505
|
}
|
|
574
|
-
|
|
575
|
-
for (
|
|
506
|
+
const description = child.description(definitions, xmlns);
|
|
507
|
+
for (const key in description) {
|
|
576
508
|
sequence[key] = description[key];
|
|
577
509
|
}
|
|
578
510
|
}
|
|
579
511
|
return sequence;
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
}(Element));
|
|
512
|
+
}
|
|
513
|
+
}
|
|
583
514
|
exports.AllElement = AllElement;
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
_this.allowedChildren = buildAllowedChildren([
|
|
515
|
+
class MessageElement extends Element {
|
|
516
|
+
constructor() {
|
|
517
|
+
super(...arguments);
|
|
518
|
+
this.allowedChildren = buildAllowedChildren([
|
|
589
519
|
'part',
|
|
590
520
|
'documentation',
|
|
591
521
|
]);
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
for (var _i = 0, children_3 = children; _i < children_3.length; _i++) {
|
|
600
|
-
var child = children_3[_i];
|
|
522
|
+
this.element = null;
|
|
523
|
+
this.parts = null;
|
|
524
|
+
}
|
|
525
|
+
postProcess(definitions) {
|
|
526
|
+
let part = null;
|
|
527
|
+
const children = this.children || [];
|
|
528
|
+
for (const child of children) {
|
|
601
529
|
if (child.name === 'part') {
|
|
602
530
|
part = child;
|
|
603
531
|
break;
|
|
@@ -607,11 +535,11 @@ var MessageElement = /** @class */ (function (_super) {
|
|
|
607
535
|
return;
|
|
608
536
|
}
|
|
609
537
|
if (part.$element) {
|
|
610
|
-
|
|
538
|
+
let lookupTypes = [];
|
|
611
539
|
delete this.parts;
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
540
|
+
const nsName = (0, utils_1.splitQName)(part.$element);
|
|
541
|
+
const ns = nsName.prefix;
|
|
542
|
+
let schema = definitions.schemas[definitions.xmlns[ns]];
|
|
615
543
|
this.element = schema.elements[nsName.name];
|
|
616
544
|
if (!this.element) {
|
|
617
545
|
debug(nsName.name + ' is not present in wsdl and cannot be processed correctly.');
|
|
@@ -622,11 +550,10 @@ var MessageElement = /** @class */ (function (_super) {
|
|
|
622
550
|
// set the optional $lookupType to be used within `client#_invoke()` when
|
|
623
551
|
// calling `wsdl#objectToDocumentXML()
|
|
624
552
|
this.element.$lookupType = part.$element;
|
|
625
|
-
|
|
553
|
+
const elementChildren = this.element.children;
|
|
626
554
|
// get all nested lookup types (only complex types are followed)
|
|
627
555
|
if (elementChildren.length > 0) {
|
|
628
|
-
for (
|
|
629
|
-
var child = elementChildren_1[_a];
|
|
556
|
+
for (const child of elementChildren) {
|
|
630
557
|
lookupTypes.push(this._getNestedLookupTypeString(child));
|
|
631
558
|
}
|
|
632
559
|
}
|
|
@@ -638,15 +565,15 @@ var MessageElement = /** @class */ (function (_super) {
|
|
|
638
565
|
filter(function removeEmptyLookupTypes(type) {
|
|
639
566
|
return type !== '^';
|
|
640
567
|
});
|
|
641
|
-
|
|
642
|
-
for (
|
|
568
|
+
const schemaXmlns = definitions.schemas[this.element.targetNamespace].xmlns;
|
|
569
|
+
for (let i = 0; i < lookupTypes.length; i++) {
|
|
643
570
|
lookupTypes[i] = this._createLookupTypeObject(lookupTypes[i], schemaXmlns);
|
|
644
571
|
}
|
|
645
572
|
}
|
|
646
573
|
this.element.$lookupTypes = lookupTypes;
|
|
647
574
|
if (this.element.$type) {
|
|
648
|
-
|
|
649
|
-
|
|
575
|
+
const type = (0, utils_1.splitQName)(this.element.$type);
|
|
576
|
+
const typeNs = schema.xmlns && schema.xmlns[type.prefix] || definitions.xmlns[type.prefix];
|
|
650
577
|
if (typeNs) {
|
|
651
578
|
if (type.name in Primitives) {
|
|
652
579
|
// this.element = this.element.$type;
|
|
@@ -654,7 +581,7 @@ var MessageElement = /** @class */ (function (_super) {
|
|
|
654
581
|
else {
|
|
655
582
|
// first check local mapping of ns alias to namespace
|
|
656
583
|
schema = definitions.schemas[typeNs];
|
|
657
|
-
|
|
584
|
+
const ctype = schema.complexTypes[type.name] || schema.types[type.name] || schema.elements[type.name];
|
|
658
585
|
if (ctype) {
|
|
659
586
|
this.parts = ctype.description(definitions, schema.xmlns);
|
|
660
587
|
}
|
|
@@ -662,7 +589,7 @@ var MessageElement = /** @class */ (function (_super) {
|
|
|
662
589
|
}
|
|
663
590
|
}
|
|
664
591
|
else {
|
|
665
|
-
|
|
592
|
+
const method = this.element.description(definitions, schema.xmlns);
|
|
666
593
|
this.parts = method[nsName.name];
|
|
667
594
|
}
|
|
668
595
|
this.children.splice(0, 1);
|
|
@@ -671,16 +598,16 @@ var MessageElement = /** @class */ (function (_super) {
|
|
|
671
598
|
// rpc encoding
|
|
672
599
|
this.parts = {};
|
|
673
600
|
delete this.element;
|
|
674
|
-
for (
|
|
601
|
+
for (let i = 0; part = this.children[i]; i++) {
|
|
675
602
|
if (part.name === 'documentation') {
|
|
676
603
|
// <wsdl:documentation can be present under <wsdl:message>
|
|
677
604
|
continue;
|
|
678
605
|
}
|
|
679
|
-
assert_1.ok(part.name === 'part', 'Expected part element');
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
606
|
+
(0, assert_1.ok)(part.name === 'part', 'Expected part element');
|
|
607
|
+
const nsName = (0, utils_1.splitQName)(part.$type);
|
|
608
|
+
const ns = definitions.xmlns[nsName.prefix];
|
|
609
|
+
const type = nsName.name;
|
|
610
|
+
const schemaDefinition = definitions.schemas[ns];
|
|
684
611
|
if (typeof schemaDefinition !== 'undefined') {
|
|
685
612
|
this.parts[part.$name] = definitions.schemas[ns].types[type] || definitions.schemas[ns].complexTypes[type];
|
|
686
613
|
}
|
|
@@ -695,15 +622,15 @@ var MessageElement = /** @class */ (function (_super) {
|
|
|
695
622
|
}
|
|
696
623
|
}
|
|
697
624
|
this.deleteFixedAttrs();
|
|
698
|
-
}
|
|
699
|
-
|
|
625
|
+
}
|
|
626
|
+
description(definitions) {
|
|
700
627
|
if (this.element) {
|
|
701
628
|
return this.element && this.element.description(definitions);
|
|
702
629
|
}
|
|
703
|
-
|
|
630
|
+
const desc = {};
|
|
704
631
|
desc[this.$name] = this.parts;
|
|
705
632
|
return desc;
|
|
706
|
-
}
|
|
633
|
+
}
|
|
707
634
|
/**
|
|
708
635
|
* Takes a given namespaced String(for example: 'alias:property') and creates a lookupType
|
|
709
636
|
* object for further use in as first (lookup) `parameterTypeObj` within the `objectToXML`
|
|
@@ -715,18 +642,18 @@ var MessageElement = /** @class */ (function (_super) {
|
|
|
715
642
|
* @returns {Object}
|
|
716
643
|
* @private
|
|
717
644
|
*/
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
645
|
+
_createLookupTypeObject(nsString, xmlns) {
|
|
646
|
+
const splittedNSString = (0, utils_1.splitQName)(nsString);
|
|
647
|
+
const nsAlias = splittedNSString.prefix;
|
|
648
|
+
const splittedName = splittedNSString.name.split('#');
|
|
649
|
+
const type = splittedName[0];
|
|
650
|
+
const name = splittedName[1];
|
|
724
651
|
return {
|
|
725
652
|
$namespace: xmlns[nsAlias],
|
|
726
653
|
$type: nsAlias + ':' + type,
|
|
727
|
-
$name: name
|
|
654
|
+
$name: name,
|
|
728
655
|
};
|
|
729
|
-
}
|
|
656
|
+
}
|
|
730
657
|
/**
|
|
731
658
|
* Iterates through the element and every nested child to find any defined `$type`
|
|
732
659
|
* property and returns it in a underscore ('_') separated String (using '^' as default
|
|
@@ -737,76 +664,66 @@ var MessageElement = /** @class */ (function (_super) {
|
|
|
737
664
|
* @returns {String}
|
|
738
665
|
* @private
|
|
739
666
|
*/
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
var excluded = this.ignoredNamespaces.concat('xs'); // do not process $type values wich start with
|
|
667
|
+
_getNestedLookupTypeString(element) {
|
|
668
|
+
let resolvedType = '^';
|
|
669
|
+
const excluded = this.ignoredNamespaces.concat('xs'); // do not process $type values wich start with
|
|
744
670
|
if (element.hasOwnProperty('$type') && typeof element.$type === 'string') {
|
|
745
671
|
if (excluded.indexOf(element.$type.split(':')[0]) === -1) {
|
|
746
672
|
resolvedType += ('_' + element.$type + '#' + element.$name);
|
|
747
673
|
}
|
|
748
674
|
}
|
|
749
675
|
if (element.children.length > 0) {
|
|
750
|
-
element.children.forEach(
|
|
751
|
-
|
|
676
|
+
element.children.forEach((child) => {
|
|
677
|
+
const resolvedChildType = this._getNestedLookupTypeString(child).replace(/\^_/, '');
|
|
752
678
|
if (resolvedChildType && typeof resolvedChildType === 'string') {
|
|
753
679
|
resolvedType += ('_' + resolvedChildType);
|
|
754
680
|
}
|
|
755
681
|
});
|
|
756
682
|
}
|
|
757
683
|
return resolvedType;
|
|
758
|
-
};
|
|
759
|
-
return MessageElement;
|
|
760
|
-
}(Element));
|
|
761
|
-
exports.MessageElement = MessageElement;
|
|
762
|
-
var DocumentationElement = /** @class */ (function (_super) {
|
|
763
|
-
__extends(DocumentationElement, _super);
|
|
764
|
-
function DocumentationElement() {
|
|
765
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
766
684
|
}
|
|
767
|
-
|
|
768
|
-
|
|
685
|
+
}
|
|
686
|
+
exports.MessageElement = MessageElement;
|
|
687
|
+
class DocumentationElement extends Element {
|
|
688
|
+
}
|
|
769
689
|
exports.DocumentationElement = DocumentationElement;
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
_this.allowedChildren = buildAllowedChildren([
|
|
690
|
+
class SchemaElement extends Element {
|
|
691
|
+
constructor() {
|
|
692
|
+
super(...arguments);
|
|
693
|
+
this.allowedChildren = buildAllowedChildren([
|
|
775
694
|
'complexType',
|
|
776
695
|
'element',
|
|
777
696
|
'import',
|
|
778
697
|
'include',
|
|
779
698
|
'simpleType',
|
|
780
699
|
]);
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
var _this = this;
|
|
789
|
-
assert_1.ok(source instanceof SchemaElement);
|
|
700
|
+
this.complexTypes = {};
|
|
701
|
+
this.types = {};
|
|
702
|
+
this.elements = {};
|
|
703
|
+
this.includes = [];
|
|
704
|
+
}
|
|
705
|
+
merge(source) {
|
|
706
|
+
(0, assert_1.ok)(source instanceof SchemaElement);
|
|
790
707
|
_.merge(this.complexTypes, source.complexTypes);
|
|
791
708
|
_.merge(this.types, source.types);
|
|
792
709
|
_.merge(this.elements, source.elements);
|
|
793
710
|
_.merge(this.xmlns, source.xmlns);
|
|
794
711
|
// Merge attributes from source without overwriting our's
|
|
795
|
-
_.merge(this, _.pickBy(source,
|
|
796
|
-
return key.startsWith('$') && !
|
|
712
|
+
_.merge(this, _.pickBy(source, (value, key) => {
|
|
713
|
+
return key.startsWith('$') && !this.hasOwnProperty(key);
|
|
797
714
|
}));
|
|
798
715
|
return this;
|
|
799
|
-
}
|
|
800
|
-
|
|
716
|
+
}
|
|
717
|
+
addChild(child) {
|
|
801
718
|
if (child.$name in Primitives) {
|
|
802
719
|
return;
|
|
803
720
|
}
|
|
804
721
|
if (child instanceof IncludeElement || child instanceof ImportElement) {
|
|
805
|
-
|
|
806
|
-
if (
|
|
722
|
+
const location = child.$schemaLocation || child.$location;
|
|
723
|
+
if (location) {
|
|
807
724
|
this.includes.push({
|
|
808
725
|
namespace: child.$namespace || child.$targetNamespace || this.$targetNamespace,
|
|
809
|
-
location:
|
|
726
|
+
location: location,
|
|
810
727
|
});
|
|
811
728
|
}
|
|
812
729
|
}
|
|
@@ -821,65 +738,58 @@ var SchemaElement = /** @class */ (function (_super) {
|
|
|
821
738
|
}
|
|
822
739
|
this.children.pop();
|
|
823
740
|
// child.deleteFixedAttrs();
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
}(Element));
|
|
741
|
+
}
|
|
742
|
+
}
|
|
827
743
|
exports.SchemaElement = SchemaElement;
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
_this.allowedChildren = buildAllowedChildren([
|
|
744
|
+
class TypesElement extends Element {
|
|
745
|
+
constructor() {
|
|
746
|
+
super(...arguments);
|
|
747
|
+
this.allowedChildren = buildAllowedChildren([
|
|
833
748
|
'documentation',
|
|
834
749
|
'schema',
|
|
835
750
|
]);
|
|
836
|
-
|
|
837
|
-
return _this;
|
|
751
|
+
this.schemas = {};
|
|
838
752
|
}
|
|
839
753
|
// fix#325
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
var targetNamespace = child.$targetNamespace || ((_a = child.includes[0]) === null || _a === void 0 ? void 0 : _a.namespace);
|
|
754
|
+
addChild(child) {
|
|
755
|
+
(0, assert_1.ok)(child instanceof SchemaElement);
|
|
756
|
+
const targetNamespace = child.$targetNamespace || child.includes[0]?.namespace;
|
|
844
757
|
if (!this.schemas.hasOwnProperty(targetNamespace)) {
|
|
845
758
|
this.schemas[targetNamespace] = child;
|
|
846
759
|
}
|
|
847
760
|
else {
|
|
848
761
|
console.error('Target-Namespace "' + targetNamespace + '" already in use by another Schema!');
|
|
849
762
|
}
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
}(Element));
|
|
763
|
+
}
|
|
764
|
+
}
|
|
853
765
|
exports.TypesElement = TypesElement;
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
_this.allowedChildren = buildAllowedChildren([
|
|
766
|
+
class OperationElement extends Element {
|
|
767
|
+
constructor() {
|
|
768
|
+
super(...arguments);
|
|
769
|
+
this.allowedChildren = buildAllowedChildren([
|
|
859
770
|
'documentation',
|
|
860
771
|
'fault',
|
|
861
772
|
'input',
|
|
862
773
|
'operation',
|
|
863
774
|
'output',
|
|
864
775
|
]);
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
OperationElement.prototype.addChild = function (child) {
|
|
776
|
+
this.input = null;
|
|
777
|
+
this.output = null;
|
|
778
|
+
this.inputSoap = null;
|
|
779
|
+
this.outputSoap = null;
|
|
780
|
+
this.style = '';
|
|
781
|
+
this.soapAction = '';
|
|
782
|
+
}
|
|
783
|
+
addChild(child) {
|
|
874
784
|
if (child instanceof OperationElement) {
|
|
875
785
|
this.soapAction = child.$soapAction || '';
|
|
876
786
|
this.style = child.$style || '';
|
|
877
787
|
this.children.pop();
|
|
878
788
|
}
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
for (
|
|
789
|
+
}
|
|
790
|
+
postProcess(definitions, tag) {
|
|
791
|
+
const children = this.children;
|
|
792
|
+
for (let i = 0, child; child = children[i]; i++) {
|
|
883
793
|
if (child.name !== 'input' && child.name !== 'output') {
|
|
884
794
|
continue;
|
|
885
795
|
}
|
|
@@ -888,8 +798,8 @@ var OperationElement = /** @class */ (function (_super) {
|
|
|
888
798
|
children.splice(i--, 1);
|
|
889
799
|
continue;
|
|
890
800
|
}
|
|
891
|
-
|
|
892
|
-
|
|
801
|
+
const messageName = (0, utils_1.splitQName)(child.$message).name;
|
|
802
|
+
const message = definitions.messages[messageName];
|
|
893
803
|
message.postProcess(definitions);
|
|
894
804
|
if (message.element) {
|
|
895
805
|
definitions.messages[message.element.$name] = message;
|
|
@@ -901,35 +811,32 @@ var OperationElement = /** @class */ (function (_super) {
|
|
|
901
811
|
children.splice(i--, 1);
|
|
902
812
|
}
|
|
903
813
|
this.deleteFixedAttrs();
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
814
|
+
}
|
|
815
|
+
description(definitions) {
|
|
816
|
+
const inputDesc = this.input ? this.input.description(definitions) : null;
|
|
817
|
+
const outputDesc = this.output ? this.output.description(definitions) : null;
|
|
908
818
|
return {
|
|
909
819
|
input: inputDesc && inputDesc[Object.keys(inputDesc)[0]],
|
|
910
|
-
output: outputDesc && outputDesc[Object.keys(outputDesc)[0]]
|
|
820
|
+
output: outputDesc && outputDesc[Object.keys(outputDesc)[0]],
|
|
911
821
|
};
|
|
912
|
-
}
|
|
913
|
-
|
|
914
|
-
}(Element));
|
|
822
|
+
}
|
|
823
|
+
}
|
|
915
824
|
exports.OperationElement = OperationElement;
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
_this.allowedChildren = buildAllowedChildren([
|
|
825
|
+
class PortTypeElement extends Element {
|
|
826
|
+
constructor() {
|
|
827
|
+
super(...arguments);
|
|
828
|
+
this.allowedChildren = buildAllowedChildren([
|
|
921
829
|
'documentation',
|
|
922
830
|
'operation',
|
|
923
831
|
]);
|
|
924
|
-
|
|
925
|
-
return _this;
|
|
832
|
+
this.methods = {};
|
|
926
833
|
}
|
|
927
|
-
|
|
928
|
-
|
|
834
|
+
postProcess(definitions) {
|
|
835
|
+
const children = this.children;
|
|
929
836
|
if (typeof children === 'undefined') {
|
|
930
837
|
return;
|
|
931
838
|
}
|
|
932
|
-
for (
|
|
839
|
+
for (let i = 0, child; child = children[i]; i++) {
|
|
933
840
|
if (child.name !== 'operation') {
|
|
934
841
|
continue;
|
|
935
842
|
}
|
|
@@ -939,56 +846,53 @@ var PortTypeElement = /** @class */ (function (_super) {
|
|
|
939
846
|
}
|
|
940
847
|
delete this.$name;
|
|
941
848
|
this.deleteFixedAttrs();
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
for (
|
|
946
|
-
|
|
947
|
-
methods[
|
|
849
|
+
}
|
|
850
|
+
description(definitions) {
|
|
851
|
+
const methods = {};
|
|
852
|
+
for (const name in this.methods) {
|
|
853
|
+
const method = this.methods[name];
|
|
854
|
+
methods[name] = method.description(definitions);
|
|
948
855
|
}
|
|
949
856
|
return methods;
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
}(Element));
|
|
857
|
+
}
|
|
858
|
+
}
|
|
953
859
|
exports.PortTypeElement = PortTypeElement;
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
_this.allowedChildren = buildAllowedChildren([
|
|
860
|
+
class BindingElement extends Element {
|
|
861
|
+
constructor() {
|
|
862
|
+
super(...arguments);
|
|
863
|
+
this.allowedChildren = buildAllowedChildren([
|
|
959
864
|
'binding',
|
|
960
865
|
'documentation',
|
|
961
866
|
'operation',
|
|
962
867
|
'SecuritySpec',
|
|
963
868
|
]);
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
return _this;
|
|
869
|
+
this.transport = '';
|
|
870
|
+
this.style = '';
|
|
871
|
+
this.methods = {};
|
|
968
872
|
}
|
|
969
|
-
|
|
873
|
+
addChild(child) {
|
|
970
874
|
if (child.name === 'binding') {
|
|
971
875
|
this.transport = child.$transport;
|
|
972
876
|
this.style = child.$style;
|
|
973
877
|
this.children.pop();
|
|
974
878
|
}
|
|
975
|
-
}
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
879
|
+
}
|
|
880
|
+
postProcess(definitions) {
|
|
881
|
+
const type = (0, utils_1.splitQName)(this.$type).name;
|
|
882
|
+
const portType = definitions.portTypes[type];
|
|
883
|
+
const style = this.style;
|
|
884
|
+
const children = this.children;
|
|
981
885
|
if (portType) {
|
|
982
886
|
portType.postProcess(definitions);
|
|
983
887
|
this.methods = portType.methods;
|
|
984
|
-
for (
|
|
888
|
+
for (let i = 0, child; child = children[i]; i++) {
|
|
985
889
|
if (child.name !== 'operation') {
|
|
986
890
|
continue;
|
|
987
891
|
}
|
|
988
892
|
child.postProcess(definitions, 'binding');
|
|
989
893
|
children.splice(i--, 1);
|
|
990
894
|
child.style || (child.style = style);
|
|
991
|
-
|
|
895
|
+
const method = this.methods[child.$name];
|
|
992
896
|
if (method) {
|
|
993
897
|
method.style = child.style;
|
|
994
898
|
method.soapAction = child.soapAction;
|
|
@@ -1002,63 +906,57 @@ var BindingElement = /** @class */ (function (_super) {
|
|
|
1002
906
|
delete this.$name;
|
|
1003
907
|
delete this.$type;
|
|
1004
908
|
this.deleteFixedAttrs();
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
for (
|
|
1009
|
-
|
|
1010
|
-
methods[
|
|
909
|
+
}
|
|
910
|
+
description(definitions) {
|
|
911
|
+
const methods = {};
|
|
912
|
+
for (const name in this.methods) {
|
|
913
|
+
const method = this.methods[name];
|
|
914
|
+
methods[name] = method.description(definitions);
|
|
1011
915
|
}
|
|
1012
916
|
return methods;
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
}(Element));
|
|
917
|
+
}
|
|
918
|
+
}
|
|
1016
919
|
exports.BindingElement = BindingElement;
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
_this.allowedChildren = buildAllowedChildren([
|
|
920
|
+
class PortElement extends Element {
|
|
921
|
+
constructor() {
|
|
922
|
+
super(...arguments);
|
|
923
|
+
this.allowedChildren = buildAllowedChildren([
|
|
1022
924
|
'address',
|
|
1023
925
|
'documentation',
|
|
1024
926
|
]);
|
|
1025
|
-
|
|
1026
|
-
return _this;
|
|
927
|
+
this.location = null;
|
|
1027
928
|
}
|
|
1028
|
-
|
|
929
|
+
addChild(child) {
|
|
1029
930
|
if (child.name === 'address' && typeof (child.$location) !== 'undefined') {
|
|
1030
931
|
this.location = child.$location;
|
|
1031
932
|
}
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
|
-
}(Element));
|
|
933
|
+
}
|
|
934
|
+
}
|
|
1035
935
|
exports.PortElement = PortElement;
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
_this.allowedChildren = buildAllowedChildren([
|
|
936
|
+
class ServiceElement extends Element {
|
|
937
|
+
constructor() {
|
|
938
|
+
super(...arguments);
|
|
939
|
+
this.allowedChildren = buildAllowedChildren([
|
|
1041
940
|
'documentation',
|
|
1042
941
|
'port',
|
|
1043
942
|
]);
|
|
1044
|
-
|
|
1045
|
-
return _this;
|
|
943
|
+
this.ports = {};
|
|
1046
944
|
}
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
945
|
+
postProcess(definitions) {
|
|
946
|
+
const children = this.children;
|
|
947
|
+
const bindings = definitions.bindings;
|
|
1050
948
|
if (children && children.length > 0) {
|
|
1051
|
-
for (
|
|
949
|
+
for (let i = 0, child; child = children[i]; i++) {
|
|
1052
950
|
if (child.name !== 'port') {
|
|
1053
951
|
continue;
|
|
1054
952
|
}
|
|
1055
|
-
|
|
1056
|
-
|
|
953
|
+
const bindingName = (0, utils_1.splitQName)(child.$binding).name;
|
|
954
|
+
const binding = bindings[bindingName];
|
|
1057
955
|
if (binding) {
|
|
1058
956
|
binding.postProcess(definitions);
|
|
1059
957
|
this.ports[child.$name] = {
|
|
1060
958
|
location: child.location,
|
|
1061
|
-
binding: binding
|
|
959
|
+
binding: binding,
|
|
1062
960
|
};
|
|
1063
961
|
children.splice(i--, 1);
|
|
1064
962
|
}
|
|
@@ -1066,23 +964,21 @@ var ServiceElement = /** @class */ (function (_super) {
|
|
|
1066
964
|
}
|
|
1067
965
|
delete this.$name;
|
|
1068
966
|
this.deleteFixedAttrs();
|
|
1069
|
-
}
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
for (
|
|
1073
|
-
|
|
1074
|
-
ports[
|
|
967
|
+
}
|
|
968
|
+
description(definitions) {
|
|
969
|
+
const ports = {};
|
|
970
|
+
for (const name in this.ports) {
|
|
971
|
+
const port = this.ports[name];
|
|
972
|
+
ports[name] = port.binding.description(definitions);
|
|
1075
973
|
}
|
|
1076
974
|
return ports;
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
}(Element));
|
|
975
|
+
}
|
|
976
|
+
}
|
|
1080
977
|
exports.ServiceElement = ServiceElement;
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
_this.allowedChildren = buildAllowedChildren([
|
|
978
|
+
class DefinitionsElement extends Element {
|
|
979
|
+
constructor() {
|
|
980
|
+
super(...arguments);
|
|
981
|
+
this.allowedChildren = buildAllowedChildren([
|
|
1086
982
|
'binding',
|
|
1087
983
|
'documentation',
|
|
1088
984
|
'import',
|
|
@@ -1091,23 +987,22 @@ var DefinitionsElement = /** @class */ (function (_super) {
|
|
|
1091
987
|
'service',
|
|
1092
988
|
'types',
|
|
1093
989
|
]);
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
990
|
+
this.messages = {};
|
|
991
|
+
this.portTypes = {};
|
|
992
|
+
this.bindings = {};
|
|
993
|
+
this.services = {};
|
|
994
|
+
this.schemas = {};
|
|
995
|
+
this.descriptions = {
|
|
1100
996
|
types: {},
|
|
1101
|
-
elements: {}
|
|
997
|
+
elements: {},
|
|
1102
998
|
};
|
|
1103
|
-
return _this;
|
|
1104
999
|
}
|
|
1105
|
-
|
|
1000
|
+
init() {
|
|
1106
1001
|
if (this.name !== 'definitions') {
|
|
1107
1002
|
this.unexpected(this.nsName);
|
|
1108
1003
|
}
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1004
|
+
}
|
|
1005
|
+
addChild(child) {
|
|
1111
1006
|
if (child instanceof TypesElement) {
|
|
1112
1007
|
// Merge types.schemas into definitions.schemas
|
|
1113
1008
|
_.merge(this.schemas, child.schemas);
|
|
@@ -1116,7 +1011,7 @@ var DefinitionsElement = /** @class */ (function (_super) {
|
|
|
1116
1011
|
this.messages[child.$name] = child;
|
|
1117
1012
|
}
|
|
1118
1013
|
else if (child.name === 'import') {
|
|
1119
|
-
|
|
1014
|
+
const schemaElement = new SchemaElement(child.$namespace, {});
|
|
1120
1015
|
schemaElement.init();
|
|
1121
1016
|
this.schemas[child.$namespace] = schemaElement;
|
|
1122
1017
|
this.schemas[child.$namespace].addChild(child);
|
|
@@ -1136,35 +1031,19 @@ var DefinitionsElement = /** @class */ (function (_super) {
|
|
|
1136
1031
|
else if (child instanceof DocumentationElement) {
|
|
1137
1032
|
}
|
|
1138
1033
|
this.children.pop();
|
|
1139
|
-
};
|
|
1140
|
-
return DefinitionsElement;
|
|
1141
|
-
}(Element));
|
|
1142
|
-
exports.DefinitionsElement = DefinitionsElement;
|
|
1143
|
-
var BodyElement = /** @class */ (function (_super) {
|
|
1144
|
-
__extends(BodyElement, _super);
|
|
1145
|
-
function BodyElement() {
|
|
1146
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
1147
1034
|
}
|
|
1148
|
-
|
|
1149
|
-
|
|
1035
|
+
}
|
|
1036
|
+
exports.DefinitionsElement = DefinitionsElement;
|
|
1037
|
+
class BodyElement extends Element {
|
|
1038
|
+
}
|
|
1150
1039
|
exports.BodyElement = BodyElement;
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
function IncludeElement() {
|
|
1154
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
1155
|
-
}
|
|
1156
|
-
return IncludeElement;
|
|
1157
|
-
}(Element));
|
|
1040
|
+
class IncludeElement extends Element {
|
|
1041
|
+
}
|
|
1158
1042
|
exports.IncludeElement = IncludeElement;
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
function ImportElement() {
|
|
1162
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
1163
|
-
}
|
|
1164
|
-
return ImportElement;
|
|
1165
|
-
}(Element));
|
|
1043
|
+
class ImportElement extends Element {
|
|
1044
|
+
}
|
|
1166
1045
|
exports.ImportElement = ImportElement;
|
|
1167
|
-
|
|
1046
|
+
const ElementTypeMap = {
|
|
1168
1047
|
// group: [GroupElement, 'element group'],
|
|
1169
1048
|
all: AllElement,
|
|
1170
1049
|
any: AnyElement,
|
|
@@ -1179,7 +1058,7 @@ var ElementTypeMap = {
|
|
|
1179
1058
|
enumeration: EnumerationElement,
|
|
1180
1059
|
extension: ExtensionElement,
|
|
1181
1060
|
fault: Element,
|
|
1182
|
-
|
|
1061
|
+
import: ImportElement,
|
|
1183
1062
|
include: IncludeElement,
|
|
1184
1063
|
input: InputElement,
|
|
1185
1064
|
message: MessageElement,
|
|
@@ -1193,12 +1072,11 @@ var ElementTypeMap = {
|
|
|
1193
1072
|
service: ServiceElement,
|
|
1194
1073
|
simpleContent: SimpleContentElement,
|
|
1195
1074
|
simpleType: SimpleTypeElement,
|
|
1196
|
-
types: TypesElement
|
|
1075
|
+
types: TypesElement,
|
|
1197
1076
|
};
|
|
1198
1077
|
function buildAllowedChildren(elementList) {
|
|
1199
|
-
|
|
1200
|
-
for (
|
|
1201
|
-
var element = elementList_1[_i];
|
|
1078
|
+
const rtn = {};
|
|
1079
|
+
for (const element of elementList) {
|
|
1202
1080
|
rtn[element.replace(/^_/, '')] = ElementTypeMap[element] || Element;
|
|
1203
1081
|
}
|
|
1204
1082
|
return rtn;
|