@stacksjs/ts-cloud 0.9.3 → 0.10.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 (255) hide show
  1. package/dist/aws/index.js +1 -269
  2. package/dist/bin/chunk-08c0pzkb.js +1 -0
  3. package/dist/bin/chunk-12210qvj.js +1 -0
  4. package/dist/bin/chunk-1v6bt68w.js +6 -0
  5. package/dist/bin/chunk-35ttwn26.js +70 -0
  6. package/dist/bin/chunk-3r3be05z.js +1 -0
  7. package/dist/bin/chunk-41yqpdv7.js +2 -0
  8. package/dist/bin/chunk-5rv31chh.js +1 -0
  9. package/dist/bin/chunk-6eat8ezk.js +2 -0
  10. package/dist/bin/chunk-6gktf2m2.js +1 -0
  11. package/dist/bin/chunk-6zjy949y.js +141 -0
  12. package/dist/bin/chunk-7wzdaqh6.js +2 -0
  13. package/dist/bin/chunk-80ar3aty.js +1 -0
  14. package/dist/bin/chunk-8rwhsp5b.js +2 -0
  15. package/dist/bin/chunk-936vp7dx.js +44 -0
  16. package/dist/bin/chunk-9px3rg4a.js +4 -0
  17. package/dist/bin/chunk-anm3ae6z.js +7364 -0
  18. package/dist/bin/{chunk-ynjvbphf.js → chunk-axvr7dwa.js} +6 -6
  19. package/dist/bin/chunk-b0hj9m5e.js +2 -0
  20. package/dist/bin/{chunk-mh0kdzqp.js → chunk-b2ymh8k0.js} +1 -1
  21. package/dist/bin/chunk-b35989e3.js +50 -0
  22. package/dist/bin/chunk-c2b6nk0q.js +37 -0
  23. package/dist/bin/chunk-ckxpgwxw.js +3 -0
  24. package/dist/bin/chunk-d6zzgvtn.js +92 -0
  25. package/dist/bin/chunk-da8zpf82.js +1 -0
  26. package/dist/bin/chunk-ddmjjstg.js +1 -0
  27. package/dist/bin/chunk-dhhz4zyj.js +1 -0
  28. package/dist/bin/chunk-dj9a67c3.js +9 -0
  29. package/dist/bin/chunk-ds1z880f.js +1 -0
  30. package/dist/bin/chunk-dvkj4k6h.js +111 -0
  31. package/dist/bin/chunk-eh40fpvj.js +1 -0
  32. package/dist/bin/chunk-ey9fagrr.js +6 -0
  33. package/dist/bin/chunk-ezftw2q4.js +1 -0
  34. package/dist/bin/chunk-g6a4n3rh.js +1 -0
  35. package/dist/bin/chunk-g90nqfgv.js +585 -0
  36. package/dist/bin/chunk-gs40j75w.js +1 -0
  37. package/dist/bin/chunk-jjjts1vt.js +1 -0
  38. package/dist/bin/{chunk-ry030a6b.js → chunk-jnsbzqzz.js} +30 -30
  39. package/dist/bin/chunk-jnx4jgw8.js +1 -0
  40. package/dist/bin/chunk-jt1tndm2.js +3 -0
  41. package/dist/bin/chunk-kybdb0ws.js +2 -0
  42. package/dist/bin/chunk-m3nqw76h.js +3 -0
  43. package/dist/bin/chunk-mn6j22zn.js +6 -0
  44. package/dist/bin/chunk-nb0yjkv5.js +2 -0
  45. package/dist/bin/chunk-pjpa4x52.js +2 -0
  46. package/dist/bin/chunk-pkgkfe6s.js +2 -0
  47. package/dist/bin/chunk-pnz5hk8n.js +60 -0
  48. package/dist/bin/chunk-q46zr2tv.js +1 -0
  49. package/dist/bin/chunk-qtdngvs8.js +1 -0
  50. package/dist/bin/chunk-sbejksrh.js +2 -0
  51. package/dist/bin/chunk-svyd4v6c.js +34 -0
  52. package/dist/bin/chunk-tna7ay8d.js +1 -0
  53. package/dist/bin/chunk-tp4c2mv1.js +1 -0
  54. package/dist/bin/chunk-w5d6tr2x.js +1 -0
  55. package/dist/bin/chunk-wewcjam5.js +1 -0
  56. package/dist/bin/chunk-xv4bscrm.js +1 -0
  57. package/dist/bin/chunk-y9eyc5pw.js +1 -0
  58. package/dist/bin/chunk-y9f8649w.js +512 -0
  59. package/dist/bin/cli.js +428 -418
  60. package/dist/bin/dashboard-server.js +1 -1
  61. package/dist/chunk-06jk7ba9.js +7355 -0
  62. package/dist/chunk-0e16qt6k.js +5 -0
  63. package/dist/chunk-13hxhzaz.js +34 -0
  64. package/dist/chunk-2p89vt3b.js +2 -0
  65. package/dist/chunk-77t2ctwn.js +2 -0
  66. package/dist/chunk-88z37ey4.js +114 -0
  67. package/dist/chunk-8c4715hz.js +2 -0
  68. package/dist/chunk-9a22225r.js +60 -0
  69. package/dist/chunk-as6by62d.js +1 -0
  70. package/dist/chunk-cd0zpxhf.js +44 -0
  71. package/dist/chunk-cp54a0qn.js +6 -0
  72. package/dist/chunk-d67xbk4v.js +141 -0
  73. package/dist/chunk-dckz9xve.js +2 -0
  74. package/dist/chunk-e1666vjv.js +2 -0
  75. package/dist/chunk-hhdx5k96.js +442 -0
  76. package/dist/chunk-kv2ztkp4.js +1617 -0
  77. package/dist/chunk-nrz6zypg.js +1 -0
  78. package/dist/chunk-q816js1y.js +1 -0
  79. package/dist/chunk-qh9ep11z.js +704 -0
  80. package/dist/chunk-rg720cqg.js +1 -0
  81. package/dist/chunk-snak8s7m.js +92 -0
  82. package/dist/chunk-vq737g82.js +1 -0
  83. package/dist/chunk-xd6w0c11.js +50 -0
  84. package/dist/chunk-xtwjt370.js +37 -0
  85. package/dist/chunk-y26yh5zp.js +1 -0
  86. package/dist/chunk-zmxffmmq.js +4 -0
  87. package/dist/deploy/attach-credentials.d.ts +4 -8
  88. package/dist/deploy/index.js +1 -168
  89. package/dist/dns/cloudflare.d.ts +27 -0
  90. package/dist/dns/godaddy.d.ts +18 -1
  91. package/dist/dns/index.d.ts +2 -0
  92. package/dist/dns/index.js +1 -41
  93. package/dist/dns/zone-migration.d.ts +92 -0
  94. package/dist/dns/zone-migration.test.d.ts +1 -0
  95. package/dist/drivers/hetzner/driver.d.ts +8 -1
  96. package/dist/drivers/index.js +1 -154
  97. package/dist/drivers/shared/compute-provision.d.ts +14 -2
  98. package/dist/drivers/shared/db-provision.d.ts +3 -2
  99. package/dist/drivers/shared/mail-provision.d.ts +116 -0
  100. package/dist/drivers/shared/mail-provision.test.d.ts +1 -0
  101. package/dist/drivers/shared/managed-services-probe.d.ts +47 -0
  102. package/dist/drivers/shared/managed-services-probe.test.d.ts +1 -0
  103. package/dist/drivers/shared/package-manager.d.ts +1 -0
  104. package/dist/drivers/shared/remote-failure.d.ts +21 -0
  105. package/dist/drivers/shared/remote-failure.test.d.ts +1 -0
  106. package/dist/drivers/shared/sqlite-shared-path.d.ts +50 -0
  107. package/dist/drivers/shared/sqlite-shared-path.test.d.ts +1 -0
  108. package/dist/index.d.ts +2 -0
  109. package/dist/index.js +100 -6129
  110. package/dist/operations/plan.d.ts +136 -0
  111. package/dist/operations/plan.test.d.ts +1 -0
  112. package/dist/operations/server-rename.d.ts +84 -0
  113. package/dist/operations/server-rename.test.d.ts +1 -0
  114. package/dist/operations/site-move.d.ts +263 -0
  115. package/dist/operations/site-move.test.d.ts +1 -0
  116. package/dist/protection/index.js +1 -89
  117. package/dist/push/index.js +1 -509
  118. package/dist/spend/index.js +1 -173
  119. package/dist/ui/404.html +1 -1
  120. package/dist/ui/accept-invitation.html +1 -1
  121. package/dist/ui/access-denied.html +1 -1
  122. package/dist/ui/account/automation.html +5 -5
  123. package/dist/ui/account/security.html +2 -2
  124. package/dist/ui/applications/compose.html +6 -6
  125. package/dist/ui/applications/new.html +2 -2
  126. package/dist/ui/data/backups.html +80 -80
  127. package/dist/ui/data/services.html +78 -78
  128. package/dist/ui/data/volumes.html +50 -50
  129. package/dist/ui/index.html +50 -50
  130. package/dist/ui/infrastructure/topology.html +118 -118
  131. package/dist/ui/integrations.html +1 -1
  132. package/dist/ui/operations/alerts.html +47 -47
  133. package/dist/ui/operations/configuration.html +5 -5
  134. package/dist/ui/operations/jobs.html +76 -76
  135. package/dist/ui/operations/maintenance.html +6 -6
  136. package/dist/ui/operations/observability.html +82 -82
  137. package/dist/ui/operations/previews.html +5 -5
  138. package/dist/ui/operations/queue.html +6 -6
  139. package/dist/ui/operations/regions.html +6 -6
  140. package/dist/ui/operations/releases.html +6 -6
  141. package/dist/ui/operations/spend.html +54 -54
  142. package/dist/ui/operations/workloads.html +104 -104
  143. package/dist/ui/security.html +2 -2
  144. package/dist/ui/server/actions.html +56 -56
  145. package/dist/ui/server/activity.html +1 -1
  146. package/dist/ui/server/capacity.html +6 -6
  147. package/dist/ui/server/database.html +106 -106
  148. package/dist/ui/server/deployments.html +50 -50
  149. package/dist/ui/server/diagnostics.html +2 -2
  150. package/dist/ui/server/firewall.html +76 -76
  151. package/dist/ui/server/fleet.html +34 -34
  152. package/dist/ui/server/logs.html +24 -24
  153. package/dist/ui/server/metrics.html +112 -112
  154. package/dist/ui/server/security.html +1 -1
  155. package/dist/ui/server/services.html +27 -27
  156. package/dist/ui/server/sites.html +120 -120
  157. package/dist/ui/server/ssh-keys.html +51 -51
  158. package/dist/ui/server/team.html +144 -144
  159. package/dist/ui/server/terminal.html +15 -15
  160. package/dist/ui/serverless/alarms.html +52 -52
  161. package/dist/ui/serverless/assets.html +27 -27
  162. package/dist/ui/serverless/cost.html +2 -2
  163. package/dist/ui/serverless/data.html +36 -36
  164. package/dist/ui/serverless/deployments.html +27 -27
  165. package/dist/ui/serverless/firewall.html +1 -1
  166. package/dist/ui/serverless/functions.html +40 -40
  167. package/dist/ui/serverless/logs.html +24 -24
  168. package/dist/ui/serverless/metrics.html +2 -2
  169. package/dist/ui/serverless/queues.html +47 -47
  170. package/dist/ui/serverless/secrets.html +52 -52
  171. package/dist/ui/serverless/traces.html +6 -6
  172. package/dist/ui/serverless.html +54 -54
  173. package/dist/ui-src/src/charts.ts +17499 -12662
  174. package/dist/ui-src/src/topology.ts +2 -2
  175. package/package.json +3 -3
  176. package/dist/bin/chunk-09nwf2gy.js +0 -34
  177. package/dist/bin/chunk-14cwr6eh.js +0 -70
  178. package/dist/bin/chunk-271gk1n2.js +0 -6
  179. package/dist/bin/chunk-38pq971s.js +0 -2
  180. package/dist/bin/chunk-3gykfyq4.js +0 -37
  181. package/dist/bin/chunk-3r4fb59r.js +0 -3
  182. package/dist/bin/chunk-41x17hw1.js +0 -1
  183. package/dist/bin/chunk-4vrqm9h0.js +0 -2
  184. package/dist/bin/chunk-57y1zxbf.js +0 -3
  185. package/dist/bin/chunk-598yf4bs.js +0 -1
  186. package/dist/bin/chunk-8v7ddyvf.js +0 -1
  187. package/dist/bin/chunk-92mea34a.js +0 -1
  188. package/dist/bin/chunk-9pvsff8g.js +0 -1
  189. package/dist/bin/chunk-9v39615t.js +0 -1
  190. package/dist/bin/chunk-avm7tnwe.js +0 -1
  191. package/dist/bin/chunk-ax9mr6wm.js +0 -44
  192. package/dist/bin/chunk-axhnkn5g.js +0 -2
  193. package/dist/bin/chunk-b5gd39s8.js +0 -512
  194. package/dist/bin/chunk-b9qbp8j1.js +0 -1
  195. package/dist/bin/chunk-bz828v8q.js +0 -3
  196. package/dist/bin/chunk-c1vcdgvr.js +0 -1
  197. package/dist/bin/chunk-ctd2vg9w.js +0 -2
  198. package/dist/bin/chunk-dbgffky8.js +0 -1
  199. package/dist/bin/chunk-dwr30vbv.js +0 -1
  200. package/dist/bin/chunk-e3xrwh9z.js +0 -1
  201. package/dist/bin/chunk-fhc6ntvd.js +0 -2
  202. package/dist/bin/chunk-fpm59y25.js +0 -6
  203. package/dist/bin/chunk-fvbxvq6b.js +0 -1
  204. package/dist/bin/chunk-fy8j3y8p.js +0 -92
  205. package/dist/bin/chunk-fz21b57w.js +0 -1
  206. package/dist/bin/chunk-gavvf0pg.js +0 -141
  207. package/dist/bin/chunk-ggn7ax8p.js +0 -4
  208. package/dist/bin/chunk-gpe2prkm.js +0 -1
  209. package/dist/bin/chunk-gqf6jsmy.js +0 -1
  210. package/dist/bin/chunk-h5pa5men.js +0 -2
  211. package/dist/bin/chunk-hm08xdxf.js +0 -2
  212. package/dist/bin/chunk-hzgz13nf.js +0 -1
  213. package/dist/bin/chunk-hzqw8xm5.js +0 -111
  214. package/dist/bin/chunk-j703btc5.js +0 -50
  215. package/dist/bin/chunk-jpjamjey.js +0 -6935
  216. package/dist/bin/chunk-m2zwtapr.js +0 -1
  217. package/dist/bin/chunk-m669wtgr.js +0 -1
  218. package/dist/bin/chunk-mr0atd2s.js +0 -2
  219. package/dist/bin/chunk-ngcyftm2.js +0 -1
  220. package/dist/bin/chunk-p66ptpmr.js +0 -2
  221. package/dist/bin/chunk-p8q9bq9g.js +0 -1
  222. package/dist/bin/chunk-r3kv0vm9.js +0 -6
  223. package/dist/bin/chunk-r9hjwcj9.js +0 -6
  224. package/dist/bin/chunk-rtczra13.js +0 -1
  225. package/dist/bin/chunk-rytk89az.js +0 -60
  226. package/dist/bin/chunk-sgyffpgm.js +0 -581
  227. package/dist/bin/chunk-vek8a0w6.js +0 -1
  228. package/dist/bin/chunk-waayf9ay.js +0 -2
  229. package/dist/bin/chunk-yv9sth30.js +0 -1
  230. package/dist/chunk-01d86gt1.js +0 -1324
  231. package/dist/chunk-050r7ycy.js +0 -46516
  232. package/dist/chunk-1c8dbv57.js +0 -7278
  233. package/dist/chunk-29rse4p1.js +0 -12203
  234. package/dist/chunk-32e7ya18.js +0 -642
  235. package/dist/chunk-4cjrg98a.js +0 -597
  236. package/dist/chunk-50jpda9q.js +0 -371
  237. package/dist/chunk-6a1t7fnq.js +0 -12121
  238. package/dist/chunk-728jvrr0.js +0 -1701
  239. package/dist/chunk-7m60qnc8.js +0 -1762
  240. package/dist/chunk-aa2dkn7b.js +0 -205
  241. package/dist/chunk-d48vtdj4.js +0 -433
  242. package/dist/chunk-f55nkpvb.js +0 -8
  243. package/dist/chunk-fgk8cqew.js +0 -152
  244. package/dist/chunk-he9a874b.js +0 -769
  245. package/dist/chunk-k2yyatfw.js +0 -10
  246. package/dist/chunk-k4px0bnv.js +0 -23
  247. package/dist/chunk-nsgqsmrh.js +0 -1779
  248. package/dist/chunk-q0st3se8.js +0 -42033
  249. package/dist/chunk-qr803fye.js +0 -2122
  250. package/dist/chunk-rds0sy87.js +0 -1771
  251. package/dist/chunk-ttz2ra5j.js +0 -12
  252. package/dist/chunk-v0bahtg2.js +0 -4
  253. package/dist/chunk-va2yd85b.js +0 -200
  254. package/dist/chunk-x9s0cqfx.js +0 -13
  255. package/dist/chunk-zqtpg06c.js +0 -1752
