MCPcopy Create free account
hub / github.com/Effect-TS/effect / getQueueSchema

Function getQueueSchema

packages/effect/src/unstable/workflow/DurableQueue.ts:149–170  ·  view source on GitHub ↗
(
  payload: Payload
)

Source from the content-addressed store, hash-verified

147const queueSchemas = new WeakMap<Schema.Top, Schema.Top>()
148
149const getQueueSchema = <Payload extends Schema.Top>(
150 payload: Payload
151): Schema.Struct<{
152 token: typeof DurableDeferred.Token
153 payload: Payload
154 traceId: typeof Schema.String
155 spanId: typeof Schema.String
156 sampled: typeof Schema.Boolean
157}> => {
158 let schema = queueSchemas.get(payload)
159 if (!schema) {
160 schema = Schema.Struct({
161 token: DurableDeferred.Token,
162 traceId: Schema.String,
163 spanId: Schema.String,
164 sampled: Schema.Boolean,
165 payload
166 })
167 queueSchemas.set(payload, schema)
168 }
169 return schema as any
170}
171
172/**
173 * Adds an item to the queue and wait for a worker to process it.

Callers 1

DurableQueue.tsFile · 0.85

Calls 2

getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected