cdk-gitlab-runner 2.1.394 → 2.2.0

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 (39) hide show
  1. package/.jsii +93 -117
  2. package/API.md +28 -47
  3. package/README.md +49 -17
  4. package/lib/gitlab-runner-autoscaling.d.ts +5 -0
  5. package/lib/gitlab-runner-autoscaling.js +9 -4
  6. package/lib/gitlab-runner-instance.d.ts +8 -38
  7. package/lib/gitlab-runner-instance.js +14 -6
  8. package/lib/integ.api.js +3 -2
  9. package/lib/integ.gitlab-runner-autoscaling.js +2 -1
  10. package/node_modules/compare-versions/LICENSE +21 -0
  11. package/node_modules/compare-versions/README.md +133 -0
  12. package/node_modules/compare-versions/lib/esm/compare.d.ts +19 -0
  13. package/node_modules/compare-versions/lib/esm/compare.js +44 -0
  14. package/node_modules/compare-versions/lib/esm/compare.js.map +1 -0
  15. package/node_modules/compare-versions/lib/esm/compareVersions.d.ts +8 -0
  16. package/node_modules/compare-versions/lib/esm/compareVersions.js +29 -0
  17. package/node_modules/compare-versions/lib/esm/compareVersions.js.map +1 -0
  18. package/node_modules/compare-versions/lib/esm/index.d.ts +5 -0
  19. package/node_modules/compare-versions/lib/esm/index.js +5 -0
  20. package/node_modules/compare-versions/lib/esm/index.js.map +1 -0
  21. package/node_modules/compare-versions/lib/esm/satisfies.d.ts +14 -0
  22. package/node_modules/compare-versions/lib/esm/satisfies.js +66 -0
  23. package/node_modules/compare-versions/lib/esm/satisfies.js.map +1 -0
  24. package/node_modules/compare-versions/lib/esm/utils.d.ts +7 -0
  25. package/node_modules/compare-versions/lib/esm/utils.js +37 -0
  26. package/node_modules/compare-versions/lib/esm/utils.js.map +1 -0
  27. package/node_modules/compare-versions/lib/esm/validate.d.ts +28 -0
  28. package/node_modules/compare-versions/lib/esm/validate.js +31 -0
  29. package/node_modules/compare-versions/lib/esm/validate.js.map +1 -0
  30. package/node_modules/compare-versions/lib/umd/index.js +216 -0
  31. package/node_modules/compare-versions/lib/umd/index.js.map +1 -0
  32. package/node_modules/compare-versions/package.json +45 -0
  33. package/node_modules/compare-versions/src/compare.ts +54 -0
  34. package/node_modules/compare-versions/src/compareVersions.ts +31 -0
  35. package/node_modules/compare-versions/src/index.ts +5 -0
  36. package/node_modules/compare-versions/src/satisfies.ts +69 -0
  37. package/node_modules/compare-versions/src/utils.ts +50 -0
  38. package/node_modules/compare-versions/src/validate.ts +36 -0
  39. package/package.json +7 -1
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Allowed arithmetic operators
3
+ */
4
+ export type CompareOperator = '>' | '>=' | '=' | '<' | '<=' | '!=';
5
+
6
+ export const semver =
7
+ /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;
8
+
9
+ export const validateAndParse = (version: string) => {
10
+ if (typeof version !== 'string') {
11
+ throw new TypeError('Invalid argument expected string');
12
+ }
13
+ const match = version.match(semver);
14
+ if (!match) {
15
+ throw new Error(
16
+ `Invalid argument not valid semver ('${version}' received)`
17
+ );
18
+ }
19
+ match.shift();
20
+ return match;
21
+ };
22
+
23
+ const isWildcard = (s: string) => s === '*' || s === 'x' || s === 'X';
24
+
25
+ const tryParse = (v: string) => {
26
+ const n = parseInt(v, 10);
27
+ return isNaN(n) ? v : n;
28
+ };
29
+
30
+ const forceType = (a: string | number, b: string | number) =>
31
+ typeof a !== typeof b ? [String(a), String(b)] : [a, b];
32
+
33
+ const compareStrings = (a: string, b: string) => {
34
+ if (isWildcard(a) || isWildcard(b)) return 0;
35
+ const [ap, bp] = forceType(tryParse(a), tryParse(b));
36
+ if (ap > bp) return 1;
37
+ if (ap < bp) return -1;
38
+ return 0;
39
+ };
40
+
41
+ export const compareSegments = (
42
+ a: string | string[] | RegExpMatchArray,
43
+ b: string | string[] | RegExpMatchArray
44
+ ) => {
45
+ for (let i = 0; i < Math.max(a.length, b.length); i++) {
46
+ const r = compareStrings(a[i] || '0', b[i] || '0');
47
+ if (r !== 0) return r;
48
+ }
49
+ return 0;
50
+ };
@@ -0,0 +1,36 @@
1
+ import { semver } from './utils';
2
+
3
+ /**
4
+ * Validate [semver](https://semver.org/) version strings.
5
+ *
6
+ * @param version Version number to validate
7
+ * @returns `true` if the version number is a valid semver version number, `false` otherwise.
8
+ *
9
+ * @example
10
+ * ```
11
+ * validate('1.0.0-rc.1'); // return true
12
+ * validate('1.0-rc.1'); // return false
13
+ * validate('foo'); // return false
14
+ * ```
15
+ */
16
+ export const validate = (version: string) =>
17
+ typeof version === 'string' && /^[v\d]/.test(version) && semver.test(version);
18
+
19
+ /**
20
+ * Validate [semver](https://semver.org/) version strings strictly. Will not accept wildcards and version ranges.
21
+ *
22
+ * @param version Version number to validate
23
+ * @returns `true` if the version number is a valid semver version number `false` otherwise
24
+ *
25
+ * @example
26
+ * ```
27
+ * validate('1.0.0-rc.1'); // return true
28
+ * validate('1.0-rc.1'); // return false
29
+ * validate('foo'); // return false
30
+ * ```
31
+ */
32
+ export const validateStrict = (version: string) =>
33
+ typeof version === 'string' &&
34
+ /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/.test(
35
+ version
36
+ );
package/package.json CHANGED
@@ -63,6 +63,12 @@
63
63
  "aws-cdk-lib": "^2.86.0",
64
64
  "constructs": "^10.0.5"
65
65
  },
66
+ "dependencies": {
67
+ "compare-versions": "^6.1.0"
68
+ },
69
+ "bundledDependencies": [
70
+ "compare-versions"
71
+ ],
66
72
  "keywords": [
67
73
  "aws",
68
74
  "cdk",
@@ -71,7 +77,7 @@
71
77
  ],
72
78
  "main": "lib/index.js",
73
79
  "license": "Apache-2.0",
74
- "version": "2.1.394",
80
+ "version": "2.2.0",
75
81
  "jest": {
76
82
  "testMatch": [
77
83
  "<rootDir>/src/**/__tests__/**/*.ts?(x)",