@hazeljs/serverless 0.7.9 → 0.8.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.
Files changed (2) hide show
  1. package/README.md +28 -20
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -46,12 +46,12 @@ import { AppModule } from './app.module';
46
46
  export const handler = createLambdaHandler(AppModule, {
47
47
  // Enable binary response
48
48
  binaryMimeTypes: ['image/*', 'application/pdf'],
49
-
49
+
50
50
  // Custom initialization
51
51
  onInit: async (app) => {
52
52
  console.log('Lambda initialized');
53
53
  },
54
-
54
+
55
55
  // Custom error handling
56
56
  onError: (error) => {
57
57
  console.error('Lambda error:', error);
@@ -159,7 +159,7 @@ export const hazelApp = createCloudFunctionHandler(AppModule, {
159
159
  onInit: async (app) => {
160
160
  console.log('Cloud Function initialized');
161
161
  },
162
-
162
+
163
163
  // Custom error handling
164
164
  onError: (error) => {
165
165
  console.error('Cloud Function error:', error);
@@ -311,7 +311,7 @@ import { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda';
311
311
  @Get('/lambda-info')
312
312
  getLambdaInfo(@Req() req: any) {
313
313
  const event: APIGatewayProxyEvent = req.apiGateway.event;
314
-
314
+
315
315
  return {
316
316
  requestId: event.requestContext.requestId,
317
317
  sourceIp: event.requestContext.identity.sourceIp,
@@ -395,14 +395,18 @@ import { CloudWatch } from 'aws-sdk';
395
395
  const cloudwatch = new CloudWatch();
396
396
 
397
397
  async function recordMetric(name: string, value: number) {
398
- await cloudwatch.putMetricData({
399
- Namespace: 'HazelJS',
400
- MetricData: [{
401
- MetricName: name,
402
- Value: value,
403
- Unit: 'Count',
404
- }],
405
- }).promise();
398
+ await cloudwatch
399
+ .putMetricData({
400
+ Namespace: 'HazelJS',
401
+ MetricData: [
402
+ {
403
+ MetricName: name,
404
+ Value: value,
405
+ Unit: 'Count',
406
+ },
407
+ ],
408
+ })
409
+ .promise();
406
410
  }
407
411
  ```
408
412
 
@@ -422,15 +426,19 @@ const monitoring = new Monitoring.MetricServiceClient();
422
426
  async function recordMetric(name: string, value: number) {
423
427
  const request = {
424
428
  name: monitoring.projectPath(projectId),
425
- timeSeries: [{
426
- metric: { type: `custom.googleapis.com/${name}` },
427
- points: [{
428
- interval: { endTime: { seconds: Date.now() / 1000 } },
429
- value: { doubleValue: value },
430
- }],
431
- }],
429
+ timeSeries: [
430
+ {
431
+ metric: { type: `custom.googleapis.com/${name}` },
432
+ points: [
433
+ {
434
+ interval: { endTime: { seconds: Date.now() / 1000 } },
435
+ value: { doubleValue: value },
436
+ },
437
+ ],
438
+ },
439
+ ],
432
440
  };
433
-
441
+
434
442
  await monitoring.createTimeSeries(request);
435
443
  }
436
444
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hazeljs/serverless",
3
- "version": "0.7.9",
3
+ "version": "0.8.0",
4
4
  "description": "Serverless adapters (AWS Lambda, Google Cloud Functions) for HazelJS framework",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -48,5 +48,5 @@
48
48
  "peerDependencies": {
49
49
  "@hazeljs/core": ">=0.2.0-beta.0"
50
50
  },
51
- "gitHead": "28c21c509aeca3bf2d0878fbee737d906b654c67"
51
+ "gitHead": "e0ed98ca074dd4f7472816d3c32ef576900dcca6"
52
52
  }