oracledb 7.0.1 → 26.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 (74) hide show
  1. package/README.md +16 -6
  2. package/build/Release/oracledb-26.0.0-darwin-arm64.node +0 -0
  3. package/build/Release/oracledb-26.0.0-darwin-arm64.node-buildinfo.txt +1 -0
  4. package/build/Release/oracledb-26.0.0-js-buildinfo.txt +1 -0
  5. package/build/Release/oracledb-26.0.0-linux-arm64.node +0 -0
  6. package/build/Release/oracledb-26.0.0-linux-arm64.node-buildinfo.txt +1 -0
  7. package/build/Release/oracledb-26.0.0-linux-x64.node +0 -0
  8. package/build/Release/oracledb-26.0.0-linux-x64.node-buildinfo.txt +1 -0
  9. package/build/Release/oracledb-26.0.0-win32-x64.node +0 -0
  10. package/build/Release/oracledb-26.0.0-win32-x64.node-buildinfo.txt +1 -0
  11. package/lib/connection.js +71 -8
  12. package/lib/constants.js +4 -0
  13. package/lib/endUserSecurityContext.js +20 -8
  14. package/lib/errors.js +70 -5
  15. package/lib/impl/connection.js +36 -0
  16. package/lib/impl/datahandlers/buffer.js +91 -18
  17. package/lib/impl/datahandlers/oson.js +3 -2
  18. package/lib/impl/resultset.js +32 -11
  19. package/lib/oracledb.js +34 -0
  20. package/lib/pool.js +6 -2
  21. package/lib/queryStream.js +13 -5
  22. package/lib/resultset.js +10 -3
  23. package/lib/securityContextProvider.js +206 -0
  24. package/lib/thin/aq.js +2 -3
  25. package/lib/thin/connection.js +381 -19
  26. package/lib/thin/dbObject.js +17 -8
  27. package/lib/thin/pool.js +3 -2
  28. package/lib/thin/protocol/capabilities.js +37 -4
  29. package/lib/thin/protocol/constants.js +49 -1
  30. package/lib/thin/protocol/messages/auth.js +17 -6
  31. package/lib/thin/protocol/messages/base.js +74 -16
  32. package/lib/thin/protocol/messages/dataType.js +46 -0
  33. package/lib/thin/protocol/messages/directPathLoadStream.js +3 -2
  34. package/lib/thin/protocol/messages/execute.js +10 -4
  35. package/lib/thin/protocol/messages/index.js +4 -0
  36. package/lib/thin/protocol/messages/notification.js +281 -0
  37. package/lib/thin/protocol/messages/subscribe.js +181 -0
  38. package/lib/thin/protocol/messages/withData.js +21 -7
  39. package/lib/thin/protocol/packet.js +2 -4
  40. package/lib/thin/protocol/protocol.js +7 -4
  41. package/lib/thin/resultSet.js +40 -20
  42. package/lib/thin/sqlnet/ezConnectResolver.js +7 -0
  43. package/lib/thin/sqlnet/navNodes.js +3 -3
  44. package/lib/thin/sqlnet/ntTcp.js +24 -8
  45. package/lib/thin/statement.js +6 -1
  46. package/lib/thin/statementCache.js +34 -6
  47. package/lib/thin/subscr.js +363 -0
  48. package/lib/transformer.js +60 -17
  49. package/lib/util.js +46 -8
  50. package/lib/version.js +2 -2
  51. package/package.json +1 -1
  52. package/plugins/configProviders/gcpstorage/index.js +121 -0
  53. package/plugins/configProviders/ociobject/index.js +1 -1
  54. package/plugins/token/cache.js +154 -0
  55. package/plugins/token/endUserSecurityProvider/index.js +377 -0
  56. package/plugins/token/extensionAzure/index.js +160 -28
  57. package/plugins/token/extensionOci/index.js +221 -16
  58. package/plugins/vectorsdk/OracleVecDB.js +346 -0
  59. package/plugins/vectorsdk/index.js +49 -0
  60. package/plugins/vectorsdk/utils.js +370 -0
  61. package/plugins/vectorsdk/vectorEmbedding.js +223 -0
  62. package/plugins/vectorsdk/vectorIndex.js +177 -0
  63. package/plugins/vectorsdk/vectorRecords.js +406 -0
  64. package/plugins/vectorsdk/vectorSchema.js +408 -0
  65. package/plugins/vectorsdk/vectorSearch.js +538 -0
  66. package/build/Release/oracledb-7.0.1-darwin-arm64.node +0 -0
  67. package/build/Release/oracledb-7.0.1-darwin-arm64.node-buildinfo.txt +0 -1
  68. package/build/Release/oracledb-7.0.1-js-buildinfo.txt +0 -1
  69. package/build/Release/oracledb-7.0.1-linux-arm64.node +0 -0
  70. package/build/Release/oracledb-7.0.1-linux-arm64.node-buildinfo.txt +0 -1
  71. package/build/Release/oracledb-7.0.1-linux-x64.node +0 -0
  72. package/build/Release/oracledb-7.0.1-linux-x64.node-buildinfo.txt +0 -1
  73. package/build/Release/oracledb-7.0.1-win32-x64.node +0 -0
  74. package/build/Release/oracledb-7.0.1-win32-x64.node-buildinfo.txt +0 -1
