@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
package/dist/db/index.cjs
CHANGED
|
@@ -1,32 +1,31 @@
|
|
|
1
|
+
require("../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
require("./createBundleDiff.cjs");
|
|
1
3
|
require("../version.cjs");
|
|
2
4
|
const require_handler = require("../handler.cjs");
|
|
3
5
|
const require_route = require("../route.cjs");
|
|
6
|
+
const require_storageAccess = require("../storageAccess.cjs");
|
|
7
|
+
const require_types = require("./types.cjs");
|
|
4
8
|
const require_ormCore = require("./ormCore.cjs");
|
|
5
9
|
const require_pluginCore = require("./pluginCore.cjs");
|
|
6
|
-
|
|
10
|
+
let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
|
|
7
11
|
//#region src/db/index.ts
|
|
8
12
|
function createHotUpdater(options) {
|
|
9
13
|
const basePath = require_route.normalizeBasePath(options.basePath ?? "/api");
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const plugin = storagePlugins.find((p) => p.supportedProtocol === protocol);
|
|
16
|
-
if (!plugin) throw new Error(`No storage plugin for protocol: ${protocol}`);
|
|
17
|
-
const { fileUrl } = await plugin.getDownloadUrl(storageUri, context);
|
|
18
|
-
if (!fileUrl) throw new Error("Storage plugin returned empty fileUrl");
|
|
19
|
-
return fileUrl;
|
|
20
|
-
};
|
|
21
|
-
const resolveFileUrl = async (storageUri, context) => {
|
|
22
|
-
return resolveStoragePluginUrl(storageUri, context);
|
|
23
|
-
};
|
|
14
|
+
const { readStorageText, resolveFileUrl } = require_storageAccess.createStorageAccess((options.storages ?? options.storagePlugins ?? []).map((plugin) => {
|
|
15
|
+
const storagePlugin = typeof plugin === "function" ? plugin() : plugin;
|
|
16
|
+
(0, _hot_updater_plugin_core.assertRuntimeStoragePlugin)(storagePlugin);
|
|
17
|
+
return storagePlugin;
|
|
18
|
+
}));
|
|
24
19
|
const database = options.database;
|
|
25
20
|
const core = require_types.isDatabasePluginFactory(database) || require_types.isDatabasePlugin(database) ? (() => {
|
|
26
21
|
const plugin = require_types.isDatabasePluginFactory(database) ? database() : database;
|
|
27
|
-
return require_pluginCore.createPluginDatabaseCore(() => plugin, resolveFileUrl, require_types.isDatabasePluginFactory(database) ? {
|
|
22
|
+
return require_pluginCore.createPluginDatabaseCore(() => plugin, resolveFileUrl, require_types.isDatabasePluginFactory(database) ? {
|
|
23
|
+
createMutationPlugin: () => database(),
|
|
24
|
+
readStorageText
|
|
25
|
+
} : { readStorageText });
|
|
28
26
|
})() : require_ormCore.createOrmDatabaseCore({
|
|
29
27
|
database,
|
|
28
|
+
readStorageText,
|
|
30
29
|
resolveFileUrl
|
|
31
30
|
});
|
|
32
31
|
const api = {
|
package/dist/db/index.d.cts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { CreateBundleDiffDependencies, CreateBundleDiffInput, CreateBundleDiffOptions, createBundleDiff } from "./createBundleDiff.cjs";
|
|
1
2
|
import { HandlerRoutes } from "../handler.cjs";
|
|
2
|
-
import { DatabaseAPI, DatabaseAdapter, StoragePluginFactory } from "./types.cjs";
|
|
3
3
|
import { HotUpdaterClient, HotUpdaterDB, Migrator } from "./ormCore.cjs";
|
|
4
4
|
import { HOT_UPDATER_SERVER_VERSION } from "../version.cjs";
|
|
5
|
-
import {
|
|
5
|
+
import { DatabaseAPI, DatabaseAdapter, StoragePluginFactory } from "./types.cjs";
|
|
6
|
+
import { HotUpdaterContext, RuntimeStoragePlugin } from "@hot-updater/plugin-core";
|
|
6
7
|
|
|
7
8
|
//#region src/db/index.d.ts
|
|
8
9
|
type HotUpdaterAPI<TContext = unknown> = DatabaseAPI<TContext> & {
|
|
@@ -17,11 +18,11 @@ interface CreateHotUpdaterOptions<TContext = unknown> {
|
|
|
17
18
|
/**
|
|
18
19
|
* Storage plugins for handling file uploads and downloads.
|
|
19
20
|
*/
|
|
20
|
-
storages?: (
|
|
21
|
+
storages?: (RuntimeStoragePlugin<TContext> | StoragePluginFactory<TContext>)[];
|
|
21
22
|
/**
|
|
22
23
|
* @deprecated Use `storages` instead. This field will be removed in a future version.
|
|
23
24
|
*/
|
|
24
|
-
storagePlugins?: (
|
|
25
|
+
storagePlugins?: (RuntimeStoragePlugin<TContext> | StoragePluginFactory<TContext>)[];
|
|
25
26
|
basePath?: string;
|
|
26
27
|
cwd?: string;
|
|
27
28
|
routes?: HandlerRoutes;
|
package/dist/db/index.d.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { CreateBundleDiffDependencies, CreateBundleDiffInput, CreateBundleDiffOptions, createBundleDiff } from "./createBundleDiff.mjs";
|
|
1
2
|
import { HandlerRoutes } from "../handler.mjs";
|
|
2
|
-
import { DatabaseAPI, DatabaseAdapter, StoragePluginFactory } from "./types.mjs";
|
|
3
3
|
import { HotUpdaterClient, HotUpdaterDB, Migrator } from "./ormCore.mjs";
|
|
4
4
|
import { HOT_UPDATER_SERVER_VERSION } from "../version.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { DatabaseAPI, DatabaseAdapter, StoragePluginFactory } from "./types.mjs";
|
|
6
|
+
import { HotUpdaterContext, RuntimeStoragePlugin } from "@hot-updater/plugin-core";
|
|
6
7
|
|
|
7
8
|
//#region src/db/index.d.ts
|
|
8
9
|
type HotUpdaterAPI<TContext = unknown> = DatabaseAPI<TContext> & {
|
|
@@ -17,11 +18,11 @@ interface CreateHotUpdaterOptions<TContext = unknown> {
|
|
|
17
18
|
/**
|
|
18
19
|
* Storage plugins for handling file uploads and downloads.
|
|
19
20
|
*/
|
|
20
|
-
storages?: (
|
|
21
|
+
storages?: (RuntimeStoragePlugin<TContext> | StoragePluginFactory<TContext>)[];
|
|
21
22
|
/**
|
|
22
23
|
* @deprecated Use `storages` instead. This field will be removed in a future version.
|
|
23
24
|
*/
|
|
24
|
-
storagePlugins?: (
|
|
25
|
+
storagePlugins?: (RuntimeStoragePlugin<TContext> | StoragePluginFactory<TContext>)[];
|
|
25
26
|
basePath?: string;
|
|
26
27
|
cwd?: string;
|
|
27
28
|
routes?: HandlerRoutes;
|
package/dist/db/index.mjs
CHANGED
|
@@ -1,32 +1,30 @@
|
|
|
1
|
+
import "./createBundleDiff.mjs";
|
|
1
2
|
import "../version.mjs";
|
|
2
3
|
import { createHandler } from "../handler.mjs";
|
|
3
4
|
import { normalizeBasePath } from "../route.mjs";
|
|
5
|
+
import { createStorageAccess } from "../storageAccess.mjs";
|
|
6
|
+
import { isDatabasePlugin, isDatabasePluginFactory } from "./types.mjs";
|
|
4
7
|
import { createOrmDatabaseCore } from "./ormCore.mjs";
|
|
5
8
|
import { createPluginDatabaseCore } from "./pluginCore.mjs";
|
|
6
|
-
import {
|
|
9
|
+
import { assertRuntimeStoragePlugin } from "@hot-updater/plugin-core";
|
|
7
10
|
//#region src/db/index.ts
|
|
8
11
|
function createHotUpdater(options) {
|
|
9
12
|
const basePath = normalizeBasePath(options.basePath ?? "/api");
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const plugin = storagePlugins.find((p) => p.supportedProtocol === protocol);
|
|
16
|
-
if (!plugin) throw new Error(`No storage plugin for protocol: ${protocol}`);
|
|
17
|
-
const { fileUrl } = await plugin.getDownloadUrl(storageUri, context);
|
|
18
|
-
if (!fileUrl) throw new Error("Storage plugin returned empty fileUrl");
|
|
19
|
-
return fileUrl;
|
|
20
|
-
};
|
|
21
|
-
const resolveFileUrl = async (storageUri, context) => {
|
|
22
|
-
return resolveStoragePluginUrl(storageUri, context);
|
|
23
|
-
};
|
|
13
|
+
const { readStorageText, resolveFileUrl } = createStorageAccess((options.storages ?? options.storagePlugins ?? []).map((plugin) => {
|
|
14
|
+
const storagePlugin = typeof plugin === "function" ? plugin() : plugin;
|
|
15
|
+
assertRuntimeStoragePlugin(storagePlugin);
|
|
16
|
+
return storagePlugin;
|
|
17
|
+
}));
|
|
24
18
|
const database = options.database;
|
|
25
19
|
const core = isDatabasePluginFactory(database) || isDatabasePlugin(database) ? (() => {
|
|
26
20
|
const plugin = isDatabasePluginFactory(database) ? database() : database;
|
|
27
|
-
return createPluginDatabaseCore(() => plugin, resolveFileUrl, isDatabasePluginFactory(database) ? {
|
|
21
|
+
return createPluginDatabaseCore(() => plugin, resolveFileUrl, isDatabasePluginFactory(database) ? {
|
|
22
|
+
createMutationPlugin: () => database(),
|
|
23
|
+
readStorageText
|
|
24
|
+
} : { readStorageText });
|
|
28
25
|
})() : createOrmDatabaseCore({
|
|
29
26
|
database,
|
|
27
|
+
readStorageText,
|
|
30
28
|
resolveFileUrl
|
|
31
29
|
});
|
|
32
30
|
const api = {
|
package/dist/db/ormCore.cjs
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
require("../_virtual/_rolldown/runtime.cjs");
|
|
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/index.cjs");
|
|
1
3
|
const require_calculatePagination = require("../calculatePagination.cjs");
|
|
2
4
|
const require_v0_21_0 = require("../schema/v0_21_0.cjs");
|
|
3
5
|
const require_v0_29_0 = require("../schema/v0_29_0.cjs");
|
|
4
|
-
|
|
6
|
+
const require_v0_31_0 = require("../schema/v0_31_0.cjs");
|
|
7
|
+
const require_schemaEnhancements = require("./schemaEnhancements.cjs");
|
|
8
|
+
const require_types = require("./types.cjs");
|
|
9
|
+
const require_updateArtifacts = require("./updateArtifacts.cjs");
|
|
5
10
|
let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
|
|
6
|
-
let
|
|
11
|
+
let _hot_updater_core = require("@hot-updater/core");
|
|
7
12
|
//#region src/db/ormCore.ts
|
|
8
13
|
const parseTargetCohorts = (value) => {
|
|
9
14
|
if (!value) return null;
|
|
@@ -16,12 +21,32 @@ const parseTargetCohorts = (value) => {
|
|
|
16
21
|
}
|
|
17
22
|
return null;
|
|
18
23
|
};
|
|
19
|
-
const schemas = [
|
|
24
|
+
const schemas = [
|
|
25
|
+
require_v0_21_0.v0_21_0,
|
|
26
|
+
require_v0_29_0.v0_29_0,
|
|
27
|
+
require_v0_31_0.v0_31_0
|
|
28
|
+
];
|
|
20
29
|
const getLastItem = (items) => items.at(-1);
|
|
21
30
|
const DEFAULT_BUNDLE_ORDER = {
|
|
22
31
|
field: "id",
|
|
23
32
|
direction: "desc"
|
|
24
33
|
};
|
|
34
|
+
const buildBundlePatchId = (bundleId, baseBundleId) => `${bundleId}:${baseBundleId}`;
|
|
35
|
+
const toBundlePatchRecords = (bundle) => (0, _hot_updater_core.getBundlePatches)(bundle).map((patch, index) => ({
|
|
36
|
+
id: buildBundlePatchId(bundle.id, patch.baseBundleId),
|
|
37
|
+
bundle_id: bundle.id,
|
|
38
|
+
base_bundle_id: patch.baseBundleId,
|
|
39
|
+
base_file_hash: patch.baseFileHash,
|
|
40
|
+
patch_file_hash: patch.patchFileHash,
|
|
41
|
+
patch_storage_uri: patch.patchStorageUri,
|
|
42
|
+
order_index: index
|
|
43
|
+
}));
|
|
44
|
+
const mapPatchRecordToPatch = (record) => ({
|
|
45
|
+
baseBundleId: record.base_bundle_id,
|
|
46
|
+
baseFileHash: record.base_file_hash,
|
|
47
|
+
patchFileHash: record.patch_file_hash,
|
|
48
|
+
patchStorageUri: record.patch_storage_uri
|
|
49
|
+
});
|
|
25
50
|
const mergeIdFilter = (base, patch) => ({
|
|
26
51
|
...base,
|
|
27
52
|
...patch
|
|
@@ -52,16 +77,16 @@ const buildCursorPageWhere = (where, cursor, orderBy) => {
|
|
|
52
77
|
};
|
|
53
78
|
};
|
|
54
79
|
const buildCountBeforeWhere = (where, firstBundleId, orderBy) => mergeWhereWithIdFilter(where, { [orderBy.direction === "desc" ? "gt" : "lt"]: firstBundleId });
|
|
55
|
-
const HotUpdaterDB =
|
|
80
|
+
const HotUpdaterDB = require_index.fumadb({
|
|
56
81
|
namespace: "hot_updater",
|
|
57
82
|
schemas
|
|
58
83
|
});
|
|
59
|
-
function createOrmDatabaseCore({ database, resolveFileUrl }) {
|
|
84
|
+
function createOrmDatabaseCore({ database, resolveFileUrl, readStorageText }) {
|
|
60
85
|
const client = HotUpdaterDB.client(database);
|
|
61
86
|
const UPDATE_CHECK_PAGE_SIZE = 100;
|
|
62
87
|
const isMongoAdapter = client.adapter.name.toLowerCase().includes("mongodb");
|
|
88
|
+
const lastSchemaVersion = getLastItem(schemas).version;
|
|
63
89
|
const ensureORM = async () => {
|
|
64
|
-
const lastSchemaVersion = getLastItem(schemas).version;
|
|
65
90
|
try {
|
|
66
91
|
const currentVersion = await client.createMigrator().getVersion();
|
|
67
92
|
if (currentVersion === void 0) throw new Error("Database is not initialized. Please run 'npx hot-updater migrate' to set up the database schema.");
|
|
@@ -91,44 +116,87 @@ function createOrmDatabaseCore({ database, resolveFileUrl }) {
|
|
|
91
116
|
if (where?.fingerprintHash !== void 0) conditions.push(where.fingerprintHash === null ? b.isNull("fingerprint_hash") : b("fingerprint_hash", "=", where.fingerprintHash));
|
|
92
117
|
return conditions.length > 0 ? b.and(...conditions) : true;
|
|
93
118
|
};
|
|
119
|
+
const mapBundleRecordToBundle = (record, patchRecords = []) => {
|
|
120
|
+
const patches = patchRecords.slice().sort((left, right) => (left.order_index ?? 0) - (right.order_index ?? 0) || left.base_bundle_id.localeCompare(right.base_bundle_id)).map(mapPatchRecordToPatch);
|
|
121
|
+
const primaryPatch = patches[0] ?? null;
|
|
122
|
+
return {
|
|
123
|
+
id: record.id,
|
|
124
|
+
platform: record.platform,
|
|
125
|
+
shouldForceUpdate: Boolean(record.should_force_update),
|
|
126
|
+
enabled: Boolean(record.enabled),
|
|
127
|
+
fileHash: record.file_hash,
|
|
128
|
+
gitCommitHash: record.git_commit_hash ?? null,
|
|
129
|
+
message: record.message ?? null,
|
|
130
|
+
channel: record.channel,
|
|
131
|
+
storageUri: record.storage_uri,
|
|
132
|
+
targetAppVersion: record.target_app_version ?? null,
|
|
133
|
+
fingerprintHash: record.fingerprint_hash ?? null,
|
|
134
|
+
metadata: require_updateArtifacts.parseBundleMetadata(record.metadata),
|
|
135
|
+
manifestStorageUri: record.manifest_storage_uri ?? null,
|
|
136
|
+
manifestFileHash: record.manifest_file_hash ?? null,
|
|
137
|
+
assetBaseStorageUri: record.asset_base_storage_uri ?? null,
|
|
138
|
+
patches,
|
|
139
|
+
patchBaseBundleId: primaryPatch?.baseBundleId ?? null,
|
|
140
|
+
patchBaseFileHash: primaryPatch?.baseFileHash ?? null,
|
|
141
|
+
patchFileHash: primaryPatch?.patchFileHash ?? null,
|
|
142
|
+
patchStorageUri: primaryPatch?.patchStorageUri ?? null,
|
|
143
|
+
rolloutCohortCount: record.rollout_cohort_count ?? _hot_updater_core.DEFAULT_ROLLOUT_COHORT_COUNT,
|
|
144
|
+
targetCohorts: parseTargetCohorts(record.target_cohorts)
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
const fetchBundlePatchMap = async (orm, bundleIds) => {
|
|
148
|
+
const patchMap = /* @__PURE__ */ new Map();
|
|
149
|
+
if (bundleIds.length === 0) return patchMap;
|
|
150
|
+
const patchRows = await orm.findMany("bundle_patches", {
|
|
151
|
+
select: [
|
|
152
|
+
"id",
|
|
153
|
+
"bundle_id",
|
|
154
|
+
"base_bundle_id",
|
|
155
|
+
"base_file_hash",
|
|
156
|
+
"patch_file_hash",
|
|
157
|
+
"patch_storage_uri",
|
|
158
|
+
"order_index"
|
|
159
|
+
],
|
|
160
|
+
where: (b) => b("bundle_id", "in", bundleIds)
|
|
161
|
+
});
|
|
162
|
+
for (const row of patchRows) {
|
|
163
|
+
const current = patchMap.get(row.bundle_id) ?? [];
|
|
164
|
+
current.push(row);
|
|
165
|
+
patchMap.set(row.bundle_id, current);
|
|
166
|
+
}
|
|
167
|
+
return patchMap;
|
|
168
|
+
};
|
|
169
|
+
const fetchBundleById = async (id) => {
|
|
170
|
+
const orm = await ensureORM();
|
|
171
|
+
const result = await orm.findFirst("bundles", {
|
|
172
|
+
select: [
|
|
173
|
+
"id",
|
|
174
|
+
"platform",
|
|
175
|
+
"should_force_update",
|
|
176
|
+
"enabled",
|
|
177
|
+
"file_hash",
|
|
178
|
+
"git_commit_hash",
|
|
179
|
+
"message",
|
|
180
|
+
"channel",
|
|
181
|
+
"storage_uri",
|
|
182
|
+
"target_app_version",
|
|
183
|
+
"fingerprint_hash",
|
|
184
|
+
"metadata",
|
|
185
|
+
"manifest_storage_uri",
|
|
186
|
+
"manifest_file_hash",
|
|
187
|
+
"asset_base_storage_uri",
|
|
188
|
+
"rollout_cohort_count",
|
|
189
|
+
"target_cohorts"
|
|
190
|
+
],
|
|
191
|
+
where: (b) => b("id", "=", id)
|
|
192
|
+
});
|
|
193
|
+
if (!result) return null;
|
|
194
|
+
return mapBundleRecordToBundle(result, (await fetchBundlePatchMap(orm, [id])).get(id) ?? []);
|
|
195
|
+
};
|
|
94
196
|
return {
|
|
95
197
|
api: {
|
|
96
198
|
async getBundleById(id) {
|
|
97
|
-
|
|
98
|
-
select: [
|
|
99
|
-
"id",
|
|
100
|
-
"platform",
|
|
101
|
-
"should_force_update",
|
|
102
|
-
"enabled",
|
|
103
|
-
"file_hash",
|
|
104
|
-
"git_commit_hash",
|
|
105
|
-
"message",
|
|
106
|
-
"channel",
|
|
107
|
-
"storage_uri",
|
|
108
|
-
"target_app_version",
|
|
109
|
-
"fingerprint_hash",
|
|
110
|
-
"metadata",
|
|
111
|
-
"rollout_cohort_count",
|
|
112
|
-
"target_cohorts"
|
|
113
|
-
],
|
|
114
|
-
where: (b) => b("id", "=", id)
|
|
115
|
-
});
|
|
116
|
-
if (!result) return null;
|
|
117
|
-
return {
|
|
118
|
-
id: result.id,
|
|
119
|
-
platform: result.platform,
|
|
120
|
-
shouldForceUpdate: Boolean(result.should_force_update),
|
|
121
|
-
enabled: Boolean(result.enabled),
|
|
122
|
-
fileHash: result.file_hash,
|
|
123
|
-
gitCommitHash: result.git_commit_hash ?? null,
|
|
124
|
-
message: result.message ?? null,
|
|
125
|
-
channel: result.channel,
|
|
126
|
-
storageUri: result.storage_uri,
|
|
127
|
-
targetAppVersion: result.target_app_version ?? null,
|
|
128
|
-
fingerprintHash: result.fingerprint_hash ?? null,
|
|
129
|
-
rolloutCohortCount: result.rollout_cohort_count ?? _hot_updater_core.DEFAULT_ROLLOUT_COHORT_COUNT,
|
|
130
|
-
targetCohorts: parseTargetCohorts(result.target_cohorts)
|
|
131
|
-
};
|
|
199
|
+
return fetchBundleById(id);
|
|
132
200
|
},
|
|
133
201
|
async getUpdateInfo(args) {
|
|
134
202
|
const orm = await ensureORM();
|
|
@@ -282,11 +350,34 @@ function createOrmDatabaseCore({ database, resolveFileUrl }) {
|
|
|
282
350
|
const info = await this.getUpdateInfo(args);
|
|
283
351
|
if (!info) return null;
|
|
284
352
|
const { storageUri, ...rest } = info;
|
|
285
|
-
|
|
286
|
-
|
|
353
|
+
if (!readStorageText) {
|
|
354
|
+
const fileUrl = await resolveFileUrl(storageUri ?? null, context);
|
|
355
|
+
return {
|
|
356
|
+
...rest,
|
|
357
|
+
fileUrl
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
const [fileUrl, currentBundle, targetBundle] = await Promise.all([
|
|
361
|
+
resolveFileUrl(storageUri ?? null, context),
|
|
362
|
+
args.bundleId !== _hot_updater_core.NIL_UUID ? fetchBundleById(args.bundleId) : null,
|
|
363
|
+
info.id !== _hot_updater_core.NIL_UUID ? fetchBundleById(info.id) : null
|
|
364
|
+
]);
|
|
365
|
+
const baseResponse = {
|
|
287
366
|
...rest,
|
|
288
367
|
fileUrl
|
|
289
368
|
};
|
|
369
|
+
const manifestArtifacts = await require_updateArtifacts.resolveManifestArtifacts({
|
|
370
|
+
currentBundle,
|
|
371
|
+
resolveFileUrl,
|
|
372
|
+
readStorageText,
|
|
373
|
+
targetBundle,
|
|
374
|
+
context
|
|
375
|
+
});
|
|
376
|
+
if (!manifestArtifacts) return baseResponse;
|
|
377
|
+
return {
|
|
378
|
+
...baseResponse,
|
|
379
|
+
...manifestArtifacts
|
|
380
|
+
};
|
|
290
381
|
},
|
|
291
382
|
async getChannels() {
|
|
292
383
|
const rows = await (await ensureORM()).findMany("bundles", {
|
|
@@ -315,26 +406,14 @@ function createOrmDatabaseCore({ database, resolveFileUrl }) {
|
|
|
315
406
|
"target_app_version",
|
|
316
407
|
"fingerprint_hash",
|
|
317
408
|
"metadata",
|
|
409
|
+
"manifest_storage_uri",
|
|
410
|
+
"manifest_file_hash",
|
|
411
|
+
"asset_base_storage_uri",
|
|
318
412
|
"rollout_cohort_count",
|
|
319
413
|
"target_cohorts"
|
|
320
414
|
];
|
|
321
|
-
const mapRowsToBundles = (rows) => rows.map((r) => ({
|
|
322
|
-
id: r.id,
|
|
323
|
-
platform: r.platform,
|
|
324
|
-
shouldForceUpdate: Boolean(r.should_force_update),
|
|
325
|
-
enabled: Boolean(r.enabled),
|
|
326
|
-
fileHash: r.file_hash,
|
|
327
|
-
gitCommitHash: r.git_commit_hash ?? null,
|
|
328
|
-
message: r.message ?? null,
|
|
329
|
-
channel: r.channel,
|
|
330
|
-
storageUri: r.storage_uri,
|
|
331
|
-
targetAppVersion: r.target_app_version ?? null,
|
|
332
|
-
fingerprintHash: r.fingerprint_hash ?? null,
|
|
333
|
-
rolloutCohortCount: r.rollout_cohort_count ?? _hot_updater_core.DEFAULT_ROLLOUT_COHORT_COUNT,
|
|
334
|
-
targetCohorts: parseTargetCohorts(r.target_cohorts)
|
|
335
|
-
}));
|
|
336
415
|
const findBundles = async ({ where, orderBy, limit, offset }) => {
|
|
337
|
-
|
|
416
|
+
const rows = isMongoAdapter ? (await orm.findMany("bundles", {
|
|
338
417
|
select: selectedColumns,
|
|
339
418
|
where: buildBundleWhere(where)
|
|
340
419
|
})).sort((a, b) => {
|
|
@@ -346,7 +425,9 @@ function createOrmDatabaseCore({ database, resolveFileUrl }) {
|
|
|
346
425
|
orderBy: [[orderBy.field, orderBy.direction]],
|
|
347
426
|
limit,
|
|
348
427
|
offset
|
|
349
|
-
})
|
|
428
|
+
});
|
|
429
|
+
const patchMap = await fetchBundlePatchMap(orm, rows.map((row) => row.id));
|
|
430
|
+
return rows.map((row) => mapBundleRecordToBundle(row, patchMap.get(row.id) ?? []));
|
|
350
431
|
};
|
|
351
432
|
if (!options.cursor?.after && !options.cursor?.before) {
|
|
352
433
|
const data = await findBundles({
|
|
@@ -400,6 +481,7 @@ function createOrmDatabaseCore({ database, resolveFileUrl }) {
|
|
|
400
481
|
};
|
|
401
482
|
},
|
|
402
483
|
async insertBundle(bundle) {
|
|
484
|
+
require_schemaEnhancements.assertBundlePersistenceConstraints(bundle);
|
|
403
485
|
const orm = await ensureORM();
|
|
404
486
|
const values = {
|
|
405
487
|
id: bundle.id,
|
|
@@ -413,7 +495,10 @@ function createOrmDatabaseCore({ database, resolveFileUrl }) {
|
|
|
413
495
|
storage_uri: bundle.storageUri,
|
|
414
496
|
target_app_version: bundle.targetAppVersion,
|
|
415
497
|
fingerprint_hash: bundle.fingerprintHash,
|
|
416
|
-
metadata: bundle.metadata ?? {},
|
|
498
|
+
metadata: (0, _hot_updater_core.stripBundleArtifactMetadata)(bundle.metadata) ?? {},
|
|
499
|
+
manifest_storage_uri: (0, _hot_updater_core.getManifestStorageUri)(bundle),
|
|
500
|
+
manifest_file_hash: (0, _hot_updater_core.getManifestFileHash)(bundle),
|
|
501
|
+
asset_base_storage_uri: (0, _hot_updater_core.getAssetBaseStorageUri)(bundle),
|
|
417
502
|
rollout_cohort_count: bundle.rolloutCohortCount ?? _hot_updater_core.DEFAULT_ROLLOUT_COHORT_COUNT,
|
|
418
503
|
target_cohorts: bundle.targetCohorts ?? null
|
|
419
504
|
};
|
|
@@ -423,6 +508,9 @@ function createOrmDatabaseCore({ database, resolveFileUrl }) {
|
|
|
423
508
|
create: values,
|
|
424
509
|
update: updateValues
|
|
425
510
|
});
|
|
511
|
+
await orm.deleteMany("bundle_patches", { where: (b) => b("bundle_id", "=", bundle.id) });
|
|
512
|
+
const patchValues = toBundlePatchRecords(bundle);
|
|
513
|
+
if (patchValues.length > 0) await orm.createMany("bundle_patches", patchValues);
|
|
426
514
|
},
|
|
427
515
|
async updateBundleById(bundleId, newBundle) {
|
|
428
516
|
const orm = await ensureORM();
|
|
@@ -432,6 +520,7 @@ function createOrmDatabaseCore({ database, resolveFileUrl }) {
|
|
|
432
520
|
...current,
|
|
433
521
|
...newBundle
|
|
434
522
|
};
|
|
523
|
+
require_schemaEnhancements.assertBundlePersistenceConstraints(merged);
|
|
435
524
|
const values = {
|
|
436
525
|
id: merged.id,
|
|
437
526
|
platform: merged.platform,
|
|
@@ -444,7 +533,10 @@ function createOrmDatabaseCore({ database, resolveFileUrl }) {
|
|
|
444
533
|
storage_uri: merged.storageUri,
|
|
445
534
|
target_app_version: merged.targetAppVersion,
|
|
446
535
|
fingerprint_hash: merged.fingerprintHash,
|
|
447
|
-
metadata: merged.metadata ?? {},
|
|
536
|
+
metadata: (0, _hot_updater_core.stripBundleArtifactMetadata)(merged.metadata) ?? {},
|
|
537
|
+
manifest_storage_uri: (0, _hot_updater_core.getManifestStorageUri)(merged),
|
|
538
|
+
manifest_file_hash: (0, _hot_updater_core.getManifestFileHash)(merged),
|
|
539
|
+
asset_base_storage_uri: (0, _hot_updater_core.getAssetBaseStorageUri)(merged),
|
|
448
540
|
rollout_cohort_count: merged.rolloutCohortCount ?? _hot_updater_core.DEFAULT_ROLLOUT_COHORT_COUNT,
|
|
449
541
|
target_cohorts: merged.targetCohorts ?? null
|
|
450
542
|
};
|
|
@@ -454,14 +546,30 @@ function createOrmDatabaseCore({ database, resolveFileUrl }) {
|
|
|
454
546
|
create: values,
|
|
455
547
|
update: updateValues2
|
|
456
548
|
});
|
|
549
|
+
await orm.deleteMany("bundle_patches", { where: (b) => b("bundle_id", "=", merged.id) });
|
|
550
|
+
const patchValues = toBundlePatchRecords(merged);
|
|
551
|
+
if (patchValues.length > 0) await orm.createMany("bundle_patches", patchValues);
|
|
457
552
|
},
|
|
458
553
|
async deleteBundleById(bundleId) {
|
|
459
|
-
|
|
554
|
+
const orm = await ensureORM();
|
|
555
|
+
if (!await orm.findFirst("bundles", {
|
|
556
|
+
select: ["id"],
|
|
557
|
+
where: (b) => b("id", "=", bundleId)
|
|
558
|
+
})) return;
|
|
559
|
+
await orm.deleteMany("bundle_patches", { where: (b) => b("bundle_id", "=", bundleId) });
|
|
560
|
+
await orm.deleteMany("bundle_patches", { where: (b) => b("base_bundle_id", "=", bundleId) });
|
|
561
|
+
await orm.deleteMany("bundles", { where: (b) => b("id", "=", bundleId) });
|
|
460
562
|
}
|
|
461
563
|
},
|
|
462
564
|
adapterName: client.adapter.name,
|
|
463
|
-
createMigrator: () => client.createMigrator(),
|
|
464
|
-
generateSchema:
|
|
565
|
+
createMigrator: () => require_schemaEnhancements.wrapKyselyMigrator(client.createMigrator(), require_types.getSQLProvider(database.provider), lastSchemaVersion),
|
|
566
|
+
generateSchema: (version, name) => {
|
|
567
|
+
const result = client.generateSchema(version, name);
|
|
568
|
+
return {
|
|
569
|
+
...result,
|
|
570
|
+
code: require_schemaEnhancements.enhanceGeneratedSchema(client.adapter.name, result.code, database.provider)
|
|
571
|
+
};
|
|
572
|
+
}
|
|
465
573
|
};
|
|
466
574
|
}
|
|
467
575
|
//#endregion
|
package/dist/db/ormCore.d.cts
CHANGED
|
@@ -1,42 +1,108 @@
|
|
|
1
|
+
import { Column, ExplicitRelation, IdColumn, Schema, Table } 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/create-tg0451Y_.cjs";
|
|
2
|
+
import { FumaDBFactory, InferFumaDB } 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.cjs";
|
|
1
3
|
import { HotUpdaterContext } from "@hot-updater/plugin-core";
|
|
2
|
-
import * as _$fumadb_schema0 from "fumadb/schema";
|
|
3
|
-
import * as _$fumadb from "fumadb";
|
|
4
|
-
import { InferFumaDB } from "fumadb";
|
|
5
|
-
import { FumaDBAdapter } from "fumadb/adapters";
|
|
6
4
|
|
|
7
5
|
//#region src/db/ormCore.d.ts
|
|
8
|
-
declare const HotUpdaterDB:
|
|
9
|
-
bundles:
|
|
10
|
-
id:
|
|
11
|
-
platform:
|
|
12
|
-
should_force_update:
|
|
13
|
-
enabled:
|
|
14
|
-
file_hash:
|
|
15
|
-
git_commit_hash:
|
|
16
|
-
message:
|
|
17
|
-
channel:
|
|
18
|
-
storage_uri:
|
|
19
|
-
target_app_version:
|
|
20
|
-
fingerprint_hash:
|
|
21
|
-
metadata:
|
|
6
|
+
declare const HotUpdaterDB: FumaDBFactory<[Schema<"0.21.0", {
|
|
7
|
+
bundles: Table<{
|
|
8
|
+
id: IdColumn<"uuid", string, string>;
|
|
9
|
+
platform: Column<"string", string, string>;
|
|
10
|
+
should_force_update: Column<"bool", boolean, boolean>;
|
|
11
|
+
enabled: Column<"bool", boolean, boolean>;
|
|
12
|
+
file_hash: Column<"string", string, string>;
|
|
13
|
+
git_commit_hash: Column<"string", string | null, string | null>;
|
|
14
|
+
message: Column<"string", string | null, string | null>;
|
|
15
|
+
channel: Column<"string", string | null, string>;
|
|
16
|
+
storage_uri: Column<"string", string, string>;
|
|
17
|
+
target_app_version: Column<"string", string | null, string | null>;
|
|
18
|
+
fingerprint_hash: Column<"string", string | null, string | null>;
|
|
19
|
+
metadata: Column<"json", unknown, unknown>;
|
|
22
20
|
}, {}>;
|
|
23
|
-
}>,
|
|
24
|
-
bundles:
|
|
25
|
-
id:
|
|
26
|
-
platform:
|
|
27
|
-
should_force_update:
|
|
28
|
-
enabled:
|
|
29
|
-
file_hash:
|
|
30
|
-
git_commit_hash:
|
|
31
|
-
message:
|
|
32
|
-
channel:
|
|
33
|
-
storage_uri:
|
|
34
|
-
target_app_version:
|
|
35
|
-
fingerprint_hash:
|
|
36
|
-
metadata:
|
|
37
|
-
rollout_cohort_count:
|
|
38
|
-
target_cohorts:
|
|
21
|
+
}>, Schema<"0.29.0", {
|
|
22
|
+
bundles: Table<{
|
|
23
|
+
id: IdColumn<"uuid", string, string>;
|
|
24
|
+
platform: Column<"string", string, string>;
|
|
25
|
+
should_force_update: Column<"bool", boolean, boolean>;
|
|
26
|
+
enabled: Column<"bool", boolean, boolean>;
|
|
27
|
+
file_hash: Column<"string", string, string>;
|
|
28
|
+
git_commit_hash: Column<"string", string | null, string | null>;
|
|
29
|
+
message: Column<"string", string | null, string | null>;
|
|
30
|
+
channel: Column<"string", string | null, string>;
|
|
31
|
+
storage_uri: Column<"string", string, string>;
|
|
32
|
+
target_app_version: Column<"string", string | null, string | null>;
|
|
33
|
+
fingerprint_hash: Column<"string", string | null, string | null>;
|
|
34
|
+
metadata: Column<"json", unknown, unknown>;
|
|
35
|
+
rollout_cohort_count: Column<"integer", number | null, number>;
|
|
36
|
+
target_cohorts: Column<"json", unknown, unknown>;
|
|
39
37
|
}, {}>;
|
|
38
|
+
}>, Schema<"0.31.0", {
|
|
39
|
+
bundles: Table<{
|
|
40
|
+
id: IdColumn<"uuid", string, string>;
|
|
41
|
+
platform: Column<"string", string, string>;
|
|
42
|
+
should_force_update: Column<"bool", boolean, boolean>;
|
|
43
|
+
enabled: Column<"bool", boolean, boolean>;
|
|
44
|
+
file_hash: Column<"string", string, string>;
|
|
45
|
+
git_commit_hash: Column<"string", string | null, string | null>;
|
|
46
|
+
message: Column<"string", string | null, string | null>;
|
|
47
|
+
channel: Column<"string", string | null, string>;
|
|
48
|
+
storage_uri: Column<"string", string, string>;
|
|
49
|
+
target_app_version: Column<"string", string | null, string | null>;
|
|
50
|
+
fingerprint_hash: Column<"string", string | null, string | null>;
|
|
51
|
+
metadata: Column<"json", unknown, unknown>;
|
|
52
|
+
manifest_storage_uri: Column<"string", string | null, string | null>;
|
|
53
|
+
manifest_file_hash: Column<"string", string | null, string | null>;
|
|
54
|
+
asset_base_storage_uri: Column<"string", string | null, string | null>;
|
|
55
|
+
rollout_cohort_count: Column<"integer", number | null, number>;
|
|
56
|
+
target_cohorts: Column<"json", unknown, unknown>;
|
|
57
|
+
}, {}>;
|
|
58
|
+
bundle_patches: Table<{
|
|
59
|
+
id: IdColumn<"varchar(255)", string, string>;
|
|
60
|
+
bundle_id: Column<"uuid", string, string>;
|
|
61
|
+
base_bundle_id: Column<"uuid", string, string>;
|
|
62
|
+
base_file_hash: Column<"string", string, string>;
|
|
63
|
+
patch_file_hash: Column<"string", string, string>;
|
|
64
|
+
patch_storage_uri: Column<"string", string, string>;
|
|
65
|
+
order_index: Column<"integer", number | null, number>;
|
|
66
|
+
}, Omit<{}, "bundle" | "baseBundle"> & {
|
|
67
|
+
bundle: ExplicitRelation<"one", Table<{
|
|
68
|
+
id: IdColumn<"uuid", string, string>;
|
|
69
|
+
platform: Column<"string", string, string>;
|
|
70
|
+
should_force_update: Column<"bool", boolean, boolean>;
|
|
71
|
+
enabled: Column<"bool", boolean, boolean>;
|
|
72
|
+
file_hash: Column<"string", string, string>;
|
|
73
|
+
git_commit_hash: Column<"string", string | null, string | null>;
|
|
74
|
+
message: Column<"string", string | null, string | null>;
|
|
75
|
+
channel: Column<"string", string | null, string>;
|
|
76
|
+
storage_uri: Column<"string", string, string>;
|
|
77
|
+
target_app_version: Column<"string", string | null, string | null>;
|
|
78
|
+
fingerprint_hash: Column<"string", string | null, string | null>;
|
|
79
|
+
metadata: Column<"json", unknown, unknown>;
|
|
80
|
+
manifest_storage_uri: Column<"string", string | null, string | null>;
|
|
81
|
+
manifest_file_hash: Column<"string", string | null, string | null>;
|
|
82
|
+
asset_base_storage_uri: Column<"string", string | null, string | null>;
|
|
83
|
+
rollout_cohort_count: Column<"integer", number | null, number>;
|
|
84
|
+
target_cohorts: Column<"json", unknown, unknown>;
|
|
85
|
+
}, {}>>;
|
|
86
|
+
baseBundle: ExplicitRelation<"one", Table<{
|
|
87
|
+
id: IdColumn<"uuid", string, string>;
|
|
88
|
+
platform: Column<"string", string, string>;
|
|
89
|
+
should_force_update: Column<"bool", boolean, boolean>;
|
|
90
|
+
enabled: Column<"bool", boolean, boolean>;
|
|
91
|
+
file_hash: Column<"string", string, string>;
|
|
92
|
+
git_commit_hash: Column<"string", string | null, string | null>;
|
|
93
|
+
message: Column<"string", string | null, string | null>;
|
|
94
|
+
channel: Column<"string", string | null, string>;
|
|
95
|
+
storage_uri: Column<"string", string, string>;
|
|
96
|
+
target_app_version: Column<"string", string | null, string | null>;
|
|
97
|
+
fingerprint_hash: Column<"string", string | null, string | null>;
|
|
98
|
+
metadata: Column<"json", unknown, unknown>;
|
|
99
|
+
manifest_storage_uri: Column<"string", string | null, string | null>;
|
|
100
|
+
manifest_file_hash: Column<"string", string | null, string | null>;
|
|
101
|
+
asset_base_storage_uri: Column<"string", string | null, string | null>;
|
|
102
|
+
rollout_cohort_count: Column<"integer", number | null, number>;
|
|
103
|
+
target_cohorts: Column<"json", unknown, unknown>;
|
|
104
|
+
}, {}>>;
|
|
105
|
+
}>;
|
|
40
106
|
}>]>;
|
|
41
107
|
type HotUpdaterClient = InferFumaDB<typeof HotUpdaterDB>;
|
|
42
108
|
type Migrator = ReturnType<HotUpdaterClient["createMigrator"]>;
|