@equinor/roma-nx-plugin 6.0.0-beta.7 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +54 -0
- package/generators.json +5 -0
- package/migrations.json +6 -6
- package/package.json +2 -3
- package/src/executors/create-vite-config.js +1 -3
- package/src/executors/create-vite-config.js.map +1 -1
- package/src/executors/publish/manifest-model.d.ts +11 -0
- package/src/executors/publish/publish-script.js +78 -1
- package/src/executors/publish/publish-script.js.map +1 -1
- package/src/executors/publish/readme.md +83 -27
- package/src/executors/serve/server.js +45 -19
- package/src/executors/serve/server.js.map +1 -1
- package/src/executors/utils/logger.js +7 -3
- package/src/executors/utils/logger.js.map +1 -1
- package/src/executors/utils/read-manifest.js +4 -1
- package/src/executors/utils/read-manifest.js.map +1 -1
- package/src/executors/utils/verify-manifest.d.ts +2 -0
- package/src/executors/utils/verify-manifest.js +18 -0
- package/src/executors/utils/verify-manifest.js.map +1 -0
- package/src/generators/app/data/generated-dependencies.json +23 -0
- package/src/generators/app/generator.js +7 -17
- package/src/generators/app/generator.js.map +1 -1
- package/src/generators/component-test/generator.js +1 -1
- package/src/generators/preset/generator.js.map +1 -1
- package/src/generators/preset/schema.d.ts +1 -0
- package/src/generators/skill/files/roma-app-development/SKILL.md +38 -0
- package/src/generators/skill/files/roma-app-development/fusion-modules.md +577 -0
- package/src/generators/skill/files/roma-app-development/generators.md +357 -0
- package/src/generators/skill/files/roma-app-development/roma-modules.md +409 -0
- package/src/generators/skill/files/roma-app-development/services.md +450 -0
- package/src/generators/skill/generator.d.ts +4 -0
- package/src/generators/skill/generator.js +14 -0
- package/src/generators/skill/generator.js.map +1 -0
- package/src/generators/skill/schema.d.ts +3 -0
- package/src/generators/skill/schema.json +14 -0
- package/src/generators/app/data/modules.d.ts +0 -19
- package/src/generators/app/data/modules.js +0 -23
- package/src/generators/app/data/modules.js.map +0 -1
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
# Services & Data Fetching in Roma
|
|
2
|
+
|
|
3
|
+
## Architecture
|
|
4
|
+
|
|
5
|
+
Roma data fetching combines two libraries:
|
|
6
|
+
|
|
7
|
+
1. **Fusion HTTP Client** — Wraps the native `fetch` API with automatic authentication (MSAL token acquisition). Registered via service discovery so apps don't manage tokens.
|
|
8
|
+
2. **React Query (TanStack Query v5)** — Manages request state (loading, error, cache), provides a global query cache shared across all Roma apps, and supports persistence to IndexedDB.
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
Component → useQuery/useMutation → fetch function → Fusion IHttpClient → API
|
|
12
|
+
↓
|
|
13
|
+
Automatic auth token injection
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Registering Services
|
|
19
|
+
|
|
20
|
+
Services are registered in each app's `src/config.ts`. Failing to register a service causes a runtime error when the app tries to use it.
|
|
21
|
+
|
|
22
|
+
### Using a Roma-registered service
|
|
23
|
+
|
|
24
|
+
For APIs registered in Roma's service discovery (available at `https://roma.equinor.com/_discovery/environments/current`):
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import type { AppModuleInitiator } from '@equinor/fusion-framework-react-app';
|
|
28
|
+
|
|
29
|
+
export const configure: AppModuleInitiator = (configurator, env) => {
|
|
30
|
+
// Each call registers a named HTTP client backed by the service's config
|
|
31
|
+
configurator.useFrameworkServiceClient('portal');
|
|
32
|
+
configurator.useFrameworkServiceClient('ratscore');
|
|
33
|
+
configurator.useFrameworkServiceClient('waterborne-cargo');
|
|
34
|
+
configurator.useFrameworkServiceClient('deal-handling');
|
|
35
|
+
configurator.useFrameworkServiceClient('graph'); // MS Graph API
|
|
36
|
+
configurator.useFrameworkServiceClient('roma-alarm');
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export default configure;
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Adding a custom HTTP client (for development or unlisted APIs)
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
export const configure: AppModuleInitiator = (configurator, env) => {
|
|
46
|
+
configurator.configureHttpClient('my-client', {
|
|
47
|
+
baseUri: 'https://foo.bar/api',
|
|
48
|
+
defaultScopes: ['my-scope/.default'],
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### APIM-exposed APIs
|
|
54
|
+
|
|
55
|
+
If the API is exposed via Azure API Management, set `baseUri` to `/apim`.
|
|
56
|
+
|
|
57
|
+
### Non-CORS APIs (local dev proxy)
|
|
58
|
+
|
|
59
|
+
If the API isn't behind APIM and doesn't support CORS, add a proxy in `vite.config.ts`:
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
import { defineConfig } from 'vite';
|
|
63
|
+
|
|
64
|
+
export default defineConfig({
|
|
65
|
+
build: {
|
|
66
|
+
lib: {
|
|
67
|
+
entry: 'src/index.ts',
|
|
68
|
+
fileName: 'app-bundle',
|
|
69
|
+
formats: ['es'],
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
server: {
|
|
73
|
+
proxy: {
|
|
74
|
+
'/my-api': {
|
|
75
|
+
target: 'http://localhost:8080/api',
|
|
76
|
+
changeOrigin: true,
|
|
77
|
+
rewrite: (path) => path.replace('/my-api', ''),
|
|
78
|
+
secure: false,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Enabling navigation
|
|
86
|
+
|
|
87
|
+
See `fusion-modules.md` → **Navigation** for full configuration, React hooks, and usage examples.
|
|
88
|
+
|
|
89
|
+
### Enabling page titles
|
|
90
|
+
|
|
91
|
+
See `roma-modules.md` → **Page Title** for full configuration, React hooks, and usage examples.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Data Fetching Patterns
|
|
96
|
+
|
|
97
|
+
### Basic query hook (recommended pattern)
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
import { useQuery } from '@tanstack/react-query';
|
|
101
|
+
import { HttpResponseError, IHttpClient } from '@equinor/fusion-framework-module-http';
|
|
102
|
+
import { useHttpClient } from '@equinor/fusion-framework-react-module-http';
|
|
103
|
+
import { handleError } from '@equinor/roma-framework';
|
|
104
|
+
|
|
105
|
+
type MyData = {
|
|
106
|
+
id: string;
|
|
107
|
+
name: string;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const fetchMyData = async (client: IHttpClient) => {
|
|
111
|
+
const req = await client.fetch('/my-endpoint');
|
|
112
|
+
return handleError<MyData>(req);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export const useGetMyData = () => {
|
|
116
|
+
const client = useHttpClient('my-service'); // name must match config.ts registration
|
|
117
|
+
return useQuery<MyData, HttpResponseError>({
|
|
118
|
+
queryKey: ['my-endpoint'],
|
|
119
|
+
queryFn: () => fetchMyData(client),
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Using `handleError` (from `@equinor/roma-framework`)
|
|
125
|
+
|
|
126
|
+
The framework provides a centralized error handler that parses responses and throws typed `HttpError`:
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
import { handleError } from '@equinor/roma-framework';
|
|
130
|
+
|
|
131
|
+
// In your fetch function:
|
|
132
|
+
const req = await client.fetch('/some-endpoint');
|
|
133
|
+
return handleError<MyResponseType>(req);
|
|
134
|
+
// → Returns parsed JSON if status < 300
|
|
135
|
+
// → Throws HttpError with message and cause for 300+
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
`handleError` inspects `content-type` to parse JSON or text errors and falls back to standard HTTP status messages.
|
|
139
|
+
|
|
140
|
+
### Query with caching and persistence
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
export const useGetCreditTerm = () => {
|
|
144
|
+
const client = useHttpClient('ratscore');
|
|
145
|
+
return useQuery<Array<CreditTerm>, HttpResponseError>({
|
|
146
|
+
queryKey: ['traderecap/creditterm'],
|
|
147
|
+
queryFn: () => fetchCreditTerm(client),
|
|
148
|
+
staleTime: 60_000, // data is fresh for 60s
|
|
149
|
+
meta: { persist: true }, // persist to IndexedDB across sessions
|
|
150
|
+
refetchOnMount: true,
|
|
151
|
+
refetchOnReconnect: true,
|
|
152
|
+
refetchOnWindowFocus: true,
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Query without caching
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
export const useGetCreditTerm = () => {
|
|
161
|
+
const client = useHttpClient('ratscore');
|
|
162
|
+
return useQuery<Array<CreditTerm>, HttpResponseError>({
|
|
163
|
+
queryKey: ['traderecap/creditterm'],
|
|
164
|
+
queryFn: () => fetchCreditTerm(client),
|
|
165
|
+
// No staleTime, no persist → default behavior
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Conditional / parameterized query
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
export const useGetCargoes = (userId: string) => {
|
|
174
|
+
const client = useHttpClient('waterborne-cargo');
|
|
175
|
+
return useQuery<SearchResult<Cargo>, HttpResponseError>({
|
|
176
|
+
queryKey: ['api/cargos', userId], // include params in queryKey
|
|
177
|
+
queryFn: () => fetchCargoes(client, userId),
|
|
178
|
+
enabled: !!userId && userId !== 'MISSINGUSER', // only fetch when ready
|
|
179
|
+
retry: 1,
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Infinite query (paginated data)
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
import { useInfiniteQuery } from '@tanstack/react-query';
|
|
188
|
+
|
|
189
|
+
export const useGetDealsLastWeek = () => {
|
|
190
|
+
const client = useHttpClient('ratscore');
|
|
191
|
+
return useInfiniteQuery({
|
|
192
|
+
queryKey: ['homepage-kpi', 'deals-last-week', todayStr],
|
|
193
|
+
initialPageParam: 0,
|
|
194
|
+
getNextPageParam: (lastPage: SearchResult<Deal>) => lastPage.nextPage,
|
|
195
|
+
queryFn: ({ pageParam }) => getDeals(client, pageParam),
|
|
196
|
+
meta: { persist: true },
|
|
197
|
+
staleTime: 60_000 * 30,
|
|
198
|
+
refetchInterval: 60_000 * 30,
|
|
199
|
+
select: (pages) => {
|
|
200
|
+
// Transform paginated data
|
|
201
|
+
return pages.pages.flatMap((p) => p.items);
|
|
202
|
+
},
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Prefetching related data
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
import { QueryClient, useQueryClient } from '@tanstack/react-query';
|
|
211
|
+
|
|
212
|
+
const prefetchCargo = async (cargoId: string, client: IHttpClient, queryClient: QueryClient) => {
|
|
213
|
+
return queryClient.ensureQueryData({
|
|
214
|
+
queryKey: ['api/cargos', cargoId],
|
|
215
|
+
queryFn: () => client.json(`/cargos/${cargoId}`),
|
|
216
|
+
meta: { persist: true },
|
|
217
|
+
});
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
// Inside a select callback or effect:
|
|
221
|
+
latestCargoes.forEach((c) => prefetchCargo(c.id, client, queryClient));
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Mutations
|
|
227
|
+
|
|
228
|
+
### Manual mutation hook (for hand-written APIs)
|
|
229
|
+
|
|
230
|
+
```typescript
|
|
231
|
+
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
232
|
+
import { useHttpClient } from '@equinor/fusion-framework-react-module-http';
|
|
233
|
+
|
|
234
|
+
export const useCreateItem = () => {
|
|
235
|
+
const client = useHttpClient('portal');
|
|
236
|
+
const queryClient = useQueryClient();
|
|
237
|
+
|
|
238
|
+
return useMutation({
|
|
239
|
+
mutationFn: async (newItem: ItemDto) => {
|
|
240
|
+
const res = await client.fetch('/api/items', {
|
|
241
|
+
method: 'POST',
|
|
242
|
+
headers: { 'Content-Type': 'application/json' },
|
|
243
|
+
body: JSON.stringify(newItem),
|
|
244
|
+
});
|
|
245
|
+
if (!res.ok) throw new Error(res.statusText);
|
|
246
|
+
return res.json();
|
|
247
|
+
},
|
|
248
|
+
onSuccess: () => {
|
|
249
|
+
queryClient.invalidateQueries({ queryKey: ['api/items'] });
|
|
250
|
+
},
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Generated mutations (Orval pattern)
|
|
256
|
+
|
|
257
|
+
The Roma API clients in `libs/roma-framework/src/lib/api/` are auto-generated by Orval. They use `useCustomClient` from `use-client.ts` which wraps `useHttpClient('portal')`:
|
|
258
|
+
|
|
259
|
+
```typescript
|
|
260
|
+
// Generated — do not edit
|
|
261
|
+
import { useMutation } from '@tanstack/react-query';
|
|
262
|
+
import { useCustomClient } from '../../use-client';
|
|
263
|
+
import type { ErrorType, BodyType } from '../../use-client';
|
|
264
|
+
|
|
265
|
+
export const useCreateFeedback = (options?) => {
|
|
266
|
+
return useMutation(useCreateFeedbackMutationOptions(options));
|
|
267
|
+
};
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
Usage in components:
|
|
271
|
+
|
|
272
|
+
```typescript
|
|
273
|
+
const createFeedback = useCreateFeedback({
|
|
274
|
+
mutation: {
|
|
275
|
+
onSuccess: async () => {
|
|
276
|
+
await queryClient.invalidateQueries({ queryKey: ['feedbacks'] });
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
// Trigger:
|
|
282
|
+
createFeedback.mutate({ data: feedbackPayload });
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Query invalidation across tabs
|
|
286
|
+
|
|
287
|
+
Roma uses a `BroadcastChannel` to synchronize cache invalidation across browser tabs:
|
|
288
|
+
|
|
289
|
+
```typescript
|
|
290
|
+
import { queryInvalidationChannel } from '@equinor/roma-framework';
|
|
291
|
+
|
|
292
|
+
// After a mutation succeeds:
|
|
293
|
+
const key = getGetSettingsByAppShortNameQueryKey('notifications');
|
|
294
|
+
await queryClient.resetQueries({ queryKey: key });
|
|
295
|
+
queryInvalidationChannel.postMessage({ key });
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## Persistence
|
|
301
|
+
|
|
302
|
+
Roma's query persister uses **IndexedDB** via `idb-keyval`. To opt a query into persistence:
|
|
303
|
+
|
|
304
|
+
### Option A: Set `meta.persist`
|
|
305
|
+
|
|
306
|
+
```typescript
|
|
307
|
+
useQuery({
|
|
308
|
+
queryKey: ['my-data'],
|
|
309
|
+
queryFn: fetchMyData,
|
|
310
|
+
meta: { persist: true },
|
|
311
|
+
});
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### Option B: Include `'persist'` in the queryKey
|
|
315
|
+
|
|
316
|
+
```typescript
|
|
317
|
+
useQuery({
|
|
318
|
+
queryKey: ['persist', 'my-data'],
|
|
319
|
+
queryFn: fetchMyData,
|
|
320
|
+
});
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### Automatic persistence
|
|
324
|
+
|
|
325
|
+
Queries with keys starting with `/api/` or `/_discovery` are automatically persisted by the Roma persister without needing to opt in.
|
|
326
|
+
|
|
327
|
+
### Important notes on persisted data
|
|
328
|
+
|
|
329
|
+
- When data is persisted, `isLoading` will be `false` immediately (cached data is returned first)
|
|
330
|
+
- Use `isStale && isFetching` to detect that fresh data is being loaded in the background:
|
|
331
|
+
|
|
332
|
+
```typescript
|
|
333
|
+
const { data, isStale, isFetching, error } = useGetMyData();
|
|
334
|
+
const isRefreshing = isStale && isFetching;
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## Accessing Auth & Framework Modules
|
|
340
|
+
|
|
341
|
+
### Get current user
|
|
342
|
+
|
|
343
|
+
```typescript
|
|
344
|
+
import { useFramework } from '@equinor/fusion-framework-react';
|
|
345
|
+
|
|
346
|
+
const framework = useFramework();
|
|
347
|
+
const user = framework.modules.auth.defaultAccount;
|
|
348
|
+
const userId = user?.username.split('@')[0].toLowerCase();
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### Get user from app context
|
|
352
|
+
|
|
353
|
+
```typescript
|
|
354
|
+
import { useAppModules } from '@equinor/fusion-framework-react-app';
|
|
355
|
+
|
|
356
|
+
const auth = useAppModules().auth;
|
|
357
|
+
const username = auth?.account?.username.split('@')[0];
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### Navigation
|
|
361
|
+
|
|
362
|
+
```typescript
|
|
363
|
+
import { useFramework } from '@equinor/fusion-framework-react';
|
|
364
|
+
import { NavigationModule } from '@equinor/fusion-framework-module-navigation';
|
|
365
|
+
|
|
366
|
+
const module = useFramework<[NavigationModule]>().modules.navigation;
|
|
367
|
+
module.navigator.push('/apps/my-app/details/123');
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
Or from app module:
|
|
371
|
+
|
|
372
|
+
```typescript
|
|
373
|
+
import { useAppModule } from '@equinor/fusion-framework-react-app';
|
|
374
|
+
import { NavigationModule } from '@equinor/fusion-framework-module-navigation';
|
|
375
|
+
|
|
376
|
+
const module = useAppModule<NavigationModule>('navigation');
|
|
377
|
+
const router = module.createRouter([
|
|
378
|
+
{ path: '/', element: <Home /> },
|
|
379
|
+
{ path: '/details/:id', element: <Details /> },
|
|
380
|
+
]);
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
### Check API roles
|
|
384
|
+
|
|
385
|
+
```typescript
|
|
386
|
+
import { useGetApiRoles, useHasApiRole } from '@equinor/roma-framework';
|
|
387
|
+
|
|
388
|
+
// Get all roles for an API
|
|
389
|
+
const roles = useGetApiRoles('ratscore');
|
|
390
|
+
|
|
391
|
+
// Check a specific role
|
|
392
|
+
const isAdmin = useHasApiRole('portal', 'Admin');
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
---
|
|
396
|
+
|
|
397
|
+
## Error Handling
|
|
398
|
+
|
|
399
|
+
### Using `handleError` (preferred)
|
|
400
|
+
|
|
401
|
+
```typescript
|
|
402
|
+
import { handleError } from '@equinor/roma-framework';
|
|
403
|
+
|
|
404
|
+
const fetchData = async (client: IHttpClient) => {
|
|
405
|
+
const req = await client.fetch('/my-endpoint');
|
|
406
|
+
return handleError<MyType>(req);
|
|
407
|
+
};
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
### Manual error handling
|
|
411
|
+
|
|
412
|
+
```typescript
|
|
413
|
+
const fetchData = async (client: IHttpClient) => {
|
|
414
|
+
const req = await client.fetch('/my-endpoint');
|
|
415
|
+
if (req.status >= 400) {
|
|
416
|
+
let data;
|
|
417
|
+
if (req.headers.get('Content-type')?.includes('json')) {
|
|
418
|
+
data = await req.json();
|
|
419
|
+
} else {
|
|
420
|
+
data = await req.text();
|
|
421
|
+
}
|
|
422
|
+
throw new HttpResponseError(req.statusText, data);
|
|
423
|
+
}
|
|
424
|
+
return req.json();
|
|
425
|
+
};
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
### In components
|
|
429
|
+
|
|
430
|
+
```typescript
|
|
431
|
+
const { data, error, isLoading } = useGetMyData();
|
|
432
|
+
|
|
433
|
+
if (error) return <ErrorDisplay error={error} />;
|
|
434
|
+
if (isLoading) return <EquinorLoader />;
|
|
435
|
+
return <MyComponent data={data} />;
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
---
|
|
439
|
+
|
|
440
|
+
## Best Practices
|
|
441
|
+
|
|
442
|
+
- **Always include relevant parameters in `queryKey`** to keep cached entries unique
|
|
443
|
+
- **Use `handleError` from `@equinor/roma-framework`** instead of hand-rolling error parsing
|
|
444
|
+
- **Set `staleTime`** appropriately — `0` (default) means every mount triggers a refetch
|
|
445
|
+
- **Use `meta: { persist: true }`** for slow endpoints where showing stale data first improves UX
|
|
446
|
+
- **Don't persist highly volatile data** — if it's outdated within minutes, caching adds no value
|
|
447
|
+
- **Show loading/stale indicators** so users know when data is being refreshed
|
|
448
|
+
- **Use `enabled`** to conditionally run queries (e.g., when user ID is available)
|
|
449
|
+
- **Invalidate queries after mutations** via `queryClient.invalidateQueries()`
|
|
450
|
+
- **Use `queryInvalidationChannel`** when cache invalidation needs to propagate across browser tabs
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.skillGenerator = skillGenerator;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const path = tslib_1.__importStar(require("path"));
|
|
7
|
+
async function skillGenerator(tree, options) {
|
|
8
|
+
var _a;
|
|
9
|
+
const targetDir = (_a = options.directory) !== null && _a !== void 0 ? _a : '.claude/skills';
|
|
10
|
+
(0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), targetDir, options);
|
|
11
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
12
|
+
}
|
|
13
|
+
exports.default = skillGenerator;
|
|
14
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../plugins/roma/src/generators/skill/generator.ts"],"names":[],"mappings":";;AAIA,wCAQC;;AAZD,uCAA8D;AAC9D,mDAA6B;AAGtB,KAAK,UAAU,cAAc,CAClC,IAAU,EACV,OAA6B;;IAE7B,MAAM,SAAS,GAAG,MAAA,OAAO,CAAC,SAAS,mCAAI,gBAAgB,CAAC;IAExD,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACvE,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,kBAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "Skill",
|
|
4
|
+
"title": "",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"directory": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Target directory for the skill files. Defaults to .claude/skills",
|
|
10
|
+
"default": ".claude/skills"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"required": []
|
|
14
|
+
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare const modules: {
|
|
2
|
-
'@equinor/fusion-framework-module-msal': string;
|
|
3
|
-
'@equinor/fusion-framework-module-navigation': string;
|
|
4
|
-
'@equinor/fusion-framework-module-context': string;
|
|
5
|
-
'fusion-framework-module-ag-grid': string;
|
|
6
|
-
'fusion-framework-module-bookmark': string;
|
|
7
|
-
'fusion-framework-module-event': string;
|
|
8
|
-
'@equinor/fusion-framework-module-http': string;
|
|
9
|
-
'@equinor/fusion-framework-module-service-discovery': string;
|
|
10
|
-
'fusion-framework-module-services': string;
|
|
11
|
-
'fusion-framework-module-signalr': string;
|
|
12
|
-
'fusion-framework-module-telemetry': string;
|
|
13
|
-
'fusion-framework-module-widget': string;
|
|
14
|
-
'fusion-framework-react-module-bookmark': string;
|
|
15
|
-
'@equinor/fusion-framework-react-module-http': string;
|
|
16
|
-
'@equinor/fusion-framework-react-module-context': string;
|
|
17
|
-
'fusion-framework-react-module-signalr': string;
|
|
18
|
-
'fusion-framework-react-module-event': string;
|
|
19
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.modules = void 0;
|
|
4
|
-
exports.modules = {
|
|
5
|
-
'@equinor/fusion-framework-module-msal': '^4.0.1',
|
|
6
|
-
'@equinor/fusion-framework-module-navigation': '^4.0.8',
|
|
7
|
-
'@equinor/fusion-framework-module-context': '^5.0.18',
|
|
8
|
-
'fusion-framework-module-ag-grid': '^30.1.0',
|
|
9
|
-
'fusion-framework-module-bookmark': '1.0.10',
|
|
10
|
-
'fusion-framework-module-event': '^4.0.5',
|
|
11
|
-
'@equinor/fusion-framework-module-http': '^6.2.2',
|
|
12
|
-
'@equinor/fusion-framework-module-service-discovery': '^8.0.7',
|
|
13
|
-
'fusion-framework-module-services': '^3.1.5',
|
|
14
|
-
'fusion-framework-module-signalr': '^2.0.7',
|
|
15
|
-
'fusion-framework-module-telemetry': '^4.0.2',
|
|
16
|
-
'fusion-framework-module-widget': '^1.0.9',
|
|
17
|
-
'fusion-framework-react-module-bookmark': '^2.0.17',
|
|
18
|
-
'@equinor/fusion-framework-react-module-http': '^8.0.2',
|
|
19
|
-
'@equinor/fusion-framework-react-module-context': '^6.2.19',
|
|
20
|
-
'fusion-framework-react-module-signalr': '^2.0.7',
|
|
21
|
-
'fusion-framework-react-module-event': '^3.1.2',
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=modules.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../../../../../../../plugins/roma/src/generators/app/data/modules.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG;IACrB,uCAAuC,EAAE,QAAQ;IACjD,6CAA6C,EAAE,QAAQ;IACvD,0CAA0C,EAAE,SAAS;IACrD,iCAAiC,EAAE,SAAS;IAC5C,kCAAkC,EAAE,QAAQ;IAC5C,+BAA+B,EAAE,QAAQ;IACzC,uCAAuC,EAAE,QAAQ;IACjD,oDAAoD,EAAE,QAAQ;IAC9D,kCAAkC,EAAE,QAAQ;IAC5C,iCAAiC,EAAE,QAAQ;IAC3C,mCAAmC,EAAE,QAAQ;IAC7C,gCAAgC,EAAE,QAAQ;IAC1C,wCAAwC,EAAE,SAAS;IACnD,6CAA6C,EAAE,QAAQ;IACvD,gDAAgD,EAAE,SAAS;IAC3D,uCAAuC,EAAE,QAAQ;IACjD,qCAAqC,EAAE,QAAQ;CAChD,CAAC"}
|