oracledb 6.9.0 → 7.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/LICENSE.txt +1 -1
- package/NOTICE.txt +1 -1
- package/README.md +9 -9
- package/build/Release/oracledb-7.0.0-darwin-arm64.node +0 -0
- package/build/Release/oracledb-7.0.0-darwin-arm64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-7.0.0-js-buildinfo.txt +1 -0
- package/build/Release/oracledb-7.0.0-linux-arm64.node +0 -0
- package/build/Release/oracledb-7.0.0-linux-arm64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-7.0.0-linux-x64.node +0 -0
- package/build/Release/oracledb-7.0.0-linux-x64.node-buildinfo.txt +1 -0
- package/build/Release/oracledb-7.0.0-win32-x64.node +0 -0
- package/build/Release/oracledb-7.0.0-win32-x64.node-buildinfo.txt +1 -0
- package/eslint.config.js +39 -0
- package/lib/aqDeqOptions.js +18 -1
- package/lib/aqQueue.js +10 -6
- package/lib/connection.js +418 -39
- package/lib/dbObject.js +25 -4
- package/lib/endUserSecurityContext.js +176 -0
- package/lib/errors.js +99 -8
- package/lib/impl/aqDeqOptions.js +10 -1
- package/lib/impl/connection.js +76 -2
- package/lib/impl/datahandlers/buffer.js +68 -5
- package/lib/impl/datahandlers/oson.js +7 -2
- package/lib/impl/datahandlers/vector.js +25 -5
- package/lib/impl/lob.js +9 -0
- package/lib/impl/parserHelpers.js +443 -0
- package/lib/impl/resultset.js +1 -1
- package/lib/impl/sodaDocument.js +5 -14
- package/lib/lob.js +27 -14
- package/lib/obfuscation.js +97 -0
- package/lib/oracledb.js +163 -49
- package/lib/parser.js +204 -0
- package/lib/pipeline.js +113 -0
- package/lib/pool.js +203 -147
- package/lib/poolStatistics.js +1 -1
- package/lib/resultset.js +42 -21
- package/lib/settings.js +1 -0
- package/lib/sodaCollection.js +12 -8
- package/lib/sodaDatabase.js +35 -8
- package/lib/sodaDocument.js +24 -6
- package/lib/sodaOperation.js +7 -6
- package/lib/thin/aq.js +475 -0
- package/lib/thin/connection.js +518 -54
- package/lib/thin/dbObject.js +7 -1
- package/lib/thin/lob.js +20 -1
- package/lib/thin/pool.js +42 -62
- package/lib/thin/protocol/capabilities.js +21 -4
- package/lib/thin/protocol/constants.js +143 -2
- package/lib/thin/protocol/encryptDecrypt.js +45 -10
- package/lib/thin/protocol/messages/aqArray.js +238 -0
- package/lib/thin/protocol/messages/aqBase.js +305 -0
- package/lib/thin/protocol/messages/aqDeq.js +164 -0
- package/lib/thin/protocol/messages/aqEnq.js +135 -0
- package/lib/thin/protocol/messages/auth.js +18 -28
- package/lib/thin/protocol/messages/base.js +245 -4
- package/lib/thin/protocol/messages/dataType.js +8 -3
- package/lib/thin/protocol/messages/directPathLoadStream.js +377 -0
- package/lib/thin/protocol/messages/directPathOp.js +65 -0
- package/lib/thin/protocol/messages/directPathPrepare.js +158 -0
- package/lib/thin/protocol/messages/endPipeline.js +56 -0
- package/lib/thin/protocol/messages/execute.js +9 -7
- package/lib/thin/protocol/messages/index.js +9 -1
- package/lib/thin/protocol/messages/protocol.js +2 -2
- package/lib/thin/protocol/messages/withData.js +10 -142
- package/lib/thin/protocol/packet.js +120 -28
- package/lib/thin/protocol/protocol.js +110 -25
- package/lib/thin/protocol/utils.js +1 -26
- package/lib/thin/resultSet.js +13 -19
- package/lib/thin/sqlnet/ezConnectResolver.js +2 -2
- package/lib/thin/sqlnet/networkSession.js +63 -41
- package/lib/thin/sqlnet/ntTcp.js +24 -0
- package/lib/thin/sqlnet/nvStrToNvPair.js +50 -25
- package/lib/thin/sqlnet/packet.js +25 -4
- package/lib/thin/sqlnet/paramParser.js +10 -7
- package/lib/thin/statementCache.js +2 -4
- package/lib/traceHandler.js +59 -2
- package/lib/transformer.js +8 -3
- package/lib/types.js +36 -22
- package/lib/util.js +6 -19
- package/lib/version.js +3 -3
- package/package/install.js +5 -5
- package/package/prunebinaries.js +1 -1
- package/package.json +1 -1
- package/plugins/configProviders/awsCommon.js +125 -0
- package/plugins/configProviders/awss3/index.js +138 -0
- package/plugins/configProviders/awssecretsmanager/index.js +147 -0
- package/plugins/configProviders/azure/index.js +7 -5
- package/plugins/token/extensionAzure/index.js +0 -1
- package/plugins/token/extensionOci/index.js +0 -1
- package/build/Release/oracledb-6.9.0-darwin-arm64.node +0 -0
- package/build/Release/oracledb-6.9.0-darwin-arm64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.9.0-darwin-x64.node +0 -0
- package/build/Release/oracledb-6.9.0-darwin-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.9.0-js-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.9.0-linux-arm64.node +0 -0
- package/build/Release/oracledb-6.9.0-linux-arm64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.9.0-linux-x64.node +0 -0
- package/build/Release/oracledb-6.9.0-linux-x64.node-buildinfo.txt +0 -1
- package/build/Release/oracledb-6.9.0-win32-x64.node +0 -0
- package/build/Release/oracledb-6.9.0-win32-x64.node-buildinfo.txt +0 -1
package/lib/sodaDatabase.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2018,
|
|
1
|
+
// Copyright (c) 2018, 2025, Oracle and/or its affiliates.
|
|
2
2
|
|
|
3
3
|
//-----------------------------------------------------------------------------
|
|
4
4
|
//
|
|
@@ -32,6 +32,7 @@ const SodaDocument = require('./sodaDocument.js');
|
|
|
32
32
|
const errors = require('./errors.js');
|
|
33
33
|
const nodbUtil = require('./util.js');
|
|
34
34
|
const settings = require('./settings.js');
|
|
35
|
+
const transformer = require('./transformer.js');
|
|
35
36
|
|
|
36
37
|
class SodaDatabase {
|
|
37
38
|
|
|
@@ -64,7 +65,7 @@ class SodaDatabase {
|
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
const coll = new SodaCollection();
|
|
68
|
+
const coll = new SodaCollection(this);
|
|
68
69
|
coll._impl = await this._impl.createCollection(name, options);
|
|
69
70
|
return coll;
|
|
70
71
|
}
|
|
@@ -76,6 +77,7 @@ class SodaDatabase {
|
|
|
76
77
|
//---------------------------------------------------------------------------
|
|
77
78
|
createDocument(content, a2) {
|
|
78
79
|
let options = {};
|
|
80
|
+
let inContent;
|
|
79
81
|
|
|
80
82
|
errors.assertArgCount(arguments, 1, 2);
|
|
81
83
|
errors.assertParamValue(Buffer.isBuffer(content) ||
|
|
@@ -87,14 +89,20 @@ class SodaDatabase {
|
|
|
87
89
|
errors.assertParamPropString(options, 2, "mediaType");
|
|
88
90
|
}
|
|
89
91
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
// native JSON support for SODA is available from Oracle Client 23.4
|
|
93
|
+
if (this._impl.supportsJson &&
|
|
94
|
+
(!options.mediaType || options.mediaType === 'application/json')) {
|
|
95
|
+
inContent = transformer.transformJsonValue(content);
|
|
96
|
+
} else if (Buffer.isBuffer(content)) {
|
|
97
|
+
inContent = content;
|
|
98
|
+
} else if (typeof content === 'string') {
|
|
99
|
+
inContent = Buffer.from(content);
|
|
100
|
+
} else {
|
|
101
|
+
inContent = Buffer.from(JSON.stringify(content));
|
|
94
102
|
}
|
|
95
103
|
|
|
96
104
|
const doc = new SodaDocument();
|
|
97
|
-
doc._impl = this._impl.createDocument(
|
|
105
|
+
doc._impl = this._impl.createDocument(inContent, options);
|
|
98
106
|
return doc;
|
|
99
107
|
}
|
|
100
108
|
|
|
@@ -133,12 +141,31 @@ class SodaDatabase {
|
|
|
133
141
|
const options = {autoCommit: settings.autoCommit};
|
|
134
142
|
const collImpl = await this._impl.openCollection(name, options);
|
|
135
143
|
if (collImpl) {
|
|
136
|
-
const coll = new SodaCollection();
|
|
144
|
+
const coll = new SodaCollection(this);
|
|
137
145
|
coll._impl = collImpl;
|
|
138
146
|
return coll;
|
|
139
147
|
}
|
|
140
148
|
}
|
|
141
149
|
|
|
150
|
+
//---------------------------------------------------------------------------
|
|
151
|
+
// _verifySodaDoc()
|
|
152
|
+
//
|
|
153
|
+
// Verifies the content passed is valid for a SodaDocument object.
|
|
154
|
+
//---------------------------------------------------------------------------
|
|
155
|
+
_verifySodaDoc(content) {
|
|
156
|
+
// check if the content is a sodaDocument object
|
|
157
|
+
if (content != null && content._sodaDocumentMarker)
|
|
158
|
+
return content._impl;
|
|
159
|
+
errors.assertParamValue(nodbUtil.isObject(content), 1);
|
|
160
|
+
|
|
161
|
+
// JSON is assumed, if you pass in the content
|
|
162
|
+
// starting from Oracle Client 23ai onwards, JSON in SODA is supported
|
|
163
|
+
if (this._impl._supportsJson)
|
|
164
|
+
return transformer.transformJsonValue(content);
|
|
165
|
+
|
|
166
|
+
return Buffer.from(JSON.stringify(content));
|
|
167
|
+
}
|
|
168
|
+
|
|
142
169
|
}
|
|
143
170
|
|
|
144
171
|
nodbUtil.wrapFns(SodaDatabase.prototype,
|
package/lib/sodaDocument.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2018,
|
|
1
|
+
// Copyright (c) 2018, 2025, Oracle and/or its affiliates.
|
|
2
2
|
|
|
3
3
|
//-----------------------------------------------------------------------------
|
|
4
4
|
//
|
|
@@ -40,10 +40,14 @@ class SodaDocument {
|
|
|
40
40
|
//---------------------------------------------------------------------------
|
|
41
41
|
// getContent()
|
|
42
42
|
//
|
|
43
|
-
// Returns the document content
|
|
43
|
+
// Returns the document content in native JavaScript format.
|
|
44
|
+
// Non-JSON content is returned as a JavaScript Buffer.
|
|
44
45
|
//---------------------------------------------------------------------------
|
|
45
46
|
getContent() {
|
|
46
|
-
|
|
47
|
+
const content = this._impl.getContent();
|
|
48
|
+
if (typeof content === 'string' && this.mediaType === 'application/json')
|
|
49
|
+
return JSON.parse(content);
|
|
50
|
+
return content;
|
|
47
51
|
}
|
|
48
52
|
|
|
49
53
|
//---------------------------------------------------------------------------
|
|
@@ -52,7 +56,14 @@ class SodaDocument {
|
|
|
52
56
|
// Returns the document content as a buffer.
|
|
53
57
|
//---------------------------------------------------------------------------
|
|
54
58
|
getContentAsBuffer() {
|
|
55
|
-
|
|
59
|
+
const content = this._impl.getContent();
|
|
60
|
+
if (Buffer.isBuffer(content))
|
|
61
|
+
return content;
|
|
62
|
+
else if (typeof content == 'string')
|
|
63
|
+
return Buffer.from(content);
|
|
64
|
+
|
|
65
|
+
// assumed to be a JSON Object (available from Oracle Client 23ai)
|
|
66
|
+
return Buffer.from(JSON.stringify(content));
|
|
56
67
|
}
|
|
57
68
|
|
|
58
69
|
//---------------------------------------------------------------------------
|
|
@@ -61,7 +72,14 @@ class SodaDocument {
|
|
|
61
72
|
// Returns the document content as a string.
|
|
62
73
|
//---------------------------------------------------------------------------
|
|
63
74
|
getContentAsString() {
|
|
64
|
-
|
|
75
|
+
const content = this._impl.getContent();
|
|
76
|
+
if (typeof content === 'string')
|
|
77
|
+
return content;
|
|
78
|
+
else if (Buffer.isBuffer(content))
|
|
79
|
+
return content.toString();
|
|
80
|
+
|
|
81
|
+
// assumed to be a JSON Object (available from Oracle Client 23ai)
|
|
82
|
+
return JSON.stringify(content);
|
|
65
83
|
}
|
|
66
84
|
|
|
67
85
|
//---------------------------------------------------------------------------
|
|
@@ -92,7 +110,7 @@ class SodaDocument {
|
|
|
92
110
|
}
|
|
93
111
|
|
|
94
112
|
//---------------------------------------------------------------------------
|
|
95
|
-
//
|
|
113
|
+
// version
|
|
96
114
|
//
|
|
97
115
|
// Property for the version of the document.
|
|
98
116
|
//---------------------------------------------------------------------------
|
package/lib/sodaOperation.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) 2018,
|
|
1
|
+
// Copyright (c) 2018, 2025, Oracle and/or its affiliates.
|
|
2
2
|
|
|
3
3
|
//-----------------------------------------------------------------------------
|
|
4
4
|
//
|
|
@@ -34,11 +34,12 @@ const settings = require('./settings.js');
|
|
|
34
34
|
|
|
35
35
|
class SodaOperation {
|
|
36
36
|
|
|
37
|
-
constructor() {
|
|
37
|
+
constructor(sodaDb) {
|
|
38
38
|
this._options = {
|
|
39
39
|
autoCommit: settings.autoCommit,
|
|
40
40
|
fetchArraySize: settings.fetchArraySize
|
|
41
41
|
};
|
|
42
|
+
this._sodaDb = sodaDb;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
//---------------------------------------------------------------------------
|
|
@@ -118,7 +119,7 @@ class SodaOperation {
|
|
|
118
119
|
//---------------------------------------------------------------------------
|
|
119
120
|
async replaceOne(content) {
|
|
120
121
|
errors.assertArgCount(arguments, 1, 1);
|
|
121
|
-
content =
|
|
122
|
+
content = this._sodaDb._verifySodaDoc(content);
|
|
122
123
|
return await this._impl.replaceOne(this._options, content);
|
|
123
124
|
}
|
|
124
125
|
|
|
@@ -130,7 +131,7 @@ class SodaOperation {
|
|
|
130
131
|
//---------------------------------------------------------------------------
|
|
131
132
|
async replaceOneAndGet(content) {
|
|
132
133
|
errors.assertArgCount(arguments, 1, 1);
|
|
133
|
-
content =
|
|
134
|
+
content = this._sodaDb._verifySodaDoc(content);
|
|
134
135
|
const docImpl = await this._impl.replaceOneAndGet(this._options, content);
|
|
135
136
|
if (docImpl) {
|
|
136
137
|
const doc = new SodaDocument();
|
|
@@ -200,7 +201,7 @@ class SodaOperation {
|
|
|
200
201
|
// limit property - a non-terminal function and can chain further
|
|
201
202
|
limit(n) {
|
|
202
203
|
errors.assertArgCount(arguments, 1, 1);
|
|
203
|
-
errors.assertParamValue(
|
|
204
|
+
errors.assertParamValue(Number.isInteger(n) && n > 0, 1);
|
|
204
205
|
this._options.limit = n;
|
|
205
206
|
return this;
|
|
206
207
|
}
|
|
@@ -208,7 +209,7 @@ class SodaOperation {
|
|
|
208
209
|
// skip property - a non-terminal function and can chain further
|
|
209
210
|
skip(n) {
|
|
210
211
|
errors.assertArgCount(arguments, 1, 1);
|
|
211
|
-
errors.assertParamValue(
|
|
212
|
+
errors.assertParamValue(Number.isInteger(n) && n >= 0, 1);
|
|
212
213
|
this._options.skip = n;
|
|
213
214
|
return this;
|
|
214
215
|
}
|
package/lib/thin/aq.js
ADDED
|
@@ -0,0 +1,475 @@
|
|
|
1
|
+
// Copyright (c) 2025, 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
|
+
|
|
27
|
+
'use strict';
|
|
28
|
+
|
|
29
|
+
const AqEnqMessage = require("./protocol/messages/aqEnq.js");
|
|
30
|
+
const AqDeqMessage = require("./protocol/messages/aqDeq.js");
|
|
31
|
+
const AqArrayMessage = require("./protocol/messages/aqArray.js");
|
|
32
|
+
const constants = require("./protocol/constants.js");
|
|
33
|
+
const errors = require("../errors.js");
|
|
34
|
+
const types = require("../types.js");
|
|
35
|
+
const { AQ_VISIBILITY_IMMEDIATE } = require("../constants.js");
|
|
36
|
+
|
|
37
|
+
class ThinQueueImpl {
|
|
38
|
+
|
|
39
|
+
constructor(connImpl, name, payloadTypeClass, payloadType) {
|
|
40
|
+
this._connImpl = connImpl;
|
|
41
|
+
this.name = name;
|
|
42
|
+
this.payloadTypeClass = payloadTypeClass;
|
|
43
|
+
this.isJson = payloadType === types.DB_TYPE_JSON;
|
|
44
|
+
this.payloadType = payloadType;
|
|
45
|
+
this.deqOptions = new ThinDeqOptionsImpl();
|
|
46
|
+
this.enqOptions = new ThinEnqOptionsImpl();
|
|
47
|
+
if (this.isJson) {
|
|
48
|
+
this.payloadToid = Buffer.alloc(16, 0);
|
|
49
|
+
this.payloadToid[15] = 0x47;
|
|
50
|
+
} else if (this.payloadTypeClass) {
|
|
51
|
+
// Assuming oid is Buffer
|
|
52
|
+
this.payloadToid = this.payloadTypeClass._objType.oid;
|
|
53
|
+
} else {
|
|
54
|
+
this.payloadToid = Buffer.alloc(16, 0);
|
|
55
|
+
this.payloadToid[15] = 0x17;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
//---------------------------------------------------------------------------
|
|
60
|
+
// _createArrayDeqMessage()
|
|
61
|
+
//
|
|
62
|
+
// Creates an array dequeue message for dequeuing multiple messages.
|
|
63
|
+
//---------------------------------------------------------------------------
|
|
64
|
+
_createArrayDeqMessage(numIters) {
|
|
65
|
+
const message = new AqArrayMessage(this._connImpl);
|
|
66
|
+
message.numIters = numIters;
|
|
67
|
+
message.propsImpls = Array.from({length: numIters},
|
|
68
|
+
() => new ThinMsgPropsImpl());
|
|
69
|
+
message.queueImpl = this;
|
|
70
|
+
message.deqOptionsImpl = this.deqOptions;
|
|
71
|
+
message.operation = constants.TNS_AQ_ARRAY_DEQ;
|
|
72
|
+
return message;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
//---------------------------------------------------------------------------
|
|
76
|
+
// _createArrayEnqMessage()
|
|
77
|
+
//
|
|
78
|
+
// Creates an array enqueue message for enqueuing multiple messages.
|
|
79
|
+
//---------------------------------------------------------------------------
|
|
80
|
+
_createArrayEnqMessage(propsImpls) {
|
|
81
|
+
const message = new AqArrayMessage(this._connImpl);
|
|
82
|
+
message.queueImpl = this;
|
|
83
|
+
message.enqOptionsImpl = this.enqOptions;
|
|
84
|
+
message.propsImpls = propsImpls;
|
|
85
|
+
message.operation = constants.TNS_AQ_ARRAY_ENQ;
|
|
86
|
+
message.numIters = propsImpls.length;
|
|
87
|
+
return message;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
//---------------------------------------------------------------------------
|
|
91
|
+
// _createDeqMessage()
|
|
92
|
+
//
|
|
93
|
+
// Creates a dequeue message for dequeuing a single message.
|
|
94
|
+
//---------------------------------------------------------------------------
|
|
95
|
+
_createDeqMessage() {
|
|
96
|
+
const propsImpl = new ThinMsgPropsImpl();
|
|
97
|
+
const message = new AqDeqMessage(this._connImpl);
|
|
98
|
+
message.queueImpl = this;
|
|
99
|
+
message.deqOptionsImpl = this.deqOptions;
|
|
100
|
+
message.propsImpl = propsImpl;
|
|
101
|
+
return message;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
//---------------------------------------------------------------------------
|
|
105
|
+
// _createEnqMessage()
|
|
106
|
+
//
|
|
107
|
+
// Creates an enqueue message for enqueuing a single message.
|
|
108
|
+
//---------------------------------------------------------------------------
|
|
109
|
+
_createEnqMessage(propsImpl) {
|
|
110
|
+
const message = new AqEnqMessage(this._connImpl);
|
|
111
|
+
message.queueImpl = this;
|
|
112
|
+
message.enqOptionsImpl = this.enqOptions;
|
|
113
|
+
message.propsImpl = propsImpl;
|
|
114
|
+
return message;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
//---------------------------------------------------------------------------
|
|
118
|
+
// deq()
|
|
119
|
+
//
|
|
120
|
+
// Dequeues messages from the queue, either one or many based on the max
|
|
121
|
+
// number of messages requested.
|
|
122
|
+
//---------------------------------------------------------------------------
|
|
123
|
+
async deq(maxNumMessages) {
|
|
124
|
+
let results;
|
|
125
|
+
if (maxNumMessages > 1) {
|
|
126
|
+
results = await this.deqMany(maxNumMessages);
|
|
127
|
+
} else if (maxNumMessages == 1) {
|
|
128
|
+
results = await this.deqOne();
|
|
129
|
+
} else {
|
|
130
|
+
errors.throwErr(errors.ERR_INVALID_MAX_MESSAGES);
|
|
131
|
+
}
|
|
132
|
+
return results;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
//---------------------------------------------------------------------------
|
|
136
|
+
// deqMany()
|
|
137
|
+
//
|
|
138
|
+
// Dequeues multiple messages from the queue.
|
|
139
|
+
//---------------------------------------------------------------------------
|
|
140
|
+
async deqMany(maxNumMessages) {
|
|
141
|
+
if (this.enqOptions.visibility === AQ_VISIBILITY_IMMEDIATE)
|
|
142
|
+
errors.throwNotImplemented('immediate visibility with deqMany');
|
|
143
|
+
const message = this._createArrayDeqMessage(maxNumMessages);
|
|
144
|
+
await this._connImpl._protocol._processMessage(message);
|
|
145
|
+
if (message.noMsgFound) {
|
|
146
|
+
return [];
|
|
147
|
+
}
|
|
148
|
+
return message.propsImpls.slice(0, message.numIters);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
//---------------------------------------------------------------------------
|
|
152
|
+
// deqOne()
|
|
153
|
+
//
|
|
154
|
+
// Dequeues a single message from the queue.
|
|
155
|
+
//---------------------------------------------------------------------------
|
|
156
|
+
async deqOne() {
|
|
157
|
+
const message = this._createDeqMessage();
|
|
158
|
+
await this._connImpl._protocol._processMessage(message);
|
|
159
|
+
if (message.noMsgFound) {
|
|
160
|
+
return [];
|
|
161
|
+
}
|
|
162
|
+
return [message.propsImpl];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
//---------------------------------------------------------------------------
|
|
166
|
+
// enq()
|
|
167
|
+
//
|
|
168
|
+
// Enqueues one or many messages to the queue based on the number provided.
|
|
169
|
+
//---------------------------------------------------------------------------
|
|
170
|
+
async enq(messages) {
|
|
171
|
+
const propsImpls = messages.map(properties => {
|
|
172
|
+
const impl = new ThinMsgPropsImpl();
|
|
173
|
+
impl._init(properties);
|
|
174
|
+
return impl;
|
|
175
|
+
});
|
|
176
|
+
if (messages.length == 1)
|
|
177
|
+
return await this.enqOne(propsImpls[0]);
|
|
178
|
+
return await this.enqMany(propsImpls);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
//---------------------------------------------------------------------------
|
|
182
|
+
// enqMany()
|
|
183
|
+
//
|
|
184
|
+
// Enqueues multiple messages to the queue.
|
|
185
|
+
//---------------------------------------------------------------------------
|
|
186
|
+
async enqMany(propsImpls) {
|
|
187
|
+
if (this.enqOptions.visibility === AQ_VISIBILITY_IMMEDIATE)
|
|
188
|
+
errors.throwNotImplemented('immediate visibility with enqMany');
|
|
189
|
+
const message = this._createArrayEnqMessage(propsImpls);
|
|
190
|
+
await this._connImpl._protocol._processMessage(message);
|
|
191
|
+
return propsImpls;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
//---------------------------------------------------------------------------
|
|
195
|
+
// enqOne()
|
|
196
|
+
//
|
|
197
|
+
// Enqueues a single message to the queue.
|
|
198
|
+
//---------------------------------------------------------------------------
|
|
199
|
+
async enqOne(propsImpl) {
|
|
200
|
+
// No need to set payloadJson or similar; _writePayload handles OSON/JSON
|
|
201
|
+
const message = this._createEnqMessage(propsImpl);
|
|
202
|
+
await this._connImpl._protocol._processMessage(message);
|
|
203
|
+
return [propsImpl];
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
//---------------------------------------------------------------------------
|
|
207
|
+
// _getConnImpl()
|
|
208
|
+
//
|
|
209
|
+
// Common method on all classes that make use of a connection -- used to
|
|
210
|
+
// ensure serialization of all use of the connection.
|
|
211
|
+
//---------------------------------------------------------------------------
|
|
212
|
+
_getConnImpl() {
|
|
213
|
+
return this._connImpl;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
class ThinDeqOptionsImpl {
|
|
219
|
+
|
|
220
|
+
constructor() {
|
|
221
|
+
this.condition = null;
|
|
222
|
+
this.consumerName = null;
|
|
223
|
+
this.correlation = null;
|
|
224
|
+
this.deliveryMode = constants.TNS_AQ_MSG_PERSISTENT;
|
|
225
|
+
this.mode = constants.TNS_AQ_DEQ_REMOVE;
|
|
226
|
+
this.msgId = null;
|
|
227
|
+
this.navigation = constants.TNS_AQ_DEQ_NEXT_MSG;
|
|
228
|
+
this.transformation = null;
|
|
229
|
+
this.visibility = constants.TNS_AQ_DEQ_ON_COMMIT;
|
|
230
|
+
this.wait = constants.TNS_AQ_DEQ_WAIT_FOREVER;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
getCondition() {
|
|
234
|
+
return this.condition;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
getConsumerName() {
|
|
238
|
+
return this.consumerName;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
getCorrelation() {
|
|
242
|
+
return this.correlation;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
getMsgId() {
|
|
246
|
+
return this.msgId;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
getMode() {
|
|
250
|
+
return this.mode;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
getNavigation() {
|
|
254
|
+
return this.navigation;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
getTransformation() {
|
|
258
|
+
return this.transformation;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
getVisibility() {
|
|
262
|
+
return this.visibility;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
getWait() {
|
|
266
|
+
return this.wait;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
setCondition(value) {
|
|
270
|
+
this.condition = value;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
setConsumerName(value) {
|
|
274
|
+
this.consumerName = value;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
setCorrelation(value) {
|
|
278
|
+
this.correlation = value;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
setDeliveryMode(value) {
|
|
282
|
+
this.deliveryMode = value;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
setMode(value) {
|
|
286
|
+
this.mode = value;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
setMsgId(value) {
|
|
290
|
+
this.msgId = value;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
setNavigation(value) {
|
|
294
|
+
this.navigation = value;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
setTransformation(value) {
|
|
298
|
+
this.transformation = value;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
setVisibility(value) {
|
|
302
|
+
this.visibility = value;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
setWait(value) {
|
|
306
|
+
this.wait = value;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
class ThinEnqOptionsImpl {
|
|
312
|
+
|
|
313
|
+
constructor() {
|
|
314
|
+
this.transformation = null;
|
|
315
|
+
this.visibility = constants.TNS_AQ_ENQ_ON_COMMIT;
|
|
316
|
+
this.deliveryMode = constants.TNS_AQ_MSG_PERSISTENT;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
getDeliveryMode() {
|
|
320
|
+
return this.deliveryMode;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
getTransformation() {
|
|
324
|
+
errors.throwNotImplemented('transformation');
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
getVisibility() {
|
|
328
|
+
return this.visibility;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
setDeliveryMode(value) {
|
|
332
|
+
this.deliveryMode = value;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
// eslint-disable-next-line no-unused-vars
|
|
336
|
+
setTransformation(value) {
|
|
337
|
+
errors.throwNotImplemented('transformation');
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
setVisibility(value) {
|
|
341
|
+
this.visibility = value;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
class ThinMsgPropsImpl {
|
|
347
|
+
|
|
348
|
+
constructor() {
|
|
349
|
+
this.delay = constants.TNS_AQ_MSG_NO_DELAY;
|
|
350
|
+
this.correlation = null;
|
|
351
|
+
this.exceptionq = null;
|
|
352
|
+
this.expiration = constants.TNS_AQ_MSG_NO_EXPIRATION;
|
|
353
|
+
this.priority = 0;
|
|
354
|
+
this.recipients = [];
|
|
355
|
+
this.numAttempts = 0;
|
|
356
|
+
this.deliveryMode = 0;
|
|
357
|
+
this.enqTime = null;
|
|
358
|
+
this.msgId = null;
|
|
359
|
+
this.state = 0;
|
|
360
|
+
this.payload = null;
|
|
361
|
+
this.enqTxnId = null;
|
|
362
|
+
this.senderAgentName = null;
|
|
363
|
+
this.senderAgentAddress = null;
|
|
364
|
+
this.senderAgentProtocol = 0;
|
|
365
|
+
this.originalMsgId = null;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
//---------------------------------------------------------------------------
|
|
369
|
+
// _init()
|
|
370
|
+
//
|
|
371
|
+
// Initializes the message properties from the provided properties object.
|
|
372
|
+
//---------------------------------------------------------------------------
|
|
373
|
+
_init(properties) {
|
|
374
|
+
this.payload = properties.payload;
|
|
375
|
+
if (properties.correlation !== undefined)
|
|
376
|
+
this.correlation = properties.correlation;
|
|
377
|
+
if (properties.delay !== undefined)
|
|
378
|
+
this.delay = properties.delay;
|
|
379
|
+
if (properties.exceptionQueue !== undefined)
|
|
380
|
+
this.exceptionQueue = properties.exceptionQueue;
|
|
381
|
+
if (properties.expiration !== undefined)
|
|
382
|
+
this.expiration = properties.expiration;
|
|
383
|
+
if (properties.priority !== undefined)
|
|
384
|
+
this.priority = properties.priority;
|
|
385
|
+
if (properties.recipients !== undefined)
|
|
386
|
+
this.recipients = properties.recipients;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
getNumAttempts() {
|
|
390
|
+
return this.numAttempts;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
getCorrelation() {
|
|
394
|
+
return this.correlation;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
getDelay() {
|
|
398
|
+
return this.delay;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
getDeliveryMode() {
|
|
402
|
+
return this.deliveryMode;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
getEnqTime() {
|
|
406
|
+
return this.enqTime;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
getExceptionQueue() {
|
|
410
|
+
return this.exceptionq;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
getExpiration() {
|
|
414
|
+
return this.expiration;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
getMsgId() {
|
|
418
|
+
return this.msgId;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
getOriginalMsgId() {
|
|
422
|
+
return this.originalMsgId;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
getPayload() {
|
|
426
|
+
return this.payload;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
getPriority() {
|
|
430
|
+
return this.priority;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
getState() {
|
|
434
|
+
return this.state;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
setCorrelation(value) {
|
|
438
|
+
this.correlation = value;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
setDelay(value) {
|
|
442
|
+
this.delay = value;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
setExceptionQueue(value) {
|
|
446
|
+
this.exceptionq = value;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
setExpiration(value) {
|
|
450
|
+
this.expiration = value;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
setPayloadBytes(value) {
|
|
454
|
+
this.payload = value;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
setPayloadObject(value) {
|
|
458
|
+
this.payload = value;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
setPayloadJson(value) {
|
|
462
|
+
this.payload = value;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
setPriority(value) {
|
|
466
|
+
this.priority = value;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
setRecipients(value) {
|
|
470
|
+
this.recipients = value;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
module.exports = { ThinQueueImpl };
|