@hot-updater/aws 0.6.0 → 0.6.1-rc.0
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.js +14 -14
- package/dist/s3Database.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import * as
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE__aws_sdk_client_s3_241e987a__ from "@aws-sdk/client-s3";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE__aws_sdk_lib_storage_3664e495__ from "@aws-sdk/lib-storage";
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE_path__ from "path";
|
|
4
|
-
import * as
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_fs_promises_400951f8__ from "fs/promises";
|
|
5
5
|
const types = {
|
|
6
6
|
"application/prs.cww": [
|
|
7
7
|
"cww"
|
|
@@ -3314,24 +3314,24 @@ const streamToString = (stream)=>new Promise((resolve, reject)=>{
|
|
|
3314
3314
|
});
|
|
3315
3315
|
const s3Database = (config, hooks)=>(_)=>{
|
|
3316
3316
|
const { bucketName, ...s3Config } = config;
|
|
3317
|
-
const client = new
|
|
3317
|
+
const client = new __WEBPACK_EXTERNAL_MODULE__aws_sdk_client_s3_241e987a__.S3Client(s3Config);
|
|
3318
3318
|
let bundles = [];
|
|
3319
3319
|
return {
|
|
3320
3320
|
name: "s3Database",
|
|
3321
3321
|
async commitBundle () {
|
|
3322
3322
|
try {
|
|
3323
|
-
const command = new
|
|
3323
|
+
const command = new __WEBPACK_EXTERNAL_MODULE__aws_sdk_client_s3_241e987a__.GetObjectCommand({
|
|
3324
3324
|
Bucket: bucketName,
|
|
3325
3325
|
Key: "update.json"
|
|
3326
3326
|
});
|
|
3327
3327
|
await client.send(command);
|
|
3328
3328
|
} catch (e) {
|
|
3329
|
-
if (!(e instanceof
|
|
3329
|
+
if (!(e instanceof __WEBPACK_EXTERNAL_MODULE__aws_sdk_client_s3_241e987a__.NoSuchKey)) throw e;
|
|
3330
3330
|
}
|
|
3331
3331
|
const Key = "update.json";
|
|
3332
3332
|
const Body = JSON.stringify(bundles);
|
|
3333
3333
|
const ContentType = src.getType(Key) ?? void 0;
|
|
3334
|
-
const upload = new
|
|
3334
|
+
const upload = new __WEBPACK_EXTERNAL_MODULE__aws_sdk_lib_storage_3664e495__.Upload({
|
|
3335
3335
|
client,
|
|
3336
3336
|
params: {
|
|
3337
3337
|
ContentType,
|
|
@@ -3363,7 +3363,7 @@ const s3Database = (config, hooks)=>(_)=>{
|
|
|
3363
3363
|
async getBundles (refresh = false) {
|
|
3364
3364
|
if (bundles.length > 0 && !refresh) return bundles;
|
|
3365
3365
|
try {
|
|
3366
|
-
const command = new
|
|
3366
|
+
const command = new __WEBPACK_EXTERNAL_MODULE__aws_sdk_client_s3_241e987a__.GetObjectCommand({
|
|
3367
3367
|
Bucket: bucketName,
|
|
3368
3368
|
Key: "update.json"
|
|
3369
3369
|
});
|
|
@@ -3373,7 +3373,7 @@ const s3Database = (config, hooks)=>(_)=>{
|
|
|
3373
3373
|
bundles = _bundle;
|
|
3374
3374
|
return _bundle;
|
|
3375
3375
|
} catch (e) {
|
|
3376
|
-
if (e instanceof
|
|
3376
|
+
if (e instanceof __WEBPACK_EXTERNAL_MODULE__aws_sdk_client_s3_241e987a__.NoSuchKey) return [];
|
|
3377
3377
|
throw e;
|
|
3378
3378
|
}
|
|
3379
3379
|
}
|
|
@@ -3381,14 +3381,14 @@ const s3Database = (config, hooks)=>(_)=>{
|
|
|
3381
3381
|
};
|
|
3382
3382
|
const s3Storage = (config, hooks)=>(_)=>{
|
|
3383
3383
|
const { bucketName, ...s3Config } = config;
|
|
3384
|
-
const client = new
|
|
3384
|
+
const client = new __WEBPACK_EXTERNAL_MODULE__aws_sdk_client_s3_241e987a__.S3Client(s3Config);
|
|
3385
3385
|
return {
|
|
3386
3386
|
name: "s3Storage",
|
|
3387
3387
|
async deleteBundle (bundleId) {
|
|
3388
3388
|
const Key = [
|
|
3389
3389
|
bundleId
|
|
3390
3390
|
].join("/");
|
|
3391
|
-
const listCommand = new
|
|
3391
|
+
const listCommand = new __WEBPACK_EXTERNAL_MODULE__aws_sdk_client_s3_241e987a__.ListObjectsV2Command({
|
|
3392
3392
|
Bucket: bucketName,
|
|
3393
3393
|
Prefix: bundleId
|
|
3394
3394
|
});
|
|
@@ -3404,21 +3404,21 @@ const s3Storage = (config, hooks)=>(_)=>{
|
|
|
3404
3404
|
Quiet: true
|
|
3405
3405
|
}
|
|
3406
3406
|
};
|
|
3407
|
-
const deleteCommand = new
|
|
3407
|
+
const deleteCommand = new __WEBPACK_EXTERNAL_MODULE__aws_sdk_client_s3_241e987a__.DeleteObjectsCommand(deleteParams);
|
|
3408
3408
|
await client.send(deleteCommand);
|
|
3409
3409
|
return Key;
|
|
3410
3410
|
}
|
|
3411
3411
|
throw new Error("Bundle Not Found");
|
|
3412
3412
|
},
|
|
3413
3413
|
async uploadBundle (bundleId, bundlePath) {
|
|
3414
|
-
const Body = await
|
|
3414
|
+
const Body = await __WEBPACK_EXTERNAL_MODULE_fs_promises_400951f8__["default"].readFile(bundlePath);
|
|
3415
3415
|
const ContentType = src.getType(bundlePath) ?? void 0;
|
|
3416
3416
|
const filename = __WEBPACK_EXTERNAL_MODULE_path__["default"].basename(bundlePath);
|
|
3417
3417
|
const Key = [
|
|
3418
3418
|
bundleId,
|
|
3419
3419
|
filename
|
|
3420
3420
|
].join("/");
|
|
3421
|
-
const upload = new
|
|
3421
|
+
const upload = new __WEBPACK_EXTERNAL_MODULE__aws_sdk_lib_storage_3664e495__.Upload({
|
|
3422
3422
|
client,
|
|
3423
3423
|
params: {
|
|
3424
3424
|
ContentType,
|
package/dist/s3Database.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type S3ClientConfig } from "@aws-sdk/client-s3";
|
|
2
2
|
import type { BasePluginArgs, DatabasePlugin, DatabasePluginHooks } from "@hot-updater/plugin-core";
|
|
3
|
-
export interface S3DatabaseConfig extends
|
|
3
|
+
export interface S3DatabaseConfig extends S3ClientConfig {
|
|
4
4
|
bucketName: string;
|
|
5
5
|
}
|
|
6
6
|
export declare const s3Database: (config: S3DatabaseConfig, hooks?: DatabasePluginHooks) => (_: BasePluginArgs) => DatabasePlugin;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/aws",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.6.0",
|
|
4
|
+
"version": "0.6.1-rc.0",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"mime": "^4.0.4"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@hot-updater/plugin-core": "0.6.0",
|
|
27
|
+
"@hot-updater/plugin-core": "0.6.1-rc.0",
|
|
28
28
|
"@aws-sdk/client-s3": "^3.685.0",
|
|
29
29
|
"@aws-sdk/lib-storage": "^3.685.0"
|
|
30
30
|
},
|