@digipair/skill-s3 0.136.1 → 0.136.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.
@@ -0,0 +1,349 @@
1
+ import { P as ProviderError, ak as IniSectionType, k as CONFIG_PREFIX_SEPARATOR, r as readFile, al as getConfigFilepath, am as parseIni } from './index.esm2.js';
2
+
3
+ function _assert_this_initialized(self) {
4
+ if (self === void 0) {
5
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
6
+ }
7
+ return self;
8
+ }
9
+ function _class_call_check(instance, Constructor) {
10
+ if (!(instance instanceof Constructor)) {
11
+ throw new TypeError("Cannot call a class as a function");
12
+ }
13
+ }
14
+ function _define_property$1(obj, key, value) {
15
+ if (key in obj) {
16
+ Object.defineProperty(obj, key, {
17
+ value: value,
18
+ enumerable: true,
19
+ configurable: true,
20
+ writable: true
21
+ });
22
+ } else {
23
+ obj[key] = value;
24
+ }
25
+ return obj;
26
+ }
27
+ function _get_prototype_of(o) {
28
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
29
+ return o.__proto__ || Object.getPrototypeOf(o);
30
+ };
31
+ return _get_prototype_of(o);
32
+ }
33
+ function _inherits(subClass, superClass) {
34
+ if (typeof superClass !== "function" && superClass !== null) {
35
+ throw new TypeError("Super expression must either be null or a function");
36
+ }
37
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
38
+ constructor: {
39
+ value: subClass,
40
+ writable: true,
41
+ configurable: true
42
+ }
43
+ });
44
+ if (superClass) _set_prototype_of(subClass, superClass);
45
+ }
46
+ function _possible_constructor_return(self, call) {
47
+ if (call && (_type_of(call) === "object" || typeof call === "function")) {
48
+ return call;
49
+ }
50
+ return _assert_this_initialized(self);
51
+ }
52
+ function _set_prototype_of(o, p) {
53
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
54
+ o.__proto__ = p;
55
+ return o;
56
+ };
57
+ return _set_prototype_of(o, p);
58
+ }
59
+ function _type_of(obj) {
60
+ "@swc/helpers - typeof";
61
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
62
+ }
63
+ function _is_native_reflect_construct() {
64
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
65
+ if (Reflect.construct.sham) return false;
66
+ if (typeof Proxy === "function") return true;
67
+ try {
68
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
69
+ return true;
70
+ } catch (e) {
71
+ return false;
72
+ }
73
+ }
74
+ function _create_super(Derived) {
75
+ var hasNativeReflectConstruct = _is_native_reflect_construct();
76
+ return function _createSuperInternal() {
77
+ var Super = _get_prototype_of(Derived), result;
78
+ if (hasNativeReflectConstruct) {
79
+ var NewTarget = _get_prototype_of(this).constructor;
80
+ result = Reflect.construct(Super, arguments, NewTarget);
81
+ } else {
82
+ result = Super.apply(this, arguments);
83
+ }
84
+ return _possible_constructor_return(this, result);
85
+ };
86
+ }
87
+ var TokenProviderError = /*#__PURE__*/ function(ProviderError) {
88
+ _inherits(TokenProviderError, ProviderError);
89
+ var _super = _create_super(TokenProviderError);
90
+ function TokenProviderError(message) {
91
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
92
+ _class_call_check(this, TokenProviderError);
93
+ var _this;
94
+ _this = _super.call(this, message, options);
95
+ _define_property$1(_assert_this_initialized(_this), "name", "TokenProviderError");
96
+ Object.setPrototypeOf(_assert_this_initialized(_this), TokenProviderError.prototype);
97
+ return _this;
98
+ }
99
+ return TokenProviderError;
100
+ }(ProviderError);
101
+
102
+ function _array_like_to_array(arr, len) {
103
+ if (len == null || len > arr.length) len = arr.length;
104
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
105
+ return arr2;
106
+ }
107
+ function _array_with_holes(arr) {
108
+ if (Array.isArray(arr)) return arr;
109
+ }
110
+ function _define_property(obj, key, value) {
111
+ if (key in obj) {
112
+ Object.defineProperty(obj, key, {
113
+ value: value,
114
+ enumerable: true,
115
+ configurable: true,
116
+ writable: true
117
+ });
118
+ } else {
119
+ obj[key] = value;
120
+ }
121
+ return obj;
122
+ }
123
+ function _iterable_to_array_limit(arr, i) {
124
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
125
+ if (_i == null) return;
126
+ var _arr = [];
127
+ var _n = true;
128
+ var _d = false;
129
+ var _s, _e;
130
+ try {
131
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
132
+ _arr.push(_s.value);
133
+ if (i && _arr.length === i) break;
134
+ }
135
+ } catch (err) {
136
+ _d = true;
137
+ _e = err;
138
+ } finally{
139
+ try {
140
+ if (!_n && _i["return"] != null) _i["return"]();
141
+ } finally{
142
+ if (_d) throw _e;
143
+ }
144
+ }
145
+ return _arr;
146
+ }
147
+ function _non_iterable_rest() {
148
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
149
+ }
150
+ function _object_spread(target) {
151
+ for(var i = 1; i < arguments.length; i++){
152
+ var source = arguments[i] != null ? arguments[i] : {};
153
+ var ownKeys = Object.keys(source);
154
+ if (typeof Object.getOwnPropertySymbols === "function") {
155
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
156
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
157
+ }));
158
+ }
159
+ ownKeys.forEach(function(key) {
160
+ _define_property(target, key, source[key]);
161
+ });
162
+ }
163
+ return target;
164
+ }
165
+ function ownKeys(object, enumerableOnly) {
166
+ var keys = Object.keys(object);
167
+ if (Object.getOwnPropertySymbols) {
168
+ var symbols = Object.getOwnPropertySymbols(object);
169
+ keys.push.apply(keys, symbols);
170
+ }
171
+ return keys;
172
+ }
173
+ function _object_spread_props(target, source) {
174
+ source = source != null ? source : {};
175
+ if (Object.getOwnPropertyDescriptors) {
176
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
177
+ } else {
178
+ ownKeys(Object(source)).forEach(function(key) {
179
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
180
+ });
181
+ }
182
+ return target;
183
+ }
184
+ function _sliced_to_array(arr, i) {
185
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
186
+ }
187
+ function _unsupported_iterable_to_array(o, minLen) {
188
+ if (!o) return;
189
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
190
+ var n = Object.prototype.toString.call(o).slice(8, -1);
191
+ if (n === "Object" && o.constructor) n = o.constructor.name;
192
+ if (n === "Map" || n === "Set") return Array.from(n);
193
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
194
+ }
195
+ var getSsoSessionData = function(data) {
196
+ return Object.entries(data).filter(function(param) {
197
+ var _param = _sliced_to_array(param, 1), key = _param[0];
198
+ return key.startsWith(IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR);
199
+ }).reduce(function(acc, param) {
200
+ var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
201
+ return _object_spread_props(_object_spread({}, acc), _define_property({}, key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1), value));
202
+ }, {});
203
+ };
204
+
205
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
206
+ try {
207
+ var info = gen[key](arg);
208
+ var value = info.value;
209
+ } catch (error) {
210
+ reject(error);
211
+ return;
212
+ }
213
+ if (info.done) {
214
+ resolve(value);
215
+ } else {
216
+ Promise.resolve(value).then(_next, _throw);
217
+ }
218
+ }
219
+ function _async_to_generator(fn) {
220
+ return function() {
221
+ var self = this, args = arguments;
222
+ return new Promise(function(resolve, reject) {
223
+ var gen = fn.apply(self, args);
224
+ function _next(value) {
225
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
226
+ }
227
+ function _throw(err) {
228
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
229
+ }
230
+ _next(undefined);
231
+ });
232
+ };
233
+ }
234
+ function _ts_generator(thisArg, body) {
235
+ var f, y, t, g, _ = {
236
+ label: 0,
237
+ sent: function() {
238
+ if (t[0] & 1) throw t[1];
239
+ return t[1];
240
+ },
241
+ trys: [],
242
+ ops: []
243
+ };
244
+ return g = {
245
+ next: verb(0),
246
+ "throw": verb(1),
247
+ "return": verb(2)
248
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
249
+ return this;
250
+ }), g;
251
+ function verb(n) {
252
+ return function(v) {
253
+ return step([
254
+ n,
255
+ v
256
+ ]);
257
+ };
258
+ }
259
+ function step(op) {
260
+ if (f) throw new TypeError("Generator is already executing.");
261
+ while(_)try {
262
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
263
+ if (y = 0, t) op = [
264
+ op[0] & 2,
265
+ t.value
266
+ ];
267
+ switch(op[0]){
268
+ case 0:
269
+ case 1:
270
+ t = op;
271
+ break;
272
+ case 4:
273
+ _.label++;
274
+ return {
275
+ value: op[1],
276
+ done: false
277
+ };
278
+ case 5:
279
+ _.label++;
280
+ y = op[1];
281
+ op = [
282
+ 0
283
+ ];
284
+ continue;
285
+ case 7:
286
+ op = _.ops.pop();
287
+ _.trys.pop();
288
+ continue;
289
+ default:
290
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
291
+ _ = 0;
292
+ continue;
293
+ }
294
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
295
+ _.label = op[1];
296
+ break;
297
+ }
298
+ if (op[0] === 6 && _.label < t[1]) {
299
+ _.label = t[1];
300
+ t = op;
301
+ break;
302
+ }
303
+ if (t && _.label < t[2]) {
304
+ _.label = t[2];
305
+ _.ops.push(op);
306
+ break;
307
+ }
308
+ if (t[2]) _.ops.pop();
309
+ _.trys.pop();
310
+ continue;
311
+ }
312
+ op = body.call(thisArg, _);
313
+ } catch (e) {
314
+ op = [
315
+ 6,
316
+ e
317
+ ];
318
+ y = 0;
319
+ } finally{
320
+ f = t = 0;
321
+ }
322
+ if (op[0] & 5) throw op[1];
323
+ return {
324
+ value: op[0] ? op[1] : void 0,
325
+ done: true
326
+ };
327
+ }
328
+ }
329
+ var swallowError = function() {
330
+ return {};
331
+ };
332
+ var loadSsoSessionData = function() {
333
+ var _ref = _async_to_generator(function() {
334
+ var init, _init_configFilepath;
335
+ var _arguments = arguments;
336
+ return _ts_generator(this, function(_state) {
337
+ init = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {};
338
+ return [
339
+ 2,
340
+ readFile((_init_configFilepath = init.configFilepath) !== null && _init_configFilepath !== void 0 ? _init_configFilepath : getConfigFilepath()).then(parseIni).then(getSsoSessionData).catch(swallowError)
341
+ ];
342
+ });
343
+ });
344
+ return function loadSsoSessionData() {
345
+ return _ref.apply(this, arguments);
346
+ };
347
+ }();
348
+
349
+ export { TokenProviderError as T, loadSsoSessionData as l };
@@ -1,4 +1,4 @@
1
- import { l as loadSharedConfigFiles } from './index.esm3.js';
1
+ import { a as loadSharedConfigFiles } from './index.esm2.js';
2
2
 
