@hot-updater/cloudflare 0.18.3 → 0.18.5
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 +57 -30
- package/dist/index.js +57 -30
- package/package.json +4 -4
- package/worker/dist/README.md +1 -1
package/dist/index.cjs
CHANGED
|
@@ -399,34 +399,56 @@ const d1Database = (config, hooks) => {
|
|
|
399
399
|
},
|
|
400
400
|
async commitBundle(context, { changedSets }) {
|
|
401
401
|
if (changedSets.length === 0) return;
|
|
402
|
-
const
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
402
|
+
for (const op of changedSets) if (op.operation === "delete") {
|
|
403
|
+
const deleteSql = (0, import_lib.default)(`
|
|
404
|
+
DELETE FROM bundles WHERE id = ?
|
|
405
|
+
`);
|
|
406
|
+
await context.cf.d1.database.query(config.databaseId, {
|
|
407
|
+
account_id: config.accountId,
|
|
408
|
+
sql: deleteSql,
|
|
409
|
+
params: [op.data.id]
|
|
410
|
+
});
|
|
411
|
+
bundles = bundles.filter((b) => b.id !== op.data.id);
|
|
412
|
+
} else if (op.operation === "insert" || op.operation === "update") {
|
|
413
|
+
const bundle = op.data;
|
|
414
|
+
const upsertSql = (0, import_lib.default)(`
|
|
415
|
+
INSERT OR REPLACE INTO bundles (
|
|
416
|
+
id,
|
|
417
|
+
channel,
|
|
418
|
+
enabled,
|
|
419
|
+
should_force_update,
|
|
420
|
+
file_hash,
|
|
421
|
+
git_commit_hash,
|
|
422
|
+
message,
|
|
423
|
+
platform,
|
|
424
|
+
target_app_version,
|
|
425
|
+
storage_uri,
|
|
426
|
+
fingerprint_hash,
|
|
427
|
+
metadata
|
|
428
|
+
)
|
|
429
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
430
|
+
`);
|
|
431
|
+
const params = [
|
|
432
|
+
bundle.id,
|
|
433
|
+
bundle.channel,
|
|
434
|
+
bundle.enabled ? 1 : 0,
|
|
435
|
+
bundle.shouldForceUpdate ? 1 : 0,
|
|
436
|
+
bundle.fileHash,
|
|
437
|
+
bundle.gitCommitHash || null,
|
|
438
|
+
bundle.message || null,
|
|
439
|
+
bundle.platform,
|
|
440
|
+
bundle.targetAppVersion,
|
|
441
|
+
bundle.storageUri,
|
|
442
|
+
bundle.fingerprintHash,
|
|
443
|
+
bundle.metadata ? JSON.stringify(bundle.metadata) : JSON.stringify({})
|
|
444
|
+
];
|
|
445
|
+
await context.cf.d1.database.query(config.databaseId, {
|
|
446
|
+
account_id: config.accountId,
|
|
447
|
+
sql: upsertSql,
|
|
448
|
+
params
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
hooks?.onDatabaseUpdated?.();
|
|
430
452
|
}
|
|
431
453
|
}, hooks);
|
|
432
454
|
};
|
|
@@ -8208,8 +8230,13 @@ const r2Storage = (config, hooks) => (_) => {
|
|
|
8208
8230
|
return {
|
|
8209
8231
|
name: "r2Storage",
|
|
8210
8232
|
async deleteBundle(bundleId) {
|
|
8211
|
-
|
|
8212
|
-
|
|
8233
|
+
const Key = `${bundleId}/bundle.zip `;
|
|
8234
|
+
try {
|
|
8235
|
+
await wrangler("r2", "object", "delete", [bucketName, Key].join("/"), "--remote");
|
|
8236
|
+
return { storageUri: `r2://${bucketName}/${Key}` };
|
|
8237
|
+
} catch (error$1) {
|
|
8238
|
+
throw new Error("Can not delete bundle");
|
|
8239
|
+
}
|
|
8213
8240
|
},
|
|
8214
8241
|
async uploadBundle(bundleId, bundlePath) {
|
|
8215
8242
|
const contentType = src_default.getType(bundlePath) ?? void 0;
|
package/dist/index.js
CHANGED
|
@@ -401,34 +401,56 @@ const d1Database = (config, hooks) => {
|
|
|
401
401
|
},
|
|
402
402
|
async commitBundle(context, { changedSets }) {
|
|
403
403
|
if (changedSets.length === 0) return;
|
|
404
|
-
const
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
404
|
+
for (const op of changedSets) if (op.operation === "delete") {
|
|
405
|
+
const deleteSql = (0, import_lib.default)(`
|
|
406
|
+
DELETE FROM bundles WHERE id = ?
|
|
407
|
+
`);
|
|
408
|
+
await context.cf.d1.database.query(config.databaseId, {
|
|
409
|
+
account_id: config.accountId,
|
|
410
|
+
sql: deleteSql,
|
|
411
|
+
params: [op.data.id]
|
|
412
|
+
});
|
|
413
|
+
bundles = bundles.filter((b) => b.id !== op.data.id);
|
|
414
|
+
} else if (op.operation === "insert" || op.operation === "update") {
|
|
415
|
+
const bundle = op.data;
|
|
416
|
+
const upsertSql = (0, import_lib.default)(`
|
|
417
|
+
INSERT OR REPLACE INTO bundles (
|
|
418
|
+
id,
|
|
419
|
+
channel,
|
|
420
|
+
enabled,
|
|
421
|
+
should_force_update,
|
|
422
|
+
file_hash,
|
|
423
|
+
git_commit_hash,
|
|
424
|
+
message,
|
|
425
|
+
platform,
|
|
426
|
+
target_app_version,
|
|
427
|
+
storage_uri,
|
|
428
|
+
fingerprint_hash,
|
|
429
|
+
metadata
|
|
430
|
+
)
|
|
431
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
432
|
+
`);
|
|
433
|
+
const params = [
|
|
434
|
+
bundle.id,
|
|
435
|
+
bundle.channel,
|
|
436
|
+
bundle.enabled ? 1 : 0,
|
|
437
|
+
bundle.shouldForceUpdate ? 1 : 0,
|
|
438
|
+
bundle.fileHash,
|
|
439
|
+
bundle.gitCommitHash || null,
|
|
440
|
+
bundle.message || null,
|
|
441
|
+
bundle.platform,
|
|
442
|
+
bundle.targetAppVersion,
|
|
443
|
+
bundle.storageUri,
|
|
444
|
+
bundle.fingerprintHash,
|
|
445
|
+
bundle.metadata ? JSON.stringify(bundle.metadata) : JSON.stringify({})
|
|
446
|
+
];
|
|
447
|
+
await context.cf.d1.database.query(config.databaseId, {
|
|
448
|
+
account_id: config.accountId,
|
|
449
|
+
sql: upsertSql,
|
|
450
|
+
params
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
hooks?.onDatabaseUpdated?.();
|
|
432
454
|
}
|
|
433
455
|
}, hooks);
|
|
434
456
|
};
|
|
@@ -8210,8 +8232,13 @@ const r2Storage = (config, hooks) => (_) => {
|
|
|
8210
8232
|
return {
|
|
8211
8233
|
name: "r2Storage",
|
|
8212
8234
|
async deleteBundle(bundleId) {
|
|
8213
|
-
|
|
8214
|
-
|
|
8235
|
+
const Key = `${bundleId}/bundle.zip `;
|
|
8236
|
+
try {
|
|
8237
|
+
await wrangler("r2", "object", "delete", [bucketName, Key].join("/"), "--remote");
|
|
8238
|
+
return { storageUri: `r2://${bucketName}/${Key}` };
|
|
8239
|
+
} catch (error$1) {
|
|
8240
|
+
throw new Error("Can not delete bundle");
|
|
8241
|
+
}
|
|
8215
8242
|
},
|
|
8216
8243
|
async uploadBundle(bundleId, bundlePath) {
|
|
8217
8244
|
const contentType = src_default.getType(bundlePath) ?? void 0;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/cloudflare",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.18.
|
|
4
|
+
"version": "0.18.5",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.js",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"cloudflare": "4.2.0",
|
|
43
|
-
"@hot-updater/core": "0.18.
|
|
44
|
-
"@hot-updater/
|
|
45
|
-
"@hot-updater/
|
|
43
|
+
"@hot-updater/core": "0.18.5",
|
|
44
|
+
"@hot-updater/plugin-core": "0.18.5",
|
|
45
|
+
"@hot-updater/js": "0.18.5"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@clack/prompts": "0.10.0",
|
package/worker/dist/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
This folder contains the built output assets for the worker "hot-updater" generated at 2025-06-
|
|
1
|
+
This folder contains the built output assets for the worker "hot-updater" generated at 2025-06-10T01:49:43.561Z.
|