@fluxomni/api-client 0.11.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/README.md +253 -0
- package/dist/auth.d.ts +36 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +71 -0
- package/dist/auth.js.map +1 -0
- package/dist/client.d.ts +89 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +254 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +59 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +135 -0
- package/dist/errors.js.map +1 -0
- package/dist/generated/graphql.d.ts +6777 -0
- package/dist/generated/graphql.d.ts.map +1 -0
- package/dist/generated/graphql.js +13702 -0
- package/dist/generated/graphql.js.map +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -0
- package/dist/scalars.d.ts +5 -0
- package/dist/scalars.d.ts.map +1 -0
- package/dist/scalars.js +2 -0
- package/dist/scalars.js.map +1 -0
- package/package.json +61 -0
- package/src/auth.ts +127 -0
- package/src/client.ts +412 -0
- package/src/errors.ts +183 -0
- package/src/generated/graphql.ts +20296 -0
- package/src/index.ts +72 -0
- package/src/scalars.ts +4 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fluxomni TypeScript GraphQL API Client
|
|
3
|
+
*
|
|
4
|
+
* A thin Fluxomni GraphQL transport with:
|
|
5
|
+
* - Session-aware HTTP and WebSocket setup
|
|
6
|
+
* - Direct raw GraphQL execution for automation scripts
|
|
7
|
+
* - Generated GraphQL documents and types for typed callers
|
|
8
|
+
* - Browser and server convenience helpers without a hand-written domain SDK
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { GraphQLClient, StateDocument } from '@fluxomni/api-client';
|
|
13
|
+
*
|
|
14
|
+
* // Create client
|
|
15
|
+
* const client = new GraphQLClient({
|
|
16
|
+
* httpEndpoint: 'http://localhost:8001/api',
|
|
17
|
+
* wsEndpoint: 'ws://localhost:8001/api/subscriptions',
|
|
18
|
+
* });
|
|
19
|
+
*
|
|
20
|
+
* const data = await client.executeRaw<{
|
|
21
|
+
* routes: { allRoutes: Array<{ id: string; label?: string | null }> };
|
|
22
|
+
* }>(`
|
|
23
|
+
* query Routes {
|
|
24
|
+
* routes { allRoutes { id label } }
|
|
25
|
+
* }
|
|
26
|
+
* `);
|
|
27
|
+
*
|
|
28
|
+
* // Subscribe to state changes
|
|
29
|
+
* client.subscribe({ query: StateDocument }).subscribe({
|
|
30
|
+
* next: (result) => {
|
|
31
|
+
* console.log('Routes updated:', result.data);
|
|
32
|
+
* },
|
|
33
|
+
* error: (err) => console.error(err),
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @packageDocumentation
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
// Low-level client
|
|
41
|
+
export {
|
|
42
|
+
type AuthRole,
|
|
43
|
+
type AuthStatus,
|
|
44
|
+
type AuthUser,
|
|
45
|
+
createSessionFetch,
|
|
46
|
+
type LoginOptions,
|
|
47
|
+
type LoginResult,
|
|
48
|
+
login,
|
|
49
|
+
SESSION_COOKIE_NAME,
|
|
50
|
+
} from './auth.js';
|
|
51
|
+
export {
|
|
52
|
+
type ConnectionCallbacks,
|
|
53
|
+
GraphQLClient,
|
|
54
|
+
type GraphQLClientConfig,
|
|
55
|
+
type GraphQLClientLoginOptions,
|
|
56
|
+
type GraphQLClientLoginResult,
|
|
57
|
+
} from './client.js';
|
|
58
|
+
// Errors
|
|
59
|
+
export {
|
|
60
|
+
classifyGraphQLError,
|
|
61
|
+
ClientError,
|
|
62
|
+
extractField,
|
|
63
|
+
GraphQLError,
|
|
64
|
+
type GraphQLErrorCategory,
|
|
65
|
+
type GraphQLServerError,
|
|
66
|
+
MissingDataError,
|
|
67
|
+
MissingFieldError,
|
|
68
|
+
NetworkError,
|
|
69
|
+
} from './errors.js';
|
|
70
|
+
// Re-export all generated types for convenience
|
|
71
|
+
export * from './generated/graphql.js';
|
|
72
|
+
export type { DateTime } from './scalars.js';
|
package/src/scalars.ts
ADDED