@hot-updater/server 0.33.1 → 0.34.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.
Files changed (198) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +0 -2
  2. package/dist/adapters/drizzle.cjs +195 -2
  3. package/dist/adapters/drizzle.d.cts +7 -4
  4. package/dist/adapters/drizzle.d.mts +7 -4
  5. package/dist/adapters/drizzle.mjs +194 -2
  6. package/dist/adapters/drizzleLazyDB.cjs +53 -0
  7. package/dist/adapters/drizzleLazyDB.mjs +53 -0
  8. package/dist/adapters/kysely.cjs +154 -3
  9. package/dist/adapters/kysely.d.cts +18 -10
  10. package/dist/adapters/kysely.d.mts +18 -10
  11. package/dist/adapters/kysely.mjs +153 -3
  12. package/dist/adapters/mongodb.cjs +183 -2
  13. package/dist/adapters/mongodb.d.cts +5 -4
  14. package/dist/adapters/mongodb.d.mts +5 -4
  15. package/dist/adapters/mongodb.mjs +183 -2
  16. package/dist/adapters/prisma.cjs +200 -2
  17. package/dist/adapters/prisma.d.cts +9 -4
  18. package/dist/adapters/prisma.d.mts +9 -4
  19. package/dist/adapters/prisma.mjs +199 -2
  20. package/dist/db/bundleRows.cjs +82 -0
  21. package/dist/db/bundleRows.d.cts +33 -0
  22. package/dist/db/bundleRows.d.mts +33 -0
  23. package/dist/db/bundleRows.mjs +79 -0
  24. package/dist/db/fixedMigrator.cjs +136 -0
  25. package/dist/db/fixedMigrator.mjs +135 -0
  26. package/dist/db/index.cjs +17 -15
  27. package/dist/db/index.d.cts +3 -3
  28. package/dist/db/index.d.mts +3 -3
  29. package/dist/db/index.mjs +17 -15
  30. package/dist/db/pluginCore.cjs +13 -5
  31. package/dist/db/pluginCore.mjs +13 -5
  32. package/dist/db/schema/mongodb.cjs +17 -0
  33. package/dist/db/schema/mongodb.mjs +17 -0
  34. package/dist/db/schema/registry.cjs +23 -0
  35. package/dist/db/schema/registry.mjs +18 -0
  36. package/dist/db/schema/sql.cjs +84 -0
  37. package/dist/db/schema/sql.mjs +78 -0
  38. package/dist/db/schema/sqlMigrations.cjs +74 -0
  39. package/dist/db/schema/sqlMigrations.mjs +73 -0
  40. package/dist/db/schema/sqlOperations.cjs +27 -0
  41. package/dist/db/schema/sqlOperations.mjs +26 -0
  42. package/dist/db/schemaEnhancements.cjs +1 -152
  43. package/dist/db/schemaEnhancements.mjs +1 -149
  44. package/dist/db/schemaGenerators.cjs +222 -0
  45. package/dist/db/schemaGenerators.mjs +220 -0
  46. package/dist/db/schemaReadiness.cjs +23 -0
  47. package/dist/db/schemaReadiness.d.cts +8 -0
  48. package/dist/db/schemaReadiness.d.mts +8 -0
  49. package/dist/db/schemaReadiness.mjs +22 -0
  50. package/dist/db/types.cjs +10 -2
  51. package/dist/db/types.d.cts +58 -14
  52. package/dist/db/types.d.mts +58 -14
  53. package/dist/db/types.mjs +9 -1
  54. package/dist/index.cjs +2 -2
  55. package/dist/index.d.cts +3 -2
  56. package/dist/index.d.mts +3 -2
  57. package/dist/index.mjs +2 -2
  58. package/dist/{packages/server/package.cjs → package.cjs} +1 -1
  59. package/dist/{packages/server/package.mjs → package.mjs} +1 -1
  60. package/dist/runtime.cjs +9 -2
  61. package/dist/runtime.mjs +9 -2
  62. package/dist/schema/dsl.cjs +86 -0
  63. package/dist/schema/dsl.mjs +73 -0
  64. package/dist/schema/index.cjs +13 -0
  65. package/dist/schema/index.mjs +13 -0
  66. package/dist/schema/settings.cjs +9 -0
  67. package/dist/schema/settings.mjs +9 -0
  68. package/dist/schema/types.cjs +6 -0
  69. package/dist/schema/types.mjs +5 -0
  70. package/dist/schema/v0_21_0.cjs +33 -18
  71. package/dist/schema/v0_21_0.mjs +32 -18
  72. package/dist/schema/v0_29_0.cjs +40 -20
  73. package/dist/schema/v0_29_0.mjs +39 -20
  74. package/dist/schema/v0_31_0.cjs +77 -43
  75. package/dist/schema/v0_31_0.mjs +75 -43
  76. package/dist/version.cjs +1 -1
  77. package/dist/version.mjs +1 -1
  78. package/package.json +30 -16
  79. package/src/adapters/drizzle.spec.ts +75 -0
  80. package/src/adapters/drizzle.ts +328 -12
  81. package/src/adapters/drizzleLazyDB.ts +151 -0
  82. package/src/adapters/kysely.spec.ts +107 -0
  83. package/src/adapters/kysely.ts +349 -14
  84. package/src/adapters/mongodb.ts +298 -15
  85. package/src/adapters/prisma.ts +337 -12
  86. package/src/db/bundleRows.ts +140 -0
  87. package/src/db/fixedMigrator.spec.ts +89 -0
  88. package/src/db/fixedMigrator.ts +288 -0
  89. package/src/db/hotUpdaterSchema.ts +6 -0
  90. package/src/db/index.spec.ts +976 -13
  91. package/src/db/index.ts +37 -36
  92. package/src/db/pluginCore.spec.ts +17 -11
  93. package/src/db/pluginCore.ts +15 -6
  94. package/src/db/schema/definitions.ts +1 -0
  95. package/src/db/schema/mongodb.ts +26 -0
  96. package/src/db/schema/registry.ts +55 -0
  97. package/src/db/schema/sql.ts +200 -0
  98. package/src/db/schema/sqlMigrations.ts +219 -0
  99. package/src/db/schema/sqlOperations.ts +62 -0
  100. package/src/db/schema/types.ts +1 -0
  101. package/src/db/schemaEnhancements.ts +0 -405
  102. package/src/db/schemaGenerators.ts +382 -0
  103. package/src/db/schemaReadiness.ts +33 -0
  104. package/src/db/types.ts +69 -25
  105. package/src/runtime.spec.ts +70 -0
  106. package/src/runtime.ts +14 -2
  107. package/src/schema/dsl-all-versions.spec.ts +26 -0
  108. package/src/schema/dsl.ts +148 -0
  109. package/src/schema/index.ts +16 -0
  110. package/src/schema/settings.ts +15 -0
  111. package/src/schema/types.ts +73 -0
  112. package/src/schema/v0_21_0.ts +48 -18
  113. package/src/schema/v0_29_0.ts +58 -22
  114. package/src/schema/v0_31_0.spec.ts +73 -0
  115. package/src/schema/v0_31_0.ts +116 -54
  116. package/dist/_virtual/_rolldown/runtime.mjs +0 -6
  117. package/dist/calculatePagination.cjs +0 -25
  118. package/dist/calculatePagination.mjs +0 -25
  119. package/dist/db/ormCore.cjs +0 -577
  120. package/dist/db/ormCore.d.cts +0 -110
  121. package/dist/db/ormCore.d.mts +0 -110
  122. package/dist/db/ormCore.mjs +0 -575
  123. package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/_u64.cjs +0 -112
  124. package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/_u64.mjs +0 -108
  125. package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/cryptoNode.cjs +0 -22
  126. package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/cryptoNode.mjs +0 -18
  127. package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/sha3.cjs +0 -219
  128. package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/sha3.mjs +0 -214
  129. package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/utils.cjs +0 -275
  130. package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/utils.mjs +0 -270
  131. package/dist/node_modules/.pnpm/@paralleldrive_cuid2@2.3.1/node_modules/@paralleldrive/cuid2/index.cjs +0 -17
  132. package/dist/node_modules/.pnpm/@paralleldrive_cuid2@2.3.1/node_modules/@paralleldrive/cuid2/index.mjs +0 -13
  133. package/dist/node_modules/.pnpm/@paralleldrive_cuid2@2.3.1/node_modules/@paralleldrive/cuid2/src/index.cjs +0 -69
  134. package/dist/node_modules/.pnpm/@paralleldrive_cuid2@2.3.1/node_modules/@paralleldrive/cuid2/src/index.mjs +0 -65
  135. package/dist/node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare_workers-types@4.20260611.1_@electric-sql_pglite@0.4.1_@l_601a3995dfc55b0b7fac93cbe1e76579/node_modules/drizzle-orm/column.cjs +0 -52
  136. package/dist/node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare_workers-types@4.20260611.1_@electric-sql_pglite@0.4.1_@l_601a3995dfc55b0b7fac93cbe1e76579/node_modules/drizzle-orm/column.mjs +0 -52
  137. package/dist/node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare_workers-types@4.20260611.1_@electric-sql_pglite@0.4.1_@l_601a3995dfc55b0b7fac93cbe1e76579/node_modules/drizzle-orm/entity.cjs +0 -16
  138. package/dist/node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare_workers-types@4.20260611.1_@electric-sql_pglite@0.4.1_@l_601a3995dfc55b0b7fac93cbe1e76579/node_modules/drizzle-orm/entity.mjs +0 -15
  139. package/dist/node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare_workers-types@4.20260611.1_@electric-sql_pglite@0.4.1_@l_601a3995dfc55b0b7fac93cbe1e76579/node_modules/drizzle-orm/pg-core/columns/enum.cjs +0 -7
  140. package/dist/node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare_workers-types@4.20260611.1_@electric-sql_pglite@0.4.1_@l_601a3995dfc55b0b7fac93cbe1e76579/node_modules/drizzle-orm/pg-core/columns/enum.mjs +0 -7
  141. package/dist/node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare_workers-types@4.20260611.1_@electric-sql_pglite@0.4.1_@l_601a3995dfc55b0b7fac93cbe1e76579/node_modules/drizzle-orm/sql/expressions/conditions.cjs +0 -92
  142. package/dist/node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare_workers-types@4.20260611.1_@electric-sql_pglite@0.4.1_@l_601a3995dfc55b0b7fac93cbe1e76579/node_modules/drizzle-orm/sql/expressions/conditions.mjs +0 -78
  143. package/dist/node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare_workers-types@4.20260611.1_@electric-sql_pglite@0.4.1_@l_601a3995dfc55b0b7fac93cbe1e76579/node_modules/drizzle-orm/sql/expressions/select.cjs +0 -11
  144. package/dist/node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare_workers-types@4.20260611.1_@electric-sql_pglite@0.4.1_@l_601a3995dfc55b0b7fac93cbe1e76579/node_modules/drizzle-orm/sql/expressions/select.mjs +0 -10
  145. package/dist/node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare_workers-types@4.20260611.1_@electric-sql_pglite@0.4.1_@l_601a3995dfc55b0b7fac93cbe1e76579/node_modules/drizzle-orm/sql/sql.cjs +0 -383
  146. package/dist/node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare_workers-types@4.20260611.1_@electric-sql_pglite@0.4.1_@l_601a3995dfc55b0b7fac93cbe1e76579/node_modules/drizzle-orm/sql/sql.mjs +0 -366
  147. package/dist/node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare_workers-types@4.20260611.1_@electric-sql_pglite@0.4.1_@l_601a3995dfc55b0b7fac93cbe1e76579/node_modules/drizzle-orm/subquery.cjs +0 -17
  148. package/dist/node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare_workers-types@4.20260611.1_@electric-sql_pglite@0.4.1_@l_601a3995dfc55b0b7fac93cbe1e76579/node_modules/drizzle-orm/subquery.mjs +0 -17
  149. package/dist/node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare_workers-types@4.20260611.1_@electric-sql_pglite@0.4.1_@l_601a3995dfc55b0b7fac93cbe1e76579/node_modules/drizzle-orm/table.cjs +0 -60
  150. package/dist/node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare_workers-types@4.20260611.1_@electric-sql_pglite@0.4.1_@l_601a3995dfc55b0b7fac93cbe1e76579/node_modules/drizzle-orm/table.mjs +0 -59
  151. package/dist/node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare_workers-types@4.20260611.1_@electric-sql_pglite@0.4.1_@l_601a3995dfc55b0b7fac93cbe1e76579/node_modules/drizzle-orm/table.utils.cjs +0 -4
  152. package/dist/node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare_workers-types@4.20260611.1_@electric-sql_pglite@0.4.1_@l_601a3995dfc55b0b7fac93cbe1e76579/node_modules/drizzle-orm/table.utils.mjs +0 -4
  153. package/dist/node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare_workers-types@4.20260611.1_@electric-sql_pglite@0.4.1_@l_601a3995dfc55b0b7fac93cbe1e76579/node_modules/drizzle-orm/tracing.cjs +0 -6
  154. package/dist/node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare_workers-types@4.20260611.1_@electric-sql_pglite@0.4.1_@l_601a3995dfc55b0b7fac93cbe1e76579/node_modules/drizzle-orm/tracing.mjs +0 -6
  155. package/dist/node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare_workers-types@4.20260611.1_@electric-sql_pglite@0.4.1_@l_601a3995dfc55b0b7fac93cbe1e76579/node_modules/drizzle-orm/view-common.cjs +0 -4
  156. package/dist/node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare_workers-types@4.20260611.1_@electric-sql_pglite@0.4.1_@l_601a3995dfc55b0b7fac93cbe1e76579/node_modules/drizzle-orm/view-common.mjs +0 -4
  157. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/adapters/drizzle/index.cjs +0 -383
  158. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/adapters/drizzle/index.d.cts +0 -12
  159. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/adapters/drizzle/index.d.mts +0 -12
  160. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/adapters/drizzle/index.mjs +0 -383
  161. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/adapters/kysely/index.cjs +0 -4
  162. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/adapters/kysely/index.mjs +0 -5
  163. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/adapters/prisma/index.cjs +0 -339
  164. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/adapters/prisma/index.d.cts +0 -70
  165. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/adapters/prisma/index.d.mts +0 -70
  166. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/adapters/prisma/index.mjs +0 -339
  167. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/chunk-7PZK4ONR.cjs +0 -57
  168. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/chunk-7PZK4ONR.mjs +0 -56
  169. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/chunk-C6OTUURW.cjs +0 -330
  170. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/chunk-C6OTUURW.mjs +0 -326
  171. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/chunk-CHTIKPQU.cjs +0 -166
  172. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/chunk-CHTIKPQU.mjs +0 -163
  173. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/chunk-GUE4GMNC.cjs +0 -14
  174. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/chunk-GUE4GMNC.mjs +0 -13
  175. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/chunk-LHHP6UVP.cjs +0 -24
  176. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/chunk-LHHP6UVP.mjs +0 -24
  177. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/chunk-LVCPMTAT.cjs +0 -1190
  178. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/chunk-LVCPMTAT.mjs +0 -1189
  179. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/chunk-PK2W2SQ7.cjs +0 -197
  180. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/chunk-PK2W2SQ7.mjs +0 -197
  181. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/chunk-ZEQMAIFI.cjs +0 -410
  182. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/chunk-ZEQMAIFI.mjs +0 -400
  183. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/chunk-ZOCGSAWS.cjs +0 -213
  184. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/chunk-ZOCGSAWS.mjs +0 -212
  185. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/create-tg0451Y_.d.cts +0 -285
  186. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/create-tg0451Y_.d.mts +0 -285
  187. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/index-CMqePMTF.d.cts +0 -45
  188. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/index-CMqePMTF.d.mts +0 -45
  189. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/index.cjs +0 -69
  190. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/index.d.cts +0 -49
  191. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/index.d.mts +0 -49
  192. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/index.mjs +0 -67
  193. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/query/index.d.cts +0 -156
  194. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/query/index.d.mts +0 -156
  195. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/schema/index.cjs +0 -1
  196. package/dist/node_modules/.pnpm/fumadb@0.2.2_mongodb@6.20.0_@aws-sdk_credential-providers@3.1066.0_socks@2.8.9__prisma@_ee79457f0e32f18f0beb5c2db02e4f73/node_modules/fumadb/dist/schema/index.mjs +0 -2
  197. package/src/db/ormCore.ts +0 -1059
  198. package/src/db/ormUpdateCheck.bench.ts +0 -262
