@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.
Files changed (165) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +25 -0
  2. package/dist/_virtual/_rolldown/runtime.mjs +6 -0
  3. package/dist/adapters/drizzle.cjs +6 -9
  4. package/dist/adapters/drizzle.d.cts +8 -1
  5. package/dist/adapters/drizzle.d.mts +8 -1
  6. package/dist/adapters/drizzle.mjs +5 -2
  7. package/dist/adapters/kysely.cjs +7 -9
  8. package/dist/adapters/kysely.d.cts +14 -1
  9. package/dist/adapters/kysely.d.mts +14 -1
  10. package/dist/adapters/kysely.mjs +6 -2
  11. package/dist/adapters/mongodb.cjs +7 -9
  12. package/dist/adapters/mongodb.d.cts +9 -1
  13. package/dist/adapters/mongodb.d.mts +9 -1
  14. package/dist/adapters/mongodb.mjs +5 -2
  15. package/dist/adapters/prisma.cjs +6 -9
  16. package/dist/adapters/prisma.d.cts +8 -1
  17. package/dist/adapters/prisma.d.mts +8 -1
  18. package/dist/adapters/prisma.mjs +5 -2
  19. package/dist/db/createBundleDiff.cjs +166 -0
  20. package/dist/db/createBundleDiff.d.cts +20 -0
  21. package/dist/db/createBundleDiff.d.mts +20 -0
  22. package/dist/db/createBundleDiff.mjs +161 -0
  23. package/dist/db/index.cjs +15 -16
  24. package/dist/db/index.d.cts +5 -4
  25. package/dist/db/index.d.mts +5 -4
  26. package/dist/db/index.mjs +14 -16
  27. package/dist/db/ormCore.cjs +173 -65
  28. package/dist/db/ormCore.d.cts +100 -34
  29. package/dist/db/ormCore.d.mts +100 -34
  30. package/dist/db/ormCore.mjs +171 -64
  31. package/dist/db/pluginCore.cjs +37 -3
  32. package/dist/db/pluginCore.mjs +36 -3
  33. package/dist/db/schemaEnhancements.cjs +171 -0
  34. package/dist/db/schemaEnhancements.mjs +167 -0
  35. package/dist/db/types.cjs +6 -0
  36. package/dist/db/types.d.cts +19 -7
  37. package/dist/db/types.d.mts +22 -10
  38. package/dist/db/types.mjs +6 -1
  39. package/dist/db/updateArtifacts.cjs +127 -0
  40. package/dist/db/updateArtifacts.mjs +125 -0
  41. package/dist/handler.cjs +61 -5
  42. package/dist/handler.d.cts +2 -2
  43. package/dist/handler.d.mts +5 -5
  44. package/dist/handler.mjs +59 -5
  45. package/dist/index.cjs +2 -0
  46. package/dist/index.d.cts +3 -2
  47. package/dist/index.d.mts +3 -2
  48. package/dist/index.mjs +2 -1
  49. package/dist/node.d.cts +0 -1
  50. package/dist/node.d.mts +0 -1
  51. package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/_u64.cjs +112 -0
  52. package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/_u64.mjs +108 -0
  53. package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/cryptoNode.cjs +22 -0
  54. package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/cryptoNode.mjs +18 -0
  55. package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/sha3.cjs +219 -0
  56. package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/sha3.mjs +214 -0
  57. package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/utils.cjs +275 -0
  58. package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/utils.mjs +270 -0
  59. package/dist/node_modules/.pnpm/@paralleldrive_cuid2@2.3.1/node_modules/@paralleldrive/cuid2/index.cjs +17 -0
  60. package/dist/node_modules/.pnpm/@paralleldrive_cuid2@2.3.1/node_modules/@paralleldrive/cuid2/index.mjs +13 -0
  61. package/dist/node_modules/.pnpm/@paralleldrive_cuid2@2.3.1/node_modules/@paralleldrive/cuid2/src/index.cjs +69 -0
  62. package/dist/node_modules/.pnpm/@paralleldrive_cuid2@2.3.1/node_modules/@paralleldrive/cuid2/src/index.mjs +65 -0
  63. 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
  64. 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
  65. 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
  66. 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
  67. 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
  68. 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
  69. 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
  70. 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
  71. 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
  72. 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
  73. 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
  74. 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
  75. 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
  76. 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
  77. 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
  78. 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
  79. 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
  80. 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
  81. 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
  82. 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
  83. 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
  84. 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
  85. 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
  86. 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
  87. 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
  88. 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
  89. 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
  90. 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
  91. 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
  92. 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
  93. 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
  94. 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
  95. 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
  96. 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
  97. 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
  98. 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
  99. 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
  100. 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
  101. 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
  102. 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
  103. 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
  104. 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
  105. 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
  106. 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
  107. 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
  108. 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
  109. 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
  110. 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
  111. 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
  112. 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
  113. 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
  114. 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
  115. 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
  116. 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
  117. 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
  118. 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
  119. 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
  120. 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
  121. 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
  122. 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
  123. 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
  124. 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
  125. package/dist/{package.cjs → packages/server/package.cjs} +1 -1
  126. package/dist/{package.mjs → packages/server/package.mjs} +1 -1
  127. package/dist/runtime.cjs +13 -13
  128. package/dist/runtime.d.cts +4 -4
  129. package/dist/runtime.d.mts +4 -4
  130. package/dist/runtime.mjs +12 -13
  131. package/dist/schema/v0_21_0.cjs +16 -15
  132. package/dist/schema/v0_21_0.mjs +3 -2
  133. package/dist/schema/v0_29_0.cjs +18 -17
  134. package/dist/schema/v0_29_0.mjs +3 -2
  135. package/dist/schema/v0_31_0.cjs +48 -0
  136. package/dist/schema/v0_31_0.mjs +48 -0
  137. package/dist/storageAccess.cjs +44 -0
  138. package/dist/storageAccess.mjs +44 -0
  139. package/dist/version.cjs +1 -1
  140. package/dist/version.mjs +1 -1
  141. package/package.json +15 -7
  142. package/src/adapters/drizzle.ts +15 -1
  143. package/src/adapters/kysely.ts +24 -1
  144. package/src/adapters/mongodb.ts +19 -1
  145. package/src/adapters/prisma.ts +15 -1
  146. package/src/db/createBundleDiff.spec.ts +402 -0
  147. package/src/db/createBundleDiff.ts +375 -0
  148. package/src/db/index.spec.ts +528 -27
  149. package/src/db/index.ts +22 -36
  150. package/src/db/ormCore.ts +308 -75
  151. package/src/db/pluginCore.spec.ts +385 -0
  152. package/src/db/pluginCore.ts +45 -4
  153. package/src/db/schemaEnhancements.ts +460 -0
  154. package/src/db/types.ts +38 -7
  155. package/src/db/updateArtifacts.ts +388 -0
  156. package/src/handler-standalone.integration.spec.ts +1 -0
  157. package/src/handler.spec.ts +121 -0
  158. package/src/handler.ts +117 -5
  159. package/src/runtime.spec.ts +287 -55
  160. package/src/runtime.ts +21 -37
  161. package/src/schema/v0_21_0.ts +1 -1
  162. package/src/schema/v0_29_0.ts +1 -1
  163. package/src/schema/v0_31_0.ts +58 -0
  164. package/src/storageAccess.spec.ts +57 -0
  165. package/src/storageAccess.ts +90 -0
