@voiceflow/sdk-runtime 1.3.1 → 1.3.2
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/CHANGELOG.md +6 -0
- package/build/cjs/runtime/runtime.interface.d.ts +10 -14
- package/build/cjs/runtime/runtime.interface.d.ts.map +1 -1
- package/build/cjs/runtime/runtime.interface.js +5 -10
- package/build/cjs/trace/trace.component.d.ts +1 -1
- package/build/esm/runtime/runtime.interface.d.ts +10 -14
- package/build/esm/runtime/runtime.interface.d.ts.map +1 -1
- package/build/esm/runtime/runtime.interface.js +4 -7
- package/build/esm/trace/trace.component.d.ts +1 -1
- package/package.json +2 -2
- package/src/runtime/runtime.interface.ts +15 -20
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.3.2](https://github.com/voiceflow/adapters/compare/@voiceflow/sdk-runtime@1.3.1...@voiceflow/sdk-runtime@1.3.2) (2022-10-04)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* definitive action types (CT-1048) ([#42](https://github.com/voiceflow/adapters/issues/42)) ([8ecfa82](https://github.com/voiceflow/adapters/commit/8ecfa82efddb7652af4af4794224a83484a279c1)), closes [/github.com/voiceflow/creator-app/blob/729ff17e2d558fc43ce7140497ca0716656df33f/packages/creator-app/src/pages/Prototype/components/PrototypeDialog/utils.ts#L52-L60](https://github.com//github.com/voiceflow/creator-app/blob/729ff17e2d558fc43ce7140497ca0716656df33f/packages/creator-app/src/pages/Prototype/components/PrototypeDialog/utils.ts/issues/L52-L60)
|
|
11
|
+
|
|
6
12
|
## [1.3.1](https://github.com/voiceflow/adapters/compare/@voiceflow/sdk-runtime@1.3.0...@voiceflow/sdk-runtime@1.3.1) (2022-10-03)
|
|
7
13
|
|
|
8
14
|
### Bug Fixes
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BaseRequest } from '@voiceflow/base-types';
|
|
1
2
|
declare type FetchFn = (...parameters: any[]) => Promise<any>;
|
|
2
3
|
export interface RuntimeOptions<V = AuthVerify | PublicVerify> {
|
|
3
4
|
url: string;
|
|
@@ -27,14 +28,8 @@ export interface RuntimeInteractResponse {
|
|
|
27
28
|
request: RuntimeAction;
|
|
28
29
|
trace: RuntimeTrace[];
|
|
29
30
|
}
|
|
30
|
-
export declare
|
|
31
|
-
export declare
|
|
32
|
-
export declare const isRuntimeActionType: (value: unknown) => value is "launch" | "intent" | "text" | "...etc";
|
|
33
|
-
export interface RuntimeAction<T extends RuntimeActionType = RuntimeActionType, P = unknown> {
|
|
34
|
-
type: T;
|
|
35
|
-
payload: P;
|
|
36
|
-
}
|
|
37
|
-
export declare const isRuntimeAction: (value: unknown) => value is RuntimeAction<"launch" | "intent" | "text" | "...etc", unknown>;
|
|
31
|
+
export declare type RuntimeAction = BaseRequest.TextRequest | BaseRequest.LaunchRequest | BaseRequest.IntentRequest | BaseRequest.ActionRequest | BaseRequest.GeneralRequest | BaseRequest.BaseRequest<unknown>;
|
|
32
|
+
export declare const isRuntimeAction: (value: unknown) => value is RuntimeAction;
|
|
38
33
|
export interface IntentActionPayload {
|
|
39
34
|
query: string;
|
|
40
35
|
intent: {
|
|
@@ -46,21 +41,22 @@ export interface IntentActionPayload {
|
|
|
46
41
|
}[];
|
|
47
42
|
confidence?: number;
|
|
48
43
|
}
|
|
49
|
-
export declare type IntentAction =
|
|
50
|
-
export declare
|
|
51
|
-
export declare const
|
|
44
|
+
export declare type IntentAction = BaseRequest.IntentRequest;
|
|
45
|
+
export declare type ActionType = BaseRequest.RequestType;
|
|
46
|
+
export declare const ActionType: typeof BaseRequest.RequestType;
|
|
47
|
+
export declare const createIntentAction: (payload: BaseRequest.IntentRequestPayload) => BaseRequest.IntentRequest;
|
|
52
48
|
export interface RuntimeState {
|
|
53
49
|
storage: Record<string, any>;
|
|
54
50
|
variables: Record<string, any>;
|
|
55
51
|
}
|
|
56
|
-
export declare const RuntimeTraceTypeSet: Set<"
|
|
52
|
+
export declare const RuntimeTraceTypeSet: Set<"speak" | "text" | "choice" | "card" | "visual" | "audio" | "payload" | "stream" | "end">;
|
|
57
53
|
export declare type RuntimeTraceType = typeof RuntimeTraceTypeSet extends Set<infer K> ? K : never;
|
|
58
|
-
export declare const isRuntimeTraceType: (value: unknown) => value is "
|
|
54
|
+
export declare const isRuntimeTraceType: (value: unknown) => value is "speak" | "text" | "choice" | "card" | "visual" | "audio" | "payload" | "stream" | "end";
|
|
59
55
|
export interface RuntimeTrace<T extends RuntimeTraceType = RuntimeTraceType, P = unknown> {
|
|
60
56
|
type: T;
|
|
61
57
|
payload: P;
|
|
62
58
|
}
|
|
63
|
-
export declare const isRuntimeTrace: (value: unknown) => value is RuntimeTrace<"
|
|
59
|
+
export declare const isRuntimeTrace: (value: unknown) => value is RuntimeTrace<"speak" | "text" | "choice" | "card" | "visual" | "audio" | "payload" | "stream" | "end", unknown>;
|
|
64
60
|
export interface CardTracePayload {
|
|
65
61
|
card: {
|
|
66
62
|
type: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.interface.d.ts","sourceRoot":"","sources":["../../../src/runtime/runtime.interface.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime.interface.d.ts","sourceRoot":"","sources":["../../../src/runtime/runtime.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,aAAK,OAAO,GAAG,CAAC,GAAG,UAAU,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAEtD,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,UAAU,GAAG,YAAY;IAC3D,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,CAAC,CAAC;IAEV;;;OAGG;IACH,aAAa,CA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G,YAAY,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;AAErE,eAAO,MAAM,aAAa,UAAW,OAAO,yBAA2E,CAAC;AAExH,MAAM,WAAW,kBAAkB;IACjC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isStreamTrace = exports.isVisualTrace = exports.isTextTrace = exports.isSpeakTrace = exports.isPayloadTrace = exports.isEndTrace = exports.isChoiceTrace = exports.isCardTrace = exports.isRuntimeTrace = exports.isRuntimeTraceType = exports.RuntimeTraceTypeSet = exports.createIntentAction = exports.
|
|
3
|
+
exports.isStreamTrace = exports.isVisualTrace = exports.isTextTrace = exports.isSpeakTrace = exports.isPayloadTrace = exports.isEndTrace = exports.isChoiceTrace = exports.isCardTrace = exports.isRuntimeTrace = exports.isRuntimeTraceType = exports.RuntimeTraceTypeSet = exports.createIntentAction = exports.ActionType = exports.isRuntimeAction = exports.isPublicRuntimeOptions = exports.isAuthRuntimeOptions = void 0;
|
|
4
|
+
const base_types_1 = require("@voiceflow/base-types");
|
|
4
5
|
const isAuthRuntimeOptions = (options) => {
|
|
5
6
|
return !!options?.verify?.authorization;
|
|
6
7
|
};
|
|
@@ -9,17 +10,11 @@ const isPublicRuntimeOptions = (options) => {
|
|
|
9
10
|
return typeof options?.verify?.projectID === 'string';
|
|
10
11
|
};
|
|
11
12
|
exports.isPublicRuntimeOptions = isPublicRuntimeOptions;
|
|
12
|
-
|
|
13
|
-
const isRuntimeActionType = (value) => typeof value === 'string' && exports.RuntimeActionTypeSet.has(value);
|
|
14
|
-
exports.isRuntimeActionType = isRuntimeActionType;
|
|
15
|
-
const isRuntimeAction = (value) => typeof value === 'object' &&
|
|
16
|
-
Object.prototype.hasOwnProperty.call(value, 'type') &&
|
|
17
|
-
(0, exports.isRuntimeActionType)(value.type);
|
|
13
|
+
const isRuntimeAction = (value) => typeof value === 'object' && Object.prototype.hasOwnProperty.call(value, 'type');
|
|
18
14
|
exports.isRuntimeAction = isRuntimeAction;
|
|
19
|
-
|
|
20
|
-
exports.isIntentAction = isIntentAction;
|
|
15
|
+
exports.ActionType = base_types_1.BaseRequest.RequestType;
|
|
21
16
|
const createIntentAction = (payload) => ({
|
|
22
|
-
type:
|
|
17
|
+
type: exports.ActionType.INTENT,
|
|
23
18
|
payload,
|
|
24
19
|
});
|
|
25
20
|
exports.createIntentAction = createIntentAction;
|
|
@@ -4,5 +4,5 @@ export interface TraceComponentOverload<Trace extends RuntimeTrace> {
|
|
|
4
4
|
<Context>(declaration: TraceDeclaration<Context, Trace>): Required<TraceDeclaration<Context, Trace>>;
|
|
5
5
|
<Context>(handle: TraceAccumulator<Context, Trace>): Required<TraceDeclaration<Context, Trace>>;
|
|
6
6
|
}
|
|
7
|
-
export declare const createTraceComponent: <Trace extends RuntimeTrace<"
|
|
7
|
+
export declare const createTraceComponent: <Trace extends RuntimeTrace<"speak" | "text" | "choice" | "card" | "visual" | "audio" | "payload" | "stream" | "end", unknown>>(type: Trace["type"]) => TraceComponentOverload<Trace>;
|
|
8
8
|
//# sourceMappingURL=trace.component.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BaseRequest } from '@voiceflow/base-types';
|
|
1
2
|
declare type FetchFn = (...parameters: any[]) => Promise<any>;
|
|
2
3
|
export interface RuntimeOptions<V = AuthVerify | PublicVerify> {
|
|
3
4
|
url: string;
|
|
@@ -27,14 +28,8 @@ export interface RuntimeInteractResponse {
|
|
|
27
28
|
request: RuntimeAction;
|
|
28
29
|
trace: RuntimeTrace[];
|
|
29
30
|
}
|
|
30
|
-
export declare
|
|
31
|
-
export declare
|
|
32
|
-
export declare const isRuntimeActionType: (value: unknown) => value is "launch" | "intent" | "text" | "...etc";
|
|
33
|
-
export interface RuntimeAction<T extends RuntimeActionType = RuntimeActionType, P = unknown> {
|
|
34
|
-
type: T;
|
|
35
|
-
payload: P;
|
|
36
|
-
}
|
|
37
|
-
export declare const isRuntimeAction: (value: unknown) => value is RuntimeAction<"launch" | "intent" | "text" | "...etc", unknown>;
|
|
31
|
+
export declare type RuntimeAction = BaseRequest.TextRequest | BaseRequest.LaunchRequest | BaseRequest.IntentRequest | BaseRequest.ActionRequest | BaseRequest.GeneralRequest | BaseRequest.BaseRequest<unknown>;
|
|
32
|
+
export declare const isRuntimeAction: (value: unknown) => value is RuntimeAction;
|
|
38
33
|
export interface IntentActionPayload {
|
|
39
34
|
query: string;
|
|
40
35
|
intent: {
|
|
@@ -46,21 +41,22 @@ export interface IntentActionPayload {
|
|
|
46
41
|
}[];
|
|
47
42
|
confidence?: number;
|
|
48
43
|
}
|
|
49
|
-
export declare type IntentAction =
|
|
50
|
-
export declare
|
|
51
|
-
export declare const
|
|
44
|
+
export declare type IntentAction = BaseRequest.IntentRequest;
|
|
45
|
+
export declare type ActionType = BaseRequest.RequestType;
|
|
46
|
+
export declare const ActionType: typeof BaseRequest.RequestType;
|
|
47
|
+
export declare const createIntentAction: (payload: BaseRequest.IntentRequestPayload) => BaseRequest.IntentRequest;
|
|
52
48
|
export interface RuntimeState {
|
|
53
49
|
storage: Record<string, any>;
|
|
54
50
|
variables: Record<string, any>;
|
|
55
51
|
}
|
|
56
|
-
export declare const RuntimeTraceTypeSet: Set<"
|
|
52
|
+
export declare const RuntimeTraceTypeSet: Set<"speak" | "text" | "choice" | "card" | "visual" | "audio" | "payload" | "stream" | "end">;
|
|
57
53
|
export declare type RuntimeTraceType = typeof RuntimeTraceTypeSet extends Set<infer K> ? K : never;
|
|
58
|
-
export declare const isRuntimeTraceType: (value: unknown) => value is "
|
|
54
|
+
export declare const isRuntimeTraceType: (value: unknown) => value is "speak" | "text" | "choice" | "card" | "visual" | "audio" | "payload" | "stream" | "end";
|
|
59
55
|
export interface RuntimeTrace<T extends RuntimeTraceType = RuntimeTraceType, P = unknown> {
|
|
60
56
|
type: T;
|
|
61
57
|
payload: P;
|
|
62
58
|
}
|
|
63
|
-
export declare const isRuntimeTrace: (value: unknown) => value is RuntimeTrace<"
|
|
59
|
+
export declare const isRuntimeTrace: (value: unknown) => value is RuntimeTrace<"speak" | "text" | "choice" | "card" | "visual" | "audio" | "payload" | "stream" | "end", unknown>;
|
|
64
60
|
export interface CardTracePayload {
|
|
65
61
|
card: {
|
|
66
62
|
type: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.interface.d.ts","sourceRoot":"","sources":["../../../src/runtime/runtime.interface.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime.interface.d.ts","sourceRoot":"","sources":["../../../src/runtime/runtime.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,aAAK,OAAO,GAAG,CAAC,GAAG,UAAU,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAEtD,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,UAAU,GAAG,YAAY;IAC3D,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,CAAC,CAAC;IAEV;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,UAAU;IACzB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,oBAAoB,YACtB,eAAe,QAAQ,UAAU,GAAG,YAAY,CAAC,CAAC,0CAG5D,CAAC;AAEF,eAAO,MAAM,sBAAsB,YACxB,eAAe,QAAQ,UAAU,GAAG,YAAY,CAAC,CAAC,4CAG5D,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,aAAa,CAAC;I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
2
3
|
return !!options?.verify?.authorization;
|
|
3
4
|
};
|
|
4
5
|
export const isPublicRuntimeOptions = (options) => {
|
|
5
6
|
return typeof options?.verify?.projectID === 'string';
|
|
6
7
|
};
|
|
7
|
-
export const
|
|
8
|
-
export const
|
|
9
|
-
export const isRuntimeAction = (value) => typeof value === 'object' &&
|
|
10
|
-
Object.prototype.hasOwnProperty.call(value, 'type') &&
|
|
11
|
-
isRuntimeActionType(value.type);
|
|
12
|
-
export const isIntentAction = (value) => isRuntimeAction(value) && value.type === 'intent';
|
|
8
|
+
export const isRuntimeAction = (value) => typeof value === 'object' && Object.prototype.hasOwnProperty.call(value, 'type');
|
|
9
|
+
export const ActionType = BaseRequest.RequestType;
|
|
13
10
|
export const createIntentAction = (payload) => ({
|
|
14
|
-
type:
|
|
11
|
+
type: ActionType.INTENT,
|
|
15
12
|
payload,
|
|
16
13
|
});
|
|
17
14
|
export const RuntimeTraceTypeSet = new Set([
|
|
@@ -4,5 +4,5 @@ export interface TraceComponentOverload<Trace extends RuntimeTrace> {
|
|
|
4
4
|
<Context>(declaration: TraceDeclaration<Context, Trace>): Required<TraceDeclaration<Context, Trace>>;
|
|
5
5
|
<Context>(handle: TraceAccumulator<Context, Trace>): Required<TraceDeclaration<Context, Trace>>;
|
|
6
6
|
}
|
|
7
|
-
export declare const createTraceComponent: <Trace extends RuntimeTrace<"
|
|
7
|
+
export declare const createTraceComponent: <Trace extends RuntimeTrace<"speak" | "text" | "choice" | "card" | "visual" | "audio" | "payload" | "stream" | "end", unknown>>(type: Trace["type"]) => TraceComponentOverload<Trace>;
|
|
8
8
|
//# sourceMappingURL=trace.component.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voiceflow/sdk-runtime",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"import": "./build/esm/main.js",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "654c6cb5aaa1b24328e43a0b5db33c20f4ca1c43"
|
|
45
45
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { BaseRequest } from '@voiceflow/base-types';
|
|
2
|
+
|
|
1
3
|
// Super broad type so that differing fetch types (ex. builtin, node-fetch, etc.) don't conflict with it
|
|
2
4
|
type FetchFn = (...parameters: any[]) => Promise<any>;
|
|
3
5
|
|
|
@@ -45,22 +47,16 @@ export interface RuntimeInteractResponse {
|
|
|
45
47
|
trace: RuntimeTrace[];
|
|
46
48
|
}
|
|
47
49
|
|
|
48
|
-
export
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
export interface RuntimeAction<T extends RuntimeActionType = RuntimeActionType, P = unknown> {
|
|
56
|
-
type: T;
|
|
57
|
-
payload: P;
|
|
58
|
-
}
|
|
50
|
+
export type RuntimeAction =
|
|
51
|
+
| BaseRequest.TextRequest
|
|
52
|
+
| BaseRequest.LaunchRequest
|
|
53
|
+
| BaseRequest.IntentRequest
|
|
54
|
+
| BaseRequest.ActionRequest
|
|
55
|
+
| BaseRequest.GeneralRequest
|
|
56
|
+
| BaseRequest.BaseRequest<unknown>;
|
|
59
57
|
|
|
60
58
|
export const isRuntimeAction = (value: unknown): value is RuntimeAction =>
|
|
61
|
-
typeof value === 'object' &&
|
|
62
|
-
Object.prototype.hasOwnProperty.call(value, 'type') &&
|
|
63
|
-
isRuntimeActionType((value as any).type);
|
|
59
|
+
typeof value === 'object' && Object.prototype.hasOwnProperty.call(value, 'type');
|
|
64
60
|
|
|
65
61
|
export interface IntentActionPayload {
|
|
66
62
|
query: string;
|
|
@@ -69,13 +65,12 @@ export interface IntentActionPayload {
|
|
|
69
65
|
confidence?: number;
|
|
70
66
|
}
|
|
71
67
|
|
|
72
|
-
export type IntentAction =
|
|
73
|
-
|
|
74
|
-
export const
|
|
75
|
-
isRuntimeAction(value) && value.type === 'intent';
|
|
68
|
+
export type IntentAction = BaseRequest.IntentRequest;
|
|
69
|
+
export type ActionType = BaseRequest.RequestType;
|
|
70
|
+
export const ActionType = BaseRequest.RequestType;
|
|
76
71
|
|
|
77
|
-
export const createIntentAction = (payload:
|
|
78
|
-
type:
|
|
72
|
+
export const createIntentAction = (payload: BaseRequest.IntentRequestPayload): BaseRequest.IntentRequest => ({
|
|
73
|
+
type: ActionType.INTENT,
|
|
79
74
|
payload,
|
|
80
75
|
});
|
|
81
76
|
|