@homaiohq/napi-quickfix 0.0.0-stage → 0.2.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.
- package/CMakeLists.txt +135 -0
- package/LICENSE +21 -0
- package/README.md +638 -2
- package/THIRD_PARTY_LICENSES +48 -0
- package/cpp/acceptor_wrap.cpp +468 -0
- package/cpp/acceptor_wrap.h +116 -0
- package/cpp/addon.cpp +87 -0
- package/cpp/application_bridge.cpp +466 -0
- package/cpp/application_bridge.h +204 -0
- package/cpp/data_dictionary_wrap.cpp +165 -0
- package/cpp/data_dictionary_wrap.h +59 -0
- package/cpp/engine_common.cpp +5 -0
- package/cpp/engine_common.h +127 -0
- package/cpp/engine_workers.h +167 -0
- package/cpp/errors.h +142 -0
- package/cpp/field_map_ops.h +492 -0
- package/cpp/group_wrap.cpp +221 -0
- package/cpp/group_wrap.h +76 -0
- package/cpp/initiator_wrap.cpp +492 -0
- package/cpp/initiator_wrap.h +104 -0
- package/cpp/message_wrap.cpp +288 -0
- package/cpp/message_wrap.h +95 -0
- package/cpp/session_id_wrap.cpp +91 -0
- package/cpp/session_id_wrap.h +46 -0
- package/cpp/session_op_gate.h +201 -0
- package/cpp/session_settings_wrap.cpp +98 -0
- package/cpp/session_settings_wrap.h +40 -0
- package/cpp/session_static.cpp +220 -0
- package/cpp/session_wrap.cpp +438 -0
- package/cpp/session_wrap.h +144 -0
- package/dist/cjs/acceptor.d.ts +29 -0
- package/dist/cjs/acceptor.js +38 -0
- package/dist/cjs/application.d.ts +115 -0
- package/dist/cjs/application.js +62 -0
- package/dist/cjs/data-dictionary.d.ts +67 -0
- package/dist/cjs/data-dictionary.js +105 -0
- package/dist/cjs/engine.d.ts +152 -0
- package/dist/cjs/engine.js +183 -0
- package/dist/cjs/enums.d.ts +56 -0
- package/dist/cjs/enums.js +44 -0
- package/dist/cjs/field-value.d.ts +12 -0
- package/dist/cjs/field-value.js +40 -0
- package/dist/cjs/generated/fields.d.ts +6122 -0
- package/dist/cjs/generated/fields.js +6127 -0
- package/dist/cjs/generated/values.d.ts +8548 -0
- package/dist/cjs/generated/values.js +8580 -0
- package/dist/cjs/group.d.ts +126 -0
- package/dist/cjs/group.js +185 -0
- package/dist/cjs/index.d.ts +68 -0
- package/dist/cjs/index.js +73 -0
- package/dist/cjs/initiator.d.ts +29 -0
- package/dist/cjs/initiator.js +38 -0
- package/dist/cjs/load-native.cjs +5 -0
- package/dist/cjs/message.d.ts +238 -0
- package/dist/cjs/message.js +299 -0
- package/dist/cjs/native.d.ts +325 -0
- package/dist/cjs/native.js +22 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/session-id.d.ts +51 -0
- package/dist/cjs/session-id.js +87 -0
- package/dist/cjs/session-settings.d.ts +46 -0
- package/dist/cjs/session-settings.js +75 -0
- package/dist/cjs/session.d.ts +213 -0
- package/dist/cjs/session.js +337 -0
- package/dist/esm/acceptor.d.ts +29 -0
- package/dist/esm/acceptor.js +34 -0
- package/dist/esm/application.d.ts +115 -0
- package/dist/esm/application.js +57 -0
- package/dist/esm/data-dictionary.d.ts +67 -0
- package/dist/esm/data-dictionary.js +101 -0
- package/dist/esm/engine.d.ts +152 -0
- package/dist/esm/engine.js +179 -0
- package/dist/esm/enums.d.ts +56 -0
- package/dist/esm/enums.js +35 -0
- package/dist/esm/field-value.d.ts +12 -0
- package/dist/esm/field-value.js +37 -0
- package/dist/esm/generated/fields.d.ts +6122 -0
- package/dist/esm/generated/fields.js +6124 -0
- package/dist/esm/generated/values.d.ts +8548 -0
- package/dist/esm/generated/values.js +8564 -0
- package/dist/esm/group.d.ts +126 -0
- package/dist/esm/group.js +181 -0
- package/dist/esm/index.d.ts +68 -0
- package/dist/esm/index.js +43 -0
- package/dist/esm/initiator.d.ts +29 -0
- package/dist/esm/initiator.js +34 -0
- package/dist/esm/load-native.cjs +5 -0
- package/dist/esm/message.d.ts +238 -0
- package/dist/esm/message.js +293 -0
- package/dist/esm/native.d.ts +325 -0
- package/dist/esm/native.js +16 -0
- package/dist/esm/session-id.d.ts +51 -0
- package/dist/esm/session-id.js +82 -0
- package/dist/esm/session-settings.d.ts +46 -0
- package/dist/esm/session-settings.js +71 -0
- package/dist/esm/session.d.ts +213 -0
- package/dist/esm/session.js +329 -0
- package/package.json +95 -4
- package/prebuilds/darwin-arm64/node.napi.node +0 -0
- package/prebuilds/darwin-x64/node.napi.node +0 -0
- package/prebuilds/linux-x64/node.napi.glibc.node +0 -0
- package/prebuilds/linux-x64/node.napi.musl.node +0 -0
- package/prebuilds/win32-x64/node.napi.node +0 -0
- package/src/load-native.cjs +5 -0
package/CMakeLists.txt
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.15)
|
|
2
|
+
|
|
3
|
+
project(napi_quickfix CXX)
|
|
4
|
+
|
|
5
|
+
set(CMAKE_CXX_STANDARD 17)
|
|
6
|
+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
7
|
+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
8
|
+
|
|
9
|
+
include(FetchContent)
|
|
10
|
+
|
|
11
|
+
# ---------------------------------------------------------------------------
|
|
12
|
+
# QuickFIX (build-time dependency, nothing vendored). Pinned to v1.16.0.
|
|
13
|
+
# ---------------------------------------------------------------------------
|
|
14
|
+
# Force QuickFIX build options BEFORE MakeAvailable so add_subdirectory picks
|
|
15
|
+
# them up from the cache.
|
|
16
|
+
set(QUICKFIX_SHARED_LIBS OFF CACHE BOOL "" FORCE)
|
|
17
|
+
set(QUICKFIX_EXAMPLES OFF CACHE BOOL "" FORCE)
|
|
18
|
+
set(QUICKFIX_TESTS OFF CACHE BOOL "" FORCE)
|
|
19
|
+
set(HAVE_SSL OFF CACHE BOOL "" FORCE)
|
|
20
|
+
set(HAVE_MYSQL OFF CACHE BOOL "" FORCE)
|
|
21
|
+
set(HAVE_POSTGRESQL OFF CACHE BOOL "" FORCE)
|
|
22
|
+
|
|
23
|
+
FetchContent_Declare(
|
|
24
|
+
quickfix
|
|
25
|
+
GIT_REPOSITORY https://github.com/quickfix/quickfix.git
|
|
26
|
+
GIT_TAG v1.16.0
|
|
27
|
+
GIT_SHALLOW TRUE
|
|
28
|
+
)
|
|
29
|
+
FetchContent_MakeAvailable(quickfix)
|
|
30
|
+
|
|
31
|
+
# Give musl the same clock as glibc. QuickFIX picks its clock in
|
|
32
|
+
# src/C++/FieldTypes.cpp:
|
|
33
|
+
# #if defined(_POSIX_SOURCE) || defined(HAVE_GETTIMEOFDAY) -> gettimeofday, us
|
|
34
|
+
# #elif defined(HAVE_FTIME) -> ftime, ms only
|
|
35
|
+
# glibc's <features.h> defines _POSIX_SOURCE whenever _GNU_SOURCE is set (and g++
|
|
36
|
+
# always sets it), so glibc takes the gettimeofday branch for free. musl never
|
|
37
|
+
# defines _POSIX_SOURCE, and QuickFIX -- although it probes gettimeofday in
|
|
38
|
+
# cmake/QuickfixPlatformSettings.cmake -- never propagates HAVE_GETTIMEOFDAY to the
|
|
39
|
+
# compiler (it is absent from cmake_config.h.in). musl does get HAVE_FTIME, so it
|
|
40
|
+
# lands on the obsolete ftime() branch and is capped at MILLISECOND resolution.
|
|
41
|
+
# That is invisible at the default TimestampPrecision=3, but with
|
|
42
|
+
# TimestampPrecision=6 a musl build emits .NNN000 where glibc emits true
|
|
43
|
+
# microseconds. Forcing the probe result on removes that divergence.
|
|
44
|
+
# No-op on glibc, which already takes the first branch.
|
|
45
|
+
#
|
|
46
|
+
# UNIX-only on purpose: MSVC has no gettimeofday() to point HAVE_GETTIMEOFDAY at, and
|
|
47
|
+
# upstream QuickFIX does propagate HAVE_FTIME on Windows (it probes for it in
|
|
48
|
+
# src/C++/CMakeLists.txt), so Windows is millisecond-capped by design. The loopback
|
|
49
|
+
# test's microsecond-tail assertion is POSIX-gated to match.
|
|
50
|
+
if(UNIX AND TARGET quickfix)
|
|
51
|
+
target_compile_definitions(quickfix PRIVATE HAVE_GETTIMEOFDAY)
|
|
52
|
+
endif()
|
|
53
|
+
|
|
54
|
+
# ---------------------------------------------------------------------------
|
|
55
|
+
# Include-tree shim (risk #1): QuickFIX ships headers flat in src/C++/*.h but
|
|
56
|
+
# code includes them as "quickfix/Message.h". Assemble a quickfix/ include tree
|
|
57
|
+
# at configure time (Windows-safe: file copies, no symlinks).
|
|
58
|
+
# ---------------------------------------------------------------------------
|
|
59
|
+
set(QF_INCLUDE_ROOT "${CMAKE_BINARY_DIR}/qf_include")
|
|
60
|
+
file(GLOB QF_HEADERS "${quickfix_SOURCE_DIR}/src/C++/*.h")
|
|
61
|
+
foreach(_qf_hdr ${QF_HEADERS})
|
|
62
|
+
get_filename_component(_qf_name "${_qf_hdr}" NAME)
|
|
63
|
+
configure_file("${_qf_hdr}" "${QF_INCLUDE_ROOT}/quickfix/${_qf_name}" COPYONLY)
|
|
64
|
+
endforeach()
|
|
65
|
+
|
|
66
|
+
# Copy any generated config.h (may live in the binary dir after configure).
|
|
67
|
+
file(GLOB_RECURSE QF_GENERATED_CONFIG "${quickfix_BINARY_DIR}/*config.h")
|
|
68
|
+
foreach(_qf_cfg ${QF_GENERATED_CONFIG})
|
|
69
|
+
get_filename_component(_qf_cfg_name "${_qf_cfg}" NAME)
|
|
70
|
+
configure_file("${_qf_cfg}" "${QF_INCLUDE_ROOT}/quickfix/${_qf_cfg_name}" COPYONLY)
|
|
71
|
+
endforeach()
|
|
72
|
+
|
|
73
|
+
# ---------------------------------------------------------------------------
|
|
74
|
+
# node-addon-api include dir (resolved via node).
|
|
75
|
+
# ---------------------------------------------------------------------------
|
|
76
|
+
execute_process(
|
|
77
|
+
COMMAND node -p "require('node-addon-api').include_dir"
|
|
78
|
+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
79
|
+
OUTPUT_VARIABLE NODE_ADDON_API_DIR
|
|
80
|
+
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
81
|
+
)
|
|
82
|
+
string(REPLACE "\"" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
|
|
83
|
+
string(REPLACE "\n" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
|
|
84
|
+
|
|
85
|
+
# ---------------------------------------------------------------------------
|
|
86
|
+
# The native addon.
|
|
87
|
+
# ---------------------------------------------------------------------------
|
|
88
|
+
# CONFIGURE_DEPENDS re-globs on every build, so adding or deleting a cpp/*.cpp
|
|
89
|
+
# file is picked up by an already-configured tree. cmake-js only re-runs the
|
|
90
|
+
# configure step when CMakeCache.txt is missing, so without it a deleted source
|
|
91
|
+
# stays in the build graph until `yarn clean`.
|
|
92
|
+
file(GLOB ADDON_SOURCES CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/cpp/*.cpp")
|
|
93
|
+
|
|
94
|
+
add_library(napi_quickfix SHARED ${ADDON_SOURCES} ${CMAKE_JS_SRC})
|
|
95
|
+
set_target_properties(napi_quickfix PROPERTIES PREFIX "" SUFFIX ".node")
|
|
96
|
+
|
|
97
|
+
target_include_directories(napi_quickfix PRIVATE
|
|
98
|
+
${CMAKE_JS_INC}
|
|
99
|
+
${QF_INCLUDE_ROOT}
|
|
100
|
+
${quickfix_SOURCE_DIR}/src/C++
|
|
101
|
+
${NODE_ADDON_API_DIR}
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
target_compile_definitions(napi_quickfix PRIVATE
|
|
105
|
+
NAPI_VERSION=9
|
|
106
|
+
NAPI_CPP_EXCEPTIONS
|
|
107
|
+
NODE_ADDON_API_DISABLE_DEPRECATED
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
target_link_libraries(napi_quickfix PRIVATE ${CMAKE_JS_LIB} quickfix)
|
|
111
|
+
|
|
112
|
+
if(UNIX AND NOT APPLE)
|
|
113
|
+
find_package(Threads REQUIRED)
|
|
114
|
+
target_link_libraries(napi_quickfix PRIVATE Threads::Threads)
|
|
115
|
+
# Statically absorb libstdc++/libgcc so a prebuild does not pin consumers to the
|
|
116
|
+
# build image's GLIBCXX version. This matters most for musl: docker-node only keeps
|
|
117
|
+
# the newest Alpine bases, so node:22-alpine's GCC keeps advancing (already 15.2 on
|
|
118
|
+
# Alpine 3.24) and a consumer on an older node:22-alpineX.Y would otherwise hit
|
|
119
|
+
# "GLIBCXX_3.4.3x not found". Safe here because the addon is a leaf: C++ exceptions
|
|
120
|
+
# and RTTI never cross out of the .node (Node's addon ABI is C, and QuickFIX is
|
|
121
|
+
# statically linked into this same object), and Node dlopen()s addons RTLD_LOCAL, so
|
|
122
|
+
# the absorbed symbols stay private to this module.
|
|
123
|
+
target_link_options(napi_quickfix PRIVATE -static-libstdc++ -static-libgcc)
|
|
124
|
+
endif()
|
|
125
|
+
|
|
126
|
+
if(APPLE)
|
|
127
|
+
find_package(Threads REQUIRED)
|
|
128
|
+
target_link_libraries(napi_quickfix PRIVATE Threads::Threads)
|
|
129
|
+
target_link_options(napi_quickfix PRIVATE -undefined dynamic_lookup)
|
|
130
|
+
endif()
|
|
131
|
+
|
|
132
|
+
if(WIN32)
|
|
133
|
+
target_link_libraries(napi_quickfix PRIVATE ws2_32)
|
|
134
|
+
target_compile_definitions(napi_quickfix PRIVATE NOMINMAX _WIN32_WINNT=0x0601)
|
|
135
|
+
endif()
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Homaio
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|