@wraps.dev/cli 3.6.0 → 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -30520,20 +30520,21 @@ async function checkVercelDomain(token, domain, teamId) {
30520
30520
  }
30521
30521
  }
30522
30522
  async function validateCloudflareCredentials(token) {
30523
- try {
30524
- const response = await fetch(
30525
- "https://api.cloudflare.com/client/v4/user/tokens/verify",
30526
- {
30527
- headers: {
30528
- Authorization: `Bearer ${token}`
30529
- }
30530
- }
30531
- );
30532
- const data = await response.json();
30533
- return data.success === true;
30534
- } catch {
30535
- return false;
30523
+ const probe = async (url) => {
30524
+ try {
30525
+ const response = await fetch(url, {
30526
+ headers: { Authorization: `Bearer ${token}` }
30527
+ });
30528
+ const data = await response.json();
30529
+ return data.success === true;
30530
+ } catch {
30531
+ return false;
30532
+ }
30533
+ };
30534
+ if (await probe("https://api.cloudflare.com/client/v4/user/tokens/verify")) {
30535
+ return true;
30536
30536
  }
30537
+ return probe("https://api.cloudflare.com/client/v4/zones?per_page=1");
30537
30538
  }
30538
30539
  async function findCloudflareZoneId(token, domain) {
30539
30540
  try {
@@ -45206,19 +45207,18 @@ async function provisionTrackingHttps(args) {
45206
45207
  );
45207
45208
  if (cert.status !== "ISSUED") {
45208
45209
  const dnsRecordsToShow = [];
45210
+ let validationRecordPushed = false;
45209
45211
  if (cert.validationRecord) {
45210
45212
  dnsRecordsToShow.push(cert.validationRecord);
45211
45213
  if (metadataDnsProvider && metadataDnsProvider !== "manual") {
45212
- await progress.execute(
45214
+ validationRecordPushed = await progress.execute(
45213
45215
  "Creating ACM validation DNS record",
45214
- async () => {
45215
- await pushValidationRecord(
45216
- metadataDnsProvider,
45217
- domain,
45218
- sesRegion,
45219
- cert.validationRecord
45220
- );
45221
- }
45216
+ async () => pushValidationRecord(
45217
+ metadataDnsProvider,
45218
+ domain,
45219
+ sesRegion,
45220
+ cert.validationRecord
45221
+ )
45222
45222
  );
45223
45223
  }
45224
45224
  }
@@ -45229,7 +45229,8 @@ async function provisionTrackingHttps(args) {
45229
45229
  validationRecord: cert.validationRecord
45230
45230
  },
45231
45231
  cnameTarget: awstrackTarget,
45232
- dnsRecordsToShow
45232
+ dnsRecordsToShow,
45233
+ validationRecordPushed
45233
45234
  };
45234
45235
  }
45235
45236
  const distribution = await progress.execute(
@@ -45252,7 +45253,8 @@ async function provisionTrackingHttps(args) {
45252
45253
  distributionDomain: distribution.domainName
45253
45254
  },
45254
45255
  cnameTarget: distribution.domainName,
45255
- dnsRecordsToShow: []
45256
+ dnsRecordsToShow: [],
45257
+ validationRecordPushed: true
45256
45258
  };
45257
45259
  }
45258
45260
 
@@ -45924,6 +45926,7 @@ async function offerTrackingCname(ctx, trackingDomain, cnameTarget, replaceExist
45924
45926
  value: targetValue
45925
45927
  };
45926
45928
  const provider = ctx.metadata.services.email?.dnsProvider;
45929
+ let degradedReason;
45927
45930
  if (provider && provider !== "manual") {
45928
45931
  const parts = ctx.candidate.domain.split(".");
45929
45932
  const rootDomain = parts.length > 2 ? parts.slice(-2).join(".") : ctx.candidate.domain;
@@ -45947,8 +45950,14 @@ async function offerTrackingCname(ctx, trackingDomain, cnameTarget, replaceExist
45947
45950
  );
45948
45951
  return;
45949
45952
  }
45953
+ degradedReason = result.errors?.join("; ") ?? `${getDNSProviderDisplayName(provider)} created no record`;
45954
+ } else {
45955
+ degradedReason = cred.error ?? `${getDNSProviderDisplayName(provider)} credentials`;
45950
45956
  }
45951
45957
  }
45958
+ if (degradedReason) {
45959
+ clack24.log.warn(`Could not update DNS automatically: ${degradedReason}`);
45960
+ }
45952
45961
  clack24.log.info(
45953
45962
  `Add this DNS record:
45954
45963
  ${pc26.cyan(record.name)}
@@ -46010,7 +46019,10 @@ async function applyTrackingHttps(ctx, enable) {
46010
46019
  if (result.trackingHttps.status === "active" && !wasActive) {
46011
46020
  await offerTrackingCname(ctx, trackingDomain, result.cnameTarget, true);
46012
46021
  }
46013
- return { pendingValidationRecord: result.dnsRecordsToShow[0] };
46022
+ return {
46023
+ pendingValidationRecord: result.dnsRecordsToShow[0],
46024
+ validationRecordPushed: result.validationRecordPushed
46025
+ };
46014
46026
  }
46015
46027
  async function applyFlagMode(args) {
46016
46028
  const {
@@ -46183,7 +46195,7 @@ async function applyFlagMode(args) {
46183
46195
  );
46184
46196
  if (httpsResult.pendingValidationRecord) {
46185
46197
  clack24.log.info(
46186
- `Add this DNS record to validate the certificate:
46198
+ `${httpsResult.validationRecordPushed ? "Certificate validation record (created for you):" : "Add this DNS record to validate the certificate:"}
46187
46199
  ${pc26.cyan(httpsResult.pendingValidationRecord.name)}
46188
46200
  Type: ${httpsResult.pendingValidationRecord.type} Value: ${httpsResult.pendingValidationRecord.value}`
46189
46201
  );
@@ -46393,7 +46405,7 @@ async function applyInteractiveMode(args) {
46393
46405
  );
46394
46406
  if (httpsResult.pendingValidationRecord) {
46395
46407
  clack24.log.info(
46396
- `Add this DNS record to validate the certificate:
46408
+ `${httpsResult.validationRecordPushed ? "Certificate validation record (created for you):" : "Add this DNS record to validate the certificate:"}
46397
46409
  ${pc26.cyan(httpsResult.pendingValidationRecord.name)}
46398
46410
  Type: ${httpsResult.pendingValidationRecord.type} Value: ${httpsResult.pendingValidationRecord.value}`
46399
46411
  );
@@ -47396,7 +47408,9 @@ Run ${pc27.cyan("wraps email init")} first to deploy email infrastructure.
47396
47408
  progress.stop();
47397
47409
  console.log();
47398
47410
  clack25.log.info(
47399
- pc27.bold("Add this DNS record to validate the certificate:")
47411
+ pc27.bold(
47412
+ trackingHttpsResult.validationRecordPushed ? "Certificate validation record (created for you):" : "Add this DNS record to validate the certificate:"
47413
+ )
47400
47414
  );
47401
47415
  console.log();
47402
47416
  for (const record of trackingHttpsResult.dnsRecordsToShow) {