@@ -0,0 +1,148 @@
1
+ import type {
2
+ HotUpdaterColumnSchema,
3
+ HotUpdaterColumnType,
4
+ HotUpdaterCheckSchema,
5
+ HotUpdaterDefault,
6
+ HotUpdaterForeignKeySchema,
7
+ HotUpdaterIndexSchema,
8
+ HotUpdaterRelationSchema,
9
+ HotUpdaterTableSchema,
10
+ HotUpdaterVersionedSchema,
11
+ } from "./types";
12
+
13
+ type DefaultValue = boolean | number | string | Record<string, unknown>;
14
+
15
+ export type HotUpdaterColumnDsl = {
16
+ readonly dsl: "column";
17
+ readonly ormName: string;
18
+ readonly type: HotUpdaterColumnType;
19
+ readonly default?: HotUpdaterDefault;
20
+ readonly nullableValue?: true;
21
+ readonly primaryKeyValue?: true;
22
+ readonly nullable: () => HotUpdaterColumnDsl;
23
+ readonly primaryKey: () => HotUpdaterColumnDsl;
24
+ readonly defaultTo: (value: DefaultValue) => HotUpdaterColumnDsl;
25
+ };
26
+
27
+ export type HotUpdaterTableDsl = HotUpdaterTableSchema & {
28
+ readonly dsl: "table";
29
+ };
30
+
31
+ const withDsl = <Value extends object, Dsl extends string>(
32
+ value: Value,
33
+ dsl: Dsl,
34
+ ): Value & { readonly dsl: Dsl } =>
35
+ Object.defineProperty(value, "dsl", {
36
+ enumerable: false,
37
+ value: dsl,
38
+ }) as Value & { readonly dsl: Dsl };
39
+
40
+ const defaultValue = (value: DefaultValue): HotUpdaterDefault =>
41
+ typeof value === "object"
42
+ ? { type: "json", value }
43
+ : { type: "literal", value };
44
+
45
+ const columnSchema = (column: HotUpdaterColumnDsl): HotUpdaterColumnSchema => ({
46
+ ormName: column.ormName,
47
+ type: column.type,
48
+ ...(column.nullableValue ? { nullable: true } : {}),
49
+ ...(column.primaryKeyValue ? { primaryKey: true } : {}),
50
+ ...(column.default ? { default: column.default } : {}),
51
+ });
52
+
53
+ type ColumnState = HotUpdaterColumnSchema & {
54
+ readonly nullableValue?: boolean;
55
+ readonly primaryKeyValue?: boolean;
56
+ };
57
+
58
+ const createColumn = (state: ColumnState): HotUpdaterColumnDsl => ({
59
+ dsl: "column",
60
+ ormName: state.ormName,
61
+ type: state.type,
62
+ ...(state.nullableValue ? { nullableValue: true } : {}),
63
+ ...(state.primaryKeyValue ? { primaryKeyValue: true } : {}),
64
+ ...(state.default ? { default: state.default } : {}),
65
+ nullable: () => createColumn({ ...state, nullableValue: true }),
66
+ primaryKey: () => createColumn({ ...state, primaryKeyValue: true }),
67
+ defaultTo: (value) =>
68
+ createColumn({ ...state, default: defaultValue(value) }),
69
+ });
70
+
71
+ export const varchar = <Length extends number>(
72
+ length: Length,
73
+ ): `varchar(${Length})` => `varchar(${length})` as `varchar(${Length})`;
74
+
75
+ export const column = (
76
+ ormName: string,
77
+ type: HotUpdaterColumnType,
78
+ ): HotUpdaterColumnDsl => createColumn({ ormName, type });
79
+
80
+ export const idColumn = (
81
+ ormName: string,
82
+ type: HotUpdaterColumnType,
83
+ ): HotUpdaterColumnDsl => column(ormName, type).primaryKey();
84
+
85
+ export const uuid = (ormName: string): HotUpdaterColumnDsl =>
86
+ column(ormName, "uuid");
87
+
88
+ export const integer = (ormName: string): HotUpdaterColumnDsl =>
89
+ column(ormName, "integer");
90
+
91
+ export const bool = (ormName: string): HotUpdaterColumnDsl =>
92
+ column(ormName, "bool");
93
+
94
+ export const json = (ormName: string): HotUpdaterColumnDsl =>
95
+ column(ormName, "json");
96
+
97
+ export const stringColumn = (ormName: string): HotUpdaterColumnDsl =>
98
+ column(ormName, "string");
99
+
100
+ export const index = (
101
+ name: string,
102
+ columns: readonly string[],
103
+ providers?: HotUpdaterIndexSchema["providers"],
104
+ ): HotUpdaterIndexSchema => ({
105
+ name,
106
+ columns,
107
+ ...(providers ? { providers } : {}),
108
+ });
109
+
110
+ export const foreignKey = (
111
+ name: string,
112
+ columns: readonly string[],
113
+ referencedTable: string,
114
+ referencedColumns: readonly string[],
115
+ ): HotUpdaterForeignKeySchema => ({
116
+ name,
117
+ columns,
118
+ referencedTable,
119
+ referencedColumns,
120
+ onUpdate: "restrict",
121
+ onDelete: "cascade",
122
+ });
123
+
124
+ export const check = (config: HotUpdaterCheckSchema): HotUpdaterCheckSchema =>
125
+ config;
126
+
127
+ export const relation = (
128
+ config: HotUpdaterRelationSchema,
129
+ ): HotUpdaterRelationSchema => config;
130
+
131
+ export const table = (
132
+ ormName: string,
133
+ columns: Record<string, HotUpdaterColumnDsl>,
134
+ extras: Omit<HotUpdaterTableSchema, "columns" | "ormName"> = {},
135
+ ): HotUpdaterTableDsl =>
136
+ withDsl(
137
+ {
138
+ ormName,
139
+ columns: Object.values(columns).map(columnSchema),
140
+ ...extras,
141
+ },
142
+ "table",
143
+ );
144
+
145
+ export const schema = (
146
+ value: HotUpdaterVersionedSchema,
147
+ ): HotUpdaterVersionedSchema & { readonly dsl: "schema" } =>
148
+ withDsl({ ...value }, "schema");
@@ -0,0 +1,16 @@
1
+ import type { HotUpdaterVersionedSchema } from "./types";
2
+ import { v0_21_0 } from "./v0_21_0";
3
+ import { v0_29_0 } from "./v0_29_0";
4
+ import { v0_31_0 } from "./v0_31_0";
5
+
6
+ export * from "./settings";
7
+ export * from "./types";
8
+ export * from "./v0_21_0";
9
+ export * from "./v0_29_0";
10
+ export * from "./v0_31_0";
11
+
12
+ export const hotUpdaterSchemaVersions: readonly HotUpdaterVersionedSchema[] = [
13
+ v0_21_0,
14
+ v0_29_0,
15
+ v0_31_0,
16
+ ];
@@ -0,0 +1,15 @@
1
+ import { idColumn, stringColumn, table, varchar } from "./dsl";
2
+ import {
3
+ HOT_UPDATER_SETTINGS_TABLE,
4
+ type HotUpdaterSchemaVersion,
5
+ } from "./types";
6
+
7
+ export const createSettingsTable = (version: HotUpdaterSchemaVersion) =>
8
+ table(
9
+ HOT_UPDATER_SETTINGS_TABLE,
10
+ {
11
+ key: idColumn("key", varchar(255)),
12
+ value: stringColumn("value").defaultTo(version),
13
+ },
14
+ { internal: true },
15
+ );
@@ -0,0 +1,73 @@
1
+ import type { ORMProvider } from "../db/types";
2
+
3
+ export const HOT_UPDATER_SCHEMA_VERSION = "0.31.0";
4
+ export const HOT_UPDATER_SETTINGS_TABLE = "private_hot_updater_settings";
5
+
6
+ export type HotUpdaterColumnType =
7
+ | "bool"
8
+ | "integer"
9
+ | "json"
10
+ | "string"
11
+ | "uuid"
12
+ | `varchar(${number})`;
13
+
14
+ export type HotUpdaterDefault =
15
+ | { readonly type: "literal"; readonly value: boolean | number | string }
16
+ | { readonly type: "json"; readonly value: unknown };
17
+
18
+ export interface HotUpdaterColumnSchema {
19
+ readonly ormName: string;
20
+ readonly type: HotUpdaterColumnType;
21
+ readonly nullable?: boolean;
22
+ readonly primaryKey?: boolean;
23
+ readonly default?: HotUpdaterDefault;
24
+ }
25
+
26
+ export interface HotUpdaterIndexSchema {
27
+ readonly name: string;
28
+ readonly columns: readonly string[];
29
+ readonly providers?: readonly ORMProvider[];
30
+ }
31
+
32
+ export interface HotUpdaterCheckSchema {
33
+ readonly name: string;
34
+ readonly expression: string;
35
+ readonly sqliteInline?: boolean;
36
+ }
37
+
38
+ export interface HotUpdaterForeignKeySchema {
39
+ readonly name: string;
40
+ readonly columns: readonly string[];
41
+ readonly referencedTable: string;
42
+ readonly referencedColumns: readonly string[];
43
+ readonly onUpdate: "restrict";
44
+ readonly onDelete: "cascade";
45
+ }
46
+
47
+ export interface HotUpdaterRelationSchema {
48
+ readonly name: string;
49
+ readonly fieldName: string;
50
+ readonly targetFieldName: string;
51
+ readonly relationName: string;
52
+ readonly columns: readonly string[];
53
+ readonly referencedTable: string;
54
+ readonly referencedColumns: readonly string[];
55
+ }
56
+
57
+ export interface HotUpdaterTableSchema {
58
+ readonly ormName: string;
59
+ readonly columns: readonly HotUpdaterColumnSchema[];
60
+ readonly indexes?: readonly HotUpdaterIndexSchema[];
61
+ readonly checks?: readonly HotUpdaterCheckSchema[];
62
+ readonly foreignKeys?: readonly HotUpdaterForeignKeySchema[];
63
+ readonly relations?: readonly HotUpdaterRelationSchema[];
64
+ readonly internal?: boolean;
65
+ }
66
+
67
+ export interface HotUpdaterVersionedSchema {
68
+ readonly version: HotUpdaterSchemaVersion;
69
+ readonly settingsTable: string;
70
+ readonly tables: readonly HotUpdaterTableSchema[];
71
+ }
72
+
73
+ export type HotUpdaterSchemaVersion = "0.21.0" | "0.29.0" | "0.31.0";
@@ -1,22 +1,52 @@
1
- import { column, idColumn, schema, table } from "fumadb/schema";
1
+ import {
2
+ bool,
3
+ check,
4
+ idColumn,
5
+ index,
6
+ json,
7
+ schema,
8
+ stringColumn,
9
+ table,
10
+ } from "./dsl";
11
+ import { createSettingsTable } from "./settings";
12
+ import { HOT_UPDATER_SETTINGS_TABLE } from "./types";
13
+
14
+ export const bundlesV021 = table(
15
+ "bundles",
16
+ {
17
+ id: idColumn("id", "uuid"),
18
+ platform: stringColumn("platform"),
19
+ should_force_update: bool("should_force_update"),
20
+ enabled: bool("enabled"),
21
+ file_hash: stringColumn("file_hash"),
22
+ git_commit_hash: stringColumn("git_commit_hash").nullable(),
23
+ message: stringColumn("message").nullable(),
24
+ channel: stringColumn("channel").defaultTo("production"),
25
+ storage_uri: stringColumn("storage_uri"),
26
+ target_app_version: stringColumn("target_app_version").nullable(),
27
+ fingerprint_hash: stringColumn("fingerprint_hash").nullable(),
28
+ metadata: json("metadata").defaultTo({}),
29
+ },
30
+ {
31
+ indexes: [
32
+ index("bundles_target_app_version_idx", ["target_app_version"]),
33
+ index("bundles_fingerprint_hash_idx", ["fingerprint_hash"]),
34
+ index("bundles_channel_idx", ["channel"]),
35
+ index("bundles_platform_idx", ["platform"], ["mongodb"]),
36
+ ],
37
+ checks: [
38
+ check({
39
+ name: "check_version_or_fingerprint",
40
+ expression:
41
+ "(target_app_version is not null) or (fingerprint_hash is not null)",
42
+ sqliteInline: true,
43
+ }),
44
+ ],
45
+ },
46
+ );
2
47
 
