@hot-updater/aws 0.21.6 → 0.21.7

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.
@@ -7678,12 +7678,16 @@ var CloudFrontManager = class {
7678
7678
  try {
7679
7679
  const existingOac = (await cloudfrontClient.listOriginAccessControls({})).OriginAccessControlList?.Items?.find((oac) => oac.Name === "HotUpdaterOAC");
7680
7680
  if (existingOac?.Id) oacId = existingOac.Id;
7681
- else oacId = (await cloudfrontClient.createOriginAccessControl({ OriginAccessControlConfig: {
7682
- Name: "HotUpdaterOAC",
7683
- OriginAccessControlOriginType: "s3",
7684
- SigningBehavior: "always",
7685
- SigningProtocol: "sigv4"
7686
- } })).OriginAccessControl?.Id;
7681
+ else {
7682
+ const createOacResp = await cloudfrontClient.createOriginAccessControl({ OriginAccessControlConfig: {
7683
+ Name: "HotUpdaterOAC",
7684
+ OriginAccessControlOriginType: "s3",
7685
+ SigningBehavior: "always",
7686
+ SigningProtocol: "sigv4"
7687
+ } });
7688
+ if (!createOacResp.OriginAccessControl?.Id) throw new Error("Failed to create Origin Access Control: No ID returned");
7689
+ oacId = createOacResp.OriginAccessControl.Id;
7690
+ }
7687
7691
  } catch {
7688
7692
  throw new Error("Failed to get or create Origin Access Control");
7689
7693
  }
@@ -8009,8 +8013,9 @@ var CloudFrontManager = class {
8009
8013
  };
8010
8014
  try {
8011
8015
  const distResp = await cloudfrontClient.createDistribution({ DistributionConfig: finalDistributionConfig });
8012
- const distributionId = distResp.Distribution?.Id;
8013
- const distributionDomain = distResp.Distribution?.DomainName;
8016
+ if (!distResp.Distribution?.Id || !distResp.Distribution?.DomainName) throw new Error("Failed to create CloudFront distribution: No ID or DomainName returned");
8017
+ const distributionId = distResp.Distribution.Id;
8018
+ const distributionDomain = distResp.Distribution.DomainName;
8014
8019
  f.success(`Created new CloudFront distribution. Distribution ID: ${distributionId}`);
8015
8020
  let retryCount = 0;
8016
8021
  await Te([{
@@ -8092,11 +8097,13 @@ var IAMManager = class {
8092
8097
  }
8093
8098
  } catch {
8094
8099
  try {
8095
- const lambdaRoleArn = (await iamClient.createRole({
8100
+ const createRoleResp = await iamClient.createRole({
8096
8101
  RoleName: roleName,
8097
8102
  AssumeRolePolicyDocument: assumeRolePolicyDocument,
8098
8103
  Description: "Role for Lambda@Edge to access S3 and SSM"
8099
- })).Role?.Arn;
8104
+ });
8105
+ if (!createRoleResp.Role?.Arn) throw new Error("Failed to create IAM role: No ARN returned");
8106
+ const lambdaRoleArn = createRoleResp.Role.Arn;
8100
8107
  f.info(`Created IAM role: ${roleName} (${lambdaRoleArn})`);
8101
8108
  await iamClient.attachRolePolicy({
8102
8109
  RoleName: roleName,
@@ -8945,7 +8952,7 @@ const runInit = async ({ build }) => {
8945
8952
  f.success("Generated 'hot-updater.config.ts' file with AWS settings.");
8946
8953
  const sourceUrl = `https://${distributionDomain}/api/check-update`;
8947
8954
  Me((0, __hot_updater_plugin_core.transformTemplate)(SOURCE_TEMPLATE, { source: sourceUrl }));
8948
- f.message(`Next step: ${(0, __hot_updater_plugin_core.link)("https://hot-updater.dev/guide/providers/3_aws-s3-lambda-edge.html#step-4-changeenv-file-optional")}`);
8955
+ f.message(`Next step: ${(0, __hot_updater_plugin_core.link)("https://hot-updater.dev/docs/managed/aws#step-4-changeenv-file-optional")}`);
8949
8956
  f.success("Done! 🎉");
8950
8957
  };
8951
8958
 
package/dist/iac/index.js CHANGED
@@ -7652,12 +7652,16 @@ var CloudFrontManager = class {
7652
7652
  try {
7653
7653
  const existingOac = (await cloudfrontClient.listOriginAccessControls({})).OriginAccessControlList?.Items?.find((oac) => oac.Name === "HotUpdaterOAC");
7654
7654
  if (existingOac?.Id) oacId = existingOac.Id;
7655
- else oacId = (await cloudfrontClient.createOriginAccessControl({ OriginAccessControlConfig: {
7656
- Name: "HotUpdaterOAC",
7657
- OriginAccessControlOriginType: "s3",
7658
- SigningBehavior: "always",
7659
- SigningProtocol: "sigv4"
7660
- } })).OriginAccessControl?.Id;
7655
+ else {
7656
+ const createOacResp = await cloudfrontClient.createOriginAccessControl({ OriginAccessControlConfig: {
7657
+ Name: "HotUpdaterOAC",
7658
+ OriginAccessControlOriginType: "s3",
7659
+ SigningBehavior: "always",
7660
+ SigningProtocol: "sigv4"
7661
+ } });
7662
+ if (!createOacResp.OriginAccessControl?.Id) throw new Error("Failed to create Origin Access Control: No ID returned");
7663
+ oacId = createOacResp.OriginAccessControl.Id;
7664
+ }
7661
7665
  } catch {
7662
7666
  throw new Error("Failed to get or create Origin Access Control");
7663
7667
  }
@@ -7983,8 +7987,9 @@ var CloudFrontManager = class {
7983
7987
  };
7984
7988
  try {
7985
7989
  const distResp = await cloudfrontClient.createDistribution({ DistributionConfig: finalDistributionConfig });
7986
- const distributionId = distResp.Distribution?.Id;
7987
- const distributionDomain = distResp.Distribution?.DomainName;
7990
+ if (!distResp.Distribution?.Id || !distResp.Distribution?.DomainName) throw new Error("Failed to create CloudFront distribution: No ID or DomainName returned");
7991
+ const distributionId = distResp.Distribution.Id;
7992
+ const distributionDomain = distResp.Distribution.DomainName;
7988
7993
  f.success(`Created new CloudFront distribution. Distribution ID: ${distributionId}`);
7989
7994
  let retryCount = 0;
7990
7995
  await Te([{
@@ -8066,11 +8071,13 @@ var IAMManager = class {
8066
8071
  }
8067
8072
  } catch {
8068
8073
  try {
8069
- const lambdaRoleArn = (await iamClient.createRole({
8074
+ const createRoleResp = await iamClient.createRole({
8070
8075
  RoleName: roleName,
8071
8076
  AssumeRolePolicyDocument: assumeRolePolicyDocument,
8072
8077
  Description: "Role for Lambda@Edge to access S3 and SSM"
8073
- })).Role?.Arn;
8078
+ });
8079
+ if (!createRoleResp.Role?.Arn) throw new Error("Failed to create IAM role: No ARN returned");
8080
+ const lambdaRoleArn = createRoleResp.Role.Arn;
8074
8081
  f.info(`Created IAM role: ${roleName} (${lambdaRoleArn})`);
8075
8082
  await iamClient.attachRolePolicy({
8076
8083
  RoleName: roleName,
@@ -8919,7 +8926,7 @@ const runInit = async ({ build }) => {
8919
8926
  f.success("Generated 'hot-updater.config.ts' file with AWS settings.");
8920
8927
  const sourceUrl = `https://${distributionDomain}/api/check-update`;
8921
8928
  Me(transformTemplate(SOURCE_TEMPLATE, { source: sourceUrl }));
8922
- f.message(`Next step: ${link("https://hot-updater.dev/guide/providers/3_aws-s3-lambda-edge.html#step-4-changeenv-file-optional")}`);
8929
+ f.message(`Next step: ${link("https://hot-updater.dev/docs/managed/aws#step-4-changeenv-file-optional")}`);
8923
8930
  f.success("Done! 🎉");
8924
8931
  };
8925
8932
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/aws",
3
3
  "type": "module",
4
- "version": "0.21.6",
4
+ "version": "0.21.7",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.js",
@@ -46,9 +46,9 @@
46
46
  "mime": "^4.0.4",
47
47
  "picocolors": "1.1.1",
48
48
  "@clack/prompts": "0.10.0",
49
- "@hot-updater/core": "0.21.6",
50
- "@hot-updater/js": "0.21.6",
51
- "@hot-updater/test-utils": "0.21.6"
49
+ "@hot-updater/core": "0.21.7",
50
+ "@hot-updater/js": "0.21.7",
51
+ "@hot-updater/test-utils": "0.21.7"
52
52
  },
53
53
  "dependencies": {
54
54
  "@aws-sdk/client-cloudfront": "3.772.0",
@@ -61,7 +61,7 @@
61
61
  "@aws-sdk/credential-providers": "3.772.0",
62
62
  "@aws-sdk/lib-storage": "3.772.0",
63
63
  "aws-lambda": "1.0.7",
64
- "@hot-updater/plugin-core": "0.21.6"
64
+ "@hot-updater/plugin-core": "0.21.7"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "tsdown",