@icanbwell/bwell-sdk-ts 1.28.0 → 1.29.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.
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * This file is automatically generated. Please do not edit this file directly.
3
3
  */
4
- export declare const VERSION = "1.28.0";
4
+ export declare const VERSION = "1.29.0";
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * This file is automatically generated. Please do not edit this file directly.
3
3
  */
4
- export const VERSION = "1.28.0";
4
+ export const VERSION = "1.29.0";
@@ -1,9 +1,10 @@
1
1
  import type { ActivityManager } from "../api/base/activity/activity-manager.js";
2
2
  import type { ConnectionManager } from "../api/base/connection/connection-manager.js";
3
3
  import type { DeviceManager } from "../api/base/device/device-manager.js";
4
+ import { BaseManagerError } from "../api/base/errors.js";
4
5
  import type { EventManager } from "../api/base/event/event-manager.js";
5
6
  import type { HealthManager } from "../api/base/health-data/health-manager.js";
6
- import type { AuthTokens } from "../api/base/identity/index.js";
7
+ import type { AuthTokens, CreateGuestAccessTokenResults } from "../api/base/identity/index.js";
7
8
  import type { SearchManager } from "../api/base/search/search-manager.js";
8
9
  import type { UserManager } from "../api/base/user/user-manager.js";
9
10
  import { HealthSpaceManager } from "../api/index.js";
@@ -76,6 +77,11 @@ export declare class BWellSDK {
76
77
  * @returns {Promise<BWellTransactionResult<null, OperationOutcomeError | InvalidTokenError>>}
77
78
  */
78
79
  setAuthTokens(authTokens: AuthTokens): Promise<BWellTransactionResult<null, OperationOutcomeError | InvalidTokenError>>;
80
+ /**
81
+ * Creates a set of guest access tokens (access, id, and refresh)
82
+ * @returns A promise that resolves to a BWellTransactionResult containing the guest access tokens or an error.
83
+ */
84
+ createGuestAccessToken(): Promise<BWellTransactionResult<CreateGuestAccessTokenResults, BaseManagerError>>;
79
85
  get health(): HealthManager;
80
86
  get healthSpace(): HealthSpaceManager;
81
87
  get user(): UserManager;
@@ -28,7 +28,7 @@ import { LoggerFactory, } from "../logger/index.js";
28
28
  import { BWellTransactionResult } from "../results/index.js";
29
29
  import { OpenTelemetry } from "../telemetry/index.js";
30
30
  import { JWTTokenManager, } from "../tokens/index.js";
31
- import { parseUserFromIdToken } from "../utils/index.js";
31
+ import { isNotNullOrUndefined, parseUserFromIdToken } from "../utils/index.js";
32
32
  /**
33
33
  * The BWell SDK is the main entry point for the SDK.
34
34
  *
@@ -157,6 +157,17 @@ export class BWellSDK {
157
157
  return BWellTransactionResult.success(null);
158
158
  });
159
159
  }
160
+ /**
161
+ * Creates a set of guest access tokens (access, id, and refresh)
162
+ * @returns A promise that resolves to a BWellTransactionResult containing the guest access tokens or an error.
163
+ */
164
+ createGuestAccessToken() {
165
+ return __awaiter(this, void 0, void 0, function* () {
166
+ return __classPrivateFieldGet(this, _BWellSDK_identityManager, "f").createGuestAccessToken({
167
+ clientKey: __classPrivateFieldGet(this, _BWellSDK_sdkConfig, "f").context.clientKey,
168
+ });
169
+ });
170
+ }
160
171
  get health() {
161
172
  return __classPrivateFieldGet(this, _BWellSDK_instances, "m", _BWellSDK_getApiProvider).call(this).health;
162
173
  }
@@ -189,7 +200,9 @@ _BWellSDK_config = new WeakMap(), _BWellSDK_sdkConfig = new WeakMap(), _BWellSDK
189
200
  return __awaiter(this, void 0, void 0, function* () {
190
201
  try {
191
202
  const user = parseUserFromIdToken(identityTokens.idToken);
192
- __classPrivateFieldGet(this, _BWellSDK_sdkConfig, "f").setContextUser(user);
203
+ if (isNotNullOrUndefined(user)) {
204
+ __classPrivateFieldGet(this, _BWellSDK_sdkConfig, "f").setContextUser(user);
205
+ }
193
206
  }
194
207
  catch (e) {
195
208
  if (BWellError.isBwellError(e)) {
@@ -103,7 +103,7 @@ export declare const AppointmentsDocument = "\n query appointments($source: S
103
103
  export declare const CancelAppointmentDocument = "\n mutation cancelAppointment($appointment: UpdateAppointmentInput!) {\n updateAppointment(appointment: $appointment) {\n id\n status\n }\n}\n ";
104
104
  export declare const CancelationReasonsDocument = "\n query cancelationReasons($organization: SearchReference!) {\n cancelationReasons(organization: $organization) {\n id\n title\n url\n concept {\n code\n display\n }\n }\n}\n ";
105
105
  export declare const AuthenticateDocument = "\n query authenticate {\n getToken {\n accessToken {\n jwtToken\n }\n idToken {\n jwtToken\n }\n refreshToken {\n token\n }\n }\n}\n ";
106
- export declare const CreateGuestAccessTokenDocument = "\n mutation createGuestAccessToken($clientKey: String!) {\n createGuestAccessToken(clientKey: $clientKey) {\n accessToken\n tokenType\n issuedAt\n expiresIn\n }\n}\n ";
106
+ export declare const CreateGuestAccessTokenDocument = "\n mutation createGuestAccessToken($clientKey: String!) {\n createGuestAccessToken(clientKey: $clientKey) {\n accessToken\n refreshToken\n identityToken\n tokenType\n issuedAt\n expiresIn\n }\n}\n ";
107
107
  export declare const ExchangeAuthCodeDocument = "\n mutation ExchangeAuthCode($authCode: String!) {\n exchangeAuthCode(authCode: $authCode) {\n accessToken {\n jwtToken\n }\n idToken {\n jwtToken\n }\n refreshToken {\n token\n }\n }\n}\n ";
108
108
  export declare const InitializeDocument = "\n query initialize($clientKey: String!) {\n initSdk(clientKey: $clientKey) {\n httpClient {\n requestTimeout\n retry {\n interval\n attempts\n }\n }\n graphQLClient {\n url\n authUrl\n fetchPolicy\n cache {\n maxSizeBytes\n }\n }\n logLevel\n telemetry {\n enabled\n collectorUrl\n }\n }\n}\n ";
109
109
  export declare const LoginDocument = "\n query login($email: String!, $password: String!) {\n login(email: $email, password: $password) {\n accessToken {\n jwtToken\n }\n idToken {\n jwtToken\n }\n refreshToken {\n token\n }\n }\n}\n ";
@@ -2248,6 +2248,8 @@ export const CreateGuestAccessTokenDocument = `
2248
2248
  mutation createGuestAccessToken($clientKey: String!) {
2249
2249
  createGuestAccessToken(clientKey: $clientKey) {
2250
2250
  accessToken
2251
+ refreshToken
2252
+ identityToken
2251
2253
  tokenType
2252
2254
  issuedAt
2253
2255
  expiresIn