presidium 0.29.13 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Archive.js +11 -7
- package/AwsCredentials.js +39 -41
- package/Docker.js +1377 -1073
- package/DynamoDBGlobalSecondaryIndex.js +782 -0
- package/DynamoDBStream.js +500 -0
- package/DynamoDBTable.js +1483 -0
- package/ECR.js +188 -35
- package/HTTP.js +390 -0
- package/NpmToken.js +26 -9
- package/README.md +194 -126
- package/Readable.js +88 -0
- package/S3Bucket.js +2368 -337
- package/SecretsManager.js +193 -123
- package/TranscribeStream.js +33 -25
- package/WebSocket.js +1 -24
- package/XML.js +286 -0
- package/package.json +42 -22
- package/userAgent.js +5 -0
- package/.eslintrc.js +0 -330
- package/.github/workflows/nodejs.yml +0 -82
- package/Archive.test.js +0 -61
- package/AutoScaling.js +0 -106
- package/AutoScaling.test.js +0 -57
- package/AwsCredentials.test.js +0 -63
- package/CHANGELOG.md +0 -11
- package/Dependency.js +0 -49
- package/Dependency.test.js +0 -74
- package/Docker.test.js +0 -483
- package/DockerContainer.js +0 -162
- package/DockerContainer.test.js +0 -116
- package/DockerImage.js +0 -191
- package/DockerImage.test.js +0 -89
- package/DockerService.js +0 -319
- package/DockerService.test.js +0 -191
- package/DockerSwarm.js +0 -117
- package/DockerSwarm.test.js +0 -32
- package/Dynamo.js +0 -460
- package/Dynamo.test.js +0 -80
- package/DynamoIndex.js +0 -186
- package/DynamoIndex.test.js +0 -417
- package/DynamoIndexQueryIterator.js +0 -49
- package/DynamoIndexQueryIterator.test.js +0 -102
- package/DynamoStream.js +0 -251
- package/DynamoStream.memory-usage.js +0 -32
- package/DynamoStream.test.js +0 -336
- package/DynamoTable.js +0 -430
- package/DynamoTable.test.js +0 -246
- package/DynamoTableScanIterator.js +0 -26
- package/DynamoTableScanIterator.test.js +0 -39
- package/DynamoTableV2.js +0 -487
- package/DynamoTableV2.test.js +0 -121
- package/EC2.js +0 -186
- package/EC2.test.js +0 -57
- package/ECR.test.js +0 -32
- package/EcrLoginPassword.js +0 -39
- package/Elasticsearch.js +0 -29
- package/Elasticsearch.test.js +0 -13
- package/ElasticsearchIndex.js +0 -440
- package/ElasticsearchIndex.test.js +0 -155
- package/Gzip.js +0 -29
- package/Gzip.test.js +0 -30
- package/Http.js +0 -104
- package/Http.test.js +0 -86
- package/HttpAgent.js +0 -20
- package/HttpAgent.test.js +0 -9
- package/HttpServer.js +0 -72
- package/HttpServer.test.js +0 -30
- package/HttpsAgent.js +0 -20
- package/HttpsAgent.test.js +0 -15
- package/HttpsServer.js +0 -37
- package/Kinesis.js +0 -33
- package/Kinesis.test.js +0 -11
- package/KinesisStream.js +0 -270
- package/KinesisStream.test.js +0 -165
- package/Mongo.js +0 -38
- package/Mongo.test.js +0 -13
- package/MongoCollection.js +0 -26
- package/MongoCollection.test.js +0 -23
- package/OptionalValidator.test.js +0 -30
- package/Password.test.js +0 -19
- package/Redis.js +0 -32
- package/Redis.test.js +0 -215
- package/RequestBuffer.js +0 -21
- package/RequestBuffer.test.js +0 -34
- package/S3.js +0 -424
- package/S3.test.js +0 -13
- package/S3Bucket.test.js +0 -86
- package/SecretsManager.test.js +0 -76
- package/StrictValidator.test.js +0 -36
- package/StringStream.js +0 -15
- package/TranscribeStream.test.js +0 -119
- package/WebSocketServer.js +0 -109
- package/WebSocketServer.test.js +0 -156
- package/index.js +0 -73
- package/internal/AWSAutoScalingDescribeAutoScalingGroupsFilters.js +0 -35
- package/internal/AWSEC2DescribeInstancesFilters.js +0 -140
- package/internal/AmzCanonicalHeaders.js +0 -18
- package/internal/AmzDate.js +0 -14
- package/internal/AmzSignature.js +0 -35
- package/internal/AmzSignedHeaders.js +0 -13
- package/internal/AutoScalingListGroupsDescribeFilterOptions.ss +0 -7
- package/internal/AwsCredentials.js +0 -32
- package/internal/AwsPresignedUrlV4.js +0 -100
- package/internal/Crc32.js +0 -93
- package/internal/EC2ListInstancesDescribeFilterOptions.ss +0 -91
- package/internal/RetryAwsErrors.js +0 -21
- package/internal/StreamString.js +0 -14
- package/internal/StringStream.js +0 -15
- package/internal/arrayPush.js +0 -14
- package/internal/asyncIterableTake.js +0 -18
- package/internal/callPropBinary.js +0 -19
- package/internal/callPropUnary.js +0 -18
- package/internal/createExpressionAttributeNames.js +0 -53
- package/internal/createExpressionAttributeValues.js +0 -23
- package/internal/createFilterExpression.js +0 -32
- package/internal/createKeyConditionExpression.js +0 -32
- package/internal/createUpdateServiceSpec.js +0 -260
- package/internal/createUpdateServiceSpec.test.js +0 -396
- package/internal/filterExists.js +0 -7
- package/internal/filterExistsAndNotEmpty.js +0 -12
- package/internal/fixtures/csr.pem +0 -17
- package/internal/fixtures/my-private-root-ca.cert.pem +0 -22
- package/internal/fixtures/my-private-root-ca.privkey.pem +0 -28
- package/internal/fixtures/privkey.pem +0 -28
- package/internal/getFirstKey.js +0 -11
- package/internal/getFirstValue.js +0 -11
- package/internal/has.js +0 -6
- package/internal/hashJSON.js +0 -13
- package/internal/inspect.js +0 -6
- package/internal/isArray.js +0 -11
- package/internal/isPromise.js +0 -4
- package/internal/join.js +0 -13
- package/internal/make-certs.sh +0 -34
- package/internal/mapKeys.js +0 -29
- package/internal/match.js +0 -3
- package/internal/objectFilterKeys.js +0 -21
- package/internal/parseJSON.js +0 -4
- package/internal/parsePath.js +0 -19
- package/internal/parseRedisConnectionString.js +0 -36
- package/internal/parseRedisConnectionString.test.js +0 -22
- package/internal/pathJoin.js +0 -13
- package/internal/pathResolve.js +0 -13
- package/internal/pathWalk.js +0 -56
- package/internal/pathWalk.test.js +0 -25
- package/internal/replace.js +0 -3
- package/internal/sha256.js +0 -6
- package/internal/sleep.js +0 -14
- package/internal/slice.js +0 -4
- package/internal/split.js +0 -5
- package/internal/startsWith.js +0 -5
- package/internal/streamToString.js +0 -14
- package/internal/stringifyJSON.js +0 -3
- package/internal/toArray.js +0 -13
- package/internal/trim.js +0 -3
- package/media-stream-fixture-aws-keynote.txt +0 -366
- package/teardown.js +0 -42
- package/teardown.test.js +0 -63
- package/test.js +0 -48
package/Archive.js
CHANGED
|
@@ -17,7 +17,7 @@ const pick = require('rubico/pick')
|
|
|
17
17
|
*
|
|
18
18
|
* @synopsis
|
|
19
19
|
* ```coffeescript [specscript]
|
|
20
|
-
* new Archive(base Object<
|
|
20
|
+
* new Archive(base Object<string>) -> archive Archive
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
23
|
const Archive = function (base) {
|
|
@@ -33,9 +33,11 @@ const Archive = function (base) {
|
|
|
33
33
|
*
|
|
34
34
|
* @synopsis
|
|
35
35
|
* ```coffeescript [specscript]
|
|
36
|
-
*
|
|
36
|
+
* module tar 'https://github.com/mafintosh/tar-stream'
|
|
37
|
+
*
|
|
38
|
+
* archive.tar(path string, options {
|
|
37
39
|
* ignore: Array<string>, // paths or names to ignore
|
|
38
|
-
* }) ->
|
|
40
|
+
* }) -> pack tar.Pack
|
|
39
41
|
* ```
|
|
40
42
|
*
|
|
41
43
|
* @description
|
|
@@ -75,15 +77,17 @@ Archive.prototype.tar = function archiveTar(path, options) {
|
|
|
75
77
|
*
|
|
76
78
|
* @synopsis
|
|
77
79
|
* ```coffeescript [specscript]
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
+
* module tar 'https://github.com/mafintosh/tar-stream'
|
|
81
|
+
*
|
|
82
|
+
* archive.untar(
|
|
83
|
+
* pack tar.Pack,
|
|
80
84
|
* options {
|
|
81
85
|
* ignore: Array<string>, // paths or names to ignore
|
|
82
86
|
* },
|
|
83
87
|
* ) -> Map<(header EntryHeader)=>(stream EntryStream)>
|
|
84
88
|
* ```
|
|
85
89
|
*/
|
|
86
|
-
Archive.prototype.untar = function archiveUntar(
|
|
90
|
+
Archive.prototype.untar = function archiveUntar(pack) {
|
|
87
91
|
const extractStream = tar.extract(),
|
|
88
92
|
extracted = new Map()
|
|
89
93
|
return new Promise((resolve, reject) => {
|
|
@@ -94,7 +98,7 @@ Archive.prototype.untar = function archiveUntar(archive) {
|
|
|
94
98
|
})
|
|
95
99
|
extractStream.on('finish', thunkify(resolve, extracted))
|
|
96
100
|
extractStream.on('error', reject)
|
|
97
|
-
|
|
101
|
+
pack.pipe(extractStream)
|
|
98
102
|
})
|
|
99
103
|
}
|
|
100
104
|
|
package/AwsCredentials.js
CHANGED
|
@@ -1,70 +1,68 @@
|
|
|
1
1
|
require('rubico/global')
|
|
2
2
|
const fs = require('fs')
|
|
3
|
-
const
|
|
4
|
-
const pathResolve = require('./internal/pathResolve')
|
|
3
|
+
const resolvePath = require('./internal/resolvePath')
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* @name AwsCredentials
|
|
8
7
|
*
|
|
9
8
|
* @synopsis
|
|
10
9
|
* ```coffeescript [specscript]
|
|
11
|
-
* AwsCredentials(options {
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
10
|
+
* AwsCredentials(profile string, options? {
|
|
11
|
+
* credentialsFileDirname: string
|
|
12
|
+
* credentialsFilename: string,
|
|
13
|
+
* recurse: boolean,
|
|
14
|
+
* }) -> awsCreds Promise<{
|
|
15
15
|
* accessKeyId: string,
|
|
16
16
|
* secretAccessKey: string,
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* AwsCredentials(profile string) -> awsCreds {
|
|
20
|
-
* accessKeyId: string,
|
|
21
|
-
* secretAccessKey: string,
|
|
22
|
-
* }
|
|
17
|
+
* region: string,
|
|
18
|
+
* }>
|
|
23
19
|
* ```
|
|
24
20
|
*/
|
|
25
21
|
|
|
26
|
-
const AwsCredentials = async function (options = {}) {
|
|
27
|
-
if (
|
|
28
|
-
|
|
29
|
-
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
|
30
|
-
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
|
|
31
|
-
}
|
|
32
|
-
if (process.env.AWS_REGION) {
|
|
33
|
-
awsCreds.region = process.env.AWS_REGION
|
|
34
|
-
}
|
|
35
|
-
return awsCreds
|
|
22
|
+
const AwsCredentials = async function (profile, options = {}) {
|
|
23
|
+
if (profile == null) {
|
|
24
|
+
profile = 'default'
|
|
36
25
|
}
|
|
37
26
|
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
let credentialsFileDir =
|
|
43
|
-
options.credentialsFileDir ?? pathResolve(process.cwd())
|
|
27
|
+
const recurse = options.recurse ?? true
|
|
28
|
+
const credentialsFileDirname = options.credentialsFileDirname ?? '.aws'
|
|
29
|
+
const credentialsFilename = options.credentialsFilename ?? 'credentials'
|
|
30
|
+
let credentialsFileDir = resolvePath(process.cwd())
|
|
44
31
|
let lines = ''
|
|
45
|
-
while (credentialsFileDir != '/') {
|
|
32
|
+
while (recurse && credentialsFileDir != '/') {
|
|
46
33
|
const credentialsFilePath =
|
|
47
|
-
|
|
34
|
+
resolvePath(credentialsFileDir, `${credentialsFileDirname}/${credentialsFilename}`)
|
|
48
35
|
if (fs.existsSync(credentialsFilePath)) {
|
|
49
|
-
lines = await (
|
|
50
|
-
|
|
51
|
-
.then(buffer => `${buffer}`.split('\n'))
|
|
52
|
-
)
|
|
36
|
+
lines = await fs.promises.readFile(credentialsFilePath)
|
|
37
|
+
.then(buffer => buffer.toString('utf8').split('\n'))
|
|
53
38
|
break
|
|
54
39
|
}
|
|
55
|
-
credentialsFileDir =
|
|
40
|
+
credentialsFileDir = resolvePath(credentialsFileDir, '..')
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (lines == '') {
|
|
44
|
+
throw new Error('Missing .aws/credentials file')
|
|
56
45
|
}
|
|
57
46
|
|
|
58
47
|
const startingLineNumber = lines.findIndex(line => line == `[${profile}]`)
|
|
59
48
|
|
|
60
|
-
const accessKeyId = lines.find(
|
|
49
|
+
const accessKeyId = startingLineNumber == -1 ? undefined : lines.find(
|
|
61
50
|
(line, index) => index > startingLineNumber
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
51
|
+
&& line.startsWith('aws_access_key_id')
|
|
52
|
+
&& index - startingLineNumber < 3
|
|
53
|
+
)?.split(' = ')[1]
|
|
54
|
+
const secretAccessKey = startingLineNumber == -1 ? undefined : lines.find(
|
|
65
55
|
(line, index) => index > startingLineNumber
|
|
66
|
-
|
|
67
|
-
|
|
56
|
+
&& line.startsWith('aws_secret_access_key')
|
|
57
|
+
&& index - startingLineNumber < 3
|
|
58
|
+
)?.split(' = ')[1]
|
|
59
|
+
|
|
60
|
+
if (accessKeyId == null) {
|
|
61
|
+
throw new Error(`unable to find aws_access_key_id for profile ${profile}`)
|
|
62
|
+
}
|
|
63
|
+
if (secretAccessKey == null) {
|
|
64
|
+
throw new Error(`unable to find aws_secret_access_key for profile ${profile}`)
|
|
65
|
+
}
|
|
68
66
|
|
|
69
67
|
return { accessKeyId, secretAccessKey }
|
|
70
68
|
}
|