create-mastra 0.1.0-alpha.23 → 0.1.0-alpha.25
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/LICENSE +44 -0
- package/dist/AssumeRoleCommand-Cse3dzcY.js +3650 -0
- package/dist/AssumeRoleCommand-Cse3dzcY.js.map +1 -0
- package/dist/create-aggregated-client-BFp7oxSr.js +24 -0
- package/dist/create-aggregated-client-BFp7oxSr.js.map +1 -0
- package/dist/extended-encode-uri-component-Dlbpb2Wd.js +8 -0
- package/dist/extended-encode-uri-component-Dlbpb2Wd.js.map +1 -0
- package/dist/index-B6QXpY-b.js +37 -0
- package/dist/index-B6QXpY-b.js.map +1 -0
- package/dist/index-BRCgFUbU.js +37 -0
- package/dist/index-BRCgFUbU.js.map +1 -0
- package/dist/index-BZHBFaQF.js +37 -0
- package/dist/index-BZHBFaQF.js.map +1 -0
- package/dist/index-B_Yunpbk.js +37 -0
- package/dist/index-B_Yunpbk.js.map +1 -0
- package/dist/index-BpMCSgn8.js +1145 -0
- package/dist/index-BpMCSgn8.js.map +1 -0
- package/dist/index-BxJx8yLU.js +37 -0
- package/dist/index-BxJx8yLU.js.map +1 -0
- package/dist/index-CF0rZfmW.js +37 -0
- package/dist/index-CF0rZfmW.js.map +1 -0
- package/dist/index-DeZeG5u4.js +3726 -0
- package/dist/index-DeZeG5u4.js.map +1 -0
- package/dist/index-_YTyVz_X.js +298 -0
- package/dist/index-_YTyVz_X.js.map +1 -0
- package/dist/index-lqkrgSwk.js +37 -0
- package/dist/index-lqkrgSwk.js.map +1 -0
- package/dist/index.js +152931 -39
- package/dist/index.js.map +1 -0
- package/dist/loadCognitoIdentity-CWxGlq_8.js +828 -0
- package/dist/loadCognitoIdentity-CWxGlq_8.js.map +1 -0
- package/dist/loadSso-MEAVww3h.js +615 -0
- package/dist/loadSso-MEAVww3h.js.map +1 -0
- package/dist/loadSts-DEnlAvEU.js +40 -0
- package/dist/loadSts-DEnlAvEU.js.map +1 -0
- package/dist/parseJsonBody-C_mcRkFo.js +161 -0
- package/dist/parseJsonBody-C_mcRkFo.js.map +1 -0
- package/dist/requestBuilder-CuNXirlx.js +90 -0
- package/dist/requestBuilder-CuNXirlx.js.map +1 -0
- package/package.json +16 -5
- package/starter-files/config.ts +28 -0
- package/starter-files/mastra-pg.docker-compose.yaml +15 -0
- package/starter-files/tools.ts +95 -0
- package/starter-files/workflow.ts +173 -0
- package/dist/index.d.ts +0 -2
- package/dist/utils.d.ts +0 -1
- package/dist/utils.js +0 -11
|
@@ -0,0 +1,3650 @@
|
|
|
1
|
+
import { c as collectBodyString, r as resolveAwsSdkSigV4Config, d as getSmithyContext, n as normalizeProvider, e as resolveEndpoint, E as EndpointCache, f as customEndpointFunctions, h as awsEndpointFunctions, i as fromBase64, A as AwsSdkSigV4Signer, N as NoAuthSigner, j as NoOpLogger, k as emitWarningIfUnsupportedVersion, l as emitWarningIfUnsupportedVersion$1, m as calculateBodyLength, o as createDefaultUserAgentProvider, H as Hash, x as resolveDefaultsModeConfig, y as loadConfigsForDefaultMode, p as NODE_MAX_ATTEMPT_CONFIG_OPTIONS, q as NODE_REGION_CONFIG_FILE_OPTIONS, s as NODE_REGION_CONFIG_OPTIONS, t as NODE_RETRY_MODE_CONFIG_OPTIONS, D as DEFAULT_RETRY_MODE, u as NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, v as NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, w as NODE_APP_ID_CONFIG_OPTIONS, z as getDefaultExtensionConfiguration, F as resolveAwsRegionExtensionConfiguration, G as resolveDefaultRuntimeConfig, I as resolveHttpHandlerRuntimeConfig, J as getAwsRegionExtensionConfiguration, B as getHttpHandlerExtensionConfiguration, b as Client, K as resolveUserAgentConfig, L as resolveRetryConfig, M as resolveRegionConfig, O as resolveEndpointConfig, P as getUserAgentPlugin, Q as getRetryPlugin, R as getContentLengthPlugin, S as getHostHeaderPlugin, T as getLoggerPlugin, U as getRecursionDetectionPlugin, V as getHttpAuthSchemeEndpointRuleSetPlugin, X as getHttpSigningPlugin, W as DefaultIdentityProviderConfig, Y as resolveHostHeaderConfig, Z as ServiceException, _ as SENSITIVE_STRING, $ as decorateServiceException, a0 as withBaseException, C as Command, g as getSerdePlugin, a as getEndpointPlugin } from './index-DeZeG5u4.js';
|
|
2
|
+
import { z as toBase64, A as parseUrl, B as fromUtf8, C as toUtf8, F as defaultProvider, G as loadConfig, N as NodeHttpHandler, I as streamCollector, R as strictParseInt32, J as expectString, K as expectNonNull, S as parseRfc3339DateTimeWithOffset, H as HttpRequest } from './index.js';
|
|
3
|
+
import 'node:buffer';
|
|
4
|
+
import { e as extendedEncodeURIComponent } from './extended-encode-uri-component-Dlbpb2Wd.js';
|
|
5
|
+
|
|
6
|
+
const getValueFromTextNode = (obj) => {
|
|
7
|
+
const textNodeName = "#text";
|
|
8
|
+
for (const key in obj) {
|
|
9
|
+
if (obj.hasOwnProperty(key) && obj[key][textNodeName] !== undefined) {
|
|
10
|
+
obj[key] = obj[key][textNodeName];
|
|
11
|
+
}
|
|
12
|
+
else if (typeof obj[key] === "object" && obj[key] !== null) {
|
|
13
|
+
obj[key] = getValueFromTextNode(obj[key]);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return obj;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
var validator = {};
|
|
20
|
+
|
|
21
|
+
var util = {};
|
|
22
|
+
|
|
23
|
+
var hasRequiredUtil;
|
|
24
|
+
|
|
25
|
+
function requireUtil () {
|
|
26
|
+
if (hasRequiredUtil) return util;
|
|
27
|
+
hasRequiredUtil = 1;
|
|
28
|
+
(function (exports) {
|
|
29
|
+
|
|
30
|
+
const nameStartChar = ':A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD';
|
|
31
|
+
const nameChar = nameStartChar + '\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040';
|
|
32
|
+
const nameRegexp = '[' + nameStartChar + '][' + nameChar + ']*';
|
|
33
|
+
const regexName = new RegExp('^' + nameRegexp + '$');
|
|
34
|
+
|
|
35
|
+
const getAllMatches = function(string, regex) {
|
|
36
|
+
const matches = [];
|
|
37
|
+
let match = regex.exec(string);
|
|
38
|
+
while (match) {
|
|
39
|
+
const allmatches = [];
|
|
40
|
+
allmatches.startIndex = regex.lastIndex - match[0].length;
|
|
41
|
+
const len = match.length;
|
|
42
|
+
for (let index = 0; index < len; index++) {
|
|
43
|
+
allmatches.push(match[index]);
|
|
44
|
+
}
|
|
45
|
+
matches.push(allmatches);
|
|
46
|
+
match = regex.exec(string);
|
|
47
|
+
}
|
|
48
|
+
return matches;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const isName = function(string) {
|
|
52
|
+
const match = regexName.exec(string);
|
|
53
|
+
return !(match === null || typeof match === 'undefined');
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
exports.isExist = function(v) {
|
|
57
|
+
return typeof v !== 'undefined';
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
exports.isEmptyObject = function(obj) {
|
|
61
|
+
return Object.keys(obj).length === 0;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Copy all the properties of a into b.
|
|
66
|
+
* @param {*} target
|
|
67
|
+
* @param {*} a
|
|
68
|
+
*/
|
|
69
|
+
exports.merge = function(target, a, arrayMode) {
|
|
70
|
+
if (a) {
|
|
71
|
+
const keys = Object.keys(a); // will return an array of own properties
|
|
72
|
+
const len = keys.length; //don't make it inline
|
|
73
|
+
for (let i = 0; i < len; i++) {
|
|
74
|
+
if (arrayMode === 'strict') {
|
|
75
|
+
target[keys[i]] = [ a[keys[i]] ];
|
|
76
|
+
} else {
|
|
77
|
+
target[keys[i]] = a[keys[i]];
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
/* exports.merge =function (b,a){
|
|
83
|
+
return Object.assign(b,a);
|
|
84
|
+
} */
|
|
85
|
+
|
|
86
|
+
exports.getValue = function(v) {
|
|
87
|
+
if (exports.isExist(v)) {
|
|
88
|
+
return v;
|
|
89
|
+
} else {
|
|
90
|
+
return '';
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// const fakeCall = function(a) {return a;};
|
|
95
|
+
// const fakeCallNoReturn = function() {};
|
|
96
|
+
|
|
97
|
+
exports.isName = isName;
|
|
98
|
+
exports.getAllMatches = getAllMatches;
|
|
99
|
+
exports.nameRegexp = nameRegexp;
|
|
100
|
+
} (util));
|
|
101
|
+
return util;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
var hasRequiredValidator;
|
|
105
|
+
|
|
106
|
+
function requireValidator () {
|
|
107
|
+
if (hasRequiredValidator) return validator;
|
|
108
|
+
hasRequiredValidator = 1;
|
|
109
|
+
|
|
110
|
+
const util = requireUtil();
|
|
111
|
+
|
|
112
|
+
const defaultOptions = {
|
|
113
|
+
allowBooleanAttributes: false, //A tag can have attributes without any value
|
|
114
|
+
unpairedTags: []
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
//const tagsPattern = new RegExp("<\\/?([\\w:\\-_\.]+)\\s*\/?>","g");
|
|
118
|
+
validator.validate = function (xmlData, options) {
|
|
119
|
+
options = Object.assign({}, defaultOptions, options);
|
|
120
|
+
|
|
121
|
+
//xmlData = xmlData.replace(/(\r\n|\n|\r)/gm,"");//make it single line
|
|
122
|
+
//xmlData = xmlData.replace(/(^\s*<\?xml.*?\?>)/g,"");//Remove XML starting tag
|
|
123
|
+
//xmlData = xmlData.replace(/(<!DOCTYPE[\s\w\"\.\/\-\:]+(\[.*\])*\s*>)/g,"");//Remove DOCTYPE
|
|
124
|
+
const tags = [];
|
|
125
|
+
let tagFound = false;
|
|
126
|
+
|
|
127
|
+
//indicates that the root tag has been closed (aka. depth 0 has been reached)
|
|
128
|
+
let reachedRoot = false;
|
|
129
|
+
|
|
130
|
+
if (xmlData[0] === '\ufeff') {
|
|
131
|
+
// check for byte order mark (BOM)
|
|
132
|
+
xmlData = xmlData.substr(1);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
for (let i = 0; i < xmlData.length; i++) {
|
|
136
|
+
|
|
137
|
+
if (xmlData[i] === '<' && xmlData[i+1] === '?') {
|
|
138
|
+
i+=2;
|
|
139
|
+
i = readPI(xmlData,i);
|
|
140
|
+
if (i.err) return i;
|
|
141
|
+
}else if (xmlData[i] === '<') {
|
|
142
|
+
//starting of tag
|
|
143
|
+
//read until you reach to '>' avoiding any '>' in attribute value
|
|
144
|
+
let tagStartPos = i;
|
|
145
|
+
i++;
|
|
146
|
+
|
|
147
|
+
if (xmlData[i] === '!') {
|
|
148
|
+
i = readCommentAndCDATA(xmlData, i);
|
|
149
|
+
continue;
|
|
150
|
+
} else {
|
|
151
|
+
let closingTag = false;
|
|
152
|
+
if (xmlData[i] === '/') {
|
|
153
|
+
//closing tag
|
|
154
|
+
closingTag = true;
|
|
155
|
+
i++;
|
|
156
|
+
}
|
|
157
|
+
//read tagname
|
|
158
|
+
let tagName = '';
|
|
159
|
+
for (; i < xmlData.length &&
|
|
160
|
+
xmlData[i] !== '>' &&
|
|
161
|
+
xmlData[i] !== ' ' &&
|
|
162
|
+
xmlData[i] !== '\t' &&
|
|
163
|
+
xmlData[i] !== '\n' &&
|
|
164
|
+
xmlData[i] !== '\r'; i++
|
|
165
|
+
) {
|
|
166
|
+
tagName += xmlData[i];
|
|
167
|
+
}
|
|
168
|
+
tagName = tagName.trim();
|
|
169
|
+
//console.log(tagName);
|
|
170
|
+
|
|
171
|
+
if (tagName[tagName.length - 1] === '/') {
|
|
172
|
+
//self closing tag without attributes
|
|
173
|
+
tagName = tagName.substring(0, tagName.length - 1);
|
|
174
|
+
//continue;
|
|
175
|
+
i--;
|
|
176
|
+
}
|
|
177
|
+
if (!validateTagName(tagName)) {
|
|
178
|
+
let msg;
|
|
179
|
+
if (tagName.trim().length === 0) {
|
|
180
|
+
msg = "Invalid space after '<'.";
|
|
181
|
+
} else {
|
|
182
|
+
msg = "Tag '"+tagName+"' is an invalid name.";
|
|
183
|
+
}
|
|
184
|
+
return getErrorObject('InvalidTag', msg, getLineNumberForPosition(xmlData, i));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const result = readAttributeStr(xmlData, i);
|
|
188
|
+
if (result === false) {
|
|
189
|
+
return getErrorObject('InvalidAttr', "Attributes for '"+tagName+"' have open quote.", getLineNumberForPosition(xmlData, i));
|
|
190
|
+
}
|
|
191
|
+
let attrStr = result.value;
|
|
192
|
+
i = result.index;
|
|
193
|
+
|
|
194
|
+
if (attrStr[attrStr.length - 1] === '/') {
|
|
195
|
+
//self closing tag
|
|
196
|
+
const attrStrStart = i - attrStr.length;
|
|
197
|
+
attrStr = attrStr.substring(0, attrStr.length - 1);
|
|
198
|
+
const isValid = validateAttributeString(attrStr, options);
|
|
199
|
+
if (isValid === true) {
|
|
200
|
+
tagFound = true;
|
|
201
|
+
//continue; //text may presents after self closing tag
|
|
202
|
+
} else {
|
|
203
|
+
//the result from the nested function returns the position of the error within the attribute
|
|
204
|
+
//in order to get the 'true' error line, we need to calculate the position where the attribute begins (i - attrStr.length) and then add the position within the attribute
|
|
205
|
+
//this gives us the absolute index in the entire xml, which we can use to find the line at last
|
|
206
|
+
return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, attrStrStart + isValid.err.line));
|
|
207
|
+
}
|
|
208
|
+
} else if (closingTag) {
|
|
209
|
+
if (!result.tagClosed) {
|
|
210
|
+
return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' doesn't have proper closing.", getLineNumberForPosition(xmlData, i));
|
|
211
|
+
} else if (attrStr.trim().length > 0) {
|
|
212
|
+
return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' can't have attributes or invalid starting.", getLineNumberForPosition(xmlData, tagStartPos));
|
|
213
|
+
} else if (tags.length === 0) {
|
|
214
|
+
return getErrorObject('InvalidTag', "Closing tag '"+tagName+"' has not been opened.", getLineNumberForPosition(xmlData, tagStartPos));
|
|
215
|
+
} else {
|
|
216
|
+
const otg = tags.pop();
|
|
217
|
+
if (tagName !== otg.tagName) {
|
|
218
|
+
let openPos = getLineNumberForPosition(xmlData, otg.tagStartPos);
|
|
219
|
+
return getErrorObject('InvalidTag',
|
|
220
|
+
"Expected closing tag '"+otg.tagName+"' (opened in line "+openPos.line+", col "+openPos.col+") instead of closing tag '"+tagName+"'.",
|
|
221
|
+
getLineNumberForPosition(xmlData, tagStartPos));
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
//when there are no more tags, we reached the root level.
|
|
225
|
+
if (tags.length == 0) {
|
|
226
|
+
reachedRoot = true;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
} else {
|
|
230
|
+
const isValid = validateAttributeString(attrStr, options);
|
|
231
|
+
if (isValid !== true) {
|
|
232
|
+
//the result from the nested function returns the position of the error within the attribute
|
|
233
|
+
//in order to get the 'true' error line, we need to calculate the position where the attribute begins (i - attrStr.length) and then add the position within the attribute
|
|
234
|
+
//this gives us the absolute index in the entire xml, which we can use to find the line at last
|
|
235
|
+
return getErrorObject(isValid.err.code, isValid.err.msg, getLineNumberForPosition(xmlData, i - attrStr.length + isValid.err.line));
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
//if the root level has been reached before ...
|
|
239
|
+
if (reachedRoot === true) {
|
|
240
|
+
return getErrorObject('InvalidXml', 'Multiple possible root nodes found.', getLineNumberForPosition(xmlData, i));
|
|
241
|
+
} else if(options.unpairedTags.indexOf(tagName) !== -1); else {
|
|
242
|
+
tags.push({tagName, tagStartPos});
|
|
243
|
+
}
|
|
244
|
+
tagFound = true;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
//skip tag text value
|
|
248
|
+
//It may include comments and CDATA value
|
|
249
|
+
for (i++; i < xmlData.length; i++) {
|
|
250
|
+
if (xmlData[i] === '<') {
|
|
251
|
+
if (xmlData[i + 1] === '!') {
|
|
252
|
+
//comment or CADATA
|
|
253
|
+
i++;
|
|
254
|
+
i = readCommentAndCDATA(xmlData, i);
|
|
255
|
+
continue;
|
|
256
|
+
} else if (xmlData[i+1] === '?') {
|
|
257
|
+
i = readPI(xmlData, ++i);
|
|
258
|
+
if (i.err) return i;
|
|
259
|
+
} else {
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
} else if (xmlData[i] === '&') {
|
|
263
|
+
const afterAmp = validateAmpersand(xmlData, i);
|
|
264
|
+
if (afterAmp == -1)
|
|
265
|
+
return getErrorObject('InvalidChar', "char '&' is not expected.", getLineNumberForPosition(xmlData, i));
|
|
266
|
+
i = afterAmp;
|
|
267
|
+
}else {
|
|
268
|
+
if (reachedRoot === true && !isWhiteSpace(xmlData[i])) {
|
|
269
|
+
return getErrorObject('InvalidXml', "Extra text at the end", getLineNumberForPosition(xmlData, i));
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
} //end of reading tag text value
|
|
273
|
+
if (xmlData[i] === '<') {
|
|
274
|
+
i--;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
} else {
|
|
278
|
+
if ( isWhiteSpace(xmlData[i])) {
|
|
279
|
+
continue;
|
|
280
|
+
}
|
|
281
|
+
return getErrorObject('InvalidChar', "char '"+xmlData[i]+"' is not expected.", getLineNumberForPosition(xmlData, i));
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (!tagFound) {
|
|
286
|
+
return getErrorObject('InvalidXml', 'Start tag expected.', 1);
|
|
287
|
+
}else if (tags.length == 1) {
|
|
288
|
+
return getErrorObject('InvalidTag', "Unclosed tag '"+tags[0].tagName+"'.", getLineNumberForPosition(xmlData, tags[0].tagStartPos));
|
|
289
|
+
}else if (tags.length > 0) {
|
|
290
|
+
return getErrorObject('InvalidXml', "Invalid '"+
|
|
291
|
+
JSON.stringify(tags.map(t => t.tagName), null, 4).replace(/\r?\n/g, '')+
|
|
292
|
+
"' found.", {line: 1, col: 1});
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
return true;
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
function isWhiteSpace(char){
|
|
299
|
+
return char === ' ' || char === '\t' || char === '\n' || char === '\r';
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Read Processing insstructions and skip
|
|
303
|
+
* @param {*} xmlData
|
|
304
|
+
* @param {*} i
|
|
305
|
+
*/
|
|
306
|
+
function readPI(xmlData, i) {
|
|
307
|
+
const start = i;
|
|
308
|
+
for (; i < xmlData.length; i++) {
|
|
309
|
+
if (xmlData[i] == '?' || xmlData[i] == ' ') {
|
|
310
|
+
//tagname
|
|
311
|
+
const tagname = xmlData.substr(start, i - start);
|
|
312
|
+
if (i > 5 && tagname === 'xml') {
|
|
313
|
+
return getErrorObject('InvalidXml', 'XML declaration allowed only at the start of the document.', getLineNumberForPosition(xmlData, i));
|
|
314
|
+
} else if (xmlData[i] == '?' && xmlData[i + 1] == '>') {
|
|
315
|
+
//check if valid attribut string
|
|
316
|
+
i++;
|
|
317
|
+
break;
|
|
318
|
+
} else {
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return i;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function readCommentAndCDATA(xmlData, i) {
|
|
327
|
+
if (xmlData.length > i + 5 && xmlData[i + 1] === '-' && xmlData[i + 2] === '-') {
|
|
328
|
+
//comment
|
|
329
|
+
for (i += 3; i < xmlData.length; i++) {
|
|
330
|
+
if (xmlData[i] === '-' && xmlData[i + 1] === '-' && xmlData[i + 2] === '>') {
|
|
331
|
+
i += 2;
|
|
332
|
+
break;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
} else if (
|
|
336
|
+
xmlData.length > i + 8 &&
|
|
337
|
+
xmlData[i + 1] === 'D' &&
|
|
338
|
+
xmlData[i + 2] === 'O' &&
|
|
339
|
+
xmlData[i + 3] === 'C' &&
|
|
340
|
+
xmlData[i + 4] === 'T' &&
|
|
341
|
+
xmlData[i + 5] === 'Y' &&
|
|
342
|
+
xmlData[i + 6] === 'P' &&
|
|
343
|
+
xmlData[i + 7] === 'E'
|
|
344
|
+
) {
|
|
345
|
+
let angleBracketsCount = 1;
|
|
346
|
+
for (i += 8; i < xmlData.length; i++) {
|
|
347
|
+
if (xmlData[i] === '<') {
|
|
348
|
+
angleBracketsCount++;
|
|
349
|
+
} else if (xmlData[i] === '>') {
|
|
350
|
+
angleBracketsCount--;
|
|
351
|
+
if (angleBracketsCount === 0) {
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
} else if (
|
|
357
|
+
xmlData.length > i + 9 &&
|
|
358
|
+
xmlData[i + 1] === '[' &&
|
|
359
|
+
xmlData[i + 2] === 'C' &&
|
|
360
|
+
xmlData[i + 3] === 'D' &&
|
|
361
|
+
xmlData[i + 4] === 'A' &&
|
|
362
|
+
xmlData[i + 5] === 'T' &&
|
|
363
|
+
xmlData[i + 6] === 'A' &&
|
|
364
|
+
xmlData[i + 7] === '['
|
|
365
|
+
) {
|
|
366
|
+
for (i += 8; i < xmlData.length; i++) {
|
|
367
|
+
if (xmlData[i] === ']' && xmlData[i + 1] === ']' && xmlData[i + 2] === '>') {
|
|
368
|
+
i += 2;
|
|
369
|
+
break;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
return i;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
const doubleQuote = '"';
|
|
378
|
+
const singleQuote = "'";
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Keep reading xmlData until '<' is found outside the attribute value.
|
|
382
|
+
* @param {string} xmlData
|
|
383
|
+
* @param {number} i
|
|
384
|
+
*/
|
|
385
|
+
function readAttributeStr(xmlData, i) {
|
|
386
|
+
let attrStr = '';
|
|
387
|
+
let startChar = '';
|
|
388
|
+
let tagClosed = false;
|
|
389
|
+
for (; i < xmlData.length; i++) {
|
|
390
|
+
if (xmlData[i] === doubleQuote || xmlData[i] === singleQuote) {
|
|
391
|
+
if (startChar === '') {
|
|
392
|
+
startChar = xmlData[i];
|
|
393
|
+
} else if (startChar !== xmlData[i]) ; else {
|
|
394
|
+
startChar = '';
|
|
395
|
+
}
|
|
396
|
+
} else if (xmlData[i] === '>') {
|
|
397
|
+
if (startChar === '') {
|
|
398
|
+
tagClosed = true;
|
|
399
|
+
break;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
attrStr += xmlData[i];
|
|
403
|
+
}
|
|
404
|
+
if (startChar !== '') {
|
|
405
|
+
return false;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
return {
|
|
409
|
+
value: attrStr,
|
|
410
|
+
index: i,
|
|
411
|
+
tagClosed: tagClosed
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Select all the attributes whether valid or invalid.
|
|
417
|
+
*/
|
|
418
|
+
const validAttrStrRegxp = new RegExp('(\\s*)([^\\s=]+)(\\s*=)?(\\s*([\'"])(([\\s\\S])*?)\\5)?', 'g');
|
|
419
|
+
|
|
420
|
+
//attr, ="sd", a="amit's", a="sd"b="saf", ab cd=""
|
|
421
|
+
|
|
422
|
+
function validateAttributeString(attrStr, options) {
|
|
423
|
+
//console.log("start:"+attrStr+":end");
|
|
424
|
+
|
|
425
|
+
//if(attrStr.trim().length === 0) return true; //empty string
|
|
426
|
+
|
|
427
|
+
const matches = util.getAllMatches(attrStr, validAttrStrRegxp);
|
|
428
|
+
const attrNames = {};
|
|
429
|
+
|
|
430
|
+
for (let i = 0; i < matches.length; i++) {
|
|
431
|
+
if (matches[i][1].length === 0) {
|
|
432
|
+
//nospace before attribute name: a="sd"b="saf"
|
|
433
|
+
return getErrorObject('InvalidAttr', "Attribute '"+matches[i][2]+"' has no space in starting.", getPositionFromMatch(matches[i]))
|
|
434
|
+
} else if (matches[i][3] !== undefined && matches[i][4] === undefined) {
|
|
435
|
+
return getErrorObject('InvalidAttr', "Attribute '"+matches[i][2]+"' is without value.", getPositionFromMatch(matches[i]));
|
|
436
|
+
} else if (matches[i][3] === undefined && !options.allowBooleanAttributes) {
|
|
437
|
+
//independent attribute: ab
|
|
438
|
+
return getErrorObject('InvalidAttr', "boolean attribute '"+matches[i][2]+"' is not allowed.", getPositionFromMatch(matches[i]));
|
|
439
|
+
}
|
|
440
|
+
/* else if(matches[i][6] === undefined){//attribute without value: ab=
|
|
441
|
+
return { err: { code:"InvalidAttr",msg:"attribute " + matches[i][2] + " has no value assigned."}};
|
|
442
|
+
} */
|
|
443
|
+
const attrName = matches[i][2];
|
|
444
|
+
if (!validateAttrName(attrName)) {
|
|
445
|
+
return getErrorObject('InvalidAttr', "Attribute '"+attrName+"' is an invalid name.", getPositionFromMatch(matches[i]));
|
|
446
|
+
}
|
|
447
|
+
if (!attrNames.hasOwnProperty(attrName)) {
|
|
448
|
+
//check for duplicate attribute.
|
|
449
|
+
attrNames[attrName] = 1;
|
|
450
|
+
} else {
|
|
451
|
+
return getErrorObject('InvalidAttr', "Attribute '"+attrName+"' is repeated.", getPositionFromMatch(matches[i]));
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
return true;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
function validateNumberAmpersand(xmlData, i) {
|
|
459
|
+
let re = /\d/;
|
|
460
|
+
if (xmlData[i] === 'x') {
|
|
461
|
+
i++;
|
|
462
|
+
re = /[\da-fA-F]/;
|
|
463
|
+
}
|
|
464
|
+
for (; i < xmlData.length; i++) {
|
|
465
|
+
if (xmlData[i] === ';')
|
|
466
|
+
return i;
|
|
467
|
+
if (!xmlData[i].match(re))
|
|
468
|
+
break;
|
|
469
|
+
}
|
|
470
|
+
return -1;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
function validateAmpersand(xmlData, i) {
|
|
474
|
+
// https://www.w3.org/TR/xml/#dt-charref
|
|
475
|
+
i++;
|
|
476
|
+
if (xmlData[i] === ';')
|
|
477
|
+
return -1;
|
|
478
|
+
if (xmlData[i] === '#') {
|
|
479
|
+
i++;
|
|
480
|
+
return validateNumberAmpersand(xmlData, i);
|
|
481
|
+
}
|
|
482
|
+
let count = 0;
|
|
483
|
+
for (; i < xmlData.length; i++, count++) {
|
|
484
|
+
if (xmlData[i].match(/\w/) && count < 20)
|
|
485
|
+
continue;
|
|
486
|
+
if (xmlData[i] === ';')
|
|
487
|
+
break;
|
|
488
|
+
return -1;
|
|
489
|
+
}
|
|
490
|
+
return i;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
function getErrorObject(code, message, lineNumber) {
|
|
494
|
+
return {
|
|
495
|
+
err: {
|
|
496
|
+
code: code,
|
|
497
|
+
msg: message,
|
|
498
|
+
line: lineNumber.line || lineNumber,
|
|
499
|
+
col: lineNumber.col,
|
|
500
|
+
},
|
|
501
|
+
};
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
function validateAttrName(attrName) {
|
|
505
|
+
return util.isName(attrName);
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
// const startsWithXML = /^xml/i;
|
|
509
|
+
|
|
510
|
+
function validateTagName(tagname) {
|
|
511
|
+
return util.isName(tagname) /* && !tagname.match(startsWithXML) */;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
//this function returns the line number for the character at the given index
|
|
515
|
+
function getLineNumberForPosition(xmlData, index) {
|
|
516
|
+
const lines = xmlData.substring(0, index).split(/\r?\n/);
|
|
517
|
+
return {
|
|
518
|
+
line: lines.length,
|
|
519
|
+
|
|
520
|
+
// column number is last line's length + 1, because column numbering starts at 1:
|
|
521
|
+
col: lines[lines.length - 1].length + 1
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
//this function returns the position of the first character of match within attrStr
|
|
526
|
+
function getPositionFromMatch(match) {
|
|
527
|
+
return match.startIndex + match[1].length;
|
|
528
|
+
}
|
|
529
|
+
return validator;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
var OptionsBuilder = {};
|
|
533
|
+
|
|
534
|
+
var hasRequiredOptionsBuilder;
|
|
535
|
+
|
|
536
|
+
function requireOptionsBuilder () {
|
|
537
|
+
if (hasRequiredOptionsBuilder) return OptionsBuilder;
|
|
538
|
+
hasRequiredOptionsBuilder = 1;
|
|
539
|
+
const defaultOptions = {
|
|
540
|
+
preserveOrder: false,
|
|
541
|
+
attributeNamePrefix: '@_',
|
|
542
|
+
attributesGroupName: false,
|
|
543
|
+
textNodeName: '#text',
|
|
544
|
+
ignoreAttributes: true,
|
|
545
|
+
removeNSPrefix: false, // remove NS from tag name or attribute name if true
|
|
546
|
+
allowBooleanAttributes: false, //a tag can have attributes without any value
|
|
547
|
+
//ignoreRootElement : false,
|
|
548
|
+
parseTagValue: true,
|
|
549
|
+
parseAttributeValue: false,
|
|
550
|
+
trimValues: true, //Trim string values of tag and attributes
|
|
551
|
+
cdataPropName: false,
|
|
552
|
+
numberParseOptions: {
|
|
553
|
+
hex: true,
|
|
554
|
+
leadingZeros: true,
|
|
555
|
+
eNotation: true
|
|
556
|
+
},
|
|
557
|
+
tagValueProcessor: function(tagName, val) {
|
|
558
|
+
return val;
|
|
559
|
+
},
|
|
560
|
+
attributeValueProcessor: function(attrName, val) {
|
|
561
|
+
return val;
|
|
562
|
+
},
|
|
563
|
+
stopNodes: [], //nested tags will not be parsed even for errors
|
|
564
|
+
alwaysCreateTextNode: false,
|
|
565
|
+
isArray: () => false,
|
|
566
|
+
commentPropName: false,
|
|
567
|
+
unpairedTags: [],
|
|
568
|
+
processEntities: true,
|
|
569
|
+
htmlEntities: false,
|
|
570
|
+
ignoreDeclaration: false,
|
|
571
|
+
ignorePiTags: false,
|
|
572
|
+
transformTagName: false,
|
|
573
|
+
transformAttributeName: false,
|
|
574
|
+
updateTag: function(tagName, jPath, attrs){
|
|
575
|
+
return tagName
|
|
576
|
+
},
|
|
577
|
+
// skipEmptyListItem: false
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
const buildOptions = function(options) {
|
|
581
|
+
return Object.assign({}, defaultOptions, options);
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
OptionsBuilder.buildOptions = buildOptions;
|
|
585
|
+
OptionsBuilder.defaultOptions = defaultOptions;
|
|
586
|
+
return OptionsBuilder;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
var xmlNode;
|
|
590
|
+
var hasRequiredXmlNode;
|
|
591
|
+
|
|
592
|
+
function requireXmlNode () {
|
|
593
|
+
if (hasRequiredXmlNode) return xmlNode;
|
|
594
|
+
hasRequiredXmlNode = 1;
|
|
595
|
+
|
|
596
|
+
class XmlNode{
|
|
597
|
+
constructor(tagname) {
|
|
598
|
+
this.tagname = tagname;
|
|
599
|
+
this.child = []; //nested tags, text, cdata, comments in order
|
|
600
|
+
this[":@"] = {}; //attributes map
|
|
601
|
+
}
|
|
602
|
+
add(key,val){
|
|
603
|
+
// this.child.push( {name : key, val: val, isCdata: isCdata });
|
|
604
|
+
if(key === "__proto__") key = "#__proto__";
|
|
605
|
+
this.child.push( {[key]: val });
|
|
606
|
+
}
|
|
607
|
+
addChild(node) {
|
|
608
|
+
if(node.tagname === "__proto__") node.tagname = "#__proto__";
|
|
609
|
+
if(node[":@"] && Object.keys(node[":@"]).length > 0){
|
|
610
|
+
this.child.push( { [node.tagname]: node.child, [":@"]: node[":@"] });
|
|
611
|
+
}else {
|
|
612
|
+
this.child.push( { [node.tagname]: node.child });
|
|
613
|
+
}
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
xmlNode = XmlNode;
|
|
618
|
+
return xmlNode;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
var DocTypeReader;
|
|
622
|
+
var hasRequiredDocTypeReader;
|
|
623
|
+
|
|
624
|
+
function requireDocTypeReader () {
|
|
625
|
+
if (hasRequiredDocTypeReader) return DocTypeReader;
|
|
626
|
+
hasRequiredDocTypeReader = 1;
|
|
627
|
+
const util = requireUtil();
|
|
628
|
+
|
|
629
|
+
//TODO: handle comments
|
|
630
|
+
function readDocType(xmlData, i){
|
|
631
|
+
|
|
632
|
+
const entities = {};
|
|
633
|
+
if( xmlData[i + 3] === 'O' &&
|
|
634
|
+
xmlData[i + 4] === 'C' &&
|
|
635
|
+
xmlData[i + 5] === 'T' &&
|
|
636
|
+
xmlData[i + 6] === 'Y' &&
|
|
637
|
+
xmlData[i + 7] === 'P' &&
|
|
638
|
+
xmlData[i + 8] === 'E')
|
|
639
|
+
{
|
|
640
|
+
i = i+9;
|
|
641
|
+
let angleBracketsCount = 1;
|
|
642
|
+
let hasBody = false, comment = false;
|
|
643
|
+
let exp = "";
|
|
644
|
+
for(;i<xmlData.length;i++){
|
|
645
|
+
if (xmlData[i] === '<' && !comment) { //Determine the tag type
|
|
646
|
+
if( hasBody && isEntity(xmlData, i)){
|
|
647
|
+
i += 7;
|
|
648
|
+
[entityName, val,i] = readEntityExp(xmlData,i+1);
|
|
649
|
+
if(val.indexOf("&") === -1) //Parameter entities are not supported
|
|
650
|
+
entities[ validateEntityName(entityName) ] = {
|
|
651
|
+
regx : RegExp( `&${entityName};`,"g"),
|
|
652
|
+
val: val
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
else if( hasBody && isElement(xmlData, i)) i += 8;//Not supported
|
|
656
|
+
else if( hasBody && isAttlist(xmlData, i)) i += 8;//Not supported
|
|
657
|
+
else if( hasBody && isNotation(xmlData, i)) i += 9;//Not supported
|
|
658
|
+
else comment = true;
|
|
659
|
+
|
|
660
|
+
angleBracketsCount++;
|
|
661
|
+
exp = "";
|
|
662
|
+
} else if (xmlData[i] === '>') { //Read tag content
|
|
663
|
+
if(comment){
|
|
664
|
+
if( xmlData[i - 1] === "-" && xmlData[i - 2] === "-"){
|
|
665
|
+
comment = false;
|
|
666
|
+
angleBracketsCount--;
|
|
667
|
+
}
|
|
668
|
+
}else {
|
|
669
|
+
angleBracketsCount--;
|
|
670
|
+
}
|
|
671
|
+
if (angleBracketsCount === 0) {
|
|
672
|
+
break;
|
|
673
|
+
}
|
|
674
|
+
}else if( xmlData[i] === '['){
|
|
675
|
+
hasBody = true;
|
|
676
|
+
}else {
|
|
677
|
+
exp += xmlData[i];
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
if(angleBracketsCount !== 0){
|
|
681
|
+
throw new Error(`Unclosed DOCTYPE`);
|
|
682
|
+
}
|
|
683
|
+
}else {
|
|
684
|
+
throw new Error(`Invalid Tag instead of DOCTYPE`);
|
|
685
|
+
}
|
|
686
|
+
return {entities, i};
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
function readEntityExp(xmlData,i){
|
|
690
|
+
//External entities are not supported
|
|
691
|
+
// <!ENTITY ext SYSTEM "http://normal-website.com" >
|
|
692
|
+
|
|
693
|
+
//Parameter entities are not supported
|
|
694
|
+
// <!ENTITY entityname "&anotherElement;">
|
|
695
|
+
|
|
696
|
+
//Internal entities are supported
|
|
697
|
+
// <!ENTITY entityname "replacement text">
|
|
698
|
+
|
|
699
|
+
//read EntityName
|
|
700
|
+
let entityName = "";
|
|
701
|
+
for (; i < xmlData.length && (xmlData[i] !== "'" && xmlData[i] !== '"' ); i++) {
|
|
702
|
+
// if(xmlData[i] === " ") continue;
|
|
703
|
+
// else
|
|
704
|
+
entityName += xmlData[i];
|
|
705
|
+
}
|
|
706
|
+
entityName = entityName.trim();
|
|
707
|
+
if(entityName.indexOf(" ") !== -1) throw new Error("External entites are not supported");
|
|
708
|
+
|
|
709
|
+
//read Entity Value
|
|
710
|
+
const startChar = xmlData[i++];
|
|
711
|
+
let val = "";
|
|
712
|
+
for (; i < xmlData.length && xmlData[i] !== startChar ; i++) {
|
|
713
|
+
val += xmlData[i];
|
|
714
|
+
}
|
|
715
|
+
return [entityName, val, i];
|
|
716
|
+
}
|
|
717
|
+
function isEntity(xmlData, i){
|
|
718
|
+
if(xmlData[i+1] === '!' &&
|
|
719
|
+
xmlData[i+2] === 'E' &&
|
|
720
|
+
xmlData[i+3] === 'N' &&
|
|
721
|
+
xmlData[i+4] === 'T' &&
|
|
722
|
+
xmlData[i+5] === 'I' &&
|
|
723
|
+
xmlData[i+6] === 'T' &&
|
|
724
|
+
xmlData[i+7] === 'Y') return true
|
|
725
|
+
return false
|
|
726
|
+
}
|
|
727
|
+
function isElement(xmlData, i){
|
|
728
|
+
if(xmlData[i+1] === '!' &&
|
|
729
|
+
xmlData[i+2] === 'E' &&
|
|
730
|
+
xmlData[i+3] === 'L' &&
|
|
731
|
+
xmlData[i+4] === 'E' &&
|
|
732
|
+
xmlData[i+5] === 'M' &&
|
|
733
|
+
xmlData[i+6] === 'E' &&
|
|
734
|
+
xmlData[i+7] === 'N' &&
|
|
735
|
+
xmlData[i+8] === 'T') return true
|
|
736
|
+
return false
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
function isAttlist(xmlData, i){
|
|
740
|
+
if(xmlData[i+1] === '!' &&
|
|
741
|
+
xmlData[i+2] === 'A' &&
|
|
742
|
+
xmlData[i+3] === 'T' &&
|
|
743
|
+
xmlData[i+4] === 'T' &&
|
|
744
|
+
xmlData[i+5] === 'L' &&
|
|
745
|
+
xmlData[i+6] === 'I' &&
|
|
746
|
+
xmlData[i+7] === 'S' &&
|
|
747
|
+
xmlData[i+8] === 'T') return true
|
|
748
|
+
return false
|
|
749
|
+
}
|
|
750
|
+
function isNotation(xmlData, i){
|
|
751
|
+
if(xmlData[i+1] === '!' &&
|
|
752
|
+
xmlData[i+2] === 'N' &&
|
|
753
|
+
xmlData[i+3] === 'O' &&
|
|
754
|
+
xmlData[i+4] === 'T' &&
|
|
755
|
+
xmlData[i+5] === 'A' &&
|
|
756
|
+
xmlData[i+6] === 'T' &&
|
|
757
|
+
xmlData[i+7] === 'I' &&
|
|
758
|
+
xmlData[i+8] === 'O' &&
|
|
759
|
+
xmlData[i+9] === 'N') return true
|
|
760
|
+
return false
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
function validateEntityName(name){
|
|
764
|
+
if (util.isName(name))
|
|
765
|
+
return name;
|
|
766
|
+
else
|
|
767
|
+
throw new Error(`Invalid entity name ${name}`);
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
DocTypeReader = readDocType;
|
|
771
|
+
return DocTypeReader;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
var strnum;
|
|
775
|
+
var hasRequiredStrnum;
|
|
776
|
+
|
|
777
|
+
function requireStrnum () {
|
|
778
|
+
if (hasRequiredStrnum) return strnum;
|
|
779
|
+
hasRequiredStrnum = 1;
|
|
780
|
+
const hexRegex = /^[-+]?0x[a-fA-F0-9]+$/;
|
|
781
|
+
const numRegex = /^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;
|
|
782
|
+
// const octRegex = /0x[a-z0-9]+/;
|
|
783
|
+
// const binRegex = /0x[a-z0-9]+/;
|
|
784
|
+
|
|
785
|
+
|
|
786
|
+
//polyfill
|
|
787
|
+
if (!Number.parseInt && window.parseInt) {
|
|
788
|
+
Number.parseInt = window.parseInt;
|
|
789
|
+
}
|
|
790
|
+
if (!Number.parseFloat && window.parseFloat) {
|
|
791
|
+
Number.parseFloat = window.parseFloat;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
|
|
795
|
+
const consider = {
|
|
796
|
+
hex : true,
|
|
797
|
+
leadingZeros: true,
|
|
798
|
+
decimalPoint: "\.",
|
|
799
|
+
eNotation: true
|
|
800
|
+
//skipLike: /regex/
|
|
801
|
+
};
|
|
802
|
+
|
|
803
|
+
function toNumber(str, options = {}){
|
|
804
|
+
// const options = Object.assign({}, consider);
|
|
805
|
+
// if(opt.leadingZeros === false){
|
|
806
|
+
// options.leadingZeros = false;
|
|
807
|
+
// }else if(opt.hex === false){
|
|
808
|
+
// options.hex = false;
|
|
809
|
+
// }
|
|
810
|
+
|
|
811
|
+
options = Object.assign({}, consider, options );
|
|
812
|
+
if(!str || typeof str !== "string" ) return str;
|
|
813
|
+
|
|
814
|
+
let trimmedStr = str.trim();
|
|
815
|
+
// if(trimmedStr === "0.0") return 0;
|
|
816
|
+
// else if(trimmedStr === "+0.0") return 0;
|
|
817
|
+
// else if(trimmedStr === "-0.0") return -0;
|
|
818
|
+
|
|
819
|
+
if(options.skipLike !== undefined && options.skipLike.test(trimmedStr)) return str;
|
|
820
|
+
else if (options.hex && hexRegex.test(trimmedStr)) {
|
|
821
|
+
return Number.parseInt(trimmedStr, 16);
|
|
822
|
+
// } else if (options.parseOct && octRegex.test(str)) {
|
|
823
|
+
// return Number.parseInt(val, 8);
|
|
824
|
+
// }else if (options.parseBin && binRegex.test(str)) {
|
|
825
|
+
// return Number.parseInt(val, 2);
|
|
826
|
+
}else {
|
|
827
|
+
//separate negative sign, leading zeros, and rest number
|
|
828
|
+
const match = numRegex.exec(trimmedStr);
|
|
829
|
+
if(match){
|
|
830
|
+
const sign = match[1];
|
|
831
|
+
const leadingZeros = match[2];
|
|
832
|
+
let numTrimmedByZeros = trimZeros(match[3]); //complete num without leading zeros
|
|
833
|
+
//trim ending zeros for floating number
|
|
834
|
+
|
|
835
|
+
const eNotation = match[4] || match[6];
|
|
836
|
+
if(!options.leadingZeros && leadingZeros.length > 0 && sign && trimmedStr[2] !== ".") return str; //-0123
|
|
837
|
+
else if(!options.leadingZeros && leadingZeros.length > 0 && !sign && trimmedStr[1] !== ".") return str; //0123
|
|
838
|
+
else {//no leading zeros or leading zeros are allowed
|
|
839
|
+
const num = Number(trimmedStr);
|
|
840
|
+
const numStr = "" + num;
|
|
841
|
+
if(numStr.search(/[eE]/) !== -1){ //given number is long and parsed to eNotation
|
|
842
|
+
if(options.eNotation) return num;
|
|
843
|
+
else return str;
|
|
844
|
+
}else if(eNotation){ //given number has enotation
|
|
845
|
+
if(options.eNotation) return num;
|
|
846
|
+
else return str;
|
|
847
|
+
}else if(trimmedStr.indexOf(".") !== -1){ //floating number
|
|
848
|
+
// const decimalPart = match[5].substr(1);
|
|
849
|
+
// const intPart = trimmedStr.substr(0,trimmedStr.indexOf("."));
|
|
850
|
+
|
|
851
|
+
|
|
852
|
+
// const p = numStr.indexOf(".");
|
|
853
|
+
// const givenIntPart = numStr.substr(0,p);
|
|
854
|
+
// const givenDecPart = numStr.substr(p+1);
|
|
855
|
+
if(numStr === "0" && (numTrimmedByZeros === "") ) return num; //0.0
|
|
856
|
+
else if(numStr === numTrimmedByZeros) return num; //0.456. 0.79000
|
|
857
|
+
else if( sign && numStr === "-"+numTrimmedByZeros) return num;
|
|
858
|
+
else return str;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
if(leadingZeros){
|
|
862
|
+
// if(numTrimmedByZeros === numStr){
|
|
863
|
+
// if(options.leadingZeros) return num;
|
|
864
|
+
// else return str;
|
|
865
|
+
// }else return str;
|
|
866
|
+
if(numTrimmedByZeros === numStr) return num;
|
|
867
|
+
else if(sign+numTrimmedByZeros === numStr) return num;
|
|
868
|
+
else return str;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
if(trimmedStr === numStr) return num;
|
|
872
|
+
else if(trimmedStr === sign+numStr) return num;
|
|
873
|
+
// else{
|
|
874
|
+
// //number with +/- sign
|
|
875
|
+
// trimmedStr.test(/[-+][0-9]);
|
|
876
|
+
|
|
877
|
+
// }
|
|
878
|
+
return str;
|
|
879
|
+
}
|
|
880
|
+
// else if(!eNotation && trimmedStr && trimmedStr !== Number(trimmedStr) ) return str;
|
|
881
|
+
|
|
882
|
+
}else { //non-numeric string
|
|
883
|
+
return str;
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
/**
|
|
889
|
+
*
|
|
890
|
+
* @param {string} numStr without leading zeros
|
|
891
|
+
* @returns
|
|
892
|
+
*/
|
|
893
|
+
function trimZeros(numStr){
|
|
894
|
+
if(numStr && numStr.indexOf(".") !== -1){//float
|
|
895
|
+
numStr = numStr.replace(/0+$/, ""); //remove ending zeros
|
|
896
|
+
if(numStr === ".") numStr = "0";
|
|
897
|
+
else if(numStr[0] === ".") numStr = "0"+numStr;
|
|
898
|
+
else if(numStr[numStr.length-1] === ".") numStr = numStr.substr(0,numStr.length-1);
|
|
899
|
+
return numStr;
|
|
900
|
+
}
|
|
901
|
+
return numStr;
|
|
902
|
+
}
|
|
903
|
+
strnum = toNumber;
|
|
904
|
+
return strnum;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
var OrderedObjParser_1;
|
|
908
|
+
var hasRequiredOrderedObjParser;
|
|
909
|
+
|
|
910
|
+
function requireOrderedObjParser () {
|
|
911
|
+
if (hasRequiredOrderedObjParser) return OrderedObjParser_1;
|
|
912
|
+
hasRequiredOrderedObjParser = 1;
|
|
913
|
+
///@ts-check
|
|
914
|
+
|
|
915
|
+
const util = requireUtil();
|
|
916
|
+
const xmlNode = requireXmlNode();
|
|
917
|
+
const readDocType = requireDocTypeReader();
|
|
918
|
+
const toNumber = requireStrnum();
|
|
919
|
+
|
|
920
|
+
// const regx =
|
|
921
|
+
// '<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)'
|
|
922
|
+
// .replace(/NAME/g, util.nameRegexp);
|
|
923
|
+
|
|
924
|
+
//const tagsRegx = new RegExp("<(\\/?[\\w:\\-\._]+)([^>]*)>(\\s*"+cdataRegx+")*([^<]+)?","g");
|
|
925
|
+
//const tagsRegx = new RegExp("<(\\/?)((\\w*:)?([\\w:\\-\._]+))([^>]*)>([^<]*)("+cdataRegx+"([^<]*))*([^<]+)?","g");
|
|
926
|
+
|
|
927
|
+
class OrderedObjParser{
|
|
928
|
+
constructor(options){
|
|
929
|
+
this.options = options;
|
|
930
|
+
this.currentNode = null;
|
|
931
|
+
this.tagsNodeStack = [];
|
|
932
|
+
this.docTypeEntities = {};
|
|
933
|
+
this.lastEntities = {
|
|
934
|
+
"apos" : { regex: /&(apos|#39|#x27);/g, val : "'"},
|
|
935
|
+
"gt" : { regex: /&(gt|#62|#x3E);/g, val : ">"},
|
|
936
|
+
"lt" : { regex: /&(lt|#60|#x3C);/g, val : "<"},
|
|
937
|
+
"quot" : { regex: /&(quot|#34|#x22);/g, val : "\""},
|
|
938
|
+
};
|
|
939
|
+
this.ampEntity = { regex: /&(amp|#38|#x26);/g, val : "&"};
|
|
940
|
+
this.htmlEntities = {
|
|
941
|
+
"space": { regex: /&(nbsp|#160);/g, val: " " },
|
|
942
|
+
// "lt" : { regex: /&(lt|#60);/g, val: "<" },
|
|
943
|
+
// "gt" : { regex: /&(gt|#62);/g, val: ">" },
|
|
944
|
+
// "amp" : { regex: /&(amp|#38);/g, val: "&" },
|
|
945
|
+
// "quot" : { regex: /&(quot|#34);/g, val: "\"" },
|
|
946
|
+
// "apos" : { regex: /&(apos|#39);/g, val: "'" },
|
|
947
|
+
"cent" : { regex: /&(cent|#162);/g, val: "¢" },
|
|
948
|
+
"pound" : { regex: /&(pound|#163);/g, val: "£" },
|
|
949
|
+
"yen" : { regex: /&(yen|#165);/g, val: "¥" },
|
|
950
|
+
"euro" : { regex: /&(euro|#8364);/g, val: "€" },
|
|
951
|
+
"copyright" : { regex: /&(copy|#169);/g, val: "©" },
|
|
952
|
+
"reg" : { regex: /&(reg|#174);/g, val: "®" },
|
|
953
|
+
"inr" : { regex: /&(inr|#8377);/g, val: "₹" },
|
|
954
|
+
"num_dec": { regex: /&#([0-9]{1,7});/g, val : (_, str) => String.fromCharCode(Number.parseInt(str, 10)) },
|
|
955
|
+
"num_hex": { regex: /&#x([0-9a-fA-F]{1,6});/g, val : (_, str) => String.fromCharCode(Number.parseInt(str, 16)) },
|
|
956
|
+
};
|
|
957
|
+
this.addExternalEntities = addExternalEntities;
|
|
958
|
+
this.parseXml = parseXml;
|
|
959
|
+
this.parseTextData = parseTextData;
|
|
960
|
+
this.resolveNameSpace = resolveNameSpace;
|
|
961
|
+
this.buildAttributesMap = buildAttributesMap;
|
|
962
|
+
this.isItStopNode = isItStopNode;
|
|
963
|
+
this.replaceEntitiesValue = replaceEntitiesValue;
|
|
964
|
+
this.readStopNodeData = readStopNodeData;
|
|
965
|
+
this.saveTextToParentTag = saveTextToParentTag;
|
|
966
|
+
this.addChild = addChild;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
function addExternalEntities(externalEntities){
|
|
972
|
+
const entKeys = Object.keys(externalEntities);
|
|
973
|
+
for (let i = 0; i < entKeys.length; i++) {
|
|
974
|
+
const ent = entKeys[i];
|
|
975
|
+
this.lastEntities[ent] = {
|
|
976
|
+
regex: new RegExp("&"+ent+";","g"),
|
|
977
|
+
val : externalEntities[ent]
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
/**
|
|
983
|
+
* @param {string} val
|
|
984
|
+
* @param {string} tagName
|
|
985
|
+
* @param {string} jPath
|
|
986
|
+
* @param {boolean} dontTrim
|
|
987
|
+
* @param {boolean} hasAttributes
|
|
988
|
+
* @param {boolean} isLeafNode
|
|
989
|
+
* @param {boolean} escapeEntities
|
|
990
|
+
*/
|
|
991
|
+
function parseTextData(val, tagName, jPath, dontTrim, hasAttributes, isLeafNode, escapeEntities) {
|
|
992
|
+
if (val !== undefined) {
|
|
993
|
+
if (this.options.trimValues && !dontTrim) {
|
|
994
|
+
val = val.trim();
|
|
995
|
+
}
|
|
996
|
+
if(val.length > 0){
|
|
997
|
+
if(!escapeEntities) val = this.replaceEntitiesValue(val);
|
|
998
|
+
|
|
999
|
+
const newval = this.options.tagValueProcessor(tagName, val, jPath, hasAttributes, isLeafNode);
|
|
1000
|
+
if(newval === null || newval === undefined){
|
|
1001
|
+
//don't parse
|
|
1002
|
+
return val;
|
|
1003
|
+
}else if(typeof newval !== typeof val || newval !== val){
|
|
1004
|
+
//overwrite
|
|
1005
|
+
return newval;
|
|
1006
|
+
}else if(this.options.trimValues){
|
|
1007
|
+
return parseValue(val, this.options.parseTagValue, this.options.numberParseOptions);
|
|
1008
|
+
}else {
|
|
1009
|
+
const trimmedVal = val.trim();
|
|
1010
|
+
if(trimmedVal === val){
|
|
1011
|
+
return parseValue(val, this.options.parseTagValue, this.options.numberParseOptions);
|
|
1012
|
+
}else {
|
|
1013
|
+
return val;
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
function resolveNameSpace(tagname) {
|
|
1021
|
+
if (this.options.removeNSPrefix) {
|
|
1022
|
+
const tags = tagname.split(':');
|
|
1023
|
+
const prefix = tagname.charAt(0) === '/' ? '/' : '';
|
|
1024
|
+
if (tags[0] === 'xmlns') {
|
|
1025
|
+
return '';
|
|
1026
|
+
}
|
|
1027
|
+
if (tags.length === 2) {
|
|
1028
|
+
tagname = prefix + tags[1];
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
return tagname;
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
//TODO: change regex to capture NS
|
|
1035
|
+
//const attrsRegx = new RegExp("([\\w\\-\\.\\:]+)\\s*=\\s*(['\"])((.|\n)*?)\\2","gm");
|
|
1036
|
+
const attrsRegx = new RegExp('([^\\s=]+)\\s*(=\\s*([\'"])([\\s\\S]*?)\\3)?', 'gm');
|
|
1037
|
+
|
|
1038
|
+
function buildAttributesMap(attrStr, jPath, tagName) {
|
|
1039
|
+
if (!this.options.ignoreAttributes && typeof attrStr === 'string') {
|
|
1040
|
+
// attrStr = attrStr.replace(/\r?\n/g, ' ');
|
|
1041
|
+
//attrStr = attrStr || attrStr.trim();
|
|
1042
|
+
|
|
1043
|
+
const matches = util.getAllMatches(attrStr, attrsRegx);
|
|
1044
|
+
const len = matches.length; //don't make it inline
|
|
1045
|
+
const attrs = {};
|
|
1046
|
+
for (let i = 0; i < len; i++) {
|
|
1047
|
+
const attrName = this.resolveNameSpace(matches[i][1]);
|
|
1048
|
+
let oldVal = matches[i][4];
|
|
1049
|
+
let aName = this.options.attributeNamePrefix + attrName;
|
|
1050
|
+
if (attrName.length) {
|
|
1051
|
+
if (this.options.transformAttributeName) {
|
|
1052
|
+
aName = this.options.transformAttributeName(aName);
|
|
1053
|
+
}
|
|
1054
|
+
if(aName === "__proto__") aName = "#__proto__";
|
|
1055
|
+
if (oldVal !== undefined) {
|
|
1056
|
+
if (this.options.trimValues) {
|
|
1057
|
+
oldVal = oldVal.trim();
|
|
1058
|
+
}
|
|
1059
|
+
oldVal = this.replaceEntitiesValue(oldVal);
|
|
1060
|
+
const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPath);
|
|
1061
|
+
if(newVal === null || newVal === undefined){
|
|
1062
|
+
//don't parse
|
|
1063
|
+
attrs[aName] = oldVal;
|
|
1064
|
+
}else if(typeof newVal !== typeof oldVal || newVal !== oldVal){
|
|
1065
|
+
//overwrite
|
|
1066
|
+
attrs[aName] = newVal;
|
|
1067
|
+
}else {
|
|
1068
|
+
//parse
|
|
1069
|
+
attrs[aName] = parseValue(
|
|
1070
|
+
oldVal,
|
|
1071
|
+
this.options.parseAttributeValue,
|
|
1072
|
+
this.options.numberParseOptions
|
|
1073
|
+
);
|
|
1074
|
+
}
|
|
1075
|
+
} else if (this.options.allowBooleanAttributes) {
|
|
1076
|
+
attrs[aName] = true;
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
if (!Object.keys(attrs).length) {
|
|
1081
|
+
return;
|
|
1082
|
+
}
|
|
1083
|
+
if (this.options.attributesGroupName) {
|
|
1084
|
+
const attrCollection = {};
|
|
1085
|
+
attrCollection[this.options.attributesGroupName] = attrs;
|
|
1086
|
+
return attrCollection;
|
|
1087
|
+
}
|
|
1088
|
+
return attrs
|
|
1089
|
+
}
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
const parseXml = function(xmlData) {
|
|
1093
|
+
xmlData = xmlData.replace(/\r\n?/g, "\n"); //TODO: remove this line
|
|
1094
|
+
const xmlObj = new xmlNode('!xml');
|
|
1095
|
+
let currentNode = xmlObj;
|
|
1096
|
+
let textData = "";
|
|
1097
|
+
let jPath = "";
|
|
1098
|
+
for(let i=0; i< xmlData.length; i++){//for each char in XML data
|
|
1099
|
+
const ch = xmlData[i];
|
|
1100
|
+
if(ch === '<'){
|
|
1101
|
+
// const nextIndex = i+1;
|
|
1102
|
+
// const _2ndChar = xmlData[nextIndex];
|
|
1103
|
+
if( xmlData[i+1] === '/') {//Closing Tag
|
|
1104
|
+
const closeIndex = findClosingIndex(xmlData, ">", i, "Closing Tag is not closed.");
|
|
1105
|
+
let tagName = xmlData.substring(i+2,closeIndex).trim();
|
|
1106
|
+
|
|
1107
|
+
if(this.options.removeNSPrefix){
|
|
1108
|
+
const colonIndex = tagName.indexOf(":");
|
|
1109
|
+
if(colonIndex !== -1){
|
|
1110
|
+
tagName = tagName.substr(colonIndex+1);
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
if(this.options.transformTagName) {
|
|
1115
|
+
tagName = this.options.transformTagName(tagName);
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
if(currentNode){
|
|
1119
|
+
textData = this.saveTextToParentTag(textData, currentNode, jPath);
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
//check if last tag of nested tag was unpaired tag
|
|
1123
|
+
const lastTagName = jPath.substring(jPath.lastIndexOf(".")+1);
|
|
1124
|
+
if(tagName && this.options.unpairedTags.indexOf(tagName) !== -1 ){
|
|
1125
|
+
throw new Error(`Unpaired tag can not be used as closing tag: </${tagName}>`);
|
|
1126
|
+
}
|
|
1127
|
+
let propIndex = 0;
|
|
1128
|
+
if(lastTagName && this.options.unpairedTags.indexOf(lastTagName) !== -1 ){
|
|
1129
|
+
propIndex = jPath.lastIndexOf('.', jPath.lastIndexOf('.')-1);
|
|
1130
|
+
this.tagsNodeStack.pop();
|
|
1131
|
+
}else {
|
|
1132
|
+
propIndex = jPath.lastIndexOf(".");
|
|
1133
|
+
}
|
|
1134
|
+
jPath = jPath.substring(0, propIndex);
|
|
1135
|
+
|
|
1136
|
+
currentNode = this.tagsNodeStack.pop();//avoid recursion, set the parent tag scope
|
|
1137
|
+
textData = "";
|
|
1138
|
+
i = closeIndex;
|
|
1139
|
+
} else if( xmlData[i+1] === '?') {
|
|
1140
|
+
|
|
1141
|
+
let tagData = readTagExp(xmlData,i, false, "?>");
|
|
1142
|
+
if(!tagData) throw new Error("Pi Tag is not closed.");
|
|
1143
|
+
|
|
1144
|
+
textData = this.saveTextToParentTag(textData, currentNode, jPath);
|
|
1145
|
+
if( (this.options.ignoreDeclaration && tagData.tagName === "?xml") || this.options.ignorePiTags);else {
|
|
1146
|
+
|
|
1147
|
+
const childNode = new xmlNode(tagData.tagName);
|
|
1148
|
+
childNode.add(this.options.textNodeName, "");
|
|
1149
|
+
|
|
1150
|
+
if(tagData.tagName !== tagData.tagExp && tagData.attrExpPresent){
|
|
1151
|
+
childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath, tagData.tagName);
|
|
1152
|
+
}
|
|
1153
|
+
this.addChild(currentNode, childNode, jPath);
|
|
1154
|
+
|
|
1155
|
+
}
|
|
1156
|
+
|
|
1157
|
+
|
|
1158
|
+
i = tagData.closeIndex + 1;
|
|
1159
|
+
} else if(xmlData.substr(i + 1, 3) === '!--') {
|
|
1160
|
+
const endIndex = findClosingIndex(xmlData, "-->", i+4, "Comment is not closed.");
|
|
1161
|
+
if(this.options.commentPropName){
|
|
1162
|
+
const comment = xmlData.substring(i + 4, endIndex - 2);
|
|
1163
|
+
|
|
1164
|
+
textData = this.saveTextToParentTag(textData, currentNode, jPath);
|
|
1165
|
+
|
|
1166
|
+
currentNode.add(this.options.commentPropName, [ { [this.options.textNodeName] : comment } ]);
|
|
1167
|
+
}
|
|
1168
|
+
i = endIndex;
|
|
1169
|
+
} else if( xmlData.substr(i + 1, 2) === '!D') {
|
|
1170
|
+
const result = readDocType(xmlData, i);
|
|
1171
|
+
this.docTypeEntities = result.entities;
|
|
1172
|
+
i = result.i;
|
|
1173
|
+
}else if(xmlData.substr(i + 1, 2) === '![') {
|
|
1174
|
+
const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2;
|
|
1175
|
+
const tagExp = xmlData.substring(i + 9,closeIndex);
|
|
1176
|
+
|
|
1177
|
+
textData = this.saveTextToParentTag(textData, currentNode, jPath);
|
|
1178
|
+
|
|
1179
|
+
let val = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true, true);
|
|
1180
|
+
if(val == undefined) val = "";
|
|
1181
|
+
|
|
1182
|
+
//cdata should be set even if it is 0 length string
|
|
1183
|
+
if(this.options.cdataPropName){
|
|
1184
|
+
currentNode.add(this.options.cdataPropName, [ { [this.options.textNodeName] : tagExp } ]);
|
|
1185
|
+
}else {
|
|
1186
|
+
currentNode.add(this.options.textNodeName, val);
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
i = closeIndex + 2;
|
|
1190
|
+
}else {//Opening tag
|
|
1191
|
+
let result = readTagExp(xmlData,i, this.options.removeNSPrefix);
|
|
1192
|
+
let tagName= result.tagName;
|
|
1193
|
+
const rawTagName = result.rawTagName;
|
|
1194
|
+
let tagExp = result.tagExp;
|
|
1195
|
+
let attrExpPresent = result.attrExpPresent;
|
|
1196
|
+
let closeIndex = result.closeIndex;
|
|
1197
|
+
|
|
1198
|
+
if (this.options.transformTagName) {
|
|
1199
|
+
tagName = this.options.transformTagName(tagName);
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
//save text as child node
|
|
1203
|
+
if (currentNode && textData) {
|
|
1204
|
+
if(currentNode.tagname !== '!xml'){
|
|
1205
|
+
//when nested tag is found
|
|
1206
|
+
textData = this.saveTextToParentTag(textData, currentNode, jPath, false);
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
//check if last tag was unpaired tag
|
|
1211
|
+
const lastTag = currentNode;
|
|
1212
|
+
if(lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1 ){
|
|
1213
|
+
currentNode = this.tagsNodeStack.pop();
|
|
1214
|
+
jPath = jPath.substring(0, jPath.lastIndexOf("."));
|
|
1215
|
+
}
|
|
1216
|
+
if(tagName !== xmlObj.tagname){
|
|
1217
|
+
jPath += jPath ? "." + tagName : tagName;
|
|
1218
|
+
}
|
|
1219
|
+
if (this.isItStopNode(this.options.stopNodes, jPath, tagName)) {
|
|
1220
|
+
let tagContent = "";
|
|
1221
|
+
//self-closing tag
|
|
1222
|
+
if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
|
|
1223
|
+
if(tagName[tagName.length - 1] === "/"){ //remove trailing '/'
|
|
1224
|
+
tagName = tagName.substr(0, tagName.length - 1);
|
|
1225
|
+
jPath = jPath.substr(0, jPath.length - 1);
|
|
1226
|
+
tagExp = tagName;
|
|
1227
|
+
}else {
|
|
1228
|
+
tagExp = tagExp.substr(0, tagExp.length - 1);
|
|
1229
|
+
}
|
|
1230
|
+
i = result.closeIndex;
|
|
1231
|
+
}
|
|
1232
|
+
//unpaired tag
|
|
1233
|
+
else if(this.options.unpairedTags.indexOf(tagName) !== -1){
|
|
1234
|
+
|
|
1235
|
+
i = result.closeIndex;
|
|
1236
|
+
}
|
|
1237
|
+
//normal tag
|
|
1238
|
+
else {
|
|
1239
|
+
//read until closing tag is found
|
|
1240
|
+
const result = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
|
|
1241
|
+
if(!result) throw new Error(`Unexpected end of ${rawTagName}`);
|
|
1242
|
+
i = result.i;
|
|
1243
|
+
tagContent = result.tagContent;
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
const childNode = new xmlNode(tagName);
|
|
1247
|
+
if(tagName !== tagExp && attrExpPresent){
|
|
1248
|
+
childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
|
|
1249
|
+
}
|
|
1250
|
+
if(tagContent) {
|
|
1251
|
+
tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true);
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
jPath = jPath.substr(0, jPath.lastIndexOf("."));
|
|
1255
|
+
childNode.add(this.options.textNodeName, tagContent);
|
|
1256
|
+
|
|
1257
|
+
this.addChild(currentNode, childNode, jPath);
|
|
1258
|
+
}else {
|
|
1259
|
+
//selfClosing tag
|
|
1260
|
+
if(tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1){
|
|
1261
|
+
if(tagName[tagName.length - 1] === "/"){ //remove trailing '/'
|
|
1262
|
+
tagName = tagName.substr(0, tagName.length - 1);
|
|
1263
|
+
jPath = jPath.substr(0, jPath.length - 1);
|
|
1264
|
+
tagExp = tagName;
|
|
1265
|
+
}else {
|
|
1266
|
+
tagExp = tagExp.substr(0, tagExp.length - 1);
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
if(this.options.transformTagName) {
|
|
1270
|
+
tagName = this.options.transformTagName(tagName);
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
const childNode = new xmlNode(tagName);
|
|
1274
|
+
if(tagName !== tagExp && attrExpPresent){
|
|
1275
|
+
childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
|
|
1276
|
+
}
|
|
1277
|
+
this.addChild(currentNode, childNode, jPath);
|
|
1278
|
+
jPath = jPath.substr(0, jPath.lastIndexOf("."));
|
|
1279
|
+
}
|
|
1280
|
+
//opening tag
|
|
1281
|
+
else {
|
|
1282
|
+
const childNode = new xmlNode( tagName);
|
|
1283
|
+
this.tagsNodeStack.push(currentNode);
|
|
1284
|
+
|
|
1285
|
+
if(tagName !== tagExp && attrExpPresent){
|
|
1286
|
+
childNode[":@"] = this.buildAttributesMap(tagExp, jPath, tagName);
|
|
1287
|
+
}
|
|
1288
|
+
this.addChild(currentNode, childNode, jPath);
|
|
1289
|
+
currentNode = childNode;
|
|
1290
|
+
}
|
|
1291
|
+
textData = "";
|
|
1292
|
+
i = closeIndex;
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
}else {
|
|
1296
|
+
textData += xmlData[i];
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
return xmlObj.child;
|
|
1300
|
+
};
|
|
1301
|
+
|
|
1302
|
+
function addChild(currentNode, childNode, jPath){
|
|
1303
|
+
const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"]);
|
|
1304
|
+
if(result === false);else if(typeof result === "string"){
|
|
1305
|
+
childNode.tagname = result;
|
|
1306
|
+
currentNode.addChild(childNode);
|
|
1307
|
+
}else {
|
|
1308
|
+
currentNode.addChild(childNode);
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
const replaceEntitiesValue = function(val){
|
|
1313
|
+
|
|
1314
|
+
if(this.options.processEntities){
|
|
1315
|
+
for(let entityName in this.docTypeEntities){
|
|
1316
|
+
const entity = this.docTypeEntities[entityName];
|
|
1317
|
+
val = val.replace( entity.regx, entity.val);
|
|
1318
|
+
}
|
|
1319
|
+
for(let entityName in this.lastEntities){
|
|
1320
|
+
const entity = this.lastEntities[entityName];
|
|
1321
|
+
val = val.replace( entity.regex, entity.val);
|
|
1322
|
+
}
|
|
1323
|
+
if(this.options.htmlEntities){
|
|
1324
|
+
for(let entityName in this.htmlEntities){
|
|
1325
|
+
const entity = this.htmlEntities[entityName];
|
|
1326
|
+
val = val.replace( entity.regex, entity.val);
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
val = val.replace( this.ampEntity.regex, this.ampEntity.val);
|
|
1330
|
+
}
|
|
1331
|
+
return val;
|
|
1332
|
+
};
|
|
1333
|
+
function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) {
|
|
1334
|
+
if (textData) { //store previously collected data as textNode
|
|
1335
|
+
if(isLeafNode === undefined) isLeafNode = Object.keys(currentNode.child).length === 0;
|
|
1336
|
+
|
|
1337
|
+
textData = this.parseTextData(textData,
|
|
1338
|
+
currentNode.tagname,
|
|
1339
|
+
jPath,
|
|
1340
|
+
false,
|
|
1341
|
+
currentNode[":@"] ? Object.keys(currentNode[":@"]).length !== 0 : false,
|
|
1342
|
+
isLeafNode);
|
|
1343
|
+
|
|
1344
|
+
if (textData !== undefined && textData !== "")
|
|
1345
|
+
currentNode.add(this.options.textNodeName, textData);
|
|
1346
|
+
textData = "";
|
|
1347
|
+
}
|
|
1348
|
+
return textData;
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
//TODO: use jPath to simplify the logic
|
|
1352
|
+
/**
|
|
1353
|
+
*
|
|
1354
|
+
* @param {string[]} stopNodes
|
|
1355
|
+
* @param {string} jPath
|
|
1356
|
+
* @param {string} currentTagName
|
|
1357
|
+
*/
|
|
1358
|
+
function isItStopNode(stopNodes, jPath, currentTagName){
|
|
1359
|
+
const allNodesExp = "*." + currentTagName;
|
|
1360
|
+
for (const stopNodePath in stopNodes) {
|
|
1361
|
+
const stopNodeExp = stopNodes[stopNodePath];
|
|
1362
|
+
if( allNodesExp === stopNodeExp || jPath === stopNodeExp ) return true;
|
|
1363
|
+
}
|
|
1364
|
+
return false;
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
/**
|
|
1368
|
+
* Returns the tag Expression and where it is ending handling single-double quotes situation
|
|
1369
|
+
* @param {string} xmlData
|
|
1370
|
+
* @param {number} i starting index
|
|
1371
|
+
* @returns
|
|
1372
|
+
*/
|
|
1373
|
+
function tagExpWithClosingIndex(xmlData, i, closingChar = ">"){
|
|
1374
|
+
let attrBoundary;
|
|
1375
|
+
let tagExp = "";
|
|
1376
|
+
for (let index = i; index < xmlData.length; index++) {
|
|
1377
|
+
let ch = xmlData[index];
|
|
1378
|
+
if (attrBoundary) {
|
|
1379
|
+
if (ch === attrBoundary) attrBoundary = "";//reset
|
|
1380
|
+
} else if (ch === '"' || ch === "'") {
|
|
1381
|
+
attrBoundary = ch;
|
|
1382
|
+
} else if (ch === closingChar[0]) {
|
|
1383
|
+
if(closingChar[1]){
|
|
1384
|
+
if(xmlData[index + 1] === closingChar[1]){
|
|
1385
|
+
return {
|
|
1386
|
+
data: tagExp,
|
|
1387
|
+
index: index
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
}else {
|
|
1391
|
+
return {
|
|
1392
|
+
data: tagExp,
|
|
1393
|
+
index: index
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
} else if (ch === '\t') {
|
|
1397
|
+
ch = " ";
|
|
1398
|
+
}
|
|
1399
|
+
tagExp += ch;
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
function findClosingIndex(xmlData, str, i, errMsg){
|
|
1404
|
+
const closingIndex = xmlData.indexOf(str, i);
|
|
1405
|
+
if(closingIndex === -1){
|
|
1406
|
+
throw new Error(errMsg)
|
|
1407
|
+
}else {
|
|
1408
|
+
return closingIndex + str.length - 1;
|
|
1409
|
+
}
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
function readTagExp(xmlData,i, removeNSPrefix, closingChar = ">"){
|
|
1413
|
+
const result = tagExpWithClosingIndex(xmlData, i+1, closingChar);
|
|
1414
|
+
if(!result) return;
|
|
1415
|
+
let tagExp = result.data;
|
|
1416
|
+
const closeIndex = result.index;
|
|
1417
|
+
const separatorIndex = tagExp.search(/\s/);
|
|
1418
|
+
let tagName = tagExp;
|
|
1419
|
+
let attrExpPresent = true;
|
|
1420
|
+
if(separatorIndex !== -1){//separate tag name and attributes expression
|
|
1421
|
+
tagName = tagExp.substring(0, separatorIndex);
|
|
1422
|
+
tagExp = tagExp.substring(separatorIndex + 1).trimStart();
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
const rawTagName = tagName;
|
|
1426
|
+
if(removeNSPrefix){
|
|
1427
|
+
const colonIndex = tagName.indexOf(":");
|
|
1428
|
+
if(colonIndex !== -1){
|
|
1429
|
+
tagName = tagName.substr(colonIndex+1);
|
|
1430
|
+
attrExpPresent = tagName !== result.data.substr(colonIndex + 1);
|
|
1431
|
+
}
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
return {
|
|
1435
|
+
tagName: tagName,
|
|
1436
|
+
tagExp: tagExp,
|
|
1437
|
+
closeIndex: closeIndex,
|
|
1438
|
+
attrExpPresent: attrExpPresent,
|
|
1439
|
+
rawTagName: rawTagName,
|
|
1440
|
+
}
|
|
1441
|
+
}
|
|
1442
|
+
/**
|
|
1443
|
+
* find paired tag for a stop node
|
|
1444
|
+
* @param {string} xmlData
|
|
1445
|
+
* @param {string} tagName
|
|
1446
|
+
* @param {number} i
|
|
1447
|
+
*/
|
|
1448
|
+
function readStopNodeData(xmlData, tagName, i){
|
|
1449
|
+
const startIndex = i;
|
|
1450
|
+
// Starting at 1 since we already have an open tag
|
|
1451
|
+
let openTagCount = 1;
|
|
1452
|
+
|
|
1453
|
+
for (; i < xmlData.length; i++) {
|
|
1454
|
+
if( xmlData[i] === "<"){
|
|
1455
|
+
if (xmlData[i+1] === "/") {//close tag
|
|
1456
|
+
const closeIndex = findClosingIndex(xmlData, ">", i, `${tagName} is not closed`);
|
|
1457
|
+
let closeTagName = xmlData.substring(i+2,closeIndex).trim();
|
|
1458
|
+
if(closeTagName === tagName){
|
|
1459
|
+
openTagCount--;
|
|
1460
|
+
if (openTagCount === 0) {
|
|
1461
|
+
return {
|
|
1462
|
+
tagContent: xmlData.substring(startIndex, i),
|
|
1463
|
+
i : closeIndex
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
i=closeIndex;
|
|
1468
|
+
} else if(xmlData[i+1] === '?') {
|
|
1469
|
+
const closeIndex = findClosingIndex(xmlData, "?>", i+1, "StopNode is not closed.");
|
|
1470
|
+
i=closeIndex;
|
|
1471
|
+
} else if(xmlData.substr(i + 1, 3) === '!--') {
|
|
1472
|
+
const closeIndex = findClosingIndex(xmlData, "-->", i+3, "StopNode is not closed.");
|
|
1473
|
+
i=closeIndex;
|
|
1474
|
+
} else if(xmlData.substr(i + 1, 2) === '![') {
|
|
1475
|
+
const closeIndex = findClosingIndex(xmlData, "]]>", i, "StopNode is not closed.") - 2;
|
|
1476
|
+
i=closeIndex;
|
|
1477
|
+
} else {
|
|
1478
|
+
const tagData = readTagExp(xmlData, i, '>');
|
|
1479
|
+
|
|
1480
|
+
if (tagData) {
|
|
1481
|
+
const openTagName = tagData && tagData.tagName;
|
|
1482
|
+
if (openTagName === tagName && tagData.tagExp[tagData.tagExp.length-1] !== "/") {
|
|
1483
|
+
openTagCount++;
|
|
1484
|
+
}
|
|
1485
|
+
i=tagData.closeIndex;
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
}//end for loop
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
function parseValue(val, shouldParse, options) {
|
|
1493
|
+
if (shouldParse && typeof val === 'string') {
|
|
1494
|
+
//console.log(options)
|
|
1495
|
+
const newval = val.trim();
|
|
1496
|
+
if(newval === 'true' ) return true;
|
|
1497
|
+
else if(newval === 'false' ) return false;
|
|
1498
|
+
else return toNumber(val, options);
|
|
1499
|
+
} else {
|
|
1500
|
+
if (util.isExist(val)) {
|
|
1501
|
+
return val;
|
|
1502
|
+
} else {
|
|
1503
|
+
return '';
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
|
|
1509
|
+
OrderedObjParser_1 = OrderedObjParser;
|
|
1510
|
+
return OrderedObjParser_1;
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
var node2json = {};
|
|
1514
|
+
|
|
1515
|
+
var hasRequiredNode2json;
|
|
1516
|
+
|
|
1517
|
+
function requireNode2json () {
|
|
1518
|
+
if (hasRequiredNode2json) return node2json;
|
|
1519
|
+
hasRequiredNode2json = 1;
|
|
1520
|
+
|
|
1521
|
+
/**
|
|
1522
|
+
*
|
|
1523
|
+
* @param {array} node
|
|
1524
|
+
* @param {any} options
|
|
1525
|
+
* @returns
|
|
1526
|
+
*/
|
|
1527
|
+
function prettify(node, options){
|
|
1528
|
+
return compress( node, options);
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
/**
|
|
1532
|
+
*
|
|
1533
|
+
* @param {array} arr
|
|
1534
|
+
* @param {object} options
|
|
1535
|
+
* @param {string} jPath
|
|
1536
|
+
* @returns object
|
|
1537
|
+
*/
|
|
1538
|
+
function compress(arr, options, jPath){
|
|
1539
|
+
let text;
|
|
1540
|
+
const compressedObj = {};
|
|
1541
|
+
for (let i = 0; i < arr.length; i++) {
|
|
1542
|
+
const tagObj = arr[i];
|
|
1543
|
+
const property = propName(tagObj);
|
|
1544
|
+
let newJpath = "";
|
|
1545
|
+
if(jPath === undefined) newJpath = property;
|
|
1546
|
+
else newJpath = jPath + "." + property;
|
|
1547
|
+
|
|
1548
|
+
if(property === options.textNodeName){
|
|
1549
|
+
if(text === undefined) text = tagObj[property];
|
|
1550
|
+
else text += "" + tagObj[property];
|
|
1551
|
+
}else if(property === undefined){
|
|
1552
|
+
continue;
|
|
1553
|
+
}else if(tagObj[property]){
|
|
1554
|
+
|
|
1555
|
+
let val = compress(tagObj[property], options, newJpath);
|
|
1556
|
+
const isLeaf = isLeafTag(val, options);
|
|
1557
|
+
|
|
1558
|
+
if(tagObj[":@"]){
|
|
1559
|
+
assignAttributes( val, tagObj[":@"], newJpath, options);
|
|
1560
|
+
}else if(Object.keys(val).length === 1 && val[options.textNodeName] !== undefined && !options.alwaysCreateTextNode){
|
|
1561
|
+
val = val[options.textNodeName];
|
|
1562
|
+
}else if(Object.keys(val).length === 0){
|
|
1563
|
+
if(options.alwaysCreateTextNode) val[options.textNodeName] = "";
|
|
1564
|
+
else val = "";
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
if(compressedObj[property] !== undefined && compressedObj.hasOwnProperty(property)) {
|
|
1568
|
+
if(!Array.isArray(compressedObj[property])) {
|
|
1569
|
+
compressedObj[property] = [ compressedObj[property] ];
|
|
1570
|
+
}
|
|
1571
|
+
compressedObj[property].push(val);
|
|
1572
|
+
}else {
|
|
1573
|
+
//TODO: if a node is not an array, then check if it should be an array
|
|
1574
|
+
//also determine if it is a leaf node
|
|
1575
|
+
if (options.isArray(property, newJpath, isLeaf )) {
|
|
1576
|
+
compressedObj[property] = [val];
|
|
1577
|
+
}else {
|
|
1578
|
+
compressedObj[property] = val;
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1583
|
+
}
|
|
1584
|
+
// if(text && text.length > 0) compressedObj[options.textNodeName] = text;
|
|
1585
|
+
if(typeof text === "string"){
|
|
1586
|
+
if(text.length > 0) compressedObj[options.textNodeName] = text;
|
|
1587
|
+
}else if(text !== undefined) compressedObj[options.textNodeName] = text;
|
|
1588
|
+
return compressedObj;
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
function propName(obj){
|
|
1592
|
+
const keys = Object.keys(obj);
|
|
1593
|
+
for (let i = 0; i < keys.length; i++) {
|
|
1594
|
+
const key = keys[i];
|
|
1595
|
+
if(key !== ":@") return key;
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
function assignAttributes(obj, attrMap, jpath, options){
|
|
1600
|
+
if (attrMap) {
|
|
1601
|
+
const keys = Object.keys(attrMap);
|
|
1602
|
+
const len = keys.length; //don't make it inline
|
|
1603
|
+
for (let i = 0; i < len; i++) {
|
|
1604
|
+
const atrrName = keys[i];
|
|
1605
|
+
if (options.isArray(atrrName, jpath + "." + atrrName, true, true)) {
|
|
1606
|
+
obj[atrrName] = [ attrMap[atrrName] ];
|
|
1607
|
+
} else {
|
|
1608
|
+
obj[atrrName] = attrMap[atrrName];
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
function isLeafTag(obj, options){
|
|
1615
|
+
const { textNodeName } = options;
|
|
1616
|
+
const propCount = Object.keys(obj).length;
|
|
1617
|
+
|
|
1618
|
+
if (propCount === 0) {
|
|
1619
|
+
return true;
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
if (
|
|
1623
|
+
propCount === 1 &&
|
|
1624
|
+
(obj[textNodeName] || typeof obj[textNodeName] === "boolean" || obj[textNodeName] === 0)
|
|
1625
|
+
) {
|
|
1626
|
+
return true;
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
return false;
|
|
1630
|
+
}
|
|
1631
|
+
node2json.prettify = prettify;
|
|
1632
|
+
return node2json;
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
var XMLParser_1;
|
|
1636
|
+
var hasRequiredXMLParser;
|
|
1637
|
+
|
|
1638
|
+
function requireXMLParser () {
|
|
1639
|
+
if (hasRequiredXMLParser) return XMLParser_1;
|
|
1640
|
+
hasRequiredXMLParser = 1;
|
|
1641
|
+
const { buildOptions} = requireOptionsBuilder();
|
|
1642
|
+
const OrderedObjParser = requireOrderedObjParser();
|
|
1643
|
+
const { prettify} = requireNode2json();
|
|
1644
|
+
const validator = requireValidator();
|
|
1645
|
+
|
|
1646
|
+
class XMLParser{
|
|
1647
|
+
|
|
1648
|
+
constructor(options){
|
|
1649
|
+
this.externalEntities = {};
|
|
1650
|
+
this.options = buildOptions(options);
|
|
1651
|
+
|
|
1652
|
+
}
|
|
1653
|
+
/**
|
|
1654
|
+
* Parse XML dats to JS object
|
|
1655
|
+
* @param {string|Buffer} xmlData
|
|
1656
|
+
* @param {boolean|Object} validationOption
|
|
1657
|
+
*/
|
|
1658
|
+
parse(xmlData,validationOption){
|
|
1659
|
+
if(typeof xmlData === "string");else if( xmlData.toString){
|
|
1660
|
+
xmlData = xmlData.toString();
|
|
1661
|
+
}else {
|
|
1662
|
+
throw new Error("XML data is accepted in String or Bytes[] form.")
|
|
1663
|
+
}
|
|
1664
|
+
if( validationOption){
|
|
1665
|
+
if(validationOption === true) validationOption = {}; //validate with default options
|
|
1666
|
+
|
|
1667
|
+
const result = validator.validate(xmlData, validationOption);
|
|
1668
|
+
if (result !== true) {
|
|
1669
|
+
throw Error( `${result.err.msg}:${result.err.line}:${result.err.col}` )
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
const orderedObjParser = new OrderedObjParser(this.options);
|
|
1673
|
+
orderedObjParser.addExternalEntities(this.externalEntities);
|
|
1674
|
+
const orderedResult = orderedObjParser.parseXml(xmlData);
|
|
1675
|
+
if(this.options.preserveOrder || orderedResult === undefined) return orderedResult;
|
|
1676
|
+
else return prettify(orderedResult, this.options);
|
|
1677
|
+
}
|
|
1678
|
+
|
|
1679
|
+
/**
|
|
1680
|
+
* Add Entity which is not by default supported by this library
|
|
1681
|
+
* @param {string} key
|
|
1682
|
+
* @param {string} value
|
|
1683
|
+
*/
|
|
1684
|
+
addEntity(key, value){
|
|
1685
|
+
if(value.indexOf("&") !== -1){
|
|
1686
|
+
throw new Error("Entity value can't have '&'")
|
|
1687
|
+
}else if(key.indexOf("&") !== -1 || key.indexOf(";") !== -1){
|
|
1688
|
+
throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'")
|
|
1689
|
+
}else if(value === "&"){
|
|
1690
|
+
throw new Error("An entity with value '&' is not permitted");
|
|
1691
|
+
}else {
|
|
1692
|
+
this.externalEntities[key] = value;
|
|
1693
|
+
}
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
XMLParser_1 = XMLParser;
|
|
1698
|
+
return XMLParser_1;
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
var orderedJs2Xml;
|
|
1702
|
+
var hasRequiredOrderedJs2Xml;
|
|
1703
|
+
|
|
1704
|
+
function requireOrderedJs2Xml () {
|
|
1705
|
+
if (hasRequiredOrderedJs2Xml) return orderedJs2Xml;
|
|
1706
|
+
hasRequiredOrderedJs2Xml = 1;
|
|
1707
|
+
const EOL = "\n";
|
|
1708
|
+
|
|
1709
|
+
/**
|
|
1710
|
+
*
|
|
1711
|
+
* @param {array} jArray
|
|
1712
|
+
* @param {any} options
|
|
1713
|
+
* @returns
|
|
1714
|
+
*/
|
|
1715
|
+
function toXml(jArray, options) {
|
|
1716
|
+
let indentation = "";
|
|
1717
|
+
if (options.format && options.indentBy.length > 0) {
|
|
1718
|
+
indentation = EOL;
|
|
1719
|
+
}
|
|
1720
|
+
return arrToStr(jArray, options, "", indentation);
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
function arrToStr(arr, options, jPath, indentation) {
|
|
1724
|
+
let xmlStr = "";
|
|
1725
|
+
let isPreviousElementTag = false;
|
|
1726
|
+
|
|
1727
|
+
for (let i = 0; i < arr.length; i++) {
|
|
1728
|
+
const tagObj = arr[i];
|
|
1729
|
+
const tagName = propName(tagObj);
|
|
1730
|
+
if(tagName === undefined) continue;
|
|
1731
|
+
|
|
1732
|
+
let newJPath = "";
|
|
1733
|
+
if (jPath.length === 0) newJPath = tagName;
|
|
1734
|
+
else newJPath = `${jPath}.${tagName}`;
|
|
1735
|
+
|
|
1736
|
+
if (tagName === options.textNodeName) {
|
|
1737
|
+
let tagText = tagObj[tagName];
|
|
1738
|
+
if (!isStopNode(newJPath, options)) {
|
|
1739
|
+
tagText = options.tagValueProcessor(tagName, tagText);
|
|
1740
|
+
tagText = replaceEntitiesValue(tagText, options);
|
|
1741
|
+
}
|
|
1742
|
+
if (isPreviousElementTag) {
|
|
1743
|
+
xmlStr += indentation;
|
|
1744
|
+
}
|
|
1745
|
+
xmlStr += tagText;
|
|
1746
|
+
isPreviousElementTag = false;
|
|
1747
|
+
continue;
|
|
1748
|
+
} else if (tagName === options.cdataPropName) {
|
|
1749
|
+
if (isPreviousElementTag) {
|
|
1750
|
+
xmlStr += indentation;
|
|
1751
|
+
}
|
|
1752
|
+
xmlStr += `<![CDATA[${tagObj[tagName][0][options.textNodeName]}]]>`;
|
|
1753
|
+
isPreviousElementTag = false;
|
|
1754
|
+
continue;
|
|
1755
|
+
} else if (tagName === options.commentPropName) {
|
|
1756
|
+
xmlStr += indentation + `<!--${tagObj[tagName][0][options.textNodeName]}-->`;
|
|
1757
|
+
isPreviousElementTag = true;
|
|
1758
|
+
continue;
|
|
1759
|
+
} else if (tagName[0] === "?") {
|
|
1760
|
+
const attStr = attr_to_str(tagObj[":@"], options);
|
|
1761
|
+
const tempInd = tagName === "?xml" ? "" : indentation;
|
|
1762
|
+
let piTextNodeName = tagObj[tagName][0][options.textNodeName];
|
|
1763
|
+
piTextNodeName = piTextNodeName.length !== 0 ? " " + piTextNodeName : ""; //remove extra spacing
|
|
1764
|
+
xmlStr += tempInd + `<${tagName}${piTextNodeName}${attStr}?>`;
|
|
1765
|
+
isPreviousElementTag = true;
|
|
1766
|
+
continue;
|
|
1767
|
+
}
|
|
1768
|
+
let newIdentation = indentation;
|
|
1769
|
+
if (newIdentation !== "") {
|
|
1770
|
+
newIdentation += options.indentBy;
|
|
1771
|
+
}
|
|
1772
|
+
const attStr = attr_to_str(tagObj[":@"], options);
|
|
1773
|
+
const tagStart = indentation + `<${tagName}${attStr}`;
|
|
1774
|
+
const tagValue = arrToStr(tagObj[tagName], options, newJPath, newIdentation);
|
|
1775
|
+
if (options.unpairedTags.indexOf(tagName) !== -1) {
|
|
1776
|
+
if (options.suppressUnpairedNode) xmlStr += tagStart + ">";
|
|
1777
|
+
else xmlStr += tagStart + "/>";
|
|
1778
|
+
} else if ((!tagValue || tagValue.length === 0) && options.suppressEmptyNode) {
|
|
1779
|
+
xmlStr += tagStart + "/>";
|
|
1780
|
+
} else if (tagValue && tagValue.endsWith(">")) {
|
|
1781
|
+
xmlStr += tagStart + `>${tagValue}${indentation}</${tagName}>`;
|
|
1782
|
+
} else {
|
|
1783
|
+
xmlStr += tagStart + ">";
|
|
1784
|
+
if (tagValue && indentation !== "" && (tagValue.includes("/>") || tagValue.includes("</"))) {
|
|
1785
|
+
xmlStr += indentation + options.indentBy + tagValue + indentation;
|
|
1786
|
+
} else {
|
|
1787
|
+
xmlStr += tagValue;
|
|
1788
|
+
}
|
|
1789
|
+
xmlStr += `</${tagName}>`;
|
|
1790
|
+
}
|
|
1791
|
+
isPreviousElementTag = true;
|
|
1792
|
+
}
|
|
1793
|
+
|
|
1794
|
+
return xmlStr;
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
function propName(obj) {
|
|
1798
|
+
const keys = Object.keys(obj);
|
|
1799
|
+
for (let i = 0; i < keys.length; i++) {
|
|
1800
|
+
const key = keys[i];
|
|
1801
|
+
if(!obj.hasOwnProperty(key)) continue;
|
|
1802
|
+
if (key !== ":@") return key;
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
function attr_to_str(attrMap, options) {
|
|
1807
|
+
let attrStr = "";
|
|
1808
|
+
if (attrMap && !options.ignoreAttributes) {
|
|
1809
|
+
for (let attr in attrMap) {
|
|
1810
|
+
if(!attrMap.hasOwnProperty(attr)) continue;
|
|
1811
|
+
let attrVal = options.attributeValueProcessor(attr, attrMap[attr]);
|
|
1812
|
+
attrVal = replaceEntitiesValue(attrVal, options);
|
|
1813
|
+
if (attrVal === true && options.suppressBooleanAttributes) {
|
|
1814
|
+
attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}`;
|
|
1815
|
+
} else {
|
|
1816
|
+
attrStr += ` ${attr.substr(options.attributeNamePrefix.length)}="${attrVal}"`;
|
|
1817
|
+
}
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
return attrStr;
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
function isStopNode(jPath, options) {
|
|
1824
|
+
jPath = jPath.substr(0, jPath.length - options.textNodeName.length - 1);
|
|
1825
|
+
let tagName = jPath.substr(jPath.lastIndexOf(".") + 1);
|
|
1826
|
+
for (let index in options.stopNodes) {
|
|
1827
|
+
if (options.stopNodes[index] === jPath || options.stopNodes[index] === "*." + tagName) return true;
|
|
1828
|
+
}
|
|
1829
|
+
return false;
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
function replaceEntitiesValue(textValue, options) {
|
|
1833
|
+
if (textValue && textValue.length > 0 && options.processEntities) {
|
|
1834
|
+
for (let i = 0; i < options.entities.length; i++) {
|
|
1835
|
+
const entity = options.entities[i];
|
|
1836
|
+
textValue = textValue.replace(entity.regex, entity.val);
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
return textValue;
|
|
1840
|
+
}
|
|
1841
|
+
orderedJs2Xml = toXml;
|
|
1842
|
+
return orderedJs2Xml;
|
|
1843
|
+
}
|
|
1844
|
+
|
|
1845
|
+
var json2xml;
|
|
1846
|
+
var hasRequiredJson2xml;
|
|
1847
|
+
|
|
1848
|
+
function requireJson2xml () {
|
|
1849
|
+
if (hasRequiredJson2xml) return json2xml;
|
|
1850
|
+
hasRequiredJson2xml = 1;
|
|
1851
|
+
//parse Empty Node as self closing node
|
|
1852
|
+
const buildFromOrderedJs = requireOrderedJs2Xml();
|
|
1853
|
+
|
|
1854
|
+
const defaultOptions = {
|
|
1855
|
+
attributeNamePrefix: '@_',
|
|
1856
|
+
attributesGroupName: false,
|
|
1857
|
+
textNodeName: '#text',
|
|
1858
|
+
ignoreAttributes: true,
|
|
1859
|
+
cdataPropName: false,
|
|
1860
|
+
format: false,
|
|
1861
|
+
indentBy: ' ',
|
|
1862
|
+
suppressEmptyNode: false,
|
|
1863
|
+
suppressUnpairedNode: true,
|
|
1864
|
+
suppressBooleanAttributes: true,
|
|
1865
|
+
tagValueProcessor: function(key, a) {
|
|
1866
|
+
return a;
|
|
1867
|
+
},
|
|
1868
|
+
attributeValueProcessor: function(attrName, a) {
|
|
1869
|
+
return a;
|
|
1870
|
+
},
|
|
1871
|
+
preserveOrder: false,
|
|
1872
|
+
commentPropName: false,
|
|
1873
|
+
unpairedTags: [],
|
|
1874
|
+
entities: [
|
|
1875
|
+
{ regex: new RegExp("&", "g"), val: "&" },//it must be on top
|
|
1876
|
+
{ regex: new RegExp(">", "g"), val: ">" },
|
|
1877
|
+
{ regex: new RegExp("<", "g"), val: "<" },
|
|
1878
|
+
{ regex: new RegExp("\'", "g"), val: "'" },
|
|
1879
|
+
{ regex: new RegExp("\"", "g"), val: """ }
|
|
1880
|
+
],
|
|
1881
|
+
processEntities: true,
|
|
1882
|
+
stopNodes: [],
|
|
1883
|
+
// transformTagName: false,
|
|
1884
|
+
// transformAttributeName: false,
|
|
1885
|
+
oneListGroup: false
|
|
1886
|
+
};
|
|
1887
|
+
|
|
1888
|
+
function Builder(options) {
|
|
1889
|
+
this.options = Object.assign({}, defaultOptions, options);
|
|
1890
|
+
if (this.options.ignoreAttributes || this.options.attributesGroupName) {
|
|
1891
|
+
this.isAttribute = function(/*a*/) {
|
|
1892
|
+
return false;
|
|
1893
|
+
};
|
|
1894
|
+
} else {
|
|
1895
|
+
this.attrPrefixLen = this.options.attributeNamePrefix.length;
|
|
1896
|
+
this.isAttribute = isAttribute;
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
this.processTextOrObjNode = processTextOrObjNode;
|
|
1900
|
+
|
|
1901
|
+
if (this.options.format) {
|
|
1902
|
+
this.indentate = indentate;
|
|
1903
|
+
this.tagEndChar = '>\n';
|
|
1904
|
+
this.newLine = '\n';
|
|
1905
|
+
} else {
|
|
1906
|
+
this.indentate = function() {
|
|
1907
|
+
return '';
|
|
1908
|
+
};
|
|
1909
|
+
this.tagEndChar = '>';
|
|
1910
|
+
this.newLine = '';
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
Builder.prototype.build = function(jObj) {
|
|
1915
|
+
if(this.options.preserveOrder){
|
|
1916
|
+
return buildFromOrderedJs(jObj, this.options);
|
|
1917
|
+
}else {
|
|
1918
|
+
if(Array.isArray(jObj) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1){
|
|
1919
|
+
jObj = {
|
|
1920
|
+
[this.options.arrayNodeName] : jObj
|
|
1921
|
+
};
|
|
1922
|
+
}
|
|
1923
|
+
return this.j2x(jObj, 0).val;
|
|
1924
|
+
}
|
|
1925
|
+
};
|
|
1926
|
+
|
|
1927
|
+
Builder.prototype.j2x = function(jObj, level) {
|
|
1928
|
+
let attrStr = '';
|
|
1929
|
+
let val = '';
|
|
1930
|
+
for (let key in jObj) {
|
|
1931
|
+
if(!Object.prototype.hasOwnProperty.call(jObj, key)) continue;
|
|
1932
|
+
if (typeof jObj[key] === 'undefined') {
|
|
1933
|
+
// supress undefined node only if it is not an attribute
|
|
1934
|
+
if (this.isAttribute(key)) {
|
|
1935
|
+
val += '';
|
|
1936
|
+
}
|
|
1937
|
+
} else if (jObj[key] === null) {
|
|
1938
|
+
// null attribute should be ignored by the attribute list, but should not cause the tag closing
|
|
1939
|
+
if (this.isAttribute(key)) {
|
|
1940
|
+
val += '';
|
|
1941
|
+
} else if (key[0] === '?') {
|
|
1942
|
+
val += this.indentate(level) + '<' + key + '?' + this.tagEndChar;
|
|
1943
|
+
} else {
|
|
1944
|
+
val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
|
|
1945
|
+
}
|
|
1946
|
+
// val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
|
|
1947
|
+
} else if (jObj[key] instanceof Date) {
|
|
1948
|
+
val += this.buildTextValNode(jObj[key], key, '', level);
|
|
1949
|
+
} else if (typeof jObj[key] !== 'object') {
|
|
1950
|
+
//premitive type
|
|
1951
|
+
const attr = this.isAttribute(key);
|
|
1952
|
+
if (attr) {
|
|
1953
|
+
attrStr += this.buildAttrPairStr(attr, '' + jObj[key]);
|
|
1954
|
+
}else {
|
|
1955
|
+
//tag value
|
|
1956
|
+
if (key === this.options.textNodeName) {
|
|
1957
|
+
let newval = this.options.tagValueProcessor(key, '' + jObj[key]);
|
|
1958
|
+
val += this.replaceEntitiesValue(newval);
|
|
1959
|
+
} else {
|
|
1960
|
+
val += this.buildTextValNode(jObj[key], key, '', level);
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
} else if (Array.isArray(jObj[key])) {
|
|
1964
|
+
//repeated nodes
|
|
1965
|
+
const arrLen = jObj[key].length;
|
|
1966
|
+
let listTagVal = "";
|
|
1967
|
+
let listTagAttr = "";
|
|
1968
|
+
for (let j = 0; j < arrLen; j++) {
|
|
1969
|
+
const item = jObj[key][j];
|
|
1970
|
+
if (typeof item === 'undefined') ; else if (item === null) {
|
|
1971
|
+
if(key[0] === "?") val += this.indentate(level) + '<' + key + '?' + this.tagEndChar;
|
|
1972
|
+
else val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
|
|
1973
|
+
// val += this.indentate(level) + '<' + key + '/' + this.tagEndChar;
|
|
1974
|
+
} else if (typeof item === 'object') {
|
|
1975
|
+
if(this.options.oneListGroup){
|
|
1976
|
+
const result = this.j2x(item, level + 1);
|
|
1977
|
+
listTagVal += result.val;
|
|
1978
|
+
if (this.options.attributesGroupName && item.hasOwnProperty(this.options.attributesGroupName)) {
|
|
1979
|
+
listTagAttr += result.attrStr;
|
|
1980
|
+
}
|
|
1981
|
+
}else {
|
|
1982
|
+
listTagVal += this.processTextOrObjNode(item, key, level);
|
|
1983
|
+
}
|
|
1984
|
+
} else {
|
|
1985
|
+
if (this.options.oneListGroup) {
|
|
1986
|
+
let textValue = this.options.tagValueProcessor(key, item);
|
|
1987
|
+
textValue = this.replaceEntitiesValue(textValue);
|
|
1988
|
+
listTagVal += textValue;
|
|
1989
|
+
} else {
|
|
1990
|
+
listTagVal += this.buildTextValNode(item, key, '', level);
|
|
1991
|
+
}
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
if(this.options.oneListGroup){
|
|
1995
|
+
listTagVal = this.buildObjectNode(listTagVal, key, listTagAttr, level);
|
|
1996
|
+
}
|
|
1997
|
+
val += listTagVal;
|
|
1998
|
+
} else {
|
|
1999
|
+
//nested node
|
|
2000
|
+
if (this.options.attributesGroupName && key === this.options.attributesGroupName) {
|
|
2001
|
+
const Ks = Object.keys(jObj[key]);
|
|
2002
|
+
const L = Ks.length;
|
|
2003
|
+
for (let j = 0; j < L; j++) {
|
|
2004
|
+
attrStr += this.buildAttrPairStr(Ks[j], '' + jObj[key][Ks[j]]);
|
|
2005
|
+
}
|
|
2006
|
+
} else {
|
|
2007
|
+
val += this.processTextOrObjNode(jObj[key], key, level);
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
return {attrStr: attrStr, val: val};
|
|
2012
|
+
};
|
|
2013
|
+
|
|
2014
|
+
Builder.prototype.buildAttrPairStr = function(attrName, val){
|
|
2015
|
+
val = this.options.attributeValueProcessor(attrName, '' + val);
|
|
2016
|
+
val = this.replaceEntitiesValue(val);
|
|
2017
|
+
if (this.options.suppressBooleanAttributes && val === "true") {
|
|
2018
|
+
return ' ' + attrName;
|
|
2019
|
+
} else return ' ' + attrName + '="' + val + '"';
|
|
2020
|
+
};
|
|
2021
|
+
|
|
2022
|
+
function processTextOrObjNode (object, key, level) {
|
|
2023
|
+
const result = this.j2x(object, level + 1);
|
|
2024
|
+
if (object[this.options.textNodeName] !== undefined && Object.keys(object).length === 1) {
|
|
2025
|
+
return this.buildTextValNode(object[this.options.textNodeName], key, result.attrStr, level);
|
|
2026
|
+
} else {
|
|
2027
|
+
return this.buildObjectNode(result.val, key, result.attrStr, level);
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
|
|
2031
|
+
Builder.prototype.buildObjectNode = function(val, key, attrStr, level) {
|
|
2032
|
+
if(val === ""){
|
|
2033
|
+
if(key[0] === "?") return this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar;
|
|
2034
|
+
else {
|
|
2035
|
+
return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar;
|
|
2036
|
+
}
|
|
2037
|
+
}else {
|
|
2038
|
+
|
|
2039
|
+
let tagEndExp = '</' + key + this.tagEndChar;
|
|
2040
|
+
let piClosingChar = "";
|
|
2041
|
+
|
|
2042
|
+
if(key[0] === "?") {
|
|
2043
|
+
piClosingChar = "?";
|
|
2044
|
+
tagEndExp = "";
|
|
2045
|
+
}
|
|
2046
|
+
|
|
2047
|
+
// attrStr is an empty string in case the attribute came as undefined or null
|
|
2048
|
+
if ((attrStr || attrStr === '') && val.indexOf('<') === -1) {
|
|
2049
|
+
return ( this.indentate(level) + '<' + key + attrStr + piClosingChar + '>' + val + tagEndExp );
|
|
2050
|
+
} else if (this.options.commentPropName !== false && key === this.options.commentPropName && piClosingChar.length === 0) {
|
|
2051
|
+
return this.indentate(level) + `<!--${val}-->` + this.newLine;
|
|
2052
|
+
}else {
|
|
2053
|
+
return (
|
|
2054
|
+
this.indentate(level) + '<' + key + attrStr + piClosingChar + this.tagEndChar +
|
|
2055
|
+
val +
|
|
2056
|
+
this.indentate(level) + tagEndExp );
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
};
|
|
2060
|
+
|
|
2061
|
+
Builder.prototype.closeTag = function(key){
|
|
2062
|
+
let closeTag = "";
|
|
2063
|
+
if(this.options.unpairedTags.indexOf(key) !== -1){ //unpaired
|
|
2064
|
+
if(!this.options.suppressUnpairedNode) closeTag = "/";
|
|
2065
|
+
}else if(this.options.suppressEmptyNode){ //empty
|
|
2066
|
+
closeTag = "/";
|
|
2067
|
+
}else {
|
|
2068
|
+
closeTag = `></${key}`;
|
|
2069
|
+
}
|
|
2070
|
+
return closeTag;
|
|
2071
|
+
};
|
|
2072
|
+
|
|
2073
|
+
Builder.prototype.buildTextValNode = function(val, key, attrStr, level) {
|
|
2074
|
+
if (this.options.cdataPropName !== false && key === this.options.cdataPropName) {
|
|
2075
|
+
return this.indentate(level) + `<![CDATA[${val}]]>` + this.newLine;
|
|
2076
|
+
}else if (this.options.commentPropName !== false && key === this.options.commentPropName) {
|
|
2077
|
+
return this.indentate(level) + `<!--${val}-->` + this.newLine;
|
|
2078
|
+
}else if(key[0] === "?") {//PI tag
|
|
2079
|
+
return this.indentate(level) + '<' + key + attrStr+ '?' + this.tagEndChar;
|
|
2080
|
+
}else {
|
|
2081
|
+
let textValue = this.options.tagValueProcessor(key, val);
|
|
2082
|
+
textValue = this.replaceEntitiesValue(textValue);
|
|
2083
|
+
|
|
2084
|
+
if( textValue === ''){
|
|
2085
|
+
return this.indentate(level) + '<' + key + attrStr + this.closeTag(key) + this.tagEndChar;
|
|
2086
|
+
}else {
|
|
2087
|
+
return this.indentate(level) + '<' + key + attrStr + '>' +
|
|
2088
|
+
textValue +
|
|
2089
|
+
'</' + key + this.tagEndChar;
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
};
|
|
2093
|
+
|
|
2094
|
+
Builder.prototype.replaceEntitiesValue = function(textValue){
|
|
2095
|
+
if(textValue && textValue.length > 0 && this.options.processEntities){
|
|
2096
|
+
for (let i=0; i<this.options.entities.length; i++) {
|
|
2097
|
+
const entity = this.options.entities[i];
|
|
2098
|
+
textValue = textValue.replace(entity.regex, entity.val);
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
return textValue;
|
|
2102
|
+
};
|
|
2103
|
+
|
|
2104
|
+
function indentate(level) {
|
|
2105
|
+
return this.options.indentBy.repeat(level);
|
|
2106
|
+
}
|
|
2107
|
+
|
|
2108
|
+
function isAttribute(name /*, options*/) {
|
|
2109
|
+
if (name.startsWith(this.options.attributeNamePrefix) && name !== this.options.textNodeName) {
|
|
2110
|
+
return name.substr(this.attrPrefixLen);
|
|
2111
|
+
} else {
|
|
2112
|
+
return false;
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
|
|
2116
|
+
json2xml = Builder;
|
|
2117
|
+
return json2xml;
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
var fxp;
|
|
2121
|
+
var hasRequiredFxp;
|
|
2122
|
+
|
|
2123
|
+
function requireFxp () {
|
|
2124
|
+
if (hasRequiredFxp) return fxp;
|
|
2125
|
+
hasRequiredFxp = 1;
|
|
2126
|
+
|
|
2127
|
+
const validator = requireValidator();
|
|
2128
|
+
const XMLParser = requireXMLParser();
|
|
2129
|
+
const XMLBuilder = requireJson2xml();
|
|
2130
|
+
|
|
2131
|
+
fxp = {
|
|
2132
|
+
XMLParser: XMLParser,
|
|
2133
|
+
XMLValidator: validator,
|
|
2134
|
+
XMLBuilder: XMLBuilder
|
|
2135
|
+
};
|
|
2136
|
+
return fxp;
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
var fxpExports = requireFxp();
|
|
2140
|
+
|
|
2141
|
+
const parseXmlBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
2142
|
+
if (encoded.length) {
|
|
2143
|
+
const parser = new fxpExports.XMLParser({
|
|
2144
|
+
attributeNamePrefix: "",
|
|
2145
|
+
htmlEntities: true,
|
|
2146
|
+
ignoreAttributes: false,
|
|
2147
|
+
ignoreDeclaration: true,
|
|
2148
|
+
parseTagValue: false,
|
|
2149
|
+
trimValues: false,
|
|
2150
|
+
tagValueProcessor: (_, val) => (val.trim() === "" && val.includes("\n") ? "" : undefined),
|
|
2151
|
+
});
|
|
2152
|
+
parser.addEntity("#xD", "\r");
|
|
2153
|
+
parser.addEntity("#10", "\n");
|
|
2154
|
+
let parsedObj;
|
|
2155
|
+
try {
|
|
2156
|
+
parsedObj = parser.parse(encoded, true);
|
|
2157
|
+
}
|
|
2158
|
+
catch (e) {
|
|
2159
|
+
if (e && typeof e === "object") {
|
|
2160
|
+
Object.defineProperty(e, "$responseBodyText", {
|
|
2161
|
+
value: encoded,
|
|
2162
|
+
});
|
|
2163
|
+
}
|
|
2164
|
+
throw e;
|
|
2165
|
+
}
|
|
2166
|
+
const textNodeName = "#text";
|
|
2167
|
+
const key = Object.keys(parsedObj)[0];
|
|
2168
|
+
const parsedObjToReturn = parsedObj[key];
|
|
2169
|
+
if (parsedObjToReturn[textNodeName]) {
|
|
2170
|
+
parsedObjToReturn[key] = parsedObjToReturn[textNodeName];
|
|
2171
|
+
delete parsedObjToReturn[textNodeName];
|
|
2172
|
+
}
|
|
2173
|
+
return getValueFromTextNode(parsedObjToReturn);
|
|
2174
|
+
}
|
|
2175
|
+
return {};
|
|
2176
|
+
});
|
|
2177
|
+
const parseXmlErrorBody = async (errorBody, context) => {
|
|
2178
|
+
const value = await parseXmlBody(errorBody, context);
|
|
2179
|
+
if (value.Error) {
|
|
2180
|
+
value.Error.message = value.Error.message ?? value.Error.Message;
|
|
2181
|
+
}
|
|
2182
|
+
return value;
|
|
2183
|
+
};
|
|
2184
|
+
|
|
2185
|
+
const defaultSTSHttpAuthSchemeParametersProvider = async (config, context, input) => {
|
|
2186
|
+
return {
|
|
2187
|
+
operation: getSmithyContext(context).operation,
|
|
2188
|
+
region: (await normalizeProvider(config.region)()) ||
|
|
2189
|
+
(() => {
|
|
2190
|
+
throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
|
|
2191
|
+
})(),
|
|
2192
|
+
};
|
|
2193
|
+
};
|
|
2194
|
+
function createAwsAuthSigv4HttpAuthOption(authParameters) {
|
|
2195
|
+
return {
|
|
2196
|
+
schemeId: "aws.auth#sigv4",
|
|
2197
|
+
signingProperties: {
|
|
2198
|
+
name: "sts",
|
|
2199
|
+
region: authParameters.region,
|
|
2200
|
+
},
|
|
2201
|
+
propertiesExtractor: (config, context) => ({
|
|
2202
|
+
signingProperties: {
|
|
2203
|
+
config,
|
|
2204
|
+
context,
|
|
2205
|
+
},
|
|
2206
|
+
}),
|
|
2207
|
+
};
|
|
2208
|
+
}
|
|
2209
|
+
function createSmithyApiNoAuthHttpAuthOption(authParameters) {
|
|
2210
|
+
return {
|
|
2211
|
+
schemeId: "smithy.api#noAuth",
|
|
2212
|
+
};
|
|
2213
|
+
}
|
|
2214
|
+
const defaultSTSHttpAuthSchemeProvider = (authParameters) => {
|
|
2215
|
+
const options = [];
|
|
2216
|
+
switch (authParameters.operation) {
|
|
2217
|
+
case "AssumeRoleWithSAML": {
|
|
2218
|
+
options.push(createSmithyApiNoAuthHttpAuthOption());
|
|
2219
|
+
break;
|
|
2220
|
+
}
|
|
2221
|
+
case "AssumeRoleWithWebIdentity": {
|
|
2222
|
+
options.push(createSmithyApiNoAuthHttpAuthOption());
|
|
2223
|
+
break;
|
|
2224
|
+
}
|
|
2225
|
+
default: {
|
|
2226
|
+
options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
return options;
|
|
2230
|
+
};
|
|
2231
|
+
const resolveStsAuthConfig = (input) => ({
|
|
2232
|
+
...input,
|
|
2233
|
+
stsClientCtor: STSClient,
|
|
2234
|
+
});
|
|
2235
|
+
const resolveHttpAuthSchemeConfig = (config) => {
|
|
2236
|
+
const config_0 = resolveStsAuthConfig(config);
|
|
2237
|
+
const config_1 = resolveAwsSdkSigV4Config(config_0);
|
|
2238
|
+
return {
|
|
2239
|
+
...config_1,
|
|
2240
|
+
};
|
|
2241
|
+
};
|
|
2242
|
+
|
|
2243
|
+
const resolveClientEndpointParameters = (options) => {
|
|
2244
|
+
return {
|
|
2245
|
+
...options,
|
|
2246
|
+
useDualstackEndpoint: options.useDualstackEndpoint ?? false,
|
|
2247
|
+
useFipsEndpoint: options.useFipsEndpoint ?? false,
|
|
2248
|
+
useGlobalEndpoint: options.useGlobalEndpoint ?? false,
|
|
2249
|
+
defaultSigningName: "sts",
|
|
2250
|
+
};
|
|
2251
|
+
};
|
|
2252
|
+
const commonParams = {
|
|
2253
|
+
UseGlobalEndpoint: { type: "builtInParams", name: "useGlobalEndpoint" },
|
|
2254
|
+
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
|
|
2255
|
+
Endpoint: { type: "builtInParams", name: "endpoint" },
|
|
2256
|
+
Region: { type: "builtInParams", name: "region" },
|
|
2257
|
+
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
|
|
2258
|
+
};
|
|
2259
|
+
|
|
2260
|
+
var name = "@aws-sdk/client-sts";
|
|
2261
|
+
var description = "AWS SDK for JavaScript Sts Client for Node.js, Browser and React Native";
|
|
2262
|
+
var version = "3.716.0";
|
|
2263
|
+
var scripts = {
|
|
2264
|
+
build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
|
|
2265
|
+
"build:cjs": "node ../../scripts/compilation/inline client-sts",
|
|
2266
|
+
"build:es": "tsc -p tsconfig.es.json",
|
|
2267
|
+
"build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
|
|
2268
|
+
"build:types": "rimraf ./dist-types tsconfig.types.tsbuildinfo && tsc -p tsconfig.types.json",
|
|
2269
|
+
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
|
|
2270
|
+
clean: "rimraf ./dist-* && rimraf *.tsbuildinfo",
|
|
2271
|
+
"extract:docs": "api-extractor run --local",
|
|
2272
|
+
"generate:client": "node ../../scripts/generate-clients/single-service --solo sts",
|
|
2273
|
+
test: "yarn g:vitest run",
|
|
2274
|
+
"test:watch": "yarn g:vitest watch"
|
|
2275
|
+
};
|
|
2276
|
+
var main = "./dist-cjs/index.js";
|
|
2277
|
+
var types = "./dist-types/index.d.ts";
|
|
2278
|
+
var module = "./dist-es/index.js";
|
|
2279
|
+
var sideEffects = false;
|
|
2280
|
+
var dependencies = {
|
|
2281
|
+
"@aws-crypto/sha256-browser": "5.2.0",
|
|
2282
|
+
"@aws-crypto/sha256-js": "5.2.0",
|
|
2283
|
+
"@aws-sdk/client-sso-oidc": "3.716.0",
|
|
2284
|
+
"@aws-sdk/core": "3.716.0",
|
|
2285
|
+
"@aws-sdk/credential-provider-node": "3.716.0",
|
|
2286
|
+
"@aws-sdk/middleware-host-header": "3.714.0",
|
|
2287
|
+
"@aws-sdk/middleware-logger": "3.714.0",
|
|
2288
|
+
"@aws-sdk/middleware-recursion-detection": "3.714.0",
|
|
2289
|
+
"@aws-sdk/middleware-user-agent": "3.716.0",
|
|
2290
|
+
"@aws-sdk/region-config-resolver": "3.714.0",
|
|
2291
|
+
"@aws-sdk/types": "3.714.0",
|
|
2292
|
+
"@aws-sdk/util-endpoints": "3.714.0",
|
|
2293
|
+
"@aws-sdk/util-user-agent-browser": "3.714.0",
|
|
2294
|
+
"@aws-sdk/util-user-agent-node": "3.716.0",
|
|
2295
|
+
"@smithy/config-resolver": "^3.0.13",
|
|
2296
|
+
"@smithy/core": "^2.5.5",
|
|
2297
|
+
"@smithy/fetch-http-handler": "^4.1.2",
|
|
2298
|
+
"@smithy/hash-node": "^3.0.11",
|
|
2299
|
+
"@smithy/invalid-dependency": "^3.0.11",
|
|
2300
|
+
"@smithy/middleware-content-length": "^3.0.13",
|
|
2301
|
+
"@smithy/middleware-endpoint": "^3.2.6",
|
|
2302
|
+
"@smithy/middleware-retry": "^3.0.31",
|
|
2303
|
+
"@smithy/middleware-serde": "^3.0.11",
|
|
2304
|
+
"@smithy/middleware-stack": "^3.0.11",
|
|
2305
|
+
"@smithy/node-config-provider": "^3.1.12",
|
|
2306
|
+
"@smithy/node-http-handler": "^3.3.2",
|
|
2307
|
+
"@smithy/protocol-http": "^4.1.8",
|
|
2308
|
+
"@smithy/smithy-client": "^3.5.1",
|
|
2309
|
+
"@smithy/types": "^3.7.2",
|
|
2310
|
+
"@smithy/url-parser": "^3.0.11",
|
|
2311
|
+
"@smithy/util-base64": "^3.0.0",
|
|
2312
|
+
"@smithy/util-body-length-browser": "^3.0.0",
|
|
2313
|
+
"@smithy/util-body-length-node": "^3.0.0",
|
|
2314
|
+
"@smithy/util-defaults-mode-browser": "^3.0.31",
|
|
2315
|
+
"@smithy/util-defaults-mode-node": "^3.0.31",
|
|
2316
|
+
"@smithy/util-endpoints": "^2.1.7",
|
|
2317
|
+
"@smithy/util-middleware": "^3.0.11",
|
|
2318
|
+
"@smithy/util-retry": "^3.0.11",
|
|
2319
|
+
"@smithy/util-utf8": "^3.0.0",
|
|
2320
|
+
tslib: "^2.6.2"
|
|
2321
|
+
};
|
|
2322
|
+
var devDependencies = {
|
|
2323
|
+
"@tsconfig/node16": "16.1.3",
|
|
2324
|
+
"@types/node": "^16.18.96",
|
|
2325
|
+
concurrently: "7.0.0",
|
|
2326
|
+
"downlevel-dts": "0.10.1",
|
|
2327
|
+
rimraf: "3.0.2",
|
|
2328
|
+
typescript: "~4.9.5"
|
|
2329
|
+
};
|
|
2330
|
+
var engines = {
|
|
2331
|
+
node: ">=16.0.0"
|
|
2332
|
+
};
|
|
2333
|
+
var typesVersions = {
|
|
2334
|
+
"<4.0": {
|
|
2335
|
+
"dist-types/*": [
|
|
2336
|
+
"dist-types/ts3.4/*"
|
|
2337
|
+
]
|
|
2338
|
+
}
|
|
2339
|
+
};
|
|
2340
|
+
var files = [
|
|
2341
|
+
"dist-*/**"
|
|
2342
|
+
];
|
|
2343
|
+
var author = {
|
|
2344
|
+
name: "AWS SDK for JavaScript Team",
|
|
2345
|
+
url: "https://aws.amazon.com/javascript/"
|
|
2346
|
+
};
|
|
2347
|
+
var license = "Apache-2.0";
|
|
2348
|
+
var browser = {
|
|
2349
|
+
"./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser"
|
|
2350
|
+
};
|
|
2351
|
+
var homepage = "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-sts";
|
|
2352
|
+
var repository = {
|
|
2353
|
+
type: "git",
|
|
2354
|
+
url: "https://github.com/aws/aws-sdk-js-v3.git",
|
|
2355
|
+
directory: "clients/client-sts"
|
|
2356
|
+
};
|
|
2357
|
+
var packageInfo = {
|
|
2358
|
+
name: name,
|
|
2359
|
+
description: description,
|
|
2360
|
+
version: version,
|
|
2361
|
+
scripts: scripts,
|
|
2362
|
+
main: main,
|
|
2363
|
+
types: types,
|
|
2364
|
+
module: module,
|
|
2365
|
+
sideEffects: sideEffects,
|
|
2366
|
+
dependencies: dependencies,
|
|
2367
|
+
devDependencies: devDependencies,
|
|
2368
|
+
engines: engines,
|
|
2369
|
+
typesVersions: typesVersions,
|
|
2370
|
+
files: files,
|
|
2371
|
+
author: author,
|
|
2372
|
+
license: license,
|
|
2373
|
+
browser: browser,
|
|
2374
|
+
"react-native": {
|
|
2375
|
+
"./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native"
|
|
2376
|
+
},
|
|
2377
|
+
homepage: homepage,
|
|
2378
|
+
repository: repository
|
|
2379
|
+
};
|
|
2380
|
+
|
|
2381
|
+
const F = "required", G = "type", H = "fn", I = "argv", J = "ref";
|
|
2382
|
+
const a = false, b = true, c = "booleanEquals", d = "stringEquals", e = "sigv4", f = "sts", g = "us-east-1", h = "endpoint", i = "https://sts.{Region}.{PartitionResult#dnsSuffix}", j = "tree", k = "error", l = "getAttr", m = { [F]: false, [G]: "String" }, n = { [F]: true, "default": false, [G]: "Boolean" }, o = { [J]: "Endpoint" }, p = { [H]: "isSet", [I]: [{ [J]: "Region" }] }, q = { [J]: "Region" }, r = { [H]: "aws.partition", [I]: [q], "assign": "PartitionResult" }, s = { [J]: "UseFIPS" }, t = { [J]: "UseDualStack" }, u = { "url": "https://sts.amazonaws.com", "properties": { "authSchemes": [{ "name": e, "signingName": f, "signingRegion": g }] }, "headers": {} }, v = {}, w = { "conditions": [{ [H]: d, [I]: [q, "aws-global"] }], [h]: u, [G]: h }, x = { [H]: c, [I]: [s, true] }, y = { [H]: c, [I]: [t, true] }, z = { [H]: l, [I]: [{ [J]: "PartitionResult" }, "supportsFIPS"] }, A = { [J]: "PartitionResult" }, B = { [H]: c, [I]: [true, { [H]: l, [I]: [A, "supportsDualStack"] }] }, C = [{ [H]: "isSet", [I]: [o] }], D = [x], E = [y];
|
|
2383
|
+
const _data = { version: "1.0", parameters: { Region: m, UseDualStack: n, UseFIPS: n, Endpoint: m, UseGlobalEndpoint: n }, rules: [{ conditions: [{ [H]: c, [I]: [{ [J]: "UseGlobalEndpoint" }, b] }, { [H]: "not", [I]: C }, p, r, { [H]: c, [I]: [s, a] }, { [H]: c, [I]: [t, a] }], rules: [{ conditions: [{ [H]: d, [I]: [q, "ap-northeast-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "ap-south-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "ap-southeast-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "ap-southeast-2"] }], endpoint: u, [G]: h }, w, { conditions: [{ [H]: d, [I]: [q, "ca-central-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-central-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-north-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-west-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-west-2"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-west-3"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "sa-east-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, g] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "us-east-2"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "us-west-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "us-west-2"] }], endpoint: u, [G]: h }, { endpoint: { url: i, properties: { authSchemes: [{ name: e, signingName: f, signingRegion: "{Region}" }] }, headers: v }, [G]: h }], [G]: j }, { conditions: C, rules: [{ conditions: D, error: "Invalid Configuration: FIPS and custom endpoint are not supported", [G]: k }, { conditions: E, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", [G]: k }, { endpoint: { url: o, properties: v, headers: v }, [G]: h }], [G]: j }, { conditions: [p], rules: [{ conditions: [r], rules: [{ conditions: [x, y], rules: [{ conditions: [{ [H]: c, [I]: [b, z] }, B], rules: [{ endpoint: { url: "https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: v, headers: v }, [G]: h }], [G]: j }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", [G]: k }], [G]: j }, { conditions: D, rules: [{ conditions: [{ [H]: c, [I]: [z, b] }], rules: [{ conditions: [{ [H]: d, [I]: [{ [H]: l, [I]: [A, "name"] }, "aws-us-gov"] }], endpoint: { url: "https://sts.{Region}.amazonaws.com", properties: v, headers: v }, [G]: h }, { endpoint: { url: "https://sts-fips.{Region}.{PartitionResult#dnsSuffix}", properties: v, headers: v }, [G]: h }], [G]: j }, { error: "FIPS is enabled but this partition does not support FIPS", [G]: k }], [G]: j }, { conditions: E, rules: [{ conditions: [B], rules: [{ endpoint: { url: "https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: v, headers: v }, [G]: h }], [G]: j }, { error: "DualStack is enabled but this partition does not support DualStack", [G]: k }], [G]: j }, w, { endpoint: { url: i, properties: v, headers: v }, [G]: h }], [G]: j }], [G]: j }, { error: "Invalid Configuration: Missing Region", [G]: k }] };
|
|
2384
|
+
const ruleSet = _data;
|
|
2385
|
+
|
|
2386
|
+
const cache = new EndpointCache({
|
|
2387
|
+
size: 50,
|
|
2388
|
+
params: ["Endpoint", "Region", "UseDualStack", "UseFIPS", "UseGlobalEndpoint"],
|
|
2389
|
+
});
|
|
2390
|
+
const defaultEndpointResolver = (endpointParams, context = {}) => {
|
|
2391
|
+
return cache.get(endpointParams, () => resolveEndpoint(ruleSet, {
|
|
2392
|
+
endpointParams: endpointParams,
|
|
2393
|
+
logger: context.logger,
|
|
2394
|
+
}));
|
|
2395
|
+
};
|
|
2396
|
+
customEndpointFunctions.aws = awsEndpointFunctions;
|
|
2397
|
+
|
|
2398
|
+
const getRuntimeConfig$1 = (config) => {
|
|
2399
|
+
return {
|
|
2400
|
+
apiVersion: "2011-06-15",
|
|
2401
|
+
base64Decoder: config?.base64Decoder ?? fromBase64,
|
|
2402
|
+
base64Encoder: config?.base64Encoder ?? toBase64,
|
|
2403
|
+
disableHostPrefix: config?.disableHostPrefix ?? false,
|
|
2404
|
+
endpointProvider: config?.endpointProvider ?? defaultEndpointResolver,
|
|
2405
|
+
extensions: config?.extensions ?? [],
|
|
2406
|
+
httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? defaultSTSHttpAuthSchemeProvider,
|
|
2407
|
+
httpAuthSchemes: config?.httpAuthSchemes ?? [
|
|
2408
|
+
{
|
|
2409
|
+
schemeId: "aws.auth#sigv4",
|
|
2410
|
+
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
|
|
2411
|
+
signer: new AwsSdkSigV4Signer(),
|
|
2412
|
+
},
|
|
2413
|
+
{
|
|
2414
|
+
schemeId: "smithy.api#noAuth",
|
|
2415
|
+
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})),
|
|
2416
|
+
signer: new NoAuthSigner(),
|
|
2417
|
+
},
|
|
2418
|
+
],
|
|
2419
|
+
logger: config?.logger ?? new NoOpLogger(),
|
|
2420
|
+
serviceId: config?.serviceId ?? "STS",
|
|
2421
|
+
urlParser: config?.urlParser ?? parseUrl,
|
|
2422
|
+
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
|
|
2423
|
+
utf8Encoder: config?.utf8Encoder ?? toUtf8,
|
|
2424
|
+
};
|
|
2425
|
+
};
|
|
2426
|
+
|
|
2427
|
+
const getRuntimeConfig = (config) => {
|
|
2428
|
+
emitWarningIfUnsupportedVersion(process.version);
|
|
2429
|
+
const defaultsMode = resolveDefaultsModeConfig(config);
|
|
2430
|
+
const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
|
|
2431
|
+
const clientSharedValues = getRuntimeConfig$1(config);
|
|
2432
|
+
emitWarningIfUnsupportedVersion$1(process.version);
|
|
2433
|
+
const profileConfig = { profile: config?.profile };
|
|
2434
|
+
return {
|
|
2435
|
+
...clientSharedValues,
|
|
2436
|
+
...config,
|
|
2437
|
+
runtime: "node",
|
|
2438
|
+
defaultsMode,
|
|
2439
|
+
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
|
2440
|
+
credentialDefaultProvider: config?.credentialDefaultProvider ?? defaultProvider,
|
|
2441
|
+
defaultUserAgentProvider: config?.defaultUserAgentProvider ??
|
|
2442
|
+
createDefaultUserAgentProvider({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
|
2443
|
+
httpAuthSchemes: config?.httpAuthSchemes ?? [
|
|
2444
|
+
{
|
|
2445
|
+
schemeId: "aws.auth#sigv4",
|
|
2446
|
+
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4") ||
|
|
2447
|
+
(async (idProps) => await defaultProvider(idProps?.__config || {})()),
|
|
2448
|
+
signer: new AwsSdkSigV4Signer(),
|
|
2449
|
+
},
|
|
2450
|
+
{
|
|
2451
|
+
schemeId: "smithy.api#noAuth",
|
|
2452
|
+
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})),
|
|
2453
|
+
signer: new NoAuthSigner(),
|
|
2454
|
+
},
|
|
2455
|
+
],
|
|
2456
|
+
maxAttempts: config?.maxAttempts ?? loadConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
|
|
2457
|
+
region: config?.region ??
|
|
2458
|
+
loadConfig(NODE_REGION_CONFIG_OPTIONS, { ...NODE_REGION_CONFIG_FILE_OPTIONS, ...profileConfig }),
|
|
2459
|
+
requestHandler: NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider),
|
|
2460
|
+
retryMode: config?.retryMode ??
|
|
2461
|
+
loadConfig({
|
|
2462
|
+
...NODE_RETRY_MODE_CONFIG_OPTIONS,
|
|
2463
|
+
default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE,
|
|
2464
|
+
}, config),
|
|
2465
|
+
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
|
|
2466
|
+
streamCollector: config?.streamCollector ?? streamCollector,
|
|
2467
|
+
useDualstackEndpoint: config?.useDualstackEndpoint ?? loadConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, profileConfig),
|
|
2468
|
+
useFipsEndpoint: config?.useFipsEndpoint ?? loadConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, profileConfig),
|
|
2469
|
+
userAgentAppId: config?.userAgentAppId ?? loadConfig(NODE_APP_ID_CONFIG_OPTIONS, profileConfig),
|
|
2470
|
+
};
|
|
2471
|
+
};
|
|
2472
|
+
|
|
2473
|
+
const getHttpAuthExtensionConfiguration = (runtimeConfig) => {
|
|
2474
|
+
const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
|
|
2475
|
+
let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
|
|
2476
|
+
let _credentials = runtimeConfig.credentials;
|
|
2477
|
+
return {
|
|
2478
|
+
setHttpAuthScheme(httpAuthScheme) {
|
|
2479
|
+
const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
|
|
2480
|
+
if (index === -1) {
|
|
2481
|
+
_httpAuthSchemes.push(httpAuthScheme);
|
|
2482
|
+
}
|
|
2483
|
+
else {
|
|
2484
|
+
_httpAuthSchemes.splice(index, 1, httpAuthScheme);
|
|
2485
|
+
}
|
|
2486
|
+
},
|
|
2487
|
+
httpAuthSchemes() {
|
|
2488
|
+
return _httpAuthSchemes;
|
|
2489
|
+
},
|
|
2490
|
+
setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
|
|
2491
|
+
_httpAuthSchemeProvider = httpAuthSchemeProvider;
|
|
2492
|
+
},
|
|
2493
|
+
httpAuthSchemeProvider() {
|
|
2494
|
+
return _httpAuthSchemeProvider;
|
|
2495
|
+
},
|
|
2496
|
+
setCredentials(credentials) {
|
|
2497
|
+
_credentials = credentials;
|
|
2498
|
+
},
|
|
2499
|
+
credentials() {
|
|
2500
|
+
return _credentials;
|
|
2501
|
+
},
|
|
2502
|
+
};
|
|
2503
|
+
};
|
|
2504
|
+
const resolveHttpAuthRuntimeConfig = (config) => {
|
|
2505
|
+
return {
|
|
2506
|
+
httpAuthSchemes: config.httpAuthSchemes(),
|
|
2507
|
+
httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
|
|
2508
|
+
credentials: config.credentials(),
|
|
2509
|
+
};
|
|
2510
|
+
};
|
|
2511
|
+
|
|
2512
|
+
const asPartial = (t) => t;
|
|
2513
|
+
const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
|
|
2514
|
+
const extensionConfiguration = {
|
|
2515
|
+
...asPartial(getAwsRegionExtensionConfiguration(runtimeConfig)),
|
|
2516
|
+
...asPartial(getDefaultExtensionConfiguration(runtimeConfig)),
|
|
2517
|
+
...asPartial(getHttpHandlerExtensionConfiguration(runtimeConfig)),
|
|
2518
|
+
...asPartial(getHttpAuthExtensionConfiguration(runtimeConfig)),
|
|
2519
|
+
};
|
|
2520
|
+
extensions.forEach((extension) => extension.configure(extensionConfiguration));
|
|
2521
|
+
return {
|
|
2522
|
+
...runtimeConfig,
|
|
2523
|
+
...resolveAwsRegionExtensionConfiguration(extensionConfiguration),
|
|
2524
|
+
...resolveDefaultRuntimeConfig(extensionConfiguration),
|
|
2525
|
+
...resolveHttpHandlerRuntimeConfig(extensionConfiguration),
|
|
2526
|
+
...resolveHttpAuthRuntimeConfig(extensionConfiguration),
|
|
2527
|
+
};
|
|
2528
|
+
};
|
|
2529
|
+
|
|
2530
|
+
class STSClient extends Client {
|
|
2531
|
+
constructor(...[configuration]) {
|
|
2532
|
+
const _config_0 = getRuntimeConfig(configuration || {});
|
|
2533
|
+
const _config_1 = resolveClientEndpointParameters(_config_0);
|
|
2534
|
+
const _config_2 = resolveUserAgentConfig(_config_1);
|
|
2535
|
+
const _config_3 = resolveRetryConfig(_config_2);
|
|
2536
|
+
const _config_4 = resolveRegionConfig(_config_3);
|
|
2537
|
+
const _config_5 = resolveHostHeaderConfig(_config_4);
|
|
2538
|
+
const _config_6 = resolveEndpointConfig(_config_5);
|
|
2539
|
+
const _config_7 = resolveHttpAuthSchemeConfig(_config_6);
|
|
2540
|
+
const _config_8 = resolveRuntimeExtensions(_config_7, configuration?.extensions || []);
|
|
2541
|
+
super(_config_8);
|
|
2542
|
+
this.config = _config_8;
|
|
2543
|
+
this.middlewareStack.use(getUserAgentPlugin(this.config));
|
|
2544
|
+
this.middlewareStack.use(getRetryPlugin(this.config));
|
|
2545
|
+
this.middlewareStack.use(getContentLengthPlugin(this.config));
|
|
2546
|
+
this.middlewareStack.use(getHostHeaderPlugin(this.config));
|
|
2547
|
+
this.middlewareStack.use(getLoggerPlugin(this.config));
|
|
2548
|
+
this.middlewareStack.use(getRecursionDetectionPlugin(this.config));
|
|
2549
|
+
this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin(this.config, {
|
|
2550
|
+
httpAuthSchemeParametersProvider: defaultSTSHttpAuthSchemeParametersProvider,
|
|
2551
|
+
identityProviderConfigProvider: async (config) => new DefaultIdentityProviderConfig({
|
|
2552
|
+
"aws.auth#sigv4": config.credentials,
|
|
2553
|
+
}),
|
|
2554
|
+
}));
|
|
2555
|
+
this.middlewareStack.use(getHttpSigningPlugin(this.config));
|
|
2556
|
+
}
|
|
2557
|
+
destroy() {
|
|
2558
|
+
super.destroy();
|
|
2559
|
+
}
|
|
2560
|
+
}
|
|
2561
|
+
|
|
2562
|
+
class STSServiceException extends ServiceException {
|
|
2563
|
+
constructor(options) {
|
|
2564
|
+
super(options);
|
|
2565
|
+
Object.setPrototypeOf(this, STSServiceException.prototype);
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2568
|
+
|
|
2569
|
+
class ExpiredTokenException extends STSServiceException {
|
|
2570
|
+
constructor(opts) {
|
|
2571
|
+
super({
|
|
2572
|
+
name: "ExpiredTokenException",
|
|
2573
|
+
$fault: "client",
|
|
2574
|
+
...opts,
|
|
2575
|
+
});
|
|
2576
|
+
this.name = "ExpiredTokenException";
|
|
2577
|
+
this.$fault = "client";
|
|
2578
|
+
Object.setPrototypeOf(this, ExpiredTokenException.prototype);
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
class MalformedPolicyDocumentException extends STSServiceException {
|
|
2582
|
+
constructor(opts) {
|
|
2583
|
+
super({
|
|
2584
|
+
name: "MalformedPolicyDocumentException",
|
|
2585
|
+
$fault: "client",
|
|
2586
|
+
...opts,
|
|
2587
|
+
});
|
|
2588
|
+
this.name = "MalformedPolicyDocumentException";
|
|
2589
|
+
this.$fault = "client";
|
|
2590
|
+
Object.setPrototypeOf(this, MalformedPolicyDocumentException.prototype);
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2593
|
+
class PackedPolicyTooLargeException extends STSServiceException {
|
|
2594
|
+
constructor(opts) {
|
|
2595
|
+
super({
|
|
2596
|
+
name: "PackedPolicyTooLargeException",
|
|
2597
|
+
$fault: "client",
|
|
2598
|
+
...opts,
|
|
2599
|
+
});
|
|
2600
|
+
this.name = "PackedPolicyTooLargeException";
|
|
2601
|
+
this.$fault = "client";
|
|
2602
|
+
Object.setPrototypeOf(this, PackedPolicyTooLargeException.prototype);
|
|
2603
|
+
}
|
|
2604
|
+
}
|
|
2605
|
+
class RegionDisabledException extends STSServiceException {
|
|
2606
|
+
constructor(opts) {
|
|
2607
|
+
super({
|
|
2608
|
+
name: "RegionDisabledException",
|
|
2609
|
+
$fault: "client",
|
|
2610
|
+
...opts,
|
|
2611
|
+
});
|
|
2612
|
+
this.name = "RegionDisabledException";
|
|
2613
|
+
this.$fault = "client";
|
|
2614
|
+
Object.setPrototypeOf(this, RegionDisabledException.prototype);
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2617
|
+
class IDPRejectedClaimException extends STSServiceException {
|
|
2618
|
+
constructor(opts) {
|
|
2619
|
+
super({
|
|
2620
|
+
name: "IDPRejectedClaimException",
|
|
2621
|
+
$fault: "client",
|
|
2622
|
+
...opts,
|
|
2623
|
+
});
|
|
2624
|
+
this.name = "IDPRejectedClaimException";
|
|
2625
|
+
this.$fault = "client";
|
|
2626
|
+
Object.setPrototypeOf(this, IDPRejectedClaimException.prototype);
|
|
2627
|
+
}
|
|
2628
|
+
}
|
|
2629
|
+
class InvalidIdentityTokenException extends STSServiceException {
|
|
2630
|
+
constructor(opts) {
|
|
2631
|
+
super({
|
|
2632
|
+
name: "InvalidIdentityTokenException",
|
|
2633
|
+
$fault: "client",
|
|
2634
|
+
...opts,
|
|
2635
|
+
});
|
|
2636
|
+
this.name = "InvalidIdentityTokenException";
|
|
2637
|
+
this.$fault = "client";
|
|
2638
|
+
Object.setPrototypeOf(this, InvalidIdentityTokenException.prototype);
|
|
2639
|
+
}
|
|
2640
|
+
}
|
|
2641
|
+
class IDPCommunicationErrorException extends STSServiceException {
|
|
2642
|
+
constructor(opts) {
|
|
2643
|
+
super({
|
|
2644
|
+
name: "IDPCommunicationErrorException",
|
|
2645
|
+
$fault: "client",
|
|
2646
|
+
...opts,
|
|
2647
|
+
});
|
|
2648
|
+
this.name = "IDPCommunicationErrorException";
|
|
2649
|
+
this.$fault = "client";
|
|
2650
|
+
Object.setPrototypeOf(this, IDPCommunicationErrorException.prototype);
|
|
2651
|
+
}
|
|
2652
|
+
}
|
|
2653
|
+
class InvalidAuthorizationMessageException extends STSServiceException {
|
|
2654
|
+
constructor(opts) {
|
|
2655
|
+
super({
|
|
2656
|
+
name: "InvalidAuthorizationMessageException",
|
|
2657
|
+
$fault: "client",
|
|
2658
|
+
...opts,
|
|
2659
|
+
});
|
|
2660
|
+
this.name = "InvalidAuthorizationMessageException";
|
|
2661
|
+
this.$fault = "client";
|
|
2662
|
+
Object.setPrototypeOf(this, InvalidAuthorizationMessageException.prototype);
|
|
2663
|
+
}
|
|
2664
|
+
}
|
|
2665
|
+
const CredentialsFilterSensitiveLog = (obj) => ({
|
|
2666
|
+
...obj,
|
|
2667
|
+
...(obj.SecretAccessKey && { SecretAccessKey: SENSITIVE_STRING }),
|
|
2668
|
+
});
|
|
2669
|
+
const AssumeRoleResponseFilterSensitiveLog = (obj) => ({
|
|
2670
|
+
...obj,
|
|
2671
|
+
...(obj.Credentials && { Credentials: CredentialsFilterSensitiveLog(obj.Credentials) }),
|
|
2672
|
+
});
|
|
2673
|
+
const AssumeRoleWithSAMLRequestFilterSensitiveLog = (obj) => ({
|
|
2674
|
+
...obj,
|
|
2675
|
+
...(obj.SAMLAssertion && { SAMLAssertion: SENSITIVE_STRING }),
|
|
2676
|
+
});
|
|
2677
|
+
const AssumeRoleWithSAMLResponseFilterSensitiveLog = (obj) => ({
|
|
2678
|
+
...obj,
|
|
2679
|
+
...(obj.Credentials && { Credentials: CredentialsFilterSensitiveLog(obj.Credentials) }),
|
|
2680
|
+
});
|
|
2681
|
+
const AssumeRoleWithWebIdentityRequestFilterSensitiveLog = (obj) => ({
|
|
2682
|
+
...obj,
|
|
2683
|
+
...(obj.WebIdentityToken && { WebIdentityToken: SENSITIVE_STRING }),
|
|
2684
|
+
});
|
|
2685
|
+
const AssumeRoleWithWebIdentityResponseFilterSensitiveLog = (obj) => ({
|
|
2686
|
+
...obj,
|
|
2687
|
+
...(obj.Credentials && { Credentials: CredentialsFilterSensitiveLog(obj.Credentials) }),
|
|
2688
|
+
});
|
|
2689
|
+
const AssumeRootResponseFilterSensitiveLog = (obj) => ({
|
|
2690
|
+
...obj,
|
|
2691
|
+
...(obj.Credentials && { Credentials: CredentialsFilterSensitiveLog(obj.Credentials) }),
|
|
2692
|
+
});
|
|
2693
|
+
const GetFederationTokenResponseFilterSensitiveLog = (obj) => ({
|
|
2694
|
+
...obj,
|
|
2695
|
+
...(obj.Credentials && { Credentials: CredentialsFilterSensitiveLog(obj.Credentials) }),
|
|
2696
|
+
});
|
|
2697
|
+
const GetSessionTokenResponseFilterSensitiveLog = (obj) => ({
|
|
2698
|
+
...obj,
|
|
2699
|
+
...(obj.Credentials && { Credentials: CredentialsFilterSensitiveLog(obj.Credentials) }),
|
|
2700
|
+
});
|
|
2701
|
+
|
|
2702
|
+
const se_AssumeRoleCommand = async (input, context) => {
|
|
2703
|
+
const headers = SHARED_HEADERS;
|
|
2704
|
+
let body;
|
|
2705
|
+
body = buildFormUrlencodedString({
|
|
2706
|
+
...se_AssumeRoleRequest(input),
|
|
2707
|
+
[_A]: _AR,
|
|
2708
|
+
[_V]: _,
|
|
2709
|
+
});
|
|
2710
|
+
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
|
2711
|
+
};
|
|
2712
|
+
const se_AssumeRoleWithSAMLCommand = async (input, context) => {
|
|
2713
|
+
const headers = SHARED_HEADERS;
|
|
2714
|
+
let body;
|
|
2715
|
+
body = buildFormUrlencodedString({
|
|
2716
|
+
...se_AssumeRoleWithSAMLRequest(input),
|
|
2717
|
+
[_A]: _ARWSAML,
|
|
2718
|
+
[_V]: _,
|
|
2719
|
+
});
|
|
2720
|
+
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
|
2721
|
+
};
|
|
2722
|
+
const se_AssumeRoleWithWebIdentityCommand = async (input, context) => {
|
|
2723
|
+
const headers = SHARED_HEADERS;
|
|
2724
|
+
let body;
|
|
2725
|
+
body = buildFormUrlencodedString({
|
|
2726
|
+
...se_AssumeRoleWithWebIdentityRequest(input),
|
|
2727
|
+
[_A]: _ARWWI,
|
|
2728
|
+
[_V]: _,
|
|
2729
|
+
});
|
|
2730
|
+
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
|
2731
|
+
};
|
|
2732
|
+
const se_AssumeRootCommand = async (input, context) => {
|
|
2733
|
+
const headers = SHARED_HEADERS;
|
|
2734
|
+
let body;
|
|
2735
|
+
body = buildFormUrlencodedString({
|
|
2736
|
+
...se_AssumeRootRequest(input),
|
|
2737
|
+
[_A]: _ARs,
|
|
2738
|
+
[_V]: _,
|
|
2739
|
+
});
|
|
2740
|
+
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
|
2741
|
+
};
|
|
2742
|
+
const se_DecodeAuthorizationMessageCommand = async (input, context) => {
|
|
2743
|
+
const headers = SHARED_HEADERS;
|
|
2744
|
+
let body;
|
|
2745
|
+
body = buildFormUrlencodedString({
|
|
2746
|
+
...se_DecodeAuthorizationMessageRequest(input),
|
|
2747
|
+
[_A]: _DAM,
|
|
2748
|
+
[_V]: _,
|
|
2749
|
+
});
|
|
2750
|
+
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
|
2751
|
+
};
|
|
2752
|
+
const se_GetAccessKeyInfoCommand = async (input, context) => {
|
|
2753
|
+
const headers = SHARED_HEADERS;
|
|
2754
|
+
let body;
|
|
2755
|
+
body = buildFormUrlencodedString({
|
|
2756
|
+
...se_GetAccessKeyInfoRequest(input),
|
|
2757
|
+
[_A]: _GAKI,
|
|
2758
|
+
[_V]: _,
|
|
2759
|
+
});
|
|
2760
|
+
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
|
2761
|
+
};
|
|
2762
|
+
const se_GetCallerIdentityCommand = async (input, context) => {
|
|
2763
|
+
const headers = SHARED_HEADERS;
|
|
2764
|
+
let body;
|
|
2765
|
+
body = buildFormUrlencodedString({
|
|
2766
|
+
...se_GetCallerIdentityRequest(),
|
|
2767
|
+
[_A]: _GCI,
|
|
2768
|
+
[_V]: _,
|
|
2769
|
+
});
|
|
2770
|
+
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
|
2771
|
+
};
|
|
2772
|
+
const se_GetFederationTokenCommand = async (input, context) => {
|
|
2773
|
+
const headers = SHARED_HEADERS;
|
|
2774
|
+
let body;
|
|
2775
|
+
body = buildFormUrlencodedString({
|
|
2776
|
+
...se_GetFederationTokenRequest(input),
|
|
2777
|
+
[_A]: _GFT,
|
|
2778
|
+
[_V]: _,
|
|
2779
|
+
});
|
|
2780
|
+
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
|
2781
|
+
};
|
|
2782
|
+
const se_GetSessionTokenCommand = async (input, context) => {
|
|
2783
|
+
const headers = SHARED_HEADERS;
|
|
2784
|
+
let body;
|
|
2785
|
+
body = buildFormUrlencodedString({
|
|
2786
|
+
...se_GetSessionTokenRequest(input),
|
|
2787
|
+
[_A]: _GST,
|
|
2788
|
+
[_V]: _,
|
|
2789
|
+
});
|
|
2790
|
+
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
|
2791
|
+
};
|
|
2792
|
+
const de_AssumeRoleCommand = async (output, context) => {
|
|
2793
|
+
if (output.statusCode >= 300) {
|
|
2794
|
+
return de_CommandError(output, context);
|
|
2795
|
+
}
|
|
2796
|
+
const data = await parseXmlBody(output.body, context);
|
|
2797
|
+
let contents = {};
|
|
2798
|
+
contents = de_AssumeRoleResponse(data.AssumeRoleResult);
|
|
2799
|
+
const response = {
|
|
2800
|
+
$metadata: deserializeMetadata(output),
|
|
2801
|
+
...contents,
|
|
2802
|
+
};
|
|
2803
|
+
return response;
|
|
2804
|
+
};
|
|
2805
|
+
const de_AssumeRoleWithSAMLCommand = async (output, context) => {
|
|
2806
|
+
if (output.statusCode >= 300) {
|
|
2807
|
+
return de_CommandError(output, context);
|
|
2808
|
+
}
|
|
2809
|
+
const data = await parseXmlBody(output.body, context);
|
|
2810
|
+
let contents = {};
|
|
2811
|
+
contents = de_AssumeRoleWithSAMLResponse(data.AssumeRoleWithSAMLResult);
|
|
2812
|
+
const response = {
|
|
2813
|
+
$metadata: deserializeMetadata(output),
|
|
2814
|
+
...contents,
|
|
2815
|
+
};
|
|
2816
|
+
return response;
|
|
2817
|
+
};
|
|
2818
|
+
const de_AssumeRoleWithWebIdentityCommand = async (output, context) => {
|
|
2819
|
+
if (output.statusCode >= 300) {
|
|
2820
|
+
return de_CommandError(output, context);
|
|
2821
|
+
}
|
|
2822
|
+
const data = await parseXmlBody(output.body, context);
|
|
2823
|
+
let contents = {};
|
|
2824
|
+
contents = de_AssumeRoleWithWebIdentityResponse(data.AssumeRoleWithWebIdentityResult);
|
|
2825
|
+
const response = {
|
|
2826
|
+
$metadata: deserializeMetadata(output),
|
|
2827
|
+
...contents,
|
|
2828
|
+
};
|
|
2829
|
+
return response;
|
|
2830
|
+
};
|
|
2831
|
+
const de_AssumeRootCommand = async (output, context) => {
|
|
2832
|
+
if (output.statusCode >= 300) {
|
|
2833
|
+
return de_CommandError(output, context);
|
|
2834
|
+
}
|
|
2835
|
+
const data = await parseXmlBody(output.body, context);
|
|
2836
|
+
let contents = {};
|
|
2837
|
+
contents = de_AssumeRootResponse(data.AssumeRootResult);
|
|
2838
|
+
const response = {
|
|
2839
|
+
$metadata: deserializeMetadata(output),
|
|
2840
|
+
...contents,
|
|
2841
|
+
};
|
|
2842
|
+
return response;
|
|
2843
|
+
};
|
|
2844
|
+
const de_DecodeAuthorizationMessageCommand = async (output, context) => {
|
|
2845
|
+
if (output.statusCode >= 300) {
|
|
2846
|
+
return de_CommandError(output, context);
|
|
2847
|
+
}
|
|
2848
|
+
const data = await parseXmlBody(output.body, context);
|
|
2849
|
+
let contents = {};
|
|
2850
|
+
contents = de_DecodeAuthorizationMessageResponse(data.DecodeAuthorizationMessageResult);
|
|
2851
|
+
const response = {
|
|
2852
|
+
$metadata: deserializeMetadata(output),
|
|
2853
|
+
...contents,
|
|
2854
|
+
};
|
|
2855
|
+
return response;
|
|
2856
|
+
};
|
|
2857
|
+
const de_GetAccessKeyInfoCommand = async (output, context) => {
|
|
2858
|
+
if (output.statusCode >= 300) {
|
|
2859
|
+
return de_CommandError(output, context);
|
|
2860
|
+
}
|
|
2861
|
+
const data = await parseXmlBody(output.body, context);
|
|
2862
|
+
let contents = {};
|
|
2863
|
+
contents = de_GetAccessKeyInfoResponse(data.GetAccessKeyInfoResult);
|
|
2864
|
+
const response = {
|
|
2865
|
+
$metadata: deserializeMetadata(output),
|
|
2866
|
+
...contents,
|
|
2867
|
+
};
|
|
2868
|
+
return response;
|
|
2869
|
+
};
|
|
2870
|
+
const de_GetCallerIdentityCommand = async (output, context) => {
|
|
2871
|
+
if (output.statusCode >= 300) {
|
|
2872
|
+
return de_CommandError(output, context);
|
|
2873
|
+
}
|
|
2874
|
+
const data = await parseXmlBody(output.body, context);
|
|
2875
|
+
let contents = {};
|
|
2876
|
+
contents = de_GetCallerIdentityResponse(data.GetCallerIdentityResult);
|
|
2877
|
+
const response = {
|
|
2878
|
+
$metadata: deserializeMetadata(output),
|
|
2879
|
+
...contents,
|
|
2880
|
+
};
|
|
2881
|
+
return response;
|
|
2882
|
+
};
|
|
2883
|
+
const de_GetFederationTokenCommand = async (output, context) => {
|
|
2884
|
+
if (output.statusCode >= 300) {
|
|
2885
|
+
return de_CommandError(output, context);
|
|
2886
|
+
}
|
|
2887
|
+
const data = await parseXmlBody(output.body, context);
|
|
2888
|
+
let contents = {};
|
|
2889
|
+
contents = de_GetFederationTokenResponse(data.GetFederationTokenResult);
|
|
2890
|
+
const response = {
|
|
2891
|
+
$metadata: deserializeMetadata(output),
|
|
2892
|
+
...contents,
|
|
2893
|
+
};
|
|
2894
|
+
return response;
|
|
2895
|
+
};
|
|
2896
|
+
const de_GetSessionTokenCommand = async (output, context) => {
|
|
2897
|
+
if (output.statusCode >= 300) {
|
|
2898
|
+
return de_CommandError(output, context);
|
|
2899
|
+
}
|
|
2900
|
+
const data = await parseXmlBody(output.body, context);
|
|
2901
|
+
let contents = {};
|
|
2902
|
+
contents = de_GetSessionTokenResponse(data.GetSessionTokenResult);
|
|
2903
|
+
const response = {
|
|
2904
|
+
$metadata: deserializeMetadata(output),
|
|
2905
|
+
...contents,
|
|
2906
|
+
};
|
|
2907
|
+
return response;
|
|
2908
|
+
};
|
|
2909
|
+
const de_CommandError = async (output, context) => {
|
|
2910
|
+
const parsedOutput = {
|
|
2911
|
+
...output,
|
|
2912
|
+
body: await parseXmlErrorBody(output.body, context),
|
|
2913
|
+
};
|
|
2914
|
+
const errorCode = loadQueryErrorCode(output, parsedOutput.body);
|
|
2915
|
+
switch (errorCode) {
|
|
2916
|
+
case "ExpiredTokenException":
|
|
2917
|
+
case "com.amazonaws.sts#ExpiredTokenException":
|
|
2918
|
+
throw await de_ExpiredTokenExceptionRes(parsedOutput);
|
|
2919
|
+
case "MalformedPolicyDocument":
|
|
2920
|
+
case "com.amazonaws.sts#MalformedPolicyDocumentException":
|
|
2921
|
+
throw await de_MalformedPolicyDocumentExceptionRes(parsedOutput);
|
|
2922
|
+
case "PackedPolicyTooLarge":
|
|
2923
|
+
case "com.amazonaws.sts#PackedPolicyTooLargeException":
|
|
2924
|
+
throw await de_PackedPolicyTooLargeExceptionRes(parsedOutput);
|
|
2925
|
+
case "RegionDisabledException":
|
|
2926
|
+
case "com.amazonaws.sts#RegionDisabledException":
|
|
2927
|
+
throw await de_RegionDisabledExceptionRes(parsedOutput);
|
|
2928
|
+
case "IDPRejectedClaim":
|
|
2929
|
+
case "com.amazonaws.sts#IDPRejectedClaimException":
|
|
2930
|
+
throw await de_IDPRejectedClaimExceptionRes(parsedOutput);
|
|
2931
|
+
case "InvalidIdentityToken":
|
|
2932
|
+
case "com.amazonaws.sts#InvalidIdentityTokenException":
|
|
2933
|
+
throw await de_InvalidIdentityTokenExceptionRes(parsedOutput);
|
|
2934
|
+
case "IDPCommunicationError":
|
|
2935
|
+
case "com.amazonaws.sts#IDPCommunicationErrorException":
|
|
2936
|
+
throw await de_IDPCommunicationErrorExceptionRes(parsedOutput);
|
|
2937
|
+
case "InvalidAuthorizationMessageException":
|
|
2938
|
+
case "com.amazonaws.sts#InvalidAuthorizationMessageException":
|
|
2939
|
+
throw await de_InvalidAuthorizationMessageExceptionRes(parsedOutput);
|
|
2940
|
+
default:
|
|
2941
|
+
const parsedBody = parsedOutput.body;
|
|
2942
|
+
return throwDefaultError({
|
|
2943
|
+
output,
|
|
2944
|
+
parsedBody: parsedBody.Error,
|
|
2945
|
+
errorCode,
|
|
2946
|
+
});
|
|
2947
|
+
}
|
|
2948
|
+
};
|
|
2949
|
+
const de_ExpiredTokenExceptionRes = async (parsedOutput, context) => {
|
|
2950
|
+
const body = parsedOutput.body;
|
|
2951
|
+
const deserialized = de_ExpiredTokenException(body.Error);
|
|
2952
|
+
const exception = new ExpiredTokenException({
|
|
2953
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
2954
|
+
...deserialized,
|
|
2955
|
+
});
|
|
2956
|
+
return decorateServiceException(exception, body);
|
|
2957
|
+
};
|
|
2958
|
+
const de_IDPCommunicationErrorExceptionRes = async (parsedOutput, context) => {
|
|
2959
|
+
const body = parsedOutput.body;
|
|
2960
|
+
const deserialized = de_IDPCommunicationErrorException(body.Error);
|
|
2961
|
+
const exception = new IDPCommunicationErrorException({
|
|
2962
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
2963
|
+
...deserialized,
|
|
2964
|
+
});
|
|
2965
|
+
return decorateServiceException(exception, body);
|
|
2966
|
+
};
|
|
2967
|
+
const de_IDPRejectedClaimExceptionRes = async (parsedOutput, context) => {
|
|
2968
|
+
const body = parsedOutput.body;
|
|
2969
|
+
const deserialized = de_IDPRejectedClaimException(body.Error);
|
|
2970
|
+
const exception = new IDPRejectedClaimException({
|
|
2971
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
2972
|
+
...deserialized,
|
|
2973
|
+
});
|
|
2974
|
+
return decorateServiceException(exception, body);
|
|
2975
|
+
};
|
|
2976
|
+
const de_InvalidAuthorizationMessageExceptionRes = async (parsedOutput, context) => {
|
|
2977
|
+
const body = parsedOutput.body;
|
|
2978
|
+
const deserialized = de_InvalidAuthorizationMessageException(body.Error);
|
|
2979
|
+
const exception = new InvalidAuthorizationMessageException({
|
|
2980
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
2981
|
+
...deserialized,
|
|
2982
|
+
});
|
|
2983
|
+
return decorateServiceException(exception, body);
|
|
2984
|
+
};
|
|
2985
|
+
const de_InvalidIdentityTokenExceptionRes = async (parsedOutput, context) => {
|
|
2986
|
+
const body = parsedOutput.body;
|
|
2987
|
+
const deserialized = de_InvalidIdentityTokenException(body.Error);
|
|
2988
|
+
const exception = new InvalidIdentityTokenException({
|
|
2989
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
2990
|
+
...deserialized,
|
|
2991
|
+
});
|
|
2992
|
+
return decorateServiceException(exception, body);
|
|
2993
|
+
};
|
|
2994
|
+
const de_MalformedPolicyDocumentExceptionRes = async (parsedOutput, context) => {
|
|
2995
|
+
const body = parsedOutput.body;
|
|
2996
|
+
const deserialized = de_MalformedPolicyDocumentException(body.Error);
|
|
2997
|
+
const exception = new MalformedPolicyDocumentException({
|
|
2998
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
2999
|
+
...deserialized,
|
|
3000
|
+
});
|
|
3001
|
+
return decorateServiceException(exception, body);
|
|
3002
|
+
};
|
|
3003
|
+
const de_PackedPolicyTooLargeExceptionRes = async (parsedOutput, context) => {
|
|
3004
|
+
const body = parsedOutput.body;
|
|
3005
|
+
const deserialized = de_PackedPolicyTooLargeException(body.Error);
|
|
3006
|
+
const exception = new PackedPolicyTooLargeException({
|
|
3007
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
3008
|
+
...deserialized,
|
|
3009
|
+
});
|
|
3010
|
+
return decorateServiceException(exception, body);
|
|
3011
|
+
};
|
|
3012
|
+
const de_RegionDisabledExceptionRes = async (parsedOutput, context) => {
|
|
3013
|
+
const body = parsedOutput.body;
|
|
3014
|
+
const deserialized = de_RegionDisabledException(body.Error);
|
|
3015
|
+
const exception = new RegionDisabledException({
|
|
3016
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
3017
|
+
...deserialized,
|
|
3018
|
+
});
|
|
3019
|
+
return decorateServiceException(exception, body);
|
|
3020
|
+
};
|
|
3021
|
+
const se_AssumeRoleRequest = (input, context) => {
|
|
3022
|
+
const entries = {};
|
|
3023
|
+
if (input[_RA] != null) {
|
|
3024
|
+
entries[_RA] = input[_RA];
|
|
3025
|
+
}
|
|
3026
|
+
if (input[_RSN] != null) {
|
|
3027
|
+
entries[_RSN] = input[_RSN];
|
|
3028
|
+
}
|
|
3029
|
+
if (input[_PA] != null) {
|
|
3030
|
+
const memberEntries = se_policyDescriptorListType(input[_PA]);
|
|
3031
|
+
if (input[_PA]?.length === 0) {
|
|
3032
|
+
entries.PolicyArns = [];
|
|
3033
|
+
}
|
|
3034
|
+
Object.entries(memberEntries).forEach(([key, value]) => {
|
|
3035
|
+
const loc = `PolicyArns.${key}`;
|
|
3036
|
+
entries[loc] = value;
|
|
3037
|
+
});
|
|
3038
|
+
}
|
|
3039
|
+
if (input[_P] != null) {
|
|
3040
|
+
entries[_P] = input[_P];
|
|
3041
|
+
}
|
|
3042
|
+
if (input[_DS] != null) {
|
|
3043
|
+
entries[_DS] = input[_DS];
|
|
3044
|
+
}
|
|
3045
|
+
if (input[_T] != null) {
|
|
3046
|
+
const memberEntries = se_tagListType(input[_T]);
|
|
3047
|
+
if (input[_T]?.length === 0) {
|
|
3048
|
+
entries.Tags = [];
|
|
3049
|
+
}
|
|
3050
|
+
Object.entries(memberEntries).forEach(([key, value]) => {
|
|
3051
|
+
const loc = `Tags.${key}`;
|
|
3052
|
+
entries[loc] = value;
|
|
3053
|
+
});
|
|
3054
|
+
}
|
|
3055
|
+
if (input[_TTK] != null) {
|
|
3056
|
+
const memberEntries = se_tagKeyListType(input[_TTK]);
|
|
3057
|
+
if (input[_TTK]?.length === 0) {
|
|
3058
|
+
entries.TransitiveTagKeys = [];
|
|
3059
|
+
}
|
|
3060
|
+
Object.entries(memberEntries).forEach(([key, value]) => {
|
|
3061
|
+
const loc = `TransitiveTagKeys.${key}`;
|
|
3062
|
+
entries[loc] = value;
|
|
3063
|
+
});
|
|
3064
|
+
}
|
|
3065
|
+
if (input[_EI] != null) {
|
|
3066
|
+
entries[_EI] = input[_EI];
|
|
3067
|
+
}
|
|
3068
|
+
if (input[_SN] != null) {
|
|
3069
|
+
entries[_SN] = input[_SN];
|
|
3070
|
+
}
|
|
3071
|
+
if (input[_TC] != null) {
|
|
3072
|
+
entries[_TC] = input[_TC];
|
|
3073
|
+
}
|
|
3074
|
+
if (input[_SI] != null) {
|
|
3075
|
+
entries[_SI] = input[_SI];
|
|
3076
|
+
}
|
|
3077
|
+
if (input[_PC] != null) {
|
|
3078
|
+
const memberEntries = se_ProvidedContextsListType(input[_PC]);
|
|
3079
|
+
if (input[_PC]?.length === 0) {
|
|
3080
|
+
entries.ProvidedContexts = [];
|
|
3081
|
+
}
|
|
3082
|
+
Object.entries(memberEntries).forEach(([key, value]) => {
|
|
3083
|
+
const loc = `ProvidedContexts.${key}`;
|
|
3084
|
+
entries[loc] = value;
|
|
3085
|
+
});
|
|
3086
|
+
}
|
|
3087
|
+
return entries;
|
|
3088
|
+
};
|
|
3089
|
+
const se_AssumeRoleWithSAMLRequest = (input, context) => {
|
|
3090
|
+
const entries = {};
|
|
3091
|
+
if (input[_RA] != null) {
|
|
3092
|
+
entries[_RA] = input[_RA];
|
|
3093
|
+
}
|
|
3094
|
+
if (input[_PAr] != null) {
|
|
3095
|
+
entries[_PAr] = input[_PAr];
|
|
3096
|
+
}
|
|
3097
|
+
if (input[_SAMLA] != null) {
|
|
3098
|
+
entries[_SAMLA] = input[_SAMLA];
|
|
3099
|
+
}
|
|
3100
|
+
if (input[_PA] != null) {
|
|
3101
|
+
const memberEntries = se_policyDescriptorListType(input[_PA]);
|
|
3102
|
+
if (input[_PA]?.length === 0) {
|
|
3103
|
+
entries.PolicyArns = [];
|
|
3104
|
+
}
|
|
3105
|
+
Object.entries(memberEntries).forEach(([key, value]) => {
|
|
3106
|
+
const loc = `PolicyArns.${key}`;
|
|
3107
|
+
entries[loc] = value;
|
|
3108
|
+
});
|
|
3109
|
+
}
|
|
3110
|
+
if (input[_P] != null) {
|
|
3111
|
+
entries[_P] = input[_P];
|
|
3112
|
+
}
|
|
3113
|
+
if (input[_DS] != null) {
|
|
3114
|
+
entries[_DS] = input[_DS];
|
|
3115
|
+
}
|
|
3116
|
+
return entries;
|
|
3117
|
+
};
|
|
3118
|
+
const se_AssumeRoleWithWebIdentityRequest = (input, context) => {
|
|
3119
|
+
const entries = {};
|
|
3120
|
+
if (input[_RA] != null) {
|
|
3121
|
+
entries[_RA] = input[_RA];
|
|
3122
|
+
}
|
|
3123
|
+
if (input[_RSN] != null) {
|
|
3124
|
+
entries[_RSN] = input[_RSN];
|
|
3125
|
+
}
|
|
3126
|
+
if (input[_WIT] != null) {
|
|
3127
|
+
entries[_WIT] = input[_WIT];
|
|
3128
|
+
}
|
|
3129
|
+
if (input[_PI] != null) {
|
|
3130
|
+
entries[_PI] = input[_PI];
|
|
3131
|
+
}
|
|
3132
|
+
if (input[_PA] != null) {
|
|
3133
|
+
const memberEntries = se_policyDescriptorListType(input[_PA]);
|
|
3134
|
+
if (input[_PA]?.length === 0) {
|
|
3135
|
+
entries.PolicyArns = [];
|
|
3136
|
+
}
|
|
3137
|
+
Object.entries(memberEntries).forEach(([key, value]) => {
|
|
3138
|
+
const loc = `PolicyArns.${key}`;
|
|
3139
|
+
entries[loc] = value;
|
|
3140
|
+
});
|
|
3141
|
+
}
|
|
3142
|
+
if (input[_P] != null) {
|
|
3143
|
+
entries[_P] = input[_P];
|
|
3144
|
+
}
|
|
3145
|
+
if (input[_DS] != null) {
|
|
3146
|
+
entries[_DS] = input[_DS];
|
|
3147
|
+
}
|
|
3148
|
+
return entries;
|
|
3149
|
+
};
|
|
3150
|
+
const se_AssumeRootRequest = (input, context) => {
|
|
3151
|
+
const entries = {};
|
|
3152
|
+
if (input[_TP] != null) {
|
|
3153
|
+
entries[_TP] = input[_TP];
|
|
3154
|
+
}
|
|
3155
|
+
if (input[_TPA] != null) {
|
|
3156
|
+
const memberEntries = se_PolicyDescriptorType(input[_TPA]);
|
|
3157
|
+
Object.entries(memberEntries).forEach(([key, value]) => {
|
|
3158
|
+
const loc = `TaskPolicyArn.${key}`;
|
|
3159
|
+
entries[loc] = value;
|
|
3160
|
+
});
|
|
3161
|
+
}
|
|
3162
|
+
if (input[_DS] != null) {
|
|
3163
|
+
entries[_DS] = input[_DS];
|
|
3164
|
+
}
|
|
3165
|
+
return entries;
|
|
3166
|
+
};
|
|
3167
|
+
const se_DecodeAuthorizationMessageRequest = (input, context) => {
|
|
3168
|
+
const entries = {};
|
|
3169
|
+
if (input[_EM] != null) {
|
|
3170
|
+
entries[_EM] = input[_EM];
|
|
3171
|
+
}
|
|
3172
|
+
return entries;
|
|
3173
|
+
};
|
|
3174
|
+
const se_GetAccessKeyInfoRequest = (input, context) => {
|
|
3175
|
+
const entries = {};
|
|
3176
|
+
if (input[_AKI] != null) {
|
|
3177
|
+
entries[_AKI] = input[_AKI];
|
|
3178
|
+
}
|
|
3179
|
+
return entries;
|
|
3180
|
+
};
|
|
3181
|
+
const se_GetCallerIdentityRequest = (input, context) => {
|
|
3182
|
+
const entries = {};
|
|
3183
|
+
return entries;
|
|
3184
|
+
};
|
|
3185
|
+
const se_GetFederationTokenRequest = (input, context) => {
|
|
3186
|
+
const entries = {};
|
|
3187
|
+
if (input[_N] != null) {
|
|
3188
|
+
entries[_N] = input[_N];
|
|
3189
|
+
}
|
|
3190
|
+
if (input[_P] != null) {
|
|
3191
|
+
entries[_P] = input[_P];
|
|
3192
|
+
}
|
|
3193
|
+
if (input[_PA] != null) {
|
|
3194
|
+
const memberEntries = se_policyDescriptorListType(input[_PA]);
|
|
3195
|
+
if (input[_PA]?.length === 0) {
|
|
3196
|
+
entries.PolicyArns = [];
|
|
3197
|
+
}
|
|
3198
|
+
Object.entries(memberEntries).forEach(([key, value]) => {
|
|
3199
|
+
const loc = `PolicyArns.${key}`;
|
|
3200
|
+
entries[loc] = value;
|
|
3201
|
+
});
|
|
3202
|
+
}
|
|
3203
|
+
if (input[_DS] != null) {
|
|
3204
|
+
entries[_DS] = input[_DS];
|
|
3205
|
+
}
|
|
3206
|
+
if (input[_T] != null) {
|
|
3207
|
+
const memberEntries = se_tagListType(input[_T]);
|
|
3208
|
+
if (input[_T]?.length === 0) {
|
|
3209
|
+
entries.Tags = [];
|
|
3210
|
+
}
|
|
3211
|
+
Object.entries(memberEntries).forEach(([key, value]) => {
|
|
3212
|
+
const loc = `Tags.${key}`;
|
|
3213
|
+
entries[loc] = value;
|
|
3214
|
+
});
|
|
3215
|
+
}
|
|
3216
|
+
return entries;
|
|
3217
|
+
};
|
|
3218
|
+
const se_GetSessionTokenRequest = (input, context) => {
|
|
3219
|
+
const entries = {};
|
|
3220
|
+
if (input[_DS] != null) {
|
|
3221
|
+
entries[_DS] = input[_DS];
|
|
3222
|
+
}
|
|
3223
|
+
if (input[_SN] != null) {
|
|
3224
|
+
entries[_SN] = input[_SN];
|
|
3225
|
+
}
|
|
3226
|
+
if (input[_TC] != null) {
|
|
3227
|
+
entries[_TC] = input[_TC];
|
|
3228
|
+
}
|
|
3229
|
+
return entries;
|
|
3230
|
+
};
|
|
3231
|
+
const se_policyDescriptorListType = (input, context) => {
|
|
3232
|
+
const entries = {};
|
|
3233
|
+
let counter = 1;
|
|
3234
|
+
for (const entry of input) {
|
|
3235
|
+
if (entry === null) {
|
|
3236
|
+
continue;
|
|
3237
|
+
}
|
|
3238
|
+
const memberEntries = se_PolicyDescriptorType(entry);
|
|
3239
|
+
Object.entries(memberEntries).forEach(([key, value]) => {
|
|
3240
|
+
entries[`member.${counter}.${key}`] = value;
|
|
3241
|
+
});
|
|
3242
|
+
counter++;
|
|
3243
|
+
}
|
|
3244
|
+
return entries;
|
|
3245
|
+
};
|
|
3246
|
+
const se_PolicyDescriptorType = (input, context) => {
|
|
3247
|
+
const entries = {};
|
|
3248
|
+
if (input[_a] != null) {
|
|
3249
|
+
entries[_a] = input[_a];
|
|
3250
|
+
}
|
|
3251
|
+
return entries;
|
|
3252
|
+
};
|
|
3253
|
+
const se_ProvidedContext = (input, context) => {
|
|
3254
|
+
const entries = {};
|
|
3255
|
+
if (input[_PAro] != null) {
|
|
3256
|
+
entries[_PAro] = input[_PAro];
|
|
3257
|
+
}
|
|
3258
|
+
if (input[_CA] != null) {
|
|
3259
|
+
entries[_CA] = input[_CA];
|
|
3260
|
+
}
|
|
3261
|
+
return entries;
|
|
3262
|
+
};
|
|
3263
|
+
const se_ProvidedContextsListType = (input, context) => {
|
|
3264
|
+
const entries = {};
|
|
3265
|
+
let counter = 1;
|
|
3266
|
+
for (const entry of input) {
|
|
3267
|
+
if (entry === null) {
|
|
3268
|
+
continue;
|
|
3269
|
+
}
|
|
3270
|
+
const memberEntries = se_ProvidedContext(entry);
|
|
3271
|
+
Object.entries(memberEntries).forEach(([key, value]) => {
|
|
3272
|
+
entries[`member.${counter}.${key}`] = value;
|
|
3273
|
+
});
|
|
3274
|
+
counter++;
|
|
3275
|
+
}
|
|
3276
|
+
return entries;
|
|
3277
|
+
};
|
|
3278
|
+
const se_Tag = (input, context) => {
|
|
3279
|
+
const entries = {};
|
|
3280
|
+
if (input[_K] != null) {
|
|
3281
|
+
entries[_K] = input[_K];
|
|
3282
|
+
}
|
|
3283
|
+
if (input[_Va] != null) {
|
|
3284
|
+
entries[_Va] = input[_Va];
|
|
3285
|
+
}
|
|
3286
|
+
return entries;
|
|
3287
|
+
};
|
|
3288
|
+
const se_tagKeyListType = (input, context) => {
|
|
3289
|
+
const entries = {};
|
|
3290
|
+
let counter = 1;
|
|
3291
|
+
for (const entry of input) {
|
|
3292
|
+
if (entry === null) {
|
|
3293
|
+
continue;
|
|
3294
|
+
}
|
|
3295
|
+
entries[`member.${counter}`] = entry;
|
|
3296
|
+
counter++;
|
|
3297
|
+
}
|
|
3298
|
+
return entries;
|
|
3299
|
+
};
|
|
3300
|
+
const se_tagListType = (input, context) => {
|
|
3301
|
+
const entries = {};
|
|
3302
|
+
let counter = 1;
|
|
3303
|
+
for (const entry of input) {
|
|
3304
|
+
if (entry === null) {
|
|
3305
|
+
continue;
|
|
3306
|
+
}
|
|
3307
|
+
const memberEntries = se_Tag(entry);
|
|
3308
|
+
Object.entries(memberEntries).forEach(([key, value]) => {
|
|
3309
|
+
entries[`member.${counter}.${key}`] = value;
|
|
3310
|
+
});
|
|
3311
|
+
counter++;
|
|
3312
|
+
}
|
|
3313
|
+
return entries;
|
|
3314
|
+
};
|
|
3315
|
+
const de_AssumedRoleUser = (output, context) => {
|
|
3316
|
+
const contents = {};
|
|
3317
|
+
if (output[_ARI] != null) {
|
|
3318
|
+
contents[_ARI] = expectString(output[_ARI]);
|
|
3319
|
+
}
|
|
3320
|
+
if (output[_Ar] != null) {
|
|
3321
|
+
contents[_Ar] = expectString(output[_Ar]);
|
|
3322
|
+
}
|
|
3323
|
+
return contents;
|
|
3324
|
+
};
|
|
3325
|
+
const de_AssumeRoleResponse = (output, context) => {
|
|
3326
|
+
const contents = {};
|
|
3327
|
+
if (output[_C] != null) {
|
|
3328
|
+
contents[_C] = de_Credentials(output[_C]);
|
|
3329
|
+
}
|
|
3330
|
+
if (output[_ARU] != null) {
|
|
3331
|
+
contents[_ARU] = de_AssumedRoleUser(output[_ARU]);
|
|
3332
|
+
}
|
|
3333
|
+
if (output[_PPS] != null) {
|
|
3334
|
+
contents[_PPS] = strictParseInt32(output[_PPS]);
|
|
3335
|
+
}
|
|
3336
|
+
if (output[_SI] != null) {
|
|
3337
|
+
contents[_SI] = expectString(output[_SI]);
|
|
3338
|
+
}
|
|
3339
|
+
return contents;
|
|
3340
|
+
};
|
|
3341
|
+
const de_AssumeRoleWithSAMLResponse = (output, context) => {
|
|
3342
|
+
const contents = {};
|
|
3343
|
+
if (output[_C] != null) {
|
|
3344
|
+
contents[_C] = de_Credentials(output[_C]);
|
|
3345
|
+
}
|
|
3346
|
+
if (output[_ARU] != null) {
|
|
3347
|
+
contents[_ARU] = de_AssumedRoleUser(output[_ARU]);
|
|
3348
|
+
}
|
|
3349
|
+
if (output[_PPS] != null) {
|
|
3350
|
+
contents[_PPS] = strictParseInt32(output[_PPS]);
|
|
3351
|
+
}
|
|
3352
|
+
if (output[_S] != null) {
|
|
3353
|
+
contents[_S] = expectString(output[_S]);
|
|
3354
|
+
}
|
|
3355
|
+
if (output[_ST] != null) {
|
|
3356
|
+
contents[_ST] = expectString(output[_ST]);
|
|
3357
|
+
}
|
|
3358
|
+
if (output[_I] != null) {
|
|
3359
|
+
contents[_I] = expectString(output[_I]);
|
|
3360
|
+
}
|
|
3361
|
+
if (output[_Au] != null) {
|
|
3362
|
+
contents[_Au] = expectString(output[_Au]);
|
|
3363
|
+
}
|
|
3364
|
+
if (output[_NQ] != null) {
|
|
3365
|
+
contents[_NQ] = expectString(output[_NQ]);
|
|
3366
|
+
}
|
|
3367
|
+
if (output[_SI] != null) {
|
|
3368
|
+
contents[_SI] = expectString(output[_SI]);
|
|
3369
|
+
}
|
|
3370
|
+
return contents;
|
|
3371
|
+
};
|
|
3372
|
+
const de_AssumeRoleWithWebIdentityResponse = (output, context) => {
|
|
3373
|
+
const contents = {};
|
|
3374
|
+
if (output[_C] != null) {
|
|
3375
|
+
contents[_C] = de_Credentials(output[_C]);
|
|
3376
|
+
}
|
|
3377
|
+
if (output[_SFWIT] != null) {
|
|
3378
|
+
contents[_SFWIT] = expectString(output[_SFWIT]);
|
|
3379
|
+
}
|
|
3380
|
+
if (output[_ARU] != null) {
|
|
3381
|
+
contents[_ARU] = de_AssumedRoleUser(output[_ARU]);
|
|
3382
|
+
}
|
|
3383
|
+
if (output[_PPS] != null) {
|
|
3384
|
+
contents[_PPS] = strictParseInt32(output[_PPS]);
|
|
3385
|
+
}
|
|
3386
|
+
if (output[_Pr] != null) {
|
|
3387
|
+
contents[_Pr] = expectString(output[_Pr]);
|
|
3388
|
+
}
|
|
3389
|
+
if (output[_Au] != null) {
|
|
3390
|
+
contents[_Au] = expectString(output[_Au]);
|
|
3391
|
+
}
|
|
3392
|
+
if (output[_SI] != null) {
|
|
3393
|
+
contents[_SI] = expectString(output[_SI]);
|
|
3394
|
+
}
|
|
3395
|
+
return contents;
|
|
3396
|
+
};
|
|
3397
|
+
const de_AssumeRootResponse = (output, context) => {
|
|
3398
|
+
const contents = {};
|
|
3399
|
+
if (output[_C] != null) {
|
|
3400
|
+
contents[_C] = de_Credentials(output[_C]);
|
|
3401
|
+
}
|
|
3402
|
+
if (output[_SI] != null) {
|
|
3403
|
+
contents[_SI] = expectString(output[_SI]);
|
|
3404
|
+
}
|
|
3405
|
+
return contents;
|
|
3406
|
+
};
|
|
3407
|
+
const de_Credentials = (output, context) => {
|
|
3408
|
+
const contents = {};
|
|
3409
|
+
if (output[_AKI] != null) {
|
|
3410
|
+
contents[_AKI] = expectString(output[_AKI]);
|
|
3411
|
+
}
|
|
3412
|
+
if (output[_SAK] != null) {
|
|
3413
|
+
contents[_SAK] = expectString(output[_SAK]);
|
|
3414
|
+
}
|
|
3415
|
+
if (output[_STe] != null) {
|
|
3416
|
+
contents[_STe] = expectString(output[_STe]);
|
|
3417
|
+
}
|
|
3418
|
+
if (output[_E] != null) {
|
|
3419
|
+
contents[_E] = expectNonNull(parseRfc3339DateTimeWithOffset(output[_E]));
|
|
3420
|
+
}
|
|
3421
|
+
return contents;
|
|
3422
|
+
};
|
|
3423
|
+
const de_DecodeAuthorizationMessageResponse = (output, context) => {
|
|
3424
|
+
const contents = {};
|
|
3425
|
+
if (output[_DM] != null) {
|
|
3426
|
+
contents[_DM] = expectString(output[_DM]);
|
|
3427
|
+
}
|
|
3428
|
+
return contents;
|
|
3429
|
+
};
|
|
3430
|
+
const de_ExpiredTokenException = (output, context) => {
|
|
3431
|
+
const contents = {};
|
|
3432
|
+
if (output[_m] != null) {
|
|
3433
|
+
contents[_m] = expectString(output[_m]);
|
|
3434
|
+
}
|
|
3435
|
+
return contents;
|
|
3436
|
+
};
|
|
3437
|
+
const de_FederatedUser = (output, context) => {
|
|
3438
|
+
const contents = {};
|
|
3439
|
+
if (output[_FUI] != null) {
|
|
3440
|
+
contents[_FUI] = expectString(output[_FUI]);
|
|
3441
|
+
}
|
|
3442
|
+
if (output[_Ar] != null) {
|
|
3443
|
+
contents[_Ar] = expectString(output[_Ar]);
|
|
3444
|
+
}
|
|
3445
|
+
return contents;
|
|
3446
|
+
};
|
|
3447
|
+
const de_GetAccessKeyInfoResponse = (output, context) => {
|
|
3448
|
+
const contents = {};
|
|
3449
|
+
if (output[_Ac] != null) {
|
|
3450
|
+
contents[_Ac] = expectString(output[_Ac]);
|
|
3451
|
+
}
|
|
3452
|
+
return contents;
|
|
3453
|
+
};
|
|
3454
|
+
const de_GetCallerIdentityResponse = (output, context) => {
|
|
3455
|
+
const contents = {};
|
|
3456
|
+
if (output[_UI] != null) {
|
|
3457
|
+
contents[_UI] = expectString(output[_UI]);
|
|
3458
|
+
}
|
|
3459
|
+
if (output[_Ac] != null) {
|
|
3460
|
+
contents[_Ac] = expectString(output[_Ac]);
|
|
3461
|
+
}
|
|
3462
|
+
if (output[_Ar] != null) {
|
|
3463
|
+
contents[_Ar] = expectString(output[_Ar]);
|
|
3464
|
+
}
|
|
3465
|
+
return contents;
|
|
3466
|
+
};
|
|
3467
|
+
const de_GetFederationTokenResponse = (output, context) => {
|
|
3468
|
+
const contents = {};
|
|
3469
|
+
if (output[_C] != null) {
|
|
3470
|
+
contents[_C] = de_Credentials(output[_C]);
|
|
3471
|
+
}
|
|
3472
|
+
if (output[_FU] != null) {
|
|
3473
|
+
contents[_FU] = de_FederatedUser(output[_FU]);
|
|
3474
|
+
}
|
|
3475
|
+
if (output[_PPS] != null) {
|
|
3476
|
+
contents[_PPS] = strictParseInt32(output[_PPS]);
|
|
3477
|
+
}
|
|
3478
|
+
return contents;
|
|
3479
|
+
};
|
|
3480
|
+
const de_GetSessionTokenResponse = (output, context) => {
|
|
3481
|
+
const contents = {};
|
|
3482
|
+
if (output[_C] != null) {
|
|
3483
|
+
contents[_C] = de_Credentials(output[_C]);
|
|
3484
|
+
}
|
|
3485
|
+
return contents;
|
|
3486
|
+
};
|
|
3487
|
+
const de_IDPCommunicationErrorException = (output, context) => {
|
|
3488
|
+
const contents = {};
|
|
3489
|
+
if (output[_m] != null) {
|
|
3490
|
+
contents[_m] = expectString(output[_m]);
|
|
3491
|
+
}
|
|
3492
|
+
return contents;
|
|
3493
|
+
};
|
|
3494
|
+
const de_IDPRejectedClaimException = (output, context) => {
|
|
3495
|
+
const contents = {};
|
|
3496
|
+
if (output[_m] != null) {
|
|
3497
|
+
contents[_m] = expectString(output[_m]);
|
|
3498
|
+
}
|
|
3499
|
+
return contents;
|
|
3500
|
+
};
|
|
3501
|
+
const de_InvalidAuthorizationMessageException = (output, context) => {
|
|
3502
|
+
const contents = {};
|
|
3503
|
+
if (output[_m] != null) {
|
|
3504
|
+
contents[_m] = expectString(output[_m]);
|
|
3505
|
+
}
|
|
3506
|
+
return contents;
|
|
3507
|
+
};
|
|
3508
|
+
const de_InvalidIdentityTokenException = (output, context) => {
|
|
3509
|
+
const contents = {};
|
|
3510
|
+
if (output[_m] != null) {
|
|
3511
|
+
contents[_m] = expectString(output[_m]);
|
|
3512
|
+
}
|
|
3513
|
+
return contents;
|
|
3514
|
+
};
|
|
3515
|
+
const de_MalformedPolicyDocumentException = (output, context) => {
|
|
3516
|
+
const contents = {};
|
|
3517
|
+
if (output[_m] != null) {
|
|
3518
|
+
contents[_m] = expectString(output[_m]);
|
|
3519
|
+
}
|
|
3520
|
+
return contents;
|
|
3521
|
+
};
|
|
3522
|
+
const de_PackedPolicyTooLargeException = (output, context) => {
|
|
3523
|
+
const contents = {};
|
|
3524
|
+
if (output[_m] != null) {
|
|
3525
|
+
contents[_m] = expectString(output[_m]);
|
|
3526
|
+
}
|
|
3527
|
+
return contents;
|
|
3528
|
+
};
|
|
3529
|
+
const de_RegionDisabledException = (output, context) => {
|
|
3530
|
+
const contents = {};
|
|
3531
|
+
if (output[_m] != null) {
|
|
3532
|
+
contents[_m] = expectString(output[_m]);
|
|
3533
|
+
}
|
|
3534
|
+
return contents;
|
|
3535
|
+
};
|
|
3536
|
+
const deserializeMetadata = (output) => ({
|
|
3537
|
+
httpStatusCode: output.statusCode,
|
|
3538
|
+
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
|
|
3539
|
+
extendedRequestId: output.headers["x-amz-id-2"],
|
|
3540
|
+
cfId: output.headers["x-amz-cf-id"],
|
|
3541
|
+
});
|
|
3542
|
+
const throwDefaultError = withBaseException(STSServiceException);
|
|
3543
|
+
const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => {
|
|
3544
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
3545
|
+
const contents = {
|
|
3546
|
+
protocol,
|
|
3547
|
+
hostname,
|
|
3548
|
+
port,
|
|
3549
|
+
method: "POST",
|
|
3550
|
+
path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
|
|
3551
|
+
headers,
|
|
3552
|
+
};
|
|
3553
|
+
if (body !== undefined) {
|
|
3554
|
+
contents.body = body;
|
|
3555
|
+
}
|
|
3556
|
+
return new HttpRequest(contents);
|
|
3557
|
+
};
|
|
3558
|
+
const SHARED_HEADERS = {
|
|
3559
|
+
"content-type": "application/x-www-form-urlencoded",
|
|
3560
|
+
};
|
|
3561
|
+
const _ = "2011-06-15";
|
|
3562
|
+
const _A = "Action";
|
|
3563
|
+
const _AKI = "AccessKeyId";
|
|
3564
|
+
const _AR = "AssumeRole";
|
|
3565
|
+
const _ARI = "AssumedRoleId";
|
|
3566
|
+
const _ARU = "AssumedRoleUser";
|
|
3567
|
+
const _ARWSAML = "AssumeRoleWithSAML";
|
|
3568
|
+
const _ARWWI = "AssumeRoleWithWebIdentity";
|
|
3569
|
+
const _ARs = "AssumeRoot";
|
|
3570
|
+
const _Ac = "Account";
|
|
3571
|
+
const _Ar = "Arn";
|
|
3572
|
+
const _Au = "Audience";
|
|
3573
|
+
const _C = "Credentials";
|
|
3574
|
+
const _CA = "ContextAssertion";
|
|
3575
|
+
const _DAM = "DecodeAuthorizationMessage";
|
|
3576
|
+
const _DM = "DecodedMessage";
|
|
3577
|
+
const _DS = "DurationSeconds";
|
|
3578
|
+
const _E = "Expiration";
|
|
3579
|
+
const _EI = "ExternalId";
|
|
3580
|
+
const _EM = "EncodedMessage";
|
|
3581
|
+
const _FU = "FederatedUser";
|
|
3582
|
+
const _FUI = "FederatedUserId";
|
|
3583
|
+
const _GAKI = "GetAccessKeyInfo";
|
|
3584
|
+
const _GCI = "GetCallerIdentity";
|
|
3585
|
+
const _GFT = "GetFederationToken";
|
|
3586
|
+
const _GST = "GetSessionToken";
|
|
3587
|
+
const _I = "Issuer";
|
|
3588
|
+
const _K = "Key";
|
|
3589
|
+
const _N = "Name";
|
|
3590
|
+
const _NQ = "NameQualifier";
|
|
3591
|
+
const _P = "Policy";
|
|
3592
|
+
const _PA = "PolicyArns";
|
|
3593
|
+
const _PAr = "PrincipalArn";
|
|
3594
|
+
const _PAro = "ProviderArn";
|
|
3595
|
+
const _PC = "ProvidedContexts";
|
|
3596
|
+
const _PI = "ProviderId";
|
|
3597
|
+
const _PPS = "PackedPolicySize";
|
|
3598
|
+
const _Pr = "Provider";
|
|
3599
|
+
const _RA = "RoleArn";
|
|
3600
|
+
const _RSN = "RoleSessionName";
|
|
3601
|
+
const _S = "Subject";
|
|
3602
|
+
const _SAK = "SecretAccessKey";
|
|
3603
|
+
const _SAMLA = "SAMLAssertion";
|
|
3604
|
+
const _SFWIT = "SubjectFromWebIdentityToken";
|
|
3605
|
+
const _SI = "SourceIdentity";
|
|
3606
|
+
const _SN = "SerialNumber";
|
|
3607
|
+
const _ST = "SubjectType";
|
|
3608
|
+
const _STe = "SessionToken";
|
|
3609
|
+
const _T = "Tags";
|
|
3610
|
+
const _TC = "TokenCode";
|
|
3611
|
+
const _TP = "TargetPrincipal";
|
|
3612
|
+
const _TPA = "TaskPolicyArn";
|
|
3613
|
+
const _TTK = "TransitiveTagKeys";
|
|
3614
|
+
const _UI = "UserId";
|
|
3615
|
+
const _V = "Version";
|
|
3616
|
+
const _Va = "Value";
|
|
3617
|
+
const _WIT = "WebIdentityToken";
|
|
3618
|
+
const _a = "arn";
|
|
3619
|
+
const _m = "message";
|
|
3620
|
+
const buildFormUrlencodedString = (formEntries) => Object.entries(formEntries)
|
|
3621
|
+
.map(([key, value]) => extendedEncodeURIComponent(key) + "=" + extendedEncodeURIComponent(value))
|
|
3622
|
+
.join("&");
|
|
3623
|
+
const loadQueryErrorCode = (output, data) => {
|
|
3624
|
+
if (data.Error?.Code !== undefined) {
|
|
3625
|
+
return data.Error.Code;
|
|
3626
|
+
}
|
|
3627
|
+
if (output.statusCode == 404) {
|
|
3628
|
+
return "NotFound";
|
|
3629
|
+
}
|
|
3630
|
+
};
|
|
3631
|
+
|
|
3632
|
+
class AssumeRoleCommand extends Command
|
|
3633
|
+
.classBuilder()
|
|
3634
|
+
.ep(commonParams)
|
|
3635
|
+
.m(function (Command, cs, config, o) {
|
|
3636
|
+
return [
|
|
3637
|
+
getSerdePlugin(config, this.serialize, this.deserialize),
|
|
3638
|
+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
|
|
3639
|
+
];
|
|
3640
|
+
})
|
|
3641
|
+
.s("AWSSecurityTokenServiceV20110615", "AssumeRole", {})
|
|
3642
|
+
.n("STSClient", "AssumeRoleCommand")
|
|
3643
|
+
.f(undefined, AssumeRoleResponseFilterSensitiveLog)
|
|
3644
|
+
.ser(se_AssumeRoleCommand)
|
|
3645
|
+
.de(de_AssumeRoleCommand)
|
|
3646
|
+
.build() {
|
|
3647
|
+
}
|
|
3648
|
+
|
|
3649
|
+
export { AssumeRoleCommand as A, InvalidAuthorizationMessageException as B, CredentialsFilterSensitiveLog as C, AssumeRoleResponseFilterSensitiveLog as D, ExpiredTokenException as E, GetFederationTokenResponseFilterSensitiveLog as G, IDPRejectedClaimException as I, MalformedPolicyDocumentException as M, PackedPolicyTooLargeException as P, RegionDisabledException as R, STSClient as S, AssumeRoleWithSAMLRequestFilterSensitiveLog as a, AssumeRoleWithSAMLResponseFilterSensitiveLog as b, commonParams as c, de_AssumeRoleWithSAMLCommand as d, AssumeRoleWithWebIdentityRequestFilterSensitiveLog as e, AssumeRoleWithWebIdentityResponseFilterSensitiveLog as f, se_AssumeRoleWithWebIdentityCommand as g, de_AssumeRoleWithWebIdentityCommand as h, AssumeRootResponseFilterSensitiveLog as i, se_AssumeRootCommand as j, de_AssumeRootCommand as k, se_DecodeAuthorizationMessageCommand as l, de_DecodeAuthorizationMessageCommand as m, se_GetAccessKeyInfoCommand as n, de_GetAccessKeyInfoCommand as o, se_GetCallerIdentityCommand as p, de_GetCallerIdentityCommand as q, se_GetFederationTokenCommand as r, se_AssumeRoleWithSAMLCommand as s, de_GetFederationTokenCommand as t, GetSessionTokenResponseFilterSensitiveLog as u, se_GetSessionTokenCommand as v, de_GetSessionTokenCommand as w, STSServiceException as x, InvalidIdentityTokenException as y, IDPCommunicationErrorException as z };
|
|
3650
|
+
//# sourceMappingURL=AssumeRoleCommand-Cse3dzcY.js.map
|