3
48
  export const v0_21_0 = schema({
4
49
  version: "0.21.0",
5
- tables: {
6
- bundles: table("bundles", {
7
- id: idColumn("id", "uuid"),
8
- platform: column("platform", "string"),
9
- should_force_update: column("should_force_update", "bool"),
10
- enabled: column("enabled", "bool"),
11
- file_hash: column("file_hash", "string"),
12
- git_commit_hash: column("git_commit_hash", "string").nullable(),
13
- message: column("message", "string").nullable(),
14
- channel: column("channel", "string").defaultTo("production"),
15
- storage_uri: column("storage_uri", "string"),
16
- target_app_version: column("target_app_version", "string").nullable(),
17
- fingerprint_hash: column("fingerprint_hash", "string").nullable(),
18
- metadata: column("metadata", "json"),
19
- }),
20
- },
21
- relations: {},
50
+ settingsTable: HOT_UPDATER_SETTINGS_TABLE,
51
+ tables: [bundlesV021, createSettingsTable("0.21.0")],
22
52
  });
@@ -1,26 +1,62 @@
1
- import { column, idColumn, schema, table } from "fumadb/schema";
1
+ import {
2
+ bool,
3
+ check,
4
+ idColumn,
5
+ index,
6
+ integer,
7
+ json,
8
+ schema,
9
+ stringColumn,
10
+ table,
11
+ } from "./dsl";
12
+ import { createSettingsTable } from "./settings";
13
+ import { HOT_UPDATER_SETTINGS_TABLE } from "./types";
14
+
15
+ export const bundlesV029 = table(
16
+ "bundles",
17
+ {
18
+ id: idColumn("id", "uuid"),
19
+ platform: stringColumn("platform"),
20
+ should_force_update: bool("should_force_update"),
21
+ enabled: bool("enabled"),
22
+ file_hash: stringColumn("file_hash"),
23
+ git_commit_hash: stringColumn("git_commit_hash").nullable(),
24
+ message: stringColumn("message").nullable(),
25
+ channel: stringColumn("channel").defaultTo("production"),
26
+ storage_uri: stringColumn("storage_uri"),
27
+ target_app_version: stringColumn("target_app_version").nullable(),
28
+ fingerprint_hash: stringColumn("fingerprint_hash").nullable(),
29
+ metadata: json("metadata").defaultTo({}),
30
+ rollout_cohort_count: integer("rollout_cohort_count").defaultTo(1000),
31
+ target_cohorts: json("target_cohorts").nullable(),
32
+ },
33
+ {
34
+ indexes: [
35
+ index("bundles_target_app_version_idx", ["target_app_version"]),
36
+ index("bundles_fingerprint_hash_idx", ["fingerprint_hash"]),
37
+ index("bundles_channel_idx", ["channel"]),
38
+ index("bundles_platform_idx", ["platform"], ["mongodb"]),
39
+ index("bundles_rollout_idx", ["rollout_cohort_count"]),
40
+ ],
41
+ checks: [
42
+ check({
43
+ name: "check_version_or_fingerprint",
44
+ expression:
45
+ "(target_app_version is not null) or (fingerprint_hash is not null)",
46
+ sqliteInline: true,
47
+ }),
48
+ check({
49
+ name: "bundles_rollout_cohort_count_check",
50
+ expression:
51
+ "rollout_cohort_count >= 0 and rollout_cohort_count <= 1000",
52
+ sqliteInline: true,
53
+ }),
54
+ ],
55
+ },
56
+ );
2
57
 
