@hot-updater/server 0.36.6 → 1.0.0-rc.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 (291) hide show
  1. package/dist/adapters/databaseConstraintErrors.cjs +23 -0
  2. package/dist/adapters/databaseConstraintErrors.mjs +21 -0
  3. package/dist/adapters/databasePluginUtils.cjs +117 -0
  4. package/dist/adapters/databasePluginUtils.mjs +106 -0
  5. package/dist/adapters/drizzle.cjs +53 -176
  6. package/dist/adapters/drizzle.d.cts +6 -4
  7. package/dist/adapters/drizzle.d.mts +6 -4
  8. package/dist/adapters/drizzle.mjs +54 -177
  9. package/dist/adapters/drizzleCrud.cjs +250 -0
  10. package/dist/adapters/drizzleCrud.mjs +249 -0
  11. package/dist/adapters/drizzleLazyDB.cjs +84 -36
  12. package/dist/adapters/drizzleLazyDB.mjs +84 -36
  13. package/dist/adapters/drizzleQuery.cjs +68 -0
  14. package/dist/adapters/drizzleQuery.mjs +67 -0
  15. package/dist/adapters/kysely.cjs +18 -138
  16. package/dist/adapters/kysely.d.cts +3 -12
  17. package/dist/adapters/kysely.d.mts +3 -12
  18. package/dist/adapters/kysely.mjs +19 -139
  19. package/dist/adapters/kyselyCrud.cjs +254 -0
  20. package/dist/adapters/kyselyCrud.mjs +253 -0
  21. package/dist/adapters/kyselyQuery.cjs +56 -0
  22. package/dist/adapters/kyselyQuery.mjs +55 -0
  23. package/dist/adapters/mongodb.cjs +21 -174
  24. package/dist/adapters/mongodb.d.cts +3 -2
  25. package/dist/adapters/mongodb.d.mts +3 -2
  26. package/dist/adapters/mongodb.mjs +21 -174
  27. package/dist/adapters/mongodbCollections.cjs +36 -0
  28. package/dist/adapters/mongodbCollections.mjs +30 -0
  29. package/dist/adapters/mongodbQuery.cjs +77 -0
  30. package/dist/adapters/mongodbQuery.mjs +70 -0
  31. package/dist/adapters/mongodbReads.cjs +148 -0
  32. package/dist/adapters/mongodbReads.mjs +147 -0
  33. package/dist/adapters/mongodbWrites.cjs +134 -0
  34. package/dist/adapters/mongodbWrites.mjs +133 -0
  35. package/dist/adapters/prisma.cjs +205 -180
  36. package/dist/adapters/prisma.d.cts +3 -3
  37. package/dist/adapters/prisma.d.mts +3 -3
  38. package/dist/adapters/prisma.mjs +206 -181
  39. package/dist/adapters/prismaQuery.cjs +58 -0
  40. package/dist/adapters/prismaQuery.mjs +56 -0
  41. package/dist/adapters/prismaRows.cjs +198 -0
  42. package/dist/adapters/prismaRows.mjs +188 -0
  43. package/dist/analytics/bounded/activeOverview.cjs +87 -0
  44. package/dist/analytics/bounded/activeOverview.mjs +85 -0
  45. package/dist/analytics/bounded/installationSearch.cjs +42 -0
  46. package/dist/analytics/bounded/installationSearch.mjs +42 -0
  47. package/dist/analytics/bounded/persistence.cjs +39 -0
  48. package/dist/analytics/bounded/persistence.mjs +38 -0
  49. package/dist/analytics/bounded/provider.cjs +170 -0
  50. package/dist/analytics/bounded/provider.d.cts +7 -0
  51. package/dist/analytics/bounded/provider.d.mts +7 -0
  52. package/dist/analytics/bounded/provider.mjs +170 -0
  53. package/dist/analytics/bounded/scan.cjs +144 -0
  54. package/dist/analytics/bounded/scan.mjs +138 -0
  55. package/dist/analytics/domain.d.cts +121 -0
  56. package/dist/analytics/domain.d.mts +121 -0
  57. package/dist/analytics/errors.cjs +22 -0
  58. package/dist/analytics/errors.mjs +20 -0
  59. package/dist/analytics/eventInput.cjs +111 -0
  60. package/dist/analytics/eventInput.mjs +111 -0
  61. package/dist/analytics/persistence.d.cts +6 -0
  62. package/dist/analytics/persistence.d.mts +6 -0
  63. package/dist/analytics/queryInput.cjs +58 -0
  64. package/dist/analytics/queryInput.mjs +55 -0
  65. package/dist/analytics/routes.cjs +63 -0
  66. package/dist/analytics/routes.mjs +61 -0
  67. package/dist/analytics/types.d.cts +17 -0
  68. package/dist/analytics/types.d.mts +17 -0
  69. package/dist/apiKeys.cjs +139 -0
  70. package/dist/apiKeys.d.cts +50 -0
  71. package/dist/apiKeys.d.mts +50 -0
  72. package/dist/apiKeys.mjs +133 -0
  73. package/dist/createHotUpdaterCore.cjs +48 -26
  74. package/dist/createHotUpdaterCore.d.cts +49 -17
  75. package/dist/createHotUpdaterCore.d.mts +49 -17
  76. package/dist/createHotUpdaterCore.mjs +51 -29
  77. package/dist/db/createBundleDiff.cjs +45 -68
  78. package/dist/db/createBundleDiff.d.cts +3 -3
  79. package/dist/db/createBundleDiff.d.mts +3 -3
  80. package/dist/db/createBundleDiff.mjs +47 -68
  81. package/dist/db/databasePluginCore.cjs +138 -0
  82. package/dist/db/databasePluginCore.mjs +137 -0
  83. package/dist/db/fixedMigrator.cjs +36 -93
  84. package/dist/db/fixedMigrator.mjs +36 -93
  85. package/dist/db/fixedMigratorMongo.cjs +319 -0
  86. package/dist/db/fixedMigratorMongo.mjs +319 -0
  87. package/dist/db/fixedMigratorShared.cjs +23 -0
  88. package/dist/db/fixedMigratorShared.mjs +18 -0
  89. package/dist/db/mongoMigrationExecution.cjs +11 -0
  90. package/dist/db/mongoMigrationExecution.mjs +11 -0
  91. package/dist/db/releaseCatalog.cjs +66 -0
  92. package/dist/db/releaseCatalog.d.cts +17 -0
  93. package/dist/db/releaseCatalog.d.mts +17 -0
  94. package/dist/db/releaseCatalog.mjs +64 -0
  95. package/dist/db/schema/mongodb.cjs +14 -6
  96. package/dist/db/schema/mongodb.mjs +14 -6
  97. package/dist/db/schema/registry.cjs +0 -2
  98. package/dist/db/schema/registry.mjs +1 -2
  99. package/dist/db/schema/sql.cjs +31 -14
  100. package/dist/db/schema/sql.mjs +32 -13
  101. package/dist/db/schema/sqlOperations.cjs +4 -4
  102. package/dist/db/schema/sqlOperations.mjs +5 -5
  103. package/dist/db/schemaGenerators.cjs +52 -18
  104. package/dist/db/schemaGenerators.mjs +52 -18
  105. package/dist/db/schemaReadiness.cjs +4 -3
  106. package/dist/db/schemaReadiness.mjs +4 -3
  107. package/dist/db/sqlMigrationExecution.cjs +67 -0
  108. package/dist/db/sqlMigrationExecution.mjs +66 -0
  109. package/dist/db/types.cjs +2 -6
  110. package/dist/db/types.d.cts +60 -16
  111. package/dist/db/types.d.mts +60 -16
  112. package/dist/db/types.mjs +3 -6
  113. package/dist/db/updateArtifacts.cjs +114 -60
  114. package/dist/db/updateArtifacts.mjs +117 -62
  115. package/dist/handler.cjs +108 -282
  116. package/dist/handler.d.cts +3 -46
  117. package/dist/handler.d.mts +3 -46
  118. package/dist/handler.mjs +107 -281
  119. package/dist/handlerBundleRoutes.cjs +155 -0
  120. package/dist/handlerBundleRoutes.mjs +155 -0
  121. package/dist/handlerErrors.cjs +9 -0
  122. package/dist/handlerErrors.mjs +9 -0
  123. package/dist/handlerParameters.cjs +39 -0
  124. package/dist/handlerParameters.mjs +34 -0
  125. package/dist/handlerReleaseCatalogRoutes.cjs +111 -0
  126. package/dist/handlerReleaseCatalogRoutes.mjs +110 -0
  127. package/dist/handlerReleaseManagementRoutes.cjs +125 -0
  128. package/dist/handlerReleaseManagementRoutes.mjs +124 -0
  129. package/dist/handlerTypes.d.cts +63 -0
  130. package/dist/handlerTypes.d.mts +63 -0
  131. package/dist/handlerVersionRoutes.cjs +10 -0
  132. package/dist/handlerVersionRoutes.d.cts +4 -0
  133. package/dist/handlerVersionRoutes.d.mts +4 -0
  134. package/dist/handlerVersionRoutes.mjs +9 -0
  135. package/dist/index.cjs +10 -1
  136. package/dist/index.d.cts +9 -3
  137. package/dist/index.d.mts +9 -3
  138. package/dist/index.mjs +5 -2
  139. package/dist/node.cjs +19 -12
  140. package/dist/node.d.cts +15 -10
  141. package/dist/node.d.mts +15 -10
  142. package/dist/node.mjs +19 -13
  143. package/dist/package.cjs +1 -1
  144. package/dist/package.mjs +1 -1
  145. package/dist/schema/dsl.cjs +19 -2
  146. package/dist/schema/dsl.mjs +17 -3
  147. package/dist/schema/index.cjs +1 -8
  148. package/dist/schema/index.mjs +2 -8
  149. package/dist/schema/types.cjs +3 -1
  150. package/dist/schema/types.mjs +3 -2
  151. package/dist/schema/v1_0_0.cjs +364 -0
  152. package/dist/schema/v1_0_0.mjs +357 -0
  153. package/dist/storageAccess.cjs +69 -25
  154. package/dist/storageAccess.mjs +68 -25
  155. package/dist/types/index.d.cts +4 -3
  156. package/dist/types/index.d.mts +5 -4
  157. package/package.json +8 -7
  158. package/src/adapters/databaseConstraintErrors.ts +25 -0
  159. package/src/adapters/databasePluginTestDatabase.ts +106 -0
  160. package/src/adapters/databasePluginUtils.spec.ts +29 -0
  161. package/src/adapters/databasePluginUtils.ts +214 -0
  162. package/src/adapters/drizzle.spec.ts +208 -47
  163. package/src/adapters/drizzle.ts +106 -293
  164. package/src/adapters/drizzleCrud.ts +419 -0
  165. package/src/adapters/drizzleLazyDB.ts +206 -100
  166. package/src/adapters/drizzleQuery.ts +164 -0
  167. package/src/adapters/kysely.spec.ts +126 -88
  168. package/src/adapters/kysely.ts +76 -334
  169. package/src/adapters/kyselyCrud.ts +588 -0
  170. package/src/adapters/kyselyQuery.ts +128 -0
  171. package/src/adapters/mongodb.spec.ts +141 -0
  172. package/src/adapters/mongodb.ts +60 -288
  173. package/src/adapters/mongodbCollections.ts +62 -0
  174. package/src/adapters/mongodbQuery.ts +226 -0
  175. package/src/adapters/mongodbReads.ts +311 -0
  176. package/src/adapters/mongodbRows.spec.ts +64 -0
  177. package/src/adapters/mongodbRows.ts +118 -0
  178. package/src/adapters/mongodbTestClient.ts +342 -0
  179. package/src/adapters/mongodbTestFilter.ts +166 -0
  180. package/src/adapters/mongodbWrites.ts +260 -0
  181. package/src/adapters/prisma.spec.ts +196 -0
  182. package/src/adapters/prisma.ts +417 -292
  183. package/src/adapters/prismaQuery.ts +129 -0
  184. package/src/adapters/prismaRows.spec.ts +98 -0
  185. package/src/adapters/prismaRows.ts +301 -0
  186. package/src/adapters/prismaTestClient.ts +396 -0
  187. package/src/analytics/analytics.integration.spec.ts +144 -0
  188. package/src/analytics/bounded/activeOverview.spec.ts +189 -0
  189. package/src/analytics/bounded/activeOverview.ts +148 -0
  190. package/src/analytics/bounded/installationSearch.spec.ts +130 -0
  191. package/src/analytics/bounded/installationSearch.ts +69 -0
  192. package/src/analytics/bounded/persistence.ts +43 -0
  193. package/src/analytics/bounded/provider.spec.ts +219 -0
  194. package/src/analytics/bounded/provider.ts +229 -0
  195. package/src/analytics/bounded/scan.ts +235 -0
  196. package/src/analytics/domain.ts +139 -0
  197. package/src/analytics/errors.ts +18 -0
  198. package/src/analytics/eventInput.ts +168 -0
  199. package/src/analytics/persistence.ts +10 -0
  200. package/src/analytics/queryInput.ts +102 -0
  201. package/src/analytics/routes.ts +123 -0
  202. package/src/analytics/types.ts +44 -0
  203. package/src/apiKeys.integration.spec.ts +192 -0
  204. package/src/apiKeys.spec.ts +162 -0
  205. package/src/apiKeys.ts +220 -0
  206. package/src/createHotUpdaterCore.ts +164 -100
  207. package/src/db/bundleRows.spec.ts +164 -0
  208. package/src/db/bundleRows.ts +10 -140
  209. package/src/db/createBundleDiff.spec.ts +172 -127
  210. package/src/db/createBundleDiff.ts +91 -110
  211. package/src/db/databasePluginCore.spec.ts +62 -0
  212. package/src/db/databasePluginCore.testFixtures.ts +76 -0
  213. package/src/db/databasePluginCore.ts +185 -0
  214. package/src/db/databasePluginUpdateCheck.bench.ts +107 -0
  215. package/src/db/fixedMigrator.spec.ts +184 -42
  216. package/src/db/fixedMigrator.ts +64 -205
  217. package/src/db/fixedMigratorMongo.spec.ts +192 -0
  218. package/src/db/fixedMigratorMongo.ts +425 -0
  219. package/src/db/fixedMigratorShared.ts +36 -0
  220. package/src/db/hotUpdaterSchema.ts +0 -1
  221. package/src/db/index.spec.ts +333 -1025
  222. package/src/db/mongoMigrationExecution.ts +23 -0
  223. package/src/db/node-sqlite.d.ts +25 -0
  224. package/src/db/releaseCatalog.ts +148 -0
  225. package/src/db/schema/mongodb.ts +20 -6
  226. package/src/db/schema/sql.ts +52 -11
  227. package/src/db/schema/sqlOperations.ts +5 -4
  228. package/src/db/schemaGenerators.ts +107 -23
  229. package/src/db/schemaReadiness.ts +2 -1
  230. package/src/db/sqlMigrationExecution.spec.ts +65 -0
  231. package/src/db/sqlMigrationExecution.ts +108 -0
  232. package/src/db/types.spec.ts +55 -0
  233. package/src/db/types.ts +129 -65
  234. package/src/db/updateArtifacts.spec.ts +359 -0
  235. package/src/db/updateArtifacts.ts +290 -126
  236. package/src/handler-standalone.integration.spec.ts +401 -364
  237. package/src/handler.spec.ts +137 -582
  238. package/src/handler.testFixtures.ts +30 -0
  239. package/src/handler.ts +218 -616
  240. package/src/handlerAuth.integration.spec.ts +33 -0
  241. package/src/handlerBundleRoutes.ts +259 -0
  242. package/src/handlerErrors.ts +7 -0
  243. package/src/handlerManagement.spec.ts +262 -0
  244. package/src/handlerParameters.ts +105 -0
  245. package/src/handlerReleaseCatalogRoutes.ts +154 -0
  246. package/src/handlerReleaseManagementRoutes.ts +213 -0
  247. package/src/handlerTypes.ts +96 -0
  248. package/src/handlerVersionRoutes.ts +12 -0
  249. package/src/index.ts +22 -2
  250. package/src/node.spec.ts +79 -10
  251. package/src/node.ts +20 -17
  252. package/src/releaseCatalogRoutes.integration.spec.ts +238 -0
  253. package/src/runtime.spec.ts +126 -959
  254. package/src/runtime.testFixtures.ts +71 -0
  255. package/src/schema/dsl-all-versions.spec.ts +26 -17
  256. package/src/schema/dsl.ts +41 -2
  257. package/src/schema/index.ts +3 -9
  258. package/src/schema/types.ts +9 -3
  259. package/src/schema/v1_0_0.spec.ts +146 -0
  260. package/src/schema/v1_0_0.ts +465 -0
  261. package/src/storageAccess.spec.ts +127 -32
  262. package/src/storageAccess.ts +106 -55
  263. package/src/types/index.ts +2 -1
  264. package/dist/db/bundleRows.cjs +0 -82
  265. package/dist/db/bundleRows.d.cts +0 -33
  266. package/dist/db/bundleRows.d.mts +0 -33
  267. package/dist/db/bundleRows.mjs +0 -79
  268. package/dist/db/pluginCore.cjs +0 -242
  269. package/dist/db/pluginCore.mjs +0 -241
  270. package/dist/db/schema/sqlMigrations.cjs +0 -74
  271. package/dist/db/schema/sqlMigrations.mjs +0 -73
  272. package/dist/db/schemaEnhancements.cjs +0 -20
  273. package/dist/db/schemaEnhancements.mjs +0 -19
  274. package/dist/route.cjs +0 -7
  275. package/dist/route.mjs +0 -7
  276. package/dist/schema/v0_21_0.cjs +0 -38
  277. package/dist/schema/v0_21_0.mjs +0 -37
  278. package/dist/schema/v0_29_0.cjs +0 -45
  279. package/dist/schema/v0_29_0.mjs +0 -44
  280. package/dist/schema/v0_31_0.cjs +0 -82
  281. package/dist/schema/v0_31_0.mjs +0 -80
  282. package/src/db/pluginCore.spec.ts +0 -1095
  283. package/src/db/pluginCore.ts +0 -475
  284. package/src/db/pluginUpdateCheck.bench.ts +0 -254
  285. package/src/db/schema/sqlMigrations.ts +0 -219
  286. package/src/db/schemaEnhancements.ts +0 -55
  287. package/src/route.ts +0 -7
  288. package/src/schema/v0_21_0.ts +0 -52
  289. package/src/schema/v0_29_0.ts +0 -62
  290. package/src/schema/v0_31_0.spec.ts +0 -73
  291. package/src/schema/v0_31_0.ts +0 -120
