@inai-dev/types 1.0.0 → 1.2.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.
Files changed (2) hide show
  1. package/README.md +73 -13
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -10,28 +10,88 @@ npm install @inai-dev/types
10
10
 
11
11
  > **Note:** You typically don't need to install this directly. It's included as a dependency of all other `@inai-dev/*` packages.
12
12
 
13
- ## Usage
13
+ ## Auth Types
14
14
 
15
15
  ```ts
16
16
  import type {
17
- AuthObject,
18
- UserResource,
19
- SessionResource,
20
- ApplicationResource,
21
- EnvironmentResource,
22
- OrganizationResource,
17
+ AuthObject, // Base auth object (userId, tenantId, orgId, has(), getToken())
18
+ ServerAuthObject, // Extends AuthObject with protect() and redirectToSignIn()
19
+ ProtectedAuthObject, // AuthObject with non-null userId (after protect())
20
+ JWTClaims, // Decoded JWT payload (sub, tenant_id, roles, permissions, ...)
23
21
  } from "@inai-dev/types";
24
22
  ```
25
23
 
26
- ## Exported Types
24
+ ## Resource Types
27
25
 
28
- - **Auth**: `AuthObject`, `AuthConfig`, `SignInResult`, `SignUpResult`
29
- - **Resources**: `UserResource`, `SessionResource`, `ApplicationResource`, `EnvironmentResource`, `OrganizationResource`, `RoleResource`, `PermissionResource`
30
- - **Config**: `InAIConfig`, `CookieConfig`
26
+ ```ts
27
+ import type {
28
+ UserResource, // App user (id, email, firstName, lastName, roles, ...)
29
+ PlatformUserResource, // Platform admin user
30
+ SessionResource, // User session (id, userId, tenantId, expiresAt)
31
+ OrganizationResource, // Organization (id, name, slug, metadata)
32
+ ApplicationResource, // Application (id, name, slug, environments)
33
+ EnvironmentResource, // Environment (id, name, publishableKey)
34
+ ApplicationStats, // App statistics (totalUsers, activeSessions, ...)
35
+ ApiKeyResource, // API key (id, name, keyPrefix, keyType)
36
+ PaginatedResult, // Paginated response wrapper (data, total, page, limit)
37
+ } from "@inai-dev/types";
38
+ ```
39
+
40
+ ## Config Types
41
+
42
+ ```ts
43
+ import type {
44
+ InAIAuthConfig, // Client config (publishableKey, tenantId)
45
+ InAIMiddlewareConfig, // Middleware config (publicRoutes, signInUrl, beforeAuth, afterAuth)
46
+ InAIAuthSDKConfig, // SDK-wide config (signInUrl, signUpUrl, afterSignInUrl, publishableKey)
47
+ } from "@inai-dev/types";
48
+ ```
49
+
50
+ ## Result Types
51
+
52
+ ```ts
53
+ import type {
54
+ LoginParams, // { email, password }
55
+ LoginResult, // { access_token?, mfa_required?, mfa_token? }
56
+ MFAChallengeParams, // { mfa_token, code }
57
+ TokenPair, // { access_token, refresh_token, token_type, expires_in }
58
+ SignInResult, // { status, mfa_token?, user?, error? }
59
+ SignUpResult, // { status, user?, error? }
60
+ InAIAuthErrorBody, // { code, detail, field? }
61
+ } from "@inai-dev/types";
62
+ ```
63
+
64
+ ## Exports Reference
65
+
66
+ | Type | Category | Description |
67
+ |---|---|---|
68
+ | `AuthObject` | Auth | Base authentication state |
69
+ | `ServerAuthObject` | Auth | Server-side auth with protect/redirect |
70
+ | `ProtectedAuthObject` | Auth | Guaranteed authenticated state |
71
+ | `JWTClaims` | Auth | Decoded JWT token claims |
72
+ | `UserResource` | Resource | App user data |
73
+ | `PlatformUserResource` | Resource | Platform admin data |
74
+ | `SessionResource` | Resource | Session data |
75
+ | `OrganizationResource` | Resource | Organization data |
76
+ | `ApplicationResource` | Resource | Application data |
77
+ | `EnvironmentResource` | Resource | Environment data |
78
+ | `ApplicationStats` | Resource | Application statistics |
79
+ | `ApiKeyResource` | Resource | API key data |
80
+ | `PaginatedResult<T>` | Resource | Paginated response |
81
+ | `InAIAuthConfig` | Config | Client configuration |
82
+ | `InAIMiddlewareConfig` | Config | Middleware configuration |
83
+ | `InAIAuthSDKConfig` | Config | SDK global configuration |
84
+ | `LoginParams` | Result | Login request parameters |
85
+ | `LoginResult` | Result | Login response |
86
+ | `MFAChallengeParams` | Result | MFA challenge parameters |
87
+ | `TokenPair` | Result | Token pair response |
88
+ | `SignInResult` | Result | Sign-in flow result |
89
+ | `SignUpResult` | Result | Sign-up flow result |
90
+ | `InAIAuthErrorBody` | Result | Error response body |
31
91
 
32
- ## Documentation
92
+ ## Questions & Support
33
93
 
34
- See the full [API Reference](https://github.com/inai-dev/sdk/blob/main/docs/api-reference.md).
94
+ Visit [https://inai.dev](https://inai.dev) for documentation, guides, and support.
35
95
 
36
96
  ## License
37
97
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inai-dev/types",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "TypeScript types for the InAI Auth SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",