oracledb 5.4.0 → 6.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.
- package/CHANGELOG.md +1 -1849
- package/LICENSE.txt +8 -222
- package/NOTICE.txt +1 -1
- package/README.md +38 -30
- package/SECURITY.md +38 -0
- package/THIRD_PARTY_LICENSES.txt +1 -1
- package/build/Release/oracledb-6.0.0-darwin-x64.node +0 -0
- package/build/Release/oracledb-6.0.0-darwin-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.0.0-js-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.0.0-linux-arm64.node +0 -0
- package/build/Release/oracledb-6.0.0-linux-arm64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.0.0-linux-x64.node +0 -0
- package/build/Release/oracledb-6.0.0-linux-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-6.0.0-win32-x64.node +0 -0
- package/build/Release/oracledb-6.0.0-win32-x64.node-buildinfo.txt +1 -0
- package/examples/README.md +113 -0
- package/examples/dbconfig.js +100 -0
- package/examples/example.js +156 -0
- package/index.js +26 -0
- package/lib/aqDeqOptions.js +146 -7
- package/lib/aqEnqOptions.js +59 -7
- package/lib/aqMessage.js +118 -7
- package/lib/aqQueue.js +242 -53
- package/lib/connection.js +1324 -465
- package/lib/constants.js +203 -0
- package/lib/dbObject.js +346 -32
- package/lib/errors.js +781 -0
- package/lib/impl/aqDeqOptions.js +197 -0
- package/lib/impl/aqEnqOptions.js +89 -0
- package/lib/impl/aqMessage.js +134 -0
- package/lib/impl/aqQueue.js +81 -0
- package/lib/impl/connection.js +529 -0
- package/lib/impl/dbObject.js +159 -0
- package/lib/impl/index.js +59 -0
- package/lib/impl/lob.js +85 -0
- package/lib/impl/pool.js +195 -0
- package/lib/impl/resultset.js +223 -0
- package/lib/impl/sodaCollection.js +174 -0
- package/lib/impl/sodaDatabase.js +81 -0
- package/lib/impl/sodaDocCursor.js +63 -0
- package/lib/impl/sodaDocument.js +98 -0
- package/lib/impl/sodaOperation.js +109 -0
- package/lib/lob.js +156 -68
- package/lib/oracledb.js +1051 -257
- package/lib/pool.js +654 -465
- package/lib/poolStatistics.js +23 -9
- package/lib/queryStream.js +14 -7
- package/lib/resultset.js +292 -171
- package/lib/settings.js +191 -0
- package/lib/sodaCollection.js +214 -201
- package/lib/sodaDatabase.js +107 -71
- package/lib/sodaDocCursor.js +44 -32
- package/lib/sodaDocument.js +76 -14
- package/lib/sodaOperation.js +131 -118
- package/lib/thin/connection.js +1038 -0
- package/lib/thin/dbObject.js +629 -0
- package/lib/thin/index.js +40 -0
- package/lib/thin/lob.js +188 -0
- package/lib/thin/pool.js +481 -0
- package/lib/thin/protocol/buffer.js +1040 -0
- package/lib/thin/protocol/capabilities.js +116 -0
- package/lib/thin/protocol/constants.js +764 -0
- package/lib/thin/protocol/encryptDecrypt.js +185 -0
- package/lib/thin/protocol/messages/auth.js +348 -0
- package/lib/thin/protocol/messages/base.js +475 -0
- package/lib/thin/protocol/messages/commit.js +56 -0
- package/lib/thin/protocol/messages/dataType.js +382 -0
- package/lib/thin/protocol/messages/execute.js +312 -0
- package/lib/thin/protocol/messages/fetch.js +60 -0
- package/lib/thin/protocol/messages/index.js +53 -0
- package/lib/thin/protocol/messages/lobOp.js +200 -0
- package/lib/thin/protocol/messages/logOff.js +53 -0
- package/lib/thin/protocol/messages/ping.js +56 -0
- package/lib/thin/protocol/messages/protocol.js +78 -0
- package/lib/thin/protocol/messages/rollback.js +56 -0
- package/lib/thin/protocol/messages/sessionRelease.js +60 -0
- package/lib/thin/protocol/messages/withData.js +811 -0
- package/lib/thin/protocol/oson.js +660 -0
- package/lib/thin/protocol/packet.js +520 -0
- package/lib/thin/protocol/protocol.js +202 -0
- package/lib/thin/protocol/utils.js +88 -0
- package/lib/thin/resultSet.js +122 -0
- package/lib/thin/sqlnet/connStrategy.js +175 -0
- package/lib/thin/sqlnet/constants.js +199 -0
- package/lib/thin/sqlnet/ezConnectResolver.js +488 -0
- package/lib/thin/sqlnet/navNodes.js +870 -0
- package/lib/thin/sqlnet/networkSession.js +620 -0
- package/lib/thin/sqlnet/ntTcp.js +525 -0
- package/lib/thin/sqlnet/nvStrToNvPair.js +783 -0
- package/lib/thin/sqlnet/packet.js +405 -0
- package/lib/thin/sqlnet/paramParser.js +205 -0
- package/lib/thin/sqlnet/sessionAtts.js +160 -0
- package/lib/thin/statement.js +301 -0
- package/lib/thin/util.js +289 -0
- package/lib/transformer.js +250 -0
- package/lib/types.js +357 -0
- package/lib/util.js +194 -108
- package/lib/version.js +36 -0
- package/package/README.md +33 -30
- package/package/install.js +89 -64
- package/package/prunebinaries.js +60 -12
- package/package.json +3 -3
- package/build/Release/oracledb-5.4.0-darwin-x64.node +0 -0
- package/build/Release/oracledb-5.4.0-darwin-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-5.4.0-linux-x64.node +0 -0
- package/build/Release/oracledb-5.4.0-linux-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-5.4.0-win32-x64.node +0 -0
- package/build/Release/oracledb-5.4.0-win32-x64.node-buildinfo.txt +0 -1
package/lib/aqQueue.js
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
|
-
// Copyright (c) 2019,
|
|
1
|
+
// Copyright (c) 2019, 2023, Oracle and/or its affiliates.
|
|
2
2
|
|
|
3
3
|
//-----------------------------------------------------------------------------
|
|
4
4
|
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
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.
|
|
7
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.
|
|
8
15
|
// You may obtain a copy of the License at
|
|
9
|
-
// http://www.apache.org/licenses/LICENSE-2.0.
|
|
10
16
|
//
|
|
11
|
-
//
|
|
12
|
-
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
13
|
-
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
// https://www.apache.org/licenses/LICENSE-2.0
|
|
14
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.
|
|
15
22
|
// See the License for the specific language governing permissions and
|
|
16
23
|
// limitations under the License.
|
|
17
24
|
//
|
|
@@ -19,67 +26,249 @@
|
|
|
19
26
|
|
|
20
27
|
'use strict';
|
|
21
28
|
|
|
29
|
+
const constants = require('./constants.js');
|
|
30
|
+
const errors = require('./errors.js');
|
|
22
31
|
const nodbUtil = require('./util.js');
|
|
32
|
+
const AqDeqOptions = require('./aqDeqOptions.js');
|
|
33
|
+
const AqEnqOptions = require('./aqEnqOptions.js');
|
|
34
|
+
const AqMessage = require('./aqMessage.js');
|
|
35
|
+
const BaseDbObject = require('./dbObject.js');
|
|
23
36
|
|
|
24
|
-
|
|
25
|
-
// deqOne()
|
|
26
|
-
// Returns a single message from the queue, if one is available.
|
|
27
|
-
//-----------------------------------------------------------------------------
|
|
28
|
-
async function deqOne() {
|
|
29
|
-
nodbUtil.checkArgCount(arguments, 0, 0);
|
|
30
|
-
return await this._deqOne();
|
|
31
|
-
}
|
|
37
|
+
class AqQueue {
|
|
32
38
|
|
|
39
|
+
//---------------------------------------------------------------------------
|
|
40
|
+
// _isPayload()
|
|
41
|
+
//
|
|
42
|
+
// Returns a boolean indicating if the value is a valid payload.
|
|
43
|
+
//---------------------------------------------------------------------------
|
|
44
|
+
_isPayload(value) {
|
|
45
|
+
return (typeof value === 'string' || Buffer.isBuffer(value) ||
|
|
46
|
+
value instanceof BaseDbObject);
|
|
47
|
+
}
|
|
33
48
|
|
|
34
|
-
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
49
|
+
//---------------------------------------------------------------------------
|
|
50
|
+
// _verifyMessage()
|
|
51
|
+
//
|
|
52
|
+
// Messages that can be enqueued must be a string, Buffer or database object
|
|
53
|
+
// (in which case all message properties are defaulted) or an object
|
|
54
|
+
// containing a "payload" property along with the other properties to use
|
|
55
|
+
// during the enqueue. A normalized object is returned.
|
|
56
|
+
//---------------------------------------------------------------------------
|
|
57
|
+
_verifyMessage(message) {
|
|
44
58
|
|
|
59
|
+
// validate we have a payload of the correct type
|
|
60
|
+
let payload;
|
|
61
|
+
if (this._isPayload(message)) {
|
|
62
|
+
payload = message;
|
|
63
|
+
message = {};
|
|
64
|
+
} else {
|
|
65
|
+
message = {...message};
|
|
66
|
+
if (this._isPayload(message.payload)) {
|
|
67
|
+
payload = message.payload;
|
|
68
|
+
} else if (this._payloadTypeClass) {
|
|
69
|
+
payload = new this._payloadTypeClass(message.payload);
|
|
70
|
+
} else {
|
|
71
|
+
errors.throwErr(errors.ERR_INVALID_AQ_MESSAGE);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
45
74
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return await this._enqOne(message);
|
|
55
|
-
}
|
|
75
|
+
// validate payload
|
|
76
|
+
if (typeof payload === 'string') {
|
|
77
|
+
message.payload = Buffer.from(payload);
|
|
78
|
+
} else if (Buffer.isBuffer(payload)) {
|
|
79
|
+
message.payload = payload;
|
|
80
|
+
} else {
|
|
81
|
+
message.payload = payload._impl;
|
|
82
|
+
}
|
|
56
83
|
|
|
84
|
+
// validate options, if applicable
|
|
85
|
+
if (message.correlation !== undefined) {
|
|
86
|
+
errors.assertParamPropValue(typeof message.correlation === 'string', 1,
|
|
87
|
+
"correlation");
|
|
88
|
+
}
|
|
89
|
+
if (message.delay !== undefined) {
|
|
90
|
+
errors.assertParamPropValue(Number.isInteger(message.delay), 1, "delay");
|
|
91
|
+
}
|
|
92
|
+
if (message.exceptionQueue !== undefined) {
|
|
93
|
+
errors.assertParamPropValue(typeof message.exceptionQueue === 'string',
|
|
94
|
+
1, "exceptionQueue");
|
|
95
|
+
}
|
|
96
|
+
if (message.expiration !== undefined) {
|
|
97
|
+
errors.assertParamPropValue(Number.isInteger(message.expiration), 1,
|
|
98
|
+
"expiration");
|
|
99
|
+
}
|
|
100
|
+
if (message.priority !== undefined) {
|
|
101
|
+
errors.assertParamPropValue(Number.isInteger(message.priority), 1,
|
|
102
|
+
"priority");
|
|
103
|
+
}
|
|
104
|
+
if (message.recipients !== undefined) {
|
|
105
|
+
errors.assertParamPropValue(nodbUtil.isArrayOfStrings(message.recipients),
|
|
106
|
+
1, "recipients");
|
|
107
|
+
}
|
|
57
108
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
109
|
+
return message;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
//---------------------------------------------------------------------------
|
|
113
|
+
// create()
|
|
114
|
+
//
|
|
115
|
+
// Creates the queue and populates some internal attributes.
|
|
116
|
+
//---------------------------------------------------------------------------
|
|
117
|
+
async create(conn, name, options) {
|
|
118
|
+
if (options.payloadType) {
|
|
119
|
+
if (typeof options.payloadType == 'string') {
|
|
120
|
+
const cls = await conn._getDbObjectClassForName(options.payloadType);
|
|
121
|
+
this._payloadTypeClass = cls;
|
|
122
|
+
options.payloadType = cls;
|
|
123
|
+
} else {
|
|
124
|
+
errors.assertParamPropValue(nodbUtil.isObject(options.payloadType) &&
|
|
125
|
+
options.payloadType.prototype instanceof BaseDbObject, 2, "payloadType");
|
|
126
|
+
this._payloadTypeClass = options.payloadType;
|
|
127
|
+
}
|
|
128
|
+
this._payloadType = constants.DB_TYPE_OBJECT;
|
|
129
|
+
this._payloadTypeName = this._payloadTypeClass.prototype.name;
|
|
130
|
+
} else {
|
|
131
|
+
this._payloadType = constants.DB_TYPE_RAW;
|
|
132
|
+
this._payloadTypeName = "RAW";
|
|
133
|
+
}
|
|
134
|
+
this._name = name;
|
|
135
|
+
this._impl = await conn._impl.getQueue(name, options);
|
|
136
|
+
}
|
|
68
137
|
|
|
138
|
+
//---------------------------------------------------------------------------
|
|
139
|
+
// deqMany()
|
|
140
|
+
//
|
|
141
|
+
// Returns an array of messages from the queue, up to the maximum specified,
|
|
142
|
+
// if any are available.
|
|
143
|
+
//---------------------------------------------------------------------------
|
|
144
|
+
async deqMany(maxMessages) {
|
|
145
|
+
errors.assertArgCount(arguments, 1, 1);
|
|
146
|
+
errors.assertParamValue(Number.isInteger(maxMessages) && maxMessages > 0,
|
|
147
|
+
1);
|
|
148
|
+
const msgImpls = await this._impl.deqMany(maxMessages);
|
|
149
|
+
const messages = new Array(msgImpls.length);
|
|
150
|
+
for (let i = 0; i < msgImpls.length; i++) {
|
|
151
|
+
const msg = new AqMessage();
|
|
152
|
+
msg._impl = msgImpls[i];
|
|
153
|
+
msg._payloadTypeClass = this._payloadTypeClass;
|
|
154
|
+
messages[i] = msg;
|
|
155
|
+
}
|
|
156
|
+
return messages;
|
|
157
|
+
}
|
|
69
158
|
|
|
70
|
-
|
|
159
|
+
//---------------------------------------------------------------------------
|
|
160
|
+
// deqOne()
|
|
161
|
+
//
|
|
162
|
+
// Returns a single message from the queue, if one is available.
|
|
163
|
+
//---------------------------------------------------------------------------
|
|
164
|
+
async deqOne() {
|
|
165
|
+
errors.assertArgCount(arguments, 0, 0);
|
|
166
|
+
const msgImpl = await this._impl.deqOne();
|
|
167
|
+
if (msgImpl) {
|
|
168
|
+
const msg = new AqMessage();
|
|
169
|
+
msg._impl = msgImpl;
|
|
170
|
+
msg._payloadTypeClass = this._payloadTypeClass;
|
|
171
|
+
return msg;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
71
174
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
175
|
+
//---------------------------------------------------------------------------
|
|
176
|
+
// deqOptions
|
|
177
|
+
//
|
|
178
|
+
// Property for the dequeue options associated with the queue.
|
|
179
|
+
//---------------------------------------------------------------------------
|
|
180
|
+
get deqOptions() {
|
|
181
|
+
if (!this._deqOptions) {
|
|
182
|
+
const deqOptions = new AqDeqOptions();
|
|
183
|
+
deqOptions._impl = this._impl.deqOptions;
|
|
184
|
+
this._deqOptions = deqOptions;
|
|
185
|
+
}
|
|
186
|
+
return this._deqOptions;
|
|
77
187
|
}
|
|
78
188
|
|
|
79
|
-
|
|
80
|
-
|
|
189
|
+
//---------------------------------------------------------------------------
|
|
190
|
+
// enqMany()
|
|
191
|
+
//
|
|
192
|
+
// Enqueues multiple messages into the queue at the same time, avoiding
|
|
193
|
+
// multiple round-trips.
|
|
194
|
+
//---------------------------------------------------------------------------
|
|
195
|
+
async enqMany(messages) {
|
|
196
|
+
errors.assertArgCount(arguments, 1, 1);
|
|
197
|
+
errors.assertParamValue(Array.isArray(messages) && messages.length > 0, 1);
|
|
198
|
+
const verifiedMessages = new Array(messages.length);
|
|
199
|
+
for (let i = 0; i < messages.length; i++) {
|
|
200
|
+
verifiedMessages[i] = this._verifyMessage(messages[i]);
|
|
201
|
+
}
|
|
202
|
+
return await this._impl.enqMany(verifiedMessages);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
//---------------------------------------------------------------------------
|
|
206
|
+
// enqOne()
|
|
207
|
+
//
|
|
208
|
+
// Enqueues a single message into the queue.
|
|
209
|
+
//---------------------------------------------------------------------------
|
|
210
|
+
async enqOne(message) {
|
|
211
|
+
errors.assertArgCount(arguments, 1, 1);
|
|
212
|
+
message = this._verifyMessage(message);
|
|
213
|
+
return await this._impl.enqOne(message);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
//---------------------------------------------------------------------------
|
|
217
|
+
// enqOptions
|
|
218
|
+
//
|
|
219
|
+
// Property for the enqueue options associated with the queue.
|
|
220
|
+
//---------------------------------------------------------------------------
|
|
221
|
+
get enqOptions() {
|
|
222
|
+
if (!this._enqOptions) {
|
|
223
|
+
const enqOptions = new AqEnqOptions();
|
|
224
|
+
enqOptions._impl = this._impl.enqOptions;
|
|
225
|
+
this._enqOptions = enqOptions;
|
|
226
|
+
}
|
|
227
|
+
return this._enqOptions;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
//---------------------------------------------------------------------------
|
|
231
|
+
// name
|
|
232
|
+
//
|
|
233
|
+
// Property for the name of the queue.
|
|
234
|
+
//---------------------------------------------------------------------------
|
|
235
|
+
get name() {
|
|
236
|
+
return this._name;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
//---------------------------------------------------------------------------
|
|
240
|
+
// payloadType
|
|
241
|
+
//
|
|
242
|
+
// Property for the payload type.
|
|
243
|
+
//---------------------------------------------------------------------------
|
|
244
|
+
get payloadType() {
|
|
245
|
+
return this._payloadType;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
//---------------------------------------------------------------------------
|
|
249
|
+
// payloadTypeName
|
|
250
|
+
//
|
|
251
|
+
// Property for the payload type name.
|
|
252
|
+
//---------------------------------------------------------------------------
|
|
253
|
+
get payloadTypeName() {
|
|
254
|
+
return this._payloadTypeName;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
//---------------------------------------------------------------------------
|
|
258
|
+
// payloadTypeClass
|
|
259
|
+
//
|
|
260
|
+
// Property for the payload type class.
|
|
261
|
+
//---------------------------------------------------------------------------
|
|
262
|
+
get payloadTypeClass() {
|
|
263
|
+
return this._payloadTypeClass;
|
|
81
264
|
}
|
|
82
265
|
|
|
83
266
|
}
|
|
84
267
|
|
|
268
|
+
nodbUtil.wrapFns(AqQueue.prototype,
|
|
269
|
+
"deqOne",
|
|
270
|
+
"deqMany",
|
|
271
|
+
"enqOne",
|
|
272
|
+
"enqMany");
|
|
273
|
+
|
|
85
274
|
module.exports = AqQueue;
|