@pome-sh/cli 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (471) hide show
  1. package/dist/build-info.json +3 -3
  2. package/dist/src/doctor/checks.js +2 -2
  3. package/node_modules/@pome-sh/sdk/dist/db.d.ts +4 -4
  4. package/node_modules/@pome-sh/sdk/dist/db.js +93 -25
  5. package/node_modules/@pome-sh/sdk/dist/db.js.map +1 -1
  6. package/node_modules/@pome-sh/sdk/package.json +2 -6
  7. package/node_modules/@pome-sh/twin-github/README.md +2 -1
  8. package/node_modules/@pome-sh/twin-github/package.json +2 -3
  9. package/node_modules/@pome-sh/twin-slack/package.json +2 -3
  10. package/node_modules/@pome-sh/twin-stripe/README.md +2 -2
  11. package/node_modules/@pome-sh/twin-stripe/package.json +2 -3
  12. package/package.json +6 -7
  13. package/dist/src/recorder/verdictArtifact.d.ts +0 -71
  14. package/dist/src/recorder/verdictArtifact.js +0 -207
  15. package/dist/src/score/view.d.ts +0 -38
  16. package/dist/src/score/view.js +0 -59
  17. package/dist/src/twin/github/app.d.ts +0 -10
  18. package/dist/src/twin/github/app.js +0 -316
  19. package/dist/src/twin/github/db/migrations.d.ts +0 -2
  20. package/dist/src/twin/github/db/migrations.js +0 -64
  21. package/dist/src/twin/github/db/openDatabase.d.ts +0 -2
  22. package/dist/src/twin/github/db/openDatabase.js +0 -13
  23. package/dist/src/twin/github/db/queries.d.ts +0 -77
  24. package/dist/src/twin/github/db/queries.js +0 -93
  25. package/dist/src/twin/github/domain/seed.d.ts +0 -74
  26. package/dist/src/twin/github/domain/seed.js +0 -104
  27. package/dist/src/twin/github/domain/serializers.d.ts +0 -113
  28. package/dist/src/twin/github/domain/serializers.js +0 -76
  29. package/dist/src/twin/github/types.d.ts +0 -66
  30. package/dist/src/twin/github/types.js +0 -1
  31. package/dist/src/twin-github/app.d.ts +0 -9
  32. package/dist/src/twin-github/app.js +0 -327
  33. package/dist/src/twin-github/auth.d.ts +0 -16
  34. package/dist/src/twin-github/auth.js +0 -142
  35. package/dist/src/twin-github/build-info.d.ts +0 -7
  36. package/dist/src/twin-github/build-info.js +0 -52
  37. package/dist/src/twin-github/db.d.ts +0 -4
  38. package/dist/src/twin-github/db.js +0 -362
  39. package/dist/src/twin-github/domain.d.ts +0 -1649
  40. package/dist/src/twin-github/domain.js +0 -957
  41. package/dist/src/twin-github/errors.d.ts +0 -14
  42. package/dist/src/twin-github/errors.js +0 -34
  43. package/dist/src/twin-github/index.d.ts +0 -9
  44. package/dist/src/twin-github/index.js +0 -7
  45. package/dist/src/twin-github/mcp.d.ts +0 -17
  46. package/dist/src/twin-github/mcp.js +0 -281
  47. package/dist/src/twin-github/recorder.d.ts +0 -2
  48. package/dist/src/twin-github/recorder.js +0 -29
  49. package/dist/src/twin-github/seed.d.ts +0 -74
  50. package/dist/src/twin-github/seed.js +0 -107
  51. package/dist/src/twin-github/serializers.d.ts +0 -449
  52. package/dist/src/twin-github/serializers.js +0 -429
  53. package/dist/src/twin-github/server.d.ts +0 -1
  54. package/dist/src/twin-github/server.js +0 -34
  55. package/dist/src/twin-github/tools.d.ts +0 -1545
  56. package/dist/src/twin-github/tools.js +0 -347
  57. package/dist/src/twin-github/types.d.ts +0 -198
  58. package/dist/src/twin-github/types.js +0 -1
  59. package/dist/src/twin-github/unsupported-envelope.d.ts +0 -10
  60. package/dist/src/twin-github/unsupported-envelope.js +0 -29
  61. package/dist/src/twin-github/util.d.ts +0 -13
  62. package/dist/src/twin-github/util.js +0 -61
  63. package/dist/src/twin-slack/app.d.ts +0 -17
  64. package/dist/src/twin-slack/app.js +0 -683
  65. package/dist/src/twin-slack/auth.d.ts +0 -38
  66. package/dist/src/twin-slack/auth.js +0 -219
  67. package/dist/src/twin-slack/build-info.d.ts +0 -7
  68. package/dist/src/twin-slack/build-info.js +0 -9
  69. package/dist/src/twin-slack/db.d.ts +0 -4
  70. package/dist/src/twin-slack/db.js +0 -213
  71. package/dist/src/twin-slack/domain.d.ts +0 -236
  72. package/dist/src/twin-slack/domain.js +0 -1293
  73. package/dist/src/twin-slack/errors.d.ts +0 -16
  74. package/dist/src/twin-slack/errors.js +0 -60
  75. package/dist/src/twin-slack/index.d.ts +0 -8
  76. package/dist/src/twin-slack/index.js +0 -8
  77. package/dist/src/twin-slack/mcp.d.ts +0 -17
  78. package/dist/src/twin-slack/mcp.js +0 -226
  79. package/dist/src/twin-slack/recorder.d.ts +0 -2
  80. package/dist/src/twin-slack/recorder.js +0 -15
  81. package/dist/src/twin-slack/seed.d.ts +0 -49
  82. package/dist/src/twin-slack/seed.js +0 -139
  83. package/dist/src/twin-slack/serializers.d.ts +0 -141
  84. package/dist/src/twin-slack/serializers.js +0 -377
  85. package/dist/src/twin-slack/tools.d.ts +0 -97
  86. package/dist/src/twin-slack/tools.js +0 -171
  87. package/dist/src/twin-slack/types.d.ts +0 -164
  88. package/dist/src/twin-slack/types.js +0 -1
  89. package/dist/src/twin-slack/unsupported-envelope.d.ts +0 -12
  90. package/dist/src/twin-slack/unsupported-envelope.js +0 -61
  91. package/dist/src/twin-slack/upstream-types.d.ts +0 -19
  92. package/dist/src/twin-slack/upstream-types.js +0 -1
  93. package/dist/src/twin-slack/util.d.ts +0 -31
  94. package/dist/src/twin-slack/util.js +0 -136
  95. package/node_modules/base64-js/LICENSE +0 -21
  96. package/node_modules/base64-js/README.md +0 -34
  97. package/node_modules/base64-js/base64js.min.js +0 -1
  98. package/node_modules/base64-js/index.d.ts +0 -3
  99. package/node_modules/base64-js/index.js +0 -150
  100. package/node_modules/base64-js/package.json +0 -47
  101. package/node_modules/better-sqlite3/LICENSE +0 -21
  102. package/node_modules/better-sqlite3/README.md +0 -99
  103. package/node_modules/better-sqlite3/binding.gyp +0 -38
  104. package/node_modules/better-sqlite3/build/Release/better_sqlite3.node +0 -0
  105. package/node_modules/better-sqlite3/deps/common.gypi +0 -68
  106. package/node_modules/better-sqlite3/deps/copy.js +0 -31
  107. package/node_modules/better-sqlite3/deps/defines.gypi +0 -42
  108. package/node_modules/better-sqlite3/deps/download.sh +0 -123
  109. package/node_modules/better-sqlite3/deps/patches/1208.patch +0 -15
  110. package/node_modules/better-sqlite3/deps/sqlite3/sqlite3.c +0 -269395
  111. package/node_modules/better-sqlite3/deps/sqlite3/sqlite3.h +0 -14347
  112. package/node_modules/better-sqlite3/deps/sqlite3/sqlite3ext.h +0 -739
  113. package/node_modules/better-sqlite3/deps/sqlite3.gyp +0 -80
  114. package/node_modules/better-sqlite3/deps/test_extension.c +0 -21
  115. package/node_modules/better-sqlite3/lib/database.js +0 -90
  116. package/node_modules/better-sqlite3/lib/index.js +0 -3
  117. package/node_modules/better-sqlite3/lib/methods/aggregate.js +0 -43
  118. package/node_modules/better-sqlite3/lib/methods/backup.js +0 -67
  119. package/node_modules/better-sqlite3/lib/methods/function.js +0 -31
  120. package/node_modules/better-sqlite3/lib/methods/inspect.js +0 -7
  121. package/node_modules/better-sqlite3/lib/methods/pragma.js +0 -12
  122. package/node_modules/better-sqlite3/lib/methods/serialize.js +0 -16
  123. package/node_modules/better-sqlite3/lib/methods/table.js +0 -189
  124. package/node_modules/better-sqlite3/lib/methods/transaction.js +0 -78
  125. package/node_modules/better-sqlite3/lib/methods/wrappers.js +0 -54
  126. package/node_modules/better-sqlite3/lib/sqlite-error.js +0 -20
  127. package/node_modules/better-sqlite3/lib/util.js +0 -12
  128. package/node_modules/better-sqlite3/package.json +0 -59
  129. package/node_modules/better-sqlite3/src/addon.cpp +0 -47
  130. package/node_modules/better-sqlite3/src/better_sqlite3.cpp +0 -74
  131. package/node_modules/better-sqlite3/src/objects/backup.cpp +0 -120
  132. package/node_modules/better-sqlite3/src/objects/backup.hpp +0 -36
  133. package/node_modules/better-sqlite3/src/objects/database.cpp +0 -417
  134. package/node_modules/better-sqlite3/src/objects/database.hpp +0 -103
  135. package/node_modules/better-sqlite3/src/objects/statement-iterator.cpp +0 -113
  136. package/node_modules/better-sqlite3/src/objects/statement-iterator.hpp +0 -50
  137. package/node_modules/better-sqlite3/src/objects/statement.cpp +0 -383
  138. package/node_modules/better-sqlite3/src/objects/statement.hpp +0 -58
  139. package/node_modules/better-sqlite3/src/util/bind-map.cpp +0 -73
  140. package/node_modules/better-sqlite3/src/util/binder.cpp +0 -193
  141. package/node_modules/better-sqlite3/src/util/constants.cpp +0 -172
  142. package/node_modules/better-sqlite3/src/util/custom-aggregate.cpp +0 -121
  143. package/node_modules/better-sqlite3/src/util/custom-function.cpp +0 -59
  144. package/node_modules/better-sqlite3/src/util/custom-table.cpp +0 -409
  145. package/node_modules/better-sqlite3/src/util/data-converter.cpp +0 -17
  146. package/node_modules/better-sqlite3/src/util/data.cpp +0 -194
  147. package/node_modules/better-sqlite3/src/util/helpers.cpp +0 -109
  148. package/node_modules/better-sqlite3/src/util/macros.cpp +0 -90
  149. package/node_modules/better-sqlite3/src/util/query-macros.cpp +0 -71
  150. package/node_modules/better-sqlite3/src/util/row-builder.cpp +0 -49
  151. package/node_modules/bindings/LICENSE.md +0 -22
  152. package/node_modules/bindings/README.md +0 -98
  153. package/node_modules/bindings/bindings.js +0 -221
  154. package/node_modules/bindings/package.json +0 -28
  155. package/node_modules/bl/.travis.yml +0 -17
  156. package/node_modules/bl/BufferList.js +0 -396
  157. package/node_modules/bl/LICENSE.md +0 -13
  158. package/node_modules/bl/README.md +0 -247
  159. package/node_modules/bl/bl.js +0 -84
  160. package/node_modules/bl/package.json +0 -37
  161. package/node_modules/bl/test/convert.js +0 -21
  162. package/node_modules/bl/test/indexOf.js +0 -492
  163. package/node_modules/bl/test/isBufferList.js +0 -32
  164. package/node_modules/bl/test/test.js +0 -869
  165. package/node_modules/buffer/AUTHORS.md +0 -70
  166. package/node_modules/buffer/LICENSE +0 -21
  167. package/node_modules/buffer/README.md +0 -410
  168. package/node_modules/buffer/index.d.ts +0 -186
  169. package/node_modules/buffer/index.js +0 -1817
  170. package/node_modules/buffer/package.json +0 -96
  171. package/node_modules/chownr/LICENSE +0 -15
  172. package/node_modules/chownr/README.md +0 -3
  173. package/node_modules/chownr/chownr.js +0 -167
  174. package/node_modules/chownr/package.json +0 -29
  175. package/node_modules/decompress-response/index.d.ts +0 -22
  176. package/node_modules/decompress-response/index.js +0 -58
  177. package/node_modules/decompress-response/license +0 -9
  178. package/node_modules/decompress-response/package.json +0 -56
  179. package/node_modules/decompress-response/readme.md +0 -48
  180. package/node_modules/deep-extend/CHANGELOG.md +0 -46
  181. package/node_modules/deep-extend/LICENSE +0 -20
  182. package/node_modules/deep-extend/README.md +0 -91
  183. package/node_modules/deep-extend/index.js +0 -1
  184. package/node_modules/deep-extend/lib/deep-extend.js +0 -150
  185. package/node_modules/deep-extend/package.json +0 -62
  186. package/node_modules/detect-libc/LICENSE +0 -201
  187. package/node_modules/detect-libc/README.md +0 -163
  188. package/node_modules/detect-libc/index.d.ts +0 -14
  189. package/node_modules/detect-libc/lib/detect-libc.js +0 -313
  190. package/node_modules/detect-libc/lib/elf.js +0 -39
  191. package/node_modules/detect-libc/lib/filesystem.js +0 -51
  192. package/node_modules/detect-libc/lib/process.js +0 -24
  193. package/node_modules/detect-libc/package.json +0 -44
  194. package/node_modules/end-of-stream/LICENSE +0 -21
  195. package/node_modules/end-of-stream/README.md +0 -54
  196. package/node_modules/end-of-stream/index.js +0 -96
  197. package/node_modules/end-of-stream/package.json +0 -37
  198. package/node_modules/expand-template/.travis.yml +0 -6
  199. package/node_modules/expand-template/LICENSE +0 -21
  200. package/node_modules/expand-template/README.md +0 -43
  201. package/node_modules/expand-template/index.js +0 -26
  202. package/node_modules/expand-template/package.json +0 -29
  203. package/node_modules/expand-template/test.js +0 -67
  204. package/node_modules/file-uri-to-path/.npmignore +0 -1
  205. package/node_modules/file-uri-to-path/.travis.yml +0 -30
  206. package/node_modules/file-uri-to-path/History.md +0 -21
  207. package/node_modules/file-uri-to-path/LICENSE +0 -20
  208. package/node_modules/file-uri-to-path/README.md +0 -74
  209. package/node_modules/file-uri-to-path/index.d.ts +0 -2
  210. package/node_modules/file-uri-to-path/index.js +0 -66
  211. package/node_modules/file-uri-to-path/package.json +0 -32
  212. package/node_modules/file-uri-to-path/test/test.js +0 -24
  213. package/node_modules/file-uri-to-path/test/tests.json +0 -13
  214. package/node_modules/fs-constants/LICENSE +0 -21
  215. package/node_modules/fs-constants/README.md +0 -26
  216. package/node_modules/fs-constants/browser.js +0 -1
  217. package/node_modules/fs-constants/index.js +0 -1
  218. package/node_modules/fs-constants/package.json +0 -19
  219. package/node_modules/github-from-package/.travis.yml +0 -4
  220. package/node_modules/github-from-package/LICENSE +0 -18
  221. package/node_modules/github-from-package/example/package.json +0 -8
  222. package/node_modules/github-from-package/example/url.js +0 -3
  223. package/node_modules/github-from-package/index.js +0 -17
  224. package/node_modules/github-from-package/package.json +0 -30
  225. package/node_modules/github-from-package/readme.markdown +0 -53
  226. package/node_modules/github-from-package/test/a.json +0 -8
  227. package/node_modules/github-from-package/test/b.json +0 -5
  228. package/node_modules/github-from-package/test/c.json +0 -5
  229. package/node_modules/github-from-package/test/d.json +0 -7
  230. package/node_modules/github-from-package/test/e.json +0 -5
  231. package/node_modules/github-from-package/test/url.js +0 -19
  232. package/node_modules/ieee754/LICENSE +0 -11
  233. package/node_modules/ieee754/README.md +0 -51
  234. package/node_modules/ieee754/index.d.ts +0 -10
  235. package/node_modules/ieee754/index.js +0 -85
  236. package/node_modules/ieee754/package.json +0 -52
  237. package/node_modules/inherits/LICENSE +0 -16
  238. package/node_modules/inherits/README.md +0 -42
  239. package/node_modules/inherits/inherits.js +0 -9
  240. package/node_modules/inherits/inherits_browser.js +0 -27
  241. package/node_modules/inherits/package.json +0 -29
  242. package/node_modules/ini/LICENSE +0 -15
  243. package/node_modules/ini/README.md +0 -102
  244. package/node_modules/ini/ini.js +0 -206
  245. package/node_modules/ini/package.json +0 -33
  246. package/node_modules/mimic-response/index.d.ts +0 -17
  247. package/node_modules/mimic-response/index.js +0 -77
  248. package/node_modules/mimic-response/license +0 -9
  249. package/node_modules/mimic-response/package.json +0 -42
  250. package/node_modules/mimic-response/readme.md +0 -78
  251. package/node_modules/minimist/.eslintrc +0 -29
  252. package/node_modules/minimist/.github/FUNDING.yml +0 -12
  253. package/node_modules/minimist/.nycrc +0 -14
  254. package/node_modules/minimist/CHANGELOG.md +0 -298
  255. package/node_modules/minimist/LICENSE +0 -18
  256. package/node_modules/minimist/README.md +0 -121
  257. package/node_modules/minimist/example/parse.js +0 -4
  258. package/node_modules/minimist/index.js +0 -263
  259. package/node_modules/minimist/package.json +0 -75
  260. package/node_modules/minimist/test/all_bool.js +0 -34
  261. package/node_modules/minimist/test/bool.js +0 -177
  262. package/node_modules/minimist/test/dash.js +0 -43
  263. package/node_modules/minimist/test/default_bool.js +0 -37
  264. package/node_modules/minimist/test/dotted.js +0 -24
  265. package/node_modules/minimist/test/kv_short.js +0 -32
  266. package/node_modules/minimist/test/long.js +0 -33
  267. package/node_modules/minimist/test/num.js +0 -38
  268. package/node_modules/minimist/test/parse.js +0 -209
  269. package/node_modules/minimist/test/parse_modified.js +0 -11
  270. package/node_modules/minimist/test/proto.js +0 -64
  271. package/node_modules/minimist/test/short.js +0 -69
  272. package/node_modules/minimist/test/stop_early.js +0 -17
  273. package/node_modules/minimist/test/unknown.js +0 -104
  274. package/node_modules/minimist/test/whitespace.js +0 -10
  275. package/node_modules/mkdirp-classic/LICENSE +0 -21
  276. package/node_modules/mkdirp-classic/README.md +0 -18
  277. package/node_modules/mkdirp-classic/index.js +0 -98
  278. package/node_modules/mkdirp-classic/package.json +0 -18
  279. package/node_modules/napi-build-utils/.github/workflows/run-npm-tests.yml +0 -31
  280. package/node_modules/napi-build-utils/LICENSE +0 -21
  281. package/node_modules/napi-build-utils/README.md +0 -52
  282. package/node_modules/napi-build-utils/index.js +0 -214
  283. package/node_modules/napi-build-utils/index.md +0 -0
  284. package/node_modules/napi-build-utils/package.json +0 -42
  285. package/node_modules/node-abi/LICENSE +0 -21
  286. package/node_modules/node-abi/README.md +0 -54
  287. package/node_modules/node-abi/abi_registry.json +0 -453
  288. package/node_modules/node-abi/index.js +0 -179
  289. package/node_modules/node-abi/package.json +0 -45
  290. package/node_modules/once/LICENSE +0 -15
  291. package/node_modules/once/README.md +0 -79
  292. package/node_modules/once/once.js +0 -42
  293. package/node_modules/once/package.json +0 -33
  294. package/node_modules/prebuild-install/CHANGELOG.md +0 -131
  295. package/node_modules/prebuild-install/CONTRIBUTING.md +0 -6
  296. package/node_modules/prebuild-install/LICENSE +0 -21
  297. package/node_modules/prebuild-install/README.md +0 -163
  298. package/node_modules/prebuild-install/asset.js +0 -44
  299. package/node_modules/prebuild-install/bin.js +0 -78
  300. package/node_modules/prebuild-install/download.js +0 -142
  301. package/node_modules/prebuild-install/error.js +0 -14
  302. package/node_modules/prebuild-install/help.txt +0 -16
  303. package/node_modules/prebuild-install/index.js +0 -1
  304. package/node_modules/prebuild-install/log.js +0 -33
  305. package/node_modules/prebuild-install/package.json +0 -67
  306. package/node_modules/prebuild-install/proxy.js +0 -35
  307. package/node_modules/prebuild-install/rc.js +0 -64
  308. package/node_modules/prebuild-install/util.js +0 -143
  309. package/node_modules/pump/.github/FUNDING.yml +0 -2
  310. package/node_modules/pump/.travis.yml +0 -5
  311. package/node_modules/pump/LICENSE +0 -21
  312. package/node_modules/pump/README.md +0 -74
  313. package/node_modules/pump/SECURITY.md +0 -5
  314. package/node_modules/pump/empty.js +0 -1
  315. package/node_modules/pump/index.js +0 -86
  316. package/node_modules/pump/package.json +0 -30
  317. package/node_modules/pump/test-browser.js +0 -66
  318. package/node_modules/pump/test-node.js +0 -53
  319. package/node_modules/rc/LICENSE.APACHE2 +0 -15
  320. package/node_modules/rc/LICENSE.BSD +0 -26
  321. package/node_modules/rc/LICENSE.MIT +0 -24
  322. package/node_modules/rc/README.md +0 -227
  323. package/node_modules/rc/browser.js +0 -7
  324. package/node_modules/rc/cli.js +0 -4
  325. package/node_modules/rc/index.js +0 -53
  326. package/node_modules/rc/lib/utils.js +0 -104
  327. package/node_modules/rc/package.json +0 -29
  328. package/node_modules/rc/test/ini.js +0 -16
  329. package/node_modules/rc/test/nested-env-vars.js +0 -50
  330. package/node_modules/rc/test/test.js +0 -59
  331. package/node_modules/readable-stream/CONTRIBUTING.md +0 -38
  332. package/node_modules/readable-stream/GOVERNANCE.md +0 -136
  333. package/node_modules/readable-stream/LICENSE +0 -47
  334. package/node_modules/readable-stream/README.md +0 -106
  335. package/node_modules/readable-stream/errors-browser.js +0 -127
  336. package/node_modules/readable-stream/errors.js +0 -116
  337. package/node_modules/readable-stream/experimentalWarning.js +0 -17
  338. package/node_modules/readable-stream/lib/_stream_duplex.js +0 -126
  339. package/node_modules/readable-stream/lib/_stream_passthrough.js +0 -37
  340. package/node_modules/readable-stream/lib/_stream_readable.js +0 -1027
  341. package/node_modules/readable-stream/lib/_stream_transform.js +0 -190
  342. package/node_modules/readable-stream/lib/_stream_writable.js +0 -641
  343. package/node_modules/readable-stream/lib/internal/streams/async_iterator.js +0 -180
  344. package/node_modules/readable-stream/lib/internal/streams/buffer_list.js +0 -183
  345. package/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -96
  346. package/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +0 -86
  347. package/node_modules/readable-stream/lib/internal/streams/from-browser.js +0 -3
  348. package/node_modules/readable-stream/lib/internal/streams/from.js +0 -52
  349. package/node_modules/readable-stream/lib/internal/streams/pipeline.js +0 -86
  350. package/node_modules/readable-stream/lib/internal/streams/state.js +0 -22
  351. package/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
  352. package/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
  353. package/node_modules/readable-stream/package.json +0 -68
  354. package/node_modules/readable-stream/readable-browser.js +0 -9
  355. package/node_modules/readable-stream/readable.js +0 -16
  356. package/node_modules/safe-buffer/LICENSE +0 -21
  357. package/node_modules/safe-buffer/README.md +0 -584
  358. package/node_modules/safe-buffer/index.d.ts +0 -187
  359. package/node_modules/safe-buffer/index.js +0 -65
  360. package/node_modules/safe-buffer/package.json +0 -51
  361. package/node_modules/semver/LICENSE +0 -15
  362. package/node_modules/semver/README.md +0 -680
  363. package/node_modules/semver/bin/semver.js +0 -195
  364. package/node_modules/semver/classes/comparator.js +0 -143
  365. package/node_modules/semver/classes/index.js +0 -7
  366. package/node_modules/semver/classes/range.js +0 -577
  367. package/node_modules/semver/classes/semver.js +0 -350
  368. package/node_modules/semver/functions/clean.js +0 -8
  369. package/node_modules/semver/functions/cmp.js +0 -54
  370. package/node_modules/semver/functions/coerce.js +0 -62
  371. package/node_modules/semver/functions/compare-build.js +0 -9
  372. package/node_modules/semver/functions/compare-loose.js +0 -5
  373. package/node_modules/semver/functions/compare.js +0 -7
  374. package/node_modules/semver/functions/diff.js +0 -60
  375. package/node_modules/semver/functions/eq.js +0 -5
  376. package/node_modules/semver/functions/gt.js +0 -5
  377. package/node_modules/semver/functions/gte.js +0 -5
  378. package/node_modules/semver/functions/inc.js +0 -21
  379. package/node_modules/semver/functions/lt.js +0 -5
  380. package/node_modules/semver/functions/lte.js +0 -5
  381. package/node_modules/semver/functions/major.js +0 -5
  382. package/node_modules/semver/functions/minor.js +0 -5
  383. package/node_modules/semver/functions/neq.js +0 -5
  384. package/node_modules/semver/functions/parse.js +0 -18
  385. package/node_modules/semver/functions/patch.js +0 -5
  386. package/node_modules/semver/functions/prerelease.js +0 -8
  387. package/node_modules/semver/functions/rcompare.js +0 -5
  388. package/node_modules/semver/functions/rsort.js +0 -5
  389. package/node_modules/semver/functions/satisfies.js +0 -12
  390. package/node_modules/semver/functions/sort.js +0 -5
  391. package/node_modules/semver/functions/truncate.js +0 -48
  392. package/node_modules/semver/functions/valid.js +0 -8
  393. package/node_modules/semver/index.js +0 -93
  394. package/node_modules/semver/internal/constants.js +0 -37
  395. package/node_modules/semver/internal/debug.js +0 -11
  396. package/node_modules/semver/internal/identifiers.js +0 -29
  397. package/node_modules/semver/internal/lrucache.js +0 -42
  398. package/node_modules/semver/internal/parse-options.js +0 -17
  399. package/node_modules/semver/internal/re.js +0 -223
  400. package/node_modules/semver/package.json +0 -78
  401. package/node_modules/semver/preload.js +0 -4
  402. package/node_modules/semver/range.bnf +0 -17
  403. package/node_modules/semver/ranges/gtr.js +0 -6
  404. package/node_modules/semver/ranges/intersects.js +0 -9
  405. package/node_modules/semver/ranges/ltr.js +0 -6
  406. package/node_modules/semver/ranges/max-satisfying.js +0 -27
  407. package/node_modules/semver/ranges/min-satisfying.js +0 -26
  408. package/node_modules/semver/ranges/min-version.js +0 -63
  409. package/node_modules/semver/ranges/outside.js +0 -82
  410. package/node_modules/semver/ranges/simplify.js +0 -49
  411. package/node_modules/semver/ranges/subset.js +0 -249
  412. package/node_modules/semver/ranges/to-comparators.js +0 -10
  413. package/node_modules/semver/ranges/valid.js +0 -13
  414. package/node_modules/simple-concat/.travis.yml +0 -3
  415. package/node_modules/simple-concat/LICENSE +0 -20
  416. package/node_modules/simple-concat/README.md +0 -44
  417. package/node_modules/simple-concat/index.js +0 -15
  418. package/node_modules/simple-concat/package.json +0 -47
  419. package/node_modules/simple-concat/test/basic.js +0 -41
  420. package/node_modules/simple-get/.github/dependabot.yml +0 -15
  421. package/node_modules/simple-get/.github/workflows/ci.yml +0 -23
  422. package/node_modules/simple-get/LICENSE +0 -20
  423. package/node_modules/simple-get/README.md +0 -333
  424. package/node_modules/simple-get/index.js +0 -108
  425. package/node_modules/simple-get/package.json +0 -67
  426. package/node_modules/string_decoder/LICENSE +0 -48
  427. package/node_modules/string_decoder/README.md +0 -47
  428. package/node_modules/string_decoder/lib/string_decoder.js +0 -296
  429. package/node_modules/string_decoder/package.json +0 -34
  430. package/node_modules/strip-json-comments/index.js +0 -70
  431. package/node_modules/strip-json-comments/license +0 -21
  432. package/node_modules/strip-json-comments/package.json +0 -42
  433. package/node_modules/strip-json-comments/readme.md +0 -64
  434. package/node_modules/tar-fs/.travis.yml +0 -6
  435. package/node_modules/tar-fs/LICENSE +0 -21
  436. package/node_modules/tar-fs/README.md +0 -165
  437. package/node_modules/tar-fs/index.js +0 -392
  438. package/node_modules/tar-fs/package.json +0 -46
  439. package/node_modules/tar-fs/test/fixtures/a/hello.txt +0 -1
  440. package/node_modules/tar-fs/test/fixtures/b/a/test.txt +0 -1
  441. package/node_modules/tar-fs/test/fixtures/d/file1 +0 -0
  442. package/node_modules/tar-fs/test/fixtures/d/file2 +0 -0
  443. package/node_modules/tar-fs/test/fixtures/d/sub-dir/file5 +0 -0
  444. package/node_modules/tar-fs/test/fixtures/d/sub-files/file3 +0 -0
  445. package/node_modules/tar-fs/test/fixtures/d/sub-files/file4 +0 -0
  446. package/node_modules/tar-fs/test/fixtures/e/directory/.ignore +0 -0
  447. package/node_modules/tar-fs/test/fixtures/e/file +0 -0
  448. package/node_modules/tar-fs/test/fixtures/invalid.tar +0 -0
  449. package/node_modules/tar-fs/test/index.js +0 -457
  450. package/node_modules/tar-stream/LICENSE +0 -21
  451. package/node_modules/tar-stream/README.md +0 -168
  452. package/node_modules/tar-stream/extract.js +0 -257
  453. package/node_modules/tar-stream/headers.js +0 -295
  454. package/node_modules/tar-stream/index.js +0 -2
  455. package/node_modules/tar-stream/pack.js +0 -255
  456. package/node_modules/tar-stream/package.json +0 -58
  457. package/node_modules/tar-stream/sandbox.js +0 -11
  458. package/node_modules/tunnel-agent/LICENSE +0 -55
  459. package/node_modules/tunnel-agent/README.md +0 -4
  460. package/node_modules/tunnel-agent/index.js +0 -244
  461. package/node_modules/tunnel-agent/package.json +0 -22
  462. package/node_modules/util-deprecate/History.md +0 -16
  463. package/node_modules/util-deprecate/LICENSE +0 -24
  464. package/node_modules/util-deprecate/README.md +0 -53
  465. package/node_modules/util-deprecate/browser.js +0 -67
  466. package/node_modules/util-deprecate/node.js +0 -6
  467. package/node_modules/util-deprecate/package.json +0 -27
  468. package/node_modules/wrappy/LICENSE +0 -15
  469. package/node_modules/wrappy/README.md +0 -36
  470. package/node_modules/wrappy/package.json +0 -29
  471. package/node_modules/wrappy/wrappy.js +0 -33
