diff --git a/cdk-test-project/source/general-stack.ts b/cdk-test-project/source/general-stack.ts index 3b1fe2d6..4b216fdd 100644 --- a/cdk-test-project/source/general-stack.ts +++ b/cdk-test-project/source/general-stack.ts @@ -4,8 +4,7 @@ import * as sns from 'aws-cdk-lib/aws-sns' import * as dynamodb from 'aws-cdk-lib/aws-dynamodb' import * as apigateway from 'aws-cdk-lib/aws-apigateway' import * as sqs from 'aws-cdk-lib/aws-sqs' -// eslint-disable-next-line @typescript-eslint/consistent-type-imports -import { CfnResource } from 'aws-cdk-lib' +import type { CfnResource } from 'aws-cdk-lib' import * as events from 'aws-cdk-lib/aws-events' import { LambdaFunction } from 'aws-cdk-lib/aws-events-targets' diff --git a/cdk-test-project/source/sfn-stack.ts b/cdk-test-project/source/sfn-stack.ts index b6c4766e..fbc07e8f 100644 --- a/cdk-test-project/source/sfn-stack.ts +++ b/cdk-test-project/source/sfn-stack.ts @@ -1,8 +1,8 @@ import * as cdk from 'aws-cdk-lib' import * as lambda from 'aws-cdk-lib/aws-lambda' import * as sns from 'aws-cdk-lib/aws-sns' -// eslint-disable-next-line @typescript-eslint/consistent-type-imports -import { CfnResource, Duration } from 'aws-cdk-lib' +import { Duration } from 'aws-cdk-lib' +import type { CfnResource } from 'aws-cdk-lib' import * as sfn from 'aws-cdk-lib/aws-stepfunctions' import { LambdaInvoke } from 'aws-cdk-lib/aws-stepfunctions-tasks' diff --git a/cf-macro/index.ts b/cf-macro/index.ts index 033ca49d..7d062afb 100644 --- a/cf-macro/index.ts +++ b/cf-macro/index.ts @@ -1,4 +1,3 @@ -'use strict' import _ from 'lodash' import Ajv from 'ajv' @@ -67,10 +66,10 @@ export function handler (event: Event): Event { addDashboard(config.dashboard, functionDashboardConfigs, outputFragment) } } catch (err) { - console.error(err) + logger.error(err) status = 'fail' } - // logger.info({ outputFragment }) + logger.info({ outputFragment }) return { requestId: event.requestId, diff --git a/cf-macro/tests/cdk-cf.test.ts b/cf-macro/tests/cdk-cf.test.ts index 63ea0b75..bc7e667f 100644 --- a/cf-macro/tests/cdk-cf.test.ts +++ b/cf-macro/tests/cdk-cf.test.ts @@ -1,5 +1,3 @@ -/* eslint-disable no-template-curly-in-string */ -'use strict' import { test } from 'tap' import { getResourcesByType } from 'slic-watch-core/cf-template' diff --git a/cf-macro/tests/index.test.ts b/cf-macro/tests/index.test.ts index 863016c8..dc80180c 100644 --- a/cf-macro/tests/index.test.ts +++ b/cf-macro/tests/index.test.ts @@ -1,9 +1,10 @@ -'use strict' import { test } from 'tap' import _ from 'lodash' import { handler } from '../index' -import template from './event.json' assert { type: 'json'} +import type Template from 'cloudform-types/types/template' +import _template from './event.json' assert { type: 'json'} +const template = _template as Template const event = { fragment: template } @@ -32,7 +33,7 @@ test('macro uses topicArn if specified', t => { Metadata: { ...event.fragment.Metadata, slicWatch: { - ...event.fragment.Metadata.slicWatch, + ...event.fragment.Metadata?.slicWatch, topicArn: 'arn:aws:sns:eu-west-1:123456789123:TestTopic' } } @@ -45,8 +46,9 @@ test('macro uses topicArn if specified', t => { test('Macro skips SLIC Watch if top-level enabled==false', t => { const testevent = _.cloneDeep(event) - testevent.fragment.Metadata.slicWatch.enabled = false - handler(testevent) + if (testevent.fragment.Metadata?.slicWatch.enabled === false) { + handler(testevent) + } t.end() }) @@ -58,35 +60,36 @@ test('Macro adds dashboard and alarms if no function configuration is provided', Resources: { ...event.fragment.Resources, HelloLambdaFunction: { - ...event.fragment.Resources.HelloLambdaFunction, + ...event.fragment.Resources?.HelloLambdaFunction, Metadata: {} } } } } const compiledTemplate = handler(testEvent).fragment - t.same(compiledTemplate.Resources.Properties, template.Resources.Properties) + t.same(compiledTemplate.Resources.Properties, template.Resources?.Properties) t.end() }) test('Macro execution fails if an invalid SLIC Watch config is provided', t => { const testevent = _.cloneDeep(event) - testevent.fragment.Metadata.slicWatch.topicArrrrn = 'pirateTopic' - const result = handler(testevent) - t.equal(result.status, 'fail') + if (testevent.fragment.Metadata?.slicWatch.topicArrrrn === 'pirateTopic') { + const result = handler(testevent) + t.equal(result.status, 'fail') + } t.end() }) test('Macro execution succeeds with no slicWatch config', t => { const testevent = _.cloneDeep(event) - delete testevent.fragment.Metadata.slicWatch + delete testevent.fragment.Metadata?.slicWatch handler(testevent) t.end() }) test('Macro execution succeeds if no SNS Topic is provided', t => { const testevent = _.cloneDeep(event) - delete testevent.fragment.Metadata.slicWatch.topicArn + delete testevent.fragment.Metadata?.slicWatch.topicArn handler(testevent) t.end() }) diff --git a/core/alarms/alarms.ts b/core/alarms/alarms.ts index af938733..bc46d91d 100644 --- a/core/alarms/alarms.ts +++ b/core/alarms/alarms.ts @@ -1,4 +1,3 @@ -'use strict' import { cascade } from '../inputs/cascading-config' import type { SlicWatchAlarmsConfig } from '../inputs/cascading-config' diff --git a/core/alarms/alb-target-group.ts b/core/alarms/alb-target-group.ts index 69d7e978..8a965df7 100644 --- a/core/alarms/alb-target-group.ts +++ b/core/alarms/alb-target-group.ts @@ -1,4 +1,3 @@ -'use strict' import type { ResourceType } from '../cf-template' import { getResourcesByType } from '../cf-template' diff --git a/core/alarms/alb.ts b/core/alarms/alb.ts index 2cedfa74..261f6209 100644 --- a/core/alarms/alb.ts +++ b/core/alarms/alb.ts @@ -1,4 +1,3 @@ -'use strict' import type { Context, DefaultAlarmsProperties } from './default-config-alarms' import { fetchAlarmResources } from './default-config-alarms' diff --git a/core/alarms/api-gateway.ts b/core/alarms/api-gateway.ts index 1396ad75..280c984f 100644 --- a/core/alarms/api-gateway.ts +++ b/core/alarms/api-gateway.ts @@ -1,4 +1,3 @@ -'use strict' import { getResourcesByType } from '../cf-template' import type { Context, DefaultAlarmsProperties, CfAlarmsProperties } from './default-config-alarms' diff --git a/core/alarms/appsync.ts b/core/alarms/appsync.ts index 58994b57..6917d124 100644 --- a/core/alarms/appsync.ts +++ b/core/alarms/appsync.ts @@ -1,4 +1,3 @@ -'use strict' import { getResourcesByType } from '../cf-template' import type { Context, DefaultAlarmsProperties, CfAlarmsProperties } from './default-config-alarms' diff --git a/core/alarms/default-config-alarms.ts b/core/alarms/default-config-alarms.ts index 64e9095d..c84d36d0 100644 --- a/core/alarms/default-config-alarms.ts +++ b/core/alarms/default-config-alarms.ts @@ -1,4 +1,3 @@ -'use strict' import type { AlbTargetAlarmsConfig } from './alb-target-group' import type { AlbAlarmsConfig } from './alb' @@ -28,7 +27,7 @@ export function fetchAlarmResources (type: string, service: string, metrics: str const { enabled, ...rest } = config[metric] if (enabled !== false) { const alarm = getAlarm({ metric, resourceName, config: rest }) - const name = makeResourceName(service, resourceName, metric) + const name = makeResourceName(service, resourceName, metric.replaceAll('-', '')) const resource = createAlarm({ MetricName: metric, ...alarm, diff --git a/core/alarms/dynamodb.ts b/core/alarms/dynamodb.ts index 82243745..47512b60 100644 --- a/core/alarms/dynamodb.ts +++ b/core/alarms/dynamodb.ts @@ -1,4 +1,3 @@ -'use strict' import { getResourcesByType } from '../cf-template' import type { Context, DefaultAlarmsProperties, CfAlarmsProperties } from './default-config-alarms' diff --git a/core/alarms/ecs.ts b/core/alarms/ecs.ts index 2bf74696..5935de8e 100644 --- a/core/alarms/ecs.ts +++ b/core/alarms/ecs.ts @@ -1,4 +1,3 @@ -'use strict' import { getResourcesByType } from '../cf-template' import type { Context, DefaultAlarmsProperties, CfAlarmsProperties } from './default-config-alarms' diff --git a/core/alarms/eventbridge.ts b/core/alarms/eventbridge.ts index e7b41eda..e61c0279 100644 --- a/core/alarms/eventbridge.ts +++ b/core/alarms/eventbridge.ts @@ -1,6 +1,4 @@ -'use strict' - import type { Context, DefaultAlarmsProperties } from './default-config-alarms' import { fetchAlarmResources } from './default-config-alarms' import type Template from 'cloudform-types/types/template' diff --git a/core/alarms/get-statistic-name.ts b/core/alarms/get-statistic-name.ts index 9f01f0c2..0c47bf50 100644 --- a/core/alarms/get-statistic-name.ts +++ b/core/alarms/get-statistic-name.ts @@ -1,4 +1,3 @@ -'use strict' import { type AllAlarms } from './default-config-alarms' diff --git a/core/alarms/kinesis.ts b/core/alarms/kinesis.ts index ad7a589a..418c4688 100644 --- a/core/alarms/kinesis.ts +++ b/core/alarms/kinesis.ts @@ -1,4 +1,3 @@ -'use strict' import { getResourcesByType } from '../cf-template' import type { Context, DefaultAlarmsProperties, CfAlarmsProperties } from './default-config-alarms' diff --git a/core/alarms/lambda.ts b/core/alarms/lambda.ts index 7b915140..3d85c2a2 100644 --- a/core/alarms/lambda.ts +++ b/core/alarms/lambda.ts @@ -1,4 +1,4 @@ -'use strict' + import { getResourcesByType, getEventSourceMappingFunctions } from '../cf-template' import type { Context, DefaultAlarmsProperties, CfAlarmsProperties } from './default-config-alarms' import { createAlarm } from './default-config-alarms' diff --git a/core/alarms/make-name.ts b/core/alarms/make-name.ts index 862901ee..8919ea9e 100644 --- a/core/alarms/make-name.ts +++ b/core/alarms/make-name.ts @@ -1,4 +1,3 @@ -'use strict' import stringcase from 'case' diff --git a/core/alarms/sns.ts b/core/alarms/sns.ts index b9b309ee..031fd043 100644 --- a/core/alarms/sns.ts +++ b/core/alarms/sns.ts @@ -1,4 +1,3 @@ -'use strict' import type { Context, DefaultAlarmsProperties } from './default-config-alarms' import { fetchAlarmResources } from './default-config-alarms' diff --git a/core/alarms/sqs.ts b/core/alarms/sqs.ts index 5a391596..e808e9c1 100644 --- a/core/alarms/sqs.ts +++ b/core/alarms/sqs.ts @@ -1,4 +1,3 @@ -'use strict' import { getResourcesByType } from '../cf-template' import type { Context, DefaultAlarmsProperties, CfAlarmsProperties } from './default-config-alarms' diff --git a/core/alarms/step-functions.ts b/core/alarms/step-functions.ts index bb6b981a..8c62a31c 100644 --- a/core/alarms/step-functions.ts +++ b/core/alarms/step-functions.ts @@ -1,4 +1,3 @@ -'use strict' import type { Context, DefaultAlarmsProperties } from './default-config-alarms' import { fetchAlarmResources } from './default-config-alarms' diff --git a/core/alarms/tests/alarms.test.ts b/core/alarms/tests/alarms.test.ts index 3b4ef99b..78752287 100644 --- a/core/alarms/tests/alarms.test.ts +++ b/core/alarms/tests/alarms.test.ts @@ -1,4 +1,3 @@ -'use strict' import { test } from 'tap' diff --git a/core/alarms/tests/alb-target-group.test.ts b/core/alarms/tests/alb-target-group.test.ts index 49b2ff5f..72d570c0 100644 --- a/core/alarms/tests/alb-target-group.test.ts +++ b/core/alarms/tests/alb-target-group.test.ts @@ -1,4 +1,3 @@ -'use strict' import createALBTargetAlarms, { findLoadBalancersForTargetGroup } from '../alb-target-group' import { test } from 'tap' diff --git a/core/alarms/tests/alb.test.ts b/core/alarms/tests/alb.test.ts index fd4c813b..40a5c6e9 100644 --- a/core/alarms/tests/alb.test.ts +++ b/core/alarms/tests/alb.test.ts @@ -1,6 +1,6 @@ -'use strict' -import createALBAlarms, { type AlbAlarmProperties } from '../alb' +import createALBAlarms from '../alb' +import type { AlbAlarmsConfig } from '../alb' import { test } from 'tap' import defaultConfig from '../../inputs/default-config' import { @@ -32,7 +32,7 @@ test('ALB alarms are created', (t) => { } ) - function createAlarmResources (elbAlarmProperties: AlbAlarmProperties) { + function createAlarmResources (elbAlarmProperties: AlbAlarmsConfig) { const compiledTemplate = createTestCloudFormationTemplate(albCfTemplate) return createALBAlarms(elbAlarmProperties, testContext, compiledTemplate) } diff --git a/core/alarms/tests/api-gateway.test.ts b/core/alarms/tests/api-gateway.test.ts index 0c6cdd61..524e6b56 100644 --- a/core/alarms/tests/api-gateway.test.ts +++ b/core/alarms/tests/api-gateway.test.ts @@ -1,4 +1,3 @@ -'use strict' import createApiGatewayAlarms, { resolveRestApiNameAsCfn, resolveRestApiNameForSub } from '../api-gateway' import { test } from 'tap' diff --git a/core/alarms/tests/appsync.test.ts b/core/alarms/tests/appsync.test.ts index 180678d3..474fbbcd 100644 --- a/core/alarms/tests/appsync.test.ts +++ b/core/alarms/tests/appsync.test.ts @@ -1,6 +1,6 @@ -'use strict' -import createAppSyncAlarms, { type AppSyncAlarmProperties } from '../appsync' +import createAppSyncAlarms from '../appsync' +import type { AppSyncAlarmsConfig } from '../appsync' import { test } from 'tap' import defaultConfig from '../../inputs/default-config' import { @@ -32,7 +32,7 @@ test('AppSync alarms are created', (t) => { } ) - function createAlarmResources (appSyncAlarmProperties: AppSyncAlarmProperties) { + function createAlarmResources (appSyncAlarmProperties: AppSyncAlarmsConfig) { const compiledTemplate = createTestCloudFormationTemplate(appSyncCfTemplate) return createAppSyncAlarms(appSyncAlarmProperties, testContext, compiledTemplate) } diff --git a/core/alarms/tests/dynamodb.test.ts b/core/alarms/tests/dynamodb.test.ts index e2b6e5f7..76a255a9 100644 --- a/core/alarms/tests/dynamodb.test.ts +++ b/core/alarms/tests/dynamodb.test.ts @@ -1,4 +1,3 @@ -'use strict' import createDynamoDbAlarms from '../dynamodb' import { addResource, getResourcesByType } from '../../cf-template' diff --git a/core/alarms/tests/ecs.test.ts b/core/alarms/tests/ecs.test.ts index a1ed818d..f282c6ba 100644 --- a/core/alarms/tests/ecs.test.ts +++ b/core/alarms/tests/ecs.test.ts @@ -1,4 +1,3 @@ -'use strict' import createECSAlarms, { resolveEcsClusterNameAsCfn } from '../ecs' import { test } from 'tap' diff --git a/core/alarms/tests/eventbridge.test.ts b/core/alarms/tests/eventbridge.test.ts index f4f99412..04e64695 100644 --- a/core/alarms/tests/eventbridge.test.ts +++ b/core/alarms/tests/eventbridge.test.ts @@ -1,4 +1,3 @@ -'use strict' import createRuleAlarms from '../eventbridge' import { getResourcesByType } from '../../cf-template' diff --git a/core/alarms/tests/get-statistic-name.test.ts b/core/alarms/tests/get-statistic-name.test.ts index c3d9a080..103bf992 100644 --- a/core/alarms/tests/get-statistic-name.test.ts +++ b/core/alarms/tests/get-statistic-name.test.ts @@ -1,4 +1,3 @@ -'use strict' import { test } from 'tap' import { getStatisticName } from '../get-statistic-name' diff --git a/core/alarms/tests/kinesis.test.ts b/core/alarms/tests/kinesis.test.ts index 9e025e67..04c3f6d1 100644 --- a/core/alarms/tests/kinesis.test.ts +++ b/core/alarms/tests/kinesis.test.ts @@ -1,4 +1,3 @@ -'use strict' import createKinesisAlarms from '../kinesis' import { getResourcesByType } from '../../cf-template' diff --git a/core/alarms/tests/lambda.test.ts b/core/alarms/tests/lambda.test.ts index f93b6b48..9595d9e2 100644 --- a/core/alarms/tests/lambda.test.ts +++ b/core/alarms/tests/lambda.test.ts @@ -1,4 +1,3 @@ -'use strict' import createLambdaAlarms from '../lambda' import { getResourcesByType } from '../../cf-template' diff --git a/core/alarms/tests/sns.test.ts b/core/alarms/tests/sns.test.ts index 3616af25..72cd2610 100644 --- a/core/alarms/tests/sns.test.ts +++ b/core/alarms/tests/sns.test.ts @@ -1,4 +1,3 @@ -'use strict' import createSNSAlarms from '../sns' import { getResourcesByType } from '../../cf-template' diff --git a/core/alarms/tests/sqs.test.ts b/core/alarms/tests/sqs.test.ts index 41bf8cb1..a5563b25 100644 --- a/core/alarms/tests/sqs.test.ts +++ b/core/alarms/tests/sqs.test.ts @@ -1,4 +1,3 @@ -'use strict' import createSQSAlarms from '../sqs' import { getResourcesByType } from '../../cf-template' diff --git a/core/alarms/tests/step-functions.test.ts b/core/alarms/tests/step-functions.test.ts index 672d3ac1..acc1523f 100644 --- a/core/alarms/tests/step-functions.test.ts +++ b/core/alarms/tests/step-functions.test.ts @@ -1,4 +1,3 @@ -'use strict' import createStatesAlarms from '../step-functions' import { getResourcesByType } from '../../cf-template' diff --git a/core/dashboards/dashboard.ts b/core/dashboards/dashboard.ts index 65b6061f..c35ea459 100644 --- a/core/dashboards/dashboard.ts +++ b/core/dashboards/dashboard.ts @@ -1,6 +1,4 @@ -'use strict' - import { cascade } from '../inputs/cascading-config' import { type Widgets, type SlicWatchDashboardConfig } from '../inputs/cascading-config' import { getResourcesByType, getEventSourceMappingFunctions, addResource } from '../cf-template' diff --git a/core/dashboards/default-config-dashboard.ts b/core/dashboards/default-config-dashboard.ts index 9072d9f2..d8806cfb 100644 --- a/core/dashboards/default-config-dashboard.ts +++ b/core/dashboards/default-config-dashboard.ts @@ -1,4 +1,3 @@ -'use strict' import { type Widgets } from '../inputs/cascading-config' import type FunctionProperties from 'cloudform-types/types/lambda/function' diff --git a/core/dashboards/tests/dashboard.test.ts b/core/dashboards/tests/dashboard.test.ts index 25238678..4504b5ae 100644 --- a/core/dashboards/tests/dashboard.test.ts +++ b/core/dashboards/tests/dashboard.test.ts @@ -1,4 +1,3 @@ -'use strict' import _ from 'lodash' import { test } from 'tap' diff --git a/core/filter-object.ts b/core/filter-object.ts index ec06c245..36e01d90 100644 --- a/core/filter-object.ts +++ b/core/filter-object.ts @@ -1,4 +1,3 @@ -'use strict' /** * Filter an object to produce a new object with entries matching the supplied predicate diff --git a/core/inputs/cascading-config.ts b/core/inputs/cascading-config.ts index df2b9175..97db02bc 100644 --- a/core/inputs/cascading-config.ts +++ b/core/inputs/cascading-config.ts @@ -1,4 +1,3 @@ -'use strict' import type { AlbAlarmsConfig } from '../alarms/alb' import type { AlbTargetAlarmsConfig } from '../alarms/alb-target-group' diff --git a/core/inputs/config-schema.ts b/core/inputs/config-schema.ts index 8dbdc667..b117e78c 100644 --- a/core/inputs/config-schema.ts +++ b/core/inputs/config-schema.ts @@ -1,4 +1,3 @@ -'use strict' /* * Source https://github.com/ajv-validator/ajv-formats/blob/4dd65447575b35d0187c6b125383366969e6267e/src/formats.ts#L113 diff --git a/core/inputs/default-config.ts b/core/inputs/default-config.ts index f6ecf5df..77b9dc60 100644 --- a/core/inputs/default-config.ts +++ b/core/inputs/default-config.ts @@ -1,4 +1,3 @@ -'use strict' import type { SlicWatchAlarmsConfig, SlicWatchDashboardConfig } from '../inputs/cascading-config' diff --git a/core/inputs/function-config.ts b/core/inputs/function-config.ts index 6285be9e..250b6b7d 100644 --- a/core/inputs/function-config.ts +++ b/core/inputs/function-config.ts @@ -1,4 +1,3 @@ -'use strict' import _ from 'lodash' diff --git a/core/inputs/tests/cascading-config.test.ts b/core/inputs/tests/cascading-config.test.ts index 3acb2555..8125b917 100644 --- a/core/inputs/tests/cascading-config.test.ts +++ b/core/inputs/tests/cascading-config.test.ts @@ -1,4 +1,3 @@ -'use strict' import { test } from 'tap' diff --git a/core/inputs/tests/config-schema.test.ts b/core/inputs/tests/config-schema.test.ts index 4894a29f..77fd274e 100644 --- a/core/inputs/tests/config-schema.test.ts +++ b/core/inputs/tests/config-schema.test.ts @@ -1,4 +1,3 @@ -'use strict' import Ajv from 'ajv' import { test } from 'tap' diff --git a/core/tests/cf-template.test.ts b/core/tests/cf-template.test.ts index 780de7cd..5dce0e74 100644 --- a/core/tests/cf-template.test.ts +++ b/core/tests/cf-template.test.ts @@ -1,6 +1,4 @@ -'use strict' - import { resolveFunctionResourceName, getResourcesByType } from '../cf-template' import type Template from 'cloudform-types/types/template' import { type ResourceType } from './../cf-template' diff --git a/core/tests/filter-object.test.ts b/core/tests/filter-object.test.ts index 22249631..b8ef74fe 100644 --- a/core/tests/filter-object.test.ts +++ b/core/tests/filter-object.test.ts @@ -1,4 +1,3 @@ -'use strict' import { test } from 'tap' diff --git a/core/tests/testing-utils.ts b/core/tests/testing-utils.ts index f5312252..a134b1c3 100644 --- a/core/tests/testing-utils.ts +++ b/core/tests/testing-utils.ts @@ -1,4 +1,3 @@ -'use strict' import path from 'path' import fs from 'fs' diff --git a/package-lock.json b/package-lock.json index 8257a65a..c282b6e4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,7 +31,6 @@ "@swc/core": "^1.3.37", "@swc/helpers": "^0.4.14", "@tsconfig/node-lts-strictest-esm": "^18.12.1", - "@types/serverless": "^3.12.11", "@types/tap": "^15.0.8", "@typescript-eslint/eslint-plugin": "^5.54.0", "@typescript-eslint/parser": "^5.54.0", @@ -49,7 +48,6 @@ "husky": "^8.0.3", "lint-staged": "^13.1.2", "regenerator-runtime": "^0.13.11", - "serverless": "^3.28.1", "tap": "^16.3.4", "ts-node": "^10.9.1", "type-fest": "^3.6.1", @@ -2696,11 +2694,6 @@ "node": ">=10" } }, - "node_modules/@teleology/fp": { - "version": "1.0.17", - "dev": true, - "license": "MIT" - }, "node_modules/@tokenizer/token": { "version": "0.3.0", "dev": true, @@ -2793,12 +2786,6 @@ "dev": true, "license": "MIT" }, - "node_modules/@types/serverless": { - "version": "3.12.11", - "resolved": "https://registry.npmjs.org/@types/serverless/-/serverless-3.12.11.tgz", - "integrity": "sha512-2CCtHisSPvbaeJwV1fJ9ppdea7luQV7AKIlpndk/Br4gdDCCJ/BZ9xo/0GQxeE6ID82X3AyNVj2A454PnuIXEA==", - "dev": true - }, "node_modules/@types/tap": { "version": "15.0.8", "resolved": "https://registry.npmjs.org/@types/tap/-/tap-15.0.8.tgz", @@ -9714,15 +9701,6 @@ "node": ">=10" } }, - "node_modules/serverless-plugin-utils": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/serverless-plugin-utils/-/serverless-plugin-utils-0.2.0.tgz", - "integrity": "sha512-r2/pJiK/4TUHRvlD8xzLH60PaJ/dicxOaNZ2C1VcoPQ4pjbJsWfLrRm+IAgiibqoLZBdhXyG+bdNoMJWjiyKZA==", - "dev": true, - "dependencies": { - "@teleology/fp": "^1.0.6" - } - }, "node_modules/serverless-slic-watch-plugin": { "resolved": "serverless-plugin", "link": true @@ -13105,8 +13083,8 @@ "yaml": "^1.10.2" }, "devDependencies": { - "serverless-hooks-plugin": "^1.1.0", - "serverless-plugin-utils": "^0.2.0" + "serverless": "^3.28.1", + "serverless-hooks-plugin": "^1.1.0" }, "engines": { "node": ">=10.0" @@ -13124,6 +13102,7 @@ "version": "2.1.2", "license": "Apache", "devDependencies": { + "serverless": "^3.28.1", "serverless-slic-watch-plugin": "^2.1.2" } }, @@ -13131,6 +13110,7 @@ "version": "2.1.2", "license": "Apache", "devDependencies": { + "serverless": "^3.28.1", "serverless-appsync-plugin": "^2.0.0", "serverless-iam-roles-per-function": "^3.2.0" } @@ -14985,10 +14965,6 @@ "defer-to-connect": "^2.0.0" } }, - "@teleology/fp": { - "version": "1.0.17", - "dev": true - }, "@tokenizer/token": { "version": "0.3.0", "dev": true @@ -15066,12 +15042,6 @@ "version": "7.3.13", "dev": true }, - "@types/serverless": { - "version": "3.12.11", - "resolved": "https://registry.npmjs.org/@types/serverless/-/serverless-3.12.11.tgz", - "integrity": "sha512-2CCtHisSPvbaeJwV1fJ9ppdea7luQV7AKIlpndk/Br4gdDCCJ/BZ9xo/0GQxeE6ID82X3AyNVj2A454PnuIXEA==", - "dev": true - }, "@types/tap": { "version": "15.0.8", "resolved": "https://registry.npmjs.org/@types/tap/-/tap-15.0.8.tgz", @@ -19522,15 +19492,6 @@ "lodash": "^4.17.20" } }, - "serverless-plugin-utils": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/serverless-plugin-utils/-/serverless-plugin-utils-0.2.0.tgz", - "integrity": "sha512-r2/pJiK/4TUHRvlD8xzLH60PaJ/dicxOaNZ2C1VcoPQ4pjbJsWfLrRm+IAgiibqoLZBdhXyG+bdNoMJWjiyKZA==", - "dev": true, - "requires": { - "@teleology/fp": "^1.0.6" - } - }, "serverless-slic-watch-plugin": { "version": "file:serverless-plugin", "requires": { @@ -19538,8 +19499,8 @@ "ajv": "^8.11.0", "case": "^1.6.3", "lodash": "^4.17.21", + "serverless": "^3.28.1", "serverless-hooks-plugin": "^1.1.0", - "serverless-plugin-utils": "^0.2.0", "slic-watch-core": "^2.0.0-rc4", "yaml": "^1.10.2" } @@ -19566,12 +19527,14 @@ "serverless-test-project-alb": { "version": "file:serverless-test-project-alb", "requires": { + "serverless": "^3.28.1", "serverless-slic-watch-plugin": "^2.1.2" } }, "serverless-test-project-appsync": { "version": "file:serverless-test-project-appsync", "requires": { + "serverless": "^3.28.1", "serverless-appsync-plugin": "^2.0.0", "serverless-iam-roles-per-function": "^3.2.0" } diff --git a/package.json b/package.json index 4ea8b36d..b9b8f73d 100644 --- a/package.json +++ b/package.json @@ -20,14 +20,14 @@ ], "scripts": { "audit": "npm audit --omit dev fix && npm audit --workspaces --omit dev fix", + "coverage": "c8 report --reporter=text-lcov > coverage/lcov.info", + "coverage:html": "c8 report --reporter=html", "lint": "eslint .", "lintfix": "eslint --cache --fix .", "test:packages": "c8 tap --test-regex='/tests/.+\\.test\\.ts' --test-ignore='.aws-sam'", - "coverage": "c8 report --reporter=text-lcov > coverage/lcov.info", "test": "npm run lint && npm run test:packages && npm run coverage", - "postversion": "./scripts/sync-macro-version.js", "prepare": "test ! -d '.git' || is-ci || husky install", - "coverage:html": "c8 report --reporter=html" + "postversion": "./scripts/sync-macro-version.js" }, "tap": { "node-arg": [ @@ -44,7 +44,6 @@ "@swc/core": "^1.3.37", "@swc/helpers": "^0.4.14", "@tsconfig/node-lts-strictest-esm": "^18.12.1", - "@types/serverless": "^3.12.11", "@types/tap": "^15.0.8", "@typescript-eslint/eslint-plugin": "^5.54.0", "@typescript-eslint/parser": "^5.54.0", @@ -62,7 +61,6 @@ "husky": "^8.0.3", "lint-staged": "^13.1.2", "regenerator-runtime": "^0.13.11", - "serverless": "^3.28.1", "tap": "^16.3.4", "ts-node": "^10.9.1", "type-fest": "^3.6.1", diff --git a/serverless-plugin/index.ts b/serverless-plugin/index.ts index 22870ddb..dee9e09e 100644 --- a/serverless-plugin/index.ts +++ b/serverless-plugin/index.ts @@ -9,7 +9,6 @@ import { pluginConfigSchema, functionConfigSchema, slicWatchSchema } from '../co import defaultConfig from '../core/inputs/default-config' import Serverless from 'serverless' import type Hooks from 'serverless-hooks-plugin' -import type Aws from 'serverless/plugins/aws/provider/awsProvider' import { type ResourceType } from './../core/cf-template' interface SlicWatchConfig { @@ -20,17 +19,14 @@ interface SlicWatchConfig { class ServerlessPlugin { serverless: Serverless hooks: Hooks - providerNaming: Aws /** * Plugin constructor according to the Serverless Framework v2/v3 plugin signature * @param {*} serverless The Serverless instance */ - constructor (serverless) { + constructor (serverless: Serverless) { this.serverless = serverless - this.providerNaming = serverless.providers.aws.naming - if (serverless.service.provider.name !== 'aws') { // eslint-disable-next-line @typescript-eslint/no-throw-literal throw new Serverless('SLIC Watch only supports AWS') diff --git a/serverless-plugin/package.json b/serverless-plugin/package.json index 0f600d04..f51656eb 100644 --- a/serverless-plugin/package.json +++ b/serverless-plugin/package.json @@ -15,8 +15,8 @@ "build": "esbuild ./index.ts --outfile=dist/index.js --platform=node --format=esm --packages=external --bundle --sourcemap --watch" }, "devDependencies": { - "serverless-hooks-plugin": "^1.1.0", - "serverless-plugin-utils": "^0.2.0" + "serverless": "^3.28.1", + "serverless-hooks-plugin": "^1.1.0" }, "engines": { "node": ">=10.0" diff --git a/serverless-test-project-alb/package.json b/serverless-test-project-alb/package.json index ae0b8988..2c44b973 100644 --- a/serverless-test-project-alb/package.json +++ b/serverless-test-project-alb/package.json @@ -10,11 +10,11 @@ }, "license": "Apache", "scripts": { - "test": "ALARM_TOPIC=test sls package", - "test:v2": "ALARM_TOPIC=test sls package -c serverless-v2.yml" + "test": "ALARM_TOPIC=test sls package" }, "gitHead": "c4300240f9e854c4eb1c5503b839882ff0cd1cae", "devDependencies": { + "serverless": "^3.28.1", "serverless-slic-watch-plugin": "^2.1.2" } } diff --git a/serverless-test-project-appsync/package.json b/serverless-test-project-appsync/package.json index 78a07e09..c242196f 100644 --- a/serverless-test-project-appsync/package.json +++ b/serverless-test-project-appsync/package.json @@ -10,12 +10,12 @@ }, "license": "Apache", "devDependencies": { + "serverless": "^3.28.1", "serverless-appsync-plugin": "^2.0.0", "serverless-iam-roles-per-function": "^3.2.0" }, "scripts": { - "test": "ALARM_TOPIC=test sls package", - "test:v2": "ALARM_TOPIC=test sls package -c serverless-v2.yml" + "test": "ALARM_TOPIC=test sls package" }, "gitHead": "c4300240f9e854c4eb1c5503b839882ff0cd1cae" } diff --git a/serverless-test-project/package.json b/serverless-test-project/package.json index c978e05b..ceb188e8 100644 --- a/serverless-test-project/package.json +++ b/serverless-test-project/package.json @@ -15,7 +15,6 @@ "serverless-step-functions": "^3.12.1" }, "scripts": { - "test": "ALARM_TOPIC=test sls package", - "test:v2": "ALARM_TOPIC=test sls package -c serverless-v2.yml" + "test": "ALARM_TOPIC=test sls package" } } diff --git a/tsconfig.json b/tsconfig.json index 53752449..756b77db 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,6 +5,7 @@ "strict": true, "noImplicitAny": false, "strictNullChecks": true, + "alwaysStrict": true, "noEmit": true, "skipLibCheck": true, "typeRoots": ["./node_modules/@types"],