skuba 12.1.0-hoist-less-20250722131939 → 12.1.0-main-20250812041011

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 (81) hide show
  1. package/README.md +1 -2
  2. package/config/tsconfig.json +3 -2
  3. package/lib/cli/build/assets.js +1 -1
  4. package/lib/cli/build/assets.js.map +2 -2
  5. package/lib/cli/build/tsc.d.ts +5 -1
  6. package/lib/cli/build/tsc.js +12 -0
  7. package/lib/cli/build/tsc.js.map +3 -3
  8. package/lib/cli/init/getConfig.js +1 -1
  9. package/lib/cli/init/getConfig.js.map +2 -2
  10. package/lib/cli/lint/internal.js +1 -1
  11. package/lib/cli/lint/internal.js.map +2 -2
  12. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.d.ts +2 -0
  13. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js +35 -0
  14. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/index.js.map +7 -0
  15. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.d.ts +4 -0
  16. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js +162 -0
  17. package/lib/cli/lint/internalLints/upgrade/patches/12.0.2/unhandledRejections.js.map +7 -0
  18. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js +1 -1
  19. package/lib/cli/lint/internalLints/upgrade/patches/8.2.1/upgradeESLint.js.map +2 -2
  20. package/lib/cli/node/index.js +8 -2
  21. package/lib/cli/node/index.js.map +2 -2
  22. package/lib/cli/start/index.js +8 -2
  23. package/lib/cli/start/index.js.map +2 -2
  24. package/lib/cli/test/index.d.ts +1 -1
  25. package/lib/cli/test/index.js +18 -4
  26. package/lib/cli/test/index.js.map +2 -2
  27. package/lib/utils/args.d.ts +2 -0
  28. package/lib/utils/args.js +5 -0
  29. package/lib/utils/args.js.map +2 -2
  30. package/package.json +16 -17
  31. package/template/base/_pnpm-workspace.yaml +1 -0
  32. package/template/base/jest.setup.ts +1 -1
  33. package/template/express-rest-api/.buildkite/pipeline.yml +6 -0
  34. package/template/express-rest-api/.env +1 -1
  35. package/template/express-rest-api/.gantry/dev.yml +5 -1
  36. package/template/express-rest-api/.gantry/prod.yml +5 -1
  37. package/template/express-rest-api/Dockerfile +1 -1
  38. package/template/express-rest-api/README.md +5 -5
  39. package/template/express-rest-api/gantry.apply.yml +17 -1
  40. package/template/express-rest-api/package.json +11 -5
  41. package/template/express-rest-api/src/api/healthCheck.ts +2 -2
  42. package/template/express-rest-api/src/config.ts +7 -7
  43. package/template/express-rest-api/src/framework/logging.ts +11 -7
  44. package/template/express-rest-api/src/framework/metrics.ts +1 -1
  45. package/template/express-rest-api/src/listen.ts +6 -0
  46. package/template/express-rest-api/src/tracing.ts +56 -0
  47. package/template/greeter/README.md +2 -2
  48. package/template/greeter/package.json +2 -2
  49. package/template/koa-rest-api/.buildkite/pipeline.yml +6 -0
  50. package/template/koa-rest-api/.env +1 -1
  51. package/template/koa-rest-api/.gantry/dev.yml +3 -3
  52. package/template/koa-rest-api/.gantry/prod.yml +3 -3
  53. package/template/koa-rest-api/README.md +6 -6
  54. package/template/koa-rest-api/gantry.apply.yml +15 -3
  55. package/template/koa-rest-api/package.json +9 -10
  56. package/template/koa-rest-api/src/api/healthCheck.ts +2 -2
  57. package/template/koa-rest-api/src/config.ts +7 -7
  58. package/template/koa-rest-api/src/framework/logging.ts +12 -8
  59. package/template/koa-rest-api/src/framework/metrics.ts +1 -1
  60. package/template/koa-rest-api/src/framework/server.test.ts +7 -8
  61. package/template/koa-rest-api/src/framework/server.ts +1 -4
  62. package/template/koa-rest-api/src/listen.ts +6 -0
  63. package/template/lambda-sqs-worker-cdk/.buildkite/pipeline.yml +6 -2
  64. package/template/lambda-sqs-worker-cdk/.env +1 -1
  65. package/template/lambda-sqs-worker-cdk/README.md +8 -8
  66. package/template/lambda-sqs-worker-cdk/infra/__snapshots__/appStack.test.ts.snap +50 -10
  67. package/template/lambda-sqs-worker-cdk/infra/appStack.test.ts +5 -8
  68. package/template/lambda-sqs-worker-cdk/infra/appStack.ts +15 -5
  69. package/template/lambda-sqs-worker-cdk/infra/config.ts +30 -18
  70. package/template/lambda-sqs-worker-cdk/infra/index.ts +1 -1
  71. package/template/lambda-sqs-worker-cdk/package.json +7 -7
  72. package/template/lambda-sqs-worker-cdk/src/app.test.ts +91 -51
  73. package/template/lambda-sqs-worker-cdk/src/app.ts +7 -9
  74. package/template/lambda-sqs-worker-cdk/src/config.ts +11 -16
  75. package/template/lambda-sqs-worker-cdk/src/framework/handler.test.ts +10 -5
  76. package/template/lambda-sqs-worker-cdk/src/framework/handler.ts +44 -24
  77. package/template/lambda-sqs-worker-cdk/src/framework/logging.ts +23 -11
  78. package/template/lambda-sqs-worker-cdk/src/framework/metrics.ts +1 -4
  79. package/template/lambda-sqs-worker-cdk/src/testing/handler.ts +4 -1
  80. package/template/oss-npm-package/.github/workflows/release.yml +1 -1
  81. package/template/oss-npm-package/.github/workflows/validate.yml +1 -1
