@friggframework/devtools 2.0.0--canary.704.6a606c3.0 → 2.0.0--canary.703.12b980b.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 (65) hide show
  1. package/README.md +0 -14
  2. package/frigg-cli/README.md +30 -83
  3. package/frigg-cli/__tests__/unit/commands/deploy-subscriptions-step.test.js +35 -0
  4. package/frigg-cli/__tests__/unit/commands/generate-iam.test.js +0 -18
  5. package/frigg-cli/__tests__/unit/commands/install.test.js +341 -594
  6. package/frigg-cli/__tests__/unit/dependencies.test.js +5 -3
  7. package/frigg-cli/deploy-command/index.js +3 -0
  8. package/frigg-cli/deploy-command/subscriptions-step.js +44 -0
  9. package/frigg-cli/generate-command/index.js +0 -1
  10. package/frigg-cli/generate-iam-command.js +0 -1
  11. package/frigg-cli/index.js +6 -12
  12. package/frigg-cli/init-command/backend-first-handler.js +554 -397
  13. package/frigg-cli/init-command/index.js +35 -82
  14. package/frigg-cli/install-command/commit-changes.js +8 -40
  15. package/frigg-cli/install-command/environment-variables.js +0 -15
  16. package/frigg-cli/install-command/index.js +21 -96
  17. package/frigg-cli/install-command/install-package.js +4 -77
  18. package/frigg-cli/install-command/integration-file.js +11 -20
  19. package/frigg-cli/install-command/template.js +75 -102
  20. package/frigg-cli/install-command/validate-package.js +4 -36
  21. package/frigg-cli/package.json +3 -3
  22. package/frigg-cli/test/init-command.test.js +2 -9
  23. package/infrastructure/README.md +0 -20
  24. package/infrastructure/docs/POSTGRES-CONFIGURATION.md +1 -21
  25. package/infrastructure/domains/admin-scripts/admin-script-builder.js +46 -50
  26. package/infrastructure/domains/admin-scripts/admin-script-builder.test.js +7 -46
  27. package/infrastructure/domains/database/aurora-builder.js +2 -13
  28. package/infrastructure/domains/database/aurora-builder.test.js +0 -22
  29. package/infrastructure/domains/database/migration-builder.js +175 -182
  30. package/infrastructure/domains/database/migration-builder.test.js +5 -36
  31. package/infrastructure/domains/integration/define-integration-provisioning.test.js +59 -0
  32. package/infrastructure/domains/integration/integration-builder.js +80 -65
  33. package/infrastructure/domains/integration/integration-builder.test.js +30 -73
  34. package/infrastructure/domains/scheduler/trigger-builder.js +114 -0
  35. package/infrastructure/domains/scheduler/trigger-builder.test.js +82 -0
  36. package/infrastructure/domains/security/iam-generator.js +5 -112
  37. package/infrastructure/domains/security/iam-generator.test.js +0 -94
  38. package/infrastructure/domains/shared/function-environments.js +9 -1
  39. package/infrastructure/domains/shared/function-environments.test.js +14 -0
  40. package/infrastructure/domains/shared/utilities/base-definition-factory.js +124 -83
  41. package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +26 -116
  42. package/infrastructure/domains/shared/utilities/logging-config.js +4 -3
  43. package/infrastructure/domains/shared/utilities/logging-config.test.js +2 -1
  44. package/infrastructure/infrastructure-composer.js +2 -0
  45. package/infrastructure/infrastructure-composer.test.js +3 -3
  46. package/package.json +8 -13
  47. package/frigg-cli/__tests__/unit/commands/init.test.js +0 -688
  48. package/frigg-cli/__tests__/unit/utils/node-version.test.js +0 -66
  49. package/frigg-cli/init-command/deployment-modes.js +0 -7
  50. package/frigg-cli/init-command/safe-path.js +0 -58
  51. package/frigg-cli/init-command/scaffold-dependencies.js +0 -202
  52. package/frigg-cli/install-command/app-definition.js +0 -174
  53. package/frigg-cli/install-command/resolve-module.js +0 -69
  54. package/frigg-cli/templates/backend/README.md +0 -267
  55. package/frigg-cli/templates/backend/env.example +0 -20
  56. package/frigg-cli/templates/backend/gitignore +0 -10
  57. package/frigg-cli/templates/backend/index.js +0 -114
  58. package/frigg-cli/templates/backend/infrastructure.js +0 -20
  59. package/frigg-cli/utils/node-version.js +0 -51
  60. package/infrastructure/__tests__/package-patterns-composition.test.js +0 -153
  61. package/infrastructure/__tests__/scaffold-default-infrastructure.test.js +0 -148
  62. package/infrastructure/domains/shared/utilities/framework-version.js +0 -14
  63. package/infrastructure/domains/shared/utilities/framework-version.test.js +0 -27
  64. package/infrastructure/domains/shared/utilities/package-patterns.js +0 -35
  65. package/infrastructure/domains/shared/utilities/package-patterns.test.js +0 -112