@@ -1,642 +0,0 @@
1
- import {
2
- AWSClient
3
- } from "./chunk-zqtpg06c.js";
4
-
5
- // src/aws/route53.ts
6
- class Route53Client {
7
- client;
8
- region;
9
- constructor(region = "us-east-1") {
10
- this.region = region;
11
- this.client = new AWSClient;
12
- }
13
- async createHostedZone(params) {
14
- const callerReference = params.CallerReference || `${Date.now()}-${Math.random().toString(36).slice(2)}`;
15
- let xmlBody = `<?xml version="1.0" encoding="UTF-8"?>
16
- <CreateHostedZoneRequest xmlns="https://route53.amazonaws.com/doc/2013-04-01/">
17
- <Name>${params.Name}</Name>
18
- <CallerReference>${callerReference}</CallerReference>`;
19
- if (params.HostedZoneConfig) {
20
- xmlBody += `
21
- <HostedZoneConfig>`;
22
- if (params.HostedZoneConfig.Comment) {
23
- xmlBody += `
24
- <Comment>${params.HostedZoneConfig.Comment}</Comment>`;
25
- }
26
- if (params.HostedZoneConfig.PrivateZone !== undefined) {
27
- xmlBody += `
28
- <PrivateZone>${params.HostedZoneConfig.PrivateZone}</PrivateZone>`;
29
- }
30
- xmlBody += `
31
- </HostedZoneConfig>`;
32
- }
33
- if (params.VPC) {
34
- xmlBody += `
35
- <VPC>
36
- <VPCRegion>${params.VPC.VPCRegion}</VPCRegion>
37
- <VPCId>${params.VPC.VPCId}</VPCId>
38
- </VPC>`;
39
- }
40
- if (params.DelegationSetId) {
41
- xmlBody += `
42
- <DelegationSetId>${params.DelegationSetId}</DelegationSetId>`;
43
- }
44
- xmlBody += `
45
- </CreateHostedZoneRequest>`;
46
- const result = await this.client.request({
47
- service: "route53",
48
- region: this.region,
49
- method: "POST",
50
- path: "/2013-04-01/hostedzone",
51
- headers: {
52
- "content-type": "application/xml"
53
- },
54
- body: xmlBody
55
- });
56
- return this.parseCreateHostedZoneResponse(result);
57
- }
58
- async listHostedZones(params) {
59
- const queryParams = {};
60
- if (params?.Marker)
61
- queryParams.marker = params.Marker;
62
- if (params?.MaxItems)
63
- queryParams.maxitems = params.MaxItems;
64
- const result = await this.client.request({
65
- service: "route53",
66
- region: this.region,
67
- method: "GET",
68
- path: "/2013-04-01/hostedzone",
69
- queryParams: Object.keys(queryParams).length > 0 ? queryParams : undefined
70
- });
71
- return this.parseListHostedZonesResponse(result);
72
- }
73
- async listHostedZonesByName(params) {
74
- const queryParams = {};
75
- if (params?.DNSName)
76
- queryParams.dnsname = params.DNSName;
77
- if (params?.HostedZoneId)
78
- queryParams.hostedzoneid = params.HostedZoneId;
79
- if (params?.MaxItems)
80
- queryParams.maxitems = params.MaxItems;
81
- const result = await this.client.request({
82
- service: "route53",
83
- region: this.region,
84
- method: "GET",
85
- path: "/2013-04-01/hostedzonesbyname",
86
- queryParams: Object.keys(queryParams).length > 0 ? queryParams : undefined
87
- });
88
- return this.parseListHostedZonesResponse(result);
89
- }
90
- async getHostedZone(params) {
91
- const hostedZoneId = params.Id.replace("/hostedzone/", "");
92
- const result = await this.client.request({
93
- service: "route53",
94
- region: this.region,
95
- method: "GET",
96
- path: `/2013-04-01/hostedzone/${hostedZoneId}`
97
- });
98
- return this.parseGetHostedZoneResponse(result);
99
- }
100
- async deleteHostedZone(params) {
101
- const hostedZoneId = params.Id.replace("/hostedzone/", "");
102
- await this.client.request({
103
- service: "route53",
104
- region: this.region,
105
- method: "DELETE",
106
- path: `/2013-04-01/hostedzone/${hostedZoneId}`
107
- });
108
- }
109
- async listResourceRecordSets(params) {
110
- const hostedZoneId = params.HostedZoneId.replace("/hostedzone/", "");
111
- const queryParams = {};
112
- if (params.StartRecordName)
113
- queryParams.name = params.StartRecordName;
114
- if (params.StartRecordType)
115
- queryParams.type = params.StartRecordType;
116
- if (params.StartRecordIdentifier)
117
- queryParams.identifier = params.StartRecordIdentifier;
118
- if (params.MaxItems)
119
- queryParams.maxitems = params.MaxItems;
120
- const result = await this.client.request({
121
- service: "route53",
122
- region: this.region,
123
- method: "GET",
124
- path: `/2013-04-01/hostedzone/${hostedZoneId}/rrset`,
125
- queryParams: Object.keys(queryParams).length > 0 ? queryParams : undefined
126
- });
127
- return this.parseListResourceRecordSetsResponse(result);
128
- }
129
- async changeResourceRecordSets(params) {
130
- const hostedZoneId = params.HostedZoneId.replace("/hostedzone/", "");
131
- let xmlBody = `<?xml version="1.0" encoding="UTF-8"?>
132
- <ChangeResourceRecordSetsRequest xmlns="https://route53.amazonaws.com/doc/2013-04-01/">
133
- <ChangeBatch>`;
134
- if (params.ChangeBatch.Comment) {
135
- xmlBody += `
136
- <Comment>${this.escapeXml(params.ChangeBatch.Comment)}</Comment>`;
137
- }
138
- xmlBody += `
139
- <Changes>`;
140
- for (const change of params.ChangeBatch.Changes) {
141
- xmlBody += `
142
- <Change>
143
- <Action>${change.Action}</Action>
144
- <ResourceRecordSet>
145
- <Name>${change.ResourceRecordSet.Name}</Name>
146
- <Type>${change.ResourceRecordSet.Type}</Type>`;
147
- if (change.ResourceRecordSet.TTL !== undefined) {
148
- xmlBody += `
149
- <TTL>${change.ResourceRecordSet.TTL}</TTL>`;
150
- }
151
- if (change.ResourceRecordSet.SetIdentifier) {
152
- xmlBody += `
153
- <SetIdentifier>${change.ResourceRecordSet.SetIdentifier}</SetIdentifier>`;
154
- }
155
- if (change.ResourceRecordSet.Weight !== undefined) {
156
- xmlBody += `
157
- <Weight>${change.ResourceRecordSet.Weight}</Weight>`;
158
- }
159
- if (change.ResourceRecordSet.Region) {
160
- xmlBody += `
161
- <Region>${change.ResourceRecordSet.Region}</Region>`;
162
- }
163
- if (change.ResourceRecordSet.Failover) {
164
- xmlBody += `
165
- <Failover>${change.ResourceRecordSet.Failover}</Failover>`;
166
- }
167
- if (change.ResourceRecordSet.HealthCheckId) {
168
- xmlBody += `
169
- <HealthCheckId>${change.ResourceRecordSet.HealthCheckId}</HealthCheckId>`;
170
- }
171
- if (change.ResourceRecordSet.ResourceRecords && change.ResourceRecordSet.ResourceRecords.length > 0) {
172
- xmlBody += `
173
- <ResourceRecords>`;
174
- for (const record of change.ResourceRecordSet.ResourceRecords) {
175
- xmlBody += `
176
- <ResourceRecord>
177
- <Value>${this.escapeXml(record.Value)}</Value>
178
- </ResourceRecord>`;
179
- }
180
- xmlBody += `
181
- </ResourceRecords>`;
182
- }
183
- if (change.ResourceRecordSet.AliasTarget) {
184
- xmlBody += `
185
- <AliasTarget>
186
- <HostedZoneId>${change.ResourceRecordSet.AliasTarget.HostedZoneId}</HostedZoneId>
187
- <DNSName>${change.ResourceRecordSet.AliasTarget.DNSName}</DNSName>
188
- <EvaluateTargetHealth>${change.ResourceRecordSet.AliasTarget.EvaluateTargetHealth}</EvaluateTargetHealth>
189
- </AliasTarget>`;
190
- }
191
- if (change.ResourceRecordSet.GeoLocation) {
192
- xmlBody += `
193
- <GeoLocation>`;
194
- if (change.ResourceRecordSet.GeoLocation.ContinentCode) {
195
- xmlBody += `
196
- <ContinentCode>${change.ResourceRecordSet.GeoLocation.ContinentCode}</ContinentCode>`;
197
- }
198
- if (change.ResourceRecordSet.GeoLocation.CountryCode) {
199
- xmlBody += `
200
- <CountryCode>${change.ResourceRecordSet.GeoLocation.CountryCode}</CountryCode>`;
201
- }
202
- if (change.ResourceRecordSet.GeoLocation.SubdivisionCode) {
203
- xmlBody += `
204
- <SubdivisionCode>${change.ResourceRecordSet.GeoLocation.SubdivisionCode}</SubdivisionCode>`;
205
- }
206
- xmlBody += `
207
- </GeoLocation>`;
208
- }
209
- xmlBody += `
210
- </ResourceRecordSet>
211
- </Change>`;
212
- }
213
- xmlBody += `
214
- </Changes>
215
- </ChangeBatch>
216
- </ChangeResourceRecordSetsRequest>`;
217
- const result = await this.client.request({
218
- service: "route53",
219
- region: this.region,
220
- method: "POST",
221
- path: `/2013-04-01/hostedzone/${hostedZoneId}/rrset`,
222
- headers: {
223
- "content-type": "application/xml"
224
- },
225
- body: xmlBody
226
- });
227
- return this.parseChangeResourceRecordSetsResponse(result);
228
- }
229
- escapeXml(str) {
230
- return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
231
- }
232
- parseCreateHostedZoneResponse(result) {
233
- const response = result.CreateHostedZoneResponse || result;
234
- return {
235
- HostedZone: this.parseHostedZone(response.HostedZone),
236
- ChangeInfo: {
237
- Id: response.ChangeInfo?.Id || "",
238
- Status: response.ChangeInfo?.Status || "",
239
- SubmittedAt: response.ChangeInfo?.SubmittedAt || ""
240
- },
241
- DelegationSet: this.parseDelegationSet(response.DelegationSet),
242
- Location: response.Location || ""
243
- };
244
- }
245
- parseListHostedZonesResponse(result) {
246
- const response = result.ListHostedZonesResponse || result.ListHostedZonesByNameResponse || result;
247
- let hostedZones = response.HostedZones?.HostedZone || response.HostedZones || [];
248
- if (!Array.isArray(hostedZones)) {
249
- hostedZones = hostedZones ? [hostedZones] : [];
250
- }
251
- return {
252
- HostedZones: hostedZones.map((hz) => this.parseHostedZone(hz)),
253
- IsTruncated: response.IsTruncated === "true" || response.IsTruncated === true,
254
- MaxItems: response.MaxItems || "100",
255
- Marker: response.Marker,
256
- NextMarker: response.NextMarker
257
- };
258
- }
259
- parseGetHostedZoneResponse(result) {
260
- const response = result.GetHostedZoneResponse || result;
261
- return {
262
- HostedZone: this.parseHostedZone(response.HostedZone),
263
- DelegationSet: this.parseDelegationSet(response.DelegationSet),
264
- VPCs: response.VPCs?.VPC ? Array.isArray(response.VPCs.VPC) ? response.VPCs.VPC : [response.VPCs.VPC] : undefined
265
- };
266
- }
267
- parseListResourceRecordSetsResponse(result) {
268
- const response = result.ListResourceRecordSetsResponse || result;
269
- let recordSets = response.ResourceRecordSets?.ResourceRecordSet || response.ResourceRecordSets || [];
270
- if (!Array.isArray(recordSets)) {
271
- recordSets = recordSets ? [recordSets] : [];
272
- }
273
- return {
274
- ResourceRecordSets: recordSets.map((rs) => this.parseResourceRecordSet(rs)),
275
- IsTruncated: response.IsTruncated === "true" || response.IsTruncated === true,
276
- MaxItems: response.MaxItems || "100",
277
- NextRecordName: response.NextRecordName,
278
- NextRecordType: response.NextRecordType,
279
- NextRecordIdentifier: response.NextRecordIdentifier
280
- };
281
- }
282
- parseChangeResourceRecordSetsResponse(result) {
283
- const response = result.ChangeResourceRecordSetsResponse || result;
284
- return {
285
- ChangeInfo: {
286
- Id: response.ChangeInfo?.Id || "",
287
- Status: response.ChangeInfo?.Status || "",
288
- SubmittedAt: response.ChangeInfo?.SubmittedAt || "",
289
- Comment: response.ChangeInfo?.Comment
290
- }
291
- };
292
- }
293
- parseHostedZone(hz) {
294
- if (!hz)
295
- return { Id: "", Name: "" };
296
- return {
297
- Id: hz.Id || "",
298
- Name: hz.Name || "",
299
- CallerReference: hz.CallerReference,
300
- Config: hz.Config ? {
301
- Comment: hz.Config.Comment,
302
- PrivateZone: hz.Config.PrivateZone === "true" || hz.Config.PrivateZone === true
303
- } : undefined,
304
- ResourceRecordSetCount: hz.ResourceRecordSetCount ? Number(hz.ResourceRecordSetCount) : undefined
305
- };
306
- }
307
- parseDelegationSet(ds) {
308
- if (!ds)
309
- return { NameServers: [] };
310
- let nameServers = ds.NameServers?.NameServer || ds.NameServers || [];
311
- if (!Array.isArray(nameServers)) {
312
- nameServers = nameServers ? [nameServers] : [];
313
- }
314
- return {
315
- Id: ds.Id,
316
- CallerReference: ds.CallerReference,
317
- NameServers: nameServers
318
- };
319
- }
320
- parseResourceRecordSet(rs) {
321
- if (!rs)
322
- return { Name: "", Type: "" };
323
- let resourceRecords = rs.ResourceRecords?.ResourceRecord || rs.ResourceRecords || [];
324
- if (!Array.isArray(resourceRecords)) {
325
- resourceRecords = resourceRecords ? [resourceRecords] : [];
326
- }
327
- return {
328
- Name: rs.Name || "",
329
- Type: rs.Type || "",
330
- TTL: rs.TTL ? Number(rs.TTL) : undefined,
331
- ResourceRecords: resourceRecords.map((rr) => ({
332
- Value: rr.Value || rr
333
- })),
334
- AliasTarget: rs.AliasTarget ? {
335
- HostedZoneId: rs.AliasTarget.HostedZoneId,
336
- DNSName: rs.AliasTarget.DNSName,
337
- EvaluateTargetHealth: rs.AliasTarget.EvaluateTargetHealth === "true" || rs.AliasTarget.EvaluateTargetHealth === true
338
- } : undefined,
339
- SetIdentifier: rs.SetIdentifier,
340
- Weight: rs.Weight ? Number(rs.Weight) : undefined,
341
- Region: rs.Region,
342
- GeoLocation: rs.GeoLocation,
343
- Failover: rs.Failover,
344
- HealthCheckId: rs.HealthCheckId
345
- };
346
- }
347
- async findHostedZoneByName(domainName) {
348
- const normalizedDomain = domainName.endsWith(".") ? domainName : `${domainName}.`;
349
- const result = await this.listHostedZonesByName({ DNSName: normalizedDomain });
350
- const zone = result.HostedZones.find((z) => z.Name === normalizedDomain);
351
- return zone || null;
352
- }
353
- async createARecord(params) {
354
- const values = Array.isArray(params.Value) ? params.Value : [params.Value];
355
- return this.changeResourceRecordSets({
356
- HostedZoneId: params.HostedZoneId,
357
- ChangeBatch: {
358
- Changes: [
359
- {
360
- Action: "UPSERT",
361
- ResourceRecordSet: {
362
- Name: params.Name,
363
- Type: "A",
364
- TTL: params.TTL || 300,
365
- ResourceRecords: values.map((v) => ({ Value: v }))
366
- }
367
- }
368
- ]
369
- }
370
- });
371
- }
372
- async createCnameRecord(params) {
373
- return this.changeResourceRecordSets({
374
- HostedZoneId: params.HostedZoneId,
375
- ChangeBatch: {
376
- Changes: [
377
- {
378
- Action: "UPSERT",
379
- ResourceRecordSet: {
380
- Name: params.Name,
381
- Type: "CNAME",
382
- TTL: params.TTL || 300,
383
- ResourceRecords: [{ Value: params.Value }]
384
- }
385
- }
386
- ]
387
- }
388
- });
389
- }
390
- async createAliasRecord(params) {
391
- return this.changeResourceRecordSets({
392
- HostedZoneId: params.HostedZoneId,
393
- ChangeBatch: {
394
- Changes: [
395
- {
396
- Action: "UPSERT",
397
- ResourceRecordSet: {
398
- Name: params.Name,
399
- Type: params.Type || "A",
400
- AliasTarget: {
401
- HostedZoneId: params.TargetHostedZoneId,
402
- DNSName: params.TargetDNSName,
403
- EvaluateTargetHealth: params.EvaluateTargetHealth ?? false
404
- }
405
- }
406
- }
407
- ]
408
- }
409
- });
410
- }
411
- async createTxtRecord(params) {
412
- const values = Array.isArray(params.Value) ? params.Value : [params.Value];
413
- const quotedValues = values.map((v) => {
414
- if (!v.startsWith('"')) {
415
- return `"${v}"`;
416
- }
417
- return v;
418
- });
419
- return this.changeResourceRecordSets({
420
- HostedZoneId: params.HostedZoneId,
421
- ChangeBatch: {
422
- Changes: [
423
- {
424
- Action: "UPSERT",
425
- ResourceRecordSet: {
426
- Name: params.Name,
427
- Type: "TXT",
428
- TTL: params.TTL || 300,
429
- ResourceRecords: quotedValues.map((v) => ({ Value: v }))
430
- }
431
- }
432
- ]
433
- }
434
- });
435
- }
436
- async createMxRecord(params) {
437
- return this.changeResourceRecordSets({
438
- HostedZoneId: params.HostedZoneId,
439
- ChangeBatch: {
440
- Changes: [
441
- {
442
- Action: "UPSERT",
443
- ResourceRecordSet: {
444
- Name: params.Name,
445
- Type: "MX",
446
- TTL: params.TTL || 300,
447
- ResourceRecords: params.Values.map((v) => ({
448
- Value: `${v.priority} ${v.mailServer}`
449
- }))
450
- }
451
- }
452
- ]
453
- }
454
- });
455
- }
456
- async deleteRecord(params) {
457
- return this.changeResourceRecordSets({
458
- HostedZoneId: params.HostedZoneId,
459
- ChangeBatch: {
460
- Changes: [
461
- {
462
- Action: "DELETE",
463
- ResourceRecordSet: params.RecordSet
464
- }
465
- ]
466
- }
467
- });
468
- }
469
- async waitForChange(changeId, maxAttempts = 60, delayMs = 5000) {
470
- const id = changeId.replace("/change/", "");
471
- for (let i = 0;i < maxAttempts; i++) {
472
- const result = await this.client.request({
473
- service: "route53",
474
- region: this.region,
475
- method: "GET",
476
- path: `/2013-04-01/change/${id}`
477
- });
478
- const status = result.GetChangeResponse?.ChangeInfo?.Status || result.ChangeInfo?.Status;
479
- if (status === "INSYNC") {
480
- return true;
481
- }
482
- await new Promise((resolve) => setTimeout(resolve, delayMs));
483
- }
484
- return false;
485
- }
486
- async findOrCreateHostedZone(params) {
487
- const normalizedDomain = params.domainName.endsWith(".") ? params.domainName : `${params.domainName}.`;
488
- const existing = await this.findHostedZoneByName(normalizedDomain);
489
- if (existing) {
490
- const zoneDetails = await this.getHostedZone({ Id: existing.Id });
491
- return {
492
- hostedZone: existing,
493
- nameServers: zoneDetails.DelegationSet.NameServers,
494
- isNew: false
495
- };
496
- }
497
- const result = await this.createHostedZone({
498
- Name: normalizedDomain,
499
- HostedZoneConfig: {
500
- Comment: params.comment || `Hosted zone for ${params.domainName}`,
501
- PrivateZone: params.privateZone
502
- },
503
- VPC: params.vpc
504
- });
505
- return {
506
- hostedZone: result.HostedZone,
507
- nameServers: result.DelegationSet.NameServers,
508
- isNew: true
509
- };
510
- }
511
- static getRootDomain(domain) {
512
- const parts = domain.replace(/\.$/, "").split(".");
513
- if (parts.length <= 2) {
514
- return domain;
515
- }
516
- return parts.slice(-2).join(".");
517
- }
518
- async findHostedZoneForDomain(domain) {
519
- const normalizedDomain = domain.replace(/\.$/, "");
520
- const parts = normalizedDomain.split(".");
521
- for (let i = 0;i < parts.length - 1; i++) {
522
- const testDomain = parts.slice(i).join(".");
523
- const zone = await this.findHostedZoneByName(testDomain);
524
- if (zone) {
525
- return zone;
526
- }
527
- }
528
- return null;
529
- }
530
- async ensureHostedZone(params) {
531
- const result = await this.findOrCreateHostedZone({
532
- domainName: params.domainName,
533
- comment: params.comment
534
- });
535
- const hostedZoneId = result.hostedZone.Id.replace("/hostedzone/", "");
536
- return {
537
- hostedZoneId,
538
- nameServers: result.nameServers,
539
- isNew: result.isNew,
540
- action: result.isNew ? "created" : "found"
541
- };
542
- }
543
- async setupDomainDns(params) {
544
- const { domain, createIfNotExists = true } = params;
545
- const existing = await this.findHostedZoneByName(domain);
546
- if (existing) {
547
- const zoneDetails = await this.getHostedZone({ Id: existing.Id });
548
- return {
549
- success: true,
550
- hostedZoneId: existing.Id.replace("/hostedzone/", ""),
551
- nameServers: zoneDetails.DelegationSet.NameServers,
552
- isNew: false,
553
- message: `Found existing hosted zone for ${domain}`
554
- };
555
- }
556
- if (!createIfNotExists) {
557
- return {
558
- success: false,
559
- hostedZoneId: null,
560
- nameServers: [],
561
- isNew: false,
562
- message: `No hosted zone found for ${domain} and createIfNotExists is false`
563
- };
564
- }
565
- const result = await this.createHostedZone({
566
- Name: domain,
567
- HostedZoneConfig: {
568
- Comment: `Created automatically by ts-cloud for ${domain}`
569
- }
570
- });
571
- return {
572
- success: true,
573
- hostedZoneId: result.HostedZone.Id.replace("/hostedzone/", ""),
574
- nameServers: result.DelegationSet.NameServers,
575
- isNew: true,
576
- message: `Created new hosted zone for ${domain}. Please update your domain registrar with these name servers: ${result.DelegationSet.NameServers.join(", ")}`
577
- };
578
- }
579
- static CloudFrontHostedZoneId = "Z2FDTNDATAQYW2";
580
- static S3WebsiteHostedZoneIds = {
581
- "us-east-1": "Z3AQBSTGFYJSTF",
582
- "us-east-2": "Z2O1EMRO9K5GLX",
583
- "us-west-1": "Z2F56UZL2M1ACD",
584
- "us-west-2": "Z3BJ6K6RIION7M",
585
- "ap-east-1": "ZNB98KWMFR0R6",
586
- "ap-south-1": "Z11RGJOFQNVJUP",
587
- "ap-northeast-1": "Z2M4EHUR26P7ZW",
588
- "ap-northeast-2": "Z3W03O7B5YMIYP",
589
- "ap-northeast-3": "Z2YQB5RD63NC85",
590
- "ap-southeast-1": "Z3O0J2DXBE1FTB",
591
- "ap-southeast-2": "Z1WCIGYICN2BYD",
592
- "ca-central-1": "Z1QDHH18159H29",
593
- "eu-central-1": "Z21DNDUVLTQW6Q",
594
- "eu-west-1": "Z1BKCTXD74EZPE",
595
- "eu-west-2": "Z3GKZC51ZF0DB4",
596
- "eu-west-3": "Z3R1K369G5AVDG",
597
- "eu-north-1": "Z3BAZG2TWCNX0D",
598
- "sa-east-1": "Z7KQH4QJS55SO"
599
- };
600
- static ALBHostedZoneIds = {
601
- "us-east-1": "Z35SXDOTRQ7X7K",
602
- "us-east-2": "Z3AADJGX6KTTL2",
603
- "us-west-1": "Z368ELLRRE2KJ0",
604
- "us-west-2": "Z1H1FL5HABSF5",
605
- "ap-east-1": "Z3DQVH9N71FHZ0",
606
- "ap-south-1": "ZP97RAFLXTNZK",
607
- "ap-northeast-1": "Z14GRHDCWA56QT",
608
- "ap-northeast-2": "ZWKZPGTI48KDX",
609
- "ap-northeast-3": "Z5LXEBD8Y73MNV",
610
- "ap-southeast-1": "Z1LMS91P8CMLE5",
611
- "ap-southeast-2": "Z1GM3OXH4ZPM65",
612
- "ca-central-1": "ZQSVJUPU6J1EY",
613
- "eu-central-1": "Z215JYRZR1TBD5",
614
- "eu-west-1": "Z32O12XQLNTSW2",
615
- "eu-west-2": "ZHURV8PSTC4K8",
616
- "eu-west-3": "Z3Q77PNBQS71R4",
617
- "eu-north-1": "Z23TAZ6LKFMNIO",
618
- "sa-east-1": "Z2P70J7HTTTPLU"
619
- };
620
- static APIGatewayHostedZoneIds = {
621
- "us-east-1": "Z1UJRXOUMOOFQ8",
622
- "us-east-2": "ZOJJZC49E0EPZ",
623
- "us-west-1": "Z2MUQ32089INYE",
624
- "us-west-2": "Z2OJLYMUO9EFXC",
625
- "ap-east-1": "Z3FD1VL90ND7K5",
626
- "ap-south-1": "Z3VO1THU9YC4UR",
627
- "ap-northeast-1": "Z1YSHQZHG15GKL",
628
- "ap-northeast-2": "Z20JF4UZKIW1U8",
629
- "ap-northeast-3": "Z2YQB5RD63NC85",
630
- "ap-southeast-1": "ZL327KTPIQFUL",
631
- "ap-southeast-2": "Z2RPCDW04V8134",
632
- "ca-central-1": "Z19DQILCV0OWEC",
633
- "eu-central-1": "Z1U9ULNL0V5AJ3",
634
- "eu-west-1": "ZLY8HYME6SFDD",
635
- "eu-west-2": "ZJ5UAJN8Y3Z2Q",
636
- "eu-west-3": "Z3KY65QIEKYHQQ",
637
- "eu-north-1": "Z3UWIKFBOOGXPP",
638
- "sa-east-1": "ZCMLWB8V5SYIT"
639
- };
640
- }
641
-
642
- export { Route53Client };