@icanbwell/bwell-sdk-ts 2.0.0-alpha.0-rc.1754330797 → 2.0.0-alpha.0-rc.1754488327

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 (292) hide show
  1. package/README.md +17 -1
  2. package/dist/__version__.d.ts +1 -1
  3. package/dist/__version__.js +1 -1
  4. package/dist/api/base/connection/connection-manager.d.ts +55 -49
  5. package/dist/api/base/connection/connection-manager.js +3 -0
  6. package/dist/api/base/connection/connection-request.d.ts +15 -1
  7. package/dist/api/base/connection/connection-request.js +8 -0
  8. package/dist/api/base/connection/index.d.ts +1 -2
  9. package/dist/api/base/health-data/health-data-request.d.ts +105 -0
  10. package/dist/api/base/health-data/health-data-request.js +81 -0
  11. package/dist/api/base/health-data/health-manager.d.ts +104 -64
  12. package/dist/api/base/health-data/index.d.ts +1 -1
  13. package/dist/api/base/health-data/lab-knowledge-request.d.ts +9 -0
  14. package/dist/api/base/health-data/lab-knowledge-request.js +3 -0
  15. package/dist/api/base/health-data/medication-knowledge-request.d.ts +9 -0
  16. package/dist/api/base/health-data/medication-knowledge-request.js +3 -0
  17. package/dist/api/base/health-data/medication-pricing-request.d.ts +9 -0
  18. package/dist/api/base/health-data/medication-pricing-request.js +3 -0
  19. package/dist/api/base/health-space/appointments-request.d.ts +9 -0
  20. package/dist/api/base/health-space/appointments-request.js +3 -0
  21. package/dist/api/base/health-space/cancel-appointment-request.d.ts +8 -1
  22. package/dist/api/base/health-space/cancel-appointment-request.js +4 -0
  23. package/dist/api/base/health-space/cancellation-reasons-request.d.ts +28 -0
  24. package/dist/api/base/health-space/{cancelationReasons-request.js → cancellation-reasons-request.js} +10 -4
  25. package/dist/api/base/health-space/health-space-manager.d.ts +33 -24
  26. package/dist/api/base/health-space/index.d.ts +2 -2
  27. package/dist/api/base/health-space/index.js +1 -1
  28. package/dist/api/base/identity/identity-manager.d.ts +97 -10
  29. package/dist/api/base/questionnaire/index.d.ts +1 -1
  30. package/dist/api/base/questionnaire/next-question-request.d.ts +8 -2
  31. package/dist/api/base/questionnaire/next-question-request.js +4 -1
  32. package/dist/api/base/questionnaire/questionnaire-manager.d.ts +16 -9
  33. package/dist/api/base/requests/search-date.d.ts +12 -0
  34. package/dist/api/base/requests/search-string.d.ts +6 -0
  35. package/dist/api/base/requests/search-token.d.ts +18 -0
  36. package/dist/api/base/user/create-consent-request.d.ts +13 -1
  37. package/dist/api/base/user/create-consent-request.js +8 -3
  38. package/dist/api/base/user/create-verification-url-request.d.ts +12 -0
  39. package/dist/api/base/user/create-verification-url-request.js +6 -0
  40. package/dist/api/base/user/get-consents-request.d.ts +19 -1
  41. package/dist/api/base/user/get-consents-request.js +13 -1
  42. package/dist/api/base/user/index.d.ts +1 -2
  43. package/dist/api/base/user/update-profile-request.d.ts +11 -3
  44. package/dist/api/base/user/update-profile-request.js +5 -3
  45. package/dist/api/base/user/user-manager.d.ts +50 -55
  46. package/dist/api/base/user/validators.d.ts +5 -0
  47. package/dist/api/base/user/validators.js +13 -0
  48. package/dist/api/graphql-api/connection/connection-response-factory.d.ts +1 -1
  49. package/dist/api/graphql-api/connection/connection-response-factory.js +1 -4
  50. package/dist/api/graphql-api/connection/graphql-connection-manager.d.ts +7 -6
  51. package/dist/api/graphql-api/connection/graphql-connection-manager.js +6 -3
  52. package/dist/api/graphql-api/errors/errors.js +1 -1
  53. package/dist/api/graphql-api/health-space/cancel-appointment-request-factory.js +1 -2
  54. package/dist/api/graphql-api/health-space/graphql-health-space-manager.d.ts +5 -4
  55. package/dist/api/graphql-api/health-space/graphql-health-space-manager.js +7 -6
  56. package/dist/api/graphql-api/healthdata/graphql-health-manager.d.ts +13 -12
  57. package/dist/api/graphql-api/identity/graphql-identity-manager.d.ts +2 -1
  58. package/dist/api/graphql-api/identity/graphql-identity-manager.js +4 -2
  59. package/dist/api/graphql-api/questionnaire/graphql-questionnaire-manager.d.ts +3 -2
  60. package/dist/api/graphql-api/questionnaire/graphql-questionnaire-manager.js +2 -1
  61. package/dist/api/graphql-api/user/graphql-user-manager.d.ts +7 -7
  62. package/dist/api/graphql-api/user/graphql-user-manager.js +7 -4
  63. package/dist/api/graphql-api/user/update-profile-request-factory.js +1 -2
  64. package/dist/auth/auth-code-strategy.d.ts +2 -1
  65. package/dist/auth/auth-strategy.d.ts +1 -1
  66. package/dist/auth/oauth-strategy.d.ts +2 -1
  67. package/dist/auth/username-password-strategy.d.ts +2 -1
  68. package/dist/bwell-sdk/bwell-sdk.d.ts +289 -33
  69. package/dist/bwell-sdk/bwell-sdk.js +294 -30
  70. package/dist/config/bwell-config.d.ts +8 -2
  71. package/dist/config/bwell-config.js +1 -3
  72. package/dist/config/sdk-config.d.ts +1 -1
  73. package/dist/errors/authentication-error.d.ts +7 -0
  74. package/dist/errors/authentication-error.js +7 -0
  75. package/dist/errors/bwell-error.d.ts +12 -2
  76. package/dist/errors/bwell-error.js +5 -2
  77. package/dist/errors/illegal-argument-error.d.ts +7 -0
  78. package/dist/errors/illegal-argument-error.js +7 -0
  79. package/dist/errors/illegal-state-error.d.ts +7 -0
  80. package/dist/errors/illegal-state-error.js +7 -0
  81. package/dist/errors/invalid-client-key-error.d.ts +7 -0
  82. package/dist/errors/invalid-client-key-error.js +7 -0
  83. package/dist/errors/invalid-credentials-type-error.d.ts +7 -0
  84. package/dist/errors/invalid-credentials-type-error.js +7 -0
  85. package/dist/errors/invalid-token-error.d.ts +4 -1
  86. package/dist/errors/invalid-token-error.js +4 -1
  87. package/dist/errors/network-error.d.ts +7 -0
  88. package/dist/errors/network-error.js +7 -0
  89. package/dist/errors/operation-outcome-error.d.ts +8 -1
  90. package/dist/errors/operation-outcome-error.js +7 -0
  91. package/dist/errors/unknown-error.d.ts +7 -0
  92. package/dist/errors/unknown-error.js +7 -0
  93. package/dist/errors/validation-error.d.ts +7 -0
  94. package/dist/errors/validation-error.js +7 -0
  95. package/dist/graphql/operations/index.d.ts +30 -30
  96. package/dist/graphql/operations/index.js +6 -4
  97. package/dist/graphql/operations/types.d.ts +242 -6
  98. package/dist/graphql/schema.d.ts +90 -277
  99. package/dist/graphql/schema.js +1 -369
  100. package/dist/index.d.ts +7 -5
  101. package/dist/index.js +5 -4
  102. package/dist/language/language-manager.d.ts +25 -10
  103. package/dist/language/language-manager.js +5 -0
  104. package/dist/models/common/address.d.ts +41 -0
  105. package/dist/models/common/annotation.d.ts +18 -0
  106. package/dist/models/common/attachment.d.ts +18 -0
  107. package/dist/models/common/bundle.d.ts +59 -0
  108. package/dist/models/common/codeable-concept.d.ts +17 -0
  109. package/dist/models/common/codeable-concept.js +1 -0
  110. package/dist/models/common/coding.d.ts +18 -0
  111. package/dist/models/common/coding.js +1 -0
  112. package/dist/models/common/component.d.ts +23 -0
  113. package/dist/models/common/component.js +1 -0
  114. package/dist/models/common/contact-point.d.ts +28 -0
  115. package/dist/models/common/contact-point.js +1 -0
  116. package/dist/models/common/expression.d.ts +20 -0
  117. package/dist/models/common/expression.js +1 -0
  118. package/dist/models/common/extension.d.ts +47 -0
  119. package/dist/models/common/extension.js +1 -0
  120. package/dist/models/common/fhir-error.d.ts +23 -0
  121. package/dist/models/common/fhir-error.js +1 -0
  122. package/dist/models/common/human-name.d.ts +20 -0
  123. package/dist/models/common/human-name.js +1 -0
  124. package/dist/models/common/identifier.d.ts +19 -0
  125. package/dist/models/common/identifier.js +1 -0
  126. package/dist/models/common/index.d.ts +23 -0
  127. package/dist/models/common/index.js +2 -0
  128. package/dist/models/common/location.d.ts +44 -0
  129. package/dist/models/common/location.js +1 -0
  130. package/dist/models/common/meta.d.ts +21 -0
  131. package/dist/models/common/meta.js +1 -0
  132. package/dist/models/common/narrative.d.ts +14 -0
  133. package/dist/models/common/narrative.js +1 -0
  134. package/dist/models/common/operation-outcome.d.ts +48 -0
  135. package/dist/models/common/operation-outcome.js +1 -0
  136. package/dist/models/common/paging-info.d.ts +18 -0
  137. package/dist/models/common/paging-info.js +1 -0
  138. package/dist/models/common/period.d.ts +14 -0
  139. package/dist/models/common/period.js +1 -0
  140. package/dist/models/common/quantity.d.ts +20 -0
  141. package/dist/models/common/quantity.js +1 -0
  142. package/dist/models/common/range.d.ts +15 -0
  143. package/dist/models/common/range.js +1 -0
  144. package/dist/models/common/ratio.d.ts +15 -0
  145. package/dist/models/common/ratio.js +1 -0
  146. package/dist/models/common/reference-range.d.ts +13 -0
  147. package/dist/models/common/reference-range.js +1 -0
  148. package/dist/models/common/reference.d.ts +26 -0
  149. package/dist/models/common/reference.js +1 -0
  150. package/dist/models/connection/base-connection.d.ts +27 -0
  151. package/dist/models/connection/base-connection.js +1 -0
  152. package/dist/models/connection/connection-status.d.ts +15 -0
  153. package/dist/models/connection/connection-status.js +1 -0
  154. package/dist/models/connection/connection.d.ts +32 -0
  155. package/dist/models/connection/connection.js +1 -0
  156. package/dist/models/connection/data-source.d.ts +27 -0
  157. package/dist/models/connection/data-source.js +1 -0
  158. package/dist/models/connection/index.d.ts +6 -0
  159. package/dist/models/connection/index.js +1 -0
  160. package/dist/models/connection/member-connection.d.ts +25 -0
  161. package/dist/models/connection/member-connection.js +1 -0
  162. package/dist/models/connection/oauth-url.d.ts +12 -0
  163. package/dist/models/connection/oauth-url.js +1 -0
  164. package/dist/models/enums/category-code.d.ts +11 -0
  165. package/dist/models/enums/category-code.js +13 -0
  166. package/dist/models/enums/connection-category.d.ts +9 -0
  167. package/dist/models/enums/connection-category.js +1 -0
  168. package/dist/models/enums/consent-provision-type.d.ts +11 -0
  169. package/dist/models/enums/consent-provision-type.js +2 -0
  170. package/dist/models/enums/consent-status.d.ts +11 -0
  171. package/dist/models/enums/consent-status.js +9 -0
  172. package/dist/models/enums/data-connection-status.d.ts +9 -0
  173. package/dist/models/enums/data-connection-status.js +1 -0
  174. package/dist/models/enums/data-connection-type.d.ts +9 -0
  175. package/dist/models/enums/data-connection-type.js +1 -0
  176. package/dist/models/enums/index.d.ts +9 -0
  177. package/dist/models/enums/index.js +4 -0
  178. package/dist/models/enums/log-level.d.ts +8 -0
  179. package/dist/models/enums/log-level.js +1 -0
  180. package/dist/models/enums/person-gender.d.ts +11 -0
  181. package/dist/models/enums/person-gender.js +7 -0
  182. package/dist/models/enums/sync-status.d.ts +9 -0
  183. package/dist/models/enums/sync-status.js +1 -0
  184. package/dist/models/health-data/allergy-intolerance-bundle.d.ts +11 -0
  185. package/dist/models/health-data/allergy-intolerance-bundle.js +1 -0
  186. package/dist/models/health-data/allergy-intolerance-entry.d.ts +11 -0
  187. package/dist/models/health-data/allergy-intolerance-entry.js +1 -0
  188. package/dist/models/health-data/allergy-intolerance-group.d.ts +36 -0
  189. package/dist/models/health-data/allergy-intolerance-group.js +1 -0
  190. package/dist/models/health-data/allergy-intolerance-reaction.d.ts +23 -0
  191. package/dist/models/health-data/allergy-intolerance-reaction.js +1 -0
  192. package/dist/models/health-data/allergy-intolerance.d.ts +46 -0
  193. package/dist/models/health-data/allergy-intolerance.js +1 -0
  194. package/dist/models/health-data/care-plan-group.d.ts +34 -0
  195. package/dist/models/health-data/care-plan-group.js +1 -0
  196. package/dist/models/health-data/condition-group.d.ts +34 -0
  197. package/dist/models/health-data/condition-group.js +1 -0
  198. package/dist/models/health-data/diagnostic-report-lab-group.d.ts +37 -0
  199. package/dist/models/health-data/diagnostic-report-lab-group.js +1 -0
  200. package/dist/models/health-data/encounter-group.d.ts +40 -0
  201. package/dist/models/health-data/encounter-group.js +1 -0
  202. package/dist/models/health-data/health-summary.d.ts +18 -0
  203. package/dist/models/health-data/health-summary.js +1 -0
  204. package/dist/models/health-data/immunization-group.d.ts +33 -0
  205. package/dist/models/health-data/immunization-group.js +1 -0
  206. package/dist/models/health-data/index.d.ts +15 -0
  207. package/dist/models/health-data/index.js +1 -0
  208. package/dist/models/health-data/lab-group.d.ts +43 -0
  209. package/dist/models/health-data/lab-group.js +1 -0
  210. package/dist/models/health-data/medication-group.d.ts +35 -0
  211. package/dist/models/health-data/medication-group.js +1 -0
  212. package/dist/models/health-data/procedure-group.d.ts +35 -0
  213. package/dist/models/health-data/procedure-group.js +1 -0
  214. package/dist/models/health-data/vital-sign-group.d.ts +43 -0
  215. package/dist/models/health-data/vital-sign-group.js +1 -0
  216. package/dist/models/health-space/appointment-bundle.d.ts +11 -0
  217. package/dist/models/health-space/appointment-bundle.js +1 -0
  218. package/dist/models/health-space/appointment-entry.d.ts +11 -0
  219. package/dist/models/health-space/appointment-entry.js +1 -0
  220. package/dist/models/health-space/appointment-participant.d.ts +17 -0
  221. package/dist/models/health-space/appointment-participant.js +1 -0
  222. package/dist/models/health-space/appointment-update.d.ts +14 -0
  223. package/dist/models/health-space/appointment-update.js +1 -0
  224. package/dist/models/health-space/appointment.d.ts +30 -0
  225. package/dist/models/health-space/appointment.js +1 -0
  226. package/dist/models/health-space/cancellation-reasons.d.ts +32 -0
  227. package/dist/models/health-space/cancellation-reasons.js +1 -0
  228. package/dist/models/health-space/index.d.ts +6 -0
  229. package/dist/models/health-space/index.js +1 -0
  230. package/dist/models/identity/auth-tokens.d.ts +25 -0
  231. package/dist/models/identity/auth-tokens.js +1 -0
  232. package/dist/models/identity/create-guest-access-token-results.d.ts +12 -0
  233. package/dist/models/identity/create-guest-access-token-results.js +1 -0
  234. package/dist/models/identity/index.d.ts +4 -0
  235. package/dist/models/identity/index.js +1 -0
  236. package/dist/models/identity/refresh-token-results.d.ts +8 -0
  237. package/dist/models/identity/refresh-token-results.js +1 -0
  238. package/dist/models/identity/sdk-configuration-result.d.ts +27 -0
  239. package/dist/models/identity/sdk-configuration-result.js +1 -0
  240. package/dist/models/index.d.ts +7 -4
  241. package/dist/models/index.js +7 -4
  242. package/dist/models/questionnaire/index.d.ts +5 -0
  243. package/dist/models/questionnaire/index.js +1 -0
  244. package/dist/models/questionnaire/questionnaire-item.d.ts +38 -0
  245. package/dist/models/questionnaire/questionnaire-item.js +1 -0
  246. package/dist/models/questionnaire/questionnaire-response-answer.d.ts +33 -0
  247. package/dist/models/questionnaire/questionnaire-response-answer.js +1 -0
  248. package/dist/models/questionnaire/questionnaire-response-item.d.ts +19 -0
  249. package/dist/models/questionnaire/questionnaire-response-item.js +1 -0
  250. package/dist/models/questionnaire/questionnaire-response.d.ts +29 -0
  251. package/dist/models/questionnaire/questionnaire-response.js +1 -0
  252. package/dist/models/questionnaire/questionnaire.d.ts +30 -0
  253. package/dist/models/questionnaire/questionnaire.js +1 -0
  254. package/dist/models/user/consent.d.ts +91 -0
  255. package/dist/models/user/consent.js +1 -0
  256. package/dist/models/user/index.d.ts +4 -0
  257. package/dist/models/user/index.js +1 -0
  258. package/dist/models/user/person.d.ts +43 -0
  259. package/dist/models/user/person.js +1 -0
  260. package/dist/models/user/user.d.ts +12 -0
  261. package/dist/models/user/user.js +1 -0
  262. package/dist/models/user/verification-result.d.ts +30 -0
  263. package/dist/models/user/verification-result.js +1 -0
  264. package/dist/requests/paged-request.d.ts +35 -0
  265. package/dist/requests/paged-request.js +22 -0
  266. package/dist/requests/request.d.ts +16 -0
  267. package/dist/requests/request.js +8 -0
  268. package/dist/requests/validator.d.ts +15 -0
  269. package/dist/requests/validator.js +7 -0
  270. package/dist/results/bwell-query-result.d.ts +5 -0
  271. package/dist/results/bwell-query-result.js +5 -0
  272. package/dist/results/bwell-transaction-result.d.ts +17 -3
  273. package/dist/results/bwell-transaction-result.js +15 -1
  274. package/dist/results/index.d.ts +1 -0
  275. package/dist/results/index.js +1 -0
  276. package/dist/tokens/load-auth-tokens.d.ts +1 -1
  277. package/dist/tokens/token-storage.d.ts +4 -0
  278. package/dist/tokens/token-storage.js +2 -0
  279. package/package.json +5 -2
  280. package/dist/api/base/connection/connection.d.ts +0 -19
  281. package/dist/api/base/health-space/cancelationReasons-request.d.ts +0 -16
  282. package/dist/api/base/user/types.d.ts +0 -9
  283. package/dist/api/base/user/types.js +0 -17
  284. package/dist/models/coding.d.ts +0 -5
  285. package/dist/models/fhir-error.d.ts +0 -9
  286. package/dist/models/user.d.ts +0 -4
  287. /package/dist/{api/base/connection/connection.js → models/common/address.js} +0 -0
  288. /package/dist/models/{coding.js → common/annotation.js} +0 -0
  289. /package/dist/models/{fhir-error.js → common/attachment.js} +0 -0
  290. /package/dist/models/{user.js → common/bundle.js} +0 -0
  291. /package/dist/{models → results}/operation-outcome.d.ts +0 -0
  292. /package/dist/{models → results}/operation-outcome.js +0 -0
