@kronor/dtv 12.0.0 → 13.0.1

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.
Files changed (29) hide show
  1. package/README.md +1 -1
  2. package/dist/cli/config/loadConfig.js +7 -6
  3. package/dist/index.es.js +30124 -37061
  4. package/dist/types/App.d.ts +4 -4
  5. package/dist/types/components/AIAssistantForm.d.ts +1 -1
  6. package/dist/types/components/ActionButtons.d.ts +1 -1
  7. package/dist/types/components/Autocomplete.d.ts +2 -2
  8. package/dist/types/components/FilterForm.d.ts +2 -2
  9. package/dist/types/components/FilterStatePills.d.ts +1 -1
  10. package/dist/types/components/LoadingOverlay.d.ts +1 -1
  11. package/dist/types/components/PhoneNumberFilter.d.ts +2 -1
  12. package/dist/types/components/SavedFilterList.d.ts +1 -1
  13. package/dist/types/components/SpeechInput.d.ts +1 -1
  14. package/dist/types/components/Table.d.ts +1 -1
  15. package/dist/types/components/TablePagination.d.ts +1 -1
  16. package/dist/types/components/UserPreferencesPanel.d.ts +1 -1
  17. package/dist/types/framework/cell-renderer-components/CurrencyAmount.d.ts +1 -1
  18. package/dist/types/framework/cell-renderer-components/LayoutHelpers.d.ts +4 -4
  19. package/dist/types/framework/cell-renderer-components/Link.d.ts +1 -1
  20. package/dist/types/framework/cell-renderer-components/Mapping.d.ts +1 -1
  21. package/dist/types/framework/data.d.ts +1 -3
  22. package/dist/types/framework/fetch-error.d.ts +6 -2
  23. package/dist/types/framework/filters.d.ts +1 -1
  24. package/dist/types/framework/graphql-client.d.ts +28 -0
  25. package/dist/types/lib/index.d.ts +1 -0
  26. package/dist/types/views/payment-requests/components/NoRowsExtendDateRange.d.ts +1 -1
  27. package/docs/analytics.md +2 -2
  28. package/docs/api/runtime.md +2 -0
  29. package/package.json +11 -12
package/README.md CHANGED
@@ -84,7 +84,7 @@ React and ReactDOM 19 are peer dependencies; ensure they are installed in the ho
84
84
  - **App State Before Effects:** The table's state and its effects live in `src/framework/state/app-state.ts`: messages, pure transitions, and the commands `useAppState` runs (requests, user data writes, analytics, toolbar actions). Before adding a `useEffect`, `useLayoutEffect`, ref or `useState` to `App.tsx` for table behaviour, consider a message and a command instead. Transitions are tested as plain functions in `app-state.test.ts`, messages are handled in the order they are sent, and `useAppState` already hands commands the values of the latest render, which is what refs in `App.tsx` usually work around. `DTVAPI.runAction` is an example: a first version kept the running actions in refs and set the API in a layout effect, and as `actionRequested`/`actionEnded` and a `runAction` command it needs neither. Effects in `App.tsx` are for what the state cannot own, such as the DOM.
85
85
 
86
86
  ## Integration & Data Flow
87
- - Data is fetched via GraphQL using `graphql-request` (see `src/framework/data.ts`).
87
+ - Data is fetched via GraphQL with DTV's own `fetch`-based client (see `src/framework/graphql-client.ts` and `src/framework/data.ts`).
88
88
  - Views define their own GraphQL queries and filter schemas.
89
89
  - Filter expressions are serialized/deserialized using helpers in `src/framework/filters.ts`.
90
90
  - Unified URL Filter Param: Both share links and persistence use a single base64 URL-safe encoded parameter `dtv-filter-state`. Enable syncing by passing `syncFilterStateToUrl: true` to `dtv.renderTableView` (or `?sync-filter-state-to-url=true` in dev). The param is updated only when filters are applied (not on every change). It names the view the filter state belongs to, so a shared link opens that view. When disabled, a one-off link is consumed (param removed after load).
@@ -48,17 +48,18 @@ async function importConfig(abs) {
48
48
  const tmpFile = path.join(path.dirname(abs), `.${path.basename(abs)}.dtv-tmp.${Date.now()}.mjs`);
49
49
  await fs.writeFile(tmpFile, transpiled.outputText, 'utf8');
50
50
  try {
51
- const tmpUrl = pathToFileURL(tmpFile).href;
52
- const mod = await import(`${tmpUrl}?t=${Date.now()}`);
51
+ // The file name is new on every run, so the import is never served from cache
52
+ const mod = await import(pathToFileURL(tmpFile).href);
53
53
  return (mod.default ?? mod.config ?? mod);
54
54
  }
55
55
  finally {
56
56
  await fs.unlink(tmpFile).catch(() => undefined);
57
57
  }
58
58
  }
59
- // JS/MJS/CJS (or any Node-supported module) can be imported directly.
60
- // Cache-bust import to allow repeated runs.
61
- const mod = await import(`${url}?t=${Date.now()}`);
59
+ // JS/MJS/CJS (or any Node-supported module) can be imported directly. The CLI loads
60
+ // its config once per process, so the import needs no cache-busting query (which
61
+ // Jest 30.5's module loader would also take for part of the file name).
62
+ const mod = await import(url);
62
63
  return (mod.default ?? mod.config ?? mod);
63
64
  })();
64
65
  if (!isRecord(cfg)) {
@@ -110,7 +111,7 @@ export async function loadDefinitionsConfig(configPath) {
110
111
  catch (err) {
111
112
  throw new Error(`Failed to load ${configPath}: ${err instanceof Error ? err.message : String(err)}\n` +
112
113
  'If it fails for want of what only typegen needs (e.g. a secret for the schema), make `schema` a function: ' +
113
- 'it is called by `dtv typegen` only.');
114
+ 'it is called by `dtv typegen` only.', { cause: err });
114
115
  }
115
116
  validateScan(cfg);
116
117
  const scan = cfg.scan;