@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/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
@@ -0,0 +1,4 @@
1
+ /**
2
+ * RFC3339 timestamp returned by the GraphQL `DateTime` scalar.
3
+ */
4
+ export type DateTime = string;