@@ -1,86 +1,342 @@
1
1
  import { BaseManagerError } from "../api/base/errors.js";
2
2
  import { HealthManager } from "../api/base/health-data/index.js";
3
- import type { AuthTokens, CreateGuestAccessTokenResults } from "../api/base/identity/index.js";
4
3
  import { type Credentials } from "../auth/index.js";
5
4
  import { type BWellConfig } from "../config/index.js";
6
5
  import { BWellError, type AuthenticationError, type InvalidClientKeyError, type InvalidTokenError, type OperationOutcomeError } from "../errors/index.js";
7
6
  import { ConnectionManager, HealthSpaceManager, QuestionnaireManager, UserManager } from "../index.js";
7
+ import { type LanguageManager } from "../language/index.js";
8
+ import { AuthTokens, CreateGuestAccessTokenResults } from "../models/identity/index.js";
8
9
  import { BWellTransactionResult } from "../results/index.js";
9
- export { AuthTokens } from "../api/base/identity/index.js";
10
10
  /**
11
- * The BWell SDK is the main entry point for the SDK.
11
+ * # b.well SDK
12
12
  *
13
- * It is responsible for initializing the SDK, authenticating the user, and providing
14
- * access to all of the SDK's functionality via the manager classes (see [Interfaces](../README.md#interfaces)).
13
+ * The b.well SDK is the main entry point for interacting with the b.well Connected Health platform.
14
+ *
15
+ * Provides a comprehensive TypeScript/JavaScript interface with organized manager categories for:
16
+ * - Health data access (conditions, medications, labs, procedures)
17
+ * - User management (profiles, consent, identity verification)
18
+ * - Appointment management (scheduling, viewing, canceling)
19
+ * - Connection management (external healthcare providers)
20
+ * - Questionnaire processing (dynamic forms and responses)
21
+ *
22
+ * ## Basic Usage
15
23
  *
16
- * @example
17
- * Simple initialization with oauth authentication and only required config properties.
18
- * Note that the SDK must be initialized and authenticated for most data accessx
19
- * methods to work properly.
20
24
  * ```typescript
21
- * const sdk = new BWellSDK({
22
- * clientKey: "YOUR_CLIENT_KEY",
23
- * clientSecret: "YOUR_CLIENT_SECRET",
24
- * });
25
+ * import { BWellSDK } from '@bwell/sdk';
26
+ *
27
+ * const sdk = new BWellSDK({ clientKey: "YOUR_CLIENT_KEY" });
28
+ * await sdk.initialize();
29
+ * await sdk.authenticate({ token: "YOUR_TOKEN" });
30
+ *
31
+ * // Access health data
32
+ * const conditions = await sdk.health.getConditions();
33
+ * const profile = await sdk.user.getProfile();
25
34
  * ```
35
+ *
36
+ * @see {@link HealthManager} for health data operations
37
+ * @see {@link UserManager} for user management operations
38
+ * @see {@link HealthSpaceManager} for appointment management
39
+ * @see {@link ConnectionManager} for provider connections
40
+ * @see {@link QuestionnaireManager} for questionnaire processing
41
+ *
42
+
43
+ * @class BWellSDK
44
+ * @category Core
45
+ * @title BWellSDK
46
+ * @excerpt Main entry point for interacting with the b.well Connected Health platform
26
47
  */