3
58
  export const v0_29_0 = schema({
4
59
  version: "0.29.0",
5
- tables: {
6
- bundles: table("bundles", {
7
- id: idColumn("id", "uuid"),
8
- platform: column("platform", "string"),
9
- should_force_update: column("should_force_update", "bool"),
10
- enabled: column("enabled", "bool"),
11
- file_hash: column("file_hash", "string"),
12
- git_commit_hash: column("git_commit_hash", "string").nullable(),
13
- message: column("message", "string").nullable(),
14
- channel: column("channel", "string").defaultTo("production"),
15
- storage_uri: column("storage_uri", "string"),
16
- target_app_version: column("target_app_version", "string").nullable(),
17
- fingerprint_hash: column("fingerprint_hash", "string").nullable(),
18
- metadata: column("metadata", "json"),
19
- rollout_cohort_count: column("rollout_cohort_count", "integer").defaultTo(
20
- 1000,
21
- ),
22
- target_cohorts: column("target_cohorts", "json").nullable(),
23
- }),
24
- },
25
- relations: {},
60
+ settingsTable: HOT_UPDATER_SETTINGS_TABLE,
61
+ tables: [bundlesV029, createSettingsTable("0.29.0")],
26
62
  });
@@ -0,0 +1,73 @@
1
+ import { describe, expect, it } from "vitest";
2
+
3
+ import { createTableStatement } from "../db/schema/sql";
4
+ import { bundlePatchesV031, v0_31_0 } from "./v0_31_0";
5
+
6
+ describe("bundlePatchesV031", () => {
7
+ it("uses the functional schema DSL for the v0.31.0 bundle patches table", () => {
8
+ expect(v0_31_0.dsl).toBe("schema");
9
+ expect(bundlePatchesV031.dsl).toBe("table");
10
+ expect(bundlePatchesV031.columns).toEqual([
11
+ { ormName: "id", type: "varchar(255)", primaryKey: true },
12
+ { ormName: "bundle_id", type: "uuid" },
13
+ { ormName: "base_bundle_id", type: "uuid" },
14
+ { ormName: "base_file_hash", type: "string" },
15
+ { ormName: "patch_file_hash", type: "string" },
16
+ { ormName: "patch_storage_uri", type: "string" },
17
+ {
18
+ ormName: "order_index",
19
+ type: "integer",
20
+ default: { type: "literal", value: 0 },
21
+ },
22
+ ]);
23
+ expect(bundlePatchesV031.indexes).toEqual([
24
+ { name: "bundle_patches_bundle_id_idx", columns: ["bundle_id"] },
25
+ {
26
+ name: "bundle_patches_base_bundle_id_idx",
27
+ columns: ["base_bundle_id"],
28
+ },
29
+ ]);
30
+ expect(bundlePatchesV031.foreignKeys).toEqual([
31
+ {
32
+ name: "bundle_patches_bundle_id_fk",
33
+ columns: ["bundle_id"],
34
+ referencedTable: "bundles",
35
+ referencedColumns: ["id"],
36
+ onUpdate: "restrict",
37
+ onDelete: "cascade",
38
+ },
39
+ {
40
+ name: "bundle_patches_base_bundle_id_fk",
41
+ columns: ["base_bundle_id"],
42
+ referencedTable: "bundles",
43
+ referencedColumns: ["id"],
44
+ onUpdate: "restrict",
45
+ onDelete: "cascade",
46
+ },
47
+ ]);
48
+ expect(bundlePatchesV031.relations).toEqual([
49
+ {
50
+ name: "bundle",
51
+ fieldName: "patches",
52
+ targetFieldName: "bundle",
53
+ relationName: "bundle_patches_bundles_patches",
54
+ columns: ["bundle_id"],
55
+ referencedTable: "bundles",
56
+ referencedColumns: ["id"],
57
+ },
58
+ {
59
+ name: "baseBundle",
60
+ fieldName: "baseForPatches",
61
+ targetFieldName: "baseBundle",
62
+ relationName: "bundle_patches_bundles_baseForPatches",
63
+ columns: ["base_bundle_id"],
64
+ referencedTable: "bundles",
65
+ referencedColumns: ["id"],
66
+ },
67
+ ]);
68
+ expect(Object.keys(bundlePatchesV031)).not.toContain("dsl");
69
+ expect(createTableStatement(bundlePatchesV031, "postgresql")).toContain(
70
+ "id varchar(255) primary key not null",
71
+ );
72
+ });
73
+ });
@@ -1,58 +1,120 @@
1
- import { column, idColumn, schema, table } from "fumadb/schema";
1
+ import {
2
+ bool,
3
+ check,
4
+ column,
5
+ foreignKey,
6
+ idColumn,
7
+ index,
8
+ integer,
9
+ json,
10
+ relation,
11
+ schema,
12
+ stringColumn,
13
+ table,
14
+ uuid,
15
+ varchar,
16
+ } from "./dsl";
17
+ import { createSettingsTable } from "./settings";
18
+ import { HOT_UPDATER_SETTINGS_TABLE } from "./types";
2
19
 
