feat(module-services): add App State API client - #5214
Merged
Conversation
🦋 Changeset detectedLatest commit: aadff4a The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
odinr
force-pushed
the
feat/app-state-service-client
branch
from
August 5, 2026 10:53
5ee901e to
7db2e4a
Compare
odinr
marked this pull request as ready for review
August 5, 2026 10:53
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a versioned App State API client to the services module.
Changes:
- Implements eight user and admin state operations.
- Adds provider integration and the
./app-stateexport. - Adds tests, documentation, and a minor changeset.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
packages/modules/services/tests/setup.ts |
Adds App State API mock handlers. |
packages/modules/services/tests/app-state.test.ts |
Tests all App State operations. |
packages/modules/services/src/provider.ts |
Adds the App State client factory. |
packages/modules/services/src/app-state/types.ts |
Defines version utility types. |
packages/modules/services/src/app-state/static.ts |
Defines supported API versions. |
packages/modules/services/src/app-state/index.ts |
Exposes the public subpath API. |
packages/modules/services/src/app-state/endpoints/me.delete.ts |
Implements current-user bulk wipe. |
packages/modules/services/src/app-state/endpoints/me-apps.get.ts |
Implements current-user app listing. |
packages/modules/services/src/app-state/endpoints/me-app.get.ts |
Implements current-user app-state retrieval. |
packages/modules/services/src/app-state/endpoints/me-app.delete.ts |
Implements current-user app-state wipe. |
packages/modules/services/src/app-state/endpoints/admin-app.delete.ts |
Implements administrative app-wide wipe. |
packages/modules/services/src/app-state/endpoints/admin-app-users.get.ts |
Implements administrative user listing. |
packages/modules/services/src/app-state/endpoints/admin-app-user.get.ts |
Implements administrative user-state retrieval. |
packages/modules/services/src/app-state/endpoints/admin-app-user.delete.ts |
Implements administrative user-state wipe. |
packages/modules/services/src/app-state/client.ts |
Defines the consumer-facing client. |
packages/modules/services/README.md |
Documents the new client. |
packages/modules/services/package.json |
Registers the new package subpath. |
.changeset/module-services_add-app-state-client.md |
Records the minor release. |
Suppressed comments (1)
packages/modules/services/src/app-state/client.ts:84
TMethoddoes not default to'json': the constructor requires_method, and the generic default is the union of supported client methods. Remove the stated default so the public API documentation matches the signature.
* @template TMethod - The client method to use for the request, defaults to 'json'.
eikeland
approved these changes
Aug 5, 2026
Implements a versioned domain client for the App State API (https://appstate.ci.api.fusion-dev.net/openapi/v1.json), following the same versioned-endpoint pattern as bookmarks/context/notification. - AppStateApiClient exposed via new ./app-state subpath export - ApiProvider.createAppStateClient() factory method - 8 operations: list/get/wipe own app state, GDPR full erasure, and admin list/get/wipe per-user or per-app state
…TSDoc example
- me.delete.ts / admin-app.delete.ts: merge caller headers via Headers instead of\n Object.assign shallow-replacing the headers object, so callers can add headers\n without stripping the mandatory X-Confirm-Wipe header\n- client.ts / changeset: fix TSDoc/example importing HttpClient from the wrong\n path and constructing it with an unsupported { baseUri } argument\n- client.ts: remove inaccurate "defaults to 'json'" claim on @template TMethod
odinr
force-pushed
the
feat/app-state-service-client
branch
from
August 7, 2026 09:29
42813f6 to
aadff4a
Compare
Contributor
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.
Why is this change needed?
The App State API (https://appstate.ci.api.fusion-dev.net/openapi/v1.json) has no typed client in
@equinor/fusion-framework-module-services. Consumers need a domain client to read and manage per-user/per-app state, consistent with the other service domains already offered by this package.What is the current behavior?
@equinor/fusion-framework-module-servicesexposesBookmarksApiClient,ContextApiClient,NotificationApiClient, andPeopleApiClient. There is no App State client and nocreateAppStateClientfactory onApiProvider.What is the new behavior?
Adds
AppStateApiClient, exposed via a new./app-statesubpath export andApiProvider.createAppStateClient(). It follows the same versioned-method pattern asbookmarks/context/notification: every method takes an API version ('v1') as its first argument, builds the request with a Zod-validated response selector, and appends?api-version=1.0to the request path.Operations covered:
listMyApps,getMyAppState,wipeMyAppState,wipeAllMyState(current user's own state, incl. GDPR full erasure)listAppUsers,getUserAppState,wipeUserAppState,wipeAllAppUsersState(admin operations scoped to an app)What is the intended behavior or invariant?
v2.unknownunless the caller supplies aTResponsetype argument.wipeAllMyState,wipeAllAppUsersState) always send theX-Confirm-Wipe: trueheader the API requires; callers can still add further headers viainit.Does this PR introduce a breaking change?
No. This is a net-new subpath export and a new method on
ApiProvider; no existing exports or signatures changed.Impact assessment:
./app-statesubpath andcreateAppStateClient()method; no action required for existing consumers@equinor/fusion-framework-module-servicesReview guidance:
app-state/*againstcontext/*orbookmarks/*to confirm the versioned pattern (enum, zod schemas,api-versionquery param,no-separate-exportsuppression) is followed consistently.client.tsis the main new consumer-facing surface — check method signatures and TSDoc.tests/app-state.test.tsand the addedtests/setup.tsmsw handlers cover all 8 operations, including the missing-confirmation-header rejection path.Additional context
Validated locally:
tsc -b --force,biome check,fusion-lint lint, andvitestall pass forpackages/modules/services.Related issues
Closes equinor/fusion-core-tasks#1671 (sub-issue of the App State epic, equinor/fusion-core-tasks#538).
Checklist