@bref.sh/layers 2.0.2 → 2.0.4

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 +131 -85
  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
@@ -48,116 +48,162 @@
48
48
  "php-81": {
49
49
  "af-south-1": "",
50
50
  "ap-east-1": "",
51
- "ap-northeast-1": "1",
52
- "ap-northeast-2": "1",
53
- "ap-northeast-3": "1",
54
- "ap-south-1": "1",
55
- "ap-southeast-1": "1",
56
- "ap-southeast-2": "1",
57
- "ca-central-1": "2",
58
- "eu-central-1": "2",
59
- "eu-north-1": "2",
51
+ "ap-northeast-1": "2",
52
+ "ap-northeast-2": "2",
53
+ "ap-northeast-3": "2",
54
+ "ap-south-1": "2",
55
+ "ap-southeast-1": "2",
56
+ "ap-southeast-2": "2",
57
+ "ca-central-1": "3",
58
+ "eu-central-1": "3",
59
+ "eu-north-1": "3",
60
60
  "eu-south-1": "",
61
- "eu-west-1": "2",
62
- "eu-west-2": "2",
63
- "eu-west-3": "2",
61
+ "eu-west-1": "3",
62
+ "eu-west-2": "3",
63
+ "eu-west-3": "3",
64
64
  "me-south-1": "",
65
- "sa-east-1": "2",
66
- "us-east-1": "2",
67
- "us-east-2": "2",
68
- "us-west-1": "2",
69
- "us-west-2": "2"
65
+ "sa-east-1": "3",
66
+ "us-east-1": "3",
67
+ "us-east-2": "3",
68
+ "us-west-1": "3",
69
+ "us-west-2": "3"
70
70
  },
71
71
  "php-81-fpm": {
72
72
  "af-south-1": "",
73
73
  "ap-east-1": "",
74
- "ap-northeast-1": "1",
75
- "ap-northeast-2": "1",
76
- "ap-northeast-3": "1",
77
- "ap-south-1": "1",
78
- "ap-southeast-1": "1",
79
- "ap-southeast-2": "1",
80
- "ca-central-1": "2",
81
- "eu-central-1": "2",
82
- "eu-north-1": "2",
74
+ "ap-northeast-1": "2",
75
+ "ap-northeast-2": "2",
76
+ "ap-northeast-3": "2",
77
+ "ap-south-1": "2",
78
+ "ap-southeast-1": "2",
79
+ "ap-southeast-2": "2",
80
+ "ca-central-1": "3",
81
+ "eu-central-1": "3",
82
+ "eu-north-1": "3",
83
83
  "eu-south-1": "",
84
- "eu-west-1": "2",
85
- "eu-west-2": "2",
86
- "eu-west-3": "2",
84
+ "eu-west-1": "3",
85
+ "eu-west-2": "3",
86
+ "eu-west-3": "3",
87
87
  "me-south-1": "",
88
- "sa-east-1": "2",
89
- "us-east-1": "2",
90
- "us-east-2": "2",
91
- "us-west-1": "2",
92
- "us-west-2": "2"
88
+ "sa-east-1": "3",
89
+ "us-east-1": "3",
90
+ "us-east-2": "3",
91
+ "us-west-1": "3",
92
+ "us-west-2": "3"
93
93
  },
94
94
  "php-80": {
95
95
  "af-south-1": "",
96
96
  "ap-east-1": "",
97
- "ap-northeast-1": "1",
98
- "ap-northeast-2": "1",
99
- "ap-northeast-3": "1",
100
- "ap-south-1": "3",
101
- "ap-southeast-1": "1",
102
- "ap-southeast-2": "3",
103
- "ca-central-1": "4",
104
- "eu-central-1": "4",
105
- "eu-north-1": "4",
97
+ "ap-northeast-1": "2",
98
+ "ap-northeast-2": "2",
99
+ "ap-northeast-3": "2",
100
+ "ap-south-1": "4",
101
+ "ap-southeast-1": "2",
102
+ "ap-southeast-2": "4",
103
+ "ca-central-1": "5",
104
+ "eu-central-1": "5",
105
+ "eu-north-1": "5",
106
106
  "eu-south-1": "",
107
- "eu-west-1": "4",
108
- "eu-west-2": "4",
109
- "eu-west-3": "4",
107
+ "eu-west-1": "5",
108
+ "eu-west-2": "5",
109
+ "eu-west-3": "5",
110
110
  "me-south-1": "",
111
- "sa-east-1": "4",
112
- "us-east-1": "4",
113
- "us-east-2": "4",
114
- "us-west-1": "4",
115
- "us-west-2": "4"
111
+ "sa-east-1": "5",
112
+ "us-east-1": "5",
113
+ "us-east-2": "5",
114
+ "us-west-1": "5",
115
+ "us-west-2": "5"
116
116
  },