3
- export const v0_31_0 = schema({
4
- version: "0.31.0",
5
- tables: {
6
- bundles: table("bundles", {
7
- id: idColumn("id", "uuid"),
8
- platform: column("platform", "string"),
9
- should_force_update: column("should_force_update", "bool"),
10
- enabled: column("enabled", "bool"),
11
- file_hash: column("file_hash", "string"),
12
- git_commit_hash: column("git_commit_hash", "string").nullable(),
13
- message: column("message", "string").nullable(),
14
- channel: column("channel", "string").defaultTo("production"),
15
- storage_uri: column("storage_uri", "string"),
16
- target_app_version: column("target_app_version", "string").nullable(),
17
- fingerprint_hash: column("fingerprint_hash", "string").nullable(),
18
- metadata: column("metadata", "json"),
19
- manifest_storage_uri: column("manifest_storage_uri", "string").nullable(),
20
- manifest_file_hash: column("manifest_file_hash", "string").nullable(),
21
- asset_base_storage_uri: column(
22
- "asset_base_storage_uri",
23
- "string",
24
- ).nullable(),
25
- rollout_cohort_count: column("rollout_cohort_count", "integer").defaultTo(
26
- 1000,
27
- ),
28
- target_cohorts: column("target_cohorts", "json").nullable(),
29
- }),
30
- bundle_patches: table("bundle_patches", {
31
- id: idColumn("id", "varchar(255)"),
32
- bundle_id: column("bundle_id", "uuid"),
33
- base_bundle_id: column("base_bundle_id", "uuid"),
34
- base_file_hash: column("base_file_hash", "string"),
35
- patch_file_hash: column("patch_file_hash", "string"),
36
- patch_storage_uri: column("patch_storage_uri", "string"),
37
- order_index: column("order_index", "integer").defaultTo(0),
38
- }),
20
+ export const bundlesV031 = table(
21
+ "bundles",
22
+ {
23
+ id: idColumn("id", "uuid"),
24
+ platform: stringColumn("platform"),
25
+ should_force_update: bool("should_force_update"),
26
+ enabled: bool("enabled"),
27
+ file_hash: stringColumn("file_hash"),
28
+ git_commit_hash: stringColumn("git_commit_hash").nullable(),
29
+ message: stringColumn("message").nullable(),
30
+ channel: stringColumn("channel").defaultTo("production"),
31
+ storage_uri: stringColumn("storage_uri"),
32
+ target_app_version: stringColumn("target_app_version").nullable(),
33
+ fingerprint_hash: stringColumn("fingerprint_hash").nullable(),
34
+ metadata: json("metadata").defaultTo({}),
35
+ rollout_cohort_count: integer("rollout_cohort_count").defaultTo(1000),
36
+ target_cohorts: json("target_cohorts").nullable(),
37
+ manifest_storage_uri: stringColumn("manifest_storage_uri").nullable(),
38
+ manifest_file_hash: stringColumn("manifest_file_hash").nullable(),
39
+ asset_base_storage_uri: stringColumn("asset_base_storage_uri").nullable(),
40
+ },
41
+ {
42
+ indexes: [
43
+ index("bundles_target_app_version_idx", ["target_app_version"]),
44
+ index("bundles_fingerprint_hash_idx", ["fingerprint_hash"]),
45
+ index("bundles_channel_idx", ["channel"]),
46
+ index("bundles_platform_idx", ["platform"], ["mongodb"]),
47
+ index("bundles_rollout_idx", ["rollout_cohort_count"]),
48
+ ],
49
+ checks: [
50
+ check({
51
+ name: "check_version_or_fingerprint",
52
+ expression:
53
+ "(target_app_version is not null) or (fingerprint_hash is not null)",
54
+ sqliteInline: true,
55
+ }),
56
+ check({
57
+ name: "bundles_rollout_cohort_count_check",
58
+ expression:
59
+ "rollout_cohort_count >= 0 and rollout_cohort_count <= 1000",
60
+ sqliteInline: true,
61
+ }),
62
+ ],
63
+ },
64
+ );
65
+
66
+ export const bundlePatchesV031 = table(
67
+ "bundle_patches",
68
+ {
69
+ id: idColumn("id", varchar(255)),
70
+ bundle_id: uuid("bundle_id"),
71
+ base_bundle_id: uuid("base_bundle_id"),
72
+ base_file_hash: column("base_file_hash", "string"),
73
+ patch_file_hash: column("patch_file_hash", "string"),
74
+ patch_storage_uri: column("patch_storage_uri", "string"),
75
+ order_index: integer("order_index").defaultTo(0),
39
76
  },
40
- relations: {
41
- bundle_patches: (builder) => ({
42
- bundle: builder
43
- .one("bundles", ["bundle_id", "id"])
44
- .imply("patches")
45
- .foreignKey({
46
- name: "bundle_patches_bundle_id_fk",
47
- onDelete: "CASCADE",
48
- }),
49
- baseBundle: builder
50
- .one("bundles", ["base_bundle_id", "id"])
51
- .imply("baseForPatches")
52
- .foreignKey({
53
- name: "bundle_patches_base_bundle_id_fk",
54
- onDelete: "CASCADE",
55
- }),
56
- }),
77
+ {
78
+ indexes: [
79
+ index("bundle_patches_bundle_id_idx", ["bundle_id"]),
80
+ index("bundle_patches_base_bundle_id_idx", ["base_bundle_id"]),
81
+ ],
82
+ foreignKeys: [
83
+ foreignKey("bundle_patches_bundle_id_fk", ["bundle_id"], "bundles", [
84
+ "id",
85
+ ]),
86
+ foreignKey(
87
+ "bundle_patches_base_bundle_id_fk",
88
+ ["base_bundle_id"],
89
+ "bundles",
90
+ ["id"],
91
+ ),
92
+ ],
93
+ relations: [
94
+ relation({
95
+ name: "bundle",
96
+ fieldName: "patches",
97
+ targetFieldName: "bundle",
98
+ relationName: "bundle_patches_bundles_patches",
99
+ columns: ["bundle_id"],
100
+ referencedTable: "bundles",
101
+ referencedColumns: ["id"],
102
+ }),
103
+ relation({
104
+ name: "baseBundle",
105
+ fieldName: "baseForPatches",
106
+ targetFieldName: "baseBundle",
107
+ relationName: "bundle_patches_bundles_baseForPatches",
108
+ columns: ["base_bundle_id"],
109
+ referencedTable: "bundles",
110
+ referencedColumns: ["id"],
111
+ }),
112
+ ],
57
113
  },
114
+ );
115
+
116
+ export const v0_31_0 = schema({
117
+ version: "0.31.0",
118
+ settingsTable: HOT_UPDATER_SETTINGS_TABLE,
119
+ tables: [bundlesV031, bundlePatchesV031, createSettingsTable("0.31.0")],
58
120
  });
@@ -1,6 +0,0 @@
1
- import { createRequire } from "node:module";
2
- //#region \0rolldown/runtime.js
3
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
4
- var __require = /* @__PURE__ */ createRequire(import.meta.url);
5
- //#endregion
6
- export { __commonJSMin, __require };