@voiceflow/sdk-runtime 1.30.0 → 1.31.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/main.d.ts +1 -1
- package/build/cjs/main.d.ts.map +1 -1
- package/build/cjs/main.js +3 -0
- package/build/cjs/main.js.map +1 -1
- package/build/cjs/v2/base-runtime.client.d.ts +12 -0
- package/build/cjs/v2/base-runtime.client.d.ts.map +1 -0
- package/build/cjs/v2/base-runtime.client.js +37 -0
- package/build/cjs/v2/base-runtime.client.js.map +1 -0
- package/build/cjs/v2/private-runtime.client.d.ts +5 -10
- package/build/cjs/v2/private-runtime.client.d.ts.map +1 -1
- package/build/cjs/v2/private-runtime.client.js +29 -30
- package/build/cjs/v2/private-runtime.client.js.map +1 -1
- package/build/cjs/v2/public-runtime.client.d.ts +3 -8
- package/build/cjs/v2/public-runtime.client.d.ts.map +1 -1
- package/build/cjs/v2/public-runtime.client.js +2 -8
- package/build/cjs/v2/public-runtime.client.js.map +1 -1
- package/build/cjs/v2/runtime.interface.d.ts +22 -9
- package/build/cjs/v2/runtime.interface.d.ts.map +1 -1
- package/build/cjs/v2/runtime.interface.js +9 -2
- package/build/cjs/v2/runtime.interface.js.map +1 -1
- package/build/cjs/v2/runtime.utils.d.ts +2 -0
- package/build/cjs/v2/runtime.utils.d.ts.map +1 -0
- package/build/cjs/v2/runtime.utils.js +9 -0
- package/build/cjs/v2/runtime.utils.js.map +1 -0
- package/build/cjs/v2/shareable-link-runtime.client.d.ts +3 -7
- package/build/cjs/v2/shareable-link-runtime.client.d.ts.map +1 -1
- package/build/cjs/v2/shareable-link-runtime.client.js +2 -7
- package/build/cjs/v2/shareable-link-runtime.client.js.map +1 -1
- package/build/cjs/v2/websocket-runtime/websocket-runtime.client.d.ts +5 -9
- package/build/cjs/v2/websocket-runtime/websocket-runtime.client.d.ts.map +1 -1
- package/build/cjs/v2/websocket-runtime/websocket-runtime.client.js +79 -23
- package/build/cjs/v2/websocket-runtime/websocket-runtime.client.js.map +1 -1
- package/build/esm/main.d.ts +1 -1
- package/build/esm/main.d.ts.map +1 -1
- package/build/esm/main.js +1 -0
- package/build/esm/main.js.map +1 -1
- package/build/esm/v2/base-runtime.client.d.ts +12 -0
- package/build/esm/v2/base-runtime.client.d.ts.map +1 -0
- package/build/esm/v2/base-runtime.client.js +33 -0
- package/build/esm/v2/base-runtime.client.js.map +1 -0
- package/build/esm/v2/private-runtime.client.d.ts +5 -10
- package/build/esm/v2/private-runtime.client.d.ts.map +1 -1
- package/build/esm/v2/private-runtime.client.js +29 -30
- package/build/esm/v2/private-runtime.client.js.map +1 -1
- package/build/esm/v2/public-runtime.client.d.ts +3 -8
- package/build/esm/v2/public-runtime.client.d.ts.map +1 -1
- package/build/esm/v2/public-runtime.client.js +2 -8
- package/build/esm/v2/public-runtime.client.js.map +1 -1
- package/build/esm/v2/runtime.interface.d.ts +22 -9
- package/build/esm/v2/runtime.interface.d.ts.map +1 -1
- package/build/esm/v2/runtime.interface.js +8 -1
- package/build/esm/v2/runtime.interface.js.map +1 -1
- package/build/esm/v2/runtime.utils.d.ts +2 -0
- package/build/esm/v2/runtime.utils.d.ts.map +1 -0
- package/build/esm/v2/runtime.utils.js +5 -0
- package/build/esm/v2/runtime.utils.js.map +1 -0
- package/build/esm/v2/shareable-link-runtime.client.d.ts +3 -7
- package/build/esm/v2/shareable-link-runtime.client.d.ts.map +1 -1
- package/build/esm/v2/shareable-link-runtime.client.js +2 -7
- package/build/esm/v2/shareable-link-runtime.client.js.map +1 -1
- package/build/esm/v2/websocket-runtime/websocket-runtime.client.d.ts +5 -9
- package/build/esm/v2/websocket-runtime/websocket-runtime.client.d.ts.map +1 -1
- package/build/esm/v2/websocket-runtime/websocket-runtime.client.js +80 -24
- package/build/esm/v2/websocket-runtime/websocket-runtime.client.js.map +1 -1
- package/package.json +2 -2
package/build/cjs/main.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export * from './trace';
|
|
|
4
4
|
export * from './v2/private-runtime.client';
|
|
5
5
|
export * from './v2/public-runtime.client';
|
|
6
6
|
export type { RuntimeInteractStreamRequest } from './v2/runtime.interface';
|
|
7
|
-
export { IRuntimeClient } from './v2/runtime.interface';
|
|
7
|
+
export { IRuntimeClient, RuntimeLogStatus } from './v2/runtime.interface';
|
|
8
8
|
export * from './v2/shareable-link-runtime.client';
|
|
9
9
|
export * from './v2/websocket-runtime/websocket-runtime.client';
|
|
10
10
|
export * from './v2/websocket-runtime/websocket-runtime.interface';
|
package/build/cjs/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,YAAY,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,YAAY,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1E,cAAc,oCAAoC,CAAC;AACnD,cAAc,iDAAiD,CAAC;AAChE,cAAc,oDAAoD,CAAC"}
|
package/build/cjs/main.js
CHANGED
|
@@ -14,11 +14,14 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.RuntimeLogStatus = void 0;
|
|
17
18
|
__exportStar(require("./runtime"), exports);
|
|
18
19
|
__exportStar(require("./sdk"), exports);
|
|
19
20
|
__exportStar(require("./trace"), exports);
|
|
20
21
|
__exportStar(require("./v2/private-runtime.client"), exports);
|
|
21
22
|
__exportStar(require("./v2/public-runtime.client"), exports);
|
|
23
|
+
var runtime_interface_1 = require("./v2/runtime.interface");
|
|
24
|
+
Object.defineProperty(exports, "RuntimeLogStatus", { enumerable: true, get: function () { return runtime_interface_1.RuntimeLogStatus; } });
|
|
22
25
|
__exportStar(require("./v2/shareable-link-runtime.client"), exports);
|
|
23
26
|
__exportStar(require("./v2/websocket-runtime/websocket-runtime.client"), exports);
|
|
24
27
|
__exportStar(require("./v2/websocket-runtime/websocket-runtime.interface"), exports);
|
package/build/cjs/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,wCAAsB;AACtB,0CAAwB;AACxB,8DAA4C;AAC5C,6DAA2C;AAE3C,4DAA0E;AAAjD,qHAAA,gBAAgB,OAAA;AACzC,qEAAmD;AACnD,kFAAgE;AAChE,qFAAmE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FetchClient } from '@voiceflow/fetch';
|
|
2
|
+
import type { IRuntimeClient, RuntimeClientOptions, RuntimeInteractStreamRequest, RuntimeLog } from './runtime.interface';
|
|
3
|
+
import { TraceService } from './trace.service';
|
|
4
|
+
export declare class BaseRuntimeClient<T> implements IRuntimeClient<T> {
|
|
5
|
+
protected readonly options: RuntimeClientOptions<T>;
|
|
6
|
+
protected readonly trace: TraceService<T>;
|
|
7
|
+
protected readonly fetch: FetchClient<RequestInit, Request | URL, Response>;
|
|
8
|
+
constructor(options: RuntimeClientOptions<T>, trace?: TraceService<T>, fetch?: FetchClient<RequestInit, Request | URL, Response>);
|
|
9
|
+
log: ({ error, status, source, message, version, projectID, additionalProperties }: RuntimeLog) => Promise<void>;
|
|
10
|
+
interactStream(_createContext: () => T, _request: RuntimeInteractStreamRequest): Promise<ReadableStream<T>>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=base-runtime.client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-runtime.client.d.ts","sourceRoot":"","sources":["../../../src/v2/base-runtime.client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,4BAA4B,EAC5B,UAAU,EACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,qBAAa,iBAAiB,CAAC,CAAC,CAAE,YAAW,cAAc,CAAC,CAAC,CAAC;IAE1D,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC;IACnD,SAAS,CAAC,QAAQ,CAAC,KAAK;IACxB,SAAS,CAAC,QAAQ,CAAC,KAAK;gBAFL,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,EAChC,KAAK,kBAA+C,EACpD,KAAK,oDAAgD;IAGnE,GAAG,iFAAwF,UAAU,mBAmB1G;IAEW,cAAc,CACzB,cAAc,EAAE,MAAM,CAAC,EACvB,QAAQ,EAAE,4BAA4B,GACrC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;CAG9B"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseRuntimeClient = void 0;
|
|
4
|
+
const fetch_1 = require("@voiceflow/fetch");
|
|
5
|
+
const trace_service_1 = require("./trace.service");
|
|
6
|
+
class BaseRuntimeClient {
|
|
7
|
+
constructor(options, trace = new trace_service_1.TraceService({ traces: options.traces }), fetch = new fetch_1.FetchClient({ baseURL: options.baseURL })) {
|
|
8
|
+
this.options = options;
|
|
9
|
+
this.trace = trace;
|
|
10
|
+
this.fetch = fetch;
|
|
11
|
+
this.log = async ({ error, status, source, message, version, projectID, additionalProperties }) => {
|
|
12
|
+
this.fetch
|
|
13
|
+
.post(`/v1alpha1/webchat-log/${projectID}`, {
|
|
14
|
+
json: {
|
|
15
|
+
status,
|
|
16
|
+
source,
|
|
17
|
+
message,
|
|
18
|
+
version,
|
|
19
|
+
additionalProperties: {
|
|
20
|
+
...additionalProperties,
|
|
21
|
+
date: Date.now(),
|
|
22
|
+
error: error instanceof Error ? { name: error.name, stack: error.stack, message: error.message } : error,
|
|
23
|
+
hostname: globalThis.location.hostname,
|
|
24
|
+
userAgent: globalThis.navigator.userAgent,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
})
|
|
28
|
+
// eslint-disable-next-line no-console
|
|
29
|
+
.catch((error) => console.debug('Failed to log', error));
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
async interactStream(_createContext, _request) {
|
|
33
|
+
return Promise.reject(new Error('Not implemented'));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.BaseRuntimeClient = BaseRuntimeClient;
|
|
37
|
+
//# sourceMappingURL=base-runtime.client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-runtime.client.js","sourceRoot":"","sources":["../../../src/v2/base-runtime.client.ts"],"names":[],"mappings":";;;AAAA,4CAA+C;AAQ/C,mDAA+C;AAE/C,MAAa,iBAAiB;IAC5B,YACqB,OAAgC,EAChC,QAAQ,IAAI,4BAAY,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CA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2
|
-
import type { IRuntimeClient,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
private readonly options;
|
|
6
|
-
private readonly trace;
|
|
7
|
-
private readonly fetch;
|
|
8
|
-
private state;
|
|
9
|
-
constructor(options: RuntimeClientOptions<T>, trace?: TraceService<T>, fetch?: FetchClient<RequestInit, Request | URL, Response>);
|
|
1
|
+
import { BaseRuntimeClient } from './base-runtime.client';
|
|
2
|
+
import type { IRuntimeClient, RuntimeInteractStreamRequest } from './runtime.interface';
|
|
3
|
+
export declare class PrivateRuntimeClient<T> extends BaseRuntimeClient<T> implements IRuntimeClient<T> {
|
|
4
|
+
protected state: Record<string, any> | null;
|
|
10
5
|
setState: (context: T, state: Record<string, any>) => void;
|
|
11
6
|
resetState: (state?: Record<string, any> | null) => void;
|
|
12
7
|
patchState: (state: Record<string, any>) => void;
|
|
13
|
-
interactStream(createContext: () => T, { userID, action, projectID, audioEvents, environment, guidedNavigation, }: RuntimeInteractStreamRequest)
|
|
8
|
+
interactStream: (createContext: () => T, { userID, action, projectID, audioEvents, environment, guidedNavigation, }: RuntimeInteractStreamRequest) => Promise<ReadableStream<T>>;
|
|
14
9
|
}
|
|
15
10
|
//# sourceMappingURL=private-runtime.client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-runtime.client.d.ts","sourceRoot":"","sources":["../../../src/v2/private-runtime.client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"private-runtime.client.d.ts","sourceRoot":"","sources":["../../../src/v2/private-runtime.client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG1D,OAAO,KAAK,EAAE,cAAc,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAGxF,qBAAa,oBAAoB,CAAC,CAAC,CAAE,SAAQ,iBAAiB,CAAC,CAAC,CAAE,YAAW,cAAc,CAAC,CAAC,CAAC;IAC5F,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAQ;IAE5C,QAAQ,YAAa,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,UAIvD;IAEK,UAAU,WAAW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,UAEpD;IAEK,UAAU,UAAW,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,UAE7C;IAEc,cAAc,kBACb,MAAM,CAAC,8EAQnB,4BAA4B,gCA2B/B;CACH"}
|
|
@@ -2,16 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PrivateRuntimeClient = void 0;
|
|
4
4
|
const dtos_interact_1 = require("@voiceflow/dtos-interact");
|
|
5
|
-
const fetch_1 = require("@voiceflow/fetch");
|
|
6
5
|
const stream_1 = require("eventsource-parser/stream");
|
|
6
|
+
const base_runtime_client_1 = require("./base-runtime.client");
|
|
7
7
|
const interact_state_stream_1 = require("./interact-state.stream");
|
|
8
8
|
const interact_trace_stream_1 = require("./interact-trace.stream");
|
|
9
|
-
const
|
|
10
|
-
class PrivateRuntimeClient {
|
|
11
|
-
constructor(
|
|
12
|
-
|
|
13
|
-
this.trace = trace;
|
|
14
|
-
this.fetch = fetch;
|
|
9
|
+
const runtime_utils_1 = require("./runtime.utils");
|
|
10
|
+
class PrivateRuntimeClient extends base_runtime_client_1.BaseRuntimeClient {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
15
13
|
this.state = null;
|
|
16
14
|
this.setState = (context, state) => {
|
|
17
15
|
this.state = state;
|
|
@@ -23,29 +21,30 @@ class PrivateRuntimeClient {
|
|
|
23
21
|
this.patchState = (state) => {
|
|
24
22
|
this.state = { ...this.state, ...state };
|
|
25
23
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
24
|
+
this.interactStream = async (createContext, { userID, action, projectID, audioEvents = false, environment, guidedNavigation = false, }) => {
|
|
25
|
+
const audioEncoding = 'audio/pcm';
|
|
26
|
+
const resolvedUserID = (0, runtime_utils_1.getResolvedUserID)(this.state?.variables?.user_id, userID);
|
|
27
|
+
const result = await this.fetch.post(`/v2/project/${projectID}/stateless/interact/stream`, {
|
|
28
|
+
json: { userID: resolvedUserID, action, state: this.state ?? undefined },
|
|
29
|
+
query: new URLSearchParams({
|
|
30
|
+
audio_events: String(audioEvents),
|
|
31
|
+
audio_encoding: String(audioEncoding),
|
|
32
|
+
completion_events: String(true),
|
|
33
|
+
guided_navigation: String(guidedNavigation),
|
|
34
|
+
modality: dtos_interact_1.Modality.CHAT,
|
|
35
|
+
...(environment && { environment }),
|
|
36
|
+
}),
|
|
37
|
+
headers: { authorization: `Bearer ${this.options.authorization}` },
|
|
38
|
+
});
|
|
39
|
+
if (!result.body) {
|
|
40
|
+
throw new Error('interact stream body is empty');
|
|
41
|
+
}
|
|
42
|
+
return result.body
|
|
43
|
+
.pipeThrough(new TextDecoderStream())
|
|
44
|
+
.pipeThrough(new stream_1.EventSourceParserStream())
|
|
45
|
+
.pipeThrough(new interact_state_stream_1.InteractStateStream((state) => this.setState(createContext(), state)))
|
|
46
|
+
.pipeThrough(new interact_trace_stream_1.InteractTraceStream(createContext, this.trace, this.options.onTrace));
|
|
47
|
+
};
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
50
|
exports.PrivateRuntimeClient = PrivateRuntimeClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"private-runtime.client.js","sourceRoot":"","sources":["../../../src/v2/private-runtime.client.ts"],"names":[],"mappings":";;;AAA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SAAS,EAAE;gBACxE,KAAK,EAAE,IAAI,eAAe,CAAC;oBACzB,YAAY,EAAE,MAAM,CAAC,WAAW,CAAC;oBACjC,cAAc,EAAE,MAAM,CAAC,aAAa,CAAC;oBACrC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC;oBAC/B,iBAAiB,EAAE,MAAM,CAAC,gBAAgB,CAAC;oBAC3C,QAAQ,EAAE,wBAAQ,CAAC,IAAI;oBACvB,GAAG,CAAC,WAAW,IAAI,EAAE,WAAW,EAAE,CAAC;iBACpC,CAAC;gBACF,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE;aACnE,CAAC,CAAC;YAEH,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;YACnD,CAAC;YAED,OAAO,MAAM,CAAC,IAAI;iBACf,WAAW,CAAC,IAAI,iBAAiB,EAAE,CAAC;iBACpC,WAAW,CAAC,IAAI,gCAAuB,EAAE,CAAC;iBAC1C,WAAW,CAAC,IAAI,2CAAmB,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC;iBACtF,WAAW,CAAC,IAAI,2CAAmB,CAAI,aAAa,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QAC9F,CAAC,CAAC;IACJ,CAAC;CAAA;AAtDD,oDAsDC"}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { IRuntimeClient,
|
|
3
|
-
|
|
4
|
-
export declare class PublicRuntimeClient<T> implements IRuntimeClient<T> {
|
|
5
|
-
private readonly options;
|
|
6
|
-
private readonly trace;
|
|
7
|
-
private readonly fetch;
|
|
8
|
-
constructor(options: RuntimeClientOptions<T>, trace?: TraceService<T>, fetch?: FetchClient<RequestInit, Request | URL, Response>);
|
|
1
|
+
import { BaseRuntimeClient } from './base-runtime.client';
|
|
2
|
+
import type { IRuntimeClient, RuntimeInteractStreamRequest } from './runtime.interface';
|
|
3
|
+
export declare class PublicRuntimeClient<T> extends BaseRuntimeClient<T> implements IRuntimeClient<T> {
|
|
9
4
|
interactStream(createContext: () => T, { userID, action, projectID, environment, audioEvents }: RuntimeInteractStreamRequest): Promise<ReadableStream<T>>;
|
|
10
5
|
}
|
|
11
6
|
//# sourceMappingURL=public-runtime.client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public-runtime.client.d.ts","sourceRoot":"","sources":["../../../src/v2/public-runtime.client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"public-runtime.client.d.ts","sourceRoot":"","sources":["../../../src/v2/public-runtime.client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAExF,qBAAa,mBAAmB,CAAC,CAAC,CAAE,SAAQ,iBAAiB,CAAC,CAAC,CAAE,YAAW,cAAc,CAAC,CAAC,CAAC;IACrE,cAAc,CAClC,aAAa,EAAE,MAAM,CAAC,EACtB,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,WAAmB,EAAE,EAAE,4BAA4B,GAC5F,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;CA0B9B"}
|
|
@@ -2,16 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PublicRuntimeClient = void 0;
|
|
4
4
|
const dtos_interact_1 = require("@voiceflow/dtos-interact");
|
|
5
|
-
const fetch_1 = require("@voiceflow/fetch");
|
|
6
5
|
const stream_1 = require("eventsource-parser/stream");
|
|
6
|
+
const base_runtime_client_1 = require("./base-runtime.client");
|
|
7
7
|
const interact_trace_stream_1 = require("./interact-trace.stream");
|
|
8
|
-
|
|
9
|
-
class PublicRuntimeClient {
|
|
10
|
-
constructor(options, trace = new trace_service_1.TraceService({ traces: options.traces }), fetch = new fetch_1.FetchClient({ baseURL: options.baseURL })) {
|
|
11
|
-
this.options = options;
|
|
12
|
-
this.trace = trace;
|
|
13
|
-
this.fetch = fetch;
|
|
14
|
-
}
|
|
8
|
+
class PublicRuntimeClient extends base_runtime_client_1.BaseRuntimeClient {
|
|
15
9
|
async interactStream(createContext, { userID, action, projectID, environment, audioEvents = false }) {
|
|
16
10
|
const audioEncoding = 'audio/pcm';
|
|
17
11
|
const result = await this.fetch.post(`/v2/public/project/${projectID}/user/${encodeURIComponent(userID)}/interact/stream`, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public-runtime.client.js","sourceRoot":"","sources":["../../../src/v2/public-runtime.client.ts"],"names":[],"mappings":";;;AAAA,4DAAoD;AACpD,
|
|
1
|
+
{"version":3,"file":"public-runtime.client.js","sourceRoot":"","sources":["../../../src/v2/public-runtime.client.ts"],"names":[],"mappings":";;;AAAA,4DAAoD;AACpD,sDAAoE;AAEpE,+DAA0D;AAC1D,mEAA8D;AAG9D,MAAa,mBAAuB,SAAQ,uCAAoB;IAC9C,KAAK,CAAC,cAAc,CAClC,aAAsB,EACtB,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,GAAG,KAAK,EAAgC;QAE7F,MAAM,aAAa,GAAG,WAAW,CAAC;QAElC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAClC,sBAAsB,SAAS,SAAS,kBAAkB,CAAC,MAAM,CAAC,kBAAkB,EACpF;YACE,IAAI,EAAE,EAAE,MAAM,EAAE;YAChB,KAAK,EAAE,IAAI,eAAe,CAAC;gBACzB,YAAY,EAAE,MAAM,CAAC,WAAW,CAAC;gBACjC,cAAc,EAAE,MAAM,CAAC,aAAa,CAAC;gBACrC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC;gBAC/B,QAAQ,EAAE,wBAAQ,CAAC,IAAI;gBACvB,GAAG,CAAC,WAAW,IAAI,EAAE,WAAW,EAAE,CAAC;aACpC,CAAC;SACH,CACF,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACnD,CAAC;QAED,OAAO,MAAM,CAAC,IAAI;aACf,WAAW,CAAC,IAAI,iBAAiB,EAAE,CAAC;aACpC,WAAW,CAAC,IAAI,gCAAuB,EAAE,CAAC;aAC1C,WAAW,CAAC,IAAI,2CAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACrE,CAAC;CACF;AA9BD,kDA8BC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { AnyTrace } from '@voiceflow/dtos-interact';
|
|
2
2
|
import type { RuntimeAction } from '../runtime';
|
|
3
|
-
import type {
|
|
3
|
+
import type { TraceDeclaration } from '../trace/trace.interface';
|
|
4
4
|
export declare enum Environment {
|
|
5
|
-
DEVELOPMENT = "development",
|
|
6
5
|
STAGING = "staging",
|
|
7
|
-
PRODUCTION = "production"
|
|
6
|
+
PRODUCTION = "production",
|
|
7
|
+
DEVELOPMENT = "development"
|
|
8
8
|
}
|
|
9
|
-
export interface RuntimeClientOptions<T>
|
|
9
|
+
export interface RuntimeClientOptions<T> {
|
|
10
|
+
traces?: TraceDeclaration<T, any>[];
|
|
10
11
|
baseURL: string;
|
|
11
12
|
onTrace?: (context: T, trace: AnyTrace) => Promise<void> | void;
|
|
12
13
|
authorization?: string;
|
|
@@ -19,14 +20,26 @@ export interface RuntimeInteractStreamRequest {
|
|
|
19
20
|
projectID: string;
|
|
20
21
|
environment?: string;
|
|
21
22
|
audioEvents?: boolean;
|
|
23
|
+
webchatVersion: string;
|
|
22
24
|
guidedNavigation?: boolean;
|
|
23
25
|
}
|
|
26
|
+
export declare enum RuntimeLogStatus {
|
|
27
|
+
INFO = "info",
|
|
28
|
+
ERROR = "error",
|
|
29
|
+
DEBUG = "debug",
|
|
30
|
+
WARNING = "warning"
|
|
31
|
+
}
|
|
32
|
+
export interface RuntimeLog {
|
|
33
|
+
error?: unknown;
|
|
34
|
+
status: RuntimeLogStatus;
|
|
35
|
+
source: string;
|
|
36
|
+
message: string;
|
|
37
|
+
version: string;
|
|
38
|
+
projectID: string;
|
|
39
|
+
additionalProperties?: Record<string, unknown>;
|
|
40
|
+
}
|
|
24
41
|
export interface IRuntimeClient<T> {
|
|
25
|
-
|
|
26
|
-
resetState?(state?: Record<string, any> | null): void;
|
|
27
|
-
patchState?(state: Record<string, any>): void;
|
|
28
|
-
setInitialState?(state: Record<string, any>): void;
|
|
42
|
+
log(log: RuntimeLog): void;
|
|
29
43
|
interactStream(createContext: () => T, request: RuntimeInteractStreamRequest): Promise<ReadableStream<T>>;
|
|
30
|
-
disconnect?(): void;
|
|
31
44
|
}
|
|
32
45
|
//# sourceMappingURL=runtime.interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.interface.d.ts","sourceRoot":"","sources":["../../../src/v2/runtime.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"runtime.interface.d.ts","sourceRoot":"","sources":["../../../src/v2/runtime.interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,oBAAY,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/B,GAAG,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,CAAC;IAC3B,cAAc,CAAC,aAAa,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,4BAA4B,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;CAC3G"}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Environment = void 0;
|
|
3
|
+
exports.RuntimeLogStatus = exports.Environment = void 0;
|
|
4
4
|
// Define the Environment enum locally if not available
|
|
5
5
|
var Environment;
|
|
6
6
|
(function (Environment) {
|
|
7
|
-
Environment["DEVELOPMENT"] = "development";
|
|
8
7
|
Environment["STAGING"] = "staging";
|
|
9
8
|
Environment["PRODUCTION"] = "production";
|
|
9
|
+
Environment["DEVELOPMENT"] = "development";
|
|
10
10
|
})(Environment || (exports.Environment = Environment = {}));
|
|
11
|
+
var RuntimeLogStatus;
|
|
12
|
+
(function (RuntimeLogStatus) {
|
|
13
|
+
RuntimeLogStatus["INFO"] = "info";
|
|
14
|
+
RuntimeLogStatus["ERROR"] = "error";
|
|
15
|
+
RuntimeLogStatus["DEBUG"] = "debug";
|
|
16
|
+
RuntimeLogStatus["WARNING"] = "warning";
|
|
17
|
+
})(RuntimeLogStatus || (exports.RuntimeLogStatus = RuntimeLogStatus = {}));
|
|
11
18
|
//# sourceMappingURL=runtime.interface.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.interface.js","sourceRoot":"","sources":["../../../src/v2/runtime.interface.ts"],"names":[],"mappings":";;;AAKA,uDAAuD;AACvD,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,
|
|
1
|
+
{"version":3,"file":"runtime.interface.js","sourceRoot":"","sources":["../../../src/v2/runtime.interface.ts"],"names":[],"mappings":";;;AAKA,uDAAuD;AACvD,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,kCAAmB,CAAA;IACnB,wCAAyB,CAAA;IACzB,0CAA2B,CAAA;AAC7B,CAAC,EAJW,WAAW,2BAAX,WAAW,QAItB;AAqBD,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,iCAAa,CAAA;IACb,mCAAe,CAAA;IACf,mCAAe,CAAA;IACf,uCAAmB,CAAA;AACrB,CAAC,EALW,gBAAgB,gCAAhB,gBAAgB,QAK3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.utils.d.ts","sourceRoot":"","sources":["../../../src/v2/runtime.utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,gBACf,OAAO,kBACJ,MAAM,kBACP,MAAM,KACpB,MAEF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getResolvedUserID = void 0;
|
|
4
|
+
const DEFAULT_USER_ID = 'TEST_USER';
|
|
5
|
+
const getResolvedUserID = (stateUserID, fallbackUserID, defaultUserID = DEFAULT_USER_ID) => {
|
|
6
|
+
return stateUserID && stateUserID !== defaultUserID ? String(stateUserID) : fallbackUserID;
|
|
7
|
+
};
|
|
8
|
+
exports.getResolvedUserID = getResolvedUserID;
|
|
9
|
+
//# sourceMappingURL=runtime.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.utils.js","sourceRoot":"","sources":["../../../src/v2/runtime.utils.ts"],"names":[],"mappings":";;;AAAA,MAAM,eAAe,GAAG,WAAW,CAAC;AAE7B,MAAM,iBAAiB,GAAG,CAC/B,WAAoB,EACpB,cAAsB,EACtB,gBAAwB,eAAe,EAC/B,EAAE;IACV,OAAO,WAAW,IAAI,WAAW,KAAK,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC;AAC7F,CAAC,CAAC;AANW,QAAA,iBAAiB,qBAM5B"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { IRuntimeClient,
|
|
3
|
-
|
|
4
|
-
export declare class ShareableLinkRuntimeClient<T> implements IRuntimeClient<T> {
|
|
5
|
-
private readonly trace;
|
|
6
|
-
private readonly fetch;
|
|
7
|
-
constructor(options: RuntimeClientOptions<T>, trace?: TraceService<T>, fetch?: FetchClient<RequestInit, Request | URL, Response>);
|
|
1
|
+
import { BaseRuntimeClient } from './base-runtime.client';
|
|
2
|
+
import type { IRuntimeClient, RuntimeInteractStreamRequest } from './runtime.interface';
|
|
3
|
+
export declare class ShareableLinkRuntimeClient<T> extends BaseRuntimeClient<T> implements IRuntimeClient<T> {
|
|
8
4
|
syncState(projectID: string, userID: string, state: Record<string, any> | null, environment?: string): Promise<any>;
|
|
9
5
|
interactStream(createContext: () => T, { userID, action, projectID, environment, audioEvents }: RuntimeInteractStreamRequest): Promise<ReadableStream<T>>;
|
|
10
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shareable-link-runtime.client.d.ts","sourceRoot":"","sources":["../../../src/v2/shareable-link-runtime.client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shareable-link-runtime.client.d.ts","sourceRoot":"","sources":["../../../src/v2/shareable-link-runtime.client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,KAAK,EAAE,cAAc,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAExF,qBAAa,0BAA0B,CAAC,CAAC,CAAE,SAAQ,iBAAiB,CAAC,CAAC,CAAE,YAAW,cAAc,CAAC,CAAC,CAAC;IACrF,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE,WAAW,CAAC,EAAE,MAAM;IAc3F,cAAc,CAClC,aAAa,EAAE,MAAM,CAAC,EACtB,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,WAAmB,EAAE,EAAE,4BAA4B,GAC5F,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;CA0B9B"}
|
|
@@ -2,15 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ShareableLinkRuntimeClient = void 0;
|
|
4
4
|
const dtos_interact_1 = require("@voiceflow/dtos-interact");
|
|
5
|
-
const fetch_1 = require("@voiceflow/fetch");
|
|
6
5
|
const stream_1 = require("eventsource-parser/stream");
|
|
6
|
+
const base_runtime_client_1 = require("./base-runtime.client");
|
|
7
7
|
const interact_trace_stream_1 = require("./interact-trace.stream");
|
|
8
|
-
|
|
9
|
-
class ShareableLinkRuntimeClient {
|
|
10
|
-
constructor(options, trace = new trace_service_1.TraceService({ traces: options.traces }), fetch = new fetch_1.FetchClient({ baseURL: options.baseURL })) {
|
|
11
|
-
this.trace = trace;
|
|
12
|
-
this.fetch = fetch;
|
|
13
|
-
}
|
|
8
|
+
class ShareableLinkRuntimeClient extends base_runtime_client_1.BaseRuntimeClient {
|
|
14
9
|
async syncState(projectID, userID, state, environment) {
|
|
15
10
|
const result = await this.fetch.post(`/public/${projectID}/state/user/${encodeURIComponent(userID)}/interact`, {
|
|
16
11
|
json: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shareable-link-runtime.client.js","sourceRoot":"","sources":["../../../src/v2/shareable-link-runtime.client.ts"],"names":[],"mappings":";;;AAAA,4DAAoD;AACpD,
|
|
1
|
+
{"version":3,"file":"shareable-link-runtime.client.js","sourceRoot":"","sources":["../../../src/v2/shareable-link-runtime.client.ts"],"names":[],"mappings":";;;AAAA,4DAAoD;AACpD,sDAAoE;AAEpE,+DAA0D;AAC1D,mEAA8D;AAG9D,MAAa,0BAA8B,SAAQ,uCAAoB;IAC9D,KAAK,CAAC,SA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,EAAE,CAAC;aAC1C,WAAW,CAAC,IAAI,2CAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACrE,CAAC;CACF;AA5CD,gEA4CC"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { BaseRuntimeClient } from '../base-runtime.client';
|
|
2
|
+
import type { IRuntimeClient, RuntimeInteractStreamRequest } from '../runtime.interface';
|
|
3
3
|
import { ConnectionState } from './websocket-runtime.interface';
|
|
4
|
-
export declare class WebSocketRuntimeClient<T> implements IRuntimeClient<T> {
|
|
5
|
-
private readonly options;
|
|
6
|
-
private readonly trace;
|
|
4
|
+
export declare class WebSocketRuntimeClient<T> extends BaseRuntimeClient<T> implements IRuntimeClient<T> {
|
|
7
5
|
private state;
|
|
8
6
|
private ws;
|
|
9
7
|
private connectionState;
|
|
@@ -12,11 +10,9 @@ export declare class WebSocketRuntimeClient<T> implements IRuntimeClient<T> {
|
|
|
12
10
|
private inactivityTimer;
|
|
13
11
|
private readonly inactivityTimeout;
|
|
14
12
|
private readonly emitter;
|
|
15
|
-
constructor(options: RuntimeClientOptions<T>, trace?: TraceService<T>);
|
|
16
13
|
setState: (context: T, state: Record<string, any>) => void;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
setInitialState(state: Record<string, any>): void;
|
|
14
|
+
patchState: (state: Record<string, any>) => void;
|
|
15
|
+
resetState: (state?: Record<string, any> | null) => Promise<void>;
|
|
20
16
|
private startInactivityTimer;
|
|
21
17
|
private clearInactivityTimer;
|
|
22
18
|
private resetInactivityTimer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"websocket-runtime.client.d.ts","sourceRoot":"","sources":["../../../../src/v2/websocket-runtime/websocket-runtime.client.ts"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"websocket-runtime.client.d.ts","sourceRoot":"","sources":["../../../../src/v2/websocket-runtime/websocket-runt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