oracledb 6.8.0 → 6.10.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 (85) hide show
  1. package/README.md +39 -3
  2. package/build/Release/oracledb-6.10.0-darwin-arm64.node +0 -0
  3. package/build/Release/oracledb-6.10.0-darwin-arm64.node-buildinfo.txt +1 -0
  4. package/build/Release/oracledb-6.10.0-darwin-x64.node +0 -0
  5. package/build/Release/oracledb-6.10.0-darwin-x64.node-buildinfo.txt +1 -0
  6. package/build/Release/oracledb-6.10.0-js-buildinfo.txt +1 -0
  7. package/build/Release/oracledb-6.10.0-linux-arm64.node +0 -0
  8. package/build/Release/oracledb-6.10.0-linux-arm64.node-buildinfo.txt +1 -0
  9. package/build/Release/oracledb-6.10.0-linux-x64.node +0 -0
  10. package/build/Release/oracledb-6.10.0-linux-x64.node-buildinfo.txt +1 -0
  11. package/build/Release/oracledb-6.10.0-win32-x64.node +0 -0
  12. package/build/Release/oracledb-6.10.0-win32-x64.node-buildinfo.txt +1 -0
  13. package/lib/aqDeqOptions.js +18 -1
  14. package/lib/aqMessage.js +10 -1
  15. package/lib/aqQueue.js +10 -6
  16. package/lib/configProviders/file.js +72 -0
  17. package/lib/connection.js +93 -4
  18. package/lib/dbObject.js +34 -4
  19. package/lib/errors.js +70 -35
  20. package/lib/impl/aqDeqOptions.js +10 -1
  21. package/lib/impl/connection.js +9 -0
  22. package/lib/impl/datahandlers/buffer.js +49 -0
  23. package/lib/impl/datahandlers/oson.js +7 -2
  24. package/lib/impl/pool.js +10 -1
  25. package/lib/impl/resultset.js +5 -4
  26. package/lib/impl/sodaDocument.js +5 -14
  27. package/lib/lob.js +9 -1
  28. package/lib/oracledb.js +152 -30
  29. package/lib/pool.js +199 -147
  30. package/lib/poolStatistics.js +4 -2
  31. package/lib/sodaCollection.js +12 -8
  32. package/lib/sodaDatabase.js +35 -8
  33. package/lib/sodaDocument.js +24 -6
  34. package/lib/sodaOperation.js +7 -6
  35. package/lib/thin/aq.js +475 -0
  36. package/lib/thin/connection.js +171 -14
  37. package/lib/thin/dbObject.js +8 -6
  38. package/lib/thin/lob.js +2 -3
  39. package/lib/thin/pool.js +105 -28
  40. package/lib/thin/protocol/capabilities.js +10 -4
  41. package/lib/thin/protocol/constants.js +90 -1
  42. package/lib/thin/protocol/encryptDecrypt.js +2 -2
  43. package/lib/thin/protocol/messages/aqArray.js +238 -0
  44. package/lib/thin/protocol/messages/aqBase.js +305 -0
  45. package/lib/thin/protocol/messages/aqDeq.js +164 -0
  46. package/lib/thin/protocol/messages/aqEnq.js +135 -0
  47. package/lib/thin/protocol/messages/auth.js +25 -27
  48. package/lib/thin/protocol/messages/base.js +98 -9
  49. package/lib/thin/protocol/messages/dataType.js +2 -1
  50. package/lib/thin/protocol/messages/execute.js +46 -4
  51. package/lib/thin/protocol/messages/lobOp.js +5 -22
  52. package/lib/thin/protocol/messages/logOff.js +0 -1
  53. package/lib/thin/protocol/messages/sessionRelease.js +0 -1
  54. package/lib/thin/protocol/messages/transactionSwitch.js +12 -4
  55. package/lib/thin/protocol/messages/withData.js +3 -3
  56. package/lib/thin/protocol/packet.js +6 -5
  57. package/lib/thin/protocol/protocol.js +2 -1
  58. package/lib/thin/sqlnet/connStrategy.js +2 -1
  59. package/lib/thin/sqlnet/navNodes.js +1 -1
  60. package/lib/thin/sqlnet/networkSession.js +10 -4
  61. package/lib/thin/sqlnet/packet.js +2 -1
  62. package/lib/thin/sqlnet/sessionAtts.js +2 -3
  63. package/lib/types.js +6 -11
  64. package/lib/util.js +72 -11
  65. package/lib/version.js +1 -1
  66. package/package/install.js +3 -3
  67. package/package/prunebinaries.js +6 -12
  68. package/package.json +2 -2
  69. package/{lib/configProviders/azure.js → plugins/configProviders/azure/index.js} +73 -63
  70. package/plugins/configProviders/azurevault/index.js +84 -0
  71. package/{lib → plugins}/configProviders/base.js +13 -3
  72. package/{lib/configProviders/ociobject.js → plugins/configProviders/ociobject/index.js} +43 -78
  73. package/plugins/configProviders/ocivault/index.js +100 -0
  74. package/plugins/token/extensionOci/index.js +71 -35
  75. package/build/Release/oracledb-6.8.0-darwin-arm64.node +0 -0
  76. package/build/Release/oracledb-6.8.0-darwin-arm64.node-buildinfo.txt +0 -1
  77. package/build/Release/oracledb-6.8.0-darwin-x64.node +0 -0
  78. package/build/Release/oracledb-6.8.0-darwin-x64.node-buildinfo.txt +0 -1
  79. package/build/Release/oracledb-6.8.0-js-buildinfo.txt +0 -1
  80. package/build/Release/oracledb-6.8.0-linux-arm64.node +0 -0
  81. package/build/Release/oracledb-6.8.0-linux-arm64.node-buildinfo.txt +0 -1
  82. package/build/Release/oracledb-6.8.0-linux-x64.node +0 -0
  83. package/build/Release/oracledb-6.8.0-linux-x64.node-buildinfo.txt +0 -1
  84. package/build/Release/oracledb-6.8.0-win32-x64.node +0 -0
  85. package/build/Release/oracledb-6.8.0-win32-x64.node-buildinfo.txt +0 -1
