{"version":3,"file":"operation.mjs","sources":["../../../@hive/sdk/dist/operation.mjs"],"sourcesContent":["//#region src/operation.ts\nvar Operation = class {\n\t/**\n\t* Unique identifier of the `Operation`.\n\t*/\n\tid;\n\t/**\n\t* Optionally, a predefined type of the `Operation` as used internally\n\t* by the `Hive` instance and its core components.\n\t*\n\t* Allows for grouping related events and filtering them.\n\t*/\n\ttype;\n\t/**\n\t* Optionally, a trace identifier for the `Operation`.\n\t*\n\t* Primarily used for tracing and filtering.\n\t*/\n\ttrace;\n\t/**\n\t* Timestamp of when the `Operation` started.\n\t*/\n\tstart;\n\t/**\n\t* Timestamp of when the `Operation` ended.\n\t*/\n\tend;\n\tconstructor(config) {\n\t\tthis.id = config?.id ?? crypto.randomUUID();\n\t\tthis.type = config?.type ?? null;\n\t\tthis.trace = config?.trace ?? null;\n\t\tthis.start = config?.start ?? performance.now();\n\t\tthis.end = config?.end ?? null;\n\t}\n\t/**\n\t* Duration of how long the `Operation` took to complete.\n\t*/\n\tget duration() {\n\t\treturn (this.end ?? performance.now()) - this.start;\n\t}\n\t/**\n\t* Serializes the `Operation` into a plain JSON-like object.\n\t*\n\t* @returns Object matching the `SerializedOperation` type.\n\t*/\n\tserialize = () => ({\n\t\tid: this.id,\n\t\ttype: this.type,\n\t\ttrace: this.trace,\n\t\tstart: this.start,\n\t\tend: this.end\n\t});\n};\n\n//#endregion\nexport { Operation };"],"names":[],"mappings":"AACA,IAAI,YAAY,MAAM;AAAA;AAAA;AAAA;AAAA,EAIrB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,KAAA;AAAA;AAAA;AAAA;AAAA,EAIA,KAAA;AAAA;AAAA;AAAA;AAAA,EAIA,GAAA;AAAA,EACA,YAAY,MAAA,EAAQ;AACnB,IAAA,IAAA,CAAK,EAAA,GAAK,MAAA,EAAQ,EAAA,IAAM,MAAA,CAAO,UAAA,EAAW;AAC1C,IAAA,IAAA,CAAK,IAAA,GAAO,QAAQ,IAAA,IAAQ,IAAA;AAC5B,IAAA,IAAA,CAAK,KAAA,GAAQ,QAAQ,KAAA,IAAS,IAAA;AAC9B,IAAA,IAAA,CAAK,KAAA,GAAQ,MAAA,EAAQ,KAAA,IAAS,WAAA,CAAY,GAAA,EAAI;AAC9C,IAAA,IAAA,CAAK,GAAA,GAAM,QAAQ,GAAA,IAAO,IAAA;AAAA,EAC3B;AAAA;AAAA;AAAA;AAAA,EAIA,IAAI,QAAA,GAAW;AACd,IAAA,OAAA,CAAQ,IAAA,CAAK,GAAA,IAAO,WAAA,CAAY,GAAA,MAAS,IAAA,CAAK,KAAA;AAAA,EAC/C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,YAAY,OAAO;AAAA,IAClB,IAAI,IAAA,CAAK,EAAA;AAAA,IACT,MAAM,IAAA,CAAK,IAAA;AAAA,IACX,OAAO,IAAA,CAAK,KAAA;AAAA,IACZ,OAAO,IAAA,CAAK,KAAA;AAAA,IACZ,KAAK,IAAA,CAAK;AAAA,GACX,CAAA;AACD;;;;"}