@@ -1,17 +1,22 @@
1
1
  import { AsyncLocalStorage } from 'async_hooks';
2
2
 
3
- import createLogger, { createDestination } from '@seek/logger';
3
+ import { createDestination, createLogger } from '@seek/logger';
4
4
 
5
5
  import { config } from 'src/config.js';
6
6
 
7
- interface LoggerContext {
7
+ interface LambdaContext {
8
8
  awsRequestId: string;
9
9
  }
10
10
 
11
- export const loggerContext = new AsyncLocalStorage<LoggerContext>();
11
+ interface RecordContext {
12
+ sqsMessageId: string;
13
+ }
14
+
15
+ export const lambdaContext = new AsyncLocalStorage<LambdaContext>();
16
+ export const recordContext = new AsyncLocalStorage<RecordContext>();
12
17
 
13
18
  const { destination, stdoutMock } = createDestination({
14
- mock: config.environment === 'test' && {
19
+ mock: config.deployment === 'test' && {
15
20
  redact: ['awsRequestId'],
16
21
  },
17
22
  });
@@ -20,19 +25,26 @@ export { stdoutMock };
20
25
 
21
26
  export const logger = createLogger(
22
27
  {
23
- base: {
24
- environment: config.environment,
25
- version: config.version,
28
+ eeeoh: {
29
+ /**
30
+ * TODO: choose an appropriate Datadog log tier.
31
+ *
32
+ * https://github.com/seek-oss/logger/blob/master/docs/eeeoh.md#datadog-log-tiers
33
+ */
34
+ datadog: 'tin',
35
+ team: '<%- teamName %>',
36
+ use: 'environment',
26
37
  },
27
38
 
28
39
  level: config.logLevel,
29
40
 
30
- mixin: () => ({ ...loggerContext.getStore() }),
31
-
32
- name: config.name,
41
+ mixin: () => ({
42
+ ...lambdaContext.getStore(),
43
+ ...recordContext.getStore(),
44
+ }),
33
45
 
34
46
  transport:
35
- config.environment === 'local' ? { target: 'pino-pretty' } : undefined,
47
+ config.deployment === 'local' ? { target: 'pino-pretty' } : undefined,
36
48
  },
37
49
  destination,
38
50
  );
@@ -7,8 +7,5 @@ const prefix = `${config.name}.`;
7
7
  export const metricsClient = {
8
8
  distribution: (
9
9
  ...[name, ...rest]: Parameters<typeof sendDistributionMetric>
10
- ) =>
11
- config.metrics
12
- ? sendDistributionMetric(`${prefix}${name}`, ...rest)
13
- : undefined,
10
+ ) => sendDistributionMetric(`${prefix}${name}`, ...rest),
14
11
  };
@@ -9,5 +9,8 @@ export const createCtx = () =>
9
9
 
10
10
  export const createSqsEvent = (bodies: string[]) =>
11
11
  ({
12
- Records: bodies.map((body) => ({ body })),
12
+ Records: bodies.map((body) => ({
13
+ body,
14
+ messageId: chance.guid({ version: 4 }),
15
+ })),
13
16
  }) as SQSEvent;
@@ -18,7 +18,7 @@ jobs:
18
18
  timeout-minutes: 20
19
19
  steps:
20
20
  - name: Check out repo
21
- uses: actions/checkout@v4
21
+ uses: actions/checkout@v5
22
22
  with:
23
23
  fetch-depth: 0
24
24
 
@@ -16,7 +16,7 @@ jobs:
16
16
  timeout-minutes: 20
17
17
  steps:
18
18
  - name: Check out repo
19
- uses: actions/checkout@v4
19
+ uses: actions/checkout@v5
20
20
 
21
21
  - name: Set up Node.js
22
22
  uses: actions/setup-node@v4