@sudobility/testomniac_client 0.0.92 → 0.0.93

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 (2) hide show
  1. package/README.md +149 -19
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @sudobility/testomniac_client
2
2
 
3
- API client SDK for Starter with TanStack Query hooks.
3
+ API client SDK for the Testomniac testing platform with TanStack Query hooks.
4
4
 
5
5
  ## Installation
6
6
 
@@ -17,56 +17,186 @@ bun add react @tanstack/react-query @sudobility/types
17
17
  ## Usage
18
18
 
19
19
  ```ts
20
- import { StarterClient } from '@sudobility/testomniac_client';
20
+ import { TestomniacClient } from '@sudobility/testomniac_client';
21
21
  import {
22
- useHistories,
23
- useHistoriesTotal,
22
+ useRun,
23
+ useRunSummary,
24
+ useRunFindings,
25
+ useSubmitScan,
24
26
  } from '@sudobility/testomniac_client/hooks';
25
27
 
26
28
  // Create the HTTP client (dependency-injected NetworkClient)
27
- const client = new StarterClient({
29
+ const client = new TestomniacClient({
28
30
  baseUrl: 'https://api.example.com',
29
31
  networkClient,
30
32
  });
31
33
 
32
- // In a React component:
33
- const { data, createHistory, updateHistory, deleteHistory } =
34
- useHistories(config);
35
- const { data: total } = useHistoriesTotal(config);
34
+ // Fetch a test run directly
35
+ const run = await client.getTestRun(runId, token);
36
+
37
+ // In a React component -- query hook:
38
+ const { run, isLoading, error } = useRun({
39
+ networkClient,
40
+ baseUrl,
41
+ runId,
42
+ token,
43
+ });
44
+
45
+ // Mutation hook (public endpoint, no auth required):
46
+ const { submitScan, isSubmitting } = useSubmitScan({
47
+ networkClient,
48
+ baseUrl,
49
+ });
50
+ await submitScan({ url: 'https://example.com', email: 'user@example.com' });
36
51
  ```
37
52
 
38
53
  ## API
39
54
 
