smart001 1.0.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 (1448) hide show
  1. package/backend/db.js +19 -0
  2. package/backend/node_modules/.bin/bcrypt +16 -0
  3. package/backend/node_modules/.bin/bcrypt.cmd +17 -0
  4. package/backend/node_modules/.bin/bcrypt.ps1 +28 -0
  5. package/backend/node_modules/.bin/json +16 -0
  6. package/backend/node_modules/.bin/json.cmd +17 -0
  7. package/backend/node_modules/.bin/json.ps1 +28 -0
  8. package/backend/node_modules/.bin/node-gyp-build +16 -0
  9. package/backend/node_modules/.bin/node-gyp-build-optional +16 -0
  10. package/backend/node_modules/.bin/node-gyp-build-optional.cmd +17 -0
  11. package/backend/node_modules/.bin/node-gyp-build-optional.ps1 +28 -0
  12. package/backend/node_modules/.bin/node-gyp-build-test +16 -0
  13. package/backend/node_modules/.bin/node-gyp-build-test.cmd +17 -0
  14. package/backend/node_modules/.bin/node-gyp-build-test.ps1 +28 -0
  15. package/backend/node_modules/.bin/node-gyp-build.cmd +17 -0
  16. package/backend/node_modules/.bin/node-gyp-build.ps1 +28 -0
  17. package/backend/node_modules/.bin/nodemon +16 -0
  18. package/backend/node_modules/.bin/nodemon.cmd +17 -0
  19. package/backend/node_modules/.bin/nodemon.ps1 +28 -0
  20. package/backend/node_modules/.bin/nodetouch +16 -0
  21. package/backend/node_modules/.bin/nodetouch.cmd +17 -0
  22. package/backend/node_modules/.bin/nodetouch.ps1 +28 -0
  23. package/backend/node_modules/.bin/semver +16 -0
  24. package/backend/node_modules/.bin/semver.cmd +17 -0
  25. package/backend/node_modules/.bin/semver.ps1 +28 -0
  26. package/backend/node_modules/.package-lock.json +1475 -0
  27. package/backend/node_modules/@types/node/LICENSE +21 -0
  28. package/backend/node_modules/@types/node/README.md +15 -0
  29. package/backend/node_modules/@types/node/assert/strict.d.ts +59 -0
  30. package/backend/node_modules/@types/node/assert.d.ts +950 -0
  31. package/backend/node_modules/@types/node/async_hooks.d.ts +711 -0
  32. package/backend/node_modules/@types/node/buffer.buffer.d.ts +466 -0
  33. package/backend/node_modules/@types/node/buffer.d.ts +1765 -0
  34. package/backend/node_modules/@types/node/child_process.d.ts +1366 -0
  35. package/backend/node_modules/@types/node/cluster.d.ts +432 -0
  36. package/backend/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
  37. package/backend/node_modules/@types/node/console.d.ts +93 -0
  38. package/backend/node_modules/@types/node/constants.d.ts +14 -0
  39. package/backend/node_modules/@types/node/crypto.d.ts +4058 -0
  40. package/backend/node_modules/@types/node/dgram.d.ts +537 -0
  41. package/backend/node_modules/@types/node/diagnostics_channel.d.ts +552 -0
  42. package/backend/node_modules/@types/node/dns/promises.d.ts +497 -0
  43. package/backend/node_modules/@types/node/dns.d.ts +876 -0
  44. package/backend/node_modules/@types/node/domain.d.ts +150 -0
  45. package/backend/node_modules/@types/node/events.d.ts +1008 -0
  46. package/backend/node_modules/@types/node/fs/promises.d.ts +1468 -0
  47. package/backend/node_modules/@types/node/fs.d.ts +4780 -0
  48. package/backend/node_modules/@types/node/globals.d.ts +150 -0
  49. package/backend/node_modules/@types/node/globals.typedarray.d.ts +101 -0
  50. package/backend/node_modules/@types/node/http.d.ts +2147 -0
  51. package/backend/node_modules/@types/node/http2.d.ts +2485 -0
  52. package/backend/node_modules/@types/node/https.d.ts +400 -0
  53. package/backend/node_modules/@types/node/index.d.ts +117 -0
  54. package/backend/node_modules/@types/node/inspector/promises.d.ts +35 -0
  55. package/backend/node_modules/@types/node/inspector.d.ts +264 -0
  56. package/backend/node_modules/@types/node/inspector.generated.d.ts +4406 -0
  57. package/backend/node_modules/@types/node/module.d.ts +755 -0
  58. package/backend/node_modules/@types/node/net.d.ts +970 -0
  59. package/backend/node_modules/@types/node/os.d.ts +498 -0
  60. package/backend/node_modules/@types/node/package.json +155 -0
  61. package/backend/node_modules/@types/node/path/posix.d.ts +8 -0
  62. package/backend/node_modules/@types/node/path/win32.d.ts +8 -0
  63. package/backend/node_modules/@types/node/path.d.ts +178 -0
  64. package/backend/node_modules/@types/node/perf_hooks.d.ts +612 -0
  65. package/backend/node_modules/@types/node/process.d.ts +2204 -0
  66. package/backend/node_modules/@types/node/punycode.d.ts +89 -0
  67. package/backend/node_modules/@types/node/querystring.d.ts +139 -0
  68. package/backend/node_modules/@types/node/quic.d.ts +897 -0
  69. package/backend/node_modules/@types/node/readline/promises.d.ts +158 -0
  70. package/backend/node_modules/@types/node/readline.d.ts +507 -0
  71. package/backend/node_modules/@types/node/repl.d.ts +420 -0
  72. package/backend/node_modules/@types/node/sea.d.ts +47 -0
  73. package/backend/node_modules/@types/node/sqlite.d.ts +1068 -0
  74. package/backend/node_modules/@types/node/stream/consumers.d.ts +114 -0
  75. package/backend/node_modules/@types/node/stream/iter.d.ts +301 -0
  76. package/backend/node_modules/@types/node/stream/promises.d.ts +211 -0
  77. package/backend/node_modules/@types/node/stream/web.d.ts +300 -0
  78. package/backend/node_modules/@types/node/stream.d.ts +1774 -0
  79. package/backend/node_modules/@types/node/string_decoder.d.ts +27 -0
  80. package/backend/node_modules/@types/node/test/reporters.d.ts +59 -0
  81. package/backend/node_modules/@types/node/test.d.ts +2279 -0
  82. package/backend/node_modules/@types/node/timers/promises.d.ts +93 -0
  83. package/backend/node_modules/@types/node/timers.d.ts +149 -0
  84. package/backend/node_modules/@types/node/tls.d.ts +1193 -0
  85. package/backend/node_modules/@types/node/trace_events.d.ts +103 -0
  86. package/backend/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +462 -0
  87. package/backend/node_modules/@types/node/ts5.6/compatibility/float16array.d.ts +71 -0
  88. package/backend/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +36 -0
  89. package/backend/node_modules/@types/node/ts5.6/index.d.ts +119 -0
  90. package/backend/node_modules/@types/node/ts5.7/compatibility/float16array.d.ts +72 -0
  91. package/backend/node_modules/@types/node/ts5.7/index.d.ts +119 -0
  92. package/backend/node_modules/@types/node/tty.d.ts +225 -0
  93. package/backend/node_modules/@types/node/url.d.ts +556 -0
  94. package/backend/node_modules/@types/node/util/types.d.ts +558 -0
  95. package/backend/node_modules/@types/node/util.d.ts +1677 -0
  96. package/backend/node_modules/@types/node/v8.d.ts +980 -0
  97. package/backend/node_modules/@types/node/vm.d.ts +1136 -0
  98. package/backend/node_modules/@types/node/wasi.d.ts +131 -0
  99. package/backend/node_modules/@types/node/web-globals/abortcontroller.d.ts +59 -0
  100. package/backend/node_modules/@types/node/web-globals/blob.d.ts +23 -0
  101. package/backend/node_modules/@types/node/web-globals/console.d.ts +9 -0
  102. package/backend/node_modules/@types/node/web-globals/crypto.d.ts +39 -0
  103. package/backend/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  104. package/backend/node_modules/@types/node/web-globals/encoding.d.ts +11 -0
  105. package/backend/node_modules/@types/node/web-globals/events.d.ts +106 -0
  106. package/backend/node_modules/@types/node/web-globals/fetch.d.ts +69 -0
  107. package/backend/node_modules/@types/node/web-globals/importmeta.d.ts +13 -0
  108. package/backend/node_modules/@types/node/web-globals/messaging.d.ts +23 -0
  109. package/backend/node_modules/@types/node/web-globals/navigator.d.ts +25 -0
  110. package/backend/node_modules/@types/node/web-globals/performance.d.ts +45 -0
  111. package/backend/node_modules/@types/node/web-globals/storage.d.ts +24 -0
  112. package/backend/node_modules/@types/node/web-globals/streams.d.ts +115 -0
  113. package/backend/node_modules/@types/node/web-globals/timers.d.ts +44 -0
  114. package/backend/node_modules/@types/node/web-globals/url.d.ts +24 -0
  115. package/backend/node_modules/@types/node/worker_threads.d.ts +671 -0
  116. package/backend/node_modules/@types/node/zlib/iter.d.ts +131 -0
  117. package/backend/node_modules/@types/node/zlib.d.ts +589 -0
  118. package/backend/node_modules/accepts/HISTORY.md +250 -0
  119. package/backend/node_modules/accepts/LICENSE +23 -0
  120. package/backend/node_modules/accepts/README.md +140 -0
  121. package/backend/node_modules/accepts/index.js +238 -0
  122. package/backend/node_modules/accepts/package.json +47 -0
  123. package/backend/node_modules/anymatch/LICENSE +15 -0
  124. package/backend/node_modules/anymatch/README.md +87 -0
  125. package/backend/node_modules/anymatch/index.d.ts +20 -0
  126. package/backend/node_modules/anymatch/index.js +104 -0
  127. package/backend/node_modules/anymatch/package.json +48 -0
  128. package/backend/node_modules/aws-ssl-profiles/LICENSE +19 -0
  129. package/backend/node_modules/aws-ssl-profiles/README.md +146 -0
  130. package/backend/node_modules/aws-ssl-profiles/lib/@types/profiles.d.ts +4 -0
  131. package/backend/node_modules/aws-ssl-profiles/lib/@types/profiles.js +2 -0
  132. package/backend/node_modules/aws-ssl-profiles/lib/index.d.ts +8 -0
  133. package/backend/node_modules/aws-ssl-profiles/lib/index.js +13 -0
  134. package/backend/node_modules/aws-ssl-profiles/lib/profiles/ca/defaults.d.ts +9 -0
  135. package/backend/node_modules/aws-ssl-profiles/lib/profiles/ca/defaults.js +2888 -0
  136. package/backend/node_modules/aws-ssl-profiles/lib/profiles/ca/proxies.d.ts +8 -0
  137. package/backend/node_modules/aws-ssl-profiles/lib/profiles/ca/proxies.js +111 -0
  138. package/backend/node_modules/aws-ssl-profiles/package.json +52 -0
  139. package/backend/node_modules/balanced-match/LICENSE.md +23 -0
  140. package/backend/node_modules/balanced-match/README.md +57 -0
  141. package/backend/node_modules/balanced-match/dist/commonjs/index.d.ts +9 -0
  142. package/backend/node_modules/balanced-match/dist/commonjs/index.d.ts.map +1 -0
  143. package/backend/node_modules/balanced-match/dist/commonjs/index.js +59 -0
  144. package/backend/node_modules/balanced-match/dist/commonjs/index.js.map +1 -0
  145. package/backend/node_modules/balanced-match/dist/commonjs/package.json +3 -0
  146. package/backend/node_modules/balanced-match/dist/esm/index.d.ts +9 -0
  147. package/backend/node_modules/balanced-match/dist/esm/index.d.ts.map +1 -0
  148. package/backend/node_modules/balanced-match/dist/esm/index.js +54 -0
  149. package/backend/node_modules/balanced-match/dist/esm/index.js.map +1 -0
  150. package/backend/node_modules/balanced-match/dist/esm/package.json +3 -0
  151. package/backend/node_modules/balanced-match/package.json +68 -0
  152. package/backend/node_modules/bcrypt/.dockerignore +6 -0
  153. package/backend/node_modules/bcrypt/.editorconfig +19 -0
  154. package/backend/node_modules/bcrypt/.github/workflows/build-pack-publish.yml +110 -0
  155. package/backend/node_modules/bcrypt/.github/workflows/ci.yaml +42 -0
  156. package/backend/node_modules/bcrypt/CHANGELOG.md +184 -0
  157. package/backend/node_modules/bcrypt/Dockerfile +57 -0
  158. package/backend/node_modules/bcrypt/Dockerfile-alpine +41 -0
  159. package/backend/node_modules/bcrypt/ISSUE_TEMPLATE.md +18 -0
  160. package/backend/node_modules/bcrypt/LICENSE +19 -0
  161. package/backend/node_modules/bcrypt/Makefile +19 -0
  162. package/backend/node_modules/bcrypt/README.md +388 -0
  163. package/backend/node_modules/bcrypt/SECURITY.md +15 -0
  164. package/backend/node_modules/bcrypt/bcrypt.js +242 -0
  165. package/backend/node_modules/bcrypt/binding.gyp +49 -0
  166. package/backend/node_modules/bcrypt/build-all.sh +37 -0
  167. package/backend/node_modules/bcrypt/examples/async_compare.js +28 -0
  168. package/backend/node_modules/bcrypt/examples/forever_gen_salt.js +8 -0
  169. package/backend/node_modules/bcrypt/package.json +62 -0
  170. package/backend/node_modules/bcrypt/prebuilds/darwin-arm64/bcrypt.node +0 -0
  171. package/backend/node_modules/bcrypt/prebuilds/darwin-x64/bcrypt.node +0 -0
  172. package/backend/node_modules/bcrypt/prebuilds/linux-arm/bcrypt.glibc.node +0 -0
  173. package/backend/node_modules/bcrypt/prebuilds/linux-arm/bcrypt.musl.node +0 -0
  174. package/backend/node_modules/bcrypt/prebuilds/linux-arm64/bcrypt.glibc.node +0 -0
  175. package/backend/node_modules/bcrypt/prebuilds/linux-arm64/bcrypt.musl.node +0 -0
  176. package/backend/node_modules/bcrypt/prebuilds/linux-x64/bcrypt.glibc.node +0 -0
  177. package/backend/node_modules/bcrypt/prebuilds/linux-x64/bcrypt.musl.node +0 -0
  178. package/backend/node_modules/bcrypt/prebuilds/win32-arm64/bcrypt.node +0 -0
  179. package/backend/node_modules/bcrypt/prebuilds/win32-x64/bcrypt.node +0 -0
  180. package/backend/node_modules/bcrypt/promises.js +45 -0
  181. package/backend/node_modules/bcrypt/src/bcrypt.cc +315 -0
  182. package/backend/node_modules/bcrypt/src/bcrypt_node.cc +288 -0
  183. package/backend/node_modules/bcrypt/src/blowfish.cc +679 -0
  184. package/backend/node_modules/bcrypt/src/node_blf.h +132 -0
  185. package/backend/node_modules/bcrypt/test/async.test.js +209 -0
  186. package/backend/node_modules/bcrypt/test/implementation.test.js +48 -0
  187. package/backend/node_modules/bcrypt/test/promise.test.js +168 -0
  188. package/backend/node_modules/bcrypt/test/repetitions.test.js +55 -0
  189. package/backend/node_modules/bcrypt/test/sync.test.js +125 -0
  190. package/backend/node_modules/bcryptjs/LICENSE +27 -0
  191. package/backend/node_modules/bcryptjs/README.md +201 -0
  192. package/backend/node_modules/bcryptjs/bin/bcrypt +23 -0
  193. package/backend/node_modules/bcryptjs/index.d.ts +3 -0
  194. package/backend/node_modules/bcryptjs/index.js +1159 -0
  195. package/backend/node_modules/bcryptjs/package.json +76 -0
  196. package/backend/node_modules/bcryptjs/types.d.ts +157 -0
  197. package/backend/node_modules/bcryptjs/umd/index.d.ts +3 -0
  198. package/backend/node_modules/bcryptjs/umd/index.js +1220 -0
  199. package/backend/node_modules/bcryptjs/umd/package.json +3 -0
  200. package/backend/node_modules/bcryptjs/umd/types.d.ts +157 -0
  201. package/backend/node_modules/binary-extensions/binary-extensions.json +263 -0
  202. package/backend/node_modules/binary-extensions/binary-extensions.json.d.ts +3 -0
  203. package/backend/node_modules/binary-extensions/index.d.ts +14 -0
  204. package/backend/node_modules/binary-extensions/index.js +1 -0
  205. package/backend/node_modules/binary-extensions/license +10 -0
  206. package/backend/node_modules/binary-extensions/package.json +40 -0
  207. package/backend/node_modules/binary-extensions/readme.md +25 -0
  208. package/backend/node_modules/body-parser/LICENSE +23 -0
  209. package/backend/node_modules/body-parser/README.md +494 -0
  210. package/backend/node_modules/body-parser/index.js +71 -0
  211. package/backend/node_modules/body-parser/lib/read.js +247 -0
  212. package/backend/node_modules/body-parser/lib/types/json.js +158 -0
  213. package/backend/node_modules/body-parser/lib/types/raw.js +42 -0
  214. package/backend/node_modules/body-parser/lib/types/text.js +36 -0
  215. package/backend/node_modules/body-parser/lib/types/urlencoded.js +142 -0
  216. package/backend/node_modules/body-parser/lib/utils.js +98 -0
  217. package/backend/node_modules/body-parser/package.json +52 -0
  218. package/backend/node_modules/brace-expansion/LICENSE +23 -0
  219. package/backend/node_modules/brace-expansion/README.md +94 -0
  220. package/backend/node_modules/brace-expansion/dist/commonjs/index.d.ts +6 -0
  221. package/backend/node_modules/brace-expansion/dist/commonjs/index.d.ts.map +1 -0
  222. package/backend/node_modules/brace-expansion/dist/commonjs/index.js +201 -0
  223. package/backend/node_modules/brace-expansion/dist/commonjs/index.js.map +1 -0
  224. package/backend/node_modules/brace-expansion/dist/commonjs/package.json +3 -0
  225. package/backend/node_modules/brace-expansion/dist/esm/index.d.ts +6 -0
  226. package/backend/node_modules/brace-expansion/dist/esm/index.d.ts.map +1 -0
  227. package/backend/node_modules/brace-expansion/dist/esm/index.js +197 -0
  228. package/backend/node_modules/brace-expansion/dist/esm/index.js.map +1 -0
  229. package/backend/node_modules/brace-expansion/dist/esm/package.json +3 -0
  230. package/backend/node_modules/brace-expansion/package.json +64 -0
  231. package/backend/node_modules/braces/LICENSE +21 -0
  232. package/backend/node_modules/braces/README.md +586 -0
  233. package/backend/node_modules/braces/index.js +170 -0
  234. package/backend/node_modules/braces/lib/compile.js +60 -0
  235. package/backend/node_modules/braces/lib/constants.js +57 -0
  236. package/backend/node_modules/braces/lib/expand.js +113 -0
  237. package/backend/node_modules/braces/lib/parse.js +331 -0
  238. package/backend/node_modules/braces/lib/stringify.js +32 -0
  239. package/backend/node_modules/braces/lib/utils.js +122 -0
  240. package/backend/node_modules/braces/package.json +77 -0
  241. package/backend/node_modules/buffer-equal-constant-time/.travis.yml +4 -0
  242. package/backend/node_modules/buffer-equal-constant-time/LICENSE.txt +12 -0
  243. package/backend/node_modules/buffer-equal-constant-time/README.md +50 -0
  244. package/backend/node_modules/buffer-equal-constant-time/index.js +41 -0
  245. package/backend/node_modules/buffer-equal-constant-time/package.json +21 -0
  246. package/backend/node_modules/buffer-equal-constant-time/test.js +42 -0
  247. package/backend/node_modules/bytes/History.md +97 -0
  248. package/backend/node_modules/bytes/LICENSE +23 -0
  249. package/backend/node_modules/bytes/Readme.md +152 -0
  250. package/backend/node_modules/bytes/index.js +170 -0
  251. package/backend/node_modules/bytes/package.json +42 -0
  252. package/backend/node_modules/call-bind-apply-helpers/.eslintrc +17 -0
  253. package/backend/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +12 -0
  254. package/backend/node_modules/call-bind-apply-helpers/.nycrc +9 -0
  255. package/backend/node_modules/call-bind-apply-helpers/CHANGELOG.md +30 -0
  256. package/backend/node_modules/call-bind-apply-helpers/LICENSE +21 -0
  257. package/backend/node_modules/call-bind-apply-helpers/README.md +62 -0
  258. package/backend/node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
  259. package/backend/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
  260. package/backend/node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
  261. package/backend/node_modules/call-bind-apply-helpers/applyBind.js +10 -0
  262. package/backend/node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
  263. package/backend/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
  264. package/backend/node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
  265. package/backend/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
  266. package/backend/node_modules/call-bind-apply-helpers/index.d.ts +64 -0
  267. package/backend/node_modules/call-bind-apply-helpers/index.js +15 -0
  268. package/backend/node_modules/call-bind-apply-helpers/package.json +85 -0
  269. package/backend/node_modules/call-bind-apply-helpers/reflectApply.d.ts +3 -0
  270. package/backend/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
  271. package/backend/node_modules/call-bind-apply-helpers/test/index.js +63 -0
  272. package/backend/node_modules/call-bind-apply-helpers/tsconfig.json +9 -0
  273. package/backend/node_modules/call-bound/.eslintrc +13 -0
  274. package/backend/node_modules/call-bound/.github/FUNDING.yml +12 -0
  275. package/backend/node_modules/call-bound/.nycrc +9 -0
  276. package/backend/node_modules/call-bound/CHANGELOG.md +42 -0
  277. package/backend/node_modules/call-bound/LICENSE +21 -0
  278. package/backend/node_modules/call-bound/README.md +53 -0
  279. package/backend/node_modules/call-bound/index.d.ts +94 -0
  280. package/backend/node_modules/call-bound/index.js +19 -0
  281. package/backend/node_modules/call-bound/package.json +99 -0
  282. package/backend/node_modules/call-bound/test/index.js +61 -0
  283. package/backend/node_modules/call-bound/tsconfig.json +10 -0
  284. package/backend/node_modules/chokidar/LICENSE +21 -0
  285. package/backend/node_modules/chokidar/README.md +308 -0
  286. package/backend/node_modules/chokidar/index.js +973 -0
  287. package/backend/node_modules/chokidar/lib/constants.js +66 -0
  288. package/backend/node_modules/chokidar/lib/fsevents-handler.js +526 -0
  289. package/backend/node_modules/chokidar/lib/nodefs-handler.js +654 -0
  290. package/backend/node_modules/chokidar/package.json +70 -0
  291. package/backend/node_modules/chokidar/types/index.d.ts +192 -0
  292. package/backend/node_modules/content-disposition/LICENSE +22 -0
  293. package/backend/node_modules/content-disposition/README.md +141 -0
  294. package/backend/node_modules/content-disposition/index.js +536 -0
  295. package/backend/node_modules/content-disposition/package.json +40 -0
  296. package/backend/node_modules/content-type/HISTORY.md +29 -0
  297. package/backend/node_modules/content-type/LICENSE +22 -0
  298. package/backend/node_modules/content-type/README.md +94 -0
  299. package/backend/node_modules/content-type/index.js +225 -0
  300. package/backend/node_modules/content-type/package.json +42 -0
  301. package/backend/node_modules/cookie/LICENSE +24 -0
  302. package/backend/node_modules/cookie/README.md +317 -0
  303. package/backend/node_modules/cookie/SECURITY.md +25 -0
  304. package/backend/node_modules/cookie/index.js +335 -0
  305. package/backend/node_modules/cookie/package.json +44 -0
  306. package/backend/node_modules/cookie-signature/History.md +70 -0
  307. package/backend/node_modules/cookie-signature/LICENSE +22 -0
  308. package/backend/node_modules/cookie-signature/Readme.md +23 -0
  309. package/backend/node_modules/cookie-signature/index.js +47 -0
  310. package/backend/node_modules/cookie-signature/package.json +24 -0
  311. package/backend/node_modules/cors/LICENSE +22 -0
  312. package/backend/node_modules/cors/README.md +277 -0
  313. package/backend/node_modules/cors/lib/index.js +238 -0
  314. package/backend/node_modules/cors/package.json +42 -0
  315. package/backend/node_modules/debug/LICENSE +20 -0
  316. package/backend/node_modules/debug/README.md +481 -0
  317. package/backend/node_modules/debug/package.json +64 -0
  318. package/backend/node_modules/debug/src/browser.js +272 -0
  319. package/backend/node_modules/debug/src/common.js +292 -0
  320. package/backend/node_modules/debug/src/index.js +10 -0
  321. package/backend/node_modules/debug/src/node.js +263 -0
  322. package/backend/node_modules/denque/CHANGELOG.md +29 -0
  323. package/backend/node_modules/denque/LICENSE +201 -0
  324. package/backend/node_modules/denque/README.md +77 -0
  325. package/backend/node_modules/denque/index.d.ts +47 -0
  326. package/backend/node_modules/denque/index.js +481 -0
  327. package/backend/node_modules/denque/package.json +58 -0
  328. package/backend/node_modules/depd/History.md +103 -0
  329. package/backend/node_modules/depd/LICENSE +22 -0
  330. package/backend/node_modules/depd/Readme.md +280 -0
  331. package/backend/node_modules/depd/index.js +538 -0
  332. package/backend/node_modules/depd/lib/browser/index.js +77 -0
  333. package/backend/node_modules/depd/package.json +45 -0
  334. package/backend/node_modules/dunder-proto/.eslintrc +5 -0
  335. package/backend/node_modules/dunder-proto/.github/FUNDING.yml +12 -0
  336. package/backend/node_modules/dunder-proto/.nycrc +13 -0
  337. package/backend/node_modules/dunder-proto/CHANGELOG.md +24 -0
  338. package/backend/node_modules/dunder-proto/LICENSE +21 -0
  339. package/backend/node_modules/dunder-proto/README.md +54 -0
  340. package/backend/node_modules/dunder-proto/get.d.ts +5 -0
  341. package/backend/node_modules/dunder-proto/get.js +30 -0
  342. package/backend/node_modules/dunder-proto/package.json +76 -0
  343. package/backend/node_modules/dunder-proto/set.d.ts +5 -0
  344. package/backend/node_modules/dunder-proto/set.js +35 -0
  345. package/backend/node_modules/dunder-proto/test/get.js +34 -0
  346. package/backend/node_modules/dunder-proto/test/index.js +4 -0
  347. package/backend/node_modules/dunder-proto/test/set.js +50 -0
  348. package/backend/node_modules/dunder-proto/tsconfig.json +9 -0
  349. package/backend/node_modules/ecdsa-sig-formatter/CODEOWNERS +1 -0
  350. package/backend/node_modules/ecdsa-sig-formatter/LICENSE +201 -0
  351. package/backend/node_modules/ecdsa-sig-formatter/README.md +65 -0
  352. package/backend/node_modules/ecdsa-sig-formatter/package.json +46 -0
  353. package/backend/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.d.ts +17 -0
  354. package/backend/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js +187 -0
  355. package/backend/node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js +23 -0
  356. package/backend/node_modules/ee-first/LICENSE +22 -0
  357. package/backend/node_modules/ee-first/README.md +80 -0
  358. package/backend/node_modules/ee-first/index.js +95 -0
  359. package/backend/node_modules/ee-first/package.json +29 -0
  360. package/backend/node_modules/encodeurl/LICENSE +22 -0
  361. package/backend/node_modules/encodeurl/README.md +109 -0
  362. package/backend/node_modules/encodeurl/index.js +60 -0
  363. package/backend/node_modules/encodeurl/package.json +40 -0
  364. package/backend/node_modules/es-define-property/.eslintrc +13 -0
  365. package/backend/node_modules/es-define-property/.github/FUNDING.yml +12 -0
  366. package/backend/node_modules/es-define-property/.nycrc +9 -0
  367. package/backend/node_modules/es-define-property/CHANGELOG.md +29 -0
  368. package/backend/node_modules/es-define-property/LICENSE +21 -0
  369. package/backend/node_modules/es-define-property/README.md +49 -0
  370. package/backend/node_modules/es-define-property/index.d.ts +3 -0
  371. package/backend/node_modules/es-define-property/index.js +14 -0
  372. package/backend/node_modules/es-define-property/package.json +81 -0
  373. package/backend/node_modules/es-define-property/test/index.js +56 -0
  374. package/backend/node_modules/es-define-property/tsconfig.json +10 -0
  375. package/backend/node_modules/es-errors/.eslintrc +5 -0
  376. package/backend/node_modules/es-errors/.github/FUNDING.yml +12 -0
  377. package/backend/node_modules/es-errors/CHANGELOG.md +40 -0
  378. package/backend/node_modules/es-errors/LICENSE +21 -0
  379. package/backend/node_modules/es-errors/README.md +55 -0
  380. package/backend/node_modules/es-errors/eval.d.ts +3 -0
  381. package/backend/node_modules/es-errors/eval.js +4 -0
  382. package/backend/node_modules/es-errors/index.d.ts +3 -0
  383. package/backend/node_modules/es-errors/index.js +4 -0
  384. package/backend/node_modules/es-errors/package.json +80 -0
  385. package/backend/node_modules/es-errors/range.d.ts +3 -0
  386. package/backend/node_modules/es-errors/range.js +4 -0
  387. package/backend/node_modules/es-errors/ref.d.ts +3 -0
  388. package/backend/node_modules/es-errors/ref.js +4 -0
  389. package/backend/node_modules/es-errors/syntax.d.ts +3 -0
  390. package/backend/node_modules/es-errors/syntax.js +4 -0
  391. package/backend/node_modules/es-errors/test/index.js +19 -0
  392. package/backend/node_modules/es-errors/tsconfig.json +49 -0
  393. package/backend/node_modules/es-errors/type.d.ts +3 -0
  394. package/backend/node_modules/es-errors/type.js +4 -0
  395. package/backend/node_modules/es-errors/uri.d.ts +3 -0
  396. package/backend/node_modules/es-errors/uri.js +4 -0
  397. package/backend/node_modules/es-object-atoms/.eslintrc +16 -0
  398. package/backend/node_modules/es-object-atoms/.github/FUNDING.yml +12 -0
  399. package/backend/node_modules/es-object-atoms/CHANGELOG.md +37 -0
  400. package/backend/node_modules/es-object-atoms/LICENSE +21 -0
  401. package/backend/node_modules/es-object-atoms/README.md +63 -0
  402. package/backend/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +3 -0
  403. package/backend/node_modules/es-object-atoms/RequireObjectCoercible.js +11 -0
  404. package/backend/node_modules/es-object-atoms/ToObject.d.ts +7 -0
  405. package/backend/node_modules/es-object-atoms/ToObject.js +10 -0
  406. package/backend/node_modules/es-object-atoms/index.d.ts +3 -0
  407. package/backend/node_modules/es-object-atoms/index.js +4 -0
  408. package/backend/node_modules/es-object-atoms/isObject.d.ts +3 -0
  409. package/backend/node_modules/es-object-atoms/isObject.js +6 -0
  410. package/backend/node_modules/es-object-atoms/package.json +80 -0
  411. package/backend/node_modules/es-object-atoms/test/index.js +38 -0
  412. package/backend/node_modules/es-object-atoms/tsconfig.json +6 -0
  413. package/backend/node_modules/escape-html/LICENSE +24 -0
  414. package/backend/node_modules/escape-html/Readme.md +43 -0
  415. package/backend/node_modules/escape-html/index.js +78 -0
  416. package/backend/node_modules/escape-html/package.json +24 -0
  417. package/backend/node_modules/etag/HISTORY.md +83 -0
  418. package/backend/node_modules/etag/LICENSE +22 -0
  419. package/backend/node_modules/etag/README.md +159 -0
  420. package/backend/node_modules/etag/index.js +131 -0
  421. package/backend/node_modules/etag/package.json +47 -0
  422. package/backend/node_modules/express/LICENSE +24 -0
  423. package/backend/node_modules/express/Readme.md +276 -0
  424. package/backend/node_modules/express/index.js +11 -0
  425. package/backend/node_modules/express/lib/application.js +631 -0
  426. package/backend/node_modules/express/lib/express.js +81 -0
  427. package/backend/node_modules/express/lib/request.js +514 -0
  428. package/backend/node_modules/express/lib/response.js +1053 -0
  429. package/backend/node_modules/express/lib/utils.js +271 -0
  430. package/backend/node_modules/express/lib/view.js +205 -0
  431. package/backend/node_modules/express/package.json +99 -0
  432. package/backend/node_modules/fill-range/LICENSE +21 -0
  433. package/backend/node_modules/fill-range/README.md +237 -0
  434. package/backend/node_modules/fill-range/index.js +248 -0
  435. package/backend/node_modules/fill-range/package.json +74 -0
  436. package/backend/node_modules/finalhandler/HISTORY.md +239 -0
  437. package/backend/node_modules/finalhandler/LICENSE +22 -0
  438. package/backend/node_modules/finalhandler/README.md +150 -0
  439. package/backend/node_modules/finalhandler/index.js +293 -0
  440. package/backend/node_modules/finalhandler/package.json +47 -0
  441. package/backend/node_modules/forwarded/HISTORY.md +21 -0
  442. package/backend/node_modules/forwarded/LICENSE +22 -0
  443. package/backend/node_modules/forwarded/README.md +57 -0
  444. package/backend/node_modules/forwarded/index.js +90 -0
  445. package/backend/node_modules/forwarded/package.json +45 -0
  446. package/backend/node_modules/fresh/HISTORY.md +80 -0
  447. package/backend/node_modules/fresh/LICENSE +23 -0
  448. package/backend/node_modules/fresh/README.md +117 -0
  449. package/backend/node_modules/fresh/index.js +136 -0
  450. package/backend/node_modules/fresh/package.json +46 -0
  451. package/backend/node_modules/function-bind/.eslintrc +21 -0
  452. package/backend/node_modules/function-bind/.github/FUNDING.yml +12 -0
  453. package/backend/node_modules/function-bind/.github/SECURITY.md +3 -0
  454. package/backend/node_modules/function-bind/.nycrc +13 -0
  455. package/backend/node_modules/function-bind/CHANGELOG.md +136 -0
  456. package/backend/node_modules/function-bind/LICENSE +20 -0
  457. package/backend/node_modules/function-bind/README.md +46 -0
  458. package/backend/node_modules/function-bind/implementation.js +84 -0
  459. package/backend/node_modules/function-bind/index.js +5 -0
  460. package/backend/node_modules/function-bind/package.json +87 -0
  461. package/backend/node_modules/function-bind/test/.eslintrc +9 -0
  462. package/backend/node_modules/function-bind/test/index.js +252 -0
  463. package/backend/node_modules/generate-function/.travis.yml +3 -0
  464. package/backend/node_modules/generate-function/LICENSE +21 -0
  465. package/backend/node_modules/generate-function/README.md +89 -0
  466. package/backend/node_modules/generate-function/example.js +27 -0
  467. package/backend/node_modules/generate-function/index.js +181 -0
  468. package/backend/node_modules/generate-function/package.json +32 -0
  469. package/backend/node_modules/generate-function/test.js +49 -0
  470. package/backend/node_modules/get-intrinsic/.eslintrc +42 -0
  471. package/backend/node_modules/get-intrinsic/.github/FUNDING.yml +12 -0
  472. package/backend/node_modules/get-intrinsic/.nycrc +9 -0
  473. package/backend/node_modules/get-intrinsic/CHANGELOG.md +186 -0
  474. package/backend/node_modules/get-intrinsic/LICENSE +21 -0
  475. package/backend/node_modules/get-intrinsic/README.md +71 -0
  476. package/backend/node_modules/get-intrinsic/index.js +378 -0
  477. package/backend/node_modules/get-intrinsic/package.json +97 -0
  478. package/backend/node_modules/get-intrinsic/test/GetIntrinsic.js +274 -0
  479. package/backend/node_modules/get-proto/.eslintrc +10 -0
  480. package/backend/node_modules/get-proto/.github/FUNDING.yml +12 -0
  481. package/backend/node_modules/get-proto/.nycrc +9 -0
  482. package/backend/node_modules/get-proto/CHANGELOG.md +21 -0
  483. package/backend/node_modules/get-proto/LICENSE +21 -0
  484. package/backend/node_modules/get-proto/Object.getPrototypeOf.d.ts +5 -0
  485. package/backend/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
  486. package/backend/node_modules/get-proto/README.md +50 -0
  487. package/backend/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +3 -0
  488. package/backend/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
  489. package/backend/node_modules/get-proto/index.d.ts +5 -0
  490. package/backend/node_modules/get-proto/index.js +27 -0
  491. package/backend/node_modules/get-proto/package.json +81 -0
  492. package/backend/node_modules/get-proto/test/index.js +68 -0
  493. package/backend/node_modules/get-proto/tsconfig.json +9 -0
  494. package/backend/node_modules/glob-parent/CHANGELOG.md +110 -0
  495. package/backend/node_modules/glob-parent/LICENSE +15 -0
  496. package/backend/node_modules/glob-parent/README.md +137 -0
  497. package/backend/node_modules/glob-parent/index.js +42 -0
  498. package/backend/node_modules/glob-parent/package.json +48 -0
  499. package/backend/node_modules/gopd/.eslintrc +16 -0
  500. package/backend/node_modules/gopd/.github/FUNDING.yml +12 -0
  501. package/backend/node_modules/gopd/CHANGELOG.md +45 -0
  502. package/backend/node_modules/gopd/LICENSE +21 -0
  503. package/backend/node_modules/gopd/README.md +40 -0
  504. package/backend/node_modules/gopd/gOPD.d.ts +1 -0
  505. package/backend/node_modules/gopd/gOPD.js +4 -0
  506. package/backend/node_modules/gopd/index.d.ts +5 -0
  507. package/backend/node_modules/gopd/index.js +15 -0
  508. package/backend/node_modules/gopd/package.json +77 -0
  509. package/backend/node_modules/gopd/test/index.js +36 -0
  510. package/backend/node_modules/gopd/tsconfig.json +9 -0
  511. package/backend/node_modules/has-flag/index.js +8 -0
  512. package/backend/node_modules/has-flag/license +9 -0
  513. package/backend/node_modules/has-flag/package.json +44 -0
  514. package/backend/node_modules/has-flag/readme.md +70 -0
  515. package/backend/node_modules/has-symbols/.eslintrc +11 -0
  516. package/backend/node_modules/has-symbols/.github/FUNDING.yml +12 -0
  517. package/backend/node_modules/has-symbols/.nycrc +9 -0
  518. package/backend/node_modules/has-symbols/CHANGELOG.md +91 -0
  519. package/backend/node_modules/has-symbols/LICENSE +21 -0
  520. package/backend/node_modules/has-symbols/README.md +46 -0
  521. package/backend/node_modules/has-symbols/index.d.ts +3 -0
  522. package/backend/node_modules/has-symbols/index.js +14 -0
  523. package/backend/node_modules/has-symbols/package.json +111 -0
  524. package/backend/node_modules/has-symbols/shams.d.ts +3 -0
  525. package/backend/node_modules/has-symbols/shams.js +45 -0
  526. package/backend/node_modules/has-symbols/test/index.js +22 -0
  527. package/backend/node_modules/has-symbols/test/shams/core-js.js +29 -0
  528. package/backend/node_modules/has-symbols/test/shams/get-own-property-symbols.js +29 -0
  529. package/backend/node_modules/has-symbols/test/tests.js +58 -0
  530. package/backend/node_modules/has-symbols/tsconfig.json +10 -0
  531. package/backend/node_modules/hasown/.github/FUNDING.yml +12 -0
  532. package/backend/node_modules/hasown/.nycrc +13 -0
  533. package/backend/node_modules/hasown/CHANGELOG.md +51 -0
  534. package/backend/node_modules/hasown/LICENSE +21 -0
  535. package/backend/node_modules/hasown/README.md +40 -0
  536. package/backend/node_modules/hasown/eslint.config.mjs +6 -0
  537. package/backend/node_modules/hasown/index.d.ts +4 -0
  538. package/backend/node_modules/hasown/index.js +8 -0
  539. package/backend/node_modules/hasown/package.json +92 -0
  540. package/backend/node_modules/hasown/tsconfig.json +6 -0
  541. package/backend/node_modules/http-errors/HISTORY.md +186 -0
  542. package/backend/node_modules/http-errors/LICENSE +23 -0
  543. package/backend/node_modules/http-errors/README.md +169 -0
  544. package/backend/node_modules/http-errors/index.js +290 -0
  545. package/backend/node_modules/http-errors/package.json +54 -0
  546. package/backend/node_modules/iconv-lite/LICENSE +21 -0
  547. package/backend/node_modules/iconv-lite/README.md +138 -0
  548. package/backend/node_modules/iconv-lite/encodings/dbcs-codec.js +532 -0
  549. package/backend/node_modules/iconv-lite/encodings/dbcs-data.js +185 -0
  550. package/backend/node_modules/iconv-lite/encodings/index.js +23 -0
  551. package/backend/node_modules/iconv-lite/encodings/internal.js +218 -0
  552. package/backend/node_modules/iconv-lite/encodings/sbcs-codec.js +75 -0
  553. package/backend/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
  554. package/backend/node_modules/iconv-lite/encodings/sbcs-data.js +178 -0
  555. package/backend/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
  556. package/backend/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
  557. package/backend/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
  558. package/backend/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
  559. package/backend/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
  560. package/backend/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
  561. package/backend/node_modules/iconv-lite/encodings/tables/gbk-added.json +56 -0
  562. package/backend/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
  563. package/backend/node_modules/iconv-lite/encodings/utf16.js +187 -0
  564. package/backend/node_modules/iconv-lite/encodings/utf32.js +307 -0
  565. package/backend/node_modules/iconv-lite/encodings/utf7.js +283 -0
  566. package/backend/node_modules/iconv-lite/lib/bom-handling.js +48 -0
  567. package/backend/node_modules/iconv-lite/lib/helpers/merge-exports.js +13 -0
  568. package/backend/node_modules/iconv-lite/lib/index.d.ts +129 -0
  569. package/backend/node_modules/iconv-lite/lib/index.js +182 -0
  570. package/backend/node_modules/iconv-lite/lib/streams.js +105 -0
  571. package/backend/node_modules/iconv-lite/package.json +70 -0
  572. package/backend/node_modules/iconv-lite/types/encodings.d.ts +423 -0
  573. package/backend/node_modules/ignore-by-default/LICENSE +14 -0
  574. package/backend/node_modules/ignore-by-default/README.md +26 -0
  575. package/backend/node_modules/ignore-by-default/index.js +12 -0
  576. package/backend/node_modules/ignore-by-default/package.json +34 -0
  577. package/backend/node_modules/inherits/LICENSE +16 -0
  578. package/backend/node_modules/inherits/README.md +42 -0
  579. package/backend/node_modules/inherits/inherits.js +9 -0
  580. package/backend/node_modules/inherits/inherits_browser.js +27 -0
  581. package/backend/node_modules/inherits/package.json +29 -0
  582. package/backend/node_modules/ipaddr.js/LICENSE +19 -0
  583. package/backend/node_modules/ipaddr.js/README.md +233 -0
  584. package/backend/node_modules/ipaddr.js/ipaddr.min.js +1 -0
  585. package/backend/node_modules/ipaddr.js/lib/ipaddr.js +673 -0
  586. package/backend/node_modules/ipaddr.js/lib/ipaddr.js.d.ts +68 -0
  587. package/backend/node_modules/ipaddr.js/package.json +35 -0
  588. package/backend/node_modules/is-binary-path/index.d.ts +17 -0
  589. package/backend/node_modules/is-binary-path/index.js +7 -0
  590. package/backend/node_modules/is-binary-path/license +9 -0
  591. package/backend/node_modules/is-binary-path/package.json +40 -0
  592. package/backend/node_modules/is-binary-path/readme.md +34 -0
  593. package/backend/node_modules/is-extglob/LICENSE +21 -0
  594. package/backend/node_modules/is-extglob/README.md +107 -0
  595. package/backend/node_modules/is-extglob/index.js +20 -0
  596. package/backend/node_modules/is-extglob/package.json +69 -0
  597. package/backend/node_modules/is-glob/LICENSE +21 -0
  598. package/backend/node_modules/is-glob/README.md +206 -0
  599. package/backend/node_modules/is-glob/index.js +150 -0
  600. package/backend/node_modules/is-glob/package.json +81 -0
  601. package/backend/node_modules/is-number/LICENSE +21 -0
  602. package/backend/node_modules/is-number/README.md +187 -0
  603. package/backend/node_modules/is-number/index.js +18 -0
  604. package/backend/node_modules/is-number/package.json +82 -0
  605. package/backend/node_modules/is-promise/LICENSE +19 -0
  606. package/backend/node_modules/is-promise/index.d.ts +2 -0
  607. package/backend/node_modules/is-promise/index.js +6 -0
  608. package/backend/node_modules/is-promise/index.mjs +3 -0
  609. package/backend/node_modules/is-promise/package.json +30 -0
  610. package/backend/node_modules/is-promise/readme.md +33 -0
  611. package/backend/node_modules/is-property/LICENSE +22 -0
  612. package/backend/node_modules/is-property/README.md +28 -0
  613. package/backend/node_modules/is-property/is-property.js +5 -0
  614. package/backend/node_modules/is-property/package.json +36 -0
  615. package/backend/node_modules/json/.gitmodules +3 -0
  616. package/backend/node_modules/json/.jshintrc +3 -0
  617. package/backend/node_modules/json/CHANGES.md +1050 -0
  618. package/backend/node_modules/json/LICENSE.txt +24 -0
  619. package/backend/node_modules/json/README.md +122 -0
  620. package/backend/node_modules/json/lib/json.js +1765 -0
  621. package/backend/node_modules/json/man/man1/json.1 +1151 -0
  622. package/backend/node_modules/json/package.json +38 -0
  623. package/backend/node_modules/jsonwebtoken/LICENSE +21 -0
  624. package/backend/node_modules/jsonwebtoken/README.md +396 -0
  625. package/backend/node_modules/jsonwebtoken/decode.js +30 -0
  626. package/backend/node_modules/jsonwebtoken/index.js +8 -0
  627. package/backend/node_modules/jsonwebtoken/lib/JsonWebTokenError.js +14 -0
  628. package/backend/node_modules/jsonwebtoken/lib/NotBeforeError.js +13 -0
  629. package/backend/node_modules/jsonwebtoken/lib/TokenExpiredError.js +13 -0
  630. package/backend/node_modules/jsonwebtoken/lib/asymmetricKeyDetailsSupported.js +3 -0
  631. package/backend/node_modules/jsonwebtoken/lib/psSupported.js +3 -0
  632. package/backend/node_modules/jsonwebtoken/lib/rsaPssKeyDetailsSupported.js +3 -0
  633. package/backend/node_modules/jsonwebtoken/lib/timespan.js +18 -0
  634. package/backend/node_modules/jsonwebtoken/lib/validateAsymmetricKey.js +66 -0
  635. package/backend/node_modules/jsonwebtoken/package.json +70 -0
  636. package/backend/node_modules/jsonwebtoken/sign.js +253 -0
  637. package/backend/node_modules/jsonwebtoken/verify.js +263 -0
  638. package/backend/node_modules/jwa/LICENSE +17 -0
  639. package/backend/node_modules/jwa/README.md +150 -0
  640. package/backend/node_modules/jwa/index.js +266 -0
  641. package/backend/node_modules/jwa/opslevel.yml +6 -0
  642. package/backend/node_modules/jwa/package.json +37 -0
  643. package/backend/node_modules/jws/CHANGELOG.md +56 -0
  644. package/backend/node_modules/jws/LICENSE +17 -0
  645. package/backend/node_modules/jws/index.js +22 -0
  646. package/backend/node_modules/jws/lib/data-stream.js +55 -0
  647. package/backend/node_modules/jws/lib/sign-stream.js +83 -0
  648. package/backend/node_modules/jws/lib/tostring.js +10 -0
  649. package/backend/node_modules/jws/lib/verify-stream.js +125 -0
  650. package/backend/node_modules/jws/opslevel.yml +6 -0
  651. package/backend/node_modules/jws/package.json +34 -0
  652. package/backend/node_modules/jws/readme.md +255 -0
  653. package/backend/node_modules/lodash.includes/LICENSE +47 -0
  654. package/backend/node_modules/lodash.includes/README.md +18 -0
  655. package/backend/node_modules/lodash.includes/index.js +745 -0
  656. package/backend/node_modules/lodash.includes/package.json +17 -0
  657. package/backend/node_modules/lodash.isboolean/LICENSE +22 -0
  658. package/backend/node_modules/lodash.isboolean/README.md +18 -0
  659. package/backend/node_modules/lodash.isboolean/index.js +70 -0
  660. package/backend/node_modules/lodash.isboolean/package.json +17 -0
  661. package/backend/node_modules/lodash.isinteger/LICENSE +47 -0
  662. package/backend/node_modules/lodash.isinteger/README.md +18 -0
  663. package/backend/node_modules/lodash.isinteger/index.js +265 -0
  664. package/backend/node_modules/lodash.isinteger/package.json +17 -0
  665. package/backend/node_modules/lodash.isnumber/LICENSE +22 -0
  666. package/backend/node_modules/lodash.isnumber/README.md +18 -0
  667. package/backend/node_modules/lodash.isnumber/index.js +79 -0
  668. package/backend/node_modules/lodash.isnumber/package.json +17 -0
  669. package/backend/node_modules/lodash.isplainobject/LICENSE +47 -0
  670. package/backend/node_modules/lodash.isplainobject/README.md +18 -0
  671. package/backend/node_modules/lodash.isplainobject/index.js +139 -0
  672. package/backend/node_modules/lodash.isplainobject/package.json +17 -0
  673. package/backend/node_modules/lodash.isstring/LICENSE +22 -0
  674. package/backend/node_modules/lodash.isstring/README.md +18 -0
  675. package/backend/node_modules/lodash.isstring/index.js +95 -0
  676. package/backend/node_modules/lodash.isstring/package.json +17 -0
  677. package/backend/node_modules/lodash.once/LICENSE +47 -0
  678. package/backend/node_modules/lodash.once/README.md +18 -0
  679. package/backend/node_modules/lodash.once/index.js +294 -0
  680. package/backend/node_modules/lodash.once/package.json +17 -0
  681. package/backend/node_modules/long/LICENSE +202 -0
  682. package/backend/node_modules/long/README.md +286 -0
  683. package/backend/node_modules/long/index.d.ts +2 -0
  684. package/backend/node_modules/long/index.js +1581 -0
  685. package/backend/node_modules/long/package.json +58 -0
  686. package/backend/node_modules/long/types.d.ts +474 -0
  687. package/backend/node_modules/long/umd/index.d.ts +3 -0
  688. package/backend/node_modules/long/umd/index.js +1622 -0
  689. package/backend/node_modules/long/umd/package.json +3 -0
  690. package/backend/node_modules/long/umd/types.d.ts +474 -0
  691. package/backend/node_modules/lru.min/LICENSE +21 -0
  692. package/backend/node_modules/lru.min/README.md +392 -0
  693. package/backend/node_modules/lru.min/browser/lru.min.js +1 -0
  694. package/backend/node_modules/lru.min/lib/index.d.ts +38 -0
  695. package/backend/node_modules/lru.min/lib/index.js +248 -0
  696. package/backend/node_modules/lru.min/lib/index.mjs +227 -0
  697. package/backend/node_modules/lru.min/package.json +87 -0
  698. package/backend/node_modules/math-intrinsics/.eslintrc +16 -0
  699. package/backend/node_modules/math-intrinsics/.github/FUNDING.yml +12 -0
  700. package/backend/node_modules/math-intrinsics/CHANGELOG.md +24 -0
  701. package/backend/node_modules/math-intrinsics/LICENSE +21 -0
  702. package/backend/node_modules/math-intrinsics/README.md +50 -0
  703. package/backend/node_modules/math-intrinsics/abs.d.ts +1 -0
  704. package/backend/node_modules/math-intrinsics/abs.js +4 -0
  705. package/backend/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +3 -0
  706. package/backend/node_modules/math-intrinsics/constants/maxArrayLength.js +4 -0
  707. package/backend/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +3 -0
  708. package/backend/node_modules/math-intrinsics/constants/maxSafeInteger.js +5 -0
  709. package/backend/node_modules/math-intrinsics/constants/maxValue.d.ts +3 -0
  710. package/backend/node_modules/math-intrinsics/constants/maxValue.js +5 -0
  711. package/backend/node_modules/math-intrinsics/floor.d.ts +1 -0
  712. package/backend/node_modules/math-intrinsics/floor.js +4 -0
  713. package/backend/node_modules/math-intrinsics/isFinite.d.ts +3 -0
  714. package/backend/node_modules/math-intrinsics/isFinite.js +12 -0
  715. package/backend/node_modules/math-intrinsics/isInteger.d.ts +3 -0
  716. package/backend/node_modules/math-intrinsics/isInteger.js +16 -0
  717. package/backend/node_modules/math-intrinsics/isNaN.d.ts +1 -0
  718. package/backend/node_modules/math-intrinsics/isNaN.js +6 -0
  719. package/backend/node_modules/math-intrinsics/isNegativeZero.d.ts +3 -0
  720. package/backend/node_modules/math-intrinsics/isNegativeZero.js +6 -0
  721. package/backend/node_modules/math-intrinsics/max.d.ts +1 -0
  722. package/backend/node_modules/math-intrinsics/max.js +4 -0
  723. package/backend/node_modules/math-intrinsics/min.d.ts +1 -0
  724. package/backend/node_modules/math-intrinsics/min.js +4 -0
  725. package/backend/node_modules/math-intrinsics/mod.d.ts +3 -0
  726. package/backend/node_modules/math-intrinsics/mod.js +9 -0
  727. package/backend/node_modules/math-intrinsics/package.json +86 -0
  728. package/backend/node_modules/math-intrinsics/pow.d.ts +1 -0
  729. package/backend/node_modules/math-intrinsics/pow.js +4 -0
  730. package/backend/node_modules/math-intrinsics/round.d.ts +1 -0
  731. package/backend/node_modules/math-intrinsics/round.js +4 -0
  732. package/backend/node_modules/math-intrinsics/sign.d.ts +3 -0
  733. package/backend/node_modules/math-intrinsics/sign.js +11 -0
  734. package/backend/node_modules/math-intrinsics/test/index.js +192 -0
  735. package/backend/node_modules/math-intrinsics/tsconfig.json +3 -0
  736. package/backend/node_modules/media-typer/HISTORY.md +50 -0
  737. package/backend/node_modules/media-typer/LICENSE +22 -0
  738. package/backend/node_modules/media-typer/README.md +93 -0
  739. package/backend/node_modules/media-typer/index.js +143 -0
  740. package/backend/node_modules/media-typer/package.json +33 -0
  741. package/backend/node_modules/merge-descriptors/index.d.ts +11 -0
  742. package/backend/node_modules/merge-descriptors/index.js +26 -0
  743. package/backend/node_modules/merge-descriptors/license +11 -0
  744. package/backend/node_modules/merge-descriptors/package.json +50 -0
  745. package/backend/node_modules/merge-descriptors/readme.md +55 -0
  746. package/backend/node_modules/mime-db/HISTORY.md +541 -0
  747. package/backend/node_modules/mime-db/LICENSE +23 -0
  748. package/backend/node_modules/mime-db/README.md +109 -0
  749. package/backend/node_modules/mime-db/db.json +9342 -0
  750. package/backend/node_modules/mime-db/index.js +12 -0
  751. package/backend/node_modules/mime-db/package.json +56 -0
  752. package/backend/node_modules/mime-types/HISTORY.md +428 -0
  753. package/backend/node_modules/mime-types/LICENSE +23 -0
  754. package/backend/node_modules/mime-types/README.md +126 -0
  755. package/backend/node_modules/mime-types/index.js +211 -0
  756. package/backend/node_modules/mime-types/mimeScore.js +57 -0
  757. package/backend/node_modules/mime-types/package.json +49 -0
  758. package/backend/node_modules/minimatch/LICENSE.md +55 -0
  759. package/backend/node_modules/minimatch/README.md +528 -0
  760. package/backend/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts +2 -0
  761. package/backend/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map +1 -0
  762. package/backend/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
  763. package/backend/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map +1 -0
  764. package/backend/node_modules/minimatch/dist/commonjs/ast.d.ts +22 -0
  765. package/backend/node_modules/minimatch/dist/commonjs/ast.d.ts.map +1 -0
  766. package/backend/node_modules/minimatch/dist/commonjs/ast.js +845 -0
  767. package/backend/node_modules/minimatch/dist/commonjs/ast.js.map +1 -0
  768. package/backend/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts +8 -0
  769. package/backend/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map +1 -0
  770. package/backend/node_modules/minimatch/dist/commonjs/brace-expressions.js +150 -0
  771. package/backend/node_modules/minimatch/dist/commonjs/brace-expressions.js.map +1 -0
  772. package/backend/node_modules/minimatch/dist/commonjs/escape.d.ts +15 -0
  773. package/backend/node_modules/minimatch/dist/commonjs/escape.d.ts.map +1 -0
  774. package/backend/node_modules/minimatch/dist/commonjs/escape.js +30 -0
  775. package/backend/node_modules/minimatch/dist/commonjs/escape.js.map +1 -0
  776. package/backend/node_modules/minimatch/dist/commonjs/index.d.ts +174 -0
  777. package/backend/node_modules/minimatch/dist/commonjs/index.d.ts.map +1 -0
  778. package/backend/node_modules/minimatch/dist/commonjs/index.js +1127 -0
  779. package/backend/node_modules/minimatch/dist/commonjs/index.js.map +1 -0
  780. package/backend/node_modules/minimatch/dist/commonjs/package.json +3 -0
  781. package/backend/node_modules/minimatch/dist/commonjs/unescape.d.ts +22 -0
  782. package/backend/node_modules/minimatch/dist/commonjs/unescape.d.ts.map +1 -0
  783. package/backend/node_modules/minimatch/dist/commonjs/unescape.js +38 -0
  784. package/backend/node_modules/minimatch/dist/commonjs/unescape.js.map +1 -0
  785. package/backend/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts +2 -0
  786. package/backend/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map +1 -0
  787. package/backend/node_modules/minimatch/dist/esm/assert-valid-pattern.js +10 -0
  788. package/backend/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +1 -0
  789. package/backend/node_modules/minimatch/dist/esm/ast.d.ts +22 -0
  790. package/backend/node_modules/minimatch/dist/esm/ast.d.ts.map +1 -0
  791. package/backend/node_modules/minimatch/dist/esm/ast.js +841 -0
  792. package/backend/node_modules/minimatch/dist/esm/ast.js.map +1 -0
  793. package/backend/node_modules/minimatch/dist/esm/brace-expressions.d.ts +8 -0
  794. package/backend/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map +1 -0
  795. package/backend/node_modules/minimatch/dist/esm/brace-expressions.js +146 -0
  796. package/backend/node_modules/minimatch/dist/esm/brace-expressions.js.map +1 -0
  797. package/backend/node_modules/minimatch/dist/esm/escape.d.ts +15 -0
  798. package/backend/node_modules/minimatch/dist/esm/escape.d.ts.map +1 -0
  799. package/backend/node_modules/minimatch/dist/esm/escape.js +26 -0
  800. package/backend/node_modules/minimatch/dist/esm/escape.js.map +1 -0
  801. package/backend/node_modules/minimatch/dist/esm/index.d.ts +174 -0
  802. package/backend/node_modules/minimatch/dist/esm/index.d.ts.map +1 -0
  803. package/backend/node_modules/minimatch/dist/esm/index.js +1114 -0
  804. package/backend/node_modules/minimatch/dist/esm/index.js.map +1 -0
  805. package/backend/node_modules/minimatch/dist/esm/package.json +3 -0
  806. package/backend/node_modules/minimatch/dist/esm/unescape.d.ts +22 -0
  807. package/backend/node_modules/minimatch/dist/esm/unescape.d.ts.map +1 -0
  808. package/backend/node_modules/minimatch/dist/esm/unescape.js +34 -0
  809. package/backend/node_modules/minimatch/dist/esm/unescape.js.map +1 -0
  810. package/backend/node_modules/minimatch/package.json +73 -0
  811. package/backend/node_modules/ms/index.js +162 -0
  812. package/backend/node_modules/ms/license.md +21 -0
  813. package/backend/node_modules/ms/package.json +38 -0
  814. package/backend/node_modules/ms/readme.md +59 -0
  815. package/backend/node_modules/mysql2/License +19 -0
  816. package/backend/node_modules/mysql2/README.md +114 -0
  817. package/backend/node_modules/mysql2/index.d.ts +1 -0
  818. package/backend/node_modules/mysql2/index.js +77 -0
  819. package/backend/node_modules/mysql2/lib/auth_41.js +95 -0
  820. package/backend/node_modules/mysql2/lib/auth_plugins/caching_sha2_password.js +115 -0
  821. package/backend/node_modules/mysql2/lib/auth_plugins/caching_sha2_password.md +18 -0
  822. package/backend/node_modules/mysql2/lib/auth_plugins/index.js +8 -0
  823. package/backend/node_modules/mysql2/lib/auth_plugins/mysql_clear_password.js +17 -0
  824. package/backend/node_modules/mysql2/lib/auth_plugins/mysql_native_password.js +34 -0
  825. package/backend/node_modules/mysql2/lib/auth_plugins/sha256_password.js +74 -0
  826. package/backend/node_modules/mysql2/lib/base/connection.js +1139 -0
  827. package/backend/node_modules/mysql2/lib/base/pool.js +343 -0
  828. package/backend/node_modules/mysql2/lib/commands/auth_switch.js +151 -0
  829. package/backend/node_modules/mysql2/lib/commands/binlog_dump.js +109 -0
  830. package/backend/node_modules/mysql2/lib/commands/change_user.js +68 -0
  831. package/backend/node_modules/mysql2/lib/commands/client_handshake.js +386 -0
  832. package/backend/node_modules/mysql2/lib/commands/close_statement.js +18 -0
  833. package/backend/node_modules/mysql2/lib/commands/command.js +54 -0
  834. package/backend/node_modules/mysql2/lib/commands/execute.js +116 -0
  835. package/backend/node_modules/mysql2/lib/commands/index.js +29 -0
  836. package/backend/node_modules/mysql2/lib/commands/ping.js +36 -0
  837. package/backend/node_modules/mysql2/lib/commands/prepare.js +143 -0
  838. package/backend/node_modules/mysql2/lib/commands/query.js +365 -0
  839. package/backend/node_modules/mysql2/lib/commands/quit.js +29 -0
  840. package/backend/node_modules/mysql2/lib/commands/register_slave.js +27 -0
  841. package/backend/node_modules/mysql2/lib/commands/reset_connection.js +29 -0
  842. package/backend/node_modules/mysql2/lib/commands/server_handshake.js +205 -0
  843. package/backend/node_modules/mysql2/lib/compressed_protocol.js +153 -0
  844. package/backend/node_modules/mysql2/lib/connection.js +12 -0
  845. package/backend/node_modules/mysql2/lib/connection_config.js +300 -0
  846. package/backend/node_modules/mysql2/lib/constants/charset_encodings.js +317 -0
  847. package/backend/node_modules/mysql2/lib/constants/charsets.js +317 -0
  848. package/backend/node_modules/mysql2/lib/constants/client.js +39 -0
  849. package/backend/node_modules/mysql2/lib/constants/commands.js +37 -0
  850. package/backend/node_modules/mysql2/lib/constants/cursor.js +9 -0
  851. package/backend/node_modules/mysql2/lib/constants/encoding_charset.js +50 -0
  852. package/backend/node_modules/mysql2/lib/constants/errors.js +3973 -0
  853. package/backend/node_modules/mysql2/lib/constants/field_flags.js +20 -0
  854. package/backend/node_modules/mysql2/lib/constants/server_status.js +44 -0
  855. package/backend/node_modules/mysql2/lib/constants/session_track.js +11 -0
  856. package/backend/node_modules/mysql2/lib/constants/ssl_profiles.js +11 -0
  857. package/backend/node_modules/mysql2/lib/constants/types.js +64 -0
  858. package/backend/node_modules/mysql2/lib/create_connection.js +10 -0
  859. package/backend/node_modules/mysql2/lib/create_pool.js +10 -0
  860. package/backend/node_modules/mysql2/lib/create_pool_cluster.js +9 -0
  861. package/backend/node_modules/mysql2/lib/helpers.js +83 -0
  862. package/backend/node_modules/mysql2/lib/packet_parser.js +195 -0
  863. package/backend/node_modules/mysql2/lib/packets/auth_next_factor.js +35 -0
  864. package/backend/node_modules/mysql2/lib/packets/auth_switch_request.js +38 -0
  865. package/backend/node_modules/mysql2/lib/packets/auth_switch_request_more_data.js +33 -0
  866. package/backend/node_modules/mysql2/lib/packets/auth_switch_response.js +30 -0
  867. package/backend/node_modules/mysql2/lib/packets/binary_row.js +95 -0
  868. package/backend/node_modules/mysql2/lib/packets/binlog_dump.js +33 -0
  869. package/backend/node_modules/mysql2/lib/packets/binlog_query_statusvars.js +115 -0
  870. package/backend/node_modules/mysql2/lib/packets/change_user.js +97 -0
  871. package/backend/node_modules/mysql2/lib/packets/close_statement.js +21 -0
  872. package/backend/node_modules/mysql2/lib/packets/column_definition.js +291 -0
  873. package/backend/node_modules/mysql2/lib/packets/encode_parameter.js +69 -0
  874. package/backend/node_modules/mysql2/lib/packets/execute.js +177 -0
  875. package/backend/node_modules/mysql2/lib/packets/handshake.js +112 -0
  876. package/backend/node_modules/mysql2/lib/packets/handshake_response.js +173 -0
  877. package/backend/node_modules/mysql2/lib/packets/index.js +154 -0
  878. package/backend/node_modules/mysql2/lib/packets/packet.js +978 -0
  879. package/backend/node_modules/mysql2/lib/packets/prepare_statement.js +27 -0
  880. package/backend/node_modules/mysql2/lib/packets/prepared_statement_header.js +16 -0
  881. package/backend/node_modules/mysql2/lib/packets/query.js +102 -0
  882. package/backend/node_modules/mysql2/lib/packets/register_slave.js +46 -0
  883. package/backend/node_modules/mysql2/lib/packets/reset_connection.js +17 -0
  884. package/backend/node_modules/mysql2/lib/packets/resultset_header.js +124 -0
  885. package/backend/node_modules/mysql2/lib/packets/ssl_request.js +25 -0
  886. package/backend/node_modules/mysql2/lib/packets/text_row.js +47 -0
  887. package/backend/node_modules/mysql2/lib/parsers/binary_parser.js +235 -0
  888. package/backend/node_modules/mysql2/lib/parsers/parser_cache.js +68 -0
  889. package/backend/node_modules/mysql2/lib/parsers/static_binary_parser.js +213 -0
  890. package/backend/node_modules/mysql2/lib/parsers/static_text_parser.js +152 -0
  891. package/backend/node_modules/mysql2/lib/parsers/string.js +50 -0
  892. package/backend/node_modules/mysql2/lib/parsers/text_parser.js +214 -0
  893. package/backend/node_modules/mysql2/lib/pool.js +12 -0
  894. package/backend/node_modules/mysql2/lib/pool_cluster.js +375 -0
  895. package/backend/node_modules/mysql2/lib/pool_config.js +34 -0
  896. package/backend/node_modules/mysql2/lib/pool_connection.js +81 -0
  897. package/backend/node_modules/mysql2/lib/promise/capture_local_err.js +25 -0
  898. package/backend/node_modules/mysql2/lib/promise/connection.js +237 -0
  899. package/backend/node_modules/mysql2/lib/promise/inherit_events.js +27 -0
  900. package/backend/node_modules/mysql2/lib/promise/make_done_cb.js +16 -0
  901. package/backend/node_modules/mysql2/lib/promise/pool.js +118 -0
  902. package/backend/node_modules/mysql2/lib/promise/pool_cluster.js +59 -0
  903. package/backend/node_modules/mysql2/lib/promise/pool_connection.js +19 -0
  904. package/backend/node_modules/mysql2/lib/promise/prepared_statement_info.js +35 -0
  905. package/backend/node_modules/mysql2/lib/results_stream.js +38 -0
  906. package/backend/node_modules/mysql2/lib/server.js +37 -0
  907. package/backend/node_modules/mysql2/lib/tracing.js +81 -0
  908. package/backend/node_modules/mysql2/package.json +95 -0
  909. package/backend/node_modules/mysql2/promise.d.ts +141 -0
  910. package/backend/node_modules/mysql2/promise.js +209 -0
  911. package/backend/node_modules/mysql2/typings/mysql/LICENSE.txt +15 -0
  912. package/backend/node_modules/mysql2/typings/mysql/index.d.ts +93 -0
  913. package/backend/node_modules/mysql2/typings/mysql/info.txt +1 -0
  914. package/backend/node_modules/mysql2/typings/mysql/lib/Auth.d.ts +30 -0
  915. package/backend/node_modules/mysql2/typings/mysql/lib/Connection.d.ts +456 -0
  916. package/backend/node_modules/mysql2/typings/mysql/lib/Pool.d.ts +78 -0
  917. package/backend/node_modules/mysql2/typings/mysql/lib/PoolCluster.d.ts +92 -0
  918. package/backend/node_modules/mysql2/typings/mysql/lib/PoolConnection.d.ts +11 -0
  919. package/backend/node_modules/mysql2/typings/mysql/lib/Server.d.ts +11 -0
  920. package/backend/node_modules/mysql2/typings/mysql/lib/Tracing.d.ts +71 -0
  921. package/backend/node_modules/mysql2/typings/mysql/lib/constants/CharsetToEncoding.d.ts +8 -0
  922. package/backend/node_modules/mysql2/typings/mysql/lib/constants/Charsets.d.ts +326 -0
  923. package/backend/node_modules/mysql2/typings/mysql/lib/constants/Types.d.ts +70 -0
  924. package/backend/node_modules/mysql2/typings/mysql/lib/constants/index.d.ts +5 -0
  925. package/backend/node_modules/mysql2/typings/mysql/lib/parsers/ParserCache.d.ts +4 -0
  926. package/backend/node_modules/mysql2/typings/mysql/lib/parsers/index.d.ts +18 -0
  927. package/backend/node_modules/mysql2/typings/mysql/lib/parsers/typeCast.d.ts +54 -0
  928. package/backend/node_modules/mysql2/typings/mysql/lib/protocol/packets/Field.d.ts +10 -0
  929. package/backend/node_modules/mysql2/typings/mysql/lib/protocol/packets/FieldPacket.d.ts +27 -0
  930. package/backend/node_modules/mysql2/typings/mysql/lib/protocol/packets/OkPacket.d.ts +23 -0
  931. package/backend/node_modules/mysql2/typings/mysql/lib/protocol/packets/ProcedurePacket.d.ts +13 -0
  932. package/backend/node_modules/mysql2/typings/mysql/lib/protocol/packets/ResultSetHeader.d.ts +18 -0
  933. package/backend/node_modules/mysql2/typings/mysql/lib/protocol/packets/RowDataPacket.d.ts +9 -0
  934. package/backend/node_modules/mysql2/typings/mysql/lib/protocol/packets/index.d.ts +28 -0
  935. package/backend/node_modules/mysql2/typings/mysql/lib/protocol/packets/params/ErrorPacketParams.d.ts +6 -0
  936. package/backend/node_modules/mysql2/typings/mysql/lib/protocol/packets/params/OkPacketParams.d.ts +9 -0
  937. package/backend/node_modules/mysql2/typings/mysql/lib/protocol/sequences/ExecutableBase.d.ts +41 -0
  938. package/backend/node_modules/mysql2/typings/mysql/lib/protocol/sequences/Prepare.d.ts +65 -0
  939. package/backend/node_modules/mysql2/typings/mysql/lib/protocol/sequences/Query.d.ts +235 -0
  940. package/backend/node_modules/mysql2/typings/mysql/lib/protocol/sequences/QueryableBase.d.ts +41 -0
  941. package/backend/node_modules/mysql2/typings/mysql/lib/protocol/sequences/Sequence.d.ts +5 -0
  942. package/backend/node_modules/mysql2/typings/mysql/lib/protocol/sequences/promise/ExecutableBase.d.ts +17 -0
  943. package/backend/node_modules/mysql2/typings/mysql/lib/protocol/sequences/promise/QueryableBase.d.ts +18 -0
  944. package/backend/node_modules/named-placeholders/LICENSE +21 -0
  945. package/backend/node_modules/named-placeholders/README.md +27 -0
  946. package/backend/node_modules/named-placeholders/index.js +179 -0
  947. package/backend/node_modules/named-placeholders/package.json +36 -0
  948. package/backend/node_modules/negotiator/HISTORY.md +114 -0
  949. package/backend/node_modules/negotiator/LICENSE +24 -0
  950. package/backend/node_modules/negotiator/README.md +212 -0
  951. package/backend/node_modules/negotiator/index.js +83 -0
  952. package/backend/node_modules/negotiator/lib/charset.js +169 -0
  953. package/backend/node_modules/negotiator/lib/encoding.js +205 -0
  954. package/backend/node_modules/negotiator/lib/language.js +179 -0
  955. package/backend/node_modules/negotiator/lib/mediaType.js +294 -0
  956. package/backend/node_modules/negotiator/package.json +43 -0
  957. package/backend/node_modules/node-addon-api/LICENSE.md +9 -0
  958. package/backend/node_modules/node-addon-api/README.md +95 -0
  959. package/backend/node_modules/node-addon-api/common.gypi +21 -0
  960. package/backend/node_modules/node-addon-api/except.gypi +25 -0
  961. package/backend/node_modules/node-addon-api/index.js +14 -0
  962. package/backend/node_modules/node-addon-api/napi-inl.deprecated.h +186 -0
  963. package/backend/node_modules/node-addon-api/napi-inl.h +7181 -0
  964. package/backend/node_modules/node-addon-api/napi.h +3380 -0
  965. package/backend/node_modules/node-addon-api/node_addon_api.gyp +42 -0
  966. package/backend/node_modules/node-addon-api/node_api.gyp +9 -0
  967. package/backend/node_modules/node-addon-api/noexcept.gypi +26 -0
  968. package/backend/node_modules/node-addon-api/nothing.c +0 -0
  969. package/backend/node_modules/node-addon-api/package-support.json +21 -0
  970. package/backend/node_modules/node-addon-api/package.json +480 -0
  971. package/backend/node_modules/node-addon-api/tools/README.md +73 -0
  972. package/backend/node_modules/node-addon-api/tools/check-napi.js +99 -0
  973. package/backend/node_modules/node-addon-api/tools/clang-format.js +71 -0
  974. package/backend/node_modules/node-addon-api/tools/conversion.js +301 -0
  975. package/backend/node_modules/node-gyp-build/LICENSE +21 -0
  976. package/backend/node_modules/node-gyp-build/README.md +58 -0
  977. package/backend/node_modules/node-gyp-build/SECURITY.md +5 -0
  978. package/backend/node_modules/node-gyp-build/bin.js +84 -0
  979. package/backend/node_modules/node-gyp-build/build-test.js +19 -0
  980. package/backend/node_modules/node-gyp-build/index.js +6 -0
  981. package/backend/node_modules/node-gyp-build/node-gyp-build.js +207 -0
  982. package/backend/node_modules/node-gyp-build/optional.js +7 -0
  983. package/backend/node_modules/node-gyp-build/package.json +43 -0
  984. package/backend/node_modules/nodemon/.prettierrc.json +3 -0
  985. package/backend/node_modules/nodemon/LICENSE +21 -0
  986. package/backend/node_modules/nodemon/README.md +439 -0
  987. package/backend/node_modules/nodemon/bin/nodemon.js +16 -0
  988. package/backend/node_modules/nodemon/bin/windows-kill.exe +0 -0
  989. package/backend/node_modules/nodemon/doc/cli/authors.txt +8 -0
  990. package/backend/node_modules/nodemon/doc/cli/config.txt +44 -0
  991. package/backend/node_modules/nodemon/doc/cli/help.txt +29 -0
  992. package/backend/node_modules/nodemon/doc/cli/logo.txt +20 -0
  993. package/backend/node_modules/nodemon/doc/cli/options.txt +36 -0
  994. package/backend/node_modules/nodemon/doc/cli/topics.txt +8 -0
  995. package/backend/node_modules/nodemon/doc/cli/usage.txt +3 -0
  996. package/backend/node_modules/nodemon/doc/cli/whoami.txt +9 -0
  997. package/backend/node_modules/nodemon/index.d.ts +124 -0
  998. package/backend/node_modules/nodemon/jsconfig.json +7 -0
  999. package/backend/node_modules/nodemon/lib/cli/index.js +49 -0
  1000. package/backend/node_modules/nodemon/lib/cli/parse.js +230 -0
  1001. package/backend/node_modules/nodemon/lib/config/command.js +43 -0
  1002. package/backend/node_modules/nodemon/lib/config/defaults.js +34 -0
  1003. package/backend/node_modules/nodemon/lib/config/exec.js +240 -0
  1004. package/backend/node_modules/nodemon/lib/config/index.js +93 -0
  1005. package/backend/node_modules/nodemon/lib/config/load.js +225 -0
  1006. package/backend/node_modules/nodemon/lib/help/index.js +27 -0
  1007. package/backend/node_modules/nodemon/lib/index.js +1 -0
  1008. package/backend/node_modules/nodemon/lib/monitor/index.js +4 -0
  1009. package/backend/node_modules/nodemon/lib/monitor/match.js +288 -0
  1010. package/backend/node_modules/nodemon/lib/monitor/run.js +562 -0
  1011. package/backend/node_modules/nodemon/lib/monitor/signals.js +34 -0
  1012. package/backend/node_modules/nodemon/lib/monitor/watch.js +244 -0
  1013. package/backend/node_modules/nodemon/lib/nodemon.js +317 -0
  1014. package/backend/node_modules/nodemon/lib/rules/add.js +89 -0
  1015. package/backend/node_modules/nodemon/lib/rules/index.js +53 -0
  1016. package/backend/node_modules/nodemon/lib/rules/parse.js +43 -0
  1017. package/backend/node_modules/nodemon/lib/spawn.js +74 -0
  1018. package/backend/node_modules/nodemon/lib/utils/bus.js +44 -0
  1019. package/backend/node_modules/nodemon/lib/utils/clone.js +40 -0
  1020. package/backend/node_modules/nodemon/lib/utils/colour.js +26 -0
  1021. package/backend/node_modules/nodemon/lib/utils/index.js +103 -0
  1022. package/backend/node_modules/nodemon/lib/utils/log.js +82 -0
  1023. package/backend/node_modules/nodemon/lib/utils/merge.js +47 -0
  1024. package/backend/node_modules/nodemon/lib/version.js +100 -0
  1025. package/backend/node_modules/nodemon/package.json +78 -0
  1026. package/backend/node_modules/normalize-path/LICENSE +21 -0
  1027. package/backend/node_modules/normalize-path/README.md +127 -0
  1028. package/backend/node_modules/normalize-path/index.js +35 -0
  1029. package/backend/node_modules/normalize-path/package.json +77 -0
  1030. package/backend/node_modules/object-assign/index.js +90 -0
  1031. package/backend/node_modules/object-assign/license +21 -0
  1032. package/backend/node_modules/object-assign/package.json +42 -0
  1033. package/backend/node_modules/object-assign/readme.md +61 -0
  1034. package/backend/node_modules/object-inspect/.eslintrc +53 -0
  1035. package/backend/node_modules/object-inspect/.github/FUNDING.yml +12 -0
  1036. package/backend/node_modules/object-inspect/.nycrc +13 -0
  1037. package/backend/node_modules/object-inspect/CHANGELOG.md +424 -0
  1038. package/backend/node_modules/object-inspect/LICENSE +21 -0
  1039. package/backend/node_modules/object-inspect/example/all.js +23 -0
  1040. package/backend/node_modules/object-inspect/example/circular.js +6 -0
  1041. package/backend/node_modules/object-inspect/example/fn.js +5 -0
  1042. package/backend/node_modules/object-inspect/example/inspect.js +10 -0
  1043. package/backend/node_modules/object-inspect/index.js +544 -0
  1044. package/backend/node_modules/object-inspect/package-support.json +20 -0
  1045. package/backend/node_modules/object-inspect/package.json +105 -0
  1046. package/backend/node_modules/object-inspect/readme.markdown +84 -0
  1047. package/backend/node_modules/object-inspect/test/bigint.js +58 -0
  1048. package/backend/node_modules/object-inspect/test/browser/dom.js +15 -0
  1049. package/backend/node_modules/object-inspect/test/circular.js +16 -0
  1050. package/backend/node_modules/object-inspect/test/deep.js +12 -0
  1051. package/backend/node_modules/object-inspect/test/element.js +53 -0
  1052. package/backend/node_modules/object-inspect/test/err.js +48 -0
  1053. package/backend/node_modules/object-inspect/test/fakes.js +29 -0
  1054. package/backend/node_modules/object-inspect/test/fn.js +76 -0
  1055. package/backend/node_modules/object-inspect/test/global.js +17 -0
  1056. package/backend/node_modules/object-inspect/test/has.js +15 -0
  1057. package/backend/node_modules/object-inspect/test/holes.js +15 -0
  1058. package/backend/node_modules/object-inspect/test/indent-option.js +271 -0
  1059. package/backend/node_modules/object-inspect/test/inspect.js +139 -0
  1060. package/backend/node_modules/object-inspect/test/lowbyte.js +12 -0
  1061. package/backend/node_modules/object-inspect/test/number.js +58 -0
  1062. package/backend/node_modules/object-inspect/test/quoteStyle.js +26 -0
  1063. package/backend/node_modules/object-inspect/test/toStringTag.js +40 -0
  1064. package/backend/node_modules/object-inspect/test/undef.js +12 -0
  1065. package/backend/node_modules/object-inspect/test/values.js +261 -0
  1066. package/backend/node_modules/object-inspect/test-core-js.js +26 -0
  1067. package/backend/node_modules/object-inspect/util.inspect.js +1 -0
  1068. package/backend/node_modules/on-finished/HISTORY.md +98 -0
  1069. package/backend/node_modules/on-finished/LICENSE +23 -0
  1070. package/backend/node_modules/on-finished/README.md +162 -0
  1071. package/backend/node_modules/on-finished/index.js +234 -0
  1072. package/backend/node_modules/on-finished/package.json +39 -0
  1073. package/backend/node_modules/once/LICENSE +15 -0
  1074. package/backend/node_modules/once/README.md +79 -0
  1075. package/backend/node_modules/once/once.js +42 -0
  1076. package/backend/node_modules/once/package.json +33 -0
  1077. package/backend/node_modules/parseurl/HISTORY.md +58 -0
  1078. package/backend/node_modules/parseurl/LICENSE +24 -0
  1079. package/backend/node_modules/parseurl/README.md +133 -0
  1080. package/backend/node_modules/parseurl/index.js +158 -0
  1081. package/backend/node_modules/parseurl/package.json +40 -0
  1082. package/backend/node_modules/path-to-regexp/LICENSE +21 -0
  1083. package/backend/node_modules/path-to-regexp/Readme.md +224 -0
  1084. package/backend/node_modules/path-to-regexp/dist/index.d.ts +147 -0
  1085. package/backend/node_modules/path-to-regexp/dist/index.js +431 -0
  1086. package/backend/node_modules/path-to-regexp/dist/index.js.map +1 -0
  1087. package/backend/node_modules/path-to-regexp/package.json +64 -0
  1088. package/backend/node_modules/picomatch/LICENSE +21 -0
  1089. package/backend/node_modules/picomatch/README.md +716 -0
  1090. package/backend/node_modules/picomatch/index.js +3 -0
  1091. package/backend/node_modules/picomatch/lib/constants.js +184 -0
  1092. package/backend/node_modules/picomatch/lib/parse.js +1392 -0
  1093. package/backend/node_modules/picomatch/lib/picomatch.js +342 -0
  1094. package/backend/node_modules/picomatch/lib/scan.js +391 -0
  1095. package/backend/node_modules/picomatch/lib/utils.js +64 -0
  1096. package/backend/node_modules/picomatch/package.json +81 -0
  1097. package/backend/node_modules/proxy-addr/HISTORY.md +161 -0
  1098. package/backend/node_modules/proxy-addr/LICENSE +22 -0
  1099. package/backend/node_modules/proxy-addr/README.md +139 -0
  1100. package/backend/node_modules/proxy-addr/index.js +327 -0
  1101. package/backend/node_modules/proxy-addr/package.json +47 -0
  1102. package/backend/node_modules/pstree.remy/.travis.yml +8 -0
  1103. package/backend/node_modules/pstree.remy/LICENSE +7 -0
  1104. package/backend/node_modules/pstree.remy/README.md +26 -0
  1105. package/backend/node_modules/pstree.remy/lib/index.js +37 -0
  1106. package/backend/node_modules/pstree.remy/lib/tree.js +37 -0
  1107. package/backend/node_modules/pstree.remy/lib/utils.js +53 -0
  1108. package/backend/node_modules/pstree.remy/package.json +33 -0
  1109. package/backend/node_modules/pstree.remy/tests/fixtures/index.js +13 -0
  1110. package/backend/node_modules/pstree.remy/tests/fixtures/out1 +10 -0
  1111. package/backend/node_modules/pstree.remy/tests/fixtures/out2 +29 -0
  1112. package/backend/node_modules/pstree.remy/tests/index.test.js +51 -0
  1113. package/backend/node_modules/qs/.editorconfig +46 -0
  1114. package/backend/node_modules/qs/.github/FUNDING.yml +12 -0
  1115. package/backend/node_modules/qs/.github/SECURITY.md +11 -0
  1116. package/backend/node_modules/qs/.github/THREAT_MODEL.md +78 -0
  1117. package/backend/node_modules/qs/.nycrc +13 -0
  1118. package/backend/node_modules/qs/CHANGELOG.md +822 -0
  1119. package/backend/node_modules/qs/LICENSE.md +29 -0
  1120. package/backend/node_modules/qs/README.md +758 -0
  1121. package/backend/node_modules/qs/dist/qs.js +141 -0
  1122. package/backend/node_modules/qs/eslint.config.mjs +57 -0
  1123. package/backend/node_modules/qs/lib/formats.js +23 -0
  1124. package/backend/node_modules/qs/lib/index.js +11 -0
  1125. package/backend/node_modules/qs/lib/parse.js +403 -0
  1126. package/backend/node_modules/qs/lib/stringify.js +363 -0
  1127. package/backend/node_modules/qs/lib/utils.js +342 -0
  1128. package/backend/node_modules/qs/package.json +94 -0
  1129. package/backend/node_modules/qs/test/empty-keys-cases.js +267 -0
  1130. package/backend/node_modules/qs/test/parse.js +1703 -0
  1131. package/backend/node_modules/qs/test/stringify.js +1448 -0
  1132. package/backend/node_modules/qs/test/utils.js +432 -0
  1133. package/backend/node_modules/range-parser/HISTORY.md +56 -0
  1134. package/backend/node_modules/range-parser/LICENSE +23 -0
  1135. package/backend/node_modules/range-parser/README.md +84 -0
  1136. package/backend/node_modules/range-parser/index.js +162 -0
  1137. package/backend/node_modules/range-parser/package.json +44 -0
  1138. package/backend/node_modules/raw-body/LICENSE +22 -0
  1139. package/backend/node_modules/raw-body/README.md +223 -0
  1140. package/backend/node_modules/raw-body/index.d.ts +85 -0
  1141. package/backend/node_modules/raw-body/index.js +336 -0
  1142. package/backend/node_modules/raw-body/package.json +46 -0
  1143. package/backend/node_modules/readdirp/LICENSE +21 -0
  1144. package/backend/node_modules/readdirp/README.md +122 -0
  1145. package/backend/node_modules/readdirp/index.d.ts +43 -0
  1146. package/backend/node_modules/readdirp/index.js +287 -0
  1147. package/backend/node_modules/readdirp/package.json +122 -0
  1148. package/backend/node_modules/router/HISTORY.md +228 -0
  1149. package/backend/node_modules/router/LICENSE +23 -0
  1150. package/backend/node_modules/router/README.md +416 -0
  1151. package/backend/node_modules/router/index.js +748 -0
  1152. package/backend/node_modules/router/lib/layer.js +247 -0
  1153. package/backend/node_modules/router/lib/route.js +242 -0
  1154. package/backend/node_modules/router/package.json +44 -0
  1155. package/backend/node_modules/safe-buffer/LICENSE +21 -0
  1156. package/backend/node_modules/safe-buffer/README.md +584 -0
  1157. package/backend/node_modules/safe-buffer/index.d.ts +187 -0
  1158. package/backend/node_modules/safe-buffer/index.js +65 -0
  1159. package/backend/node_modules/safe-buffer/package.json +51 -0
  1160. package/backend/node_modules/safer-buffer/LICENSE +21 -0
  1161. package/backend/node_modules/safer-buffer/Porting-Buffer.md +268 -0
  1162. package/backend/node_modules/safer-buffer/Readme.md +156 -0
  1163. package/backend/node_modules/safer-buffer/dangerous.js +58 -0
  1164. package/backend/node_modules/safer-buffer/package.json +34 -0
  1165. package/backend/node_modules/safer-buffer/safer.js +77 -0
  1166. package/backend/node_modules/safer-buffer/tests.js +406 -0
  1167. package/backend/node_modules/semver/LICENSE +15 -0
  1168. package/backend/node_modules/semver/README.md +680 -0
  1169. package/backend/node_modules/semver/bin/semver.js +195 -0
  1170. package/backend/node_modules/semver/classes/comparator.js +143 -0
  1171. package/backend/node_modules/semver/classes/index.js +7 -0
  1172. package/backend/node_modules/semver/classes/range.js +557 -0
  1173. package/backend/node_modules/semver/classes/semver.js +333 -0
  1174. package/backend/node_modules/semver/functions/clean.js +8 -0
  1175. package/backend/node_modules/semver/functions/cmp.js +54 -0
  1176. package/backend/node_modules/semver/functions/coerce.js +62 -0
  1177. package/backend/node_modules/semver/functions/compare-build.js +9 -0
  1178. package/backend/node_modules/semver/functions/compare-loose.js +5 -0
  1179. package/backend/node_modules/semver/functions/compare.js +7 -0
  1180. package/backend/node_modules/semver/functions/diff.js +60 -0
  1181. package/backend/node_modules/semver/functions/eq.js +5 -0
  1182. package/backend/node_modules/semver/functions/gt.js +5 -0
  1183. package/backend/node_modules/semver/functions/gte.js +5 -0
  1184. package/backend/node_modules/semver/functions/inc.js +21 -0
  1185. package/backend/node_modules/semver/functions/lt.js +5 -0
  1186. package/backend/node_modules/semver/functions/lte.js +5 -0
  1187. package/backend/node_modules/semver/functions/major.js +5 -0
  1188. package/backend/node_modules/semver/functions/minor.js +5 -0
  1189. package/backend/node_modules/semver/functions/neq.js +5 -0
  1190. package/backend/node_modules/semver/functions/parse.js +18 -0
  1191. package/backend/node_modules/semver/functions/patch.js +5 -0
  1192. package/backend/node_modules/semver/functions/prerelease.js +8 -0
  1193. package/backend/node_modules/semver/functions/rcompare.js +5 -0
  1194. package/backend/node_modules/semver/functions/rsort.js +5 -0
  1195. package/backend/node_modules/semver/functions/satisfies.js +12 -0
  1196. package/backend/node_modules/semver/functions/sort.js +5 -0
  1197. package/backend/node_modules/semver/functions/truncate.js +48 -0
  1198. package/backend/node_modules/semver/functions/valid.js +8 -0
  1199. package/backend/node_modules/semver/index.js +93 -0
  1200. package/backend/node_modules/semver/internal/constants.js +37 -0
  1201. package/backend/node_modules/semver/internal/debug.js +11 -0
  1202. package/backend/node_modules/semver/internal/identifiers.js +29 -0
  1203. package/backend/node_modules/semver/internal/lrucache.js +42 -0
  1204. package/backend/node_modules/semver/internal/parse-options.js +17 -0
  1205. package/backend/node_modules/semver/internal/re.js +223 -0
  1206. package/backend/node_modules/semver/package.json +78 -0
  1207. package/backend/node_modules/semver/preload.js +4 -0
  1208. package/backend/node_modules/semver/range.bnf +17 -0
  1209. package/backend/node_modules/semver/ranges/gtr.js +6 -0
  1210. package/backend/node_modules/semver/ranges/intersects.js +9 -0
  1211. package/backend/node_modules/semver/ranges/ltr.js +6 -0
  1212. package/backend/node_modules/semver/ranges/max-satisfying.js +27 -0
  1213. package/backend/node_modules/semver/ranges/min-satisfying.js +26 -0
  1214. package/backend/node_modules/semver/ranges/min-version.js +63 -0
  1215. package/backend/node_modules/semver/ranges/outside.js +82 -0
  1216. package/backend/node_modules/semver/ranges/simplify.js +49 -0
  1217. package/backend/node_modules/semver/ranges/subset.js +249 -0
  1218. package/backend/node_modules/semver/ranges/to-comparators.js +10 -0
  1219. package/backend/node_modules/semver/ranges/valid.js +13 -0
  1220. package/backend/node_modules/send/LICENSE +23 -0
  1221. package/backend/node_modules/send/README.md +317 -0
  1222. package/backend/node_modules/send/index.js +997 -0
  1223. package/backend/node_modules/send/package.json +63 -0
  1224. package/backend/node_modules/serve-static/LICENSE +25 -0
  1225. package/backend/node_modules/serve-static/README.md +253 -0
  1226. package/backend/node_modules/serve-static/index.js +208 -0
  1227. package/backend/node_modules/serve-static/package.json +44 -0
  1228. package/backend/node_modules/setprototypeof/LICENSE +13 -0
  1229. package/backend/node_modules/setprototypeof/README.md +31 -0
  1230. package/backend/node_modules/setprototypeof/index.d.ts +2 -0
  1231. package/backend/node_modules/setprototypeof/index.js +17 -0
  1232. package/backend/node_modules/setprototypeof/package.json +38 -0
  1233. package/backend/node_modules/setprototypeof/test/index.js +24 -0
  1234. package/backend/node_modules/side-channel/.editorconfig +9 -0
  1235. package/backend/node_modules/side-channel/.eslintrc +12 -0
  1236. package/backend/node_modules/side-channel/.github/FUNDING.yml +12 -0
  1237. package/backend/node_modules/side-channel/.nycrc +13 -0
  1238. package/backend/node_modules/side-channel/CHANGELOG.md +110 -0
  1239. package/backend/node_modules/side-channel/LICENSE +21 -0
  1240. package/backend/node_modules/side-channel/README.md +61 -0
  1241. package/backend/node_modules/side-channel/index.d.ts +14 -0
  1242. package/backend/node_modules/side-channel/index.js +43 -0
  1243. package/backend/node_modules/side-channel/package.json +85 -0
  1244. package/backend/node_modules/side-channel/test/index.js +104 -0
  1245. package/backend/node_modules/side-channel/tsconfig.json +9 -0
  1246. package/backend/node_modules/side-channel-list/.editorconfig +9 -0
  1247. package/backend/node_modules/side-channel-list/.eslintrc +11 -0
  1248. package/backend/node_modules/side-channel-list/.github/FUNDING.yml +12 -0
  1249. package/backend/node_modules/side-channel-list/.nycrc +13 -0
  1250. package/backend/node_modules/side-channel-list/CHANGELOG.md +36 -0
  1251. package/backend/node_modules/side-channel-list/LICENSE +21 -0
  1252. package/backend/node_modules/side-channel-list/README.md +62 -0
  1253. package/backend/node_modules/side-channel-list/index.d.ts +13 -0
  1254. package/backend/node_modules/side-channel-list/index.js +111 -0
  1255. package/backend/node_modules/side-channel-list/list.d.ts +14 -0
  1256. package/backend/node_modules/side-channel-list/package.json +77 -0
  1257. package/backend/node_modules/side-channel-list/test/index.js +154 -0
  1258. package/backend/node_modules/side-channel-list/tsconfig.json +9 -0
  1259. package/backend/node_modules/side-channel-map/.editorconfig +9 -0
  1260. package/backend/node_modules/side-channel-map/.eslintrc +11 -0
  1261. package/backend/node_modules/side-channel-map/.github/FUNDING.yml +12 -0
  1262. package/backend/node_modules/side-channel-map/.nycrc +13 -0
  1263. package/backend/node_modules/side-channel-map/CHANGELOG.md +22 -0
  1264. package/backend/node_modules/side-channel-map/LICENSE +21 -0
  1265. package/backend/node_modules/side-channel-map/README.md +62 -0
  1266. package/backend/node_modules/side-channel-map/index.d.ts +15 -0
  1267. package/backend/node_modules/side-channel-map/index.js +68 -0
  1268. package/backend/node_modules/side-channel-map/package.json +80 -0
  1269. package/backend/node_modules/side-channel-map/test/index.js +114 -0
  1270. package/backend/node_modules/side-channel-map/tsconfig.json +9 -0
  1271. package/backend/node_modules/side-channel-weakmap/.editorconfig +9 -0
  1272. package/backend/node_modules/side-channel-weakmap/.eslintrc +12 -0
  1273. package/backend/node_modules/side-channel-weakmap/.github/FUNDING.yml +12 -0
  1274. package/backend/node_modules/side-channel-weakmap/.nycrc +13 -0
  1275. package/backend/node_modules/side-channel-weakmap/CHANGELOG.md +28 -0
  1276. package/backend/node_modules/side-channel-weakmap/LICENSE +21 -0
  1277. package/backend/node_modules/side-channel-weakmap/README.md +62 -0
  1278. package/backend/node_modules/side-channel-weakmap/index.d.ts +15 -0
  1279. package/backend/node_modules/side-channel-weakmap/index.js +84 -0
  1280. package/backend/node_modules/side-channel-weakmap/package.json +87 -0
  1281. package/backend/node_modules/side-channel-weakmap/test/index.js +114 -0
  1282. package/backend/node_modules/side-channel-weakmap/tsconfig.json +9 -0
  1283. package/backend/node_modules/simple-update-notifier/LICENSE +21 -0
  1284. package/backend/node_modules/simple-update-notifier/README.md +82 -0
  1285. package/backend/node_modules/simple-update-notifier/build/index.d.ts +13 -0
  1286. package/backend/node_modules/simple-update-notifier/build/index.js +210 -0
  1287. package/backend/node_modules/simple-update-notifier/package.json +100 -0
  1288. package/backend/node_modules/simple-update-notifier/src/borderedText.ts +12 -0
  1289. package/backend/node_modules/simple-update-notifier/src/cache.spec.ts +17 -0
  1290. package/backend/node_modules/simple-update-notifier/src/cache.ts +44 -0
  1291. package/backend/node_modules/simple-update-notifier/src/getDistVersion.spec.ts +35 -0
  1292. package/backend/node_modules/simple-update-notifier/src/getDistVersion.ts +29 -0
  1293. package/backend/node_modules/simple-update-notifier/src/hasNewVersion.spec.ts +82 -0
  1294. package/backend/node_modules/simple-update-notifier/src/hasNewVersion.ts +40 -0
  1295. package/backend/node_modules/simple-update-notifier/src/index.spec.ts +27 -0
  1296. package/backend/node_modules/simple-update-notifier/src/index.ts +34 -0
  1297. package/backend/node_modules/simple-update-notifier/src/isNpmOrYarn.ts +12 -0
  1298. package/backend/node_modules/simple-update-notifier/src/types.ts +8 -0
  1299. package/backend/node_modules/sql-escaper/LICENSE +21 -0
  1300. package/backend/node_modules/sql-escaper/README.md +424 -0
  1301. package/backend/node_modules/sql-escaper/lib/index.d.ts +15 -0
  1302. package/backend/node_modules/sql-escaper/lib/index.js +398 -0
  1303. package/backend/node_modules/sql-escaper/lib/index.mjs +305 -0
  1304. package/backend/node_modules/sql-escaper/lib/types.d.ts +5 -0
  1305. package/backend/node_modules/sql-escaper/lib/types.js +2 -0
  1306. package/backend/node_modules/sql-escaper/package.json +81 -0
  1307. package/backend/node_modules/statuses/HISTORY.md +87 -0
  1308. package/backend/node_modules/statuses/LICENSE +23 -0
  1309. package/backend/node_modules/statuses/README.md +139 -0
  1310. package/backend/node_modules/statuses/codes.json +65 -0
  1311. package/backend/node_modules/statuses/index.js +146 -0
  1312. package/backend/node_modules/statuses/package.json +49 -0
  1313. package/backend/node_modules/supports-color/browser.js +5 -0
  1314. package/backend/node_modules/supports-color/index.js +131 -0
  1315. package/backend/node_modules/supports-color/license +9 -0
  1316. package/backend/node_modules/supports-color/package.json +53 -0
  1317. package/backend/node_modules/supports-color/readme.md +66 -0
  1318. package/backend/node_modules/to-regex-range/LICENSE +21 -0
  1319. package/backend/node_modules/to-regex-range/README.md +305 -0
  1320. package/backend/node_modules/to-regex-range/index.js +288 -0
  1321. package/backend/node_modules/to-regex-range/package.json +88 -0
  1322. package/backend/node_modules/toidentifier/HISTORY.md +9 -0
  1323. package/backend/node_modules/toidentifier/LICENSE +21 -0
  1324. package/backend/node_modules/toidentifier/README.md +61 -0
  1325. package/backend/node_modules/toidentifier/index.js +32 -0
  1326. package/backend/node_modules/toidentifier/package.json +38 -0
  1327. package/backend/node_modules/token/index.js +60 -0
  1328. package/backend/node_modules/token/package.json +24 -0
  1329. package/backend/node_modules/token/readme.md +70 -0
  1330. package/backend/node_modules/token/test/token.test.js +77 -0
  1331. package/backend/node_modules/touch/LICENSE +15 -0
  1332. package/backend/node_modules/touch/README.md +52 -0
  1333. package/backend/node_modules/touch/bin/nodetouch.js +112 -0
  1334. package/backend/node_modules/touch/index.js +224 -0
  1335. package/backend/node_modules/touch/package.json +25 -0
  1336. package/backend/node_modules/type-is/HISTORY.md +292 -0
  1337. package/backend/node_modules/type-is/LICENSE +23 -0
  1338. package/backend/node_modules/type-is/README.md +198 -0
  1339. package/backend/node_modules/type-is/index.js +240 -0
  1340. package/backend/node_modules/type-is/node_modules/content-type/LICENSE +22 -0
  1341. package/backend/node_modules/type-is/node_modules/content-type/README.md +69 -0
  1342. package/backend/node_modules/type-is/node_modules/content-type/dist/index.d.ts +26 -0
  1343. package/backend/node_modules/type-is/node_modules/content-type/dist/index.js +170 -0
  1344. package/backend/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -0
  1345. package/backend/node_modules/type-is/node_modules/content-type/package.json +52 -0
  1346. package/backend/node_modules/type-is/package.json +51 -0
  1347. package/backend/node_modules/undefsafe/.github/workflows/release.yml +25 -0
  1348. package/backend/node_modules/undefsafe/.jscsrc +13 -0
  1349. package/backend/node_modules/undefsafe/.jshintrc +16 -0
  1350. package/backend/node_modules/undefsafe/.travis.yml +18 -0
  1351. package/backend/node_modules/undefsafe/LICENSE +22 -0
  1352. package/backend/node_modules/undefsafe/README.md +63 -0
  1353. package/backend/node_modules/undefsafe/example.js +14 -0
  1354. package/backend/node_modules/undefsafe/lib/undefsafe.js +125 -0
  1355. package/backend/node_modules/undefsafe/package.json +34 -0
  1356. package/backend/node_modules/undici-types/LICENSE +21 -0
  1357. package/backend/node_modules/undici-types/README.md +6 -0
  1358. package/backend/node_modules/undici-types/agent.d.ts +32 -0
  1359. package/backend/node_modules/undici-types/api.d.ts +43 -0
  1360. package/backend/node_modules/undici-types/balanced-pool.d.ts +30 -0
  1361. package/backend/node_modules/undici-types/cache-interceptor.d.ts +179 -0
  1362. package/backend/node_modules/undici-types/cache.d.ts +36 -0
  1363. package/backend/node_modules/undici-types/client-stats.d.ts +15 -0
  1364. package/backend/node_modules/undici-types/client.d.ts +123 -0
  1365. package/backend/node_modules/undici-types/connector.d.ts +36 -0
  1366. package/backend/node_modules/undici-types/content-type.d.ts +21 -0
  1367. package/backend/node_modules/undici-types/cookies.d.ts +30 -0
  1368. package/backend/node_modules/undici-types/diagnostics-channel.d.ts +74 -0
  1369. package/backend/node_modules/undici-types/dispatcher.d.ts +279 -0
  1370. package/backend/node_modules/undici-types/env-http-proxy-agent.d.ts +22 -0
  1371. package/backend/node_modules/undici-types/errors.d.ts +177 -0
  1372. package/backend/node_modules/undici-types/eventsource.d.ts +66 -0
  1373. package/backend/node_modules/undici-types/fetch.d.ts +211 -0
  1374. package/backend/node_modules/undici-types/formdata.d.ts +108 -0
  1375. package/backend/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  1376. package/backend/node_modules/undici-types/global-origin.d.ts +7 -0
  1377. package/backend/node_modules/undici-types/h2c-client.d.ts +73 -0
  1378. package/backend/node_modules/undici-types/handlers.d.ts +15 -0
  1379. package/backend/node_modules/undici-types/header.d.ts +160 -0
  1380. package/backend/node_modules/undici-types/index.d.ts +91 -0
  1381. package/backend/node_modules/undici-types/interceptors.d.ts +80 -0
  1382. package/backend/node_modules/undici-types/mock-agent.d.ts +68 -0
  1383. package/backend/node_modules/undici-types/mock-call-history.d.ts +111 -0
  1384. package/backend/node_modules/undici-types/mock-client.d.ts +27 -0
  1385. package/backend/node_modules/undici-types/mock-errors.d.ts +12 -0
  1386. package/backend/node_modules/undici-types/mock-interceptor.d.ts +94 -0
  1387. package/backend/node_modules/undici-types/mock-pool.d.ts +27 -0
  1388. package/backend/node_modules/undici-types/package.json +55 -0
  1389. package/backend/node_modules/undici-types/patch.d.ts +29 -0
  1390. package/backend/node_modules/undici-types/pool-stats.d.ts +19 -0
  1391. package/backend/node_modules/undici-types/pool.d.ts +41 -0
  1392. package/backend/node_modules/undici-types/proxy-agent.d.ts +29 -0
  1393. package/backend/node_modules/undici-types/readable.d.ts +68 -0
  1394. package/backend/node_modules/undici-types/retry-agent.d.ts +8 -0
  1395. package/backend/node_modules/undici-types/retry-handler.d.ts +125 -0
  1396. package/backend/node_modules/undici-types/round-robin-pool.d.ts +41 -0
  1397. package/backend/node_modules/undici-types/snapshot-agent.d.ts +109 -0
  1398. package/backend/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
  1399. package/backend/node_modules/undici-types/util.d.ts +18 -0
  1400. package/backend/node_modules/undici-types/utility.d.ts +7 -0
  1401. package/backend/node_modules/undici-types/webidl.d.ts +347 -0
  1402. package/backend/node_modules/undici-types/websocket.d.ts +188 -0
  1403. package/backend/node_modules/unpipe/HISTORY.md +4 -0
  1404. package/backend/node_modules/unpipe/LICENSE +22 -0
  1405. package/backend/node_modules/unpipe/README.md +43 -0
  1406. package/backend/node_modules/unpipe/index.js +69 -0
  1407. package/backend/node_modules/unpipe/package.json +27 -0
  1408. package/backend/node_modules/vary/HISTORY.md +39 -0
  1409. package/backend/node_modules/vary/LICENSE +22 -0
  1410. package/backend/node_modules/vary/README.md +101 -0
  1411. package/backend/node_modules/vary/index.js +149 -0
  1412. package/backend/node_modules/vary/package.json +43 -0
  1413. package/backend/node_modules/web/README.md +191 -0
  1414. package/backend/node_modules/web/package.json +17 -0
  1415. package/backend/node_modules/web/test-web.js +16 -0
  1416. package/backend/node_modules/web/web.js +200 -0
  1417. package/backend/node_modules/wrappy/LICENSE +15 -0
  1418. package/backend/node_modules/wrappy/README.md +36 -0
  1419. package/backend/node_modules/wrappy/package.json +29 -0
  1420. package/backend/node_modules/wrappy/wrappy.js +33 -0
  1421. package/backend/package-lock.json +1506 -0
  1422. package/backend/package.json +25 -0
  1423. package/backend/server.js +561 -0
  1424. package/epms.sql +162 -0
  1425. package/frontend/README.md +16 -0
  1426. package/frontend/eslint.config.js +21 -0
  1427. package/frontend/index.html +13 -0
  1428. package/frontend/package-lock.json +3042 -0
  1429. package/frontend/package.json +31 -0
  1430. package/frontend/public/favicon.svg +1 -0
  1431. package/frontend/public/icons.svg +24 -0
  1432. package/frontend/src/App.css +184 -0
  1433. package/frontend/src/App.jsx +58 -0
  1434. package/frontend/src/assets/hero.png +0 -0
  1435. package/frontend/src/assets/react.svg +1 -0
  1436. package/frontend/src/assets/vite.svg +1 -0
  1437. package/frontend/src/components/Sidebar.jsx +77 -0
  1438. package/frontend/src/index.css +1 -0
  1439. package/frontend/src/main.jsx +12 -0
  1440. package/frontend/src/pages/Dashboard.jsx +26 -0
  1441. package/frontend/src/pages/Department.jsx +282 -0
  1442. package/frontend/src/pages/Employee.jsx +317 -0
  1443. package/frontend/src/pages/Login.jsx +114 -0
  1444. package/frontend/src/pages/Payroll.jsx +113 -0
  1445. package/frontend/src/pages/Register.jsx +108 -0
  1446. package/frontend/src/pages/Salary.jsx +166 -0
  1447. package/frontend/vite.config.js +8 -0
  1448. package/package.json +13 -0
