@friggframework/devtools 2.0.0--canary.689.e2b05a4.0 → 2.0.0--canary.704.79d9a63.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 (25) hide show
  1. package/README.md +14 -0
  2. package/frigg-cli/README.md +6 -0
  3. package/frigg-cli/__tests__/unit/dependencies.test.js +3 -5
  4. package/frigg-cli/__tests__/unit/utils/node-version.test.js +66 -0
  5. package/frigg-cli/index.js +3 -0
  6. package/frigg-cli/package.json +3 -3
  7. package/frigg-cli/utils/node-version.js +51 -0
  8. package/infrastructure/README.md +20 -0
  9. package/infrastructure/__tests__/package-patterns-composition.test.js +153 -0
  10. package/infrastructure/domains/admin-scripts/admin-script-builder.js +50 -46
  11. package/infrastructure/domains/admin-scripts/admin-script-builder.test.js +46 -7
  12. package/infrastructure/domains/database/migration-builder.js +182 -175
  13. package/infrastructure/domains/database/migration-builder.test.js +36 -5
  14. package/infrastructure/domains/integration/integration-builder.js +65 -61
  15. package/infrastructure/domains/integration/integration-builder.test.js +73 -8
  16. package/infrastructure/domains/shared/utilities/base-definition-factory.js +76 -122
  17. package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +95 -26
  18. package/infrastructure/domains/shared/utilities/framework-version.js +14 -0
  19. package/infrastructure/domains/shared/utilities/framework-version.test.js +27 -0
  20. package/infrastructure/domains/shared/utilities/logging-config.js +3 -4
  21. package/infrastructure/domains/shared/utilities/logging-config.test.js +1 -2
  22. package/infrastructure/domains/shared/utilities/package-patterns.js +35 -0
  23. package/infrastructure/domains/shared/utilities/package-patterns.test.js +112 -0
  24. package/infrastructure/infrastructure-composer.test.js +3 -3
  25. package/package.json +11 -8
@@ -886,8 +886,8 @@ describe('IntegrationBuilder', () => {
886
886
  const result = await integrationBuilder.build(appDefinition, {});
887
887
 
888
888
  expect(result.functions.testWebhook.package).toBeDefined();
889
- expect(result.functions.testWebhook.package.exclude).toContain('node_modules/aws-sdk/**');
890
- expect(result.functions.testWebhook.package.exclude).toContain('node_modules/@prisma/**');
889
+ expect(result.functions.testWebhook.package.patterns).toContain('!node_modules/aws-sdk/**');
890
+ expect(result.functions.testWebhook.package.patterns).toContain('!node_modules/@prisma/**');
891
891
  });
892
892
  });
893
893
 
@@ -982,8 +982,8 @@ describe('IntegrationBuilder', () => {
982
982
  expect(result.functions.asana.layers).toBeUndefined();
983
983
  expect(result.functions.asanaQueueWorker.layers).toBeUndefined();
984
984
  expect(result.functions.asanaWebhook.layers).toBeUndefined();
985
- expect(result.functions.asana.package.exclude).not.toEqual(
986
- expect.arrayContaining(['node_modules/@prisma/**'])
985
+ expect(result.functions.asana.package.patterns).not.toEqual(
986
+ expect.arrayContaining(['!node_modules/@prisma/**'])
987
987
  );
988
988
  });
989
989
  });
@@ -1091,14 +1091,14 @@ describe('IntegrationBuilder nested node_modules (lambda.keepNestedNodeModules)'
1091
1091
  ...(lambda && { lambda }),
1092
1092
  });
1093
1093
  const packagedFunctions = (result) =>
1094
- Object.values(result.functions).filter((fn) => fn.package?.exclude);
1094
+ Object.values(result.functions).filter((fn) => fn.package?.patterns);
1095
1095
 
1096
1096
  it('excludes every nested node_modules by default', async () => {
1097
1097
  const result = await new IntegrationBuilder().build(appDefinition(), {});
1098
1098
 
1099
1099
  expect(packagedFunctions(result).length).toBeGreaterThan(0);
1100
1100
  for (const fn of packagedFunctions(result)) {
1101
- expect(fn.package.exclude).toContain('node_modules/**/node_modules/**');
1101
+ expect(fn.package.patterns).toContain('!node_modules/**/node_modules/**');
1102
1102
  }
1103
1103
  });
