@friggframework/devtools 2.0.0--canary.654.be44e66.0 → 2.0.0--canary.654.ebad223.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.
@@ -330,31 +330,13 @@ describe('logging (ADR-048)', () => {
330
330
  expect(result.frameworkVersion).toBe('>=3.17.0');
331
331
  });
332
332
 
333
- it('maps logging.level to provider.logs.lambda and sets frameworkVersion >=3.58.0', () => {
333
+ it('validates logging.level but leaves the Lambda log format and frameworkVersion alone by default', () => {
334
334
  const result = build({ level: 'warn' });
335
335
 
336
- expect(result.provider.logs).toEqual({
337
- lambda: {
338
- logFormat: 'JSON',
339
- applicationLogLevel: 'WARN',
340
- systemLogLevel: 'INFO',
341
- },
342
- });
343
- expect(result.provider.logRetentionInDays).toBeUndefined();
344
- expect(result.frameworkVersion).toBe('>=3.58.0');
336
+ expect(result.provider.logs).toBeUndefined();
337
+ expect(result.frameworkVersion).toBe('>=3.17.0');
345
338
  });
346
339
 
347
- it.each(['info', 'INFO', 'Info', 'fatal', 'TRACE'])(
348
- 'accepts level "%s" in any case',
349
- (level) => {
350
- const result = build({ level });
351
-
352
- expect(result.provider.logs.lambda.applicationLogLevel).toBe(
353
- level.toUpperCase()
354
- );
355
- }
356
- );
357
-
358
340
  it.each(['verbose', 'warning', '', 3])('throws on unknown level %p', (level) => {
359
341
  expect(() => build({ level })).toThrow(/logging\.level/);
360
342
  });
@@ -380,10 +362,9 @@ describe('logging (ADR-048)', () => {
380
362
  }
381
363
  );
382
364
 
383
- it('sets both level and retention together', () => {
365
+ it('sets retention when level is also set', () => {
384
366
  const result = build({ level: 'debug', retentionInDays: 14 });
385
367
 
386
- expect(result.provider.logs.lambda.applicationLogLevel).toBe('DEBUG');
387
368
  expect(result.provider.logRetentionInDays).toBe(14);
388
369
  });
389
370
  });
@@ -9,9 +9,10 @@ const RETENTION_DAYS = [
9
9
  // First osls version that compiles provider.logs.lambda into LoggingConfig.
10
10
  const LOGGING_CONFIG_FRAMEWORK_VERSION = '>=3.58.0';
11
11
 
12
- // ADR-048 Open question 3 (Phase 0 spike). Set to false to leave Lambda on
13
- // its default Text format; FRIGG_LOG_LEVEL then filters in process alone.
14
- const EMIT_LAMBDA_JSON_LOGGING_CONFIG = true;
12
+ // ADR-048 Open question 3: off until the Phase 0 spike proves Lambda JSON mode
13
+ // keeps direct fd 1 lines intact. Until then Lambda stays on Text and
14
+ // FRIGG_LOG_LEVEL filters in process.
15
+ const EMIT_LAMBDA_JSON_LOGGING_CONFIG = false;
15
16
 
16
17
  function normalizeLogLevel(level) {
17
18
  const normalized = typeof level === 'string' ? level.toUpperCase() : level;
@@ -37,9 +38,13 @@ function validateRetentionInDays(retentionInDays) {
37
38
  * Returns an empty object when logging is absent (ADR-048 §12: no change).
38
39
  *
39
40
  * @param {Object} [logging] - appDefinition.logging
41
+ * @param {{ lambdaJson?: boolean }} [options]
40
42
  * @returns {{ frameworkVersion?: string, provider?: Object }}
41
43
  */
42
- function buildLoggingProviderConfig(logging) {
44
+ function buildLoggingProviderConfig(
45
+ logging,
46
+ { lambdaJson = EMIT_LAMBDA_JSON_LOGGING_CONFIG } = {}
47
+ ) {
43
48
  if (!logging) return {};
44
49
 
45
50
  const provider = {};
@@ -47,8 +52,8 @@ function buildLoggingProviderConfig(logging) {
47
52
 
48
53
  if (logging.level !== undefined) {
49
54
  const level = normalizeLogLevel(logging.level);
50
- result.frameworkVersion = LOGGING_CONFIG_FRAMEWORK_VERSION;
51
- if (EMIT_LAMBDA_JSON_LOGGING_CONFIG) {
55
+ if (lambdaJson) {
56
+ result.frameworkVersion = LOGGING_CONFIG_FRAMEWORK_VERSION;
52
57
  provider.logs = {
53
58
  lambda: {
54
59
  logFormat: 'JSON',
@@ -0,0 +1,52 @@
1
+ const { buildLoggingProviderConfig } = require('./logging-config');
2
+
3
+ describe('buildLoggingProviderConfig (ADR-048)', () => {
4
+ it('emits no Lambda LoggingConfig and no osls floor by default, until the Phase 0 spike passes', () => {
5
+ const result = buildLoggingProviderConfig({ level: 'warn' });
6
+
7
+ expect(result.provider).toBeUndefined();
8
+ expect(result.frameworkVersion).toBeUndefined();
9
+ });
10
+
11
+ it('still validates the level when the LoggingConfig is off', () => {
12
+ expect(() => buildLoggingProviderConfig({ level: 'verbose' })).toThrow(
13
+ /logging\.level/
14
+ );
15
+ });
16
+
17
+ describe('with lambdaJson', () => {
18
+ const build = (logging) =>
19
+ buildLoggingProviderConfig(logging, { lambdaJson: true });
20
+
21
+ it('maps level to provider.logs.lambda and sets frameworkVersion >=3.58.0', () => {
22
+ expect(build({ level: 'warn' })).toEqual({
23
+ frameworkVersion: '>=3.58.0',
24
+ provider: {
25
+ logs: {
26
+ lambda: {
27
+ logFormat: 'JSON',
28
+ applicationLogLevel: 'WARN',
29
+ systemLogLevel: 'INFO',
30
+ },
31
+ },
32
+ },
33
+ });
34
+ });
35
+
36
+ it.each(['info', 'INFO', 'Info', 'fatal', 'TRACE'])(
37
+ 'accepts level "%s" in any case',
38
+ (level) => {
39
+ expect(
40
+ build({ level }).provider.logs.lambda.applicationLogLevel
41
+ ).toBe(level.toUpperCase());
42
+ }
43
+ );
44
+
45
+ it('sets both level and retention together', () => {
46
+ const result = build({ level: 'debug', retentionInDays: 14 });
47
+
48
+ expect(result.provider.logs.lambda.applicationLogLevel).toBe('DEBUG');
49
+ expect(result.provider.logRetentionInDays).toBe(14);
50
+ });
51
+ });
52
+ });
@@ -239,18 +239,14 @@ describe('composeServerlessDefinition', () => {
239
239
  });
240
240
 
241
241
  describe('Logging (ADR-048)', () => {
242
- it('carries logging into provider.logs, FRIGG_LOG_LEVEL and logRetentionInDays', async () => {
242
+ it('carries logging into FRIGG_LOG_LEVEL and logRetentionInDays, with no Lambda LoggingConfig by default', async () => {
243
243
  const result = await composeServerlessDefinition({
244
244
  integrations: [mockIntegration],
245
245
  logging: { level: 'debug', retentionInDays: 30 },
246
246
  });
247
247
 
248
- expect(result.frameworkVersion).toBe('>=3.58.0');
249
- expect(result.provider.logs.lambda).toEqual({
250
- logFormat: 'JSON',
251
- applicationLogLevel: 'DEBUG',
252
- systemLogLevel: 'INFO',
253
- });
248
+ expect(result.frameworkVersion).toBe('>=3.17.0');
249
+ expect(result.provider.logs).toBeUndefined();
254
250
  expect(result.provider.logRetentionInDays).toBe(30);
255
251
  expect(result.provider.environment.FRIGG_LOG_LEVEL).toBe('DEBUG');
256
252
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@friggframework/devtools",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0--canary.654.be44e66.0",
4
+ "version": "2.0.0--canary.654.ebad223.0",
5
5
  "bin": {
6
6
  "frigg": "./frigg-cli/index.js"
7
7
  },
@@ -26,9 +26,9 @@
26
26
  "@babel/eslint-parser": "^7.18.9",
27
27
  "@babel/parser": "^7.25.3",
28
28
  "@babel/traverse": "^7.25.3",
29
- "@friggframework/core": "2.0.0--canary.654.be44e66.0",
30
- "@friggframework/schemas": "2.0.0--canary.654.be44e66.0",
31
- "@friggframework/test": "2.0.0--canary.654.be44e66.0",
29
+ "@friggframework/core": "2.0.0--canary.654.ebad223.0",
30
+ "@friggframework/schemas": "2.0.0--canary.654.ebad223.0",
31
+ "@friggframework/test": "2.0.0--canary.654.ebad223.0",
32
32
  "@hapi/boom": "^10.0.1",
33
33
  "@inquirer/prompts": "^5.3.8",
34
34
  "axios": "^1.18.0",
@@ -56,8 +56,8 @@
56
56
  "validate-npm-package-name": "^5.0.0"
57
57
  },
58
58
  "devDependencies": {
59
- "@friggframework/eslint-config": "2.0.0--canary.654.be44e66.0",
60
- "@friggframework/prettier-config": "2.0.0--canary.654.be44e66.0",
59
+ "@friggframework/eslint-config": "2.0.0--canary.654.ebad223.0",
60
+ "@friggframework/prettier-config": "2.0.0--canary.654.ebad223.0",
61
61
  "aws-sdk-client-mock": "^4.1.0",
62
62
  "aws-sdk-client-mock-jest": "^4.1.0",
63
63
  "jest": "^30.1.3",
@@ -89,5 +89,5 @@
89
89
  "publishConfig": {
90
90
  "access": "public"
91
91
  },
92
- "gitHead": "be44e66226ec1db051c264a5f8cf02998f3aa14c"
92
+ "gitHead": "ebad2239696f6fbfd7918a327bdbd45c737dc7e0"
93
93
  }