@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.
Files changed (46) hide show
  1. package/README.md +0 -14
  2. package/frigg-cli/README.md +0 -6
  3. package/frigg-cli/__tests__/unit/commands/provider-dispatch.test.js +140 -0
  4. package/frigg-cli/__tests__/unit/dependencies.test.js +5 -3
  5. package/frigg-cli/build-command/index.js +32 -1
  6. package/frigg-cli/deploy-command/index.js +50 -2
  7. package/frigg-cli/doctor-command/index.js +7 -0
  8. package/frigg-cli/generate-iam-command.js +7 -0
  9. package/frigg-cli/index.js +0 -3
  10. package/frigg-cli/package.json +3 -3
  11. package/frigg-cli/repair-command/index.js +7 -0
  12. package/frigg-cli/start-command/index.js +58 -0
  13. package/frigg-cli/utils/provider-helper.js +80 -0
  14. package/infrastructure/README.md +4 -22
  15. package/infrastructure/__tests__/create-frigg-infrastructure-provider.test.js +64 -0
  16. package/infrastructure/__tests__/management-api-gateway-routes.test.js +335 -0
  17. package/infrastructure/__tests__/template-generation.test.js +7 -0
  18. package/infrastructure/create-frigg-infrastructure.js +14 -0
  19. package/infrastructure/domains/admin-scripts/admin-script-builder.js +48 -56
  20. package/infrastructure/domains/admin-scripts/admin-script-builder.test.js +7 -76
  21. package/infrastructure/domains/database/migration-builder.js +175 -182
  22. package/infrastructure/domains/database/migration-builder.test.js +5 -36
  23. package/infrastructure/domains/integration/integration-builder.js +61 -65
  24. package/infrastructure/domains/integration/integration-builder.test.js +8 -73
  25. package/infrastructure/domains/parameters/offload-utils.js +1 -0
  26. package/infrastructure/domains/shared/environment-builder.js +12 -1
  27. package/infrastructure/domains/shared/environment-builder.test.js +20 -0
  28. package/infrastructure/domains/shared/types/app-definition.js +15 -1
  29. package/infrastructure/domains/shared/utilities/base-definition-factory.js +150 -86
  30. package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +111 -96
  31. package/infrastructure/domains/shared/utilities/logging-config.js +4 -3
  32. package/infrastructure/domains/shared/utilities/logging-config.test.js +2 -1
  33. package/infrastructure/infrastructure-composer.test.js +10 -3
  34. package/infrastructure/provider-build.js +119 -0
  35. package/infrastructure/scripts/build-prisma-layer.js +32 -5
  36. package/infrastructure/scripts/build-prisma-layer.test.js +35 -0
  37. package/package.json +8 -11
  38. package/test/npm-install-guard.js +104 -0
  39. package/test/npm-install-guard.test.js +53 -0
  40. package/frigg-cli/__tests__/unit/utils/node-version.test.js +0 -66
  41. package/frigg-cli/utils/node-version.js +0 -51
  42. package/infrastructure/__tests__/package-patterns-composition.test.js +0 -153
  43. package/infrastructure/domains/shared/utilities/framework-version.js +0 -14
  44. package/infrastructure/domains/shared/utilities/framework-version.test.js +0 -27
  45. package/infrastructure/domains/shared/utilities/package-patterns.js +0 -35
  46. 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.patterns).toContain('!node_modules/aws-sdk/**');
890
- expect(result.functions.testWebhook.package.patterns).toContain('!node_modules/@prisma/**');
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.patterns).not.toEqual(
986
- expect.arrayContaining(['!node_modules/@prisma/**'])
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?.patterns);
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.patterns).toContain('!node_modules/**/node_modules/**');
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.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/**');
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
  });
@@ -40,6 +40,7 @@ const FRAMEWORK_ENV_BLOCKLIST = new Set([
40
40
  'KMS_KEY_ARN',
41
41
  'AES_KEY',
42
42
  'AES_KEY_ID',
43
+ 'FRIGG_ENCRYPTION_DISABLED',
43
44
  'DATABASE_URL',
44
45
  'DATABASE_HOST',
45
46
  'DATABASE_PORT',
@@ -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}', // Used by encryption bypass logic
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 - Cloud provider (e.g., 'aws')
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 { OSLS_FRAMEWORK_VERSION } = require('./framework-version');
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
- 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
- ] : []),
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
- // Exclude AWS SDK (provided by Lambda runtime)
63
- 'node_modules/aws-sdk/**',
64
- 'node_modules/@aws-sdk/**',
78
+ // Exclude AWS SDK (provided by Lambda runtime)
79
+ 'node_modules/aws-sdk/**',
80
+ 'node_modules/@aws-sdk/**',
65
81
 
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/**',
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
- ...nestedNodeModulesExcludes(AppDefinition, usePrismaLayer),
90
+ ...nestedNodeModulesExcludes(AppDefinition, usePrismaLayer),
75
91
 
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!
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
- // 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',
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
- // 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
- }),
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: OSLS_FRAMEWORK_VERSION,
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
- // Emitted only when true: osls 4 accepts `useDotenv: true` or no key (ADR-050).
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
- events: [
244
- { httpApi: { path: '/api/integrations', method: 'ANY' } },
245
- {
246
- httpApi: {
247
- path: '/api/integrations/{proxy+}',
248
- method: 'ANY',
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.