@bref.sh/layers 2.0.2 → 2.0.3

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 (3) hide show
  1. package/layers.js +50 -2
  2. package/layers.json +46 -0
  3. package/package.json +1 -1
package/layers.js CHANGED
@@ -1,4 +1,52 @@
1
- // Expose the JSON data as a JS dependency for easier use in programmatic environments
1
+ /** @type {Record<string, Record<string, string>>} */
2
+ const layerVersions = require('./layers.json');
3
+
4
+ /**
5
+ * Returns the ARN for the function layer.
6
+ * @param {string} region
7
+ * @param {string} phpVersion (e.g. '8.1')
8
+ * @param {'x86'|'arm'} platform
9
+ * @returns {string} Layer ARN
10
+ */
11
+ function functionLayerArn(region, phpVersion, platform) {
12
+ let layerName = 'php-' + phpVersion.replace('.', '');
13
+ if (platform === 'arm') {
14
+ layerName = 'arm-' + layerName;
15
+ }
16
+ const version = layerVersions[layerName][region];
17
+ return `arn:aws:lambda:${region}:534081306603:layer:${layerName}:${version}`;
18
+ }
19
+
20
+ /**
21
+ * Returns the ARN for the FPM layer.
22
+ * @param {string} region
23
+ * @param {string} phpVersion (e.g. '8.1')
24
+ * @param {'x86'|'arm'} platform
25
+ * @returns {string} Layer ARN
26
+ */
27
+ function fpmLayerArn(region, phpVersion, platform) {
28
+ let layerName = 'php-' + phpVersion.replace('.', '') + '-fpm';
29
+ if (platform === 'arm') {
30
+ layerName = 'arm-' + layerName;
31
+ }
32
+ const version = layerVersions[layerName][region];
33
+ return `arn:aws:lambda:${region}:534081306603:layer:${layerName}:${version}`;
34
+ }
35
+
36
+ /**
37
+ * Returns the ARN for the Console layer.
38
+ * @param {string} region
39
+ * @returns {string} Layer ARN
40
+ */
41
+ function consoleLayerArn(region) {
42
+ const version = layerVersions.console[region];
43
+ return `arn:aws:lambda:${region}:534081306603:layer:console:${version}`;
44
+ }
45
+
2
46
  module.exports = {
3
- versions: require('./layers.json'),
47
+ // Expose the JSON data as a JS dependency for easier use in programmatic environments
48
+ layerVersions,
49
+ functionLayerArn,
50
+ fpmLayerArn,
51
+ consoleLayerArn,
4
52
  };
package/layers.json CHANGED
@@ -137,6 +137,52 @@
137
137
  "us-west-1": "2",
138
138
  "us-west-2": "2"
139
139
  },
140
+ "arm-php-80": {
141
+ "af-south-1": "",
142
+ "ap-east-1": "",
143
+ "ap-northeast-1": "1",
144
+ "ap-northeast-2": "1",
145
+ "ap-northeast-3": "1",
146
+ "ap-south-1": "1",
147
+ "ap-southeast-1": "1",
148
+ "ap-southeast-2": "1",
149
+ "ca-central-1": "2",
150
+ "eu-central-1": "2",
151
+ "eu-north-1": "2",
152
+ "eu-south-1": "",
153
+ "eu-west-1": "2",
154
+ "eu-west-2": "2",
155
+ "eu-west-3": "2",
156
+ "me-south-1": "",
157
+ "sa-east-1": "2",
158
+ "us-east-1": "2",
159
+ "us-east-2": "2",
160
+ "us-west-1": "2",
161
+ "us-west-2": "2"
162
+ },
163
+ "arm-php-80-fpm": {
164
+ "af-south-1": "",
165
+ "ap-east-1": "",
166
+ "ap-northeast-1": "1",
167
+ "ap-northeast-2": "1",
168
+ "ap-northeast-3": "1",
169
+ "ap-south-1": "1",
170
+ "ap-southeast-1": "1",
171
+ "ap-southeast-2": "1",
172
+ "ca-central-1": "2",
173
+ "eu-central-1": "2",
174
+ "eu-north-1": "2",
175
+ "eu-south-1": "",
176
+ "eu-west-1": "2",
177
+ "eu-west-2": "2",
178
+ "eu-west-3": "2",
179
+ "me-south-1": "",
180
+ "sa-east-1": "2",
181
+ "us-east-1": "2",
182
+ "us-east-2": "2",
183
+ "us-west-1": "2",
184
+ "us-west-2": "2"
185
+ },
140
186
  "console": {
141
187
  "af-south-1": "",
142
188
  "ap-east-1": "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bref.sh/layers",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Bref.sh AWS Lambda layers",
5
5
  "repository": "brefphp/layers.js",
6
6
  "license": "MIT",