node-firebird 2.0.1 → 2.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/.github/workflows/node.js.yml +20 -0
- package/CI_DEBUGGING_GUIDE.md +148 -0
- package/FIREBIRD_LOG_FEATURE.md +145 -0
- package/MINIMAL_CHANGES_SUMMARY.md +136 -0
- package/PR_SUMMARY.md +88 -131
- package/README.md +142 -22
- package/ROADMAP.md +223 -0
- package/SRP_PROTOCOL.md +480 -0
- package/lib/ieee754-decimal.js +500 -0
- package/lib/index.d.ts +10 -6
- package/lib/wire/connection.js +263 -61
- package/lib/wire/const.js +29 -0
- package/lib/wire/database.js +78 -9
- package/lib/wire/eventConnection.js +6 -3
- package/lib/wire/fbEventManager.js +234 -41
- package/lib/wire/serialize.js +39 -0
- package/lib/wire/service.js +102 -94
- package/lib/wire/statement.js +4 -4
- package/lib/wire/transaction.js +27 -9
- package/lib/wire/xsqlvar.js +176 -0
- package/package.json +5 -4
- package/vitest.config.js +12 -1
- package/0001-fix-attachEvent-host-resolution.patch +0 -72
- package/Roadmap.md +0 -80
- package/diff +0 -62
package/Roadmap.md
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
# Node-Firebird Roadmap
|
|
2
|
-
|
|
3
|
-
This document outlines the future development direction for the `node-firebird` library. Our primary goals are to modernize the codebase, implement support for the latest Firebird features, and improve the overall developer experience.
|
|
4
|
-
|
|
5
|
-
## Protocol Implementation Status
|
|
6
|
-
|
|
7
|
-
The following table summarizes the current and planned implementation status of the Firebird wire protocol for each major version.
|
|
8
|
-
|
|
9
|
-
| Firebird Version | Protocol Versions | Status |
|
|
10
|
-
| :--- | :--- | :--- |
|
|
11
|
-
| 2.5 | 10, 11, 12, 13 | ✅ Implemented |
|
|
12
|
-
| 3.0 | 14, 15 | ✅ Implemented |
|
|
13
|
-
| 4.0 | 16, 17 | ❌ Not Implemented |
|
|
14
|
-
| 5.0 | N/A | ❌ Not Implemented |
|
|
15
|
-
| 6.0 | N/A | ❌ Not Implemented |
|
|
16
|
-
|
|
17
|
-
## Firebird 3 Support
|
|
18
|
-
|
|
19
|
-
Firebird 3 introduced Protocol 13, which brought significant changes focusing on security and performance. The following features have been implemented:
|
|
20
|
-
|
|
21
|
-
- **Protocol Versions 14 and 15:** ✅ Implemented - newer wire protocol versions are now supported.
|
|
22
|
-
- **Enhanced Authentication:** ✅ Implemented - Srp256 (SHA-256) authentication plugin is now supported alongside Srp (SHA-1) and Legacy_Auth.
|
|
23
|
-
- **Wire Protocol Encryption:** ✅ Implemented - Arc4 (RC4) stream cipher encryption for all network traffic using SRP session keys.
|
|
24
|
-
- **Wire Protocol Compression:** ✅ Implemented - zlib compression support for protocol version 13+.
|
|
25
|
-
- **Packed (NULL-aware) Row Data:** ✅ Implemented - null bitmap support for protocol version 13+.
|
|
26
|
-
- **op_cond_accept Handling:** ✅ Implemented - proper handling of conditional accept with authentication continuation.
|
|
27
|
-
- **UTF-8 User Identification:** ✅ Implemented - all user identification is properly handled with UTF-8 encoding via `isc_dpb_utf8_filename` flag for Firebird 3+.
|
|
28
|
-
- **Database Encryption Callback:** ✅ Implemented - support for database encryption key callback (`op_crypt_key_callback`) during the connect phase, allowing connections to encrypted databases. The `dbCryptConfig` connection option supports both plain text and base64-encoded encryption keys.
|
|
29
|
-
|
|
30
|
-
The following features are planned for future implementation:
|
|
31
|
-
|
|
32
|
-
## Firebird 4 Support
|
|
33
|
-
|
|
34
|
-
Firebird 4 introduced Protocol versions 16 and 17, continuing to build upon the foundation of Firebird 3. Key features to implement include:
|
|
35
|
-
|
|
36
|
-
- **Protocol Versions 16 and 17:** Implement the latest protocol versions to support Firebird 4 features.
|
|
37
|
-
|
|
38
|
-
## Firebird 5 Support
|
|
39
|
-
|
|
40
|
-
Firebird 5 introduces a host of new SQL features and performance improvements that will require significant client-side implementation:
|
|
41
|
-
|
|
42
|
-
- **Bidirectional Cursors:** Implement support for scrollable cursors for remote database access.
|
|
43
|
-
- **`RETURNING` Multiple Rows:** Enhance DML operations to support returning multiple rows.
|
|
44
|
-
- **`SKIP LOCKED`:** Add support for the `SKIP LOCKED` clause in `SELECT WITH LOCK`, `UPDATE`, and `DELETE` statements.
|
|
45
|
-
- **New Data Types and Functions:** Add support for new built-in functions and packages.
|
|
46
|
-
|
|
47
|
-
## Firebird 6 and Beyond
|
|
48
|
-
|
|
49
|
-
As Firebird 6 and future versions are released, we will continue to monitor new features and plan for their implementation. Key areas of interest include:
|
|
50
|
-
|
|
51
|
-
- **JSON Support:** Implement client-side support for the new SQL-compliant JSON functions.
|
|
52
|
-
- **Tablespaces:** Add support for tablespaces.
|
|
53
|
-
- **SQL Schemas:** Implement support for SQL schemas.
|
|
54
|
-
|
|
55
|
-
## Codebase Refactoring
|
|
56
|
-
|
|
57
|
-
The current codebase is functional but could be significantly improved by adopting modern JavaScript and TypeScript features.
|
|
58
|
-
|
|
59
|
-
### Modern JavaScript Classes
|
|
60
|
-
|
|
61
|
-
The existing codebase is written in a prototype-based style. We plan to refactor the entire library to use modern JavaScript classes (`class` syntax). This will improve readability, maintainability, and make the code easier to understand for new contributors.
|
|
62
|
-
|
|
63
|
-
**Benefits:**
|
|
64
|
-
|
|
65
|
-
- Improved code structure and organization.
|
|
66
|
-
- Easier to reason about inheritance and object-oriented patterns.
|
|
67
|
-
- Better alignment with modern JavaScript best practices.
|
|
68
|
-
|
|
69
|
-
### TypeScript Rewrite
|
|
70
|
-
|
|
71
|
-
A full rewrite of the library in TypeScript is a long-term goal. This would bring the benefits of static typing, improved developer tooling, and a more robust codebase.
|
|
72
|
-
|
|
73
|
-
**Benefits:**
|
|
74
|
-
|
|
75
|
-
- **Type Safety:** Catch errors at compile-time instead of runtime.
|
|
76
|
-
- **Improved Autocomplete:** Better editor support and developer experience.
|
|
77
|
-
- **Self-documenting Code:** Types make the code easier to understand and use.
|
|
78
|
-
- **Easier Refactoring:** Static analysis makes it easier to refactor code with confidence.
|
|
79
|
-
|
|
80
|
-
We believe these changes will make `node-firebird` a more robust, modern, and developer-friendly library for accessing Firebird databases.
|
package/diff
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
diff --git a/lib/wire/database.js b/lib/wire/database.js
|
|
2
|
-
index d91b9db..a9f3128 100644
|
|
3
|
-
--- a/lib/wire/database.js
|
|
4
|
-
+++ b/lib/wire/database.js
|
|
5
|
-
@@ -5,6 +5,46 @@ const Const = require('./const');
|
|
6
|
-
const EventConnection = require('./eventConnection');
|
|
7
|
-
const FbEventManager = require('./fbEventManager');
|
|
8
|
-
|
|
9
|
-
+/**
|
|
10
|
-
+ * Resolves the host to use for the auxiliary event channel.
|
|
11
|
-
+ *
|
|
12
|
-
+ * Priority:
|
|
13
|
-
+ * 1. connection.options.host – explicitly provided by the caller; known reachable.
|
|
14
|
-
+ * 2. socket_info.host – only when it is a concrete routable address
|
|
15
|
-
+ * (i.e. not "0.0.0.0" and not "::").
|
|
16
|
-
+ * 3. socket.remoteAddress – the OS-level address of the main connection socket,
|
|
17
|
-
+ * with IPv6-mapped IPv4 prefixes stripped.
|
|
18
|
-
+ *
|
|
19
|
-
+ * @param {object} connection The active database connection object.
|
|
20
|
-
+ * @param {string} auxHost The host returned by the auxConnection() call.
|
|
21
|
-
+ * @returns {string} A connectable host string.
|
|
22
|
-
+ */
|
|
23
|
-
+function resolveEventHost(connection, auxHost) {
|
|
24
|
-
+ // 1. Prefer the host the caller explicitly supplied.
|
|
25
|
-
+ if (connection.options && connection.options.host) {
|
|
26
|
-
+ return connection.options.host;
|
|
27
|
-
+ }
|
|
28
|
-
+
|
|
29
|
-
+ // 2. Use auxConnection host only when it is a real address.
|
|
30
|
-
+ var BIND_ANY = ['0.0.0.0', '::'];
|
|
31
|
-
+ if (auxHost && BIND_ANY.indexOf(auxHost) === -1) {
|
|
32
|
-
+ return auxHost;
|
|
33
|
-
+ }
|
|
34
|
-
+
|
|
35
|
-
+ // 3. Fall back to the OS-reported remote address of the main socket,
|
|
36
|
-
+ // normalising IPv6-mapped IPv4 (e.g. "::ffff:10.0.0.1" → "10.0.0.1").
|
|
37
|
-
+ var remoteAddress = connection._socket && connection._socket.remoteAddress;
|
|
38
|
-
+ if (remoteAddress) {
|
|
39
|
-
+ return remoteAddress.replace(/^::ffff:/, '');
|
|
40
|
-
+ }
|
|
41
|
-
+
|
|
42
|
-
+ // Last resort: return whatever auxConnection gave us and let the caller fail
|
|
43
|
-
+ // with a meaningful socket error rather than a silent undefined.
|
|
44
|
-
+ return auxHost;
|
|
45
|
-
+}
|
|
46
|
-
+
|
|
47
|
-
+
|
|
48
|
-
+
|
|
49
|
-
/***************************************
|
|
50
|
-
*
|
|
51
|
-
* Database
|
|
52
|
-
@@ -279,8 +319,9 @@ class Database extends Events.EventEmitter {
|
|
53
|
-
doError(err, callback);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
+ var eventHost = resolveEventHost(self.connection, socket_info.host);
|
|
57
|
-
|
|
58
|
-
- const eventConnection = new EventConnection(socket_info.host, socket_info.port, function (err) {
|
|
59
|
-
+ const eventConnection = new EventConnection(eventHost, socket_info.port, function (err) {
|
|
60
|
-
if (err) {
|
|
61
|
-
doError(err, callback);
|
|
62
|
-
return;
|