@fett/sql-translator 0.0.1-beta

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 (199) hide show
  1. package/README.md +191 -0
  2. package/lib/client/client.d.ts +59 -0
  3. package/lib/client/client.d.ts.map +1 -0
  4. package/lib/client/client.js +201 -0
  5. package/lib/client/client.js.map +1 -0
  6. package/lib/client/index.d.ts +15 -0
  7. package/lib/client/index.d.ts.map +1 -0
  8. package/lib/client/index.js +15 -0
  9. package/lib/client/index.js.map +1 -0
  10. package/lib/client/manager.d.ts +27 -0
  11. package/lib/client/manager.d.ts.map +1 -0
  12. package/lib/client/manager.js +73 -0
  13. package/lib/client/manager.js.map +1 -0
  14. package/lib/client/registry.d.ts +31 -0
  15. package/lib/client/registry.d.ts.map +1 -0
  16. package/lib/client/registry.js +128 -0
  17. package/lib/client/registry.js.map +1 -0
  18. package/lib/core/cache.d.ts +28 -0
  19. package/lib/core/cache.d.ts.map +1 -0
  20. package/lib/core/cache.js +58 -0
  21. package/lib/core/cache.js.map +1 -0
  22. package/lib/core/config.d.ts +16 -0
  23. package/lib/core/config.d.ts.map +1 -0
  24. package/lib/core/config.js +47 -0
  25. package/lib/core/config.js.map +1 -0
  26. package/lib/core/field-mapper/mysql.d.ts +42 -0
  27. package/lib/core/field-mapper/mysql.d.ts.map +1 -0
  28. package/lib/core/field-mapper/mysql.js +129 -0
  29. package/lib/core/field-mapper/mysql.js.map +1 -0
  30. package/lib/core/field-mapper/postgresql.d.ts +25 -0
  31. package/lib/core/field-mapper/postgresql.d.ts.map +1 -0
  32. package/lib/core/field-mapper/postgresql.js +121 -0
  33. package/lib/core/field-mapper/postgresql.js.map +1 -0
  34. package/lib/core/sql/normalize.d.ts +10 -0
  35. package/lib/core/sql/normalize.d.ts.map +1 -0
  36. package/lib/core/sql/normalize.js +121 -0
  37. package/lib/core/sql/normalize.js.map +1 -0
  38. package/lib/core/sql/pagination.d.ts +22 -0
  39. package/lib/core/sql/pagination.d.ts.map +1 -0
  40. package/lib/core/sql/pagination.js +61 -0
  41. package/lib/core/sql/pagination.js.map +1 -0
  42. package/lib/core/sql/statement.d.ts +28 -0
  43. package/lib/core/sql/statement.d.ts.map +1 -0
  44. package/lib/core/sql/statement.js +155 -0
  45. package/lib/core/sql/statement.js.map +1 -0
  46. package/lib/core/sql/table-mapper.d.ts +24 -0
  47. package/lib/core/sql/table-mapper.d.ts.map +1 -0
  48. package/lib/core/sql/table-mapper.js +113 -0
  49. package/lib/core/sql/table-mapper.js.map +1 -0
  50. package/lib/core/task-queue.d.ts +31 -0
  51. package/lib/core/task-queue.d.ts.map +1 -0
  52. package/lib/core/task-queue.js +185 -0
  53. package/lib/core/task-queue.js.map +1 -0
  54. package/lib/core/worker/bun-worker.d.ts +21 -0
  55. package/lib/core/worker/bun-worker.d.ts.map +1 -0
  56. package/lib/core/worker/bun-worker.js +93 -0
  57. package/lib/core/worker/bun-worker.js.map +1 -0
  58. package/lib/core/worker/index.d.ts +16 -0
  59. package/lib/core/worker/index.d.ts.map +1 -0
  60. package/lib/core/worker/index.js +16 -0
  61. package/lib/core/worker/index.js.map +1 -0
  62. package/lib/core/worker/node-worker.d.ts +19 -0
  63. package/lib/core/worker/node-worker.d.ts.map +1 -0
  64. package/lib/core/worker/node-worker.js +94 -0
  65. package/lib/core/worker/node-worker.js.map +1 -0
  66. package/lib/core/worker/task-runner-bun.d.ts +2 -0
  67. package/lib/core/worker/task-runner-bun.d.ts.map +1 -0
  68. package/lib/core/worker/task-runner-bun.js +18 -0
  69. package/lib/core/worker/task-runner-bun.js.map +1 -0
  70. package/lib/core/worker/task-runner.d.ts +2 -0
  71. package/lib/core/worker/task-runner.d.ts.map +1 -0
  72. package/lib/core/worker/task-runner.js +21 -0
  73. package/lib/core/worker/task-runner.js.map +1 -0
  74. package/lib/driver/index.d.ts +3 -0
  75. package/lib/driver/index.d.ts.map +1 -0
  76. package/lib/driver/index.js +16 -0
  77. package/lib/driver/index.js.map +1 -0
  78. package/lib/driver/interface.d.ts +39 -0
  79. package/lib/driver/interface.d.ts.map +1 -0
  80. package/lib/driver/interface.js +2 -0
  81. package/lib/driver/interface.js.map +1 -0
  82. package/lib/driver/mongodb/dml-translator.d.ts +21 -0
  83. package/lib/driver/mongodb/dml-translator.d.ts.map +1 -0
  84. package/lib/driver/mongodb/dml-translator.js +127 -0
  85. package/lib/driver/mongodb/dml-translator.js.map +1 -0
  86. package/lib/driver/mongodb/index.d.ts +27 -0
  87. package/lib/driver/mongodb/index.d.ts.map +1 -0
  88. package/lib/driver/mongodb/index.js +263 -0
  89. package/lib/driver/mongodb/index.js.map +1 -0
  90. package/lib/driver/mongodb/pool.d.ts +31 -0
  91. package/lib/driver/mongodb/pool.d.ts.map +1 -0
  92. package/lib/driver/mongodb/pool.js +96 -0
  93. package/lib/driver/mongodb/pool.js.map +1 -0
  94. package/lib/driver/mongodb/schema.d.ts +37 -0
  95. package/lib/driver/mongodb/schema.d.ts.map +1 -0
  96. package/lib/driver/mongodb/schema.js +238 -0
  97. package/lib/driver/mongodb/schema.js.map +1 -0
  98. package/lib/driver/mongodb/sql-translator.d.ts +19 -0
  99. package/lib/driver/mongodb/sql-translator.d.ts.map +1 -0
  100. package/lib/driver/mongodb/sql-translator.js +30 -0
  101. package/lib/driver/mongodb/sql-translator.js.map +1 -0
  102. package/lib/driver/mysql/index.d.ts +41 -0
  103. package/lib/driver/mysql/index.d.ts.map +1 -0
  104. package/lib/driver/mysql/index.js +338 -0
  105. package/lib/driver/mysql/index.js.map +1 -0
  106. package/lib/driver/mysql/pool.d.ts +46 -0
  107. package/lib/driver/mysql/pool.d.ts.map +1 -0
  108. package/lib/driver/mysql/pool.js +141 -0
  109. package/lib/driver/mysql/pool.js.map +1 -0
  110. package/lib/driver/mysql/version.d.ts +27 -0
  111. package/lib/driver/mysql/version.d.ts.map +1 -0
  112. package/lib/driver/mysql/version.js +77 -0
  113. package/lib/driver/mysql/version.js.map +1 -0
  114. package/lib/driver/postgresql/index.d.ts +34 -0
  115. package/lib/driver/postgresql/index.d.ts.map +1 -0
  116. package/lib/driver/postgresql/index.js +383 -0
  117. package/lib/driver/postgresql/index.js.map +1 -0
  118. package/lib/driver/postgresql/pool.d.ts +33 -0
  119. package/lib/driver/postgresql/pool.d.ts.map +1 -0
  120. package/lib/driver/postgresql/pool.js +104 -0
  121. package/lib/driver/postgresql/pool.js.map +1 -0
  122. package/lib/driver/registry.d.ts +16 -0
  123. package/lib/driver/registry.d.ts.map +1 -0
  124. package/lib/driver/registry.js +27 -0
  125. package/lib/driver/registry.js.map +1 -0
  126. package/lib/driver/sqlite/backend.d.ts +19 -0
  127. package/lib/driver/sqlite/backend.d.ts.map +1 -0
  128. package/lib/driver/sqlite/backend.js +5 -0
  129. package/lib/driver/sqlite/backend.js.map +1 -0
  130. package/lib/driver/sqlite/bun.d.ts +10 -0
  131. package/lib/driver/sqlite/bun.d.ts.map +1 -0
  132. package/lib/driver/sqlite/bun.js +36 -0
  133. package/lib/driver/sqlite/bun.js.map +1 -0
  134. package/lib/driver/sqlite/index.d.ts +49 -0
  135. package/lib/driver/sqlite/index.d.ts.map +1 -0
  136. package/lib/driver/sqlite/index.js +421 -0
  137. package/lib/driver/sqlite/index.js.map +1 -0
  138. package/lib/driver/sqlite/node.d.ts +10 -0
  139. package/lib/driver/sqlite/node.d.ts.map +1 -0
  140. package/lib/driver/sqlite/node.js +37 -0
  141. package/lib/driver/sqlite/node.js.map +1 -0
  142. package/lib/driver/sqlite/store.d.ts +13 -0
  143. package/lib/driver/sqlite/store.d.ts.map +1 -0
  144. package/lib/driver/sqlite/store.js +57 -0
  145. package/lib/driver/sqlite/store.js.map +1 -0
  146. package/lib/errors.d.ts +18 -0
  147. package/lib/errors.d.ts.map +1 -0
  148. package/lib/errors.js +24 -0
  149. package/lib/errors.js.map +1 -0
  150. package/lib/facade/engine.d.ts +29 -0
  151. package/lib/facade/engine.d.ts.map +1 -0
  152. package/lib/facade/engine.js +107 -0
  153. package/lib/facade/engine.js.map +1 -0
  154. package/lib/index.d.ts +41 -0
  155. package/lib/index.d.ts.map +1 -0
  156. package/lib/index.js +40 -0
  157. package/lib/index.js.map +1 -0
  158. package/lib/optional/static-source.d.ts +36 -0
  159. package/lib/optional/static-source.d.ts.map +1 -0
  160. package/lib/optional/static-source.js +141 -0
  161. package/lib/optional/static-source.js.map +1 -0
  162. package/lib/runtime.d.ts +12 -0
  163. package/lib/runtime.d.ts.map +1 -0
  164. package/lib/runtime.js +26 -0
  165. package/lib/runtime.js.map +1 -0
  166. package/lib/types/config.d.ts +146 -0
  167. package/lib/types/config.d.ts.map +1 -0
  168. package/lib/types/config.js +5 -0
  169. package/lib/types/config.js.map +1 -0
  170. package/lib/types/index.d.ts +7 -0
  171. package/lib/types/index.d.ts.map +1 -0
  172. package/lib/types/index.js +7 -0
  173. package/lib/types/index.js.map +1 -0
  174. package/lib/types/manager.d.ts +37 -0
  175. package/lib/types/manager.d.ts.map +1 -0
  176. package/lib/types/manager.js +5 -0
  177. package/lib/types/manager.js.map +1 -0
  178. package/lib/types/queue.d.ts +45 -0
  179. package/lib/types/queue.d.ts.map +1 -0
  180. package/lib/types/queue.js +5 -0
  181. package/lib/types/queue.js.map +1 -0
  182. package/lib/types/result.d.ts +61 -0
  183. package/lib/types/result.d.ts.map +1 -0
  184. package/lib/types/result.js +16 -0
  185. package/lib/types/result.js.map +1 -0
  186. package/lib/types/schema.d.ts +51 -0
  187. package/lib/types/schema.d.ts.map +1 -0
  188. package/lib/types/schema.js +5 -0
  189. package/lib/types/schema.js.map +1 -0
  190. package/lib/types/task.d.ts +48 -0
  191. package/lib/types/task.d.ts.map +1 -0
  192. package/lib/types/task.js +136 -0
  193. package/lib/types/task.js.map +1 -0
  194. package/lib/types/transaction.d.ts +13 -0
  195. package/lib/types/transaction.d.ts.map +1 -0
  196. package/lib/types/transaction.js +2 -0
  197. package/lib/types/transaction.js.map +1 -0
  198. package/package.json +93 -0
  199. package/patches/bson@7.3.2.patch +105 -0
