@kirkelliott/zap 0.1.1 → 0.1.3
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/dist/cli.js +10 -0
- package/dist/init.js +5 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -141,4 +141,14 @@ program
|
|
|
141
141
|
return console.log('no handlers deployed');
|
|
142
142
|
handlers.forEach(o => console.log(o.Key.replace(/\.zap$/, '')));
|
|
143
143
|
});
|
|
144
|
+
program
|
|
145
|
+
.command('demo')
|
|
146
|
+
.description('deploy the built-in demo handlers')
|
|
147
|
+
.option('-b, --bucket <bucket>', 'S3 bucket (or set ZAP_BUCKET)')
|
|
148
|
+
.action(async (opts) => {
|
|
149
|
+
const b = bucket(opts);
|
|
150
|
+
const demoDir = (0, node_path_1.resolve)(__dirname, '..', 'demo');
|
|
151
|
+
const files = await walkZap(demoDir, 'demo');
|
|
152
|
+
await Promise.all(files.map(({ filePath, key }) => deployFile(b, filePath, key)));
|
|
153
|
+
});
|
|
144
154
|
program.parse();
|
package/dist/init.js
CHANGED
|
@@ -134,6 +134,11 @@ async function init(region) {
|
|
|
134
134
|
let url;
|
|
135
135
|
try {
|
|
136
136
|
const { FunctionUrl } = await lambda.send(new client_lambda_1.GetFunctionUrlConfigCommand({ FunctionName: FUNCTION }));
|
|
137
|
+
await lambda.send(new client_lambda_1.UpdateFunctionUrlConfigCommand({ FunctionName: FUNCTION, AuthType: 'NONE', Cors: { AllowOrigins: ['*'], AllowMethods: ['*'], AllowHeaders: ['*'] } }));
|
|
138
|
+
try {
|
|
139
|
+
await lambda.send(new client_lambda_1.AddPermissionCommand({ FunctionName: FUNCTION, StatementId: 'public-access', Action: 'lambda:InvokeFunctionUrl', Principal: '*', FunctionUrlAuthType: 'NONE' }));
|
|
140
|
+
}
|
|
141
|
+
catch { }
|
|
137
142
|
url = FunctionUrl;
|
|
138
143
|
}
|
|
139
144
|
catch (err) {
|