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

Function publish

packages/core/src/event.ts:419–439  ·  view source on GitHub ↗
(definition: D, data: Data<D>, options?: PublishOptions)

Source from the content-addressed store, hash-verified

417 }
418
419 function publish<D extends Definition>(definition: D, data: Data<D>, options?: PublishOptions) {
420 return Effect.gen(function* () {
421 const serviceLocation = Option.getOrUndefined(yield* Effect.serviceOption(Location.Service))
422 const location =
423 options?.location ??
424 (serviceLocation
425 ? { directory: serviceLocation.directory, workspaceID: serviceLocation.workspaceID }
426 : undefined)
427 return yield* publishEvent(
428 definition,
429 {
430 id: options?.id ?? ID.create(),
431 ...(options?.metadata ? { metadata: options.metadata } : {}),
432 type: definition.type,
433 ...(location ? { location } : {}),
434 data,
435 } as Payload<D>,
436 options?.commit,
437 )
438 })
439 }
440
441 function replay(
442 event: SerializedEvent,

Callers

nothing calls this directly

Calls 2

publishEventFunction · 0.85
createMethod · 0.65

Tested by

no test coverage detected