mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-18 10:07:58 +00:00
chore: generate
This commit is contained in:
@@ -33,10 +33,7 @@ type State = {
|
||||
}
|
||||
|
||||
export interface Interface {
|
||||
readonly publish: <D extends BusEvent.Definition>(
|
||||
def: D,
|
||||
properties: BusProperties<D>,
|
||||
) => Effect.Effect<void>
|
||||
readonly publish: <D extends BusEvent.Definition>(def: D, properties: BusProperties<D>) => Effect.Effect<void>
|
||||
readonly subscribe: <D extends BusEvent.Definition>(def: D) => Stream.Stream<Payload<D>>
|
||||
readonly subscribeAll: () => Stream.Stream<Payload>
|
||||
readonly subscribeCallback: <D extends BusEvent.Definition>(
|
||||
@@ -85,10 +82,7 @@ export const layer = Layer.effect(
|
||||
})
|
||||
}
|
||||
|
||||
function publish<D extends BusEvent.Definition>(
|
||||
def: D,
|
||||
properties: BusProperties<D>,
|
||||
) {
|
||||
function publish<D extends BusEvent.Definition>(def: D, properties: BusProperties<D>) {
|
||||
return Effect.gen(function* () {
|
||||
const s = yield* InstanceState.get(state)
|
||||
const payload: Payload = { type: def.type, properties }
|
||||
@@ -184,17 +178,11 @@ const { runPromise, runSync } = makeRuntime(Service, layer)
|
||||
|
||||
// runSync is safe here because the subscribe chain (InstanceState.get, PubSub.subscribe,
|
||||
// Scope.make, Effect.forkScoped) is entirely synchronous. If any step becomes async, this will throw.
|
||||
export async function publish<D extends BusEvent.Definition>(
|
||||
def: D,
|
||||
properties: BusProperties<D>,
|
||||
) {
|
||||
export async function publish<D extends BusEvent.Definition>(def: D, properties: BusProperties<D>) {
|
||||
return runPromise((svc) => svc.publish(def, properties))
|
||||
}
|
||||
|
||||
export function subscribe<D extends BusEvent.Definition>(
|
||||
def: D,
|
||||
callback: (event: Payload<D>) => unknown,
|
||||
) {
|
||||
export function subscribe<D extends BusEvent.Definition>(def: D, callback: (event: Payload<D>) => unknown) {
|
||||
return runSync((svc) => svc.subscribeCallback(def, callback))
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,10 @@ import { Schema as EffectSchema, Types } from "effect"
|
||||
import { zodObject } from "@/util/effect-zod"
|
||||
import { isRecord } from "@/util/record"
|
||||
|
||||
export type Definition<Schema extends EffectSchema.Top = EffectSchema.Top, BusSchema extends EffectSchema.Top = Schema> = {
|
||||
export type Definition<
|
||||
Schema extends EffectSchema.Top = EffectSchema.Top,
|
||||
BusSchema extends EffectSchema.Top = Schema,
|
||||
> = {
|
||||
type: string
|
||||
version: number
|
||||
aggregate: string
|
||||
@@ -87,10 +90,13 @@ export function define<
|
||||
Agg extends string,
|
||||
Schema extends EffectSchema.Top,
|
||||
BusSchema extends EffectSchema.Top = Schema,
|
||||
>(input: { type: Type; version: number; aggregate: Agg; schema: Schema; busSchema?: BusSchema }): Definition<
|
||||
Schema,
|
||||
BusSchema
|
||||
> {
|
||||
>(input: {
|
||||
type: Type
|
||||
version: number
|
||||
aggregate: Agg
|
||||
schema: Schema
|
||||
busSchema?: BusSchema
|
||||
}): Definition<Schema, BusSchema> {
|
||||
if (frozen) {
|
||||
throw new Error("Error defining sync event: sync system has been frozen")
|
||||
}
|
||||
|
||||
@@ -10570,8 +10570,7 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": ["url"]
|
||||
}
|
||||
},
|
||||
"title": {
|
||||
"anyOf": [
|
||||
@@ -10636,8 +10635,7 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": ["created", "updated", "compacting", "archived"]
|
||||
}
|
||||
},
|
||||
"permission": {
|
||||
"anyOf": [
|
||||
@@ -10676,20 +10674,7 @@
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"slug",
|
||||
"projectID",
|
||||
"workspaceID",
|
||||
"directory",
|
||||
"parentID",
|
||||
"summary",
|
||||
"title",
|
||||
"version",
|
||||
"permission",
|
||||
"revert"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["sessionID", "info"]
|
||||
|
||||
Reference in New Issue
Block a user