deployable-awscdk-app-ts 0.1.207 → 0.1.209

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 (68) hide show
  1. package/.jsii +43 -22
  2. package/.projenrc.ts +3 -0
  3. package/API.md +16 -0
  4. package/lib/index.d.ts +1 -0
  5. package/lib/index.js +18 -2
  6. package/lib/types.d.ts +8 -0
  7. package/lib/types.js +1 -1
  8. package/node_modules/semver/LICENSE +15 -0
  9. package/node_modules/semver/README.md +637 -0
  10. package/node_modules/semver/bin/semver.js +197 -0
  11. package/node_modules/semver/classes/comparator.js +141 -0
  12. package/node_modules/semver/classes/index.js +5 -0
  13. package/node_modules/semver/classes/range.js +539 -0
  14. package/node_modules/semver/classes/semver.js +302 -0
  15. package/node_modules/semver/functions/clean.js +6 -0
  16. package/node_modules/semver/functions/cmp.js +52 -0
  17. package/node_modules/semver/functions/coerce.js +52 -0
  18. package/node_modules/semver/functions/compare-build.js +7 -0
  19. package/node_modules/semver/functions/compare-loose.js +3 -0
  20. package/node_modules/semver/functions/compare.js +5 -0
  21. package/node_modules/semver/functions/diff.js +65 -0
  22. package/node_modules/semver/functions/eq.js +3 -0
  23. package/node_modules/semver/functions/gt.js +3 -0
  24. package/node_modules/semver/functions/gte.js +3 -0
  25. package/node_modules/semver/functions/inc.js +19 -0
  26. package/node_modules/semver/functions/lt.js +3 -0
  27. package/node_modules/semver/functions/lte.js +3 -0
  28. package/node_modules/semver/functions/major.js +3 -0
  29. package/node_modules/semver/functions/minor.js +3 -0
  30. package/node_modules/semver/functions/neq.js +3 -0
  31. package/node_modules/semver/functions/parse.js +16 -0
  32. package/node_modules/semver/functions/patch.js +3 -0
  33. package/node_modules/semver/functions/prerelease.js +6 -0
  34. package/node_modules/semver/functions/rcompare.js +3 -0
  35. package/node_modules/semver/functions/rsort.js +3 -0
  36. package/node_modules/semver/functions/satisfies.js +10 -0
  37. package/node_modules/semver/functions/sort.js +3 -0
  38. package/node_modules/semver/functions/valid.js +6 -0
  39. package/node_modules/semver/index.js +89 -0
  40. package/node_modules/semver/internal/constants.js +35 -0
  41. package/node_modules/semver/internal/debug.js +9 -0
  42. package/node_modules/semver/internal/identifiers.js +23 -0
  43. package/node_modules/semver/internal/parse-options.js +15 -0
  44. package/node_modules/semver/internal/re.js +212 -0
  45. package/node_modules/semver/node_modules/lru-cache/LICENSE +15 -0
  46. package/node_modules/semver/node_modules/lru-cache/README.md +166 -0
  47. package/node_modules/semver/node_modules/lru-cache/index.js +334 -0
  48. package/node_modules/semver/node_modules/lru-cache/package.json +34 -0
  49. package/node_modules/semver/node_modules/yallist/LICENSE +15 -0
  50. package/node_modules/semver/node_modules/yallist/README.md +204 -0
  51. package/node_modules/semver/node_modules/yallist/iterator.js +8 -0
  52. package/node_modules/semver/node_modules/yallist/package.json +29 -0
  53. package/node_modules/semver/node_modules/yallist/yallist.js +426 -0
  54. package/node_modules/semver/package.json +87 -0
  55. package/node_modules/semver/preload.js +2 -0
  56. package/node_modules/semver/range.bnf +16 -0
  57. package/node_modules/semver/ranges/gtr.js +4 -0
  58. package/node_modules/semver/ranges/intersects.js +7 -0
  59. package/node_modules/semver/ranges/ltr.js +4 -0
  60. package/node_modules/semver/ranges/max-satisfying.js +25 -0
  61. package/node_modules/semver/ranges/min-satisfying.js +24 -0
  62. package/node_modules/semver/ranges/min-version.js +61 -0
  63. package/node_modules/semver/ranges/outside.js +80 -0
  64. package/node_modules/semver/ranges/simplify.js +47 -0
  65. package/node_modules/semver/ranges/subset.js +247 -0
  66. package/node_modules/semver/ranges/to-comparators.js +8 -0
  67. package/node_modules/semver/ranges/valid.js +11 -0
  68. package/package.json +6 -2
