equinor / equinor/fusion-framework

Query: consider a proxy for `client`/`cache` getters to control access

Open
#5,144 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
10
Forks
10
Avg merge
19h 40m
Merged PRs (30d)
150

Description

## Context

`Query#client` and `Query#cache` currently return the internal `QueryClient`/`QueryCache` instances directly:

https://github.com/equinor/fusion-framework/blob/main/packages/utils/query/src/Query.ts

```ts
public get client(): QueryClient {
return this.#client;
}

public get cache(): QueryCache {
return this.#cache;
}
```

There are long-standing `TODO: Proxy` comments suggesting these getters should return a proxy instead, to restrict/observe what consumers can do with the underlying instances (e.g. prevent calling internal-only methods directly).

## Task

- Decide whether a proxy is actually warranted, and if so, design its restricted surface.
- Implement the proxy (or remove the TODO if no longer considered necessary).

This issue was opened while resolving `fusion-lint`'s `no-todo-without-issue` rule, which requires TODO comments to reference a tracking issue.

Contributor guide

Open the contributing guide

Research direction

Start with packages/utils/query/src/Query.ts and inspect the existing Query#client and Query#cache getters plus their TODO: Proxy comments. Decide whether restricting or observing the underlying QueryClient and QueryCache is warranted, define the allowed surface if it is, and finish by implementing the proxy or removing the TODO when no proxy is needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.