@opencode-ai/cli-linux-x64 0.0.0-beta-202606050000
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/chunk-01tb5qes.js.map +131 -0
- package/bin/chunk-06d8aa69.js.map +10 -0
- package/bin/chunk-07w2xsfy.js.map +50 -0
- package/bin/chunk-0azwkk9z.js.map +12 -0
- package/bin/chunk-0d9ja06r.js.map +9 -0
- package/bin/chunk-14kv2kjk.js.map +13 -0
- package/bin/chunk-17j53wgt.js.map +11 -0
- package/bin/chunk-191djt7z.js.map +113 -0
- package/bin/chunk-1brm44vt.js.map +10 -0
- package/bin/chunk-1jb1dn9p.js.map +10 -0
- package/bin/chunk-1paeax4j.js.map +56 -0
- package/bin/chunk-1wb39pye.js.map +9 -0
- package/bin/chunk-2mjmecen.js.map +10 -0
- package/bin/chunk-2wqpg9fb.js.map +10 -0
- package/bin/chunk-32ewzcjk.js.map +10 -0
- package/bin/chunk-334z6v35.js.map +9 -0
- package/bin/chunk-3jqjf0hd.js.map +10 -0
- package/bin/chunk-3n6vddyq.js.map +73 -0
- package/bin/chunk-3zmvhepw.js.map +10 -0
- package/bin/chunk-4980h0t7.js.map +37 -0
- package/bin/chunk-4q5k6a0e.js.map +10 -0
- package/bin/chunk-5ft9zwf9.js.map +10 -0
- package/bin/chunk-6ttpn29p.js.map +10 -0
- package/bin/chunk-7fvpf4bs.js.map +10 -0
- package/bin/chunk-7vb6kdat.js.map +10 -0
- package/bin/chunk-84amh6xf.js.map +11 -0
- package/bin/chunk-8akfq1ty.js.map +19 -0
- package/bin/chunk-8rd9r1gb.js.map +11 -0
- package/bin/chunk-8x80qvzn.js.map +10 -0
- package/bin/chunk-943th5qs.js.map +10 -0
- package/bin/chunk-94yf089p.js.map +10 -0
- package/bin/chunk-98cxndhz.js.map +9 -0
- package/bin/chunk-9f8tmby0.js.map +9 -0
- package/bin/chunk-9fbstsnw.js.map +9 -0
- package/bin/chunk-9hq8aywf.js.map +10 -0
- package/bin/chunk-9m7hf7ms.js.map +10 -0
- package/bin/chunk-9vf55fj3.js.map +10 -0
- package/bin/chunk-9w9rk9en.js.map +20 -0
- package/bin/chunk-9y4hgfns.js.map +10 -0
- package/bin/chunk-aag5p1fp.js.map +10 -0
- package/bin/chunk-axy1v6wd.js.map +27 -0
- package/bin/chunk-bj9msmj2.js.map +10 -0
- package/bin/chunk-bt0r89ee.js.map +9 -0
- package/bin/chunk-c2gsyspz.js.map +10 -0
- package/bin/chunk-c8hr0q5n.js.map +10 -0
- package/bin/chunk-cab6ccj0.js.map +10 -0
- package/bin/chunk-ck4nkjtx.js.map +193 -0
- package/bin/chunk-cvm4kr56.js.map +23 -0
- package/bin/chunk-cyb9bpgm.js.map +10 -0
- package/bin/chunk-d1p8awq6.js.map +10 -0
- package/bin/chunk-d6nz1m6v.js.map +10 -0
- package/bin/chunk-d9g5798m.js.map +81 -0
- package/bin/chunk-dcn0azxw.js.map +10 -0
- package/bin/chunk-dd9pfwmr.js.map +10 -0
- package/bin/chunk-dk4qekzk.js.map +10 -0
- package/bin/chunk-dk9tgwkh.js.map +9 -0
- package/bin/chunk-dzzhxh1c.js.map +10 -0
- package/bin/chunk-efsmps94.js.map +9 -0
- package/bin/chunk-fdw7znt6.js.map +11 -0
- package/bin/chunk-fs6t8jdg.js.map +10 -0
- package/bin/chunk-fzcqzwx5.js.map +10 -0
- package/bin/chunk-g4fcmhkj.js.map +11 -0
- package/bin/chunk-g4ff66n8.js.map +10 -0
- package/bin/chunk-g8mpn6ke.js.map +11 -0
- package/bin/chunk-gahs293a.js.map +10 -0
- package/bin/chunk-gh9dcqbv.js.map +10 -0
- package/bin/chunk-grvxd8zq.js.map +10 -0
- package/bin/chunk-gv6nagng.js.map +10 -0
- package/bin/chunk-h1vz14ze.js.map +167 -0
- package/bin/chunk-hav16yge.js.map +10 -0
- package/bin/chunk-hp5nnq6f.js.map +11 -0
- package/bin/chunk-hrcbafh3.js.map +9 -0
- package/bin/chunk-hxfsfpek.js.map +10 -0
- package/bin/chunk-jcqp2wmf.js.map +10 -0
- package/bin/chunk-jt9t8203.js.map +9 -0
- package/bin/chunk-k0980eb5.js.map +10 -0
- package/bin/chunk-kghptcgb.js.map +9 -0
- package/bin/chunk-kkvk5eez.js.map +10 -0
- package/bin/chunk-kv0b3sh5.js.map +10 -0
- package/bin/chunk-kvfs5rat.js.map +10 -0
- package/bin/chunk-mf0qqhvb.js.map +10 -0
- package/bin/chunk-mkze6twx.js.map +10 -0
- package/bin/chunk-mzjs3qj3.js.map +10 -0
- package/bin/chunk-n10mj2m3.js.map +17 -0
- package/bin/chunk-n2fbt143.js.map +9 -0
- package/bin/chunk-n6a0rctn.js.map +9 -0
- package/bin/chunk-nd3yv9bg.js.map +388 -0
- package/bin/chunk-njn9a3jp.js.map +13 -0
- package/bin/chunk-nkhzpsnk.js.map +13 -0
- package/bin/chunk-ny5cyeha.js.map +10 -0
- package/bin/chunk-p3nkd9t2.js.map +10 -0
- package/bin/chunk-p3pr1t3k.js.map +10 -0
- package/bin/chunk-p7j7e7hb.js.map +10 -0
- package/bin/chunk-p89bk96c.js.map +10 -0
- package/bin/chunk-pnkd37ss.js.map +20 -0
- package/bin/chunk-prat77ba.js.map +577 -0
- package/bin/chunk-q6nf6fka.js.map +10 -0
- package/bin/chunk-qbpebjh2.js.map +10 -0
- package/bin/chunk-qzx2gre7.js.map +13 -0
- package/bin/chunk-r55kafff.js.map +9 -0
- package/bin/chunk-rrwp4x01.js.map +10 -0
- package/bin/chunk-rt02k446.js.map +11 -0
- package/bin/chunk-s39nwv01.js.map +9 -0
- package/bin/chunk-s983v0dp.js.map +10 -0
- package/bin/chunk-san15sca.js.map +10 -0
- package/bin/chunk-sfk73pp2.js.map +10 -0
- package/bin/chunk-sjd3wbjd.js.map +10 -0
- package/bin/chunk-swbdmja3.js.map +10 -0
- package/bin/chunk-tc8tvjey.js.map +33 -0
- package/bin/chunk-tcqtz83b.js.map +10 -0
- package/bin/chunk-tgxxchfy.js.map +28 -0
- package/bin/chunk-tvxakxv2.js.map +10 -0
- package/bin/chunk-v81ta3tx.js.map +15 -0
- package/bin/chunk-va2h4xya.js.map +37 -0
- package/bin/chunk-vezq3hc4.js.map +9 -0
- package/bin/chunk-vmbpvmpg.js.map +10 -0
- package/bin/chunk-w7p62pb6.js.map +17 -0
- package/bin/chunk-wr4x72qd.js.map +13 -0
- package/bin/chunk-x3ywttp7.js.map +10 -0
- package/bin/chunk-x988wmrk.js.map +10 -0
- package/bin/chunk-x9zjg1f7.js.map +20 -0
- package/bin/chunk-xaqrhtz6.js.map +10 -0
- package/bin/chunk-xd2mrkwy.js.map +10 -0
- package/bin/chunk-xfh2377b.js.map +10 -0
- package/bin/chunk-xs0ras4j.js.map +51 -0
- package/bin/chunk-xt7ap9fb.js.map +10 -0
- package/bin/chunk-xya5qk3h.js.map +16 -0
- package/bin/chunk-yg7w4jgd.js.map +10 -0
- package/bin/chunk-yhpv46tb.js.map +20 -0
- package/bin/chunk-ymy66kr8.js.map +15 -0
- package/bin/chunk-yx4z6xsb.js.map +11 -0
- package/bin/chunk-yymwxqpy.js.map +10 -0
- package/bin/chunk-z70c75xe.js.map +11 -0
- package/bin/chunk-zkqyr3hc.js.map +10 -0
- package/bin/index.js.map +12 -0
- package/bin/lildax +0 -0
- package/package.json +15 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../core/src/database/migration/20260428004200_add_session_path.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { Effect } from \"effect\"\nimport type { DatabaseMigration } from \"../migration\"\n\nexport default {\n id: \"20260428004200_add_session_path\",\n up(tx) {\n return Effect.gen(function* () {\n yield* tx.run(`ALTER TABLE \\`session\\` ADD \\`path\\` text;`)\n })\n },\n} satisfies DatabaseMigration.Migration\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";wHAGA,SAAe,QACb,GAAI,kCACJ,EAAE,CAAC,EAAI,CACL,OAAO,EAAO,IAAI,SAAU,EAAG,CAC7B,MAAO,EAAG,IAAI,wCAA4C,EAC3D,EAEL",
|
|
8
|
+
"debugId": "353AC1FD975A97E164756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../node_modules/.bun/@opentelemetry+sdk-trace-node@2.6.1+460773ef8ff1e07c/node_modules/@opentelemetry/sdk-trace-node/build/src/NodeTracerProvider.js", "../../node_modules/.bun/@opentelemetry+sdk-trace-node@2.6.1+460773ef8ff1e07c/node_modules/@opentelemetry/sdk-trace-node/build/src/index.js", "../../node_modules/.bun/@effect+opentelemetry@4.0.0-beta.74+216b5fc669d139f4/node_modules/@effect/opentelemetry/dist/NodeSdk.js", "../../node_modules/.bun/@effect+opentelemetry@4.0.0-beta.74+216b5fc669d139f4/node_modules/@effect/opentelemetry/dist/internal/utilities.js", "../../node_modules/.bun/@opentelemetry+api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/esm/types/LogRecord.js", "../../node_modules/.bun/@opentelemetry+api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/esm/NoopLogger.js", "../../node_modules/.bun/@opentelemetry+api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/esm/internal/global-utils.js", "../../node_modules/.bun/@opentelemetry+api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/esm/NoopLoggerProvider.js", "../../node_modules/.bun/@opentelemetry+api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/esm/ProxyLogger.js", "../../node_modules/.bun/@opentelemetry+api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/esm/ProxyLoggerProvider.js", "../../node_modules/.bun/@opentelemetry+api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/esm/api/logs.js", "../../node_modules/.bun/@opentelemetry+api-logs@0.214.0/node_modules/@opentelemetry/api-logs/build/esm/index.js", "../../node_modules/.bun/@opentelemetry+sdk-logs@0.214.0+460773ef8ff1e07c/node_modules/@opentelemetry/sdk-logs/build/esm/LoggerProvider.js", "../../node_modules/.bun/@opentelemetry+sdk-logs@0.214.0+460773ef8ff1e07c/node_modules/@opentelemetry/sdk-logs/build/esm/Logger.js", "../../node_modules/.bun/@opentelemetry+sdk-logs@0.214.0+460773ef8ff1e07c/node_modules/@opentelemetry/sdk-logs/build/esm/LogRecordImpl.js", "../../node_modules/.bun/@opentelemetry+sdk-logs@0.214.0+460773ef8ff1e07c/node_modules/@opentelemetry/sdk-logs/build/esm/utils/validation.js", "../../node_modules/.bun/@opentelemetry+sdk-logs@0.214.0+460773ef8ff1e07c/node_modules/@opentelemetry/sdk-logs/build/esm/export/NoopLogRecordProcessor.js", "../../node_modules/.bun/@opentelemetry+sdk-logs@0.214.0+460773ef8ff1e07c/node_modules/@opentelemetry/sdk-logs/build/esm/MultiLogRecordProcessor.js", "../../node_modules/.bun/@opentelemetry+sdk-logs@0.214.0+460773ef8ff1e07c/node_modules/@opentelemetry/sdk-logs/build/esm/internal/utils.js", "../../node_modules/.bun/@opentelemetry+sdk-logs@0.214.0+460773ef8ff1e07c/node_modules/@opentelemetry/sdk-logs/build/esm/internal/LoggerProviderSharedState.js", "../../node_modules/.bun/@effect+opentelemetry@4.0.0-beta.74+216b5fc669d139f4/node_modules/@effect/opentelemetry/dist/internal/attributes.js", "../../node_modules/.bun/@effect+opentelemetry@4.0.0-beta.74+216b5fc669d139f4/node_modules/@effect/opentelemetry/dist/Resource.js", "../../node_modules/.bun/@effect+opentelemetry@4.0.0-beta.74+216b5fc669d139f4/node_modules/@effect/opentelemetry/dist/Logger.js", "../../node_modules/.bun/@effect+opentelemetry@4.0.0-beta.74+216b5fc669d139f4/node_modules/@effect/opentelemetry/dist/internal/metrics.js", "../../node_modules/.bun/@opentelemetry+sdk-metrics@2.6.1+460773ef8ff1e07c/node_modules/@opentelemetry/sdk-metrics/build/esm/export/AggregationTemporality.js", "../../node_modules/.bun/@opentelemetry+sdk-metrics@2.6.1+460773ef8ff1e07c/node_modules/@opentelemetry/sdk-metrics/build/esm/export/MetricData.js", "../../node_modules/.bun/@effect+opentelemetry@4.0.0-beta.74+216b5fc669d139f4/node_modules/@effect/opentelemetry/dist/Metrics.js", "../../node_modules/.bun/@effect+opentelemetry@4.0.0-beta.74+216b5fc669d139f4/node_modules/@effect/opentelemetry/dist/Tracer.js"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.NodeTracerProvider = void 0;\n/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nconst context_async_hooks_1 = require(\"@opentelemetry/context-async-hooks\");\nconst sdk_trace_base_1 = require(\"@opentelemetry/sdk-trace-base\");\nconst api_1 = require(\"@opentelemetry/api\");\nconst core_1 = require(\"@opentelemetry/core\");\nfunction setupContextManager(contextManager) {\n // null means 'do not register'\n if (contextManager === null) {\n return;\n }\n // undefined means 'register default'\n if (contextManager === undefined) {\n const defaultContextManager = new context_async_hooks_1.AsyncLocalStorageContextManager();\n defaultContextManager.enable();\n api_1.context.setGlobalContextManager(defaultContextManager);\n return;\n }\n contextManager.enable();\n api_1.context.setGlobalContextManager(contextManager);\n}\nfunction setupPropagator(propagator) {\n // null means 'do not register'\n if (propagator === null) {\n return;\n }\n // undefined means 'register default'\n if (propagator === undefined) {\n api_1.propagation.setGlobalPropagator(new core_1.CompositePropagator({\n propagators: [\n new core_1.W3CTraceContextPropagator(),\n new core_1.W3CBaggagePropagator(),\n ],\n }));\n return;\n }\n api_1.propagation.setGlobalPropagator(propagator);\n}\n/**\n * Register this TracerProvider for use with the OpenTelemetry API.\n * Undefined values may be replaced with defaults, and\n * null values will be skipped.\n *\n * @param config Configuration object for SDK registration\n */\nclass NodeTracerProvider extends sdk_trace_base_1.BasicTracerProvider {\n constructor(config = {}) {\n super(config);\n }\n /**\n * Register this TracerProvider for use with the OpenTelemetry API.\n * Undefined values may be replaced with defaults, and\n * null values will be skipped.\n *\n * @param config Configuration object for SDK registration\n */\n register(config = {}) {\n api_1.trace.setGlobalTracerProvider(this);\n setupContextManager(config.contextManager);\n setupPropagator(config.propagator);\n }\n}\nexports.NodeTracerProvider = NodeTracerProvider;\n//# sourceMappingURL=NodeTracerProvider.js.map",
|
|
6
|
+
"\"use strict\";\n/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.TraceIdRatioBasedSampler = exports.SimpleSpanProcessor = exports.SamplingDecision = exports.RandomIdGenerator = exports.ParentBasedSampler = exports.NoopSpanProcessor = exports.InMemorySpanExporter = exports.ConsoleSpanExporter = exports.BatchSpanProcessor = exports.BasicTracerProvider = exports.AlwaysOnSampler = exports.AlwaysOffSampler = exports.NodeTracerProvider = void 0;\nvar NodeTracerProvider_1 = require(\"./NodeTracerProvider\");\nObject.defineProperty(exports, \"NodeTracerProvider\", { enumerable: true, get: function () { return NodeTracerProvider_1.NodeTracerProvider; } });\nvar sdk_trace_base_1 = require(\"@opentelemetry/sdk-trace-base\");\nObject.defineProperty(exports, \"AlwaysOffSampler\", { enumerable: true, get: function () { return sdk_trace_base_1.AlwaysOffSampler; } });\nObject.defineProperty(exports, \"AlwaysOnSampler\", { enumerable: true, get: function () { return sdk_trace_base_1.AlwaysOnSampler; } });\nObject.defineProperty(exports, \"BasicTracerProvider\", { enumerable: true, get: function () { return sdk_trace_base_1.BasicTracerProvider; } });\nObject.defineProperty(exports, \"BatchSpanProcessor\", { enumerable: true, get: function () { return sdk_trace_base_1.BatchSpanProcessor; } });\nObject.defineProperty(exports, \"ConsoleSpanExporter\", { enumerable: true, get: function () { return sdk_trace_base_1.ConsoleSpanExporter; } });\nObject.defineProperty(exports, \"InMemorySpanExporter\", { enumerable: true, get: function () { return sdk_trace_base_1.InMemorySpanExporter; } });\nObject.defineProperty(exports, \"NoopSpanProcessor\", { enumerable: true, get: function () { return sdk_trace_base_1.NoopSpanProcessor; } });\nObject.defineProperty(exports, \"ParentBasedSampler\", { enumerable: true, get: function () { return sdk_trace_base_1.ParentBasedSampler; } });\nObject.defineProperty(exports, \"RandomIdGenerator\", { enumerable: true, get: function () { return sdk_trace_base_1.RandomIdGenerator; } });\nObject.defineProperty(exports, \"SamplingDecision\", { enumerable: true, get: function () { return sdk_trace_base_1.SamplingDecision; } });\nObject.defineProperty(exports, \"SimpleSpanProcessor\", { enumerable: true, get: function () { return sdk_trace_base_1.SimpleSpanProcessor; } });\nObject.defineProperty(exports, \"TraceIdRatioBasedSampler\", { enumerable: true, get: function () { return sdk_trace_base_1.TraceIdRatioBasedSampler; } });\n//# sourceMappingURL=index.js.map",
|
|
7
|
+
"import { NodeTracerProvider } from \"@opentelemetry/sdk-trace-node\";\nimport * as Effect from \"effect/Effect\";\nimport { constant } from \"effect/Function\";\nimport * as Layer from \"effect/Layer\";\nimport { isNonEmpty } from \"./internal/utilities.js\";\nimport * as Logger from \"./Logger.js\";\nimport * as Metrics from \"./Metrics.js\";\nimport * as Resource from \"./Resource.js\";\nimport * as Tracer from \"./Tracer.js\";\n/**\n * Creates a scoped Node OpenTelemetry tracer provider from one or more span processors and shuts it down when the layer is released.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerTracerProvider = (processor, config) => Layer.effect(Tracer.OtelTracerProvider, Effect.gen(function* () {\n const resource = yield* Resource.Resource;\n return yield* Effect.acquireRelease(Effect.sync(() => {\n const provider = new NodeTracerProvider({\n ...(config ?? undefined),\n resource,\n spanProcessors: Array.isArray(processor) ? processor : [processor]\n });\n return provider;\n }), provider => Effect.promise(() => provider.forceFlush().then(() => provider.shutdown())).pipe(Effect.ignore, Effect.interruptible, Effect.timeoutOption(config?.shutdownTimeout ?? 3000)));\n}));\n/**\n * Creates a Node OpenTelemetry layer from configuration, enabling tracing, metrics, and logging only when their processors or readers are supplied.\n *\n * **When to use**\n *\n * Use to install OpenTelemetry support for a Node.js Effect application from\n * one configuration object, enabling tracing, metrics, logging, or any\n * combination of those signals based on the processors and readers supplied.\n *\n * **Details**\n *\n * The configuration can be provided lazily or effectfully. The layer always\n * provides `Resource.Resource`, building it from environment variables and any\n * explicit resource metadata in the configuration.\n *\n * **Gotchas**\n *\n * Register Node auto-instrumentations before importing modules that should be\n * patched, because many Node instrumentations hook module loading.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = evaluate => Layer.unwrap(Effect.gen(function* () {\n const config = yield* Effect.isEffect(evaluate) ? evaluate : Effect.sync(evaluate);\n const ResourceLive = Resource.layerFromEnv(config.resource && Resource.configToAttributes(config.resource));\n const TracerLive = isNonEmpty(config.spanProcessor) ? Layer.provide(Tracer.layer, layerTracerProvider(config.spanProcessor, {\n ...config.tracerConfig,\n shutdownTimeout: config.shutdownTimeout\n })) : Layer.empty;\n const MetricsLive = isNonEmpty(config.metricReader) ? Metrics.layer(constant(config.metricReader), {\n shutdownTimeout: config.shutdownTimeout,\n temporality: config.metricTemporality\n }) : Layer.empty;\n const LoggerLive = isNonEmpty(config.logRecordProcessor) ? Layer.provide(Logger.layer({\n mergeWithExisting: config.loggerMergeWithExisting\n }), Logger.layerLoggerProvider(config.logRecordProcessor, {\n ...config.loggerProviderConfig,\n shutdownTimeout: config.shutdownTimeout\n })) : Layer.empty;\n return Layer.mergeAll(TracerLive, MetricsLive, LoggerLive).pipe(Layer.provideMerge(ResourceLive));\n}));\n/**\n * Layer that provides an empty OpenTelemetry `Resource`.\n *\n * @category layers\n * @since 2.0.0\n */\nexport const layerEmpty = Resource.layerEmpty;\n//# sourceMappingURL=NodeSdk.js.map",
|
|
8
|
+
"/** @internal */\nexport const isNonEmpty = a => a !== undefined && !(Array.isArray(a) && a.length === 0);\n//# sourceMappingURL=utilities.js.map",
|
|
9
|
+
"/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport var SeverityNumber;\n(function (SeverityNumber) {\n SeverityNumber[SeverityNumber[\"UNSPECIFIED\"] = 0] = \"UNSPECIFIED\";\n SeverityNumber[SeverityNumber[\"TRACE\"] = 1] = \"TRACE\";\n SeverityNumber[SeverityNumber[\"TRACE2\"] = 2] = \"TRACE2\";\n SeverityNumber[SeverityNumber[\"TRACE3\"] = 3] = \"TRACE3\";\n SeverityNumber[SeverityNumber[\"TRACE4\"] = 4] = \"TRACE4\";\n SeverityNumber[SeverityNumber[\"DEBUG\"] = 5] = \"DEBUG\";\n SeverityNumber[SeverityNumber[\"DEBUG2\"] = 6] = \"DEBUG2\";\n SeverityNumber[SeverityNumber[\"DEBUG3\"] = 7] = \"DEBUG3\";\n SeverityNumber[SeverityNumber[\"DEBUG4\"] = 8] = \"DEBUG4\";\n SeverityNumber[SeverityNumber[\"INFO\"] = 9] = \"INFO\";\n SeverityNumber[SeverityNumber[\"INFO2\"] = 10] = \"INFO2\";\n SeverityNumber[SeverityNumber[\"INFO3\"] = 11] = \"INFO3\";\n SeverityNumber[SeverityNumber[\"INFO4\"] = 12] = \"INFO4\";\n SeverityNumber[SeverityNumber[\"WARN\"] = 13] = \"WARN\";\n SeverityNumber[SeverityNumber[\"WARN2\"] = 14] = \"WARN2\";\n SeverityNumber[SeverityNumber[\"WARN3\"] = 15] = \"WARN3\";\n SeverityNumber[SeverityNumber[\"WARN4\"] = 16] = \"WARN4\";\n SeverityNumber[SeverityNumber[\"ERROR\"] = 17] = \"ERROR\";\n SeverityNumber[SeverityNumber[\"ERROR2\"] = 18] = \"ERROR2\";\n SeverityNumber[SeverityNumber[\"ERROR3\"] = 19] = \"ERROR3\";\n SeverityNumber[SeverityNumber[\"ERROR4\"] = 20] = \"ERROR4\";\n SeverityNumber[SeverityNumber[\"FATAL\"] = 21] = \"FATAL\";\n SeverityNumber[SeverityNumber[\"FATAL2\"] = 22] = \"FATAL2\";\n SeverityNumber[SeverityNumber[\"FATAL3\"] = 23] = \"FATAL3\";\n SeverityNumber[SeverityNumber[\"FATAL4\"] = 24] = \"FATAL4\";\n})(SeverityNumber || (SeverityNumber = {}));\n//# sourceMappingURL=LogRecord.js.map",
|
|
10
|
+
"/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport class NoopLogger {\n emit(_logRecord) { }\n}\nexport const NOOP_LOGGER = new NoopLogger();\n//# sourceMappingURL=NoopLogger.js.map",
|
|
11
|
+
"/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport const GLOBAL_LOGS_API_KEY = Symbol.for('io.opentelemetry.js.api.logs');\nexport const _global = globalThis;\n/**\n * Make a function which accepts a version integer and returns the instance of an API if the version\n * is compatible, or a fallback version (usually NOOP) if it is not.\n *\n * @param requiredVersion Backwards compatibility version which is required to return the instance\n * @param instance Instance which should be returned if the required version is compatible\n * @param fallback Fallback instance, usually NOOP, which will be returned if the required version is not compatible\n */\nexport function makeGetter(requiredVersion, instance, fallback) {\n return (version) => version === requiredVersion ? instance : fallback;\n}\n/**\n * A number which should be incremented each time a backwards incompatible\n * change is made to the API. This number is used when an API package\n * attempts to access the global API to ensure it is getting a compatible\n * version. If the global API is not compatible with the API package\n * attempting to get it, a NOOP API implementation will be returned.\n */\nexport const API_BACKWARDS_COMPATIBILITY_VERSION = 1;\n//# sourceMappingURL=global-utils.js.map",
|
|
12
|
+
"/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { NoopLogger } from './NoopLogger';\nexport class NoopLoggerProvider {\n getLogger(_name, _version, _options) {\n return new NoopLogger();\n }\n}\nexport const NOOP_LOGGER_PROVIDER = new NoopLoggerProvider();\n//# sourceMappingURL=NoopLoggerProvider.js.map",
|
|
13
|
+
"/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { NOOP_LOGGER } from './NoopLogger';\nexport class ProxyLogger {\n constructor(provider, name, version, options) {\n this._provider = provider;\n this.name = name;\n this.version = version;\n this.options = options;\n }\n /**\n * Emit a log record. This method should only be used by log appenders.\n *\n * @param logRecord\n */\n emit(logRecord) {\n this._getLogger().emit(logRecord);\n }\n /**\n * Try to get a logger from the proxy logger provider.\n * If the proxy logger provider has no delegate, return a noop logger.\n */\n _getLogger() {\n if (this._delegate) {\n return this._delegate;\n }\n const logger = this._provider._getDelegateLogger(this.name, this.version, this.options);\n if (!logger) {\n return NOOP_LOGGER;\n }\n this._delegate = logger;\n return this._delegate;\n }\n}\n//# sourceMappingURL=ProxyLogger.js.map",
|
|
14
|
+
"/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { NOOP_LOGGER_PROVIDER } from './NoopLoggerProvider';\nimport { ProxyLogger } from './ProxyLogger';\nexport class ProxyLoggerProvider {\n getLogger(name, version, options) {\n var _a;\n return ((_a = this._getDelegateLogger(name, version, options)) !== null && _a !== void 0 ? _a : new ProxyLogger(this, name, version, options));\n }\n /**\n * Get the delegate logger provider.\n * Used by tests only.\n * @internal\n */\n _getDelegate() {\n var _a;\n return (_a = this._delegate) !== null && _a !== void 0 ? _a : NOOP_LOGGER_PROVIDER;\n }\n /**\n * Set the delegate logger provider\n * @internal\n */\n _setDelegate(delegate) {\n this._delegate = delegate;\n }\n /**\n * @internal\n */\n _getDelegateLogger(name, version, options) {\n var _a;\n return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getLogger(name, version, options);\n }\n}\n//# sourceMappingURL=ProxyLoggerProvider.js.map",
|
|
15
|
+
"/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { API_BACKWARDS_COMPATIBILITY_VERSION, GLOBAL_LOGS_API_KEY, _global, makeGetter, } from '../internal/global-utils';\nimport { NOOP_LOGGER_PROVIDER } from '../NoopLoggerProvider';\nimport { ProxyLoggerProvider } from '../ProxyLoggerProvider';\nexport class LogsAPI {\n constructor() {\n this._proxyLoggerProvider = new ProxyLoggerProvider();\n }\n static getInstance() {\n if (!this._instance) {\n this._instance = new LogsAPI();\n }\n return this._instance;\n }\n setGlobalLoggerProvider(provider) {\n if (_global[GLOBAL_LOGS_API_KEY]) {\n return this.getLoggerProvider();\n }\n _global[GLOBAL_LOGS_API_KEY] = makeGetter(API_BACKWARDS_COMPATIBILITY_VERSION, provider, NOOP_LOGGER_PROVIDER);\n this._proxyLoggerProvider._setDelegate(provider);\n return provider;\n }\n /**\n * Returns the global logger provider.\n *\n * @returns LoggerProvider\n */\n getLoggerProvider() {\n var _a, _b;\n return ((_b = (_a = _global[GLOBAL_LOGS_API_KEY]) === null || _a === void 0 ? void 0 : _a.call(_global, API_BACKWARDS_COMPATIBILITY_VERSION)) !== null && _b !== void 0 ? _b : this._proxyLoggerProvider);\n }\n /**\n * Returns a logger from the global logger provider.\n *\n * @returns Logger\n */\n getLogger(name, version, options) {\n return this.getLoggerProvider().getLogger(name, version, options);\n }\n /** Remove the global logger provider */\n disable() {\n delete _global[GLOBAL_LOGS_API_KEY];\n this._proxyLoggerProvider = new ProxyLoggerProvider();\n }\n}\n//# sourceMappingURL=logs.js.map",
|
|
16
|
+
"/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport { SeverityNumber } from './types/LogRecord';\nexport { NOOP_LOGGER, NoopLogger } from './NoopLogger';\nimport { LogsAPI } from './api/logs';\nexport const logs = LogsAPI.getInstance();\n//# sourceMappingURL=index.js.map",
|
|
17
|
+
"/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { diag } from '@opentelemetry/api';\nimport { NOOP_LOGGER } from '@opentelemetry/api-logs';\nimport { defaultResource } from '@opentelemetry/resources';\nimport { BindOnceFuture } from '@opentelemetry/core';\nimport { Logger } from './Logger';\nimport { DEFAULT_LOGGER_CONFIGURATOR, LoggerProviderSharedState, } from './internal/LoggerProviderSharedState';\nexport const DEFAULT_LOGGER_NAME = 'unknown';\nexport class LoggerProvider {\n _shutdownOnce;\n _sharedState;\n constructor(config = {}) {\n const mergedConfig = {\n resource: config.resource ?? defaultResource(),\n forceFlushTimeoutMillis: config.forceFlushTimeoutMillis ?? 30000,\n logRecordLimits: {\n attributeCountLimit: config.logRecordLimits?.attributeCountLimit ?? 128,\n attributeValueLengthLimit: config.logRecordLimits?.attributeValueLengthLimit ?? Infinity,\n },\n loggerConfigurator: config.loggerConfigurator ?? DEFAULT_LOGGER_CONFIGURATOR,\n processors: config.processors ?? [],\n };\n this._sharedState = new LoggerProviderSharedState(mergedConfig.resource, mergedConfig.forceFlushTimeoutMillis, mergedConfig.logRecordLimits, mergedConfig.processors, mergedConfig.loggerConfigurator);\n this._shutdownOnce = new BindOnceFuture(this._shutdown, this);\n }\n /**\n * Get a logger with the configuration of the LoggerProvider.\n */\n getLogger(name, version, options) {\n if (this._shutdownOnce.isCalled) {\n diag.warn('A shutdown LoggerProvider cannot provide a Logger');\n return NOOP_LOGGER;\n }\n if (!name) {\n diag.warn('Logger requested without instrumentation scope name.');\n }\n const loggerName = name || DEFAULT_LOGGER_NAME;\n const key = `${loggerName}@${version || ''}:${options?.schemaUrl || ''}`;\n if (!this._sharedState.loggers.has(key)) {\n this._sharedState.loggers.set(key, new Logger({ name: loggerName, version, schemaUrl: options?.schemaUrl }, this._sharedState));\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return this._sharedState.loggers.get(key);\n }\n /**\n * Notifies all registered LogRecordProcessor to flush any buffered data.\n *\n * Returns a promise which is resolved when all flushes are complete.\n */\n forceFlush() {\n // do not flush after shutdown\n if (this._shutdownOnce.isCalled) {\n diag.warn('invalid attempt to force flush after LoggerProvider shutdown');\n return this._shutdownOnce.promise;\n }\n return this._sharedState.activeProcessor.forceFlush();\n }\n /**\n * Flush all buffered data and shut down the LoggerProvider and all registered\n * LogRecordProcessor.\n *\n * Returns a promise which is resolved when all flushes are complete.\n */\n shutdown() {\n if (this._shutdownOnce.isCalled) {\n diag.warn('shutdown may only be called once per LoggerProvider');\n return this._shutdownOnce.promise;\n }\n return this._shutdownOnce.call();\n }\n _shutdown() {\n return this._sharedState.activeProcessor.shutdown();\n }\n}\n//# sourceMappingURL=LoggerProvider.js.map",
|
|
18
|
+
"/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { SeverityNumber } from '@opentelemetry/api-logs';\nimport { context, trace, TraceFlags, isSpanContextValid, } from '@opentelemetry/api';\nimport { LogRecordImpl } from './LogRecordImpl';\nexport class Logger {\n instrumentationScope;\n _sharedState;\n _loggerConfig;\n constructor(instrumentationScope, sharedState) {\n this.instrumentationScope = instrumentationScope;\n this._sharedState = sharedState;\n // Cache the logger configuration at construction time\n // Since we don't support re-configuration, this avoids map lookups\n // and string allocations on each emit() call\n this._loggerConfig = this._sharedState.getLoggerConfig(this.instrumentationScope);\n }\n emit(logRecord) {\n const loggerConfig = this._loggerConfig;\n const currentContext = logRecord.context || context.active();\n // Apply minimum severity filtering\n const recordSeverity = logRecord.severityNumber ?? SeverityNumber.UNSPECIFIED;\n // 1. Minimum severity: If the log record's SeverityNumber is specified\n // (i.e. not 0) and is less than the configured minimum_severity,\n // the log record MUST be dropped.\n if (recordSeverity !== SeverityNumber.UNSPECIFIED &&\n recordSeverity < loggerConfig.minimumSeverity) {\n // Log record is dropped due to minimum severity filter\n return;\n }\n // 2. Trace-based: If trace_based is true, and if the log record has a\n // SpanId and the TraceFlags SAMPLED flag is unset, the log record MUST be dropped.\n if (loggerConfig.traceBased) {\n const spanContext = trace.getSpanContext(currentContext);\n if (spanContext && isSpanContextValid(spanContext)) {\n // Check if the trace is unsampled (SAMPLED flag is unset)\n const isSampled = (spanContext.traceFlags & TraceFlags.SAMPLED) === TraceFlags.SAMPLED;\n if (!isSampled) {\n // Log record is dropped due to trace-based filter\n return;\n }\n }\n // If there's no valid span context, the log record is not associated with a trace\n // and therefore bypasses trace-based filtering (as per spec)\n }\n /**\n * If a Logger was obtained with include_trace_context=true,\n * the LogRecords it emits MUST automatically include the Trace Context from the active Context,\n * if Context has not been explicitly set.\n */\n const logRecordInstance = new LogRecordImpl(this._sharedState, this.instrumentationScope, {\n context: currentContext,\n ...logRecord,\n });\n /**\n * the explicitly passed Context,\n * the current Context, or an empty Context if the Logger was obtained with include_trace_context=false\n */\n this._sharedState.activeProcessor.onEmit(logRecordInstance, currentContext);\n /**\n * A LogRecordProcessor may freely modify logRecord for the duration of the OnEmit call.\n * If logRecord is needed after OnEmit returns (i.e. for asynchronous processing) only reads are permitted.\n */\n logRecordInstance._makeReadonly();\n }\n}\n//# sourceMappingURL=Logger.js.map",
|
|
19
|
+
"/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport * as api from '@opentelemetry/api';\nimport { timeInputToHrTime } from '@opentelemetry/core';\nimport { ATTR_EXCEPTION_MESSAGE, ATTR_EXCEPTION_STACKTRACE, ATTR_EXCEPTION_TYPE, } from '@opentelemetry/semantic-conventions';\nimport { isLogAttributeValue } from './utils/validation';\nexport class LogRecordImpl {\n hrTime;\n hrTimeObserved;\n spanContext;\n resource;\n instrumentationScope;\n attributes = {};\n _severityText;\n _severityNumber;\n _body;\n _eventName;\n _attributesCount = 0;\n _droppedAttributesCount = 0;\n _isReadonly = false;\n _logRecordLimits;\n set severityText(severityText) {\n if (this._isLogRecordReadonly()) {\n return;\n }\n this._severityText = severityText;\n }\n get severityText() {\n return this._severityText;\n }\n set severityNumber(severityNumber) {\n if (this._isLogRecordReadonly()) {\n return;\n }\n this._severityNumber = severityNumber;\n }\n get severityNumber() {\n return this._severityNumber;\n }\n set body(body) {\n if (this._isLogRecordReadonly()) {\n return;\n }\n this._body = body;\n }\n get body() {\n return this._body;\n }\n get eventName() {\n return this._eventName;\n }\n set eventName(eventName) {\n if (this._isLogRecordReadonly()) {\n return;\n }\n this._eventName = eventName;\n }\n get droppedAttributesCount() {\n return this._droppedAttributesCount;\n }\n constructor(_sharedState, instrumentationScope, logRecord) {\n const { timestamp, observedTimestamp, eventName, severityNumber, severityText, body, attributes = {}, exception, context, } = logRecord;\n const now = Date.now();\n this.hrTime = timeInputToHrTime(timestamp ?? now);\n this.hrTimeObserved = timeInputToHrTime(observedTimestamp ?? now);\n if (context) {\n const spanContext = api.trace.getSpanContext(context);\n if (spanContext && api.isSpanContextValid(spanContext)) {\n this.spanContext = spanContext;\n }\n }\n this.severityNumber = severityNumber;\n this.severityText = severityText;\n this.body = body;\n this.resource = _sharedState.resource;\n this.instrumentationScope = instrumentationScope;\n this._logRecordLimits = _sharedState.logRecordLimits;\n this._eventName = eventName;\n this.setAttributes(attributes);\n if (exception != null) {\n this._setException(exception);\n }\n }\n setAttribute(key, value) {\n if (this._isLogRecordReadonly()) {\n return this;\n }\n if (key.length === 0) {\n api.diag.warn(`Invalid attribute key: ${key}`);\n return this;\n }\n if (!isLogAttributeValue(value)) {\n api.diag.warn(`Invalid attribute value set for key: ${key}`);\n return this;\n }\n const isNewKey = !Object.prototype.hasOwnProperty.call(this.attributes, key);\n if (isNewKey &&\n this._attributesCount >= this._logRecordLimits.attributeCountLimit) {\n this._droppedAttributesCount++;\n // Only warn once per LogRecord to avoid log spam\n if (this._droppedAttributesCount === 1) {\n api.diag.warn('Dropping extra attributes.');\n }\n return this;\n }\n this.attributes[key] = this._truncateToSize(value);\n if (isNewKey) {\n this._attributesCount++;\n }\n return this;\n }\n setAttributes(attributes) {\n for (const [k, v] of Object.entries(attributes)) {\n this.setAttribute(k, v);\n }\n return this;\n }\n setBody(body) {\n this.body = body;\n return this;\n }\n setEventName(eventName) {\n this.eventName = eventName;\n return this;\n }\n setSeverityNumber(severityNumber) {\n this.severityNumber = severityNumber;\n return this;\n }\n setSeverityText(severityText) {\n this.severityText = severityText;\n return this;\n }\n /**\n * @internal\n * A LogRecordProcessor may freely modify logRecord for the duration of the OnEmit call.\n * If logRecord is needed after OnEmit returns (i.e. for asynchronous processing) only reads are permitted.\n */\n _makeReadonly() {\n this._isReadonly = true;\n }\n _truncateToSize(value) {\n const limit = this._logRecordLimits.attributeValueLengthLimit;\n // Check limit\n if (limit <= 0) {\n // Negative values are invalid, so do not truncate\n api.diag.warn(`Attribute value limit must be positive, got ${limit}`);\n return value;\n }\n // null/undefined - no truncation needed\n if (value == null) {\n return value;\n }\n // String\n if (typeof value === 'string') {\n return this._truncateToLimitUtil(value, limit);\n }\n // Byte arrays - no truncation needed\n if (value instanceof Uint8Array) {\n return value;\n }\n // Arrays (can contain any AnyValue types)\n if (Array.isArray(value)) {\n return value.map(val => this._truncateToSize(val));\n }\n // Objects/Maps - recursively truncate nested values\n if (typeof value === 'object') {\n const truncatedObj = {};\n for (const [k, v] of Object.entries(value)) {\n truncatedObj[k] = this._truncateToSize(v);\n }\n return truncatedObj;\n }\n // Other types (number, boolean), no need to apply value length limit\n return value;\n }\n _setException(exception) {\n let hasMinimumAttributes = false;\n if (typeof exception === 'string' || typeof exception === 'number') {\n if (!Object.hasOwn(this.attributes, ATTR_EXCEPTION_MESSAGE)) {\n this.setAttribute(ATTR_EXCEPTION_MESSAGE, String(exception));\n }\n hasMinimumAttributes = true;\n }\n else if (exception && typeof exception === 'object') {\n const exceptionObj = exception;\n if (exceptionObj.code) {\n if (!Object.hasOwn(this.attributes, ATTR_EXCEPTION_TYPE)) {\n this.setAttribute(ATTR_EXCEPTION_TYPE, exceptionObj.code.toString());\n }\n hasMinimumAttributes = true;\n }\n else if (exceptionObj.name) {\n if (!Object.hasOwn(this.attributes, ATTR_EXCEPTION_TYPE)) {\n this.setAttribute(ATTR_EXCEPTION_TYPE, exceptionObj.name);\n }\n hasMinimumAttributes = true;\n }\n if (exceptionObj.message) {\n if (!Object.hasOwn(this.attributes, ATTR_EXCEPTION_MESSAGE)) {\n this.setAttribute(ATTR_EXCEPTION_MESSAGE, exceptionObj.message);\n }\n hasMinimumAttributes = true;\n }\n if (exceptionObj.stack) {\n if (!Object.hasOwn(this.attributes, ATTR_EXCEPTION_STACKTRACE)) {\n this.setAttribute(ATTR_EXCEPTION_STACKTRACE, exceptionObj.stack);\n }\n hasMinimumAttributes = true;\n }\n }\n if (!hasMinimumAttributes) {\n api.diag.warn(`Failed to record an exception ${exception}`);\n }\n }\n _truncateToLimitUtil(value, limit) {\n if (value.length <= limit) {\n return value;\n }\n return value.substring(0, limit);\n }\n _isLogRecordReadonly() {\n if (this._isReadonly) {\n api.diag.warn('Can not execute the operation on emitted log record');\n }\n return this._isReadonly;\n }\n}\n//# sourceMappingURL=LogRecordImpl.js.map",
|
|
20
|
+
"/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * Validates if a value is a valid AnyValue for Log Attributes according to OpenTelemetry spec.\n * Log Attributes support a superset of standard Attributes and must support:\n * - Scalar values: string, boolean, signed 64 bit integer, or double precision floating point\n * - Byte arrays (Uint8Array)\n * - Arrays of any values (heterogeneous arrays allowed)\n * - Maps from string to any value (nested objects)\n * - Empty values (null/undefined)\n *\n * @param val - The value to validate\n * @returns true if the value is a valid AnyValue, false otherwise\n */\nexport function isLogAttributeValue(val) {\n return isLogAttributeValueInternal(val, new WeakSet());\n}\nfunction isLogAttributeValueInternal(val, visited) {\n // null and undefined are explicitly allowed\n if (val == null) {\n return true;\n }\n // Scalar values\n if (typeof val === 'string' ||\n typeof val === 'number' ||\n typeof val === 'boolean') {\n return true;\n }\n // Byte arrays\n if (val instanceof Uint8Array) {\n return true;\n }\n // For objects and arrays, check for circular references\n if (typeof val === 'object') {\n if (visited.has(val)) {\n // Circular reference detected - reject it\n return false;\n }\n visited.add(val);\n // Arrays (can contain any AnyValue, including heterogeneous)\n if (Array.isArray(val)) {\n return val.every(item => isLogAttributeValueInternal(item, visited));\n }\n // Only accept plain objects (not built-in objects like Date, RegExp, Error, etc.)\n // Check if it's a plain object by verifying its constructor is Object or it has no constructor\n const obj = val;\n if (obj.constructor !== Object && obj.constructor !== undefined) {\n return false;\n }\n // Objects/Maps (including empty objects)\n // All object properties must be valid AnyValues\n return Object.values(obj).every(item => isLogAttributeValueInternal(item, visited));\n }\n return false;\n}\n//# sourceMappingURL=validation.js.map",
|
|
21
|
+
"/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nexport class NoopLogRecordProcessor {\n forceFlush() {\n return Promise.resolve();\n }\n onEmit(_logRecord, _context) { }\n shutdown() {\n return Promise.resolve();\n }\n}\n//# sourceMappingURL=NoopLogRecordProcessor.js.map",
|
|
22
|
+
"/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { callWithTimeout } from '@opentelemetry/core';\n/**\n * Implementation of the {@link LogRecordProcessor} that simply forwards all\n * received events to a list of {@link LogRecordProcessor}s.\n */\nexport class MultiLogRecordProcessor {\n processors;\n forceFlushTimeoutMillis;\n constructor(processors, forceFlushTimeoutMillis) {\n this.processors = processors;\n this.forceFlushTimeoutMillis = forceFlushTimeoutMillis;\n }\n async forceFlush() {\n const timeout = this.forceFlushTimeoutMillis;\n await Promise.all(this.processors.map(processor => callWithTimeout(processor.forceFlush(), timeout)));\n }\n onEmit(logRecord, context) {\n this.processors.forEach(processors => processors.onEmit(logRecord, context));\n }\n async shutdown() {\n await Promise.all(this.processors.map(processor => processor.shutdown()));\n }\n}\n//# sourceMappingURL=MultiLogRecordProcessor.js.map",
|
|
23
|
+
"/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * Converting the instrumentation scope object to a unique identifier string.\n * @param scope - The instrumentation scope to convert\n * @returns A unique string identifier for the scope\n */\nexport function getInstrumentationScopeKey(scope) {\n return `${scope.name}@${scope.version || ''}:${scope.schemaUrl || ''}`;\n}\n//# sourceMappingURL=utils.js.map",
|
|
24
|
+
"/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\nimport { SeverityNumber } from '@opentelemetry/api-logs';\nimport { NoopLogRecordProcessor } from '../export/NoopLogRecordProcessor';\nimport { MultiLogRecordProcessor } from '../MultiLogRecordProcessor';\nimport { getInstrumentationScopeKey } from './utils';\nconst DEFAULT_LOGGER_CONFIG = {\n disabled: false,\n minimumSeverity: SeverityNumber.UNSPECIFIED,\n traceBased: false,\n};\n/**\n * Default LoggerConfigurator that returns the default config for all loggers\n */\nexport const DEFAULT_LOGGER_CONFIGURATOR = () => ({\n ...DEFAULT_LOGGER_CONFIG,\n});\nexport class LoggerProviderSharedState {\n loggers = new Map();\n activeProcessor;\n registeredLogRecordProcessors = [];\n resource;\n forceFlushTimeoutMillis;\n logRecordLimits;\n processors;\n _loggerConfigurator;\n _loggerConfigs = new Map();\n constructor(resource, forceFlushTimeoutMillis, logRecordLimits, processors, loggerConfigurator) {\n this.resource = resource;\n this.forceFlushTimeoutMillis = forceFlushTimeoutMillis;\n this.logRecordLimits = logRecordLimits;\n this.processors = processors;\n if (processors.length > 0) {\n this.registeredLogRecordProcessors = processors;\n this.activeProcessor = new MultiLogRecordProcessor(this.registeredLogRecordProcessors, this.forceFlushTimeoutMillis);\n }\n else {\n this.activeProcessor = new NoopLogRecordProcessor();\n }\n this._loggerConfigurator =\n loggerConfigurator ?? DEFAULT_LOGGER_CONFIGURATOR;\n }\n /**\n * Get the LoggerConfig for a given instrumentation scope.\n * Uses the LoggerConfigurator function to compute the config on first access\n * and caches the result.\n *\n * @experimental This feature is in development as per the OpenTelemetry specification.\n */\n getLoggerConfig(instrumentationScope) {\n const key = getInstrumentationScopeKey(instrumentationScope);\n // Return cached config if available\n let config = this._loggerConfigs.get(key);\n if (config) {\n return config;\n }\n // Compute config using the configurator\n // The configurator always returns a complete config\n config = this._loggerConfigurator(instrumentationScope);\n // Cache the result\n this._loggerConfigs.set(key, config);\n return config;\n }\n}\n//# sourceMappingURL=LoggerProviderSharedState.js.map",
|
|
25
|
+
"import * as Inspectable from \"effect/Inspectable\";\nconst bigint1e9 = /*#__PURE__*/BigInt(1_000_000_000);\n/** @internal */\nexport const nanosToHrTime = timestamp => {\n return [Number(timestamp / bigint1e9), Number(timestamp % bigint1e9)];\n};\n/** @internal */\nexport const recordToAttributes = record => {\n const attributes = {};\n for (const [key, value] of Object.entries(record)) {\n attributes[key] = unknownToAttributeValue(value);\n }\n return attributes;\n};\n/** @internal */\nexport const unknownToAttributeValue = value => {\n if (typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\") {\n return value;\n } else if (typeof value === \"bigint\") {\n return value.toString();\n }\n return Inspectable.toStringUnknown(value);\n};\n//# sourceMappingURL=attributes.js.map",
|
|
26
|
+
"import * as Resources from \"@opentelemetry/resources\";\nimport * as OtelSemConv from \"@opentelemetry/semantic-conventions\";\nimport * as Arr from \"effect/Array\";\nimport * as Config from \"effect/Config\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\n/**\n * Service tag for OpenTelemetry metadata attached to emitted telemetry.\n *\n * **When to use**\n *\n * Use to provide process, service, and deployment metadata that should be\n * attached to spans, metrics, and logs.\n *\n * @category services\n * @since 4.0.0\n */\nexport class Resource extends /*#__PURE__*/Context.Service()(\"@effect/opentelemetry/Resource\") {}\n/**\n * Creates a `Resource` layer from service metadata and additional OpenTelemetry attributes.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = config => Layer.succeed(Resource, Resources.resourceFromAttributes(configToAttributes(config)));\n/**\n * Converts resource configuration into OpenTelemetry attributes, adding service name, optional service version, and telemetry SDK metadata.\n *\n * **When to use**\n *\n * Use to turn explicit service metadata into a raw OpenTelemetry attribute map\n * for lower-level resource construction or for merging with environment-derived\n * attributes via `layerFromEnv`.\n *\n * **Details**\n *\n * The returned record copies `attributes` first, then sets `service.name`,\n * `telemetry.sdk.name`, and `telemetry.sdk.language`. `service.version` is\n * included only when `serviceVersion` is provided.\n *\n * **Gotchas**\n *\n * Custom values for `service.name` and `telemetry.sdk.*` are overwritten by this\n * helper. An empty `serviceVersion` is treated as absent.\n *\n * @see {@link layer} for creating a `Resource` layer from explicit metadata\n * @see {@link layerFromEnv} for merging attributes with OpenTelemetry environment variables\n *\n * @category configuration\n * @since 4.0.0\n */\nexport const configToAttributes = options => {\n const attributes = {\n ...(options.attributes ?? undefined),\n [OtelSemConv.ATTR_SERVICE_NAME]: options.serviceName,\n [OtelSemConv.ATTR_TELEMETRY_SDK_NAME]: \"@effect/opentelemetry\",\n [OtelSemConv.ATTR_TELEMETRY_SDK_LANGUAGE]: typeof globalThis.document === \"undefined\" ? OtelSemConv.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS : OtelSemConv.TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS\n };\n if (options.serviceVersion) {\n attributes[OtelSemConv.ATTR_SERVICE_VERSION] = options.serviceVersion;\n }\n return attributes;\n};\n/**\n * Creates a `Resource` layer from OpenTelemetry environment variables, optionally merging additional attributes.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerFromEnv = additionalAttributes => Layer.effect(Resource, Effect.gen(function* () {\n const serviceName = yield* Config.option(Config.string(\"OTEL_SERVICE_NAME\"));\n const attributes = yield* Config.string(\"OTEL_RESOURCE_ATTRIBUTES\").pipe(Config.withDefault(\"\"), Config.map(s => {\n const attrs = s.split(\",\");\n return Arr.reduce(attrs, {}, (acc, attr) => {\n const parts = attr.split(\"=\");\n if (parts.length !== 2) {\n return acc;\n }\n acc[parts[0].trim()] = parts[1].trim();\n return acc;\n });\n }));\n if (serviceName._tag === \"Some\") {\n attributes[OtelSemConv.ATTR_SERVICE_NAME] = serviceName.value;\n }\n if (additionalAttributes) {\n Object.assign(attributes, additionalAttributes);\n }\n return Resources.resourceFromAttributes(attributes);\n}).pipe(Effect.orDie));\n/**\n * Layer that provides an empty OpenTelemetry resource.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerEmpty = /*#__PURE__*/Layer.succeed(Resource, /*#__PURE__*/Resources.emptyResource());\n//# sourceMappingURL=Resource.js.map",
|
|
27
|
+
"/**\n * Connects Effect logging to the OpenTelemetry Logs SDK.\n *\n * This module turns Effect log events into OpenTelemetry log records. It\n * provides the `OtelLoggerProvider` service, a `Logger` implementation created\n * by {@link make}, a {@link layer} that installs it into Effect logging, and\n * {@link layerLoggerProvider} for creating a scoped SDK `LoggerProvider` from\n * one or more `LogRecordProcessor`s.\n *\n * **Mental model**\n *\n * Effect decides when a log is emitted and supplies the message, fiber id, log\n * level, annotations, log spans, and active parent span. This module maps that\n * data into an OpenTelemetry log record, including severity text/number, trace\n * and span identifiers when available, and timestamps from the Effect `Clock`.\n *\n * **Common tasks**\n *\n * Use {@link layerLoggerProvider} when the application wants this package to own\n * the OpenTelemetry logger provider lifecycle. Provide it with processors such\n * as OTLP, console, or vendor-specific exporters, then install {@link layer} so\n * regular Effect logging emits records through that provider. If the provider is\n * created elsewhere, supply `OtelLoggerProvider` yourself and still use\n * {@link layer} or {@link make}.\n *\n * **Gotchas**\n *\n * This module does not choose an exporter. Export behavior, batching, retries,\n * and delivery guarantees come from the configured OpenTelemetry processors.\n * The scoped provider is force-flushed and shut down when the layer is released,\n * using the configured shutdown timeout; externally managed providers should be\n * flushed and shut down by the owner to avoid dropping buffered logs.\n *\n * @since 4.0.0\n */\nimport { SeverityNumber } from \"@opentelemetry/api-logs\";\nimport * as Otel from \"@opentelemetry/sdk-logs\";\nimport * as Arr from \"effect/Array\";\nimport * as Clock from \"effect/Clock\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Logger from \"effect/Logger\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as References from \"effect/References\";\nimport * as Tracer from \"effect/Tracer\";\nimport { nanosToHrTime, unknownToAttributeValue } from \"./internal/attributes.js\";\nimport { Resource } from \"./Resource.js\";\n/**\n * Context service containing the OpenTelemetry `LoggerProvider` used to emit Effect log records.\n *\n * @category services\n * @since 4.0.0\n */\nexport class OtelLoggerProvider extends /*#__PURE__*/Context.Service()(\"@effect/opentelemetry/Logger/OtelLoggerProvider\") {}\n/**\n * Maps an Effect `LogLevel` to the corresponding OpenTelemetry `SeverityNumber`.\n *\n * **Details**\n *\n * OpenTelemetry log severity numbers are in the range `1` through `24`. This\n * function maps from Effect's log levels instead of using\n * `LogLevel.getOrdinal`, whose internal sort ordinals, such as the `Info`\n * ordinal `20000`, fall outside the OpenTelemetry logs data model and can be\n * treated as `UNSPECIFIED` by validating backends.\n *\n * @category converting\n * @since 4.0.0\n */\nexport const logLevelToSeverityNumber = level => {\n switch (level) {\n case \"Trace\":\n return SeverityNumber.TRACE;\n case \"Debug\":\n return SeverityNumber.DEBUG;\n case \"Info\":\n return SeverityNumber.INFO;\n case \"Warn\":\n return SeverityNumber.WARN;\n case \"Error\":\n return SeverityNumber.ERROR;\n case \"Fatal\":\n return SeverityNumber.FATAL;\n default:\n return SeverityNumber.UNSPECIFIED;\n }\n};\n/**\n * Creates an Effect logger that emits log records through the configured OpenTelemetry logger provider.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = /*#__PURE__*/Effect.gen(function* () {\n const loggerProvider = yield* OtelLoggerProvider;\n const clock = yield* Clock.Clock;\n const otelLogger = loggerProvider.getLogger(\"@effect/opentelemetry\");\n return Logger.make(options => {\n const attributes = {\n fiberId: options.fiber.id\n };\n const span = Context.getOrUndefined(options.fiber.context, Tracer.ParentSpan);\n if (Predicate.isNotUndefined(span)) {\n attributes.spanId = span.spanId;\n attributes.traceId = span.traceId;\n }\n for (const [key, value] of Object.entries(options.fiber.getRef(References.CurrentLogAnnotations))) {\n attributes[key] = unknownToAttributeValue(value);\n }\n const now = options.date.getTime();\n for (const [label, startTime] of options.fiber.getRef(References.CurrentLogSpans)) {\n attributes[`logSpan.${label}`] = `${now - startTime}ms`;\n }\n const message = Arr.ensure(options.message).map(unknownToAttributeValue);\n const hrTime = nanosToHrTime(clock.currentTimeNanosUnsafe());\n otelLogger.emit({\n body: message.length === 1 ? message[0] : message,\n severityText: options.logLevel,\n severityNumber: logLevelToSeverityNumber(options.logLevel),\n timestamp: hrTime,\n observedTimestamp: hrTime,\n attributes\n });\n });\n});\n/**\n * Creates a layer that installs the OpenTelemetry-backed Effect logger, merging with existing loggers by default.\n *\n * **When to use**\n *\n * Use to install the OpenTelemetry-backed Effect logger in an application that\n * has an `OtelLoggerProvider`, so standard Effect logging emits OpenTelemetry\n * log records.\n *\n * **Details**\n *\n * The layer installs the logger created by `make`. `mergeWithExisting` defaults\n * to `true`; set it to `false` to replace the current logger set.\n *\n * @see {@link make} for constructing the logger directly\n * @see {@link layerLoggerProvider} for creating the required logger provider\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = options => Logger.layer([make], {\n mergeWithExisting: options.mergeWithExisting ?? true\n});\n/**\n * Creates a scoped OpenTelemetry logger provider from one or more log record processors, using the current `Resource` and flushing and shutting down the provider when the layer is released.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerLoggerProvider = (processor, config) => Layer.effect(OtelLoggerProvider, Effect.gen(function* () {\n const resource = yield* Resource;\n return yield* Effect.acquireRelease(Effect.sync(() => new Otel.LoggerProvider({\n ...(config ?? undefined),\n processors: Arr.ensure(processor),\n resource\n })), provider => Effect.promise(() => provider.forceFlush().then(() => provider.shutdown())).pipe(Effect.ignore, Effect.interruptible, Effect.timeoutOption(config?.shutdownTimeout ?? 3000)));\n}));\n//# sourceMappingURL=Logger.js.map",
|
|
28
|
+
"import { ValueType } from \"@opentelemetry/api\";\nimport { AggregationTemporality, DataPointType, InstrumentType } from \"@opentelemetry/sdk-metrics\";\nimport * as Arr from \"effect/Array\";\nimport * as Metric from \"effect/Metric\";\nconst sdkName = \"@effect/opentelemetry/Metrics\";\n/** @internal */\nexport class MetricProducerImpl {\n resource;\n context;\n temporality;\n startTimes;\n startTimeNanos;\n previousExportTimeNanos;\n previousCounterState;\n previousHistogramState;\n previousFrequencyState;\n previousSummaryState;\n constructor(resource, context, temporality = \"cumulative\") {\n this.resource = resource;\n this.context = context;\n this.temporality = temporality;\n this.startTimes = new Map();\n this.startTimeNanos = currentHrTime();\n this.previousExportTimeNanos = this.startTimeNanos;\n this.previousCounterState = new Map();\n this.previousHistogramState = new Map();\n this.previousFrequencyState = new Map();\n this.previousSummaryState = new Map();\n }\n startTimeFor(name, hrTime) {\n if (this.startTimes.has(name)) {\n return this.startTimes.get(name);\n }\n this.startTimes.set(name, hrTime);\n return hrTime;\n }\n collect(_options) {\n const snapshot = Metric.snapshotUnsafe(this.context);\n const hrTimeNow = currentHrTime();\n const metricData = [];\n const metricDataByName = new Map();\n const addMetricData = data => {\n metricData.push(data);\n metricDataByName.set(data.descriptor.name, data);\n };\n const isDelta = this.temporality === \"delta\";\n const aggregationTemporality = isDelta ? AggregationTemporality.DELTA : AggregationTemporality.CUMULATIVE;\n const intervalStartTime = isDelta ? this.previousExportTimeNanos : this.startTimeNanos;\n for (let i = 0, len = snapshot.length; i < len; i++) {\n const state = snapshot[i];\n const attributes = state.attributes ? Arr.reduce(Object.entries(state.attributes), {}, (acc, [key, value]) => {\n acc[key] = String(value);\n return acc;\n }) : {};\n const metricKey = makeMetricKey(state.id, state.attributes);\n switch (state.type) {\n case \"Counter\":\n {\n const currentCount = state.state.count;\n let reportValue = currentCount;\n if (isDelta) {\n const previousCount = this.previousCounterState.get(metricKey);\n if (previousCount !== undefined) {\n if (typeof currentCount === \"bigint\" && typeof previousCount === \"bigint\") {\n reportValue = currentCount - previousCount;\n // Handle reset: if current < previous, report current value\n if (reportValue < BigInt(0)) {\n reportValue = currentCount;\n }\n } else {\n const curr = Number(currentCount);\n const prev = Number(previousCount);\n reportValue = curr - prev;\n // Handle reset\n if (reportValue < 0) {\n reportValue = curr;\n }\n }\n }\n this.previousCounterState.set(metricKey, currentCount);\n }\n const descriptor = descriptorFromState(state, attributes);\n const startTime = this.startTimeFor(descriptor.name, intervalStartTime);\n const dataPoint = {\n startTime,\n endTime: hrTimeNow,\n attributes,\n value: Number(reportValue)\n };\n if (metricDataByName.has(state.id)) {\n metricDataByName.get(state.id).dataPoints.push(dataPoint);\n } else {\n addMetricData({\n dataPointType: DataPointType.SUM,\n descriptor,\n isMonotonic: state.state.incremental,\n aggregationTemporality,\n dataPoints: [dataPoint]\n });\n }\n break;\n }\n case \"Gauge\":\n {\n // Gauges don't have temporality - they always report current value\n const descriptor = descriptorFromState(state, attributes);\n const startTime = this.startTimeFor(descriptor.name, this.startTimeNanos);\n const dataPoint = {\n startTime,\n endTime: hrTimeNow,\n attributes,\n value: Number(state.state.value)\n };\n if (metricDataByName.has(state.id)) {\n metricDataByName.get(state.id).dataPoints.push(dataPoint);\n } else {\n addMetricData({\n dataPointType: DataPointType.GAUGE,\n descriptor,\n aggregationTemporality: AggregationTemporality.CUMULATIVE,\n dataPoints: [dataPoint]\n });\n }\n break;\n }\n case \"Histogram\":\n {\n const size = state.state.buckets.length;\n const currentBuckets = {\n boundaries: Arr.allocate(size - 1),\n counts: Arr.allocate(size)\n };\n let idx = 0;\n let prev = 0;\n for (const [boundary, value] of state.state.buckets) {\n if (idx < size - 1) {\n currentBuckets.boundaries[idx] = boundary;\n }\n currentBuckets.counts[idx] = value - prev;\n prev = value;\n idx++;\n }\n let reportCount = state.state.count;\n let reportSum = state.state.sum;\n let reportBucketCounts = currentBuckets.counts;\n const reportMin = state.state.min;\n const reportMax = state.state.max;\n if (isDelta) {\n const previousState = this.previousHistogramState.get(metricKey);\n if (previousState !== undefined) {\n reportCount = state.state.count - previousState.count;\n reportSum = state.state.sum - previousState.sum;\n reportBucketCounts = currentBuckets.counts.map((c, i) => Math.max(0, c - (previousState.bucketCounts[i] ?? 0)));\n }\n this.previousHistogramState.set(metricKey, {\n count: state.state.count,\n sum: state.state.sum,\n bucketCounts: currentBuckets.counts.slice(),\n min: state.state.min,\n max: state.state.max\n });\n }\n const descriptor = descriptorFromState(state, attributes);\n const startTime = this.startTimeFor(descriptor.name, intervalStartTime);\n const dataPoint = {\n startTime,\n endTime: hrTimeNow,\n attributes,\n value: {\n buckets: {\n boundaries: currentBuckets.boundaries,\n counts: reportBucketCounts\n },\n count: reportCount,\n min: reportMin,\n max: reportMax,\n sum: reportSum\n }\n };\n if (metricDataByName.has(state.id)) {\n metricDataByName.get(state.id).dataPoints.push(dataPoint);\n } else {\n addMetricData({\n dataPointType: DataPointType.HISTOGRAM,\n descriptor,\n aggregationTemporality,\n dataPoints: [dataPoint]\n });\n }\n break;\n }\n case \"Frequency\":\n {\n const dataPoints = [];\n const currentOccurrences = new Map();\n for (const [freqKey, value] of state.state.occurrences) {\n currentOccurrences.set(freqKey, value);\n let reportValue = value;\n if (isDelta) {\n const previousOccurrences = this.previousFrequencyState.get(metricKey);\n if (previousOccurrences !== undefined) {\n const previousValue = previousOccurrences.get(freqKey) ?? 0;\n reportValue = Math.max(0, value - previousValue);\n }\n }\n const descriptor = descriptorFromState(state, attributes);\n const startTime = this.startTimeFor(descriptor.name, intervalStartTime);\n dataPoints.push({\n startTime,\n endTime: hrTimeNow,\n attributes: {\n ...attributes,\n key: freqKey\n },\n value: reportValue\n });\n }\n if (isDelta) {\n this.previousFrequencyState.set(metricKey, currentOccurrences);\n }\n if (metricDataByName.has(state.id)) {\n // oxlint-disable-next-line no-restricted-syntax\n metricDataByName.get(state.id).dataPoints.push(...dataPoints);\n } else {\n const descriptor = descriptorFromState(state, attributes);\n addMetricData({\n dataPointType: DataPointType.SUM,\n descriptor,\n aggregationTemporality,\n isMonotonic: true,\n dataPoints\n });\n }\n break;\n }\n case \"Summary\":\n {\n // Quantiles are always computed fresh from the sliding window\n const dataPoints = [{\n startTime: intervalStartTime,\n endTime: hrTimeNow,\n attributes: {\n ...attributes,\n quantile: \"min\"\n },\n value: state.state.min\n }];\n for (const [quantile, value] of state.state.quantiles) {\n dataPoints.push({\n startTime: intervalStartTime,\n endTime: hrTimeNow,\n attributes: {\n ...attributes,\n quantile: quantile.toString()\n },\n value: value ?? 0\n });\n }\n dataPoints.push({\n startTime: intervalStartTime,\n endTime: hrTimeNow,\n attributes: {\n ...attributes,\n quantile: \"max\"\n },\n value: state.state.max\n });\n let reportCount = state.state.count;\n let reportSum = state.state.sum;\n if (isDelta) {\n const previousState = this.previousSummaryState.get(metricKey);\n if (previousState !== undefined) {\n reportCount = state.state.count - previousState.count;\n reportSum = state.state.sum - previousState.sum;\n }\n this.previousSummaryState.set(metricKey, {\n count: state.state.count,\n sum: state.state.sum\n });\n }\n const countDataPoint = {\n startTime: intervalStartTime,\n endTime: hrTimeNow,\n attributes,\n value: reportCount\n };\n const sumDataPoint = {\n startTime: intervalStartTime,\n endTime: hrTimeNow,\n attributes,\n value: reportSum\n };\n if (metricDataByName.has(`${state.id}_quantiles`)) {\n // oxlint-disable-next-line no-restricted-syntax\n metricDataByName.get(`${state.id}_quantiles`).dataPoints.push(...dataPoints);\n metricDataByName.get(`${state.id}_count`).dataPoints.push(countDataPoint);\n metricDataByName.get(`${state.id}_sum`).dataPoints.push(sumDataPoint);\n } else {\n const descriptor = descriptorFromState(state, attributes);\n addMetricData({\n dataPointType: DataPointType.SUM,\n descriptor: {\n ...descriptor,\n name: `${descriptor.name}_quantiles`\n },\n aggregationTemporality,\n isMonotonic: false,\n dataPoints\n });\n addMetricData({\n dataPointType: DataPointType.SUM,\n descriptor: {\n name: `${state.id}_count`,\n description: state.description ?? \"\",\n unit: \"1\",\n type: InstrumentType.COUNTER,\n valueType: ValueType.INT,\n advice: {}\n },\n aggregationTemporality,\n isMonotonic: true,\n dataPoints: [countDataPoint]\n });\n addMetricData({\n dataPointType: DataPointType.SUM,\n descriptor: {\n name: `${state.id}_sum`,\n description: state.description ?? \"\",\n unit: \"1\",\n type: InstrumentType.COUNTER,\n valueType: ValueType.DOUBLE,\n advice: {}\n },\n aggregationTemporality,\n isMonotonic: true,\n dataPoints: [sumDataPoint]\n });\n }\n break;\n }\n }\n }\n // Update the previous export time for delta calculations\n if (isDelta) {\n this.previousExportTimeNanos = hrTimeNow;\n }\n return Promise.resolve({\n resourceMetrics: {\n resource: this.resource,\n scopeMetrics: [{\n scope: {\n name: sdkName\n },\n metrics: metricData\n }]\n },\n errors: []\n });\n }\n}\n/** Creates a unique key for a metric including its attributes */\nconst makeMetricKey = (id, attributes) => {\n if (attributes === undefined || Object.keys(attributes).length === 0) {\n return id;\n }\n const sortedEntries = Object.entries(attributes).sort((a, b) => a[0].localeCompare(b[0]));\n return `${id}:${JSON.stringify(sortedEntries)}`;\n};\nconst currentHrTime = () => {\n const now = Date.now();\n return [Math.floor(now / 1000), now % 1000 * 1000000];\n};\nconst descriptorFromState = (state, attributes) => {\n const unit = attributes.unit ?? attributes.time_unit ?? \"1\";\n return {\n name: state.id,\n description: state.description ?? \"\",\n unit,\n type: instrumentTypeFromSnapshot(state),\n valueType: determineValueType(state),\n advice: {}\n };\n};\nconst instrumentTypeFromSnapshot = state => {\n switch (state.type) {\n case \"Histogram\":\n return InstrumentType.HISTOGRAM;\n case \"Gauge\":\n return InstrumentType.OBSERVABLE_GAUGE;\n case \"Frequency\":\n return InstrumentType.COUNTER;\n case \"Counter\":\n return state.state.incremental ? InstrumentType.COUNTER : InstrumentType.UP_DOWN_COUNTER;\n case \"Summary\":\n return InstrumentType.COUNTER;\n }\n};\nconst determineValueType = state => {\n if (state.type === \"Counter\") {\n return typeof state.state.count === \"bigint\" ? ValueType.INT : ValueType.DOUBLE;\n } else if (state.type === \"Gauge\") {\n return typeof state.state.value === \"bigint\" ? ValueType.INT : ValueType.DOUBLE;\n }\n return ValueType.DOUBLE;\n};\n//# sourceMappingURL=metrics.js.map",
|
|
29
|
+
"/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * AggregationTemporality indicates the way additive quantities are expressed.\n */\nexport var AggregationTemporality;\n(function (AggregationTemporality) {\n AggregationTemporality[AggregationTemporality[\"DELTA\"] = 0] = \"DELTA\";\n AggregationTemporality[AggregationTemporality[\"CUMULATIVE\"] = 1] = \"CUMULATIVE\";\n})(AggregationTemporality || (AggregationTemporality = {}));\n//# sourceMappingURL=AggregationTemporality.js.map",
|
|
30
|
+
"/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n/**\n * Supported types of metric instruments.\n */\nexport var InstrumentType;\n(function (InstrumentType) {\n InstrumentType[\"COUNTER\"] = \"COUNTER\";\n InstrumentType[\"GAUGE\"] = \"GAUGE\";\n InstrumentType[\"HISTOGRAM\"] = \"HISTOGRAM\";\n InstrumentType[\"UP_DOWN_COUNTER\"] = \"UP_DOWN_COUNTER\";\n InstrumentType[\"OBSERVABLE_COUNTER\"] = \"OBSERVABLE_COUNTER\";\n InstrumentType[\"OBSERVABLE_GAUGE\"] = \"OBSERVABLE_GAUGE\";\n InstrumentType[\"OBSERVABLE_UP_DOWN_COUNTER\"] = \"OBSERVABLE_UP_DOWN_COUNTER\";\n})(InstrumentType || (InstrumentType = {}));\n/**\n * The aggregated point data type.\n */\nexport var DataPointType;\n(function (DataPointType) {\n /**\n * A histogram data point contains a histogram statistics of collected\n * values with a list of explicit bucket boundaries and statistics such\n * as min, max, count, and sum of all collected values.\n */\n DataPointType[DataPointType[\"HISTOGRAM\"] = 0] = \"HISTOGRAM\";\n /**\n * An exponential histogram data point contains a histogram statistics of\n * collected values where bucket boundaries are automatically calculated\n * using an exponential function, and statistics such as min, max, count,\n * and sum of all collected values.\n */\n DataPointType[DataPointType[\"EXPONENTIAL_HISTOGRAM\"] = 1] = \"EXPONENTIAL_HISTOGRAM\";\n /**\n * A gauge metric data point has only a single numeric value.\n */\n DataPointType[DataPointType[\"GAUGE\"] = 2] = \"GAUGE\";\n /**\n * A sum metric data point has a single numeric value and a\n * monotonicity-indicator.\n */\n DataPointType[DataPointType[\"SUM\"] = 3] = \"SUM\";\n})(DataPointType || (DataPointType = {}));\n//# sourceMappingURL=MetricData.js.map",
|
|
31
|
+
"import * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport { MetricProducerImpl } from \"./internal/metrics.js\";\nimport { Resource } from \"./Resource.js\";\n/**\n * Creates an OpenTelemetry metric producer from Effect metrics.\n *\n * **When to use**\n *\n * Use to create a `MetricProducer` when you need to wire Effect metrics into\n * OpenTelemetry manually instead of using the scoped `layer` helper.\n *\n * **Details**\n *\n * Requires the current OpenTelemetry `Resource`, captures the current Effect\n * context, and uses cumulative temporality by default. Pass `\"delta\"` for\n * interval-based values.\n *\n * @see {@link registerProducer} for attaching a producer to metric readers\n * @see {@link layer} for creating and registering a producer in a scoped layer\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const makeProducer = temporality => Effect.gen(function* () {\n const resource = yield* Resource;\n const services = yield* Effect.context();\n return new MetricProducerImpl(resource, services, temporality);\n});\n/**\n * Registers a metric producer with one or more metric readers.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const registerProducer = (self, metricReader, options) => Effect.acquireRelease(Effect.sync(() => {\n const reader = metricReader();\n const readers = Array.isArray(reader) ? reader : [reader];\n readers.forEach(reader => reader.setMetricProducer(self));\n return readers;\n}), readers => Effect.promise(() => Promise.all(readers.map(reader => reader.shutdown()))).pipe(Effect.ignore, Effect.interruptible, Effect.timeoutOption(options?.shutdownTimeout ?? 3000)));\n/**\n * Creates a Layer that registers a metric producer with metric readers.\n *\n * **Example** (Creating a metrics layer with temporality)\n *\n * ```ts\n * import { Metrics } from \"@effect/opentelemetry\"\n * import { PeriodicExportingMetricReader } from \"@opentelemetry/sdk-metrics\"\n * import { OTLPMetricExporter } from \"@opentelemetry/exporter-metrics-otlp-http\"\n *\n * const metricExporter = new OTLPMetricExporter({ url: \"<your-otel-url>\" })\n *\n * // Use delta temporality for backends like Datadog or Dynatrace\n * const metricsLayer = Metrics.layer(\n * () => new PeriodicExportingMetricReader({\n * exporter: metricExporter,\n * exportIntervalMillis: 10000\n * }),\n * { temporality: \"delta\" }\n * )\n *\n * // Use cumulative temporality for backends like Prometheus (default)\n * const cumulativeLayer = Metrics.layer(\n * () => new PeriodicExportingMetricReader({ exporter: metricExporter }),\n * { temporality: \"cumulative\" }\n * )\n * ```\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = (evaluate, options) => Layer.effectDiscard(Effect.flatMap(makeProducer(options?.temporality), producer => registerProducer(producer, evaluate, options)));\n//# sourceMappingURL=Metrics.js.map",
|
|
32
|
+
"/**\n * Bridges Effect tracing into OpenTelemetry by installing an Effect `Tracer`\n * that creates OpenTelemetry spans, records attributes, events, links, errors,\n * and status, and keeps OpenTelemetry context active while traced effects run.\n * Use this module when an application already has an OpenTelemetry\n * `TracerProvider`, or when the Node and Web SDK layers should expose Effect\n * spans to OTLP, console, or other OpenTelemetry-compatible exporters.\n *\n * The layer constructors wire Effect's tracer service to either the global\n * OpenTelemetry tracer provider or an explicitly provided `OtelTracer`. This\n * module does not create exporters or span processors by itself, so spans are\n * exported only when the provider has been configured by the application or by\n * the Node/Web SDK layers. Parentage is taken from Effect spans first and can\n * also attach to the active OpenTelemetry context, while `makeExternalSpan` and\n * `withSpanContext` are the entry points for continuing an incoming remote\n * trace. Preserve `traceFlags` and `traceState` when building external spans;\n * otherwise sampling defaults to sampled and trace state cannot be propagated.\n *\n * @since 4.0.0\n */\nimport * as Otel from \"@opentelemetry/api\";\nimport * as OtelSemConv from \"@opentelemetry/semantic-conventions\";\nimport * as Cause from \"effect/Cause\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Exit from \"effect/Exit\";\nimport { constTrue, dual } from \"effect/Function\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as Tracer from \"effect/Tracer\";\nimport { nanosToHrTime, recordToAttributes, unknownToAttributeValue } from \"./internal/attributes.js\";\nimport { Resource } from \"./Resource.js\";\n// =============================================================================\n// Service Definitions\n// =============================================================================\n/**\n * Context service containing the OpenTelemetry `Tracer` used to create spans for Effect tracing.\n *\n * @category services\n * @since 4.0.0\n */\nexport class OtelTracer extends /*#__PURE__*/Context.Service()(\"@effect/opentelemetry/Tracer\") {}\n/**\n * Context service containing the OpenTelemetry `TracerProvider` used to obtain tracers.\n *\n * @category services\n * @since 4.0.0\n */\nexport class OtelTracerProvider extends /*#__PURE__*/Context.Service()(\"@effect/opentelemetry/Tracer/OtelTracerProvider\") {}\n/**\n * Context service containing OpenTelemetry trace flags used when constructing external span contexts.\n *\n * @category services\n * @since 4.0.0\n */\nexport class OtelTraceFlags extends /*#__PURE__*/Context.Service()(\"@effect/opentelemetry/Tracer/OtelTraceFlags\") {}\n/**\n * Context service containing OpenTelemetry trace state used when constructing external span contexts.\n *\n * @category services\n * @since 4.0.0\n */\nexport class OtelTraceState extends /*#__PURE__*/Context.Service()(\"@effect/opentelemetry/Tracer/OtelTraceState\") {}\n// =============================================================================\n// Constructors\n// =============================================================================\n/**\n * Creates an Effect `Tracer` implementation backed by the configured OpenTelemetry tracer.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = /*#__PURE__*/Effect.map(/*#__PURE__*/Effect.service(OtelTracer), tracer => Tracer.make({\n span(options) {\n return new OtelSpan(Otel.context, Otel.trace, tracer, options);\n },\n context(primitive, fiber) {\n const currentSpan = fiber.currentSpan;\n if (currentSpan === undefined) {\n return primitive[\"~effect/Effect/evaluate\"](fiber);\n }\n return Otel.context.with(populateContext(Otel.context.active(), currentSpan), () => primitive[\"~effect/Effect/evaluate\"](fiber));\n }\n}));\n/**\n * Creates an Effect external span from an OpenTelemetry span context, preserving trace flags and trace state when provided.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const makeExternalSpan = options => {\n const annotations = Context.mutate(Context.empty(), annotations => {\n let next = annotations;\n if (options.traceFlags !== undefined) {\n next = Context.add(next, OtelTraceFlags, options.traceFlags);\n }\n if (typeof options.traceState === \"string\") {\n try {\n next = Context.add(next, OtelTraceState, Otel.createTraceState(options.traceState));\n } catch {\n //\n }\n } else if (options.traceState) {\n next = Context.add(next, OtelTraceState, options.traceState);\n }\n return next;\n });\n return {\n _tag: \"ExternalSpan\",\n traceId: options.traceId,\n spanId: options.spanId,\n sampled: Predicate.isNotUndefined(options.traceFlags) ? isSampled(options.traceFlags) : true,\n annotations\n };\n};\n// =============================================================================\n// Layers\n// =============================================================================\n/**\n * Layer that provides the current global OpenTelemetry tracer provider.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerGlobalProvider = /*#__PURE__*/Layer.sync(OtelTracerProvider, () => Otel.trace.getTracerProvider());\n/**\n * Layer that creates an OpenTelemetry tracer from the provided tracer provider and resource metadata.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerTracer = /*#__PURE__*/Layer.effect(OtelTracer, /*#__PURE__*/Effect.gen(function* () {\n const resource = yield* Resource;\n const provider = yield* OtelTracerProvider;\n return provider.getTracer(resource.attributes[OtelSemConv.ATTR_SERVICE_NAME], resource.attributes[OtelSemConv.ATTR_SERVICE_VERSION]);\n}));\n/**\n * Layer that creates an OpenTelemetry tracer from the global tracer provider and the current resource.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerGlobalTracer = /*#__PURE__*/layerTracer.pipe(/*#__PURE__*/Layer.provide(layerGlobalProvider));\n/**\n * Layer that installs an Effect tracer backed by the global OpenTelemetry tracer provider.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerGlobal = /*#__PURE__*/Layer.effect(Tracer.Tracer, make).pipe(/*#__PURE__*/Layer.provideMerge(layerGlobalTracer));\n/**\n * Layer that installs the Effect tracer using an `OtelTracer` already provided in the environment.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerWithoutOtelTracer = /*#__PURE__*/Layer.effect(Tracer.Tracer, make);\n/**\n * Layer that creates an OpenTelemetry tracer from a provider and resource, then installs it as the Effect tracer.\n *\n * **When to use**\n *\n * Use when your application already supplies an `OtelTracerProvider` and a\n * `Resource`, and you want Effect spans to be created by an OpenTelemetry\n * tracer derived from those services.\n *\n * @see {@link layerTracer} for creating only the OpenTelemetry tracer service\n * @see {@link layerGlobal} for installing the Effect tracer from the global provider\n * @see {@link layerWithoutOtelTracer} for installing an already-provided `OtelTracer`\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = /*#__PURE__*/layerWithoutOtelTracer.pipe(/*#__PURE__*/Layer.provideMerge(layerTracer));\n// =============================================================================\n// Utilities / Combinators\n// =============================================================================\nconst bigint1e6 = /*#__PURE__*/BigInt(1_000_000);\nconst bigint1e9 = /*#__PURE__*/BigInt(1_000_000_000);\n/**\n * Gets the current OpenTelemetry span.\n *\n * **Details**\n *\n * This accessor works with both the official OpenTelemetry API, such as\n * `Tracer.layer` and `NodeSdk.layer`, and the lightweight OTLP module, such as\n * `OtlpTracer.layer`. When using OTLP, the returned span is a wrapper that\n * conforms to the OpenTelemetry `Span` interface.\n *\n * @category accessors\n * @since 4.0.0\n */\nexport const currentOtelSpan = /*#__PURE__*/Effect.clockWith(clock => Effect.map(Effect.currentSpan, span => OtelSpanTypeId in span ? span.span : makeOtelSpan(span, clock)));\nconst makeOtelSpan = (span, clock) => {\n const spanContext = {\n traceId: span.traceId,\n spanId: span.spanId,\n traceFlags: span.sampled ? Otel.TraceFlags.SAMPLED : Otel.TraceFlags.NONE,\n isRemote: false\n };\n let exit = Exit.void;\n const self = {\n spanContext: () => spanContext,\n setAttribute(key, value) {\n span.attribute(key, value);\n return self;\n },\n setAttributes(attributes) {\n for (const [key, value] of Object.entries(attributes)) {\n span.attribute(key, value);\n }\n return self;\n },\n addEvent(name) {\n let attributes = undefined;\n let startTime = undefined;\n if (arguments.length === 3) {\n attributes = arguments[1];\n startTime = arguments[2];\n } else {\n startTime = arguments[1];\n }\n span.event(name, convertOtelTimeInput(startTime, clock), attributes);\n return self;\n },\n addLink(link) {\n span.addLinks([{\n span: makeExternalSpan(link.context),\n attributes: link.attributes ?? {}\n }]);\n return self;\n },\n addLinks(links) {\n span.addLinks(links.map(link => ({\n span: makeExternalSpan(link.context),\n attributes: link.attributes ?? {}\n })));\n return self;\n },\n setStatus(status) {\n exit = Otel.SpanStatusCode.ERROR ? Exit.die(status.message ?? \"Unknown error\") : Exit.void;\n return self;\n },\n updateName: () => self,\n end(endTime) {\n const time = convertOtelTimeInput(endTime, clock);\n span.end(time, exit);\n return self;\n },\n isRecording: constTrue,\n recordException(exception, timeInput) {\n const time = convertOtelTimeInput(timeInput, clock);\n const cause = Cause.fail(exception);\n const error = Cause.prettyErrors(cause)[0];\n span.event(error.message, time, {\n \"exception.type\": error.name,\n \"exception.message\": error.message,\n \"exception.stacktrace\": error.stack ?? \"\"\n });\n }\n };\n return self;\n};\nconst convertOtelTimeInput = (input, clock) => {\n if (input === undefined) {\n return clock.currentTimeNanosUnsafe();\n } else if (typeof input === \"number\") {\n return BigInt(Math.round(input * 1_000_000));\n } else if (input instanceof Date) {\n return BigInt(input.getTime()) * bigint1e6;\n }\n const [seconds, nanos] = input;\n return BigInt(seconds) * bigint1e9 + BigInt(nanos);\n};\n/**\n * Sets an effect's parent span from the given OpenTelemetry `SpanContext`.\n *\n * **When to use**\n *\n * Use when OpenTelemetry instrumentation outside Effect has already\n * produced a parent span context and an effect should continue that trace.\n *\n * @category propagation\n * @since 4.0.0\n */\nexport const withSpanContext = /*#__PURE__*/dual(2, (self, spanContext) => Effect.withParentSpan(self, makeExternalSpan(spanContext)));\n// =============================================================================\n// Internals\n// =============================================================================\nconst OtelSpanTypeId = \"~@effect/opentelemetry/Tracer/OtelSpan\";\nconst kindMap = {\n \"internal\": Otel.SpanKind.INTERNAL,\n \"client\": Otel.SpanKind.CLIENT,\n \"server\": Otel.SpanKind.SERVER,\n \"producer\": Otel.SpanKind.PRODUCER,\n \"consumer\": Otel.SpanKind.CONSUMER\n};\n/** @internal */\nexport class OtelSpan {\n [OtelSpanTypeId];\n _tag = \"Span\";\n name;\n kind;\n annotations;\n links;\n span;\n spanId;\n traceId;\n attributes = /*#__PURE__*/new Map();\n sampled;\n parent;\n status;\n constructor(contextApi, traceApi, tracer, options) {\n this[OtelSpanTypeId] = OtelSpanTypeId;\n this.name = options.name;\n this.annotations = options.annotations;\n this.links = options.links;\n this.kind = options.kind;\n const active = contextApi.active();\n this.parent = options.root !== true ? Option.orElse(options.parent, () => getOtelParent(traceApi, active, options.annotations)) : options.parent;\n this.span = tracer.startSpan(options.name, {\n startTime: nanosToHrTime(options.startTime),\n links: options.links.length > 0 ? options.links.map(link => ({\n context: makeSpanContext(link.span),\n attributes: recordToAttributes(link.attributes)\n })) : undefined,\n kind: kindMap[this.kind]\n }, Option.isSome(this.parent) ? populateContext(active, this.parent.value, options.annotations) : Otel.trace.deleteSpan(active));\n const spanContext = this.span.spanContext();\n this.spanId = spanContext.spanId;\n this.traceId = spanContext.traceId;\n this.status = {\n _tag: \"Started\",\n startTime: options.startTime\n };\n this.sampled = isSampled(spanContext.traceFlags);\n }\n attribute(key, value) {\n this.span.setAttribute(key, unknownToAttributeValue(value));\n this.attributes.set(key, value);\n }\n addLinks(links) {\n // oxlint-disable-next-line no-restricted-syntax\n this.links.push(...links);\n this.span.addLinks(links.map(link => ({\n context: makeSpanContext(link.span),\n attributes: recordToAttributes(link.attributes)\n })));\n }\n end(endTime, exit) {\n const hrTime = nanosToHrTime(endTime);\n this.status = {\n _tag: \"Ended\",\n endTime,\n exit,\n startTime: this.status.startTime\n };\n if (exit._tag === \"Success\") {\n this.span.setStatus({\n code: Otel.SpanStatusCode.OK\n });\n } else {\n if (Cause.hasInterruptsOnly(exit.cause)) {\n this.span.setStatus({\n code: Otel.SpanStatusCode.OK,\n message: Cause.pretty(exit.cause)\n });\n this.span.setAttribute(\"span.label\", \"⚠︎ Interrupted\");\n this.span.setAttribute(\"status.interrupted\", true);\n } else {\n const errors = Cause.prettyErrors(exit.cause);\n if (errors.length > 0) {\n for (const error of errors) {\n this.span.recordException(error, hrTime);\n }\n this.span.setStatus({\n code: Otel.SpanStatusCode.ERROR,\n message: errors[0].message\n });\n } else {\n // empty cause means no error\n this.span.setStatus({\n code: Otel.SpanStatusCode.OK\n });\n }\n }\n }\n this.span.end(hrTime);\n }\n event(name, startTime, attributes) {\n this.span.addEvent(name, attributes ? recordToAttributes(attributes) : undefined, nanosToHrTime(startTime));\n }\n}\nconst isSampled = traceFlags => (traceFlags & Otel.TraceFlags.SAMPLED) === Otel.TraceFlags.SAMPLED;\nconst getOtelParent = (tracer, context, annotations) => {\n const otelParent = tracer.getSpan(context)?.spanContext();\n if (!otelParent) return Option.none();\n return Option.some(Tracer.externalSpan({\n spanId: otelParent.spanId,\n traceId: otelParent.traceId,\n sampled: (otelParent.traceFlags & 1) === 1,\n annotations\n }));\n};\nconst makeSpanContext = (span, annotations) => {\n const traceFlags = makeTraceFlags(span, annotations);\n const traceState = makeTraceState(span, annotations);\n return {\n spanId: span.spanId,\n traceId: span.traceId,\n isRemote: span._tag === \"ExternalSpan\",\n traceFlags,\n traceState\n };\n};\nconst makeTraceFlags = (span, annotations) => {\n let traceFlags;\n if (Predicate.isNotUndefined(annotations)) {\n traceFlags = extractTraceService(span, annotations, OtelTraceFlags);\n if (Predicate.isUndefined(traceFlags)) {\n traceFlags = Context.getOrUndefined(span.annotations, OtelTraceFlags);\n }\n }\n return traceFlags ?? Otel.TraceFlags.SAMPLED;\n};\nconst makeTraceState = (span, annotations) => {\n let traceState;\n if (Predicate.isNotUndefined(annotations)) {\n traceState = extractTraceService(span, annotations, OtelTraceState);\n if (Predicate.isUndefined(traceState)) {\n traceState = Context.getOrUndefined(span.annotations, OtelTraceState);\n }\n }\n return traceState;\n};\nconst extractTraceService = (parent, annotations, service) => {\n const instance = Context.getOrUndefined(annotations, service);\n if (Predicate.isNotUndefined(instance)) {\n return instance;\n }\n return Context.getOrUndefined(parent.annotations, service);\n};\nconst populateContext = (context, span, annotations) => span instanceof OtelSpan ? Otel.trace.setSpan(context, span.span) : Otel.trace.setSpanContext(context, makeSpanContext(span, annotations));\n//# sourceMappingURL=Tracer.js.map"
|
|
33
|
+
],
|
|
34
|
+
"mappings": ";swBACA,YAAO,oBAAe,QAAS,kBAAc,MAAE,MAAO,EAAK,CAAC,EACpD,sBAA0B,OAKlC,IAAM,QACA,QACA,MACA,QACN,SAAS,EAAmB,CAAC,EAAgB,CAEzC,GAAI,IAAmB,KACnB,OAGJ,GAAI,IAAmB,OAAW,CAC9B,IAAM,EAAwB,IAAI,GAAsB,gCACxD,EAAsB,OAAO,EAC7B,EAAM,QAAQ,wBAAwB,CAAqB,EAC3D,OAEJ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AiB,EAAO,gBACxB,YAAa,EAAO,iBACtB,CAAC,EAAU,GACL,EAAa,GAAW,EAAO,kBAAkB,EAAU,GAAe,GAAM,CACpF,kBAAmB,EAAO,uBAC5B,CAAC,EAAU,GAAoB,EAAO,mBAAoB,IACrD,EAAO,qBACV,gBAAiB,EAAO,eAC1B,CAAC,CAAC,EAAU,GACZ,OAAa,GAAS,EAAY,EAAa,CAAU,EAAE,KAAW,GAAa,CAAY,CAAC,EACjG,CAAC,EAOW,GAAsB",
|
|
35
|
+
"debugId": "0C79C2F5FE1C7FA864756E2164756E21",
|
|
36
|
+
"names": []
|
|
37
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../node_modules/.bun/ai-gateway-provider@3.1.2+a6631614dda8d488/node_modules/ai-gateway-provider/dist/index.mjs"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"var __defProp = Object.defineProperty;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== \"symbol\" ? key + \"\" : key, value);\n\n// src/auth.ts\nvar CF_TEMP_TOKEN = \"CF_TEMP_TOKEN\";\n\n// src/providers.ts\nvar providers = [\n {\n name: \"openai\",\n regex: /^https:\\/\\/api\\.openai\\.com\\//,\n transformEndpoint: (url) => url.replace(/^https:\\/\\/api\\.openai\\.com\\//, \"\")\n },\n {\n name: \"deepseek\",\n regex: /^https:\\/\\/api\\.deepseek\\.com\\//,\n transformEndpoint: (url) => url.replace(/^https:\\/\\/api\\.deepseek\\.com\\//, \"\")\n },\n {\n name: \"anthropic\",\n regex: /^https:\\/\\/api\\.anthropic\\.com\\//,\n transformEndpoint: (url) => url.replace(/^https:\\/\\/api\\.anthropic\\.com\\//, \"\"),\n headerKey: \"x-api-key\"\n },\n {\n name: \"google-ai-studio\",\n regex: /^https:\\/\\/generativelanguage\\.googleapis\\.com\\//,\n headerKey: \"x-goog-api-key\",\n transformEndpoint: (url) => url.replace(/^https:\\/\\/generativelanguage\\.googleapis\\.com\\//, \"\")\n },\n {\n name: \"google-vertex-ai\",\n regex: /aiplatform\\.googleapis\\.com/,\n transformEndpoint: (url) => url.replace(/https:\\/\\/(.*)[-]?aiplatform\\.googleapis\\.com\\//, \"\")\n },\n {\n name: \"grok\",\n regex: /^https:\\/\\/api\\.x\\.ai\\//,\n transformEndpoint: (url) => url.replace(/^https:\\/\\/api\\.x\\.ai\\//, \"\")\n },\n {\n name: \"mistral\",\n regex: /^https:\\/\\/api\\.mistral\\.ai\\//,\n transformEndpoint: (url) => url.replace(/^https:\\/\\/api\\.mistral\\.ai\\//, \"\")\n },\n {\n name: \"perplexity-ai\",\n regex: /^https:\\/\\/api\\.perplexity\\.ai\\//,\n transformEndpoint: (url) => url.replace(/^https:\\/\\/api\\.perplexity\\.ai\\//, \"\")\n },\n {\n name: \"replicate\",\n regex: /^https:\\/\\/api\\.replicate\\.com\\//,\n transformEndpoint: (url) => url.replace(/^https:\\/\\/api\\.replicate\\.com\\//, \"\")\n },\n {\n name: \"groq\",\n regex: /^https:\\/\\/api\\.groq\\.com\\/openai\\/v1\\//,\n transformEndpoint: (url) => url.replace(/^https:\\/\\/api\\.groq\\.com\\/openai\\/v1\\//, \"\")\n },\n {\n name: \"google-vertex-ai\",\n regex: /^https:\\/\\/(?:[a-z0-9]+-)*aiplatform\\.googleapis\\.com\\//,\n transformEndpoint: (url) => url.replace(/^https:\\/\\/(?:[a-z0-9]+-)*aiplatform\\.googleapis\\.com\\//, \"\"),\n headerKey: \"authorization\"\n },\n {\n name: \"azure-openai\",\n regex: /^https:\\/\\/(?<resource>[^.]+)\\.openai\\.azure\\.com\\/openai\\/deployments\\/(?<deployment>[^/]+)\\/(?<rest>.*)$/,\n transformEndpoint: (url) => {\n const match = url.match(\n /^https:\\/\\/(?<resource>[^.]+)\\.openai\\.azure\\.com\\/openai\\/deployments\\/(?<deployment>[^/]+)\\/(?<rest>.*)$/\n );\n if (!match || !match.groups) return url;\n const { resource, deployment, rest } = match.groups;\n if (!resource || !deployment || !rest) {\n throw new Error(\"Failed to parse Azure OpenAI endpoint URL.\");\n }\n return `${resource}/${deployment}/${rest}`;\n },\n headerKey: \"api-key\"\n },\n {\n name: \"openrouter\",\n regex: /^https:\\/\\/openrouter\\.ai\\/api\\//,\n transformEndpoint: (url) => url.replace(/^https:\\/\\/openrouter\\.ai\\/api\\//, \"\")\n },\n {\n name: \"compat\",\n regex: /^https:\\/\\/gateway\\.ai\\.cloudflare\\.com\\/v1\\/compat\\//,\n transformEndpoint: (url) => url.replace(/^https:\\/\\/gateway\\.ai\\.cloudflare\\.com\\/v1\\/compat\\//, \"\")\n }\n];\n\n// src/index.ts\nvar AiGatewayInternalFetchError = class extends Error {\n};\nvar AiGatewayDoesNotExist = class extends Error {\n};\nvar AiGatewayUnauthorizedError = class extends Error {\n};\nasync function streamToObject(stream) {\n const response = new Response(stream);\n return await response.json();\n}\nvar AiGatewayChatLanguageModel = class {\n constructor(models, config) {\n __publicField(this, \"specificationVersion\", \"v3\");\n __publicField(this, \"defaultObjectGenerationMode\", \"json\");\n __publicField(this, \"supportedUrls\", {\n // No URLS are supported for this language model\n });\n __publicField(this, \"models\");\n __publicField(this, \"config\");\n this.models = models;\n this.config = config;\n }\n get modelId() {\n if (!this.models[0]) {\n throw new Error(\"models cannot be empty array\");\n }\n return this.models[0].modelId;\n }\n get provider() {\n if (!this.models[0]) {\n throw new Error(\"models cannot be empty array\");\n }\n return this.models[0].provider;\n }\n async processModelRequest(options, modelMethod) {\n const requests = [];\n for (const model of this.models) {\n if (!model.config || !Object.keys(model.config).includes(\"fetch\")) {\n throw new Error(\n `Sorry, but provider \"${model.provider}\" is currently not supported, please open a issue in the github repo!`\n );\n }\n model.config.fetch = (url, request) => {\n requests.push({\n modelProvider: model.provider,\n request,\n url\n });\n throw new AiGatewayInternalFetchError(\"Stopping provider execution...\");\n };\n try {\n await model[modelMethod](options);\n } catch (e) {\n if (!(e instanceof AiGatewayInternalFetchError)) {\n throw e;\n }\n }\n }\n const body = await Promise.all(\n requests.map(async (req) => {\n let providerConfig = null;\n for (const provider of providers) {\n if (provider.regex.test(req.url)) {\n providerConfig = provider;\n }\n }\n if (!providerConfig) {\n throw new Error(\n `Sorry, but provider \"${req.modelProvider}\" is currently not supported, please open a issue in the github repo!`\n );\n }\n if (!req.request.body) {\n throw new Error(\"Ai Gateway provider received an unexpected empty body\");\n }\n const authHeader = providerConfig.headerKey ?? \"authorization\";\n const authValue = \"get\" in req.request.headers ? req.request.headers.get(authHeader) : req.request.headers[authHeader];\n if (authValue?.indexOf(CF_TEMP_TOKEN) !== -1) {\n if (\"delete\" in req.request.headers) {\n req.request.headers.delete(authHeader);\n } else {\n delete req.request.headers[authHeader];\n }\n }\n return {\n endpoint: providerConfig.transformEndpoint(req.url),\n headers: req.request.headers,\n provider: providerConfig.name,\n query: await streamToObject(req.request.body)\n };\n })\n );\n const headers = parseAiGatewayOptions(this.config.options ?? {});\n let resp;\n if (\"binding\" in this.config) {\n const updatedBody = body.map((obj) => ({\n ...obj,\n headers: {\n ...obj.headers ?? {},\n ...Object.fromEntries(headers.entries())\n }\n }));\n resp = await this.config.binding.run(updatedBody, {\n signal: options.abortSignal\n });\n } else {\n headers.set(\"Content-Type\", \"application/json\");\n headers.set(\"cf-aig-authorization\", `Bearer ${this.config.apiKey}`);\n resp = await fetch(\n `https://gateway.ai.cloudflare.com/v1/${this.config.accountId}/${this.config.gateway}`,\n {\n body: JSON.stringify(body),\n headers,\n method: \"POST\",\n signal: options.abortSignal\n }\n );\n }\n if (resp.status === 400) {\n const cloneResp = resp.clone();\n const result = await cloneResp.json();\n if (result.success === false && result.error && result.error.length > 0 && result.error[0]?.code === 2001) {\n throw new AiGatewayDoesNotExist(\"This AI gateway does not exist\");\n }\n } else if (resp.status === 401) {\n const cloneResp = resp.clone();\n const result = await cloneResp.json();\n if (result.success === false && result.error && result.error.length > 0 && result.error[0]?.code === 2009) {\n throw new AiGatewayUnauthorizedError(\n \"Your AI Gateway has authentication active, but you didn't provide a valid apiKey\"\n );\n }\n }\n const step = Number.parseInt(resp.headers.get(\"cf-aig-step\") ?? \"0\", 10);\n if (!this.models[step]) {\n throw new Error(\"Unexpected AI Gateway Error\");\n }\n this.models[step].config = {\n ...this.models[step].config,\n fetch: (_url, _req) => resp\n };\n return this.models[step][modelMethod](options);\n }\n async doStream(options) {\n return this.processModelRequest(options, \"doStream\");\n }\n async doGenerate(options) {\n return this.processModelRequest(options, \"doGenerate\");\n }\n};\nfunction createAiGateway(options) {\n const createChatModel = (models) => {\n return new AiGatewayChatLanguageModel(Array.isArray(models) ? models : [models], options);\n };\n const provider = (models) => createChatModel(models);\n provider.chat = createChatModel;\n return provider;\n}\nfunction parseAiGatewayOptions(options) {\n const headers = new Headers();\n if (options.skipCache === true) {\n headers.set(\"cf-skip-cache\", \"true\");\n }\n if (options.cacheTtl) {\n headers.set(\"cf-cache-ttl\", options.cacheTtl.toString());\n }\n if (options.metadata) {\n headers.set(\"cf-aig-metadata\", JSON.stringify(options.metadata));\n }\n if (options.cacheKey) {\n headers.set(\"cf-aig-cache-key\", options.cacheKey);\n }\n if (options.collectLog !== void 0) {\n headers.set(\"cf-aig-collect-log\", options.collectLog === true ? \"true\" : \"false\");\n }\n if (options.eventId !== void 0) {\n headers.set(\"cf-aig-event-id\", options.eventId);\n }\n if (options.requestTimeoutMs !== void 0) {\n headers.set(\"cf-aig-request-timeout\", options.requestTimeoutMs.toString());\n }\n if (options.retries !== void 0) {\n if (options.retries.maxAttempts !== void 0) {\n headers.set(\"cf-aig-max-attempts\", options.retries.maxAttempts.toString());\n }\n if (options.retries.retryDelayMs !== void 0) {\n headers.set(\"cf-aig-retry-delay\", options.retries.retryDelayMs.toString());\n }\n if (options.retries.backoff !== void 0) {\n headers.set(\"cf-aig-backoff\", options.retries.backoff);\n }\n }\n return headers;\n}\nexport {\n AiGatewayChatLanguageModel,\n AiGatewayDoesNotExist,\n AiGatewayInternalFetchError,\n AiGatewayUnauthorizedError,\n createAiGateway,\n parseAiGatewayOptions\n};\n//# sourceMappingURL=index.mjs.map"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";uCAAA,IAAI,EAAY,OAAO,eACnB,EAAkB,CAAC,EAAK,EAAK,KAAU,KAAO,GAAM,EAAU,EAAK,EAAK,CAAE,WAAY,GAAM,aAAc,GAAM,SAAU,GAAM,OAAM,CAAC,EAAI,EAAI,GAAO,EACtJ,EAAgB,CAAC,EAAK,EAAK,IAAU,EAAgB,EAAK,OAAO,IAAQ,SAAW,EAAM,GAAK,EAAK,CAAK,EAGzG,EAAgB,gBAGhB,EAAY,CACd,CACE,KAAM,SACN,MAAO,gCACP,kBAAmB,CAAC,IAAQ,EAAI,QAAQ,gCAAiC,EAAE,CAC7E,EACA,CACE,KAAM,WACN,MAAO,kCACP,kBAAmB,CAAC,IAAQ,EAAI,QAAQ,kCAAmC,EAAE,CAC/E,EACA,CACE,KAAM,YACN,MAAO,mCACP,kBAAmB,CAAC,IAAQ,EAAI,QAAQ,mCAAoC,EAAE,EAC9E,UAAW,WACb,EACA,CACE,KAAM,mBACN,MAAO,mDACP,UAAW,iBACX,kBAAmB,CAAC,IAAQ,EAAI,QAAQ,mDAAoD,EAAE,CAChG,EACA,CACE,KAAM,mBACN,MAAO,8BACP,kBAAmB,CAAC,IAAQ,EAAI,QAAQ,kDAAmD,EAAE,CAC/F,EACA,CACE,KAAM,OACN,MAAO,0BACP,kBAAmB,CAAC,IAAQ,EAAI,QAAQ,0BAA2B,EAAE,CACvE,EACA,CACE,KAAM,UACN,MAAO,gCACP,kBAAmB,CAAC,IAAQ,EAAI,QAAQ,gCAAiC,EAAE,CAC7E,EACA,CACE,KAAM,gBACN,MAAO,mCACP,kBAAmB,CAAC,IAAQ,EAAI,QAAQ,mCAAoC,EAAE,CAChF,EACA,CACE,KAAM,YACN,MAAO,mCACP,kBA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BA117B64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../node_modules/.bun/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/token.js"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar token_exports = {};\n__export(token_exports, {\n refreshToken: () => refreshToken\n});\nmodule.exports = __toCommonJS(token_exports);\nvar import_token_error = require(\"./token-error\");\nvar import_token_util = require(\"./token-util\");\nasync function refreshToken(options) {\n let projectId = options?.project;\n let teamId = options?.team;\n if (!projectId && !teamId) {\n const projectInfo = (0, import_token_util.findProjectInfo)();\n projectId = projectInfo.projectId;\n teamId = projectInfo.teamId;\n } else if (!projectId || !teamId) {\n const projectInfo = (0, import_token_util.findProjectInfo)();\n projectId = projectId ?? projectInfo.projectId;\n teamId = teamId ?? projectInfo.teamId;\n }\n if (!projectId) {\n throw new import_token_error.VercelOidcTokenError(\n \"Failed to refresh OIDC token: No project specified. Try re-linking your project with `vc link`\"\n );\n }\n let maybeToken = (0, import_token_util.loadToken)(projectId);\n if (!maybeToken || (0, import_token_util.isExpired)((0, import_token_util.getTokenPayload)(maybeToken.token), options?.expirationBufferMs)) {\n const authToken = await (0, import_token_util.getVercelToken)({\n expirationBufferMs: options?.expirationBufferMs\n });\n maybeToken = await (0, import_token_util.getVercelOidcToken)(authToken, projectId, teamId);\n if (!maybeToken) {\n throw new import_token_error.VercelOidcTokenError(\"Failed to refresh OIDC token\");\n }\n (0, import_token_util.saveToken)(maybeToken, projectId);\n }\n process.env.VERCEL_OIDC_TOKEN = maybeToken.token;\n return;\n}\n// Annotate the CommonJS export names for ESM import in node:\n0 && (module.exports = {\n refreshToken\n});\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";yHACA,SAAuB,eAAnB,EAC0B,yBAA1B,EAC2B,oBAA3B,GADmB,OAEnB,EAAe,OAAO,UAAU,eAChC,EAAW,CAAC,EAAQ,IAAQ,CAC9B,QAAS,KAAQ,EACf,EAAU,EAAQ,EAAM,CAAE,IAAK,EAAI,GAAO,WAAY,EAAK,CAAC,GAE5D,EAAc,CAAC,EAAI,EAAM,EAAQ,IAAS,CAC5C,GAAI,GAAQ,OAAO,IAAS,UAAY,OAAO,IAAS,YACtD,QAAS,KAAO,EAAkB,CAAI,EACpC,GAAI,CAAC,EAAa,KAAK,EAAI,CAAG,GAAK,IAAQ,EACzC,EAAU,EAAI,EAAK,CAAE,IAAK,IAAM,EAAK,GAAM,WAAY,EAAE,EAAO,EAAiB,EAAM,CAAG,IAAM,EAAK,UAAW,CAAC,EAEvH,OAAO,GAEL,EAAe,CAAC,IAAQ,EAAY,EAAU,CAAC,EAAG,aAAc,CAAE,MAAO,EAAK,CAAC,EAAG,CAAG,EACrF,EAAgB,CAAC,EACrB,EAAS,EAAe,CACtB,aAAc,IAAM,CACtB,CAAC,EACD,EAAO,QAAU,EAAa,CAAa,EAC3C,IAAI,MACA,MACJ,eAAe,CAAY,CAAC,EAAS,CACnC,IAAI,EAAY,GAAS,QACrB,EAAS,GAAS,KACtB,GAAI,CAAC,GAAa,CAAC,EAAQ,CACzB,IAAM,GAAe,EAAG,EAAkB,iBAAiB,EAC3D,EAAY,EAAY,UACxB,EAAS,EAAY,OAChB,QAAI,CAAC,GAAa,CAAC,EAAQ,CAChC,IAAM,GAAe,EAAG,EAAkB,iBAAiB,EAC3D,EAAY,GAAa,EAAY,UACrC,EAAS,GAAU,EAAY,OAEjC,GAAI,CAAC,EACH,MAAM,IAAI,EAAmB,qBAC3B,gGACF,EAEF,IAAI,GAAc,EAAG,EAAkB,WAAW,CAAS,EAC3D,GAAI,CAAC,IAAe,EAAG,EAAkB,YAAY,EAAG,EAAkB,iBAAiB,EAAW,KAAK,EAAG,GAAS,kBAAkB,EAAG,CAC1I,IAAM,EAAY,MAAO,EAAG,EAAkB,gBAAgB,CAC5D,mBAAoB,GAAS,kBAC/B,CAAC,EAED,GADA,EAAa,MAAO,EAAG,EAAkB,oBAAoB,EAAW,EAAW,CAAM,EACrF,CAAC,EACH,MAAM,IAAI,EAAmB,qBAAqB,8BAA8B,GAEjF,EAAG,EAAkB,WAAW,EAAY,CAAS,EAExD,QAAQ,IAAI,kBAAoB,EAAW,MAC3C",
|
|
8
|
+
"debugId": "CFC0F727EFE7BD1864756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../core/src/database/migration/20260604172448_event_sourced_session_input.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { Effect } from \"effect\"\nimport type { DatabaseMigration } from \"../migration\"\n\nexport default {\n id: \"20260604172448_event_sourced_session_input\",\n up(tx) {\n return Effect.gen(function* () {\n yield* tx.run(`DELETE FROM \\`session_input\\`;`)\n yield* tx.run(`DELETE FROM \\`session_message\\`;`)\n yield* tx.run(`DELETE FROM \\`event\\`;`)\n yield* tx.run(`DELETE FROM \\`event_sequence\\`;`)\n yield* tx.run(`UPDATE \\`session\\` SET \\`workspace_id\\` = NULL;`)\n yield* tx.run(`DELETE FROM \\`workspace\\`;`)\n yield* tx.run(`DROP INDEX IF EXISTS \\`event_aggregate_seq_idx\\`;`)\n yield* tx.run(`CREATE UNIQUE INDEX \\`event_aggregate_seq_idx\\` ON \\`event\\` (\\`aggregate_id\\`,\\`seq\\`);`)\n yield* tx.run(`DROP INDEX IF EXISTS \\`session_message_session_seq_idx\\`;`)\n yield* tx.run(\n `CREATE UNIQUE INDEX \\`session_message_session_seq_idx\\` ON \\`session_message\\` (\\`session_id\\`,\\`seq\\`);`,\n )\n yield* tx.run(`PRAGMA foreign_keys=OFF;`)\n yield* tx.run(`\n CREATE TABLE \\`__new_session_input\\` (\n \\`id\\` text PRIMARY KEY,\n \\`session_id\\` text NOT NULL,\n \\`prompt\\` text NOT NULL,\n \\`delivery\\` text NOT NULL,\n \\`admitted_seq\\` integer NOT NULL,\n \\`promoted_seq\\` integer,\n \\`time_created\\` integer NOT NULL,\n CONSTRAINT \\`fk_session_input_session_id_session_id_fk\\` FOREIGN KEY (\\`session_id\\`) REFERENCES \\`session\\`(\\`id\\`) ON DELETE CASCADE\n );\n `)\n yield* tx.run(`DROP TABLE \\`session_input\\`;`)\n yield* tx.run(`ALTER TABLE \\`__new_session_input\\` RENAME TO \\`session_input\\`;`)\n yield* tx.run(`PRAGMA foreign_keys=ON;`)\n yield* tx.run(\n `CREATE INDEX \\`session_input_session_pending_delivery_seq_idx\\` ON \\`session_input\\` (\\`session_id\\`,\\`promoted_seq\\`,\\`delivery\\`,\\`admitted_seq\\`);`,\n )\n yield* tx.run(\n `CREATE UNIQUE INDEX \\`session_input_session_admitted_seq_idx\\` ON \\`session_input\\` (\\`session_id\\`,\\`admitted_seq\\`);`,\n )\n yield* tx.run(\n `CREATE UNIQUE INDEX \\`session_input_session_promoted_seq_idx\\` ON \\`session_input\\` (\\`session_id\\`,\\`promoted_seq\\`);`,\n )\n })\n },\n} satisfies DatabaseMigration.Migration\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";wHAGA,SAAe,QACb,GAAI,6CACJ,EAAE,CAAC,EAAI,CACL,OAAO,EAAO,IAAI,SAAU,EAAG,CAC7B,MAAO,EAAG,IAAI,8BAAgC,EAC9C,MAAO,EAAG,IAAI,gCAAkC,EAChD,MAAO,EAAG,IAAI,sBAAwB,EACtC,MAAO,EAAG,IAAI,+BAAiC,EAC/C,MAAO,EAAG,IAAI,6CAAiD,EAC/D,MAAO,EAAG,IAAI,0BAA4B,EAC1C,MAAO,EAAG,IAAI,iDAAmD,EACjE,MAAO,EAAG,IAAI,kFAA0F,EACxG,MAAO,EAAG,IAAI,yDAA2D,EACzE,MAAO,EAAG,IACR,kGACF,EACA,MAAO,EAAG,IAAI,0BAA0B,EACxC,MAAO,EAAG,IAAI,0dAWb,EACD,MAAO,EAAG,IAAI,6BAA+B,EAC7C,MAAO,EAAG,IAAI,8DAAkE,EAChF,MAAO,EAAG,IAAI,yBAAyB,EACvC,MAAO,EAAG,IACR,2IACF,EACA,MAAO,EAAG,IACR,gHACF,EACA,MAAO,EAAG,IACR,gHACF,EACD,EAEL",
|
|
8
|
+
"debugId": "264C4C92D530297264756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|