@hot-updater/vercel 1.2.0-rc.43 → 1.2.0-rc.44
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/function/index.mjs +19 -6
- package/package.json +7 -7
package/dist/function/index.mjs
CHANGED
|
@@ -2064,7 +2064,12 @@ const sqlTableShapes = (dialect, tables, tablePrefix = "") => tables.map((table)
|
|
|
2064
2064
|
name: `${name}__${index.name}`,
|
|
2065
2065
|
columns: entries,
|
|
2066
2066
|
key: columns,
|
|
2067
|
-
indexes: [
|
|
2067
|
+
indexes: [{
|
|
2068
|
+
kind: "index",
|
|
2069
|
+
name: shortSqlName(`${name}__${index.name}__key`),
|
|
2070
|
+
unique: false,
|
|
2071
|
+
columns: table.key
|
|
2072
|
+
}]
|
|
2068
2073
|
}
|
|
2069
2074
|
}];
|
|
2070
2075
|
}
|
|
@@ -2134,9 +2139,17 @@ const pruneStatements = (dialect, table, tablePrefix, limit) => {
|
|
|
2134
2139
|
const order = retentionOrder(table).columns.map(quote);
|
|
2135
2140
|
const list = (alias, direction = "") => order.map((column) => `${alias}.${column}${direction}`).join(", ");
|
|
2136
2141
|
const oldest = (before) => `SELECT ${list("i")} FROM ${name} i WHERE i.${at} <= ${before()} ORDER BY ${list("i", " ASC")} LIMIT ${limit}`;
|
|
2137
|
-
const doomed = (alias, before) =>
|
|
2142
|
+
const doomed = (alias, before) => `(${list(alias)}) <= (SELECT ${list("b")} FROM (${oldest(before)}) b ORDER BY ${list("b", " DESC")} LIMIT 1) AND ${alias}.${at} <= ${before()}`;
|
|
2138
2143
|
const entries = table.indexes.filter((index) => isMultiIndex(table, index)).map((index) => quote(`${tablePrefix}${table.name}__${index.name}`));
|
|
2139
2144
|
const keyOf = (left, right) => table.key.map((column) => `${left}.${quote(column)} = ${right}.${quote(column)}`).join(" AND ");
|
|
2145
|
+
if (dialect === "sqlite") return [...table.indexes.filter((index) => isMultiIndex(table, index)).map((index) => {
|
|
2146
|
+
const columns = [...index.eq, ...indexOrderColumns(table, index)];
|
|
2147
|
+
const multi = columns.filter((column) => findPhysicalColumn(table, column).multi);
|
|
2148
|
+
const values = columns.map((column) => multi.includes(column) ? `j${multi.indexOf(column)}.${quote("value")}` : `b.${quote(column)}`);
|
|
2149
|
+
const each = multi.map((column, at) => `, json_each(b.${quote(column)}) j${at}`);
|
|
2150
|
+
const into = quote(`${tablePrefix}${table.name}__${index.name}`);
|
|
2151
|
+
return (before) => `DELETE FROM ${into} WHERE (${columns.map(quote).join(", ")}) IN (SELECT ${values.join(", ")} FROM ${name} b${each.join("")} WHERE ${doomed("b", before)})`;
|
|
2152
|
+
}), (before) => `DELETE FROM ${name} WHERE ${doomed(name, before)}`];
|
|
2140
2153
|
if (dialect === "mysql") return [...entries.map((index) => (before) => `DELETE e FROM ${index} e JOIN (${oldest(before)}) d ON ${keyOf("e", "d")}`), (before) => `DELETE FROM ${name} WHERE ${at} <= ${before()} ORDER BY ${order.join(", ")} LIMIT ${limit}`];
|
|
2141
2154
|
return [...entries.map((index) => (before) => `DELETE FROM ${index} WHERE EXISTS (SELECT * FROM ${name} b WHERE ${keyOf("b", index)} AND ${doomed("b", before)})`), (before) => `DELETE FROM ${name} WHERE ${doomed(name, before)}`];
|
|
2142
2155
|
};
|
|
@@ -4347,19 +4360,19 @@ const createSqlAdapter = ({ executor, tablePrefix = "", maxOps = 1e3, maxParams
|
|
|
4347
4360
|
const where = (bind, key, v) => `${keyMatch(bind, table, key)}${v === void 0 ? "" : ` AND ${version} = ${bind(v)}`}${when ? ` AND ${when(bind)}` : ""}`;
|
|
4348
4361
|
const insert = (bind, into, columns, values) => `INSERT INTO ${into} (${columns.map(quote).join(", ")}) ${when ? `SELECT ${values.join(", ")} WHERE ${when(bind)}` : `VALUES (${values.join(", ")})`}`;
|
|
4349
4362
|
const insertRow = (bind, row) => insert(bind, name, table.columns.map((column) => column.name), table.columns.map((column) => bind(row[column.name], column)));
|
|
4350
|
-
const entries = (key, row, changed) => table.indexes.flatMap((index) => {
|
|
4363
|
+
const entries = (key, row, changed, stale = true) => table.indexes.flatMap((index) => {
|
|
4351
4364
|
const columns = [...index.eq, ...indexOrderColumns(table, index)];
|
|
4352
4365
|
if (!isMultiIndex(table, index) || changed && !columns.some((column) => changed.includes(column))) return [];
|
|
4353
4366
|
const into = tableOf(table, index);
|
|
4354
4367
|
const found = row ? indexEntries(table, index, row) : [];
|
|
4355
4368
|
const order = found.length > 0 ? indexOrderTuple(table, index, row) : [];
|
|
4356
|
-
return [sql((bind) => `DELETE FROM ${into} WHERE ${where(bind, key)}`), ...found.map((eq) => sql((bind) => {
|
|
4369
|
+
return [...stale ? [sql((bind) => `DELETE FROM ${into} WHERE ${where(bind, key)}`)] : [], ...found.map((eq) => sql((bind) => {
|
|
4357
4370
|
const values = [...eq, ...order].map((value) => bind(value));
|
|
4358
4371
|
return insert(bind, into, columns, values);
|
|
4359
4372
|
}))];
|
|
4360
4373
|
});
|
|
4361
4374
|
switch (op.type) {
|
|
4362
|
-
case "insert": return [sql((bind) => insertRow(bind, op.row)), ...entries(rowKey(table, op.row), op.row)];
|
|
4375
|
+
case "insert": return [sql((bind) => insertRow(bind, op.row)), ...entries(rowKey(table, op.row), op.row, void 0, false)];
|
|
4363
4376
|
case "patch": return [sql((bind) => {
|
|
4364
4377
|
const set = Object.entries(op.set).map(([column, value]) => `${quote(column)} = ${bind(value, findPhysicalColumn(table, column))}`);
|
|
4365
4378
|
return `UPDATE ${name} SET ${[...set, `${version} = ${version} + 1`].join(", ")} WHERE ${where(bind, op.key, op.guard.v)}`;
|
|
@@ -17739,7 +17752,7 @@ const postgres = (config) => {
|
|
|
17739
17752
|
};
|
|
17740
17753
|
//#endregion
|
|
17741
17754
|
//#region ../../packages/server/dist/version.mjs
|
|
17742
|
-
const HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.
|
|
17755
|
+
const HOT_UPDATER_SERVER_VERSION = "1.2.0-rc.44";
|
|
17743
17756
|
//#endregion
|
|
17744
17757
|
//#region ../../packages/server/dist/handlerVersionRoutes.mjs
|
|
17745
17758
|
const createVersionRouteHandlers = (plugins = []) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hot-updater/vercel",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.2.0-rc.
|
|
4
|
+
"version": "1.2.0-rc.44",
|
|
5
5
|
"description": "React Native OTA solution for self-hosted",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
7
7
|
"module": "dist/index.mjs",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"@vercel/cli-auth": "0.3.10",
|
|
42
42
|
"@vercel/cli-config": "0.3.1",
|
|
43
43
|
"pg": "8.13.1",
|
|
44
|
-
"@hot-updater/
|
|
45
|
-
"@hot-updater/
|
|
46
|
-
"@hot-updater/
|
|
47
|
-
"@hot-updater/postgres": "1.2.0-rc.
|
|
48
|
-
"@hot-updater/
|
|
44
|
+
"@hot-updater/cli-tools": "1.2.0-rc.44",
|
|
45
|
+
"@hot-updater/protocol": "1.2.0-rc.44",
|
|
46
|
+
"@hot-updater/plugin-core": "1.2.0-rc.44",
|
|
47
|
+
"@hot-updater/postgres": "1.2.0-rc.44",
|
|
48
|
+
"@hot-updater/server": "1.2.0-rc.44"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^20",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"execa": "9.5.2",
|
|
55
55
|
"kysely": "0.28.17",
|
|
56
56
|
"vitest": "4.1.4",
|
|
57
|
-
"@hot-updater/test-utils": "1.2.0-rc.
|
|
57
|
+
"@hot-updater/test-utils": "1.2.0-rc.44"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"build": "tsdown",
|