@@ -1,4 +1,4 @@
1
- // Copyright (c) 2022, 2024, Oracle and/or its affiliates.
1
+ // Copyright (c) 2022, 2025, Oracle and/or its affiliates.
2
2
 
3
3
  //-----------------------------------------------------------------------------
4
4
  //
@@ -405,6 +405,7 @@ module.exports = {
405
405
  TNS_DATA_TYPE_UD21: 639,
406
406
  TNS_DATA_TYPE_TNP: 640,
407
407
  TNS_DATA_TYPE_OAC: 646,
408
+ TNS_DATA_TYPE_SESSSIGN: 647,
408
409
  TNS_DATA_TYPE_OER: 652,
409
410
  TNS_DATA_TYPE_UDS: 663,
410
411
 
@@ -439,6 +440,7 @@ module.exports = {
439
440
  // parameter keyword numbers,
440
441
  TNS_KEYWORD_NUM_CURRENT_SCHEMA: 168,
441
442
  TNS_KEYWORD_NUM_EDITION: 172,
443
+ TNS_KEYWORD_NUM_TRANSACTION_ID: 201,
442
444
 
443
445
  // bind flags
444
446
  TNS_BIND_USE_INDICATORS: 0x0001,
@@ -476,6 +478,7 @@ module.exports = {
476
478
  TNS_SERVER_PIGGYBACK_LTXID: 7,
477
479
  TNS_SERVER_PIGGYBACK_AC_REPLAY_CONTEXT: 8,
478
480
  TNS_SERVER_PIGGYBACK_EXT_SYNC: 9,
481
+ TNS_SERVER_PIGGYBACK_SESS_SIGNATURE: 10,
479
482
 
480
483
  // session return constants
481
484
  TNS_SESSGET_SESSION_CHANGED: 4,
@@ -556,6 +559,9 @@ module.exports = {
556
559
  TNS_FUNC_CANCEL_ALL: 120, // piggyback fn
557
560
  TNS_FUNC_TPC_TXN_SWITCH: 103,
558
561
  TNS_FUNC_TPC_TXN_CHANGE_STATE: 104,
562
+ TNS_FUNC_AQ_ENQ: 121,
563
+ TNS_FUNC_AQ_DEQ: 122,
564
+ TNS_FUNC_ARRAY_AQ: 145,
559
565
 
560
566
  // character sets and encodings
561
567
  TNS_CHARSET_UTF8: 873,
@@ -571,6 +577,7 @@ module.exports = {
571
577
  TNS_CCAP_CTB_FEATURE_BACKPORT: 5,
572
578
  TNS_CCAP_FIELD_VERSION: 7,
573
579
  TNS_CCAP_SERVER_DEFINE_CONV: 8,
580
+ TNS_CCAP_DEQUEUE_WITH_SELECTOR: 9,
574
581
  TNS_CCAP_TTC1: 15,
575
582
  TNS_CCAP_OCI1: 16,
576
583
  TNS_CCAP_TDS_VERSION: 17,
@@ -582,7 +589,9 @@ module.exports = {
582
589
  TNS_CCAP_UB2_DTY: 27,
583
590
  TNS_CCAP_OCI2: 31,
584
591
  TNS_CCAP_CLIENT_FN: 34,
592
+ TNS_CCAP_OCI3: 35,
585
593
  TNS_CCAP_TTC3: 37,
594
+ TNS_CCAP_SESS_SIGNATURE_VERSION: 39,
586
595
  TNS_CCAP_TTC4: 40,
587
596
  TNS_CCAP_LOB2: 42,
588
597
  TNS_CCAP_TTC5: 44,
@@ -625,6 +634,7 @@ module.exports = {
625
634
  TNS_CCAP_RPC_VERSION_MAX: 7,
626
635
  TNS_CCAP_RPC_SIG_VALUE: 3,
627
636
  TNS_CCAP_DBF_VERSION_MAX: 1,
637
+ TNS_CCAP_LTXID: 0x08,
628
638
  TNS_CCAP_IMPLICIT_RESULTS: 0x10,
629
639
  TNS_CCAP_BIG_CHUNK_CLR: 0x20,
630
640
  TNS_CCAP_KEEP_OUT_ORDER: 0x80,
@@ -642,9 +652,12 @@ module.exports = {
642
652
  TNS_CCAP_LOB2_QUASI: 0x01,
643
653
  TNS_CCAP_LOB2_2GB_PREFETCH: 0x04,
644
654
  TNS_CCAP_CTB_IMPLICIT_POOL: 0x08,
655
+ TNS_CCAP_CTB_OAUTH_MSG_ON_ERR: 0x10,
645
656
  TNS_CCAP_VECTOR_SUPPORT: 0x08,
646
657
  TNS_CCAP_VECTOR_FEATURE_BINARY: 0x01,
647
658
  TNS_CCAP_VECTOR_FEATURE_SPARSE: 0x02,
659
+ TNS_CCAP_TTC5_SESSIONLESS_TXNS: 0x20,
660
+ TNS_CCAP_OCI3_OCSSYNC: 0x20,
648
661
 
649
662
  // runtime capability indices
650
663
  TNS_RCAP_COMPAT: 0,
@@ -674,6 +687,7 @@ module.exports = {
674
687
  // transaction switching op codes
675
688
  TNS_TPC_TXN_START: 0x01,
676
689
  TNS_TPC_TXN_DETACH: 0x02,
690
+ TNS_TPC_TXN_POST_DETACH: 0x04,
677
691
 
678
692
  // transaction change state op codes
679
693
  TNS_TPC_TXN_COMMIT: 0x01,
@@ -689,6 +703,80 @@ module.exports = {
689
703
  TNS_TPC_TXN_STATE_READ_ONLY: 4,
690
704
  TNS_TPC_TXN_STATE_FORGOTTEN: 5,
691
705
 
706
+ // sessionless transaction flag
707
+ TNS_TPC_TRANS_SESSIONLESS: 0x00000010,
708
+
709
+ // sessionless transaction format
710
+ TNS_TPC_TRANS_SESSIONLESS_FORMAT: 0x4e5c3e,
711
+
712
+ // sessionless sync version
713
+ TNS_TPC_TRANS_TRANSACTION_ID_SYNC_VERSION_1: 0x01,
714
+
715
+ // sessionless server states
716
+ TNS_TPC_TRANS_TRANSACTION_ID_SYNC_SET: 0x40,
717
+ TNS_TPC_TRANS_TRANSACTION_ID_SYNC_UNSET: 0x80,
718
+
719
+ // sessionless state reason
720
+ TNS_TPC_TRANS_TRANSACTION_ID_SYNC_SERVER: 0x01,
721
+ TNS_TPC_TRANS_TRANSACTION_ID_SYNC_CLIENT: 0x02,
722
+ TNS_TPC_TRANS_TRANSACTION_ID_SYNC_TXEND_XA: 0x03,
723
+
724
+ // AQ Delivery modes
725
+ TNS_AQ_MSG_PERSISTENT: constants.AQ_MSG_DELIV_MODE_PERSISTENT,
726
+ TNS_AQ_MSG_BUFFERED: constants.AQ_MSG_DELIV_MODE_BUFFERED,
727
+ TNS_AQ_MSG_PERSISTENT_OR_BUFFERED: constants.AQ_MSG_DELIV_MODE_PERSISTENT_OR_BUFFERED,
728
+
729
+ // AQ dequeue modes
730
+ TNS_AQ_DEQ_BROWSE: 1,
731
+ TNS_AQ_DEQ_LOCKED: 2,
732
+ TNS_AQ_DEQ_REMOVE: 3,
733
+ TNS_AQ_DEQ_REMOVE_NODATA: 4,
734
+
735
+ // AQ dequeue navigation modes
736
+ TNS_AQ_DEQ_FIRST_MSG: 1,
737
+ TNS_AQ_DEQ_NEXT_MSG: 3,
738
+ TNS_AQ_DEQ_NEXT_TRANSACTION: 2,
739
+
740
+ // AQ dequeue visibility modes
741
+ TNS_AQ_DEQ_IMMEDIATE: 1,
742
+ TNS_AQ_DEQ_ON_COMMIT: 2,
743
+
744
+ // AQ dequeue wait modes
745
+ TNS_AQ_DEQ_NO_WAIT: 0,
746
+ TNS_AQ_DEQ_WAIT_FOREVER: 0xFFFFFFFF,
747
+
748
+ // AQ enqueue visibility modes
749
+ TNS_AQ_ENQ_IMMEDIATE: 1,
750
+ TNS_AQ_ENQ_ON_COMMIT: 2,
751
+
752
+ // AQ message states
753
+ TNS_AQ_MSG_EXPIRED: 3,
754
+ TNS_AQ_MSG_PROCESSED: 2,
755
+ TNS_AQ_MSG_READY: 0,
756
+ TNS_AQ_MSG_WAITING: 1,
757
+
758
+ // AQ other constants
759
+ TNS_AQ_MSG_NO_DELAY: 0,
760
+ TNS_AQ_MSG_NO_EXPIRATION: -1,
761
+ TNS_AQ_ARRAY_ENQ: 0x01,
762
+ TNS_AQ_ARRAY_DEQ: 0x02,
763
+ TNS_AQ_ARRAY_FLAGS_RETURN_MESSAGE_ID: 0x01,
764
+ TNS_TTC_ENQ_STREAMING_ENABLED: 0x00000001,
765
+ TNS_TTC_ENQ_STREAMING_DISABLED: 0x00000000,
766
+
767
+ // AQ flags
768
+ TNS_KPD_AQ_BUFMSG: 0x02,
769
+ TNS_KPD_AQ_EITHER: 0x10,
770
+
771
+ TNS_AQ_MESSAGE_ID_LENGTH: 16,
772
+ TNS_AQ_MESSAGE_VERSION: 1,
773
+
774
+ TNS_AQ_EXT_KEYWORD_AGENT_NAME: 64,
775
+ TNS_AQ_EXT_KEYWORD_AGENT_ADDRESS: 65,
776
+ TNS_AQ_EXT_KEYWORD_AGENT_PROTOCOL: 66,
777
+ TNS_AQ_EXT_KEYWORD_ORIGINAL_MSGID: 69,
778
+
779
+
692
780
  // other constants
693
781
  TNS_ESCAPE_CHAR: 253,
694
782
  TNS_LONG_LENGTH_INDICATOR: dataHandlerConstants.TNS_LONG_LENGTH_INDICATOR,
@@ -760,6 +848,7 @@ module.exports = {
760
848
  TNS_ERR_INVALID_SID: 12505,
761
849
  TNS_ERR_NO_DATA_FOUND: 1403,
762
850
  TNS_ERR_SESSION_SHUTDOWN: 12572,
851
+ TNS_ERR_NO_MESSAGES_FOUND: 25228,
763
852
 
764
853
  // warnings
765
854
  TNS_WARN_COMPILATION_CREATE: 0x20,
@@ -40,7 +40,7 @@ class EncryptDecrypt {
40
40
 
41
41
  // Key length is dependent on the algorithm. In this case for aes192, it is
42
42
  // 24 bytes (192 bits).
43
- _decrypt(key, val) {
43
+ decrypt(key, val) {
44
44
  const iv = Buffer.alloc(16, 0); // Initialization vector, same is used in server
45
45
  const decipher = crypto.createDecipheriv(algorithm, key, iv);
46
46
  decipher.setAutoPadding(false);
@@ -138,7 +138,7 @@ class EncryptDecrypt {
138
138
  if (newPassword) {
139
139
  newPasswordBytes = Buffer.from(newPassword, 'utf8');
140
140
  }
141
- const sessionKeyParta = this._decrypt(passwordHash, encodedServerKey);
141
+ const sessionKeyParta = this.decrypt(passwordHash, encodedServerKey);
142
142
  const sessionKeyPartb = Buffer.alloc(sessionKeyParta.length);
143
143
  crypto.randomFillSync(sessionKeyPartb);
144
144
  const encodedClientKey = this._encrypt(passwordHash, sessionKeyPartb);
@@ -0,0 +1,238 @@
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
+ //-----------------------------------------------------------------------------
28
+ // aqArray.js
29
+ //
30
+ // This file defines the messages that are sent to the database and the
31
+ // responses that are received by the client for enqueuing and dequeuing
32
+ // an array of AQ messages.
33
+ //-----------------------------------------------------------------------------
34
+
35
+ 'use strict';
36
+
37
+ const AqBaseMessage = require("./aqBase.js");
38
+ const constants = require("../constants.js");
39
+ const errors = require("../../../errors.js");
40
+
41
+ class AqArrayMessage extends AqBaseMessage {
42
+
43
+ constructor(connImpl) {
44
+ super(connImpl);
45
+ this.functionCode = constants.TNS_FUNC_ARRAY_AQ;
46
+ this.numIters = 0;
47
+ this.propsImpls = [];
48
+ this.noMsgFound = false;
49
+ }
50
+
51
+ //--------------------------------------------------------------------------
52
+ // processReturnParameter()
53
+ //
54
+ // Process the return parameters of the AQ array enqueue/dequeue request.
55
+ // We recieve all the msg details in deq and in case of enq the msgIds.
56
+ //--------------------------------------------------------------------------
57
+ processReturnParameter(buf) {
58
+ const numIters = buf.readUB4();
59
+ for (let i = 0; i < numIters; i++) {
60
+ const propsImpl = this.propsImpls[i];
61
+ let temp16 = buf.readUB2();
62
+ if (temp16 > 0) {
63
+ buf.skipUB1();
64
+ this._processMsgProps(buf, propsImpl);
65
+ }
66
+ propsImpl.recipients = this._processRecipients(buf);
67
+ temp16 = buf.readUB2();
68
+ if (temp16 > 0) {
69
+ propsImpl.payload = this._processPayload(buf);
70
+ }
71
+ const msgId = buf.readBytesAndLength();// msgIds array
72
+ if (this.operation === constants.TNS_AQ_ARRAY_ENQ) {
73
+ for (let j = 0; j < this.propsImpls.length; j++) {
74
+ this.propsImpls[j].msgId = Buffer.from(msgId.slice(j * 16, (j + 1) * 16));
75
+ }
76
+ } else {
77
+ propsImpl.msgId = Buffer.from(msgId);
78
+ }
79
+ temp16 = buf.readUB2(); // extensions len
80
+ if (temp16 > 0) {
81
+ errors.throwErr(errors.ERR_NOT_IMPLEMENTED);
82
+ }
83
+ buf.skipUB2(); // output ack
84
+ }
85
+ if (this.operation === constants.TNS_AQ_ARRAY_ENQ) {
86
+ this.numIters = buf.readUB4();
87
+ } else {
88
+ this.numIters = numIters;
89
+ }
90
+ }
91
+
92
+ //--------------------------------------------------------------------------
93
+ // _writeArrayDeq()
94
+ //
95
+ // Writes to the buffer the fields specific to the array dequeue of AQ
96
+ // messages.
97
+ //--------------------------------------------------------------------------
98
+ _writeArrayDeq(buf) {
99
+ let consumerNameBytes = null;
100
+ let correlationBytes = null;
101
+ let conditionBytes = null;
102
+ const queueNameBytes = Buffer.from(this.queueImpl.name);
103
+ const deliveryMode = this.deqOptionsImpl.deliveryMode;
104
+ let flags = 0;
105
+
106
+ if (deliveryMode === constants.TNS_AQ_MSG_BUFFERED) {
107
+ flags |= constants.TNS_KPD_AQ_BUFMSG;
108
+ } else if (deliveryMode === constants.TNS_AQ_MSG_PERSISTENT_OR_BUFFERED) {
109
+ flags |= constants.TNS_KPD_AQ_EITHER;
110
+ }
111
+
112
+ if (this.deqOptionsImpl.consumerName) {
113
+ consumerNameBytes = Buffer.from(this.deqOptionsImpl.consumerName, 'utf-8');
114
+ }
115
+ if (this.deqOptionsImpl.condition) {
116
+ conditionBytes = Buffer.from(this.deqOptionsImpl.condition, 'utf-8');
117
+ }
118
+ if (this.deqOptionsImpl.correlation) {
119
+ correlationBytes = Buffer.from(this.deqOptionsImpl.correlation, 'utf-8');
120
+ }
121
+
122
+ for (const propsImpl of this.propsImpls) {
123
+ buf.writeUB4(queueNameBytes.length);
124
+ buf.writeBytesWithLength(queueNameBytes);
125
+ this._writeMsgProps(buf, propsImpl);
126
+ buf.writeUB4(0); // num recipients
127
+ this._writeValueWithLength(buf, consumerNameBytes);
128
+ buf.writeSB4(this.deqOptionsImpl.mode);
129
+ buf.writeSB4(this.deqOptionsImpl.navigation);
130
+ buf.writeSB4(this.deqOptionsImpl.visibility);
131
+ buf.writeSB4(this.deqOptionsImpl.wait);
132
+ this._writeValueWithLength(buf, this.deqOptionsImpl.msgid);
133
+ this._writeValueWithLength(buf, correlationBytes);
134
+ this._writeValueWithLength(buf, conditionBytes);
135
+ buf.writeUB4(0); // extensions
136
+ buf.writeUB4(0); // rel msg id
137
+ buf.writeSB4(0); // seq deviation
138
+ buf.writeUB4(16); // toid length
139
+ buf.writeBytesWithLength(this.queueImpl.payloadToid);
140
+ buf.writeUB2(constants.TNS_AQ_MESSAGE_VERSION);
141
+ buf.writeUB4(0); // payload length
142
+ buf.writeUB4(0); // raw pay length
143
+ buf.writeUB4(0);
144
+ buf.writeUB4(flags); // deliveryMode flag
145
+ buf.writeUB4(0); // extensions len
146
+ buf.writeUB4(0); // source seq len
147
+ }
148
+ }
149
+
150
+ //--------------------------------------------------------------------------
151
+ // _writeArrayEnq()
152
+ //
153
+ // Writes input parameters in case of array enqueue.
154
+ //--------------------------------------------------------------------------
155
+ _writeArrayEnq(buf) {
156
+ const queueNameBytes = Buffer.from(this.queueImpl.name);
157
+ const deliveryMode = this.enqOptionsImpl.deliveryMode;
158
+ let flags = 0;
159
+
160
+ if (deliveryMode === constants.TNS_AQ_MSG_BUFFERED) {
161
+ flags |= constants.TNS_KPD_AQ_BUFMSG;
162
+ } else if (deliveryMode === constants.TNS_AQ_MSG_PERSISTENT_OR_BUFFERED) {
163
+ flags |= constants.TNS_KPD_AQ_EITHER;
164
+ }
165
+
166
+ buf.writeUB4(0); // rel msgid len
167
+ buf.writeUInt8(constants.TNS_MSG_TYPE_ROW_HEADER);
168
+ buf.writeUB4(queueNameBytes.length);
169
+ buf.writeBytesWithLength(queueNameBytes);
170
+ buf.writeBytes(this.queueImpl.payloadToid);
171
+ buf.writeUB2(constants.TNS_AQ_MESSAGE_VERSION);
172
+ buf.writeUB4(flags);
173
+
174
+ for (const propsImpl of this.propsImpls) {
175
+ buf.writeUInt8(constants.TNS_MSG_TYPE_ROW_DATA);
176
+ buf.writeUB4(flags); // aqi flags
177
+ this._writeMsgProps(buf, propsImpl);
178
+ if (propsImpl.recipients === null || propsImpl.recipients.length === 0) {
179
+ buf.writeUB4(0); // num recipients
180
+ } else {
181
+ buf.writeUB4(3 * propsImpl.recipients.length);
182
+ this._writeRecipients(buf, propsImpl);
183
+ }
184
+ buf.writeSB4(this.enqOptionsImpl.visibility);
185
+ buf.writeUB4(0); // relative msg id
186
+ buf.writeSB4(0); // seq deviation
187
+ if (!this.queueImpl.payloadTypeClass && !this.queueImpl.isJson) {
188
+ buf.writeUB4(propsImpl.payload.length);
189
+ }
190
+ this._writePayload(buf, propsImpl);
191
+ }
192
+ buf.writeUInt8(constants.TNS_MSG_TYPE_STATUS);
193
+ }
194
+
195
+ //--------------------------------------------------------------------------
196
+ // _writeMessageBody()
197
+ //
198
+ // Writes the body of the message to the buffer.
199
+ //--------------------------------------------------------------------------
200
+ encode(buf) {
201
+ this.writeFunctionHeader(buf);
202
+ if (this.operation === constants.TNS_AQ_ARRAY_ENQ) {
203
+ buf.writeUInt8(0); // input params
204
+ buf.writeUB4(0); // length
205
+ } else {
206
+ buf.writeUInt8(1);
207
+ buf.writeUB4(this.numIters);
208
+ }
209
+ buf.writeUB4(constants.TNS_AQ_ARRAY_FLAGS_RETURN_MESSAGE_ID);
210
+ if (this.operation === constants.TNS_AQ_ARRAY_ENQ) {
211
+ buf.writeUInt8(1); // output params
212
+ buf.writeUInt8(0); // length
213
+ } else {
214
+ buf.writeUInt8(1);
215
+ buf.writeUInt8(1);
216
+ }
217
+ buf.writeSB4(this.operation);
218
+ if (this.operation === constants.TNS_AQ_ARRAY_ENQ) {
219
+ buf.writeUInt8(1); // num iters (pointer)
220
+ } else {
221
+ buf.writeUInt8(0);
222
+ }
223
+ if (buf.caps.ttcFieldVersion >= constants.TNS_CCAP_FIELD_VERSION_21_1) {
224
+ buf.writeUB4(0xffff); // shard id
225
+ }
226
+ if (this.operation === constants.TNS_AQ_ARRAY_ENQ) {
227
+ buf.writeUB4(this.numIters);
228
+ }
229
+ if (this.operation === constants.TNS_AQ_ARRAY_ENQ) {
230
+ this._writeArrayEnq(buf);
231
+ } else {
232
+ this._writeArrayDeq(buf);
233
+ }
234
+ }
235
+
236
+ }
237
+
238
+ module.exports = AqArrayMessage;