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AM,EAAgB,kBAChB,EAAS,OAAO,YAAY,OAAO,QAAQ,QAAQ,IAAgB,KAAI,EAAE,EAAM,KAAQ,CAAC,EAAM,QAAQ,OAC5G,OAAO,QAAU,IAAK,kBAAmB,SAC3C,CAAE,MAAO,GACP,MAAM,CACR","file":"/npm/@temporalio/core-bridge@1.13.1/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@temporalio/core-bridge@1.13.1/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","const { isPromise } = require('node:util/types');\nconst { getPrebuiltPath } = require('./common');\nconst typescriptExports = require('./lib/index');\nconst { convertFromNamedError } = require('./lib/errors');\n\n/**\n * Wraps calls to native functions to convert \"named errors\" to the correct error types.\n */\nfunction wrapErrors(fn) {\n  return (...args) => {\n    try {\n      let res = fn(...args);\n      if (isPromise(res)) {\n        return res.catch((e) => {\n          throw convertFromNamedError(e, false);\n        });\n      }\n      return res;\n    } catch (e) {\n      throw convertFromNamedError(e, true);\n    }\n  };\n}\nlet wrapper = (f) => wrapErrors(f);\n\n/**\n * Wraps calls to native functions to add tracing logs.\n *\n * To enable, set the `TEMPORAL_TRACE_NATIVE_CALLS` environment variable to `true`.\n *\n * IMPORTANT: This is meant for internal SDK debugging only.\n */\nif (process.env.TEMPORAL_TRACE_NATIVE_CALLS?.toLowerCase() === 'true') {\n  // Generate a random 5-character ID for the current \"execution\"\n  let execId = Math.random().toString(36).slice(-5);\n  let callSequence = 100000;\n\n  function log(callid, msg) {\n    console.log(`${new Date().toISOString()} [call-to-bridge] ${callid} ${msg}`);\n  }\n\n  // Do not trace these functions, they are way too verbose\n  const ignoreList = ['get_time_of_day'];\n\n  function wrapDebug(fn, fnname) {\n    // Functions names looks like `temporal_sdk_typescript_bridge::logs::get_time_of_day`\n    // Strip the path to retain only the function name\n    fnname = fnname.substring(fnname.lastIndexOf('::') + 2);\n    if (ignoreList.includes(fnname)) return fn;\n\n    return (...args) => {\n      let callid = `${execId}:${String(callSequence++).slice(-5)}`;\n\n      try {\n        log(callid, `${fnname}() - calling in`);\n\n        let res = fn(...args);\n\n        if (isPromise(res)) {\n          log(callid, `${fnname}() - received promise`);\n          return res.then(\n            (x) => {\n              log(callid, `${fnname}() - promise resolved`);\n              return x;\n            },\n            (e) => {\n              log(callid, `${fnname}() - promise rejected with ${e}`);\n              throw convertFromNamedError(e, false);\n            }\n          );\n        } else {\n          log(callid, `${fnname}() - returned`);\n        }\n\n        return res;\n      } catch (e) {\n        log(callid, `${fnname}() - threw an error ${e}`);\n        throw convertFromNamedError(e, true);\n      }\n    };\n  }\n\n  wrapper = (f) => wrapDebug(wrapErrors(f), f.name);\n}\n\ntry {\n  const nativeLibPath = getPrebuiltPath();\n  const native = Object.fromEntries(Object.entries(require(nativeLibPath)).map(([name, fn]) => [name, wrapper(fn)]));\n  module.exports = { ...typescriptExports, native };\n} catch (err) {\n  throw err;\n}\n"]}