@@ -1,21 +1,14 @@
1
- import type {
2
- HotUpdaterContext,
3
- RuntimeStoragePlugin,
1
+ import {
2
+ parseStorageDownloadPath,
3
+ type StoragePluginWith,
4
4
  } from "@hot-updater/plugin-core";
5
5
 
6
- const assertRemoteDownloadUrl = (fileUrl: string) => {
7
- try {
8
- const protocol = new URL(fileUrl).protocol.replace(":", "");
9
- if (protocol === "http" || protocol === "https") {
10
- return fileUrl;
11
- }
12
- } catch {
13
- // Fall through to the runtime-specific error below.
6
+ const assertRemoteUrl = (value: string) => {
7
+ const protocol = new URL(value).protocol;
8
+ if (protocol !== "http:" && protocol !== "https:") {
9
+ throw new Error("Storage getDownloadUrl must resolve to an HTTP(S) URL.");
14
10
  }
15
-
16
- throw new Error(
17
- "Storage plugin returned a local file path; runtime update checks require an HTTP(S) download URL.",
18
- );
11
+ return value;
19
12
  };
20
13
 
21
14
  const getStorageProtocol = (storageUri: string) =>
@@ -24,66 +17,124 @@ const getStorageProtocol = (storageUri: string) =>
24
17
  const isRemoteUrlProtocol = (protocol: string) =>
25
18
  protocol === "http" || protocol === "https";
26
19
 
27
- export const createStorageAccess = <TContext>(
28
- storagePlugins: RuntimeStoragePlugin<TContext>[],
20
+ const resolveDownloadPath = (value: string, storageUri: string) => {
21
+ const parsed = parseStorageDownloadPath(value);
22
+ if (!parsed || parsed.storageUri !== storageUri) {
23
+ throw new Error(
24
+ "Storage getDownloadUrl must return an HTTP(S) URL or a valid storage download path.",
25
+ );
26
+ }
27
+ return value;
28
+ };
29
+
30
+ const tokensEqual = (left: string, right: string) => {
31
+ const leftBytes = new TextEncoder().encode(left);
32
+ const rightBytes = new TextEncoder().encode(right);
33
+ let difference = leftBytes.length ^ rightBytes.length;
34
+ const length = Math.max(leftBytes.length, rightBytes.length);
35
+ for (let index = 0; index < length; index += 1) {
36
+ difference |= (leftBytes[index] ?? 0) ^ (rightBytes[index] ?? 0);
37
+ }
38
+ return difference === 0;
39
+ };
40
+
41
+ export const createStorageAccess = (
42
+ storagePlugins: StoragePluginWith<"get">[],
29
43
  ) => {
30
- const findStoragePlugin = (protocol: string) => {
31
- return storagePlugins.find((item) => item.supportedProtocol === protocol);
44
+ const protocols = new Set<string>();
45
+ for (const storage of storagePlugins) {
46
+ if (protocols.has(storage.protocol)) {
47
+ throw new Error(
48
+ `Multiple storage plugins handle protocol: ${storage.protocol}`,
49
+ );
50
+ }
51
+ protocols.add(storage.protocol);
52
+ }
53
+
54
+ const findStorage = (protocol: string) =>
55
+ storagePlugins.find((item) => item.protocol === protocol);
56
+
57
+ const readStorageResponse = async (
58
+ storageUri: string,
59
+ ): Promise<Response | null> => {
60
+ const protocol = getStorageProtocol(storageUri);
61
+ const storage = findStorage(protocol);
62
+ if (storage) return (await storage.get({ storageUri })).response;
63
+
64
+ if (isRemoteUrlProtocol(protocol)) {
65
+ const response = await fetch(storageUri);
66
+ return response.ok ? response : null;
67
+ }
68
+
69
+ throw new Error(`No storage plugin for protocol: ${protocol}`);
32
70
  };
33
71
 
34
72
  const resolveFileUrl = async (
35
73
  storageUri: string | null,
36
- context?: HotUpdaterContext<TContext>,
37
74
  ): Promise<string | null> => {
38
- if (!storageUri) {
39
- return null;
40
- }
75
+ if (!storageUri) return null;
41
76
 
42
77
  const protocol = getStorageProtocol(storageUri);
43
- const plugin = findStoragePlugin(protocol);
44
- if (plugin) {
45
- const downloadTarget = await plugin.profiles.runtime.getDownloadUrl(
46
- storageUri,
47
- context,
78
+ const storage = findStorage(protocol);
79
+ if (!storage) {
80
+ if (isRemoteUrlProtocol(protocol)) return storageUri;
81
+ throw new Error(`No storage plugin for protocol: ${protocol}`);
82
+ }
83
+ if (!storage.getDownloadUrl) {
84
+ throw new Error(
85
+ `Storage plugin "${storage.name}" does not implement getDownloadUrl.`,
48
86
  );
49
- const { fileUrl } = downloadTarget;
50
- if (!fileUrl) {
51
- throw new Error("Storage plugin returned empty fileUrl");
52
- }
53
-
54
- return assertRemoteDownloadUrl(fileUrl);
55
87
  }
56
-
57
- if (isRemoteUrlProtocol(protocol)) {
58
- return storageUri;
88
+ const { url: downloadUrl } = await storage.getDownloadUrl({ storageUri });
89
+ try {
90
+ return assertRemoteUrl(downloadUrl);
91
+ } catch (error) {
92
+ if (/^[a-z][a-z\d+.-]*:/i.test(downloadUrl)) throw error;
59
93
  }
60
-
61
- throw new Error(`No storage plugin for protocol: ${protocol}`);
94
+ return resolveDownloadPath(downloadUrl, storageUri);
62
95
  };
63
96
 
64
97
  const readStorageText = async (
65
98
  storageUri: string,
66
- context?: HotUpdaterContext<TContext>,
67
99
  ): Promise<string | null> => {
68
- const protocol = getStorageProtocol(storageUri);
69
- const plugin = findStoragePlugin(protocol);
70
- if (plugin) {
71
- return plugin.profiles.runtime.readText(storageUri, context);
72
- }
100
+ const response = await readStorageResponse(storageUri);
101
+ return response?.text() ?? null;
102
+ };
73
103
 
74
- if (isRemoteUrlProtocol(protocol)) {
75
- const response = await fetch(storageUri);
76
- if (!response.ok) {
77
- return null;
104
+ const downloadStorageObject = storagePlugins.some(
105
+ (storage) => storage.getDownloadUrl !== undefined,
106
+ )
107
+ ? async (
108
+ storageUriToken: string,
109
+ encodedSignature: string,
110
+ ): Promise<Response | null> => {
111
+ const requestedPath = `/storage/${storageUriToken}/${encodedSignature}`;
112
+ const requested = parseStorageDownloadPath(requestedPath);
113
+ if (!requested) return null;
114
+ let storage: StoragePluginWith<"get"> | undefined;
115
+ try {
116
+ storage = findStorage(getStorageProtocol(requested.storageUri));
117
+ } catch {
118
+ return null;
119
+ }
120
+ if (!storage?.getDownloadUrl) return null;
121
+ const { url: downloadUrl } = await storage.getDownloadUrl({
122
+ storageUri: requested.storageUri,
123
+ });
124
+ try {
125
+ new URL(downloadUrl);
126
+ return null;
127
+ } catch {
128
+ if (/^[a-z][a-z\d+.-]*:/i.test(downloadUrl)) return null;
129
+ }
130
+ if (!tokensEqual(downloadUrl, requestedPath)) return null;
131
+ return (await storage.get({ storageUri: requested.storageUri }))
132
+ .response;
78
133
  }
79
-
80
- return response.text();
81
- }
82
-
83
- throw new Error(`No storage plugin for protocol: ${protocol}`);
84
- };
134
+ : undefined;
85
135
 
86
136
  return {
137
+ downloadStorageObject,
87
138
  readStorageText,
88
139
  resolveFileUrl,
89
140
  };
@@ -1,4 +1,5 @@
1
1
  import type { Bundle } from "@hot-updater/core";
2
+ import type { ChannelRow } from "@hot-updater/plugin-core";
2
3
 
3
4
  export type { Bundle } from "@hot-updater/core";
4
5
  export type { HotUpdaterAPI } from "../createHotUpdaterCore";
@@ -29,5 +30,5 @@ export interface Paginated<TData> extends DataResponse<TData> {
29
30
  export type PaginatedResult = Paginated<Bundle[]>;
30
31
 
31
32
  export type ChannelsResponse = DataResponse<{
32
- channels: string[];
33
+ channels: readonly ChannelRow[];
33
34
  }>;
@@ -1,82 +0,0 @@
1
- require("../_virtual/_rolldown/runtime.cjs");
2
- const require_updateArtifacts = require("./updateArtifacts.cjs");
3
- let _hot_updater_core = require("@hot-updater/core");
4
- //#region src/db/bundleRows.ts
5
- const parseTargetCohorts = (value) => {
6
- if (!value) return null;
7
- if (Array.isArray(value)) return value.filter((item) => typeof item === "string");
8
- if (typeof value !== "string") return null;
9
- try {
10
- const parsed = JSON.parse(value);
11
- return Array.isArray(parsed) ? parsed.filter((item) => typeof item === "string") : null;
12
- } catch {
13
- return null;
14
- }
15
- };
16
- const buildBundlePatchId = (bundleId, baseBundleId) => `${bundleId}:${baseBundleId}`;
17
- const bundleToRow = (bundle) => ({
18
- id: bundle.id,
19
- platform: bundle.platform,
20
- should_force_update: bundle.shouldForceUpdate,
21
- enabled: bundle.enabled,
22
- file_hash: bundle.fileHash,
23
- git_commit_hash: bundle.gitCommitHash,
24
- message: bundle.message,
25
- channel: bundle.channel,
26
- storage_uri: bundle.storageUri,
27
- target_app_version: bundle.targetAppVersion,
28
- fingerprint_hash: bundle.fingerprintHash,
29
- metadata: (0, _hot_updater_core.stripBundleArtifactMetadata)(bundle.metadata) ?? {},
30
- manifest_storage_uri: (0, _hot_updater_core.getManifestStorageUri)(bundle),
31
- manifest_file_hash: (0, _hot_updater_core.getManifestFileHash)(bundle),
32
- asset_base_storage_uri: (0, _hot_updater_core.getAssetBaseStorageUri)(bundle),
33
- rollout_cohort_count: bundle.rolloutCohortCount ?? _hot_updater_core.DEFAULT_ROLLOUT_COHORT_COUNT,
34
- target_cohorts: bundle.targetCohorts ?? null
35
- });
36
- const bundleToPatchRows = (bundle) => (0, _hot_updater_core.getBundlePatches)(bundle).map((patch, index) => ({
37
- id: buildBundlePatchId(bundle.id, patch.baseBundleId),
38
- bundle_id: bundle.id,
39
- base_bundle_id: patch.baseBundleId,
40
- base_file_hash: patch.baseFileHash,
41
- patch_file_hash: patch.patchFileHash,
42
- patch_storage_uri: patch.patchStorageUri,
43
- order_index: index
44
- }));
45
- const mapPatchRowToPatch = (record) => ({
46
- baseBundleId: record.base_bundle_id,
47
- baseFileHash: record.base_file_hash,
48
- patchFileHash: record.patch_file_hash,
49
- patchStorageUri: record.patch_storage_uri
50
- });
51
- const rowToBundle = (record, patchRecords = []) => {
52
- 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(mapPatchRowToPatch);
53
- const primaryPatch = patches[0] ?? null;
54
- return {
55
- id: record.id,
56
- platform: record.platform,
57
- shouldForceUpdate: Boolean(record.should_force_update),
58
- enabled: Boolean(record.enabled),
59
- fileHash: record.file_hash,
60
- gitCommitHash: record.git_commit_hash ?? null,
61
- message: record.message ?? null,
62
- channel: record.channel,
63
- storageUri: record.storage_uri,
64
- targetAppVersion: record.target_app_version ?? null,
65
- fingerprintHash: record.fingerprint_hash ?? null,
66
- metadata: require_updateArtifacts.parseBundleMetadata(record.metadata),
67
- manifestStorageUri: record.manifest_storage_uri ?? null,
68
- manifestFileHash: record.manifest_file_hash ?? null,
69
- assetBaseStorageUri: record.asset_base_storage_uri ?? null,
70
- patches,
71
- patchBaseBundleId: primaryPatch?.baseBundleId ?? null,
72
- patchBaseFileHash: primaryPatch?.baseFileHash ?? null,
73
- patchFileHash: primaryPatch?.patchFileHash ?? null,
74
- patchStorageUri: primaryPatch?.patchStorageUri ?? null,
75
- rolloutCohortCount: record.rollout_cohort_count ?? _hot_updater_core.DEFAULT_ROLLOUT_COHORT_COUNT,
76
- targetCohorts: parseTargetCohorts(record.target_cohorts)
77
- };
78
- };
79
- //#endregion
80
- exports.bundleToPatchRows = bundleToPatchRows;
81
- exports.bundleToRow = bundleToRow;
82
- exports.rowToBundle = rowToBundle;
@@ -1,33 +0,0 @@
1
- import { Bundle } from "@hot-updater/core";
2
-
3
- //#region src/db/bundleRows.d.ts
4
- type BundleRow = {
5
- readonly id: string;
6
- readonly platform: string;
7
- readonly should_force_update: unknown;
8
- readonly enabled: unknown;
9
- readonly file_hash: string;
10
- readonly git_commit_hash: string | null;
11
- readonly message: string | null;
12
- readonly channel: string;
13
- readonly storage_uri: string;
14
- readonly target_app_version: string | null;
15
- readonly fingerprint_hash: string | null;
16
- readonly metadata?: unknown;
17
- readonly manifest_storage_uri?: string | null;
18
- readonly manifest_file_hash?: string | null;
19
- readonly asset_base_storage_uri?: string | null;
20
- readonly rollout_cohort_count?: number | null;
21
- readonly target_cohorts?: unknown;
22
- };
23
- type BundlePatchRow = {
24
- readonly id: string;
25
- readonly bundle_id: string;
26
- readonly base_bundle_id: string;
27
- readonly base_file_hash: string;
28
- readonly patch_file_hash: string;
29
- readonly patch_storage_uri: string;
30
- readonly order_index?: number | null;
31
- };
32
- //#endregion
33
- export { BundlePatchRow, BundleRow };
@@ -1,33 +0,0 @@
1
- import { Bundle } from "@hot-updater/core";
2
-
3
- //#region src/db/bundleRows.d.ts
4
- type BundleRow = {
5
- readonly id: string;
6
- readonly platform: string;
7
- readonly should_force_update: unknown;
8
- readonly enabled: unknown;
9
- readonly file_hash: string;
10
- readonly git_commit_hash: string | null;
11
- readonly message: string | null;
12
- readonly channel: string;
13
- readonly storage_uri: string;
14
- readonly target_app_version: string | null;
15
- readonly fingerprint_hash: string | null;
16
- readonly metadata?: unknown;
17
- readonly manifest_storage_uri?: string | null;
18
- readonly manifest_file_hash?: string | null;
19
- readonly asset_base_storage_uri?: string | null;
20
- readonly rollout_cohort_count?: number | null;
21
- readonly target_cohorts?: unknown;
22
- };
23
- type BundlePatchRow = {
24
- readonly id: string;
25
- readonly bundle_id: string;
26
- readonly base_bundle_id: string;
27
- readonly base_file_hash: string;
28
- readonly patch_file_hash: string;
29
- readonly patch_storage_uri: string;
30
- readonly order_index?: number | null;
31
- };
32
- //#endregion
33
- export { BundlePatchRow, BundleRow };
@@ -1,79 +0,0 @@
1
- import { parseBundleMetadata } from "./updateArtifacts.mjs";
2
- import { DEFAULT_ROLLOUT_COHORT_COUNT, getAssetBaseStorageUri, getBundlePatches, getManifestFileHash, getManifestStorageUri, stripBundleArtifactMetadata } from "@hot-updater/core";
3
- //#region src/db/bundleRows.ts
4
- const parseTargetCohorts = (value) => {
5
- if (!value) return null;
6
- if (Array.isArray(value)) return value.filter((item) => typeof item === "string");
7
- if (typeof value !== "string") return null;
8
- try {
9
- const parsed = JSON.parse(value);
10
- return Array.isArray(parsed) ? parsed.filter((item) => typeof item === "string") : null;
11
- } catch {
12
- return null;
13
- }
14
- };
15
- const buildBundlePatchId = (bundleId, baseBundleId) => `${bundleId}:${baseBundleId}`;
16
- const bundleToRow = (bundle) => ({
17
- id: bundle.id,
18
- platform: bundle.platform,
19
- should_force_update: bundle.shouldForceUpdate,
20
- enabled: bundle.enabled,
21
- file_hash: bundle.fileHash,
22
- git_commit_hash: bundle.gitCommitHash,
23
- message: bundle.message,
24
- channel: bundle.channel,
25
- storage_uri: bundle.storageUri,
26
- target_app_version: bundle.targetAppVersion,
27
- fingerprint_hash: bundle.fingerprintHash,
28
- metadata: stripBundleArtifactMetadata(bundle.metadata) ?? {},
29
- manifest_storage_uri: getManifestStorageUri(bundle),
30
- manifest_file_hash: getManifestFileHash(bundle),
31
- asset_base_storage_uri: getAssetBaseStorageUri(bundle),
32
- rollout_cohort_count: bundle.rolloutCohortCount ?? DEFAULT_ROLLOUT_COHORT_COUNT,
33
- target_cohorts: bundle.targetCohorts ?? null
34
- });
35
- const bundleToPatchRows = (bundle) => getBundlePatches(bundle).map((patch, index) => ({
36
- id: buildBundlePatchId(bundle.id, patch.baseBundleId),
37
- bundle_id: bundle.id,
38
- base_bundle_id: patch.baseBundleId,
39
- base_file_hash: patch.baseFileHash,
40
- patch_file_hash: patch.patchFileHash,
41
- patch_storage_uri: patch.patchStorageUri,
42
- order_index: index
43
- }));
44
- const mapPatchRowToPatch = (record) => ({
45
- baseBundleId: record.base_bundle_id,
46
- baseFileHash: record.base_file_hash,
47
- patchFileHash: record.patch_file_hash,
48
- patchStorageUri: record.patch_storage_uri
49
- });
50
- const rowToBundle = (record, patchRecords = []) => {
51
- 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(mapPatchRowToPatch);
52
- const primaryPatch = patches[0] ?? null;
53
- return {
54
- id: record.id,
55
- platform: record.platform,
56
- shouldForceUpdate: Boolean(record.should_force_update),
57
- enabled: Boolean(record.enabled),
58
- fileHash: record.file_hash,
59
- gitCommitHash: record.git_commit_hash ?? null,
60
- message: record.message ?? null,
61
- channel: record.channel,
62
- storageUri: record.storage_uri,
63
- targetAppVersion: record.target_app_version ?? null,
64
- fingerprintHash: record.fingerprint_hash ?? null,
65
- metadata: parseBundleMetadata(record.metadata),
66
- manifestStorageUri: record.manifest_storage_uri ?? null,
67
- manifestFileHash: record.manifest_file_hash ?? null,
68
- assetBaseStorageUri: record.asset_base_storage_uri ?? null,
69
- patches,
70
- patchBaseBundleId: primaryPatch?.baseBundleId ?? null,
71
- patchBaseFileHash: primaryPatch?.baseFileHash ?? null,
72
- patchFileHash: primaryPatch?.patchFileHash ?? null,
73
- patchStorageUri: primaryPatch?.patchStorageUri ?? null,
74
- rolloutCohortCount: record.rollout_cohort_count ?? DEFAULT_ROLLOUT_COHORT_COUNT,
75
- targetCohorts: parseTargetCohorts(record.target_cohorts)
76
- };
77
- };
78
- //#endregion
79
- export { bundleToPatchRows, bundleToRow, rowToBundle };
@@ -1,242 +0,0 @@
1
- require("../_virtual/_rolldown/runtime.cjs");
2
- const require_schemaEnhancements = require("./schemaEnhancements.cjs");
3
- const require_updateArtifacts = require("./updateArtifacts.cjs");
4
- let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
5
- let _hot_updater_core = require("@hot-updater/core");
6
- //#region src/db/pluginCore.ts
7
- const PAGE_SIZE = 100;
8
- const DESC_ORDER = {
9
- field: "id",
10
- direction: "desc"
11
- };
12
- const bundleMatchesQueryWhere = (bundle, where) => {
13
- if (!where) return true;
14
- if (where.channel !== void 0 && bundle.channel !== where.channel) return false;
15
- if (where.platform !== void 0 && bundle.platform !== where.platform) return false;
16
- if (where.enabled !== void 0 && bundle.enabled !== where.enabled) return false;
17
- if (where.id?.eq !== void 0 && bundle.id !== where.id.eq) return false;
18
- if (where.id?.gt !== void 0 && bundle.id.localeCompare(where.id.gt) <= 0) return false;
19
- if (where.id?.gte !== void 0 && bundle.id.localeCompare(where.id.gte) < 0) return false;
20
- if (where.id?.lt !== void 0 && bundle.id.localeCompare(where.id.lt) >= 0) return false;
21
- if (where.id?.lte !== void 0 && bundle.id.localeCompare(where.id.lte) > 0) return false;
22
- if (where.id?.in && !where.id.in.includes(bundle.id)) return false;
23
- if (where.targetAppVersionNotNull && bundle.targetAppVersion === null) return false;
24
- if (where.targetAppVersion !== void 0 && bundle.targetAppVersion !== where.targetAppVersion) return false;
25
- if (where.targetAppVersionIn && !where.targetAppVersionIn.includes(bundle.targetAppVersion ?? "")) return false;
26
- if (where.fingerprintHash !== void 0 && bundle.fingerprintHash !== where.fingerprintHash) return false;
27
- return true;
28
- };
29
- const sortBundles = (bundles, orderBy) => {
30
- const direction = orderBy?.direction ?? "desc";
31
- return bundles.slice().sort((a, b) => {
32
- const result = a.id.localeCompare(b.id);
33
- return direction === "asc" ? result : -result;
34
- });
35
- };
36
- const makeResponse = (bundle, status) => ({
37
- id: bundle.id,
38
- message: bundle.message,
39
- shouldForceUpdate: status === "ROLLBACK" ? true : bundle.shouldForceUpdate,
40
- status,
41
- storageUri: bundle.storageUri,
42
- fileHash: bundle.fileHash
43
- });
44
- const INIT_BUNDLE_ROLLBACK_UPDATE_INFO = {
45
- message: null,
46
- id: _hot_updater_core.NIL_UUID,
47
- shouldForceUpdate: true,
48
- status: "ROLLBACK",
49
- storageUri: null,
50
- fileHash: null
51
- };
52
- function createPluginDatabaseCore(getPlugin, resolveFileUrl, options) {
53
- const coreOptions = options;
54
- const runWithMutationPlugin = async (operation) => {
55
- const plugin = coreOptions?.createMutationPlugin?.() ?? getPlugin();
56
- try {
57
- return await operation(plugin);
58
- } finally {
59
- if (coreOptions?.createMutationPlugin) await coreOptions.cleanupMutationPlugin?.(plugin);
60
- }
61
- };
62
- const getSortedBundlePage = async (options, context) => {
63
- const result = await getPlugin().getBundles({
64
- ...options,
65
- orderBy: options.orderBy ?? DESC_ORDER
66
- }, context);
67
- return {
68
- ...result,
69
- data: sortBundles(result.data, options.orderBy ?? DESC_ORDER)
70
- };
71
- };
72
- const isEligibleForUpdate = (bundle, cohort) => {
73
- return (0, _hot_updater_core.isCohortEligibleForUpdate)(bundle.id, cohort, bundle.rolloutCohortCount, bundle.targetCohorts);
74
- };
75
- const findUpdateInfoByScanning = async ({ args, queryWhere, isCandidate, context }) => {
76
- let after;
77
- while (true) {
78
- const { data, pagination } = await getSortedBundlePage({
79
- where: queryWhere,
80
- limit: PAGE_SIZE,
81
- orderBy: DESC_ORDER,
82
- ...after ? { cursor: { after } } : {}
83
- }, context);
84
- for (const bundle of data) {
85
- if (!bundleMatchesQueryWhere(bundle, queryWhere) || !isCandidate(bundle)) continue;
86
- if (args.bundleId === _hot_updater_core.NIL_UUID) {
87
- if (isEligibleForUpdate(bundle, args.cohort)) return makeResponse(bundle, "UPDATE");
88
- continue;
89
- }
90
- const compareResult = bundle.id.localeCompare(args.bundleId);
91
- if (compareResult > 0) {
92
- if (isEligibleForUpdate(bundle, args.cohort)) return makeResponse(bundle, "UPDATE");
93
- continue;
94
- }
95
- if (compareResult === 0) {
96
- if (isEligibleForUpdate(bundle, args.cohort)) return null;
97
- continue;
98
- }
99
- return makeResponse(bundle, "ROLLBACK");
100
- }
101
- if (!pagination.hasNextPage) break;
102
- after = data.at(-1)?.id;
103
- if (!after) break;
104
- }
105
- if (args.bundleId === _hot_updater_core.NIL_UUID) return null;
106
- if (args.minBundleId && args.bundleId.localeCompare(args.minBundleId) <= 0) return null;
107
- return INIT_BUNDLE_ROLLBACK_UPDATE_INFO;
108
- };
109
- const getBaseWhere = ({ platform, channel, minBundleId }) => ({
110
- platform,
111
- channel,
112
- enabled: true,
113
- id: { gte: minBundleId }
114
- });
115
- return {
116
- api: {
117
- async getBundleById(id, context) {
118
- await coreOptions?.beforeOperation?.();
119
- return getPlugin().getBundleById(id, context);
120
- },
121
- async getUpdateInfo(args, context) {
122
- await coreOptions?.beforeOperation?.();
123
- const directGetUpdateInfo = getPlugin().getUpdateInfo;
124
- if (directGetUpdateInfo) return context === void 0 ? await directGetUpdateInfo(args) : await directGetUpdateInfo(args, context);
125
- const channel = args.channel ?? "production";
126
- const minBundleId = args.minBundleId ?? _hot_updater_core.NIL_UUID;
127
- const baseWhere = getBaseWhere({
128
- platform: args.platform,
129
- channel,
130
- minBundleId
131
- });
132
- if (args._updateStrategy === "fingerprint") return findUpdateInfoByScanning({
133
- args,
134
- queryWhere: {
135
- ...baseWhere,
136
- fingerprintHash: args.fingerprintHash
137
- },
138
- context,
139
- isCandidate: (bundle) => {
140
- return bundle.enabled && bundle.platform === args.platform && bundle.channel === channel && bundle.id.localeCompare(minBundleId) >= 0 && bundle.fingerprintHash === args.fingerprintHash;
141
- }
142
- });
143
- return findUpdateInfoByScanning({
144
- args,
145
- queryWhere: { ...baseWhere },
146
- context,
147
- isCandidate: (bundle) => {
148
- return bundle.enabled && bundle.platform === args.platform && bundle.channel === channel && bundle.id.localeCompare(minBundleId) >= 0 && !!bundle.targetAppVersion && (0, _hot_updater_plugin_core.semverSatisfies)(bundle.targetAppVersion, args.appVersion);
149
- }
150
- });
151
- },
152
- async getAppUpdateInfo(args, context) {
153
- const info = await this.getUpdateInfo(args, context);
154
- if (!info) return null;
155
- const { storageUri, ...rest } = info;
156
- const readStorageText = coreOptions?.readStorageText;
157
- if (info.id === _hot_updater_core.NIL_UUID || !readStorageText) {
158
- const fileUrl = await resolveFileUrl(storageUri ?? null, context);
159
- return {
160
- ...rest,
161
- fileUrl
162
- };
163
- }
164
- const requestBundles = (0, _hot_updater_plugin_core.createRequestUpdateBundleResolver)(context);
165
- const getCurrentBundle = () => {
166
- if (args.bundleId === _hot_updater_core.NIL_UUID) return null;
167
- const seededCurrentBundle = requestBundles.peek(args.bundleId);
168
- if (seededCurrentBundle || requestBundles.hasSeededBundles()) return seededCurrentBundle;
169
- return requestBundles.getById(args.bundleId, () => getPlugin().getBundleById(args.bundleId, context));
170
- };
171
- const [fileUrl, targetBundle, currentBundle] = await Promise.all([
172
- resolveFileUrl(storageUri ?? null, context),
173
- requestBundles.getById(info.id, () => getPlugin().getBundleById(info.id, context)),
174
- getCurrentBundle()
175
- ]);
176
- const baseResponse = {
177
- ...rest,
178
- fileUrl
179
- };
180
- const manifestArtifacts = await require_updateArtifacts.resolveManifestArtifacts({
181
- currentBundle,
182
- resolveFileUrl,
183
- readStorageText,
184
- targetBundle,
185
- context
186
- });
187
- if (!manifestArtifacts) return baseResponse;
188
- return {
189
- ...baseResponse,
190
- ...manifestArtifacts
191
- };
192
- },
193
- async getChannels(context) {
194
- await coreOptions?.beforeOperation?.();
195
- return getPlugin().getChannels(context);
196
- },
197
- async getBundles(options, context) {
198
- await coreOptions?.beforeOperation?.();
199
- return getPlugin().getBundles(options, context);
200
- },
201
- async insertBundle(bundle, context) {
202
- await coreOptions?.beforeOperation?.();
203
- require_schemaEnhancements.assertBundlePersistenceConstraints(bundle);
204
- await runWithMutationPlugin(async (plugin) => {
205
- await plugin.appendBundle(bundle, context);
206
- await plugin.commitBundle(context);
207
- });
208
- },
209
- async updateBundleById(bundleId, newBundle, context) {
210
- await coreOptions?.beforeOperation?.();
211
- await runWithMutationPlugin(async (plugin) => {
212
- const current = await plugin.getBundleById(bundleId, context);
213
- if (!current) throw new Error("targetBundleId not found");
214
- require_schemaEnhancements.assertBundlePersistenceConstraints({
215
- ...current,
216
- ...newBundle
217
- });
218
- await plugin.updateBundle(bundleId, newBundle, context);
219
- await plugin.commitBundle(context);
220
- });
221
- },
222
- async deleteBundleById(bundleId, context) {
223
- await coreOptions?.beforeOperation?.();
224
- await runWithMutationPlugin(async (plugin) => {
225
- const bundle = await plugin.getBundleById(bundleId, context);
226
- if (!bundle) return;
227
- await plugin.deleteBundle(bundle, context);
228
- await plugin.commitBundle(context);
229
- });
230
- }
231
- },
232
- adapterName: getPlugin().name,
233
- createMigrator: () => {
234
- throw new Error("createMigrator is only available for Kysely/MongoDB database adapters.");
235
- },
236
- generateSchema: () => {
237
- throw new Error("generateSchema is only available for Drizzle/Prisma database adapters.");
238
- }
239
- };
240
- }
241
- //#endregion
242
- exports.createPluginDatabaseCore = createPluginDatabaseCore;