@voiceflow/sdk-runtime 1.8.2 → 1.9.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/build/cjs/runtime/index.d.ts +1 -0
- package/build/cjs/runtime/index.d.ts.map +1 -1
- package/build/cjs/runtime/index.js +1 -0
- package/build/cjs/runtime/runtime.interface.d.ts +11 -3
- package/build/cjs/runtime/runtime.interface.d.ts.map +1 -1
- package/build/cjs/runtime/runtime.interface.js +7 -1
- package/build/cjs/runtime/runtime.service.prototype.d.ts +12 -0
- package/build/cjs/runtime/runtime.service.prototype.d.ts.map +1 -0
- package/build/cjs/runtime/runtime.service.prototype.js +37 -0
- package/build/cjs/sdk/sdk.service.d.ts.map +1 -1
- package/build/cjs/sdk/sdk.service.js +4 -1
- package/build/esm/runtime/index.d.ts +1 -0
- package/build/esm/runtime/index.d.ts.map +1 -1
- package/build/esm/runtime/index.js +1 -0
- package/build/esm/runtime/runtime.interface.d.ts +11 -3
- package/build/esm/runtime/runtime.interface.d.ts.map +1 -1
- package/build/esm/runtime/runtime.interface.js +5 -0
- package/build/esm/runtime/runtime.service.prototype.d.ts +12 -0
- package/build/esm/runtime/runtime.service.prototype.d.ts.map +1 -0
- package/build/esm/runtime/runtime.service.prototype.js +33 -0
- package/build/esm/sdk/sdk.service.d.ts.map +1 -1
- package/build/esm/sdk/sdk.service.js +5 -2
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC"}
|
|
@@ -17,4 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./runtime.interface"), exports);
|
|
18
18
|
__exportStar(require("./runtime.service"), exports);
|
|
19
19
|
__exportStar(require("./runtime.service.auth"), exports);
|
|
20
|
+
__exportStar(require("./runtime.service.prototype"), exports);
|
|
20
21
|
__exportStar(require("./runtime.service.public"), exports);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseRequest, Trace } from '@voiceflow/base-types';
|
|
2
2
|
export { Trace } from '@voiceflow/base-types';
|
|
3
3
|
type FetchFn = (...parameters: any[]) => Promise<any>;
|
|
4
|
-
export interface RuntimeOptions<V = AuthVerify | PublicVerify> {
|
|
4
|
+
export interface RuntimeOptions<V = AuthVerify | PublicVerify | PrototypeVerify> {
|
|
5
5
|
url: string;
|
|
6
6
|
verify: V;
|
|
7
7
|
/**
|
|
@@ -16,8 +16,15 @@ export interface AuthVerify {
|
|
|
16
16
|
export interface PublicVerify {
|
|
17
17
|
projectID: string;
|
|
18
18
|
}
|
|
19
|
-
export
|
|
20
|
-
|
|
19
|
+
export interface PrototypeVerify {
|
|
20
|
+
projectID: string;
|
|
21
|
+
versionID: string;
|
|
22
|
+
prototype: true;
|
|
23
|
+
}
|
|
24
|
+
export type AnyVerify = Partial<AuthVerify & PublicVerify & PrototypeVerify>;
|
|
25
|
+
export declare const isAuthRuntimeOptions: (options: RuntimeOptions<AnyVerify>) => options is RuntimeOptions<AuthVerify>;
|
|
26
|
+
export declare const isPublicRuntimeOptions: (options: RuntimeOptions<AnyVerify>) => options is RuntimeOptions<PublicVerify>;
|
|
27
|
+
export declare const isPrototypeRuntimeOptions: (options: RuntimeOptions<AnyVerify>) => options is RuntimeOptions<PrototypeVerify>;
|
|
21
28
|
export interface RuntimeInteractRequest {
|
|
22
29
|
action: RuntimeAction;
|
|
23
30
|
sessionID: string;
|
|
@@ -53,6 +60,7 @@ export type ActionType = BaseRequest.RequestType;
|
|
|
53
60
|
export declare const ActionType: typeof BaseRequest.RequestType;
|
|
54
61
|
export declare const createIntentAction: (payload: BaseRequest.IntentRequestPayload) => BaseRequest.IntentRequest;
|
|
55
62
|
export interface RuntimeState {
|
|
63
|
+
turn: Record<string, any>;
|
|
56
64
|
storage: Record<string, any>;
|
|
57
65
|
variables: Record<string, any>;
|
|
58
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.interface.d.ts","sourceRoot":"","sources":["../../../src/runtime/runtime.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAG9C,KAAK,OAAO,GAAG,CAAC,GAAG,UAAU,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAEtD,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,UAAU,GAAG,YAAY;
|
|
1
|
+
{"version":3,"file":"runtime.interface.d.ts","sourceRoot":"","sources":["../../../src/runtime/runtime.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAG9C,KAAK,OAAO,GAAG,CAAC,GAAG,UAAU,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAEtD,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,UAAU,GAAG,YAAY,GAAG,eAAe;IAC7E,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;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,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACzB,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC5C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,aAAa,CAAC;AACrD,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,CAAC;AACjD,eAAO,MAAM,UAAU,gCAA0B,CAAC;AAElD,eAAO,MAAM,kBAAkB,YAAa,YAAY,oBAAoB,KAAG,YAAY,aAGzF,CAAC;AAEH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAChC;AAED,eAAO,MAAM,kBAAkB,UAAW,OAAO,6BACoC,CAAC;AAEtF,eAAO,MAAM,cAAc,UAAW,OAAO,gLAGJ,CAAC;AAE1C,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,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isRuntimeTrace = exports.isRuntimeTraceType = exports.createIntentAction = exports.ActionType = exports.isRuntimeAction = exports.isPublicRuntimeOptions = exports.isAuthRuntimeOptions = exports.Trace = void 0;
|
|
3
|
+
exports.isRuntimeTrace = exports.isRuntimeTraceType = exports.createIntentAction = exports.ActionType = exports.isRuntimeAction = exports.isPrototypeRuntimeOptions = exports.isPublicRuntimeOptions = exports.isAuthRuntimeOptions = exports.Trace = void 0;
|
|
4
4
|
const base_types_1 = require("@voiceflow/base-types");
|
|
5
5
|
var base_types_2 = require("@voiceflow/base-types");
|
|
6
6
|
Object.defineProperty(exports, "Trace", { enumerable: true, get: function () { return base_types_2.Trace; } });
|
|
@@ -12,6 +12,12 @@ const isPublicRuntimeOptions = (options) => {
|
|
|
12
12
|
return typeof options?.verify?.projectID === 'string';
|
|
13
13
|
};
|
|
14
14
|
exports.isPublicRuntimeOptions = isPublicRuntimeOptions;
|
|
15
|
+
const isPrototypeRuntimeOptions = (options) => {
|
|
16
|
+
return (options?.verify?.prototype === true &&
|
|
17
|
+
typeof options?.verify?.versionID === 'string' &&
|
|
18
|
+
typeof options?.verify?.projectID === 'string');
|
|
19
|
+
};
|
|
20
|
+
exports.isPrototypeRuntimeOptions = isPrototypeRuntimeOptions;
|
|
15
21
|
const isRuntimeAction = (value) => typeof value === 'object' && Object.prototype.hasOwnProperty.call(value, 'type');
|
|
16
22
|
exports.isRuntimeAction = isRuntimeAction;
|
|
17
23
|
exports.ActionType = base_types_1.BaseRequest.RequestType;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PrototypeVerify, RuntimeInteractRequest, RuntimeInteractResponse, RuntimeOptions } from '../runtime/runtime.interface';
|
|
2
|
+
import { RuntimeService } from '../runtime/runtime.service';
|
|
3
|
+
export declare class PrototypeRuntimeService extends RuntimeService {
|
|
4
|
+
private state;
|
|
5
|
+
private readonly versionID;
|
|
6
|
+
constructor(options: RuntimeOptions<PrototypeVerify>);
|
|
7
|
+
interact(request: RuntimeInteractRequest): Promise<RuntimeInteractResponse>;
|
|
8
|
+
feedback(): Promise<never>;
|
|
9
|
+
getPublishing(): Promise<never>;
|
|
10
|
+
createTranscript(): Promise<never>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=runtime.service.prototype.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.service.prototype.d.ts","sourceRoot":"","sources":["../../../src/runtime/runtime.service.prototype.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,cAAc,EAEf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,qBAAa,uBAAwB,SAAQ,cAAc;IACzD,OAAO,CAAC,KAAK,CAIX;IAEF,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEhB,OAAO,EAAE,cAAc,CAAC,eAAe,CAAC;IAM9C,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAc3E,QAAQ;IAKd,aAAa;IAKb,gBAAgB;CAGxB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PrototypeRuntimeService = void 0;
|
|
4
|
+
const runtime_service_1 = require("../runtime/runtime.service");
|
|
5
|
+
class PrototypeRuntimeService extends runtime_service_1.RuntimeService {
|
|
6
|
+
constructor(options) {
|
|
7
|
+
super(options);
|
|
8
|
+
this.state = {
|
|
9
|
+
turn: {},
|
|
10
|
+
storage: {},
|
|
11
|
+
variables: {},
|
|
12
|
+
};
|
|
13
|
+
this.versionID = options.verify.versionID;
|
|
14
|
+
}
|
|
15
|
+
async interact(request) {
|
|
16
|
+
const { action, config, sessionID } = request;
|
|
17
|
+
const result = await this.send(`interact/${this.versionID}`, {
|
|
18
|
+
body: { state: this.state, request: action, config },
|
|
19
|
+
method: 'POST',
|
|
20
|
+
headers: { sessionID, platform: 'chat-prototype' },
|
|
21
|
+
});
|
|
22
|
+
this.state = result.state;
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
async feedback() {
|
|
26
|
+
return Promise.reject(new Error('not implemented'));
|
|
27
|
+
}
|
|
28
|
+
// TODO: expose authenticated publishing
|
|
29
|
+
getPublishing() {
|
|
30
|
+
return Promise.reject(new Error('not implemented'));
|
|
31
|
+
}
|
|
32
|
+
// TODO: expose authenticated createTranscript
|
|
33
|
+
createTranscript() {
|
|
34
|
+
return Promise.reject(new Error('not implemented'));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.PrototypeRuntimeService = PrototypeRuntimeService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.service.d.ts","sourceRoot":"","sources":["../../../src/sdk/sdk.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"sdk.service.d.ts","sourceRoot":"","sources":["../../../src/sdk/sdk.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAShG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D,qBAAa,gBAAgB,CAAC,CAAC;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiB;IAEzC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAkB;gBAErB,OAAO,EAAE,uBAAuB,CAAC,CAAC,CAAC;IAc/C,YAAY,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC,EAAE,GAAG,CAAC;IAKrC,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,CAAC,CAAC;IAKjE,QAAQ,CAAC,OAAO,EAAE,sBAAsB;IAIxC,aAAa,CAAC,GAAG,OAAO,EAAE,UAAU,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;IAIrE,gBAAgB,CAAC,GAAG,OAAO,EAAE,UAAU,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC;CAGzF"}
|
|
@@ -6,7 +6,10 @@ const trace_service_1 = require("../trace/trace.service");
|
|
|
6
6
|
class VoiceflowRuntime {
|
|
7
7
|
constructor(options) {
|
|
8
8
|
this.trace = new trace_service_1.TraceService(options);
|
|
9
|
-
if ((0, runtime_1.
|
|
9
|
+
if ((0, runtime_1.isPrototypeRuntimeOptions)(options)) {
|
|
10
|
+
this.runtime = new runtime_1.PrototypeRuntimeService(options);
|
|
11
|
+
}
|
|
12
|
+
else if ((0, runtime_1.isAuthRuntimeOptions)(options)) {
|
|
10
13
|
this.runtime = new runtime_1.AuthRuntimeService(options);
|
|
11
14
|
}
|
|
12
15
|
else if ((0, runtime_1.isPublicRuntimeOptions)(options)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseRequest, Trace } from '@voiceflow/base-types';
|
|
2
2
|
export { Trace } from '@voiceflow/base-types';
|
|
3
3
|
type FetchFn = (...parameters: any[]) => Promise<any>;
|
|
4
|
-
export interface RuntimeOptions<V = AuthVerify | PublicVerify> {
|
|
4
|
+
export interface RuntimeOptions<V = AuthVerify | PublicVerify | PrototypeVerify> {
|
|
5
5
|
url: string;
|
|
6
6
|
verify: V;
|
|
7
7
|
/**
|
|
@@ -16,8 +16,15 @@ export interface AuthVerify {
|
|
|
16
16
|
export interface PublicVerify {
|
|
17
17
|
projectID: string;
|
|
18
18
|
}
|
|
19
|
-
export
|
|
20
|
-
|
|
19
|
+
export interface PrototypeVerify {
|
|
20
|
+
projectID: string;
|
|
21
|
+
versionID: string;
|
|
22
|
+
prototype: true;
|
|
23
|
+
}
|
|
24
|
+
export type AnyVerify = Partial<AuthVerify & PublicVerify & PrototypeVerify>;
|
|
25
|
+
export declare const isAuthRuntimeOptions: (options: RuntimeOptions<AnyVerify>) => options is RuntimeOptions<AuthVerify>;
|
|
26
|
+
export declare const isPublicRuntimeOptions: (options: RuntimeOptions<AnyVerify>) => options is RuntimeOptions<PublicVerify>;
|
|
27
|
+
export declare const isPrototypeRuntimeOptions: (options: RuntimeOptions<AnyVerify>) => options is RuntimeOptions<PrototypeVerify>;
|
|
21
28
|
export interface RuntimeInteractRequest {
|
|
22
29
|
action: RuntimeAction;
|
|
23
30
|
sessionID: string;
|
|
@@ -53,6 +60,7 @@ export type ActionType = BaseRequest.RequestType;
|
|
|
53
60
|
export declare const ActionType: typeof BaseRequest.RequestType;
|
|
54
61
|
export declare const createIntentAction: (payload: BaseRequest.IntentRequestPayload) => BaseRequest.IntentRequest;
|
|
55
62
|
export interface RuntimeState {
|
|
63
|
+
turn: Record<string, any>;
|
|
56
64
|
storage: Record<string, any>;
|
|
57
65
|
variables: Record<string, any>;
|
|
58
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.interface.d.ts","sourceRoot":"","sources":["../../../src/runtime/runtime.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAG9C,KAAK,OAAO,GAAG,CAAC,GAAG,UAAU,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAEtD,MAAM,WAAW,cAAc,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AkB,UAAW,OAAO,6BACoC,CAAC;AAEtF,eAAO,MAAM,cAAc,UAAW,OAAO,gLAGJ,CAAC;AAE1C,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"}
|
|
@@ -6,6 +6,11 @@ export const isAuthRuntimeOptions = (options) => {
|
|
|
6
6
|
export const isPublicRuntimeOptions = (options) => {
|
|
7
7
|
return typeof options?.verify?.projectID === 'string';
|
|
8
8
|
};
|
|
9
|
+
export const isPrototypeRuntimeOptions = (options) => {
|
|
10
|
+
return (options?.verify?.prototype === true &&
|
|
11
|
+
typeof options?.verify?.versionID === 'string' &&
|
|
12
|
+
typeof options?.verify?.projectID === 'string');
|
|
13
|
+
};
|
|
9
14
|
export const isRuntimeAction = (value) => typeof value === 'object' && Object.prototype.hasOwnProperty.call(value, 'type');
|
|
10
15
|
export const ActionType = BaseRequest.RequestType;
|
|
11
16
|
export const createIntentAction = (payload) => ({
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PrototypeVerify, RuntimeInteractRequest, RuntimeInteractResponse, RuntimeOptions } from '../runtime/runtime.interface.js';
|
|
2
|
+
import { RuntimeService } from '../runtime/runtime.service.js';
|
|
3
|
+
export declare class PrototypeRuntimeService extends RuntimeService {
|
|
4
|
+
private state;
|
|
5
|
+
private readonly versionID;
|
|
6
|
+
constructor(options: RuntimeOptions<PrototypeVerify>);
|
|
7
|
+
interact(request: RuntimeInteractRequest): Promise<RuntimeInteractResponse>;
|
|
8
|
+
feedback(): Promise<never>;
|
|
9
|
+
getPublishing(): Promise<never>;
|
|
10
|
+
createTranscript(): Promise<never>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=runtime.service.prototype.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.service.prototype.d.ts","sourceRoot":"","sources":["../../../src/runtime/runtime.service.prototype.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,sBAAsB,EACtB,uBAAuB,EACvB,cAAc,EAEf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,qBAAa,uBAAwB,SAAQ,cAAc;IACzD,OAAO,CAAC,KAAK,CAIX;IAEF,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEhB,OAAO,EAAE,cAAc,CAAC,eAAe,CAAC;IAM9C,QAAQ,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAc3E,QAAQ;IAKd,aAAa;IAKb,gBAAgB;CAGxB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { RuntimeService } from '../runtime/runtime.service.js';
|
|
2
|
+
export class PrototypeRuntimeService extends RuntimeService {
|
|
3
|
+
constructor(options) {
|
|
4
|
+
super(options);
|
|
5
|
+
this.state = {
|
|
6
|
+
turn: {},
|
|
7
|
+
storage: {},
|
|
8
|
+
variables: {},
|
|
9
|
+
};
|
|
10
|
+
this.versionID = options.verify.versionID;
|
|
11
|
+
}
|
|
12
|
+
async interact(request) {
|
|
13
|
+
const { action, config, sessionID } = request;
|
|
14
|
+
const result = await this.send(`interact/${this.versionID}`, {
|
|
15
|
+
body: { state: this.state, request: action, config },
|
|
16
|
+
method: 'POST',
|
|
17
|
+
headers: { sessionID, platform: 'chat-prototype' },
|
|
18
|
+
});
|
|
19
|
+
this.state = result.state;
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
async feedback() {
|
|
23
|
+
return Promise.reject(new Error('not implemented'));
|
|
24
|
+
}
|
|
25
|
+
// TODO: expose authenticated publishing
|
|
26
|
+
getPublishing() {
|
|
27
|
+
return Promise.reject(new Error('not implemented'));
|
|
28
|
+
}
|
|
29
|
+
// TODO: expose authenticated createTranscript
|
|
30
|
+
createTranscript() {
|
|
31
|
+
return Promise.reject(new Error('not implemented'));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.service.d.ts","sourceRoot":"","sources":["../../../src/sdk/sdk.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"sdk.service.d.ts","sourceRoot":"","sources":["../../../src/sdk/sdk.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAShG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D,qBAAa,gBAAgB,CAAC,CAAC;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiB;IAEzC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAkB;gBAErB,OAAO,EAAE,uBAAuB,CAAC,CAAC,CAAC;IAc/C,YAAY,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC,EAAE,GAAG,CAAC;IAKrC,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,CAAC,CAAC;IAKjE,QAAQ,CAAC,OAAO,EAAE,sBAAsB;IAIxC,aAAa,CAAC,GAAG,OAAO,EAAE,UAAU,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;IAIrE,gBAAgB,CAAC,GAAG,OAAO,EAAE,UAAU,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC;CAGzF"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { AuthRuntimeService, isAuthRuntimeOptions, isPublicRuntimeOptions, PublicRuntimeService } from '../runtime/index.js';
|
|
1
|
+
import { AuthRuntimeService, isAuthRuntimeOptions, isPrototypeRuntimeOptions, isPublicRuntimeOptions, PrototypeRuntimeService, PublicRuntimeService, } from '../runtime/index.js';
|
|
2
2
|
import { TraceService } from '../trace/trace.service.js';
|
|
3
3
|
export class VoiceflowRuntime {
|
|
4
4
|
constructor(options) {
|
|
5
5
|
this.trace = new TraceService(options);
|
|
6
|
-
if (
|
|
6
|
+
if (isPrototypeRuntimeOptions(options)) {
|
|
7
|
+
this.runtime = new PrototypeRuntimeService(options);
|
|
8
|
+
}
|
|
9
|
+
else if (isAuthRuntimeOptions(options)) {
|
|
7
10
|
this.runtime = new AuthRuntimeService(options);
|
|
8
11
|
}
|
|
9
12
|
else if (isPublicRuntimeOptions(options)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voiceflow/sdk-runtime",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"import": "./build/esm/main.js",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "f9dbb16f2074fda039a798336cbc6bb67bd240e0"
|
|
42
42
|
}
|