@hot-updater/aws 1.1.2 → 1.1.3
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/init/index.cjs +22 -1
- package/dist/init/index.mjs +22 -1
- package/dist/lambda/index.cjs +1 -1
- package/package.json +7 -7
package/dist/init/index.cjs
CHANGED
|
@@ -7796,6 +7796,8 @@ var CloudFrontManager = class {
|
|
|
7796
7796
|
//#endregion
|
|
7797
7797
|
//#region iac/dynamodb.ts
|
|
7798
7798
|
const DYNAMODB_DESCRIBE_TABLE_ACTION = "dynamodb:DescribeTable";
|
|
7799
|
+
const PITR_MAX_ATTEMPTS = 25;
|
|
7800
|
+
const PITR_RETRY_DELAY_MS = 5e3;
|
|
7799
7801
|
var DynamoDBTableSchemaError = class extends Error {
|
|
7800
7802
|
tableName;
|
|
7801
7803
|
name = "DynamoDBTableSchemaError";
|
|
@@ -7815,6 +7817,14 @@ var DynamoDBTimeToLiveError = class extends Error {
|
|
|
7815
7817
|
this.attributeName = attributeName;
|
|
7816
7818
|
}
|
|
7817
7819
|
};
|
|
7820
|
+
var DynamoDBPointInTimeRecoveryError = class extends _hot_updater_cli_tools.InitError {
|
|
7821
|
+
tableName;
|
|
7822
|
+
name = "DynamoDBPointInTimeRecoveryError";
|
|
7823
|
+
constructor(tableName, cause) {
|
|
7824
|
+
super(`DynamoDB table "${tableName}" still refused point-in-time recovery after ${24 * PITR_RETRY_DELAY_MS / 1e3} seconds: AWS reports continuous backups unavailable. Rerun \`hot-updater init\` to try again.`, { cause });
|
|
7825
|
+
this.tableName = tableName;
|
|
7826
|
+
}
|
|
7827
|
+
};
|
|
7818
7828
|
var DynamoDBPermissionError = class extends _hot_updater_cli_tools.InitError {
|
|
7819
7829
|
tableName;
|
|
7820
7830
|
region;
|
|
@@ -7850,6 +7860,7 @@ const hasExpectedSchema = (table) => {
|
|
|
7850
7860
|
return keyAttributes.every((attributeName) => table?.AttributeDefinitions?.some(({ AttributeName, AttributeType }) => AttributeName === attributeName && AttributeType === "S")) && table?.BillingModeSummary?.BillingMode === "PAY_PER_REQUEST" && table.OnDemandThroughput?.MaxReadRequestUnits === onDemandThroughput.MaxReadRequestUnits && table.OnDemandThroughput?.MaxWriteRequestUnits === onDemandThroughput.MaxWriteRequestUnits && hasKeySchema(table?.KeySchema, primaryKeySchema) && (table?.GlobalSecondaryIndexes ?? []).length === 0;
|
|
7851
7861
|
};
|
|
7852
7862
|
const isResourceNotFound = (error) => typeof error === "object" && error !== null && Reflect.get(error, "name") === "ResourceNotFoundException";
|
|
7863
|
+
const isContinuousBackupsUnavailable = (error) => error instanceof Error && error.name === "ContinuousBackupsUnavailableException";
|
|
7853
7864
|
const buildDynamoDBCreateTableInput = (tableName) => ({
|
|
7854
7865
|
AttributeDefinitions: [{
|
|
7855
7866
|
AttributeName: "pk",
|
|
@@ -7925,7 +7936,7 @@ var DynamoDBManager = class {
|
|
|
7925
7936
|
/** Point-in-time recovery and TTL, each turned on only when it is off. */
|
|
7926
7937
|
async ensureLifecycle(tableName) {
|
|
7927
7938
|
const { ContinuousBackupsDescription } = await this.client.describeContinuousBackups({ TableName: tableName });
|
|
7928
|
-
if (ContinuousBackupsDescription?.PointInTimeRecoveryDescription?.PointInTimeRecoveryStatus !== "ENABLED") await this.
|
|
7939
|
+
if (ContinuousBackupsDescription?.PointInTimeRecoveryDescription?.PointInTimeRecoveryStatus !== "ENABLED") await this.enablePointInTimeRecovery(tableName);
|
|
7929
7940
|
const { TimeToLiveDescription: ttl } = await this.client.describeTimeToLive({ TableName: tableName });
|
|
7930
7941
|
const status = ttl?.TimeToLiveStatus;
|
|
7931
7942
|
if (status === "ENABLED" || status === "ENABLING") {
|
|
@@ -7934,6 +7945,16 @@ var DynamoDBManager = class {
|
|
|
7934
7945
|
}
|
|
7935
7946
|
await this.client.updateTimeToLive(buildDynamoDBTimeToLiveInput(tableName));
|
|
7936
7947
|
}
|
|
7948
|
+
async enablePointInTimeRecovery(tableName) {
|
|
7949
|
+
for (let attempt = 1;; attempt++) try {
|
|
7950
|
+
await this.client.updateContinuousBackups(buildDynamoDBBackupInput(tableName));
|
|
7951
|
+
return;
|
|
7952
|
+
} catch (error) {
|
|
7953
|
+
if (!isContinuousBackupsUnavailable(error)) throw error;
|
|
7954
|
+
if (attempt === PITR_MAX_ATTEMPTS) throw new DynamoDBPointInTimeRecoveryError(tableName, error);
|
|
7955
|
+
await new Promise((resolve) => setTimeout(resolve, PITR_RETRY_DELAY_MS));
|
|
7956
|
+
}
|
|
7957
|
+
}
|
|
7937
7958
|
};
|
|
7938
7959
|
//#endregion
|
|
7939
7960
|
//#region iac/iam.ts
|
package/dist/init/index.mjs
CHANGED
|
@@ -7791,6 +7791,8 @@ var CloudFrontManager = class {
|
|
|
7791
7791
|
//#endregion
|
|
7792
7792
|
//#region iac/dynamodb.ts
|
|
7793
7793
|
const DYNAMODB_DESCRIBE_TABLE_ACTION = "dynamodb:DescribeTable";
|
|
7794
|
+
const PITR_MAX_ATTEMPTS = 25;
|
|
7795
|
+
const PITR_RETRY_DELAY_MS = 5e3;
|
|
7794
7796
|
var DynamoDBTableSchemaError = class extends Error {
|
|
7795
7797
|
tableName;
|
|
7796
7798
|
name = "DynamoDBTableSchemaError";
|
|
@@ -7810,6 +7812,14 @@ var DynamoDBTimeToLiveError = class extends Error {
|
|
|
7810
7812
|
this.attributeName = attributeName;
|
|
7811
7813
|
}
|
|
7812
7814
|
};
|
|
7815
|
+
var DynamoDBPointInTimeRecoveryError = class extends InitError {
|
|
7816
|
+
tableName;
|
|
7817
|
+
name = "DynamoDBPointInTimeRecoveryError";
|
|
7818
|
+
constructor(tableName, cause) {
|
|
7819
|
+
super(`DynamoDB table "${tableName}" still refused point-in-time recovery after ${24 * PITR_RETRY_DELAY_MS / 1e3} seconds: AWS reports continuous backups unavailable. Rerun \`hot-updater init\` to try again.`, { cause });
|
|
7820
|
+
this.tableName = tableName;
|
|
7821
|
+
}
|
|
7822
|
+
};
|
|
7813
7823
|
var DynamoDBPermissionError = class extends InitError {
|
|
7814
7824
|
tableName;
|
|
7815
7825
|
region;
|
|
@@ -7845,6 +7855,7 @@ const hasExpectedSchema = (table) => {
|
|
|
7845
7855
|
return keyAttributes.every((attributeName) => table?.AttributeDefinitions?.some(({ AttributeName, AttributeType }) => AttributeName === attributeName && AttributeType === "S")) && table?.BillingModeSummary?.BillingMode === "PAY_PER_REQUEST" && table.OnDemandThroughput?.MaxReadRequestUnits === onDemandThroughput.MaxReadRequestUnits && table.OnDemandThroughput?.MaxWriteRequestUnits === onDemandThroughput.MaxWriteRequestUnits && hasKeySchema(table?.KeySchema, primaryKeySchema) && (table?.GlobalSecondaryIndexes ?? []).length === 0;
|
|
7846
7856
|
};
|
|
7847
7857
|
const isResourceNotFound = (error) => typeof error === "object" && error !== null && Reflect.get(error, "name") === "ResourceNotFoundException";
|
|
7858
|
+
const isContinuousBackupsUnavailable = (error) => error instanceof Error && error.name === "ContinuousBackupsUnavailableException";
|
|
7848
7859
|
const buildDynamoDBCreateTableInput = (tableName) => ({
|
|
7849
7860
|
AttributeDefinitions: [{
|
|
7850
7861
|
AttributeName: "pk",
|
|
@@ -7920,7 +7931,7 @@ var DynamoDBManager = class {
|
|
|
7920
7931
|
/** Point-in-time recovery and TTL, each turned on only when it is off. */
|
|
7921
7932
|
async ensureLifecycle(tableName) {
|
|
7922
7933
|
const { ContinuousBackupsDescription } = await this.client.describeContinuousBackups({ TableName: tableName });
|
|
7923
|
-
if (ContinuousBackupsDescription?.PointInTimeRecoveryDescription?.PointInTimeRecoveryStatus !== "ENABLED") await this.
|
|
7934
|
+
if (ContinuousBackupsDescription?.PointInTimeRecoveryDescription?.PointInTimeRecoveryStatus !== "ENABLED") await this.enablePointInTimeRecovery(tableName);
|
|
7924
7935
|
const { TimeToLiveDescription: ttl } = await this.client.describeTimeToLive({ TableName: tableName });
|
|
7925
7936
|
const status = ttl?.TimeToLiveStatus;
|
|
7926
7937
|
if (status === "ENABLED" || status === "ENABLING") {
|
|
@@ -7929,6 +7940,16 @@ var DynamoDBManager = class {
|
|
|
7929
7940
|
}
|
|
7930
7941
|
await this.client.updateTimeToLive(buildDynamoDBTimeToLiveInput(tableName));
|
|
7931
7942
|
}
|
|
7943
|
+
async enablePointInTimeRecovery(tableName) {
|
|
7944
|
+
for (let attempt = 1;; attempt++) try {
|
|
7945
|
+
await this.client.updateContinuousBackups(buildDynamoDBBackupInput(tableName));
|
|
7946
|
+
return;
|
|
7947
|
+
} catch (error) {
|
|
7948
|
+
if (!isContinuousBackupsUnavailable(error)) throw error;
|
|
7949
|
+
if (attempt === PITR_MAX_ATTEMPTS) throw new DynamoDBPointInTimeRecoveryError(tableName, error);
|
|
7950
|
+
await new Promise((resolve) => setTimeout(resolve, PITR_RETRY_DELAY_MS));
|
|
7951
|
+
}
|
|
7952
|
+
}
|
|
7932
7953
|
};
|
|
7933
7954
|
//#endregion
|
|
7934
7955
|
//#region iac/iam.ts
|
package/dist/lambda/index.cjs
CHANGED
|
@@ -4549,7 +4549,7 @@ const createKvAdapter = ({ store, tablePrefix = "" }) => {
|
|
|
4549
4549
|
};
|
|
4550
4550
|
//#endregion
|
|
4551
4551
|
//#region ../../packages/server/dist/version.mjs
|
|
4552
|
-
const HOT_UPDATER_SERVER_VERSION = "1.1.
|
|
4552
|
+
const HOT_UPDATER_SERVER_VERSION = "1.1.3";
|
|
4553
4553
|
//#endregion
|
|
4554
4554
|
//#region ../../packages/server/dist/handlerVersionRoutes.mjs
|
|
4555
4555
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/aws",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.3",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.mjs",
|
|
@@ -45,9 +45,9 @@
|
|
|
45
45
|
"es-toolkit": "^1.32.0",
|
|
46
46
|
"execa": "9.5.2",
|
|
47
47
|
"mime": "^4.0.4",
|
|
48
|
-
"@hot-updater/
|
|
49
|
-
"@hot-updater/mock": "1.1.
|
|
50
|
-
"@hot-updater/
|
|
48
|
+
"@hot-updater/protocol": "1.1.3",
|
|
49
|
+
"@hot-updater/mock": "1.1.3",
|
|
50
|
+
"@hot-updater/test-utils": "1.1.3"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@aws-sdk/client-cloudfront": "3.1066.0",
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
"@aws-sdk/lib-dynamodb": "3.1066.0",
|
|
64
64
|
"@aws-sdk/s3-request-presigner": "3.1066.0",
|
|
65
65
|
"hono": "4.12.34",
|
|
66
|
-
"@hot-updater/cli-tools": "1.1.
|
|
67
|
-
"@hot-updater/plugin-core": "1.1.
|
|
68
|
-
"@hot-updater/server": "1.1.
|
|
66
|
+
"@hot-updater/cli-tools": "1.1.3",
|
|
67
|
+
"@hot-updater/plugin-core": "1.1.3",
|
|
68
|
+
"@hot-updater/server": "1.1.3"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|
|
71
71
|
"build": "tsdown",
|