@icanbwell/bwell-sdk-ts 2.0.0-alpha.0-rc.1754641589 → 2.0.0-alpha.0-rc.1755023129
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.
- package/dist/__version__.d.ts +1 -1
- package/dist/__version__.js +1 -1
- package/dist/api/base/api-provider.d.ts +2 -0
- package/dist/api/base/device/constants.d.ts +3 -0
- package/dist/api/base/device/constants.js +3 -0
- package/dist/api/base/device/device-manager.d.ts +40 -0
- package/dist/api/base/device/device-manager.js +1 -0
- package/dist/api/base/device/device-request.d.ts +54 -0
- package/dist/api/base/device/device-request.js +59 -0
- package/dist/api/base/device/index.d.ts +3 -0
- package/dist/api/base/device/index.js +3 -0
- package/dist/api/base/index.d.ts +1 -0
- package/dist/api/base/index.js +1 -1
- package/dist/api/base/search/search-health-resources-request.d.ts +4 -20
- package/dist/api/graphql-api/device/device-request-factory.d.ts +9 -0
- package/dist/api/graphql-api/device/device-request-factory.js +15 -0
- package/dist/api/graphql-api/device/graphql-device-manager.d.ts +14 -0
- package/dist/api/graphql-api/device/graphql-device-manager.js +75 -0
- package/dist/api/graphql-api/device/index.d.ts +1 -0
- package/dist/api/graphql-api/device/index.js +1 -0
- package/dist/api/graphql-api/graphql-api-provider.d.ts +2 -1
- package/dist/api/graphql-api/graphql-api-provider.js +2 -1
- package/dist/bwell-sdk/bwell-sdk.d.ts +9 -1
- package/dist/bwell-sdk/bwell-sdk.js +10 -3
- package/dist/graphql/operations/index.d.ts +8 -0
- package/dist/graphql/operations/index.js +12 -0
- package/dist/graphql/operations/types.d.ts +11 -0
- package/dist/graphql/schema.d.ts +5 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/models/device/index.d.ts +3 -0
- package/dist/models/device/index.js +1 -0
- package/dist/models/enums/device-platform.d.ts +11 -0
- package/dist/models/enums/device-platform.js +2 -0
- package/dist/models/enums/index.d.ts +3 -0
- package/dist/models/enums/index.js +1 -0
- package/dist/models/enums/sort-field.d.ts +10 -0
- package/dist/models/enums/sort-field.js +1 -0
- package/dist/models/enums/sort-order.d.ts +9 -0
- package/dist/models/enums/sort-order.js +1 -0
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +1 -0
- package/package.json +1 -1
package/dist/__version__.d.ts
CHANGED
package/dist/__version__.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { LanguageManager } from "../../language/language-manager.js";
|
|
2
2
|
import { ConnectionManager } from "./connection/index.js";
|
|
3
|
+
import { DeviceManager } from "./device/index.js";
|
|
3
4
|
import { HealthManager } from "./health-data/index.js";
|
|
4
5
|
import { HealthSpaceManager } from "./health-space/index.js";
|
|
5
6
|
import { IdentityManager } from "./identity/identity-manager.js";
|
|
@@ -10,6 +11,7 @@ export interface ApiProvider {
|
|
|
10
11
|
readonly health: HealthManager;
|
|
11
12
|
readonly healthSpace: HealthSpaceManager;
|
|
12
13
|
readonly user: UserManager;
|
|
14
|
+
readonly device: DeviceManager;
|
|
13
15
|
readonly connection: ConnectionManager;
|
|
14
16
|
readonly search: SearchManager;
|
|
15
17
|
readonly questionnaire: QuestionnaireManager;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { DeviceRegistrationResults } from "../../../models/index.js";
|
|
2
|
+
import type { BWellTransactionResult } from "../../../results/index.js";
|
|
3
|
+
import type { BaseManagerError } from "../errors.js";
|
|
4
|
+
import { DeregisterDeviceRequest, RegisterDeviceRequest } from "./index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Methods to register/deregister mobile devices.
|
|
7
|
+
*
|
|
8
|
+
* @title DeviceManager
|
|
9
|
+
* @excerpt Methods to register/deregister mobile devices
|
|
10
|
+
* @category Managers
|
|
11
|
+
*/
|
|
12
|
+
export interface DeviceManager {
|
|
13
|
+
/**
|
|
14
|
+
* Register device to receive push notifications.
|
|
15
|
+
*
|
|
16
|
+
* @param {RegisterDeviceRequest} request - The request containing device registration information.
|
|
17
|
+
* @returns {Promise<BWellTransactionResult<DeviceRegistrationResults, BaseManagerError>>} Registration results or an error.
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const results = await sdk.device.registerDevice({
|
|
21
|
+
* deviceToken: "123",
|
|
22
|
+
* platformName: "IOS",
|
|
23
|
+
* applicationName: "my-app"
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
registerDevice(request: RegisterDeviceRequest): Promise<BWellTransactionResult<DeviceRegistrationResults, BaseManagerError>>;
|
|
28
|
+
/**
|
|
29
|
+
* Deregisters a device so that it will no longer receive notifications.
|
|
30
|
+
* @param {DeregisterDeviceRequest} request The request to deregister the device.
|
|
31
|
+
* @returns {Promise<BWellTransactionResult<DeviceRegistrationResults, BaseManagerError>>} The deregistration results or an error.
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const results = await sdk.device.deregisterDevice({
|
|
35
|
+
* deviceToken: "123",
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
deregisterDevice(request: DeregisterDeviceRequest): Promise<BWellTransactionResult<DeviceRegistrationResults, BaseManagerError>>;
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ErrorsCollector, ValidationRequest, Validator } from "../../../index.js";
|
|
2
|
+
import { DevicePlatform } from "../../../models/enums/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Input type for registering a device to receive push notifications.
|
|
5
|
+
* @category Inputs
|
|
6
|
+
* @title RegisterDeviceRequestInput
|
|
7
|
+
* @excerpt Input for registering a device
|
|
8
|
+
*/
|
|
9
|
+
export type RegisterDeviceRequestInput = {
|
|
10
|
+
deviceToken: string;
|
|
11
|
+
platformName: DevicePlatform;
|
|
12
|
+
applicationName: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Validator for RegisterDeviceRequestInput.
|
|
16
|
+
* Validates device token, platform name, and application name fields.
|
|
17
|
+
*/
|
|
18
|
+
export declare class RegisterDeviceRequestValidator implements Validator<RegisterDeviceRequestInput> {
|
|
19
|
+
validate(data: RegisterDeviceRequestInput, errors: ErrorsCollector): void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Request class for registering a device.
|
|
23
|
+
* @category Requests
|
|
24
|
+
* @title RegisterDeviceRequest
|
|
25
|
+
* @excerpt Request for registering a device
|
|
26
|
+
*/
|
|
27
|
+
export declare class RegisterDeviceRequest extends ValidationRequest<RegisterDeviceRequestInput> {
|
|
28
|
+
protected validator: RegisterDeviceRequestValidator;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Input object for deregistering a device
|
|
32
|
+
* @category Inputs
|
|
33
|
+
* @title DeregisterDeviceRequestInput
|
|
34
|
+
* @excerpt Input for deregistering a device
|
|
35
|
+
*/
|
|
36
|
+
export type DeregisterDeviceRequestInput = {
|
|
37
|
+
deviceToken: string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Validator for DeregisterDeviceRequestInput.
|
|
41
|
+
* Validates the device token field.
|
|
42
|
+
*/
|
|
43
|
+
export declare class DeregisterDeviceRequestValidator implements Validator<DeregisterDeviceRequestInput> {
|
|
44
|
+
validate(data: DeregisterDeviceRequestInput, errors: ErrorsCollector): void;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Request class for de-registering a device.
|
|
48
|
+
* @category Requests
|
|
49
|
+
* @title DeregisterDeviceRequest
|
|
50
|
+
* @excerpt Request for de-registering a device
|
|
51
|
+
*/
|
|
52
|
+
export declare class DeregisterDeviceRequest extends ValidationRequest<DeregisterDeviceRequestInput> {
|
|
53
|
+
protected validator: DeregisterDeviceRequestValidator;
|
|
54
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ValidationRequest, } from "../../../index.js";
|
|
2
|
+
import { devicePlatformValues, } from "../../../models/enums/index.js";
|
|
3
|
+
import { isBlank } from "../../../utils/string-utils.js";
|
|
4
|
+
import { INVALID_APPLICATION_NAME_ERROR, INVALID_DEVICE_TOKEN_ERROR, INVALID_PLATFORM_NAME_ERROR, } from "./constants.js";
|
|
5
|
+
const isValidDevicePlatform = (value) => {
|
|
6
|
+
return devicePlatformValues.includes(value);
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Validator for RegisterDeviceRequestInput.
|
|
10
|
+
* Validates device token, platform name, and application name fields.
|
|
11
|
+
*/
|
|
12
|
+
export class RegisterDeviceRequestValidator {
|
|
13
|
+
validate(data, errors) {
|
|
14
|
+
if (isBlank(data.deviceToken)) {
|
|
15
|
+
errors.add(INVALID_DEVICE_TOKEN_ERROR);
|
|
16
|
+
}
|
|
17
|
+
if (!isValidDevicePlatform(data.platformName.toUpperCase())) {
|
|
18
|
+
errors.add(INVALID_PLATFORM_NAME_ERROR);
|
|
19
|
+
}
|
|
20
|
+
if (isBlank(data.applicationName)) {
|
|
21
|
+
errors.add(INVALID_APPLICATION_NAME_ERROR);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Request class for registering a device.
|
|
27
|
+
* @category Requests
|
|
28
|
+
* @title RegisterDeviceRequest
|
|
29
|
+
* @excerpt Request for registering a device
|
|
30
|
+
*/
|
|
31
|
+
export class RegisterDeviceRequest extends ValidationRequest {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
this.validator = new RegisterDeviceRequestValidator();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Validator for DeregisterDeviceRequestInput.
|
|
39
|
+
* Validates the device token field.
|
|
40
|
+
*/
|
|
41
|
+
export class DeregisterDeviceRequestValidator {
|
|
42
|
+
validate(data, errors) {
|
|
43
|
+
if (isBlank(data.deviceToken)) {
|
|
44
|
+
errors.add(INVALID_DEVICE_TOKEN_ERROR);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Request class for de-registering a device.
|
|
50
|
+
* @category Requests
|
|
51
|
+
* @title DeregisterDeviceRequest
|
|
52
|
+
* @excerpt Request for de-registering a device
|
|
53
|
+
*/
|
|
54
|
+
export class DeregisterDeviceRequest extends ValidationRequest {
|
|
55
|
+
constructor() {
|
|
56
|
+
super(...arguments);
|
|
57
|
+
this.validator = new DeregisterDeviceRequestValidator();
|
|
58
|
+
}
|
|
59
|
+
}
|
package/dist/api/base/index.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ export * from "./user/index.js";
|
|
|
3
3
|
export * from "./health-data/index.js";
|
|
4
4
|
export * from "./search/index.js";
|
|
5
5
|
export * from "./connection/index.js";
|
|
6
|
+
export * from "./device/index.js";
|
|
6
7
|
export * from "./health-space/index.js";
|
|
7
8
|
export * from "./questionnaire/index.js";
|
package/dist/api/base/index.js
CHANGED
|
@@ -4,7 +4,7 @@ export * from "./health-data/index.js";
|
|
|
4
4
|
// export * from "./activity/index.js";
|
|
5
5
|
export * from "./search/index.js";
|
|
6
6
|
export * from "./connection/index.js";
|
|
7
|
-
|
|
7
|
+
export * from "./device/index.js";
|
|
8
8
|
// export * from "./event/index.js";
|
|
9
9
|
export * from "./health-space/index.js";
|
|
10
10
|
export * from "./questionnaire/index.js";
|
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
import { ClientInput,
|
|
1
|
+
import { ClientInput, OrderByInput, SearchFiltersInput, SearchLocation, UserInput } from "../../../graphql/schema.js";
|
|
2
|
+
import { SortField, SortOrder } from "../../../models/enums/index.js";
|
|
2
3
|
import { PagedRequest, PagedRequestInput, PagedRequestValidator } from "../../../requests/index.js";
|
|
3
|
-
/**
|
|
4
|
-
* Type representing the search filters for health resources.
|
|
5
|
-
*/
|
|
6
|
-
export type FilterField = `${GraphQLFilterField}`;
|
|
7
|
-
/**
|
|
8
|
-
* Type representing the organization type for health resources.
|
|
9
|
-
*/
|
|
10
|
-
export type OrganizationType = `${GraphQLOrganizationType}`;
|
|
11
|
-
/**
|
|
12
|
-
* Type representing the sort field for health resources.
|
|
13
|
-
* @experimental
|
|
14
|
-
*/
|
|
15
|
-
export type SortField = `${GraphQLSortField}`;
|
|
16
|
-
/**
|
|
17
|
-
* Type representing the sort order for health resources.
|
|
18
|
-
*/
|
|
19
|
-
export type SortOrder = `${GraphQLSortOrder}`;
|
|
20
4
|
/**
|
|
21
5
|
* The provider location to search by
|
|
22
6
|
*/
|
|
@@ -55,11 +39,11 @@ export type SearchHealthResourcesRequestInput = PagedRequestInput & {
|
|
|
55
39
|
/**
|
|
56
40
|
* The client configuration to search for health resources.
|
|
57
41
|
*/
|
|
58
|
-
client
|
|
42
|
+
client?: [ClientInput];
|
|
59
43
|
/**
|
|
60
44
|
* The filters to apply to the search.
|
|
61
45
|
*/
|
|
62
|
-
filters
|
|
46
|
+
filters?: SearchFiltersInput;
|
|
63
47
|
/**
|
|
64
48
|
* Specifies order options for the search.
|
|
65
49
|
*/
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UpdateDeviceRegistrationMutationVariables } from "../../../graphql/operations/types.js";
|
|
2
|
+
import { RequestFactory } from "../../../requests/index.js";
|
|
3
|
+
import { DeregisterDeviceRequest, RegisterDeviceRequest } from "../../base/device/index.js";
|
|
4
|
+
export declare class DeregisterDeviceRequestFactory implements RequestFactory<DeregisterDeviceRequest, UpdateDeviceRegistrationMutationVariables> {
|
|
5
|
+
create(request: DeregisterDeviceRequest): UpdateDeviceRegistrationMutationVariables;
|
|
6
|
+
}
|
|
7
|
+
export declare class RegisterDeviceRequestFactory implements RequestFactory<RegisterDeviceRequest, UpdateDeviceRegistrationMutationVariables> {
|
|
8
|
+
create(request: RegisterDeviceRequest): UpdateDeviceRegistrationMutationVariables;
|
|
9
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export class DeregisterDeviceRequestFactory {
|
|
2
|
+
create(request) {
|
|
3
|
+
return {
|
|
4
|
+
deviceToken: request.data().deviceToken,
|
|
5
|
+
platformName: "", //left empty because not needed to deregister
|
|
6
|
+
applicationName: "", //left empty because not needed to deregister
|
|
7
|
+
notificationPreference: false,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export class RegisterDeviceRequestFactory {
|
|
12
|
+
create(request) {
|
|
13
|
+
return Object.assign(Object.assign({}, request.data()), { notificationPreference: true });
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LoggerProvider } from "../../../logger/index.js";
|
|
2
|
+
import { DeviceRegistrationResults } from "../../../models/index.js";
|
|
3
|
+
import { BWellTransactionResult } from "../../../results/index.js";
|
|
4
|
+
import type { DeviceManager } from "../../base/device/device-manager.js";
|
|
5
|
+
import { DeregisterDeviceRequest, RegisterDeviceRequest } from "../../base/device/index.js";
|
|
6
|
+
import { BaseManagerError } from "../../base/errors.js";
|
|
7
|
+
import { GraphQLManager } from "../graphql-manager/index.js";
|
|
8
|
+
import type { GraphQLSdk } from "../graphql-sdk/index.js";
|
|
9
|
+
export declare class GraphQLDeviceManager extends GraphQLManager implements DeviceManager {
|
|
10
|
+
#private;
|
|
11
|
+
constructor(sdk: GraphQLSdk, loggerProvider?: LoggerProvider);
|
|
12
|
+
registerDevice(request: RegisterDeviceRequest): Promise<BWellTransactionResult<DeviceRegistrationResults, BaseManagerError>>;
|
|
13
|
+
deregisterDevice(request: DeregisterDeviceRequest): Promise<BWellTransactionResult<DeviceRegistrationResults, BaseManagerError>>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
11
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
12
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
13
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
14
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
15
|
+
};
|
|
16
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
17
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
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
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
20
|
+
};
|
|
21
|
+
var _GraphQLDeviceManager_sdk, _GraphQLDeviceManager_logger, _GraphQLDeviceManager_deregisterDeviceRequestFactory, _GraphQLDeviceManager_registerDeviceRequestFactory;
|
|
22
|
+
import { ConsoleLoggerProvider, } from "../../../logger/index.js";
|
|
23
|
+
import { BWellTransactionResult } from "../../../results/index.js";
|
|
24
|
+
import { GraphQLManager } from "../graphql-manager/index.js";
|
|
25
|
+
import { DeregisterDeviceRequestFactory, RegisterDeviceRequestFactory, } from "./device-request-factory.js";
|
|
26
|
+
export class GraphQLDeviceManager extends GraphQLManager {
|
|
27
|
+
constructor(sdk, loggerProvider = new ConsoleLoggerProvider()) {
|
|
28
|
+
super();
|
|
29
|
+
_GraphQLDeviceManager_sdk.set(this, void 0);
|
|
30
|
+
_GraphQLDeviceManager_logger.set(this, void 0);
|
|
31
|
+
_GraphQLDeviceManager_deregisterDeviceRequestFactory.set(this, new DeregisterDeviceRequestFactory());
|
|
32
|
+
_GraphQLDeviceManager_registerDeviceRequestFactory.set(this, new RegisterDeviceRequestFactory());
|
|
33
|
+
__classPrivateFieldSet(this, _GraphQLDeviceManager_sdk, sdk, "f");
|
|
34
|
+
__classPrivateFieldSet(this, _GraphQLDeviceManager_logger, loggerProvider.getLogger("GraphQLDeviceManager"), "f");
|
|
35
|
+
}
|
|
36
|
+
registerDevice(request) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
const validationResult = this.validateRequest(request);
|
|
39
|
+
if (validationResult.failure()) {
|
|
40
|
+
return validationResult.intoFailure();
|
|
41
|
+
}
|
|
42
|
+
const inputVariables = __classPrivateFieldGet(this, _GraphQLDeviceManager_registerDeviceRequestFactory, "f").create(request);
|
|
43
|
+
__classPrivateFieldGet(this, _GraphQLDeviceManager_logger, "f").verbose("calling updateDeviceRegistration to register device...");
|
|
44
|
+
const result = yield this.handleTransaction(__classPrivateFieldGet(this, _GraphQLDeviceManager_sdk, "f").updateDeviceRegistration(inputVariables));
|
|
45
|
+
__classPrivateFieldGet(this, _GraphQLDeviceManager_logger, "f").verbose("updateDeviceRegistration complete for registration.");
|
|
46
|
+
if (result.failure()) {
|
|
47
|
+
__classPrivateFieldGet(this, _GraphQLDeviceManager_logger, "f").error("updateDeviceRegistration failed", result);
|
|
48
|
+
return result.intoFailure();
|
|
49
|
+
}
|
|
50
|
+
__classPrivateFieldGet(this, _GraphQLDeviceManager_logger, "f").info("successfully called updateDeviceRegistration for registration.");
|
|
51
|
+
return BWellTransactionResult.success(result.data()
|
|
52
|
+
.updateDeviceRegistration);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
deregisterDevice(request) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
const validationResult = this.validateRequest(request);
|
|
58
|
+
if (validationResult.failure()) {
|
|
59
|
+
return validationResult.intoFailure();
|
|
60
|
+
}
|
|
61
|
+
__classPrivateFieldGet(this, _GraphQLDeviceManager_logger, "f").verbose("calling updateDeviceRegistration to deregister device...");
|
|
62
|
+
const inputVariables = __classPrivateFieldGet(this, _GraphQLDeviceManager_deregisterDeviceRequestFactory, "f").create(request);
|
|
63
|
+
const result = yield this.handleTransaction(__classPrivateFieldGet(this, _GraphQLDeviceManager_sdk, "f").updateDeviceRegistration(inputVariables));
|
|
64
|
+
__classPrivateFieldGet(this, _GraphQLDeviceManager_logger, "f").verbose("updateDeviceRegistration complete for deregistration.");
|
|
65
|
+
if (result.failure()) {
|
|
66
|
+
__classPrivateFieldGet(this, _GraphQLDeviceManager_logger, "f").error("updateDeviceRegistration failed", result);
|
|
67
|
+
return result.intoFailure();
|
|
68
|
+
}
|
|
69
|
+
__classPrivateFieldGet(this, _GraphQLDeviceManager_logger, "f").info("successfully called updateDeviceRegistration for deregistration.");
|
|
70
|
+
return BWellTransactionResult.success(result.data()
|
|
71
|
+
.updateDeviceRegistration);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
_GraphQLDeviceManager_sdk = new WeakMap(), _GraphQLDeviceManager_logger = new WeakMap(), _GraphQLDeviceManager_deregisterDeviceRequestFactory = new WeakMap(), _GraphQLDeviceManager_registerDeviceRequestFactory = new WeakMap();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./graphql-device-manager.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./graphql-device-manager.js";
|
|
@@ -4,13 +4,14 @@ import type { LoggerProvider } from "../../logger/index.js";
|
|
|
4
4
|
import type { ApiProvider } from "../base/api-provider.js";
|
|
5
5
|
import { HealthManager } from "../base/health-data/index.js";
|
|
6
6
|
import { IdentityManager } from "../base/identity/index.js";
|
|
7
|
-
import { ConnectionManager, HealthSpaceManager, QuestionnaireManager, SearchManager, UserManager } from "../base/index.js";
|
|
7
|
+
import { ConnectionManager, DeviceManager, HealthSpaceManager, QuestionnaireManager, SearchManager, UserManager } from "../base/index.js";
|
|
8
8
|
import type { GraphQLSdk } from "./graphql-sdk/index.js";
|
|
9
9
|
export declare class GraphQLApiProvider implements ApiProvider {
|
|
10
10
|
#private;
|
|
11
11
|
readonly health: HealthManager;
|
|
12
12
|
readonly healthSpace: HealthSpaceManager;
|
|
13
13
|
readonly user: UserManager;
|
|
14
|
+
readonly device: DeviceManager;
|
|
14
15
|
readonly connection: ConnectionManager;
|
|
15
16
|
readonly search: SearchManager;
|
|
16
17
|
readonly questionnaire: QuestionnaireManager;
|
|
@@ -12,6 +12,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
12
12
|
var _GraphQLApiProvider_logger, _GraphQLApiProvider_graphqlSDK;
|
|
13
13
|
import { BwellSdkLanguageManager, } from "../../language/language-manager.js";
|
|
14
14
|
import { GraphQLConnectionManager } from "./connection/index.js";
|
|
15
|
+
import { GraphQLDeviceManager } from "./device/index.js";
|
|
15
16
|
import { GraphQLHealthSpaceManager } from "./health-space/index.js";
|
|
16
17
|
import { GraphQLHealthManager } from "./healthdata/index.js";
|
|
17
18
|
import { GraphQLIdentityManager } from "./identity/index.js";
|
|
@@ -30,7 +31,7 @@ export class GraphQLApiProvider {
|
|
|
30
31
|
// loggerProvider,
|
|
31
32
|
// );
|
|
32
33
|
this.connection = new GraphQLConnectionManager(__classPrivateFieldGet(this, _GraphQLApiProvider_graphqlSDK, "f"), loggerProvider);
|
|
33
|
-
|
|
34
|
+
this.device = new GraphQLDeviceManager(__classPrivateFieldGet(this, _GraphQLApiProvider_graphqlSDK, "f"), loggerProvider);
|
|
34
35
|
// this.event = new GraphQLEventManager(this.#graphqlSDK, loggerProvider);
|
|
35
36
|
this.health = new GraphQLHealthManager(__classPrivateFieldGet(this, _GraphQLApiProvider_graphqlSDK, "f"), loggerProvider);
|
|
36
37
|
this.healthSpace = new GraphQLHealthSpaceManager(__classPrivateFieldGet(this, _GraphQLApiProvider_graphqlSDK, "f"), loggerProvider);
|
|
@@ -3,7 +3,7 @@ import { HealthManager } from "../api/base/health-data/index.js";
|
|
|
3
3
|
import { type Credentials } from "../auth/index.js";
|
|
4
4
|
import { type BWellConfig } from "../config/index.js";
|
|
5
5
|
import { BWellError, type AuthenticationError, type InvalidClientKeyError, type InvalidTokenError, type OperationOutcomeError } from "../errors/index.js";
|
|
6
|
-
import { ConnectionManager, HealthSpaceManager, QuestionnaireManager, SearchManager, UserManager } from "../index.js";
|
|
6
|
+
import { ConnectionManager, DeviceManager, HealthSpaceManager, QuestionnaireManager, SearchManager, UserManager } from "../index.js";
|
|
7
7
|
import { type LanguageManager } from "../language/index.js";
|
|
8
8
|
import { AuthTokens, CreateGuestAccessTokenResults } from "../models/identity/index.js";
|
|
9
9
|
import { BWellTransactionResult } from "../results/index.js";
|
|
@@ -324,6 +324,14 @@ export declare class BWellSDK {
|
|
|
324
324
|
* @category Managers
|
|
325
325
|
*/
|
|
326
326
|
get connection(): ConnectionManager;
|
|
327
|
+
/**
|
|
328
|
+
* Device manager for push notification registration and device management.
|
|
329
|
+
*
|
|
330
|
+
* @see {@link DeviceManager} - Complete device management operations and examples
|
|
331
|
+
* @returns {DeviceManager} The device manager instance
|
|
332
|
+
* @category Managers
|
|
333
|
+
*/
|
|
334
|
+
get device(): DeviceManager;
|
|
327
335
|
/**
|
|
328
336
|
* Search manager for healthcare provider and resource discovery.
|
|
329
337
|
*
|
|
@@ -462,9 +462,16 @@ export class BWellSDK {
|
|
|
462
462
|
// public get activity(): ActivityManager {
|
|
463
463
|
// return this.#getApiProvider().activity;
|
|
464
464
|
// }
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
465
|
+
/**
|
|
466
|
+
* Device manager for push notification registration and device management.
|
|
467
|
+
*
|
|
468
|
+
* @see {@link DeviceManager} - Complete device management operations and examples
|
|
469
|
+
* @returns {DeviceManager} The device manager instance
|
|
470
|
+
* @category Managers
|
|
471
|
+
*/
|
|
472
|
+
get device() {
|
|
473
|
+
return __classPrivateFieldGet(this, _BWellSDK_instances, "m", _BWellSDK_getApiProvider).call(this).device;
|
|
474
|
+
}
|
|
468
475
|
// public get event(): EventManager {
|
|
469
476
|
// return this.#getApiProvider().event;
|
|
470
477
|
// }
|
|
@@ -43,6 +43,7 @@ export declare const DisconnectConnectionDocument = "\n mutation disconnectCo
|
|
|
43
43
|
export declare const GetDataSourceDocument = "\n query getDataSource($connectionId: String!) {\n getDataSource(connectionId: $connectionId) {\n id\n name\n category\n type\n }\n}\n ";
|
|
44
44
|
export declare const GetMemberConnectionsDocument = "\n query getMemberConnections {\n subscriptions(_source: {value: \"https://icanbwell.com/proa\"}) {\n entry {\n resource {\n id\n meta {\n source\n }\n subscriptionStatus {\n error {\n ...CodeableConceptFields\n }\n extension {\n id\n url\n valueString\n }\n }\n }\n }\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 ";
|
|
45
45
|
export declare const GetOauthUrlDocument = "\n query getOauthUrl($connectionId: String!) {\n getOauthUrl(connectionId: $connectionId) {\n redirectUrl\n }\n}\n ";
|
|
46
|
+
export declare const UpdateDeviceRegistrationDocument = "\n mutation updateDeviceRegistration($deviceToken: String!, $platformName: String!, $applicationName: String!, $notificationPreference: Boolean!) {\n updateDeviceRegistration(\n input: {deviceToken: $deviceToken, platform: $platformName, applicationName: $applicationName, notificationPreference: $notificationPreference}\n ) {\n id\n }\n}\n ";
|
|
46
47
|
export declare const GetAllergyIntoleranceGroupsDocument = "\n query getAllergyIntoleranceGroups($request: AllergyIntoleranceGroupQueryRequest) {\n getAllergyIntoleranceGroups(request: $request) {\n paging_info {\n ...PagingFields\n }\n resources {\n id\n name\n coding {\n ...CodingFields\n }\n references\n criticality {\n code\n display\n }\n recordedDate\n source\n sourceDisplay\n }\n }\n}\n \n fragment PagingFields on PagingResults {\n page_number\n page_size\n total_pages\n total_items\n}\n \n\n fragment CodingFields on Coding {\n id\n system\n code\n display\n}\n ";
|
|
47
48
|
export declare const GetAllergyIntolerancesDocument = "\n query getAllergyIntolerances($page: Int, $pageSize: Int, $code: SearchToken, $lastUpdated: SearchDate) {\n allergyIntolerances(\n _count: $pageSize\n _getpagesoffset: $page\n code: $code\n _lastUpdated: $lastUpdated\n ) {\n id\n entry {\n id\n resource {\n id\n meta {\n ...MetaFields\n }\n resourceType\n category\n code {\n id\n text\n coding {\n id\n system\n display\n code\n }\n }\n criticality\n onsetDateTime\n onsetPeriod {\n start\n end\n }\n text {\n ...NarrativeFields\n }\n type\n recorder {\n id\n reference\n type\n resource {\n ... on Practitioner {\n ...PractitionerFields\n }\n }\n }\n lastOccurrence\n reaction {\n ...ReactionFields\n }\n recordedDate\n note {\n authorString\n time\n text\n }\n verificationStatus {\n ...CodeableConceptFields\n }\n clinicalStatus {\n ...CodeableConceptFields\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 NarrativeFields on Narrative {\n div\n status\n}\n \n\n fragment PractitionerFields on Practitioner {\n id\n name {\n ...HumanNameFields\n }\n identifier {\n ...IdentifierFields\n }\n}\n \n fragment HumanNameFields on HumanName {\n text\n family\n given\n prefix\n suffix\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 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 \n\n fragment ReactionFields on AllergyIntoleranceReaction {\n id\n onset\n severity\n description\n manifestation {\n ...CodeableConceptFields\n }\n note {\n id\n authorString\n time\n text\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 \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 ";
|
|
48
49
|
export declare const GetCarePlanGroupsDocument = "\n query getCarePlanGroups($request: CarePlanGroupQueryRequest) {\n getCarePlanGroups(request: $request) {\n paging_info {\n ...PagingFields\n }\n resources {\n id\n name\n references\n coding {\n ...CodingFields\n }\n source\n period {\n ...PeriodFields\n }\n sourceDisplay\n }\n }\n}\n \n fragment PagingFields on PagingResults {\n page_number\n page_size\n total_pages\n total_items\n}\n \n\n fragment CodingFields on Coding {\n id\n system\n code\n display\n}\n \n\n fragment PeriodFields on Period {\n start\n end\n}\n ";
|
|
@@ -117,6 +118,13 @@ export declare function getSdk(client: GraphQLClient, withWrapper?: SdkFunctionW
|
|
|
117
118
|
headers: Headers;
|
|
118
119
|
status: number;
|
|
119
120
|
}>;
|
|
121
|
+
updateDeviceRegistration(variables: Types.UpdateDeviceRegistrationMutationVariables, requestHeaders?: GraphQLClientRequestHeaders): Promise<{
|
|
122
|
+
data: Types.UpdateDeviceRegistrationMutationResults;
|
|
123
|
+
errors?: GraphQLError[];
|
|
124
|
+
extensions?: any;
|
|
125
|
+
headers: Headers;
|
|
126
|
+
status: number;
|
|
127
|
+
}>;
|
|
120
128
|
getAllergyIntoleranceGroups(variables?: Types.GetAllergyIntoleranceGroupsQueryVariables, requestHeaders?: GraphQLClientRequestHeaders): Promise<{
|
|
121
129
|
data: Types.GetAllergyIntoleranceGroupsQueryResults;
|
|
122
130
|
errors?: GraphQLError[];
|
|
@@ -576,6 +576,15 @@ export const GetOauthUrlDocument = `
|
|
|
576
576
|
}
|
|
577
577
|
}
|
|
578
578
|
`;
|
|
579
|
+
export const UpdateDeviceRegistrationDocument = `
|
|
580
|
+
mutation updateDeviceRegistration($deviceToken: String!, $platformName: String!, $applicationName: String!, $notificationPreference: Boolean!) {
|
|
581
|
+
updateDeviceRegistration(
|
|
582
|
+
input: {deviceToken: $deviceToken, platform: $platformName, applicationName: $applicationName, notificationPreference: $notificationPreference}
|
|
583
|
+
) {
|
|
584
|
+
id
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
`;
|
|
579
588
|
export const GetAllergyIntoleranceGroupsDocument = `
|
|
580
589
|
query getAllergyIntoleranceGroups($request: AllergyIntoleranceGroupQueryRequest) {
|
|
581
590
|
getAllergyIntoleranceGroups(request: $request) {
|
|
@@ -1411,6 +1420,9 @@ export function getSdk(client, withWrapper = defaultWrapper) {
|
|
|
1411
1420
|
getOauthUrl(variables, requestHeaders) {
|
|
1412
1421
|
return withWrapper((wrappedRequestHeaders) => client.rawRequest(GetOauthUrlDocument, variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'getOauthUrl', 'query', variables);
|
|
1413
1422
|
},
|
|
1423
|
+
updateDeviceRegistration(variables, requestHeaders) {
|
|
1424
|
+
return withWrapper((wrappedRequestHeaders) => client.rawRequest(UpdateDeviceRegistrationDocument, variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'updateDeviceRegistration', 'mutation', variables);
|
|
1425
|
+
},
|
|
1414
1426
|
getAllergyIntoleranceGroups(variables, requestHeaders) {
|
|
1415
1427
|
return withWrapper((wrappedRequestHeaders) => client.rawRequest(GetAllergyIntoleranceGroupsDocument, variables, Object.assign(Object.assign({}, requestHeaders), wrappedRequestHeaders)), 'getAllergyIntoleranceGroups', 'query', variables);
|
|
1416
1428
|
},
|
|
@@ -2340,6 +2340,17 @@ export type GetOauthUrlQueryResults = {
|
|
|
2340
2340
|
redirectUrl: string;
|
|
2341
2341
|
};
|
|
2342
2342
|
};
|
|
2343
|
+
export type UpdateDeviceRegistrationMutationVariables = Types.Exact<{
|
|
2344
|
+
deviceToken: Types.Scalars['String']['input'];
|
|
2345
|
+
platformName: Types.Scalars['String']['input'];
|
|
2346
|
+
applicationName: Types.Scalars['String']['input'];
|
|
2347
|
+
notificationPreference: Types.Scalars['Boolean']['input'];
|
|
2348
|
+
}>;
|
|
2349
|
+
export type UpdateDeviceRegistrationMutationResults = {
|
|
2350
|
+
updateDeviceRegistration: {
|
|
2351
|
+
id: string;
|
|
2352
|
+
} | null;
|
|
2353
|
+
};
|
|
2343
2354
|
export type GetAllergyIntoleranceGroupsQueryVariables = Types.Exact<{
|
|
2344
2355
|
request: Types.InputMaybe<Types.AllergyIntoleranceGroupQueryRequest>;
|
|
2345
2356
|
}>;
|
package/dist/graphql/schema.d.ts
CHANGED
|
@@ -43471,6 +43471,7 @@ export type Mutation = {
|
|
|
43471
43471
|
/** Create a connection */
|
|
43472
43472
|
createConnection: Connection;
|
|
43473
43473
|
createConsent?: Maybe<Consent>;
|
|
43474
|
+
createDataExportDirectDownloadUrl?: Maybe<Scalars['String']['output']>;
|
|
43474
43475
|
createGuestAccessToken: GuestAccessToken;
|
|
43475
43476
|
createVerificationUrl: Scalars['String']['output'];
|
|
43476
43477
|
/**
|
|
@@ -43695,6 +43696,10 @@ export type MutationCreateConnectionArgs = {
|
|
|
43695
43696
|
export type MutationCreateConsentArgs = {
|
|
43696
43697
|
consentInput: ConsentInput;
|
|
43697
43698
|
};
|
|
43699
|
+
export type MutationCreateDataExportDirectDownloadUrlArgs = {
|
|
43700
|
+
exportId: Scalars['String']['input'];
|
|
43701
|
+
password: Scalars['String']['input'];
|
|
43702
|
+
};
|
|
43698
43703
|
export type MutationCreateGuestAccessTokenArgs = {
|
|
43699
43704
|
clientKey: Scalars['String']['input'];
|
|
43700
43705
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ export { BWellConfig } from "./config/index.js";
|
|
|
3
3
|
export { TokenStorage, InMemoryTokenStorage } from "./tokens/token-storage.js";
|
|
4
4
|
export { BWellQueryResult } from "./results/bwell-query-result.js";
|
|
5
5
|
export { BWellTransactionResult, BWellTransactionFailure, BWellTransactionSuccess, } from "./results/bwell-transaction-result.js";
|
|
6
|
+
export * from "./requests/index.js";
|
|
6
7
|
export * from "./api/index.js";
|
|
7
8
|
export * from "./errors/index.js";
|
|
8
|
-
export * from "./requests/index.js";
|
|
9
9
|
export * from "./language/index.js";
|
|
10
10
|
export * from "./models/index.js";
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@ export { BWellSDK } from "./bwell-sdk/bwell-sdk.js";
|
|
|
2
2
|
export { InMemoryTokenStorage } from "./tokens/token-storage.js";
|
|
3
3
|
export { BWellQueryResult } from "./results/bwell-query-result.js";
|
|
4
4
|
export { BWellTransactionResult, BWellTransactionFailure, BWellTransactionSuccess, } from "./results/bwell-transaction-result.js";
|
|
5
|
+
export * from "./requests/index.js";
|
|
5
6
|
export * from "./api/index.js";
|
|
6
7
|
export * from "./errors/index.js";
|
|
7
|
-
export * from "./requests/index.js";
|
|
8
8
|
export * from "./language/index.js";
|
|
9
9
|
export * from "./models/index.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum representing the mobile device platforms.
|
|
3
|
+
* Ex: For push notification registration.
|
|
4
|
+
*
|
|
5
|
+
* @category Enums
|
|
6
|
+
* @title DevicePlatform
|
|
7
|
+
* @excerpt DevicePlatform enum representing the mobile device platforms.
|
|
8
|
+
*/
|
|
9
|
+
export type DevicePlatform = "IOS" | "ANDROID";
|
|
10
|
+
/** @internal */
|
|
11
|
+
export declare const devicePlatformValues: readonly ["IOS", "ANDROID"];
|
|
@@ -10,4 +10,7 @@ export { LogLevel } from "./log-level.js";
|
|
|
10
10
|
export { Gender } from "./gender.js";
|
|
11
11
|
export { FilterField } from "./filter-field.js";
|
|
12
12
|
export { SearchResultType } from "./search-result-type.js";
|
|
13
|
+
export { SortField } from "./sort-field.js";
|
|
14
|
+
export { SortOrder } from "./sort-order.js";
|
|
13
15
|
export { EndpointStatus } from "./endpoint-status.js";
|
|
16
|
+
export { DevicePlatform, devicePlatformValues } from "./device-platform.js";
|
|
@@ -2,3 +2,4 @@ export { personGenderValues } from "./person-gender.js";
|
|
|
2
2
|
export { consentStatusValues } from "./consent-status.js";
|
|
3
3
|
export { categoryCodeValues } from "./category-code.js";
|
|
4
4
|
export { consentProvisionTypeValues, } from "./consent-provision-type.js";
|
|
5
|
+
export { devicePlatformValues } from "./device-platform.js";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sort field options for health resource searches.
|
|
3
|
+
* Defines the available fields that can be used to sort search results.
|
|
4
|
+
*
|
|
5
|
+
* @experimental
|
|
6
|
+
* @category Enums
|
|
7
|
+
* @title SortField
|
|
8
|
+
* @excerpt Available sort fields for health resource searches
|
|
9
|
+
*/
|
|
10
|
+
export type SortField = "content" | "distance" | "relevance";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sort order options for health resource searches.
|
|
3
|
+
* Defines the direction in which search results should be sorted.
|
|
4
|
+
*
|
|
5
|
+
* @category Enums
|
|
6
|
+
* @title SortOrder
|
|
7
|
+
* @excerpt Available sort orders for health resource searches
|
|
8
|
+
*/
|
|
9
|
+
export type SortOrder = "asc" | "desc";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/models/index.d.ts
CHANGED
package/dist/models/index.js
CHANGED