cdk-comprehend-s3olap 2.0.79 → 2.0.80

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.
Files changed (34) hide show
  1. package/.jsii +3 -3
  2. package/lib/cdk-comprehend-s3olap.js +2 -2
  3. package/lib/comprehend-lambdas.js +2 -2
  4. package/lib/iam-roles.js +4 -4
  5. package/node_modules/aws-sdk/CHANGELOG.md +7 -1
  6. package/node_modules/aws-sdk/README.md +1 -1
  7. package/node_modules/aws-sdk/apis/mediapackage-2017-10-12.min.json +7 -0
  8. package/node_modules/aws-sdk/clients/mediapackage.d.ts +2 -0
  9. package/node_modules/aws-sdk/clients/rds.d.ts +5 -5
  10. package/node_modules/aws-sdk/dist/aws-sdk-core-react-native.js +151 -31
  11. package/node_modules/aws-sdk/dist/aws-sdk-react-native.js +154 -34
  12. package/node_modules/aws-sdk/dist/aws-sdk.js +230 -114
  13. package/node_modules/aws-sdk/dist/aws-sdk.min.js +11 -11
  14. package/node_modules/aws-sdk/lib/config-base.d.ts +14 -0
  15. package/node_modules/aws-sdk/lib/config.js +78 -1
  16. package/node_modules/aws-sdk/lib/core.js +1 -1
  17. package/node_modules/aws-sdk/lib/event_listeners.js +49 -30
  18. package/node_modules/aws-sdk/lib/node_loader.js +17 -1
  19. package/node_modules/aws-sdk/lib/service.js +2 -0
  20. package/node_modules/aws-sdk/lib/shared-ini/ini-loader.d.ts +1 -12
  21. package/node_modules/aws-sdk/lib/shared-ini/ini-loader.js +68 -30
  22. package/node_modules/aws-sdk/lib/signers/bearer.js +14 -0
  23. package/node_modules/aws-sdk/lib/signers/request_signer.js +2 -0
  24. package/node_modules/aws-sdk/lib/token/sso_token_provider.d.ts +12 -0
  25. package/node_modules/aws-sdk/lib/token/sso_token_provider.js +245 -0
  26. package/node_modules/aws-sdk/lib/token/static_token_provider.d.ts +8 -0
  27. package/node_modules/aws-sdk/lib/token/static_token_provider.js +27 -0
  28. package/node_modules/aws-sdk/lib/token/token_provider_chain.d.ts +24 -0
  29. package/node_modules/aws-sdk/lib/token/token_provider_chain.js +165 -0
  30. package/node_modules/aws-sdk/lib/token.d.ts +101 -0
  31. package/node_modules/aws-sdk/lib/token.js +219 -0
  32. package/node_modules/aws-sdk/package.json +1 -1
  33. package/node_modules/aws-sdk/scripts/region-checker/allowlist.js +4 -1
  34. package/package.json +3 -3
@@ -3,6 +3,8 @@ import {Agent as httpsAgent} from 'https';
3
3
  import {AWSError} from './error';
4
4
  import {Credentials, CredentialsOptions} from './credentials';
5
5
  import {CredentialProviderChain} from './credentials/credential_provider_chain';
6
+ import {Token} from './token';
7
+ import {TokenProviderChain} from './token/token_provider_chain';
6
8
 
