@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.
- package/dist/_virtual/_rolldown/runtime.cjs +0 -2
- package/dist/adapters/drizzle.cjs +195 -2
- package/dist/adapters/drizzle.d.cts +7 -4
- package/dist/adapters/drizzle.d.mts +7 -4
- package/dist/adapters/drizzle.mjs +194 -2
- package/dist/adapters/drizzleLazyDB.cjs +53 -0
- package/dist/adapters/drizzleLazyDB.mjs +53 -0
- package/dist/adapters/kysely.cjs +154 -3
- package/dist/adapters/kysely.d.cts +18 -10
- package/dist/adapters/kysely.d.mts +18 -10
- package/dist/adapters/kysely.mjs +153 -3
- package/dist/adapters/mongodb.cjs +183 -2
- package/dist/adapters/mongodb.d.cts +5 -4
- package/dist/adapters/mongodb.d.mts +5 -4
- package/dist/adapters/mongodb.mjs +183 -2
- package/dist/adapters/prisma.cjs +200 -2
- package/dist/adapters/prisma.d.cts +9 -4
- package/dist/adapters/prisma.d.mts +9 -4
- package/dist/adapters/prisma.mjs +199 -2
- package/dist/db/bundleRows.cjs +82 -0
- package/dist/db/bundleRows.d.cts +33 -0
- package/dist/db/bundleRows.d.mts +33 -0
- package/dist/db/bundleRows.mjs +79 -0
- package/dist/db/fixedMigrator.cjs +136 -0
- package/dist/db/fixedMigrator.mjs +135 -0
- package/dist/db/index.cjs +17 -15
- package/dist/db/index.d.cts +3 -3
- package/dist/db/index.d.mts +3 -3
- package/dist/db/index.mjs +17 -15
- package/dist/db/pluginCore.cjs +13 -5
- package/dist/db/pluginCore.mjs +13 -5
- package/dist/db/schema/mongodb.cjs +17 -0
- package/dist/db/schema/mongodb.mjs +17 -0
- package/dist/db/schema/registry.cjs +23 -0
- package/dist/db/schema/registry.mjs +18 -0
- package/dist/db/schema/sql.cjs +84 -0
- package/dist/db/schema/sql.mjs +78 -0
- package/dist/db/schema/sqlMigrations.cjs +74 -0
- package/dist/db/schema/sqlMigrations.mjs +73 -0
- package/dist/db/schema/sqlOperations.cjs +27 -0
- package/dist/db/schema/sqlOperations.mjs +26 -0
- package/dist/db/schemaEnhancements.cjs +1 -152
- package/dist/db/schemaEnhancements.mjs +1 -149
- package/dist/db/schemaGenerators.cjs +222 -0
- package/dist/db/schemaGenerators.mjs +220 -0
- package/dist/db/schemaReadiness.cjs +23 -0
- package/dist/db/schemaReadiness.d.cts +8 -0
- package/dist/db/schemaReadiness.d.mts +8 -0
- package/dist/db/schemaReadiness.mjs +22 -0
- package/dist/db/types.cjs +10 -2
- package/dist/db/types.d.cts +58 -14
- package/dist/db/types.d.mts +58 -14
- package/dist/db/types.mjs +9 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +3 -2
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +2 -2
- package/dist/{packages/server/package.cjs → package.cjs} +1 -1
- package/dist/{packages/server/package.mjs → package.mjs} +1 -1
- package/dist/runtime.cjs +9 -2
- package/dist/runtime.mjs +9 -2
- package/dist/schema/dsl.cjs +86 -0
- package/dist/schema/dsl.mjs +73 -0
- package/dist/schema/index.cjs +13 -0
- package/dist/schema/index.mjs +13 -0
- package/dist/schema/settings.cjs +9 -0
- package/dist/schema/settings.mjs +9 -0
- package/dist/schema/types.cjs +6 -0
- package/dist/schema/types.mjs +5 -0
- package/dist/schema/v0_21_0.cjs +33 -18
- package/dist/schema/v0_21_0.mjs +32 -18
- package/dist/schema/v0_29_0.cjs +40 -20
- package/dist/schema/v0_29_0.mjs +39 -20
- package/dist/schema/v0_31_0.cjs +77 -43
- package/dist/schema/v0_31_0.mjs +75 -43
- package/dist/version.cjs +1 -1
- package/dist/version.mjs +1 -1
- package/package.json +30 -16
- package/src/adapters/drizzle.spec.ts +75 -0
- package/src/adapters/drizzle.ts +328 -12
- package/src/adapters/drizzleLazyDB.ts +151 -0
- package/src/adapters/kysely.spec.ts +107 -0
- package/src/adapters/kysely.ts +349 -14
- package/src/adapters/mongodb.ts +298 -15
- package/src/adapters/prisma.ts +337 -12
- package/src/db/bundleRows.ts +140 -0
- package/src/db/fixedMigrator.spec.ts +89 -0
- package/src/db/fixedMigrator.ts +288 -0
- package/src/db/hotUpdaterSchema.ts +6 -0
- package/src/db/index.spec.ts +976 -13
- package/src/db/index.ts +37 -36
- package/src/db/pluginCore.spec.ts +17 -11
- package/src/db/pluginCore.ts +15 -6
- package/src/db/schema/definitions.ts +1 -0
- package/src/db/schema/mongodb.ts +26 -0
- package/src/db/schema/registry.ts +55 -0
- package/src/db/schema/sql.ts +200 -0
- package/src/db/schema/sqlMigrations.ts +219 -0
- package/src/db/schema/sqlOperations.ts +62 -0
- package/src/db/schema/types.ts +1 -0
- package/src/db/schemaEnhancements.ts +0 -405
- package/src/db/schemaGenerators.ts +382 -0
- package/src/db/schemaReadiness.ts +33 -0
- package/src/db/types.ts +69 -25
- package/src/runtime.spec.ts +70 -0
- package/src/runtime.ts +14 -2
- package/src/schema/dsl-all-versions.spec.ts +26 -0
- package/src/schema/dsl.ts +148 -0
- package/src/schema/index.ts +16 -0
- package/src/schema/settings.ts +15 -0
- package/src/schema/types.ts +73 -0
- package/src/schema/v0_21_0.ts +48 -18
- package/src/schema/v0_29_0.ts +58 -22
- package/src/schema/v0_31_0.spec.ts +73 -0
- package/src/schema/v0_31_0.ts +116 -54
- package/dist/_virtual/_rolldown/runtime.mjs +0 -6
- package/dist/calculatePagination.cjs +0 -25
- package/dist/calculatePagination.mjs +0 -25
- package/dist/db/ormCore.cjs +0 -577
- package/dist/db/ormCore.d.cts +0 -110
- package/dist/db/ormCore.d.mts +0 -110
- package/dist/db/ormCore.mjs +0 -575
- package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/_u64.cjs +0 -112
- package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/_u64.mjs +0 -108
- package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/cryptoNode.cjs +0 -22
- package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/cryptoNode.mjs +0 -18
- package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/sha3.cjs +0 -219
- package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/sha3.mjs +0 -214
- package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/utils.cjs +0 -275
- package/dist/node_modules/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/utils.mjs +0 -270
- package/dist/node_modules/.pnpm/@paralleldrive_cuid2@2.3.1/node_modules/@paralleldrive/cuid2/index.cjs +0 -17
- package/dist/node_modules/.pnpm/@paralleldrive_cuid2@2.3.1/node_modules/@paralleldrive/cuid2/index.mjs +0 -13
- package/dist/node_modules/.pnpm/@paralleldrive_cuid2@2.3.1/node_modules/@paralleldrive/cuid2/src/index.cjs +0 -69
- package/dist/node_modules/.pnpm/@paralleldrive_cuid2@2.3.1/node_modules/@paralleldrive/cuid2/src/index.mjs +0 -65
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- package/src/db/ormCore.ts +0 -1059
- package/src/db/ormUpdateCheck.bench.ts +0 -262
package/dist/db/ormCore.mjs
DELETED
|
@@ -1,575 +0,0 @@
|
|
|
1
|
-
import { fumadb } from "../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";
|
|
2
|
-
import { calculatePagination } from "../calculatePagination.mjs";
|
|
3
|
-
import { v0_21_0 } from "../schema/v0_21_0.mjs";
|
|
4
|
-
import { v0_29_0 } from "../schema/v0_29_0.mjs";
|
|
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";
|
|
9
|
-
import { semverSatisfies } from "@hot-updater/plugin-core";
|
|
10
|
-
import { DEFAULT_ROLLOUT_COHORT_COUNT, NIL_UUID, getAssetBaseStorageUri, getBundlePatches, getManifestFileHash, getManifestStorageUri, isCohortEligibleForUpdate, stripBundleArtifactMetadata } from "@hot-updater/core";
|
|
11
|
-
//#region src/db/ormCore.ts
|
|
12
|
-
const parseTargetCohorts = (value) => {
|
|
13
|
-
if (!value) return null;
|
|
14
|
-
if (Array.isArray(value)) return value.filter((v) => typeof v === "string");
|
|
15
|
-
if (typeof value === "string") try {
|
|
16
|
-
const parsed = JSON.parse(value);
|
|
17
|
-
if (Array.isArray(parsed)) return parsed.filter((v) => typeof v === "string");
|
|
18
|
-
} catch {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
return null;
|
|
22
|
-
};
|
|
23
|
-
const schemas = [
|
|
24
|
-
v0_21_0,
|
|
25
|
-
v0_29_0,
|
|
26
|
-
v0_31_0
|
|
27
|
-
];
|
|
28
|
-
const getLastItem = (items) => items.at(-1);
|
|
29
|
-
const DEFAULT_BUNDLE_ORDER = {
|
|
30
|
-
field: "id",
|
|
31
|
-
direction: "desc"
|
|
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
|
-
});
|
|
49
|
-
const mergeIdFilter = (base, patch) => ({
|
|
50
|
-
...base,
|
|
51
|
-
...patch
|
|
52
|
-
});
|
|
53
|
-
const mergeWhereWithIdFilter = (where, idFilter) => ({
|
|
54
|
-
...where,
|
|
55
|
-
id: mergeIdFilter(where?.id, idFilter)
|
|
56
|
-
});
|
|
57
|
-
const buildCursorPageWhere = (where, cursor, orderBy) => {
|
|
58
|
-
const direction = orderBy.direction;
|
|
59
|
-
if (cursor.after) return {
|
|
60
|
-
reverseData: false,
|
|
61
|
-
where: mergeWhereWithIdFilter(where, { [direction === "desc" ? "lt" : "gt"]: cursor.after }),
|
|
62
|
-
orderBy
|
|
63
|
-
};
|
|
64
|
-
if (cursor.before) return {
|
|
65
|
-
reverseData: true,
|
|
66
|
-
where: mergeWhereWithIdFilter(where, { [direction === "desc" ? "gt" : "lt"]: cursor.before }),
|
|
67
|
-
orderBy: {
|
|
68
|
-
field: orderBy.field,
|
|
69
|
-
direction: direction === "desc" ? "asc" : "desc"
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
return {
|
|
73
|
-
reverseData: false,
|
|
74
|
-
where: where ?? {},
|
|
75
|
-
orderBy
|
|
76
|
-
};
|
|
77
|
-
};
|
|
78
|
-
const buildCountBeforeWhere = (where, firstBundleId, orderBy) => mergeWhereWithIdFilter(where, { [orderBy.direction === "desc" ? "gt" : "lt"]: firstBundleId });
|
|
79
|
-
const HotUpdaterDB = fumadb({
|
|
80
|
-
namespace: "hot_updater",
|
|
81
|
-
schemas
|
|
82
|
-
});
|
|
83
|
-
function createOrmDatabaseCore({ database, resolveFileUrl, readStorageText }) {
|
|
84
|
-
const client = HotUpdaterDB.client(database);
|
|
85
|
-
const UPDATE_CHECK_PAGE_SIZE = 100;
|
|
86
|
-
const isMongoAdapter = client.adapter.name.toLowerCase().includes("mongodb");
|
|
87
|
-
const lastSchemaVersion = getLastItem(schemas).version;
|
|
88
|
-
const ensureORM = async () => {
|
|
89
|
-
try {
|
|
90
|
-
const currentVersion = await client.createMigrator().getVersion();
|
|
91
|
-
if (currentVersion === void 0) throw new Error("Database is not initialized. Please run 'npx hot-updater migrate' to set up the database schema.");
|
|
92
|
-
if (currentVersion !== lastSchemaVersion) throw new Error(`Database schema version mismatch. Expected version ${lastSchemaVersion}, but database is on version ${currentVersion}. Please run 'npx hot-updater migrate' to update your database schema.`);
|
|
93
|
-
return client.orm(lastSchemaVersion);
|
|
94
|
-
} catch (error) {
|
|
95
|
-
if (error instanceof Error && error.message.includes("doesn't support migration")) return client.orm(lastSchemaVersion);
|
|
96
|
-
throw error;
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
const buildBundleWhere = (where) => (b) => {
|
|
100
|
-
if (where?.id?.in && where.id.in.length === 0) return false;
|
|
101
|
-
if (where?.targetAppVersionIn && where.targetAppVersionIn.length === 0) return false;
|
|
102
|
-
const conditions = [];
|
|
103
|
-
if (where?.channel !== void 0) conditions.push(b("channel", "=", where.channel));
|
|
104
|
-
if (where?.platform !== void 0) conditions.push(b("platform", "=", where.platform));
|
|
105
|
-
if (where?.enabled !== void 0) conditions.push(b("enabled", "=", where.enabled));
|
|
106
|
-
if (where?.id?.eq !== void 0) conditions.push(b("id", "=", where.id.eq));
|
|
107
|
-
if (where?.id?.gt !== void 0) conditions.push(b("id", ">", where.id.gt));
|
|
108
|
-
if (where?.id?.gte !== void 0) conditions.push(b("id", ">=", where.id.gte));
|
|
109
|
-
if (where?.id?.lt !== void 0) conditions.push(b("id", "<", where.id.lt));
|
|
110
|
-
if (where?.id?.lte !== void 0) conditions.push(b("id", "<=", where.id.lte));
|
|
111
|
-
if (where?.id?.in) conditions.push(b("id", "in", where.id.in));
|
|
112
|
-
if (where?.targetAppVersionNotNull) conditions.push(b.isNotNull("target_app_version"));
|
|
113
|
-
if (where?.targetAppVersion !== void 0) conditions.push(where.targetAppVersion === null ? b.isNull("target_app_version") : b("target_app_version", "=", where.targetAppVersion));
|
|
114
|
-
if (where?.targetAppVersionIn) conditions.push(b("target_app_version", "in", where.targetAppVersionIn));
|
|
115
|
-
if (where?.fingerprintHash !== void 0) conditions.push(where.fingerprintHash === null ? b.isNull("fingerprint_hash") : b("fingerprint_hash", "=", where.fingerprintHash));
|
|
116
|
-
return conditions.length > 0 ? b.and(...conditions) : true;
|
|
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
|
-
};
|
|
195
|
-
return {
|
|
196
|
-
api: {
|
|
197
|
-
async getBundleById(id) {
|
|
198
|
-
return fetchBundleById(id);
|
|
199
|
-
},
|
|
200
|
-
async getUpdateInfo(args) {
|
|
201
|
-
const orm = await ensureORM();
|
|
202
|
-
const toUpdateInfo = (row, status) => ({
|
|
203
|
-
id: row.id,
|
|
204
|
-
shouldForceUpdate: status === "ROLLBACK" ? true : Boolean(row.should_force_update),
|
|
205
|
-
message: row.message ?? null,
|
|
206
|
-
status,
|
|
207
|
-
storageUri: row.storage_uri ?? null,
|
|
208
|
-
fileHash: row.file_hash ?? null
|
|
209
|
-
});
|
|
210
|
-
const INIT_BUNDLE_ROLLBACK_UPDATE_INFO = {
|
|
211
|
-
id: NIL_UUID,
|
|
212
|
-
message: null,
|
|
213
|
-
shouldForceUpdate: true,
|
|
214
|
-
status: "ROLLBACK",
|
|
215
|
-
storageUri: null,
|
|
216
|
-
fileHash: null
|
|
217
|
-
};
|
|
218
|
-
const isEligibleForUpdate = (row, cohort) => {
|
|
219
|
-
return isCohortEligibleForUpdate(row.id, cohort, row.rollout_cohort_count ?? null, parseTargetCohorts(row.target_cohorts));
|
|
220
|
-
};
|
|
221
|
-
const findUpdateInfoByScanning = async ({ args, where, isCandidate }) => {
|
|
222
|
-
if (isMongoAdapter) {
|
|
223
|
-
const rows = await orm.findMany("bundles", {
|
|
224
|
-
select: [
|
|
225
|
-
"id",
|
|
226
|
-
"should_force_update",
|
|
227
|
-
"message",
|
|
228
|
-
"storage_uri",
|
|
229
|
-
"file_hash",
|
|
230
|
-
"rollout_cohort_count",
|
|
231
|
-
"target_cohorts",
|
|
232
|
-
"target_app_version",
|
|
233
|
-
"fingerprint_hash"
|
|
234
|
-
],
|
|
235
|
-
where: buildBundleWhere(where)
|
|
236
|
-
});
|
|
237
|
-
rows.sort((a, b) => b.id.localeCompare(a.id));
|
|
238
|
-
for (const row of rows) {
|
|
239
|
-
if (!isCandidate(row)) continue;
|
|
240
|
-
if (args.bundleId === NIL_UUID) {
|
|
241
|
-
if (isEligibleForUpdate(row, args.cohort)) return toUpdateInfo(row, "UPDATE");
|
|
242
|
-
continue;
|
|
243
|
-
}
|
|
244
|
-
const compareResult = row.id.localeCompare(args.bundleId);
|
|
245
|
-
if (compareResult > 0) {
|
|
246
|
-
if (isEligibleForUpdate(row, args.cohort)) return toUpdateInfo(row, "UPDATE");
|
|
247
|
-
continue;
|
|
248
|
-
}
|
|
249
|
-
if (compareResult === 0) {
|
|
250
|
-
if (isEligibleForUpdate(row, args.cohort)) return null;
|
|
251
|
-
continue;
|
|
252
|
-
}
|
|
253
|
-
return toUpdateInfo(row, "ROLLBACK");
|
|
254
|
-
}
|
|
255
|
-
if (args.bundleId === NIL_UUID) return null;
|
|
256
|
-
if (args.minBundleId && args.bundleId.localeCompare(args.minBundleId) <= 0) return null;
|
|
257
|
-
return INIT_BUNDLE_ROLLBACK_UPDATE_INFO;
|
|
258
|
-
}
|
|
259
|
-
let offset = 0;
|
|
260
|
-
while (true) {
|
|
261
|
-
const rows = await orm.findMany("bundles", {
|
|
262
|
-
select: [
|
|
263
|
-
"id",
|
|
264
|
-
"should_force_update",
|
|
265
|
-
"message",
|
|
266
|
-
"storage_uri",
|
|
267
|
-
"file_hash",
|
|
268
|
-
"rollout_cohort_count",
|
|
269
|
-
"target_cohorts",
|
|
270
|
-
"target_app_version",
|
|
271
|
-
"fingerprint_hash"
|
|
272
|
-
],
|
|
273
|
-
where: buildBundleWhere(where),
|
|
274
|
-
orderBy: [["id", "desc"]],
|
|
275
|
-
limit: UPDATE_CHECK_PAGE_SIZE,
|
|
276
|
-
offset
|
|
277
|
-
});
|
|
278
|
-
for (const row of rows) {
|
|
279
|
-
if (!isCandidate(row)) continue;
|
|
280
|
-
if (args.bundleId === NIL_UUID) {
|
|
281
|
-
if (isEligibleForUpdate(row, args.cohort)) return toUpdateInfo(row, "UPDATE");
|
|
282
|
-
continue;
|
|
283
|
-
}
|
|
284
|
-
const compareResult = row.id.localeCompare(args.bundleId);
|
|
285
|
-
if (compareResult > 0) {
|
|
286
|
-
if (isEligibleForUpdate(row, args.cohort)) return toUpdateInfo(row, "UPDATE");
|
|
287
|
-
continue;
|
|
288
|
-
}
|
|
289
|
-
if (compareResult === 0) {
|
|
290
|
-
if (isEligibleForUpdate(row, args.cohort)) return null;
|
|
291
|
-
continue;
|
|
292
|
-
}
|
|
293
|
-
return toUpdateInfo(row, "ROLLBACK");
|
|
294
|
-
}
|
|
295
|
-
if (rows.length < UPDATE_CHECK_PAGE_SIZE) break;
|
|
296
|
-
offset += UPDATE_CHECK_PAGE_SIZE;
|
|
297
|
-
}
|
|
298
|
-
if (args.bundleId === NIL_UUID) return null;
|
|
299
|
-
if (args.minBundleId && args.bundleId.localeCompare(args.minBundleId) <= 0) return null;
|
|
300
|
-
return INIT_BUNDLE_ROLLBACK_UPDATE_INFO;
|
|
301
|
-
};
|
|
302
|
-
const appVersionStrategy = async ({ platform, appVersion, bundleId, minBundleId = NIL_UUID, channel = "production", cohort }) => {
|
|
303
|
-
return findUpdateInfoByScanning({
|
|
304
|
-
args: {
|
|
305
|
-
_updateStrategy: "appVersion",
|
|
306
|
-
platform,
|
|
307
|
-
appVersion,
|
|
308
|
-
bundleId,
|
|
309
|
-
minBundleId,
|
|
310
|
-
channel,
|
|
311
|
-
cohort
|
|
312
|
-
},
|
|
313
|
-
where: {
|
|
314
|
-
enabled: true,
|
|
315
|
-
platform,
|
|
316
|
-
channel,
|
|
317
|
-
id: { gte: minBundleId },
|
|
318
|
-
targetAppVersionNotNull: true
|
|
319
|
-
},
|
|
320
|
-
isCandidate: (row) => !!row.target_app_version && semverSatisfies(row.target_app_version, appVersion)
|
|
321
|
-
});
|
|
322
|
-
};
|
|
323
|
-
const fingerprintStrategy = async ({ platform, fingerprintHash, bundleId, minBundleId = NIL_UUID, channel = "production", cohort }) => {
|
|
324
|
-
return findUpdateInfoByScanning({
|
|
325
|
-
args: {
|
|
326
|
-
_updateStrategy: "fingerprint",
|
|
327
|
-
platform,
|
|
328
|
-
fingerprintHash,
|
|
329
|
-
bundleId,
|
|
330
|
-
minBundleId,
|
|
331
|
-
channel,
|
|
332
|
-
cohort
|
|
333
|
-
},
|
|
334
|
-
where: {
|
|
335
|
-
enabled: true,
|
|
336
|
-
platform,
|
|
337
|
-
channel,
|
|
338
|
-
id: { gte: minBundleId },
|
|
339
|
-
fingerprintHash
|
|
340
|
-
},
|
|
341
|
-
isCandidate: (row) => row.fingerprint_hash === fingerprintHash
|
|
342
|
-
});
|
|
343
|
-
};
|
|
344
|
-
if (args._updateStrategy === "appVersion") return appVersionStrategy(args);
|
|
345
|
-
if (args._updateStrategy === "fingerprint") return fingerprintStrategy(args);
|
|
346
|
-
return null;
|
|
347
|
-
},
|
|
348
|
-
async getAppUpdateInfo(args, context) {
|
|
349
|
-
const info = await this.getUpdateInfo(args);
|
|
350
|
-
if (!info) return null;
|
|
351
|
-
const { storageUri, ...rest } = info;
|
|
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 = {
|
|
365
|
-
...rest,
|
|
366
|
-
fileUrl
|
|
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
|
-
};
|
|
380
|
-
},
|
|
381
|
-
async getChannels() {
|
|
382
|
-
const rows = await (await ensureORM()).findMany("bundles", {
|
|
383
|
-
select: ["channel"],
|
|
384
|
-
orderBy: [["channel", "asc"]]
|
|
385
|
-
});
|
|
386
|
-
const set = new Set(rows?.map((r) => r.channel) ?? []);
|
|
387
|
-
return Array.from(set);
|
|
388
|
-
},
|
|
389
|
-
async getBundles(options) {
|
|
390
|
-
const orm = await ensureORM();
|
|
391
|
-
const { where, limit } = options;
|
|
392
|
-
const orderBy = options.orderBy ?? DEFAULT_BUNDLE_ORDER;
|
|
393
|
-
const offset = ("offset" in options ? options.offset : void 0) ?? 0;
|
|
394
|
-
const total = await orm.count("bundles", { where: buildBundleWhere(where) });
|
|
395
|
-
const selectedColumns = [
|
|
396
|
-
"id",
|
|
397
|
-
"platform",
|
|
398
|
-
"should_force_update",
|
|
399
|
-
"enabled",
|
|
400
|
-
"file_hash",
|
|
401
|
-
"git_commit_hash",
|
|
402
|
-
"message",
|
|
403
|
-
"channel",
|
|
404
|
-
"storage_uri",
|
|
405
|
-
"target_app_version",
|
|
406
|
-
"fingerprint_hash",
|
|
407
|
-
"metadata",
|
|
408
|
-
"manifest_storage_uri",
|
|
409
|
-
"manifest_file_hash",
|
|
410
|
-
"asset_base_storage_uri",
|
|
411
|
-
"rollout_cohort_count",
|
|
412
|
-
"target_cohorts"
|
|
413
|
-
];
|
|
414
|
-
const findBundles = async ({ where, orderBy, limit, offset }) => {
|
|
415
|
-
const rows = isMongoAdapter ? (await orm.findMany("bundles", {
|
|
416
|
-
select: selectedColumns,
|
|
417
|
-
where: buildBundleWhere(where)
|
|
418
|
-
})).sort((a, b) => {
|
|
419
|
-
const result = a.id.localeCompare(b.id);
|
|
420
|
-
return orderBy.direction === "asc" ? result : -result;
|
|
421
|
-
}).slice(offset, offset + limit) : await orm.findMany("bundles", {
|
|
422
|
-
select: selectedColumns,
|
|
423
|
-
where: buildBundleWhere(where),
|
|
424
|
-
orderBy: [[orderBy.field, orderBy.direction]],
|
|
425
|
-
limit,
|
|
426
|
-
offset
|
|
427
|
-
});
|
|
428
|
-
const patchMap = await fetchBundlePatchMap(orm, rows.map((row) => row.id));
|
|
429
|
-
return rows.map((row) => mapBundleRecordToBundle(row, patchMap.get(row.id) ?? []));
|
|
430
|
-
};
|
|
431
|
-
if (!options.cursor?.after && !options.cursor?.before) {
|
|
432
|
-
const data = await findBundles({
|
|
433
|
-
where,
|
|
434
|
-
orderBy,
|
|
435
|
-
limit,
|
|
436
|
-
offset
|
|
437
|
-
});
|
|
438
|
-
return {
|
|
439
|
-
data,
|
|
440
|
-
pagination: {
|
|
441
|
-
...calculatePagination(total, {
|
|
442
|
-
limit,
|
|
443
|
-
offset
|
|
444
|
-
}),
|
|
445
|
-
...data.length > 0 && offset + data.length < total ? { nextCursor: data.at(-1)?.id } : {},
|
|
446
|
-
...data.length > 0 && offset > 0 ? { previousCursor: data[0]?.id } : {}
|
|
447
|
-
}
|
|
448
|
-
};
|
|
449
|
-
}
|
|
450
|
-
const { where: cursorWhere, orderBy: cursorOrderBy, reverseData } = buildCursorPageWhere(where, options.cursor, orderBy);
|
|
451
|
-
const cursorPage = await findBundles({
|
|
452
|
-
where: cursorWhere,
|
|
453
|
-
orderBy: cursorOrderBy,
|
|
454
|
-
limit,
|
|
455
|
-
offset: 0
|
|
456
|
-
});
|
|
457
|
-
const data = reverseData ? cursorPage.slice().reverse() : cursorPage;
|
|
458
|
-
if (data.length === 0) return {
|
|
459
|
-
data,
|
|
460
|
-
pagination: {
|
|
461
|
-
...calculatePagination(total, {
|
|
462
|
-
limit,
|
|
463
|
-
offset: options.cursor.after ? total : 0
|
|
464
|
-
}),
|
|
465
|
-
...options.cursor.after ? { previousCursor: options.cursor.after } : {},
|
|
466
|
-
...options.cursor.before ? { nextCursor: options.cursor.before } : {}
|
|
467
|
-
}
|
|
468
|
-
};
|
|
469
|
-
const startIndex = await orm.count("bundles", { where: buildBundleWhere(buildCountBeforeWhere(where, data[0].id, orderBy)) });
|
|
470
|
-
return {
|
|
471
|
-
data,
|
|
472
|
-
pagination: {
|
|
473
|
-
...calculatePagination(total, {
|
|
474
|
-
limit,
|
|
475
|
-
offset: startIndex
|
|
476
|
-
}),
|
|
477
|
-
...startIndex + data.length < total ? { nextCursor: data.at(-1)?.id } : {},
|
|
478
|
-
...startIndex > 0 ? { previousCursor: data[0]?.id } : {}
|
|
479
|
-
}
|
|
480
|
-
};
|
|
481
|
-
},
|
|
482
|
-
async insertBundle(bundle) {
|
|
483
|
-
assertBundlePersistenceConstraints(bundle);
|
|
484
|
-
const orm = await ensureORM();
|
|
485
|
-
const values = {
|
|
486
|
-
id: bundle.id,
|
|
487
|
-
platform: bundle.platform,
|
|
488
|
-
should_force_update: bundle.shouldForceUpdate,
|
|
489
|
-
enabled: bundle.enabled,
|
|
490
|
-
file_hash: bundle.fileHash,
|
|
491
|
-
git_commit_hash: bundle.gitCommitHash,
|
|
492
|
-
message: bundle.message,
|
|
493
|
-
channel: bundle.channel,
|
|
494
|
-
storage_uri: bundle.storageUri,
|
|
495
|
-
target_app_version: bundle.targetAppVersion,
|
|
496
|
-
fingerprint_hash: bundle.fingerprintHash,
|
|
497
|
-
metadata: stripBundleArtifactMetadata(bundle.metadata) ?? {},
|
|
498
|
-
manifest_storage_uri: getManifestStorageUri(bundle),
|
|
499
|
-
manifest_file_hash: getManifestFileHash(bundle),
|
|
500
|
-
asset_base_storage_uri: getAssetBaseStorageUri(bundle),
|
|
501
|
-
rollout_cohort_count: bundle.rolloutCohortCount ?? DEFAULT_ROLLOUT_COHORT_COUNT,
|
|
502
|
-
target_cohorts: bundle.targetCohorts ?? null
|
|
503
|
-
};
|
|
504
|
-
const { id, ...updateValues } = values;
|
|
505
|
-
await orm.upsert("bundles", {
|
|
506
|
-
where: (b) => b("id", "=", id),
|
|
507
|
-
create: values,
|
|
508
|
-
update: updateValues
|
|
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);
|
|
513
|
-
},
|
|
514
|
-
async updateBundleById(bundleId, newBundle) {
|
|
515
|
-
const orm = await ensureORM();
|
|
516
|
-
const current = await this.getBundleById(bundleId);
|
|
517
|
-
if (!current) throw new Error("targetBundleId not found");
|
|
518
|
-
const merged = {
|
|
519
|
-
...current,
|
|
520
|
-
...newBundle
|
|
521
|
-
};
|
|
522
|
-
assertBundlePersistenceConstraints(merged);
|
|
523
|
-
const values = {
|
|
524
|
-
id: merged.id,
|
|
525
|
-
platform: merged.platform,
|
|
526
|
-
should_force_update: merged.shouldForceUpdate,
|
|
527
|
-
enabled: merged.enabled,
|
|
528
|
-
file_hash: merged.fileHash,
|
|
529
|
-
git_commit_hash: merged.gitCommitHash,
|
|
530
|
-
message: merged.message,
|
|
531
|
-
channel: merged.channel,
|
|
532
|
-
storage_uri: merged.storageUri,
|
|
533
|
-
target_app_version: merged.targetAppVersion,
|
|
534
|
-
fingerprint_hash: merged.fingerprintHash,
|
|
535
|
-
metadata: stripBundleArtifactMetadata(merged.metadata) ?? {},
|
|
536
|
-
manifest_storage_uri: getManifestStorageUri(merged),
|
|
537
|
-
manifest_file_hash: getManifestFileHash(merged),
|
|
538
|
-
asset_base_storage_uri: getAssetBaseStorageUri(merged),
|
|
539
|
-
rollout_cohort_count: merged.rolloutCohortCount ?? DEFAULT_ROLLOUT_COHORT_COUNT,
|
|
540
|
-
target_cohorts: merged.targetCohorts ?? null
|
|
541
|
-
};
|
|
542
|
-
const { id: id2, ...updateValues2 } = values;
|
|
543
|
-
await orm.upsert("bundles", {
|
|
544
|
-
where: (b) => b("id", "=", id2),
|
|
545
|
-
create: values,
|
|
546
|
-
update: updateValues2
|
|
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);
|
|
551
|
-
},
|
|
552
|
-
async deleteBundleById(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) });
|
|
561
|
-
}
|
|
562
|
-
},
|
|
563
|
-
adapterName: client.adapter.name,
|
|
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
|
-
}
|
|
572
|
-
};
|
|
573
|
-
}
|
|
574
|
-
//#endregion
|
|
575
|
-
export { HotUpdaterDB, createOrmDatabaseCore };
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
//#region ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/_u64.js
|
|
3
|
-
var require__u64 = /* @__PURE__ */ require("../../../../../../_virtual/_rolldown/runtime.cjs").__commonJSMin(((exports) => {
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.toBig = exports.shrSL = exports.shrSH = exports.rotrSL = exports.rotrSH = exports.rotrBL = exports.rotrBH = exports.rotr32L = exports.rotr32H = exports.rotlSL = exports.rotlSH = exports.rotlBL = exports.rotlBH = exports.add5L = exports.add5H = exports.add4L = exports.add4H = exports.add3L = exports.add3H = void 0;
|
|
6
|
-
exports.add = add;
|
|
7
|
-
exports.fromBig = fromBig;
|
|
8
|
-
exports.split = split;
|
|
9
|
-
/**
|
|
10
|
-
* Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array.
|
|
11
|
-
* @todo re-check https://issues.chromium.org/issues/42212588
|
|
12
|
-
* @module
|
|
13
|
-
*/
|
|
14
|
-
const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
15
|
-
const _32n = /* @__PURE__ */ BigInt(32);
|
|
16
|
-
function fromBig(n, le = false) {
|
|
17
|
-
if (le) return {
|
|
18
|
-
h: Number(n & U32_MASK64),
|
|
19
|
-
l: Number(n >> _32n & U32_MASK64)
|
|
20
|
-
};
|
|
21
|
-
return {
|
|
22
|
-
h: Number(n >> _32n & U32_MASK64) | 0,
|
|
23
|
-
l: Number(n & U32_MASK64) | 0
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
function split(lst, le = false) {
|
|
27
|
-
const len = lst.length;
|
|
28
|
-
let Ah = new Uint32Array(len);
|
|
29
|
-
let Al = new Uint32Array(len);
|
|
30
|
-
for (let i = 0; i < len; i++) {
|
|
31
|
-
const { h, l } = fromBig(lst[i], le);
|
|
32
|
-
[Ah[i], Al[i]] = [h, l];
|
|
33
|
-
}
|
|
34
|
-
return [Ah, Al];
|
|
35
|
-
}
|
|
36
|
-
const toBig = (h, l) => BigInt(h >>> 0) << _32n | BigInt(l >>> 0);
|
|
37
|
-
exports.toBig = toBig;
|
|
38
|
-
const shrSH = (h, _l, s) => h >>> s;
|
|
39
|
-
exports.shrSH = shrSH;
|
|
40
|
-
const shrSL = (h, l, s) => h << 32 - s | l >>> s;
|
|
41
|
-
exports.shrSL = shrSL;
|
|
42
|
-
const rotrSH = (h, l, s) => h >>> s | l << 32 - s;
|
|
43
|
-
exports.rotrSH = rotrSH;
|
|
44
|
-
const rotrSL = (h, l, s) => h << 32 - s | l >>> s;
|
|
45
|
-
exports.rotrSL = rotrSL;
|
|
46
|
-
const rotrBH = (h, l, s) => h << 64 - s | l >>> s - 32;
|
|
47
|
-
exports.rotrBH = rotrBH;
|
|
48
|
-
const rotrBL = (h, l, s) => h >>> s - 32 | l << 64 - s;
|
|
49
|
-
exports.rotrBL = rotrBL;
|
|
50
|
-
const rotr32H = (_h, l) => l;
|
|
51
|
-
exports.rotr32H = rotr32H;
|
|
52
|
-
const rotr32L = (h, _l) => h;
|
|
53
|
-
exports.rotr32L = rotr32L;
|
|
54
|
-
const rotlSH = (h, l, s) => h << s | l >>> 32 - s;
|
|
55
|
-
exports.rotlSH = rotlSH;
|
|
56
|
-
const rotlSL = (h, l, s) => l << s | h >>> 32 - s;
|
|
57
|
-
exports.rotlSL = rotlSL;
|
|
58
|
-
const rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
|
|
59
|
-
exports.rotlBH = rotlBH;
|
|
60
|
-
const rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
|
|
61
|
-
exports.rotlBL = rotlBL;
|
|
62
|
-
function add(Ah, Al, Bh, Bl) {
|
|
63
|
-
const l = (Al >>> 0) + (Bl >>> 0);
|
|
64
|
-
return {
|
|
65
|
-
h: Ah + Bh + (l / 2 ** 32 | 0) | 0,
|
|
66
|
-
l: l | 0
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
|
|
70
|
-
exports.add3L = add3L;
|
|
71
|
-
const add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
|
|
72
|
-
exports.add3H = add3H;
|
|
73
|
-
const add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
|
|
74
|
-
exports.add4L = add4L;
|
|
75
|
-
const add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
|
|
76
|
-
exports.add4H = add4H;
|
|
77
|
-
const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
|
|
78
|
-
exports.add5L = add5L;
|
|
79
|
-
const add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
|
|
80
|
-
exports.add5H = add5H;
|
|
81
|
-
exports.default = {
|
|
82
|
-
fromBig,
|
|
83
|
-
split,
|
|
84
|
-
toBig,
|
|
85
|
-
shrSH,
|
|
86
|
-
shrSL,
|
|
87
|
-
rotrSH,
|
|
88
|
-
rotrSL,
|
|
89
|
-
rotrBH,
|
|
90
|
-
rotrBL,
|
|
91
|
-
rotr32H,
|
|
92
|
-
rotr32L,
|
|
93
|
-
rotlSH,
|
|
94
|
-
rotlSL,
|
|
95
|
-
rotlBH,
|
|
96
|
-
rotlBL,
|
|
97
|
-
add,
|
|
98
|
-
add3L,
|
|
99
|
-
add3H,
|
|
100
|
-
add4L,
|
|
101
|
-
add4H,
|
|
102
|
-
add5H,
|
|
103
|
-
add5L
|
|
104
|
-
};
|
|
105
|
-
}));
|
|
106
|
-
//#endregion
|
|
107
|
-
Object.defineProperty(exports, "default", {
|
|
108
|
-
enumerable: true,
|
|
109
|
-
get: function() {
|
|
110
|
-
return require__u64();
|
|
111
|
-
}
|
|
112
|
-
});
|