40
- ### StarterClient
55
+ ### TestomniacClient
56
+
57
+ HTTP client class constructed with `{ baseUrl, networkClient }`. Uses dependency injection via the `NetworkClient` interface from `@sudobility/types` -- no direct fetch calls. Provides 60+ async methods covering all API endpoints: users, entities, products, runners, test environments, test runs, findings, personas, test scenarios, test surfaces, test interactions, credentials, schedules, and more.
58
+
59
+ ### Hooks (74)
60
+
61
+ All hooks follow consistent patterns:
62
+
63
+ **Query hooks** accept a config object with `{ baseUrl, networkClient, token, ...params, enabled? }` and return `{ data, isLoading, error, refetch }` with safe defaults (`?? []`, `?? null`).
64
+
65
+ **Mutation hooks** return `{ mutateAsync, isPending, error, reset }` with automatic cache invalidation.
66
+
67
+ #### Runs & Summaries
68
+
69
+ - `useRun(config)` -- Single run details
70
+ - `useRunSummary(config)` -- Run summary with finding counts and expertise breakdown
71
+ - `useRunLiveDashboard(config)` -- Live dashboard data for in-progress runs
72
+ - `useRunStructure(config)` -- Run structure (pages, interactions hierarchy)
73
+ - `useRunNavigationMap(config)` -- Site navigation map for graph visualization
74
+
75
+ #### Pages & Page States
76
+
77
+ - `useRunPages(config)` -- Pages discovered in a run
78
+ - `useRunPagesSummary(config)` -- Summary of all pages in a run
79
+ - `useRunPageSummary(config)` -- Detailed summary for a single page
80
+ - `usePageStates(config)` -- Page states for a given page
81
+ - `usePageStateItems(config)` -- Actionable items within a page state
82
+ - `usePageStateScaffolds(config)` -- Scaffolds detected in a page state
83
+ - `useHtmlElement(config)` -- HTML element details
84
+
85
+ #### Test Surfaces & Bundles
86
+
87
+ - `useRunnerTestSurfaces(config)` -- Test surfaces for a runner
88
+ - `useEnvironmentTestSurfaces(config)` -- Test surfaces for an environment
89
+ - `useTestSurfaceChildSurfaces(config)` -- Child surfaces of a test surface
90
+ - `useTestSurfaceTestInteractions(config)` -- Interactions for a test surface
91
+ - `useRunnerTestSurfaceBundles(config)` -- Test surface bundles
92
+ - `useBundleSurfaces(config)` -- Surfaces in a bundle
93
+ - `useBundleInteractions(config)` -- Interactions in a bundle
94
+ - `useBundleScenarios(config)` -- Scenarios in a bundle
95
+ - `useCreateTestSurfaceBundle(config)` -- Mutation: create bundle
96
+ - `useUpdateTestSurfaceBundle(config)` -- Mutation: update bundle
97
+ - `useDeleteTestSurfaceBundle(config)` -- Mutation: delete bundle
98
+
99
+ #### Test Interactions & Test Runs
100
+
101
+ - `useRunTestInteractions(config)` -- Test interactions for a run
102
+ - `useRunnerTestInteractions(config)` -- Test interactions for a runner
103
+ - `useEnvironmentTestInteractions(config)` -- Test interactions for an environment
104
+ - `useTestInteractionActions(config)` -- Actions within a test interaction
105
+ - `useTestInteractionRun(config)` -- Single test interaction run
106
+ - `useCreateTestInteractionRun(config)` -- Mutation: create interaction run
107
+ - `useRunTestRuns(config)` -- Test runs for a run
108
+ - `useRunnerTestRuns(config)` -- Test runs for a runner
109
+ - `useTestRunFindings(config)` -- Findings for a specific test run
110
+
111
+ #### Findings & Patterns
112
+
113
+ - `useRunFindings(config)` -- Findings for a run
114
+ - `useRunnerFindings(config)` -- Findings across a runner
115
+ - `useRunPatterns(config)` -- UI patterns detected in a run
116
+ - `useRunScaffolds(config)` -- Scaffolds detected in a run
117
+ - `useRunnerScaffolds(config)` -- Scaffolds across a runner
118
+
119
+ #### Personas
120
+
121
+ - `useRunPersonas(config)` -- Personas for a run
122
+ - `useRunnerPersonas(config)` -- Personas for a runner
123
+ - `useProductPersonas(config)` -- Personas for a product
124
+ - `usePersonaUseCases(config)` -- Use cases for a persona
125
+ - `useUseCaseInputValues(config)` -- Input values for a use case
126
+ - `useCreatePersona(config)` -- Mutation: create persona
127
+ - `useUpdatePersona(config)` -- Mutation: update persona
128
+ - `useDeletePersona(config)` -- Mutation: delete persona
129
+ - `useDetectPersonas(config)` -- Mutation: AI-detect personas
130
+
131
+ #### Test Scenarios & Sequences
132
+
133
+ - `useRunnerTestScenarios(config)` -- Test scenarios for a runner
134
+ - `useTestScenarioSequences(config)` -- Sequences in a test scenario
135
+ - `useTestScenarioSequenceTestInteractions(config)` -- Interactions in a sequence
136
+ - `useTestScenarioSequenceRuns(config)` -- Runs of a sequence
137
+ - `useCreateTestScenario(config)` -- Mutation: create scenario
138
+ - `useUpdateTestScenario(config)` -- Mutation: update scenario
139
+ - `useDeleteTestScenario(config)` -- Mutation: delete scenario
140
+ - `useDetectTestScenarios(config)` -- Mutation: AI-detect scenarios
141
+ - `useGenerateSequence(config)` -- Mutation: AI-generate sequence steps
142
+
143
+ #### Schedules & Credentials
41
144
 