@@ -1,117 +1,90 @@
1
- /**
2
- * Source for a new integration class (`src/integrations/<Name>Integration.js`)
3
- * that wraps one installed API module.
4
- *
5
- * It follows the current IntegrationBase contract: a static `Definition`
6
- * (name, version, display, `modules: { <key>: { definition } }`) and event
7
- * handlers registered on `this.events` in the constructor. Calls to the API
8
- * module go through `this.<key>.api.<method>()`.
9
- */
1
+ const path = require('path');
10
2
 
11
- /** Turn an arbitrary label (e.g. "Google Drive", "Monday.com") into a JS identifier. */
12
- function toIdentifier(label) {
13
- const words = String(label)
14
- .split(/[^A-Za-z0-9]+/)
15
- .filter(Boolean);
16
- let identifier = words
17
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
18
- .join('');
19
- if (!identifier) {
20
- identifier = 'Module';
21
- }
22
- if (/^[0-9]/.test(identifier)) {
23
- identifier = `Module${identifier}`;
24
- }
25
- return identifier;
26
- }
3
+ function getIntegrationTemplate(apiModuleName, backendPath, ApiClass) {
4
+ // Find the sample data method
5
+ const apiMethods = Object.getOwnPropertyNames(ApiClass.prototype);
6
+ const sampleDataMethod =
7
+ apiMethods.find(
8
+ (method) =>
9
+ method.toLowerCase().includes('search') ||
10
+ method.toLowerCase().includes('list') ||
11
+ method.toLowerCase().includes('get')
12
+ ) || 'searchDeals';
27
13
 
28
- /** camelCase key for `Definition.modules` (e.g. "google-drive" -> "googleDrive"). */
29
- function toModuleKey(moduleName) {
30
- const words = String(moduleName)
31
- .split(/[^A-Za-z0-9]+/)
32
- .filter(Boolean);
33
- if (words.length === 0) {
34
- return 'module';
35
- }
36
- const key = words
37
- .map((word, i) =>
38
- i === 0
39
- ? word.charAt(0).toLowerCase() + word.slice(1)
40
- : word.charAt(0).toUpperCase() + word.slice(1)
41
- )
42
- .join('');
43
- return /^[0-9]/.test(key) ? `module${key}` : key;
44
- }
14
+ return `const { get, IntegrationBase, Options } = require('@friggframework/core');
15
+ const { Definition: ${apiModuleName}Module, Config: defaultConfig } = require('@friggframework/api-module-${apiModuleName.toLowerCase()}');
45
16
 
46
- const quote = (value) => JSON.stringify(value === undefined ? '' : value);
17
+ class ${apiModuleName}Integration extends IntegrationBase {
18
+ static Config = {
19
+ name: defaultConfig.name || '${apiModuleName.toLowerCase()}',
20
+ version: '1.0.0',
21
+ supportedVersions: ['1.0.0'],
22
+ events: ['SEARCH_DEALS'],
23
+ };
47
24
 
48
- /**
49
- * @param {object} params
50
- * @param {string} params.className - e.g. `HubSpotIntegration`
51
- * @param {string} params.packageName - e.g. `@friggframework/api-module-hubspot`
52
- * @param {string} params.moduleName - The module's `Definition.getName()`
53
- * @param {string} params.label - Human-readable name
54
- * @param {string} [params.description]
55
- * @param {string} [params.detailsUrl]
56
- * @param {string} [params.icon]
57
- * @param {string[]} [params.categories]
58
- * @returns {string}
59
- */
60
- function getIntegrationTemplate({
61
- className,
62
- packageName,
63
- moduleName,
64
- label,
65
- description,
66
- detailsUrl,
67
- icon,
68
- categories,
69
- }) {
70
- const moduleKey = toModuleKey(moduleName);
71
- const moduleVar = `${moduleKey}Module`;
72
- const category = Array.isArray(categories) ? categories.join(', ') : '';
25
+ static Options =
26
+ new Options({
27
+ module: ${apiModuleName}Module,
28
+ integrations: [${apiModuleName}Module],
29
+ display: {
30
+ name: defaultConfig.displayName || '${apiModuleName}',
31
+ description: defaultConfig.description || 'Sales & CRM, Marketing',
32
+ category: defaultConfig.category || 'Sales & CRM, Marketing',
33
+ detailsUrl: defaultConfig.detailsUrl || 'https://www.${apiModuleName.toLowerCase()}.com',
34
+ icon: defaultConfig.icon || 'https://friggframework.org/assets/img/${apiModuleName.toLowerCase()}.jpeg',
35
+ },
36
+ hasUserConfig: true,
37
+ });
73
38
 
74
- return `const { IntegrationBase } = require('@friggframework/core');
75
- const ${moduleVar} = require(${quote(packageName)});
39
+ static modules = {
40
+ ${apiModuleName.toLowerCase()}: ${apiModuleName}Module,
41
+ }
76
42
 
77
- class ${className} extends IntegrationBase {
78
- static Definition = {
79
- name: ${quote(moduleName)},
80
- version: '1.0.0',
81
- supportedVersions: ['1.0.0'],
82
- hasUserConfig: false,
43
+ /**
44
+ * HANDLE EVENTS
45
+ */
46
+ async receiveNotification(notifier, event, object = null) {
47
+ if (event === 'SEARCH_DEALS') {
48
+ return this.target.api.searchDeals(object);
49
+ }
50
+ }
83
51
 
84
- display: {
85
- label: ${quote(label)},
86
- description: ${quote(description)},
87
- category: ${quote(category)},
88
- detailsUrl: ${quote(detailsUrl)},
89
- icon: ${quote(icon)},
90
- },
52
+ /**
53
+ * ALL CUSTOM/OPTIONAL METHODS FOR AN INTEGRATION MANAGER
54
+ */
55
+ async getSampleData() {
56
+ const res = await this.target.api.${sampleDataMethod}();
57
+ return { data: res };
58
+ }
91
59
 
92
- // The API modules this integration uses. Each key becomes
93
- // \`this.<key>\` on an integration instance, e.g.
94
- // \`this.${moduleKey}.api\`.
95
- modules: {
96
- ${moduleKey}: { definition: ${moduleVar}.Definition },
97
- },
60
+ /**
61
+ * ALL REQUIRED METHODS FOR AN INTEGRATION MANAGER
62
+ */
63
+ async onCreate(params) {
64
+ // Validate that we have all of the data we need
65
+ // Set integration status as makes sense. Default ENABLED
66
+ // TODO turn this into a validateConfig method/function
67
+ this.record.status = 'ENABLED';
68
+ await this.record.save();
69
+ return this.record;
70
+ }
98
71
 
99
- // HTTP routes, served under /api/${moduleName}-integration/...
100
- // e.g. { path: '/sample', method: 'GET', event: 'GET_SAMPLE_DATA' }
101
- routes: [],
102
- };
72
+ async onUpdate(params) {
73
+ const newConfig = get(params, 'config');
74
+ const oldConfig = this.record.config;
75
+ // Just save whatever
76
+ this.record.markModified('config');
77
+ await this.record.save();
78
+ return this.validateConfig();
79
+ }
103
80
 
104
- constructor(params) {
105
- super(params);
106
- this.events = {
107
- // Map event names to handlers, e.g.
108
- // GET_SAMPLE_DATA: { handler: this.getSampleData.bind(this) },
109
- };
81
+ async getConfigOptions() {
82
+ const options = {}
83
+ return options;
110
84
  }
111
85
  }
112
86
 
113
- module.exports = ${className};
114
- `;
87
+ module.exports = ${apiModuleName}Integration;`;
115
88
  }
116
89
 
117
- module.exports = { getIntegrationTemplate, toIdentifier, toModuleKey };
90
+ module.exports = { getIntegrationTemplate };
@@ -1,28 +1,12 @@
1
- const spawn = require('cross-spawn');
1
+ const { execSync } = require('child_process');
2
2
  const axios = require('axios');
3
3
  const { logError } = require('./logger');
4
4
  const { checkbox } = require('@inquirer/prompts');
5
5
 
6
- const API_MODULE_PREFIX = '@friggframework/api-module-';
7
-
8
6
  async function searchPackages(apiModuleName) {
9
- // Arguments are passed as an array (no shell), so the search term can
10
- // never be interpreted as a command.
11
- const result = spawn.sync(
12
- 'npm',
13
- ['search', `${API_MODULE_PREFIX}${apiModuleName}`, '--json'],
14
- { encoding: 'utf8' }
15
- );
16
- if (result.error) {
17
- throw result.error;
18
- }
19
- if (result.status !== 0) {
20
- throw new Error(`npm search failed: ${result.stderr || result.status}`);
21
- }
22
- // npm search is a full-text search; keep only Frigg API modules.
23
- return JSON.parse(result.stdout || '[]').filter(
24
- (pkg) => pkg && pkg.name && pkg.name.startsWith(API_MODULE_PREFIX)
25
- );
7
+ const searchCommand = `npm search @friggframework/api-module-${apiModuleName} --json`;
8
+ const result = execSync(searchCommand, { encoding: 'utf8' });
9
+ return JSON.parse(result);
26
10
  }
27
11
 
28
12
  async function checkPackageExists(packageName) {
@@ -74,21 +58,6 @@ const searchAndSelectPackage = async (apiModuleName) => {
74
58
  };
75
59
  });
