construct-hub 0.4.147 → 0.4.148

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../node_modules/shimmer/index.js", "../../../../node_modules/emitter-listener/listener.js", "../../../../node_modules/cls-hooked/context.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/logger.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/segments/attributes/captured_exception.js", "../../../../node_modules/atomic-batcher/index.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/daemon_config.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/segment_emitter.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/segments/attributes/trace_id.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/utils.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/segments/segment_utils.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/segments/attributes/remote_request_data.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/segments/attributes/subsegment.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/segments/segment.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/context_utils.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/middleware/incoming_request_data.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/middleware/sampling/local_reservoir.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/middleware/sampling/local_sampler.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/middleware/sampling/reservoir.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/middleware/sampling/sampling_rule.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/middleware/sampling/service_connector.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/middleware/sampling/rule_cache.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/middleware/sampling/rule_poller.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/middleware/sampling/target_poller.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/middleware/sampling/default_sampler.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/middleware/mw_utils.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/env/aws_lambda.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/segments/plugins/plugin.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/segments/plugins/ec2_plugin.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/segments/plugins/ecs_plugin.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/segments/plugins/elastic_beanstalk_plugin.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/patchers/call_capturer.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/segments/attributes/aws.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/capture.js", "../../../../node_modules/aws-xray-sdk-core/node_modules/semver/semver.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/patchers/aws_p.js", "../../../../node_modules/@aws-sdk/service-error-classification/dist-cjs/constants.js", "../../../../node_modules/@aws-sdk/service-error-classification/dist-cjs/index.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/patchers/aws3_p.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/patchers/http_p.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/patchers/promise_p.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/database/sql_data.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/aws-xray.js", "../../../../node_modules/aws-xray-sdk-core/dist/lib/index.js", "../../../../src/backend/orchestration/redrive-state-machine.lambda.ts", "../../../../src/backend/shared/aws.lambda-shared.ts", "../../../../src/backend/shared/env.lambda-shared.ts"],
4
- "sourcesContent": ["'use strict'\n\nfunction isFunction (funktion) {\n return typeof funktion === 'function'\n}\n\n// Default to complaining loudly when things don't go according to plan.\nvar logger = console.error.bind(console)\n\n// Sets a property on an object, preserving its enumerability.\n// This function assumes that the property is already writable.\nfunction defineProperty (obj, name, value) {\n var enumerable = !!obj[name] && obj.propertyIsEnumerable(name)\n Object.defineProperty(obj, name, {\n configurable: true,\n enumerable: enumerable,\n writable: true,\n value: value\n })\n}\n\n// Keep initialization idempotent.\nfunction shimmer (options) {\n if (options && options.logger) {\n if (!isFunction(options.logger)) logger(\"new logger isn't a function, not replacing\")\n else logger = options.logger\n }\n}\n\nfunction wrap (nodule, name, wrapper) {\n if (!nodule || !nodule[name]) {\n logger('no original function ' + name + ' to wrap')\n return\n }\n\n if (!wrapper) {\n logger('no wrapper function')\n logger((new Error()).stack)\n return\n }\n\n if (!isFunction(nodule[name]) || !isFunction(wrapper)) {\n logger('original object and wrapper must be functions')\n return\n }\n\n var original = nodule[name]\n var wrapped = wrapper(original, name)\n\n defineProperty(wrapped, '__original', original)\n defineProperty(wrapped, '__unwrap', function () {\n if (nodule[name] === wrapped) defineProperty(nodule, name, original)\n })\n defineProperty(wrapped, '__wrapped', true)\n\n defineProperty(nodule, name, wrapped)\n return wrapped\n}\n\nfunction massWrap (nodules, names, wrapper) {\n if (!nodules) {\n logger('must provide one or more modules to patch')\n logger((new Error()).stack)\n return\n } else if (!Array.isArray(nodules)) {\n nodules = [nodules]\n }\n\n if (!(names && Array.isArray(names))) {\n logger('must provide one or more functions to wrap on modules')\n return\n }\n\n nodules.forEach(function (nodule) {\n names.forEach(function (name) {\n wrap(nodule, name, wrapper)\n })\n })\n}\n\nfunction unwrap (nodule, name) {\n if (!nodule || !nodule[name]) {\n logger('no function to unwrap.')\n logger((new Error()).stack)\n return\n }\n\n if (!nodule[name].__unwrap) {\n logger('no original to unwrap to -- has ' + name + ' already been unwrapped?')\n } else {\n return nodule[name].__unwrap()\n }\n}\n\nfunction massUnwrap (nodules, names) {\n if (!nodules) {\n logger('must provide one or more modules to patch')\n logger((new Error()).stack)\n return\n } else if (!Array.isArray(nodules)) {\n nodules = [nodules]\n }\n\n if (!(names && Array.isArray(names))) {\n logger('must provide one or more functions to unwrap on modules')\n return\n }\n\n nodules.forEach(function (nodule) {\n names.forEach(function (name) {\n unwrap(nodule, name)\n })\n })\n}\n\nshimmer.wrap = wrap\nshimmer.massWrap = massWrap\nshimmer.unwrap = unwrap\nshimmer.massUnwrap = massUnwrap\n\nmodule.exports = shimmer\n", "'use strict';\n\nvar shimmer = require('shimmer');\nvar wrap = shimmer.wrap;\nvar unwrap = shimmer.unwrap;\n\n// Default to complaining loudly when things don't go according to plan.\n// dunderscores are boring\nvar SYMBOL = 'wrap@before';\n\n// Sets a property on an object, preserving its enumerability.\n// This function assumes that the property is already writable.\nfunction defineProperty(obj, name, value) {\n var enumerable = !!obj[name] && obj.propertyIsEnumerable(name);\n Object.defineProperty(obj, name, {\n configurable: true,\n enumerable: enumerable,\n writable: true,\n value: value\n });\n}\n\nfunction _process(self, listeners) {\n var l = listeners.length;\n for (var p = 0; p < l; p++) {\n var listener = listeners[p];\n // set up the listener so that onEmit can do whatever it needs\n var before = self[SYMBOL];\n if (typeof before === 'function') {\n before(listener);\n }\n else if (Array.isArray(before)) {\n var length = before.length;\n for (var i = 0; i < length; i++) before[i](listener);\n }\n }\n}\n\nfunction _listeners(self, event) {\n var listeners;\n listeners = self._events && self._events[event];\n if (!Array.isArray(listeners)) {\n if (listeners) {\n listeners = [listeners];\n }\n else {\n listeners = [];\n }\n }\n\n return listeners;\n}\n\nfunction _findAndProcess(self, event, before) {\n var after = _listeners(self, event);\n var unprocessed = after.filter(function(fn) { return before.indexOf(fn) === -1; });\n if (unprocessed.length > 0) _process(self, unprocessed);\n}\n\nfunction _wrap(unwrapped, visit) {\n if (!unwrapped) return;\n\n var wrapped = unwrapped;\n if (typeof unwrapped === 'function') {\n wrapped = visit(unwrapped);\n }\n else if (Array.isArray(unwrapped)) {\n wrapped = [];\n for (var i = 0; i < unwrapped.length; i++) {\n wrapped[i] = visit(unwrapped[i]);\n }\n }\n return wrapped;\n}\n\nmodule.exports = function wrapEmitter(emitter, onAddListener, onEmit) {\n if (!emitter || !emitter.on || !emitter.addListener ||\n !emitter.removeListener || !emitter.emit) {\n throw new Error(\"can only wrap real EEs\");\n }\n\n if (!onAddListener) throw new Error(\"must have function to run on listener addition\");\n if (!onEmit) throw new Error(\"must have function to wrap listeners when emitting\");\n\n /* Attach a context to a listener, and make sure that this hook stays\n * attached to the emitter forevermore.\n */\n function adding(on) {\n return function added(event, listener) {\n var existing = _listeners(this, event).slice();\n\n try {\n var returned = on.call(this, event, listener);\n _findAndProcess(this, event, existing);\n return returned;\n }\n finally {\n // old-style streaming overwrites .on and .addListener, so rewrap\n if (!this.on.__wrapped) wrap(this, 'on', adding);\n if (!this.addListener.__wrapped) wrap(this, 'addListener', adding);\n }\n };\n }\n\n function emitting(emit) {\n return function emitted(event) {\n if (!this._events || !this._events[event]) return emit.apply(this, arguments);\n\n var unwrapped = this._events[event];\n\n /* Ensure that if removeListener gets called, it's working with the\n * unwrapped listeners.\n */\n function remover(removeListener) {\n return function removed() {\n this._events[event] = unwrapped;\n try {\n return removeListener.apply(this, arguments);\n }\n finally {\n unwrapped = this._events[event];\n this._events[event] = _wrap(unwrapped, onEmit);\n }\n };\n }\n wrap(this, 'removeListener', remover);\n\n try {\n /* At emit time, ensure that whatever else is going on, removeListener will\n * still work while at the same time running whatever hooks are necessary to\n * make sure the listener is run in the correct context.\n */\n this._events[event] = _wrap(unwrapped, onEmit);\n return emit.apply(this, arguments);\n }\n finally {\n /* Ensure that regardless of what happens when preparing and running the\n * listeners, the status quo ante is restored before continuing.\n */\n unwrap(this, 'removeListener');\n this._events[event] = unwrapped;\n }\n };\n }\n\n // support multiple onAddListeners\n if (!emitter[SYMBOL]) {\n defineProperty(emitter, SYMBOL, onAddListener);\n }\n else if (typeof emitter[SYMBOL] === 'function') {\n defineProperty(emitter, SYMBOL, [emitter[SYMBOL], onAddListener]);\n }\n else if (Array.isArray(emitter[SYMBOL])) {\n emitter[SYMBOL].push(onAddListener);\n }\n\n // only wrap the core functions once\n if (!emitter.__wrapped) {\n wrap(emitter, 'addListener', adding);\n wrap(emitter, 'on', adding);\n wrap(emitter, 'emit', emitting);\n\n defineProperty(emitter, '__unwrap', function () {\n unwrap(emitter, 'addListener');\n unwrap(emitter, 'on');\n unwrap(emitter, 'emit');\n delete emitter[SYMBOL];\n delete emitter.__wrapped;\n });\n defineProperty(emitter, '__wrapped', true);\n }\n};\n", "/* eslint-disable max-len */\n'use strict';\n\nconst util = require('util');\nconst assert = require('assert');\nconst wrapEmitter = require('emitter-listener');\nconst async_hooks = require('async_hooks');\n\nconst CONTEXTS_SYMBOL = 'cls@contexts';\nconst ERROR_SYMBOL = 'error@context';\n\nconst DEBUG_CLS_HOOKED = process.env.DEBUG_CLS_HOOKED;\n\nlet currentUid = -1;\n\nmodule.exports = {\n getNamespace: getNamespace,\n createNamespace: createNamespace,\n destroyNamespace: destroyNamespace,\n reset: reset,\n ERROR_SYMBOL: ERROR_SYMBOL\n};\n\nfunction Namespace(name) {\n this.name = name;\n // changed in 2.7: no default context\n this.active = null;\n this._set = [];\n this.id = null;\n this._contexts = new Map();\n this._indent = 0;\n}\n\nNamespace.prototype.set = function set(key, value) {\n if (!this.active) {\n throw new Error('No context available. ns.run() or ns.bind() must be called first.');\n }\n\n this.active[key] = value;\n\n if (DEBUG_CLS_HOOKED) {\n const indentStr = ' '.repeat(this._indent < 0 ? 0 : this._indent);\n debug2(indentStr + 'CONTEXT-SET KEY:' + key + '=' + value + ' in ns:' + this.name + ' currentUid:' + currentUid + ' active:' + util.inspect(this.active, {showHidden:true, depth:2, colors:true}));\n }\n\n return value;\n};\n\nNamespace.prototype.get = function get(key) {\n if (!this.active) {\n if (DEBUG_CLS_HOOKED) {\n const asyncHooksCurrentId = async_hooks.currentId();\n const triggerId = async_hooks.triggerAsyncId();\n const indentStr = ' '.repeat(this._indent < 0 ? 0 : this._indent);\n //debug2(indentStr + 'CONTEXT-GETTING KEY NO ACTIVE NS:' + key + '=undefined' + ' (' + this.name + ') currentUid:' + currentUid + ' active:' + util.inspect(this.active, {showHidden:true, depth:2, colors:true}));\n debug2(`${indentStr}CONTEXT-GETTING KEY NO ACTIVE NS: (${this.name}) ${key}=undefined currentUid:${currentUid} asyncHooksCurrentId:${asyncHooksCurrentId} triggerId:${triggerId} len:${this._set.length}`);\n }\n return undefined;\n }\n if (DEBUG_CLS_HOOKED) {\n const asyncHooksCurrentId = async_hooks.executionAsyncId();\n const triggerId = async_hooks.triggerAsyncId();\n const indentStr = ' '.repeat(this._indent < 0 ? 0 : this._indent);\n debug2(indentStr + 'CONTEXT-GETTING KEY:' + key + '=' + this.active[key] + ' (' + this.name + ') currentUid:' + currentUid + ' active:' + util.inspect(this.active, {showHidden:true, depth:2, colors:true}));\n debug2(`${indentStr}CONTEXT-GETTING KEY: (${this.name}) ${key}=${this.active[key]} currentUid:${currentUid} asyncHooksCurrentId:${asyncHooksCurrentId} triggerId:${triggerId} len:${this._set.length} active:${util.inspect(this.active)}`);\n }\n return this.active[key];\n};\n\nNamespace.prototype.createContext = function createContext() {\n // Prototype inherit existing context if created a new child context within existing context.\n let context = Object.create(this.active ? this.active : Object.prototype);\n context._ns_name = this.name;\n context.id = currentUid;\n\n if (DEBUG_CLS_HOOKED) {\n const asyncHooksCurrentId = async_hooks.executionAsyncId();\n const triggerId = async_hooks.triggerAsyncId();\n const indentStr = ' '.repeat(this._indent < 0 ? 0 : this._indent);\n debug2(`${indentStr}CONTEXT-CREATED Context: (${this.name}) currentUid:${currentUid} asyncHooksCurrentId:${asyncHooksCurrentId} triggerId:${triggerId} len:${this._set.length} context:${util.inspect(context, {showHidden:true, depth:2, colors:true})}`);\n }\n\n return context;\n};\n\nNamespace.prototype.run = function run(fn) {\n let context = this.createContext();\n this.enter(context);\n\n try {\n if (DEBUG_CLS_HOOKED) {\n const triggerId = async_hooks.triggerAsyncId();\n const asyncHooksCurrentId = async_hooks.executionAsyncId();\n const indentStr = ' '.repeat(this._indent < 0 ? 0 : this._indent);\n debug2(`${indentStr}CONTEXT-RUN BEGIN: (${this.name}) currentUid:${currentUid} triggerId:${triggerId} asyncHooksCurrentId:${asyncHooksCurrentId} len:${this._set.length} context:${util.inspect(context)}`);\n }\n fn(context);\n return context;\n } catch (exception) {\n if (exception) {\n exception[ERROR_SYMBOL] = context;\n }\n throw exception;\n } finally {\n if (DEBUG_CLS_HOOKED) {\n const triggerId = async_hooks.triggerAsyncId();\n const asyncHooksCurrentId = async_hooks.executionAsyncId();\n const indentStr = ' '.repeat(this._indent < 0 ? 0 : this._indent);\n debug2(`${indentStr}CONTEXT-RUN END: (${this.name}) currentUid:${currentUid} triggerId:${triggerId} asyncHooksCurrentId:${asyncHooksCurrentId} len:${this._set.length} ${util.inspect(context)}`);\n }\n this.exit(context);\n }\n};\n\nNamespace.prototype.runAndReturn = function runAndReturn(fn) {\n let value;\n this.run(function (context) {\n value = fn(context);\n });\n return value;\n};\n\n/**\n * Uses global Promise and assumes Promise is cls friendly or wrapped already.\n * @param {function} fn\n * @returns {*}\n */\nNamespace.prototype.runPromise = function runPromise(fn) {\n let context = this.createContext();\n this.enter(context);\n\n let promise = fn(context);\n if (!promise || !promise.then || !promise.catch) {\n throw new Error('fn must return a promise.');\n }\n\n if (DEBUG_CLS_HOOKED) {\n debug2('CONTEXT-runPromise BEFORE: (' + this.name + ') currentUid:' + currentUid + ' len:' + this._set.length + ' ' + util.inspect(context));\n }\n\n return promise\n .then(result => {\n if (DEBUG_CLS_HOOKED) {\n debug2('CONTEXT-runPromise AFTER then: (' + this.name + ') currentUid:' + currentUid + ' len:' + this._set.length + ' ' + util.inspect(context));\n }\n this.exit(context);\n return result;\n })\n .catch(err => {\n err[ERROR_SYMBOL] = context;\n if (DEBUG_CLS_HOOKED) {\n debug2('CONTEXT-runPromise AFTER catch: (' + this.name + ') currentUid:' + currentUid + ' len:' + this._set.length + ' ' + util.inspect(context));\n }\n this.exit(context);\n throw err;\n });\n};\n\nNamespace.prototype.bind = function bindFactory(fn, context) {\n if (!context) {\n if (!this.active) {\n context = this.createContext();\n } else {\n context = this.active;\n }\n }\n\n let self = this;\n return function clsBind() {\n self.enter(context);\n try {\n return fn.apply(this, arguments);\n } catch (exception) {\n if (exception) {\n exception[ERROR_SYMBOL] = context;\n }\n throw exception;\n } finally {\n self.exit(context);\n }\n };\n};\n\nNamespace.prototype.enter = function enter(context) {\n assert.ok(context, 'context must be provided for entering');\n if (DEBUG_CLS_HOOKED) {\n const asyncHooksCurrentId = async_hooks.executionAsyncId();\n const triggerId = async_hooks.triggerAsyncId();\n const indentStr = ' '.repeat(this._indent < 0 ? 0 : this._indent);\n debug2(`${indentStr}CONTEXT-ENTER: (${this.name}) currentUid:${currentUid} triggerId:${triggerId} asyncHooksCurrentId:${asyncHooksCurrentId} len:${this._set.length} ${util.inspect(context)}`);\n }\n\n this._set.push(this.active);\n this.active = context;\n};\n\nNamespace.prototype.exit = function exit(context) {\n assert.ok(context, 'context must be provided for exiting');\n if (DEBUG_CLS_HOOKED) {\n const asyncHooksCurrentId = async_hooks.executionAsyncId();\n const triggerId = async_hooks.triggerAsyncId();\n const indentStr = ' '.repeat(this._indent < 0 ? 0 : this._indent);\n debug2(`${indentStr}CONTEXT-EXIT: (${this.name}) currentUid:${currentUid} triggerId:${triggerId} asyncHooksCurrentId:${asyncHooksCurrentId} len:${this._set.length} ${util.inspect(context)}`);\n }\n\n // Fast path for most exits that are at the top of the stack\n if (this.active === context) {\n assert.ok(this._set.length, 'can\\'t remove top context');\n this.active = this._set.pop();\n return;\n }\n\n // Fast search in the stack using lastIndexOf\n let index = this._set.lastIndexOf(context);\n\n if (index < 0) {\n if (DEBUG_CLS_HOOKED) {\n debug2('??ERROR?? context exiting but not entered - ignoring: ' + util.inspect(context));\n }\n assert.ok(index >= 0, 'context not currently entered; can\\'t exit. \\n' + util.inspect(this) + '\\n' + util.inspect(context));\n } else {\n assert.ok(index, 'can\\'t remove top context');\n this._set.splice(index, 1);\n }\n};\n\nNamespace.prototype.bindEmitter = function bindEmitter(emitter) {\n assert.ok(emitter.on && emitter.addListener && emitter.emit, 'can only bind real EEs');\n\n let namespace = this;\n let thisSymbol = 'context@' + this.name;\n\n // Capture the context active at the time the emitter is bound.\n function attach(listener) {\n if (!listener) {\n return;\n }\n if (!listener[CONTEXTS_SYMBOL]) {\n listener[CONTEXTS_SYMBOL] = Object.create(null);\n }\n\n listener[CONTEXTS_SYMBOL][thisSymbol] = {\n namespace: namespace,\n context: namespace.active\n };\n }\n\n // At emit time, bind the listener within the correct context.\n function bind(unwrapped) {\n if (!(unwrapped && unwrapped[CONTEXTS_SYMBOL])) {\n return unwrapped;\n }\n\n let wrapped = unwrapped;\n let unwrappedContexts = unwrapped[CONTEXTS_SYMBOL];\n Object.keys(unwrappedContexts).forEach(function (name) {\n let thunk = unwrappedContexts[name];\n wrapped = thunk.namespace.bind(wrapped, thunk.context);\n });\n return wrapped;\n }\n\n wrapEmitter(emitter, attach, bind);\n};\n\n/**\n * If an error comes out of a namespace, it will have a context attached to it.\n * This function knows how to find it.\n *\n * @param {Error} exception Possibly annotated error.\n */\nNamespace.prototype.fromException = function fromException(exception) {\n return exception[ERROR_SYMBOL];\n};\n\nfunction getNamespace(name) {\n return process.namespaces[name];\n}\n\nfunction createNamespace(name) {\n assert.ok(name, 'namespace must be given a name.');\n\n if (DEBUG_CLS_HOOKED) {\n debug2(`NS-CREATING NAMESPACE (${name})`);\n }\n let namespace = new Namespace(name);\n namespace.id = currentUid;\n\n const hook = async_hooks.createHook({\n init(asyncId, type, triggerId, resource) {\n currentUid = async_hooks.executionAsyncId();\n\n //CHAIN Parent's Context onto child if none exists. This is needed to pass net-events.spec\n // let initContext = namespace.active;\n // if(!initContext && triggerId) {\n // let parentContext = namespace._contexts.get(triggerId);\n // if (parentContext) {\n // namespace.active = parentContext;\n // namespace._contexts.set(currentUid, parentContext);\n // if (DEBUG_CLS_HOOKED) {\n // const indentStr = ' '.repeat(namespace._indent < 0 ? 0 : namespace._indent);\n // debug2(`${indentStr}INIT [${type}] (${name}) WITH PARENT CONTEXT asyncId:${asyncId} currentUid:${currentUid} triggerId:${triggerId} active:${util.inspect(namespace.active, true)} resource:${resource}`);\n // }\n // } else if (DEBUG_CLS_HOOKED) {\n // const indentStr = ' '.repeat(namespace._indent < 0 ? 0 : namespace._indent);\n // debug2(`${indentStr}INIT [${type}] (${name}) MISSING CONTEXT asyncId:${asyncId} currentUid:${currentUid} triggerId:${triggerId} active:${util.inspect(namespace.active, true)} resource:${resource}`);\n // }\n // }else {\n // namespace._contexts.set(currentUid, namespace.active);\n // if (DEBUG_CLS_HOOKED) {\n // const indentStr = ' '.repeat(namespace._indent < 0 ? 0 : namespace._indent);\n // debug2(`${indentStr}INIT [${type}] (${name}) asyncId:${asyncId} currentUid:${currentUid} triggerId:${triggerId} active:${util.inspect(namespace.active, true)} resource:${resource}`);\n // }\n // }\n if(namespace.active) {\n namespace._contexts.set(asyncId, namespace.active);\n\n if (DEBUG_CLS_HOOKED) {\n const indentStr = ' '.repeat(namespace._indent < 0 ? 0 : namespace._indent);\n debug2(`${indentStr}INIT [${type}] (${name}) asyncId:${asyncId} currentUid:${currentUid} triggerId:${triggerId} active:${util.inspect(namespace.active, {showHidden:true, depth:2, colors:true})} resource:${resource}`);\n }\n }else if(currentUid === 0){\n // CurrentId will be 0 when triggered from C++. Promise events\n // https://github.com/nodejs/node/blob/master/doc/api/async_hooks.md#triggerid\n const triggerId = async_hooks.triggerAsyncId();\n const triggerIdContext = namespace._contexts.get(triggerId);\n if (triggerIdContext) {\n namespace._contexts.set(asyncId, triggerIdContext);\n if (DEBUG_CLS_HOOKED) {\n const indentStr = ' '.repeat(namespace._indent < 0 ? 0 : namespace._indent);\n debug2(`${indentStr}INIT USING CONTEXT FROM TRIGGERID [${type}] (${name}) asyncId:${asyncId} currentUid:${currentUid} triggerId:${triggerId} active:${util.inspect(namespace.active, { showHidden: true, depth: 2, colors: true })} resource:${resource}`);\n }\n } else if (DEBUG_CLS_HOOKED) {\n const indentStr = ' '.repeat(namespace._indent < 0 ? 0 : namespace._indent);\n debug2(`${indentStr}INIT MISSING CONTEXT [${type}] (${name}) asyncId:${asyncId} currentUid:${currentUid} triggerId:${triggerId} active:${util.inspect(namespace.active, { showHidden: true, depth: 2, colors: true })} resource:${resource}`);\n }\n }\n\n\n if(DEBUG_CLS_HOOKED && type === 'PROMISE'){\n debug2(util.inspect(resource, {showHidden: true}));\n const parentId = resource.parentId;\n const indentStr = ' '.repeat(namespace._indent < 0 ? 0 : namespace._indent);\n debug2(`${indentStr}INIT RESOURCE-PROMISE [${type}] (${name}) parentId:${parentId} asyncId:${asyncId} currentUid:${currentUid} triggerId:${triggerId} active:${util.inspect(namespace.active, {showHidden:true, depth:2, colors:true})} resource:${resource}`);\n }\n\n },\n before(asyncId) {\n currentUid = async_hooks.executionAsyncId();\n let context;\n\n /*\n if(currentUid === 0){\n // CurrentId will be 0 when triggered from C++. Promise events\n // https://github.com/nodejs/node/blob/master/doc/api/async_hooks.md#triggerid\n //const triggerId = async_hooks.triggerAsyncId();\n context = namespace._contexts.get(asyncId); // || namespace._contexts.get(triggerId);\n }else{\n context = namespace._contexts.get(currentUid);\n }\n */\n\n //HACK to work with promises until they are fixed in node > 8.1.1\n context = namespace._contexts.get(asyncId) || namespace._contexts.get(currentUid);\n\n if (context) {\n if (DEBUG_CLS_HOOKED) {\n const triggerId = async_hooks.triggerAsyncId();\n const indentStr = ' '.repeat(namespace._indent < 0 ? 0 : namespace._indent);\n debug2(`${indentStr}BEFORE (${name}) asyncId:${asyncId} currentUid:${currentUid} triggerId:${triggerId} active:${util.inspect(namespace.active, {showHidden:true, depth:2, colors:true})} context:${util.inspect(context)}`);\n namespace._indent += 2;\n }\n\n namespace.enter(context);\n\n } else if (DEBUG_CLS_HOOKED) {\n const triggerId = async_hooks.triggerAsyncId();\n const indentStr = ' '.repeat(namespace._indent < 0 ? 0 : namespace._indent);\n debug2(`${indentStr}BEFORE MISSING CONTEXT (${name}) asyncId:${asyncId} currentUid:${currentUid} triggerId:${triggerId} active:${util.inspect(namespace.active, {showHidden:true, depth:2, colors:true})} namespace._contexts:${util.inspect(namespace._contexts, {showHidden:true, depth:2, colors:true})}`);\n namespace._indent += 2;\n }\n },\n after(asyncId) {\n currentUid = async_hooks.executionAsyncId();\n let context; // = namespace._contexts.get(currentUid);\n /*\n if(currentUid === 0){\n // CurrentId will be 0 when triggered from C++. Promise events\n // https://github.com/nodejs/node/blob/master/doc/api/async_hooks.md#triggerid\n //const triggerId = async_hooks.triggerAsyncId();\n context = namespace._contexts.get(asyncId); // || namespace._contexts.get(triggerId);\n }else{\n context = namespace._contexts.get(currentUid);\n }\n */\n //HACK to work with promises until they are fixed in node > 8.1.1\n context = namespace._contexts.get(asyncId) || namespace._contexts.get(currentUid);\n\n if (context) {\n if (DEBUG_CLS_HOOKED) {\n const triggerId = async_hooks.triggerAsyncId();\n namespace._indent -= 2;\n const indentStr = ' '.repeat(namespace._indent < 0 ? 0 : namespace._indent);\n debug2(`${indentStr}AFTER (${name}) asyncId:${asyncId} currentUid:${currentUid} triggerId:${triggerId} active:${util.inspect(namespace.active, {showHidden:true, depth:2, colors:true})} context:${util.inspect(context)}`);\n }\n\n namespace.exit(context);\n\n } else if (DEBUG_CLS_HOOKED) {\n const triggerId = async_hooks.triggerAsyncId();\n namespace._indent -= 2;\n const indentStr = ' '.repeat(namespace._indent < 0 ? 0 : namespace._indent);\n debug2(`${indentStr}AFTER MISSING CONTEXT (${name}) asyncId:${asyncId} currentUid:${currentUid} triggerId:${triggerId} active:${util.inspect(namespace.active, {showHidden:true, depth:2, colors:true})} context:${util.inspect(context)}`);\n }\n },\n destroy(asyncId) {\n currentUid = async_hooks.executionAsyncId();\n if (DEBUG_CLS_HOOKED) {\n const triggerId = async_hooks.triggerAsyncId();\n const indentStr = ' '.repeat(namespace._indent < 0 ? 0 : namespace._indent);\n debug2(`${indentStr}DESTROY (${name}) currentUid:${currentUid} asyncId:${asyncId} triggerId:${triggerId} active:${util.inspect(namespace.active, {showHidden:true, depth:2, colors:true})} context:${util.inspect(namespace._contexts.get(currentUid))}`);\n }\n\n namespace._contexts.delete(asyncId);\n }\n });\n\n hook.enable();\n\n process.namespaces[name] = namespace;\n return namespace;\n}\n\nfunction destroyNamespace(name) {\n let namespace = getNamespace(name);\n\n assert.ok(namespace, 'can\\'t delete nonexistent namespace! \"' + name + '\"');\n assert.ok(namespace.id, 'don\\'t assign to process.namespaces directly! ' + util.inspect(namespace));\n\n process.namespaces[name] = null;\n}\n\nfunction reset() {\n // must unregister async listeners\n if (process.namespaces) {\n Object.keys(process.namespaces).forEach(function (name) {\n destroyNamespace(name);\n });\n }\n process.namespaces = Object.create(null);\n}\n\nprocess.namespaces = {};\n\n//const fs = require('fs');\nfunction debug2(...args) {\n if (DEBUG_CLS_HOOKED) {\n //fs.writeSync(1, `${util.format(...args)}\\n`);\n process._rawDebug(`${util.format(...args)}`);\n }\n}\n\n/*function getFunctionName(fn) {\n if (!fn) {\n return fn;\n }\n if (typeof fn === 'function') {\n if (fn.name) {\n return fn.name;\n }\n return (fn.toString().trim().match(/^function\\s*([^\\s(]+)/) || [])[1];\n } else if (fn.constructor && fn.constructor.name) {\n return fn.constructor.name;\n }\n}*/\n\n\n", "\"use strict\";\nvar validLogLevels = ['debug', 'info', 'warn', 'error', 'silent'];\nvar defaultLogLevel = validLogLevels.indexOf('error');\nvar logLevel = calculateLogLevel(process.env.AWS_XRAY_DEBUG_MODE ? 'debug' : process.env.AWS_XRAY_LOG_LEVEL);\nvar logger = {\n error: createLoggerForLevel('error'),\n info: createLoggerForLevel('info'),\n warn: createLoggerForLevel('warn'),\n debug: createLoggerForLevel('debug'),\n};\nfunction createLoggerForLevel(level) {\n var loggerLevel = validLogLevels.indexOf(level);\n var consoleMethod = console[level] || console.log || (() => { });\n if (loggerLevel >= logLevel) {\n return (message, meta) => {\n if (message || meta) {\n consoleMethod(formatLogMessage(level, message, meta));\n }\n };\n }\n else {\n return () => { };\n }\n}\nfunction calculateLogLevel(level) {\n if (level) {\n var normalisedLevel = level.toLowerCase();\n var index = validLogLevels.indexOf(normalisedLevel);\n return index >= 0 ? index : defaultLogLevel;\n }\n // Silently ignore invalid log levels, default to default level\n return defaultLogLevel;\n}\nfunction createTimestamp(date) {\n var tzo = -date.getTimezoneOffset(), // Negate to make this tzo = local - UTC\n dif = tzo >= 0 ? '+' : '-', pad = function (num) {\n var norm = Math.floor(Math.abs(num));\n return (norm < 10 ? '0' : '') + norm;\n };\n return new Date(date.getTime() + (tzo * 60 * 1000)).toISOString()\n .replace(/T/, ' ')\n .replace(/Z/, ' ') +\n dif + pad(tzo / 60) +\n ':' + pad(tzo % 60);\n}\nfunction isLambdaFunction() {\n return process.env.LAMBDA_TASK_ROOT !== undefined;\n}\nfunction formatLogMessage(level, message, meta) {\n var messageParts = [];\n if (!isLambdaFunction()) {\n messageParts.push(createTimestamp(new Date()));\n messageParts.push(`[${level.toUpperCase()}]`);\n }\n if (message) {\n messageParts.push(message);\n }\n var logString = messageParts.join(' ');\n var metaDataString = formatMetaData(meta);\n return [logString, metaDataString].filter(str => str.length > 0).join('\\n ');\n}\nfunction formatMetaData(meta) {\n if (!meta) {\n return '';\n }\n return ((typeof (meta) === 'string') ? meta : JSON.stringify(meta));\n}\nvar logging = {\n setLogger: function setLogger(logObj) {\n logger = logObj;\n },\n getLogger: function getLogger() {\n return logger;\n }\n};\nmodule.exports = logging;\n", "\"use strict\";\nconst crypto = require('crypto');\n/**\n * Represents a captured exception.\n * @constructor\n * @param {Exception} err - The exception to capture.\n * @param {boolean} [remote] - Flag for whether the error was remote.\n */\nfunction CapturedException(err, remote) {\n this.init(err, remote);\n}\nCapturedException.prototype.init = function init(err, remote) {\n var e = (typeof err === 'string' || err instanceof String) ? { message: err, name: '' } : err;\n this.message = e.message;\n this.type = e.name;\n this.stack = [];\n this.remote = !!remote;\n this.id = crypto.randomBytes(8).toString('hex');\n if (e.stack) {\n var stack = e.stack.split('\\n');\n stack.shift();\n stack.forEach((stackline) => {\n var line = stackline.trim().replace(/\\(|\\)/g, '');\n line = line.substring(line.indexOf(' ') + 1);\n var label = line.lastIndexOf(' ') >= 0 ? line.slice(0, line.lastIndexOf(' ')) : null;\n var path = Array.isArray(label) && !label.length ? line : line.slice(line.lastIndexOf(' ') + 1);\n path = path.split(':');\n var entry = {\n path: path[0],\n line: parseInt(path[1]),\n label: label || 'anonymous'\n };\n this.stack.push(entry);\n }, this);\n }\n};\nmodule.exports = CapturedException;\n", "module.exports = batcher\n\nfunction batcher (run) {\n var running = false\n var pendingBatch = null\n var pendingCallbacks = null\n var callbacks = null\n\n return append\n\n function done (err) {\n if (callbacks) callAll(callbacks, err)\n\n running = false\n callbacks = pendingCallbacks\n var nextBatch = pendingBatch\n\n pendingBatch = null\n pendingCallbacks = null\n\n if (!nextBatch || !nextBatch.length) {\n if (!callbacks || !callbacks.length) {\n callbacks = null\n return\n }\n if (!nextBatch) nextBatch = []\n }\n\n running = true\n run(nextBatch, done)\n }\n\n function append (val, cb) {\n if (running) {\n if (!pendingBatch) {\n pendingBatch = []\n pendingCallbacks = []\n }\n pushAll(pendingBatch, val)\n if (cb) pendingCallbacks.push(cb)\n } else {\n if (cb) callbacks = [cb]\n running = true\n run(Array.isArray(val) ? val : [val], done)\n }\n }\n}\n\nfunction pushAll (list, val) {\n if (Array.isArray(val)) pushArray(list, val)\n else list.push(val)\n}\n\nfunction pushArray (list, val) {\n for (var i = 0; i < val.length; i++) list.push(val[i])\n}\n\nfunction callAll (list, err) {\n for (var i = 0; i < list.length; i++) list[i](err)\n}\n", "\"use strict\";\nvar logger = require('./logger');\n/**\n * A module representing the X-Ray daemon configuration including the udp and tcp addresses.\n * @module DaemonConfig\n */\nvar DaemonConfig = {\n udp_ip: '127.0.0.1',\n udp_port: 2000,\n tcp_ip: '127.0.0.1',\n tcp_port: 2000,\n setDaemonAddress: function setDaemonAddress(address) {\n if (!process.env.AWS_XRAY_DAEMON_ADDRESS) {\n processAddress(address);\n logger.getLogger().info('Configured daemon address to ' + address + '.');\n }\n else {\n logger.getLogger().warn('Ignoring call to setDaemonAddress as AWS_XRAY_DAEMON_ADDRESS is set. ' +\n 'The current daemon address will not be changed.');\n }\n }\n};\nvar processAddress = function processAddress(address) {\n if (address.indexOf(':') === -1) {\n throw new Error('Invalid Daemon Address. You must specify an ip and port.');\n }\n else {\n var splitAddress = address.split(' ');\n if (splitAddress.length === 1) {\n // in format of 127.0.0.1:2000\n if (address.indexOf('udp') > -1 || address.indexOf('tcp') > -1) {\n throw new Error('Invalid Daemon Address. You must specify both tcp and udp addresses.');\n }\n var addr = address.split(':');\n if (!addr[0]) {\n throw new Error('Invalid Daemon Address. You must specify an ip.');\n }\n DaemonConfig.udp_ip = addr[0];\n DaemonConfig.tcp_ip = addr[0];\n DaemonConfig.udp_port = addr[1];\n DaemonConfig.tcp_port = addr[1];\n }\n else if (splitAddress.length === 2) {\n // in format of udp:127.0.0.1:2000 tcp:127.0.0.1:2001\n var part_1 = splitAddress[0].split(':');\n var part_2 = splitAddress[1].split(':');\n var addr_map = {};\n addr_map[part_1[0]] = part_1;\n addr_map[part_2[0]] = part_2;\n DaemonConfig.udp_ip = addr_map['udp'][1];\n DaemonConfig.udp_port = parseInt(addr_map['udp'][2]);\n DaemonConfig.tcp_ip = addr_map['tcp'][1];\n DaemonConfig.tcp_port = parseInt(addr_map['tcp'][2]);\n if (!DaemonConfig.udp_port || !DaemonConfig.tcp_port) {\n throw new Error('Invalid Daemon Address. You must specify port number.');\n }\n }\n }\n};\nif (process.env.AWS_XRAY_DAEMON_ADDRESS) {\n processAddress(process.env.AWS_XRAY_DAEMON_ADDRESS);\n}\nmodule.exports = DaemonConfig;\n", "\"use strict\";\nvar dgram = require('dgram');\nvar batcher = require('atomic-batcher');\nvar logger = require('./logger');\nvar PROTOCOL_HEADER = '{\"format\":\"json\",\"version\":1}';\nvar PROTOCOL_DELIMITER = '\\n';\n/**\n * Sends a collection of data over a UDP socket. This method\n * is designed to be used by `atomic-batcher` as a way to share\n * a single UDP socket for sending multiple data blocks.\n *\n * @param {object} ops - Details of the data to send\n * @param {Function} callback - The function to call when done\n */\nfunction batchSendData(ops, callback) {\n var client = dgram.createSocket('udp4');\n executeSendData(client, ops, 0, function () {\n try {\n client.close();\n }\n finally {\n callback();\n }\n });\n}\n/**\n * Execute sending data starting at the specified index and\n * using the provided client.\n *\n * @param {Socket} client - Socket to send data with\n * @param {object} ops - Details of data to send\n * @param {number} index - Starting index for sending\n * @param {Function} callback - Function to call when done\n */\nfunction executeSendData(client, ops, index, callback) {\n if (index >= ops.length) {\n callback();\n return;\n }\n sendMessage(client, ops[index], function () {\n executeSendData(client, ops, index + 1, callback);\n });\n}\n/**\n * Send a single message over a UDP socket.\n *\n * @param {Socket} client - Socket to send data with\n * @param {object} data - Details of the data to send\n * @param {Function} batchCallback - Function to call when done\n */\nfunction sendMessage(client, data, batchCallback) {\n var msg = data.msg;\n var offset = data.offset;\n var length = data.length;\n var port = data.port;\n var address = data.address;\n var callback = data.callback;\n client.send(msg, offset, length, port, address, function (err) {\n try {\n callback(err);\n }\n finally {\n batchCallback();\n }\n });\n}\n/**\n * Class to mimic the Socket interface for a UDP client, but to provided\n * batching of outgoing sends using temporary Sockets that are created and\n * destroyed as needed.\n */\nfunction BatchingTemporarySocket() {\n this.batchSend = batcher(batchSendData);\n}\n/**\n * Provide the same signature as the Socket.send method but the work will be\n * batched to share temporary UDP sockets whenever possible.\n */\nBatchingTemporarySocket.prototype.send = function (msg, offset, length, port, address, callback) {\n var work = {\n msg: msg,\n offset: offset,\n length: length,\n port: port,\n address: address,\n callback: callback\n };\n this.batchSend(work);\n};\n/**\n * Segment emitter module.\n * @module SegmentEmitter\n */\nvar SegmentEmitter = {\n daemonConfig: require('./daemon_config'),\n /**\n * Returns the formatted segment JSON string.\n */\n format: function format(segment) {\n return PROTOCOL_HEADER + PROTOCOL_DELIMITER + segment.toString();\n },\n /**\n * Creates a UDP socket connection and send the formatted segment.\n * @param {Segment} segment - The segment to send to the daemon.\n */\n send: function send(segment) {\n if (!this.socket) {\n if (this.useBatchingTemporarySocket) {\n this.socket = new BatchingTemporarySocket();\n }\n else {\n this.socket = dgram.createSocket('udp4').unref();\n }\n }\n var client = this.socket;\n var formatted = segment.format();\n var data = PROTOCOL_HEADER + PROTOCOL_DELIMITER + formatted;\n var message = Buffer.from(data);\n var short = '{\"trace_id:\"' + segment.trace_id + '\",\"id\":\"' + segment.id + '\"}';\n var type = segment.type === 'subsegment' ? 'Subsegment' : 'Segment';\n client.send(message, 0, message.length, this.daemonConfig.udp_port, this.daemonConfig.udp_ip, function (err) {\n if (err) {\n if (err.code === 'EMSGSIZE') {\n logger.getLogger().error(type + ' too large to send: ' + short + ' (' + message.length + ' bytes).');\n }\n else {\n logger.getLogger().error('Error occured sending segment: ', err);\n }\n }\n else {\n logger.getLogger().debug(type + ' sent: {\"trace_id:\"' + segment.trace_id + '\",\"id\":\"' + segment.id + '\"}');\n logger.getLogger().debug('UDP message sent: ' + segment);\n }\n });\n },\n /**\n * Configures the address and/or port the daemon is expected to be on.\n * @param {string} address - Address of the daemon the segments should be sent to. Should be formatted as an IPv4 address.\n * @module SegmentEmitter\n * @function setDaemonAddress\n */\n setDaemonAddress: function setDaemonAddress(address) {\n this.daemonConfig.setDaemonAddress(address);\n },\n /**\n * Get the UDP IP the emitter is configured to.\n * @module SegmentEmitter\n * @function getIp\n */\n getIp: function getIp() {\n return this.daemonConfig.udp_ip;\n },\n /**\n * Get the UDP port the emitter is configured to.\n * @module SegmentEmitter\n * @function getPort\n */\n getPort: function getPort() {\n return this.daemonConfig.udp_port;\n },\n /**\n * Forces the segment emitter to create a new socket on send, and close it on complete.\n * @module SegmentEmitter\n * @function disableReusableSocket\n */\n disableReusableSocket: function () {\n this.useBatchingTemporarySocket = true;\n }\n};\nmodule.exports = SegmentEmitter;\n", "\"use strict\";\nvar crypto = require('crypto');\nvar logger = require('../../logger');\n/**\n * Class describing an AWS X-Ray trace ID.\n * @see https://docs.aws.amazon.com/xray/latest/devguide/xray-concepts.html#xray-concepts-traces\n */\nclass TraceID {\n /**\n * Constructs a new trace ID using the current time.\n * @param {string} [tsHex] - time stamp to use for trace ID in hexadecimal format\n * @param {string} [numberhex] - string of hexadecimal characters for random portion of Trace ID\n * @constructor\n */\n constructor(tsHex, numberhex) {\n this.version = 1;\n this.timestamp = tsHex || Math.round(new Date().getTime() / 1000).toString(16);\n this.id = numberhex || crypto.randomBytes(12).toString('hex');\n }\n /**\n * @returns {TraceID} - a hardcoded trace ID using zeroed timestamp and random ID\n */\n static Invalid() {\n return new TraceID('00000000', '000000000000000000000000');\n }\n /**\n * Constructs a new trace ID from provided string. If no string is provided or the provided string is invalid,\n * log an error but a new trace ID still returned. This can be used as a trace ID string validator.\n * @param {string} [rawID] - string to create a Trace ID object from.\n */\n static FromString(rawID) {\n const DELIMITER = '-';\n var traceID = new TraceID();\n var version, timestamp;\n if (!rawID || typeof rawID !== 'string') {\n logger.getLogger().error('Empty or non-string trace ID provided');\n return traceID;\n }\n const parts = rawID.trim().split(DELIMITER);\n if (parts.length !== 3) {\n logger.getLogger().error('Unrecognized trace ID format');\n return traceID;\n }\n version = parseInt(parts[0]);\n if (isNaN(version) || version < 1) {\n logger.getLogger().error('Trace ID version must be positive integer');\n return traceID;\n }\n timestamp = parseInt(parts[1], 16).toString(16);\n if (timestamp === 'NaN') {\n logger.getLogger().error('Trace ID timestamp must be a hex-encoded value');\n return traceID;\n }\n traceID.version = version;\n traceID.timestamp = timestamp;\n traceID.id = parts[2];\n return traceID;\n }\n /**\n * Returns a string representation of the trace ID.\n * @returns {string} - stringified trace ID, e.g. 1-57fbe041-2c7ad569f5d6ff149137be86\n */\n toString() {\n return `${this.version.toString()}-${this.timestamp}-${this.id}`;\n }\n}\nmodule.exports = TraceID;\n", "\"use strict\";\n/**\n * @module utils\n */\nvar crypto = require('crypto');\nvar logger = require('./logger');\nvar TraceID = require('./segments/attributes/trace_id');\nvar utils = {\n /**\n * Checks a HTTP response code, where 4xx are 'error' and 5xx are 'fault'.\n * @param {string} status - the HTTP response status code.\n * @returns [string] - 'error', 'fault' or nothing on no match\n * @alias module:utils.getCauseTypeFromHttpStatus\n */\n getCauseTypeFromHttpStatus: function getCauseTypeFromHttpStatus(status) {\n var stat = status.toString();\n if (stat.match(/^[4][0-9]{2}$/) !== null) {\n return 'error';\n }\n else if (stat.match(/^[5][0-9]{2}$/) !== null) {\n return 'fault';\n }\n },\n /**\n * Removes the query string parameters from a given http request path\n * as it may contain sensitive information\n *\n * Related issue: https://github.com/aws/aws-xray-sdk-node/issues/246\n *\n * Node documentation: https://nodejs.org/api/http.html#http_http_request_url_options_callback\n *\n * @param {string} path - options.path in a http.request callback\n * @returns [string] - removes query string element from path\n * @alias module:utils.stripQueryStringFromPath\n */\n stripQueryStringFromPath: function stripQueryStringFromPath(path) {\n return path ? path.split('?')[0] : '';\n },\n /**\n * Performs a case-insensitive wildcard match against two strings. This method works with pseduo-regex chars; specifically ? and * are supported.\n * An asterisk (*) represents any combination of characters\n * A question mark (?) represents any single character\n *\n * @param {string} pattern - the regex-like pattern to be compared against.\n * @param {string} text - the string to compare against the pattern.\n * @returns boolean\n * @alias module:utils.wildcardMatch\n */\n wildcardMatch: function wildcardMatch(pattern, text) {\n if (pattern === undefined || text === undefined) {\n return false;\n }\n if (pattern.length === 1 && pattern.charAt(0) === '*') {\n return true;\n }\n var patternLength = pattern.length;\n var textLength = text.length;\n var indexOfGlob = pattern.indexOf('*');\n pattern = pattern.toLowerCase();\n text = text.toLowerCase();\n // Infix globs are relatively rare, and the below search is expensive especially when\n // Balsa is used a lot. Check for infix globs and, in their absence, do the simple thing\n if (indexOfGlob === -1 || indexOfGlob === (patternLength - 1)) {\n var match = function simpleWildcardMatch() {\n var j = 0;\n for (var i = 0; i < patternLength; i++) {\n var patternChar = pattern.charAt(i);\n if (patternChar === '*') {\n // Presumption for this method is that globs only occur at end\n return true;\n }\n else if (patternChar === '?') {\n if (j === textLength) {\n return false;\n } // No character to match\n j++;\n }\n else {\n if (j >= textLength || patternChar != text.charAt(j)) {\n return false;\n }\n j++;\n }\n }\n // Ate up all the pattern and didn't end at a glob, so a match will have consumed all\n // the text\n return j === textLength;\n };\n return match();\n }\n /*\n * The matchArray[i] is used to record if there is a match between the first i chars in =\n * text and the first j chars in pattern.\n * So will return matchArray[textLength+1] in the end\n * Loop from the beginning of the pattern\n * case not '*': if text[i]==pattern[j] or pattern[j] is '?', and matchArray[i] is true,\n * set matchArray[i+1] to true, otherwise false\n * case '*': since '*' can match any globing, as long as there is a true in matchArray before i\n * all the matchArray[i+1], matchArray[i+2],...,matchArray[textLength] could be true\n */\n var matchArray = [];\n matchArray[0] = true;\n for (var j = 0; j < patternLength; j++) {\n var i;\n var patternChar = pattern.charAt(j);\n if (patternChar != '*') {\n for (i = textLength - 1; i >= 0; i--) {\n matchArray[i + 1] = !!matchArray[i] && (patternChar === '?' || (patternChar === text.charAt(i)));\n }\n }\n else {\n i = 0;\n while (i <= textLength && !matchArray[i]) {\n i++;\n }\n for (i; i <= textLength; i++) {\n matchArray[i] = true;\n }\n }\n matchArray[0] = (matchArray[0] && patternChar === '*');\n }\n return matchArray[textLength];\n },\n LambdaUtils: {\n validTraceData: function (xAmznTraceId) {\n var valid = false;\n if (xAmznTraceId) {\n var data = utils.processTraceData(xAmznTraceId);\n valid = !!(data && data.root && data.parent && data.sampled);\n }\n return valid;\n },\n /**\n * Populates trace ID, parent ID, and sampled decision of given segment. Will always populate valid values,\n * even if xAmznTraceId contains missing or invalid values. This ensures downstream services receive valid\n * headers.\n * @param {Segment} segment - Facade segment to be populated\n * @param {String} xAmznTraceId - Raw Trace Header to supply trace data\n * @returns {Boolean} - true if required fields are present and Trace ID is valid, false otherwise\n */\n populateTraceData: function (segment, xAmznTraceId) {\n logger.getLogger().debug('Lambda trace data found: ' + xAmznTraceId);\n var data = utils.processTraceData(xAmznTraceId);\n var valid = false;\n if (!data) {\n data = {};\n logger.getLogger().error('_X_AMZN_TRACE_ID is empty or has an invalid format');\n }\n else if (!data.root || !data.parent || !data.sampled) {\n logger.getLogger().error('_X_AMZN_TRACE_ID is missing required information');\n }\n else {\n valid = true;\n }\n segment.trace_id = TraceID.FromString(data.root).toString(); // Will always assign valid trace_id\n segment.id = data.parent || crypto.randomBytes(8).toString('hex');\n if (data.root && segment.trace_id !== data.root) {\n logger.getLogger().error('_X_AMZN_TRACE_ID contains invalid trace ID');\n valid = false;\n }\n if (!parseInt(data.sampled)) {\n segment.notTraced = true;\n }\n else {\n delete segment.notTraced;\n }\n logger.getLogger().debug('Segment started: ' + JSON.stringify(data));\n return valid;\n }\n },\n /**\n * Splits out the data from the trace id format. Used by the middleware.\n * @param {String} traceData - The additional trace data (typically in req.headers.x-amzn-trace-id).\n * @returns {object}\n * @alias module:mw_utils.processTraceData\n */\n processTraceData: function processTraceData(traceData) {\n var amznTraceData = {};\n var reservedKeywords = ['root', 'parent', 'sampled', 'self'];\n var remainingBytes = 256;\n if (!(typeof traceData === 'string' && traceData)) {\n return amznTraceData;\n }\n traceData.split(';').forEach(function (header) {\n if (!header) {\n return;\n }\n var pair = header.split('=');\n if (pair[0] && pair[1]) {\n var key = pair[0].trim().toLowerCase();\n var value = pair[1].trim().toLowerCase();\n var reserved = reservedKeywords.indexOf(key) !== -1;\n if (reserved) {\n amznTraceData[key] = value;\n }\n else if (!reserved && remainingBytes - (key.length + value.length) >= 0) {\n amznTraceData[key] = value;\n remainingBytes -= (key.length + value.length);\n }\n }\n });\n return amznTraceData;\n },\n /**\n * Makes a shallow copy of an object without given keys - keeps prototype\n * @param {Object} obj - The object to copy\n * @param {string[]} [keys=[]] - The keys that won't be copied\n * @param {boolean} [preservePrototype=false] - If true also copy prototype properties\n * @returns {}\n */\n objectWithoutProperties: function objectWithoutProperties(obj, keys, preservePrototype) {\n keys = Array.isArray(keys) ? keys : [];\n preservePrototype = typeof preservePrototype === 'boolean' ? preservePrototype : false;\n var target = preservePrototype ? Object.create(Object.getPrototypeOf(obj)) : {};\n for (var property in obj) {\n if (keys.indexOf(property) >= 0) {\n continue;\n }\n if (!Object.prototype.hasOwnProperty.call(obj, property)) {\n continue;\n }\n target[property] = obj[property];\n }\n return target;\n },\n /**\n * Safely gets an integer from a string or number\n * @param {String | Number} - input to cast to integer\n * @returns {Number} - Integer representation of input, or 0 if input is not castable to int\n */\n safeParseInt: (val) => {\n if (!val || isNaN(val)) {\n return 0;\n }\n return parseInt(val);\n }\n};\nmodule.exports = utils;\n", "\"use strict\";\nconst { safeParseInt } = require('../utils');\nvar logger = require('../logger');\nvar DEFAULT_STREAMING_THRESHOLD = 100;\nvar utils = {\n streamingThreshold: DEFAULT_STREAMING_THRESHOLD,\n getCurrentTime: function getCurrentTime() {\n return Date.now() / 1000;\n },\n setOrigin: function setOrigin(origin) {\n this.origin = origin;\n },\n setPluginData: function setPluginData(pluginData) {\n this.pluginData = pluginData;\n },\n setSDKData: function setSDKData(sdkData) {\n this.sdkData = sdkData;\n },\n setServiceData: function setServiceData(serviceData) {\n this.serviceData = serviceData;\n },\n /**\n * Overrides the default streaming threshold (100).\n * The threshold represents the maximum number of subsegments on a single segment before\n * the SDK beings to send the completed subsegments out of band of the main segment.\n * Reduce this threshold if you see the 'Segment too large to send' error.\n * @param {number} threshold - The new threshold to use.\n * @memberof AWSXRay\n */\n setStreamingThreshold: function setStreamingThreshold(threshold) {\n if (isFinite(threshold) && threshold >= 0) {\n utils.streamingThreshold = threshold;\n logger.getLogger().debug('Subsegment streaming threshold set to: ' + threshold);\n }\n else {\n logger.getLogger().error('Invalid threshold: ' + threshold + '. Must be a whole number >= 0.');\n }\n },\n getStreamingThreshold: function getStreamingThreshold() {\n return utils.streamingThreshold;\n },\n /**\n * Parses an HTTP response object to return an X-Ray compliant HTTP response object.\n * @param {http.ServerResponse} res\n * @returns {Object} - X-Ray response object to be added to (sub)segment\n */\n getHttpResponseData: (res) => {\n const ret = {};\n if (!res) {\n return ret;\n }\n const status = safeParseInt(res.statusCode);\n if (status !== 0) {\n ret.status = status;\n }\n if (res.headers && res.headers['content-length']) {\n ret.content_length = safeParseInt(res.headers['content-length']);\n }\n return ret;\n }\n};\nmodule.exports = utils;\n", "\"use strict\";\nconst { getHttpResponseData } = require('../segment_utils');\nvar { stripQueryStringFromPath } = require('../../utils');\n/**\n * Represents an outgoing HTTP/HTTPS call.\n * @constructor\n * @param {http.ClientRequest|https.ClientRequest} req - The request object from the HTTP/HTTPS call.\n * @param {http.IncomingMessage|https.IncomingMessage} res - The response object from the HTTP/HTTPS call.\n * @param {boolean} downstreamXRayEnabled - when true, adds a \"traced\": true hint to generated subsegments such that the AWS X-Ray service expects a corresponding segment from the downstream service.\n */\nfunction RemoteRequestData(req, res, downstreamXRayEnabled) {\n this.init(req, res, downstreamXRayEnabled);\n}\nRemoteRequestData.prototype.init = function init(req, res, downstreamXRayEnabled) {\n this.request = {\n url: (req.agent && req.agent.protocol) ? (req.agent.protocol + '//' + (req.host || req.getHeader('host')) + stripQueryStringFromPath(req.path)) : '',\n method: req.method || '',\n };\n if (downstreamXRayEnabled) {\n this.request.traced = true;\n }\n if (res) {\n this.response = getHttpResponseData(res);\n }\n};\nmodule.exports = RemoteRequestData;\n", "\"use strict\";\nvar crypto = require('crypto');\nvar CapturedException = require('./captured_exception');\nvar RemoteRequestData = require('./remote_request_data');\nvar SegmentEmitter = require('../../segment_emitter');\nvar SegmentUtils = require('../segment_utils');\nvar Utils = require('../../utils');\nvar logger = require('../../logger');\n/**\n * Represents a subsegment.\n * @constructor\n * @param {string} name - The name of the subsegment.\n */\nfunction Subsegment(name) {\n this.init(name);\n}\nSubsegment.prototype.init = function init(name) {\n if (typeof name != 'string') {\n throw new Error('Subsegment name must be of type string.');\n }\n this.id = crypto.randomBytes(8).toString('hex');\n this.name = name;\n this.start_time = SegmentUtils.getCurrentTime();\n this.in_progress = true;\n this.counter = 0;\n this.notTraced = false;\n};\n/**\n * Nests a new subsegment to the array of subsegments.\n * @param {string} name - The name of the new subsegment to append.\n * @returns {Subsegment} - The newly created subsegment.\n */\nSubsegment.prototype.addNewSubsegment = function addNewSubsegment(name) {\n const subsegment = new Subsegment(name);\n this.addSubsegment(subsegment);\n return subsegment;\n};\nSubsegment.prototype.addSubsegmentWithoutSampling = function addSubsegmentWithoutSampling(subsegment) {\n this.addSubsegment(subsegment);\n subsegment.notTraced = true;\n};\nSubsegment.prototype.addNewSubsegmentWithoutSampling = function addNewSubsegmentWithoutSampling(name) {\n const subsegment = new Subsegment(name);\n this.addSubsegment(subsegment);\n subsegment.notTraced = true;\n return subsegment;\n};\n/**\n * Adds a subsegment to the array of subsegments.\n * @param {Subsegment} subsegment - The subsegment to append.\n */\nSubsegment.prototype.addSubsegment = function (subsegment) {\n if (!(subsegment instanceof Subsegment)) {\n throw new Error('Failed to add subsegment:' + subsegment + ' to subsegment \"' + this.name +\n '\". Not a subsegment.');\n }\n if (this.subsegments === undefined) {\n this.subsegments = [];\n }\n subsegment.segment = this.segment;\n subsegment.parent = this;\n subsegment.notTraced = subsegment.parent.notTraced;\n if (subsegment.end_time === undefined) {\n this.incrementCounter(subsegment.counter);\n }\n this.subsegments.push(subsegment);\n};\n/**\n * Removes the subsegment from the subsegments array, used in subsegment streaming.\n */\nSubsegment.prototype.removeSubsegment = function removeSubsegment(subsegment) {\n if (!(subsegment instanceof Subsegment)) {\n throw new Error('Failed to remove subsegment:' + subsegment + ' from subsegment \"' + this.name +\n '\". Not a subsegment.');\n }\n if (this.subsegments !== undefined) {\n var index = this.subsegments.indexOf(subsegment);\n if (index >= 0) {\n this.subsegments.splice(index, 1);\n }\n }\n};\n/**\n * Adds a property with associated data into the subsegment.\n * @param {string} name - The name of the property to add.\n * @param {Object} data - The data of the property to add.\n */\nSubsegment.prototype.addAttribute = function addAttribute(name, data) {\n this[name] = data;\n};\n/**\n * Adds a subsegement id to record ordering.\n * @param {string} id - A subsegment id.\n */\nSubsegment.prototype.addPrecursorId = function (id) {\n if (typeof id !== 'string') {\n logger.getLogger().error('Failed to add id:' + id + ' to subsegment ' + this.name +\n '. Precursor Ids must be of type string.');\n }\n if (this.precursor_ids === undefined) {\n this.precursor_ids = [];\n }\n this.precursor_ids.push(id);\n};\n/**\n * Adds a key-value pair that can be queryable through GetTraceSummaries.\n * Only acceptable types are string, float/int and boolean.\n * @param {string} key - The name of key to add.\n * @param {boolean|string|number} value - The value to add for the given key.\n */\nSubsegment.prototype.addAnnotation = function (key, value) {\n if (typeof value !== 'boolean' && typeof value !== 'string' && !isFinite(value)) {\n logger.getLogger().error('Failed to add annotation key: ' + key + ' value: ' + value + ' to subsegment ' +\n this.name + '. Value must be of type string, number or boolean.');\n return;\n }\n if (typeof key !== 'string') {\n logger.getLogger().error('Failed to add annotation key: ' + key + ' value: ' + value + ' to subsegment ' +\n this.name + '. Key must be of type string.');\n return;\n }\n if (this.annotations === undefined) {\n this.annotations = {};\n }\n this.annotations[key] = value;\n};\n/**\n * Adds a key-value pair to the metadata.default attribute when no namespace is given.\n * Metadata is not queryable, but is recorded.\n * @param {string} key - The name of the key to add.\n * @param {object|null} value - The value of the associated key.\n * @param {string} [namespace] - The property name to put the key/value pair under.\n */\nSubsegment.prototype.addMetadata = function (key, value, namespace) {\n if (typeof key !== 'string') {\n logger.getLogger().error('Failed to add metadata key: ' + key + ' value: ' + value + ' to subsegment ' +\n this.name + '. Key must be of type string.');\n return;\n }\n if (namespace && typeof namespace !== 'string') {\n logger.getLogger().error('Failed to add metadata key: ' + key + ' value: ' + value + ' to subsegment ' +\n this.name + '. Namespace must be of type string.');\n return;\n }\n var ns = namespace || 'default';\n if (!this.metadata) {\n this.metadata = {};\n }\n if (!this.metadata[ns]) {\n this.metadata[ns] = {};\n }\n if (ns !== '__proto__') {\n this.metadata[ns][key] = value !== null && value !== undefined ? value : '';\n }\n};\nSubsegment.prototype.addSqlData = function addSqlData(sqlData) {\n this.sql = sqlData;\n};\n/**\n * Adds an error with associated data into the subsegment.\n * To handle propagating errors, the subsegment also sets a copy of the error on the\n * root segment. As the error passes up the execution stack, a reference is created\n * on each subsegment to the originating subsegment.\n * @param {Error|string} err - The error to capture.\n * @param {boolean} [remote] - Flag for whether the exception caught was remote or not.\n */\nSubsegment.prototype.addError = function addError(err, remote) {\n if (err == null || typeof err !== 'object' && typeof (err) !== 'string') {\n logger.getLogger().error('Failed to add error:' + err + ' to subsegment \"' + this.name +\n '\". Not an object or string literal.');\n return;\n }\n this.addFaultFlag();\n if (this.segment && this.segment.exception) {\n if (err === this.segment.exception.ex) {\n this.fault = true;\n this.cause = { id: this.segment.exception.cause, exceptions: [] };\n return;\n }\n delete this.segment.exception;\n }\n if (this.segment) {\n this.segment.exception = {\n ex: err,\n cause: this.id\n };\n }\n else {\n //error, cannot propagate exception if not added to segment\n }\n if (this.cause === undefined) {\n this.cause = {\n working_directory: process.cwd(),\n exceptions: []\n };\n }\n this.cause.exceptions.unshift(new CapturedException(err, remote));\n};\n/**\n * Adds data for an outgoing HTTP/HTTPS call.\n * @param {http.ClientRequest/https.ClientRequest} req - The request object from the HTTP/HTTPS call.\n * @param {http.IncomingMessage/https.IncomingMessage} res - The response object from the HTTP/HTTPS call.\n * @param {boolean} downstreamXRayEnabled - when true, adds a \"traced\": true hint to generated subsegments such that the AWS X-Ray service expects a corresponding segment from the downstream service.\n */\nSubsegment.prototype.addRemoteRequestData = function addRemoteRequestData(req, res, downstreamXRayEnabled) {\n this.http = new RemoteRequestData(req, res, downstreamXRayEnabled);\n if ('traced' in this.http.request) {\n this.traced = this.http.request.traced;\n delete this.http.request.traced;\n }\n};\n/**\n * Adds fault flag to the subsegment.\n */\nSubsegment.prototype.addFaultFlag = function addFaultFlag() {\n this.fault = true;\n};\n/**\n * Adds error flag to the subsegment.\n */\nSubsegment.prototype.addErrorFlag = function addErrorFlag() {\n this.error = true;\n};\n/**\n * Adds throttle flag to the subsegment.\n */\nSubsegment.prototype.addThrottleFlag = function addThrottleFlag() {\n this.throttle = true;\n};\n/**\n * Closes the current subsegment. This automatically captures any exceptions and sets the end time.\n * @param {Error|string} [err] - The error to capture.\n * @param {boolean} [remote] - Flag for whether the exception caught was remote or not.\n */\nSubsegment.prototype.close = function close(err, remote) {\n var root = this.segment;\n this.end_time = SegmentUtils.getCurrentTime();\n delete this.in_progress;\n if (err) {\n this.addError(err, remote);\n }\n if (this.parent) {\n this.parent.decrementCounter();\n }\n if (root && root.counter > SegmentUtils.getStreamingThreshold()) {\n if (this.streamSubsegments() && this.parent) {\n this.parent.removeSubsegment(this);\n }\n }\n};\n/**\n * Each subsegment holds a counter of open subsegments. This increments\n * the counter such that it can be called from a child and propagate up.\n * @param {Number} [additional] - An additional amount to increment. Used when adding subsegment trees.\n */\nSubsegment.prototype.incrementCounter = function incrementCounter(additional) {\n this.counter = additional ? this.counter + additional + 1 : this.counter + 1;\n if (this.parent) {\n this.parent.incrementCounter(additional);\n }\n};\n/**\n * Each subsegment holds a counter of its open subsegments. This decrements\n * the counter such that it can be called from a child and propagate up.\n */\nSubsegment.prototype.decrementCounter = function decrementCounter() {\n this.counter--;\n if (this.parent) {\n this.parent.decrementCounter();\n }\n};\n/**\n * Returns a boolean indicating whether or not the subsegment has been closed.\n * @returns {boolean} - Returns true if the subsegment is closed.\n */\nSubsegment.prototype.isClosed = function isClosed() {\n return !this.in_progress;\n};\n/**\n * Sends the subsegment to the daemon.\n */\nSubsegment.prototype.flush = function flush() {\n if (!this.parent || !this.segment) {\n logger.getLogger().error('Failed to flush subsegment: ' + this.name + '. Subsegment must be added ' +\n 'to a segment chain to flush.');\n return;\n }\n if (this.segment.trace_id) {\n if (this.segment.notTraced !== true && !this.notTraced) {\n SegmentEmitter.send(this);\n }\n else {\n logger.getLogger().debug('Ignoring flush on subsegment ' + this.id + '. Associated segment is marked as not sampled.');\n }\n }\n else {\n logger.getLogger().debug('Ignoring flush on subsegment ' + this.id + '. Associated segment is missing a trace ID.');\n }\n};\n/**\n * Returns true if the subsegment was streamed in its entirety\n */\nSubsegment.prototype.streamSubsegments = function streamSubsegments() {\n if (this.isClosed() && this.counter <= 0) {\n this.flush();\n return true;\n }\n else if (this.subsegments && this.subsegments.length > 0) {\n var open = [];\n this.subsegments.forEach(function (child) {\n if (!child.streamSubsegments()) {\n open.push(child);\n }\n });\n this.subsegments = open;\n }\n};\n/**\n * Returns the formatted, trimmed subsegment JSON string to send to the daemon.\n */\nSubsegment.prototype.format = function format() {\n this.type = 'subsegment';\n if (this.parent) {\n this.parent_id = this.parent.id;\n }\n if (this.segment) {\n this.trace_id = this.segment.trace_id;\n }\n return JSON.stringify(this);\n};\n/**\n * Returns the formatted subsegment JSON string.\n */\nSubsegment.prototype.toString = function toString() {\n return JSON.stringify(this);\n};\nSubsegment.prototype.toJSON = function toJSON() {\n var ignore = ['segment', 'parent', 'counter'];\n if (this.subsegments == null || this.subsegments.length === 0) {\n ignore.push('subsegments');\n }\n var thisCopy = Utils.objectWithoutProperties(this, ignore, false);\n return thisCopy;\n};\nmodule.exports = Subsegment;\n", "\"use strict\";\nvar crypto = require('crypto');\nvar CapturedException = require('./attributes/captured_exception');\nvar SegmentEmitter = require('../segment_emitter');\nvar SegmentUtils = require('./segment_utils');\nvar Subsegment = require('./attributes/subsegment');\nvar TraceID = require('./attributes/trace_id');\nvar Utils = require('../utils');\nvar logger = require('../logger');\n/**\n * Represents a segment.\n * @constructor\n * @param {string} name - The name of the subsegment.\n * @param {string} [rootId] - The trace ID of the spawning parent, included in the 'X-Amzn-Trace-Id' header of the incoming request. If one is not supplied, it will be generated.\n * @param {string} [parentId] - The sub/segment ID of the spawning parent, included in the 'X-Amzn-Trace-Id' header of the incoming request.\n */\nfunction Segment(name, rootId, parentId) {\n this.init(name, rootId, parentId);\n}\nSegment.prototype.init = function init(name, rootId, parentId) {\n if (typeof name != 'string') {\n throw new Error('Segment name must be of type string.');\n }\n // Validate the Trace ID\n var traceId;\n if (rootId && typeof rootId == 'string') {\n traceId = TraceID.FromString(rootId);\n }\n else {\n traceId = new TraceID();\n }\n var id = crypto.randomBytes(8).toString('hex');\n var startTime = SegmentUtils.getCurrentTime();\n this.trace_id = traceId.toString();\n this.id = id;\n this.start_time = startTime;\n this.name = name || '';\n this.in_progress = true;\n this.counter = 0;\n if (parentId) {\n this.parent_id = parentId;\n }\n if (SegmentUtils.serviceData) {\n this.setServiceData(SegmentUtils.serviceData);\n }\n if (SegmentUtils.pluginData) {\n this.addPluginData(SegmentUtils.pluginData);\n }\n if (SegmentUtils.origin) {\n this.origin = SegmentUtils.origin;\n }\n if (SegmentUtils.sdkData) {\n this.setSDKData(SegmentUtils.sdkData);\n }\n};\n/**\n * Adds incoming request data to the http block of the segment.\n * @param {IncomingRequestData} data - The data of the property to add.\n */\nSegment.prototype.addIncomingRequestData = function addIncomingRequestData(data) {\n this.http = data;\n};\n/**\n * Adds a key-value pair that can be queryable through GetTraceSummaries.\n * Only acceptable types are string, float/int and boolean.\n * @param {string} key - The name of key to add.\n * @param {boolean|string|number} value - The value to add for the given key.\n */\nSegment.prototype.addAnnotation = function addAnnotation(key, value) {\n if (typeof value !== 'boolean' && typeof value !== 'string' && !isFinite(value)) {\n logger.getLogger().error('Failed to add annotation key: ' + key + ' value: ' + value + ' to subsegment ' +\n this.name + '. Value must be of type string, number or boolean.');\n return;\n }\n if (typeof key !== 'string') {\n logger.getLogger().error('Failed to add annotation key: ' + key + ' value: ' + value + ' to subsegment ' +\n this.name + '. Key must be of type string.');\n return;\n }\n if (this.annotations === undefined) {\n this.annotations = {};\n }\n this.annotations[key] = value;\n};\n/**\n * Adds a User ID that can be queried from the X-Ray console. User ID\n * must be a string.\n * @param {string} user - The ID of the user corresponding to this segment\n */\nSegment.prototype.setUser = function (user) {\n if (typeof user !== 'string') {\n logger.getLogger().error('Set user: ' + user + ' failed. User IDs must be of type string.');\n }\n this.user = user;\n};\n/**\n * Adds a key-value pair to the metadata.default attribute when no namespace is given.\n * Metadata is not queryable, but is recorded.\n * @param {string} key - The name of the key to add.\n * @param {object|null} value - The value of the associated key.\n * @param {string} [namespace] - The property name to put the key/value pair under.\n */\nSegment.prototype.addMetadata = function (key, value, namespace) {\n if (typeof key !== 'string') {\n logger.getLogger().error('Failed to add metadata key: ' + key + ' value: ' + value + ' to segment ' +\n this.name + '. Key must be of type string.');\n return;\n }\n if (namespace && typeof namespace !== 'string') {\n logger.getLogger().error('Failed to add metadata key: ' + key + ' value: ' + value + ' to segment ' +\n this.name + '. Namespace must be of type string.');\n return;\n }\n var ns = namespace || 'default';\n if (!this.metadata) {\n this.metadata = {};\n }\n if (!this.metadata[ns]) {\n this.metadata[ns] = {};\n }\n if (ns !== '__proto__') {\n this.metadata[ns][key] = value !== null && value !== undefined ? value : '';\n }\n};\n/**\n * Adds data about the AWS X-Ray SDK onto the segment.\n * @param {Object} data - Object that contains the version of the SDK, and other information.\n */\nSegment.prototype.setSDKData = function setSDKData(data) {\n if (!data) {\n logger.getLogger().error('Add SDK data: ' + data + ' failed.' +\n 'Must not be empty.');\n return;\n }\n if (!this.aws) {\n this.aws = {};\n }\n this.aws.xray = data;\n};\nSegment.prototype.setMatchedSamplingRule = function setMatchedSamplingRule(ruleName) {\n if (this.aws) {\n this.aws = JSON.parse(JSON.stringify(this.aws));\n }\n if (this.aws && this.aws['xray']) {\n this.aws.xray['rule_name'] = ruleName;\n }\n else {\n this.aws = { xray: { 'rule_name': ruleName } };\n }\n};\n/**\n * Adds data about the service into the segment.\n * @param {Object} data - Object that contains the version of the application, and other information.\n */\nSegment.prototype.setServiceData = function setServiceData(data) {\n if (!data) {\n logger.getLogger().error('Add service data: ' + data + ' failed.' +\n 'Must not be empty.');\n return;\n }\n this.service = data;\n};\n/**\n * Adds a service with associated version data into the segment.\n * @param {Object} data - The associated AWS data.\n */\nSegment.prototype.addPluginData = function addPluginData(data) {\n if (this.aws === undefined) {\n this.aws = {};\n }\n Object.assign(this.aws, data);\n};\n/**\n * Adds a new subsegment to the array of subsegments.\n * @param {string} name - The name of the new subsegment to append.\n */\nSegment.prototype.addNewSubsegment = function addNewSubsegment(name) {\n var subsegment = new Subsegment(name);\n this.addSubsegment(subsegment);\n return subsegment;\n};\nSegment.prototype.addSubsegmentWithoutSampling = function addSubsegmentWithoutSampling(subsegment) {\n this.addSubsegment(subsegment);\n subsegment.notTraced = true;\n};\nSegment.prototype.addNewSubsegmentWithoutSampling = function addNewSubsegmentWithoutSampling(name) {\n const subsegment = new Subsegment(name);\n this.addSubsegment(subsegment);\n subsegment.notTraced = true;\n return subsegment;\n};\n/**\n * Adds a subsegment to the array of subsegments.\n * @param {Subsegment} subsegment - The subsegment to append.\n */\nSegment.prototype.addSubsegment = function addSubsegment(subsegment) {\n if (!(subsegment instanceof Subsegment)) {\n throw new Error('Cannot add subsegment: ' + subsegment + '. Not a subsegment.');\n }\n if (this.subsegments === undefined) {\n this.subsegments = [];\n }\n subsegment.segment = this;\n subsegment.parent = this;\n subsegment.notTraced = subsegment.parent.notTraced;\n this.subsegments.push(subsegment);\n if (!subsegment.end_time) {\n this.incrementCounter(subsegment.counter);\n }\n};\n/**\n * Removes the subsegment from the subsegments array, used in subsegment streaming.\n */\nSegment.prototype.removeSubsegment = function removeSubsegment(subsegment) {\n if (!(subsegment instanceof Subsegment)) {\n throw new Error('Failed to remove subsegment:' + subsegment + ' from subsegment \"' + this.name +\n '\". Not a subsegment.');\n }\n if (this.subsegments !== undefined) {\n var index = this.subsegments.indexOf(subsegment);\n if (index >= 0) {\n this.subsegments.splice(index, 1);\n }\n }\n};\n/**\n * Adds error data into the segment.\n * @param {Error|string} err - The error to capture.\n * @param {boolean} [remote] - Flag for whether the exception caught was remote or not.\n */\nSegment.prototype.addError = function addError(err, remote) {\n if (err == null || typeof err !== 'object' && typeof (err) !== 'string') {\n logger.getLogger().error('Failed to add error:' + err + ' to subsegment \"' + this.name +\n '\". Not an object or string literal.');\n return;\n }\n this.addFaultFlag();\n if (this.exception) {\n if (err === this.exception.ex) {\n this.cause = { id: this.exception.cause };\n delete this.exception;\n return;\n }\n delete this.exception;\n }\n if (this.cause === undefined) {\n this.cause = {\n working_directory: process.cwd(),\n exceptions: []\n };\n }\n this.cause.exceptions.push(new CapturedException(err, remote));\n};\n/**\n * Adds fault flag to the subsegment.\n */\nSegment.prototype.addFaultFlag = function addFaultFlag() {\n this.fault = true;\n};\n/**\n * Adds error flag to the subsegment.\n */\nSegment.prototype.addErrorFlag = function addErrorFlag() {\n this.error = true;\n};\n/**\n * Adds throttle flag to the subsegment.\n */\nSegment.prototype.addThrottleFlag = function addThrottleFlag() {\n this.throttle = true;\n};\n/**\n * Returns a boolean indicating whether or not the segment has been closed.\n * @returns {boolean} - Returns true if the subsegment is closed.\n */\nSegment.prototype.isClosed = function isClosed() {\n return !this.in_progress;\n};\n/**\n * Each segment holds a counter of open subsegments. This increments the counter.\n * @param {Number} [additional] - An additional amount to increment. Used when adding subsegment trees.\n */\nSegment.prototype.incrementCounter = function incrementCounter(additional) {\n this.counter = additional ? this.counter + additional + 1 : this.counter + 1;\n if (this.counter > SegmentUtils.streamingThreshold && this.subsegments && this.subsegments.length > 0) {\n var open = [];\n this.subsegments.forEach(function (child) {\n if (!child.streamSubsegments()) {\n open.push(child);\n }\n });\n this.subsegments = open;\n }\n};\n/**\n * Each segment holds a counter of open subsegments. This decrements\n * the counter such that it can be called from a child and propagate up.\n */\nSegment.prototype.decrementCounter = function decrementCounter() {\n this.counter--;\n if (this.counter <= 0 && this.isClosed()) {\n this.flush();\n }\n};\n/**\n * Closes the current segment. This automatically sets the end time.\n * @param {Error|string} [err] - The error to capture.\n * @param {boolean} [remote] - Flag for whether the exception caught was remote or not.\n */\nSegment.prototype.close = function (err, remote) {\n if (!this.end_time) {\n this.end_time = SegmentUtils.getCurrentTime();\n }\n if (err !== undefined) {\n this.addError(err, remote);\n }\n delete this.in_progress;\n delete this.exception;\n if (this.counter <= 0) {\n this.flush();\n }\n};\n/**\n * Sends the segment to the daemon.\n */\nSegment.prototype.flush = function flush() {\n if (this.notTraced !== true) {\n delete this.exception;\n var thisCopy = Utils.objectWithoutProperties(this, ['counter', 'notTraced'], true);\n SegmentEmitter.send(thisCopy);\n }\n};\nSegment.prototype.format = function format() {\n var ignore = ['segment', 'parent', 'counter'];\n if (this.subsegments == null || this.subsegments.length === 0) {\n ignore.push('subsegments');\n }\n var thisCopy = Utils.objectWithoutProperties(this, ignore, false);\n return JSON.stringify(thisCopy);\n};\nSegment.prototype.toString = function toString() {\n return JSON.stringify(this);\n};\nmodule.exports = Segment;\n", "\"use strict\";\n/**\n * @module context_utils\n */\nvar cls = require('cls-hooked/context');\nvar logger = require('./logger');\nvar Segment = require('./segments/segment');\nvar Subsegment = require('./segments/attributes/subsegment');\nvar cls_mode = true;\nvar NAMESPACE = 'AWSXRay';\nvar SEGMENT = 'segment';\nvar contextOverride = false;\nvar contextUtils = {\n CONTEXT_MISSING_STRATEGY: {\n RUNTIME_ERROR: {\n contextMissing: function contextMissingRuntimeError(message) {\n throw new Error(message);\n }\n },\n LOG_ERROR: {\n contextMissing: function contextMissingLogError(message) {\n var err = new Error(message);\n logger.getLogger().error(err.stack);\n }\n },\n IGNORE_ERROR: {\n contextMissing: function contextMissingIgnoreError() {\n }\n }\n },\n contextMissingStrategy: {},\n /**\n * Resolves the segment or subsegment given manual mode and params on the call required.\n * @param [Segment|Subsegment] segment - The segment manually provided via params.XraySegment, if provided.\n * @returns {Segment|Subsegment}\n * @alias module:context_utils.resolveManualSegmentParams\n */\n resolveManualSegmentParams: function resolveManualSegmentParams(params) {\n if (params && !contextUtils.isAutomaticMode()) {\n var xraySegment = params.XRaySegment || params.XraySegment;\n var segment = params.Segment;\n var found = null;\n if (xraySegment && (xraySegment instanceof Segment || xraySegment instanceof Subsegment)) {\n found = xraySegment;\n delete params.XRaySegment;\n delete params.XraySegment;\n }\n else if (segment && (segment instanceof Segment || segment instanceof Subsegment)) {\n found = segment;\n delete params.Segment;\n }\n return found;\n }\n },\n /**\n * Gets current CLS namespace for X-Ray SDK or creates one if absent.\n * @returns {Namespace}\n * @alias module:context_utils.getNamespace\n */\n getNamespace: function getNamespace() {\n return cls.getNamespace(NAMESPACE) || cls.createNamespace(NAMESPACE);\n },\n /**\n * Resolves the segment or subsegment given manual or automatic mode.\n * @param [Segment|Subsegment] segment - The segment manually provided, if provided.\n * @returns {Segment|Subsegment}\n * @alias module:context_utils.resolveSegment\n */\n resolveSegment: function resolveSegment(segment) {\n if (cls_mode) {\n return this.getSegment();\n }\n else if (segment && !cls_mode) {\n return segment;\n }\n else if (!segment && !cls_mode) {\n contextUtils.contextMissingStrategy.contextMissing('No sub/segment specified. A sub/segment must be provided for manual mode.');\n }\n },\n /**\n * Returns the current segment or subsegment. For use with in automatic mode only.\n * @returns {Segment|Subsegment}\n * @alias module:context_utils.getSegment\n */\n getSegment: function getSegment() {\n if (cls_mode) {\n var segment = contextUtils.getNamespace(NAMESPACE).get(SEGMENT);\n if (!segment) {\n contextUtils.contextMissingStrategy.contextMissing('Failed to get the current sub/segment from the context.');\n }\n else if (segment instanceof Segment && process.env.LAMBDA_TASK_ROOT && segment.facade == true) {\n segment.resolveLambdaTraceData();\n }\n return segment;\n }\n else {\n contextUtils.contextMissingStrategy.contextMissing('Cannot get sub/segment from context. Not supported in manual mode.');\n }\n },\n /**\n * Sets the current segment or subsegment. For use with in automatic mode only.\n * @param [Segment|Subsegment] segment - The sub/segment to set.\n * @returns {Segment|Subsegment}\n * @alias module:context_utils.setSegment\n */\n setSegment: function setSegment(segment) {\n if (cls_mode) {\n if (!contextUtils.getNamespace(NAMESPACE).set(SEGMENT, segment)) {\n logger.getLogger().warn('Failed to set the current sub/segment on the context.');\n }\n }\n else {\n contextUtils.contextMissingStrategy.contextMissing('Cannot set sub/segment on context. Not supported in manual mode.');\n }\n },\n /**\n * Returns true if in automatic mode, otherwise false.\n * @returns {Segment|Subsegment}\n * @alias module:context_utils.isAutomaticMode\n */\n isAutomaticMode: function isAutomaticMode() {\n return cls_mode;\n },\n /**\n * Enables automatic mode. Automatic mode uses 'cls-hooked'.\n * @see https://github.com/jeff-lewis/cls-hooked\n * @alias module:context_utils.enableAutomaticMode\n */\n enableAutomaticMode: function enableAutomaticMode() {\n cls_mode = true;\n contextUtils.getNamespace(NAMESPACE);\n logger.getLogger().debug('Overriding AWS X-Ray SDK mode. Set to automatic mode.');\n },\n /**\n * Disables automatic mode. Current segment or subsegment then must be passed manually\n * via the parent optional on captureFunc, captureAsyncFunc etc.\n * @alias module:context_utils.enableManualMode\n */\n enableManualMode: function enableManualMode() {\n cls_mode = false;\n if (cls.getNamespace(NAMESPACE)) {\n cls.destroyNamespace(NAMESPACE);\n }\n logger.getLogger().debug('Overriding AWS X-Ray SDK mode. Set to manual mode.');\n },\n /**\n * Sets the context missing strategy if no context missing strategy is set using the environment variable with\n * key AWS_XRAY_CONTEXT_MISSING. The context missing strategy's contextMissing function will be called whenever\n * trace context is not found.\n * @param {string|function} strategy - The strategy to set. Valid string values are 'LOG_ERROR' and 'RUNTIME_ERROR'.\n * Alternatively, a custom function can be supplied, which takes a error message string.\n */\n setContextMissingStrategy: function setContextMissingStrategy(strategy) {\n if (!contextOverride) {\n if (typeof strategy === 'string') {\n var lookupStrategy = contextUtils.CONTEXT_MISSING_STRATEGY[strategy.toUpperCase()];\n if (lookupStrategy) {\n contextUtils.contextMissingStrategy.contextMissing = lookupStrategy.contextMissing;\n if (process.env.AWS_XRAY_CONTEXT_MISSING) {\n logger.getLogger().debug('AWS_XRAY_CONTEXT_MISSING is set. Configured context missing strategy to ' +\n process.env.AWS_XRAY_CONTEXT_MISSING + '.');\n }\n else {\n logger.getLogger().debug('Configured context missing strategy to: ' + strategy);\n }\n }\n else {\n throw new Error('Invalid context missing strategy: ' + strategy + '. Valid values are ' +\n Object.keys(contextUtils.CONTEXT_MISSING_STRATEGY) + '.');\n }\n }\n else if (typeof strategy === 'function') {\n contextUtils.contextMissingStrategy.contextMissing = strategy;\n logger.getLogger().info('Configured custom context missing strategy to function: ' + strategy.name);\n }\n else {\n throw new Error('Context missing strategy must be either a string or a custom function.');\n }\n }\n else {\n logger.getLogger().warn('Ignoring call to setContextMissingStrategy as AWS_XRAY_CONTEXT_MISSING is set. ' +\n 'The current context missing strategy will not be changed.');\n }\n }\n};\ncls.createNamespace(NAMESPACE);\nlogger.getLogger().debug('Starting the AWS X-Ray SDK in automatic mode (default).');\nif (process.env.AWS_XRAY_CONTEXT_MISSING) {\n contextUtils.setContextMissingStrategy(process.env.AWS_XRAY_CONTEXT_MISSING);\n contextOverride = true;\n}\nelse {\n contextUtils.contextMissingStrategy.contextMissing = contextUtils.CONTEXT_MISSING_STRATEGY.RUNTIME_ERROR.contextMissing;\n logger.getLogger().debug('Using default context missing strategy: RUNTIME_ERROR');\n}\nmodule.exports = contextUtils;\n", "\"use strict\";\nvar { getHttpResponseData } = require('../segments/segment_utils');\n/**\n * Represents an incoming HTTP/HTTPS call.\n * @constructor\n * @param {http.IncomingMessage|https.IncomingMessage} req - The request object from the HTTP/HTTPS call.\n */\nfunction IncomingRequestData(req) {\n this.init(req);\n}\nIncomingRequestData.prototype.init = function init(req) {\n var forwarded = !!req.headers['x-forwarded-for'];\n var url;\n if (req.connection) {\n url = ((req.connection.secure || req.connection.encrypted) ? 'https://' : 'http://') +\n ((req.headers['host'] || '') + (req.url || ''));\n }\n this.request = {\n method: req.method || '',\n user_agent: req.headers['user-agent'] || '',\n client_ip: getClientIp(req) || '',\n url: url || '',\n };\n if (forwarded) {\n this.request.x_forwarded_for = forwarded;\n }\n};\nvar getClientIp = function getClientIp(req) {\n var clientIp;\n if (req.headers['x-forwarded-for']) {\n clientIp = (req.headers['x-forwarded-for'] || '').split(',')[0];\n }\n else if (req.connection && req.connection.remoteAddress) {\n clientIp = req.connection.remoteAddress;\n }\n else if (req.socket && req.socket.remoteAddress) {\n clientIp = req.socket.remoteAddress;\n }\n else if (req.connection && req.connection.socket && req.connection.socket.remoteAddress) {\n clientIp = req.connection.socket.remoteAddress;\n }\n return clientIp;\n};\n/**\n * Closes the local and automatically captures the response data.\n * @param {http.ServerResponse|https.ServerResponse} res - The response object from the HTTP/HTTPS call.\n */\nIncomingRequestData.prototype.close = function close(res) {\n this.response = getHttpResponseData(res);\n};\nmodule.exports = IncomingRequestData;\n", "\"use strict\";\n/**\n * Represents a LocalReservoir object that keeps track of the number of traces per second sampled and\n * the fixed rate for a given sampling rule defined locally.\n * It also decides if a given trace should be sampled or not based on the state of current second.\n * @constructor\n * @param {number} fixedTarget - An integer value to specify the maximum number of traces per second to sample.\n * @param {number} fallbackRate - A value between 0 and 1 indicating the sampling rate after the maximum traces per second has been hit.\n */\nfunction LocalReservoir(fixedTarget, fallbackRate) {\n this.init(fixedTarget, fallbackRate);\n}\nLocalReservoir.prototype.init = function init(fixedTarget, fallbackRate) {\n this.usedThisSecond = 0;\n if (typeof fixedTarget === 'number' && fixedTarget % 1 === 0 && fixedTarget >= 0) {\n this.fixedTarget = fixedTarget;\n }\n else {\n throw new Error('Error in sampling file. Rule attribute \"fixed_target\" must be a non-negative integer.');\n }\n if (typeof fallbackRate === 'number' && fallbackRate >= 0 && fallbackRate <= 1) {\n this.fallbackRate = fallbackRate;\n }\n else {\n throw new Error('Error in sampling file. Rule attribute \"rate\" must be a number between 0 and 1 inclusive.');\n }\n};\nLocalReservoir.prototype.isSampled = function isSampled() {\n var now = Math.round(new Date().getTime() / 1000);\n if (now !== this.thisSecond) {\n this.usedThisSecond = 0;\n this.thisSecond = now;\n }\n if (this.usedThisSecond >= this.fixedTarget) {\n return Math.random() < this.fallbackRate;\n }\n this.usedThisSecond++;\n return true;\n};\nmodule.exports = LocalReservoir;\n", "\"use strict\";\nvar fs = require('fs');\nvar LocalReservoir = require('./local_reservoir');\nvar Utils = require('../../utils');\nvar defaultRules = require('../../resources/default_sampling_rules.json');\nvar logger = require('../../logger');\n/**\n * The local sampler used to make sampling decisions when the decisions are absent in the incoming requests\n * and the default sampler needs to fall back on local rules. It will also be the primary sampler\n * if the default sampler is disabled.\n * @module LocalSampler\n */\nvar LocalSampler = {\n /**\n * Makes a sample decision based on the sample request.\n * @param {object} sampleRequest - Contains information for rules matching.\n * @module LocalSampler\n * @function shouldSample\n */\n shouldSample: function shouldSample(sampleRequest) {\n var host = sampleRequest.host;\n var httpMethod = sampleRequest.httpMethod;\n var urlPath = sampleRequest.urlPath;\n var formatted = '{ http_method: ' + httpMethod + ', host: ' + host + ', url_path: ' + urlPath + ' }';\n var matched;\n this.rules.some(function (rule) {\n // Any null parameters provided will be considered an implicit match.\n if (rule.default || (host == null || (Utils.wildcardMatch(rule.host, host))\n && (httpMethod == null || Utils.wildcardMatch(rule.http_method, httpMethod))\n && (urlPath == null || Utils.wildcardMatch(rule.url_path, urlPath)))) {\n matched = rule.reservoir;\n logger.getLogger().debug('Local sampling rule match found for ' + formatted + '. Matched ' + (rule.default ?\n 'default' : '{ http_method: ' + rule.http_method + ', host: ' + rule.host + ', url_path: ' +\n rule.url_path + ' }') + '. Using fixed_target: ' + matched.fixedTarget + ' and rate: ' + matched.fallbackRate + '.');\n return true;\n }\n });\n if (matched) {\n return matched.isSampled();\n }\n else {\n logger.getLogger().debug('No sampling rule matched for ' + formatted);\n return false;\n }\n },\n /**\n * Set local rules for making sampling decisions.\n * @module LocalSampler\n * @function setLocalRules\n */\n setLocalRules: function setLocalRules(source) {\n if (source) {\n if (typeof source === 'string') {\n logger.getLogger().info('Using custom sampling rules file: ' + source);\n this.rules = loadRulesConfig(JSON.parse(fs.readFileSync(source, 'utf8')));\n }\n else {\n logger.getLogger().info('Using custom sampling rules source.');\n this.rules = loadRulesConfig(source);\n }\n }\n else {\n this.rules = parseRulesConfig(defaultRules);\n }\n }\n};\nvar loadRulesConfig = function loadRulesConfig(config) {\n if (!config.version) {\n throw new Error('Error in sampling file. Missing \"version\" attribute.');\n }\n if (config.version === 1 || config.version === 2) {\n return parseRulesConfig(config);\n }\n else {\n throw new Error('Error in sampling file. Unknown version \"' + config.version + '\".');\n }\n};\nvar parseRulesConfig = function parseRulesConfig(config) {\n var defaultRule;\n var rules = [];\n if (config.default) {\n var missing = [];\n for (var key in config.default) {\n if (key !== 'fixed_target' && key !== 'rate') {\n throw new Error('Error in sampling file. Invalid attribute for default: ' + key +\n '. Valid attributes for default are \"fixed_target\" and \"rate\".');\n }\n else if (typeof config.default[key] !== 'number') {\n throw new Error('Error in sampling file. Default ' + key + ' must be a number.');\n }\n }\n if (typeof config.default.fixed_target === 'undefined') {\n missing.push('fixed_target');\n }\n if (typeof config.default.rate === 'undefined') {\n missing.push('rate');\n }\n if (missing.length !== 0) {\n throw new Error('Error in sampling file. Missing required attributes for default: ' + missing + '.');\n }\n defaultRule = { default: true, reservoir: new LocalReservoir(config.default.fixed_target, config.default.rate) };\n }\n else {\n throw new Error('Error in sampling file. Expecting \"default\" object to be defined with attributes \"fixed_target\" and \"rate\".');\n }\n if (Array.isArray(config.rules)) {\n config.rules.forEach(function (rawRule) {\n var params = {};\n var required;\n if (config.version === 2) {\n required = { host: 1, http_method: 1, url_path: 1, fixed_target: 1, rate: 1 };\n }\n if (config.version === 1) {\n required = { service_name: 1, http_method: 1, url_path: 1, fixed_target: 1, rate: 1 };\n }\n for (var key in rawRule) {\n var value = rawRule[key];\n if (!required[key] && key != 'description') {\n throw new Error('Error in sampling file. Rule ' + JSON.stringify(rawRule) + ' has invalid attribute: ' + key + '.');\n }\n else if (key != 'description' && !value && value !== 0) {\n throw new Error('Error in sampling file. Rule ' + JSON.stringify(rawRule) + ' attribute \"' + key + '\" has invalid value: ' + value + '.');\n }\n else {\n if (config.version === 2) {\n params[key] = value;\n }\n if (config.version === 1 && key === 'service_name') {\n params['host'] = value;\n }\n else {\n params[key] = value;\n }\n delete required[key];\n }\n }\n if (Object.keys(required).length !== 0 && required.constructor === Object) {\n throw new Error('Error in sampling file. Rule ' + JSON.stringify(rawRule) + ' is missing required attributes: ' + Object.keys(required) + '.');\n }\n var rule = params;\n rule.reservoir = new LocalReservoir(rawRule.fixed_target, rawRule.rate);\n rules.push(rule);\n });\n }\n rules.push(defaultRule);\n return rules;\n};\nLocalSampler.setLocalRules();\nmodule.exports = LocalSampler;\n", "\"use strict\";\n/**\n * Represents a Reservoir object that keeps track of the number of traces per second sampled and\n * the fixed rate for a given sampling rule. This information is fetched from X-Ray serivce.\n * It decides if a given trace should be borrowed or sampled or not sampled based on the state of current second.\n * @constructor\n */\nfunction Reservoir() {\n this.init();\n}\nReservoir.prototype.init = function init() {\n this.quota = null;\n this.TTL = null;\n this.takenThisSec = 0;\n this.borrowedThisSec = 0;\n this.reportInterval = 1;\n this.reportElapsed = 0;\n};\nReservoir.prototype.borrowOrTake = function borrowOrTake(now, canBorrow) {\n this.adjustThisSec(now);\n // Don't borrow if the quota is available and fresh.\n if (this.quota >= 0 && this.TTL >= now) {\n if (this.takenThisSec >= this.quota) {\n return false;\n }\n this.takenThisSec++;\n return 'take';\n }\n // Otherwise try to borrow if the quota is not present or expired.\n if (canBorrow) {\n if (this.borrowedThisSec >= 1) {\n return false;\n }\n this.borrowedThisSec++;\n return 'borrow';\n }\n};\nReservoir.prototype.adjustThisSec = function adjustThisSec(now) {\n if (now !== this.thisSec) {\n this.takenThisSec = 0;\n this.borrowedThisSec = 0;\n this.thisSec = now;\n }\n};\nReservoir.prototype.loadNewQuota = function loadNewQuota(quota, TTL, interval) {\n if (quota) {\n this.quota = quota;\n }\n if (TTL) {\n this.TTL = TTL;\n }\n if (interval) {\n this.reportInterval = interval / 10;\n } // Report interval is always time of 10.\n};\nReservoir.prototype.timeToReport = function timeToReport() {\n if (this.reportElapsed + 1 >= this.reportInterval) {\n this.reportElapsed = 0;\n return true;\n }\n else {\n this.reportElapsed += 1;\n return false;\n }\n};\nmodule.exports = Reservoir;\n", "\"use strict\";\nvar Utils = require('../../utils');\nvar Reservoir = require('./reservoir');\n/**\n * The data model for a sampling rule defined using X-Ray API CreateSamplingRules.\n * It should be only instantiated directly from the X-Ray API response.\n * @constructor\n */\nfunction SamplingRule(name, priority, rate, reservoirSize, host, httpMethod, urlPath, serviceName, serviceType) {\n this.init(name, priority, rate, reservoirSize, host, httpMethod, urlPath, serviceName, serviceType);\n}\nSamplingRule.prototype.init = function init(name, priority, rate, reservoirSize, host, httpMethod, urlPath, serviceName, serviceType) {\n this.name = name;\n this.priority = priority;\n this.rate = rate;\n this.host = host;\n this.httpMethod = httpMethod;\n this.urlPath = urlPath;\n this.serviceName = serviceName;\n this.serviceType = serviceType;\n this.reservoir = new Reservoir();\n this.borrow = !!reservoirSize;\n this.resetStatistics();\n};\nSamplingRule.prototype.match = function match(sampleRequest) {\n var host = sampleRequest.host;\n var httpMethod = sampleRequest.httpMethod;\n var serviceName = sampleRequest.serviceName;\n var urlPath = sampleRequest.urlPath;\n var serviceType = sampleRequest.serviceType;\n return this.isDefault() || (!host || Utils.wildcardMatch(this.host, host))\n && (!httpMethod || Utils.wildcardMatch(this.httpMethod, httpMethod))\n && (!serviceName || Utils.wildcardMatch(this.serviceName, serviceName))\n && (!urlPath || Utils.wildcardMatch(this.urlPath, urlPath))\n && (!serviceType || Utils.wildcardMatch(this.serviceType, serviceType));\n};\nSamplingRule.prototype.snapshotStatistics = function snapshotStatistics() {\n var statistics = {\n requestCount: this.requestCount,\n borrowCount: this.borrowCount,\n sampledCount: this.sampledCount\n };\n this.resetStatistics();\n return statistics;\n};\nSamplingRule.prototype.merge = function merge(rule) {\n this.reservoir = rule.reservoir;\n this.requestCount = rule.requestCount;\n this.borrowCount = rule.borrowCount;\n this.sampledCount = rule.sampledCount;\n rule = null; // unref the old rule so it can be garbage collected.\n};\nSamplingRule.prototype.isDefault = function isDefault() {\n return this.name === 'Default'; // \"Default\" is a reserved keyword from X-Ray back-end.\n};\nSamplingRule.prototype.incrementRequestCount = function incrementRequestCount() {\n this.requestCount++;\n};\nSamplingRule.prototype.incrementBorrowCount = function incrementBorrowCount() {\n this.borrowCount++;\n};\nSamplingRule.prototype.incrementSampledCount = function incrementSampledCount() {\n this.sampledCount++;\n};\nSamplingRule.prototype.setRate = function setRate(rate) {\n this.rate = rate;\n};\nSamplingRule.prototype.getRate = function getRate() {\n return this.rate;\n};\nSamplingRule.prototype.getName = function getName() {\n return this.name;\n};\nSamplingRule.prototype.getPriority = function getPriority() {\n return this.priority;\n};\nSamplingRule.prototype.getReservoir = function getReservoir() {\n return this.reservoir;\n};\nSamplingRule.prototype.resetStatistics = function resetStatistics() {\n this.requestCount = 0;\n this.borrowCount = 0;\n this.sampledCount = 0;\n};\nSamplingRule.prototype.canBorrow = function canBorrow() {\n return this.borrow;\n};\nSamplingRule.prototype.everMatched = function everMatched() {\n return this.requestCount > 0;\n};\nSamplingRule.prototype.timeToReport = function timeToReport() {\n return this.reservoir.timeToReport();\n};\nmodule.exports = SamplingRule;\n", "\"use strict\";\nvar crypto = require('crypto');\nvar logger = require('../../logger');\nvar SamplingRule = require('./sampling_rule');\nvar DaemonConfig = require('../../daemon_config');\nconst util = require('util');\nconst http = require('http');\n/**\n * The ServiceConnector that calls X-Ray service and convert the API response bodies to data models\n * defined in the X-Ray SDK and return them to the pollers.\n * @module ServiceConnector\n */\nvar ServiceConnector = {\n // client_id is a 12 byte cryptographically secure random hex\n // identifying the SDK instance and is generated during SDK initialization/\n // This is required when reporting sampling to X-Ray back-end.\n clientId: crypto.randomBytes(12).toString('hex'),\n samplingRulesPath: '/GetSamplingRules',\n samplingTargetsPath: '/SamplingTargets',\n logger: logger,\n httpClient: http,\n fetchSamplingRules: function fetchSamplingRules(callback) {\n const body = '{}'; // Payload needed for GetSamplingRules POST request\n const options = getOptions(this.samplingRulesPath, body.length);\n const httpReq = this.httpClient.__request ? this.httpClient.__request : this.httpClient.request;\n const req = httpReq(options, res => {\n var data = '';\n res.on('data', d => {\n data += d;\n });\n res.on('error', error => {\n callback(error);\n });\n res.on('end', () => {\n var dataObj;\n try {\n dataObj = JSON.parse(data);\n }\n catch (err) {\n callback(err);\n return;\n }\n if (!dataObj) {\n callback(new Error('AWS X-Ray GetSamplingRules API returned empty response'));\n return;\n }\n var newRules = assembleRules(dataObj);\n callback(null, newRules);\n });\n });\n req.on('error', () => {\n callback(new Error(`Failed to connect to X-Ray daemon at ${options.hostname}:${options.port} to get sampling rules.`));\n });\n req.write(body);\n req.end();\n },\n fetchTargets: function fetchTargets(rules, callback) {\n const body = JSON.stringify(constructStatisticsDocs(rules));\n const options = getOptions(this.samplingTargetsPath, body.length);\n const httpReq = this.httpClient.__request ? this.httpClient.__request : this.httpClient.request;\n const req = httpReq(options, res => {\n var data = '';\n res.on('data', d => {\n data += d;\n });\n res.on('error', error => {\n callback(error);\n });\n res.on('end', () => {\n var dataObj;\n try {\n dataObj = JSON.parse(data);\n }\n catch (err) {\n callback(err);\n return;\n }\n if (!dataObj || typeof dataObj['LastRuleModification'] != 'number') {\n callback(new Error('AWS X-Ray SamplingTargets API returned invalid response'));\n return;\n }\n var targetsMapping = assembleTargets(dataObj);\n var ruleFreshness = dateToEpoch(dataObj['LastRuleModification']);\n callback(null, targetsMapping, ruleFreshness);\n });\n });\n req.on('error', () => {\n callback(new Error(`Failed to connect to X-Ray daemon at ${options.hostname}:${options.port} to get sampling targets.`));\n });\n req.write(body);\n req.end();\n }\n};\nvar constructStatisticsDocs = function constructStatisticsDocs(rules) {\n var documents = [];\n var now = Math.floor(new Date().getTime() / 1000);\n rules.forEach(function (rule) {\n var statistics = rule.snapshotStatistics();\n var doc = {\n 'RuleName': rule.getName(),\n 'ClientID': ServiceConnector.clientId,\n 'RequestCount': statistics.requestCount,\n 'BorrowCount': statistics.borrowCount,\n 'SampledCount': statistics.sampledCount,\n 'Timestamp': now\n };\n documents.push(doc);\n });\n return { SamplingStatisticsDocuments: documents };\n};\nvar assembleRules = function assembleRules(data) {\n var newRules = [];\n var ruleList = data['SamplingRuleRecords'] || [];\n ruleList.forEach(function (ruleRecord) {\n ruleRecord = ruleRecord['SamplingRule'];\n // For forward compatibility reason right now it only\n // deals with version 1 sampling rules.\n if (isRuleValid(ruleRecord)) {\n var newRule = new SamplingRule(ruleRecord['RuleName'], ruleRecord['Priority'], ruleRecord['FixedRate'], ruleRecord['ReservoirSize'], ruleRecord['Host'], ruleRecord['HTTPMethod'], ruleRecord['URLPath'], ruleRecord['ServiceName'], ruleRecord['ServiceType']);\n newRules.push(newRule);\n }\n });\n return newRules;\n};\nvar assembleTargets = function assembleTargets(data) {\n var docs = data['SamplingTargetDocuments'] || [];\n var targetsMapping = {};\n docs.forEach(function (doc) {\n var newTarget = {\n rate: doc['FixedRate'],\n quota: doc['ReservoirQuota'],\n TTL: dateToEpoch(doc['ReservoirQuotaTTL']),\n interval: doc['Interval']\n };\n targetsMapping[doc['RuleName']] = newTarget;\n });\n return targetsMapping;\n};\nvar isRuleValid = function isRuleValid(record) {\n return record['Version'] === 1\n && record['ResourceARN'] === '*'\n && record['Attributes'] && Object.keys(record['Attributes']).length === 0\n && record['ServiceType']\n && record['RuleName']\n && record['Priority']\n && typeof record['FixedRate'] == 'number';\n};\nvar dateToEpoch = function dateToEpoch(date) {\n return new Date(date).getTime() / 1000;\n};\nvar getOptions = function getOptions(path, contentLength) {\n const options = {\n hostname: DaemonConfig.tcp_ip,\n port: DaemonConfig.tcp_port,\n method: 'POST',\n path: path,\n headers: {\n 'Content-Type': 'application/json',\n 'Content-Length': contentLength,\n 'Host': util.format('%s:%d', DaemonConfig.tcp_ip, DaemonConfig.tcp_port)\n }\n };\n return options;\n};\nmodule.exports = ServiceConnector;\n", "\"use strict\";\nvar TTL = 60 * 60; // The cache expires 1 hour after the last refresh time.\n/**\n * The rule cache that stores sampling rules fetched from X-Ray service.\n * @module RuleCache\n */\nvar RuleCache = {\n rules: [],\n lastUpdated: null,\n /**\n * Tries to find a valid rule that matches the sample request.\n * @param {object} sampleRequest - Contains information for rules matching.\n * @param {number} now - Current epoch in seconds.\n * @module RuleCache\n * @function getMatchedRule\n */\n getMatchedRule: function getMatchedRule(sampleRequest, now) {\n if (isExpired(now)) {\n return null;\n }\n var matchedRule;\n this.rules.forEach(function (rule) {\n if (!matchedRule && rule.match(sampleRequest)) {\n matchedRule = rule;\n }\n if (rule.isDefault() && !matchedRule) {\n matchedRule = rule;\n }\n });\n return matchedRule;\n },\n /**\n * Load rules fetched from X-Ray service in order sorted by priorities.\n * @param {object} rules - Newly fetched rules to load.\n * @module RuleCache\n * @function loadRules\n */\n loadRules: function loadRules(rules) {\n // Record the old rules for later merging.\n var oldRules = {};\n this.rules.forEach(function (rule) {\n oldRules[rule.getName()] = rule;\n });\n // Update the rules in the cache.\n this.rules = rules;\n // Transfer state information to refreshed rules.\n this.rules.forEach(function (rule) {\n var oldRule = oldRules[rule.getName()];\n if (oldRule) {\n rule.merge(oldRule);\n }\n });\n // The cache should maintain the order of the rules based on\n // priority. If priority is the same we sort name by alphabet\n // as rule name is unique.\n this.rules.sort(function (a, b) {\n var v = a.getPriority() - b.getPriority();\n if (v !== 0) {\n return v;\n }\n if (a.getName() > b.getName()) {\n return 1;\n }\n else {\n return -1;\n }\n });\n },\n /**\n * Load targets fetched from X-Ray service.\n * @param {object} targetsMapping - Newly fetched targets map with rule name as key.\n * @module RuleCache\n * @function loadTargets\n */\n loadTargets: function loadTargets(targetsMapping) {\n this.rules.forEach(function (rule) {\n var target = targetsMapping[rule.getName()];\n if (target) {\n rule.getReservoir().loadNewQuota(target.quota, target.TTL, target.interval);\n rule.setRate(target.rate);\n }\n });\n },\n getRules: function getRules() {\n return this.rules;\n },\n timestamp: function timestamp(now) {\n this.lastUpdated = now;\n },\n getLastUpdated: function getLastUpdated() {\n return this.lastUpdated;\n }\n};\nvar isExpired = function isExpired(now) {\n // The cache is considered expired if it is never loaded.\n if (!RuleCache.getLastUpdated()) {\n return true;\n }\n return now > RuleCache.getLastUpdated() + TTL;\n};\nmodule.exports = RuleCache;\n", "\"use strict\";\nvar logger = require('../../logger');\nvar ServiceConnector = require('./service_connector');\nvar ruleCache = require('./rule_cache');\nvar DEFAULT_INTERVAL = 5 * 60 * 1000; // 5 minutes on sampling rules fetch\n/**\n * The RulePoller that periodically fetch sampling rules from X-Ray service\n * and load them into RuleCache.\n * @module RulePoller\n */\nvar RulePoller = {\n start: function start() {\n if (this.poller) {\n clearInterval(this.poller);\n }\n // Refresh sampling rules cache with no jitter upon start.\n refresh(false);\n this.poller = setInterval(refresh, DEFAULT_INTERVAL);\n this.poller.unref();\n },\n};\nvar refresh = function refresh(jitter) {\n // Add jitter by default unless explicitly told not to.\n jitter = typeof jitter === 'undefined' ? true : jitter;\n if (jitter) {\n var delay = getJitter();\n setTimeout(refreshWithFirewall, delay);\n }\n else {\n refreshWithFirewall();\n }\n};\nvar refreshWithFirewall = function refreshWithFirewall() {\n try {\n refreshCache();\n }\n catch (e) {\n logger.getLogger().warn('Encountered unexpected exception when fetching sampling rules: ' + e);\n }\n};\nvar refreshCache = function refreshCache() {\n // Timestamp should be generated *before* the actual outbound call to ensure\n // we don't mark the cache as being fresher than it actually is.\n var now = Math.floor(new Date().getTime() / 1000);\n // Pass a callback that only runs when the new rules are\n // successfully fetched.\n ServiceConnector.fetchSamplingRules(function (err, newRules) {\n if (err) {\n logger.getLogger().warn('Failed to retrieve sampling rules from X-Ray service:', err);\n }\n else if (newRules.length !== 0) {\n ruleCache.loadRules(newRules);\n ruleCache.timestamp(now);\n logger.getLogger().info('Successfully refreshed centralized sampling rule cache.');\n }\n });\n};\n// A random jitter of up to 5 seconds is injected after every run to ensure\n// the calls eventually get evenly distributed over the 5 minute window.\nvar getJitter = function getJitter() {\n return Math.random() * 5;\n};\nmodule.exports = RulePoller;\n", "\"use strict\";\nvar rulePoller = require('./rule_poller');\nvar serviceConnector = require('./service_connector');\nvar ruleCache = require('./rule_cache');\nvar logger = require('../../logger');\nvar DEFAULT_INTERVAL = 10 * 1000; // 10 seconds on sampling targets fetch\n/**\n * The TargetPoller that periodically fetch sampling targets from X-Ray service\n * and load them into RuleCache.\n * @module TargetPoller\n */\nvar TargetPoller = {\n interval: DEFAULT_INTERVAL,\n start: function start() {\n this.poller = setInterval(refreshWithFirewall, DEFAULT_INTERVAL + getJitter());\n this.poller.unref();\n },\n};\nvar refreshWithFirewall = function refreshWithFirewall() {\n try {\n refresh();\n }\n catch (e) {\n logger.getLogger().warn('Encountered unexpected exception when fetching sampling targets: ' + e);\n }\n};\nvar refresh = function refresh() {\n var candidates = getCandidates();\n if (candidates && candidates.length > 0) {\n serviceConnector.fetchTargets(candidates, function (err, targetsMapping, ruleFreshness) {\n if (err) {\n logger.getLogger().warn('Failed to retrieve sampling targets from X-Ray service:', err);\n return;\n }\n ruleCache.loadTargets(targetsMapping);\n if (ruleFreshness > ruleCache.getLastUpdated()) {\n logger.getLogger().info('Performing out-of-band sampling rule polling to fetch updated rules.');\n rulePoller.start();\n }\n logger.getLogger().info('Successfully reported rule statistics to get new sampling quota.');\n });\n }\n};\n// Don't report a rule statistics if any of the conditions is met:\n// 1. The report time hasn't come (some rules might have larger report intervals).\n// 2. The rule is never matched.\nvar getCandidates = function getCandidates() {\n var rules = ruleCache.getRules();\n var candidates = [];\n rules.forEach(function (rule) {\n if (rule.everMatched() && rule.timeToReport()) {\n candidates.push(rule);\n }\n });\n return candidates;\n};\n// A random jitter of up to 0.1 seconds is injected after every run to ensure\n// the calls eventually get evenly distributed over the 10 second window.\nvar getJitter = function getJitter() {\n return Math.random() / TargetPoller.interval;\n};\nmodule.exports = TargetPoller;\n", "\"use strict\";\nvar logger = require('../../logger');\nconst util = require('util');\nvar SegmentUtils = require('../../segments/segment_utils');\n/**\n * The default sampler used to make sampling decisions when the decisions are absent in the incoming requests.\n * The sampler use pollers to poll sampling rules from X-Ray service.\n * @module DefaultSampler\n */\nvar DefaultSampler = {\n localSampler: require('./local_sampler'),\n rulePoller: require('./rule_poller'),\n targetPoller: require('./target_poller'),\n ruleCache: require('./rule_cache'),\n started: false,\n /**\n * Makes a sample decision based on the sample request.\n * @param {object} sampleRequest - Contains information for rules matching.\n * @module DefaultSampler\n * @function shouldSample\n */\n shouldSample: function shouldSample(sampleRequest) {\n try {\n if (!this.started) {\n this.start();\n }\n if (!sampleRequest.serviceType) {\n sampleRequest.serviceType = SegmentUtils.origin;\n }\n var now = Math.floor(new Date().getTime() / 1000);\n var matchedRule = this.ruleCache.getMatchedRule(sampleRequest, now);\n if (matchedRule) {\n logger.getLogger().debug(util.format('Rule %s is matched.', matchedRule.getName()));\n return processMatchedRule(matchedRule, now);\n }\n else {\n logger.getLogger().info('No effective centralized sampling rule match. Fallback to local rules.');\n return this.localSampler.shouldSample(sampleRequest);\n }\n }\n catch (err) {\n logger.getLogger().error('Unhandled exception by the SDK during making sampling decisions: ' + err);\n }\n },\n /**\n * Set local rules in case there is a need to fallback.\n * @module DefaultSampler\n * @function setLocalRules\n */\n setLocalRules: function setLocalRules(source) {\n this.localSampler.setLocalRules(source);\n },\n /**\n * Start the pollers to poll sampling rules and targets from X-Ray service.\n * @module DefaultSampler\n * @function start\n */\n start: function start() {\n if (!this.started) {\n this.rulePoller.start();\n this.targetPoller.start();\n this.started = true;\n }\n }\n};\nvar processMatchedRule = function processMatchedRule(rule, now) {\n // As long as a rule is matched we increment request counter.\n rule.incrementRequestCount();\n var reservoir = rule.getReservoir();\n var sample = true;\n // We check if we can borrow or take from reservoir first.\n var decision = reservoir.borrowOrTake(now, rule.canBorrow());\n if (decision === 'borrow') {\n rule.incrementBorrowCount();\n }\n else if (decision === 'take') {\n rule.incrementSampledCount();\n }\n else if (Math.random() <= rule.getRate()) {\n // Otherwise we compute based on FixedRate of this sampling rule.\n rule.incrementSampledCount();\n }\n else {\n sample = false;\n }\n if (sample) {\n return rule.getName();\n }\n else {\n return false;\n }\n};\nmodule.exports = DefaultSampler;\n", "\"use strict\";\n/**\n * Middleware Utils module.\n *\n * Exposes various configuration and helper methods to be used by the middleware.\n * @module mw_utils\n */\nvar Segment = require('../segments/segment');\nvar IncomingRequestData = require('./incoming_request_data');\nvar logger = require('../logger');\nvar coreUtils = require('../utils');\nvar wildcardMatch = require('../utils').wildcardMatch;\nvar processTraceData = require('../utils').processTraceData;\n//headers are case-insensitive\nvar XRAY_HEADER = 'x-amzn-trace-id';\nvar overrideFlag = !!process.env.AWS_XRAY_TRACING_NAME;\nvar utils = {\n defaultName: process.env.AWS_XRAY_TRACING_NAME,\n dynamicNaming: false,\n hostPattern: null,\n sampler: require('./sampling/default_sampler'),\n /**\n * Enables dynamic naming for segments via the middleware. Use 'AWSXRay.middleware.enableDynamicNaming()'.\n * @param {string} [hostPattern] - The pattern to match the host header. See the README on dynamic and fixed naming modes.\n * @alias module:mw_utils.enableDynamicNaming\n */\n enableDynamicNaming: function (hostPattern) {\n this.dynamicNaming = true;\n if (hostPattern && typeof hostPattern !== 'string') {\n throw new Error('Host pattern must be a string.');\n }\n this.hostPattern = hostPattern || null;\n },\n /**\n * Splits out the 'x-amzn-trace-id' header params from the incoming request. Used by the middleware.\n * @param {http.IncomingMessage|https.IncomingMessage} req - The request object from the incoming call.\n * @returns {object}\n * @alias module:mw_utils.processHeaders\n */\n processHeaders: function processHeaders(req) {\n var amznTraceHeader = {};\n if (req && req.headers && req.headers[XRAY_HEADER]) {\n amznTraceHeader = processTraceData(req.headers[XRAY_HEADER]);\n }\n return amznTraceHeader;\n },\n /**\n * Resolves the name of the segment as determined by fixed or dynamic mode options. Used by the middleware.\n * @param {string} hostHeader - The string from the request.headers.host property.\n * @returns {string}\n * @alias module:mw_utils.resolveName\n */\n resolveName: function resolveName(hostHeader) {\n var name;\n if (this.dynamicNaming && hostHeader) {\n name = this.hostPattern ? (wildcardMatch(this.hostPattern, hostHeader) ? hostHeader : this.defaultName) : hostHeader;\n }\n else {\n name = this.defaultName;\n }\n return name;\n },\n /**\n * Resolves the sampling decision as determined by the values given and options set. Used by the middleware.\n * @param {object} amznTraceHeader - The object as returned by the processHeaders function.\n * @param {Segment} segment - The string from the request.headers.host property.\n * @param {http.ServerResponse|https.ServerResponse} res - The response object from the incoming call.\n * @returns {boolean}\n * @alias module:mw_utils.resolveSampling\n */\n resolveSampling: function resolveSampling(amznTraceHeader, segment, res) {\n var isSampled;\n if (amznTraceHeader.sampled === '1') {\n isSampled = true;\n }\n else if (amznTraceHeader.sampled === '0') {\n isSampled = false;\n }\n else {\n var sampleRequest = {\n host: res.req.headers.host,\n httpMethod: res.req.method,\n urlPath: res.req.url,\n serviceName: segment.name\n };\n isSampled = this.sampler.shouldSample(sampleRequest);\n if (isSampled instanceof String || typeof isSampled === 'string') {\n segment.setMatchedSamplingRule(isSampled);\n isSampled = true;\n }\n }\n if (amznTraceHeader.sampled === '?') {\n res.header[XRAY_HEADER] = 'Root=' + amznTraceHeader.root + ';Sampled=' + (isSampled ? '1' : '0');\n }\n if (!isSampled) {\n segment.notTraced = true;\n }\n },\n /**\n * Sets the default name of created segments. Used with the middleware.\n * Can be overridden by the AWS_XRAY_TRACING_NAME environment variable.\n * @param {string} name - The default name for segments created in the middleware.\n * @alias module:mw_utils.setDefaultName\n */\n setDefaultName: function setDefaultName(name) {\n if (!overrideFlag) {\n this.defaultName = name;\n }\n },\n disableCentralizedSampling: function disableCentralizedSampling() {\n this.sampler = require('./sampling/local_sampler');\n },\n /**\n * Overrides the default sampling rules file to specify at what rate to sample at for specific routes.\n * The base sampling rules file can be found at /lib/resources/default_sampling_rules.json\n * @param {string|Object} source - The path to the custom sampling rules file, or the source JSON object.\n * @memberof AWSXRay\n */\n setSamplingRules: function setSamplingRules(source) {\n if (!source || source instanceof String || !(typeof source === 'string' || (source instanceof Object))) {\n throw new Error('Please specify a path to the local sampling rules file, or supply an object containing the rules.');\n }\n this.sampler.setLocalRules(source);\n },\n /**\n * Logs a debug message including core request and segment information\n * @param {string} message - The message to be logged\n * @param {string} url - The request url being traced\n * @param {Segment} - The current segment\n */\n middlewareLog: function middlewareLog(message, url, segment) {\n logger.getLogger().debug(message + ': { url: ' + url + ', name: ' + segment.name + ', trace_id: ' +\n segment.trace_id + ', id: ' + segment.id + ', sampled: ' + !segment.notTraced + ' }');\n },\n /**\n * Traces the request/response cycle of an http.IncomingMessage / http.ServerResponse pair.\n * Resolves sampling rules, creates a segment, adds the core request / response data adding\n * throttling / error / fault flags based on the response status code.\n * @param {http.IncomingMessage} req - The incoming request.\n * @param {http.ServerResponse} res - The server response.\n * @returns {Segment}\n * @memberof AWSXRay\n */\n traceRequestResponseCycle: function traceRequestResponseCycle(req, res) {\n var amznTraceHeader = this.processHeaders(req);\n var name = this.resolveName(req.headers.host);\n var segment = new Segment(name, amznTraceHeader.root, amznTraceHeader.parent);\n var responseWithEmbeddedRequest = Object.assign({}, res, { req: req });\n this.resolveSampling(amznTraceHeader, segment, responseWithEmbeddedRequest);\n segment.addIncomingRequestData(new IncomingRequestData(req));\n this.middlewareLog('Starting middleware segment', req.url, segment);\n var middlewareLog = this.middlewareLog;\n var didEnd = false;\n var endSegment = function () {\n // ensure `endSegment` is only called once\n // in some versions of node.js 10.x and in all versions of node.js 11.x and higher,\n // the 'finish' and 'close' event are BOTH triggered.\n // Previously, only one or the other was triggered:\n // https://github.com/nodejs/node/pull/20611\n if (didEnd) {\n return;\n }\n didEnd = true;\n if (res.statusCode === 429) {\n segment.addThrottleFlag();\n }\n const cause = coreUtils.getCauseTypeFromHttpStatus(res.statusCode);\n if (cause) {\n segment[cause] = true;\n }\n segment.http.close(res);\n segment.close();\n middlewareLog('Closed middleware segment successfully', req.url, segment);\n };\n res.on('finish', endSegment);\n res.on('close', endSegment);\n return segment;\n }\n};\nmodule.exports = utils;\n", "\"use strict\";\nvar contextUtils = require('../context_utils');\nvar mwUtils = require('../middleware/mw_utils');\nvar LambdaUtils = require('../utils').LambdaUtils;\nvar Segment = require('../segments/segment');\nvar SegmentEmitter = require('../segment_emitter');\nvar SegmentUtils = require('../segments/segment_utils');\nvar logger = require('../logger');\nconst TraceID = require('../segments/attributes/trace_id');\n/**\n * @namespace\n * @ignore\n */\nvar xAmznTraceIdPrev = null;\n/**\n* Used to initialize segments on AWS Lambda with extra data from the context.\n*/\nmodule.exports.init = function init() {\n contextUtils.enableManualMode = function () {\n logger.getLogger().warn('AWS Lambda does not support AWS X-Ray manual mode.');\n };\n SegmentEmitter.disableReusableSocket();\n SegmentUtils.setStreamingThreshold(0);\n /**\n * Disabling all centralized sampling in Lambda environments. The sampling decisions would be\n * uselessly applied to the facade segment, and the sampling pollers were causing errors.\n *\n * See: https://github.com/aws/aws-xray-sdk-node/issues/217\n */\n logger.getLogger().info('Disabling centralized sampling in Lambda environment.');\n mwUtils.disableCentralizedSampling();\n var namespace = contextUtils.getNamespace();\n namespace.enter(namespace.createContext());\n contextUtils.setSegment(facadeSegment());\n};\nvar facadeSegment = function facadeSegment() {\n var segment = new Segment('facade');\n var whitelistFcn = ['addNewSubsegment', 'addSubsegment', 'removeSubsegment', 'toString', 'addSubsegmentWithoutSampling', 'addNewSubsegmentWithoutSampling'];\n var silentFcn = ['incrementCounter', 'decrementCounter', 'isClosed', 'close', 'format', 'flush'];\n var xAmznTraceId = process.env._X_AMZN_TRACE_ID;\n for (var key in segment) {\n if (typeof segment[key] === 'function' && whitelistFcn.indexOf(key) === -1) {\n if (silentFcn.indexOf(key) === -1) {\n segment[key] = (function () {\n var func = key;\n return function facade() {\n logger.getLogger().warn('Function \"' + func + '\" cannot be called on an AWS Lambda segment. Please use a subsegment to record data.');\n return;\n };\n })();\n }\n else {\n segment[key] = function facade() {\n return;\n };\n }\n }\n }\n segment.trace_id = TraceID.Invalid().toString();\n segment.isClosed = function () {\n return true;\n };\n segment.in_progress = false;\n segment.counter = 1;\n segment.notTraced = true;\n segment.facade = true;\n segment.reset = function reset() {\n this.trace_id = TraceID.Invalid().toString();\n this.id = '00000000';\n delete this.subsegments;\n this.notTraced = true;\n };\n segment.resolveLambdaTraceData = function resolveLambdaTraceData() {\n var xAmznLambda = process.env._X_AMZN_TRACE_ID;\n if (xAmznLambda) {\n // This check resets the trace data whenever a new trace header is read to not leak data between invocations\n if (xAmznLambda != xAmznTraceIdPrev) {\n this.reset();\n if (LambdaUtils.populateTraceData(segment, xAmznLambda)) {\n xAmznTraceIdPrev = xAmznLambda;\n }\n }\n }\n else {\n this.reset();\n contextUtils.contextMissingStrategy.contextMissing('Missing AWS Lambda trace data for X-Ray. ' +\n 'Ensure Active Tracing is enabled and no subsegments are created outside the function handler.');\n }\n };\n // Test for valid trace data during SDK startup. It's likely we're still in the cold-start portion of the\n // code at this point and a valid trace header has not been set\n if (LambdaUtils.validTraceData(xAmznTraceId)) {\n if (LambdaUtils.populateTraceData(segment, xAmznTraceId)) {\n xAmznTraceIdPrev = xAmznTraceId;\n }\n }\n return segment;\n};\n", "\"use strict\";\nvar http = require('http');\nvar Plugin = {\n METADATA_TIMEOUT: 1000,\n /**\n * Asynchronously retrieves metadata from on-instance endpoint with an HTTP request using retries for\n * requests that time out.\n * @param {object} options - The HTTP options to make the request with\n * @param {function} callback - callback to plugin\n */\n getPluginMetadata: function (options, callback) {\n const METADATA_RETRY_TIMEOUT = 250; // Millis\n const METADATA_RETRIES = 5;\n var retries = METADATA_RETRIES;\n var getMetadata = function () {\n var httpReq = http.__request ? http.__request : http.request;\n var req = httpReq(options, function (res) {\n var body = '';\n res.on('data', function (chunk) {\n body += chunk;\n });\n res.on('end', function () {\n if (this.statusCode === 200 || this.statusCode === 300) {\n try {\n body = JSON.parse(body);\n }\n catch (e) {\n callback(e);\n return;\n }\n callback(null, body);\n }\n else if (retries > 0 && Math.floor(this.statusCode / 100) === 5) {\n retries--;\n setTimeout(getMetadata, METADATA_RETRY_TIMEOUT);\n }\n else {\n callback(new Error(`Failed to retrieve metadata with options: ${options}`));\n }\n });\n });\n req.on('error', function (err) {\n callback(err);\n });\n req.on('timeout', function () {\n req.abort();\n });\n req.setTimeout(Plugin.METADATA_TIMEOUT);\n req.end();\n };\n getMetadata();\n }\n};\nmodule.exports = Plugin;\n", "\"use strict\";\nvar Plugin = require('./plugin');\nvar logger = require('../../logger');\nvar http = require('http');\nvar EC2Plugin = {\n /**\n * A function to get the instance data from the EC2 metadata service.\n * @param {function} callback - The callback for the plugin loader.\n */\n getData: function (callback) {\n const METADATA_PATH = '/latest/dynamic/instance-identity/document';\n function populateMetadata(token) {\n const options = getOptions(METADATA_PATH, 'GET', token ? { 'X-aws-ec2-metadata-token': token } : {});\n Plugin.getPluginMetadata(options, function (err, data) {\n if (err || !data) {\n logger.getLogger().error('Error loading EC2 plugin metadata: ', err ? err.toString() : 'Could not retrieve data from IMDS.');\n callback();\n return;\n }\n const metadata = {\n ec2: {\n instance_id: data.instanceId,\n availability_zone: data.availabilityZone,\n instance_size: data.instanceType,\n ami_id: data.imageId\n }\n };\n callback(metadata);\n });\n }\n /**\n * This kicks off a requet to get a token used for requests to IMDSv2. If the request for the token\n * fails, we fall back to IMDSv1. Otherwise, the token will be used for an IMDSv2 request.\n */\n getToken(function (token) {\n if (token === null) {\n logger.getLogger().debug('EC2Plugin failed to get token from IMDSv2. Falling back to IMDSv1.');\n }\n populateMetadata(token);\n });\n },\n originName: 'AWS::EC2::Instance'\n};\n/**\n * Asynchronously retrieves a token used in requests to EC2 instance metadata service.\n * @param {function} callback - callback to plugin\n */\nfunction getToken(callback) {\n const httpReq = http.__request ? http.__request : http.request;\n const TTL = 60; //seconds\n const TOKEN_PATH = '/latest/api/token';\n const options = getOptions(TOKEN_PATH, 'PUT', {\n 'X-aws-ec2-metadata-token-ttl-seconds': TTL\n });\n let req = httpReq(options, function (res) {\n let body = '';\n res.on('data', function (chunk) {\n body += chunk;\n });\n res.on('end', function () {\n if (this.statusCode === 200 || this.statusCode === 300) {\n callback(body);\n }\n else {\n callback(null);\n }\n });\n });\n req.on('error', function () {\n callback(null);\n });\n req.on('timeout', function () {\n req.abort();\n callback(null);\n });\n req.setTimeout(Plugin.METADATA_TIMEOUT);\n req.end();\n}\nfunction getOptions(path, method, headers) {\n if (!method) {\n method = 'GET';\n }\n if (!headers) {\n headers = {};\n }\n return {\n host: '169.254.169.254',\n path: path,\n method: method,\n headers: headers\n };\n}\nmodule.exports = EC2Plugin;\n", "\"use strict\";\nvar os = require('os');\nvar ECSPlugin = {\n /**\n * A function to get the instance data from the ECS instance.\n * @param {function} callback - The callback for the plugin loader.\n */\n getData: function (callback) {\n callback({ ecs: { container: os.hostname() } });\n },\n originName: 'AWS::ECS::Container'\n};\nmodule.exports = ECSPlugin;\n", "\"use strict\";\nvar fs = require('fs');\nvar logger = require('../../logger');\nvar ENV_CONFIG_LOCATION = '/var/elasticbeanstalk/xray/environment.conf';\nvar ElasticBeanstalkPlugin = {\n /**\n * A function to get data from the Elastic Beanstalk environment configuration file.\n * @param {function} callback - The callback for the plugin loader.\n */\n getData: function (callback) {\n fs.readFile(ENV_CONFIG_LOCATION, 'utf8', function (err, rawData) {\n if (err) {\n logger.getLogger().error('Error loading Elastic Beanstalk plugin:', err.stack);\n callback();\n }\n else {\n var data = JSON.parse(rawData);\n var metadata = {\n elastic_beanstalk: {\n environment: data.environment_name,\n version_label: data.version_label,\n deployment_id: data.deployment_id\n }\n };\n callback(metadata);\n }\n });\n },\n originName: 'AWS::ElasticBeanstalk::Environment'\n};\nmodule.exports = ElasticBeanstalkPlugin;\n", "\"use strict\";\nvar fs = require('fs');\nvar logger = require('../logger');\nvar whitelist = require('../resources/aws_whitelist.json');\nvar paramTypes = {\n REQ_DESC: 'request_descriptors',\n REQ_PARAMS: 'request_parameters',\n RES_DESC: 'response_descriptors',\n RES_PARAMS: 'response_parameters'\n};\n/**\n * Represents a set of AWS services, operations and keys or params to capture.\n * @constructor\n * @param {string|Object} [source] - The location or source JSON object of the custom AWS whitelist file. If none is provided, the default file will be used.\n */\nfunction CallCapturer(source) {\n this.init(source);\n}\nCallCapturer.prototype.init = function init(source) {\n if (source) {\n if (typeof source === 'string') {\n logger.getLogger().info('Using custom AWS whitelist file: ' + source);\n this.services = loadWhitelist(JSON.parse(fs.readFileSync(source, 'utf8')));\n }\n else {\n logger.getLogger().info('Using custom AWS whitelist source.');\n this.services = loadWhitelist(source);\n }\n }\n else {\n this.services = whitelist.services;\n }\n};\nCallCapturer.prototype.append = function append(source) {\n var newServices = {};\n if (typeof source === 'string') {\n logger.getLogger().info('Appending AWS whitelist with custom file: ' + source);\n newServices = loadWhitelist(JSON.parse(fs.readFileSync(source, 'utf8')));\n }\n else {\n logger.getLogger().info('Appending AWS whitelist with a custom source.');\n newServices = loadWhitelist(source);\n }\n for (var attribute in newServices) {\n this.services[attribute] = newServices[attribute];\n }\n};\nCallCapturer.prototype.capture = function capture(serviceName, response) {\n var operation = response.request.operation;\n var call = this.services[serviceName] !== undefined ? this.services[serviceName].operations[operation] : null;\n if (call === null) {\n logger.getLogger().debug('Call \"' + serviceName + '.' + operation + '\" is not whitelisted for additional data capturing. Ignoring.');\n return;\n }\n var dataCaptured = {};\n for (var paramType in call) {\n var params = call[paramType];\n if (paramType === paramTypes.REQ_PARAMS) {\n captureCallParams(params, response.request.params, dataCaptured);\n }\n else if (paramType === paramTypes.REQ_DESC) {\n captureDescriptors(params, response.request.params, dataCaptured);\n }\n else if (paramType === paramTypes.RES_PARAMS) {\n if (response.data) {\n captureCallParams(params, response.data, dataCaptured);\n }\n }\n else if (paramType === paramTypes.RES_DESC) {\n if (response.data) {\n captureDescriptors(params, response.data, dataCaptured);\n }\n }\n else {\n logger.getLogger().error('Unknown parameter type \"' + paramType + '\". Must be \"request_descriptors\", \"response_descriptors\", ' +\n '\"request_parameters\" or \"response_parameters\".');\n }\n }\n return dataCaptured;\n};\nfunction captureCallParams(params, call, data) {\n params.forEach(function (param) {\n if (typeof call[param] !== 'undefined') {\n var formatted = toSnakeCase(param);\n this[formatted] = call[param];\n }\n }, data);\n}\nfunction captureDescriptors(descriptors, params, data) {\n for (var paramName in descriptors) {\n var attributes = descriptors[paramName];\n if (typeof params[paramName] !== 'undefined') {\n var paramData;\n if (attributes.list && attributes.get_count) {\n paramData = params[paramName] ? params[paramName].length : 0;\n }\n else {\n paramData = attributes.get_keys === true ? Object.keys(params[paramName]) : params[paramName];\n }\n if (typeof attributes.rename_to === 'string') {\n data[attributes.rename_to] = paramData;\n }\n else {\n var formatted = toSnakeCase(paramName);\n data[formatted] = paramData;\n }\n }\n }\n}\nfunction toSnakeCase(param) {\n if (param === 'IPAddress') {\n return 'ip_address';\n }\n else {\n return param.split(/(?=[A-Z])/).join('_').toLowerCase();\n }\n}\nfunction loadWhitelist(source) {\n var doc = source;\n if (doc.services === undefined) {\n throw new Error('Document formatting is incorrect. Expecting \"services\" param.');\n }\n return doc.services;\n}\nmodule.exports = CallCapturer;\n", "\"use strict\";\nvar CallCapturer = require('../../patchers/call_capturer.js');\nvar capturer = new CallCapturer();\n/**\n * Represents a AWS client call. Automatically captures data from the supplied response object,\n * Data captured depends on the whitelisting file supplied.\n * The base whitelisting file can be found at /lib/resources/aws_whitelist.json.\n * @constructor\n * @param {any} res - The response object from the AWS call. Typed as any to avoid AWS SDK dependency. Otherwise would be AWS.Response.\n * @param {string} serviceName - The service name of the AWS client.\n * @see https://github.com/aws/aws-sdk-js/blob/master/lib/response.js\n */\nfunction Aws(res, serviceName) {\n this.init(res, serviceName);\n}\nAws.prototype.init = function init(res, serviceName) {\n //TODO: account ID\n this.operation = formatOperation(res.request.operation) || '';\n if (res && res.request && res.request.httpRequest && res.request.httpRequest.region) {\n this.region = res.request.httpRequest.region;\n }\n if (res && res.requestId) {\n this.request_id = res.requestId;\n }\n this.retries = res.retryCount || 0;\n if (res.extendedRequestId && serviceName && serviceName.toLowerCase() === 's3') {\n this.id_2 = res.extendedRequestId;\n }\n if (serviceName) {\n this.addData(capturer.capture(serviceName.toLowerCase(), res));\n }\n};\nAws.prototype.addData = function addData(data) {\n for (var attribute in data) {\n this[attribute] = data[attribute];\n }\n};\n/**\n * Overrides the default whitelisting file to specify what params to capture on each AWS Service call.\n * @param {string|Object} source - The path to the custom whitelist file, or a whitelist source JSON object.\n * @exports setAWSWhitelist\n */\nvar setAWSWhitelist = function setAWSWhitelist(source) {\n if (!source || source instanceof String || !(typeof source === 'string' || (source instanceof Object))) {\n throw new Error('Please specify a path to the local whitelist file, or supply a whitelist source object.');\n }\n capturer = new CallCapturer(source);\n};\n/**\n * Appends to the default whitelisting file to specify what params to capture on each AWS Service call.\n * @param {string|Object} source - The path to the custom whitelist file, or a whitelist source JSON object.\n * @exports appendAWSWhitelist\n */\nvar appendAWSWhitelist = function appendAWSWhitelist(source) {\n if (!source || source instanceof String || !(typeof source === 'string' || (source instanceof Object))) {\n throw new Error('Please specify a path to the local whitelist file, or supply a whitelist source object.');\n }\n capturer.append(source);\n};\nfunction formatOperation(operation) {\n if (!operation) {\n return;\n }\n return operation.charAt(0).toUpperCase() + operation.slice(1);\n}\nmodule.exports = Aws;\nmodule.exports.appendAWSWhitelist = appendAWSWhitelist;\nmodule.exports.setAWSWhitelist = setAWSWhitelist;\n", "\"use strict\";\n/**\n * Capture module.\n * @module capture\n */\nvar contextUtils = require('./context_utils');\nvar logger = require('./logger');\n/**\n * Wrap to automatically capture information for the segment.\n * @param {string} name - The name of the new subsegment.\n * @param {function} fcn - The function context to wrap. Can take a single 'subsegment' argument.\n * @param {Segment|Subsegment} [parent] - The parent for the new subsegment, for manual mode.\n * @alias module:capture.captureFunc\n * @return {*} - Returns the result if any by executing the provided function.\n */\nvar captureFunc = function captureFunc(name, fcn, parent) {\n validate(name, fcn);\n var current, executeFcn;\n var parentSeg = contextUtils.resolveSegment(parent);\n if (!parentSeg) {\n logger.getLogger().warn('Failed to capture function.');\n return fcn();\n }\n current = parentSeg.addNewSubsegment(name);\n executeFcn = captureFcn(fcn, current);\n try {\n const response = executeFcn(current);\n current.close();\n return response;\n }\n catch (e) {\n current.close(e);\n throw (e);\n }\n};\n/**\n * Wrap to automatically capture information for the sub/segment. You must close the segment\n * manually from within the function.\n * @param {string} name - The name of the new subsegment.\n * @param {function} fcn - The function context to wrap. Must take a single 'subsegment' argument and call 'subsegment.close([optional error])' when the async function completes.\n * @param {Segment|Subsegment} [parent] - The parent for the new subsegment, for manual mode.\n * @alias module:capture.captureAsyncFunc\n * @return {*} - Returns a promise by executing the provided async function.\n */\nvar captureAsyncFunc = function captureAsyncFunc(name, fcn, parent) {\n validate(name, fcn);\n var current, executeFcn;\n var parentSeg = contextUtils.resolveSegment(parent);\n if (!parentSeg) {\n logger.getLogger().warn('Failed to capture async function.');\n return fcn();\n }\n current = parentSeg.addNewSubsegment(name);\n executeFcn = captureFcn(fcn, current);\n try {\n return executeFcn(current);\n }\n catch (e) {\n current.close(e);\n throw (e);\n }\n};\n/**\n * Wrap to automatically capture information for the sub/segment. This wraps the callback and returns a function.\n * when executed, all arguments are passed through accordingly. An additional argument is appended to gain access to the newly created subsegment.\n * For this reason, always call the captured callback with the full list of arguments.\n * @param {string} name - The name of the new subsegment.\n * @param {function} fcn - The function context to wrap. Can take a single 'subsegment' argument.\n * @param {Segment|Subsegment} [parent] - The parent for the new subsegment, for manual mode.\n * @alias module:capture.captureCallbackFunc\n */\nvar captureCallbackFunc = function captureCallbackFunc(name, fcn, parent) {\n validate(name, fcn);\n var base = contextUtils.resolveSegment(parent);\n if (!base) {\n logger.getLogger().warn('Failed to capture callback function.');\n return fcn;\n }\n base.incrementCounter();\n return function () {\n var parentSeg = contextUtils.resolveSegment(parent);\n var args = Array.prototype.slice.call(arguments);\n captureFunc(name, fcn.bind.apply(fcn, [null].concat(args)), parentSeg);\n base.decrementCounter();\n }.bind(this);\n};\nfunction captureFcn(fcn, current) {\n var executeFcn;\n if (contextUtils.isAutomaticMode()) {\n var session = contextUtils.getNamespace();\n var contextFcn = function () {\n var value;\n session.run(function () {\n contextUtils.setSegment(current);\n value = fcn(current);\n });\n return value;\n };\n executeFcn = contextFcn;\n }\n else {\n executeFcn = fcn;\n }\n return executeFcn;\n}\nfunction validate(name, fcn) {\n var error;\n if (!name || typeof name !== 'string') {\n error = 'Param \"name\" must be a non-empty string.';\n logger.getLogger().error(error);\n throw new Error(error);\n }\n else if (typeof fcn !== 'function') {\n error = 'Param \"fcn\" must be a function.';\n logger.getLogger().error(error);\n throw new Error(error);\n }\n}\nmodule.exports.captureFunc = captureFunc;\nmodule.exports.captureAsyncFunc = captureAsyncFunc;\nmodule.exports.captureCallbackFunc = captureCallbackFunc;\n", "exports = module.exports = SemVer\n\nvar debug\n/* istanbul ignore next */\nif (typeof process === 'object' &&\n process.env &&\n process.env.NODE_DEBUG &&\n /\\bsemver\\b/i.test(process.env.NODE_DEBUG)) {\n debug = function () {\n var args = Array.prototype.slice.call(arguments, 0)\n args.unshift('SEMVER')\n console.log.apply(console, args)\n }\n} else {\n debug = function () {}\n}\n\n// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nexports.SEMVER_SPEC_VERSION = '2.0.0'\n\nvar MAX_LENGTH = 256\nvar MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||\n /* istanbul ignore next */ 9007199254740991\n\n// Max safe segment length for coercion.\nvar MAX_SAFE_COMPONENT_LENGTH = 16\n\n// The actual regexps go on exports.re\nvar re = exports.re = []\nvar src = exports.src = []\nvar R = 0\n\n// The following Regular Expressions can be used for tokenizing,\n// validating, and parsing SemVer version strings.\n\n// ## Numeric Identifier\n// A single `0`, or a non-zero digit followed by zero or more digits.\n\nvar NUMERICIDENTIFIER = R++\nsrc[NUMERICIDENTIFIER] = '0|[1-9]\\\\d*'\nvar NUMERICIDENTIFIERLOOSE = R++\nsrc[NUMERICIDENTIFIERLOOSE] = '[0-9]+'\n\n// ## Non-numeric Identifier\n// Zero or more digits, followed by a letter or hyphen, and then zero or\n// more letters, digits, or hyphens.\n\nvar NONNUMERICIDENTIFIER = R++\nsrc[NONNUMERICIDENTIFIER] = '\\\\d*[a-zA-Z-][a-zA-Z0-9-]*'\n\n// ## Main Version\n// Three dot-separated numeric identifiers.\n\nvar MAINVERSION = R++\nsrc[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\\\.' +\n '(' + src[NUMERICIDENTIFIER] + ')\\\\.' +\n '(' + src[NUMERICIDENTIFIER] + ')'\n\nvar MAINVERSIONLOOSE = R++\nsrc[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\\\.' +\n '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\\\.' +\n '(' + src[NUMERICIDENTIFIERLOOSE] + ')'\n\n// ## Pre-release Version Identifier\n// A numeric identifier, or a non-numeric identifier.\n\nvar PRERELEASEIDENTIFIER = R++\nsrc[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] +\n '|' + src[NONNUMERICIDENTIFIER] + ')'\n\nvar PRERELEASEIDENTIFIERLOOSE = R++\nsrc[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] +\n '|' + src[NONNUMERICIDENTIFIER] + ')'\n\n// ## Pre-release Version\n// Hyphen, followed by one or more dot-separated pre-release version\n// identifiers.\n\nvar PRERELEASE = R++\nsrc[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] +\n '(?:\\\\.' + src[PRERELEASEIDENTIFIER] + ')*))'\n\nvar PRERELEASELOOSE = R++\nsrc[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] +\n '(?:\\\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))'\n\n// ## Build Metadata Identifier\n// Any combination of digits, letters, or hyphens.\n\nvar BUILDIDENTIFIER = R++\nsrc[BUILDIDENTIFIER] = '[0-9A-Za-z-]+'\n\n// ## Build Metadata\n// Plus sign, followed by one or more period-separated build metadata\n// identifiers.\n\nvar BUILD = R++\nsrc[BUILD] = '(?:\\\\+(' + src[BUILDIDENTIFIER] +\n '(?:\\\\.' + src[BUILDIDENTIFIER] + ')*))'\n\n// ## Full Version String\n// A main version, followed optionally by a pre-release version and\n// build metadata.\n\n// Note that the only major, minor, patch, and pre-release sections of\n// the version string are capturing groups. The build metadata is not a\n// capturing group, because it should not ever be used in version\n// comparison.\n\nvar FULL = R++\nvar FULLPLAIN = 'v?' + src[MAINVERSION] +\n src[PRERELEASE] + '?' +\n src[BUILD] + '?'\n\nsrc[FULL] = '^' + FULLPLAIN + '$'\n\n// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n// common in the npm registry.\nvar LOOSEPLAIN = '[v=\\\\s]*' + src[MAINVERSIONLOOSE] +\n src[PRERELEASELOOSE] + '?' +\n src[BUILD] + '?'\n\nvar LOOSE = R++\nsrc[LOOSE] = '^' + LOOSEPLAIN + '$'\n\nvar GTLT = R++\nsrc[GTLT] = '((?:<|>)?=?)'\n\n// Something like \"2.*\" or \"1.2.x\".\n// Note that \"x.x\" is a valid xRange identifer, meaning \"any version\"\n// Only the first item is strictly required.\nvar XRANGEIDENTIFIERLOOSE = R++\nsrc[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\\\*'\nvar XRANGEIDENTIFIER = R++\nsrc[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\\\*'\n\nvar XRANGEPLAIN = R++\nsrc[XRANGEPLAIN] = '[v=\\\\s]*(' + src[XRANGEIDENTIFIER] + ')' +\n '(?:\\\\.(' + src[XRANGEIDENTIFIER] + ')' +\n '(?:\\\\.(' + src[XRANGEIDENTIFIER] + ')' +\n '(?:' + src[PRERELEASE] + ')?' +\n src[BUILD] + '?' +\n ')?)?'\n\nvar XRANGEPLAINLOOSE = R++\nsrc[XRANGEPLAINLOOSE] = '[v=\\\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' +\n '(?:\\\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +\n '(?:\\\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +\n '(?:' + src[PRERELEASELOOSE] + ')?' +\n src[BUILD] + '?' +\n ')?)?'\n\nvar XRANGE = R++\nsrc[XRANGE] = '^' + src[GTLT] + '\\\\s*' + src[XRANGEPLAIN] + '$'\nvar XRANGELOOSE = R++\nsrc[XRANGELOOSE] = '^' + src[GTLT] + '\\\\s*' + src[XRANGEPLAINLOOSE] + '$'\n\n// Coercion.\n// Extract anything that could conceivably be a part of a valid semver\nvar COERCE = R++\nsrc[COERCE] = '(?:^|[^\\\\d])' +\n '(\\\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' +\n '(?:\\\\.(\\\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +\n '(?:\\\\.(\\\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +\n '(?:$|[^\\\\d])'\n\n// Tilde ranges.\n// Meaning is \"reasonably at or greater than\"\nvar LONETILDE = R++\nsrc[LONETILDE] = '(?:~>?)'\n\nvar TILDETRIM = R++\nsrc[TILDETRIM] = '(\\\\s*)' + src[LONETILDE] + '\\\\s+'\nre[TILDETRIM] = new RegExp(src[TILDETRIM], 'g')\nvar tildeTrimReplace = '$1~'\n\nvar TILDE = R++\nsrc[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$'\nvar TILDELOOSE = R++\nsrc[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$'\n\n// Caret ranges.\n// Meaning is \"at least and backwards compatible with\"\nvar LONECARET = R++\nsrc[LONECARET] = '(?:\\\\^)'\n\nvar CARETTRIM = R++\nsrc[CARETTRIM] = '(\\\\s*)' + src[LONECARET] + '\\\\s+'\nre[CARETTRIM] = new RegExp(src[CARETTRIM], 'g')\nvar caretTrimReplace = '$1^'\n\nvar CARET = R++\nsrc[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$'\nvar CARETLOOSE = R++\nsrc[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$'\n\n// A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\nvar COMPARATORLOOSE = R++\nsrc[COMPARATORLOOSE] = '^' + src[GTLT] + '\\\\s*(' + LOOSEPLAIN + ')$|^$'\nvar COMPARATOR = R++\nsrc[COMPARATOR] = '^' + src[GTLT] + '\\\\s*(' + FULLPLAIN + ')$|^$'\n\n// An expression to strip any whitespace between the gtlt and the thing\n// it modifies, so that `> 1.2.3` ==> `>1.2.3`\nvar COMPARATORTRIM = R++\nsrc[COMPARATORTRIM] = '(\\\\s*)' + src[GTLT] +\n '\\\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')'\n\n// this one has to use the /g flag\nre[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g')\nvar comparatorTrimReplace = '$1$2$3'\n\n// Something like `1.2.3 - 1.2.4`\n// Note that these all use the loose form, because they'll be\n// checked against either the strict or loose comparator form\n// later.\nvar HYPHENRANGE = R++\nsrc[HYPHENRANGE] = '^\\\\s*(' + src[XRANGEPLAIN] + ')' +\n '\\\\s+-\\\\s+' +\n '(' + src[XRANGEPLAIN] + ')' +\n '\\\\s*$'\n\nvar HYPHENRANGELOOSE = R++\nsrc[HYPHENRANGELOOSE] = '^\\\\s*(' + src[XRANGEPLAINLOOSE] + ')' +\n '\\\\s+-\\\\s+' +\n '(' + src[XRANGEPLAINLOOSE] + ')' +\n '\\\\s*$'\n\n// Star ranges basically just allow anything at all.\nvar STAR = R++\nsrc[STAR] = '(<|>)?=?\\\\s*\\\\*'\n\n// Compile to actual regexp objects.\n// All are flag-free, unless they were created above with a flag.\nfor (var i = 0; i < R; i++) {\n debug(i, src[i])\n if (!re[i]) {\n re[i] = new RegExp(src[i])\n }\n}\n\nexports.parse = parse\nfunction parse (version, options) {\n if (!options || typeof options !== 'object') {\n options = {\n loose: !!options,\n includePrerelease: false\n }\n }\n\n if (version instanceof SemVer) {\n return version\n }\n\n if (typeof version !== 'string') {\n return null\n }\n\n if (version.length > MAX_LENGTH) {\n return null\n }\n\n var r = options.loose ? re[LOOSE] : re[FULL]\n if (!r.test(version)) {\n return null\n }\n\n try {\n return new SemVer(version, options)\n } catch (er) {\n return null\n }\n}\n\nexports.valid = valid\nfunction valid (version, options) {\n var v = parse(version, options)\n return v ? v.version : null\n}\n\nexports.clean = clean\nfunction clean (version, options) {\n var s = parse(version.trim().replace(/^[=v]+/, ''), options)\n return s ? s.version : null\n}\n\nexports.SemVer = SemVer\n\nfunction SemVer (version, options) {\n if (!options || typeof options !== 'object') {\n options = {\n loose: !!options,\n includePrerelease: false\n }\n }\n if (version instanceof SemVer) {\n if (version.loose === options.loose) {\n return version\n } else {\n version = version.version\n }\n } else if (typeof version !== 'string') {\n throw new TypeError('Invalid Version: ' + version)\n }\n\n if (version.length > MAX_LENGTH) {\n throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters')\n }\n\n if (!(this instanceof SemVer)) {\n return new SemVer(version, options)\n }\n\n debug('SemVer', version, options)\n this.options = options\n this.loose = !!options.loose\n\n var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL])\n\n if (!m) {\n throw new TypeError('Invalid Version: ' + version)\n }\n\n this.raw = version\n\n // these are actually numbers\n this.major = +m[1]\n this.minor = +m[2]\n this.patch = +m[3]\n\n if (this.major > MAX_SAFE_INTEGER || this.major < 0) {\n throw new TypeError('Invalid major version')\n }\n\n if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {\n throw new TypeError('Invalid minor version')\n }\n\n if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {\n throw new TypeError('Invalid patch version')\n }\n\n // numberify any prerelease numeric ids\n if (!m[4]) {\n this.prerelease = []\n } else {\n this.prerelease = m[4].split('.').map(function (id) {\n if (/^[0-9]+$/.test(id)) {\n var num = +id\n if (num >= 0 && num < MAX_SAFE_INTEGER) {\n return num\n }\n }\n return id\n })\n }\n\n this.build = m[5] ? m[5].split('.') : []\n this.format()\n}\n\nSemVer.prototype.format = function () {\n this.version = this.major + '.' + this.minor + '.' + this.patch\n if (this.prerelease.length) {\n this.version += '-' + this.prerelease.join('.')\n }\n return this.version\n}\n\nSemVer.prototype.toString = function () {\n return this.version\n}\n\nSemVer.prototype.compare = function (other) {\n debug('SemVer.compare', this.version, this.options, other)\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n return this.compareMain(other) || this.comparePre(other)\n}\n\nSemVer.prototype.compareMain = function (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n return compareIdentifiers(this.major, other.major) ||\n compareIdentifiers(this.minor, other.minor) ||\n compareIdentifiers(this.patch, other.patch)\n}\n\nSemVer.prototype.comparePre = function (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n // NOT having a prerelease is > having one\n if (this.prerelease.length && !other.prerelease.length) {\n return -1\n } else if (!this.prerelease.length && other.prerelease.length) {\n return 1\n } else if (!this.prerelease.length && !other.prerelease.length) {\n return 0\n }\n\n var i = 0\n do {\n var a = this.prerelease[i]\n var b = other.prerelease[i]\n debug('prerelease compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n}\n\n// preminor will bump the version up to the next minor release, and immediately\n// down to pre-release. premajor and prepatch work the same way.\nSemVer.prototype.inc = function (release, identifier) {\n switch (release) {\n case 'premajor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor = 0\n this.major++\n this.inc('pre', identifier)\n break\n case 'preminor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor++\n this.inc('pre', identifier)\n break\n case 'prepatch':\n // If this is already a prerelease, it will bump to the next version\n // drop any prereleases that might already exist, since they are not\n // relevant at this point.\n this.prerelease.length = 0\n this.inc('patch', identifier)\n this.inc('pre', identifier)\n break\n // If the input is a non-prerelease version, this acts the same as\n // prepatch.\n case 'prerelease':\n if (this.prerelease.length === 0) {\n this.inc('patch', identifier)\n }\n this.inc('pre', identifier)\n break\n\n case 'major':\n // If this is a pre-major version, bump up to the same major version.\n // Otherwise increment major.\n // 1.0.0-5 bumps to 1.0.0\n // 1.1.0 bumps to 2.0.0\n if (this.minor !== 0 ||\n this.patch !== 0 ||\n this.prerelease.length === 0) {\n this.major++\n }\n this.minor = 0\n this.patch = 0\n this.prerelease = []\n break\n case 'minor':\n // If this is a pre-minor version, bump up to the same minor version.\n // Otherwise increment minor.\n // 1.2.0-5 bumps to 1.2.0\n // 1.2.1 bumps to 1.3.0\n if (this.patch !== 0 || this.prerelease.length === 0) {\n this.minor++\n }\n this.patch = 0\n this.prerelease = []\n break\n case 'patch':\n // If this is not a pre-release version, it will increment the patch.\n // If it is a pre-release it will bump up to the same patch version.\n // 1.2.0-5 patches to 1.2.0\n // 1.2.0 patches to 1.2.1\n if (this.prerelease.length === 0) {\n this.patch++\n }\n this.prerelease = []\n break\n // This probably shouldn't be used publicly.\n // 1.0.0 \"pre\" would become 1.0.0-0 which is the wrong direction.\n case 'pre':\n if (this.prerelease.length === 0) {\n this.prerelease = [0]\n } else {\n var i = this.prerelease.length\n while (--i >= 0) {\n if (typeof this.prerelease[i] === 'number') {\n this.prerelease[i]++\n i = -2\n }\n }\n if (i === -1) {\n // didn't increment anything\n this.prerelease.push(0)\n }\n }\n if (identifier) {\n // 1.2.0-beta.1 bumps to 1.2.0-beta.2,\n // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0\n if (this.prerelease[0] === identifier) {\n if (isNaN(this.prerelease[1])) {\n this.prerelease = [identifier, 0]\n }\n } else {\n this.prerelease = [identifier, 0]\n }\n }\n break\n\n default:\n throw new Error('invalid increment argument: ' + release)\n }\n this.format()\n this.raw = this.version\n return this\n}\n\nexports.inc = inc\nfunction inc (version, release, loose, identifier) {\n if (typeof (loose) === 'string') {\n identifier = loose\n loose = undefined\n }\n\n try {\n return new SemVer(version, loose).inc(release, identifier).version\n } catch (er) {\n return null\n }\n}\n\nexports.diff = diff\nfunction diff (version1, version2) {\n if (eq(version1, version2)) {\n return null\n } else {\n var v1 = parse(version1)\n var v2 = parse(version2)\n var prefix = ''\n if (v1.prerelease.length || v2.prerelease.length) {\n prefix = 'pre'\n var defaultResult = 'prerelease'\n }\n for (var key in v1) {\n if (key === 'major' || key === 'minor' || key === 'patch') {\n if (v1[key] !== v2[key]) {\n return prefix + key\n }\n }\n }\n return defaultResult // may be undefined\n }\n}\n\nexports.compareIdentifiers = compareIdentifiers\n\nvar numeric = /^[0-9]+$/\nfunction compareIdentifiers (a, b) {\n var anum = numeric.test(a)\n var bnum = numeric.test(b)\n\n if (anum && bnum) {\n a = +a\n b = +b\n }\n\n return a === b ? 0\n : (anum && !bnum) ? -1\n : (bnum && !anum) ? 1\n : a < b ? -1\n : 1\n}\n\nexports.rcompareIdentifiers = rcompareIdentifiers\nfunction rcompareIdentifiers (a, b) {\n return compareIdentifiers(b, a)\n}\n\nexports.major = major\nfunction major (a, loose) {\n return new SemVer(a, loose).major\n}\n\nexports.minor = minor\nfunction minor (a, loose) {\n return new SemVer(a, loose).minor\n}\n\nexports.patch = patch\nfunction patch (a, loose) {\n return new SemVer(a, loose).patch\n}\n\nexports.compare = compare\nfunction compare (a, b, loose) {\n return new SemVer(a, loose).compare(new SemVer(b, loose))\n}\n\nexports.compareLoose = compareLoose\nfunction compareLoose (a, b) {\n return compare(a, b, true)\n}\n\nexports.rcompare = rcompare\nfunction rcompare (a, b, loose) {\n return compare(b, a, loose)\n}\n\nexports.sort = sort\nfunction sort (list, loose) {\n return list.sort(function (a, b) {\n return exports.compare(a, b, loose)\n })\n}\n\nexports.rsort = rsort\nfunction rsort (list, loose) {\n return list.sort(function (a, b) {\n return exports.rcompare(a, b, loose)\n })\n}\n\nexports.gt = gt\nfunction gt (a, b, loose) {\n return compare(a, b, loose) > 0\n}\n\nexports.lt = lt\nfunction lt (a, b, loose) {\n return compare(a, b, loose) < 0\n}\n\nexports.eq = eq\nfunction eq (a, b, loose) {\n return compare(a, b, loose) === 0\n}\n\nexports.neq = neq\nfunction neq (a, b, loose) {\n return compare(a, b, loose) !== 0\n}\n\nexports.gte = gte\nfunction gte (a, b, loose) {\n return compare(a, b, loose) >= 0\n}\n\nexports.lte = lte\nfunction lte (a, b, loose) {\n return compare(a, b, loose) <= 0\n}\n\nexports.cmp = cmp\nfunction cmp (a, op, b, loose) {\n switch (op) {\n case '===':\n if (typeof a === 'object')\n a = a.version\n if (typeof b === 'object')\n b = b.version\n return a === b\n\n case '!==':\n if (typeof a === 'object')\n a = a.version\n if (typeof b === 'object')\n b = b.version\n return a !== b\n\n case '':\n case '=':\n case '==':\n return eq(a, b, loose)\n\n case '!=':\n return neq(a, b, loose)\n\n case '>':\n return gt(a, b, loose)\n\n case '>=':\n return gte(a, b, loose)\n\n case '<':\n return lt(a, b, loose)\n\n case '<=':\n return lte(a, b, loose)\n\n default:\n throw new TypeError('Invalid operator: ' + op)\n }\n}\n\nexports.Comparator = Comparator\nfunction Comparator (comp, options) {\n if (!options || typeof options !== 'object') {\n options = {\n loose: !!options,\n includePrerelease: false\n }\n }\n\n if (comp instanceof Comparator) {\n if (comp.loose === !!options.loose) {\n return comp\n } else {\n comp = comp.value\n }\n }\n\n if (!(this instanceof Comparator)) {\n return new Comparator(comp, options)\n }\n\n debug('comparator', comp, options)\n this.options = options\n this.loose = !!options.loose\n this.parse(comp)\n\n if (this.semver === ANY) {\n this.value = ''\n } else {\n this.value = this.operator + this.semver.version\n }\n\n debug('comp', this)\n}\n\nvar ANY = {}\nComparator.prototype.parse = function (comp) {\n var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR]\n var m = comp.match(r)\n\n if (!m) {\n throw new TypeError('Invalid comparator: ' + comp)\n }\n\n this.operator = m[1]\n if (this.operator === '=') {\n this.operator = ''\n }\n\n // if it literally is just '>' or '' then allow anything.\n if (!m[2]) {\n this.semver = ANY\n } else {\n this.semver = new SemVer(m[2], this.options.loose)\n }\n}\n\nComparator.prototype.toString = function () {\n return this.value\n}\n\nComparator.prototype.test = function (version) {\n debug('Comparator.test', version, this.options.loose)\n\n if (this.semver === ANY) {\n return true\n }\n\n if (typeof version === 'string') {\n version = new SemVer(version, this.options)\n }\n\n return cmp(version, this.operator, this.semver, this.options)\n}\n\nComparator.prototype.intersects = function (comp, options) {\n if (!(comp instanceof Comparator)) {\n throw new TypeError('a Comparator is required')\n }\n\n if (!options || typeof options !== 'object') {\n options = {\n loose: !!options,\n includePrerelease: false\n }\n }\n\n var rangeTmp\n\n if (this.operator === '') {\n rangeTmp = new Range(comp.value, options)\n return satisfies(this.value, rangeTmp, options)\n } else if (comp.operator === '') {\n rangeTmp = new Range(this.value, options)\n return satisfies(comp.semver, rangeTmp, options)\n }\n\n var sameDirectionIncreasing =\n (this.operator === '>=' || this.operator === '>') &&\n (comp.operator === '>=' || comp.operator === '>')\n var sameDirectionDecreasing =\n (this.operator === '<=' || this.operator === '<') &&\n (comp.operator === '<=' || comp.operator === '<')\n var sameSemVer = this.semver.version === comp.semver.version\n var differentDirectionsInclusive =\n (this.operator === '>=' || this.operator === '<=') &&\n (comp.operator === '>=' || comp.operator === '<=')\n var oppositeDirectionsLessThan =\n cmp(this.semver, '<', comp.semver, options) &&\n ((this.operator === '>=' || this.operator === '>') &&\n (comp.operator === '<=' || comp.operator === '<'))\n var oppositeDirectionsGreaterThan =\n cmp(this.semver, '>', comp.semver, options) &&\n ((this.operator === '<=' || this.operator === '<') &&\n (comp.operator === '>=' || comp.operator === '>'))\n\n return sameDirectionIncreasing || sameDirectionDecreasing ||\n (sameSemVer && differentDirectionsInclusive) ||\n oppositeDirectionsLessThan || oppositeDirectionsGreaterThan\n}\n\nexports.Range = Range\nfunction Range (range, options) {\n if (!options || typeof options !== 'object') {\n options = {\n loose: !!options,\n includePrerelease: false\n }\n }\n\n if (range instanceof Range) {\n if (range.loose === !!options.loose &&\n range.includePrerelease === !!options.includePrerelease) {\n return range\n } else {\n return new Range(range.raw, options)\n }\n }\n\n if (range instanceof Comparator) {\n return new Range(range.value, options)\n }\n\n if (!(this instanceof Range)) {\n return new Range(range, options)\n }\n\n this.options = options\n this.loose = !!options.loose\n this.includePrerelease = !!options.includePrerelease\n\n // First, split based on boolean or ||\n this.raw = range\n this.set = range.split(/\\s*\\|\\|\\s*/).map(function (range) {\n return this.parseRange(range.trim())\n }, this).filter(function (c) {\n // throw out any that are not relevant for whatever reason\n return c.length\n })\n\n if (!this.set.length) {\n throw new TypeError('Invalid SemVer Range: ' + range)\n }\n\n this.format()\n}\n\nRange.prototype.format = function () {\n this.range = this.set.map(function (comps) {\n return comps.join(' ').trim()\n }).join('||').trim()\n return this.range\n}\n\nRange.prototype.toString = function () {\n return this.range\n}\n\nRange.prototype.parseRange = function (range) {\n var loose = this.options.loose\n range = range.trim()\n // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE]\n range = range.replace(hr, hyphenReplace)\n debug('hyphen replace', range)\n // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace)\n debug('comparator trim', range, re[COMPARATORTRIM])\n\n // `~ 1.2.3` => `~1.2.3`\n range = range.replace(re[TILDETRIM], tildeTrimReplace)\n\n // `^ 1.2.3` => `^1.2.3`\n range = range.replace(re[CARETTRIM], caretTrimReplace)\n\n // normalize spaces\n range = range.split(/\\s+/).join(' ')\n\n // At this point, the range is completely trimmed and\n // ready to be split into comparators.\n\n var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR]\n var set = range.split(' ').map(function (comp) {\n return parseComparator(comp, this.options)\n }, this).join(' ').split(/\\s+/)\n if (this.options.loose) {\n // in loose mode, throw out any that are not valid comparators\n set = set.filter(function (comp) {\n return !!comp.match(compRe)\n })\n }\n set = set.map(function (comp) {\n return new Comparator(comp, this.options)\n }, this)\n\n return set\n}\n\nRange.prototype.intersects = function (range, options) {\n if (!(range instanceof Range)) {\n throw new TypeError('a Range is required')\n }\n\n return this.set.some(function (thisComparators) {\n return thisComparators.every(function (thisComparator) {\n return range.set.some(function (rangeComparators) {\n return rangeComparators.every(function (rangeComparator) {\n return thisComparator.intersects(rangeComparator, options)\n })\n })\n })\n })\n}\n\n// Mostly just for testing and legacy API reasons\nexports.toComparators = toComparators\nfunction toComparators (range, options) {\n return new Range(range, options).set.map(function (comp) {\n return comp.map(function (c) {\n return c.value\n }).join(' ').trim().split(' ')\n })\n}\n\n// comprised of xranges, tildes, stars, and gtlt's at this point.\n// already replaced the hyphen ranges\n// turn into a set of JUST comparators.\nfunction parseComparator (comp, options) {\n debug('comp', comp, options)\n comp = replaceCarets(comp, options)\n debug('caret', comp)\n comp = replaceTildes(comp, options)\n debug('tildes', comp)\n comp = replaceXRanges(comp, options)\n debug('xrange', comp)\n comp = replaceStars(comp, options)\n debug('stars', comp)\n return comp\n}\n\nfunction isX (id) {\n return !id || id.toLowerCase() === 'x' || id === '*'\n}\n\n// ~, ~> --> * (any, kinda silly)\n// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0\n// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0\n// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0\n// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0\n// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0\nfunction replaceTildes (comp, options) {\n return comp.trim().split(/\\s+/).map(function (comp) {\n return replaceTilde(comp, options)\n }).join(' ')\n}\n\nfunction replaceTilde (comp, options) {\n var r = options.loose ? re[TILDELOOSE] : re[TILDE]\n return comp.replace(r, function (_, M, m, p, pr) {\n debug('tilde', comp, _, M, m, p, pr)\n var ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'\n } else if (isX(p)) {\n // ~1.2 == >=1.2.0 <1.3.0\n ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'\n } else if (pr) {\n debug('replaceTilde pr', pr)\n ret = '>=' + M + '.' + m + '.' + p + '-' + pr +\n ' <' + M + '.' + (+m + 1) + '.0'\n } else {\n // ~1.2.3 == >=1.2.3 <1.3.0\n ret = '>=' + M + '.' + m + '.' + p +\n ' <' + M + '.' + (+m + 1) + '.0'\n }\n\n debug('tilde return', ret)\n return ret\n })\n}\n\n// ^ --> * (any, kinda silly)\n// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0\n// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0\n// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0\n// ^1.2.3 --> >=1.2.3 <2.0.0\n// ^1.2.0 --> >=1.2.0 <2.0.0\nfunction replaceCarets (comp, options) {\n return comp.trim().split(/\\s+/).map(function (comp) {\n return replaceCaret(comp, options)\n }).join(' ')\n}\n\nfunction replaceCaret (comp, options) {\n debug('caret', comp, options)\n var r = options.loose ? re[CARETLOOSE] : re[CARET]\n return comp.replace(r, function (_, M, m, p, pr) {\n debug('caret', comp, _, M, m, p, pr)\n var ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'\n } else if (isX(p)) {\n if (M === '0') {\n ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'\n } else {\n ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'\n }\n } else if (pr) {\n debug('replaceCaret pr', pr)\n if (M === '0') {\n if (m === '0') {\n ret = '>=' + M + '.' + m + '.' + p + '-' + pr +\n ' <' + M + '.' + m + '.' + (+p + 1)\n } else {\n ret = '>=' + M + '.' + m + '.' + p + '-' + pr +\n ' <' + M + '.' + (+m + 1) + '.0'\n }\n } else {\n ret = '>=' + M + '.' + m + '.' + p + '-' + pr +\n ' <' + (+M + 1) + '.0.0'\n }\n } else {\n debug('no pr')\n if (M === '0') {\n if (m === '0') {\n ret = '>=' + M + '.' + m + '.' + p +\n ' <' + M + '.' + m + '.' + (+p + 1)\n } else {\n ret = '>=' + M + '.' + m + '.' + p +\n ' <' + M + '.' + (+m + 1) + '.0'\n }\n } else {\n ret = '>=' + M + '.' + m + '.' + p +\n ' <' + (+M + 1) + '.0.0'\n }\n }\n\n debug('caret return', ret)\n return ret\n })\n}\n\nfunction replaceXRanges (comp, options) {\n debug('replaceXRanges', comp, options)\n return comp.split(/\\s+/).map(function (comp) {\n return replaceXRange(comp, options)\n }).join(' ')\n}\n\nfunction replaceXRange (comp, options) {\n comp = comp.trim()\n var r = options.loose ? re[XRANGELOOSE] : re[XRANGE]\n return comp.replace(r, function (ret, gtlt, M, m, p, pr) {\n debug('xRange', comp, ret, gtlt, M, m, p, pr)\n var xM = isX(M)\n var xm = xM || isX(m)\n var xp = xm || isX(p)\n var anyX = xp\n\n if (gtlt === '=' && anyX) {\n gtlt = ''\n }\n\n if (xM) {\n if (gtlt === '>' || gtlt === '<') {\n // nothing is allowed\n ret = '<0.0.0'\n } else {\n // nothing is forbidden\n ret = '*'\n }\n } else if (gtlt && anyX) {\n // we know patch is an x, because we have any x at all.\n // replace X with 0\n if (xm) {\n m = 0\n }\n p = 0\n\n if (gtlt === '>') {\n // >1 => >=2.0.0\n // >1.2 => >=1.3.0\n // >1.2.3 => >= 1.2.4\n gtlt = '>='\n if (xm) {\n M = +M + 1\n m = 0\n p = 0\n } else {\n m = +m + 1\n p = 0\n }\n } else if (gtlt === '<=') {\n // <=0.7.x is actually <0.8.0, since any 0.7.x should\n // pass. Similarly, <=7.x is actually <8.0.0, etc.\n gtlt = '<'\n if (xm) {\n M = +M + 1\n } else {\n m = +m + 1\n }\n }\n\n ret = gtlt + M + '.' + m + '.' + p\n } else if (xm) {\n ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'\n } else if (xp) {\n ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'\n }\n\n debug('xRange return', ret)\n\n return ret\n })\n}\n\n// Because * is AND-ed with everything else in the comparator,\n// and '' means \"any version\", just remove the *s entirely.\nfunction replaceStars (comp, options) {\n debug('replaceStars', comp, options)\n // Looseness is ignored here. star is always as loose as it gets!\n return comp.trim().replace(re[STAR], '')\n}\n\n// This function is passed to string.replace(re[HYPHENRANGE])\n// M, m, patch, prerelease, build\n// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5\n// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do\n// 1.2 - 3.4 => >=1.2.0 <3.5.0\nfunction hyphenReplace ($0,\n from, fM, fm, fp, fpr, fb,\n to, tM, tm, tp, tpr, tb) {\n if (isX(fM)) {\n from = ''\n } else if (isX(fm)) {\n from = '>=' + fM + '.0.0'\n } else if (isX(fp)) {\n from = '>=' + fM + '.' + fm + '.0'\n } else {\n from = '>=' + from\n }\n\n if (isX(tM)) {\n to = ''\n } else if (isX(tm)) {\n to = '<' + (+tM + 1) + '.0.0'\n } else if (isX(tp)) {\n to = '<' + tM + '.' + (+tm + 1) + '.0'\n } else if (tpr) {\n to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr\n } else {\n to = '<=' + to\n }\n\n return (from + ' ' + to).trim()\n}\n\n// if ANY of the sets match ALL of its comparators, then pass\nRange.prototype.test = function (version) {\n if (!version) {\n return false\n }\n\n if (typeof version === 'string') {\n version = new SemVer(version, this.options)\n }\n\n for (var i = 0; i < this.set.length; i++) {\n if (testSet(this.set[i], version, this.options)) {\n return true\n }\n }\n return false\n}\n\nfunction testSet (set, version, options) {\n for (var i = 0; i < set.length; i++) {\n if (!set[i].test(version)) {\n return false\n }\n }\n\n if (version.prerelease.length && !options.includePrerelease) {\n // Find the set of versions that are allowed to have prereleases\n // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0\n // That should allow `1.2.3-pr.2` to pass.\n // However, `1.2.4-alpha.notready` should NOT be allowed,\n // even though it's within the range set by the comparators.\n for (i = 0; i < set.length; i++) {\n debug(set[i].semver)\n if (set[i].semver === ANY) {\n continue\n }\n\n if (set[i].semver.prerelease.length > 0) {\n var allowed = set[i].semver\n if (allowed.major === version.major &&\n allowed.minor === version.minor &&\n allowed.patch === version.patch) {\n return true\n }\n }\n }\n\n // Version has a -pre, but it's not one of the ones we like.\n return false\n }\n\n return true\n}\n\nexports.satisfies = satisfies\nfunction satisfies (version, range, options) {\n try {\n range = new Range(range, options)\n } catch (er) {\n return false\n }\n return range.test(version)\n}\n\nexports.maxSatisfying = maxSatisfying\nfunction maxSatisfying (versions, range, options) {\n var max = null\n var maxSV = null\n try {\n var rangeObj = new Range(range, options)\n } catch (er) {\n return null\n }\n versions.forEach(function (v) {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!max || maxSV.compare(v) === -1) {\n // compare(max, v, true)\n max = v\n maxSV = new SemVer(max, options)\n }\n }\n })\n return max\n}\n\nexports.minSatisfying = minSatisfying\nfunction minSatisfying (versions, range, options) {\n var min = null\n var minSV = null\n try {\n var rangeObj = new Range(range, options)\n } catch (er) {\n return null\n }\n versions.forEach(function (v) {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!min || minSV.compare(v) === 1) {\n // compare(min, v, true)\n min = v\n minSV = new SemVer(min, options)\n }\n }\n })\n return min\n}\n\nexports.minVersion = minVersion\nfunction minVersion (range, loose) {\n range = new Range(range, loose)\n\n var minver = new SemVer('0.0.0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = new SemVer('0.0.0-0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = null\n for (var i = 0; i < range.set.length; ++i) {\n var comparators = range.set[i]\n\n comparators.forEach(function (comparator) {\n // Clone to avoid manipulating the comparator's semver object.\n var compver = new SemVer(comparator.semver.version)\n switch (comparator.operator) {\n case '>':\n if (compver.prerelease.length === 0) {\n compver.patch++\n } else {\n compver.prerelease.push(0)\n }\n compver.raw = compver.format()\n /* fallthrough */\n case '':\n case '>=':\n if (!minver || gt(minver, compver)) {\n minver = compver\n }\n break\n case '<':\n case '<=':\n /* Ignore maximum versions */\n break\n /* istanbul ignore next */\n default:\n throw new Error('Unexpected operation: ' + comparator.operator)\n }\n })\n }\n\n if (minver && range.test(minver)) {\n return minver\n }\n\n return null\n}\n\nexports.validRange = validRange\nfunction validRange (range, options) {\n try {\n // Return '*' instead of '' so that truthiness works.\n // This will throw if it's invalid anyway\n return new Range(range, options).range || '*'\n } catch (er) {\n return null\n }\n}\n\n// Determine if version is less than all the versions possible in the range\nexports.ltr = ltr\nfunction ltr (version, range, options) {\n return outside(version, range, '<', options)\n}\n\n// Determine if version is greater than all the versions possible in the range.\nexports.gtr = gtr\nfunction gtr (version, range, options) {\n return outside(version, range, '>', options)\n}\n\nexports.outside = outside\nfunction outside (version, range, hilo, options) {\n version = new SemVer(version, options)\n range = new Range(range, options)\n\n var gtfn, ltefn, ltfn, comp, ecomp\n switch (hilo) {\n case '>':\n gtfn = gt\n ltefn = lte\n ltfn = lt\n comp = '>'\n ecomp = '>='\n break\n case '<':\n gtfn = lt\n ltefn = gte\n ltfn = gt\n comp = '<'\n ecomp = '<='\n break\n default:\n throw new TypeError('Must provide a hilo val of \"<\" or \">\"')\n }\n\n // If it satisifes the range it is not outside\n if (satisfies(version, range, options)) {\n return false\n }\n\n // From now on, variable terms are as if we're in \"gtr\" mode.\n // but note that everything is flipped for the \"ltr\" function.\n\n for (var i = 0; i < range.set.length; ++i) {\n var comparators = range.set[i]\n\n var high = null\n var low = null\n\n comparators.forEach(function (comparator) {\n if (comparator.semver === ANY) {\n comparator = new Comparator('>=0.0.0')\n }\n high = high || comparator\n low = low || comparator\n if (gtfn(comparator.semver, high.semver, options)) {\n high = comparator\n } else if (ltfn(comparator.semver, low.semver, options)) {\n low = comparator\n }\n })\n\n // If the edge version comparator has a operator then our version\n // isn't outside it\n if (high.operator === comp || high.operator === ecomp) {\n return false\n }\n\n // If the lowest version comparator has an operator and our version\n // is less than it then it isn't higher than the range\n if ((!low.operator || low.operator === comp) &&\n ltefn(version, low.semver)) {\n return false\n } else if (low.operator === ecomp && ltfn(version, low.semver)) {\n return false\n }\n }\n return true\n}\n\nexports.prerelease = prerelease\nfunction prerelease (version, options) {\n var parsed = parse(version, options)\n return (parsed && parsed.prerelease.length) ? parsed.prerelease : null\n}\n\nexports.intersects = intersects\nfunction intersects (r1, r2, options) {\n r1 = new Range(r1, options)\n r2 = new Range(r2, options)\n return r1.intersects(r2)\n}\n\nexports.coerce = coerce\nfunction coerce (version) {\n if (version instanceof SemVer) {\n return version\n }\n\n if (typeof version !== 'string') {\n return null\n }\n\n var match = version.match(re[COERCE])\n\n if (match == null) {\n return null\n }\n\n return parse(match[1] +\n '.' + (match[2] || '0') +\n '.' + (match[3] || '0'))\n}\n", "\"use strict\";\n/**\n * Capture module.\n * @module aws_p\n */\nvar semver = require('semver');\nvar Aws = require('../segments/attributes/aws');\nvar contextUtils = require('../context_utils');\nvar Utils = require('../utils');\nvar logger = require('../logger');\nvar minVersion = '2.7.15';\nvar throttledErrorDefault = function throttledErrorDefault() {\n return false; // If the customer doesn't provide an aws-sdk with a throttled error function, we can't make assumptions.\n};\n/**\n * Configures the AWS SDK to automatically capture information for the segment.\n * All created clients will automatically be captured. See 'captureAWSClient'\n * for additional details.\n * @param {AWS} awssdk - The Javascript AWS SDK.\n * @alias module:aws_p.captureAWS\n * @returns {AWS}\n * @see https://github.com/aws/aws-sdk-js\n */\nvar captureAWS = function captureAWS(awssdk) {\n if (!semver.gte(awssdk.VERSION, minVersion)) {\n throw new Error('AWS SDK version ' + minVersion + ' or greater required.');\n }\n for (var prop in awssdk) {\n if (awssdk[prop].serviceIdentifier) {\n var Service = awssdk[prop];\n Service.prototype.customizeRequests(captureAWSRequest);\n }\n }\n return awssdk;\n};\n/**\n * Configures any AWS Client instance to automatically capture information for the segment.\n * For manual mode, a param with key called 'Segment' is required as a part of the AWS\n * call paramaters, and must reference a Segment or Subsegment object.\n * @param {AWS.Service} service - An instance of a AWS service to wrap.\n * @alias module:aws_p.captureAWSClient\n * @returns {AWS.Service}\n * @see https://github.com/aws/aws-sdk-js\n */\nvar captureAWSClient = function captureAWSClient(service) {\n service.customizeRequests(captureAWSRequest);\n return service;\n};\nfunction captureAWSRequest(req) {\n var parent = contextUtils.resolveSegment(contextUtils.resolveManualSegmentParams(req.params));\n if (!parent) {\n var output = this.serviceIdentifier + '.' + req.operation;\n if (!contextUtils.isAutomaticMode()) {\n logger.getLogger().info('Call ' + output + ' requires a segment object' +\n ' on the request params as \"XRaySegment\" for tracing in manual mode. Ignoring.');\n }\n else {\n logger.getLogger().info('Call ' + output +\n ' is missing the sub/segment context for automatic mode. Ignoring.');\n }\n return req;\n }\n var throttledError = this.throttledError || throttledErrorDefault;\n var stack = (new Error()).stack;\n let subsegment;\n if (parent.notTraced) {\n subsegment = parent.addNewSubsegmentWithoutSampling(this.serviceIdentifier);\n }\n else {\n subsegment = parent.addNewSubsegment(this.serviceIdentifier);\n }\n var traceId = parent.segment ? parent.segment.trace_id : parent.trace_id;\n var buildListener = function (req) {\n req.httpRequest.headers['X-Amzn-Trace-Id'] = 'Root=' + traceId + ';Parent=' + subsegment.id +\n ';Sampled=' + (subsegment.notTraced ? '0' : '1');\n };\n var completeListener = function (res) {\n subsegment.addAttribute('namespace', 'aws');\n subsegment.addAttribute('aws', new Aws(res, subsegment.name));\n var httpRes = res.httpResponse;\n if (httpRes) {\n subsegment.addAttribute('http', new HttpResponse(httpRes));\n if (httpRes.statusCode === 429 || (res.error && throttledError(res.error))) {\n subsegment.addThrottleFlag();\n }\n }\n if (res.error) {\n var err = { message: res.error.message, name: res.error.code, stack: stack };\n if (httpRes && httpRes.statusCode) {\n if (Utils.getCauseTypeFromHttpStatus(httpRes.statusCode) == 'error') {\n subsegment.addErrorFlag();\n }\n subsegment.close(err, true);\n }\n else {\n subsegment.close(err);\n }\n }\n else {\n if (httpRes && httpRes.statusCode) {\n var cause = Utils.getCauseTypeFromHttpStatus(httpRes.statusCode);\n if (cause) {\n subsegment[cause] = true;\n }\n }\n subsegment.close();\n }\n };\n req.on('beforePresign', function (req) {\n // Only the AWS Presigner triggers this event,\n // so we can rely on this event to notify us when\n // a request is for a presigned url\n parent.removeSubsegment(subsegment);\n parent.decrementCounter();\n req.removeListener('build', buildListener);\n req.removeListener('complete', completeListener);\n });\n req.on('build', buildListener).on('complete', completeListener);\n if (!req.__send) {\n req.__send = req.send;\n req.send = function (callback) {\n if (contextUtils.isAutomaticMode()) {\n var session = contextUtils.getNamespace();\n session.run(function () {\n contextUtils.setSegment(subsegment);\n req.__send(callback);\n });\n }\n else {\n req.__send(callback);\n }\n };\n }\n}\nfunction HttpResponse(res) {\n this.init(res);\n}\nHttpResponse.prototype.init = function init(res) {\n this.response = {\n status: res.statusCode || '',\n };\n if (res.headers && res.headers['content-length']) {\n this.response.content_length = res.headers['content-length'];\n }\n};\nmodule.exports.captureAWSClient = captureAWSClient;\nmodule.exports.captureAWS = captureAWS;\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.NODEJS_TIMEOUT_ERROR_CODES = exports.TRANSIENT_ERROR_STATUS_CODES = exports.TRANSIENT_ERROR_CODES = exports.THROTTLING_ERROR_CODES = exports.CLOCK_SKEW_ERROR_CODES = void 0;\nexports.CLOCK_SKEW_ERROR_CODES = [\n \"AuthFailure\",\n \"InvalidSignatureException\",\n \"RequestExpired\",\n \"RequestInTheFuture\",\n \"RequestTimeTooSkewed\",\n \"SignatureDoesNotMatch\",\n];\nexports.THROTTLING_ERROR_CODES = [\n \"BandwidthLimitExceeded\",\n \"EC2ThrottledException\",\n \"LimitExceededException\",\n \"PriorRequestNotComplete\",\n \"ProvisionedThroughputExceededException\",\n \"RequestLimitExceeded\",\n \"RequestThrottled\",\n \"RequestThrottledException\",\n \"SlowDown\",\n \"ThrottledException\",\n \"Throttling\",\n \"ThrottlingException\",\n \"TooManyRequestsException\",\n \"TransactionInProgressException\",\n];\nexports.TRANSIENT_ERROR_CODES = [\"AbortError\", \"TimeoutError\", \"RequestTimeout\", \"RequestTimeoutException\"];\nexports.TRANSIENT_ERROR_STATUS_CODES = [500, 502, 503, 504];\nexports.NODEJS_TIMEOUT_ERROR_CODES = [\"ECONNRESET\", \"EPIPE\", \"ETIMEDOUT\"];\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isTransientError = exports.isThrottlingError = exports.isClockSkewError = exports.isRetryableByTrait = void 0;\nconst constants_1 = require(\"./constants\");\nconst isRetryableByTrait = (error) => error.$retryable !== undefined;\nexports.isRetryableByTrait = isRetryableByTrait;\nconst isClockSkewError = (error) => constants_1.CLOCK_SKEW_ERROR_CODES.includes(error.name);\nexports.isClockSkewError = isClockSkewError;\nconst isThrottlingError = (error) => {\n var _a, _b;\n return ((_a = error.$metadata) === null || _a === void 0 ? void 0 : _a.httpStatusCode) === 429 ||\n constants_1.THROTTLING_ERROR_CODES.includes(error.name) ||\n ((_b = error.$retryable) === null || _b === void 0 ? void 0 : _b.throttling) == true;\n};\nexports.isThrottlingError = isThrottlingError;\nconst isTransientError = (error) => {\n var _a;\n return constants_1.TRANSIENT_ERROR_CODES.includes(error.name) ||\n constants_1.NODEJS_TIMEOUT_ERROR_CODES.includes((error === null || error === void 0 ? void 0 : error.code) || \"\") ||\n constants_1.TRANSIENT_ERROR_STATUS_CODES.includes(((_a = error.$metadata) === null || _a === void 0 ? void 0 : _a.httpStatusCode) || 0);\n};\nexports.isTransientError = isTransientError;\n", "\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.captureAWSClient = void 0;\nconst service_error_classification_1 = require(\"@aws-sdk/service-error-classification\");\nconst aws_1 = __importDefault(require(\"../segments/attributes/aws\"));\nconst querystring_1 = require(\"querystring\");\nconst subsegment_1 = __importDefault(require(\"../segments/attributes/subsegment\"));\nconst contextUtils = require('../context_utils');\nconst logger = require('../logger');\nconst { safeParseInt } = require('../utils');\nconst utils_1 = require(\"../utils\");\nconst XRAY_PLUGIN_NAME = 'XRaySDKInstrumentation';\nconst buildAttributesFromMetadata = async (service, operation, region, res, error) => {\n var _a, _b, _c;\n const { extendedRequestId, requestId, httpStatusCode: statusCode, attempts } = ((_a = res === null || res === void 0 ? void 0 : res.output) === null || _a === void 0 ? void 0 : _a.$metadata) || (error === null || error === void 0 ? void 0 : error.$metadata);\n const aws = new aws_1.default({\n extendedRequestId,\n requestId,\n retryCount: attempts,\n request: {\n operation,\n httpRequest: {\n region,\n statusCode,\n },\n },\n }, service);\n const http = {};\n if (statusCode) {\n http.response = {};\n http.response.status = statusCode;\n }\n if (((_b = res === null || res === void 0 ? void 0 : res.response) === null || _b === void 0 ? void 0 : _b.headers) && ((_c = res === null || res === void 0 ? void 0 : res.response) === null || _c === void 0 ? void 0 : _c.headers['content-length']) !== undefined) {\n if (!http.response) {\n http.response = {};\n }\n http.response.content_length = safeParseInt(res.response.headers['content-length']);\n }\n return [aws, http];\n};\nfunction addFlags(http, subsegment, err) {\n var _a, _b, _c;\n if (err && (0, service_error_classification_1.isThrottlingError)(err)) {\n subsegment.addThrottleFlag();\n }\n else if (safeParseInt((_a = http.response) === null || _a === void 0 ? void 0 : _a.status) === 429 || safeParseInt((_b = err === null || err === void 0 ? void 0 : err.$metadata) === null || _b === void 0 ? void 0 : _b.httpStatusCode) === 429) {\n subsegment.addThrottleFlag();\n }\n const cause = (0, utils_1.getCauseTypeFromHttpStatus)(safeParseInt((_c = http.response) === null || _c === void 0 ? void 0 : _c.status));\n if (cause === 'fault') {\n subsegment.addFaultFlag();\n }\n else if (cause === 'error') {\n subsegment.addErrorFlag();\n }\n}\nconst getXRayMiddleware = (config, manualSegment) => (next, context) => async (args) => {\n const segment = contextUtils.isAutomaticMode() ? contextUtils.resolveSegment() : manualSegment;\n const { clientName, commandName } = context;\n const operation = commandName.slice(0, -7); // Strip trailing \"Command\" string\n const service = clientName.slice(0, -6); // Strip trailing \"Client\" string\n if (!segment) {\n const output = service + '.' + operation.charAt(0).toLowerCase() + operation.slice(1);\n if (!contextUtils.isAutomaticMode()) {\n logger.getLogger().info('Call ' + output + ' requires a segment object' +\n ' passed to captureAWSv3Client for tracing in manual mode. Ignoring.');\n }\n else {\n logger.getLogger().info('Call ' + output +\n ' is missing the sub/segment context for automatic mode. Ignoring.');\n }\n return next(args);\n }\n let subsegment;\n if (segment.notTraced) {\n subsegment = segment.addNewSubsegmentWithoutSampling(service);\n }\n else {\n subsegment = segment.addNewSubsegment(service);\n }\n subsegment.addAttribute('namespace', 'aws');\n const parent = (segment instanceof subsegment_1.default ? segment.segment : segment);\n args.request.headers['X-Amzn-Trace-Id'] = (0, querystring_1.stringify)({\n Root: parent.trace_id,\n Parent: subsegment.id,\n Sampled: subsegment.notTraced ? '0' : '1',\n }, ';');\n let res;\n try {\n res = await next(args);\n if (!res) {\n throw new Error('Failed to get response from instrumented AWS Client.');\n }\n const [aws, http] = await buildAttributesFromMetadata(service, operation, await config.region(), res, null);\n subsegment.addAttribute('aws', aws);\n subsegment.addAttribute('http', http);\n addFlags(http, subsegment);\n subsegment.close();\n return res;\n }\n catch (err) {\n if (err.$metadata) {\n const [aws, http] = await buildAttributesFromMetadata(service, operation, await config.region(), null, err);\n subsegment.addAttribute('aws', aws);\n subsegment.addAttribute('http', http);\n addFlags(http, subsegment, err);\n }\n const errObj = { message: err.message, name: err.name, stack: err.stack || new Error().stack };\n subsegment.close(errObj, true);\n throw err;\n }\n};\nconst xRayMiddlewareOptions = {\n name: XRAY_PLUGIN_NAME,\n step: 'build',\n};\nconst getXRayPlugin = (config, manualSegment) => ({\n applyToStack: (stack) => {\n stack.add(getXRayMiddleware(config, manualSegment), xRayMiddlewareOptions);\n },\n});\n/**\n * Instruments AWS SDK V3 clients with X-Ray via middleware.\n *\n * @param client - AWS SDK V3 client to instrument\n * @param manualSegment - Parent segment or subsegment that is passed in for manual mode users\n * @returns - the client with the X-Ray instrumentation middleware added to its middleware stack\n */\nfunction captureAWSClient(client, manualSegment) {\n // Remove existing middleware to ensure operation is idempotent\n client.middlewareStack.remove(XRAY_PLUGIN_NAME);\n client.middlewareStack.use(getXRayPlugin(client.config, manualSegment));\n return client;\n}\nexports.captureAWSClient = captureAWSClient;\n", "\"use strict\";\n/**\n * @module http_p\n */\n/**\n * This module patches the HTTP and HTTPS node built-in libraries and returns a copy of the module with tracing enabled.\n */\nvar url = require('url');\nvar contextUtils = require('../context_utils');\nvar Utils = require('../utils');\nvar logger = require('../logger');\nvar events = require('events');\n/**\n * Wraps the http/https.request() and .get() calls to automatically capture information for the segment.\n * This patches the built-in HTTP and HTTPS modules globally. If using a 3rd party HTTP library,\n * it should still use HTTP under the hood. Be sure to patch globally before requiring the 3rd party library.\n * 3rd party library compatibility is best effort. Some incompatibility issues may arise.\n * @param {http|https} module - The built in Node.js HTTP or HTTPS module.\n * @param {boolean} downstreamXRayEnabled - when true, adds a \"traced:true\" property to the subsegment\n * so the AWS X-Ray service expects a corresponding segment from the downstream service.\n * @param {function} subsegmentCallback - a callback that is called with the subsegment, the Node.js\n * http.ClientRequest, the Node.js http.IncomingMessage (if a response was received) and any error issued,\n * allowing custom annotations and metadata to be added.\n * to be added to the subsegment.\n * @alias module:http_p.captureHTTPsGlobal\n */\nvar captureHTTPsGlobal = function captureHTTPsGlobal(module, downstreamXRayEnabled, subsegmentCallback) {\n if (!module.__request) {\n enableCapture(module, downstreamXRayEnabled, subsegmentCallback);\n }\n};\n/**\n * Wraps the http/https.request() and .get() calls to automatically capture information for the segment.\n * Returns an instance of the HTTP or HTTPS module that is patched.\n * @param {http|https} module - The built in Node.js HTTP or HTTPS module.\n * @param {boolean} downstreamXRayEnabled - when true, adds a \"traced:true\" property to the subsegment\n * so the AWS X-Ray service expects a corresponding segment from the downstream service.\n * @param {function} subsegmentCallback - a callback that is called with the subsegment, the Node.js\n * http.ClientRequest, and the Node.js http.IncomingMessage to allow custom annotations and metadata\n * to be added to the subsegment.\n * @alias module:http_p.captureHTTPs\n * @returns {http|https}\n */\nvar captureHTTPs = function captureHTTPs(module, downstreamXRayEnabled, subsegmentCallback) {\n if (module.__request) {\n return module;\n }\n var tracedModule = {};\n Object.keys(module).forEach(function (val) {\n tracedModule[val] = module[val];\n });\n enableCapture(tracedModule, downstreamXRayEnabled, subsegmentCallback);\n return tracedModule;\n};\nfunction enableCapture(module, downstreamXRayEnabled, subsegmentCallback) {\n function captureOutgoingHTTPs(baseFunc, ...args) {\n let options;\n let callback;\n let hasUrl;\n let urlObj;\n let arg0 = args[0];\n if (typeof args[1] === 'object') {\n hasUrl = true;\n urlObj = typeof arg0 === 'string' ? new url.URL(arg0) : arg0;\n options = args[1],\n callback = args[2];\n }\n else {\n hasUrl = false;\n options = arg0;\n callback = args[1];\n }\n // Short circuit if the HTTP request has no options or is already being captured\n if (!options || (options.headers && (options.headers['X-Amzn-Trace-Id']))) {\n return baseFunc(...args);\n }\n // Case of calling a string URL without options, e.g.: http.request('http://amazon.com', callback)\n if (typeof options === 'string') {\n options = new url.URL(options);\n }\n if (!hasUrl) {\n urlObj = options;\n }\n const parent = contextUtils.resolveSegment(contextUtils.resolveManualSegmentParams(options));\n const hostname = options.hostname || options.host || urlObj.hostname || urlObj.host || 'Unknown host';\n if (!parent) {\n let output = '[ host: ' + hostname;\n output = options.method ? (output + ', method: ' + options.method) : output;\n output += ', path: ' + (urlObj.pathname || Utils.stripQueryStringFromPath(options.path)) + ' ]';\n if (!contextUtils.isAutomaticMode()) {\n logger.getLogger().info('Options for request ' + output +\n ' requires a segment object on the options params as \"XRaySegment\" for tracing in manual mode. Ignoring.');\n }\n else {\n logger.getLogger().info('Options for request ' + output +\n ' is missing the sub/segment context for automatic mode. Ignoring.');\n }\n // Options are not modified, only parsed for logging. We can pass in the original arguments.\n return baseFunc(...args);\n }\n let subsegment;\n if (parent.notTraced) {\n subsegment = parent.addNewSubsegmentWithoutSampling(hostname);\n }\n else {\n subsegment = parent.addNewSubsegment(hostname);\n }\n const root = parent.segment ? parent.segment : parent;\n subsegment.namespace = 'remote';\n if (!options.headers) {\n options.headers = {};\n }\n options.headers['X-Amzn-Trace-Id'] = 'Root=' + root.trace_id + ';Parent=' + subsegment.id +\n ';Sampled=' + (subsegment.notTraced ? '0' : '1');\n const errorCapturer = function errorCapturer(e) {\n if (subsegmentCallback) {\n subsegmentCallback(subsegment, this, null, e);\n }\n if (subsegment.http && subsegment.http.response) {\n if (Utils.getCauseTypeFromHttpStatus(subsegment.http.response.status) === 'error') {\n subsegment.addErrorFlag();\n }\n subsegment.close(e, true);\n }\n else {\n const madeItToDownstream = (e.code !== 'ECONNREFUSED');\n subsegment.addRemoteRequestData(this, null, madeItToDownstream && downstreamXRayEnabled);\n subsegment.close(e);\n }\n };\n const optionsCopy = Utils.objectWithoutProperties(options, ['Segment'], true);\n let req = baseFunc(...(hasUrl ? [arg0, optionsCopy] : [options]), function (res) {\n res.on('end', function () {\n if (subsegmentCallback) {\n subsegmentCallback(subsegment, this.req, res);\n }\n if (res.statusCode === 429) {\n subsegment.addThrottleFlag();\n }\n const cause = Utils.getCauseTypeFromHttpStatus(res.statusCode);\n if (cause) {\n subsegment[cause] = true;\n }\n subsegment.addRemoteRequestData(res.req, res, !!downstreamXRayEnabled);\n subsegment.close();\n });\n if (typeof callback === 'function') {\n if (contextUtils.isAutomaticMode()) {\n const session = contextUtils.getNamespace();\n session.run(function () {\n contextUtils.setSegment(subsegment);\n callback(res);\n });\n }\n else {\n callback(res);\n }\n // if no callback provided by user application, AND no explicit response listener\n // added by user application, then we consume the response so the 'end' event fires\n // See: https://nodejs.org/api/http.html#http_class_http_clientrequest\n }\n else if (res.req && res.req.listenerCount('response') === 0) {\n res.resume();\n }\n });\n // Use errorMonitor if available (in Node 12.17+), otherwise fall back to standard error listener\n // See: https://nodejs.org/dist/latest-v12.x/docs/api/events.html#events_eventemitter_errormonitor\n req.on(events.errorMonitor || 'error', errorCapturer);\n return req;\n }\n module.__request = module.request;\n function captureHTTPsRequest(...args) {\n return captureOutgoingHTTPs(module.__request, ...args);\n }\n module.__get = module.get;\n function captureHTTPsGet(...args) {\n return captureOutgoingHTTPs(module.__get, ...args);\n }\n Object.defineProperties(module, {\n request: { value: captureHTTPsRequest, configurable: true, enumerable: true, writable: true },\n get: { value: captureHTTPsGet, configurable: true, enumerable: true, writable: true },\n });\n}\nmodule.exports.captureHTTPsGlobal = captureHTTPsGlobal;\nmodule.exports.captureHTTPs = captureHTTPs;\n", "\"use strict\";\n/**\n * @module promise_p\n */\n/**\n * This module patches native Promise libraries provided by V8 engine\n * so all subsegments generated within Promise are attached to the correct parent.\n */\nconst contextUtils = require('../context_utils');\nconst originalThen = Symbol('original then');\nconst originalCatch = Symbol('original catch');\nfunction patchPromise(Promise) {\n const then = Promise.prototype.then;\n if (!then[originalThen]) {\n Promise.prototype.then = function (onFulfilled, onRejected) {\n if (contextUtils.isAutomaticMode()\n && tryGetCurrentSegment()) {\n const ns = contextUtils.getNamespace();\n onFulfilled = onFulfilled && ns.bind(onFulfilled);\n onRejected = onRejected && ns.bind(onRejected);\n }\n return then.call(this, onFulfilled, onRejected);\n };\n Promise.prototype.then[originalThen] = then;\n }\n const origCatch = Promise.prototype.catch;\n if (origCatch && !origCatch[originalCatch]) {\n Promise.prototype.catch = function (onRejected) {\n if (contextUtils.isAutomaticMode()\n && tryGetCurrentSegment()) {\n const ns = contextUtils.getNamespace();\n onRejected = onRejected && ns.bind(onRejected);\n }\n return origCatch.call(this, onRejected);\n };\n Promise.prototype.catch[originalCatch] = origCatch;\n }\n}\nfunction unpatchPromise(Promise) {\n const then = Promise.prototype.then;\n if (then[originalThen]) {\n Promise.prototype.then = then[originalThen];\n }\n const origCatch = Promise.prototype.catch;\n if (origCatch && origCatch[originalCatch]) {\n Promise.prototype.catch = origCatch[originalCatch];\n }\n}\nfunction tryGetCurrentSegment() {\n try {\n return contextUtils.getSegment();\n }\n catch (e) {\n return undefined;\n }\n}\nfunction capturePromise() {\n patchPromise(Promise);\n}\nfunction uncapturePromise() {\n unpatchPromise(Promise);\n}\ncapturePromise.patchThirdPartyPromise = patchPromise;\nmodule.exports.capturePromise = capturePromise;\nmodule.exports.uncapturePromise = uncapturePromise;\n", "\"use strict\";\n/**\n * Represents a SQL database call.\n * @constructor\n * @param {string} databaseVer - The version on the database (user supplied).\n * @param {string} driverVer - The version on the database driver (user supplied).\n * @param {string} user - The user associated to the database call.\n * @param {string} queryType - The SQL query type.\n */\nfunction SqlData(databaseVer, driverVer, user, url, queryType) {\n this.init(databaseVer, driverVer, user, url, queryType);\n}\nSqlData.prototype.init = function init(databaseVer, driverVer, user, url, queryType) {\n if (databaseVer) {\n this.database_version = databaseVer;\n }\n if (driverVer) {\n this.driver_version = driverVer;\n }\n if (queryType) {\n this.preparation = queryType;\n }\n this.url = url;\n this.user = user;\n};\nmodule.exports = SqlData;\n", "\"use strict\";\nvar contextUtils = require('./context_utils');\nvar logging = require('./logger');\nvar segmentUtils = require('./segments/segment_utils');\nvar utils = require('./utils');\nvar LambdaEnv = require('./env/aws_lambda');\n// Import Data from package.json,\n// If the importing of package.json fails leave\n// pkginfo as an empty object\nvar pkginfo = {};\ntry {\n pkginfo = require('../../package.json');\n}\ncatch (err) {\n logging.getLogger().debug('Failed to load SDK data:', err);\n}\nvar UNKNOWN = 'unknown';\n/**\n * A module representing the AWSXRay SDK.\n * @namespace AWSXRay\n */\nvar AWSXRay = {\n /**\n * @memberof AWSXRay\n * @type {object}\n * @namespace AWSXRay.plugins\n */\n plugins: {\n /**\n * Exposes the AWS EC2 plugin.\n * @memberof AWSXRay.plugins\n */\n EC2Plugin: require('./segments/plugins/ec2_plugin'),\n /**\n * Exposes the AWS ECS plugin.\n * @memberof AWSXRay.plugins\n */\n ECSPlugin: require('./segments/plugins/ecs_plugin'),\n /**\n * Exposes the AWS Elastic Beanstalk plugin.\n * @memberof AWSXRay.plugins\n */\n ElasticBeanstalkPlugin: require('./segments/plugins/elastic_beanstalk_plugin'),\n },\n /**\n * Enables use of plugins to capture additional data for segments.\n * @param {Array} plugins - A configurable subset of AWSXRay.plugins.\n * @memberof AWSXRay\n * @see AWSXRay.plugins\n */\n config: function (plugins) {\n var pluginData = {};\n plugins.forEach(function (plugin) {\n plugin.getData(function (data) {\n if (data) {\n for (var attribute in data) {\n pluginData[attribute] = data[attribute];\n }\n }\n });\n segmentUtils.setOrigin(plugin.originName);\n segmentUtils.setPluginData(pluginData);\n });\n },\n /**\n * Overrides the default whitelisting file to specify what params to capture on each AWS Service call.\n * If a service or API is not listed, no additional data is captured.\n * The base whitelisting file can be found at /lib/resources/aws_whitelist.json\n * @param {string|Object} source - The path to the custom whitelist file, or a whitelist source JSON object.\n * @memberof AWSXRay\n */\n setAWSWhitelist: require('./segments/attributes/aws').setAWSWhitelist,\n /**\n * Appends to the current whitelisting file.\n * In the case of a duplicate service API listed, the new source will override the previous values.\n * @param {string|Object} source - The path to the custom whitelist file, or a whitelist source JSON object.\n * @memberof AWSXRay\n */\n appendAWSWhitelist: require('./segments/attributes/aws').appendAWSWhitelist,\n /**\n * Overrides the default streaming threshold (100).\n * The threshold represents the maximum number of subsegments on a single segment before\n * the SDK begins to send the completed subsegments out of band of the main segment.\n * Reduce this threshold if you see the 'Segment too large to send' error.\n * @param {number} threshold - The new threshold to use.\n * @memberof AWSXRay\n */\n setStreamingThreshold: segmentUtils.setStreamingThreshold,\n /**\n * Set your own logger for the SDK.\n * @param {Object} logger - A logger which responds to debug/info/warn/error calls.\n * @memberof AWSXRay\n */\n setLogger: logging.setLogger,\n /**\n * Gets the set logger for the SDK.\n * @memberof AWSXRay\n */\n getLogger: logging.getLogger,\n /**\n * Configures the address and port the daemon is expected to be on.\n * @param {string} address - Address of the daemon the segments should be sent to. Expects 'x.x.x.x', ':yyyy' or 'x.x.x.x:yyyy' IPv4 formats.\n * @module DaemonConfig\n * @memberof AWSXRay\n * @function\n * @see module:DaemonConfig.setDaemonAddress\n */\n setDaemonAddress: require('./daemon_config').setDaemonAddress,\n /**\n * @param {string} name - The name of the new subsegment.\n * @param {function} fcn - The function conext to wrap.\n * @param {Segment|Subsegment} [parent] - The parent for the new subsegment, for manual mode.\n * @memberof AWSXRay\n * @function\n * @see module:capture.captureFunc\n */\n captureFunc: require('./capture').captureFunc,\n /**\n * @param {string} name - The name of the new subsegment.\n * @param {function} fcn - The function conext to wrap.\n * @param {Segment|Subsegment} [parent] - The parent for the new subsegment, for manual mode.\n * @memberof AWSXRay\n * @function\n * @see module:capture.captureAsyncFunc\n */\n captureAsyncFunc: require('./capture').captureAsyncFunc,\n /**\n * @param {string} name - The name of the new subsegment.\n * @param {function} fcn - The function conext to wrap.\n * @param {Segment|Subsegment} [parent] - The parent for the new subsegment, for manual mode.\n * @memberof AWSXRay\n * @function\n * @see module:capture.captureCallbackFunc\n */\n captureCallbackFunc: require('./capture').captureCallbackFunc,\n /**\n * @param {AWS} awssdk - The Javascript AWS SDK.\n * @memberof AWSXRay\n * @function\n * @see module:aws_p.captureAWS\n */\n captureAWS: require('./patchers/aws_p').captureAWS,\n /**\n * @param {AWS.Service} service - An instance of a AWS service to wrap.\n * @memberof AWSXRay\n * @function\n * @see module:aws_p.captureAWSClient\n */\n captureAWSClient: require('./patchers/aws_p').captureAWSClient,\n /**\n * @param {AWSv3.Service} service - An instance of a AWS SDK v3 service to wrap.\n * @param {Segment|Subsegment} segment - Optional segment for manual mode.\n * @memberof AWSXRay\n * @function\n * @see module:aws3_p.captureAWSClient\n */\n captureAWSv3Client: require('./patchers/aws3_p').captureAWSClient,\n /**\n * @param {http|https} module - The built in Node.js HTTP or HTTPS module.\n * @memberof AWSXRay\n * @function\n * @returns {http|https}\n * @see module:http_p.captureHTTPs\n */\n captureHTTPs: require('./patchers/http_p').captureHTTPs,\n /**\n * @param {http|https} module - The built in Node.js HTTP or HTTPS module.\n * @memberof AWSXRay\n * @function\n * @see module:http_p.captureHTTPsGlobal\n */\n captureHTTPsGlobal: require('./patchers/http_p').captureHTTPsGlobal,\n /**\n * @memberof AWSXRay\n * @function\n * @see module:promise_p.capturePromise\n */\n capturePromise: require('./patchers/promise_p').capturePromise,\n /**\n * Exposes various helper methods.\n * @memberof AWSXRay\n * @function\n * @see module:utils\n */\n utils: utils,\n /**\n * @memberof AWSXRay\n * @type {object}\n * @namespace AWSXRay.database\n */\n database: {\n /**\n * Exposes the SqlData class.\n * @memberof AWSXRay.database\n * @see SqlData\n */\n SqlData: require('./database/sql_data'),\n },\n /**\n * Exposes the Middleware Utils class.\n * @memberof AWSXRay\n * @function\n * @see module:mw_utils\n */\n middleware: require('./middleware/mw_utils'),\n /**\n * Gets the current namespace of the context.\n * Used for supporting functions that can be used in automatic mode.\n * @memberof AWSXRay\n * @function\n * @returns {Segment|Subsegment}\n * @see module:context_utils.getNamespace\n */\n getNamespace: contextUtils.getNamespace,\n /**\n * Resolves the current segment or subsegment, checks manual and automatic modes.\n * Used for supporting functions that can be used in both manual and automatic modes.\n * @memberof AWSXRay\n * @function\n * @returns {Segment|Subsegment}\n * @see module:context_utils.resolveSegment\n */\n resolveSegment: contextUtils.resolveSegment,\n /**\n * Returns the current segment or subsegment. For use with automatic mode only.\n * @memberof AWSXRay\n * @function\n * @returns {Segment|Subsegment}\n * @see module:context_utils.getSegment\n */\n getSegment: contextUtils.getSegment,\n /**\n * Sets the current segment or subsegment. For use with automatic mode only.\n * @memberof AWSXRay\n * @function\n * @see module:context_utils.setSegment\n */\n setSegment: contextUtils.setSegment,\n /**\n * Returns true if automatic mode is enabled, otherwise false.\n * @memberof AWSXRay\n * @function\n * @see module:context_utils.isAutomaticMode\n */\n isAutomaticMode: contextUtils.isAutomaticMode,\n /**\n * Enables automatic mode. Automatic mode uses 'cls-hooked'.\n * @see https://github.com/jeff-lewis/cls-hooked\n * @memberof AWSXRay\n * @function\n * @see module:context_utils.enableAutomaticMode\n */\n enableAutomaticMode: contextUtils.enableAutomaticMode,\n /**\n * Disables automatic mode. Current segment or subsegment must be passed manually\n * via the parent optional on captureFunc, captureAsyncFunc etc.\n * @memberof AWSXRay\n * @function\n * @see module:context_utils.enableManualMode\n */\n enableManualMode: contextUtils.enableManualMode,\n /**\n * Sets the context missing strategy.\n * @param {Object} strategy - The strategy to set. This object's contextMissing function will be called whenever trace context is not found.\n */\n setContextMissingStrategy: contextUtils.setContextMissingStrategy,\n /**\n * Exposes the segment class.\n * @memberof AWSXRay\n * @function\n */\n Segment: require('./segments/segment'),\n /**\n * Exposes the subsegment class.\n * @memberof AWSXRay\n * @see Subsegment\n */\n Subsegment: require('./segments/attributes/subsegment'),\n SegmentUtils: segmentUtils\n};\n/**\n * Exposes the IncomingRequestData, to capture incoming request data.\n * For use with middleware.\n * @memberof AWSXRay.middleware\n * @see IncomingRequestData\n */\nAWSXRay.middleware.IncomingRequestData = require('./middleware/incoming_request_data'),\n (function () {\n var data = {\n runtime: (process.release && process.release.name) ? process.release.name : UNKNOWN,\n runtime_version: process.version,\n version: process.env.npm_package_version || UNKNOWN,\n name: process.env.npm_package_name || UNKNOWN\n };\n var sdkData = {\n sdk: 'X-Ray for Node.js',\n sdk_version: pkginfo.version ? pkginfo.version : UNKNOWN,\n package: pkginfo.name ? pkginfo.name : UNKNOWN,\n };\n segmentUtils.setSDKData(sdkData);\n segmentUtils.setServiceData(data);\n if (process.env.LAMBDA_TASK_ROOT) {\n LambdaEnv.init();\n }\n })();\nmodule.exports = AWSXRay;\n", "\"use strict\";\n// Convenience file to require the SDK from the root of the repository\nmodule.exports = require('./aws-xray');\n", "import { Context } from 'aws-lambda';\nimport type * as AWS from 'aws-sdk';\nimport * as aws from '../shared/aws.lambda-shared';\nimport { requireEnv } from '../shared/env.lambda-shared';\n\nexport async function handler(event: unknown, context: Context): Promise<void> {\n const stateMachineArn = requireEnv('STATE_MACHINE_ARN');\n const queueUrl = requireEnv('QUEUE_URL');\n\n console.log(`Event: ${JSON.stringify(event, null, 2)}`);\n\n const sfn = aws.stepFunctions();\n\n for await (const message of messagesToRedrive(queueUrl)) {\n const input = JSON.parse(message.Body!);\n console.log(`Redriving message ${JSON.stringify(input, null, 2)}`);\n\n // Strip the docgen field before redriving as this contains error messages that\n // be too long for ECS inputs.\n const { docGen, ...formatted } = input;\n const { executionArn } = await sfn\n .startExecution({\n stateMachineArn: stateMachineArn,\n input: JSON.stringify({\n ...formatted,\n // Remove the _error information\n _error: undefined,\n // Add the redrive information\n _redrive: {\n lambdaRequestId: context.awsRequestId,\n lambdaLogGroupName: context.logGroupName,\n lambdaLogStreamName: context.logStreamName,\n },\n }),\n })\n .promise();\n console.log(`Redrive execution ARN: ${executionArn}`);\n\n await aws\n .sqs()\n .deleteMessage({\n QueueUrl: queueUrl,\n ReceiptHandle: message.ReceiptHandle!,\n })\n .promise();\n }\n}\n\nasync function* messagesToRedrive(queueUrl: string) {\n const sqs = aws.sqs();\n let result: AWS.SQS.ReceiveMessageResult;\n do {\n result = await sqs\n .receiveMessage({\n QueueUrl: queueUrl,\n VisibilityTimeout: 900, // 15 minutes\n })\n .promise();\n if (result.Messages) {\n yield* result.Messages;\n }\n } while (result.Messages != null && result.Messages.length > 0);\n}\n", "import * as _AWS from 'aws-sdk';\nimport * as AWSXRay from 'aws-xray-sdk-core';\n\n// Do nothing if there is no XRay trace context\nAWSXRay.setContextMissingStrategy(() => {});\n\nconst AWS = AWSXRay.captureAWS(_AWS);\n\nlet _s3: AWS.S3 | undefined;\nlet _sqs: AWS.SQS | undefined;\nlet _sfn: AWS.StepFunctions | undefined;\nlet _lambda: AWS.Lambda | undefined;\nlet _codeArtifact: AWS.CodeArtifact | undefined;\n\nexport function s3(): AWS.S3 {\n if (_s3 == null) {\n _s3 = new AWS.S3();\n }\n return _s3;\n}\n\n/**\n * Checks whether an object exists in S3 at the provided bucket and key.\n */\nexport function s3ObjectExists(bucket: string, key: string): Promise<boolean> {\n return s3()\n .headObject({\n Bucket: bucket,\n Key: key,\n })\n .promise()\n .then(\n () => true,\n (cause) => {\n if (cause.code === 'NotFound') {\n return false;\n }\n return Promise.reject(cause);\n }\n );\n}\n\nexport function sqs(): AWS.SQS {\n if (_sqs == null) {\n _sqs = new AWS.SQS();\n }\n return _sqs;\n}\n\nexport function stepFunctions(): AWS.StepFunctions {\n if (_sfn == null) {\n _sfn = new AWS.StepFunctions();\n }\n return _sfn;\n}\n\nexport function lambda(): AWS.Lambda {\n if (_lambda == null) {\n _lambda = new AWS.Lambda();\n }\n return _lambda;\n}\n\nexport function codeArtifact(): AWS.CodeArtifact {\n if (_codeArtifact == null) {\n _codeArtifact = new AWS.CodeArtifact();\n }\n return _codeArtifact;\n}\n\n/**\n * Resets all clients vended by this module. This is useful in unit tests when\n * `aws-sdk-mocks` is used, so that new mocks are injected as intended.\n */\nexport function reset(): void {\n _s3 = _sqs = _sfn = _lambda = _codeArtifact = undefined;\n}\n", "import { env } from 'process';\n\nexport function requireEnv(name: string): string {\n const result = env[name];\n if (!result) {\n throw new Error(\n `No value specified for required environment variable: ${name}`\n );\n }\n return result;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,2CAAAA,SAAA;AAAA;AAEA,aAAS,WAAY,UAAU;AAC7B,aAAO,OAAO,aAAa;AAAA,IA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,QAAQ;AACX,YAAQ,IAAI,0BAA0B,cAAc;AAEpD,UACG,IAAI,EACJ,cAAc;AAAA,MACb,UAAU;AAAA,MACV,eAAe,QAAQ;AAAA,IACzB,CAAC,EACA,QAAQ;AAAA,EACb;AACF;AAEA,gBAAgB,kBAAkB,UAAkB;AAClD,QAAMC,OAAU,IAAI;AACpB,MAAI;AACJ,KAAG;AACD,aAAS,MAAMA,KACZ,eAAe;AAAA,MACd,UAAU;AAAA,MACV,mBAAmB;AAAA,IACrB,CAAC,EACA,QAAQ;AACX,QAAI,OAAO,UAAU;AACnB,aAAO,OAAO;AAAA,IAChB;AAAA,EACF,SAAS,OAAO,YAAY,QAAQ,OAAO,SAAS,SAAS;AAC/D;",
4
+ "sourcesContent": ["'use strict'\n\nfunction isFunction (funktion) {\n return typeof funktion === 'function'\n}\n\n// Default to complaining loudly when things don't go according to plan.\nvar logger = console.error.bind(console)\n\n// Sets a property on an object, preserving its enumerability.\n// This function assumes that the property is already writable.\nfunction defineProperty (obj, name, value) {\n var enumerable = !!obj[name] && obj.propertyIsEnumerable(name)\n Object.defineProperty(obj, name, {\n configurable: true,\n enumerable: enumerable,\n writable: true,\n value: value\n })\n}\n\n// Keep initialization idempotent.\nfunction shimmer (options) {\n if (options && options.logger) {\n if (!isFunction(options.logger)) logger(\"new logger isn't a function, not replacing\")\n else logger = options.logger\n }\n}\n\nfunction wrap (nodule, name, wrapper) {\n if (!nodule || !nodule[name]) {\n logger('no original function ' + name + ' to wrap')\n return\n }\n\n if (!wrapper) {\n logger('no wrapper function')\n logger((new Error()).stack)\n return\n }\n\n if (!isFunction(nodule[name]) || !isFunction(wrapper)) {\n logger('original object and wrapper must be functions')\n return\n }\n\n var original = nodule[name]\n var wrapped = wrapper(original, name)\n\n defineProperty(wrapped, '__original', original)\n defineProperty(wrapped, '__unwrap', function () {\n if (nodule[name] === wrapped) defineProperty(nodule, name, original)\n })\n defineProperty(wrapped, '__wrapped', true)\n\n defineProperty(nodule, name, wrapped)\n return wrapped\n}\n\nfunction massWrap (nodules, names, wrapper) {\n if (!nodules) {\n logger('must provide one or more modules to patch')\n logger((new Error()).stack)\n return\n } else if (!Array.isArray(nodules)) {\n nodules = [nodules]\n }\n\n if (!(names && Array.isArray(names))) {\n logger('must provide one or more functions to wrap on modules')\n return\n }\n\n nodules.forEach(function (nodule) {\n names.forEach(function (name) {\n wrap(nodule, name, wrapper)\n })\n })\n}\n\nfunction unwrap (nodule, name) {\n if (!nodule || !nodule[name]) {\n logger('no function to unwrap.')\n logger((new Error()).stack)\n return\n }\n\n if (!nodule[name].__unwrap) {\n logger('no original to unwrap to -- has ' + name + ' already been unwrapped?')\n } else {\n return nodule[name].__unwrap()\n }\n}\n\nfunction massUnwrap (nodules, names) {\n if (!nodules) {\n logger('must provide one or more modules to patch')\n logger((new Error()).stack)\n return\n } else if (!Array.isArray(nodules)) {\n nodules = [nodules]\n }\n\n if (!(names && Array.isArray(names))) {\n logger('must provide one or more functions to unwrap on modules')\n return\n }\n\n nodules.forEach(function (nodule) {\n names.forEach(function (name) {\n unwrap(nodule, name)\n })\n })\n}\n\nshimmer.wrap = wrap\nshimmer.massWrap = massWrap\nshimmer.unwrap = unwrap\nshimmer.massUnwrap = massUnwrap\n\nmodule.exports = shimmer\n", "'use strict';\n\nvar shimmer = require('shimmer');\nvar wrap = shimmer.wrap;\nvar unwrap = shimmer.unwrap;\n\n// Default to complaining loudly when things don't go according to plan.\n// dunderscores are boring\nvar SYMBOL = 'wrap@before';\n\n// Sets a property on an object, preserving its enumerability.\n// This function assumes that the property is already writable.\nfunction defineProperty(obj, name, value) {\n var enumerable = !!obj[name] && obj.propertyIsEnumerable(name);\n Object.defineProperty(obj, name, {\n configurable: true,\n enumerable: enumerable,\n writable: true,\n value: value\n });\n}\n\nfunction _process(self, listeners) {\n var l = listeners.length;\n for (var p = 0; p < l; p++) {\n var listener = listeners[p];\n // set up the listener so that onEmit can do whatever it needs\n var before = self[SYMBOL];\n if (typeof before === 'function') {\n before(listener);\n }\n else if (Array.isArray(before)) {\n var length = before.length;\n for (var i = 0; i < length; i++) before[i](listener);\n }\n }\n}\n\nfunction _listeners(self, event) {\n var listeners;\n listeners = self._events && self._events[event];\n if (!Array.isArray(listeners)) {\n if (listeners) {\n listeners = [listeners];\n }\n else {\n listeners = [];\n }\n }\n\n return listeners;\n}\n\nfunction _findAndProcess(self, event, before) {\n var after = _listeners(self, event);\n var unprocessed = after.filter(function(fn) { return before.indexOf(fn) === -1; });\n if (unprocessed.length > 0) _process(self, unprocessed);\n}\n\nfunction _wrap(unwrapped, visit) {\n if (!unwrapped) return;\n\n var wrapped = unwrapped;\n if (typeof unwrapped === 'function') {\n wrapped = visit(unwrapped);\n }\n else if (Array.isArray(unwrapped)) {\n wrapped = [];\n for (var i = 0; i < unwrapped.length; i++) {\n wrapped[i] = visit(unwrapped[i]);\n }\n }\n return wrapped;\n}\n\nmodule.exports = function wrapEmitter(emitter, onAddListener, onEmit) {\n if (!emitter || !emitter.on || !emitter.addListener ||\n !emitter.removeListener || !emitter.emit) {\n throw new Error(\"can only wrap real EEs\");\n }\n\n if (!onAddListener) throw new Error(\"must have function to run on listener addition\");\n if (!onEmit) throw new Error(\"must have function to wrap listeners when emitting\");\n\n /* Attach a context to a listener, and make sure that this hook stays\n * attached to the emitter forevermore.\n */\n function adding(on) {\n return function added(event, listener) {\n var existing = _listeners(this, event).slice();\n\n try {\n var returned = on.call(this, event, listener);\n _findAndProcess(this, event, existing);\n return returned;\n }\n finally {\n // old-style streaming overwrites .on and .addListener, so rewrap\n if (!this.on.__wrapped) wrap(this, 'on', adding);\n if (!this.addListener.__wrapped) wrap(this, 'addListener', adding);\n }\n };\n }\n\n function emitting(emit) {\n return function emitted(event) {\n if (!this._events || !this._events[event]) return emit.apply(this, arguments);\n\n var unwrapped = this._events[event];\n\n /* Ensure that if removeListener gets called, it's working with the\n * unwrapped listeners.\n */\n function remover(removeListener) {\n return function removed() {\n this._events[event] = unwrapped;\n try {\n return removeListener.apply(this, arguments);\n }\n finally {\n unwrapped = this._events[event];\n this._events[event] = _wrap(unwrapped, onEmit);\n }\n };\n }\n wrap(this, 'removeListener', remover);\n\n try {\n /* At emit time, ensure that whatever else is going on, removeListener will\n * still work while at the same time running whatever hooks are necessary to\n * make sure the listener is run in the correct context.\n */\n this._events[event] = _wrap(unwrapped, onEmit);\n return emit.apply(this, arguments);\n }\n finally {\n /* Ensure that regardless of what happens when preparing and running the\n * listeners, the status quo ante is restored before continuing.\n */\n unwrap(this, 'removeListener');\n this._events[event] = unwrapped;\n }\n };\n }\n\n // support multiple onAddListeners\n if (!emitter[SYMBOL]) {\n defineProperty(emitter, SYMBOL, onAddListener);\n }\n else if (typeof emitter[SYMBOL] === 'function') {\n defineProperty(emitter, SYMBOL, [emitter[SYMBOL], onAddListener]);\n }\n else if (Array.isArray(emitter[SYMBOL])) {\n emitter[SYMBOL].push(onAddListener);\n }\n\n // only wrap the core functions once\n if (!emitter.__wrapped) {\n wrap(emitter, 'addListener', adding);\n wrap(emitter, 'on', adding);\n wrap(emitter, 'emit', emitting);\n\n defineProperty(emitter, '__unwrap', function () {\n unwrap(emitter, 'addListener');\n unwrap(emitter, 'on');\n unwrap(emitter, 'emit');\n delete emitter[SYMBOL];\n delete emitter.__wrapped;\n });\n defineProperty(emitter, '__wrapped', true);\n }\n};\n", "/* eslint-disable max-len */\n'use strict';\n\nconst util = require('util');\nconst assert = require('assert');\nconst wrapEmitter = require('emitter-listener');\nconst async_hooks = require('async_hooks');\n\nconst CONTEXTS_SYMBOL = 'cls@contexts';\nconst ERROR_SYMBOL = 'error@context';\n\nconst DEBUG_CLS_HOOKED = process.env.DEBUG_CLS_HOOKED;\n\nlet currentUid = -1;\n\nmodule.exports = {\n getNamespace: getNamespace,\n createNamespace: createNamespace,\n destroyNamespace: destroyNamespace,\n reset: reset,\n ERROR_SYMBOL: ERROR_SYMBOL\n};\n\nfunction Namespace(name) {\n this.name = name;\n // changed in 2.7: no default context\n this.active = null;\n this._set = [];\n this.id = null;\n this._contexts = new Map();\n this._indent = 0;\n}\n\nNamespace.prototype.set = function set(key, value) {\n if (!this.active) {\n throw new Error('No context available. ns.run() or ns.bind() must be called first.');\n }\n\n this.active[key] = value;\n\n if (DEBUG_CLS_HOOKED) {\n const indentStr = ' '.repeat(this._indent < 0 ? 0 : this._indent);\n debug2(indentStr + 'CONTEXT-SET KEY:' + key + '=' + value + ' in ns:' + this.name + ' currentUid:' + currentUid + ' active:' + util.inspect(this.active, {showHidden:true, depth:2, colors:true}));\n }\n\n return value;\n};\n\nNamespace.prototype.get = function get(key) {\n if (!this.active) {\n if (DEBUG_CLS_HOOKED) {\n const asyncHooksCurrentId = async_hooks.currentId();\n const triggerId = async_hooks.triggerAsyncId();\n const indentStr = ' '.repeat(this._indent < 0 ? 0 : this._indent);\n //debug2(indentStr + 'CONTEXT-GETTING KEY NO ACTIVE NS:' + key + '=undefined' + ' (' + this.name + ') currentUid:' + currentUid + ' active:' + util.inspect(this.active, {showHidden:true, depth:2, colors:true}));\n debug2(`${indentStr}CONTEXT-GETTING KEY NO ACTIVE NS: (${this.name}) ${key}=undefined currentUid:${currentUid} asyncHooksCurrentId:${asyncHooksCurrentId} triggerId:${triggerId} len:${this._set.length}`);\n }\n return undefined;\n }\n if (DEBUG_CLS_HOOKED) {\n const asyncHooksCurrentId = async_hooks.executionAsyncId();\n const triggerId = async_hooks.triggerAsyncId();\n const indentStr = ' '.repeat(this._indent < 0 ? 0 : this._indent);\n debug2(indentStr + 'CONTEXT-GETTING KEY:' + key + '=' + this.active[key] + ' (' + this.name + ') currentUid:' + currentUid + ' active:' + util.inspect(this.active, {showHidden:true, depth:2, colors:true}));\n debug2(`${indentStr}CONTEXT-GETTING KEY: (${this.name}) ${key}=${this.active[key]} currentUid:${currentUid} asyncHooksCurrentId:${asyncHooksCurrentId} triggerId:${triggerId} len:${this._set.length} active:${util.inspect(this.active)}`);\n }\n return this.active[key];\n};\n\nNamespace.prototype.createContext = function createContext() {\n // Prototype inherit existing context if created a new child context within existing context.\n let context = Object.create(this.active ? this.active : Object.prototype);\n context._ns_name = this.name;\n context.id = currentUid;\n\n if (DEBUG_CLS_HOOKED) {\n const asyncHooksCurrentId = async_hooks.executionAsyncId();\n const triggerId = async_hooks.triggerAsyncId();\n const indentStr = ' '.repeat(this._indent < 0 ? 0 : this._indent);\n debug2(`${indentStr}CONTEXT-CREATED Context: (${this.name}) currentUid:${currentUid} asyncHooksCurrentId:${asyncHooksCurrentId} triggerId:${triggerId} len:${this._set.length} context:${util.inspect(context, {showHidden:true, depth:2, colors:true})}`);\n }\n\n return context;\n};\n\nNamespace.prototype.run = function run(fn) {\n let context = this.createContext();\n this.enter(context);\n\n try {\n if (DEBUG_CLS_HOOKED) {\n const triggerId = async_hooks.triggerAsyncId();\n const asyncHooksCurrentId = async_hooks.executionAsyncId();\n const indentStr = ' '.repeat(this._indent < 0 ? 0 : this._indent);\n debug2(`${indentStr}CONTEXT-RUN BEGIN: (${this.name}) currentUid:${currentUid} triggerId:${triggerId} asyncHooksCurrentId:${asyncHooksCurrentId} len:${this._set.length} context:${util.inspect(context)}`);\n }\n fn(context);\n return context;\n } catch (exception) {\n if (exception) {\n exception[ERROR_SYMBOL] = context;\n }\n throw exception;\n } finally {\n if (DEBUG_CLS_HOOKED) {\n const triggerId = async_hooks.triggerAsyncId();\n const asyncHooksCurrentId = async_hooks.executionAsyncId();\n const indentStr = ' '.repeat(this._indent < 0 ? 0 : this._indent);\n debug2(`${indentStr}CONTEXT-RUN END: (${this.name}) currentUid:${currentUid} triggerId:${triggerId} asyncHooksCurrentId:${asyncHooksCurrentId} len:${this._set.length} ${util.inspect(context)}`);\n }\n this.exit(context);\n }\n};\n\nNamespace.prototype.runAndReturn = function runAndReturn(fn) {\n let value;\n this.run(function (context) {\n value = fn(context);\n });\n return value;\n};\n\n/**\n * Uses global Promise and assumes Promise is cls friendly or wrapped already.\n * @param {function} fn\n * @returns {*}\n */\nNamespace.prototype.runPromise = function runPromise(fn) {\n let context = this.createContext();\n this.enter(context);\n\n let promise = fn(context);\n if (!promise || !promise.then || !promise.catch) {\n throw new Error('fn must return a promise.');\n }\n\n if (DEBUG_CLS_HOOKED) {\n debug2('CONTEXT-runPromise BEFORE: (' + this.name + ') currentUid:' + currentUid + ' len:' + this._set.length + ' ' + util.inspect(context));\n }\n\n return promise\n .then(result => {\n if (DEBUG_CLS_HOOKED) {\n debug2('CONTEXT-runPromise AFTER then: (' + this.name + ') currentUid:' + currentUid + ' len:' + this._set.length + ' ' + util.inspect(context));\n }\n this.exit(context);\n return result;\n })\n .catch(err => {\n err[ERROR_SYMBOL] = context;\n if (DEBUG_CLS_HOOKED) {\n debug2('CONTEXT-runPromise AFTER catch: (' + this.name + ') currentUid:' + currentUid + ' len:' + this._set.length + ' ' + util.inspect(context));\n }\n this.exit(context);\n throw err;\n });\n};\n\nNamespace.prototype.bind = function bindFactory(fn, context) {\n if (!context) {\n if (!this.active) {\n context = this.createContext();\n } else {\n context = this.active;\n }\n }\n\n let self = this;\n return function clsBind() {\n self.enter(context);\n try {\n return fn.apply(this, arguments);\n } catch (exception) {\n if (exception) {\n exception[ERROR_SYMBOL] = context;\n }\n throw exception;\n } finally {\n self.exit(context);\n }\n };\n};\n\nNamespace.prototype.enter = function enter(context) {\n assert.ok(context, 'context must be provided for entering');\n if (DEBUG_CLS_HOOKED) {\n const asyncHooksCurrentId = async_hooks.executionAsyncId();\n const triggerId = async_hooks.triggerAsyncId();\n const indentStr = ' '.repeat(this._indent < 0 ? 0 : this._indent);\n debug2(`${indentStr}CONTEXT-ENTER: (${this.name}) currentUid:${currentUid} triggerId:${triggerId} asyncHooksCurrentId:${asyncHooksCurrentId} len:${this._set.length} ${util.inspect(context)}`);\n }\n\n this._set.push(this.active);\n this.active = context;\n};\n\nNamespace.prototype.exit = function exit(context) {\n assert.ok(context, 'context must be provided for exiting');\n if (DEBUG_CLS_HOOKED) {\n const asyncHooksCurrentId = async_hooks.executionAsyncId();\n const triggerId = async_hooks.triggerAsyncId();\n const indentStr = ' '.repeat(this._indent < 0 ? 0 : this._indent);\n debug2(`${indentStr}CONTEXT-EXIT: (${this.name}) currentUid:${currentUid} triggerId:${triggerId} asyncHooksCurrentId:${asyncHooksCurrentId} len:${this._set.length} ${util.inspect(context)}`);\n }\n\n // Fast path for most exits that are at the top of the stack\n if (this.active === context) {\n assert.ok(this._set.length, 'can\\'t remove top context');\n this.active = this._set.pop();\n return;\n }\n\n // Fast search in the stack using lastIndexOf\n let index = this._set.lastIndexOf(context);\n\n if (index < 0) {\n if (DEBUG_CLS_HOOKED) {\n debug2('??ERROR?? context exiting but not entered - ignoring: ' + util.inspect(context));\n }\n assert.ok(index >= 0, 'context not currently entered; can\\'t exit. \\n' + util.inspect(this) + '\\n' + util.inspect(context));\n } else {\n assert.ok(index, 'can\\'t remove top context');\n this._set.splice(index, 1);\n }\n};\n\nNamespace.prototype.bindEmitter = function bindEmitter(emitter) {\n assert.ok(emitter.on && emitter.addListener && emitter.emit, 'can only bind real EEs');\n\n let namespace = this;\n let thisSymbol = 'context@' + this.name;\n\n // Capture the context active at the time the emitter is bound.\n function attach(listener) {\n if (!listener) {\n return;\n }\n if (!listener[CONTEXTS_SYMBOL]) {\n listener[CONTEXTS_SYMBOL] = Object.create(null);\n }\n\n listener[CONTEXTS_SYMBOL][thisSymbol] = {\n namespace: namespace,\n context: namespace.active\n };\n }\n\n // At emit time, bind the listener within the correct context.\n function bind(unwrapped) {\n if (!(unwrapped && unwrapped[CONTEXTS_SYMBOL])) {\n return unwrapped;\n }\n\n let wrapped = unwrapped;\n let unwrappedContexts = unwrapped[CONTEXTS_SYMBOL];\n Object.keys(unwrappedContexts).forEach(function (name) {\n let thunk = unwrappedContexts[name];\n wrapped = thunk.namespace.bind(wrapped, thunk.context);\n });\n return wrapped;\n }\n\n wrapEmitter(emitter, attach, bind);\n};\n\n/**\n * If an error comes out of a namespace, it will have a context attached to it.\n * This function knows how to find it.\n *\n * @param {Error} exception Possibly annotated error.\n */\nNamespace.prototype.fromException = function fromException(exception) {\n return exception[ERROR_SYMBOL];\n};\n\nfunction getNamespace(name) {\n return process.namespaces[name];\n}\n\nfunction createNamespace(name) {\n assert.ok(name, 'namespace must be given a name.');\n\n if (DEBUG_CLS_HOOKED) {\n debug2(`NS-CREATING NAMESPACE (${name})`);\n }\n let namespace = new Namespace(name);\n namespace.id = currentUid;\n\n const hook = async_hooks.createHook({\n init(asyncId, type, triggerId, resource) {\n currentUid = async_hooks.executionAsyncId();\n\n //CHAIN Parent's Context onto child if none exists. This is needed to pass net-events.spec\n // let initContext = namespace.active;\n // if(!initContext && triggerId) {\n // let parentContext = namespace._contexts.get(triggerId);\n // if (parentContext) {\n // namespace.active = parentContext;\n // namespace._contexts.set(currentUid, parentContext);\n // if (DEBUG_CLS_HOOKED) {\n // const indentStr = ' '.repeat(namespace._indent < 0 ? 0 : namespace._indent);\n // debug2(`${indentStr}INIT [${type}] (${name}) WITH PARENT CONTEXT asyncId:${asyncId} currentUid:${currentUid} triggerId:${triggerId} active:${util.inspect(namespace.active, true)} resource:${resource}`);\n // }\n // } else if (DEBUG_CLS_HOOKED) {\n // const indentStr = ' '.repeat(namespace._indent < 0 ? 0 : namespace._indent);\n // debug2(`${indentStr}INIT [${type}] (${name}) MISSING CONTEXT asyncId:${asyncId} currentUid:${currentUid} triggerId:${triggerId} active:${util.inspect(namespace.active, true)} resource:${resource}`);\n // }\n // }else {\n // namespace._contexts.set(currentUid, namespace.active);\n // if (DEBUG_CLS_HOOKED) {\n // const indentStr = ' '.repeat(namespace._indent < 0 ? 0 : namespace._indent);\n // debug2(`${indentStr}INIT [${type}] (${name}) asyncId:${asyncId} currentUid:${currentUid} triggerId:${triggerId} active:${util.inspect(namespace.active, true)} resource:${resource}`);\n // }\n // }\n if(namespace.active) {\n namespace._contexts.set(asyncId, namespace.active);\n\n if (DEBUG_CLS_HOOKED) {\n const indentStr = ' '.repeat(namespace._indent < 0 ? 0 : namespace._indent);\n debug2(`${indentStr}INIT [${type}] (${name}) asyncId:${asyncId} currentUid:${currentUid} triggerId:${triggerId} active:${util.inspect(namespace.active, {showHidden:true, depth:2, colors:true})} resource:${resource}`);\n }\n }else if(currentUid === 0){\n // CurrentId will be 0 when triggered from C++. Promise events\n // https://github.com/nodejs/node/blob/master/doc/api/async_hooks.md#triggerid\n const triggerId = async_hooks.triggerAsyncId();\n const triggerIdContext = namespace._contexts.get(triggerId);\n if (triggerIdContext) {\n namespace._contexts.set(asyncId, triggerIdContext);\n if (DEBUG_CLS_HOOKED) {\n const indentStr = ' '.repeat(namespace._indent < 0 ? 0 : namespace._indent);\n debug2(`${indentStr}INIT USING CONTEXT FROM TRIGGERID [${type}] (${name}) asyncId:${asyncId} currentUid:${currentUid} triggerId:${triggerId} active:${util.inspect(namespace.active, { showHidden: true, depth: 2, colors: true })} resource:${resource}`);\n }\n } else if (DEBUG_CLS_HOOKED) {\n const indentStr = ' '.repeat(namespace._indent < 0 ? 0 : namespace._indent);\n debug2(`${indentStr}INIT MISSING CONTEXT [${type}] (${name}) asyncId:${asyncId} currentUid:${currentUid} triggerId:${triggerId} active:${util.inspect(namespace.active, { showHidden: true, depth: 2, colors: true })} resource:${resource}`);\n }\n }\n\n\n if(DEBUG_CLS_HOOKED && type === 'PROMISE'){\n debug2(util.inspect(resource, {showHidden: true}));\n const parentId = resource.parentId;\n const indentStr = ' '.repeat(namespace._indent < 0 ? 0 : namespace._indent);\n debug2(`${indentStr}INIT RESOURCE-PROMISE [${type}] (${name}) parentId:${parentId} asyncId:${asyncId} currentUid:${currentUid} triggerId:${triggerId} active:${util.inspect(namespace.active, {showHidden:true, depth:2, colors:true})} resource:${resource}`);\n }\n\n },\n before(asyncId) {\n currentUid = async_hooks.executionAsyncId();\n let context;\n\n /*\n if(currentUid === 0){\n // CurrentId will be 0 when triggered from C++. Promise events\n // https://github.com/nodejs/node/blob/master/doc/api/async_hooks.md#triggerid\n //const triggerId = async_hooks.triggerAsyncId();\n context = namespace._contexts.get(asyncId); // || namespace._contexts.get(triggerId);\n }else{\n context = namespace._contexts.get(currentUid);\n }\n */\n\n //HACK to work with promises until they are fixed in node > 8.1.1\n context = namespace._contexts.get(asyncId) || namespace._contexts.get(currentUid);\n\n if (context) {\n if (DEBUG_CLS_HOOKED) {\n const triggerId = async_hooks.triggerAsyncId();\n const indentStr = ' '.repeat(namespace._indent < 0 ? 0 : namespace._indent);\n debug2(`${indentStr}BEFORE (${name}) asyncId:${asyncId} currentUid:${currentUid} triggerId:${triggerId} active:${util.inspect(namespace.active, {showHidden:true, depth:2, colors:true})} context:${util.inspect(context)}`);\n namespace._indent += 2;\n }\n\n namespace.enter(context);\n\n } else if (DEBUG_CLS_HOOKED) {\n const triggerId = async_hooks.triggerAsyncId();\n const indentStr = ' '.repeat(namespace._indent < 0 ? 0 : namespace._indent);\n debug2(`${indentStr}BEFORE MISSING CONTEXT (${name}) asyncId:${asyncId} currentUid:${currentUid} triggerId:${triggerId} active:${util.inspect(namespace.active, {showHidden:true, depth:2, colors:true})} namespace._contexts:${util.inspect(namespace._contexts, {showHidden:true, depth:2, colors:true})}`);\n namespace._indent += 2;\n }\n },\n after(asyncId) {\n currentUid = async_hooks.executionAsyncId();\n let context; // = namespace._contexts.get(currentUid);\n /*\n if(currentUid === 0){\n // CurrentId will be 0 when triggered from C++. Promise events\n // https://github.com/nodejs/node/blob/master/doc/api/async_hooks.md#triggerid\n //const triggerId = async_hooks.triggerAsyncId();\n context = namespace._contexts.get(asyncId); // || namespace._contexts.get(triggerId);\n }else{\n context = namespace._contexts.get(currentUid);\n }\n */\n //HACK to work with promises until they are fixed in node > 8.1.1\n context = namespace._contexts.get(asyncId) || namespace._contexts.get(currentUid);\n\n if (context) {\n if (DEBUG_CLS_HOOKED) {\n const triggerId = async_hooks.triggerAsyncId();\n namespace._indent -= 2;\n const indentStr = ' '.repeat(namespace._indent < 0 ? 0 : namespace._indent);\n debug2(`${indentStr}AFTER (${name}) asyncId:${asyncId} currentUid:${currentUid} triggerId:${triggerId} active:${util.inspect(namespace.active, {showHidden:true, depth:2, colors:true})} context:${util.inspect(context)}`);\n }\n\n namespace.exit(context);\n\n } else if (DEBUG_CLS_HOOKED) {\n const triggerId = async_hooks.triggerAsyncId();\n namespace._indent -= 2;\n const indentStr = ' '.repeat(namespace._indent < 0 ? 0 : namespace._indent);\n debug2(`${indentStr}AFTER MISSING CONTEXT (${name}) asyncId:${asyncId} currentUid:${currentUid} triggerId:${triggerId} active:${util.inspect(namespace.active, {showHidden:true, depth:2, colors:true})} context:${util.inspect(context)}`);\n }\n },\n destroy(asyncId) {\n currentUid = async_hooks.executionAsyncId();\n if (DEBUG_CLS_HOOKED) {\n const triggerId = async_hooks.triggerAsyncId();\n const indentStr = ' '.repeat(namespace._indent < 0 ? 0 : namespace._indent);\n debug2(`${indentStr}DESTROY (${name}) currentUid:${currentUid} asyncId:${asyncId} triggerId:${triggerId} active:${util.inspect(namespace.active, {showHidden:true, depth:2, colors:true})} context:${util.inspect(namespace._contexts.get(currentUid))}`);\n }\n\n namespace._contexts.delete(asyncId);\n }\n });\n\n hook.enable();\n\n process.namespaces[name] = namespace;\n return namespace;\n}\n\nfunction destroyNamespace(name) {\n let namespace = getNamespace(name);\n\n assert.ok(namespace, 'can\\'t delete nonexistent namespace! \"' + name + '\"');\n assert.ok(namespace.id, 'don\\'t assign to process.namespaces directly! ' + util.inspect(namespace));\n\n process.namespaces[name] = null;\n}\n\nfunction reset() {\n // must unregister async listeners\n if (process.namespaces) {\n Object.keys(process.namespaces).forEach(function (name) {\n destroyNamespace(name);\n });\n }\n process.namespaces = Object.create(null);\n}\n\nprocess.namespaces = {};\n\n//const fs = require('fs');\nfunction debug2(...args) {\n if (DEBUG_CLS_HOOKED) {\n //fs.writeSync(1, `${util.format(...args)}\\n`);\n process._rawDebug(`${util.format(...args)}`);\n }\n}\n\n/*function getFunctionName(fn) {\n if (!fn) {\n return fn;\n }\n if (typeof fn === 'function') {\n if (fn.name) {\n return fn.name;\n }\n return (fn.toString().trim().match(/^function\\s*([^\\s(]+)/) || [])[1];\n } else if (fn.constructor && fn.constructor.name) {\n return fn.constructor.name;\n }\n}*/\n\n\n", "\"use strict\";\nvar validLogLevels = ['debug', 'info', 'warn', 'error', 'silent'];\nvar defaultLogLevel = validLogLevels.indexOf('error');\nvar logLevel = calculateLogLevel(process.env.AWS_XRAY_DEBUG_MODE ? 'debug' : process.env.AWS_XRAY_LOG_LEVEL);\nvar logger = {\n error: createLoggerForLevel('error'),\n info: createLoggerForLevel('info'),\n warn: createLoggerForLevel('warn'),\n debug: createLoggerForLevel('debug'),\n};\nfunction createLoggerForLevel(level) {\n var loggerLevel = validLogLevels.indexOf(level);\n var consoleMethod = console[level] || console.log || (() => { });\n if (loggerLevel >= logLevel) {\n return (message, meta) => {\n if (message || meta) {\n consoleMethod(formatLogMessage(level, message, meta));\n }\n };\n }\n else {\n return () => { };\n }\n}\nfunction calculateLogLevel(level) {\n if (level) {\n var normalisedLevel = level.toLowerCase();\n var index = validLogLevels.indexOf(normalisedLevel);\n return index >= 0 ? index : defaultLogLevel;\n }\n // Silently ignore invalid log levels, default to default level\n return defaultLogLevel;\n}\nfunction createTimestamp(date) {\n var tzo = -date.getTimezoneOffset(), // Negate to make this tzo = local - UTC\n dif = tzo >= 0 ? '+' : '-', pad = function (num) {\n var norm = Math.floor(Math.abs(num));\n return (norm < 10 ? '0' : '') + norm;\n };\n return new Date(date.getTime() + (tzo * 60 * 1000)).toISOString()\n .replace(/T/, ' ')\n .replace(/Z/, ' ') +\n dif + pad(tzo / 60) +\n ':' + pad(tzo % 60);\n}\nfunction isLambdaFunction() {\n return process.env.LAMBDA_TASK_ROOT !== undefined;\n}\nfunction formatLogMessage(level, message, meta) {\n var messageParts = [];\n if (!isLambdaFunction()) {\n messageParts.push(createTimestamp(new Date()));\n messageParts.push(`[${level.toUpperCase()}]`);\n }\n if (message) {\n messageParts.push(message);\n }\n var logString = messageParts.join(' ');\n var metaDataString = formatMetaData(meta);\n return [logString, metaDataString].filter(str => str.length > 0).join('\\n ');\n}\nfunction formatMetaData(meta) {\n if (!meta) {\n return '';\n }\n return ((typeof (meta) === 'string') ? meta : JSON.stringify(meta));\n}\nvar logging = {\n setLogger: function setLogger(logObj) {\n logger = logObj;\n },\n getLogger: function getLogger() {\n return logger;\n }\n};\nmodule.exports = logging;\n", "\"use strict\";\nconst crypto = require('crypto');\n/**\n * Represents a captured exception.\n * @constructor\n * @param {Exception} err - The exception to capture.\n * @param {boolean} [remote] - Flag for whether the error was remote.\n */\nfunction CapturedException(err, remote) {\n this.init(err, remote);\n}\nCapturedException.prototype.init = function init(err, remote) {\n var e = (typeof err === 'string' || err instanceof String) ? { message: err, name: '' } : err;\n this.message = e.message;\n this.type = e.name;\n this.stack = [];\n this.remote = !!remote;\n this.id = crypto.randomBytes(8).toString('hex');\n if (e.stack) {\n var stack = e.stack.split('\\n');\n stack.shift();\n stack.forEach((stackline) => {\n var line = stackline.trim().replace(/\\(|\\)/g, '');\n line = line.substring(line.indexOf(' ') + 1);\n var label = line.lastIndexOf(' ') >= 0 ? line.slice(0, line.lastIndexOf(' ')) : null;\n var path = Array.isArray(label) && !label.length ? line : line.slice(line.lastIndexOf(' ') + 1);\n path = path.split(':');\n var entry = {\n path: path[0],\n line: parseInt(path[1]),\n label: label || 'anonymous'\n };\n this.stack.push(entry);\n }, this);\n }\n};\nmodule.exports = CapturedException;\n", "module.exports = batcher\n\nfunction batcher (run) {\n var running = false\n var pendingBatch = null\n var pendingCallbacks = null\n var callbacks = null\n\n return append\n\n function done (err) {\n if (callbacks) callAll(callbacks, err)\n\n running = false\n callbacks = pendingCallbacks\n var nextBatch = pendingBatch\n\n pendingBatch = null\n pendingCallbacks = null\n\n if (!nextBatch || !nextBatch.length) {\n if (!callbacks || !callbacks.length) {\n callbacks = null\n return\n }\n if (!nextBatch) nextBatch = []\n }\n\n running = true\n run(nextBatch, done)\n }\n\n function append (val, cb) {\n if (running) {\n if (!pendingBatch) {\n pendingBatch = []\n pendingCallbacks = []\n }\n pushAll(pendingBatch, val)\n if (cb) pendingCallbacks.push(cb)\n } else {\n if (cb) callbacks = [cb]\n running = true\n run(Array.isArray(val) ? val : [val], done)\n }\n }\n}\n\nfunction pushAll (list, val) {\n if (Array.isArray(val)) pushArray(list, val)\n else list.push(val)\n}\n\nfunction pushArray (list, val) {\n for (var i = 0; i < val.length; i++) list.push(val[i])\n}\n\nfunction callAll (list, err) {\n for (var i = 0; i < list.length; i++) list[i](err)\n}\n", "\"use strict\";\nvar logger = require('./logger');\n/**\n * A module representing the X-Ray daemon configuration including the udp and tcp addresses.\n * @module DaemonConfig\n */\nvar DaemonConfig = {\n udp_ip: '127.0.0.1',\n udp_port: 2000,\n tcp_ip: '127.0.0.1',\n tcp_port: 2000,\n setDaemonAddress: function setDaemonAddress(address) {\n if (!process.env.AWS_XRAY_DAEMON_ADDRESS) {\n processAddress(address);\n logger.getLogger().info('Configured daemon address to ' + address + '.');\n }\n else {\n logger.getLogger().warn('Ignoring call to setDaemonAddress as AWS_XRAY_DAEMON_ADDRESS is set. ' +\n 'The current daemon address will not be changed.');\n }\n }\n};\nvar processAddress = function processAddress(address) {\n if (address.indexOf(':') === -1) {\n throw new Error('Invalid Daemon Address. You must specify an ip and port.');\n }\n else {\n var splitAddress = address.split(' ');\n if (splitAddress.length === 1) {\n // in format of 127.0.0.1:2000\n if (address.indexOf('udp') > -1 || address.indexOf('tcp') > -1) {\n throw new Error('Invalid Daemon Address. You must specify both tcp and udp addresses.');\n }\n var addr = address.split(':');\n if (!addr[0]) {\n throw new Error('Invalid Daemon Address. You must specify an ip.');\n }\n DaemonConfig.udp_ip = addr[0];\n DaemonConfig.tcp_ip = addr[0];\n DaemonConfig.udp_port = addr[1];\n DaemonConfig.tcp_port = addr[1];\n }\n else if (splitAddress.length === 2) {\n // in format of udp:127.0.0.1:2000 tcp:127.0.0.1:2001\n var part_1 = splitAddress[0].split(':');\n var part_2 = splitAddress[1].split(':');\n var addr_map = {};\n addr_map[part_1[0]] = part_1;\n addr_map[part_2[0]] = part_2;\n DaemonConfig.udp_ip = addr_map['udp'][1];\n DaemonConfig.udp_port = parseInt(addr_map['udp'][2]);\n DaemonConfig.tcp_ip = addr_map['tcp'][1];\n DaemonConfig.tcp_port = parseInt(addr_map['tcp'][2]);\n if (!DaemonConfig.udp_port || !DaemonConfig.tcp_port) {\n throw new Error('Invalid Daemon Address. You must specify port number.');\n }\n }\n }\n};\nif (process.env.AWS_XRAY_DAEMON_ADDRESS) {\n processAddress(process.env.AWS_XRAY_DAEMON_ADDRESS);\n}\nmodule.exports = DaemonConfig;\n", "\"use strict\";\nvar dgram = require('dgram');\nvar batcher = require('atomic-batcher');\nvar logger = require('./logger');\nvar PROTOCOL_HEADER = '{\"format\":\"json\",\"version\":1}';\nvar PROTOCOL_DELIMITER = '\\n';\n/**\n * Sends a collection of data over a UDP socket. This method\n * is designed to be used by `atomic-batcher` as a way to share\n * a single UDP socket for sending multiple data blocks.\n *\n * @param {object} ops - Details of the data to send\n * @param {Function} callback - The function to call when done\n */\nfunction batchSendData(ops, callback) {\n var client = dgram.createSocket('udp4');\n executeSendData(client, ops, 0, function () {\n try {\n client.close();\n }\n finally {\n callback();\n }\n });\n}\n/**\n * Execute sending data starting at the specified index and\n * using the provided client.\n *\n * @param {Socket} client - Socket to send data with\n * @param {object} ops - Details of data to send\n * @param {number} index - Starting index for sending\n * @param {Function} callback - Function to call when done\n */\nfunction executeSendData(client, ops, index, callback) {\n if (index >= ops.length) {\n callback();\n return;\n }\n sendMessage(client, ops[index], function () {\n executeSendData(client, ops, index + 1, callback);\n });\n}\n/**\n * Send a single message over a UDP socket.\n *\n * @param {Socket} client - Socket to send data with\n * @param {object} data - Details of the data to send\n * @param {Function} batchCallback - Function to call when done\n */\nfunction sendMessage(client, data, batchCallback) {\n var msg = data.msg;\n var offset = data.offset;\n var length = data.length;\n var port = data.port;\n var address = data.address;\n var callback = data.callback;\n client.send(msg, offset, length, port, address, function (err) {\n try {\n callback(err);\n }\n finally {\n batchCallback();\n }\n });\n}\n/**\n * Class to mimic the Socket interface for a UDP client, but to provided\n * batching of outgoing sends using temporary Sockets that are created and\n * destroyed as needed.\n */\nfunction BatchingTemporarySocket() {\n this.batchSend = batcher(batchSendData);\n}\n/**\n * Provide the same signature as the Socket.send method but the work will be\n * batched to share temporary UDP sockets whenever possible.\n */\nBatchingTemporarySocket.prototype.send = function (msg, offset, length, port, address, callback) {\n var work = {\n msg: msg,\n offset: offset,\n length: length,\n port: port,\n address: address,\n callback: callback\n };\n this.batchSend(work);\n};\n/**\n * Segment emitter module.\n * @module SegmentEmitter\n */\nvar SegmentEmitter = {\n daemonConfig: require('./daemon_config'),\n /**\n * Returns the formatted segment JSON string.\n */\n format: function format(segment) {\n return PROTOCOL_HEADER + PROTOCOL_DELIMITER + segment.toString();\n },\n /**\n * Creates a UDP socket connection and send the formatted segment.\n * @param {Segment} segment - The segment to send to the daemon.\n */\n send: function send(segment) {\n if (!this.socket) {\n if (this.useBatchingTemporarySocket) {\n this.socket = new BatchingTemporarySocket();\n }\n else {\n this.socket = dgram.createSocket('udp4').unref();\n }\n }\n var client = this.socket;\n var formatted = segment.format();\n var data = PROTOCOL_HEADER + PROTOCOL_DELIMITER + formatted;\n var message = Buffer.from(data);\n var short = '{\"trace_id:\"' + segment.trace_id + '\",\"id\":\"' + segment.id + '\"}';\n var type = segment.type === 'subsegment' ? 'Subsegment' : 'Segment';\n client.send(message, 0, message.length, this.daemonConfig.udp_port, this.daemonConfig.udp_ip, function (err) {\n if (err) {\n if (err.code === 'EMSGSIZE') {\n logger.getLogger().error(type + ' too large to send: ' + short + ' (' + message.length + ' bytes).');\n }\n else {\n logger.getLogger().error('Error occured sending segment: ', err);\n }\n }\n else {\n logger.getLogger().debug(type + ' sent: {\"trace_id:\"' + segment.trace_id + '\",\"id\":\"' + segment.id + '\"}');\n logger.getLogger().debug('UDP message sent: ' + segment);\n }\n });\n },\n /**\n * Configures the address and/or port the daemon is expected to be on.\n * @param {string} address - Address of the daemon the segments should be sent to. Should be formatted as an IPv4 address.\n * @module SegmentEmitter\n * @function setDaemonAddress\n */\n setDaemonAddress: function setDaemonAddress(address) {\n this.daemonConfig.setDaemonAddress(address);\n },\n /**\n * Get the UDP IP the emitter is configured to.\n * @module SegmentEmitter\n * @function getIp\n */\n getIp: function getIp() {\n return this.daemonConfig.udp_ip;\n },\n /**\n * Get the UDP port the emitter is configured to.\n * @module SegmentEmitter\n * @function getPort\n */\n getPort: function getPort() {\n return this.daemonConfig.udp_port;\n },\n /**\n * Forces the segment emitter to create a new socket on send, and close it on complete.\n * @module SegmentEmitter\n * @function disableReusableSocket\n */\n disableReusableSocket: function () {\n this.useBatchingTemporarySocket = true;\n }\n};\nmodule.exports = SegmentEmitter;\n", "\"use strict\";\nvar crypto = require('crypto');\nvar logger = require('../../logger');\n/**\n * Class describing an AWS X-Ray trace ID.\n * @see https://docs.aws.amazon.com/xray/latest/devguide/xray-concepts.html#xray-concepts-traces\n */\nclass TraceID {\n /**\n * Constructs a new trace ID using the current time.\n * @param {string} [tsHex] - time stamp to use for trace ID in hexadecimal format\n * @param {string} [numberhex] - string of hexadecimal characters for random portion of Trace ID\n * @constructor\n */\n constructor(tsHex, numberhex) {\n this.version = 1;\n this.timestamp = tsHex || Math.round(new Date().getTime() / 1000).toString(16);\n this.id = numberhex || crypto.randomBytes(12).toString('hex');\n }\n /**\n * @returns {TraceID} - a hardcoded trace ID using zeroed timestamp and random ID\n */\n static Invalid() {\n return new TraceID('00000000', '000000000000000000000000');\n }\n /**\n * Constructs a new trace ID from provided string. If no string is provided or the provided string is invalid,\n * log an error but a new trace ID still returned. This can be used as a trace ID string validator.\n * @param {string} [rawID] - string to create a Trace ID object from.\n */\n static FromString(rawID) {\n const DELIMITER = '-';\n var traceID = new TraceID();\n var version, timestamp;\n if (!rawID || typeof rawID !== 'string') {\n logger.getLogger().error('Empty or non-string trace ID provided');\n return traceID;\n }\n const parts = rawID.trim().split(DELIMITER);\n if (parts.length !== 3) {\n logger.getLogger().error('Unrecognized trace ID format');\n return traceID;\n }\n version = parseInt(parts[0]);\n if (isNaN(version) || version < 1) {\n logger.getLogger().error('Trace ID version must be positive integer');\n return traceID;\n }\n timestamp = parseInt(parts[1], 16).toString(16);\n if (timestamp === 'NaN') {\n logger.getLogger().error('Trace ID timestamp must be a hex-encoded value');\n return traceID;\n }\n traceID.version = version;\n traceID.timestamp = timestamp;\n traceID.id = parts[2];\n return traceID;\n }\n /**\n * Returns a string representation of the trace ID.\n * @returns {string} - stringified trace ID, e.g. 1-57fbe041-2c7ad569f5d6ff149137be86\n */\n toString() {\n return `${this.version.toString()}-${this.timestamp}-${this.id}`;\n }\n}\nmodule.exports = TraceID;\n", "\"use strict\";\n/**\n * @module utils\n */\nvar crypto = require('crypto');\nvar logger = require('./logger');\nvar TraceID = require('./segments/attributes/trace_id');\nvar utils = {\n /**\n * Checks a HTTP response code, where 4xx are 'error' and 5xx are 'fault'.\n * @param {string} status - the HTTP response status code.\n * @returns [string] - 'error', 'fault' or nothing on no match\n * @alias module:utils.getCauseTypeFromHttpStatus\n */\n getCauseTypeFromHttpStatus: function getCauseTypeFromHttpStatus(status) {\n var stat = status.toString();\n if (stat.match(/^[4][0-9]{2}$/) !== null) {\n return 'error';\n }\n else if (stat.match(/^[5][0-9]{2}$/) !== null) {\n return 'fault';\n }\n },\n /**\n * Removes the query string parameters from a given http request path\n * as it may contain sensitive information\n *\n * Related issue: https://github.com/aws/aws-xray-sdk-node/issues/246\n *\n * Node documentation: https://nodejs.org/api/http.html#http_http_request_url_options_callback\n *\n * @param {string} path - options.path in a http.request callback\n * @returns [string] - removes query string element from path\n * @alias module:utils.stripQueryStringFromPath\n */\n stripQueryStringFromPath: function stripQueryStringFromPath(path) {\n return path ? path.split('?')[0] : '';\n },\n /**\n * Performs a case-insensitive wildcard match against two strings. This method works with pseduo-regex chars; specifically ? and * are supported.\n * An asterisk (*) represents any combination of characters\n * A question mark (?) represents any single character\n *\n * @param {string} pattern - the regex-like pattern to be compared against.\n * @param {string} text - the string to compare against the pattern.\n * @returns boolean\n * @alias module:utils.wildcardMatch\n */\n wildcardMatch: function wildcardMatch(pattern, text) {\n if (pattern === undefined || text === undefined) {\n return false;\n }\n if (pattern.length === 1 && pattern.charAt(0) === '*') {\n return true;\n }\n var patternLength = pattern.length;\n var textLength = text.length;\n var indexOfGlob = pattern.indexOf('*');\n pattern = pattern.toLowerCase();\n text = text.toLowerCase();\n // Infix globs are relatively rare, and the below search is expensive especially when\n // Balsa is used a lot. Check for infix globs and, in their absence, do the simple thing\n if (indexOfGlob === -1 || indexOfGlob === (patternLength - 1)) {\n var match = function simpleWildcardMatch() {\n var j = 0;\n for (var i = 0; i < patternLength; i++) {\n var patternChar = pattern.charAt(i);\n if (patternChar === '*') {\n // Presumption for this method is that globs only occur at end\n return true;\n }\n else if (patternChar === '?') {\n if (j === textLength) {\n return false;\n } // No character to match\n j++;\n }\n else {\n if (j >= textLength || patternChar != text.charAt(j)) {\n return false;\n }\n j++;\n }\n }\n // Ate up all the pattern and didn't end at a glob, so a match will have consumed all\n // the text\n return j === textLength;\n };\n return match();\n }\n /*\n * The matchArray[i] is used to record if there is a match between the first i chars in =\n * text and the first j chars in pattern.\n * So will return matchArray[textLength+1] in the end\n * Loop from the beginning of the pattern\n * case not '*': if text[i]==pattern[j] or pattern[j] is '?', and matchArray[i] is true,\n * set matchArray[i+1] to true, otherwise false\n * case '*': since '*' can match any globing, as long as there is a true in matchArray before i\n * all the matchArray[i+1], matchArray[i+2],...,matchArray[textLength] could be true\n */\n var matchArray = [];\n matchArray[0] = true;\n for (var j = 0; j < patternLength; j++) {\n var i;\n var patternChar = pattern.charAt(j);\n if (patternChar != '*') {\n for (i = textLength - 1; i >= 0; i--) {\n matchArray[i + 1] = !!matchArray[i] && (patternChar === '?' || (patternChar === text.charAt(i)));\n }\n }\n else {\n i = 0;\n while (i <= textLength && !matchArray[i]) {\n i++;\n }\n for (i; i <= textLength; i++) {\n matchArray[i] = true;\n }\n }\n matchArray[0] = (matchArray[0] && patternChar === '*');\n }\n return matchArray[textLength];\n },\n LambdaUtils: {\n validTraceData: function (xAmznTraceId) {\n var valid = false;\n if (xAmznTraceId) {\n var data = utils.processTraceData(xAmznTraceId);\n valid = !!(data && data.root && data.parent && data.sampled);\n }\n return valid;\n },\n /**\n * Populates trace ID, parent ID, and sampled decision of given segment. Will always populate valid values,\n * even if xAmznTraceId contains missing or invalid values. This ensures downstream services receive valid\n * headers.\n * @param {Segment} segment - Facade segment to be populated\n * @param {String} xAmznTraceId - Raw Trace Header to supply trace data\n * @returns {Boolean} - true if required fields are present and Trace ID is valid, false otherwise\n */\n populateTraceData: function (segment, xAmznTraceId) {\n logger.getLogger().debug('Lambda trace data found: ' + xAmznTraceId);\n var data = utils.processTraceData(xAmznTraceId);\n var valid = false;\n if (!data) {\n data = {};\n logger.getLogger().error('_X_AMZN_TRACE_ID is empty or has an invalid format');\n }\n else if (!data.root || !data.parent || !data.sampled) {\n logger.getLogger().error('_X_AMZN_TRACE_ID is missing required information');\n }\n else {\n valid = true;\n }\n segment.trace_id = TraceID.FromString(data.root).toString(); // Will always assign valid trace_id\n segment.id = data.parent || crypto.randomBytes(8).toString('hex');\n if (data.root && segment.trace_id !== data.root) {\n logger.getLogger().error('_X_AMZN_TRACE_ID contains invalid trace ID');\n valid = false;\n }\n if (!parseInt(data.sampled)) {\n segment.notTraced = true;\n }\n else {\n delete segment.notTraced;\n }\n logger.getLogger().debug('Segment started: ' + JSON.stringify(data));\n return valid;\n }\n },\n /**\n * Splits out the data from the trace id format. Used by the middleware.\n * @param {String} traceData - The additional trace data (typically in req.headers.x-amzn-trace-id).\n * @returns {object}\n * @alias module:mw_utils.processTraceData\n */\n processTraceData: function processTraceData(traceData) {\n var amznTraceData = {};\n var reservedKeywords = ['root', 'parent', 'sampled', 'self'];\n var remainingBytes = 256;\n if (!(typeof traceData === 'string' && traceData)) {\n return amznTraceData;\n }\n traceData.split(';').forEach(function (header) {\n if (!header) {\n return;\n }\n var pair = header.split('=');\n if (pair[0] && pair[1]) {\n var key = pair[0].trim().toLowerCase();\n var value = pair[1].trim().toLowerCase();\n var reserved = reservedKeywords.indexOf(key) !== -1;\n if (reserved) {\n amznTraceData[key] = value;\n }\n else if (!reserved && remainingBytes - (key.length + value.length) >= 0) {\n amznTraceData[key] = value;\n remainingBytes -= (key.length + value.length);\n }\n }\n });\n return amznTraceData;\n },\n /**\n * Makes a shallow copy of an object without given keys - keeps prototype\n * @param {Object} obj - The object to copy\n * @param {string[]} [keys=[]] - The keys that won't be copied\n * @param {boolean} [preservePrototype=false] - If true also copy prototype properties\n * @returns {}\n */\n objectWithoutProperties: function objectWithoutProperties(obj, keys, preservePrototype) {\n keys = Array.isArray(keys) ? keys : [];\n preservePrototype = typeof preservePrototype === 'boolean' ? preservePrototype : false;\n var target = preservePrototype ? Object.create(Object.getPrototypeOf(obj)) : {};\n for (var property in obj) {\n if (keys.indexOf(property) >= 0) {\n continue;\n }\n if (!Object.prototype.hasOwnProperty.call(obj, property)) {\n continue;\n }\n target[property] = obj[property];\n }\n return target;\n },\n /**\n * Safely gets an integer from a string or number\n * @param {String | Number} - input to cast to integer\n * @returns {Number} - Integer representation of input, or 0 if input is not castable to int\n */\n safeParseInt: (val) => {\n if (!val || isNaN(val)) {\n return 0;\n }\n return parseInt(val);\n }\n};\nmodule.exports = utils;\n", "\"use strict\";\nconst { safeParseInt } = require('../utils');\nvar logger = require('../logger');\nvar DEFAULT_STREAMING_THRESHOLD = 100;\nvar utils = {\n streamingThreshold: DEFAULT_STREAMING_THRESHOLD,\n getCurrentTime: function getCurrentTime() {\n return Date.now() / 1000;\n },\n setOrigin: function setOrigin(origin) {\n this.origin = origin;\n },\n setPluginData: function setPluginData(pluginData) {\n this.pluginData = pluginData;\n },\n setSDKData: function setSDKData(sdkData) {\n this.sdkData = sdkData;\n },\n setServiceData: function setServiceData(serviceData) {\n this.serviceData = serviceData;\n },\n /**\n * Overrides the default streaming threshold (100).\n * The threshold represents the maximum number of subsegments on a single segment before\n * the SDK beings to send the completed subsegments out of band of the main segment.\n * Reduce this threshold if you see the 'Segment too large to send' error.\n * @param {number} threshold - The new threshold to use.\n * @memberof AWSXRay\n */\n setStreamingThreshold: function setStreamingThreshold(threshold) {\n if (isFinite(threshold) && threshold >= 0) {\n utils.streamingThreshold = threshold;\n logger.getLogger().debug('Subsegment streaming threshold set to: ' + threshold);\n }\n else {\n logger.getLogger().error('Invalid threshold: ' + threshold + '. Must be a whole number >= 0.');\n }\n },\n getStreamingThreshold: function getStreamingThreshold() {\n return utils.streamingThreshold;\n },\n /**\n * Parses an HTTP response object to return an X-Ray compliant HTTP response object.\n * @param {http.ServerResponse} res\n * @returns {Object} - X-Ray response object to be added to (sub)segment\n */\n getHttpResponseData: (res) => {\n const ret = {};\n if (!res) {\n return ret;\n }\n const status = safeParseInt(res.statusCode);\n if (status !== 0) {\n ret.status = status;\n }\n if (res.headers && res.headers['content-length']) {\n ret.content_length = safeParseInt(res.headers['content-length']);\n }\n return ret;\n }\n};\nmodule.exports = utils;\n", "\"use strict\";\nconst { getHttpResponseData } = require('../segment_utils');\nvar { stripQueryStringFromPath } = require('../../utils');\n/**\n * Represents an outgoing HTTP/HTTPS call.\n * @constructor\n * @param {http.ClientRequest|https.ClientRequest} req - The request object from the HTTP/HTTPS call.\n * @param {http.IncomingMessage|https.IncomingMessage} res - The response object from the HTTP/HTTPS call.\n * @param {boolean} downstreamXRayEnabled - when true, adds a \"traced\": true hint to generated subsegments such that the AWS X-Ray service expects a corresponding segment from the downstream service.\n */\nfunction RemoteRequestData(req, res, downstreamXRayEnabled) {\n this.init(req, res, downstreamXRayEnabled);\n}\nRemoteRequestData.prototype.init = function init(req, res, downstreamXRayEnabled) {\n this.request = {\n url: (req.agent && req.agent.protocol) ? (req.agent.protocol + '//' + (req.host || req.getHeader('host')) + stripQueryStringFromPath(req.path)) : '',\n method: req.method || '',\n };\n if (downstreamXRayEnabled) {\n this.request.traced = true;\n }\n if (res) {\n this.response = getHttpResponseData(res);\n }\n};\nmodule.exports = RemoteRequestData;\n", "\"use strict\";\nvar crypto = require('crypto');\nvar CapturedException = require('./captured_exception');\nvar RemoteRequestData = require('./remote_request_data');\nvar SegmentEmitter = require('../../segment_emitter');\nvar SegmentUtils = require('../segment_utils');\nvar Utils = require('../../utils');\nvar logger = require('../../logger');\n/**\n * Represents a subsegment.\n * @constructor\n * @param {string} name - The name of the subsegment.\n */\nfunction Subsegment(name) {\n this.init(name);\n}\nSubsegment.prototype.init = function init(name) {\n if (typeof name != 'string') {\n throw new Error('Subsegment name must be of type string.');\n }\n this.id = crypto.randomBytes(8).toString('hex');\n this.name = name;\n this.start_time = SegmentUtils.getCurrentTime();\n this.in_progress = true;\n this.counter = 0;\n this.notTraced = false;\n};\n/**\n * Nests a new subsegment to the array of subsegments.\n * @param {string} name - The name of the new subsegment to append.\n * @returns {Subsegment} - The newly created subsegment.\n */\nSubsegment.prototype.addNewSubsegment = function addNewSubsegment(name) {\n const subsegment = new Subsegment(name);\n this.addSubsegment(subsegment);\n return subsegment;\n};\nSubsegment.prototype.addSubsegmentWithoutSampling = function addSubsegmentWithoutSampling(subsegment) {\n this.addSubsegment(subsegment);\n subsegment.notTraced = true;\n};\nSubsegment.prototype.addNewSubsegmentWithoutSampling = function addNewSubsegmentWithoutSampling(name) {\n const subsegment = new Subsegment(name);\n this.addSubsegment(subsegment);\n subsegment.notTraced = true;\n return subsegment;\n};\n/**\n * Adds a subsegment to the array of subsegments.\n * @param {Subsegment} subsegment - The subsegment to append.\n */\nSubsegment.prototype.addSubsegment = function (subsegment) {\n if (!(subsegment instanceof Subsegment)) {\n throw new Error('Failed to add subsegment:' + subsegment + ' to subsegment \"' + this.name +\n '\". Not a subsegment.');\n }\n if (this.subsegments === undefined) {\n this.subsegments = [];\n }\n subsegment.segment = this.segment;\n subsegment.parent = this;\n subsegment.notTraced = subsegment.parent.notTraced;\n if (subsegment.end_time === undefined) {\n this.incrementCounter(subsegment.counter);\n }\n this.subsegments.push(subsegment);\n};\n/**\n * Removes the subsegment from the subsegments array, used in subsegment streaming.\n */\nSubsegment.prototype.removeSubsegment = function removeSubsegment(subsegment) {\n if (!(subsegment instanceof Subsegment)) {\n throw new Error('Failed to remove subsegment:' + subsegment + ' from subsegment \"' + this.name +\n '\". Not a subsegment.');\n }\n if (this.subsegments !== undefined) {\n var index = this.subsegments.indexOf(subsegment);\n if (index >= 0) {\n this.subsegments.splice(index, 1);\n }\n }\n};\n/**\n * Adds a property with associated data into the subsegment.\n * @param {string} name - The name of the property to add.\n * @param {Object} data - The data of the property to add.\n */\nSubsegment.prototype.addAttribute = function addAttribute(name, data) {\n this[name] = data;\n};\n/**\n * Adds a subsegement id to record ordering.\n * @param {string} id - A subsegment id.\n */\nSubsegment.prototype.addPrecursorId = function (id) {\n if (typeof id !== 'string') {\n logger.getLogger().error('Failed to add id:' + id + ' to subsegment ' + this.name +\n '. Precursor Ids must be of type string.');\n }\n if (this.precursor_ids === undefined) {\n this.precursor_ids = [];\n }\n this.precursor_ids.push(id);\n};\n/**\n * Adds a key-value pair that can be queryable through GetTraceSummaries.\n * Only acceptable types are string, float/int and boolean.\n * @param {string} key - The name of key to add.\n * @param {boolean|string|number} value - The value to add for the given key.\n */\nSubsegment.prototype.addAnnotation = function (key, value) {\n if (typeof value !== 'boolean' && typeof value !== 'string' && !isFinite(value)) {\n logger.getLogger().error('Failed to add annotation key: ' + key + ' value: ' + value + ' to subsegment ' +\n this.name + '. Value must be of type string, number or boolean.');\n return;\n }\n if (typeof key !== 'string') {\n logger.getLogger().error('Failed to add annotation key: ' + key + ' value: ' + value + ' to subsegment ' +\n this.name + '. Key must be of type string.');\n return;\n }\n if (this.annotations === undefined) {\n this.annotations = {};\n }\n this.annotations[key] = value;\n};\n/**\n * Adds a key-value pair to the metadata.default attribute when no namespace is given.\n * Metadata is not queryable, but is recorded.\n * @param {string} key - The name of the key to add.\n * @param {object|null} value - The value of the associated key.\n * @param {string} [namespace] - The property name to put the key/value pair under.\n */\nSubsegment.prototype.addMetadata = function (key, value, namespace) {\n if (typeof key !== 'string') {\n logger.getLogger().error('Failed to add metadata key: ' + key + ' value: ' + value + ' to subsegment ' +\n this.name + '. Key must be of type string.');\n return;\n }\n if (namespace && typeof namespace !== 'string') {\n logger.getLogger().error('Failed to add metadata key: ' + key + ' value: ' + value + ' to subsegment ' +\n this.name + '. Namespace must be of type string.');\n return;\n }\n var ns = namespace || 'default';\n if (!this.metadata) {\n this.metadata = {};\n }\n if (!this.metadata[ns]) {\n this.metadata[ns] = {};\n }\n if (ns !== '__proto__') {\n this.metadata[ns][key] = value !== null && value !== undefined ? value : '';\n }\n};\nSubsegment.prototype.addSqlData = function addSqlData(sqlData) {\n this.sql = sqlData;\n};\n/**\n * Adds an error with associated data into the subsegment.\n * To handle propagating errors, the subsegment also sets a copy of the error on the\n * root segment. As the error passes up the execution stack, a reference is created\n * on each subsegment to the originating subsegment.\n * @param {Error|string} err - The error to capture.\n * @param {boolean} [remote] - Flag for whether the exception caught was remote or not.\n */\nSubsegment.prototype.addError = function addError(err, remote) {\n if (err == null || typeof err !== 'object' && typeof (err) !== 'string') {\n logger.getLogger().error('Failed to add error:' + err + ' to subsegment \"' + this.name +\n '\". Not an object or string literal.');\n return;\n }\n this.addFaultFlag();\n if (this.segment && this.segment.exception) {\n if (err === this.segment.exception.ex) {\n this.fault = true;\n this.cause = { id: this.segment.exception.cause, exceptions: [] };\n return;\n }\n delete this.segment.exception;\n }\n if (this.segment) {\n this.segment.exception = {\n ex: err,\n cause: this.id\n };\n }\n else {\n //error, cannot propagate exception if not added to segment\n }\n if (this.cause === undefined) {\n this.cause = {\n working_directory: process.cwd(),\n exceptions: []\n };\n }\n this.cause.exceptions.unshift(new CapturedException(err, remote));\n};\n/**\n * Adds data for an outgoing HTTP/HTTPS call.\n * @param {http.ClientRequest/https.ClientRequest} req - The request object from the HTTP/HTTPS call.\n * @param {http.IncomingMessage/https.IncomingMessage} res - The response object from the HTTP/HTTPS call.\n * @param {boolean} downstreamXRayEnabled - when true, adds a \"traced\": true hint to generated subsegments such that the AWS X-Ray service expects a corresponding segment from the downstream service.\n */\nSubsegment.prototype.addRemoteRequestData = function addRemoteRequestData(req, res, downstreamXRayEnabled) {\n this.http = new RemoteRequestData(req, res, downstreamXRayEnabled);\n if ('traced' in this.http.request) {\n this.traced = this.http.request.traced;\n delete this.http.request.traced;\n }\n};\n/**\n * Adds fault flag to the subsegment.\n */\nSubsegment.prototype.addFaultFlag = function addFaultFlag() {\n this.fault = true;\n};\n/**\n * Adds error flag to the subsegment.\n */\nSubsegment.prototype.addErrorFlag = function addErrorFlag() {\n this.error = true;\n};\n/**\n * Adds throttle flag to the subsegment.\n */\nSubsegment.prototype.addThrottleFlag = function addThrottleFlag() {\n this.throttle = true;\n};\n/**\n * Closes the current subsegment. This automatically captures any exceptions and sets the end time.\n * @param {Error|string} [err] - The error to capture.\n * @param {boolean} [remote] - Flag for whether the exception caught was remote or not.\n */\nSubsegment.prototype.close = function close(err, remote) {\n var root = this.segment;\n this.end_time = SegmentUtils.getCurrentTime();\n delete this.in_progress;\n if (err) {\n this.addError(err, remote);\n }\n if (this.parent) {\n this.parent.decrementCounter();\n }\n if (root && root.counter > SegmentUtils.getStreamingThreshold()) {\n if (this.streamSubsegments() && this.parent) {\n this.parent.removeSubsegment(this);\n }\n }\n};\n/**\n * Each subsegment holds a counter of open subsegments. This increments\n * the counter such that it can be called from a child and propagate up.\n * @param {Number} [additional] - An additional amount to increment. Used when adding subsegment trees.\n */\nSubsegment.prototype.incrementCounter = function incrementCounter(additional) {\n this.counter = additional ? this.counter + additional + 1 : this.counter + 1;\n if (this.parent) {\n this.parent.incrementCounter(additional);\n }\n};\n/**\n * Each subsegment holds a counter of its open subsegments. This decrements\n * the counter such that it can be called from a child and propagate up.\n */\nSubsegment.prototype.decrementCounter = function decrementCounter() {\n this.counter--;\n if (this.parent) {\n this.parent.decrementCounter();\n }\n};\n/**\n * Returns a boolean indicating whether or not the subsegment has been closed.\n * @returns {boolean} - Returns true if the subsegment is closed.\n */\nSubsegment.prototype.isClosed = function isClosed() {\n return !this.in_progress;\n};\n/**\n * Sends the subsegment to the daemon.\n */\nSubsegment.prototype.flush = function flush() {\n if (!this.parent || !this.segment) {\n logger.getLogger().error('Failed to flush subsegment: ' + this.name + '. Subsegment must be added ' +\n 'to a segment chain to flush.');\n return;\n }\n if (this.segment.trace_id) {\n if (this.segment.notTraced !== true && !this.notTraced) {\n SegmentEmitter.send(this);\n }\n else {\n logger.getLogger().debug('Ignoring flush on subsegment ' + this.id + '. Associated segment is marked as not sampled.');\n }\n }\n else {\n logger.getLogger().debug('Ignoring flush on subsegment ' + this.id + '. Associated segment is missing a trace ID.');\n }\n};\n/**\n * Returns true if the subsegment was streamed in its entirety\n */\nSubsegment.prototype.streamSubsegments = function streamSubsegments() {\n if (this.isClosed() && this.counter <= 0) {\n this.flush();\n return true;\n }\n else if (this.subsegments && this.subsegments.length > 0) {\n var open = [];\n this.subsegments.forEach(function (child) {\n if (!child.streamSubsegments()) {\n open.push(child);\n }\n });\n this.subsegments = open;\n }\n};\n/**\n * Returns the formatted, trimmed subsegment JSON string to send to the daemon.\n */\nSubsegment.prototype.format = function format() {\n this.type = 'subsegment';\n if (this.parent) {\n this.parent_id = this.parent.id;\n }\n if (this.segment) {\n this.trace_id = this.segment.trace_id;\n }\n return JSON.stringify(this);\n};\n/**\n * Returns the formatted subsegment JSON string.\n */\nSubsegment.prototype.toString = function toString() {\n return JSON.stringify(this);\n};\nSubsegment.prototype.toJSON = function toJSON() {\n var ignore = ['segment', 'parent', 'counter'];\n if (this.subsegments == null || this.subsegments.length === 0) {\n ignore.push('subsegments');\n }\n var thisCopy = Utils.objectWithoutProperties(this, ignore, false);\n return thisCopy;\n};\nmodule.exports = Subsegment;\n", "\"use strict\";\nvar crypto = require('crypto');\nvar CapturedException = require('./attributes/captured_exception');\nvar SegmentEmitter = require('../segment_emitter');\nvar SegmentUtils = require('./segment_utils');\nvar Subsegment = require('./attributes/subsegment');\nvar TraceID = require('./attributes/trace_id');\nvar Utils = require('../utils');\nvar logger = require('../logger');\n/**\n * Represents a segment.\n * @constructor\n * @param {string} name - The name of the subsegment.\n * @param {string} [rootId] - The trace ID of the spawning parent, included in the 'X-Amzn-Trace-Id' header of the incoming request. If one is not supplied, it will be generated.\n * @param {string} [parentId] - The sub/segment ID of the spawning parent, included in the 'X-Amzn-Trace-Id' header of the incoming request.\n */\nfunction Segment(name, rootId, parentId) {\n this.init(name, rootId, parentId);\n}\nSegment.prototype.init = function init(name, rootId, parentId) {\n if (typeof name != 'string') {\n throw new Error('Segment name must be of type string.');\n }\n // Validate the Trace ID\n var traceId;\n if (rootId && typeof rootId == 'string') {\n traceId = TraceID.FromString(rootId);\n }\n else {\n traceId = new TraceID();\n }\n var id = crypto.randomBytes(8).toString('hex');\n var startTime = SegmentUtils.getCurrentTime();\n this.trace_id = traceId.toString();\n this.id = id;\n this.start_time = startTime;\n this.name = name || '';\n this.in_progress = true;\n this.counter = 0;\n if (parentId) {\n this.parent_id = parentId;\n }\n if (SegmentUtils.serviceData) {\n this.setServiceData(SegmentUtils.serviceData);\n }\n if (SegmentUtils.pluginData) {\n this.addPluginData(SegmentUtils.pluginData);\n }\n if (SegmentUtils.origin) {\n this.origin = SegmentUtils.origin;\n }\n if (SegmentUtils.sdkData) {\n this.setSDKData(SegmentUtils.sdkData);\n }\n};\n/**\n * Adds incoming request data to the http block of the segment.\n * @param {IncomingRequestData} data - The data of the property to add.\n */\nSegment.prototype.addIncomingRequestData = function addIncomingRequestData(data) {\n this.http = data;\n};\n/**\n * Adds a key-value pair that can be queryable through GetTraceSummaries.\n * Only acceptable types are string, float/int and boolean.\n * @param {string} key - The name of key to add.\n * @param {boolean|string|number} value - The value to add for the given key.\n */\nSegment.prototype.addAnnotation = function addAnnotation(key, value) {\n if (typeof value !== 'boolean' && typeof value !== 'string' && !isFinite(value)) {\n logger.getLogger().error('Failed to add annotation key: ' + key + ' value: ' + value + ' to subsegment ' +\n this.name + '. Value must be of type string, number or boolean.');\n return;\n }\n if (typeof key !== 'string') {\n logger.getLogger().error('Failed to add annotation key: ' + key + ' value: ' + value + ' to subsegment ' +\n this.name + '. Key must be of type string.');\n return;\n }\n if (this.annotations === undefined) {\n this.annotations = {};\n }\n this.annotations[key] = value;\n};\n/**\n * Adds a User ID that can be queried from the X-Ray console. User ID\n * must be a string.\n * @param {string} user - The ID of the user corresponding to this segment\n */\nSegment.prototype.setUser = function (user) {\n if (typeof user !== 'string') {\n logger.getLogger().error('Set user: ' + user + ' failed. User IDs must be of type string.');\n }\n this.user = user;\n};\n/**\n * Adds a key-value pair to the metadata.default attribute when no namespace is given.\n * Metadata is not queryable, but is recorded.\n * @param {string} key - The name of the key to add.\n * @param {object|null} value - The value of the associated key.\n * @param {string} [namespace] - The property name to put the key/value pair under.\n */\nSegment.prototype.addMetadata = function (key, value, namespace) {\n if (typeof key !== 'string') {\n logger.getLogger().error('Failed to add metadata key: ' + key + ' value: ' + value + ' to segment ' +\n this.name + '. Key must be of type string.');\n return;\n }\n if (namespace && typeof namespace !== 'string') {\n logger.getLogger().error('Failed to add metadata key: ' + key + ' value: ' + value + ' to segment ' +\n this.name + '. Namespace must be of type string.');\n return;\n }\n var ns = namespace || 'default';\n if (!this.metadata) {\n this.metadata = {};\n }\n if (!this.metadata[ns]) {\n this.metadata[ns] = {};\n }\n if (ns !== '__proto__') {\n this.metadata[ns][key] = value !== null && value !== undefined ? value : '';\n }\n};\n/**\n * Adds data about the AWS X-Ray SDK onto the segment.\n * @param {Object} data - Object that contains the version of the SDK, and other information.\n */\nSegment.prototype.setSDKData = function setSDKData(data) {\n if (!data) {\n logger.getLogger().error('Add SDK data: ' + data + ' failed.' +\n 'Must not be empty.');\n return;\n }\n if (!this.aws) {\n this.aws = {};\n }\n this.aws.xray = data;\n};\nSegment.prototype.setMatchedSamplingRule = function setMatchedSamplingRule(ruleName) {\n if (this.aws) {\n this.aws = JSON.parse(JSON.stringify(this.aws));\n }\n if (this.aws && this.aws['xray']) {\n this.aws.xray['rule_name'] = ruleName;\n }\n else {\n this.aws = { xray: { 'rule_name': ruleName } };\n }\n};\n/**\n * Adds data about the service into the segment.\n * @param {Object} data - Object that contains the version of the application, and other information.\n */\nSegment.prototype.setServiceData = function setServiceData(data) {\n if (!data) {\n logger.getLogger().error('Add service data: ' + data + ' failed.' +\n 'Must not be empty.');\n return;\n }\n this.service = data;\n};\n/**\n * Adds a service with associated version data into the segment.\n * @param {Object} data - The associated AWS data.\n */\nSegment.prototype.addPluginData = function addPluginData(data) {\n if (this.aws === undefined) {\n this.aws = {};\n }\n Object.assign(this.aws, data);\n};\n/**\n * Adds a new subsegment to the array of subsegments.\n * @param {string} name - The name of the new subsegment to append.\n */\nSegment.prototype.addNewSubsegment = function addNewSubsegment(name) {\n var subsegment = new Subsegment(name);\n this.addSubsegment(subsegment);\n return subsegment;\n};\nSegment.prototype.addSubsegmentWithoutSampling = function addSubsegmentWithoutSampling(subsegment) {\n this.addSubsegment(subsegment);\n subsegment.notTraced = true;\n};\nSegment.prototype.addNewSubsegmentWithoutSampling = function addNewSubsegmentWithoutSampling(name) {\n const subsegment = new Subsegment(name);\n this.addSubsegment(subsegment);\n subsegment.notTraced = true;\n return subsegment;\n};\n/**\n * Adds a subsegment to the array of subsegments.\n * @param {Subsegment} subsegment - The subsegment to append.\n */\nSegment.prototype.addSubsegment = function addSubsegment(subsegment) {\n if (!(subsegment instanceof Subsegment)) {\n throw new Error('Cannot add subsegment: ' + subsegment + '. Not a subsegment.');\n }\n if (this.subsegments === undefined) {\n this.subsegments = [];\n }\n subsegment.segment = this;\n subsegment.parent = this;\n subsegment.notTraced = subsegment.parent.notTraced;\n this.subsegments.push(subsegment);\n if (!subsegment.end_time) {\n this.incrementCounter(subsegment.counter);\n }\n};\n/**\n * Removes the subsegment from the subsegments array, used in subsegment streaming.\n */\nSegment.prototype.removeSubsegment = function removeSubsegment(subsegment) {\n if (!(subsegment instanceof Subsegment)) {\n throw new Error('Failed to remove subsegment:' + subsegment + ' from subsegment \"' + this.name +\n '\". Not a subsegment.');\n }\n if (this.subsegments !== undefined) {\n var index = this.subsegments.indexOf(subsegment);\n if (index >= 0) {\n this.subsegments.splice(index, 1);\n }\n }\n};\n/**\n * Adds error data into the segment.\n * @param {Error|string} err - The error to capture.\n * @param {boolean} [remote] - Flag for whether the exception caught was remote or not.\n */\nSegment.prototype.addError = function addError(err, remote) {\n if (err == null || typeof err !== 'object' && typeof (err) !== 'string') {\n logger.getLogger().error('Failed to add error:' + err + ' to subsegment \"' + this.name +\n '\". Not an object or string literal.');\n return;\n }\n this.addFaultFlag();\n if (this.exception) {\n if (err === this.exception.ex) {\n this.cause = { id: this.exception.cause };\n delete this.exception;\n return;\n }\n delete this.exception;\n }\n if (this.cause === undefined) {\n this.cause = {\n working_directory: process.cwd(),\n exceptions: []\n };\n }\n this.cause.exceptions.push(new CapturedException(err, remote));\n};\n/**\n * Adds fault flag to the subsegment.\n */\nSegment.prototype.addFaultFlag = function addFaultFlag() {\n this.fault = true;\n};\n/**\n * Adds error flag to the subsegment.\n */\nSegment.prototype.addErrorFlag = function addErrorFlag() {\n this.error = true;\n};\n/**\n * Adds throttle flag to the subsegment.\n */\nSegment.prototype.addThrottleFlag = function addThrottleFlag() {\n this.throttle = true;\n};\n/**\n * Returns a boolean indicating whether or not the segment has been closed.\n * @returns {boolean} - Returns true if the subsegment is closed.\n */\nSegment.prototype.isClosed = function isClosed() {\n return !this.in_progress;\n};\n/**\n * Each segment holds a counter of open subsegments. This increments the counter.\n * @param {Number} [additional] - An additional amount to increment. Used when adding subsegment trees.\n */\nSegment.prototype.incrementCounter = function incrementCounter(additional) {\n this.counter = additional ? this.counter + additional + 1 : this.counter + 1;\n if (this.counter > SegmentUtils.streamingThreshold && this.subsegments && this.subsegments.length > 0) {\n var open = [];\n this.subsegments.forEach(function (child) {\n if (!child.streamSubsegments()) {\n open.push(child);\n }\n });\n this.subsegments = open;\n }\n};\n/**\n * Each segment holds a counter of open subsegments. This decrements\n * the counter such that it can be called from a child and propagate up.\n */\nSegment.prototype.decrementCounter = function decrementCounter() {\n this.counter--;\n if (this.counter <= 0 && this.isClosed()) {\n this.flush();\n }\n};\n/**\n * Closes the current segment. This automatically sets the end time.\n * @param {Error|string} [err] - The error to capture.\n * @param {boolean} [remote] - Flag for whether the exception caught was remote or not.\n */\nSegment.prototype.close = function (err, remote) {\n if (!this.end_time) {\n this.end_time = SegmentUtils.getCurrentTime();\n }\n if (err !== undefined) {\n this.addError(err, remote);\n }\n delete this.in_progress;\n delete this.exception;\n if (this.counter <= 0) {\n this.flush();\n }\n};\n/**\n * Sends the segment to the daemon.\n */\nSegment.prototype.flush = function flush() {\n if (this.notTraced !== true) {\n delete this.exception;\n var thisCopy = Utils.objectWithoutProperties(this, ['counter', 'notTraced'], true);\n SegmentEmitter.send(thisCopy);\n }\n};\nSegment.prototype.format = function format() {\n var ignore = ['segment', 'parent', 'counter'];\n if (this.subsegments == null || this.subsegments.length === 0) {\n ignore.push('subsegments');\n }\n var thisCopy = Utils.objectWithoutProperties(this, ignore, false);\n return JSON.stringify(thisCopy);\n};\nSegment.prototype.toString = function toString() {\n return JSON.stringify(this);\n};\nmodule.exports = Segment;\n", "\"use strict\";\n/**\n * @module context_utils\n */\nvar cls = require('cls-hooked/context');\nvar logger = require('./logger');\nvar Segment = require('./segments/segment');\nvar Subsegment = require('./segments/attributes/subsegment');\nvar cls_mode = true;\nvar NAMESPACE = 'AWSXRay';\nvar SEGMENT = 'segment';\nvar contextOverride = false;\nvar contextUtils = {\n CONTEXT_MISSING_STRATEGY: {\n RUNTIME_ERROR: {\n contextMissing: function contextMissingRuntimeError(message) {\n throw new Error(message);\n }\n },\n LOG_ERROR: {\n contextMissing: function contextMissingLogError(message) {\n var err = new Error(message);\n logger.getLogger().error(err.stack);\n }\n },\n IGNORE_ERROR: {\n contextMissing: function contextMissingIgnoreError() {\n }\n }\n },\n contextMissingStrategy: {},\n /**\n * Resolves the segment or subsegment given manual mode and params on the call required.\n * @param [Segment|Subsegment] segment - The segment manually provided via params.XraySegment, if provided.\n * @returns {Segment|Subsegment}\n * @alias module:context_utils.resolveManualSegmentParams\n */\n resolveManualSegmentParams: function resolveManualSegmentParams(params) {\n if (params && !contextUtils.isAutomaticMode()) {\n var xraySegment = params.XRaySegment || params.XraySegment;\n var segment = params.Segment;\n var found = null;\n if (xraySegment && (xraySegment instanceof Segment || xraySegment instanceof Subsegment)) {\n found = xraySegment;\n delete params.XRaySegment;\n delete params.XraySegment;\n }\n else if (segment && (segment instanceof Segment || segment instanceof Subsegment)) {\n found = segment;\n delete params.Segment;\n }\n return found;\n }\n },\n /**\n * Gets current CLS namespace for X-Ray SDK or creates one if absent.\n * @returns {Namespace}\n * @alias module:context_utils.getNamespace\n */\n getNamespace: function getNamespace() {\n return cls.getNamespace(NAMESPACE) || cls.createNamespace(NAMESPACE);\n },\n /**\n * Resolves the segment or subsegment given manual or automatic mode.\n * @param [Segment|Subsegment] segment - The segment manually provided, if provided.\n * @returns {Segment|Subsegment}\n * @alias module:context_utils.resolveSegment\n */\n resolveSegment: function resolveSegment(segment) {\n if (cls_mode) {\n return this.getSegment();\n }\n else if (segment && !cls_mode) {\n return segment;\n }\n else if (!segment && !cls_mode) {\n contextUtils.contextMissingStrategy.contextMissing('No sub/segment specified. A sub/segment must be provided for manual mode.');\n }\n },\n /**\n * Returns the current segment or subsegment. For use with in automatic mode only.\n * @returns {Segment|Subsegment}\n * @alias module:context_utils.getSegment\n */\n getSegment: function getSegment() {\n if (cls_mode) {\n var segment = contextUtils.getNamespace(NAMESPACE).get(SEGMENT);\n if (!segment) {\n contextUtils.contextMissingStrategy.contextMissing('Failed to get the current sub/segment from the context.');\n }\n else if (segment instanceof Segment && process.env.LAMBDA_TASK_ROOT && segment.facade == true) {\n segment.resolveLambdaTraceData();\n }\n return segment;\n }\n else {\n contextUtils.contextMissingStrategy.contextMissing('Cannot get sub/segment from context. Not supported in manual mode.');\n }\n },\n /**\n * Sets the current segment or subsegment. For use with in automatic mode only.\n * @param [Segment|Subsegment] segment - The sub/segment to set.\n * @returns {Segment|Subsegment}\n * @alias module:context_utils.setSegment\n */\n setSegment: function setSegment(segment) {\n if (cls_mode) {\n if (!contextUtils.getNamespace(NAMESPACE).set(SEGMENT, segment)) {\n logger.getLogger().warn('Failed to set the current sub/segment on the context.');\n }\n }\n else {\n contextUtils.contextMissingStrategy.contextMissing('Cannot set sub/segment on context. Not supported in manual mode.');\n }\n },\n /**\n * Returns true if in automatic mode, otherwise false.\n * @returns {Segment|Subsegment}\n * @alias module:context_utils.isAutomaticMode\n */\n isAutomaticMode: function isAutomaticMode() {\n return cls_mode;\n },\n /**\n * Enables automatic mode. Automatic mode uses 'cls-hooked'.\n * @see https://github.com/jeff-lewis/cls-hooked\n * @alias module:context_utils.enableAutomaticMode\n */\n enableAutomaticMode: function enableAutomaticMode() {\n cls_mode = true;\n contextUtils.getNamespace(NAMESPACE);\n logger.getLogger().debug('Overriding AWS X-Ray SDK mode. Set to automatic mode.');\n },\n /**\n * Disables automatic mode. Current segment or subsegment then must be passed manually\n * via the parent optional on captureFunc, captureAsyncFunc etc.\n * @alias module:context_utils.enableManualMode\n */\n enableManualMode: function enableManualMode() {\n cls_mode = false;\n if (cls.getNamespace(NAMESPACE)) {\n cls.destroyNamespace(NAMESPACE);\n }\n logger.getLogger().debug('Overriding AWS X-Ray SDK mode. Set to manual mode.');\n },\n /**\n * Sets the context missing strategy if no context missing strategy is set using the environment variable with\n * key AWS_XRAY_CONTEXT_MISSING. The context missing strategy's contextMissing function will be called whenever\n * trace context is not found.\n * @param {string|function} strategy - The strategy to set. Valid string values are 'LOG_ERROR' and 'RUNTIME_ERROR'.\n * Alternatively, a custom function can be supplied, which takes a error message string.\n */\n setContextMissingStrategy: function setContextMissingStrategy(strategy) {\n if (!contextOverride) {\n if (typeof strategy === 'string') {\n var lookupStrategy = contextUtils.CONTEXT_MISSING_STRATEGY[strategy.toUpperCase()];\n if (lookupStrategy) {\n contextUtils.contextMissingStrategy.contextMissing = lookupStrategy.contextMissing;\n if (process.env.AWS_XRAY_CONTEXT_MISSING) {\n logger.getLogger().debug('AWS_XRAY_CONTEXT_MISSING is set. Configured context missing strategy to ' +\n process.env.AWS_XRAY_CONTEXT_MISSING + '.');\n }\n else {\n logger.getLogger().debug('Configured context missing strategy to: ' + strategy);\n }\n }\n else {\n throw new Error('Invalid context missing strategy: ' + strategy + '. Valid values are ' +\n Object.keys(contextUtils.CONTEXT_MISSING_STRATEGY) + '.');\n }\n }\n else if (typeof strategy === 'function') {\n contextUtils.contextMissingStrategy.contextMissing = strategy;\n logger.getLogger().info('Configured custom context missing strategy to function: ' + strategy.name);\n }\n else {\n throw new Error('Context missing strategy must be either a string or a custom function.');\n }\n }\n else {\n logger.getLogger().warn('Ignoring call to setContextMissingStrategy as AWS_XRAY_CONTEXT_MISSING is set. ' +\n 'The current context missing strategy will not be changed.');\n }\n }\n};\ncls.createNamespace(NAMESPACE);\nlogger.getLogger().debug('Starting the AWS X-Ray SDK in automatic mode (default).');\nif (process.env.AWS_XRAY_CONTEXT_MISSING) {\n contextUtils.setContextMissingStrategy(process.env.AWS_XRAY_CONTEXT_MISSING);\n contextOverride = true;\n}\nelse {\n contextUtils.contextMissingStrategy.contextMissing = contextUtils.CONTEXT_MISSING_STRATEGY.RUNTIME_ERROR.contextMissing;\n logger.getLogger().debug('Using default context missing strategy: RUNTIME_ERROR');\n}\nmodule.exports = contextUtils;\n", "\"use strict\";\nvar { getHttpResponseData } = require('../segments/segment_utils');\n/**\n * Represents an incoming HTTP/HTTPS call.\n * @constructor\n * @param {http.IncomingMessage|https.IncomingMessage} req - The request object from the HTTP/HTTPS call.\n */\nfunction IncomingRequestData(req) {\n this.init(req);\n}\nIncomingRequestData.prototype.init = function init(req) {\n var forwarded = !!req.headers['x-forwarded-for'];\n var url;\n if (req.connection) {\n url = ((req.connection.secure || req.connection.encrypted) ? 'https://' : 'http://') +\n ((req.headers['host'] || '') + (req.url || ''));\n }\n this.request = {\n method: req.method || '',\n user_agent: req.headers['user-agent'] || '',\n client_ip: getClientIp(req) || '',\n url: url || '',\n };\n if (forwarded) {\n this.request.x_forwarded_for = forwarded;\n }\n};\nvar getClientIp = function getClientIp(req) {\n var clientIp;\n if (req.headers['x-forwarded-for']) {\n clientIp = (req.headers['x-forwarded-for'] || '').split(',')[0];\n }\n else if (req.connection && req.connection.remoteAddress) {\n clientIp = req.connection.remoteAddress;\n }\n else if (req.socket && req.socket.remoteAddress) {\n clientIp = req.socket.remoteAddress;\n }\n else if (req.connection && req.connection.socket && req.connection.socket.remoteAddress) {\n clientIp = req.connection.socket.remoteAddress;\n }\n return clientIp;\n};\n/**\n * Closes the local and automatically captures the response data.\n * @param {http.ServerResponse|https.ServerResponse} res - The response object from the HTTP/HTTPS call.\n */\nIncomingRequestData.prototype.close = function close(res) {\n this.response = getHttpResponseData(res);\n};\nmodule.exports = IncomingRequestData;\n", "\"use strict\";\n/**\n * Represents a LocalReservoir object that keeps track of the number of traces per second sampled and\n * the fixed rate for a given sampling rule defined locally.\n * It also decides if a given trace should be sampled or not based on the state of current second.\n * @constructor\n * @param {number} fixedTarget - An integer value to specify the maximum number of traces per second to sample.\n * @param {number} fallbackRate - A value between 0 and 1 indicating the sampling rate after the maximum traces per second has been hit.\n */\nfunction LocalReservoir(fixedTarget, fallbackRate) {\n this.init(fixedTarget, fallbackRate);\n}\nLocalReservoir.prototype.init = function init(fixedTarget, fallbackRate) {\n this.usedThisSecond = 0;\n if (typeof fixedTarget === 'number' && fixedTarget % 1 === 0 && fixedTarget >= 0) {\n this.fixedTarget = fixedTarget;\n }\n else {\n throw new Error('Error in sampling file. Rule attribute \"fixed_target\" must be a non-negative integer.');\n }\n if (typeof fallbackRate === 'number' && fallbackRate >= 0 && fallbackRate <= 1) {\n this.fallbackRate = fallbackRate;\n }\n else {\n throw new Error('Error in sampling file. Rule attribute \"rate\" must be a number between 0 and 1 inclusive.');\n }\n};\nLocalReservoir.prototype.isSampled = function isSampled() {\n var now = Math.round(new Date().getTime() / 1000);\n if (now !== this.thisSecond) {\n this.usedThisSecond = 0;\n this.thisSecond = now;\n }\n if (this.usedThisSecond >= this.fixedTarget) {\n return Math.random() < this.fallbackRate;\n }\n this.usedThisSecond++;\n return true;\n};\nmodule.exports = LocalReservoir;\n", "\"use strict\";\nvar fs = require('fs');\nvar LocalReservoir = require('./local_reservoir');\nvar Utils = require('../../utils');\nvar defaultRules = require('../../resources/default_sampling_rules.json');\nvar logger = require('../../logger');\n/**\n * The local sampler used to make sampling decisions when the decisions are absent in the incoming requests\n * and the default sampler needs to fall back on local rules. It will also be the primary sampler\n * if the default sampler is disabled.\n * @module LocalSampler\n */\nvar LocalSampler = {\n /**\n * Makes a sample decision based on the sample request.\n * @param {object} sampleRequest - Contains information for rules matching.\n * @module LocalSampler\n * @function shouldSample\n */\n shouldSample: function shouldSample(sampleRequest) {\n var host = sampleRequest.host;\n var httpMethod = sampleRequest.httpMethod;\n var urlPath = sampleRequest.urlPath;\n var formatted = '{ http_method: ' + httpMethod + ', host: ' + host + ', url_path: ' + urlPath + ' }';\n var matched;\n this.rules.some(function (rule) {\n // Any null parameters provided will be considered an implicit match.\n if (rule.default || (host == null || (Utils.wildcardMatch(rule.host, host))\n && (httpMethod == null || Utils.wildcardMatch(rule.http_method, httpMethod))\n && (urlPath == null || Utils.wildcardMatch(rule.url_path, urlPath)))) {\n matched = rule.reservoir;\n logger.getLogger().debug('Local sampling rule match found for ' + formatted + '. Matched ' + (rule.default ?\n 'default' : '{ http_method: ' + rule.http_method + ', host: ' + rule.host + ', url_path: ' +\n rule.url_path + ' }') + '. Using fixed_target: ' + matched.fixedTarget + ' and rate: ' + matched.fallbackRate + '.');\n return true;\n }\n });\n if (matched) {\n return matched.isSampled();\n }\n else {\n logger.getLogger().debug('No sampling rule matched for ' + formatted);\n return false;\n }\n },\n /**\n * Set local rules for making sampling decisions.\n * @module LocalSampler\n * @function setLocalRules\n */\n setLocalRules: function setLocalRules(source) {\n if (source) {\n if (typeof source === 'string') {\n logger.getLogger().info('Using custom sampling rules file: ' + source);\n this.rules = loadRulesConfig(JSON.parse(fs.readFileSync(source, 'utf8')));\n }\n else {\n logger.getLogger().info('Using custom sampling rules source.');\n this.rules = loadRulesConfig(source);\n }\n }\n else {\n this.rules = parseRulesConfig(defaultRules);\n }\n }\n};\nvar loadRulesConfig = function loadRulesConfig(config) {\n if (!config.version) {\n throw new Error('Error in sampling file. Missing \"version\" attribute.');\n }\n if (config.version === 1 || config.version === 2) {\n return parseRulesConfig(config);\n }\n else {\n throw new Error('Error in sampling file. Unknown version \"' + config.version + '\".');\n }\n};\nvar parseRulesConfig = function parseRulesConfig(config) {\n var defaultRule;\n var rules = [];\n if (config.default) {\n var missing = [];\n for (var key in config.default) {\n if (key !== 'fixed_target' && key !== 'rate') {\n throw new Error('Error in sampling file. Invalid attribute for default: ' + key +\n '. Valid attributes for default are \"fixed_target\" and \"rate\".');\n }\n else if (typeof config.default[key] !== 'number') {\n throw new Error('Error in sampling file. Default ' + key + ' must be a number.');\n }\n }\n if (typeof config.default.fixed_target === 'undefined') {\n missing.push('fixed_target');\n }\n if (typeof config.default.rate === 'undefined') {\n missing.push('rate');\n }\n if (missing.length !== 0) {\n throw new Error('Error in sampling file. Missing required attributes for default: ' + missing + '.');\n }\n defaultRule = { default: true, reservoir: new LocalReservoir(config.default.fixed_target, config.default.rate) };\n }\n else {\n throw new Error('Error in sampling file. Expecting \"default\" object to be defined with attributes \"fixed_target\" and \"rate\".');\n }\n if (Array.isArray(config.rules)) {\n config.rules.forEach(function (rawRule) {\n var params = {};\n var required;\n if (config.version === 2) {\n required = { host: 1, http_method: 1, url_path: 1, fixed_target: 1, rate: 1 };\n }\n if (config.version === 1) {\n required = { service_name: 1, http_method: 1, url_path: 1, fixed_target: 1, rate: 1 };\n }\n for (var key in rawRule) {\n var value = rawRule[key];\n if (!required[key] && key != 'description') {\n throw new Error('Error in sampling file. Rule ' + JSON.stringify(rawRule) + ' has invalid attribute: ' + key + '.');\n }\n else if (key != 'description' && !value && value !== 0) {\n throw new Error('Error in sampling file. Rule ' + JSON.stringify(rawRule) + ' attribute \"' + key + '\" has invalid value: ' + value + '.');\n }\n else {\n if (config.version === 2) {\n params[key] = value;\n }\n if (config.version === 1 && key === 'service_name') {\n params['host'] = value;\n }\n else {\n params[key] = value;\n }\n delete required[key];\n }\n }\n if (Object.keys(required).length !== 0 && required.constructor === Object) {\n throw new Error('Error in sampling file. Rule ' + JSON.stringify(rawRule) + ' is missing required attributes: ' + Object.keys(required) + '.');\n }\n var rule = params;\n rule.reservoir = new LocalReservoir(rawRule.fixed_target, rawRule.rate);\n rules.push(rule);\n });\n }\n rules.push(defaultRule);\n return rules;\n};\nLocalSampler.setLocalRules();\nmodule.exports = LocalSampler;\n", "\"use strict\";\n/**\n * Represents a Reservoir object that keeps track of the number of traces per second sampled and\n * the fixed rate for a given sampling rule. This information is fetched from X-Ray serivce.\n * It decides if a given trace should be borrowed or sampled or not sampled based on the state of current second.\n * @constructor\n */\nfunction Reservoir() {\n this.init();\n}\nReservoir.prototype.init = function init() {\n this.quota = null;\n this.TTL = null;\n this.takenThisSec = 0;\n this.borrowedThisSec = 0;\n this.reportInterval = 1;\n this.reportElapsed = 0;\n};\nReservoir.prototype.borrowOrTake = function borrowOrTake(now, canBorrow) {\n this.adjustThisSec(now);\n // Don't borrow if the quota is available and fresh.\n if (this.quota >= 0 && this.TTL >= now) {\n if (this.takenThisSec >= this.quota) {\n return false;\n }\n this.takenThisSec++;\n return 'take';\n }\n // Otherwise try to borrow if the quota is not present or expired.\n if (canBorrow) {\n if (this.borrowedThisSec >= 1) {\n return false;\n }\n this.borrowedThisSec++;\n return 'borrow';\n }\n};\nReservoir.prototype.adjustThisSec = function adjustThisSec(now) {\n if (now !== this.thisSec) {\n this.takenThisSec = 0;\n this.borrowedThisSec = 0;\n this.thisSec = now;\n }\n};\nReservoir.prototype.loadNewQuota = function loadNewQuota(quota, TTL, interval) {\n if (quota) {\n this.quota = quota;\n }\n if (TTL) {\n this.TTL = TTL;\n }\n if (interval) {\n this.reportInterval = interval / 10;\n } // Report interval is always time of 10.\n};\nReservoir.prototype.timeToReport = function timeToReport() {\n if (this.reportElapsed + 1 >= this.reportInterval) {\n this.reportElapsed = 0;\n return true;\n }\n else {\n this.reportElapsed += 1;\n return false;\n }\n};\nmodule.exports = Reservoir;\n", "\"use strict\";\nvar Utils = require('../../utils');\nvar Reservoir = require('./reservoir');\n/**\n * The data model for a sampling rule defined using X-Ray API CreateSamplingRules.\n * It should be only instantiated directly from the X-Ray API response.\n * @constructor\n */\nfunction SamplingRule(name, priority, rate, reservoirSize, host, httpMethod, urlPath, serviceName, serviceType) {\n this.init(name, priority, rate, reservoirSize, host, httpMethod, urlPath, serviceName, serviceType);\n}\nSamplingRule.prototype.init = function init(name, priority, rate, reservoirSize, host, httpMethod, urlPath, serviceName, serviceType) {\n this.name = name;\n this.priority = priority;\n this.rate = rate;\n this.host = host;\n this.httpMethod = httpMethod;\n this.urlPath = urlPath;\n this.serviceName = serviceName;\n this.serviceType = serviceType;\n this.reservoir = new Reservoir();\n this.borrow = !!reservoirSize;\n this.resetStatistics();\n};\nSamplingRule.prototype.match = function match(sampleRequest) {\n var host = sampleRequest.host;\n var httpMethod = sampleRequest.httpMethod;\n var serviceName = sampleRequest.serviceName;\n var urlPath = sampleRequest.urlPath;\n var serviceType = sampleRequest.serviceType;\n return this.isDefault() || (!host || Utils.wildcardMatch(this.host, host))\n && (!httpMethod || Utils.wildcardMatch(this.httpMethod, httpMethod))\n && (!serviceName || Utils.wildcardMatch(this.serviceName, serviceName))\n && (!urlPath || Utils.wildcardMatch(this.urlPath, urlPath))\n && (!serviceType || Utils.wildcardMatch(this.serviceType, serviceType));\n};\nSamplingRule.prototype.snapshotStatistics = function snapshotStatistics() {\n var statistics = {\n requestCount: this.requestCount,\n borrowCount: this.borrowCount,\n sampledCount: this.sampledCount\n };\n this.resetStatistics();\n return statistics;\n};\nSamplingRule.prototype.merge = function merge(rule) {\n this.reservoir = rule.reservoir;\n this.requestCount = rule.requestCount;\n this.borrowCount = rule.borrowCount;\n this.sampledCount = rule.sampledCount;\n rule = null; // unref the old rule so it can be garbage collected.\n};\nSamplingRule.prototype.isDefault = function isDefault() {\n return this.name === 'Default'; // \"Default\" is a reserved keyword from X-Ray back-end.\n};\nSamplingRule.prototype.incrementRequestCount = function incrementRequestCount() {\n this.requestCount++;\n};\nSamplingRule.prototype.incrementBorrowCount = function incrementBorrowCount() {\n this.borrowCount++;\n};\nSamplingRule.prototype.incrementSampledCount = function incrementSampledCount() {\n this.sampledCount++;\n};\nSamplingRule.prototype.setRate = function setRate(rate) {\n this.rate = rate;\n};\nSamplingRule.prototype.getRate = function getRate() {\n return this.rate;\n};\nSamplingRule.prototype.getName = function getName() {\n return this.name;\n};\nSamplingRule.prototype.getPriority = function getPriority() {\n return this.priority;\n};\nSamplingRule.prototype.getReservoir = function getReservoir() {\n return this.reservoir;\n};\nSamplingRule.prototype.resetStatistics = function resetStatistics() {\n this.requestCount = 0;\n this.borrowCount = 0;\n this.sampledCount = 0;\n};\nSamplingRule.prototype.canBorrow = function canBorrow() {\n return this.borrow;\n};\nSamplingRule.prototype.everMatched = function everMatched() {\n return this.requestCount > 0;\n};\nSamplingRule.prototype.timeToReport = function timeToReport() {\n return this.reservoir.timeToReport();\n};\nmodule.exports = SamplingRule;\n", "\"use strict\";\nvar crypto = require('crypto');\nvar logger = require('../../logger');\nvar SamplingRule = require('./sampling_rule');\nvar DaemonConfig = require('../../daemon_config');\nconst util = require('util');\nconst http = require('http');\n/**\n * The ServiceConnector that calls X-Ray service and convert the API response bodies to data models\n * defined in the X-Ray SDK and return them to the pollers.\n * @module ServiceConnector\n */\nvar ServiceConnector = {\n // client_id is a 12 byte cryptographically secure random hex\n // identifying the SDK instance and is generated during SDK initialization/\n // This is required when reporting sampling to X-Ray back-end.\n clientId: crypto.randomBytes(12).toString('hex'),\n samplingRulesPath: '/GetSamplingRules',\n samplingTargetsPath: '/SamplingTargets',\n logger: logger,\n httpClient: http,\n fetchSamplingRules: function fetchSamplingRules(callback) {\n const body = '{}'; // Payload needed for GetSamplingRules POST request\n const options = getOptions(this.samplingRulesPath, body.length);\n const httpReq = this.httpClient.__request ? this.httpClient.__request : this.httpClient.request;\n const req = httpReq(options, res => {\n var data = '';\n res.on('data', d => {\n data += d;\n });\n res.on('error', error => {\n callback(error);\n });\n res.on('end', () => {\n var dataObj;\n try {\n dataObj = JSON.parse(data);\n }\n catch (err) {\n callback(err);\n return;\n }\n if (!dataObj) {\n callback(new Error('AWS X-Ray GetSamplingRules API returned empty response'));\n return;\n }\n var newRules = assembleRules(dataObj);\n callback(null, newRules);\n });\n });\n req.on('error', () => {\n callback(new Error(`Failed to connect to X-Ray daemon at ${options.hostname}:${options.port} to get sampling rules.`));\n });\n req.write(body);\n req.end();\n },\n fetchTargets: function fetchTargets(rules, callback) {\n const body = JSON.stringify(constructStatisticsDocs(rules));\n const options = getOptions(this.samplingTargetsPath, body.length);\n const httpReq = this.httpClient.__request ? this.httpClient.__request : this.httpClient.request;\n const req = httpReq(options, res => {\n var data = '';\n res.on('data', d => {\n data += d;\n });\n res.on('error', error => {\n callback(error);\n });\n res.on('end', () => {\n var dataObj;\n try {\n dataObj = JSON.parse(data);\n }\n catch (err) {\n callback(err);\n return;\n }\n if (!dataObj || typeof dataObj['LastRuleModification'] != 'number') {\n callback(new Error('AWS X-Ray SamplingTargets API returned invalid response'));\n return;\n }\n var targetsMapping = assembleTargets(dataObj);\n var ruleFreshness = dateToEpoch(dataObj['LastRuleModification']);\n callback(null, targetsMapping, ruleFreshness);\n });\n });\n req.on('error', () => {\n callback(new Error(`Failed to connect to X-Ray daemon at ${options.hostname}:${options.port} to get sampling targets.`));\n });\n req.write(body);\n req.end();\n }\n};\nvar constructStatisticsDocs = function constructStatisticsDocs(rules) {\n var documents = [];\n var now = Math.floor(new Date().getTime() / 1000);\n rules.forEach(function (rule) {\n var statistics = rule.snapshotStatistics();\n var doc = {\n 'RuleName': rule.getName(),\n 'ClientID': ServiceConnector.clientId,\n 'RequestCount': statistics.requestCount,\n 'BorrowCount': statistics.borrowCount,\n 'SampledCount': statistics.sampledCount,\n 'Timestamp': now\n };\n documents.push(doc);\n });\n return { SamplingStatisticsDocuments: documents };\n};\nvar assembleRules = function assembleRules(data) {\n var newRules = [];\n var ruleList = data['SamplingRuleRecords'] || [];\n ruleList.forEach(function (ruleRecord) {\n ruleRecord = ruleRecord['SamplingRule'];\n // For forward compatibility reason right now it only\n // deals with version 1 sampling rules.\n if (isRuleValid(ruleRecord)) {\n var newRule = new SamplingRule(ruleRecord['RuleName'], ruleRecord['Priority'], ruleRecord['FixedRate'], ruleRecord['ReservoirSize'], ruleRecord['Host'], ruleRecord['HTTPMethod'], ruleRecord['URLPath'], ruleRecord['ServiceName'], ruleRecord['ServiceType']);\n newRules.push(newRule);\n }\n });\n return newRules;\n};\nvar assembleTargets = function assembleTargets(data) {\n var docs = data['SamplingTargetDocuments'] || [];\n var targetsMapping = {};\n docs.forEach(function (doc) {\n var newTarget = {\n rate: doc['FixedRate'],\n quota: doc['ReservoirQuota'],\n TTL: dateToEpoch(doc['ReservoirQuotaTTL']),\n interval: doc['Interval']\n };\n targetsMapping[doc['RuleName']] = newTarget;\n });\n return targetsMapping;\n};\nvar isRuleValid = function isRuleValid(record) {\n return record['Version'] === 1\n && record['ResourceARN'] === '*'\n && record['Attributes'] && Object.keys(record['Attributes']).length === 0\n && record['ServiceType']\n && record['RuleName']\n && record['Priority']\n && typeof record['FixedRate'] == 'number';\n};\nvar dateToEpoch = function dateToEpoch(date) {\n return new Date(date).getTime() / 1000;\n};\nvar getOptions = function getOptions(path, contentLength) {\n const options = {\n hostname: DaemonConfig.tcp_ip,\n port: DaemonConfig.tcp_port,\n method: 'POST',\n path: path,\n headers: {\n 'Content-Type': 'application/json',\n 'Content-Length': contentLength,\n 'Host': util.format('%s:%d', DaemonConfig.tcp_ip, DaemonConfig.tcp_port)\n }\n };\n return options;\n};\nmodule.exports = ServiceConnector;\n", "\"use strict\";\nvar TTL = 60 * 60; // The cache expires 1 hour after the last refresh time.\n/**\n * The rule cache that stores sampling rules fetched from X-Ray service.\n * @module RuleCache\n */\nvar RuleCache = {\n rules: [],\n lastUpdated: null,\n /**\n * Tries to find a valid rule that matches the sample request.\n * @param {object} sampleRequest - Contains information for rules matching.\n * @param {number} now - Current epoch in seconds.\n * @module RuleCache\n * @function getMatchedRule\n */\n getMatchedRule: function getMatchedRule(sampleRequest, now) {\n if (isExpired(now)) {\n return null;\n }\n var matchedRule;\n this.rules.forEach(function (rule) {\n if (!matchedRule && rule.match(sampleRequest)) {\n matchedRule = rule;\n }\n if (rule.isDefault() && !matchedRule) {\n matchedRule = rule;\n }\n });\n return matchedRule;\n },\n /**\n * Load rules fetched from X-Ray service in order sorted by priorities.\n * @param {object} rules - Newly fetched rules to load.\n * @module RuleCache\n * @function loadRules\n */\n loadRules: function loadRules(rules) {\n // Record the old rules for later merging.\n var oldRules = {};\n this.rules.forEach(function (rule) {\n oldRules[rule.getName()] = rule;\n });\n // Update the rules in the cache.\n this.rules = rules;\n // Transfer state information to refreshed rules.\n this.rules.forEach(function (rule) {\n var oldRule = oldRules[rule.getName()];\n if (oldRule) {\n rule.merge(oldRule);\n }\n });\n // The cache should maintain the order of the rules based on\n // priority. If priority is the same we sort name by alphabet\n // as rule name is unique.\n this.rules.sort(function (a, b) {\n var v = a.getPriority() - b.getPriority();\n if (v !== 0) {\n return v;\n }\n if (a.getName() > b.getName()) {\n return 1;\n }\n else {\n return -1;\n }\n });\n },\n /**\n * Load targets fetched from X-Ray service.\n * @param {object} targetsMapping - Newly fetched targets map with rule name as key.\n * @module RuleCache\n * @function loadTargets\n */\n loadTargets: function loadTargets(targetsMapping) {\n this.rules.forEach(function (rule) {\n var target = targetsMapping[rule.getName()];\n if (target) {\n rule.getReservoir().loadNewQuota(target.quota, target.TTL, target.interval);\n rule.setRate(target.rate);\n }\n });\n },\n getRules: function getRules() {\n return this.rules;\n },\n timestamp: function timestamp(now) {\n this.lastUpdated = now;\n },\n getLastUpdated: function getLastUpdated() {\n return this.lastUpdated;\n }\n};\nvar isExpired = function isExpired(now) {\n // The cache is considered expired if it is never loaded.\n if (!RuleCache.getLastUpdated()) {\n return true;\n }\n return now > RuleCache.getLastUpdated() + TTL;\n};\nmodule.exports = RuleCache;\n", "\"use strict\";\nvar logger = require('../../logger');\nvar ServiceConnector = require('./service_connector');\nvar ruleCache = require('./rule_cache');\nvar DEFAULT_INTERVAL = 5 * 60 * 1000; // 5 minutes on sampling rules fetch\n/**\n * The RulePoller that periodically fetch sampling rules from X-Ray service\n * and load them into RuleCache.\n * @module RulePoller\n */\nvar RulePoller = {\n start: function start() {\n if (this.poller) {\n clearInterval(this.poller);\n }\n // Refresh sampling rules cache with no jitter upon start.\n refresh(false);\n this.poller = setInterval(refresh, DEFAULT_INTERVAL);\n this.poller.unref();\n },\n};\nvar refresh = function refresh(jitter) {\n // Add jitter by default unless explicitly told not to.\n jitter = typeof jitter === 'undefined' ? true : jitter;\n if (jitter) {\n var delay = getJitter();\n setTimeout(refreshWithFirewall, delay);\n }\n else {\n refreshWithFirewall();\n }\n};\nvar refreshWithFirewall = function refreshWithFirewall() {\n try {\n refreshCache();\n }\n catch (e) {\n logger.getLogger().warn('Encountered unexpected exception when fetching sampling rules: ' + e);\n }\n};\nvar refreshCache = function refreshCache() {\n // Timestamp should be generated *before* the actual outbound call to ensure\n // we don't mark the cache as being fresher than it actually is.\n var now = Math.floor(new Date().getTime() / 1000);\n // Pass a callback that only runs when the new rules are\n // successfully fetched.\n ServiceConnector.fetchSamplingRules(function (err, newRules) {\n if (err) {\n logger.getLogger().warn('Failed to retrieve sampling rules from X-Ray service:', err);\n }\n else if (newRules.length !== 0) {\n ruleCache.loadRules(newRules);\n ruleCache.timestamp(now);\n logger.getLogger().info('Successfully refreshed centralized sampling rule cache.');\n }\n });\n};\n// A random jitter of up to 5 seconds is injected after every run to ensure\n// the calls eventually get evenly distributed over the 5 minute window.\nvar getJitter = function getJitter() {\n return Math.random() * 5;\n};\nmodule.exports = RulePoller;\n", "\"use strict\";\nvar rulePoller = require('./rule_poller');\nvar serviceConnector = require('./service_connector');\nvar ruleCache = require('./rule_cache');\nvar logger = require('../../logger');\nvar DEFAULT_INTERVAL = 10 * 1000; // 10 seconds on sampling targets fetch\n/**\n * The TargetPoller that periodically fetch sampling targets from X-Ray service\n * and load them into RuleCache.\n * @module TargetPoller\n */\nvar TargetPoller = {\n interval: DEFAULT_INTERVAL,\n start: function start() {\n this.poller = setInterval(refreshWithFirewall, DEFAULT_INTERVAL + getJitter());\n this.poller.unref();\n },\n};\nvar refreshWithFirewall = function refreshWithFirewall() {\n try {\n refresh();\n }\n catch (e) {\n logger.getLogger().warn('Encountered unexpected exception when fetching sampling targets: ' + e);\n }\n};\nvar refresh = function refresh() {\n var candidates = getCandidates();\n if (candidates && candidates.length > 0) {\n serviceConnector.fetchTargets(candidates, function (err, targetsMapping, ruleFreshness) {\n if (err) {\n logger.getLogger().warn('Failed to retrieve sampling targets from X-Ray service:', err);\n return;\n }\n ruleCache.loadTargets(targetsMapping);\n if (ruleFreshness > ruleCache.getLastUpdated()) {\n logger.getLogger().info('Performing out-of-band sampling rule polling to fetch updated rules.');\n rulePoller.start();\n }\n logger.getLogger().info('Successfully reported rule statistics to get new sampling quota.');\n });\n }\n};\n// Don't report a rule statistics if any of the conditions is met:\n// 1. The report time hasn't come (some rules might have larger report intervals).\n// 2. The rule is never matched.\nvar getCandidates = function getCandidates() {\n var rules = ruleCache.getRules();\n var candidates = [];\n rules.forEach(function (rule) {\n if (rule.everMatched() && rule.timeToReport()) {\n candidates.push(rule);\n }\n });\n return candidates;\n};\n// A random jitter of up to 0.1 seconds is injected after every run to ensure\n// the calls eventually get evenly distributed over the 10 second window.\nvar getJitter = function getJitter() {\n return Math.random() / TargetPoller.interval;\n};\nmodule.exports = TargetPoller;\n", "\"use strict\";\nvar logger = require('../../logger');\nconst util = require('util');\nvar SegmentUtils = require('../../segments/segment_utils');\n/**\n * The default sampler used to make sampling decisions when the decisions are absent in the incoming requests.\n * The sampler use pollers to poll sampling rules from X-Ray service.\n * @module DefaultSampler\n */\nvar DefaultSampler = {\n localSampler: require('./local_sampler'),\n rulePoller: require('./rule_poller'),\n targetPoller: require('./target_poller'),\n ruleCache: require('./rule_cache'),\n started: false,\n /**\n * Makes a sample decision based on the sample request.\n * @param {object} sampleRequest - Contains information for rules matching.\n * @module DefaultSampler\n * @function shouldSample\n */\n shouldSample: function shouldSample(sampleRequest) {\n try {\n if (!this.started) {\n this.start();\n }\n if (!sampleRequest.serviceType) {\n sampleRequest.serviceType = SegmentUtils.origin;\n }\n var now = Math.floor(new Date().getTime() / 1000);\n var matchedRule = this.ruleCache.getMatchedRule(sampleRequest, now);\n if (matchedRule) {\n logger.getLogger().debug(util.format('Rule %s is matched.', matchedRule.getName()));\n return processMatchedRule(matchedRule, now);\n }\n else {\n logger.getLogger().info('No effective centralized sampling rule match. Fallback to local rules.');\n return this.localSampler.shouldSample(sampleRequest);\n }\n }\n catch (err) {\n logger.getLogger().error('Unhandled exception by the SDK during making sampling decisions: ' + err);\n }\n },\n /**\n * Set local rules in case there is a need to fallback.\n * @module DefaultSampler\n * @function setLocalRules\n */\n setLocalRules: function setLocalRules(source) {\n this.localSampler.setLocalRules(source);\n },\n /**\n * Start the pollers to poll sampling rules and targets from X-Ray service.\n * @module DefaultSampler\n * @function start\n */\n start: function start() {\n if (!this.started) {\n this.rulePoller.start();\n this.targetPoller.start();\n this.started = true;\n }\n }\n};\nvar processMatchedRule = function processMatchedRule(rule, now) {\n // As long as a rule is matched we increment request counter.\n rule.incrementRequestCount();\n var reservoir = rule.getReservoir();\n var sample = true;\n // We check if we can borrow or take from reservoir first.\n var decision = reservoir.borrowOrTake(now, rule.canBorrow());\n if (decision === 'borrow') {\n rule.incrementBorrowCount();\n }\n else if (decision === 'take') {\n rule.incrementSampledCount();\n }\n else if (Math.random() <= rule.getRate()) {\n // Otherwise we compute based on FixedRate of this sampling rule.\n rule.incrementSampledCount();\n }\n else {\n sample = false;\n }\n if (sample) {\n return rule.getName();\n }\n else {\n return false;\n }\n};\nmodule.exports = DefaultSampler;\n", "\"use strict\";\n/**\n * Middleware Utils module.\n *\n * Exposes various configuration and helper methods to be used by the middleware.\n * @module mw_utils\n */\nvar Segment = require('../segments/segment');\nvar IncomingRequestData = require('./incoming_request_data');\nvar logger = require('../logger');\nvar coreUtils = require('../utils');\nvar wildcardMatch = require('../utils').wildcardMatch;\nvar processTraceData = require('../utils').processTraceData;\n//headers are case-insensitive\nvar XRAY_HEADER = 'x-amzn-trace-id';\nvar overrideFlag = !!process.env.AWS_XRAY_TRACING_NAME;\nvar utils = {\n defaultName: process.env.AWS_XRAY_TRACING_NAME,\n dynamicNaming: false,\n hostPattern: null,\n sampler: require('./sampling/default_sampler'),\n /**\n * Enables dynamic naming for segments via the middleware. Use 'AWSXRay.middleware.enableDynamicNaming()'.\n * @param {string} [hostPattern] - The pattern to match the host header. See the README on dynamic and fixed naming modes.\n * @alias module:mw_utils.enableDynamicNaming\n */\n enableDynamicNaming: function (hostPattern) {\n this.dynamicNaming = true;\n if (hostPattern && typeof hostPattern !== 'string') {\n throw new Error('Host pattern must be a string.');\n }\n this.hostPattern = hostPattern || null;\n },\n /**\n * Splits out the 'x-amzn-trace-id' header params from the incoming request. Used by the middleware.\n * @param {http.IncomingMessage|https.IncomingMessage} req - The request object from the incoming call.\n * @returns {object}\n * @alias module:mw_utils.processHeaders\n */\n processHeaders: function processHeaders(req) {\n var amznTraceHeader = {};\n if (req && req.headers && req.headers[XRAY_HEADER]) {\n amznTraceHeader = processTraceData(req.headers[XRAY_HEADER]);\n }\n return amznTraceHeader;\n },\n /**\n * Resolves the name of the segment as determined by fixed or dynamic mode options. Used by the middleware.\n * @param {string} hostHeader - The string from the request.headers.host property.\n * @returns {string}\n * @alias module:mw_utils.resolveName\n */\n resolveName: function resolveName(hostHeader) {\n var name;\n if (this.dynamicNaming && hostHeader) {\n name = this.hostPattern ? (wildcardMatch(this.hostPattern, hostHeader) ? hostHeader : this.defaultName) : hostHeader;\n }\n else {\n name = this.defaultName;\n }\n return name;\n },\n /**\n * Resolves the sampling decision as determined by the values given and options set. Used by the middleware.\n * @param {object} amznTraceHeader - The object as returned by the processHeaders function.\n * @param {Segment} segment - The string from the request.headers.host property.\n * @param {http.ServerResponse|https.ServerResponse} res - The response object from the incoming call.\n * @returns {boolean}\n * @alias module:mw_utils.resolveSampling\n */\n resolveSampling: function resolveSampling(amznTraceHeader, segment, res) {\n var isSampled;\n if (amznTraceHeader.sampled === '1') {\n isSampled = true;\n }\n else if (amznTraceHeader.sampled === '0') {\n isSampled = false;\n }\n else {\n var sampleRequest = {\n host: res.req.headers.host,\n httpMethod: res.req.method,\n urlPath: res.req.url,\n serviceName: segment.name\n };\n isSampled = this.sampler.shouldSample(sampleRequest);\n if (isSampled instanceof String || typeof isSampled === 'string') {\n segment.setMatchedSamplingRule(isSampled);\n isSampled = true;\n }\n }\n if (amznTraceHeader.sampled === '?') {\n res.header[XRAY_HEADER] = 'Root=' + amznTraceHeader.root + ';Sampled=' + (isSampled ? '1' : '0');\n }\n if (!isSampled) {\n segment.notTraced = true;\n }\n },\n /**\n * Sets the default name of created segments. Used with the middleware.\n * Can be overridden by the AWS_XRAY_TRACING_NAME environment variable.\n * @param {string} name - The default name for segments created in the middleware.\n * @alias module:mw_utils.setDefaultName\n */\n setDefaultName: function setDefaultName(name) {\n if (!overrideFlag) {\n this.defaultName = name;\n }\n },\n disableCentralizedSampling: function disableCentralizedSampling() {\n this.sampler = require('./sampling/local_sampler');\n },\n /**\n * Overrides the default sampling rules file to specify at what rate to sample at for specific routes.\n * The base sampling rules file can be found at /lib/resources/default_sampling_rules.json\n * @param {string|Object} source - The path to the custom sampling rules file, or the source JSON object.\n * @memberof AWSXRay\n */\n setSamplingRules: function setSamplingRules(source) {\n if (!source || source instanceof String || !(typeof source === 'string' || (source instanceof Object))) {\n throw new Error('Please specify a path to the local sampling rules file, or supply an object containing the rules.');\n }\n this.sampler.setLocalRules(source);\n },\n /**\n * Logs a debug message including core request and segment information\n * @param {string} message - The message to be logged\n * @param {string} url - The request url being traced\n * @param {Segment} - The current segment\n */\n middlewareLog: function middlewareLog(message, url, segment) {\n logger.getLogger().debug(message + ': { url: ' + url + ', name: ' + segment.name + ', trace_id: ' +\n segment.trace_id + ', id: ' + segment.id + ', sampled: ' + !segment.notTraced + ' }');\n },\n /**\n * Traces the request/response cycle of an http.IncomingMessage / http.ServerResponse pair.\n * Resolves sampling rules, creates a segment, adds the core request / response data adding\n * throttling / error / fault flags based on the response status code.\n * @param {http.IncomingMessage} req - The incoming request.\n * @param {http.ServerResponse} res - The server response.\n * @returns {Segment}\n * @memberof AWSXRay\n */\n traceRequestResponseCycle: function traceRequestResponseCycle(req, res) {\n var amznTraceHeader = this.processHeaders(req);\n var name = this.resolveName(req.headers.host);\n var segment = new Segment(name, amznTraceHeader.root, amznTraceHeader.parent);\n var responseWithEmbeddedRequest = Object.assign({}, res, { req: req });\n this.resolveSampling(amznTraceHeader, segment, responseWithEmbeddedRequest);\n segment.addIncomingRequestData(new IncomingRequestData(req));\n this.middlewareLog('Starting middleware segment', req.url, segment);\n var middlewareLog = this.middlewareLog;\n var didEnd = false;\n var endSegment = function () {\n // ensure `endSegment` is only called once\n // in some versions of node.js 10.x and in all versions of node.js 11.x and higher,\n // the 'finish' and 'close' event are BOTH triggered.\n // Previously, only one or the other was triggered:\n // https://github.com/nodejs/node/pull/20611\n if (didEnd) {\n return;\n }\n didEnd = true;\n if (res.statusCode === 429) {\n segment.addThrottleFlag();\n }\n const cause = coreUtils.getCauseTypeFromHttpStatus(res.statusCode);\n if (cause) {\n segment[cause] = true;\n }\n segment.http.close(res);\n segment.close();\n middlewareLog('Closed middleware segment successfully', req.url, segment);\n };\n res.on('finish', endSegment);\n res.on('close', endSegment);\n return segment;\n }\n};\nmodule.exports = utils;\n", "\"use strict\";\nvar contextUtils = require('../context_utils');\nvar mwUtils = require('../middleware/mw_utils');\nvar LambdaUtils = require('../utils').LambdaUtils;\nvar Segment = require('../segments/segment');\nvar SegmentEmitter = require('../segment_emitter');\nvar SegmentUtils = require('../segments/segment_utils');\nvar logger = require('../logger');\nconst TraceID = require('../segments/attributes/trace_id');\n/**\n * @namespace\n * @ignore\n */\nvar xAmznTraceIdPrev = null;\n/**\n* Used to initialize segments on AWS Lambda with extra data from the context.\n*/\nmodule.exports.init = function init() {\n contextUtils.enableManualMode = function () {\n logger.getLogger().warn('AWS Lambda does not support AWS X-Ray manual mode.');\n };\n SegmentEmitter.disableReusableSocket();\n SegmentUtils.setStreamingThreshold(0);\n /**\n * Disabling all centralized sampling in Lambda environments. The sampling decisions would be\n * uselessly applied to the facade segment, and the sampling pollers were causing errors.\n *\n * See: https://github.com/aws/aws-xray-sdk-node/issues/217\n */\n logger.getLogger().info('Disabling centralized sampling in Lambda environment.');\n mwUtils.disableCentralizedSampling();\n var namespace = contextUtils.getNamespace();\n namespace.enter(namespace.createContext());\n contextUtils.setSegment(facadeSegment());\n};\nvar facadeSegment = function facadeSegment() {\n var segment = new Segment('facade');\n var whitelistFcn = ['addNewSubsegment', 'addSubsegment', 'removeSubsegment', 'toString', 'addSubsegmentWithoutSampling', 'addNewSubsegmentWithoutSampling'];\n var silentFcn = ['incrementCounter', 'decrementCounter', 'isClosed', 'close', 'format', 'flush'];\n var xAmznTraceId = process.env._X_AMZN_TRACE_ID;\n for (var key in segment) {\n if (typeof segment[key] === 'function' && whitelistFcn.indexOf(key) === -1) {\n if (silentFcn.indexOf(key) === -1) {\n segment[key] = (function () {\n var func = key;\n return function facade() {\n logger.getLogger().warn('Function \"' + func + '\" cannot be called on an AWS Lambda segment. Please use a subsegment to record data.');\n return;\n };\n })();\n }\n else {\n segment[key] = function facade() {\n return;\n };\n }\n }\n }\n segment.trace_id = TraceID.Invalid().toString();\n segment.isClosed = function () {\n return true;\n };\n segment.in_progress = false;\n segment.counter = 1;\n segment.notTraced = true;\n segment.facade = true;\n segment.reset = function reset() {\n this.trace_id = TraceID.Invalid().toString();\n this.id = '00000000';\n delete this.subsegments;\n this.notTraced = true;\n };\n segment.resolveLambdaTraceData = function resolveLambdaTraceData() {\n var xAmznLambda = process.env._X_AMZN_TRACE_ID;\n if (xAmznLambda) {\n // This check resets the trace data whenever a new trace header is read to not leak data between invocations\n if (xAmznLambda != xAmznTraceIdPrev) {\n this.reset();\n if (LambdaUtils.populateTraceData(segment, xAmznLambda)) {\n xAmznTraceIdPrev = xAmznLambda;\n }\n }\n }\n else {\n this.reset();\n contextUtils.contextMissingStrategy.contextMissing('Missing AWS Lambda trace data for X-Ray. ' +\n 'Ensure Active Tracing is enabled and no subsegments are created outside the function handler.');\n }\n };\n // Test for valid trace data during SDK startup. It's likely we're still in the cold-start portion of the\n // code at this point and a valid trace header has not been set\n if (LambdaUtils.validTraceData(xAmznTraceId)) {\n if (LambdaUtils.populateTraceData(segment, xAmznTraceId)) {\n xAmznTraceIdPrev = xAmznTraceId;\n }\n }\n return segment;\n};\n", "\"use strict\";\nvar http = require('http');\nvar Plugin = {\n METADATA_TIMEOUT: 1000,\n /**\n * Asynchronously retrieves metadata from on-instance endpoint with an HTTP request using retries for\n * requests that time out.\n * @param {object} options - The HTTP options to make the request with\n * @param {function} callback - callback to plugin\n */\n getPluginMetadata: function (options, callback) {\n const METADATA_RETRY_TIMEOUT = 250; // Millis\n const METADATA_RETRIES = 5;\n var retries = METADATA_RETRIES;\n var getMetadata = function () {\n var httpReq = http.__request ? http.__request : http.request;\n var req = httpReq(options, function (res) {\n var body = '';\n res.on('data', function (chunk) {\n body += chunk;\n });\n res.on('end', function () {\n if (this.statusCode === 200 || this.statusCode === 300) {\n try {\n body = JSON.parse(body);\n }\n catch (e) {\n callback(e);\n return;\n }\n callback(null, body);\n }\n else if (retries > 0 && Math.floor(this.statusCode / 100) === 5) {\n retries--;\n setTimeout(getMetadata, METADATA_RETRY_TIMEOUT);\n }\n else {\n callback(new Error(`Failed to retrieve metadata with options: ${options}`));\n }\n });\n });\n req.on('error', function (err) {\n callback(err);\n });\n req.on('timeout', function () {\n req.abort();\n });\n req.setTimeout(Plugin.METADATA_TIMEOUT);\n req.end();\n };\n getMetadata();\n }\n};\nmodule.exports = Plugin;\n", "\"use strict\";\nvar Plugin = require('./plugin');\nvar logger = require('../../logger');\nvar http = require('http');\nvar EC2Plugin = {\n /**\n * A function to get the instance data from the EC2 metadata service.\n * @param {function} callback - The callback for the plugin loader.\n */\n getData: function (callback) {\n const METADATA_PATH = '/latest/dynamic/instance-identity/document';\n function populateMetadata(token) {\n const options = getOptions(METADATA_PATH, 'GET', token ? { 'X-aws-ec2-metadata-token': token } : {});\n Plugin.getPluginMetadata(options, function (err, data) {\n if (err || !data) {\n logger.getLogger().error('Error loading EC2 plugin metadata: ', err ? err.toString() : 'Could not retrieve data from IMDS.');\n callback();\n return;\n }\n const metadata = {\n ec2: {\n instance_id: data.instanceId,\n availability_zone: data.availabilityZone,\n instance_size: data.instanceType,\n ami_id: data.imageId\n }\n };\n callback(metadata);\n });\n }\n /**\n * This kicks off a requet to get a token used for requests to IMDSv2. If the request for the token\n * fails, we fall back to IMDSv1. Otherwise, the token will be used for an IMDSv2 request.\n */\n getToken(function (token) {\n if (token === null) {\n logger.getLogger().debug('EC2Plugin failed to get token from IMDSv2. Falling back to IMDSv1.');\n }\n populateMetadata(token);\n });\n },\n originName: 'AWS::EC2::Instance'\n};\n/**\n * Asynchronously retrieves a token used in requests to EC2 instance metadata service.\n * @param {function} callback - callback to plugin\n */\nfunction getToken(callback) {\n const httpReq = http.__request ? http.__request : http.request;\n const TTL = 60; //seconds\n const TOKEN_PATH = '/latest/api/token';\n const options = getOptions(TOKEN_PATH, 'PUT', {\n 'X-aws-ec2-metadata-token-ttl-seconds': TTL\n });\n let req = httpReq(options, function (res) {\n let body = '';\n res.on('data', function (chunk) {\n body += chunk;\n });\n res.on('end', function () {\n if (this.statusCode === 200 || this.statusCode === 300) {\n callback(body);\n }\n else {\n callback(null);\n }\n });\n });\n req.on('error', function () {\n callback(null);\n });\n req.on('timeout', function () {\n req.abort();\n callback(null);\n });\n req.setTimeout(Plugin.METADATA_TIMEOUT);\n req.end();\n}\nfunction getOptions(path, method, headers) {\n if (!method) {\n method = 'GET';\n }\n if (!headers) {\n headers = {};\n }\n return {\n host: '169.254.169.254',\n path: path,\n method: method,\n headers: headers\n };\n}\nmodule.exports = EC2Plugin;\n", "\"use strict\";\nvar os = require('os');\nvar ECSPlugin = {\n /**\n * A function to get the instance data from the ECS instance.\n * @param {function} callback - The callback for the plugin loader.\n */\n getData: function (callback) {\n callback({ ecs: { container: os.hostname() } });\n },\n originName: 'AWS::ECS::Container'\n};\nmodule.exports = ECSPlugin;\n", "\"use strict\";\nvar fs = require('fs');\nvar logger = require('../../logger');\nvar ENV_CONFIG_LOCATION = '/var/elasticbeanstalk/xray/environment.conf';\nvar ElasticBeanstalkPlugin = {\n /**\n * A function to get data from the Elastic Beanstalk environment configuration file.\n * @param {function} callback - The callback for the plugin loader.\n */\n getData: function (callback) {\n fs.readFile(ENV_CONFIG_LOCATION, 'utf8', function (err, rawData) {\n if (err) {\n logger.getLogger().error('Error loading Elastic Beanstalk plugin:', err.stack);\n callback();\n }\n else {\n var data = JSON.parse(rawData);\n var metadata = {\n elastic_beanstalk: {\n environment: data.environment_name,\n version_label: data.version_label,\n deployment_id: data.deployment_id\n }\n };\n callback(metadata);\n }\n });\n },\n originName: 'AWS::ElasticBeanstalk::Environment'\n};\nmodule.exports = ElasticBeanstalkPlugin;\n", "\"use strict\";\nvar fs = require('fs');\nvar logger = require('../logger');\nvar whitelist = require('../resources/aws_whitelist.json');\nvar paramTypes = {\n REQ_DESC: 'request_descriptors',\n REQ_PARAMS: 'request_parameters',\n RES_DESC: 'response_descriptors',\n RES_PARAMS: 'response_parameters'\n};\n/**\n * Represents a set of AWS services, operations and keys or params to capture.\n * @constructor\n * @param {string|Object} [source] - The location or source JSON object of the custom AWS whitelist file. If none is provided, the default file will be used.\n */\nfunction CallCapturer(source) {\n this.init(source);\n}\nCallCapturer.prototype.init = function init(source) {\n if (source) {\n if (typeof source === 'string') {\n logger.getLogger().info('Using custom AWS whitelist file: ' + source);\n this.services = loadWhitelist(JSON.parse(fs.readFileSync(source, 'utf8')));\n }\n else {\n logger.getLogger().info('Using custom AWS whitelist source.');\n this.services = loadWhitelist(source);\n }\n }\n else {\n this.services = whitelist.services;\n }\n};\nCallCapturer.prototype.append = function append(source) {\n var newServices = {};\n if (typeof source === 'string') {\n logger.getLogger().info('Appending AWS whitelist with custom file: ' + source);\n newServices = loadWhitelist(JSON.parse(fs.readFileSync(source, 'utf8')));\n }\n else {\n logger.getLogger().info('Appending AWS whitelist with a custom source.');\n newServices = loadWhitelist(source);\n }\n for (var attribute in newServices) {\n this.services[attribute] = newServices[attribute];\n }\n};\nCallCapturer.prototype.capture = function capture(serviceName, response) {\n var operation = response.request.operation;\n var call = this.services[serviceName] !== undefined ? this.services[serviceName].operations[operation] : null;\n if (call === null) {\n logger.getLogger().debug('Call \"' + serviceName + '.' + operation + '\" is not whitelisted for additional data capturing. Ignoring.');\n return;\n }\n var dataCaptured = {};\n for (var paramType in call) {\n var params = call[paramType];\n if (paramType === paramTypes.REQ_PARAMS) {\n captureCallParams(params, response.request.params, dataCaptured);\n }\n else if (paramType === paramTypes.REQ_DESC) {\n captureDescriptors(params, response.request.params, dataCaptured);\n }\n else if (paramType === paramTypes.RES_PARAMS) {\n if (response.data) {\n captureCallParams(params, response.data, dataCaptured);\n }\n }\n else if (paramType === paramTypes.RES_DESC) {\n if (response.data) {\n captureDescriptors(params, response.data, dataCaptured);\n }\n }\n else {\n logger.getLogger().error('Unknown parameter type \"' + paramType + '\". Must be \"request_descriptors\", \"response_descriptors\", ' +\n '\"request_parameters\" or \"response_parameters\".');\n }\n }\n return dataCaptured;\n};\nfunction captureCallParams(params, call, data) {\n params.forEach(function (param) {\n if (typeof call[param] !== 'undefined') {\n var formatted = toSnakeCase(param);\n this[formatted] = call[param];\n }\n }, data);\n}\nfunction captureDescriptors(descriptors, params, data) {\n for (var paramName in descriptors) {\n var attributes = descriptors[paramName];\n if (typeof params[paramName] !== 'undefined') {\n var paramData;\n if (attributes.list && attributes.get_count) {\n paramData = params[paramName] ? params[paramName].length : 0;\n }\n else {\n paramData = attributes.get_keys === true ? Object.keys(params[paramName]) : params[paramName];\n }\n if (typeof attributes.rename_to === 'string') {\n data[attributes.rename_to] = paramData;\n }\n else {\n var formatted = toSnakeCase(paramName);\n data[formatted] = paramData;\n }\n }\n }\n}\nfunction toSnakeCase(param) {\n if (param === 'IPAddress') {\n return 'ip_address';\n }\n else {\n return param.split(/(?=[A-Z])/).join('_').toLowerCase();\n }\n}\nfunction loadWhitelist(source) {\n var doc = source;\n if (doc.services === undefined) {\n throw new Error('Document formatting is incorrect. Expecting \"services\" param.');\n }\n return doc.services;\n}\nmodule.exports = CallCapturer;\n", "\"use strict\";\nvar CallCapturer = require('../../patchers/call_capturer.js');\nvar capturer = new CallCapturer();\n/**\n * Represents a AWS client call. Automatically captures data from the supplied response object,\n * Data captured depends on the whitelisting file supplied.\n * The base whitelisting file can be found at /lib/resources/aws_whitelist.json.\n * @constructor\n * @param {any} res - The response object from the AWS call. Typed as any to avoid AWS SDK dependency. Otherwise would be AWS.Response.\n * @param {string} serviceName - The service name of the AWS client.\n * @see https://github.com/aws/aws-sdk-js/blob/master/lib/response.js\n */\nfunction Aws(res, serviceName) {\n this.init(res, serviceName);\n}\nAws.prototype.init = function init(res, serviceName) {\n //TODO: account ID\n this.operation = formatOperation(res.request.operation) || '';\n if (res && res.request && res.request.httpRequest && res.request.httpRequest.region) {\n this.region = res.request.httpRequest.region;\n }\n if (res && res.requestId) {\n this.request_id = res.requestId;\n }\n this.retries = res.retryCount || 0;\n if (res.extendedRequestId && serviceName && serviceName.toLowerCase() === 's3') {\n this.id_2 = res.extendedRequestId;\n }\n if (serviceName) {\n this.addData(capturer.capture(serviceName.toLowerCase(), res));\n }\n};\nAws.prototype.addData = function addData(data) {\n for (var attribute in data) {\n this[attribute] = data[attribute];\n }\n};\n/**\n * Overrides the default whitelisting file to specify what params to capture on each AWS Service call.\n * @param {string|Object} source - The path to the custom whitelist file, or a whitelist source JSON object.\n * @exports setAWSWhitelist\n */\nvar setAWSWhitelist = function setAWSWhitelist(source) {\n if (!source || source instanceof String || !(typeof source === 'string' || (source instanceof Object))) {\n throw new Error('Please specify a path to the local whitelist file, or supply a whitelist source object.');\n }\n capturer = new CallCapturer(source);\n};\n/**\n * Appends to the default whitelisting file to specify what params to capture on each AWS Service call.\n * @param {string|Object} source - The path to the custom whitelist file, or a whitelist source JSON object.\n * @exports appendAWSWhitelist\n */\nvar appendAWSWhitelist = function appendAWSWhitelist(source) {\n if (!source || source instanceof String || !(typeof source === 'string' || (source instanceof Object))) {\n throw new Error('Please specify a path to the local whitelist file, or supply a whitelist source object.');\n }\n capturer.append(source);\n};\nfunction formatOperation(operation) {\n if (!operation) {\n return;\n }\n return operation.charAt(0).toUpperCase() + operation.slice(1);\n}\nmodule.exports = Aws;\nmodule.exports.appendAWSWhitelist = appendAWSWhitelist;\nmodule.exports.setAWSWhitelist = setAWSWhitelist;\n", "\"use strict\";\n/**\n * Capture module.\n * @module capture\n */\nvar contextUtils = require('./context_utils');\nvar logger = require('./logger');\n/**\n * Wrap to automatically capture information for the segment.\n * @param {string} name - The name of the new subsegment.\n * @param {function} fcn - The function context to wrap. Can take a single 'subsegment' argument.\n * @param {Segment|Subsegment} [parent] - The parent for the new subsegment, for manual mode.\n * @alias module:capture.captureFunc\n * @return {*} - Returns the result if any by executing the provided function.\n */\nvar captureFunc = function captureFunc(name, fcn, parent) {\n validate(name, fcn);\n var current, executeFcn;\n var parentSeg = contextUtils.resolveSegment(parent);\n if (!parentSeg) {\n logger.getLogger().warn('Failed to capture function.');\n return fcn();\n }\n current = parentSeg.addNewSubsegment(name);\n executeFcn = captureFcn(fcn, current);\n try {\n const response = executeFcn(current);\n current.close();\n return response;\n }\n catch (e) {\n current.close(e);\n throw (e);\n }\n};\n/**\n * Wrap to automatically capture information for the sub/segment. You must close the segment\n * manually from within the function.\n * @param {string} name - The name of the new subsegment.\n * @param {function} fcn - The function context to wrap. Must take a single 'subsegment' argument and call 'subsegment.close([optional error])' when the async function completes.\n * @param {Segment|Subsegment} [parent] - The parent for the new subsegment, for manual mode.\n * @alias module:capture.captureAsyncFunc\n * @return {*} - Returns a promise by executing the provided async function.\n */\nvar captureAsyncFunc = function captureAsyncFunc(name, fcn, parent) {\n validate(name, fcn);\n var current, executeFcn;\n var parentSeg = contextUtils.resolveSegment(parent);\n if (!parentSeg) {\n logger.getLogger().warn('Failed to capture async function.');\n return fcn();\n }\n current = parentSeg.addNewSubsegment(name);\n executeFcn = captureFcn(fcn, current);\n try {\n return executeFcn(current);\n }\n catch (e) {\n current.close(e);\n throw (e);\n }\n};\n/**\n * Wrap to automatically capture information for the sub/segment. This wraps the callback and returns a function.\n * when executed, all arguments are passed through accordingly. An additional argument is appended to gain access to the newly created subsegment.\n * For this reason, always call the captured callback with the full list of arguments.\n * @param {string} name - The name of the new subsegment.\n * @param {function} fcn - The function context to wrap. Can take a single 'subsegment' argument.\n * @param {Segment|Subsegment} [parent] - The parent for the new subsegment, for manual mode.\n * @alias module:capture.captureCallbackFunc\n */\nvar captureCallbackFunc = function captureCallbackFunc(name, fcn, parent) {\n validate(name, fcn);\n var base = contextUtils.resolveSegment(parent);\n if (!base) {\n logger.getLogger().warn('Failed to capture callback function.');\n return fcn;\n }\n base.incrementCounter();\n return function () {\n var parentSeg = contextUtils.resolveSegment(parent);\n var args = Array.prototype.slice.call(arguments);\n captureFunc(name, fcn.bind.apply(fcn, [null].concat(args)), parentSeg);\n base.decrementCounter();\n }.bind(this);\n};\nfunction captureFcn(fcn, current) {\n var executeFcn;\n if (contextUtils.isAutomaticMode()) {\n var session = contextUtils.getNamespace();\n var contextFcn = function () {\n var value;\n session.run(function () {\n contextUtils.setSegment(current);\n value = fcn(current);\n });\n return value;\n };\n executeFcn = contextFcn;\n }\n else {\n executeFcn = fcn;\n }\n return executeFcn;\n}\nfunction validate(name, fcn) {\n var error;\n if (!name || typeof name !== 'string') {\n error = 'Param \"name\" must be a non-empty string.';\n logger.getLogger().error(error);\n throw new Error(error);\n }\n else if (typeof fcn !== 'function') {\n error = 'Param \"fcn\" must be a function.';\n logger.getLogger().error(error);\n throw new Error(error);\n }\n}\nmodule.exports.captureFunc = captureFunc;\nmodule.exports.captureAsyncFunc = captureAsyncFunc;\nmodule.exports.captureCallbackFunc = captureCallbackFunc;\n", "exports = module.exports = SemVer\n\nvar debug\n/* istanbul ignore next */\nif (typeof process === 'object' &&\n process.env &&\n process.env.NODE_DEBUG &&\n /\\bsemver\\b/i.test(process.env.NODE_DEBUG)) {\n debug = function () {\n var args = Array.prototype.slice.call(arguments, 0)\n args.unshift('SEMVER')\n console.log.apply(console, args)\n }\n} else {\n debug = function () {}\n}\n\n// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nexports.SEMVER_SPEC_VERSION = '2.0.0'\n\nvar MAX_LENGTH = 256\nvar MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||\n /* istanbul ignore next */ 9007199254740991\n\n// Max safe segment length for coercion.\nvar MAX_SAFE_COMPONENT_LENGTH = 16\n\n// The actual regexps go on exports.re\nvar re = exports.re = []\nvar src = exports.src = []\nvar R = 0\n\n// The following Regular Expressions can be used for tokenizing,\n// validating, and parsing SemVer version strings.\n\n// ## Numeric Identifier\n// A single `0`, or a non-zero digit followed by zero or more digits.\n\nvar NUMERICIDENTIFIER = R++\nsrc[NUMERICIDENTIFIER] = '0|[1-9]\\\\d*'\nvar NUMERICIDENTIFIERLOOSE = R++\nsrc[NUMERICIDENTIFIERLOOSE] = '[0-9]+'\n\n// ## Non-numeric Identifier\n// Zero or more digits, followed by a letter or hyphen, and then zero or\n// more letters, digits, or hyphens.\n\nvar NONNUMERICIDENTIFIER = R++\nsrc[NONNUMERICIDENTIFIER] = '\\\\d*[a-zA-Z-][a-zA-Z0-9-]*'\n\n// ## Main Version\n// Three dot-separated numeric identifiers.\n\nvar MAINVERSION = R++\nsrc[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\\\.' +\n '(' + src[NUMERICIDENTIFIER] + ')\\\\.' +\n '(' + src[NUMERICIDENTIFIER] + ')'\n\nvar MAINVERSIONLOOSE = R++\nsrc[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\\\.' +\n '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\\\.' +\n '(' + src[NUMERICIDENTIFIERLOOSE] + ')'\n\n// ## Pre-release Version Identifier\n// A numeric identifier, or a non-numeric identifier.\n\nvar PRERELEASEIDENTIFIER = R++\nsrc[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] +\n '|' + src[NONNUMERICIDENTIFIER] + ')'\n\nvar PRERELEASEIDENTIFIERLOOSE = R++\nsrc[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] +\n '|' + src[NONNUMERICIDENTIFIER] + ')'\n\n// ## Pre-release Version\n// Hyphen, followed by one or more dot-separated pre-release version\n// identifiers.\n\nvar PRERELEASE = R++\nsrc[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] +\n '(?:\\\\.' + src[PRERELEASEIDENTIFIER] + ')*))'\n\nvar PRERELEASELOOSE = R++\nsrc[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] +\n '(?:\\\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))'\n\n// ## Build Metadata Identifier\n// Any combination of digits, letters, or hyphens.\n\nvar BUILDIDENTIFIER = R++\nsrc[BUILDIDENTIFIER] = '[0-9A-Za-z-]+'\n\n// ## Build Metadata\n// Plus sign, followed by one or more period-separated build metadata\n// identifiers.\n\nvar BUILD = R++\nsrc[BUILD] = '(?:\\\\+(' + src[BUILDIDENTIFIER] +\n '(?:\\\\.' + src[BUILDIDENTIFIER] + ')*))'\n\n// ## Full Version String\n// A main version, followed optionally by a pre-release version and\n// build metadata.\n\n// Note that the only major, minor, patch, and pre-release sections of\n// the version string are capturing groups. The build metadata is not a\n// capturing group, because it should not ever be used in version\n// comparison.\n\nvar FULL = R++\nvar FULLPLAIN = 'v?' + src[MAINVERSION] +\n src[PRERELEASE] + '?' +\n src[BUILD] + '?'\n\nsrc[FULL] = '^' + FULLPLAIN + '$'\n\n// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n// common in the npm registry.\nvar LOOSEPLAIN = '[v=\\\\s]*' + src[MAINVERSIONLOOSE] +\n src[PRERELEASELOOSE] + '?' +\n src[BUILD] + '?'\n\nvar LOOSE = R++\nsrc[LOOSE] = '^' + LOOSEPLAIN + '$'\n\nvar GTLT = R++\nsrc[GTLT] = '((?:<|>)?=?)'\n\n// Something like \"2.*\" or \"1.2.x\".\n// Note that \"x.x\" is a valid xRange identifer, meaning \"any version\"\n// Only the first item is strictly required.\nvar XRANGEIDENTIFIERLOOSE = R++\nsrc[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\\\*'\nvar XRANGEIDENTIFIER = R++\nsrc[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\\\*'\n\nvar XRANGEPLAIN = R++\nsrc[XRANGEPLAIN] = '[v=\\\\s]*(' + src[XRANGEIDENTIFIER] + ')' +\n '(?:\\\\.(' + src[XRANGEIDENTIFIER] + ')' +\n '(?:\\\\.(' + src[XRANGEIDENTIFIER] + ')' +\n '(?:' + src[PRERELEASE] + ')?' +\n src[BUILD] + '?' +\n ')?)?'\n\nvar XRANGEPLAINLOOSE = R++\nsrc[XRANGEPLAINLOOSE] = '[v=\\\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' +\n '(?:\\\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +\n '(?:\\\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' +\n '(?:' + src[PRERELEASELOOSE] + ')?' +\n src[BUILD] + '?' +\n ')?)?'\n\nvar XRANGE = R++\nsrc[XRANGE] = '^' + src[GTLT] + '\\\\s*' + src[XRANGEPLAIN] + '$'\nvar XRANGELOOSE = R++\nsrc[XRANGELOOSE] = '^' + src[GTLT] + '\\\\s*' + src[XRANGEPLAINLOOSE] + '$'\n\n// Coercion.\n// Extract anything that could conceivably be a part of a valid semver\nvar COERCE = R++\nsrc[COERCE] = '(?:^|[^\\\\d])' +\n '(\\\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' +\n '(?:\\\\.(\\\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +\n '(?:\\\\.(\\\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' +\n '(?:$|[^\\\\d])'\n\n// Tilde ranges.\n// Meaning is \"reasonably at or greater than\"\nvar LONETILDE = R++\nsrc[LONETILDE] = '(?:~>?)'\n\nvar TILDETRIM = R++\nsrc[TILDETRIM] = '(\\\\s*)' + src[LONETILDE] + '\\\\s+'\nre[TILDETRIM] = new RegExp(src[TILDETRIM], 'g')\nvar tildeTrimReplace = '$1~'\n\nvar TILDE = R++\nsrc[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$'\nvar TILDELOOSE = R++\nsrc[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$'\n\n// Caret ranges.\n// Meaning is \"at least and backwards compatible with\"\nvar LONECARET = R++\nsrc[LONECARET] = '(?:\\\\^)'\n\nvar CARETTRIM = R++\nsrc[CARETTRIM] = '(\\\\s*)' + src[LONECARET] + '\\\\s+'\nre[CARETTRIM] = new RegExp(src[CARETTRIM], 'g')\nvar caretTrimReplace = '$1^'\n\nvar CARET = R++\nsrc[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$'\nvar CARETLOOSE = R++\nsrc[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$'\n\n// A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\nvar COMPARATORLOOSE = R++\nsrc[COMPARATORLOOSE] = '^' + src[GTLT] + '\\\\s*(' + LOOSEPLAIN + ')$|^$'\nvar COMPARATOR = R++\nsrc[COMPARATOR] = '^' + src[GTLT] + '\\\\s*(' + FULLPLAIN + ')$|^$'\n\n// An expression to strip any whitespace between the gtlt and the thing\n// it modifies, so that `> 1.2.3` ==> `>1.2.3`\nvar COMPARATORTRIM = R++\nsrc[COMPARATORTRIM] = '(\\\\s*)' + src[GTLT] +\n '\\\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')'\n\n// this one has to use the /g flag\nre[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g')\nvar comparatorTrimReplace = '$1$2$3'\n\n// Something like `1.2.3 - 1.2.4`\n// Note that these all use the loose form, because they'll be\n// checked against either the strict or loose comparator form\n// later.\nvar HYPHENRANGE = R++\nsrc[HYPHENRANGE] = '^\\\\s*(' + src[XRANGEPLAIN] + ')' +\n '\\\\s+-\\\\s+' +\n '(' + src[XRANGEPLAIN] + ')' +\n '\\\\s*$'\n\nvar HYPHENRANGELOOSE = R++\nsrc[HYPHENRANGELOOSE] = '^\\\\s*(' + src[XRANGEPLAINLOOSE] + ')' +\n '\\\\s+-\\\\s+' +\n '(' + src[XRANGEPLAINLOOSE] + ')' +\n '\\\\s*$'\n\n// Star ranges basically just allow anything at all.\nvar STAR = R++\nsrc[STAR] = '(<|>)?=?\\\\s*\\\\*'\n\n// Compile to actual regexp objects.\n// All are flag-free, unless they were created above with a flag.\nfor (var i = 0; i < R; i++) {\n debug(i, src[i])\n if (!re[i]) {\n re[i] = new RegExp(src[i])\n }\n}\n\nexports.parse = parse\nfunction parse (version, options) {\n if (!options || typeof options !== 'object') {\n options = {\n loose: !!options,\n includePrerelease: false\n }\n }\n\n if (version instanceof SemVer) {\n return version\n }\n\n if (typeof version !== 'string') {\n return null\n }\n\n if (version.length > MAX_LENGTH) {\n return null\n }\n\n var r = options.loose ? re[LOOSE] : re[FULL]\n if (!r.test(version)) {\n return null\n }\n\n try {\n return new SemVer(version, options)\n } catch (er) {\n return null\n }\n}\n\nexports.valid = valid\nfunction valid (version, options) {\n var v = parse(version, options)\n return v ? v.version : null\n}\n\nexports.clean = clean\nfunction clean (version, options) {\n var s = parse(version.trim().replace(/^[=v]+/, ''), options)\n return s ? s.version : null\n}\n\nexports.SemVer = SemVer\n\nfunction SemVer (version, options) {\n if (!options || typeof options !== 'object') {\n options = {\n loose: !!options,\n includePrerelease: false\n }\n }\n if (version instanceof SemVer) {\n if (version.loose === options.loose) {\n return version\n } else {\n version = version.version\n }\n } else if (typeof version !== 'string') {\n throw new TypeError('Invalid Version: ' + version)\n }\n\n if (version.length > MAX_LENGTH) {\n throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters')\n }\n\n if (!(this instanceof SemVer)) {\n return new SemVer(version, options)\n }\n\n debug('SemVer', version, options)\n this.options = options\n this.loose = !!options.loose\n\n var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL])\n\n if (!m) {\n throw new TypeError('Invalid Version: ' + version)\n }\n\n this.raw = version\n\n // these are actually numbers\n this.major = +m[1]\n this.minor = +m[2]\n this.patch = +m[3]\n\n if (this.major > MAX_SAFE_INTEGER || this.major < 0) {\n throw new TypeError('Invalid major version')\n }\n\n if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {\n throw new TypeError('Invalid minor version')\n }\n\n if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {\n throw new TypeError('Invalid patch version')\n }\n\n // numberify any prerelease numeric ids\n if (!m[4]) {\n this.prerelease = []\n } else {\n this.prerelease = m[4].split('.').map(function (id) {\n if (/^[0-9]+$/.test(id)) {\n var num = +id\n if (num >= 0 && num < MAX_SAFE_INTEGER) {\n return num\n }\n }\n return id\n })\n }\n\n this.build = m[5] ? m[5].split('.') : []\n this.format()\n}\n\nSemVer.prototype.format = function () {\n this.version = this.major + '.' + this.minor + '.' + this.patch\n if (this.prerelease.length) {\n this.version += '-' + this.prerelease.join('.')\n }\n return this.version\n}\n\nSemVer.prototype.toString = function () {\n return this.version\n}\n\nSemVer.prototype.compare = function (other) {\n debug('SemVer.compare', this.version, this.options, other)\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n return this.compareMain(other) || this.comparePre(other)\n}\n\nSemVer.prototype.compareMain = function (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n return compareIdentifiers(this.major, other.major) ||\n compareIdentifiers(this.minor, other.minor) ||\n compareIdentifiers(this.patch, other.patch)\n}\n\nSemVer.prototype.comparePre = function (other) {\n if (!(other instanceof SemVer)) {\n other = new SemVer(other, this.options)\n }\n\n // NOT having a prerelease is > having one\n if (this.prerelease.length && !other.prerelease.length) {\n return -1\n } else if (!this.prerelease.length && other.prerelease.length) {\n return 1\n } else if (!this.prerelease.length && !other.prerelease.length) {\n return 0\n }\n\n var i = 0\n do {\n var a = this.prerelease[i]\n var b = other.prerelease[i]\n debug('prerelease compare', i, a, b)\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n}\n\n// preminor will bump the version up to the next minor release, and immediately\n// down to pre-release. premajor and prepatch work the same way.\nSemVer.prototype.inc = function (release, identifier) {\n switch (release) {\n case 'premajor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor = 0\n this.major++\n this.inc('pre', identifier)\n break\n case 'preminor':\n this.prerelease.length = 0\n this.patch = 0\n this.minor++\n this.inc('pre', identifier)\n break\n case 'prepatch':\n // If this is already a prerelease, it will bump to the next version\n // drop any prereleases that might already exist, since they are not\n // relevant at this point.\n this.prerelease.length = 0\n this.inc('patch', identifier)\n this.inc('pre', identifier)\n break\n // If the input is a non-prerelease version, this acts the same as\n // prepatch.\n case 'prerelease':\n if (this.prerelease.length === 0) {\n this.inc('patch', identifier)\n }\n this.inc('pre', identifier)\n break\n\n case 'major':\n // If this is a pre-major version, bump up to the same major version.\n // Otherwise increment major.\n // 1.0.0-5 bumps to 1.0.0\n // 1.1.0 bumps to 2.0.0\n if (this.minor !== 0 ||\n this.patch !== 0 ||\n this.prerelease.length === 0) {\n this.major++\n }\n this.minor = 0\n this.patch = 0\n this.prerelease = []\n break\n case 'minor':\n // If this is a pre-minor version, bump up to the same minor version.\n // Otherwise increment minor.\n // 1.2.0-5 bumps to 1.2.0\n // 1.2.1 bumps to 1.3.0\n if (this.patch !== 0 || this.prerelease.length === 0) {\n this.minor++\n }\n this.patch = 0\n this.prerelease = []\n break\n case 'patch':\n // If this is not a pre-release version, it will increment the patch.\n // If it is a pre-release it will bump up to the same patch version.\n // 1.2.0-5 patches to 1.2.0\n // 1.2.0 patches to 1.2.1\n if (this.prerelease.length === 0) {\n this.patch++\n }\n this.prerelease = []\n break\n // This probably shouldn't be used publicly.\n // 1.0.0 \"pre\" would become 1.0.0-0 which is the wrong direction.\n case 'pre':\n if (this.prerelease.length === 0) {\n this.prerelease = [0]\n } else {\n var i = this.prerelease.length\n while (--i >= 0) {\n if (typeof this.prerelease[i] === 'number') {\n this.prerelease[i]++\n i = -2\n }\n }\n if (i === -1) {\n // didn't increment anything\n this.prerelease.push(0)\n }\n }\n if (identifier) {\n // 1.2.0-beta.1 bumps to 1.2.0-beta.2,\n // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0\n if (this.prerelease[0] === identifier) {\n if (isNaN(this.prerelease[1])) {\n this.prerelease = [identifier, 0]\n }\n } else {\n this.prerelease = [identifier, 0]\n }\n }\n break\n\n default:\n throw new Error('invalid increment argument: ' + release)\n }\n this.format()\n this.raw = this.version\n return this\n}\n\nexports.inc = inc\nfunction inc (version, release, loose, identifier) {\n if (typeof (loose) === 'string') {\n identifier = loose\n loose = undefined\n }\n\n try {\n return new SemVer(version, loose).inc(release, identifier).version\n } catch (er) {\n return null\n }\n}\n\nexports.diff = diff\nfunction diff (version1, version2) {\n if (eq(version1, version2)) {\n return null\n } else {\n var v1 = parse(version1)\n var v2 = parse(version2)\n var prefix = ''\n if (v1.prerelease.length || v2.prerelease.length) {\n prefix = 'pre'\n var defaultResult = 'prerelease'\n }\n for (var key in v1) {\n if (key === 'major' || key === 'minor' || key === 'patch') {\n if (v1[key] !== v2[key]) {\n return prefix + key\n }\n }\n }\n return defaultResult // may be undefined\n }\n}\n\nexports.compareIdentifiers = compareIdentifiers\n\nvar numeric = /^[0-9]+$/\nfunction compareIdentifiers (a, b) {\n var anum = numeric.test(a)\n var bnum = numeric.test(b)\n\n if (anum && bnum) {\n a = +a\n b = +b\n }\n\n return a === b ? 0\n : (anum && !bnum) ? -1\n : (bnum && !anum) ? 1\n : a < b ? -1\n : 1\n}\n\nexports.rcompareIdentifiers = rcompareIdentifiers\nfunction rcompareIdentifiers (a, b) {\n return compareIdentifiers(b, a)\n}\n\nexports.major = major\nfunction major (a, loose) {\n return new SemVer(a, loose).major\n}\n\nexports.minor = minor\nfunction minor (a, loose) {\n return new SemVer(a, loose).minor\n}\n\nexports.patch = patch\nfunction patch (a, loose) {\n return new SemVer(a, loose).patch\n}\n\nexports.compare = compare\nfunction compare (a, b, loose) {\n return new SemVer(a, loose).compare(new SemVer(b, loose))\n}\n\nexports.compareLoose = compareLoose\nfunction compareLoose (a, b) {\n return compare(a, b, true)\n}\n\nexports.rcompare = rcompare\nfunction rcompare (a, b, loose) {\n return compare(b, a, loose)\n}\n\nexports.sort = sort\nfunction sort (list, loose) {\n return list.sort(function (a, b) {\n return exports.compare(a, b, loose)\n })\n}\n\nexports.rsort = rsort\nfunction rsort (list, loose) {\n return list.sort(function (a, b) {\n return exports.rcompare(a, b, loose)\n })\n}\n\nexports.gt = gt\nfunction gt (a, b, loose) {\n return compare(a, b, loose) > 0\n}\n\nexports.lt = lt\nfunction lt (a, b, loose) {\n return compare(a, b, loose) < 0\n}\n\nexports.eq = eq\nfunction eq (a, b, loose) {\n return compare(a, b, loose) === 0\n}\n\nexports.neq = neq\nfunction neq (a, b, loose) {\n return compare(a, b, loose) !== 0\n}\n\nexports.gte = gte\nfunction gte (a, b, loose) {\n return compare(a, b, loose) >= 0\n}\n\nexports.lte = lte\nfunction lte (a, b, loose) {\n return compare(a, b, loose) <= 0\n}\n\nexports.cmp = cmp\nfunction cmp (a, op, b, loose) {\n switch (op) {\n case '===':\n if (typeof a === 'object')\n a = a.version\n if (typeof b === 'object')\n b = b.version\n return a === b\n\n case '!==':\n if (typeof a === 'object')\n a = a.version\n if (typeof b === 'object')\n b = b.version\n return a !== b\n\n case '':\n case '=':\n case '==':\n return eq(a, b, loose)\n\n case '!=':\n return neq(a, b, loose)\n\n case '>':\n return gt(a, b, loose)\n\n case '>=':\n return gte(a, b, loose)\n\n case '<':\n return lt(a, b, loose)\n\n case '<=':\n return lte(a, b, loose)\n\n default:\n throw new TypeError('Invalid operator: ' + op)\n }\n}\n\nexports.Comparator = Comparator\nfunction Comparator (comp, options) {\n if (!options || typeof options !== 'object') {\n options = {\n loose: !!options,\n includePrerelease: false\n }\n }\n\n if (comp instanceof Comparator) {\n if (comp.loose === !!options.loose) {\n return comp\n } else {\n comp = comp.value\n }\n }\n\n if (!(this instanceof Comparator)) {\n return new Comparator(comp, options)\n }\n\n debug('comparator', comp, options)\n this.options = options\n this.loose = !!options.loose\n this.parse(comp)\n\n if (this.semver === ANY) {\n this.value = ''\n } else {\n this.value = this.operator + this.semver.version\n }\n\n debug('comp', this)\n}\n\nvar ANY = {}\nComparator.prototype.parse = function (comp) {\n var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR]\n var m = comp.match(r)\n\n if (!m) {\n throw new TypeError('Invalid comparator: ' + comp)\n }\n\n this.operator = m[1]\n if (this.operator === '=') {\n this.operator = ''\n }\n\n // if it literally is just '>' or '' then allow anything.\n if (!m[2]) {\n this.semver = ANY\n } else {\n this.semver = new SemVer(m[2], this.options.loose)\n }\n}\n\nComparator.prototype.toString = function () {\n return this.value\n}\n\nComparator.prototype.test = function (version) {\n debug('Comparator.test', version, this.options.loose)\n\n if (this.semver === ANY) {\n return true\n }\n\n if (typeof version === 'string') {\n version = new SemVer(version, this.options)\n }\n\n return cmp(version, this.operator, this.semver, this.options)\n}\n\nComparator.prototype.intersects = function (comp, options) {\n if (!(comp instanceof Comparator)) {\n throw new TypeError('a Comparator is required')\n }\n\n if (!options || typeof options !== 'object') {\n options = {\n loose: !!options,\n includePrerelease: false\n }\n }\n\n var rangeTmp\n\n if (this.operator === '') {\n rangeTmp = new Range(comp.value, options)\n return satisfies(this.value, rangeTmp, options)\n } else if (comp.operator === '') {\n rangeTmp = new Range(this.value, options)\n return satisfies(comp.semver, rangeTmp, options)\n }\n\n var sameDirectionIncreasing =\n (this.operator === '>=' || this.operator === '>') &&\n (comp.operator === '>=' || comp.operator === '>')\n var sameDirectionDecreasing =\n (this.operator === '<=' || this.operator === '<') &&\n (comp.operator === '<=' || comp.operator === '<')\n var sameSemVer = this.semver.version === comp.semver.version\n var differentDirectionsInclusive =\n (this.operator === '>=' || this.operator === '<=') &&\n (comp.operator === '>=' || comp.operator === '<=')\n var oppositeDirectionsLessThan =\n cmp(this.semver, '<', comp.semver, options) &&\n ((this.operator === '>=' || this.operator === '>') &&\n (comp.operator === '<=' || comp.operator === '<'))\n var oppositeDirectionsGreaterThan =\n cmp(this.semver, '>', comp.semver, options) &&\n ((this.operator === '<=' || this.operator === '<') &&\n (comp.operator === '>=' || comp.operator === '>'))\n\n return sameDirectionIncreasing || sameDirectionDecreasing ||\n (sameSemVer && differentDirectionsInclusive) ||\n oppositeDirectionsLessThan || oppositeDirectionsGreaterThan\n}\n\nexports.Range = Range\nfunction Range (range, options) {\n if (!options || typeof options !== 'object') {\n options = {\n loose: !!options,\n includePrerelease: false\n }\n }\n\n if (range instanceof Range) {\n if (range.loose === !!options.loose &&\n range.includePrerelease === !!options.includePrerelease) {\n return range\n } else {\n return new Range(range.raw, options)\n }\n }\n\n if (range instanceof Comparator) {\n return new Range(range.value, options)\n }\n\n if (!(this instanceof Range)) {\n return new Range(range, options)\n }\n\n this.options = options\n this.loose = !!options.loose\n this.includePrerelease = !!options.includePrerelease\n\n // First, split based on boolean or ||\n this.raw = range\n this.set = range.split(/\\s*\\|\\|\\s*/).map(function (range) {\n return this.parseRange(range.trim())\n }, this).filter(function (c) {\n // throw out any that are not relevant for whatever reason\n return c.length\n })\n\n if (!this.set.length) {\n throw new TypeError('Invalid SemVer Range: ' + range)\n }\n\n this.format()\n}\n\nRange.prototype.format = function () {\n this.range = this.set.map(function (comps) {\n return comps.join(' ').trim()\n }).join('||').trim()\n return this.range\n}\n\nRange.prototype.toString = function () {\n return this.range\n}\n\nRange.prototype.parseRange = function (range) {\n var loose = this.options.loose\n range = range.trim()\n // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE]\n range = range.replace(hr, hyphenReplace)\n debug('hyphen replace', range)\n // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace)\n debug('comparator trim', range, re[COMPARATORTRIM])\n\n // `~ 1.2.3` => `~1.2.3`\n range = range.replace(re[TILDETRIM], tildeTrimReplace)\n\n // `^ 1.2.3` => `^1.2.3`\n range = range.replace(re[CARETTRIM], caretTrimReplace)\n\n // normalize spaces\n range = range.split(/\\s+/).join(' ')\n\n // At this point, the range is completely trimmed and\n // ready to be split into comparators.\n\n var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR]\n var set = range.split(' ').map(function (comp) {\n return parseComparator(comp, this.options)\n }, this).join(' ').split(/\\s+/)\n if (this.options.loose) {\n // in loose mode, throw out any that are not valid comparators\n set = set.filter(function (comp) {\n return !!comp.match(compRe)\n })\n }\n set = set.map(function (comp) {\n return new Comparator(comp, this.options)\n }, this)\n\n return set\n}\n\nRange.prototype.intersects = function (range, options) {\n if (!(range instanceof Range)) {\n throw new TypeError('a Range is required')\n }\n\n return this.set.some(function (thisComparators) {\n return thisComparators.every(function (thisComparator) {\n return range.set.some(function (rangeComparators) {\n return rangeComparators.every(function (rangeComparator) {\n return thisComparator.intersects(rangeComparator, options)\n })\n })\n })\n })\n}\n\n// Mostly just for testing and legacy API reasons\nexports.toComparators = toComparators\nfunction toComparators (range, options) {\n return new Range(range, options).set.map(function (comp) {\n return comp.map(function (c) {\n return c.value\n }).join(' ').trim().split(' ')\n })\n}\n\n// comprised of xranges, tildes, stars, and gtlt's at this point.\n// already replaced the hyphen ranges\n// turn into a set of JUST comparators.\nfunction parseComparator (comp, options) {\n debug('comp', comp, options)\n comp = replaceCarets(comp, options)\n debug('caret', comp)\n comp = replaceTildes(comp, options)\n debug('tildes', comp)\n comp = replaceXRanges(comp, options)\n debug('xrange', comp)\n comp = replaceStars(comp, options)\n debug('stars', comp)\n return comp\n}\n\nfunction isX (id) {\n return !id || id.toLowerCase() === 'x' || id === '*'\n}\n\n// ~, ~> --> * (any, kinda silly)\n// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0\n// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0\n// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0\n// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0\n// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0\nfunction replaceTildes (comp, options) {\n return comp.trim().split(/\\s+/).map(function (comp) {\n return replaceTilde(comp, options)\n }).join(' ')\n}\n\nfunction replaceTilde (comp, options) {\n var r = options.loose ? re[TILDELOOSE] : re[TILDE]\n return comp.replace(r, function (_, M, m, p, pr) {\n debug('tilde', comp, _, M, m, p, pr)\n var ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'\n } else if (isX(p)) {\n // ~1.2 == >=1.2.0 <1.3.0\n ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'\n } else if (pr) {\n debug('replaceTilde pr', pr)\n ret = '>=' + M + '.' + m + '.' + p + '-' + pr +\n ' <' + M + '.' + (+m + 1) + '.0'\n } else {\n // ~1.2.3 == >=1.2.3 <1.3.0\n ret = '>=' + M + '.' + m + '.' + p +\n ' <' + M + '.' + (+m + 1) + '.0'\n }\n\n debug('tilde return', ret)\n return ret\n })\n}\n\n// ^ --> * (any, kinda silly)\n// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0\n// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0\n// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0\n// ^1.2.3 --> >=1.2.3 <2.0.0\n// ^1.2.0 --> >=1.2.0 <2.0.0\nfunction replaceCarets (comp, options) {\n return comp.trim().split(/\\s+/).map(function (comp) {\n return replaceCaret(comp, options)\n }).join(' ')\n}\n\nfunction replaceCaret (comp, options) {\n debug('caret', comp, options)\n var r = options.loose ? re[CARETLOOSE] : re[CARET]\n return comp.replace(r, function (_, M, m, p, pr) {\n debug('caret', comp, _, M, m, p, pr)\n var ret\n\n if (isX(M)) {\n ret = ''\n } else if (isX(m)) {\n ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'\n } else if (isX(p)) {\n if (M === '0') {\n ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'\n } else {\n ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'\n }\n } else if (pr) {\n debug('replaceCaret pr', pr)\n if (M === '0') {\n if (m === '0') {\n ret = '>=' + M + '.' + m + '.' + p + '-' + pr +\n ' <' + M + '.' + m + '.' + (+p + 1)\n } else {\n ret = '>=' + M + '.' + m + '.' + p + '-' + pr +\n ' <' + M + '.' + (+m + 1) + '.0'\n }\n } else {\n ret = '>=' + M + '.' + m + '.' + p + '-' + pr +\n ' <' + (+M + 1) + '.0.0'\n }\n } else {\n debug('no pr')\n if (M === '0') {\n if (m === '0') {\n ret = '>=' + M + '.' + m + '.' + p +\n ' <' + M + '.' + m + '.' + (+p + 1)\n } else {\n ret = '>=' + M + '.' + m + '.' + p +\n ' <' + M + '.' + (+m + 1) + '.0'\n }\n } else {\n ret = '>=' + M + '.' + m + '.' + p +\n ' <' + (+M + 1) + '.0.0'\n }\n }\n\n debug('caret return', ret)\n return ret\n })\n}\n\nfunction replaceXRanges (comp, options) {\n debug('replaceXRanges', comp, options)\n return comp.split(/\\s+/).map(function (comp) {\n return replaceXRange(comp, options)\n }).join(' ')\n}\n\nfunction replaceXRange (comp, options) {\n comp = comp.trim()\n var r = options.loose ? re[XRANGELOOSE] : re[XRANGE]\n return comp.replace(r, function (ret, gtlt, M, m, p, pr) {\n debug('xRange', comp, ret, gtlt, M, m, p, pr)\n var xM = isX(M)\n var xm = xM || isX(m)\n var xp = xm || isX(p)\n var anyX = xp\n\n if (gtlt === '=' && anyX) {\n gtlt = ''\n }\n\n if (xM) {\n if (gtlt === '>' || gtlt === '<') {\n // nothing is allowed\n ret = '<0.0.0'\n } else {\n // nothing is forbidden\n ret = '*'\n }\n } else if (gtlt && anyX) {\n // we know patch is an x, because we have any x at all.\n // replace X with 0\n if (xm) {\n m = 0\n }\n p = 0\n\n if (gtlt === '>') {\n // >1 => >=2.0.0\n // >1.2 => >=1.3.0\n // >1.2.3 => >= 1.2.4\n gtlt = '>='\n if (xm) {\n M = +M + 1\n m = 0\n p = 0\n } else {\n m = +m + 1\n p = 0\n }\n } else if (gtlt === '<=') {\n // <=0.7.x is actually <0.8.0, since any 0.7.x should\n // pass. Similarly, <=7.x is actually <8.0.0, etc.\n gtlt = '<'\n if (xm) {\n M = +M + 1\n } else {\n m = +m + 1\n }\n }\n\n ret = gtlt + M + '.' + m + '.' + p\n } else if (xm) {\n ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'\n } else if (xp) {\n ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'\n }\n\n debug('xRange return', ret)\n\n return ret\n })\n}\n\n// Because * is AND-ed with everything else in the comparator,\n// and '' means \"any version\", just remove the *s entirely.\nfunction replaceStars (comp, options) {\n debug('replaceStars', comp, options)\n // Looseness is ignored here. star is always as loose as it gets!\n return comp.trim().replace(re[STAR], '')\n}\n\n// This function is passed to string.replace(re[HYPHENRANGE])\n// M, m, patch, prerelease, build\n// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5\n// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do\n// 1.2 - 3.4 => >=1.2.0 <3.5.0\nfunction hyphenReplace ($0,\n from, fM, fm, fp, fpr, fb,\n to, tM, tm, tp, tpr, tb) {\n if (isX(fM)) {\n from = ''\n } else if (isX(fm)) {\n from = '>=' + fM + '.0.0'\n } else if (isX(fp)) {\n from = '>=' + fM + '.' + fm + '.0'\n } else {\n from = '>=' + from\n }\n\n if (isX(tM)) {\n to = ''\n } else if (isX(tm)) {\n to = '<' + (+tM + 1) + '.0.0'\n } else if (isX(tp)) {\n to = '<' + tM + '.' + (+tm + 1) + '.0'\n } else if (tpr) {\n to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr\n } else {\n to = '<=' + to\n }\n\n return (from + ' ' + to).trim()\n}\n\n// if ANY of the sets match ALL of its comparators, then pass\nRange.prototype.test = function (version) {\n if (!version) {\n return false\n }\n\n if (typeof version === 'string') {\n version = new SemVer(version, this.options)\n }\n\n for (var i = 0; i < this.set.length; i++) {\n if (testSet(this.set[i], version, this.options)) {\n return true\n }\n }\n return false\n}\n\nfunction testSet (set, version, options) {\n for (var i = 0; i < set.length; i++) {\n if (!set[i].test(version)) {\n return false\n }\n }\n\n if (version.prerelease.length && !options.includePrerelease) {\n // Find the set of versions that are allowed to have prereleases\n // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0\n // That should allow `1.2.3-pr.2` to pass.\n // However, `1.2.4-alpha.notready` should NOT be allowed,\n // even though it's within the range set by the comparators.\n for (i = 0; i < set.length; i++) {\n debug(set[i].semver)\n if (set[i].semver === ANY) {\n continue\n }\n\n if (set[i].semver.prerelease.length > 0) {\n var allowed = set[i].semver\n if (allowed.major === version.major &&\n allowed.minor === version.minor &&\n allowed.patch === version.patch) {\n return true\n }\n }\n }\n\n // Version has a -pre, but it's not one of the ones we like.\n return false\n }\n\n return true\n}\n\nexports.satisfies = satisfies\nfunction satisfies (version, range, options) {\n try {\n range = new Range(range, options)\n } catch (er) {\n return false\n }\n return range.test(version)\n}\n\nexports.maxSatisfying = maxSatisfying\nfunction maxSatisfying (versions, range, options) {\n var max = null\n var maxSV = null\n try {\n var rangeObj = new Range(range, options)\n } catch (er) {\n return null\n }\n versions.forEach(function (v) {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!max || maxSV.compare(v) === -1) {\n // compare(max, v, true)\n max = v\n maxSV = new SemVer(max, options)\n }\n }\n })\n return max\n}\n\nexports.minSatisfying = minSatisfying\nfunction minSatisfying (versions, range, options) {\n var min = null\n var minSV = null\n try {\n var rangeObj = new Range(range, options)\n } catch (er) {\n return null\n }\n versions.forEach(function (v) {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!min || minSV.compare(v) === 1) {\n // compare(min, v, true)\n min = v\n minSV = new SemVer(min, options)\n }\n }\n })\n return min\n}\n\nexports.minVersion = minVersion\nfunction minVersion (range, loose) {\n range = new Range(range, loose)\n\n var minver = new SemVer('0.0.0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = new SemVer('0.0.0-0')\n if (range.test(minver)) {\n return minver\n }\n\n minver = null\n for (var i = 0; i < range.set.length; ++i) {\n var comparators = range.set[i]\n\n comparators.forEach(function (comparator) {\n // Clone to avoid manipulating the comparator's semver object.\n var compver = new SemVer(comparator.semver.version)\n switch (comparator.operator) {\n case '>':\n if (compver.prerelease.length === 0) {\n compver.patch++\n } else {\n compver.prerelease.push(0)\n }\n compver.raw = compver.format()\n /* fallthrough */\n case '':\n case '>=':\n if (!minver || gt(minver, compver)) {\n minver = compver\n }\n break\n case '<':\n case '<=':\n /* Ignore maximum versions */\n break\n /* istanbul ignore next */\n default:\n throw new Error('Unexpected operation: ' + comparator.operator)\n }\n })\n }\n\n if (minver && range.test(minver)) {\n return minver\n }\n\n return null\n}\n\nexports.validRange = validRange\nfunction validRange (range, options) {\n try {\n // Return '*' instead of '' so that truthiness works.\n // This will throw if it's invalid anyway\n return new Range(range, options).range || '*'\n } catch (er) {\n return null\n }\n}\n\n// Determine if version is less than all the versions possible in the range\nexports.ltr = ltr\nfunction ltr (version, range, options) {\n return outside(version, range, '<', options)\n}\n\n// Determine if version is greater than all the versions possible in the range.\nexports.gtr = gtr\nfunction gtr (version, range, options) {\n return outside(version, range, '>', options)\n}\n\nexports.outside = outside\nfunction outside (version, range, hilo, options) {\n version = new SemVer(version, options)\n range = new Range(range, options)\n\n var gtfn, ltefn, ltfn, comp, ecomp\n switch (hilo) {\n case '>':\n gtfn = gt\n ltefn = lte\n ltfn = lt\n comp = '>'\n ecomp = '>='\n break\n case '<':\n gtfn = lt\n ltefn = gte\n ltfn = gt\n comp = '<'\n ecomp = '<='\n break\n default:\n throw new TypeError('Must provide a hilo val of \"<\" or \">\"')\n }\n\n // If it satisifes the range it is not outside\n if (satisfies(version, range, options)) {\n return false\n }\n\n // From now on, variable terms are as if we're in \"gtr\" mode.\n // but note that everything is flipped for the \"ltr\" function.\n\n for (var i = 0; i < range.set.length; ++i) {\n var comparators = range.set[i]\n\n var high = null\n var low = null\n\n comparators.forEach(function (comparator) {\n if (comparator.semver === ANY) {\n comparator = new Comparator('>=0.0.0')\n }\n high = high || comparator\n low = low || comparator\n if (gtfn(comparator.semver, high.semver, options)) {\n high = comparator\n } else if (ltfn(comparator.semver, low.semver, options)) {\n low = comparator\n }\n })\n\n // If the edge version comparator has a operator then our version\n // isn't outside it\n if (high.operator === comp || high.operator === ecomp) {\n return false\n }\n\n // If the lowest version comparator has an operator and our version\n // is less than it then it isn't higher than the range\n if ((!low.operator || low.operator === comp) &&\n ltefn(version, low.semver)) {\n return false\n } else if (low.operator === ecomp && ltfn(version, low.semver)) {\n return false\n }\n }\n return true\n}\n\nexports.prerelease = prerelease\nfunction prerelease (version, options) {\n var parsed = parse(version, options)\n return (parsed && parsed.prerelease.length) ? parsed.prerelease : null\n}\n\nexports.intersects = intersects\nfunction intersects (r1, r2, options) {\n r1 = new Range(r1, options)\n r2 = new Range(r2, options)\n return r1.intersects(r2)\n}\n\nexports.coerce = coerce\nfunction coerce (version) {\n if (version instanceof SemVer) {\n return version\n }\n\n if (typeof version !== 'string') {\n return null\n }\n\n var match = version.match(re[COERCE])\n\n if (match == null) {\n return null\n }\n\n return parse(match[1] +\n '.' + (match[2] || '0') +\n '.' + (match[3] || '0'))\n}\n", "\"use strict\";\n/**\n * Capture module.\n * @module aws_p\n */\nvar semver = require('semver');\nvar Aws = require('../segments/attributes/aws');\nvar contextUtils = require('../context_utils');\nvar Utils = require('../utils');\nvar logger = require('../logger');\nvar minVersion = '2.7.15';\nvar throttledErrorDefault = function throttledErrorDefault() {\n return false; // If the customer doesn't provide an aws-sdk with a throttled error function, we can't make assumptions.\n};\n/**\n * Configures the AWS SDK to automatically capture information for the segment.\n * All created clients will automatically be captured. See 'captureAWSClient'\n * for additional details.\n * @param {AWS} awssdk - The Javascript AWS SDK.\n * @alias module:aws_p.captureAWS\n * @returns {AWS}\n * @see https://github.com/aws/aws-sdk-js\n */\nvar captureAWS = function captureAWS(awssdk) {\n if (!semver.gte(awssdk.VERSION, minVersion)) {\n throw new Error('AWS SDK version ' + minVersion + ' or greater required.');\n }\n for (var prop in awssdk) {\n if (awssdk[prop].serviceIdentifier) {\n var Service = awssdk[prop];\n Service.prototype.customizeRequests(captureAWSRequest);\n }\n }\n return awssdk;\n};\n/**\n * Configures any AWS Client instance to automatically capture information for the segment.\n * For manual mode, a param with key called 'Segment' is required as a part of the AWS\n * call paramaters, and must reference a Segment or Subsegment object.\n * @param {AWS.Service} service - An instance of a AWS service to wrap.\n * @alias module:aws_p.captureAWSClient\n * @returns {AWS.Service}\n * @see https://github.com/aws/aws-sdk-js\n */\nvar captureAWSClient = function captureAWSClient(service) {\n service.customizeRequests(captureAWSRequest);\n return service;\n};\nfunction captureAWSRequest(req) {\n var parent = contextUtils.resolveSegment(contextUtils.resolveManualSegmentParams(req.params));\n if (!parent) {\n var output = this.serviceIdentifier + '.' + req.operation;\n if (!contextUtils.isAutomaticMode()) {\n logger.getLogger().info('Call ' + output + ' requires a segment object' +\n ' on the request params as \"XRaySegment\" for tracing in manual mode. Ignoring.');\n }\n else {\n logger.getLogger().info('Call ' + output +\n ' is missing the sub/segment context for automatic mode. Ignoring.');\n }\n return req;\n }\n var throttledError = this.throttledError || throttledErrorDefault;\n var stack = (new Error()).stack;\n let subsegment;\n if (parent.notTraced) {\n subsegment = parent.addNewSubsegmentWithoutSampling(this.serviceIdentifier);\n }\n else {\n subsegment = parent.addNewSubsegment(this.serviceIdentifier);\n }\n var traceId = parent.segment ? parent.segment.trace_id : parent.trace_id;\n var buildListener = function (req) {\n req.httpRequest.headers['X-Amzn-Trace-Id'] = 'Root=' + traceId + ';Parent=' + subsegment.id +\n ';Sampled=' + (subsegment.notTraced ? '0' : '1');\n };\n var completeListener = function (res) {\n subsegment.addAttribute('namespace', 'aws');\n subsegment.addAttribute('aws', new Aws(res, subsegment.name));\n var httpRes = res.httpResponse;\n if (httpRes) {\n subsegment.addAttribute('http', new HttpResponse(httpRes));\n if (httpRes.statusCode === 429 || (res.error && throttledError(res.error))) {\n subsegment.addThrottleFlag();\n }\n }\n if (res.error) {\n var err = { message: res.error.message, name: res.error.code, stack: stack };\n if (httpRes && httpRes.statusCode) {\n if (Utils.getCauseTypeFromHttpStatus(httpRes.statusCode) == 'error') {\n subsegment.addErrorFlag();\n }\n subsegment.close(err, true);\n }\n else {\n subsegment.close(err);\n }\n }\n else {\n if (httpRes && httpRes.statusCode) {\n var cause = Utils.getCauseTypeFromHttpStatus(httpRes.statusCode);\n if (cause) {\n subsegment[cause] = true;\n }\n }\n subsegment.close();\n }\n };\n req.on('beforePresign', function (req) {\n // Only the AWS Presigner triggers this event,\n // so we can rely on this event to notify us when\n // a request is for a presigned url\n parent.removeSubsegment(subsegment);\n parent.decrementCounter();\n req.removeListener('build', buildListener);\n req.removeListener('complete', completeListener);\n });\n req.on('build', buildListener).on('complete', completeListener);\n if (!req.__send) {\n req.__send = req.send;\n req.send = function (callback) {\n if (contextUtils.isAutomaticMode()) {\n var session = contextUtils.getNamespace();\n session.run(function () {\n contextUtils.setSegment(subsegment);\n req.__send(callback);\n });\n }\n else {\n req.__send(callback);\n }\n };\n }\n}\nfunction HttpResponse(res) {\n this.init(res);\n}\nHttpResponse.prototype.init = function init(res) {\n this.response = {\n status: res.statusCode || '',\n };\n if (res.headers && res.headers['content-length']) {\n this.response.content_length = res.headers['content-length'];\n }\n};\nmodule.exports.captureAWSClient = captureAWSClient;\nmodule.exports.captureAWS = captureAWS;\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.NODEJS_TIMEOUT_ERROR_CODES = exports.TRANSIENT_ERROR_STATUS_CODES = exports.TRANSIENT_ERROR_CODES = exports.THROTTLING_ERROR_CODES = exports.CLOCK_SKEW_ERROR_CODES = void 0;\nexports.CLOCK_SKEW_ERROR_CODES = [\n \"AuthFailure\",\n \"InvalidSignatureException\",\n \"RequestExpired\",\n \"RequestInTheFuture\",\n \"RequestTimeTooSkewed\",\n \"SignatureDoesNotMatch\",\n];\nexports.THROTTLING_ERROR_CODES = [\n \"BandwidthLimitExceeded\",\n \"EC2ThrottledException\",\n \"LimitExceededException\",\n \"PriorRequestNotComplete\",\n \"ProvisionedThroughputExceededException\",\n \"RequestLimitExceeded\",\n \"RequestThrottled\",\n \"RequestThrottledException\",\n \"SlowDown\",\n \"ThrottledException\",\n \"Throttling\",\n \"ThrottlingException\",\n \"TooManyRequestsException\",\n \"TransactionInProgressException\",\n];\nexports.TRANSIENT_ERROR_CODES = [\"AbortError\", \"TimeoutError\", \"RequestTimeout\", \"RequestTimeoutException\"];\nexports.TRANSIENT_ERROR_STATUS_CODES = [500, 502, 503, 504];\nexports.NODEJS_TIMEOUT_ERROR_CODES = [\"ECONNRESET\", \"EPIPE\", \"ETIMEDOUT\"];\n", "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isTransientError = exports.isThrottlingError = exports.isClockSkewError = exports.isRetryableByTrait = void 0;\nconst constants_1 = require(\"./constants\");\nconst isRetryableByTrait = (error) => error.$retryable !== undefined;\nexports.isRetryableByTrait = isRetryableByTrait;\nconst isClockSkewError = (error) => constants_1.CLOCK_SKEW_ERROR_CODES.includes(error.name);\nexports.isClockSkewError = isClockSkewError;\nconst isThrottlingError = (error) => {\n var _a, _b;\n return ((_a = error.$metadata) === null || _a === void 0 ? void 0 : _a.httpStatusCode) === 429 ||\n constants_1.THROTTLING_ERROR_CODES.includes(error.name) ||\n ((_b = error.$retryable) === null || _b === void 0 ? void 0 : _b.throttling) == true;\n};\nexports.isThrottlingError = isThrottlingError;\nconst isTransientError = (error) => {\n var _a;\n return constants_1.TRANSIENT_ERROR_CODES.includes(error.name) ||\n constants_1.NODEJS_TIMEOUT_ERROR_CODES.includes((error === null || error === void 0 ? void 0 : error.code) || \"\") ||\n constants_1.TRANSIENT_ERROR_STATUS_CODES.includes(((_a = error.$metadata) === null || _a === void 0 ? void 0 : _a.httpStatusCode) || 0);\n};\nexports.isTransientError = isTransientError;\n", "\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.captureAWSClient = void 0;\nconst service_error_classification_1 = require(\"@aws-sdk/service-error-classification\");\nconst aws_1 = __importDefault(require(\"../segments/attributes/aws\"));\nconst querystring_1 = require(\"querystring\");\nconst subsegment_1 = __importDefault(require(\"../segments/attributes/subsegment\"));\nconst contextUtils = require('../context_utils');\nconst logger = require('../logger');\nconst { safeParseInt } = require('../utils');\nconst utils_1 = require(\"../utils\");\nconst XRAY_PLUGIN_NAME = 'XRaySDKInstrumentation';\nconst buildAttributesFromMetadata = async (service, operation, region, res, error) => {\n var _a, _b, _c;\n const { extendedRequestId, requestId, httpStatusCode: statusCode, attempts } = ((_a = res === null || res === void 0 ? void 0 : res.output) === null || _a === void 0 ? void 0 : _a.$metadata) || (error === null || error === void 0 ? void 0 : error.$metadata);\n const aws = new aws_1.default({\n extendedRequestId,\n requestId,\n retryCount: attempts,\n request: {\n operation,\n httpRequest: {\n region,\n statusCode,\n },\n },\n }, service);\n const http = {};\n if (statusCode) {\n http.response = {};\n http.response.status = statusCode;\n }\n if (((_b = res === null || res === void 0 ? void 0 : res.response) === null || _b === void 0 ? void 0 : _b.headers) && ((_c = res === null || res === void 0 ? void 0 : res.response) === null || _c === void 0 ? void 0 : _c.headers['content-length']) !== undefined) {\n if (!http.response) {\n http.response = {};\n }\n http.response.content_length = safeParseInt(res.response.headers['content-length']);\n }\n return [aws, http];\n};\nfunction addFlags(http, subsegment, err) {\n var _a, _b, _c;\n if (err && (0, service_error_classification_1.isThrottlingError)(err)) {\n subsegment.addThrottleFlag();\n }\n else if (safeParseInt((_a = http.response) === null || _a === void 0 ? void 0 : _a.status) === 429 || safeParseInt((_b = err === null || err === void 0 ? void 0 : err.$metadata) === null || _b === void 0 ? void 0 : _b.httpStatusCode) === 429) {\n subsegment.addThrottleFlag();\n }\n const cause = (0, utils_1.getCauseTypeFromHttpStatus)(safeParseInt((_c = http.response) === null || _c === void 0 ? void 0 : _c.status));\n if (cause === 'fault') {\n subsegment.addFaultFlag();\n }\n else if (cause === 'error') {\n subsegment.addErrorFlag();\n }\n}\nconst getXRayMiddleware = (config, manualSegment) => (next, context) => async (args) => {\n const segment = contextUtils.isAutomaticMode() ? contextUtils.resolveSegment() : manualSegment;\n const { clientName, commandName } = context;\n const operation = commandName.slice(0, -7); // Strip trailing \"Command\" string\n const service = clientName.slice(0, -6); // Strip trailing \"Client\" string\n if (!segment) {\n const output = service + '.' + operation.charAt(0).toLowerCase() + operation.slice(1);\n if (!contextUtils.isAutomaticMode()) {\n logger.getLogger().info('Call ' + output + ' requires a segment object' +\n ' passed to captureAWSv3Client for tracing in manual mode. Ignoring.');\n }\n else {\n logger.getLogger().info('Call ' + output +\n ' is missing the sub/segment context for automatic mode. Ignoring.');\n }\n return next(args);\n }\n let subsegment;\n if (segment.notTraced) {\n subsegment = segment.addNewSubsegmentWithoutSampling(service);\n }\n else {\n subsegment = segment.addNewSubsegment(service);\n }\n subsegment.addAttribute('namespace', 'aws');\n const parent = (segment instanceof subsegment_1.default ? segment.segment : segment);\n args.request.headers['X-Amzn-Trace-Id'] = (0, querystring_1.stringify)({\n Root: parent.trace_id,\n Parent: subsegment.id,\n Sampled: subsegment.notTraced ? '0' : '1',\n }, ';');\n let res;\n try {\n res = await next(args);\n if (!res) {\n throw new Error('Failed to get response from instrumented AWS Client.');\n }\n const [aws, http] = await buildAttributesFromMetadata(service, operation, await config.region(), res, null);\n subsegment.addAttribute('aws', aws);\n subsegment.addAttribute('http', http);\n addFlags(http, subsegment);\n subsegment.close();\n return res;\n }\n catch (err) {\n if (err.$metadata) {\n const [aws, http] = await buildAttributesFromMetadata(service, operation, await config.region(), null, err);\n subsegment.addAttribute('aws', aws);\n subsegment.addAttribute('http', http);\n addFlags(http, subsegment, err);\n }\n const errObj = { message: err.message, name: err.name, stack: err.stack || new Error().stack };\n subsegment.close(errObj, true);\n throw err;\n }\n};\nconst xRayMiddlewareOptions = {\n name: XRAY_PLUGIN_NAME,\n step: 'build',\n};\nconst getXRayPlugin = (config, manualSegment) => ({\n applyToStack: (stack) => {\n stack.add(getXRayMiddleware(config, manualSegment), xRayMiddlewareOptions);\n },\n});\n/**\n * Instruments AWS SDK V3 clients with X-Ray via middleware.\n *\n * @param client - AWS SDK V3 client to instrument\n * @param manualSegment - Parent segment or subsegment that is passed in for manual mode users\n * @returns - the client with the X-Ray instrumentation middleware added to its middleware stack\n */\nfunction captureAWSClient(client, manualSegment) {\n // Remove existing middleware to ensure operation is idempotent\n client.middlewareStack.remove(XRAY_PLUGIN_NAME);\n client.middlewareStack.use(getXRayPlugin(client.config, manualSegment));\n return client;\n}\nexports.captureAWSClient = captureAWSClient;\n", "\"use strict\";\n/**\n * @module http_p\n */\n/**\n * This module patches the HTTP and HTTPS node built-in libraries and returns a copy of the module with tracing enabled.\n */\nvar url = require('url');\nvar contextUtils = require('../context_utils');\nvar Utils = require('../utils');\nvar logger = require('../logger');\nvar events = require('events');\n/**\n * Wraps the http/https.request() and .get() calls to automatically capture information for the segment.\n * This patches the built-in HTTP and HTTPS modules globally. If using a 3rd party HTTP library,\n * it should still use HTTP under the hood. Be sure to patch globally before requiring the 3rd party library.\n * 3rd party library compatibility is best effort. Some incompatibility issues may arise.\n * @param {http|https} module - The built in Node.js HTTP or HTTPS module.\n * @param {boolean} downstreamXRayEnabled - when true, adds a \"traced:true\" property to the subsegment\n * so the AWS X-Ray service expects a corresponding segment from the downstream service.\n * @param {function} subsegmentCallback - a callback that is called with the subsegment, the Node.js\n * http.ClientRequest, the Node.js http.IncomingMessage (if a response was received) and any error issued,\n * allowing custom annotations and metadata to be added.\n * to be added to the subsegment.\n * @alias module:http_p.captureHTTPsGlobal\n */\nvar captureHTTPsGlobal = function captureHTTPsGlobal(module, downstreamXRayEnabled, subsegmentCallback) {\n if (!module.__request) {\n enableCapture(module, downstreamXRayEnabled, subsegmentCallback);\n }\n};\n/**\n * Wraps the http/https.request() and .get() calls to automatically capture information for the segment.\n * Returns an instance of the HTTP or HTTPS module that is patched.\n * @param {http|https} module - The built in Node.js HTTP or HTTPS module.\n * @param {boolean} downstreamXRayEnabled - when true, adds a \"traced:true\" property to the subsegment\n * so the AWS X-Ray service expects a corresponding segment from the downstream service.\n * @param {function} subsegmentCallback - a callback that is called with the subsegment, the Node.js\n * http.ClientRequest, and the Node.js http.IncomingMessage to allow custom annotations and metadata\n * to be added to the subsegment.\n * @alias module:http_p.captureHTTPs\n * @returns {http|https}\n */\nvar captureHTTPs = function captureHTTPs(module, downstreamXRayEnabled, subsegmentCallback) {\n if (module.__request) {\n return module;\n }\n var tracedModule = {};\n Object.keys(module).forEach(function (val) {\n tracedModule[val] = module[val];\n });\n enableCapture(tracedModule, downstreamXRayEnabled, subsegmentCallback);\n return tracedModule;\n};\nfunction enableCapture(module, downstreamXRayEnabled, subsegmentCallback) {\n function captureOutgoingHTTPs(baseFunc, ...args) {\n let options;\n let callback;\n let hasUrl;\n let urlObj;\n let arg0 = args[0];\n if (typeof args[1] === 'object') {\n hasUrl = true;\n urlObj = typeof arg0 === 'string' ? new url.URL(arg0) : arg0;\n options = args[1],\n callback = args[2];\n }\n else {\n hasUrl = false;\n options = arg0;\n callback = args[1];\n }\n // Short circuit if the HTTP request has no options or is already being captured\n if (!options || (options.headers && (options.headers['X-Amzn-Trace-Id']))) {\n return baseFunc(...args);\n }\n // Case of calling a string URL without options, e.g.: http.request('http://amazon.com', callback)\n if (typeof options === 'string') {\n options = new url.URL(options);\n }\n if (!hasUrl) {\n urlObj = options;\n }\n const parent = contextUtils.resolveSegment(contextUtils.resolveManualSegmentParams(options));\n const hostname = options.hostname || options.host || urlObj.hostname || urlObj.host || 'Unknown host';\n if (!parent) {\n let output = '[ host: ' + hostname;\n output = options.method ? (output + ', method: ' + options.method) : output;\n output += ', path: ' + (urlObj.pathname || Utils.stripQueryStringFromPath(options.path)) + ' ]';\n if (!contextUtils.isAutomaticMode()) {\n logger.getLogger().info('Options for request ' + output +\n ' requires a segment object on the options params as \"XRaySegment\" for tracing in manual mode. Ignoring.');\n }\n else {\n logger.getLogger().info('Options for request ' + output +\n ' is missing the sub/segment context for automatic mode. Ignoring.');\n }\n // Options are not modified, only parsed for logging. We can pass in the original arguments.\n return baseFunc(...args);\n }\n let subsegment;\n if (parent.notTraced) {\n subsegment = parent.addNewSubsegmentWithoutSampling(hostname);\n }\n else {\n subsegment = parent.addNewSubsegment(hostname);\n }\n const root = parent.segment ? parent.segment : parent;\n subsegment.namespace = 'remote';\n if (!options.headers) {\n options.headers = {};\n }\n options.headers['X-Amzn-Trace-Id'] = 'Root=' + root.trace_id + ';Parent=' + subsegment.id +\n ';Sampled=' + (subsegment.notTraced ? '0' : '1');\n const errorCapturer = function errorCapturer(e) {\n if (subsegmentCallback) {\n subsegmentCallback(subsegment, this, null, e);\n }\n if (subsegment.http && subsegment.http.response) {\n if (Utils.getCauseTypeFromHttpStatus(subsegment.http.response.status) === 'error') {\n subsegment.addErrorFlag();\n }\n subsegment.close(e, true);\n }\n else {\n const madeItToDownstream = (e.code !== 'ECONNREFUSED');\n subsegment.addRemoteRequestData(this, null, madeItToDownstream && downstreamXRayEnabled);\n subsegment.close(e);\n }\n };\n const optionsCopy = Utils.objectWithoutProperties(options, ['Segment'], true);\n let req = baseFunc(...(hasUrl ? [arg0, optionsCopy] : [options]), function (res) {\n res.on('end', function () {\n if (subsegmentCallback) {\n subsegmentCallback(subsegment, this.req, res);\n }\n if (res.statusCode === 429) {\n subsegment.addThrottleFlag();\n }\n const cause = Utils.getCauseTypeFromHttpStatus(res.statusCode);\n if (cause) {\n subsegment[cause] = true;\n }\n subsegment.addRemoteRequestData(res.req, res, !!downstreamXRayEnabled);\n subsegment.close();\n });\n if (typeof callback === 'function') {\n if (contextUtils.isAutomaticMode()) {\n const session = contextUtils.getNamespace();\n session.run(function () {\n contextUtils.setSegment(subsegment);\n callback(res);\n });\n }\n else {\n callback(res);\n }\n // if no callback provided by user application, AND no explicit response listener\n // added by user application, then we consume the response so the 'end' event fires\n // See: https://nodejs.org/api/http.html#http_class_http_clientrequest\n }\n else if (res.req && res.req.listenerCount('response') === 0) {\n res.resume();\n }\n });\n // Use errorMonitor if available (in Node 12.17+), otherwise fall back to standard error listener\n // See: https://nodejs.org/dist/latest-v12.x/docs/api/events.html#events_eventemitter_errormonitor\n req.on(events.errorMonitor || 'error', errorCapturer);\n return req;\n }\n module.__request = module.request;\n function captureHTTPsRequest(...args) {\n return captureOutgoingHTTPs(module.__request, ...args);\n }\n module.__get = module.get;\n function captureHTTPsGet(...args) {\n return captureOutgoingHTTPs(module.__get, ...args);\n }\n Object.defineProperties(module, {\n request: { value: captureHTTPsRequest, configurable: true, enumerable: true, writable: true },\n get: { value: captureHTTPsGet, configurable: true, enumerable: true, writable: true },\n });\n}\nmodule.exports.captureHTTPsGlobal = captureHTTPsGlobal;\nmodule.exports.captureHTTPs = captureHTTPs;\n", "\"use strict\";\n/**\n * @module promise_p\n */\n/**\n * This module patches native Promise libraries provided by V8 engine\n * so all subsegments generated within Promise are attached to the correct parent.\n */\nconst contextUtils = require('../context_utils');\nconst originalThen = Symbol('original then');\nconst originalCatch = Symbol('original catch');\nfunction patchPromise(Promise) {\n const then = Promise.prototype.then;\n if (!then[originalThen]) {\n Promise.prototype.then = function (onFulfilled, onRejected) {\n if (contextUtils.isAutomaticMode()\n && tryGetCurrentSegment()) {\n const ns = contextUtils.getNamespace();\n onFulfilled = onFulfilled && ns.bind(onFulfilled);\n onRejected = onRejected && ns.bind(onRejected);\n }\n return then.call(this, onFulfilled, onRejected);\n };\n Promise.prototype.then[originalThen] = then;\n }\n const origCatch = Promise.prototype.catch;\n if (origCatch && !origCatch[originalCatch]) {\n Promise.prototype.catch = function (onRejected) {\n if (contextUtils.isAutomaticMode()\n && tryGetCurrentSegment()) {\n const ns = contextUtils.getNamespace();\n onRejected = onRejected && ns.bind(onRejected);\n }\n return origCatch.call(this, onRejected);\n };\n Promise.prototype.catch[originalCatch] = origCatch;\n }\n}\nfunction unpatchPromise(Promise) {\n const then = Promise.prototype.then;\n if (then[originalThen]) {\n Promise.prototype.then = then[originalThen];\n }\n const origCatch = Promise.prototype.catch;\n if (origCatch && origCatch[originalCatch]) {\n Promise.prototype.catch = origCatch[originalCatch];\n }\n}\nfunction tryGetCurrentSegment() {\n try {\n return contextUtils.getSegment();\n }\n catch (e) {\n return undefined;\n }\n}\nfunction capturePromise() {\n patchPromise(Promise);\n}\nfunction uncapturePromise() {\n unpatchPromise(Promise);\n}\ncapturePromise.patchThirdPartyPromise = patchPromise;\nmodule.exports.capturePromise = capturePromise;\nmodule.exports.uncapturePromise = uncapturePromise;\n", "\"use strict\";\n/**\n * Represents a SQL database call.\n * @constructor\n * @param {string} databaseVer - The version on the database (user supplied).\n * @param {string} driverVer - The version on the database driver (user supplied).\n * @param {string} user - The user associated to the database call.\n * @param {string} queryType - The SQL query type.\n */\nfunction SqlData(databaseVer, driverVer, user, url, queryType) {\n this.init(databaseVer, driverVer, user, url, queryType);\n}\nSqlData.prototype.init = function init(databaseVer, driverVer, user, url, queryType) {\n if (databaseVer) {\n this.database_version = databaseVer;\n }\n if (driverVer) {\n this.driver_version = driverVer;\n }\n if (queryType) {\n this.preparation = queryType;\n }\n this.url = url;\n this.user = user;\n};\nmodule.exports = SqlData;\n", "\"use strict\";\nvar contextUtils = require('./context_utils');\nvar logging = require('./logger');\nvar segmentUtils = require('./segments/segment_utils');\nvar utils = require('./utils');\nvar LambdaEnv = require('./env/aws_lambda');\n// Import Data from package.json,\n// If the importing of package.json fails leave\n// pkginfo as an empty object\nvar pkginfo = {};\ntry {\n pkginfo = require('../../package.json');\n}\ncatch (err) {\n logging.getLogger().debug('Failed to load SDK data:', err);\n}\nvar UNKNOWN = 'unknown';\n/**\n * A module representing the AWSXRay SDK.\n * @namespace AWSXRay\n */\nvar AWSXRay = {\n /**\n * @memberof AWSXRay\n * @type {object}\n * @namespace AWSXRay.plugins\n */\n plugins: {\n /**\n * Exposes the AWS EC2 plugin.\n * @memberof AWSXRay.plugins\n */\n EC2Plugin: require('./segments/plugins/ec2_plugin'),\n /**\n * Exposes the AWS ECS plugin.\n * @memberof AWSXRay.plugins\n */\n ECSPlugin: require('./segments/plugins/ecs_plugin'),\n /**\n * Exposes the AWS Elastic Beanstalk plugin.\n * @memberof AWSXRay.plugins\n */\n ElasticBeanstalkPlugin: require('./segments/plugins/elastic_beanstalk_plugin'),\n },\n /**\n * Enables use of plugins to capture additional data for segments.\n * @param {Array} plugins - A configurable subset of AWSXRay.plugins.\n * @memberof AWSXRay\n * @see AWSXRay.plugins\n */\n config: function (plugins) {\n var pluginData = {};\n plugins.forEach(function (plugin) {\n plugin.getData(function (data) {\n if (data) {\n for (var attribute in data) {\n pluginData[attribute] = data[attribute];\n }\n }\n });\n segmentUtils.setOrigin(plugin.originName);\n segmentUtils.setPluginData(pluginData);\n });\n },\n /**\n * Overrides the default whitelisting file to specify what params to capture on each AWS Service call.\n * If a service or API is not listed, no additional data is captured.\n * The base whitelisting file can be found at /lib/resources/aws_whitelist.json\n * @param {string|Object} source - The path to the custom whitelist file, or a whitelist source JSON object.\n * @memberof AWSXRay\n */\n setAWSWhitelist: require('./segments/attributes/aws').setAWSWhitelist,\n /**\n * Appends to the current whitelisting file.\n * In the case of a duplicate service API listed, the new source will override the previous values.\n * @param {string|Object} source - The path to the custom whitelist file, or a whitelist source JSON object.\n * @memberof AWSXRay\n */\n appendAWSWhitelist: require('./segments/attributes/aws').appendAWSWhitelist,\n /**\n * Overrides the default streaming threshold (100).\n * The threshold represents the maximum number of subsegments on a single segment before\n * the SDK begins to send the completed subsegments out of band of the main segment.\n * Reduce this threshold if you see the 'Segment too large to send' error.\n * @param {number} threshold - The new threshold to use.\n * @memberof AWSXRay\n */\n setStreamingThreshold: segmentUtils.setStreamingThreshold,\n /**\n * Set your own logger for the SDK.\n * @param {Object} logger - A logger which responds to debug/info/warn/error calls.\n * @memberof AWSXRay\n */\n setLogger: logging.setLogger,\n /**\n * Gets the set logger for the SDK.\n * @memberof AWSXRay\n */\n getLogger: logging.getLogger,\n /**\n * Configures the address and port the daemon is expected to be on.\n * @param {string} address - Address of the daemon the segments should be sent to. Expects 'x.x.x.x', ':yyyy' or 'x.x.x.x:yyyy' IPv4 formats.\n * @module DaemonConfig\n * @memberof AWSXRay\n * @function\n * @see module:DaemonConfig.setDaemonAddress\n */\n setDaemonAddress: require('./daemon_config').setDaemonAddress,\n /**\n * @param {string} name - The name of the new subsegment.\n * @param {function} fcn - The function conext to wrap.\n * @param {Segment|Subsegment} [parent] - The parent for the new subsegment, for manual mode.\n * @memberof AWSXRay\n * @function\n * @see module:capture.captureFunc\n */\n captureFunc: require('./capture').captureFunc,\n /**\n * @param {string} name - The name of the new subsegment.\n * @param {function} fcn - The function conext to wrap.\n * @param {Segment|Subsegment} [parent] - The parent for the new subsegment, for manual mode.\n * @memberof AWSXRay\n * @function\n * @see module:capture.captureAsyncFunc\n */\n captureAsyncFunc: require('./capture').captureAsyncFunc,\n /**\n * @param {string} name - The name of the new subsegment.\n * @param {function} fcn - The function conext to wrap.\n * @param {Segment|Subsegment} [parent] - The parent for the new subsegment, for manual mode.\n * @memberof AWSXRay\n * @function\n * @see module:capture.captureCallbackFunc\n */\n captureCallbackFunc: require('./capture').captureCallbackFunc,\n /**\n * @param {AWS} awssdk - The Javascript AWS SDK.\n * @memberof AWSXRay\n * @function\n * @see module:aws_p.captureAWS\n */\n captureAWS: require('./patchers/aws_p').captureAWS,\n /**\n * @param {AWS.Service} service - An instance of a AWS service to wrap.\n * @memberof AWSXRay\n * @function\n * @see module:aws_p.captureAWSClient\n */\n captureAWSClient: require('./patchers/aws_p').captureAWSClient,\n /**\n * @param {AWSv3.Service} service - An instance of a AWS SDK v3 service to wrap.\n * @param {Segment|Subsegment} segment - Optional segment for manual mode.\n * @memberof AWSXRay\n * @function\n * @see module:aws3_p.captureAWSClient\n */\n captureAWSv3Client: require('./patchers/aws3_p').captureAWSClient,\n /**\n * @param {http|https} module - The built in Node.js HTTP or HTTPS module.\n * @memberof AWSXRay\n * @function\n * @returns {http|https}\n * @see module:http_p.captureHTTPs\n */\n captureHTTPs: require('./patchers/http_p').captureHTTPs,\n /**\n * @param {http|https} module - The built in Node.js HTTP or HTTPS module.\n * @memberof AWSXRay\n * @function\n * @see module:http_p.captureHTTPsGlobal\n */\n captureHTTPsGlobal: require('./patchers/http_p').captureHTTPsGlobal,\n /**\n * @memberof AWSXRay\n * @function\n * @see module:promise_p.capturePromise\n */\n capturePromise: require('./patchers/promise_p').capturePromise,\n /**\n * Exposes various helper methods.\n * @memberof AWSXRay\n * @function\n * @see module:utils\n */\n utils: utils,\n /**\n * @memberof AWSXRay\n * @type {object}\n * @namespace AWSXRay.database\n */\n database: {\n /**\n * Exposes the SqlData class.\n * @memberof AWSXRay.database\n * @see SqlData\n */\n SqlData: require('./database/sql_data'),\n },\n /**\n * Exposes the Middleware Utils class.\n * @memberof AWSXRay\n * @function\n * @see module:mw_utils\n */\n middleware: require('./middleware/mw_utils'),\n /**\n * Gets the current namespace of the context.\n * Used for supporting functions that can be used in automatic mode.\n * @memberof AWSXRay\n * @function\n * @returns {Segment|Subsegment}\n * @see module:context_utils.getNamespace\n */\n getNamespace: contextUtils.getNamespace,\n /**\n * Resolves the current segment or subsegment, checks manual and automatic modes.\n * Used for supporting functions that can be used in both manual and automatic modes.\n * @memberof AWSXRay\n * @function\n * @returns {Segment|Subsegment}\n * @see module:context_utils.resolveSegment\n */\n resolveSegment: contextUtils.resolveSegment,\n /**\n * Returns the current segment or subsegment. For use with automatic mode only.\n * @memberof AWSXRay\n * @function\n * @returns {Segment|Subsegment}\n * @see module:context_utils.getSegment\n */\n getSegment: contextUtils.getSegment,\n /**\n * Sets the current segment or subsegment. For use with automatic mode only.\n * @memberof AWSXRay\n * @function\n * @see module:context_utils.setSegment\n */\n setSegment: contextUtils.setSegment,\n /**\n * Returns true if automatic mode is enabled, otherwise false.\n * @memberof AWSXRay\n * @function\n * @see module:context_utils.isAutomaticMode\n */\n isAutomaticMode: contextUtils.isAutomaticMode,\n /**\n * Enables automatic mode. Automatic mode uses 'cls-hooked'.\n * @see https://github.com/jeff-lewis/cls-hooked\n * @memberof AWSXRay\n * @function\n * @see module:context_utils.enableAutomaticMode\n */\n enableAutomaticMode: contextUtils.enableAutomaticMode,\n /**\n * Disables automatic mode. Current segment or subsegment must be passed manually\n * via the parent optional on captureFunc, captureAsyncFunc etc.\n * @memberof AWSXRay\n * @function\n * @see module:context_utils.enableManualMode\n */\n enableManualMode: contextUtils.enableManualMode,\n /**\n * Sets the context missing strategy.\n * @param {Object} strategy - The strategy to set. This object's contextMissing function will be called whenever trace context is not found.\n */\n setContextMissingStrategy: contextUtils.setContextMissingStrategy,\n /**\n * Exposes the segment class.\n * @memberof AWSXRay\n * @function\n */\n Segment: require('./segments/segment'),\n /**\n * Exposes the subsegment class.\n * @memberof AWSXRay\n * @see Subsegment\n */\n Subsegment: require('./segments/attributes/subsegment'),\n SegmentUtils: segmentUtils\n};\n/**\n * Exposes the IncomingRequestData, to capture incoming request data.\n * For use with middleware.\n * @memberof AWSXRay.middleware\n * @see IncomingRequestData\n */\nAWSXRay.middleware.IncomingRequestData = require('./middleware/incoming_request_data'),\n (function () {\n var data = {\n runtime: (process.release && process.release.name) ? process.release.name : UNKNOWN,\n runtime_version: process.version,\n version: process.env.npm_package_version || UNKNOWN,\n name: process.env.npm_package_name || UNKNOWN\n };\n var sdkData = {\n sdk: 'X-Ray for Node.js',\n sdk_version: pkginfo.version ? pkginfo.version : UNKNOWN,\n package: pkginfo.name ? pkginfo.name : UNKNOWN,\n };\n segmentUtils.setSDKData(sdkData);\n segmentUtils.setServiceData(data);\n if (process.env.LAMBDA_TASK_ROOT) {\n LambdaEnv.init();\n }\n })();\nmodule.exports = AWSXRay;\n", "\"use strict\";\n// Convenience file to require the SDK from the root of the repository\nmodule.exports = require('./aws-xray');\n", "import { Context } from 'aws-lambda';\nimport type * as AWS from 'aws-sdk';\nimport * as aws from '../shared/aws.lambda-shared';\nimport { requireEnv } from '../shared/env.lambda-shared';\n\nexport async function handler(event: unknown, context: Context): Promise<void> {\n const stateMachineArn = requireEnv('STATE_MACHINE_ARN');\n const queueUrl = requireEnv('QUEUE_URL');\n\n console.log(`Event: ${JSON.stringify(event, null, 2)}`);\n\n const sfn = aws.stepFunctions();\n\n for await (const message of messagesToRedrive(queueUrl)) {\n const input = JSON.parse(message.Body!);\n console.log(`Redriving message ${JSON.stringify(input, null, 2)}`);\n\n const { executionArn } = await sfn\n .startExecution({\n stateMachineArn: stateMachineArn,\n input: JSON.stringify({\n ...input,\n // Remove unnecessary fields that would bloat the input size\n $TaskExecution: undefined,\n catalogNeedsUpdating: undefined,\n docGen: undefined,\n docGenOutput: undefined,\n _error: undefined,\n error: undefined,\n // Add the redrive information\n _redrive: {\n lambdaRequestId: context.awsRequestId,\n lambdaLogGroupName: context.logGroupName,\n lambdaLogStreamName: context.logStreamName,\n },\n }),\n })\n .promise();\n console.log(`Redrive execution ARN: ${executionArn}`);\n\n await aws\n .sqs()\n .deleteMessage({\n QueueUrl: queueUrl,\n ReceiptHandle: message.ReceiptHandle!,\n })\n .promise();\n }\n}\n\nasync function* messagesToRedrive(queueUrl: string) {\n const sqs = aws.sqs();\n let result: AWS.SQS.ReceiveMessageResult;\n do {\n result = await sqs\n .receiveMessage({\n QueueUrl: queueUrl,\n VisibilityTimeout: 900, // 15 minutes\n })\n .promise();\n if (result.Messages) {\n yield* result.Messages;\n }\n } while (result.Messages != null && result.Messages.length > 0);\n}\n", "import * as _AWS from 'aws-sdk';\nimport * as AWSXRay from 'aws-xray-sdk-core';\n\n// Do nothing if there is no XRay trace context\nAWSXRay.setContextMissingStrategy(() => {});\n\nconst AWS = AWSXRay.captureAWS(_AWS);\n\nlet _s3: AWS.S3 | undefined;\nlet _sqs: AWS.SQS | undefined;\nlet _sfn: AWS.StepFunctions | undefined;\nlet _lambda: AWS.Lambda | undefined;\nlet _codeArtifact: AWS.CodeArtifact | undefined;\n\nexport function s3(): AWS.S3 {\n if (_s3 == null) {\n _s3 = new AWS.S3();\n }\n return _s3;\n}\n\n/**\n * Checks whether an object exists in S3 at the provided bucket and key.\n */\nexport function s3ObjectExists(bucket: string, key: string): Promise<boolean> {\n return s3()\n .headObject({\n Bucket: bucket,\n Key: key,\n })\n .promise()\n .then(\n () => true,\n (cause) => {\n if (cause.code === 'NotFound') {\n return false;\n }\n return Promise.reject(cause);\n }\n );\n}\n\nexport function sqs(): AWS.SQS {\n if (_sqs == null) {\n _sqs = new AWS.SQS();\n }\n return _sqs;\n}\n\nexport function stepFunctions(): AWS.StepFunctions {\n if (_sfn == null) {\n _sfn = new AWS.StepFunctions();\n }\n return _sfn;\n}\n\nexport function lambda(): AWS.Lambda {\n if (_lambda == null) {\n _lambda = new AWS.Lambda();\n }\n return _lambda;\n}\n\nexport function codeArtifact(): AWS.CodeArtifact {\n if (_codeArtifact == null) {\n _codeArtifact = new AWS.CodeArtifact();\n }\n return _codeArtifact;\n}\n\n/**\n * Resets all clients vended by this module. This is useful in unit tests when\n * `aws-sdk-mocks` is used, so that new mocks are injected as intended.\n */\nexport function reset(): void {\n _s3 = _sqs = _sfn = _lambda = _codeArtifact = undefined;\n}\n", "import { env } from 'process';\n\nexport function requireEnv(name: string): string {\n const result = env[name];\n if (!result) {\n throw new Error(\n `No value specified for required environment variable: ${name}`\n );\n }\n return result;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,2CAAAA,SAAA;AAAA;AAEA,aAAS,WAAY,UAAU;AAC7B,aAAO,OAAO,aAAa;AAAA,IAC7B;AAGA,QAAI,SAAS,QAAQ,MAAM,KAAK,OAAO;AAIvC,aAAS,eAAgB,KAAK,MAAM,OAAO;AACzC,UAAI,aAAa,CAAC,CAAC,IAAI,SAAS,IAAI,qBAAqB,IAAI;AAC7D,aAAO,eAAe,KAAK,MAAM;AAAA,QAC/B,cAAc;AAAA,QACd;AAAA,QACA,UAAU;AAAA,QACV;AAAA,MACF,CAAC;AAAA,IACH;AAGA,aAAS,QAAS,SAAS;AACzB,UAAI,WAAW,QAAQ,QAAQ;AAC7B,YAAI,CAAC,WAAW,QAAQ,MAAM;AAAG,iBAAO,4CAA4C;AAAA;AAC/E,mBAAS,QAAQ;AAAA,MACxB;AAAA,IACF;AAEA,aAAS,KAAM,QAAQ,MAAM,SAAS;AACpC,UAAI,CAAC,UAAU,CAAC,OAAO,OAAO;AAC5B,eAAO,0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module", "triggerId", "module", "module", "module", "module", "processAddress", "module", "module", "module", "j", "i", "patternChar", "module", "module", "module", "module", "module", "setContextMissingStrategy", "module", "getClientIp", "module", "module", "loadRulesConfig", "parseRulesConfig", "key", "module", "module", "module", "constructStatisticsDocs", "assembleRules", "assembleTargets", "isRuleValid", "dateToEpoch", "getOptions", "module", "isExpired", "module", "refresh", "refreshWithFirewall", "refreshCache", "getJitter", "module", "refreshWithFirewall", "refresh", "getCandidates", "getJitter", "module", "processMatchedRule", "module", "module", "facadeSegment", "module", "module", "module", "module", "module", "module", "setAWSWhitelist", "appendAWSWhitelist", "module", "captureFunc", "captureAsyncFunc", "captureCallbackFunc", "module", "i", "range", "comp", "module", "throttledErrorDefault", "captureAWS", "captureAWSClient", "req", "module", "captureHTTPsGlobal", "captureHTTPs", "errorCapturer", "module", "Promise", "module", "module", "AWSXRay", "module", "sqs"]
7
7
  }