@icanbwell/bwell-sdk-ts 2.0.0-alpha.0-rc.1755532484 → 2.0.0-alpha.0-rc.1755885512

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 = "2.0.0-alpha.0-rc.1755532484";
4
+ export declare const VERSION = "2.0.0-alpha.0-rc.1755885512";
@@ -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 = "2.0.0-alpha.0-rc.1755532484";
4
+ export const VERSION = "2.0.0-alpha.0-rc.1755885512";
@@ -1,10 +1,10 @@
1
1
  import { ValidationError } from "../../../errors/validation-error.js";
2
- import { Consent, Person, VerificationResult } from "../../../models/user/index.js";
2
+ import { Consent, ConsentBundle, Person, VerificationResult } from "../../../models/user/index.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";
6
6
  import { CreateVerificationUrlRequest } from "./create-verification-url-request.js";
7
- import { CreateDataExportDirectDownloadUrlRequest } from "./index.js";
7
+ import { CreateDataExportDirectDownloadUrlRequest, GetConsentsRequest } from "./index.js";
8
8
  import { UpdateProfileRequest } from "./update-profile-request.js";
9
9
  /**
10
10
  * User Manager for profile management, consent handling, and identity verification.
@@ -42,6 +42,12 @@ export interface UserManager {
42
42
  * ```
43
43
  */
44
44
  updateProfile(request: UpdateProfileRequest): Promise<BWellTransactionResult<Person, BaseManagerError>>;
