solclientjs
Version:
Solace Messaging API for Node.js
930 lines (929 loc) • 2.36 MB
JavaScript
/*! For license information please see solclient-debug.js.LICENSE.txt */
(function webpackUniversalModuleDefinition(root, factory) {
if (typeof exports === "object" && typeof module === "object") module.exports = factory(); else if (typeof define === "function" && define.amd) define("solace", [], factory); else if (typeof exports === "object") exports["solace"] = factory(); else root["solace"] = factory();
})(this, () => {
/******/
return (() => {
// webpackBootstrap
/******/ var __webpack_modules__ = {
/***/ "./index.js":
/*!******************!*\
!*** ./index.js ***!
\******************/
/***/ (module, __unused_webpack_exports, __webpack_require__) => {
// Node entry point
//global.BUILD_ENV = require('./define.config.js');
module.exports = __webpack_require__(/*! solclient-core */ "./modules/solclient-core/api.js");
/***/
},
/***/ "./modules/solclient-convert/api.js":
/*!******************************************!*\
!*** ./modules/solclient-convert/api.js ***!
\******************************************/
/***/ (module, __unused_webpack_exports, __webpack_require__) => {
const {
Base64
} = __webpack_require__(/*! ./lib/base64 */ "./modules/solclient-convert/lib/base64.js");
const {
Bits
} = __webpack_require__(/*! ./lib/bits */ "./modules/solclient-convert/lib/bits.js");
const {
Convert
} = __webpack_require__(/*! ./lib/convert */ "./modules/solclient-convert/lib/convert.js");
const {
Hex
} = __webpack_require__(/*! ./lib/hex */ "./modules/solclient-convert/lib/hex.js");
const {
Long
} = __webpack_require__(/*! ./lib/long */ "./modules/solclient-convert/lib/long.js");
module.exports.Base64 = Base64;
module.exports.Bits = Bits;
module.exports.Convert = Convert;
module.exports.Hex = Hex;
module.exports.Long = Long;
/***/
},
/***/ "./modules/solclient-convert/lib/base64.js":
/*!*************************************************!*\
!*** ./modules/solclient-convert/lib/base64.js ***!
\*************************************************/
/***/ (module, __unused_webpack_exports, __webpack_require__) => {
/* provided dependency */ var Buffer = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js")["Buffer"];
// This code was written by Tyler Akins and has been placed in the
// public domain. It would be nice if you left this header intact.
// Base64 code from Tyler Akins -- http://rumkin.com
// It has been modified by me (Edward Funnekotter) to improve its
// efficiency
// It has been modified by me (Justin Bowes) to avoid using it whenever
// possible in favour of browser or buffer implementations.
const KEY_STR = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
const ENC_LUT = [ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 99, -1, -1, 99, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 99, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, 64, -1, -1,
// 64
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1,
// 128
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
// 192
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 ];
class DecodeError extends Error {}
const LegacyEncoder = {
/**
* Encodes a string in base64
* @param {String} input The string to encode in base64.
* @returns {String} base64 encoded input
* @private
*/
base64_encode(input) {
let output = "";
let i = 0;
do {
const chr1 = input.charCodeAt(i++);
const chr2 = input.charCodeAt(i++);
const chr3 = input.charCodeAt(i++);
const enc1 = chr1 >> 2;
const enc2 = (chr1 & 3) << 4 | chr2 >> 4;
let enc3 = (chr2 & 15) << 2 | chr3 >> 6;
let enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output += KEY_STR.charAt(enc1);
output += KEY_STR.charAt(enc2);
output += KEY_STR.charAt(enc3);
output += KEY_STR.charAt(enc4);
} while (i < input.length);
return output;
},
/**
* Decodes a base64 string.
* @param {String} input The base64 string to decode.
* @returns {String} binary output
* @private
*/
base64_decode(input) {
let output = "";
let i = 0;
do {
while (ENC_LUT[input.charCodeAt(i)] > 64) {
i++;
}
const enc1 = ENC_LUT[input.charCodeAt(i++)];
const enc2 = ENC_LUT[input.charCodeAt(i++)];
const enc3 = ENC_LUT[input.charCodeAt(i++)];
const enc4 = ENC_LUT[input.charCodeAt(i++)];
if (enc1 < 0 || enc2 < 0 || enc3 < 0 || enc4 < 0) {
// Invalid character in base64 text
// alert("enc at " + i + ": " + enc1 + ", " + enc2 + ", " + enc3 + ", " + enc4);
throw new DecodeError("Invalid base64 character");
}
const chr1 = enc1 << 2 | enc2 >> 4;
const chr2 = (enc2 & 15) << 4 | enc3 >> 2;
const chr3 = (enc3 & 3) << 6 | enc4;
output += String.fromCharCode(chr1);
if (enc3 !== 64) {
output += String.fromCharCode(chr2);
}
if (enc4 !== 64) {
output += String.fromCharCode(chr3);
}
} while (i < input.length - 3);
return output;
}
};
const isNode = typeof window === "undefined"; // !node
const hasBuffer = typeof Buffer !== "undefined";
const hasBlob = typeof Blob !== "undefined"; // !node, !ie9
const BufferEncoder = hasBuffer && (hasBlob || isNode) ? {
base64_encode: str => Buffer.from(str, "binary").toString("base64"),
base64_decode: str => Buffer.from(str, "base64").toString("binary")
} : {};
/* eslint-env browser */
/* eslint-disable dot-notation */
const WindowEncoder = typeof window !== "undefined" ? {
base64_encode: window["btoa"] ? b => window["btoa"](b) : null,
base64_decode: window["atob"] ? a => window["atob"](a) : null
} : {};
/* eslint-enable dot-notation */
const Base64 = {
encode: WindowEncoder.base64_encode || BufferEncoder.base64_encode || LegacyEncoder.base64_encode,
decode: WindowEncoder.base64_decode || BufferEncoder.base64_decode || LegacyEncoder.base64_decode
};
module.exports.Base64 = Base64;
/***/
},
/***/ "./modules/solclient-convert/lib/bits.js":
/*!***********************************************!*\
!*** ./modules/solclient-convert/lib/bits.js ***!
\***********************************************/
/***/ module => {
const Bits = {
get(val, shift, numBits) {
return val >>> shift & (1 << numBits) - 1;
},
set(dataIn, val, shift, numBits) {
const curMask = (1 << numBits) - 1;
const shiftedVal = (val & curMask) << shift;
const data = dataIn & ~(curMask << shift);
return data | shiftedVal;
}
};
module.exports.Bits = Bits;
/***/
},
/***/ "./modules/solclient-convert/lib/convert.js":
/*!**************************************************!*\
!*** ./modules/solclient-convert/lib/convert.js ***!
\**************************************************/
/***/ (module, __unused_webpack_exports, __webpack_require__) => {
const Long = __webpack_require__(/*! long */ "./node_modules/long/umd/index.js");
const {
ErrorSubcode,
OperationError
} = __webpack_require__(/*! solclient-error */ "./modules/solclient-error/api.js");
// eslint-disable-next-line global-require
const BufferImpl = __webpack_require__(/*! buffer */ "./node_modules/buffer/index.js").Buffer;
/**
* @module
* ===========================================================================
* Convert
*
* This collection of functions performs all required string to number and number to string
* conversions
* ============================================================================
* @private
*/
const TWO_ZEROES_STR = String.fromCharCode(0, 0);
const THREE_ZEROES_STR = String.fromCharCode(0, 0, 0);
const FOUR_ZEROES_STR = String.fromCharCode(0, 0, 0, 0);
const BYTEARRAY_CONVERT_CHUNK = 8192;
const UNSIGNED_LSHIFT_24 = 256 * 256 * 256;
const ARRAY_BUFFER_CONVERT_CHUNK = 32768;
function uint8ArrayToString(data, format = undefined) {
const dataLength = data.byteLength;
const uint8DataArray = new Uint8Array(BufferImpl.from(data));
let result = "";
for (let i = 0; i < dataLength; i++) {
if (format && format.toLowerCase() === "hex") {
result += uint8DataArray[i].toString(16).padStart(2, "0");
} else {
result += String.fromCharCode(uint8DataArray[i] & 255);
}
}
return result;
}
function stringToUint8Array(data) {
const dataLength = data.length;
const arrayBuf = new ArrayBuffer(dataLength);
const uint8Array = new Uint8Array(arrayBuf, 0, dataLength);
for (let i = 0; i < dataLength; i++) {
uint8Array[i] = data.charCodeAt(i);
}
return uint8Array;
}
function hexStringToUint8Array(data) {
// if null data, return empty Uint8Array
if (data == null) {
return new Uint8Array();
}
return Uint8Array.from(BufferImpl.from(data, "hex"));
}
function arrayBufferToString(ab) {
if (!ab) return "";
const len = ab.byteLength;
const u8 = new Uint8Array(ab);
if (len < ARRAY_BUFFER_CONVERT_CHUNK) {
return String.fromCharCode.apply(null, u8);
}
let k = 0;
let r = "";
while (k < len) {
// slice is clamped, inclusive of startIndex, exclusive of lastIndex
r += String.fromCharCode.apply(null, u8.subarray(k, k + ARRAY_BUFFER_CONVERT_CHUNK));
k += ARRAY_BUFFER_CONVERT_CHUNK;
}
return r;
}
function stringToArrayBuffer(str) {
return stringToUint8Array(str).buffer;
}
function int8ToStr(int8) {
return String.fromCharCode(int8 & 255);
}
function int16ToStr(int16) {
return String.fromCharCode(int16 >> 8 & 255) + String.fromCharCode(int16 & 255);
}
function int24ToStr(int24) {
return String.fromCharCode(int24 >> 16 & 255) + String.fromCharCode(int24 >> 8 & 255) + String.fromCharCode(int24 & 255);
}
function int32ToStr(int32) {
// It is expected that there are a lot of small numbers
// being converted, so it is worth doing a few checks for
// efficiency (on firefox it is about 3 times quicker for small numbers
// to do the check - it is 2 times quicker for chrome)
if (int32 === 0) return FOUR_ZEROES_STR;
if (int32 > 0) {
if (int32 < 256) {
return THREE_ZEROES_STR + String.fromCharCode(int32);
}
if (int32 < 65536) {
return TWO_ZEROES_STR + String.fromCharCode(int32 >> 8) + String.fromCharCode(int32 & 255);
}
}
return String.fromCharCode(int32 >> 24 & 255) + String.fromCharCode(int32 >> 16 & 255) + String.fromCharCode(int32 >> 8 & 255) + String.fromCharCode(int32 & 255);
}
function int64ToStr(int64) {
if (typeof int64 !== "number") {
return int32ToStr(int64.high) + int32ToStr(int64.low);
}
// It is expected that there are a lot of small numbers
// being converted, so it is worth doing a few checks for
// efficiency (on firefox it is about 3 times quicker for small numbers
// to do the check - it is 2 times quicker for chrome)
if (int64 >= 0) {
if (int64 < 256) {
return FOUR_ZEROES_STR + THREE_ZEROES_STR + String.fromCharCode(int64);
}
if (int64 < 65536) {
return FOUR_ZEROES_STR + TWO_ZEROES_STR + String.fromCharCode(int64 >> 8) + String.fromCharCode(int64 & 255);
}
if (int64 < 4294967296) {
return FOUR_ZEROES_STR + (String.fromCharCode(int64 >> 24 & 255) + String.fromCharCode(int64 >> 16 & 255) + String.fromCharCode(int64 >> 8 & 255) + String.fromCharCode(int64 & 255));
}
}
return String.fromCharCode(int64 >> 56 & 255) + String.fromCharCode(int64 >> 48 & 255) + String.fromCharCode(int64 >> 40 & 255) + String.fromCharCode(int64 >> 32 & 255) + String.fromCharCode(int64 >> 24 & 255) + String.fromCharCode(int64 >> 16 & 255) + String.fromCharCode(int64 >> 8 & 255) + String.fromCharCode(int64 & 255);
}
function byteArrayToStr(byteArray) {
const len = byteArray.length;
if (len < BYTEARRAY_CONVERT_CHUNK) {
return String.fromCharCode.apply(null, byteArray);
}
let k = 0;
let r = "";
while (k < len) {
// slice is clamped, inclusive of startIndex, exclusive of lastIndex
r += String.fromCharCode.apply(null, byteArray.slice(k, k + BYTEARRAY_CONVERT_CHUNK));
k += BYTEARRAY_CONVERT_CHUNK;
}
return r;
}
function strToByteArray(str) {
const result = [];
let i;
for (i = 0; i < str.length; i++) {
result[i] = str.charCodeAt(i);
}
return result;
}
function strToHexArray(str) {
function toHex(c) {
return c.charCodeAt(0).toString(16);
}
return Array.prototype.map.call(str.split(""), toHex);
}
function strToInt8(data) {
return data.charCodeAt(0) & 255;
}
function strToInt16(data) {
return (data.charCodeAt(0) << 8) + data.charCodeAt(1);
}
function strToInt24(data) {
return (data.charCodeAt(0) << 16) + (data.charCodeAt(1) << 8) + data.charCodeAt(2);
}
function strToInt32(data) {
// SIGNED integer
return (data.charCodeAt(0) << 24) + (data.charCodeAt(1) << 16) + (data.charCodeAt(2) << 8) + data.charCodeAt(3);
}
function strToUInt32(data) {
// WARNING: you cannot use a << 24 to shift a byte into
// a 32-bit string, because all shifts in JS are signed
return data.charCodeAt(0) * UNSIGNED_LSHIFT_24 + (data.charCodeAt(1) << 16) + (data.charCodeAt(2) << 8) + data.charCodeAt(3);
}
function strToUInt64(data) {
return Long.fromBits(strToUInt32(data.substr(4, 4)), strToUInt32(data.substr(0, 4)), true);
}
function ucs2ToUtf8(ucs2) {
return unescape(encodeURIComponent(ucs2));
}
function utf8ToUcs2(utf8) {
return decodeURIComponent(escape(utf8));
}
function anythingToBuffer(value) {
if (BufferImpl.isBuffer(value)) {
return value;
}
if (typeof value === "string") {
return BufferImpl.from(value, "latin1");
}
if (value instanceof ArrayBuffer) {
return BufferImpl.from(value);
}
//TypedArrays and DataView:
if (value.buffer instanceof ArrayBuffer && typeof value.byteLength === "number" && typeof value.byteOffset === "number") {
if (value.byteOffset === 0 && value.byteLength === value.buffer.byteLength) {
// "full sice", no actual offset: just use the raw buffer.
return BufferImpl.from(value.buffer);
}
return BufferImpl.from(value.buffer, value.byteOffset, value.byteLength);
}
throw new OperationError("Parameter value failed validation", ErrorSubcode.PARAMETER_OUT_OF_RANGE, "Expecting Buffer/Uint8Array, also accepting string, ArrayBuffer, any TypedArray, or DataView.");
}
const Convert = {
arrayBufferToString: arrayBufferToString,
stringToArrayBuffer: stringToArrayBuffer,
uint8ArrayToString: uint8ArrayToString,
stringToUint8Array: stringToUint8Array,
hexStringToUint8Array: hexStringToUint8Array,
int8ToStr: int8ToStr,
strToInt8: strToInt8,
int16ToStr: int16ToStr,
strToInt16: strToInt16,
int24ToStr: int24ToStr,
strToInt24: strToInt24,
int32ToStr: int32ToStr,
strToInt32: strToInt32,
strToUInt32: strToUInt32,
int64ToStr: int64ToStr,
strToUInt64: strToUInt64,
byteArrayToStr: byteArrayToStr,
strToByteArray: strToByteArray,
strToHexArray: strToHexArray,
ucs2ToUtf8: ucs2ToUtf8,
utf8ToUcs2: utf8ToUcs2,
anythingToBuffer: anythingToBuffer
};
module.exports.Convert = Convert;
/***/
},
/***/ "./modules/solclient-convert/lib/hex.js":
/*!**********************************************!*\
!*** ./modules/solclient-convert/lib/hex.js ***!
\**********************************************/
/***/ module => {
function numToHex(n) {
if (typeof n !== "number") {
return "";
}
const s = n.toString(16);
return s.length < 2 ? `0${s}` : s;
}
function formatHexString(obj) {
if (typeof obj === "number") {
return `0x${numToHex(obj)}`;
}
if (typeof obj === "object" && Array.isArray(obj)) {
return obj.map(numToHex).join();
}
if (typeof obj === "string") {
return Array.prototype.map.call(obj, (_, i) => numToHex(obj.charCodeAt(i))).join("");
}
return null;
}
const Hex = {
formatHexString: formatHexString
};
module.exports.Hex = Hex;
/***/
},
/***/ "./modules/solclient-convert/lib/long.js":
/*!***********************************************!*\
!*** ./modules/solclient-convert/lib/long.js ***!
\***********************************************/
/***/ (module, __unused_webpack_exports, __webpack_require__) => {
module.exports.Long = __webpack_require__(/*! long */ "./node_modules/long/umd/index.js");
/***/
},
/***/ "./modules/solclient-core/api-internal.js":
/*!************************************************!*\
!*** ./modules/solclient-core/api-internal.js ***!
\************************************************/
/***/ (module, __unused_webpack_exports, __webpack_require__) => {
/**
* SolclientJS internal API for white-box integration testing
* @private
*/
/* _eslint-disable sort-requires/sort-requires */
const Convert = __webpack_require__(/*! solclient-convert */ "./modules/solclient-convert/api.js");
const Debug = __webpack_require__(/*! solclient-debug */ "./modules/solclient-debug/api.js");
const Destination = __webpack_require__(/*! solclient-destination */ "./modules/solclient-destination/api.js");
const Error = __webpack_require__(/*! solclient-error */ "./modules/solclient-error/api.js");
const ESKit = __webpack_require__(/*! solclient-eskit */ "./modules/solclient-eskit/api.js");
const Factory = __webpack_require__(/*! solclient-factory */ "./modules/solclient-factory/api.js");
const FSM = __webpack_require__(/*! solclient-fsm */ "./modules/solclient-fsm/api.js");
const Log = __webpack_require__(/*! solclient-log */ "./modules/solclient-log/api.js");
const Message = __webpack_require__(/*! solclient-message */ "./modules/solclient-message/api.js");
const MessageTracing = __webpack_require__(/*! solclient-message-tracing */ "./modules/solclient-message-tracing/api.js");
const Publisher = __webpack_require__(/*! solclient-message-publisher */ "./modules/solclient-message-publisher/api.js");
const SDT = __webpack_require__(/*! solclient-sdt */ "./modules/solclient-sdt/api.js");
const Session = __webpack_require__(/*! solclient-session */ "./modules/solclient-session/api.js");
const SMF = __webpack_require__(/*! solclient-smf */ "./modules/solclient-smf/api.js");
const SolcacheSession = __webpack_require__(/*! solclient-solcache-session */ "./modules/solclient-solcache-session/api.js");
const TestEnv = __webpack_require__(/*! solclient-env */ "./modules/solclient-env/api.js");
const Transport = __webpack_require__(/*! solclient-transport */ "./modules/solclient-transport/api.js");
const Util = __webpack_require__(/*! solclient-util */ "./modules/solclient-util/api.js");
const Validate = __webpack_require__(/*! solclient-validate */ "./modules/solclient-validate/api.js");
module.exports = {
Convert: Convert,
Debug: Debug,
Destination: Destination,
Error: Error,
ESKit: ESKit,
Factory: Factory,
FSM: FSM,
Log: Log,
Message: Message,
MessageTracing: MessageTracing,
Publisher: Publisher,
SDT: SDT,
Session: Session,
SMF: SMF,
SolcacheSession: SolcacheSession,
TestEnv: TestEnv,
Transport: Transport,
Util: Util,
Validate: Validate
};
/***/
},
/***/ "./modules/solclient-core/api.js":
/*!***************************************!*\
!*** ./modules/solclient-core/api.js ***!
\***************************************/
/***/ (module, __unused_webpack_exports, __webpack_require__) => {
/**
* <h1> Overview </h1>
*
* This is the Solace Corporation Messaging API for JavaScript. Concepts defined in this API are
* similar to those defined in other Solace Messaging APIs for Java, C, and .NET.
*
* <h1> Concepts </h1>
*
* Some general concepts:
*
* <li> All function calls are non-blocking; confirmation, if requested, is returned to the calling
* client application in the form of callbacks. </li>
*
*/
/* _eslint-disable sort-requires/sort-requires */
// -------------------------- Solclient Factory ------------------------------
// Load me before the rest of the API as a plug-in point for modules
const FactoryLib = __webpack_require__(/*! solclient-factory */ "./modules/solclient-factory/api.js");
// ---------------------------------------------------------------------------
const {
SolclientFactory,
SolclientFactoryProfiles,
SolclientFactoryProperties
} = FactoryLib;
const {
Long
} = __webpack_require__(/*! solclient-convert */ "./modules/solclient-convert/api.js");
const {
Destination,
DestinationType,
Topic
} = __webpack_require__(/*! solclient-destination */ "./modules/solclient-destination/api.js");
const {
ErrorSubcode,
NotImplementedError,
OperationError,
RequestError,
RequestEventCode
} = __webpack_require__(/*! solclient-error */ "./modules/solclient-error/api.js");
const {
makeIterator
} = __webpack_require__(/*! solclient-eskit */ "./modules/solclient-eskit/api.js");
const {
ConsoleLogImpl,
LogImpl,
LogLevel
} = __webpack_require__(/*! solclient-log */ "./modules/solclient-log/api.js");
const {
Message,
MessageCacheStatus,
MessageDeliveryModeType,
MessageDumpFlag,
MessageOutcome,
MessageType,
MessageUserCosType,
ReplicationGroupMessageId
} = __webpack_require__(/*! solclient-message */ "./modules/solclient-message/api.js");
const {
MessageConsumer,
MessageConsumerAcknowledgeMode,
MessageConsumerEventName,
MessageConsumerProperties,
QueueBrowser,
QueueBrowserEventName,
QueueBrowserProperties
} = __webpack_require__(/*! solclient-message-consumer */ "./modules/solclient-message-consumer/api.js");
const {
ReplayStartLocation,
ReplayStartLocationBeginning
} = __webpack_require__(/*! solclient-replaystart */ "./modules/solclient-replaystart/api.js");
const {
MessagePublisherAcknowledgeMode,
MessagePublisherProperties
} = __webpack_require__(/*! solclient-message-publisher */ "./modules/solclient-message-publisher/api.js");
const {
Baggage,
TraceContext,
TraceContextSetter
} = __webpack_require__(/*! solclient-message-tracing */ "./modules/solclient-message-tracing/api.js");
const {
AbstractQueueDescriptor,
QueueAccessType,
QueueDescriptor,
QueueDiscardBehavior,
QueuePermissions,
QueueProperties,
QueueType,
EndpointNameComplaint
} = __webpack_require__(/*! solclient-queue */ "./modules/solclient-queue/api.js");
const {
SDTField,
SDTFieldType,
SDTMapContainer,
SDTStreamContainer,
SDTUnsupportedValueError,
SDTValueErrorSubcode
} = __webpack_require__(/*! solclient-sdt */ "./modules/solclient-sdt/api.js");
const {
AuthenticationScheme,
CapabilityType,
MessageRxCBInfo,
MutableSessionProperty,
Session,
SessionEvent,
SessionEventCBInfo,
SessionEventCode,
SessionProperties,
SessionState,
SslDowngrade
} = __webpack_require__(/*! solclient-session */ "./modules/solclient-session/api.js");
const {
CacheCBInfo,
CacheLiveDataAction,
CacheRequestResult,
CacheReturnCode,
CacheReturnSubcode,
CacheSession,
CacheSessionProperties
} = __webpack_require__(/*! solclient-solcache-session */ "./modules/solclient-solcache-session/api.js");
const {
StatType
} = __webpack_require__(/*! solclient-stats */ "./modules/solclient-stats/api.js");
const {
TransportError,
TransportProtocol
} = __webpack_require__(/*! solclient-transport */ "./modules/solclient-transport/api.js");
const {
Version
} = __webpack_require__(/*! solclient-util */ "./modules/solclient-util/api.js");
// --------------------------- Internal API -- do not use --------------------
// Load me last. I disappear in production mode
const _internal = __webpack_require__(/*! ./api-internal.js */ "./modules/solclient-core/api-internal.js");
// ---------------------------------------------------------------------------
/**
* @namespace
* @public
*/
const solace = {
AbstractQueueDescriptor: AbstractQueueDescriptor,
AuthenticationScheme: AuthenticationScheme,
Baggage: Baggage,
CacheCBInfo: CacheCBInfo,
CacheLiveDataAction: CacheLiveDataAction,
CacheRequestResult: CacheRequestResult,
CacheReturnCode: CacheReturnCode,
CacheReturnSubcode: CacheReturnSubcode,
CacheSession: CacheSession,
CacheSessionProperties: CacheSessionProperties,
CapabilityType: CapabilityType,
ConsoleLogImpl: ConsoleLogImpl,
Destination: Destination,
DestinationType: DestinationType,
ErrorSubcode: ErrorSubcode,
LogImpl: LogImpl,
LogLevel: LogLevel,
Long: Long,
Message: Message,
MessageCacheStatus: MessageCacheStatus,
MessageConsumer: MessageConsumer,
MessageConsumerAcknowledgeMode: MessageConsumerAcknowledgeMode,
MessageConsumerEventName: MessageConsumerEventName,
MessageConsumerProperties: MessageConsumerProperties,
MessageDeliveryModeType: MessageDeliveryModeType,
MessageDumpFlag: MessageDumpFlag,
MessageOutcome: MessageOutcome,
MessagePublisherAcknowledgeMode: MessagePublisherAcknowledgeMode,
MessagePublisherProperties: MessagePublisherProperties,
MessageRxCBInfo: MessageRxCBInfo,
MessageType: MessageType,
MessageUserCosType: MessageUserCosType,
MutableSessionProperty: MutableSessionProperty,
NotImplementedError: NotImplementedError,
OperationError: OperationError,
QueueAccessType: QueueAccessType,
QueueBrowser: QueueBrowser,
QueueBrowserEventName: QueueBrowserEventName,
QueueBrowserProperties: QueueBrowserProperties,
QueueDescriptor: QueueDescriptor,
QueueDiscardBehavior: QueueDiscardBehavior,
QueuePermissions: QueuePermissions,
QueueProperties: QueueProperties,
QueueType: QueueType,
EndpointNameComplaint: EndpointNameComplaint,
ReplayStartLocation: ReplayStartLocation,
/*
* This should not be here ReplayStartLocationBeginning should not be a publicly exposed type.
* This type must remain for backwards compatibility however it was never indented for use
* by applications.
* */
ReplayStartLocationBeginning: ReplayStartLocationBeginning,
ReplicationGroupMessageId: ReplicationGroupMessageId,
RequestError: RequestError,
RequestEventCode: RequestEventCode,
SDTField: SDTField,
SDTFieldType: SDTFieldType,
SDTMapContainer: SDTMapContainer,
SDTStreamContainer: SDTStreamContainer,
SDTUnsupportedValueError: SDTUnsupportedValueError,
SDTValueErrorSubcode: SDTValueErrorSubcode,
Session: Session,
SessionEvent: SessionEvent,
SessionEventCBInfo: SessionEventCBInfo,
SessionEventCode: SessionEventCode,
SessionProperties: SessionProperties,
SessionState: SessionState,
SolclientFactory: SolclientFactory,
SolclientFactoryProfiles: SolclientFactoryProfiles,
SolclientFactoryProperties: SolclientFactoryProperties,
SslDowngrade: SslDowngrade,
StatType: StatType,
Topic: Topic,
TraceContext: TraceContext,
TraceContextSetter: TraceContextSetter,
TransportError: TransportError,
TransportProtocol: TransportProtocol,
Version: Version,
makeIterator: makeIterator,
_internal: _internal
};
Object.assign(module.exports, solace);
/***/
},
/***/ "./modules/solclient-debug/api.js":
/*!****************************************!*\
!*** ./modules/solclient-debug/api.js ***!
\****************************************/
/***/ (module, __unused_webpack_exports, __webpack_require__) => {
const {
Debug
} = __webpack_require__(/*! ./lib/debug */ "./modules/solclient-debug/lib/debug.js");
module.exports.Debug = Debug;
/***/
},
/***/ "./modules/solclient-debug/lib/debug.js":
/*!**********************************************!*\
!*** ./modules/solclient-debug/lib/debug.js ***!
\**********************************************/
/***/ (module, __unused_webpack_exports, __webpack_require__) => {
/* eslint-disable global-require */
// Do late binding for these debug utilities to break cyclic dependencies.
const PRINTABLE_LUT = (() => {
const tmp = [];
for (let c = 0; c < 256; ++c) {
tmp[c] = c < 33 || c > 126 ? "." : String.fromCharCode(c);
}
return tmp;
})();
const SPACER = " ";
const UNPRINTABLE = ".";
function formatDumpBytes(data, showDecode, leftPadding) {
const {
StringBuffer,
StringUtils
} = __webpack_require__(/*! solclient-util */ "./modules/solclient-util/api.js");
const {
isEmpty,
padLeft,
padRight
} = StringUtils;
if (isEmpty(data)) {
return null;
}
const output = new StringBuffer();
const ascii = new StringBuffer();
const line = new StringBuffer();
let lineBytes = 0;
const asciiOffset = 54;
for (let i = 0, dataLen = data.length; i < dataLen; ++i) {
const ccode = data.charCodeAt(i);
//const ccode = dataBuf.readInt8(i);
line.append(padLeft(ccode.toString(16), 2, "0"), " ");
ascii.append(PRINTABLE_LUT[ccode] || UNPRINTABLE);
lineBytes++;
if (lineBytes === 8) {
line.append(SPACER);
}
if (lineBytes === 16 || i === data.length - 1) {
if (leftPadding > 0) {
output.append(padRight("", leftPadding, " "));
}
output.append(padRight(line.toString(), asciiOffset, " "));
if (showDecode) {
output.append(ascii);
}
output.append("\n");
line.clear();
ascii.clear();
lineBytes = 0;
}
}
return output.toString();
}
function parseSMFStream(data) {
const {
Codec: {
Decode: {
decodeCompoundMessage
}
}
} = __webpack_require__(/*! solclient-smf */ "./modules/solclient-smf/api.js");
const {
LOG_WARN,
LOG_ERROR
} = __webpack_require__(/*! solclient-log */ "./modules/solclient-log/api.js");
if (data === null) {
LOG_ERROR("data null in debugParseSmfStream");
return;
}
let pos = 0;
LOG_WARN(`parseSMFStream(): Starting parse, length ${data.length}`);
while (pos < data.length) {
const incomingMsg = decodeCompoundMessage(data, pos);
const smf = incomingMsg ? incomingMsg.smfHeader : null;
if (!(incomingMsg && smf)) {
// couldn't decode! Lost SMF framing.
LOG_WARN("parseSMFStream(): couldn't decode message.");
LOG_WARN(`Position: ${pos} length: ${data.length}`);
return;
}
LOG_WARN(`>> Pos(${pos}) Protocol ${smf.smf_protocol}, Length: ${smf.messageLength}`);
pos += smf.messageLength;
}
}
const Debug = {
formatDumpBytes: formatDumpBytes,
parseSMFStream: parseSMFStream
};
module.exports.Debug = Debug;
/***/
},
/***/ "./modules/solclient-destination/api.js":
/*!**********************************************!*\
!*** ./modules/solclient-destination/api.js ***!
\**********************************************/
/***/ (module, __unused_webpack_exports, __webpack_require__) => {
const {
Destination
} = __webpack_require__(/*! ./lib/destination */ "./modules/solclient-destination/lib/destination.js");
const {
DestinationFromNetwork
} = __webpack_require__(/*! ./lib/destination-from-network */ "./modules/solclient-destination/lib/destination-from-network.js");
const {
DestinationType
} = __webpack_require__(/*! ./lib/destination-type */ "./modules/solclient-destination/lib/destination-type.js");
const {
DestinationUtil
} = __webpack_require__(/*! ./lib/destination-util */ "./modules/solclient-destination/lib/destination-util.js");
const {
Parameter
} = __webpack_require__(/*! solclient-validate */ "./modules/solclient-validate/api.js");
const {
Queue
} = __webpack_require__(/*! ./lib/queue */ "./modules/solclient-destination/lib/queue.js");
const {
SolclientFactory
} = __webpack_require__(/*! solclient-factory */ "./modules/solclient-factory/api.js");
const {
Topic
} = __webpack_require__(/*! ./lib/topic */ "./modules/solclient-destination/lib/topic.js");
/**
* Creates a topic {@link solace.Destination} instance. When the returned Destination is set as
* the destination of a message via {@link solace.Message#setDestination}, the message will be
* delivered to direct subscribers or topic endpoints subscribed to the given topic.
*
* @param {String} topicName The topic string for the new topic.
* @returns {solace.Destination} The newly created topic destination.
* @method
* @name solace.SolclientFactory.createTopicDestination
*/
SolclientFactory.createTopicDestination = SolclientFactory.createFactory(topicName => {
Parameter.isString("topicName", topicName);
return Topic.createFromName(topicName);
});
/* @deprecated @*/
SolclientFactory.createTopic = SolclientFactory.createFactory(topicName => new Topic(topicName));
/**
* Creates a durable queue {@link solace.Destination} instance. When the returned Destination is
* set as the destination of a message via {@link solace.Message#setDestination}, the message will
* be delivered to the Guaranteed Message queue on the Solace Message Router of the same name.
*
* @since 10.0.0
* @param {String} queueName The queueName of the queue
* @returns {solace.Destination} The newly created queue destination.
* @method
* @name solace.SolclientFactory.createDurableQueueDestination
*/
SolclientFactory.createDurableQueueDestination = SolclientFactory.createFactory(queueName => {
Parameter.isString("queueName", queueName);
return Queue.createFromLocalName(queueName);
});
module.exports.Destination = Destination;
module.exports.DestinationFromNetwork = DestinationFromNetwork;
module.exports.DestinationType = DestinationType;
module.exports.DestinationUtil = DestinationUtil;
module.exports.Queue = Queue;
module.exports.Topic = Topic;
/***/
},
/***/ "./modules/solclient-destination/lib/destination-from-network.js":
/*!***********************************************************************!*\
!*** ./modules/solclient-destination/lib/destination-from-network.js ***!
\***********************************************************************/
/***/ (module, __unused_webpack_exports, __webpack_require__) => {
const {
DestinationType
} = __webpack_require__(/*! ./destination-type */ "./modules/solclient-destination/lib/destination-type.js");
const {
DestinationUtil
} = __webpack_require__(/*! ./destination-util */ "./modules/solclient-destination/lib/destination-util.js");
const {
Queue
} = __webpack_require__(/*! ./queue */ "./modules/solclient-destination/lib/queue.js");
const {
Topic
} = __webpack_require__(/*! ./topic */ "./modules/solclient-destination/lib/topic.js");
const QUEUE_PREFIX = "#P2P/QUE/";
const QUEUE_PREFIX_LEN = QUEUE_PREFIX.length;
const TEMPORARY_QUEUE_PREFIX = "#P2P/QTMP/";
function createDestinationFromName(networkTopicName, networkTopicBytes = undefined) {
if (networkTopicName === null || networkTopicName.length === 0) {
return null;
}
const spec = {
name: networkTopicName,
bytes: networkTopicBytes || DestinationUtil.encodeBytes(networkTopicName)
};
if (networkTopicName[0] === "#") {
if (networkTopicName.startsWith(QUEUE_PREFIX)) {
const offset = QUEUE_PREFIX_LEN;
spec.name = networkTopicName.substr(offset);
spec.type = DestinationType.QUEUE;
spec.offset = offset;
return new Queue(spec);
} else if (networkTopicName.startsWith(TEMPORARY_QUEUE_PREFIX)) {
spec.name = networkTopicName;
spec.type = DestinationType.TEMPORARY_QUEUE;
spec.offset = 0;