feat: add maintenanceWindows resource for scheduling planned downtime#20
Merged
Conversation
Wires up `client.maintenanceWindows` so users can schedule alert-suppression
windows directly from the SDK. Mirrors the `/api/v1/maintenance-windows`
REST surface: list (auto-paginating + manual page control), listPage, get,
create, update, and cancel. List forwards optional `monitorId` and `filter`
('active' | 'upcoming') as query params.
Schemas/types are bridged through `src/schemas.ts` and `src/types.ts` so
the public type surface (`MaintenanceWindowDto`, `CreateMaintenanceWindowRequest`,
`UpdateMaintenanceWindowRequest`, `MaintenanceWindowFilters`) stays
strict-mode clean and re-exportable from `@devhelm/sdk`.
Co-authored-by: Cursor <cursoragent@cursor.com>
Stubs `globalThis.fetch` (same approach as the surface-telemetry tests) to capture each outbound request and assert on the exact path, HTTP method, query string, and JSON body the SDK puts on the wire. Covers create, list with filters, list auto-pagination, listPage, get, update, cancel, plus a client-side validation guard that fails before any network I/O. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a
client.maintenanceWindowsresource module so users can scheduleplanned alert-suppression windows directly from the SDK — mirroring the
/api/v1/maintenance-windowssurface that the API and dashboard alreadyexpose. Closes the gap with
cli/sdk-python, which previously had noJS/TS counterpart for this workflow.
The resource is a thin, fully typed wrapper over the existing OpenAPI
contract — no new generated types, no spec changes, no runtime deps.
Use case
What's included
src/resources/maintenance-windows.ts—MaintenanceWindowsclass withcreate,list(auto-paginating),listPage,get,update,cancel.Each method is async, JSDoc-documented with a
@example, and returns thegenerated
MaintenanceWindowDto(orPage<MaintenanceWindowDto>), neverany.src/schemas.tsandsrc/types.tsfor theMaintenanceWindowDto,CreateMaintenanceWindowRequest,UpdateMaintenanceWindowRequest, plus theSingleValueResponse/TableValueResultenvelopes.src/client.tsand theMaintenanceWindows/MaintenanceWindowFiltersre-exports insrc/index.ts.test/spec-paths.test.tsso spec drift around/api/v1/maintenance-windowsis caught at test time.test/maintenance-windows.test.ts— stubsglobalThis.fetch(same shapeas the existing surface-telemetry tests) and asserts the exact path,
method, query string, and body for every method, plus auto-pagination
and client-side validation behavior.
Test plan
npm run lint— cleannpm run typecheck— clean (strict mode, noany)npm run build— succeedsnpm test— all 1321 tests pass (including 13 newmaintenance-windows.test.tscases)Made with Cursor