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