@stacksjs/ts-cloud 0.9.2 → 0.9.4

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 (191) hide show
  1. package/dist/aws/index.js +1 -269
  2. package/dist/bin/chunk-00kg80qg.js +1 -0
  3. package/dist/bin/chunk-09nwf2gy.js +34 -0
  4. package/dist/bin/chunk-1k5kszjp.js +111 -0
  5. package/dist/bin/chunk-21e0mavm.js +1 -0
  6. package/dist/bin/chunk-271gk1n2.js +6 -0
  7. package/dist/bin/chunk-2empps47.js +2 -0
  8. package/dist/bin/chunk-38pq971s.js +2 -0
  9. package/dist/bin/chunk-3gykfyq4.js +37 -0
  10. package/dist/bin/chunk-3vqfexc4.js +70 -0
  11. package/dist/bin/chunk-4vrqm9h0.js +2 -0
  12. package/dist/bin/chunk-598yf4bs.js +1 -0
  13. package/dist/bin/chunk-5ectjq0b.js +1 -0
  14. package/dist/bin/chunk-5erkxpt7.js +512 -0
  15. package/dist/bin/chunk-5mrtzemj.js +1 -0
  16. package/dist/bin/chunk-5n9fmabb.js +1 -0
  17. package/dist/bin/chunk-9knpg30y.js +1 -0
  18. package/dist/bin/chunk-9pvsff8g.js +1 -0
  19. package/dist/bin/chunk-ax9mr6wm.js +44 -0
  20. package/dist/bin/chunk-axhnkn5g.js +2 -0
  21. package/dist/bin/chunk-c1vcdgvr.js +1 -0
  22. package/dist/bin/chunk-ctd2vg9w.js +2 -0
  23. package/dist/bin/chunk-dbgffky8.js +1 -0
  24. package/dist/bin/chunk-ddk4rt4j.js +6 -0
  25. package/dist/bin/chunk-dwr30vbv.js +1 -0
  26. package/dist/bin/chunk-e0rkrq70.js +1 -0
  27. package/dist/bin/chunk-e3xrwh9z.js +1 -0
  28. package/dist/bin/chunk-etrb03mt.js +1507 -0
  29. package/dist/bin/chunk-fhc6ntvd.js +2 -0
  30. package/dist/bin/chunk-fpm59y25.js +6 -0
  31. package/dist/bin/chunk-fvbxvq6b.js +1 -0
  32. package/dist/bin/chunk-fy8j3y8p.js +92 -0
  33. package/dist/bin/chunk-fz21b57w.js +1 -0
  34. package/dist/bin/chunk-gavvf0pg.js +141 -0
  35. package/dist/bin/chunk-ggn7ax8p.js +4 -0
  36. package/dist/bin/chunk-gpe2prkm.js +1 -0
  37. package/dist/bin/chunk-h5pa5men.js +2 -0
  38. package/dist/bin/chunk-hm08xdxf.js +2 -0
  39. package/dist/bin/chunk-hzgz13nf.js +1 -0
  40. package/dist/bin/chunk-j703btc5.js +50 -0
  41. package/dist/bin/chunk-k9t9wvms.js +1 -0
  42. package/dist/bin/chunk-m669wtgr.js +1 -0
  43. package/dist/bin/chunk-m7dgskt1.js +1 -0
  44. package/dist/bin/chunk-mh0kdzqp.js +2 -0
  45. package/dist/bin/chunk-mr0atd2s.js +2 -0
  46. package/dist/bin/chunk-mz0wbbsj.js +3 -0
  47. package/dist/bin/chunk-ngcyftm2.js +1 -0
  48. package/dist/bin/chunk-p66ptpmr.js +2 -0
  49. package/dist/bin/chunk-qk9qgepa.js +1 -0
  50. package/dist/bin/chunk-rxcvf10f.js +7364 -0
  51. package/dist/bin/chunk-rytk89az.js +60 -0
  52. package/dist/bin/chunk-tga3hhwk.js +6 -0
  53. package/dist/bin/chunk-tx0tqq2k.js +8 -0
  54. package/dist/bin/chunk-vek8a0w6.js +1 -0
  55. package/dist/bin/chunk-vm3q5gf2.js +3 -0
  56. package/dist/bin/chunk-y7s5r8y6.js +3 -0
  57. package/dist/bin/chunk-yv9sth30.js +1 -0
  58. package/dist/bin/chunk-zmegvjp8.js +581 -0
  59. package/dist/bin/cli.js +417 -10597
  60. package/dist/bin/dashboard-server.js +1 -6998
  61. package/dist/chunk-0ccta6z6.js +6 -0
  62. package/dist/chunk-0k1cs6pp.js +1 -0
  63. package/dist/chunk-1egjn203.js +704 -0
  64. package/dist/chunk-2wx29qga.js +5 -0
  65. package/dist/chunk-5m5rqmv7.js +1 -0
  66. package/dist/chunk-8ea5022g.js +114 -0
  67. package/dist/chunk-8xqn3c0w.js +2 -0
  68. package/dist/chunk-b4esxhmw.js +2 -0
  69. package/dist/chunk-b8e5wzwn.js +44 -0
  70. package/dist/chunk-bggt4n6e.js +2 -0
  71. package/dist/chunk-cwkg37rs.js +37 -0
  72. package/dist/chunk-dskvqt67.js +7355 -0
  73. package/dist/chunk-gahsdmxf.js +1617 -0
  74. package/dist/chunk-gnv3r2jg.js +1 -0
  75. package/dist/chunk-hg3c48cp.js +34 -0
  76. package/dist/chunk-m5azeva3.js +2 -0
  77. package/dist/chunk-r3qf56b3.js +92 -0
  78. package/dist/chunk-sdqa9ghv.js +141 -0
  79. package/dist/chunk-svrvvcm7.js +1 -0
  80. package/dist/chunk-v0p3hpc3.js +60 -0
  81. package/dist/chunk-wdzjbecg.js +50 -0
  82. package/dist/chunk-ww8k3g7j.js +1 -0
  83. package/dist/chunk-xmqfc62w.js +1 -0
  84. package/dist/chunk-xrebj679.js +435 -0
  85. package/dist/chunk-xt3s24vr.js +2 -0
  86. package/dist/chunk-y21zk0pn.js +4 -0
  87. package/dist/deploy/attach-credentials.d.ts +57 -0
  88. package/dist/deploy/index.js +1 -168
  89. package/dist/deploy/site-ports.d.ts +151 -0
  90. package/dist/deploy/site-target.d.ts +24 -1
  91. package/dist/dns/index.js +1 -41
  92. package/dist/drivers/index.js +1 -154
  93. package/dist/index.js +100 -6129
  94. package/dist/protection/index.js +1 -89
  95. package/dist/push/index.js +1 -509
  96. package/dist/spend/index.js +1 -173
  97. package/dist/ui/404.html +16 -548
  98. package/dist/ui/_stx/chunk.5ddb5087.js +90 -0
  99. package/dist/ui/_stx/chunk.9fd39d5b.js +86 -0
  100. package/dist/ui/_stx/chunk.d5301f79.js +119 -0
  101. package/dist/ui/_stx/crosswind.222ed683.css +1 -0
  102. package/dist/ui/_stx/crosswind.616c25f3.css +1 -0
  103. package/dist/ui/_stx/crosswind.80baa894.css +320 -0
  104. package/dist/ui/_stx/crosswind.906ee17c.css +1 -0
  105. package/dist/ui/_stx/crosswind.996ed49e.css +1 -0
  106. package/dist/ui/_stx/crosswind.b7a99a5c.css +1 -0
  107. package/dist/ui/_stx/router.fa5bc4dc.js +4 -0
  108. package/dist/ui/_stx/runtime.c696d17a.js +1 -0
  109. package/dist/ui/_stx/style.448ab192.css +1 -0
  110. package/dist/ui/accept-invitation.html +2 -1133
  111. package/dist/ui/access-denied.html +7 -1130
  112. package/dist/ui/account/automation.html +12 -1134
  113. package/dist/ui/account/security.html +13 -1136
  114. package/dist/ui/applications/compose.html +12 -1134
  115. package/dist/ui/applications/new.html +13 -1137
  116. package/dist/ui/data/backups.html +91 -1136
  117. package/dist/ui/data/services.html +89 -1136
  118. package/dist/ui/data/volumes.html +61 -1136
  119. package/dist/ui/index.html +60 -1136
  120. package/dist/ui/infrastructure/topology.html +128 -1135
  121. package/dist/ui/integrations.html +13 -1138
  122. package/dist/ui/operations/alerts.html +59 -1136
  123. package/dist/ui/operations/configuration.html +13 -1135
  124. package/dist/ui/operations/jobs.html +87 -1136
  125. package/dist/ui/operations/maintenance.html +12 -1134
  126. package/dist/ui/operations/observability.html +93 -1136
  127. package/dist/ui/operations/previews.html +12 -1134
  128. package/dist/ui/operations/queue.html +12 -1134
  129. package/dist/ui/operations/regions.html +12 -1134
  130. package/dist/ui/operations/releases.html +12 -1134
  131. package/dist/ui/operations/spend.html +65 -1136
  132. package/dist/ui/operations/workloads.html +115 -1136
  133. package/dist/ui/robots.txt +2 -0
  134. package/dist/ui/security.html +24 -1136
  135. package/dist/ui/server/actions.html +67 -1138
  136. package/dist/ui/server/activity.html +7 -1130
  137. package/dist/ui/server/capacity.html +12 -1134
  138. package/dist/ui/server/database.html +166 -1135
  139. package/dist/ui/server/deployments.html +60 -1136
  140. package/dist/ui/server/diagnostics.html +7 -1130
  141. package/dist/ui/server/firewall.html +286 -1212
  142. package/dist/ui/server/fleet.html +45 -1136
  143. package/dist/ui/server/logs.html +34 -1135
  144. package/dist/ui/server/metrics.html +124 -1140
  145. package/dist/ui/server/security.html +7 -1130
  146. package/dist/ui/server/services.html +46 -1133
  147. package/dist/ui/server/sites.html +287 -1137
  148. package/dist/ui/server/ssh-keys.html +62 -1135
  149. package/dist/ui/server/team.html +155 -1136
  150. package/dist/ui/server/terminal.html +97 -1183
  151. package/dist/ui/serverless/alarms.html +62 -1135
  152. package/dist/ui/serverless/assets.html +47 -1132
  153. package/dist/ui/serverless/cost.html +7 -1130
  154. package/dist/ui/serverless/data.html +46 -1135
  155. package/dist/ui/serverless/deployments.html +47 -1132
  156. package/dist/ui/serverless/firewall.html +7 -1130
  157. package/dist/ui/serverless/functions.html +50 -1136
  158. package/dist/ui/serverless/logs.html +34 -1135
  159. package/dist/ui/serverless/metrics.html +7 -1130
  160. package/dist/ui/serverless/queues.html +58 -1135
  161. package/dist/ui/serverless/secrets.html +62 -1136
  162. package/dist/ui/serverless/traces.html +12 -1134
  163. package/dist/ui/serverless.html +64 -1137
  164. package/dist/ui-src/pages/server/firewall.stx +14 -14
  165. package/package.json +3 -3
  166. package/dist/chunk-01d86gt1.js +0 -1324
  167. package/dist/chunk-050r7ycy.js +0 -46516
  168. package/dist/chunk-29rse4p1.js +0 -12203
  169. package/dist/chunk-32e7ya18.js +0 -642
  170. package/dist/chunk-4cjrg98a.js +0 -597
  171. package/dist/chunk-50jpda9q.js +0 -371
  172. package/dist/chunk-6a1t7fnq.js +0 -12121
  173. package/dist/chunk-728jvrr0.js +0 -1701
  174. package/dist/chunk-7m60qnc8.js +0 -1762
  175. package/dist/chunk-aa2dkn7b.js +0 -205
  176. package/dist/chunk-d48vtdj4.js +0 -433
  177. package/dist/chunk-f55nkpvb.js +0 -8
  178. package/dist/chunk-fgk8cqew.js +0 -152
  179. package/dist/chunk-he9a874b.js +0 -769
  180. package/dist/chunk-hg7rhrgd.js +0 -7274
  181. package/dist/chunk-k2yyatfw.js +0 -10
  182. package/dist/chunk-k4px0bnv.js +0 -23
  183. package/dist/chunk-nsgqsmrh.js +0 -1779
  184. package/dist/chunk-qr803fye.js +0 -2122
  185. package/dist/chunk-rds0sy87.js +0 -1771
  186. package/dist/chunk-rxgchb08.js +0 -42033
  187. package/dist/chunk-ttz2ra5j.js +0 -12
  188. package/dist/chunk-v0bahtg2.js +0 -4
  189. package/dist/chunk-va2yd85b.js +0 -200
  190. package/dist/chunk-x9s0cqfx.js +0 -13
  191. 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 };