@stacksjs/ts-cloud 0.9.3 → 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 (143) hide show
  1. package/dist/aws/index.js +1 -269
  2. package/dist/bin/chunk-00kg80qg.js +1 -0
  3. package/dist/bin/{chunk-hzqw8xm5.js → chunk-1k5kszjp.js} +1 -1
  4. package/dist/bin/{chunk-9v39615t.js → chunk-21e0mavm.js} +1 -1
  5. package/dist/bin/{chunk-waayf9ay.js → chunk-2empps47.js} +1 -1
  6. package/dist/bin/{chunk-14cwr6eh.js → chunk-3vqfexc4.js} +1 -1
  7. package/dist/bin/chunk-5ectjq0b.js +1 -0
  8. package/dist/bin/{chunk-b5gd39s8.js → chunk-5erkxpt7.js} +4 -4
  9. package/dist/bin/{chunk-41x17hw1.js → chunk-5mrtzemj.js} +1 -1
  10. package/dist/bin/{chunk-p8q9bq9g.js → chunk-5n9fmabb.js} +1 -1
  11. package/dist/bin/{chunk-gqf6jsmy.js → chunk-9knpg30y.js} +1 -1
  12. package/dist/bin/{chunk-r3kv0vm9.js → chunk-ddk4rt4j.js} +1 -1
  13. package/dist/bin/{chunk-avm7tnwe.js → chunk-e0rkrq70.js} +1 -1
  14. package/dist/bin/{chunk-ry030a6b.js → chunk-etrb03mt.js} +1 -1
  15. package/dist/bin/{chunk-8v7ddyvf.js → chunk-k9t9wvms.js} +1 -1
  16. package/dist/bin/{chunk-92mea34a.js → chunk-m7dgskt1.js} +1 -1
  17. package/dist/bin/{chunk-3r4fb59r.js → chunk-mz0wbbsj.js} +1 -1
  18. package/dist/bin/{chunk-b9qbp8j1.js → chunk-qk9qgepa.js} +1 -1
  19. package/dist/bin/chunk-rxcvf10f.js +7364 -0
  20. package/dist/bin/{chunk-r9hjwcj9.js → chunk-tga3hhwk.js} +1 -1
  21. package/dist/bin/{chunk-ynjvbphf.js → chunk-tx0tqq2k.js} +1 -1
  22. package/dist/bin/{chunk-57y1zxbf.js → chunk-vm3q5gf2.js} +1 -1
  23. package/dist/bin/{chunk-bz828v8q.js → chunk-y7s5r8y6.js} +1 -1
  24. package/dist/bin/{chunk-sgyffpgm.js → chunk-zmegvjp8.js} +1 -1
  25. package/dist/bin/cli.js +14 -14
  26. package/dist/bin/dashboard-server.js +1 -1
  27. package/dist/chunk-0ccta6z6.js +6 -0
  28. package/dist/chunk-0k1cs6pp.js +1 -0
  29. package/dist/chunk-1egjn203.js +704 -0
  30. package/dist/chunk-2wx29qga.js +5 -0
  31. package/dist/chunk-5m5rqmv7.js +1 -0
  32. package/dist/chunk-8ea5022g.js +114 -0
  33. package/dist/chunk-8xqn3c0w.js +2 -0
  34. package/dist/chunk-b4esxhmw.js +2 -0
  35. package/dist/chunk-b8e5wzwn.js +44 -0
  36. package/dist/chunk-bggt4n6e.js +2 -0
  37. package/dist/chunk-cwkg37rs.js +37 -0
  38. package/dist/chunk-dskvqt67.js +7355 -0
  39. package/dist/chunk-gahsdmxf.js +1617 -0
  40. package/dist/chunk-gnv3r2jg.js +1 -0
  41. package/dist/chunk-hg3c48cp.js +34 -0
  42. package/dist/chunk-m5azeva3.js +2 -0
  43. package/dist/chunk-r3qf56b3.js +92 -0
  44. package/dist/chunk-sdqa9ghv.js +141 -0
  45. package/dist/chunk-svrvvcm7.js +1 -0
  46. package/dist/chunk-v0p3hpc3.js +60 -0
  47. package/dist/chunk-wdzjbecg.js +50 -0
  48. package/dist/chunk-ww8k3g7j.js +1 -0
  49. package/dist/chunk-xmqfc62w.js +1 -0
  50. package/dist/chunk-xrebj679.js +435 -0
  51. package/dist/chunk-xt3s24vr.js +2 -0
  52. package/dist/chunk-y21zk0pn.js +4 -0
  53. package/dist/deploy/index.js +1 -168
  54. package/dist/dns/index.js +1 -41
  55. package/dist/drivers/index.js +1 -154
  56. package/dist/index.js +100 -6129
  57. package/dist/protection/index.js +1 -89
  58. package/dist/push/index.js +1 -509
  59. package/dist/spend/index.js +1 -173
  60. package/dist/ui/404.html +1 -1
  61. package/dist/ui/accept-invitation.html +1 -1
  62. package/dist/ui/access-denied.html +1 -1
  63. package/dist/ui/account/automation.html +6 -6
  64. package/dist/ui/account/security.html +2 -2
  65. package/dist/ui/applications/compose.html +6 -6
  66. package/dist/ui/applications/new.html +2 -2
  67. package/dist/ui/data/backups.html +5 -5
  68. package/dist/ui/data/services.html +5 -5
  69. package/dist/ui/data/volumes.html +6 -6
  70. package/dist/ui/index.html +6 -6
  71. package/dist/ui/infrastructure/topology.html +5 -5
  72. package/dist/ui/integrations.html +1 -1
  73. package/dist/ui/operations/alerts.html +5 -5
  74. package/dist/ui/operations/configuration.html +5 -5
  75. package/dist/ui/operations/jobs.html +5 -5
  76. package/dist/ui/operations/maintenance.html +5 -5
  77. package/dist/ui/operations/observability.html +6 -6
  78. package/dist/ui/operations/previews.html +6 -6
  79. package/dist/ui/operations/queue.html +6 -6
  80. package/dist/ui/operations/regions.html +6 -6
  81. package/dist/ui/operations/releases.html +6 -6
  82. package/dist/ui/operations/spend.html +6 -6
  83. package/dist/ui/operations/workloads.html +6 -6
  84. package/dist/ui/security.html +1 -1
  85. package/dist/ui/server/actions.html +5 -5
  86. package/dist/ui/server/activity.html +1 -1
  87. package/dist/ui/server/capacity.html +6 -6
  88. package/dist/ui/server/database.html +6 -6
  89. package/dist/ui/server/deployments.html +6 -6
  90. package/dist/ui/server/diagnostics.html +2 -2
  91. package/dist/ui/server/firewall.html +6 -6
  92. package/dist/ui/server/fleet.html +6 -6
  93. package/dist/ui/server/logs.html +6 -6
  94. package/dist/ui/server/metrics.html +6 -6
  95. package/dist/ui/server/security.html +2 -2
  96. package/dist/ui/server/services.html +1 -1
  97. package/dist/ui/server/sites.html +6 -6
  98. package/dist/ui/server/ssh-keys.html +6 -6
  99. package/dist/ui/server/team.html +6 -6
  100. package/dist/ui/server/terminal.html +1 -1
  101. package/dist/ui/serverless/alarms.html +5 -5
  102. package/dist/ui/serverless/assets.html +2 -2
  103. package/dist/ui/serverless/cost.html +1 -1
  104. package/dist/ui/serverless/data.html +6 -6
  105. package/dist/ui/serverless/deployments.html +2 -2
  106. package/dist/ui/serverless/firewall.html +1 -1
  107. package/dist/ui/serverless/functions.html +6 -6
  108. package/dist/ui/serverless/logs.html +6 -6
  109. package/dist/ui/serverless/metrics.html +2 -2
  110. package/dist/ui/serverless/queues.html +6 -6
  111. package/dist/ui/serverless/secrets.html +6 -6
  112. package/dist/ui/serverless/traces.html +6 -6
  113. package/dist/ui/serverless.html +5 -5
  114. package/package.json +3 -3
  115. package/dist/bin/chunk-jpjamjey.js +0 -6935
  116. package/dist/bin/chunk-m2zwtapr.js +0 -1
  117. package/dist/bin/chunk-rtczra13.js +0 -1
  118. package/dist/chunk-01d86gt1.js +0 -1324
  119. package/dist/chunk-050r7ycy.js +0 -46516
  120. package/dist/chunk-1c8dbv57.js +0 -7278
  121. package/dist/chunk-29rse4p1.js +0 -12203
  122. package/dist/chunk-32e7ya18.js +0 -642
  123. package/dist/chunk-4cjrg98a.js +0 -597
  124. package/dist/chunk-50jpda9q.js +0 -371
  125. package/dist/chunk-6a1t7fnq.js +0 -12121
  126. package/dist/chunk-728jvrr0.js +0 -1701
  127. package/dist/chunk-7m60qnc8.js +0 -1762
  128. package/dist/chunk-aa2dkn7b.js +0 -205
  129. package/dist/chunk-d48vtdj4.js +0 -433
  130. package/dist/chunk-f55nkpvb.js +0 -8
  131. package/dist/chunk-fgk8cqew.js +0 -152
  132. package/dist/chunk-he9a874b.js +0 -769
  133. package/dist/chunk-k2yyatfw.js +0 -10
  134. package/dist/chunk-k4px0bnv.js +0 -23
  135. package/dist/chunk-nsgqsmrh.js +0 -1779
  136. package/dist/chunk-q0st3se8.js +0 -42033
  137. package/dist/chunk-qr803fye.js +0 -2122
  138. package/dist/chunk-rds0sy87.js +0 -1771
  139. package/dist/chunk-ttz2ra5j.js +0 -12
  140. package/dist/chunk-v0bahtg2.js +0 -4
  141. package/dist/chunk-va2yd85b.js +0 -200
  142. package/dist/chunk-x9s0cqfx.js +0 -13
  143. 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 };