@gravity-rail/sdk 3.2.0 → 4.0.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 (38) hide show
  1. package/README.md +16 -1
  2. package/dist/{chat-interaction-Cc9hQNyx.d.ts → chat-interaction-DXgKjFqZ.d.cts} +490 -522
  3. package/dist/{chat-interaction-CoHsIqyX.d.cts → chat-interaction-a7U-tHfQ.d.ts} +490 -522
  4. package/dist/{chunk-MAPAZORN.js → chunk-WHRIIBJ4.js} +181 -144
  5. package/dist/chunk-WHRIIBJ4.js.map +1 -0
  6. package/dist/{chunk-RLFS7O2L.js → chunk-ZLF3N3ZD.js} +183 -81
  7. package/dist/chunk-ZLF3N3ZD.js.map +1 -0
  8. package/dist/helpers.cjs.map +1 -1
  9. package/dist/helpers.d.cts +2 -2
  10. package/dist/helpers.d.ts +2 -2
  11. package/dist/helpers.js +1 -1
  12. package/dist/index.cjs +339 -220
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +6 -6
  15. package/dist/index.d.ts +6 -6
  16. package/dist/index.js +2 -2
  17. package/dist/index.js.map +1 -1
  18. package/dist/internal.cjs +367 -224
  19. package/dist/internal.cjs.map +1 -1
  20. package/dist/internal.d.cts +45 -9
  21. package/dist/internal.d.ts +45 -9
  22. package/dist/internal.js +14 -6
  23. package/dist/internal.js.map +1 -1
  24. package/dist/{member-import-9h52_4KO.d.cts → member-import-BHtOru8g.d.cts} +1 -1
  25. package/dist/{member-import-BWyl88Qx.d.ts → member-import-VOLKR5dY.d.ts} +1 -1
  26. package/dist/{path-ChuuGGLG.d.ts → path-B3b3_El9.d.cts} +36 -18
  27. package/dist/{path-CXnjBalr.d.cts → path-CUY-Iw70.d.ts} +36 -18
  28. package/dist/schemas.cjs +2 -4
  29. package/dist/schemas.cjs.map +1 -1
  30. package/dist/schemas.d.cts +5 -6
  31. package/dist/schemas.d.ts +5 -6
  32. package/dist/schemas.js +2 -4
  33. package/dist/schemas.js.map +1 -1
  34. package/dist/{tasks-B7tIHQcS.d.cts → tasks-CgptqCsN.d.cts} +13 -45
  35. package/dist/{tasks-B7tIHQcS.d.ts → tasks-CgptqCsN.d.ts} +13 -45
  36. package/package.json +3 -3
  37. package/dist/chunk-MAPAZORN.js.map +0 -1
  38. package/dist/chunk-RLFS7O2L.js.map +0 -1
package/README.md CHANGED
@@ -118,7 +118,22 @@ const client = new GravityRailClient(undefined, window.location.origin);
118
118
 
119
119
  A cross-origin `baseUrl` with no credential makes unauthenticated calls.
120
120
 
121
- When an organization requires SSO, a 401 carrying `WWW-Authenticate: Bearer realm="org"` calls your `setOrgAuthHandler` handler once. A bearer client's handler must hand back the org session with `client.setOrgSession(session, orgUuid)` (sent as `X-Org-Session`); a same-origin session client is retried once after the handler resolves, carrying the httpOnly org-session cookie the sign-in left.
121
+ An organization authentication challenge (`WWW-Authenticate: Bearer realm="org"`) calls your `setOrgAuthHandler` handler. A bearer handler returns an opaque organization session candidate; it must not call `setOrgSession` during the handler:
122
+
123
+ ```typescript
124
+ client.setOrgAuthHandler(async ({ orgUuid, authUrl, acrValues }) => {
125
+ const session = await signInToOrganization({ orgUuid, authUrl, acrValues });
126
+ return { session, orgUuid, source: 'new' };
127
+ });
128
+ ```
129
+
130
+ `source: 'new'` means the server issued this session during the attempt; it does not establish MFA or reset its authentication time. A handler may return `source: 'cache'` only for a previously saved candidate, before `sessionRejected` is true. It may supply `onRejected` to remove that exact candidate from its cache. Compare the stored credential before removal so an old rejection cannot erase a newer login.
131
+
132
+ The SDK adopts a result only while the handler still owns its original credential context. It sends the candidate as `X-Org-Session` for server validation. A newly issued candidate gets one retry. A bearer request that starts without an org session may validate a cache candidate first, then make one new sign-in attempt if rejected. An empty cache does not permit two new sign-ins. Account MFA recovery has its own one-attempt budget. A concurrent login supersedes an older handler; its failure or delayed result cannot clear the newer credential. `setOrgSession` remains available for configuration outside a handler.
133
+
134
+ A same-origin cookie handler may resolve without a result after sign-in sets the httpOnly org cookie; the SDK retries once with that cookie.
135
+
136
+ `acrValues` reports the server's requested authentication context. The SDK and CLI do not forward Gravity Rail's `urn:gravity:mfa` value as a provider-specific OIDC hint. For SSO with required MFA, configure the identity provider to require MFA and return verified authentication methods. An insufficient newly issued session fails with guidance to complete Account MFA or check the identity provider configuration; the SDK does not repeat interactive sign-in.
122
137
 
123
138
  ## Core Concepts
124
139