@@ -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_.mjs";
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.mjs";
1
3
  import { HotUpdaterContext } from "@hot-updater/plugin-core";
2
- import * as _$fumadb from "fumadb";
3
- import { InferFumaDB } from "fumadb";
4
- import * as _$fumadb_schema0 from "fumadb/schema";
5
- import { FumaDBAdapter } from "fumadb/adapters";
6
4
 
7
5
  //#region src/db/ormCore.d.ts
8
- declare const HotUpdaterDB: _$fumadb.FumaDBFactory<[_$fumadb_schema0.Schema<"0.21.0", {
9
- bundles: _$fumadb_schema0.Table<{
10
- id: _$fumadb_schema0.IdColumn<"uuid", string, string>;
11
- platform: _$fumadb_schema0.Column<"string", string, string>;
12
- should_force_update: _$fumadb_schema0.Column<"bool", boolean, boolean>;
13
- enabled: _$fumadb_schema0.Column<"bool", boolean, boolean>;
14
- file_hash: _$fumadb_schema0.Column<"string", string, string>;
15
- git_commit_hash: _$fumadb_schema0.Column<"string", string | null, string | null>;
16
- message: _$fumadb_schema0.Column<"string", string | null, string | null>;
17
- channel: _$fumadb_schema0.Column<"string", string, string>;
18
- storage_uri: _$fumadb_schema0.Column<"string", string, string>;
19
- target_app_version: _$fumadb_schema0.Column<"string", string | null, string | null>;
20
- fingerprint_hash: _$fumadb_schema0.Column<"string", string | null, string | null>;
21
- metadata: _$fumadb_schema0.Column<"json", unknown, unknown>;
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
- }>, _$fumadb_schema0.Schema<"0.29.0", {
24
- bundles: _$fumadb_schema0.Table<{
25
- id: _$fumadb_schema0.IdColumn<"uuid", string, string>;
26
- platform: _$fumadb_schema0.Column<"string", string, string>;
27
- should_force_update: _$fumadb_schema0.Column<"bool", boolean, boolean>;
28
- enabled: _$fumadb_schema0.Column<"bool", boolean, boolean>;
29
- file_hash: _$fumadb_schema0.Column<"string", string, string>;
30
- git_commit_hash: _$fumadb_schema0.Column<"string", string | null, string | null>;
31
- message: _$fumadb_schema0.Column<"string", string | null, string | null>;
32
- channel: _$fumadb_schema0.Column<"string", string, string>;
33
- storage_uri: _$fumadb_schema0.Column<"string", string, string>;
34
- target_app_version: _$fumadb_schema0.Column<"string", string | null, string | null>;
35
- fingerprint_hash: _$fumadb_schema0.Column<"string", string | null, string | null>;
36
- metadata: _$fumadb_schema0.Column<"json", unknown, unknown>;
37
- rollout_cohort_count: _$fumadb_schema0.Column<"integer", number | null, number>;
38
- target_cohorts: _$fumadb_schema0.Column<"json", unknown, unknown>;
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"]>;
@@ -1,9 +1,13 @@
1
+ import { fumadb } 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.mjs";
1
2
  import { calculatePagination } from "../calculatePagination.mjs";
2
3
  import { v0_21_0 } from "../schema/v0_21_0.mjs";
3
4
  import { v0_29_0 } from "../schema/v0_29_0.mjs";
4
- import { DEFAULT_ROLLOUT_COHORT_COUNT, NIL_UUID, isCohortEligibleForUpdate } from "@hot-updater/core";
5
+ import { v0_31_0 } from "../schema/v0_31_0.mjs";
6
+ import { assertBundlePersistenceConstraints, enhanceGeneratedSchema, wrapKyselyMigrator } from "./schemaEnhancements.mjs";
7
+ import { getSQLProvider } from "./types.mjs";
8
+ import { parseBundleMetadata, resolveManifestArtifacts } from "./updateArtifacts.mjs";
5
9
  import { semverSatisfies } from "@hot-updater/plugin-core";
6
- import { fumadb } from "fumadb";
10
+ import { DEFAULT_ROLLOUT_COHORT_COUNT, NIL_UUID, getAssetBaseStorageUri, getBundlePatches, getManifestFileHash, getManifestStorageUri, isCohortEligibleForUpdate, stripBundleArtifactMetadata } from "@hot-updater/core";
7
11
  //#region src/db/ormCore.ts
8
12
  const parseTargetCohorts = (value) => {
9
13
  if (!value) return null;
@@ -16,12 +20,32 @@ const parseTargetCohorts = (value) => {
16
20
  }
17
21
  return null;
18
22
  };
19
- const schemas = [v0_21_0, v0_29_0];
23
+ const schemas = [
24
+ v0_21_0,
25
+ v0_29_0,
26
+ v0_31_0
27
+ ];
20
28
  const getLastItem = (items) => items.at(-1);
21
29
  const DEFAULT_BUNDLE_ORDER = {
22
30
  field: "id",
23
31
  direction: "desc"
24
32
  };
33
+ const buildBundlePatchId = (bundleId, baseBundleId) => `${bundleId}:${baseBundleId}`;
34
+ const toBundlePatchRecords = (bundle) => getBundlePatches(bundle).map((patch, index) => ({
35
+ id: buildBundlePatchId(bundle.id, patch.baseBundleId),
36
+ bundle_id: bundle.id,
37
+ base_bundle_id: patch.baseBundleId,
38
+ base_file_hash: patch.baseFileHash,
39
+ patch_file_hash: patch.patchFileHash,
40
+ patch_storage_uri: patch.patchStorageUri,
41
+ order_index: index
42
+ }));
43
+ const mapPatchRecordToPatch = (record) => ({
44
+ baseBundleId: record.base_bundle_id,
45
+ baseFileHash: record.base_file_hash,
46
+ patchFileHash: record.patch_file_hash,
47
+ patchStorageUri: record.patch_storage_uri
48
+ });
25
49
  const mergeIdFilter = (base, patch) => ({
26
50
  ...base,
27
51
  ...patch
@@ -56,12 +80,12 @@ const HotUpdaterDB = fumadb({
56
80
  namespace: "hot_updater",
57
81
  schemas
58
82
  });
59
- function createOrmDatabaseCore({ database, resolveFileUrl }) {
83
+ function createOrmDatabaseCore({ database, resolveFileUrl, readStorageText }) {
60
84
  const client = HotUpdaterDB.client(database);
61
85
  const UPDATE_CHECK_PAGE_SIZE = 100;
62
86
  const isMongoAdapter = client.adapter.name.toLowerCase().includes("mongodb");
87
+ const lastSchemaVersion = getLastItem(schemas).version;
63
88
  const ensureORM = async () => {
64
- const lastSchemaVersion = getLastItem(schemas).version;
65
89
  try {
66
90
  const currentVersion = await client.createMigrator().getVersion();
67
91
  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 +115,87 @@ function createOrmDatabaseCore({ database, resolveFileUrl }) {
91
115
  if (where?.fingerprintHash !== void 0) conditions.push(where.fingerprintHash === null ? b.isNull("fingerprint_hash") : b("fingerprint_hash", "=", where.fingerprintHash));
92
116
  return conditions.length > 0 ? b.and(...conditions) : true;
93
117
  };
118
+ const mapBundleRecordToBundle = (record, patchRecords = []) => {
119
+ 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);
120
+ const primaryPatch = patches[0] ?? null;
121
+ return {
122
+ id: record.id,
123
+ platform: record.platform,
124
+ shouldForceUpdate: Boolean(record.should_force_update),
125
+ enabled: Boolean(record.enabled),
126
+ fileHash: record.file_hash,
127
+ gitCommitHash: record.git_commit_hash ?? null,
128
+ message: record.message ?? null,
129
+ channel: record.channel,
130
+ storageUri: record.storage_uri,
131
+ targetAppVersion: record.target_app_version ?? null,
132
+ fingerprintHash: record.fingerprint_hash ?? null,
133
+ metadata: parseBundleMetadata(record.metadata),
134
+ manifestStorageUri: record.manifest_storage_uri ?? null,
135
+ manifestFileHash: record.manifest_file_hash ?? null,
136
+ assetBaseStorageUri: record.asset_base_storage_uri ?? null,
137
+ patches,
138
+ patchBaseBundleId: primaryPatch?.baseBundleId ?? null,
139
+ patchBaseFileHash: primaryPatch?.baseFileHash ?? null,
140
+ patchFileHash: primaryPatch?.patchFileHash ?? null,
141
+ patchStorageUri: primaryPatch?.patchStorageUri ?? null,
142
+ rolloutCohortCount: record.rollout_cohort_count ?? DEFAULT_ROLLOUT_COHORT_COUNT,
143
+ targetCohorts: parseTargetCohorts(record.target_cohorts)
144
+ };
145
+ };
146
+ const fetchBundlePatchMap = async (orm, bundleIds) => {
147
+ const patchMap = /* @__PURE__ */ new Map();
148
+ if (bundleIds.length === 0) return patchMap;
149
+ const patchRows = await orm.findMany("bundle_patches", {
150
+ select: [
151
+ "id",
152
+ "bundle_id",
153
+ "base_bundle_id",
154
+ "base_file_hash",
155
+ "patch_file_hash",
156
+ "patch_storage_uri",
157
+ "order_index"
158
+ ],
159
+ where: (b) => b("bundle_id", "in", bundleIds)
160
+ });
161
+ for (const row of patchRows) {
162
+ const current = patchMap.get(row.bundle_id) ?? [];
163
+ current.push(row);
164
+ patchMap.set(row.bundle_id, current);
165
+ }
166
+ return patchMap;
167
+ };
168
+ const fetchBundleById = async (id) => {
169
+ const orm = await ensureORM();
170
+ const result = await orm.findFirst("bundles", {
171
+ select: [
172
+ "id",
173
+ "platform",
174
+ "should_force_update",
175
+ "enabled",
176
+ "file_hash",
177
+ "git_commit_hash",
178
+ "message",
179
+ "channel",
180
+ "storage_uri",
181
+ "target_app_version",
182
+ "fingerprint_hash",
183
+ "metadata",
184
+ "manifest_storage_uri",
185
+ "manifest_file_hash",
186
+ "asset_base_storage_uri",
187
+ "rollout_cohort_count",
188
+ "target_cohorts"
189
+ ],
190
+ where: (b) => b("id", "=", id)
191
+ });
192
+ if (!result) return null;
193
+ return mapBundleRecordToBundle(result, (await fetchBundlePatchMap(orm, [id])).get(id) ?? []);
194
+ };
94
195
  return {
95
196
  api: {
96
197
  async getBundleById(id) {
97
- const result = await (await ensureORM()).findFirst("bundles", {
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 ?? DEFAULT_ROLLOUT_COHORT_COUNT,
130
- targetCohorts: parseTargetCohorts(result.target_cohorts)
131
- };
198
+ return fetchBundleById(id);
132
199
  },
133
200
  async getUpdateInfo(args) {
134
201
  const orm = await ensureORM();
@@ -282,11 +349,34 @@ function createOrmDatabaseCore({ database, resolveFileUrl }) {
282
349
  const info = await this.getUpdateInfo(args);
283
350
  if (!info) return null;
284
351
  const { storageUri, ...rest } = info;
285
- const fileUrl = await resolveFileUrl(storageUri ?? null, context);
286
- return {
352
+ if (!readStorageText) {
353
+ const fileUrl = await resolveFileUrl(storageUri ?? null, context);
354
+ return {
355
+ ...rest,
356
+ fileUrl
357
+ };
358
+ }
359
+ const [fileUrl, currentBundle, targetBundle] = await Promise.all([
360
+ resolveFileUrl(storageUri ?? null, context),
361
+ args.bundleId !== NIL_UUID ? fetchBundleById(args.bundleId) : null,
362
+ info.id !== NIL_UUID ? fetchBundleById(info.id) : null
363
+ ]);
364
+ const baseResponse = {
287
365
  ...rest,
288
366
  fileUrl
289
367
  };
368
+ const manifestArtifacts = await resolveManifestArtifacts({
369
+ currentBundle,
370
+ resolveFileUrl,
371
+ readStorageText,
372
+ targetBundle,
373
+ context
374
+ });
375
+ if (!manifestArtifacts) return baseResponse;
376
+ return {
377
+ ...baseResponse,
378
+ ...manifestArtifacts
379
+ };
290
380
  },
291
381
  async getChannels() {
292
382
  const rows = await (await ensureORM()).findMany("bundles", {
@@ -315,26 +405,14 @@ function createOrmDatabaseCore({ database, resolveFileUrl }) {
315
405
  "target_app_version",
316
406
  "fingerprint_hash",
317
407
  "metadata",
408
+ "manifest_storage_uri",
409
+ "manifest_file_hash",
410
+ "asset_base_storage_uri",
318
411
  "rollout_cohort_count",
319
412
  "target_cohorts"
320
413
  ];
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 ?? DEFAULT_ROLLOUT_COHORT_COUNT,
334
- targetCohorts: parseTargetCohorts(r.target_cohorts)
335
- }));
336
414
  const findBundles = async ({ where, orderBy, limit, offset }) => {
337
- return mapRowsToBundles(isMongoAdapter ? (await orm.findMany("bundles", {
415
+ const rows = isMongoAdapter ? (await orm.findMany("bundles", {
338
416
  select: selectedColumns,
339
417
  where: buildBundleWhere(where)
340
418
  })).sort((a, b) => {
@@ -346,7 +424,9 @@ function createOrmDatabaseCore({ database, resolveFileUrl }) {
346
424
  orderBy: [[orderBy.field, orderBy.direction]],
347
425
  limit,
348
426
  offset
349
- }));
427
+ });
428
+ const patchMap = await fetchBundlePatchMap(orm, rows.map((row) => row.id));
429
+ return rows.map((row) => mapBundleRecordToBundle(row, patchMap.get(row.id) ?? []));
350
430
  };
351
431
  if (!options.cursor?.after && !options.cursor?.before) {
352
432
  const data = await findBundles({
@@ -400,6 +480,7 @@ function createOrmDatabaseCore({ database, resolveFileUrl }) {
400
480
  };
401
481
  },
402
482
  async insertBundle(bundle) {
483
+ assertBundlePersistenceConstraints(bundle);
403
484
  const orm = await ensureORM();
404
485
  const values = {
405
486
  id: bundle.id,
@@ -413,7 +494,10 @@ function createOrmDatabaseCore({ database, resolveFileUrl }) {
413
494
  storage_uri: bundle.storageUri,
414
495
  target_app_version: bundle.targetAppVersion,
415
496
  fingerprint_hash: bundle.fingerprintHash,
416
- metadata: bundle.metadata ?? {},
497
+ metadata: stripBundleArtifactMetadata(bundle.metadata) ?? {},
498
+ manifest_storage_uri: getManifestStorageUri(bundle),
499
+ manifest_file_hash: getManifestFileHash(bundle),
500
+ asset_base_storage_uri: getAssetBaseStorageUri(bundle),
417
501
  rollout_cohort_count: bundle.rolloutCohortCount ?? DEFAULT_ROLLOUT_COHORT_COUNT,
418
502
  target_cohorts: bundle.targetCohorts ?? null
419
503
  };
@@ -423,6 +507,9 @@ function createOrmDatabaseCore({ database, resolveFileUrl }) {
423
507
  create: values,
424
508
  update: updateValues
425
509
  });
510
+ await orm.deleteMany("bundle_patches", { where: (b) => b("bundle_id", "=", bundle.id) });
511
+ const patchValues = toBundlePatchRecords(bundle);
512
+ if (patchValues.length > 0) await orm.createMany("bundle_patches", patchValues);
426
513
  },
427
514
  async updateBundleById(bundleId, newBundle) {
428
515
  const orm = await ensureORM();
@@ -432,6 +519,7 @@ function createOrmDatabaseCore({ database, resolveFileUrl }) {
432
519
  ...current,
433
520
  ...newBundle
434
521
  };
522
+ assertBundlePersistenceConstraints(merged);
435
523
  const values = {
436
524
  id: merged.id,
437
525
  platform: merged.platform,
@@ -444,7 +532,10 @@ function createOrmDatabaseCore({ database, resolveFileUrl }) {
444
532
  storage_uri: merged.storageUri,
445
533
  target_app_version: merged.targetAppVersion,
446
534
  fingerprint_hash: merged.fingerprintHash,
447
- metadata: merged.metadata ?? {},
535
+ metadata: stripBundleArtifactMetadata(merged.metadata) ?? {},
536
+ manifest_storage_uri: getManifestStorageUri(merged),
537
+ manifest_file_hash: getManifestFileHash(merged),
538
+ asset_base_storage_uri: getAssetBaseStorageUri(merged),
448
539
  rollout_cohort_count: merged.rolloutCohortCount ?? DEFAULT_ROLLOUT_COHORT_COUNT,
449
540
  target_cohorts: merged.targetCohorts ?? null
450
541
  };
@@ -454,14 +545,30 @@ function createOrmDatabaseCore({ database, resolveFileUrl }) {
454
545
  create: values,
455
546
  update: updateValues2
456
547
  });
548
+ await orm.deleteMany("bundle_patches", { where: (b) => b("bundle_id", "=", merged.id) });
549
+ const patchValues = toBundlePatchRecords(merged);
550
+ if (patchValues.length > 0) await orm.createMany("bundle_patches", patchValues);
457
551
  },
458
552
  async deleteBundleById(bundleId) {
459
- await (await ensureORM()).deleteMany("bundles", { where: (b) => b("id", "=", bundleId) });
553
+ const orm = await ensureORM();
554
+ if (!await orm.findFirst("bundles", {
555
+ select: ["id"],
556
+ where: (b) => b("id", "=", bundleId)
557
+ })) return;
558
+ await orm.deleteMany("bundle_patches", { where: (b) => b("bundle_id", "=", bundleId) });
559
+ await orm.deleteMany("bundle_patches", { where: (b) => b("base_bundle_id", "=", bundleId) });
560
+ await orm.deleteMany("bundles", { where: (b) => b("id", "=", bundleId) });
460
561
  }
461
562
  },
462
563
  adapterName: client.adapter.name,
463
- createMigrator: () => client.createMigrator(),
464
- generateSchema: client.generateSchema
564
+ createMigrator: () => wrapKyselyMigrator(client.createMigrator(), getSQLProvider(database.provider), lastSchemaVersion),
565
+ generateSchema: (version, name) => {
566
+ const result = client.generateSchema(version, name);
567
+ return {
568
+ ...result,
569
+ code: enhanceGeneratedSchema(client.adapter.name, result.code, database.provider)
570
+ };
571
+ }
465
572
  };
466
573
  }
467
574
  //#endregion
@@ -1,5 +1,8 @@
1
- let _hot_updater_core = require("@hot-updater/core");
1
+ require("../_virtual/_rolldown/runtime.cjs");
2
+ const require_schemaEnhancements = require("./schemaEnhancements.cjs");
3
+ const require_updateArtifacts = require("./updateArtifacts.cjs");
2
4
  let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
5
+ let _hot_updater_core = require("@hot-updater/core");
3
6
  //#region src/db/pluginCore.ts
4
7
  const PAGE_SIZE = 100;
5
8
  const DESC_ORDER = {
@@ -147,11 +150,35 @@ function createPluginDatabaseCore(getPlugin, resolveFileUrl, options) {
147
150
  const info = await this.getUpdateInfo(args, context);
148
151
  if (!info) return null;
149
152
  const { storageUri, ...rest } = info;
150
- const fileUrl = await resolveFileUrl(storageUri ?? null, context);
151
- return {
153
+ const readStorageText = options?.readStorageText;
154
+ if (info.id === _hot_updater_core.NIL_UUID || !readStorageText) {
155
+ const fileUrl = await resolveFileUrl(storageUri ?? null, context);
156
+ return {
157
+ ...rest,
158
+ fileUrl
159
+ };
160
+ }
161
+ const [fileUrl, targetBundle, currentBundle] = await Promise.all([
162
+ resolveFileUrl(storageUri ?? null, context),
163
+ getPlugin().getBundleById(info.id, context),
164
+ args.bundleId !== _hot_updater_core.NIL_UUID ? getPlugin().getBundleById(args.bundleId, context) : null
165
+ ]);
166
+ const baseResponse = {
152
167
  ...rest,
153
168
  fileUrl
154
169
  };
170
+ const manifestArtifacts = await require_updateArtifacts.resolveManifestArtifacts({
171
+ currentBundle,
172
+ resolveFileUrl,
173
+ readStorageText,
174
+ targetBundle,
175
+ context
176
+ });
177
+ if (!manifestArtifacts) return baseResponse;
178
+ return {
179
+ ...baseResponse,
180
+ ...manifestArtifacts
181
+ };
155
182
  },
156
183
  async getChannels(context) {
157
184
  return getPlugin().getChannels(context);
@@ -160,6 +187,7 @@ function createPluginDatabaseCore(getPlugin, resolveFileUrl, options) {
160
187
  return getPlugin().getBundles(options, context);
161
188
  },
162
189
  async insertBundle(bundle, context) {
190
+ require_schemaEnhancements.assertBundlePersistenceConstraints(bundle);
163
191
  await runWithMutationPlugin(async (plugin) => {
164
192
  await plugin.appendBundle(bundle, context);
165
193
  await plugin.commitBundle(context);
@@ -167,6 +195,12 @@ function createPluginDatabaseCore(getPlugin, resolveFileUrl, options) {
167
195
  },
168
196
  async updateBundleById(bundleId, newBundle, context) {
169
197
  await runWithMutationPlugin(async (plugin) => {
198
+ const current = await plugin.getBundleById(bundleId, context);
199
+ if (!current) throw new Error("targetBundleId not found");
200
+ require_schemaEnhancements.assertBundlePersistenceConstraints({
201
+ ...current,
202
+ ...newBundle
203
+ });
170
204
  await plugin.updateBundle(bundleId, newBundle, context);
171
205
  await plugin.commitBundle(context);
172
206
  });
@@ -1,5 +1,7 @@
1
- import { NIL_UUID, isCohortEligibleForUpdate } from "@hot-updater/core";
1
+ import { assertBundlePersistenceConstraints } from "./schemaEnhancements.mjs";
2
+ import { resolveManifestArtifacts } from "./updateArtifacts.mjs";
2
3
  import { semverSatisfies } from "@hot-updater/plugin-core";
4
+ import { NIL_UUID, isCohortEligibleForUpdate } from "@hot-updater/core";
3
5
  //#region src/db/pluginCore.ts
4
6
  const PAGE_SIZE = 100;
5
7
  const DESC_ORDER = {
@@ -147,11 +149,35 @@ function createPluginDatabaseCore(getPlugin, resolveFileUrl, options) {
147
149
  const info = await this.getUpdateInfo(args, context);
148
150
  if (!info) return null;
149
151
  const { storageUri, ...rest } = info;
150
- const fileUrl = await resolveFileUrl(storageUri ?? null, context);
151
- return {
152
+ const readStorageText = options?.readStorageText;
153
+ if (info.id === NIL_UUID || !readStorageText) {
154
+ const fileUrl = await resolveFileUrl(storageUri ?? null, context);
155
+ return {
156
+ ...rest,
157
+ fileUrl
158
+ };
159
+ }
160
+ const [fileUrl, targetBundle, currentBundle] = await Promise.all([
161
+ resolveFileUrl(storageUri ?? null, context),
162
+ getPlugin().getBundleById(info.id, context),
163
+ args.bundleId !== NIL_UUID ? getPlugin().getBundleById(args.bundleId, context) : null
164
+ ]);
165
+ const baseResponse = {
152
166
  ...rest,
153
167
  fileUrl
154
168
  };
169
+ const manifestArtifacts = await resolveManifestArtifacts({
170
+ currentBundle,
171
+ resolveFileUrl,
172
+ readStorageText,
173
+ targetBundle,
174
+ context
175
+ });
176
+ if (!manifestArtifacts) return baseResponse;
177
+ return {
178
+ ...baseResponse,
179
+ ...manifestArtifacts
180
+ };
155
181
  },
156
182
  async getChannels(context) {
157
183
  return getPlugin().getChannels(context);
@@ -160,6 +186,7 @@ function createPluginDatabaseCore(getPlugin, resolveFileUrl, options) {
160
186
  return getPlugin().getBundles(options, context);
161
187
  },
162
188
  async insertBundle(bundle, context) {
189
+ assertBundlePersistenceConstraints(bundle);
163
190
  await runWithMutationPlugin(async (plugin) => {
164
191
  await plugin.appendBundle(bundle, context);
165
192
  await plugin.commitBundle(context);
@@ -167,6 +194,12 @@ function createPluginDatabaseCore(getPlugin, resolveFileUrl, options) {
167
194
  },
168
195
  async updateBundleById(bundleId, newBundle, context) {
169
196
  await runWithMutationPlugin(async (plugin) => {
197
+ const current = await plugin.getBundleById(bundleId, context);
198
+ if (!current) throw new Error("targetBundleId not found");
199
+ assertBundlePersistenceConstraints({
200
+ ...current,
201
+ ...newBundle
202
+ });
170
203
  await plugin.updateBundle(bundleId, newBundle, context);
171
204
  await plugin.commitBundle(context);
172
205
  });