@@ -0,0 +1,3380 @@
1
+ #ifndef SRC_NAPI_H_
2
+ #define SRC_NAPI_H_
3
+
4
+ #ifndef NAPI_HAS_THREADS
5
+ #if !defined(__wasm__) || (defined(__EMSCRIPTEN_PTHREADS__) || \
6
+ (defined(__wasi__) && defined(_REENTRANT)))
7
+ #define NAPI_HAS_THREADS 1
8
+ #else
9
+ #define NAPI_HAS_THREADS 0
10
+ #endif
11
+ #endif
12
+
13
+ #include <node_api.h>
14
+ #include <functional>
15
+ #include <initializer_list>
16
+ #include <memory>
17
+ #if NAPI_HAS_THREADS
18
+ #include <mutex>
19
+ #endif // NAPI_HAS_THREADS
20
+ #include <chrono>
21
+ #include <string>
22
+ #include <string_view>
23
+ #include <vector>
24
+
25
+ // VS2015 RTM has bugs with constexpr, so require min of VS2015 Update 3 (known
26
+ // good version)
27
+ #if !defined(_MSC_VER) || _MSC_FULL_VER >= 190024210
28
+ #define NAPI_HAS_CONSTEXPR 1
29
+ #endif
30
+
31
+ // VS2013 does not support char16_t literal strings, so we'll work around it
32
+ // using wchar_t strings and casting them. This is safe as long as the character
33
+ // sizes are the same.
34
+ #if defined(_MSC_VER) && _MSC_VER <= 1800
35
+ static_assert(sizeof(char16_t) == sizeof(wchar_t),
36
+ "Size mismatch between char16_t and wchar_t");
37
+ #define NAPI_WIDE_TEXT(x) reinterpret_cast<char16_t*>(L##x)
38
+ #else
39
+ #define NAPI_WIDE_TEXT(x) u##x
40
+ #endif
41
+
42
+ // Backwards-compatibility to handle the rename of this macro definition, in
43
+ // case they are used within userland code.
44
+ #ifdef NAPI_CPP_EXCEPTIONS
45
+ #define NODE_ADDON_API_CPP_EXCEPTIONS
46
+ #endif
47
+ #if defined(NODE_ADDON_API_CPP_EXCEPTIONS) && !defined(NAPI_CPP_EXCEPTIONS)
48
+ #define NAPI_CPP_EXCEPTIONS
49
+ #endif
50
+ #ifdef NAPI_DISABLE_CPP_EXCEPTIONS
51
+ #define NODE_ADDON_API_DISABLE_CPP_EXCEPTIONS
52
+ #endif
53
+ #if defined(NODE_ADDON_API_DISABLE_CPP_EXCEPTIONS) && \
54
+ !defined(NAPI_DISABLE_CPP_EXCEPTIONS)
55
+ #define NAPI_DISABLE_CPP_EXCEPTIONS
56
+ #endif
57
+
58
+ // If C++ exceptions are not explicitly enabled or disabled, enable them
59
+ // if exceptions were enabled in the compiler settings.
60
+ #if !defined(NODE_ADDON_API_CPP_EXCEPTIONS) && \
61
+ !defined(NODE_ADDON_API_DISABLE_CPP_EXCEPTIONS)
62
+ #if defined(_CPPUNWIND) || defined(__EXCEPTIONS)
63
+ #define NODE_ADDON_API_CPP_EXCEPTIONS
64
+ #else
65
+ #error Exception support not detected. \
66
+ Define either NODE_ADDON_API_CPP_EXCEPTIONS or NODE_ADDON_API_DISABLE_CPP_EXCEPTIONS.
67
+ #endif
68
+ #endif
69
+
70
+ // If C++ NODE_ADDON_API_CPP_EXCEPTIONS are enabled, NODE_ADDON_API_ENABLE_MAYBE
71
+ // should not be set
72
+ #if defined(NODE_ADDON_API_CPP_EXCEPTIONS) && \
73
+ defined(NODE_ADDON_API_ENABLE_MAYBE)
74
+ #error NODE_ADDON_API_ENABLE_MAYBE should not be set when \
75
+ NODE_ADDON_API_CPP_EXCEPTIONS is defined.
76
+ #endif
77
+
78
+ #ifdef _NOEXCEPT
79
+ #define NAPI_NOEXCEPT _NOEXCEPT
80
+ #else
81
+ #define NAPI_NOEXCEPT noexcept
82
+ #endif
83
+
84
+ #ifdef NODE_ADDON_API_CPP_EXCEPTIONS
85
+
86
+ // When C++ exceptions are enabled, Errors are thrown directly. There is no need
87
+ // to return anything after the throw statements. The variadic parameter is an
88
+ // optional return value that is ignored.
89
+ // We need _VOID versions of the macros to avoid warnings resulting from
90
+ // leaving the NAPI_THROW_* `...` argument empty.
91
+
92
+ #define NAPI_THROW(e, ...) throw e
93
+ #define NAPI_THROW_VOID(e) throw e
94
+
95
+ #define NAPI_THROW_IF_FAILED(env, status, ...) \
96
+ if ((status) != napi_ok) throw Napi::Error::New(env);
97
+
98
+ #define NAPI_THROW_IF_FAILED_VOID(env, status) \
99
+ if ((status) != napi_ok) throw Napi::Error::New(env);
100
+
101
+ #else // NODE_ADDON_API_CPP_EXCEPTIONS
102
+
103
+ // When C++ exceptions are disabled, Errors are thrown as JavaScript exceptions,
104
+ // which are pending until the callback returns to JS. The variadic parameter
105
+ // is an optional return value; usually it is an empty result.
106
+ // We need _VOID versions of the macros to avoid warnings resulting from
107
+ // leaving the NAPI_THROW_* `...` argument empty.
108
+
109
+ #define NAPI_THROW(e, ...) \
110
+ do { \
111
+ (e).ThrowAsJavaScriptException(); \
112
+ return __VA_ARGS__; \
113
+ } while (0)
114
+
115
+ #define NAPI_THROW_VOID(e) \
116
+ do { \
117
+ (e).ThrowAsJavaScriptException(); \
118
+ return; \
119
+ } while (0)
120
+
121
+ #define NAPI_THROW_IF_FAILED(env, status, ...) \
122
+ if ((status) != napi_ok) { \
123
+ Napi::Error::New(env).ThrowAsJavaScriptException(); \
124
+ return __VA_ARGS__; \
125
+ }
126
+
127
+ #define NAPI_THROW_IF_FAILED_VOID(env, status) \
128
+ if ((status) != napi_ok) { \
129
+ Napi::Error::New(env).ThrowAsJavaScriptException(); \
130
+ return; \
131
+ }
132
+
133
+ #endif // NODE_ADDON_API_CPP_EXCEPTIONS
134
+
135
+ #ifdef NODE_ADDON_API_ENABLE_MAYBE
136
+ #define NAPI_MAYBE_THROW_IF_FAILED(env, status, type) \
137
+ NAPI_THROW_IF_FAILED(env, status, Napi::Nothing<type>())
138
+
139
+ #define NAPI_RETURN_OR_THROW_IF_FAILED(env, status, result, type) \
140
+ NAPI_MAYBE_THROW_IF_FAILED(env, status, type); \
141
+ return Napi::Just<type>(result);
142
+ #else
143
+ #define NAPI_MAYBE_THROW_IF_FAILED(env, status, type) \
144
+ NAPI_THROW_IF_FAILED(env, status, type())
145
+
146
+ #define NAPI_RETURN_OR_THROW_IF_FAILED(env, status, result, type) \
147
+ NAPI_MAYBE_THROW_IF_FAILED(env, status, type); \
148
+ return result;
149
+ #endif
150
+
151
+ #define NAPI_DISALLOW_ASSIGN(CLASS) void operator=(const CLASS&) = delete;
152
+ #define NAPI_DISALLOW_COPY(CLASS) CLASS(const CLASS&) = delete;
153
+
154
+ #define NAPI_DISALLOW_ASSIGN_COPY(CLASS) \
155
+ NAPI_DISALLOW_ASSIGN(CLASS) \
156
+ NAPI_DISALLOW_COPY(CLASS)
157
+
158
+ #define NAPI_CHECK(condition, location, message) \
159
+ do { \
160
+ if (!(condition)) { \
161
+ Napi::Error::Fatal((location), (message)); \
162
+ } \
163
+ } while (0)
164
+
165
+ // Internal check helper. Be careful that the formatted message length should be
166
+ // max 255 size and null terminated.
167
+ #define NAPI_INTERNAL_CHECK(expr, location, ...) \
168
+ do { \
169
+ if (!(expr)) { \
170
+ std::string msg = Napi::details::StringFormat(__VA_ARGS__); \
171
+ Napi::Error::Fatal(location, msg.c_str()); \
172
+ } \
173
+ } while (0)
174
+
175
+ #define NAPI_INTERNAL_CHECK_EQ(actual, expected, value_format, location) \
176
+ do { \
177
+ auto actual_value = (actual); \
178
+ NAPI_INTERNAL_CHECK(actual_value == (expected), \
179
+ location, \
180
+ "Expected " #actual " to be equal to " #expected \
181
+ ", but got " value_format ".", \
182
+ actual_value); \
183
+ } while (0)
184
+
185
+ #define NAPI_FATAL_IF_FAILED(status, location, message) \
186
+ NAPI_CHECK((status) == napi_ok, location, message)
187
+
188
+ ////////////////////////////////////////////////////////////////////////////////
189
+ /// Node-API C++ Wrapper Classes
190
+ ///
191
+ /// These classes wrap the "Node-API" ABI-stable C APIs for Node.js, providing a
192
+ /// C++ object model and C++ exception-handling semantics with low overhead.
193
+ /// The wrappers are all header-only so that they do not affect the ABI.
194
+ ////////////////////////////////////////////////////////////////////////////////
195
+ namespace Napi {
196
+
197
+ #ifdef NAPI_CPP_CUSTOM_NAMESPACE
198
+ // NAPI_CPP_CUSTOM_NAMESPACE can be #define'd per-addon to avoid symbol
199
+ // conflicts between different instances of node-addon-api
200
+
201
+ // First dummy definition of the namespace to make sure that Napi::(name) still
202
+ // refers to the right things inside this file.
203
+ namespace NAPI_CPP_CUSTOM_NAMESPACE {}
204
+ using namespace NAPI_CPP_CUSTOM_NAMESPACE;
205
+
206
+ namespace NAPI_CPP_CUSTOM_NAMESPACE {
207
+ #endif
208
+
209
+ // Forward declarations
210
+ class Env;
211
+ class Value;
212
+ class Boolean;
213
+ class Number;
214
+ #if NAPI_VERSION > 5
215
+ class BigInt;
216
+ #endif // NAPI_VERSION > 5
217
+ #if (NAPI_VERSION > 4)
218
+ class Date;
219
+ #endif
220
+ class String;
221
+ class Object;
222
+ class Array;
223
+ class ArrayBuffer;
224
+ class Function;
225
+ class Error;
226
+ class PropertyDescriptor;
227
+ class CallbackInfo;
228
+ class TypedArray;
229
+ template <typename T>
230
+ class TypedArrayOf;
231
+
232
+ using Int8Array =
233
+ TypedArrayOf<int8_t>; ///< Typed-array of signed 8-bit integers
234
+ using Uint8Array =
235
+ TypedArrayOf<uint8_t>; ///< Typed-array of unsigned 8-bit integers
236
+ using Int16Array =
237
+ TypedArrayOf<int16_t>; ///< Typed-array of signed 16-bit integers
238
+ using Uint16Array =
239
+ TypedArrayOf<uint16_t>; ///< Typed-array of unsigned 16-bit integers
240
+ using Int32Array =
241
+ TypedArrayOf<int32_t>; ///< Typed-array of signed 32-bit integers
242
+ using Uint32Array =
243
+ TypedArrayOf<uint32_t>; ///< Typed-array of unsigned 32-bit integers
244
+ using Float32Array =
245
+ TypedArrayOf<float>; ///< Typed-array of 32-bit floating-point values
246
+ using Float64Array =
247
+ TypedArrayOf<double>; ///< Typed-array of 64-bit floating-point values
248
+ #if NAPI_VERSION > 5
249
+ using BigInt64Array =
250
+ TypedArrayOf<int64_t>; ///< Typed array of signed 64-bit integers
251
+ using BigUint64Array =
252
+ TypedArrayOf<uint64_t>; ///< Typed array of unsigned 64-bit integers
253
+ #endif // NAPI_VERSION > 5
254
+
255
+ /// Defines the signature of a Node-API C++ module's registration callback
256
+ /// (init) function.
257
+ using ModuleRegisterCallback = Object (*)(Env env, Object exports);
258
+
259
+ class MemoryManagement;
260
+
261
+ /// A simple Maybe type, representing an object which may or may not have a
262
+ /// value.
263
+ ///
264
+ /// If an API method returns a Maybe<>, the API method can potentially fail
265
+ /// either because an exception is thrown, or because an exception is pending,
266
+ /// e.g. because a previous API call threw an exception that hasn't been
267
+ /// caught yet. In that case, a "Nothing" value is returned.
268
+ template <class T>
269
+ class Maybe {
270
+ public:
271
+ bool IsNothing() const;
272
+ bool IsJust() const;
273
+
274
+ /// Short-hand for Unwrap(), which doesn't return a value. Could be used
275
+ /// where the actual value of the Maybe is not needed like Object::Set.
276
+ /// If this Maybe is nothing (empty), node-addon-api will crash the
277
+ /// process.
278
+ void Check() const;
279
+
280
+ /// Return the value of type T contained in the Maybe. If this Maybe is
281
+ /// nothing (empty), node-addon-api will crash the process.
282
+ T Unwrap() const;
283
+
284
+ /// Return the value of type T contained in the Maybe, or using a default
285
+ /// value if this Maybe is nothing (empty).
286
+ T UnwrapOr(const T& default_value) const;
287
+
288
+ /// Converts this Maybe to a value of type T in the out. If this Maybe is
289
+ /// nothing (empty), `false` is returned and `out` is left untouched.
290
+ bool UnwrapTo(T* out) const;
291
+
292
+ bool operator==(const Maybe& other) const;
293
+ bool operator!=(const Maybe& other) const;
294
+
295
+ private:
296
+ Maybe();
297
+ explicit Maybe(const T& t);
298
+
299
+ bool _has_value;
300
+ T _value;
301
+
302
+ template <class U>
303
+ friend Maybe<U> Nothing();
304
+ template <class U>
305
+ friend Maybe<U> Just(const U& u);
306
+ };
307
+
308
+ template <class T>
309
+ inline Maybe<T> Nothing();
310
+
311
+ template <class T>
312
+ inline Maybe<T> Just(const T& t);
313
+
314
+ #if defined(NODE_ADDON_API_ENABLE_MAYBE)
315
+ template <typename T>
316
+ using MaybeOrValue = Maybe<T>;
317
+ #else
318
+ template <typename T>
319
+ using MaybeOrValue = T;
320
+ #endif
321
+
322
+ #ifdef NODE_API_EXPERIMENTAL_HAS_POST_FINALIZER
323
+ using node_addon_api_basic_env = node_api_nogc_env;
324
+ using node_addon_api_basic_finalize = node_api_nogc_finalize;
325
+ #else
326
+ using node_addon_api_basic_env = napi_env;
327
+ using node_addon_api_basic_finalize = napi_finalize;
328
+ #endif
329
+
330
+ /// Environment for Node-API values and operations.
331
+ ///
332
+ /// All Node-API values and operations must be associated with an environment.
333
+ /// An environment instance is always provided to callback functions; that
334
+ /// environment must then be used for any creation of Node-API values or other
335
+ /// Node-API operations within the callback. (Many methods infer the
336
+ /// environment from the `this` instance that the method is called on.)
337
+ ///
338
+ /// Multiple environments may co-exist in a single process or a thread.
339
+ ///
340
+ /// In the V8 JavaScript engine, a Node-API environment approximately
341
+ /// corresponds to an Isolate.
342
+ class BasicEnv {
343
+ private:
344
+ node_addon_api_basic_env _env;
345
+ #if NAPI_VERSION > 5
346
+ template <typename T>
347
+ static void DefaultFini(Env, T* data);
348
+ template <typename DataType, typename HintType>
349
+ static void DefaultFiniWithHint(Env, DataType* data, HintType* hint);
350
+ #endif // NAPI_VERSION > 5
351
+ public:
352
+ BasicEnv(node_addon_api_basic_env env);
353
+
354
+ operator node_addon_api_basic_env() const;
355
+
356
+ // Without these operator overloads, the error:
357
+ //
358
+ // Use of overloaded operator '==' is ambiguous (with operand types
359
+ // 'Napi::Env' and 'Napi::Env')
360
+ //
361
+ // ... occurs when comparing foo.Env() == bar.Env() or foo.Env() == nullptr
362
+ bool operator==(const BasicEnv& other) const {
363
+ return _env == other._env;
364
+ }
365
+ bool operator==(std::nullptr_t /*other*/) const {
366
+ return _env == nullptr;
367
+ }
368
+
369
+ #if NAPI_VERSION > 2
370
+ template <typename Hook, typename Arg = void>
371
+ class CleanupHook;
372
+
373
+ template <typename Hook>
374
+ CleanupHook<Hook> AddCleanupHook(Hook hook);
375
+
376
+ template <typename Hook, typename Arg>
377
+ CleanupHook<Hook, Arg> AddCleanupHook(Hook hook, Arg* arg);
378
+ #endif // NAPI_VERSION > 2
379
+
380
+ #if NAPI_VERSION > 5
381
+ template <typename T>
382
+ T* GetInstanceData() const;
383
+
384
+ template <typename T>
385
+ using Finalizer = void (*)(Env, T*);
386
+ template <typename T, Finalizer<T> fini = BasicEnv::DefaultFini<T>>
387
+ void SetInstanceData(T* data) const;
388
+
389
+ template <typename DataType, typename HintType>
390
+ using FinalizerWithHint = void (*)(Env, DataType*, HintType*);
391
+ template <typename DataType,
392
+ typename HintType,
393
+ FinalizerWithHint<DataType, HintType> fini =
394
+ BasicEnv::DefaultFiniWithHint<DataType, HintType>>
395
+ void SetInstanceData(DataType* data, HintType* hint) const;
396
+ #endif // NAPI_VERSION > 5
397
+
398
+ #if NAPI_VERSION > 2
399
+ template <typename Hook, typename Arg>
400
+ class CleanupHook {
401
+ public:
402
+ CleanupHook();
403
+ CleanupHook(BasicEnv env, Hook hook, Arg* arg);
404
+ CleanupHook(BasicEnv env, Hook hook);
405
+ bool Remove(BasicEnv env);
406
+ bool IsEmpty() const;
407
+
408
+ private:
409
+ static inline void Wrapper(void* data) NAPI_NOEXCEPT;
410
+ static inline void WrapperWithArg(void* data) NAPI_NOEXCEPT;
411
+
412
+ void (*wrapper)(void* arg);
413
+ struct CleanupData {
414
+ Hook hook;
415
+ Arg* arg;
416
+ } * data;
417
+ };
418
+ #endif // NAPI_VERSION > 2
419
+
420
+ #if NAPI_VERSION > 8
421
+ const char* GetModuleFileName() const;
422
+ #endif // NAPI_VERSION > 8
423
+
424
+ #ifdef NODE_API_EXPERIMENTAL_HAS_POST_FINALIZER
425
+ template <typename FinalizerType>
426
+ inline void PostFinalizer(FinalizerType finalizeCallback) const;
427
+
428
+ template <typename FinalizerType, typename T>
429
+ inline void PostFinalizer(FinalizerType finalizeCallback, T* data) const;
430
+
431
+ template <typename FinalizerType, typename T, typename Hint>
432
+ inline void PostFinalizer(FinalizerType finalizeCallback,
433
+ T* data,
434
+ Hint* finalizeHint) const;
435
+ #endif // NODE_API_EXPERIMENTAL_HAS_POST_FINALIZER
436
+
437
+ friend class Env;
438
+ };
439
+
440
+ class Env : public BasicEnv {
441
+ public:
442
+ Env(napi_env env);
443
+
444
+ operator napi_env() const;
445
+
446
+ Object Global() const;
447
+ Value Undefined() const;
448
+ Value Null() const;
449
+
450
+ bool IsExceptionPending() const;
451
+ Error GetAndClearPendingException() const;
452
+
453
+ MaybeOrValue<Value> RunScript(const char* utf8script) const;
454
+ MaybeOrValue<Value> RunScript(const std::string& utf8script) const;
455
+ MaybeOrValue<Value> RunScript(String script) const;
456
+ };
457
+
458
+ /// A JavaScript value of unknown type.
459
+ ///
460
+ /// For type-specific operations, convert to one of the Value subclasses using a
461
+ /// `To*` or `As()` method. The `To*` methods do type coercion; the `As()`
462
+ /// method does not.
463
+ ///
464
+ /// Napi::Value value = ...
465
+ /// if (!value.IsString()) throw Napi::TypeError::New(env, "Invalid
466
+ /// arg..."); Napi::String str = value.As<Napi::String>(); // Cast to a
467
+ /// string value
468
+ ///
469
+ /// Napi::Value anotherValue = ...
470
+ /// bool isTruthy = anotherValue.ToBoolean(); // Coerce to a boolean value
471
+ class Value {
472
+ public:
473
+ Value(); ///< Creates a new _empty_ Value instance.
474
+ Value(napi_env env,
475
+ napi_value value); ///< Wraps a Node-API value primitive.
476
+
477
+ /// Creates a JS value from a C++ primitive.
478
+ ///
479
+ /// `value` may be any of:
480
+ /// - bool
481
+ /// - Any integer type
482
+ /// - Any floating point type
483
+ /// - const char* (encoded using UTF-8, null-terminated)
484
+ /// - const char16_t* (encoded using UTF-16-LE, null-terminated)
485
+ /// - std::string (encoded using UTF-8)
486
+ /// - std::u16string
487
+ /// - napi::Value
488
+ /// - napi_value
489
+ template <typename T>
490
+ static Value From(napi_env env, const T& value);
491
+
492
+ static void CheckCast(napi_env env, napi_value value);
493
+
494
+ /// Converts to a Node-API value primitive.
495
+ ///
496
+ /// If the instance is _empty_, this returns `nullptr`.
497
+ operator napi_value() const;
498
+
499
+ /// Tests if this value strictly equals another value.
500
+ bool operator==(const Value& other) const;
501
+
502
+ /// Tests if this value does not strictly equal another value.
503
+ bool operator!=(const Value& other) const;
504
+
505
+ /// Tests if this value strictly equals another value.
506
+ bool StrictEquals(const Value& other) const;
507
+
508
+ /// Gets the environment the value is associated with.
509
+ Napi::Env Env() const;
510
+
511
+ /// Checks if the value is empty (uninitialized).
512
+ ///
513
+ /// An empty value is invalid, and most attempts to perform an operation on an
514
+ /// empty value will result in an exception. Note an empty value is distinct
515
+ /// from JavaScript `null` or `undefined`, which are valid values.
516
+ ///
517
+ /// When C++ exceptions are disabled at compile time, a method with a `Value`
518
+ /// return type may return an empty value to indicate a pending exception. So
519
+ /// when not using C++ exceptions, callers should check whether the value is
520
+ /// empty before attempting to use it.
521
+ bool IsEmpty() const;
522
+
523
+ napi_valuetype Type() const; ///< Gets the type of the value.
524
+
525
+ bool IsUndefined()
526
+ const; ///< Tests if a value is an undefined JavaScript value.
527
+ bool IsNull() const; ///< Tests if a value is a null JavaScript value.
528
+ bool IsBoolean() const; ///< Tests if a value is a JavaScript boolean.
529
+ bool IsNumber() const; ///< Tests if a value is a JavaScript number.
530
+ #if NAPI_VERSION > 5
531
+ bool IsBigInt() const; ///< Tests if a value is a JavaScript bigint.
532
+ #endif // NAPI_VERSION > 5
533
+ #if (NAPI_VERSION > 4)
534
+ bool IsDate() const; ///< Tests if a value is a JavaScript date.
535
+ #endif
536
+ bool IsString() const; ///< Tests if a value is a JavaScript string.
537
+ bool IsSymbol() const; ///< Tests if a value is a JavaScript symbol.
538
+ bool IsArray() const; ///< Tests if a value is a JavaScript array.
539
+ bool IsArrayBuffer()
540
+ const; ///< Tests if a value is a JavaScript array buffer.
541
+ bool IsTypedArray() const; ///< Tests if a value is a JavaScript typed array.
542
+ bool IsObject() const; ///< Tests if a value is a JavaScript object.
543
+ bool IsFunction() const; ///< Tests if a value is a JavaScript function.
544
+ bool IsPromise() const; ///< Tests if a value is a JavaScript promise.
545
+ bool IsDataView() const; ///< Tests if a value is a JavaScript data view.
546
+ bool IsBuffer() const; ///< Tests if a value is a Node buffer.
547
+ bool IsExternal() const; ///< Tests if a value is a pointer to external data.
548
+ #ifdef NODE_API_EXPERIMENTAL_HAS_SHAREDARRAYBUFFER
549
+ bool IsSharedArrayBuffer() const;
550
+ #endif
551
+
552
+ /// Casts to another type of `Napi::Value`, when the actual type is known or
553
+ /// assumed.
554
+ ///
555
+ /// This conversion does NOT coerce the type. Calling any methods
556
+ /// inappropriate for the actual value type will throw `Napi::Error`.
557
+ ///
558
+ /// If `NODE_ADDON_API_ENABLE_TYPE_CHECK_ON_AS` is defined, this method
559
+ /// asserts that the actual type is the expected type.
560
+ template <typename T>
561
+ T As() const;
562
+
563
+ // Unsafe Value::As(), should be avoided.
564
+ template <typename T>
565
+ T UnsafeAs() const;
566
+
567
+ MaybeOrValue<Boolean> ToBoolean()
568
+ const; ///< Coerces a value to a JavaScript boolean.
569
+ MaybeOrValue<Number> ToNumber()
570
+ const; ///< Coerces a value to a JavaScript number.
571
+ MaybeOrValue<String> ToString()
572
+ const; ///< Coerces a value to a JavaScript string.
573
+ MaybeOrValue<Object> ToObject()
574
+ const; ///< Coerces a value to a JavaScript object.
575
+
576
+ protected:
577
+ /// !cond INTERNAL
578
+ napi_env _env;
579
+ napi_value _value;
580
+ /// !endcond
581
+ };
582
+
583
+ /// A JavaScript boolean value.
584
+ class Boolean : public Value {
585
+ public:
586
+ static Boolean New(napi_env env, ///< Node-API environment
587
+ bool value ///< Boolean value
588
+ );
589
+
590
+ static void CheckCast(napi_env env, napi_value value);
591
+
592
+ Boolean(); ///< Creates a new _empty_ Boolean instance.
593
+ Boolean(napi_env env,
594
+ napi_value value); ///< Wraps a Node-API value primitive.
595
+
596
+ operator bool() const; ///< Converts a Boolean value to a boolean primitive.
597
+ bool Value() const; ///< Converts a Boolean value to a boolean primitive.
598
+ };
599
+
600
+ /// A JavaScript number value.
601
+ class Number : public Value {
602
+ public:
603
+ static Number New(napi_env env, ///< Node-API environment
604
+ double value ///< Number value
605
+ );
606
+
607
+ static void CheckCast(napi_env env, napi_value value);
608
+
609
+ Number(); ///< Creates a new _empty_ Number instance.
610
+ Number(napi_env env,
611
+ napi_value value); ///< Wraps a Node-API value primitive.
612
+
613
+ operator int32_t()
614
+ const; ///< Converts a Number value to a 32-bit signed integer value.
615
+ operator uint32_t()
616
+ const; ///< Converts a Number value to a 32-bit unsigned integer value.
617
+ operator int64_t()
618
+ const; ///< Converts a Number value to a 64-bit signed integer value.
619
+ operator float()
620
+ const; ///< Converts a Number value to a 32-bit floating-point value.
621
+ operator double()
622
+ const; ///< Converts a Number value to a 64-bit floating-point value.
623
+
624
+ int32_t Int32Value()
625
+ const; ///< Converts a Number value to a 32-bit signed integer value.
626
+ uint32_t Uint32Value()
627
+ const; ///< Converts a Number value to a 32-bit unsigned integer value.
628
+ int64_t Int64Value()
629
+ const; ///< Converts a Number value to a 64-bit signed integer value.
630
+ float FloatValue()
631
+ const; ///< Converts a Number value to a 32-bit floating-point value.
632
+ double DoubleValue()
633
+ const; ///< Converts a Number value to a 64-bit floating-point value.
634
+ };
635
+
636
+ #if NAPI_VERSION > 5
637
+ /// A JavaScript bigint value.
638
+ class BigInt : public Value {
639
+ public:
640
+ static BigInt New(napi_env env, ///< Node-API environment
641
+ int64_t value ///< Number value
642
+ );
643
+ static BigInt New(napi_env env, ///< Node-API environment
644
+ uint64_t value ///< Number value
645
+ );
646
+
647
+ /// Creates a new BigInt object using a specified sign bit and a
648
+ /// specified list of digits/words.
649
+ /// The resulting number is calculated as:
650
+ /// (-1)^sign_bit * (words[0] * (2^64)^0 + words[1] * (2^64)^1 + ...)
651
+ static BigInt New(napi_env env, ///< Node-API environment
652
+ int sign_bit, ///< Sign bit. 1 if negative.
653
+ size_t word_count, ///< Number of words in array
654
+ const uint64_t* words ///< Array of words
655
+ );
656
+
657
+ static void CheckCast(napi_env env, napi_value value);
658
+
659
+ BigInt(); ///< Creates a new _empty_ BigInt instance.
660
+ BigInt(napi_env env,
661
+ napi_value value); ///< Wraps a Node-API value primitive.
662
+
663
+ int64_t Int64Value(bool* lossless)
664
+ const; ///< Converts a BigInt value to a 64-bit signed integer value.
665
+ uint64_t Uint64Value(bool* lossless)
666
+ const; ///< Converts a BigInt value to a 64-bit unsigned integer value.
667
+
668
+ size_t WordCount() const; ///< The number of 64-bit words needed to store
669
+ ///< the result of ToWords().
670
+
671
+ /// Writes the contents of this BigInt to a specified memory location.
672
+ /// `sign_bit` must be provided and will be set to 1 if this BigInt is
673
+ /// negative.
674
+ /// `*word_count` has to be initialized to the length of the `words` array.
675
+ /// Upon return, it will be set to the actual number of words that would
676
+ /// be needed to store this BigInt (i.e. the return value of `WordCount()`).
677
+ void ToWords(int* sign_bit, size_t* word_count, uint64_t* words);
678
+ };
679
+ #endif // NAPI_VERSION > 5
680
+
681
+ #if (NAPI_VERSION > 4)
682
+ /// A JavaScript date value.
683
+ class Date : public Value {
684
+ public:
685
+ /// Creates a new Date value from a double primitive.
686
+ static Date New(napi_env env, ///< Node-API environment
687
+ double value ///< Number value
688
+ );
689
+
690
+ /// Creates a new Date value from a std::chrono::system_clock::time_point.
691
+ static Date New(
692
+ napi_env env, ///< Node-API environment
693
+ std::chrono::system_clock::time_point time_point ///< Time point value
694
+ );
695
+
696
+ static void CheckCast(napi_env env, napi_value value);
697
+
698
+ Date(); ///< Creates a new _empty_ Date instance.
699
+ Date(napi_env env, napi_value value); ///< Wraps a Node-API value primitive.
700
+ operator double() const; ///< Converts a Date value to double primitive
701
+
702
+ double ValueOf() const; ///< Converts a Date value to a double primitive.
703
+ };
704
+ #endif
705
+
706
+ /// A JavaScript string or symbol value (that can be used as a property name).
707
+ class Name : public Value {
708
+ public:
709
+ static void CheckCast(napi_env env, napi_value value);
710
+
711
+ Name(); ///< Creates a new _empty_ Name instance.
712
+ Name(napi_env env,
713
+ napi_value value); ///< Wraps a Node-API value primitive.
714
+ };
715
+
716
+ /// A JavaScript string value.
717
+ class String : public Name {
718
+ public:
719
+ /// Creates a new String value from a UTF-8 encoded C++ string.
720
+ static String New(napi_env env, ///< Node-API environment
721
+ const std::string& value ///< UTF-8 encoded C++ string
722
+ );
723
+
724
+ /// Creates a new String value from a UTF-16 encoded C++ string.
725
+ static String New(napi_env env, ///< Node-API environment
726
+ const std::u16string& value ///< UTF-16 encoded C++ string
727
+ );
728
+
729
+ /// Creates a new String value from a UTF-8 encoded C++ string view.
730
+ static String New(napi_env env, ///< Node-API environment
731
+ std::string_view value ///< UTF-8 encoded C++ string view
732
+ );
733
+
734
+ /// Creates a new String value from a UTF-8 encoded C string.
735
+ static String New(
736
+ napi_env env, ///< Node-API environment
737
+ const char* value ///< UTF-8 encoded null-terminated C string
738
+ );
739
+
740
+ /// Creates a new String value from a UTF-16 encoded C string.
741
+ static String New(
742
+ napi_env env, ///< Node-API environment
743
+ const char16_t* value ///< UTF-16 encoded null-terminated C string
744
+ );
745
+
746
+ /// Creates a new String value from a UTF-8 encoded C string with specified
747
+ /// length.
748
+ static String New(napi_env env, ///< Node-API environment
749
+ const char* value, ///< UTF-8 encoded C string (not
750
+ ///< necessarily null-terminated)
751
+ size_t length ///< length of the string in bytes
752
+ );
753
+
754
+ /// Creates a new String value from a UTF-16 encoded C string with specified
755
+ /// length.
756
+ static String New(
757
+ napi_env env, ///< Node-API environment
758
+ const char16_t* value, ///< UTF-16 encoded C string (not necessarily
759
+ ///< null-terminated)
760
+ size_t length ///< Length of the string in 2-byte code units
761
+ );
762
+
763
+ /// Creates a new String based on the original object's type.
764
+ ///
765
+ /// `value` may be any of:
766
+ /// - const char* (encoded using UTF-8, null-terminated)
767
+ /// - const char16_t* (encoded using UTF-16-LE, null-terminated)
768
+ /// - std::string (encoded using UTF-8)
769
+ /// - std::u16string
770
+ template <typename T>
771
+ static String From(napi_env env, const T& value);
772
+
773
+ static void CheckCast(napi_env env, napi_value value);
774
+
775
+ String(); ///< Creates a new _empty_ String instance.
776
+ String(napi_env env,
777
+ napi_value value); ///< Wraps a Node-API value primitive.
778
+
779
+ operator std::string()
780
+ const; ///< Converts a String value to a UTF-8 encoded C++ string.
781
+ operator std::u16string()
782
+ const; ///< Converts a String value to a UTF-16 encoded C++ string.
783
+ std::string Utf8Value()
784
+ const; ///< Converts a String value to a UTF-8 encoded C++ string.
785
+ std::u16string Utf16Value()
786
+ const; ///< Converts a String value to a UTF-16 encoded C++ string.
787
+ };
788
+
789
+ /// A JavaScript symbol value.
790
+ class Symbol : public Name {
791
+ public:
792
+ /// Creates a new Symbol value with an optional description.
793
+ static Symbol New(
794
+ napi_env env, ///< Node-API environment
795
+ const char* description =
796
+ nullptr ///< Optional UTF-8 encoded null-terminated C string
797
+ /// describing the symbol
798
+ );
799
+
800
+ /// Creates a new Symbol value with a description.
801
+ static Symbol New(
802
+ napi_env env, ///< Node-API environment
803
+ const std::string&
804
+ description ///< UTF-8 encoded C++ string describing the symbol
805
+ );
806
+
807
+ /// Creates a new Symbol value with a description.
808
+ static Symbol New(
809
+ napi_env env, ///< Node-API environment
810
+ std::string_view
811
+ description ///< UTF-8 encoded C++ string view describing the symbol
812
+ );
813
+
814
+ /// Creates a new Symbol value with a description.
815
+ static Symbol New(napi_env env, ///< Node-API environment
816
+ String description ///< String value describing the symbol
817
+ );
818
+
819
+ /// Creates a new Symbol value with a description.
820
+ static Symbol New(
821
+ napi_env env, ///< Node-API environment
822
+ napi_value description ///< String value describing the symbol
823
+ );
824
+
825
+ /// Get a public Symbol (e.g. Symbol.iterator).
826
+ static MaybeOrValue<Symbol> WellKnown(napi_env, const std::string& name);
827
+
828
+ // Create a symbol in the global registry, UTF-8 Encoded cpp string
829
+ static MaybeOrValue<Symbol> For(napi_env env, const std::string& description);
830
+
831
+ // Create a symbol in the global registry, UTF-8 encoded cpp string view
832
+ static MaybeOrValue<Symbol> For(napi_env env, std::string_view description);
833
+
834
+ // Create a symbol in the global registry, C style string (null terminated)
835
+ static MaybeOrValue<Symbol> For(napi_env env, const char* description);
836
+
837
+ // Create a symbol in the global registry, String value describing the symbol
838
+ static MaybeOrValue<Symbol> For(napi_env env, String description);
839
+
840
+ // Create a symbol in the global registry, napi_value describing the symbol
841
+ static MaybeOrValue<Symbol> For(napi_env env, napi_value description);
842
+
843
+ static void CheckCast(napi_env env, napi_value value);
844
+
845
+ Symbol(); ///< Creates a new _empty_ Symbol instance.
846
+ Symbol(napi_env env,
847
+ napi_value value); ///< Wraps a Node-API value primitive.
848
+ };
849
+
850
+ class TypeTaggable : public Value {
851
+ public:
852
+ #if NAPI_VERSION >= 8
853
+ void TypeTag(const napi_type_tag* type_tag) const;
854
+ bool CheckTypeTag(const napi_type_tag* type_tag) const;
855
+ #endif // NAPI_VERSION >= 8
856
+ protected:
857
+ TypeTaggable();
858
+ TypeTaggable(napi_env env, napi_value value);
859
+ };
860
+
861
+ /// A JavaScript object value.
862
+ class Object : public TypeTaggable {
863
+ public:
864
+ /// Enables property and element assignments using indexing syntax.
865
+ ///
866
+ /// This is a convenient helper to get and set object properties. As
867
+ /// getting and setting object properties may throw with JavaScript
868
+ /// exceptions, it is notable that these operations may fail.
869
+ /// When NODE_ADDON_API_ENABLE_MAYBE is defined, the process will abort
870
+ /// on JavaScript exceptions.
871
+ ///
872
+ /// Example:
873
+ ///
874
+ /// Napi::Value propertyValue = object1['A'];
875
+ /// object2['A'] = propertyValue;
876
+ /// Napi::Value elementValue = array[0];
877
+ /// array[1] = elementValue;
878
+ template <typename Key>
879
+ class PropertyLValue {
880
+ public:
881
+ /// Converts an L-value to a value.
882
+ operator Value() const;
883
+
884
+ /// Assigns a value to the property. The type of value can be
885
+ /// anything supported by `Object::Set`.
886
+ template <typename ValueType>
887
+ PropertyLValue& operator=(ValueType value);
888
+
889
+ /// Converts an L-value to a value. For convenience.
890
+ Value AsValue() const;
891
+
892
+ private:
893
+ PropertyLValue() = delete;
894
+ PropertyLValue(Object object, Key key);
895
+ napi_env _env;
896
+ napi_value _object;
897
+ Key _key;
898
+
899
+ friend class Napi::Object;
900
+ };
901
+
902
+ /// Creates a new Object value.
903
+ static Object New(napi_env env ///< Node-API environment
904
+ );
905
+
906
+ static void CheckCast(napi_env env, napi_value value);
907
+
908
+ Object(); ///< Creates a new _empty_ Object instance.
909
+ Object(napi_env env,
910
+ napi_value value); ///< Wraps a Node-API value primitive.
911
+
912
+ /// Gets or sets a named property.
913
+ PropertyLValue<std::string> operator[](
914
+ const char* utf8name ///< UTF-8 encoded null-terminated property name
915
+ );
916
+
917
+ /// Gets or sets a named property.
918
+ PropertyLValue<std::string> operator[](
919
+ const std::string& utf8name ///< UTF-8 encoded property name
920
+ );
921
+
922
+ /// Gets or sets an indexed property or array element.
923
+ PropertyLValue<uint32_t> operator[](
924
+ uint32_t index /// Property / element index
925
+ );
926
+
927
+ /// Gets or sets an indexed property or array element.
928
+ PropertyLValue<Value> operator[](Value index /// Property / element index
929
+ ) const;
930
+
931
+ /// Gets a named property.
932
+ MaybeOrValue<Value> operator[](
933
+ const char* utf8name ///< UTF-8 encoded null-terminated property name
934
+ ) const;
935
+
936
+ /// Gets a named property.
937
+ MaybeOrValue<Value> operator[](
938
+ const std::string& utf8name ///< UTF-8 encoded property name
939
+ ) const;
940
+
941
+ /// Gets an indexed property or array element.
942
+ MaybeOrValue<Value> operator[](uint32_t index ///< Property / element index
943
+ ) const;
944
+
945
+ /// Checks whether a property is present.
946
+ MaybeOrValue<bool> Has(napi_value key ///< Property key primitive
947
+ ) const;
948
+
949
+ /// Checks whether a property is present.
950
+ MaybeOrValue<bool> Has(Value key ///< Property key
951
+ ) const;
952
+
953
+ /// Checks whether a named property is present.
954
+ MaybeOrValue<bool> Has(
955
+ const char* utf8name ///< UTF-8 encoded null-terminated property name
956
+ ) const;
957
+
958
+ /// Checks whether a named property is present.
959
+ MaybeOrValue<bool> Has(
960
+ const std::string& utf8name ///< UTF-8 encoded property name
961
+ ) const;
962
+
963
+ /// Checks whether a own property is present.
964
+ MaybeOrValue<bool> HasOwnProperty(napi_value key ///< Property key primitive
965
+ ) const;
966
+
967
+ /// Checks whether a own property is present.
968
+ MaybeOrValue<bool> HasOwnProperty(Value key ///< Property key
969
+ ) const;
970
+
971
+ /// Checks whether a own property is present.
972
+ MaybeOrValue<bool> HasOwnProperty(
973
+ const char* utf8name ///< UTF-8 encoded null-terminated property name
974
+ ) const;
975
+
976
+ /// Checks whether a own property is present.
977
+ MaybeOrValue<bool> HasOwnProperty(
978
+ const std::string& utf8name ///< UTF-8 encoded property name
979
+ ) const;
980
+
981
+ /// Gets a property.
982
+ MaybeOrValue<Value> Get(napi_value key ///< Property key primitive
983
+ ) const;
984
+
985
+ /// Gets a property.
986
+ MaybeOrValue<Value> Get(Value key ///< Property key
987
+ ) const;
988
+
989
+ /// Gets a named property.
990
+ MaybeOrValue<Value> Get(
991
+ const char* utf8name ///< UTF-8 encoded null-terminated property name
992
+ ) const;
993
+
994
+ /// Gets a named property.
995
+ MaybeOrValue<Value> Get(
996
+ const std::string& utf8name ///< UTF-8 encoded property name
997
+ ) const;
998
+
999
+ /// Sets a property.
1000
+ template <typename ValueType>
1001
+ MaybeOrValue<bool> Set(napi_value key, ///< Property key primitive
1002
+ const ValueType& value ///< Property value primitive
1003
+ ) const;
1004
+
1005
+ /// Sets a property.
1006
+ template <typename ValueType>
1007
+ MaybeOrValue<bool> Set(Value key, ///< Property key
1008
+ const ValueType& value ///< Property value
1009
+ ) const;
1010
+
1011
+ /// Sets a named property.
1012
+ template <typename ValueType>
1013
+ MaybeOrValue<bool> Set(
1014
+ const char* utf8name, ///< UTF-8 encoded null-terminated property name
1015
+ const ValueType& value) const;
1016
+
1017
+ /// Sets a named property.
1018
+ template <typename ValueType>
1019
+ MaybeOrValue<bool> Set(
1020
+ const std::string& utf8name, ///< UTF-8 encoded property name
1021
+ const ValueType& value ///< Property value primitive
1022
+ ) const;
1023
+
1024
+ /// Delete property.
1025
+ MaybeOrValue<bool> Delete(napi_value key ///< Property key primitive
1026
+ ) const;
1027
+
1028
+ /// Delete property.
1029
+ MaybeOrValue<bool> Delete(Value key ///< Property key
1030
+ ) const;
1031
+
1032
+ /// Delete property.
1033
+ MaybeOrValue<bool> Delete(
1034
+ const char* utf8name ///< UTF-8 encoded null-terminated property name
1035
+ ) const;
1036
+
1037
+ /// Delete property.
1038
+ MaybeOrValue<bool> Delete(
1039
+ const std::string& utf8name ///< UTF-8 encoded property name
1040
+ ) const;
1041
+
1042
+ /// Checks whether an indexed property is present.
1043
+ MaybeOrValue<bool> Has(uint32_t index ///< Property / element index
1044
+ ) const;
1045
+
1046
+ /// Gets an indexed property or array element.
1047
+ MaybeOrValue<Value> Get(uint32_t index ///< Property / element index
1048
+ ) const;
1049
+
1050
+ /// Sets an indexed property or array element.
1051
+ template <typename ValueType>
1052
+ MaybeOrValue<bool> Set(uint32_t index, ///< Property / element index
1053
+ const ValueType& value ///< Property value primitive
1054
+ ) const;
1055
+
1056
+ /// Deletes an indexed property or array element.
1057
+ MaybeOrValue<bool> Delete(uint32_t index ///< Property / element index
1058
+ ) const;
1059
+
1060
+ /// This operation can fail in case of Proxy.[[OwnPropertyKeys]] and
1061
+ /// Proxy.[[GetOwnProperty]] calling into JavaScript. See:
1062
+ /// -
1063
+ /// https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys
1064
+ /// -
1065
+ /// https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-getownproperty-p
1066
+ MaybeOrValue<Array> GetPropertyNames() const; ///< Get all property names
1067
+
1068
+ /// Defines a property on the object.
1069
+ ///
1070
+ /// This operation can fail in case of Proxy.[[DefineOwnProperty]] calling
1071
+ /// into JavaScript. See
1072
+ /// https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-defineownproperty-p-desc
1073
+ MaybeOrValue<bool> DefineProperty(
1074
+ const PropertyDescriptor&
1075
+ property ///< Descriptor for the property to be defined
1076
+ ) const;
1077
+
1078
+ /// Defines properties on the object.
1079
+ ///
1080
+ /// This operation can fail in case of Proxy.[[DefineOwnProperty]] calling
1081
+ /// into JavaScript. See
1082
+ /// https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-defineownproperty-p-desc
1083
+ MaybeOrValue<bool> DefineProperties(
1084
+ const std::initializer_list<PropertyDescriptor>& properties
1085
+ ///< List of descriptors for the properties to be defined
1086
+ ) const;
1087
+
1088
+ /// Defines properties on the object.
1089
+ ///
1090
+ /// This operation can fail in case of Proxy.[[DefineOwnProperty]] calling
1091
+ /// into JavaScript. See
1092
+ /// https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-defineownproperty-p-desc
1093
+ MaybeOrValue<bool> DefineProperties(
1094
+ const std::vector<PropertyDescriptor>& properties
1095
+ ///< Vector of descriptors for the properties to be defined
1096
+ ) const;
1097
+
1098
+ /// Checks if an object is an instance created by a constructor function.
1099
+ ///
1100
+ /// This is equivalent to the JavaScript `instanceof` operator.
1101
+ ///
1102
+ /// This operation can fail in case of Proxy.[[GetPrototypeOf]] calling into
1103
+ /// JavaScript.
1104
+ /// See
1105
+ /// https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-getprototypeof
1106
+ MaybeOrValue<bool> InstanceOf(
1107
+ const Function& constructor ///< Constructor function
1108
+ ) const;
1109
+
1110
+ template <typename Finalizer, typename T>
1111
+ inline void AddFinalizer(Finalizer finalizeCallback, T* data) const;
1112
+
1113
+ template <typename Finalizer, typename T, typename Hint>
1114
+ inline void AddFinalizer(Finalizer finalizeCallback,
1115
+ T* data,
1116
+ Hint* finalizeHint) const;
1117
+
1118
+ #ifdef NODE_ADDON_API_CPP_EXCEPTIONS
1119
+ class const_iterator;
1120
+
1121
+ inline const_iterator begin() const;
1122
+
1123
+ inline const_iterator end() const;
1124
+
1125
+ class iterator;
1126
+
1127
+ inline iterator begin();
1128
+
1129
+ inline iterator end();
1130
+ #endif // NODE_ADDON_API_CPP_EXCEPTIONS
1131
+
1132
+ #if NAPI_VERSION >= 8
1133
+ /// This operation can fail in case of Proxy.[[GetPrototypeOf]] calling into
1134
+ /// JavaScript.
1135
+ /// See
1136
+ /// https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-getprototypeof
1137
+ MaybeOrValue<bool> Freeze() const;
1138
+ /// This operation can fail in case of Proxy.[[GetPrototypeOf]] calling into
1139
+ /// JavaScript.
1140
+ /// See
1141
+ /// https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-getprototypeof
1142
+ MaybeOrValue<bool> Seal() const;
1143
+ #endif // NAPI_VERSION >= 8
1144
+
1145
+ MaybeOrValue<Object> GetPrototype() const;
1146
+
1147
+ #ifdef NODE_API_EXPERIMENTAL_HAS_SET_PROTOTYPE
1148
+ MaybeOrValue<bool> SetPrototype(const Object& value) const;
1149
+ #endif
1150
+ };
1151
+
1152
+ template <typename T>
1153
+ class External : public TypeTaggable {
1154
+ public:
1155
+ static External New(napi_env env, T* data);
1156
+
1157
+ // Finalizer must implement `void operator()(Env env, T* data)`.
1158
+ template <typename Finalizer>
1159
+ static External New(napi_env env, T* data, Finalizer finalizeCallback);
1160
+ // Finalizer must implement `void operator()(Env env, T* data, Hint* hint)`.
1161
+ template <typename Finalizer, typename Hint>
1162
+ static External New(napi_env env,
1163
+ T* data,
1164
+ Finalizer finalizeCallback,
1165
+ Hint* finalizeHint);
1166
+
1167
+ static void CheckCast(napi_env env, napi_value value);
1168
+
1169
+ External();
1170
+ External(napi_env env, napi_value value);
1171
+
1172
+ T* Data() const;
1173
+ };
1174
+
1175
+ class Array : public Object {
1176
+ public:
1177
+ static Array New(napi_env env);
1178
+ static Array New(napi_env env, size_t length);
1179
+
1180
+ static void CheckCast(napi_env env, napi_value value);
1181
+
1182
+ Array();
1183
+ Array(napi_env env, napi_value value);
1184
+
1185
+ uint32_t Length() const;
1186
+ };
1187
+
1188
+ #ifdef NODE_ADDON_API_CPP_EXCEPTIONS
1189
+ class Object::const_iterator {
1190
+ private:
1191
+ enum class Type { BEGIN, END };
1192
+
1193
+ inline const_iterator(const Object* object, const Type type);
1194
+
1195
+ public:
1196
+ inline const_iterator& operator++();
1197
+
1198
+ inline bool operator==(const const_iterator& other) const;
1199
+
1200
+ inline bool operator!=(const const_iterator& other) const;
1201
+
1202
+ inline const std::pair<Value, Object::PropertyLValue<Value>> operator*()
1203
+ const;
1204
+
1205
+ private:
1206
+ const Napi::Object* _object;
1207
+ Array _keys;
1208
+ uint32_t _index;
1209
+
1210
+ friend class Object;
1211
+ };
1212
+
1213
+ class Object::iterator {
1214
+ private:
1215
+ enum class Type { BEGIN, END };
1216
+
1217
+ inline iterator(Object* object, const Type type);
1218
+
1219
+ public:
1220
+ inline iterator& operator++();
1221
+
1222
+ inline bool operator==(const iterator& other) const;
1223
+
1224
+ inline bool operator!=(const iterator& other) const;
1225
+
1226
+ inline std::pair<Value, Object::PropertyLValue<Value>> operator*();
1227
+
1228
+ private:
1229
+ Napi::Object* _object;
1230
+ Array _keys;
1231
+ uint32_t _index;
1232
+
1233
+ friend class Object;
1234
+ };
1235
+ #endif // NODE_ADDON_API_CPP_EXCEPTIONS
1236
+
1237
+ #ifdef NODE_API_EXPERIMENTAL_HAS_SHAREDARRAYBUFFER
1238
+ class SharedArrayBuffer : public Object {
1239
+ public:
1240
+ SharedArrayBuffer();
1241
+ SharedArrayBuffer(napi_env env, napi_value value);
1242
+
1243
+ static SharedArrayBuffer New(napi_env env, size_t byteLength);
1244
+
1245
+ static void CheckCast(napi_env env, napi_value value);
1246
+
1247
+ void* Data();
1248
+ size_t ByteLength();
1249
+ };
1250
+ #endif
1251
+
1252
+ /// A JavaScript array buffer value.
1253
+ class ArrayBuffer : public Object {
1254
+ public:
1255
+ /// Creates a new ArrayBuffer instance over a new automatically-allocated
1256
+ /// buffer.
1257
+ static ArrayBuffer New(
1258
+ napi_env env, ///< Node-API environment
1259
+ size_t byteLength ///< Length of the buffer to be allocated, in bytes
1260
+ );
1261
+
1262
+ #ifndef NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED
1263
+ /// Creates a new ArrayBuffer instance, using an external buffer with
1264
+ /// specified byte length.
1265
+ static ArrayBuffer New(
1266
+ napi_env env, ///< Node-API environment
1267
+ void* externalData, ///< Pointer to the external buffer to be used by
1268
+ ///< the array
1269
+ size_t byteLength ///< Length of the external buffer to be used by the
1270
+ ///< array, in bytes
1271
+ );
1272
+
1273
+ /// Creates a new ArrayBuffer instance, using an external buffer with
1274
+ /// specified byte length.
1275
+ template <typename Finalizer>
1276
+ static ArrayBuffer New(
1277
+ napi_env env, ///< Node-API environment
1278
+ void* externalData, ///< Pointer to the external buffer to be used by
1279
+ ///< the array
1280
+ size_t byteLength, ///< Length of the external buffer to be used by the
1281
+ ///< array,
1282
+ /// in bytes
1283
+ Finalizer finalizeCallback ///< Function to be called when the array
1284
+ ///< buffer is destroyed;
1285
+ /// must implement `void operator()(Env env,
1286
+ /// void* externalData)`
1287
+ );
1288
+
1289
+ /// Creates a new ArrayBuffer instance, using an external buffer with
1290
+ /// specified byte length.
1291
+ template <typename Finalizer, typename Hint>
1292
+ static ArrayBuffer New(
1293
+ napi_env env, ///< Node-API environment
1294
+ void* externalData, ///< Pointer to the external buffer to be used by
1295
+ ///< the array
1296
+ size_t byteLength, ///< Length of the external buffer to be used by the
1297
+ ///< array,
1298
+ /// in bytes
1299
+ Finalizer finalizeCallback, ///< Function to be called when the array
1300
+ ///< buffer is destroyed;
1301
+ /// must implement `void operator()(Env
1302
+ /// env, void* externalData, Hint* hint)`
1303
+ Hint* finalizeHint ///< Hint (second parameter) to be passed to the
1304
+ ///< finalize callback
1305
+ );
1306
+ #endif // NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED
1307
+
1308
+ static void CheckCast(napi_env env, napi_value value);
1309
+
1310
+ ArrayBuffer(); ///< Creates a new _empty_ ArrayBuffer instance.
1311
+ ArrayBuffer(napi_env env,
1312
+ napi_value value); ///< Wraps a Node-API value primitive.
1313
+
1314
+ void* Data(); ///< Gets a pointer to the data buffer.
1315
+ size_t ByteLength(); ///< Gets the length of the array buffer in bytes.
1316
+
1317
+ #if NAPI_VERSION >= 7
1318
+ bool IsDetached() const;
1319
+ void Detach();
1320
+ #endif // NAPI_VERSION >= 7
1321
+ };
1322
+
1323
+ /// A JavaScript typed-array value with unknown array type.
1324
+ ///
1325
+ /// For type-specific operations, cast to a `TypedArrayOf<T>` instance using the
1326
+ /// `As()` method:
1327
+ ///
1328
+ /// Napi::TypedArray array = ...
1329
+ /// if (t.TypedArrayType() == napi_int32_array) {
1330
+ /// Napi::Int32Array int32Array = t.As<Napi::Int32Array>();
1331
+ /// }
1332
+ class TypedArray : public Object {
1333
+ public:
1334
+ static void CheckCast(napi_env env, napi_value value);
1335
+
1336
+ TypedArray(); ///< Creates a new _empty_ TypedArray instance.
1337
+ TypedArray(napi_env env,
1338
+ napi_value value); ///< Wraps a Node-API value primitive.
1339
+
1340
+ napi_typedarray_type TypedArrayType()
1341
+ const; ///< Gets the type of this typed-array.
1342
+ Napi::ArrayBuffer ArrayBuffer() const; ///< Gets the backing array buffer.
1343
+
1344
+ uint8_t ElementSize()
1345
+ const; ///< Gets the size in bytes of one element in the array.
1346
+ size_t ElementLength() const; ///< Gets the number of elements in the array.
1347
+ size_t ByteOffset()
1348
+ const; ///< Gets the offset into the buffer where the array starts.
1349
+ size_t ByteLength() const; ///< Gets the length of the array in bytes.
1350
+
1351
+ protected:
1352
+ /// !cond INTERNAL
1353
+ napi_typedarray_type _type;
1354
+ size_t _length;
1355
+
1356
+ TypedArray(napi_env env,
1357
+ napi_value value,
1358
+ napi_typedarray_type type,
1359
+ size_t length);
1360
+
1361
+ template <typename T>
1362
+ static
1363
+ #if defined(NAPI_HAS_CONSTEXPR)
1364
+ constexpr
1365
+ #endif
1366
+ napi_typedarray_type
1367
+ TypedArrayTypeForPrimitiveType() {
1368
+ return std::is_same<T, int8_t>::value ? napi_int8_array
1369
+ : std::is_same<T, uint8_t>::value ? napi_uint8_array
1370
+ : std::is_same<T, int16_t>::value ? napi_int16_array
1371
+ : std::is_same<T, uint16_t>::value ? napi_uint16_array
1372
+ : std::is_same<T, int32_t>::value ? napi_int32_array
1373
+ : std::is_same<T, uint32_t>::value ? napi_uint32_array
1374
+ : std::is_same<T, float>::value ? napi_float32_array
1375
+ : std::is_same<T, double>::value ? napi_float64_array
1376
+ #if NAPI_VERSION > 5
1377
+ : std::is_same<T, int64_t>::value ? napi_bigint64_array
1378
+ : std::is_same<T, uint64_t>::value ? napi_biguint64_array
1379
+ #endif // NAPI_VERSION > 5
1380
+ : napi_int8_array;
1381
+ }
1382
+ /// !endcond
1383
+ };
1384
+
1385
+ /// A JavaScript typed-array value with known array type.
1386
+ ///
1387
+ /// Note while it is possible to create and access Uint8 "clamped" arrays using
1388
+ /// this class, the _clamping_ behavior is only applied in JavaScript.
1389
+ template <typename T>
1390
+ class TypedArrayOf : public TypedArray {
1391
+ public:
1392
+ /// Creates a new TypedArray instance over a new automatically-allocated array
1393
+ /// buffer.
1394
+ ///
1395
+ /// The array type parameter can normally be omitted (because it is inferred
1396
+ /// from the template parameter T), except when creating a "clamped" array:
1397
+ ///
1398
+ /// Uint8Array::New(env, length, napi_uint8_clamped_array)
1399
+ static TypedArrayOf New(
1400
+ napi_env env, ///< Node-API environment
1401
+ size_t elementLength, ///< Length of the created array, as a number of
1402
+ ///< elements
1403
+ #if defined(NAPI_HAS_CONSTEXPR)
1404
+ napi_typedarray_type type =
1405
+ TypedArray::TypedArrayTypeForPrimitiveType<T>()
1406
+ #else
1407
+ napi_typedarray_type type
1408
+ #endif
1409
+ ///< Type of array, if different from the default array type for the
1410
+ ///< template parameter T.
1411
+ );
1412
+
1413
+ /// Creates a new TypedArray instance over a provided array buffer.
1414
+ ///
1415
+ /// The array type parameter can normally be omitted (because it is inferred
1416
+ /// from the template parameter T), except when creating a "clamped" array:
1417
+ ///
1418
+ /// Uint8Array::New(env, length, buffer, 0, napi_uint8_clamped_array)
1419
+ static TypedArrayOf New(
1420
+ napi_env env, ///< Node-API environment
1421
+ size_t elementLength, ///< Length of the created array, as a number of
1422
+ ///< elements
1423
+ Napi::ArrayBuffer arrayBuffer, ///< Backing array buffer instance to use
1424
+ size_t bufferOffset, ///< Offset into the array buffer where the
1425
+ ///< typed-array starts
1426
+ #if defined(NAPI_HAS_CONSTEXPR)
1427
+ napi_typedarray_type type =
1428
+ TypedArray::TypedArrayTypeForPrimitiveType<T>()
1429
+ #else
1430
+ napi_typedarray_type type
1431
+ #endif
1432
+ ///< Type of array, if different from the default array type for the
1433
+ ///< template parameter T.
1434
+ );
1435
+
1436
+ static void CheckCast(napi_env env, napi_value value);
1437
+
1438
+ TypedArrayOf(); ///< Creates a new _empty_ TypedArrayOf instance.
1439
+ TypedArrayOf(napi_env env,
1440
+ napi_value value); ///< Wraps a Node-API value primitive.
1441
+
1442
+ T& operator[](size_t index); ///< Gets or sets an element in the array.
1443
+ const T& operator[](size_t index) const; ///< Gets an element in the array.
1444
+
1445
+ /// Gets a pointer to the array's backing buffer.
1446
+ ///
1447
+ /// This is not necessarily the same as the `ArrayBuffer::Data()` pointer,
1448
+ /// because the typed-array may have a non-zero `ByteOffset()` into the
1449
+ /// `ArrayBuffer`.
1450
+ T* Data();
1451
+
1452
+ /// Gets a pointer to the array's backing buffer.
1453
+ ///
1454
+ /// This is not necessarily the same as the `ArrayBuffer::Data()` pointer,
1455
+ /// because the typed-array may have a non-zero `ByteOffset()` into the
1456
+ /// `ArrayBuffer`.
1457
+ const T* Data() const;
1458
+
1459
+ private:
1460
+ T* _data;
1461
+
1462
+ TypedArrayOf(napi_env env,
1463
+ napi_value value,
1464
+ napi_typedarray_type type,
1465
+ size_t length,
1466
+ T* data);
1467
+ };
1468
+
1469
+ /// The DataView provides a low-level interface for reading/writing multiple
1470
+ /// number types in an ArrayBuffer irrespective of the platform's endianness.
1471
+ class DataView : public Object {
1472
+ public:
1473
+ static DataView New(napi_env env, Napi::ArrayBuffer arrayBuffer);
1474
+ static DataView New(napi_env env,
1475
+ Napi::ArrayBuffer arrayBuffer,
1476
+ size_t byteOffset);
1477
+ static DataView New(napi_env env,
1478
+ Napi::ArrayBuffer arrayBuffer,
1479
+ size_t byteOffset,
1480
+ size_t byteLength);
1481
+
1482
+ #ifdef NODE_API_EXPERIMENTAL_HAS_SHAREDARRAYBUFFER
1483
+ static DataView New(napi_env env, Napi::SharedArrayBuffer arrayBuffer);
1484
+ static DataView New(napi_env env,
1485
+ Napi::SharedArrayBuffer arrayBuffer,
1486
+ size_t byteOffset);
1487
+ static DataView New(napi_env env,
1488
+ Napi::SharedArrayBuffer arrayBuffer,
1489
+ size_t byteOffset,
1490
+ size_t byteLength);
1491
+ #endif
1492
+
1493
+ static void CheckCast(napi_env env, napi_value value);
1494
+
1495
+ DataView(); ///< Creates a new _empty_ DataView instance.
1496
+ DataView(napi_env env,
1497
+ napi_value value); ///< Wraps a Node-API value primitive.
1498
+
1499
+ // Gets the backing `ArrayBuffer`.
1500
+ //
1501
+ // If this `DataView` is not backed by an `ArrayBuffer`, this method will
1502
+ // terminate the process with a fatal error when using
1503
+ // `NODE_ADDON_API_ENABLE_TYPE_CHECK_ON_AS` or exhibit undefined behavior
1504
+ // otherwise. Use `Buffer()` instead to get the backing buffer without
1505
+ // assuming its type.
1506
+ Napi::ArrayBuffer ArrayBuffer() const;
1507
+
1508
+ // Gets the backing buffer (an `ArrayBuffer` or `SharedArrayBuffer`).
1509
+ //
1510
+ // Use `IsArrayBuffer()` or `IsSharedArrayBuffer()` to check the type of the
1511
+ // backing buffer prior to casting with `As<T>()`.
1512
+ Napi::Value Buffer() const;
1513
+ size_t ByteOffset()
1514
+ const; ///< Gets the offset into the buffer where the array starts.
1515
+ size_t ByteLength() const; ///< Gets the length of the array in bytes.
1516
+
1517
+ void* Data() const;
1518
+
1519
+ float GetFloat32(size_t byteOffset) const;
1520
+ double GetFloat64(size_t byteOffset) const;
1521
+ int8_t GetInt8(size_t byteOffset) const;
1522
+ int16_t GetInt16(size_t byteOffset) const;
1523
+ int32_t GetInt32(size_t byteOffset) const;
1524
+ uint8_t GetUint8(size_t byteOffset) const;
1525
+ uint16_t GetUint16(size_t byteOffset) const;
1526
+ uint32_t GetUint32(size_t byteOffset) const;
1527
+
1528
+ void SetFloat32(size_t byteOffset, float value) const;
1529
+ void SetFloat64(size_t byteOffset, double value) const;
1530
+ void SetInt8(size_t byteOffset, int8_t value) const;
1531
+ void SetInt16(size_t byteOffset, int16_t value) const;
1532
+ void SetInt32(size_t byteOffset, int32_t value) const;
1533
+ void SetUint8(size_t byteOffset, uint8_t value) const;
1534
+ void SetUint16(size_t byteOffset, uint16_t value) const;
1535
+ void SetUint32(size_t byteOffset, uint32_t value) const;
1536
+
1537
+ private:
1538
+ template <typename T>
1539
+ T ReadData(size_t byteOffset) const;
1540
+
1541
+ template <typename T>
1542
+ void WriteData(size_t byteOffset, T value) const;
1543
+
1544
+ void* _data{};
1545
+ size_t _length{};
1546
+ };
1547
+
1548
+ class Function : public Object {
1549
+ public:
1550
+ using VoidCallback = void (*)(const CallbackInfo& info);
1551
+ using Callback = Value (*)(const CallbackInfo& info);
1552
+
1553
+ template <VoidCallback cb>
1554
+ static Function New(napi_env env,
1555
+ const char* utf8name = nullptr,
1556
+ void* data = nullptr);
1557
+
1558
+ template <Callback cb>
1559
+ static Function New(napi_env env,
1560
+ const char* utf8name = nullptr,
1561
+ void* data = nullptr);
1562
+
1563
+ template <VoidCallback cb>
1564
+ static Function New(napi_env env,
1565
+ const std::string& utf8name,
1566
+ void* data = nullptr);
1567
+
1568
+ template <Callback cb>
1569
+ static Function New(napi_env env,
1570
+ const std::string& utf8name,
1571
+ void* data = nullptr);
1572
+
1573
+ /// Callable must implement operator() accepting a const CallbackInfo&
1574
+ /// and return either void or Value.
1575
+ template <typename Callable>
1576
+ static Function New(napi_env env,
1577
+ Callable cb,
1578
+ const char* utf8name = nullptr,
1579
+ void* data = nullptr);
1580
+ /// Callable must implement operator() accepting a const CallbackInfo&
1581
+ /// and return either void or Value.
1582
+ template <typename Callable>
1583
+ static Function New(napi_env env,
1584
+ Callable cb,
1585
+ const std::string& utf8name,
1586
+ void* data = nullptr);
1587
+
1588
+ static void CheckCast(napi_env env, napi_value value);
1589
+
1590
+ Function();
1591
+ Function(napi_env env, napi_value value);
1592
+
1593
+ MaybeOrValue<Value> operator()(
1594
+ const std::initializer_list<napi_value>& args) const;
1595
+
1596
+ MaybeOrValue<Value> Call(const std::initializer_list<napi_value>& args) const;
1597
+ MaybeOrValue<Value> Call(const std::vector<napi_value>& args) const;
1598
+ MaybeOrValue<Value> Call(const std::vector<Value>& args) const;
1599
+ MaybeOrValue<Value> Call(size_t argc, const napi_value* args) const;
1600
+ MaybeOrValue<Value> Call(napi_value recv,
1601
+ const std::initializer_list<napi_value>& args) const;
1602
+ MaybeOrValue<Value> Call(napi_value recv,
1603
+ const std::vector<napi_value>& args) const;
1604
+ MaybeOrValue<Value> Call(napi_value recv,
1605
+ const std::vector<Value>& args) const;
1606
+ MaybeOrValue<Value> Call(napi_value recv,
1607
+ size_t argc,
1608
+ const napi_value* args) const;
1609
+
1610
+ MaybeOrValue<Value> MakeCallback(
1611
+ napi_value recv,
1612
+ const std::initializer_list<napi_value>& args,
1613
+ napi_async_context context = nullptr) const;
1614
+ MaybeOrValue<Value> MakeCallback(napi_value recv,
1615
+ const std::vector<napi_value>& args,
1616
+ napi_async_context context = nullptr) const;
1617
+ MaybeOrValue<Value> MakeCallback(napi_value recv,
1618
+ size_t argc,
1619
+ const napi_value* args,
1620
+ napi_async_context context = nullptr) const;
1621
+
1622
+ MaybeOrValue<Object> New(const std::initializer_list<napi_value>& args) const;
1623
+ MaybeOrValue<Object> New(const std::vector<napi_value>& args) const;
1624
+ MaybeOrValue<Object> New(size_t argc, const napi_value* args) const;
1625
+ };
1626
+
1627
+ class Promise : public Object {
1628
+ public:
1629
+ class Deferred {
1630
+ public:
1631
+ static Deferred New(napi_env env);
1632
+ Deferred(napi_env env);
1633
+
1634
+ Napi::Promise Promise() const;
1635
+ Napi::Env Env() const;
1636
+
1637
+ void Resolve(napi_value value) const;
1638
+ void Reject(napi_value value) const;
1639
+
1640
+ private:
1641
+ napi_env _env;
1642
+ napi_deferred _deferred;
1643
+ napi_value _promise;
1644
+ };
1645
+
1646
+ static void CheckCast(napi_env env, napi_value value);
1647
+
1648
+ Promise();
1649
+ Promise(napi_env env, napi_value value);
1650
+
1651
+ MaybeOrValue<Promise> Then(napi_value onFulfilled) const;
1652
+ MaybeOrValue<Promise> Then(napi_value onFulfilled,
1653
+ napi_value onRejected) const;
1654
+ MaybeOrValue<Promise> Catch(napi_value onRejected) const;
1655
+
1656
+ MaybeOrValue<Promise> Then(const Function& onFulfilled) const;
1657
+ MaybeOrValue<Promise> Then(const Function& onFulfilled,
1658
+ const Function& onRejected) const;
1659
+ MaybeOrValue<Promise> Catch(const Function& onRejected) const;
1660
+ };
1661
+
1662
+ template <typename T>
1663
+ class Buffer : public Uint8Array {
1664
+ public:
1665
+ static Buffer<T> New(napi_env env, size_t length);
1666
+ #ifndef NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED
1667
+ static Buffer<T> New(napi_env env, T* data, size_t length);
1668
+
1669
+ // Finalizer must implement `void operator()(Env env, T* data)`.
1670
+ template <typename Finalizer>
1671
+ static Buffer<T> New(napi_env env,
1672
+ T* data,
1673
+ size_t length,
1674
+ Finalizer finalizeCallback);
1675
+ // Finalizer must implement `void operator()(Env env, T* data, Hint* hint)`.
1676
+ template <typename Finalizer, typename Hint>
1677
+ static Buffer<T> New(napi_env env,
1678
+ T* data,
1679
+ size_t length,
1680
+ Finalizer finalizeCallback,
1681
+ Hint* finalizeHint);
1682
+ #endif // NODE_API_NO_EXTERNAL_BUFFERS_ALLOWED
1683
+
1684
+ static Buffer<T> NewOrCopy(napi_env env, T* data, size_t length);
1685
+ // Finalizer must implement `void operator()(Env env, T* data)`.
1686
+ template <typename Finalizer>
1687
+ static Buffer<T> NewOrCopy(napi_env env,
1688
+ T* data,
1689
+ size_t length,
1690
+ Finalizer finalizeCallback);
1691
+ // Finalizer must implement `void operator()(Env env, T* data, Hint* hint)`.
1692
+ template <typename Finalizer, typename Hint>
1693
+ static Buffer<T> NewOrCopy(napi_env env,
1694
+ T* data,
1695
+ size_t length,
1696
+ Finalizer finalizeCallback,
1697
+ Hint* finalizeHint);
1698
+
1699
+ static Buffer<T> Copy(napi_env env, const T* data, size_t length);
1700
+
1701
+ static void CheckCast(napi_env env, napi_value value);
1702
+
1703
+ Buffer();
1704
+ Buffer(napi_env env, napi_value value);
1705
+ size_t Length() const;
1706
+ T* Data() const;
1707
+
1708
+ private:
1709
+ };
1710
+
1711
+ /// Holds a counted reference to a value; initially a weak reference unless
1712
+ /// otherwise specified, may be changed to/from a strong reference by adjusting
1713
+ /// the refcount.
1714
+ ///
1715
+ /// The referenced value is not immediately destroyed when the reference count
1716
+ /// is zero; it is merely then eligible for garbage-collection if there are no
1717
+ /// other references to the value.
1718
+ template <typename T>
1719
+ class Reference {
1720
+ public:
1721
+ static Reference<T> New(const T& value, uint32_t initialRefcount = 0);
1722
+
1723
+ Reference();
1724
+ Reference(napi_env env, napi_ref ref);
1725
+ ~Reference();
1726
+
1727
+ // A reference can be moved but cannot be copied.
1728
+ Reference(Reference<T>&& other);
1729
+ Reference<T>& operator=(Reference<T>&& other);
1730
+ NAPI_DISALLOW_ASSIGN(Reference<T>)
1731
+
1732
+ operator napi_ref() const;
1733
+ bool operator==(const Reference<T>& other) const;
1734
+ bool operator!=(const Reference<T>& other) const;
1735
+
1736
+ Napi::Env Env() const;
1737
+ bool IsEmpty() const;
1738
+
1739
+ // Note when getting the value of a Reference it is usually correct to do so
1740
+ // within a HandleScope so that the value handle gets cleaned up efficiently.
1741
+ T Value() const;
1742
+
1743
+ uint32_t Ref() const;
1744
+ uint32_t Unref() const;
1745
+ void Reset();
1746
+ void Reset(const T& value, uint32_t refcount = 0);
1747
+
1748
+ // Call this on a reference that is declared as static data, to prevent its
1749
+ // destructor from running at program shutdown time, which would attempt to
1750
+ // reset the reference when the environment is no longer valid. Avoid using
1751
+ // this if at all possible. If you do need to use static data, MAKE SURE to
1752
+ // warn your users that your addon is NOT threadsafe.
1753
+ void SuppressDestruct();
1754
+
1755
+ protected:
1756
+ Reference(const Reference<T>&);
1757
+
1758
+ /// !cond INTERNAL
1759
+ napi_env _env;
1760
+ napi_ref _ref;
1761
+ /// !endcond
1762
+
1763
+ private:
1764
+ bool _suppressDestruct;
1765
+ };
1766
+
1767
+ class ObjectReference : public Reference<Object> {
1768
+ public:
1769
+ ObjectReference();
1770
+ ObjectReference(napi_env env, napi_ref ref);
1771
+
1772
+ // A reference can be moved but cannot be copied.
1773
+ ObjectReference(Reference<Object>&& other);
1774
+ ObjectReference& operator=(Reference<Object>&& other);
1775
+ ObjectReference(ObjectReference&& other);
1776
+ ObjectReference& operator=(ObjectReference&& other);
1777
+ NAPI_DISALLOW_ASSIGN(ObjectReference)
1778
+
1779
+ MaybeOrValue<Napi::Value> Get(const char* utf8name) const;
1780
+ MaybeOrValue<Napi::Value> Get(const std::string& utf8name) const;
1781
+ MaybeOrValue<bool> Set(const char* utf8name, napi_value value) const;
1782
+ MaybeOrValue<bool> Set(const char* utf8name, Napi::Value value) const;
1783
+ MaybeOrValue<bool> Set(const char* utf8name, const char* utf8value) const;
1784
+ MaybeOrValue<bool> Set(const char* utf8name, bool boolValue) const;
1785
+ MaybeOrValue<bool> Set(const char* utf8name, double numberValue) const;
1786
+ MaybeOrValue<bool> Set(const std::string& utf8name, napi_value value) const;
1787
+ MaybeOrValue<bool> Set(const std::string& utf8name, Napi::Value value) const;
1788
+ MaybeOrValue<bool> Set(const std::string& utf8name,
1789
+ const std::string& utf8value) const;
1790
+ MaybeOrValue<bool> Set(const std::string& utf8name, bool boolValue) const;
1791
+ MaybeOrValue<bool> Set(const std::string& utf8name, double numberValue) const;
1792
+
1793
+ MaybeOrValue<Napi::Value> Get(uint32_t index) const;
1794
+ MaybeOrValue<bool> Set(uint32_t index, const napi_value value) const;
1795
+ MaybeOrValue<bool> Set(uint32_t index, const Napi::Value value) const;
1796
+ MaybeOrValue<bool> Set(uint32_t index, const char* utf8value) const;
1797
+ MaybeOrValue<bool> Set(uint32_t index, const std::string& utf8value) const;
1798
+ MaybeOrValue<bool> Set(uint32_t index, bool boolValue) const;
1799
+ MaybeOrValue<bool> Set(uint32_t index, double numberValue) const;
1800
+
1801
+ protected:
1802
+ ObjectReference(const ObjectReference&);
1803
+ };
1804
+
1805
+ class FunctionReference : public Reference<Function> {
1806
+ public:
1807
+ FunctionReference();
1808
+ FunctionReference(napi_env env, napi_ref ref);
1809
+
1810
+ // A reference can be moved but cannot be copied.
1811
+ FunctionReference(Reference<Function>&& other);
1812
+ FunctionReference& operator=(Reference<Function>&& other);
1813
+ FunctionReference(FunctionReference&& other);
1814
+ FunctionReference& operator=(FunctionReference&& other);
1815
+ NAPI_DISALLOW_ASSIGN_COPY(FunctionReference)
1816
+
1817
+ MaybeOrValue<Napi::Value> operator()(
1818
+ const std::initializer_list<napi_value>& args) const;
1819
+
1820
+ MaybeOrValue<Napi::Value> Call(
1821
+ const std::initializer_list<napi_value>& args) const;
1822
+ MaybeOrValue<Napi::Value> Call(const std::vector<napi_value>& args) const;
1823
+ MaybeOrValue<Napi::Value> Call(
1824
+ napi_value recv, const std::initializer_list<napi_value>& args) const;
1825
+ MaybeOrValue<Napi::Value> Call(napi_value recv,
1826
+ const std::vector<napi_value>& args) const;
1827
+ MaybeOrValue<Napi::Value> Call(napi_value recv,
1828
+ size_t argc,
1829
+ const napi_value* args) const;
1830
+
1831
+ MaybeOrValue<Napi::Value> MakeCallback(
1832
+ napi_value recv,
1833
+ const std::initializer_list<napi_value>& args,
1834
+ napi_async_context context = nullptr) const;
1835
+ MaybeOrValue<Napi::Value> MakeCallback(
1836
+ napi_value recv,
1837
+ const std::vector<napi_value>& args,
1838
+ napi_async_context context = nullptr) const;
1839
+ MaybeOrValue<Napi::Value> MakeCallback(
1840
+ napi_value recv,
1841
+ size_t argc,
1842
+ const napi_value* args,
1843
+ napi_async_context context = nullptr) const;
1844
+
1845
+ MaybeOrValue<Object> New(const std::initializer_list<napi_value>& args) const;
1846
+ MaybeOrValue<Object> New(const std::vector<napi_value>& args) const;
1847
+ };
1848
+
1849
+ // Shortcuts to creating a new reference with inferred type and refcount = 0.
1850
+ template <typename T>
1851
+ Reference<T> Weak(T value);
1852
+ ObjectReference Weak(Object value);
1853
+ FunctionReference Weak(Function value);
1854
+
1855
+ // Shortcuts to creating a new reference with inferred type and refcount = 1.
1856
+ template <typename T>
1857
+ Reference<T> Persistent(T value);
1858
+ ObjectReference Persistent(Object value);
1859
+ FunctionReference Persistent(Function value);
1860
+
1861
+ /// A persistent reference to a JavaScript error object. Use of this class
1862
+ /// depends somewhat on whether C++ exceptions are enabled at compile time.
1863
+ ///
1864
+ /// ### Handling Errors With C++ Exceptions
1865
+ ///
1866
+ /// If C++ exceptions are enabled, then the `Error` class extends
1867
+ /// `std::exception` and enables integrated error-handling for C++ exceptions
1868
+ /// and JavaScript exceptions.
1869
+ ///
1870
+ /// If a Node-API call fails without executing any JavaScript code (for
1871
+ /// example due to an invalid argument), then the Node-API wrapper
1872
+ /// automatically converts and throws the error as a C++ exception of type
1873
+ /// `Napi::Error`. Or if a JavaScript function called by C++ code via Node-API
1874
+ /// throws a JavaScript exception, then the Node-API wrapper automatically
1875
+ /// converts and throws it as a C++ exception of type `Napi::Error`.
1876
+ ///
1877
+ /// If a C++ exception of type `Napi::Error` escapes from a Node-API C++
1878
+ /// callback, then the Node-API wrapper automatically converts and throws it
1879
+ /// as a JavaScript exception. Therefore, catching a C++ exception of type
1880
+ /// `Napi::Error` prevents a JavaScript exception from being thrown.
1881
+ ///
1882
+ /// #### Example 1A - Throwing a C++ exception:
1883
+ ///
1884
+ /// Napi::Env env = ...
1885
+ /// throw Napi::Error::New(env, "Example exception");
1886
+ ///
1887
+ /// Following C++ statements will not be executed. The exception will bubble
1888
+ /// up as a C++ exception of type `Napi::Error`, until it is either caught
1889
+ /// while still in C++, or else automatically propagated as a JavaScript
1890
+ /// exception when the callback returns to JavaScript.
1891
+ ///
1892
+ /// #### Example 2A - Propagating a Node-API C++ exception:
1893
+ ///
1894
+ /// Napi::Function jsFunctionThatThrows = someObj.As<Napi::Function>();
1895
+ /// Napi::Value result = jsFunctionThatThrows({ arg1, arg2 });
1896
+ ///
1897
+ /// Following C++ statements will not be executed. The exception will bubble
1898
+ /// up as a C++ exception of type `Napi::Error`, until it is either caught
1899
+ /// while still in C++, or else automatically propagated as a JavaScript
1900
+ /// exception when the callback returns to JavaScript.
1901
+ ///
1902
+ /// #### Example 3A - Handling a Node-API C++ exception:
1903
+ ///
1904
+ /// Napi::Function jsFunctionThatThrows = someObj.As<Napi::Function>();
1905
+ /// Napi::Value result;
1906
+ /// try {
1907
+ /// result = jsFunctionThatThrows({ arg1, arg2 });
1908
+ /// } catch (const Napi::Error& e) {
1909
+ /// cerr << "Caught JavaScript exception: " + e.what();
1910
+ /// }
1911
+ ///
1912
+ /// Since the exception was caught here, it will not be propagated as a
1913
+ /// JavaScript exception.
1914
+ ///
1915
+ /// ### Handling Errors Without C++ Exceptions
1916
+ ///
1917
+ /// If C++ exceptions are disabled (by defining
1918
+ /// `NODE_ADDON_API_DISABLE_CPP_EXCEPTIONS`) then this class does not extend
1919
+ /// `std::exception`, and APIs in the `Napi` namespace do not throw C++
1920
+ /// exceptions when they fail. Instead, they raise _pending_ JavaScript
1921
+ /// exceptions and return _empty_ `Value`s. Calling code should check
1922
+ /// `Value::IsEmpty()` before attempting to use a returned value, and may use
1923
+ /// methods on the `Env` class to check for, get, and clear a pending JavaScript
1924
+ /// exception. If the pending exception is not cleared, it will be thrown when
1925
+ /// the native callback returns to JavaScript.
1926
+ ///
1927
+ /// #### Example 1B - Throwing a JS exception
1928
+ ///
1929
+ /// Napi::Env env = ...
1930
+ /// Napi::Error::New(env, "Example
1931
+ /// exception").ThrowAsJavaScriptException(); return;
1932
+ ///
1933
+ /// After throwing a JS exception, the code should generally return
1934
+ /// immediately from the native callback, after performing any necessary
1935
+ /// cleanup.
1936
+ ///
1937
+ /// #### Example 2B - Propagating a Node-API JS exception:
1938
+ ///
1939
+ /// Napi::Function jsFunctionThatThrows = someObj.As<Napi::Function>();
1940
+ /// Napi::Value result = jsFunctionThatThrows({ arg1, arg2 });
1941
+ /// if (result.IsEmpty()) return;
1942
+ ///
1943
+ /// An empty value result from a Node-API call indicates an error occurred,
1944
+ /// and a JavaScript exception is pending. To let the exception propagate, the
1945
+ /// code should generally return immediately from the native callback, after
1946
+ /// performing any necessary cleanup.
1947
+ ///
1948
+ /// #### Example 3B - Handling a Node-API JS exception:
1949
+ ///
1950
+ /// Napi::Function jsFunctionThatThrows = someObj.As<Napi::Function>();
1951
+ /// Napi::Value result = jsFunctionThatThrows({ arg1, arg2 });
1952
+ /// if (result.IsEmpty()) {
1953
+ /// Napi::Error e = env.GetAndClearPendingException();
1954
+ /// cerr << "Caught JavaScript exception: " + e.Message();
1955
+ /// }
1956
+ ///
1957
+ /// Since the exception was cleared here, it will not be propagated as a
1958
+ /// JavaScript exception after the native callback returns.
1959
+ class Error : public ObjectReference
1960
+ #ifdef NODE_ADDON_API_CPP_EXCEPTIONS
1961
+ ,
1962
+ public std::exception
1963
+ #endif // NODE_ADDON_API_CPP_EXCEPTIONS
1964
+ {
1965
+ public:
1966
+ static Error New(napi_env env);
1967
+ static Error New(napi_env env, const char* message);
1968
+ static Error New(napi_env env, const std::string& message);
1969
+
1970
+ static NAPI_NO_RETURN void Fatal(const char* location, const char* message);
1971
+
1972
+ Error();
1973
+ Error(napi_env env, napi_value value);
1974
+
1975
+ // An error can be moved or copied.
1976
+ Error(Error&& other);
1977
+ Error& operator=(Error&& other);
1978
+ Error(const Error&);
1979
+ Error& operator=(const Error&);
1980
+
1981
+ const std::string& Message() const NAPI_NOEXCEPT;
1982
+ void ThrowAsJavaScriptException() const;
1983
+
1984
+ Object Value() const;
1985
+
1986
+ #ifdef NODE_ADDON_API_CPP_EXCEPTIONS
1987
+ const char* what() const NAPI_NOEXCEPT override;
1988
+ #endif // NODE_ADDON_API_CPP_EXCEPTIONS
1989
+
1990
+ protected:
1991
+ /// !cond INTERNAL
1992
+ using create_error_fn = napi_status (*)(napi_env envb,
1993
+ napi_value code,
1994
+ napi_value msg,
1995
+ napi_value* result);
1996
+
1997
+ template <typename TError>
1998
+ static TError New(napi_env env,
1999
+ const char* message,
2000
+ size_t length,
2001
+ create_error_fn create_error);
2002
+ /// !endcond
2003
+
2004
+ private:
2005
+ static inline const char* ERROR_WRAP_VALUE() NAPI_NOEXCEPT;
2006
+ mutable std::string _message;
2007
+ };
2008
+
2009
+ class TypeError : public Error {
2010
+ public:
2011
+ static TypeError New(napi_env env, const char* message);
2012
+ static TypeError New(napi_env env, const std::string& message);
2013
+
2014
+ TypeError();
2015
+ TypeError(napi_env env, napi_value value);
2016
+ };
2017
+
2018
+ class RangeError : public Error {
2019
+ public:
2020
+ static RangeError New(napi_env env, const char* message);
2021
+ static RangeError New(napi_env env, const std::string& message);
2022
+
2023
+ RangeError();
2024
+ RangeError(napi_env env, napi_value value);
2025
+ };
2026
+
2027
+ #if NAPI_VERSION > 8
2028
+ class SyntaxError : public Error {
2029
+ public:
2030
+ static SyntaxError New(napi_env env, const char* message);
2031
+ static SyntaxError New(napi_env env, const std::string& message);
2032
+
2033
+ SyntaxError();
2034
+ SyntaxError(napi_env env, napi_value value);
2035
+ };
2036
+ #endif // NAPI_VERSION > 8
2037
+
2038
+ class CallbackInfo {
2039
+ public:
2040
+ CallbackInfo(napi_env env, napi_callback_info info);
2041
+ ~CallbackInfo();
2042
+
2043
+ // Disallow copying to prevent multiple free of _dynamicArgs
2044
+ NAPI_DISALLOW_ASSIGN_COPY(CallbackInfo)
2045
+
2046
+ Napi::Env Env() const;
2047
+ Value NewTarget() const;
2048
+ bool IsConstructCall() const;
2049
+ size_t Length() const;
2050
+ const Value operator[](size_t index) const;
2051
+ Value This() const;
2052
+ void* Data() const;
2053
+ void SetData(void* data);
2054
+ explicit operator napi_callback_info() const;
2055
+
2056
+ private:
2057
+ const size_t _staticArgCount = 6;
2058
+ napi_env _env;
2059
+ napi_callback_info _info;
2060
+ napi_value _this;
2061
+ size_t _argc;
2062
+ napi_value* _argv;
2063
+ napi_value _staticArgs[6]{};
2064
+ napi_value* _dynamicArgs;
2065
+ void* _data;
2066
+ };
2067
+
2068
+ class PropertyDescriptor {
2069
+ public:
2070
+ using GetterCallback = Napi::Value (*)(const Napi::CallbackInfo& info);
2071
+ using SetterCallback = void (*)(const Napi::CallbackInfo& info);
2072
+
2073
+ #ifndef NODE_ADDON_API_DISABLE_DEPRECATED
2074
+ template <typename Getter>
2075
+ static PropertyDescriptor Accessor(
2076
+ const char* utf8name,
2077
+ Getter getter,
2078
+ napi_property_attributes attributes = napi_default,
2079
+ void* data = nullptr);
2080
+ template <typename Getter>
2081
+ static PropertyDescriptor Accessor(
2082
+ const std::string& utf8name,
2083
+ Getter getter,
2084
+ napi_property_attributes attributes = napi_default,
2085
+ void* data = nullptr);
2086
+ template <typename Getter>
2087
+ static PropertyDescriptor Accessor(
2088
+ napi_value name,
2089
+ Getter getter,
2090
+ napi_property_attributes attributes = napi_default,
2091
+ void* data = nullptr);
2092
+ template <typename Getter>
2093
+ static PropertyDescriptor Accessor(
2094
+ Name name,
2095
+ Getter getter,
2096
+ napi_property_attributes attributes = napi_default,
2097
+ void* data = nullptr);
2098
+ template <typename Getter, typename Setter>
2099
+ static PropertyDescriptor Accessor(
2100
+ const char* utf8name,
2101
+ Getter getter,
2102
+ Setter setter,
2103
+ napi_property_attributes attributes = napi_default,
2104
+ void* data = nullptr);
2105
+ template <typename Getter, typename Setter>
2106
+ static PropertyDescriptor Accessor(
2107
+ const std::string& utf8name,
2108
+ Getter getter,
2109
+ Setter setter,
2110
+ napi_property_attributes attributes = napi_default,
2111
+ void* data = nullptr);
2112
+ template <typename Getter, typename Setter>
2113
+ static PropertyDescriptor Accessor(
2114
+ napi_value name,
2115
+ Getter getter,
2116
+ Setter setter,
2117
+ napi_property_attributes attributes = napi_default,
2118
+ void* data = nullptr);
2119
+ template <typename Getter, typename Setter>
2120
+ static PropertyDescriptor Accessor(
2121
+ Name name,
2122
+ Getter getter,
2123
+ Setter setter,
2124
+ napi_property_attributes attributes = napi_default,
2125
+ void* data = nullptr);
2126
+ template <typename Callable>
2127
+ static PropertyDescriptor Function(
2128
+ const char* utf8name,
2129
+ Callable cb,
2130
+ napi_property_attributes attributes = napi_default,
2131
+ void* data = nullptr);
2132
+ template <typename Callable>
2133
+ static PropertyDescriptor Function(
2134
+ const std::string& utf8name,
2135
+ Callable cb,
2136
+ napi_property_attributes attributes = napi_default,
2137
+ void* data = nullptr);
2138
+ template <typename Callable>
2139
+ static PropertyDescriptor Function(
2140
+ napi_value name,
2141
+ Callable cb,
2142
+ napi_property_attributes attributes = napi_default,
2143
+ void* data = nullptr);
2144
+ template <typename Callable>
2145
+ static PropertyDescriptor Function(
2146
+ Name name,
2147
+ Callable cb,
2148
+ napi_property_attributes attributes = napi_default,
2149
+ void* data = nullptr);
2150
+ #endif // !NODE_ADDON_API_DISABLE_DEPRECATED
2151
+
2152
+ template <GetterCallback Getter>
2153
+ static PropertyDescriptor Accessor(
2154
+ const char* utf8name,
2155
+ napi_property_attributes attributes = napi_default,
2156
+ void* data = nullptr);
2157
+
2158
+ template <GetterCallback Getter>
2159
+ static PropertyDescriptor Accessor(
2160
+ const std::string& utf8name,
2161
+ napi_property_attributes attributes = napi_default,
2162
+ void* data = nullptr);
2163
+
2164
+ template <GetterCallback Getter>
2165
+ static PropertyDescriptor Accessor(
2166
+ Name name,
2167
+ napi_property_attributes attributes = napi_default,
2168
+ void* data = nullptr);
2169
+
2170
+ template <GetterCallback Getter, SetterCallback Setter>
2171
+ static PropertyDescriptor Accessor(
2172
+ const char* utf8name,
2173
+ napi_property_attributes attributes = napi_default,
2174
+ void* data = nullptr);
2175
+
2176
+ template <GetterCallback Getter, SetterCallback Setter>
2177
+ static PropertyDescriptor Accessor(
2178
+ const std::string& utf8name,
2179
+ napi_property_attributes attributes = napi_default,
2180
+ void* data = nullptr);
2181
+
2182
+ template <GetterCallback Getter, SetterCallback Setter>
2183
+ static PropertyDescriptor Accessor(
2184
+ Name name,
2185
+ napi_property_attributes attributes = napi_default,
2186
+ void* data = nullptr);
2187
+
2188
+ template <typename Getter>
2189
+ static PropertyDescriptor Accessor(
2190
+ Napi::Env env,
2191
+ Napi::Object object,
2192
+ const char* utf8name,
2193
+ Getter getter,
2194
+ napi_property_attributes attributes = napi_default,
2195
+ void* data = nullptr);
2196
+ template <typename Getter>
2197
+ static PropertyDescriptor Accessor(
2198
+ Napi::Env env,
2199
+ Napi::Object object,
2200
+ const std::string& utf8name,
2201
+ Getter getter,
2202
+ napi_property_attributes attributes = napi_default,
2203
+ void* data = nullptr);
2204
+ template <typename Getter>
2205
+ static PropertyDescriptor Accessor(
2206
+ Napi::Env env,
2207
+ Napi::Object object,
2208
+ Name name,
2209
+ Getter getter,
2210
+ napi_property_attributes attributes = napi_default,
2211
+ void* data = nullptr);
2212
+ template <typename Getter, typename Setter>
2213
+ static PropertyDescriptor Accessor(
2214
+ Napi::Env env,
2215
+ Napi::Object object,
2216
+ const char* utf8name,
2217
+ Getter getter,
2218
+ Setter setter,
2219
+ napi_property_attributes attributes = napi_default,
2220
+ void* data = nullptr);
2221
+ template <typename Getter, typename Setter>
2222
+ static PropertyDescriptor Accessor(
2223
+ Napi::Env env,
2224
+ Napi::Object object,
2225
+ const std::string& utf8name,
2226
+ Getter getter,
2227
+ Setter setter,
2228
+ napi_property_attributes attributes = napi_default,
2229
+ void* data = nullptr);
2230
+ template <typename Getter, typename Setter>
2231
+ static PropertyDescriptor Accessor(
2232
+ Napi::Env env,
2233
+ Napi::Object object,
2234
+ Name name,
2235
+ Getter getter,
2236
+ Setter setter,
2237
+ napi_property_attributes attributes = napi_default,
2238
+ void* data = nullptr);
2239
+ template <typename Callable>
2240
+ static PropertyDescriptor Function(
2241
+ Napi::Env env,
2242
+ Napi::Object object,
2243
+ const char* utf8name,
2244
+ Callable cb,
2245
+ napi_property_attributes attributes = napi_default,
2246
+ void* data = nullptr);
2247
+ template <typename Callable>
2248
+ static PropertyDescriptor Function(
2249
+ Napi::Env env,
2250
+ Napi::Object object,
2251
+ const std::string& utf8name,
2252
+ Callable cb,
2253
+ napi_property_attributes attributes = napi_default,
2254
+ void* data = nullptr);
2255
+ template <typename Callable>
2256
+ static PropertyDescriptor Function(
2257
+ Napi::Env env,
2258
+ Napi::Object object,
2259
+ Name name,
2260
+ Callable cb,
2261
+ napi_property_attributes attributes = napi_default,
2262
+ void* data = nullptr);
2263
+ static PropertyDescriptor Value(
2264
+ const char* utf8name,
2265
+ napi_value value,
2266
+ napi_property_attributes attributes = napi_default);
2267
+ static PropertyDescriptor Value(
2268
+ const std::string& utf8name,
2269
+ napi_value value,
2270
+ napi_property_attributes attributes = napi_default);
2271
+ static PropertyDescriptor Value(
2272
+ napi_value name,
2273
+ napi_value value,
2274
+ napi_property_attributes attributes = napi_default);
2275
+ static PropertyDescriptor Value(
2276
+ Name name,
2277
+ Napi::Value value,
2278
+ napi_property_attributes attributes = napi_default);
2279
+
2280
+ PropertyDescriptor(napi_property_descriptor desc);
2281
+
2282
+ operator napi_property_descriptor&();
2283
+ operator const napi_property_descriptor&() const;
2284
+
2285
+ private:
2286
+ napi_property_descriptor _desc;
2287
+ };
2288
+
2289
+ /// Property descriptor for use with `ObjectWrap::DefineClass()`.
2290
+ ///
2291
+ /// This is different from the standalone `PropertyDescriptor` because it is
2292
+ /// specific to each `ObjectWrap<T>` subclass. This prevents using descriptors
2293
+ /// from a different class when defining a new class (preventing the callbacks
2294
+ /// from having incorrect `this` pointers).
2295
+ template <typename T>
2296
+ class ClassPropertyDescriptor {
2297
+ public:
2298
+ ClassPropertyDescriptor(napi_property_descriptor desc) : _desc(desc) {}
2299
+
2300
+ operator napi_property_descriptor&() { return _desc; }
2301
+ operator const napi_property_descriptor&() const { return _desc; }
2302
+
2303
+ private:
2304
+ napi_property_descriptor _desc;
2305
+ };
2306
+
2307
+ template <typename T, typename TCallback>
2308
+ struct MethodCallbackData {
2309
+ TCallback callback;
2310
+ void* data;
2311
+ };
2312
+
2313
+ template <typename T, typename TGetterCallback, typename TSetterCallback>
2314
+ struct AccessorCallbackData {
2315
+ TGetterCallback getterCallback;
2316
+ TSetterCallback setterCallback;
2317
+ void* data;
2318
+ };
2319
+
2320
+ template <typename T>
2321
+ class InstanceWrap {
2322
+ public:
2323
+ using InstanceVoidMethodCallback = void (T::*)(const CallbackInfo& info);
2324
+ using InstanceMethodCallback = Napi::Value (T::*)(const CallbackInfo& info);
2325
+ using InstanceGetterCallback = Napi::Value (T::*)(const CallbackInfo& info);
2326
+ using InstanceSetterCallback = void (T::*)(const CallbackInfo& info,
2327
+ const Napi::Value& value);
2328
+
2329
+ using PropertyDescriptor = ClassPropertyDescriptor<T>;
2330
+
2331
+ static PropertyDescriptor InstanceMethod(
2332
+ const char* utf8name,
2333
+ InstanceVoidMethodCallback method,
2334
+ napi_property_attributes attributes = napi_default,
2335
+ void* data = nullptr);
2336
+ static PropertyDescriptor InstanceMethod(
2337
+ const char* utf8name,
2338
+ InstanceMethodCallback method,
2339
+ napi_property_attributes attributes = napi_default,
2340
+ void* data = nullptr);
2341
+ static PropertyDescriptor InstanceMethod(
2342
+ Symbol name,
2343
+ InstanceVoidMethodCallback method,
2344
+ napi_property_attributes attributes = napi_default,
2345
+ void* data = nullptr);
2346
+ static PropertyDescriptor InstanceMethod(
2347
+ Symbol name,
2348
+ InstanceMethodCallback method,
2349
+ napi_property_attributes attributes = napi_default,
2350
+ void* data = nullptr);
2351
+ template <InstanceVoidMethodCallback method>
2352
+ static PropertyDescriptor InstanceMethod(
2353
+ const char* utf8name,
2354
+ napi_property_attributes attributes = napi_default,
2355
+ void* data = nullptr);
2356
+ template <InstanceMethodCallback method>
2357
+ static PropertyDescriptor InstanceMethod(
2358
+ const char* utf8name,
2359
+ napi_property_attributes attributes = napi_default,
2360
+ void* data = nullptr);
2361
+ template <InstanceVoidMethodCallback method>
2362
+ static PropertyDescriptor InstanceMethod(
2363
+ Symbol name,
2364
+ napi_property_attributes attributes = napi_default,
2365
+ void* data = nullptr);
2366
+ template <InstanceMethodCallback method>
2367
+ static PropertyDescriptor InstanceMethod(
2368
+ Symbol name,
2369
+ napi_property_attributes attributes = napi_default,
2370
+ void* data = nullptr);
2371
+ static PropertyDescriptor InstanceAccessor(
2372
+ const char* utf8name,
2373
+ InstanceGetterCallback getter,
2374
+ InstanceSetterCallback setter,
2375
+ napi_property_attributes attributes = napi_default,
2376
+ void* data = nullptr);
2377
+ static PropertyDescriptor InstanceAccessor(
2378
+ Symbol name,
2379
+ InstanceGetterCallback getter,
2380
+ InstanceSetterCallback setter,
2381
+ napi_property_attributes attributes = napi_default,
2382
+ void* data = nullptr);
2383
+ template <InstanceGetterCallback getter,
2384
+ InstanceSetterCallback setter = nullptr>
2385
+ static PropertyDescriptor InstanceAccessor(
2386
+ const char* utf8name,
2387
+ napi_property_attributes attributes = napi_default,
2388
+ void* data = nullptr);
2389
+ template <InstanceGetterCallback getter,
2390
+ InstanceSetterCallback setter = nullptr>
2391
+ static PropertyDescriptor InstanceAccessor(
2392
+ Symbol name,
2393
+ napi_property_attributes attributes = napi_default,
2394
+ void* data = nullptr);
2395
+ static PropertyDescriptor InstanceValue(
2396
+ const char* utf8name,
2397
+ Napi::Value value,
2398
+ napi_property_attributes attributes = napi_default);
2399
+ static PropertyDescriptor InstanceValue(
2400
+ Symbol name,
2401
+ Napi::Value value,
2402
+ napi_property_attributes attributes = napi_default);
2403
+
2404
+ protected:
2405
+ static void AttachPropData(napi_env env,
2406
+ napi_value value,
2407
+ const napi_property_descriptor* prop);
2408
+
2409
+ private:
2410
+ using This = InstanceWrap<T>;
2411
+
2412
+ using InstanceVoidMethodCallbackData =
2413
+ MethodCallbackData<T, InstanceVoidMethodCallback>;
2414
+ using InstanceMethodCallbackData =
2415
+ MethodCallbackData<T, InstanceMethodCallback>;
2416
+ using InstanceAccessorCallbackData =
2417
+ AccessorCallbackData<T, InstanceGetterCallback, InstanceSetterCallback>;
2418
+
2419
+ static napi_value InstanceVoidMethodCallbackWrapper(napi_env env,
2420
+ napi_callback_info info);
2421
+ static napi_value InstanceMethodCallbackWrapper(napi_env env,
2422
+ napi_callback_info info);
2423
+ static napi_value InstanceGetterCallbackWrapper(napi_env env,
2424
+ napi_callback_info info);
2425
+ static napi_value InstanceSetterCallbackWrapper(napi_env env,
2426
+ napi_callback_info info);
2427
+
2428
+ template <InstanceSetterCallback method>
2429
+ static napi_value WrappedMethod(napi_env env,
2430
+ napi_callback_info info) NAPI_NOEXCEPT;
2431
+
2432
+ template <InstanceSetterCallback setter>
2433
+ struct SetterTag {};
2434
+
2435
+ template <InstanceSetterCallback setter>
2436
+ static napi_callback WrapSetter(SetterTag<setter>) NAPI_NOEXCEPT {
2437
+ return &This::WrappedMethod<setter>;
2438
+ }
2439
+ static napi_callback WrapSetter(SetterTag<nullptr>) NAPI_NOEXCEPT {
2440
+ return nullptr;
2441
+ }
2442
+ };
2443
+
2444
+ /// Base class to be extended by C++ classes exposed to JavaScript; each C++
2445
+ /// class instance gets "wrapped" by a JavaScript object that is managed by this
2446
+ /// class.
2447
+ ///
2448
+ /// At initialization time, the `DefineClass()` method must be used to
2449
+ /// hook up the accessor and method callbacks. It takes a list of
2450
+ /// property descriptors, which can be constructed via the various
2451
+ /// static methods on the base class.
2452
+ ///
2453
+ /// #### Example:
2454
+ ///
2455
+ /// class Example: public Napi::ObjectWrap<Example> {
2456
+ /// public:
2457
+ /// static void Initialize(Napi::Env& env, Napi::Object& target) {
2458
+ /// Napi::Function constructor = DefineClass(env, "Example", {
2459
+ /// InstanceAccessor<&Example::GetSomething,
2460
+ /// &Example::SetSomething>("value"),
2461
+ /// InstanceMethod<&Example::DoSomething>("doSomething"),
2462
+ /// });
2463
+ /// target.Set("Example", constructor);
2464
+ /// }
2465
+ ///
2466
+ /// Example(const Napi::CallbackInfo& info); // Constructor
2467
+ /// Napi::Value GetSomething(const Napi::CallbackInfo& info);
2468
+ /// void SetSomething(const Napi::CallbackInfo& info, const Napi::Value&
2469
+ /// value); Napi::Value DoSomething(const Napi::CallbackInfo& info);
2470
+ /// }
2471
+ template <typename T>
2472
+ class ObjectWrap : public InstanceWrap<T>, public Reference<Object> {
2473
+ public:
2474
+ ObjectWrap(const CallbackInfo& callbackInfo);
2475
+ virtual ~ObjectWrap();
2476
+
2477
+ static T* Unwrap(Object wrapper);
2478
+
2479
+ // Methods exposed to JavaScript must conform to one of these callback
2480
+ // signatures.
2481
+ using StaticVoidMethodCallback = void (*)(const CallbackInfo& info);
2482
+ using StaticMethodCallback = Napi::Value (*)(const CallbackInfo& info);
2483
+ using StaticGetterCallback = Napi::Value (*)(const CallbackInfo& info);
2484
+ using StaticSetterCallback = void (*)(const CallbackInfo& info,
2485
+ const Napi::Value& value);
2486
+
2487
+ using PropertyDescriptor = ClassPropertyDescriptor<T>;
2488
+
2489
+ static Function DefineClass(
2490
+ Napi::Env env,
2491
+ const char* utf8name,
2492
+ const std::initializer_list<PropertyDescriptor>& properties,
2493
+ void* data = nullptr);
2494
+ static Function DefineClass(Napi::Env env,
2495
+ const char* utf8name,
2496
+ const std::vector<PropertyDescriptor>& properties,
2497
+ void* data = nullptr);
2498
+ static PropertyDescriptor StaticMethod(
2499
+ const char* utf8name,
2500
+ StaticVoidMethodCallback method,
2501
+ napi_property_attributes attributes = napi_default,
2502
+ void* data = nullptr);
2503
+ static PropertyDescriptor StaticMethod(
2504
+ const char* utf8name,
2505
+ StaticMethodCallback method,
2506
+ napi_property_attributes attributes = napi_default,
2507
+ void* data = nullptr);
2508
+ static PropertyDescriptor StaticMethod(
2509
+ Symbol name,
2510
+ StaticVoidMethodCallback method,
2511
+ napi_property_attributes attributes = napi_default,
2512
+ void* data = nullptr);
2513
+ static PropertyDescriptor StaticMethod(
2514
+ Symbol name,
2515
+ StaticMethodCallback method,
2516
+ napi_property_attributes attributes = napi_default,
2517
+ void* data = nullptr);
2518
+ template <StaticVoidMethodCallback method>
2519
+ static PropertyDescriptor StaticMethod(
2520
+ const char* utf8name,
2521
+ napi_property_attributes attributes = napi_default,
2522
+ void* data = nullptr);
2523
+ template <StaticVoidMethodCallback method>
2524
+ static PropertyDescriptor StaticMethod(
2525
+ Symbol name,
2526
+ napi_property_attributes attributes = napi_default,
2527
+ void* data = nullptr);
2528
+ template <StaticMethodCallback method>
2529
+ static PropertyDescriptor StaticMethod(
2530
+ const char* utf8name,
2531
+ napi_property_attributes attributes = napi_default,
2532
+ void* data = nullptr);
2533
+ template <StaticMethodCallback method>
2534
+ static PropertyDescriptor StaticMethod(
2535
+ Symbol name,
2536
+ napi_property_attributes attributes = napi_default,
2537
+ void* data = nullptr);
2538
+ static PropertyDescriptor StaticAccessor(
2539
+ const char* utf8name,
2540
+ StaticGetterCallback getter,
2541
+ StaticSetterCallback setter,
2542
+ napi_property_attributes attributes = napi_default,
2543
+ void* data = nullptr);
2544
+ static PropertyDescriptor StaticAccessor(
2545
+ Symbol name,
2546
+ StaticGetterCallback getter,
2547
+ StaticSetterCallback setter,
2548
+ napi_property_attributes attributes = napi_default,
2549
+ void* data = nullptr);
2550
+ template <StaticGetterCallback getter, StaticSetterCallback setter = nullptr>
2551
+ static PropertyDescriptor StaticAccessor(
2552
+ const char* utf8name,
2553
+ napi_property_attributes attributes = napi_default,
2554
+ void* data = nullptr);
2555
+ template <StaticGetterCallback getter, StaticSetterCallback setter = nullptr>
2556
+ static PropertyDescriptor StaticAccessor(
2557
+ Symbol name,
2558
+ napi_property_attributes attributes = napi_default,
2559
+ void* data = nullptr);
2560
+ static PropertyDescriptor StaticValue(
2561
+ const char* utf8name,
2562
+ Napi::Value value,
2563
+ napi_property_attributes attributes = napi_default);
2564
+ static PropertyDescriptor StaticValue(
2565
+ Symbol name,
2566
+ Napi::Value value,
2567
+ napi_property_attributes attributes = napi_default);
2568
+ static Napi::Value OnCalledAsFunction(const Napi::CallbackInfo& callbackInfo);
2569
+ virtual void Finalize(Napi::Env env);
2570
+ virtual void Finalize(BasicEnv env);
2571
+
2572
+ private:
2573
+ using This = ObjectWrap<T>;
2574
+
2575
+ static napi_value ConstructorCallbackWrapper(napi_env env,
2576
+ napi_callback_info info);
2577
+ static napi_value StaticVoidMethodCallbackWrapper(napi_env env,
2578
+ napi_callback_info info);
2579
+ static napi_value StaticMethodCallbackWrapper(napi_env env,
2580
+ napi_callback_info info);
2581
+ static napi_value StaticGetterCallbackWrapper(napi_env env,
2582
+ napi_callback_info info);
2583
+ static napi_value StaticSetterCallbackWrapper(napi_env env,
2584
+ napi_callback_info info);
2585
+ static void FinalizeCallback(node_addon_api_basic_env env,
2586
+ void* data,
2587
+ void* hint);
2588
+
2589
+ static void PostFinalizeCallback(napi_env env, void* data, void* hint);
2590
+
2591
+ static Function DefineClass(Napi::Env env,
2592
+ const char* utf8name,
2593
+ const size_t props_count,
2594
+ const napi_property_descriptor* props,
2595
+ void* data = nullptr);
2596
+
2597
+ using StaticVoidMethodCallbackData =
2598
+ MethodCallbackData<T, StaticVoidMethodCallback>;
2599
+ using StaticMethodCallbackData = MethodCallbackData<T, StaticMethodCallback>;
2600
+
2601
+ using StaticAccessorCallbackData =
2602
+ AccessorCallbackData<T, StaticGetterCallback, StaticSetterCallback>;
2603
+
2604
+ template <StaticSetterCallback method>
2605
+ static napi_value WrappedMethod(napi_env env,
2606
+ napi_callback_info info) NAPI_NOEXCEPT;
2607
+
2608
+ template <StaticSetterCallback setter>
2609
+ struct StaticSetterTag {};
2610
+
2611
+ template <StaticSetterCallback setter>
2612
+ static napi_callback WrapStaticSetter(StaticSetterTag<setter>) NAPI_NOEXCEPT {
2613
+ return &This::WrappedMethod<setter>;
2614
+ }
2615
+ static napi_callback WrapStaticSetter(StaticSetterTag<nullptr>)
2616
+ NAPI_NOEXCEPT {
2617
+ return nullptr;
2618
+ }
2619
+
2620
+ bool _construction_failed = true;
2621
+ bool _finalized = false;
2622
+ };
2623
+
2624
+ class HandleScope {
2625
+ public:
2626
+ HandleScope(napi_env env, napi_handle_scope scope);
2627
+ explicit HandleScope(Napi::Env env);
2628
+ ~HandleScope();
2629
+
2630
+ // Disallow copying to prevent double close of napi_handle_scope
2631
+ NAPI_DISALLOW_ASSIGN_COPY(HandleScope)
2632
+
2633
+ operator napi_handle_scope() const;
2634
+
2635
+ Napi::Env Env() const;
2636
+
2637
+ private:
2638
+ napi_env _env;
2639
+ napi_handle_scope _scope;
2640
+ };
2641
+
2642
+ class EscapableHandleScope {
2643
+ public:
2644
+ EscapableHandleScope(napi_env env, napi_escapable_handle_scope scope);
2645
+ explicit EscapableHandleScope(Napi::Env env);
2646
+ ~EscapableHandleScope();
2647
+
2648
+ // Disallow copying to prevent double close of napi_escapable_handle_scope
2649
+ NAPI_DISALLOW_ASSIGN_COPY(EscapableHandleScope)
2650
+
2651
+ operator napi_escapable_handle_scope() const;
2652
+
2653
+ Napi::Env Env() const;
2654
+ Value Escape(napi_value escapee);
2655
+
2656
+ private:
2657
+ napi_env _env;
2658
+ napi_escapable_handle_scope _scope;
2659
+ };
2660
+
2661
+ #if (NAPI_VERSION > 2)
2662
+ class CallbackScope {
2663
+ public:
2664
+ CallbackScope(napi_env env, napi_callback_scope scope);
2665
+ CallbackScope(napi_env env, napi_async_context context);
2666
+ virtual ~CallbackScope();
2667
+
2668
+ // Disallow copying to prevent double close of napi_callback_scope
2669
+ NAPI_DISALLOW_ASSIGN_COPY(CallbackScope)
2670
+
2671
+ operator napi_callback_scope() const;
2672
+
2673
+ Napi::Env Env() const;
2674
+
2675
+ private:
2676
+ napi_env _env;
2677
+ napi_callback_scope _scope;
2678
+ };
2679
+ #endif
2680
+
2681
+ class AsyncContext {
2682
+ public:
2683
+ explicit AsyncContext(napi_env env, const char* resource_name);
2684
+ explicit AsyncContext(napi_env env,
2685
+ const char* resource_name,
2686
+ const Object& resource);
2687
+ virtual ~AsyncContext();
2688
+
2689
+ AsyncContext(AsyncContext&& other);
2690
+ AsyncContext& operator=(AsyncContext&& other);
2691
+ NAPI_DISALLOW_ASSIGN_COPY(AsyncContext)
2692
+
2693
+ operator napi_async_context() const;
2694
+
2695
+ Napi::Env Env() const;
2696
+
2697
+ private:
2698
+ napi_env _env;
2699
+ napi_async_context _context;
2700
+ };
2701
+
2702
+ #if NAPI_HAS_THREADS
2703
+ class AsyncWorker {
2704
+ public:
2705
+ virtual ~AsyncWorker();
2706
+
2707
+ NAPI_DISALLOW_ASSIGN_COPY(AsyncWorker)
2708
+
2709
+ operator napi_async_work() const;
2710
+
2711
+ Napi::Env Env() const;
2712
+
2713
+ void Queue();
2714
+ void Cancel();
2715
+ void SuppressDestruct();
2716
+
2717
+ ObjectReference& Receiver();
2718
+ FunctionReference& Callback();
2719
+
2720
+ virtual void OnExecute(Napi::Env env);
2721
+ virtual void OnWorkComplete(Napi::Env env, napi_status status);
2722
+
2723
+ protected:
2724
+ explicit AsyncWorker(const Function& callback);
2725
+ explicit AsyncWorker(const Function& callback, const char* resource_name);
2726
+ explicit AsyncWorker(const Function& callback,
2727
+ const char* resource_name,
2728
+ const Object& resource);
2729
+ explicit AsyncWorker(const Object& receiver, const Function& callback);
2730
+ explicit AsyncWorker(const Object& receiver,
2731
+ const Function& callback,
2732
+ const char* resource_name);
2733
+ explicit AsyncWorker(const Object& receiver,
2734
+ const Function& callback,
2735
+ const char* resource_name,
2736
+ const Object& resource);
2737
+
2738
+ explicit AsyncWorker(Napi::Env env);
2739
+ explicit AsyncWorker(Napi::Env env, const char* resource_name);
2740
+ explicit AsyncWorker(Napi::Env env,
2741
+ const char* resource_name,
2742
+ const Object& resource);
2743
+
2744
+ virtual void Execute() = 0;
2745
+ virtual void OnOK();
2746
+ virtual void OnError(const Error& e);
2747
+ virtual void Destroy();
2748
+ virtual std::vector<napi_value> GetResult(Napi::Env env);
2749
+
2750
+ void SetError(const std::string& error);
2751
+
2752
+ private:
2753
+ static inline void OnAsyncWorkExecute(napi_env env, void* asyncworker);
2754
+ static inline void OnAsyncWorkComplete(napi_env env,
2755
+ napi_status status,
2756
+ void* asyncworker);
2757
+
2758
+ napi_env _env;
2759
+ napi_async_work _work;
2760
+ ObjectReference _receiver;
2761
+ FunctionReference _callback;
2762
+ std::string _error;
2763
+ bool _suppress_destruct;
2764
+ };
2765
+ #endif // NAPI_HAS_THREADS
2766
+
2767
+ #if (NAPI_VERSION > 3 && NAPI_HAS_THREADS)
2768
+ class ThreadSafeFunction {
2769
+ public:
2770
+ // This API may only be called from the main thread.
2771
+ template <typename ResourceString>
2772
+ static ThreadSafeFunction New(napi_env env,
2773
+ const Function& callback,
2774
+ ResourceString resourceName,
2775
+ size_t maxQueueSize,
2776
+ size_t initialThreadCount);
2777
+
2778
+ // This API may only be called from the main thread.
2779
+ template <typename ResourceString, typename ContextType>
2780
+ static ThreadSafeFunction New(napi_env env,
2781
+ const Function& callback,
2782
+ ResourceString resourceName,
2783
+ size_t maxQueueSize,
2784
+ size_t initialThreadCount,
2785
+ ContextType* context);
2786
+
2787
+ // This API may only be called from the main thread.
2788
+ template <typename ResourceString, typename Finalizer>
2789
+ static ThreadSafeFunction New(napi_env env,
2790
+ const Function& callback,
2791
+ ResourceString resourceName,
2792
+ size_t maxQueueSize,
2793
+ size_t initialThreadCount,
2794
+ Finalizer finalizeCallback);
2795
+
2796
+ // This API may only be called from the main thread.
2797
+ template <typename ResourceString,
2798
+ typename Finalizer,
2799
+ typename FinalizerDataType>
2800
+ static ThreadSafeFunction New(napi_env env,
2801
+ const Function& callback,
2802
+ ResourceString resourceName,
2803
+ size_t maxQueueSize,
2804
+ size_t initialThreadCount,
2805
+ Finalizer finalizeCallback,
2806
+ FinalizerDataType* data);
2807
+
2808
+ // This API may only be called from the main thread.
2809
+ template <typename ResourceString, typename ContextType, typename Finalizer>
2810
+ static ThreadSafeFunction New(napi_env env,
2811
+ const Function& callback,
2812
+ ResourceString resourceName,
2813
+ size_t maxQueueSize,
2814
+ size_t initialThreadCount,
2815
+ ContextType* context,
2816
+ Finalizer finalizeCallback);
2817
+
2818
+ // This API may only be called from the main thread.
2819
+ template <typename ResourceString,
2820
+ typename ContextType,
2821
+ typename Finalizer,
2822
+ typename FinalizerDataType>
2823
+ static ThreadSafeFunction New(napi_env env,
2824
+ const Function& callback,
2825
+ ResourceString resourceName,
2826
+ size_t maxQueueSize,
2827
+ size_t initialThreadCount,
2828
+ ContextType* context,
2829
+ Finalizer finalizeCallback,
2830
+ FinalizerDataType* data);
2831
+
2832
+ // This API may only be called from the main thread.
2833
+ template <typename ResourceString>
2834
+ static ThreadSafeFunction New(napi_env env,
2835
+ const Function& callback,
2836
+ const Object& resource,
2837
+ ResourceString resourceName,
2838
+ size_t maxQueueSize,
2839
+ size_t initialThreadCount);
2840
+
2841
+ // This API may only be called from the main thread.
2842
+ template <typename ResourceString, typename ContextType>
2843
+ static ThreadSafeFunction New(napi_env env,
2844
+ const Function& callback,
2845
+ const Object& resource,
2846
+ ResourceString resourceName,
2847
+ size_t maxQueueSize,
2848
+ size_t initialThreadCount,
2849
+ ContextType* context);
2850
+
2851
+ // This API may only be called from the main thread.
2852
+ template <typename ResourceString, typename Finalizer>
2853
+ static ThreadSafeFunction New(napi_env env,
2854
+ const Function& callback,
2855
+ const Object& resource,
2856
+ ResourceString resourceName,
2857
+ size_t maxQueueSize,
2858
+ size_t initialThreadCount,
2859
+ Finalizer finalizeCallback);
2860
+
2861
+ // This API may only be called from the main thread.
2862
+ template <typename ResourceString,
2863
+ typename Finalizer,
2864
+ typename FinalizerDataType>
2865
+ static ThreadSafeFunction New(napi_env env,
2866
+ const Function& callback,
2867
+ const Object& resource,
2868
+ ResourceString resourceName,
2869
+ size_t maxQueueSize,
2870
+ size_t initialThreadCount,
2871
+ Finalizer finalizeCallback,
2872
+ FinalizerDataType* data);
2873
+
2874
+ // This API may only be called from the main thread.
2875
+ template <typename ResourceString, typename ContextType, typename Finalizer>
2876
+ static ThreadSafeFunction New(napi_env env,
2877
+ const Function& callback,
2878
+ const Object& resource,
2879
+ ResourceString resourceName,
2880
+ size_t maxQueueSize,
2881
+ size_t initialThreadCount,
2882
+ ContextType* context,
2883
+ Finalizer finalizeCallback);
2884
+
2885
+ // This API may only be called from the main thread.
2886
+ template <typename ResourceString,
2887
+ typename ContextType,
2888
+ typename Finalizer,
2889
+ typename FinalizerDataType>
2890
+ static ThreadSafeFunction New(napi_env env,
2891
+ const Function& callback,
2892
+ const Object& resource,
2893
+ ResourceString resourceName,
2894
+ size_t maxQueueSize,
2895
+ size_t initialThreadCount,
2896
+ ContextType* context,
2897
+ Finalizer finalizeCallback,
2898
+ FinalizerDataType* data);
2899
+
2900
+ ThreadSafeFunction();
2901
+ ThreadSafeFunction(napi_threadsafe_function tsFunctionValue);
2902
+
2903
+ operator napi_threadsafe_function() const;
2904
+
2905
+ // This API may be called from any thread.
2906
+ napi_status BlockingCall() const;
2907
+
2908
+ // This API may be called from any thread.
2909
+ template <typename Callback>
2910
+ napi_status BlockingCall(Callback callback) const;
2911
+
2912
+ // This API may be called from any thread.
2913
+ template <typename DataType, typename Callback>
2914
+ napi_status BlockingCall(DataType* data, Callback callback) const;
2915
+
2916
+ // This API may be called from any thread.
2917
+ napi_status NonBlockingCall() const;
2918
+
2919
+ // This API may be called from any thread.
2920
+ template <typename Callback>
2921
+ napi_status NonBlockingCall(Callback callback) const;
2922
+
2923
+ // This API may be called from any thread.
2924
+ template <typename DataType, typename Callback>
2925
+ napi_status NonBlockingCall(DataType* data, Callback callback) const;
2926
+
2927
+ // This API may only be called from the main thread.
2928
+ void Ref(napi_env env) const;
2929
+
2930
+ // This API may only be called from the main thread.
2931
+ void Unref(napi_env env) const;
2932
+
2933
+ // This API may be called from any thread.
2934
+ napi_status Acquire() const;
2935
+
2936
+ // This API may be called from any thread.
2937
+ napi_status Release() const;
2938
+
2939
+ // This API may be called from any thread.
2940
+ napi_status Abort() const;
2941
+
2942
+ struct ConvertibleContext {
2943
+ template <class T>
2944
+ operator T*() {
2945
+ return static_cast<T*>(context);
2946
+ }
2947
+ void* context;
2948
+ };
2949
+
2950
+ // This API may be called from any thread.
2951
+ ConvertibleContext GetContext() const;
2952
+
2953
+ private:
2954
+ using CallbackWrapper = std::function<void(Napi::Env, Napi::Function)>;
2955
+
2956
+ template <typename ResourceString,
2957
+ typename ContextType,
2958
+ typename Finalizer,
2959
+ typename FinalizerDataType>
2960
+ static ThreadSafeFunction New(napi_env env,
2961
+ const Function& callback,
2962
+ const Object& resource,
2963
+ ResourceString resourceName,
2964
+ size_t maxQueueSize,
2965
+ size_t initialThreadCount,
2966
+ ContextType* context,
2967
+ Finalizer finalizeCallback,
2968
+ FinalizerDataType* data,
2969
+ napi_finalize wrapper);
2970
+
2971
+ napi_status CallInternal(CallbackWrapper* callbackWrapper,
2972
+ napi_threadsafe_function_call_mode mode) const;
2973
+
2974
+ static void CallJS(napi_env env,
2975
+ napi_value jsCallback,
2976
+ void* context,
2977
+ void* data);
2978
+
2979
+ napi_threadsafe_function _tsfn;
2980
+ };
2981
+
2982
+ // A TypedThreadSafeFunction by default has no context (nullptr) and can
2983
+ // accept any type (void) to its CallJs.
2984
+ template <typename ContextType = std::nullptr_t,
2985
+ typename DataType = void,
2986
+ void (*CallJs)(Napi::Env, Napi::Function, ContextType*, DataType*) =
2987
+ nullptr>
2988
+ class TypedThreadSafeFunction {
2989
+ public:
2990
+ // This API may only be called from the main thread.
2991
+ // Helper function that returns nullptr if running Node-API 5+, otherwise a
2992
+ // non-empty, no-op Function. This provides the ability to specify at
2993
+ // compile-time a callback parameter to `New` that safely does no action
2994
+ // when targeting _any_ Node-API version.
2995
+ #if NAPI_VERSION > 4
2996
+ static std::nullptr_t EmptyFunctionFactory(Napi::Env env);
2997
+ #else
2998
+ static Napi::Function EmptyFunctionFactory(Napi::Env env);
2999
+ #endif
3000
+ static Napi::Function FunctionOrEmpty(Napi::Env env,
3001
+ Napi::Function& callback);
3002
+
3003
+ #if NAPI_VERSION > 4
3004
+ // This API may only be called from the main thread.
3005
+ // Creates a new threadsafe function with:
3006
+ // Callback [missing] Resource [missing] Finalizer [missing]
3007
+ template <typename ResourceString>
3008
+ static TypedThreadSafeFunction<ContextType, DataType, CallJs> New(
3009
+ napi_env env,
3010
+ ResourceString resourceName,
3011
+ size_t maxQueueSize,
3012
+ size_t initialThreadCount,
3013
+ ContextType* context = nullptr);
3014
+
3015
+ // This API may only be called from the main thread.
3016
+ // Creates a new threadsafe function with:
3017
+ // Callback [missing] Resource [passed] Finalizer [missing]
3018
+ template <typename ResourceString>
3019
+ static TypedThreadSafeFunction<ContextType, DataType, CallJs> New(
3020
+ napi_env env,
3021
+ const Object& resource,
3022
+ ResourceString resourceName,
3023
+ size_t maxQueueSize,
3024
+ size_t initialThreadCount,
3025
+ ContextType* context = nullptr);
3026
+
3027
+ // This API may only be called from the main thread.
3028
+ // Creates a new threadsafe function with:
3029
+ // Callback [missing] Resource [missing] Finalizer [passed]
3030
+ template <typename ResourceString,
3031
+ typename Finalizer,
3032
+ typename FinalizerDataType = void>
3033
+ static TypedThreadSafeFunction<ContextType, DataType, CallJs> New(
3034
+ napi_env env,
3035
+ ResourceString resourceName,
3036
+ size_t maxQueueSize,
3037
+ size_t initialThreadCount,
3038
+ ContextType* context,
3039
+ Finalizer finalizeCallback,
3040
+ FinalizerDataType* data = nullptr);
3041
+
3042
+ // This API may only be called from the main thread.
3043
+ // Creates a new threadsafe function with:
3044
+ // Callback [missing] Resource [passed] Finalizer [passed]
3045
+ template <typename ResourceString,
3046
+ typename Finalizer,
3047
+ typename FinalizerDataType = void>
3048
+ static TypedThreadSafeFunction<ContextType, DataType, CallJs> New(
3049
+ napi_env env,
3050
+ const Object& resource,
3051
+ ResourceString resourceName,
3052
+ size_t maxQueueSize,
3053
+ size_t initialThreadCount,
3054
+ ContextType* context,
3055
+ Finalizer finalizeCallback,
3056
+ FinalizerDataType* data = nullptr);
3057
+ #endif
3058
+
3059
+ // This API may only be called from the main thread.
3060
+ // Creates a new threadsafe function with:
3061
+ // Callback [passed] Resource [missing] Finalizer [missing]
3062
+ template <typename ResourceString>
3063
+ static TypedThreadSafeFunction<ContextType, DataType, CallJs> New(
3064
+ napi_env env,
3065
+ const Function& callback,
3066
+ ResourceString resourceName,
3067
+ size_t maxQueueSize,
3068
+ size_t initialThreadCount,
3069
+ ContextType* context = nullptr);
3070
+
3071
+ // This API may only be called from the main thread.
3072
+ // Creates a new threadsafe function with:
3073
+ // Callback [passed] Resource [passed] Finalizer [missing]
3074
+ template <typename ResourceString>
3075
+ static TypedThreadSafeFunction<ContextType, DataType, CallJs> New(
3076
+ napi_env env,
3077
+ const Function& callback,
3078
+ const Object& resource,
3079
+ ResourceString resourceName,
3080
+ size_t maxQueueSize,
3081
+ size_t initialThreadCount,
3082
+ ContextType* context = nullptr);
3083
+
3084
+ // This API may only be called from the main thread.
3085
+ // Creates a new threadsafe function with:
3086
+ // Callback [passed] Resource [missing] Finalizer [passed]
3087
+ template <typename ResourceString,
3088
+ typename Finalizer,
3089
+ typename FinalizerDataType = void>
3090
+ static TypedThreadSafeFunction<ContextType, DataType, CallJs> New(
3091
+ napi_env env,
3092
+ const Function& callback,
3093
+ ResourceString resourceName,
3094
+ size_t maxQueueSize,
3095
+ size_t initialThreadCount,
3096
+ ContextType* context,
3097
+ Finalizer finalizeCallback,
3098
+ FinalizerDataType* data = nullptr);
3099
+
3100
+ // This API may only be called from the main thread.
3101
+ // Creates a new threadsafe function with:
3102
+ // Callback [passed] Resource [passed] Finalizer [passed]
3103
+ template <typename CallbackType,
3104
+ typename ResourceString,
3105
+ typename Finalizer,
3106
+ typename FinalizerDataType>
3107
+ static TypedThreadSafeFunction<ContextType, DataType, CallJs> New(
3108
+ napi_env env,
3109
+ CallbackType callback,
3110
+ const Object& resource,
3111
+ ResourceString resourceName,
3112
+ size_t maxQueueSize,
3113
+ size_t initialThreadCount,
3114
+ ContextType* context,
3115
+ Finalizer finalizeCallback,
3116
+ FinalizerDataType* data = nullptr);
3117
+
3118
+ TypedThreadSafeFunction();
3119
+ TypedThreadSafeFunction(napi_threadsafe_function tsFunctionValue);
3120
+
3121
+ operator napi_threadsafe_function() const;
3122
+
3123
+ // This API may be called from any thread.
3124
+ napi_status BlockingCall(DataType* data = nullptr) const;
3125
+
3126
+ // This API may be called from any thread.
3127
+ napi_status NonBlockingCall(DataType* data = nullptr) const;
3128
+
3129
+ // This API may only be called from the main thread.
3130
+ void Ref(napi_env env) const;
3131
+
3132
+ // This API may only be called from the main thread.
3133
+ void Unref(napi_env env) const;
3134
+
3135
+ // This API may be called from any thread.
3136
+ napi_status Acquire() const;
3137
+
3138
+ // This API may be called from any thread.
3139
+ napi_status Release() const;
3140
+
3141
+ // This API may be called from any thread.
3142
+ napi_status Abort() const;
3143
+
3144
+ // This API may be called from any thread.
3145
+ ContextType* GetContext() const;
3146
+
3147
+ private:
3148
+ template <typename ResourceString,
3149
+ typename Finalizer,
3150
+ typename FinalizerDataType>
3151
+ static TypedThreadSafeFunction<ContextType, DataType, CallJs> New(
3152
+ napi_env env,
3153
+ const Function& callback,
3154
+ const Object& resource,
3155
+ ResourceString resourceName,
3156
+ size_t maxQueueSize,
3157
+ size_t initialThreadCount,
3158
+ ContextType* context,
3159
+ Finalizer finalizeCallback,
3160
+ FinalizerDataType* data,
3161
+ napi_finalize wrapper);
3162
+
3163
+ static void CallJsInternal(napi_env env,
3164
+ napi_value jsCallback,
3165
+ void* context,
3166
+ void* data);
3167
+
3168
+ protected:
3169
+ napi_threadsafe_function _tsfn;
3170
+ };
3171
+ template <typename DataType>
3172
+ class AsyncProgressWorkerBase : public AsyncWorker {
3173
+ public:
3174
+ virtual void OnWorkProgress(DataType* data) = 0;
3175
+ class ThreadSafeData {
3176
+ public:
3177
+ ThreadSafeData(AsyncProgressWorkerBase* asyncprogressworker, DataType* data)
3178
+ : _asyncprogressworker(asyncprogressworker), _data(data) {}
3179
+
3180
+ AsyncProgressWorkerBase* asyncprogressworker() {
3181
+ return _asyncprogressworker;
3182
+ }
3183
+ DataType* data() { return _data; }
3184
+
3185
+ private:
3186
+ AsyncProgressWorkerBase* _asyncprogressworker;
3187
+ DataType* _data;
3188
+ };
3189
+ void OnWorkComplete(Napi::Env env, napi_status status) override;
3190
+
3191
+ protected:
3192
+ explicit AsyncProgressWorkerBase(const Object& receiver,
3193
+ const Function& callback,
3194
+ const char* resource_name,
3195
+ const Object& resource,
3196
+ size_t queue_size = 1);
3197
+ virtual ~AsyncProgressWorkerBase();
3198
+
3199
+ // Optional callback of Napi::ThreadSafeFunction only available after
3200
+ // NAPI_VERSION 4. Refs: https://github.com/nodejs/node/pull/27791
3201
+ #if NAPI_VERSION > 4
3202
+ explicit AsyncProgressWorkerBase(Napi::Env env,
3203
+ const char* resource_name,
3204
+ const Object& resource,
3205
+ size_t queue_size = 1);
3206
+ #endif
3207
+
3208
+ static inline void OnAsyncWorkProgress(Napi::Env env,
3209
+ Napi::Function jsCallback,
3210
+ void* data);
3211
+
3212
+ napi_status NonBlockingCall(DataType* data);
3213
+
3214
+ private:
3215
+ ThreadSafeFunction _tsfn;
3216
+ bool _work_completed = false;
3217
+ napi_status _complete_status;
3218
+ static inline void OnThreadSafeFunctionFinalize(
3219
+ Napi::Env env, void* data, AsyncProgressWorkerBase* context);
3220
+ };
3221
+
3222
+ template <class T>
3223
+ class AsyncProgressWorker : public AsyncProgressWorkerBase<void> {
3224
+ public:
3225
+ virtual ~AsyncProgressWorker();
3226
+
3227
+ class ExecutionProgress {
3228
+ friend class AsyncProgressWorker;
3229
+
3230
+ public:
3231
+ void Signal() const;
3232
+ void Send(const T* data, size_t count) const;
3233
+
3234
+ private:
3235
+ explicit ExecutionProgress(AsyncProgressWorker* worker) : _worker(worker) {}
3236
+ AsyncProgressWorker* const _worker;
3237
+ };
3238
+
3239
+ void OnWorkProgress(void*) override;
3240
+
3241
+ protected:
3242
+ explicit AsyncProgressWorker(const Function& callback);
3243
+ explicit AsyncProgressWorker(const Function& callback,
3244
+ const char* resource_name);
3245
+ explicit AsyncProgressWorker(const Function& callback,
3246
+ const char* resource_name,
3247
+ const Object& resource);
3248
+ explicit AsyncProgressWorker(const Object& receiver,
3249
+ const Function& callback);
3250
+ explicit AsyncProgressWorker(const Object& receiver,
3251
+ const Function& callback,
3252
+ const char* resource_name);
3253
+ explicit AsyncProgressWorker(const Object& receiver,
3254
+ const Function& callback,
3255
+ const char* resource_name,
3256
+ const Object& resource);
3257
+
3258
+ // Optional callback of Napi::ThreadSafeFunction only available after
3259
+ // NAPI_VERSION 4. Refs: https://github.com/nodejs/node/pull/27791
3260
+ #if NAPI_VERSION > 4
3261
+ explicit AsyncProgressWorker(Napi::Env env);
3262
+ explicit AsyncProgressWorker(Napi::Env env, const char* resource_name);
3263
+ explicit AsyncProgressWorker(Napi::Env env,
3264
+ const char* resource_name,
3265
+ const Object& resource);
3266
+ #endif
3267
+ virtual void Execute(const ExecutionProgress& progress) = 0;
3268
+ virtual void OnProgress(const T* data, size_t count) = 0;
3269
+
3270
+ private:
3271
+ void Execute() override;
3272
+ void Signal();
3273
+ void SendProgress_(const T* data, size_t count);
3274
+
3275
+ std::mutex _mutex;
3276
+ T* _asyncdata;
3277
+ size_t _asyncsize;
3278
+ bool _signaled;
3279
+ };
3280
+
3281
+ template <class T>
3282
+ class AsyncProgressQueueWorker
3283
+ : public AsyncProgressWorkerBase<std::pair<T*, size_t>> {
3284
+ public:
3285
+ virtual ~AsyncProgressQueueWorker(){};
3286
+
3287
+ class ExecutionProgress {
3288
+ friend class AsyncProgressQueueWorker;
3289
+
3290
+ public:
3291
+ void Signal() const;
3292
+ void Send(const T* data, size_t count) const;
3293
+
3294
+ private:
3295
+ explicit ExecutionProgress(AsyncProgressQueueWorker* worker)
3296
+ : _worker(worker) {}
3297
+ AsyncProgressQueueWorker* const _worker;
3298
+ };
3299
+
3300
+ void OnWorkComplete(Napi::Env env, napi_status status) override;
3301
+ void OnWorkProgress(std::pair<T*, size_t>*) override;
3302
+
3303
+ protected:
3304
+ explicit AsyncProgressQueueWorker(const Function& callback);
3305
+ explicit AsyncProgressQueueWorker(const Function& callback,
3306
+ const char* resource_name);
3307
+ explicit AsyncProgressQueueWorker(const Function& callback,
3308
+ const char* resource_name,
3309
+ const Object& resource);
3310
+ explicit AsyncProgressQueueWorker(const Object& receiver,
3311
+ const Function& callback);
3312
+ explicit AsyncProgressQueueWorker(const Object& receiver,
3313
+ const Function& callback,
3314
+ const char* resource_name);
3315
+ explicit AsyncProgressQueueWorker(const Object& receiver,
3316
+ const Function& callback,
3317
+ const char* resource_name,
3318
+ const Object& resource);
3319
+
3320
+ // Optional callback of Napi::ThreadSafeFunction only available after
3321
+ // NAPI_VERSION 4. Refs: https://github.com/nodejs/node/pull/27791
3322
+ #if NAPI_VERSION > 4
3323
+ explicit AsyncProgressQueueWorker(Napi::Env env);
3324
+ explicit AsyncProgressQueueWorker(Napi::Env env, const char* resource_name);
3325
+ explicit AsyncProgressQueueWorker(Napi::Env env,
3326
+ const char* resource_name,
3327
+ const Object& resource);
3328
+ #endif
3329
+ virtual void Execute(const ExecutionProgress& progress) = 0;
3330
+ virtual void OnProgress(const T* data, size_t count) = 0;
3331
+
3332
+ private:
3333
+ void Execute() override;
3334
+ void Signal() const;
3335
+ void SendProgress_(const T* data, size_t count);
3336
+ };
3337
+ #endif // NAPI_VERSION > 3 && NAPI_HAS_THREADS
3338
+
3339
+ // Memory management.
3340
+ class MemoryManagement {
3341
+ public:
3342
+ static int64_t AdjustExternalMemory(BasicEnv env, int64_t change_in_bytes);
3343
+ };
3344
+
3345
+ // Version management
3346
+ class VersionManagement {
3347
+ public:
3348
+ static uint32_t GetNapiVersion(BasicEnv env);
3349
+ static const napi_node_version* GetNodeVersion(BasicEnv env);
3350
+ };
3351
+
3352
+ #if NAPI_VERSION > 5
3353
+ template <typename T>
3354
+ class Addon : public InstanceWrap<T> {
3355
+ public:
3356
+ static inline Object Init(Env env, Object exports);
3357
+ static T* Unwrap(Object wrapper);
3358
+
3359
+ protected:
3360
+ using AddonProp = ClassPropertyDescriptor<T>;
3361
+ void DefineAddon(Object exports,
3362
+ const std::initializer_list<AddonProp>& props);
3363
+ Napi::Object DefineProperties(Object object,
3364
+ const std::initializer_list<AddonProp>& props);
3365
+
3366
+ private:
3367
+ Object entry_point_;
3368
+ };
3369
+ #endif // NAPI_VERSION > 5
3370
+
3371
+ #ifdef NAPI_CPP_CUSTOM_NAMESPACE
3372
+ } // namespace NAPI_CPP_CUSTOM_NAMESPACE
3373
+ #endif
3374
+
3375
+ } // namespace Napi
3376
+
3377
+ // Inline implementations of all the above class methods are included here.
3378
+ #include "napi-inl.h"
3379
+
3380
+ #endif // SRC_NAPI_H_