45
+ /**
46
+ * Retrieves a list of consents for the current user, optionally filtered by category.
47
+ * @param category - Optional category code to filter consents.
48
+ * @returns A promise that resolves to a query result containing a bundle of consents.
49
+ */
50
+ getConsents(request?: GetConsentsRequest): Promise<BWellQueryResult<ConsentBundle, BaseManagerError>>;
45
51
  /**
46
52
  * Creates a new user consent.
47
53
  * Stores consent preferences for the authenticated user.
@@ -0,0 +1,5 @@
1
+ import { SearchConsentQueryVariables } from "../../../graphql/operations/types.js";
2
+ import { GetConsentsRequest, RequestFactory } from "../../../index.js";
3
+ export declare class GetConsentRequestFactory implements RequestFactory<GetConsentsRequest, SearchConsentQueryVariables> {
4
+ create(request: GetConsentsRequest): SearchConsentQueryVariables;
5
+ }
@@ -0,0 +1,12 @@
1
+ export class GetConsentRequestFactory {
2
+ create(request) {
3
+ const input = request.data();
4
+ return {
5
+ category: {
6
+ value: {
7
+ value: input.category,
8
+ },
9
+ },
10
+ };
11
+ }
12
+ }
@@ -1,9 +1,9 @@
1
1
  import { ValidationError } from "../../../errors/validation-error.js";
2
2
  import { LoggerProvider } from "../../../logger/index.js";
3
- import { Consent, Person, VerificationResult } from "../../../models/user/index.js";
3
+ import { Consent, ConsentBundle, Person, VerificationResult } from "../../../models/user/index.js";
4
4
  import { BWellQueryResult, BWellTransactionResult } from "../../../results/index.js";
5
5
  import { BaseManagerError } from "../../base/errors.js";
6
- import { CreateConsentRequest, CreateDataExportDirectDownloadUrlRequest, CreateVerificationUrlRequest, UpdateProfileRequest } from "../../base/user/index.js";
6
+ import { CreateConsentRequest, CreateDataExportDirectDownloadUrlRequest, CreateVerificationUrlRequest, GetConsentsRequest, UpdateProfileRequest } from "../../base/user/index.js";
7
7
  import type { UserManager } from "../../base/user/user-manager.js";
8
8
  import { GraphQLManager } from "../graphql-manager/index.js";
9
9
  import type { GraphQLSdk } from "../graphql-sdk/index.js";
@@ -13,6 +13,7 @@ export declare class GraphQLUserManager extends GraphQLManager implements UserMa
13
13
  getProfile(): Promise<BWellQueryResult<Person, BaseManagerError>>;
14
14
  delete(): Promise<BWellTransactionResult<null, BaseManagerError>>;
15
15
  updateProfile(request: UpdateProfileRequest): Promise<BWellTransactionResult<Person, BaseManagerError>>;
16
+ getConsents(request?: GetConsentsRequest): Promise<BWellQueryResult<ConsentBundle, BaseManagerError | ValidationError>>;
16
17
  createConsent(request: CreateConsentRequest): Promise<BWellTransactionResult<Consent, BaseManagerError | ValidationError>>;
17
18
  createDataExportDirectDownloadUrl(request: CreateDataExportDirectDownloadUrlRequest): Promise<BWellTransactionResult<string | null, BaseManagerError>>;
18
19
  createVerificationUrl(request: CreateVerificationUrlRequest): Promise<BWellTransactionResult<string, BaseManagerError>>;
@@ -18,12 +18,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
18
18
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
19
19
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
20
20
  };
21
- var _GraphQLUserManager_sdk, _GraphQLUserManager_logger, _GraphQLUserManager_createConsentRequestFactory, _GraphQLUserManager_updateProfileRequestFactory, _GraphQLUserManager_createVerificationUrlRequestFactory;
21
+ var _GraphQLUserManager_sdk, _GraphQLUserManager_logger, _GraphQLUserManager_createConsentRequestFactory, _GraphQLUserManager_updateProfileRequestFactory, _GraphQLUserManager_getConsentRequestFactory, _GraphQLUserManager_createVerificationUrlRequestFactory;
22
22
  import { ConsoleLoggerProvider, } from "../../../logger/index.js";
23
23
  import { BWellQueryResult, BWellTransactionResult, } from "../../../results/index.js";
24
24
  import { GraphQLManager } from "../graphql-manager/index.js";
25
25
  import { CreateConsentRequestFactory } from "./create-consent-request-factory.js";
26
26
  import { CreateVerificationUrlRequestFactory } from "./create-verification-url-request-factory.js";
27
+ import { GetConsentRequestFactory } from "./get-consent-request-factory.js";
27
28
  import { UpdateProfileRequestFactory } from "./update-profile-request-factory.js";
28
29
  export class GraphQLUserManager extends GraphQLManager {
29
30
  constructor(sdk, loggerProvider = new ConsoleLoggerProvider()) {
@@ -32,14 +33,7 @@ export class GraphQLUserManager extends GraphQLManager {
32
33
  _GraphQLUserManager_logger.set(this, void 0);
33
34
  _GraphQLUserManager_createConsentRequestFactory.set(this, new CreateConsentRequestFactory());
34
35
  _GraphQLUserManager_updateProfileRequestFactory.set(this, new UpdateProfileRequestFactory());
35
- // #getConsentRequestFactory: RequestFactory<
36
- // GetConsentsRequest,
37
- // SearchConsentQueryVariables
38
- // > = new GetConsentRequestFactory();
39
- // #createDataExportDirectDownloadUrlRequestFactory: RequestFactory<
40
- // CreateDataExportDirectDownloadUrlRequest,
41
- // CreateDataExportDirectDownloadUrlMutationVariables
42
- // > = new CreateDataExportDirectDownloadUrlRequestFactory();
36
+ _GraphQLUserManager_getConsentRequestFactory.set(this, new GetConsentRequestFactory());
43
37
  _GraphQLUserManager_createVerificationUrlRequestFactory.set(this, new CreateVerificationUrlRequestFactory());
44
38
  __classPrivateFieldSet(this, _GraphQLUserManager_sdk, sdk, "f");
45
39
  __classPrivateFieldSet(this, _GraphQLUserManager_logger, loggerProvider.getLogger("GraphQLUserManager"), "f");
@@ -86,30 +80,29 @@ export class GraphQLUserManager extends GraphQLManager {
86
80
  .updateUserProfile);
87
81
  });
88
82
  }
89
- // TODO: Migrate
90
- // public async getConsents(
91
- // request?: GetConsentsRequest,
92
- // ): Promise<
93
- // BWellQueryResult<GetConsentsResults, BaseManagerError | ValidationError>
94
- // > {
95
- // const validationResults = this.validateRequest(request);
96
- // if (validationResults.failure()) {
97
- // return validationResults.toQueryResult();
98
- // }
99
- // this.#logger.verbose("calling consent search query...");
100
- // let sdkRequest: SearchConsentQueryVariables | undefined;
101
- // if (request !== undefined) {
102
- // sdkRequest = this.#getConsentRequestFactory.create(request);
103
- // }
104
- // const result = await this.handleQuery(this.#sdk.searchConsent(sdkRequest));
105
- // this.#logger.verbose("consent search query complete");
106
- // if (result.hasError()) {
107
- // this.#logger.error("consent search failed", result.error);
108
- // } else {
109
- // this.#logger.info("successfully called consent search query");
110
- // }
111
- // return new BWellQueryResult(result.data?.search, result.error);
112
- // }
83
+ getConsents(request) {
84
+ return __awaiter(this, void 0, void 0, function* () {
85
+ var _a;
86
+ const validationResults = this.validateRequest(request);
87
+ if (validationResults.failure()) {
88
+ return validationResults.toQueryResult();
89
+ }
90
+ __classPrivateFieldGet(this, _GraphQLUserManager_logger, "f").verbose("calling consent search query...");
91
+ let sdkRequest;
92
+ if (request !== undefined) {
93
+ sdkRequest = __classPrivateFieldGet(this, _GraphQLUserManager_getConsentRequestFactory, "f").create(request);
94
+ }
95
+ const result = yield this.handleQuery(__classPrivateFieldGet(this, _GraphQLUserManager_sdk, "f").searchConsent(sdkRequest));
96
+ __classPrivateFieldGet(this, _GraphQLUserManager_logger, "f").verbose("consent search query complete");
97
+ if (result.hasError()) {
98
+ __classPrivateFieldGet(this, _GraphQLUserManager_logger, "f").error("consent search failed", result.error);
99
+ }
100
+ else {
101
+ __classPrivateFieldGet(this, _GraphQLUserManager_logger, "f").info("successfully called consent search query");
102
+ }
103
+ return new BWellQueryResult((_a = result.data) === null || _a === void 0 ? void 0 : _a.consents, result.error);
104
+ });
105
+ }
113
106
  createConsent(request) {
114
107
  return __awaiter(this, void 0, void 0, function* () {
115
108
  const validationResult = request.validate();
@@ -173,4 +166,4 @@ export class GraphQLUserManager extends GraphQLManager {
173
166
  });
174
167
  }
175
168
  }
176
- _GraphQLUserManager_sdk = new WeakMap(), _GraphQLUserManager_logger = new WeakMap(), _GraphQLUserManager_createConsentRequestFactory = new WeakMap(), _GraphQLUserManager_updateProfileRequestFactory = new WeakMap(), _GraphQLUserManager_createVerificationUrlRequestFactory = new WeakMap();
169
+ _GraphQLUserManager_sdk = new WeakMap(), _GraphQLUserManager_logger = new WeakMap(), _GraphQLUserManager_createConsentRequestFactory = new WeakMap(), _GraphQLUserManager_updateProfileRequestFactory = new WeakMap(), _GraphQLUserManager_getConsentRequestFactory = new WeakMap(), _GraphQLUserManager_createVerificationUrlRequestFactory = new WeakMap();
@@ -74,6 +74,7 @@ export declare const CreateDataExportDirectDownloadUrlDocument = "\n mutation
74
74
  export declare const CreateVerificationUrlDocument = "\n mutation CreateVerificationUrl($callbackURL: String, $includeAttributeMatchingCheck: Boolean) {\n createVerificationUrl(\n callbackURL: $callbackURL\n includeAttributeMatchingCheck: $includeAttributeMatchingCheck\n )\n}\n ";
75
75
  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 ";
76
76
  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 }\n}\n ";
77
+ export declare const SearchConsentDocument = "\n query searchConsent($category: SearchToken) {\n consents(category: $category) {\n id\n entry {\n id\n resource {\n id\n meta {\n ...MetaFields\n }\n status\n scope {\n ...CodeableConceptFields\n }\n category {\n ...CodeableConceptFields\n }\n patient {\n reference\n }\n provision {\n type\n }\n }\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 id\n system\n code\n display\n}\n \n\n fragment CodeableConceptFields on CodeableConcept {\n id\n text\n coding {\n ...CodingFields\n }\n}\n \n fragment CodingFields on Coding {\n id\n system\n code\n display\n}\n ";
77
78
  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 ";
78
79
  export declare const VerificationStatusDocument = "\n query VerificationStatus {\n verificationStatus {\n resourceType\n id\n status\n statusDate\n lastPerformed\n }\n}\n ";
79
80
  export type SdkFunctionWrapper = <T>(action: (requestHeaders?: Record<string, string>) => Promise<T>, operationName: string, operationType?: string, variables?: any) => Promise<T>;
@@ -330,6 +331,13 @@ export declare function getSdk(client: GraphQLClient, withWrapper?: SdkFunctionW
330
331
  headers: Headers;
331
332
  status: number;
332
333
  }>;
334
+ searchConsent(variables?: Types.SearchConsentQueryVariables, requestHeaders?: GraphQLClientRequestHeaders): Promise<{
335
+ data: Types.SearchConsentQueryResults;
336
+ errors?: GraphQLError[];
337
+ extensions?: any;
338
+ headers: Headers;
339
+ status: number;
340
+ }>;
333
341
  updateUserProfile(variables?: Types.UpdateUserProfileMutationVariables, requestHeaders?: GraphQLClientRequestHeaders): Promise<{
334
342
  data: Types.UpdateUserProfileMutationResults;
335
343
  errors?: GraphQLError[];
@@ -1363,6 +1363,36 @@ export const GetProfileDocument = `
1363
1363
  }
1364
1364
  }
1365
1365
  `;
1366
+ export const SearchConsentDocument = `
1367
+ query searchConsent($category: SearchToken) {
1368
+ consents(category: $category) {
1369
+ id
1370
+ entry {
1371
+ id
1372
+ resource {
1373
+ id
1374
+ meta {
1375
+ ...MetaFields
1376
+ }
1377
+ status
1378
+ scope {
1379
+ ...CodeableConceptFields
1380
+ }
1381
+ category {
1382
+ ...CodeableConceptFields
1383
+ }
1384
+ patient {
1385
+ reference
1386
+ }
1387
+ provision {
1388
+ type
1389
+ }
1390
+ }
1391
+ }
1392
+ }
1393
+ }
1394
+ ${MetaFieldsFragmentDoc}
1395
+ ${CodeableConceptFieldsFragmentDoc}`;
1366
1396
  export const UpdateUserProfileDocument = `
1367
1397
  mutation updateUserProfile($person: FHIRPersonInput) {
1368
1398
  updateUserProfile(input: $person) {
@@ -1510,6 +1540,9 @@ export function getSdk(client, withWrapper = defaultWrapper) {
1510
1540
  getProfile(variables, requestHeaders) {
1511
1541
  return withWrapper((wrappedRequestHeaders) => client.rawRequest(GetProfileDocument, variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'getProfile', 'query', variables);
1512
1542
  },
1543
+ searchConsent(variables, requestHeaders) {
1544
+ return withWrapper((wrappedRequestHeaders) => client.rawRequest(SearchConsentDocument, variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'searchConsent', 'query', variables);
1545
+ },
1513
1546
  updateUserProfile(variables, requestHeaders) {
1514
1547
  return withWrapper((wrappedRequestHeaders) => client.rawRequest(UpdateUserProfileDocument, variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'updateUserProfile', 'mutation', variables);
1515
1548
  },
@@ -4630,6 +4630,64 @@ export type GetProfileQueryResults = {
4630
4630
  } | null> | null;
4631
4631
  } | null;
4632
4632
  };
4633
+ export type SearchConsentQueryVariables = Types.Exact<{
4634
+ category: Types.InputMaybe<Types.SearchToken>;
4635
+ }>;
4636
+ export type SearchConsentQueryResults = {
4637
+ consents: {
4638
+ id: string | null;
4639
+ entry: Array<{
4640
+ id: string | null;
4641
+ resource: {
4642
+ id: string;
4643
+ status: any | null;
4644
+ meta: {
4645
+ versionId: string | null;
4646
+ lastUpdated: any | null;
4647
+ source: any | null;
4648
+ security: Array<{
4649
+ id: string | null;
4650
+ system: any | null;
4651
+ code: any | null;
4652
+ display: string | null;
4653
+ } | null> | null;
4654
+ tag: Array<{
4655
+ id: string | null;
4656
+ system: any | null;
4657
+ code: any | null;
4658
+ display: string | null;
4659
+ } | null> | null;
4660
+ } | null;
4661
+ scope: {
4662
+ id: string | null;
4663
+ text: string | null;
4664
+ coding: Array<{
4665
+ id: string | null;
4666
+ system: any | null;
4667
+ code: any | null;
4668
+ display: string | null;
4669
+ } | null> | null;
4670
+ } | null;
4671
+ category: Array<{
4672
+ id: string | null;
4673
+ text: string | null;
4674
+ coding: Array<{
4675
+ id: string | null;
4676
+ system: any | null;
4677
+ code: any | null;
4678
+ display: string | null;
4679
+ } | null> | null;
4680
+ } | null> | null;
4681
+ patient: {
4682
+ reference: string | null;
4683
+ } | null;
4684
+ provision: {
4685
+ type: any | null;
4686
+ } | null;
4687
+ } | null;
4688
+ } | null> | null;
4689
+ } | null;
4690
+ };
4633
4691
  export type UpdateUserProfileMutationVariables = Types.Exact<{
4634
4692
  person: Types.InputMaybe<Types.FhirPersonInput>;
4635
4693
  }>;
@@ -55580,6 +55580,7 @@ export type QuestionnaireResponseItemAnswerInput = {
55580
55580
  export type QuestionnaireResponseItemInput = {
55581
55581
  answer?: InputMaybe<Array<InputMaybe<QuestionnaireResponseItemAnswerInput>>>;
55582
55582
  definition?: InputMaybe<Scalars['String']['input']>;
55583
+ extension?: InputMaybe<Array<InputMaybe<FhirExtensionInput>>>;
55583
55584
  item?: InputMaybe<Array<InputMaybe<QuestionnaireResponseItemInput>>>;
55584
55585
  linkId: Scalars['String']['input'];
55585
55586
  text?: InputMaybe<Scalars['String']['input']>;
@@ -1,4 +1,4 @@
1
- import type { CodeableConcept, Meta, Period, Reference } from "../common/index.js";
1
+ import type { CodeableConcept, EntryBundle, IdentifiedResourceEntry, Meta, Period, Reference } from "../common/index.js";
2
2
  /**
3
3
  * A record of a healthcare consumer's choices or choices made on their behalf by a third party.
4
4
  * Captures permissions, prohibitions and obligations with respect to access to or use of a resource.
@@ -89,3 +89,23 @@ export type ConsentProvision = {
89
89
  */
