@hot-updater/server 0.30.11 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_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/src/db/index.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
DatabasePlugin,
|
|
3
3
|
HotUpdaterContext,
|
|
4
|
-
|
|
4
|
+
RuntimeStoragePlugin,
|
|
5
5
|
} from "@hot-updater/plugin-core";
|
|
6
|
+
import { assertRuntimeStoragePlugin } from "@hot-updater/plugin-core";
|
|
6
7
|
|
|
8
|
+
export * from "./createBundleDiff";
|
|
7
9
|
import { createHandler, type HandlerRoutes } from "../handler";
|
|
8
10
|
import { normalizeBasePath } from "../route";
|
|
11
|
+
import { createStorageAccess } from "../storageAccess";
|
|
9
12
|
import {
|
|
10
13
|
createOrmDatabaseCore,
|
|
11
14
|
type HotUpdaterClient,
|
|
@@ -40,11 +43,17 @@ export interface CreateHotUpdaterOptions<TContext = unknown> {
|
|
|
40
43
|
/**
|
|
41
44
|
* Storage plugins for handling file uploads and downloads.
|
|
42
45
|
*/
|
|
43
|
-
storages?: (
|
|
46
|
+
storages?: (
|
|
47
|
+
| RuntimeStoragePlugin<TContext>
|
|
48
|
+
| StoragePluginFactory<TContext>
|
|
49
|
+
)[];
|
|
44
50
|
/**
|
|
45
51
|
* @deprecated Use `storages` instead. This field will be removed in a future version.
|
|
46
52
|
*/
|
|
47
|
-
storagePlugins?: (
|
|
53
|
+
storagePlugins?: (
|
|
54
|
+
| RuntimeStoragePlugin<TContext>
|
|
55
|
+
| StoragePluginFactory<TContext>
|
|
56
|
+
)[];
|
|
48
57
|
basePath?: string;
|
|
49
58
|
cwd?: string;
|
|
50
59
|
routes?: HandlerRoutes;
|
|
@@ -57,39 +66,14 @@ export function createHotUpdater<TContext = unknown>(
|
|
|
57
66
|
|
|
58
67
|
// Initialize storage plugins - call factories if they are functions
|
|
59
68
|
const storagePlugins = (options.storages ?? options.storagePlugins ?? []).map(
|
|
60
|
-
(plugin) =>
|
|
69
|
+
(plugin) => {
|
|
70
|
+
const storagePlugin = typeof plugin === "function" ? plugin() : plugin;
|
|
71
|
+
assertRuntimeStoragePlugin(storagePlugin);
|
|
72
|
+
return storagePlugin;
|
|
73
|
+
},
|
|
61
74
|
);
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
storageUri: string | null,
|
|
65
|
-
context?: HotUpdaterContext<TContext>,
|
|
66
|
-
): Promise<string | null> => {
|
|
67
|
-
if (!storageUri) {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
const url = new URL(storageUri);
|
|
71
|
-
const protocol = url.protocol.replace(":", "");
|
|
72
|
-
if (protocol === "http" || protocol === "https") {
|
|
73
|
-
return storageUri;
|
|
74
|
-
}
|
|
75
|
-
const plugin = storagePlugins.find((p) => p.supportedProtocol === protocol);
|
|
76
|
-
|
|
77
|
-
if (!plugin) {
|
|
78
|
-
throw new Error(`No storage plugin for protocol: ${protocol}`);
|
|
79
|
-
}
|
|
80
|
-
const { fileUrl } = await plugin.getDownloadUrl(storageUri, context);
|
|
81
|
-
if (!fileUrl) {
|
|
82
|
-
throw new Error("Storage plugin returned empty fileUrl");
|
|
83
|
-
}
|
|
84
|
-
return fileUrl;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const resolveFileUrl = async (
|
|
88
|
-
storageUri: string | null,
|
|
89
|
-
context?: HotUpdaterContext<TContext>,
|
|
90
|
-
) => {
|
|
91
|
-
return resolveStoragePluginUrl(storageUri, context);
|
|
92
|
-
};
|
|
75
|
+
const { readStorageText, resolveFileUrl } =
|
|
76
|
+
createStorageAccess(storagePlugins);
|
|
93
77
|
|
|
94
78
|
const database = options.database;
|
|
95
79
|
|
|
@@ -108,12 +92,14 @@ export function createHotUpdater<TContext = unknown>(
|
|
|
108
92
|
isDatabasePluginFactory(database)
|
|
109
93
|
? {
|
|
110
94
|
createMutationPlugin: () => database(),
|
|
95
|
+
readStorageText,
|
|
111
96
|
}
|
|
112
|
-
:
|
|
97
|
+
: { readStorageText },
|
|
113
98
|
);
|
|
114
99
|
})()
|
|
115
100
|
: createOrmDatabaseCore<TContext>({
|
|
116
101
|
database,
|
|
102
|
+
readStorageText,
|
|
117
103
|
resolveFileUrl,
|
|
118
104
|
});
|
|
119
105
|
|
package/src/db/ormCore.ts
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
2
|
+
AppUpdateAvailableInfo,
|
|
3
3
|
AppVersionGetBundlesArgs,
|
|
4
4
|
Bundle,
|
|
5
|
+
BundlePatchArtifact,
|
|
5
6
|
FingerprintGetBundlesArgs,
|
|
6
7
|
GetBundlesArgs,
|
|
7
8
|
Platform,
|
|
8
9
|
UpdateInfo,
|
|
9
10
|
} from "@hot-updater/core";
|
|
10
11
|
import {
|
|
12
|
+
getAssetBaseStorageUri,
|
|
13
|
+
getBundlePatches,
|
|
14
|
+
getManifestFileHash,
|
|
15
|
+
getManifestStorageUri,
|
|
11
16
|
DEFAULT_ROLLOUT_COHORT_COUNT,
|
|
12
17
|
isCohortEligibleForUpdate,
|
|
13
18
|
NIL_UUID,
|
|
19
|
+
stripBundleArtifactMetadata,
|
|
14
20
|
} from "@hot-updater/core";
|
|
15
21
|
import type {
|
|
16
22
|
DatabaseBundleCursor,
|
|
@@ -23,13 +29,26 @@ import type {
|
|
|
23
29
|
import { semverSatisfies } from "@hot-updater/plugin-core";
|
|
24
30
|
import type { InferFumaDB } from "fumadb";
|
|
25
31
|
import { fumadb } from "fumadb";
|
|
26
|
-
import type { FumaDBAdapter } from "fumadb/adapters";
|
|
27
32
|
|
|
28
33
|
import { calculatePagination } from "../calculatePagination";
|
|
29
34
|
import { v0_21_0 } from "../schema/v0_21_0";
|
|
30
35
|
import { v0_29_0 } from "../schema/v0_29_0";
|
|
36
|
+
import { v0_31_0 } from "../schema/v0_31_0";
|
|
31
37
|
import type { Paginated } from "../types";
|
|
32
|
-
import
|
|
38
|
+
import {
|
|
39
|
+
assertBundlePersistenceConstraints,
|
|
40
|
+
enhanceGeneratedSchema,
|
|
41
|
+
wrapKyselyMigrator,
|
|
42
|
+
} from "./schemaEnhancements";
|
|
43
|
+
import {
|
|
44
|
+
getSQLProvider,
|
|
45
|
+
type DatabaseAPI,
|
|
46
|
+
type ORMDatabaseAdapter,
|
|
47
|
+
} from "./types";
|
|
48
|
+
import {
|
|
49
|
+
parseBundleMetadata,
|
|
50
|
+
resolveManifestArtifacts,
|
|
51
|
+
} from "./updateArtifacts";
|
|
33
52
|
|
|
34
53
|
const parseTargetCohorts = (value: unknown): string[] | null => {
|
|
35
54
|
if (!value) return null;
|
|
@@ -49,7 +68,11 @@ const parseTargetCohorts = (value: unknown): string[] | null => {
|
|
|
49
68
|
return null;
|
|
50
69
|
};
|
|
51
70
|
|
|
52
|
-
const schemas: [typeof v0_21_0, typeof v0_29_0] = [
|
|
71
|
+
const schemas: [typeof v0_21_0, typeof v0_29_0, typeof v0_31_0] = [
|
|
72
|
+
v0_21_0,
|
|
73
|
+
v0_29_0,
|
|
74
|
+
v0_31_0,
|
|
75
|
+
];
|
|
53
76
|
|
|
54
77
|
const getLastItem = <T extends unknown[]>(
|
|
55
78
|
items: T,
|
|
@@ -58,6 +81,70 @@ const getLastItem = <T extends unknown[]>(
|
|
|
58
81
|
|
|
59
82
|
const DEFAULT_BUNDLE_ORDER = { field: "id", direction: "desc" } as const;
|
|
60
83
|
|
|
84
|
+
type BundleRecord = {
|
|
85
|
+
id: string;
|
|
86
|
+
platform: string;
|
|
87
|
+
should_force_update: unknown;
|
|
88
|
+
enabled: unknown;
|
|
89
|
+
file_hash: string;
|
|
90
|
+
git_commit_hash: string | null;
|
|
91
|
+
message: string | null;
|
|
92
|
+
channel: string;
|
|
93
|
+
storage_uri: string;
|
|
94
|
+
target_app_version: string | null;
|
|
95
|
+
fingerprint_hash: string | null;
|
|
96
|
+
metadata?: unknown;
|
|
97
|
+
manifest_storage_uri?: string | null;
|
|
98
|
+
manifest_file_hash?: string | null;
|
|
99
|
+
asset_base_storage_uri?: string | null;
|
|
100
|
+
rollout_cohort_count?: number | null;
|
|
101
|
+
target_cohorts?: unknown;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
type BundlePatchRecord = {
|
|
105
|
+
id: string;
|
|
106
|
+
bundle_id: string;
|
|
107
|
+
base_bundle_id: string;
|
|
108
|
+
base_file_hash: string;
|
|
109
|
+
patch_file_hash: string;
|
|
110
|
+
patch_storage_uri: string;
|
|
111
|
+
order_index?: number | null;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const buildBundlePatchId = (bundleId: string, baseBundleId: string) =>
|
|
115
|
+
`${bundleId}:${baseBundleId}`;
|
|
116
|
+
|
|
117
|
+
const toBundlePatchRecords = (
|
|
118
|
+
bundle: Pick<
|
|
119
|
+
Bundle,
|
|
120
|
+
| "id"
|
|
121
|
+
| "patches"
|
|
122
|
+
| "patchBaseBundleId"
|
|
123
|
+
| "patchBaseFileHash"
|
|
124
|
+
| "patchFileHash"
|
|
125
|
+
| "patchStorageUri"
|
|
126
|
+
| "metadata"
|
|
127
|
+
>,
|
|
128
|
+
): BundlePatchRecord[] =>
|
|
129
|
+
getBundlePatches(bundle).map((patch, index) => ({
|
|
130
|
+
id: buildBundlePatchId(bundle.id, patch.baseBundleId),
|
|
131
|
+
bundle_id: bundle.id,
|
|
132
|
+
base_bundle_id: patch.baseBundleId,
|
|
133
|
+
base_file_hash: patch.baseFileHash,
|
|
134
|
+
patch_file_hash: patch.patchFileHash,
|
|
135
|
+
patch_storage_uri: patch.patchStorageUri,
|
|
136
|
+
order_index: index,
|
|
137
|
+
}));
|
|
138
|
+
|
|
139
|
+
const mapPatchRecordToPatch = (
|
|
140
|
+
record: BundlePatchRecord,
|
|
141
|
+
): BundlePatchArtifact => ({
|
|
142
|
+
baseBundleId: record.base_bundle_id,
|
|
143
|
+
baseFileHash: record.base_file_hash,
|
|
144
|
+
patchFileHash: record.patch_file_hash,
|
|
145
|
+
patchStorageUri: record.patch_storage_uri,
|
|
146
|
+
});
|
|
147
|
+
|
|
61
148
|
const mergeIdFilter = (
|
|
62
149
|
base: DatabaseBundleIdFilter | undefined,
|
|
63
150
|
patch: DatabaseBundleIdFilter,
|
|
@@ -135,26 +222,32 @@ export type Migrator = ReturnType<HotUpdaterClient["createMigrator"]>;
|
|
|
135
222
|
export function createOrmDatabaseCore<TContext = unknown>({
|
|
136
223
|
database,
|
|
137
224
|
resolveFileUrl,
|
|
225
|
+
readStorageText,
|
|
138
226
|
}: {
|
|
139
|
-
database:
|
|
227
|
+
database: ORMDatabaseAdapter;
|
|
140
228
|
resolveFileUrl: (
|
|
141
229
|
storageUri: string | null,
|
|
142
230
|
context?: HotUpdaterContext<TContext>,
|
|
143
231
|
) => Promise<string | null>;
|
|
232
|
+
readStorageText?: (
|
|
233
|
+
storageUri: string,
|
|
234
|
+
context?: HotUpdaterContext<TContext>,
|
|
235
|
+
) => Promise<string | null>;
|
|
144
236
|
}): {
|
|
145
237
|
api: DatabaseAPI<TContext>;
|
|
146
238
|
adapterName: string;
|
|
147
239
|
createMigrator: () => Migrator;
|
|
148
240
|
generateSchema: HotUpdaterClient["generateSchema"];
|
|
149
241
|
} {
|
|
150
|
-
const client = HotUpdaterDB.client(
|
|
242
|
+
const client = HotUpdaterDB.client(
|
|
243
|
+
database as Parameters<typeof HotUpdaterDB.client>[0],
|
|
244
|
+
);
|
|
151
245
|
const UPDATE_CHECK_PAGE_SIZE = 100;
|
|
152
246
|
const isMongoAdapter = client.adapter.name.toLowerCase().includes("mongodb");
|
|
247
|
+
const latestSchema = getLastItem(schemas);
|
|
248
|
+
const lastSchemaVersion = latestSchema.version;
|
|
153
249
|
|
|
154
250
|
const ensureORM = async () => {
|
|
155
|
-
const latestSchema = getLastItem(schemas);
|
|
156
|
-
const lastSchemaVersion = latestSchema.version;
|
|
157
|
-
|
|
158
251
|
try {
|
|
159
252
|
const migrator = client.createMigrator();
|
|
160
253
|
const currentVersion = await migrator.getVersion();
|
|
@@ -246,46 +339,115 @@ export function createOrmDatabaseCore<TContext = unknown>({
|
|
|
246
339
|
return conditions.length > 0 ? b.and(...conditions) : true;
|
|
247
340
|
};
|
|
248
341
|
|
|
342
|
+
const mapBundleRecordToBundle = (
|
|
343
|
+
record: BundleRecord,
|
|
344
|
+
patchRecords: BundlePatchRecord[] = [],
|
|
345
|
+
): Bundle => {
|
|
346
|
+
const patches = patchRecords
|
|
347
|
+
.slice()
|
|
348
|
+
.sort(
|
|
349
|
+
(left, right) =>
|
|
350
|
+
(left.order_index ?? 0) - (right.order_index ?? 0) ||
|
|
351
|
+
left.base_bundle_id.localeCompare(right.base_bundle_id),
|
|
352
|
+
)
|
|
353
|
+
.map(mapPatchRecordToPatch);
|
|
354
|
+
const primaryPatch = patches[0] ?? null;
|
|
355
|
+
|
|
356
|
+
return {
|
|
357
|
+
id: record.id,
|
|
358
|
+
platform: record.platform as Platform,
|
|
359
|
+
shouldForceUpdate: Boolean(record.should_force_update),
|
|
360
|
+
enabled: Boolean(record.enabled),
|
|
361
|
+
fileHash: record.file_hash,
|
|
362
|
+
gitCommitHash: record.git_commit_hash ?? null,
|
|
363
|
+
message: record.message ?? null,
|
|
364
|
+
channel: record.channel,
|
|
365
|
+
storageUri: record.storage_uri,
|
|
366
|
+
targetAppVersion: record.target_app_version ?? null,
|
|
367
|
+
fingerprintHash: record.fingerprint_hash ?? null,
|
|
368
|
+
metadata: parseBundleMetadata(record.metadata),
|
|
369
|
+
manifestStorageUri: record.manifest_storage_uri ?? null,
|
|
370
|
+
manifestFileHash: record.manifest_file_hash ?? null,
|
|
371
|
+
assetBaseStorageUri: record.asset_base_storage_uri ?? null,
|
|
372
|
+
patches,
|
|
373
|
+
patchBaseBundleId: primaryPatch?.baseBundleId ?? null,
|
|
374
|
+
patchBaseFileHash: primaryPatch?.baseFileHash ?? null,
|
|
375
|
+
patchFileHash: primaryPatch?.patchFileHash ?? null,
|
|
376
|
+
patchStorageUri: primaryPatch?.patchStorageUri ?? null,
|
|
377
|
+
rolloutCohortCount:
|
|
378
|
+
record.rollout_cohort_count ?? DEFAULT_ROLLOUT_COHORT_COUNT,
|
|
379
|
+
targetCohorts: parseTargetCohorts(record.target_cohorts),
|
|
380
|
+
};
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
const fetchBundlePatchMap = async (
|
|
384
|
+
orm: Awaited<ReturnType<typeof ensureORM>>,
|
|
385
|
+
bundleIds: string[],
|
|
386
|
+
): Promise<Map<string, BundlePatchRecord[]>> => {
|
|
387
|
+
const patchMap = new Map<string, BundlePatchRecord[]>();
|
|
388
|
+
|
|
389
|
+
if (bundleIds.length === 0) {
|
|
390
|
+
return patchMap;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
const patchRows = await orm.findMany("bundle_patches", {
|
|
394
|
+
select: [
|
|
395
|
+
"id",
|
|
396
|
+
"bundle_id",
|
|
397
|
+
"base_bundle_id",
|
|
398
|
+
"base_file_hash",
|
|
399
|
+
"patch_file_hash",
|
|
400
|
+
"patch_storage_uri",
|
|
401
|
+
"order_index",
|
|
402
|
+
],
|
|
403
|
+
where: (b) => b("bundle_id", "in", bundleIds),
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
for (const row of patchRows) {
|
|
407
|
+
const current = patchMap.get(row.bundle_id) ?? [];
|
|
408
|
+
current.push(row);
|
|
409
|
+
patchMap.set(row.bundle_id, current);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
return patchMap;
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
const fetchBundleById = async (id: string): Promise<Bundle | null> => {
|
|
416
|
+
const orm = await ensureORM();
|
|
417
|
+
const result = await orm.findFirst("bundles", {
|
|
418
|
+
select: [
|
|
419
|
+
"id",
|
|
420
|
+
"platform",
|
|
421
|
+
"should_force_update",
|
|
422
|
+
"enabled",
|
|
423
|
+
"file_hash",
|
|
424
|
+
"git_commit_hash",
|
|
425
|
+
"message",
|
|
426
|
+
"channel",
|
|
427
|
+
"storage_uri",
|
|
428
|
+
"target_app_version",
|
|
429
|
+
"fingerprint_hash",
|
|
430
|
+
"metadata",
|
|
431
|
+
"manifest_storage_uri",
|
|
432
|
+
"manifest_file_hash",
|
|
433
|
+
"asset_base_storage_uri",
|
|
434
|
+
"rollout_cohort_count",
|
|
435
|
+
"target_cohorts",
|
|
436
|
+
],
|
|
437
|
+
where: (b) => b("id", "=", id),
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
if (!result) {
|
|
441
|
+
return null;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
const patchMap = await fetchBundlePatchMap(orm, [id]);
|
|
445
|
+
return mapBundleRecordToBundle(result, patchMap.get(id) ?? []);
|
|
446
|
+
};
|
|
447
|
+
|
|
249
448
|
const api: DatabaseAPI<TContext> = {
|
|
250
449
|
async getBundleById(id: string): Promise<Bundle | null> {
|
|
251
|
-
|
|
252
|
-
const result = await orm.findFirst("bundles", {
|
|
253
|
-
select: [
|
|
254
|
-
"id",
|
|
255
|
-
"platform",
|
|
256
|
-
"should_force_update",
|
|
257
|
-
"enabled",
|
|
258
|
-
"file_hash",
|
|
259
|
-
"git_commit_hash",
|
|
260
|
-
"message",
|
|
261
|
-
"channel",
|
|
262
|
-
"storage_uri",
|
|
263
|
-
"target_app_version",
|
|
264
|
-
"fingerprint_hash",
|
|
265
|
-
"metadata",
|
|
266
|
-
"rollout_cohort_count",
|
|
267
|
-
"target_cohorts",
|
|
268
|
-
],
|
|
269
|
-
where: (b) => b("id", "=", id),
|
|
270
|
-
});
|
|
271
|
-
if (!result) return null;
|
|
272
|
-
const bundle: Bundle = {
|
|
273
|
-
id: result.id,
|
|
274
|
-
platform: result.platform as Platform,
|
|
275
|
-
shouldForceUpdate: Boolean(result.should_force_update),
|
|
276
|
-
enabled: Boolean(result.enabled),
|
|
277
|
-
fileHash: result.file_hash,
|
|
278
|
-
gitCommitHash: result.git_commit_hash ?? null,
|
|
279
|
-
message: result.message ?? null,
|
|
280
|
-
channel: result.channel,
|
|
281
|
-
storageUri: result.storage_uri,
|
|
282
|
-
targetAppVersion: result.target_app_version ?? null,
|
|
283
|
-
fingerprintHash: result.fingerprint_hash ?? null,
|
|
284
|
-
rolloutCohortCount:
|
|
285
|
-
result.rollout_cohort_count ?? DEFAULT_ROLLOUT_COHORT_COUNT,
|
|
286
|
-
targetCohorts: parseTargetCohorts(result.target_cohorts),
|
|
287
|
-
};
|
|
288
|
-
return bundle;
|
|
450
|
+
return fetchBundleById(id);
|
|
289
451
|
},
|
|
290
452
|
|
|
291
453
|
async getUpdateInfo(args: GetBundlesArgs): Promise<UpdateInfo | null> {
|
|
@@ -558,14 +720,40 @@ export function createOrmDatabaseCore<TContext = unknown>({
|
|
|
558
720
|
async getAppUpdateInfo(
|
|
559
721
|
args: GetBundlesArgs,
|
|
560
722
|
context?: HotUpdaterContext<TContext>,
|
|
561
|
-
): Promise<
|
|
723
|
+
): Promise<AppUpdateAvailableInfo | null> {
|
|
562
724
|
const info = await this.getUpdateInfo(args);
|
|
563
725
|
if (!info) return null;
|
|
564
726
|
const { storageUri, ...rest } = info as UpdateInfo & {
|
|
565
727
|
storageUri: string | null;
|
|
566
728
|
};
|
|
567
|
-
|
|
568
|
-
|
|
729
|
+
if (!readStorageText) {
|
|
730
|
+
const fileUrl = await resolveFileUrl(storageUri ?? null, context);
|
|
731
|
+
const baseResponse = { ...rest, fileUrl };
|
|
732
|
+
return baseResponse;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
const [fileUrl, currentBundle, targetBundle] = await Promise.all([
|
|
736
|
+
resolveFileUrl(storageUri ?? null, context),
|
|
737
|
+
args.bundleId !== NIL_UUID ? fetchBundleById(args.bundleId) : null,
|
|
738
|
+
info.id !== NIL_UUID ? fetchBundleById(info.id) : null,
|
|
739
|
+
]);
|
|
740
|
+
const baseResponse = { ...rest, fileUrl };
|
|
741
|
+
const manifestArtifacts = await resolveManifestArtifacts({
|
|
742
|
+
currentBundle,
|
|
743
|
+
resolveFileUrl,
|
|
744
|
+
readStorageText,
|
|
745
|
+
targetBundle,
|
|
746
|
+
context,
|
|
747
|
+
});
|
|
748
|
+
|
|
749
|
+
if (!manifestArtifacts) {
|
|
750
|
+
return baseResponse;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
return {
|
|
754
|
+
...baseResponse,
|
|
755
|
+
...manifestArtifacts,
|
|
756
|
+
};
|
|
569
757
|
},
|
|
570
758
|
|
|
571
759
|
async getChannels(): Promise<string[]> {
|
|
@@ -606,6 +794,9 @@ export function createOrmDatabaseCore<TContext = unknown>({
|
|
|
606
794
|
| "target_app_version"
|
|
607
795
|
| "fingerprint_hash"
|
|
608
796
|
| "metadata"
|
|
797
|
+
| "manifest_storage_uri"
|
|
798
|
+
| "manifest_file_hash"
|
|
799
|
+
| "asset_base_storage_uri"
|
|
609
800
|
| "rollout_cohort_count"
|
|
610
801
|
| "target_cohorts"
|
|
611
802
|
> = [
|
|
@@ -621,30 +812,13 @@ export function createOrmDatabaseCore<TContext = unknown>({
|
|
|
621
812
|
"target_app_version",
|
|
622
813
|
"fingerprint_hash",
|
|
623
814
|
"metadata",
|
|
815
|
+
"manifest_storage_uri",
|
|
816
|
+
"manifest_file_hash",
|
|
817
|
+
"asset_base_storage_uri",
|
|
624
818
|
"rollout_cohort_count",
|
|
625
819
|
"target_cohorts",
|
|
626
820
|
];
|
|
627
821
|
|
|
628
|
-
const mapRowsToBundles = (rows: any[]): Bundle[] =>
|
|
629
|
-
rows.map(
|
|
630
|
-
(r): Bundle => ({
|
|
631
|
-
id: r.id,
|
|
632
|
-
platform: r.platform as Platform,
|
|
633
|
-
shouldForceUpdate: Boolean(r.should_force_update),
|
|
634
|
-
enabled: Boolean(r.enabled),
|
|
635
|
-
fileHash: r.file_hash,
|
|
636
|
-
gitCommitHash: r.git_commit_hash ?? null,
|
|
637
|
-
message: r.message ?? null,
|
|
638
|
-
channel: r.channel,
|
|
639
|
-
storageUri: r.storage_uri,
|
|
640
|
-
targetAppVersion: r.target_app_version ?? null,
|
|
641
|
-
fingerprintHash: r.fingerprint_hash ?? null,
|
|
642
|
-
rolloutCohortCount:
|
|
643
|
-
r.rollout_cohort_count ?? DEFAULT_ROLLOUT_COHORT_COUNT,
|
|
644
|
-
targetCohorts: parseTargetCohorts(r.target_cohorts),
|
|
645
|
-
}),
|
|
646
|
-
);
|
|
647
|
-
|
|
648
822
|
const findBundles = async ({
|
|
649
823
|
where,
|
|
650
824
|
orderBy,
|
|
@@ -676,7 +850,14 @@ export function createOrmDatabaseCore<TContext = unknown>({
|
|
|
676
850
|
offset,
|
|
677
851
|
});
|
|
678
852
|
|
|
679
|
-
|
|
853
|
+
const patchMap = await fetchBundlePatchMap(
|
|
854
|
+
orm,
|
|
855
|
+
rows.map((row) => row.id),
|
|
856
|
+
);
|
|
857
|
+
|
|
858
|
+
return rows.map((row) =>
|
|
859
|
+
mapBundleRecordToBundle(row, patchMap.get(row.id) ?? []),
|
|
860
|
+
);
|
|
680
861
|
};
|
|
681
862
|
|
|
682
863
|
if (!options.cursor?.after && !options.cursor?.before) {
|
|
@@ -752,6 +933,7 @@ export function createOrmDatabaseCore<TContext = unknown>({
|
|
|
752
933
|
},
|
|
753
934
|
|
|
754
935
|
async insertBundle(bundle: Bundle): Promise<void> {
|
|
936
|
+
assertBundlePersistenceConstraints(bundle);
|
|
755
937
|
const orm = await ensureORM();
|
|
756
938
|
const values = {
|
|
757
939
|
id: bundle.id,
|
|
@@ -765,7 +947,10 @@ export function createOrmDatabaseCore<TContext = unknown>({
|
|
|
765
947
|
storage_uri: bundle.storageUri,
|
|
766
948
|
target_app_version: bundle.targetAppVersion,
|
|
767
949
|
fingerprint_hash: bundle.fingerprintHash,
|
|
768
|
-
metadata: bundle.metadata ?? {},
|
|
950
|
+
metadata: stripBundleArtifactMetadata(bundle.metadata) ?? {},
|
|
951
|
+
manifest_storage_uri: getManifestStorageUri(bundle),
|
|
952
|
+
manifest_file_hash: getManifestFileHash(bundle),
|
|
953
|
+
asset_base_storage_uri: getAssetBaseStorageUri(bundle),
|
|
769
954
|
rollout_cohort_count:
|
|
770
955
|
bundle.rolloutCohortCount ?? DEFAULT_ROLLOUT_COHORT_COUNT,
|
|
771
956
|
target_cohorts: bundle.targetCohorts ?? null,
|
|
@@ -776,6 +961,13 @@ export function createOrmDatabaseCore<TContext = unknown>({
|
|
|
776
961
|
create: values,
|
|
777
962
|
update: updateValues,
|
|
778
963
|
});
|
|
964
|
+
await orm.deleteMany("bundle_patches", {
|
|
965
|
+
where: (b) => b("bundle_id", "=", bundle.id),
|
|
966
|
+
});
|
|
967
|
+
const patchValues = toBundlePatchRecords(bundle);
|
|
968
|
+
if (patchValues.length > 0) {
|
|
969
|
+
await orm.createMany("bundle_patches", patchValues);
|
|
970
|
+
}
|
|
779
971
|
},
|
|
780
972
|
|
|
781
973
|
async updateBundleById(
|
|
@@ -786,6 +978,7 @@ export function createOrmDatabaseCore<TContext = unknown>({
|
|
|
786
978
|
const current = await this.getBundleById(bundleId);
|
|
787
979
|
if (!current) throw new Error("targetBundleId not found");
|
|
788
980
|
const merged: Bundle = { ...current, ...newBundle };
|
|
981
|
+
assertBundlePersistenceConstraints(merged);
|
|
789
982
|
const values = {
|
|
790
983
|
id: merged.id,
|
|
791
984
|
platform: merged.platform,
|
|
@@ -798,7 +991,10 @@ export function createOrmDatabaseCore<TContext = unknown>({
|
|
|
798
991
|
storage_uri: merged.storageUri,
|
|
799
992
|
target_app_version: merged.targetAppVersion,
|
|
800
993
|
fingerprint_hash: merged.fingerprintHash,
|
|
801
|
-
metadata: merged.metadata ?? {},
|
|
994
|
+
metadata: stripBundleArtifactMetadata(merged.metadata) ?? {},
|
|
995
|
+
manifest_storage_uri: getManifestStorageUri(merged),
|
|
996
|
+
manifest_file_hash: getManifestFileHash(merged),
|
|
997
|
+
asset_base_storage_uri: getAssetBaseStorageUri(merged),
|
|
802
998
|
rollout_cohort_count:
|
|
803
999
|
merged.rolloutCohortCount ?? DEFAULT_ROLLOUT_COHORT_COUNT,
|
|
804
1000
|
target_cohorts: merged.targetCohorts ?? null,
|
|
@@ -809,10 +1005,32 @@ export function createOrmDatabaseCore<TContext = unknown>({
|
|
|
809
1005
|
create: values,
|
|
810
1006
|
update: updateValues2,
|
|
811
1007
|
});
|
|
1008
|
+
await orm.deleteMany("bundle_patches", {
|
|
1009
|
+
where: (b) => b("bundle_id", "=", merged.id),
|
|
1010
|
+
});
|
|
1011
|
+
const patchValues = toBundlePatchRecords(merged);
|
|
1012
|
+
if (patchValues.length > 0) {
|
|
1013
|
+
await orm.createMany("bundle_patches", patchValues);
|
|
1014
|
+
}
|
|
812
1015
|
},
|
|
813
1016
|
|
|
814
1017
|
async deleteBundleById(bundleId: string): Promise<void> {
|
|
815
1018
|
const orm = await ensureORM();
|
|
1019
|
+
const existingBundle = await orm.findFirst("bundles", {
|
|
1020
|
+
select: ["id"],
|
|
1021
|
+
where: (b) => b("id", "=", bundleId),
|
|
1022
|
+
});
|
|
1023
|
+
|
|
1024
|
+
if (!existingBundle) {
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
await orm.deleteMany("bundle_patches", {
|
|
1029
|
+
where: (b) => b("bundle_id", "=", bundleId),
|
|
1030
|
+
});
|
|
1031
|
+
await orm.deleteMany("bundle_patches", {
|
|
1032
|
+
where: (b) => b("base_bundle_id", "=", bundleId),
|
|
1033
|
+
});
|
|
816
1034
|
await orm.deleteMany("bundles", { where: (b) => b("id", "=", bundleId) });
|
|
817
1035
|
},
|
|
818
1036
|
};
|
|
@@ -820,7 +1038,22 @@ export function createOrmDatabaseCore<TContext = unknown>({
|
|
|
820
1038
|
return {
|
|
821
1039
|
api,
|
|
822
1040
|
adapterName: client.adapter.name,
|
|
823
|
-
createMigrator: () =>
|
|
824
|
-
|
|
1041
|
+
createMigrator: () =>
|
|
1042
|
+
wrapKyselyMigrator(
|
|
1043
|
+
client.createMigrator(),
|
|
1044
|
+
getSQLProvider(database.provider),
|
|
1045
|
+
lastSchemaVersion,
|
|
1046
|
+
) as Migrator,
|
|
1047
|
+
generateSchema: (version, name) => {
|
|
1048
|
+
const result = client.generateSchema(version, name);
|
|
1049
|
+
return {
|
|
1050
|
+
...result,
|
|
1051
|
+
code: enhanceGeneratedSchema(
|
|
1052
|
+
client.adapter.name,
|
|
1053
|
+
result.code,
|
|
1054
|
+
database.provider,
|
|
1055
|
+
),
|
|
1056
|
+
};
|
|
1057
|
+
},
|
|
825
1058
|
};
|
|
826
1059
|
}
|