@stacksjs/ts-cloud 0.2.2 → 0.2.5
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/dist/aws/acm.d.ts +215 -0
- package/dist/aws/application-autoscaling.d.ts +345 -0
- package/dist/aws/bedrock.d.ts +2672 -0
- package/dist/aws/client.d.ts +181 -0
- package/dist/aws/cloudformation.d.ts +187 -0
- package/dist/aws/cloudfront.d.ts +416 -0
- package/dist/aws/cloudwatch-logs.d.ts +70 -0
- package/dist/aws/comprehend.d.ts +616 -0
- package/dist/aws/connect.d.ts +533 -0
- package/dist/aws/deploy-imap.d.ts +26 -0
- package/dist/aws/dynamodb.d.ts +270 -0
- package/dist/aws/ec2.d.ts +545 -0
- package/dist/aws/ecr.d.ts +240 -0
- package/dist/aws/ecs.d.ts +267 -0
- package/dist/aws/efs.d.ts +36 -0
- package/dist/aws/elasticache.d.ts +112 -0
- package/dist/aws/elbv2.d.ts +389 -0
- package/dist/aws/email.d.ts +260 -0
- package/dist/aws/eventbridge.d.ts +197 -0
- package/dist/aws/iam.d.ts +1013 -0
- package/dist/aws/imap-server.d.ts +298 -0
- package/dist/aws/index.d.ts +53 -0
- package/dist/aws/kendra.d.ts +831 -0
- package/dist/aws/lambda.d.ts +319 -0
- package/dist/aws/opensearch.d.ts +121 -0
- package/dist/aws/personalize.d.ts +586 -0
- package/dist/aws/polly.d.ts +243 -0
- package/dist/aws/rds.d.ts +346 -0
- package/dist/aws/rekognition.d.ts +691 -0
- package/dist/aws/route53-domains.d.ts +161 -0
- package/dist/aws/route53.d.ts +330 -0
- package/dist/aws/s3.d.ts +535 -0
- package/dist/aws/scheduler.d.ts +224 -0
- package/dist/aws/secrets-manager.d.ts +267 -0
- package/dist/aws/ses.d.ts +441 -0
- package/dist/aws/setup-phone.d.ts +1 -0
- package/dist/aws/setup-sms.d.ts +116 -0
- package/dist/aws/sms.d.ts +477 -0
- package/dist/aws/smtp-server.d.ts +108 -0
- package/dist/aws/sns.d.ts +224 -0
- package/dist/aws/sqs.d.ts +107 -0
- package/dist/aws/ssm.d.ts +311 -0
- package/dist/aws/sts.d.ts +21 -0
- package/dist/aws/support.d.ts +139 -0
- package/dist/aws/test-imap.d.ts +15 -0
- package/dist/aws/textract.d.ts +477 -0
- package/dist/aws/transcribe.d.ts +79 -0
- package/dist/aws/translate.d.ts +424 -0
- package/dist/aws/voice.d.ts +361 -0
- package/dist/bin/cli.js +4500 -809
- package/dist/config.d.ts +5 -0
- package/dist/deploy/index.d.ts +6 -0
- package/dist/deploy/static-site-external-dns.d.ts +70 -0
- package/dist/deploy/static-site.d.ts +110 -0
- package/dist/dns/cloudflare.d.ts +74 -0
- package/dist/dns/godaddy.d.ts +63 -0
- package/dist/dns/index.d.ts +67 -0
- package/dist/dns/porkbun.d.ts +43 -0
- package/dist/dns/route53-adapter.d.ts +67 -0
- package/dist/dns/types.d.ts +100 -0
- package/dist/dns/validator.d.ts +105 -0
- package/dist/generators/index.d.ts +4 -0
- package/dist/generators/infrastructure.d.ts +115 -0
- package/dist/index.d.ts +9 -165
- package/dist/index.js +24067 -6430
- package/dist/push/apns.d.ts +140 -0
- package/dist/push/fcm.d.ts +205 -0
- package/dist/push/index.d.ts +44 -0
- package/dist/security/pre-deploy-scanner.d.ts +97 -0
- package/dist/ssl/acme-client.d.ts +133 -0
- package/dist/ssl/index.d.ts +6 -0
- package/dist/ssl/letsencrypt.d.ts +96 -0
- package/dist/utils/cli.d.ts +121 -0
- package/dist/validation/index.d.ts +4 -0
- package/dist/validation/template.d.ts +27 -0
- package/package.json +6 -6
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CloudOptions } from '@ts-cloud/core';
|
|
2
|
+
export declare const defaultConfig: CloudOptions;
|
|
3
|
+
export declare function getConfig(): Promise<CloudOptions>;
|
|
4
|
+
export declare const loadCloudConfig: () => Promise<CloudOptions>;
|
|
5
|
+
export declare const config: CloudOptions;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static Site Deployment with External DNS Provider Support
|
|
3
|
+
* Deploys static sites to AWS (S3 + CloudFront + ACM) with DNS managed by external providers (Porkbun, GoDaddy, etc.)
|
|
4
|
+
*/
|
|
5
|
+
import type { DnsProviderConfig } from '../dns/types';
|
|
6
|
+
export interface ExternalDnsStaticSiteConfig {
|
|
7
|
+
/** Site name used for resource naming */
|
|
8
|
+
siteName: string;
|
|
9
|
+
/** AWS region for S3 bucket */
|
|
10
|
+
region?: string;
|
|
11
|
+
/** Custom domain (e.g., bunpress.org) */
|
|
12
|
+
domain: string;
|
|
13
|
+
/** S3 bucket name (auto-generated if not provided) */
|
|
14
|
+
bucket?: string;
|
|
15
|
+
/** ACM certificate ARN (auto-created if not provided) */
|
|
16
|
+
certificateArn?: string;
|
|
17
|
+
/** CloudFormation stack name */
|
|
18
|
+
stackName?: string;
|
|
19
|
+
/** Default root object */
|
|
20
|
+
defaultRootObject?: string;
|
|
21
|
+
/** Error document */
|
|
22
|
+
errorDocument?: string;
|
|
23
|
+
/** Cache control for assets */
|
|
24
|
+
cacheControl?: string;
|
|
25
|
+
/** Tags to apply to resources */
|
|
26
|
+
tags?: Record<string, string>;
|
|
27
|
+
/** DNS provider configuration */
|
|
28
|
+
dnsProvider: DnsProviderConfig;
|
|
29
|
+
/** Skip DNS verification and record creation (use when DNS is already configured) */
|
|
30
|
+
skipDnsVerification?: boolean;
|
|
31
|
+
/** When true, serves raw files without URL rewriting (for curl | bash install scripts) */
|
|
32
|
+
passthroughUrls?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface ExternalDnsDeployResult {
|
|
35
|
+
success: boolean;
|
|
36
|
+
stackId?: string;
|
|
37
|
+
stackName: string;
|
|
38
|
+
bucket: string;
|
|
39
|
+
distributionId?: string;
|
|
40
|
+
distributionDomain?: string;
|
|
41
|
+
domain?: string;
|
|
42
|
+
certificateArn?: string;
|
|
43
|
+
message: string;
|
|
44
|
+
filesUploaded?: number;
|
|
45
|
+
filesSkipped?: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Generate CloudFormation template for static site infrastructure (without Route53)
|
|
49
|
+
*/
|
|
50
|
+
export declare function generateExternalDnsStaticSiteTemplate(config: {
|
|
51
|
+
bucketName: string;
|
|
52
|
+
domain?: string;
|
|
53
|
+
aliases?: string[];
|
|
54
|
+
certificateArn?: string;
|
|
55
|
+
defaultRootObject?: string;
|
|
56
|
+
errorDocument?: string;
|
|
57
|
+
passthroughUrls?: boolean;
|
|
58
|
+
}): object;
|
|
59
|
+
/**
|
|
60
|
+
* Deploy a static site to AWS with external DNS provider
|
|
61
|
+
*/
|
|
62
|
+
export declare function deployStaticSiteWithExternalDns(config: ExternalDnsStaticSiteConfig): Promise<ExternalDnsDeployResult>;
|
|
63
|
+
/**
|
|
64
|
+
* Full deployment with external DNS: infrastructure + files + cache invalidation
|
|
65
|
+
*/
|
|
66
|
+
export declare function deployStaticSiteWithExternalDnsFull(config: ExternalDnsStaticSiteConfig & {
|
|
67
|
+
sourceDir: string;
|
|
68
|
+
cleanBucket?: boolean;
|
|
69
|
+
onProgress?: (stage: string, detail?: string) => void;
|
|
70
|
+
}): Promise<ExternalDnsDeployResult>;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static Site Deployment Module
|
|
3
|
+
* Deploys static sites to AWS using CloudFormation (S3 + CloudFront + Route53/External DNS + ACM)
|
|
4
|
+
*/
|
|
5
|
+
import type { DnsProviderConfig } from '../dns/types';
|
|
6
|
+
export interface StaticSiteConfig {
|
|
7
|
+
/** Site name used for resource naming */
|
|
8
|
+
siteName: string;
|
|
9
|
+
/** AWS region for S3 bucket */
|
|
10
|
+
region?: string;
|
|
11
|
+
/** Custom domain (e.g., docs.example.com) */
|
|
12
|
+
domain?: string;
|
|
13
|
+
/** Subdomain part (e.g., 'docs') - used with baseDomain */
|
|
14
|
+
subdomain?: string;
|
|
15
|
+
/** Base domain (e.g., 'example.com') - must have Route53 hosted zone */
|
|
16
|
+
baseDomain?: string;
|
|
17
|
+
/** S3 bucket name (auto-generated if not provided) */
|
|
18
|
+
bucket?: string;
|
|
19
|
+
/** Route53 hosted zone ID (auto-detected if not provided) */
|
|
20
|
+
hostedZoneId?: string;
|
|
21
|
+
/** ACM certificate ARN (auto-created if not provided) */
|
|
22
|
+
certificateArn?: string;
|
|
23
|
+
/** CloudFormation stack name */
|
|
24
|
+
stackName?: string;
|
|
25
|
+
/** Default root object */
|
|
26
|
+
defaultRootObject?: string;
|
|
27
|
+
/** Error document */
|
|
28
|
+
errorDocument?: string;
|
|
29
|
+
/** Cache control for assets */
|
|
30
|
+
cacheControl?: string;
|
|
31
|
+
/** Tags to apply to resources */
|
|
32
|
+
tags?: Record<string, string>;
|
|
33
|
+
/**
|
|
34
|
+
* External DNS provider configuration (optional)
|
|
35
|
+
* When provided, DNS records will be managed via the specified provider (Porkbun, GoDaddy, etc.)
|
|
36
|
+
* instead of Route53. Useful when your domain is registered outside AWS.
|
|
37
|
+
*/
|
|
38
|
+
dnsProvider?: DnsProviderConfig;
|
|
39
|
+
}
|
|
40
|
+
export interface DeployResult {
|
|
41
|
+
success: boolean;
|
|
42
|
+
stackId?: string;
|
|
43
|
+
stackName: string;
|
|
44
|
+
bucket: string;
|
|
45
|
+
distributionId?: string;
|
|
46
|
+
distributionDomain?: string;
|
|
47
|
+
domain?: string;
|
|
48
|
+
certificateArn?: string;
|
|
49
|
+
message: string;
|
|
50
|
+
}
|
|
51
|
+
export interface UploadOptions {
|
|
52
|
+
/** Local directory containing built files */
|
|
53
|
+
sourceDir: string;
|
|
54
|
+
/** S3 bucket name */
|
|
55
|
+
bucket: string;
|
|
56
|
+
/** AWS region */
|
|
57
|
+
region: string;
|
|
58
|
+
/** Cache control header */
|
|
59
|
+
cacheControl?: string;
|
|
60
|
+
/** Callback for progress updates */
|
|
61
|
+
onProgress?: (uploaded: number, total: number, file: string) => void;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Generate CloudFormation template for static site infrastructure
|
|
65
|
+
*/
|
|
66
|
+
export declare function generateStaticSiteTemplate(config: {
|
|
67
|
+
bucketName: string;
|
|
68
|
+
domain?: string;
|
|
69
|
+
certificateArn?: string;
|
|
70
|
+
hostedZoneId?: string;
|
|
71
|
+
defaultRootObject?: string;
|
|
72
|
+
errorDocument?: string;
|
|
73
|
+
}): object;
|
|
74
|
+
/**
|
|
75
|
+
* Deploy a static site to AWS
|
|
76
|
+
* Automatically routes to external DNS deployment when a non-Route53 dnsProvider is configured
|
|
77
|
+
*/
|
|
78
|
+
export declare function deployStaticSite(config: StaticSiteConfig): Promise<DeployResult>;
|
|
79
|
+
/**
|
|
80
|
+
* Upload files to S3 bucket (only uploads changed files)
|
|
81
|
+
*/
|
|
82
|
+
export declare function uploadStaticFiles(options: UploadOptions): Promise<{
|
|
83
|
+
uploaded: number;
|
|
84
|
+
skipped: number;
|
|
85
|
+
errors: string[];
|
|
86
|
+
}>;
|
|
87
|
+
/**
|
|
88
|
+
* Invalidate CloudFront cache
|
|
89
|
+
*/
|
|
90
|
+
export declare function invalidateCache(distributionId: string): Promise<{
|
|
91
|
+
invalidationId: string;
|
|
92
|
+
}>;
|
|
93
|
+
/**
|
|
94
|
+
* Delete static site infrastructure
|
|
95
|
+
*/
|
|
96
|
+
export declare function deleteStaticSite(stackName: string, region?: string): Promise<{
|
|
97
|
+
success: boolean;
|
|
98
|
+
message: string;
|
|
99
|
+
}>;
|
|
100
|
+
/**
|
|
101
|
+
* Full deployment: infrastructure + files + cache invalidation
|
|
102
|
+
*/
|
|
103
|
+
export declare function deployStaticSiteFull(config: StaticSiteConfig & {
|
|
104
|
+
sourceDir: string;
|
|
105
|
+
cleanBucket?: boolean;
|
|
106
|
+
onProgress?: (stage: string, detail?: string) => void;
|
|
107
|
+
}): Promise<DeployResult & {
|
|
108
|
+
filesUploaded?: number;
|
|
109
|
+
filesSkipped?: number;
|
|
110
|
+
}>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cloudflare DNS Provider
|
|
3
|
+
* API documentation: https://developers.cloudflare.com/api/resources/dns/subresources/records/
|
|
4
|
+
*/
|
|
5
|
+
import type { CreateRecordResult, DeleteRecordResult, DnsProvider, DnsRecord, DnsRecordType, ListRecordsResult } from './types';
|
|
6
|
+
export declare class CloudflareProvider implements DnsProvider {
|
|
7
|
+
readonly name = "cloudflare";
|
|
8
|
+
private apiToken;
|
|
9
|
+
private zoneCache;
|
|
10
|
+
constructor(apiToken: string);
|
|
11
|
+
/**
|
|
12
|
+
* Make an authenticated API request to Cloudflare
|
|
13
|
+
*/
|
|
14
|
+
private request;
|
|
15
|
+
/**
|
|
16
|
+
* Get the root domain from a full domain name
|
|
17
|
+
* e.g., "api.example.com" -> "example.com"
|
|
18
|
+
*/
|
|
19
|
+
private getRootDomain;
|
|
20
|
+
/**
|
|
21
|
+
* Get Zone ID for a domain (with caching)
|
|
22
|
+
*/
|
|
23
|
+
private getZoneId;
|
|
24
|
+
/**
|
|
25
|
+
* Get the full record name
|
|
26
|
+
* Cloudflare stores records with full domain names
|
|
27
|
+
*/
|
|
28
|
+
private getFullRecordName;
|
|
29
|
+
/**
|
|
30
|
+
* Convert DnsRecord to Cloudflare record format
|
|
31
|
+
*/
|
|
32
|
+
private toCloudflareRecord;
|
|
33
|
+
/**
|
|
34
|
+
* Convert Cloudflare record to DnsRecordResult format
|
|
35
|
+
*/
|
|
36
|
+
private fromCloudflareRecord;
|
|
37
|
+
createRecord(domain: string, record: DnsRecord): Promise<CreateRecordResult>;
|
|
38
|
+
upsertRecord(domain: string, record: DnsRecord): Promise<CreateRecordResult>;
|
|
39
|
+
deleteRecord(domain: string, record: DnsRecord): Promise<DeleteRecordResult>;
|
|
40
|
+
listRecords(domain: string, type?: DnsRecordType): Promise<ListRecordsResult>;
|
|
41
|
+
canManageDomain(domain: string): Promise<boolean>;
|
|
42
|
+
/**
|
|
43
|
+
* List all domains (zones) managed by this Cloudflare account
|
|
44
|
+
*/
|
|
45
|
+
listDomains(): Promise<string[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Get zone details (Cloudflare-specific)
|
|
48
|
+
*/
|
|
49
|
+
getZoneDetails(domain: string): Promise<{
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
status: string;
|
|
53
|
+
nameServers: string[];
|
|
54
|
+
paused: boolean;
|
|
55
|
+
} | null>;
|
|
56
|
+
/**
|
|
57
|
+
* Purge cache for a domain (Cloudflare-specific)
|
|
58
|
+
*/
|
|
59
|
+
purgeCache(domain: string, options?: {
|
|
60
|
+
purgeEverything?: boolean;
|
|
61
|
+
files?: string[];
|
|
62
|
+
tags?: string[];
|
|
63
|
+
hosts?: string[];
|
|
64
|
+
}): Promise<boolean>;
|
|
65
|
+
/**
|
|
66
|
+
* Get proxy status for a record (Cloudflare-specific)
|
|
67
|
+
* Returns whether a record is proxied through Cloudflare
|
|
68
|
+
*/
|
|
69
|
+
getRecordProxyStatus(domain: string, record: DnsRecord): Promise<boolean | null>;
|
|
70
|
+
/**
|
|
71
|
+
* Update proxy status for a record (Cloudflare-specific)
|
|
72
|
+
*/
|
|
73
|
+
setRecordProxyStatus(domain: string, record: DnsRecord, proxied: boolean): Promise<boolean>;
|
|
74
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GoDaddy DNS Provider
|
|
3
|
+
* API documentation: https://developer.godaddy.com/doc/endpoint/domains
|
|
4
|
+
*/
|
|
5
|
+
import type { CreateRecordResult, DeleteRecordResult, DnsProvider, DnsRecord, DnsRecordType, ListRecordsResult } from './types';
|
|
6
|
+
export declare class GoDaddyProvider implements DnsProvider {
|
|
7
|
+
readonly name = "godaddy";
|
|
8
|
+
private apiKey;
|
|
9
|
+
private apiSecret;
|
|
10
|
+
private baseUrl;
|
|
11
|
+
constructor(apiKey: string, apiSecret: string, environment?: 'production' | 'ote');
|
|
12
|
+
/**
|
|
13
|
+
* Make an authenticated API request to GoDaddy
|
|
14
|
+
*/
|
|
15
|
+
private request;
|
|
16
|
+
/**
|
|
17
|
+
* Extract the subdomain from a full record name
|
|
18
|
+
* GoDaddy uses @ for root domain
|
|
19
|
+
*/
|
|
20
|
+
private getSubdomain;
|
|
21
|
+
/**
|
|
22
|
+
* Get the root domain from a full domain name
|
|
23
|
+
*/
|
|
24
|
+
private getRootDomain;
|
|
25
|
+
/**
|
|
26
|
+
* Convert DnsRecord to GoDaddy record format
|
|
27
|
+
*/
|
|
28
|
+
private toGoDaddyRecord;
|
|
29
|
+
/**
|
|
30
|
+
* Convert GoDaddy record to DnsRecordResult format
|
|
31
|
+
*/
|
|
32
|
+
private fromGoDaddyRecord;
|
|
33
|
+
createRecord(domain: string, record: DnsRecord): Promise<CreateRecordResult>;
|
|
34
|
+
upsertRecord(domain: string, record: DnsRecord): Promise<CreateRecordResult>;
|
|
35
|
+
deleteRecord(domain: string, record: DnsRecord): Promise<DeleteRecordResult>;
|
|
36
|
+
listRecords(domain: string, type?: DnsRecordType): Promise<ListRecordsResult>;
|
|
37
|
+
canManageDomain(domain: string): Promise<boolean>;
|
|
38
|
+
/**
|
|
39
|
+
* List all domains managed by this GoDaddy account
|
|
40
|
+
*/
|
|
41
|
+
listDomains(): Promise<string[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Get domain details (GoDaddy-specific)
|
|
44
|
+
*/
|
|
45
|
+
getDomainDetails(domain: string): Promise<{
|
|
46
|
+
domain: string;
|
|
47
|
+
status: string;
|
|
48
|
+
nameServers?: string[];
|
|
49
|
+
expires?: string;
|
|
50
|
+
} | null>;
|
|
51
|
+
/**
|
|
52
|
+
* Update nameservers for a domain (GoDaddy-specific)
|
|
53
|
+
*/
|
|
54
|
+
updateNameServers(domain: string, nameservers: string[]): Promise<boolean>;
|
|
55
|
+
/**
|
|
56
|
+
* Check domain availability (GoDaddy-specific)
|
|
57
|
+
*/
|
|
58
|
+
checkDomainAvailability(domain: string): Promise<{
|
|
59
|
+
available: boolean;
|
|
60
|
+
price?: number;
|
|
61
|
+
currency?: string;
|
|
62
|
+
}>;
|
|
63
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DNS Provider Module
|
|
3
|
+
* Unified DNS management for Route53, Porkbun, and GoDaddy
|
|
4
|
+
*/
|
|
5
|
+
export * from './types';
|
|
6
|
+
export { PorkbunProvider } from './porkbun';
|
|
7
|
+
export { GoDaddyProvider } from './godaddy';
|
|
8
|
+
export { CloudflareProvider } from './cloudflare';
|
|
9
|
+
export { Route53Provider } from './route53-adapter';
|
|
10
|
+
export { UnifiedDnsValidator, createPorkbunValidator, createGoDaddyValidator, createRoute53Validator, } from './validator';
|
|
11
|
+
import type { DnsProvider, DnsProviderConfig } from './types';
|
|
12
|
+
/**
|
|
13
|
+
* Create a DNS provider from configuration
|
|
14
|
+
*/
|
|
15
|
+
export declare function createDnsProvider(config: DnsProviderConfig): DnsProvider;
|
|
16
|
+
/**
|
|
17
|
+
* Auto-detect DNS provider for a domain
|
|
18
|
+
* Tries each provider to see which one can manage the domain
|
|
19
|
+
*/
|
|
20
|
+
export declare function detectDnsProvider(domain: string, configs: DnsProviderConfig[]): Promise<DnsProvider | null>;
|
|
21
|
+
/**
|
|
22
|
+
* DNS Provider factory with environment variable support
|
|
23
|
+
*/
|
|
24
|
+
export declare class DnsProviderFactory {
|
|
25
|
+
private providers;
|
|
26
|
+
private configs;
|
|
27
|
+
/**
|
|
28
|
+
* Add provider configuration
|
|
29
|
+
*/
|
|
30
|
+
addConfig(config: DnsProviderConfig): this;
|
|
31
|
+
/**
|
|
32
|
+
* Add Route53 provider
|
|
33
|
+
*/
|
|
34
|
+
addRoute53(region?: string, hostedZoneId?: string): this;
|
|
35
|
+
/**
|
|
36
|
+
* Add Porkbun provider
|
|
37
|
+
*/
|
|
38
|
+
addPorkbun(apiKey: string, secretKey: string): this;
|
|
39
|
+
/**
|
|
40
|
+
* Add GoDaddy provider
|
|
41
|
+
*/
|
|
42
|
+
addGoDaddy(apiKey: string, apiSecret: string, environment?: 'production' | 'ote'): this;
|
|
43
|
+
/**
|
|
44
|
+
* Add Cloudflare provider
|
|
45
|
+
*/
|
|
46
|
+
addCloudflare(apiToken: string): this;
|
|
47
|
+
/**
|
|
48
|
+
* Load providers from environment variables
|
|
49
|
+
*/
|
|
50
|
+
loadFromEnv(): this;
|
|
51
|
+
/**
|
|
52
|
+
* Get a provider by name
|
|
53
|
+
*/
|
|
54
|
+
getProvider(name: 'route53' | 'porkbun' | 'godaddy' | 'cloudflare'): DnsProvider | null;
|
|
55
|
+
/**
|
|
56
|
+
* Auto-detect provider for a domain
|
|
57
|
+
*/
|
|
58
|
+
getProviderForDomain(domain: string): Promise<DnsProvider | null>;
|
|
59
|
+
/**
|
|
60
|
+
* Get all configured providers
|
|
61
|
+
*/
|
|
62
|
+
getAllProviders(): DnsProvider[];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Default factory instance (can be configured globally)
|
|
66
|
+
*/
|
|
67
|
+
export declare const dnsProviders: DnsProviderFactory;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Porkbun DNS Provider
|
|
3
|
+
* API documentation: https://porkbun.com/api/json/v3/documentation
|
|
4
|
+
*/
|
|
5
|
+
import type { CreateRecordResult, DeleteRecordResult, DnsProvider, DnsRecord, DnsRecordType, ListRecordsResult } from './types';
|
|
6
|
+
export declare class PorkbunProvider implements DnsProvider {
|
|
7
|
+
readonly name = "porkbun";
|
|
8
|
+
private apiKey;
|
|
9
|
+
private secretKey;
|
|
10
|
+
constructor(apiKey: string, secretKey: string);
|
|
11
|
+
/**
|
|
12
|
+
* Make an authenticated API request to Porkbun
|
|
13
|
+
*/
|
|
14
|
+
private request;
|
|
15
|
+
/**
|
|
16
|
+
* Extract the subdomain from a full record name
|
|
17
|
+
* e.g., "_acme-challenge.example.com" -> "_acme-challenge"
|
|
18
|
+
*/
|
|
19
|
+
private getSubdomain;
|
|
20
|
+
/**
|
|
21
|
+
* Get the root domain from a full domain name
|
|
22
|
+
* e.g., "api.example.com" -> "example.com"
|
|
23
|
+
*/
|
|
24
|
+
private getRootDomain;
|
|
25
|
+
createRecord(domain: string, record: DnsRecord): Promise<CreateRecordResult>;
|
|
26
|
+
upsertRecord(domain: string, record: DnsRecord): Promise<CreateRecordResult>;
|
|
27
|
+
deleteRecord(domain: string, record: DnsRecord): Promise<DeleteRecordResult>;
|
|
28
|
+
listRecords(domain: string, type?: DnsRecordType): Promise<ListRecordsResult>;
|
|
29
|
+
canManageDomain(domain: string): Promise<boolean>;
|
|
30
|
+
/**
|
|
31
|
+
* List all domains managed by this Porkbun account
|
|
32
|
+
* Uses the domain list API endpoint
|
|
33
|
+
*/
|
|
34
|
+
listDomains(): Promise<string[]>;
|
|
35
|
+
/**
|
|
36
|
+
* Get nameservers for a domain (Porkbun-specific)
|
|
37
|
+
*/
|
|
38
|
+
getNameServers(domain: string): Promise<string[]>;
|
|
39
|
+
/**
|
|
40
|
+
* Update nameservers for a domain (Porkbun-specific)
|
|
41
|
+
*/
|
|
42
|
+
updateNameServers(domain: string, nameservers: string[]): Promise<boolean>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Route53 DNS Provider Adapter
|
|
3
|
+
* Wraps the existing Route53Client to implement the DnsProvider interface
|
|
4
|
+
*/
|
|
5
|
+
import { Route53Client } from '../aws/route53';
|
|
6
|
+
import type { CreateRecordResult, DeleteRecordResult, DnsProvider, DnsRecord, DnsRecordType, ListRecordsResult } from './types';
|
|
7
|
+
export declare class Route53Provider implements DnsProvider {
|
|
8
|
+
readonly name = "route53";
|
|
9
|
+
private client;
|
|
10
|
+
private hostedZoneCache;
|
|
11
|
+
private providedHostedZoneId?;
|
|
12
|
+
constructor(region?: string, hostedZoneId?: string);
|
|
13
|
+
/**
|
|
14
|
+
* Get the root domain from a full domain name
|
|
15
|
+
*/
|
|
16
|
+
private getRootDomain;
|
|
17
|
+
/**
|
|
18
|
+
* Get the hosted zone ID for a domain
|
|
19
|
+
*/
|
|
20
|
+
private getHostedZoneId;
|
|
21
|
+
/**
|
|
22
|
+
* Ensure domain name ends with a dot (Route53 requirement)
|
|
23
|
+
*/
|
|
24
|
+
private normalizeName;
|
|
25
|
+
createRecord(domain: string, record: DnsRecord): Promise<CreateRecordResult>;
|
|
26
|
+
upsertRecord(domain: string, record: DnsRecord): Promise<CreateRecordResult>;
|
|
27
|
+
deleteRecord(domain: string, record: DnsRecord): Promise<DeleteRecordResult>;
|
|
28
|
+
listRecords(domain: string, type?: DnsRecordType): Promise<ListRecordsResult>;
|
|
29
|
+
canManageDomain(domain: string): Promise<boolean>;
|
|
30
|
+
/**
|
|
31
|
+
* List all domains (hosted zones) managed in Route53
|
|
32
|
+
*/
|
|
33
|
+
listDomains(): Promise<string[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Get the underlying Route53Client for advanced operations
|
|
36
|
+
*/
|
|
37
|
+
getRoute53Client(): Route53Client;
|
|
38
|
+
/**
|
|
39
|
+
* Create an alias record (Route53-specific feature)
|
|
40
|
+
* Useful for CloudFront, ALB, etc.
|
|
41
|
+
*/
|
|
42
|
+
createAliasRecord(params: {
|
|
43
|
+
domain: string;
|
|
44
|
+
name: string;
|
|
45
|
+
targetHostedZoneId: string;
|
|
46
|
+
targetDnsName: string;
|
|
47
|
+
evaluateTargetHealth?: boolean;
|
|
48
|
+
type?: 'A' | 'AAAA';
|
|
49
|
+
}): Promise<CreateRecordResult>;
|
|
50
|
+
/**
|
|
51
|
+
* Create CloudFront alias record (convenience method)
|
|
52
|
+
*/
|
|
53
|
+
createCloudFrontAlias(params: {
|
|
54
|
+
domain: string;
|
|
55
|
+
name: string;
|
|
56
|
+
cloudFrontDomainName: string;
|
|
57
|
+
}): Promise<CreateRecordResult>;
|
|
58
|
+
/**
|
|
59
|
+
* Create ALB alias record (convenience method)
|
|
60
|
+
*/
|
|
61
|
+
createAlbAlias(params: {
|
|
62
|
+
domain: string;
|
|
63
|
+
name: string;
|
|
64
|
+
albDnsName: string;
|
|
65
|
+
region: string;
|
|
66
|
+
}): Promise<CreateRecordResult>;
|
|
67
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DNS Provider Types
|
|
3
|
+
* Common interfaces for DNS provider abstraction
|
|
4
|
+
*/
|
|
5
|
+
export type DnsRecordType = 'A' | 'AAAA' | 'CNAME' | 'TXT' | 'MX' | 'NS' | 'SRV' | 'CAA';
|
|
6
|
+
export interface DnsRecord {
|
|
7
|
+
name: string;
|
|
8
|
+
type: DnsRecordType;
|
|
9
|
+
content: string;
|
|
10
|
+
/** Alias for content - some providers use 'value' instead */
|
|
11
|
+
value?: string;
|
|
12
|
+
ttl?: number;
|
|
13
|
+
priority?: number;
|
|
14
|
+
weight?: number;
|
|
15
|
+
port?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface DnsRecordResult extends DnsRecord {
|
|
18
|
+
id?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface CreateRecordResult {
|
|
21
|
+
success: boolean;
|
|
22
|
+
id?: string;
|
|
23
|
+
message?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface DeleteRecordResult {
|
|
26
|
+
success: boolean;
|
|
27
|
+
message?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface ListRecordsResult {
|
|
30
|
+
success: boolean;
|
|
31
|
+
records: DnsRecordResult[];
|
|
32
|
+
message?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Common DNS Provider interface
|
|
36
|
+
* All DNS providers (Route53, Porkbun, GoDaddy, etc.) implement this
|
|
37
|
+
*/
|
|
38
|
+
export interface DnsProvider {
|
|
39
|
+
/**
|
|
40
|
+
* Provider name for logging/identification
|
|
41
|
+
*/
|
|
42
|
+
readonly name: string;
|
|
43
|
+
/**
|
|
44
|
+
* Create a DNS record
|
|
45
|
+
*/
|
|
46
|
+
createRecord(domain: string, record: DnsRecord): Promise<CreateRecordResult>;
|
|
47
|
+
/**
|
|
48
|
+
* Update an existing DNS record (upsert behavior)
|
|
49
|
+
*/
|
|
50
|
+
upsertRecord(domain: string, record: DnsRecord): Promise<CreateRecordResult>;
|
|
51
|
+
/**
|
|
52
|
+
* Delete a DNS record
|
|
53
|
+
*/
|
|
54
|
+
deleteRecord(domain: string, record: DnsRecord): Promise<DeleteRecordResult>;
|
|
55
|
+
/**
|
|
56
|
+
* List all DNS records for a domain
|
|
57
|
+
*/
|
|
58
|
+
listRecords(domain: string, type?: DnsRecordType): Promise<ListRecordsResult>;
|
|
59
|
+
/**
|
|
60
|
+
* Check if the provider can manage this domain
|
|
61
|
+
*/
|
|
62
|
+
canManageDomain(domain: string): Promise<boolean>;
|
|
63
|
+
/**
|
|
64
|
+
* List all domains managed by this provider
|
|
65
|
+
* Returns an array of domain names (e.g., ['example.com', 'mysite.org'])
|
|
66
|
+
*/
|
|
67
|
+
listDomains(): Promise<string[]>;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* DNS Provider configuration types
|
|
71
|
+
*/
|
|
72
|
+
export interface Route53ProviderConfig {
|
|
73
|
+
provider: 'route53';
|
|
74
|
+
region?: string;
|
|
75
|
+
hostedZoneId?: string;
|
|
76
|
+
}
|
|
77
|
+
export interface PorkbunProviderConfig {
|
|
78
|
+
provider: 'porkbun';
|
|
79
|
+
apiKey: string;
|
|
80
|
+
secretKey: string;
|
|
81
|
+
}
|
|
82
|
+
export interface GoDaddyProviderConfig {
|
|
83
|
+
provider: 'godaddy';
|
|
84
|
+
apiKey: string;
|
|
85
|
+
apiSecret: string;
|
|
86
|
+
environment?: 'production' | 'ote';
|
|
87
|
+
}
|
|
88
|
+
export interface CloudflareProviderConfig {
|
|
89
|
+
provider: 'cloudflare';
|
|
90
|
+
apiToken: string;
|
|
91
|
+
}
|
|
92
|
+
export type DnsProviderConfig = Route53ProviderConfig | PorkbunProviderConfig | GoDaddyProviderConfig | CloudflareProviderConfig;
|
|
93
|
+
/**
|
|
94
|
+
* Extended configuration for certificate validation
|
|
95
|
+
*/
|
|
96
|
+
export interface CertificateValidationConfig {
|
|
97
|
+
provider: DnsProviderConfig;
|
|
98
|
+
waitForValidation?: boolean;
|
|
99
|
+
maxWaitMinutes?: number;
|
|
100
|
+
}
|