90
90
  period: Period | null;
91
91
  };
92
+ /**
93
+ * Represents an entry in an allergy intolerance bundle.
94
+ * Represents an entry in a consent bundle.
95
+ * Contains a consent resource and metadata.
96
+ *
97
+ * @category Models
98
+ * @title ConsentEntry
99
+ * @excerpt Represents an entry in a consent bundle
100
+ */
101
+ type ConsentEntry = IdentifiedResourceEntry<Consent>;
102
+ /**
103
+ * Bundle of consent search results.
104
+ * Contains multiple consent entries from search operations.
105
+ *
106
+ * @category Models
107
+ * @title ConsentBundle
108
+ * @excerpt Bundle of consent search results
109
+ */
110
+ export type ConsentBundle = EntryBundle<ConsentEntry>;
111
+ export {};
@@ -1,4 +1,4 @@
1
1
  export type { User } from "./user.js";
2
2
  export type { Person } from "./person.js";
3
- export type { Consent } from "./consent.js";
3
+ export type { Consent, ConsentBundle } from "./consent.js";
4
4
  export type { VerificationResult } from "./verification-result.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icanbwell/bwell-sdk-ts",
3
- "version": "2.0.0-alpha.0-rc.1755532484",
3
+ "version": "2.0.0-alpha.0-rc.1755885512",
4
4
  "description": "b.well TypeScript SDK",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",