@hot-updater/aws 0.21.10 → 0.21.11

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/index.cjs CHANGED
@@ -1459,16 +1459,15 @@ async function invalidateCloudFront(client, distributionId, paths) {
1459
1459
  }
1460
1460
  const s3Database = (config, hooks) => {
1461
1461
  const { bucketName, cloudfrontDistributionId, apiBasePath = "/api/check-update",...s3Config } = config;
1462
- if (!cloudfrontDistributionId) throw new Error("cloudfrontDistributionId is missing in s3Database");
1463
1462
  return (0, __hot_updater_plugin_core.createBlobDatabasePlugin)({
1464
1463
  name: "s3Database",
1465
1464
  apiBasePath,
1466
1465
  getContext: () => ({
1467
1466
  client: new __aws_sdk_client_s3.S3Client(s3Config),
1468
- cloudfrontClient: new __aws_sdk_client_cloudfront.CloudFrontClient({
1467
+ cloudfrontClient: cloudfrontDistributionId ? new __aws_sdk_client_cloudfront.CloudFrontClient({
1469
1468
  credentials: s3Config.credentials,
1470
1469
  region: s3Config.region
1471
- })
1470
+ }) : void 0
1472
1471
  }),
1473
1472
  listObjects: (context, prefix) => listObjectsInS3(context.client, bucketName, prefix),
1474
1473
  loadObject: (context, key) => loadJsonFromS3(context.client, bucketName, key),
@@ -1484,7 +1483,7 @@ const s3Database = (config, hooks) => {
1484
1483
 
1485
1484
  //#endregion
1486
1485
  //#region src/s3Storage.ts
1487
- const s3Storage = (config, hooks) => (_) => {
1486
+ const s3Storage = (config, hooks) => () => {
1488
1487
  const { bucketName,...s3Config } = config;
1489
1488
  const client = new __aws_sdk_client_s3.S3Client(s3Config);
1490
1489
  const getStorageKey = (0, __hot_updater_plugin_core.createStorageKeyBuilder)(config.basePath);
package/dist/index.d.cts CHANGED
@@ -1,14 +1,21 @@
1
1
  import * as _hot_updater_plugin_core0 from "@hot-updater/plugin-core";
2
- import { BasePluginArgs, DatabasePluginHooks, StoragePlugin, StoragePluginHooks } from "@hot-updater/plugin-core";
2
+ import { DatabasePluginHooks, StoragePlugin, StoragePluginHooks } from "@hot-updater/plugin-core";
3
3
  import { S3ClientConfig } from "@aws-sdk/client-s3";
4
4
 
5
5
  //#region src/s3Database.d.ts
6
6
  interface S3DatabaseConfig extends S3ClientConfig {
7
7
  bucketName: string;
8
- cloudfrontDistributionId: string;
8
+ /**
9
+ * CloudFront distribution ID used for cache invalidation.
10
+ *
11
+ * If omitted or an empty string, CloudFront invalidation is skipped.
12
+ * This is useful for local development environments (e.g. Localstack)
13
+ * where CloudFront is not available.
14
+ */
15
+ cloudfrontDistributionId?: string;
9
16
  apiBasePath?: string;
10
17
  }
11
- declare const s3Database: (config: S3DatabaseConfig, hooks?: DatabasePluginHooks) => (options: _hot_updater_plugin_core0.BasePluginArgs) => _hot_updater_plugin_core0.DatabasePlugin;
18
+ declare const s3Database: (config: S3DatabaseConfig, hooks?: DatabasePluginHooks) => () => _hot_updater_plugin_core0.DatabasePlugin;
12
19
  //#endregion
13
20
  //#region src/s3Storage.d.ts
14
21
  interface S3StorageConfig extends S3ClientConfig {
@@ -18,6 +25,6 @@ interface S3StorageConfig extends S3ClientConfig {
18
25
  */
19
26
  basePath?: string;
20
27
  }
21
- declare const s3Storage: (config: S3StorageConfig, hooks?: StoragePluginHooks) => (_: BasePluginArgs) => StoragePlugin;
28
+ declare const s3Storage: (config: S3StorageConfig, hooks?: StoragePluginHooks) => () => StoragePlugin;
22
29
  //#endregion
23
30
  export { S3DatabaseConfig, S3StorageConfig, s3Database, s3Storage };
package/dist/index.d.ts CHANGED
@@ -1,14 +1,21 @@
1
1
  import { S3ClientConfig } from "@aws-sdk/client-s3";
2
2
  import * as _hot_updater_plugin_core0 from "@hot-updater/plugin-core";
3
- import { BasePluginArgs, DatabasePluginHooks, StoragePlugin, StoragePluginHooks } from "@hot-updater/plugin-core";
3
+ import { DatabasePluginHooks, StoragePlugin, StoragePluginHooks } from "@hot-updater/plugin-core";
4
4
 
5
5
  //#region src/s3Database.d.ts
6
6
  interface S3DatabaseConfig extends S3ClientConfig {
7
7
  bucketName: string;
8
- cloudfrontDistributionId: string;
8
+ /**
9
+ * CloudFront distribution ID used for cache invalidation.
10
+ *
11
+ * If omitted or an empty string, CloudFront invalidation is skipped.
12
+ * This is useful for local development environments (e.g. Localstack)
13
+ * where CloudFront is not available.
14
+ */
15
+ cloudfrontDistributionId?: string;
9
16
  apiBasePath?: string;
10
17
  }
11
- declare const s3Database: (config: S3DatabaseConfig, hooks?: DatabasePluginHooks) => (options: _hot_updater_plugin_core0.BasePluginArgs) => _hot_updater_plugin_core0.DatabasePlugin;
18
+ declare const s3Database: (config: S3DatabaseConfig, hooks?: DatabasePluginHooks) => () => _hot_updater_plugin_core0.DatabasePlugin;
12
19
  //#endregion
13
20
  //#region src/s3Storage.d.ts
14
21
  interface S3StorageConfig extends S3ClientConfig {
@@ -18,6 +25,6 @@ interface S3StorageConfig extends S3ClientConfig {
18
25
  */
19
26
  basePath?: string;
20
27
  }
21
- declare const s3Storage: (config: S3StorageConfig, hooks?: StoragePluginHooks) => (_: BasePluginArgs) => StoragePlugin;
28
+ declare const s3Storage: (config: S3StorageConfig, hooks?: StoragePluginHooks) => () => StoragePlugin;
22
29
  //#endregion
23
30
  export { S3DatabaseConfig, S3StorageConfig, s3Database, s3Storage };
package/dist/index.js CHANGED
@@ -1429,16 +1429,15 @@ async function invalidateCloudFront(client, distributionId, paths) {
1429
1429
  }
1430
1430
  const s3Database = (config, hooks) => {
1431
1431
  const { bucketName, cloudfrontDistributionId, apiBasePath = "/api/check-update",...s3Config } = config;
1432
- if (!cloudfrontDistributionId) throw new Error("cloudfrontDistributionId is missing in s3Database");
1433
1432
  return createBlobDatabasePlugin({
1434
1433
  name: "s3Database",
1435
1434
  apiBasePath,
1436
1435
  getContext: () => ({
1437
1436
  client: new S3Client(s3Config),
1438
- cloudfrontClient: new CloudFrontClient({
1437
+ cloudfrontClient: cloudfrontDistributionId ? new CloudFrontClient({
1439
1438
  credentials: s3Config.credentials,
1440
1439
  region: s3Config.region
1441
- })
1440
+ }) : void 0
1442
1441
  }),
1443
1442
  listObjects: (context, prefix) => listObjectsInS3(context.client, bucketName, prefix),
1444
1443
  loadObject: (context, key) => loadJsonFromS3(context.client, bucketName, key),
@@ -1454,7 +1453,7 @@ const s3Database = (config, hooks) => {
1454
1453
 
1455
1454
  //#endregion
1456
1455
  //#region src/s3Storage.ts
1457
- const s3Storage = (config, hooks) => (_) => {
1456
+ const s3Storage = (config, hooks) => () => {
1458
1457
  const { bucketName,...s3Config } = config;
1459
1458
  const client = new S3Client(s3Config);
1460
1459
  const getStorageKey = createStorageKeyBuilder(config.basePath);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/aws",
3
3
  "type": "module",
4
- "version": "0.21.10",
4
+ "version": "0.21.11",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.js",
@@ -44,9 +44,9 @@
44
44
  "execa": "9.5.2",
45
45
  "hono": "^4.6.3",
46
46
  "mime": "^4.0.4",
47
- "@hot-updater/core": "0.21.10",
48
- "@hot-updater/test-utils": "0.21.10",
49
- "@hot-updater/js": "0.21.10"
47
+ "@hot-updater/core": "0.21.11",
48
+ "@hot-updater/js": "0.21.11",
49
+ "@hot-updater/test-utils": "0.21.11"
50
50
  },
51
51
  "dependencies": {
52
52
  "@aws-sdk/client-cloudfront": "3.772.0",
@@ -59,8 +59,8 @@
59
59
  "@aws-sdk/credential-providers": "3.772.0",
60
60
  "@aws-sdk/lib-storage": "3.772.0",
61
61
  "aws-lambda": "1.0.7",
62
- "@hot-updater/cli-tools": "0.21.10",
63
- "@hot-updater/plugin-core": "0.21.10"
62
+ "@hot-updater/cli-tools": "0.21.11",
63
+ "@hot-updater/plugin-core": "0.21.11"
64
64
  },
65
65
  "scripts": {
66
66
  "build": "tsdown",