(config: TransactionConfig<T>)
| 222 | } |
| 223 | |
| 224 | constructor(config: TransactionConfig<T>) { |
| 225 | if (typeof config.mutationFn === `undefined`) { |
| 226 | throw new MissingMutationFunctionError() |
| 227 | } |
| 228 | this.id = config.id ?? safeRandomUUID() |
| 229 | this.mutationFn = config.mutationFn |
| 230 | this.state = `pending` |
| 231 | this.mutations = [] |
| 232 | this.isPersisted = createDeferred<Transaction<T>>() |
| 233 | this.autoCommit = config.autoCommit ?? true |
| 234 | this.createdAt = new Date() |
| 235 | this.sequenceNumber = sequenceNumber++ |
| 236 | this.metadata = config.metadata ?? {} |
| 237 | } |
| 238 | |
| 239 | setState(newState: TransactionState) { |
| 240 | this.state = newState |
nothing calls this directly
no test coverage detected