The StackAdapter interface and Stack class have no way to signal shutdown or flush pending writes. This is needed before the API adapter can be built, since it will maintain an offline write queue that needs to be committed cleanly.
Changes needed
In packages/core/src/types.ts, add two optional lifecycle methods to StackAdapter:
flush?(): Promise<void> — flush any pending writes (e.g. offline queue). No-op for adapters that write immediately.
close?(): Promise<void> — release any held resources (connections, file handles, timers).
In packages/core/src/stack.ts, add corresponding public methods that delegate to the adapter:
stack.flush() — delegates to adapter.flush() if implemented
stack.close() — delegates to adapter.close() if implemented
Both methods should be graceful no-ops when the adapter doesn’t implement them.
Notes
- Tests should be added to
stack.test.ts covering both the delegating behavior and the graceful no-op case.
The
StackAdapterinterface andStackclass have no way to signal shutdown or flush pending writes. This is needed before the API adapter can be built, since it will maintain an offline write queue that needs to be committed cleanly.Changes needed
In
packages/core/src/types.ts, add two optional lifecycle methods toStackAdapter:flush?(): Promise<void>— flush any pending writes (e.g. offline queue). No-op for adapters that write immediately.close?(): Promise<void>— release any held resources (connections, file handles, timers).In
packages/core/src/stack.ts, add corresponding public methods that delegate to the adapter:stack.flush()— delegates toadapter.flush()if implementedstack.close()— delegates toadapter.close()if implementedBoth methods should be graceful no-ops when the adapter doesn’t implement them.
Notes
stack.test.tscovering both the delegating behavior and the graceful no-op case.