@friggframework/devtools 2.0.0--canary.625.27a7e7a.0 → 2.0.0--canary.625.8f60019.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.
|
@@ -16,6 +16,11 @@ const {
|
|
|
16
16
|
validateOffloadConfig,
|
|
17
17
|
} = require('./offload-utils');
|
|
18
18
|
|
|
19
|
+
// INIT-phase preload shipped in @friggframework/core, packaged into every
|
|
20
|
+
// skipEsbuild handler at this stable path (LAMBDA_TASK_ROOT = /var/task).
|
|
21
|
+
const SSM_PRELOAD_PATH =
|
|
22
|
+
'/var/task/node_modules/@friggframework/core/core/ssm-preload.mjs';
|
|
23
|
+
|
|
19
24
|
class SsmBuilder extends InfrastructureBuilder {
|
|
20
25
|
constructor() {
|
|
21
26
|
super();
|
|
@@ -93,6 +98,16 @@ class SsmBuilder extends InfrastructureBuilder {
|
|
|
93
98
|
result.environment.SSM_PARAMETER_PREFIX = prefix;
|
|
94
99
|
result.environment.FRIGG_SSM_OFFLOADED_KEYS = offloadedKeys.join(',');
|
|
95
100
|
|
|
101
|
+
// Populate offloaded values into process.env during Lambda INIT,
|
|
102
|
+
// BEFORE app modules load. api-modules capture OAuth client
|
|
103
|
+
// credentials at module-require time (top-level Definition.env), so
|
|
104
|
+
// the handler-time loader (parametersToEnv) is too late for them.
|
|
105
|
+
// NODE_OPTIONS=--import runs this ESM preload (top-level await) before
|
|
106
|
+
// the entry module. Shipped in @friggframework/core (packaged into
|
|
107
|
+
// every skipEsbuild handler at a stable path). Appended to any
|
|
108
|
+
// app-provided NODE_OPTIONS.
|
|
109
|
+
result.environment.NODE_OPTIONS = `\${env:NODE_OPTIONS, ''} --import file://${SSM_PRELOAD_PATH}`;
|
|
110
|
+
|
|
96
111
|
// Prefix-scoped read grant. Built as a plain serverless string (not
|
|
97
112
|
// Fn::Sub) because the prefix contains serverless variables like
|
|
98
113
|
// ${self:service} that Fn::Sub would reject as bad substitution keys.
|
|
@@ -234,6 +234,29 @@ describe('SsmBuilder', () => {
|
|
|
234
234
|
expect(result.environment.FRIGG_SSM_OFFLOADED_KEYS).toBe('BAR,FOO');
|
|
235
235
|
});
|
|
236
236
|
|
|
237
|
+
it('sets NODE_OPTIONS to --import the INIT preload (appended to any app value)', async () => {
|
|
238
|
+
const appDefinition = {
|
|
239
|
+
ssm: { enable: true },
|
|
240
|
+
environment: { FOO: 'ssm' },
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
const result = await ssmBuilder.build(appDefinition, {});
|
|
244
|
+
|
|
245
|
+
expect(result.environment.NODE_OPTIONS).toContain('--import');
|
|
246
|
+
expect(result.environment.NODE_OPTIONS).toContain(
|
|
247
|
+
'@friggframework/core/core/ssm-preload.mjs'
|
|
248
|
+
);
|
|
249
|
+
// Appends to any app-provided NODE_OPTIONS rather than clobbering it.
|
|
250
|
+
expect(result.environment.NODE_OPTIONS).toContain(
|
|
251
|
+
"${env:NODE_OPTIONS, ''}"
|
|
252
|
+
);
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it('does not set NODE_OPTIONS when no keys are offloaded', async () => {
|
|
256
|
+
const result = await ssmBuilder.build({ ssm: { enable: true } }, {});
|
|
257
|
+
expect(result.environment.NODE_OPTIONS).toBeUndefined();
|
|
258
|
+
});
|
|
259
|
+
|
|
237
260
|
it('should add a prefix-scoped read statement while retaining the broad grant by default', async () => {
|
|
238
261
|
const appDefinition = {
|
|
239
262
|
ssm: { enable: true },
|
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.625.
|
|
4
|
+
"version": "2.0.0--canary.625.8f60019.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"frigg": "./frigg-cli/index.js"
|
|
7
7
|
},
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"@babel/eslint-parser": "^7.18.9",
|
|
27
27
|
"@babel/parser": "^7.25.3",
|
|
28
28
|
"@babel/traverse": "^7.25.3",
|
|
29
|
-
"@friggframework/core": "2.0.0--canary.625.
|
|
30
|
-
"@friggframework/schemas": "2.0.0--canary.625.
|
|
31
|
-
"@friggframework/test": "2.0.0--canary.625.
|
|
29
|
+
"@friggframework/core": "2.0.0--canary.625.8f60019.0",
|
|
30
|
+
"@friggframework/schemas": "2.0.0--canary.625.8f60019.0",
|
|
31
|
+
"@friggframework/test": "2.0.0--canary.625.8f60019.0",
|
|
32
32
|
"@hapi/boom": "^10.0.1",
|
|
33
33
|
"@inquirer/prompts": "^5.3.8",
|
|
34
34
|
"axios": "^1.18.0",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"validate-npm-package-name": "^5.0.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@friggframework/eslint-config": "2.0.0--canary.625.
|
|
60
|
-
"@friggframework/prettier-config": "2.0.0--canary.625.
|
|
59
|
+
"@friggframework/eslint-config": "2.0.0--canary.625.8f60019.0",
|
|
60
|
+
"@friggframework/prettier-config": "2.0.0--canary.625.8f60019.0",
|
|
61
61
|
"aws-sdk-client-mock": "^4.1.0",
|
|
62
62
|
"aws-sdk-client-mock-jest": "^4.1.0",
|
|
63
63
|
"jest": "^30.1.3",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"publishConfig": {
|
|
90
90
|
"access": "public"
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "8f600193664963446e2c59c4b05ee076b0fbdc2a"
|
|
93
93
|
}
|