@friggframework/devtools 2.0.0--canary.704.79d9a63.0 → 2.0.0--canary.680.daae24e.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.
- package/README.md +0 -14
- package/frigg-cli/README.md +0 -6
- package/frigg-cli/__tests__/unit/dependencies.test.js +5 -3
- package/frigg-cli/index.js +0 -3
- package/frigg-cli/package.json +3 -3
- package/infrastructure/README.md +4 -22
- package/infrastructure/__tests__/management-api-gateway-routes.test.js +335 -0
- package/infrastructure/domains/admin-scripts/admin-script-builder.js +48 -56
- package/infrastructure/domains/admin-scripts/admin-script-builder.test.js +7 -76
- package/infrastructure/domains/database/migration-builder.js +175 -182
- package/infrastructure/domains/database/migration-builder.test.js +5 -36
- package/infrastructure/domains/integration/integration-builder.js +61 -65
- package/infrastructure/domains/integration/integration-builder.test.js +8 -73
- package/infrastructure/domains/parameters/offload-utils.js +1 -0
- package/infrastructure/domains/shared/environment-builder.js +12 -1
- package/infrastructure/domains/shared/environment-builder.test.js +20 -0
- package/infrastructure/domains/shared/utilities/base-definition-factory.js +148 -86
- package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +87 -96
- package/infrastructure/domains/shared/utilities/logging-config.js +4 -3
- package/infrastructure/domains/shared/utilities/logging-config.test.js +2 -1
- package/infrastructure/infrastructure-composer.test.js +3 -3
- package/package.json +8 -11
- package/frigg-cli/__tests__/unit/utils/node-version.test.js +0 -66
- package/frigg-cli/utils/node-version.js +0 -51
- package/infrastructure/__tests__/package-patterns-composition.test.js +0 -153
- package/infrastructure/domains/shared/utilities/framework-version.js +0 -14
- package/infrastructure/domains/shared/utilities/framework-version.test.js +0 -27
- package/infrastructure/domains/shared/utilities/package-patterns.js +0 -35
- package/infrastructure/domains/shared/utilities/package-patterns.test.js +0 -112
|
@@ -20,7 +20,6 @@ const {
|
|
|
20
20
|
ValidationResult,
|
|
21
21
|
} = require('../shared/base-builder');
|
|
22
22
|
const IntegrationResourceResolver = require('./integration-resolver');
|
|
23
|
-
const { toPackagePatterns } = require('../shared/utilities/package-patterns');
|
|
24
23
|
const {
|
|
25
24
|
createEmptyDiscoveryResult,
|
|
26
25
|
ResourceOwnership,
|
|
@@ -255,70 +254,67 @@ class IntegrationBuilder extends InfrastructureBuilder {
|
|
|
255
254
|
*/
|
|
256
255
|
createFunctionPackageConfig(usePrismaLayer = true, appDefinition = {}) {
|
|
257
256
|
return {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
'**/.swarm/**',
|
|
320
|
-
],
|
|
321
|
-
}),
|
|
257
|
+
exclude: [
|
|
258
|
+
// Exclude AWS SDK (provided by Lambda runtime)
|
|
259
|
+
'node_modules/aws-sdk/**',
|
|
260
|
+
'node_modules/@aws-sdk/**',
|
|
261
|
+
|
|
262
|
+
// Exclude Prisma (provided via Lambda Layer)
|
|
263
|
+
...(usePrismaLayer
|
|
264
|
+
? [
|
|
265
|
+
'node_modules/@prisma/**',
|
|
266
|
+
'node_modules/.prisma/**',
|
|
267
|
+
'node_modules/prisma/**',
|
|
268
|
+
'node_modules/@friggframework/core/generated/**',
|
|
269
|
+
]
|
|
270
|
+
: []),
|
|
271
|
+
|
|
272
|
+
...nestedNodeModulesExcludes(appDefinition, usePrismaLayer),
|
|
273
|
+
|
|
274
|
+
// Exclude build tools (not needed at runtime)
|
|
275
|
+
'node_modules/esbuild/**',
|
|
276
|
+
'node_modules/@esbuild/**',
|
|
277
|
+
'node_modules/typescript/**',
|
|
278
|
+
'node_modules/webpack/**',
|
|
279
|
+
'node_modules/osls/**',
|
|
280
|
+
'node_modules/serverless-esbuild/**',
|
|
281
|
+
'node_modules/serverless-jetpack/**',
|
|
282
|
+
'node_modules/serverless-offline/**',
|
|
283
|
+
'node_modules/serverless-offline-sqs/**',
|
|
284
|
+
'node_modules/serverless-dotenv-plugin/**',
|
|
285
|
+
'node_modules/serverless-kms-grants/**',
|
|
286
|
+
// Note: DO NOT exclude serverless-http - it's a runtime dependency!
|
|
287
|
+
|
|
288
|
+
// Exclude dev/test dependencies
|
|
289
|
+
'node_modules/@friggframework/test/**',
|
|
290
|
+
'node_modules/@friggframework/eslint-config/**',
|
|
291
|
+
'node_modules/@friggframework/prettier-config/**',
|
|
292
|
+
'node_modules/jest/**',
|
|
293
|
+
'node_modules/prettier/**',
|
|
294
|
+
'node_modules/eslint/**',
|
|
295
|
+
|
|
296
|
+
// Exclude local dev files
|
|
297
|
+
'deploy.log',
|
|
298
|
+
'.env.backup',
|
|
299
|
+
'docker-compose.yml',
|
|
300
|
+
'jest.config.js',
|
|
301
|
+
'jest.unit.config.js',
|
|
302
|
+
'.eslintrc.json',
|
|
303
|
+
'.prettierrc',
|
|
304
|
+
'.prettierignore',
|
|
305
|
+
'.markdownlintignore',
|
|
306
|
+
'package-lock.json',
|
|
307
|
+
|
|
308
|
+
// Exclude development/test files (keep src/ - needed for integrations and api-modules)
|
|
309
|
+
'coverage/**',
|
|
310
|
+
'test/**',
|
|
311
|
+
'layers/**',
|
|
312
|
+
// Note: DO NOT exclude src/** - handlers need src/integrations and src/api-modules at runtime
|
|
313
|
+
'**/*.test.js',
|
|
314
|
+
'**/*.spec.js',
|
|
315
|
+
'**/.claude-flow/**',
|
|
316
|
+
'**/.swarm/**',
|
|
317
|
+
],
|
|
322
318
|
};
|
|
323
319
|
}
|
|
324
320
|
|
|
@@ -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.
|
|
890
|
-
expect(result.functions.testWebhook.package.
|
|
889
|
+
expect(result.functions.testWebhook.package.exclude).toContain('node_modules/aws-sdk/**');
|
|
890
|
+
expect(result.functions.testWebhook.package.exclude).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.
|
|
986
|
-
expect.arrayContaining(['
|
|
985
|
+
expect(result.functions.asana.package.exclude).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?.
|
|
1094
|
+
Object.values(result.functions).filter((fn) => fn.package?.exclude);
|
|
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.
|
|
1101
|
+
expect(fn.package.exclude).toContain('node_modules/**/node_modules/**');
|
|
1102
1102
|
}
|
|
1103
1103
|
});
|
|
1104
1104
|
|
|
@@ -1109,73 +1109,8 @@ describe('IntegrationBuilder nested node_modules (lambda.keepNestedNodeModules)'
|
|
|
1109
1109
|
);
|
|
1110
1110
|
|
|
1111
1111
|
for (const fn of packagedFunctions(result)) {
|
|
1112
|
-
expect(fn.package.
|
|
1113
|
-
expect(fn.package.
|
|
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/**');
|
|
1112
|
+
expect(fn.package.exclude).not.toContain('node_modules/**/node_modules/**');
|
|
1113
|
+
expect(fn.package.exclude).toContain('node_modules/**/node_modules/@friggframework/**');
|
|
1179
1114
|
}
|
|
1180
1115
|
});
|
|
1181
1116
|
});
|
|
@@ -72,6 +72,16 @@ function addLoggingEnv(appDefinition, envVars) {
|
|
|
72
72
|
envVars.FRIGG_LOG_LEVEL = normalized;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
// Field-level encryption fails closed in a deployed stage with no key (core's
|
|
76
|
+
// encryption-config.js). `fieldLevelEncryptionMethod: 'none'` is the explicit,
|
|
77
|
+
// documented way to run a stage in plaintext; core logs a warning on every
|
|
78
|
+
// cold start while it is set.
|
|
79
|
+
function addEncryptionEnv(appDefinition, envVars) {
|
|
80
|
+
if (appDefinition?.encryption?.fieldLevelEncryptionMethod === 'none') {
|
|
81
|
+
envVars.FRIGG_ENCRYPTION_DISABLED = 'true';
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
75
85
|
/**
|
|
76
86
|
* Get environment variables from AppDefinition
|
|
77
87
|
*
|
|
@@ -149,6 +159,7 @@ function getAppEnvironmentVars(appDefinition) {
|
|
|
149
159
|
}
|
|
150
160
|
|
|
151
161
|
addLoggingEnv(appDefinition, envVars);
|
|
162
|
+
addEncryptionEnv(appDefinition, envVars);
|
|
152
163
|
|
|
153
164
|
if (envKeys.length > 0) {
|
|
154
165
|
console.log(
|
|
@@ -187,7 +198,7 @@ function getAppEnvironmentVars(appDefinition) {
|
|
|
187
198
|
function buildEnvironment(appEnvironmentVars, discoveredResources) {
|
|
188
199
|
const environment = {
|
|
189
200
|
...appEnvironmentVars,
|
|
190
|
-
STAGE: '${self:provider.stage}', //
|
|
201
|
+
STAGE: '${self:provider.stage}', // Read by core: e.g. the local-only encryption bypass
|
|
191
202
|
FRIGG_STACK: '${self:service}',
|
|
192
203
|
FRIGG_STAGE: '${self:provider.stage}',
|
|
193
204
|
FRIGG_REGION: '${self:provider.region}',
|
|
@@ -468,6 +468,26 @@ describe('Environment Builder', () => {
|
|
|
468
468
|
});
|
|
469
469
|
});
|
|
470
470
|
|
|
471
|
+
describe('field-level encryption opt-out', () => {
|
|
472
|
+
it("emits FRIGG_ENCRYPTION_DISABLED=true for fieldLevelEncryptionMethod: 'none'", () => {
|
|
473
|
+
const result = getAppEnvironmentVars({
|
|
474
|
+
encryption: { fieldLevelEncryptionMethod: 'none' },
|
|
475
|
+
});
|
|
476
|
+
|
|
477
|
+
expect(result.FRIGG_ENCRYPTION_DISABLED).toBe('true');
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
it.each([
|
|
481
|
+
['kms', { fieldLevelEncryptionMethod: 'kms' }],
|
|
482
|
+
['aes', { fieldLevelEncryptionMethod: 'aes' }],
|
|
483
|
+
['no encryption block', undefined],
|
|
484
|
+
])('does not opt out for %s', (_label, encryption) => {
|
|
485
|
+
const result = getAppEnvironmentVars({ encryption });
|
|
486
|
+
|
|
487
|
+
expect(result.FRIGG_ENCRYPTION_DISABLED).toBeUndefined();
|
|
488
|
+
});
|
|
489
|
+
});
|
|
490
|
+
|
|
471
491
|
describe('buildEnvironment()', () => {
|
|
472
492
|
it('should combine app vars with standard Frigg variables', () => {
|
|
473
493
|
const appEnvironmentVars = {
|
|
@@ -9,9 +9,25 @@
|
|
|
9
9
|
|
|
10
10
|
const { buildEnvironment } = require('../environment-builder');
|
|
11
11
|
const { nestedNodeModulesExcludes } = require('./nested-node-modules');
|
|
12
|
-
const { toPackagePatterns } = require('./package-patterns');
|
|
13
12
|
const { buildLoggingProviderConfig } = require('./logging-config');
|
|
14
|
-
const {
|
|
13
|
+
const {
|
|
14
|
+
getGatewayRoutes,
|
|
15
|
+
} = require('@friggframework/core/management-api/route-registry');
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* HTTP API events for one function, from core's Management API route
|
|
19
|
+
* registry (ADR-053): the same registry mounts the Express routers and
|
|
20
|
+
* builds the OpenAPI documents, so the three cannot drift.
|
|
21
|
+
*/
|
|
22
|
+
function managementApiEvents(AppDefinition, functionName) {
|
|
23
|
+
const managementApi = AppDefinition.managementApi || {};
|
|
24
|
+
return getGatewayRoutes({
|
|
25
|
+
v1: managementApi.v1 !== false,
|
|
26
|
+
proxy: managementApi.proxy?.enable === true,
|
|
27
|
+
})
|
|
28
|
+
.filter((route) => route.function === functionName)
|
|
29
|
+
.map(({ method, path }) => ({ httpApi: { path, method } }));
|
|
30
|
+
}
|
|
15
31
|
|
|
16
32
|
/**
|
|
17
33
|
* Create base serverless definition with core functions and resources
|
|
@@ -39,95 +55,143 @@ function createBaseDefinition(
|
|
|
39
55
|
const loggingConfig = buildLoggingProviderConfig(AppDefinition.logging);
|
|
40
56
|
|
|
41
57
|
// Package config for handlers that skip esbuild (need node_modules dependencies)
|
|
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.
|
|
58
|
+
// Include backend src/ and index.js since handlers load the app definition
|
|
44
59
|
const skipEsbuildPackageConfig = {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
] : []),
|
|
60
|
+
// Explicitly include project files that handlers need
|
|
61
|
+
include: [
|
|
62
|
+
// Include DocumentDB TLS certificate if configured
|
|
63
|
+
...(AppDefinition.database?.documentDB?.tlsCAFile
|
|
64
|
+
? [AppDefinition.database.documentDB.tlsCAFile.replace(/^\.\//, '')]
|
|
65
|
+
: []),
|
|
66
|
+
],
|
|
67
|
+
exclude: [
|
|
68
|
+
// Exclude Prisma (provided via Lambda Layer)
|
|
69
|
+
...(usePrismaLayer ? [
|
|
70
|
+
'node_modules/@prisma/**',
|
|
71
|
+
'node_modules/.prisma/**',
|
|
72
|
+
'node_modules/prisma/**',
|
|
73
|
+
'node_modules/@friggframework/core/generated/**',
|
|
74
|
+
] : []),
|
|
61
75
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
76
|
+
// Exclude AWS SDK (provided by Lambda runtime)
|
|
77
|
+
'node_modules/aws-sdk/**',
|
|
78
|
+
'node_modules/@aws-sdk/**',
|
|
65
79
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
80
|
+
// Exclude dev/test dependencies
|
|
81
|
+
'node_modules/@friggframework/test/**',
|
|
82
|
+
'node_modules/@friggframework/eslint-config/**',
|
|
83
|
+
'node_modules/@friggframework/prettier-config/**',
|
|
84
|
+
'node_modules/jest/**',
|
|
85
|
+
'node_modules/prettier/**',
|
|
86
|
+
'node_modules/eslint/**',
|
|
73
87
|
|
|
74
|
-
|
|
88
|
+
...nestedNodeModulesExcludes(AppDefinition, usePrismaLayer),
|
|
75
89
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
// Exclude build tools (not needed at runtime)
|
|
91
|
+
'node_modules/esbuild/**',
|
|
92
|
+
'node_modules/@esbuild/**',
|
|
93
|
+
'node_modules/typescript/**',
|
|
94
|
+
'node_modules/webpack/**',
|
|
95
|
+
'node_modules/osls/**',
|
|
96
|
+
'node_modules/serverless-esbuild/**',
|
|
97
|
+
'node_modules/serverless-jetpack/**',
|
|
98
|
+
'node_modules/serverless-offline/**',
|
|
99
|
+
'node_modules/serverless-offline-sqs/**',
|
|
100
|
+
'node_modules/serverless-dotenv-plugin/**',
|
|
101
|
+
'node_modules/serverless-kms-grants/**',
|
|
102
|
+
// Note: DO NOT exclude serverless-http - it's a runtime dependency!
|
|
89
103
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
// Exclude local dev files and environment files (NEVER deploy .env files!)
|
|
105
|
+
'.env',
|
|
106
|
+
'.env.*',
|
|
107
|
+
'.env.local',
|
|
108
|
+
'.env.*.local',
|
|
109
|
+
'**/.env',
|
|
110
|
+
'**/.env.*',
|
|
111
|
+
'deploy.log',
|
|
112
|
+
'.env.backup',
|
|
113
|
+
'docker-compose.yml',
|
|
114
|
+
'jest.config.js',
|
|
115
|
+
'jest.unit.config.js',
|
|
116
|
+
'.eslintrc.json',
|
|
117
|
+
'.prettierrc',
|
|
118
|
+
'.prettierignore',
|
|
119
|
+
'.markdownlintignore',
|
|
120
|
+
'package-lock.json',
|
|
107
121
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
122
|
+
// Exclude test files and layers (keep src/ - needed for app definition and integrations)
|
|
123
|
+
'test/**',
|
|
124
|
+
'layers/**',
|
|
125
|
+
'coverage/**',
|
|
126
|
+
// Note: DO NOT exclude src/** - handlers need src/integrations and src/api-modules at runtime
|
|
127
|
+
'**/*.test.js',
|
|
128
|
+
'**/*.spec.js',
|
|
129
|
+
'**/.claude-flow/**',
|
|
130
|
+
'**/.swarm/**',
|
|
131
|
+
],
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
// Function-level package config to exclude Prisma and AWS SDK
|
|
135
|
+
const functionPackageConfig = {
|
|
136
|
+
exclude: [
|
|
137
|
+
// Exclude AWS SDK (already in Lambda runtime or externalized by esbuild)
|
|
138
|
+
'node_modules/aws-sdk/**',
|
|
139
|
+
'node_modules/@aws-sdk/**',
|
|
140
|
+
|
|
141
|
+
// Exclude Prisma (provided via Lambda Layer)
|
|
142
|
+
...(usePrismaLayer ? [
|
|
143
|
+
'node_modules/@prisma/**',
|
|
144
|
+
'node_modules/.prisma/**',
|
|
145
|
+
'node_modules/prisma/**',
|
|
146
|
+
'node_modules/@friggframework/core/generated/**',
|
|
147
|
+
] : []),
|
|
148
|
+
|
|
149
|
+
// Exclude nested node_modules from symlinked frigg packages (for npm link development)
|
|
150
|
+
'node_modules/@friggframework/core/node_modules/**',
|
|
151
|
+
'node_modules/@friggframework/devtools/node_modules/**',
|
|
152
|
+
|
|
153
|
+
// Exclude environment files (NEVER deploy .env files!)
|
|
154
|
+
'.env',
|
|
155
|
+
'.env.*',
|
|
156
|
+
'.env.local',
|
|
157
|
+
'.env.*.local',
|
|
158
|
+
'**/.env',
|
|
159
|
+
'**/.env.*',
|
|
160
|
+
|
|
161
|
+
// Exclude development/test files from backend project
|
|
162
|
+
'coverage/**',
|
|
163
|
+
'test/**',
|
|
164
|
+
'src/**',
|
|
165
|
+
'layers/**',
|
|
166
|
+
'**/*.test.js',
|
|
167
|
+
'**/*.spec.js',
|
|
168
|
+
'.git/**',
|
|
169
|
+
'.github/**',
|
|
170
|
+
|
|
171
|
+
// Exclude AI assistant and development artifacts
|
|
172
|
+
'**/.claude-flow/**',
|
|
173
|
+
'**/.swarm/**',
|
|
174
|
+
'**/CLAUDE.md',
|
|
175
|
+
'**/README.md',
|
|
176
|
+
'**/*.md',
|
|
177
|
+
|
|
178
|
+
// Exclude config and meta files from core
|
|
179
|
+
'node_modules/@friggframework/core/.eslintrc.json',
|
|
180
|
+
'node_modules/@friggframework/core/.gitignore',
|
|
181
|
+
'node_modules/@friggframework/core/jest.config.js',
|
|
182
|
+
'node_modules/@friggframework/core/CHANGELOG.md',
|
|
183
|
+
],
|
|
119
184
|
};
|
|
120
185
|
|
|
121
186
|
return {
|
|
122
|
-
frameworkVersion:
|
|
187
|
+
frameworkVersion: loggingConfig.frameworkVersion || '>=3.17.0',
|
|
123
188
|
service: AppDefinition.name || 'create-frigg-app',
|
|
124
189
|
package: {
|
|
125
190
|
individually: true,
|
|
126
191
|
},
|
|
127
192
|
// Only use .env for local development (offline mode)
|
|
128
|
-
// Production deployments should use environment vars from infrastructure
|
|
129
|
-
|
|
130
|
-
...(process.argv.includes('offline') && { useDotenv: true }),
|
|
193
|
+
// Production deployments should use environment vars from infrastructure
|
|
194
|
+
useDotenv: process.argv.includes('offline'),
|
|
131
195
|
provider: {
|
|
132
196
|
name: AppDefinition.provider || 'aws',
|
|
133
197
|
...(process.env.AWS_PROFILE && { profile: process.env.AWS_PROFILE }),
|
|
@@ -240,16 +304,12 @@ function createBaseDefinition(
|
|
|
240
304
|
...(usePrismaLayer && { layers: [{ Ref: 'PrismaLambdaLayer' }] }),
|
|
241
305
|
skipEsbuild: true, // Handlers in node_modules don't need bundling
|
|
242
306
|
package: skipEsbuildPackageConfig,
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
},
|
|
250
|
-
},
|
|
251
|
-
{ httpApi: { path: '/api/authorize', method: 'ANY' } },
|
|
252
|
-
],
|
|
307
|
+
// Every Management API path the auth Lambda serves (v1, v2 per
|
|
308
|
+
// resource, the OAuth redirect) comes from core's route
|
|
309
|
+
// registry. HTTP API has no implicit catch-all, so an unlisted
|
|
310
|
+
// prefix 404s at the gateway before Express sees it. Guarded by
|
|
311
|
+
// __tests__/management-api-gateway-routes.test.js.
|
|
312
|
+
events: managementApiEvents(AppDefinition, 'auth'),
|
|
253
313
|
},
|
|
254
314
|
user: {
|
|
255
315
|
handler: 'node_modules/@friggframework/core/handlers/routers/user.handler',
|
|
@@ -266,6 +326,8 @@ function createBaseDefinition(
|
|
|
266
326
|
events: [
|
|
267
327
|
{ httpApi: { path: '/health', method: 'GET' } },
|
|
268
328
|
{ httpApi: { path: '/health/{proxy+}', method: 'GET' } },
|
|
329
|
+
// GET /api/meta and the OpenAPI documents: public, DB-free.
|
|
330
|
+
...managementApiEvents(AppDefinition, 'health'),
|
|
269
331
|
],
|
|
270
332
|
},
|
|
271
333
|
// Reporting is an admin operation (ADR-010): the report router runs on the admin-scripts Lambda, not as a standalone function here.
|