76
60
 
77
- // Without a terminal to prompt on, take the exact match
78
- // (`frigg install hubspot` -> @friggframework/api-module-hubspot).
79
- if (!process.stdin.isTTY) {
80
- const exact = `${API_MODULE_PREFIX}${apiModuleName}`;
81
- if (filteredResults.some((pkg) => pkg.name === exact)) {
82
- return [exact];
83
- }
84
- logError(
85
- `No exact match for ${exact}, and there is no terminal to choose from: ${filteredResults
86
- .map((pkg) => pkg.name)
87
- .join(', ')}`
88
- );
89
- process.exit(1);
90
- }
91
-
92
61
  const selectedPackages = await checkbox({
93
62
  message: 'Select the packages to install:',
94
63
  choices,
@@ -99,7 +68,6 @@ const searchAndSelectPackage = async (apiModuleName) => {
99
68
  };
100
69
 
101
70
  module.exports = {
102
- API_MODULE_PREFIX,
103
71
  validatePackageExists,
104
72
  checkPackageExists,
105
73
  searchPackages,
@@ -26,7 +26,7 @@
26
26
  "lodash": "4.18.1",
27
27
  "node-cache": "^5.1.2",
28
28
  "open": "^8.4.2",
29
- "osls": "^4.4.0",
29
+ "osls": "^3.58.0",
30
30
  "semver": "^7.6.0",
31
31
  "validate-npm-package-name": "^5.0.0"
32
32
  },
@@ -55,9 +55,9 @@
55
55
  },
56
56
  "homepage": "https://github.com/friggframework/frigg#readme",
57
57
  "engines": {
58
- "node": "^22.13.0 || >=24"
58
+ "node": ">=18"
59
59
  },
60
60
  "publishConfig": {
61
61
  "access": "public"
62
62
  }
63
- }
63
+ }
@@ -123,19 +123,12 @@ describe('Init Command', () => {
123
123
  );
124
124
  });