@@ -0,0 +1,105 @@
1
+ diff --git a/lib/bson.bundle.js b/lib/bson.bundle.js
2
+ index a2b81106635cd009d5ed3c90d33bfb544ca542a9..ea0f5fa063f1e54f24e8ae3d231b03f507858f2c 100644
3
+ --- a/lib/bson.bundle.js
4
+ +++ b/lib/bson.bundle.js
5
+ @@ -2617,9 +2617,14 @@ class ObjectId extends BSONValue {
6
+ };
7
+ static {
8
+ this.resetState();
9
+ - const { startupSnapshot } = globalThis?.process?.getBuiltinModule?.('v8') ?? {};
10
+ - if (startupSnapshot?.isBuildingSnapshot?.()) {
11
+ + // [sql-translator patch] Bun 未实现 node:v8 startupSnapshot,加 try/catch 兼容
12
+ + try {
13
+ + const { startupSnapshot } = globalThis?.process?.getBuiltinModule?.('v8') ?? {};
14
+ + if (startupSnapshot?.isBuildingSnapshot?.()) {
15
+ startupSnapshot?.addDeserializeCallback?.(this.resetState);
16
+ + }
17
+ + } catch {
18
+ + // Bun 等运行时未实现 v8 startupSnapshot,忽略
19
+ }
20
+ }
21
+ static cacheHexString;
22
+ diff --git a/lib/bson.cjs b/lib/bson.cjs
23
+ index 6743a3210ac3d2eec51ce4b9c763d551a35c2ec9..f01b19f5ab1c10154ce9d55e3b283cdf7a852ea4 100644
24
+ --- a/lib/bson.cjs
25
+ +++ b/lib/bson.cjs
26
+ @@ -2616,9 +2616,14 @@ class ObjectId extends BSONValue {
27
+ };
28
+ static {
29
+ this.resetState();
30
+ - const { startupSnapshot } = globalThis?.process?.getBuiltinModule?.('v8') ?? {};
31
+ - if (startupSnapshot?.isBuildingSnapshot?.()) {
32
+ + // [sql-translator patch] Bun 兼容:node:v8 startupSnapshot 未实现时忽略
33
+ + try {
34
+ + const { startupSnapshot } = globalThis?.process?.getBuiltinModule?.('v8') ?? {};
35
+ + if (startupSnapshot?.isBuildingSnapshot?.()) {
36
+ startupSnapshot?.addDeserializeCallback?.(this.resetState);
37
+ + }
38
+ + } catch {
39
+ + // ignore
40
+ }
41
+ }
42
+ static cacheHexString;
43
+ diff --git a/lib/bson.mjs b/lib/bson.mjs
44
+ index 9555e4a71bedc22425f3f07b4ed724ef0c22bfd4..926adb087e8e9856b0a1b8d1dfd1b07a4cf255bc 100644
45
+ --- a/lib/bson.mjs
46
+ +++ b/lib/bson.mjs
47
+ @@ -2614,9 +2614,14 @@ class ObjectId extends BSONValue {
48
+ };
49
+ static {
50
+ this.resetState();
51
+ - const { startupSnapshot } = globalThis?.process?.getBuiltinModule?.('v8') ?? {};
52
+ - if (startupSnapshot?.isBuildingSnapshot?.()) {
53
+ + // [sql-translator patch] Bun 兼容:node:v8 startupSnapshot 未实现时忽略
54
+ + try {
55
+ + const { startupSnapshot } = globalThis?.process?.getBuiltinModule?.('v8') ?? {};
56
+ + if (startupSnapshot?.isBuildingSnapshot?.()) {
57
+ startupSnapshot?.addDeserializeCallback?.(this.resetState);
58
+ + }
59
+ + } catch {
60
+ + // ignore
61
+ }
62
+ }
63
+ static cacheHexString;
64
+ diff --git a/lib/bson.node.mjs b/lib/bson.node.mjs
65
+ index a0f9695d9bbe62942114b01302990501debb26a1..827c1783daa7e6cc51464e50ccdd4752b5ede956 100644
66
+ --- a/lib/bson.node.mjs
67
+ +++ b/lib/bson.node.mjs
68
+ @@ -2614,9 +2614,14 @@ class ObjectId extends BSONValue {
69
+ };
70
+ static {
71
+ this.resetState();
72
+ - const { startupSnapshot } = globalThis?.process?.getBuiltinModule?.('v8') ?? {};
73
+ - if (startupSnapshot?.isBuildingSnapshot?.()) {
74
+ + // [sql-translator patch] Bun 兼容:node:v8 startupSnapshot 未实现时忽略
75
+ + try {
76
+ + const { startupSnapshot } = globalThis?.process?.getBuiltinModule?.('v8') ?? {};
77
+ + if (startupSnapshot?.isBuildingSnapshot?.()) {
78
+ startupSnapshot?.addDeserializeCallback?.(this.resetState);
79
+ + }
80
+ + } catch {
81
+ + // ignore
82
+ }
83
+ }
84
+ static cacheHexString;
85
+ diff --git a/lib/bson.rn.cjs b/lib/bson.rn.cjs
86
+ index 91c72452a937e6cd5c07c548c6729847f6d4712c..027b97f6b57462e484237d9a8b4c8a330926c315 100644
87
+ --- a/lib/bson.rn.cjs
88
+ +++ b/lib/bson.rn.cjs
89
+ @@ -2624,9 +2624,14 @@ class ObjectId extends BSONValue {
90
+ };
91
+ static {
92
+ this.resetState();
93
+ - const { startupSnapshot } = globalThis?.process?.getBuiltinModule?.('v8') ?? {};
94
+ - if (startupSnapshot?.isBuildingSnapshot?.()) {
95
+ + // [sql-translator patch] Bun 兼容:node:v8 startupSnapshot 未实现时忽略
96
+ + try {
97
+ + const { startupSnapshot } = globalThis?.process?.getBuiltinModule?.('v8') ?? {};
98
+ + if (startupSnapshot?.isBuildingSnapshot?.()) {
99
+ startupSnapshot?.addDeserializeCallback?.(this.resetState);
100
+ + }
101
+ + } catch {
102
+ + // ignore
103
+ }
104
+ }
105
+ static cacheHexString;