( payload: Payload )
| 147 | const queueSchemas = new WeakMap<Schema.Top, Schema.Top>() |
| 148 | |
| 149 | const 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. |
no test coverage detected