@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
@@ -29,21 +29,42 @@ import { OpenTelemetry } from "../telemetry/index.js";
29
29
  import { JWTTokenManager, loadAuthTokens, } from "../tokens/index.js";
30
30
  import { isNotNullOrUndefined, parseUserFromIdToken } from "../utils/index.js";
31
31
  /**
32
- * The BWell SDK is the main entry point for the SDK.
32
+ * # b.well SDK
33
33
  *
34
- * It is responsible for initializing the SDK, authenticating the user, and providing
35
- * access to all of the SDK's functionality via the manager classes (see [Interfaces](../README.md#interfaces)).
34
+ * The b.well SDK is the main entry point for interacting with the b.well Connected Health platform.
35
+ *
36
+ * Provides a comprehensive TypeScript/JavaScript interface with organized manager categories for:
37
+ * - Health data access (conditions, medications, labs, procedures)
38
+ * - User management (profiles, consent, identity verification)
39
+ * - Appointment management (scheduling, viewing, canceling)
40
+ * - Connection management (external healthcare providers)
41
+ * - Questionnaire processing (dynamic forms and responses)
42
+ *
43
+ * ## Basic Usage
36
44
  *
37
- * @example
38
- * Simple initialization with oauth authentication and only required config properties.
39
- * Note that the SDK must be initialized and authenticated for most data accessx
40
- * methods to work properly.
41
45
  * ```typescript
42
- * const sdk = new BWellSDK({
43
- * clientKey: "YOUR_CLIENT_KEY",
44
- * clientSecret: "YOUR_CLIENT_SECRET",
45
- * });
46
+ * import { BWellSDK } from '@bwell/sdk';
47
+ *
48
+ * const sdk = new BWellSDK({ clientKey: "YOUR_CLIENT_KEY" });
49
+ * await sdk.initialize();
50
+ * await sdk.authenticate({ token: "YOUR_TOKEN" });
51
+ *
52
+ * // Access health data
53
+ * const conditions = await sdk.health.getConditions();
54
+ * const profile = await sdk.user.getProfile();
46
55
  * ```
56
+ *
57
+ * @see {@link HealthManager} for health data operations
58
+ * @see {@link UserManager} for user management operations
59
+ * @see {@link HealthSpaceManager} for appointment management
60
+ * @see {@link ConnectionManager} for provider connections
61
+ * @see {@link QuestionnaireManager} for questionnaire processing
62
+ *
63
+
64
+ * @class BWellSDK
65
+ * @category Core
66
+ * @title BWellSDK
67
+ * @excerpt Main entry point for interacting with the b.well Connected Health platform
47
68
  */