42
- HTTP client class constructed with `{ baseUrl, networkClient }`. Uses dependency injection via the `NetworkClient` interface -- no direct fetch calls.
145
+ - `useRunnerSchedules(config)` -- Schedules for a runner
146
+ - `useCreateTestSchedule(config)` -- Mutation: create schedule
147
+ - `useEntityCredentials(config)` -- Credentials for an entity
148
+ - `useCreateEntityCredential(config)` -- Mutation: create credential
149
+ - `useUpdateEntityCredential(config)` -- Mutation: update credential
150
+ - `useDeleteEntityCredential(config)` -- Mutation: delete credential
43
151
 
44
- ### Hooks
152
+ #### Entities, Products & Runners
45
153
 
46
- - `useHistories(config)` -- Fetches user history list; provides `createHistory`, `updateHistory`, `deleteHistory` mutations with automatic cache invalidation.
47
- - `useHistoriesTotal(config)` -- Fetches global total (public endpoint).
154
+ - `useEntities(config)` -- User's entities
155
+ - `useEntityProducts(config)` -- Products for an entity
156
+ - `useProduct(config)` -- Single product details
157
+ - `useProductRuns(config)` -- Runs for a product
158
+ - `useProductRunners(config)` -- Runners for a product
159
+ - `useProductEnvironments(config)` -- Environments for a product
160
+ - `useRunner(config)` -- Single runner details
161
+ - `useRunnerScans(config)` -- Scans for a runner
162
+ - `useRunnerPages(config)` -- Pages across a runner
163
+ - `useRunnerPageStates(config)` -- Page states across a runner
164
+ - `useEnvironmentPages(config)` -- Pages for an environment
165
+
166
+ #### Scanning
167
+
168
+ - `useSubmitScan(config)` -- Mutation: submit a scan (public endpoint, no auth required)
169
+
170
+ ### QUERY_KEYS
171
+
172
+ Type-safe cache key factory for TanStack Query with 50+ key methods. Keys are namespaced under `'testomniac'` and structured hierarchically (e.g., `QUERY_KEYS.run(runId)` produces `['testomniac', 'run', runId]`).
173
+
174
+ ### Cache Settings
175
+
176
+ - `DEFAULT_STALE_TIME` -- 5 minutes
177
+ - `DEFAULT_GC_TIME` -- 30 minutes
48
178
 
49
179
  ### Utilities
50
180
 
51
- - `createAuthHeaders(token)` -- Builds auth header object
181
+ - `createAuthHeaders(token)` -- Builds `Authorization: Bearer` header object
52
182
  - `buildUrl(base, path)` -- URL construction helper
53
183
  - `handleApiError(error)` -- Standardized API error handling
54
- - `QUERY_KEYS` -- Type-safe TanStack Query cache key factory
55
184
 
56
185
  ## Development
57
186
 
58
187
  ```bash
59
- bun run build # Build ESM
188
+ bun run build # Build ESM (tsc -> dist/)
189
+ bun run build:watch # Watch mode build
60
190
  bun run clean # Remove dist/
61
191
  bun test # Run Vitest tests
62
192
  bun run typecheck # TypeScript check
63
193
  bun run lint # ESLint
64
- bun run verify # All checks + build (use before commit)
194
+ bun run verify # typecheck + test + build (use before commit)
65
195
  ```
66
196
 
67
197
  ## Related Packages
68
198
 
69
- - **testomniac_types** -- Shared type definitions (imported for API types)
199
+ - **testomniac_types** -- Shared type definitions (imported for all API request/response types)
70
200
  - **testomniac_api** -- Backend server this client communicates with
71
201
  - **testomniac_lib** -- Business logic library that wraps this client's hooks
72
202
  - **testomniac_app** -- Web frontend (consumes transitively via testomniac_lib)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sudobility/testomniac_client",
3
- "version": "0.0.92",
3
+ "version": "0.0.93",
4
4
  "description": "Testomniac API client library with TanStack Query hooks",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -40,7 +40,7 @@
40
40
  "react": ">=18.0.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@sudobility/testomniac_types": "^0.0.73",
43
+ "@sudobility/testomniac_types": "^0.0.74",
44
44
  "@sudobility/types": "^1.9.62",
45
45
  "@tanstack/react-query": "^5.90.5",
46
46
  "@types/react": "^19.2.2",