@hot-updater/server 0.30.12 → 0.31.1
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/_virtual/_rolldown/runtime.cjs +25 -0
- package/dist/_virtual/_rolldown/runtime.mjs +6 -0
- package/dist/adapters/drizzle.cjs +6 -9
- package/dist/adapters/drizzle.d.cts +8 -1
- package/dist/adapters/drizzle.d.mts +8 -1
- package/dist/adapters/drizzle.mjs +5 -2
- package/dist/adapters/kysely.cjs +7 -9
- package/dist/adapters/kysely.d.cts +14 -1
- package/dist/adapters/kysely.d.mts +14 -1
- package/dist/adapters/kysely.mjs +6 -2
- package/dist/adapters/mongodb.cjs +7 -9
- package/dist/adapters/mongodb.d.cts +9 -1
- package/dist/adapters/mongodb.d.mts +9 -1
- package/dist/adapters/mongodb.mjs +5 -2
- package/dist/adapters/prisma.cjs +6 -9
- package/dist/adapters/prisma.d.cts +8 -1
- package/dist/adapters/prisma.d.mts +8 -1
- package/dist/adapters/prisma.mjs +5 -2
- package/dist/db/createBundleDiff.cjs +166 -0
- package/dist/db/createBundleDiff.d.cts +20 -0
- package/dist/db/createBundleDiff.d.mts +20 -0
- package/dist/db/createBundleDiff.mjs +161 -0
- package/dist/db/index.cjs +15 -16
- package/dist/db/index.d.cts +5 -4
- package/dist/db/index.d.mts +5 -4
- package/dist/db/index.mjs +14 -16
- package/dist/db/ormCore.cjs +173 -65
- package/dist/db/ormCore.d.cts +100 -34
- package/dist/db/ormCore.d.mts +100 -34
- package/dist/db/ormCore.mjs +171 -64
- package/dist/db/pluginCore.cjs +37 -3
- package/dist/db/pluginCore.mjs +36 -3
- package/dist/db/schemaEnhancements.cjs +171 -0
- package/dist/db/schemaEnhancements.mjs +167 -0
- package/dist/db/types.cjs +6 -0
- package/dist/db/types.d.cts +19 -7
- package/dist/db/types.d.mts +22 -10
- package/dist/db/types.mjs +6 -1
- package/dist/db/updateArtifacts.cjs +127 -0
- package/dist/db/updateArtifacts.mjs +125 -0
- package/dist/handler.cjs +61 -5
- package/dist/handler.d.cts +2 -2
- package/dist/handler.d.mts +5 -5
- package/dist/handler.mjs +59 -5
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +3 -2
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +2 -1
- package/dist/node.d.cts +0 -1
- package/dist/node.d.mts +0 -1
- package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/_u64.cjs +112 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/_u64.mjs +108 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/cryptoNode.cjs +22 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/cryptoNode.mjs +18 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/sha3.cjs +219 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/sha3.mjs +214 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/utils.cjs +275 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/utils.mjs +270 -0
- package/dist/node_modules/.pnpm/@paralleldrive_cuid2@2.3.1/node_modules/@paralleldrive/cuid2/index.cjs +17 -0
- package/dist/node_modules/.pnpm/@paralleldrive_cuid2@2.3.1/node_modules/@paralleldrive/cuid2/index.mjs +13 -0
- package/dist/node_modules/.pnpm/@paralleldrive_cuid2@2.3.1/node_modules/@paralleldrive/cuid2/src/index.cjs +69 -0
- package/dist/node_modules/.pnpm/@paralleldrive_cuid2@2.3.1/node_modules/@paralleldrive/cuid2/src/index.mjs +65 -0
- package/dist/node_modules/.pnpm/drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pglite@0.2.17_@_31f44b782f9321d71f3ce9d35aa1edf7/node_modules/drizzle-orm/column.cjs +52 -0
- package/dist/node_modules/.pnpm/drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pglite@0.2.17_@_31f44b782f9321d71f3ce9d35aa1edf7/node_modules/drizzle-orm/column.mjs +52 -0
- package/dist/node_modules/.pnpm/drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pglite@0.2.17_@_31f44b782f9321d71f3ce9d35aa1edf7/node_modules/drizzle-orm/entity.cjs +16 -0
- package/dist/node_modules/.pnpm/drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pglite@0.2.17_@_31f44b782f9321d71f3ce9d35aa1edf7/node_modules/drizzle-orm/entity.mjs +15 -0
- package/dist/node_modules/.pnpm/drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pglite@0.2.17_@_31f44b782f9321d71f3ce9d35aa1edf7/node_modules/drizzle-orm/pg-core/columns/enum.cjs +7 -0
- package/dist/node_modules/.pnpm/drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pglite@0.2.17_@_31f44b782f9321d71f3ce9d35aa1edf7/node_modules/drizzle-orm/pg-core/columns/enum.mjs +7 -0
- package/dist/node_modules/.pnpm/drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pglite@0.2.17_@_31f44b782f9321d71f3ce9d35aa1edf7/node_modules/drizzle-orm/sql/expressions/conditions.cjs +92 -0
- package/dist/node_modules/.pnpm/drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pglite@0.2.17_@_31f44b782f9321d71f3ce9d35aa1edf7/node_modules/drizzle-orm/sql/expressions/conditions.mjs +78 -0
- package/dist/node_modules/.pnpm/drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pglite@0.2.17_@_31f44b782f9321d71f3ce9d35aa1edf7/node_modules/drizzle-orm/sql/expressions/select.cjs +11 -0
- package/dist/node_modules/.pnpm/drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pglite@0.2.17_@_31f44b782f9321d71f3ce9d35aa1edf7/node_modules/drizzle-orm/sql/expressions/select.mjs +10 -0
- package/dist/node_modules/.pnpm/drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pglite@0.2.17_@_31f44b782f9321d71f3ce9d35aa1edf7/node_modules/drizzle-orm/sql/sql.cjs +383 -0
- package/dist/node_modules/.pnpm/drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pglite@0.2.17_@_31f44b782f9321d71f3ce9d35aa1edf7/node_modules/drizzle-orm/sql/sql.mjs +366 -0
- package/dist/node_modules/.pnpm/drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pglite@0.2.17_@_31f44b782f9321d71f3ce9d35aa1edf7/node_modules/drizzle-orm/subquery.cjs +17 -0
- package/dist/node_modules/.pnpm/drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pglite@0.2.17_@_31f44b782f9321d71f3ce9d35aa1edf7/node_modules/drizzle-orm/subquery.mjs +17 -0
- package/dist/node_modules/.pnpm/drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pglite@0.2.17_@_31f44b782f9321d71f3ce9d35aa1edf7/node_modules/drizzle-orm/table.cjs +60 -0
- package/dist/node_modules/.pnpm/drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pglite@0.2.17_@_31f44b782f9321d71f3ce9d35aa1edf7/node_modules/drizzle-orm/table.mjs +59 -0
- package/dist/node_modules/.pnpm/drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pglite@0.2.17_@_31f44b782f9321d71f3ce9d35aa1edf7/node_modules/drizzle-orm/table.utils.cjs +4 -0
- package/dist/node_modules/.pnpm/drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pglite@0.2.17_@_31f44b782f9321d71f3ce9d35aa1edf7/node_modules/drizzle-orm/table.utils.mjs +4 -0
- package/dist/node_modules/.pnpm/drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pglite@0.2.17_@_31f44b782f9321d71f3ce9d35aa1edf7/node_modules/drizzle-orm/tracing.cjs +6 -0
- package/dist/node_modules/.pnpm/drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pglite@0.2.17_@_31f44b782f9321d71f3ce9d35aa1edf7/node_modules/drizzle-orm/tracing.mjs +6 -0
- package/dist/node_modules/.pnpm/drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pglite@0.2.17_@_31f44b782f9321d71f3ce9d35aa1edf7/node_modules/drizzle-orm/view-common.cjs +4 -0
- package/dist/node_modules/.pnpm/drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pglite@0.2.17_@_31f44b782f9321d71f3ce9d35aa1edf7/node_modules/drizzle-orm/view-common.mjs +4 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/adapters/drizzle/index.cjs +383 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/adapters/drizzle/index.d.cts +12 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/adapters/drizzle/index.d.mts +12 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/adapters/drizzle/index.mjs +383 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/adapters/kysely/index.cjs +4 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/adapters/kysely/index.mjs +5 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/adapters/prisma/index.cjs +339 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/adapters/prisma/index.d.cts +70 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/adapters/prisma/index.d.mts +70 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/adapters/prisma/index.mjs +339 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/chunk-7PZK4ONR.cjs +57 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/chunk-7PZK4ONR.mjs +56 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/chunk-C6OTUURW.cjs +330 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/chunk-C6OTUURW.mjs +326 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/chunk-CHTIKPQU.cjs +166 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/chunk-CHTIKPQU.mjs +163 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/chunk-GUE4GMNC.cjs +14 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/chunk-GUE4GMNC.mjs +13 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/chunk-LHHP6UVP.cjs +24 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/chunk-LHHP6UVP.mjs +24 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/chunk-LVCPMTAT.cjs +1190 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/chunk-LVCPMTAT.mjs +1189 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/chunk-PK2W2SQ7.cjs +197 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/chunk-PK2W2SQ7.mjs +197 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/chunk-ZEQMAIFI.cjs +410 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/chunk-ZEQMAIFI.mjs +400 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/chunk-ZOCGSAWS.cjs +213 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/chunk-ZOCGSAWS.mjs +212 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/create-tg0451Y_.d.cts +285 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/create-tg0451Y_.d.mts +285 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/index-CMqePMTF.d.cts +45 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/index-CMqePMTF.d.mts +45 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/index.cjs +69 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/index.d.cts +49 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/index.d.mts +49 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/index.mjs +67 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/query/index.d.cts +156 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/query/index.d.mts +156 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/schema/index.cjs +1 -0
- package/dist/node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/schema/index.mjs +2 -0
- package/dist/{package.cjs → packages/server/package.cjs} +1 -1
- package/dist/{package.mjs → packages/server/package.mjs} +1 -1
- package/dist/runtime.cjs +13 -13
- package/dist/runtime.d.cts +4 -4
- package/dist/runtime.d.mts +4 -4
- package/dist/runtime.mjs +12 -13
- package/dist/schema/v0_21_0.cjs +16 -15
- package/dist/schema/v0_21_0.mjs +3 -2
- package/dist/schema/v0_29_0.cjs +18 -17
- package/dist/schema/v0_29_0.mjs +3 -2
- package/dist/schema/v0_31_0.cjs +48 -0
- package/dist/schema/v0_31_0.mjs +48 -0
- package/dist/storageAccess.cjs +44 -0
- package/dist/storageAccess.mjs +44 -0
- package/dist/version.cjs +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +15 -7
- package/src/adapters/drizzle.ts +15 -1
- package/src/adapters/kysely.ts +24 -1
- package/src/adapters/mongodb.ts +19 -1
- package/src/adapters/prisma.ts +15 -1
- package/src/db/createBundleDiff.spec.ts +402 -0
- package/src/db/createBundleDiff.ts +375 -0
- package/src/db/index.spec.ts +528 -27
- package/src/db/index.ts +22 -36
- package/src/db/ormCore.ts +308 -75
- package/src/db/pluginCore.spec.ts +385 -0
- package/src/db/pluginCore.ts +45 -4
- package/src/db/schemaEnhancements.ts +460 -0
- package/src/db/types.ts +38 -7
- package/src/db/updateArtifacts.ts +388 -0
- package/src/handler-standalone.integration.spec.ts +1 -0
- package/src/handler.spec.ts +121 -0
- package/src/handler.ts +117 -5
- package/src/runtime.spec.ts +287 -55
- package/src/runtime.ts +21 -37
- package/src/schema/v0_21_0.ts +1 -1
- package/src/schema/v0_29_0.ts +1 -1
- package/src/schema/v0_31_0.ts +58 -0
- package/src/storageAccess.spec.ts +57 -0
- package/src/storageAccess.ts +90 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
+
value: mod,
|
|
21
|
+
enumerable: true
|
|
22
|
+
}) : target, mod));
|
|
23
|
+
//#endregion
|
|
24
|
+
exports.__commonJSMin = __commonJSMin;
|
|
25
|
+
exports.__toESM = __toESM;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
4
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
5
|
+
//#endregion
|
|
6
|
+
export { __commonJSMin, __require };
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
});
|
|
9
|
-
});
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_index = require("../node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/adapters/drizzle/index.cjs");
|
|
3
|
+
//#region src/adapters/drizzle.ts
|
|
4
|
+
const drizzleAdapter = (config) => Object.assign(require_index.drizzleAdapter(config), { provider: config.provider });
|
|
5
|
+
//#endregion
|
|
6
|
+
exports.drizzleAdapter = drizzleAdapter;
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { drizzleAdapter as drizzleAdapter$1 } from "../node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/adapters/drizzle/index.cjs";
|
|
2
|
+
import { ORMDatabaseAdapter } from "../db/types.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/adapters/drizzle.d.ts
|
|
5
|
+
type DrizzleConfig = Parameters<typeof drizzleAdapter$1>[0];
|
|
6
|
+
declare const drizzleAdapter: (config: DrizzleConfig) => ORMDatabaseAdapter;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { DrizzleConfig, drizzleAdapter };
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { drizzleAdapter as drizzleAdapter$1 } from "../node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/adapters/drizzle/index.mjs";
|
|
2
|
+
import { ORMDatabaseAdapter } from "../db/types.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/adapters/drizzle.d.ts
|
|
5
|
+
type DrizzleConfig = Parameters<typeof drizzleAdapter$1>[0];
|
|
6
|
+
declare const drizzleAdapter: (config: DrizzleConfig) => ORMDatabaseAdapter;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { DrizzleConfig, drizzleAdapter };
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { drizzleAdapter as drizzleAdapter$1 } from "../node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/adapters/drizzle/index.mjs";
|
|
2
|
+
//#region src/adapters/drizzle.ts
|
|
3
|
+
const drizzleAdapter = (config) => Object.assign(drizzleAdapter$1(config), { provider: config.provider });
|
|
4
|
+
//#endregion
|
|
5
|
+
export { drizzleAdapter };
|
package/dist/adapters/kysely.cjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
});
|
|
9
|
-
});
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_chunk_LVCPMTAT = require("../node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/chunk-LVCPMTAT.cjs");
|
|
3
|
+
require("../node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/adapters/kysely/index.cjs");
|
|
4
|
+
//#region src/adapters/kysely.ts
|
|
5
|
+
const kyselyAdapter = (config) => Object.assign(require_chunk_LVCPMTAT.kyselyAdapter(config), { provider: config.provider });
|
|
6
|
+
//#endregion
|
|
7
|
+
exports.kyselyAdapter = kyselyAdapter;
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { RelationMode as RelationMode$1, SQLProvider as SQLProvider$1 } from "../node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/index-CMqePMTF.cjs";
|
|
2
|
+
import { ORMDatabaseAdapter } from "../db/types.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/adapters/kysely.d.ts
|
|
5
|
+
type RelationMode = RelationMode$1;
|
|
6
|
+
type SQLProvider = SQLProvider$1;
|
|
7
|
+
interface KyselyConfig<TDatabase extends object = object> {
|
|
8
|
+
db: TDatabase;
|
|
9
|
+
provider: SQLProvider;
|
|
10
|
+
relationMode?: RelationMode;
|
|
11
|
+
}
|
|
12
|
+
declare const kyselyAdapter: <TDatabase extends object>(config: KyselyConfig<TDatabase>) => ORMDatabaseAdapter;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { KyselyConfig, RelationMode, SQLProvider, kyselyAdapter };
|
|
@@ -1 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { RelationMode as RelationMode$1, SQLProvider as SQLProvider$1 } from "../node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/index-CMqePMTF.mjs";
|
|
2
|
+
import { ORMDatabaseAdapter } from "../db/types.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/adapters/kysely.d.ts
|
|
5
|
+
type RelationMode = RelationMode$1;
|
|
6
|
+
type SQLProvider = SQLProvider$1;
|
|
7
|
+
interface KyselyConfig<TDatabase extends object = object> {
|
|
8
|
+
db: TDatabase;
|
|
9
|
+
provider: SQLProvider;
|
|
10
|
+
relationMode?: RelationMode;
|
|
11
|
+
}
|
|
12
|
+
declare const kyselyAdapter: <TDatabase extends object>(config: KyselyConfig<TDatabase>) => ORMDatabaseAdapter;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { KyselyConfig, RelationMode, SQLProvider, kyselyAdapter };
|
package/dist/adapters/kysely.mjs
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { kyselyAdapter as kyselyAdapter$1 } from "../node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/chunk-LVCPMTAT.mjs";
|
|
2
|
+
import "../node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/adapters/kysely/index.mjs";
|
|
3
|
+
//#region src/adapters/kysely.ts
|
|
4
|
+
const kyselyAdapter = (config) => Object.assign(kyselyAdapter$1(config), { provider: config.provider });
|
|
5
|
+
//#endregion
|
|
6
|
+
export { kyselyAdapter };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
});
|
|
9
|
-
});
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
require("../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
let fumadb_adapters_mongodb = require("fumadb/adapters/mongodb");
|
|
4
|
+
//#region src/adapters/mongodb.ts
|
|
5
|
+
const mongoAdapter = (options) => Object.assign((0, fumadb_adapters_mongodb.mongoAdapter)(options), { provider: "mongodb" });
|
|
6
|
+
//#endregion
|
|
7
|
+
exports.mongoAdapter = mongoAdapter;
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { ORMDatabaseAdapter } from "../db/types.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/adapters/mongodb.d.ts
|
|
4
|
+
interface MongoDBConfig<TClient extends object = object> {
|
|
5
|
+
client: TClient;
|
|
6
|
+
}
|
|
7
|
+
declare const mongoAdapter: <TClient extends object>(options: MongoDBConfig<TClient>) => ORMDatabaseAdapter;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { MongoDBConfig, mongoAdapter };
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { ORMDatabaseAdapter } from "../db/types.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/adapters/mongodb.d.ts
|
|
4
|
+
interface MongoDBConfig<TClient extends object = object> {
|
|
5
|
+
client: TClient;
|
|
6
|
+
}
|
|
7
|
+
declare const mongoAdapter: <TClient extends object>(options: MongoDBConfig<TClient>) => ORMDatabaseAdapter;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { MongoDBConfig, mongoAdapter };
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { mongoAdapter as mongoAdapter$1 } from "fumadb/adapters/mongodb";
|
|
2
|
+
//#region src/adapters/mongodb.ts
|
|
3
|
+
const mongoAdapter = (options) => Object.assign(mongoAdapter$1(options), { provider: "mongodb" });
|
|
4
|
+
//#endregion
|
|
5
|
+
export { mongoAdapter };
|
package/dist/adapters/prisma.cjs
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
});
|
|
9
|
-
});
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_index = require("../node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/adapters/prisma/index.cjs");
|
|
3
|
+
//#region src/adapters/prisma.ts
|
|
4
|
+
const prismaAdapter = (config) => Object.assign(require_index.prismaAdapter(config), { provider: config.provider });
|
|
5
|
+
//#endregion
|
|
6
|
+
exports.prismaAdapter = prismaAdapter;
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { ORMDatabaseAdapter } from "../db/types.cjs";
|
|
2
|
+
import { prismaAdapter as prismaAdapter$1 } from "../node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/adapters/prisma/index.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/adapters/prisma.d.ts
|
|
5
|
+
type PrismaConfig = Parameters<typeof prismaAdapter$1>[0];
|
|
6
|
+
declare const prismaAdapter: (config: PrismaConfig) => ORMDatabaseAdapter;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { PrismaConfig, prismaAdapter };
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { ORMDatabaseAdapter } from "../db/types.mjs";
|
|
2
|
+
import { prismaAdapter as prismaAdapter$1 } from "../node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/adapters/prisma/index.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/adapters/prisma.d.ts
|
|
5
|
+
type PrismaConfig = Parameters<typeof prismaAdapter$1>[0];
|
|
6
|
+
declare const prismaAdapter: (config: PrismaConfig) => ORMDatabaseAdapter;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { PrismaConfig, prismaAdapter };
|
package/dist/adapters/prisma.mjs
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { prismaAdapter as prismaAdapter$1 } from "../node_modules/.pnpm/fumadb@0.2.2_drizzle-orm@0.44.7_@cloudflare_workers-types@4.20260313.1_@electric-sql_pg_c72c8c754becd21f6d6662e8fbd28e7f/node_modules/fumadb/dist/adapters/prisma/index.mjs";
|
|
2
|
+
//#region src/adapters/prisma.ts
|
|
3
|
+
const prismaAdapter = (config) => Object.assign(prismaAdapter$1(config), { provider: config.provider });
|
|
4
|
+
//#endregion
|
|
5
|
+
export { prismaAdapter };
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
let node_crypto = require("node:crypto");
|
|
3
|
+
node_crypto = require_runtime.__toESM(node_crypto);
|
|
4
|
+
let node_fs_promises = require("node:fs/promises");
|
|
5
|
+
node_fs_promises = require_runtime.__toESM(node_fs_promises);
|
|
6
|
+
let node_os = require("node:os");
|
|
7
|
+
node_os = require_runtime.__toESM(node_os);
|
|
8
|
+
let node_path = require("node:path");
|
|
9
|
+
node_path = require_runtime.__toESM(node_path);
|
|
10
|
+
let node_util = require("node:util");
|
|
11
|
+
let node_zlib = require("node:zlib");
|
|
12
|
+
let _hot_updater_bsdiff = require("@hot-updater/bsdiff");
|
|
13
|
+
let _hot_updater_core = require("@hot-updater/core");
|
|
14
|
+
//#region src/db/createBundleDiff.ts
|
|
15
|
+
const HBC_ASSET_PATH_RE = /\.bundle$/;
|
|
16
|
+
const BR_COMPRESSED_ASSET_PATH_RE = /(^|\/)index\.[^/]+\.bundle$/;
|
|
17
|
+
const HOT_UPDATER_DOWNLOAD_DIR_PREFIX = "downloads-";
|
|
18
|
+
const decompressBrotli = (0, node_util.promisify)(node_zlib.brotliDecompress);
|
|
19
|
+
const isBundleManifest = (value) => {
|
|
20
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
21
|
+
const manifest = value;
|
|
22
|
+
if (typeof manifest.bundleId !== "string") return false;
|
|
23
|
+
if (!manifest.assets || typeof manifest.assets !== "object") return false;
|
|
24
|
+
return Object.values(manifest.assets).every((asset) => {
|
|
25
|
+
if (!asset || typeof asset !== "object" || Array.isArray(asset)) return false;
|
|
26
|
+
const manifestAsset = asset;
|
|
27
|
+
return typeof manifestAsset.fileHash === "string" && (manifestAsset.signature === void 0 || typeof manifestAsset.signature === "string");
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
const createChildStorageUri = (baseStorageUri, relativePath) => {
|
|
31
|
+
const baseUrl = new URL(baseStorageUri);
|
|
32
|
+
baseUrl.pathname = `${baseUrl.pathname.replace(/\/+$/, "")}/${relativePath.split("/").filter(Boolean).map((segment) => encodeURIComponent(segment)).join("/")}`;
|
|
33
|
+
return baseUrl.toString();
|
|
34
|
+
};
|
|
35
|
+
const getRelativeStorageDir = (relativePath) => {
|
|
36
|
+
const normalized = relativePath.replace(/\\/g, "/");
|
|
37
|
+
const dirname = node_path.default.posix.dirname(normalized);
|
|
38
|
+
return dirname === "." ? "" : dirname;
|
|
39
|
+
};
|
|
40
|
+
async function downloadFromUrl(url) {
|
|
41
|
+
const response = await fetch(url);
|
|
42
|
+
if (!response.ok) throw new Error(`Failed to download storage object: ${response.status}`);
|
|
43
|
+
return new Uint8Array(await response.arrayBuffer());
|
|
44
|
+
}
|
|
45
|
+
async function downloadStorageBytes(storageUri, storagePlugin) {
|
|
46
|
+
const protocol = new URL(storageUri).protocol.replace(":", "");
|
|
47
|
+
if (protocol === "http" || protocol === "https") return downloadFromUrl(storageUri);
|
|
48
|
+
if (!storagePlugin) throw new Error("Storage plugin is not configured");
|
|
49
|
+
if (storagePlugin.supportedProtocol !== protocol) throw new Error(`No storage plugin for protocol: ${protocol}`);
|
|
50
|
+
const downloadRoot = node_path.default.join(process.cwd(), ".hot-updater");
|
|
51
|
+
await node_fs_promises.default.mkdir(downloadRoot, { recursive: true });
|
|
52
|
+
const workDir = await node_fs_promises.default.mkdtemp(node_path.default.join(downloadRoot, HOT_UPDATER_DOWNLOAD_DIR_PREFIX));
|
|
53
|
+
const filename = node_path.default.basename(new URL(storageUri).pathname) || (0, node_crypto.randomUUID)();
|
|
54
|
+
const filePath = node_path.default.join(workDir, filename);
|
|
55
|
+
try {
|
|
56
|
+
await storagePlugin.profiles.node.downloadFile(storageUri, filePath);
|
|
57
|
+
return new Uint8Array(await node_fs_promises.default.readFile(filePath));
|
|
58
|
+
} finally {
|
|
59
|
+
await node_fs_promises.default.rm(workDir, {
|
|
60
|
+
force: true,
|
|
61
|
+
recursive: true
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async function fetchManifest(bundle, storagePlugin) {
|
|
66
|
+
const manifestStorageUri = (0, _hot_updater_core.getManifestStorageUri)(bundle);
|
|
67
|
+
if (!manifestStorageUri) throw new Error(`Bundle ${bundle.id} does not have manifest metadata`);
|
|
68
|
+
const manifestBytes = await downloadStorageBytes(manifestStorageUri, storagePlugin);
|
|
69
|
+
const payload = JSON.parse(new TextDecoder().decode(manifestBytes));
|
|
70
|
+
if (!isBundleManifest(payload)) throw new Error(`Invalid manifest payload for bundle ${bundle.id}`);
|
|
71
|
+
return payload;
|
|
72
|
+
}
|
|
73
|
+
function resolveHbcAssetPath(manifest) {
|
|
74
|
+
const candidates = Object.keys(manifest.assets).sort((left, right) => left.localeCompare(right)).filter((candidate) => HBC_ASSET_PATH_RE.test(candidate));
|
|
75
|
+
if (candidates.length === 0) throw new Error("No Hermes bundle asset found in manifest");
|
|
76
|
+
if (candidates.length > 1) throw new Error(`Expected exactly one Hermes bundle asset in manifest, found ${candidates.length}: ${candidates.join(", ")}`);
|
|
77
|
+
return candidates[0];
|
|
78
|
+
}
|
|
79
|
+
async function fetchAssetBytes(bundle, assetPath, storagePlugin) {
|
|
80
|
+
const assetBaseStorageUri = (0, _hot_updater_core.getAssetBaseStorageUri)(bundle);
|
|
81
|
+
if (!assetBaseStorageUri) throw new Error(`Bundle ${bundle.id} does not have asset storage metadata`);
|
|
82
|
+
if (BR_COMPRESSED_ASSET_PATH_RE.test(assetPath)) {
|
|
83
|
+
const compressedAssetStorageUri = createChildStorageUri(assetBaseStorageUri, `${assetPath}.br`);
|
|
84
|
+
let compressedBytes = null;
|
|
85
|
+
try {
|
|
86
|
+
compressedBytes = await downloadStorageBytes(compressedAssetStorageUri, storagePlugin);
|
|
87
|
+
} catch {}
|
|
88
|
+
if (compressedBytes) return new Uint8Array(await decompressBrotli(compressedBytes));
|
|
89
|
+
}
|
|
90
|
+
return downloadStorageBytes(createChildStorageUri(assetBaseStorageUri, assetPath), storagePlugin);
|
|
91
|
+
}
|
|
92
|
+
async function getFileHash(filePath) {
|
|
93
|
+
const file = await node_fs_promises.default.readFile(filePath);
|
|
94
|
+
return node_crypto.default.createHash("sha256").update(file).digest("hex");
|
|
95
|
+
}
|
|
96
|
+
function buildNextPatchState({ currentBundle, nextPatch, makePrimary }) {
|
|
97
|
+
const existingPatches = (0, _hot_updater_core.getBundlePatches)(currentBundle).filter((patch) => patch.baseBundleId !== nextPatch.baseBundleId);
|
|
98
|
+
const orderedPatches = makePrimary ? [nextPatch, ...existingPatches] : [...existingPatches, nextPatch];
|
|
99
|
+
return {
|
|
100
|
+
patches: orderedPatches,
|
|
101
|
+
primaryPatch: orderedPatches[0] ?? nextPatch
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
async function createBundleDiff({ baseBundleId, bundleId }, deps, options = {}) {
|
|
105
|
+
if (!deps.storagePlugin) throw new Error("Storage plugin is not configured");
|
|
106
|
+
if (baseBundleId === bundleId) throw new Error("Base bundle must be different from the target bundle");
|
|
107
|
+
const baseBundle = await deps.databasePlugin.getBundleById(baseBundleId);
|
|
108
|
+
const targetBundle = await deps.databasePlugin.getBundleById(bundleId);
|
|
109
|
+
if (!baseBundle || !targetBundle) throw new Error("Bundle not found");
|
|
110
|
+
if (baseBundle.platform !== targetBundle.platform) throw new Error("Base bundle platform must match the target bundle");
|
|
111
|
+
if (baseBundle.id.localeCompare(targetBundle.id) >= 0) throw new Error("Base bundle must be older than the target bundle");
|
|
112
|
+
const [baseManifest, targetManifest] = await Promise.all([fetchManifest(baseBundle, deps.storagePlugin), fetchManifest(targetBundle, deps.storagePlugin)]);
|
|
113
|
+
const baseAssetPath = resolveHbcAssetPath(baseManifest);
|
|
114
|
+
const targetAssetPath = resolveHbcAssetPath(targetManifest);
|
|
115
|
+
if (baseAssetPath !== targetAssetPath) throw new Error("Base and target Hermes asset paths do not match");
|
|
116
|
+
const baseAssetHash = baseManifest.assets[baseAssetPath]?.fileHash;
|
|
117
|
+
const targetAssetHash = targetManifest.assets[targetAssetPath]?.fileHash;
|
|
118
|
+
if (!baseAssetHash || !targetAssetHash) throw new Error("Hermes asset hash is missing from manifest");
|
|
119
|
+
if (baseAssetHash === targetAssetHash) throw new Error("Hermes bundle is unchanged; no diff patch is required");
|
|
120
|
+
const [baseBytes, targetBytes] = await Promise.all([fetchAssetBytes(baseBundle, baseAssetPath, deps.storagePlugin), fetchAssetBytes(targetBundle, targetAssetPath, deps.storagePlugin)]);
|
|
121
|
+
const patchBytes = await (0, _hot_updater_bsdiff.hdiff)(baseBytes, targetBytes);
|
|
122
|
+
const workDir = await node_fs_promises.default.mkdtemp(node_path.default.join(node_os.default.tmpdir(), "hot-updater-console-bsdiff-"));
|
|
123
|
+
const patchFilename = `${node_path.default.posix.basename(targetAssetPath)}.bsdiff`;
|
|
124
|
+
const patchPath = node_path.default.join(workDir, patchFilename);
|
|
125
|
+
const previousPatch = (0, _hot_updater_core.getBundlePatch)(targetBundle, baseBundle.id);
|
|
126
|
+
try {
|
|
127
|
+
await node_fs_promises.default.writeFile(patchPath, patchBytes);
|
|
128
|
+
const uploadKey = [
|
|
129
|
+
targetBundle.id,
|
|
130
|
+
"patches",
|
|
131
|
+
baseBundle.id,
|
|
132
|
+
getRelativeStorageDir(targetAssetPath)
|
|
133
|
+
].filter(Boolean).join("/");
|
|
134
|
+
const patchUpload = await deps.storagePlugin.profiles.node.upload(uploadKey, patchPath);
|
|
135
|
+
const patchFileHash = await getFileHash(patchPath);
|
|
136
|
+
const nextState = buildNextPatchState({
|
|
137
|
+
currentBundle: targetBundle,
|
|
138
|
+
nextPatch: {
|
|
139
|
+
baseBundleId: baseBundle.id,
|
|
140
|
+
baseFileHash: baseAssetHash,
|
|
141
|
+
patchFileHash,
|
|
142
|
+
patchStorageUri: patchUpload.storageUri
|
|
143
|
+
},
|
|
144
|
+
makePrimary: options.makePrimary ?? true
|
|
145
|
+
});
|
|
146
|
+
await deps.databasePlugin.updateBundle(targetBundle.id, {
|
|
147
|
+
patches: nextState.patches,
|
|
148
|
+
patchBaseBundleId: nextState.primaryPatch.baseBundleId,
|
|
149
|
+
patchBaseFileHash: nextState.primaryPatch.baseFileHash,
|
|
150
|
+
patchFileHash: nextState.primaryPatch.patchFileHash,
|
|
151
|
+
patchStorageUri: nextState.primaryPatch.patchStorageUri
|
|
152
|
+
});
|
|
153
|
+
await deps.databasePlugin.commitBundle();
|
|
154
|
+
if (previousPatch?.patchStorageUri && previousPatch.patchStorageUri !== patchUpload.storageUri) await deps.storagePlugin.profiles.node.delete(previousPatch.patchStorageUri).catch(() => {});
|
|
155
|
+
const updatedBundle = await deps.databasePlugin.getBundleById(targetBundle.id);
|
|
156
|
+
if (!updatedBundle) throw new Error("Updated bundle not found");
|
|
157
|
+
return updatedBundle;
|
|
158
|
+
} finally {
|
|
159
|
+
await node_fs_promises.default.rm(workDir, {
|
|
160
|
+
force: true,
|
|
161
|
+
recursive: true
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
166
|
+
exports.createBundleDiff = createBundleDiff;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Bundle, DatabasePlugin, NodeStoragePlugin } from "@hot-updater/plugin-core";
|
|
2
|
+
|
|
3
|
+
//#region src/db/createBundleDiff.d.ts
|
|
4
|
+
interface CreateBundleDiffInput {
|
|
5
|
+
baseBundleId: string;
|
|
6
|
+
bundleId: string;
|
|
7
|
+
}
|
|
8
|
+
interface CreateBundleDiffDependencies {
|
|
9
|
+
databasePlugin: DatabasePlugin;
|
|
10
|
+
storagePlugin: NodeStoragePlugin | null;
|
|
11
|
+
}
|
|
12
|
+
interface CreateBundleDiffOptions {
|
|
13
|
+
makePrimary?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare function createBundleDiff({
|
|
16
|
+
baseBundleId,
|
|
17
|
+
bundleId
|
|
18
|
+
}: CreateBundleDiffInput, deps: CreateBundleDiffDependencies, options?: CreateBundleDiffOptions): Promise<Bundle>;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { CreateBundleDiffDependencies, CreateBundleDiffInput, CreateBundleDiffOptions, createBundleDiff };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Bundle, DatabasePlugin, NodeStoragePlugin } from "@hot-updater/plugin-core";
|
|
2
|
+
|
|
3
|
+
//#region src/db/createBundleDiff.d.ts
|
|
4
|
+
interface CreateBundleDiffInput {
|
|
5
|
+
baseBundleId: string;
|
|
6
|
+
bundleId: string;
|
|
7
|
+
}
|
|
8
|
+
interface CreateBundleDiffDependencies {
|
|
9
|
+
databasePlugin: DatabasePlugin;
|
|
10
|
+
storagePlugin: NodeStoragePlugin | null;
|
|
11
|
+
}
|
|
12
|
+
interface CreateBundleDiffOptions {
|
|
13
|
+
makePrimary?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare function createBundleDiff({
|
|
16
|
+
baseBundleId,
|
|
17
|
+
bundleId
|
|
18
|
+
}: CreateBundleDiffInput, deps: CreateBundleDiffDependencies, options?: CreateBundleDiffOptions): Promise<Bundle>;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { CreateBundleDiffDependencies, CreateBundleDiffInput, CreateBundleDiffOptions, createBundleDiff };
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import crypto, { randomUUID } from "node:crypto";
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { promisify } from "node:util";
|
|
6
|
+
import { brotliDecompress } from "node:zlib";
|
|
7
|
+
import { hdiff } from "@hot-updater/bsdiff";
|
|
8
|
+
import { getAssetBaseStorageUri, getBundlePatch, getBundlePatches, getManifestStorageUri } from "@hot-updater/core";
|
|
9
|
+
//#region src/db/createBundleDiff.ts
|
|
10
|
+
const HBC_ASSET_PATH_RE = /\.bundle$/;
|
|
11
|
+
const BR_COMPRESSED_ASSET_PATH_RE = /(^|\/)index\.[^/]+\.bundle$/;
|
|
12
|
+
const HOT_UPDATER_DOWNLOAD_DIR_PREFIX = "downloads-";
|
|
13
|
+
const decompressBrotli = promisify(brotliDecompress);
|
|
14
|
+
const isBundleManifest = (value) => {
|
|
15
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
16
|
+
const manifest = value;
|
|
17
|
+
if (typeof manifest.bundleId !== "string") return false;
|
|
18
|
+
if (!manifest.assets || typeof manifest.assets !== "object") return false;
|
|
19
|
+
return Object.values(manifest.assets).every((asset) => {
|
|
20
|
+
if (!asset || typeof asset !== "object" || Array.isArray(asset)) return false;
|
|
21
|
+
const manifestAsset = asset;
|
|
22
|
+
return typeof manifestAsset.fileHash === "string" && (manifestAsset.signature === void 0 || typeof manifestAsset.signature === "string");
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
const createChildStorageUri = (baseStorageUri, relativePath) => {
|
|
26
|
+
const baseUrl = new URL(baseStorageUri);
|
|
27
|
+
baseUrl.pathname = `${baseUrl.pathname.replace(/\/+$/, "")}/${relativePath.split("/").filter(Boolean).map((segment) => encodeURIComponent(segment)).join("/")}`;
|
|
28
|
+
return baseUrl.toString();
|
|
29
|
+
};
|
|
30
|
+
const getRelativeStorageDir = (relativePath) => {
|
|
31
|
+
const normalized = relativePath.replace(/\\/g, "/");
|
|
32
|
+
const dirname = path.posix.dirname(normalized);
|
|
33
|
+
return dirname === "." ? "" : dirname;
|
|
34
|
+
};
|
|
35
|
+
async function downloadFromUrl(url) {
|
|
36
|
+
const response = await fetch(url);
|
|
37
|
+
if (!response.ok) throw new Error(`Failed to download storage object: ${response.status}`);
|
|
38
|
+
return new Uint8Array(await response.arrayBuffer());
|
|
39
|
+
}
|
|
40
|
+
async function downloadStorageBytes(storageUri, storagePlugin) {
|
|
41
|
+
const protocol = new URL(storageUri).protocol.replace(":", "");
|
|
42
|
+
if (protocol === "http" || protocol === "https") return downloadFromUrl(storageUri);
|
|
43
|
+
if (!storagePlugin) throw new Error("Storage plugin is not configured");
|
|
44
|
+
if (storagePlugin.supportedProtocol !== protocol) throw new Error(`No storage plugin for protocol: ${protocol}`);
|
|
45
|
+
const downloadRoot = path.join(process.cwd(), ".hot-updater");
|
|
46
|
+
await fs.mkdir(downloadRoot, { recursive: true });
|
|
47
|
+
const workDir = await fs.mkdtemp(path.join(downloadRoot, HOT_UPDATER_DOWNLOAD_DIR_PREFIX));
|
|
48
|
+
const filename = path.basename(new URL(storageUri).pathname) || randomUUID();
|
|
49
|
+
const filePath = path.join(workDir, filename);
|
|
50
|
+
try {
|
|
51
|
+
await storagePlugin.profiles.node.downloadFile(storageUri, filePath);
|
|
52
|
+
return new Uint8Array(await fs.readFile(filePath));
|
|
53
|
+
} finally {
|
|
54
|
+
await fs.rm(workDir, {
|
|
55
|
+
force: true,
|
|
56
|
+
recursive: true
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async function fetchManifest(bundle, storagePlugin) {
|
|
61
|
+
const manifestStorageUri = getManifestStorageUri(bundle);
|
|
62
|
+
if (!manifestStorageUri) throw new Error(`Bundle ${bundle.id} does not have manifest metadata`);
|
|
63
|
+
const manifestBytes = await downloadStorageBytes(manifestStorageUri, storagePlugin);
|
|
64
|
+
const payload = JSON.parse(new TextDecoder().decode(manifestBytes));
|
|
65
|
+
if (!isBundleManifest(payload)) throw new Error(`Invalid manifest payload for bundle ${bundle.id}`);
|
|
66
|
+
return payload;
|
|
67
|
+
}
|
|
68
|
+
function resolveHbcAssetPath(manifest) {
|
|
69
|
+
const candidates = Object.keys(manifest.assets).sort((left, right) => left.localeCompare(right)).filter((candidate) => HBC_ASSET_PATH_RE.test(candidate));
|
|
70
|
+
if (candidates.length === 0) throw new Error("No Hermes bundle asset found in manifest");
|
|
71
|
+
if (candidates.length > 1) throw new Error(`Expected exactly one Hermes bundle asset in manifest, found ${candidates.length}: ${candidates.join(", ")}`);
|
|
72
|
+
return candidates[0];
|
|
73
|
+
}
|
|
74
|
+
async function fetchAssetBytes(bundle, assetPath, storagePlugin) {
|
|
75
|
+
const assetBaseStorageUri = getAssetBaseStorageUri(bundle);
|
|
76
|
+
if (!assetBaseStorageUri) throw new Error(`Bundle ${bundle.id} does not have asset storage metadata`);
|
|
77
|
+
if (BR_COMPRESSED_ASSET_PATH_RE.test(assetPath)) {
|
|
78
|
+
const compressedAssetStorageUri = createChildStorageUri(assetBaseStorageUri, `${assetPath}.br`);
|
|
79
|
+
let compressedBytes = null;
|
|
80
|
+
try {
|
|
81
|
+
compressedBytes = await downloadStorageBytes(compressedAssetStorageUri, storagePlugin);
|
|
82
|
+
} catch {}
|
|
83
|
+
if (compressedBytes) return new Uint8Array(await decompressBrotli(compressedBytes));
|
|
84
|
+
}
|
|
85
|
+
return downloadStorageBytes(createChildStorageUri(assetBaseStorageUri, assetPath), storagePlugin);
|
|
86
|
+
}
|
|
87
|
+
async function getFileHash(filePath) {
|
|
88
|
+
const file = await fs.readFile(filePath);
|
|
89
|
+
return crypto.createHash("sha256").update(file).digest("hex");
|
|
90
|
+
}
|
|
91
|
+
function buildNextPatchState({ currentBundle, nextPatch, makePrimary }) {
|
|
92
|
+
const existingPatches = getBundlePatches(currentBundle).filter((patch) => patch.baseBundleId !== nextPatch.baseBundleId);
|
|
93
|
+
const orderedPatches = makePrimary ? [nextPatch, ...existingPatches] : [...existingPatches, nextPatch];
|
|
94
|
+
return {
|
|
95
|
+
patches: orderedPatches,
|
|
96
|
+
primaryPatch: orderedPatches[0] ?? nextPatch
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
async function createBundleDiff({ baseBundleId, bundleId }, deps, options = {}) {
|
|
100
|
+
if (!deps.storagePlugin) throw new Error("Storage plugin is not configured");
|
|
101
|
+
if (baseBundleId === bundleId) throw new Error("Base bundle must be different from the target bundle");
|
|
102
|
+
const baseBundle = await deps.databasePlugin.getBundleById(baseBundleId);
|
|
103
|
+
const targetBundle = await deps.databasePlugin.getBundleById(bundleId);
|
|
104
|
+
if (!baseBundle || !targetBundle) throw new Error("Bundle not found");
|
|
105
|
+
if (baseBundle.platform !== targetBundle.platform) throw new Error("Base bundle platform must match the target bundle");
|
|
106
|
+
if (baseBundle.id.localeCompare(targetBundle.id) >= 0) throw new Error("Base bundle must be older than the target bundle");
|
|
107
|
+
const [baseManifest, targetManifest] = await Promise.all([fetchManifest(baseBundle, deps.storagePlugin), fetchManifest(targetBundle, deps.storagePlugin)]);
|
|
108
|
+
const baseAssetPath = resolveHbcAssetPath(baseManifest);
|
|
109
|
+
const targetAssetPath = resolveHbcAssetPath(targetManifest);
|
|
110
|
+
if (baseAssetPath !== targetAssetPath) throw new Error("Base and target Hermes asset paths do not match");
|
|
111
|
+
const baseAssetHash = baseManifest.assets[baseAssetPath]?.fileHash;
|
|
112
|
+
const targetAssetHash = targetManifest.assets[targetAssetPath]?.fileHash;
|
|
113
|
+
if (!baseAssetHash || !targetAssetHash) throw new Error("Hermes asset hash is missing from manifest");
|
|
114
|
+
if (baseAssetHash === targetAssetHash) throw new Error("Hermes bundle is unchanged; no diff patch is required");
|
|
115
|
+
const [baseBytes, targetBytes] = await Promise.all([fetchAssetBytes(baseBundle, baseAssetPath, deps.storagePlugin), fetchAssetBytes(targetBundle, targetAssetPath, deps.storagePlugin)]);
|
|
116
|
+
const patchBytes = await hdiff(baseBytes, targetBytes);
|
|
117
|
+
const workDir = await fs.mkdtemp(path.join(os.tmpdir(), "hot-updater-console-bsdiff-"));
|
|
118
|
+
const patchFilename = `${path.posix.basename(targetAssetPath)}.bsdiff`;
|
|
119
|
+
const patchPath = path.join(workDir, patchFilename);
|
|
120
|
+
const previousPatch = getBundlePatch(targetBundle, baseBundle.id);
|
|
121
|
+
try {
|
|
122
|
+
await fs.writeFile(patchPath, patchBytes);
|
|
123
|
+
const uploadKey = [
|
|
124
|
+
targetBundle.id,
|
|
125
|
+
"patches",
|
|
126
|
+
baseBundle.id,
|
|
127
|
+
getRelativeStorageDir(targetAssetPath)
|
|
128
|
+
].filter(Boolean).join("/");
|
|
129
|
+
const patchUpload = await deps.storagePlugin.profiles.node.upload(uploadKey, patchPath);
|
|
130
|
+
const patchFileHash = await getFileHash(patchPath);
|
|
131
|
+
const nextState = buildNextPatchState({
|
|
132
|
+
currentBundle: targetBundle,
|
|
133
|
+
nextPatch: {
|
|
134
|
+
baseBundleId: baseBundle.id,
|
|
135
|
+
baseFileHash: baseAssetHash,
|
|
136
|
+
patchFileHash,
|
|
137
|
+
patchStorageUri: patchUpload.storageUri
|
|
138
|
+
},
|
|
139
|
+
makePrimary: options.makePrimary ?? true
|
|
140
|
+
});
|
|
141
|
+
await deps.databasePlugin.updateBundle(targetBundle.id, {
|
|
142
|
+
patches: nextState.patches,
|
|
143
|
+
patchBaseBundleId: nextState.primaryPatch.baseBundleId,
|
|
144
|
+
patchBaseFileHash: nextState.primaryPatch.baseFileHash,
|
|
145
|
+
patchFileHash: nextState.primaryPatch.patchFileHash,
|
|
146
|
+
patchStorageUri: nextState.primaryPatch.patchStorageUri
|
|
147
|
+
});
|
|
148
|
+
await deps.databasePlugin.commitBundle();
|
|
149
|
+
if (previousPatch?.patchStorageUri && previousPatch.patchStorageUri !== patchUpload.storageUri) await deps.storagePlugin.profiles.node.delete(previousPatch.patchStorageUri).catch(() => {});
|
|
150
|
+
const updatedBundle = await deps.databasePlugin.getBundleById(targetBundle.id);
|
|
151
|
+
if (!updatedBundle) throw new Error("Updated bundle not found");
|
|
152
|
+
return updatedBundle;
|
|
153
|
+
} finally {
|
|
154
|
+
await fs.rm(workDir, {
|
|
155
|
+
force: true,
|
|
156
|
+
recursive: true
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
//#endregion
|
|
161
|
+
export { createBundleDiff };
|