@@ -0,0 +1,206 @@
1
+ // Copyright (c) 2026, Oracle and/or its affiliates.
2
+
3
+ //-----------------------------------------------------------------------------
4
+ //
5
+ // This software is dual-licensed to you under the Universal Permissive License
6
+ // (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl and Apache License
7
+ // 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose
8
+ // either license.
9
+ //
10
+ // If you elect to accept the software under the Apache License, Version 2.0,
11
+ // the following applies:
12
+ //
13
+ // Licensed under the Apache License, Version 2.0 (the "License");
14
+ // you may not use this file except in compliance with the License.
15
+ // You may obtain a copy of the License at
16
+ //
17
+ // https://www.apache.org/licenses/LICENSE-2.0
18
+ //
19
+ // Unless required by applicable law or agreed to in writing, software
20
+ // distributed under the License is distributed on an "AS IS" BASIS,
21
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
+ // See the License for the specific language governing permissions and
23
+ // limitations under the License.
24
+ //
25
+ //-----------------------------------------------------------------------------
26
+ 'use strict';
27
+
28
+ const { AsyncLocalStorage } = require('async_hooks');
29
+ const errors = require('./errors.js');
30
+
31
+ const asyncLocalStorage = new AsyncLocalStorage();
32
+ // One driver-wide invocation hook dispatches every supported operation. It
33
+ // does not hold security configuration: applyForOperation() selects the
34
+ // provider from the individual connection, so pools may use different
35
+ // providers concurrently.
36
+ let invocationHook = null;
37
+
38
+ //---------------------------------------------------------------------------
39
+ // getInvocationHook()
40
+ //---------------------------------------------------------------------------
41
+ function getInvocationHook() {
42
+ return invocationHook;
43
+ }
44
+
45
+ //---------------------------------------------------------------------------
46
+ // setInvocationHook()
47
+ //---------------------------------------------------------------------------
48
+ function setInvocationHook(hook) {
49
+ invocationHook = hook;
50
+ }
51
+
52
+ //---------------------------------------------------------------------------
53
+ // _getProvider()
54
+ //
55
+ // Determines the provider associated with the supplied connection.
56
+ //---------------------------------------------------------------------------
57
+ function _getProvider(connection) {
58
+ // A token configuration hook attaches a provider to an individual pool or
59
+ // standalone connection. This permits multiple pools to use different
60
+ // identity providers in the same process without process-global state.
61
+ return connection?._securityContextProvider;
62
+ }
63
+
64
+ //---------------------------------------------------------------------------
65
+ // _clearConnection()
66
+ //
67
+ // Clears cached security context for the provided connection.
68
+ //---------------------------------------------------------------------------
69
+ function _clearConnection(connection) {
70
+ connection.clearEndUserSecurityContext();
71
+ }
72
+
73
+ //---------------------------------------------------------------------------
74
+ // getCurrentContext()
75
+ //
76
+ // Returns the current context stored in AsyncLocalStorage.
77
+ //---------------------------------------------------------------------------
78
+ function getCurrentContext() {
79
+ return asyncLocalStorage.getStore()?.metadata ?? null;
80
+ }
81
+
82
+ //---------------------------------------------------------------------------
83
+ // _getScopedValue() / _setScopedValue()
84
+ //
85
+ // Internal per-runWithContext() scratch storage; it never holds application
86
+ // metadata. The built-in provider uses it to cache an encoded EUSC in
87
+ // operation resolution. Values are keyed by provider because one scope may
88
+ // use connections from differently configured pools. The Map is fresh for
89
+ // every scope and is released with that asynchronous scope.
90
+ //---------------------------------------------------------------------------
91
+ function _getScopedValue(key) {
92
+ return asyncLocalStorage.getStore()?.values.get(key);
93
+ }
94
+
95
+ function _setScopedValue(key, value) {
96
+ const scope = asyncLocalStorage.getStore();
97
+ if (scope) {
98
+ scope.values.set(key, value);
99
+ }
100
+ }
101
+
102
+ //---------------------------------------------------------------------------
103
+ // applyForOperation()
104
+ //
105
+ // Invokes the registered provider before the supplied database operation. A
106
+ // provider returns a ready-to-apply EndUserSecurityContext, or undefined when
107
+ // this operation should use the normal database login.
108
+ //---------------------------------------------------------------------------
109
+ async function applyForOperation(connection) {
110
+ const provider = _getProvider(connection);
111
+ if (!provider) {
112
+ return;
113
+ }
114
+ const perOperation = provider._contextResolution === 'operation';
115
+ if (!perOperation && connection._securityContextInitialized) {
116
+ return;
117
+ }
118
+ let securityContext;
119
+ try {
120
+ securityContext = await provider();
121
+ } catch (err) {
122
+ const error = errors.getErr(errors.ERR_END_USER_SECURITY_CONTEXT_PROVIDER);
123
+ error.cause = err;
124
+ throw error;
125
+ }
126
+
127
+ if (securityContext) {
128
+ connection.setEndUserSecurityContext(securityContext);
129
+ }
130
+ if (!perOperation) {
131
+ // The implementation already owns the installed context. Keep only the
132
+ // fact that this borrowed connection has resolved its provider.
133
+ connection._securityContextInitialized = true;
134
+ } else if (securityContext) {
135
+ return { connection };
136
+ }
137
+ }
138
+
139
+ //---------------------------------------------------------------------------
140
+ // _validateContext()
141
+ //
142
+ // Security metadata is an object assembled by the application. Token syntax is
143
+ // deliberately not validated here; the configured identity provider remains
144
+ // authoritative for token validation and exchange.
145
+ //---------------------------------------------------------------------------
146
+ function _validateContext(context) {
147
+ if (context === null || typeof context !== 'object' || Array.isArray(context)) {
148
+ errors.throwErr(errors.ERR_INVALID_SECURITY_CONTEXT_METADATA);
149
+ }
150
+ const hasEndUserToken = context.endUserToken !== undefined &&
151
+ context.endUserToken !== null;
152
+ const hasEndUserName = context.endUserName !== undefined &&
153
+ context.endUserName !== null;
154
+ const hasKey = context.key !== undefined && context.key !== null;
155
+ // These fields represent mutually exclusive EUSC identity forms. Validate
156
+ // them before entering the callback so a conflicting request cannot perform
157
+ // unrelated work or reach a database operation before being rejected.
158
+ if (hasEndUserToken && (hasEndUserName || hasKey)) {
159
+ errors.throwErr(errors.ERR_CONFLICTING_SECURITY_CONTEXT_IDENTITIES);
160
+ }
161
+ }
162
+
163
+ //---------------------------------------------------------------------------
164
+ // runWithContext()
165
+ //
166
+ // Associates the supplied metadata object with the callback's asynchronous
167
+ // work. Applications must treat the metadata object, including nested values, as
168
+ // immutable until the callback and all its database operations complete. The
169
+ // separate Map is mutable driver-only scratch storage, not a copy of metadata.
170
+ //---------------------------------------------------------------------------
171
+ function runWithContext(context, fn, ...args) {
172
+ _validateContext(context);
173
+ if (typeof fn !== 'function') {
174
+ errors.throwErr(errors.ERR_INVALID_SECURITY_CONTEXT_CALLBACK);
175
+ }
176
+ return asyncLocalStorage.run({ metadata: context, values: new Map() },
177
+ () => fn(...args));
178
+ }
179
+
180
+ //---------------------------------------------------------------------------
181
+ function createInvocationHook() {
182
+ return {
183
+ before: async ({ connection }) => {
184
+ if (!connection) {
185
+ return undefined;
186
+ }
187
+ return await applyForOperation(connection);
188
+ },
189
+ after: (state) => {
190
+ if (state?.connection) {
191
+ _clearConnection(state.connection);
192
+ }
193
+ }
194
+ };
195
+ }
196
+
197
+ module.exports = {
198
+ applyForOperation,
199
+ runWithContext,
200
+ getCurrentContext,
201
+ _getScopedValue,
202
+ _setScopedValue,
203
+ getInvocationHook,
204
+ setInvocationHook,
205
+ createInvocationHook
206
+ };
package/lib/thin/aq.js CHANGED
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2025, Oracle and/or its affiliates.
1
+ // Copyright (c) 2025, 2026, Oracle and/or its affiliates.
2
2
 
3
3
  //-----------------------------------------------------------------------------
4
4
  //
@@ -354,7 +354,6 @@ class ThinMsgPropsImpl {
354
354
  this.recipients = [];
355
355
  this.numAttempts = 0;
356
356
  this.deliveryMode = 0;
357
- this.enqTime = null;
358
357
  this.msgId = null;
359
358
  this.state = 0;
360
359
  this.payload = null;
@@ -472,4 +471,4 @@ class ThinMsgPropsImpl {
472
471
 
473
472
  }
474
473
 
475
- module.exports = { ThinQueueImpl };
474
+ module.exports = { ThinQueueImpl, ThinMsgPropsImpl };