@bref.sh/layers 3.0.2 → 3.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/README.md +5 -10
  2. package/layers.js +2 -36
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -32,20 +32,15 @@ Get a layer version:
32
32
  ```js
33
33
  import { layerVersions } from '@bref.sh/layers';
34
34
 
35
- console.log(layerVersions['php-82']['us-east-1']);
36
- console.log(layerVersions['php-82-fpm']['eu-west-3']);
35
+ console.log(layerVersions['php-84']['us-east-1']);
36
+ console.log(layerVersions['arm-php-84']['eu-west-3']);
37
37
  ```
38
38
 
39
39
  Helpers to get a full ARN:
40
40
 
41
41
  ```js
42
- import { functionLayerArn, fpmLayerArn, consoleLayerArn } from '@bref.sh/layers';
42
+ import { layerArn } from '@bref.sh/layers';
43
43
 
44
- console.log(functionLayerArn(region, '8.2'));
45
- console.log(functionLayerArn(region, '8.3', 'arm'));
46
-
47
- console.log(fpmLayerArn(region, '8.2'));
48
- console.log(fpmLayerArn(region, '8.3', 'arm'));
49
-
50
- console.log(consoleLayerArn(region));
44
+ console.log(layerArn(region, '8.4'));
45
+ console.log(layerArn(region, '8.4', 'arm'));
51
46
  ```
package/layers.js CHANGED
@@ -8,7 +8,7 @@ const layerVersions = require('./layers.json');
8
8
  * @param {'x86'|'arm'} platform
9
9
  * @returns {string} Layer ARN
10
10
  */
11
- function functionLayerArn(region, phpVersion, platform = 'x86') {
11
+ function layerArn(region, phpVersion, platform = 'x86') {
12
12
  let layerName = 'php-' + phpVersion.replace('.', '');
13
13
  if (platform === 'arm') {
14
14
  layerName = 'arm-' + layerName;
@@ -20,42 +20,8 @@ function functionLayerArn(region, phpVersion, platform = 'x86') {
20
20
  return `arn:aws:lambda:${region}:873528684822:layer:${layerName}:${version}`;
21
21
  }
22
22
 
23
- /**
24
- * Returns the ARN for the FPM layer.
25
- * @param {string} region
26
- * @param {string} phpVersion (e.g. '8.1')
27
- * @param {'x86'|'arm'} platform
28
- * @returns {string} Layer ARN
29
- */
30
- function fpmLayerArn(region, phpVersion, platform = 'x86') {
31
- let layerName = 'php-' + phpVersion.replace('.', '') + '-fpm';
32
- if (platform === 'arm') {
33
- layerName = 'arm-' + layerName;
34
- }
35
- const version = layerVersions[layerName]?.[region];
36
- if (!version) {
37
- throw new Error(`PHP version ${phpVersion} in ${region} is not supported`);
38
- }
39
- return `arn:aws:lambda:${region}:873528684822:layer:${layerName}:${version}`;
40
- }
41
-
42
- /**
43
- * Returns the ARN for the Console layer.
44
- * @param {string} region
45
- * @returns {string} Layer ARN
46
- */
47
- function consoleLayerArn(region) {
48
- const version = layerVersions.console[region];
49
- if (!version) {
50
- throw new Error(`Console layer does not exist in region ${region}`);
51
- }
52
- return `arn:aws:lambda:${region}:873528684822:layer:console:${version}`;
53
- }
54
-
55
23
  module.exports = {
56
24
  // Expose the JSON data as a JS dependency for easier use in programmatic environments
57
25
  layerVersions,
58
- functionLayerArn,
59
- fpmLayerArn,
60
- consoleLayerArn,
26
+ layerArn,
61
27
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bref.sh/layers",
3
- "version": "3.0.2",
3
+ "version": "3.0.3",
4
4
  "description": "Bref.sh AWS Lambda layers",
5
5
  "repository": "brefphp/layers.js",
6
6
  "license": "MIT",