@smoothbricks/lmao 0.2.2 → 0.3.0
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/README.md +206 -206
- package/dist/allocator.wasm +0 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/lib/JsBufferStrategy.d.ts +4 -3
- package/dist/lib/JsBufferStrategy.d.ts.map +1 -1
- package/dist/lib/JsBufferStrategy.js +18 -11
- package/dist/lib/arrow/lease.d.ts +10 -0
- package/dist/lib/arrow/lease.d.ts.map +1 -0
- package/dist/lib/arrow/lease.js +33 -0
- package/dist/lib/arrow/utils.d.ts +3 -4
- package/dist/lib/arrow/utils.d.ts.map +1 -1
- package/dist/lib/arrow/utils.js +12 -13
- package/dist/lib/arrow/vocabularyDictionary.d.ts +21 -0
- package/dist/lib/arrow/vocabularyDictionary.d.ts.map +1 -0
- package/dist/lib/arrow/vocabularyDictionary.js +95 -0
- package/dist/lib/bufferStrategy.d.ts +3 -2
- package/dist/lib/bufferStrategy.d.ts.map +1 -1
- package/dist/lib/cloudflare/traceRows.d.ts.map +1 -1
- package/dist/lib/cloudflare/traceRows.js +3 -2
- package/dist/lib/codegen/evaluatorGenerator.d.ts.map +1 -1
- package/dist/lib/codegen/evaluatorGenerator.js +12 -11
- package/dist/lib/codegen/fixedPositionWriterGenerator.d.ts +44 -82
- package/dist/lib/codegen/fixedPositionWriterGenerator.d.ts.map +1 -1
- package/dist/lib/codegen/fixedPositionWriterGenerator.js +223 -162
- package/dist/lib/codegen/spanLoggerClosureMaterializer.d.ts +63 -0
- package/dist/lib/codegen/spanLoggerClosureMaterializer.d.ts.map +1 -0
- package/dist/lib/codegen/spanLoggerClosureMaterializer.js +447 -0
- package/dist/lib/codegen/spanLoggerGenerator.d.ts +36 -19
- package/dist/lib/codegen/spanLoggerGenerator.d.ts.map +1 -1
- package/dist/lib/codegen/spanLoggerGenerator.js +164 -158
- package/dist/lib/convertToArrow.d.ts +7 -2
- package/dist/lib/convertToArrow.d.ts.map +1 -1
- package/dist/lib/convertToArrow.js +499 -285
- package/dist/lib/defineOpContext.js +1 -1
- package/dist/lib/enumMetadata.d.ts +19 -0
- package/dist/lib/enumMetadata.d.ts.map +1 -0
- package/dist/lib/enumMetadata.js +86 -0
- package/dist/lib/flushScheduler.d.ts.map +1 -1
- package/dist/lib/flushScheduler.js +13 -4
- package/dist/lib/library.d.ts +16 -98
- package/dist/lib/library.d.ts.map +1 -1
- package/dist/lib/library.js +32 -525
- package/dist/lib/logBinding.d.ts +21 -27
- package/dist/lib/logBinding.d.ts.map +1 -1
- package/dist/lib/op.d.ts +30 -30
- package/dist/lib/op.d.ts.map +1 -1
- package/dist/lib/op.js +15 -22
- package/dist/lib/opContext/createOpGroup.d.ts +1 -1
- package/dist/lib/opContext/createOpGroup.d.ts.map +1 -1
- package/dist/lib/opContext/createOpGroup.js +22 -29
- package/dist/lib/opContext/defineOp.d.ts +4 -4
- package/dist/lib/opContext/defineOp.d.ts.map +1 -1
- package/dist/lib/opContext/defineOp.js +53 -10
- package/dist/lib/opContext/opGroupTypes.d.ts +2 -2
- package/dist/lib/opContext/opTypes.d.ts +1 -1
- package/dist/lib/opContext/opTypes.d.ts.map +1 -1
- package/dist/lib/opContext/spanContextTypes.d.ts +33 -18
- package/dist/lib/opContext/spanContextTypes.d.ts.map +1 -1
- package/dist/lib/opContext/types.d.ts +4 -4
- package/dist/lib/opContext/types.d.ts.map +1 -1
- package/dist/lib/physicalLayoutPlan.d.ts +89 -0
- package/dist/lib/physicalLayoutPlan.d.ts.map +1 -0
- package/dist/lib/physicalLayoutPlan.js +442 -0
- package/dist/lib/resolveMessage.d.ts +9 -0
- package/dist/lib/resolveMessage.d.ts.map +1 -0
- package/dist/lib/resolveMessage.js +63 -0
- package/dist/lib/result.d.ts +5 -7
- package/dist/lib/result.d.ts.map +1 -1
- package/dist/lib/result.js +19 -26
- package/dist/lib/runtimeHint.d.ts +35 -0
- package/dist/lib/runtimeHint.d.ts.map +1 -0
- package/dist/lib/runtimeHint.js +79 -0
- package/dist/lib/schema/typeGuards.d.ts +7 -47
- package/dist/lib/schema/typeGuards.d.ts.map +1 -1
- package/dist/lib/schema/typeGuards.js +7 -123
- package/dist/lib/schema/types.d.ts +1 -1
- package/dist/lib/schema/types.d.ts.map +1 -1
- package/dist/lib/span-buffer/aot/v1.d.ts +2 -0
- package/dist/lib/span-buffer/aot/v1.d.ts.map +1 -0
- package/dist/lib/span-buffer/aot/v1.js +24 -0
- package/dist/lib/spanBuffer.d.ts +33 -4
- package/dist/lib/spanBuffer.d.ts.map +1 -1
- package/dist/lib/spanBuffer.js +583 -91
- package/dist/lib/spanBufferStats.d.ts +1 -1
- package/dist/lib/spanBufferStats.d.ts.map +1 -1
- package/dist/lib/spanContext.d.ts +27 -51
- package/dist/lib/spanContext.d.ts.map +1 -1
- package/dist/lib/spanContext.js +822 -344
- package/dist/lib/sqlite/sqlite-common.d.ts.map +1 -1
- package/dist/lib/sqlite/sqlite-common.js +20 -21
- package/dist/lib/testing/bun-harness.d.ts +8 -3
- package/dist/lib/testing/bun-harness.d.ts.map +1 -1
- package/dist/lib/testing/bun-harness.js +30 -18
- package/dist/lib/testing/extractFacts.d.ts +1 -1
- package/dist/lib/testing/extractFacts.d.ts.map +1 -1
- package/dist/lib/testing/extractFacts.js +55 -63
- package/dist/lib/testing/facts.d.ts +1 -1
- package/dist/lib/testing/facts.d.ts.map +1 -1
- package/dist/lib/testing/queryable-span.d.ts +1 -1
- package/dist/lib/testing/queryable-span.d.ts.map +1 -1
- package/dist/lib/testing/queryable-span.js +26 -28
- package/dist/lib/testing/span-query.d.ts.map +1 -1
- package/dist/lib/testing/span-query.js +19 -22
- package/dist/lib/testing/stdio-replay.d.ts.map +1 -1
- package/dist/lib/testing/stdio-replay.js +19 -8
- package/dist/lib/threadId.d.ts.map +1 -1
- package/dist/lib/threadId.js +6 -3
- package/dist/lib/traceContext.d.ts.map +1 -1
- package/dist/lib/traceContext.js +1 -4
- package/dist/lib/traceRoot.d.ts +30 -8
- package/dist/lib/traceRoot.d.ts.map +1 -1
- package/dist/lib/traceRoot.es.d.ts +17 -15
- package/dist/lib/traceRoot.es.d.ts.map +1 -1
- package/dist/lib/traceRoot.es.js +68 -34
- package/dist/lib/traceRoot.js +11 -0
- package/dist/lib/traceRoot.node.d.ts +17 -19
- package/dist/lib/traceRoot.node.d.ts.map +1 -1
- package/dist/lib/traceRoot.node.js +66 -38
- package/dist/lib/traceTopology.d.ts +42 -0
- package/dist/lib/traceTopology.d.ts.map +1 -0
- package/dist/lib/traceTopology.js +260 -0
- package/dist/lib/tracer.d.ts +9 -5
- package/dist/lib/tracer.d.ts.map +1 -1
- package/dist/lib/tracer.js +65 -71
- package/dist/lib/tracers/ArrayQueueTracer.d.ts +1 -1
- package/dist/lib/tracers/ArrayQueueTracer.js +1 -1
- package/dist/lib/tracers/StdioTracer.d.ts.map +1 -1
- package/dist/lib/tracers/StdioTracer.js +15 -13
- package/dist/lib/tracers/TestTracer.d.ts +4 -6
- package/dist/lib/tracers/TestTracer.d.ts.map +1 -1
- package/dist/lib/tracers/TestTracer.js +6 -8
- package/dist/lib/types.d.ts +49 -32
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/vocabularyRegistry.d.ts +25 -0
- package/dist/lib/vocabularyRegistry.d.ts.map +1 -0
- package/dist/lib/vocabularyRegistry.js +372 -0
- package/dist/lib/wasm/WasmBufferStrategy.d.ts +6 -10
- package/dist/lib/wasm/WasmBufferStrategy.d.ts.map +1 -1
- package/dist/lib/wasm/WasmBufferStrategy.js +44 -37
- package/dist/lib/wasm/wasmAllocator.d.ts +27 -22
- package/dist/lib/wasm/wasmAllocator.d.ts.map +1 -1
- package/dist/lib/wasm/wasmAllocator.js +66 -44
- package/dist/lib/wasm/wasmPhysicalLayout.d.ts +67 -0
- package/dist/lib/wasm/wasmPhysicalLayout.d.ts.map +1 -0
- package/dist/lib/wasm/wasmPhysicalLayout.js +179 -0
- package/dist/lib/wasm/wasmSpanBuffer.d.ts +79 -31
- package/dist/lib/wasm/wasmSpanBuffer.d.ts.map +1 -1
- package/dist/lib/wasm/wasmSpanBuffer.js +442 -272
- package/dist/lib/wasm/wasmTraceRoot.d.ts +24 -22
- package/dist/lib/wasm/wasmTraceRoot.d.ts.map +1 -1
- package/dist/lib/wasm/wasmTraceRoot.js +110 -71
- package/dist/vocabulary/register/v1.d.ts +2 -0
- package/dist/vocabulary/register/v1.d.ts.map +1 -0
- package/dist/vocabulary/register/v1.js +1 -0
- package/dist/wasm.d.ts +5 -0
- package/dist/wasm.d.ts.map +1 -0
- package/dist/wasm.js +4 -0
- package/package.json +54 -6
- package/src/index.ts +1 -0
- package/src/lib/JsBufferStrategy.ts +27 -9
- package/src/lib/__tests__/arrow-builder-integration/arrow-conversion.test.ts +335 -37
- package/src/lib/__tests__/arrow-builder-integration/binary-arrow-conversion.test.ts +97 -26
- package/src/lib/__tests__/arrow-builder-integration/binary-comparison.test.ts +75 -15
- package/src/lib/__tests__/arrow-builder-integration/binary-format-compliance.test.ts +30 -6
- package/src/lib/__tests__/arrow-builder-integration/buffer-chaining.test.ts +18 -21
- package/src/lib/__tests__/arrow-builder-integration/foundation.test.ts +5 -2
- package/src/lib/__tests__/arrow-builder-integration/integration.test.ts +25 -7
- package/src/lib/__tests__/arrow-builder-integration/lazy-columns.test.ts +3 -2
- package/src/lib/__tests__/buffer-overflow.test.ts +24 -18
- package/src/lib/__tests__/capability-span-context.test.ts +505 -0
- package/src/lib/__tests__/capacity-tuning.test.ts +5 -3
- package/src/lib/__tests__/eager-columns.test.ts +345 -0
- package/src/lib/__tests__/enum-metadata-aot.test.ts +153 -0
- package/src/lib/__tests__/enum-metadata.test.ts +177 -0
- package/src/lib/__tests__/fixtures/empty-vocabulary-runtime.fixture.ts +15 -0
- package/src/lib/__tests__/flushScheduler.test.ts +5 -1
- package/src/lib/__tests__/identity-view.property.test.ts +179 -0
- package/src/lib/__tests__/library.test.ts +19 -235
- package/src/lib/__tests__/message-buffer-families.test.ts +878 -0
- package/src/lib/__tests__/nested-library-tasks.test.ts +14 -15
- package/src/lib/__tests__/op-metadata.test.ts +1 -1
- package/src/lib/__tests__/op-type-safety.test.ts +5 -16
- package/src/lib/__tests__/physical-layout-plan.test.ts +333 -0
- package/src/lib/__tests__/remap-descriptor-integration.test.ts +381 -0
- package/src/lib/__tests__/root-context-construction.test.ts +414 -0
- package/src/lib/__tests__/span-auto-runtime.test.ts +386 -0
- package/src/lib/__tests__/span-buffer-segment-stats.test.ts +221 -0
- package/src/lib/__tests__/span-lifecycle.test.ts +53 -25
- package/src/lib/__tests__/spanbuffer-materializer-parity.test.ts +266 -0
- package/src/lib/__tests__/sync-async-trace.test.ts +24 -23
- package/src/lib/__tests__/tag-writer-aot.test.ts +214 -0
- package/src/lib/__tests__/test-helpers.ts +67 -12
- package/src/lib/__tests__/threadId.test.ts +62 -0
- package/src/lib/__tests__/timestamp.test.ts +221 -93
- package/src/lib/__tests__/traceTopology.property.test.ts +383 -0
- package/src/lib/__tests__/type-narrowing.test.ts +63 -0
- package/src/lib/__tests__/vocabulary-dense-decoding.test.ts +405 -0
- package/src/lib/__tests__/vocabularyRegistry.test.ts +313 -0
- package/src/lib/arrow/lease.ts +43 -0
- package/src/lib/arrow/utils.ts +10 -14
- package/src/lib/arrow/vocabularyDictionary.ts +123 -0
- package/src/lib/bufferStrategy.ts +9 -1
- package/src/lib/cloudflare/traceRows.ts +3 -2
- package/src/lib/codegen/__tests__/evaluatorGenerator.test.ts +21 -141
- package/src/lib/codegen/__tests__/fixedPositionWriter-parity.test.ts +273 -0
- package/src/lib/codegen/__tests__/fixedPositionWriter-uint64.test.ts +61 -34
- package/src/lib/codegen/__tests__/nullBitmap.test.ts +33 -37
- package/src/lib/codegen/__tests__/spanLoggerGenerator.test.ts +34 -18
- package/src/lib/codegen/__tests__/spanLoggerMaterializerParity.test.ts +503 -0
- package/src/lib/codegen/evaluatorGenerator.ts +18 -13
- package/src/lib/codegen/fixedPositionWriterGenerator.ts +329 -245
- package/src/lib/codegen/spanLoggerClosureMaterializer.ts +598 -0
- package/src/lib/codegen/spanLoggerGenerator.ts +241 -177
- package/src/lib/convertToArrow.ts +598 -311
- package/src/lib/defineOpContext.ts +1 -1
- package/src/lib/enumMetadata.ts +121 -0
- package/src/lib/flushScheduler.ts +11 -5
- package/src/lib/library.ts +37 -595
- package/src/lib/logBinding.ts +21 -27
- package/src/lib/op.ts +75 -18
- package/src/lib/opContext/__tests__/retry.test.ts +27 -21
- package/src/lib/opContext/createOpGroup.ts +33 -31
- package/src/lib/opContext/defineOp.ts +88 -11
- package/src/lib/opContext/opGroupTypes.ts +2 -2
- package/src/lib/opContext/opTypes.ts +1 -1
- package/src/lib/opContext/spanContextTypes.ts +122 -24
- package/src/lib/opContext/types.ts +7 -3
- package/src/lib/physicalLayoutPlan.ts +598 -0
- package/src/lib/resolveMessage.ts +67 -0
- package/src/lib/result.ts +20 -33
- package/src/lib/runtimeHint.ts +98 -0
- package/src/lib/schema/__tests__/featureFlags.test.ts +2 -1
- package/src/lib/schema/builder.ts +1 -1
- package/src/lib/schema/typeGuards.ts +7 -151
- package/src/lib/schema/types.ts +1 -1
- package/src/lib/span-buffer/aot/v1.ts +26 -0
- package/src/lib/spanBuffer.ts +658 -92
- package/src/lib/spanBufferStats.ts +1 -1
- package/src/lib/spanContext.ts +1350 -861
- package/src/lib/sqlite/sqlite-common.ts +20 -31
- package/src/lib/testing/__tests__/topology-traversal.test.ts +174 -0
- package/src/lib/testing/__tests__/vitest-harness.test.ts +2 -1
- package/src/lib/testing/bun-harness.ts +94 -43
- package/src/lib/testing/extractFacts.ts +64 -78
- package/src/lib/testing/facts.ts +1 -1
- package/src/lib/testing/queryable-span.ts +23 -30
- package/src/lib/testing/span-query.ts +16 -20
- package/src/lib/testing/stdio-replay.ts +25 -8
- package/src/lib/testing/vitest-harness.ts +1 -1
- package/src/lib/threadId.ts +6 -3
- package/src/lib/traceContext.ts +1 -6
- package/src/lib/traceRoot.es.ts +77 -42
- package/src/lib/traceRoot.node.ts +75 -46
- package/src/lib/traceRoot.ts +41 -14
- package/src/lib/traceTopology.ts +279 -0
- package/src/lib/tracer.ts +109 -98
- package/src/lib/tracers/ArrayQueueTracer.ts +1 -1
- package/src/lib/tracers/StdioTracer.ts +15 -13
- package/src/lib/tracers/TestTracer.ts +6 -8
- package/src/lib/tracers/__tests__/ArrayQueueTracer.test.ts +15 -10
- package/src/lib/tracers/__tests__/CompositeTracer.test.ts +150 -0
- package/src/lib/tracers/__tests__/TestTracer.test.ts +23 -13
- package/src/lib/types.ts +64 -33
- package/src/lib/vocabularyRegistry.ts +439 -0
- package/src/lib/wasm/WasmBufferStrategy.ts +56 -48
- package/src/lib/wasm/__tests__/WasmBufferStrategy.test.ts +215 -11
- package/src/lib/wasm/__tests__/allocatorFreeBlockClamp.test.ts +86 -0
- package/src/lib/wasm/__tests__/wasm-identity-view.test.ts +311 -0
- package/src/lib/wasm/__tests__/wasm-integration.test.ts +417 -44
- package/src/lib/wasm/__tests__/wasm-message-buffer-families.test.ts +588 -0
- package/src/lib/wasm/__tests__/wasmAllocator.test.ts +100 -668
- package/src/lib/wasm/__tests__/wasmSpanBuffer.test.ts +419 -63
- package/src/lib/wasm/__tests__/wasmTraceRoot.test.ts +24 -29
- package/src/lib/wasm/__tests__/wasmTracer.test.ts.disabled +2 -2
- package/src/lib/wasm/wasmAllocator.ts +131 -96
- package/src/lib/wasm/wasmPhysicalLayout.ts +309 -0
- package/src/lib/wasm/wasmSpanBuffer.ts +597 -341
- package/src/lib/wasm/wasmTraceRoot.ts +140 -78
- package/src/vocabulary/register/v1.ts +1 -0
- package/src/wasm.ts +19 -0
- package/src/lib/__tests__/remapped-buffer-view-integration.test.ts +0 -319
- package/src/lib/__tests__/remapped-buffer-view.test.ts +0 -635
- package/src/lib/wasm/allocator.zig +0 -948
package/src/lib/logBinding.ts
CHANGED
|
@@ -14,24 +14,25 @@
|
|
|
14
14
|
|
|
15
15
|
import type { LogSchema } from './schema/LogSchema.js';
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
type
|
|
17
|
+
/** Dense cold-path remap entry with schema and canonical storage property metadata. */
|
|
18
|
+
export type RemappedColumn = readonly [
|
|
19
|
+
outputName: string,
|
|
20
|
+
sourceName: string,
|
|
21
|
+
schema: unknown,
|
|
22
|
+
valuesProperty: `${string}_values`,
|
|
23
|
+
nullsProperty: `${string}_nulls`,
|
|
24
|
+
];
|
|
19
25
|
|
|
20
26
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* Generated at module composition time (cold path) by `generateRemappedBufferViewClass()`.
|
|
24
|
-
* Used by prefixed modules to wrap SpanBuffer instances for Arrow conversion when
|
|
25
|
-
* the module's schema columns have been renamed with a prefix.
|
|
26
|
-
*
|
|
27
|
-
* The constructor takes a raw SpanBuffer and returns a view that remaps column access
|
|
28
|
-
* from prefixed names to unprefixed names for tree traversal during Arrow conversion.
|
|
29
|
-
*
|
|
30
|
-
* Per specs/lmao/01e_library_integration_pattern.md:
|
|
31
|
-
* - Hot path: Library writes directly to unprefixed columns (zero overhead)
|
|
32
|
-
* - Cold path: Arrow conversion uses RemappedBufferView to access via prefixed names
|
|
27
|
+
* Immutable metadata interpreted only by cold Arrow conversion.
|
|
28
|
+
* Child SpanBuffers retain their canonical schema and storage layout.
|
|
33
29
|
*/
|
|
34
|
-
export
|
|
30
|
+
export interface RemapDescriptor {
|
|
31
|
+
/** Fully composed output-name to canonical source-name lookup. */
|
|
32
|
+
readonly sourceNames: Readonly<Record<string, string>>;
|
|
33
|
+
/** Dense output/source/schema entries in deterministic composition order. */
|
|
34
|
+
readonly columns: readonly RemappedColumn[];
|
|
35
|
+
}
|
|
35
36
|
|
|
36
37
|
/**
|
|
37
38
|
* LogBinding - Everything needed for a group of ops to write logs.
|
|
@@ -47,21 +48,14 @@ export type RemappedViewConstructor = new (buffer: SpanBuffer) => SpanBuffer;
|
|
|
47
48
|
* - 01b2_buffer_self_tuning.md - Self-tuning via SpanBufferClass.stats
|
|
48
49
|
* - 01e_library_integration_pattern.md - Library prefix/remapping support
|
|
49
50
|
*
|
|
50
|
-
* @property
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* @property remappedViewClass - Optional RemappedBufferView class for prefixed/remapped buffers.
|
|
55
|
-
* - When present: the module's ops write to unprefixed columns, but buffers must be wrapped
|
|
56
|
-
* in this view for Arrow conversion to access them by prefixed names
|
|
57
|
-
* - When absent: buffers can be used directly without remapping
|
|
58
|
-
* - Set during module composition when prefix() or mapColumns() is applied (cold path)
|
|
59
|
-
* - Used when registering child spans to parent's tree (see op.ts)
|
|
51
|
+
* @property remapDescriptor - Optional immutable output-to-source metadata for
|
|
52
|
+
* prefixed/remapped buffers. Ops attach the descriptor pointer to raw child
|
|
53
|
+
* buffers; cold Arrow traversal interprets it without wrapping the buffer.
|
|
60
54
|
*/
|
|
61
55
|
export interface LogBinding<T extends LogSchema = LogSchema> {
|
|
62
56
|
/** The unprefixed schema defining what columns exist */
|
|
63
57
|
readonly logSchema: T;
|
|
64
58
|
|
|
65
|
-
/** Optional
|
|
66
|
-
readonly
|
|
59
|
+
/** Optional immutable remapping metadata for cold Arrow conversion. */
|
|
60
|
+
readonly remapDescriptor?: RemapDescriptor;
|
|
67
61
|
}
|
package/src/lib/op.ts
CHANGED
|
@@ -14,11 +14,24 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import type { PreEncodedEntry } from '@smoothbricks/arrow-builder';
|
|
17
|
-
import type {
|
|
17
|
+
import type { RemapDescriptor } from './logBinding.js';
|
|
18
18
|
import type { SpanContext } from './opContext/spanContextTypes.js';
|
|
19
19
|
import type { OpContext, OpContextBinding } from './opContext/types.js';
|
|
20
|
+
import type {
|
|
21
|
+
ArrowExposurePlan,
|
|
22
|
+
CallsitePlan,
|
|
23
|
+
EagerColumnDescriptor,
|
|
24
|
+
PhysicalAppenders,
|
|
25
|
+
} from './physicalLayoutPlan.js';
|
|
26
|
+
import { getPhysicalLayoutPlan, sealCallsitePlan } from './physicalLayoutPlan.js';
|
|
20
27
|
import type { Result } from './result.js';
|
|
28
|
+
import { decodeRuntimeHint } from './runtimeHint.js';
|
|
29
|
+
import type { LogSchema } from './schema/LogSchema.js';
|
|
21
30
|
import type { SpanBufferConstructor } from './spanBuffer.js';
|
|
31
|
+
import { createSpanContextClass } from './spanContext.js';
|
|
32
|
+
import type { TimestampAppendPrimitive } from './traceRoot.js';
|
|
33
|
+
import type { VocabularyGeneration } from './vocabularyRegistry.js';
|
|
34
|
+
import type { WasmLayoutTemplate } from './wasm/wasmPhysicalLayout.js';
|
|
22
35
|
|
|
23
36
|
// =============================================================================
|
|
24
37
|
// OP METADATA
|
|
@@ -36,7 +49,15 @@ import type { SpanBufferConstructor } from './spanBuffer.js';
|
|
|
36
49
|
// (package_name/package_file/git_sha) + pre-encoded UTF-8 entries for Arrow
|
|
37
50
|
// dictionary building. One per defineOp; SpanBuffer/SpanContext are the other
|
|
38
51
|
// two levels of the 01j Context Hierarchy.
|
|
39
|
-
export interface
|
|
52
|
+
export interface OpCompileMetadata {
|
|
53
|
+
readonly runtimeHint: number;
|
|
54
|
+
readonly eagerColumns?: readonly string[];
|
|
55
|
+
readonly localMessageDictionary?: readonly number[];
|
|
56
|
+
/** ttsc-only startup hook that installs the source-emitted physical buffer constructor. */
|
|
57
|
+
readonly materializeSpanBufferClass?: (schema: LogSchema) => void;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface OpMetadata<T extends LogSchema = LogSchema> {
|
|
40
61
|
/** Op name for metrics tracking (distinct from span names which are provided at call sites) */
|
|
41
62
|
readonly name: string;
|
|
42
63
|
/** Package name from package.json */
|
|
@@ -54,6 +75,18 @@ export interface OpMetadata {
|
|
|
54
75
|
readonly package_file_entry: PreEncodedEntry;
|
|
55
76
|
/** Pre-encoded git_sha for Arrow dictionary building */
|
|
56
77
|
readonly git_sha_entry: PreEncodedEntry;
|
|
78
|
+
/** Startup-resolved physical layout used by span setup; absent only on raw fallback metadata. */
|
|
79
|
+
readonly _physicalLayoutPlan?: {
|
|
80
|
+
readonly SpanBufferClass: SpanBufferConstructor<T>;
|
|
81
|
+
readonly eagerColumns: EagerColumnDescriptor;
|
|
82
|
+
readonly vocabularyGeneration: VocabularyGeneration;
|
|
83
|
+
readonly localMessageDictionary: readonly number[];
|
|
84
|
+
readonly encodeLocalMessage: (globalDenseIndex: number) => number;
|
|
85
|
+
readonly wasmLayout: WasmLayoutTemplate;
|
|
86
|
+
readonly appendLogEntry: TimestampAppendPrimitive;
|
|
87
|
+
readonly arrowExposure: ArrowExposurePlan;
|
|
88
|
+
readonly appenders: PhysicalAppenders;
|
|
89
|
+
};
|
|
57
90
|
}
|
|
58
91
|
//#endregion smoo/lmao!n/opcontext-hierarchy
|
|
59
92
|
|
|
@@ -82,7 +115,7 @@ export interface OpMetadata {
|
|
|
82
115
|
*
|
|
83
116
|
* Phase 2 architecture:
|
|
84
117
|
* - SpanBufferClass carries static schema + stats (shared by all ops from same defineOpContext)
|
|
85
|
-
* -
|
|
118
|
+
* - remapDescriptor is an immutable cold-path binding for prefixed/mapped ops
|
|
86
119
|
* - No LogBinding - stats accessed via SpanBufferClass.stats
|
|
87
120
|
*
|
|
88
121
|
* @typeParam Ctx - OpContext with deps, ff, env (contravariant position)
|
|
@@ -91,21 +124,45 @@ export interface OpMetadata {
|
|
|
91
124
|
* @typeParam E - Error type of the Result
|
|
92
125
|
*/
|
|
93
126
|
export class Op<Ctx extends OpContext, Args extends unknown[], S, E> {
|
|
127
|
+
readonly metadata: OpMetadata;
|
|
128
|
+
readonly callsitePlan: CallsitePlan<Ctx['logSchema'], Ctx>;
|
|
129
|
+
readonly fn: (ctx: SpanContext<Ctx>, ...args: Args) => Result<S, E> | Promise<Result<S, E>>;
|
|
130
|
+
readonly _opContextBinding?: OpContextBinding<Ctx['logSchema'], Ctx['flags'], Ctx['deps'], Ctx['userCtx']>;
|
|
131
|
+
|
|
94
132
|
constructor(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
readonly
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
133
|
+
metadata: OpMetadata,
|
|
134
|
+
SpanBufferClass: SpanBufferConstructor<Ctx['logSchema']>,
|
|
135
|
+
fn: (ctx: SpanContext<Ctx>, ...args: Args) => Result<S, E> | Promise<Result<S, E>>,
|
|
136
|
+
remapDescriptor?: RemapDescriptor,
|
|
137
|
+
opContextBinding?: OpContextBinding<Ctx['logSchema'], Ctx['flags'], Ctx['deps'], Ctx['userCtx']>,
|
|
138
|
+
runtimeHint = 0,
|
|
139
|
+
eagerColumns: readonly string[] = [],
|
|
140
|
+
localMessageDictionary: readonly number[] = Object.freeze([]),
|
|
141
|
+
) {
|
|
142
|
+
const userContextKeys = Object.keys(opContextBinding?.ctxDefaults ?? {}).sort();
|
|
143
|
+
const layoutKey = userContextKeys.join('\u0000');
|
|
144
|
+
const capabilities = decodeRuntimeHint(runtimeHint).capabilities;
|
|
145
|
+
const SpanContextClass = createSpanContextClass<Ctx>(
|
|
146
|
+
SpanBufferClass.schema,
|
|
147
|
+
opContextBinding?.logBinding ?? { logSchema: SpanBufferClass.schema },
|
|
148
|
+
capabilities,
|
|
149
|
+
userContextKeys,
|
|
150
|
+
);
|
|
151
|
+
const physicalLayoutPlan = getPhysicalLayoutPlan<Ctx['logSchema'], Ctx>(
|
|
152
|
+
SpanBufferClass,
|
|
153
|
+
runtimeHint,
|
|
154
|
+
SpanContextClass,
|
|
155
|
+
remapDescriptor,
|
|
156
|
+
'strategy-selected',
|
|
157
|
+
layoutKey,
|
|
158
|
+
eagerColumns,
|
|
159
|
+
localMessageDictionary,
|
|
160
|
+
);
|
|
161
|
+
const resolvedMetadata = Object.freeze({ ...metadata, _physicalLayoutPlan: physicalLayoutPlan });
|
|
162
|
+
this.callsitePlan = sealCallsitePlan(physicalLayoutPlan, resolvedMetadata);
|
|
163
|
+
this.metadata = resolvedMetadata;
|
|
164
|
+
this.fn = fn;
|
|
165
|
+
this._opContextBinding = opContextBinding;
|
|
166
|
+
}
|
|
110
167
|
}
|
|
111
168
|
//#endregion smoo/lmao!n/op-class
|
|
@@ -23,11 +23,13 @@ import { Blocked } from '../../errors/Blocked.js';
|
|
|
23
23
|
import { Code } from '../../errors/CodeError.js';
|
|
24
24
|
import { exponentialBackoff, fixedDelay, linearBackoff, Transient, TransientError } from '../../errors/Transient.js';
|
|
25
25
|
import type { OpContextOf, SpanContext } from '../../opContext/types.js';
|
|
26
|
+
import { resolveEntryType } from '../../resolveMessage.js';
|
|
26
27
|
import type { Result } from '../../result.js';
|
|
27
28
|
import { S } from '../../schema/builder.js';
|
|
28
29
|
import { defineLogSchema } from '../../schema/defineLogSchema.js';
|
|
29
30
|
import { ENTRY_TYPE_SPAN_RETRY } from '../../schema/systemSchema.js';
|
|
30
31
|
import { TestTracer } from '../../tracers/TestTracer.js';
|
|
32
|
+
import { iterateSpanChildren } from '../../traceTopology.js';
|
|
31
33
|
|
|
32
34
|
// Test schema
|
|
33
35
|
const testSchema = defineLogSchema({
|
|
@@ -476,18 +478,18 @@ describe('LMAO Op Retry', () => {
|
|
|
476
478
|
const rootBuffer = tracer.rootBuffers[0];
|
|
477
479
|
|
|
478
480
|
// Get child span buffer (the span execution)
|
|
479
|
-
const childBuffers = rootBuffer
|
|
480
|
-
expect(childBuffers
|
|
481
|
-
const spanBuffer = childBuffers
|
|
481
|
+
const childBuffers = Array.from(iterateSpanChildren(rootBuffer));
|
|
482
|
+
expect(childBuffers).toHaveLength(1);
|
|
483
|
+
const [spanBuffer] = childBuffers;
|
|
484
|
+
if (!spanBuffer) throw new Error('expected retry span buffer');
|
|
482
485
|
|
|
483
486
|
// Check entry_type for ENTRY_TYPE_SPAN_RETRY (value 5)
|
|
484
487
|
// Row 0: span-start
|
|
485
488
|
// Row 1: span-ok/span-err
|
|
486
489
|
// Row 2+: log entries and span-retry entries
|
|
487
|
-
const entryTypes = spanBuffer.entry_type;
|
|
488
490
|
const retryEntries: number[] = [];
|
|
489
491
|
for (let i = 2; i < spanBuffer._writeIndex; i++) {
|
|
490
|
-
if (
|
|
492
|
+
if (resolveEntryType(spanBuffer, i) === ENTRY_TYPE_SPAN_RETRY) {
|
|
491
493
|
retryEntries.push(i);
|
|
492
494
|
}
|
|
493
495
|
}
|
|
@@ -498,7 +500,10 @@ describe('LMAO Op Retry', () => {
|
|
|
498
500
|
// Verify message format: retry:op:{opName}
|
|
499
501
|
// Note: For inline functions, the opMetadata name comes from the parent context
|
|
500
502
|
// which in this test is 'root' (the root trace name)
|
|
501
|
-
|
|
503
|
+
if (spanBuffer._messageLayoutFamily === 'static-only' || spanBuffer.message_values === undefined) {
|
|
504
|
+
throw new Error(`expected retry raw message lane, received ${spanBuffer._messageLayoutFamily}`);
|
|
505
|
+
}
|
|
506
|
+
const messages = requireStringArray(spanBuffer.message_values, 'retry messages');
|
|
502
507
|
const retryAttempts = requireFloat64Array(spanBuffer.getColumnIfAllocated('retry_attempt'), 'retry attempts');
|
|
503
508
|
const retryDelays = requireFloat64Array(spanBuffer.getColumnIfAllocated('retry_delay_ms'), 'retry delays');
|
|
504
509
|
for (const idx of retryEntries) {
|
|
@@ -522,15 +527,15 @@ describe('LMAO Op Retry', () => {
|
|
|
522
527
|
|
|
523
528
|
expect(tracer.rootBuffers.length).toBe(1);
|
|
524
529
|
const rootBuffer = tracer.rootBuffers[0];
|
|
525
|
-
const childBuffers = rootBuffer
|
|
526
|
-
expect(childBuffers
|
|
527
|
-
const spanBuffer = childBuffers
|
|
530
|
+
const childBuffers = Array.from(iterateSpanChildren(rootBuffer));
|
|
531
|
+
expect(childBuffers).toHaveLength(1);
|
|
532
|
+
const [spanBuffer] = childBuffers;
|
|
533
|
+
if (!spanBuffer) throw new Error('expected no-retry span buffer');
|
|
528
534
|
|
|
529
535
|
// Check for any retry entries
|
|
530
|
-
const entryTypes = spanBuffer.entry_type;
|
|
531
536
|
let retryCount = 0;
|
|
532
537
|
for (let i = 0; i < spanBuffer._writeIndex; i++) {
|
|
533
|
-
if (
|
|
538
|
+
if (resolveEntryType(spanBuffer, i) === ENTRY_TYPE_SPAN_RETRY) {
|
|
534
539
|
retryCount++;
|
|
535
540
|
}
|
|
536
541
|
}
|
|
@@ -551,13 +556,13 @@ describe('LMAO Op Retry', () => {
|
|
|
551
556
|
expect(result.success).toBe(false);
|
|
552
557
|
|
|
553
558
|
const rootBuffer = tracer.rootBuffers[0];
|
|
554
|
-
const spanBuffer = rootBuffer
|
|
559
|
+
const [spanBuffer] = iterateSpanChildren(rootBuffer);
|
|
560
|
+
if (!spanBuffer) throw new Error('expected exhausted-retry span buffer');
|
|
555
561
|
|
|
556
562
|
// Check for retry entries
|
|
557
|
-
const entryTypes = spanBuffer.entry_type;
|
|
558
563
|
let retryCount = 0;
|
|
559
564
|
for (let i = 0; i < spanBuffer._writeIndex; i++) {
|
|
560
|
-
if (
|
|
565
|
+
if (resolveEntryType(spanBuffer, i) === ENTRY_TYPE_SPAN_RETRY) {
|
|
561
566
|
retryCount++;
|
|
562
567
|
}
|
|
563
568
|
}
|
|
@@ -583,13 +588,13 @@ describe('LMAO Op Retry', () => {
|
|
|
583
588
|
});
|
|
584
589
|
|
|
585
590
|
const rootBuffer = tracer.rootBuffers[0];
|
|
586
|
-
const spanBuffer = rootBuffer
|
|
591
|
+
const [spanBuffer] = iterateSpanChildren(rootBuffer);
|
|
592
|
+
if (!spanBuffer) throw new Error('expected retry error-code span buffer');
|
|
587
593
|
|
|
588
594
|
// Find retry entry
|
|
589
|
-
const entryTypes = spanBuffer.entry_type;
|
|
590
595
|
let retryIdx = -1;
|
|
591
596
|
for (let i = 2; i < spanBuffer._writeIndex; i++) {
|
|
592
|
-
if (
|
|
597
|
+
if (resolveEntryType(spanBuffer, i) === ENTRY_TYPE_SPAN_RETRY) {
|
|
593
598
|
retryIdx = i;
|
|
594
599
|
break;
|
|
595
600
|
}
|
|
@@ -664,7 +669,8 @@ describe('LMAO Op Retry', () => {
|
|
|
664
669
|
|
|
665
670
|
// Verify tags were preserved through retry
|
|
666
671
|
const rootBuffer = tracer.rootBuffers[0];
|
|
667
|
-
const spanBuffer = rootBuffer
|
|
672
|
+
const [spanBuffer] = iterateSpanChildren(rootBuffer);
|
|
673
|
+
if (!spanBuffer) throw new Error('expected tag-preservation span buffer');
|
|
668
674
|
|
|
669
675
|
// Tags are written at row 0 (span-start)
|
|
670
676
|
const operations = requireStringArray(spanBuffer.getColumnIfAllocated('operation'), 'operations');
|
|
@@ -728,11 +734,11 @@ describe('LMAO Op Retry', () => {
|
|
|
728
734
|
expect(attempts).toBe(5);
|
|
729
735
|
|
|
730
736
|
// Verify 4 retry entries (attempts 1-4 failed)
|
|
731
|
-
const spanBuffer = tracer.rootBuffers[0]
|
|
732
|
-
|
|
737
|
+
const [spanBuffer] = iterateSpanChildren(tracer.rootBuffers[0]);
|
|
738
|
+
if (!spanBuffer) throw new Error('expected multi-retry span buffer');
|
|
733
739
|
let retryCount = 0;
|
|
734
740
|
for (let i = 0; i < spanBuffer._writeIndex; i++) {
|
|
735
|
-
if (
|
|
741
|
+
if (resolveEntryType(spanBuffer, i) === ENTRY_TYPE_SPAN_RETRY) {
|
|
736
742
|
retryCount++;
|
|
737
743
|
}
|
|
738
744
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - Private fields (#columnMapping) don't affect hidden class (truly hidden, no enumeration)
|
|
9
9
|
* - Ops as own properties enable direct access and predictable object shape
|
|
10
10
|
* - prefix()/mapColumns() create new instances with same SpanBufferClass (shared stats)
|
|
11
|
-
* - Only
|
|
11
|
+
* - Only immutable remap metadata differs between original and mapped op instances
|
|
12
12
|
*
|
|
13
13
|
* Internal properties (_logSchema, _flags, etc.) are prefixed with underscore to avoid
|
|
14
14
|
* collision with user-defined op names. Public interfaces hide these from intellisense.
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
* @module opContext/createOpGroup
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import {
|
|
19
|
+
import { createRemapDescriptor } from '../library.js';
|
|
20
|
+
import type { RemapDescriptor } from '../logBinding.js';
|
|
20
21
|
import { Op } from '../op.js';
|
|
21
22
|
import { SYSTEM_SCHEMA_FIELD_NAMES } from '../schema/systemSchema.js';
|
|
22
23
|
import type { SchemaFields } from '../schema/types.js';
|
|
@@ -36,9 +37,9 @@ import type { OpContext } from './types.js';
|
|
|
36
37
|
|
|
37
38
|
//#region smoo/lmao!n/column-mapping-api
|
|
38
39
|
// 01l "Dependencies with Column Mapping" + 01e "Column Mapping API": .prefix(name) and
|
|
39
|
-
// .mapColumns({ col: 'new' | 'shared' | null }) are
|
|
40
|
-
// OpGroup's ops with
|
|
41
|
-
//
|
|
40
|
+
// .mapColumns({ col: 'new' | 'shared' | null }) are composed here. Each call clones the
|
|
41
|
+
// OpGroup's ops with one immutable descriptor; child buffers remain canonical and Arrow
|
|
42
|
+
// interprets the descriptor only on its cold traversal path.
|
|
42
43
|
// =============================================================================
|
|
43
44
|
// INTERNAL HELPERS
|
|
44
45
|
// =============================================================================
|
|
@@ -48,12 +49,8 @@ function getSchemaFields<Schema extends { readonly fields: SchemaFields }>(field
|
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
/**
|
|
51
|
-
* Create
|
|
52
|
-
* Input: clean ->
|
|
53
|
-
* Output: prefixed -> clean mapping (e.g., { http_status: 'status' })
|
|
54
|
-
*
|
|
55
|
-
* Why reverse: RemappedBufferView wraps child buffer at registration time.
|
|
56
|
-
* Arrow conversion asks for 'http_status', view needs to find 'status' in raw buffer.
|
|
52
|
+
* Create the fully composed Arrow output-to-canonical-source mapping.
|
|
53
|
+
* Input: clean -> output mapping; output: output -> clean mapping.
|
|
57
54
|
*/
|
|
58
55
|
function createReverseMapping(mapping: Record<string, string | null | undefined>): Record<string, string> {
|
|
59
56
|
const reverse: Record<string, string> = {};
|
|
@@ -69,14 +66,23 @@ function isOpInstance<Ctx extends OpContext>(value: unknown): value is Op<Ctx, u
|
|
|
69
66
|
return value instanceof Op;
|
|
70
67
|
}
|
|
71
68
|
|
|
72
|
-
function
|
|
69
|
+
function copyOpsWithDescriptor<Ctx extends OpContext>(
|
|
73
70
|
source: OpGroupOps<Ctx>,
|
|
74
71
|
target: Record<string, unknown>,
|
|
75
|
-
|
|
72
|
+
remapDescriptor: RemapDescriptor,
|
|
76
73
|
) {
|
|
77
74
|
for (const [key, value] of Object.entries(source)) {
|
|
78
75
|
if (isOpInstance<Ctx>(value)) {
|
|
79
|
-
target[key] = new Op(
|
|
76
|
+
target[key] = new Op(
|
|
77
|
+
value.metadata,
|
|
78
|
+
value.callsitePlan.SpanBufferClass,
|
|
79
|
+
value.fn,
|
|
80
|
+
remapDescriptor,
|
|
81
|
+
value._opContextBinding,
|
|
82
|
+
value.callsitePlan.runtimeHint,
|
|
83
|
+
value.callsitePlan.eagerColumns.names,
|
|
84
|
+
value.callsitePlan.localMessageDictionary,
|
|
85
|
+
);
|
|
80
86
|
}
|
|
81
87
|
}
|
|
82
88
|
}
|
|
@@ -92,12 +98,12 @@ function assertGroupCarriesOps<Ctx extends OpContext, Ops extends OpGroupOps<Ctx
|
|
|
92
98
|
}
|
|
93
99
|
}
|
|
94
100
|
|
|
95
|
-
function
|
|
101
|
+
function cloneOpsWithDescriptor<Ctx extends OpContext, Ops extends OpGroupOps<Ctx>>(
|
|
96
102
|
source: Ops,
|
|
97
|
-
|
|
103
|
+
remapDescriptor: RemapDescriptor,
|
|
98
104
|
): Ops {
|
|
99
105
|
const cloned: Record<string, unknown> = {};
|
|
100
|
-
|
|
106
|
+
copyOpsWithDescriptor<Ctx>(source, cloned, remapDescriptor);
|
|
101
107
|
assertGroupCarriesOps<Ctx, Ops>(cloned, source);
|
|
102
108
|
return cloned;
|
|
103
109
|
}
|
|
@@ -105,6 +111,7 @@ function cloneOpsWithView<Ctx extends OpContext, Ops extends OpGroupOps<Ctx>>(
|
|
|
105
111
|
function prefixContributedSchema<T extends SchemaFields, P extends string>(fields: T, prefix: P): PrefixedSchema<T, P> {
|
|
106
112
|
const result: Record<string, unknown> = {};
|
|
107
113
|
for (const [key, value] of Object.entries(fields)) {
|
|
114
|
+
if (SYSTEM_SCHEMA_FIELD_NAMES.has(key)) continue;
|
|
108
115
|
result[`${prefix}_${key}`] = value;
|
|
109
116
|
}
|
|
110
117
|
assertMappedSchema<PrefixedSchema<T, P>>(result);
|
|
@@ -226,7 +233,7 @@ function validateAllOpNames(ops: Record<string, unknown>): void {
|
|
|
226
233
|
* 2. Ops spread as own properties for direct access (`.request` not `.ops.request`)
|
|
227
234
|
* 3. Prototype methods (prefix/mapColumns) shared across instances
|
|
228
235
|
* 4. Same SpanBufferClass preserved across prefix() calls (shared schema + stats)
|
|
229
|
-
* 5. Only
|
|
236
|
+
* 5. Only immutable remap metadata differs between original and mapped ops
|
|
230
237
|
*
|
|
231
238
|
* Structure enables V8 optimization:
|
|
232
239
|
* - All OpGroup instances with same ops have same hidden class
|
|
@@ -271,16 +278,14 @@ class OpGroupImpl<Ctx extends OpContext, Ops extends OpGroupOps<Ctx>> implements
|
|
|
271
278
|
? prefixMapping(this.#columnMapping, p)
|
|
272
279
|
: buildPrefixMapping(this._logSchema._columnNames, p);
|
|
273
280
|
|
|
274
|
-
// Generate RemappedBufferView for this prefix
|
|
275
|
-
// Why reverse mapping: Arrow conversion asks for 'http_status', needs to find 'status'
|
|
276
281
|
const reverseMapping = createReverseMapping(newMapping);
|
|
277
|
-
const
|
|
282
|
+
const remapDescriptor = createRemapDescriptor(this._logSchema, reverseMapping);
|
|
278
283
|
|
|
279
284
|
// Create new OpGroup with prefixed ops
|
|
280
285
|
const newGroup = new MappedOpGroupImpl<Ctx, PrefixedSchema<Ctx['logSchema']['fields'], P>, Ops>(
|
|
281
286
|
this._logSchema,
|
|
282
287
|
this._flags,
|
|
283
|
-
|
|
288
|
+
cloneOpsWithDescriptor<Ctx, Ops>(this.#ops, remapDescriptor),
|
|
284
289
|
newMapping,
|
|
285
290
|
prefixContributedSchema<Ctx['logSchema']['fields'], P>(getSchemaFields(this._logSchema), p),
|
|
286
291
|
);
|
|
@@ -295,9 +300,8 @@ class OpGroupImpl<Ctx extends OpContext, Ops extends OpGroupOps<Ctx>> implements
|
|
|
295
300
|
// Override/extend the existing mapping with new mapping
|
|
296
301
|
const newMapping = { ...this.#columnMapping, ...mapping };
|
|
297
302
|
|
|
298
|
-
// Generate RemappedBufferView for this mapping
|
|
299
303
|
const reverseMapping = createReverseMapping(newMapping);
|
|
300
|
-
const
|
|
304
|
+
const remapDescriptor = createRemapDescriptor(this._logSchema, reverseMapping);
|
|
301
305
|
|
|
302
306
|
// Build contributed schema from original fields with new mapping
|
|
303
307
|
const newContributed = buildContributedSchema<Ctx['logSchema']['fields'], M>(
|
|
@@ -309,7 +313,7 @@ class OpGroupImpl<Ctx extends OpContext, Ops extends OpGroupOps<Ctx>> implements
|
|
|
309
313
|
const newGroup = new MappedOpGroupImpl<Ctx, MappedSchema<Ctx['logSchema']['fields'], M>, Ops>(
|
|
310
314
|
this._logSchema,
|
|
311
315
|
this._flags,
|
|
312
|
-
|
|
316
|
+
cloneOpsWithDescriptor<Ctx, Ops>(this.#ops, remapDescriptor),
|
|
313
317
|
newMapping,
|
|
314
318
|
newContributed,
|
|
315
319
|
);
|
|
@@ -363,9 +367,8 @@ class MappedOpGroupImpl<Ctx extends OpContext, ContributedSchema extends SchemaF
|
|
|
363
367
|
// Apply prefix to the current mapping's target names
|
|
364
368
|
const newMapping = prefixMapping(this.#columnMapping, p);
|
|
365
369
|
|
|
366
|
-
// Generate RemappedBufferView
|
|
367
370
|
const reverseMapping = createReverseMapping(newMapping);
|
|
368
|
-
const
|
|
371
|
+
const remapDescriptor = createRemapDescriptor(this._logSchema, reverseMapping);
|
|
369
372
|
|
|
370
373
|
// Build new contributed schema by prefixing current contributed schema
|
|
371
374
|
const newContributed = prefixContributedSchema(this._contributedSchema, p);
|
|
@@ -374,7 +377,7 @@ class MappedOpGroupImpl<Ctx extends OpContext, ContributedSchema extends SchemaF
|
|
|
374
377
|
const newGroup = new MappedOpGroupImpl<Ctx, PrefixedSchema<ContributedSchema, P>, Ops>(
|
|
375
378
|
this._logSchema,
|
|
376
379
|
this._flags,
|
|
377
|
-
|
|
380
|
+
cloneOpsWithDescriptor<Ctx, Ops>(this.#ops, remapDescriptor),
|
|
378
381
|
newMapping,
|
|
379
382
|
newContributed,
|
|
380
383
|
);
|
|
@@ -389,9 +392,8 @@ class MappedOpGroupImpl<Ctx extends OpContext, ContributedSchema extends SchemaF
|
|
|
389
392
|
// Override/extend the existing mapping
|
|
390
393
|
const newMapping = { ...this.#columnMapping, ...mapping };
|
|
391
394
|
|
|
392
|
-
// Generate RemappedBufferView
|
|
393
395
|
const reverseMapping = createReverseMapping(newMapping);
|
|
394
|
-
const
|
|
396
|
+
const remapDescriptor = createRemapDescriptor(this._logSchema, reverseMapping);
|
|
395
397
|
|
|
396
398
|
// Build contributed schema from current contributed fields so chained maps stay typed to the public surface.
|
|
397
399
|
const newContributed = buildContributedSchema(this._contributedSchema, mapping);
|
|
@@ -400,7 +402,7 @@ class MappedOpGroupImpl<Ctx extends OpContext, ContributedSchema extends SchemaF
|
|
|
400
402
|
const newGroup = new MappedOpGroupImpl<Ctx, MappedSchema<ContributedSchema, M>, Ops>(
|
|
401
403
|
this._logSchema,
|
|
402
404
|
this._flags,
|
|
403
|
-
|
|
405
|
+
cloneOpsWithDescriptor<Ctx, Ops>(this.#ops, remapDescriptor),
|
|
404
406
|
newMapping,
|
|
405
407
|
newContributed,
|
|
406
408
|
);
|