@digipair/skill-s3 0.136.3 → 0.136.5

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.
@@ -1,15 +1,17 @@
1
- import node_http from 'node:http';
2
- import { aX as ProviderError, C as CredentialsProviderError, ae as parseUrl, ak as loadConfig } from './index.esm3.js';
3
- import 'node:crypto';
4
- import 'node:path';
5
- import 'node:os';
1
+ import { parse } from 'url';
2
+ import { Buffer } from 'buffer';
3
+ import { request } from 'http';
4
+ import { P as ProviderError, C as CredentialsProviderError, p as parseUrl, l as loadConfig } from './index.esm2.js';
5
+ import 'path';
6
+ import 'os';
6
7
  import 'node:fs/promises';
8
+ import 'stream';
9
+ import 'crypto';
7
10
  import 'node:stream';
8
- import 'node:process';
9
- import 'buffer';
11
+ import 'https';
12
+ import 'process';
10
13
  import 'node:fs';
11
- import 'node:https';
12
- import 'node:zlib';
14
+ import 'zlib';
13
15
 
14
16
  function _define_property$5(obj, key, value) {
15
17
  if (key in obj) {
@@ -39,62 +41,6 @@ function _object_spread$4(target) {
39
41
  }
40
42
  return target;
41
43
  }
42
- function _type_of$1(obj) {
43
- "@swc/helpers - typeof";
44
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
45
- }
46
- var isImdsCredentials = function(arg) {
47
- return Boolean(arg) && (typeof arg === "undefined" ? "undefined" : _type_of$1(arg)) === "object" && typeof arg.AccessKeyId === "string" && typeof arg.SecretAccessKey === "string" && typeof arg.Token === "string" && typeof arg.Expiration === "string";
48
- };
49
- var fromImdsCredentials = function(creds) {
50
- return _object_spread$4({
51
- accessKeyId: creds.AccessKeyId,
52
- secretAccessKey: creds.SecretAccessKey,
53
- sessionToken: creds.Token,
54
- expiration: new Date(creds.Expiration)
55
- }, creds.AccountId && {
56
- accountId: creds.AccountId
57
- });
58
- };
59
-
60
- var DEFAULT_TIMEOUT = 1000;
61
- var DEFAULT_MAX_RETRIES = 0;
62
- var providerConfigFromInit = function(param) {
63
- var _param_maxRetries = param.maxRetries, maxRetries = _param_maxRetries === void 0 ? DEFAULT_MAX_RETRIES : _param_maxRetries, _param_timeout = param.timeout, timeout = _param_timeout === void 0 ? DEFAULT_TIMEOUT : _param_timeout;
64
- return {
65
- maxRetries: maxRetries,
66
- timeout: timeout
67
- };
68
- };
69
-
70
- function _define_property$4(obj, key, value) {
71
- if (key in obj) {
72
- Object.defineProperty(obj, key, {
73
- value: value,
74
- enumerable: true,
75
- configurable: true,
76
- writable: true
77
- });
78
- } else {
79
- obj[key] = value;
80
- }
81
- return obj;
82
- }
83
- function _object_spread$3(target) {
84
- for(var i = 1; i < arguments.length; i++){
85
- var source = arguments[i] != null ? arguments[i] : {};
86
- var ownKeys = Object.keys(source);
87
- if (typeof Object.getOwnPropertySymbols === "function") {
88
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
89
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
90
- }));
91
- }
92
- ownKeys.forEach(function(key) {
93
- _define_property$4(target, key, source[key]);
94
- });
95
- }
96
- return target;
97
- }
98
44
  function ownKeys$3(object, enumerableOnly) {
99
45
  var keys = Object.keys(object);
100
46
  if (Object.getOwnPropertySymbols) {
@@ -117,7 +63,7 @@ function _object_spread_props$3(target, source) {
117
63
  function httpRequest(options) {
118
64
  return new Promise(function(resolve, reject) {
119
65
  var _options_hostname;
120
- var req = node_http.request(_object_spread_props$3(_object_spread$3({
66
+ var req = request(_object_spread_props$3(_object_spread$4({
121
67
  method: "GET"
122
68
  }, options), {
123
69
  hostname: (_options_hostname = options.hostname) === null || _options_hostname === void 0 ? void 0 : _options_hostname.replace(/^\[(.+)\]$/, "$1")
@@ -151,6 +97,62 @@ function httpRequest(options) {
151
97
  });
152
98
  }
153
99
 
100
+ function _define_property$4(obj, key, value) {
101
+ if (key in obj) {
102
+ Object.defineProperty(obj, key, {
103
+ value: value,
104
+ enumerable: true,
105
+ configurable: true,
106
+ writable: true
107
+ });
108
+ } else {
109
+ obj[key] = value;
110
+ }
111
+ return obj;
112
+ }
113
+ function _object_spread$3(target) {
114
+ for(var i = 1; i < arguments.length; i++){
115
+ var source = arguments[i] != null ? arguments[i] : {};
116
+ var ownKeys = Object.keys(source);
117
+ if (typeof Object.getOwnPropertySymbols === "function") {
118
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
119
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
120
+ }));
121
+ }
122
+ ownKeys.forEach(function(key) {
123
+ _define_property$4(target, key, source[key]);
124
+ });
125
+ }
126
+ return target;
127
+ }
128
+ function _type_of$1(obj) {
129
+ "@swc/helpers - typeof";
130
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
131
+ }
132
+ var isImdsCredentials = function(arg) {
133
+ return Boolean(arg) && (typeof arg === "undefined" ? "undefined" : _type_of$1(arg)) === "object" && typeof arg.AccessKeyId === "string" && typeof arg.SecretAccessKey === "string" && typeof arg.Token === "string" && typeof arg.Expiration === "string";
134
+ };
135
+ var fromImdsCredentials = function(creds) {
136
+ return _object_spread$3({
137
+ accessKeyId: creds.AccessKeyId,
138
+ secretAccessKey: creds.SecretAccessKey,
139
+ sessionToken: creds.Token,
140
+ expiration: new Date(creds.Expiration)
141
+ }, creds.AccountId && {
142
+ accountId: creds.AccountId
143
+ });
144
+ };
145
+
146
+ var DEFAULT_TIMEOUT = 1000;
147
+ var DEFAULT_MAX_RETRIES = 0;
148
+ var providerConfigFromInit = function(param) {
149
+ var _param_maxRetries = param.maxRetries, maxRetries = _param_maxRetries === void 0 ? DEFAULT_MAX_RETRIES : _param_maxRetries, _param_timeout = param.timeout, timeout = _param_timeout === void 0 ? DEFAULT_TIMEOUT : _param_timeout;
150
+ return {
151
+ maxRetries: maxRetries,
152
+ timeout: timeout
153
+ };
154
+ };
155
+
154
156
  var retry = function(toRetry, maxRetries) {
155
157
  var promise = toRetry();
156
158
  for(var i = 0; i < maxRetries; i++){
@@ -404,14 +406,14 @@ var requestFromEcsImds = function() {
404
406
  };
405
407
  }();
406
408
  var CMDS_IP = "169.254.170.2";
407
- var GREENGRASS_HOSTS = new Set([
408
- "localhost",
409
- "127.0.0.1"
410
- ]);
411
- var GREENGRASS_PROTOCOLS = new Set([
412
- "http:",
413
- "https:"
414
- ]);
409
+ var GREENGRASS_HOSTS = {
410
+ localhost: true,
411
+ "127.0.0.1": true
412
+ };
413
+ var GREENGRASS_PROTOCOLS = {
414
+ "http:": true,
415
+ "https:": true
416
+ };
415
417
  var getCmdsUri = function() {
416
418
  var _ref = _async_to_generator$3(function(param) {
417
419
  var logger, parsed;
@@ -427,21 +429,14 @@ var getCmdsUri = function() {
427
429
  ];
428
430
  }
429
431
  if (process.env[ENV_CMDS_FULL_URI]) {
430
- try {
431
- parsed = new URL(process.env[ENV_CMDS_FULL_URI]);
432
- } catch (e) {
433
- throw new CredentialsProviderError("".concat(process.env[ENV_CMDS_FULL_URI], " is not a valid container metadata service URL"), {
434
- tryNextLink: false,
435
- logger: logger
436
- });
437
- }
438
- if (!parsed.hostname || !GREENGRASS_HOSTS.has(parsed.hostname)) {
432
+ parsed = parse(process.env[ENV_CMDS_FULL_URI]);
433
+ if (!parsed.hostname || !(parsed.hostname in GREENGRASS_HOSTS)) {
439
434
  throw new CredentialsProviderError("".concat(parsed.hostname, " is not a valid container metadata service hostname"), {
440
435
  tryNextLink: false,
441
436
  logger: logger
442
437
  });
443
438
  }
444
- if (!parsed.protocol || !GREENGRASS_PROTOCOLS.has(parsed.protocol)) {
439
+ if (!parsed.protocol || !(parsed.protocol in GREENGRASS_PROTOCOLS)) {
445
440
  throw new CredentialsProviderError("".concat(parsed.protocol, " is not a valid container metadata service protocol"), {
446
441
  tryNextLink: false,
447
442
  logger: logger
@@ -449,12 +444,9 @@ var getCmdsUri = function() {
449
444
  }
450
445
  return [
451
446
  2,
452
- {
453
- protocol: parsed.protocol,
454
- hostname: parsed.hostname,
455
- path: parsed.pathname + parsed.search,
447
+ _object_spread_props$2(_object_spread$2({}, parsed), {
456
448
  port: parsed.port ? parseInt(parsed.port, 10) : undefined
457
- }
449
+ })
458
450
  ];
459
451
  }
460
452
  throw new CredentialsProviderError("The container metadata credential provider cannot be used unless" + " the ".concat(ENV_CMDS_RELATIVE_URI, " or ").concat(ENV_CMDS_FULL_URI, " environment") + " variable is set", {