@friggframework/devtools 2.0.0--canary.744.9a69fb7.0 → 2.0.0--canary.744.7e3ee98.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.
@@ -33,7 +33,9 @@ class AdminScriptBuilder extends InfrastructureBuilder {
33
33
  appDefinition.reports.length > 0;
34
34
  const hasBuiltinReports =
35
35
  appDefinition.admin?.includeBuiltinReports === true;
36
- return hasScripts || hasReports || hasBuiltinReports;
36
+ const hasBuiltinScripts =
37
+ appDefinition.admin?.includeBuiltinScripts === true;
38
+ return hasScripts || hasReports || hasBuiltinReports || hasBuiltinScripts;
37
39
  }
38
40
 
39
41
  getDependencies() {
@@ -83,6 +85,10 @@ class AdminScriptBuilder extends InfrastructureBuilder {
83
85
  : [];
84
86
  const hasReports =
85
87
  reports.length > 0 || adminConfig.includeBuiltinReports === true;
88
+ // The built-in scripts (registered at runtime by the admin-scripts
89
+ // bootstrap) need the same queue, executor and routes as app scripts.
90
+ const hasScripts =
91
+ adminScripts.length > 0 || adminConfig.includeBuiltinScripts === true;
86
92
 
87
93
  // Only non-JSON report output is stored in S3, so provision the bucket
88
94
  // only for that. Built-in reports emit JSON, so they don't trigger it.
@@ -99,7 +105,7 @@ class AdminScriptBuilder extends InfrastructureBuilder {
99
105
  iamStatements: [],
100
106
  };
101
107
 
102
- if (adminScripts.length > 0) {
108
+ if (hasScripts) {
103
109
  console.log(` Processing ${adminScripts.length} scripts...`);
104
110
  this.createAdminScriptQueue(result, appDefinition);
105
111
  this.createScriptExecutorFunction(appDefinition, result, usePrismaLayer);
@@ -109,6 +115,9 @@ class AdminScriptBuilder extends InfrastructureBuilder {
109
115
  const name = script.Definition?.name || 'unknown';
110
116
  console.log(` ✓ Registered script: ${name}`);
111
117
  });
118
+ if (adminConfig.includeBuiltinScripts) {
119
+ console.log(' ✓ Built-in scripts enabled');
120
+ }
112
121
  }
113
122
 
114
123
  if (hasReports) {
@@ -127,12 +136,9 @@ class AdminScriptBuilder extends InfrastructureBuilder {
127
136
  }
128
137
  }
129
138
 
130
- if (
131
- adminConfig.enableScheduling &&
132
- (adminScripts.length > 0 || hasReports)
133
- ) {
139
+ if (adminConfig.enableScheduling && (hasScripts || hasReports)) {
134
140
  this.createSchedulerResources(appDefinition, result, {
135
- scriptsPresent: adminScripts.length > 0,
141
+ scriptsPresent: hasScripts,
136
142
  hasReports,
137
143
  });
138
144
  }
@@ -44,6 +44,12 @@ describe('AdminScriptBuilder', () => {
44
44
  expect(adminScriptBuilder.shouldExecute(appDefinition)).toBe(true);
45
45
  });
46
46
 
47
+ it('should return true when only the built-in scripts are enabled', () => {
48
+ expect(
49
+ adminScriptBuilder.shouldExecute({ admin: { includeBuiltinScripts: true } })
50
+ ).toBe(true);
51
+ });
52
+
47
53
  it('should return false when adminScripts is not an array', () => {
48
54
  const appDefinition = {
49
55
  adminScripts: { name: 'test' },
@@ -742,6 +748,27 @@ describe('AdminScriptBuilder', () => {
742
748
  expect(result.functions.reportExecutor).toBeDefined();
743
749
  });
744
750
 
751
+ it('creates the script queue, executor and routes when only the built-in scripts are enabled', async () => {
752
+ const result = await adminScriptBuilder.build(
753
+ { admin: { includeBuiltinScripts: true } },
754
+ {}
755
+ );
756
+
757
+ expect(result.resources.AdminScriptQueue).toBeDefined();
758
+ expect(result.functions.adminScriptExecutor).toBeDefined();
759
+ expect(result.functions.adminScriptRouter).toBeDefined();
760
+ });
761
+
762
+ it('provisions scheduling for the built-in scripts', async () => {
763
+ const result = await adminScriptBuilder.build(
764
+ { admin: { includeBuiltinScripts: true, enableScheduling: true } },
765
+ {}
766
+ );
767
+
768
+ expect(result.resources.AdminScriptQueue).toBeDefined();
769
+ expect(JSON.stringify(result.resources)).toMatch(/Schedule/);
770
+ });
771
+
745
772
  it('does NOT create ReportQueue or reportExecutor when only adminScripts are present', async () => {
746
773
  const appDefinition = {
747
774
  adminScripts: [{ Definition: { name: 'test-script' } }],
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@friggframework/devtools",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0--canary.744.9a69fb7.0",
4
+ "version": "2.0.0--canary.744.7e3ee98.0",
5
5
  "bin": {
6
6
  "frigg": "./frigg-cli/index.js"
7
7
  },
@@ -28,9 +28,9 @@
28
28
  "@babel/eslint-parser": "^7.18.9",
29
29
  "@babel/parser": "^7.25.3",
30
30
  "@babel/traverse": "^7.25.3",
31
- "@friggframework/core": "2.0.0--canary.744.9a69fb7.0",
32
- "@friggframework/schemas": "2.0.0--canary.744.9a69fb7.0",
33
- "@friggframework/test": "2.0.0--canary.744.9a69fb7.0",
31
+ "@friggframework/core": "2.0.0--canary.744.7e3ee98.0",
32
+ "@friggframework/schemas": "2.0.0--canary.744.7e3ee98.0",
33
+ "@friggframework/test": "2.0.0--canary.744.7e3ee98.0",
34
34
  "@hapi/boom": "^10.0.1",
35
35
  "@inquirer/prompts": "^5.3.8",
36
36
  "axios": "^1.18.0",
@@ -58,8 +58,8 @@
58
58
  "validate-npm-package-name": "^5.0.0"
59
59
  },
60
60
  "devDependencies": {
61
- "@friggframework/eslint-config": "2.0.0--canary.744.9a69fb7.0",
62
- "@friggframework/prettier-config": "2.0.0--canary.744.9a69fb7.0",
61
+ "@friggframework/eslint-config": "2.0.0--canary.744.7e3ee98.0",
62
+ "@friggframework/prettier-config": "2.0.0--canary.744.7e3ee98.0",
63
63
  "aws-sdk-client-mock": "^4.1.0",
64
64
  "aws-sdk-client-mock-jest": "^4.1.0",
65
65
  "jest": "^30.1.3",
@@ -91,5 +91,5 @@
91
91
  "publishConfig": {
92
92
  "access": "public"
93
93
  },
94
- "gitHead": "9a69fb7c1880d0a1d7575e2e18a9fcf0fc76f37c"
94
+ "gitHead": "7e3ee98f0418c7247a4c166826c0b561eef27741"
95
95
  }