1104
1104
 
@@ -1109,8 +1109,73 @@ describe('IntegrationBuilder nested node_modules (lambda.keepNestedNodeModules)'
1109
1109
  );
1110
1110
 
1111
1111
  for (const fn of packagedFunctions(result)) {
1112
- expect(fn.package.exclude).not.toContain('node_modules/**/node_modules/**');
1113
- expect(fn.package.exclude).toContain('node_modules/**/node_modules/@friggframework/**');
1112
+ expect(fn.package.patterns).not.toContain('!node_modules/**/node_modules/**');
1113
+ expect(fn.package.patterns).toContain('!node_modules/**/node_modules/@friggframework/**');
1114
+ }
1115
+ });
1116
+ });
1117
+
1118
+ describe('IntegrationBuilder function package patterns (ADR-050)', () => {
1119
+ const appDefinition = {
1120
+ integrations: [
1121
+ {
1122
+ Definition: {
1123
+ name: 'hubspot',
1124
+ webhooks: true,
1125
+ extensions: {
1126
+ hubspotWebhooks: {
1127
+ extension: {
1128
+ name: 'hubspot-webhooks',
1129
+ routes: [
1130
+ {
1131
+ path: '/webhooks',
1132
+ method: 'POST',
1133
+ event: 'HUBSPOT_WEBHOOK_RECEIVED',
1134
+ },
1135
+ ],
1136
+ events: {
1137
+ HUBSPOT_WEBHOOK_RECEIVED: {
1138
+ type: 'LIFE_CYCLE_EVENT',
1139
+ handler: () => {},
1140
+ },
1141
+ },
1142
+ },
1143
+ handlers: {},
1144
+ },
1145
+ },
1146
+ },
1147
+ },
1148
+ ],
1149
+ };
1150
+
1151
+ it('emits package.patterns, never include/exclude, on every function it packages', async () => {
1152
+ const result = await new IntegrationBuilder().build(appDefinition, {});
1153
+
1154
+ const expected = [
1155
+ 'hubspot',
1156
+ 'hubspotWebhook',
1157
+ 'hubspot__hubspotWebhooks',
1158
+ 'hubspotQueueWorker',
1159
+ 'dlqProcessor',
1160
+ ];
1161
+ for (const name of expected) {
1162
+ const pkg = result.functions[name]?.package;
1163
+ expect(pkg).toBeDefined();
1164
+ expect(pkg).not.toHaveProperty('include');
1165
+ expect(pkg).not.toHaveProperty('exclude');
1166
+ // Integration functions only exclude, so every pattern is negated.
1167
+ expect(pkg.patterns.length).toBeGreaterThan(0);
1168
+ expect(pkg.patterns.every((p) => p.startsWith('!'))).toBe(true);
1169
+ expect(pkg.patterns).toEqual(
1170
+ expect.arrayContaining([
1171
+ '!node_modules/aws-sdk/**',
1172
+ '!node_modules/@prisma/**',
1173
+ '!node_modules/**/node_modules/**',
1174
+ '!node_modules/osls/**',
1175
+ '!test/**',
1176
+ ])
1177
+ );
1178
+ expect(pkg.patterns).not.toContain('!src/**');
1114
1179
  }
1115
1180
  });
1116
1181
  });
@@ -9,7 +9,9 @@
9
9
 
10
10
  const { buildEnvironment } = require('../environment-builder');
11
11
  const { nestedNodeModulesExcludes } = require('./nested-node-modules');
12
+ const { toPackagePatterns } = require('./package-patterns');
12
13
  const { buildLoggingProviderConfig } = require('./logging-config');
14
+ const { OSLS_FRAMEWORK_VERSION } = require('./framework-version');
13
15
 
