ag-common 0.0.848 → 0.0.849
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.
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ACMClient } from '@aws-sdk/client-acm';
|
|
2
|
+
export declare const setAcm: (region: string) => ACMClient;
|
|
3
|
+
export declare let acm: ACMClient;
|
|
4
|
+
/**
|
|
5
|
+
* Find an ACM certificate that covers both the apex domain and wildcard.
|
|
6
|
+
* @param domain - The domain to find a certificate for (e.g., "bolt.garden")
|
|
7
|
+
* @param region - AWS region (defaults to us-east-1 for CloudFront/Cognito compatibility)
|
|
8
|
+
* @returns The certificate ARN
|
|
9
|
+
* @throws Error if no matching certificate is found
|
|
10
|
+
*/
|
|
11
|
+
export declare const findCertificateByDomain: (domain: string, region?: string) => Promise<string>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.findCertificateByDomain = exports.acm = exports.setAcm = void 0;
|
|
13
|
+
/* eslint-disable no-await-in-loop */
|
|
14
|
+
const client_acm_1 = require("@aws-sdk/client-acm");
|
|
15
|
+
const setAcm = (region) => {
|
|
16
|
+
const raw = new client_acm_1.ACMClient({ region });
|
|
17
|
+
exports.acm = raw;
|
|
18
|
+
return raw;
|
|
19
|
+
};
|
|
20
|
+
exports.setAcm = setAcm;
|
|
21
|
+
exports.acm = (0, exports.setAcm)('us-east-1');
|
|
22
|
+
/**
|
|
23
|
+
* Find an ACM certificate that covers both the apex domain and wildcard.
|
|
24
|
+
* @param domain - The domain to find a certificate for (e.g., "bolt.garden")
|
|
25
|
+
* @param region - AWS region (defaults to us-east-1 for CloudFront/Cognito compatibility)
|
|
26
|
+
* @returns The certificate ARN
|
|
27
|
+
* @throws Error if no matching certificate is found
|
|
28
|
+
*/
|
|
29
|
+
const findCertificateByDomain = (domain_1, ...args_1) => __awaiter(void 0, [domain_1, ...args_1], void 0, function* (domain, region = 'us-east-1') {
|
|
30
|
+
var _a, _b, _c;
|
|
31
|
+
const ar = yield exports.acm.config.region();
|
|
32
|
+
if (ar !== region) {
|
|
33
|
+
(0, exports.setAcm)(region);
|
|
34
|
+
}
|
|
35
|
+
const requiredDomains = new Set([domain, `*.${domain}`]);
|
|
36
|
+
const listResponse = yield exports.acm.send(new client_acm_1.ListCertificatesCommand({}));
|
|
37
|
+
if (!((_a = listResponse.CertificateSummaryList) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
38
|
+
throw new Error(`No ACM certificates found in region ${region}`);
|
|
39
|
+
}
|
|
40
|
+
for (const cert of listResponse.CertificateSummaryList) {
|
|
41
|
+
if (!cert.CertificateArn)
|
|
42
|
+
continue;
|
|
43
|
+
const describeResponse = yield exports.acm.send(new client_acm_1.DescribeCertificateCommand({
|
|
44
|
+
CertificateArn: cert.CertificateArn,
|
|
45
|
+
}));
|
|
46
|
+
const sans = (_c = (_b = describeResponse.Certificate) === null || _b === void 0 ? void 0 : _b.SubjectAlternativeNames) !== null && _c !== void 0 ? _c : [];
|
|
47
|
+
const sanSet = new Set(sans);
|
|
48
|
+
const hasAllDomains = [...requiredDomains].every((d) => sanSet.has(d));
|
|
49
|
+
if (hasAllDomains) {
|
|
50
|
+
return cert.CertificateArn;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
throw new Error(`No ACM certificate found covering both "${domain}" and "*.${domain}" in region ${region}`);
|
|
54
|
+
});
|
|
55
|
+
exports.findCertificateByDomain = findCertificateByDomain;
|
package/dist/api/helpers/aws.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setAwsRegion = void 0;
|
|
4
|
+
const acm_1 = require("./acm");
|
|
4
5
|
const dynamo_1 = require("./dynamo");
|
|
5
6
|
const s3_1 = require("./s3");
|
|
6
7
|
const ses_1 = require("./ses");
|
|
@@ -10,5 +11,6 @@ const setAwsRegion = (region) => {
|
|
|
10
11
|
(0, s3_1.setS3)({ region, provider: 's3' });
|
|
11
12
|
(0, ses_1.setSes)(region);
|
|
12
13
|
(0, sqs_1.setSqs)(region);
|
|
14
|
+
(0, acm_1.setAcm)('us-east-1');
|
|
13
15
|
};
|
|
14
16
|
exports.setAwsRegion = setAwsRegion;
|
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./acm"), exports);
|
|
17
18
|
__exportStar(require("./api"), exports);
|
|
18
19
|
__exportStar(require("./apigw"), exports);
|
|
19
20
|
__exportStar(require("./aws"), exports);
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.0.
|
|
2
|
+
"version": "0.0.849",
|
|
3
3
|
"name": "ag-common",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
@@ -10,69 +10,70 @@
|
|
|
10
10
|
"url": "https://github.com/andreigec/ag-common.git"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"react": "^19.2.0",
|
|
16
|
-
"react-dom": "^19.2.0",
|
|
17
|
-
"tailwind-merge": "^3.3.1",
|
|
18
|
-
"tailwindcss": "^4.1.14",
|
|
19
|
-
"tailwindcss-animate": "^1.0.7",
|
|
20
|
-
"tsx": "^4.20.6",
|
|
21
|
-
"typescript": "^5.9.3",
|
|
22
|
-
"@tailwindcss/postcss": "^4.1.14",
|
|
23
|
-
"autoprefixer": "^10.4.21",
|
|
13
|
+
"@tailwindcss/postcss": "^4.1.18",
|
|
14
|
+
"autoprefixer": "^10.4.23",
|
|
24
15
|
"class-variance-authority": "^0.7.1",
|
|
25
16
|
"clsx": "^2.1.1",
|
|
26
17
|
"cross-env": "^10.1.0",
|
|
27
|
-
"
|
|
18
|
+
"eslint": "^9.39.2",
|
|
19
|
+
"eslint-config-e7npm": "^0.1.31",
|
|
20
|
+
"lucide-react": "^0.562.0",
|
|
21
|
+
"react": "^19.2.3",
|
|
22
|
+
"react-dom": "^19.2.3",
|
|
23
|
+
"tailwind-merge": "^3.4.0",
|
|
24
|
+
"tailwindcss": "^4.1.18",
|
|
25
|
+
"tailwindcss-animate": "^1.0.7",
|
|
26
|
+
"tsx": "^4.21.0",
|
|
27
|
+
"typescript": "^5.9.3"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@aws-sdk/client-
|
|
31
|
-
"@aws-sdk/client-
|
|
32
|
-
"@aws-sdk/client-
|
|
33
|
-
"@aws-sdk/client-
|
|
34
|
-
"@aws-sdk/client-
|
|
35
|
-
"@aws-sdk/client-
|
|
36
|
-
"@aws-sdk/
|
|
37
|
-
"@aws-sdk/
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
30
|
+
"@aws-sdk/client-acm": "^3.966.0",
|
|
31
|
+
"@aws-sdk/client-apigatewaymanagementapi": "^3.966.0",
|
|
32
|
+
"@aws-sdk/client-dynamodb": "^3.966.0",
|
|
33
|
+
"@aws-sdk/client-s3": "^3.966.0",
|
|
34
|
+
"@aws-sdk/client-ses": "^3.966.0",
|
|
35
|
+
"@aws-sdk/client-sqs": "^3.966.0",
|
|
36
|
+
"@aws-sdk/client-sts": "^3.966.0",
|
|
37
|
+
"@aws-sdk/lib-dynamodb": "^3.966.0",
|
|
38
|
+
"@aws-sdk/s3-presigned-post": "^3.966.0",
|
|
39
|
+
"@azure/cosmos": "^4.9.0",
|
|
40
|
+
"@google/genai": "^1.35.0",
|
|
40
41
|
"@radix-ui/react-accordion": "^1.2.12",
|
|
41
|
-
"@radix-ui/react-avatar": "^1.1.
|
|
42
|
+
"@radix-ui/react-avatar": "^1.1.11",
|
|
42
43
|
"@radix-ui/react-checkbox": "^1.3.3",
|
|
43
44
|
"@radix-ui/react-dialog": "^1.1.15",
|
|
44
45
|
"@radix-ui/react-dropdown-menu": "^2.1.16",
|
|
45
46
|
"@radix-ui/react-icons": "^1.3.2",
|
|
46
|
-
"@radix-ui/react-label": "^2.1.
|
|
47
|
+
"@radix-ui/react-label": "^2.1.8",
|
|
47
48
|
"@radix-ui/react-popover": "^1.1.15",
|
|
48
49
|
"@radix-ui/react-radio-group": "^1.3.8",
|
|
49
50
|
"@radix-ui/react-scroll-area": "^1.2.10",
|
|
50
51
|
"@radix-ui/react-select": "^2.2.6",
|
|
51
|
-
"@radix-ui/react-slot": "^1.2.
|
|
52
|
+
"@radix-ui/react-slot": "^1.2.4",
|
|
52
53
|
"@radix-ui/react-switch": "^1.2.6",
|
|
53
54
|
"@radix-ui/react-toast": "^1.2.15",
|
|
54
|
-
"@smithy/types": "^4.
|
|
55
|
-
"@storybook/addon-docs": "^10.
|
|
56
|
-
"@storybook/addon-links": "^10.
|
|
55
|
+
"@smithy/types": "^4.11.0",
|
|
56
|
+
"@storybook/addon-docs": "^10.1.11",
|
|
57
|
+
"@storybook/addon-links": "^10.1.11",
|
|
57
58
|
"@storybook/addon-styling-webpack": "^3.0.0",
|
|
58
59
|
"@storybook/addons": "^7.6.17",
|
|
59
|
-
"@storybook/react-vite": "^10.
|
|
60
|
-
"@storybook/react-webpack5": "^10.
|
|
60
|
+
"@storybook/react-vite": "^10.1.11",
|
|
61
|
+
"@storybook/react-webpack5": "^10.1.11",
|
|
61
62
|
"@types/jsonwebtoken": "^9.0.10",
|
|
62
|
-
"@types/node": "^25.0.
|
|
63
|
-
"@types/react": "^19.2.
|
|
64
|
-
"@types/react-dom": "^19.2.
|
|
65
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
66
|
-
"@typescript-eslint/parser": "^8.
|
|
67
|
-
"aws-cdk-lib": "^2.
|
|
63
|
+
"@types/node": "^25.0.3",
|
|
64
|
+
"@types/react": "^19.2.7",
|
|
65
|
+
"@types/react-dom": "^19.2.3",
|
|
66
|
+
"@typescript-eslint/eslint-plugin": "^8.52.0",
|
|
67
|
+
"@typescript-eslint/parser": "^8.52.0",
|
|
68
|
+
"aws-cdk-lib": "^2.234.1",
|
|
68
69
|
"buffer": "^6.0.3",
|
|
69
|
-
"eslint-plugin-storybook": "^10.
|
|
70
|
+
"eslint-plugin-storybook": "^10.1.11",
|
|
70
71
|
"globstar": "^1.0.0",
|
|
71
|
-
"jsonwebtoken": "^9.0.
|
|
72
|
+
"jsonwebtoken": "^9.0.3",
|
|
72
73
|
"jwks-rsa": "^3.2.0",
|
|
73
74
|
"node-cache": "^5.1.2",
|
|
74
|
-
"rimraf": "^6.
|
|
75
|
-
"storybook": "^10.
|
|
75
|
+
"rimraf": "^6.1.2",
|
|
76
|
+
"storybook": "^10.1.11"
|
|
76
77
|
},
|
|
77
78
|
"files": [
|
|
78
79
|
"dist/**/*",
|