@nabla/connect-protocol 0.1.0-test1 → 0.3.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.
- package/dist/commandResult.d.ts +4 -1
- package/dist/commands.d.ts +8 -9
- package/dist/events.d.ts +10 -4
- package/dist/export.d.ts +34 -7
- package/dist/index.d.ts +1 -1
- package/dist/lifecycle.d.ts +2 -1
- package/dist/session.d.ts +71 -0
- package/dist/version.d.ts +20 -2
- package/package.json +1 -1
- package/dist/query.d.ts +0 -9
package/dist/commandResult.d.ts
CHANGED
|
@@ -6,12 +6,15 @@ import type { NablaConnectProtocolVersion } from "./version.js";
|
|
|
6
6
|
* result.
|
|
7
7
|
*/
|
|
8
8
|
export type NablaConnectCommandResultStatus = "ACCEPTED" | "REJECTED";
|
|
9
|
-
export type NablaConnectCommandRejectionReason = "STALE_STATE" | "NOT_ALLOWED" | "BUSY" | "INVALID_SESSION" | "
|
|
9
|
+
export type NablaConnectCommandRejectionReason = "STALE_STATE" | "NOT_ALLOWED" | "BUSY" | "INVALID_SESSION" | "EXPORT_FAILED" | "INVALID_MESSAGE"
|
|
10
|
+
/** An unexpected failure while running the command. */
|
|
11
|
+
| "UNKNOWN";
|
|
10
12
|
/**
|
|
11
13
|
* `requestId` is `null` when the rejected message carried no usable one.
|
|
12
14
|
* Consumers must tolerate additional fields.
|
|
13
15
|
*/
|
|
14
16
|
export type NablaConnectCommandResult = {
|
|
17
|
+
/** The version pinned by the session handshake. */
|
|
15
18
|
version: NablaConnectProtocolVersion;
|
|
16
19
|
sessionId: string;
|
|
17
20
|
requestId: string | null;
|
package/dist/commands.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import type { NablaConnectCommandExportNoteEvent, NablaConnectCommandStartNoteGenerationEvent, NablaConnectCommandStartRecordingEvent, NablaConnectCommandStopRecordingEvent } from "./events.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { NablaConnectSessionHelloMessage } from "./session.js";
|
|
3
3
|
import type { NablaConnectProtocolVersion } from "./version.js";
|
|
4
4
|
/**
|
|
5
|
-
* `sessionId` and `requestId` are non-empty strings of at most
|
|
5
|
+
* `clientId`, `sessionId` and `requestId` are non-empty strings of at most
|
|
6
6
|
* `NablaConnectBoundedIdMaxLength` characters. `expectedRevision` is a positive
|
|
7
7
|
* integer: the revision of the snapshot the host acted on.
|
|
8
8
|
*/
|
|
9
9
|
export type NablaConnectCommandBase = {
|
|
10
|
+
/** The version pinned by the session handshake. */
|
|
10
11
|
version: NablaConnectProtocolVersion;
|
|
12
|
+
/** The `clientId` of the `session:hello`. The iframe ignores another one. */
|
|
13
|
+
clientId: string;
|
|
11
14
|
sessionId: string;
|
|
12
15
|
requestId: string;
|
|
13
16
|
expectedRevision: number;
|
|
@@ -20,14 +23,9 @@ export type NablaConnectCommandStopRecordingMessage = {
|
|
|
20
23
|
event: NablaConnectCommandStopRecordingEvent;
|
|
21
24
|
data: NablaConnectCommandBase;
|
|
22
25
|
};
|
|
23
|
-
export type NablaConnectStartNoteGenerationOptions = {
|
|
24
|
-
microphoneCutConfirmed?: boolean;
|
|
25
|
-
};
|
|
26
26
|
export type NablaConnectCommandStartNoteGenerationMessage = {
|
|
27
27
|
event: NablaConnectCommandStartNoteGenerationEvent;
|
|
28
|
-
data: NablaConnectCommandBase
|
|
29
|
-
startNoteGeneration?: NablaConnectStartNoteGenerationOptions;
|
|
30
|
-
};
|
|
28
|
+
data: NablaConnectCommandBase;
|
|
31
29
|
};
|
|
32
30
|
export type NablaConnectCommandExportNoteMessage = {
|
|
33
31
|
event: NablaConnectCommandExportNoteEvent;
|
|
@@ -35,7 +33,8 @@ export type NablaConnectCommandExportNoteMessage = {
|
|
|
35
33
|
};
|
|
36
34
|
/** The iframe ignores unknown fields on commands. */
|
|
37
35
|
export type NablaConnectInboundCommandMessage = NablaConnectCommandStartRecordingMessage | NablaConnectCommandStopRecordingMessage | NablaConnectCommandStartNoteGenerationMessage | NablaConnectCommandExportNoteMessage;
|
|
38
|
-
|
|
36
|
+
/** Everything the iframe receives: the handshake, then commands. */
|
|
37
|
+
export type NablaConnectInboundLifecycleMessage = NablaConnectSessionHelloMessage | NablaConnectInboundCommandMessage;
|
|
39
38
|
export type NablaConnectLifecycleCommandKind = "startRecording" | "stopRecording" | "startNoteGeneration" | "exportNote";
|
|
40
39
|
/** Each command with the event that carries it and the snapshot action it requires. */
|
|
41
40
|
export type NablaConnectLifecycleCommands = {
|
package/dist/events.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export type NablaConnectLifecycleStateChangedEvent = "com.connect.nabla:lifecycle:stateChanged";
|
|
2
|
-
export type
|
|
2
|
+
export type NablaConnectSessionAvailableEvent = "com.connect.nabla:session:available";
|
|
3
|
+
export type NablaConnectSessionHelloEvent = "com.connect.nabla:session:hello";
|
|
4
|
+
export type NablaConnectSessionReadyEvent = "com.connect.nabla:session:ready";
|
|
5
|
+
export type NablaConnectSessionRejectedEvent = "com.connect.nabla:session:rejected";
|
|
3
6
|
export type NablaConnectCommandStartRecordingEvent = "com.connect.nabla:command:startRecording";
|
|
4
7
|
export type NablaConnectCommandStopRecordingEvent = "com.connect.nabla:command:stopRecording";
|
|
5
8
|
export type NablaConnectCommandStartNoteGenerationEvent = "com.connect.nabla:command:startNoteGeneration";
|
|
@@ -8,9 +11,9 @@ export type NablaConnectCommandResultEvent = "com.connect.nabla:command:result";
|
|
|
8
11
|
export type NablaConnectExportNoteEvent = "com.connect.nabla:export:note";
|
|
9
12
|
export type NablaConnectExportPatientInstructionsEvent = "com.connect.nabla:export:patientInstructions";
|
|
10
13
|
/** Events the host page sends to the iframe. */
|
|
11
|
-
export type NablaConnectInboundEvent =
|
|
14
|
+
export type NablaConnectInboundEvent = NablaConnectSessionHelloEvent | NablaConnectCommandStartRecordingEvent | NablaConnectCommandStopRecordingEvent | NablaConnectCommandStartNoteGenerationEvent | NablaConnectCommandExportNoteEvent;
|
|
12
15
|
/** Events the iframe sends to the host page. */
|
|
13
|
-
export type NablaConnectOutboundEvent = NablaConnectLifecycleStateChangedEvent | NablaConnectCommandResultEvent | NablaConnectExportNoteEvent | NablaConnectExportPatientInstructionsEvent;
|
|
16
|
+
export type NablaConnectOutboundEvent = NablaConnectSessionAvailableEvent | NablaConnectSessionReadyEvent | NablaConnectSessionRejectedEvent | NablaConnectLifecycleStateChangedEvent | NablaConnectCommandResultEvent | NablaConnectExportNoteEvent | NablaConnectExportPatientInstructionsEvent;
|
|
14
17
|
/**
|
|
15
18
|
* Every event name, by key. Types have no runtime value, so each consumer redeclares the
|
|
16
19
|
* names it uses and pins the declaration to this type:
|
|
@@ -18,7 +21,10 @@ export type NablaConnectOutboundEvent = NablaConnectLifecycleStateChangedEvent |
|
|
|
18
21
|
*/
|
|
19
22
|
export type NablaConnectEventNames = {
|
|
20
23
|
lifecycleStateChanged: NablaConnectLifecycleStateChangedEvent;
|
|
21
|
-
|
|
24
|
+
sessionAvailable: NablaConnectSessionAvailableEvent;
|
|
25
|
+
sessionHello: NablaConnectSessionHelloEvent;
|
|
26
|
+
sessionReady: NablaConnectSessionReadyEvent;
|
|
27
|
+
sessionRejected: NablaConnectSessionRejectedEvent;
|
|
22
28
|
commandStartRecording: NablaConnectCommandStartRecordingEvent;
|
|
23
29
|
commandStopRecording: NablaConnectCommandStopRecordingEvent;
|
|
24
30
|
commandStartNoteGeneration: NablaConnectCommandStartNoteGenerationEvent;
|
package/dist/export.d.ts
CHANGED
|
@@ -1,7 +1,40 @@
|
|
|
1
1
|
import type { NablaConnectExportNoteEvent, NablaConnectExportPatientInstructionsEvent } from "./events.js";
|
|
2
|
+
export type NablaConnectIcd10Entry = {
|
|
3
|
+
system: "http://hl7.org/fhir/sid/icd-10-cm";
|
|
4
|
+
code: string;
|
|
5
|
+
display: string;
|
|
6
|
+
isHcc: boolean;
|
|
7
|
+
isMcc: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type NablaConnectSnomedEntry = {
|
|
10
|
+
system: "http://snomed.info/sct";
|
|
11
|
+
code: string;
|
|
12
|
+
display: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* A subsection of a note section, with its normalized codes. `title` is `null` for a
|
|
16
|
+
* subsection without a title. The code lists are empty when no codes are available at
|
|
17
|
+
* export time.
|
|
18
|
+
*/
|
|
19
|
+
export type NablaConnectNoteSubsection = {
|
|
20
|
+
title: string | null;
|
|
21
|
+
text: string;
|
|
22
|
+
icd10Codes: NablaConnectIcd10Entry[];
|
|
23
|
+
snomedCodes: NablaConnectSnomedEntry[];
|
|
24
|
+
};
|
|
25
|
+
/** The content of a note section, discriminated by `type`. */
|
|
26
|
+
export type NablaConnectNoteSectionContent = {
|
|
27
|
+
type: "TEXT";
|
|
28
|
+
text: string;
|
|
29
|
+
} | {
|
|
30
|
+
type: "SUBSECTIONS";
|
|
31
|
+
subsections: NablaConnectNoteSubsection[];
|
|
32
|
+
};
|
|
2
33
|
export type NablaConnectExportableNoteSection = {
|
|
3
34
|
category: string | null;
|
|
35
|
+
/** @deprecated The `NOTE_EXPORT` callback deprecates it: read `structuredContent`. */
|
|
4
36
|
content: string;
|
|
37
|
+
structuredContent: NablaConnectNoteSectionContent;
|
|
5
38
|
title: string;
|
|
6
39
|
};
|
|
7
40
|
export type NablaConnectExportableNote = {
|
|
@@ -9,13 +42,7 @@ export type NablaConnectExportableNote = {
|
|
|
9
42
|
freeText: string | null;
|
|
10
43
|
};
|
|
11
44
|
export type NablaConnectVisitDiagnosisSystem = "http://hl7.org/fhir/sid/icd-10-cm";
|
|
12
|
-
export type NablaConnectVisitDiagnosis =
|
|
13
|
-
system: NablaConnectVisitDiagnosisSystem;
|
|
14
|
-
code: string;
|
|
15
|
-
display: string;
|
|
16
|
-
isHcc: boolean;
|
|
17
|
-
isMcc: boolean;
|
|
18
|
-
};
|
|
45
|
+
export type NablaConnectVisitDiagnosis = NablaConnectIcd10Entry;
|
|
19
46
|
export type NablaConnectExportTranscriptItem = {
|
|
20
47
|
text: string;
|
|
21
48
|
speakerType: string;
|
package/dist/index.d.ts
CHANGED
package/dist/lifecycle.d.ts
CHANGED
|
@@ -10,12 +10,13 @@ export type NablaConnectNoteGenerationFailureReason = "TRANSCRIPT_TOO_SHORT" | "
|
|
|
10
10
|
* `NablaConnectBoundedIdMaxLength` characters, `revision` a positive integer.
|
|
11
11
|
*/
|
|
12
12
|
export type NablaConnectLifecycleSnapshot = {
|
|
13
|
+
/** The version pinned by the session handshake. */
|
|
13
14
|
version: NablaConnectProtocolVersion;
|
|
14
15
|
sessionId: string;
|
|
15
16
|
revision: number;
|
|
16
17
|
state: NablaConnectLifecycleState;
|
|
17
18
|
availableActions: NablaConnectLifecycleAction[];
|
|
18
|
-
|
|
19
|
+
canBeClosed: boolean;
|
|
19
20
|
reason: NablaConnectLifecycleSnapshotReason | null;
|
|
20
21
|
failureReason: NablaConnectNoteGenerationFailureReason | null;
|
|
21
22
|
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { NablaConnectSessionAvailableEvent, NablaConnectSessionHelloEvent, NablaConnectSessionReadyEvent, NablaConnectSessionRejectedEvent } from "./events.js";
|
|
2
|
+
import type { NablaConnectProtocolVersion } from "./version.js";
|
|
3
|
+
/**
|
|
4
|
+
* The iframe is listening. Sent once per session, before anything else. A new one on the
|
|
5
|
+
* same iframe element means the previous session is gone: the document reloaded, or the
|
|
6
|
+
* iframe opened another encounter.
|
|
7
|
+
*
|
|
8
|
+
* Setup messages are not versioned and only ever gain fields. `supportedVersions` is
|
|
9
|
+
* bounded by `NablaConnectSupportedVersionsMaxLength`.
|
|
10
|
+
*
|
|
11
|
+
* `clientId` is the client the document was loaded for, read from its URL, or `null` for a
|
|
12
|
+
* document that was loaded for none. It is a bounded id.
|
|
13
|
+
*/
|
|
14
|
+
export type NablaConnectSessionAvailableMessage = {
|
|
15
|
+
event: NablaConnectSessionAvailableEvent;
|
|
16
|
+
data: {
|
|
17
|
+
supportedVersions: number[];
|
|
18
|
+
clientId: string | null;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* The host SDK offers the versions it speaks. Sent when the SDK is created and again on
|
|
23
|
+
* every `session:available`. Until the iframe answers with `session:ready`, it ignores
|
|
24
|
+
* every other inbound message.
|
|
25
|
+
*
|
|
26
|
+
* `sdkVersion` is the semver of the SDK, bounded by `NablaConnectSdkVersionMaxLength`.
|
|
27
|
+
* The iframe logs it. It is not clinical data.
|
|
28
|
+
*
|
|
29
|
+
* `clientId` is a bounded id that identifies the SDK client. The iframe only answers the
|
|
30
|
+
* client its document was loaded for, and ignores a message with another or no `clientId`.
|
|
31
|
+
*/
|
|
32
|
+
export type NablaConnectSessionHelloMessage = {
|
|
33
|
+
event: NablaConnectSessionHelloEvent;
|
|
34
|
+
data: {
|
|
35
|
+
supportedVersions: number[];
|
|
36
|
+
sdkVersion: string;
|
|
37
|
+
clientId: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* The iframe pinned the highest version both sides support. Every later message of the
|
|
42
|
+
* session carries and is validated against it, and the first `stateChanged` follows.
|
|
43
|
+
* A repeated `session:hello` in the same session gets the same message back.
|
|
44
|
+
*
|
|
45
|
+
* `clientId` echoes the one of the `session:hello` it answers. The iframe posts to a window
|
|
46
|
+
* its host shares with other clients, so each client tells its own messages by it.
|
|
47
|
+
*/
|
|
48
|
+
export type NablaConnectSessionReadyMessage = {
|
|
49
|
+
event: NablaConnectSessionReadyEvent;
|
|
50
|
+
data: {
|
|
51
|
+
version: NablaConnectProtocolVersion;
|
|
52
|
+
sessionId: string;
|
|
53
|
+
clientId: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export type NablaConnectSessionRejectionReason = "UNSUPPORTED_VERSION";
|
|
57
|
+
/**
|
|
58
|
+
* The two sides share no version, or the session already pinned one the host does not
|
|
59
|
+
* offer. The host gets no session. `supportedVersions` is what the iframe speaks. If they
|
|
60
|
+
* are all newer than the SDK's, the SDK is too old and the integrator upgrades
|
|
61
|
+
* `@nabla/connect-sdk`. If they are all older, the iframe is behind the SDK.
|
|
62
|
+
* `clientId` echoes the one of the `session:hello` it answers.
|
|
63
|
+
*/
|
|
64
|
+
export type NablaConnectSessionRejectedMessage = {
|
|
65
|
+
event: NablaConnectSessionRejectedEvent;
|
|
66
|
+
data: {
|
|
67
|
+
reason: NablaConnectSessionRejectionReason;
|
|
68
|
+
supportedVersions: number[];
|
|
69
|
+
clientId: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
package/dist/version.d.ts
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* A protocol version the session can pin. Bumped on breaking changes only.
|
|
3
|
+
*
|
|
4
|
+
* The `session:*` setup messages are not versioned and only ever gain fields. They
|
|
5
|
+
* negotiate the version that every other message of the session carries:
|
|
6
|
+
* `session:ready` reports the one it pinned.
|
|
7
|
+
*/
|
|
2
8
|
export type NablaConnectProtocolVersion = 1;
|
|
3
9
|
/**
|
|
4
|
-
* Ids (`sessionId`, `requestId`) are non-empty strings of at most this many characters.
|
|
10
|
+
* Ids (`clientId`, `sessionId`, `requestId`) are non-empty strings of at most this many characters.
|
|
5
11
|
* Types cannot express the bound: consumers must enforce it.
|
|
6
12
|
*/
|
|
7
13
|
export type NablaConnectBoundedIdMaxLength = 64;
|
|
14
|
+
/**
|
|
15
|
+
* `supportedVersions` holds at most this many positive integers. It may list versions the
|
|
16
|
+
* receiver does not know: it ignores them.
|
|
17
|
+
*/
|
|
18
|
+
export type NablaConnectSupportedVersionsMaxLength = 16;
|
|
19
|
+
/** `sdkVersion` is a non-empty string of at most this many characters. */
|
|
20
|
+
export type NablaConnectSdkVersionMaxLength = 64;
|
|
21
|
+
/**
|
|
22
|
+
* The query parameter of the iframe URL that carries the `clientId` the document is loaded
|
|
23
|
+
* for. The SDK sets it. The iframe only answers the client it names.
|
|
24
|
+
*/
|
|
25
|
+
export type NablaConnectClientIdParam = "nablaConnectClientId";
|
package/package.json
CHANGED
package/dist/query.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { NablaConnectQueryLifecycleStateEvent } from "./events.js";
|
|
2
|
-
import type { NablaConnectProtocolVersion } from "./version.js";
|
|
3
|
-
/** Asks the iframe to send its current lifecycle snapshot. */
|
|
4
|
-
export type NablaConnectQueryLifecycleStateMessage = {
|
|
5
|
-
event: NablaConnectQueryLifecycleStateEvent;
|
|
6
|
-
data: {
|
|
7
|
-
version: NablaConnectProtocolVersion;
|
|
8
|
-
};
|
|
9
|
-
};
|