48
69
  export class BWellSDK {
49
70
  constructor(config) {
@@ -71,17 +92,42 @@ export class BWellSDK {
71
92
  __classPrivateFieldSet(this, _BWellSDK_apiProvider, __classPrivateFieldGet(this, _BWellSDK_instances, "m", _BWellSDK_initApiProvider).call(this), "f");
72
93
  __classPrivateFieldSet(this, _BWellSDK_configManager, new ConfigManager(__classPrivateFieldGet(this, _BWellSDK_apiProvider, "f").identity), "f");
73
94
  }
95
+ // =============================================================================
96
+ // CORE SDK METHODS
97
+ // =============================================================================
74
98
  /**
75
- * Initializes the SDK with the provided configuration.
76
- * @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.
99
+ * ## Initialize SDK
100
+ *
101
+ * Initializes the SDK with the provided configuration. This method must be called
102
+ * before using any other SDK functionality.
103
+ *
104
+ * **Prerequisites:**
105
+ * - Valid `clientKey` must be provided in the constructor
106
+ * - Network connectivity to b.well services
107
+ *
108
+ * **Post-initialization:**
109
+ * - SDK configuration is validated and loaded
110
+ * - Base dependencies are initialized
111
+ * - Ready for authentication
112
+ *
113
+ * @returns {Promise<BWellTransactionResult<null, InvalidClientKeyError | OperationOutcomeError>>}
114
+ * A promise that resolves to a BWellTransactionResult with:
115
+ * - `null` data on success
116
+ * - `InvalidClientKeyError` if client credentials are invalid
117
+ * - `OperationOutcomeError` if server-side initialization fails
118
+ *
77
119
  * @example
78
120
  * ```typescript
79
121
  * const sdk = new BWellSDK({
80
- * clientKey: "YOUR_CLIENT_KEY",
81
- * clientSecret: "YOUR_CLIENT_SECRET",
122
+ * clientKey: "YOUR_CLIENT_KEY",
82
123
  * });
83
124
  *
84
- * await sdk.initialize();
125
+ * const initResult = await sdk.initialize();
126
+ * if (initResult.success()) {
127
+ * console.log("SDK initialized successfully");
128
+ * } else {
129
+ * console.error("Failed to initialize SDK:", initResult.error().message);
130
+ * }
85
131
  * ```
86
132
  */
87
133
  initialize() {
@@ -98,21 +144,51 @@ export class BWellSDK {
98
144
  });
99
145
  }
100
146
  /**
101
- * Authenticates the user with the provided credentials.
102
- * @param credentials The credentials to be used for authentication.
103
- * @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.
147
+ * ## Authenticate User
148
+ *
149
+ * Authenticates the user with the provided credentials and prepares the SDK for
150
+ * data access operations.
151
+ *
152
+ * **Prerequisites:**
153
+ * - SDK must be initialized via `initialize()`
154
+ * - Valid authentication credentials
155
+ *
156
+ * **Authentication Flow:**
157
+ * 1. Validates credentials with authentication strategy
158
+ * 2. Bootstraps authentication tokens
159
+ * 3. Initializes token management
160
+ * 4. Prepares API providers for authenticated requests
161
+ *
162
+ * **Supported Credential Types:**
163
+ * - Token-based authentication
164
+ * - OAuth credentials (depending on configuration)
165
+ *
166
+ * @param {Credentials} credentials - The credentials to be used for authentication
167
+ * @returns {Promise<BWellTransactionResult<null, AuthenticationError | InvalidTokenError>>}
168
+ * A promise that resolves to a BWellTransactionResult with:
169
+ * - `null` data on success
170
+ * - `AuthenticationError` if authentication fails
171
+ * - `InvalidTokenError` if provided tokens are invalid
172
+ *
104
173
  * @example
105
174
  * ```typescript
106
175
  * const sdk = new BWellSDK({
107
- * clientKey: "YOUR_CLIENT_KEY",
108
- * clientSecret: "YOUR_CLIENT_SECRET",
176
+ * clientKey: "YOUR_CLIENT_KEY",
109
177
  * });
110
178
  *
111
179
  * await sdk.initialize();
112
180
  *
113
- * await sdk.authenticate({
114
- * token: "YOUR_TOKEN",
181
+ * const authResult = await sdk.authenticate({
182
+ * token: "YOUR_ACCESS_TOKEN",
115
183
  * });
184
+ *
185
+ * if (authResult.success()) {
186
+ * console.log("Authentication successful");
187
+ * // Now you can use all SDK functionality
188
+ * const profile = await sdk.user.getProfile();
189
+ * } else {
190
+ * console.error("Authentication failed:", authResult.error().message);
191
+ * }
116
192
  * ```
117
193
  */
118
194
  authenticate(credentials) {
@@ -127,14 +203,53 @@ export class BWellSDK {
127
203
  });
128
204
  }