14
16
  /**
15
17
  * Create base serverless definition with core functions and resources
@@ -37,143 +39,95 @@ function createBaseDefinition(
37
39
  const loggingConfig = buildLoggingProviderConfig(AppDefinition.logging);
38
40
 
39
41
  // Package config for handlers that skip esbuild (need node_modules dependencies)
40
- // Include backend src/ and index.js since handlers load the app definition
42
+ // Include backend src/ and index.js since handlers load the app definition.
43
+ // osls 4 only reads package.patterns (ADR-050): excludes first, then includes.
41
44
  const skipEsbuildPackageConfig = {
42
- // Explicitly include project files that handlers need
43
- include: [
44
- // Include DocumentDB TLS certificate if configured
45
- ...(AppDefinition.database?.documentDB?.tlsCAFile
46
- ? [AppDefinition.database.documentDB.tlsCAFile.replace(/^\.\//, '')]
47
- : []),
48
- ],
49
- exclude: [
50
- // Exclude Prisma (provided via Lambda Layer)
51
- ...(usePrismaLayer ? [
52
- 'node_modules/@prisma/**',
53
- 'node_modules/.prisma/**',
54
- 'node_modules/prisma/**',
55
- 'node_modules/@friggframework/core/generated/**',
56
- ] : []),
57
-
58
- // Exclude AWS SDK (provided by Lambda runtime)
59
- 'node_modules/aws-sdk/**',
60
- 'node_modules/@aws-sdk/**',
61
-
62
- // Exclude dev/test dependencies
63
- 'node_modules/@friggframework/test/**',
64
- 'node_modules/@friggframework/eslint-config/**',
65
- 'node_modules/@friggframework/prettier-config/**',
66
- 'node_modules/jest/**',
67
- 'node_modules/prettier/**',
68
- 'node_modules/eslint/**',
69
-
70
- ...nestedNodeModulesExcludes(AppDefinition, usePrismaLayer),
71
-
72
- // Exclude build tools (not needed at runtime)
73
- 'node_modules/esbuild/**',
74
- 'node_modules/@esbuild/**',
75
- 'node_modules/typescript/**',
76
- 'node_modules/webpack/**',
77
- 'node_modules/osls/**',
78
- 'node_modules/serverless-esbuild/**',
79
- 'node_modules/serverless-jetpack/**',
80
- 'node_modules/serverless-offline/**',
81
- 'node_modules/serverless-offline-sqs/**',
82
- 'node_modules/serverless-dotenv-plugin/**',
83
- 'node_modules/serverless-kms-grants/**',
84
- // Note: DO NOT exclude serverless-http - it's a runtime dependency!
85
-
86
- // Exclude local dev files and environment files (NEVER deploy .env files!)
87
- '.env',
88
- '.env.*',
89
- '.env.local',
90
- '.env.*.local',
91
- '**/.env',
92
- '**/.env.*',
93
- 'deploy.log',
94
- '.env.backup',
95
- 'docker-compose.yml',
96
- 'jest.config.js',
97
- 'jest.unit.config.js',
98
- '.eslintrc.json',
99
- '.prettierrc',
100
- '.prettierignore',
101
- '.markdownlintignore',
102
- 'package-lock.json',
103
-
104
- // Exclude test files and layers (keep src/ - needed for app definition and integrations)
105
- 'test/**',
106
- 'layers/**',
107
- 'coverage/**',
108
- // Note: DO NOT exclude src/** - handlers need src/integrations and src/api-modules at runtime
109
- '**/*.test.js',
110
- '**/*.spec.js',
111
- '**/.claude-flow/**',
112
- '**/.swarm/**',
113
- ],
114
- };
115
-
116
- // Function-level package config to exclude Prisma and AWS SDK
117
- const functionPackageConfig = {
118
- exclude: [
119
- // Exclude AWS SDK (already in Lambda runtime or externalized by esbuild)
120
- 'node_modules/aws-sdk/**',
121
- 'node_modules/@aws-sdk/**',
45
+ patterns: toPackagePatterns({
46
+ // Explicitly include project files that handlers need
47
+ include: [
48
+ // Include DocumentDB TLS certificate if configured
49
+ ...(AppDefinition.database?.documentDB?.tlsCAFile
50
+ ? [AppDefinition.database.documentDB.tlsCAFile.replace(/^\.\//, '')]
51
+ : []),
52
+ ],
53
+ exclude: [
54
+ // Exclude Prisma (provided via Lambda Layer)
55
+ ...(usePrismaLayer ? [
56
+ 'node_modules/@prisma/**',
57
+ 'node_modules/.prisma/**',
58
+ 'node_modules/prisma/**',
59
+ 'node_modules/@friggframework/core/generated/**',
60
+ ] : []),
122
61
 
123
- // Exclude Prisma (provided via Lambda Layer)
124
- ...(usePrismaLayer ? [
125
- 'node_modules/@prisma/**',
126
- 'node_modules/.prisma/**',
127
- 'node_modules/prisma/**',
128
- 'node_modules/@friggframework/core/generated/**',
129
- ] : []),
62
+ // Exclude AWS SDK (provided by Lambda runtime)
63
+ 'node_modules/aws-sdk/**',
64
+ 'node_modules/@aws-sdk/**',
130
65
 
131
- // Exclude nested node_modules from symlinked frigg packages (for npm link development)
132
- 'node_modules/@friggframework/core/node_modules/**',
133
- 'node_modules/@friggframework/devtools/node_modules/**',
66
+ // Exclude dev/test dependencies
67
+ 'node_modules/@friggframework/test/**',
68
+ 'node_modules/@friggframework/eslint-config/**',
69
+ 'node_modules/@friggframework/prettier-config/**',
70
+ 'node_modules/jest/**',
71
+ 'node_modules/prettier/**',
72
+ 'node_modules/eslint/**',
134
73
 
135
- // Exclude environment files (NEVER deploy .env files!)
136
- '.env',
137
- '.env.*',
138
- '.env.local',
139
- '.env.*.local',
140
- '**/.env',
141
- '**/.env.*',
74
+ ...nestedNodeModulesExcludes(AppDefinition, usePrismaLayer),
142
75
 
143
- // Exclude development/test files from backend project
144
- 'coverage/**',
145
- 'test/**',
146
- 'src/**',
147
- 'layers/**',
148
- '**/*.test.js',
149
- '**/*.spec.js',
150
- '.git/**',
151
- '.github/**',
76
+ // Exclude build tools (not needed at runtime)
77
+ 'node_modules/esbuild/**',
78
+ 'node_modules/@esbuild/**',
79
+ 'node_modules/typescript/**',
80
+ 'node_modules/webpack/**',
81
+ 'node_modules/osls/**',
82
+ 'node_modules/serverless-esbuild/**',
83
+ 'node_modules/serverless-jetpack/**',
84
+ 'node_modules/serverless-offline/**',
85
+ 'node_modules/serverless-offline-sqs/**',
86
+ 'node_modules/serverless-dotenv-plugin/**',
87
+ 'node_modules/serverless-kms-grants/**',
88
+ // Note: DO NOT exclude serverless-http - it's a runtime dependency!
152
89
 
153
- // Exclude AI assistant and development artifacts
154
- '**/.claude-flow/**',
155
- '**/.swarm/**',
156
- '**/CLAUDE.md',
157
- '**/README.md',
158
- '**/*.md',
90
+ // Exclude local dev files and environment files (NEVER deploy .env files!)
91
+ '.env',
92
+ '.env.*',
93
+ '.env.local',
94
+ '.env.*.local',
95
+ '**/.env',
96
+ '**/.env.*',
97
+ 'deploy.log',
98
+ '.env.backup',
99
+ 'docker-compose.yml',
100
+ 'jest.config.js',
101
+ 'jest.unit.config.js',
102
+ '.eslintrc.json',
103
+ '.prettierrc',
104
+ '.prettierignore',
105
+ '.markdownlintignore',
106
+ 'package-lock.json',
159
107
 
160
- // Exclude config and meta files from core
161
- 'node_modules/@friggframework/core/.eslintrc.json',
162
- 'node_modules/@friggframework/core/.gitignore',
163
- 'node_modules/@friggframework/core/jest.config.js',
164
- 'node_modules/@friggframework/core/CHANGELOG.md',
165
- ],
108
+ // Exclude test files and layers (keep src/ - needed for app definition and integrations)
109
+ 'test/**',
110
+ 'layers/**',
111
+ 'coverage/**',
112
+ // Note: DO NOT exclude src/** - handlers need src/integrations and src/api-modules at runtime
113
+ '**/*.test.js',
114
+ '**/*.spec.js',
115
+ '**/.claude-flow/**',
116
+ '**/.swarm/**',
117
+ ],
118
+ }),
166
119
  };
167
120
 
168
121
  return {
169
- frameworkVersion: loggingConfig.frameworkVersion || '>=3.17.0',
122
+ frameworkVersion: OSLS_FRAMEWORK_VERSION,
170
123
  service: AppDefinition.name || 'create-frigg-app',
171
124
  package: {
172
125
  individually: true,
173
126
  },
174
127
  // Only use .env for local development (offline mode)
175
- // Production deployments should use environment vars from infrastructure
176
- useDotenv: process.argv.includes('offline'),
128
+ // Production deployments should use environment vars from infrastructure.
129
+ // Emitted only when true: osls 4 accepts `useDotenv: true` or no key (ADR-050).
130
+ ...(process.argv.includes('offline') && { useDotenv: true }),
177
131
  provider: {
178
132
  name: AppDefinition.provider || 'aws',
179
133
  ...(process.env.AWS_PROFILE && { profile: process.env.AWS_PROFILE }),
@@ -5,6 +5,7 @@
5
5
  */
6
6
 
7
7
  const { createBaseDefinition } = require('./base-definition-factory');
8
+ const { OSLS_FRAMEWORK_VERSION } = require('./framework-version');
8
9
 
9
10
  describe('Base Definition Factory', () => {
10
11
  beforeEach(() => {
@@ -23,7 +24,7 @@ describe('Base Definition Factory', () => {
23
24
  const result = createBaseDefinition(appDefinition, appEnvironmentVars, discoveredResources);
24
25
 
25
26
  expect(result.service).toBe('test-app');
26
- expect(result.frameworkVersion).toBe('>=3.17.0');
27
+ expect(result.frameworkVersion).toBe(OSLS_FRAMEWORK_VERSION);
27
28
  expect(result.provider.name).toBe('aws');
28
29
  expect(result.provider.runtime).toBe('nodejs22.x');
29
30
  expect(result.provider.timeout).toBe(29);
@@ -236,12 +237,75 @@ describe('Base Definition Factory', () => {
236
237
  expect(result.package.individually).toBe(true);
237
238
  });
238
239
 
239
- it('should enable dotenv only in offline mode', () => {
240
- const result = createBaseDefinition({}, {}, {});
240
+ describe('useDotenv (ADR-050)', () => {
241
+ const originalArgv = process.argv;
242
+ afterEach(() => {
243
+ process.argv = originalArgv;
244
+ });
245
+
246
+ it.each([['package'], ['deploy'], ['print']])(
247
+ 'omits useDotenv for `osls %s` (osls 4 only accepts true)',
248
+ (command) => {
249
+ process.argv = ['node', 'osls', command, '--stage', 'prod'];
250
+ const result = createBaseDefinition({}, {}, {});
251
+
252
+ expect(result).not.toHaveProperty('useDotenv');
253
+ expect(result.plugins).not.toContain('serverless-dotenv-plugin');
254
+ }
255
+ );
256
+
257
+ it('sets useDotenv: true for `osls offline`', () => {
258
+ process.argv = ['node', 'osls', 'offline', '--stage', 'dev'];
259
+ const result = createBaseDefinition({}, {}, {});
241
260
 
242
- // useDotenv is conditional - only true when process.argv includes 'offline'
243
- expect(result.useDotenv).toBeDefined();
244
- expect(typeof result.useDotenv).toBe('boolean');
261
+ expect(result.useDotenv).toBe(true);
262
+ expect(result.plugins).toContain('serverless-dotenv-plugin');
263
+ });
264
+ });
265
+
266
+ describe('function package patterns (ADR-050)', () => {
267
+ it('emits package.patterns and no include/exclude on auth, user and health', () => {
268
+ const result = createBaseDefinition({}, {}, {});
269
+
270
+ for (const fn of ['auth', 'user', 'health']) {
271
+ const pkg = result.functions[fn].package;
272
+ expect(pkg).not.toHaveProperty('include');
273
+ expect(pkg).not.toHaveProperty('exclude');
274
+ expect(Array.isArray(pkg.patterns)).toBe(true);
275
+ expect(pkg.patterns).toEqual(
276
+ expect.arrayContaining([
277
+ '!node_modules/aws-sdk/**',
278
+ '!node_modules/@aws-sdk/**',
279
+ '!.env',
280
+ '!**/.env.*',
281
+ '!package-lock.json',
282
+ '!test/**',
283
+ '!layers/**',
284
+ ])
285
+ );
286
+ // No exclude pattern removes src/: handlers load the app definition from it.
287
+ expect(pkg.patterns).not.toContain('!src/**');
288
+ }
289
+ });
290
+
291
+ it('puts the DocumentDB CA file after every exclude so it is re-added', () => {
292
+ const result = createBaseDefinition(
293
+ { database: { documentDB: { tlsCAFile: './certs/global-bundle.pem' } } },
294
+ {},
295
+ {}
296
+ );
297
+ const { patterns } = result.functions.auth.package;
298
+
299
+ expect(patterns[patterns.length - 1]).toBe('certs/global-bundle.pem');
300
+ expect(patterns.slice(0, -1).every((p) => p.startsWith('!'))).toBe(true);
301
+ });
302
+
303
+ it('emits only negated excludes when no CA file is configured', () => {
304
+ const result = createBaseDefinition({}, {}, {});
305
+ expect(
306
+ result.functions.auth.package.patterns.every((p) => p.startsWith('!'))
307
+ ).toBe(true);
308
+ });
245
309
  });
246
310
 
247
311
  describe('usePrismaLayer configuration', () => {
@@ -250,12 +314,12 @@ describe('Base Definition Factory', () => {
250
314
 
251
315
  expect(result.layers.prisma).toBeDefined();
252
316
  expect(result.functions.auth.layers).toEqual([{ Ref: 'PrismaLambdaLayer' }]);
253
- expect(result.functions.auth.package.exclude).toEqual(
317
+ expect(result.functions.auth.package.patterns).toEqual(
254
318
  expect.arrayContaining([
255
- 'node_modules/@prisma/**',
256
- 'node_modules/.prisma/**',
257
- 'node_modules/prisma/**',
258
- 'node_modules/@friggframework/core/generated/**',
319
+ '!node_modules/@prisma/**',
320
+ '!node_modules/.prisma/**',
321
+ '!node_modules/prisma/**',
322
+ '!node_modules/@friggframework/core/generated/**',
259
323
  ])
260
324
  );
261
325
  expect(result.custom.esbuild.external).toEqual(
@@ -268,12 +332,12 @@ describe('Base Definition Factory', () => {
268
332
 
269
333
  expect(result.layers).toEqual({});
270
334
  expect(result.functions.auth.layers).toBeUndefined();
271
- expect(result.functions.auth.package.exclude).not.toEqual(
335
+ expect(result.functions.auth.package.patterns).not.toEqual(
272
336
  expect.arrayContaining([
273
- 'node_modules/@prisma/**',
274
- 'node_modules/.prisma/**',
275
- 'node_modules/prisma/**',
276
- 'node_modules/@friggframework/core/generated/**',
337
+ '!node_modules/@prisma/**',
338
+ '!node_modules/.prisma/**',
339
+ '!node_modules/prisma/**',
340
+ '!node_modules/@friggframework/core/generated/**',
277
341
  ])
278
342
  );
279
343
  expect(result.custom.esbuild.external).not.toEqual(
@@ -297,7 +361,7 @@ describe('nested node_modules (lambda.keepNestedNodeModules)', () => {
297
361
  const result = build({ name: 'test-app' });
298
362
 
299
363
  for (const fn of ['auth', 'user', 'health']) {
300
- expect(result.functions[fn].package.exclude).toContain('node_modules/**/node_modules/**');
364
+ expect(result.functions[fn].package.patterns).toContain('!node_modules/**/node_modules/**');
301
365
  }
302
366
  });
303
367
 
@@ -305,13 +369,13 @@ describe('nested node_modules (lambda.keepNestedNodeModules)', () => {
305
369
  const result = build({ name: 'test-app', lambda: { keepNestedNodeModules: true } });
306
370
 
307
371
  for (const fn of ['auth', 'user', 'health']) {
308
- const { exclude } = result.functions[fn].package;
309
- expect(exclude).not.toContain('node_modules/**/node_modules/**');
310
- expect(exclude).toEqual(
372
+ const { patterns } = result.functions[fn].package;
373
+ expect(patterns).not.toContain('!node_modules/**/node_modules/**');
374
+ expect(patterns).toEqual(
311
375
  expect.arrayContaining([
312
- 'node_modules/**/node_modules/@friggframework/**',
313
- 'node_modules/**/node_modules/@aws-sdk/**',
314
- 'node_modules/**/node_modules/@prisma/**',
376
+ '!node_modules/**/node_modules/@friggframework/**',
377
+ '!node_modules/**/node_modules/@aws-sdk/**',
378
+ '!node_modules/**/node_modules/@prisma/**',
315
379
  ])
316
380
  );
317
381
  }
@@ -327,14 +391,14 @@ describe('logging (ADR-048)', () => {
327
391
 
328
392
  expect(result.provider.logs).toBeUndefined();
329
393
  expect(result.provider.logRetentionInDays).toBeUndefined();
330
- expect(result.frameworkVersion).toBe('>=3.17.0');
394
+ expect(result.frameworkVersion).toBe(OSLS_FRAMEWORK_VERSION);
331
395
  });
332
396
 
333
397
  it('validates logging.level but leaves the Lambda log format and frameworkVersion alone by default', () => {
334
398
  const result = build({ level: 'warn' });
335
399
 
336
400
  expect(result.provider.logs).toBeUndefined();
337
- expect(result.frameworkVersion).toBe('>=3.17.0');
401
+ expect(result.frameworkVersion).toBe(OSLS_FRAMEWORK_VERSION);
338
402
  });
339
403
 
340
404
  it.each(['verbose', 'warning', '', 3])('throws on unknown level %p', (level) => {
@@ -346,7 +410,12 @@ describe('logging (ADR-048)', () => {
346
410
 
347
411
  expect(result.provider.logRetentionInDays).toBe(30);
348
412
  expect(result.provider.logs).toBeUndefined();
349
- expect(result.frameworkVersion).toBe('>=3.17.0');
413
+ expect(result.frameworkVersion).toBe(OSLS_FRAMEWORK_VERSION);
414
+ });
415
+
416
+ it('keeps the single osls frameworkVersion even when the Lambda LoggingConfig is on (ADR-050)', () => {
417
+ const result = build({ level: 'warn' });
418
+ expect(result.frameworkVersion).toBe('^4.4.0');
350
419
  });
351
420
 
352
421
  it('accepts 1096, which CloudWatch allows but the osls schema omits', () => {
@@ -0,0 +1,14 @@
1
+ /**
2
+ * osls framework version
3
+ *
4
+ * Utility Layer - Hexagonal Architecture
5
+ *
6
+ * The single `frameworkVersion` every composed definition emits (ADR-050).
7
+ * It matches the osls range in devtools and frigg-cli, so an app whose own
8
+ * package.json still resolves osls 3 fails at once with
9
+ * FRAMEWORK_VERSION_MISMATCH instead of packaging a different artifact.
10
+ * It subsumes the ADR-048 LoggingConfig floor (>=3.58.0).
11
+ */
12
+ const OSLS_FRAMEWORK_VERSION = '^4.4.0';
13
+
14
+ module.exports = { OSLS_FRAMEWORK_VERSION };
@@ -0,0 +1,27 @@
1
+ const { OSLS_FRAMEWORK_VERSION } = require('./framework-version');
2
+ const semver = require('semver');
3
+
4
+ describe('OSLS_FRAMEWORK_VERSION (ADR-050)', () => {
5
+ it('is the osls 4 range Frigg targets', () => {
6
+ expect(OSLS_FRAMEWORK_VERSION).toBe('^4.4.0');
7
+ });
8
+
9
+ it.each([
10
+ ['4.4.0', true],
11
+ ['4.9.1', true],
12
+ ['4.3.9', false],
13
+ ['3.78.0', false],
14
+ ['5.0.0', false],
15
+ ])('osls %s satisfies it: %s', (version, expected) => {
16
+ // osls compares frameworkVersion with semver.satisfies and fails
17
+ // with FRAMEWORK_VERSION_MISMATCH otherwise.
18
+ expect(semver.satisfies(version, OSLS_FRAMEWORK_VERSION)).toBe(expected);
19
+ });
20
+
21
+ it('matches the osls range devtools and frigg-cli depend on', () => {
22
+ const devtools = require('../../../../package.json');
23
+ const cli = require('../../../../frigg-cli/package.json');
24
+ expect(devtools.devDependencies.osls).toBe(OSLS_FRAMEWORK_VERSION);
25
+ expect(cli.dependencies.osls).toBe(OSLS_FRAMEWORK_VERSION);
26
+ });
27
+ });
@@ -6,8 +6,8 @@ const RETENTION_DAYS = [
6
6
  2192, 2557, 2922, 3288, 3653,
7
7
  ];
8
8
 
9
- // First osls version that compiles provider.logs.lambda into LoggingConfig.
10
- const LOGGING_CONFIG_FRAMEWORK_VERSION = '>=3.58.0';
9
+ // provider.logs.lambda compiles to LoggingConfig from osls 3.58.0; the base
10
+ // definition's single frameworkVersion (^4.4.0, ADR-050) already covers it.
11
11
 
12
12
  // ADR-048 Open question 3: off until the Phase 0 spike proves Lambda JSON mode
13
13
  // keeps direct fd 1 lines intact. Until then Lambda stays on Text and
@@ -39,7 +39,7 @@ function validateRetentionInDays(retentionInDays) {
39
39
  *
40
40
  * @param {Object} [logging] - appDefinition.logging
41
41
  * @param {{ lambdaJson?: boolean }} [options]
42
- * @returns {{ frameworkVersion?: string, provider?: Object }}
42
+ * @returns {{ provider?: Object }}
43
43
  */
44
44
  function buildLoggingProviderConfig(
45
45
  logging,
@@ -53,7 +53,6 @@ function buildLoggingProviderConfig(
53
53
  if (logging.level !== undefined) {
54
54
  const level = normalizeLogLevel(logging.level);
55
55
  if (lambdaJson) {
56
- result.frameworkVersion = LOGGING_CONFIG_FRAMEWORK_VERSION;
57
56
  provider.logs = {
58
57
  lambda: {
59
58
  logFormat: 'JSON',
@@ -18,9 +18,8 @@ describe('buildLoggingProviderConfig (ADR-048)', () => {
18
18
  const build = (logging) =>
19
19
  buildLoggingProviderConfig(logging, { lambdaJson: true });
20
20
 
21
- it('maps level to provider.logs.lambda and sets frameworkVersion >=3.58.0', () => {
21
+ it('maps level to provider.logs.lambda and leaves frameworkVersion to the base definition (ADR-050)', () => {
22
22
  expect(build({ level: 'warn' })).toEqual({
23
- frameworkVersion: '>=3.58.0',
24
23
  provider: {
25
24
  logs: {
26
25
  lambda: {
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Function package patterns
3
+ *
4
+ * Utility Layer - Hexagonal Architecture
5
+ *
6
+ * osls 4 rejects `package.include` / `package.exclude` and only reads
7
+ * `package.patterns` (ADR-050). Builders keep their include and exclude lists
8
+ * and pass them through this helper, so one place owns the negation.
9
+ *
10
+ * osls resolves a function's files with `resolveFilePathsFromPatterns`: an
11
+ * ordered list evaluated last-match-wins. On osls 3 a function `exclude` was
12
+ * placed (negated) ahead of the function `include`. Frigg emits no
13
+ * service-level include, exclude or patterns, so `[!exclude..., include...]`
14
+ * reproduces the osls 3 order exactly, and is valid on osls 3 and osls 4.
15
+ *
16
+ * An exclude that already starts with `!` was treated by osls 3 as an include
17
+ * in exclude position; it is emitted un-negated in the same position here.
18
+ */
19
+
20
+ /**
21
+ * @param {Object} [lists]
22
+ * @param {string[]} [lists.include] - Globs to (re-)add after the excludes
23
+ * @param {string[]} [lists.exclude] - Globs to remove
24
+ * @returns {string[]} Value for `package.patterns`
25
+ */
26
+ function toPackagePatterns({ include = [], exclude = [] } = {}) {
27
+ return [
28
+ ...exclude.map((pattern) =>
29
+ pattern.startsWith('!') ? pattern.slice(1) : `!${pattern}`
30
+ ),
31
+ ...include,
32
+ ];
33
+ }
34
+
35
+ module.exports = { toPackagePatterns };