7
9
  export class ConfigBase extends ConfigurationOptions{
8
10
  constructor(options?: ConfigurationOptions);
@@ -10,6 +12,10 @@ export class ConfigBase extends ConfigurationOptions{
10
12
  * Loads credentials from the configuration object.
11
13
  */
12
14
  getCredentials(callback: (err: AWSError|null, credentials: Credentials|CredentialsOptions|null) => void): void;
15
+ /**
16
+ * Loads token from the token object.
17
+ */
18
+ getToken(callback: (err: AWSError|null, token: Token|null) => void): void;
13
19
  /**
14
20
  * Loads configuration data from a JSON file into this config object.
15
21
  * Loading configuration will reset all existing configuration on the object.
@@ -149,6 +155,14 @@ export abstract class ConfigurationOptions {
149
155
  * The provider chain used to resolve credentials if no static credentials property is set.
150
156
  */
151
157
  credentialProvider?: CredentialProviderChain
158
+ /**
159
+ * The Token to authenticate requests with.
160
+ */
161
+ token?: Token|null
162
+ /**
163
+ * The provider chain used to resolve token if no static token property is set.
164
+ */
165
+ tokenProvider?: TokenProviderChain
152
166
  /**
153
167
  * AWS access key ID.
154
168
  *
@@ -442,6 +442,82 @@ AWS.Config = AWS.util.inherit({
442
442
  }
443
443
  },
444
444
 
445
+ /**
446
+ * Loads token from the configuration object. This is used internally
447
+ * by the SDK to ensure that refreshable {Token} objects are properly
448
+ * refreshed and loaded when sending a request. If you want to ensure that
449
+ * your token is loaded prior to a request, you can use this method
450
+ * directly to provide accurate token data stored in the object.
451
+ *
452
+ * @note If you configure the SDK with static token, the token data should
453
+ * already be present in {token} attribute. This method is primarily necessary
454
+ * to load token from asynchronous sources, or sources that can refresh
455
+ * token periodically.
456
+ * @example Getting your access token
457
+ * AWS.config.getToken(function(err) {
458
+ * if (err) console.log(err.stack); // token not loaded
459
+ * else console.log("Token:", AWS.config.token.token);
460
+ * })
461
+ * @callback callback function(err)
462
+ * Called when the {token} have been properly set on the configuration object.
463
+ *
464
+ * @param err [Error] if this is set, token was not successfully loaded and
465
+ * this error provides information why.
466
+ * @see token
467
+ */
468
+ getToken: function getToken(callback) {
469
+ var self = this;
470
+
471
+ function finish(err) {
472
+ callback(err, err ? null : self.token);
473
+ }
474
+
475
+ function tokenError(msg, err) {
476
+ return new AWS.util.error(err || new Error(), {
477
+ code: 'TokenError',
478
+ message: msg,
479
+ name: 'TokenError'
480
+ });
481
+ }
482
+
483
+ function getAsyncToken() {
484
+ self.token.get(function(err) {
485
+ if (err) {
486
+ var msg = 'Could not load token from ' +
487
+ self.token.constructor.name;
488
+ err = tokenError(msg, err);
489
+ }
490
+ finish(err);
491
+ });
492
+ }
493
+
494
+ function getStaticToken() {
495
+ var err = null;
496
+ if (!self.token.token) {
497
+ err = tokenError('Missing token');
498
+ }
499
+ finish(err);
500
+ }
501
+
502
+ if (self.token) {
503
+ if (typeof self.token.get === 'function') {
504
+ getAsyncToken();
505
+ } else { // static token
506
+ getStaticToken();
507
+ }
508
+ } else if (self.tokenProvider) {
509
+ self.tokenProvider.resolve(function(err, token) {
510
+ if (err) {
511
+ err = tokenError('Could not load token from any providers', err);
512
+ }
513
+ self.token = token;
514
+ finish(err);
515
+ });
516
+ } else {
517
+ finish(tokenError('No token to load'));
518
+ }
519
+ },
520
+
445
521
  /**
446
522
  * @!group Loading and Setting Configuration Options
447
523
  */
@@ -575,7 +651,8 @@ AWS.Config = AWS.util.inherit({
575
651
  hostPrefixEnabled: true,
576
652
  stsRegionalEndpoints: 'legacy',
577
653
  useFipsEndpoint: false,
578
- useDualstackEndpoint: false
654
+ useDualstackEndpoint: false,
655
+ token: null
579
656
  },
580
657
 
581
658
  /**
@@ -20,7 +20,7 @@ AWS.util.update(AWS, {
20
20
  /**
21
21
  * @constant
22
22
  */
23
- VERSION: '2.1203.0',
23
+ VERSION: '2.1204.0',
24
24
 
25
25
  /**
26
26
  * @api private
@@ -255,37 +255,56 @@ AWS.EventListeners = {
255
255
  var authtype = operation ? operation.authtype : '';
256
256
  if (!service.api.signatureVersion && !authtype && !service.config.signatureVersion) return done(); // none
257
257
 
258
- service.config.getCredentials(function (err, credentials) {
259
- if (err) {
260
- req.response.error = err;
261
- return done();
262
- }
258
+ if (authtype === 'bearer' || service.config.signatureVersion === 'bearer') {
259
+ service.config.getToken(function (err, token) {
260
+ if (err) {
261
+ req.response.error = err;
262
+ return done();
263
+ }
263
264
 
264
- try {
265
- var date = service.getSkewCorrectedDate();
266
- var SignerClass = service.getSignerClass(req);
267
- var signer = new SignerClass(req.httpRequest,
268
- service.getSigningName(req),
269
- {
270
- signatureCache: service.config.signatureCache,
271
- operation: operation,
272
- signatureVersion: service.api.signatureVersion
273
- });
274
- signer.setServiceClientId(service._clientId);
275
-
276
- // clear old authorization headers
277
- delete req.httpRequest.headers['Authorization'];
278
- delete req.httpRequest.headers['Date'];
279
- delete req.httpRequest.headers['X-Amz-Date'];
280
-
281
- // add new authorization
282
- signer.addAuthorization(credentials, date);
283
- req.signedAt = date;
284
- } catch (e) {
285
- req.response.error = e;
286
- }
287
- done();
288
- });
265
+ try {
266
+ var SignerClass = service.getSignerClass(req);
267
+ var signer = new SignerClass(req.httpRequest);
268
+ signer.addAuthorization(token);
269
+ } catch (e) {
270
+ req.response.error = e;
271
+ }
272
+ done();
273
+ });
274
+ } else {
275
+ service.config.getCredentials(function (err, credentials) {
276
+ if (err) {
277
+ req.response.error = err;
278
+ return done();
279
+ }
280
+
281
+ try {
282
+ var date = service.getSkewCorrectedDate();
283
+ var SignerClass = service.getSignerClass(req);
284
+ var signer = new SignerClass(req.httpRequest,
285
+ service.getSigningName(req),
286
+ {
287
+ signatureCache: service.config.signatureCache,
288
+ operation: operation,
289
+ signatureVersion: service.api.signatureVersion
290
+ });
291
+ signer.setServiceClientId(service._clientId);
292
+
293
+ // clear old authorization headers
294
+ delete req.httpRequest.headers['Authorization'];
295
+ delete req.httpRequest.headers['Date'];
296
+ delete req.httpRequest.headers['X-Amz-Date'];
297
+
298
+ // add new authorization
299
+ signer.addAuthorization(credentials, date);
300
+ req.signedAt = date;
301
+ } catch (e) {
302
+ req.response.error = e;
303
+ }
304
+ done();
305
+ });
306
+
307
+ }
289
308
  });
290
309
 
291
310
  add('VALIDATE_RESPONSE', 'validateResponse', function VALIDATE_RESPONSE(resp) {
@@ -87,7 +87,7 @@ require('./credentials/shared_ini_file_credentials');
87
87
  require('./credentials/process_credentials');
88
88
  require('./credentials/sso_credentials');
89
89
 
90
- // Setup default chain providers
90
+ // Setup default providers for credentials chain
91
91
  // If this changes, please update documentation for
92
92
  // AWS.CredentialProviderChain.defaultProviders in
93
93
  // credentials/credential_provider_chain.js
@@ -102,6 +102,19 @@ AWS.CredentialProviderChain.defaultProviders = [
102
102
  function () { return new AWS.EC2MetadataCredentials(); }
103
103
  ];
104
104
 
105
+ // Load custom token providers
106
+ require('./token');
107
+ require('./token/token_provider_chain');
108
+ require('./token/sso_token_provider');
109
+
110
+ // Setup default providers for token chain
111
+ // If this changes, please update documentation for
112
+ // AWS.TokenProviderChain.defaultProviders in
113
+ // token/token_provider_chain.js
114
+ AWS.TokenProviderChain.defaultProviders = [
115
+ function () { return new AWS.SSOTokenProvider(); },
116
+ ];
117
+
105
118
  var getRegion = function() {
106
119
  var env = process.env;
107
120
  var region = env.AWS_REGION || env.AMAZON_REGION;
@@ -173,6 +186,9 @@ AWS.util.update(AWS.Config.prototype.keys, {
173
186
  var region = getRegion();
174
187
  return region ? getRealRegion(region): undefined;
175
188
  },
189
+ tokenProvider: function() {
190
+ return new AWS.TokenProviderChain();
191
+ },
176
192
  useFipsEndpoint: function() {
177
193
  var region = getRegion();
178
194
  return isFipsRegion(region)
@@ -499,6 +499,8 @@ AWS.Service = inherit({
499
499
  version = this.config.signatureVersion;
500
500
  } else if (authtype === 'v4' || authtype === 'v4-unsigned-body') {
501
501
  version = 'v4';
502
+ } else if (authtype === 'bearer') {
503
+ version = 'bearer';
502
504
  } else {
503
505
  version = this.api.signatureVersion;
504
506
  }
@@ -27,15 +27,4 @@ export class IniLoader{
27
27
  * @returns {object} object of all profile information in the file
28
28
  */
29
29
  loadFrom(options: LoadFileOptions): IniFileContent;
30
- }
31
-
32
- /**
33
- * Read specified file and return parsed config object. This method will always
34
- * read from disk and won't update cache. This is a lower level function of
35
- * loadFrom().
36
- * @param filename [string] valid readable file path containing aws credentials
37
- * or aws configs
38
- * @param isConfig [boolean] true if specified file is an aws config file; false
39
- * if the file is an aws credentials file
40
- */
41
- export function parseFile(filename: string, isConfig: boolean): IniFileContent;
30
+ }
@@ -2,18 +2,32 @@ var AWS = require('../core');
2
2
  var os = require('os');
3
3
  var path = require('path');
4
4
 
5
- function parseFile(filename, isConfig) {
6
- var content = AWS.util.ini.parse(AWS.util.readFileSync(filename));
7
- var tmpContent = {};
8
- Object.keys(content).forEach(function(profileName) {
9
- var profileContent = content[profileName];
10
- profileName = isConfig ? profileName.replace(/^profile\s/, '') : profileName;
11
- Object.defineProperty(tmpContent, profileName, {
12
- value: profileContent,
13
- enumerable: true
14
- });
5
+ function parseFile(filename) {
6
+ return AWS.util.ini.parse(AWS.util.readFileSync(filename));
7
+ }
8
+
9
+ function getProfiles(fileContent) {
10
+ var tmpContent = {};
11
+ Object.keys(fileContent).forEach(function(sectionName) {
12
+ if (/^sso-session\s/.test(sectionName)) return;
13
+ Object.defineProperty(tmpContent, sectionName.replace(/^profile\s/, ''), {
14
+ value: fileContent[sectionName],
15
+ enumerable: true
16
+ });
17
+ });
18
+ return tmpContent;
19
+ }
20
+
21
+ function getSsoSessions(fileContent) {
22
+ var tmpContent = {};
23
+ Object.keys(fileContent).forEach(function(sectionName) {
24
+ if (!/^sso-session\s/.test(sectionName)) return;
25
+ Object.defineProperty(tmpContent, sectionName.replace(/^sso-session\s/, ''), {
26
+ value: fileContent[sectionName],
27
+ enumerable: true
15
28
  });
16
- return tmpContent;
29
+ });
30
+ return tmpContent;
17
31
  }
18
32
 
19
33
  /**
@@ -28,41 +42,66 @@ function parseFile(filename, isConfig) {
28
42
  AWS.IniLoader = AWS.util.inherit({
29
43
  constructor: function IniLoader() {
30
44
  this.resolvedProfiles = {};
45
+ this.resolvedSsoSessions = {};
31
46
  },
32
47
 
33
48
  /** Remove all cached files. Used after config files are updated. */
34
49
  clearCachedFiles: function clearCachedFiles() {
35
50
  this.resolvedProfiles = {};
51
+ this.resolvedSsoSessions = {};
36
52
  },
37
53
 
38
- /**
39
- * Load configurations from config/credentials files and cache them
40
- * for later use. If no file is specified it will try to load default
41
- * files.
42
- * @param options [map] information describing the file
43
- * @option options filename [String] ('~/.aws/credentials' or defined by
44
- * AWS_SHARED_CREDENTIALS_FILE process env var or '~/.aws/config' if
45
- * isConfig is set to true)
46
- * path to the file to be read.
47
- * @option options isConfig [Boolean] (false) True to read config file.
48
- * @return [map<String,String>] object containing contents from file in key-value
49
- * pairs.
50
- */
54
+ /**
55
+ * Load configurations from config/credentials files and cache them
56
+ * for later use. If no file is specified it will try to load default files.
57
+ *
58
+ * @param options [map] information describing the file
59
+ * @option options filename [String] ('~/.aws/credentials' or defined by
60
+ * AWS_SHARED_CREDENTIALS_FILE process env var or '~/.aws/config' if
61
+ * isConfig is set to true)
62
+ * path to the file to be read.
63
+ * @option options isConfig [Boolean] (false) True to read config file.
64
+ * @return [map<String,String>] object containing contents from file in key-value
65
+ * pairs.
66
+ */
51
67
  loadFrom: function loadFrom(options) {
52
68
  options = options || {};
53
69
  var isConfig = options.isConfig === true;
54
70
  var filename = options.filename || this.getDefaultFilePath(isConfig);
55
71
  if (!this.resolvedProfiles[filename]) {
56
- var fileContent = this.parseFile(filename, isConfig);
57
- Object.defineProperty(this.resolvedProfiles, filename, { value: fileContent });
72
+ var fileContent = parseFile(filename);
73
+ if (isConfig) {
74
+ Object.defineProperty(this.resolvedProfiles, filename, {
75
+ value: getProfiles(fileContent)
76
+ });
77
+ } else {
78
+ Object.defineProperty(this.resolvedProfiles, filename, { value: fileContent });
79
+ }
58
80
  }
59
81
  return this.resolvedProfiles[filename];
60
82
  },
61
83
 
62
84
  /**
63
- * @api private
85
+ * Load sso sessions from config/credentials files and cache them
86
+ * for later use. If no file is specified it will try to load default file.
87
+ *
88
+ * @param options [map] information describing the file
89
+ * @option options filename [String] ('~/.aws/config' or defined by
90
+ * AWS_CONFIG_FILE process env var)
91
+ * @return [map<String,String>] object containing contents from file in key-value
92
+ * pairs.
64
93
  */
65
- parseFile: parseFile,
94
+ loadSsoSessionsFrom: function loadSsoSessionsFrom(options) {
95
+ options = options || {};
96
+ var filename = options.filename || this.getDefaultFilePath(true);
97
+ if (!this.resolvedSsoSessions[filename]) {
98
+ var fileContent = parseFile(filename);
99
+ Object.defineProperty(this.resolvedSsoSessions, filename, {
100
+ value: getSsoSessions(fileContent)
101
+ });
102
+ }
103
+ return this.resolvedSsoSessions[filename];
104
+ },
66
105
 
67
106
  /**
68
107
  * @api private
@@ -101,6 +140,5 @@ AWS.IniLoader = AWS.util.inherit({
101
140
  var IniLoader = AWS.IniLoader;
102
141
 
103
142
  module.exports = {
104
- IniLoader: IniLoader,
105
- parseFile: parseFile,
143
+ IniLoader: IniLoader
106
144
  };
@@ -0,0 +1,14 @@
1
+ var AWS = require('../core');
2
+
3
+ /**
4
+ * @api private
5
+ */
6
+ AWS.Signers.Bearer = AWS.util.inherit(AWS.Signers.RequestSigner, {
7
+ constructor: function Bearer(request) {
8
+ AWS.Signers.RequestSigner.call(this, request);
9
+ },
10
+
11
+ addAuthorization: function addAuthorization(token) {
12
+ this.request.httpRequest.headers['Authorization'] = 'Bearer ' + token.token;
13
+ }
14
+ });
@@ -27,6 +27,7 @@ AWS.Signers.RequestSigner.getVersion = function getVersion(version) {
27
27
  case 'v4': return AWS.Signers.V4;
28
28
  case 's3': return AWS.Signers.S3;
29
29
  case 'v3https': return AWS.Signers.V3Https;
30
+ case 'bearer': return AWS.Signers.Bearer;
30
31
  }
31
32
  throw new Error('Unknown signing version ' + version);
32
33
  };
@@ -37,3 +38,4 @@ require('./v3https');
37
38
  require('./v4');
38
39
  require('./s3');
39
40
  require('./presign');
41
+ require('./bearer');
@@ -0,0 +1,12 @@
1
+ import {Token} from '../token';
2
+
3
+ export class SSOTokenProvider extends Token {
4
+ /**
5
+ * Creates a new SSOTokenProvider object.
6
+ */
7
+ constructor(options?: SSOTokenProviderOptions);
8
+ }
9
+
10
+ export interface SSOTokenProviderOptions {
11
+ profile?: string
12
+ }