@kirkelliott/zap 0.1.5 → 0.1.6
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 +19 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
};
|
|
35
35
|
})();
|
|
36
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
const client_lambda_1 = require("@aws-sdk/client-lambda");
|
|
37
38
|
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
38
39
|
const commander_1 = require("commander");
|
|
39
40
|
const promises_1 = require("node:fs/promises");
|
|
@@ -151,4 +152,22 @@ program
|
|
|
151
152
|
const files = await walkZap(demoDir, 'demo');
|
|
152
153
|
await Promise.all(files.map(({ filePath, key }) => deployFile(b, filePath, key)));
|
|
153
154
|
});
|
|
155
|
+
program
|
|
156
|
+
.command('repair')
|
|
157
|
+
.description('re-apply Lambda Function URL public access permissions')
|
|
158
|
+
.action(async () => {
|
|
159
|
+
const cfg = readConfig();
|
|
160
|
+
const region = cfg.region ?? 'us-east-1';
|
|
161
|
+
const fn = cfg.functionArn ?? cfg.function ?? 'zap-runtime';
|
|
162
|
+
const lambda = new client_lambda_1.LambdaClient({ region });
|
|
163
|
+
await lambda.send(new client_lambda_1.UpdateFunctionUrlConfigCommand({ FunctionName: fn, AuthType: 'NONE', Cors: { AllowOrigins: ['*'], AllowMethods: ['*'], AllowHeaders: ['*'] } }));
|
|
164
|
+
try {
|
|
165
|
+
await lambda.send(new client_lambda_1.RemovePermissionCommand({ FunctionName: fn, StatementId: 'public-access' }));
|
|
166
|
+
}
|
|
167
|
+
catch { }
|
|
168
|
+
await lambda.send(new client_lambda_1.AddPermissionCommand({ FunctionName: fn, StatementId: 'public-access', Action: 'lambda:InvokeFunctionUrl', Principal: '*', FunctionUrlAuthType: 'NONE' }));
|
|
169
|
+
console.log('✓ permissions repaired');
|
|
170
|
+
if (cfg.url)
|
|
171
|
+
console.log(`\n → ${cfg.url.trim()}\n`);
|
|
172
|
+
});
|
|
154
173
|
program.parse();
|