129
205
  /**
130
- * Sets auth tokens for a pre-authenticated user. Performs a token refresh to
131
- * validate the provided tokens.
206
+ * ## Set Authentication Tokens
207
+ *
208
+ * Sets auth tokens for a pre-authenticated user. This method performs token validation
209
+ * and can be used in place of `authenticate()` when tokens are obtained through
210
+ * external means.
211
+ *
212
+ * **Use Cases:**
213
+ * - Integration with existing authentication systems
214
+ * - Server-side token management
215
+ * - Custom authentication flows
132
216
  *
133
- * This can be used in place of `authenticate` for times when a user has been
134
- * authenticated through means other than the SDK.
217
+ * **Token Validation:**
218
+ * - Validates token format and structure
219
+ * - Parses user information from ID token
220
+ * - Initializes token refresh mechanisms
221
+ *
222
+ * @param {AuthTokens} authTokens - Auth tokens for pre-authenticated user containing:
223
+ * - `accessToken` - Access token for API requests
224
+ * - `idToken` - ID token containing user information
225
+ * - `refreshToken` - Refresh token for token renewal
135
226
  *
136
- * @param {AuthTokens} authTokens - Auth tokens for pre-authenticated user
137
227
  * @returns {Promise<BWellTransactionResult<null, OperationOutcomeError | InvalidTokenError>>}
228
+ * A promise that resolves to a BWellTransactionResult with:
229
+ * - `null` data on success
230
+ * - `OperationOutcomeError` if server-side validation fails
231
+ * - `InvalidTokenError` if provided tokens are invalid or expired
232
+ *
233
+ * @example
234
+ * ```typescript
235
+ * const sdk = new BWellSDK({
236
+ * clientKey: "YOUR_CLIENT_KEY",
237
+ * });
238
+ *
239
+ * await sdk.initialize();
240
+ *
241
+ * // Use tokens obtained from external authentication
242
+ * const tokenResult = await sdk.setAuthTokens({
243
+ * accessToken: "your-access-token",
244
+ * idToken: "your-id-token",
245
+ * refreshToken: "your-refresh-token"
246
+ * });
247
+ *
248
+ * if (tokenResult.success()) {
249
+ * console.log("Tokens set successfully");
250
+ * // SDK is now ready for use
251
+ * }
252
+ * ```
138
253
  */
