@ovok/core 0.4.59-dev.562 → 0.4.59-dev.563
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/client/platform/types.d.ts +1 -1
- package/dist/client/platform/types.js +1 -0
- package/dist/conformance/capability-requirements.js +1 -1
- package/dist/next/index.d.ts +6 -0
- package/dist/next/ovok.d.ts +6 -0
- package/dist/next/ovok.js +4 -0
- package/dist/next/resources/omnichannel-alerts/notifications-rules-resource.d.ts +35 -0
- package/dist/next/resources/omnichannel-alerts/notifications-rules-resource.js +27 -0
- package/dist/next/resources/omnichannel-alerts/omnichannel-alerts-resource.d.ts +88 -0
- package/dist/next/resources/omnichannel-alerts/omnichannel-alerts-resource.js +23 -0
- package/dist/next/resources/push/push-devices-resource.d.ts +60 -0
- package/dist/next/resources/push/push-devices-resource.js +28 -0
- package/dist/next/resources/push/push-provider-resource.d.ts +129 -0
- package/dist/next/resources/push/push-provider-resource.js +31 -0
- package/dist/next/resources/push/push-resource.d.ts +15 -0
- package/dist/next/resources/push/push-resource.js +19 -0
- package/package.json +1 -1
|
@@ -158,7 +158,7 @@ export type OvokProjectFeaturesUpdate = {
|
|
|
158
158
|
*
|
|
159
159
|
* @category projects
|
|
160
160
|
*/
|
|
161
|
-
export declare const OVOK_PROJECT_SETTING_KEYS: readonly ["CONTENT_ENABLED", "MAILING_ENABLED", "PATIENT_INVITATION_ENABLED", "PATIENT_REGISTRATION_ENABLED", "PATIENT_LOGIN_ENABLED", "PRACTITIONER_INVITATION_ENABLED", "PRACTITIONER_REGISTRATION_ENABLED", "PRACTITIONER_LOGIN_ENABLED", "CLINICIAN_INVITE_ON_BUSINESS_EMAIL"];
|
|
161
|
+
export declare const OVOK_PROJECT_SETTING_KEYS: readonly ["CONTENT_ENABLED", "MAILING_ENABLED", "PATIENT_INVITATION_ENABLED", "PATIENT_REGISTRATION_ENABLED", "PATIENT_LOGIN_ENABLED", "PRACTITIONER_INVITATION_ENABLED", "PRACTITIONER_REGISTRATION_ENABLED", "PRACTITIONER_LOGIN_ENABLED", "CLINICIAN_INVITE_ON_BUSINESS_EMAIL", "OMNICHANNEL_ALERTS_ENABLED"];
|
|
162
162
|
/**
|
|
163
163
|
* A boolean project setting key.
|
|
164
164
|
*
|
|
@@ -26,7 +26,7 @@ exports.OVOK_CORE_REQUIREMENTS = {
|
|
|
26
26
|
description: "The FHIR surface a server must provide for the @ovok/core client library's own methods to function.",
|
|
27
27
|
software: {
|
|
28
28
|
name: "@ovok/core",
|
|
29
|
-
version: "0.4.59-dev.
|
|
29
|
+
version: "0.4.59-dev.563+fdd295b",
|
|
30
30
|
},
|
|
31
31
|
fhirVersion: "4.0.1",
|
|
32
32
|
format: ["json"],
|
package/dist/next/index.d.ts
CHANGED
|
@@ -49,6 +49,10 @@ export type { ActiveCallNotification } from "./resources/video-calls/video-calls
|
|
|
49
49
|
export type { CmsListParams, CmsReadParams } from "./resources/cms/cms-delivery";
|
|
50
50
|
export type { DeletedDocument, DocumentDownloadParams } from "./resources/documents/documents-resource";
|
|
51
51
|
export type { BotInput, BotOutput } from "./resources/bots/bots-resource";
|
|
52
|
+
export type { PushDevice, PushDeviceList, PushPlatform, RegisterPushDeviceRequest, } from "./resources/push/push-devices-resource";
|
|
53
|
+
export type { ApnsEnvironment, ApnsPushProvider, ApnsPushProviderChange, CreatePushProviderRequest, ExpoPushProvider, FcmPushProvider, PushProviderName, PushProviderSettings, RelayPushProvider, UpdatePushProviderRequest, } from "./resources/push/push-provider-resource";
|
|
54
|
+
export type { NotificationsRule, NotificationsRuleResponse } from "./resources/omnichannel-alerts/notifications-rules-resource";
|
|
55
|
+
export type { NotificationsPreviewAlert, NotificationsPreviewRecipient, NotificationsPreviewRequest, NotificationsPreviewResponse, NotificationsPreviewStep, } from "./resources/omnichannel-alerts/omnichannel-alerts-resource";
|
|
52
56
|
export type * from "./resources/slim/slim-queries";
|
|
53
57
|
export type { AccountsResource } from "./resources/accounts/accounts-resource";
|
|
54
58
|
export type { AiResource } from "./resources/ai/ai-resource";
|
|
@@ -66,9 +70,11 @@ export type { InvitesResource } from "./resources/invites/invites-resource";
|
|
|
66
70
|
export type { LocalesResource } from "./resources/localization/locales-resource";
|
|
67
71
|
export type { LocalizationsResource } from "./resources/localization/localizations-resource";
|
|
68
72
|
export type { MeasurementsResource } from "./resources/measurements/measurements-resource";
|
|
73
|
+
export type { OmnichannelAlertsResource } from "./resources/omnichannel-alerts/omnichannel-alerts-resource";
|
|
69
74
|
export type { OutboxResource } from "./outbox/outbox-resource";
|
|
70
75
|
export type { PatientResource } from "./resources/patient/patient-resource";
|
|
71
76
|
export type { ProjectsResource } from "./resources/projects/projects-resource";
|
|
77
|
+
export type { PushResource } from "./resources/push/push-resource";
|
|
72
78
|
export type { QuestionnaireResponsesResource, QuestionnairesResource, } from "./resources/questionnaires/questionnaires-resource";
|
|
73
79
|
export type { SharingResource } from "./resources/sharing/sharing-resource";
|
|
74
80
|
export type { SavedAccountsResource } from "./resources/session/saved-accounts-resource";
|
package/dist/next/ovok.d.ts
CHANGED
|
@@ -15,8 +15,10 @@ import { InvitesResource } from "./resources/invites/invites-resource";
|
|
|
15
15
|
import { LocalesResource } from "./resources/localization/locales-resource";
|
|
16
16
|
import { LocalizationsResource } from "./resources/localization/localizations-resource";
|
|
17
17
|
import { MeasurementsResource } from "./resources/measurements/measurements-resource";
|
|
18
|
+
import { OmnichannelAlertsResource } from "./resources/omnichannel-alerts/omnichannel-alerts-resource";
|
|
18
19
|
import { PatientResource } from "./resources/patient/patient-resource";
|
|
19
20
|
import { ProjectsResource } from "./resources/projects/projects-resource";
|
|
21
|
+
import { PushResource } from "./resources/push/push-resource";
|
|
20
22
|
import { QuestionnaireResponsesResource, QuestionnairesResource } from "./resources/questionnaires/questionnaires-resource";
|
|
21
23
|
import { RealtimeResource } from "./resources/realtime/realtime-resource";
|
|
22
24
|
import { SessionResource } from "./resources/session/session-resource";
|
|
@@ -85,5 +87,9 @@ export declare class Ovok {
|
|
|
85
87
|
readonly email: EmailResource;
|
|
86
88
|
/** Bot execution. */
|
|
87
89
|
readonly bots: BotsResource;
|
|
90
|
+
/** Push devices and the project's push provider. */
|
|
91
|
+
readonly push: PushResource;
|
|
92
|
+
/** The rule that decides who hears of each Signals alert, and its preview. */
|
|
93
|
+
readonly omnichannelAlerts: OmnichannelAlertsResource;
|
|
88
94
|
constructor(config: OvokConfig);
|
|
89
95
|
}
|
package/dist/next/ovok.js
CHANGED
|
@@ -25,8 +25,10 @@ const locales_resource_1 = require("./resources/localization/locales-resource");
|
|
|
25
25
|
const localizations_resource_1 = require("./resources/localization/localizations-resource");
|
|
26
26
|
const measurements_resource_1 = require("./resources/measurements/measurements-resource");
|
|
27
27
|
const offline_measurement_queue_1 = require("./resources/measurements/offline-measurement-queue");
|
|
28
|
+
const omnichannel_alerts_resource_1 = require("./resources/omnichannel-alerts/omnichannel-alerts-resource");
|
|
28
29
|
const patient_resource_1 = require("./resources/patient/patient-resource");
|
|
29
30
|
const projects_resource_1 = require("./resources/projects/projects-resource");
|
|
31
|
+
const push_resource_1 = require("./resources/push/push-resource");
|
|
30
32
|
const questionnaires_resource_1 = require("./resources/questionnaires/questionnaires-resource");
|
|
31
33
|
const realtime_resource_1 = require("./resources/realtime/realtime-resource");
|
|
32
34
|
const session_resource_1 = require("./resources/session/session-resource");
|
|
@@ -90,6 +92,8 @@ class Ovok {
|
|
|
90
92
|
this.wearables = new wearables_resource_1.WearablesResource(http);
|
|
91
93
|
this.email = new email_resource_1.EmailResource(http);
|
|
92
94
|
this.bots = new bots_resource_1.BotsResource(http);
|
|
95
|
+
this.push = new push_resource_1.PushResource(http);
|
|
96
|
+
this.omnichannelAlerts = new omnichannel_alerts_resource_1.OmnichannelAlertsResource(http);
|
|
93
97
|
}
|
|
94
98
|
}
|
|
95
99
|
exports.Ovok = Ovok;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { HttpClient } from "../../http/http-client";
|
|
2
|
+
import { RequestOptions } from "../../http/transmit";
|
|
3
|
+
/**
|
|
4
|
+
* The project's alert notifications rule, as Signals runs it. `logic` is JSON Logic that answers the `notify` steps.
|
|
5
|
+
*
|
|
6
|
+
* @category omnichannelAlerts
|
|
7
|
+
*/
|
|
8
|
+
export type NotificationsRule = {
|
|
9
|
+
/** The JSON Logic rule, passed through as it is. */
|
|
10
|
+
logic: unknown;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The project's alert notifications rule.
|
|
14
|
+
*
|
|
15
|
+
* @category omnichannelAlerts
|
|
16
|
+
*/
|
|
17
|
+
export type NotificationsRuleResponse = {
|
|
18
|
+
/** The rule Signals runs for the project, or null when it has none and nobody is told. */
|
|
19
|
+
notifications: Record<string, unknown> | null;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* The project's alert notifications rule. For project admins.
|
|
23
|
+
*
|
|
24
|
+
* @category omnichannelAlerts
|
|
25
|
+
*/
|
|
26
|
+
export declare class NotificationsRulesResource {
|
|
27
|
+
private readonly omnichannelAlerts;
|
|
28
|
+
constructor(omnichannelAlerts: HttpClient);
|
|
29
|
+
/** Reads the rule. Calls `GET v1/omnichannel-alerts/rules`. */
|
|
30
|
+
retrieve(options?: RequestOptions): Promise<NotificationsRuleResponse>;
|
|
31
|
+
/** Sets the rule; Ovok checks its channels and recipients, then Signals checks its steps. Calls `PUT v1/omnichannel-alerts/rules`. */
|
|
32
|
+
update(rule: NotificationsRule, options?: RequestOptions): Promise<NotificationsRuleResponse>;
|
|
33
|
+
/** Removes the rule, so nobody is told of a new alert. Calls `DELETE v1/omnichannel-alerts/rules`. */
|
|
34
|
+
remove(options?: RequestOptions): Promise<void>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotificationsRulesResource = void 0;
|
|
4
|
+
const RULES_PATH = "rules";
|
|
5
|
+
/**
|
|
6
|
+
* The project's alert notifications rule. For project admins.
|
|
7
|
+
*
|
|
8
|
+
* @category omnichannelAlerts
|
|
9
|
+
*/
|
|
10
|
+
class NotificationsRulesResource {
|
|
11
|
+
constructor(omnichannelAlerts) {
|
|
12
|
+
this.omnichannelAlerts = omnichannelAlerts;
|
|
13
|
+
}
|
|
14
|
+
/** Reads the rule. Calls `GET v1/omnichannel-alerts/rules`. */
|
|
15
|
+
retrieve(options) {
|
|
16
|
+
return this.omnichannelAlerts.get(RULES_PATH, options);
|
|
17
|
+
}
|
|
18
|
+
/** Sets the rule; Ovok checks its channels and recipients, then Signals checks its steps. Calls `PUT v1/omnichannel-alerts/rules`. */
|
|
19
|
+
update(rule, options) {
|
|
20
|
+
return this.omnichannelAlerts.put(RULES_PATH, rule, options);
|
|
21
|
+
}
|
|
22
|
+
/** Removes the rule, so nobody is told of a new alert. Calls `DELETE v1/omnichannel-alerts/rules`. */
|
|
23
|
+
remove(options) {
|
|
24
|
+
return this.omnichannelAlerts.delete(RULES_PATH, options);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.NotificationsRulesResource = NotificationsRulesResource;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { HttpClient } from "../../http/http-client";
|
|
2
|
+
import { RequestOptions } from "../../http/transmit";
|
|
3
|
+
import { NotificationsRule, NotificationsRulesResource } from "./notifications-rules-resource";
|
|
4
|
+
/**
|
|
5
|
+
* A sample alert to preview the rule against.
|
|
6
|
+
*
|
|
7
|
+
* @category omnichannelAlerts
|
|
8
|
+
*/
|
|
9
|
+
export type NotificationsPreviewAlert = {
|
|
10
|
+
/** Why the alert fired; `trigger` when omitted. */
|
|
11
|
+
reason?: "trigger" | "empty" | "note" | "inactive";
|
|
12
|
+
/** The alert code, such as a LOINC code. */
|
|
13
|
+
code?: string;
|
|
14
|
+
/** The alert variant, such as `high`. */
|
|
15
|
+
variant?: string;
|
|
16
|
+
/** The alert message. */
|
|
17
|
+
message?: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Request body for previewing who an alert's notifications reach.
|
|
21
|
+
*
|
|
22
|
+
* @category omnichannelAlerts
|
|
23
|
+
*/
|
|
24
|
+
export type NotificationsPreviewRequest = {
|
|
25
|
+
/** The FHIR Patient id whose people are resolved. */
|
|
26
|
+
patientId: string;
|
|
27
|
+
/** The sample alert. */
|
|
28
|
+
alert?: NotificationsPreviewAlert;
|
|
29
|
+
/** The rule to try, instead of the project's own. */
|
|
30
|
+
notifications?: NotificationsRule;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* A person a preview step reaches.
|
|
34
|
+
*
|
|
35
|
+
* @category omnichannelAlerts
|
|
36
|
+
*/
|
|
37
|
+
export type NotificationsPreviewRecipient = {
|
|
38
|
+
/** The person's FHIR reference, such as `Practitioner/123`. */
|
|
39
|
+
reference: string;
|
|
40
|
+
/** The person's name. */
|
|
41
|
+
display: string;
|
|
42
|
+
/** Whether the person has an email address on file. */
|
|
43
|
+
email: boolean;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* One step the rule plans, and the people it reaches.
|
|
47
|
+
*
|
|
48
|
+
* @category omnichannelAlerts
|
|
49
|
+
*/
|
|
50
|
+
export type NotificationsPreviewStep = {
|
|
51
|
+
/** The step number, from 0. */
|
|
52
|
+
step: number;
|
|
53
|
+
/** Minutes after the alert fired. */
|
|
54
|
+
after: number;
|
|
55
|
+
/** The channels the step names. */
|
|
56
|
+
channels: string[];
|
|
57
|
+
/** The recipient roles the step names. */
|
|
58
|
+
to: string[];
|
|
59
|
+
/** The people the roles resolve to. */
|
|
60
|
+
recipients: NotificationsPreviewRecipient[];
|
|
61
|
+
/** Channels Ovok does not tell over. */
|
|
62
|
+
unknownChannels: string[];
|
|
63
|
+
/** Recipient roles Ovok does not resolve. */
|
|
64
|
+
unknownRoles: string[];
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Each step the rule plans for a sample alert. Nothing is sent.
|
|
68
|
+
*
|
|
69
|
+
* @category omnichannelAlerts
|
|
70
|
+
*/
|
|
71
|
+
export type NotificationsPreviewResponse = {
|
|
72
|
+
/** The planned steps. */
|
|
73
|
+
steps: NotificationsPreviewStep[];
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Omni-channel alerts: Signals generates each alert's notification steps from the project's rule, and Ovok delivers
|
|
77
|
+
* them by push and email. Calls routes under `v1/omnichannel-alerts`. For project admins.
|
|
78
|
+
*
|
|
79
|
+
* @category omnichannelAlerts
|
|
80
|
+
*/
|
|
81
|
+
export declare class OmnichannelAlertsResource {
|
|
82
|
+
/** The project's alert notifications rule. */
|
|
83
|
+
readonly rules: NotificationsRulesResource;
|
|
84
|
+
private readonly omnichannelAlerts;
|
|
85
|
+
constructor(http: HttpClient);
|
|
86
|
+
/** Previews who a sample alert's notifications reach, step by step. Sends nothing. Calls `POST v1/omnichannel-alerts/preview`. */
|
|
87
|
+
preview(body: NotificationsPreviewRequest, options?: RequestOptions): Promise<NotificationsPreviewResponse>;
|
|
88
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OmnichannelAlertsResource = void 0;
|
|
4
|
+
const notifications_rules_resource_1 = require("./notifications-rules-resource");
|
|
5
|
+
const OMNICHANNEL_ALERTS_PATH = "v1/omnichannel-alerts";
|
|
6
|
+
const PREVIEW_PATH = "preview";
|
|
7
|
+
/**
|
|
8
|
+
* Omni-channel alerts: Signals generates each alert's notification steps from the project's rule, and Ovok delivers
|
|
9
|
+
* them by push and email. Calls routes under `v1/omnichannel-alerts`. For project admins.
|
|
10
|
+
*
|
|
11
|
+
* @category omnichannelAlerts
|
|
12
|
+
*/
|
|
13
|
+
class OmnichannelAlertsResource {
|
|
14
|
+
constructor(http) {
|
|
15
|
+
this.omnichannelAlerts = http.under(OMNICHANNEL_ALERTS_PATH);
|
|
16
|
+
this.rules = new notifications_rules_resource_1.NotificationsRulesResource(this.omnichannelAlerts);
|
|
17
|
+
}
|
|
18
|
+
/** Previews who a sample alert's notifications reach, step by step. Sends nothing. Calls `POST v1/omnichannel-alerts/preview`. */
|
|
19
|
+
preview(body, options) {
|
|
20
|
+
return this.omnichannelAlerts.post(PREVIEW_PATH, body, options);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.OmnichannelAlertsResource = OmnichannelAlertsResource;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { HttpClient } from "../../http/http-client";
|
|
2
|
+
import { RequestOptions } from "../../http/transmit";
|
|
3
|
+
/**
|
|
4
|
+
* The platform a push device runs on.
|
|
5
|
+
*
|
|
6
|
+
* @category push
|
|
7
|
+
*/
|
|
8
|
+
export type PushPlatform = "ios" | "android" | "web";
|
|
9
|
+
/**
|
|
10
|
+
* Request body for registering a push device.
|
|
11
|
+
*
|
|
12
|
+
* @category push
|
|
13
|
+
*/
|
|
14
|
+
export type RegisterPushDeviceRequest = {
|
|
15
|
+
/** The push token the device was given: FCM, APNs (hex) or Expo. Never returned. */
|
|
16
|
+
token: string;
|
|
17
|
+
/** The device platform. */
|
|
18
|
+
platform: PushPlatform;
|
|
19
|
+
/** The app the token belongs to, such as its bundle or package id. */
|
|
20
|
+
appId?: string | null;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* A device the signed-in person receives push on.
|
|
24
|
+
*
|
|
25
|
+
* @category push
|
|
26
|
+
*/
|
|
27
|
+
export type PushDevice = {
|
|
28
|
+
/** The device id. */
|
|
29
|
+
id: string;
|
|
30
|
+
/** The device platform. */
|
|
31
|
+
platform: PushPlatform;
|
|
32
|
+
/** The app the token belongs to; null when not sent. */
|
|
33
|
+
appId: string | null;
|
|
34
|
+
/** When the device was registered to this profile. */
|
|
35
|
+
registeredAt: string | null;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* The signed-in person's push devices.
|
|
39
|
+
*
|
|
40
|
+
* @category push
|
|
41
|
+
*/
|
|
42
|
+
export type PushDeviceList = {
|
|
43
|
+
/** The devices registered to the signed-in person in this project. */
|
|
44
|
+
devices: PushDevice[];
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* The devices the signed-in person receives push on, each their own.
|
|
48
|
+
*
|
|
49
|
+
* @category push
|
|
50
|
+
*/
|
|
51
|
+
export declare class PushDevicesResource {
|
|
52
|
+
private readonly push;
|
|
53
|
+
constructor(push: HttpClient);
|
|
54
|
+
/** Registers a device token to the signed-in person; registering it again answers the same device. Calls `POST v1/push/devices`. */
|
|
55
|
+
register(body: RegisterPushDeviceRequest, options?: RequestOptions): Promise<PushDevice>;
|
|
56
|
+
/** Lists the signed-in person's devices. Calls `GET v1/push/devices`. */
|
|
57
|
+
list(options?: RequestOptions): Promise<PushDeviceList>;
|
|
58
|
+
/** Removes a device, which then gets no more push. Calls `DELETE v1/push/devices/{id}`. */
|
|
59
|
+
unregister(id: string, options?: RequestOptions): Promise<void>;
|
|
60
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PushDevicesResource = void 0;
|
|
4
|
+
const url_1 = require("../../http/url");
|
|
5
|
+
const DEVICES_PATH = "devices";
|
|
6
|
+
/**
|
|
7
|
+
* The devices the signed-in person receives push on, each their own.
|
|
8
|
+
*
|
|
9
|
+
* @category push
|
|
10
|
+
*/
|
|
11
|
+
class PushDevicesResource {
|
|
12
|
+
constructor(push) {
|
|
13
|
+
this.push = push;
|
|
14
|
+
}
|
|
15
|
+
/** Registers a device token to the signed-in person; registering it again answers the same device. Calls `POST v1/push/devices`. */
|
|
16
|
+
register(body, options) {
|
|
17
|
+
return this.push.post(DEVICES_PATH, body, options);
|
|
18
|
+
}
|
|
19
|
+
/** Lists the signed-in person's devices. Calls `GET v1/push/devices`. */
|
|
20
|
+
list(options) {
|
|
21
|
+
return this.push.get(DEVICES_PATH, options);
|
|
22
|
+
}
|
|
23
|
+
/** Removes a device, which then gets no more push. Calls `DELETE v1/push/devices/{id}`. */
|
|
24
|
+
unregister(id, options) {
|
|
25
|
+
return this.push.delete(`${DEVICES_PATH}/${(0, url_1.pathSegment)(id)}`, options);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.PushDevicesResource = PushDevicesResource;
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { HttpClient } from "../../http/http-client";
|
|
2
|
+
import { RequestOptions } from "../../http/transmit";
|
|
3
|
+
/**
|
|
4
|
+
* A provider the project's push goes through. `relay` posts each push to an HTTPS endpoint of your own.
|
|
5
|
+
*
|
|
6
|
+
* @category push
|
|
7
|
+
*/
|
|
8
|
+
export type PushProviderName = "fcm" | "apns" | "expo" | "relay";
|
|
9
|
+
/**
|
|
10
|
+
* The APNs environment: `production` for App Store and TestFlight builds, `sandbox` for development builds.
|
|
11
|
+
*
|
|
12
|
+
* @category push
|
|
13
|
+
*/
|
|
14
|
+
export type ApnsEnvironment = "production" | "sandbox";
|
|
15
|
+
/**
|
|
16
|
+
* Firebase Cloud Messaging credentials.
|
|
17
|
+
*
|
|
18
|
+
* @category push
|
|
19
|
+
*/
|
|
20
|
+
export type FcmPushProvider = {
|
|
21
|
+
/** Always `fcm`. */
|
|
22
|
+
provider: "fcm";
|
|
23
|
+
/** The Firebase service account key: the JSON file, as text. Never returned. */
|
|
24
|
+
secret: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Apple Push Notification service credentials.
|
|
28
|
+
*
|
|
29
|
+
* @category push
|
|
30
|
+
*/
|
|
31
|
+
export type ApnsPushProvider = {
|
|
32
|
+
/** Always `apns`. */
|
|
33
|
+
provider: "apns";
|
|
34
|
+
/** The `.p8` APNs auth key, as PEM text. Never returned. */
|
|
35
|
+
secret: string;
|
|
36
|
+
/** The Apple Developer team id. */
|
|
37
|
+
teamId: string;
|
|
38
|
+
/** The id of the `.p8` key. */
|
|
39
|
+
keyId: string;
|
|
40
|
+
/** The app's bundle id, sent as the APNs topic. */
|
|
41
|
+
bundleId: string;
|
|
42
|
+
/** Which APNs environment to send to. */
|
|
43
|
+
environment: ApnsEnvironment;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* The APNs settings to change; each field left out stays as it is.
|
|
47
|
+
*
|
|
48
|
+
* @category push
|
|
49
|
+
*/
|
|
50
|
+
export type ApnsPushProviderChange = {
|
|
51
|
+
/** Always `apns`. */
|
|
52
|
+
provider: "apns";
|
|
53
|
+
/** The `.p8` APNs auth key, as PEM text. Never returned. */
|
|
54
|
+
secret?: string;
|
|
55
|
+
/** The Apple Developer team id. */
|
|
56
|
+
teamId?: string;
|
|
57
|
+
/** The id of the `.p8` key. */
|
|
58
|
+
keyId?: string;
|
|
59
|
+
/** The app's bundle id, sent as the APNs topic. */
|
|
60
|
+
bundleId?: string;
|
|
61
|
+
/** Which APNs environment to send to. */
|
|
62
|
+
environment?: ApnsEnvironment;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Expo push service settings.
|
|
66
|
+
*
|
|
67
|
+
* @category push
|
|
68
|
+
*/
|
|
69
|
+
export type ExpoPushProvider = {
|
|
70
|
+
/** Always `expo`. */
|
|
71
|
+
provider: "expo";
|
|
72
|
+
/** An Expo access token, when the Expo project requires one; null when it does not. Never returned. */
|
|
73
|
+
secret: string | null;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* A relay of your own: Ovok posts each push to it as a signed `push.send`.
|
|
77
|
+
*
|
|
78
|
+
* @category push
|
|
79
|
+
*/
|
|
80
|
+
export type RelayPushProvider = {
|
|
81
|
+
/** Always `relay`. */
|
|
82
|
+
provider: "relay";
|
|
83
|
+
/** Where Ovok posts each `push.send`: https, on a public host. */
|
|
84
|
+
url: string;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Request body for setting up the push provider.
|
|
88
|
+
*
|
|
89
|
+
* @category push
|
|
90
|
+
*/
|
|
91
|
+
export type CreatePushProviderRequest = FcmPushProvider | ApnsPushProvider | ExpoPushProvider | RelayPushProvider;
|
|
92
|
+
/**
|
|
93
|
+
* Request body for changing the push provider: the provider set up, and what to change of it.
|
|
94
|
+
*
|
|
95
|
+
* @category push
|
|
96
|
+
*/
|
|
97
|
+
export type UpdatePushProviderRequest = FcmPushProvider | ApnsPushProviderChange | ExpoPushProvider | RelayPushProvider;
|
|
98
|
+
/**
|
|
99
|
+
* The project's push provider, never with a stored secret.
|
|
100
|
+
*
|
|
101
|
+
* @category push
|
|
102
|
+
*/
|
|
103
|
+
export type PushProviderSettings = {
|
|
104
|
+
/** The project id. */
|
|
105
|
+
projectId: string;
|
|
106
|
+
/** The provider push goes through; null when none. */
|
|
107
|
+
provider: PushProviderName | null;
|
|
108
|
+
/** What the provider is set up with, never a secret; null when none. */
|
|
109
|
+
settings: Record<string, string | boolean> | null;
|
|
110
|
+
/** The relay's `whsec_` signing secret, answered once when the relay is set up; null otherwise. */
|
|
111
|
+
secret: string | null;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* The provider the project's push goes through, and its credentials. For project admins.
|
|
115
|
+
*
|
|
116
|
+
* @category push
|
|
117
|
+
*/
|
|
118
|
+
export declare class PushProviderResource {
|
|
119
|
+
private readonly push;
|
|
120
|
+
constructor(push: HttpClient);
|
|
121
|
+
/** Reads the push provider. Calls `GET v1/push/provider`. */
|
|
122
|
+
retrieve(options?: RequestOptions): Promise<PushProviderSettings>;
|
|
123
|
+
/** Sets up the push provider; a relay's signing secret is answered this once. Calls `POST v1/push/provider`. */
|
|
124
|
+
create(body: CreatePushProviderRequest, options?: RequestOptions): Promise<PushProviderSettings>;
|
|
125
|
+
/** Changes the push provider. Calls `PATCH v1/push/provider`. */
|
|
126
|
+
update(body: UpdatePushProviderRequest, options?: RequestOptions): Promise<PushProviderSettings>;
|
|
127
|
+
/** Removes the push provider; no push is sent until one is set up again. Calls `DELETE v1/push/provider`. */
|
|
128
|
+
remove(options?: RequestOptions): Promise<void>;
|
|
129
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PushProviderResource = void 0;
|
|
4
|
+
const PROVIDER_PATH = "provider";
|
|
5
|
+
/**
|
|
6
|
+
* The provider the project's push goes through, and its credentials. For project admins.
|
|
7
|
+
*
|
|
8
|
+
* @category push
|
|
9
|
+
*/
|
|
10
|
+
class PushProviderResource {
|
|
11
|
+
constructor(push) {
|
|
12
|
+
this.push = push;
|
|
13
|
+
}
|
|
14
|
+
/** Reads the push provider. Calls `GET v1/push/provider`. */
|
|
15
|
+
retrieve(options) {
|
|
16
|
+
return this.push.get(PROVIDER_PATH, options);
|
|
17
|
+
}
|
|
18
|
+
/** Sets up the push provider; a relay's signing secret is answered this once. Calls `POST v1/push/provider`. */
|
|
19
|
+
create(body, options) {
|
|
20
|
+
return this.push.post(PROVIDER_PATH, body, options);
|
|
21
|
+
}
|
|
22
|
+
/** Changes the push provider. Calls `PATCH v1/push/provider`. */
|
|
23
|
+
update(body, options) {
|
|
24
|
+
return this.push.patch(PROVIDER_PATH, body, options);
|
|
25
|
+
}
|
|
26
|
+
/** Removes the push provider; no push is sent until one is set up again. Calls `DELETE v1/push/provider`. */
|
|
27
|
+
remove(options) {
|
|
28
|
+
return this.push.delete(PROVIDER_PATH, options);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.PushProviderResource = PushProviderResource;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { HttpClient } from "../../http/http-client";
|
|
2
|
+
import { PushDevicesResource } from "./push-devices-resource";
|
|
3
|
+
import { PushProviderResource } from "./push-provider-resource";
|
|
4
|
+
/**
|
|
5
|
+
* Push devices and the project's push provider. Calls routes under `v1/push`.
|
|
6
|
+
*
|
|
7
|
+
* @category push
|
|
8
|
+
*/
|
|
9
|
+
export declare class PushResource {
|
|
10
|
+
/** The signed-in person's push devices. */
|
|
11
|
+
readonly devices: PushDevicesResource;
|
|
12
|
+
/** The project's push provider. */
|
|
13
|
+
readonly provider: PushProviderResource;
|
|
14
|
+
constructor(http: HttpClient);
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PushResource = void 0;
|
|
4
|
+
const push_devices_resource_1 = require("./push-devices-resource");
|
|
5
|
+
const push_provider_resource_1 = require("./push-provider-resource");
|
|
6
|
+
const PUSH_PATH = "v1/push";
|
|
7
|
+
/**
|
|
8
|
+
* Push devices and the project's push provider. Calls routes under `v1/push`.
|
|
9
|
+
*
|
|
10
|
+
* @category push
|
|
11
|
+
*/
|
|
12
|
+
class PushResource {
|
|
13
|
+
constructor(http) {
|
|
14
|
+
const push = http.under(PUSH_PATH);
|
|
15
|
+
this.devices = new push_devices_resource_1.PushDevicesResource(push);
|
|
16
|
+
this.provider = new push_provider_resource_1.PushProviderResource(push);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.PushResource = PushResource;
|