27
48
  export declare class BWellSDK {
28
49
  #private;
29
50
  constructor(config: BWellConfig);
30
51
  /**
31
- * Initializes the SDK with the provided configuration.
32
- * @returns A promise that resolves to a BWellTransactionResult with a null data value if the SDK was initialized successfully, or an error if it was not.
52
+ * ## Initialize SDK
53
+ *
54
+ * Initializes the SDK with the provided configuration. This method must be called
55
+ * before using any other SDK functionality.
56
+ *
57
+ * **Prerequisites:**
58
+ * - Valid `clientKey` must be provided in the constructor
59
+ * - Network connectivity to b.well services
60
+ *
61
+ * **Post-initialization:**
62
+ * - SDK configuration is validated and loaded
63
+ * - Base dependencies are initialized
64
+ * - Ready for authentication
65
+ *
66
+ * @returns {Promise<BWellTransactionResult<null, InvalidClientKeyError | OperationOutcomeError>>}
67
+ * A promise that resolves to a BWellTransactionResult with:
68
+ * - `null` data on success
69
+ * - `InvalidClientKeyError` if client credentials are invalid
70
+ * - `OperationOutcomeError` if server-side initialization fails
71
+ *
33
72
  * @example
34
73
  * ```typescript
35
74
  * const sdk = new BWellSDK({
36
- * clientKey: "YOUR_CLIENT_KEY",
37
- * clientSecret: "YOUR_CLIENT_SECRET",
75
+ * clientKey: "YOUR_CLIENT_KEY",
38
76
  * });
39
77
  *
40
- * await sdk.initialize();
78
+ * const initResult = await sdk.initialize();
79
+ * if (initResult.success()) {
80
+ * console.log("SDK initialized successfully");
81
+ * } else {
82
+ * console.error("Failed to initialize SDK:", initResult.error().message);
83
+ * }
41
84
  * ```
42
85
  */
43
86
  initialize(): Promise<BWellTransactionResult<null, InvalidClientKeyError | OperationOutcomeError>>;
44
87
  /**
45
- * Authenticates the user with the provided credentials.
46
- * @param credentials The credentials to be used for authentication.
47
- * @returns A promise that resolves to a BWellTransactionResult with a null data value if the user was authenticated successfully, or an error if they were not.
88
+ * ## Authenticate User
89
+ *
90
+ * Authenticates the user with the provided credentials and prepares the SDK for
91
+ * data access operations.
92
+ *
93
+ * **Prerequisites:**
94
+ * - SDK must be initialized via `initialize()`
95
+ * - Valid authentication credentials
96
+ *
97
+ * **Authentication Flow:**
98
+ * 1. Validates credentials with authentication strategy
99
+ * 2. Bootstraps authentication tokens
100
+ * 3. Initializes token management
101
+ * 4. Prepares API providers for authenticated requests
102
+ *
103
+ * **Supported Credential Types:**
104
+ * - Token-based authentication
105
+ * - OAuth credentials (depending on configuration)
106
+ *
107
+ * @param {Credentials} credentials - The credentials to be used for authentication
108
+ * @returns {Promise<BWellTransactionResult<null, AuthenticationError | InvalidTokenError>>}
109
+ * A promise that resolves to a BWellTransactionResult with:
110
+ * - `null` data on success
111
+ * - `AuthenticationError` if authentication fails
112
+ * - `InvalidTokenError` if provided tokens are invalid
113
+ *
48
114
  * @example
49
115
  * ```typescript
50
116
  * const sdk = new BWellSDK({
51
- * clientKey: "YOUR_CLIENT_KEY",
52
- * clientSecret: "YOUR_CLIENT_SECRET",
117
+ * clientKey: "YOUR_CLIENT_KEY",
53
118
  * });
54
119
  *
55
120
  * await sdk.initialize();
56
121
  *
57
- * await sdk.authenticate({
58
- * token: "YOUR_TOKEN",
122
+ * const authResult = await sdk.authenticate({
123
+ * token: "YOUR_ACCESS_TOKEN",
59
124
  * });
125
+ *
126
+ * if (authResult.success()) {
127
+ * console.log("Authentication successful");
128
+ * // Now you can use all SDK functionality
129
+ * const profile = await sdk.user.getProfile();
130
+ * } else {
131
+ * console.error("Authentication failed:", authResult.error().message);
132
+ * }
60
133
  * ```
61
134
  */
62
135
  authenticate(credentials: Credentials): Promise<BWellTransactionResult<null, AuthenticationError | InvalidTokenError>>;
63
136
  /**
64
- * Sets auth tokens for a pre-authenticated user. Performs a token refresh to
65
- * validate the provided tokens.
137
+ * ## Set Authentication Tokens
138
+ *
139
+ * Sets auth tokens for a pre-authenticated user. This method performs token validation
140
+ * and can be used in place of `authenticate()` when tokens are obtained through
141
+ * external means.
142
+ *
143
+ * **Use Cases:**
144
+ * - Integration with existing authentication systems
145
+ * - Server-side token management
146
+ * - Custom authentication flows
66
147
  *
67
- * This can be used in place of `authenticate` for times when a user has been
68
- * authenticated through means other than the SDK.
148
+ * **Token Validation:**
149
+ * - Validates token format and structure
150
+ * - Parses user information from ID token
151
+ * - Initializes token refresh mechanisms
152
+ *
153
+ * @param {AuthTokens} authTokens - Auth tokens for pre-authenticated user containing:
154
+ * - `accessToken` - Access token for API requests
155
+ * - `idToken` - ID token containing user information
156
+ * - `refreshToken` - Refresh token for token renewal
69
157
  *
70
- * @param {AuthTokens} authTokens - Auth tokens for pre-authenticated user
71
158
  * @returns {Promise<BWellTransactionResult<null, OperationOutcomeError | InvalidTokenError>>}
159
+ * A promise that resolves to a BWellTransactionResult with:
160
+ * - `null` data on success
161
+ * - `OperationOutcomeError` if server-side validation fails
162
+ * - `InvalidTokenError` if provided tokens are invalid or expired
163
+ *
164
+ * @example
165
+ * ```typescript
166
+ * const sdk = new BWellSDK({
167
+ * clientKey: "YOUR_CLIENT_KEY",
168
+ * });
169
+ *
170
+ * await sdk.initialize();
171
+ *
172
+ * // Use tokens obtained from external authentication
173
+ * const tokenResult = await sdk.setAuthTokens({
174
+ * accessToken: "your-access-token",
175
+ * idToken: "your-id-token",
176
+ * refreshToken: "your-refresh-token"
177
+ * });
178
+ *
179
+ * if (tokenResult.success()) {
180
+ * console.log("Tokens set successfully");
181
+ * // SDK is now ready for use
182
+ * }
183
+ * ```
72
184
  */
73
185
  setAuthTokens(authTokens: AuthTokens): Promise<BWellTransactionResult<null, OperationOutcomeError | InvalidTokenError>>;
186
+ /**
187
+ * ## Authenticate From Storage
188
+ *
189
+ * Authenticates the user using tokens previously stored in the configured token storage.
190
+ * This method provides a convenient way to restore user sessions without requiring
191
+ * manual credential input.
192
+ *
193
+ * **Prerequisites:**
194
+ * - SDK must be initialized via `initialize()`
195
+ * - `tokenStorage` must be configured in the BWell config
196
+ * - Valid tokens must exist in the configured storage
197
+ *
198
+ * **Authentication Flow:**
199
+ * 1. Loads tokens from the configured token storage
200
+ * 2. Validates and bootstraps the loaded tokens
201
+ * 3. Refreshes access token to ensure validity
202
+ * 4. Prepares API providers for authenticated requests
203
+ *
204
+ * **Storage Integration:**
205
+ * - Supports various storage backends (localStorage, secure storage, etc.)
206
+ * - Handles storage errors gracefully
207
+ * - Automatically validates token integrity
208
+ *
209
+ * @returns {Promise<BWellTransactionResult<null, AuthenticationError | InvalidTokenError | BWellError>>}
210
+ * A promise that resolves to a BWellTransactionResult with:
211
+ * - `null` data on success
212
+ * - `AuthenticationError` if authentication process fails
213
+ * - `InvalidTokenError` if stored tokens are invalid or expired
214
+ * - `BWellError` if token storage is not configured
215
+ *
216
+ * @example
217
+ * ```typescript
218
+ * const sdk = new BWellSDK({
219
+ * clientKey: "YOUR_CLIENT_KEY",
220
+ * tokenStorage: new LocalStorageTokenStorage() // or your storage implementation
221
+ * });
222
+ *
223
+ * await sdk.initialize();
224
+ *
225
+ * // Attempt to authenticate from stored tokens
226
+ * const authResult = await sdk.authenticateFromStorage();
227
+ *
228
+ * if (authResult.success()) {
229
+ * console.log("Authentication from storage successful");
230
+ * // SDK is ready for use with restored session
231
+ * const profile = await sdk.user.getProfile();
232
+ * } else {
233
+ * console.error("Authentication from storage failed:", authResult.error().message);
234
+ * // Fall back to manual authentication
235
+ * await sdk.authenticate({ token: "USER_PROVIDED_TOKEN" });
236
+ * }
237
+ * ```
238
+ */
74
239
  authenticateFromStorage(): Promise<BWellTransactionResult<null, AuthenticationError | InvalidTokenError | BWellError>>;
75
240
  /**
76
- * Creates a set of guest access tokens (access, id, and refresh)
77
- * @returns A promise that resolves to a BWellTransactionResult containing the guest access tokens or an error.
241
+ * ## Create Guest Access Token
242
+ *
243
+ * Creates a guest access token that allows limited, anonymous access to certain
244
+ * b.well platform features without requiring user authentication. Guest tokens
245
+ * provide restricted access to public resources and non-sensitive operations.
246
+ *
247
+ * **Prerequisites:**
248
+ * - SDK must be initialized via `initialize()`
249
+ * - Valid client key must be configured
250
+ * - Client must have guest access permissions enabled
251
+ *
252
+ * **Guest Access Capabilities:**
253
+ * - Access to public health resources
254
+ * - Limited questionnaire functionality
255
+ * - Anonymous data queries (where permitted)
256
+ * - Public provider directory access
257
+ *
258
+ * **Limitations:**
259
+ * - No access to personal health records
260
+ * - Cannot perform user-specific operations
261
+ * - Limited to read-only operations on public data
262
+ * - Tokens have shorter expiration times
263
+ *
264
+ * @returns {Promise<BWellTransactionResult<CreateGuestAccessTokenResults, BaseManagerError>>}
265
+ * A promise that resolves to a BWellTransactionResult with:
266
+ * - `CreateGuestAccessTokenResults` containing the guest access token and metadata
267
+ * - `BaseManagerError` if token creation fails due to client configuration or server issues
268
+ *
269
+ * @example
270
+ * ```typescript
271
+ * const sdk = new BWellSDK({
272
+ * clientKey: "YOUR_CLIENT_KEY",
273
+ * });
274
+ *
275
+ * await sdk.initialize();
276
+ *
277
+ * // Create a guest access token for anonymous access
278
+ * const guestTokenResult = await sdk.createGuestAccessToken();
279
+ *
280
+ * if (guestTokenResult.success()) {
281
+ * const guestToken = guestTokenResult.data();
282
+ * console.log("Guest token created:", guestToken.accessToken);
283
+ *
284
+ * // Use the guest token for limited operations
285
+ * // Note: This doesn't automatically authenticate the SDK
286
+ * // You may need to use setAuthTokens() with appropriate tokens
287
+ * } else {
288
+ * console.error("Failed to create guest token:", guestTokenResult.error().message);
289
+ * }
290
+ * ```
78
291
  */
79
292
  createGuestAccessToken(): Promise<BWellTransactionResult<CreateGuestAccessTokenResults, BaseManagerError>>;
293
+ /**
294
+ * Health data manager for patient health records and clinical data access.
295
+ *
296
+ * @see {@link HealthManager} - Complete health data operations and examples
297
+ * @returns {HealthManager} The health data manager instance
298
+ * @category Managers
299
+ */
80
300
  get health(): HealthManager;
301
+ /**
302
+ * Health space manager for appointments, scheduling, and healthcare facility management.
303
+ *
304
+ * @see {@link HealthSpaceManager} - Complete appointment management operations and examples
305
+ * @returns {HealthSpaceManager} The health space manager instance
306
+ * @category Managers
307
+ */
81
308
  get healthSpace(): HealthSpaceManager;
309
+ /**
310
+ * User manager for profile management, consent handling, and identity verification.
311
+ *
312
+ * @see {@link UserManager} - Complete user management operations and examples
313
+ * @returns {UserManager} The user manager instance
314
+ * @category Managers
315
+ */
82
316
  get user(): UserManager;
317
+ /**
318
+ * Connection manager for data source connections and OAuth management.
319
+ *
320
+ * @see {@link ConnectionManager} - Complete connection management operations and examples
321
+ * @returns {ConnectionManager} The connection manager instance
322
+ * @category Managers
323
+ */
83
324
  get connection(): ConnectionManager;
84
- get language(): import("../language/language-manager.js").LanguageManager;
325
+ /**
326
+ * Language manager for language and localization utilities.
327
+ *
328
+ * @see {@link LanguageManager} - Complete language and localization operations
329
+ * @returns {LanguageManager} The language manager instance
330
+ * @category Managers
331
+ */
332
+ get language(): LanguageManager;
333
+ /**
334
+ * Questionnaire manager for dynamic questionnaire processing and response handling.
335
+ *
336
+ * @experimental This manager and its methods are experimental and may change in future releases.
337
+ * @see {@link QuestionnaireManager} - Complete questionnaire processing operations and examples
338
+ * @returns {QuestionnaireManager} The questionnaire manager instance
339
+ * @category Managers
340
+ */
85
341
  get questionnaire(): QuestionnaireManager;
86
342
  }