@nabla/connect-protocol 0.1.0-test1 → 0.2.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 +5 -8
- package/dist/events.d.ts +10 -4
- package/dist/index.d.ts +1 -1
- package/dist/lifecycle.d.ts +2 -1
- package/dist/session.d.ts +57 -0
- package/dist/version.d.ts +14 -1
- 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,5 +1,5 @@
|
|
|
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
5
|
* `sessionId` and `requestId` are non-empty strings of at most
|
|
@@ -7,6 +7,7 @@ import type { NablaConnectProtocolVersion } from "./version.js";
|
|
|
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;
|
|
11
12
|
sessionId: string;
|
|
12
13
|
requestId: string;
|
|
@@ -20,14 +21,9 @@ export type NablaConnectCommandStopRecordingMessage = {
|
|
|
20
21
|
event: NablaConnectCommandStopRecordingEvent;
|
|
21
22
|
data: NablaConnectCommandBase;
|
|
22
23
|
};
|
|
23
|
-
export type NablaConnectStartNoteGenerationOptions = {
|
|
24
|
-
microphoneCutConfirmed?: boolean;
|
|
25
|
-
};
|
|
26
24
|
export type NablaConnectCommandStartNoteGenerationMessage = {
|
|
27
25
|
event: NablaConnectCommandStartNoteGenerationEvent;
|
|
28
|
-
data: NablaConnectCommandBase
|
|
29
|
-
startNoteGeneration?: NablaConnectStartNoteGenerationOptions;
|
|
30
|
-
};
|
|
26
|
+
data: NablaConnectCommandBase;
|
|
31
27
|
};
|
|
32
28
|
export type NablaConnectCommandExportNoteMessage = {
|
|
33
29
|
event: NablaConnectCommandExportNoteEvent;
|
|
@@ -35,7 +31,8 @@ export type NablaConnectCommandExportNoteMessage = {
|
|
|
35
31
|
};
|
|
36
32
|
/** The iframe ignores unknown fields on commands. */
|
|
37
33
|
export type NablaConnectInboundCommandMessage = NablaConnectCommandStartRecordingMessage | NablaConnectCommandStopRecordingMessage | NablaConnectCommandStartNoteGenerationMessage | NablaConnectCommandExportNoteMessage;
|
|
38
|
-
|
|
34
|
+
/** Everything the iframe receives: the handshake, then commands. */
|
|
35
|
+
export type NablaConnectInboundLifecycleMessage = NablaConnectSessionHelloMessage | NablaConnectInboundCommandMessage;
|
|
39
36
|
export type NablaConnectLifecycleCommandKind = "startRecording" | "stopRecording" | "startNoteGeneration" | "exportNote";
|
|
40
37
|
/** Each command with the event that carries it and the snapshot action it requires. */
|
|
41
38
|
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/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,57 @@
|
|
|
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
|
+
export type NablaConnectSessionAvailableMessage = {
|
|
12
|
+
event: NablaConnectSessionAvailableEvent;
|
|
13
|
+
data: {
|
|
14
|
+
supportedVersions: number[];
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The host SDK offers the versions it speaks. Sent when the SDK is created and again on
|
|
19
|
+
* every `session:available`. Until the iframe answers with `session:ready`, it ignores
|
|
20
|
+
* every other inbound message.
|
|
21
|
+
*
|
|
22
|
+
* `sdkVersion` is the semver of the SDK, bounded by `NablaConnectSdkVersionMaxLength`.
|
|
23
|
+
* The iframe logs it. It is not clinical data.
|
|
24
|
+
*/
|
|
25
|
+
export type NablaConnectSessionHelloMessage = {
|
|
26
|
+
event: NablaConnectSessionHelloEvent;
|
|
27
|
+
data: {
|
|
28
|
+
supportedVersions: number[];
|
|
29
|
+
sdkVersion: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* The iframe pinned the highest version both sides support. Every later message of the
|
|
34
|
+
* session carries and is validated against it, and the first `stateChanged` follows.
|
|
35
|
+
* A repeated `session:hello` in the same session gets the same message back.
|
|
36
|
+
*/
|
|
37
|
+
export type NablaConnectSessionReadyMessage = {
|
|
38
|
+
event: NablaConnectSessionReadyEvent;
|
|
39
|
+
data: {
|
|
40
|
+
version: NablaConnectProtocolVersion;
|
|
41
|
+
sessionId: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export type NablaConnectSessionRejectionReason = "UNSUPPORTED_VERSION";
|
|
45
|
+
/**
|
|
46
|
+
* The two sides share no version, or the session already pinned one the host does not
|
|
47
|
+
* offer. The host gets no session. `supportedVersions` is what the iframe speaks. If they
|
|
48
|
+
* are all newer than the SDK's, the SDK is too old and the integrator upgrades
|
|
49
|
+
* `@nabla/connect-sdk`. If they are all older, the iframe is behind the SDK.
|
|
50
|
+
*/
|
|
51
|
+
export type NablaConnectSessionRejectedMessage = {
|
|
52
|
+
event: NablaConnectSessionRejectedEvent;
|
|
53
|
+
data: {
|
|
54
|
+
reason: NablaConnectSessionRejectionReason;
|
|
55
|
+
supportedVersions: number[];
|
|
56
|
+
};
|
|
57
|
+
};
|
package/dist/version.d.ts
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
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
10
|
* Ids (`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;
|
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
|
-
};
|