codepipeline-event-notifier 0.1.1

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.
package/API.md ADDED
@@ -0,0 +1,39 @@
1
+ # API Reference <a name="API Reference" id="api-reference"></a>
2
+
3
+
4
+
5
+ ## Classes <a name="Classes" id="Classes"></a>
6
+
7
+ ### Hello <a name="Hello" id="codepipeline-event-notifier.Hello"></a>
8
+
9
+ #### Initializers <a name="Initializers" id="codepipeline-event-notifier.Hello.Initializer"></a>
10
+
11
+ ```typescript
12
+ import { Hello } from 'codepipeline-event-notifier'
13
+
14
+ new Hello()
15
+ ```
16
+
17
+ | **Name** | **Type** | **Description** |
18
+ | --- | --- | --- |
19
+
20
+ ---
21
+
22
+ #### Methods <a name="Methods" id="Methods"></a>
23
+
24
+ | **Name** | **Description** |
25
+ | --- | --- |
26
+ | <code><a href="#codepipeline-event-notifier.Hello.sayHello">sayHello</a></code> | *No description.* |
27
+
28
+ ---
29
+
30
+ ##### `sayHello` <a name="sayHello" id="codepipeline-event-notifier.Hello.sayHello"></a>
31
+
32
+ ```typescript
33
+ public sayHello(): string
34
+ ```
35
+
36
+
37
+
38
+
39
+
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # CodePipeline Event Notifier
2
+
3
+ [![npm version](https://img.shields.io/npm/v/codepipeline-event-notifier.svg)](https://www.npmjs.com/package/codepipeline-event-notifier)
4
+ [![license](https://img.shields.io/npm/l/codepipeline-event-notifier.svg)](LICENSE)
5
+
6
+ CDK construct that listens to **AWS CodePipeline execution STARTED** events via EventBridge, invokes a Lambda notifier, and publishes execution state changes to an SNS topic.
7
+
8
+ ## Features
9
+
10
+ - **EventBridge integration**: triggers on `CodePipeline Pipeline Execution State Change` with `state=STARTED`
11
+ - **SNS notifications**: publishes execution status transitions (observed while polling) as JSON messages
12
+ - **Execution polling**: polls `GetPipelineExecution` until a terminal state or timeout
13
+ - **No subscriptions by default**: the SNS Topic is created, but subscriptions (email/HTTP/etc.) are intentionally not configured
14
+
15
+ ## Installation
16
+
17
+ ### npm
18
+
19
+ ```bash
20
+ npm install codepipeline-event-notifier
21
+ ```
22
+
23
+ ### yarn
24
+
25
+ ```bash
26
+ yarn add codepipeline-event-notifier
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ Instantiate `CodePipelineEventNotifier` in your CDK stack:
32
+
33
+ ```ts
34
+ import { Stack } from 'aws-cdk-lib';
35
+ import { Construct } from 'constructs';
36
+ import { CodePipelineEventNotifier } from 'codepipeline-event-notifier';
37
+
38
+ export class MyStack extends Stack {
39
+ constructor(scope: Construct, id: string) {
40
+ super(scope, id);
41
+
42
+ new CodePipelineEventNotifier(this, 'CodePipelineEventNotifier');
43
+ }
44
+ }
45
+ ```
46
+
47
+ ## Options
48
+
49
+ The notifier Lambda supports the following environment variables:
50
+
51
+ - `SNS_TOPIC_ARN` (**required**): SNS topic ARN to publish notifications to (provided by the construct)
52
+ - `POLL_INTERVAL_SECONDS` (default: `10`): poll interval in seconds
53
+ - `MAX_POLL_MINUTES` (default: `14`): maximum polling duration in minutes (Lambda should be configured with a matching timeout)
54
+
55
+ ## Requirements
56
+
57
+ - Node.js `>= 20`
58
+ - AWS CDK `v2` (`aws-cdk-lib`)
59
+
60
+ ## License
61
+
62
+ This project is licensed under the Apache-2.0 License.
@@ -0,0 +1,296 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ try {
10
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
+ } catch (e) {
12
+ throw mod = 0, e;
13
+ }
14
+ };
15
+ var __export = (target, all) => {
16
+ for (var name in all)
17
+ __defProp(target, name, { get: all[name], enumerable: true });
18
+ };
19
+ var __copyProps = (to, from, except, desc) => {
20
+ if (from && typeof from === "object" || typeof from === "function") {
21
+ for (let key of __getOwnPropNames(from))
22
+ if (!__hasOwnProp.call(to, key) && key !== except)
23
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
24
+ }
25
+ return to;
26
+ };
27
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
28
+ // If the importer is in node compatibility mode or this is not an ESM
29
+ // file that has been converted to a CommonJS file using a Babel-
30
+ // compatible transform (i.e. "__esModule" has not been set), then set
31
+ // "default" to the CommonJS "module.exports" for node compatibility.
32
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
33
+ mod
34
+ ));
35
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
+
37
+ // node_modules/strict-env-resolver/lib/index.js
38
+ var require_lib = __commonJS({
39
+ "node_modules/strict-env-resolver/lib/index.js"(exports2) {
40
+ "use strict";
41
+ Object.defineProperty(exports2, "__esModule", { value: true });
42
+ exports2.StrictEnvResolver = exports2.StrictEnvType = exports2.StrictEnvValidationError = exports2.StrictEnvError = void 0;
43
+ var TRUE_BOOLEAN_PATTERN = /^(1|true|yes|on)$/i;
44
+ var parseNumber = (raw) => {
45
+ const n = Number(raw);
46
+ if (!Number.isFinite(n)) {
47
+ return void 0;
48
+ }
49
+ return n;
50
+ };
51
+ var parseBooleanEnvValue = (normalizedRaw) => TRUE_BOOLEAN_PATTERN.test(normalizedRaw);
52
+ var StrictEnvError = class extends Error {
53
+ /**
54
+ * @param message - Error message.
55
+ */
56
+ constructor(message) {
57
+ super(message);
58
+ this.name = "StrictEnvError";
59
+ }
60
+ };
61
+ exports2.StrictEnvError = StrictEnvError;
62
+ var StrictEnvValidationError = class _StrictEnvValidationError extends StrictEnvError {
63
+ /**
64
+ * Formats validation errors into a human-readable error message.
65
+ *
66
+ * @template K - Environment variable key type.
67
+ * @param errors - Validation error entries to format.
68
+ * @returns Multi-line summary listing each key and message.
69
+ */
70
+ static format(errors) {
71
+ const lines = errors.map((e) => `- ${e.key}: ${e.message}${e.raw == null ? "" : ` (raw="${e.raw}")`}`);
72
+ return `Invalid environment variables (${errors.length}):
73
+ ${lines.join("\n")}`;
74
+ }
75
+ /**
76
+ * Creates a new validation error from one or more `StrictEnvValidationEntry` entries.
77
+ *
78
+ * @param errors - One or more structured validation errors.
79
+ */
80
+ constructor(errors) {
81
+ const msg = _StrictEnvValidationError.format(errors);
82
+ super(msg);
83
+ this.name = "StrictEnvValidationError";
84
+ this.errors = errors;
85
+ this.keys = errors.map((e) => e.key);
86
+ }
87
+ };
88
+ exports2.StrictEnvValidationError = StrictEnvValidationError;
89
+ exports2.StrictEnvType = {
90
+ /** Spec for a string value (returned as-is unless `trim: true` is set in options). */
91
+ String: { type: "string" },
92
+ /**
93
+ * Spec for a finite numeric value (`Number()` parsing; rejects `NaN` and `Infinity`).
94
+ */
95
+ Number: { type: "number" },
96
+ /** Spec for a boolean value (`1`/`true`/`yes`/`on` → `true`; other non-empty values → `false`). */
97
+ Boolean: { type: "boolean" },
98
+ /**
99
+ * Returns a spec that restricts the value to one of the given choices.
100
+ *
101
+ * @param choices - Allowed string literals.
102
+ * @returns Enum spec for use with `resolve` or `resolveAll`.
103
+ */
104
+ Enum: (choices) => ({ type: "enum", choices })
105
+ };
106
+ var defaultTrimForSpec = (spec) => spec.type !== "string";
107
+ var normalizeEnvRaw = (raw, trim) => {
108
+ if (raw == null) {
109
+ return void 0;
110
+ }
111
+ if (!trim) {
112
+ return raw;
113
+ }
114
+ return raw.trim();
115
+ };
116
+ var resolveSchemaEntry = (entry) => ({
117
+ spec: Array.isArray(entry) ? entry[0] : entry,
118
+ options: Array.isArray(entry) ? entry[1] : void 0
119
+ });
120
+ var parseEnvValue = (key, spec, raw, defaultValue, options) => {
121
+ const trim = options?.trim ?? defaultTrimForSpec(spec);
122
+ const normalizedRaw = normalizeEnvRaw(raw, trim);
123
+ const hasDefault = defaultValue !== void 0;
124
+ if (normalizedRaw == null || normalizedRaw === "") {
125
+ if (hasDefault) {
126
+ return { ok: true, value: defaultValue };
127
+ }
128
+ return {
129
+ ok: false,
130
+ error: { key, message: `Missing required environment variable: ${key}`, raw, kind: "missing" }
131
+ };
132
+ }
133
+ switch (spec.type) {
134
+ case "number": {
135
+ const n = parseNumber(normalizedRaw);
136
+ if (n === void 0) {
137
+ return {
138
+ ok: false,
139
+ error: { key, message: `Env ${key}: expected number, got "${raw}"`, raw, kind: "invalid_number" }
140
+ };
141
+ }
142
+ return { ok: true, value: n };
143
+ }
144
+ case "boolean":
145
+ return { ok: true, value: parseBooleanEnvValue(normalizedRaw) };
146
+ case "enum":
147
+ if (!spec.choices.includes(normalizedRaw)) {
148
+ return {
149
+ ok: false,
150
+ error: {
151
+ key,
152
+ message: `Env ${key}: must be one of [${spec.choices.join(", ")}]`,
153
+ raw,
154
+ kind: "invalid_enum"
155
+ }
156
+ };
157
+ }
158
+ return { ok: true, value: normalizedRaw };
159
+ default:
160
+ return { ok: true, value: normalizedRaw };
161
+ }
162
+ };
163
+ var resolve = (key, spec = exports2.StrictEnvType.String, options) => {
164
+ const result = parseEnvValue(key, spec, process.env[key], options?.default, options);
165
+ if (!result.ok) {
166
+ throw new StrictEnvValidationError([result.error]);
167
+ }
168
+ return result.value;
169
+ };
170
+ var resolveAll = (schema) => {
171
+ const envs = {};
172
+ const errors = [];
173
+ for (const key of Object.keys(schema)) {
174
+ const { spec, options } = resolveSchemaEntry(schema[key]);
175
+ const result = parseEnvValue(key, spec, process.env[key], options?.default, options);
176
+ if (!result.ok) {
177
+ errors.push(result.error);
178
+ continue;
179
+ }
180
+ envs[key] = result.value;
181
+ }
182
+ if (errors.length > 0)
183
+ throw new StrictEnvValidationError(errors);
184
+ return envs;
185
+ };
186
+ exports2.StrictEnvResolver = {
187
+ /** Reads and parses a single environment variable. See {@link resolve}. */
188
+ resolve,
189
+ /** Reads and parses multiple environment variables in one pass. See {@link resolveAll}. */
190
+ resolveAll
191
+ };
192
+ }
193
+ });
194
+
195
+ // src/funcs/notifier.lambda.ts
196
+ var notifier_lambda_exports = {};
197
+ __export(notifier_lambda_exports, {
198
+ handler: () => handler
199
+ });
200
+ module.exports = __toCommonJS(notifier_lambda_exports);
201
+ var import_client_codepipeline = require("@aws-sdk/client-codepipeline");
202
+ var import_client_sns = require("@aws-sdk/client-sns");
203
+ var import_strict_env_resolver = __toESM(require_lib());
204
+ var sns = new import_client_sns.SNSClient({});
205
+ var codepipeline = new import_client_codepipeline.CodePipelineClient({});
206
+ var mustEnv = (name) => import_strict_env_resolver.StrictEnvResolver.resolve(name, import_strict_env_resolver.StrictEnvType.String, { trim: true });
207
+ var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
208
+ var publish = async (topicArn, payload) => {
209
+ await sns.send(new import_client_sns.PublishCommand({
210
+ TopicArn: topicArn,
211
+ Message: JSON.stringify(payload)
212
+ }));
213
+ };
214
+ var pollPipelineExecution = async (params) => {
215
+ const {
216
+ topicArn,
217
+ pipelineName,
218
+ executionId,
219
+ pollIntervalSeconds,
220
+ maxPollMinutes,
221
+ startEvent
222
+ } = params;
223
+ const deadline = Date.now() + maxPollMinutes * 6e4;
224
+ let lastStatus;
225
+ await publish(topicArn, {
226
+ type: "codepipeline.execution",
227
+ phase: "eventbridge",
228
+ pipelineName,
229
+ executionId,
230
+ observedState: startEvent.detail?.state ?? "STARTED",
231
+ observedAt: (/* @__PURE__ */ new Date()).toISOString(),
232
+ event: startEvent
233
+ });
234
+ while (Date.now() < deadline) {
235
+ const res = await codepipeline.send(new import_client_codepipeline.GetPipelineExecutionCommand({
236
+ pipelineName,
237
+ pipelineExecutionId: executionId
238
+ }));
239
+ const statusRaw = res.pipelineExecution?.status ?? "UNKNOWN";
240
+ const status = String(statusRaw).toUpperCase();
241
+ if (status !== lastStatus) {
242
+ lastStatus = status;
243
+ await publish(topicArn, {
244
+ type: "codepipeline.execution",
245
+ phase: "poll",
246
+ pipelineName,
247
+ executionId,
248
+ observedState: status,
249
+ observedAt: (/* @__PURE__ */ new Date()).toISOString()
250
+ });
251
+ }
252
+ if (status === "SUCCEEDED" || status === "FAILED" || status === "STOPPED" || status === "SUPERSEDED") {
253
+ return;
254
+ }
255
+ await sleep(pollIntervalSeconds * 1e3);
256
+ }
257
+ await publish(topicArn, {
258
+ type: "codepipeline.execution",
259
+ phase: "poll",
260
+ pipelineName,
261
+ executionId,
262
+ observedState: lastStatus ?? "UNKNOWN",
263
+ observedAt: (/* @__PURE__ */ new Date()).toISOString(),
264
+ note: "Polling timed out before terminal state."
265
+ });
266
+ };
267
+ var handler = async (event) => {
268
+ const topicArn = mustEnv("SNS_TOPIC_ARN");
269
+ const pipelineName = event.detail?.pipeline;
270
+ const executionId = event.detail?.["execution-id"];
271
+ if (!pipelineName || !executionId) {
272
+ await publish(topicArn, {
273
+ type: "codepipeline.execution",
274
+ phase: "eventbridge",
275
+ observedAt: (/* @__PURE__ */ new Date()).toISOString(),
276
+ note: "Missing pipelineName or executionId in event.detail",
277
+ event
278
+ });
279
+ return;
280
+ }
281
+ const pollIntervalSeconds = import_strict_env_resolver.StrictEnvResolver.resolve("POLL_INTERVAL_SECONDS", import_strict_env_resolver.StrictEnvType.Number, { default: 10 });
282
+ const maxPollMinutes = import_strict_env_resolver.StrictEnvResolver.resolve("MAX_POLL_MINUTES", import_strict_env_resolver.StrictEnvType.Number, { default: 14 });
283
+ await pollPipelineExecution({
284
+ topicArn,
285
+ pipelineName,
286
+ executionId,
287
+ pollIntervalSeconds: pollIntervalSeconds > 0 ? pollIntervalSeconds : 10,
288
+ maxPollMinutes: maxPollMinutes > 0 ? maxPollMinutes : 14,
289
+ startEvent: event
290
+ });
291
+ };
292
+ // Annotate the CommonJS export names for ESM import in node:
293
+ 0 && (module.exports = {
294
+ handler
295
+ });
296
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../node_modules/strict-env-resolver/src/index.ts", "../../../src/funcs/notifier.lambda.ts"],
4
+ "sourcesContent": ["/**\n * Spec for a string environment variable.\n * Returned as-is by default (`trim` defaults to `false`). Set `trim: true` in options to trim\n * whitespace and treat whitespace-only values as missing.\n * The default value is passed via the third argument of `resolve` or a `[spec, options]` tuple in `resolveAll`, not in the spec.\n */\nexport type StrictEnvTypeString = { type: 'string'; default?: string };\n\n/**\n * Spec for a numeric environment variable.\n * Values are parsed with `Number()`; `NaN`, `Infinity`, and `-Infinity` are rejected.\n * The default value is passed via the third argument of `resolve` or a `[spec, options]` tuple in `resolveAll`, not in the spec.\n */\nexport type StrictEnvTypeNumber = { type: 'number'; default?: number };\n\n/**\n * Pattern for boolean env values that parse as `true`.\n * Matches `1`, `true`, `yes`, and `on` (case-insensitive) on the full trimmed string.\n */\nconst TRUE_BOOLEAN_PATTERN = /^(1|true|yes|on)$/i;\n\n/**\n * Parses a string as a finite number for environment variables.\n *\n * @param raw - Trimmed environment variable value.\n * @returns Parsed number, or `undefined` when the value is not a finite number.\n */\nconst parseNumber = (raw: string): number | undefined => {\n const n = Number(raw);\n if (!Number.isFinite(n)) {\n return undefined;\n }\n return n;\n};\n\n/**\n * Parses a trimmed string as a boolean environment variable value.\n *\n * @param normalizedRaw - Trimmed raw environment variable value.\n * @returns `true` for `1`/`true`/`yes`/`on` (case-insensitive); otherwise `false`.\n */\nconst parseBooleanEnvValue = (normalizedRaw: string): boolean => TRUE_BOOLEAN_PATTERN.test(normalizedRaw);\n\n/**\n * Spec for a boolean environment variable.\n * Parses `1`, `true`, `yes`, `on` (case-insensitive, after trim) as `true`; any other non-empty value as `false`.\n * Trims leading/trailing whitespace by default (see `StrictEnvOptions.trim`).\n * The default value is passed via the third argument of `resolve` or a `[spec, options]` tuple in `resolveAll`, not in the spec.\n */\nexport type StrictEnvTypeBoolean = { type: 'boolean'; default?: boolean };\n\n/**\n * Spec for an enum environment variable with a fixed set of choices.\n * The value must be one of `choices` (compared after trim); otherwise validation fails.\n * Trims leading/trailing whitespace by default (see `StrictEnvOptions.trim`).\n * The default value is passed via the third argument of `resolve` or a `[spec, options]` tuple in `resolveAll`, not in the spec.\n *\n * @template T - Literal string union of allowed values.\n */\nexport type StrictEnvTypeEnum<T extends string = string> = { type: 'enum'; choices: readonly T[]; default?: T };\n\n/** Union of all environment variable spec types. */\nexport type StrictEnvSpec =\n | StrictEnvTypeString\n | StrictEnvTypeNumber\n | StrictEnvTypeBoolean\n | StrictEnvTypeEnum;\n\n/**\n * Discriminated union of error kinds emitted during environment variable parsing.\n *\n * - `missing` — Variable unset, empty string, or whitespace-only (when trim is enabled) without a default.\n * - `invalid_number` — Value is not a finite number (see `StrictEnvTypeNumber`).\n * - `invalid_enum` — Value is not one of the allowed enum choices.\n */\nexport type StrictEnvErrorKind = 'missing' | 'invalid_number' | 'invalid_enum';\n\n/**\n * A structured validation error entry for a single environment variable.\n *\n * @template K - Environment variable key type.\n */\nexport type StrictEnvValidationEntry<K extends string = string> = {\n /** Environment variable name. */\n key: K;\n /** Human-readable error message. */\n message: string;\n /** Raw value from `process.env`, if present. */\n raw?: string;\n /** Error category for programmatic handling. */\n kind: StrictEnvErrorKind;\n};\n\n/**\n * Base error class for this package.\n *\n * @example\n * ```ts\n * try {\n * StrictEnvResolver.resolve('PORT', StrictEnvType.Number);\n * } catch (e) {\n * if (e instanceof StrictEnvError) {\n * // Handle all strict-env-resolver errors\n * }\n * }\n * ```\n */\nexport abstract class StrictEnvError extends Error {\n /**\n * @param message - Error message.\n */\n protected constructor(message: string) {\n super(message);\n this.name = 'StrictEnvError';\n }\n}\n\n/**\n * Validation error that carries one or more environment variable issues.\n *\n * Thrown by `StrictEnvResolver.resolve()` (single-entry `errors`) and\n * `StrictEnvResolver.resolveAll()` (multi-entry `errors`).\n * Individual entries are produced by the internal `parseEnvValue` helper.\n *\n * @template K - Union of environment variable keys included in `errors`.\n */\nexport class StrictEnvValidationError<K extends string = string> extends StrictEnvError {\n /**\n * Formats validation errors into a human-readable error message.\n *\n * @template K - Environment variable key type.\n * @param errors - Validation error entries to format.\n * @returns Multi-line summary listing each key and message.\n */\n public static format<K extends string>(errors: readonly StrictEnvValidationEntry<K>[]): string {\n const lines = errors.map((e) => `- ${e.key}: ${e.message}${e.raw == null ? '' : ` (raw=\"${e.raw}\")`}`);\n return `Invalid environment variables (${errors.length}):\\n${lines.join('\\n')}`;\n }\n\n /**\n * Structured list of validation errors.\n */\n public readonly errors: readonly StrictEnvValidationEntry<K>[];\n /**\n * Convenience list of keys included in `errors`.\n */\n public readonly keys: readonly K[];\n\n /**\n * Creates a new validation error from one or more `StrictEnvValidationEntry` entries.\n *\n * @param errors - One or more structured validation errors.\n */\n public constructor(errors: readonly StrictEnvValidationEntry<K>[]) {\n const msg = StrictEnvValidationError.format(errors);\n super(msg);\n this.name = 'StrictEnvValidationError';\n this.errors = errors;\n this.keys = errors.map((e) => e.key);\n }\n}\n\n/**\n * Predefined spec constants for use with `resolve` or as schema values in `resolveAll`.\n * Provide defaults via the third argument of `resolve` or a `[spec, { default }]` tuple in `resolveAll`.\n */\nexport const StrictEnvType = {\n /** Spec for a string value (returned as-is unless `trim: true` is set in options). */\n String: { type: 'string' } as const satisfies StrictEnvTypeString,\n /**\n * Spec for a finite numeric value (`Number()` parsing; rejects `NaN` and `Infinity`).\n */\n Number: { type: 'number' } as const satisfies StrictEnvTypeNumber,\n /** Spec for a boolean value (`1`/`true`/`yes`/`on` → `true`; other non-empty values → `false`). */\n Boolean: { type: 'boolean' } as const satisfies StrictEnvTypeBoolean,\n /**\n * Returns a spec that restricts the value to one of the given choices.\n *\n * @param choices - Allowed string literals.\n * @returns Enum spec for use with `resolve` or `resolveAll`.\n */\n Enum: <T extends string>(choices: readonly T[]) => ({ type: 'enum', choices }) as StrictEnvTypeEnum<T>,\n} as const;\n\n/**\n * Infers the return type from the given spec.\n * @template S - A `StrictEnvSpec` variant.\n */\nexport type StrictEnvSpecToType<S> =\n S extends StrictEnvTypeString ? string\n : S extends StrictEnvTypeNumber ? number\n : S extends StrictEnvTypeBoolean ? boolean\n : S extends StrictEnvTypeEnum<infer T> ? T\n : never;\n\n/**\n * Options for reading an environment variable with an optional default.\n * Used as the third argument to `resolve` or as the second element of a `[spec, options]` tuple in `resolveAll`.\n *\n * `trim` defaults to `true` for `number`, `boolean`, and `enum` specs (whitespace-only values are\n * treated as missing). For `string` specs it defaults to `false` (values are returned as-is).\n *\n * @template S - Environment variable spec type.\n */\nexport type StrictEnvOptions<S extends StrictEnvSpec> = {\n default?: StrictEnvSpecToType<S>;\n /** When `true`, trims leading/trailing whitespace before validation. */\n trim?: boolean;\n};\n\n/**\n * Schema entry for a single env var.\n *\n * Either provide a spec directly, or a tuple of `[spec, options]` to attach a default.\n */\nexport type StrictEnvSchemaEntry<S extends StrictEnvSpec = StrictEnvSpec> = S | readonly [S, StrictEnvOptions<S>];\n\n/**\n * Schema object used by `resolveAll()`.\n *\n * Keys are env var names, values are specs (optionally with defaults).\n */\nexport type StrictEnvSchema = Record<string, StrictEnvSchemaEntry>;\n\n/**\n * Extracts the spec type from a schema entry or `[spec, options]` tuple.\n *\n * @template E - Schema entry type.\n */\ntype StrictEnvSchemaEntryToSpec<E> = E extends readonly [infer S, unknown] ? S : E;\n\n/**\n * Maps a schema object to the resulting parsed environment object type.\n *\n * @template TSchema - Schema object type passed to `resolveAll`.\n */\nexport type StrictEnvSchemaToType<TSchema extends StrictEnvSchema> = {\n [K in keyof TSchema]: StrictEnvSpecToType<StrictEnvSchemaEntryToSpec<TSchema[K]> & StrictEnvSpec>;\n};\n\n/**\n * Discriminated result of parsing a single environment variable.\n *\n * On success, `value` holds the parsed result. On failure, `error` holds a structured\n * `StrictEnvValidationEntry` entry (never throws).\n *\n * @template K - Environment variable key type.\n * @template S - Environment variable spec type.\n */\ntype ParseEnvValueResult<K extends string, S extends StrictEnvSpec> =\n | { ok: true; value: StrictEnvSpecToType<S> }\n | { ok: false; error: StrictEnvValidationEntry<K> };\n\n/**\n * Default trim behavior per spec type.\n * Parsed types trim by default; strings preserve the raw value unless opted in.\n *\n * @param spec - Environment variable spec.\n * @returns Whether leading/trailing whitespace should be trimmed before validation.\n */\nconst defaultTrimForSpec = (spec: StrictEnvSpec): boolean => spec.type !== 'string';\n\n/**\n * Normalizes a raw environment variable value before validation.\n *\n * @param raw - Raw value from `process.env`, if present.\n * @param trim - Whether to trim leading/trailing whitespace.\n * @returns Normalized value, or `undefined` when unset.\n */\nconst normalizeEnvRaw = (raw: string | undefined, trim: boolean): string | undefined => {\n if (raw == null) {\n return undefined;\n }\n if (!trim) {\n return raw;\n }\n return raw.trim();\n};\n\n/** Options accepted by `parseEnvValue` (subset of `StrictEnvOptions`). */\ntype ParseEnvValueOptions<S extends StrictEnvSpec> = Pick<StrictEnvOptions<S>, 'trim'>;\n\n/**\n * Resolves a schema entry into its spec and optional per-key options.\n *\n * @param entry - Schema entry or `[spec, options]` tuple.\n * @returns Parsed spec and options for `resolveAll`.\n */\nconst resolveSchemaEntry = (\n entry: StrictEnvSchemaEntry,\n): { spec: StrictEnvSpec; options: StrictEnvOptions<StrictEnvSpec> | undefined } => ({\n spec: (Array.isArray(entry) ? entry[0] : entry) as StrictEnvSpec,\n options: (Array.isArray(entry) ? entry[1] : undefined) as StrictEnvOptions<StrictEnvSpec> | undefined,\n});\n\n/**\n * Parses a single environment variable according to the given spec.\n *\n * Central validation helper shared by `resolve` and `resolveAll`. Does not throw;\n * callers decide whether to throw immediately or collect errors.\n *\n * Missing or empty (`\"\"`) values use `defaultValue` when provided. When `trim` is enabled,\n * whitespace-only values are treated as empty. Number specs delegate to `parseNumber`.\n * Boolean specs treat `1`/`true`/`yes`/`on` (case-insensitive, after trim) as `true`.\n * Enum specs require an exact match in `choices` (after trim).\n *\n * @template K - Environment variable key type.\n * @template S - Environment variable spec type.\n * @param key - Environment variable name.\n * @param spec - Type spec for the value.\n * @param raw - Raw value from `process.env`, if present.\n * @param defaultValue - Fallback when `raw` is missing or empty.\n * @param options - Optional trim override (`trim` defaults per spec type).\n * @returns Parsed value or a structured validation error.\n */\nconst parseEnvValue = <K extends string, S extends StrictEnvSpec>(\n key: K,\n spec: S,\n raw: string | undefined,\n defaultValue: StrictEnvSpecToType<S> | undefined,\n options?: ParseEnvValueOptions<S>,\n): ParseEnvValueResult<K, S> => {\n const trim = options?.trim ?? defaultTrimForSpec(spec);\n const normalizedRaw = normalizeEnvRaw(raw, trim);\n const hasDefault = defaultValue !== undefined;\n\n if (normalizedRaw == null || normalizedRaw === '') {\n if (hasDefault) {\n return { ok: true, value: defaultValue as StrictEnvSpecToType<S> };\n }\n return {\n ok: false,\n error: { key, message: `Missing required environment variable: ${key}`, raw, kind: 'missing' },\n };\n }\n\n switch (spec.type) {\n case 'number': {\n const n = parseNumber(normalizedRaw);\n if (n === undefined) {\n return {\n ok: false,\n error: { key, message: `Env ${key}: expected number, got \"${raw}\"`, raw, kind: 'invalid_number' },\n };\n }\n return { ok: true, value: n as StrictEnvSpecToType<S> };\n }\n case 'boolean':\n return { ok: true, value: parseBooleanEnvValue(normalizedRaw) as StrictEnvSpecToType<S> };\n case 'enum':\n if (!spec.choices.includes(normalizedRaw)) {\n return {\n ok: false,\n error: {\n key,\n message: `Env ${key}: must be one of [${spec.choices.join(', ')}]`,\n raw,\n kind: 'invalid_enum',\n },\n };\n }\n return { ok: true, value: normalizedRaw as StrictEnvSpecToType<S> };\n default:\n return { ok: true, value: normalizedRaw as StrictEnvSpecToType<S> };\n }\n};\n\n/**\n * Reads and parses an environment variable according to the given spec.\n *\n * Delegates validation to `parseEnvValue`. Missing or empty (`\"\"`) values use\n * `options.default` when provided; otherwise a `StrictEnvValidationError` is thrown.\n * For `StrictEnvType.Number`, values are parsed as finite numbers (see `StrictEnvTypeNumber`).\n *\n * @template K - Environment variable key type.\n * @template S - Environment variable spec type.\n * @param key - Environment variable name (e.g. `\"PORT\"`, `\"NODE_ENV\"`).\n * @param spec - Type spec; defaults to `StrictEnvType.String` when omitted.\n * @param options - Optional `{ default, trim }`; see {@link StrictEnvOptions}.\n * @returns Parsed value with type inferred from `spec`.\n * @throws {StrictEnvValidationError} When the variable is missing, empty without a default, or invalid for the spec.\n */\nconst resolve = <K extends string, S extends StrictEnvSpec = StrictEnvTypeString>(\n key: K,\n spec: S = StrictEnvType.String as S,\n options?: StrictEnvOptions<S>,\n): StrictEnvSpecToType<S> => {\n const result = parseEnvValue(key, spec, process.env[key], options?.default, options);\n if (!result.ok) {\n throw new StrictEnvValidationError([result.error]);\n }\n return result.value;\n};\n\n/**\n * Reads and parses multiple environment variables according to the given schema.\n *\n * Always evaluates every key in `schema`. Each entry is validated via `parseEnvValue`;\n * all errors are collected and thrown once in a single `StrictEnvValidationError`.\n * Number specs use the same finite-number rules as `resolve`.\n *\n * @template TSchema - Schema object type.\n * @param schema - Map of environment variable names to specs, optionally with per-key defaults via `[spec, { default }]`.\n * @returns Parsed environment object with types inferred from the schema.\n * @throws {StrictEnvValidationError} When one or more variables are missing, empty without a default, or invalid.\n */\nconst resolveAll = <TSchema extends StrictEnvSchema>(schema: TSchema): StrictEnvSchemaToType<TSchema> => {\n const envs: Partial<StrictEnvSchemaToType<TSchema>> = {};\n const errors: StrictEnvValidationEntry<Extract<keyof TSchema, string>>[] = [];\n\n for (const key of Object.keys(schema) as Array<Extract<keyof TSchema, string>>) {\n const { spec, options } = resolveSchemaEntry(schema[key]);\n\n const result = parseEnvValue(key, spec, process.env[key], options?.default, options);\n if (!result.ok) {\n errors.push(result.error);\n continue;\n }\n envs[key] = result.value as StrictEnvSchemaToType<TSchema>[typeof key];\n }\n\n if (errors.length > 0) throw new StrictEnvValidationError(errors);\n return envs as StrictEnvSchemaToType<TSchema>;\n};\n\n/**\n * Type-safe environment variable resolver for Node.js `process.env`.\n *\n * @example\n * ```ts\n * const port = StrictEnvResolver.resolve('PORT', StrictEnvType.Number);\n * const envs = StrictEnvResolver.resolveAll({\n * PORT: StrictEnvType.Number,\n * DEBUG: [StrictEnvType.Boolean, { default: false }],\n * });\n * ```\n */\nexport const StrictEnvResolver = {\n /** Reads and parses a single environment variable. See {@link resolve}. */\n resolve,\n /** Reads and parses multiple environment variables in one pass. See {@link resolveAll}. */\n resolveAll,\n} as const;\n", "import { CodePipelineClient, GetPipelineExecutionCommand } from '@aws-sdk/client-codepipeline';\nimport { PublishCommand, SNSClient } from '@aws-sdk/client-sns';\nimport type { EventBridgeEvent } from 'aws-lambda';\nimport { StrictEnvResolver, StrictEnvType } from 'strict-env-resolver';\n\n/**\n * EventBridge detail payload for CodePipeline execution state-change events.\n */\ntype CodePipelineExecutionStartedDetail = {\n 'pipeline'?: string;\n 'state'?: string;\n 'version'?: string;\n 'execution-id'?: string;\n};\n\n/**\n * EventBridge event for CodePipeline execution state-change notifications.\n */\ntype CodePipelineExecutionStartedEvent = EventBridgeEvent<\n 'CodePipeline Pipeline Execution State Change',\n CodePipelineExecutionStartedDetail\n>;\n\n/**\n * SNS client used to publish notifications.\n */\nconst sns = new SNSClient({});\n\n/**\n * CodePipeline client used to poll execution state.\n */\nconst codepipeline = new CodePipelineClient({});\n\n/**\n * Reads a required environment variable.\n */\nconst mustEnv = (name: string): string => StrictEnvResolver.resolve(name, StrictEnvType.String, { trim: true });\n\n/**\n * Sleeps for the specified number of milliseconds.\n */\nconst sleep = (ms: number): Promise<void> => new Promise((resolve) => setTimeout(resolve, ms));\n\n/**\n * Publishes a JSON payload to the given SNS topic ARN.\n */\nconst publish = async (topicArn: string, payload: unknown): Promise<void> => {\n await sns.send(new PublishCommand({\n TopicArn: topicArn,\n Message: JSON.stringify(payload),\n }));\n};\n\n/**\n * Polls a CodePipeline execution and publishes notifications whenever the execution status changes.\n */\nconst pollPipelineExecution = async (params: {\n topicArn: string;\n pipelineName: string;\n executionId: string;\n pollIntervalSeconds: number;\n maxPollMinutes: number;\n startEvent: CodePipelineExecutionStartedEvent;\n}): Promise<void> => {\n const {\n topicArn,\n pipelineName,\n executionId,\n pollIntervalSeconds,\n maxPollMinutes,\n startEvent,\n } = params;\n\n const deadline = Date.now() + maxPollMinutes * 60_000;\n let lastStatus: string | undefined;\n\n // \u6700\u521D\u306B STARTED \u3092\u901A\u77E5\uFF08EventBridge\u7531\u6765\uFF09\n await publish(topicArn, {\n type: 'codepipeline.execution',\n phase: 'eventbridge',\n pipelineName,\n executionId,\n observedState: startEvent.detail?.state ?? 'STARTED',\n observedAt: new Date().toISOString(),\n event: startEvent,\n });\n\n while (Date.now() < deadline) {\n const res = await codepipeline.send(new GetPipelineExecutionCommand({\n pipelineName,\n pipelineExecutionId: executionId,\n }));\n\n const statusRaw = res.pipelineExecution?.status ?? 'UNKNOWN';\n const status = String(statusRaw).toUpperCase();\n if (status !== lastStatus) {\n lastStatus = status;\n await publish(topicArn, {\n type: 'codepipeline.execution',\n phase: 'poll',\n pipelineName,\n executionId,\n observedState: status,\n observedAt: new Date().toISOString(),\n });\n }\n\n if (status === 'SUCCEEDED' || status === 'FAILED' || status === 'STOPPED' || status === 'SUPERSEDED') {\n return;\n }\n\n await sleep(pollIntervalSeconds * 1000);\n }\n\n await publish(topicArn, {\n type: 'codepipeline.execution',\n phase: 'poll',\n pipelineName,\n executionId,\n observedState: lastStatus ?? 'UNKNOWN',\n observedAt: new Date().toISOString(),\n note: 'Polling timed out before terminal state.',\n });\n};\n\n/**\n * Lambda handler triggered by EventBridge when a pipeline execution transitions to STARTED.\n * It polls the execution status until it reaches a terminal state or times out.\n */\nexport const handler = async (event: CodePipelineExecutionStartedEvent): Promise<void> => {\n const topicArn = mustEnv('SNS_TOPIC_ARN');\n const pipelineName = event.detail?.pipeline;\n const executionId = event.detail?.['execution-id'];\n\n if (!pipelineName || !executionId) {\n await publish(topicArn, {\n type: 'codepipeline.execution',\n phase: 'eventbridge',\n observedAt: new Date().toISOString(),\n note: 'Missing pipelineName or executionId in event.detail',\n event,\n });\n return;\n }\n\n const pollIntervalSeconds = StrictEnvResolver.resolve('POLL_INTERVAL_SECONDS', StrictEnvType.Number, { default: 10 });\n const maxPollMinutes = StrictEnvResolver.resolve('MAX_POLL_MINUTES', StrictEnvType.Number, { default: 14 });\n\n await pollPipelineExecution({\n topicArn,\n pipelineName,\n executionId,\n pollIntervalSeconds: pollIntervalSeconds > 0 ? pollIntervalSeconds : 10,\n maxPollMinutes: maxPollMinutes > 0 ? maxPollMinutes : 14,\n startEvent: event,\n });\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,QAAM,uBAAuB;AAQ7B,QAAM,cAAc,CAAC,QAAmC;AACtD,YAAM,IAAI,OAAO,GAAG;AACpB,UAAI,CAAC,OAAO,SAAS,CAAC,GAAG;AACvB,eAAO;MACT;AACA,aAAO;IACT;AAQA,QAAM,uBAAuB,CAAC,kBAAmC,qBAAqB,KAAK,aAAa;AAkExG,QAAsB,iBAAtB,cAA6C,MAAK;;;;MAIhD,YAAsB,SAAe;AACnC,cAAM,OAAO;AACb,aAAK,OAAO;MACd;;AAPF,IAAAA,SAAA,iBAAA;AAmBA,QAAa,2BAAb,MAAa,kCAA4D,eAAc;;;;;;;;MAQ9E,OAAO,OAAyB,QAA8C;AACnF,cAAM,QAAQ,OAAO,IAAI,CAAC,MAAM,KAAK,EAAE,GAAG,KAAK,EAAE,OAAO,GAAG,EAAE,OAAO,OAAO,KAAK,UAAU,EAAE,GAAG,IAAI,EAAE;AACrG,eAAO,kCAAkC,OAAO,MAAM;EAAO,MAAM,KAAK,IAAI,CAAC;MAC/E;;;;;;MAgBA,YAAmB,QAA8C;AAC/D,cAAM,MAAM,0BAAyB,OAAO,MAAM;AAClD,cAAM,GAAG;AACT,aAAK,OAAO;AACZ,aAAK,SAAS;AACd,aAAK,OAAO,OAAO,IAAI,CAAC,MAAM,EAAE,GAAG;MACrC;;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