UNPKG

solclientjs

Version:

Solace Messaging API for Node.js

962 lines (958 loc) 1.43 MB
/*! For license information please see solclient-full.js.LICENSE.txt */ (() => { var __webpack_modules__ = { "./index.js": (module, __unused_webpack_exports, __webpack_require__) => { module.exports = __webpack_require__("./modules/solclient-core/api.js"); }, "./modules/solclient-convert/api.js": (module, __unused_webpack_exports, __webpack_require__) => { const Base64 = __webpack_require__("./modules/solclient-convert/lib/base64.js").Base64; const Bits = __webpack_require__("./modules/solclient-convert/lib/bits.js").Bits; const Convert = __webpack_require__("./modules/solclient-convert/lib/convert.js").Convert; const Hex = __webpack_require__("./modules/solclient-convert/lib/hex.js").Hex; const Long = __webpack_require__("./modules/solclient-convert/lib/long.js").Long; 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": module => { 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, -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, -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, -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 = { 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 = (3 & chr1) << 4 | chr2 >> 4; let enc3 = (15 & chr2) << 2 | chr3 >> 6; let enc4 = 63 & chr3; 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; }, 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) throw new DecodeError("Invalid base64 character"); const chr1 = enc1 << 2 | enc2 >> 4; const chr2 = (15 & enc2) << 4 | enc3 >> 2; const chr3 = (3 & enc3) << 6 | enc4; output += String.fromCharCode(chr1); if (64 !== enc3) output += String.fromCharCode(chr2); if (64 !== enc4) output += String.fromCharCode(chr3); } while (i < input.length - 3); return output; } }; const isNode = "undefined" === typeof window; const hasBuffer = "undefined" !== typeof Buffer; const hasBlob = "undefined" !== typeof Blob; const BufferEncoder = hasBuffer && (hasBlob || isNode) ? { base64_encode: str => Buffer.from(str, "binary").toString("base64"), base64_decode: str => Buffer.from(str, "base64").toString("binary") } : {}; const WindowEncoder = "undefined" !== typeof window ? { base64_encode: window["btoa"] ? b => window["btoa"](b) : null, base64_decode: window["atob"] ? a => window["atob"](a) : null } : {}; 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": 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": (module, __unused_webpack_exports, __webpack_require__) => { const Long = __webpack_require__("./node_modules/long/umd/index.js"); const { ErrorSubcode, OperationError } = __webpack_require__("./modules/solclient-error/api.js"); const BufferImpl = __webpack_require__("buffer").Buffer; 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 = void 0) { const dataLength = data.byteLength; const uint8DataArray = new Uint8Array(BufferImpl.from(data)); let result = ""; for (let i = 0; i < dataLength; i++) if (format && "hex" === format.toLowerCase()) result += uint8DataArray[i].toString(16).padStart(2, "0"); else result += String.fromCharCode(255 & uint8DataArray[i]); 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 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) { 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(255 & int8); } function int16ToStr(int16) { return String.fromCharCode(int16 >> 8 & 255) + String.fromCharCode(255 & int16); } function int24ToStr(int24) { return String.fromCharCode(int24 >> 16 & 255) + String.fromCharCode(int24 >> 8 & 255) + String.fromCharCode(255 & int24); } function int32ToStr(int32) { if (0 === int32) 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(255 & int32); } return String.fromCharCode(int32 >> 24 & 255) + String.fromCharCode(int32 >> 16 & 255) + String.fromCharCode(int32 >> 8 & 255) + String.fromCharCode(255 & int32); } function int64ToStr(int64) { if ("number" !== typeof int64) return int32ToStr(int64.high) + int32ToStr(int64.low); 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(255 & int64); if (int64 < 4294967296) return FOUR_ZEROES_STR + (String.fromCharCode(int64 >> 24 & 255) + String.fromCharCode(int64 >> 16 & 255) + String.fromCharCode(int64 >> 8 & 255) + String.fromCharCode(255 & int64)); } 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(255 & int64); } 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) { 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 255 & data.charCodeAt(0); } 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) { return (data.charCodeAt(0) << 24) + (data.charCodeAt(1) << 16) + (data.charCodeAt(2) << 8) + data.charCodeAt(3); } function strToUInt32(data) { 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 ("string" === typeof value) return BufferImpl.from(value, "latin1"); if (value instanceof ArrayBuffer) return BufferImpl.from(value); if (value.buffer instanceof ArrayBuffer && "number" === typeof value.byteLength && "number" === typeof value.byteOffset) { if (0 === value.byteOffset && value.byteLength === value.buffer.byteLength) 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": module => { function numToHex(n) { if ("number" !== typeof n) return ""; const s = n.toString(16); return s.length < 2 ? `0` + s : s; } function formatHexString(obj) { if ("number" === typeof obj) return `0x` + numToHex(obj); if ("object" === typeof obj && Array.isArray(obj)) return obj.map(numToHex).join(); if ("string" === typeof obj) 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": (module, __unused_webpack_exports, __webpack_require__) => { module.exports.Long = __webpack_require__("./node_modules/long/umd/index.js"); }, "./modules/solclient-core/api-internal.js": (module, __unused_webpack_exports, __webpack_require__) => { const Convert = __webpack_require__("./modules/solclient-convert/api.js"); const Debug = __webpack_require__("./modules/solclient-debug/api.js"); const Destination = __webpack_require__("./modules/solclient-destination/api.js"); const Error = __webpack_require__("./modules/solclient-error/api.js"); const ESKit = __webpack_require__("./modules/solclient-eskit/api.js"); const Factory = __webpack_require__("./modules/solclient-factory/api.js"); const FSM = __webpack_require__("./modules/solclient-fsm/api.js"); const Log = __webpack_require__("./modules/solclient-log/api.js"); const Message = __webpack_require__("./modules/solclient-message/api.js"); const MessageTracing = __webpack_require__("./modules/solclient-message-tracing/api.js"); const Publisher = __webpack_require__("./modules/solclient-message-publisher/api.js"); const SDT = __webpack_require__("./modules/solclient-sdt/api.js"); const Session = __webpack_require__("./modules/solclient-session/api.js"); const SMF = __webpack_require__("./modules/solclient-smf/api.js"); const SolcacheSession = __webpack_require__("./modules/solclient-solcache-session/api.js"); const TestEnv = __webpack_require__("./modules/solclient-env/api.js"); const Transport = __webpack_require__("./modules/solclient-transport/api.js"); const Util = __webpack_require__("./modules/solclient-util/api.js"); const Validate = __webpack_require__("./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": (module, __unused_webpack_exports, __webpack_require__) => { const FactoryLib = __webpack_require__("./modules/solclient-factory/api.js"); const { SolclientFactory, SolclientFactoryProfiles, SolclientFactoryProperties } = FactoryLib; const Long = __webpack_require__("./modules/solclient-convert/api.js").Long; const { Destination, DestinationType, Topic } = __webpack_require__("./modules/solclient-destination/api.js"); const { ErrorSubcode, NotImplementedError, OperationError, RequestError, RequestEventCode } = __webpack_require__("./modules/solclient-error/api.js"); const makeIterator = __webpack_require__("./modules/solclient-eskit/api.js").makeIterator; const { ConsoleLogImpl, LogImpl, LogLevel } = __webpack_require__("./modules/solclient-log/api.js"); const { Message, MessageCacheStatus, MessageDeliveryModeType, MessageDumpFlag, MessageOutcome, MessageType, MessageUserCosType, ReplicationGroupMessageId } = __webpack_require__("./modules/solclient-message/api.js"); const { MessageConsumer, MessageConsumerAcknowledgeMode, MessageConsumerEventName, MessageConsumerProperties, QueueBrowser, QueueBrowserEventName, QueueBrowserProperties } = __webpack_require__("./modules/solclient-message-consumer/api.js"); const { ReplayStartLocation, ReplayStartLocationBeginning } = __webpack_require__("./modules/solclient-replaystart/api.js"); const { MessagePublisherAcknowledgeMode, MessagePublisherProperties } = __webpack_require__("./modules/solclient-message-publisher/api.js"); const { Baggage, TraceContext, TraceContextSetter } = __webpack_require__("./modules/solclient-message-tracing/api.js"); const { AbstractQueueDescriptor, QueueAccessType, QueueDescriptor, QueueDiscardBehavior, QueuePermissions, QueueProperties, QueueType, EndpointNameComplaint } = __webpack_require__("./modules/solclient-queue/api.js"); const { SDTField, SDTFieldType, SDTMapContainer, SDTStreamContainer, SDTUnsupportedValueError, SDTValueErrorSubcode } = __webpack_require__("./modules/solclient-sdt/api.js"); const { AuthenticationScheme, CapabilityType, MessageRxCBInfo, MutableSessionProperty, Session, SessionEvent, SessionEventCBInfo, SessionEventCode, SessionProperties, SessionState, SslDowngrade } = __webpack_require__("./modules/solclient-session/api.js"); const { CacheCBInfo, CacheLiveDataAction, CacheRequestResult, CacheReturnCode, CacheReturnSubcode, CacheSession, CacheSessionProperties } = __webpack_require__("./modules/solclient-solcache-session/api.js"); const StatType = __webpack_require__("./modules/solclient-stats/api.js").StatType; const { TransportError, TransportProtocol } = __webpack_require__("./modules/solclient-transport/api.js"); const Version = __webpack_require__("./modules/solclient-util/api.js").Version; const _internal = __webpack_require__("./modules/solclient-core/api-internal.js"); 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, 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": (module, __unused_webpack_exports, __webpack_require__) => { const Debug = __webpack_require__("./modules/solclient-debug/lib/debug.js").Debug; module.exports.Debug = Debug; }, "./modules/solclient-debug/lib/debug.js": (module, __unused_webpack_exports, __webpack_require__) => { 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__("./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); line.append(padLeft(ccode.toString(16), 2, "0"), " "); ascii.append(PRINTABLE_LUT[ccode] || UNPRINTABLE); lineBytes++; if (8 === lineBytes) line.append(SPACER); if (16 === lineBytes || 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 { Decode: { decodeCompoundMessage } } = __webpack_require__("./modules/solclient-smf/api.js").Codec; const { LOG_WARN, LOG_ERROR } = __webpack_require__("./modules/solclient-log/api.js"); if (null === data) { 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)) { 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": (module, __unused_webpack_exports, __webpack_require__) => { const Destination = __webpack_require__("./modules/solclient-destination/lib/destination.js").Destination; const DestinationFromNetwork = __webpack_require__("./modules/solclient-destination/lib/destination-from-network.js").DestinationFromNetwork; const DestinationType = __webpack_require__("./modules/solclient-destination/lib/destination-type.js").DestinationType; const DestinationUtil = __webpack_require__("./modules/solclient-destination/lib/destination-util.js").DestinationUtil; const Parameter = __webpack_require__("./modules/solclient-validate/api.js").Parameter; const Queue = __webpack_require__("./modules/solclient-destination/lib/queue.js").Queue; const SolclientFactory = __webpack_require__("./modules/solclient-factory/api.js").SolclientFactory; const Topic = __webpack_require__("./modules/solclient-destination/lib/topic.js").Topic; SolclientFactory.createTopicDestination = SolclientFactory.createFactory(topicName => { Parameter.isString("topicName", topicName); return Topic.createFromName(topicName); }); SolclientFactory.createTopic = SolclientFactory.createFactory(topicName => new Topic(topicName)); 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": (module, __unused_webpack_exports, __webpack_require__) => { const DestinationType = __webpack_require__("./modules/solclient-destination/lib/destination-type.js").DestinationType; const DestinationUtil = __webpack_require__("./modules/solclient-destination/lib/destination-util.js").DestinationUtil; const Queue = __webpack_require__("./modules/solclient-destination/lib/queue.js").Queue; const Topic = __webpack_require__("./modules/solclient-destination/lib/topic.js").Topic; const QUEUE_PREFIX = "#P2P/QUE/"; const QUEUE_PREFIX_LEN = QUEUE_PREFIX.length; const TEMPORARY_QUEUE_PREFIX = "#P2P/QTMP/"; function createDestinationFromName(networkTopicName, networkTopicBytes = void 0) { if (null === networkTopicName || 0 === networkTopicName.length) 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; return new Queue(spec); } return new Topic(spec); } function createDestinationFromBytes(networkTopicBytes) { if (null === networkTopicBytes || 0 === networkTopicBytes.length) return null; const networkTopicName = DestinationUtil.decodeBytes(networkTopicBytes); return createDestinationFromName(networkTopicName, networkTopicBytes); } const DestinationFromNetwork = { createDestinationFromBytes: createDestinationFromBytes, createDestinationFromName: createDestinationFromName }; module.exports.DestinationFromNetwork = DestinationFromNetwork; }, "./modules/solclient-destination/lib/destination-type.js": (module, __unused_webpack_exports, __webpack_require__) => { const Enum = __webpack_require__("./modules/solclient-eskit/api.js").Enum; const DestinationType = { TOPIC: "topic", QUEUE: "queue", TEMPORARY_QUEUE: "temporary_queue" }; module.exports.DestinationType = Enum.new(DestinationType); module.exports.DestinationType._setCanonical({ TOPIC: DestinationType.TOPIC, QUEUE: DestinationType.QUEUE, TEMPORARY_QUEUE: DestinationType.TEMPORARY_QUEUE }); }, "./modules/solclient-destination/lib/destination-util.js": (module, __unused_webpack_exports, __webpack_require__) => { const SolclientFactoryLib = __webpack_require__("./modules/solclient-factory/api.js"); const Convert = __webpack_require__("./modules/solclient-convert/api.js").Convert; const DestinationType = __webpack_require__("./modules/solclient-destination/lib/destination-type.js").DestinationType; const LOG_ERROR = __webpack_require__("./modules/solclient-log/api.js").LOG_ERROR; const SubscriptionInfo = __webpack_require__("./modules/solclient-destination/lib/subscription-info.js").SubscriptionInfo; const { UUID, StringUtils } = __webpack_require__("./modules/solclient-util/api.js"); const { ucs2ToUtf8, utf8ToUcs2 } = Convert; const ProfileBinding = SolclientFactoryLib.ProfileBinding; const { toSafeChars, stripNullTerminate } = StringUtils; const { ErrorSubcode, OperationError } = __webpack_require__("./modules/solclient-error/api.js"); const DESTINATION_PREFIX_FROM_TYPE = { [DestinationType.QUEUE]: "#P2P/QUE/", [DestinationType.TEMPORARY_QUEUE]: "#P2P/QTMP/" }; function createTemporaryName(type, vrid, name) { const id = name || UUID.generateUUID(); switch (type) { case DestinationType.TOPIC: return `#P2P/TTMP/${vrid}/` + id; case DestinationType.TEMPORARY_QUEUE: return `#P2P/QTMP/${vrid}/` + id; default: LOG_ERROR("Unknown/invalid destination type", DestinationType.describe(type)); } return; } function createPrefix(type) { return DESTINATION_PREFIX_FROM_TYPE[type] || ""; } function createOperationError(type, errorStr) { return new OperationError(`Invalid ${type}: ` + errorStr, ErrorSubcode.INVALID_TOPIC_SYNTAX); } function legacyValidate(type, bytes, name, exceptionCreator = createOperationError.bind(null, type)) { let error; const nameLength = name.length; if (nameLength < 1) { error = exceptionCreator("Too short (must be >= 1 character)."); return { error: error }; } const bytesLength = bytes.length; if (bytesLength > 251) { error = exceptionCreator(`Too long (encoding must be <= 250 bytes); name is ${bytesLength - 1} bytes: '${name}'`); return { error: error }; } let isWildcarded = false; if (">" === name.charAt(nameLength - 1)) isWildcarded = true; for (let i = 0; i < nameLength; ++i) switch (name.charAt(i)) { case "/": if (0 === i || i === nameLength - 1 || "/" === name.charAt(i - 1)) { error = exceptionCreator(`Empty level(s) in '${name}'@${i}.`); return { error: error }; } break; case "*": if (i < nameLength - 1 && "/" !== name.charAt(i + 1)) { error = exceptionCreator(`Illegal wildcard(s) in '${name}'@${i}.`); return { error: error }; } isWildcarded = true; break; default: break; } return { isWildcarded: isWildcarded }; } function encodeBytes(bytes) { return ProfileBinding.value.topicUtf8Encode ? ucs2ToUtf8(bytes) + `` : bytes + ``; } function decodeBytes(bytes) { return stripNullTerminate(ProfileBinding.value.topicUtf8Encode ? utf8ToUcs2(bytes) : bytes); } function encode(type, name) { const prefix = createPrefix(type); const offset = prefix.length; const networkName = prefix + name; const bytes = encodeBytes(networkName); return { bytes: bytes, offset: offset, networkName: networkName }; } function validateAndEncode(type, name, exceptionCreator = createOperationError.bind(null, type)) { const { bytes, offset } = encode(type, name); const { error: constError, isWildcarded } = legacyValidate(type, bytes, name, exceptionCreator); let error = constError; let subscriptionInfo = {}; subscriptionInfo.isWildcarded = isWildcarded; if (!error) Object.keys(DESTINATION_PREFIX_FROM_TYPE).some(prefixType => { const prefix = DESTINATION_PREFIX_FROM_TYPE[prefixType]; if (!name.startsWith(prefix)) return false; error = exceptionCreator(`Reserved prefix '${prefix}' found at start of '${name}'`); return true; }); if (!error) { const { error: errorConst, subInfo: subInfoConst } = SubscriptionInfo.parseFromName(name, type); error = errorConst; subscriptionInfo = subInfoConst; } return { bytes: bytes, offset: offset, error: error, isWildcarded: isWildcarded, subscriptionInfo: subscriptionInfo }; } const DestinationUtil = { createPrefix: createPrefix, createTemporaryName: createTemporaryName, decodeBytes: decodeBytes, encode: encode, encodeBytes: encodeBytes, legacyValidate: legacyValidate, toSafeChars: toSafeChars, validateAndEncode: validateAndEncode }; module.exports.DestinationUtil = DestinationUtil; }, "./modules/solclient-destination/lib/destination.js": (module, __unused_webpack_exports, __webpack_require__) => { const DestinationType = __webpack_require__("./modules/solclient-destination/lib/destination-type.js").DestinationType; const DestinationUtil = __webpack_require__("./modules/solclient-destination/lib/destination-util.js").DestinationUtil; class Destination { constructor(spec, type = DestinationType.TOPIC) { if ("object" === typeof spec) { this._name = spec.name; this._type = spec.type; this._bytes = spec.bytes; this._offset = spec.offset; if (spec.isValidated) { this._isValidated = true; this._isWildcarded = spec.isWildcarded; this._subscriptionInfo = spec.subscriptionInfo || {}; } else { this._isValidated = false; this._subscriptionInfo = {}; } } else { this._name = spec; this._type = type; const result = DestinationUtil.encode(type, spec); this._bytes = result.bytes; this._offset = result.offset; this._isValidated = false; this._subscriptionInfo = {}; } } getName() { return this._name; } get name() { return this.getName(); } getType() { return this._type; } get type() { return this.getType(); } getBytes() { return this._bytes; } get bytes() { return this.getBytes(); } getOffset() { return this._offset; } get offset() { return this.getOffset(); } validate() { if (this._isValidated) { if (this._error) throw this._error; return; } const { error, isWildcarded } = DestinationUtil.legacyValidate(this.type, this.bytes, this.name); this._isValidated = true; if (error) { this._error = error; throw error; } this._isWildcarded = isWildcarded; } isWildcarded() { this.validate(); return this._isWildcarded; } getSubscriptionInfo() { return this._subscriptionInfo || {}; } toString() { return util_inspect(this); } equals(other) { if (!(other instanceof Destination)) return false; return this.toString().valueOf() === other.toString().valueOf(); } } module.exports.Destination = Destination; }, "./modules/solclient-destination/lib/queue.js": (module, __unused_webpack_exports, __webpack_require__) => { const DestinationUtilLib = __webpack_require__("./modules/solclient-destination/lib/destination-util.js"); const assert = __webpack_require__("./modules/solclient-eskit/api.js").assert; const Destination = __webpack_require__("./modules/solclient-destination/lib/destination.js").Destination; const DestinationType = __webpack_require__("./modules/solclient-destination/lib/destination-type.js").DestinationType; class Queue extends Destination { constructor(spec) { assert(spec.name, "Queue name not supplied"); assert(spec.type === DestinationType.QUEUE || spec.type === DestinationType.TEMPORARY_QUEUE, "Queue spec.type is invalid"); assert(spec.bytes, "Queue spec missing bytes"); assert(void 0 !== spec.offset, "Queue spec missing offset"); super(spec); } getOffset() { return this._offset; } get offset() { return this.getOffset(); } [Symbol.for("nodejs.util.inspect.custom")]() { return `[Queue ${this.getName()}]`; } static createFromLocalName(queueName) { const encoding = DestinationUtilLib.DestinationUtil.validateAndEncode(DestinationType.QUEUE, queueName); if (encoding.error) throw encoding.error; return new Queue({ name: queueName, type: DestinationType.QUEUE, isValidated: true, bytes: encoding.bytes, offset: encoding.offset, isWildcarded: encoding.isWildcarded, subscriptionInfo: encoding.subscriptionInfo }); } } module.exports.Queue = Queue; }, "./modules/solclient-destination/lib/subscription-info.js": (module, __unused_webpack_exports, __webpack_require__) => { const DestinationType = __webpack_require__("./modules/solclient-destination/lib/destination-type.js").DestinationType; const { ErrorSubcode, OperationError } = __webpack_require__("./modules/solclient-error/api.js"); function subscriptionParseNoExport(type, name, bytes, offset, result) { const NOEXPORT_PREFIX = "#noexport/"; const NOEXPORT_PREFIX_LEN = NOEXPORT_PREFIX.length; let index = offset; let error; if (name.length - index > NOEXPORT_PREFIX_LEN && !result.isNoExport) if (name.startsWith(NOEXPORT_PREFIX, index)) { index += NOEXPORT_PREFIX_LEN; result.isNoExport = true; } else result.isNoExport = false; else result.isNoExport = false; return { error: error, index: index, result: result }; } function subscriptionParseShare(type, name, bytes, offset, result, exceptionCreator) { const SHARE_PREFIX = "#share/"; const SHARE_PREFIX_LEN = SHARE_PREFIX.length; const LEVEL_DELIMETER = "/"; const LEVEL_DELIMETER_LEN = LEVEL_DELIMETER.length; let index = offset; let error; let groupIndex = -1; let shareGroup; if (name.length - index > SHARE_PREFIX_LEN && !result.isShare) if (name.startsWith(SHARE_PREFIX, offset) && name.length - (index + SHARE_PREFIX_LEN) > LEVEL_DELIMETER_LEN + 1) {