@allthings/sdk 6.2.0-2 → 6.2.0-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +343 -298
- package/dist/lib.cjs.js +394 -298
- package/dist/lib.esm.js +391 -299
- package/dist/lib.umd.min.js +43 -1
- package/dist/src/aws/index.d.ts +2 -2
- package/dist/src/index.d.ts +1 -0
- package/package.json +6 -6
package/dist/lib.cjs.js
CHANGED
|
@@ -1,15 +1,84 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var clientSsm = require('@aws-sdk/client-ssm');
|
|
3
4
|
var querystring = require('query-string');
|
|
4
5
|
var fetch = require('cross-fetch');
|
|
5
6
|
var Bottleneck = require('bottleneck');
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
7
|
+
var require$$1 = require('util');
|
|
8
|
+
var require$$0$1 = require('stream');
|
|
9
|
+
var require$$1$1 = require('path');
|
|
10
|
+
var require$$3 = require('http');
|
|
11
|
+
var require$$4 = require('https');
|
|
12
|
+
var require$$5 = require('url');
|
|
13
|
+
var require$$6 = require('fs');
|
|
14
|
+
|
|
15
|
+
var __rest$5 = (undefined && undefined.__rest) || function (s, e) {
|
|
16
|
+
var t = {};
|
|
17
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
18
|
+
t[p] = s[p];
|
|
19
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
20
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
21
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
22
|
+
t[p[i]] = s[p[i]];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
const DEFAULT_CLIENT_CONFIG = {
|
|
27
|
+
clientConfig: DEFAULT_AWS_CONFIGURATION,
|
|
28
|
+
onlyDefault: false,
|
|
29
|
+
prefix: process.env.SSM_PARAM_PATH,
|
|
30
|
+
};
|
|
31
|
+
const getSecrets = async (ssm, config, params, defaultValue = '') => {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
if (config.onlyDefault) {
|
|
34
|
+
return [defaultValue];
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
const parameters = await ssm.send(new clientSsm.GetParametersCommand({
|
|
38
|
+
Names: params.map((param) => config.prefix + param),
|
|
39
|
+
WithDecryption: true,
|
|
40
|
+
}));
|
|
41
|
+
return ((_b = (_a = parameters === null || parameters === void 0 ? void 0 : parameters.Parameters) === null || _a === void 0 ? void 0 : _a.map((parameter) => { var _a; return (_a = parameter.Value) !== null && _a !== void 0 ? _a : defaultValue; })) !== null && _b !== void 0 ? _b : [defaultValue]);
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
if (config.logger) {
|
|
45
|
+
config.logger(e);
|
|
46
|
+
}
|
|
47
|
+
return [defaultValue];
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const getSecret = async (ssm, config, param, defaultValue = '') => {
|
|
51
|
+
var _a, _b;
|
|
52
|
+
if (config.onlyDefault) {
|
|
53
|
+
return defaultValue;
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const parameter = await ssm.send(new clientSsm.GetParameterCommand({
|
|
57
|
+
Name: config.prefix + param,
|
|
58
|
+
WithDecryption: true,
|
|
59
|
+
}));
|
|
60
|
+
return (_b = (_a = parameter === null || parameter === void 0 ? void 0 : parameter.Parameter) === null || _a === void 0 ? void 0 : _a.Value) !== null && _b !== void 0 ? _b : defaultValue;
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
if (config.logger) {
|
|
64
|
+
config.logger(e);
|
|
65
|
+
}
|
|
66
|
+
return defaultValue;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const parameterStore = (userConfig) => {
|
|
70
|
+
const _a = Object.assign(Object.assign({}, DEFAULT_CLIENT_CONFIG), userConfig), { clientConfig } = _a, config = __rest$5(_a, ["clientConfig"]);
|
|
71
|
+
const ssm = new clientSsm.SSMClient(clientConfig);
|
|
72
|
+
return {
|
|
73
|
+
getSecret: (param, defaultValue) => getSecret(ssm, config, param, defaultValue),
|
|
74
|
+
getSecrets: (params, defaultValue) => getSecrets(ssm, config, params, defaultValue),
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const DEFAULT_AWS_CONFIGURATION = {
|
|
79
|
+
region: 'eu-central-2',
|
|
80
|
+
};
|
|
81
|
+
var index = { parameterStore };
|
|
13
82
|
|
|
14
83
|
function createTokenStore(initialToken) {
|
|
15
84
|
const token = new Map(Object.entries(initialToken || {}));
|
|
@@ -20,7 +89,7 @@ function createTokenStore(initialToken) {
|
|
|
20
89
|
};
|
|
21
90
|
}
|
|
22
91
|
|
|
23
|
-
const version = "6.2.0-
|
|
92
|
+
const version = "6.2.0-3";
|
|
24
93
|
|
|
25
94
|
const REST_API_URL = 'https://api.allthings.me';
|
|
26
95
|
const OAUTH_URL = 'https://accounts.allthings.me';
|
|
@@ -849,11 +918,15 @@ async function put(request, method, body, returnRawResultObject, headers) {
|
|
|
849
918
|
return request('put', method, { body, headers }, returnRawResultObject);
|
|
850
919
|
}
|
|
851
920
|
|
|
852
|
-
|
|
921
|
+
function getDefaultExportFromCjs (x) {
|
|
922
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
923
|
+
}
|
|
853
924
|
|
|
925
|
+
var Stream$2 = require$$0$1.Stream;
|
|
926
|
+
var util$2 = require$$1;
|
|
854
927
|
|
|
855
|
-
var delayed_stream = DelayedStream;
|
|
856
|
-
function DelayedStream() {
|
|
928
|
+
var delayed_stream = DelayedStream$1;
|
|
929
|
+
function DelayedStream$1() {
|
|
857
930
|
this.source = null;
|
|
858
931
|
this.dataSize = 0;
|
|
859
932
|
this.maxDataSize = 1024 * 1024;
|
|
@@ -863,9 +936,9 @@ function DelayedStream() {
|
|
|
863
936
|
this._released = false;
|
|
864
937
|
this._bufferedEvents = [];
|
|
865
938
|
}
|
|
866
|
-
util.inherits(DelayedStream, Stream$2);
|
|
939
|
+
util$2.inherits(DelayedStream$1, Stream$2);
|
|
867
940
|
|
|
868
|
-
DelayedStream.create = function(source, options) {
|
|
941
|
+
DelayedStream$1.create = function(source, options) {
|
|
869
942
|
var delayedStream = new this();
|
|
870
943
|
|
|
871
944
|
options = options || {};
|
|
@@ -889,7 +962,7 @@ DelayedStream.create = function(source, options) {
|
|
|
889
962
|
return delayedStream;
|
|
890
963
|
};
|
|
891
964
|
|
|
892
|
-
Object.defineProperty(DelayedStream.prototype, 'readable', {
|
|
965
|
+
Object.defineProperty(DelayedStream$1.prototype, 'readable', {
|
|
893
966
|
configurable: true,
|
|
894
967
|
enumerable: true,
|
|
895
968
|
get: function() {
|
|
@@ -897,11 +970,11 @@ Object.defineProperty(DelayedStream.prototype, 'readable', {
|
|
|
897
970
|
}
|
|
898
971
|
});
|
|
899
972
|
|
|
900
|
-
DelayedStream.prototype.setEncoding = function() {
|
|
973
|
+
DelayedStream$1.prototype.setEncoding = function() {
|
|
901
974
|
return this.source.setEncoding.apply(this.source, arguments);
|
|
902
975
|
};
|
|
903
976
|
|
|
904
|
-
DelayedStream.prototype.resume = function() {
|
|
977
|
+
DelayedStream$1.prototype.resume = function() {
|
|
905
978
|
if (!this._released) {
|
|
906
979
|
this.release();
|
|
907
980
|
}
|
|
@@ -909,11 +982,11 @@ DelayedStream.prototype.resume = function() {
|
|
|
909
982
|
this.source.resume();
|
|
910
983
|
};
|
|
911
984
|
|
|
912
|
-
DelayedStream.prototype.pause = function() {
|
|
985
|
+
DelayedStream$1.prototype.pause = function() {
|
|
913
986
|
this.source.pause();
|
|
914
987
|
};
|
|
915
988
|
|
|
916
|
-
DelayedStream.prototype.release = function() {
|
|
989
|
+
DelayedStream$1.prototype.release = function() {
|
|
917
990
|
this._released = true;
|
|
918
991
|
|
|
919
992
|
this._bufferedEvents.forEach(function(args) {
|
|
@@ -922,13 +995,13 @@ DelayedStream.prototype.release = function() {
|
|
|
922
995
|
this._bufferedEvents = [];
|
|
923
996
|
};
|
|
924
997
|
|
|
925
|
-
DelayedStream.prototype.pipe = function() {
|
|
998
|
+
DelayedStream$1.prototype.pipe = function() {
|
|
926
999
|
var r = Stream$2.prototype.pipe.apply(this, arguments);
|
|
927
1000
|
this.resume();
|
|
928
1001
|
return r;
|
|
929
1002
|
};
|
|
930
1003
|
|
|
931
|
-
DelayedStream.prototype._handleEmit = function(args) {
|
|
1004
|
+
DelayedStream$1.prototype._handleEmit = function(args) {
|
|
932
1005
|
if (this._released) {
|
|
933
1006
|
this.emit.apply(this, args);
|
|
934
1007
|
return;
|
|
@@ -942,7 +1015,7 @@ DelayedStream.prototype._handleEmit = function(args) {
|
|
|
942
1015
|
this._bufferedEvents.push(args);
|
|
943
1016
|
};
|
|
944
1017
|
|
|
945
|
-
DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() {
|
|
1018
|
+
DelayedStream$1.prototype._checkIfMaxDataSizeExceeded = function() {
|
|
946
1019
|
if (this._maxDataSizeExceeded) {
|
|
947
1020
|
return;
|
|
948
1021
|
}
|
|
@@ -957,11 +1030,12 @@ DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() {
|
|
|
957
1030
|
this.emit('error', new Error(message));
|
|
958
1031
|
};
|
|
959
1032
|
|
|
960
|
-
var
|
|
961
|
-
|
|
1033
|
+
var util$1 = require$$1;
|
|
1034
|
+
var Stream$1 = require$$0$1.Stream;
|
|
1035
|
+
var DelayedStream = delayed_stream;
|
|
962
1036
|
|
|
963
|
-
var combined_stream = CombinedStream;
|
|
964
|
-
function CombinedStream() {
|
|
1037
|
+
var combined_stream = CombinedStream$1;
|
|
1038
|
+
function CombinedStream$1() {
|
|
965
1039
|
this.writable = false;
|
|
966
1040
|
this.readable = true;
|
|
967
1041
|
this.dataSize = 0;
|
|
@@ -974,9 +1048,9 @@ function CombinedStream() {
|
|
|
974
1048
|
this._insideLoop = false;
|
|
975
1049
|
this._pendingNext = false;
|
|
976
1050
|
}
|
|
977
|
-
util.inherits(CombinedStream, Stream$1);
|
|
1051
|
+
util$1.inherits(CombinedStream$1, Stream$1);
|
|
978
1052
|
|
|
979
|
-
CombinedStream.create = function(options) {
|
|
1053
|
+
CombinedStream$1.create = function(options) {
|
|
980
1054
|
var combinedStream = new this();
|
|
981
1055
|
|
|
982
1056
|
options = options || {};
|
|
@@ -987,7 +1061,7 @@ CombinedStream.create = function(options) {
|
|
|
987
1061
|
return combinedStream;
|
|
988
1062
|
};
|
|
989
1063
|
|
|
990
|
-
CombinedStream.isStreamLike = function(stream) {
|
|
1064
|
+
CombinedStream$1.isStreamLike = function(stream) {
|
|
991
1065
|
return (typeof stream !== 'function')
|
|
992
1066
|
&& (typeof stream !== 'string')
|
|
993
1067
|
&& (typeof stream !== 'boolean')
|
|
@@ -995,12 +1069,12 @@ CombinedStream.isStreamLike = function(stream) {
|
|
|
995
1069
|
&& (!Buffer.isBuffer(stream));
|
|
996
1070
|
};
|
|
997
1071
|
|
|
998
|
-
CombinedStream.prototype.append = function(stream) {
|
|
999
|
-
var isStreamLike = CombinedStream.isStreamLike(stream);
|
|
1072
|
+
CombinedStream$1.prototype.append = function(stream) {
|
|
1073
|
+
var isStreamLike = CombinedStream$1.isStreamLike(stream);
|
|
1000
1074
|
|
|
1001
1075
|
if (isStreamLike) {
|
|
1002
|
-
if (!(stream instanceof
|
|
1003
|
-
var newStream =
|
|
1076
|
+
if (!(stream instanceof DelayedStream)) {
|
|
1077
|
+
var newStream = DelayedStream.create(stream, {
|
|
1004
1078
|
maxDataSize: Infinity,
|
|
1005
1079
|
pauseStream: this.pauseStreams,
|
|
1006
1080
|
});
|
|
@@ -1019,13 +1093,13 @@ CombinedStream.prototype.append = function(stream) {
|
|
|
1019
1093
|
return this;
|
|
1020
1094
|
};
|
|
1021
1095
|
|
|
1022
|
-
CombinedStream.prototype.pipe = function(dest, options) {
|
|
1096
|
+
CombinedStream$1.prototype.pipe = function(dest, options) {
|
|
1023
1097
|
Stream$1.prototype.pipe.call(this, dest, options);
|
|
1024
1098
|
this.resume();
|
|
1025
1099
|
return dest;
|
|
1026
1100
|
};
|
|
1027
1101
|
|
|
1028
|
-
CombinedStream.prototype._getNext = function() {
|
|
1102
|
+
CombinedStream$1.prototype._getNext = function() {
|
|
1029
1103
|
this._currentStream = null;
|
|
1030
1104
|
|
|
1031
1105
|
if (this._insideLoop) {
|
|
@@ -1044,7 +1118,7 @@ CombinedStream.prototype._getNext = function() {
|
|
|
1044
1118
|
}
|
|
1045
1119
|
};
|
|
1046
1120
|
|
|
1047
|
-
CombinedStream.prototype._realGetNext = function() {
|
|
1121
|
+
CombinedStream$1.prototype._realGetNext = function() {
|
|
1048
1122
|
var stream = this._streams.shift();
|
|
1049
1123
|
|
|
1050
1124
|
|
|
@@ -1060,7 +1134,7 @@ CombinedStream.prototype._realGetNext = function() {
|
|
|
1060
1134
|
|
|
1061
1135
|
var getStream = stream;
|
|
1062
1136
|
getStream(function(stream) {
|
|
1063
|
-
var isStreamLike = CombinedStream.isStreamLike(stream);
|
|
1137
|
+
var isStreamLike = CombinedStream$1.isStreamLike(stream);
|
|
1064
1138
|
if (isStreamLike) {
|
|
1065
1139
|
stream.on('data', this._checkDataSize.bind(this));
|
|
1066
1140
|
this._handleErrors(stream);
|
|
@@ -1070,10 +1144,10 @@ CombinedStream.prototype._realGetNext = function() {
|
|
|
1070
1144
|
}.bind(this));
|
|
1071
1145
|
};
|
|
1072
1146
|
|
|
1073
|
-
CombinedStream.prototype._pipeNext = function(stream) {
|
|
1147
|
+
CombinedStream$1.prototype._pipeNext = function(stream) {
|
|
1074
1148
|
this._currentStream = stream;
|
|
1075
1149
|
|
|
1076
|
-
var isStreamLike = CombinedStream.isStreamLike(stream);
|
|
1150
|
+
var isStreamLike = CombinedStream$1.isStreamLike(stream);
|
|
1077
1151
|
if (isStreamLike) {
|
|
1078
1152
|
stream.on('end', this._getNext.bind(this));
|
|
1079
1153
|
stream.pipe(this, {end: false});
|
|
@@ -1085,18 +1159,18 @@ CombinedStream.prototype._pipeNext = function(stream) {
|
|
|
1085
1159
|
this._getNext();
|
|
1086
1160
|
};
|
|
1087
1161
|
|
|
1088
|
-
CombinedStream.prototype._handleErrors = function(stream) {
|
|
1162
|
+
CombinedStream$1.prototype._handleErrors = function(stream) {
|
|
1089
1163
|
var self = this;
|
|
1090
1164
|
stream.on('error', function(err) {
|
|
1091
1165
|
self._emitError(err);
|
|
1092
1166
|
});
|
|
1093
1167
|
};
|
|
1094
1168
|
|
|
1095
|
-
CombinedStream.prototype.write = function(data) {
|
|
1169
|
+
CombinedStream$1.prototype.write = function(data) {
|
|
1096
1170
|
this.emit('data', data);
|
|
1097
1171
|
};
|
|
1098
1172
|
|
|
1099
|
-
CombinedStream.prototype.pause = function() {
|
|
1173
|
+
CombinedStream$1.prototype.pause = function() {
|
|
1100
1174
|
if (!this.pauseStreams) {
|
|
1101
1175
|
return;
|
|
1102
1176
|
}
|
|
@@ -1105,7 +1179,7 @@ CombinedStream.prototype.pause = function() {
|
|
|
1105
1179
|
this.emit('pause');
|
|
1106
1180
|
};
|
|
1107
1181
|
|
|
1108
|
-
CombinedStream.prototype.resume = function() {
|
|
1182
|
+
CombinedStream$1.prototype.resume = function() {
|
|
1109
1183
|
if (!this._released) {
|
|
1110
1184
|
this._released = true;
|
|
1111
1185
|
this.writable = true;
|
|
@@ -1116,23 +1190,23 @@ CombinedStream.prototype.resume = function() {
|
|
|
1116
1190
|
this.emit('resume');
|
|
1117
1191
|
};
|
|
1118
1192
|
|
|
1119
|
-
CombinedStream.prototype.end = function() {
|
|
1193
|
+
CombinedStream$1.prototype.end = function() {
|
|
1120
1194
|
this._reset();
|
|
1121
1195
|
this.emit('end');
|
|
1122
1196
|
};
|
|
1123
1197
|
|
|
1124
|
-
CombinedStream.prototype.destroy = function() {
|
|
1198
|
+
CombinedStream$1.prototype.destroy = function() {
|
|
1125
1199
|
this._reset();
|
|
1126
1200
|
this.emit('close');
|
|
1127
1201
|
};
|
|
1128
1202
|
|
|
1129
|
-
CombinedStream.prototype._reset = function() {
|
|
1203
|
+
CombinedStream$1.prototype._reset = function() {
|
|
1130
1204
|
this.writable = false;
|
|
1131
1205
|
this._streams = [];
|
|
1132
1206
|
this._currentStream = null;
|
|
1133
1207
|
};
|
|
1134
1208
|
|
|
1135
|
-
CombinedStream.prototype._checkDataSize = function() {
|
|
1209
|
+
CombinedStream$1.prototype._checkDataSize = function() {
|
|
1136
1210
|
this._updateDataSize();
|
|
1137
1211
|
if (this.dataSize <= this.maxDataSize) {
|
|
1138
1212
|
return;
|
|
@@ -1143,7 +1217,7 @@ CombinedStream.prototype._checkDataSize = function() {
|
|
|
1143
1217
|
this._emitError(new Error(message));
|
|
1144
1218
|
};
|
|
1145
1219
|
|
|
1146
|
-
CombinedStream.prototype._updateDataSize = function() {
|
|
1220
|
+
CombinedStream$1.prototype._updateDataSize = function() {
|
|
1147
1221
|
this.dataSize = 0;
|
|
1148
1222
|
|
|
1149
1223
|
var self = this;
|
|
@@ -1160,20 +1234,14 @@ CombinedStream.prototype._updateDataSize = function() {
|
|
|
1160
1234
|
}
|
|
1161
1235
|
};
|
|
1162
1236
|
|
|
1163
|
-
CombinedStream.prototype._emitError = function(err) {
|
|
1237
|
+
CombinedStream$1.prototype._emitError = function(err) {
|
|
1164
1238
|
this._reset();
|
|
1165
1239
|
this.emit('error', err);
|
|
1166
1240
|
};
|
|
1167
1241
|
|
|
1168
|
-
|
|
1169
|
-
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
1170
|
-
}
|
|
1171
|
-
|
|
1172
|
-
function getCjsExportFromNamespace (n) {
|
|
1173
|
-
return n && n['default'] || n;
|
|
1174
|
-
}
|
|
1242
|
+
var mimeTypes = {};
|
|
1175
1243
|
|
|
1176
|
-
var
|
|
1244
|
+
var require$$0 = {
|
|
1177
1245
|
"application/1d-interleaved-parityfec": {
|
|
1178
1246
|
source: "iana"
|
|
1179
1247
|
},
|
|
@@ -10829,13 +10897,6 @@ var db = {
|
|
|
10829
10897
|
}
|
|
10830
10898
|
};
|
|
10831
10899
|
|
|
10832
|
-
var db$1 = /*#__PURE__*/Object.freeze({
|
|
10833
|
-
__proto__: null,
|
|
10834
|
-
default: db
|
|
10835
|
-
});
|
|
10836
|
-
|
|
10837
|
-
var require$$0 = getCjsExportFromNamespace(db$1);
|
|
10838
|
-
|
|
10839
10900
|
/*!
|
|
10840
10901
|
* mime-db
|
|
10841
10902
|
* Copyright(c) 2014 Jonathan Ong
|
|
@@ -10848,204 +10909,204 @@ var require$$0 = getCjsExportFromNamespace(db$1);
|
|
|
10848
10909
|
|
|
10849
10910
|
var mimeDb = require$$0;
|
|
10850
10911
|
|
|
10851
|
-
|
|
10852
|
-
|
|
10853
|
-
|
|
10854
|
-
*
|
|
10855
|
-
*
|
|
10856
|
-
*/
|
|
10857
|
-
|
|
10858
|
-
|
|
10859
|
-
var extname = path.extname;
|
|
10860
|
-
|
|
10861
|
-
/**
|
|
10862
|
-
* Module variables.
|
|
10863
|
-
* @private
|
|
10864
|
-
*/
|
|
10865
|
-
|
|
10866
|
-
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
10867
|
-
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
10868
|
-
|
|
10869
|
-
/**
|
|
10870
|
-
* Module exports.
|
|
10871
|
-
* @public
|
|
10872
|
-
*/
|
|
10873
|
-
|
|
10874
|
-
exports.charset = charset;
|
|
10875
|
-
exports.charsets = { lookup: charset };
|
|
10876
|
-
exports.contentType = contentType;
|
|
10877
|
-
exports.extension = extension;
|
|
10878
|
-
exports.extensions = Object.create(null);
|
|
10879
|
-
exports.lookup = lookup;
|
|
10880
|
-
exports.types = Object.create(null);
|
|
10881
|
-
|
|
10882
|
-
// Populate the extensions/types maps
|
|
10883
|
-
populateMaps(exports.extensions, exports.types);
|
|
10884
|
-
|
|
10885
|
-
/**
|
|
10886
|
-
* Get the default charset for a MIME type.
|
|
10887
|
-
*
|
|
10888
|
-
* @param {string} type
|
|
10889
|
-
* @return {boolean|string}
|
|
10890
|
-
*/
|
|
10891
|
-
|
|
10892
|
-
function charset (type) {
|
|
10893
|
-
if (!type || typeof type !== 'string') {
|
|
10894
|
-
return false
|
|
10895
|
-
}
|
|
10896
|
-
|
|
10897
|
-
// TODO: use media-typer
|
|
10898
|
-
var match = EXTRACT_TYPE_REGEXP.exec(type);
|
|
10899
|
-
var mime = match && mimeDb[match[1].toLowerCase()];
|
|
10900
|
-
|
|
10901
|
-
if (mime && mime.charset) {
|
|
10902
|
-
return mime.charset
|
|
10903
|
-
}
|
|
10904
|
-
|
|
10905
|
-
// default text/* to utf-8
|
|
10906
|
-
if (match && TEXT_TYPE_REGEXP.test(match[1])) {
|
|
10907
|
-
return 'UTF-8'
|
|
10908
|
-
}
|
|
10909
|
-
|
|
10910
|
-
return false
|
|
10911
|
-
}
|
|
10912
|
-
|
|
10913
|
-
/**
|
|
10914
|
-
* Create a full Content-Type header given a MIME type or extension.
|
|
10915
|
-
*
|
|
10916
|
-
* @param {string} str
|
|
10917
|
-
* @return {boolean|string}
|
|
10918
|
-
*/
|
|
10919
|
-
|
|
10920
|
-
function contentType (str) {
|
|
10921
|
-
// TODO: should this even be in this module?
|
|
10922
|
-
if (!str || typeof str !== 'string') {
|
|
10923
|
-
return false
|
|
10924
|
-
}
|
|
10925
|
-
|
|
10926
|
-
var mime = str.indexOf('/') === -1
|
|
10927
|
-
? exports.lookup(str)
|
|
10928
|
-
: str;
|
|
10929
|
-
|
|
10930
|
-
if (!mime) {
|
|
10931
|
-
return false
|
|
10932
|
-
}
|
|
10933
|
-
|
|
10934
|
-
// TODO: use content-type or other module
|
|
10935
|
-
if (mime.indexOf('charset') === -1) {
|
|
10936
|
-
var charset = exports.charset(mime);
|
|
10937
|
-
if (charset) mime += '; charset=' + charset.toLowerCase();
|
|
10938
|
-
}
|
|
10939
|
-
|
|
10940
|
-
return mime
|
|
10941
|
-
}
|
|
10942
|
-
|
|
10943
|
-
/**
|
|
10944
|
-
* Get the default extension for a MIME type.
|
|
10945
|
-
*
|
|
10946
|
-
* @param {string} type
|
|
10947
|
-
* @return {boolean|string}
|
|
10948
|
-
*/
|
|
10949
|
-
|
|
10950
|
-
function extension (type) {
|
|
10951
|
-
if (!type || typeof type !== 'string') {
|
|
10952
|
-
return false
|
|
10953
|
-
}
|
|
10954
|
-
|
|
10955
|
-
// TODO: use media-typer
|
|
10956
|
-
var match = EXTRACT_TYPE_REGEXP.exec(type);
|
|
10957
|
-
|
|
10958
|
-
// get extensions
|
|
10959
|
-
var exts = match && exports.extensions[match[1].toLowerCase()];
|
|
10960
|
-
|
|
10961
|
-
if (!exts || !exts.length) {
|
|
10962
|
-
return false
|
|
10963
|
-
}
|
|
10964
|
-
|
|
10965
|
-
return exts[0]
|
|
10966
|
-
}
|
|
10967
|
-
|
|
10968
|
-
/**
|
|
10969
|
-
* Lookup the MIME type for a file path/extension.
|
|
10970
|
-
*
|
|
10971
|
-
* @param {string} path
|
|
10972
|
-
* @return {boolean|string}
|
|
10973
|
-
*/
|
|
10974
|
-
|
|
10975
|
-
function lookup (path) {
|
|
10976
|
-
if (!path || typeof path !== 'string') {
|
|
10977
|
-
return false
|
|
10978
|
-
}
|
|
10979
|
-
|
|
10980
|
-
// get the extension ("ext" or ".ext" or full path)
|
|
10981
|
-
var extension = extname('x.' + path)
|
|
10982
|
-
.toLowerCase()
|
|
10983
|
-
.substr(1);
|
|
10984
|
-
|
|
10985
|
-
if (!extension) {
|
|
10986
|
-
return false
|
|
10987
|
-
}
|
|
10988
|
-
|
|
10989
|
-
return exports.types[extension] || false
|
|
10990
|
-
}
|
|
10991
|
-
|
|
10992
|
-
/**
|
|
10993
|
-
* Populate the extensions and types maps.
|
|
10994
|
-
* @private
|
|
10912
|
+
/*!
|
|
10913
|
+
* mime-types
|
|
10914
|
+
* Copyright(c) 2014 Jonathan Ong
|
|
10915
|
+
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
10916
|
+
* MIT Licensed
|
|
10995
10917
|
*/
|
|
10996
10918
|
|
|
10997
|
-
function
|
|
10998
|
-
|
|
10999
|
-
|
|
11000
|
-
|
|
11001
|
-
|
|
11002
|
-
|
|
11003
|
-
|
|
11004
|
-
|
|
11005
|
-
|
|
11006
|
-
|
|
11007
|
-
|
|
11008
|
-
|
|
11009
|
-
|
|
11010
|
-
|
|
11011
|
-
|
|
11012
|
-
|
|
11013
|
-
|
|
11014
|
-
|
|
11015
|
-
|
|
11016
|
-
|
|
11017
|
-
|
|
11018
|
-
|
|
11019
|
-
|
|
11020
|
-
|
|
11021
|
-
|
|
11022
|
-
|
|
11023
|
-
|
|
11024
|
-
|
|
11025
|
-
|
|
11026
|
-
|
|
11027
|
-
|
|
11028
|
-
|
|
11029
|
-
|
|
11030
|
-
|
|
11031
|
-
|
|
11032
|
-
|
|
11033
|
-
|
|
11034
|
-
|
|
11035
|
-
|
|
11036
|
-
|
|
11037
|
-
|
|
11038
|
-
|
|
11039
|
-
|
|
11040
|
-
|
|
11041
|
-
|
|
10919
|
+
(function (exports) {
|
|
10920
|
+
|
|
10921
|
+
/**
|
|
10922
|
+
* Module dependencies.
|
|
10923
|
+
* @private
|
|
10924
|
+
*/
|
|
10925
|
+
|
|
10926
|
+
var db = mimeDb;
|
|
10927
|
+
var extname = require$$1$1.extname;
|
|
10928
|
+
|
|
10929
|
+
/**
|
|
10930
|
+
* Module variables.
|
|
10931
|
+
* @private
|
|
10932
|
+
*/
|
|
10933
|
+
|
|
10934
|
+
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
10935
|
+
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
10936
|
+
|
|
10937
|
+
/**
|
|
10938
|
+
* Module exports.
|
|
10939
|
+
* @public
|
|
10940
|
+
*/
|
|
10941
|
+
|
|
10942
|
+
exports.charset = charset;
|
|
10943
|
+
exports.charsets = { lookup: charset };
|
|
10944
|
+
exports.contentType = contentType;
|
|
10945
|
+
exports.extension = extension;
|
|
10946
|
+
exports.extensions = Object.create(null);
|
|
10947
|
+
exports.lookup = lookup;
|
|
10948
|
+
exports.types = Object.create(null);
|
|
10949
|
+
|
|
10950
|
+
// Populate the extensions/types maps
|
|
10951
|
+
populateMaps(exports.extensions, exports.types);
|
|
10952
|
+
|
|
10953
|
+
/**
|
|
10954
|
+
* Get the default charset for a MIME type.
|
|
10955
|
+
*
|
|
10956
|
+
* @param {string} type
|
|
10957
|
+
* @return {boolean|string}
|
|
10958
|
+
*/
|
|
10959
|
+
|
|
10960
|
+
function charset (type) {
|
|
10961
|
+
if (!type || typeof type !== 'string') {
|
|
10962
|
+
return false
|
|
10963
|
+
}
|
|
10964
|
+
|
|
10965
|
+
// TODO: use media-typer
|
|
10966
|
+
var match = EXTRACT_TYPE_REGEXP.exec(type);
|
|
10967
|
+
var mime = match && db[match[1].toLowerCase()];
|
|
10968
|
+
|
|
10969
|
+
if (mime && mime.charset) {
|
|
10970
|
+
return mime.charset
|
|
10971
|
+
}
|
|
10972
|
+
|
|
10973
|
+
// default text/* to utf-8
|
|
10974
|
+
if (match && TEXT_TYPE_REGEXP.test(match[1])) {
|
|
10975
|
+
return 'UTF-8'
|
|
10976
|
+
}
|
|
10977
|
+
|
|
10978
|
+
return false
|
|
10979
|
+
}
|
|
10980
|
+
|
|
10981
|
+
/**
|
|
10982
|
+
* Create a full Content-Type header given a MIME type or extension.
|
|
10983
|
+
*
|
|
10984
|
+
* @param {string} str
|
|
10985
|
+
* @return {boolean|string}
|
|
10986
|
+
*/
|
|
10987
|
+
|
|
10988
|
+
function contentType (str) {
|
|
10989
|
+
// TODO: should this even be in this module?
|
|
10990
|
+
if (!str || typeof str !== 'string') {
|
|
10991
|
+
return false
|
|
10992
|
+
}
|
|
10993
|
+
|
|
10994
|
+
var mime = str.indexOf('/') === -1
|
|
10995
|
+
? exports.lookup(str)
|
|
10996
|
+
: str;
|
|
10997
|
+
|
|
10998
|
+
if (!mime) {
|
|
10999
|
+
return false
|
|
11000
|
+
}
|
|
11001
|
+
|
|
11002
|
+
// TODO: use content-type or other module
|
|
11003
|
+
if (mime.indexOf('charset') === -1) {
|
|
11004
|
+
var charset = exports.charset(mime);
|
|
11005
|
+
if (charset) mime += '; charset=' + charset.toLowerCase();
|
|
11006
|
+
}
|
|
11007
|
+
|
|
11008
|
+
return mime
|
|
11009
|
+
}
|
|
11010
|
+
|
|
11011
|
+
/**
|
|
11012
|
+
* Get the default extension for a MIME type.
|
|
11013
|
+
*
|
|
11014
|
+
* @param {string} type
|
|
11015
|
+
* @return {boolean|string}
|
|
11016
|
+
*/
|
|
11017
|
+
|
|
11018
|
+
function extension (type) {
|
|
11019
|
+
if (!type || typeof type !== 'string') {
|
|
11020
|
+
return false
|
|
11021
|
+
}
|
|
11022
|
+
|
|
11023
|
+
// TODO: use media-typer
|
|
11024
|
+
var match = EXTRACT_TYPE_REGEXP.exec(type);
|
|
11025
|
+
|
|
11026
|
+
// get extensions
|
|
11027
|
+
var exts = match && exports.extensions[match[1].toLowerCase()];
|
|
11028
|
+
|
|
11029
|
+
if (!exts || !exts.length) {
|
|
11030
|
+
return false
|
|
11031
|
+
}
|
|
11032
|
+
|
|
11033
|
+
return exts[0]
|
|
11034
|
+
}
|
|
11035
|
+
|
|
11036
|
+
/**
|
|
11037
|
+
* Lookup the MIME type for a file path/extension.
|
|
11038
|
+
*
|
|
11039
|
+
* @param {string} path
|
|
11040
|
+
* @return {boolean|string}
|
|
11041
|
+
*/
|
|
11042
|
+
|
|
11043
|
+
function lookup (path) {
|
|
11044
|
+
if (!path || typeof path !== 'string') {
|
|
11045
|
+
return false
|
|
11046
|
+
}
|
|
11047
|
+
|
|
11048
|
+
// get the extension ("ext" or ".ext" or full path)
|
|
11049
|
+
var extension = extname('x.' + path)
|
|
11050
|
+
.toLowerCase()
|
|
11051
|
+
.substr(1);
|
|
11052
|
+
|
|
11053
|
+
if (!extension) {
|
|
11054
|
+
return false
|
|
11055
|
+
}
|
|
11056
|
+
|
|
11057
|
+
return exports.types[extension] || false
|
|
11058
|
+
}
|
|
11059
|
+
|
|
11060
|
+
/**
|
|
11061
|
+
* Populate the extensions and types maps.
|
|
11062
|
+
* @private
|
|
11063
|
+
*/
|
|
11064
|
+
|
|
11065
|
+
function populateMaps (extensions, types) {
|
|
11066
|
+
// source preference (least -> most)
|
|
11067
|
+
var preference = ['nginx', 'apache', undefined, 'iana'];
|
|
11068
|
+
|
|
11069
|
+
Object.keys(db).forEach(function forEachMimeType (type) {
|
|
11070
|
+
var mime = db[type];
|
|
11071
|
+
var exts = mime.extensions;
|
|
11072
|
+
|
|
11073
|
+
if (!exts || !exts.length) {
|
|
11074
|
+
return
|
|
11075
|
+
}
|
|
11076
|
+
|
|
11077
|
+
// mime -> extensions
|
|
11078
|
+
extensions[type] = exts;
|
|
11079
|
+
|
|
11080
|
+
// extension -> mime
|
|
11081
|
+
for (var i = 0; i < exts.length; i++) {
|
|
11082
|
+
var extension = exts[i];
|
|
11083
|
+
|
|
11084
|
+
if (types[extension]) {
|
|
11085
|
+
var from = preference.indexOf(db[types[extension]].source);
|
|
11086
|
+
var to = preference.indexOf(mime.source);
|
|
11087
|
+
|
|
11088
|
+
if (types[extension] !== 'application/octet-stream' &&
|
|
11089
|
+
(from > to || (from === to && types[extension].substr(0, 12) === 'application/'))) {
|
|
11090
|
+
// skip the remapping
|
|
11091
|
+
continue
|
|
11092
|
+
}
|
|
11093
|
+
}
|
|
11094
|
+
|
|
11095
|
+
// set the extension -> mime
|
|
11096
|
+
types[extension] = type;
|
|
11097
|
+
}
|
|
11098
|
+
});
|
|
11099
|
+
}
|
|
11100
|
+
} (mimeTypes));
|
|
11101
|
+
|
|
11102
|
+
var defer_1 = defer$1;
|
|
11042
11103
|
|
|
11043
11104
|
/**
|
|
11044
11105
|
* Runs provided function on next iteration of the event loop
|
|
11045
11106
|
*
|
|
11046
11107
|
* @param {function} fn - function to run
|
|
11047
11108
|
*/
|
|
11048
|
-
function defer(fn)
|
|
11109
|
+
function defer$1(fn)
|
|
11049
11110
|
{
|
|
11050
11111
|
var nextTick = typeof setImmediate == 'function'
|
|
11051
11112
|
? setImmediate
|
|
@@ -11065,8 +11126,10 @@ function defer(fn)
|
|
|
11065
11126
|
}
|
|
11066
11127
|
}
|
|
11067
11128
|
|
|
11129
|
+
var defer = defer_1;
|
|
11130
|
+
|
|
11068
11131
|
// API
|
|
11069
|
-
var async_1 = async;
|
|
11132
|
+
var async_1 = async$2;
|
|
11070
11133
|
|
|
11071
11134
|
/**
|
|
11072
11135
|
* Runs provided callback asynchronously
|
|
@@ -11075,12 +11138,12 @@ var async_1 = async;
|
|
|
11075
11138
|
* @param {function} callback - callback to invoke
|
|
11076
11139
|
* @returns {function} - augmented callback
|
|
11077
11140
|
*/
|
|
11078
|
-
function async(callback)
|
|
11141
|
+
function async$2(callback)
|
|
11079
11142
|
{
|
|
11080
11143
|
var isAsync = false;
|
|
11081
11144
|
|
|
11082
11145
|
// check if async happened
|
|
11083
|
-
|
|
11146
|
+
defer(function() { isAsync = true; });
|
|
11084
11147
|
|
|
11085
11148
|
return function async_callback(err, result)
|
|
11086
11149
|
{
|
|
@@ -11090,7 +11153,7 @@ function async(callback)
|
|
|
11090
11153
|
}
|
|
11091
11154
|
else
|
|
11092
11155
|
{
|
|
11093
|
-
|
|
11156
|
+
defer(function nextTick_callback()
|
|
11094
11157
|
{
|
|
11095
11158
|
callback(err, result);
|
|
11096
11159
|
});
|
|
@@ -11099,14 +11162,14 @@ function async(callback)
|
|
|
11099
11162
|
}
|
|
11100
11163
|
|
|
11101
11164
|
// API
|
|
11102
|
-
var abort_1 = abort;
|
|
11165
|
+
var abort_1 = abort$2;
|
|
11103
11166
|
|
|
11104
11167
|
/**
|
|
11105
11168
|
* Aborts leftover active jobs
|
|
11106
11169
|
*
|
|
11107
11170
|
* @param {object} state - current state object
|
|
11108
11171
|
*/
|
|
11109
|
-
function abort(state)
|
|
11172
|
+
function abort$2(state)
|
|
11110
11173
|
{
|
|
11111
11174
|
Object.keys(state.jobs).forEach(clean.bind(state));
|
|
11112
11175
|
|
|
@@ -11128,8 +11191,12 @@ function clean(key)
|
|
|
11128
11191
|
}
|
|
11129
11192
|
}
|
|
11130
11193
|
|
|
11194
|
+
var async$1 = async_1
|
|
11195
|
+
, abort$1 = abort_1
|
|
11196
|
+
;
|
|
11197
|
+
|
|
11131
11198
|
// API
|
|
11132
|
-
var iterate_1 = iterate;
|
|
11199
|
+
var iterate_1 = iterate$2;
|
|
11133
11200
|
|
|
11134
11201
|
/**
|
|
11135
11202
|
* Iterates over each job object
|
|
@@ -11139,7 +11206,7 @@ var iterate_1 = iterate;
|
|
|
11139
11206
|
* @param {object} state - current job status
|
|
11140
11207
|
* @param {function} callback - invoked when all elements processed
|
|
11141
11208
|
*/
|
|
11142
|
-
function iterate(list, iterator, state, callback)
|
|
11209
|
+
function iterate$2(list, iterator, state, callback)
|
|
11143
11210
|
{
|
|
11144
11211
|
// store current index
|
|
11145
11212
|
var key = state['keyedList'] ? state['keyedList'][state.index] : state.index;
|
|
@@ -11161,7 +11228,7 @@ function iterate(list, iterator, state, callback)
|
|
|
11161
11228
|
// don't process rest of the results
|
|
11162
11229
|
// stop still active jobs
|
|
11163
11230
|
// and reset the list
|
|
11164
|
-
|
|
11231
|
+
abort$1(state);
|
|
11165
11232
|
}
|
|
11166
11233
|
else
|
|
11167
11234
|
{
|
|
@@ -11189,12 +11256,12 @@ function runJob(iterator, key, item, callback)
|
|
|
11189
11256
|
// allow shortcut if iterator expects only two arguments
|
|
11190
11257
|
if (iterator.length == 2)
|
|
11191
11258
|
{
|
|
11192
|
-
aborter = iterator(item,
|
|
11259
|
+
aborter = iterator(item, async$1(callback));
|
|
11193
11260
|
}
|
|
11194
11261
|
// otherwise go with full three arguments
|
|
11195
11262
|
else
|
|
11196
11263
|
{
|
|
11197
|
-
aborter = iterator(item, key,
|
|
11264
|
+
aborter = iterator(item, key, async$1(callback));
|
|
11198
11265
|
}
|
|
11199
11266
|
|
|
11200
11267
|
return aborter;
|
|
@@ -11238,8 +11305,12 @@ function state(list, sortMethod)
|
|
|
11238
11305
|
return initState;
|
|
11239
11306
|
}
|
|
11240
11307
|
|
|
11308
|
+
var abort = abort_1
|
|
11309
|
+
, async = async_1
|
|
11310
|
+
;
|
|
11311
|
+
|
|
11241
11312
|
// API
|
|
11242
|
-
var terminator_1 = terminator;
|
|
11313
|
+
var terminator_1 = terminator$2;
|
|
11243
11314
|
|
|
11244
11315
|
/**
|
|
11245
11316
|
* Terminates jobs in the attached state context
|
|
@@ -11247,7 +11318,7 @@ var terminator_1 = terminator;
|
|
|
11247
11318
|
* @this AsyncKitState#
|
|
11248
11319
|
* @param {function} callback - final callback to invoke after termination
|
|
11249
11320
|
*/
|
|
11250
|
-
function terminator(callback)
|
|
11321
|
+
function terminator$2(callback)
|
|
11251
11322
|
{
|
|
11252
11323
|
if (!Object.keys(this.jobs).length)
|
|
11253
11324
|
{
|
|
@@ -11258,12 +11329,17 @@ function terminator(callback)
|
|
|
11258
11329
|
this.index = this.size;
|
|
11259
11330
|
|
|
11260
11331
|
// abort jobs
|
|
11261
|
-
|
|
11332
|
+
abort(this);
|
|
11262
11333
|
|
|
11263
11334
|
// send back results we have so far
|
|
11264
|
-
|
|
11335
|
+
async(callback)(null, this.results);
|
|
11265
11336
|
}
|
|
11266
11337
|
|
|
11338
|
+
var iterate$1 = iterate_1
|
|
11339
|
+
, initState$1 = state_1
|
|
11340
|
+
, terminator$1 = terminator_1
|
|
11341
|
+
;
|
|
11342
|
+
|
|
11267
11343
|
// Public API
|
|
11268
11344
|
var parallel_1 = parallel;
|
|
11269
11345
|
|
|
@@ -11277,11 +11353,11 @@ var parallel_1 = parallel;
|
|
|
11277
11353
|
*/
|
|
11278
11354
|
function parallel(list, iterator, callback)
|
|
11279
11355
|
{
|
|
11280
|
-
var state =
|
|
11356
|
+
var state = initState$1(list);
|
|
11281
11357
|
|
|
11282
11358
|
while (state.index < (state['keyedList'] || list).length)
|
|
11283
11359
|
{
|
|
11284
|
-
|
|
11360
|
+
iterate$1(list, iterator, state, function(error, result)
|
|
11285
11361
|
{
|
|
11286
11362
|
if (error)
|
|
11287
11363
|
{
|
|
@@ -11300,14 +11376,21 @@ function parallel(list, iterator, callback)
|
|
|
11300
11376
|
state.index++;
|
|
11301
11377
|
}
|
|
11302
11378
|
|
|
11303
|
-
return
|
|
11379
|
+
return terminator$1.bind(state, callback);
|
|
11304
11380
|
}
|
|
11305
11381
|
|
|
11382
|
+
var serialOrdered$2 = {exports: {}};
|
|
11383
|
+
|
|
11384
|
+
var iterate = iterate_1
|
|
11385
|
+
, initState = state_1
|
|
11386
|
+
, terminator = terminator_1
|
|
11387
|
+
;
|
|
11388
|
+
|
|
11306
11389
|
// Public API
|
|
11307
|
-
|
|
11390
|
+
serialOrdered$2.exports = serialOrdered$1;
|
|
11308
11391
|
// sorting helpers
|
|
11309
|
-
|
|
11310
|
-
|
|
11392
|
+
serialOrdered$2.exports.ascending = ascending;
|
|
11393
|
+
serialOrdered$2.exports.descending = descending;
|
|
11311
11394
|
|
|
11312
11395
|
/**
|
|
11313
11396
|
* Runs iterator over provided sorted array elements in series
|
|
@@ -11318,11 +11401,11 @@ var descending_1 = descending;
|
|
|
11318
11401
|
* @param {function} callback - invoked when all elements processed
|
|
11319
11402
|
* @returns {function} - jobs terminator
|
|
11320
11403
|
*/
|
|
11321
|
-
function serialOrdered(list, iterator, sortMethod, callback)
|
|
11404
|
+
function serialOrdered$1(list, iterator, sortMethod, callback)
|
|
11322
11405
|
{
|
|
11323
|
-
var state =
|
|
11406
|
+
var state = initState(list, sortMethod);
|
|
11324
11407
|
|
|
11325
|
-
|
|
11408
|
+
iterate(list, iterator, state, function iteratorHandler(error, result)
|
|
11326
11409
|
{
|
|
11327
11410
|
if (error)
|
|
11328
11411
|
{
|
|
@@ -11335,7 +11418,7 @@ function serialOrdered(list, iterator, sortMethod, callback)
|
|
|
11335
11418
|
// are we there yet?
|
|
11336
11419
|
if (state.index < (state['keyedList'] || list).length)
|
|
11337
11420
|
{
|
|
11338
|
-
|
|
11421
|
+
iterate(list, iterator, state, iteratorHandler);
|
|
11339
11422
|
return;
|
|
11340
11423
|
}
|
|
11341
11424
|
|
|
@@ -11343,7 +11426,7 @@ function serialOrdered(list, iterator, sortMethod, callback)
|
|
|
11343
11426
|
callback(null, state.results);
|
|
11344
11427
|
});
|
|
11345
11428
|
|
|
11346
|
-
return
|
|
11429
|
+
return terminator.bind(state, callback);
|
|
11347
11430
|
}
|
|
11348
11431
|
|
|
11349
11432
|
/*
|
|
@@ -11373,8 +11456,10 @@ function descending(a, b)
|
|
|
11373
11456
|
{
|
|
11374
11457
|
return -1 * ascending(a, b);
|
|
11375
11458
|
}
|
|
11376
|
-
|
|
11377
|
-
|
|
11459
|
+
|
|
11460
|
+
var serialOrderedExports = serialOrdered$2.exports;
|
|
11461
|
+
|
|
11462
|
+
var serialOrdered = serialOrderedExports;
|
|
11378
11463
|
|
|
11379
11464
|
// Public API
|
|
11380
11465
|
var serial_1 = serial;
|
|
@@ -11389,18 +11474,18 @@ var serial_1 = serial;
|
|
|
11389
11474
|
*/
|
|
11390
11475
|
function serial(list, iterator, callback)
|
|
11391
11476
|
{
|
|
11392
|
-
return
|
|
11477
|
+
return serialOrdered(list, iterator, null, callback);
|
|
11393
11478
|
}
|
|
11394
11479
|
|
|
11395
|
-
var asynckit =
|
|
11480
|
+
var asynckit$1 =
|
|
11396
11481
|
{
|
|
11397
11482
|
parallel : parallel_1,
|
|
11398
11483
|
serial : serial_1,
|
|
11399
|
-
serialOrdered :
|
|
11484
|
+
serialOrdered : serialOrderedExports
|
|
11400
11485
|
};
|
|
11401
11486
|
|
|
11402
11487
|
// populates missing values
|
|
11403
|
-
var populate = function(dst, src) {
|
|
11488
|
+
var populate$1 = function(dst, src) {
|
|
11404
11489
|
|
|
11405
11490
|
Object.keys(src).forEach(function(prop)
|
|
11406
11491
|
{
|
|
@@ -11410,18 +11495,23 @@ var populate = function(dst, src) {
|
|
|
11410
11495
|
return dst;
|
|
11411
11496
|
};
|
|
11412
11497
|
|
|
11413
|
-
var
|
|
11414
|
-
|
|
11415
|
-
var
|
|
11416
|
-
|
|
11417
|
-
|
|
11418
|
-
|
|
11498
|
+
var CombinedStream = combined_stream;
|
|
11499
|
+
var util = require$$1;
|
|
11500
|
+
var path = require$$1$1;
|
|
11501
|
+
var http = require$$3;
|
|
11502
|
+
var https = require$$4;
|
|
11503
|
+
var parseUrl = require$$5.parse;
|
|
11504
|
+
var fs = require$$6;
|
|
11505
|
+
var Stream = require$$0$1.Stream;
|
|
11506
|
+
var mime = mimeTypes;
|
|
11507
|
+
var asynckit = asynckit$1;
|
|
11508
|
+
var populate = populate$1;
|
|
11419
11509
|
|
|
11420
11510
|
// Public API
|
|
11421
11511
|
var form_data = FormData;
|
|
11422
11512
|
|
|
11423
11513
|
// make it a Stream
|
|
11424
|
-
util.inherits(FormData,
|
|
11514
|
+
util.inherits(FormData, CombinedStream);
|
|
11425
11515
|
|
|
11426
11516
|
/**
|
|
11427
11517
|
* Create readable "multipart/form-data" streams.
|
|
@@ -11440,7 +11530,7 @@ function FormData(options) {
|
|
|
11440
11530
|
this._valueLength = 0;
|
|
11441
11531
|
this._valuesToMeasure = [];
|
|
11442
11532
|
|
|
11443
|
-
|
|
11533
|
+
CombinedStream.call(this);
|
|
11444
11534
|
|
|
11445
11535
|
options = options || {};
|
|
11446
11536
|
for (var option in options) {
|
|
@@ -11460,7 +11550,7 @@ FormData.prototype.append = function(field, value, options) {
|
|
|
11460
11550
|
options = {filename: options};
|
|
11461
11551
|
}
|
|
11462
11552
|
|
|
11463
|
-
var append =
|
|
11553
|
+
var append = CombinedStream.prototype.append.bind(this);
|
|
11464
11554
|
|
|
11465
11555
|
// all that streamy business can't handle numbers
|
|
11466
11556
|
if (typeof value == 'number') {
|
|
@@ -11655,12 +11745,12 @@ FormData.prototype._getContentType = function(value, options) {
|
|
|
11655
11745
|
|
|
11656
11746
|
// or try `name` from formidable, browser
|
|
11657
11747
|
if (!contentType && value.name) {
|
|
11658
|
-
contentType =
|
|
11748
|
+
contentType = mime.lookup(value.name);
|
|
11659
11749
|
}
|
|
11660
11750
|
|
|
11661
11751
|
// or try `path` from fs-, request- streams
|
|
11662
11752
|
if (!contentType && value.path) {
|
|
11663
|
-
contentType =
|
|
11753
|
+
contentType = mime.lookup(value.path);
|
|
11664
11754
|
}
|
|
11665
11755
|
|
|
11666
11756
|
// or if it's http-reponse
|
|
@@ -11670,7 +11760,7 @@ FormData.prototype._getContentType = function(value, options) {
|
|
|
11670
11760
|
|
|
11671
11761
|
// or guess it from the filepath or filename
|
|
11672
11762
|
if (!contentType && (options.filepath || options.filename)) {
|
|
11673
|
-
contentType =
|
|
11763
|
+
contentType = mime.lookup(options.filepath || options.filename);
|
|
11674
11764
|
}
|
|
11675
11765
|
|
|
11676
11766
|
// fallback to the default content type if `value` is not simple value
|
|
@@ -11907,6 +11997,8 @@ FormData.prototype.toString = function () {
|
|
|
11907
11997
|
return '[object FormData]';
|
|
11908
11998
|
};
|
|
11909
11999
|
|
|
12000
|
+
var FormDataModule = /*@__PURE__*/getDefaultExportFromCjs(form_data);
|
|
12001
|
+
|
|
11910
12002
|
const GRANT_TYPE$1 = 'client_credentials';
|
|
11911
12003
|
const castClientOptionsToRequestParams = (clientOptions) => {
|
|
11912
12004
|
const { scope, clientId, clientSecret } = clientOptions;
|
|
@@ -12100,7 +12192,7 @@ function makeApiRequest(oauthTokenStore, oauthTokenRequester, options, httpMetho
|
|
|
12100
12192
|
const formData = Object.entries(form).reduce((previous, [name, value]) => {
|
|
12101
12193
|
previous.append.apply(previous, [name].concat(value));
|
|
12102
12194
|
return previous;
|
|
12103
|
-
}, new
|
|
12195
|
+
}, new FormDataModule());
|
|
12104
12196
|
const headers = Object.assign(Object.assign(Object.assign(Object.assign({ accept: 'application/json', authorization: `Bearer ${oauthTokenStore.get('accessToken')}`, 'X-Allthings-Caller': `${options.serviceName
|
|
12105
12197
|
? options.serviceName
|
|
12106
12198
|
: process.env.SEVICE_NAME
|
|
@@ -12324,5 +12416,9 @@ exports.EnumLookupUserType = void 0;
|
|
|
12324
12416
|
EnumLookupUserType["tenant"] = "tenant";
|
|
12325
12417
|
})(exports.EnumLookupUserType || (exports.EnumLookupUserType = {}));
|
|
12326
12418
|
|
|
12419
|
+
exports.DEFAULT_AWS_CONFIGURATION = DEFAULT_AWS_CONFIGURATION;
|
|
12420
|
+
exports.DEFAULT_PARAMETER_STORE_CLIENT_CONFIG = DEFAULT_CLIENT_CONFIG;
|
|
12421
|
+
exports.awsClients = index;
|
|
12327
12422
|
exports.createTokenStore = createTokenStore;
|
|
12423
|
+
exports.parameterStore = parameterStore;
|
|
12328
12424
|
exports.restClient = restClient;
|