@mapbox/cloudfriend
Advanced tools
Comparing version 4.1.0 to 4.1.1
@@ -0,1 +1,5 @@ | ||
# v4.1.1 | ||
- Bugfixes for Glue shortcuts | ||
# v4.1.0 | ||
@@ -2,0 +6,0 @@ |
@@ -34,3 +34,3 @@ 'use strict'; | ||
* @param {Array<Object>} [options.SortColumns=undefined] list specifying the sort order. See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-storagedescriptor.html#cfn-glue-table-storagedescriptor-sortcolumns) | ||
* @param {Boolean} [options.StoredAsSubdirectories=true] See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-storagedescriptor.html#cfn-glue-table-storagedescriptor-storedasdubdirectories) | ||
* @param {Boolean} [options.StoredAsSubDirectories=true] See [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-glue-table-storagedescriptor.html#cfn-glue-table-storagedescriptor-storedasdubdirectories) | ||
* @param {String} [options.Condition=undefined] if there is a Condition defined | ||
@@ -83,3 +83,3 @@ * in the template that should control whether or not to create this database, | ||
SortColumns, | ||
StoredAsSubdirectories = true, | ||
StoredAsSubDirectories = true, | ||
Condition, | ||
@@ -122,3 +122,3 @@ DependsOn | ||
SortColumns, | ||
StoredAsSubdirectories | ||
StoredAsSubDirectories | ||
} | ||
@@ -125,0 +125,0 @@ } |
@@ -17,11 +17,10 @@ 'use strict'; | ||
constructor(options = {}) { | ||
let { Parameters } = options; | ||
let { Parameters, SqlVariables = {} } = options; | ||
const { | ||
Columns, | ||
DatabaseName: schema, | ||
OriginalSql: originalSql, | ||
SqlVariables = {} | ||
DatabaseName, | ||
OriginalSql: originalSql | ||
} = options; | ||
const required = [schema, Columns, originalSql]; | ||
const required = [DatabaseName, Columns, originalSql]; | ||
if (required.some((variable) => !variable)) | ||
@@ -39,2 +38,3 @@ throw new Error( | ||
); | ||
SqlVariables = Object.assign({ DatabaseName }, SqlVariables); | ||
@@ -51,3 +51,3 @@ const columns = Columns.map((c) => ({ | ||
catalog: 'awsdatacatalog', | ||
schema, | ||
schema: '${DatabaseName}', | ||
originalSql, | ||
@@ -54,0 +54,0 @@ columns |
{ | ||
"name": "@mapbox/cloudfriend", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"description": "Helper functions for assembling CloudFormation templates in JavaScript", | ||
@@ -41,2 +41,3 @@ "main": "index.js", | ||
"opener": "^1.4.1", | ||
"p-queue": "^6.3.0", | ||
"tape": "^4.6.0" | ||
@@ -43,0 +44,0 @@ }, |
@@ -16,4 +16,4 @@ { | ||
"Name": "my_database", | ||
"Description": { | ||
"Fn::Sub": "Created by the {$AWS::StackName} CloudFormation stack" | ||
"Description": { | ||
"Fn::Sub": "Created by the {$AWS::StackName} CloudFormation stack" | ||
} | ||
@@ -25,2 +25,2 @@ } | ||
"Outputs": {} | ||
} | ||
} |
@@ -34,3 +34,3 @@ { | ||
}, | ||
"StoredAsSubdirectories": true | ||
"StoredAsSubDirectories": true | ||
} | ||
@@ -37,0 +37,0 @@ } |
@@ -58,3 +58,3 @@ { | ||
], | ||
"StoredAsSubdirectories": true | ||
"StoredAsSubDirectories": true | ||
} | ||
@@ -61,0 +61,0 @@ } |
@@ -34,3 +34,3 @@ { | ||
}, | ||
"StoredAsSubdirectories": true | ||
"StoredAsSubDirectories": true | ||
} | ||
@@ -37,0 +37,0 @@ } |
@@ -58,3 +58,3 @@ { | ||
], | ||
"StoredAsSubdirectories": true | ||
"StoredAsSubDirectories": true | ||
} | ||
@@ -61,0 +61,0 @@ } |
@@ -26,3 +26,3 @@ { | ||
"SerdeInfo": {}, | ||
"StoredAsSubdirectories": true | ||
"StoredAsSubDirectories": true | ||
} | ||
@@ -29,0 +29,0 @@ } |
@@ -58,3 +58,3 @@ { | ||
], | ||
"StoredAsSubdirectories": true | ||
"StoredAsSubDirectories": true | ||
} | ||
@@ -61,0 +61,0 @@ } |
@@ -34,4 +34,6 @@ { | ||
"Fn::Sub": [ | ||
"{\"catalog\":\"awsdatacatalog\",\"schema\":\"my_database\",\"originalSql\":\"SELECT * FROM another.table\",\"columns\":[{\"name\":\"column\",\"type\":\"varchar\"}]}", | ||
{} | ||
"{\"catalog\":\"awsdatacatalog\",\"schema\":\"${DatabaseName}\",\"originalSql\":\"SELECT * FROM another.table\",\"columns\":[{\"name\":\"column\",\"type\":\"varchar\"}]}", | ||
{ | ||
"DatabaseName": "my_database" | ||
} | ||
] | ||
@@ -48,3 +50,3 @@ } | ||
"SerdeInfo": {}, | ||
"StoredAsSubdirectories": true | ||
"StoredAsSubDirectories": false | ||
} | ||
@@ -51,0 +53,0 @@ } |
@@ -43,4 +43,5 @@ { | ||
"Fn::Sub": [ | ||
"{\"catalog\":\"awsdatacatalog\",\"schema\":\"my_database\",\"originalSql\":\"SELECT * FROM another.table\",\"columns\":[{\"name\":\"column\",\"type\":\"varchar\"}]}", | ||
"{\"catalog\":\"awsdatacatalog\",\"schema\":\"${DatabaseName}\",\"originalSql\":\"SELECT * FROM another.table\",\"columns\":[{\"name\":\"column\",\"type\":\"varchar\"}]}", | ||
{ | ||
"DatabaseName": "my_database", | ||
"env": { | ||
@@ -77,3 +78,3 @@ "Ref": "AWS::StackName" | ||
], | ||
"StoredAsSubdirectories": true | ||
"StoredAsSubDirectories": false | ||
} | ||
@@ -80,0 +81,0 @@ } |
@@ -8,2 +8,4 @@ 'use strict'; | ||
const fixtures = require('./fixtures/shortcuts'); | ||
const util = require('util'); | ||
const sleep = util.promisify(setTimeout); | ||
@@ -15,18 +17,14 @@ const update = !!process.env.UPDATE; | ||
test('[shortcuts] fixture validation', async (assert) => { | ||
const validations = fs | ||
const toValidate = fs | ||
.readdirSync(path.join(__dirname, 'fixtures', 'shortcuts')) | ||
.filter((filename) => path.extname(filename) === '.json') | ||
.map((filename) => { | ||
return cf | ||
.validate(path.join(__dirname, 'fixtures', 'shortcuts', filename)) | ||
.catch((err) => | ||
assert.fail(`${filename} fixture fails validation: ${err.message}`) | ||
) | ||
.then(() => assert.pass(`${filename} fixture passed validation`)); | ||
}); | ||
.filter((filename) => path.extname(filename) === '.json'); | ||
try { | ||
await Promise.all(validations); | ||
} catch (err) { | ||
assert.ifError(err, 'test failure'); | ||
while (toValidate.length) { | ||
const filename = toValidate.shift(); | ||
await Promise.all([ | ||
cf.validate(path.join(__dirname, 'fixtures', 'shortcuts', filename)) | ||
.then(() => assert.pass(`${filename} fixture passed validation`)) | ||
.catch((err) => assert.fail(`${filename} fixture fails validation: ${err.message}`)), | ||
sleep(1000) | ||
]); | ||
} | ||
@@ -33,0 +31,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
421714
8