117
117
  "php-80-fpm": {
118
118
  "af-south-1": "",
119
119
  "ap-east-1": "",
120
- "ap-northeast-1": "1",
121
- "ap-northeast-2": "1",
122
- "ap-northeast-3": "1",
123
- "ap-south-1": "1",
124
- "ap-southeast-1": "1",
125
- "ap-southeast-2": "1",
126
- "ca-central-1": "2",
127
- "eu-central-1": "2",
128
- "eu-north-1": "2",
120
+ "ap-northeast-1": "2",
121
+ "ap-northeast-2": "2",
122
+ "ap-northeast-3": "2",
123
+ "ap-south-1": "2",
124
+ "ap-southeast-1": "2",
125
+ "ap-southeast-2": "2",
126
+ "ca-central-1": "3",
127
+ "eu-central-1": "3",
128
+ "eu-north-1": "3",
129
129
  "eu-south-1": "",
130
- "eu-west-1": "2",
131
- "eu-west-2": "2",
132
- "eu-west-3": "2",
130
+ "eu-west-1": "3",
131
+ "eu-west-2": "3",
132
+ "eu-west-3": "3",
133
133
  "me-south-1": "",
134
- "sa-east-1": "2",
135
- "us-east-1": "2",
136
- "us-east-2": "2",
137
- "us-west-1": "2",
138
- "us-west-2": "2"
134
+ "sa-east-1": "3",
135
+ "us-east-1": "3",
136
+ "us-east-2": "3",
137
+ "us-west-1": "3",
138
+ "us-west-2": "3"
139
+ },
140
+ "arm-php-80": {
141
+ "af-south-1": "",
142
+ "ap-east-1": "",
143
+ "ap-northeast-1": "2",
144
+ "ap-northeast-2": "2",
145
+ "ap-northeast-3": "2",
146
+ "ap-south-1": "2",
147
+ "ap-southeast-1": "2",
148
+ "ap-southeast-2": "2",
149
+ "ca-central-1": "3",
150
+ "eu-central-1": "3",
151
+ "eu-north-1": "3",
152
+ "eu-south-1": "",
153
+ "eu-west-1": "3",
154
+ "eu-west-2": "3",
155
+ "eu-west-3": "3",
156
+ "me-south-1": "",
157
+ "sa-east-1": "3",
158
+ "us-east-1": "3",
159
+ "us-east-2": "3",
160
+ "us-west-1": "3",
161
+ "us-west-2": "3"
162
+ },
163
+ "arm-php-80-fpm": {
164
+ "af-south-1": "",
165
+ "ap-east-1": "",
166
+ "ap-northeast-1": "2",
167
+ "ap-northeast-2": "2",
168
+ "ap-northeast-3": "2",
169
+ "ap-south-1": "2",
170
+ "ap-southeast-1": "2",
171
+ "ap-southeast-2": "2",
172
+ "ca-central-1": "3",
173
+ "eu-central-1": "3",
174
+ "eu-north-1": "3",
175
+ "eu-south-1": "",
176
+ "eu-west-1": "3",
177
+ "eu-west-2": "3",
178
+ "eu-west-3": "3",
179
+ "me-south-1": "",
180
+ "sa-east-1": "3",
181
+ "us-east-1": "3",
182
+ "us-east-2": "3",
183
+ "us-west-1": "3",
184
+ "us-west-2": "3"
139
185
  },
140
186
  "console": {
141
187
  "af-south-1": "",
142
188
  "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",
189
+ "ap-northeast-1": "2",
190
+ "ap-northeast-2": "2",
191
+ "ap-northeast-3": "2",
192
+ "ap-south-1": "2",
193
+ "ap-southeast-1": "2",
194
+ "ap-southeast-2": "2",
195
+ "ca-central-1": "3",
196
+ "eu-central-1": "3",
197
+ "eu-north-1": "3",
152
198
  "eu-south-1": "",
153
- "eu-west-1": "2",
154
- "eu-west-2": "2",
155
- "eu-west-3": "2",
199
+ "eu-west-1": "3",
200
+ "eu-west-2": "3",
201
+ "eu-west-3": "3",
156
202
  "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"
203
+ "sa-east-1": "3",
204
+ "us-east-1": "3",
205
+ "us-east-2": "3",
206
+ "us-west-1": "3",
207
+ "us-west-2": "3"
162
208
  }
163
209
  }
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.4",
4
4
  "description": "Bref.sh AWS Lambda layers",
5
5
  "repository": "brefphp/layers.js",
6
6
  "license": "MIT",