139
254
  setAuthTokens(authTokens) {
140
255
  return __awaiter(this, void 0, void 0, function* () {
@@ -155,6 +270,59 @@ export class BWellSDK {
155
270
  return BWellTransactionResult.success(null);
156
271
  });
157
272
  }
273
+ /**
274
+ * ## Authenticate From Storage
275
+ *
276
+ * Authenticates the user using tokens previously stored in the configured token storage.
277
+ * This method provides a convenient way to restore user sessions without requiring
278
+ * manual credential input.
279
+ *
280
+ * **Prerequisites:**
281
+ * - SDK must be initialized via `initialize()`
282
+ * - `tokenStorage` must be configured in the BWell config
283
+ * - Valid tokens must exist in the configured storage
284
+ *
285
+ * **Authentication Flow:**
286
+ * 1. Loads tokens from the configured token storage
287
+ * 2. Validates and bootstraps the loaded tokens
288
+ * 3. Refreshes access token to ensure validity
289
+ * 4. Prepares API providers for authenticated requests
290
+ *
291
+ * **Storage Integration:**
292
+ * - Supports various storage backends (localStorage, secure storage, etc.)
293
+ * - Handles storage errors gracefully
294
+ * - Automatically validates token integrity
295
+ *
296
+ * @returns {Promise<BWellTransactionResult<null, AuthenticationError | InvalidTokenError | BWellError>>}
297
+ * A promise that resolves to a BWellTransactionResult with:
298
+ * - `null` data on success
299
+ * - `AuthenticationError` if authentication process fails
300
+ * - `InvalidTokenError` if stored tokens are invalid or expired
301
+ * - `BWellError` if token storage is not configured
302
+ *
303
+ * @example
304
+ * ```typescript
305
+ * const sdk = new BWellSDK({
306
+ * clientKey: "YOUR_CLIENT_KEY",
307
+ * tokenStorage: new LocalStorageTokenStorage() // or your storage implementation
308
+ * });
309
+ *
310
+ * await sdk.initialize();
311
+ *
312
+ * // Attempt to authenticate from stored tokens
313
+ * const authResult = await sdk.authenticateFromStorage();
314
+ *
315
+ * if (authResult.success()) {
316
+ * console.log("Authentication from storage successful");
317
+ * // SDK is ready for use with restored session
318
+ * const profile = await sdk.user.getProfile();
319
+ * } else {
320
+ * console.error("Authentication from storage failed:", authResult.error().message);
321
+ * // Fall back to manual authentication
322
+ * await sdk.authenticate({ token: "USER_PROVIDED_TOKEN" });
323
+ * }
324
+ * ```
325
+ */
158
326
  authenticateFromStorage() {
159
327
  return __awaiter(this, void 0, void 0, function* () {
160
328
  if (__classPrivateFieldGet(this, _BWellSDK_config, "f").tokenStorage === undefined) {
@@ -186,8 +354,56 @@ export class BWellSDK {
186
354
  });
187
355
  }
188
356
  /**
189
- * Creates a set of guest access tokens (access, id, and refresh)
190
- * @returns A promise that resolves to a BWellTransactionResult containing the guest access tokens or an error.
357
+ * ## Create Guest Access Token
358
+ *
359
+ * Creates a guest access token that allows limited, anonymous access to certain
360
+ * b.well platform features without requiring user authentication. Guest tokens
361
+ * provide restricted access to public resources and non-sensitive operations.
362
+ *
363
+ * **Prerequisites:**
364
+ * - SDK must be initialized via `initialize()`
365
+ * - Valid client key must be configured
366
+ * - Client must have guest access permissions enabled
367
+ *
368
+ * **Guest Access Capabilities:**
369
+ * - Access to public health resources
370
+ * - Limited questionnaire functionality
371
+ * - Anonymous data queries (where permitted)
372
+ * - Public provider directory access
373
+ *
374
+ * **Limitations:**
375
+ * - No access to personal health records
376
+ * - Cannot perform user-specific operations
377
+ * - Limited to read-only operations on public data
378
+ * - Tokens have shorter expiration times
379
+ *
380
+ * @returns {Promise<BWellTransactionResult<CreateGuestAccessTokenResults, BaseManagerError>>}
381
+ * A promise that resolves to a BWellTransactionResult with:
382
+ * - `CreateGuestAccessTokenResults` containing the guest access token and metadata
383
+ * - `BaseManagerError` if token creation fails due to client configuration or server issues
384
+ *
385
+ * @example
386
+ * ```typescript
387
+ * const sdk = new BWellSDK({
388
+ * clientKey: "YOUR_CLIENT_KEY",
389
+ * });
390
+ *
391
+ * await sdk.initialize();
392
+ *
393
+ * // Create a guest access token for anonymous access
394
+ * const guestTokenResult = await sdk.createGuestAccessToken();
395
+ *
396
+ * if (guestTokenResult.success()) {
397
+ * const guestToken = guestTokenResult.data();
398
+ * console.log("Guest token created:", guestToken.accessToken);
399
+ *
400
+ * // Use the guest token for limited operations
401
+ * // Note: This doesn't automatically authenticate the SDK
402
+ * // You may need to use setAuthTokens() with appropriate tokens
403
+ * } else {
404
+ * console.error("Failed to create guest token:", guestTokenResult.error().message);
405
+ * }
406
+ * ```
191
407
  */
192
408
  createGuestAccessToken() {
193
409
  return __awaiter(this, void 0, void 0, function* () {
@@ -196,15 +412,48 @@ export class BWellSDK {
196
412
  });
197
413
  });
198
414
  }
415
+ // =============================================================================
416
+ // MANAGER ACCESSORS
417
+ // =============================================================================
418
+ // The following getters provide access to the various manager instances that
419
+ // implement the SDK's functionality through a fluid API interface.
420
+ /**
421
+ * Health data manager for patient health records and clinical data access.
422
+ *
423
+ * @see {@link HealthManager} - Complete health data operations and examples
424
+ * @returns {HealthManager} The health data manager instance
425
+ * @category Managers
426
+ */
199
427
  get health() {
200
428
  return __classPrivateFieldGet(this, _BWellSDK_instances, "m", _BWellSDK_getApiProvider).call(this).health;
201
429
  }
430
+ /**
431
+ * Health space manager for appointments, scheduling, and healthcare facility management.
432
+ *
433
+ * @see {@link HealthSpaceManager} - Complete appointment management operations and examples
434
+ * @returns {HealthSpaceManager} The health space manager instance
435
+ * @category Managers
436
+ */
202
437
  get healthSpace() {
203
438
  return __classPrivateFieldGet(this, _BWellSDK_instances, "m", _BWellSDK_getApiProvider).call(this).healthSpace;
204
439
  }
440
+ /**
441
+ * User manager for profile management, consent handling, and identity verification.
442
+ *
443
+ * @see {@link UserManager} - Complete user management operations and examples
444
+ * @returns {UserManager} The user manager instance
445
+ * @category Managers
446
+ */
205
447
  get user() {
206
448
  return __classPrivateFieldGet(this, _BWellSDK_instances, "m", _BWellSDK_getApiProvider).call(this).user;
207
449
  }
450
+ /**
451
+ * Connection manager for data source connections and OAuth management.
452
+ *
453
+ * @see {@link ConnectionManager} - Complete connection management operations and examples
454
+ * @returns {ConnectionManager} The connection manager instance
455
+ * @category Managers
456
+ */
208
457
  get connection() {
209
458
  return __classPrivateFieldGet(this, _BWellSDK_instances, "m", _BWellSDK_getApiProvider).call(this).connection;
210
459
  }
@@ -220,9 +469,24 @@ export class BWellSDK {
220
469
  // public get search(): SearchManager {
221
470
  // return this.#getApiProvider().search;
222
471
  // }
472
+ /**
473
+ * Language manager for language and localization utilities.
474
+ *
475
+ * @see {@link LanguageManager} - Complete language and localization operations
476
+ * @returns {LanguageManager} The language manager instance
477
+ * @category Managers
478
+ */
223
479
  get language() {
224
480
  return __classPrivateFieldGet(this, _BWellSDK_instances, "m", _BWellSDK_getApiProvider).call(this).language;
225
481
  }
482
+ /**
483
+ * Questionnaire manager for dynamic questionnaire processing and response handling.
484
+ *
485
+ * @experimental This manager and its methods are experimental and may change in future releases.
486
+ * @see {@link QuestionnaireManager} - Complete questionnaire processing operations and examples
487
+ * @returns {QuestionnaireManager} The questionnaire manager instance
488
+ * @category Managers
489
+ */
226
490
  get questionnaire() {
227
491
  return __classPrivateFieldGet(this, _BWellSDK_instances, "m", _BWellSDK_getApiProvider).call(this).questionnaire;
228
492
  }
@@ -1,8 +1,14 @@
1
- import { LogLevel, Retry } from "../graphql/schema.js";
1
+ import { Retry } from "../graphql/schema.js";
2
2
  import type { Language } from "../language/language-manager.js";
3
+ import { LogLevel } from "../models/enums/index.js";
3
4
  import { TokenStorage } from "../tokens/token-storage.js";
4
5
  import type { Nullable } from "../utils/type-utils.js";
5
- export { LogLevel } from "../graphql/schema.js";
6
+ /**
7
+ * Configuration options for BWellSDK
8
+ * @title BWellConfig
9
+ * @excerpt Configuration options for BWellSDK
10
+
11
+ */
6
12
  export type BWellConfig = {
7
13
  clientKey: string;
8
14
  logLevel?: LogLevel;
@@ -1,8 +1,6 @@
1
- import { LogLevel } from "../graphql/schema.js";
2
1
  import { InMemoryTokenStorage } from "../tokens/token-storage.js";
3
- export { LogLevel } from "../graphql/schema.js";
4
2
  export const DEFAULT_BWELL_CONFIG = {
5
- logLevel: LogLevel.Error,
3
+ logLevel: "ERROR",
6
4
  timeout: 30000,
7
5
  retryPolicy: {
8
6
  attempts: 3,
@@ -1,7 +1,7 @@
1
1
  import { InvalidClientKeyError } from "../errors/index.js";
2
2
  import { Retry, SdkConfiguration } from "../graphql/schema.js";
3
3
  import { Severity } from "../logger/index.js";
4
- import { User } from "../models/user.js";
4
+ import { User } from "../models/user/user.js";
5
5
  import { BWellTransactionResult } from "../results/index.js";
6
6
  import { BWellConfig } from "./bwell-config.js";
7
7
  import { Context } from "./context.js";
@@ -1,4 +1,11 @@
1
1
  import { BWellError } from "./bwell-error.js";
2
+ /**
3
+ * Error thrown when authentication fails
4
+ * @title AuthenticationError
5
+ * @excerpt Error thrown when authentication fails
6
+
7
+ * @category Errors
8
+ */
2
9
  export declare class AuthenticationError extends BWellError {
3
10
  constructor(message?: string);
4
11
  }
@@ -1,4 +1,11 @@
1
1
  import { BWellError } from "./bwell-error.js";
2
+ /**
3
+ * Error thrown when authentication fails
4
+ * @title AuthenticationError
5
+ * @excerpt Error thrown when authentication fails
6
+
7
+ * @category Errors
8
+ */
2
9
  export class AuthenticationError extends BWellError {
3
10
  constructor(message = "Authentication Error") {
4
11
  super(message);
@@ -1,13 +1,23 @@
1
+ /**
2
+ * Options for BWellError constructor
3
+ * @title BWellErrorOptions
4
+ * @excerpt Options for BWellError constructor
5
+
6
+ * @category Errors
7
+ */
1
8
  export type BWellErrorOptions = {
2
9
  cause: unknown;
3
10
  };
4
11
  /**
5
- * Base error class for the BWell SDK.
6
- * @public
12
+ * Base error class for the b.well SDK.
13
+ * @title BWellError
14
+ * @excerpt Base error class for the b.well SDK
15
+ *
7
16
  * @example
8
17
  * ```typescript
9
18
  * throw new BWellError("An error occurred");
10
19
  * ```
20
+ * @category Errors
11
21
  */
12
22
  export declare class BWellError extends Error {
13
23
  cause?: unknown;
@@ -1,10 +1,13 @@
1
1
  /**
2
- * Base error class for the BWell SDK.
3
- * @public
2
+ * Base error class for the b.well SDK.
3
+ * @title BWellError
4
+ * @excerpt Base error class for the b.well SDK
5
+ *
4
6
  * @example
5
7
  * ```typescript
6
8
  * throw new BWellError("An error occurred");
7
9
  * ```
10
+ * @category Errors
8
11
  */
9
12
  export class BWellError extends Error {
10
13
  constructor(message, options) {
@@ -1,4 +1,11 @@
1
1
  import { BWellError } from "./bwell-error.js";
2
+ /**
3
+ * Error thrown when an illegal argument is provided
4
+ * @title IllegalArgumentError
5
+ * @excerpt Error thrown when an illegal argument is provided
6
+
7
+ * @category Errors
8
+ */
2
9
  export declare class IllegalArgumentError extends BWellError {
3
10
  constructor(message?: string);
4
11
  }
@@ -1,4 +1,11 @@
1
1
  import { BWellError } from "./bwell-error.js";
2
+ /**
3
+ * Error thrown when an illegal argument is provided
4
+ * @title IllegalArgumentError
5
+ * @excerpt Error thrown when an illegal argument is provided
6
+
7
+ * @category Errors
8
+ */
2
9
  export class IllegalArgumentError extends BWellError {
3
10
  constructor(message = "Illegal Argument Error") {
4
11
  super(message);
@@ -1,4 +1,11 @@
1
1
  import { BWellError } from "./bwell-error.js";
2
+ /**
3
+ * Error thrown when an illegal state is encountered
4
+ * @title IllegalStateError
5
+ * @excerpt Error thrown when an illegal state is encountered
6
+
7
+ * @category Errors
8
+ */
2
9
  export declare class IllegalStateError extends BWellError {
3
10
  constructor(message?: string);
4
11
  }
@@ -1,4 +1,11 @@
1
1
  import { BWellError } from "./bwell-error.js";
2
+ /**
3
+ * Error thrown when an illegal state is encountered
4
+ * @title IllegalStateError
5
+ * @excerpt Error thrown when an illegal state is encountered
6
+
7
+ * @category Errors
8
+ */
2
9
  export class IllegalStateError extends BWellError {
3
10
  constructor(message = "Illegal State Error") {
4
11
  super(message);
@@ -1,4 +1,11 @@
1
1
  import { BWellError } from "./bwell-error.js";
2
+ /**
3
+ * Error thrown when an invalid client key is provided
4
+ * @title InvalidClientKeyError
5
+ * @excerpt Error thrown when an invalid client key is provided
6
+
7
+ * @category Errors
8
+ */
2
9
  export declare class InvalidClientKeyError extends BWellError {
3
10
  constructor(message?: string);
4
11
  }
@@ -1,4 +1,11 @@
1
1
  import { BWellError } from "./bwell-error.js";
2
+ /**
3
+ * Error thrown when an invalid client key is provided
4
+ * @title InvalidClientKeyError
5
+ * @excerpt Error thrown when an invalid client key is provided
6
+
7
+ * @category Errors
8
+ */
2
9
  export class InvalidClientKeyError extends BWellError {
3
10
  constructor(message = "Invalid Client Key Error") {
4
11
  super(message);
@@ -1,5 +1,12 @@
1
1
  import { Credentials } from "../auth/index.js";
2
2
  import { BWellError } from "./bwell-error.js";
3
+ /**
4
+ * Error thrown when invalid credentials type is provided
5
+ * @title InvalidCredentialsTypeError
6
+ * @excerpt Error thrown when invalid credentials type is provided
7
+
8
+ * @category Errors
9
+ */
3
10
  export declare class InvalidCredentialsTypeError extends BWellError {
4
11
  readonly credentials: Credentials;
5
12
  constructor(message: string, credentials: Credentials);
@@ -1,4 +1,11 @@
1
1
  import { BWellError } from "./bwell-error.js";
2
+ /**
3
+ * Error thrown when invalid credentials type is provided
4
+ * @title InvalidCredentialsTypeError
5
+ * @excerpt Error thrown when invalid credentials type is provided
6
+
7
+ * @category Errors
8
+ */
2
9
  export class InvalidCredentialsTypeError extends BWellError {
3
10
  constructor(message, credentials) {
4
11
  super(message);
@@ -1,7 +1,10 @@
1
1
  import { BWellError } from "./bwell-error.js";
2
2
  /**
3
3
  * Error thrown when an invalid token is detected
4
- * @public
4
+ * @title InvalidTokenError
5
+ * @excerpt Error thrown when an invalid token is detected
6
+
7
+ * @category Errors
5
8
  */
6
9
  export declare class InvalidTokenError extends BWellError {
7
10
  constructor(message?: string);
@@ -1,7 +1,10 @@
1
1
  import { BWellError } from "./bwell-error.js";
2
2
  /**
3
3
  * Error thrown when an invalid token is detected
4
- * @public
4
+ * @title InvalidTokenError
5
+ * @excerpt Error thrown when an invalid token is detected
6
+
7
+ * @category Errors
5
8
  */
6
9
  export class InvalidTokenError extends BWellError {
7
10
  constructor(message = "Invalid Token Error") {
@@ -1,4 +1,11 @@
1
1
  import { BWellError } from "./bwell-error.js";
2
+ /**
3
+ * Error thrown when a network error occurs
4
+ * @title NetworkError
5
+ * @excerpt Error thrown when a network error occurs
6
+
7
+ * @category Errors
8
+ */
2
9
  export declare class NetworkError extends BWellError {
3
10
  status: number;
4
11
  constructor(message: string, status: number);
@@ -1,4 +1,11 @@
1
1
  import { BWellError } from "./bwell-error.js";
2
+ /**
3
+ * Error thrown when a network error occurs
4
+ * @title NetworkError
5
+ * @excerpt Error thrown when a network error occurs
6
+
7
+ * @category Errors
8
+ */
2
9
  export class NetworkError extends BWellError {
3
10
  constructor(message, status) {
4
11
  super(message);