@friggframework/devtools 2.0.0--canary.731.ffe61d3.0 → 2.0.0--canary.658.130b4ec.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/frigg-cli/README.md +31 -115
- package/frigg-cli/__tests__/unit/commands/build.test.js +0 -3
- package/frigg-cli/__tests__/unit/commands/deploy.test.js +24 -33
- package/frigg-cli/__tests__/unit/commands/doctor.test.js +6 -10
- package/frigg-cli/__tests__/unit/commands/generate-iam.test.js +0 -18
- package/frigg-cli/__tests__/unit/commands/install.test.js +341 -601
- package/frigg-cli/__tests__/unit/commands/ui.test.js +30 -31
- package/frigg-cli/__tests__/unit/dependencies.test.js +2 -6
- package/frigg-cli/build-command/index.js +0 -6
- package/frigg-cli/deploy-command/index.js +0 -6
- package/frigg-cli/generate-command/index.js +0 -1
- package/frigg-cli/generate-iam-command.js +0 -1
- package/frigg-cli/index.js +5 -22
- package/frigg-cli/index.test.js +158 -0
- package/frigg-cli/init-command/backend-first-handler.js +551 -395
- package/frigg-cli/init-command/index.js +35 -82
- package/frigg-cli/install-command/commit-changes.js +8 -40
- package/frigg-cli/install-command/environment-variables.js +0 -15
- package/frigg-cli/install-command/index.js +21 -96
- package/frigg-cli/install-command/install-package.js +4 -77
- package/frigg-cli/install-command/integration-file.js +11 -20
- package/frigg-cli/install-command/template.js +75 -102
- package/frigg-cli/install-command/validate-package.js +4 -36
- package/frigg-cli/package.json +1 -1
- package/frigg-cli/start-command/index.js +0 -4
- package/frigg-cli/start-command/start-command.test.js +0 -3
- package/frigg-cli/test/init-command.test.js +2 -9
- package/infrastructure/README.md +5 -32
- package/infrastructure/__tests__/postgres-config.test.js +836 -245
- package/infrastructure/__tests__/scoped-environment.test.js +0 -3
- package/infrastructure/__tests__/ssm-preload-node-options.test.js +0 -3
- package/infrastructure/__tests__/template-generation.test.js +8 -39
- package/infrastructure/create-frigg-infrastructure.js +1 -4
- package/infrastructure/docs/POSTGRES-CONFIGURATION.md +98 -80
- package/infrastructure/domains/admin-scripts/admin-script-builder.js +2 -8
- package/infrastructure/domains/admin-scripts/admin-script-builder.test.js +6 -52
- package/infrastructure/domains/database/aurora-builder.js +2 -13
- package/infrastructure/domains/database/aurora-builder.test.js +0 -22
- package/infrastructure/domains/database/migration-builder.js +2 -21
- package/infrastructure/domains/database/migration-builder.test.js +6 -61
- package/infrastructure/domains/health/application/use-cases/__tests__/mismatch-analyzer-method-name.test.js +8 -12
- package/infrastructure/domains/health/application/use-cases/__tests__/repair-via-import-use-case.test.js +7 -19
- package/infrastructure/domains/health/application/use-cases/run-health-check-use-case.test.js +8 -12
- package/infrastructure/domains/health/domain/services/__tests__/import-progress-monitor.test.js +18 -17
- package/infrastructure/domains/health/domain/services/__tests__/update-progress-monitor.test.js +2 -12
- package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-relationship-analysis.test.js +1 -8
- package/infrastructure/domains/health/infrastructure/adapters/aws-property-reconciler.test.js +2 -4
- package/infrastructure/domains/health/infrastructure/adapters/aws-resource-detector.test.js +0 -10
- package/infrastructure/domains/integration/integration-builder.js +0 -2
- package/infrastructure/domains/integration/integration-builder.test.js +6 -22
- package/infrastructure/domains/networking/vpc-builder.js +8 -18
- package/infrastructure/domains/networking/vpc-builder.test.js +12 -26
- package/infrastructure/domains/security/iam-generator.js +5 -112
- package/infrastructure/domains/security/iam-generator.test.js +0 -94
- package/infrastructure/domains/shared/cloudformation-discovery.test.js +6 -36
- package/infrastructure/domains/shared/environment-builder.js +5 -31
- package/infrastructure/domains/shared/environment-builder.test.js +7 -93
- package/infrastructure/domains/shared/utilities/base-definition-factory.js +3 -39
- package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +5 -85
- package/infrastructure/domains/shared/utilities/nested-node-modules.js +5 -6
- package/infrastructure/domains/shared/utilities/nested-node-modules.test.js +26 -20
- package/infrastructure/domains/shared/utilities/prisma-layer-manager.js +12 -92
- package/infrastructure/domains/shared/utilities/prisma-layer-manager.test.js +6 -158
- package/infrastructure/infrastructure-composer.js +1 -12
- package/infrastructure/infrastructure-composer.test.js +794 -339
- package/infrastructure/integration.test.js +381 -0
- package/infrastructure/scripts/build-prisma-layer.js +50 -136
- package/infrastructure/scripts/build-prisma-layer.test.js +7 -128
- package/infrastructure/scripts/build-time-discovery.test.js +3 -18
- package/package.json +10 -12
- package/frigg-cli/__tests__/unit/commands/init.test.js +0 -688
- package/frigg-cli/__tests__/unit/commands/validate-wiring.test.js +0 -92
- package/frigg-cli/init-command/deployment-modes.js +0 -7
- package/frigg-cli/init-command/safe-path.js +0 -58
- package/frigg-cli/init-command/scaffold-dependencies.js +0 -202
- package/frigg-cli/install-command/app-definition.js +0 -174
- package/frigg-cli/install-command/resolve-module.js +0 -69
- package/frigg-cli/templates/backend/README.md +0 -267
- package/frigg-cli/templates/backend/env.example +0 -20
- package/frigg-cli/templates/backend/gitignore +0 -10
- package/frigg-cli/templates/backend/index.js +0 -114
- package/frigg-cli/templates/backend/infrastructure.js +0 -20
- package/frigg-cli/validate-command/__tests__/init-validation.test.js +0 -63
- package/frigg-cli/validate-command/__tests__/integrations-checks.test.js +0 -133
- package/frigg-cli/validate-command/__tests__/validate-app-definition.test.js +0 -443
- package/frigg-cli/validate-command/__tests__/validate-command.test.js +0 -262
- package/frigg-cli/validate-command/checks/config.js +0 -504
- package/frigg-cli/validate-command/checks/integrations.js +0 -274
- package/frigg-cli/validate-command/format-report.js +0 -58
- package/frigg-cli/validate-command/index.js +0 -107
- package/frigg-cli/validate-command/load-app-definition.js +0 -105
- package/frigg-cli/validate-command/schema-issues.js +0 -154
- package/frigg-cli/validate-command/validate-app-definition.js +0 -60
- package/infrastructure/__tests__/helpers/bundled-prisma-engine-excludes.js +0 -39
- package/infrastructure/__tests__/management-api-gateway-routes.test.js +0 -284
- package/infrastructure/__tests__/scaffold-default-infrastructure.test.js +0 -151
- package/infrastructure/app-definition-schema-contract.test.js +0 -634
- package/infrastructure/create-frigg-infrastructure.test.js +0 -51
- package/infrastructure/domains/database/migration-engines.js +0 -93
- package/infrastructure/domains/database/migration-engines.test.js +0 -142
- package/infrastructure/domains/shared/lambda-architectures.js +0 -113
- package/infrastructure/domains/shared/lambda-architectures.test.js +0 -164
|
@@ -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
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
29
|
-
|
|
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
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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
|
-
|
|
75
|
-
|
|
39
|
+
static modules = {
|
|
40
|
+
${apiModuleName.toLowerCase()}: ${apiModuleName}Module,
|
|
41
|
+
}
|
|
76
42
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
|
|
100
|
-
|
|
101
|
-
|
|
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
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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 = ${
|
|
114
|
-
`;
|
|
87
|
+
module.exports = ${apiModuleName}Integration;`;
|
|
115
88
|
}
|
|
116
89
|
|
|
117
|
-
module.exports = { getIntegrationTemplate
|
|
90
|
+
module.exports = { getIntegrationTemplate };
|
|
@@ -1,28 +1,12 @@
|
|
|
1
|
-
const
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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,
|
package/frigg-cli/package.json
CHANGED
|
@@ -12,7 +12,6 @@ const {
|
|
|
12
12
|
getDatabaseTypeNotConfiguredError,
|
|
13
13
|
getPrismaClientNotGeneratedError
|
|
14
14
|
} = require('../utils/error-messages');
|
|
15
|
-
const { preflightValidation } = require('../validate-command');
|
|
16
15
|
|
|
17
16
|
async function startCommand(options) {
|
|
18
17
|
if (options.verbose) {
|
|
@@ -26,9 +25,6 @@ async function startCommand(options) {
|
|
|
26
25
|
const envPath = path.join(process.cwd(), '.env');
|
|
27
26
|
dotenv.config({ path: envPath });
|
|
28
27
|
|
|
29
|
-
// Validate the app definition (ADR-051); local development only warns.
|
|
30
|
-
preflightValidation({ command: 'start', options, failOnErrors: false });
|
|
31
|
-
|
|
32
28
|
// Pre-flight database checks
|
|
33
29
|
try {
|
|
34
30
|
await performDatabaseChecks(options.verbose);
|
|
@@ -23,9 +23,6 @@ jest.mock('node:child_process', () => ({
|
|
|
23
23
|
}));
|
|
24
24
|
|
|
25
25
|
jest.mock('../utils/database-validator', () => mockValidator);
|
|
26
|
-
// The app definition validation step is tested in validate-command/.
|
|
27
|
-
jest.mock('../validate-command', () => ({ preflightValidation: jest.fn(() => true) }));
|
|
28
|
-
|
|
29
26
|
jest.mock('dotenv');
|
|
30
27
|
|
|
31
28
|
const { spawn } = require('node:child_process');
|
|
@@ -123,19 +123,12 @@ describe('Init Command', () => {
|
|
|
123
123
|
);
|
|
124
124
|
});
|
|
125
125
|
|
|
126
|
-
it('
|
|
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
|
-
|
|
137
|
-
install: false,
|
|
138
|
-
git: false
|
|
131
|
+
frontend: false
|
|
139
132
|
};
|
|
140
133
|
|
|
141
134
|
await initCommand(mockProjectName, options);
|
package/infrastructure/README.md
CHANGED
|
@@ -285,50 +285,23 @@ const appDefinition = {
|
|
|
285
285
|
|
|
286
286
|
> ℹ️ When `usePrismaLambdaLayer: false`, Prisma stays inside each bundle and the runtime automatically loads the correct binary. No extra configuration is required.
|
|
287
287
|
|
|
288
|
-
**
|
|
288
|
+
**Keeping nested node_modules in Lambda packages:**
|
|
289
289
|
|
|
290
|
-
|
|
290
|
+
By default every function package excludes `node_modules/**/node_modules/**`. npm only nests a package when the root copy cannot satisfy a dependant, so the exclusion makes a package resolve whatever version is hoisted, and it removes the package entirely when the root copy is a dev dependency. The first `require` of such a package then fails at Lambda init with `Runtime.ImportModuleError`.
|
|
291
291
|
|
|
292
|
-
|
|
292
|
+
To ship the dependency tree the way npm resolved it, opt in per app:
|
|
293
293
|
|
|
294
294
|
```javascript
|
|
295
295
|
const appDefinition = {
|
|
296
296
|
name: 'my-app',
|
|
297
297
|
lambda: {
|
|
298
|
-
keepNestedNodeModules:
|
|
298
|
+
keepNestedNodeModules: true,
|
|
299
299
|
},
|
|
300
300
|
integrations: [{ Definition: { name: 'salesforce' } }],
|
|
301
301
|
};
|
|
302
302
|
```
|
|
303
303
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
**Lambda architecture (arm64 / Graviton):**
|
|
307
|
-
|
|
308
|
-
Every function, the Prisma layer and the migration worker deploy as x86_64 unless the app definition sets `architecture`:
|
|
309
|
-
|
|
310
|
-
```javascript
|
|
311
|
-
const appDefinition = {
|
|
312
|
-
name: 'my-app',
|
|
313
|
-
architecture: 'arm64', // or 'x86_64'; unset keeps today's template
|
|
314
|
-
integrations: [{ Definition: { name: 'hubspot' } }],
|
|
315
|
-
};
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
An explicit value sets `provider.architecture` and the layer's `compatibleArchitectures`, builds the layer with that architecture's Prisma query engine, ships the migration worker with its schema engine and query engine library, and pins the migrate CLI to them through `PRISMA_SCHEMA_ENGINE_BINARY` and `PRISMA_QUERY_ENGINE_LIBRARY`. With `usePrismaLambdaLayer: false`, each function bundles only that engine. An unset key adds no field to the template.
|
|
319
|
-
|
|
320
|
-
Before you flip an app to `arm64`:
|
|
321
|
-
|
|
322
|
-
- It needs a `@friggframework/core` release whose generated Prisma clients include the `linux-arm64-openssl-3.0.x` engine (both schemas list it in `binaryTargets`). With an older core the layer build fails naming the core version.
|
|
323
|
-
- The deploy host must reach Prisma's engine CDN (`binaries.prisma.sh`) at package time: the migration worker's engines for the target are fetched there, and packaging fails if either is missing.
|
|
324
|
-
- This runs on every compose where the migration worker is enabled, and downloads only when the target's engines are missing from the app's `node_modules/@prisma/engines`.
|
|
325
|
-
- Air-gapped or offline deploy hosts set `PRISMA_ENGINES_MIRROR` to an internal mirror of the CDN. Prisma's download honours it (`@prisma/fetch-engine` 6.19.3, `dist/chunk-LONQL55G.js`, where the download URL is built from `PRISMA_BINARIES_MIRROR || PRISMA_ENGINES_MIRROR || "https://binaries.prisma.sh"`).
|
|
326
|
-
- The app must have `prisma` installed in its own `node_modules`, not only in a hoisted parent: the worker ships its engines from there, and packaging fails otherwise. The worker runs the app's own `prisma` CLI and pins `PRISMA_SCHEMA_ENGINE_BINARY` and `PRISMA_QUERY_ENGINE_LIBRARY` to that `@prisma/engines`, so the CLI and its engines always agree. That `prisma` must still be able to run the schema and migrations of `@friggframework/core`.
|
|
327
|
-
- Published core carries one more query engine per generated client (about 15 MB unpacked each).
|
|
328
|
-
- Native addons of the app itself (`sharp`, `bcrypt`, and the like) are built for the deploy host's architecture by `npm ci`, not for the target. Build them for arm64 or replace them.
|
|
329
|
-
- During the stack update, functions run mixed for a short time, so flip in a low-traffic window.
|
|
330
|
-
- The cached layer under `layers/prisma` rebuilds on the flip: its marker records the Prisma binary target, the client set and the core and `@prisma/client` versions, and a mismatch rebuilds.
|
|
331
|
-
- The first compose after upgrading to a Frigg release with this support rebuilds the Prisma layer once, because cache markers written by older releases never match.
|
|
304
|
+
Nested copies of `@friggframework/*`, `aws-sdk`, `@aws-sdk/*` and, when the Prisma layer is enabled, `@prisma/*` and `.prisma` stay excluded: the app's single core, the Lambda runtime and the layer provide them. Expect each function package to grow by the size of the nested directories that remain (a few MB compressed in a typical app). The default stays unchanged for apps that do not set the flag.
|
|
332
305
|
|
|
333
306
|
## Usage Examples
|
|
334
307
|
|