@@ -0,0 +1,80 @@
1
+ const SemVer = require('../classes/semver')
2
+ const Comparator = require('../classes/comparator')
3
+ const { ANY } = Comparator
4
+ const Range = require('../classes/range')
5
+ const satisfies = require('../functions/satisfies')
6
+ const gt = require('../functions/gt')
7
+ const lt = require('../functions/lt')
8
+ const lte = require('../functions/lte')
9
+ const gte = require('../functions/gte')
10
+
11
+ const outside = (version, range, hilo, options) => {
12
+ version = new SemVer(version, options)
13
+ range = new Range(range, options)
14
+
15
+ let gtfn, ltefn, ltfn, comp, ecomp
16
+ switch (hilo) {
17
+ case '>':
18
+ gtfn = gt
19
+ ltefn = lte
20
+ ltfn = lt
21
+ comp = '>'
22
+ ecomp = '>='
23
+ break
24
+ case '<':
25
+ gtfn = lt
26
+ ltefn = gte
27
+ ltfn = gt
28
+ comp = '<'
29
+ ecomp = '<='
30
+ break
31
+ default:
32
+ throw new TypeError('Must provide a hilo val of "<" or ">"')
33
+ }
34
+
35
+ // If it satisfies the range it is not outside
36
+ if (satisfies(version, range, options)) {
37
+ return false
38
+ }
39
+
40
+ // From now on, variable terms are as if we're in "gtr" mode.
41
+ // but note that everything is flipped for the "ltr" function.
42
+
43
+ for (let i = 0; i < range.set.length; ++i) {
44
+ const comparators = range.set[i]
45
+
46
+ let high = null
47
+ let low = null
48
+
49
+ comparators.forEach((comparator) => {
50
+ if (comparator.semver === ANY) {
51
+ comparator = new Comparator('>=0.0.0')
52
+ }
53
+ high = high || comparator
54
+ low = low || comparator
55
+ if (gtfn(comparator.semver, high.semver, options)) {
56
+ high = comparator
57
+ } else if (ltfn(comparator.semver, low.semver, options)) {
58
+ low = comparator
59
+ }
60
+ })
61
+
62
+ // If the edge version comparator has a operator then our version
63
+ // isn't outside it
64
+ if (high.operator === comp || high.operator === ecomp) {
65
+ return false
66
+ }
67
+
68
+ // If the lowest version comparator has an operator and our version
69
+ // is less than it then it isn't higher than the range
70
+ if ((!low.operator || low.operator === comp) &&
71
+ ltefn(version, low.semver)) {
72
+ return false
73
+ } else if (low.operator === ecomp && ltfn(version, low.semver)) {
74
+ return false
75
+ }
76
+ }
77
+ return true
78
+ }
79
+
80
+ module.exports = outside
@@ -0,0 +1,47 @@
1
+ // given a set of versions and a range, create a "simplified" range
2
+ // that includes the same versions that the original range does
3
+ // If the original range is shorter than the simplified one, return that.
4
+ const satisfies = require('../functions/satisfies.js')
5
+ const compare = require('../functions/compare.js')
6
+ module.exports = (versions, range, options) => {
7
+ const set = []
8
+ let first = null
9
+ let prev = null
10
+ const v = versions.sort((a, b) => compare(a, b, options))
11
+ for (const version of v) {
12
+ const included = satisfies(version, range, options)
13
+ if (included) {
14
+ prev = version
15
+ if (!first) {
16
+ first = version
17
+ }
18
+ } else {
19
+ if (prev) {
20
+ set.push([first, prev])
21
+ }
22
+ prev = null
23
+ first = null
24
+ }
25
+ }
26
+ if (first) {
27
+ set.push([first, null])
28
+ }
29
+
30
+ const ranges = []
31
+ for (const [min, max] of set) {
32
+ if (min === max) {
33
+ ranges.push(min)
34
+ } else if (!max && min === v[0]) {
35
+ ranges.push('*')
36
+ } else if (!max) {
37
+ ranges.push(`>=${min}`)
38
+ } else if (min === v[0]) {
39
+ ranges.push(`<=${max}`)
40
+ } else {
41
+ ranges.push(`${min} - ${max}`)
42
+ }
43
+ }
44
+ const simplified = ranges.join(' || ')
45
+ const original = typeof range.raw === 'string' ? range.raw : String(range)
46
+ return simplified.length < original.length ? simplified : range
47
+ }
@@ -0,0 +1,247 @@
1
+ const Range = require('../classes/range.js')
2
+ const Comparator = require('../classes/comparator.js')
3
+ const { ANY } = Comparator
4
+ const satisfies = require('../functions/satisfies.js')
5
+ const compare = require('../functions/compare.js')
6
+
7
+ // Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:
8
+ // - Every simple range `r1, r2, ...` is a null set, OR
9
+ // - Every simple range `r1, r2, ...` which is not a null set is a subset of
10
+ // some `R1, R2, ...`
11
+ //
12
+ // Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:
13
+ // - If c is only the ANY comparator
14
+ // - If C is only the ANY comparator, return true
15
+ // - Else if in prerelease mode, return false
16
+ // - else replace c with `[>=0.0.0]`
17
+ // - If C is only the ANY comparator
18
+ // - if in prerelease mode, return true
19
+ // - else replace C with `[>=0.0.0]`
20
+ // - Let EQ be the set of = comparators in c
21
+ // - If EQ is more than one, return true (null set)
22
+ // - Let GT be the highest > or >= comparator in c
23
+ // - Let LT be the lowest < or <= comparator in c
24
+ // - If GT and LT, and GT.semver > LT.semver, return true (null set)
25
+ // - If any C is a = range, and GT or LT are set, return false
26
+ // - If EQ
27
+ // - If GT, and EQ does not satisfy GT, return true (null set)
28
+ // - If LT, and EQ does not satisfy LT, return true (null set)
29
+ // - If EQ satisfies every C, return true
30
+ // - Else return false
31
+ // - If GT
32
+ // - If GT.semver is lower than any > or >= comp in C, return false
33
+ // - If GT is >=, and GT.semver does not satisfy every C, return false
34
+ // - If GT.semver has a prerelease, and not in prerelease mode
35
+ // - If no C has a prerelease and the GT.semver tuple, return false
36
+ // - If LT
37
+ // - If LT.semver is greater than any < or <= comp in C, return false
38
+ // - If LT is <=, and LT.semver does not satisfy every C, return false
39
+ // - If GT.semver has a prerelease, and not in prerelease mode
40
+ // - If no C has a prerelease and the LT.semver tuple, return false
41
+ // - Else return true
42
+
43
+ const subset = (sub, dom, options = {}) => {
44
+ if (sub === dom) {
45
+ return true
46
+ }
47
+
48
+ sub = new Range(sub, options)
49
+ dom = new Range(dom, options)
50
+ let sawNonNull = false
51
+
52
+ OUTER: for (const simpleSub of sub.set) {
53
+ for (const simpleDom of dom.set) {
54
+ const isSub = simpleSubset(simpleSub, simpleDom, options)
55
+ sawNonNull = sawNonNull || isSub !== null
56
+ if (isSub) {
57
+ continue OUTER
58
+ }
59
+ }
60
+ // the null set is a subset of everything, but null simple ranges in
61
+ // a complex range should be ignored. so if we saw a non-null range,
62
+ // then we know this isn't a subset, but if EVERY simple range was null,
63
+ // then it is a subset.
64
+ if (sawNonNull) {
65
+ return false
66
+ }
67
+ }
68
+ return true
69
+ }
70
+
71
+ const minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')]
72
+ const minimumVersion = [new Comparator('>=0.0.0')]
73
+
74
+ const simpleSubset = (sub, dom, options) => {
75
+ if (sub === dom) {
76
+ return true
77
+ }
78
+
79
+ if (sub.length === 1 && sub[0].semver === ANY) {
80
+ if (dom.length === 1 && dom[0].semver === ANY) {
81
+ return true
82
+ } else if (options.includePrerelease) {
83
+ sub = minimumVersionWithPreRelease
84
+ } else {
85
+ sub = minimumVersion
86
+ }
87
+ }
88
+
89
+ if (dom.length === 1 && dom[0].semver === ANY) {
90
+ if (options.includePrerelease) {
91
+ return true
92
+ } else {
93
+ dom = minimumVersion
94
+ }
95
+ }
96
+
97
+ const eqSet = new Set()
98
+ let gt, lt
99
+ for (const c of sub) {
100
+ if (c.operator === '>' || c.operator === '>=') {
101
+ gt = higherGT(gt, c, options)
102
+ } else if (c.operator === '<' || c.operator === '<=') {
103
+ lt = lowerLT(lt, c, options)
104
+ } else {
105
+ eqSet.add(c.semver)
106
+ }
107
+ }
108
+
109
+ if (eqSet.size > 1) {
110
+ return null
111
+ }
112
+
113
+ let gtltComp
114
+ if (gt && lt) {
115
+ gtltComp = compare(gt.semver, lt.semver, options)
116
+ if (gtltComp > 0) {
117
+ return null
118
+ } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {
119
+ return null
120
+ }
121
+ }
122
+
123
+ // will iterate one or zero times
124
+ for (const eq of eqSet) {
125
+ if (gt && !satisfies(eq, String(gt), options)) {
126
+ return null
127
+ }
128
+
129
+ if (lt && !satisfies(eq, String(lt), options)) {
130
+ return null
131
+ }
132
+
133
+ for (const c of dom) {
134
+ if (!satisfies(eq, String(c), options)) {
135
+ return false
136
+ }
137
+ }
138
+
139
+ return true
140
+ }
141
+
142
+ let higher, lower
143
+ let hasDomLT, hasDomGT
144
+ // if the subset has a prerelease, we need a comparator in the superset
145
+ // with the same tuple and a prerelease, or it's not a subset
146
+ let needDomLTPre = lt &&
147
+ !options.includePrerelease &&
148
+ lt.semver.prerelease.length ? lt.semver : false
149
+ let needDomGTPre = gt &&
150
+ !options.includePrerelease &&
151
+ gt.semver.prerelease.length ? gt.semver : false
152
+ // exception: <1.2.3-0 is the same as <1.2.3
153
+ if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&
154
+ lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {
155
+ needDomLTPre = false
156
+ }
157
+
158
+ for (const c of dom) {
159
+ hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='
160
+ hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='
161
+ if (gt) {
162
+ if (needDomGTPre) {
163
+ if (c.semver.prerelease && c.semver.prerelease.length &&
164
+ c.semver.major === needDomGTPre.major &&
165
+ c.semver.minor === needDomGTPre.minor &&
166
+ c.semver.patch === needDomGTPre.patch) {
167
+ needDomGTPre = false
168
+ }
169
+ }
170
+ if (c.operator === '>' || c.operator === '>=') {
171
+ higher = higherGT(gt, c, options)
172
+ if (higher === c && higher !== gt) {
173
+ return false
174
+ }
175
+ } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) {
176
+ return false
177
+ }
178
+ }
179
+ if (lt) {
180
+ if (needDomLTPre) {
181
+ if (c.semver.prerelease && c.semver.prerelease.length &&
182
+ c.semver.major === needDomLTPre.major &&
183
+ c.semver.minor === needDomLTPre.minor &&
184
+ c.semver.patch === needDomLTPre.patch) {
185
+ needDomLTPre = false
186
+ }
187
+ }
188
+ if (c.operator === '<' || c.operator === '<=') {
189
+ lower = lowerLT(lt, c, options)
190
+ if (lower === c && lower !== lt) {
191
+ return false
192
+ }
193
+ } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) {
194
+ return false
195
+ }
196
+ }
197
+ if (!c.operator && (lt || gt) && gtltComp !== 0) {
198
+ return false
199
+ }
200
+ }
201
+
202
+ // if there was a < or >, and nothing in the dom, then must be false
203
+ // UNLESS it was limited by another range in the other direction.
204
+ // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0
205
+ if (gt && hasDomLT && !lt && gtltComp !== 0) {
206
+ return false
207
+ }
208
+
209
+ if (lt && hasDomGT && !gt && gtltComp !== 0) {
210
+ return false
211
+ }
212
+
213
+ // we needed a prerelease range in a specific tuple, but didn't get one
214
+ // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,
215
+ // because it includes prereleases in the 1.2.3 tuple
216
+ if (needDomGTPre || needDomLTPre) {
217
+ return false
218
+ }
219
+
220
+ return true
221
+ }
222
+
223
+ // >=1.2.3 is lower than >1.2.3
224
+ const higherGT = (a, b, options) => {
225
+ if (!a) {
226
+ return b
227
+ }
228
+ const comp = compare(a.semver, b.semver, options)
229
+ return comp > 0 ? a
230
+ : comp < 0 ? b
231
+ : b.operator === '>' && a.operator === '>=' ? b
232
+ : a
233
+ }
234
+
235
+ // <=1.2.3 is higher than <1.2.3
236
+ const lowerLT = (a, b, options) => {
237
+ if (!a) {
238
+ return b
239
+ }
240
+ const comp = compare(a.semver, b.semver, options)
241
+ return comp < 0 ? a
242
+ : comp > 0 ? b
243
+ : b.operator === '<' && a.operator === '<=' ? b
244
+ : a
245
+ }
246
+
247
+ module.exports = subset
@@ -0,0 +1,8 @@
1
+ const Range = require('../classes/range')
2
+
3
+ // Mostly just for testing and legacy API reasons
4
+ const toComparators = (range, options) =>
5
+ new Range(range, options).set
6
+ .map(comp => comp.map(c => c.value).join(' ').trim().split(' '))
7
+
8
+ module.exports = toComparators
@@ -0,0 +1,11 @@
1
+ const Range = require('../classes/range')
2
+ const validRange = (range, options) => {
3
+ try {
4
+ // Return '*' instead of '' so that truthiness works.
5
+ // This will throw if it's invalid anyway
6
+ return new Range(range, options).range || '*'
7
+ } catch (er) {
8
+ return null
9
+ }
10
+ }
11
+ module.exports = validRange
package/package.json CHANGED
@@ -65,8 +65,12 @@
65
65
  "projen": "^0.72.1"
66
66
  },
67
67
  "dependencies": {
68
- "projen": "^0.72.28"
68
+ "projen": "^0.72.28",
69
+ "semver": "^7.5.4"
69
70
  },
71
+ "bundledDependencies": [
72
+ "semver"
73
+ ],
70
74
  "keywords": [
71
75
  "AWS CDK",
72
76
  "Deployment",
@@ -75,7 +79,7 @@
75
79
  ],
76
80
  "main": "lib/index.js",
77
81
  "license": "Apache-2.0",
78
- "version": "0.1.207",
82
+ "version": "0.1.209",
79
83
  "jest": {
80
84
  "testMatch": [
81
85
  "<rootDir>/src/**/__tests__/**/*.ts?(x)",