MCPcopy Create free account
hub / github.com/anomalyco/opencode / durable

Function durable

packages/schema/src/event.ts:98–108  ·  view source on GitHub ↗
(definitions: Definitions)

Source from the content-addressed store, hash-verified

96}
97
98export function durable<const Definitions extends ReadonlyArray<Definition>>(definitions: Definitions) {
99 return readonlyMap(
100 definitions.reduce((result, definition) => {
101 if (!definition.durable) return result
102 const key = versionedType(definition.type, definition.durable.version)
103 if (result.has(key)) throw new Error(`Duplicate durable event definition for ${key}`)
104 result.set(key, definition)
105 return result
106 }, new Map<string, Definitions[number]>()),
107 )
108}
109
110function readonlyMap<Key, Value>(map: Map<Key, Value>): ReadonlyMap<Key, Value> {
111 const result: ReadonlyMap<Key, Value> = Object.freeze({

Callers

nothing calls this directly

Calls 3

readonlyMapFunction · 0.85
versionedTypeFunction · 0.85
setMethod · 0.45

Tested by

no test coverage detected