3
3
  function _array_like_to_array(arr, len) {
4
4
  if (len == null || len > arr.length) len = arr.length;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-s3",
3
- "version": "0.136.1",
3
+ "version": "0.136.4",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1,216 +0,0 @@
1
- import { j as collectBody, t as toUtf8 } from './index.esm3.js';
2
-
3
- var collectBodyString = function(streamBody, context) {
4
- return collectBody(streamBody, context).then(function(body) {
5
- var _context_utf8Encoder;
6
- return ((_context_utf8Encoder = context === null || context === void 0 ? void 0 : context.utf8Encoder) !== null && _context_utf8Encoder !== void 0 ? _context_utf8Encoder : toUtf8)(body);
7
- });
8
- };
9
-
10
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
11
- try {
12
- var info = gen[key](arg);
13
- var value = info.value;
14
- } catch (error) {
15
- reject(error);
16
- return;
17
- }
18
- if (info.done) {
19
- resolve(value);
20
- } else {
21
- Promise.resolve(value).then(_next, _throw);
22
- }
23
- }
24
- function _async_to_generator(fn) {
25
- return function() {
26
- var self = this, args = arguments;
27
- return new Promise(function(resolve, reject) {
28
- var gen = fn.apply(self, args);
29
- function _next(value) {
30
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
31
- }
32
- function _throw(err) {
33
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
34
- }
35
- _next(undefined);
36
- });
37
- };
38
- }
39
- function _type_of(obj) {
40
- "@swc/helpers - typeof";
41
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
42
- }
43
- function _ts_generator(thisArg, body) {
44
- var f, y, t, g, _ = {
45
- label: 0,
46
- sent: function() {
47
- if (t[0] & 1) throw t[1];
48
- return t[1];
49
- },
50
- trys: [],
51
- ops: []
52
- };
53
- return g = {
54
- next: verb(0),
55
- "throw": verb(1),
56
- "return": verb(2)
57
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
58
- return this;
59
- }), g;
60
- function verb(n) {
61
- return function(v) {
62
- return step([
63
- n,
64
- v
65
- ]);
66
- };
67
- }
68
- function step(op) {
69
- if (f) throw new TypeError("Generator is already executing.");
70
- while(_)try {
71
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
72
- if (y = 0, t) op = [
73
- op[0] & 2,
74
- t.value
75
- ];
76
- switch(op[0]){
77
- case 0:
78
- case 1:
79
- t = op;
80
- break;
81
- case 4:
82
- _.label++;
83
- return {
84
- value: op[1],
85
- done: false
86
- };
87
- case 5:
88
- _.label++;
89
- y = op[1];
90
- op = [
91
- 0
92
- ];
93
- continue;
94
- case 7:
95
- op = _.ops.pop();
96
- _.trys.pop();
97
- continue;
98
- default:
99
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
100
- _ = 0;
101
- continue;
102
- }
103
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
104
- _.label = op[1];
105
- break;
106
- }
107
- if (op[0] === 6 && _.label < t[1]) {
108
- _.label = t[1];
109
- t = op;
110
- break;
111
- }
112
- if (t && _.label < t[2]) {
113
- _.label = t[2];
114
- _.ops.push(op);
115
- break;
116
- }
117
- if (t[2]) _.ops.pop();
118
- _.trys.pop();
119
- continue;
120
- }
121
- op = body.call(thisArg, _);
122
- } catch (e) {
123
- op = [
124
- 6,
125
- e
126
- ];
127
- y = 0;
128
- } finally{
129
- f = t = 0;
130
- }
131
- if (op[0] & 5) throw op[1];
132
- return {
133
- value: op[0] ? op[1] : void 0,
134
- done: true
135
- };
136
- }
137
- }
138
- var parseJsonBody = function(streamBody, context) {
139
- return collectBodyString(streamBody, context).then(function(encoded) {
140
- if (encoded.length) {
141
- try {
142
- return JSON.parse(encoded);
143
- } catch (e) {
144
- if ((e === null || e === void 0 ? void 0 : e.name) === "SyntaxError") {
145
- Object.defineProperty(e, "$responseBodyText", {
146
- value: encoded
147
- });
148
- }
149
- throw e;
150
- }
151
- }
152
- return {};
153
- });
154
- };
155
- var parseJsonErrorBody = function() {
156
- var _ref = _async_to_generator(function(errorBody, context) {
157
- var value, _value_message;
158
- return _ts_generator(this, function(_state) {
159
- switch(_state.label){
160
- case 0:
161
- return [
162
- 4,
163
- parseJsonBody(errorBody, context)
164
- ];
165
- case 1:
166
- value = _state.sent();
167
- value.message = (_value_message = value.message) !== null && _value_message !== void 0 ? _value_message : value.Message;
168
- return [
169
- 2,
170
- value
171
- ];
172
- }
173
- });
174
- });
175
- return function parseJsonErrorBody(errorBody, context) {
176
- return _ref.apply(this, arguments);
177
- };
178
- }();
179
- var loadRestJsonErrorCode = function(output, data) {
180
- var findKey = function(object, key) {
181
- return Object.keys(object).find(function(k) {
182
- return k.toLowerCase() === key.toLowerCase();
183
- });
184
- };
185
- var sanitizeErrorCode = function(rawValue) {
186
- var cleanValue = rawValue;
187
- if (typeof cleanValue === "number") {
188
- cleanValue = cleanValue.toString();
189
- }
190
- if (cleanValue.indexOf(",") >= 0) {
191
- cleanValue = cleanValue.split(",")[0];
192
- }
193
- if (cleanValue.indexOf(":") >= 0) {
194
- cleanValue = cleanValue.split(":")[0];
195
- }
196
- if (cleanValue.indexOf("#") >= 0) {
197
- cleanValue = cleanValue.split("#")[1];
198
- }
199
- return cleanValue;
200
- };
201
- var headerKey = findKey(output.headers, "x-amzn-errortype");
202
- if (headerKey !== undefined) {
203
- return sanitizeErrorCode(output.headers[headerKey]);
204
- }
205
- if (data && (typeof data === "undefined" ? "undefined" : _type_of(data)) === "object") {
206
- var codeKey = findKey(data, "code");
207
- if (codeKey && data[codeKey] !== undefined) {
208
- return sanitizeErrorCode(data[codeKey]);
209
- }
210
- if (data["__type"] !== undefined) {
211
- return sanitizeErrorCode(data["__type"]);
212
- }
213
- }
214
- };
215
-
216
- export { parseJsonErrorBody as a, loadRestJsonErrorCode as l, parseJsonBody as p };