@icanbwell/bwell-sdk-ts 1.98.0 → 1.99.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.98.0";
4
+ export declare const VERSION = "1.99.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.98.0";
4
+ export const VERSION = "1.99.0";
@@ -1,5 +1,5 @@
1
1
  import { ValidationError } from "../../../errors/validation-error.js";
2
- import { CreateConsentMutationResults, CreateDataExportDirectDownloadUrlMutationResults, CreateVerificationUrlMutationResults, DeleteMutationResults, GetProfileQueryResults, SearchConsentQueryResults, UpdateUserProfileMutationResults, VerificationStatusQueryResults } from "../../../graphql/operations/types.js";
2
+ import { CreateConsentMutationResults, CreateDataExportDirectDownloadUrlMutationResults, CreateVerificationUrlMutationResults, DeleteMutationResults, GetAccessHistoryQueryResults, GetProfileQueryResults, SearchConsentQueryResults, UpdateUserProfileMutationResults, VerificationStatusQueryResults } from "../../../graphql/operations/types.js";
3
3
  import type { BWellQueryResult, BWellTransactionResult } from "../../../results/index.js";
4
4
  import { BaseManagerError } from "../errors.js";
5
5
  import { CreateConsentRequest } from "./create-consent-request.js";
@@ -8,6 +8,7 @@ import { CreateVerificationUrlRequest } from "./create-verification-url-request.
8
8
  import { GetConsentsRequest } from "./get-consents-request.js";
9
9
  import { UpdateProfileRequest } from "./update-profile-request.js";
10
10
  export type ProfileResults = GetProfileQueryResults["userProfile"];
11
+ export type GetAccessHistoryResults = GetAccessHistoryQueryResults["getAccessHistory"];
11
12
  export type DeleteUserResultsType = DeleteMutationResults["updateUserAccountStatus"];
12
13
  export interface DeleteUserResults extends DeleteUserResultsType {
13
14
  }
