@ndlib/ndlib-cdk2 1.0.35 → 1.0.37
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/README.md +3 -3
- package/lib/internal-lambdas/sourceWatcherLambda/src/node_modules/brace-expansion/README.md +0 -6
- package/lib/internal-lambdas/sourceWatcherLambda/src/node_modules/brace-expansion/index.js +84 -86
- package/lib/internal-lambdas/sourceWatcherLambda/src/node_modules/brace-expansion/package.json +7 -3
- package/lib/internal-lambdas/sourceWatcherLambda/src/package.json +4 -4
- package/lib/slack-pipeline-status-notifications.d.ts +1 -1
- package/lib/slack-pipeline-status-notifications.js +1 -2
- package/lib/source-watcher.d.ts +2 -1
- package/lib/source-watcher.js +12 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -113,7 +113,7 @@ if(props.slackChannelId){
|
|
|
113
113
|
// messageText: 'example of additional message text', // optional
|
|
114
114
|
slackChannelId: props.slackChannelId,
|
|
115
115
|
slackChannelName: props.slackChannelName,
|
|
116
|
-
|
|
116
|
+
slackNotifyTopicArn: 'some valid topic arn',
|
|
117
117
|
})
|
|
118
118
|
}
|
|
119
119
|
```
|
|
@@ -424,8 +424,8 @@ import { Topic } from 'aws-cdk-lib/aws-sns'
|
|
|
424
424
|
|
|
425
425
|
...
|
|
426
426
|
// Create a Topic
|
|
427
|
-
const
|
|
428
|
-
const approvalTopic = Topic.fromTopicArn(this, 'SlackTopicFromArn',
|
|
427
|
+
const slackNotifyTopicArn = StringParameter.valueForStringParameter(this, props.slackNotifyTopicArnParameterPath)
|
|
428
|
+
const approvalTopic = Topic.fromTopicArn(this, 'SlackTopicFromArn', slackNotifyTopicArn)
|
|
429
429
|
|
|
430
430
|
// Call the SlackIntegratedManualApproval
|
|
431
431
|
const approveTestStackAction = new SlackIntegratedManualApproval({
|
|
@@ -104,12 +104,6 @@ This module is proudly supported by my [Sponsors](https://github.com/juliangrube
|
|
|
104
104
|
|
|
105
105
|
Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)!
|
|
106
106
|
|
|
107
|
-
## Security contact information
|
|
108
|
-
|
|
109
|
-
To report a security vulnerability, please use the
|
|
110
|
-
[Tidelift security contact](https://tidelift.com/security).
|
|
111
|
-
Tidelift will coordinate the fix and disclosure.
|
|
112
|
-
|
|
113
107
|
## License
|
|
114
108
|
|
|
115
109
|
(MIT)
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
var concatMap = require('concat-map');
|
|
1
2
|
var balanced = require('balanced-match');
|
|
2
3
|
|
|
3
4
|
module.exports = expandTop;
|
|
@@ -78,6 +79,10 @@ function expandTop(str) {
|
|
|
78
79
|
return expand(escapeBraces(str), true).map(unescapeBraces);
|
|
79
80
|
}
|
|
80
81
|
|
|
82
|
+
function identity(e) {
|
|
83
|
+
return e;
|
|
84
|
+
}
|
|
85
|
+
|
|
81
86
|
function embrace(str) {
|
|
82
87
|
return '{' + str + '}';
|
|
83
88
|
}
|
|
@@ -96,7 +101,42 @@ function expand(str, isTop) {
|
|
|
96
101
|
var expansions = [];
|
|
97
102
|
|
|
98
103
|
var m = balanced('{', '}', str);
|
|
99
|
-
if (!m) return [str];
|
|
104
|
+
if (!m || /\$$/.test(m.pre)) return [str];
|
|
105
|
+
|
|
106
|
+
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
107
|
+
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
108
|
+
var isSequence = isNumericSequence || isAlphaSequence;
|
|
109
|
+
var isOptions = m.body.indexOf(',') >= 0;
|
|
110
|
+
if (!isSequence && !isOptions) {
|
|
111
|
+
// {a},b}
|
|
112
|
+
if (m.post.match(/,(?!,).*\}/)) {
|
|
113
|
+
str = m.pre + '{' + m.body + escClose + m.post;
|
|
114
|
+
return expand(str);
|
|
115
|
+
}
|
|
116
|
+
return [str];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
var n;
|
|
120
|
+
if (isSequence) {
|
|
121
|
+
n = m.body.split(/\.\./);
|
|
122
|
+
} else {
|
|
123
|
+
n = parseCommaParts(m.body);
|
|
124
|
+
if (n.length === 1) {
|
|
125
|
+
// x{{a,b}}y ==> x{a}y x{b}y
|
|
126
|
+
n = expand(n[0], false).map(embrace);
|
|
127
|
+
if (n.length === 1) {
|
|
128
|
+
var post = m.post.length
|
|
129
|
+
? expand(m.post, false)
|
|
130
|
+
: [''];
|
|
131
|
+
return post.map(function(p) {
|
|
132
|
+
return m.pre + n[0] + p;
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// at this point, n is the parts, and we know it's not a comma set
|
|
139
|
+
// with a single entry.
|
|
100
140
|
|
|
101
141
|
// no need to expand pre, since it is guaranteed to be free of brace-sets
|
|
102
142
|
var pre = m.pre;
|
|
@@ -104,97 +144,55 @@ function expand(str, isTop) {
|
|
|
104
144
|
? expand(m.post, false)
|
|
105
145
|
: [''];
|
|
106
146
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
var
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
var
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
return expand(str);
|
|
122
|
-
}
|
|
123
|
-
return [str];
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
var n;
|
|
127
|
-
if (isSequence) {
|
|
128
|
-
n = m.body.split(/\.\./);
|
|
129
|
-
} else {
|
|
130
|
-
n = parseCommaParts(m.body);
|
|
131
|
-
if (n.length === 1) {
|
|
132
|
-
// x{{a,b}}y ==> x{a}y x{b}y
|
|
133
|
-
n = expand(n[0], false).map(embrace);
|
|
134
|
-
if (n.length === 1) {
|
|
135
|
-
return post.map(function(p) {
|
|
136
|
-
return m.pre + n[0] + p;
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
}
|
|
147
|
+
var N;
|
|
148
|
+
|
|
149
|
+
if (isSequence) {
|
|
150
|
+
var x = numeric(n[0]);
|
|
151
|
+
var y = numeric(n[1]);
|
|
152
|
+
var width = Math.max(n[0].length, n[1].length)
|
|
153
|
+
var incr = n.length == 3
|
|
154
|
+
? Math.abs(numeric(n[2]))
|
|
155
|
+
: 1;
|
|
156
|
+
var test = lte;
|
|
157
|
+
var reverse = y < x;
|
|
158
|
+
if (reverse) {
|
|
159
|
+
incr *= -1;
|
|
160
|
+
test = gte;
|
|
140
161
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
N = [];
|
|
162
|
-
|
|
163
|
-
for (var i = x; test(i, y); i += incr) {
|
|
164
|
-
var c;
|
|
165
|
-
if (isAlphaSequence) {
|
|
166
|
-
c = String.fromCharCode(i);
|
|
167
|
-
if (c === '\\')
|
|
168
|
-
c = '';
|
|
169
|
-
} else {
|
|
170
|
-
c = String(i);
|
|
171
|
-
if (pad) {
|
|
172
|
-
var need = width - c.length;
|
|
173
|
-
if (need > 0) {
|
|
174
|
-
var z = new Array(need + 1).join('0');
|
|
175
|
-
if (i < 0)
|
|
176
|
-
c = '-' + z + c.slice(1);
|
|
177
|
-
else
|
|
178
|
-
c = z + c;
|
|
179
|
-
}
|
|
162
|
+
var pad = n.some(isPadded);
|
|
163
|
+
|
|
164
|
+
N = [];
|
|
165
|
+
|
|
166
|
+
for (var i = x; test(i, y); i += incr) {
|
|
167
|
+
var c;
|
|
168
|
+
if (isAlphaSequence) {
|
|
169
|
+
c = String.fromCharCode(i);
|
|
170
|
+
if (c === '\\')
|
|
171
|
+
c = '';
|
|
172
|
+
} else {
|
|
173
|
+
c = String(i);
|
|
174
|
+
if (pad) {
|
|
175
|
+
var need = width - c.length;
|
|
176
|
+
if (need > 0) {
|
|
177
|
+
var z = new Array(need + 1).join('0');
|
|
178
|
+
if (i < 0)
|
|
179
|
+
c = '-' + z + c.slice(1);
|
|
180
|
+
else
|
|
181
|
+
c = z + c;
|
|
180
182
|
}
|
|
181
183
|
}
|
|
182
|
-
N.push(c);
|
|
183
|
-
}
|
|
184
|
-
} else {
|
|
185
|
-
N = [];
|
|
186
|
-
|
|
187
|
-
for (var j = 0; j < n.length; j++) {
|
|
188
|
-
N.push.apply(N, expand(n[j], false));
|
|
189
184
|
}
|
|
185
|
+
N.push(c);
|
|
190
186
|
}
|
|
187
|
+
} else {
|
|
188
|
+
N = concatMap(n, function(el) { return expand(el, false) });
|
|
189
|
+
}
|
|
191
190
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
191
|
+
for (var j = 0; j < N.length; j++) {
|
|
192
|
+
for (var k = 0; k < post.length; k++) {
|
|
193
|
+
var expansion = pre + N[j] + post[k];
|
|
194
|
+
if (!isTop || isSequence || expansion)
|
|
195
|
+
expansions.push(expansion);
|
|
198
196
|
}
|
|
199
197
|
}
|
|
200
198
|
|
package/lib/internal-lambdas/sourceWatcherLambda/src/node_modules/brace-expansion/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brace-expansion",
|
|
3
3
|
"description": "Brace expansion as known from sh/bash",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "1.1.12",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git://github.com/juliangruber/brace-expansion.git"
|
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
"bench": "matcha test/perf/bench.js"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"balanced-match": "^1.0.0"
|
|
17
|
+
"balanced-match": "^1.0.0",
|
|
18
|
+
"concat-map": "0.0.1"
|
|
18
19
|
},
|
|
19
20
|
"devDependencies": {
|
|
20
|
-
"
|
|
21
|
+
"matcha": "^0.7.0",
|
|
21
22
|
"tape": "^4.6.0"
|
|
22
23
|
},
|
|
23
24
|
"keywords": [],
|
|
@@ -42,5 +43,8 @@
|
|
|
42
43
|
"iphone/6.0..latest",
|
|
43
44
|
"android-browser/4.2..latest"
|
|
44
45
|
]
|
|
46
|
+
},
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"tag": "1.x"
|
|
45
49
|
}
|
|
46
50
|
}
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"node": ">=22.0.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@aws-sdk/client-codepipeline": "^3.
|
|
24
|
-
"@aws-sdk/client-ssm": "^3.
|
|
23
|
+
"@aws-sdk/client-codepipeline": "^3.840.0",
|
|
24
|
+
"@aws-sdk/client-ssm": "^3.840.0"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@aws-sdk/client-codepipeline": "^3.
|
|
28
|
-
"@aws-sdk/client-ssm": "^3.
|
|
27
|
+
"@aws-sdk/client-codepipeline": "^3.840.0",
|
|
28
|
+
"@aws-sdk/client-ssm": "^3.840.0",
|
|
29
29
|
"glob": "^11.0.3",
|
|
30
30
|
"multimatch": "5.0.0",
|
|
31
31
|
"cross-spawn": "^7.0.6"
|
|
@@ -5,7 +5,7 @@ export interface ISlackPipelineStatusNotificationsProps extends StackProps {
|
|
|
5
5
|
readonly messageText?: string;
|
|
6
6
|
readonly slackChannelId: string;
|
|
7
7
|
readonly slackChannelName?: string;
|
|
8
|
-
readonly slackNotifyTopicArn
|
|
8
|
+
readonly slackNotifyTopicArn: string;
|
|
9
9
|
}
|
|
10
10
|
export interface ISlackPipelineStatusNotificationsData {
|
|
11
11
|
eventInfo: string;
|
|
@@ -11,8 +11,7 @@ class SlackPipelineStatusNotifications extends constructs_1.Construct {
|
|
|
11
11
|
const pipelineName = aws_cdk_lib_1.aws_events.EventField.fromPath('$.detail.pipeline');
|
|
12
12
|
const pipelineState = aws_cdk_lib_1.aws_events.EventField.fromPath('$.detail.state');
|
|
13
13
|
const pipelineBaseUrl = aws_cdk_lib_1.Fn.sub('https://${AWS::Region}.console.aws.amazon.com/codepipeline/home?region=${AWS::Region}#/view/');
|
|
14
|
-
|
|
15
|
-
const testStackApprovalTopic = aws_sns_1.Topic.fromTopicArn(this, 'SlackTopicFromArn', props.slackNotifyTopicArn || aws_cdk_lib_1.Fn.importValue('slack-pipeline-status-notify:TopicArn'));
|
|
14
|
+
const testStackApprovalTopic = aws_sns_1.Topic.fromTopicArn(this, 'SlackTopicFromArn', props.slackNotifyTopicArn);
|
|
16
15
|
const SlackPipelineStatusNotificationsData = {
|
|
17
16
|
eventInfo: eventInfo,
|
|
18
17
|
messageText: props.messageText,
|
package/lib/source-watcher.d.ts
CHANGED
|
@@ -30,7 +30,8 @@ export interface ISourceWatcherProps {
|
|
|
30
30
|
/**
|
|
31
31
|
* Stack name for aws-github-webhook. Needed in order to create a webhook on targetRepo.
|
|
32
32
|
*/
|
|
33
|
-
readonly webhookResourceStackName
|
|
33
|
+
readonly webhookResourceStackName?: string;
|
|
34
|
+
readonly webhookResourceArnParameterPath?: string;
|
|
34
35
|
}
|
|
35
36
|
export declare class SourceWatcher extends Construct {
|
|
36
37
|
/**
|
package/lib/source-watcher.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SourceWatcher = void 0;
|
|
4
4
|
const aws_cdk_lib_1 = require("aws-cdk-lib");
|
|
5
5
|
const constructs_1 = require("constructs");
|
|
6
|
+
const aws_ssm_1 = require("aws-cdk-lib/aws-ssm");
|
|
6
7
|
const path = require("path");
|
|
7
8
|
class SourceWatcher extends constructs_1.Construct {
|
|
8
9
|
constructor(scope, id, props) {
|
|
@@ -55,8 +56,18 @@ class SourceWatcher extends constructs_1.Construct {
|
|
|
55
56
|
handler: this.lambdaFunction,
|
|
56
57
|
proxy: true,
|
|
57
58
|
});
|
|
59
|
+
// Added the following code to get the WebhookLambdaArn from either a parameter store path or a stack name. (Used to be only from stack name)
|
|
60
|
+
let githubWebhookLambdaArn = '';
|
|
61
|
+
if (props.webhookResourceArnParameterPath) {
|
|
62
|
+
githubWebhookLambdaArn = aws_ssm_1.StringParameter.valueForStringParameter(this, props.webhookResourceArnParameterPath);
|
|
63
|
+
}
|
|
64
|
+
if (!githubWebhookLambdaArn && props.webhookResourceStackName) {
|
|
65
|
+
githubWebhookLambdaArn = aws_cdk_lib_1.Fn.importValue(`${props.webhookResourceStackName}:LambdaArn`);
|
|
66
|
+
}
|
|
67
|
+
if (!githubWebhookLambdaArn) {
|
|
68
|
+
throw new Error('You must provide a webhookResourceArnParameterPath or webhookResourceStackName to create a GitHub webhook.');
|
|
69
|
+
}
|
|
58
70
|
// Finally, create the Webhook on GitHub to route push events to the API!
|
|
59
|
-
const githubWebhookLambdaArn = aws_cdk_lib_1.Fn.importValue(`${props.webhookResourceStackName}:LambdaArn`);
|
|
60
71
|
const webhookLambda = aws_cdk_lib_1.aws_lambda.Function.fromFunctionAttributes(this, 'GithubWebhookLambda', {
|
|
61
72
|
functionArn: githubWebhookLambdaArn,
|
|
62
73
|
skipPermissions: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ndlib/ndlib-cdk2",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.37",
|
|
4
4
|
"description": "Reusable CDK2 modules used within Hesburgh Libraries of Notre Dame",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -41,20 +41,20 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/jest": "^29.5.14",
|
|
44
|
-
"@types/node": "^24.0.
|
|
45
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
46
|
-
"@typescript-eslint/parser": "^8.
|
|
44
|
+
"@types/node": "^24.0.11",
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "^8.36.0",
|
|
46
|
+
"@typescript-eslint/parser": "^8.36.0",
|
|
47
47
|
"aws-sdk-client-mock": "^4.1.0",
|
|
48
|
-
"eslint": "^9.
|
|
48
|
+
"eslint": "^9.30.1",
|
|
49
49
|
"eslint-plugin-import": "^2.32.0",
|
|
50
|
-
"eslint-plugin-jest": "^
|
|
51
|
-
"eslint-plugin-n": "^17.
|
|
50
|
+
"eslint-plugin-jest": "^29.0.1",
|
|
51
|
+
"eslint-plugin-n": "^17.21.0",
|
|
52
52
|
"eslint-plugin-node": "^11.1.0",
|
|
53
53
|
"eslint-plugin-promise": "^7.2.1",
|
|
54
54
|
"github-changes": "^2.0.3",
|
|
55
55
|
"jest": "^29.7.0",
|
|
56
56
|
"jest-mock": "^30.0.2",
|
|
57
|
-
"prettier": "^3.6.
|
|
57
|
+
"prettier": "^3.6.2",
|
|
58
58
|
"ts-jest": "^29.4.0",
|
|
59
59
|
"tsc-watch": "^7.1.1",
|
|
60
60
|
"typescript": "^5.8.3"
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"lib/**/*"
|
|
64
64
|
],
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"aws-cdk-lib": "^2.
|
|
66
|
+
"aws-cdk-lib": "^2.204.0",
|
|
67
67
|
"constructs": "^10.4.2"
|
|
68
68
|
},
|
|
69
69
|
"workspaces": [
|