@encharm/cws 4.5.3 → 4.6.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 (288) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/CLAUDE.md +81 -0
  3. package/README.md +10 -3
  4. package/dist/bindings/cws_darwin_arm64_node115.node +0 -0
  5. package/dist/bindings/cws_darwin_arm64_node127.node +0 -0
  6. package/dist/bindings/cws_darwin_arm64_node137.node +0 -0
  7. package/dist/bindings/cws_darwin_arm64_node147.node +0 -0
  8. package/dist/bindings/cws_linux_arm64_node115.node +0 -0
  9. package/dist/bindings/cws_linux_arm64_node127.node +0 -0
  10. package/dist/bindings/cws_linux_arm64_node137.node +0 -0
  11. package/dist/bindings/cws_linux_arm64_node147.node +0 -0
  12. package/dist/bindings/cws_linux_x64_node115.node +0 -0
  13. package/dist/bindings/cws_linux_x64_node127.node +0 -0
  14. package/dist/bindings/cws_linux_x64_node137.node +0 -0
  15. package/dist/bindings/cws_linux_x64_node147.node +0 -0
  16. package/dist/bindings/cws_win32_x64_node115.node +0 -0
  17. package/dist/bindings/cws_win32_x64_node127.node +0 -0
  18. package/dist/bindings/cws_win32_x64_node137.node +0 -0
  19. package/dist/bindings/cws_win32_x64_node147.node +0 -0
  20. package/package.json +1 -1
  21. package/src/Addon.cpp +2 -1
  22. package/src/Addon.h +70 -14
  23. package/src/Hub.h +1 -0
  24. package/src/Networking.h +11 -0
  25. package/src/Socket.h +201 -6
  26. package/src/WebSocket.cpp +4 -1
  27. package/src/cSNode.cpp +2 -0
  28. package/src/cSNode.h +4 -0
  29. package/src/headers/26/acorn_version.h +6 -0
  30. package/src/headers/26/aliased_buffer-inl.h +264 -0
  31. package/src/headers/26/aliased_buffer.h +205 -0
  32. package/src/headers/26/aliased_struct-inl.h +143 -0
  33. package/src/headers/26/aliased_struct.h +248 -0
  34. package/src/headers/26/amaro_version.h +6 -0
  35. package/src/headers/26/async_context_frame.h +33 -0
  36. package/src/headers/26/async_wrap-inl.h +123 -0
  37. package/src/headers/26/async_wrap.h +254 -0
  38. package/src/headers/26/base_object-inl.h +333 -0
  39. package/src/headers/26/base_object.h +339 -0
  40. package/src/headers/26/base_object_types.h +76 -0
  41. package/src/headers/26/blob_serializer_deserializer-inl.h +385 -0
  42. package/src/headers/26/blob_serializer_deserializer.h +142 -0
  43. package/src/headers/26/builtin_info.h +57 -0
  44. package/src/headers/26/callback_queue-inl.h +97 -0
  45. package/src/headers/26/callback_queue.h +79 -0
  46. package/src/headers/26/cares_wrap.h +475 -0
  47. package/src/headers/26/cleanup_queue-inl.h +36 -0
  48. package/src/headers/26/cleanup_queue.h +79 -0
  49. package/src/headers/26/compile_cache.h +134 -0
  50. package/src/headers/26/connect_wrap.h +26 -0
  51. package/src/headers/26/connection_wrap.h +30 -0
  52. package/src/headers/26/cppgc_helpers-inl.h +69 -0
  53. package/src/headers/26/cppgc_helpers.h +162 -0
  54. package/src/headers/26/crypto/crypto_aes.h +107 -0
  55. package/src/headers/26/crypto/crypto_argon2.h +88 -0
  56. package/src/headers/26/crypto/crypto_bio.h +193 -0
  57. package/src/headers/26/crypto/crypto_chacha20_poly1305.h +62 -0
  58. package/src/headers/26/crypto/crypto_cipher.h +291 -0
  59. package/src/headers/26/crypto/crypto_common.h +48 -0
  60. package/src/headers/26/crypto/crypto_context.h +219 -0
  61. package/src/headers/26/crypto/crypto_dh.h +104 -0
  62. package/src/headers/26/crypto/crypto_dsa.h +50 -0
  63. package/src/headers/26/crypto/crypto_ec.h +102 -0
  64. package/src/headers/26/crypto/crypto_hash.h +157 -0
  65. package/src/headers/26/crypto/crypto_hkdf.h +62 -0
  66. package/src/headers/26/crypto/crypto_hmac.h +92 -0
  67. package/src/headers/26/crypto/crypto_kem.h +131 -0
  68. package/src/headers/26/crypto/crypto_keygen.h +382 -0
  69. package/src/headers/26/crypto/crypto_keys.h +366 -0
  70. package/src/headers/26/crypto/crypto_kmac.h +79 -0
  71. package/src/headers/26/crypto/crypto_pbkdf2.h +76 -0
  72. package/src/headers/26/crypto/crypto_pqc.h +39 -0
  73. package/src/headers/26/crypto/crypto_random.h +127 -0
  74. package/src/headers/26/crypto/crypto_rsa.h +108 -0
  75. package/src/headers/26/crypto/crypto_scrypt.h +85 -0
  76. package/src/headers/26/crypto/crypto_sig.h +159 -0
  77. package/src/headers/26/crypto/crypto_spkac.h +21 -0
  78. package/src/headers/26/crypto/crypto_timing.h +20 -0
  79. package/src/headers/26/crypto/crypto_tls.h +342 -0
  80. package/src/headers/26/crypto/crypto_turboshake.h +105 -0
  81. package/src/headers/26/crypto/crypto_util.h +775 -0
  82. package/src/headers/26/crypto/crypto_x509.h +140 -0
  83. package/src/headers/26/dataqueue/queue.h +311 -0
  84. package/src/headers/26/debug_utils-inl.h +291 -0
  85. package/src/headers/26/debug_utils.h +200 -0
  86. package/src/headers/26/diagnosticfilename-inl.h +33 -0
  87. package/src/headers/26/embedded_data.h +17 -0
  88. package/src/headers/26/encoding_binding.h +59 -0
  89. package/src/headers/26/env-inl.h +956 -0
  90. package/src/headers/26/env.h +1294 -0
  91. package/src/headers/26/env_properties.h +562 -0
  92. package/src/headers/26/ffi/data.h +30 -0
  93. package/src/headers/26/ffi/fast.h +96 -0
  94. package/src/headers/26/ffi/jit_memory.h +26 -0
  95. package/src/headers/26/ffi/types.h +99 -0
  96. package/src/headers/26/handle_wrap.h +123 -0
  97. package/src/headers/26/histogram-inl.h +211 -0
  98. package/src/headers/26/histogram.h +474 -0
  99. package/src/headers/26/inspector/dom_storage_agent.h +68 -0
  100. package/src/headers/26/inspector/inspector_object_utils.h +38 -0
  101. package/src/headers/26/inspector/io_agent.h +30 -0
  102. package/src/headers/26/inspector/main_thread_interface.h +116 -0
  103. package/src/headers/26/inspector/network_agent.h +110 -0
  104. package/src/headers/26/inspector/network_inspector.h +45 -0
  105. package/src/headers/26/inspector/network_requests_buffer.h +195 -0
  106. package/src/headers/26/inspector/network_resource_manager.h +29 -0
  107. package/src/headers/26/inspector/node_json.h +24 -0
  108. package/src/headers/26/inspector/node_string.h +101 -0
  109. package/src/headers/26/inspector/notification_emitter.h +38 -0
  110. package/src/headers/26/inspector/protocol_helper.h +27 -0
  111. package/src/headers/26/inspector/runtime_agent.h +41 -0
  112. package/src/headers/26/inspector/storage_agent.h +33 -0
  113. package/src/headers/26/inspector/target_agent.h +59 -0
  114. package/src/headers/26/inspector/target_manager.h +70 -0
  115. package/src/headers/26/inspector/tracing_agent.h +43 -0
  116. package/src/headers/26/inspector/worker_agent.h +40 -0
  117. package/src/headers/26/inspector/worker_inspector.h +124 -0
  118. package/src/headers/26/inspector_agent.h +168 -0
  119. package/src/headers/26/inspector_io.h +78 -0
  120. package/src/headers/26/inspector_profiler.h +149 -0
  121. package/src/headers/26/inspector_socket.h +60 -0
  122. package/src/headers/26/inspector_socket_server.h +110 -0
  123. package/src/headers/26/js_native_api.h +634 -0
  124. package/src/headers/26/js_native_api_types.h +244 -0
  125. package/src/headers/26/js_native_api_v8.h +485 -0
  126. package/src/headers/26/js_native_api_v8_internals.h +45 -0
  127. package/src/headers/26/js_stream.h +57 -0
  128. package/src/headers/26/json_utils.h +172 -0
  129. package/src/headers/26/large_pages/node_large_page.h +34 -0
  130. package/src/headers/26/lru_cache-inl.h +69 -0
  131. package/src/headers/26/memory_tracker-inl.h +461 -0
  132. package/src/headers/26/memory_tracker.h +341 -0
  133. package/src/headers/26/module_wrap.h +231 -0
  134. package/src/headers/26/ncrypto.h +2008 -0
  135. package/src/headers/26/node.h +1693 -0
  136. package/src/headers/26/node_api.h +265 -0
  137. package/src/headers/26/node_api_internals.h +48 -0
  138. package/src/headers/26/node_api_types.h +58 -0
  139. package/src/headers/26/node_binding.h +170 -0
  140. package/src/headers/26/node_blob.h +160 -0
  141. package/src/headers/26/node_bob-inl.h +36 -0
  142. package/src/headers/26/node_bob.h +107 -0
  143. package/src/headers/26/node_buffer.h +92 -0
  144. package/src/headers/26/node_builtins.h +239 -0
  145. package/src/headers/26/node_concepts.h +46 -0
  146. package/src/headers/26/node_config_file.h +77 -0
  147. package/src/headers/26/node_constants.h +82 -0
  148. package/src/headers/26/node_context_data.h +171 -0
  149. package/src/headers/26/node_contextify.h +261 -0
  150. package/src/headers/26/node_crypto.h +66 -0
  151. package/src/headers/26/node_debug.h +30 -0
  152. package/src/headers/26/node_diagnostics_channel.h +121 -0
  153. package/src/headers/26/node_dir.h +52 -0
  154. package/src/headers/26/node_dotenv.h +45 -0
  155. package/src/headers/26/node_errors.h +378 -0
  156. package/src/headers/26/node_exit_code.h +54 -0
  157. package/src/headers/26/node_external_reference.h +171 -0
  158. package/src/headers/26/node_ffi.h +212 -0
  159. package/src/headers/26/node_file-inl.h +421 -0
  160. package/src/headers/26/node_file.h +561 -0
  161. package/src/headers/26/node_file_utils.h +39 -0
  162. package/src/headers/26/node_hash.h +212 -0
  163. package/src/headers/26/node_http2.h +1202 -0
  164. package/src/headers/26/node_http2_state.h +159 -0
  165. package/src/headers/26/node_http_common-inl.h +199 -0
  166. package/src/headers/26/node_http_common.h +535 -0
  167. package/src/headers/26/node_i18n.h +132 -0
  168. package/src/headers/26/node_internals.h +485 -0
  169. package/src/headers/26/node_locks.h +184 -0
  170. package/src/headers/26/node_main_instance.h +67 -0
  171. package/src/headers/26/node_mem-inl.h +113 -0
  172. package/src/headers/26/node_mem.h +45 -0
  173. package/src/headers/26/node_messaging.h +389 -0
  174. package/src/headers/26/node_metadata.h +172 -0
  175. package/src/headers/26/node_modules.h +102 -0
  176. package/src/headers/26/node_mutex.h +323 -0
  177. package/src/headers/26/node_object_wrap.h +145 -0
  178. package/src/headers/26/node_options-inl.h +524 -0
  179. package/src/headers/26/node_options.h +710 -0
  180. package/src/headers/26/node_perf.h +167 -0
  181. package/src/headers/26/node_perf_common.h +103 -0
  182. package/src/headers/26/node_platform.h +290 -0
  183. package/src/headers/26/node_process-inl.h +26 -0
  184. package/src/headers/26/node_process.h +112 -0
  185. package/src/headers/26/node_profiling.h +38 -0
  186. package/src/headers/26/node_realm-inl.h +156 -0
  187. package/src/headers/26/node_realm.h +236 -0
  188. package/src/headers/26/node_report.h +43 -0
  189. package/src/headers/26/node_revert.h +82 -0
  190. package/src/headers/26/node_root_certs.h +2937 -0
  191. package/src/headers/26/node_sea.h +101 -0
  192. package/src/headers/26/node_shadow_realm.h +46 -0
  193. package/src/headers/26/node_snapshot_builder.h +57 -0
  194. package/src/headers/26/node_snapshotable.h +167 -0
  195. package/src/headers/26/node_sockaddr-inl.h +248 -0
  196. package/src/headers/26/node_sockaddr.h +459 -0
  197. package/src/headers/26/node_sqlite.h +607 -0
  198. package/src/headers/26/node_stat_watcher.h +73 -0
  199. package/src/headers/26/node_task_runner.h +92 -0
  200. package/src/headers/26/node_threadsafe_cow-inl.h +54 -0
  201. package/src/headers/26/node_threadsafe_cow.h +105 -0
  202. package/src/headers/26/node_union_bytes.h +81 -0
  203. package/src/headers/26/node_url.h +101 -0
  204. package/src/headers/26/node_url_pattern.h +118 -0
  205. package/src/headers/26/node_v8.h +78 -0
  206. package/src/headers/26/node_v8_embedder.h +26 -0
  207. package/src/headers/26/node_v8_platform-inl.h +96 -0
  208. package/src/headers/26/node_version.h +116 -0
  209. package/src/headers/26/node_wasi.h +184 -0
  210. package/src/headers/26/node_wasm_web_api.h +55 -0
  211. package/src/headers/26/node_watchdog.h +164 -0
  212. package/src/headers/26/node_webstorage.h +62 -0
  213. package/src/headers/26/node_worker.h +162 -0
  214. package/src/headers/26/path.h +36 -0
  215. package/src/headers/26/permission/boolean_permission.h +50 -0
  216. package/src/headers/26/permission/fs_permission.h +192 -0
  217. package/src/headers/26/permission/permission.h +155 -0
  218. package/src/headers/26/permission/permission_base.h +79 -0
  219. package/src/headers/26/pipe_wrap.h +80 -0
  220. package/src/headers/26/quic/application.h +279 -0
  221. package/src/headers/26/quic/arena.h +373 -0
  222. package/src/headers/26/quic/bindingdata.h +440 -0
  223. package/src/headers/26/quic/cid.h +127 -0
  224. package/src/headers/26/quic/data.h +358 -0
  225. package/src/headers/26/quic/defs.h +417 -0
  226. package/src/headers/26/quic/endpoint.h +519 -0
  227. package/src/headers/26/quic/guard.h +5 -0
  228. package/src/headers/26/quic/http3.h +25 -0
  229. package/src/headers/26/quic/packet.h +166 -0
  230. package/src/headers/26/quic/preferredaddress.h +72 -0
  231. package/src/headers/26/quic/session.h +770 -0
  232. package/src/headers/26/quic/session_manager.h +107 -0
  233. package/src/headers/26/quic/sessionticket.h +110 -0
  234. package/src/headers/26/quic/streams.h +518 -0
  235. package/src/headers/26/quic/tlscontext.h +353 -0
  236. package/src/headers/26/quic/tokens.h +263 -0
  237. package/src/headers/26/quic/transportparams.h +184 -0
  238. package/src/headers/26/req_wrap-inl.h +175 -0
  239. package/src/headers/26/req_wrap.h +79 -0
  240. package/src/headers/26/spawn_sync.h +243 -0
  241. package/src/headers/26/stream_base-inl.h +170 -0
  242. package/src/headers/26/stream_base.h +487 -0
  243. package/src/headers/26/stream_pipe.h +76 -0
  244. package/src/headers/26/stream_wrap.h +137 -0
  245. package/src/headers/26/string_bytes.h +114 -0
  246. package/src/headers/26/string_decoder-inl.h +31 -0
  247. package/src/headers/26/string_decoder.h +49 -0
  248. package/src/headers/26/tcp_wrap.h +138 -0
  249. package/src/headers/26/threadpoolwork-inl.h +70 -0
  250. package/src/headers/26/timer_wrap-inl.h +32 -0
  251. package/src/headers/26/timer_wrap.h +87 -0
  252. package/src/headers/26/timers.h +70 -0
  253. package/src/headers/26/tracing/agent.h +125 -0
  254. package/src/headers/26/tracing/agent_legacy.h +146 -0
  255. package/src/headers/26/tracing/agent_perfetto.h +145 -0
  256. package/src/headers/26/tracing/node_trace_buffer.h +91 -0
  257. package/src/headers/26/tracing/node_trace_writer.h +79 -0
  258. package/src/headers/26/tracing/trace_event.h +27 -0
  259. package/src/headers/26/tracing/trace_event_helper.h +40 -0
  260. package/src/headers/26/tracing/trace_event_legacy.h +1113 -0
  261. package/src/headers/26/tracing/trace_event_legacy_inl.h +711 -0
  262. package/src/headers/26/tracing/trace_event_perfetto.h +47 -0
  263. package/src/headers/26/tracing/traced_value.h +167 -0
  264. package/src/headers/26/tty_wrap.h +65 -0
  265. package/src/headers/26/udp_wrap.h +231 -0
  266. package/src/headers/26/undici_version.h +6 -0
  267. package/src/headers/26/util-inl.h +788 -0
  268. package/src/headers/26/util.h +1207 -0
  269. package/src/headers/26/v8-cpp-heap-external.h +56 -0
  270. package/src/headers/26/v8-external-memory-accounter.h +60 -0
  271. package/src/headers/26/v8-fast-api-calls.h +784 -0
  272. package/src/headers/26/v8-inspector-protocol.h +13 -0
  273. package/src/headers/26/v8-inspector.h +458 -0
  274. package/src/headers/26/v8-metrics.h +273 -0
  275. package/src/headers/26/v8-trace-categories.h +28 -0
  276. package/src/headers/26/v8-unwinder-state.h +30 -0
  277. package/src/headers/26/v8-util.h +549 -0
  278. package/src/headers/26/v8-value-serializer-version.h +24 -0
  279. package/src/headers/26/v8-version-string.h +38 -0
  280. package/src/headers/26/v8-wasm-trap-handler-posix.h +31 -0
  281. package/src/headers/26/v8-wasm-trap-handler-win.h +28 -0
  282. package/src/headers/26/zlib_version.h +6 -0
  283. package/dist/bindings/cws_darwin_arm64_node115.node.dSYM/Contents/Info.plist +0 -20
  284. package/dist/bindings/cws_darwin_arm64_node115.node.dSYM/Contents/Resources/DWARF/cws_darwin_arm64_node115.node +0 -0
  285. package/dist/bindings/cws_darwin_arm64_node115.node.dSYM/Contents/Resources/Relocations/aarch64/cws_darwin_arm64_node115.node.yml +0 -931
  286. package/dist/bindings/cws_darwin_arm64_node127.node.dSYM/Contents/Info.plist +0 -20
  287. package/dist/bindings/cws_darwin_arm64_node127.node.dSYM/Contents/Resources/DWARF/cws_darwin_arm64_node127.node +0 -0
  288. package/dist/bindings/cws_darwin_arm64_node127.node.dSYM/Contents/Resources/Relocations/aarch64/cws_darwin_arm64_node127.node.yml +0 -931