125
125
 
126
- it('forwards every supported init flag to BackendFirstHandler', async () => {
127
- // The flags `frigg init` registers and initCommand forwards
128
- // (see init-command/index.js). `yes` is the non-interactive flag
129
- // (`--yes`: accept defaults, no prompts); `install: false` and
130
- // `git: false` are what `--no-install` / `--no-git` produce. The
131
- // old `frontend` option is gone: init scaffolds a backend only.
126
+ it('should pass options to BackendFirstHandler', async () => {
132
127
  const options = {
133
128
  force: true,
134
129
  verbose: true,
135
130
  mode: 'standalone',
136
- yes: true,
137
- install: false,
138
- git: false
131
+ frontend: false
139
132
  };
140
133
 
141
134
  await initCommand(mockProjectName, options);
@@ -207,26 +207,6 @@ STAGE=production
207
207
  SERVICE_NAME=my-frigg-app
208
208
  ```
209
209
 
210
- ## Packaging (osls 4)
211
-
212
- The composed definition targets osls `^4.4.0`
213
- ([ADR-050](../../../docs/architecture-decisions/050-osls-4.md)):
214
-
215
- - `frameworkVersion` is `OSLS_FRAMEWORK_VERSION` (`^4.4.0`,
216
- `domains/shared/utilities/framework-version.js`). It is the single place the version is set.
217
- - Every packaged function gets `package.patterns`, built by `toPackagePatterns({ include, exclude })`
218
- (`domains/shared/utilities/package-patterns.js`): excludes negated first, then includes. Builders
219
- keep plain include/exclude lists and pass them through the helper; never emit
220
- `package.include`/`package.exclude`. `nestedNodeModulesExcludes()` output goes through the same
221
- helper.
222
- - `useDotenv: true` is emitted only for `osls offline` (`frigg start`); otherwise the key is absent.
223
- - `custom.esbuild.exclude` is a serverless-esbuild option and stays as it is.
224
-
225
- `__tests__/package-patterns-composition.test.js` walks every function of a fully featured
226
- definition and fails if any of these rules is broken. Size budget: each function under 100 MB
227
- unzipped, function + layers under 200 MB (Lambda's hard limit is 250 MB); see
228
- [the measurements](../../../docs/reference/aws-sdk-v3-osls-migration.md#package-size-budget).
229
-
230
210
  ## Lambda Layers
231
211
 
232
212
  ### Prisma Layer
@@ -11,30 +11,10 @@ Frigg Framework supports automatic provisioning of Amazon Aurora Serverless v2 P
11
11
  - **Aurora Serverless v2**: Cost-efficient auto-scaling database (0.5-1.0 ACU default)
12
12
  - **VPC Integration**: Deployed in same private subnets as Lambda functions
13
13
  - **Secrets Manager**: Automatic credential management and rotation
14
- - **Management Modes**: discover, create-new, use-existing, external (bring your own `DATABASE_URL`)
14
+ - **Three Management Modes**: discover, create-new, use-existing
15
15
  - **Security**: Private subnet deployment with security group isolation
16
16
  - **High Availability**: Multi-AZ deployment with automatic failover
17
17
 
18
- ### Bring your own PostgreSQL (`management: 'external'`)
19
-
20
- To connect to a PostgreSQL that Frigg does not manage (any hosted provider, or
21
- a database you run yourself), set `management: 'external'`. Frigg then creates
22
- and discovers no database resources (no RDS/Aurora, no Secrets Manager secret)
23
- and needs no VPC for the database; the app connects through `DATABASE_URL`.
24
- This check takes precedence over a top-level `managementMode`. The migration
25
- infrastructure is still composed, so migrations run against `DATABASE_URL`.
26
-
27
- ```javascript
28
- const appDefinition = {
29
- vpc: { enable: false },
30
- database: { postgres: { enable: true, management: 'external' } },
31
- environment: { DATABASE_URL: true }, // read from the shell that runs `frigg deploy` (not .env)
32
- };
33
- ```
34
-
35
- Use `sslmode=require` in the URL. This is the default for apps scaffolded by
36
- `frigg init`.
37
-
38
18
  ---
39
19
 
40
20
  ## Configuration Schema
@@ -16,7 +16,6 @@
16
16
  const { InfrastructureBuilder, ValidationResult } = require('../shared/base-builder');
17
17
  const { isScopedEnvironmentActive } = require('../shared/function-environments');
18
18
  const { nestedNodeModulesExcludes } = require('../shared/utilities/nested-node-modules');
19
- const { toPackagePatterns } = require('../shared/utilities/package-patterns');
20
19
 
21
20
  class AdminScriptBuilder extends InfrastructureBuilder {
22
21
  constructor() {
@@ -398,55 +397,52 @@ class AdminScriptBuilder extends InfrastructureBuilder {
398
397
  skipEsbuildPackageConfig(appDefinition, usePrismaLayer) {
399
398
  const tlsCAFile = appDefinition?.database?.documentDB?.tlsCAFile;
400
399
  return {
401
- // osls 4 only reads package.patterns (ADR-050): excludes first, then includes.
402
- patterns: toPackagePatterns({
403
- include: [
404
- // Handlers connect to the DB, so ship the DocumentDB CA cert.
405
- ...(tlsCAFile ? [tlsCAFile.replace(/^\.\//, '')] : []),
406
- ],
407
- exclude: [
408
- 'node_modules/aws-sdk/**',
409
- 'node_modules/@aws-sdk/**',
410
- ...(usePrismaLayer
411
- ? [
412
- 'node_modules/@prisma/**',
413
- 'node_modules/.prisma/**',
414
- 'node_modules/prisma/**',
415
- 'node_modules/@friggframework/core/generated/**',
416
- ]
417
- : []),
418
- ...nestedNodeModulesExcludes(appDefinition, usePrismaLayer),
419
- 'node_modules/@friggframework/test/**',
420
- 'node_modules/@friggframework/eslint-config/**',
421
- 'node_modules/@friggframework/prettier-config/**',
422
- 'node_modules/jest/**',
423
- 'node_modules/prettier/**',
424
- 'node_modules/eslint/**',
425
- 'node_modules/esbuild/**',
426
- 'node_modules/@esbuild/**',
427
- 'node_modules/typescript/**',
428
- 'node_modules/webpack/**',
429
- 'node_modules/osls/**',
430
- 'node_modules/serverless-esbuild/**',
431
- 'node_modules/serverless-jetpack/**',
432
- 'node_modules/serverless-offline/**',
433
- 'node_modules/serverless-offline-sqs/**',
434
- 'node_modules/serverless-dotenv-plugin/**',
435
- 'node_modules/serverless-kms-grants/**',
436
- // Never deploy secrets or the lockfile.
437
- '.env',
438
- '.env.*',
439
- '**/.env',
440
- '**/.env.*',
441
- '.frigg-credentials.json',
442
- 'package-lock.json',
443
- 'test/**',
444
- 'layers/**',
445
- 'coverage/**',
446
- '**/*.test.js',
447
- '**/*.spec.js',
448
- ],
449
- }),
400
+ include: [
401
+ // Handlers connect to the DB, so ship the DocumentDB CA cert.
402
+ ...(tlsCAFile ? [tlsCAFile.replace(/^\.\//, '')] : []),
403
+ ],
404
+ exclude: [
405
+ 'node_modules/aws-sdk/**',
406
+ 'node_modules/@aws-sdk/**',
407
+ ...(usePrismaLayer
408
+ ? [
409
+ 'node_modules/@prisma/**',
410
+ 'node_modules/.prisma/**',
411
+ 'node_modules/prisma/**',
412
+ 'node_modules/@friggframework/core/generated/**',
413
+ ]
414
+ : []),
415
+ ...nestedNodeModulesExcludes(appDefinition, usePrismaLayer),
416
+ 'node_modules/@friggframework/test/**',
417
+ 'node_modules/@friggframework/eslint-config/**',
418
+ 'node_modules/@friggframework/prettier-config/**',
419
+ 'node_modules/jest/**',
420
+ 'node_modules/prettier/**',
421
+ 'node_modules/eslint/**',
422
+ 'node_modules/esbuild/**',
423
+ 'node_modules/@esbuild/**',
424
+ 'node_modules/typescript/**',
425
+ 'node_modules/webpack/**',
426
+ 'node_modules/osls/**',
427
+ 'node_modules/serverless-esbuild/**',
428
+ 'node_modules/serverless-jetpack/**',
429
+ 'node_modules/serverless-offline/**',
430
+ 'node_modules/serverless-offline-sqs/**',
431
+ 'node_modules/serverless-dotenv-plugin/**',
432
+ 'node_modules/serverless-kms-grants/**',
433
+ // Never deploy secrets or the lockfile.
434
+ '.env',
435
+ '.env.*',
436
+ '**/.env',
437
+ '**/.env.*',
438
+ '.frigg-credentials.json',
439
+ 'package-lock.json',
440
+ 'test/**',
441
+ 'layers/**',
442
+ 'coverage/**',
443
+ '**/*.test.js',
444
+ '**/*.spec.js',
445
+ ],
450
446
  };
451
447
  }
452
448
 
@@ -285,11 +285,11 @@ describe('AdminScriptBuilder', () => {
285
285
  result.functions.adminScriptExecutor,
286
286
  result.functions.adminScriptRouter,
287
287
  ]) {
288
- expect(fn.package.patterns).toEqual(
288
+ expect(fn.package.exclude).toEqual(
289
289
  expect.arrayContaining([
290
- '!node_modules/aws-sdk/**',
291
- '!node_modules/@aws-sdk/**',
292
- '!node_modules/@prisma/**',
290
+ 'node_modules/aws-sdk/**',
291
+ 'node_modules/@aws-sdk/**',
292
+ 'node_modules/@prisma/**',
293
293
  ])
294
294
  );
295
295
  }
@@ -1029,7 +1029,7 @@ describe('AdminScriptBuilder nested node_modules (lambda.keepNestedNodeModules)'
1029
1029
  const result = await new AdminScriptBuilder().build(appDefinition(), {});
1030
1030
 
1031
1031
  for (const fn of executorAndRouter(result)) {
1032
- expect(fn.package.patterns).toContain('!node_modules/**/node_modules/**');
1032
+ expect(fn.package.exclude).toContain('node_modules/**/node_modules/**');
1033
1033
  }
1034
1034
  });
1035
1035
 
@@ -1040,47 +1040,8 @@ describe('AdminScriptBuilder nested node_modules (lambda.keepNestedNodeModules)'
1040
1040
  );
1041
1041
 
1042
1042
  for (const fn of executorAndRouter(result)) {
1043
- expect(fn.package.patterns).not.toContain('!node_modules/**/node_modules/**');
1044
- expect(fn.package.patterns).toContain('!node_modules/**/node_modules/@friggframework/**');
1043
+ expect(fn.package.exclude).not.toContain('node_modules/**/node_modules/**');
1044
+ expect(fn.package.exclude).toContain('node_modules/**/node_modules/@friggframework/**');
1045
1045
  }
1046
1046
  });
1047
1047
  });
1048
-
1049
- describe('AdminScriptBuilder function package patterns (ADR-050)', () => {
1050
- it('emits package.patterns, never include/exclude, on every skipEsbuild function', async () => {
1051
- const result = await new AdminScriptBuilder().build(
1052
- {
1053
- adminScripts: [{ Definition: { name: 'test-script' } }],
1054
- reports: [{ Definition: { name: 'test-report' } }],
1055
- },
1056
- {}
1057
- );
1058
-
1059
- const packaged = Object.entries(result.functions).filter(([, fn]) => fn.package);
1060
- expect(packaged.map(([name]) => name)).toEqual(
1061
- expect.arrayContaining(['adminScriptExecutor', 'adminScriptRouter'])
1062
- );
1063
- for (const [, fn] of packaged) {
1064
- expect(fn.package).not.toHaveProperty('include');
1065
- expect(fn.package).not.toHaveProperty('exclude');
1066
- expect(fn.package.patterns.every((p) => p.startsWith('!'))).toBe(true);
1067
- expect(fn.package.patterns).toEqual(
1068
- expect.arrayContaining(['!node_modules/aws-sdk/**', '!.env', '!test/**'])
1069
- );
1070
- }
1071
- });
1072
-
1073
- it('re-adds the DocumentDB CA file after every exclude', async () => {
1074
- const result = await new AdminScriptBuilder().build(
1075
- {
1076
- adminScripts: [{ Definition: { name: 'test-script' } }],
1077
- database: { documentDB: { tlsCAFile: './global-bundle.pem' } },
1078
- },
1079
- {}
1080
- );
1081
-
1082
- const { patterns } = result.functions.adminScriptExecutor.package;
1083
- expect(patterns[patterns.length - 1]).toBe('global-bundle.pem');
1084
- expect(patterns.slice(0, -1).every((p) => p.startsWith('!'))).toBe(true);
1085
- });
1086
- });
@@ -64,18 +64,7 @@ class AuroraBuilder extends InfrastructureBuilder {
64
64
  return false;
65
65
  }
66
66
 
67
- const postgres = appDefinition.database?.postgres;
68
-
69
- // management='external': the app brings its own PostgreSQL (any
70
- // provider) and connects through DATABASE_URL. Frigg creates and
71
- // discovers no database resources and needs no VPC for it. This
72
- // check precedes managementMode, which otherwise always manages
73
- // Aurora. Migrations still run (MigrationBuilder) against DATABASE_URL.
74
- if (postgres?.management === 'external') {
75
- return false;
76
- }
77
-
78
- return postgres?.enable === true;
67
+ return appDefinition.database?.postgres?.enable === true;
79
68
  }
80
69
 
81
70
  getDependencies() {
@@ -93,7 +82,7 @@ class AuroraBuilder extends InfrastructureBuilder {
93
82
  const dbConfig = appDefinition.database.postgres;
94
83
 
95
84
  // Validate management mode
96
- const validModes = ['discover', 'managed', 'use-existing', 'external'];
85
+ const validModes = ['discover', 'managed', 'use-existing'];
97
86
  const management = dbConfig.management || 'discover';
98
87
  if (!validModes.includes(management)) {
99
88
  result.addError(`Invalid database.postgres.management: "${management}"`);
@@ -42,28 +42,6 @@ describe('AuroraBuilder', () => {
42
42
  expect(auroraBuilder.shouldExecute(appDefinition)).toBe(false);
43
43
  });
44
44
 
45
- it('should return false when Postgres is external (bring your own DATABASE_URL)', () => {
46
- const appDefinition = {
47
- database: {
48
- postgres: { enable: true, management: 'external' },
49
- },
50
- };
51
-
52
- expect(auroraBuilder.shouldExecute(appDefinition)).toBe(false);
53
- });
54
-
55
- it('should return false for external Postgres even with managementMode=managed', () => {
56
- const appDefinition = {
57
- managementMode: 'managed',
58
- vpcIsolation: 'isolated',
59
- database: {
60
- postgres: { enable: true, management: 'external' },
61
- },
62
- };
63
-
64
- expect(auroraBuilder.shouldExecute(appDefinition)).toBe(false);
65
- });
66
-
67
45
  it('should return false when database is not defined', () => {
68
46
  const appDefinition = {};
69
47