@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.
- package/README.md +0 -14
- package/frigg-cli/README.md +30 -83
- package/frigg-cli/__tests__/unit/commands/deploy-subscriptions-step.test.js +35 -0
- package/frigg-cli/__tests__/unit/commands/generate-iam.test.js +0 -18
- package/frigg-cli/__tests__/unit/commands/install.test.js +341 -594
- package/frigg-cli/__tests__/unit/dependencies.test.js +5 -3
- package/frigg-cli/deploy-command/index.js +3 -0
- package/frigg-cli/deploy-command/subscriptions-step.js +44 -0
- package/frigg-cli/generate-command/index.js +0 -1
- package/frigg-cli/generate-iam-command.js +0 -1
- package/frigg-cli/index.js +6 -12
- package/frigg-cli/init-command/backend-first-handler.js +554 -397
- 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 +3 -3
- package/frigg-cli/test/init-command.test.js +2 -9
- package/infrastructure/README.md +0 -20
- package/infrastructure/docs/POSTGRES-CONFIGURATION.md +1 -21
- package/infrastructure/domains/admin-scripts/admin-script-builder.js +46 -50
- package/infrastructure/domains/admin-scripts/admin-script-builder.test.js +7 -46
- 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 +175 -182
- package/infrastructure/domains/database/migration-builder.test.js +5 -36
- package/infrastructure/domains/integration/define-integration-provisioning.test.js +59 -0
- package/infrastructure/domains/integration/integration-builder.js +80 -65
- package/infrastructure/domains/integration/integration-builder.test.js +30 -73
- package/infrastructure/domains/scheduler/trigger-builder.js +114 -0
- package/infrastructure/domains/scheduler/trigger-builder.test.js +82 -0
- package/infrastructure/domains/security/iam-generator.js +5 -112
- package/infrastructure/domains/security/iam-generator.test.js +0 -94
- package/infrastructure/domains/shared/function-environments.js +9 -1
- package/infrastructure/domains/shared/function-environments.test.js +14 -0
- package/infrastructure/domains/shared/utilities/base-definition-factory.js +124 -83
- package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +26 -116
- 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.js +2 -0
- package/infrastructure/infrastructure-composer.test.js +3 -3
- package/package.json +8 -13
- package/frigg-cli/__tests__/unit/commands/init.test.js +0 -688
- package/frigg-cli/__tests__/unit/utils/node-version.test.js +0 -66
- 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/utils/node-version.js +0 -51
- package/infrastructure/__tests__/package-patterns-composition.test.js +0 -153
- package/infrastructure/__tests__/scaffold-default-infrastructure.test.js +0 -148
- 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
|
@@ -24,15 +24,17 @@ describe('frigg-cli dependencies', () => {
|
|
|
24
24
|
expect(oslsVersion).toMatch(/^[\^~]?\d+\.\d+\.\d+/);
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
it('should use osls
|
|
27
|
+
it('should use osls version 3.40.1 or higher', () => {
|
|
28
28
|
const oslsVersion = packageJson.dependencies.osls;
|
|
29
29
|
|
|
30
30
|
// Extract version number (remove ^ or ~ prefix)
|
|
31
31
|
const versionNumber = oslsVersion.replace(/^[\^~]/, '');
|
|
32
32
|
const [major, minor] = versionNumber.split('.').map(Number);
|
|
33
33
|
|
|
34
|
-
expect(major).
|
|
35
|
-
|
|
34
|
+
expect(major).toBeGreaterThanOrEqual(3);
|
|
35
|
+
if (major === 3) {
|
|
36
|
+
expect(minor).toBeGreaterThanOrEqual(40);
|
|
37
|
+
}
|
|
36
38
|
});
|
|
37
39
|
});
|
|
38
40
|
|
|
@@ -4,6 +4,7 @@ const fs = require('fs');
|
|
|
4
4
|
|
|
5
5
|
// Import doctor command for post-deployment health check
|
|
6
6
|
const { doctorCommand } = require('../doctor-command');
|
|
7
|
+
const { reconcileSubscriptionsAfterDeploy } = require('./subscriptions-step');
|
|
7
8
|
|
|
8
9
|
// Configuration constants
|
|
9
10
|
const PATHS = {
|
|
@@ -328,6 +329,8 @@ async function deployCommand(options) {
|
|
|
328
329
|
|
|
329
330
|
console.log('\n✓ Deployment completed successfully!');
|
|
330
331
|
|
|
332
|
+
await reconcileSubscriptionsAfterDeploy(appDefinition, options);
|
|
333
|
+
|
|
331
334
|
const skipHealthCheck = options.skipDoctor || appDefinition?.deployment?.skipPostDeploymentHealthCheck;
|
|
332
335
|
|
|
333
336
|
// Run post-deployment health check (unless disabled)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-deploy step (ADR-054 §2, amended): create the app-scope webhook subscriptions the deployed integrations
|
|
3
|
+
* declare (for example HubSpot's, which belong to the developer app).
|
|
4
|
+
*
|
|
5
|
+
* Add-only unless `--prune-subscriptions`. The deploy machine has no database, so bindings whose options depend on
|
|
6
|
+
* installation config are left to the installation lifecycle and to the admin script, and a group that has one is
|
|
7
|
+
* never pruned here. Supported setup: one provider developer app per stage, because the subscriptions are app-wide.
|
|
8
|
+
* A failure is reported and never fails the deploy; the admin script can be run afterwards.
|
|
9
|
+
*/
|
|
10
|
+
async function reconcileSubscriptionsAfterDeploy(appDefinition, options = {}, { define } = {}) {
|
|
11
|
+
if (options.skipSubscriptions) {
|
|
12
|
+
console.log('\n⏭️ Skipping webhook subscription reconcile (--skip-subscriptions)');
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const integrations = appDefinition?.integrations || [];
|
|
16
|
+
let api = define;
|
|
17
|
+
if (!api) {
|
|
18
|
+
try {
|
|
19
|
+
api = require('@friggframework/core/integrations/define');
|
|
20
|
+
} catch {
|
|
21
|
+
return null; // a core without defineIntegration: nothing declares app-scope subscriptions
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const prune = Boolean(options.pruneSubscriptions);
|
|
25
|
+
try {
|
|
26
|
+
// The provider credentials (developer app id and key) come from the deploy environment or .env.
|
|
27
|
+
try { require('dotenv').config(); } catch { /* dotenv is optional here */ }
|
|
28
|
+
const results = await api.reconcileAppSubscriptions({ integrations, listInstallations: null, prune });
|
|
29
|
+
if (!results.length) return results;
|
|
30
|
+
console.log(`\nWebhook subscriptions (${prune ? 'prune' : 'add-only'}):`);
|
|
31
|
+
for (const r of results) {
|
|
32
|
+
console.log(` ${r.extension}: ${r.created.length} created, ${r.removed.length} removed, ${r.kept.length} kept`);
|
|
33
|
+
if (!prune && r.remove.length) console.log(` ${r.remove.length} not needed by any binding (kept; --prune-subscriptions removes them): ${r.remove.join(', ')}`);
|
|
34
|
+
if (r.pruneSkipped) console.log(` not pruned: ${r.pruneSkipped}`);
|
|
35
|
+
}
|
|
36
|
+
return results;
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.log(`\n⚠️ Webhook subscription reconcile failed: ${error.message}`);
|
|
39
|
+
console.log(' The deploy succeeded. Run the reconcile-subscriptions admin script to retry.');
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
module.exports = { reconcileSubscriptionsAfterDeploy };
|
|
@@ -118,7 +118,6 @@ async function generateCommand(options = {}) {
|
|
|
118
118
|
if (options.format === 'cloudformation') {
|
|
119
119
|
template = await generateCloudFormationTemplate({
|
|
120
120
|
appName,
|
|
121
|
-
serviceName: appDefinition.name || 'create-frigg-app',
|
|
122
121
|
features,
|
|
123
122
|
userPrefix: options.user || 'frigg-deployment-user',
|
|
124
123
|
stackName: options.stackName || 'frigg-deployment-iam',
|
|
@@ -62,7 +62,6 @@ async function generateIamCommand(options = {}) {
|
|
|
62
62
|
// Use the summary already extracted above (line 44)
|
|
63
63
|
const cloudFormationYaml = generateIAMCloudFormation({
|
|
64
64
|
appName: summary.appName,
|
|
65
|
-
serviceName: summary.serviceName,
|
|
66
65
|
features: summary.features,
|
|
67
66
|
userPrefix: deploymentUserName,
|
|
68
67
|
stackName,
|
package/frigg-cli/index.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
// osls 4 needs Node ^22.13.0 || >=24 (ADR-050): fail early with a clear message.
|
|
4
|
-
require('./utils/node-version').enforceNodeVersion();
|
|
5
|
-
|
|
6
3
|
// Version Detection Wrapper
|
|
7
4
|
// This code runs when frigg-cli is installed globally
|
|
8
5
|
// It checks for a local installation and prefers it if newer
|
|
@@ -94,16 +91,11 @@ const { ssmPushCommand } = require('./ssm-command');
|
|
|
94
91
|
const program = new Command();
|
|
95
92
|
|
|
96
93
|
program
|
|
97
|
-
.command('init [
|
|
94
|
+
.command('init [templateName]')
|
|
98
95
|
.description('Initialize a new Frigg application')
|
|
99
|
-
.option('-
|
|
100
|
-
.option('-
|
|
101
|
-
.option('-
|
|
102
|
-
.option('--no-install', 'skip installing dependencies')
|
|
103
|
-
.option('--no-git', 'skip initializing a git repository')
|
|
104
|
-
.option('-f, --force', 'scaffold into a non-empty directory and overwrite README.md')
|
|
105
|
-
.option('-v, --verbose', 'enable verbose output')
|
|
106
|
-
.option('-t, --template <template>', 'legacy template (no longer supported)')
|
|
96
|
+
.option('-t, --template <template>', 'template to use', 'backend-only')
|
|
97
|
+
.option('-n, --name <name>', 'project name')
|
|
98
|
+
.option('-d, --directory <directory>', 'target directory')
|
|
107
99
|
.action(initCommand);
|
|
108
100
|
|
|
109
101
|
program
|
|
@@ -133,6 +125,8 @@ program
|
|
|
133
125
|
.option('-v, --verbose', 'enable verbose output')
|
|
134
126
|
.option('-f, --force', 'force deployment (bypasses caching for layers and functions)')
|
|
135
127
|
.option('--skip-doctor', 'skip post-deployment health check')
|
|
128
|
+
.option('--prune-subscriptions', 'after deploy, also remove app-scope webhook subscriptions no integration needs (one provider developer app per stage only)')
|
|
129
|
+
.option('--skip-subscriptions', 'skip the post-deploy webhook subscription reconcile')
|
|
136
130
|
.action(deployCommand);
|
|
137
131
|
|
|
138
132
|
program
|