@@ -27,6 +28,15 @@ export interface UserManager {
27
28
  * @returns {Promise<BWellQueryResult<ProfileResults>>} A promise resolving to an object holding the demographic data from the user.
28
29
  */
29
30
  getProfile(): Promise<BWellQueryResult<ProfileResults, BaseManagerError>>;
31
+ /**
32
+ * Retrieves the authenticated user's access history — who has accessed their
33
+ * data, how often, when it was last accessed, and for what reason — as a
34
+ * per-accessor summary over a rolling window. The person is resolved from the
35
+ * auth context; a user can only retrieve their own access history.
36
+ *
37
+ * @returns {Promise<BWellQueryResult<GetAccessHistoryResults, BaseManagerError>>} A promise resolving to the user's access history.
38
+ */
39
+ getAccessHistory(): Promise<BWellQueryResult<GetAccessHistoryResults, BaseManagerError>>;
30
40
  /**
31
41
  * Deletes a user’s account and associated user data.
32
42
  *
@@ -5,13 +5,14 @@ import { BaseManagerError } from "../../base/errors.js";
5
5
  import { CreateConsentResults, GetConsentsResults, ProfileResults, UpdateProfileResults } from "../../base/index.js";
6
6
  import { CreateDataExportDirectDownloadUrlRequest } from "../../base/user/create-data-export-direct-download-url-request.js";
7
7
  import { CreateConsentRequest, CreateVerificationUrlRequest, GetConsentsRequest, UpdateProfileRequest } from "../../base/user/index.js";
8
- import type { CreateDataExportDirectDownloadUrlResults, CreateVerificationUrlResults, GetVerificationStatusResults, UserManager } from "../../base/user/user-manager.js";
8
+ import type { CreateDataExportDirectDownloadUrlResults, CreateVerificationUrlResults, GetAccessHistoryResults, GetVerificationStatusResults, UserManager } from "../../base/user/user-manager.js";
9
9
  import { GraphQLManager } from "../graphql-manager/index.js";
10
10
  import type { GraphQLSdk } from "../graphql-sdk/index.js";
11
11
  export declare class GraphQLUserManager extends GraphQLManager implements UserManager {
12
12
  #private;
13
13
  constructor(sdk: GraphQLSdk, loggerProvider?: LoggerProvider);
14
14
  getProfile(): Promise<BWellQueryResult<ProfileResults, BaseManagerError>>;
15
+ getAccessHistory(): Promise<BWellQueryResult<GetAccessHistoryResults, BaseManagerError>>;
15
16
  delete(): Promise<BWellTransactionResult<null, BaseManagerError>>;
16
17
  updateProfile(request: UpdateProfileRequest): Promise<BWellTransactionResult<UpdateProfileResults, BaseManagerError | ValidationError>>;
17
18
  getConsents(request?: GetConsentsRequest): Promise<BWellQueryResult<GetConsentsResults, BaseManagerError | ValidationError>>;
@@ -55,6 +55,21 @@ export class GraphQLUserManager extends GraphQLManager {
55
55
  return new BWellQueryResult((_a = result.data) === null || _a === void 0 ? void 0 : _a.userProfile, result.error);
56
56
  });
57
57
  }
58
+ getAccessHistory() {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ var _a;
61
+ __classPrivateFieldGet(this, _GraphQLUserManager_logger, "f").verbose("calling getAccessHistory...");
62
+ const result = yield this.handleQuery(__classPrivateFieldGet(this, _GraphQLUserManager_sdk, "f").GetAccessHistory());
63
+ __classPrivateFieldGet(this, _GraphQLUserManager_logger, "f").verbose("getAccessHistory complete");
64
+ if (result.hasError()) {
65
+ __classPrivateFieldGet(this, _GraphQLUserManager_logger, "f").error("getAccessHistory failed", result.error);
66
+ }
67
+ else {
68
+ __classPrivateFieldGet(this, _GraphQLUserManager_logger, "f").info("successfully called getAccessHistory");
69
+ }
70
+ return new BWellQueryResult((_a = result.data) === null || _a === void 0 ? void 0 : _a.getAccessHistory, result.error);
71
+ });
72
+ }
58
73
  delete() {
59
74
  return __awaiter(this, void 0, void 0, function* () {
60
75
  __classPrivateFieldGet(this, _GraphQLUserManager_logger, "f").verbose("calling delete...");
@@ -185,6 +185,7 @@ export declare const CreateConsentDocument = "\n mutation createConsent($cons
185
185
  export declare const CreateDataExportDirectDownloadUrlDocument = "\n mutation CreateDataExportDirectDownloadUrl($exportId: String!, $password: String!) {\n createDataExportDirectDownloadUrl(exportId: $exportId, password: $password)\n}\n ";
186
186
  export declare const CreateVerificationUrlDocument = "\n mutation CreateVerificationUrl($callbackURL: String, $includeAttributeMatchingCheck: Boolean) {\n createVerificationUrl(\n callbackURL: $callbackURL\n includeAttributeMatchingCheck: $includeAttributeMatchingCheck\n )\n}\n ";
187
187
  export declare const DeleteDocument = "\n mutation delete {\n updateUserAccountStatus(operation: IMMEDIATE_EXECUTION) {\n resourceType\n issue {\n code\n severity\n details {\n text\n }\n }\n }\n}\n ";
188
+ export declare const GetAccessHistoryDocument = "\n query GetAccessHistory {\n getAccessHistory {\n summary {\n generatedAt\n windowDays\n }\n accessors {\n reference {\n reference\n display\n }\n totalCount\n lastAccessed\n organizations {\n reference\n name\n sourceId\n }\n purposeOfEvent {\n system\n code\n display\n }\n resourceTypes {\n type\n count\n }\n }\n }\n}\n ";
188
189
  export declare const GetProfileDocument = "\n query getProfile {\n userProfile {\n id\n address {\n line\n city\n state\n postalCode\n }\n telecom {\n system\n value\n use\n }\n gender\n birthDate\n name {\n family\n given\n }\n language\n identifier {\n ...IdentifierFields\n }\n }\n}\n \n fragment IdentifierFields on Identifier {\n id\n type {\n ...CodeableConceptFields\n }\n system\n value\n}\n \n fragment CodeableConceptFields on CodeableConcept {\n text\n coding {\n ...CodingFields\n }\n}\n \n fragment CodingFields on Coding {\n system\n code\n display\n}\n ";
189
190
  export declare const SearchConsentDocument = "\n query searchConsent($categoryCode: CategoryCode) {\n search(params: {category: $categoryCode}) {\n resourceType\n id\n meta {\n ...MetaFields\n }\n status\n scope {\n text\n coding {\n code\n system\n display\n }\n }\n category {\n text\n coding {\n code\n system\n display\n }\n }\n patient {\n reference\n }\n provision {\n type\n }\n }\n}\n \n fragment MetaFields on Meta {\n versionId\n lastUpdated\n source\n security {\n ...CodingFields\n }\n tag {\n ...CodingFields\n }\n}\n \n fragment CodingFields on Coding {\n system\n code\n display\n}\n ";
190
191
  export declare const UpdateUserProfileDocument = "\n mutation updateUserProfile($person: FHIRPersonInput) {\n updateUserProfile(input: $person) {\n id\n address {\n line\n city\n state\n postalCode\n }\n telecom {\n system\n value\n use\n }\n gender\n birthDate\n name {\n family\n given\n }\n language\n }\n}\n ";
@@ -828,6 +829,13 @@ export declare function getSdk(client: GraphQLClient, withWrapper?: SdkFunctionW
828
829
  headers: Headers;
829
830
  status: number;
830
831
  }>;
832
+ GetAccessHistory(variables?: Types.GetAccessHistoryQueryVariables, requestHeaders?: GraphQLClientRequestHeaders): Promise<{
833
+ data: Types.GetAccessHistoryQueryResults;
834
+ errors?: GraphQLError[];
835
+ extensions?: any;
836
+ headers: Headers;
837
+ status: number;
838
+ }>;
831
839
  getProfile(variables?: Types.GetProfileQueryVariables, requestHeaders?: GraphQLClientRequestHeaders): Promise<{
832
840
  data: Types.GetProfileQueryResults;
833
841
  errors?: GraphQLError[];
@@ -5014,6 +5014,38 @@ export const DeleteDocument = `
5014
5014
  }
5015
5015
  }
5016
5016
  `;
5017
+ export const GetAccessHistoryDocument = `
5018
+ query GetAccessHistory {
5019
+ getAccessHistory {
5020
+ summary {
5021
+ generatedAt
5022
+ windowDays
5023
+ }
5024
+ accessors {
5025
+ reference {
5026
+ reference
5027
+ display
5028
+ }
5029
+ totalCount
5030
+ lastAccessed
5031
+ organizations {
5032
+ reference
5033
+ name
5034
+ sourceId
5035
+ }
5036
+ purposeOfEvent {
5037
+ system
5038
+ code
5039
+ display
5040
+ }
5041
+ resourceTypes {
5042
+ type
5043
+ count
5044
+ }
5045
+ }
5046
+ }
5047
+ }
5048
+ `;
5017
5049
  export const GetProfileDocument = `
5018
5050
  query getProfile {
5019
5051
  userProfile {
@@ -5389,6 +5421,9 @@ export function getSdk(client, withWrapper = defaultWrapper) {
5389
5421
  delete(variables, requestHeaders) {
5390
5422
  return withWrapper((wrappedRequestHeaders) => client.rawRequest(DeleteDocument, variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'delete', 'mutation', variables);
5391
5423
  },
5424
+ GetAccessHistory(variables, requestHeaders) {
5425
+ return withWrapper((wrappedRequestHeaders) => client.rawRequest(GetAccessHistoryDocument, variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'GetAccessHistory', 'query', variables);
5426
+ },
5392
5427
  getProfile(variables, requestHeaders) {
5393
5428
  return withWrapper((wrappedRequestHeaders) => client.rawRequest(GetProfileDocument, variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'getProfile', 'query', variables);
5394
5429
  },
@@ -30420,6 +30420,39 @@ export type DeleteMutationResults = {
30420
30420
  }> | null;
30421
30421
  };
30422
30422
  };
30423
+ export type GetAccessHistoryQueryVariables = Types.Exact<{
30424
+ [key: string]: never;
30425
+ }>;
30426
+ export type GetAccessHistoryQueryResults = {
30427
+ getAccessHistory: {
30428
+ summary: {
30429
+ generatedAt: any | null;
30430
+ windowDays: number | null;
30431
+ } | null;
30432
+ accessors: Array<{
30433
+ totalCount: number;
30434
+ lastAccessed: any;
30435
+ reference: {
30436
+ reference: string;
30437
+ display: string | null;
30438
+ };
30439
+ organizations: Array<{
30440
+ reference: string;
30441
+ name: string;
30442
+ sourceId: string;
30443
+ }>;
30444
+ purposeOfEvent: Array<{
30445
+ system: string | null;
30446
+ code: string;
30447
+ display: string | null;
30448
+ }>;
30449
+ resourceTypes: Array<{
30450
+ type: string;
30451
+ count: number;
30452
+ }>;
30453
+ }>;
30454
+ };
30455
+ };
30423
30456
  export type GetProfileQueryVariables = Types.Exact<{
30424
30457
  [key: string]: never;
30425
30458
  }>;
@@ -165,6 +165,78 @@ export type Scalars = {
165
165
  export type AcceptDataSharingInvitationInput = {
166
166
  code: Scalars['String']['input'];
167
167
  };
168
+ /** Aggregated access activity for a single accessor over the window. */
169
+ export type AccessHistoryAccessor = {
170
+ __typename?: 'AccessHistoryAccessor';
171
+ /** The most recent access time across this accessor's events. */
172
+ lastAccessed: Scalars['DateTime']['output'];
173
+ /** The organization(s) the accessor belongs to. */
174
+ organizations: Array<AccessHistoryOrganization>;
175
+ /** The reason(s) the data was accessed (FHIR purposeOfEvent codings). */
176
+ purposeOfEvent: Array<AccessHistoryPurpose>;
177
+ /** Who accessed the data (Practitioner or Patient), with display set to the human name. */
178
+ reference: AccessHistoryReference;
179
+ /** Per-resource-type breakdown of what this accessor accessed. */
180
+ resourceTypes: Array<AccessHistoryResourceTypeCount>;
181
+ /** Total accesses by this accessor in the window. */
182
+ totalCount: Scalars['Int']['output'];
183
+ };
184
+ /** An organization an accessor belongs to. */
185
+ export type AccessHistoryOrganization = {
186
+ __typename?: 'AccessHistoryOrganization';
187
+ /** Human-readable organization name. */
188
+ name: Scalars['String']['output'];
189
+ /** The FHIR reference, e.g. Organization/{uuid}, with display set to the organization name. */
190
+ reference: Scalars['String']['output'];
191
+ /**
192
+ * The bwell Organization id, surfaced so the client UI can display/link the
193
+ * organization. Same value as the id in `reference`; it is not an upstream
194
+ * source-system identifier.
195
+ */
196
+ sourceId: Scalars['String']['output'];
197
+ };
198
+ /** A reason the data was accessed (FHIR purposeOfEvent coding). */
199
+ export type AccessHistoryPurpose = {
200
+ __typename?: 'AccessHistoryPurpose';
201
+ /** The purpose code, e.g. TREAT, PATRQT. */
202
+ code: Scalars['String']['output'];
203
+ /** Human-readable display for the purpose code. */
204
+ display?: Maybe<Scalars['String']['output']>;
205
+ /** The code system, typically http://terminology.hl7.org/CodeSystem/v3-ActReason. */
206
+ system?: Maybe<Scalars['String']['output']>;
207
+ };
208
+ /** A reference to an accessor, with a human-readable display. */
209
+ export type AccessHistoryReference = {
210
+ __typename?: 'AccessHistoryReference';
211
+ /** Human-readable name for the accessor. */
212
+ display?: Maybe<Scalars['String']['output']>;
213
+ /** The FHIR reference, e.g. Practitioner/{uuid} or Patient/{uuid}. */
214
+ reference: Scalars['String']['output'];
215
+ };
216
+ /** Number of access events for a single FHIR resource type. */
217
+ export type AccessHistoryResourceTypeCount = {
218
+ __typename?: 'AccessHistoryResourceTypeCount';
219
+ /** The number of access events for this resource type by this accessor. */
220
+ count: Scalars['Int']['output'];
221
+ /** The FHIR resource type that was accessed (e.g. DiagnosticReport, MedicationRequest). */
222
+ type: Scalars['String']['output'];
223
+ };
224
+ /** The access-history response: a per-accessor summary plus response-level metadata. */
225
+ export type AccessHistoryResult = {
226
+ __typename?: 'AccessHistoryResult';
227
+ /** One entry per distinct accessor. Empty when there is no recorded access. */
228
+ accessors: Array<AccessHistoryAccessor>;
229
+ /** Response-level metadata about how/when this summary was computed. */
230
+ summary?: Maybe<AccessHistorySummary>;
231
+ };
232
+ /** Response-level metadata about the access-history summary. */
233
+ export type AccessHistorySummary = {
234
+ __typename?: 'AccessHistorySummary';
235
+ /** When this summary was computed (freshness signal). */
236
+ generatedAt?: Maybe<Scalars['DateTime']['output']>;
237
+ /** Length of the rolling window covered, in days (currently 90). */
238
+ windowDays?: Maybe<Scalars['Int']['output']>;
239
+ };
168
240
  export type AccessTokenPayload = {
169
241
  __typename?: 'AccessTokenPayload';
170
242
  jwtToken: Scalars['String']['output'];
@@ -1447,6 +1519,7 @@ export type ConsentQuestionnaireResponse = {
1447
1519
  };
1448
1520
  export type ConsentSearch = {
1449
1521
  category?: InputMaybe<CategoryCode>;
1522
+ organizationId?: InputMaybe<Scalars['String']['input']>;
1450
1523
  patientId?: InputMaybe<Scalars['String']['input']>;
1451
1524
  };
1452
1525
  export type ConsentSourceInput = {
@@ -5838,6 +5911,18 @@ export type Query = {
5838
5911
  diagnosticReports?: Maybe<DiagnosticReportBundle>;
5839
5912
  explanationOfBenefits?: Maybe<ExplanationOfBenefitBundle>;
5840
5913
  findPersonWithClientSlugAndId?: Maybe<PersonInfoForLogin>;
5914
+ /**
5915
+ * Returns the access history for the currently authenticated person — who has
5916
+ * accessed their data, how often, when it was last accessed, and for what reason
5917
+ * — as a per-accessor summary over a rolling window (currently 90 days).
5918
+ *
5919
+ * HDS proxies this to the FHIR server's `Person/{id}/$access-history` operation,
5920
+ * scoped to the person id in the caller's JWT, and flattens the returned FHIR
5921
+ * `Parameters` resource into this typed shape. The FHIR server enforces
5922
+ * authorization (a user can only read their own access history) and requires both
5923
+ * `Person.read` and `AuditEvent.read` scopes.
5924
+ */
5925
+ getAccessHistory: AccessHistoryResult;
5841
5926
  getAllergyIntoleranceGroups: AllergyIntoleranceGroupQueryResults;
5842
5927
  /** Retrieves a list of AllergyIntolerance resources based on the provided search criteria. */
5843
5928
  getAllergyIntolerances: AllergyIntoleranceQueryResults;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icanbwell/bwell-sdk-ts",
3
- "version": "1.98.0",
3
+ "version": "1.99.0",
4
4
  "description": "b.well TypeScript SDK",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",