mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 12:49:06 +00:00
Send to zulip
This commit is contained in:
19
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/api_loader.js
generated
vendored
Normal file
19
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/api_loader.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
function apiLoader(svc, version) {
|
||||
if (!apiLoader.services.hasOwnProperty(svc)) {
|
||||
throw new Error('InvalidService: Failed to load api for ' + svc);
|
||||
}
|
||||
return apiLoader.services[svc][version];
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*
|
||||
* This member of AWS.apiLoader is private, but changing it will necessitate a
|
||||
* change to ../scripts/services-table-generator.ts
|
||||
*/
|
||||
apiLoader.services = {};
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = apiLoader;
|
||||
11
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/aws.js
generated
vendored
Normal file
11
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/aws.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
require('./node_loader');
|
||||
|
||||
var AWS = require('./core');
|
||||
|
||||
// Load all service classes
|
||||
require('../clients/all');
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = AWS;
|
||||
19
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/browser.js
generated
vendored
Normal file
19
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/browser.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
require('./browser_loader');
|
||||
|
||||
var AWS = require('./core');
|
||||
|
||||
if (typeof window !== 'undefined') window.AWS = AWS;
|
||||
if (typeof module !== 'undefined') {
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = AWS;
|
||||
}
|
||||
if (typeof self !== 'undefined') self.AWS = AWS;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* DO NOT REMOVE
|
||||
* browser builder will strip out this line if services are supplied on the command line.
|
||||
*/
|
||||
require('../clients/browser_default');
|
||||
37
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/browserCryptoLib.js
generated
vendored
Normal file
37
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/browserCryptoLib.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
var Hmac = require('./browserHmac');
|
||||
var Md5 = require('./browserMd5');
|
||||
var Sha1 = require('./browserSha1');
|
||||
var Sha256 = require('./browserSha256');
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = exports = {
|
||||
createHash: function createHash(alg) {
|
||||
alg = alg.toLowerCase();
|
||||
if (alg === 'md5') {
|
||||
return new Md5();
|
||||
} else if (alg === 'sha256') {
|
||||
return new Sha256();
|
||||
} else if (alg === 'sha1') {
|
||||
return new Sha1();
|
||||
}
|
||||
|
||||
throw new Error('Hash algorithm ' + alg + ' is not supported in the browser SDK');
|
||||
},
|
||||
createHmac: function createHmac(alg, key) {
|
||||
alg = alg.toLowerCase();
|
||||
if (alg === 'md5') {
|
||||
return new Hmac(Md5, key);
|
||||
} else if (alg === 'sha256') {
|
||||
return new Hmac(Sha256, key);
|
||||
} else if (alg === 'sha1') {
|
||||
return new Hmac(Sha1, key);
|
||||
}
|
||||
|
||||
throw new Error('HMAC algorithm ' + alg + ' is not supported in the browser SDK');
|
||||
},
|
||||
createSign: function() {
|
||||
throw new Error('createSign is not implemented in the browser');
|
||||
}
|
||||
};
|
||||
65
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/browserHashUtils.js
generated
vendored
Normal file
65
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/browserHashUtils.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
var Buffer = require('buffer/').Buffer;
|
||||
|
||||
/**
|
||||
* This is a polyfill for the static method `isView` of `ArrayBuffer`, which is
|
||||
* e.g. missing in IE 10.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
if (
|
||||
typeof ArrayBuffer !== 'undefined' &&
|
||||
typeof ArrayBuffer.isView === 'undefined'
|
||||
) {
|
||||
ArrayBuffer.isView = function(arg) {
|
||||
return viewStrings.indexOf(Object.prototype.toString.call(arg)) > -1;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
var viewStrings = [
|
||||
'[object Int8Array]',
|
||||
'[object Uint8Array]',
|
||||
'[object Uint8ClampedArray]',
|
||||
'[object Int16Array]',
|
||||
'[object Uint16Array]',
|
||||
'[object Int32Array]',
|
||||
'[object Uint32Array]',
|
||||
'[object Float32Array]',
|
||||
'[object Float64Array]',
|
||||
'[object DataView]',
|
||||
];
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
function isEmptyData(data) {
|
||||
if (typeof data === 'string') {
|
||||
return data.length === 0;
|
||||
}
|
||||
return data.byteLength === 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
function convertToBuffer(data) {
|
||||
if (typeof data === 'string') {
|
||||
data = new Buffer(data, 'utf8');
|
||||
}
|
||||
|
||||
if (ArrayBuffer.isView(data)) {
|
||||
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT);
|
||||
}
|
||||
|
||||
return new Uint8Array(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = exports = {
|
||||
isEmptyData: isEmptyData,
|
||||
convertToBuffer: convertToBuffer,
|
||||
};
|
||||
65
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/browserHmac.js
generated
vendored
Normal file
65
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/browserHmac.js
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
var hashUtils = require('./browserHashUtils');
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
function Hmac(hashCtor, secret) {
|
||||
this.hash = new hashCtor();
|
||||
this.outer = new hashCtor();
|
||||
|
||||
var inner = bufferFromSecret(hashCtor, secret);
|
||||
var outer = new Uint8Array(hashCtor.BLOCK_SIZE);
|
||||
outer.set(inner);
|
||||
|
||||
for (var i = 0; i < hashCtor.BLOCK_SIZE; i++) {
|
||||
inner[i] ^= 0x36;
|
||||
outer[i] ^= 0x5c;
|
||||
}
|
||||
|
||||
this.hash.update(inner);
|
||||
this.outer.update(outer);
|
||||
|
||||
// Zero out the copied key buffer.
|
||||
for (var i = 0; i < inner.byteLength; i++) {
|
||||
inner[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = exports = Hmac;
|
||||
|
||||
Hmac.prototype.update = function (toHash) {
|
||||
if (hashUtils.isEmptyData(toHash) || this.error) {
|
||||
return this;
|
||||
}
|
||||
|
||||
try {
|
||||
this.hash.update(hashUtils.convertToBuffer(toHash));
|
||||
} catch (e) {
|
||||
this.error = e;
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
Hmac.prototype.digest = function (encoding) {
|
||||
if (!this.outer.finished) {
|
||||
this.outer.update(this.hash.digest());
|
||||
}
|
||||
|
||||
return this.outer.digest(encoding);
|
||||
};
|
||||
|
||||
function bufferFromSecret(hashCtor, secret) {
|
||||
var input = hashUtils.convertToBuffer(secret);
|
||||
if (input.byteLength > hashCtor.BLOCK_SIZE) {
|
||||
var bufferHash = new hashCtor;
|
||||
bufferHash.update(input);
|
||||
input = bufferHash.digest();
|
||||
}
|
||||
var buffer = new Uint8Array(hashCtor.BLOCK_SIZE);
|
||||
buffer.set(input);
|
||||
return buffer;
|
||||
}
|
||||
182
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/browserMd5.js
generated
vendored
Normal file
182
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/browserMd5.js
generated
vendored
Normal file
@@ -0,0 +1,182 @@
|
||||
var hashUtils = require('./browserHashUtils');
|
||||
var Buffer = require('buffer/').Buffer;
|
||||
|
||||
var BLOCK_SIZE = 64;
|
||||
|
||||
var DIGEST_LENGTH = 16;
|
||||
|
||||
var INIT = [
|
||||
0x67452301,
|
||||
0xefcdab89,
|
||||
0x98badcfe,
|
||||
0x10325476,
|
||||
];
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
function Md5() {
|
||||
this.state = [
|
||||
0x67452301,
|
||||
0xefcdab89,
|
||||
0x98badcfe,
|
||||
0x10325476,
|
||||
];
|
||||
this.buffer = new DataView(new ArrayBuffer(BLOCK_SIZE));
|
||||
this.bufferLength = 0;
|
||||
this.bytesHashed = 0;
|
||||
this.finished = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = exports = Md5;
|
||||
|
||||
Md5.BLOCK_SIZE = BLOCK_SIZE;
|
||||
|
||||
Md5.prototype.update = function (sourceData) {
|
||||
if (hashUtils.isEmptyData(sourceData)) {
|
||||
return this;
|
||||
} else if (this.finished) {
|
||||
throw new Error('Attempted to update an already finished hash.');
|
||||
}
|
||||
|
||||
var data = hashUtils.convertToBuffer(sourceData);
|
||||
var position = 0;
|
||||
var byteLength = data.byteLength;
|
||||
this.bytesHashed += byteLength;
|
||||
while (byteLength > 0) {
|
||||
this.buffer.setUint8(this.bufferLength++, data[position++]);
|
||||
byteLength--;
|
||||
if (this.bufferLength === BLOCK_SIZE) {
|
||||
this.hashBuffer();
|
||||
this.bufferLength = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
Md5.prototype.digest = function (encoding) {
|
||||
if (!this.finished) {
|
||||
var _a = this, buffer = _a.buffer, undecoratedLength = _a.bufferLength, bytesHashed = _a.bytesHashed;
|
||||
var bitsHashed = bytesHashed * 8;
|
||||
buffer.setUint8(this.bufferLength++, 128);
|
||||
// Ensure the final block has enough room for the hashed length
|
||||
if (undecoratedLength % BLOCK_SIZE >= BLOCK_SIZE - 8) {
|
||||
for (var i = this.bufferLength; i < BLOCK_SIZE; i++) {
|
||||
buffer.setUint8(i, 0);
|
||||
}
|
||||
this.hashBuffer();
|
||||
this.bufferLength = 0;
|
||||
}
|
||||
for (var i = this.bufferLength; i < BLOCK_SIZE - 8; i++) {
|
||||
buffer.setUint8(i, 0);
|
||||
}
|
||||
buffer.setUint32(BLOCK_SIZE - 8, bitsHashed >>> 0, true);
|
||||
buffer.setUint32(BLOCK_SIZE - 4, Math.floor(bitsHashed / 0x100000000), true);
|
||||
this.hashBuffer();
|
||||
this.finished = true;
|
||||
}
|
||||
var out = new DataView(new ArrayBuffer(DIGEST_LENGTH));
|
||||
for (var i = 0; i < 4; i++) {
|
||||
out.setUint32(i * 4, this.state[i], true);
|
||||
}
|
||||
var buff = new Buffer(out.buffer, out.byteOffset, out.byteLength);
|
||||
return encoding ? buff.toString(encoding) : buff;
|
||||
};
|
||||
|
||||
Md5.prototype.hashBuffer = function () {
|
||||
var _a = this, buffer = _a.buffer, state = _a.state;
|
||||
var a = state[0], b = state[1], c = state[2], d = state[3];
|
||||
a = ff(a, b, c, d, buffer.getUint32(0, true), 7, 0xd76aa478);
|
||||
d = ff(d, a, b, c, buffer.getUint32(4, true), 12, 0xe8c7b756);
|
||||
c = ff(c, d, a, b, buffer.getUint32(8, true), 17, 0x242070db);
|
||||
b = ff(b, c, d, a, buffer.getUint32(12, true), 22, 0xc1bdceee);
|
||||
a = ff(a, b, c, d, buffer.getUint32(16, true), 7, 0xf57c0faf);
|
||||
d = ff(d, a, b, c, buffer.getUint32(20, true), 12, 0x4787c62a);
|
||||
c = ff(c, d, a, b, buffer.getUint32(24, true), 17, 0xa8304613);
|
||||
b = ff(b, c, d, a, buffer.getUint32(28, true), 22, 0xfd469501);
|
||||
a = ff(a, b, c, d, buffer.getUint32(32, true), 7, 0x698098d8);
|
||||
d = ff(d, a, b, c, buffer.getUint32(36, true), 12, 0x8b44f7af);
|
||||
c = ff(c, d, a, b, buffer.getUint32(40, true), 17, 0xffff5bb1);
|
||||
b = ff(b, c, d, a, buffer.getUint32(44, true), 22, 0x895cd7be);
|
||||
a = ff(a, b, c, d, buffer.getUint32(48, true), 7, 0x6b901122);
|
||||
d = ff(d, a, b, c, buffer.getUint32(52, true), 12, 0xfd987193);
|
||||
c = ff(c, d, a, b, buffer.getUint32(56, true), 17, 0xa679438e);
|
||||
b = ff(b, c, d, a, buffer.getUint32(60, true), 22, 0x49b40821);
|
||||
a = gg(a, b, c, d, buffer.getUint32(4, true), 5, 0xf61e2562);
|
||||
d = gg(d, a, b, c, buffer.getUint32(24, true), 9, 0xc040b340);
|
||||
c = gg(c, d, a, b, buffer.getUint32(44, true), 14, 0x265e5a51);
|
||||
b = gg(b, c, d, a, buffer.getUint32(0, true), 20, 0xe9b6c7aa);
|
||||
a = gg(a, b, c, d, buffer.getUint32(20, true), 5, 0xd62f105d);
|
||||
d = gg(d, a, b, c, buffer.getUint32(40, true), 9, 0x02441453);
|
||||
c = gg(c, d, a, b, buffer.getUint32(60, true), 14, 0xd8a1e681);
|
||||
b = gg(b, c, d, a, buffer.getUint32(16, true), 20, 0xe7d3fbc8);
|
||||
a = gg(a, b, c, d, buffer.getUint32(36, true), 5, 0x21e1cde6);
|
||||
d = gg(d, a, b, c, buffer.getUint32(56, true), 9, 0xc33707d6);
|
||||
c = gg(c, d, a, b, buffer.getUint32(12, true), 14, 0xf4d50d87);
|
||||
b = gg(b, c, d, a, buffer.getUint32(32, true), 20, 0x455a14ed);
|
||||
a = gg(a, b, c, d, buffer.getUint32(52, true), 5, 0xa9e3e905);
|
||||
d = gg(d, a, b, c, buffer.getUint32(8, true), 9, 0xfcefa3f8);
|
||||
c = gg(c, d, a, b, buffer.getUint32(28, true), 14, 0x676f02d9);
|
||||
b = gg(b, c, d, a, buffer.getUint32(48, true), 20, 0x8d2a4c8a);
|
||||
a = hh(a, b, c, d, buffer.getUint32(20, true), 4, 0xfffa3942);
|
||||
d = hh(d, a, b, c, buffer.getUint32(32, true), 11, 0x8771f681);
|
||||
c = hh(c, d, a, b, buffer.getUint32(44, true), 16, 0x6d9d6122);
|
||||
b = hh(b, c, d, a, buffer.getUint32(56, true), 23, 0xfde5380c);
|
||||
a = hh(a, b, c, d, buffer.getUint32(4, true), 4, 0xa4beea44);
|
||||
d = hh(d, a, b, c, buffer.getUint32(16, true), 11, 0x4bdecfa9);
|
||||
c = hh(c, d, a, b, buffer.getUint32(28, true), 16, 0xf6bb4b60);
|
||||
b = hh(b, c, d, a, buffer.getUint32(40, true), 23, 0xbebfbc70);
|
||||
a = hh(a, b, c, d, buffer.getUint32(52, true), 4, 0x289b7ec6);
|
||||
d = hh(d, a, b, c, buffer.getUint32(0, true), 11, 0xeaa127fa);
|
||||
c = hh(c, d, a, b, buffer.getUint32(12, true), 16, 0xd4ef3085);
|
||||
b = hh(b, c, d, a, buffer.getUint32(24, true), 23, 0x04881d05);
|
||||
a = hh(a, b, c, d, buffer.getUint32(36, true), 4, 0xd9d4d039);
|
||||
d = hh(d, a, b, c, buffer.getUint32(48, true), 11, 0xe6db99e5);
|
||||
c = hh(c, d, a, b, buffer.getUint32(60, true), 16, 0x1fa27cf8);
|
||||
b = hh(b, c, d, a, buffer.getUint32(8, true), 23, 0xc4ac5665);
|
||||
a = ii(a, b, c, d, buffer.getUint32(0, true), 6, 0xf4292244);
|
||||
d = ii(d, a, b, c, buffer.getUint32(28, true), 10, 0x432aff97);
|
||||
c = ii(c, d, a, b, buffer.getUint32(56, true), 15, 0xab9423a7);
|
||||
b = ii(b, c, d, a, buffer.getUint32(20, true), 21, 0xfc93a039);
|
||||
a = ii(a, b, c, d, buffer.getUint32(48, true), 6, 0x655b59c3);
|
||||
d = ii(d, a, b, c, buffer.getUint32(12, true), 10, 0x8f0ccc92);
|
||||
c = ii(c, d, a, b, buffer.getUint32(40, true), 15, 0xffeff47d);
|
||||
b = ii(b, c, d, a, buffer.getUint32(4, true), 21, 0x85845dd1);
|
||||
a = ii(a, b, c, d, buffer.getUint32(32, true), 6, 0x6fa87e4f);
|
||||
d = ii(d, a, b, c, buffer.getUint32(60, true), 10, 0xfe2ce6e0);
|
||||
c = ii(c, d, a, b, buffer.getUint32(24, true), 15, 0xa3014314);
|
||||
b = ii(b, c, d, a, buffer.getUint32(52, true), 21, 0x4e0811a1);
|
||||
a = ii(a, b, c, d, buffer.getUint32(16, true), 6, 0xf7537e82);
|
||||
d = ii(d, a, b, c, buffer.getUint32(44, true), 10, 0xbd3af235);
|
||||
c = ii(c, d, a, b, buffer.getUint32(8, true), 15, 0x2ad7d2bb);
|
||||
b = ii(b, c, d, a, buffer.getUint32(36, true), 21, 0xeb86d391);
|
||||
state[0] = (a + state[0]) & 0xFFFFFFFF;
|
||||
state[1] = (b + state[1]) & 0xFFFFFFFF;
|
||||
state[2] = (c + state[2]) & 0xFFFFFFFF;
|
||||
state[3] = (d + state[3]) & 0xFFFFFFFF;
|
||||
};
|
||||
|
||||
function cmn(q, a, b, x, s, t) {
|
||||
a = (((a + q) & 0xFFFFFFFF) + ((x + t) & 0xFFFFFFFF)) & 0xFFFFFFFF;
|
||||
return (((a << s) | (a >>> (32 - s))) + b) & 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
function ff(a, b, c, d, x, s, t) {
|
||||
return cmn((b & c) | ((~b) & d), a, b, x, s, t);
|
||||
}
|
||||
|
||||
function gg(a, b, c, d, x, s, t) {
|
||||
return cmn((b & d) | (c & (~d)), a, b, x, s, t);
|
||||
}
|
||||
|
||||
function hh(a, b, c, d, x, s, t) {
|
||||
return cmn(b ^ c ^ d, a, b, x, s, t);
|
||||
}
|
||||
|
||||
function ii(a, b, c, d, x, s, t) {
|
||||
return cmn(c ^ (b | (~d)), a, b, x, s, t);
|
||||
}
|
||||
166
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/browserSha1.js
generated
vendored
Normal file
166
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/browserSha1.js
generated
vendored
Normal file
@@ -0,0 +1,166 @@
|
||||
var Buffer = require('buffer/').Buffer;
|
||||
var hashUtils = require('./browserHashUtils');
|
||||
|
||||
var BLOCK_SIZE = 64;
|
||||
|
||||
var DIGEST_LENGTH = 20;
|
||||
|
||||
var KEY = new Uint32Array([
|
||||
0x5a827999,
|
||||
0x6ed9eba1,
|
||||
0x8f1bbcdc | 0,
|
||||
0xca62c1d6 | 0
|
||||
]);
|
||||
|
||||
var INIT = [
|
||||
0x6a09e667,
|
||||
0xbb67ae85,
|
||||
0x3c6ef372,
|
||||
0xa54ff53a,
|
||||
0x510e527f,
|
||||
0x9b05688c,
|
||||
0x1f83d9ab,
|
||||
0x5be0cd19,
|
||||
];
|
||||
|
||||
var MAX_HASHABLE_LENGTH = Math.pow(2, 53) - 1;
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
function Sha1() {
|
||||
this.h0 = 0x67452301;
|
||||
this.h1 = 0xEFCDAB89;
|
||||
this.h2 = 0x98BADCFE;
|
||||
this.h3 = 0x10325476;
|
||||
this.h4 = 0xC3D2E1F0;
|
||||
// The first 64 bytes (16 words) is the data chunk
|
||||
this.block = new Uint32Array(80);
|
||||
this.offset = 0;
|
||||
this.shift = 24;
|
||||
this.totalLength = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = exports = Sha1;
|
||||
|
||||
Sha1.BLOCK_SIZE = BLOCK_SIZE;
|
||||
|
||||
Sha1.prototype.update = function (data) {
|
||||
if (this.finished) {
|
||||
throw new Error('Attempted to update an already finished hash.');
|
||||
}
|
||||
|
||||
if (hashUtils.isEmptyData(data)) {
|
||||
return this;
|
||||
}
|
||||
|
||||
data = hashUtils.convertToBuffer(data);
|
||||
|
||||
var length = data.length;
|
||||
this.totalLength += length * 8;
|
||||
for (var i = 0; i < length; i++) {
|
||||
this.write(data[i]);
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
Sha1.prototype.write = function write(byte) {
|
||||
this.block[this.offset] |= (byte & 0xff) << this.shift;
|
||||
if (this.shift) {
|
||||
this.shift -= 8;
|
||||
} else {
|
||||
this.offset++;
|
||||
this.shift = 24;
|
||||
}
|
||||
|
||||
if (this.offset === 16) this.processBlock();
|
||||
};
|
||||
|
||||
Sha1.prototype.digest = function (encoding) {
|
||||
// Pad
|
||||
this.write(0x80);
|
||||
if (this.offset > 14 || (this.offset === 14 && this.shift < 24)) {
|
||||
this.processBlock();
|
||||
}
|
||||
this.offset = 14;
|
||||
this.shift = 24;
|
||||
|
||||
// 64-bit length big-endian
|
||||
this.write(0x00); // numbers this big aren't accurate in javascript anyway
|
||||
this.write(0x00); // ..So just hard-code to zero.
|
||||
this.write(this.totalLength > 0xffffffffff ? this.totalLength / 0x10000000000 : 0x00);
|
||||
this.write(this.totalLength > 0xffffffff ? this.totalLength / 0x100000000 : 0x00);
|
||||
for (var s = 24; s >= 0; s -= 8) {
|
||||
this.write(this.totalLength >> s);
|
||||
}
|
||||
// The value in state is little-endian rather than big-endian, so flip
|
||||
// each word into a new Uint8Array
|
||||
var out = new Buffer(DIGEST_LENGTH);
|
||||
var outView = new DataView(out.buffer);
|
||||
outView.setUint32(0, this.h0, false);
|
||||
outView.setUint32(4, this.h1, false);
|
||||
outView.setUint32(8, this.h2, false);
|
||||
outView.setUint32(12, this.h3, false);
|
||||
outView.setUint32(16, this.h4, false);
|
||||
|
||||
return encoding ? out.toString(encoding) : out;
|
||||
};
|
||||
|
||||
Sha1.prototype.processBlock = function processBlock() {
|
||||
// Extend the sixteen 32-bit words into eighty 32-bit words:
|
||||
for (var i = 16; i < 80; i++) {
|
||||
var w = this.block[i - 3] ^ this.block[i - 8] ^ this.block[i - 14] ^ this.block[i - 16];
|
||||
this.block[i] = (w << 1) | (w >>> 31);
|
||||
}
|
||||
|
||||
// Initialize hash value for this chunk:
|
||||
var a = this.h0;
|
||||
var b = this.h1;
|
||||
var c = this.h2;
|
||||
var d = this.h3;
|
||||
var e = this.h4;
|
||||
var f, k;
|
||||
|
||||
// Main loop:
|
||||
for (i = 0; i < 80; i++) {
|
||||
if (i < 20) {
|
||||
f = d ^ (b & (c ^ d));
|
||||
k = 0x5A827999;
|
||||
}
|
||||
else if (i < 40) {
|
||||
f = b ^ c ^ d;
|
||||
k = 0x6ED9EBA1;
|
||||
}
|
||||
else if (i < 60) {
|
||||
f = (b & c) | (d & (b | c));
|
||||
k = 0x8F1BBCDC;
|
||||
}
|
||||
else {
|
||||
f = b ^ c ^ d;
|
||||
k = 0xCA62C1D6;
|
||||
}
|
||||
var temp = (a << 5 | a >>> 27) + f + e + k + (this.block[i]|0);
|
||||
e = d;
|
||||
d = c;
|
||||
c = (b << 30 | b >>> 2);
|
||||
b = a;
|
||||
a = temp;
|
||||
}
|
||||
|
||||
// Add this chunk's hash to result so far:
|
||||
this.h0 = (this.h0 + a) | 0;
|
||||
this.h1 = (this.h1 + b) | 0;
|
||||
this.h2 = (this.h2 + c) | 0;
|
||||
this.h3 = (this.h3 + d) | 0;
|
||||
this.h4 = (this.h4 + e) | 0;
|
||||
|
||||
// The block is now reusable.
|
||||
this.offset = 0;
|
||||
for (i = 0; i < 16; i++) {
|
||||
this.block[i] = 0;
|
||||
}
|
||||
};
|
||||
239
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/browserSha256.js
generated
vendored
Normal file
239
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/browserSha256.js
generated
vendored
Normal file
@@ -0,0 +1,239 @@
|
||||
var Buffer = require('buffer/').Buffer;
|
||||
var hashUtils = require('./browserHashUtils');
|
||||
|
||||
var BLOCK_SIZE = 64;
|
||||
|
||||
var DIGEST_LENGTH = 32;
|
||||
|
||||
var KEY = new Uint32Array([
|
||||
0x428a2f98,
|
||||
0x71374491,
|
||||
0xb5c0fbcf,
|
||||
0xe9b5dba5,
|
||||
0x3956c25b,
|
||||
0x59f111f1,
|
||||
0x923f82a4,
|
||||
0xab1c5ed5,
|
||||
0xd807aa98,
|
||||
0x12835b01,
|
||||
0x243185be,
|
||||
0x550c7dc3,
|
||||
0x72be5d74,
|
||||
0x80deb1fe,
|
||||
0x9bdc06a7,
|
||||
0xc19bf174,
|
||||
0xe49b69c1,
|
||||
0xefbe4786,
|
||||
0x0fc19dc6,
|
||||
0x240ca1cc,
|
||||
0x2de92c6f,
|
||||
0x4a7484aa,
|
||||
0x5cb0a9dc,
|
||||
0x76f988da,
|
||||
0x983e5152,
|
||||
0xa831c66d,
|
||||
0xb00327c8,
|
||||
0xbf597fc7,
|
||||
0xc6e00bf3,
|
||||
0xd5a79147,
|
||||
0x06ca6351,
|
||||
0x14292967,
|
||||
0x27b70a85,
|
||||
0x2e1b2138,
|
||||
0x4d2c6dfc,
|
||||
0x53380d13,
|
||||
0x650a7354,
|
||||
0x766a0abb,
|
||||
0x81c2c92e,
|
||||
0x92722c85,
|
||||
0xa2bfe8a1,
|
||||
0xa81a664b,
|
||||
0xc24b8b70,
|
||||
0xc76c51a3,
|
||||
0xd192e819,
|
||||
0xd6990624,
|
||||
0xf40e3585,
|
||||
0x106aa070,
|
||||
0x19a4c116,
|
||||
0x1e376c08,
|
||||
0x2748774c,
|
||||
0x34b0bcb5,
|
||||
0x391c0cb3,
|
||||
0x4ed8aa4a,
|
||||
0x5b9cca4f,
|
||||
0x682e6ff3,
|
||||
0x748f82ee,
|
||||
0x78a5636f,
|
||||
0x84c87814,
|
||||
0x8cc70208,
|
||||
0x90befffa,
|
||||
0xa4506ceb,
|
||||
0xbef9a3f7,
|
||||
0xc67178f2
|
||||
]);
|
||||
|
||||
var INIT = [
|
||||
0x6a09e667,
|
||||
0xbb67ae85,
|
||||
0x3c6ef372,
|
||||
0xa54ff53a,
|
||||
0x510e527f,
|
||||
0x9b05688c,
|
||||
0x1f83d9ab,
|
||||
0x5be0cd19,
|
||||
];
|
||||
|
||||
var MAX_HASHABLE_LENGTH = Math.pow(2, 53) - 1;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
function Sha256() {
|
||||
this.state = [
|
||||
0x6a09e667,
|
||||
0xbb67ae85,
|
||||
0x3c6ef372,
|
||||
0xa54ff53a,
|
||||
0x510e527f,
|
||||
0x9b05688c,
|
||||
0x1f83d9ab,
|
||||
0x5be0cd19,
|
||||
];
|
||||
this.temp = new Int32Array(64);
|
||||
this.buffer = new Uint8Array(64);
|
||||
this.bufferLength = 0;
|
||||
this.bytesHashed = 0;
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
this.finished = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = exports = Sha256;
|
||||
|
||||
Sha256.BLOCK_SIZE = BLOCK_SIZE;
|
||||
|
||||
Sha256.prototype.update = function (data) {
|
||||
if (this.finished) {
|
||||
throw new Error('Attempted to update an already finished hash.');
|
||||
}
|
||||
|
||||
if (hashUtils.isEmptyData(data)) {
|
||||
return this;
|
||||
}
|
||||
|
||||
data = hashUtils.convertToBuffer(data);
|
||||
|
||||
var position = 0;
|
||||
var byteLength = data.byteLength;
|
||||
this.bytesHashed += byteLength;
|
||||
if (this.bytesHashed * 8 > MAX_HASHABLE_LENGTH) {
|
||||
throw new Error('Cannot hash more than 2^53 - 1 bits');
|
||||
}
|
||||
|
||||
while (byteLength > 0) {
|
||||
this.buffer[this.bufferLength++] = data[position++];
|
||||
byteLength--;
|
||||
if (this.bufferLength === BLOCK_SIZE) {
|
||||
this.hashBuffer();
|
||||
this.bufferLength = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
Sha256.prototype.digest = function (encoding) {
|
||||
if (!this.finished) {
|
||||
var bitsHashed = this.bytesHashed * 8;
|
||||
var bufferView = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength);
|
||||
var undecoratedLength = this.bufferLength;
|
||||
bufferView.setUint8(this.bufferLength++, 0x80);
|
||||
// Ensure the final block has enough room for the hashed length
|
||||
if (undecoratedLength % BLOCK_SIZE >= BLOCK_SIZE - 8) {
|
||||
for (var i = this.bufferLength; i < BLOCK_SIZE; i++) {
|
||||
bufferView.setUint8(i, 0);
|
||||
}
|
||||
this.hashBuffer();
|
||||
this.bufferLength = 0;
|
||||
}
|
||||
for (var i = this.bufferLength; i < BLOCK_SIZE - 8; i++) {
|
||||
bufferView.setUint8(i, 0);
|
||||
}
|
||||
bufferView.setUint32(BLOCK_SIZE - 8, Math.floor(bitsHashed / 0x100000000), true);
|
||||
bufferView.setUint32(BLOCK_SIZE - 4, bitsHashed);
|
||||
this.hashBuffer();
|
||||
this.finished = true;
|
||||
}
|
||||
// The value in state is little-endian rather than big-endian, so flip
|
||||
// each word into a new Uint8Array
|
||||
var out = new Buffer(DIGEST_LENGTH);
|
||||
for (var i = 0; i < 8; i++) {
|
||||
out[i * 4] = (this.state[i] >>> 24) & 0xff;
|
||||
out[i * 4 + 1] = (this.state[i] >>> 16) & 0xff;
|
||||
out[i * 4 + 2] = (this.state[i] >>> 8) & 0xff;
|
||||
out[i * 4 + 3] = (this.state[i] >>> 0) & 0xff;
|
||||
}
|
||||
return encoding ? out.toString(encoding) : out;
|
||||
};
|
||||
|
||||
Sha256.prototype.hashBuffer = function () {
|
||||
var _a = this,
|
||||
buffer = _a.buffer,
|
||||
state = _a.state;
|
||||
var state0 = state[0],
|
||||
state1 = state[1],
|
||||
state2 = state[2],
|
||||
state3 = state[3],
|
||||
state4 = state[4],
|
||||
state5 = state[5],
|
||||
state6 = state[6],
|
||||
state7 = state[7];
|
||||
for (var i = 0; i < BLOCK_SIZE; i++) {
|
||||
if (i < 16) {
|
||||
this.temp[i] = (((buffer[i * 4] & 0xff) << 24) |
|
||||
((buffer[(i * 4) + 1] & 0xff) << 16) |
|
||||
((buffer[(i * 4) + 2] & 0xff) << 8) |
|
||||
(buffer[(i * 4) + 3] & 0xff));
|
||||
}
|
||||
else {
|
||||
var u = this.temp[i - 2];
|
||||
var t1_1 = (u >>> 17 | u << 15) ^
|
||||
(u >>> 19 | u << 13) ^
|
||||
(u >>> 10);
|
||||
u = this.temp[i - 15];
|
||||
var t2_1 = (u >>> 7 | u << 25) ^
|
||||
(u >>> 18 | u << 14) ^
|
||||
(u >>> 3);
|
||||
this.temp[i] = (t1_1 + this.temp[i - 7] | 0) +
|
||||
(t2_1 + this.temp[i - 16] | 0);
|
||||
}
|
||||
var t1 = (((((state4 >>> 6 | state4 << 26) ^
|
||||
(state4 >>> 11 | state4 << 21) ^
|
||||
(state4 >>> 25 | state4 << 7))
|
||||
+ ((state4 & state5) ^ (~state4 & state6))) | 0)
|
||||
+ ((state7 + ((KEY[i] + this.temp[i]) | 0)) | 0)) | 0;
|
||||
var t2 = (((state0 >>> 2 | state0 << 30) ^
|
||||
(state0 >>> 13 | state0 << 19) ^
|
||||
(state0 >>> 22 | state0 << 10)) + ((state0 & state1) ^ (state0 & state2) ^ (state1 & state2))) | 0;
|
||||
state7 = state6;
|
||||
state6 = state5;
|
||||
state5 = state4;
|
||||
state4 = (state3 + t1) | 0;
|
||||
state3 = state2;
|
||||
state2 = state1;
|
||||
state1 = state0;
|
||||
state0 = (t1 + t2) | 0;
|
||||
}
|
||||
state[0] += state0;
|
||||
state[1] += state1;
|
||||
state[2] += state2;
|
||||
state[3] += state3;
|
||||
state[4] += state4;
|
||||
state[5] += state5;
|
||||
state[6] += state6;
|
||||
state[7] += state7;
|
||||
};
|
||||
39
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/browser_loader.js
generated
vendored
Normal file
39
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/browser_loader.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
var util = require('./util');
|
||||
|
||||
// browser specific modules
|
||||
util.crypto.lib = require('./browserCryptoLib');
|
||||
util.Buffer = require('buffer/').Buffer;
|
||||
util.url = require('url/');
|
||||
util.querystring = require('querystring/');
|
||||
util.realClock = require('./realclock/browserClock');
|
||||
util.environment = 'js';
|
||||
util.createEventStream = require('./event-stream/buffered-create-event-stream').createEventStream;
|
||||
util.isBrowser = function() { return true; };
|
||||
util.isNode = function() { return false; };
|
||||
|
||||
var AWS = require('./core');
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = AWS;
|
||||
|
||||
require('./credentials');
|
||||
require('./credentials/credential_provider_chain');
|
||||
require('./credentials/temporary_credentials');
|
||||
require('./credentials/chainable_temporary_credentials');
|
||||
require('./credentials/web_identity_credentials');
|
||||
require('./credentials/cognito_identity_credentials');
|
||||
require('./credentials/saml_credentials');
|
||||
|
||||
// Load the DOMParser XML parser
|
||||
AWS.XML.Parser = require('./xml/browser_parser');
|
||||
|
||||
// Load the XHR HttpClient
|
||||
require('./http/xhr');
|
||||
|
||||
if (typeof process === 'undefined') {
|
||||
var process = {
|
||||
browser: true
|
||||
};
|
||||
}
|
||||
67
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/cloudfront/signer.d.ts
generated
vendored
Normal file
67
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/cloudfront/signer.d.ts
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
export class Signer {
|
||||
/**
|
||||
* A signer object can be used to generate signed URLs and cookies for granting access to content on restricted CloudFront distributions.
|
||||
*
|
||||
* @param {string} keyPairId - The ID of the CloudFront key pair being used.
|
||||
* @param {string} privateKey - A private key in RSA format.
|
||||
*/
|
||||
constructor(keyPairId: string, privateKey: string);
|
||||
|
||||
/**
|
||||
* Create a signed Amazon CloudFront Cookie.
|
||||
*/
|
||||
getSignedCookie(options: Signer.SignerOptionsWithPolicy): Signer.CustomPolicy;
|
||||
/**
|
||||
* Create a signed Amazon CloudFront Cookie.
|
||||
*/
|
||||
getSignedCookie(options: Signer.SignerOptionsWithoutPolicy): Signer.CannedPolicy;
|
||||
/**
|
||||
* Create a signed Amazon CloudFront Cookie.
|
||||
*/
|
||||
getSignedCookie(options: Signer.SignerOptionsWithPolicy, callback: (err: Error, cookie: Signer.CustomPolicy) => void): void;
|
||||
/**
|
||||
* Create a signed Amazon CloudFront Cookie.
|
||||
*/
|
||||
getSignedCookie(options: Signer.SignerOptionsWithoutPolicy, callback: (err: Error, cookie: Signer.CannedPolicy) => void): void;
|
||||
/**
|
||||
* Create a signed Amazon CloudFront URL.
|
||||
* Keep in mind that URLs meant for use in media/flash players may have different requirements for URL formats (e.g. some require that the extension be removed, some require the file name to be prefixed - mp4:, some require you to add "/cfx/st" into your URL).
|
||||
*/
|
||||
getSignedUrl(options: Signer.SignerOptionsWithPolicy | Signer.SignerOptionsWithoutPolicy): string;
|
||||
/**
|
||||
* Create a signed Amazon CloudFront URL.
|
||||
* Keep in mind that URLs meant for use in media/flash players may have different requirements for URL formats (e.g. some require that the extension be removed, some require the file name to be prefixed - mp4:, some require you to add "/cfx/st" into your URL).
|
||||
*/
|
||||
getSignedUrl(options: Signer.SignerOptionsWithPolicy| Signer.SignerOptionsWithoutPolicy, callback: (err: Error, url: string) => void): void;
|
||||
}
|
||||
|
||||
declare namespace Signer {
|
||||
export interface SignerOptionsWithPolicy {
|
||||
/**
|
||||
* A CloudFront JSON policy. Required unless you pass in a url and an expiry time.
|
||||
*/
|
||||
policy: string;
|
||||
}
|
||||
export interface SignerOptionsWithoutPolicy {
|
||||
/**
|
||||
* The URL to which the signature will grant access. Required unless you pass in a full policy.
|
||||
*/
|
||||
url: string
|
||||
/**
|
||||
* A Unix UTC timestamp indicating when the signature should expire. Required unless you pass in a full policy.
|
||||
*/
|
||||
expires: number
|
||||
}
|
||||
|
||||
export interface CustomPolicy {
|
||||
"CloudFront-Policy": string;
|
||||
"CloudFront-Key-Pair-Id": string;
|
||||
"CloudFront-Signature": string;
|
||||
}
|
||||
|
||||
export interface CannedPolicy {
|
||||
"CloudFront-Expires": number;
|
||||
"CloudFront-Key-Pair-Id": string;
|
||||
"CloudFront-Signature": string;
|
||||
}
|
||||
}
|
||||
210
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/cloudfront/signer.js
generated
vendored
Normal file
210
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/cloudfront/signer.js
generated
vendored
Normal file
@@ -0,0 +1,210 @@
|
||||
var AWS = require('../core'),
|
||||
url = AWS.util.url,
|
||||
crypto = AWS.util.crypto.lib,
|
||||
base64Encode = AWS.util.base64.encode,
|
||||
inherit = AWS.util.inherit;
|
||||
|
||||
var queryEncode = function (string) {
|
||||
var replacements = {
|
||||
'+': '-',
|
||||
'=': '_',
|
||||
'/': '~'
|
||||
};
|
||||
return string.replace(/[\+=\/]/g, function (match) {
|
||||
return replacements[match];
|
||||
});
|
||||
};
|
||||
|
||||
var signPolicy = function (policy, privateKey) {
|
||||
var sign = crypto.createSign('RSA-SHA1');
|
||||
sign.write(policy);
|
||||
return queryEncode(sign.sign(privateKey, 'base64'));
|
||||
};
|
||||
|
||||
var signWithCannedPolicy = function (url, expires, keyPairId, privateKey) {
|
||||
var policy = JSON.stringify({
|
||||
Statement: [
|
||||
{
|
||||
Resource: url,
|
||||
Condition: { DateLessThan: { 'AWS:EpochTime': expires } }
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
return {
|
||||
Expires: expires,
|
||||
'Key-Pair-Id': keyPairId,
|
||||
Signature: signPolicy(policy.toString(), privateKey)
|
||||
};
|
||||
};
|
||||
|
||||
var signWithCustomPolicy = function (policy, keyPairId, privateKey) {
|
||||
policy = policy.replace(/\s/mg, '');
|
||||
|
||||
return {
|
||||
Policy: queryEncode(base64Encode(policy)),
|
||||
'Key-Pair-Id': keyPairId,
|
||||
Signature: signPolicy(policy, privateKey)
|
||||
};
|
||||
};
|
||||
|
||||
var determineScheme = function (url) {
|
||||
var parts = url.split('://');
|
||||
if (parts.length < 2) {
|
||||
throw new Error('Invalid URL.');
|
||||
}
|
||||
|
||||
return parts[0].replace('*', '');
|
||||
};
|
||||
|
||||
var getRtmpUrl = function (rtmpUrl) {
|
||||
var parsed = url.parse(rtmpUrl);
|
||||
return parsed.path.replace(/^\//, '') + (parsed.hash || '');
|
||||
};
|
||||
|
||||
var getResource = function (url) {
|
||||
switch (determineScheme(url)) {
|
||||
case 'http':
|
||||
case 'https':
|
||||
return url;
|
||||
case 'rtmp':
|
||||
return getRtmpUrl(url);
|
||||
default:
|
||||
throw new Error('Invalid URI scheme. Scheme must be one of'
|
||||
+ ' http, https, or rtmp');
|
||||
}
|
||||
};
|
||||
|
||||
var handleError = function (err, callback) {
|
||||
if (!callback || typeof callback !== 'function') {
|
||||
throw err;
|
||||
}
|
||||
|
||||
callback(err);
|
||||
};
|
||||
|
||||
var handleSuccess = function (result, callback) {
|
||||
if (!callback || typeof callback !== 'function') {
|
||||
return result;
|
||||
}
|
||||
|
||||
callback(null, result);
|
||||
};
|
||||
|
||||
AWS.CloudFront.Signer = inherit({
|
||||
/**
|
||||
* A signer object can be used to generate signed URLs and cookies for granting
|
||||
* access to content on restricted CloudFront distributions.
|
||||
*
|
||||
* @see http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html
|
||||
*
|
||||
* @param keyPairId [String] (Required) The ID of the CloudFront key pair
|
||||
* being used.
|
||||
* @param privateKey [String] (Required) A private key in RSA format.
|
||||
*/
|
||||
constructor: function Signer(keyPairId, privateKey) {
|
||||
if (keyPairId === void 0 || privateKey === void 0) {
|
||||
throw new Error('A key pair ID and private key are required');
|
||||
}
|
||||
|
||||
this.keyPairId = keyPairId;
|
||||
this.privateKey = privateKey;
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a signed Amazon CloudFront Cookie.
|
||||
*
|
||||
* @param options [Object] The options to create a signed cookie.
|
||||
* @option options url [String] The URL to which the signature will grant
|
||||
* access. Required unless you pass in a full
|
||||
* policy.
|
||||
* @option options expires [Number] A Unix UTC timestamp indicating when the
|
||||
* signature should expire. Required unless you
|
||||
* pass in a full policy.
|
||||
* @option options policy [String] A CloudFront JSON policy. Required unless
|
||||
* you pass in a url and an expiry time.
|
||||
*
|
||||
* @param cb [Function] if a callback is provided, this function will
|
||||
* pass the hash as the second parameter (after the error parameter) to
|
||||
* the callback function.
|
||||
*
|
||||
* @return [Object] if called synchronously (with no callback), returns the
|
||||
* signed cookie parameters.
|
||||
* @return [null] nothing is returned if a callback is provided.
|
||||
*/
|
||||
getSignedCookie: function (options, cb) {
|
||||
var signatureHash = 'policy' in options
|
||||
? signWithCustomPolicy(options.policy, this.keyPairId, this.privateKey)
|
||||
: signWithCannedPolicy(options.url, options.expires, this.keyPairId, this.privateKey);
|
||||
|
||||
var cookieHash = {};
|
||||
for (var key in signatureHash) {
|
||||
if (Object.prototype.hasOwnProperty.call(signatureHash, key)) {
|
||||
cookieHash['CloudFront-' + key] = signatureHash[key];
|
||||
}
|
||||
}
|
||||
|
||||
return handleSuccess(cookieHash, cb);
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a signed Amazon CloudFront URL.
|
||||
*
|
||||
* Keep in mind that URLs meant for use in media/flash players may have
|
||||
* different requirements for URL formats (e.g. some require that the
|
||||
* extension be removed, some require the file name to be prefixed
|
||||
* - mp4:<path>, some require you to add "/cfx/st" into your URL).
|
||||
*
|
||||
* @param options [Object] The options to create a signed URL.
|
||||
* @option options url [String] The URL to which the signature will grant
|
||||
* access. Any query params included with
|
||||
* the URL should be encoded. Required.
|
||||
* @option options expires [Number] A Unix UTC timestamp indicating when the
|
||||
* signature should expire. Required unless you
|
||||
* pass in a full policy.
|
||||
* @option options policy [String] A CloudFront JSON policy. Required unless
|
||||
* you pass in a url and an expiry time.
|
||||
*
|
||||
* @param cb [Function] if a callback is provided, this function will
|
||||
* pass the URL as the second parameter (after the error parameter) to
|
||||
* the callback function.
|
||||
*
|
||||
* @return [String] if called synchronously (with no callback), returns the
|
||||
* signed URL.
|
||||
* @return [null] nothing is returned if a callback is provided.
|
||||
*/
|
||||
getSignedUrl: function (options, cb) {
|
||||
try {
|
||||
var resource = getResource(options.url);
|
||||
} catch (err) {
|
||||
return handleError(err, cb);
|
||||
}
|
||||
|
||||
var parsedUrl = url.parse(options.url, true),
|
||||
signatureHash = Object.prototype.hasOwnProperty.call(options, 'policy')
|
||||
? signWithCustomPolicy(options.policy, this.keyPairId, this.privateKey)
|
||||
: signWithCannedPolicy(resource, options.expires, this.keyPairId, this.privateKey);
|
||||
|
||||
parsedUrl.search = null;
|
||||
for (var key in signatureHash) {
|
||||
if (Object.prototype.hasOwnProperty.call(signatureHash, key)) {
|
||||
parsedUrl.query[key] = signatureHash[key];
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
var signedUrl = determineScheme(options.url) === 'rtmp'
|
||||
? getRtmpUrl(url.format(parsedUrl))
|
||||
: url.format(parsedUrl);
|
||||
} catch (err) {
|
||||
return handleError(err, cb);
|
||||
}
|
||||
|
||||
return handleSuccess(signedUrl, cb);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = AWS.CloudFront.Signer;
|
||||
293
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/config-base.d.ts
generated
vendored
Normal file
293
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/config-base.d.ts
generated
vendored
Normal file
@@ -0,0 +1,293 @@
|
||||
import {Agent as httpAgent} from 'http';
|
||||
import {Agent as httpsAgent} from 'https';
|
||||
import {AWSError} from './error';
|
||||
import {Credentials, CredentialsOptions} from './credentials';
|
||||
import {CredentialProviderChain} from './credentials/credential_provider_chain';
|
||||
import {Token} from './token';
|
||||
import {TokenProviderChain} from './token/token_provider_chain';
|
||||
|
||||
export class ConfigBase extends ConfigurationOptions{
|
||||
constructor(options?: ConfigurationOptions);
|
||||
/**
|
||||
* Loads credentials from the configuration object.
|
||||
*/
|
||||
getCredentials(callback: (err: AWSError|null, credentials: Credentials|CredentialsOptions|null) => void): void;
|
||||
/**
|
||||
* Loads token from the token object.
|
||||
*/
|
||||
getToken(callback: (err: AWSError|null, token: Token|null) => void): void;
|
||||
/**
|
||||
* Loads configuration data from a JSON file into this config object.
|
||||
* Loading configuration will reset all existing configuration on the object.
|
||||
* This feature is not supported in the browser environment of the SDK.
|
||||
*
|
||||
* @param {string} path - the path relative to your process's current working directory to load configuration from.
|
||||
*/
|
||||
loadFromPath(path: string): ConfigBase;
|
||||
/**
|
||||
* Updates the current configuration object with new options.
|
||||
*
|
||||
* @param {ConfigurationOptions} options - a map of option keys and values.
|
||||
* @param {boolean} allowUnknownKeys - Whether unknown keys can be set on the configuration object.
|
||||
*/
|
||||
update(options: ConfigurationOptions & {[key: string]: any}, allowUnknownKeys: true): void;
|
||||
/**
|
||||
* Updates the current configuration object with new options.
|
||||
*
|
||||
* @param {ConfigurationOptions} options - a map of option keys and values.
|
||||
* @param {boolean} allowUnknownKeys - Defaults to false. Whether unknown keys can be set on the configuration object.
|
||||
*/
|
||||
update(options: ConfigurationOptions, allowUnknownKeys?: false): void;
|
||||
/**
|
||||
* Gets the promise dependency the SDK will use wherever Promises are returned.
|
||||
*/
|
||||
getPromisesDependency(): typeof Promise | void;
|
||||
/**
|
||||
* Sets the promise dependency the SDK will use wherever Promises are returned.
|
||||
* @param {function} dep - a reference to a Promise constructor
|
||||
*/
|
||||
setPromisesDependency(dep: any): void;
|
||||
}
|
||||
|
||||
export interface HTTPOptions {
|
||||
/**
|
||||
* the URL to proxy requests through.
|
||||
*/
|
||||
proxy?: string;
|
||||
/**
|
||||
* the Agent object to perform HTTP requests with.
|
||||
* Used for connection pooling.
|
||||
* Defaults to the global agent (http.globalAgent) for non-SSL connections.
|
||||
*/
|
||||
agent?: httpAgent | httpsAgent;
|
||||
/**
|
||||
* The maximum time in milliseconds that the connection phase of the request
|
||||
* should be allowed to take. This only limits the connection phase and has
|
||||
* no impact once the socket has established a connection.
|
||||
* Used in node.js environments only.
|
||||
*/
|
||||
connectTimeout?: number;
|
||||
/**
|
||||
* The number of milliseconds a request can take before automatically being terminated.
|
||||
* Defaults to two minutes (120000).
|
||||
*/
|
||||
timeout?: number;
|
||||
/**
|
||||
* Whether the SDK will send asynchronous HTTP requests.
|
||||
* Used in the browser environment only.
|
||||
* Set to false to send requests synchronously.
|
||||
* Defaults to true (async on).
|
||||
*/
|
||||
xhrAsync?: boolean;
|
||||
/**
|
||||
* Sets the 'withCredentials' property of an XMLHttpRequest object.
|
||||
* Used in the browser environment only.
|
||||
* Defaults to false.
|
||||
*/
|
||||
xhrWithCredentials?: boolean;
|
||||
}
|
||||
export interface Logger {
|
||||
write?: (chunk: any, encoding?: string, callback?: () => void) => void
|
||||
log?: (...messages: any[]) => void;
|
||||
warn?: (...message: any[]) => void;
|
||||
}
|
||||
export interface ParamValidation {
|
||||
/**
|
||||
* Validates that a value meets the min constraint.
|
||||
* This is enabled by default when paramValidation is set to true.
|
||||
*/
|
||||
min?: boolean
|
||||
/**
|
||||
* Validates that a value meets the max constraint.
|
||||
*/
|
||||
max?: boolean
|
||||
/**
|
||||
* Validates that a string value matches a regular expression.
|
||||
*/
|
||||
pattern?: boolean
|
||||
/**
|
||||
* Validates that a string value matches one of the allowable enum values.
|
||||
*/
|
||||
enum?: boolean
|
||||
}
|
||||
export interface RetryDelayOptions {
|
||||
/**
|
||||
* The base number of milliseconds to use in the exponential backoff for operation retries.
|
||||
* Defaults to 100 ms.
|
||||
*/
|
||||
base?: number
|
||||
/**
|
||||
* A custom function that accepts a retry count and error and returns the amount of time to delay in milliseconds. If the result is a non-zero negative value, no further retry attempts will be made.
|
||||
* The base option will be ignored if this option is supplied.
|
||||
*/
|
||||
customBackoff?: (retryCount: number, err?: Error) => number
|
||||
}
|
||||
|
||||
/**
|
||||
* Common configuration entries to construct a service client.
|
||||
*/
|
||||
export abstract class ConfigurationOptions {
|
||||
|
||||
/**
|
||||
* Whether to compute checksums for payload bodies when the service accepts it.
|
||||
* Currently supported in S3 only.
|
||||
*/
|
||||
computeChecksums?: boolean
|
||||
/**
|
||||
* Whether types are converted when parsing response data.
|
||||
*/
|
||||
convertResponseTypes?: boolean
|
||||
/**
|
||||
* Whether to apply a clock skew correction and retry requests that fail because of an skewed client clock.
|
||||
*/
|
||||
correctClockSkew?: boolean
|
||||
/**
|
||||
* Sets a custom User-Agent string.
|
||||
* In node environments this will set the User-Agent header, but
|
||||
* browser environments this will set the X-Amz-User-Agent header.
|
||||
*/
|
||||
customUserAgent?: string
|
||||
/**
|
||||
* The AWS credentials to sign requests with.
|
||||
*/
|
||||
credentials?: Credentials|CredentialsOptions|null
|
||||
/**
|
||||
* The provider chain used to resolve credentials if no static credentials property is set.
|
||||
*/
|
||||
credentialProvider?: CredentialProviderChain
|
||||
/**
|
||||
* The Token to authenticate requests with.
|
||||
*/
|
||||
token?: Token|null
|
||||
/**
|
||||
* The provider chain used to resolve token if no static token property is set.
|
||||
*/
|
||||
tokenProvider?: TokenProviderChain
|
||||
/**
|
||||
* AWS access key ID.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
accessKeyId?: string
|
||||
/**
|
||||
* AWS secret access key.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
secretAccessKey?: string
|
||||
/**
|
||||
* AWS session token.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
sessionToken?: string
|
||||
/**
|
||||
* A set of options to pass to the low-level HTTP request.
|
||||
*/
|
||||
httpOptions?: HTTPOptions
|
||||
/**
|
||||
* An object that responds to .write() (like a stream) or .log() (like the console object) in order to log information about requests.
|
||||
*/
|
||||
logger?: Logger
|
||||
/**
|
||||
* The maximum amount of redirects to follow for a service request.
|
||||
*/
|
||||
maxRedirects?: number
|
||||
/**
|
||||
* The maximum amount of retries to perform for a service request.
|
||||
*/
|
||||
maxRetries?: number
|
||||
/**
|
||||
* Returns whether input parameters should be validated against the operation description before sending the request.
|
||||
* Defaults to true.
|
||||
* Pass a map to enable any of the following specific validation features: min|max|pattern|enum
|
||||
*/
|
||||
paramValidation?: ParamValidation|boolean
|
||||
/**
|
||||
* The region to send service requests to.
|
||||
*/
|
||||
region?: string
|
||||
/**
|
||||
* Returns A set of options to configure the retry delay on retryable errors.
|
||||
*/
|
||||
retryDelayOptions?: RetryDelayOptions
|
||||
/**
|
||||
* Whether the provided endpoint addresses an individual bucket.
|
||||
* false if it addresses the root API endpoint.
|
||||
*/
|
||||
s3BucketEndpoint?: boolean
|
||||
/**
|
||||
* Whether to disable S3 body signing when using signature version v4.
|
||||
*/
|
||||
s3DisableBodySigning?: boolean
|
||||
/**
|
||||
* Whether to force path style URLs for S3 objects.
|
||||
*/
|
||||
s3ForcePathStyle?: boolean
|
||||
/**
|
||||
* When region is set to 'us-east-1', whether to send s3 request to global endpoints
|
||||
* or 'us-east-1' regional endpoints. This config is only applicable to S3 client;
|
||||
* Defaults to 'legacy'
|
||||
*/
|
||||
s3UsEast1RegionalEndpoint?: "regional"|"legacy"
|
||||
/**
|
||||
* Whether to override the request region with the region inferred
|
||||
* from requested resource's ARN. Only available for S3 buckets
|
||||
* Defaults to `true`
|
||||
*/
|
||||
s3UseArnRegion?: boolean
|
||||
/**
|
||||
* Whether the signature to sign requests with (overriding the API configuration) is cached.
|
||||
*/
|
||||
signatureCache?: boolean
|
||||
/**
|
||||
* The signature version to sign requests with (overriding the API configuration).
|
||||
* Possible values: 'v2'|'v3'|'v4'
|
||||
*/
|
||||
signatureVersion?: "v2"|"v3"|"v4"|string
|
||||
/**
|
||||
* Whether SSL is enabled for requests.
|
||||
*/
|
||||
sslEnabled?: boolean
|
||||
/**
|
||||
* An offset value in milliseconds to apply to all signing times.
|
||||
*/
|
||||
systemClockOffset?: number
|
||||
/**
|
||||
* Whether to use the Accelerate endpoint with the S3 service.
|
||||
*/
|
||||
useAccelerateEndpoint?: boolean
|
||||
/**
|
||||
* Whether to validate the CRC32 checksum of HTTP response bodies returned
|
||||
* by DynamoDB.
|
||||
*/
|
||||
dynamoDbCrc32?: boolean;
|
||||
/**
|
||||
* Whether to enable endpoint discovery for operations that allow optionally using an endpoint returned by
|
||||
* the service.
|
||||
*/
|
||||
endpointDiscoveryEnabled?: boolean;
|
||||
/**
|
||||
* The size of the global cache storing endpoints from endpoint
|
||||
* discovery operations. Once endpoint cache is created, updating this setting
|
||||
* cannot change existing cache size.
|
||||
*/
|
||||
endpointCacheSize?: number;
|
||||
/**
|
||||
* Whether to marshal request parameters to the prefix of hostname.
|
||||
*/
|
||||
hostPrefixEnabled?: boolean;
|
||||
/**
|
||||
* Whether to send sts request to global endpoints or
|
||||
* regional endpoints.
|
||||
*/
|
||||
stsRegionalEndpoints?: "legacy"|"regional";
|
||||
/**
|
||||
* Enables FIPS compatible endpoints.
|
||||
*/
|
||||
useFipsEndpoint?: boolean;
|
||||
/**
|
||||
* Enables IPv6 dualstack endpoint.
|
||||
*/
|
||||
useDualstackEndpoint?: boolean;
|
||||
}
|
||||
49
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/config.d.ts
generated
vendored
Normal file
49
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/config.d.ts
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
import {ConfigurationServicePlaceholders, ConfigurationServiceApiVersions} from './config_service_placeholders';
|
||||
import {ConfigBase, ConfigurationOptions} from './config-base';
|
||||
|
||||
export class Config extends ConfigBase {
|
||||
/**
|
||||
* Creates a new configuration object.
|
||||
* This is the object that passes option data along to service requests, including credentials, security, region information, and some service specific settings.
|
||||
*/
|
||||
constructor(options?: ConfigurationOptions & ConfigurationServicePlaceholders & APIVersions);
|
||||
/**
|
||||
* Loads configuration data from a JSON file into this config object.
|
||||
* Loading configuration will reset all existing configuration on the object.
|
||||
* This feature is not supported in the browser environment of the SDK.
|
||||
*
|
||||
* @param {string} path - the path relative to your process's current working directory to load configuration from.
|
||||
*/
|
||||
loadFromPath(path: string): Config & ConfigurationServicePlaceholders & APIVersions;
|
||||
/**
|
||||
* Updates the current configuration object with new options.
|
||||
*
|
||||
* @param {ConfigurationOptions} options - a map of option keys and values.
|
||||
* @param {boolean} allowUnknownKeys - Whether unknown keys can be set on the configuration object.
|
||||
*/
|
||||
update(options: ConfigurationOptions & ConfigurationServicePlaceholders & APIVersions & {[key: string]: any}, allowUnknownKeys: true): void;
|
||||
/**
|
||||
* Updates the current configuration object with new options.
|
||||
*
|
||||
* @param {ConfigurationOptions} options - a map of option keys and values.
|
||||
* @param {boolean} allowUnknownKeys - Defaults to false. Whether unknown keys can be set on the configuration object.
|
||||
*/
|
||||
update(options: ConfigurationOptions & ConfigurationServicePlaceholders & APIVersions, allowUnknownKeys?: false): void;
|
||||
}
|
||||
|
||||
export type GlobalConfigInstance = Config & ConfigurationServicePlaceholders & APIVersions;
|
||||
|
||||
|
||||
export interface APIVersions {
|
||||
/**
|
||||
* A string in YYYY-MM-DD format that represents the latest possible API version that can be used in all services (unless overridden by apiVersions). Specify \'latest\' to use the latest possible version.
|
||||
*/
|
||||
apiVersion?: "latest"|string;
|
||||
/**
|
||||
* A map of service identifiers (the lowercase service class name) with the API version to use when instantiating a service. Specify 'latest' for each individual that can use the latest available version.
|
||||
*/
|
||||
apiVersions?: ConfigurationServiceApiVersions;
|
||||
}
|
||||
|
||||
// for backwards compatible client generation
|
||||
export { ConfigBase } from "./config-base";
|
||||
707
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/config.js
generated
vendored
Normal file
707
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/config.js
generated
vendored
Normal file
@@ -0,0 +1,707 @@
|
||||
var AWS = require('./core');
|
||||
require('./credentials');
|
||||
require('./credentials/credential_provider_chain');
|
||||
var PromisesDependency;
|
||||
|
||||
/**
|
||||
* The main configuration class used by all service objects to set
|
||||
* the region, credentials, and other options for requests.
|
||||
*
|
||||
* By default, credentials and region settings are left unconfigured.
|
||||
* This should be configured by the application before using any
|
||||
* AWS service APIs.
|
||||
*
|
||||
* In order to set global configuration options, properties should
|
||||
* be assigned to the global {AWS.config} object.
|
||||
*
|
||||
* @see AWS.config
|
||||
*
|
||||
* @!group General Configuration Options
|
||||
*
|
||||
* @!attribute credentials
|
||||
* @return [AWS.Credentials] the AWS credentials to sign requests with.
|
||||
*
|
||||
* @!attribute region
|
||||
* @example Set the global region setting to us-west-2
|
||||
* AWS.config.update({region: 'us-west-2'});
|
||||
* @return [AWS.Credentials] The region to send service requests to.
|
||||
* @see http://docs.amazonwebservices.com/general/latest/gr/rande.html
|
||||
* A list of available endpoints for each AWS service
|
||||
*
|
||||
* @!attribute maxRetries
|
||||
* @return [Integer] the maximum amount of retries to perform for a
|
||||
* service request. By default this value is calculated by the specific
|
||||
* service object that the request is being made to.
|
||||
*
|
||||
* @!attribute maxRedirects
|
||||
* @return [Integer] the maximum amount of redirects to follow for a
|
||||
* service request. Defaults to 10.
|
||||
*
|
||||
* @!attribute paramValidation
|
||||
* @return [Boolean|map] whether input parameters should be validated against
|
||||
* the operation description before sending the request. Defaults to true.
|
||||
* Pass a map to enable any of the following specific validation features:
|
||||
*
|
||||
* * **min** [Boolean] — Validates that a value meets the min
|
||||
* constraint. This is enabled by default when paramValidation is set
|
||||
* to `true`.
|
||||
* * **max** [Boolean] — Validates that a value meets the max
|
||||
* constraint.
|
||||
* * **pattern** [Boolean] — Validates that a string value matches a
|
||||
* regular expression.
|
||||
* * **enum** [Boolean] — Validates that a string value matches one
|
||||
* of the allowable enum values.
|
||||
*
|
||||
* @!attribute computeChecksums
|
||||
* @return [Boolean] whether to compute checksums for payload bodies when
|
||||
* the service accepts it (currently supported in S3 and SQS only).
|
||||
*
|
||||
* @!attribute convertResponseTypes
|
||||
* @return [Boolean] whether types are converted when parsing response data.
|
||||
* Currently only supported for JSON based services. Turning this off may
|
||||
* improve performance on large response payloads. Defaults to `true`.
|
||||
*
|
||||
* @!attribute correctClockSkew
|
||||
* @return [Boolean] whether to apply a clock skew correction and retry
|
||||
* requests that fail because of an skewed client clock. Defaults to
|
||||
* `false`.
|
||||
*
|
||||
* @!attribute sslEnabled
|
||||
* @return [Boolean] whether SSL is enabled for requests
|
||||
*
|
||||
* @!attribute s3ForcePathStyle
|
||||
* @return [Boolean] whether to force path style URLs for S3 objects
|
||||
*
|
||||
* @!attribute s3BucketEndpoint
|
||||
* @note Setting this configuration option requires an `endpoint` to be
|
||||
* provided explicitly to the service constructor.
|
||||
* @return [Boolean] whether the provided endpoint addresses an individual
|
||||
* bucket (false if it addresses the root API endpoint).
|
||||
*
|
||||
* @!attribute s3DisableBodySigning
|
||||
* @return [Boolean] whether to disable S3 body signing when using signature version `v4`.
|
||||
* Body signing can only be disabled when using https. Defaults to `true`.
|
||||
*
|
||||
* @!attribute s3UsEast1RegionalEndpoint
|
||||
* @return ['legacy'|'regional'] when region is set to 'us-east-1', whether to send s3
|
||||
* request to global endpoints or 'us-east-1' regional endpoints. This config is only
|
||||
* applicable to S3 client;
|
||||
* Defaults to 'legacy'
|
||||
* @!attribute s3UseArnRegion
|
||||
* @return [Boolean] whether to override the request region with the region inferred
|
||||
* from requested resource's ARN. Only available for S3 buckets
|
||||
* Defaults to `true`
|
||||
*
|
||||
* @!attribute useAccelerateEndpoint
|
||||
* @note This configuration option is only compatible with S3 while accessing
|
||||
* dns-compatible buckets.
|
||||
* @return [Boolean] Whether to use the Accelerate endpoint with the S3 service.
|
||||
* Defaults to `false`.
|
||||
*
|
||||
* @!attribute retryDelayOptions
|
||||
* @example Set the base retry delay for all services to 300 ms
|
||||
* AWS.config.update({retryDelayOptions: {base: 300}});
|
||||
* // Delays with maxRetries = 3: 300, 600, 1200
|
||||
* @example Set a custom backoff function to provide delay values on retries
|
||||
* AWS.config.update({retryDelayOptions: {customBackoff: function(retryCount, err) {
|
||||
* // returns delay in ms
|
||||
* }}});
|
||||
* @return [map] A set of options to configure the retry delay on retryable errors.
|
||||
* Currently supported options are:
|
||||
*
|
||||
* * **base** [Integer] — The base number of milliseconds to use in the
|
||||
* exponential backoff for operation retries. Defaults to 100 ms for all services except
|
||||
* DynamoDB, where it defaults to 50ms.
|
||||
*
|
||||
* * **customBackoff ** [function] — A custom function that accepts a
|
||||
* retry count and error and returns the amount of time to delay in
|
||||
* milliseconds. If the result is a non-zero negative value, no further
|
||||
* retry attempts will be made. The `base` option will be ignored if this
|
||||
* option is supplied. The function is only called for retryable errors.
|
||||
*
|
||||
* @!attribute httpOptions
|
||||
* @return [map] A set of options to pass to the low-level HTTP request.
|
||||
* Currently supported options are:
|
||||
*
|
||||
* * **proxy** [String] — the URL to proxy requests through
|
||||
* * **agent** [http.Agent, https.Agent] — the Agent object to perform
|
||||
* HTTP requests with. Used for connection pooling. Note that for
|
||||
* SSL connections, a special Agent object is used in order to enable
|
||||
* peer certificate verification. This feature is only supported in the
|
||||
* Node.js environment.
|
||||
* * **connectTimeout** [Integer] — Sets the socket to timeout after
|
||||
* failing to establish a connection with the server after
|
||||
* `connectTimeout` milliseconds. This timeout has no effect once a socket
|
||||
* connection has been established.
|
||||
* * **timeout** [Integer] — The number of milliseconds a request can
|
||||
* take before automatically being terminated.
|
||||
* Defaults to two minutes (120000).
|
||||
* * **xhrAsync** [Boolean] — Whether the SDK will send asynchronous
|
||||
* HTTP requests. Used in the browser environment only. Set to false to
|
||||
* send requests synchronously. Defaults to true (async on).
|
||||
* * **xhrWithCredentials** [Boolean] — Sets the "withCredentials"
|
||||
* property of an XMLHttpRequest object. Used in the browser environment
|
||||
* only. Defaults to false.
|
||||
* @!attribute logger
|
||||
* @return [#write,#log] an object that responds to .write() (like a stream)
|
||||
* or .log() (like the console object) in order to log information about
|
||||
* requests
|
||||
*
|
||||
* @!attribute systemClockOffset
|
||||
* @return [Number] an offset value in milliseconds to apply to all signing
|
||||
* times. Use this to compensate for clock skew when your system may be
|
||||
* out of sync with the service time. Note that this configuration option
|
||||
* can only be applied to the global `AWS.config` object and cannot be
|
||||
* overridden in service-specific configuration. Defaults to 0 milliseconds.
|
||||
*
|
||||
* @!attribute signatureVersion
|
||||
* @return [String] the signature version to sign requests with (overriding
|
||||
* the API configuration). Possible values are: 'v2', 'v3', 'v4'.
|
||||
*
|
||||
* @!attribute signatureCache
|
||||
* @return [Boolean] whether the signature to sign requests with (overriding
|
||||
* the API configuration) is cached. Only applies to the signature version 'v4'.
|
||||
* Defaults to `true`.
|
||||
*
|
||||
* @!attribute endpointDiscoveryEnabled
|
||||
* @return [Boolean|undefined] whether to call operations with endpoints
|
||||
* given by service dynamically. Setting this config to `true` will enable
|
||||
* endpoint discovery for all applicable operations. Setting it to `false`
|
||||
* will explicitly disable endpoint discovery even though operations that
|
||||
* require endpoint discovery will presumably fail. Leaving it to
|
||||
* `undefined` means SDK only do endpoint discovery when it's required.
|
||||
* Defaults to `undefined`
|
||||
*
|
||||
* @!attribute endpointCacheSize
|
||||
* @return [Number] the size of the global cache storing endpoints from endpoint
|
||||
* discovery operations. Once endpoint cache is created, updating this setting
|
||||
* cannot change existing cache size.
|
||||
* Defaults to 1000
|
||||
*
|
||||
* @!attribute hostPrefixEnabled
|
||||
* @return [Boolean] whether to marshal request parameters to the prefix of
|
||||
* hostname. Defaults to `true`.
|
||||
*
|
||||
* @!attribute stsRegionalEndpoints
|
||||
* @return ['legacy'|'regional'] whether to send sts request to global endpoints or
|
||||
* regional endpoints.
|
||||
* Defaults to 'legacy'.
|
||||
*
|
||||
* @!attribute useFipsEndpoint
|
||||
* @return [Boolean] Enables FIPS compatible endpoints. Defaults to `false`.
|
||||
*
|
||||
* @!attribute useDualstackEndpoint
|
||||
* @return [Boolean] Enables IPv6 dualstack endpoint. Defaults to `false`.
|
||||
*/
|
||||
AWS.Config = AWS.util.inherit({
|
||||
/**
|
||||
* @!endgroup
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a new configuration object. This is the object that passes
|
||||
* option data along to service requests, including credentials, security,
|
||||
* region information, and some service specific settings.
|
||||
*
|
||||
* @example Creating a new configuration object with credentials and region
|
||||
* var config = new AWS.Config({
|
||||
* accessKeyId: 'AKID', secretAccessKey: 'SECRET', region: 'us-west-2'
|
||||
* });
|
||||
* @option options accessKeyId [String] your AWS access key ID.
|
||||
* @option options secretAccessKey [String] your AWS secret access key.
|
||||
* @option options sessionToken [AWS.Credentials] the optional AWS
|
||||
* session token to sign requests with.
|
||||
* @option options credentials [AWS.Credentials] the AWS credentials
|
||||
* to sign requests with. You can either specify this object, or
|
||||
* specify the accessKeyId and secretAccessKey options directly.
|
||||
* @option options credentialProvider [AWS.CredentialProviderChain] the
|
||||
* provider chain used to resolve credentials if no static `credentials`
|
||||
* property is set.
|
||||
* @option options region [String] the region to send service requests to.
|
||||
* See {region} for more information.
|
||||
* @option options maxRetries [Integer] the maximum amount of retries to
|
||||
* attempt with a request. See {maxRetries} for more information.
|
||||
* @option options maxRedirects [Integer] the maximum amount of redirects to
|
||||
* follow with a request. See {maxRedirects} for more information.
|
||||
* @option options sslEnabled [Boolean] whether to enable SSL for
|
||||
* requests.
|
||||
* @option options paramValidation [Boolean|map] whether input parameters
|
||||
* should be validated against the operation description before sending
|
||||
* the request. Defaults to true. Pass a map to enable any of the
|
||||
* following specific validation features:
|
||||
*
|
||||
* * **min** [Boolean] — Validates that a value meets the min
|
||||
* constraint. This is enabled by default when paramValidation is set
|
||||
* to `true`.
|
||||
* * **max** [Boolean] — Validates that a value meets the max
|
||||
* constraint.
|
||||
* * **pattern** [Boolean] — Validates that a string value matches a
|
||||
* regular expression.
|
||||
* * **enum** [Boolean] — Validates that a string value matches one
|
||||
* of the allowable enum values.
|
||||
* @option options computeChecksums [Boolean] whether to compute checksums
|
||||
* for payload bodies when the service accepts it (currently supported
|
||||
* in S3 only)
|
||||
* @option options convertResponseTypes [Boolean] whether types are converted
|
||||
* when parsing response data. Currently only supported for JSON based
|
||||
* services. Turning this off may improve performance on large response
|
||||
* payloads. Defaults to `true`.
|
||||
* @option options correctClockSkew [Boolean] whether to apply a clock skew
|
||||
* correction and retry requests that fail because of an skewed client
|
||||
* clock. Defaults to `false`.
|
||||
* @option options s3ForcePathStyle [Boolean] whether to force path
|
||||
* style URLs for S3 objects.
|
||||
* @option options s3BucketEndpoint [Boolean] whether the provided endpoint
|
||||
* addresses an individual bucket (false if it addresses the root API
|
||||
* endpoint). Note that setting this configuration option requires an
|
||||
* `endpoint` to be provided explicitly to the service constructor.
|
||||
* @option options s3DisableBodySigning [Boolean] whether S3 body signing
|
||||
* should be disabled when using signature version `v4`. Body signing
|
||||
* can only be disabled when using https. Defaults to `true`.
|
||||
* @option options s3UsEast1RegionalEndpoint ['legacy'|'regional'] when region
|
||||
* is set to 'us-east-1', whether to send s3 request to global endpoints or
|
||||
* 'us-east-1' regional endpoints. This config is only applicable to S3 client.
|
||||
* Defaults to `legacy`
|
||||
* @option options s3UseArnRegion [Boolean] whether to override the request region
|
||||
* with the region inferred from requested resource's ARN. Only available for S3 buckets
|
||||
* Defaults to `true`
|
||||
*
|
||||
* @option options retryDelayOptions [map] A set of options to configure
|
||||
* the retry delay on retryable errors. Currently supported options are:
|
||||
*
|
||||
* * **base** [Integer] — The base number of milliseconds to use in the
|
||||
* exponential backoff for operation retries. Defaults to 100 ms for all
|
||||
* services except DynamoDB, where it defaults to 50ms.
|
||||
* * **customBackoff ** [function] — A custom function that accepts a
|
||||
* retry count and error and returns the amount of time to delay in
|
||||
* milliseconds. If the result is a non-zero negative value, no further
|
||||
* retry attempts will be made. The `base` option will be ignored if this
|
||||
* option is supplied. The function is only called for retryable errors.
|
||||
* @option options httpOptions [map] A set of options to pass to the low-level
|
||||
* HTTP request. Currently supported options are:
|
||||
*
|
||||
* * **proxy** [String] — the URL to proxy requests through
|
||||
* * **agent** [http.Agent, https.Agent] — the Agent object to perform
|
||||
* HTTP requests with. Used for connection pooling. Defaults to the global
|
||||
* agent (`http.globalAgent`) for non-SSL connections. Note that for
|
||||
* SSL connections, a special Agent object is used in order to enable
|
||||
* peer certificate verification. This feature is only available in the
|
||||
* Node.js environment.
|
||||
* * **connectTimeout** [Integer] — Sets the socket to timeout after
|
||||
* failing to establish a connection with the server after
|
||||
* `connectTimeout` milliseconds. This timeout has no effect once a socket
|
||||
* connection has been established.
|
||||
* * **timeout** [Integer] — Sets the socket to timeout after timeout
|
||||
* milliseconds of inactivity on the socket. Defaults to two minutes
|
||||
* (120000).
|
||||
* * **xhrAsync** [Boolean] — Whether the SDK will send asynchronous
|
||||
* HTTP requests. Used in the browser environment only. Set to false to
|
||||
* send requests synchronously. Defaults to true (async on).
|
||||
* * **xhrWithCredentials** [Boolean] — Sets the "withCredentials"
|
||||
* property of an XMLHttpRequest object. Used in the browser environment
|
||||
* only. Defaults to false.
|
||||
* @option options apiVersion [String, Date] a String in YYYY-MM-DD format
|
||||
* (or a date) that represents the latest possible API version that can be
|
||||
* used in all services (unless overridden by `apiVersions`). Specify
|
||||
* 'latest' to use the latest possible version.
|
||||
* @option options apiVersions [map<String, String|Date>] a map of service
|
||||
* identifiers (the lowercase service class name) with the API version to
|
||||
* use when instantiating a service. Specify 'latest' for each individual
|
||||
* that can use the latest available version.
|
||||
* @option options logger [#write,#log] an object that responds to .write()
|
||||
* (like a stream) or .log() (like the console object) in order to log
|
||||
* information about requests
|
||||
* @option options systemClockOffset [Number] an offset value in milliseconds
|
||||
* to apply to all signing times. Use this to compensate for clock skew
|
||||
* when your system may be out of sync with the service time. Note that
|
||||
* this configuration option can only be applied to the global `AWS.config`
|
||||
* object and cannot be overridden in service-specific configuration.
|
||||
* Defaults to 0 milliseconds.
|
||||
* @option options signatureVersion [String] the signature version to sign
|
||||
* requests with (overriding the API configuration). Possible values are:
|
||||
* 'v2', 'v3', 'v4'.
|
||||
* @option options signatureCache [Boolean] whether the signature to sign
|
||||
* requests with (overriding the API configuration) is cached. Only applies
|
||||
* to the signature version 'v4'. Defaults to `true`.
|
||||
* @option options dynamoDbCrc32 [Boolean] whether to validate the CRC32
|
||||
* checksum of HTTP response bodies returned by DynamoDB. Default: `true`.
|
||||
* @option options useAccelerateEndpoint [Boolean] Whether to use the
|
||||
* S3 Transfer Acceleration endpoint with the S3 service. Default: `false`.
|
||||
* @option options clientSideMonitoring [Boolean] whether to collect and
|
||||
* publish this client's performance metrics of all its API requests.
|
||||
* @option options endpointDiscoveryEnabled [Boolean|undefined] whether to
|
||||
* call operations with endpoints given by service dynamically. Setting this
|
||||
* config to `true` will enable endpoint discovery for all applicable operations.
|
||||
* Setting it to `false` will explicitly disable endpoint discovery even though
|
||||
* operations that require endpoint discovery will presumably fail. Leaving it
|
||||
* to `undefined` means SDK will only do endpoint discovery when it's required.
|
||||
* Defaults to `undefined`
|
||||
* @option options endpointCacheSize [Number] the size of the global cache storing
|
||||
* endpoints from endpoint discovery operations. Once endpoint cache is created,
|
||||
* updating this setting cannot change existing cache size.
|
||||
* Defaults to 1000
|
||||
* @option options hostPrefixEnabled [Boolean] whether to marshal request
|
||||
* parameters to the prefix of hostname.
|
||||
* Defaults to `true`.
|
||||
* @option options stsRegionalEndpoints ['legacy'|'regional'] whether to send sts request
|
||||
* to global endpoints or regional endpoints.
|
||||
* Defaults to 'legacy'.
|
||||
* @option options useFipsEndpoint [Boolean] Enables FIPS compatible endpoints.
|
||||
* Defaults to `false`.
|
||||
* @option options useDualstackEndpoint [Boolean] Enables IPv6 dualstack endpoint.
|
||||
* Defaults to `false`.
|
||||
*/
|
||||
constructor: function Config(options) {
|
||||
if (options === undefined) options = {};
|
||||
options = this.extractCredentials(options);
|
||||
|
||||
AWS.util.each.call(this, this.keys, function (key, value) {
|
||||
this.set(key, options[key], value);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @!group Managing Credentials
|
||||
*/
|
||||
|
||||
/**
|
||||
* Loads credentials from the configuration object. This is used internally
|
||||
* by the SDK to ensure that refreshable {Credentials} objects are properly
|
||||
* refreshed and loaded when sending a request. If you want to ensure that
|
||||
* your credentials are loaded prior to a request, you can use this method
|
||||
* directly to provide accurate credential data stored in the object.
|
||||
*
|
||||
* @note If you configure the SDK with static or environment credentials,
|
||||
* the credential data should already be present in {credentials} attribute.
|
||||
* This method is primarily necessary to load credentials from asynchronous
|
||||
* sources, or sources that can refresh credentials periodically.
|
||||
* @example Getting your access key
|
||||
* AWS.config.getCredentials(function(err) {
|
||||
* if (err) console.log(err.stack); // credentials not loaded
|
||||
* else console.log("Access Key:", AWS.config.credentials.accessKeyId);
|
||||
* })
|
||||
* @callback callback function(err)
|
||||
* Called when the {credentials} have been properly set on the configuration
|
||||
* object.
|
||||
*
|
||||
* @param err [Error] if this is set, credentials were not successfully
|
||||
* loaded and this error provides information why.
|
||||
* @see credentials
|
||||
* @see Credentials
|
||||
*/
|
||||
getCredentials: function getCredentials(callback) {
|
||||
var self = this;
|
||||
|
||||
function finish(err) {
|
||||
callback(err, err ? null : self.credentials);
|
||||
}
|
||||
|
||||
function credError(msg, err) {
|
||||
return new AWS.util.error(err || new Error(), {
|
||||
code: 'CredentialsError',
|
||||
message: msg,
|
||||
name: 'CredentialsError'
|
||||
});
|
||||
}
|
||||
|
||||
function getAsyncCredentials() {
|
||||
self.credentials.get(function(err) {
|
||||
if (err) {
|
||||
var msg = 'Could not load credentials from ' +
|
||||
self.credentials.constructor.name;
|
||||
err = credError(msg, err);
|
||||
}
|
||||
finish(err);
|
||||
});
|
||||
}
|
||||
|
||||
function getStaticCredentials() {
|
||||
var err = null;
|
||||
if (!self.credentials.accessKeyId || !self.credentials.secretAccessKey) {
|
||||
err = credError('Missing credentials');
|
||||
}
|
||||
finish(err);
|
||||
}
|
||||
|
||||
if (self.credentials) {
|
||||
if (typeof self.credentials.get === 'function') {
|
||||
getAsyncCredentials();
|
||||
} else { // static credentials
|
||||
getStaticCredentials();
|
||||
}
|
||||
} else if (self.credentialProvider) {
|
||||
self.credentialProvider.resolve(function(err, creds) {
|
||||
if (err) {
|
||||
err = credError('Could not load credentials from any providers', err);
|
||||
}
|
||||
self.credentials = creds;
|
||||
finish(err);
|
||||
});
|
||||
} else {
|
||||
finish(credError('No credentials to load'));
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads token from the configuration object. This is used internally
|
||||
* by the SDK to ensure that refreshable {Token} objects are properly
|
||||
* refreshed and loaded when sending a request. If you want to ensure that
|
||||
* your token is loaded prior to a request, you can use this method
|
||||
* directly to provide accurate token data stored in the object.
|
||||
*
|
||||
* @note If you configure the SDK with static token, the token data should
|
||||
* already be present in {token} attribute. This method is primarily necessary
|
||||
* to load token from asynchronous sources, or sources that can refresh
|
||||
* token periodically.
|
||||
* @example Getting your access token
|
||||
* AWS.config.getToken(function(err) {
|
||||
* if (err) console.log(err.stack); // token not loaded
|
||||
* else console.log("Token:", AWS.config.token.token);
|
||||
* })
|
||||
* @callback callback function(err)
|
||||
* Called when the {token} have been properly set on the configuration object.
|
||||
*
|
||||
* @param err [Error] if this is set, token was not successfully loaded and
|
||||
* this error provides information why.
|
||||
* @see token
|
||||
*/
|
||||
getToken: function getToken(callback) {
|
||||
var self = this;
|
||||
|
||||
function finish(err) {
|
||||
callback(err, err ? null : self.token);
|
||||
}
|
||||
|
||||
function tokenError(msg, err) {
|
||||
return new AWS.util.error(err || new Error(), {
|
||||
code: 'TokenError',
|
||||
message: msg,
|
||||
name: 'TokenError'
|
||||
});
|
||||
}
|
||||
|
||||
function getAsyncToken() {
|
||||
self.token.get(function(err) {
|
||||
if (err) {
|
||||
var msg = 'Could not load token from ' +
|
||||
self.token.constructor.name;
|
||||
err = tokenError(msg, err);
|
||||
}
|
||||
finish(err);
|
||||
});
|
||||
}
|
||||
|
||||
function getStaticToken() {
|
||||
var err = null;
|
||||
if (!self.token.token) {
|
||||
err = tokenError('Missing token');
|
||||
}
|
||||
finish(err);
|
||||
}
|
||||
|
||||
if (self.token) {
|
||||
if (typeof self.token.get === 'function') {
|
||||
getAsyncToken();
|
||||
} else { // static token
|
||||
getStaticToken();
|
||||
}
|
||||
} else if (self.tokenProvider) {
|
||||
self.tokenProvider.resolve(function(err, token) {
|
||||
if (err) {
|
||||
err = tokenError('Could not load token from any providers', err);
|
||||
}
|
||||
self.token = token;
|
||||
finish(err);
|
||||
});
|
||||
} else {
|
||||
finish(tokenError('No token to load'));
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @!group Loading and Setting Configuration Options
|
||||
*/
|
||||
|
||||
/**
|
||||
* @overload update(options, allowUnknownKeys = false)
|
||||
* Updates the current configuration object with new options.
|
||||
*
|
||||
* @example Update maxRetries property of a configuration object
|
||||
* config.update({maxRetries: 10});
|
||||
* @param [Object] options a map of option keys and values.
|
||||
* @param [Boolean] allowUnknownKeys whether unknown keys can be set on
|
||||
* the configuration object. Defaults to `false`.
|
||||
* @see constructor
|
||||
*/
|
||||
update: function update(options, allowUnknownKeys) {
|
||||
allowUnknownKeys = allowUnknownKeys || false;
|
||||
options = this.extractCredentials(options);
|
||||
AWS.util.each.call(this, options, function (key, value) {
|
||||
if (allowUnknownKeys || Object.prototype.hasOwnProperty.call(this.keys, key) ||
|
||||
AWS.Service.hasService(key)) {
|
||||
this.set(key, value);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads configuration data from a JSON file into this config object.
|
||||
* @note Loading configuration will reset all existing configuration
|
||||
* on the object.
|
||||
* @!macro nobrowser
|
||||
* @param path [String] the path relative to your process's current
|
||||
* working directory to load configuration from.
|
||||
* @return [AWS.Config] the same configuration object
|
||||
*/
|
||||
loadFromPath: function loadFromPath(path) {
|
||||
this.clear();
|
||||
|
||||
var options = JSON.parse(AWS.util.readFileSync(path));
|
||||
var fileSystemCreds = new AWS.FileSystemCredentials(path);
|
||||
var chain = new AWS.CredentialProviderChain();
|
||||
chain.providers.unshift(fileSystemCreds);
|
||||
chain.resolve(function (err, creds) {
|
||||
if (err) throw err;
|
||||
else options.credentials = creds;
|
||||
});
|
||||
|
||||
this.constructor(options);
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
* Clears configuration data on this object
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
clear: function clear() {
|
||||
/*jshint forin:false */
|
||||
AWS.util.each.call(this, this.keys, function (key) {
|
||||
delete this[key];
|
||||
});
|
||||
|
||||
// reset credential provider
|
||||
this.set('credentials', undefined);
|
||||
this.set('credentialProvider', undefined);
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets a property on the configuration object, allowing for a
|
||||
* default value
|
||||
* @api private
|
||||
*/
|
||||
set: function set(property, value, defaultValue) {
|
||||
if (value === undefined) {
|
||||
if (defaultValue === undefined) {
|
||||
defaultValue = this.keys[property];
|
||||
}
|
||||
if (typeof defaultValue === 'function') {
|
||||
this[property] = defaultValue.call(this);
|
||||
} else {
|
||||
this[property] = defaultValue;
|
||||
}
|
||||
} else if (property === 'httpOptions' && this[property]) {
|
||||
// deep merge httpOptions
|
||||
this[property] = AWS.util.merge(this[property], value);
|
||||
} else {
|
||||
this[property] = value;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* All of the keys with their default values.
|
||||
*
|
||||
* @constant
|
||||
* @api private
|
||||
*/
|
||||
keys: {
|
||||
credentials: null,
|
||||
credentialProvider: null,
|
||||
region: null,
|
||||
logger: null,
|
||||
apiVersions: {},
|
||||
apiVersion: null,
|
||||
endpoint: undefined,
|
||||
httpOptions: {
|
||||
timeout: 120000
|
||||
},
|
||||
maxRetries: undefined,
|
||||
maxRedirects: 10,
|
||||
paramValidation: true,
|
||||
sslEnabled: true,
|
||||
s3ForcePathStyle: false,
|
||||
s3BucketEndpoint: false,
|
||||
s3DisableBodySigning: true,
|
||||
s3UsEast1RegionalEndpoint: 'legacy',
|
||||
s3UseArnRegion: undefined,
|
||||
computeChecksums: true,
|
||||
convertResponseTypes: true,
|
||||
correctClockSkew: false,
|
||||
customUserAgent: null,
|
||||
dynamoDbCrc32: true,
|
||||
systemClockOffset: 0,
|
||||
signatureVersion: null,
|
||||
signatureCache: true,
|
||||
retryDelayOptions: {},
|
||||
useAccelerateEndpoint: false,
|
||||
clientSideMonitoring: false,
|
||||
endpointDiscoveryEnabled: undefined,
|
||||
endpointCacheSize: 1000,
|
||||
hostPrefixEnabled: true,
|
||||
stsRegionalEndpoints: 'legacy',
|
||||
useFipsEndpoint: false,
|
||||
useDualstackEndpoint: false,
|
||||
token: null
|
||||
},
|
||||
|
||||
/**
|
||||
* Extracts accessKeyId, secretAccessKey and sessionToken
|
||||
* from a configuration hash.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
extractCredentials: function extractCredentials(options) {
|
||||
if (options.accessKeyId && options.secretAccessKey) {
|
||||
options = AWS.util.copy(options);
|
||||
options.credentials = new AWS.Credentials(options);
|
||||
}
|
||||
return options;
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the promise dependency the SDK will use wherever Promises are returned.
|
||||
* Passing `null` will force the SDK to use native Promises if they are available.
|
||||
* If native Promises are not available, passing `null` will have no effect.
|
||||
* @param [Constructor] dep A reference to a Promise constructor
|
||||
*/
|
||||
setPromisesDependency: function setPromisesDependency(dep) {
|
||||
PromisesDependency = dep;
|
||||
// if null was passed in, we should try to use native promises
|
||||
if (dep === null && typeof Promise === 'function') {
|
||||
PromisesDependency = Promise;
|
||||
}
|
||||
var constructors = [AWS.Request, AWS.Credentials, AWS.CredentialProviderChain];
|
||||
if (AWS.S3) {
|
||||
constructors.push(AWS.S3);
|
||||
if (AWS.S3.ManagedUpload) {
|
||||
constructors.push(AWS.S3.ManagedUpload);
|
||||
}
|
||||
}
|
||||
AWS.util.addPromises(constructors, PromisesDependency);
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the promise dependency set by `AWS.config.setPromisesDependency`.
|
||||
*/
|
||||
getPromisesDependency: function getPromisesDependency() {
|
||||
return PromisesDependency;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* @return [AWS.Config] The global configuration object singleton instance
|
||||
* @readonly
|
||||
* @see AWS.Config
|
||||
*/
|
||||
AWS.config = new AWS.Config();
|
||||
67
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/config_regional_endpoint.js
generated
vendored
Normal file
67
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/config_regional_endpoint.js
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
var AWS = require('./core');
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
function validateRegionalEndpointsFlagValue(configValue, errorOptions) {
|
||||
if (typeof configValue !== 'string') return undefined;
|
||||
else if (['legacy', 'regional'].indexOf(configValue.toLowerCase()) >= 0) {
|
||||
return configValue.toLowerCase();
|
||||
} else {
|
||||
throw AWS.util.error(new Error(), errorOptions);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the configuration value for regional endpoint from difference sources: client
|
||||
* config, environmental variable, shared config file. Value can be case-insensitive
|
||||
* 'legacy' or 'reginal'.
|
||||
* @param originalConfig user-supplied config object to resolve
|
||||
* @param options a map of config property names from individual configuration source
|
||||
* - env: name of environmental variable that refers to the config
|
||||
* - sharedConfig: name of shared configuration file property that refers to the config
|
||||
* - clientConfig: name of client configuration property that refers to the config
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
function resolveRegionalEndpointsFlag(originalConfig, options) {
|
||||
originalConfig = originalConfig || {};
|
||||
//validate config value
|
||||
var resolved;
|
||||
if (originalConfig[options.clientConfig]) {
|
||||
resolved = validateRegionalEndpointsFlagValue(originalConfig[options.clientConfig], {
|
||||
code: 'InvalidConfiguration',
|
||||
message: 'invalid "' + options.clientConfig + '" configuration. Expect "legacy" ' +
|
||||
' or "regional". Got "' + originalConfig[options.clientConfig] + '".'
|
||||
});
|
||||
if (resolved) return resolved;
|
||||
}
|
||||
if (!AWS.util.isNode()) return resolved;
|
||||
//validate environmental variable
|
||||
if (Object.prototype.hasOwnProperty.call(process.env, options.env)) {
|
||||
var envFlag = process.env[options.env];
|
||||
resolved = validateRegionalEndpointsFlagValue(envFlag, {
|
||||
code: 'InvalidEnvironmentalVariable',
|
||||
message: 'invalid ' + options.env + ' environmental variable. Expect "legacy" ' +
|
||||
' or "regional". Got "' + process.env[options.env] + '".'
|
||||
});
|
||||
if (resolved) return resolved;
|
||||
}
|
||||
//validate shared config file
|
||||
var profile = {};
|
||||
try {
|
||||
var profiles = AWS.util.getProfilesFromSharedConfig(AWS.util.iniLoader);
|
||||
profile = profiles[process.env.AWS_PROFILE || AWS.util.defaultProfile];
|
||||
} catch (e) {};
|
||||
if (profile && Object.prototype.hasOwnProperty.call(profile, options.sharedConfig)) {
|
||||
var fileFlag = profile[options.sharedConfig];
|
||||
resolved = validateRegionalEndpointsFlagValue(fileFlag, {
|
||||
code: 'InvalidConfiguration',
|
||||
message: 'invalid ' + options.sharedConfig + ' profile config. Expect "legacy" ' +
|
||||
' or "regional". Got "' + profile[options.sharedConfig] + '".'
|
||||
});
|
||||
if (resolved) return resolved;
|
||||
}
|
||||
return resolved;
|
||||
}
|
||||
|
||||
module.exports = resolveRegionalEndpointsFlag;
|
||||
723
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/config_service_placeholders.d.ts
generated
vendored
Normal file
723
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/config_service_placeholders.d.ts
generated
vendored
Normal file
@@ -0,0 +1,723 @@
|
||||
import * as AWS from '../clients/all';
|
||||
export abstract class ConfigurationServicePlaceholders {
|
||||
acm?: AWS.ACM.Types.ClientConfiguration;
|
||||
apigateway?: AWS.APIGateway.Types.ClientConfiguration;
|
||||
applicationautoscaling?: AWS.ApplicationAutoScaling.Types.ClientConfiguration;
|
||||
appstream?: AWS.AppStream.Types.ClientConfiguration;
|
||||
autoscaling?: AWS.AutoScaling.Types.ClientConfiguration;
|
||||
batch?: AWS.Batch.Types.ClientConfiguration;
|
||||
budgets?: AWS.Budgets.Types.ClientConfiguration;
|
||||
clouddirectory?: AWS.CloudDirectory.Types.ClientConfiguration;
|
||||
cloudformation?: AWS.CloudFormation.Types.ClientConfiguration;
|
||||
cloudfront?: AWS.CloudFront.Types.ClientConfiguration;
|
||||
cloudhsm?: AWS.CloudHSM.Types.ClientConfiguration;
|
||||
cloudsearch?: AWS.CloudSearch.Types.ClientConfiguration;
|
||||
cloudsearchdomain?: AWS.CloudSearchDomain.Types.ClientConfiguration;
|
||||
cloudtrail?: AWS.CloudTrail.Types.ClientConfiguration;
|
||||
cloudwatch?: AWS.CloudWatch.Types.ClientConfiguration;
|
||||
cloudwatchevents?: AWS.CloudWatchEvents.Types.ClientConfiguration;
|
||||
cloudwatchlogs?: AWS.CloudWatchLogs.Types.ClientConfiguration;
|
||||
codebuild?: AWS.CodeBuild.Types.ClientConfiguration;
|
||||
codecommit?: AWS.CodeCommit.Types.ClientConfiguration;
|
||||
codedeploy?: AWS.CodeDeploy.Types.ClientConfiguration;
|
||||
codepipeline?: AWS.CodePipeline.Types.ClientConfiguration;
|
||||
cognitoidentity?: AWS.CognitoIdentity.Types.ClientConfiguration;
|
||||
cognitoidentityserviceprovider?: AWS.CognitoIdentityServiceProvider.Types.ClientConfiguration;
|
||||
cognitosync?: AWS.CognitoSync.Types.ClientConfiguration;
|
||||
configservice?: AWS.ConfigService.Types.ClientConfiguration;
|
||||
cur?: AWS.CUR.Types.ClientConfiguration;
|
||||
datapipeline?: AWS.DataPipeline.Types.ClientConfiguration;
|
||||
devicefarm?: AWS.DeviceFarm.Types.ClientConfiguration;
|
||||
directconnect?: AWS.DirectConnect.Types.ClientConfiguration;
|
||||
directoryservice?: AWS.DirectoryService.Types.ClientConfiguration;
|
||||
discovery?: AWS.Discovery.Types.ClientConfiguration;
|
||||
dms?: AWS.DMS.Types.ClientConfiguration;
|
||||
dynamodb?: AWS.DynamoDB.Types.ClientConfiguration;
|
||||
dynamodbstreams?: AWS.DynamoDBStreams.Types.ClientConfiguration;
|
||||
ec2?: AWS.EC2.Types.ClientConfiguration;
|
||||
ecr?: AWS.ECR.Types.ClientConfiguration;
|
||||
ecs?: AWS.ECS.Types.ClientConfiguration;
|
||||
efs?: AWS.EFS.Types.ClientConfiguration;
|
||||
elasticache?: AWS.ElastiCache.Types.ClientConfiguration;
|
||||
elasticbeanstalk?: AWS.ElasticBeanstalk.Types.ClientConfiguration;
|
||||
elb?: AWS.ELB.Types.ClientConfiguration;
|
||||
elbv2?: AWS.ELBv2.Types.ClientConfiguration;
|
||||
emr?: AWS.EMR.Types.ClientConfiguration;
|
||||
es?: AWS.ES.Types.ClientConfiguration;
|
||||
elastictranscoder?: AWS.ElasticTranscoder.Types.ClientConfiguration;
|
||||
firehose?: AWS.Firehose.Types.ClientConfiguration;
|
||||
gamelift?: AWS.GameLift.Types.ClientConfiguration;
|
||||
glacier?: AWS.Glacier.Types.ClientConfiguration;
|
||||
health?: AWS.Health.Types.ClientConfiguration;
|
||||
iam?: AWS.IAM.Types.ClientConfiguration;
|
||||
importexport?: AWS.ImportExport.Types.ClientConfiguration;
|
||||
inspector?: AWS.Inspector.Types.ClientConfiguration;
|
||||
iot?: AWS.Iot.Types.ClientConfiguration;
|
||||
iotdata?: AWS.IotData.Types.ClientConfiguration;
|
||||
kinesis?: AWS.Kinesis.Types.ClientConfiguration;
|
||||
kinesisanalytics?: AWS.KinesisAnalytics.Types.ClientConfiguration;
|
||||
kms?: AWS.KMS.Types.ClientConfiguration;
|
||||
lambda?: AWS.Lambda.Types.ClientConfiguration;
|
||||
lexruntime?: AWS.LexRuntime.Types.ClientConfiguration;
|
||||
lightsail?: AWS.Lightsail.Types.ClientConfiguration;
|
||||
machinelearning?: AWS.MachineLearning.Types.ClientConfiguration;
|
||||
marketplacecommerceanalytics?: AWS.MarketplaceCommerceAnalytics.Types.ClientConfiguration;
|
||||
marketplacemetering?: AWS.MarketplaceMetering.Types.ClientConfiguration;
|
||||
mturk?: AWS.MTurk.Types.ClientConfiguration;
|
||||
mobileanalytics?: AWS.MobileAnalytics.Types.ClientConfiguration;
|
||||
opsworks?: AWS.OpsWorks.Types.ClientConfiguration;
|
||||
opsworkscm?: AWS.OpsWorksCM.Types.ClientConfiguration;
|
||||
organizations?: AWS.Organizations.Types.ClientConfiguration;
|
||||
pinpoint?: AWS.Pinpoint.Types.ClientConfiguration;
|
||||
polly?: AWS.Polly.Types.ClientConfiguration;
|
||||
rds?: AWS.RDS.Types.ClientConfiguration;
|
||||
redshift?: AWS.Redshift.Types.ClientConfiguration;
|
||||
rekognition?: AWS.Rekognition.Types.ClientConfiguration;
|
||||
resourcegroupstaggingapi?: AWS.ResourceGroupsTaggingAPI.Types.ClientConfiguration;
|
||||
route53?: AWS.Route53.Types.ClientConfiguration;
|
||||
route53domains?: AWS.Route53Domains.Types.ClientConfiguration;
|
||||
s3?: AWS.S3.Types.ClientConfiguration;
|
||||
s3control?: AWS.S3Control.Types.ClientConfiguration;
|
||||
servicecatalog?: AWS.ServiceCatalog.Types.ClientConfiguration;
|
||||
ses?: AWS.SES.Types.ClientConfiguration;
|
||||
shield?: AWS.Shield.Types.ClientConfiguration;
|
||||
simpledb?: AWS.SimpleDB.Types.ClientConfiguration;
|
||||
sms?: AWS.SMS.Types.ClientConfiguration;
|
||||
snowball?: AWS.Snowball.Types.ClientConfiguration;
|
||||
sns?: AWS.SNS.Types.ClientConfiguration;
|
||||
sqs?: AWS.SQS.Types.ClientConfiguration;
|
||||
ssm?: AWS.SSM.Types.ClientConfiguration;
|
||||
storagegateway?: AWS.StorageGateway.Types.ClientConfiguration;
|
||||
stepfunctions?: AWS.StepFunctions.Types.ClientConfiguration;
|
||||
sts?: AWS.STS.Types.ClientConfiguration;
|
||||
support?: AWS.Support.Types.ClientConfiguration;
|
||||
swf?: AWS.SWF.Types.ClientConfiguration;
|
||||
xray?: AWS.XRay.Types.ClientConfiguration;
|
||||
waf?: AWS.WAF.Types.ClientConfiguration;
|
||||
wafregional?: AWS.WAFRegional.Types.ClientConfiguration;
|
||||
workdocs?: AWS.WorkDocs.Types.ClientConfiguration;
|
||||
workspaces?: AWS.WorkSpaces.Types.ClientConfiguration;
|
||||
codestar?: AWS.CodeStar.Types.ClientConfiguration;
|
||||
lexmodelbuildingservice?: AWS.LexModelBuildingService.Types.ClientConfiguration;
|
||||
marketplaceentitlementservice?: AWS.MarketplaceEntitlementService.Types.ClientConfiguration;
|
||||
athena?: AWS.Athena.Types.ClientConfiguration;
|
||||
greengrass?: AWS.Greengrass.Types.ClientConfiguration;
|
||||
dax?: AWS.DAX.Types.ClientConfiguration;
|
||||
migrationhub?: AWS.MigrationHub.Types.ClientConfiguration;
|
||||
cloudhsmv2?: AWS.CloudHSMV2.Types.ClientConfiguration;
|
||||
glue?: AWS.Glue.Types.ClientConfiguration;
|
||||
mobile?: AWS.Mobile.Types.ClientConfiguration;
|
||||
pricing?: AWS.Pricing.Types.ClientConfiguration;
|
||||
costexplorer?: AWS.CostExplorer.Types.ClientConfiguration;
|
||||
mediaconvert?: AWS.MediaConvert.Types.ClientConfiguration;
|
||||
medialive?: AWS.MediaLive.Types.ClientConfiguration;
|
||||
mediapackage?: AWS.MediaPackage.Types.ClientConfiguration;
|
||||
mediastore?: AWS.MediaStore.Types.ClientConfiguration;
|
||||
mediastoredata?: AWS.MediaStoreData.Types.ClientConfiguration;
|
||||
appsync?: AWS.AppSync.Types.ClientConfiguration;
|
||||
guardduty?: AWS.GuardDuty.Types.ClientConfiguration;
|
||||
mq?: AWS.MQ.Types.ClientConfiguration;
|
||||
comprehend?: AWS.Comprehend.Types.ClientConfiguration;
|
||||
iotjobsdataplane?: AWS.IoTJobsDataPlane.Types.ClientConfiguration;
|
||||
kinesisvideoarchivedmedia?: AWS.KinesisVideoArchivedMedia.Types.ClientConfiguration;
|
||||
kinesisvideomedia?: AWS.KinesisVideoMedia.Types.ClientConfiguration;
|
||||
kinesisvideo?: AWS.KinesisVideo.Types.ClientConfiguration;
|
||||
sagemakerruntime?: AWS.SageMakerRuntime.Types.ClientConfiguration;
|
||||
sagemaker?: AWS.SageMaker.Types.ClientConfiguration;
|
||||
translate?: AWS.Translate.Types.ClientConfiguration;
|
||||
resourcegroups?: AWS.ResourceGroups.Types.ClientConfiguration;
|
||||
alexaforbusiness?: AWS.AlexaForBusiness.Types.ClientConfiguration;
|
||||
cloud9?: AWS.Cloud9.Types.ClientConfiguration;
|
||||
serverlessapplicationrepository?: AWS.ServerlessApplicationRepository.Types.ClientConfiguration;
|
||||
servicediscovery?: AWS.ServiceDiscovery.Types.ClientConfiguration;
|
||||
workmail?: AWS.WorkMail.Types.ClientConfiguration;
|
||||
autoscalingplans?: AWS.AutoScalingPlans.Types.ClientConfiguration;
|
||||
transcribeservice?: AWS.TranscribeService.Types.ClientConfiguration;
|
||||
connect?: AWS.Connect.Types.ClientConfiguration;
|
||||
acmpca?: AWS.ACMPCA.Types.ClientConfiguration;
|
||||
fms?: AWS.FMS.Types.ClientConfiguration;
|
||||
secretsmanager?: AWS.SecretsManager.Types.ClientConfiguration;
|
||||
iotanalytics?: AWS.IoTAnalytics.Types.ClientConfiguration;
|
||||
iot1clickdevicesservice?: AWS.IoT1ClickDevicesService.Types.ClientConfiguration;
|
||||
iot1clickprojects?: AWS.IoT1ClickProjects.Types.ClientConfiguration;
|
||||
pi?: AWS.PI.Types.ClientConfiguration;
|
||||
neptune?: AWS.Neptune.Types.ClientConfiguration;
|
||||
mediatailor?: AWS.MediaTailor.Types.ClientConfiguration;
|
||||
eks?: AWS.EKS.Types.ClientConfiguration;
|
||||
macie?: AWS.Macie.Types.ClientConfiguration;
|
||||
dlm?: AWS.DLM.Types.ClientConfiguration;
|
||||
signer?: AWS.Signer.Types.ClientConfiguration;
|
||||
chime?: AWS.Chime.Types.ClientConfiguration;
|
||||
pinpointemail?: AWS.PinpointEmail.Types.ClientConfiguration;
|
||||
ram?: AWS.RAM.Types.ClientConfiguration;
|
||||
route53resolver?: AWS.Route53Resolver.Types.ClientConfiguration;
|
||||
pinpointsmsvoice?: AWS.PinpointSMSVoice.Types.ClientConfiguration;
|
||||
quicksight?: AWS.QuickSight.Types.ClientConfiguration;
|
||||
rdsdataservice?: AWS.RDSDataService.Types.ClientConfiguration;
|
||||
amplify?: AWS.Amplify.Types.ClientConfiguration;
|
||||
datasync?: AWS.DataSync.Types.ClientConfiguration;
|
||||
robomaker?: AWS.RoboMaker.Types.ClientConfiguration;
|
||||
transfer?: AWS.Transfer.Types.ClientConfiguration;
|
||||
globalaccelerator?: AWS.GlobalAccelerator.Types.ClientConfiguration;
|
||||
comprehendmedical?: AWS.ComprehendMedical.Types.ClientConfiguration;
|
||||
kinesisanalyticsv2?: AWS.KinesisAnalyticsV2.Types.ClientConfiguration;
|
||||
mediaconnect?: AWS.MediaConnect.Types.ClientConfiguration;
|
||||
fsx?: AWS.FSx.Types.ClientConfiguration;
|
||||
securityhub?: AWS.SecurityHub.Types.ClientConfiguration;
|
||||
appmesh?: AWS.AppMesh.Types.ClientConfiguration;
|
||||
licensemanager?: AWS.LicenseManager.Types.ClientConfiguration;
|
||||
kafka?: AWS.Kafka.Types.ClientConfiguration;
|
||||
apigatewaymanagementapi?: AWS.ApiGatewayManagementApi.Types.ClientConfiguration;
|
||||
apigatewayv2?: AWS.ApiGatewayV2.Types.ClientConfiguration;
|
||||
docdb?: AWS.DocDB.Types.ClientConfiguration;
|
||||
backup?: AWS.Backup.Types.ClientConfiguration;
|
||||
worklink?: AWS.WorkLink.Types.ClientConfiguration;
|
||||
textract?: AWS.Textract.Types.ClientConfiguration;
|
||||
managedblockchain?: AWS.ManagedBlockchain.Types.ClientConfiguration;
|
||||
mediapackagevod?: AWS.MediaPackageVod.Types.ClientConfiguration;
|
||||
groundstation?: AWS.GroundStation.Types.ClientConfiguration;
|
||||
iotthingsgraph?: AWS.IoTThingsGraph.Types.ClientConfiguration;
|
||||
iotevents?: AWS.IoTEvents.Types.ClientConfiguration;
|
||||
ioteventsdata?: AWS.IoTEventsData.Types.ClientConfiguration;
|
||||
personalize?: AWS.Personalize.Types.ClientConfiguration;
|
||||
personalizeevents?: AWS.PersonalizeEvents.Types.ClientConfiguration;
|
||||
personalizeruntime?: AWS.PersonalizeRuntime.Types.ClientConfiguration;
|
||||
applicationinsights?: AWS.ApplicationInsights.Types.ClientConfiguration;
|
||||
servicequotas?: AWS.ServiceQuotas.Types.ClientConfiguration;
|
||||
ec2instanceconnect?: AWS.EC2InstanceConnect.Types.ClientConfiguration;
|
||||
eventbridge?: AWS.EventBridge.Types.ClientConfiguration;
|
||||
lakeformation?: AWS.LakeFormation.Types.ClientConfiguration;
|
||||
forecastservice?: AWS.ForecastService.Types.ClientConfiguration;
|
||||
forecastqueryservice?: AWS.ForecastQueryService.Types.ClientConfiguration;
|
||||
qldb?: AWS.QLDB.Types.ClientConfiguration;
|
||||
qldbsession?: AWS.QLDBSession.Types.ClientConfiguration;
|
||||
workmailmessageflow?: AWS.WorkMailMessageFlow.Types.ClientConfiguration;
|
||||
codestarnotifications?: AWS.CodeStarNotifications.Types.ClientConfiguration;
|
||||
savingsplans?: AWS.SavingsPlans.Types.ClientConfiguration;
|
||||
sso?: AWS.SSO.Types.ClientConfiguration;
|
||||
ssooidc?: AWS.SSOOIDC.Types.ClientConfiguration;
|
||||
marketplacecatalog?: AWS.MarketplaceCatalog.Types.ClientConfiguration;
|
||||
dataexchange?: AWS.DataExchange.Types.ClientConfiguration;
|
||||
sesv2?: AWS.SESV2.Types.ClientConfiguration;
|
||||
migrationhubconfig?: AWS.MigrationHubConfig.Types.ClientConfiguration;
|
||||
connectparticipant?: AWS.ConnectParticipant.Types.ClientConfiguration;
|
||||
appconfig?: AWS.AppConfig.Types.ClientConfiguration;
|
||||
iotsecuretunneling?: AWS.IoTSecureTunneling.Types.ClientConfiguration;
|
||||
wafv2?: AWS.WAFV2.Types.ClientConfiguration;
|
||||
elasticinference?: AWS.ElasticInference.Types.ClientConfiguration;
|
||||
imagebuilder?: AWS.Imagebuilder.Types.ClientConfiguration;
|
||||
schemas?: AWS.Schemas.Types.ClientConfiguration;
|
||||
accessanalyzer?: AWS.AccessAnalyzer.Types.ClientConfiguration;
|
||||
codegurureviewer?: AWS.CodeGuruReviewer.Types.ClientConfiguration;
|
||||
codeguruprofiler?: AWS.CodeGuruProfiler.Types.ClientConfiguration;
|
||||
computeoptimizer?: AWS.ComputeOptimizer.Types.ClientConfiguration;
|
||||
frauddetector?: AWS.FraudDetector.Types.ClientConfiguration;
|
||||
kendra?: AWS.Kendra.Types.ClientConfiguration;
|
||||
networkmanager?: AWS.NetworkManager.Types.ClientConfiguration;
|
||||
outposts?: AWS.Outposts.Types.ClientConfiguration;
|
||||
augmentedairuntime?: AWS.AugmentedAIRuntime.Types.ClientConfiguration;
|
||||
ebs?: AWS.EBS.Types.ClientConfiguration;
|
||||
kinesisvideosignalingchannels?: AWS.KinesisVideoSignalingChannels.Types.ClientConfiguration;
|
||||
detective?: AWS.Detective.Types.ClientConfiguration;
|
||||
codestarconnections?: AWS.CodeStarconnections.Types.ClientConfiguration;
|
||||
synthetics?: AWS.Synthetics.Types.ClientConfiguration;
|
||||
iotsitewise?: AWS.IoTSiteWise.Types.ClientConfiguration;
|
||||
macie2?: AWS.Macie2.Types.ClientConfiguration;
|
||||
codeartifact?: AWS.CodeArtifact.Types.ClientConfiguration;
|
||||
honeycode?: AWS.Honeycode.Types.ClientConfiguration;
|
||||
ivs?: AWS.IVS.Types.ClientConfiguration;
|
||||
braket?: AWS.Braket.Types.ClientConfiguration;
|
||||
identitystore?: AWS.IdentityStore.Types.ClientConfiguration;
|
||||
appflow?: AWS.Appflow.Types.ClientConfiguration;
|
||||
redshiftdata?: AWS.RedshiftData.Types.ClientConfiguration;
|
||||
ssoadmin?: AWS.SSOAdmin.Types.ClientConfiguration;
|
||||
timestreamquery?: AWS.TimestreamQuery.Types.ClientConfiguration;
|
||||
timestreamwrite?: AWS.TimestreamWrite.Types.ClientConfiguration;
|
||||
s3outposts?: AWS.S3Outposts.Types.ClientConfiguration;
|
||||
databrew?: AWS.DataBrew.Types.ClientConfiguration;
|
||||
servicecatalogappregistry?: AWS.ServiceCatalogAppRegistry.Types.ClientConfiguration;
|
||||
networkfirewall?: AWS.NetworkFirewall.Types.ClientConfiguration;
|
||||
mwaa?: AWS.MWAA.Types.ClientConfiguration;
|
||||
amplifybackend?: AWS.AmplifyBackend.Types.ClientConfiguration;
|
||||
appintegrations?: AWS.AppIntegrations.Types.ClientConfiguration;
|
||||
connectcontactlens?: AWS.ConnectContactLens.Types.ClientConfiguration;
|
||||
devopsguru?: AWS.DevOpsGuru.Types.ClientConfiguration;
|
||||
ecrpublic?: AWS.ECRPUBLIC.Types.ClientConfiguration;
|
||||
lookoutvision?: AWS.LookoutVision.Types.ClientConfiguration;
|
||||
sagemakerfeaturestoreruntime?: AWS.SageMakerFeatureStoreRuntime.Types.ClientConfiguration;
|
||||
customerprofiles?: AWS.CustomerProfiles.Types.ClientConfiguration;
|
||||
auditmanager?: AWS.AuditManager.Types.ClientConfiguration;
|
||||
emrcontainers?: AWS.EMRcontainers.Types.ClientConfiguration;
|
||||
healthlake?: AWS.HealthLake.Types.ClientConfiguration;
|
||||
sagemakeredge?: AWS.SagemakerEdge.Types.ClientConfiguration;
|
||||
amp?: AWS.Amp.Types.ClientConfiguration;
|
||||
greengrassv2?: AWS.GreengrassV2.Types.ClientConfiguration;
|
||||
iotdeviceadvisor?: AWS.IotDeviceAdvisor.Types.ClientConfiguration;
|
||||
iotfleethub?: AWS.IoTFleetHub.Types.ClientConfiguration;
|
||||
iotwireless?: AWS.IoTWireless.Types.ClientConfiguration;
|
||||
location?: AWS.Location.Types.ClientConfiguration;
|
||||
wellarchitected?: AWS.WellArchitected.Types.ClientConfiguration;
|
||||
lexmodelsv2?: AWS.LexModelsV2.Types.ClientConfiguration;
|
||||
lexruntimev2?: AWS.LexRuntimeV2.Types.ClientConfiguration;
|
||||
fis?: AWS.Fis.Types.ClientConfiguration;
|
||||
lookoutmetrics?: AWS.LookoutMetrics.Types.ClientConfiguration;
|
||||
mgn?: AWS.Mgn.Types.ClientConfiguration;
|
||||
lookoutequipment?: AWS.LookoutEquipment.Types.ClientConfiguration;
|
||||
nimble?: AWS.Nimble.Types.ClientConfiguration;
|
||||
finspace?: AWS.Finspace.Types.ClientConfiguration;
|
||||
finspacedata?: AWS.Finspacedata.Types.ClientConfiguration;
|
||||
ssmcontacts?: AWS.SSMContacts.Types.ClientConfiguration;
|
||||
ssmincidents?: AWS.SSMIncidents.Types.ClientConfiguration;
|
||||
applicationcostprofiler?: AWS.ApplicationCostProfiler.Types.ClientConfiguration;
|
||||
apprunner?: AWS.AppRunner.Types.ClientConfiguration;
|
||||
proton?: AWS.Proton.Types.ClientConfiguration;
|
||||
route53recoverycluster?: AWS.Route53RecoveryCluster.Types.ClientConfiguration;
|
||||
route53recoverycontrolconfig?: AWS.Route53RecoveryControlConfig.Types.ClientConfiguration;
|
||||
route53recoveryreadiness?: AWS.Route53RecoveryReadiness.Types.ClientConfiguration;
|
||||
chimesdkidentity?: AWS.ChimeSDKIdentity.Types.ClientConfiguration;
|
||||
chimesdkmessaging?: AWS.ChimeSDKMessaging.Types.ClientConfiguration;
|
||||
snowdevicemanagement?: AWS.SnowDeviceManagement.Types.ClientConfiguration;
|
||||
memorydb?: AWS.MemoryDB.Types.ClientConfiguration;
|
||||
opensearch?: AWS.OpenSearch.Types.ClientConfiguration;
|
||||
kafkaconnect?: AWS.KafkaConnect.Types.ClientConfiguration;
|
||||
voiceid?: AWS.VoiceID.Types.ClientConfiguration;
|
||||
wisdom?: AWS.Wisdom.Types.ClientConfiguration;
|
||||
account?: AWS.Account.Types.ClientConfiguration;
|
||||
cloudcontrol?: AWS.CloudControl.Types.ClientConfiguration;
|
||||
grafana?: AWS.Grafana.Types.ClientConfiguration;
|
||||
panorama?: AWS.Panorama.Types.ClientConfiguration;
|
||||
chimesdkmeetings?: AWS.ChimeSDKMeetings.Types.ClientConfiguration;
|
||||
resiliencehub?: AWS.Resiliencehub.Types.ClientConfiguration;
|
||||
migrationhubstrategy?: AWS.MigrationHubStrategy.Types.ClientConfiguration;
|
||||
appconfigdata?: AWS.AppConfigData.Types.ClientConfiguration;
|
||||
drs?: AWS.Drs.Types.ClientConfiguration;
|
||||
migrationhubrefactorspaces?: AWS.MigrationHubRefactorSpaces.Types.ClientConfiguration;
|
||||
evidently?: AWS.Evidently.Types.ClientConfiguration;
|
||||
inspector2?: AWS.Inspector2.Types.ClientConfiguration;
|
||||
rbin?: AWS.Rbin.Types.ClientConfiguration;
|
||||
rum?: AWS.RUM.Types.ClientConfiguration;
|
||||
backupgateway?: AWS.BackupGateway.Types.ClientConfiguration;
|
||||
iottwinmaker?: AWS.IoTTwinMaker.Types.ClientConfiguration;
|
||||
workspacesweb?: AWS.WorkSpacesWeb.Types.ClientConfiguration;
|
||||
amplifyuibuilder?: AWS.AmplifyUIBuilder.Types.ClientConfiguration;
|
||||
keyspaces?: AWS.Keyspaces.Types.ClientConfiguration;
|
||||
billingconductor?: AWS.Billingconductor.Types.ClientConfiguration;
|
||||
pinpointsmsvoicev2?: AWS.PinpointSMSVoiceV2.Types.ClientConfiguration;
|
||||
ivschat?: AWS.Ivschat.Types.ClientConfiguration;
|
||||
chimesdkmediapipelines?: AWS.ChimeSDKMediaPipelines.Types.ClientConfiguration;
|
||||
emrserverless?: AWS.EMRServerless.Types.ClientConfiguration;
|
||||
m2?: AWS.M2.Types.ClientConfiguration;
|
||||
connectcampaigns?: AWS.ConnectCampaigns.Types.ClientConfiguration;
|
||||
redshiftserverless?: AWS.RedshiftServerless.Types.ClientConfiguration;
|
||||
rolesanywhere?: AWS.RolesAnywhere.Types.ClientConfiguration;
|
||||
licensemanagerusersubscriptions?: AWS.LicenseManagerUserSubscriptions.Types.ClientConfiguration;
|
||||
backupstorage?: AWS.BackupStorage.Types.ClientConfiguration;
|
||||
privatenetworks?: AWS.PrivateNetworks.Types.ClientConfiguration;
|
||||
supportapp?: AWS.SupportApp.Types.ClientConfiguration;
|
||||
controltower?: AWS.ControlTower.Types.ClientConfiguration;
|
||||
iotfleetwise?: AWS.IoTFleetWise.Types.ClientConfiguration;
|
||||
migrationhuborchestrator?: AWS.MigrationHubOrchestrator.Types.ClientConfiguration;
|
||||
connectcases?: AWS.ConnectCases.Types.ClientConfiguration;
|
||||
resourceexplorer2?: AWS.ResourceExplorer2.Types.ClientConfiguration;
|
||||
scheduler?: AWS.Scheduler.Types.ClientConfiguration;
|
||||
chimesdkvoice?: AWS.ChimeSDKVoice.Types.ClientConfiguration;
|
||||
iotroborunner?: AWS.IoTRoboRunner.Types.ClientConfiguration;
|
||||
ssmsap?: AWS.SsmSap.Types.ClientConfiguration;
|
||||
oam?: AWS.OAM.Types.ClientConfiguration;
|
||||
arczonalshift?: AWS.ARCZonalShift.Types.ClientConfiguration;
|
||||
omics?: AWS.Omics.Types.ClientConfiguration;
|
||||
opensearchserverless?: AWS.OpenSearchServerless.Types.ClientConfiguration;
|
||||
securitylake?: AWS.SecurityLake.Types.ClientConfiguration;
|
||||
simspaceweaver?: AWS.SimSpaceWeaver.Types.ClientConfiguration;
|
||||
docdbelastic?: AWS.DocDBElastic.Types.ClientConfiguration;
|
||||
sagemakergeospatial?: AWS.SageMakerGeospatial.Types.ClientConfiguration;
|
||||
codecatalyst?: AWS.CodeCatalyst.Types.ClientConfiguration;
|
||||
pipes?: AWS.Pipes.Types.ClientConfiguration;
|
||||
sagemakermetrics?: AWS.SageMakerMetrics.Types.ClientConfiguration;
|
||||
kinesisvideowebrtcstorage?: AWS.KinesisVideoWebRTCStorage.Types.ClientConfiguration;
|
||||
licensemanagerlinuxsubscriptions?: AWS.LicenseManagerLinuxSubscriptions.Types.ClientConfiguration;
|
||||
kendraranking?: AWS.KendraRanking.Types.ClientConfiguration;
|
||||
cleanrooms?: AWS.CleanRooms.Types.ClientConfiguration;
|
||||
cloudtraildata?: AWS.CloudTrailData.Types.ClientConfiguration;
|
||||
tnb?: AWS.Tnb.Types.ClientConfiguration;
|
||||
internetmonitor?: AWS.InternetMonitor.Types.ClientConfiguration;
|
||||
ivsrealtime?: AWS.IVSRealTime.Types.ClientConfiguration;
|
||||
vpclattice?: AWS.VPCLattice.Types.ClientConfiguration;
|
||||
osis?: AWS.OSIS.Types.ClientConfiguration;
|
||||
mediapackagev2?: AWS.MediaPackageV2.Types.ClientConfiguration;
|
||||
paymentcryptography?: AWS.PaymentCryptography.Types.ClientConfiguration;
|
||||
paymentcryptographydata?: AWS.PaymentCryptographyData.Types.ClientConfiguration;
|
||||
codegurusecurity?: AWS.CodeGuruSecurity.Types.ClientConfiguration;
|
||||
verifiedpermissions?: AWS.VerifiedPermissions.Types.ClientConfiguration;
|
||||
appfabric?: AWS.AppFabric.Types.ClientConfiguration;
|
||||
medicalimaging?: AWS.MedicalImaging.Types.ClientConfiguration;
|
||||
entityresolution?: AWS.EntityResolution.Types.ClientConfiguration;
|
||||
managedblockchainquery?: AWS.ManagedBlockchainQuery.Types.ClientConfiguration;
|
||||
neptunedata?: AWS.Neptunedata.Types.ClientConfiguration;
|
||||
pcaconnectorad?: AWS.PcaConnectorAd.Types.ClientConfiguration;
|
||||
bedrock?: AWS.Bedrock.Types.ClientConfiguration;
|
||||
bedrockruntime?: AWS.BedrockRuntime.Types.ClientConfiguration;
|
||||
datazone?: AWS.DataZone.Types.ClientConfiguration;
|
||||
launchwizard?: AWS.LaunchWizard.Types.ClientConfiguration;
|
||||
}
|
||||
export interface ConfigurationServiceApiVersions {
|
||||
acm?: AWS.ACM.Types.apiVersion;
|
||||
apigateway?: AWS.APIGateway.Types.apiVersion;
|
||||
applicationautoscaling?: AWS.ApplicationAutoScaling.Types.apiVersion;
|
||||
appstream?: AWS.AppStream.Types.apiVersion;
|
||||
autoscaling?: AWS.AutoScaling.Types.apiVersion;
|
||||
batch?: AWS.Batch.Types.apiVersion;
|
||||
budgets?: AWS.Budgets.Types.apiVersion;
|
||||
clouddirectory?: AWS.CloudDirectory.Types.apiVersion;
|
||||
cloudformation?: AWS.CloudFormation.Types.apiVersion;
|
||||
cloudfront?: AWS.CloudFront.Types.apiVersion;
|
||||
cloudhsm?: AWS.CloudHSM.Types.apiVersion;
|
||||
cloudsearch?: AWS.CloudSearch.Types.apiVersion;
|
||||
cloudsearchdomain?: AWS.CloudSearchDomain.Types.apiVersion;
|
||||
cloudtrail?: AWS.CloudTrail.Types.apiVersion;
|
||||
cloudwatch?: AWS.CloudWatch.Types.apiVersion;
|
||||
cloudwatchevents?: AWS.CloudWatchEvents.Types.apiVersion;
|
||||
cloudwatchlogs?: AWS.CloudWatchLogs.Types.apiVersion;
|
||||
codebuild?: AWS.CodeBuild.Types.apiVersion;
|
||||
codecommit?: AWS.CodeCommit.Types.apiVersion;
|
||||
codedeploy?: AWS.CodeDeploy.Types.apiVersion;
|
||||
codepipeline?: AWS.CodePipeline.Types.apiVersion;
|
||||
cognitoidentity?: AWS.CognitoIdentity.Types.apiVersion;
|
||||
cognitoidentityserviceprovider?: AWS.CognitoIdentityServiceProvider.Types.apiVersion;
|
||||
cognitosync?: AWS.CognitoSync.Types.apiVersion;
|
||||
configservice?: AWS.ConfigService.Types.apiVersion;
|
||||
cur?: AWS.CUR.Types.apiVersion;
|
||||
datapipeline?: AWS.DataPipeline.Types.apiVersion;
|
||||
devicefarm?: AWS.DeviceFarm.Types.apiVersion;
|
||||
directconnect?: AWS.DirectConnect.Types.apiVersion;
|
||||
directoryservice?: AWS.DirectoryService.Types.apiVersion;
|
||||
discovery?: AWS.Discovery.Types.apiVersion;
|
||||
dms?: AWS.DMS.Types.apiVersion;
|
||||
dynamodb?: AWS.DynamoDB.Types.apiVersion;
|
||||
dynamodbstreams?: AWS.DynamoDBStreams.Types.apiVersion;
|
||||
ec2?: AWS.EC2.Types.apiVersion;
|
||||
ecr?: AWS.ECR.Types.apiVersion;
|
||||
ecs?: AWS.ECS.Types.apiVersion;
|
||||
efs?: AWS.EFS.Types.apiVersion;
|
||||
elasticache?: AWS.ElastiCache.Types.apiVersion;
|
||||
elasticbeanstalk?: AWS.ElasticBeanstalk.Types.apiVersion;
|
||||
elb?: AWS.ELB.Types.apiVersion;
|
||||
elbv2?: AWS.ELBv2.Types.apiVersion;
|
||||
emr?: AWS.EMR.Types.apiVersion;
|
||||
es?: AWS.ES.Types.apiVersion;
|
||||
elastictranscoder?: AWS.ElasticTranscoder.Types.apiVersion;
|
||||
firehose?: AWS.Firehose.Types.apiVersion;
|
||||
gamelift?: AWS.GameLift.Types.apiVersion;
|
||||
glacier?: AWS.Glacier.Types.apiVersion;
|
||||
health?: AWS.Health.Types.apiVersion;
|
||||
iam?: AWS.IAM.Types.apiVersion;
|
||||
importexport?: AWS.ImportExport.Types.apiVersion;
|
||||
inspector?: AWS.Inspector.Types.apiVersion;
|
||||
iot?: AWS.Iot.Types.apiVersion;
|
||||
iotdata?: AWS.IotData.Types.apiVersion;
|
||||
kinesis?: AWS.Kinesis.Types.apiVersion;
|
||||
kinesisanalytics?: AWS.KinesisAnalytics.Types.apiVersion;
|
||||
kms?: AWS.KMS.Types.apiVersion;
|
||||
lambda?: AWS.Lambda.Types.apiVersion;
|
||||
lexruntime?: AWS.LexRuntime.Types.apiVersion;
|
||||
lightsail?: AWS.Lightsail.Types.apiVersion;
|
||||
machinelearning?: AWS.MachineLearning.Types.apiVersion;
|
||||
marketplacecommerceanalytics?: AWS.MarketplaceCommerceAnalytics.Types.apiVersion;
|
||||
marketplacemetering?: AWS.MarketplaceMetering.Types.apiVersion;
|
||||
mturk?: AWS.MTurk.Types.apiVersion;
|
||||
mobileanalytics?: AWS.MobileAnalytics.Types.apiVersion;
|
||||
opsworks?: AWS.OpsWorks.Types.apiVersion;
|
||||
opsworkscm?: AWS.OpsWorksCM.Types.apiVersion;
|
||||
organizations?: AWS.Organizations.Types.apiVersion;
|
||||
pinpoint?: AWS.Pinpoint.Types.apiVersion;
|
||||
polly?: AWS.Polly.Types.apiVersion;
|
||||
rds?: AWS.RDS.Types.apiVersion;
|
||||
redshift?: AWS.Redshift.Types.apiVersion;
|
||||
rekognition?: AWS.Rekognition.Types.apiVersion;
|
||||
resourcegroupstaggingapi?: AWS.ResourceGroupsTaggingAPI.Types.apiVersion;
|
||||
route53?: AWS.Route53.Types.apiVersion;
|
||||
route53domains?: AWS.Route53Domains.Types.apiVersion;
|
||||
s3?: AWS.S3.Types.apiVersion;
|
||||
s3control?: AWS.S3Control.Types.apiVersion;
|
||||
servicecatalog?: AWS.ServiceCatalog.Types.apiVersion;
|
||||
ses?: AWS.SES.Types.apiVersion;
|
||||
shield?: AWS.Shield.Types.apiVersion;
|
||||
simpledb?: AWS.SimpleDB.Types.apiVersion;
|
||||
sms?: AWS.SMS.Types.apiVersion;
|
||||
snowball?: AWS.Snowball.Types.apiVersion;
|
||||
sns?: AWS.SNS.Types.apiVersion;
|
||||
sqs?: AWS.SQS.Types.apiVersion;
|
||||
ssm?: AWS.SSM.Types.apiVersion;
|
||||
storagegateway?: AWS.StorageGateway.Types.apiVersion;
|
||||
stepfunctions?: AWS.StepFunctions.Types.apiVersion;
|
||||
sts?: AWS.STS.Types.apiVersion;
|
||||
support?: AWS.Support.Types.apiVersion;
|
||||
swf?: AWS.SWF.Types.apiVersion;
|
||||
xray?: AWS.XRay.Types.apiVersion;
|
||||
waf?: AWS.WAF.Types.apiVersion;
|
||||
wafregional?: AWS.WAFRegional.Types.apiVersion;
|
||||
workdocs?: AWS.WorkDocs.Types.apiVersion;
|
||||
workspaces?: AWS.WorkSpaces.Types.apiVersion;
|
||||
codestar?: AWS.CodeStar.Types.apiVersion;
|
||||
lexmodelbuildingservice?: AWS.LexModelBuildingService.Types.apiVersion;
|
||||
marketplaceentitlementservice?: AWS.MarketplaceEntitlementService.Types.apiVersion;
|
||||
athena?: AWS.Athena.Types.apiVersion;
|
||||
greengrass?: AWS.Greengrass.Types.apiVersion;
|
||||
dax?: AWS.DAX.Types.apiVersion;
|
||||
migrationhub?: AWS.MigrationHub.Types.apiVersion;
|
||||
cloudhsmv2?: AWS.CloudHSMV2.Types.apiVersion;
|
||||
glue?: AWS.Glue.Types.apiVersion;
|
||||
mobile?: AWS.Mobile.Types.apiVersion;
|
||||
pricing?: AWS.Pricing.Types.apiVersion;
|
||||
costexplorer?: AWS.CostExplorer.Types.apiVersion;
|
||||
mediaconvert?: AWS.MediaConvert.Types.apiVersion;
|
||||
medialive?: AWS.MediaLive.Types.apiVersion;
|
||||
mediapackage?: AWS.MediaPackage.Types.apiVersion;
|
||||
mediastore?: AWS.MediaStore.Types.apiVersion;
|
||||
mediastoredata?: AWS.MediaStoreData.Types.apiVersion;
|
||||
appsync?: AWS.AppSync.Types.apiVersion;
|
||||
guardduty?: AWS.GuardDuty.Types.apiVersion;
|
||||
mq?: AWS.MQ.Types.apiVersion;
|
||||
comprehend?: AWS.Comprehend.Types.apiVersion;
|
||||
iotjobsdataplane?: AWS.IoTJobsDataPlane.Types.apiVersion;
|
||||
kinesisvideoarchivedmedia?: AWS.KinesisVideoArchivedMedia.Types.apiVersion;
|
||||
kinesisvideomedia?: AWS.KinesisVideoMedia.Types.apiVersion;
|
||||
kinesisvideo?: AWS.KinesisVideo.Types.apiVersion;
|
||||
sagemakerruntime?: AWS.SageMakerRuntime.Types.apiVersion;
|
||||
sagemaker?: AWS.SageMaker.Types.apiVersion;
|
||||
translate?: AWS.Translate.Types.apiVersion;
|
||||
resourcegroups?: AWS.ResourceGroups.Types.apiVersion;
|
||||
alexaforbusiness?: AWS.AlexaForBusiness.Types.apiVersion;
|
||||
cloud9?: AWS.Cloud9.Types.apiVersion;
|
||||
serverlessapplicationrepository?: AWS.ServerlessApplicationRepository.Types.apiVersion;
|
||||
servicediscovery?: AWS.ServiceDiscovery.Types.apiVersion;
|
||||
workmail?: AWS.WorkMail.Types.apiVersion;
|
||||
autoscalingplans?: AWS.AutoScalingPlans.Types.apiVersion;
|
||||
transcribeservice?: AWS.TranscribeService.Types.apiVersion;
|
||||
connect?: AWS.Connect.Types.apiVersion;
|
||||
acmpca?: AWS.ACMPCA.Types.apiVersion;
|
||||
fms?: AWS.FMS.Types.apiVersion;
|
||||
secretsmanager?: AWS.SecretsManager.Types.apiVersion;
|
||||
iotanalytics?: AWS.IoTAnalytics.Types.apiVersion;
|
||||
iot1clickdevicesservice?: AWS.IoT1ClickDevicesService.Types.apiVersion;
|
||||
iot1clickprojects?: AWS.IoT1ClickProjects.Types.apiVersion;
|
||||
pi?: AWS.PI.Types.apiVersion;
|
||||
neptune?: AWS.Neptune.Types.apiVersion;
|
||||
mediatailor?: AWS.MediaTailor.Types.apiVersion;
|
||||
eks?: AWS.EKS.Types.apiVersion;
|
||||
macie?: AWS.Macie.Types.apiVersion;
|
||||
dlm?: AWS.DLM.Types.apiVersion;
|
||||
signer?: AWS.Signer.Types.apiVersion;
|
||||
chime?: AWS.Chime.Types.apiVersion;
|
||||
pinpointemail?: AWS.PinpointEmail.Types.apiVersion;
|
||||
ram?: AWS.RAM.Types.apiVersion;
|
||||
route53resolver?: AWS.Route53Resolver.Types.apiVersion;
|
||||
pinpointsmsvoice?: AWS.PinpointSMSVoice.Types.apiVersion;
|
||||
quicksight?: AWS.QuickSight.Types.apiVersion;
|
||||
rdsdataservice?: AWS.RDSDataService.Types.apiVersion;
|
||||
amplify?: AWS.Amplify.Types.apiVersion;
|
||||
datasync?: AWS.DataSync.Types.apiVersion;
|
||||
robomaker?: AWS.RoboMaker.Types.apiVersion;
|
||||
transfer?: AWS.Transfer.Types.apiVersion;
|
||||
globalaccelerator?: AWS.GlobalAccelerator.Types.apiVersion;
|
||||
comprehendmedical?: AWS.ComprehendMedical.Types.apiVersion;
|
||||
kinesisanalyticsv2?: AWS.KinesisAnalyticsV2.Types.apiVersion;
|
||||
mediaconnect?: AWS.MediaConnect.Types.apiVersion;
|
||||
fsx?: AWS.FSx.Types.apiVersion;
|
||||
securityhub?: AWS.SecurityHub.Types.apiVersion;
|
||||
appmesh?: AWS.AppMesh.Types.apiVersion;
|
||||
licensemanager?: AWS.LicenseManager.Types.apiVersion;
|
||||
kafka?: AWS.Kafka.Types.apiVersion;
|
||||
apigatewaymanagementapi?: AWS.ApiGatewayManagementApi.Types.apiVersion;
|
||||
apigatewayv2?: AWS.ApiGatewayV2.Types.apiVersion;
|
||||
docdb?: AWS.DocDB.Types.apiVersion;
|
||||
backup?: AWS.Backup.Types.apiVersion;
|
||||
worklink?: AWS.WorkLink.Types.apiVersion;
|
||||
textract?: AWS.Textract.Types.apiVersion;
|
||||
managedblockchain?: AWS.ManagedBlockchain.Types.apiVersion;
|
||||
mediapackagevod?: AWS.MediaPackageVod.Types.apiVersion;
|
||||
groundstation?: AWS.GroundStation.Types.apiVersion;
|
||||
iotthingsgraph?: AWS.IoTThingsGraph.Types.apiVersion;
|
||||
iotevents?: AWS.IoTEvents.Types.apiVersion;
|
||||
ioteventsdata?: AWS.IoTEventsData.Types.apiVersion;
|
||||
personalize?: AWS.Personalize.Types.apiVersion;
|
||||
personalizeevents?: AWS.PersonalizeEvents.Types.apiVersion;
|
||||
personalizeruntime?: AWS.PersonalizeRuntime.Types.apiVersion;
|
||||
applicationinsights?: AWS.ApplicationInsights.Types.apiVersion;
|
||||
servicequotas?: AWS.ServiceQuotas.Types.apiVersion;
|
||||
ec2instanceconnect?: AWS.EC2InstanceConnect.Types.apiVersion;
|
||||
eventbridge?: AWS.EventBridge.Types.apiVersion;
|
||||
lakeformation?: AWS.LakeFormation.Types.apiVersion;
|
||||
forecastservice?: AWS.ForecastService.Types.apiVersion;
|
||||
forecastqueryservice?: AWS.ForecastQueryService.Types.apiVersion;
|
||||
qldb?: AWS.QLDB.Types.apiVersion;
|
||||
qldbsession?: AWS.QLDBSession.Types.apiVersion;
|
||||
workmailmessageflow?: AWS.WorkMailMessageFlow.Types.apiVersion;
|
||||
codestarnotifications?: AWS.CodeStarNotifications.Types.apiVersion;
|
||||
savingsplans?: AWS.SavingsPlans.Types.apiVersion;
|
||||
sso?: AWS.SSO.Types.apiVersion;
|
||||
ssooidc?: AWS.SSOOIDC.Types.apiVersion;
|
||||
marketplacecatalog?: AWS.MarketplaceCatalog.Types.apiVersion;
|
||||
dataexchange?: AWS.DataExchange.Types.apiVersion;
|
||||
sesv2?: AWS.SESV2.Types.apiVersion;
|
||||
migrationhubconfig?: AWS.MigrationHubConfig.Types.apiVersion;
|
||||
connectparticipant?: AWS.ConnectParticipant.Types.apiVersion;
|
||||
appconfig?: AWS.AppConfig.Types.apiVersion;
|
||||
iotsecuretunneling?: AWS.IoTSecureTunneling.Types.apiVersion;
|
||||
wafv2?: AWS.WAFV2.Types.apiVersion;
|
||||
elasticinference?: AWS.ElasticInference.Types.apiVersion;
|
||||
imagebuilder?: AWS.Imagebuilder.Types.apiVersion;
|
||||
schemas?: AWS.Schemas.Types.apiVersion;
|
||||
accessanalyzer?: AWS.AccessAnalyzer.Types.apiVersion;
|
||||
codegurureviewer?: AWS.CodeGuruReviewer.Types.apiVersion;
|
||||
codeguruprofiler?: AWS.CodeGuruProfiler.Types.apiVersion;
|
||||
computeoptimizer?: AWS.ComputeOptimizer.Types.apiVersion;
|
||||
frauddetector?: AWS.FraudDetector.Types.apiVersion;
|
||||
kendra?: AWS.Kendra.Types.apiVersion;
|
||||
networkmanager?: AWS.NetworkManager.Types.apiVersion;
|
||||
outposts?: AWS.Outposts.Types.apiVersion;
|
||||
augmentedairuntime?: AWS.AugmentedAIRuntime.Types.apiVersion;
|
||||
ebs?: AWS.EBS.Types.apiVersion;
|
||||
kinesisvideosignalingchannels?: AWS.KinesisVideoSignalingChannels.Types.apiVersion;
|
||||
detective?: AWS.Detective.Types.apiVersion;
|
||||
codestarconnections?: AWS.CodeStarconnections.Types.apiVersion;
|
||||
synthetics?: AWS.Synthetics.Types.apiVersion;
|
||||
iotsitewise?: AWS.IoTSiteWise.Types.apiVersion;
|
||||
macie2?: AWS.Macie2.Types.apiVersion;
|
||||
codeartifact?: AWS.CodeArtifact.Types.apiVersion;
|
||||
honeycode?: AWS.Honeycode.Types.apiVersion;
|
||||
ivs?: AWS.IVS.Types.apiVersion;
|
||||
braket?: AWS.Braket.Types.apiVersion;
|
||||
identitystore?: AWS.IdentityStore.Types.apiVersion;
|
||||
appflow?: AWS.Appflow.Types.apiVersion;
|
||||
redshiftdata?: AWS.RedshiftData.Types.apiVersion;
|
||||
ssoadmin?: AWS.SSOAdmin.Types.apiVersion;
|
||||
timestreamquery?: AWS.TimestreamQuery.Types.apiVersion;
|
||||
timestreamwrite?: AWS.TimestreamWrite.Types.apiVersion;
|
||||
s3outposts?: AWS.S3Outposts.Types.apiVersion;
|
||||
databrew?: AWS.DataBrew.Types.apiVersion;
|
||||
servicecatalogappregistry?: AWS.ServiceCatalogAppRegistry.Types.apiVersion;
|
||||
networkfirewall?: AWS.NetworkFirewall.Types.apiVersion;
|
||||
mwaa?: AWS.MWAA.Types.apiVersion;
|
||||
amplifybackend?: AWS.AmplifyBackend.Types.apiVersion;
|
||||
appintegrations?: AWS.AppIntegrations.Types.apiVersion;
|
||||
connectcontactlens?: AWS.ConnectContactLens.Types.apiVersion;
|
||||
devopsguru?: AWS.DevOpsGuru.Types.apiVersion;
|
||||
ecrpublic?: AWS.ECRPUBLIC.Types.apiVersion;
|
||||
lookoutvision?: AWS.LookoutVision.Types.apiVersion;
|
||||
sagemakerfeaturestoreruntime?: AWS.SageMakerFeatureStoreRuntime.Types.apiVersion;
|
||||
customerprofiles?: AWS.CustomerProfiles.Types.apiVersion;
|
||||
auditmanager?: AWS.AuditManager.Types.apiVersion;
|
||||
emrcontainers?: AWS.EMRcontainers.Types.apiVersion;
|
||||
healthlake?: AWS.HealthLake.Types.apiVersion;
|
||||
sagemakeredge?: AWS.SagemakerEdge.Types.apiVersion;
|
||||
amp?: AWS.Amp.Types.apiVersion;
|
||||
greengrassv2?: AWS.GreengrassV2.Types.apiVersion;
|
||||
iotdeviceadvisor?: AWS.IotDeviceAdvisor.Types.apiVersion;
|
||||
iotfleethub?: AWS.IoTFleetHub.Types.apiVersion;
|
||||
iotwireless?: AWS.IoTWireless.Types.apiVersion;
|
||||
location?: AWS.Location.Types.apiVersion;
|
||||
wellarchitected?: AWS.WellArchitected.Types.apiVersion;
|
||||
lexmodelsv2?: AWS.LexModelsV2.Types.apiVersion;
|
||||
lexruntimev2?: AWS.LexRuntimeV2.Types.apiVersion;
|
||||
fis?: AWS.Fis.Types.apiVersion;
|
||||
lookoutmetrics?: AWS.LookoutMetrics.Types.apiVersion;
|
||||
mgn?: AWS.Mgn.Types.apiVersion;
|
||||
lookoutequipment?: AWS.LookoutEquipment.Types.apiVersion;
|
||||
nimble?: AWS.Nimble.Types.apiVersion;
|
||||
finspace?: AWS.Finspace.Types.apiVersion;
|
||||
finspacedata?: AWS.Finspacedata.Types.apiVersion;
|
||||
ssmcontacts?: AWS.SSMContacts.Types.apiVersion;
|
||||
ssmincidents?: AWS.SSMIncidents.Types.apiVersion;
|
||||
applicationcostprofiler?: AWS.ApplicationCostProfiler.Types.apiVersion;
|
||||
apprunner?: AWS.AppRunner.Types.apiVersion;
|
||||
proton?: AWS.Proton.Types.apiVersion;
|
||||
route53recoverycluster?: AWS.Route53RecoveryCluster.Types.apiVersion;
|
||||
route53recoverycontrolconfig?: AWS.Route53RecoveryControlConfig.Types.apiVersion;
|
||||
route53recoveryreadiness?: AWS.Route53RecoveryReadiness.Types.apiVersion;
|
||||
chimesdkidentity?: AWS.ChimeSDKIdentity.Types.apiVersion;
|
||||
chimesdkmessaging?: AWS.ChimeSDKMessaging.Types.apiVersion;
|
||||
snowdevicemanagement?: AWS.SnowDeviceManagement.Types.apiVersion;
|
||||
memorydb?: AWS.MemoryDB.Types.apiVersion;
|
||||
opensearch?: AWS.OpenSearch.Types.apiVersion;
|
||||
kafkaconnect?: AWS.KafkaConnect.Types.apiVersion;
|
||||
voiceid?: AWS.VoiceID.Types.apiVersion;
|
||||
wisdom?: AWS.Wisdom.Types.apiVersion;
|
||||
account?: AWS.Account.Types.apiVersion;
|
||||
cloudcontrol?: AWS.CloudControl.Types.apiVersion;
|
||||
grafana?: AWS.Grafana.Types.apiVersion;
|
||||
panorama?: AWS.Panorama.Types.apiVersion;
|
||||
chimesdkmeetings?: AWS.ChimeSDKMeetings.Types.apiVersion;
|
||||
resiliencehub?: AWS.Resiliencehub.Types.apiVersion;
|
||||
migrationhubstrategy?: AWS.MigrationHubStrategy.Types.apiVersion;
|
||||
appconfigdata?: AWS.AppConfigData.Types.apiVersion;
|
||||
drs?: AWS.Drs.Types.apiVersion;
|
||||
migrationhubrefactorspaces?: AWS.MigrationHubRefactorSpaces.Types.apiVersion;
|
||||
evidently?: AWS.Evidently.Types.apiVersion;
|
||||
inspector2?: AWS.Inspector2.Types.apiVersion;
|
||||
rbin?: AWS.Rbin.Types.apiVersion;
|
||||
rum?: AWS.RUM.Types.apiVersion;
|
||||
backupgateway?: AWS.BackupGateway.Types.apiVersion;
|
||||
iottwinmaker?: AWS.IoTTwinMaker.Types.apiVersion;
|
||||
workspacesweb?: AWS.WorkSpacesWeb.Types.apiVersion;
|
||||
amplifyuibuilder?: AWS.AmplifyUIBuilder.Types.apiVersion;
|
||||
keyspaces?: AWS.Keyspaces.Types.apiVersion;
|
||||
billingconductor?: AWS.Billingconductor.Types.apiVersion;
|
||||
pinpointsmsvoicev2?: AWS.PinpointSMSVoiceV2.Types.apiVersion;
|
||||
ivschat?: AWS.Ivschat.Types.apiVersion;
|
||||
chimesdkmediapipelines?: AWS.ChimeSDKMediaPipelines.Types.apiVersion;
|
||||
emrserverless?: AWS.EMRServerless.Types.apiVersion;
|
||||
m2?: AWS.M2.Types.apiVersion;
|
||||
connectcampaigns?: AWS.ConnectCampaigns.Types.apiVersion;
|
||||
redshiftserverless?: AWS.RedshiftServerless.Types.apiVersion;
|
||||
rolesanywhere?: AWS.RolesAnywhere.Types.apiVersion;
|
||||
licensemanagerusersubscriptions?: AWS.LicenseManagerUserSubscriptions.Types.apiVersion;
|
||||
backupstorage?: AWS.BackupStorage.Types.apiVersion;
|
||||
privatenetworks?: AWS.PrivateNetworks.Types.apiVersion;
|
||||
supportapp?: AWS.SupportApp.Types.apiVersion;
|
||||
controltower?: AWS.ControlTower.Types.apiVersion;
|
||||
iotfleetwise?: AWS.IoTFleetWise.Types.apiVersion;
|
||||
migrationhuborchestrator?: AWS.MigrationHubOrchestrator.Types.apiVersion;
|
||||
connectcases?: AWS.ConnectCases.Types.apiVersion;
|
||||
resourceexplorer2?: AWS.ResourceExplorer2.Types.apiVersion;
|
||||
scheduler?: AWS.Scheduler.Types.apiVersion;
|
||||
chimesdkvoice?: AWS.ChimeSDKVoice.Types.apiVersion;
|
||||
iotroborunner?: AWS.IoTRoboRunner.Types.apiVersion;
|
||||
ssmsap?: AWS.SsmSap.Types.apiVersion;
|
||||
oam?: AWS.OAM.Types.apiVersion;
|
||||
arczonalshift?: AWS.ARCZonalShift.Types.apiVersion;
|
||||
omics?: AWS.Omics.Types.apiVersion;
|
||||
opensearchserverless?: AWS.OpenSearchServerless.Types.apiVersion;
|
||||
securitylake?: AWS.SecurityLake.Types.apiVersion;
|
||||
simspaceweaver?: AWS.SimSpaceWeaver.Types.apiVersion;
|
||||
docdbelastic?: AWS.DocDBElastic.Types.apiVersion;
|
||||
sagemakergeospatial?: AWS.SageMakerGeospatial.Types.apiVersion;
|
||||
codecatalyst?: AWS.CodeCatalyst.Types.apiVersion;
|
||||
pipes?: AWS.Pipes.Types.apiVersion;
|
||||
sagemakermetrics?: AWS.SageMakerMetrics.Types.apiVersion;
|
||||
kinesisvideowebrtcstorage?: AWS.KinesisVideoWebRTCStorage.Types.apiVersion;
|
||||
licensemanagerlinuxsubscriptions?: AWS.LicenseManagerLinuxSubscriptions.Types.apiVersion;
|
||||
kendraranking?: AWS.KendraRanking.Types.apiVersion;
|
||||
cleanrooms?: AWS.CleanRooms.Types.apiVersion;
|
||||
cloudtraildata?: AWS.CloudTrailData.Types.apiVersion;
|
||||
tnb?: AWS.Tnb.Types.apiVersion;
|
||||
internetmonitor?: AWS.InternetMonitor.Types.apiVersion;
|
||||
ivsrealtime?: AWS.IVSRealTime.Types.apiVersion;
|
||||
vpclattice?: AWS.VPCLattice.Types.apiVersion;
|
||||
osis?: AWS.OSIS.Types.apiVersion;
|
||||
mediapackagev2?: AWS.MediaPackageV2.Types.apiVersion;
|
||||
paymentcryptography?: AWS.PaymentCryptography.Types.apiVersion;
|
||||
paymentcryptographydata?: AWS.PaymentCryptographyData.Types.apiVersion;
|
||||
codegurusecurity?: AWS.CodeGuruSecurity.Types.apiVersion;
|
||||
verifiedpermissions?: AWS.VerifiedPermissions.Types.apiVersion;
|
||||
appfabric?: AWS.AppFabric.Types.apiVersion;
|
||||
medicalimaging?: AWS.MedicalImaging.Types.apiVersion;
|
||||
entityresolution?: AWS.EntityResolution.Types.apiVersion;
|
||||
managedblockchainquery?: AWS.ManagedBlockchainQuery.Types.apiVersion;
|
||||
neptunedata?: AWS.Neptunedata.Types.apiVersion;
|
||||
pcaconnectorad?: AWS.PcaConnectorAd.Types.apiVersion;
|
||||
bedrock?: AWS.Bedrock.Types.apiVersion;
|
||||
bedrockruntime?: AWS.BedrockRuntime.Types.apiVersion;
|
||||
datazone?: AWS.DataZone.Types.apiVersion;
|
||||
launchwizard?: AWS.LaunchWizard.Types.apiVersion;
|
||||
}
|
||||
11
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/config_use_dualstack.d.ts
generated
vendored
Normal file
11
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/config_use_dualstack.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import {ConfigBase} from './config-base';
|
||||
|
||||
export interface UseDualstackConfigOptions {
|
||||
/**
|
||||
* Enables IPv6/IPv4 dualstack endpoint. When a DNS lookup is performed on an endpoint of this type, it returns an “A” record with an IPv4 address and an “AAAA” record with an IPv6 address.
|
||||
* In most cases the network stack in the client environment will automatically prefer the AAAA record and make a connection using the IPv6 address.
|
||||
* Note, however, that currently on Windows, the IPv4 address will be preferred.
|
||||
* @deprecated Use {@link ConfigBase.useDualstackEndpoint}
|
||||
*/
|
||||
useDualstack?: boolean;
|
||||
}
|
||||
33
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/core.d.ts
generated
vendored
Normal file
33
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/core.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
export {Config} from './config';
|
||||
export {HTTPOptions, ConfigurationOptions} from './config-base';
|
||||
export {Credentials} from './credentials';
|
||||
export {CognitoIdentityCredentials} from './credentials/cognito_identity_credentials';
|
||||
export {CredentialProviderChain} from './credentials/credential_provider_chain';
|
||||
export {EC2MetadataCredentials} from './credentials/ec2_metadata_credentials';
|
||||
export {RemoteCredentials} from './credentials/remote_credentials';
|
||||
export {ECSCredentials} from './credentials/ecs_credentials';
|
||||
export {EnvironmentCredentials} from './credentials/environment_credentials';
|
||||
export {FileSystemCredentials} from './credentials/file_system_credentials';
|
||||
export {SAMLCredentials} from './credentials/saml_credentials';
|
||||
export {SharedIniFileCredentials} from './credentials/shared_ini_file_credentials';
|
||||
export {SsoCredentials} from './credentials/sso_credentials';
|
||||
export {ProcessCredentials} from './credentials/process_credentials';
|
||||
export {TemporaryCredentials} from './credentials/temporary_credentials';
|
||||
export {ChainableTemporaryCredentials} from './credentials/chainable_temporary_credentials';
|
||||
export {WebIdentityCredentials} from './credentials/web_identity_credentials';
|
||||
export {TokenFileWebIdentityCredentials} from './credentials/token_file_web_identity_credentials';
|
||||
export {Token} from './token';
|
||||
export {StaticTokenProvider} from './token/static_token_provider';
|
||||
export {SSOTokenProvider} from './token/sso_token_provider';
|
||||
export {TokenProviderChain} from './token/token_provider_chain';
|
||||
export {Endpoint} from './endpoint';
|
||||
export {EventListeners} from './event_listeners';
|
||||
export {HttpRequest} from './http_request';
|
||||
export {HttpResponse} from './http_response';
|
||||
export {MetadataService} from './metadata_service';
|
||||
export {Request} from './request';
|
||||
export {Response} from './response';
|
||||
export {Service} from './service';
|
||||
export {AWSError} from './error';
|
||||
export {IniLoader} from './shared-ini/ini-loader';
|
||||
export {DocumentType} from './model';
|
||||
110
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/core.js
generated
vendored
Normal file
110
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/core.js
generated
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
/**
|
||||
* The main AWS namespace
|
||||
*/
|
||||
var AWS = { util: require('./util') };
|
||||
|
||||
/**
|
||||
* @api private
|
||||
* @!macro [new] nobrowser
|
||||
* @note This feature is not supported in the browser environment of the SDK.
|
||||
*/
|
||||
var _hidden = {}; _hidden.toString(); // hack to parse macro
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = AWS;
|
||||
|
||||
AWS.util.update(AWS, {
|
||||
|
||||
/**
|
||||
* @constant
|
||||
*/
|
||||
VERSION: '2.1498.0',
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
Signers: {},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
Protocol: {
|
||||
Json: require('./protocol/json'),
|
||||
Query: require('./protocol/query'),
|
||||
Rest: require('./protocol/rest'),
|
||||
RestJson: require('./protocol/rest_json'),
|
||||
RestXml: require('./protocol/rest_xml')
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
XML: {
|
||||
Builder: require('./xml/builder'),
|
||||
Parser: null // conditionally set based on environment
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
JSON: {
|
||||
Builder: require('./json/builder'),
|
||||
Parser: require('./json/parser')
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
Model: {
|
||||
Api: require('./model/api'),
|
||||
Operation: require('./model/operation'),
|
||||
Shape: require('./model/shape'),
|
||||
Paginator: require('./model/paginator'),
|
||||
ResourceWaiter: require('./model/resource_waiter')
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
apiLoader: require('./api_loader'),
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
EndpointCache: require('../vendor/endpoint-cache').EndpointCache
|
||||
});
|
||||
require('./sequential_executor');
|
||||
require('./service');
|
||||
require('./config');
|
||||
require('./http');
|
||||
require('./event_listeners');
|
||||
require('./request');
|
||||
require('./response');
|
||||
require('./resource_waiter');
|
||||
require('./signers/request_signer');
|
||||
require('./param_validator');
|
||||
require('./maintenance_mode_message');
|
||||
|
||||
/**
|
||||
* @readonly
|
||||
* @return [AWS.SequentialExecutor] a collection of global event listeners that
|
||||
* are attached to every sent request.
|
||||
* @see AWS.Request AWS.Request for a list of events to listen for
|
||||
* @example Logging the time taken to send a request
|
||||
* AWS.events.on('send', function startSend(resp) {
|
||||
* resp.startTime = new Date().getTime();
|
||||
* }).on('complete', function calculateTime(resp) {
|
||||
* var time = (new Date().getTime() - resp.startTime) / 1000;
|
||||
* console.log('Request took ' + time + ' seconds');
|
||||
* });
|
||||
*
|
||||
* new AWS.S3().listBuckets(); // prints 'Request took 0.285 seconds'
|
||||
*/
|
||||
AWS.events = new AWS.SequentialExecutor();
|
||||
|
||||
//create endpoint cache lazily
|
||||
AWS.util.memoizedProperty(AWS, 'endpointCache', function() {
|
||||
return new AWS.EndpointCache(AWS.config.endpointCacheSize);
|
||||
}, true);
|
||||
86
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials.d.ts
generated
vendored
Normal file
86
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials.d.ts
generated
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||
import {AWSError} from './error';
|
||||
export class Credentials {
|
||||
/**
|
||||
* Creates a Credentials object with a given set of credential information as an options hash.
|
||||
*
|
||||
* @param {object} options - An option hash containing a set of credential information.
|
||||
*/
|
||||
constructor(options: CredentialsOptions);
|
||||
/**
|
||||
* Creates a Credentials object with a given set of credential information as positional arguments.
|
||||
*
|
||||
* @param {string} accessKeyId - The AWS access key ID.
|
||||
* @param {string} secretAccessKey - The AWS secret access key.
|
||||
* @param {string} sessionToken - The optional AWS session token.
|
||||
*/
|
||||
constructor(accessKeyId: string, secretAccessKey: string, sessionToken?: string);
|
||||
/**
|
||||
* Gets the existing credentials, refreshing them if they are not yet loaded or have expired.
|
||||
* Users should call this method before using refresh(), as this will not attempt to reload
|
||||
* credentials when they are already loaded into the object.
|
||||
*
|
||||
* @param {get} callback - Called when the instance metadata service responds. When called with no error, the credentials information has been loaded into the object.
|
||||
*/
|
||||
get(callback: (err?: AWSError) => void): void;
|
||||
/**
|
||||
* Gets the existing credentials, refreshing them if necessary, and returns
|
||||
* a promise that will be fulfilled immediately (if no refresh is necessary)
|
||||
* or when the refresh has completed.
|
||||
*/
|
||||
getPromise(): Promise<void>;
|
||||
/**
|
||||
* Returns whether the credentials object should call refresh()
|
||||
*/
|
||||
needsRefresh(): boolean;
|
||||
/**
|
||||
* Refreshes the credentials.
|
||||
* Users should call get() before attempting to forcibly refresh credentials.
|
||||
*
|
||||
* @param {function} callback - Called when the instance metadata service responds. When called with no error, the credentials information has been loaded into the object.
|
||||
*/
|
||||
refresh(callback: (err?: AWSError) => void): void;
|
||||
/**
|
||||
* Invokes a credential refresh and returns a promise that will be fulfilled
|
||||
* when the refresh has completed or rejected when the refresh has failed.
|
||||
* Users should call get() before attempting to forcibly refresh credentials.
|
||||
*/
|
||||
refreshPromise(): Promise<void>;
|
||||
/**
|
||||
* AWS access key ID.
|
||||
*/
|
||||
accessKeyId: string;
|
||||
/**
|
||||
* Whether the credentials have been expired and require a refresh.
|
||||
* Used in conjunction with expireTime.
|
||||
*/
|
||||
expired: boolean;
|
||||
/**
|
||||
* Time when credentials should be considered expired.
|
||||
* Used in conjunction with expired.
|
||||
*/
|
||||
expireTime: Date;
|
||||
static expiryWindow: number;
|
||||
/**
|
||||
* AWS secret access key.
|
||||
*/
|
||||
secretAccessKey: string;
|
||||
/**
|
||||
* AWS session token.
|
||||
*/
|
||||
sessionToken: string;
|
||||
}
|
||||
|
||||
export interface CredentialsOptions {
|
||||
/**
|
||||
* AWS access key ID.
|
||||
*/
|
||||
accessKeyId: string
|
||||
/**
|
||||
* AWS secret access key.
|
||||
*/
|
||||
secretAccessKey: string
|
||||
/**
|
||||
* AWS session token.
|
||||
*/
|
||||
sessionToken?: string
|
||||
}
|
||||
246
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials.js
generated
vendored
Normal file
246
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials.js
generated
vendored
Normal file
@@ -0,0 +1,246 @@
|
||||
var AWS = require('./core');
|
||||
|
||||
/**
|
||||
* Represents your AWS security credentials, specifically the
|
||||
* {accessKeyId}, {secretAccessKey}, and optional {sessionToken}.
|
||||
* Creating a `Credentials` object allows you to pass around your
|
||||
* security information to configuration and service objects.
|
||||
*
|
||||
* Note that this class typically does not need to be constructed manually,
|
||||
* as the {AWS.Config} and {AWS.Service} classes both accept simple
|
||||
* options hashes with the three keys. These structures will be converted
|
||||
* into Credentials objects automatically.
|
||||
*
|
||||
* ## Expiring and Refreshing Credentials
|
||||
*
|
||||
* Occasionally credentials can expire in the middle of a long-running
|
||||
* application. In this case, the SDK will automatically attempt to
|
||||
* refresh the credentials from the storage location if the Credentials
|
||||
* class implements the {refresh} method.
|
||||
*
|
||||
* If you are implementing a credential storage location, you
|
||||
* will want to create a subclass of the `Credentials` class and
|
||||
* override the {refresh} method. This method allows credentials to be
|
||||
* retrieved from the backing store, be it a file system, database, or
|
||||
* some network storage. The method should reset the credential attributes
|
||||
* on the object.
|
||||
*
|
||||
* @!attribute expired
|
||||
* @return [Boolean] whether the credentials have been expired and
|
||||
* require a refresh. Used in conjunction with {expireTime}.
|
||||
* @!attribute expireTime
|
||||
* @return [Date] a time when credentials should be considered expired. Used
|
||||
* in conjunction with {expired}.
|
||||
* @!attribute accessKeyId
|
||||
* @return [String] the AWS access key ID
|
||||
* @!attribute secretAccessKey
|
||||
* @return [String] the AWS secret access key
|
||||
* @!attribute sessionToken
|
||||
* @return [String] an optional AWS session token
|
||||
*/
|
||||
AWS.Credentials = AWS.util.inherit({
|
||||
/**
|
||||
* A credentials object can be created using positional arguments or an options
|
||||
* hash.
|
||||
*
|
||||
* @overload AWS.Credentials(accessKeyId, secretAccessKey, sessionToken=null)
|
||||
* Creates a Credentials object with a given set of credential information
|
||||
* as positional arguments.
|
||||
* @param accessKeyId [String] the AWS access key ID
|
||||
* @param secretAccessKey [String] the AWS secret access key
|
||||
* @param sessionToken [String] the optional AWS session token
|
||||
* @example Create a credentials object with AWS credentials
|
||||
* var creds = new AWS.Credentials('akid', 'secret', 'session');
|
||||
* @overload AWS.Credentials(options)
|
||||
* Creates a Credentials object with a given set of credential information
|
||||
* as an options hash.
|
||||
* @option options accessKeyId [String] the AWS access key ID
|
||||
* @option options secretAccessKey [String] the AWS secret access key
|
||||
* @option options sessionToken [String] the optional AWS session token
|
||||
* @example Create a credentials object with AWS credentials
|
||||
* var creds = new AWS.Credentials({
|
||||
* accessKeyId: 'akid', secretAccessKey: 'secret', sessionToken: 'session'
|
||||
* });
|
||||
*/
|
||||
constructor: function Credentials() {
|
||||
// hide secretAccessKey from being displayed with util.inspect
|
||||
AWS.util.hideProperties(this, ['secretAccessKey']);
|
||||
|
||||
this.expired = false;
|
||||
this.expireTime = null;
|
||||
this.refreshCallbacks = [];
|
||||
if (arguments.length === 1 && typeof arguments[0] === 'object') {
|
||||
var creds = arguments[0].credentials || arguments[0];
|
||||
this.accessKeyId = creds.accessKeyId;
|
||||
this.secretAccessKey = creds.secretAccessKey;
|
||||
this.sessionToken = creds.sessionToken;
|
||||
} else {
|
||||
this.accessKeyId = arguments[0];
|
||||
this.secretAccessKey = arguments[1];
|
||||
this.sessionToken = arguments[2];
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @return [Integer] the number of seconds before {expireTime} during which
|
||||
* the credentials will be considered expired.
|
||||
*/
|
||||
expiryWindow: 15,
|
||||
|
||||
/**
|
||||
* @return [Boolean] whether the credentials object should call {refresh}
|
||||
* @note Subclasses should override this method to provide custom refresh
|
||||
* logic.
|
||||
*/
|
||||
needsRefresh: function needsRefresh() {
|
||||
var currentTime = AWS.util.date.getDate().getTime();
|
||||
var adjustedTime = new Date(currentTime + this.expiryWindow * 1000);
|
||||
|
||||
if (this.expireTime && adjustedTime > this.expireTime) {
|
||||
return true;
|
||||
} else {
|
||||
return this.expired || !this.accessKeyId || !this.secretAccessKey;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Gets the existing credentials, refreshing them if they are not yet loaded
|
||||
* or have expired. Users should call this method before using {refresh},
|
||||
* as this will not attempt to reload credentials when they are already
|
||||
* loaded into the object.
|
||||
*
|
||||
* @callback callback function(err)
|
||||
* When this callback is called with no error, it means either credentials
|
||||
* do not need to be refreshed or refreshed credentials information has
|
||||
* been loaded into the object (as the `accessKeyId`, `secretAccessKey`,
|
||||
* and `sessionToken` properties).
|
||||
* @param err [Error] if an error occurred, this value will be filled
|
||||
*/
|
||||
get: function get(callback) {
|
||||
var self = this;
|
||||
if (this.needsRefresh()) {
|
||||
this.refresh(function(err) {
|
||||
if (!err) self.expired = false; // reset expired flag
|
||||
if (callback) callback(err);
|
||||
});
|
||||
} else if (callback) {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @!method getPromise()
|
||||
* Returns a 'thenable' promise.
|
||||
* Gets the existing credentials, refreshing them if they are not yet loaded
|
||||
* or have expired. Users should call this method before using {refresh},
|
||||
* as this will not attempt to reload credentials when they are already
|
||||
* loaded into the object.
|
||||
*
|
||||
* Two callbacks can be provided to the `then` method on the returned promise.
|
||||
* The first callback will be called if the promise is fulfilled, and the second
|
||||
* callback will be called if the promise is rejected.
|
||||
* @callback fulfilledCallback function()
|
||||
* Called if the promise is fulfilled. When this callback is called, it
|
||||
* means either credentials do not need to be refreshed or refreshed
|
||||
* credentials information has been loaded into the object (as the
|
||||
* `accessKeyId`, `secretAccessKey`, and `sessionToken` properties).
|
||||
* @callback rejectedCallback function(err)
|
||||
* Called if the promise is rejected.
|
||||
* @param err [Error] if an error occurred, this value will be filled
|
||||
* @return [Promise] A promise that represents the state of the `get` call.
|
||||
* @example Calling the `getPromise` method.
|
||||
* var promise = credProvider.getPromise();
|
||||
* promise.then(function() { ... }, function(err) { ... });
|
||||
*/
|
||||
|
||||
/**
|
||||
* @!method refreshPromise()
|
||||
* Returns a 'thenable' promise.
|
||||
* Refreshes the credentials. Users should call {get} before attempting
|
||||
* to forcibly refresh credentials.
|
||||
*
|
||||
* Two callbacks can be provided to the `then` method on the returned promise.
|
||||
* The first callback will be called if the promise is fulfilled, and the second
|
||||
* callback will be called if the promise is rejected.
|
||||
* @callback fulfilledCallback function()
|
||||
* Called if the promise is fulfilled. When this callback is called, it
|
||||
* means refreshed credentials information has been loaded into the object
|
||||
* (as the `accessKeyId`, `secretAccessKey`, and `sessionToken` properties).
|
||||
* @callback rejectedCallback function(err)
|
||||
* Called if the promise is rejected.
|
||||
* @param err [Error] if an error occurred, this value will be filled
|
||||
* @return [Promise] A promise that represents the state of the `refresh` call.
|
||||
* @example Calling the `refreshPromise` method.
|
||||
* var promise = credProvider.refreshPromise();
|
||||
* promise.then(function() { ... }, function(err) { ... });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Refreshes the credentials. Users should call {get} before attempting
|
||||
* to forcibly refresh credentials.
|
||||
*
|
||||
* @callback callback function(err)
|
||||
* When this callback is called with no error, it means refreshed
|
||||
* credentials information has been loaded into the object (as the
|
||||
* `accessKeyId`, `secretAccessKey`, and `sessionToken` properties).
|
||||
* @param err [Error] if an error occurred, this value will be filled
|
||||
* @note Subclasses should override this class to reset the
|
||||
* {accessKeyId}, {secretAccessKey} and optional {sessionToken}
|
||||
* on the credentials object and then call the callback with
|
||||
* any error information.
|
||||
* @see get
|
||||
*/
|
||||
refresh: function refresh(callback) {
|
||||
this.expired = false;
|
||||
callback();
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
* @param callback
|
||||
*/
|
||||
coalesceRefresh: function coalesceRefresh(callback, sync) {
|
||||
var self = this;
|
||||
if (self.refreshCallbacks.push(callback) === 1) {
|
||||
self.load(function onLoad(err) {
|
||||
AWS.util.arrayEach(self.refreshCallbacks, function(callback) {
|
||||
if (sync) {
|
||||
callback(err);
|
||||
} else {
|
||||
// callback could throw, so defer to ensure all callbacks are notified
|
||||
AWS.util.defer(function () {
|
||||
callback(err);
|
||||
});
|
||||
}
|
||||
});
|
||||
self.refreshCallbacks.length = 0;
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
* @param callback
|
||||
*/
|
||||
load: function load(callback) {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
AWS.Credentials.addPromisesToClass = function addPromisesToClass(PromiseDependency) {
|
||||
this.prototype.getPromise = AWS.util.promisifyMethod('get', PromiseDependency);
|
||||
this.prototype.refreshPromise = AWS.util.promisifyMethod('refresh', PromiseDependency);
|
||||
};
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
AWS.Credentials.deletePromisesFromClass = function deletePromisesFromClass() {
|
||||
delete this.prototype.getPromise;
|
||||
delete this.prototype.refreshPromise;
|
||||
};
|
||||
|
||||
AWS.util.addPromises(AWS.Credentials);
|
||||
30
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/chainable_temporary_credentials.d.ts
generated
vendored
Normal file
30
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/chainable_temporary_credentials.d.ts
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import {Credentials} from '../credentials';
|
||||
import {AWSError} from '../error';
|
||||
import STS = require('../../clients/sts');
|
||||
|
||||
export class ChainableTemporaryCredentials extends Credentials {
|
||||
constructor(options: ChainableTemporaryCredentials.ChainableTemporaryCredentialsOptions);
|
||||
/**
|
||||
* Creates a new temporary credentials object.
|
||||
*/
|
||||
constructor(options?: ChainableTemporaryCredentials.ChainableTemporaryCredentialsOptions);
|
||||
/**
|
||||
* Refreshes credentials using AWS.STS.assumeRole() or AWS.STS.getSessionToken(), depending on whether an IAM role ARN was passed to the credentials constructor().
|
||||
*/
|
||||
refresh(callback: (err: AWSError) => void): void;
|
||||
|
||||
/**
|
||||
* The STS service instance used to get and refresh temporary credentials from AWS STS.
|
||||
*/
|
||||
readonly service: STS
|
||||
}
|
||||
|
||||
// Needed to expose interfaces on the class
|
||||
declare namespace ChainableTemporaryCredentials {
|
||||
export type ChainableTemporaryCredentialsOptions = {
|
||||
params?: STS.Types.AssumeRoleRequest|STS.Types.GetSessionTokenRequest,
|
||||
masterCredentials?: Credentials,
|
||||
stsConfig?: STS.Types.ClientConfiguration,
|
||||
tokenCodeFn?: (serialNumber: string, callback: (err?: Error, token?: string) => void) => void
|
||||
}
|
||||
}
|
||||
200
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/chainable_temporary_credentials.js
generated
vendored
Normal file
200
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/chainable_temporary_credentials.js
generated
vendored
Normal file
@@ -0,0 +1,200 @@
|
||||
var AWS = require('../core');
|
||||
var STS = require('../../clients/sts');
|
||||
|
||||
/**
|
||||
* Represents temporary credentials retrieved from {AWS.STS}. Without any
|
||||
* extra parameters, credentials will be fetched from the
|
||||
* {AWS.STS.getSessionToken} operation. If an IAM role is provided, the
|
||||
* {AWS.STS.assumeRole} operation will be used to fetch credentials for the
|
||||
* role instead.
|
||||
*
|
||||
* AWS.ChainableTemporaryCredentials differs from AWS.TemporaryCredentials in
|
||||
* the way masterCredentials and refreshes are handled.
|
||||
* AWS.ChainableTemporaryCredentials refreshes expired credentials using the
|
||||
* masterCredentials passed by the user to support chaining of STS credentials.
|
||||
* However, AWS.TemporaryCredentials recursively collapses the masterCredentials
|
||||
* during instantiation, precluding the ability to refresh credentials which
|
||||
* require intermediate, temporary credentials.
|
||||
*
|
||||
* For example, if the application should use RoleA, which must be assumed from
|
||||
* RoleB, and the environment provides credentials which can assume RoleB, then
|
||||
* AWS.ChainableTemporaryCredentials must be used to support refreshing the
|
||||
* temporary credentials for RoleA:
|
||||
*
|
||||
* ```javascript
|
||||
* var roleACreds = new AWS.ChainableTemporaryCredentials({
|
||||
* params: {RoleArn: 'RoleA'},
|
||||
* masterCredentials: new AWS.ChainableTemporaryCredentials({
|
||||
* params: {RoleArn: 'RoleB'},
|
||||
* masterCredentials: new AWS.EnvironmentCredentials('AWS')
|
||||
* })
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* If AWS.TemporaryCredentials had been used in the previous example,
|
||||
* `roleACreds` would fail to refresh because `roleACreds` would
|
||||
* use the environment credentials for the AssumeRole request.
|
||||
*
|
||||
* Another difference is that AWS.ChainableTemporaryCredentials creates the STS
|
||||
* service instance during instantiation while AWS.TemporaryCredentials creates
|
||||
* the STS service instance during the first refresh. Creating the service
|
||||
* instance during instantiation effectively captures the master credentials
|
||||
* from the global config, so that subsequent changes to the global config do
|
||||
* not affect the master credentials used to refresh the temporary credentials.
|
||||
*
|
||||
* This allows an instance of AWS.ChainableTemporaryCredentials to be assigned
|
||||
* to AWS.config.credentials:
|
||||
*
|
||||
* ```javascript
|
||||
* var envCreds = new AWS.EnvironmentCredentials('AWS');
|
||||
* AWS.config.credentials = envCreds;
|
||||
* // masterCredentials will be envCreds
|
||||
* AWS.config.credentials = new AWS.ChainableTemporaryCredentials({
|
||||
* params: {RoleArn: '...'}
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* Similarly, to use the CredentialProviderChain's default providers as the
|
||||
* master credentials, simply create a new instance of
|
||||
* AWS.ChainableTemporaryCredentials:
|
||||
*
|
||||
* ```javascript
|
||||
* AWS.config.credentials = new ChainableTemporaryCredentials({
|
||||
* params: {RoleArn: '...'}
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @!attribute service
|
||||
* @return [AWS.STS] the STS service instance used to
|
||||
* get and refresh temporary credentials from AWS STS.
|
||||
* @note (see constructor)
|
||||
*/
|
||||
AWS.ChainableTemporaryCredentials = AWS.util.inherit(AWS.Credentials, {
|
||||
/**
|
||||
* Creates a new temporary credentials object.
|
||||
*
|
||||
* @param options [map] a set of options
|
||||
* @option options params [map] ({}) a map of options that are passed to the
|
||||
* {AWS.STS.assumeRole} or {AWS.STS.getSessionToken} operations.
|
||||
* If a `RoleArn` parameter is passed in, credentials will be based on the
|
||||
* IAM role. If a `SerialNumber` parameter is passed in, {tokenCodeFn} must
|
||||
* also be passed in or an error will be thrown.
|
||||
* @option options masterCredentials [AWS.Credentials] the master credentials
|
||||
* used to get and refresh temporary credentials from AWS STS. By default,
|
||||
* AWS.config.credentials or AWS.config.credentialProvider will be used.
|
||||
* @option options tokenCodeFn [Function] (null) Function to provide
|
||||
* `TokenCode`, if `SerialNumber` is provided for profile in {params}. Function
|
||||
* is called with value of `SerialNumber` and `callback`, and should provide
|
||||
* the `TokenCode` or an error to the callback in the format
|
||||
* `callback(err, token)`.
|
||||
* @example Creating a new credentials object for generic temporary credentials
|
||||
* AWS.config.credentials = new AWS.ChainableTemporaryCredentials();
|
||||
* @example Creating a new credentials object for an IAM role
|
||||
* AWS.config.credentials = new AWS.ChainableTemporaryCredentials({
|
||||
* params: {
|
||||
* RoleArn: 'arn:aws:iam::1234567890:role/TemporaryCredentials'
|
||||
* }
|
||||
* });
|
||||
* @see AWS.STS.assumeRole
|
||||
* @see AWS.STS.getSessionToken
|
||||
*/
|
||||
constructor: function ChainableTemporaryCredentials(options) {
|
||||
AWS.Credentials.call(this);
|
||||
options = options || {};
|
||||
this.errorCode = 'ChainableTemporaryCredentialsProviderFailure';
|
||||
this.expired = true;
|
||||
this.tokenCodeFn = null;
|
||||
|
||||
var params = AWS.util.copy(options.params) || {};
|
||||
if (params.RoleArn) {
|
||||
params.RoleSessionName = params.RoleSessionName || 'temporary-credentials';
|
||||
}
|
||||
if (params.SerialNumber) {
|
||||
if (!options.tokenCodeFn || (typeof options.tokenCodeFn !== 'function')) {
|
||||
throw new AWS.util.error(
|
||||
new Error('tokenCodeFn must be a function when params.SerialNumber is given'),
|
||||
{code: this.errorCode}
|
||||
);
|
||||
} else {
|
||||
this.tokenCodeFn = options.tokenCodeFn;
|
||||
}
|
||||
}
|
||||
var config = AWS.util.merge(
|
||||
{
|
||||
params: params,
|
||||
credentials: options.masterCredentials || AWS.config.credentials
|
||||
},
|
||||
options.stsConfig || {}
|
||||
);
|
||||
this.service = new STS(config);
|
||||
},
|
||||
|
||||
/**
|
||||
* Refreshes credentials using {AWS.STS.assumeRole} or
|
||||
* {AWS.STS.getSessionToken}, depending on whether an IAM role ARN was passed
|
||||
* to the credentials {constructor}.
|
||||
*
|
||||
* @callback callback function(err)
|
||||
* Called when the STS service responds (or fails). When
|
||||
* this callback is called with no error, it means that the credentials
|
||||
* information has been loaded into the object (as the `accessKeyId`,
|
||||
* `secretAccessKey`, and `sessionToken` properties).
|
||||
* @param err [Error] if an error occurred, this value will be filled
|
||||
* @see AWS.Credentials.get
|
||||
*/
|
||||
refresh: function refresh(callback) {
|
||||
this.coalesceRefresh(callback || AWS.util.fn.callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
* @param callback
|
||||
*/
|
||||
load: function load(callback) {
|
||||
var self = this;
|
||||
var operation = self.service.config.params.RoleArn ? 'assumeRole' : 'getSessionToken';
|
||||
this.getTokenCode(function (err, tokenCode) {
|
||||
var params = {};
|
||||
if (err) {
|
||||
callback(err);
|
||||
return;
|
||||
}
|
||||
if (tokenCode) {
|
||||
params.TokenCode = tokenCode;
|
||||
}
|
||||
self.service[operation](params, function (err, data) {
|
||||
if (!err) {
|
||||
self.service.credentialsFrom(data, self);
|
||||
}
|
||||
callback(err);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
getTokenCode: function getTokenCode(callback) {
|
||||
var self = this;
|
||||
if (this.tokenCodeFn) {
|
||||
this.tokenCodeFn(this.service.config.params.SerialNumber, function (err, token) {
|
||||
if (err) {
|
||||
var message = err;
|
||||
if (err instanceof Error) {
|
||||
message = err.message;
|
||||
}
|
||||
callback(
|
||||
AWS.util.error(
|
||||
new Error('Error fetching MFA token: ' + message),
|
||||
{ code: self.errorCode}
|
||||
)
|
||||
);
|
||||
return;
|
||||
}
|
||||
callback(null, token);
|
||||
});
|
||||
} else {
|
||||
callback(null);
|
||||
}
|
||||
}
|
||||
});
|
||||
43
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/cognito_identity_credentials.d.ts
generated
vendored
Normal file
43
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/cognito_identity_credentials.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import {Credentials} from '../credentials';
|
||||
import {AWSError} from '../error';
|
||||
import {ConfigurationOptions} from '../config-base';
|
||||
import CognitoIdentity = require('../../clients/cognitoidentity');
|
||||
import STS = require('../../clients/sts');
|
||||
|
||||
export class CognitoIdentityCredentials extends Credentials {
|
||||
/**
|
||||
* Creates a new credentials object with optional configuration.
|
||||
*/
|
||||
constructor(options: CognitoIdentityCredentials.CognitoIdentityOptions, clientConfig?: ConfigurationOptions);
|
||||
/**
|
||||
* Creates a new credentials object.
|
||||
*/
|
||||
constructor(options?: CognitoIdentityCredentials.CognitoIdentityOptions);
|
||||
/**
|
||||
* Refreshes credentials using AWS.CognitoIdentity.getCredentialsForIdentity(), or AWS.STS.assumeRoleWithWebIdentity().
|
||||
*/
|
||||
refresh(callback: (err?: AWSError) => void): void;
|
||||
/**
|
||||
* Clears the cached Cognito ID associated with the currently configured identity pool ID.
|
||||
*/
|
||||
clearCachedId(): void;
|
||||
/**
|
||||
* The raw data response from the call to AWS.CognitoIdentity.getCredentialsForIdentity(), or AWS.STS.assumeRoleWithWebIdentity().
|
||||
*/
|
||||
data: CognitoIdentity.Types.GetCredentialsForIdentityResponse|STS.Types.AssumeRoleWithWebIdentityResponse;
|
||||
/**
|
||||
* The Cognito ID returned by the last call to AWS.CognitoIdentity.getOpenIdToken().
|
||||
*/
|
||||
identityId: string;
|
||||
/**
|
||||
* The map of params passed to AWS.CognitoIdentity.getId(), AWS.CognitoIdentity.getOpenIdToken(), and AWS.STS.assumeRoleWithWebIdentity().
|
||||
*/
|
||||
params: CognitoIdentity.Types.GetIdInput|CognitoIdentity.Types.GetOpenIdTokenInput|STS.Types.AssumeRoleWithWebIdentityRequest;
|
||||
}
|
||||
|
||||
// Needed to expose interfaces on the class
|
||||
declare namespace CognitoIdentityCredentials {
|
||||
export type CognitoIdentityCredentialsInputs = CognitoIdentity.GetIdInput|CognitoIdentity.GetCredentialsForIdentityInput|CognitoIdentity.GetOpenIdTokenInput|STS.AssumeRoleWithWebIdentityRequest;
|
||||
export type CognitoIdentityOptions = CognitoIdentityCredentialsInputs & {LoginId?: string};
|
||||
export type ClientConfiguration = ConfigurationOptions;
|
||||
}
|
||||
385
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/cognito_identity_credentials.js
generated
vendored
Normal file
385
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/cognito_identity_credentials.js
generated
vendored
Normal file
@@ -0,0 +1,385 @@
|
||||
var AWS = require('../core');
|
||||
var CognitoIdentity = require('../../clients/cognitoidentity');
|
||||
var STS = require('../../clients/sts');
|
||||
|
||||
/**
|
||||
* Represents credentials retrieved from STS Web Identity Federation using
|
||||
* the Amazon Cognito Identity service.
|
||||
*
|
||||
* By default this provider gets credentials using the
|
||||
* {AWS.CognitoIdentity.getCredentialsForIdentity} service operation, which
|
||||
* requires either an `IdentityId` or an `IdentityPoolId` (Amazon Cognito
|
||||
* Identity Pool ID), which is used to call {AWS.CognitoIdentity.getId} to
|
||||
* obtain an `IdentityId`. If the identity or identity pool is not configured in
|
||||
* the Amazon Cognito Console to use IAM roles with the appropriate permissions,
|
||||
* then additionally a `RoleArn` is required containing the ARN of the IAM trust
|
||||
* policy for the Amazon Cognito role that the user will log into. If a `RoleArn`
|
||||
* is provided, then this provider gets credentials using the
|
||||
* {AWS.STS.assumeRoleWithWebIdentity} service operation, after first getting an
|
||||
* Open ID token from {AWS.CognitoIdentity.getOpenIdToken}.
|
||||
*
|
||||
* In addition, if this credential provider is used to provide authenticated
|
||||
* login, the `Logins` map may be set to the tokens provided by the respective
|
||||
* identity providers. See {constructor} for an example on creating a credentials
|
||||
* object with proper property values.
|
||||
*
|
||||
* ## Refreshing Credentials from Identity Service
|
||||
*
|
||||
* In addition to AWS credentials expiring after a given amount of time, the
|
||||
* login token from the identity provider will also expire. Once this token
|
||||
* expires, it will not be usable to refresh AWS credentials, and another
|
||||
* token will be needed. The SDK does not manage refreshing of the token value,
|
||||
* but this can be done through a "refresh token" supported by most identity
|
||||
* providers. Consult the documentation for the identity provider for refreshing
|
||||
* tokens. Once the refreshed token is acquired, you should make sure to update
|
||||
* this new token in the credentials object's {params} property. The following
|
||||
* code will update the WebIdentityToken, assuming you have retrieved an updated
|
||||
* token from the identity provider:
|
||||
*
|
||||
* ```javascript
|
||||
* AWS.config.credentials.params.Logins['graph.facebook.com'] = updatedToken;
|
||||
* ```
|
||||
*
|
||||
* Future calls to `credentials.refresh()` will now use the new token.
|
||||
*
|
||||
* @!attribute params
|
||||
* @return [map] the map of params passed to
|
||||
* {AWS.CognitoIdentity.getId},
|
||||
* {AWS.CognitoIdentity.getOpenIdToken}, and
|
||||
* {AWS.STS.assumeRoleWithWebIdentity}. To update the token, set the
|
||||
* `params.WebIdentityToken` property.
|
||||
* @!attribute data
|
||||
* @return [map] the raw data response from the call to
|
||||
* {AWS.CognitoIdentity.getCredentialsForIdentity}, or
|
||||
* {AWS.STS.assumeRoleWithWebIdentity}. Use this if you want to get
|
||||
* access to other properties from the response.
|
||||
* @!attribute identityId
|
||||
* @return [String] the Cognito ID returned by the last call to
|
||||
* {AWS.CognitoIdentity.getOpenIdToken}. This ID represents the actual
|
||||
* final resolved identity ID from Amazon Cognito.
|
||||
*/
|
||||
AWS.CognitoIdentityCredentials = AWS.util.inherit(AWS.Credentials, {
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
localStorageKey: {
|
||||
id: 'aws.cognito.identity-id.',
|
||||
providers: 'aws.cognito.identity-providers.'
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates a new credentials object.
|
||||
* @example Creating a new credentials object
|
||||
* AWS.config.credentials = new AWS.CognitoIdentityCredentials({
|
||||
*
|
||||
* // either IdentityPoolId or IdentityId is required
|
||||
* // See the IdentityPoolId param for AWS.CognitoIdentity.getID (linked below)
|
||||
* // See the IdentityId param for AWS.CognitoIdentity.getCredentialsForIdentity
|
||||
* // or AWS.CognitoIdentity.getOpenIdToken (linked below)
|
||||
* IdentityPoolId: 'us-east-1:1699ebc0-7900-4099-b910-2df94f52a030',
|
||||
* IdentityId: 'us-east-1:128d0a74-c82f-4553-916d-90053e4a8b0f'
|
||||
*
|
||||
* // optional, only necessary when the identity pool is not configured
|
||||
* // to use IAM roles in the Amazon Cognito Console
|
||||
* // See the RoleArn param for AWS.STS.assumeRoleWithWebIdentity (linked below)
|
||||
* RoleArn: 'arn:aws:iam::1234567890:role/MYAPP-CognitoIdentity',
|
||||
*
|
||||
* // optional tokens, used for authenticated login
|
||||
* // See the Logins param for AWS.CognitoIdentity.getID (linked below)
|
||||
* Logins: {
|
||||
* 'graph.facebook.com': 'FBTOKEN',
|
||||
* 'www.amazon.com': 'AMAZONTOKEN',
|
||||
* 'accounts.google.com': 'GOOGLETOKEN',
|
||||
* 'api.twitter.com': 'TWITTERTOKEN',
|
||||
* 'www.digits.com': 'DIGITSTOKEN'
|
||||
* },
|
||||
*
|
||||
* // optional name, defaults to web-identity
|
||||
* // See the RoleSessionName param for AWS.STS.assumeRoleWithWebIdentity (linked below)
|
||||
* RoleSessionName: 'web',
|
||||
*
|
||||
* // optional, only necessary when application runs in a browser
|
||||
* // and multiple users are signed in at once, used for caching
|
||||
* LoginId: 'example@gmail.com'
|
||||
*
|
||||
* }, {
|
||||
* // optionally provide configuration to apply to the underlying service clients
|
||||
* // if configuration is not provided, then configuration will be pulled from AWS.config
|
||||
*
|
||||
* // region should match the region your identity pool is located in
|
||||
* region: 'us-east-1',
|
||||
*
|
||||
* // specify timeout options
|
||||
* httpOptions: {
|
||||
* timeout: 100
|
||||
* }
|
||||
* });
|
||||
* @see AWS.CognitoIdentity.getId
|
||||
* @see AWS.CognitoIdentity.getCredentialsForIdentity
|
||||
* @see AWS.STS.assumeRoleWithWebIdentity
|
||||
* @see AWS.CognitoIdentity.getOpenIdToken
|
||||
* @see AWS.Config
|
||||
* @note If a region is not provided in the global AWS.config, or
|
||||
* specified in the `clientConfig` to the CognitoIdentityCredentials
|
||||
* constructor, you may encounter a 'Missing credentials in config' error
|
||||
* when calling making a service call.
|
||||
*/
|
||||
constructor: function CognitoIdentityCredentials(params, clientConfig) {
|
||||
AWS.Credentials.call(this);
|
||||
this.expired = true;
|
||||
this.params = params;
|
||||
this.data = null;
|
||||
this._identityId = null;
|
||||
this._clientConfig = AWS.util.copy(clientConfig || {});
|
||||
this.loadCachedId();
|
||||
var self = this;
|
||||
Object.defineProperty(this, 'identityId', {
|
||||
get: function() {
|
||||
self.loadCachedId();
|
||||
return self._identityId || self.params.IdentityId;
|
||||
},
|
||||
set: function(identityId) {
|
||||
self._identityId = identityId;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Refreshes credentials using {AWS.CognitoIdentity.getCredentialsForIdentity},
|
||||
* or {AWS.STS.assumeRoleWithWebIdentity}.
|
||||
*
|
||||
* @callback callback function(err)
|
||||
* Called when the STS service responds (or fails). When
|
||||
* this callback is called with no error, it means that the credentials
|
||||
* information has been loaded into the object (as the `accessKeyId`,
|
||||
* `secretAccessKey`, and `sessionToken` properties).
|
||||
* @param err [Error] if an error occurred, this value will be filled
|
||||
* @see AWS.Credentials.get
|
||||
*/
|
||||
refresh: function refresh(callback) {
|
||||
this.coalesceRefresh(callback || AWS.util.fn.callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
* @param callback
|
||||
*/
|
||||
load: function load(callback) {
|
||||
var self = this;
|
||||
self.createClients();
|
||||
self.data = null;
|
||||
self._identityId = null;
|
||||
self.getId(function(err) {
|
||||
if (!err) {
|
||||
if (!self.params.RoleArn) {
|
||||
self.getCredentialsForIdentity(callback);
|
||||
} else {
|
||||
self.getCredentialsFromSTS(callback);
|
||||
}
|
||||
} else {
|
||||
self.clearIdOnNotAuthorized(err);
|
||||
callback(err);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Clears the cached Cognito ID associated with the currently configured
|
||||
* identity pool ID. Use this to manually invalidate your cache if
|
||||
* the identity pool ID was deleted.
|
||||
*/
|
||||
clearCachedId: function clearCache() {
|
||||
this._identityId = null;
|
||||
delete this.params.IdentityId;
|
||||
|
||||
var poolId = this.params.IdentityPoolId;
|
||||
var loginId = this.params.LoginId || '';
|
||||
delete this.storage[this.localStorageKey.id + poolId + loginId];
|
||||
delete this.storage[this.localStorageKey.providers + poolId + loginId];
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
clearIdOnNotAuthorized: function clearIdOnNotAuthorized(err) {
|
||||
var self = this;
|
||||
if (err.code == 'NotAuthorizedException') {
|
||||
self.clearCachedId();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Retrieves a Cognito ID, loading from cache if it was already retrieved
|
||||
* on this device.
|
||||
*
|
||||
* @callback callback function(err, identityId)
|
||||
* @param err [Error, null] an error object if the call failed or null if
|
||||
* it succeeded.
|
||||
* @param identityId [String, null] if successful, the callback will return
|
||||
* the Cognito ID.
|
||||
* @note If not loaded explicitly, the Cognito ID is loaded and stored in
|
||||
* localStorage in the browser environment of a device.
|
||||
* @api private
|
||||
*/
|
||||
getId: function getId(callback) {
|
||||
var self = this;
|
||||
if (typeof self.params.IdentityId === 'string') {
|
||||
return callback(null, self.params.IdentityId);
|
||||
}
|
||||
|
||||
self.cognito.getId(function(err, data) {
|
||||
if (!err && data.IdentityId) {
|
||||
self.params.IdentityId = data.IdentityId;
|
||||
callback(null, data.IdentityId);
|
||||
} else {
|
||||
callback(err);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
loadCredentials: function loadCredentials(data, credentials) {
|
||||
if (!data || !credentials) return;
|
||||
credentials.expired = false;
|
||||
credentials.accessKeyId = data.Credentials.AccessKeyId;
|
||||
credentials.secretAccessKey = data.Credentials.SecretKey;
|
||||
credentials.sessionToken = data.Credentials.SessionToken;
|
||||
credentials.expireTime = data.Credentials.Expiration;
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
getCredentialsForIdentity: function getCredentialsForIdentity(callback) {
|
||||
var self = this;
|
||||
self.cognito.getCredentialsForIdentity(function(err, data) {
|
||||
if (!err) {
|
||||
self.cacheId(data);
|
||||
self.data = data;
|
||||
self.loadCredentials(self.data, self);
|
||||
} else {
|
||||
self.clearIdOnNotAuthorized(err);
|
||||
}
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
getCredentialsFromSTS: function getCredentialsFromSTS(callback) {
|
||||
var self = this;
|
||||
self.cognito.getOpenIdToken(function(err, data) {
|
||||
if (!err) {
|
||||
self.cacheId(data);
|
||||
self.params.WebIdentityToken = data.Token;
|
||||
self.webIdentityCredentials.refresh(function(webErr) {
|
||||
if (!webErr) {
|
||||
self.data = self.webIdentityCredentials.data;
|
||||
self.sts.credentialsFrom(self.data, self);
|
||||
}
|
||||
callback(webErr);
|
||||
});
|
||||
} else {
|
||||
self.clearIdOnNotAuthorized(err);
|
||||
callback(err);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
loadCachedId: function loadCachedId() {
|
||||
var self = this;
|
||||
|
||||
// in the browser we source default IdentityId from localStorage
|
||||
if (AWS.util.isBrowser() && !self.params.IdentityId) {
|
||||
var id = self.getStorage('id');
|
||||
if (id && self.params.Logins) {
|
||||
var actualProviders = Object.keys(self.params.Logins);
|
||||
var cachedProviders =
|
||||
(self.getStorage('providers') || '').split(',');
|
||||
|
||||
// only load ID if at least one provider used this ID before
|
||||
var intersect = cachedProviders.filter(function(n) {
|
||||
return actualProviders.indexOf(n) !== -1;
|
||||
});
|
||||
if (intersect.length !== 0) {
|
||||
self.params.IdentityId = id;
|
||||
}
|
||||
} else if (id) {
|
||||
self.params.IdentityId = id;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
createClients: function() {
|
||||
var clientConfig = this._clientConfig;
|
||||
this.webIdentityCredentials = this.webIdentityCredentials ||
|
||||
new AWS.WebIdentityCredentials(this.params, clientConfig);
|
||||
if (!this.cognito) {
|
||||
var cognitoConfig = AWS.util.merge({}, clientConfig);
|
||||
cognitoConfig.params = this.params;
|
||||
this.cognito = new CognitoIdentity(cognitoConfig);
|
||||
}
|
||||
this.sts = this.sts || new STS(clientConfig);
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
cacheId: function cacheId(data) {
|
||||
this._identityId = data.IdentityId;
|
||||
this.params.IdentityId = this._identityId;
|
||||
|
||||
// cache this IdentityId in browser localStorage if possible
|
||||
if (AWS.util.isBrowser()) {
|
||||
this.setStorage('id', data.IdentityId);
|
||||
|
||||
if (this.params.Logins) {
|
||||
this.setStorage('providers', Object.keys(this.params.Logins).join(','));
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
getStorage: function getStorage(key) {
|
||||
return this.storage[this.localStorageKey[key] + this.params.IdentityPoolId + (this.params.LoginId || '')];
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
setStorage: function setStorage(key, val) {
|
||||
try {
|
||||
this.storage[this.localStorageKey[key] + this.params.IdentityPoolId + (this.params.LoginId || '')] = val;
|
||||
} catch (_) {}
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
storage: (function() {
|
||||
try {
|
||||
var storage = AWS.util.isBrowser() && window.localStorage !== null && typeof window.localStorage === 'object' ?
|
||||
window.localStorage : {};
|
||||
|
||||
// Test set/remove which would throw an error in Safari's private browsing
|
||||
storage['aws.test-storage'] = 'foobar';
|
||||
delete storage['aws.test-storage'];
|
||||
|
||||
return storage;
|
||||
} catch (_) {
|
||||
return {};
|
||||
}
|
||||
})()
|
||||
});
|
||||
24
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/credential_provider_chain.d.ts
generated
vendored
Normal file
24
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/credential_provider_chain.d.ts
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import {Credentials} from '../credentials';
|
||||
import {AWSError} from '../error';
|
||||
export class CredentialProviderChain {
|
||||
/**
|
||||
* Creates a new CredentialProviderChain with a default set of providers specified by defaultProviders.
|
||||
*/
|
||||
constructor(providers?: provider[])
|
||||
/**
|
||||
* Resolves the provider chain by searching for the first set of credentials in providers.
|
||||
*/
|
||||
resolve(callback:(err: AWSError|null, credentials?: Credentials) => void): CredentialProviderChain;
|
||||
/**
|
||||
* Return a Promise on resolve() function
|
||||
*/
|
||||
resolvePromise(): Promise<Credentials>;
|
||||
/**
|
||||
* Returns a list of credentials objects or functions that return credentials objects. If the provider is a function, the function will be executed lazily when the provider needs to be checked for valid credentials. By default, this object will be set to the defaultProviders.
|
||||
*/
|
||||
providers: Array<Credentials|provider>;
|
||||
|
||||
static defaultProviders: provider[]
|
||||
}
|
||||
|
||||
type provider = () => Credentials;
|
||||
180
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/credential_provider_chain.js
generated
vendored
Normal file
180
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/credential_provider_chain.js
generated
vendored
Normal file
@@ -0,0 +1,180 @@
|
||||
var AWS = require('../core');
|
||||
|
||||
/**
|
||||
* Creates a credential provider chain that searches for AWS credentials
|
||||
* in a list of credential providers specified by the {providers} property.
|
||||
*
|
||||
* By default, the chain will use the {defaultProviders} to resolve credentials.
|
||||
* These providers will look in the environment using the
|
||||
* {AWS.EnvironmentCredentials} class with the 'AWS' and 'AMAZON' prefixes.
|
||||
*
|
||||
* ## Setting Providers
|
||||
*
|
||||
* Each provider in the {providers} list should be a function that returns
|
||||
* a {AWS.Credentials} object, or a hardcoded credentials object. The function
|
||||
* form allows for delayed execution of the credential construction.
|
||||
*
|
||||
* ## Resolving Credentials from a Chain
|
||||
*
|
||||
* Call {resolve} to return the first valid credential object that can be
|
||||
* loaded by the provider chain.
|
||||
*
|
||||
* For example, to resolve a chain with a custom provider that checks a file
|
||||
* on disk after the set of {defaultProviders}:
|
||||
*
|
||||
* ```javascript
|
||||
* var diskProvider = new AWS.FileSystemCredentials('./creds.json');
|
||||
* var chain = new AWS.CredentialProviderChain();
|
||||
* chain.providers.push(diskProvider);
|
||||
* chain.resolve();
|
||||
* ```
|
||||
*
|
||||
* The above code will return the `diskProvider` object if the
|
||||
* file contains credentials and the `defaultProviders` do not contain
|
||||
* any credential settings.
|
||||
*
|
||||
* @!attribute providers
|
||||
* @return [Array<AWS.Credentials, Function>]
|
||||
* a list of credentials objects or functions that return credentials
|
||||
* objects. If the provider is a function, the function will be
|
||||
* executed lazily when the provider needs to be checked for valid
|
||||
* credentials. By default, this object will be set to the
|
||||
* {defaultProviders}.
|
||||
* @see defaultProviders
|
||||
*/
|
||||
AWS.CredentialProviderChain = AWS.util.inherit(AWS.Credentials, {
|
||||
|
||||
/**
|
||||
* Creates a new CredentialProviderChain with a default set of providers
|
||||
* specified by {defaultProviders}.
|
||||
*/
|
||||
constructor: function CredentialProviderChain(providers) {
|
||||
if (providers) {
|
||||
this.providers = providers;
|
||||
} else {
|
||||
this.providers = AWS.CredentialProviderChain.defaultProviders.slice(0);
|
||||
}
|
||||
this.resolveCallbacks = [];
|
||||
},
|
||||
|
||||
/**
|
||||
* @!method resolvePromise()
|
||||
* Returns a 'thenable' promise.
|
||||
* Resolves the provider chain by searching for the first set of
|
||||
* credentials in {providers}.
|
||||
*
|
||||
* Two callbacks can be provided to the `then` method on the returned promise.
|
||||
* The first callback will be called if the promise is fulfilled, and the second
|
||||
* callback will be called if the promise is rejected.
|
||||
* @callback fulfilledCallback function(credentials)
|
||||
* Called if the promise is fulfilled and the provider resolves the chain
|
||||
* to a credentials object
|
||||
* @param credentials [AWS.Credentials] the credentials object resolved
|
||||
* by the provider chain.
|
||||
* @callback rejectedCallback function(error)
|
||||
* Called if the promise is rejected.
|
||||
* @param err [Error] the error object returned if no credentials are found.
|
||||
* @return [Promise] A promise that represents the state of the `resolve` method call.
|
||||
* @example Calling the `resolvePromise` method.
|
||||
* var promise = chain.resolvePromise();
|
||||
* promise.then(function(credentials) { ... }, function(err) { ... });
|
||||
*/
|
||||
|
||||
/**
|
||||
* Resolves the provider chain by searching for the first set of
|
||||
* credentials in {providers}.
|
||||
*
|
||||
* @callback callback function(err, credentials)
|
||||
* Called when the provider resolves the chain to a credentials object
|
||||
* or null if no credentials can be found.
|
||||
*
|
||||
* @param err [Error] the error object returned if no credentials are
|
||||
* found.
|
||||
* @param credentials [AWS.Credentials] the credentials object resolved
|
||||
* by the provider chain.
|
||||
* @return [AWS.CredentialProviderChain] the provider, for chaining.
|
||||
*/
|
||||
resolve: function resolve(callback) {
|
||||
var self = this;
|
||||
if (self.providers.length === 0) {
|
||||
callback(new Error('No providers'));
|
||||
return self;
|
||||
}
|
||||
|
||||
if (self.resolveCallbacks.push(callback) === 1) {
|
||||
var index = 0;
|
||||
var providers = self.providers.slice(0);
|
||||
|
||||
function resolveNext(err, creds) {
|
||||
if ((!err && creds) || index === providers.length) {
|
||||
AWS.util.arrayEach(self.resolveCallbacks, function (callback) {
|
||||
callback(err, creds);
|
||||
});
|
||||
self.resolveCallbacks.length = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
var provider = providers[index++];
|
||||
if (typeof provider === 'function') {
|
||||
creds = provider.call();
|
||||
} else {
|
||||
creds = provider;
|
||||
}
|
||||
|
||||
if (creds.get) {
|
||||
creds.get(function (getErr) {
|
||||
resolveNext(getErr, getErr ? null : creds);
|
||||
});
|
||||
} else {
|
||||
resolveNext(null, creds);
|
||||
}
|
||||
}
|
||||
|
||||
resolveNext();
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* The default set of providers used by a vanilla CredentialProviderChain.
|
||||
*
|
||||
* In the browser:
|
||||
*
|
||||
* ```javascript
|
||||
* AWS.CredentialProviderChain.defaultProviders = []
|
||||
* ```
|
||||
*
|
||||
* In Node.js:
|
||||
*
|
||||
* ```javascript
|
||||
* AWS.CredentialProviderChain.defaultProviders = [
|
||||
* function () { return new AWS.EnvironmentCredentials('AWS'); },
|
||||
* function () { return new AWS.EnvironmentCredentials('AMAZON'); },
|
||||
* function () { return new AWS.SsoCredentials(); },
|
||||
* function () { return new AWS.SharedIniFileCredentials(); },
|
||||
* function () { return new AWS.ECSCredentials(); },
|
||||
* function () { return new AWS.ProcessCredentials(); },
|
||||
* function () { return new AWS.TokenFileWebIdentityCredentials(); },
|
||||
* function () { return new AWS.EC2MetadataCredentials() }
|
||||
* ]
|
||||
* ```
|
||||
*/
|
||||
AWS.CredentialProviderChain.defaultProviders = [];
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
AWS.CredentialProviderChain.addPromisesToClass = function addPromisesToClass(PromiseDependency) {
|
||||
this.prototype.resolvePromise = AWS.util.promisifyMethod('resolve', PromiseDependency);
|
||||
};
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
AWS.CredentialProviderChain.deletePromisesFromClass = function deletePromisesFromClass() {
|
||||
delete this.prototype.resolvePromise;
|
||||
};
|
||||
|
||||
AWS.util.addPromises(AWS.CredentialProviderChain);
|
||||
45
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/ec2_metadata_credentials.d.ts
generated
vendored
Normal file
45
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/ec2_metadata_credentials.d.ts
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
import {Credentials} from '../credentials';
|
||||
import {Logger} from '../config-base';
|
||||
|
||||
export class EC2MetadataCredentials extends Credentials {
|
||||
/**
|
||||
* Creates credentials from the metadata service on an EC2 instance.
|
||||
* @param {object} options - Override the default (1s) timeout period.
|
||||
*/
|
||||
constructor(options?: EC2MetadataCredentialsOptions);
|
||||
|
||||
/**
|
||||
* The original expiration of the current credential. In case of AWS
|
||||
* outage, the EC2 metadata will extend expiration of the existing
|
||||
* credential.
|
||||
*/
|
||||
originalExpiration?: Date;
|
||||
}
|
||||
interface EC2MetadataCredentialsOptions {
|
||||
httpOptions?: {
|
||||
/**
|
||||
* Timeout in milliseconds.
|
||||
*/
|
||||
timeout?: number
|
||||
/**
|
||||
* Connection timeout in milliseconds.
|
||||
*/
|
||||
connectTimeout?: number
|
||||
}
|
||||
maxRetries?: number
|
||||
logger?: Logger
|
||||
/**
|
||||
* Prevent IMDSv1 fallback.
|
||||
*/
|
||||
ec2MetadataV1Disabled?: boolean
|
||||
|
||||
/**
|
||||
* profile name to check for IMDSv1 settings.
|
||||
*/
|
||||
profile?: string
|
||||
|
||||
/**
|
||||
* optional file from which to to get config.
|
||||
*/
|
||||
filename?: string
|
||||
}
|
||||
165
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/ec2_metadata_credentials.js
generated
vendored
Normal file
165
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/ec2_metadata_credentials.js
generated
vendored
Normal file
@@ -0,0 +1,165 @@
|
||||
var AWS = require('../core');
|
||||
require('../metadata_service');
|
||||
|
||||
/**
|
||||
* Represents credentials received from the metadata service on an EC2 instance.
|
||||
*
|
||||
* By default, this class will connect to the metadata service using
|
||||
* {AWS.MetadataService} and attempt to load any available credentials. If it
|
||||
* can connect, and credentials are available, these will be used with zero
|
||||
* configuration.
|
||||
*
|
||||
* This credentials class will by default timeout after 1 second of inactivity
|
||||
* and retry 3 times.
|
||||
* If your requests to the EC2 metadata service are timing out, you can increase
|
||||
* these values by configuring them directly:
|
||||
*
|
||||
* ```javascript
|
||||
* AWS.config.credentials = new AWS.EC2MetadataCredentials({
|
||||
* httpOptions: { timeout: 5000 }, // 5 second timeout
|
||||
* maxRetries: 10, // retry 10 times
|
||||
* retryDelayOptions: { base: 200 }, // see AWS.Config for information
|
||||
* logger: console // see AWS.Config for information
|
||||
* ec2MetadataV1Disabled: false // whether to block IMDS v1 fallback.
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* If your requests are timing out in connecting to the metadata service, such
|
||||
* as when testing on a development machine, you can use the connectTimeout
|
||||
* option, specified in milliseconds, which also defaults to 1 second.
|
||||
*
|
||||
* If the requests failed or returns expired credentials, it will
|
||||
* extend the expiration of current credential, with a warning message. For more
|
||||
* information, please go to:
|
||||
* https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html
|
||||
*
|
||||
* @!attribute originalExpiration
|
||||
* @return [Date] The optional original expiration of the current credential.
|
||||
* In case of AWS outage, the EC2 metadata will extend expiration of the
|
||||
* existing credential.
|
||||
*
|
||||
* @see AWS.Config.retryDelayOptions
|
||||
* @see AWS.Config.logger
|
||||
*
|
||||
* @!macro nobrowser
|
||||
*/
|
||||
AWS.EC2MetadataCredentials = AWS.util.inherit(AWS.Credentials, {
|
||||
constructor: function EC2MetadataCredentials(options) {
|
||||
AWS.Credentials.call(this);
|
||||
|
||||
options = options ? AWS.util.copy(options) : {};
|
||||
options = AWS.util.merge(
|
||||
{maxRetries: this.defaultMaxRetries}, options);
|
||||
if (!options.httpOptions) options.httpOptions = {};
|
||||
options.httpOptions = AWS.util.merge(
|
||||
{timeout: this.defaultTimeout,
|
||||
connectTimeout: this.defaultConnectTimeout},
|
||||
options.httpOptions);
|
||||
|
||||
this.metadataService = new AWS.MetadataService(options);
|
||||
this.logger = options.logger || AWS.config && AWS.config.logger;
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
defaultTimeout: 1000,
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
defaultConnectTimeout: 1000,
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
defaultMaxRetries: 3,
|
||||
|
||||
/**
|
||||
* The original expiration of the current credential. In case of AWS
|
||||
* outage, the EC2 metadata will extend expiration of the existing
|
||||
* credential.
|
||||
*/
|
||||
originalExpiration: undefined,
|
||||
|
||||
/**
|
||||
* Loads the credentials from the instance metadata service
|
||||
*
|
||||
* @callback callback function(err)
|
||||
* Called when the instance metadata service responds (or fails). When
|
||||
* this callback is called with no error, it means that the credentials
|
||||
* information has been loaded into the object (as the `accessKeyId`,
|
||||
* `secretAccessKey`, and `sessionToken` properties).
|
||||
* @param err [Error] if an error occurred, this value will be filled
|
||||
* @see get
|
||||
*/
|
||||
refresh: function refresh(callback) {
|
||||
this.coalesceRefresh(callback || AWS.util.fn.callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
* @param callback
|
||||
*/
|
||||
load: function load(callback) {
|
||||
var self = this;
|
||||
self.metadataService.loadCredentials(function(err, creds) {
|
||||
if (err) {
|
||||
if (self.hasLoadedCredentials()) {
|
||||
self.extendExpirationIfExpired();
|
||||
callback();
|
||||
} else {
|
||||
callback(err);
|
||||
}
|
||||
} else {
|
||||
self.setCredentials(creds);
|
||||
self.extendExpirationIfExpired();
|
||||
callback();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Whether this credential has been loaded.
|
||||
* @api private
|
||||
*/
|
||||
hasLoadedCredentials: function hasLoadedCredentials() {
|
||||
return this.AccessKeyId && this.secretAccessKey;
|
||||
},
|
||||
|
||||
/**
|
||||
* if expired, extend the expiration by 15 minutes base plus a jitter of 5
|
||||
* minutes range.
|
||||
* @api private
|
||||
*/
|
||||
extendExpirationIfExpired: function extendExpirationIfExpired() {
|
||||
if (this.needsRefresh()) {
|
||||
this.originalExpiration = this.originalExpiration || this.expireTime;
|
||||
this.expired = false;
|
||||
var nextTimeout = 15 * 60 + Math.floor(Math.random() * 5 * 60);
|
||||
var currentTime = AWS.util.date.getDate().getTime();
|
||||
this.expireTime = new Date(currentTime + nextTimeout * 1000);
|
||||
// TODO: add doc link;
|
||||
this.logger.warn('Attempting credential expiration extension due to a '
|
||||
+ 'credential service availability issue. A refresh of these '
|
||||
+ 'credentials will be attempted again at ' + this.expireTime
|
||||
+ '\nFor more information, please visit: https://docs.aws.amazon.com/sdkref/latest/guide/feature-static-credentials.html');
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Update the credential with new credential responded from EC2 metadata
|
||||
* service.
|
||||
* @api private
|
||||
*/
|
||||
setCredentials: function setCredentials(creds) {
|
||||
var currentTime = AWS.util.date.getDate().getTime();
|
||||
var expireTime = new Date(creds.Expiration);
|
||||
this.expired = currentTime >= expireTime ? true : false;
|
||||
this.metadata = creds;
|
||||
this.accessKeyId = creds.AccessKeyId;
|
||||
this.secretAccessKey = creds.SecretAccessKey;
|
||||
this.sessionToken = creds.Token;
|
||||
this.expireTime = expireTime;
|
||||
}
|
||||
});
|
||||
17
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/ecs_credentials.d.ts
generated
vendored
Normal file
17
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/ecs_credentials.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import {RemoteCredentials} from './remote_credentials';
|
||||
export class ECSCredentials extends RemoteCredentials {
|
||||
/**
|
||||
* Represents credentials received.
|
||||
* @param {object} options - Override the default (1s) timeout period.
|
||||
*/
|
||||
constructor(options?: ECSCredentialsOptions);
|
||||
}
|
||||
interface ECSCredentialsOptions {
|
||||
httpOptions?: {
|
||||
/**
|
||||
* Timeout in milliseconds.
|
||||
*/
|
||||
timeout?: number
|
||||
}
|
||||
maxRetries?: number
|
||||
}
|
||||
28
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/ecs_credentials.js
generated
vendored
Normal file
28
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/ecs_credentials.js
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
var AWS = require('../core');
|
||||
|
||||
/**
|
||||
* Represents credentials received from relative URI specified in the ECS container.
|
||||
*
|
||||
* This class will request refreshable credentials from the relative URI
|
||||
* specified by the AWS_CONTAINER_CREDENTIALS_RELATIVE_URI or the
|
||||
* AWS_CONTAINER_CREDENTIALS_FULL_URI environment variable. If valid credentials
|
||||
* are returned in the response, these will be used with zero configuration.
|
||||
*
|
||||
* This credentials class will by default timeout after 1 second of inactivity
|
||||
* and retry 3 times.
|
||||
* If your requests to the relative URI are timing out, you can increase
|
||||
* the value by configuring them directly:
|
||||
*
|
||||
* ```javascript
|
||||
* AWS.config.credentials = new AWS.ECSCredentials({
|
||||
* httpOptions: { timeout: 5000 }, // 5 second timeout
|
||||
* maxRetries: 10, // retry 10 times
|
||||
* retryDelayOptions: { base: 200 } // see AWS.Config for information
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @see AWS.Config.retryDelayOptions
|
||||
*
|
||||
* @!macro nobrowser
|
||||
*/
|
||||
AWS.ECSCredentials = AWS.RemoteCredentials;
|
||||
8
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/environment_credentials.d.ts
generated
vendored
Normal file
8
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/environment_credentials.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import {Credentials} from '../credentials';
|
||||
export class EnvironmentCredentials extends Credentials {
|
||||
/**
|
||||
* Creates a new EnvironmentCredentials class with a given variable prefix envPrefix.
|
||||
* @param {string} envPrefix - The prefix for the environment variable names excluding the separating underscore.
|
||||
*/
|
||||
constructor(envPrefix: string);
|
||||
}
|
||||
91
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/environment_credentials.js
generated
vendored
Normal file
91
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/environment_credentials.js
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
var AWS = require('../core');
|
||||
|
||||
/**
|
||||
* Represents credentials from the environment.
|
||||
*
|
||||
* By default, this class will look for the matching environment variables
|
||||
* prefixed by a given {envPrefix}. The un-prefixed environment variable names
|
||||
* for each credential value is listed below:
|
||||
*
|
||||
* ```javascript
|
||||
* accessKeyId: ACCESS_KEY_ID
|
||||
* secretAccessKey: SECRET_ACCESS_KEY
|
||||
* sessionToken: SESSION_TOKEN
|
||||
* ```
|
||||
*
|
||||
* With the default prefix of 'AWS', the environment variables would be:
|
||||
*
|
||||
* AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN
|
||||
*
|
||||
* @!attribute envPrefix
|
||||
* @readonly
|
||||
* @return [String] the prefix for the environment variable names excluding
|
||||
* the separating underscore ('_').
|
||||
*/
|
||||
AWS.EnvironmentCredentials = AWS.util.inherit(AWS.Credentials, {
|
||||
|
||||
/**
|
||||
* Creates a new EnvironmentCredentials class with a given variable
|
||||
* prefix {envPrefix}. For example, to load credentials using the 'AWS'
|
||||
* prefix:
|
||||
*
|
||||
* ```javascript
|
||||
* var creds = new AWS.EnvironmentCredentials('AWS');
|
||||
* creds.accessKeyId == 'AKID' // from AWS_ACCESS_KEY_ID env var
|
||||
* ```
|
||||
*
|
||||
* @param envPrefix [String] the prefix to use (e.g., 'AWS') for environment
|
||||
* variables. Do not include the separating underscore.
|
||||
*/
|
||||
constructor: function EnvironmentCredentials(envPrefix) {
|
||||
AWS.Credentials.call(this);
|
||||
this.envPrefix = envPrefix;
|
||||
this.get(function() {});
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads credentials from the environment using the prefixed
|
||||
* environment variables.
|
||||
*
|
||||
* @callback callback function(err)
|
||||
* Called after the (prefixed) ACCESS_KEY_ID, SECRET_ACCESS_KEY, and
|
||||
* SESSION_TOKEN environment variables are read. When this callback is
|
||||
* called with no error, it means that the credentials information has
|
||||
* been loaded into the object (as the `accessKeyId`, `secretAccessKey`,
|
||||
* and `sessionToken` properties).
|
||||
* @param err [Error] if an error occurred, this value will be filled
|
||||
* @see get
|
||||
*/
|
||||
refresh: function refresh(callback) {
|
||||
if (!callback) callback = AWS.util.fn.callback;
|
||||
|
||||
if (!process || !process.env) {
|
||||
callback(AWS.util.error(
|
||||
new Error('No process info or environment variables available'),
|
||||
{ code: 'EnvironmentCredentialsProviderFailure' }
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
||||
var keys = ['ACCESS_KEY_ID', 'SECRET_ACCESS_KEY', 'SESSION_TOKEN'];
|
||||
var values = [];
|
||||
|
||||
for (var i = 0; i < keys.length; i++) {
|
||||
var prefix = '';
|
||||
if (this.envPrefix) prefix = this.envPrefix + '_';
|
||||
values[i] = process.env[prefix + keys[i]];
|
||||
if (!values[i] && keys[i] !== 'SESSION_TOKEN') {
|
||||
callback(AWS.util.error(
|
||||
new Error('Variable ' + prefix + keys[i] + ' not set.'),
|
||||
{ code: 'EnvironmentCredentialsProviderFailure' }
|
||||
));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.expired = false;
|
||||
AWS.Credentials.apply(this, values);
|
||||
callback();
|
||||
}
|
||||
|
||||
});
|
||||
12
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/file_system_credentials.d.ts
generated
vendored
Normal file
12
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/file_system_credentials.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import {Credentials} from '../credentials';
|
||||
export class FileSystemCredentials extends Credentials {
|
||||
/**
|
||||
* Creates a new FileSystemCredentials object from a filename.
|
||||
* @param {string} filename - The path on disk to the JSON file to load.
|
||||
*/
|
||||
constructor(filename: string);
|
||||
/**
|
||||
* The path to the JSON file on disk containing the credentials.
|
||||
*/
|
||||
filename: string
|
||||
}
|
||||
68
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/file_system_credentials.js
generated
vendored
Normal file
68
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/file_system_credentials.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
var AWS = require('../core');
|
||||
|
||||
/**
|
||||
* Represents credentials from a JSON file on disk.
|
||||
* If the credentials expire, the SDK can {refresh} the credentials
|
||||
* from the file.
|
||||
*
|
||||
* The format of the file should be similar to the options passed to
|
||||
* {AWS.Config}:
|
||||
*
|
||||
* ```javascript
|
||||
* {accessKeyId: 'akid', secretAccessKey: 'secret', sessionToken: 'optional'}
|
||||
* ```
|
||||
*
|
||||
* @example Loading credentials from disk
|
||||
* var creds = new AWS.FileSystemCredentials('./configuration.json');
|
||||
* creds.accessKeyId == 'AKID'
|
||||
*
|
||||
* @!attribute filename
|
||||
* @readonly
|
||||
* @return [String] the path to the JSON file on disk containing the
|
||||
* credentials.
|
||||
* @!macro nobrowser
|
||||
*/
|
||||
AWS.FileSystemCredentials = AWS.util.inherit(AWS.Credentials, {
|
||||
|
||||
/**
|
||||
* @overload AWS.FileSystemCredentials(filename)
|
||||
* Creates a new FileSystemCredentials object from a filename
|
||||
*
|
||||
* @param filename [String] the path on disk to the JSON file to load.
|
||||
*/
|
||||
constructor: function FileSystemCredentials(filename) {
|
||||
AWS.Credentials.call(this);
|
||||
this.filename = filename;
|
||||
this.get(function() {});
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads the credentials from the {filename} on disk.
|
||||
*
|
||||
* @callback callback function(err)
|
||||
* Called after the JSON file on disk is read and parsed. When this callback
|
||||
* is called with no error, it means that the credentials information
|
||||
* has been loaded into the object (as the `accessKeyId`, `secretAccessKey`,
|
||||
* and `sessionToken` properties).
|
||||
* @param err [Error] if an error occurred, this value will be filled
|
||||
* @see get
|
||||
*/
|
||||
refresh: function refresh(callback) {
|
||||
if (!callback) callback = AWS.util.fn.callback;
|
||||
try {
|
||||
var creds = JSON.parse(AWS.util.readFileSync(this.filename));
|
||||
AWS.Credentials.call(this, creds);
|
||||
if (!this.accessKeyId || !this.secretAccessKey) {
|
||||
throw AWS.util.error(
|
||||
new Error('Credentials not set in ' + this.filename),
|
||||
{ code: 'FileSystemCredentialsProviderFailure' }
|
||||
);
|
||||
}
|
||||
this.expired = false;
|
||||
callback();
|
||||
} catch (err) {
|
||||
callback(err);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
14
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/process_credentials.d.ts
generated
vendored
Normal file
14
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/process_credentials.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import {Credentials} from '../credentials';
|
||||
import {HTTPOptions} from '../config-base';
|
||||
export class ProcessCredentials extends Credentials {
|
||||
/**
|
||||
* Creates a new ProcessCredentials object.
|
||||
*/
|
||||
constructor(options?: ProcessCredentialsOptions);
|
||||
}
|
||||
|
||||
interface ProcessCredentialsOptions {
|
||||
profile?: string
|
||||
filename?: string
|
||||
httpOptions?: HTTPOptions
|
||||
}
|
||||
165
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/process_credentials.js
generated
vendored
Normal file
165
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/process_credentials.js
generated
vendored
Normal file
@@ -0,0 +1,165 @@
|
||||
var AWS = require('../core');
|
||||
var proc = require('child_process');
|
||||
var iniLoader = AWS.util.iniLoader;
|
||||
|
||||
/**
|
||||
* Represents credentials loaded from shared credentials file
|
||||
* (defaulting to ~/.aws/credentials or defined by the
|
||||
* `AWS_SHARED_CREDENTIALS_FILE` environment variable).
|
||||
*
|
||||
* ## Using process credentials
|
||||
*
|
||||
* The credentials file can specify a credential provider that executes
|
||||
* a given process and attempts to read its stdout to recieve a JSON payload
|
||||
* containing the credentials:
|
||||
*
|
||||
* [default]
|
||||
* credential_process = /usr/bin/credential_proc
|
||||
*
|
||||
* Automatically handles refreshing credentials if an Expiration time is
|
||||
* provided in the credentials payload. Credentials supplied in the same profile
|
||||
* will take precedence over the credential_process.
|
||||
*
|
||||
* Sourcing credentials from an external process can potentially be dangerous,
|
||||
* so proceed with caution. Other credential providers should be preferred if
|
||||
* at all possible. If using this option, you should make sure that the shared
|
||||
* credentials file is as locked down as possible using security best practices
|
||||
* for your operating system.
|
||||
*
|
||||
* ## Using custom profiles
|
||||
*
|
||||
* The SDK supports loading credentials for separate profiles. This can be done
|
||||
* in two ways:
|
||||
*
|
||||
* 1. Set the `AWS_PROFILE` environment variable in your process prior to
|
||||
* loading the SDK.
|
||||
* 2. Directly load the AWS.ProcessCredentials provider:
|
||||
*
|
||||
* ```javascript
|
||||
* var creds = new AWS.ProcessCredentials({profile: 'myprofile'});
|
||||
* AWS.config.credentials = creds;
|
||||
* ```
|
||||
*
|
||||
* @!macro nobrowser
|
||||
*/
|
||||
AWS.ProcessCredentials = AWS.util.inherit(AWS.Credentials, {
|
||||
/**
|
||||
* Creates a new ProcessCredentials object.
|
||||
*
|
||||
* @param options [map] a set of options
|
||||
* @option options profile [String] (AWS_PROFILE env var or 'default')
|
||||
* the name of the profile to load.
|
||||
* @option options filename [String] ('~/.aws/credentials' or defined by
|
||||
* AWS_SHARED_CREDENTIALS_FILE process env var)
|
||||
* the filename to use when loading credentials.
|
||||
* @option options callback [Function] (err) Credentials are eagerly loaded
|
||||
* by the constructor. When the callback is called with no error, the
|
||||
* credentials have been loaded successfully.
|
||||
*/
|
||||
constructor: function ProcessCredentials(options) {
|
||||
AWS.Credentials.call(this);
|
||||
|
||||
options = options || {};
|
||||
|
||||
this.filename = options.filename;
|
||||
this.profile = options.profile || process.env.AWS_PROFILE || AWS.util.defaultProfile;
|
||||
this.get(options.callback || AWS.util.fn.noop);
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
load: function load(callback) {
|
||||
var self = this;
|
||||
try {
|
||||
var profiles = AWS.util.getProfilesFromSharedConfig(iniLoader, this.filename);
|
||||
var profile = profiles[this.profile] || {};
|
||||
|
||||
if (Object.keys(profile).length === 0) {
|
||||
throw AWS.util.error(
|
||||
new Error('Profile ' + this.profile + ' not found'),
|
||||
{ code: 'ProcessCredentialsProviderFailure' }
|
||||
);
|
||||
}
|
||||
|
||||
if (profile['credential_process']) {
|
||||
this.loadViaCredentialProcess(profile, function(err, data) {
|
||||
if (err) {
|
||||
callback(err, null);
|
||||
} else {
|
||||
self.expired = false;
|
||||
self.accessKeyId = data.AccessKeyId;
|
||||
self.secretAccessKey = data.SecretAccessKey;
|
||||
self.sessionToken = data.SessionToken;
|
||||
if (data.Expiration) {
|
||||
self.expireTime = new Date(data.Expiration);
|
||||
}
|
||||
callback(null);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
throw AWS.util.error(
|
||||
new Error('Profile ' + this.profile + ' did not include credential process'),
|
||||
{ code: 'ProcessCredentialsProviderFailure' }
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
callback(err);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Executes the credential_process and retrieves
|
||||
* credentials from the output
|
||||
* @api private
|
||||
* @param profile [map] credentials profile
|
||||
* @throws ProcessCredentialsProviderFailure
|
||||
*/
|
||||
loadViaCredentialProcess: function loadViaCredentialProcess(profile, callback) {
|
||||
proc.exec(profile['credential_process'], { env: process.env }, function(err, stdOut, stdErr) {
|
||||
if (err) {
|
||||
callback(AWS.util.error(
|
||||
new Error('credential_process returned error'),
|
||||
{ code: 'ProcessCredentialsProviderFailure'}
|
||||
), null);
|
||||
} else {
|
||||
try {
|
||||
var credData = JSON.parse(stdOut);
|
||||
if (credData.Expiration) {
|
||||
var currentTime = AWS.util.date.getDate();
|
||||
var expireTime = new Date(credData.Expiration);
|
||||
if (expireTime < currentTime) {
|
||||
throw Error('credential_process returned expired credentials');
|
||||
}
|
||||
}
|
||||
|
||||
if (credData.Version !== 1) {
|
||||
throw Error('credential_process does not return Version == 1');
|
||||
}
|
||||
callback(null, credData);
|
||||
} catch (err) {
|
||||
callback(AWS.util.error(
|
||||
new Error(err.message),
|
||||
{ code: 'ProcessCredentialsProviderFailure'}
|
||||
), null);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads the credentials from the credential process
|
||||
*
|
||||
* @callback callback function(err)
|
||||
* Called after the credential process has been executed. When this
|
||||
* callback is called with no error, it means that the credentials
|
||||
* information has been loaded into the object (as the `accessKeyId`,
|
||||
* `secretAccessKey`, and `sessionToken` properties).
|
||||
* @param err [Error] if an error occurred, this value will be filled
|
||||
* @see get
|
||||
*/
|
||||
refresh: function refresh(callback) {
|
||||
iniLoader.clearCachedFiles();
|
||||
this.coalesceRefresh(callback || AWS.util.fn.callback);
|
||||
}
|
||||
});
|
||||
17
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/remote_credentials.d.ts
generated
vendored
Normal file
17
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/remote_credentials.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import {Credentials} from '../credentials';
|
||||
export class RemoteCredentials extends Credentials {
|
||||
/**
|
||||
* Represents credentials received.
|
||||
* @param {object} options - Override the default (1s) timeout period.
|
||||
*/
|
||||
constructor(options?: RemoteCredentialsOptions);
|
||||
}
|
||||
interface RemoteCredentialsOptions {
|
||||
httpOptions?: {
|
||||
/**
|
||||
* Timeout in milliseconds.
|
||||
*/
|
||||
timeout?: number
|
||||
}
|
||||
maxRetries?: number
|
||||
}
|
||||
208
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/remote_credentials.js
generated
vendored
Normal file
208
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/remote_credentials.js
generated
vendored
Normal file
@@ -0,0 +1,208 @@
|
||||
var AWS = require('../core'),
|
||||
ENV_RELATIVE_URI = 'AWS_CONTAINER_CREDENTIALS_RELATIVE_URI',
|
||||
ENV_FULL_URI = 'AWS_CONTAINER_CREDENTIALS_FULL_URI',
|
||||
ENV_AUTH_TOKEN = 'AWS_CONTAINER_AUTHORIZATION_TOKEN',
|
||||
FULL_URI_UNRESTRICTED_PROTOCOLS = ['https:'],
|
||||
FULL_URI_ALLOWED_PROTOCOLS = ['http:', 'https:'],
|
||||
FULL_URI_ALLOWED_HOSTNAMES = ['localhost', '127.0.0.1'],
|
||||
RELATIVE_URI_HOST = '169.254.170.2';
|
||||
|
||||
/**
|
||||
* Represents credentials received from specified URI.
|
||||
*
|
||||
* This class will request refreshable credentials from the relative URI
|
||||
* specified by the AWS_CONTAINER_CREDENTIALS_RELATIVE_URI or the
|
||||
* AWS_CONTAINER_CREDENTIALS_FULL_URI environment variable. If valid credentials
|
||||
* are returned in the response, these will be used with zero configuration.
|
||||
*
|
||||
* This credentials class will by default timeout after 1 second of inactivity
|
||||
* and retry 3 times.
|
||||
* If your requests to the relative URI are timing out, you can increase
|
||||
* the value by configuring them directly:
|
||||
*
|
||||
* ```javascript
|
||||
* AWS.config.credentials = new AWS.RemoteCredentials({
|
||||
* httpOptions: { timeout: 5000 }, // 5 second timeout
|
||||
* maxRetries: 10, // retry 10 times
|
||||
* retryDelayOptions: { base: 200 } // see AWS.Config for information
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @see AWS.Config.retryDelayOptions
|
||||
*
|
||||
* @!macro nobrowser
|
||||
*/
|
||||
AWS.RemoteCredentials = AWS.util.inherit(AWS.Credentials, {
|
||||
constructor: function RemoteCredentials(options) {
|
||||
AWS.Credentials.call(this);
|
||||
options = options ? AWS.util.copy(options) : {};
|
||||
if (!options.httpOptions) options.httpOptions = {};
|
||||
options.httpOptions = AWS.util.merge(
|
||||
this.httpOptions, options.httpOptions);
|
||||
AWS.util.update(this, options);
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
httpOptions: { timeout: 1000 },
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
maxRetries: 3,
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
isConfiguredForEcsCredentials: function isConfiguredForEcsCredentials() {
|
||||
return Boolean(
|
||||
process &&
|
||||
process.env &&
|
||||
(process.env[ENV_RELATIVE_URI] || process.env[ENV_FULL_URI])
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
getECSFullUri: function getECSFullUri() {
|
||||
if (process && process.env) {
|
||||
var relative = process.env[ENV_RELATIVE_URI],
|
||||
full = process.env[ENV_FULL_URI];
|
||||
if (relative) {
|
||||
return 'http://' + RELATIVE_URI_HOST + relative;
|
||||
} else if (full) {
|
||||
var parsed = AWS.util.urlParse(full);
|
||||
if (FULL_URI_ALLOWED_PROTOCOLS.indexOf(parsed.protocol) < 0) {
|
||||
throw AWS.util.error(
|
||||
new Error('Unsupported protocol: AWS.RemoteCredentials supports '
|
||||
+ FULL_URI_ALLOWED_PROTOCOLS.join(',') + ' only; '
|
||||
+ parsed.protocol + ' requested.'),
|
||||
{ code: 'ECSCredentialsProviderFailure' }
|
||||
);
|
||||
}
|
||||
|
||||
if (FULL_URI_UNRESTRICTED_PROTOCOLS.indexOf(parsed.protocol) < 0 &&
|
||||
FULL_URI_ALLOWED_HOSTNAMES.indexOf(parsed.hostname) < 0) {
|
||||
throw AWS.util.error(
|
||||
new Error('Unsupported hostname: AWS.RemoteCredentials only supports '
|
||||
+ FULL_URI_ALLOWED_HOSTNAMES.join(',') + ' for ' + parsed.protocol + '; '
|
||||
+ parsed.protocol + '//' + parsed.hostname + ' requested.'),
|
||||
{ code: 'ECSCredentialsProviderFailure' }
|
||||
);
|
||||
}
|
||||
|
||||
return full;
|
||||
} else {
|
||||
throw AWS.util.error(
|
||||
new Error('Variable ' + ENV_RELATIVE_URI + ' or ' + ENV_FULL_URI +
|
||||
' must be set to use AWS.RemoteCredentials.'),
|
||||
{ code: 'ECSCredentialsProviderFailure' }
|
||||
);
|
||||
}
|
||||
} else {
|
||||
throw AWS.util.error(
|
||||
new Error('No process info available'),
|
||||
{ code: 'ECSCredentialsProviderFailure' }
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
getECSAuthToken: function getECSAuthToken() {
|
||||
if (process && process.env && process.env[ENV_FULL_URI]) {
|
||||
return process.env[ENV_AUTH_TOKEN];
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
credsFormatIsValid: function credsFormatIsValid(credData) {
|
||||
return (!!credData.accessKeyId && !!credData.secretAccessKey &&
|
||||
!!credData.sessionToken && !!credData.expireTime);
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
formatCreds: function formatCreds(credData) {
|
||||
if (!!credData.credentials) {
|
||||
credData = credData.credentials;
|
||||
}
|
||||
|
||||
return {
|
||||
expired: false,
|
||||
accessKeyId: credData.accessKeyId || credData.AccessKeyId,
|
||||
secretAccessKey: credData.secretAccessKey || credData.SecretAccessKey,
|
||||
sessionToken: credData.sessionToken || credData.Token,
|
||||
expireTime: new Date(credData.expiration || credData.Expiration)
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
request: function request(url, callback) {
|
||||
var httpRequest = new AWS.HttpRequest(url);
|
||||
httpRequest.method = 'GET';
|
||||
httpRequest.headers.Accept = 'application/json';
|
||||
var token = this.getECSAuthToken();
|
||||
if (token) {
|
||||
httpRequest.headers.Authorization = token;
|
||||
}
|
||||
AWS.util.handleRequestWithRetries(httpRequest, this, callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads the credentials from the relative URI specified by container
|
||||
*
|
||||
* @callback callback function(err)
|
||||
* Called when the request to the relative URI responds (or fails). When
|
||||
* this callback is called with no error, it means that the credentials
|
||||
* information has been loaded into the object (as the `accessKeyId`,
|
||||
* `secretAccessKey`, `sessionToken`, and `expireTime` properties).
|
||||
* @param err [Error] if an error occurred, this value will be filled
|
||||
* @see get
|
||||
*/
|
||||
refresh: function refresh(callback) {
|
||||
this.coalesceRefresh(callback || AWS.util.fn.callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
load: function load(callback) {
|
||||
var self = this;
|
||||
var fullUri;
|
||||
|
||||
try {
|
||||
fullUri = this.getECSFullUri();
|
||||
} catch (err) {
|
||||
callback(err);
|
||||
return;
|
||||
}
|
||||
|
||||
this.request(fullUri, function(err, data) {
|
||||
if (!err) {
|
||||
try {
|
||||
data = JSON.parse(data);
|
||||
var creds = self.formatCreds(data);
|
||||
if (!self.credsFormatIsValid(creds)) {
|
||||
throw AWS.util.error(
|
||||
new Error('Response data is not in valid format'),
|
||||
{ code: 'ECSCredentialsProviderFailure' }
|
||||
);
|
||||
}
|
||||
AWS.util.update(self, creds);
|
||||
} catch (dataError) {
|
||||
err = dataError;
|
||||
}
|
||||
}
|
||||
callback(err, creds);
|
||||
});
|
||||
}
|
||||
});
|
||||
34
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/saml_credentials.d.ts
generated
vendored
Normal file
34
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/saml_credentials.d.ts
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
import {Credentials} from '../credentials';
|
||||
export class SAMLCredentials extends Credentials {
|
||||
/**
|
||||
* Creates a new credentials object.
|
||||
* @param {object} params - The map of params passed to AWS.STS.assumeRoleWithSAML().
|
||||
*/
|
||||
constructor(params: SAMLCredentialsParams);
|
||||
params: SAMLCredentialsParams
|
||||
}
|
||||
interface SAMLCredentialsParams {
|
||||
/**
|
||||
* The Amazon Resource Name (ARN) of the role that the caller is assuming.
|
||||
*/
|
||||
RoleArn: string
|
||||
/**
|
||||
* The Amazon Resource Name (ARN) of the SAML provider in IAM that describes the IdP.
|
||||
*/
|
||||
PrincipalArn: string
|
||||
/**
|
||||
* The base-64 encoded SAML authentication response provided by the IdP.
|
||||
*/
|
||||
SAMLAssertion: string
|
||||
/**
|
||||
* An IAM policy in JSON format.
|
||||
* The policy plain text must be 2048 bytes or shorter.
|
||||
*/
|
||||
Policy?: string
|
||||
/**
|
||||
* The duration, in seconds, of the role session.
|
||||
* The minimum duration is 15 minutes.
|
||||
* The maximum duration is 12 hours.
|
||||
*/
|
||||
DurationSeconds?: number
|
||||
}
|
||||
94
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/saml_credentials.js
generated
vendored
Normal file
94
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/saml_credentials.js
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
var AWS = require('../core');
|
||||
var STS = require('../../clients/sts');
|
||||
|
||||
/**
|
||||
* Represents credentials retrieved from STS SAML support.
|
||||
*
|
||||
* By default this provider gets credentials using the
|
||||
* {AWS.STS.assumeRoleWithSAML} service operation. This operation
|
||||
* requires a `RoleArn` containing the ARN of the IAM trust policy for the
|
||||
* application for which credentials will be given, as well as a `PrincipalArn`
|
||||
* representing the ARN for the SAML identity provider. In addition, the
|
||||
* `SAMLAssertion` must be set to the token provided by the identity
|
||||
* provider. See {constructor} for an example on creating a credentials
|
||||
* object with proper `RoleArn`, `PrincipalArn`, and `SAMLAssertion` values.
|
||||
*
|
||||
* ## Refreshing Credentials from Identity Service
|
||||
*
|
||||
* In addition to AWS credentials expiring after a given amount of time, the
|
||||
* login token from the identity provider will also expire. Once this token
|
||||
* expires, it will not be usable to refresh AWS credentials, and another
|
||||
* token will be needed. The SDK does not manage refreshing of the token value,
|
||||
* but this can be done through a "refresh token" supported by most identity
|
||||
* providers. Consult the documentation for the identity provider for refreshing
|
||||
* tokens. Once the refreshed token is acquired, you should make sure to update
|
||||
* this new token in the credentials object's {params} property. The following
|
||||
* code will update the SAMLAssertion, assuming you have retrieved an updated
|
||||
* token from the identity provider:
|
||||
*
|
||||
* ```javascript
|
||||
* AWS.config.credentials.params.SAMLAssertion = updatedToken;
|
||||
* ```
|
||||
*
|
||||
* Future calls to `credentials.refresh()` will now use the new token.
|
||||
*
|
||||
* @!attribute params
|
||||
* @return [map] the map of params passed to
|
||||
* {AWS.STS.assumeRoleWithSAML}. To update the token, set the
|
||||
* `params.SAMLAssertion` property.
|
||||
*/
|
||||
AWS.SAMLCredentials = AWS.util.inherit(AWS.Credentials, {
|
||||
/**
|
||||
* Creates a new credentials object.
|
||||
* @param (see AWS.STS.assumeRoleWithSAML)
|
||||
* @example Creating a new credentials object
|
||||
* AWS.config.credentials = new AWS.SAMLCredentials({
|
||||
* RoleArn: 'arn:aws:iam::1234567890:role/SAMLRole',
|
||||
* PrincipalArn: 'arn:aws:iam::1234567890:role/SAMLPrincipal',
|
||||
* SAMLAssertion: 'base64-token', // base64-encoded token from IdP
|
||||
* });
|
||||
* @see AWS.STS.assumeRoleWithSAML
|
||||
*/
|
||||
constructor: function SAMLCredentials(params) {
|
||||
AWS.Credentials.call(this);
|
||||
this.expired = true;
|
||||
this.params = params;
|
||||
},
|
||||
|
||||
/**
|
||||
* Refreshes credentials using {AWS.STS.assumeRoleWithSAML}
|
||||
*
|
||||
* @callback callback function(err)
|
||||
* Called when the STS service responds (or fails). When
|
||||
* this callback is called with no error, it means that the credentials
|
||||
* information has been loaded into the object (as the `accessKeyId`,
|
||||
* `secretAccessKey`, and `sessionToken` properties).
|
||||
* @param err [Error] if an error occurred, this value will be filled
|
||||
* @see get
|
||||
*/
|
||||
refresh: function refresh(callback) {
|
||||
this.coalesceRefresh(callback || AWS.util.fn.callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
load: function load(callback) {
|
||||
var self = this;
|
||||
self.createClients();
|
||||
self.service.assumeRoleWithSAML(function (err, data) {
|
||||
if (!err) {
|
||||
self.service.credentialsFrom(data, self);
|
||||
}
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
createClients: function() {
|
||||
this.service = this.service || new STS({params: this.params});
|
||||
}
|
||||
|
||||
});
|
||||
17
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/shared_ini_file_credentials.d.ts
generated
vendored
Normal file
17
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/shared_ini_file_credentials.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import {Credentials} from '../credentials';
|
||||
import {HTTPOptions} from '../config-base';
|
||||
export class SharedIniFileCredentials extends Credentials {
|
||||
/**
|
||||
* Creates a new SharedIniFileCredentials object.
|
||||
*/
|
||||
constructor(options?: SharedIniFileCredentialsOptions);
|
||||
}
|
||||
|
||||
interface SharedIniFileCredentialsOptions {
|
||||
profile?: string
|
||||
filename?: string
|
||||
disableAssumeRole?: boolean
|
||||
tokenCodeFn?: (mfaSerial: string, callback: (err?: Error, token?: string) => void) => void
|
||||
httpOptions?: HTTPOptions
|
||||
callback?: (err?: Error) => void
|
||||
}
|
||||
284
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/shared_ini_file_credentials.js
generated
vendored
Normal file
284
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/shared_ini_file_credentials.js
generated
vendored
Normal file
@@ -0,0 +1,284 @@
|
||||
var AWS = require('../core');
|
||||
var STS = require('../../clients/sts');
|
||||
var iniLoader = AWS.util.iniLoader;
|
||||
|
||||
var ASSUME_ROLE_DEFAULT_REGION = 'us-east-1';
|
||||
|
||||
/**
|
||||
* Represents credentials loaded from shared credentials file
|
||||
* (defaulting to ~/.aws/credentials or defined by the
|
||||
* `AWS_SHARED_CREDENTIALS_FILE` environment variable).
|
||||
*
|
||||
* ## Using the shared credentials file
|
||||
*
|
||||
* This provider is checked by default in the Node.js environment. To use the
|
||||
* credentials file provider, simply add your access and secret keys to the
|
||||
* ~/.aws/credentials file in the following format:
|
||||
*
|
||||
* [default]
|
||||
* aws_access_key_id = AKID...
|
||||
* aws_secret_access_key = YOUR_SECRET_KEY
|
||||
*
|
||||
* ## Using custom profiles
|
||||
*
|
||||
* The SDK supports loading credentials for separate profiles. This can be done
|
||||
* in two ways:
|
||||
*
|
||||
* 1. Set the `AWS_PROFILE` environment variable in your process prior to
|
||||
* loading the SDK.
|
||||
* 2. Directly load the AWS.SharedIniFileCredentials provider:
|
||||
*
|
||||
* ```javascript
|
||||
* var creds = new AWS.SharedIniFileCredentials({profile: 'myprofile'});
|
||||
* AWS.config.credentials = creds;
|
||||
* ```
|
||||
*
|
||||
* @!macro nobrowser
|
||||
*/
|
||||
AWS.SharedIniFileCredentials = AWS.util.inherit(AWS.Credentials, {
|
||||
/**
|
||||
* Creates a new SharedIniFileCredentials object.
|
||||
*
|
||||
* @param options [map] a set of options
|
||||
* @option options profile [String] (AWS_PROFILE env var or 'default')
|
||||
* the name of the profile to load.
|
||||
* @option options filename [String] ('~/.aws/credentials' or defined by
|
||||
* AWS_SHARED_CREDENTIALS_FILE process env var)
|
||||
* the filename to use when loading credentials.
|
||||
* @option options disableAssumeRole [Boolean] (false) True to disable
|
||||
* support for profiles that assume an IAM role. If true, and an assume
|
||||
* role profile is selected, an error is raised.
|
||||
* @option options preferStaticCredentials [Boolean] (false) True to
|
||||
* prefer static credentials to role_arn if both are present.
|
||||
* @option options tokenCodeFn [Function] (null) Function to provide
|
||||
* STS Assume Role TokenCode, if mfa_serial is provided for profile in ini
|
||||
* file. Function is called with value of mfa_serial and callback, and
|
||||
* should provide the TokenCode or an error to the callback in the format
|
||||
* callback(err, token)
|
||||
* @option options callback [Function] (err) Credentials are eagerly loaded
|
||||
* by the constructor. When the callback is called with no error, the
|
||||
* credentials have been loaded successfully.
|
||||
* @option options httpOptions [map] A set of options to pass to the low-level
|
||||
* HTTP request. Currently supported options are:
|
||||
* * **proxy** [String] — the URL to proxy requests through
|
||||
* * **agent** [http.Agent, https.Agent] — the Agent object to perform
|
||||
* HTTP requests with. Used for connection pooling. Defaults to the global
|
||||
* agent (`http.globalAgent`) for non-SSL connections. Note that for
|
||||
* SSL connections, a special Agent object is used in order to enable
|
||||
* peer certificate verification. This feature is only available in the
|
||||
* Node.js environment.
|
||||
* * **connectTimeout** [Integer] — Sets the socket to timeout after
|
||||
* failing to establish a connection with the server after
|
||||
* `connectTimeout` milliseconds. This timeout has no effect once a socket
|
||||
* connection has been established.
|
||||
* * **timeout** [Integer] — The number of milliseconds a request can
|
||||
* take before automatically being terminated.
|
||||
* Defaults to two minutes (120000).
|
||||
*/
|
||||
constructor: function SharedIniFileCredentials(options) {
|
||||
AWS.Credentials.call(this);
|
||||
|
||||
options = options || {};
|
||||
|
||||
this.filename = options.filename;
|
||||
this.profile = options.profile || process.env.AWS_PROFILE || AWS.util.defaultProfile;
|
||||
this.disableAssumeRole = Boolean(options.disableAssumeRole);
|
||||
this.preferStaticCredentials = Boolean(options.preferStaticCredentials);
|
||||
this.tokenCodeFn = options.tokenCodeFn || null;
|
||||
this.httpOptions = options.httpOptions || null;
|
||||
this.get(options.callback || AWS.util.fn.noop);
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
load: function load(callback) {
|
||||
var self = this;
|
||||
try {
|
||||
var profiles = AWS.util.getProfilesFromSharedConfig(iniLoader, this.filename);
|
||||
var profile = profiles[this.profile] || {};
|
||||
|
||||
if (Object.keys(profile).length === 0) {
|
||||
throw AWS.util.error(
|
||||
new Error('Profile ' + this.profile + ' not found'),
|
||||
{ code: 'SharedIniFileCredentialsProviderFailure' }
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
In the CLI, the presence of both a role_arn and static credentials have
|
||||
different meanings depending on how many profiles have been visited. For
|
||||
the first profile processed, role_arn takes precedence over any static
|
||||
credentials, but for all subsequent profiles, static credentials are
|
||||
used if present, and only in their absence will the profile's
|
||||
source_profile and role_arn keys be used to load another set of
|
||||
credentials. This var is intended to yield compatible behaviour in this
|
||||
sdk.
|
||||
*/
|
||||
var preferStaticCredentialsToRoleArn = Boolean(
|
||||
this.preferStaticCredentials
|
||||
&& profile['aws_access_key_id']
|
||||
&& profile['aws_secret_access_key']
|
||||
);
|
||||
|
||||
if (profile['role_arn'] && !preferStaticCredentialsToRoleArn) {
|
||||
this.loadRoleProfile(profiles, profile, function(err, data) {
|
||||
if (err) {
|
||||
callback(err);
|
||||
} else {
|
||||
self.expired = false;
|
||||
self.accessKeyId = data.Credentials.AccessKeyId;
|
||||
self.secretAccessKey = data.Credentials.SecretAccessKey;
|
||||
self.sessionToken = data.Credentials.SessionToken;
|
||||
self.expireTime = data.Credentials.Expiration;
|
||||
callback(null);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
this.accessKeyId = profile['aws_access_key_id'];
|
||||
this.secretAccessKey = profile['aws_secret_access_key'];
|
||||
this.sessionToken = profile['aws_session_token'];
|
||||
|
||||
if (!this.accessKeyId || !this.secretAccessKey) {
|
||||
throw AWS.util.error(
|
||||
new Error('Credentials not set for profile ' + this.profile),
|
||||
{ code: 'SharedIniFileCredentialsProviderFailure' }
|
||||
);
|
||||
}
|
||||
this.expired = false;
|
||||
callback(null);
|
||||
} catch (err) {
|
||||
callback(err);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads the credentials from the shared credentials file
|
||||
*
|
||||
* @callback callback function(err)
|
||||
* Called after the shared INI file on disk is read and parsed. When this
|
||||
* callback is called with no error, it means that the credentials
|
||||
* information has been loaded into the object (as the `accessKeyId`,
|
||||
* `secretAccessKey`, and `sessionToken` properties).
|
||||
* @param err [Error] if an error occurred, this value will be filled
|
||||
* @see get
|
||||
*/
|
||||
refresh: function refresh(callback) {
|
||||
iniLoader.clearCachedFiles();
|
||||
this.coalesceRefresh(
|
||||
callback || AWS.util.fn.callback,
|
||||
this.disableAssumeRole
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
loadRoleProfile: function loadRoleProfile(creds, roleProfile, callback) {
|
||||
if (this.disableAssumeRole) {
|
||||
throw AWS.util.error(
|
||||
new Error('Role assumption profiles are disabled. ' +
|
||||
'Failed to load profile ' + this.profile +
|
||||
' from ' + creds.filename),
|
||||
{ code: 'SharedIniFileCredentialsProviderFailure' }
|
||||
);
|
||||
}
|
||||
|
||||
var self = this;
|
||||
var roleArn = roleProfile['role_arn'];
|
||||
var roleSessionName = roleProfile['role_session_name'];
|
||||
var externalId = roleProfile['external_id'];
|
||||
var mfaSerial = roleProfile['mfa_serial'];
|
||||
var sourceProfileName = roleProfile['source_profile'];
|
||||
var durationSeconds = parseInt(roleProfile['duration_seconds'], 10) || undefined;
|
||||
|
||||
// From experimentation, the following behavior mimics the AWS CLI:
|
||||
//
|
||||
// 1. Use region from the profile if present.
|
||||
// 2. Otherwise fall back to N. Virginia (global endpoint).
|
||||
//
|
||||
// It is necessary to do the fallback explicitly, because if
|
||||
// 'AWS_STS_REGIONAL_ENDPOINTS=regional', the underlying STS client will
|
||||
// otherwise throw an error if region is left 'undefined'.
|
||||
//
|
||||
// Experimentation shows that the AWS CLI (tested at version 1.18.136)
|
||||
// ignores the following potential sources of a region for the purposes of
|
||||
// this AssumeRole call:
|
||||
//
|
||||
// - The [default] profile
|
||||
// - The AWS_REGION environment variable
|
||||
//
|
||||
// Ignoring the [default] profile for the purposes of AssumeRole is arguably
|
||||
// a bug in the CLI since it does use the [default] region for service
|
||||
// calls... but right now we're matching behavior of the other tool.
|
||||
var profileRegion = roleProfile['region'] || ASSUME_ROLE_DEFAULT_REGION;
|
||||
|
||||
if (!sourceProfileName) {
|
||||
throw AWS.util.error(
|
||||
new Error('source_profile is not set using profile ' + this.profile),
|
||||
{ code: 'SharedIniFileCredentialsProviderFailure' }
|
||||
);
|
||||
}
|
||||
|
||||
var sourceProfileExistanceTest = creds[sourceProfileName];
|
||||
|
||||
if (typeof sourceProfileExistanceTest !== 'object') {
|
||||
throw AWS.util.error(
|
||||
new Error('source_profile ' + sourceProfileName + ' using profile '
|
||||
+ this.profile + ' does not exist'),
|
||||
{ code: 'SharedIniFileCredentialsProviderFailure' }
|
||||
);
|
||||
}
|
||||
|
||||
var sourceCredentials = new AWS.SharedIniFileCredentials(
|
||||
AWS.util.merge(this.options || {}, {
|
||||
profile: sourceProfileName,
|
||||
preferStaticCredentials: true
|
||||
})
|
||||
);
|
||||
|
||||
this.roleArn = roleArn;
|
||||
var sts = new STS({
|
||||
credentials: sourceCredentials,
|
||||
region: profileRegion,
|
||||
httpOptions: this.httpOptions
|
||||
});
|
||||
|
||||
var roleParams = {
|
||||
DurationSeconds: durationSeconds,
|
||||
RoleArn: roleArn,
|
||||
RoleSessionName: roleSessionName || 'aws-sdk-js-' + Date.now()
|
||||
};
|
||||
|
||||
if (externalId) {
|
||||
roleParams.ExternalId = externalId;
|
||||
}
|
||||
|
||||
if (mfaSerial && self.tokenCodeFn) {
|
||||
roleParams.SerialNumber = mfaSerial;
|
||||
self.tokenCodeFn(mfaSerial, function(err, token) {
|
||||
if (err) {
|
||||
var message;
|
||||
if (err instanceof Error) {
|
||||
message = err.message;
|
||||
} else {
|
||||
message = err;
|
||||
}
|
||||
callback(
|
||||
AWS.util.error(
|
||||
new Error('Error fetching MFA token: ' + message),
|
||||
{ code: 'SharedIniFileCredentialsProviderFailure' }
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
||||
roleParams.TokenCode = token;
|
||||
sts.assumeRole(roleParams, callback);
|
||||
});
|
||||
return;
|
||||
}
|
||||
sts.assumeRole(roleParams, callback);
|
||||
}
|
||||
});
|
||||
16
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/sso_credentials.d.ts
generated
vendored
Normal file
16
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/sso_credentials.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import {Credentials} from '../credentials';
|
||||
import SSO = require('../../clients/sso');
|
||||
import { HTTPOptions } from '../config-base';
|
||||
export class SsoCredentials extends Credentials {
|
||||
/**
|
||||
* Creates a new SsoCredentials object.
|
||||
*/
|
||||
constructor(options?: SsoCredentialsOptions);
|
||||
}
|
||||
|
||||
interface SsoCredentialsOptions {
|
||||
httpOptions?: HTTPOptions,
|
||||
profile?: string;
|
||||
filename?: string;
|
||||
ssoClient?: SSO;
|
||||
}
|
||||
248
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/sso_credentials.js
generated
vendored
Normal file
248
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/sso_credentials.js
generated
vendored
Normal file
@@ -0,0 +1,248 @@
|
||||
var AWS = require('../core');
|
||||
var path = require('path');
|
||||
var crypto = require('crypto');
|
||||
var iniLoader = AWS.util.iniLoader;
|
||||
|
||||
/**
|
||||
* Represents credentials from sso.getRoleCredentials API for
|
||||
* `sso_*` values defined in shared credentials file.
|
||||
*
|
||||
* ## Using SSO credentials
|
||||
*
|
||||
* The credentials file must specify the information below to use sso:
|
||||
*
|
||||
* [profile sso-profile]
|
||||
* sso_account_id = 012345678901
|
||||
* sso_region = **-****-*
|
||||
* sso_role_name = SampleRole
|
||||
* sso_start_url = https://d-******.awsapps.com/start
|
||||
*
|
||||
* or using the session format:
|
||||
*
|
||||
* [profile sso-token]
|
||||
* sso_session = prod
|
||||
* sso_account_id = 012345678901
|
||||
* sso_role_name = SampleRole
|
||||
*
|
||||
* [sso-session prod]
|
||||
* sso_region = **-****-*
|
||||
* sso_start_url = https://d-******.awsapps.com/start
|
||||
*
|
||||
* This information will be automatically added to your shared credentials file by running
|
||||
* `aws configure sso`.
|
||||
*
|
||||
* ## Using custom profiles
|
||||
*
|
||||
* The SDK supports loading credentials for separate profiles. This can be done
|
||||
* in two ways:
|
||||
*
|
||||
* 1. Set the `AWS_PROFILE` environment variable in your process prior to
|
||||
* loading the SDK.
|
||||
* 2. Directly load the AWS.SsoCredentials provider:
|
||||
*
|
||||
* ```javascript
|
||||
* var creds = new AWS.SsoCredentials({profile: 'myprofile'});
|
||||
* AWS.config.credentials = creds;
|
||||
* ```
|
||||
*
|
||||
* @!macro nobrowser
|
||||
*/
|
||||
AWS.SsoCredentials = AWS.util.inherit(AWS.Credentials, {
|
||||
/**
|
||||
* Creates a new SsoCredentials object.
|
||||
*
|
||||
* @param options [map] a set of options
|
||||
* @option options profile [String] (AWS_PROFILE env var or 'default')
|
||||
* the name of the profile to load.
|
||||
* @option options filename [String] ('~/.aws/credentials' or defined by
|
||||
* AWS_SHARED_CREDENTIALS_FILE process env var)
|
||||
* the filename to use when loading credentials.
|
||||
* @option options callback [Function] (err) Credentials are eagerly loaded
|
||||
* by the constructor. When the callback is called with no error, the
|
||||
* credentials have been loaded successfully.
|
||||
*/
|
||||
constructor: function SsoCredentials(options) {
|
||||
AWS.Credentials.call(this);
|
||||
|
||||
options = options || {};
|
||||
this.errorCode = 'SsoCredentialsProviderFailure';
|
||||
this.expired = true;
|
||||
|
||||
this.filename = options.filename;
|
||||
this.profile = options.profile || process.env.AWS_PROFILE || AWS.util.defaultProfile;
|
||||
this.service = options.ssoClient;
|
||||
this.httpOptions = options.httpOptions || null;
|
||||
this.get(options.callback || AWS.util.fn.noop);
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
load: function load(callback) {
|
||||
var self = this;
|
||||
|
||||
try {
|
||||
var profiles = AWS.util.getProfilesFromSharedConfig(iniLoader, this.filename);
|
||||
var profile = profiles[this.profile] || {};
|
||||
|
||||
if (Object.keys(profile).length === 0) {
|
||||
throw AWS.util.error(
|
||||
new Error('Profile ' + this.profile + ' not found'),
|
||||
{ code: self.errorCode }
|
||||
);
|
||||
}
|
||||
|
||||
if (profile.sso_session) {
|
||||
if (!profile.sso_account_id || !profile.sso_role_name) {
|
||||
throw AWS.util.error(
|
||||
new Error('Profile ' + this.profile + ' with session ' + profile.sso_session +
|
||||
' does not have valid SSO credentials. Required parameters "sso_account_id", "sso_session", ' +
|
||||
'"sso_role_name". Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html'),
|
||||
{ code: self.errorCode }
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if (!profile.sso_start_url || !profile.sso_account_id || !profile.sso_region || !profile.sso_role_name) {
|
||||
throw AWS.util.error(
|
||||
new Error('Profile ' + this.profile + ' does not have valid SSO credentials. Required parameters "sso_account_id", "sso_region", ' +
|
||||
'"sso_role_name", "sso_start_url". Reference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html'),
|
||||
{ code: self.errorCode }
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
this.getToken(this.profile, profile, function (err, token) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
var request = {
|
||||
accessToken: token,
|
||||
accountId: profile.sso_account_id,
|
||||
roleName: profile.sso_role_name,
|
||||
};
|
||||
|
||||
if (!self.service || self.service.config.region !== profile.sso_region) {
|
||||
self.service = new AWS.SSO({
|
||||
region: profile.sso_region,
|
||||
httpOptions: self.httpOptions,
|
||||
});
|
||||
}
|
||||
|
||||
self.service.getRoleCredentials(request, function(err, data) {
|
||||
if (err || !data || !data.roleCredentials) {
|
||||
callback(AWS.util.error(
|
||||
err || new Error('Please log in using "aws sso login"'),
|
||||
{ code: self.errorCode }
|
||||
), null);
|
||||
} else if (!data.roleCredentials.accessKeyId || !data.roleCredentials.secretAccessKey || !data.roleCredentials.sessionToken || !data.roleCredentials.expiration) {
|
||||
throw AWS.util.error(new Error(
|
||||
'SSO returns an invalid temporary credential.'
|
||||
));
|
||||
} else {
|
||||
self.expired = false;
|
||||
self.accessKeyId = data.roleCredentials.accessKeyId;
|
||||
self.secretAccessKey = data.roleCredentials.secretAccessKey;
|
||||
self.sessionToken = data.roleCredentials.sessionToken;
|
||||
self.expireTime = new Date(data.roleCredentials.expiration);
|
||||
callback(null);
|
||||
}
|
||||
});
|
||||
});
|
||||
} catch (err) {
|
||||
callback(err);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @private
|
||||
* Uses legacy file system retrieval or if sso-session is set,
|
||||
* use the SSOTokenProvider.
|
||||
*
|
||||
* @param {string} profileName - name of the profile.
|
||||
* @param {object} profile - profile data containing sso_session or sso_start_url etc.
|
||||
* @param {function} callback - called with (err, (string) token).
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
getToken: function getToken(profileName, profile, callback) {
|
||||
var self = this;
|
||||
|
||||
if (profile.sso_session) {
|
||||
var _iniLoader = AWS.util.iniLoader;
|
||||
var ssoSessions = _iniLoader.loadSsoSessionsFrom();
|
||||
var ssoSession = ssoSessions[profile.sso_session];
|
||||
Object.assign(profile, ssoSession);
|
||||
|
||||
var ssoTokenProvider = new AWS.SSOTokenProvider({
|
||||
profile: profileName,
|
||||
});
|
||||
ssoTokenProvider.load(function (err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
return callback(null, ssoTokenProvider.token);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
/**
|
||||
* The time window (15 mins) that SDK will treat the SSO token expires in before the defined expiration date in token.
|
||||
* This is needed because server side may have invalidated the token before the defined expiration date.
|
||||
*/
|
||||
var EXPIRE_WINDOW_MS = 15 * 60 * 1000;
|
||||
var hasher = crypto.createHash('sha1');
|
||||
var fileName = hasher.update(profile.sso_start_url).digest('hex') + '.json';
|
||||
var cachePath = path.join(
|
||||
iniLoader.getHomeDir(),
|
||||
'.aws',
|
||||
'sso',
|
||||
'cache',
|
||||
fileName
|
||||
);
|
||||
var cacheFile = AWS.util.readFileSync(cachePath);
|
||||
var cacheContent = null;
|
||||
if (cacheFile) {
|
||||
cacheContent = JSON.parse(cacheFile);
|
||||
}
|
||||
if (!cacheContent) {
|
||||
throw AWS.util.error(
|
||||
new Error('Cached credentials not found under ' + this.profile + ' profile. Please make sure you log in with aws sso login first'),
|
||||
{ code: self.errorCode }
|
||||
);
|
||||
}
|
||||
|
||||
if (!cacheContent.startUrl || !cacheContent.region || !cacheContent.accessToken || !cacheContent.expiresAt) {
|
||||
throw AWS.util.error(
|
||||
new Error('Cached credentials are missing required properties. Try running aws sso login.')
|
||||
);
|
||||
}
|
||||
|
||||
if (new Date(cacheContent.expiresAt).getTime() - Date.now() <= EXPIRE_WINDOW_MS) {
|
||||
throw AWS.util.error(new Error(
|
||||
'The SSO session associated with this profile has expired. To refresh this SSO session run aws sso login with the corresponding profile.'
|
||||
));
|
||||
}
|
||||
|
||||
return callback(null, cacheContent.accessToken);
|
||||
} catch (err) {
|
||||
return callback(err, null);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads the credentials from the AWS SSO process
|
||||
*
|
||||
* @callback callback function(err)
|
||||
* Called after the AWS SSO process has been executed. When this
|
||||
* callback is called with no error, it means that the credentials
|
||||
* information has been loaded into the object (as the `accessKeyId`,
|
||||
* `secretAccessKey`, and `sessionToken` properties).
|
||||
* @param err [Error] if an error occurred, this value will be filled
|
||||
* @see get
|
||||
*/
|
||||
refresh: function refresh(callback) {
|
||||
iniLoader.clearCachedFiles();
|
||||
this.coalesceRefresh(callback || AWS.util.fn.callback);
|
||||
},
|
||||
});
|
||||
31
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/temporary_credentials.d.ts
generated
vendored
Normal file
31
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/temporary_credentials.d.ts
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
import {Credentials} from '../credentials';
|
||||
import {AWSError} from '../error';
|
||||
import STS = require('../../clients/sts');
|
||||
|
||||
export class TemporaryCredentials extends Credentials {
|
||||
/**
|
||||
* Creates a new temporary credentials object.
|
||||
* @param {Object} options - a map of options that are passed to the AWS.STS.assumeRole() or AWS.STS.getSessionToken() operations. If a RoleArn parameter is passed in, credentials will be based on the IAM role.
|
||||
* @param {Object} masterCredentials - The master (non-temporary) credentials used to get and refresh credentials from AWS STS.
|
||||
*/
|
||||
constructor(options: TemporaryCredentials.TemporaryCredentialsOptions, masterCredentials?: Credentials);
|
||||
/**
|
||||
* Creates a new temporary credentials object.
|
||||
* @param {Object} options - a map of options that are passed to the AWS.STS.assumeRole() or AWS.STS.getSessionToken() operations. If a RoleArn parameter is passed in, credentials will be based on the IAM role.
|
||||
*/
|
||||
constructor(options?: TemporaryCredentials.TemporaryCredentialsOptions);
|
||||
/**
|
||||
* Refreshes credentials using AWS.STS.assumeRole() or AWS.STS.getSessionToken(), depending on whether an IAM role ARN was passed to the credentials constructor().
|
||||
*/
|
||||
refresh(callback: (err?: AWSError) => void): void;
|
||||
|
||||
/**
|
||||
* The master (non-temporary) credentials used to get and refresh temporary credentials from AWS STS.
|
||||
*/
|
||||
masterCredentials: Credentials
|
||||
}
|
||||
|
||||
// Needed to expose interfaces on the class
|
||||
declare namespace TemporaryCredentials {
|
||||
export type TemporaryCredentialsOptions = STS.Types.AssumeRoleRequest|STS.Types.GetSessionTokenRequest;
|
||||
}
|
||||
129
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/temporary_credentials.js
generated
vendored
Normal file
129
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/temporary_credentials.js
generated
vendored
Normal file
@@ -0,0 +1,129 @@
|
||||
var AWS = require('../core');
|
||||
var STS = require('../../clients/sts');
|
||||
|
||||
/**
|
||||
* Represents temporary credentials retrieved from {AWS.STS}. Without any
|
||||
* extra parameters, credentials will be fetched from the
|
||||
* {AWS.STS.getSessionToken} operation. If an IAM role is provided, the
|
||||
* {AWS.STS.assumeRole} operation will be used to fetch credentials for the
|
||||
* role instead.
|
||||
*
|
||||
* @note AWS.TemporaryCredentials is deprecated, but remains available for
|
||||
* backwards compatibility. {AWS.ChainableTemporaryCredentials} is the
|
||||
* preferred class for temporary credentials.
|
||||
*
|
||||
* To setup temporary credentials, configure a set of master credentials
|
||||
* using the standard credentials providers (environment, EC2 instance metadata,
|
||||
* or from the filesystem), then set the global credentials to a new
|
||||
* temporary credentials object:
|
||||
*
|
||||
* ```javascript
|
||||
* // Note that environment credentials are loaded by default,
|
||||
* // the following line is shown for clarity:
|
||||
* AWS.config.credentials = new AWS.EnvironmentCredentials('AWS');
|
||||
*
|
||||
* // Now set temporary credentials seeded from the master credentials
|
||||
* AWS.config.credentials = new AWS.TemporaryCredentials();
|
||||
*
|
||||
* // subsequent requests will now use temporary credentials from AWS STS.
|
||||
* new AWS.S3().listBucket(function(err, data) { ... });
|
||||
* ```
|
||||
*
|
||||
* @!attribute masterCredentials
|
||||
* @return [AWS.Credentials] the master (non-temporary) credentials used to
|
||||
* get and refresh temporary credentials from AWS STS.
|
||||
* @note (see constructor)
|
||||
*/
|
||||
AWS.TemporaryCredentials = AWS.util.inherit(AWS.Credentials, {
|
||||
/**
|
||||
* Creates a new temporary credentials object.
|
||||
*
|
||||
* @note In order to create temporary credentials, you first need to have
|
||||
* "master" credentials configured in {AWS.Config.credentials}. These
|
||||
* master credentials are necessary to retrieve the temporary credentials,
|
||||
* as well as refresh the credentials when they expire.
|
||||
* @param params [map] a map of options that are passed to the
|
||||
* {AWS.STS.assumeRole} or {AWS.STS.getSessionToken} operations.
|
||||
* If a `RoleArn` parameter is passed in, credentials will be based on the
|
||||
* IAM role.
|
||||
* @param masterCredentials [AWS.Credentials] the master (non-temporary) credentials
|
||||
* used to get and refresh temporary credentials from AWS STS.
|
||||
* @example Creating a new credentials object for generic temporary credentials
|
||||
* AWS.config.credentials = new AWS.TemporaryCredentials();
|
||||
* @example Creating a new credentials object for an IAM role
|
||||
* AWS.config.credentials = new AWS.TemporaryCredentials({
|
||||
* RoleArn: 'arn:aws:iam::1234567890:role/TemporaryCredentials',
|
||||
* });
|
||||
* @see AWS.STS.assumeRole
|
||||
* @see AWS.STS.getSessionToken
|
||||
*/
|
||||
constructor: function TemporaryCredentials(params, masterCredentials) {
|
||||
AWS.Credentials.call(this);
|
||||
this.loadMasterCredentials(masterCredentials);
|
||||
this.expired = true;
|
||||
|
||||
this.params = params || {};
|
||||
if (this.params.RoleArn) {
|
||||
this.params.RoleSessionName =
|
||||
this.params.RoleSessionName || 'temporary-credentials';
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Refreshes credentials using {AWS.STS.assumeRole} or
|
||||
* {AWS.STS.getSessionToken}, depending on whether an IAM role ARN was passed
|
||||
* to the credentials {constructor}.
|
||||
*
|
||||
* @callback callback function(err)
|
||||
* Called when the STS service responds (or fails). When
|
||||
* this callback is called with no error, it means that the credentials
|
||||
* information has been loaded into the object (as the `accessKeyId`,
|
||||
* `secretAccessKey`, and `sessionToken` properties).
|
||||
* @param err [Error] if an error occurred, this value will be filled
|
||||
* @see get
|
||||
*/
|
||||
refresh: function refresh (callback) {
|
||||
this.coalesceRefresh(callback || AWS.util.fn.callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
load: function load (callback) {
|
||||
var self = this;
|
||||
self.createClients();
|
||||
self.masterCredentials.get(function () {
|
||||
self.service.config.credentials = self.masterCredentials;
|
||||
var operation = self.params.RoleArn ?
|
||||
self.service.assumeRole : self.service.getSessionToken;
|
||||
operation.call(self.service, function (err, data) {
|
||||
if (!err) {
|
||||
self.service.credentialsFrom(data, self);
|
||||
}
|
||||
callback(err);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
loadMasterCredentials: function loadMasterCredentials (masterCredentials) {
|
||||
this.masterCredentials = masterCredentials || AWS.config.credentials;
|
||||
while (this.masterCredentials.masterCredentials) {
|
||||
this.masterCredentials = this.masterCredentials.masterCredentials;
|
||||
}
|
||||
|
||||
if (typeof this.masterCredentials.get !== 'function') {
|
||||
this.masterCredentials = new AWS.Credentials(this.masterCredentials);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
createClients: function () {
|
||||
this.service = this.service || new STS({params: this.params});
|
||||
}
|
||||
|
||||
});
|
||||
14
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/token_file_web_identity_credentials.d.ts
generated
vendored
Normal file
14
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/token_file_web_identity_credentials.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import {Credentials} from '../credentials';
|
||||
import {AWSError} from '../error';
|
||||
import {ConfigurationOptions} from '../config-base';
|
||||
export class TokenFileWebIdentityCredentials extends Credentials {
|
||||
/**
|
||||
* Creates a new credentials object with optional configuraion.
|
||||
* @param {Object} clientConfig - a map of configuration options to pass to the underlying STS client.
|
||||
*/
|
||||
constructor(clientConfig?: ConfigurationOptions);
|
||||
/**
|
||||
* Refreshes credentials using AWS.STS.assumeRoleWithWebIdentity().
|
||||
*/
|
||||
refresh(callback: (err?: AWSError) => void): void;
|
||||
}
|
||||
207
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/token_file_web_identity_credentials.js
generated
vendored
Normal file
207
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/token_file_web_identity_credentials.js
generated
vendored
Normal file
@@ -0,0 +1,207 @@
|
||||
var AWS = require('../core');
|
||||
var fs = require('fs');
|
||||
var STS = require('../../clients/sts');
|
||||
var iniLoader = AWS.util.iniLoader;
|
||||
|
||||
/**
|
||||
* Represents OIDC credentials from a file on disk
|
||||
* If the credentials expire, the SDK can {refresh} the credentials
|
||||
* from the file.
|
||||
*
|
||||
* ## Using the web identity token file
|
||||
*
|
||||
* This provider is checked by default in the Node.js environment. To use
|
||||
* the provider simply add your OIDC token to a file (ASCII encoding) and
|
||||
* share the filename in either AWS_WEB_IDENTITY_TOKEN_FILE environment
|
||||
* variable or web_identity_token_file shared config variable
|
||||
*
|
||||
* The file contains encoded OIDC token and the characters are
|
||||
* ASCII encoded. OIDC tokens are JSON Web Tokens (JWT).
|
||||
* JWT's are 3 base64 encoded strings joined by the '.' character.
|
||||
*
|
||||
* This class will read filename from AWS_WEB_IDENTITY_TOKEN_FILE
|
||||
* environment variable or web_identity_token_file shared config variable,
|
||||
* and get the OIDC token from filename.
|
||||
* It will also read IAM role to be assumed from AWS_ROLE_ARN
|
||||
* environment variable or role_arn shared config variable.
|
||||
* This provider gets credetials using the {AWS.STS.assumeRoleWithWebIdentity}
|
||||
* service operation
|
||||
*
|
||||
* @!macro nobrowser
|
||||
*/
|
||||
AWS.TokenFileWebIdentityCredentials = AWS.util.inherit(AWS.Credentials, {
|
||||
|
||||
/**
|
||||
* @example Creating a new credentials object
|
||||
* AWS.config.credentials = new AWS.TokenFileWebIdentityCredentials(
|
||||
* // optionally provide configuration to apply to the underlying AWS.STS service client
|
||||
* // if configuration is not provided, then configuration will be pulled from AWS.config
|
||||
* {
|
||||
* // specify timeout options
|
||||
* httpOptions: {
|
||||
* timeout: 100
|
||||
* }
|
||||
* });
|
||||
* @see AWS.Config
|
||||
*/
|
||||
constructor: function TokenFileWebIdentityCredentials(clientConfig) {
|
||||
AWS.Credentials.call(this);
|
||||
this.data = null;
|
||||
this.clientConfig = AWS.util.copy(clientConfig || {});
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns params from environment variables
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
getParamsFromEnv: function getParamsFromEnv() {
|
||||
var ENV_TOKEN_FILE = 'AWS_WEB_IDENTITY_TOKEN_FILE',
|
||||
ENV_ROLE_ARN = 'AWS_ROLE_ARN';
|
||||
if (process.env[ENV_TOKEN_FILE] && process.env[ENV_ROLE_ARN]) {
|
||||
return [{
|
||||
envTokenFile: process.env[ENV_TOKEN_FILE],
|
||||
roleArn: process.env[ENV_ROLE_ARN],
|
||||
roleSessionName: process.env['AWS_ROLE_SESSION_NAME']
|
||||
}];
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns params from shared config variables
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
getParamsFromSharedConfig: function getParamsFromSharedConfig() {
|
||||
var profiles = AWS.util.getProfilesFromSharedConfig(iniLoader);
|
||||
var profileName = process.env.AWS_PROFILE || AWS.util.defaultProfile;
|
||||
var profile = profiles[profileName] || {};
|
||||
|
||||
if (Object.keys(profile).length === 0) {
|
||||
throw AWS.util.error(
|
||||
new Error('Profile ' + profileName + ' not found'),
|
||||
{ code: 'TokenFileWebIdentityCredentialsProviderFailure' }
|
||||
);
|
||||
}
|
||||
|
||||
var paramsArray = [];
|
||||
|
||||
while (!profile['web_identity_token_file'] && profile['source_profile']) {
|
||||
paramsArray.unshift({
|
||||
roleArn: profile['role_arn'],
|
||||
roleSessionName: profile['role_session_name']
|
||||
});
|
||||
var sourceProfile = profile['source_profile'];
|
||||
profile = profiles[sourceProfile];
|
||||
}
|
||||
|
||||
paramsArray.unshift({
|
||||
envTokenFile: profile['web_identity_token_file'],
|
||||
roleArn: profile['role_arn'],
|
||||
roleSessionName: profile['role_session_name']
|
||||
});
|
||||
|
||||
return paramsArray;
|
||||
},
|
||||
|
||||
/**
|
||||
* Refreshes credentials using {AWS.STS.assumeRoleWithWebIdentity}
|
||||
*
|
||||
* @callback callback function(err)
|
||||
* Called when the STS service responds (or fails). When
|
||||
* this callback is called with no error, it means that the credentials
|
||||
* information has been loaded into the object (as the `accessKeyId`,
|
||||
* `secretAccessKey`, and `sessionToken` properties).
|
||||
* @param err [Error] if an error occurred, this value will be filled
|
||||
* @see AWS.Credentials.get
|
||||
*/
|
||||
refresh: function refresh(callback) {
|
||||
this.coalesceRefresh(callback || AWS.util.fn.callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
assumeRoleChaining: function assumeRoleChaining(paramsArray, callback) {
|
||||
var self = this;
|
||||
if (paramsArray.length === 0) {
|
||||
self.service.credentialsFrom(self.data, self);
|
||||
callback();
|
||||
} else {
|
||||
var params = paramsArray.shift();
|
||||
self.service.config.credentials = self.service.credentialsFrom(self.data, self);
|
||||
self.service.assumeRole(
|
||||
{
|
||||
RoleArn: params.roleArn,
|
||||
RoleSessionName: params.roleSessionName || 'token-file-web-identity'
|
||||
},
|
||||
function (err, data) {
|
||||
self.data = null;
|
||||
if (err) {
|
||||
callback(err);
|
||||
} else {
|
||||
self.data = data;
|
||||
self.assumeRoleChaining(paramsArray, callback);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
load: function load(callback) {
|
||||
var self = this;
|
||||
try {
|
||||
var paramsArray = self.getParamsFromEnv();
|
||||
if (!paramsArray) {
|
||||
paramsArray = self.getParamsFromSharedConfig();
|
||||
}
|
||||
if (paramsArray) {
|
||||
var params = paramsArray.shift();
|
||||
var oidcToken = fs.readFileSync(params.envTokenFile, {encoding: 'ascii'});
|
||||
if (!self.service) {
|
||||
self.createClients();
|
||||
}
|
||||
self.service.assumeRoleWithWebIdentity(
|
||||
{
|
||||
WebIdentityToken: oidcToken,
|
||||
RoleArn: params.roleArn,
|
||||
RoleSessionName: params.roleSessionName || 'token-file-web-identity'
|
||||
},
|
||||
function (err, data) {
|
||||
self.data = null;
|
||||
if (err) {
|
||||
callback(err);
|
||||
} else {
|
||||
self.data = data;
|
||||
self.assumeRoleChaining(paramsArray, callback);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
callback(err);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
createClients: function() {
|
||||
if (!this.service) {
|
||||
var stsConfig = AWS.util.merge({}, this.clientConfig);
|
||||
this.service = new STS(stsConfig);
|
||||
|
||||
// Retry in case of IDPCommunicationErrorException or InvalidIdentityToken
|
||||
this.service.retryableError = function(error) {
|
||||
if (error.code === 'IDPCommunicationErrorException' || error.code === 'InvalidIdentityToken') {
|
||||
return true;
|
||||
} else {
|
||||
return AWS.Service.prototype.retryableError.call(this, error);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
30
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/web_identity_credentials.d.ts
generated
vendored
Normal file
30
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/web_identity_credentials.d.ts
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import {Credentials} from '../credentials';
|
||||
import {AWSError} from '../error';
|
||||
import {ConfigurationOptions} from '../config-base';
|
||||
import STS = require('../../clients/sts');
|
||||
export class WebIdentityCredentials extends Credentials {
|
||||
/**
|
||||
* Creates a new credentials object with optional configuraion.
|
||||
* @param {Object} options - a map of options that are passed to the AWS.STS.assumeRole() or AWS.STS.getSessionToken() operations. If a RoleArn parameter is passed in, credentials will be based on the IAM role.
|
||||
* @param {Object} clientConfig - a map of configuration options to pass to the underlying STS client.
|
||||
*/
|
||||
constructor(options: WebIdentityCredentials.WebIdentityCredentialsOptions, clientConfig?: ConfigurationOptions);
|
||||
/**
|
||||
* Creates a new credentials object.
|
||||
* @param {string} options - a map of options that are passed to the AWS.STS.assumeRole() or AWS.STS.getSessionToken() operations. If a RoleArn parameter is passed in, credentials will be based on the IAM role.
|
||||
*/
|
||||
constructor(options?: WebIdentityCredentials.WebIdentityCredentialsOptions);
|
||||
/**
|
||||
* Refreshes credentials using AWS.STS.assumeRoleWithWebIdentity().
|
||||
*/
|
||||
refresh(callback: (err?: AWSError) => void): void;
|
||||
|
||||
data: STS.Types.AssumeRoleWithWebIdentityResponse;
|
||||
params: STS.Types.AssumeRoleWithWebIdentityRequest
|
||||
}
|
||||
|
||||
// Needed to expose interfaces on the class
|
||||
declare namespace WebIdentityCredentials {
|
||||
export type ClientConfiguration = ConfigurationOptions;
|
||||
export type WebIdentityCredentialsOptions = STS.AssumeRoleWithWebIdentityRequest;
|
||||
}
|
||||
115
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/web_identity_credentials.js
generated
vendored
Normal file
115
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/credentials/web_identity_credentials.js
generated
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
var AWS = require('../core');
|
||||
var STS = require('../../clients/sts');
|
||||
|
||||
/**
|
||||
* Represents credentials retrieved from STS Web Identity Federation support.
|
||||
*
|
||||
* By default this provider gets credentials using the
|
||||
* {AWS.STS.assumeRoleWithWebIdentity} service operation. This operation
|
||||
* requires a `RoleArn` containing the ARN of the IAM trust policy for the
|
||||
* application for which credentials will be given. In addition, the
|
||||
* `WebIdentityToken` must be set to the token provided by the identity
|
||||
* provider. See {constructor} for an example on creating a credentials
|
||||
* object with proper `RoleArn` and `WebIdentityToken` values.
|
||||
*
|
||||
* ## Refreshing Credentials from Identity Service
|
||||
*
|
||||
* In addition to AWS credentials expiring after a given amount of time, the
|
||||
* login token from the identity provider will also expire. Once this token
|
||||
* expires, it will not be usable to refresh AWS credentials, and another
|
||||
* token will be needed. The SDK does not manage refreshing of the token value,
|
||||
* but this can be done through a "refresh token" supported by most identity
|
||||
* providers. Consult the documentation for the identity provider for refreshing
|
||||
* tokens. Once the refreshed token is acquired, you should make sure to update
|
||||
* this new token in the credentials object's {params} property. The following
|
||||
* code will update the WebIdentityToken, assuming you have retrieved an updated
|
||||
* token from the identity provider:
|
||||
*
|
||||
* ```javascript
|
||||
* AWS.config.credentials.params.WebIdentityToken = updatedToken;
|
||||
* ```
|
||||
*
|
||||
* Future calls to `credentials.refresh()` will now use the new token.
|
||||
*
|
||||
* @!attribute params
|
||||
* @return [map] the map of params passed to
|
||||
* {AWS.STS.assumeRoleWithWebIdentity}. To update the token, set the
|
||||
* `params.WebIdentityToken` property.
|
||||
* @!attribute data
|
||||
* @return [map] the raw data response from the call to
|
||||
* {AWS.STS.assumeRoleWithWebIdentity}. Use this if you want to get
|
||||
* access to other properties from the response.
|
||||
*/
|
||||
AWS.WebIdentityCredentials = AWS.util.inherit(AWS.Credentials, {
|
||||
/**
|
||||
* Creates a new credentials object.
|
||||
* @param (see AWS.STS.assumeRoleWithWebIdentity)
|
||||
* @example Creating a new credentials object
|
||||
* AWS.config.credentials = new AWS.WebIdentityCredentials({
|
||||
* RoleArn: 'arn:aws:iam::1234567890:role/WebIdentity',
|
||||
* WebIdentityToken: 'ABCDEFGHIJKLMNOP', // token from identity service
|
||||
* RoleSessionName: 'web' // optional name, defaults to web-identity
|
||||
* }, {
|
||||
* // optionally provide configuration to apply to the underlying AWS.STS service client
|
||||
* // if configuration is not provided, then configuration will be pulled from AWS.config
|
||||
*
|
||||
* // specify timeout options
|
||||
* httpOptions: {
|
||||
* timeout: 100
|
||||
* }
|
||||
* });
|
||||
* @see AWS.STS.assumeRoleWithWebIdentity
|
||||
* @see AWS.Config
|
||||
*/
|
||||
constructor: function WebIdentityCredentials(params, clientConfig) {
|
||||
AWS.Credentials.call(this);
|
||||
this.expired = true;
|
||||
this.params = params;
|
||||
this.params.RoleSessionName = this.params.RoleSessionName || 'web-identity';
|
||||
this.data = null;
|
||||
this._clientConfig = AWS.util.copy(clientConfig || {});
|
||||
},
|
||||
|
||||
/**
|
||||
* Refreshes credentials using {AWS.STS.assumeRoleWithWebIdentity}
|
||||
*
|
||||
* @callback callback function(err)
|
||||
* Called when the STS service responds (or fails). When
|
||||
* this callback is called with no error, it means that the credentials
|
||||
* information has been loaded into the object (as the `accessKeyId`,
|
||||
* `secretAccessKey`, and `sessionToken` properties).
|
||||
* @param err [Error] if an error occurred, this value will be filled
|
||||
* @see get
|
||||
*/
|
||||
refresh: function refresh(callback) {
|
||||
this.coalesceRefresh(callback || AWS.util.fn.callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
load: function load(callback) {
|
||||
var self = this;
|
||||
self.createClients();
|
||||
self.service.assumeRoleWithWebIdentity(function (err, data) {
|
||||
self.data = null;
|
||||
if (!err) {
|
||||
self.data = data;
|
||||
self.service.credentialsFrom(data, self);
|
||||
}
|
||||
callback(err);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
createClients: function() {
|
||||
if (!this.service) {
|
||||
var stsConfig = AWS.util.merge({}, this._clientConfig);
|
||||
stsConfig.params = this.params;
|
||||
this.service = new STS(stsConfig);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
377
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/discover_endpoint.js
generated
vendored
Normal file
377
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/discover_endpoint.js
generated
vendored
Normal file
@@ -0,0 +1,377 @@
|
||||
var AWS = require('./core');
|
||||
var util = require('./util');
|
||||
var endpointDiscoveryEnabledEnvs = ['AWS_ENABLE_ENDPOINT_DISCOVERY', 'AWS_ENDPOINT_DISCOVERY_ENABLED'];
|
||||
|
||||
/**
|
||||
* Generate key (except resources and operation part) to index the endpoints in the cache
|
||||
* If input shape has endpointdiscoveryid trait then use
|
||||
* accessKey + operation + resources + region + service as cache key
|
||||
* If input shape doesn't have endpointdiscoveryid trait then use
|
||||
* accessKey + region + service as cache key
|
||||
* @return [map<String,String>] object with keys to index endpoints.
|
||||
* @api private
|
||||
*/
|
||||
function getCacheKey(request) {
|
||||
var service = request.service;
|
||||
var api = service.api || {};
|
||||
var operations = api.operations;
|
||||
var identifiers = {};
|
||||
if (service.config.region) {
|
||||
identifiers.region = service.config.region;
|
||||
}
|
||||
if (api.serviceId) {
|
||||
identifiers.serviceId = api.serviceId;
|
||||
}
|
||||
if (service.config.credentials.accessKeyId) {
|
||||
identifiers.accessKeyId = service.config.credentials.accessKeyId;
|
||||
}
|
||||
return identifiers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursive helper for marshallCustomIdentifiers().
|
||||
* Looks for required string input members that have 'endpointdiscoveryid' trait.
|
||||
* @api private
|
||||
*/
|
||||
function marshallCustomIdentifiersHelper(result, params, shape) {
|
||||
if (!shape || params === undefined || params === null) return;
|
||||
if (shape.type === 'structure' && shape.required && shape.required.length > 0) {
|
||||
util.arrayEach(shape.required, function(name) {
|
||||
var memberShape = shape.members[name];
|
||||
if (memberShape.endpointDiscoveryId === true) {
|
||||
var locationName = memberShape.isLocationName ? memberShape.name : name;
|
||||
result[locationName] = String(params[name]);
|
||||
} else {
|
||||
marshallCustomIdentifiersHelper(result, params[name], memberShape);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom identifiers for cache key.
|
||||
* Identifies custom identifiers by checking each shape's `endpointDiscoveryId` trait.
|
||||
* @param [object] request object
|
||||
* @param [object] input shape of the given operation's api
|
||||
* @api private
|
||||
*/
|
||||
function marshallCustomIdentifiers(request, shape) {
|
||||
var identifiers = {};
|
||||
marshallCustomIdentifiersHelper(identifiers, request.params, shape);
|
||||
return identifiers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call endpoint discovery operation when it's optional.
|
||||
* When endpoint is available in cache then use the cached endpoints. If endpoints
|
||||
* are unavailable then use regional endpoints and call endpoint discovery operation
|
||||
* asynchronously. This is turned off by default.
|
||||
* @param [object] request object
|
||||
* @api private
|
||||
*/
|
||||
function optionalDiscoverEndpoint(request) {
|
||||
var service = request.service;
|
||||
var api = service.api;
|
||||
var operationModel = api.operations ? api.operations[request.operation] : undefined;
|
||||
var inputShape = operationModel ? operationModel.input : undefined;
|
||||
|
||||
var identifiers = marshallCustomIdentifiers(request, inputShape);
|
||||
var cacheKey = getCacheKey(request);
|
||||
if (Object.keys(identifiers).length > 0) {
|
||||
cacheKey = util.update(cacheKey, identifiers);
|
||||
if (operationModel) cacheKey.operation = operationModel.name;
|
||||
}
|
||||
var endpoints = AWS.endpointCache.get(cacheKey);
|
||||
if (endpoints && endpoints.length === 1 && endpoints[0].Address === '') {
|
||||
//endpoint operation is being made but response not yet received
|
||||
//or endpoint operation just failed in 1 minute
|
||||
return;
|
||||
} else if (endpoints && endpoints.length > 0) {
|
||||
//found endpoint record from cache
|
||||
request.httpRequest.updateEndpoint(endpoints[0].Address);
|
||||
} else {
|
||||
//endpoint record not in cache or outdated. make discovery operation
|
||||
var endpointRequest = service.makeRequest(api.endpointOperation, {
|
||||
Operation: operationModel.name,
|
||||
Identifiers: identifiers,
|
||||
});
|
||||
addApiVersionHeader(endpointRequest);
|
||||
endpointRequest.removeListener('validate', AWS.EventListeners.Core.VALIDATE_PARAMETERS);
|
||||
endpointRequest.removeListener('retry', AWS.EventListeners.Core.RETRY_CHECK);
|
||||
//put in a placeholder for endpoints already requested, prevent
|
||||
//too much in-flight calls
|
||||
AWS.endpointCache.put(cacheKey, [{
|
||||
Address: '',
|
||||
CachePeriodInMinutes: 1
|
||||
}]);
|
||||
endpointRequest.send(function(err, data) {
|
||||
if (data && data.Endpoints) {
|
||||
AWS.endpointCache.put(cacheKey, data.Endpoints);
|
||||
} else if (err) {
|
||||
AWS.endpointCache.put(cacheKey, [{
|
||||
Address: '',
|
||||
CachePeriodInMinutes: 1 //not to make more endpoint operation in next 1 minute
|
||||
}]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var requestQueue = {};
|
||||
|
||||
/**
|
||||
* Call endpoint discovery operation when it's required.
|
||||
* When endpoint is available in cache then use cached ones. If endpoints are
|
||||
* unavailable then SDK should call endpoint operation then use returned new
|
||||
* endpoint for the api call. SDK will automatically attempt to do endpoint
|
||||
* discovery. This is turned off by default
|
||||
* @param [object] request object
|
||||
* @api private
|
||||
*/
|
||||
function requiredDiscoverEndpoint(request, done) {
|
||||
var service = request.service;
|
||||
var api = service.api;
|
||||
var operationModel = api.operations ? api.operations[request.operation] : undefined;
|
||||
var inputShape = operationModel ? operationModel.input : undefined;
|
||||
|
||||
var identifiers = marshallCustomIdentifiers(request, inputShape);
|
||||
var cacheKey = getCacheKey(request);
|
||||
if (Object.keys(identifiers).length > 0) {
|
||||
cacheKey = util.update(cacheKey, identifiers);
|
||||
if (operationModel) cacheKey.operation = operationModel.name;
|
||||
}
|
||||
var cacheKeyStr = AWS.EndpointCache.getKeyString(cacheKey);
|
||||
var endpoints = AWS.endpointCache.get(cacheKeyStr); //endpoint cache also accepts string keys
|
||||
if (endpoints && endpoints.length === 1 && endpoints[0].Address === '') {
|
||||
//endpoint operation is being made but response not yet received
|
||||
//push request object to a pending queue
|
||||
if (!requestQueue[cacheKeyStr]) requestQueue[cacheKeyStr] = [];
|
||||
requestQueue[cacheKeyStr].push({request: request, callback: done});
|
||||
return;
|
||||
} else if (endpoints && endpoints.length > 0) {
|
||||
request.httpRequest.updateEndpoint(endpoints[0].Address);
|
||||
done();
|
||||
} else {
|
||||
var endpointRequest = service.makeRequest(api.endpointOperation, {
|
||||
Operation: operationModel.name,
|
||||
Identifiers: identifiers,
|
||||
});
|
||||
endpointRequest.removeListener('validate', AWS.EventListeners.Core.VALIDATE_PARAMETERS);
|
||||
addApiVersionHeader(endpointRequest);
|
||||
|
||||
//put in a placeholder for endpoints already requested, prevent
|
||||
//too much in-flight calls
|
||||
AWS.endpointCache.put(cacheKeyStr, [{
|
||||
Address: '',
|
||||
CachePeriodInMinutes: 60 //long-live cache
|
||||
}]);
|
||||
endpointRequest.send(function(err, data) {
|
||||
if (err) {
|
||||
request.response.error = util.error(err, { retryable: false });
|
||||
AWS.endpointCache.remove(cacheKey);
|
||||
|
||||
//fail all the pending requests in batch
|
||||
if (requestQueue[cacheKeyStr]) {
|
||||
var pendingRequests = requestQueue[cacheKeyStr];
|
||||
util.arrayEach(pendingRequests, function(requestContext) {
|
||||
requestContext.request.response.error = util.error(err, { retryable: false });
|
||||
requestContext.callback();
|
||||
});
|
||||
delete requestQueue[cacheKeyStr];
|
||||
}
|
||||
} else if (data) {
|
||||
AWS.endpointCache.put(cacheKeyStr, data.Endpoints);
|
||||
request.httpRequest.updateEndpoint(data.Endpoints[0].Address);
|
||||
|
||||
//update the endpoint for all the pending requests in batch
|
||||
if (requestQueue[cacheKeyStr]) {
|
||||
var pendingRequests = requestQueue[cacheKeyStr];
|
||||
util.arrayEach(pendingRequests, function(requestContext) {
|
||||
requestContext.request.httpRequest.updateEndpoint(data.Endpoints[0].Address);
|
||||
requestContext.callback();
|
||||
});
|
||||
delete requestQueue[cacheKeyStr];
|
||||
}
|
||||
}
|
||||
done();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* add api version header to endpoint operation
|
||||
* @api private
|
||||
*/
|
||||
function addApiVersionHeader(endpointRequest) {
|
||||
var api = endpointRequest.service.api;
|
||||
var apiVersion = api.apiVersion;
|
||||
if (apiVersion && !endpointRequest.httpRequest.headers['x-amz-api-version']) {
|
||||
endpointRequest.httpRequest.headers['x-amz-api-version'] = apiVersion;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If api call gets invalid endpoint exception, SDK should attempt to remove the invalid
|
||||
* endpoint from cache.
|
||||
* @api private
|
||||
*/
|
||||
function invalidateCachedEndpoints(response) {
|
||||
var error = response.error;
|
||||
var httpResponse = response.httpResponse;
|
||||
if (error &&
|
||||
(error.code === 'InvalidEndpointException' || httpResponse.statusCode === 421)
|
||||
) {
|
||||
var request = response.request;
|
||||
var operations = request.service.api.operations || {};
|
||||
var inputShape = operations[request.operation] ? operations[request.operation].input : undefined;
|
||||
var identifiers = marshallCustomIdentifiers(request, inputShape);
|
||||
var cacheKey = getCacheKey(request);
|
||||
if (Object.keys(identifiers).length > 0) {
|
||||
cacheKey = util.update(cacheKey, identifiers);
|
||||
if (operations[request.operation]) cacheKey.operation = operations[request.operation].name;
|
||||
}
|
||||
AWS.endpointCache.remove(cacheKey);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If endpoint is explicitly configured, SDK should not do endpoint discovery in anytime.
|
||||
* @param [object] client Service client object.
|
||||
* @api private
|
||||
*/
|
||||
function hasCustomEndpoint(client) {
|
||||
//if set endpoint is set for specific client, enable endpoint discovery will raise an error.
|
||||
if (client._originalConfig && client._originalConfig.endpoint && client._originalConfig.endpointDiscoveryEnabled === true) {
|
||||
throw util.error(new Error(), {
|
||||
code: 'ConfigurationException',
|
||||
message: 'Custom endpoint is supplied; endpointDiscoveryEnabled must not be true.'
|
||||
});
|
||||
};
|
||||
var svcConfig = AWS.config[client.serviceIdentifier] || {};
|
||||
return Boolean(AWS.config.endpoint || svcConfig.endpoint || (client._originalConfig && client._originalConfig.endpoint));
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
function isFalsy(value) {
|
||||
return ['false', '0'].indexOf(value) >= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* If endpoint discovery should perform for this request when no operation requires endpoint
|
||||
* discovery for the given service.
|
||||
* SDK performs config resolution in order like below:
|
||||
* 1. If set in client configuration.
|
||||
* 2. If set in env AWS_ENABLE_ENDPOINT_DISCOVERY.
|
||||
* 3. If set in shared ini config file with key 'endpoint_discovery_enabled'.
|
||||
* @param [object] request request object.
|
||||
* @returns [boolean|undefined] if endpoint discovery config is not set in any source, this
|
||||
* function returns undefined
|
||||
* @api private
|
||||
*/
|
||||
function resolveEndpointDiscoveryConfig(request) {
|
||||
var service = request.service || {};
|
||||
if (service.config.endpointDiscoveryEnabled !== undefined) {
|
||||
return service.config.endpointDiscoveryEnabled;
|
||||
}
|
||||
|
||||
//shared ini file is only available in Node
|
||||
//not to check env in browser
|
||||
if (util.isBrowser()) return undefined;
|
||||
|
||||
// If any of recognized endpoint discovery config env is set
|
||||
for (var i = 0; i < endpointDiscoveryEnabledEnvs.length; i++) {
|
||||
var env = endpointDiscoveryEnabledEnvs[i];
|
||||
if (Object.prototype.hasOwnProperty.call(process.env, env)) {
|
||||
if (process.env[env] === '' || process.env[env] === undefined) {
|
||||
throw util.error(new Error(), {
|
||||
code: 'ConfigurationException',
|
||||
message: 'environmental variable ' + env + ' cannot be set to nothing'
|
||||
});
|
||||
}
|
||||
return !isFalsy(process.env[env]);
|
||||
}
|
||||
}
|
||||
|
||||
var configFile = {};
|
||||
try {
|
||||
configFile = AWS.util.iniLoader ? AWS.util.iniLoader.loadFrom({
|
||||
isConfig: true,
|
||||
filename: process.env[AWS.util.sharedConfigFileEnv]
|
||||
}) : {};
|
||||
} catch (e) {}
|
||||
var sharedFileConfig = configFile[
|
||||
process.env.AWS_PROFILE || AWS.util.defaultProfile
|
||||
] || {};
|
||||
if (Object.prototype.hasOwnProperty.call(sharedFileConfig, 'endpoint_discovery_enabled')) {
|
||||
if (sharedFileConfig.endpoint_discovery_enabled === undefined) {
|
||||
throw util.error(new Error(), {
|
||||
code: 'ConfigurationException',
|
||||
message: 'config file entry \'endpoint_discovery_enabled\' cannot be set to nothing'
|
||||
});
|
||||
}
|
||||
return !isFalsy(sharedFileConfig.endpoint_discovery_enabled);
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* attach endpoint discovery logic to request object
|
||||
* @param [object] request
|
||||
* @api private
|
||||
*/
|
||||
function discoverEndpoint(request, done) {
|
||||
var service = request.service || {};
|
||||
if (hasCustomEndpoint(service) || request.isPresigned()) return done();
|
||||
|
||||
var operations = service.api.operations || {};
|
||||
var operationModel = operations[request.operation];
|
||||
var isEndpointDiscoveryRequired = operationModel ? operationModel.endpointDiscoveryRequired : 'NULL';
|
||||
var isEnabled = resolveEndpointDiscoveryConfig(request);
|
||||
var hasRequiredEndpointDiscovery = service.api.hasRequiredEndpointDiscovery;
|
||||
if (isEnabled || hasRequiredEndpointDiscovery) {
|
||||
// Once a customer enables endpoint discovery, the SDK should start appending
|
||||
// the string endpoint-discovery to the user-agent on all requests.
|
||||
request.httpRequest.appendToUserAgent('endpoint-discovery');
|
||||
}
|
||||
switch (isEndpointDiscoveryRequired) {
|
||||
case 'OPTIONAL':
|
||||
if (isEnabled || hasRequiredEndpointDiscovery) {
|
||||
// For a given service; if at least one operation requires endpoint discovery then the SDK must enable endpoint discovery
|
||||
// by default for all operations of that service, including operations where endpoint discovery is optional.
|
||||
optionalDiscoverEndpoint(request);
|
||||
request.addNamedListener('INVALIDATE_CACHED_ENDPOINTS', 'extractError', invalidateCachedEndpoints);
|
||||
}
|
||||
done();
|
||||
break;
|
||||
case 'REQUIRED':
|
||||
if (isEnabled === false) {
|
||||
// For a given operation; if endpoint discovery is required and it has been disabled on the SDK client,
|
||||
// then the SDK must return a clear and actionable exception.
|
||||
request.response.error = util.error(new Error(), {
|
||||
code: 'ConfigurationException',
|
||||
message: 'Endpoint Discovery is disabled but ' + service.api.className + '.' + request.operation +
|
||||
'() requires it. Please check your configurations.'
|
||||
});
|
||||
done();
|
||||
break;
|
||||
}
|
||||
request.addNamedListener('INVALIDATE_CACHED_ENDPOINTS', 'extractError', invalidateCachedEndpoints);
|
||||
requiredDiscoverEndpoint(request, done);
|
||||
break;
|
||||
case 'NULL':
|
||||
default:
|
||||
done();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
discoverEndpoint: discoverEndpoint,
|
||||
requiredDiscoverEndpoint: requiredDiscoverEndpoint,
|
||||
optionalDiscoverEndpoint: optionalDiscoverEndpoint,
|
||||
marshallCustomIdentifiers: marshallCustomIdentifiers,
|
||||
getCacheKey: getCacheKey,
|
||||
invalidateCachedEndpoint: invalidateCachedEndpoints,
|
||||
};
|
||||
27
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/dynamodb/converter.d.ts
generated
vendored
Normal file
27
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/dynamodb/converter.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import DynamoDB = require('../../clients/dynamodb');
|
||||
|
||||
export class Converter {
|
||||
static input(
|
||||
data: any,
|
||||
options?: Converter.ConverterOptions
|
||||
): DynamoDB.AttributeValue;
|
||||
|
||||
static marshall(
|
||||
data: {[key: string]: any},
|
||||
options?: Converter.ConverterOptions
|
||||
): DynamoDB.AttributeMap;
|
||||
|
||||
static output(
|
||||
data: DynamoDB.AttributeValue,
|
||||
options?: Converter.ConverterOptions
|
||||
): any;
|
||||
|
||||
static unmarshall(
|
||||
data: DynamoDB.AttributeMap,
|
||||
options?: Converter.ConverterOptions
|
||||
): {[key: string]: any};
|
||||
}
|
||||
|
||||
export namespace Converter {
|
||||
export type ConverterOptions = DynamoDB.DocumentClient.ConverterOptions;
|
||||
}
|
||||
294
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/dynamodb/converter.js
generated
vendored
Normal file
294
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/dynamodb/converter.js
generated
vendored
Normal file
@@ -0,0 +1,294 @@
|
||||
var AWS = require('../core');
|
||||
var util = AWS.util;
|
||||
var typeOf = require('./types').typeOf;
|
||||
var DynamoDBSet = require('./set');
|
||||
var NumberValue = require('./numberValue');
|
||||
|
||||
AWS.DynamoDB.Converter = {
|
||||
/**
|
||||
* Convert a JavaScript value to its equivalent DynamoDB AttributeValue type
|
||||
*
|
||||
* @param data [any] The data to convert to a DynamoDB AttributeValue
|
||||
* @param options [map]
|
||||
* @option options convertEmptyValues [Boolean] Whether to automatically
|
||||
* convert empty strings, blobs,
|
||||
* and sets to `null`
|
||||
* @option options wrapNumbers [Boolean] Whether to return numbers as a
|
||||
* NumberValue object instead of
|
||||
* converting them to native JavaScript
|
||||
* numbers. This allows for the safe
|
||||
* round-trip transport of numbers of
|
||||
* arbitrary size.
|
||||
* @return [map] An object in the Amazon DynamoDB AttributeValue format
|
||||
*
|
||||
* @see AWS.DynamoDB.Converter.marshall AWS.DynamoDB.Converter.marshall to
|
||||
* convert entire records (rather than individual attributes)
|
||||
*/
|
||||
input: function convertInput(data, options) {
|
||||
options = options || {};
|
||||
var type = typeOf(data);
|
||||
if (type === 'Object') {
|
||||
return formatMap(data, options);
|
||||
} else if (type === 'Array') {
|
||||
return formatList(data, options);
|
||||
} else if (type === 'Set') {
|
||||
return formatSet(data, options);
|
||||
} else if (type === 'String') {
|
||||
if (data.length === 0 && options.convertEmptyValues) {
|
||||
return convertInput(null);
|
||||
}
|
||||
return { S: data };
|
||||
} else if (type === 'Number' || type === 'NumberValue') {
|
||||
return { N: data.toString() };
|
||||
} else if (type === 'Binary') {
|
||||
if (data.length === 0 && options.convertEmptyValues) {
|
||||
return convertInput(null);
|
||||
}
|
||||
return { B: data };
|
||||
} else if (type === 'Boolean') {
|
||||
return { BOOL: data };
|
||||
} else if (type === 'null') {
|
||||
return { NULL: true };
|
||||
} else if (type !== 'undefined' && type !== 'Function') {
|
||||
// this value has a custom constructor
|
||||
return formatMap(data, options);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Convert a JavaScript object into a DynamoDB record.
|
||||
*
|
||||
* @param data [any] The data to convert to a DynamoDB record
|
||||
* @param options [map]
|
||||
* @option options convertEmptyValues [Boolean] Whether to automatically
|
||||
* convert empty strings, blobs,
|
||||
* and sets to `null`
|
||||
* @option options wrapNumbers [Boolean] Whether to return numbers as a
|
||||
* NumberValue object instead of
|
||||
* converting them to native JavaScript
|
||||
* numbers. This allows for the safe
|
||||
* round-trip transport of numbers of
|
||||
* arbitrary size.
|
||||
*
|
||||
* @return [map] An object in the DynamoDB record format.
|
||||
*
|
||||
* @example Convert a JavaScript object into a DynamoDB record
|
||||
* var marshalled = AWS.DynamoDB.Converter.marshall({
|
||||
* string: 'foo',
|
||||
* list: ['fizz', 'buzz', 'pop'],
|
||||
* map: {
|
||||
* nestedMap: {
|
||||
* key: 'value',
|
||||
* }
|
||||
* },
|
||||
* number: 123,
|
||||
* nullValue: null,
|
||||
* boolValue: true,
|
||||
* stringSet: new DynamoDBSet(['foo', 'bar', 'baz'])
|
||||
* });
|
||||
*/
|
||||
marshall: function marshallItem(data, options) {
|
||||
return AWS.DynamoDB.Converter.input(data, options).M;
|
||||
},
|
||||
|
||||
/**
|
||||
* Convert a DynamoDB AttributeValue object to its equivalent JavaScript type.
|
||||
*
|
||||
* @param data [map] An object in the Amazon DynamoDB AttributeValue format
|
||||
* @param options [map]
|
||||
* @option options convertEmptyValues [Boolean] Whether to automatically
|
||||
* convert empty strings, blobs,
|
||||
* and sets to `null`
|
||||
* @option options wrapNumbers [Boolean] Whether to return numbers as a
|
||||
* NumberValue object instead of
|
||||
* converting them to native JavaScript
|
||||
* numbers. This allows for the safe
|
||||
* round-trip transport of numbers of
|
||||
* arbitrary size.
|
||||
*
|
||||
* @return [Object|Array|String|Number|Boolean|null]
|
||||
*
|
||||
* @see AWS.DynamoDB.Converter.unmarshall AWS.DynamoDB.Converter.unmarshall to
|
||||
* convert entire records (rather than individual attributes)
|
||||
*/
|
||||
output: function convertOutput(data, options) {
|
||||
options = options || {};
|
||||
var list, map, i;
|
||||
for (var type in data) {
|
||||
var values = data[type];
|
||||
if (type === 'M') {
|
||||
map = {};
|
||||
for (var key in values) {
|
||||
map[key] = convertOutput(values[key], options);
|
||||
}
|
||||
return map;
|
||||
} else if (type === 'L') {
|
||||
list = [];
|
||||
for (i = 0; i < values.length; i++) {
|
||||
list.push(convertOutput(values[i], options));
|
||||
}
|
||||
return list;
|
||||
} else if (type === 'SS') {
|
||||
list = [];
|
||||
for (i = 0; i < values.length; i++) {
|
||||
list.push(values[i] + '');
|
||||
}
|
||||
return new DynamoDBSet(list);
|
||||
} else if (type === 'NS') {
|
||||
list = [];
|
||||
for (i = 0; i < values.length; i++) {
|
||||
list.push(convertNumber(values[i], options.wrapNumbers));
|
||||
}
|
||||
return new DynamoDBSet(list);
|
||||
} else if (type === 'BS') {
|
||||
list = [];
|
||||
for (i = 0; i < values.length; i++) {
|
||||
list.push(AWS.util.buffer.toBuffer(values[i]));
|
||||
}
|
||||
return new DynamoDBSet(list);
|
||||
} else if (type === 'S') {
|
||||
return values + '';
|
||||
} else if (type === 'N') {
|
||||
return convertNumber(values, options.wrapNumbers);
|
||||
} else if (type === 'B') {
|
||||
return util.buffer.toBuffer(values);
|
||||
} else if (type === 'BOOL') {
|
||||
return (values === 'true' || values === 'TRUE' || values === true);
|
||||
} else if (type === 'NULL') {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Convert a DynamoDB record into a JavaScript object.
|
||||
*
|
||||
* @param data [any] The DynamoDB record
|
||||
* @param options [map]
|
||||
* @option options convertEmptyValues [Boolean] Whether to automatically
|
||||
* convert empty strings, blobs,
|
||||
* and sets to `null`
|
||||
* @option options wrapNumbers [Boolean] Whether to return numbers as a
|
||||
* NumberValue object instead of
|
||||
* converting them to native JavaScript
|
||||
* numbers. This allows for the safe
|
||||
* round-trip transport of numbers of
|
||||
* arbitrary size.
|
||||
*
|
||||
* @return [map] An object whose properties have been converted from
|
||||
* DynamoDB's AttributeValue format into their corresponding native
|
||||
* JavaScript types.
|
||||
*
|
||||
* @example Convert a record received from a DynamoDB stream
|
||||
* var unmarshalled = AWS.DynamoDB.Converter.unmarshall({
|
||||
* string: {S: 'foo'},
|
||||
* list: {L: [{S: 'fizz'}, {S: 'buzz'}, {S: 'pop'}]},
|
||||
* map: {
|
||||
* M: {
|
||||
* nestedMap: {
|
||||
* M: {
|
||||
* key: {S: 'value'}
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* },
|
||||
* number: {N: '123'},
|
||||
* nullValue: {NULL: true},
|
||||
* boolValue: {BOOL: true}
|
||||
* });
|
||||
*/
|
||||
unmarshall: function unmarshall(data, options) {
|
||||
return AWS.DynamoDB.Converter.output({M: data}, options);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @api private
|
||||
* @param data [Array]
|
||||
* @param options [map]
|
||||
*/
|
||||
function formatList(data, options) {
|
||||
var list = {L: []};
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
list['L'].push(AWS.DynamoDB.Converter.input(data[i], options));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
* @param value [String]
|
||||
* @param wrapNumbers [Boolean]
|
||||
*/
|
||||
function convertNumber(value, wrapNumbers) {
|
||||
return wrapNumbers ? new NumberValue(value) : Number(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
* @param data [map]
|
||||
* @param options [map]
|
||||
*/
|
||||
function formatMap(data, options) {
|
||||
var map = {M: {}};
|
||||
for (var key in data) {
|
||||
var formatted = AWS.DynamoDB.Converter.input(data[key], options);
|
||||
if (formatted !== void 0) {
|
||||
map['M'][key] = formatted;
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
function formatSet(data, options) {
|
||||
options = options || {};
|
||||
var values = data.values;
|
||||
if (options.convertEmptyValues) {
|
||||
values = filterEmptySetValues(data);
|
||||
if (values.length === 0) {
|
||||
return AWS.DynamoDB.Converter.input(null);
|
||||
}
|
||||
}
|
||||
|
||||
var map = {};
|
||||
switch (data.type) {
|
||||
case 'String': map['SS'] = values; break;
|
||||
case 'Binary': map['BS'] = values; break;
|
||||
case 'Number': map['NS'] = values.map(function (value) {
|
||||
return value.toString();
|
||||
});
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
function filterEmptySetValues(set) {
|
||||
var nonEmptyValues = [];
|
||||
var potentiallyEmptyTypes = {
|
||||
String: true,
|
||||
Binary: true,
|
||||
Number: false
|
||||
};
|
||||
if (potentiallyEmptyTypes[set.type]) {
|
||||
for (var i = 0; i < set.values.length; i++) {
|
||||
if (set.values[i].length === 0) {
|
||||
continue;
|
||||
}
|
||||
nonEmptyValues.push(set.values[i]);
|
||||
}
|
||||
|
||||
return nonEmptyValues;
|
||||
}
|
||||
|
||||
return set.values;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = AWS.DynamoDB.Converter;
|
||||
3557
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/dynamodb/document_client.d.ts
generated
vendored
Normal file
3557
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/dynamodb/document_client.d.ts
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
583
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/dynamodb/document_client.js
generated
vendored
Normal file
583
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/dynamodb/document_client.js
generated
vendored
Normal file
@@ -0,0 +1,583 @@
|
||||
var AWS = require('../core');
|
||||
var Translator = require('./translator');
|
||||
var DynamoDBSet = require('./set');
|
||||
|
||||
/**
|
||||
* The document client simplifies working with items in Amazon DynamoDB
|
||||
* by abstracting away the notion of attribute values. This abstraction
|
||||
* annotates native JavaScript types supplied as input parameters, as well
|
||||
* as converts annotated response data to native JavaScript types.
|
||||
*
|
||||
* ## Marshalling Input and Unmarshalling Response Data
|
||||
*
|
||||
* The document client affords developers the use of native JavaScript types
|
||||
* instead of `AttributeValue`s to simplify the JavaScript development
|
||||
* experience with Amazon DynamoDB. JavaScript objects passed in as parameters
|
||||
* are marshalled into `AttributeValue` shapes required by Amazon DynamoDB.
|
||||
* Responses from DynamoDB are unmarshalled into plain JavaScript objects
|
||||
* by the `DocumentClient`. The `DocumentClient`, does not accept
|
||||
* `AttributeValue`s in favor of native JavaScript types.
|
||||
*
|
||||
* | JavaScript Type | DynamoDB AttributeValue |
|
||||
* |:----------------------------------------------------------------------:|-------------------------|
|
||||
* | String | S |
|
||||
* | Number | N |
|
||||
* | Boolean | BOOL |
|
||||
* | null | NULL |
|
||||
* | Array | L |
|
||||
* | Object | M |
|
||||
* | Buffer, File, Blob, ArrayBuffer, DataView, and JavaScript typed arrays | B |
|
||||
*
|
||||
* ## Support for Sets
|
||||
*
|
||||
* The `DocumentClient` offers a convenient way to create sets from
|
||||
* JavaScript Arrays. The type of set is inferred from the first element
|
||||
* in the array. DynamoDB supports string, number, and binary sets. To
|
||||
* learn more about supported types see the
|
||||
* [Amazon DynamoDB Data Model Documentation](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataModel.html)
|
||||
* For more information see {AWS.DynamoDB.DocumentClient.createSet}
|
||||
*
|
||||
*/
|
||||
AWS.DynamoDB.DocumentClient = AWS.util.inherit({
|
||||
|
||||
/**
|
||||
* Creates a DynamoDB document client with a set of configuration options.
|
||||
*
|
||||
* @option options params [map] An optional map of parameters to bind to every
|
||||
* request sent by this service object.
|
||||
* @option options service [AWS.DynamoDB] An optional pre-configured instance
|
||||
* of the AWS.DynamoDB service object. This instance's config will be
|
||||
* copied to a new instance used by this client. You should not need to
|
||||
* retain a reference to the input object, and may destroy it or allow it
|
||||
* to be garbage collected.
|
||||
* @option options convertEmptyValues [Boolean] set to true if you would like
|
||||
* the document client to convert empty values (0-length strings, binary
|
||||
* buffers, and sets) to be converted to NULL types when persisting to
|
||||
* DynamoDB.
|
||||
* @option options wrapNumbers [Boolean] Set to true to return numbers as a
|
||||
* NumberValue object instead of converting them to native JavaScript numbers.
|
||||
* This allows for the safe round-trip transport of numbers of arbitrary size.
|
||||
* @see AWS.DynamoDB.constructor
|
||||
*
|
||||
*/
|
||||
constructor: function DocumentClient(options) {
|
||||
var self = this;
|
||||
self.options = options || {};
|
||||
self.configure(self.options);
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
configure: function configure(options) {
|
||||
var self = this;
|
||||
self.service = options.service;
|
||||
self.bindServiceObject(options);
|
||||
self.attrValue = options.attrValue =
|
||||
self.service.api.operations.putItem.input.members.Item.value.shape;
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
bindServiceObject: function bindServiceObject(options) {
|
||||
var self = this;
|
||||
options = options || {};
|
||||
|
||||
if (!self.service) {
|
||||
self.service = new AWS.DynamoDB(options);
|
||||
} else {
|
||||
var config = AWS.util.copy(self.service.config);
|
||||
self.service = new self.service.constructor.__super__(config);
|
||||
self.service.config.params =
|
||||
AWS.util.merge(self.service.config.params || {}, options.params);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
makeServiceRequest: function(operation, params, callback) {
|
||||
var self = this;
|
||||
var request = self.service[operation](params);
|
||||
self.setupRequest(request);
|
||||
self.setupResponse(request);
|
||||
if (typeof callback === 'function') {
|
||||
request.send(callback);
|
||||
}
|
||||
return request;
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
serviceClientOperationsMap: {
|
||||
batchGet: 'batchGetItem',
|
||||
batchWrite: 'batchWriteItem',
|
||||
delete: 'deleteItem',
|
||||
get: 'getItem',
|
||||
put: 'putItem',
|
||||
query: 'query',
|
||||
scan: 'scan',
|
||||
update: 'updateItem',
|
||||
transactGet: 'transactGetItems',
|
||||
transactWrite: 'transactWriteItems'
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the attributes of one or more items from one or more tables
|
||||
* by delegating to `AWS.DynamoDB.batchGetItem()`.
|
||||
*
|
||||
* Supply the same parameters as {AWS.DynamoDB.batchGetItem} with
|
||||
* `AttributeValue`s substituted by native JavaScript types.
|
||||
*
|
||||
* @see AWS.DynamoDB.batchGetItem
|
||||
* @example Get items from multiple tables
|
||||
* var params = {
|
||||
* RequestItems: {
|
||||
* 'Table-1': {
|
||||
* Keys: [
|
||||
* {
|
||||
* HashKey: 'haskey',
|
||||
* NumberRangeKey: 1
|
||||
* }
|
||||
* ]
|
||||
* },
|
||||
* 'Table-2': {
|
||||
* Keys: [
|
||||
* { foo: 'bar' },
|
||||
* ]
|
||||
* }
|
||||
* }
|
||||
* };
|
||||
*
|
||||
* var documentClient = new AWS.DynamoDB.DocumentClient();
|
||||
*
|
||||
* documentClient.batchGet(params, function(err, data) {
|
||||
* if (err) console.log(err);
|
||||
* else console.log(data);
|
||||
* });
|
||||
*
|
||||
*/
|
||||
batchGet: function(params, callback) {
|
||||
var operation = this.serviceClientOperationsMap['batchGet'];
|
||||
return this.makeServiceRequest(operation, params, callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* Puts or deletes multiple items in one or more tables by delegating
|
||||
* to `AWS.DynamoDB.batchWriteItem()`.
|
||||
*
|
||||
* Supply the same parameters as {AWS.DynamoDB.batchWriteItem} with
|
||||
* `AttributeValue`s substituted by native JavaScript types.
|
||||
*
|
||||
* @see AWS.DynamoDB.batchWriteItem
|
||||
* @example Write to and delete from a table
|
||||
* var params = {
|
||||
* RequestItems: {
|
||||
* 'Table-1': [
|
||||
* {
|
||||
* DeleteRequest: {
|
||||
* Key: { HashKey: 'someKey' }
|
||||
* }
|
||||
* },
|
||||
* {
|
||||
* PutRequest: {
|
||||
* Item: {
|
||||
* HashKey: 'anotherKey',
|
||||
* NumAttribute: 1,
|
||||
* BoolAttribute: true,
|
||||
* ListAttribute: [1, 'two', false],
|
||||
* MapAttribute: { foo: 'bar' }
|
||||
* }
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
* };
|
||||
*
|
||||
* var documentClient = new AWS.DynamoDB.DocumentClient();
|
||||
*
|
||||
* documentClient.batchWrite(params, function(err, data) {
|
||||
* if (err) console.log(err);
|
||||
* else console.log(data);
|
||||
* });
|
||||
*
|
||||
*/
|
||||
batchWrite: function(params, callback) {
|
||||
var operation = this.serviceClientOperationsMap['batchWrite'];
|
||||
return this.makeServiceRequest(operation, params, callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* Deletes a single item in a table by primary key by delegating to
|
||||
* `AWS.DynamoDB.deleteItem()`
|
||||
*
|
||||
* Supply the same parameters as {AWS.DynamoDB.deleteItem} with
|
||||
* `AttributeValue`s substituted by native JavaScript types.
|
||||
*
|
||||
* @see AWS.DynamoDB.deleteItem
|
||||
* @example Delete an item from a table
|
||||
* var params = {
|
||||
* TableName : 'Table',
|
||||
* Key: {
|
||||
* HashKey: 'hashkey',
|
||||
* NumberRangeKey: 1
|
||||
* }
|
||||
* };
|
||||
*
|
||||
* var documentClient = new AWS.DynamoDB.DocumentClient();
|
||||
*
|
||||
* documentClient.delete(params, function(err, data) {
|
||||
* if (err) console.log(err);
|
||||
* else console.log(data);
|
||||
* });
|
||||
*
|
||||
*/
|
||||
delete: function(params, callback) {
|
||||
var operation = this.serviceClientOperationsMap['delete'];
|
||||
return this.makeServiceRequest(operation, params, callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a set of attributes for the item with the given primary key
|
||||
* by delegating to `AWS.DynamoDB.getItem()`.
|
||||
*
|
||||
* Supply the same parameters as {AWS.DynamoDB.getItem} with
|
||||
* `AttributeValue`s substituted by native JavaScript types.
|
||||
*
|
||||
* @see AWS.DynamoDB.getItem
|
||||
* @example Get an item from a table
|
||||
* var params = {
|
||||
* TableName : 'Table',
|
||||
* Key: {
|
||||
* HashKey: 'hashkey'
|
||||
* }
|
||||
* };
|
||||
*
|
||||
* var documentClient = new AWS.DynamoDB.DocumentClient();
|
||||
*
|
||||
* documentClient.get(params, function(err, data) {
|
||||
* if (err) console.log(err);
|
||||
* else console.log(data);
|
||||
* });
|
||||
*
|
||||
*/
|
||||
get: function(params, callback) {
|
||||
var operation = this.serviceClientOperationsMap['get'];
|
||||
return this.makeServiceRequest(operation, params, callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates a new item, or replaces an old item with a new item by
|
||||
* delegating to `AWS.DynamoDB.putItem()`.
|
||||
*
|
||||
* Supply the same parameters as {AWS.DynamoDB.putItem} with
|
||||
* `AttributeValue`s substituted by native JavaScript types.
|
||||
*
|
||||
* @see AWS.DynamoDB.putItem
|
||||
* @example Create a new item in a table
|
||||
* var params = {
|
||||
* TableName : 'Table',
|
||||
* Item: {
|
||||
* HashKey: 'haskey',
|
||||
* NumAttribute: 1,
|
||||
* BoolAttribute: true,
|
||||
* ListAttribute: [1, 'two', false],
|
||||
* MapAttribute: { foo: 'bar'},
|
||||
* NullAttribute: null
|
||||
* }
|
||||
* };
|
||||
*
|
||||
* var documentClient = new AWS.DynamoDB.DocumentClient();
|
||||
*
|
||||
* documentClient.put(params, function(err, data) {
|
||||
* if (err) console.log(err);
|
||||
* else console.log(data);
|
||||
* });
|
||||
*
|
||||
*/
|
||||
put: function(params, callback) {
|
||||
var operation = this.serviceClientOperationsMap['put'];
|
||||
return this.makeServiceRequest(operation, params, callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* Edits an existing item's attributes, or adds a new item to the table if
|
||||
* it does not already exist by delegating to `AWS.DynamoDB.updateItem()`.
|
||||
*
|
||||
* Supply the same parameters as {AWS.DynamoDB.updateItem} with
|
||||
* `AttributeValue`s substituted by native JavaScript types.
|
||||
*
|
||||
* @see AWS.DynamoDB.updateItem
|
||||
* @example Update an item with expressions
|
||||
* var params = {
|
||||
* TableName: 'Table',
|
||||
* Key: { HashKey : 'hashkey' },
|
||||
* UpdateExpression: 'set #a = :x + :y',
|
||||
* ConditionExpression: '#a < :MAX',
|
||||
* ExpressionAttributeNames: {'#a' : 'Sum'},
|
||||
* ExpressionAttributeValues: {
|
||||
* ':x' : 20,
|
||||
* ':y' : 45,
|
||||
* ':MAX' : 100,
|
||||
* }
|
||||
* };
|
||||
*
|
||||
* var documentClient = new AWS.DynamoDB.DocumentClient();
|
||||
*
|
||||
* documentClient.update(params, function(err, data) {
|
||||
* if (err) console.log(err);
|
||||
* else console.log(data);
|
||||
* });
|
||||
*
|
||||
*/
|
||||
update: function(params, callback) {
|
||||
var operation = this.serviceClientOperationsMap['update'];
|
||||
return this.makeServiceRequest(operation, params, callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns one or more items and item attributes by accessing every item
|
||||
* in a table or a secondary index.
|
||||
*
|
||||
* Supply the same parameters as {AWS.DynamoDB.scan} with
|
||||
* `AttributeValue`s substituted by native JavaScript types.
|
||||
*
|
||||
* @see AWS.DynamoDB.scan
|
||||
* @example Scan the table with a filter expression
|
||||
* var params = {
|
||||
* TableName : 'Table',
|
||||
* FilterExpression : 'Year = :this_year',
|
||||
* ExpressionAttributeValues : {':this_year' : 2015}
|
||||
* };
|
||||
*
|
||||
* var documentClient = new AWS.DynamoDB.DocumentClient();
|
||||
*
|
||||
* documentClient.scan(params, function(err, data) {
|
||||
* if (err) console.log(err);
|
||||
* else console.log(data);
|
||||
* });
|
||||
*
|
||||
*/
|
||||
scan: function(params, callback) {
|
||||
var operation = this.serviceClientOperationsMap['scan'];
|
||||
return this.makeServiceRequest(operation, params, callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* Directly access items from a table by primary key or a secondary index.
|
||||
*
|
||||
* Supply the same parameters as {AWS.DynamoDB.query} with
|
||||
* `AttributeValue`s substituted by native JavaScript types.
|
||||
*
|
||||
* @see AWS.DynamoDB.query
|
||||
* @example Query an index
|
||||
* var params = {
|
||||
* TableName: 'Table',
|
||||
* IndexName: 'Index',
|
||||
* KeyConditionExpression: 'HashKey = :hkey and RangeKey > :rkey',
|
||||
* ExpressionAttributeValues: {
|
||||
* ':hkey': 'key',
|
||||
* ':rkey': 2015
|
||||
* }
|
||||
* };
|
||||
*
|
||||
* var documentClient = new AWS.DynamoDB.DocumentClient();
|
||||
*
|
||||
* documentClient.query(params, function(err, data) {
|
||||
* if (err) console.log(err);
|
||||
* else console.log(data);
|
||||
* });
|
||||
*
|
||||
*/
|
||||
query: function(params, callback) {
|
||||
var operation = this.serviceClientOperationsMap['query'];
|
||||
return this.makeServiceRequest(operation, params, callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* Synchronous write operation that groups up to 100 action requests.
|
||||
*
|
||||
* Supply the same parameters as {AWS.DynamoDB.transactWriteItems} with
|
||||
* `AttributeValue`s substituted by native JavaScript types.
|
||||
*
|
||||
* @see AWS.DynamoDB.transactWriteItems
|
||||
* @example Get items from multiple tables
|
||||
* var params = {
|
||||
* TransactItems: [{
|
||||
* Put: {
|
||||
* TableName : 'Table0',
|
||||
* Item: {
|
||||
* HashKey: 'haskey',
|
||||
* NumAttribute: 1,
|
||||
* BoolAttribute: true,
|
||||
* ListAttribute: [1, 'two', false],
|
||||
* MapAttribute: { foo: 'bar'},
|
||||
* NullAttribute: null
|
||||
* }
|
||||
* }
|
||||
* }, {
|
||||
* Update: {
|
||||
* TableName: 'Table1',
|
||||
* Key: { HashKey : 'hashkey' },
|
||||
* UpdateExpression: 'set #a = :x + :y',
|
||||
* ConditionExpression: '#a < :MAX',
|
||||
* ExpressionAttributeNames: {'#a' : 'Sum'},
|
||||
* ExpressionAttributeValues: {
|
||||
* ':x' : 20,
|
||||
* ':y' : 45,
|
||||
* ':MAX' : 100,
|
||||
* }
|
||||
* }
|
||||
* }]
|
||||
* };
|
||||
*
|
||||
* documentClient.transactWrite(params, function(err, data) {
|
||||
* if (err) console.log(err);
|
||||
* else console.log(data);
|
||||
* });
|
||||
*/
|
||||
transactWrite: function(params, callback) {
|
||||
var operation = this.serviceClientOperationsMap['transactWrite'];
|
||||
return this.makeServiceRequest(operation, params, callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* Atomically retrieves multiple items from one or more tables (but not from indexes)
|
||||
* in a single account and region.
|
||||
*
|
||||
* Supply the same parameters as {AWS.DynamoDB.transactGetItems} with
|
||||
* `AttributeValue`s substituted by native JavaScript types.
|
||||
*
|
||||
* @see AWS.DynamoDB.transactGetItems
|
||||
* @example Get items from multiple tables
|
||||
* var params = {
|
||||
* TransactItems: [{
|
||||
* Get: {
|
||||
* TableName : 'Table0',
|
||||
* Key: {
|
||||
* HashKey: 'hashkey0'
|
||||
* }
|
||||
* }
|
||||
* }, {
|
||||
* Get: {
|
||||
* TableName : 'Table1',
|
||||
* Key: {
|
||||
* HashKey: 'hashkey1'
|
||||
* }
|
||||
* }
|
||||
* }]
|
||||
* };
|
||||
*
|
||||
* documentClient.transactGet(params, function(err, data) {
|
||||
* if (err) console.log(err);
|
||||
* else console.log(data);
|
||||
* });
|
||||
*/
|
||||
transactGet: function(params, callback) {
|
||||
var operation = this.serviceClientOperationsMap['transactGet'];
|
||||
return this.makeServiceRequest(operation, params, callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates a set of elements inferring the type of set from
|
||||
* the type of the first element. Amazon DynamoDB currently supports
|
||||
* the number sets, string sets, and binary sets. For more information
|
||||
* about DynamoDB data types see the documentation on the
|
||||
* [Amazon DynamoDB Data Model](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DataModel.html#DataModel.DataTypes).
|
||||
*
|
||||
* @param list [Array] Collection to represent your DynamoDB Set
|
||||
* @param options [map]
|
||||
* * **validate** [Boolean] set to true if you want to validate the type
|
||||
* of each element in the set. Defaults to `false`.
|
||||
* @example Creating a number set
|
||||
* var documentClient = new AWS.DynamoDB.DocumentClient();
|
||||
*
|
||||
* var params = {
|
||||
* Item: {
|
||||
* hashkey: 'hashkey'
|
||||
* numbers: documentClient.createSet([1, 2, 3]);
|
||||
* }
|
||||
* };
|
||||
*
|
||||
* documentClient.put(params, function(err, data) {
|
||||
* if (err) console.log(err);
|
||||
* else console.log(data);
|
||||
* });
|
||||
*
|
||||
*/
|
||||
createSet: function(list, options) {
|
||||
options = options || {};
|
||||
return new DynamoDBSet(list, options);
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
getTranslator: function() {
|
||||
return new Translator(this.options);
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
setupRequest: function setupRequest(request) {
|
||||
var self = this;
|
||||
var translator = self.getTranslator();
|
||||
var operation = request.operation;
|
||||
var inputShape = request.service.api.operations[operation].input;
|
||||
request._events.validate.unshift(function(req) {
|
||||
req.rawParams = AWS.util.copy(req.params);
|
||||
req.params = translator.translateInput(req.rawParams, inputShape);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
setupResponse: function setupResponse(request) {
|
||||
var self = this;
|
||||
var translator = self.getTranslator();
|
||||
var outputShape = self.service.api.operations[request.operation].output;
|
||||
request.on('extractData', function(response) {
|
||||
response.data = translator.translateOutput(response.data, outputShape);
|
||||
});
|
||||
|
||||
var response = request.response;
|
||||
response.nextPage = function(cb) {
|
||||
var resp = this;
|
||||
var req = resp.request;
|
||||
var config;
|
||||
var service = req.service;
|
||||
var operation = req.operation;
|
||||
try {
|
||||
config = service.paginationConfig(operation, true);
|
||||
} catch (e) { resp.error = e; }
|
||||
|
||||
if (!resp.hasNextPage()) {
|
||||
if (cb) cb(resp.error, null);
|
||||
else if (resp.error) throw resp.error;
|
||||
return null;
|
||||
}
|
||||
|
||||
var params = AWS.util.copy(req.rawParams);
|
||||
if (!resp.nextPageTokens) {
|
||||
return cb ? cb(null, null) : null;
|
||||
} else {
|
||||
var inputTokens = config.inputToken;
|
||||
if (typeof inputTokens === 'string') inputTokens = [inputTokens];
|
||||
for (var i = 0; i < inputTokens.length; i++) {
|
||||
params[inputTokens[i]] = resp.nextPageTokens[i];
|
||||
}
|
||||
return self[operation](params, cb);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = AWS.DynamoDB.DocumentClient;
|
||||
9
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/dynamodb/numberValue.d.ts
generated
vendored
Normal file
9
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/dynamodb/numberValue.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
export class NumberValue {
|
||||
constructor(value: string|number);
|
||||
|
||||
toJSON(): number;
|
||||
|
||||
toNumber(): number;
|
||||
|
||||
toString(): string;
|
||||
}
|
||||
43
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/dynamodb/numberValue.js
generated
vendored
Normal file
43
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/dynamodb/numberValue.js
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
var util = require('../core').util;
|
||||
|
||||
/**
|
||||
* An object recognizable as a numeric value that stores the underlying number
|
||||
* as a string.
|
||||
*
|
||||
* Intended to be a deserialization target for the DynamoDB Document Client when
|
||||
* the `wrapNumbers` flag is set. This allows for numeric values that lose
|
||||
* precision when converted to JavaScript's `number` type.
|
||||
*/
|
||||
var DynamoDBNumberValue = util.inherit({
|
||||
constructor: function NumberValue(value) {
|
||||
this.wrapperName = 'NumberValue';
|
||||
this.value = value.toString();
|
||||
},
|
||||
|
||||
/**
|
||||
* Render the underlying value as a number when converting to JSON.
|
||||
*/
|
||||
toJSON: function () {
|
||||
return this.toNumber();
|
||||
},
|
||||
|
||||
/**
|
||||
* Convert the underlying value to a JavaScript number.
|
||||
*/
|
||||
toNumber: function () {
|
||||
return Number(this.value);
|
||||
},
|
||||
|
||||
/**
|
||||
* Return a string representing the unaltered value provided to the
|
||||
* constructor.
|
||||
*/
|
||||
toString: function () {
|
||||
return this.value;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = DynamoDBNumberValue;
|
||||
71
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/dynamodb/set.js
generated
vendored
Normal file
71
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/dynamodb/set.js
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
var util = require('../core').util;
|
||||
var typeOf = require('./types').typeOf;
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
var memberTypeToSetType = {
|
||||
'String': 'String',
|
||||
'Number': 'Number',
|
||||
'NumberValue': 'Number',
|
||||
'Binary': 'Binary'
|
||||
};
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
var DynamoDBSet = util.inherit({
|
||||
|
||||
constructor: function Set(list, options) {
|
||||
options = options || {};
|
||||
this.wrapperName = 'Set';
|
||||
this.initialize(list, options.validate);
|
||||
},
|
||||
|
||||
initialize: function(list, validate) {
|
||||
var self = this;
|
||||
self.values = [].concat(list);
|
||||
self.detectType();
|
||||
if (validate) {
|
||||
self.validate();
|
||||
}
|
||||
},
|
||||
|
||||
detectType: function() {
|
||||
this.type = memberTypeToSetType[typeOf(this.values[0])];
|
||||
if (!this.type) {
|
||||
throw util.error(new Error(), {
|
||||
code: 'InvalidSetType',
|
||||
message: 'Sets can contain string, number, or binary values'
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
validate: function() {
|
||||
var self = this;
|
||||
var length = self.values.length;
|
||||
var values = self.values;
|
||||
for (var i = 0; i < length; i++) {
|
||||
if (memberTypeToSetType[typeOf(values[i])] !== self.type) {
|
||||
throw util.error(new Error(), {
|
||||
code: 'InvalidType',
|
||||
message: self.type + ' Set contains ' + typeOf(values[i]) + ' value'
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Render the underlying values only when converting to JSON.
|
||||
*/
|
||||
toJSON: function() {
|
||||
var self = this;
|
||||
return self.values;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = DynamoDBSet;
|
||||
87
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/dynamodb/translator.js
generated
vendored
Normal file
87
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/dynamodb/translator.js
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
var util = require('../core').util;
|
||||
var convert = require('./converter');
|
||||
|
||||
var Translator = function(options) {
|
||||
options = options || {};
|
||||
this.attrValue = options.attrValue;
|
||||
this.convertEmptyValues = Boolean(options.convertEmptyValues);
|
||||
this.wrapNumbers = Boolean(options.wrapNumbers);
|
||||
};
|
||||
|
||||
Translator.prototype.translateInput = function(value, shape) {
|
||||
this.mode = 'input';
|
||||
return this.translate(value, shape);
|
||||
};
|
||||
|
||||
Translator.prototype.translateOutput = function(value, shape) {
|
||||
this.mode = 'output';
|
||||
return this.translate(value, shape);
|
||||
};
|
||||
|
||||
Translator.prototype.translate = function(value, shape) {
|
||||
var self = this;
|
||||
if (!shape || value === undefined) return undefined;
|
||||
|
||||
if (shape.shape === self.attrValue) {
|
||||
return convert[self.mode](value, {
|
||||
convertEmptyValues: self.convertEmptyValues,
|
||||
wrapNumbers: self.wrapNumbers,
|
||||
});
|
||||
}
|
||||
switch (shape.type) {
|
||||
case 'structure': return self.translateStructure(value, shape);
|
||||
case 'map': return self.translateMap(value, shape);
|
||||
case 'list': return self.translateList(value, shape);
|
||||
default: return self.translateScalar(value, shape);
|
||||
}
|
||||
};
|
||||
|
||||
Translator.prototype.translateStructure = function(structure, shape) {
|
||||
var self = this;
|
||||
if (structure == null) return undefined;
|
||||
|
||||
var struct = {};
|
||||
util.each(structure, function(name, value) {
|
||||
var memberShape = shape.members[name];
|
||||
if (memberShape) {
|
||||
var result = self.translate(value, memberShape);
|
||||
if (result !== undefined) struct[name] = result;
|
||||
}
|
||||
});
|
||||
return struct;
|
||||
};
|
||||
|
||||
Translator.prototype.translateList = function(list, shape) {
|
||||
var self = this;
|
||||
if (list == null) return undefined;
|
||||
|
||||
var out = [];
|
||||
util.arrayEach(list, function(value) {
|
||||
var result = self.translate(value, shape.member);
|
||||
if (result === undefined) out.push(null);
|
||||
else out.push(result);
|
||||
});
|
||||
return out;
|
||||
};
|
||||
|
||||
Translator.prototype.translateMap = function(map, shape) {
|
||||
var self = this;
|
||||
if (map == null) return undefined;
|
||||
|
||||
var out = {};
|
||||
util.each(map, function(key, value) {
|
||||
var result = self.translate(value, shape.value);
|
||||
if (result === undefined) out[key] = null;
|
||||
else out[key] = result;
|
||||
});
|
||||
return out;
|
||||
};
|
||||
|
||||
Translator.prototype.translateScalar = function(value, shape) {
|
||||
return shape.toType(value);
|
||||
};
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = Translator;
|
||||
49
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/dynamodb/types.js
generated
vendored
Normal file
49
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/dynamodb/types.js
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
var util = require('../core').util;
|
||||
|
||||
function typeOf(data) {
|
||||
if (data === null && typeof data === 'object') {
|
||||
return 'null';
|
||||
} else if (data !== undefined && isBinary(data)) {
|
||||
return 'Binary';
|
||||
} else if (data !== undefined && data.constructor) {
|
||||
return data.wrapperName || util.typeName(data.constructor);
|
||||
} else if (data !== undefined && typeof data === 'object') {
|
||||
// this object is the result of Object.create(null), hence the absence of a
|
||||
// defined constructor
|
||||
return 'Object';
|
||||
} else {
|
||||
return 'undefined';
|
||||
}
|
||||
}
|
||||
|
||||
function isBinary(data) {
|
||||
var types = [
|
||||
'Buffer', 'File', 'Blob', 'ArrayBuffer', 'DataView',
|
||||
'Int8Array', 'Uint8Array', 'Uint8ClampedArray',
|
||||
'Int16Array', 'Uint16Array', 'Int32Array', 'Uint32Array',
|
||||
'Float32Array', 'Float64Array'
|
||||
];
|
||||
if (util.isNode()) {
|
||||
var Stream = util.stream.Stream;
|
||||
if (util.Buffer.isBuffer(data) || data instanceof Stream) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
if (data !== undefined && data.constructor) {
|
||||
if (util.isType(data, types[i])) return true;
|
||||
if (util.typeName(data.constructor) === types[i]) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = {
|
||||
typeOf: typeOf,
|
||||
isBinary: isBinary
|
||||
};
|
||||
6
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/empty.js
generated
vendored
Normal file
6
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/empty.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
// use this when replacing modules with an empty replacement (needed for react-native)
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = {};
|
||||
27
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/endpoint.d.ts
generated
vendored
Normal file
27
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/endpoint.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
export class Endpoint {
|
||||
/**
|
||||
* Constructs a new endpoint given an endpoint URL.
|
||||
*/
|
||||
constructor(url: string);
|
||||
|
||||
/**
|
||||
* The host portion of the endpoint including the port, e.g., example.com:80.
|
||||
*/
|
||||
host: string;
|
||||
/**
|
||||
* The host portion of the endpoint, e.g., example.com.
|
||||
*/
|
||||
hostname: string;
|
||||
/**
|
||||
* The full URL of the endpoint.
|
||||
*/
|
||||
href: string;
|
||||
/**
|
||||
* The port of the endpoint.
|
||||
*/
|
||||
port: number;
|
||||
/**
|
||||
* The protocol (http or https) of the endpoint URL.
|
||||
*/
|
||||
protocol: string;
|
||||
}
|
||||
53
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/error.d.ts
generated
vendored
Normal file
53
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/error.d.ts
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* A structure containing information about a service or networking error.
|
||||
*/
|
||||
export type AWSError = Error & {
|
||||
/**
|
||||
* A unique short code representing the error that was emitted.
|
||||
*/
|
||||
code: string;
|
||||
/**
|
||||
* A longer human readable error message.
|
||||
*/
|
||||
message: string;
|
||||
/**
|
||||
* Whether the error message is retryable.
|
||||
*/
|
||||
retryable?: boolean;
|
||||
/**
|
||||
* In the case of a request that reached the service, this value contains the response status code.
|
||||
*/
|
||||
statusCode?: number;
|
||||
/**
|
||||
* The date time object when the error occurred.
|
||||
*/
|
||||
time: Date;
|
||||
/**
|
||||
* Set when a networking error occurs to easily identify the endpoint of the request.
|
||||
*/
|
||||
hostname?: string;
|
||||
/**
|
||||
* Set when a networking error occurs to easily identify the region of the request.
|
||||
*/
|
||||
region?: string;
|
||||
/**
|
||||
* Amount of time (in seconds) that the request waited before being resent.
|
||||
*/
|
||||
retryDelay?: number;
|
||||
/**
|
||||
* The unique request ID associated with the response.
|
||||
*/
|
||||
requestId?: string;
|
||||
/**
|
||||
* Second request ID associated with the response from S3.
|
||||
*/
|
||||
extendedRequestId?: string;
|
||||
/**
|
||||
* CloudFront request ID associated with the response.
|
||||
*/
|
||||
cfId?: string;
|
||||
/**
|
||||
* The original error which caused this Error
|
||||
*/
|
||||
originalError?: Error
|
||||
}
|
||||
21
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event-stream/buffered-create-event-stream.js
generated
vendored
Normal file
21
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event-stream/buffered-create-event-stream.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
var eventMessageChunker = require('../event-stream/event-message-chunker').eventMessageChunker;
|
||||
var parseEvent = require('./parse-event').parseEvent;
|
||||
|
||||
function createEventStream(body, parser, model) {
|
||||
var eventMessages = eventMessageChunker(body);
|
||||
|
||||
var events = [];
|
||||
|
||||
for (var i = 0; i < eventMessages.length; i++) {
|
||||
events.push(parseEvent(parser, eventMessages[i], model));
|
||||
}
|
||||
|
||||
return events;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = {
|
||||
createEventStream: createEventStream
|
||||
};
|
||||
174
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event-stream/build-message.js
generated
vendored
Normal file
174
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event-stream/build-message.js
generated
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
var util = require('../core').util;
|
||||
var crypto = util.crypto;
|
||||
var Int64 = require('./int64').Int64;
|
||||
var toBuffer = util.buffer.toBuffer;
|
||||
var allocBuffer = util.buffer.alloc;
|
||||
var Buffer = util.Buffer;
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
function buildMessage(message) {
|
||||
var formattedHeaders = buildHeaders(message.headers);
|
||||
|
||||
var headerLengthBytes = allocBuffer(4);
|
||||
headerLengthBytes.writeUInt32BE(formattedHeaders.length, 0);
|
||||
|
||||
var totalLengthBytes = allocBuffer(4);
|
||||
totalLengthBytes.writeUInt32BE(
|
||||
totalLengthBytes.length + // size of this buffer
|
||||
headerLengthBytes.length + // size of header length buffer
|
||||
4 + // prelude crc32
|
||||
formattedHeaders.length + // total size of headers
|
||||
message.body.length + // total size of payload
|
||||
4, // size of crc32 of the total message
|
||||
0
|
||||
);
|
||||
|
||||
var prelude = Buffer.concat([
|
||||
totalLengthBytes,
|
||||
headerLengthBytes
|
||||
], totalLengthBytes.length + headerLengthBytes.length);
|
||||
var preludeCrc32 = crc32(prelude);
|
||||
|
||||
var totalSansCrc32 = Buffer.concat([
|
||||
prelude, preludeCrc32, formattedHeaders, message.body
|
||||
], prelude.length + preludeCrc32.length + formattedHeaders.length + message.body.length);
|
||||
var totalCrc32 = crc32(totalSansCrc32);
|
||||
|
||||
return Buffer.concat([totalSansCrc32, totalCrc32]);
|
||||
}
|
||||
|
||||
function buildHeaders(headers) {
|
||||
/** @type {Buffer[]} */
|
||||
var chunks = [];
|
||||
var totalSize = 0;
|
||||
|
||||
var headerNames = Object.keys(headers);
|
||||
for (var i = 0; i < headerNames.length; i++) {
|
||||
var headerName = headerNames[i];
|
||||
var bytes = toBuffer(headerName);
|
||||
var headerValue = buildHeaderValue(headers[headerName]);
|
||||
var nameLength = allocBuffer(1);
|
||||
nameLength[0] = headerName.length;
|
||||
chunks.push(
|
||||
nameLength,
|
||||
bytes,
|
||||
headerValue
|
||||
);
|
||||
totalSize += nameLength.length + bytes.length + headerValue.length;
|
||||
}
|
||||
|
||||
var out = allocBuffer(totalSize);
|
||||
var position = 0;
|
||||
for (var j = 0; j < chunks.length; j++) {
|
||||
var chunk = chunks[j];
|
||||
for (var k = 0; k < chunk.length; k++) {
|
||||
out[position] = chunk[k];
|
||||
position++;
|
||||
}
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object} header
|
||||
* @param {'boolean'|'byte'|'short'|'integer'|'long'|'binary'|'string'|'timestamp'|'uuid'} header.type
|
||||
* @param {*} header.value
|
||||
* @returns {Buffer}
|
||||
*/
|
||||
function buildHeaderValue(header) {
|
||||
switch (header.type) {
|
||||
case 'binary':
|
||||
var binBytes = allocBuffer(3);
|
||||
binBytes.writeUInt8(HEADER_VALUE_TYPE.byteArray, 0);
|
||||
binBytes.writeUInt16BE(header.value.length, 1);
|
||||
return Buffer.concat([
|
||||
binBytes, header.value
|
||||
], binBytes.length + header.value.length);
|
||||
case 'boolean':
|
||||
var boolByte = allocBuffer(1);
|
||||
boolByte[0] = header.value ? HEADER_VALUE_TYPE.boolTrue : HEADER_VALUE_TYPE.boolFalse;
|
||||
return boolByte;
|
||||
case 'byte':
|
||||
var singleByte = allocBuffer(2);
|
||||
singleByte[0] = HEADER_VALUE_TYPE.byte;
|
||||
singleByte[1] = header.value;
|
||||
return singleByte;
|
||||
case 'integer':
|
||||
var intBytes = allocBuffer(5);
|
||||
intBytes.writeUInt8(HEADER_VALUE_TYPE.integer, 0);
|
||||
intBytes.writeInt32BE(header.value, 1);
|
||||
return intBytes;
|
||||
case 'long':
|
||||
var longBytes = allocBuffer(1);
|
||||
longBytes[0] = HEADER_VALUE_TYPE.long;
|
||||
return Buffer.concat([
|
||||
longBytes, header.value.bytes
|
||||
], 9);
|
||||
case 'short':
|
||||
var shortBytes = allocBuffer(3);
|
||||
shortBytes.writeUInt8(HEADER_VALUE_TYPE.short, 0);
|
||||
shortBytes.writeInt16BE(header.value, 1);
|
||||
return shortBytes;
|
||||
case 'string':
|
||||
var utf8Bytes = toBuffer(header.value);
|
||||
var strBytes = allocBuffer(3);
|
||||
strBytes.writeUInt8(HEADER_VALUE_TYPE.string, 0);
|
||||
strBytes.writeUInt16BE(utf8Bytes.length, 1);
|
||||
return Buffer.concat([
|
||||
strBytes, utf8Bytes
|
||||
], strBytes.length + utf8Bytes.length);
|
||||
case 'timestamp':
|
||||
var tsBytes = allocBuffer(1);
|
||||
tsBytes[0] = HEADER_VALUE_TYPE.timestamp;
|
||||
return Buffer.concat([
|
||||
tsBytes, Int64.fromNumber(header.value.valueOf()).bytes
|
||||
], 9);
|
||||
case 'uuid':
|
||||
if (!UUID_PATTERN.test(header.value)) {
|
||||
throw new Error('Invalid UUID received: ' + header.value);
|
||||
}
|
||||
|
||||
var uuidBytes = allocBuffer(1);
|
||||
uuidBytes[0] = HEADER_VALUE_TYPE.uuid;
|
||||
return Buffer.concat([
|
||||
uuidBytes, toBuffer(header.value.replace(/\-/g, ''), 'hex')
|
||||
], 17);
|
||||
}
|
||||
}
|
||||
|
||||
function crc32(buffer) {
|
||||
var crc32 = crypto.crc32(buffer);
|
||||
|
||||
var crc32Buffer = allocBuffer(4);
|
||||
crc32Buffer.writeUInt32BE(crc32, 0);
|
||||
|
||||
return crc32Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
var HEADER_VALUE_TYPE = {
|
||||
boolTrue: 0,
|
||||
boolFalse: 1,
|
||||
byte: 2,
|
||||
short: 3,
|
||||
integer: 4,
|
||||
long: 5,
|
||||
byteArray: 6,
|
||||
string: 7,
|
||||
timestamp: 8,
|
||||
uuid: 9,
|
||||
};
|
||||
|
||||
var UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = {
|
||||
buildMessage: buildMessage
|
||||
};
|
||||
121
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event-stream/event-message-chunker-stream.js
generated
vendored
Normal file
121
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event-stream/event-message-chunker-stream.js
generated
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
var util = require('../core').util;
|
||||
var Transform = require('stream').Transform;
|
||||
var allocBuffer = util.buffer.alloc;
|
||||
|
||||
/** @type {Transform} */
|
||||
function EventMessageChunkerStream(options) {
|
||||
Transform.call(this, options);
|
||||
|
||||
this.currentMessageTotalLength = 0;
|
||||
this.currentMessagePendingLength = 0;
|
||||
/** @type {Buffer} */
|
||||
this.currentMessage = null;
|
||||
|
||||
/** @type {Buffer} */
|
||||
this.messageLengthBuffer = null;
|
||||
}
|
||||
|
||||
EventMessageChunkerStream.prototype = Object.create(Transform.prototype);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Buffer} chunk
|
||||
* @param {string} encoding
|
||||
* @param {*} callback
|
||||
*/
|
||||
EventMessageChunkerStream.prototype._transform = function(chunk, encoding, callback) {
|
||||
var chunkLength = chunk.length;
|
||||
var currentOffset = 0;
|
||||
|
||||
while (currentOffset < chunkLength) {
|
||||
// create new message if necessary
|
||||
if (!this.currentMessage) {
|
||||
// working on a new message, determine total length
|
||||
var bytesRemaining = chunkLength - currentOffset;
|
||||
// prevent edge case where total length spans 2 chunks
|
||||
if (!this.messageLengthBuffer) {
|
||||
this.messageLengthBuffer = allocBuffer(4);
|
||||
}
|
||||
var numBytesForTotal = Math.min(
|
||||
4 - this.currentMessagePendingLength, // remaining bytes to fill the messageLengthBuffer
|
||||
bytesRemaining // bytes left in chunk
|
||||
);
|
||||
|
||||
chunk.copy(
|
||||
this.messageLengthBuffer,
|
||||
this.currentMessagePendingLength,
|
||||
currentOffset,
|
||||
currentOffset + numBytesForTotal
|
||||
);
|
||||
|
||||
this.currentMessagePendingLength += numBytesForTotal;
|
||||
currentOffset += numBytesForTotal;
|
||||
|
||||
if (this.currentMessagePendingLength < 4) {
|
||||
// not enough information to create the current message
|
||||
break;
|
||||
}
|
||||
this.allocateMessage(this.messageLengthBuffer.readUInt32BE(0));
|
||||
this.messageLengthBuffer = null;
|
||||
}
|
||||
|
||||
// write data into current message
|
||||
var numBytesToWrite = Math.min(
|
||||
this.currentMessageTotalLength - this.currentMessagePendingLength, // number of bytes left to complete message
|
||||
chunkLength - currentOffset // number of bytes left in the original chunk
|
||||
);
|
||||
chunk.copy(
|
||||
this.currentMessage, // target buffer
|
||||
this.currentMessagePendingLength, // target offset
|
||||
currentOffset, // chunk offset
|
||||
currentOffset + numBytesToWrite // chunk end to write
|
||||
);
|
||||
this.currentMessagePendingLength += numBytesToWrite;
|
||||
currentOffset += numBytesToWrite;
|
||||
|
||||
// check if a message is ready to be pushed
|
||||
if (this.currentMessageTotalLength && this.currentMessageTotalLength === this.currentMessagePendingLength) {
|
||||
// push out the message
|
||||
this.push(this.currentMessage);
|
||||
// cleanup
|
||||
this.currentMessage = null;
|
||||
this.currentMessageTotalLength = 0;
|
||||
this.currentMessagePendingLength = 0;
|
||||
}
|
||||
}
|
||||
|
||||
callback();
|
||||
};
|
||||
|
||||
EventMessageChunkerStream.prototype._flush = function(callback) {
|
||||
if (this.currentMessageTotalLength) {
|
||||
if (this.currentMessageTotalLength === this.currentMessagePendingLength) {
|
||||
callback(null, this.currentMessage);
|
||||
} else {
|
||||
callback(new Error('Truncated event message received.'));
|
||||
}
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {number} size Size of the message to be allocated.
|
||||
* @api private
|
||||
*/
|
||||
EventMessageChunkerStream.prototype.allocateMessage = function(size) {
|
||||
if (typeof size !== 'number') {
|
||||
throw new Error('Attempted to allocate an event message where size was not a number: ' + size);
|
||||
}
|
||||
this.currentMessageTotalLength = size;
|
||||
this.currentMessagePendingLength = 4;
|
||||
this.currentMessage = allocBuffer(size);
|
||||
this.currentMessage.writeUInt32BE(size, 0);
|
||||
};
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = {
|
||||
EventMessageChunkerStream: EventMessageChunkerStream
|
||||
};
|
||||
30
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event-stream/event-message-chunker.js
generated
vendored
Normal file
30
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event-stream/event-message-chunker.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Takes in a buffer of event messages and splits them into individual messages.
|
||||
* @param {Buffer} buffer
|
||||
* @api private
|
||||
*/
|
||||
function eventMessageChunker(buffer) {
|
||||
/** @type Buffer[] */
|
||||
var messages = [];
|
||||
var offset = 0;
|
||||
|
||||
while (offset < buffer.length) {
|
||||
var totalLength = buffer.readInt32BE(offset);
|
||||
|
||||
// create new buffer for individual message (shares memory with original)
|
||||
var message = buffer.slice(offset, totalLength + offset);
|
||||
// increment offset to it starts at the next message
|
||||
offset += totalLength;
|
||||
|
||||
messages.push(message);
|
||||
}
|
||||
|
||||
return messages;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = {
|
||||
eventMessageChunker: eventMessageChunker
|
||||
};
|
||||
39
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event-stream/event-message-unmarshaller-stream.js
generated
vendored
Normal file
39
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event-stream/event-message-unmarshaller-stream.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
var Transform = require('stream').Transform;
|
||||
var parseEvent = require('./parse-event').parseEvent;
|
||||
|
||||
/** @type {Transform} */
|
||||
function EventUnmarshallerStream(options) {
|
||||
options = options || {};
|
||||
// set output to object mode
|
||||
options.readableObjectMode = true;
|
||||
Transform.call(this, options);
|
||||
this._readableState.objectMode = true;
|
||||
|
||||
this.parser = options.parser;
|
||||
this.eventStreamModel = options.eventStreamModel;
|
||||
}
|
||||
|
||||
EventUnmarshallerStream.prototype = Object.create(Transform.prototype);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Buffer} chunk
|
||||
* @param {string} encoding
|
||||
* @param {*} callback
|
||||
*/
|
||||
EventUnmarshallerStream.prototype._transform = function(chunk, encoding, callback) {
|
||||
try {
|
||||
var event = parseEvent(this.parser, chunk, this.eventStreamModel);
|
||||
this.push(event);
|
||||
return callback();
|
||||
} catch (err) {
|
||||
callback(err);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = {
|
||||
EventUnmarshallerStream: EventUnmarshallerStream
|
||||
};
|
||||
6
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event-stream/event-stream.d.ts
generated
vendored
Normal file
6
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event-stream/event-stream.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
export interface StreamingEventStream<Events> extends NodeJS.ReadableStream {
|
||||
on(event: "data", listener: (event: Events) => void): this;
|
||||
on(event: string, listener: Function): this;
|
||||
}
|
||||
|
||||
export type EventStream<Events> = StreamingEventStream<Events> | Events[];
|
||||
93
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event-stream/int64.js
generated
vendored
Normal file
93
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event-stream/int64.js
generated
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
var util = require('../core').util;
|
||||
var toBuffer = util.buffer.toBuffer;
|
||||
|
||||
/**
|
||||
* A lossless representation of a signed, 64-bit integer. Instances of this
|
||||
* class may be used in arithmetic expressions as if they were numeric
|
||||
* primitives, but the binary representation will be preserved unchanged as the
|
||||
* `bytes` property of the object. The bytes should be encoded as big-endian,
|
||||
* two's complement integers.
|
||||
* @param {Buffer} bytes
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
function Int64(bytes) {
|
||||
if (bytes.length !== 8) {
|
||||
throw new Error('Int64 buffers must be exactly 8 bytes');
|
||||
}
|
||||
if (!util.Buffer.isBuffer(bytes)) bytes = toBuffer(bytes);
|
||||
|
||||
this.bytes = bytes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} number
|
||||
* @returns {Int64}
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
Int64.fromNumber = function(number) {
|
||||
if (number > 9223372036854775807 || number < -9223372036854775808) {
|
||||
throw new Error(
|
||||
number + ' is too large (or, if negative, too small) to represent as an Int64'
|
||||
);
|
||||
}
|
||||
|
||||
var bytes = new Uint8Array(8);
|
||||
for (
|
||||
var i = 7, remaining = Math.abs(Math.round(number));
|
||||
i > -1 && remaining > 0;
|
||||
i--, remaining /= 256
|
||||
) {
|
||||
bytes[i] = remaining;
|
||||
}
|
||||
|
||||
if (number < 0) {
|
||||
negate(bytes);
|
||||
}
|
||||
|
||||
return new Int64(bytes);
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {number}
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
Int64.prototype.valueOf = function() {
|
||||
var bytes = this.bytes.slice(0);
|
||||
var negative = bytes[0] & 128;
|
||||
if (negative) {
|
||||
negate(bytes);
|
||||
}
|
||||
|
||||
return parseInt(bytes.toString('hex'), 16) * (negative ? -1 : 1);
|
||||
};
|
||||
|
||||
Int64.prototype.toString = function() {
|
||||
return String(this.valueOf());
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Buffer} bytes
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
function negate(bytes) {
|
||||
for (var i = 0; i < 8; i++) {
|
||||
bytes[i] ^= 0xFF;
|
||||
}
|
||||
for (var i = 7; i > -1; i--) {
|
||||
bytes[i]++;
|
||||
if (bytes[i] !== 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = {
|
||||
Int64: Int64
|
||||
};
|
||||
73
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event-stream/parse-event.js
generated
vendored
Normal file
73
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event-stream/parse-event.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
var parseMessage = require('./parse-message').parseMessage;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {*} parser
|
||||
* @param {Buffer} message
|
||||
* @param {*} shape
|
||||
* @api private
|
||||
*/
|
||||
function parseEvent(parser, message, shape) {
|
||||
var parsedMessage = parseMessage(message);
|
||||
|
||||
// check if message is an event or error
|
||||
var messageType = parsedMessage.headers[':message-type'];
|
||||
if (messageType) {
|
||||
if (messageType.value === 'error') {
|
||||
throw parseError(parsedMessage);
|
||||
} else if (messageType.value !== 'event') {
|
||||
// not sure how to parse non-events/non-errors, ignore for now
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// determine event type
|
||||
var eventType = parsedMessage.headers[':event-type'];
|
||||
// check that the event type is modeled
|
||||
var eventModel = shape.members[eventType.value];
|
||||
if (!eventModel) {
|
||||
return;
|
||||
}
|
||||
|
||||
var result = {};
|
||||
// check if an event payload exists
|
||||
var eventPayloadMemberName = eventModel.eventPayloadMemberName;
|
||||
if (eventPayloadMemberName) {
|
||||
var payloadShape = eventModel.members[eventPayloadMemberName];
|
||||
// if the shape is binary, return the byte array
|
||||
if (payloadShape.type === 'binary') {
|
||||
result[eventPayloadMemberName] = parsedMessage.body;
|
||||
} else {
|
||||
result[eventPayloadMemberName] = parser.parse(parsedMessage.body.toString(), payloadShape);
|
||||
}
|
||||
}
|
||||
|
||||
// read event headers
|
||||
var eventHeaderNames = eventModel.eventHeaderMemberNames;
|
||||
for (var i = 0; i < eventHeaderNames.length; i++) {
|
||||
var name = eventHeaderNames[i];
|
||||
if (parsedMessage.headers[name]) {
|
||||
// parse the header!
|
||||
result[name] = eventModel.members[name].toType(parsedMessage.headers[name].value);
|
||||
}
|
||||
}
|
||||
|
||||
var output = {};
|
||||
output[eventType.value] = result;
|
||||
return output;
|
||||
}
|
||||
|
||||
function parseError(message) {
|
||||
var errorCode = message.headers[':error-code'];
|
||||
var errorMessage = message.headers[':error-message'];
|
||||
var error = new Error(errorMessage.value || errorMessage);
|
||||
error.code = error.name = errorCode.value || errorCode;
|
||||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = {
|
||||
parseEvent: parseEvent
|
||||
};
|
||||
128
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event-stream/parse-message.js
generated
vendored
Normal file
128
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event-stream/parse-message.js
generated
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
var Int64 = require('./int64').Int64;
|
||||
|
||||
var splitMessage = require('./split-message').splitMessage;
|
||||
|
||||
var BOOLEAN_TAG = 'boolean';
|
||||
var BYTE_TAG = 'byte';
|
||||
var SHORT_TAG = 'short';
|
||||
var INT_TAG = 'integer';
|
||||
var LONG_TAG = 'long';
|
||||
var BINARY_TAG = 'binary';
|
||||
var STRING_TAG = 'string';
|
||||
var TIMESTAMP_TAG = 'timestamp';
|
||||
var UUID_TAG = 'uuid';
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*
|
||||
* @param {Buffer} headers
|
||||
*/
|
||||
function parseHeaders(headers) {
|
||||
var out = {};
|
||||
var position = 0;
|
||||
while (position < headers.length) {
|
||||
var nameLength = headers.readUInt8(position++);
|
||||
var name = headers.slice(position, position + nameLength).toString();
|
||||
position += nameLength;
|
||||
switch (headers.readUInt8(position++)) {
|
||||
case 0 /* boolTrue */:
|
||||
out[name] = {
|
||||
type: BOOLEAN_TAG,
|
||||
value: true
|
||||
};
|
||||
break;
|
||||
case 1 /* boolFalse */:
|
||||
out[name] = {
|
||||
type: BOOLEAN_TAG,
|
||||
value: false
|
||||
};
|
||||
break;
|
||||
case 2 /* byte */:
|
||||
out[name] = {
|
||||
type: BYTE_TAG,
|
||||
value: headers.readInt8(position++)
|
||||
};
|
||||
break;
|
||||
case 3 /* short */:
|
||||
out[name] = {
|
||||
type: SHORT_TAG,
|
||||
value: headers.readInt16BE(position)
|
||||
};
|
||||
position += 2;
|
||||
break;
|
||||
case 4 /* integer */:
|
||||
out[name] = {
|
||||
type: INT_TAG,
|
||||
value: headers.readInt32BE(position)
|
||||
};
|
||||
position += 4;
|
||||
break;
|
||||
case 5 /* long */:
|
||||
out[name] = {
|
||||
type: LONG_TAG,
|
||||
value: new Int64(headers.slice(position, position + 8))
|
||||
};
|
||||
position += 8;
|
||||
break;
|
||||
case 6 /* byteArray */:
|
||||
var binaryLength = headers.readUInt16BE(position);
|
||||
position += 2;
|
||||
out[name] = {
|
||||
type: BINARY_TAG,
|
||||
value: headers.slice(position, position + binaryLength)
|
||||
};
|
||||
position += binaryLength;
|
||||
break;
|
||||
case 7 /* string */:
|
||||
var stringLength = headers.readUInt16BE(position);
|
||||
position += 2;
|
||||
out[name] = {
|
||||
type: STRING_TAG,
|
||||
value: headers.slice(
|
||||
position,
|
||||
position + stringLength
|
||||
).toString()
|
||||
};
|
||||
position += stringLength;
|
||||
break;
|
||||
case 8 /* timestamp */:
|
||||
out[name] = {
|
||||
type: TIMESTAMP_TAG,
|
||||
value: new Date(
|
||||
new Int64(headers.slice(position, position + 8))
|
||||
.valueOf()
|
||||
)
|
||||
};
|
||||
position += 8;
|
||||
break;
|
||||
case 9 /* uuid */:
|
||||
var uuidChars = headers.slice(position, position + 16)
|
||||
.toString('hex');
|
||||
position += 16;
|
||||
out[name] = {
|
||||
type: UUID_TAG,
|
||||
value: uuidChars.substr(0, 8) + '-' +
|
||||
uuidChars.substr(8, 4) + '-' +
|
||||
uuidChars.substr(12, 4) + '-' +
|
||||
uuidChars.substr(16, 4) + '-' +
|
||||
uuidChars.substr(20)
|
||||
};
|
||||
break;
|
||||
default:
|
||||
throw new Error('Unrecognized header type tag');
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
function parseMessage(message) {
|
||||
var parsed = splitMessage(message);
|
||||
return { headers: parseHeaders(parsed.headers), body: parsed.body };
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = {
|
||||
parseMessage: parseMessage
|
||||
};
|
||||
70
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event-stream/split-message.js
generated
vendored
Normal file
70
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event-stream/split-message.js
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
var util = require('../core').util;
|
||||
var toBuffer = util.buffer.toBuffer;
|
||||
|
||||
// All prelude components are unsigned, 32-bit integers
|
||||
var PRELUDE_MEMBER_LENGTH = 4;
|
||||
// The prelude consists of two components
|
||||
var PRELUDE_LENGTH = PRELUDE_MEMBER_LENGTH * 2;
|
||||
// Checksums are always CRC32 hashes.
|
||||
var CHECKSUM_LENGTH = 4;
|
||||
// Messages must include a full prelude, a prelude checksum, and a message checksum
|
||||
var MINIMUM_MESSAGE_LENGTH = PRELUDE_LENGTH + CHECKSUM_LENGTH * 2;
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*
|
||||
* @param {Buffer} message
|
||||
*/
|
||||
function splitMessage(message) {
|
||||
if (!util.Buffer.isBuffer(message)) message = toBuffer(message);
|
||||
|
||||
if (message.length < MINIMUM_MESSAGE_LENGTH) {
|
||||
throw new Error('Provided message too short to accommodate event stream message overhead');
|
||||
}
|
||||
|
||||
if (message.length !== message.readUInt32BE(0)) {
|
||||
throw new Error('Reported message length does not match received message length');
|
||||
}
|
||||
|
||||
var expectedPreludeChecksum = message.readUInt32BE(PRELUDE_LENGTH);
|
||||
|
||||
if (
|
||||
expectedPreludeChecksum !== util.crypto.crc32(
|
||||
message.slice(0, PRELUDE_LENGTH)
|
||||
)
|
||||
) {
|
||||
throw new Error(
|
||||
'The prelude checksum specified in the message (' +
|
||||
expectedPreludeChecksum +
|
||||
') does not match the calculated CRC32 checksum.'
|
||||
);
|
||||
}
|
||||
|
||||
var expectedMessageChecksum = message.readUInt32BE(message.length - CHECKSUM_LENGTH);
|
||||
|
||||
if (
|
||||
expectedMessageChecksum !== util.crypto.crc32(
|
||||
message.slice(0, message.length - CHECKSUM_LENGTH)
|
||||
)
|
||||
) {
|
||||
throw new Error(
|
||||
'The message checksum did not match the expected value of ' +
|
||||
expectedMessageChecksum
|
||||
);
|
||||
}
|
||||
|
||||
var headersStart = PRELUDE_LENGTH + CHECKSUM_LENGTH;
|
||||
var headersEnd = headersStart + message.readUInt32BE(PRELUDE_MEMBER_LENGTH);
|
||||
|
||||
return {
|
||||
headers: message.slice(headersStart, headersEnd),
|
||||
body: message.slice(headersEnd, message.length - CHECKSUM_LENGTH),
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = {
|
||||
splitMessage: splitMessage
|
||||
};
|
||||
39
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event-stream/streaming-create-event-stream.js
generated
vendored
Normal file
39
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event-stream/streaming-create-event-stream.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* What is necessary to create an event stream in node?
|
||||
* - http response stream
|
||||
* - parser
|
||||
* - event stream model
|
||||
*/
|
||||
|
||||
var EventMessageChunkerStream = require('../event-stream/event-message-chunker-stream').EventMessageChunkerStream;
|
||||
var EventUnmarshallerStream = require('../event-stream/event-message-unmarshaller-stream').EventUnmarshallerStream;
|
||||
|
||||
function createEventStream(stream, parser, model) {
|
||||
var eventStream = new EventUnmarshallerStream({
|
||||
parser: parser,
|
||||
eventStreamModel: model
|
||||
});
|
||||
|
||||
var eventMessageChunker = new EventMessageChunkerStream();
|
||||
|
||||
stream.pipe(
|
||||
eventMessageChunker
|
||||
).pipe(eventStream);
|
||||
|
||||
stream.on('error', function(err) {
|
||||
eventMessageChunker.emit('error', err);
|
||||
});
|
||||
|
||||
eventMessageChunker.on('error', function(err) {
|
||||
eventStream.emit('error', err);
|
||||
});
|
||||
|
||||
return eventStream;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = {
|
||||
createEventStream: createEventStream
|
||||
};
|
||||
35
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event_listeners.d.ts
generated
vendored
Normal file
35
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event_listeners.d.ts
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* The namespace used to register global event listeners for request building and sending.
|
||||
*/
|
||||
export namespace EventListeners {
|
||||
/**
|
||||
* The namespace used to register global event listeners for request building and sending.
|
||||
*/
|
||||
export namespace Core {
|
||||
/**
|
||||
* Removes an event listener from all requests.
|
||||
*/
|
||||
export function removeListener(eventName: string, eventListener: Function): void;
|
||||
/**
|
||||
* A request listener that reads data from the HTTP connection in order to build the response data. Handles the 'httpData' Request event.
|
||||
* Remove this handler if you are overriding the 'httpData' event and do not want extra data processing and buffering overhead.
|
||||
*/
|
||||
export function HTTP_DATA(): void;
|
||||
/**
|
||||
* A request listener that initiates the HTTP connection for a request being sent. Handles the 'send' Request event.
|
||||
*/
|
||||
export function SEND(): void;
|
||||
/**
|
||||
* A request listener that validates whether the request is being sent with credentials. Handles the 'validate' Request event
|
||||
*/
|
||||
export function VALIDATE_CREDENTIALS(): void;
|
||||
/**
|
||||
* A request listener that validates input parameters in a request. Handles the 'validate' Request event.
|
||||
*/
|
||||
export function VALIDATE_PARAMETERS(): void;
|
||||
/**
|
||||
* A request listener that validates whether the region is set for a request. Handles the 'validate' Request event.
|
||||
*/
|
||||
export function VALIDATE_REGION():void;
|
||||
}
|
||||
}
|
||||
732
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event_listeners.js
generated
vendored
Normal file
732
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/event_listeners.js
generated
vendored
Normal file
@@ -0,0 +1,732 @@
|
||||
var AWS = require('./core');
|
||||
var SequentialExecutor = require('./sequential_executor');
|
||||
var DISCOVER_ENDPOINT = require('./discover_endpoint').discoverEndpoint;
|
||||
/**
|
||||
* The namespace used to register global event listeners for request building
|
||||
* and sending.
|
||||
*/
|
||||
AWS.EventListeners = {
|
||||
/**
|
||||
* @!attribute VALIDATE_CREDENTIALS
|
||||
* A request listener that validates whether the request is being
|
||||
* sent with credentials.
|
||||
* Handles the {AWS.Request~validate 'validate' Request event}
|
||||
* @example Sending a request without validating credentials
|
||||
* var listener = AWS.EventListeners.Core.VALIDATE_CREDENTIALS;
|
||||
* request.removeListener('validate', listener);
|
||||
* @readonly
|
||||
* @return [Function]
|
||||
* @!attribute VALIDATE_REGION
|
||||
* A request listener that validates whether the region is set
|
||||
* for a request.
|
||||
* Handles the {AWS.Request~validate 'validate' Request event}
|
||||
* @example Sending a request without validating region configuration
|
||||
* var listener = AWS.EventListeners.Core.VALIDATE_REGION;
|
||||
* request.removeListener('validate', listener);
|
||||
* @readonly
|
||||
* @return [Function]
|
||||
* @!attribute VALIDATE_PARAMETERS
|
||||
* A request listener that validates input parameters in a request.
|
||||
* Handles the {AWS.Request~validate 'validate' Request event}
|
||||
* @example Sending a request without validating parameters
|
||||
* var listener = AWS.EventListeners.Core.VALIDATE_PARAMETERS;
|
||||
* request.removeListener('validate', listener);
|
||||
* @example Disable parameter validation globally
|
||||
* AWS.EventListeners.Core.removeListener('validate',
|
||||
* AWS.EventListeners.Core.VALIDATE_REGION);
|
||||
* @readonly
|
||||
* @return [Function]
|
||||
* @!attribute SEND
|
||||
* A request listener that initiates the HTTP connection for a
|
||||
* request being sent. Handles the {AWS.Request~send 'send' Request event}
|
||||
* @example Replacing the HTTP handler
|
||||
* var listener = AWS.EventListeners.Core.SEND;
|
||||
* request.removeListener('send', listener);
|
||||
* request.on('send', function(response) {
|
||||
* customHandler.send(response);
|
||||
* });
|
||||
* @return [Function]
|
||||
* @readonly
|
||||
* @!attribute HTTP_DATA
|
||||
* A request listener that reads data from the HTTP connection in order
|
||||
* to build the response data.
|
||||
* Handles the {AWS.Request~httpData 'httpData' Request event}.
|
||||
* Remove this handler if you are overriding the 'httpData' event and
|
||||
* do not want extra data processing and buffering overhead.
|
||||
* @example Disabling default data processing
|
||||
* var listener = AWS.EventListeners.Core.HTTP_DATA;
|
||||
* request.removeListener('httpData', listener);
|
||||
* @return [Function]
|
||||
* @readonly
|
||||
*/
|
||||
Core: {} /* doc hack */
|
||||
};
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
function getOperationAuthtype(req) {
|
||||
if (!req.service.api.operations) {
|
||||
return '';
|
||||
}
|
||||
var operation = req.service.api.operations[req.operation];
|
||||
return operation ? operation.authtype : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
function getIdentityType(req) {
|
||||
var service = req.service;
|
||||
|
||||
if (service.config.signatureVersion) {
|
||||
return service.config.signatureVersion;
|
||||
}
|
||||
|
||||
if (service.api.signatureVersion) {
|
||||
return service.api.signatureVersion;
|
||||
}
|
||||
|
||||
return getOperationAuthtype(req);
|
||||
}
|
||||
|
||||
AWS.EventListeners = {
|
||||
Core: new SequentialExecutor().addNamedListeners(function(add, addAsync) {
|
||||
addAsync(
|
||||
'VALIDATE_CREDENTIALS', 'validate',
|
||||
function VALIDATE_CREDENTIALS(req, done) {
|
||||
if (!req.service.api.signatureVersion && !req.service.config.signatureVersion) return done(); // none
|
||||
|
||||
var identityType = getIdentityType(req);
|
||||
if (identityType === 'bearer') {
|
||||
req.service.config.getToken(function(err) {
|
||||
if (err) {
|
||||
req.response.error = AWS.util.error(err, {code: 'TokenError'});
|
||||
}
|
||||
done();
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
req.service.config.getCredentials(function(err) {
|
||||
if (err) {
|
||||
req.response.error = AWS.util.error(err,
|
||||
{
|
||||
code: 'CredentialsError',
|
||||
message: 'Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1'
|
||||
}
|
||||
);
|
||||
}
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
add('VALIDATE_REGION', 'validate', function VALIDATE_REGION(req) {
|
||||
if (!req.service.isGlobalEndpoint) {
|
||||
var dnsHostRegex = new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/);
|
||||
if (!req.service.config.region) {
|
||||
req.response.error = AWS.util.error(new Error(),
|
||||
{code: 'ConfigError', message: 'Missing region in config'});
|
||||
} else if (!dnsHostRegex.test(req.service.config.region)) {
|
||||
req.response.error = AWS.util.error(new Error(),
|
||||
{code: 'ConfigError', message: 'Invalid region in config'});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
add('BUILD_IDEMPOTENCY_TOKENS', 'validate', function BUILD_IDEMPOTENCY_TOKENS(req) {
|
||||
if (!req.service.api.operations) {
|
||||
return;
|
||||
}
|
||||
var operation = req.service.api.operations[req.operation];
|
||||
if (!operation) {
|
||||
return;
|
||||
}
|
||||
var idempotentMembers = operation.idempotentMembers;
|
||||
if (!idempotentMembers.length) {
|
||||
return;
|
||||
}
|
||||
// creates a copy of params so user's param object isn't mutated
|
||||
var params = AWS.util.copy(req.params);
|
||||
for (var i = 0, iLen = idempotentMembers.length; i < iLen; i++) {
|
||||
if (!params[idempotentMembers[i]]) {
|
||||
// add the member
|
||||
params[idempotentMembers[i]] = AWS.util.uuid.v4();
|
||||
}
|
||||
}
|
||||
req.params = params;
|
||||
});
|
||||
|
||||
add('VALIDATE_PARAMETERS', 'validate', function VALIDATE_PARAMETERS(req) {
|
||||
if (!req.service.api.operations) {
|
||||
return;
|
||||
}
|
||||
var rules = req.service.api.operations[req.operation].input;
|
||||
var validation = req.service.config.paramValidation;
|
||||
new AWS.ParamValidator(validation).validate(rules, req.params);
|
||||
});
|
||||
|
||||
add('COMPUTE_CHECKSUM', 'afterBuild', function COMPUTE_CHECKSUM(req) {
|
||||
if (!req.service.api.operations) {
|
||||
return;
|
||||
}
|
||||
var operation = req.service.api.operations[req.operation];
|
||||
if (!operation) {
|
||||
return;
|
||||
}
|
||||
var body = req.httpRequest.body;
|
||||
var isNonStreamingPayload = body && (AWS.util.Buffer.isBuffer(body) || typeof body === 'string');
|
||||
var headers = req.httpRequest.headers;
|
||||
if (
|
||||
operation.httpChecksumRequired &&
|
||||
req.service.config.computeChecksums &&
|
||||
isNonStreamingPayload &&
|
||||
!headers['Content-MD5']
|
||||
) {
|
||||
var md5 = AWS.util.crypto.md5(body, 'base64');
|
||||
headers['Content-MD5'] = md5;
|
||||
}
|
||||
});
|
||||
|
||||
addAsync('COMPUTE_SHA256', 'afterBuild', function COMPUTE_SHA256(req, done) {
|
||||
req.haltHandlersOnError();
|
||||
if (!req.service.api.operations) {
|
||||
return;
|
||||
}
|
||||
var operation = req.service.api.operations[req.operation];
|
||||
var authtype = operation ? operation.authtype : '';
|
||||
if (!req.service.api.signatureVersion && !authtype && !req.service.config.signatureVersion) return done(); // none
|
||||
if (req.service.getSignerClass(req) === AWS.Signers.V4) {
|
||||
var body = req.httpRequest.body || '';
|
||||
if (authtype.indexOf('unsigned-body') >= 0) {
|
||||
req.httpRequest.headers['X-Amz-Content-Sha256'] = 'UNSIGNED-PAYLOAD';
|
||||
return done();
|
||||
}
|
||||
AWS.util.computeSha256(body, function(err, sha) {
|
||||
if (err) {
|
||||
done(err);
|
||||
}
|
||||
else {
|
||||
req.httpRequest.headers['X-Amz-Content-Sha256'] = sha;
|
||||
done();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
});
|
||||
|
||||
add('SET_CONTENT_LENGTH', 'afterBuild', function SET_CONTENT_LENGTH(req) {
|
||||
var authtype = getOperationAuthtype(req);
|
||||
var payloadMember = AWS.util.getRequestPayloadShape(req);
|
||||
if (req.httpRequest.headers['Content-Length'] === undefined) {
|
||||
try {
|
||||
var length = AWS.util.string.byteLength(req.httpRequest.body);
|
||||
req.httpRequest.headers['Content-Length'] = length;
|
||||
} catch (err) {
|
||||
if (payloadMember && payloadMember.isStreaming) {
|
||||
if (payloadMember.requiresLength) {
|
||||
//streaming payload requires length(s3, glacier)
|
||||
throw err;
|
||||
} else if (authtype.indexOf('unsigned-body') >= 0) {
|
||||
//unbounded streaming payload(lex, mediastore)
|
||||
req.httpRequest.headers['Transfer-Encoding'] = 'chunked';
|
||||
return;
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
add('SET_HTTP_HOST', 'afterBuild', function SET_HTTP_HOST(req) {
|
||||
req.httpRequest.headers['Host'] = req.httpRequest.endpoint.host;
|
||||
});
|
||||
|
||||
add('SET_TRACE_ID', 'afterBuild', function SET_TRACE_ID(req) {
|
||||
var traceIdHeaderName = 'X-Amzn-Trace-Id';
|
||||
if (AWS.util.isNode() && !Object.hasOwnProperty.call(req.httpRequest.headers, traceIdHeaderName)) {
|
||||
var ENV_LAMBDA_FUNCTION_NAME = 'AWS_LAMBDA_FUNCTION_NAME';
|
||||
var ENV_TRACE_ID = '_X_AMZN_TRACE_ID';
|
||||
var functionName = process.env[ENV_LAMBDA_FUNCTION_NAME];
|
||||
var traceId = process.env[ENV_TRACE_ID];
|
||||
if (
|
||||
typeof functionName === 'string' &&
|
||||
functionName.length > 0 &&
|
||||
typeof traceId === 'string' &&
|
||||
traceId.length > 0
|
||||
) {
|
||||
req.httpRequest.headers[traceIdHeaderName] = traceId;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
add('RESTART', 'restart', function RESTART() {
|
||||
var err = this.response.error;
|
||||
if (!err || !err.retryable) return;
|
||||
|
||||
this.httpRequest = new AWS.HttpRequest(
|
||||
this.service.endpoint,
|
||||
this.service.region
|
||||
);
|
||||
|
||||
if (this.response.retryCount < this.service.config.maxRetries) {
|
||||
this.response.retryCount++;
|
||||
} else {
|
||||
this.response.error = null;
|
||||
}
|
||||
});
|
||||
|
||||
var addToHead = true;
|
||||
addAsync('DISCOVER_ENDPOINT', 'sign', DISCOVER_ENDPOINT, addToHead);
|
||||
|
||||
addAsync('SIGN', 'sign', function SIGN(req, done) {
|
||||
var service = req.service;
|
||||
var identityType = getIdentityType(req);
|
||||
if (!identityType || identityType.length === 0) return done(); // none
|
||||
|
||||
if (identityType === 'bearer') {
|
||||
service.config.getToken(function (err, token) {
|
||||
if (err) {
|
||||
req.response.error = err;
|
||||
return done();
|
||||
}
|
||||
|
||||
try {
|
||||
var SignerClass = service.getSignerClass(req);
|
||||
var signer = new SignerClass(req.httpRequest);
|
||||
signer.addAuthorization(token);
|
||||
} catch (e) {
|
||||
req.response.error = e;
|
||||
}
|
||||
done();
|
||||
});
|
||||
} else {
|
||||
service.config.getCredentials(function (err, credentials) {
|
||||
if (err) {
|
||||
req.response.error = err;
|
||||
return done();
|
||||
}
|
||||
|
||||
try {
|
||||
var date = service.getSkewCorrectedDate();
|
||||
var SignerClass = service.getSignerClass(req);
|
||||
var operations = req.service.api.operations || {};
|
||||
var operation = operations[req.operation];
|
||||
var signer = new SignerClass(req.httpRequest,
|
||||
service.getSigningName(req),
|
||||
{
|
||||
signatureCache: service.config.signatureCache,
|
||||
operation: operation,
|
||||
signatureVersion: service.api.signatureVersion
|
||||
});
|
||||
signer.setServiceClientId(service._clientId);
|
||||
|
||||
// clear old authorization headers
|
||||
delete req.httpRequest.headers['Authorization'];
|
||||
delete req.httpRequest.headers['Date'];
|
||||
delete req.httpRequest.headers['X-Amz-Date'];
|
||||
|
||||
// add new authorization
|
||||
signer.addAuthorization(credentials, date);
|
||||
req.signedAt = date;
|
||||
} catch (e) {
|
||||
req.response.error = e;
|
||||
}
|
||||
done();
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
add('VALIDATE_RESPONSE', 'validateResponse', function VALIDATE_RESPONSE(resp) {
|
||||
if (this.service.successfulResponse(resp, this)) {
|
||||
resp.data = {};
|
||||
resp.error = null;
|
||||
} else {
|
||||
resp.data = null;
|
||||
resp.error = AWS.util.error(new Error(),
|
||||
{code: 'UnknownError', message: 'An unknown error occurred.'});
|
||||
}
|
||||
});
|
||||
|
||||
add('ERROR', 'error', function ERROR(err, resp) {
|
||||
var awsQueryCompatible = resp.request.service.api.awsQueryCompatible;
|
||||
if (awsQueryCompatible) {
|
||||
var headers = resp.httpResponse.headers;
|
||||
var queryErrorCode = headers ? headers['x-amzn-query-error'] : undefined;
|
||||
if (queryErrorCode && queryErrorCode.includes(';')) {
|
||||
resp.error.code = queryErrorCode.split(';')[0];
|
||||
}
|
||||
}
|
||||
}, true);
|
||||
|
||||
addAsync('SEND', 'send', function SEND(resp, done) {
|
||||
resp.httpResponse._abortCallback = done;
|
||||
resp.error = null;
|
||||
resp.data = null;
|
||||
|
||||
function callback(httpResp) {
|
||||
resp.httpResponse.stream = httpResp;
|
||||
var stream = resp.request.httpRequest.stream;
|
||||
var service = resp.request.service;
|
||||
var api = service.api;
|
||||
var operationName = resp.request.operation;
|
||||
var operation = api.operations[operationName] || {};
|
||||
|
||||
httpResp.on('headers', function onHeaders(statusCode, headers, statusMessage) {
|
||||
resp.request.emit(
|
||||
'httpHeaders',
|
||||
[statusCode, headers, resp, statusMessage]
|
||||
);
|
||||
|
||||
if (!resp.httpResponse.streaming) {
|
||||
if (AWS.HttpClient.streamsApiVersion === 2) { // streams2 API check
|
||||
// if we detect event streams, we're going to have to
|
||||
// return the stream immediately
|
||||
if (operation.hasEventOutput && service.successfulResponse(resp)) {
|
||||
// skip reading the IncomingStream
|
||||
resp.request.emit('httpDone');
|
||||
done();
|
||||
return;
|
||||
}
|
||||
|
||||
httpResp.on('readable', function onReadable() {
|
||||
var data = httpResp.read();
|
||||
if (data !== null) {
|
||||
resp.request.emit('httpData', [data, resp]);
|
||||
}
|
||||
});
|
||||
} else { // legacy streams API
|
||||
httpResp.on('data', function onData(data) {
|
||||
resp.request.emit('httpData', [data, resp]);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
httpResp.on('end', function onEnd() {
|
||||
if (!stream || !stream.didCallback) {
|
||||
if (AWS.HttpClient.streamsApiVersion === 2 && (operation.hasEventOutput && service.successfulResponse(resp))) {
|
||||
// don't concatenate response chunks when streaming event stream data when response is successful
|
||||
return;
|
||||
}
|
||||
resp.request.emit('httpDone');
|
||||
done();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function progress(httpResp) {
|
||||
httpResp.on('sendProgress', function onSendProgress(value) {
|
||||
resp.request.emit('httpUploadProgress', [value, resp]);
|
||||
});
|
||||
|
||||
httpResp.on('receiveProgress', function onReceiveProgress(value) {
|
||||
resp.request.emit('httpDownloadProgress', [value, resp]);
|
||||
});
|
||||
}
|
||||
|
||||
function error(err) {
|
||||
if (err.code !== 'RequestAbortedError') {
|
||||
var errCode = err.code === 'TimeoutError' ? err.code : 'NetworkingError';
|
||||
err = AWS.util.error(err, {
|
||||
code: errCode,
|
||||
region: resp.request.httpRequest.region,
|
||||
hostname: resp.request.httpRequest.endpoint.hostname,
|
||||
retryable: true
|
||||
});
|
||||
}
|
||||
resp.error = err;
|
||||
resp.request.emit('httpError', [resp.error, resp], function() {
|
||||
done();
|
||||
});
|
||||
}
|
||||
|
||||
function executeSend() {
|
||||
var http = AWS.HttpClient.getInstance();
|
||||
var httpOptions = resp.request.service.config.httpOptions || {};
|
||||
try {
|
||||
var stream = http.handleRequest(resp.request.httpRequest, httpOptions,
|
||||
callback, error);
|
||||
progress(stream);
|
||||
} catch (err) {
|
||||
error(err);
|
||||
}
|
||||
}
|
||||
var timeDiff = (resp.request.service.getSkewCorrectedDate() - this.signedAt) / 1000;
|
||||
if (timeDiff >= 60 * 10) { // if we signed 10min ago, re-sign
|
||||
this.emit('sign', [this], function(err) {
|
||||
if (err) done(err);
|
||||
else executeSend();
|
||||
});
|
||||
} else {
|
||||
executeSend();
|
||||
}
|
||||
});
|
||||
|
||||
add('HTTP_HEADERS', 'httpHeaders',
|
||||
function HTTP_HEADERS(statusCode, headers, resp, statusMessage) {
|
||||
resp.httpResponse.statusCode = statusCode;
|
||||
resp.httpResponse.statusMessage = statusMessage;
|
||||
resp.httpResponse.headers = headers;
|
||||
resp.httpResponse.body = AWS.util.buffer.toBuffer('');
|
||||
resp.httpResponse.buffers = [];
|
||||
resp.httpResponse.numBytes = 0;
|
||||
var dateHeader = headers.date || headers.Date;
|
||||
var service = resp.request.service;
|
||||
if (dateHeader) {
|
||||
var serverTime = Date.parse(dateHeader);
|
||||
if (service.config.correctClockSkew
|
||||
&& service.isClockSkewed(serverTime)) {
|
||||
service.applyClockOffset(serverTime);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
add('HTTP_DATA', 'httpData', function HTTP_DATA(chunk, resp) {
|
||||
if (chunk) {
|
||||
if (AWS.util.isNode()) {
|
||||
resp.httpResponse.numBytes += chunk.length;
|
||||
|
||||
var total = resp.httpResponse.headers['content-length'];
|
||||
var progress = { loaded: resp.httpResponse.numBytes, total: total };
|
||||
resp.request.emit('httpDownloadProgress', [progress, resp]);
|
||||
}
|
||||
|
||||
resp.httpResponse.buffers.push(AWS.util.buffer.toBuffer(chunk));
|
||||
}
|
||||
});
|
||||
|
||||
add('HTTP_DONE', 'httpDone', function HTTP_DONE(resp) {
|
||||
// convert buffers array into single buffer
|
||||
if (resp.httpResponse.buffers && resp.httpResponse.buffers.length > 0) {
|
||||
var body = AWS.util.buffer.concat(resp.httpResponse.buffers);
|
||||
resp.httpResponse.body = body;
|
||||
}
|
||||
delete resp.httpResponse.numBytes;
|
||||
delete resp.httpResponse.buffers;
|
||||
});
|
||||
|
||||
add('FINALIZE_ERROR', 'retry', function FINALIZE_ERROR(resp) {
|
||||
if (resp.httpResponse.statusCode) {
|
||||
resp.error.statusCode = resp.httpResponse.statusCode;
|
||||
if (resp.error.retryable === undefined) {
|
||||
resp.error.retryable = this.service.retryableError(resp.error, this);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
add('INVALIDATE_CREDENTIALS', 'retry', function INVALIDATE_CREDENTIALS(resp) {
|
||||
if (!resp.error) return;
|
||||
switch (resp.error.code) {
|
||||
case 'RequestExpired': // EC2 only
|
||||
case 'ExpiredTokenException':
|
||||
case 'ExpiredToken':
|
||||
resp.error.retryable = true;
|
||||
resp.request.service.config.credentials.expired = true;
|
||||
}
|
||||
});
|
||||
|
||||
add('EXPIRED_SIGNATURE', 'retry', function EXPIRED_SIGNATURE(resp) {
|
||||
var err = resp.error;
|
||||
if (!err) return;
|
||||
if (typeof err.code === 'string' && typeof err.message === 'string') {
|
||||
if (err.code.match(/Signature/) && err.message.match(/expired/)) {
|
||||
resp.error.retryable = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
add('CLOCK_SKEWED', 'retry', function CLOCK_SKEWED(resp) {
|
||||
if (!resp.error) return;
|
||||
if (this.service.clockSkewError(resp.error)
|
||||
&& this.service.config.correctClockSkew) {
|
||||
resp.error.retryable = true;
|
||||
}
|
||||
});
|
||||
|
||||
add('REDIRECT', 'retry', function REDIRECT(resp) {
|
||||
if (resp.error && resp.error.statusCode >= 300 &&
|
||||
resp.error.statusCode < 400 && resp.httpResponse.headers['location']) {
|
||||
this.httpRequest.endpoint =
|
||||
new AWS.Endpoint(resp.httpResponse.headers['location']);
|
||||
this.httpRequest.headers['Host'] = this.httpRequest.endpoint.host;
|
||||
resp.error.redirect = true;
|
||||
resp.error.retryable = true;
|
||||
}
|
||||
});
|
||||
|
||||
add('RETRY_CHECK', 'retry', function RETRY_CHECK(resp) {
|
||||
if (resp.error) {
|
||||
if (resp.error.redirect && resp.redirectCount < resp.maxRedirects) {
|
||||
resp.error.retryDelay = 0;
|
||||
} else if (resp.retryCount < resp.maxRetries) {
|
||||
resp.error.retryDelay = this.service.retryDelays(resp.retryCount, resp.error) || 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
addAsync('RESET_RETRY_STATE', 'afterRetry', function RESET_RETRY_STATE(resp, done) {
|
||||
var delay, willRetry = false;
|
||||
|
||||
if (resp.error) {
|
||||
delay = resp.error.retryDelay || 0;
|
||||
if (resp.error.retryable && resp.retryCount < resp.maxRetries) {
|
||||
resp.retryCount++;
|
||||
willRetry = true;
|
||||
} else if (resp.error.redirect && resp.redirectCount < resp.maxRedirects) {
|
||||
resp.redirectCount++;
|
||||
willRetry = true;
|
||||
}
|
||||
}
|
||||
|
||||
// delay < 0 is a signal from customBackoff to skip retries
|
||||
if (willRetry && delay >= 0) {
|
||||
resp.error = null;
|
||||
setTimeout(done, delay);
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
});
|
||||
}),
|
||||
|
||||
CorePost: new SequentialExecutor().addNamedListeners(function(add) {
|
||||
add('EXTRACT_REQUEST_ID', 'extractData', AWS.util.extractRequestId);
|
||||
add('EXTRACT_REQUEST_ID', 'extractError', AWS.util.extractRequestId);
|
||||
|
||||
add('ENOTFOUND_ERROR', 'httpError', function ENOTFOUND_ERROR(err) {
|
||||
function isDNSError(err) {
|
||||
return err.errno === 'ENOTFOUND' ||
|
||||
typeof err.errno === 'number' &&
|
||||
typeof AWS.util.getSystemErrorName === 'function' &&
|
||||
['EAI_NONAME', 'EAI_NODATA'].indexOf(AWS.util.getSystemErrorName(err.errno) >= 0);
|
||||
}
|
||||
if (err.code === 'NetworkingError' && isDNSError(err)) {
|
||||
var message = 'Inaccessible host: `' + err.hostname + '\' at port `' + err.port +
|
||||
'\'. This service may not be available in the `' + err.region +
|
||||
'\' region.';
|
||||
this.response.error = AWS.util.error(new Error(message), {
|
||||
code: 'UnknownEndpoint',
|
||||
region: err.region,
|
||||
hostname: err.hostname,
|
||||
retryable: true,
|
||||
originalError: err
|
||||
});
|
||||
}
|
||||
});
|
||||
}),
|
||||
|
||||
Logger: new SequentialExecutor().addNamedListeners(function(add) {
|
||||
add('LOG_REQUEST', 'complete', function LOG_REQUEST(resp) {
|
||||
var req = resp.request;
|
||||
var logger = req.service.config.logger;
|
||||
if (!logger) return;
|
||||
function filterSensitiveLog(inputShape, shape) {
|
||||
if (!shape) {
|
||||
return shape;
|
||||
}
|
||||
if (inputShape.isSensitive) {
|
||||
return '***SensitiveInformation***';
|
||||
}
|
||||
switch (inputShape.type) {
|
||||
case 'structure':
|
||||
var struct = {};
|
||||
AWS.util.each(shape, function(subShapeName, subShape) {
|
||||
if (Object.prototype.hasOwnProperty.call(inputShape.members, subShapeName)) {
|
||||
struct[subShapeName] = filterSensitiveLog(inputShape.members[subShapeName], subShape);
|
||||
} else {
|
||||
struct[subShapeName] = subShape;
|
||||
}
|
||||
});
|
||||
return struct;
|
||||
case 'list':
|
||||
var list = [];
|
||||
AWS.util.arrayEach(shape, function(subShape, index) {
|
||||
list.push(filterSensitiveLog(inputShape.member, subShape));
|
||||
});
|
||||
return list;
|
||||
case 'map':
|
||||
var map = {};
|
||||
AWS.util.each(shape, function(key, value) {
|
||||
map[key] = filterSensitiveLog(inputShape.value, value);
|
||||
});
|
||||
return map;
|
||||
default:
|
||||
return shape;
|
||||
}
|
||||
}
|
||||
|
||||
function buildMessage() {
|
||||
var time = resp.request.service.getSkewCorrectedDate().getTime();
|
||||
var delta = (time - req.startTime.getTime()) / 1000;
|
||||
var ansi = logger.isTTY ? true : false;
|
||||
var status = resp.httpResponse.statusCode;
|
||||
var censoredParams = req.params;
|
||||
if (
|
||||
req.service.api.operations &&
|
||||
req.service.api.operations[req.operation] &&
|
||||
req.service.api.operations[req.operation].input
|
||||
) {
|
||||
var inputShape = req.service.api.operations[req.operation].input;
|
||||
censoredParams = filterSensitiveLog(inputShape, req.params);
|
||||
}
|
||||
var params = require('util').inspect(censoredParams, true, null);
|
||||
var message = '';
|
||||
if (ansi) message += '\x1B[33m';
|
||||
message += '[AWS ' + req.service.serviceIdentifier + ' ' + status;
|
||||
message += ' ' + delta.toString() + 's ' + resp.retryCount + ' retries]';
|
||||
if (ansi) message += '\x1B[0;1m';
|
||||
message += ' ' + AWS.util.string.lowerFirst(req.operation);
|
||||
message += '(' + params + ')';
|
||||
if (ansi) message += '\x1B[0m';
|
||||
return message;
|
||||
}
|
||||
|
||||
var line = buildMessage();
|
||||
if (typeof logger.log === 'function') {
|
||||
logger.log(line);
|
||||
} else if (typeof logger.write === 'function') {
|
||||
logger.write(line + '\n');
|
||||
}
|
||||
});
|
||||
}),
|
||||
|
||||
Json: new SequentialExecutor().addNamedListeners(function(add) {
|
||||
var svc = require('./protocol/json');
|
||||
add('BUILD', 'build', svc.buildRequest);
|
||||
add('EXTRACT_DATA', 'extractData', svc.extractData);
|
||||
add('EXTRACT_ERROR', 'extractError', svc.extractError);
|
||||
}),
|
||||
|
||||
Rest: new SequentialExecutor().addNamedListeners(function(add) {
|
||||
var svc = require('./protocol/rest');
|
||||
add('BUILD', 'build', svc.buildRequest);
|
||||
add('EXTRACT_DATA', 'extractData', svc.extractData);
|
||||
add('EXTRACT_ERROR', 'extractError', svc.extractError);
|
||||
}),
|
||||
|
||||
RestJson: new SequentialExecutor().addNamedListeners(function(add) {
|
||||
var svc = require('./protocol/rest_json');
|
||||
add('BUILD', 'build', svc.buildRequest);
|
||||
add('EXTRACT_DATA', 'extractData', svc.extractData);
|
||||
add('EXTRACT_ERROR', 'extractError', svc.extractError);
|
||||
add('UNSET_CONTENT_LENGTH', 'afterBuild', svc.unsetContentLength);
|
||||
}),
|
||||
|
||||
RestXml: new SequentialExecutor().addNamedListeners(function(add) {
|
||||
var svc = require('./protocol/rest_xml');
|
||||
add('BUILD', 'build', svc.buildRequest);
|
||||
add('EXTRACT_DATA', 'extractData', svc.extractData);
|
||||
add('EXTRACT_ERROR', 'extractError', svc.extractError);
|
||||
}),
|
||||
|
||||
Query: new SequentialExecutor().addNamedListeners(function(add) {
|
||||
var svc = require('./protocol/query');
|
||||
add('BUILD', 'build', svc.buildRequest);
|
||||
add('EXTRACT_DATA', 'extractData', svc.extractData);
|
||||
add('EXTRACT_ERROR', 'extractError', svc.extractError);
|
||||
})
|
||||
};
|
||||
238
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/http.js
generated
vendored
Normal file
238
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/http.js
generated
vendored
Normal file
@@ -0,0 +1,238 @@
|
||||
var AWS = require('./core');
|
||||
var inherit = AWS.util.inherit;
|
||||
|
||||
/**
|
||||
* The endpoint that a service will talk to, for example,
|
||||
* `'https://ec2.ap-southeast-1.amazonaws.com'`. If
|
||||
* you need to override an endpoint for a service, you can
|
||||
* set the endpoint on a service by passing the endpoint
|
||||
* object with the `endpoint` option key:
|
||||
*
|
||||
* ```javascript
|
||||
* var ep = new AWS.Endpoint('awsproxy.example.com');
|
||||
* var s3 = new AWS.S3({endpoint: ep});
|
||||
* s3.service.endpoint.hostname == 'awsproxy.example.com'
|
||||
* ```
|
||||
*
|
||||
* Note that if you do not specify a protocol, the protocol will
|
||||
* be selected based on your current {AWS.config} configuration.
|
||||
*
|
||||
* @!attribute protocol
|
||||
* @return [String] the protocol (http or https) of the endpoint
|
||||
* URL
|
||||
* @!attribute hostname
|
||||
* @return [String] the host portion of the endpoint, e.g.,
|
||||
* example.com
|
||||
* @!attribute host
|
||||
* @return [String] the host portion of the endpoint including
|
||||
* the port, e.g., example.com:80
|
||||
* @!attribute port
|
||||
* @return [Integer] the port of the endpoint
|
||||
* @!attribute href
|
||||
* @return [String] the full URL of the endpoint
|
||||
*/
|
||||
AWS.Endpoint = inherit({
|
||||
|
||||
/**
|
||||
* @overload Endpoint(endpoint)
|
||||
* Constructs a new endpoint given an endpoint URL. If the
|
||||
* URL omits a protocol (http or https), the default protocol
|
||||
* set in the global {AWS.config} will be used.
|
||||
* @param endpoint [String] the URL to construct an endpoint from
|
||||
*/
|
||||
constructor: function Endpoint(endpoint, config) {
|
||||
AWS.util.hideProperties(this, ['slashes', 'auth', 'hash', 'search', 'query']);
|
||||
|
||||
if (typeof endpoint === 'undefined' || endpoint === null) {
|
||||
throw new Error('Invalid endpoint: ' + endpoint);
|
||||
} else if (typeof endpoint !== 'string') {
|
||||
return AWS.util.copy(endpoint);
|
||||
}
|
||||
|
||||
if (!endpoint.match(/^http/)) {
|
||||
var useSSL = config && config.sslEnabled !== undefined ?
|
||||
config.sslEnabled : AWS.config.sslEnabled;
|
||||
endpoint = (useSSL ? 'https' : 'http') + '://' + endpoint;
|
||||
}
|
||||
|
||||
AWS.util.update(this, AWS.util.urlParse(endpoint));
|
||||
|
||||
// Ensure the port property is set as an integer
|
||||
if (this.port) {
|
||||
this.port = parseInt(this.port, 10);
|
||||
} else {
|
||||
this.port = this.protocol === 'https:' ? 443 : 80;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* The low level HTTP request object, encapsulating all HTTP header
|
||||
* and body data sent by a service request.
|
||||
*
|
||||
* @!attribute method
|
||||
* @return [String] the HTTP method of the request
|
||||
* @!attribute path
|
||||
* @return [String] the path portion of the URI, e.g.,
|
||||
* "/list/?start=5&num=10"
|
||||
* @!attribute headers
|
||||
* @return [map<String,String>]
|
||||
* a map of header keys and their respective values
|
||||
* @!attribute body
|
||||
* @return [String] the request body payload
|
||||
* @!attribute endpoint
|
||||
* @return [AWS.Endpoint] the endpoint for the request
|
||||
* @!attribute region
|
||||
* @api private
|
||||
* @return [String] the region, for signing purposes only.
|
||||
*/
|
||||
AWS.HttpRequest = inherit({
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
constructor: function HttpRequest(endpoint, region) {
|
||||
endpoint = new AWS.Endpoint(endpoint);
|
||||
this.method = 'POST';
|
||||
this.path = endpoint.path || '/';
|
||||
this.headers = {};
|
||||
this.body = '';
|
||||
this.endpoint = endpoint;
|
||||
this.region = region;
|
||||
this._userAgent = '';
|
||||
this.setUserAgent();
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
setUserAgent: function setUserAgent() {
|
||||
this._userAgent = this.headers[this.getUserAgentHeaderName()] = AWS.util.userAgent();
|
||||
},
|
||||
|
||||
getUserAgentHeaderName: function getUserAgentHeaderName() {
|
||||
var prefix = AWS.util.isBrowser() ? 'X-Amz-' : '';
|
||||
return prefix + 'User-Agent';
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
appendToUserAgent: function appendToUserAgent(agentPartial) {
|
||||
if (typeof agentPartial === 'string' && agentPartial) {
|
||||
this._userAgent += ' ' + agentPartial;
|
||||
}
|
||||
this.headers[this.getUserAgentHeaderName()] = this._userAgent;
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
getUserAgent: function getUserAgent() {
|
||||
return this._userAgent;
|
||||
},
|
||||
|
||||
/**
|
||||
* @return [String] the part of the {path} excluding the
|
||||
* query string
|
||||
*/
|
||||
pathname: function pathname() {
|
||||
return this.path.split('?', 1)[0];
|
||||
},
|
||||
|
||||
/**
|
||||
* @return [String] the query string portion of the {path}
|
||||
*/
|
||||
search: function search() {
|
||||
var query = this.path.split('?', 2)[1];
|
||||
if (query) {
|
||||
query = AWS.util.queryStringParse(query);
|
||||
return AWS.util.queryParamsToString(query);
|
||||
}
|
||||
return '';
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
* update httpRequest endpoint with endpoint string
|
||||
*/
|
||||
updateEndpoint: function updateEndpoint(endpointStr) {
|
||||
var newEndpoint = new AWS.Endpoint(endpointStr);
|
||||
this.endpoint = newEndpoint;
|
||||
this.path = newEndpoint.path || '/';
|
||||
if (this.headers['Host']) {
|
||||
this.headers['Host'] = newEndpoint.host;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* The low level HTTP response object, encapsulating all HTTP header
|
||||
* and body data returned from the request.
|
||||
*
|
||||
* @!attribute statusCode
|
||||
* @return [Integer] the HTTP status code of the response (e.g., 200, 404)
|
||||
* @!attribute headers
|
||||
* @return [map<String,String>]
|
||||
* a map of response header keys and their respective values
|
||||
* @!attribute body
|
||||
* @return [String] the response body payload
|
||||
* @!attribute [r] streaming
|
||||
* @return [Boolean] whether this response is being streamed at a low-level.
|
||||
* Defaults to `false` (buffered reads). Do not modify this manually, use
|
||||
* {createUnbufferedStream} to convert the stream to unbuffered mode
|
||||
* instead.
|
||||
*/
|
||||
AWS.HttpResponse = inherit({
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
constructor: function HttpResponse() {
|
||||
this.statusCode = undefined;
|
||||
this.headers = {};
|
||||
this.body = undefined;
|
||||
this.streaming = false;
|
||||
this.stream = null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Disables buffering on the HTTP response and returns the stream for reading.
|
||||
* @return [Stream, XMLHttpRequest, null] the underlying stream object.
|
||||
* Use this object to directly read data off of the stream.
|
||||
* @note This object is only available after the {AWS.Request~httpHeaders}
|
||||
* event has fired. This method must be called prior to
|
||||
* {AWS.Request~httpData}.
|
||||
* @example Taking control of a stream
|
||||
* request.on('httpHeaders', function(statusCode, headers) {
|
||||
* if (statusCode < 300) {
|
||||
* if (headers.etag === 'xyz') {
|
||||
* // pipe the stream, disabling buffering
|
||||
* var stream = this.response.httpResponse.createUnbufferedStream();
|
||||
* stream.pipe(process.stdout);
|
||||
* } else { // abort this request and set a better error message
|
||||
* this.abort();
|
||||
* this.response.error = new Error('Invalid ETag');
|
||||
* }
|
||||
* }
|
||||
* }).send(console.log);
|
||||
*/
|
||||
createUnbufferedStream: function createUnbufferedStream() {
|
||||
this.streaming = true;
|
||||
return this.stream;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
AWS.HttpClient = inherit({});
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
AWS.HttpClient.getInstance = function getInstance() {
|
||||
if (this.singleton === undefined) {
|
||||
this.singleton = new this();
|
||||
}
|
||||
return this.singleton;
|
||||
};
|
||||
219
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/http/node.js
generated
vendored
Normal file
219
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/http/node.js
generated
vendored
Normal file
@@ -0,0 +1,219 @@
|
||||
var AWS = require('../core');
|
||||
var Stream = AWS.util.stream.Stream;
|
||||
var TransformStream = AWS.util.stream.Transform;
|
||||
var ReadableStream = AWS.util.stream.Readable;
|
||||
require('../http');
|
||||
var CONNECTION_REUSE_ENV_NAME = 'AWS_NODEJS_CONNECTION_REUSE_ENABLED';
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
AWS.NodeHttpClient = AWS.util.inherit({
|
||||
handleRequest: function handleRequest(httpRequest, httpOptions, callback, errCallback) {
|
||||
var self = this;
|
||||
var endpoint = httpRequest.endpoint;
|
||||
var pathPrefix = '';
|
||||
if (!httpOptions) httpOptions = {};
|
||||
if (httpOptions.proxy) {
|
||||
pathPrefix = endpoint.protocol + '//' + endpoint.hostname;
|
||||
if (endpoint.port !== 80 && endpoint.port !== 443) {
|
||||
pathPrefix += ':' + endpoint.port;
|
||||
}
|
||||
endpoint = new AWS.Endpoint(httpOptions.proxy);
|
||||
}
|
||||
|
||||
var useSSL = endpoint.protocol === 'https:';
|
||||
var http = useSSL ? require('https') : require('http');
|
||||
var options = {
|
||||
host: endpoint.hostname,
|
||||
port: endpoint.port,
|
||||
method: httpRequest.method,
|
||||
headers: httpRequest.headers,
|
||||
path: pathPrefix + httpRequest.path
|
||||
};
|
||||
|
||||
AWS.util.update(options, httpOptions);
|
||||
|
||||
if (!httpOptions.agent) {
|
||||
options.agent = this.getAgent(useSSL, {
|
||||
keepAlive: process.env[CONNECTION_REUSE_ENV_NAME] === '1' ? true : false
|
||||
});
|
||||
}
|
||||
|
||||
delete options.proxy; // proxy isn't an HTTP option
|
||||
delete options.timeout; // timeout isn't an HTTP option
|
||||
|
||||
var stream = http.request(options, function (httpResp) {
|
||||
if (stream.didCallback) return;
|
||||
|
||||
callback(httpResp);
|
||||
httpResp.emit(
|
||||
'headers',
|
||||
httpResp.statusCode,
|
||||
httpResp.headers,
|
||||
httpResp.statusMessage
|
||||
);
|
||||
});
|
||||
httpRequest.stream = stream; // attach stream to httpRequest
|
||||
stream.didCallback = false;
|
||||
|
||||
// connection timeout support
|
||||
if (httpOptions.connectTimeout) {
|
||||
var connectTimeoutId;
|
||||
stream.on('socket', function(socket) {
|
||||
if (socket.connecting) {
|
||||
connectTimeoutId = setTimeout(function connectTimeout() {
|
||||
if (stream.didCallback) return; stream.didCallback = true;
|
||||
|
||||
stream.abort();
|
||||
errCallback(AWS.util.error(
|
||||
new Error('Socket timed out without establishing a connection'),
|
||||
{code: 'TimeoutError'}
|
||||
));
|
||||
}, httpOptions.connectTimeout);
|
||||
socket.on('connect', function() {
|
||||
clearTimeout(connectTimeoutId);
|
||||
connectTimeoutId = null;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// timeout support
|
||||
stream.setTimeout(httpOptions.timeout || 0, function() {
|
||||
if (stream.didCallback) return; stream.didCallback = true;
|
||||
|
||||
var msg = 'Connection timed out after ' + httpOptions.timeout + 'ms';
|
||||
errCallback(AWS.util.error(new Error(msg), {code: 'TimeoutError'}));
|
||||
stream.abort();
|
||||
});
|
||||
|
||||
stream.on('error', function(err) {
|
||||
if (connectTimeoutId) {
|
||||
clearTimeout(connectTimeoutId);
|
||||
connectTimeoutId = null;
|
||||
}
|
||||
if (stream.didCallback) return; stream.didCallback = true;
|
||||
if ('ECONNRESET' === err.code || 'EPIPE' === err.code || 'ETIMEDOUT' === err.code) {
|
||||
errCallback(AWS.util.error(err, {code: 'TimeoutError'}));
|
||||
} else {
|
||||
errCallback(err);
|
||||
}
|
||||
});
|
||||
|
||||
var expect = httpRequest.headers.Expect || httpRequest.headers.expect;
|
||||
if (expect === '100-continue') {
|
||||
stream.once('continue', function() {
|
||||
self.writeBody(stream, httpRequest);
|
||||
});
|
||||
} else {
|
||||
this.writeBody(stream, httpRequest);
|
||||
}
|
||||
|
||||
return stream;
|
||||
},
|
||||
|
||||
writeBody: function writeBody(stream, httpRequest) {
|
||||
var body = httpRequest.body;
|
||||
var totalBytes = parseInt(httpRequest.headers['Content-Length'], 10);
|
||||
|
||||
if (body instanceof Stream) {
|
||||
// For progress support of streaming content -
|
||||
// pipe the data through a transform stream to emit 'sendProgress' events
|
||||
var progressStream = this.progressStream(stream, totalBytes);
|
||||
if (progressStream) {
|
||||
body.pipe(progressStream).pipe(stream);
|
||||
} else {
|
||||
body.pipe(stream);
|
||||
}
|
||||
} else if (body) {
|
||||
// The provided body is a buffer/string and is already fully available in memory -
|
||||
// For performance it's best to send it as a whole by calling stream.end(body),
|
||||
// Callers expect a 'sendProgress' event which is best emitted once
|
||||
// the http request stream has been fully written and all data flushed.
|
||||
// The use of totalBytes is important over body.length for strings where
|
||||
// length is char length and not byte length.
|
||||
stream.once('finish', function() {
|
||||
stream.emit('sendProgress', {
|
||||
loaded: totalBytes,
|
||||
total: totalBytes
|
||||
});
|
||||
});
|
||||
stream.end(body);
|
||||
} else {
|
||||
// no request body
|
||||
stream.end();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Create the https.Agent or http.Agent according to the request schema.
|
||||
*/
|
||||
getAgent: function getAgent(useSSL, agentOptions) {
|
||||
var http = useSSL ? require('https') : require('http');
|
||||
if (useSSL) {
|
||||
if (!AWS.NodeHttpClient.sslAgent) {
|
||||
AWS.NodeHttpClient.sslAgent = new http.Agent(AWS.util.merge({
|
||||
rejectUnauthorized: process.env.NODE_TLS_REJECT_UNAUTHORIZED === '0' ? false : true
|
||||
}, agentOptions || {}));
|
||||
AWS.NodeHttpClient.sslAgent.setMaxListeners(0);
|
||||
|
||||
// delegate maxSockets to globalAgent, set a default limit of 50 if current value is Infinity.
|
||||
// Users can bypass this default by supplying their own Agent as part of SDK configuration.
|
||||
Object.defineProperty(AWS.NodeHttpClient.sslAgent, 'maxSockets', {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
var defaultMaxSockets = 50;
|
||||
var globalAgent = http.globalAgent;
|
||||
if (globalAgent && globalAgent.maxSockets !== Infinity && typeof globalAgent.maxSockets === 'number') {
|
||||
return globalAgent.maxSockets;
|
||||
}
|
||||
return defaultMaxSockets;
|
||||
}
|
||||
});
|
||||
}
|
||||
return AWS.NodeHttpClient.sslAgent;
|
||||
} else {
|
||||
if (!AWS.NodeHttpClient.agent) {
|
||||
AWS.NodeHttpClient.agent = new http.Agent(agentOptions);
|
||||
}
|
||||
return AWS.NodeHttpClient.agent;
|
||||
}
|
||||
},
|
||||
|
||||
progressStream: function progressStream(stream, totalBytes) {
|
||||
if (typeof TransformStream === 'undefined') {
|
||||
// for node 0.8 there is no streaming progress
|
||||
return;
|
||||
}
|
||||
var loadedBytes = 0;
|
||||
var reporter = new TransformStream();
|
||||
reporter._transform = function(chunk, encoding, callback) {
|
||||
if (chunk) {
|
||||
loadedBytes += chunk.length;
|
||||
stream.emit('sendProgress', {
|
||||
loaded: loadedBytes,
|
||||
total: totalBytes
|
||||
});
|
||||
}
|
||||
callback(null, chunk);
|
||||
};
|
||||
return reporter;
|
||||
},
|
||||
|
||||
emitter: null
|
||||
});
|
||||
|
||||
/**
|
||||
* @!ignore
|
||||
*/
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
AWS.HttpClient.prototype = AWS.NodeHttpClient.prototype;
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
AWS.HttpClient.streamsApiVersion = ReadableStream ? 2 : 1;
|
||||
136
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/http/xhr.js
generated
vendored
Normal file
136
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/http/xhr.js
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
var AWS = require('../core');
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
require('../http');
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
AWS.XHRClient = AWS.util.inherit({
|
||||
handleRequest: function handleRequest(httpRequest, httpOptions, callback, errCallback) {
|
||||
var self = this;
|
||||
var endpoint = httpRequest.endpoint;
|
||||
var emitter = new EventEmitter();
|
||||
var href = endpoint.protocol + '//' + endpoint.hostname;
|
||||
if (endpoint.port !== 80 && endpoint.port !== 443) {
|
||||
href += ':' + endpoint.port;
|
||||
}
|
||||
href += httpRequest.path;
|
||||
|
||||
var xhr = new XMLHttpRequest(), headersEmitted = false;
|
||||
httpRequest.stream = xhr;
|
||||
|
||||
xhr.addEventListener('readystatechange', function() {
|
||||
try {
|
||||
if (xhr.status === 0) return; // 0 code is invalid
|
||||
} catch (e) { return; }
|
||||
|
||||
if (this.readyState >= this.HEADERS_RECEIVED && !headersEmitted) {
|
||||
emitter.statusCode = xhr.status;
|
||||
emitter.headers = self.parseHeaders(xhr.getAllResponseHeaders());
|
||||
emitter.emit(
|
||||
'headers',
|
||||
emitter.statusCode,
|
||||
emitter.headers,
|
||||
xhr.statusText
|
||||
);
|
||||
headersEmitted = true;
|
||||
}
|
||||
if (this.readyState === this.DONE) {
|
||||
self.finishRequest(xhr, emitter);
|
||||
}
|
||||
}, false);
|
||||
xhr.upload.addEventListener('progress', function (evt) {
|
||||
emitter.emit('sendProgress', evt);
|
||||
});
|
||||
xhr.addEventListener('progress', function (evt) {
|
||||
emitter.emit('receiveProgress', evt);
|
||||
}, false);
|
||||
xhr.addEventListener('timeout', function () {
|
||||
errCallback(AWS.util.error(new Error('Timeout'), {code: 'TimeoutError'}));
|
||||
}, false);
|
||||
xhr.addEventListener('error', function () {
|
||||
errCallback(AWS.util.error(new Error('Network Failure'), {
|
||||
code: 'NetworkingError'
|
||||
}));
|
||||
}, false);
|
||||
xhr.addEventListener('abort', function () {
|
||||
errCallback(AWS.util.error(new Error('Request aborted'), {
|
||||
code: 'RequestAbortedError'
|
||||
}));
|
||||
}, false);
|
||||
|
||||
callback(emitter);
|
||||
xhr.open(httpRequest.method, href, httpOptions.xhrAsync !== false);
|
||||
AWS.util.each(httpRequest.headers, function (key, value) {
|
||||
if (key !== 'Content-Length' && key !== 'User-Agent' && key !== 'Host') {
|
||||
xhr.setRequestHeader(key, value);
|
||||
}
|
||||
});
|
||||
|
||||
if (httpOptions.timeout && httpOptions.xhrAsync !== false) {
|
||||
xhr.timeout = httpOptions.timeout;
|
||||
}
|
||||
|
||||
if (httpOptions.xhrWithCredentials) {
|
||||
xhr.withCredentials = true;
|
||||
}
|
||||
try { xhr.responseType = 'arraybuffer'; } catch (e) {}
|
||||
|
||||
try {
|
||||
if (httpRequest.body) {
|
||||
xhr.send(httpRequest.body);
|
||||
} else {
|
||||
xhr.send();
|
||||
}
|
||||
} catch (err) {
|
||||
if (httpRequest.body && typeof httpRequest.body.buffer === 'object') {
|
||||
xhr.send(httpRequest.body.buffer); // send ArrayBuffer directly
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
return emitter;
|
||||
},
|
||||
|
||||
parseHeaders: function parseHeaders(rawHeaders) {
|
||||
var headers = {};
|
||||
AWS.util.arrayEach(rawHeaders.split(/\r?\n/), function (line) {
|
||||
var key = line.split(':', 1)[0];
|
||||
var value = line.substring(key.length + 2);
|
||||
if (key.length > 0) headers[key.toLowerCase()] = value;
|
||||
});
|
||||
return headers;
|
||||
},
|
||||
|
||||
finishRequest: function finishRequest(xhr, emitter) {
|
||||
var buffer;
|
||||
if (xhr.responseType === 'arraybuffer' && xhr.response) {
|
||||
var ab = xhr.response;
|
||||
buffer = new AWS.util.Buffer(ab.byteLength);
|
||||
var view = new Uint8Array(ab);
|
||||
for (var i = 0; i < buffer.length; ++i) {
|
||||
buffer[i] = view[i];
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (!buffer && typeof xhr.responseText === 'string') {
|
||||
buffer = new AWS.util.Buffer(xhr.responseText);
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
if (buffer) emitter.emit('data', buffer);
|
||||
emitter.emit('end');
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
AWS.HttpClient.prototype = AWS.XHRClient.prototype;
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
AWS.HttpClient.streamsApiVersion = 1;
|
||||
40
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/http_request.d.ts
generated
vendored
Normal file
40
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/http_request.d.ts
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
import {Endpoint} from './endpoint';
|
||||
/**
|
||||
* The low level HTTP request object, encapsulating all HTTP header and body data sent by a service request.
|
||||
*/
|
||||
export class HttpRequest {
|
||||
/**
|
||||
* Constructs HttpRequest object with provided endpoint and region
|
||||
*/
|
||||
constructor(endpoint: Endpoint, region: string);
|
||||
/**
|
||||
* The part of the path excluding the query string.
|
||||
*/
|
||||
pathname(): string;
|
||||
/**
|
||||
* The query string portion of the path.
|
||||
*/
|
||||
search: string;
|
||||
/**
|
||||
* The request body payload.
|
||||
*/
|
||||
body: string | Buffer;
|
||||
/**
|
||||
* The endpoint for the request.
|
||||
*/
|
||||
endpoint: Endpoint;
|
||||
/**
|
||||
* A map of header keys and their respective values.
|
||||
*/
|
||||
headers: {
|
||||
[key: string]: string;
|
||||
}
|
||||
/**
|
||||
* The HTTP method of the request.
|
||||
*/
|
||||
method: string;
|
||||
/**
|
||||
* The path portion of the URI, e.g., "/list/?start=5&num=10".
|
||||
*/
|
||||
path: string;
|
||||
}
|
||||
33
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/http_response.d.ts
generated
vendored
Normal file
33
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/http_response.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import * as stream from 'stream';
|
||||
interface XMLHttpRequest {}
|
||||
/**
|
||||
* The low level HTTP response object, encapsulating all HTTP header and body data returned from the request.
|
||||
*/
|
||||
export class HttpResponse {
|
||||
/**
|
||||
* Disables buffering on the HTTP response and returns the stream for reading.
|
||||
*/
|
||||
createUnbufferedStream(): stream.Readable|XMLHttpRequest
|
||||
/**
|
||||
* The response body payload.
|
||||
*/
|
||||
body: string|Buffer|Uint8Array;
|
||||
/**
|
||||
* A map of response header keys and their respective values.
|
||||
*/
|
||||
headers: {
|
||||
[key: string]: string;
|
||||
}
|
||||
/**
|
||||
* The HTTP status code of the response (e.g., 200, 404).
|
||||
*/
|
||||
statusCode: number;
|
||||
/**
|
||||
* The HTTP status message of the response (e.g., 'Bad Request', 'Not Found')
|
||||
*/
|
||||
statusMessage: string;
|
||||
/**
|
||||
* Whether this response is being streamed at a low-level.
|
||||
*/
|
||||
streaming: boolean;
|
||||
}
|
||||
62
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/json/builder.js
generated
vendored
Normal file
62
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/json/builder.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
var util = require('../util');
|
||||
|
||||
function JsonBuilder() { }
|
||||
|
||||
JsonBuilder.prototype.build = function(value, shape) {
|
||||
return JSON.stringify(translate(value, shape));
|
||||
};
|
||||
|
||||
function translate(value, shape) {
|
||||
if (!shape || value === undefined || value === null) return undefined;
|
||||
|
||||
switch (shape.type) {
|
||||
case 'structure': return translateStructure(value, shape);
|
||||
case 'map': return translateMap(value, shape);
|
||||
case 'list': return translateList(value, shape);
|
||||
default: return translateScalar(value, shape);
|
||||
}
|
||||
}
|
||||
|
||||
function translateStructure(structure, shape) {
|
||||
if (shape.isDocument) {
|
||||
return structure;
|
||||
}
|
||||
var struct = {};
|
||||
util.each(structure, function(name, value) {
|
||||
var memberShape = shape.members[name];
|
||||
if (memberShape) {
|
||||
if (memberShape.location !== 'body') return;
|
||||
var locationName = memberShape.isLocationName ? memberShape.name : name;
|
||||
var result = translate(value, memberShape);
|
||||
if (result !== undefined) struct[locationName] = result;
|
||||
}
|
||||
});
|
||||
return struct;
|
||||
}
|
||||
|
||||
function translateList(list, shape) {
|
||||
var out = [];
|
||||
util.arrayEach(list, function(value) {
|
||||
var result = translate(value, shape.member);
|
||||
if (result !== undefined) out.push(result);
|
||||
});
|
||||
return out;
|
||||
}
|
||||
|
||||
function translateMap(map, shape) {
|
||||
var out = {};
|
||||
util.each(map, function(key, value) {
|
||||
var result = translate(value, shape.value);
|
||||
if (result !== undefined) out[key] = result;
|
||||
});
|
||||
return out;
|
||||
}
|
||||
|
||||
function translateScalar(value, shape) {
|
||||
return shape.toWireFormat(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = JsonBuilder;
|
||||
68
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/json/parser.js
generated
vendored
Normal file
68
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/json/parser.js
generated
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
var util = require('../util');
|
||||
|
||||
function JsonParser() { }
|
||||
|
||||
JsonParser.prototype.parse = function(value, shape) {
|
||||
return translate(JSON.parse(value), shape);
|
||||
};
|
||||
|
||||
function translate(value, shape) {
|
||||
if (!shape || value === undefined) return undefined;
|
||||
|
||||
switch (shape.type) {
|
||||
case 'structure': return translateStructure(value, shape);
|
||||
case 'map': return translateMap(value, shape);
|
||||
case 'list': return translateList(value, shape);
|
||||
default: return translateScalar(value, shape);
|
||||
}
|
||||
}
|
||||
|
||||
function translateStructure(structure, shape) {
|
||||
if (structure == null) return undefined;
|
||||
if (shape.isDocument) return structure;
|
||||
|
||||
var struct = {};
|
||||
var shapeMembers = shape.members;
|
||||
util.each(shapeMembers, function(name, memberShape) {
|
||||
var locationName = memberShape.isLocationName ? memberShape.name : name;
|
||||
if (Object.prototype.hasOwnProperty.call(structure, locationName)) {
|
||||
var value = structure[locationName];
|
||||
var result = translate(value, memberShape);
|
||||
if (result !== undefined) struct[name] = result;
|
||||
}
|
||||
});
|
||||
return struct;
|
||||
}
|
||||
|
||||
function translateList(list, shape) {
|
||||
if (list == null) return undefined;
|
||||
|
||||
var out = [];
|
||||
util.arrayEach(list, function(value) {
|
||||
var result = translate(value, shape.member);
|
||||
if (result === undefined) out.push(null);
|
||||
else out.push(result);
|
||||
});
|
||||
return out;
|
||||
}
|
||||
|
||||
function translateMap(map, shape) {
|
||||
if (map == null) return undefined;
|
||||
|
||||
var out = {};
|
||||
util.each(map, function(key, value) {
|
||||
var result = translate(value, shape.value);
|
||||
if (result === undefined) out[key] = null;
|
||||
else out[key] = result;
|
||||
});
|
||||
return out;
|
||||
}
|
||||
|
||||
function translateScalar(value, shape) {
|
||||
return shape.toType(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = JsonParser;
|
||||
47
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/maintenance_mode_message.js
generated
vendored
Normal file
47
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/maintenance_mode_message.js
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
var warning = [
|
||||
'We are formalizing our plans to enter AWS SDK for JavaScript (v2) into maintenance mode in 2023.\n',
|
||||
'Please migrate your code to use AWS SDK for JavaScript (v3).',
|
||||
'For more information, check the migration guide at https://a.co/7PzMCcy'
|
||||
].join('\n');
|
||||
|
||||
module.exports = {
|
||||
suppress: false
|
||||
};
|
||||
|
||||
/**
|
||||
* To suppress this message:
|
||||
* @example
|
||||
* require('aws-sdk/lib/maintenance_mode_message').suppress = true;
|
||||
*/
|
||||
function emitWarning() {
|
||||
if (typeof process === 'undefined')
|
||||
return;
|
||||
|
||||
// Skip maintenance mode message in Lambda environments
|
||||
if (
|
||||
typeof process.env === 'object' &&
|
||||
typeof process.env.AWS_EXECUTION_ENV !== 'undefined' &&
|
||||
process.env.AWS_EXECUTION_ENV.indexOf('AWS_Lambda_') === 0
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
typeof process.env === 'object' &&
|
||||
typeof process.env.AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE !== 'undefined'
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof process.emitWarning === 'function') {
|
||||
process.emitWarning(warning, {
|
||||
type: 'NOTE'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
if (!module.exports.suppress) {
|
||||
emitWarning();
|
||||
}
|
||||
}, 0);
|
||||
72
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/metadata_service.d.ts
generated
vendored
Normal file
72
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/metadata_service.d.ts
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
|
||||
import {AWSError} from './error';
|
||||
/**
|
||||
* Represents a metadata service available on EC2 instances. Using the request() method, you can receieve metadata about any available resource on the metadata service.
|
||||
*/
|
||||
export class MetadataService {
|
||||
/**
|
||||
* Creates a new MetadataService object with a given set of options.
|
||||
*/
|
||||
constructor(options?: MetadataServiceOptions);
|
||||
/**
|
||||
* Sends a request to the instance metadata service for a given resource.
|
||||
*/
|
||||
request(path: string, callback: (err: AWSError, data: string) => void): void;
|
||||
request(
|
||||
path: string,
|
||||
options: {method?: string, headers?: {[key: string]: String} },
|
||||
callback: (err: AWSError, data: string) => void
|
||||
): void;
|
||||
/**
|
||||
* 169.254.169.254
|
||||
*/
|
||||
static host: string
|
||||
/**
|
||||
* A map of options to pass to the underlying HTTP request.
|
||||
*/
|
||||
httpOptions: {
|
||||
/**
|
||||
* a timeout value in milliseconds to wait before aborting the connection. Set to 0 for no timeout.
|
||||
*/
|
||||
timeout: number;
|
||||
}
|
||||
}
|
||||
|
||||
interface MetadataServiceOptions {
|
||||
/**
|
||||
* the hostname of the instance metadata service.
|
||||
*/
|
||||
host?: string;
|
||||
/**
|
||||
* a map of options to pass to the underlying HTTP request.
|
||||
*/
|
||||
httpOptions?: {
|
||||
/**
|
||||
* a timeout value in milliseconds to wait before aborting the connection. Set to 0 for no timeout.
|
||||
*/
|
||||
timeout?: number;
|
||||
}
|
||||
/**
|
||||
* the maximum number of retries to perform for timeout errors.
|
||||
*/
|
||||
maxRetries?: number;
|
||||
/**
|
||||
* A set of options to configure the retry delay on retryable errors. See AWS.Config for details.
|
||||
*/
|
||||
retryDelayOptions?: any
|
||||
|
||||
/**
|
||||
* Prevent IMDSv1 fallback.
|
||||
*/
|
||||
ec2MetadataV1Disabled?: boolean
|
||||
|
||||
/**
|
||||
* profile name to check for IMDSv1 settings.
|
||||
*/
|
||||
profile?: string
|
||||
|
||||
/**
|
||||
* optional file from which to to get config.
|
||||
*/
|
||||
filename?: string
|
||||
}
|
||||
281
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/metadata_service.js
generated
vendored
Normal file
281
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/metadata_service.js
generated
vendored
Normal file
@@ -0,0 +1,281 @@
|
||||
var AWS = require('./core');
|
||||
require('./http');
|
||||
var inherit = AWS.util.inherit;
|
||||
var getMetadataServiceEndpoint = require('./metadata_service/get_metadata_service_endpoint');
|
||||
var URL = require('url').URL;
|
||||
|
||||
/**
|
||||
* Represents a metadata service available on EC2 instances. Using the
|
||||
* {request} method, you can receieve metadata about any available resource
|
||||
* on the metadata service.
|
||||
*
|
||||
* You can disable the use of the IMDS by setting the AWS_EC2_METADATA_DISABLED
|
||||
* environment variable to a truthy value.
|
||||
*
|
||||
* @!attribute [r] httpOptions
|
||||
* @return [map] a map of options to pass to the underlying HTTP request:
|
||||
*
|
||||
* * **timeout** (Number) — a timeout value in milliseconds to wait
|
||||
* before aborting the connection. Set to 0 for no timeout.
|
||||
*
|
||||
* @!macro nobrowser
|
||||
*/
|
||||
AWS.MetadataService = inherit({
|
||||
/**
|
||||
* @return [String] the endpoint of the instance metadata service
|
||||
*/
|
||||
endpoint: getMetadataServiceEndpoint(),
|
||||
|
||||
/**
|
||||
* @!ignore
|
||||
*/
|
||||
|
||||
/**
|
||||
* Default HTTP options. By default, the metadata service is set to not
|
||||
* timeout on long requests. This means that on non-EC2 machines, this
|
||||
* request will never return. If you are calling this operation from an
|
||||
* environment that may not always run on EC2, set a `timeout` value so
|
||||
* the SDK will abort the request after a given number of milliseconds.
|
||||
*/
|
||||
httpOptions: { timeout: 0 },
|
||||
|
||||
/**
|
||||
* when enabled, metadata service will not fetch token
|
||||
*/
|
||||
disableFetchToken: false,
|
||||
|
||||
/**
|
||||
* Creates a new MetadataService object with a given set of options.
|
||||
*
|
||||
* @option options host [String] the hostname of the instance metadata
|
||||
* service
|
||||
* @option options httpOptions [map] a map of options to pass to the
|
||||
* underlying HTTP request:
|
||||
*
|
||||
* * **timeout** (Number) — a timeout value in milliseconds to wait
|
||||
* before aborting the connection. Set to 0 for no timeout.
|
||||
* @option options maxRetries [Integer] the maximum number of retries to
|
||||
* perform for timeout errors
|
||||
* @option options retryDelayOptions [map] A set of options to configure the
|
||||
* retry delay on retryable errors. See AWS.Config for details.
|
||||
* @option options ec2MetadataV1Disabled [boolean] Whether to block IMDS v1 fallback.
|
||||
* @option options profile [string] A profile to check for IMDSv1 fallback settings.
|
||||
* @option options filename [string] Optional filename for the config file.
|
||||
*/
|
||||
constructor: function MetadataService(options) {
|
||||
if (options && options.host) {
|
||||
options.endpoint = 'http://' + options.host;
|
||||
delete options.host;
|
||||
}
|
||||
this.profile = options && options.profile || process.env.AWS_PROFILE || AWS.util.defaultProfile;
|
||||
this.ec2MetadataV1Disabled = !!(options && options.ec2MetadataV1Disabled);
|
||||
this.filename = options && options.filename;
|
||||
AWS.util.update(this, options);
|
||||
},
|
||||
|
||||
/**
|
||||
* Sends a request to the instance metadata service for a given resource.
|
||||
*
|
||||
* @param path [String] the path of the resource to get
|
||||
*
|
||||
* @param options [map] an optional map used to make request
|
||||
*
|
||||
* * **method** (String) — HTTP request method
|
||||
*
|
||||
* * **headers** (map<String,String>) — a map of response header keys and their respective values
|
||||
*
|
||||
* @callback callback function(err, data)
|
||||
* Called when a response is available from the service.
|
||||
* @param err [Error, null] if an error occurred, this value will be set
|
||||
* @param data [String, null] if the request was successful, the body of
|
||||
* the response
|
||||
*/
|
||||
request: function request(path, options, callback) {
|
||||
if (arguments.length === 2) {
|
||||
callback = options;
|
||||
options = {};
|
||||
}
|
||||
|
||||
if (process.env[AWS.util.imdsDisabledEnv]) {
|
||||
callback(new Error('EC2 Instance Metadata Service access disabled'));
|
||||
return;
|
||||
}
|
||||
|
||||
path = path || '/';
|
||||
|
||||
// Verify that host is a valid URL
|
||||
if (URL) { new URL(this.endpoint); }
|
||||
|
||||
var httpRequest = new AWS.HttpRequest(this.endpoint + path);
|
||||
httpRequest.method = options.method || 'GET';
|
||||
if (options.headers) {
|
||||
httpRequest.headers = options.headers;
|
||||
}
|
||||
AWS.util.handleRequestWithRetries(httpRequest, this, callback);
|
||||
},
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
loadCredentialsCallbacks: [],
|
||||
|
||||
/**
|
||||
* Fetches metadata token used for getting credentials
|
||||
*
|
||||
* @api private
|
||||
* @callback callback function(err, token)
|
||||
* Called when token is loaded from the resource
|
||||
*/
|
||||
fetchMetadataToken: function fetchMetadataToken(callback) {
|
||||
var self = this;
|
||||
var tokenFetchPath = '/latest/api/token';
|
||||
self.request(
|
||||
tokenFetchPath,
|
||||
{
|
||||
'method': 'PUT',
|
||||
'headers': {
|
||||
'x-aws-ec2-metadata-token-ttl-seconds': '21600'
|
||||
}
|
||||
},
|
||||
callback
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Fetches credentials
|
||||
*
|
||||
* @api private
|
||||
* @callback cb function(err, creds)
|
||||
* Called when credentials are loaded from the resource
|
||||
*/
|
||||
fetchCredentials: function fetchCredentials(options, cb) {
|
||||
var self = this;
|
||||
var basePath = '/latest/meta-data/iam/security-credentials/';
|
||||
|
||||
var isImdsV1Fallback = self.disableFetchToken
|
||||
|| !(options && options.headers && options.headers['x-aws-ec2-metadata-token']);
|
||||
|
||||
if (isImdsV1Fallback && !(process.env.AWS_EC2_METADATA_DISABLED)) {
|
||||
try {
|
||||
var profiles = AWS.util.getProfilesFromSharedConfig(AWS.util.iniLoader, this.filename);
|
||||
var profileSettings = profiles[this.profile] || {};
|
||||
} catch (e) {
|
||||
profileSettings = {};
|
||||
}
|
||||
|
||||
if (profileSettings.ec2_metadata_v1_disabled && profileSettings.ec2_metadata_v1_disabled !== 'false') {
|
||||
return cb(AWS.util.error(
|
||||
new Error('AWS EC2 Metadata v1 fallback has been blocked by AWS config file profile.')
|
||||
));
|
||||
}
|
||||
|
||||
if (self.ec2MetadataV1Disabled) {
|
||||
return cb(AWS.util.error(
|
||||
new Error('AWS EC2 Metadata v1 fallback has been blocked by AWS.MetadataService::options.ec2MetadataV1Disabled=true.')
|
||||
));
|
||||
}
|
||||
|
||||
if (process.env.AWS_EC2_METADATA_V1_DISABLED && process.env.AWS_EC2_METADATA_V1_DISABLED !== 'false') {
|
||||
return cb(AWS.util.error(
|
||||
new Error('AWS EC2 Metadata v1 fallback has been blocked by process.env.AWS_EC2_METADATA_V1_DISABLED.')
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
self.request(basePath, options, function (err, roleName) {
|
||||
if (err) {
|
||||
self.disableFetchToken = !(err.statusCode === 401);
|
||||
cb(AWS.util.error(
|
||||
err,
|
||||
{
|
||||
message: 'EC2 Metadata roleName request returned error'
|
||||
}
|
||||
));
|
||||
return;
|
||||
}
|
||||
roleName = roleName.split('\n')[0]; // grab first (and only) role
|
||||
self.request(basePath + roleName, options, function (credErr, credData) {
|
||||
if (credErr) {
|
||||
self.disableFetchToken = !(credErr.statusCode === 401);
|
||||
cb(AWS.util.error(
|
||||
credErr,
|
||||
{
|
||||
message: 'EC2 Metadata creds request returned error'
|
||||
}
|
||||
));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
var credentials = JSON.parse(credData);
|
||||
cb(null, credentials);
|
||||
} catch (parseError) {
|
||||
cb(parseError);
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Loads a set of credentials stored in the instance metadata service
|
||||
*
|
||||
* @api private
|
||||
* @callback callback function(err, credentials)
|
||||
* Called when credentials are loaded from the resource
|
||||
* @param err [Error] if an error occurred, this value will be set
|
||||
* @param credentials [Object] the raw JSON object containing all
|
||||
* metadata from the credentials resource
|
||||
*/
|
||||
loadCredentials: function loadCredentials(callback) {
|
||||
var self = this;
|
||||
self.loadCredentialsCallbacks.push(callback);
|
||||
if (self.loadCredentialsCallbacks.length > 1) { return; }
|
||||
|
||||
function callbacks(err, creds) {
|
||||
var cb;
|
||||
while ((cb = self.loadCredentialsCallbacks.shift()) !== undefined) {
|
||||
cb(err, creds);
|
||||
}
|
||||
}
|
||||
|
||||
if (self.disableFetchToken) {
|
||||
self.fetchCredentials({}, callbacks);
|
||||
} else {
|
||||
self.fetchMetadataToken(function(tokenError, token) {
|
||||
if (tokenError) {
|
||||
if (tokenError.code === 'TimeoutError') {
|
||||
self.disableFetchToken = true;
|
||||
} else if (tokenError.retryable === true) {
|
||||
callbacks(AWS.util.error(
|
||||
tokenError,
|
||||
{
|
||||
message: 'EC2 Metadata token request returned error'
|
||||
}
|
||||
));
|
||||
return;
|
||||
} else if (tokenError.statusCode === 400) {
|
||||
callbacks(AWS.util.error(
|
||||
tokenError,
|
||||
{
|
||||
message: 'EC2 Metadata token request returned 400'
|
||||
}
|
||||
));
|
||||
return;
|
||||
}
|
||||
}
|
||||
var options = {};
|
||||
if (token) {
|
||||
options.headers = {
|
||||
'x-aws-ec2-metadata-token': token
|
||||
};
|
||||
}
|
||||
self.fetchCredentials(options, callbacks);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = AWS.MetadataService;
|
||||
8
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/metadata_service/get_endpoint.js
generated
vendored
Normal file
8
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/metadata_service/get_endpoint.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
var getEndpoint = function() {
|
||||
return {
|
||||
IPv4: 'http://169.254.169.254',
|
||||
IPv6: 'http://[fd00:ec2::254]',
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = getEndpoint;
|
||||
12
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/metadata_service/get_endpoint_config_options.js
generated
vendored
Normal file
12
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/metadata_service/get_endpoint_config_options.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
var ENV_ENDPOINT_NAME = 'AWS_EC2_METADATA_SERVICE_ENDPOINT';
|
||||
var CONFIG_ENDPOINT_NAME = 'ec2_metadata_service_endpoint';
|
||||
|
||||
var getEndpointConfigOptions = function() {
|
||||
return {
|
||||
environmentVariableSelector: function(env) { return env[ENV_ENDPOINT_NAME]; },
|
||||
configFileSelector: function(profile) { return profile[CONFIG_ENDPOINT_NAME]; },
|
||||
default: undefined,
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = getEndpointConfigOptions;
|
||||
8
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/metadata_service/get_endpoint_mode.js
generated
vendored
Normal file
8
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/metadata_service/get_endpoint_mode.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
var getEndpointMode = function() {
|
||||
return {
|
||||
IPv4: 'IPv4',
|
||||
IPv6: 'IPv6',
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = getEndpointMode;
|
||||
14
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/metadata_service/get_endpoint_mode_config_options.js
generated
vendored
Normal file
14
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/metadata_service/get_endpoint_mode_config_options.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
var EndpointMode = require('./get_endpoint_mode')();
|
||||
|
||||
var ENV_ENDPOINT_MODE_NAME = 'AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE';
|
||||
var CONFIG_ENDPOINT_MODE_NAME = 'ec2_metadata_service_endpoint_mode';
|
||||
|
||||
var getEndpointModeConfigOptions = function() {
|
||||
return {
|
||||
environmentVariableSelector: function(env) { return env[ENV_ENDPOINT_MODE_NAME]; },
|
||||
configFileSelector: function(profile) { return profile[CONFIG_ENDPOINT_MODE_NAME]; },
|
||||
default: EndpointMode.IPv4,
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = getEndpointModeConfigOptions;
|
||||
24
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/metadata_service/get_metadata_service_endpoint.js
generated
vendored
Normal file
24
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/metadata_service/get_metadata_service_endpoint.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
var AWS = require('../core');
|
||||
|
||||
var Endpoint = require('./get_endpoint')();
|
||||
var EndpointMode = require('./get_endpoint_mode')();
|
||||
|
||||
var ENDPOINT_CONFIG_OPTIONS = require('./get_endpoint_config_options')();
|
||||
var ENDPOINT_MODE_CONFIG_OPTIONS = require('./get_endpoint_mode_config_options')();
|
||||
|
||||
var getMetadataServiceEndpoint = function() {
|
||||
var endpoint = AWS.util.loadConfig(ENDPOINT_CONFIG_OPTIONS);
|
||||
if (endpoint !== undefined) return endpoint;
|
||||
|
||||
var endpointMode = AWS.util.loadConfig(ENDPOINT_MODE_CONFIG_OPTIONS);
|
||||
switch (endpointMode) {
|
||||
case EndpointMode.IPv4:
|
||||
return Endpoint.IPv4;
|
||||
case EndpointMode.IPv6:
|
||||
return Endpoint.IPv6;
|
||||
default:
|
||||
throw new Error('Unsupported endpoint mode: ' + endpointMode);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = getMetadataServiceEndpoint;
|
||||
89
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/model/api.js
generated
vendored
Normal file
89
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/model/api.js
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
var Collection = require('./collection');
|
||||
var Operation = require('./operation');
|
||||
var Shape = require('./shape');
|
||||
var Paginator = require('./paginator');
|
||||
var ResourceWaiter = require('./resource_waiter');
|
||||
var metadata = require('../../apis/metadata.json');
|
||||
|
||||
var util = require('../util');
|
||||
var property = util.property;
|
||||
var memoizedProperty = util.memoizedProperty;
|
||||
|
||||
function Api(api, options) {
|
||||
var self = this;
|
||||
api = api || {};
|
||||
options = options || {};
|
||||
options.api = this;
|
||||
|
||||
api.metadata = api.metadata || {};
|
||||
|
||||
var serviceIdentifier = options.serviceIdentifier;
|
||||
delete options.serviceIdentifier;
|
||||
|
||||
property(this, 'isApi', true, false);
|
||||
property(this, 'apiVersion', api.metadata.apiVersion);
|
||||
property(this, 'endpointPrefix', api.metadata.endpointPrefix);
|
||||
property(this, 'signingName', api.metadata.signingName);
|
||||
property(this, 'globalEndpoint', api.metadata.globalEndpoint);
|
||||
property(this, 'signatureVersion', api.metadata.signatureVersion);
|
||||
property(this, 'jsonVersion', api.metadata.jsonVersion);
|
||||
property(this, 'targetPrefix', api.metadata.targetPrefix);
|
||||
property(this, 'protocol', api.metadata.protocol);
|
||||
property(this, 'timestampFormat', api.metadata.timestampFormat);
|
||||
property(this, 'xmlNamespaceUri', api.metadata.xmlNamespace);
|
||||
property(this, 'abbreviation', api.metadata.serviceAbbreviation);
|
||||
property(this, 'fullName', api.metadata.serviceFullName);
|
||||
property(this, 'serviceId', api.metadata.serviceId);
|
||||
if (serviceIdentifier && metadata[serviceIdentifier]) {
|
||||
property(this, 'xmlNoDefaultLists', metadata[serviceIdentifier].xmlNoDefaultLists, false);
|
||||
}
|
||||
|
||||
memoizedProperty(this, 'className', function() {
|
||||
var name = api.metadata.serviceAbbreviation || api.metadata.serviceFullName;
|
||||
if (!name) return null;
|
||||
|
||||
name = name.replace(/^Amazon|AWS\s*|\(.*|\s+|\W+/g, '');
|
||||
if (name === 'ElasticLoadBalancing') name = 'ELB';
|
||||
return name;
|
||||
});
|
||||
|
||||
function addEndpointOperation(name, operation) {
|
||||
if (operation.endpointoperation === true) {
|
||||
property(self, 'endpointOperation', util.string.lowerFirst(name));
|
||||
}
|
||||
if (operation.endpointdiscovery && !self.hasRequiredEndpointDiscovery) {
|
||||
property(
|
||||
self,
|
||||
'hasRequiredEndpointDiscovery',
|
||||
operation.endpointdiscovery.required === true
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
property(this, 'operations', new Collection(api.operations, options, function(name, operation) {
|
||||
return new Operation(name, operation, options);
|
||||
}, util.string.lowerFirst, addEndpointOperation));
|
||||
|
||||
property(this, 'shapes', new Collection(api.shapes, options, function(name, shape) {
|
||||
return Shape.create(shape, options);
|
||||
}));
|
||||
|
||||
property(this, 'paginators', new Collection(api.paginators, options, function(name, paginator) {
|
||||
return new Paginator(name, paginator, options);
|
||||
}));
|
||||
|
||||
property(this, 'waiters', new Collection(api.waiters, options, function(name, waiter) {
|
||||
return new ResourceWaiter(name, waiter, options);
|
||||
}, util.string.lowerFirst));
|
||||
|
||||
if (options.documentation) {
|
||||
property(this, 'documentation', api.documentation);
|
||||
property(this, 'documentationUrl', api.documentationUrl);
|
||||
}
|
||||
property(this, 'awsQueryCompatible', api.metadata.awsQueryCompatible);
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = Api;
|
||||
24
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/model/collection.js
generated
vendored
Normal file
24
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/model/collection.js
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
var memoizedProperty = require('../util').memoizedProperty;
|
||||
|
||||
function memoize(name, value, factory, nameTr) {
|
||||
memoizedProperty(this, nameTr(name), function() {
|
||||
return factory(name, value);
|
||||
});
|
||||
}
|
||||
|
||||
function Collection(iterable, options, factory, nameTr, callback) {
|
||||
nameTr = nameTr || String;
|
||||
var self = this;
|
||||
|
||||
for (var id in iterable) {
|
||||
if (Object.prototype.hasOwnProperty.call(iterable, id)) {
|
||||
memoize.call(self, id, iterable[id], factory, nameTr);
|
||||
if (callback) callback(id, iterable[id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = Collection;
|
||||
4
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/model/index.d.ts
generated
vendored
Normal file
4
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/model/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export type DocumentType = Scalar | Structure | List;
|
||||
type Scalar = string | number | boolean | null;
|
||||
type Structure = { [member: string]: DocumentType };
|
||||
interface List extends Array<DocumentType> {}
|
||||
119
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/model/operation.js
generated
vendored
Normal file
119
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/model/operation.js
generated
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
var Shape = require('./shape');
|
||||
|
||||
var util = require('../util');
|
||||
var property = util.property;
|
||||
var memoizedProperty = util.memoizedProperty;
|
||||
|
||||
function Operation(name, operation, options) {
|
||||
var self = this;
|
||||
options = options || {};
|
||||
|
||||
property(this, 'name', operation.name || name);
|
||||
property(this, 'api', options.api, false);
|
||||
|
||||
operation.http = operation.http || {};
|
||||
property(this, 'endpoint', operation.endpoint);
|
||||
property(this, 'httpMethod', operation.http.method || 'POST');
|
||||
property(this, 'httpPath', operation.http.requestUri || '/');
|
||||
property(this, 'authtype', operation.authtype || '');
|
||||
property(
|
||||
this,
|
||||
'endpointDiscoveryRequired',
|
||||
operation.endpointdiscovery ?
|
||||
(operation.endpointdiscovery.required ? 'REQUIRED' : 'OPTIONAL') :
|
||||
'NULL'
|
||||
);
|
||||
|
||||
// httpChecksum replaces usage of httpChecksumRequired, but some APIs
|
||||
// (s3control) still uses old trait.
|
||||
var httpChecksumRequired = operation.httpChecksumRequired
|
||||
|| (operation.httpChecksum && operation.httpChecksum.requestChecksumRequired);
|
||||
property(this, 'httpChecksumRequired', httpChecksumRequired, false);
|
||||
|
||||
memoizedProperty(this, 'input', function() {
|
||||
if (!operation.input) {
|
||||
return new Shape.create({type: 'structure'}, options);
|
||||
}
|
||||
return Shape.create(operation.input, options);
|
||||
});
|
||||
|
||||
memoizedProperty(this, 'output', function() {
|
||||
if (!operation.output) {
|
||||
return new Shape.create({type: 'structure'}, options);
|
||||
}
|
||||
return Shape.create(operation.output, options);
|
||||
});
|
||||
|
||||
memoizedProperty(this, 'errors', function() {
|
||||
var list = [];
|
||||
if (!operation.errors) return null;
|
||||
|
||||
for (var i = 0; i < operation.errors.length; i++) {
|
||||
list.push(Shape.create(operation.errors[i], options));
|
||||
}
|
||||
|
||||
return list;
|
||||
});
|
||||
|
||||
memoizedProperty(this, 'paginator', function() {
|
||||
return options.api.paginators[name];
|
||||
});
|
||||
|
||||
if (options.documentation) {
|
||||
property(this, 'documentation', operation.documentation);
|
||||
property(this, 'documentationUrl', operation.documentationUrl);
|
||||
}
|
||||
|
||||
// idempotentMembers only tracks top-level input shapes
|
||||
memoizedProperty(this, 'idempotentMembers', function() {
|
||||
var idempotentMembers = [];
|
||||
var input = self.input;
|
||||
var members = input.members;
|
||||
if (!input.members) {
|
||||
return idempotentMembers;
|
||||
}
|
||||
for (var name in members) {
|
||||
if (!members.hasOwnProperty(name)) {
|
||||
continue;
|
||||
}
|
||||
if (members[name].isIdempotent === true) {
|
||||
idempotentMembers.push(name);
|
||||
}
|
||||
}
|
||||
return idempotentMembers;
|
||||
});
|
||||
|
||||
memoizedProperty(this, 'hasEventOutput', function() {
|
||||
var output = self.output;
|
||||
return hasEventStream(output);
|
||||
});
|
||||
}
|
||||
|
||||
function hasEventStream(topLevelShape) {
|
||||
var members = topLevelShape.members;
|
||||
var payload = topLevelShape.payload;
|
||||
|
||||
if (!topLevelShape.members) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (payload) {
|
||||
var payloadMember = members[payload];
|
||||
return payloadMember.isEventStream;
|
||||
}
|
||||
|
||||
// check if any member is an event stream
|
||||
for (var name in members) {
|
||||
if (!members.hasOwnProperty(name)) {
|
||||
if (members[name].isEventStream === true) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = Operation;
|
||||
14
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/model/paginator.js
generated
vendored
Normal file
14
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/model/paginator.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
var property = require('../util').property;
|
||||
|
||||
function Paginator(name, paginator) {
|
||||
property(this, 'inputToken', paginator.input_token);
|
||||
property(this, 'limitKey', paginator.limit_key);
|
||||
property(this, 'moreResults', paginator.more_results);
|
||||
property(this, 'outputToken', paginator.output_token);
|
||||
property(this, 'resultKey', paginator.result_key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = Paginator;
|
||||
33
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/model/resource_waiter.js
generated
vendored
Normal file
33
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/model/resource_waiter.js
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
var util = require('../util');
|
||||
var property = util.property;
|
||||
|
||||
function ResourceWaiter(name, waiter, options) {
|
||||
options = options || {};
|
||||
property(this, 'name', name);
|
||||
property(this, 'api', options.api, false);
|
||||
|
||||
if (waiter.operation) {
|
||||
property(this, 'operation', util.string.lowerFirst(waiter.operation));
|
||||
}
|
||||
|
||||
var self = this;
|
||||
var keys = [
|
||||
'type',
|
||||
'description',
|
||||
'delay',
|
||||
'maxAttempts',
|
||||
'acceptors'
|
||||
];
|
||||
|
||||
keys.forEach(function(key) {
|
||||
var value = waiter[key];
|
||||
if (value) {
|
||||
property(self, key, value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = ResourceWaiter;
|
||||
407
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/model/shape.js
generated
vendored
Normal file
407
aws/lambda-nodejs18.x/UpdateZulipStreams/node_modules/aws-sdk/lib/model/shape.js
generated
vendored
Normal file
@@ -0,0 +1,407 @@
|
||||
var Collection = require('./collection');
|
||||
|
||||
var util = require('../util');
|
||||
|
||||
function property(obj, name, value) {
|
||||
if (value !== null && value !== undefined) {
|
||||
util.property.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
function memoizedProperty(obj, name) {
|
||||
if (!obj.constructor.prototype[name]) {
|
||||
util.memoizedProperty.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
function Shape(shape, options, memberName) {
|
||||
options = options || {};
|
||||
|
||||
property(this, 'shape', shape.shape);
|
||||
property(this, 'api', options.api, false);
|
||||
property(this, 'type', shape.type);
|
||||
property(this, 'enum', shape.enum);
|
||||
property(this, 'min', shape.min);
|
||||
property(this, 'max', shape.max);
|
||||
property(this, 'pattern', shape.pattern);
|
||||
property(this, 'location', shape.location || this.location || 'body');
|
||||
property(this, 'name', this.name || shape.xmlName || shape.queryName ||
|
||||
shape.locationName || memberName);
|
||||
property(this, 'isStreaming', shape.streaming || this.isStreaming || false);
|
||||
property(this, 'requiresLength', shape.requiresLength, false);
|
||||
property(this, 'isComposite', shape.isComposite || false);
|
||||
property(this, 'isShape', true, false);
|
||||
property(this, 'isQueryName', Boolean(shape.queryName), false);
|
||||
property(this, 'isLocationName', Boolean(shape.locationName), false);
|
||||
property(this, 'isIdempotent', shape.idempotencyToken === true);
|
||||
property(this, 'isJsonValue', shape.jsonvalue === true);
|
||||
property(this, 'isSensitive', shape.sensitive === true || shape.prototype && shape.prototype.sensitive === true);
|
||||
property(this, 'isEventStream', Boolean(shape.eventstream), false);
|
||||
property(this, 'isEvent', Boolean(shape.event), false);
|
||||
property(this, 'isEventPayload', Boolean(shape.eventpayload), false);
|
||||
property(this, 'isEventHeader', Boolean(shape.eventheader), false);
|
||||
property(this, 'isTimestampFormatSet', Boolean(shape.timestampFormat) || shape.prototype && shape.prototype.isTimestampFormatSet === true, false);
|
||||
property(this, 'endpointDiscoveryId', Boolean(shape.endpointdiscoveryid), false);
|
||||
property(this, 'hostLabel', Boolean(shape.hostLabel), false);
|
||||
|
||||
if (options.documentation) {
|
||||
property(this, 'documentation', shape.documentation);
|
||||
property(this, 'documentationUrl', shape.documentationUrl);
|
||||
}
|
||||
|
||||
if (shape.xmlAttribute) {
|
||||
property(this, 'isXmlAttribute', shape.xmlAttribute || false);
|
||||
}
|
||||
|
||||
// type conversion and parsing
|
||||
property(this, 'defaultValue', null);
|
||||
this.toWireFormat = function(value) {
|
||||
if (value === null || value === undefined) return '';
|
||||
return value;
|
||||
};
|
||||
this.toType = function(value) { return value; };
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
Shape.normalizedTypes = {
|
||||
character: 'string',
|
||||
double: 'float',
|
||||
long: 'integer',
|
||||
short: 'integer',
|
||||
biginteger: 'integer',
|
||||
bigdecimal: 'float',
|
||||
blob: 'binary'
|
||||
};
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
Shape.types = {
|
||||
'structure': StructureShape,
|
||||
'list': ListShape,
|
||||
'map': MapShape,
|
||||
'boolean': BooleanShape,
|
||||
'timestamp': TimestampShape,
|
||||
'float': FloatShape,
|
||||
'integer': IntegerShape,
|
||||
'string': StringShape,
|
||||
'base64': Base64Shape,
|
||||
'binary': BinaryShape
|
||||
};
|
||||
|
||||
Shape.resolve = function resolve(shape, options) {
|
||||
if (shape.shape) {
|
||||
var refShape = options.api.shapes[shape.shape];
|
||||
if (!refShape) {
|
||||
throw new Error('Cannot find shape reference: ' + shape.shape);
|
||||
}
|
||||
|
||||
return refShape;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
Shape.create = function create(shape, options, memberName) {
|
||||
if (shape.isShape) return shape;
|
||||
|
||||
var refShape = Shape.resolve(shape, options);
|
||||
if (refShape) {
|
||||
var filteredKeys = Object.keys(shape);
|
||||
if (!options.documentation) {
|
||||
filteredKeys = filteredKeys.filter(function(name) {
|
||||
return !name.match(/documentation/);
|
||||
});
|
||||
}
|
||||
|
||||
// create an inline shape with extra members
|
||||
var InlineShape = function() {
|
||||
refShape.constructor.call(this, shape, options, memberName);
|
||||
};
|
||||
InlineShape.prototype = refShape;
|
||||
return new InlineShape();
|
||||
} else {
|
||||
// set type if not set
|
||||
if (!shape.type) {
|
||||
if (shape.members) shape.type = 'structure';
|
||||
else if (shape.member) shape.type = 'list';
|
||||
else if (shape.key) shape.type = 'map';
|
||||
else shape.type = 'string';
|
||||
}
|
||||
|
||||
// normalize types
|
||||
var origType = shape.type;
|
||||
if (Shape.normalizedTypes[shape.type]) {
|
||||
shape.type = Shape.normalizedTypes[shape.type];
|
||||
}
|
||||
|
||||
if (Shape.types[shape.type]) {
|
||||
return new Shape.types[shape.type](shape, options, memberName);
|
||||
} else {
|
||||
throw new Error('Unrecognized shape type: ' + origType);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function CompositeShape(shape) {
|
||||
Shape.apply(this, arguments);
|
||||
property(this, 'isComposite', true);
|
||||
|
||||
if (shape.flattened) {
|
||||
property(this, 'flattened', shape.flattened || false);
|
||||
}
|
||||
}
|
||||
|
||||
function StructureShape(shape, options) {
|
||||
var self = this;
|
||||
var requiredMap = null, firstInit = !this.isShape;
|
||||
|
||||
CompositeShape.apply(this, arguments);
|
||||
|
||||
if (firstInit) {
|
||||
property(this, 'defaultValue', function() { return {}; });
|
||||
property(this, 'members', {});
|
||||
property(this, 'memberNames', []);
|
||||
property(this, 'required', []);
|
||||
property(this, 'isRequired', function() { return false; });
|
||||
property(this, 'isDocument', Boolean(shape.document));
|
||||
}
|
||||
|
||||
if (shape.members) {
|
||||
property(this, 'members', new Collection(shape.members, options, function(name, member) {
|
||||
return Shape.create(member, options, name);
|
||||
}));
|
||||
memoizedProperty(this, 'memberNames', function() {
|
||||
return shape.xmlOrder || Object.keys(shape.members);
|
||||
});
|
||||
|
||||
if (shape.event) {
|
||||
memoizedProperty(this, 'eventPayloadMemberName', function() {
|
||||
var members = self.members;
|
||||
var memberNames = self.memberNames;
|
||||
// iterate over members to find ones that are event payloads
|
||||
for (var i = 0, iLen = memberNames.length; i < iLen; i++) {
|
||||
if (members[memberNames[i]].isEventPayload) {
|
||||
return memberNames[i];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
memoizedProperty(this, 'eventHeaderMemberNames', function() {
|
||||
var members = self.members;
|
||||
var memberNames = self.memberNames;
|
||||
var eventHeaderMemberNames = [];
|
||||
// iterate over members to find ones that are event headers
|
||||
for (var i = 0, iLen = memberNames.length; i < iLen; i++) {
|
||||
if (members[memberNames[i]].isEventHeader) {
|
||||
eventHeaderMemberNames.push(memberNames[i]);
|
||||
}
|
||||
}
|
||||
return eventHeaderMemberNames;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (shape.required) {
|
||||
property(this, 'required', shape.required);
|
||||
property(this, 'isRequired', function(name) {
|
||||
if (!requiredMap) {
|
||||
requiredMap = {};
|
||||
for (var i = 0; i < shape.required.length; i++) {
|
||||
requiredMap[shape.required[i]] = true;
|
||||
}
|
||||
}
|
||||
|
||||
return requiredMap[name];
|
||||
}, false, true);
|
||||
}
|
||||
|
||||
property(this, 'resultWrapper', shape.resultWrapper || null);
|
||||
|
||||
if (shape.payload) {
|
||||
property(this, 'payload', shape.payload);
|
||||
}
|
||||
|
||||
if (typeof shape.xmlNamespace === 'string') {
|
||||
property(this, 'xmlNamespaceUri', shape.xmlNamespace);
|
||||
} else if (typeof shape.xmlNamespace === 'object') {
|
||||
property(this, 'xmlNamespacePrefix', shape.xmlNamespace.prefix);
|
||||
property(this, 'xmlNamespaceUri', shape.xmlNamespace.uri);
|
||||
}
|
||||
}
|
||||
|
||||
function ListShape(shape, options) {
|
||||
var self = this, firstInit = !this.isShape;
|
||||
CompositeShape.apply(this, arguments);
|
||||
|
||||
if (firstInit) {
|
||||
property(this, 'defaultValue', function() { return []; });
|
||||
}
|
||||
|
||||
if (shape.member) {
|
||||
memoizedProperty(this, 'member', function() {
|
||||
return Shape.create(shape.member, options);
|
||||
});
|
||||
}
|
||||
|
||||
if (this.flattened) {
|
||||
var oldName = this.name;
|
||||
memoizedProperty(this, 'name', function() {
|
||||
return self.member.name || oldName;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function MapShape(shape, options) {
|
||||
var firstInit = !this.isShape;
|
||||
CompositeShape.apply(this, arguments);
|
||||
|
||||
if (firstInit) {
|
||||
property(this, 'defaultValue', function() { return {}; });
|
||||
property(this, 'key', Shape.create({type: 'string'}, options));
|
||||
property(this, 'value', Shape.create({type: 'string'}, options));
|
||||
}
|
||||
|
||||
if (shape.key) {
|
||||
memoizedProperty(this, 'key', function() {
|
||||
return Shape.create(shape.key, options);
|
||||
});
|
||||
}
|
||||
if (shape.value) {
|
||||
memoizedProperty(this, 'value', function() {
|
||||
return Shape.create(shape.value, options);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function TimestampShape(shape) {
|
||||
var self = this;
|
||||
Shape.apply(this, arguments);
|
||||
|
||||
if (shape.timestampFormat) {
|
||||
property(this, 'timestampFormat', shape.timestampFormat);
|
||||
} else if (self.isTimestampFormatSet && this.timestampFormat) {
|
||||
property(this, 'timestampFormat', this.timestampFormat);
|
||||
} else if (this.location === 'header') {
|
||||
property(this, 'timestampFormat', 'rfc822');
|
||||
} else if (this.location === 'querystring') {
|
||||
property(this, 'timestampFormat', 'iso8601');
|
||||
} else if (this.api) {
|
||||
switch (this.api.protocol) {
|
||||
case 'json':
|
||||
case 'rest-json':
|
||||
property(this, 'timestampFormat', 'unixTimestamp');
|
||||
break;
|
||||
case 'rest-xml':
|
||||
case 'query':
|
||||
case 'ec2':
|
||||
property(this, 'timestampFormat', 'iso8601');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.toType = function(value) {
|
||||
if (value === null || value === undefined) return null;
|
||||
if (typeof value.toUTCString === 'function') return value;
|
||||
return typeof value === 'string' || typeof value === 'number' ?
|
||||
util.date.parseTimestamp(value) : null;
|
||||
};
|
||||
|
||||
this.toWireFormat = function(value) {
|
||||
return util.date.format(value, self.timestampFormat);
|
||||
};
|
||||
}
|
||||
|
||||
function StringShape() {
|
||||
Shape.apply(this, arguments);
|
||||
|
||||
var nullLessProtocols = ['rest-xml', 'query', 'ec2'];
|
||||
this.toType = function(value) {
|
||||
value = this.api && nullLessProtocols.indexOf(this.api.protocol) > -1 ?
|
||||
value || '' : value;
|
||||
if (this.isJsonValue) {
|
||||
return JSON.parse(value);
|
||||
}
|
||||
|
||||
return value && typeof value.toString === 'function' ?
|
||||
value.toString() : value;
|
||||
};
|
||||
|
||||
this.toWireFormat = function(value) {
|
||||
return this.isJsonValue ? JSON.stringify(value) : value;
|
||||
};
|
||||
}
|
||||
|
||||
function FloatShape() {
|
||||
Shape.apply(this, arguments);
|
||||
|
||||
this.toType = function(value) {
|
||||
if (value === null || value === undefined) return null;
|
||||
return parseFloat(value);
|
||||
};
|
||||
this.toWireFormat = this.toType;
|
||||
}
|
||||
|
||||
function IntegerShape() {
|
||||
Shape.apply(this, arguments);
|
||||
|
||||
this.toType = function(value) {
|
||||
if (value === null || value === undefined) return null;
|
||||
return parseInt(value, 10);
|
||||
};
|
||||
this.toWireFormat = this.toType;
|
||||
}
|
||||
|
||||
function BinaryShape() {
|
||||
Shape.apply(this, arguments);
|
||||
this.toType = function(value) {
|
||||
var buf = util.base64.decode(value);
|
||||
if (this.isSensitive && util.isNode() && typeof util.Buffer.alloc === 'function') {
|
||||
/* Node.js can create a Buffer that is not isolated.
|
||||
* i.e. buf.byteLength !== buf.buffer.byteLength
|
||||
* This means that the sensitive data is accessible to anyone with access to buf.buffer.
|
||||
* If this is the node shared Buffer, then other code within this process _could_ find this secret.
|
||||
* Copy sensitive data to an isolated Buffer and zero the sensitive data.
|
||||
* While this is safe to do here, copying this code somewhere else may produce unexpected results.
|
||||
*/
|
||||
var secureBuf = util.Buffer.alloc(buf.length, buf);
|
||||
buf.fill(0);
|
||||
buf = secureBuf;
|
||||
}
|
||||
return buf;
|
||||
};
|
||||
this.toWireFormat = util.base64.encode;
|
||||
}
|
||||
|
||||
function Base64Shape() {
|
||||
BinaryShape.apply(this, arguments);
|
||||
}
|
||||
|
||||
function BooleanShape() {
|
||||
Shape.apply(this, arguments);
|
||||
|
||||
this.toType = function(value) {
|
||||
if (typeof value === 'boolean') return value;
|
||||
if (value === null || value === undefined) return null;
|
||||
return value === 'true';
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
Shape.shapes = {
|
||||
StructureShape: StructureShape,
|
||||
ListShape: ListShape,
|
||||
MapShape: MapShape,
|
||||
StringShape: StringShape,
|
||||
BooleanShape: BooleanShape,
|
||||
Base64Shape: Base64Shape
|
||||
};
|
||||
|
||||
/**
|
||||
* @api private
|
||||
*/
|
||||
module.exports = Shape;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user