@@ -0,0 +1,244 @@
1
+ #ifndef SRC_JS_NATIVE_API_TYPES_H_
2
+ #define SRC_JS_NATIVE_API_TYPES_H_
3
+
4
+ // Use INT_MAX, this should only be consumed by the pre-processor anyway.
5
+ #define NAPI_VERSION_EXPERIMENTAL 2147483647
6
+ #ifndef NAPI_VERSION
7
+ #ifdef NAPI_EXPERIMENTAL
8
+ #define NAPI_VERSION NAPI_VERSION_EXPERIMENTAL
9
+ #else
10
+ // The baseline version for Node-API.
11
+ // NAPI_VERSION controls which version is used by default when compiling
12
+ // a native addon. If the addon developer wants to use functions from a
13
+ // newer Node-API version not yet available in all LTS versions, they can
14
+ // set NAPI_VERSION to explicitly depend on that version.
15
+ #define NAPI_VERSION 8
16
+ #endif
17
+ #endif
18
+
19
+ #if defined(NAPI_EXPERIMENTAL) && \
20
+ !defined(NODE_API_EXPERIMENTAL_NO_WARNING) && \
21
+ !defined(NODE_WANT_INTERNALS)
22
+ #ifdef _MSC_VER
23
+ #pragma message("NAPI_EXPERIMENTAL is enabled. " \
24
+ "Experimental features may be unstable.")
25
+ #else
26
+ #warning "NAPI_EXPERIMENTAL is enabled. " \
27
+ "Experimental features may be unstable."
28
+ #endif
29
+ #endif
30
+
31
+ // This file needs to be compatible with C compilers.
32
+ // This is a public include file, and these includes have essentially
33
+ // become part of its API.
34
+ #include <stddef.h> // NOLINT(modernize-deprecated-headers)
35
+ #include <stdint.h> // NOLINT(modernize-deprecated-headers)
36
+
37
+ #if !defined __cplusplus || (defined(_MSC_VER) && _MSC_VER < 1900)
38
+ typedef uint16_t char16_t;
39
+ #endif
40
+
41
+ #ifndef NAPI_CDECL
42
+ #ifdef _WIN32
43
+ #define NAPI_CDECL __cdecl
44
+ #else
45
+ #define NAPI_CDECL
46
+ #endif
47
+ #endif
48
+
49
+ // JSVM API types are all opaque pointers for ABI stability
50
+ // typedef undefined structs instead of void* for compile time type safety
51
+ typedef struct napi_env__* napi_env;
52
+
53
+ // We need to mark APIs which can be called during garbage collection (GC),
54
+ // meaning that they do not affect the state of the JS engine, and can
55
+ // therefore be called synchronously from a finalizer that itself runs
56
+ // synchronously during GC. Such APIs can receive either a `napi_env` or a
57
+ // `node_api_basic_env` as their first parameter, because we should be able to
58
+ // also call them during normal, non-garbage-collecting operations, whereas
59
+ // APIs that affect the state of the JS engine can only receive a `napi_env` as
60
+ // their first parameter, because we must not call them during GC. In lieu of
61
+ // inheritance, we use the properties of the const qualifier to accomplish
62
+ // this, because both a const and a non-const value can be passed to an API
63
+ // expecting a const value, but only a non-const value can be passed to an API
64
+ // expecting a non-const value.
65
+ //
66
+ // In conjunction with appropriate CFLAGS to warn us if we're passing a const
67
+ // (basic) environment into an API that expects a non-const environment, and
68
+ // the definition of basic finalizer function pointer types below, which
69
+ // receive a basic environment as their first parameter, and can thus only call
70
+ // basic APIs (unless the user explicitly casts the environment), we achieve
71
+ // the ability to ensure at compile time that we do not call APIs that affect
72
+ // the state of the JS engine from a synchronous (basic) finalizer.
73
+ #if !defined(NAPI_EXPERIMENTAL) || \
74
+ (defined(NAPI_EXPERIMENTAL) && \
75
+ (defined(NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT) || \
76
+ defined(NODE_API_EXPERIMENTAL_BASIC_ENV_OPT_OUT)))
77
+ typedef struct napi_env__* node_api_nogc_env;
78
+ #else
79
+ typedef const struct napi_env__* node_api_nogc_env;
80
+ #endif
81
+ typedef node_api_nogc_env node_api_basic_env;
82
+
83
+ typedef struct napi_value__* napi_value;
84
+ typedef struct napi_ref__* napi_ref;
85
+ typedef struct napi_handle_scope__* napi_handle_scope;
86
+ typedef struct napi_escapable_handle_scope__* napi_escapable_handle_scope;
87
+ typedef struct napi_callback_info__* napi_callback_info;
88
+ typedef struct napi_deferred__* napi_deferred;
89
+
90
+ typedef enum {
91
+ napi_default = 0,
92
+ napi_writable = 1 << 0,
93
+ napi_enumerable = 1 << 1,
94
+ napi_configurable = 1 << 2,
95
+
96
+ // Used with napi_define_class to distinguish static properties
97
+ // from instance properties. Ignored by napi_define_properties.
98
+ napi_static = 1 << 10,
99
+
100
+ #if NAPI_VERSION >= 8
101
+ // Default for class methods.
102
+ napi_default_method = napi_writable | napi_configurable,
103
+
104
+ // Default for object properties, like in JS obj[prop].
105
+ napi_default_jsproperty = napi_writable | napi_enumerable | napi_configurable,
106
+ #endif // NAPI_VERSION >= 8
107
+ } napi_property_attributes;
108
+
109
+ typedef enum {
110
+ // ES6 types (corresponds to typeof)
111
+ napi_undefined,
112
+ napi_null,
113
+ napi_boolean,
114
+ napi_number,
115
+ napi_string,
116
+ napi_symbol,
117
+ napi_object,
118
+ napi_function,
119
+ napi_external,
120
+ napi_bigint,
121
+ } napi_valuetype;
122
+
123
+ typedef enum {
124
+ napi_int8_array,
125
+ napi_uint8_array,
126
+ napi_uint8_clamped_array,
127
+ napi_int16_array,
128
+ napi_uint16_array,
129
+ napi_int32_array,
130
+ napi_uint32_array,
131
+ napi_float32_array,
132
+ napi_float64_array,
133
+ napi_bigint64_array,
134
+ napi_biguint64_array,
135
+ #define NODE_API_HAS_FLOAT16_ARRAY
136
+ napi_float16_array,
137
+ } napi_typedarray_type;
138
+
139
+ typedef enum {
140
+ napi_ok,
141
+ napi_invalid_arg,
142
+ napi_object_expected,
143
+ napi_string_expected,
144
+ napi_name_expected,
145
+ napi_function_expected,
146
+ napi_number_expected,
147
+ napi_boolean_expected,
148
+ napi_array_expected,
149
+ napi_generic_failure,
150
+ napi_pending_exception,
151
+ napi_cancelled,
152
+ napi_escape_called_twice,
153
+ napi_handle_scope_mismatch,
154
+ napi_callback_scope_mismatch,
155
+ napi_queue_full,
156
+ napi_closing,
157
+ napi_bigint_expected,
158
+ napi_date_expected,
159
+ napi_arraybuffer_expected,
160
+ napi_detachable_arraybuffer_expected,
161
+ napi_would_deadlock, // unused
162
+ napi_no_external_buffers_allowed,
163
+ napi_cannot_run_js,
164
+ } napi_status;
165
+ // Note: when adding a new enum value to `napi_status`, please also update
166
+ // * `const int last_status` in the definition of `napi_get_last_error_info()'
167
+ // in file js_native_api_v8.cc.
168
+ // * `const char* error_messages[]` in file js_native_api_v8.cc with a brief
169
+ // message explaining the error.
170
+ // * the definition of `napi_status` in doc/api/n-api.md to reflect the newly
171
+ // added value(s).
172
+
173
+ typedef napi_value(NAPI_CDECL* napi_callback)(napi_env env,
174
+ napi_callback_info info);
175
+ typedef void(NAPI_CDECL* napi_finalize)(napi_env env,
176
+ void* finalize_data,
177
+ void* finalize_hint);
178
+
179
+ #if !defined(NAPI_EXPERIMENTAL) || \
180
+ (defined(NAPI_EXPERIMENTAL) && \
181
+ (defined(NODE_API_EXPERIMENTAL_NOGC_ENV_OPT_OUT) || \
182
+ defined(NODE_API_EXPERIMENTAL_BASIC_ENV_OPT_OUT)))
183
+ typedef napi_finalize node_api_nogc_finalize;
184
+ #else
185
+ typedef void(NAPI_CDECL* node_api_nogc_finalize)(node_api_nogc_env env,
186
+ void* finalize_data,
187
+ void* finalize_hint);
188
+ #endif
189
+ typedef node_api_nogc_finalize node_api_basic_finalize;
190
+
191
+ // A finalizer that can be called from any thread and at any time.
192
+ typedef void(NAPI_CDECL* node_api_noenv_finalize)(void* finalize_data,
193
+ void* finalize_hint);
194
+
195
+ typedef struct {
196
+ // One of utf8name or name should be NULL.
197
+ const char* utf8name;
198
+ napi_value name;
199
+
200
+ napi_callback method;
201
+ napi_callback getter;
202
+ napi_callback setter;
203
+ napi_value value;
204
+
205
+ napi_property_attributes attributes;
206
+ void* data;
207
+ } napi_property_descriptor;
208
+
209
+ typedef struct {
210
+ const char* error_message;
211
+ void* engine_reserved;
212
+ uint32_t engine_error_code;
213
+ napi_status error_code;
214
+ } napi_extended_error_info;
215
+
216
+ #if NAPI_VERSION >= 6
217
+ typedef enum {
218
+ napi_key_include_prototypes,
219
+ napi_key_own_only
220
+ } napi_key_collection_mode;
221
+
222
+ typedef enum {
223
+ napi_key_all_properties = 0,
224
+ napi_key_writable = 1,
225
+ napi_key_enumerable = 1 << 1,
226
+ napi_key_configurable = 1 << 2,
227
+ napi_key_skip_strings = 1 << 3,
228
+ napi_key_skip_symbols = 1 << 4
229
+ } napi_key_filter;
230
+
231
+ typedef enum {
232
+ napi_key_keep_numbers,
233
+ napi_key_numbers_to_strings
234
+ } napi_key_conversion;
235
+ #endif // NAPI_VERSION >= 6
236
+
237
+ #if NAPI_VERSION >= 8
238
+ typedef struct {
239
+ uint64_t lower;
240
+ uint64_t upper;
241
+ } napi_type_tag;
242
+ #endif // NAPI_VERSION >= 8
243
+
244
+ #endif // SRC_JS_NATIVE_API_TYPES_H_