@friggframework/devtools 2.0.0--canary.704.79d9a63.0 → 2.0.0--canary.686.e94de4d.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/commands/provider-dispatch.test.js +140 -0
- package/frigg-cli/__tests__/unit/dependencies.test.js +5 -3
- package/frigg-cli/build-command/index.js +32 -1
- package/frigg-cli/deploy-command/index.js +50 -2
- package/frigg-cli/doctor-command/index.js +7 -0
- package/frigg-cli/generate-iam-command.js +7 -0
- package/frigg-cli/index.js +0 -3
- package/frigg-cli/package.json +3 -3
- package/frigg-cli/repair-command/index.js +7 -0
- package/frigg-cli/start-command/index.js +58 -0
- package/frigg-cli/utils/provider-helper.js +80 -0
- package/infrastructure/README.md +4 -22
- package/infrastructure/__tests__/create-frigg-infrastructure-provider.test.js +64 -0
- package/infrastructure/__tests__/management-api-gateway-routes.test.js +335 -0
- package/infrastructure/__tests__/template-generation.test.js +7 -0
- package/infrastructure/create-frigg-infrastructure.js +14 -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/types/app-definition.js +15 -1
- package/infrastructure/domains/shared/utilities/base-definition-factory.js +150 -86
- package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +111 -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 +10 -3
- package/infrastructure/provider-build.js +119 -0
- package/infrastructure/scripts/build-prisma-layer.js +32 -5
- package/infrastructure/scripts/build-prisma-layer.test.js +35 -0
- package/package.json +8 -11
- package/test/npm-install-guard.js +104 -0
- package/test/npm-install-guard.test.js +53 -0
- 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
|
@@ -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 = {
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
* @typedef {Object} AppDefinition
|
|
130
130
|
* @property {string} name - Application name
|
|
131
131
|
* @property {string} stage - Deployment stage (e.g., 'dev', 'production')
|
|
132
|
-
* @property {string} provider -
|
|
132
|
+
* @property {string} provider - Deployment provider: 'aws' (serverless/Lambda) or 'netlify' (@friggframework/provider-netlify)
|
|
133
133
|
* @property {string} region - AWS region
|
|
134
134
|
*
|
|
135
135
|
* @property {VpcDefinition} [vpc] - VPC configuration
|
|
@@ -144,6 +144,20 @@
|
|
|
144
144
|
* @property {AdminConfig} [admin] - Admin configuration
|
|
145
145
|
*
|
|
146
146
|
* @property {Object} [environment] - Environment variables
|
|
147
|
+
*
|
|
148
|
+
* @property {ExtensionDefinition[]} [coreExtensions] - Core (app-level) extensions that add custom Prisma models, encrypted fields, admin routes and bootstrap hooks (not an integration's Definition.extensions, nor ADR-017's keyed appDefinition.extensions)
|
|
149
|
+
*/
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* App-level extension: custom models, encryption, admin routes and bootstrap
|
|
153
|
+
* @typedef {Object} ExtensionDefinition
|
|
154
|
+
* @property {string} name - Unique identifier for this extension
|
|
155
|
+
* @property {string} [schema] - Absolute path to a .prisma schema fragment
|
|
156
|
+
* @property {Object<string, {fields: string[]}>} [encryption] - Model name → encrypted fields mapping
|
|
157
|
+
* @property {Object} [routes] - Express router configuration
|
|
158
|
+
* @property {string} routes.path - Base URL path for the extension routes: /admin/<segment>..., never /api (/admin/scripts, /admin/db-migrate and /admin/queue are reserved); served by the auth function
|
|
159
|
+
* @property {Function|Object} routes.handler - Router factory (prisma, appDefinition) → Router, or { router } object
|
|
160
|
+
* @property {Function} [bootstrap] - Async function (prisma, appDefinition) → void, run by initializeApp()
|
|
147
161
|
*/
|
|
148
162
|
|
|
149
163
|
/**
|
|
@@ -9,9 +9,27 @@
|
|
|
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 route registry (ADR-053):
|
|
19
|
+
* the same registry mounts the Express routers and builds the OpenAPI
|
|
20
|
+
* documents, so the three cannot drift. It also lists /api/docs and the core
|
|
21
|
+
* extensions' admin routes (/admin/<name>, served by the auth Lambda).
|
|
22
|
+
*/
|
|
23
|
+
function managementApiEvents(AppDefinition, functionName) {
|
|
24
|
+
const managementApi = AppDefinition.managementApi || {};
|
|
25
|
+
return getGatewayRoutes({
|
|
26
|
+
v1: managementApi.v1 !== false,
|
|
27
|
+
proxy: managementApi.proxy?.enable === true,
|
|
28
|
+
coreExtensions: AppDefinition.coreExtensions,
|
|
29
|
+
})
|
|
30
|
+
.filter((route) => route.function === functionName)
|
|
31
|
+
.map(({ method, path }) => ({ httpApi: { path, method } }));
|
|
32
|
+
}
|
|
15
33
|
|
|
16
34
|
/**
|
|
17
35
|
* Create base serverless definition with core functions and resources
|
|
@@ -39,95 +57,143 @@ function createBaseDefinition(
|
|
|
39
57
|
const loggingConfig = buildLoggingProviderConfig(AppDefinition.logging);
|
|
40
58
|
|
|
41
59
|
// 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.
|
|
60
|
+
// Include backend src/ and index.js since handlers load the app definition
|
|
44
61
|
const skipEsbuildPackageConfig = {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
] : []),
|
|
62
|
+
// Explicitly include project files that handlers need
|
|
63
|
+
include: [
|
|
64
|
+
// Include DocumentDB TLS certificate if configured
|
|
65
|
+
...(AppDefinition.database?.documentDB?.tlsCAFile
|
|
66
|
+
? [AppDefinition.database.documentDB.tlsCAFile.replace(/^\.\//, '')]
|
|
67
|
+
: []),
|
|
68
|
+
],
|
|
69
|
+
exclude: [
|
|
70
|
+
// Exclude Prisma (provided via Lambda Layer)
|
|
71
|
+
...(usePrismaLayer ? [
|
|
72
|
+
'node_modules/@prisma/**',
|
|
73
|
+
'node_modules/.prisma/**',
|
|
74
|
+
'node_modules/prisma/**',
|
|
75
|
+
'node_modules/@friggframework/core/generated/**',
|
|
76
|
+
] : []),
|
|
61
77
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
78
|
+
// Exclude AWS SDK (provided by Lambda runtime)
|
|
79
|
+
'node_modules/aws-sdk/**',
|
|
80
|
+
'node_modules/@aws-sdk/**',
|
|
65
81
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
82
|
+
// Exclude dev/test dependencies
|
|
83
|
+
'node_modules/@friggframework/test/**',
|
|
84
|
+
'node_modules/@friggframework/eslint-config/**',
|
|
85
|
+
'node_modules/@friggframework/prettier-config/**',
|
|
86
|
+
'node_modules/jest/**',
|
|
87
|
+
'node_modules/prettier/**',
|
|
88
|
+
'node_modules/eslint/**',
|
|
73
89
|
|
|
74
|
-
|
|
90
|
+
...nestedNodeModulesExcludes(AppDefinition, usePrismaLayer),
|
|
75
91
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
92
|
+
// Exclude build tools (not needed at runtime)
|
|
93
|
+
'node_modules/esbuild/**',
|
|
94
|
+
'node_modules/@esbuild/**',
|
|
95
|
+
'node_modules/typescript/**',
|
|
96
|
+
'node_modules/webpack/**',
|
|
97
|
+
'node_modules/osls/**',
|
|
98
|
+
'node_modules/serverless-esbuild/**',
|
|
99
|
+
'node_modules/serverless-jetpack/**',
|
|
100
|
+
'node_modules/serverless-offline/**',
|
|
101
|
+
'node_modules/serverless-offline-sqs/**',
|
|
102
|
+
'node_modules/serverless-dotenv-plugin/**',
|
|
103
|
+
'node_modules/serverless-kms-grants/**',
|
|
104
|
+
// Note: DO NOT exclude serverless-http - it's a runtime dependency!
|
|
89
105
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
// Exclude local dev files and environment files (NEVER deploy .env files!)
|
|
107
|
+
'.env',
|
|
108
|
+
'.env.*',
|
|
109
|
+
'.env.local',
|
|
110
|
+
'.env.*.local',
|
|
111
|
+
'**/.env',
|
|
112
|
+
'**/.env.*',
|
|
113
|
+
'deploy.log',
|
|
114
|
+
'.env.backup',
|
|
115
|
+
'docker-compose.yml',
|
|
116
|
+
'jest.config.js',
|
|
117
|
+
'jest.unit.config.js',
|
|
118
|
+
'.eslintrc.json',
|
|
119
|
+
'.prettierrc',
|
|
120
|
+
'.prettierignore',
|
|
121
|
+
'.markdownlintignore',
|
|
122
|
+
'package-lock.json',
|
|
107
123
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
124
|
+
// Exclude test files and layers (keep src/ - needed for app definition and integrations)
|
|
125
|
+
'test/**',
|
|
126
|
+
'layers/**',
|
|
127
|
+
'coverage/**',
|
|
128
|
+
// Note: DO NOT exclude src/** - handlers need src/integrations and src/api-modules at runtime
|
|
129
|
+
'**/*.test.js',
|
|
130
|
+
'**/*.spec.js',
|
|
131
|
+
'**/.claude-flow/**',
|
|
132
|
+
'**/.swarm/**',
|
|
133
|
+
],
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// Function-level package config to exclude Prisma and AWS SDK
|
|
137
|
+
const functionPackageConfig = {
|
|
138
|
+
exclude: [
|
|
139
|
+
// Exclude AWS SDK (already in Lambda runtime or externalized by esbuild)
|
|
140
|
+
'node_modules/aws-sdk/**',
|
|
141
|
+
'node_modules/@aws-sdk/**',
|
|
142
|
+
|
|
143
|
+
// Exclude Prisma (provided via Lambda Layer)
|
|
144
|
+
...(usePrismaLayer ? [
|
|
145
|
+
'node_modules/@prisma/**',
|
|
146
|
+
'node_modules/.prisma/**',
|
|
147
|
+
'node_modules/prisma/**',
|
|
148
|
+
'node_modules/@friggframework/core/generated/**',
|
|
149
|
+
] : []),
|
|
150
|
+
|
|
151
|
+
// Exclude nested node_modules from symlinked frigg packages (for npm link development)
|
|
152
|
+
'node_modules/@friggframework/core/node_modules/**',
|
|
153
|
+
'node_modules/@friggframework/devtools/node_modules/**',
|
|
154
|
+
|
|
155
|
+
// Exclude environment files (NEVER deploy .env files!)
|
|
156
|
+
'.env',
|
|
157
|
+
'.env.*',
|
|
158
|
+
'.env.local',
|
|
159
|
+
'.env.*.local',
|
|
160
|
+
'**/.env',
|
|
161
|
+
'**/.env.*',
|
|
162
|
+
|
|
163
|
+
// Exclude development/test files from backend project
|
|
164
|
+
'coverage/**',
|
|
165
|
+
'test/**',
|
|
166
|
+
'src/**',
|
|
167
|
+
'layers/**',
|
|
168
|
+
'**/*.test.js',
|
|
169
|
+
'**/*.spec.js',
|
|
170
|
+
'.git/**',
|
|
171
|
+
'.github/**',
|
|
172
|
+
|
|
173
|
+
// Exclude AI assistant and development artifacts
|
|
174
|
+
'**/.claude-flow/**',
|
|
175
|
+
'**/.swarm/**',
|
|
176
|
+
'**/CLAUDE.md',
|
|
177
|
+
'**/README.md',
|
|
178
|
+
'**/*.md',
|
|
179
|
+
|
|
180
|
+
// Exclude config and meta files from core
|
|
181
|
+
'node_modules/@friggframework/core/.eslintrc.json',
|
|
182
|
+
'node_modules/@friggframework/core/.gitignore',
|
|
183
|
+
'node_modules/@friggframework/core/jest.config.js',
|
|
184
|
+
'node_modules/@friggframework/core/CHANGELOG.md',
|
|
185
|
+
],
|
|
119
186
|
};
|
|
120
187
|
|
|
121
188
|
return {
|
|
122
|
-
frameworkVersion:
|
|
189
|
+
frameworkVersion: loggingConfig.frameworkVersion || '>=3.17.0',
|
|
123
190
|
service: AppDefinition.name || 'create-frigg-app',
|
|
124
191
|
package: {
|
|
125
192
|
individually: true,
|
|
126
193
|
},
|
|
127
194
|
// 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 }),
|
|
195
|
+
// Production deployments should use environment vars from infrastructure
|
|
196
|
+
useDotenv: process.argv.includes('offline'),
|
|
131
197
|
provider: {
|
|
132
198
|
name: AppDefinition.provider || 'aws',
|
|
133
199
|
...(process.env.AWS_PROFILE && { profile: process.env.AWS_PROFILE }),
|
|
@@ -240,16 +306,12 @@ function createBaseDefinition(
|
|
|
240
306
|
...(usePrismaLayer && { layers: [{ Ref: 'PrismaLambdaLayer' }] }),
|
|
241
307
|
skipEsbuild: true, // Handlers in node_modules don't need bundling
|
|
242
308
|
package: skipEsbuildPackageConfig,
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
},
|
|
250
|
-
},
|
|
251
|
-
{ httpApi: { path: '/api/authorize', method: 'ANY' } },
|
|
252
|
-
],
|
|
309
|
+
// Every Management API path the auth Lambda serves (v1, v2 per
|
|
310
|
+
// resource, the OAuth redirect) comes from core's route
|
|
311
|
+
// registry. HTTP API has no implicit catch-all, so an unlisted
|
|
312
|
+
// prefix 404s at the gateway before Express sees it. Guarded by
|
|
313
|
+
// __tests__/management-api-gateway-routes.test.js.
|
|
314
|
+
events: managementApiEvents(AppDefinition, 'auth'),
|
|
253
315
|
},
|
|
254
316
|
user: {
|
|
255
317
|
handler: 'node_modules/@friggframework/core/handlers/routers/user.handler',
|
|
@@ -266,6 +328,8 @@ function createBaseDefinition(
|
|
|
266
328
|
events: [
|
|
267
329
|
{ httpApi: { path: '/health', method: 'GET' } },
|
|
268
330
|
{ httpApi: { path: '/health/{proxy+}', method: 'GET' } },
|
|
331
|
+
// GET /api/meta and the OpenAPI documents: public, DB-free.
|
|
332
|
+
...managementApiEvents(AppDefinition, 'health'),
|
|
269
333
|
],
|
|
270
334
|
},
|
|
271
335
|
// Reporting is an admin operation (ADR-010): the report router runs on the admin-scripts Lambda, not as a standalone function here.
|