{"version":3,"sources":["../../../src/instrumentation/helpers/create-span.ts"],"names":["createSpan","target","name","data","error","ctx","parent","id","startedAt","attributes","isEmpty","context","span_id","parent_id","status","code","SpanStatusCode","ERROR","OK","message","start_time","end_time","performance","now"],"mappings":";;;;;;;AA+BO,SAASA,UAAAA,CAAW,EACzBC,MAAAA,EACAC,IACAC,EAAAA,IAAAA,EACAC,OACAC,GACAC,EAAAA,MAAAA,EACAC,EACAC,EAAAA,SAAAA,EACgB,EAAA;AAChB,EAAO,OAAA;AACLN,IAAAA,IAAAA;IACAO,UAAY,EAAA;AACVR,MAAAA,MAAAA;AACAE,MAAAA,IAAAA,EAAMA,IAAQ,IAAA,CAACO,cAAQP,CAAAA,IAAAA,CAAQ,GAAA;QAAE,GAAGA;OAAS,GAAA,IAAA;AAC7CE,MAAAA,GAAAA,EAAKA,GAAO,IAAA,CAACK,cAAQL,CAAAA,GAAAA,CAAO,GAAA;QAAE,GAAGA;OAAQ,GAAA;AAC3C,KAAA;IACAM,OAAS,EAAA;MACPC,OAASL,EAAAA;AACX,KAAA;AACAM,IAAAA,SAAAA,EAAWP,MAAQC,EAAAA,EAAAA;IACnBO,MAAQ,EAAA;MACNC,IAAMX,EAAAA,KAAAA,GAAQY,kBAAeC,CAAAA,KAAAA,GAAQD,kBAAeE,CAAAA,EAAAA;AACpDC,MAAAA,OAAAA,EAASf,QAAQA,KAAQ,GAAA;AAC3B,KAAA;IACAgB,UAAYZ,EAAAA,SAAAA;AACZa,IAAAA,QAAAA,EAAUC,YAAYC,GAAG;AAC3B,GAAA;AACF;AA5BgBvB,MAAAA,CAAAA,UAAAA,EAAAA,YAAAA,CAAAA","file":"create-span.cjs","sourcesContent":["/**\n * Copyright 2025 IBM Corp.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { SpanStatusCode, TimeInput } from \"@opentelemetry/api\";\nimport { FrameworkSpan } from \"@/instrumentation/types.js\";\nimport { isEmpty } from \"remeda\";\n\ninterface CreateSpanProps {\n  id: string;\n  name: string;\n  target: string;\n  startedAt: TimeInput;\n  ctx?: any;\n  data?: any;\n  error?: string;\n  parent?: { id: string };\n}\n\nexport function createSpan({\n  target,\n  name,\n  data,\n  error,\n  ctx,\n  parent,\n  id,\n  startedAt,\n}: CreateSpanProps): FrameworkSpan {\n  return {\n    name: name,\n    attributes: {\n      target,\n      data: data && !isEmpty(data) ? { ...data } : null,\n      ctx: ctx && !isEmpty(ctx) ? { ...ctx } : null,\n    },\n    context: {\n      span_id: id,\n    },\n    parent_id: parent?.id,\n    status: {\n      code: error ? SpanStatusCode.ERROR : SpanStatusCode.OK,\n      message: error ? error : \"\",\n    },\n    start_time: startedAt,\n    end_time: performance.now(),\n  };\n}\n"]}