@@ -1,80 +0,0 @@
1
- # ===
2
- # This configuration defines options specific to compiling SQLite itself.
3
- # Compile-time options are loaded by the auto-generated file "defines.gypi".
4
- # The --sqlite3 option can be provided to use a custom amalgamation instead.
5
- # ===
6
-
7
- {
8
- 'includes': ['common.gypi'],
9
- 'targets': [
10
- {
11
- 'target_name': 'locate_sqlite3',
12
- 'type': 'none',
13
- 'hard_dependency': 1,
14
- 'conditions': [
15
- ['sqlite3 == ""', {
16
- 'actions': [{
17
- 'action_name': 'copy_builtin_sqlite3',
18
- 'inputs': [
19
- 'sqlite3/sqlite3.c',
20
- 'sqlite3/sqlite3.h',
21
- 'sqlite3/sqlite3ext.h',
22
- ],
23
- 'outputs': [
24
- '<(SHARED_INTERMEDIATE_DIR)/sqlite3/sqlite3.c',
25
- '<(SHARED_INTERMEDIATE_DIR)/sqlite3/sqlite3.h',
26
- '<(SHARED_INTERMEDIATE_DIR)/sqlite3/sqlite3ext.h',
27
- ],
28
- 'action': ['node', 'copy.js', '<(SHARED_INTERMEDIATE_DIR)/sqlite3', ''],
29
- }],
30
- }, {
31
- 'actions': [{
32
- 'action_name': 'copy_custom_sqlite3',
33
- 'inputs': [
34
- '<(sqlite3)/sqlite3.c',
35
- '<(sqlite3)/sqlite3.h',
36
- ],
37
- 'outputs': [
38
- '<(SHARED_INTERMEDIATE_DIR)/sqlite3/sqlite3.c',
39
- '<(SHARED_INTERMEDIATE_DIR)/sqlite3/sqlite3.h',
40
- ],
41
- 'action': ['node', 'copy.js', '<(SHARED_INTERMEDIATE_DIR)/sqlite3', '<(sqlite3)'],
42
- }],
43
- }],
44
- ],
45
- },
46
- {
47
- 'target_name': 'sqlite3',
48
- 'type': 'static_library',
49
- 'dependencies': ['locate_sqlite3'],
50
- 'sources': ['<(SHARED_INTERMEDIATE_DIR)/sqlite3/sqlite3.c'],
51
- 'include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/sqlite3/'],
52
- 'direct_dependent_settings': {
53
- 'include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/sqlite3/'],
54
- },
55
- 'cflags': ['-std=c99', '-w'],
56
- 'xcode_settings': {
57
- 'OTHER_CFLAGS': ['-std=c99'],
58
- 'WARNING_CFLAGS': ['-w'],
59
- },
60
- 'conditions': [
61
- ['sqlite3 == ""', {
62
- 'includes': ['defines.gypi'],
63
- }, {
64
- 'defines': [
65
- # This is currently required by better-sqlite3.
66
- 'SQLITE_ENABLE_COLUMN_METADATA',
67
- ],
68
- }]
69
- ],
70
- 'configurations': {
71
- 'Debug': {
72
- 'msvs_settings': { 'VCCLCompilerTool': { 'RuntimeLibrary': 1 } }, # static debug
73
- },
74
- 'Release': {
75
- 'msvs_settings': { 'VCCLCompilerTool': { 'RuntimeLibrary': 0 } }, # static release
76
- },
77
- },
78
- },
79
- ],
80
- }
@@ -1,21 +0,0 @@
1
- #include <sqlite3ext.h>
2
- SQLITE_EXTENSION_INIT1
3
-
4
- /*
5
- This SQLite extension is used only for testing purposes (npm test).
6
- */
7
-
8
- static void TestExtensionFunction(sqlite3_context* pCtx, int nVal, sqlite3_value** _) {
9
- sqlite3_result_double(pCtx, (double)nVal);
10
- }
11
-
12
- #ifdef _WIN32
13
- __declspec(dllexport)
14
- #endif
15
-
16
- int sqlite3_extension_init(sqlite3* db, char** pzErrMsg, const sqlite3_api_routines* pApi) {
17
- SQLITE_EXTENSION_INIT2(pApi)
18
- if (pzErrMsg != 0) *pzErrMsg = 0;
19
- sqlite3_create_function(db, "testExtensionFunction", -1, SQLITE_UTF8, 0, TestExtensionFunction, 0, 0);
20
- return SQLITE_OK;
21
- }
@@ -1,90 +0,0 @@
1
- 'use strict';
2
- const fs = require('fs');
3
- const path = require('path');
4
- const util = require('./util');
5
- const SqliteError = require('./sqlite-error');
6
-
7
- let DEFAULT_ADDON;
8
-
9
- function Database(filenameGiven, options) {
10
- if (new.target == null) {
11
- return new Database(filenameGiven, options);
12
- }
13
-
14
- // Apply defaults
15
- let buffer;
16
- if (Buffer.isBuffer(filenameGiven)) {
17
- buffer = filenameGiven;
18
- filenameGiven = ':memory:';
19
- }
20
- if (filenameGiven == null) filenameGiven = '';
21
- if (options == null) options = {};
22
-
23
- // Validate arguments
24
- if (typeof filenameGiven !== 'string') throw new TypeError('Expected first argument to be a string');
25
- if (typeof options !== 'object') throw new TypeError('Expected second argument to be an options object');
26
- if ('readOnly' in options) throw new TypeError('Misspelled option "readOnly" should be "readonly"');
27
- if ('memory' in options) throw new TypeError('Option "memory" was removed in v7.0.0 (use ":memory:" filename instead)');
28
-
29
- // Interpret options
30
- const filename = filenameGiven.trim();
31
- const anonymous = filename === '' || filename === ':memory:';
32
- const readonly = util.getBooleanOption(options, 'readonly');
33
- const fileMustExist = util.getBooleanOption(options, 'fileMustExist');
34
- const timeout = 'timeout' in options ? options.timeout : 5000;
35
- const verbose = 'verbose' in options ? options.verbose : null;
36
- const nativeBinding = 'nativeBinding' in options ? options.nativeBinding : null;
37
-
38
- // Validate interpreted options
39
- if (readonly && anonymous && !buffer) throw new TypeError('In-memory/temporary databases cannot be readonly');
40
- if (!Number.isInteger(timeout) || timeout < 0) throw new TypeError('Expected the "timeout" option to be a positive integer');
41
- if (timeout > 0x7fffffff) throw new RangeError('Option "timeout" cannot be greater than 2147483647');
42
- if (verbose != null && typeof verbose !== 'function') throw new TypeError('Expected the "verbose" option to be a function');
43
- if (nativeBinding != null && typeof nativeBinding !== 'string' && typeof nativeBinding !== 'object') throw new TypeError('Expected the "nativeBinding" option to be a string or addon object');
44
-
45
- // Load the native addon
46
- let addon;
47
- if (nativeBinding == null) {
48
- addon = DEFAULT_ADDON || (DEFAULT_ADDON = require('bindings')('better_sqlite3.node'));
49
- } else if (typeof nativeBinding === 'string') {
50
- // See <https://webpack.js.org/api/module-variables/#__non_webpack_require__-webpack-specific>
51
- const requireFunc = typeof __non_webpack_require__ === 'function' ? __non_webpack_require__ : require;
52
- addon = requireFunc(path.resolve(nativeBinding).replace(/(\.node)?$/, '.node'));
53
- } else {
54
- // See <https://github.com/WiseLibs/better-sqlite3/issues/972>
55
- addon = nativeBinding;
56
- }
57
-
58
- if (!addon.isInitialized) {
59
- addon.setErrorConstructor(SqliteError);
60
- addon.isInitialized = true;
61
- }
62
-
63
- // Make sure the specified directory exists
64
- if (!anonymous && !filename.startsWith('file:') && !fs.existsSync(path.dirname(filename))) {
65
- throw new TypeError('Cannot open database because the directory does not exist');
66
- }
67
-
68
- Object.defineProperties(this, {
69
- [util.cppdb]: { value: new addon.Database(filename, filenameGiven, anonymous, readonly, fileMustExist, timeout, verbose || null, buffer || null) },
70
- ...wrappers.getters,
71
- });
72
- }
73
-
74
- const wrappers = require('./methods/wrappers');
75
- Database.prototype.prepare = wrappers.prepare;
76
- Database.prototype.transaction = require('./methods/transaction');
77
- Database.prototype.pragma = require('./methods/pragma');
78
- Database.prototype.backup = require('./methods/backup');
79
- Database.prototype.serialize = require('./methods/serialize');
80
- Database.prototype.function = require('./methods/function');
81
- Database.prototype.aggregate = require('./methods/aggregate');
82
- Database.prototype.table = require('./methods/table');
83
- Database.prototype.loadExtension = wrappers.loadExtension;
84
- Database.prototype.exec = wrappers.exec;
85
- Database.prototype.close = wrappers.close;
86
- Database.prototype.defaultSafeIntegers = wrappers.defaultSafeIntegers;
87
- Database.prototype.unsafeMode = wrappers.unsafeMode;
88
- Database.prototype[util.inspect] = require('./methods/inspect');
89
-
90
- module.exports = Database;
@@ -1,3 +0,0 @@
1
- 'use strict';
2
- module.exports = require('./database');
3
- module.exports.SqliteError = require('./sqlite-error');
@@ -1,43 +0,0 @@
1
- 'use strict';
2
- const { getBooleanOption, cppdb } = require('../util');
3
-
4
- module.exports = function defineAggregate(name, options) {
5
- // Validate arguments
6
- if (typeof name !== 'string') throw new TypeError('Expected first argument to be a string');
7
- if (typeof options !== 'object' || options === null) throw new TypeError('Expected second argument to be an options object');
8
- if (!name) throw new TypeError('User-defined function name cannot be an empty string');
9
-
10
- // Interpret options
11
- const start = 'start' in options ? options.start : null;
12
- const step = getFunctionOption(options, 'step', true);
13
- const inverse = getFunctionOption(options, 'inverse', false);
14
- const result = getFunctionOption(options, 'result', false);
15
- const safeIntegers = 'safeIntegers' in options ? +getBooleanOption(options, 'safeIntegers') : 2;
16
- const deterministic = getBooleanOption(options, 'deterministic');
17
- const directOnly = getBooleanOption(options, 'directOnly');
18
- const varargs = getBooleanOption(options, 'varargs');
19
- let argCount = -1;
20
-
21
- // Determine argument count
22
- if (!varargs) {
23
- argCount = Math.max(getLength(step), inverse ? getLength(inverse) : 0);
24
- if (argCount > 0) argCount -= 1;
25
- if (argCount > 100) throw new RangeError('User-defined functions cannot have more than 100 arguments');
26
- }
27
-
28
- this[cppdb].aggregate(start, step, inverse, result, name, argCount, safeIntegers, deterministic, directOnly);
29
- return this;
30
- };
31
-
32
- const getFunctionOption = (options, key, required) => {
33
- const value = key in options ? options[key] : null;
34
- if (typeof value === 'function') return value;
35
- if (value != null) throw new TypeError(`Expected the "${key}" option to be a function`);
36
- if (required) throw new TypeError(`Missing required option "${key}"`);
37
- return null;
38
- };
39
-
40
- const getLength = ({ length }) => {
41
- if (Number.isInteger(length) && length >= 0) return length;
42
- throw new TypeError('Expected function.length to be a positive integer');
43
- };
@@ -1,67 +0,0 @@
1
- 'use strict';
2
- const fs = require('fs');
3
- const path = require('path');
4
- const { promisify } = require('util');
5
- const { cppdb } = require('../util');
6
- const fsAccess = promisify(fs.access);
7
-
8
- module.exports = async function backup(filename, options) {
9
- if (options == null) options = {};
10
-
11
- // Validate arguments
12
- if (typeof filename !== 'string') throw new TypeError('Expected first argument to be a string');
13
- if (typeof options !== 'object') throw new TypeError('Expected second argument to be an options object');
14
-
15
- // Interpret options
16
- filename = filename.trim();
17
- const attachedName = 'attached' in options ? options.attached : 'main';
18
- const handler = 'progress' in options ? options.progress : null;
19
-
20
- // Validate interpreted options
21
- if (!filename) throw new TypeError('Backup filename cannot be an empty string');
22
- if (filename === ':memory:') throw new TypeError('Invalid backup filename ":memory:"');
23
- if (typeof attachedName !== 'string') throw new TypeError('Expected the "attached" option to be a string');
24
- if (!attachedName) throw new TypeError('The "attached" option cannot be an empty string');
25
- if (handler != null && typeof handler !== 'function') throw new TypeError('Expected the "progress" option to be a function');
26
-
27
- // Make sure the specified directory exists
28
- await fsAccess(path.dirname(filename)).catch(() => {
29
- throw new TypeError('Cannot save backup because the directory does not exist');
30
- });
31
-
32
- const isNewFile = await fsAccess(filename).then(() => false, () => true);
33
- return runBackup(this[cppdb].backup(this, attachedName, filename, isNewFile), handler || null);
34
- };
35
-
36
- const runBackup = (backup, handler) => {
37
- let rate = 0;
38
- let useDefault = true;
39
-
40
- return new Promise((resolve, reject) => {
41
- setImmediate(function step() {
42
- try {
43
- const progress = backup.transfer(rate);
44
- if (!progress.remainingPages) {
45
- backup.close();
46
- resolve(progress);
47
- return;
48
- }
49
- if (useDefault) {
50
- useDefault = false;
51
- rate = 100;
52
- }
53
- if (handler) {
54
- const ret = handler(progress);
55
- if (ret !== undefined) {
56
- if (typeof ret === 'number' && ret === ret) rate = Math.max(0, Math.min(0x7fffffff, Math.round(ret)));
57
- else throw new TypeError('Expected progress callback to return a number or undefined');
58
- }
59
- }
60
- setImmediate(step);
61
- } catch (err) {
62
- backup.close();
63
- reject(err);
64
- }
65
- });
66
- });
67
- };
@@ -1,31 +0,0 @@
1
- 'use strict';
2
- const { getBooleanOption, cppdb } = require('../util');
3
-
4
- module.exports = function defineFunction(name, options, fn) {
5
- // Apply defaults
6
- if (options == null) options = {};
7
- if (typeof options === 'function') { fn = options; options = {}; }
8
-
9
- // Validate arguments
10
- if (typeof name !== 'string') throw new TypeError('Expected first argument to be a string');
11
- if (typeof fn !== 'function') throw new TypeError('Expected last argument to be a function');
12
- if (typeof options !== 'object') throw new TypeError('Expected second argument to be an options object');
13
- if (!name) throw new TypeError('User-defined function name cannot be an empty string');
14
-
15
- // Interpret options
16
- const safeIntegers = 'safeIntegers' in options ? +getBooleanOption(options, 'safeIntegers') : 2;
17
- const deterministic = getBooleanOption(options, 'deterministic');
18
- const directOnly = getBooleanOption(options, 'directOnly');
19
- const varargs = getBooleanOption(options, 'varargs');
20
- let argCount = -1;
21
-
22
- // Determine argument count
23
- if (!varargs) {
24
- argCount = fn.length;
25
- if (!Number.isInteger(argCount) || argCount < 0) throw new TypeError('Expected function.length to be a positive integer');
26
- if (argCount > 100) throw new RangeError('User-defined functions cannot have more than 100 arguments');
27
- }
28
-
29
- this[cppdb].function(fn, name, argCount, safeIntegers, deterministic, directOnly);
30
- return this;
31
- };
@@ -1,7 +0,0 @@
1
- 'use strict';
2
- const DatabaseInspection = function Database() {};
3
-
4
- module.exports = function inspect(depth, opts) {
5
- return Object.assign(new DatabaseInspection(), this);
6
- };
7
-
@@ -1,12 +0,0 @@
1
- 'use strict';
2
- const { getBooleanOption, cppdb } = require('../util');
3
-
4
- module.exports = function pragma(source, options) {
5
- if (options == null) options = {};
6
- if (typeof source !== 'string') throw new TypeError('Expected first argument to be a string');
7
- if (typeof options !== 'object') throw new TypeError('Expected second argument to be an options object');
8
- const simple = getBooleanOption(options, 'simple');
9
-
10
- const stmt = this[cppdb].prepare(`PRAGMA ${source}`, this, true);
11
- return simple ? stmt.pluck().get() : stmt.all();
12
- };
@@ -1,16 +0,0 @@
1
- 'use strict';
2
- const { cppdb } = require('../util');
3
-
4
- module.exports = function serialize(options) {
5
- if (options == null) options = {};
6
-
7
- // Validate arguments
8
- if (typeof options !== 'object') throw new TypeError('Expected first argument to be an options object');
9
-
10
- // Interpret and validate options
11
- const attachedName = 'attached' in options ? options.attached : 'main';
12
- if (typeof attachedName !== 'string') throw new TypeError('Expected the "attached" option to be a string');
13
- if (!attachedName) throw new TypeError('The "attached" option cannot be an empty string');
14
-
15
- return this[cppdb].serialize(attachedName);
16
- };
@@ -1,189 +0,0 @@
1
- 'use strict';
2
- const { cppdb } = require('../util');
3
-
4
- module.exports = function defineTable(name, factory) {
5
- // Validate arguments
6
- if (typeof name !== 'string') throw new TypeError('Expected first argument to be a string');
7
- if (!name) throw new TypeError('Virtual table module name cannot be an empty string');
8
-
9
- // Determine whether the module is eponymous-only or not
10
- let eponymous = false;
11
- if (typeof factory === 'object' && factory !== null) {
12
- eponymous = true;
13
- factory = defer(parseTableDefinition(factory, 'used', name));
14
- } else {
15
- if (typeof factory !== 'function') throw new TypeError('Expected second argument to be a function or a table definition object');
16
- factory = wrapFactory(factory);
17
- }
18
-
19
- this[cppdb].table(factory, name, eponymous);
20
- return this;
21
- };
22
-
23
- function wrapFactory(factory) {
24
- return function virtualTableFactory(moduleName, databaseName, tableName, ...args) {
25
- const thisObject = {
26
- module: moduleName,
27
- database: databaseName,
28
- table: tableName,
29
- };
30
-
31
- // Generate a new table definition by invoking the factory
32
- const def = apply.call(factory, thisObject, args);
33
- if (typeof def !== 'object' || def === null) {
34
- throw new TypeError(`Virtual table module "${moduleName}" did not return a table definition object`);
35
- }
36
-
37
- return parseTableDefinition(def, 'returned', moduleName);
38
- };
39
- }
40
-
41
- function parseTableDefinition(def, verb, moduleName) {
42
- // Validate required properties
43
- if (!hasOwnProperty.call(def, 'rows')) {
44
- throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition without a "rows" property`);
45
- }
46
- if (!hasOwnProperty.call(def, 'columns')) {
47
- throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition without a "columns" property`);
48
- }
49
-
50
- // Validate "rows" property
51
- const rows = def.rows;
52
- if (typeof rows !== 'function' || Object.getPrototypeOf(rows) !== GeneratorFunctionPrototype) {
53
- throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "rows" property (should be a generator function)`);
54
- }
55
-
56
- // Validate "columns" property
57
- let columns = def.columns;
58
- if (!Array.isArray(columns) || !(columns = [...columns]).every(x => typeof x === 'string')) {
59
- throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "columns" property (should be an array of strings)`);
60
- }
61
- if (columns.length !== new Set(columns).size) {
62
- throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with duplicate column names`);
63
- }
64
- if (!columns.length) {
65
- throw new RangeError(`Virtual table module "${moduleName}" ${verb} a table definition with zero columns`);
66
- }
67
-
68
- // Validate "parameters" property
69
- let parameters;
70
- if (hasOwnProperty.call(def, 'parameters')) {
71
- parameters = def.parameters;
72
- if (!Array.isArray(parameters) || !(parameters = [...parameters]).every(x => typeof x === 'string')) {
73
- throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "parameters" property (should be an array of strings)`);
74
- }
75
- } else {
76
- parameters = inferParameters(rows);
77
- }
78
- if (parameters.length !== new Set(parameters).size) {
79
- throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with duplicate parameter names`);
80
- }
81
- if (parameters.length > 32) {
82
- throw new RangeError(`Virtual table module "${moduleName}" ${verb} a table definition with more than the maximum number of 32 parameters`);
83
- }
84
- for (const parameter of parameters) {
85
- if (columns.includes(parameter)) {
86
- throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with column "${parameter}" which was ambiguously defined as both a column and parameter`);
87
- }
88
- }
89
-
90
- // Validate "safeIntegers" option
91
- let safeIntegers = 2;
92
- if (hasOwnProperty.call(def, 'safeIntegers')) {
93
- const bool = def.safeIntegers;
94
- if (typeof bool !== 'boolean') {
95
- throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "safeIntegers" property (should be a boolean)`);
96
- }
97
- safeIntegers = +bool;
98
- }
99
-
100
- // Validate "directOnly" option
101
- let directOnly = false;
102
- if (hasOwnProperty.call(def, 'directOnly')) {
103
- directOnly = def.directOnly;
104
- if (typeof directOnly !== 'boolean') {
105
- throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "directOnly" property (should be a boolean)`);
106
- }
107
- }
108
-
109
- // Generate SQL for the virtual table definition
110
- const columnDefinitions = [
111
- ...parameters.map(identifier).map(str => `${str} HIDDEN`),
112
- ...columns.map(identifier),
113
- ];
114
- return [
115
- `CREATE TABLE x(${columnDefinitions.join(', ')});`,
116
- wrapGenerator(rows, new Map(columns.map((x, i) => [x, parameters.length + i])), moduleName),
117
- parameters,
118
- safeIntegers,
119
- directOnly,
120
- ];
121
- }
122
-
123
- function wrapGenerator(generator, columnMap, moduleName) {
124
- return function* virtualTable(...args) {
125
- /*
126
- We must defensively clone any buffers in the arguments, because
127
- otherwise the generator could mutate one of them, which would cause
128
- us to return incorrect values for hidden columns, potentially
129
- corrupting the database.
130
- */
131
- const output = args.map(x => Buffer.isBuffer(x) ? Buffer.from(x) : x);
132
- for (let i = 0; i < columnMap.size; ++i) {
133
- output.push(null); // Fill with nulls to prevent gaps in array (v8 optimization)
134
- }
135
- for (const row of generator(...args)) {
136
- if (Array.isArray(row)) {
137
- extractRowArray(row, output, columnMap.size, moduleName);
138
- yield output;
139
- } else if (typeof row === 'object' && row !== null) {
140
- extractRowObject(row, output, columnMap, moduleName);
141
- yield output;
142
- } else {
143
- throw new TypeError(`Virtual table module "${moduleName}" yielded something that isn't a valid row object`);
144
- }
145
- }
146
- };
147
- }
148
-
149
- function extractRowArray(row, output, columnCount, moduleName) {
150
- if (row.length !== columnCount) {
151
- throw new TypeError(`Virtual table module "${moduleName}" yielded a row with an incorrect number of columns`);
152
- }
153
- const offset = output.length - columnCount;
154
- for (let i = 0; i < columnCount; ++i) {
155
- output[i + offset] = row[i];
156
- }
157
- }
158
-
159
- function extractRowObject(row, output, columnMap, moduleName) {
160
- let count = 0;
161
- for (const key of Object.keys(row)) {
162
- const index = columnMap.get(key);
163
- if (index === undefined) {
164
- throw new TypeError(`Virtual table module "${moduleName}" yielded a row with an undeclared column "${key}"`);
165
- }
166
- output[index] = row[key];
167
- count += 1;
168
- }
169
- if (count !== columnMap.size) {
170
- throw new TypeError(`Virtual table module "${moduleName}" yielded a row with missing columns`);
171
- }
172
- }
173
-
174
- function inferParameters({ length }) {
175
- if (!Number.isInteger(length) || length < 0) {
176
- throw new TypeError('Expected function.length to be a positive integer');
177
- }
178
- const params = [];
179
- for (let i = 0; i < length; ++i) {
180
- params.push(`$${i + 1}`);
181
- }
182
- return params;
183
- }
184
-
185
- const { hasOwnProperty } = Object.prototype;
186
- const { apply } = Function.prototype;
187
- const GeneratorFunctionPrototype = Object.getPrototypeOf(function*(){});
188
- const identifier = str => `"${str.replace(/"/g, '""')}"`;
189
- const defer = x => () => x;
@@ -1,78 +0,0 @@
1
- 'use strict';
2
- const { cppdb } = require('../util');
3
- const controllers = new WeakMap();
4
-
5
- module.exports = function transaction(fn) {
6
- if (typeof fn !== 'function') throw new TypeError('Expected first argument to be a function');
7
-
8
- const db = this[cppdb];
9
- const controller = getController(db, this);
10
- const { apply } = Function.prototype;
11
-
12
- // Each version of the transaction function has these same properties
13
- const properties = {
14
- default: { value: wrapTransaction(apply, fn, db, controller.default) },
15
- deferred: { value: wrapTransaction(apply, fn, db, controller.deferred) },
16
- immediate: { value: wrapTransaction(apply, fn, db, controller.immediate) },
17
- exclusive: { value: wrapTransaction(apply, fn, db, controller.exclusive) },
18
- database: { value: this, enumerable: true },
19
- };
20
-
21
- Object.defineProperties(properties.default.value, properties);
22
- Object.defineProperties(properties.deferred.value, properties);
23
- Object.defineProperties(properties.immediate.value, properties);
24
- Object.defineProperties(properties.exclusive.value, properties);
25
-
26
- // Return the default version of the transaction function
27
- return properties.default.value;
28
- };
29
-
30
- // Return the database's cached transaction controller, or create a new one
31
- const getController = (db, self) => {
32
- let controller = controllers.get(db);
33
- if (!controller) {
34
- const shared = {
35
- commit: db.prepare('COMMIT', self, false),
36
- rollback: db.prepare('ROLLBACK', self, false),
37
- savepoint: db.prepare('SAVEPOINT `\t_bs3.\t`', self, false),
38
- release: db.prepare('RELEASE `\t_bs3.\t`', self, false),
39
- rollbackTo: db.prepare('ROLLBACK TO `\t_bs3.\t`', self, false),
40
- };
41
- controllers.set(db, controller = {
42
- default: Object.assign({ begin: db.prepare('BEGIN', self, false) }, shared),
43
- deferred: Object.assign({ begin: db.prepare('BEGIN DEFERRED', self, false) }, shared),
44
- immediate: Object.assign({ begin: db.prepare('BEGIN IMMEDIATE', self, false) }, shared),
45
- exclusive: Object.assign({ begin: db.prepare('BEGIN EXCLUSIVE', self, false) }, shared),
46
- });
47
- }
48
- return controller;
49
- };
50
-
51
- // Return a new transaction function by wrapping the given function
52
- const wrapTransaction = (apply, fn, db, { begin, commit, rollback, savepoint, release, rollbackTo }) => function sqliteTransaction() {
53
- let before, after, undo;
54
- if (db.inTransaction) {
55
- before = savepoint;
56
- after = release;
57
- undo = rollbackTo;
58
- } else {
59
- before = begin;
60
- after = commit;
61
- undo = rollback;
62
- }
63
- before.run();
64
- try {
65
- const result = apply.call(fn, this, arguments);
66
- if (result && typeof result.then === 'function') {
67
- throw new TypeError('Transaction function cannot return a promise');
68
- }
69
- after.run();
70
- return result;
71
- } catch (ex) {
72
- if (db.inTransaction) {
73
- undo.run();
74
- if (undo !== rollback) after.run();
75
- }
76
- throw ex;
77
- }
78
- };