@botpress/webchat-client 0.3.0 → 0.4.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/.turbo/turbo-build.log +10 -10
- package/dist/index.d.ts +807 -9
- package/dist/webchat-client.js +3 -2
- package/dist/webchat-client2.js +112 -95
- package/dist/webchat-client3.js +28 -20
- package/dist/webchat-client9.js +26 -26
- package/eslint.config.mjs +10 -0
- package/package.json +3 -2
- package/src/client/client.ts +43 -9
- package/src/client/types/signals/initialize.ts +1 -1
- package/src/index.ts +1 -0
- package/.eslintrc.cjs +0 -11
package/dist/webchat-client.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { createClient as t, createUser as i, generateUserKey as a, initialize as n } from "./webchat-client2.js";
|
|
1
|
+
import { createClient as t, createUser as i, generateUserKey as a, initialize as n, sendPerfMetrics as s } from "./webchat-client2.js";
|
|
2
2
|
export {
|
|
3
3
|
t as createClient,
|
|
4
4
|
i as createUser,
|
|
5
5
|
a as generateUserKey,
|
|
6
|
-
n as initialize
|
|
6
|
+
n as initialize,
|
|
7
|
+
s as sendPerfMetrics
|
|
7
8
|
};
|
package/dist/webchat-client2.js
CHANGED
|
@@ -1,130 +1,147 @@
|
|
|
1
|
-
import { createUser as
|
|
1
|
+
import { createUser as x, generateUserKey as y, sendPerfMetrics as k, removeMessageFeedback as F, addMessageFeedback as T, getEvent as R, createEvent as w, deleteUser as I, updateUser as K, getUser as O, createFile as S, deleteMessage as _, getMessage as q, updateMessage as N, createMessage as z, listParticipants as A, getParticipant as J, removeParticipant as j, addParticipant as D, listConversationMessages as L, listConversations as V, deleteConversation as X, getConversation as Y, createConversation as B } from "./webchat-client3.js";
|
|
2
2
|
import { client as l } from "./webchat-client4.js";
|
|
3
|
-
import { EventSource as
|
|
4
|
-
import { throwErrorInterceptor as
|
|
3
|
+
import { EventSource as G } from "./webchat-client5.js";
|
|
4
|
+
import { throwErrorInterceptor as b } from "./webchat-client6.js";
|
|
5
5
|
import { createEventEmitter as C } from "./webchat-client7.js";
|
|
6
|
-
const
|
|
6
|
+
const n = (a) => a.data, $ = 10, M = 3e3, H = "60000", v = {
|
|
7
7
|
throwOnError: !0
|
|
8
|
-
},
|
|
8
|
+
}, se = async ({
|
|
9
9
|
clientId: a,
|
|
10
|
-
apiUrl:
|
|
11
|
-
adminSecret: i
|
|
10
|
+
apiUrl: c,
|
|
11
|
+
adminSecret: i,
|
|
12
|
+
customHeaders: o,
|
|
13
|
+
...s
|
|
12
14
|
}) => {
|
|
13
|
-
const
|
|
14
|
-
l.interceptors.response._fns.length === 0 && l.interceptors.response.use(
|
|
15
|
-
const
|
|
16
|
-
...
|
|
17
|
-
baseUrl:
|
|
15
|
+
const d = `${c || l.getConfig().baseUrl}/${a}`;
|
|
16
|
+
l.interceptors.response._fns.length === 0 && l.interceptors.response.use(b);
|
|
17
|
+
const t = {
|
|
18
|
+
...v,
|
|
19
|
+
baseUrl: d
|
|
20
|
+
}, h = {
|
|
21
|
+
...i ? { "x-admin-secret": i } : {},
|
|
22
|
+
...o
|
|
18
23
|
};
|
|
19
|
-
return
|
|
20
|
-
...
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}).then(
|
|
24
|
-
},
|
|
24
|
+
return x({
|
|
25
|
+
...t,
|
|
26
|
+
headers: Object.keys(h).length > 0 ? h : void 0,
|
|
27
|
+
body: s
|
|
28
|
+
}).then(n);
|
|
29
|
+
}, ne = ({
|
|
25
30
|
conversationId: a,
|
|
26
|
-
userToken:
|
|
31
|
+
userToken: c,
|
|
27
32
|
clientId: i,
|
|
28
|
-
apiUrl:
|
|
33
|
+
apiUrl: o,
|
|
34
|
+
adminSecret: s
|
|
29
35
|
}) => {
|
|
30
|
-
let
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
c
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
let d = 0, t = null;
|
|
37
|
+
const h = C(), e = () => {
|
|
38
|
+
t && t.close();
|
|
39
|
+
const g = `${`${o || l.getConfig().baseUrl}/${i}`}/initialize${a ? `?conversationId=${a}` : ""}`, p = {
|
|
40
|
+
...s ? { "x-admin-secret": s } : {},
|
|
41
|
+
...c ? { "x-user-key": c } : {}
|
|
42
|
+
};
|
|
43
|
+
t = P(g, p), t.onopen = () => h.emit("open"), t.onerror = (u) => {
|
|
44
|
+
d < $ ? (d++, setTimeout(() => e(), M)) : h.emit("error", u);
|
|
45
|
+
}, t.onmessage = (u) => {
|
|
46
|
+
const m = E(u.data);
|
|
47
|
+
h.emit(m.type, m.data);
|
|
39
48
|
};
|
|
40
49
|
};
|
|
41
|
-
return e(),
|
|
42
|
-
},
|
|
50
|
+
return e(), h.on;
|
|
51
|
+
}, re = async ({
|
|
43
52
|
adminSecret: a,
|
|
44
|
-
expiresAt:
|
|
53
|
+
expiresAt: c,
|
|
45
54
|
userId: i,
|
|
46
|
-
apiUrl:
|
|
47
|
-
clientId:
|
|
55
|
+
apiUrl: o,
|
|
56
|
+
clientId: s
|
|
48
57
|
}) => {
|
|
49
|
-
const
|
|
50
|
-
...
|
|
51
|
-
baseUrl:
|
|
58
|
+
const d = { "x-admin-secret": a }, t = `${o || l.getConfig().baseUrl}/${s}`, h = {
|
|
59
|
+
...v,
|
|
60
|
+
baseUrl: t
|
|
61
|
+
};
|
|
62
|
+
return y({ ...h, headers: d, body: { id: i, expiresAt: c } }).then(n);
|
|
63
|
+
}, ae = async (a, c, i, o) => {
|
|
64
|
+
const s = `${i || l.getConfig().baseUrl}/${a}`, d = {
|
|
65
|
+
...v,
|
|
66
|
+
baseUrl: s
|
|
52
67
|
};
|
|
53
|
-
return
|
|
54
|
-
},
|
|
68
|
+
return k({ ...d, body: c, headers: o }).then(n);
|
|
69
|
+
}, oe = ({
|
|
55
70
|
userKey: a,
|
|
56
|
-
clientId:
|
|
57
|
-
apiUrl: i
|
|
71
|
+
clientId: c,
|
|
72
|
+
apiUrl: i,
|
|
73
|
+
customHeaders: o
|
|
58
74
|
}) => {
|
|
59
|
-
const
|
|
60
|
-
"x-user-key": a
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
75
|
+
const s = {
|
|
76
|
+
"x-user-key": a,
|
|
77
|
+
...o
|
|
78
|
+
}, d = `${i || l.getConfig().baseUrl}/${c}`, t = {
|
|
79
|
+
...v,
|
|
80
|
+
baseUrl: d
|
|
64
81
|
};
|
|
65
|
-
return l.interceptors.response._fns.length === 0 && l.interceptors.response.use(
|
|
66
|
-
createConversation: () =>
|
|
67
|
-
getConversation: ({ conversationId: e }) =>
|
|
68
|
-
deleteConversation: ({ conversationId: e }) =>
|
|
69
|
-
listConversations: ({ nextToken: e }) =>
|
|
70
|
-
listConversationMessages: ({ conversationId: e, nextToken:
|
|
71
|
-
...
|
|
72
|
-
headers:
|
|
82
|
+
return l.interceptors.response._fns.length === 0 && l.interceptors.response.use(b), {
|
|
83
|
+
createConversation: () => B({ ...t, headers: s, body: {} }).then(n),
|
|
84
|
+
getConversation: ({ conversationId: e }) => Y({ ...t, headers: s, path: { id: e } }).then(n),
|
|
85
|
+
deleteConversation: ({ conversationId: e }) => X({ ...t, headers: s, path: { id: e } }).then(n),
|
|
86
|
+
listConversations: ({ nextToken: e }) => V({ ...t, headers: s, query: { nextToken: e } }).then(n),
|
|
87
|
+
listConversationMessages: ({ conversationId: e, nextToken: r }) => L({
|
|
88
|
+
...t,
|
|
89
|
+
headers: s,
|
|
73
90
|
path: { id: e },
|
|
74
|
-
query: { nextToken:
|
|
75
|
-
}).then(
|
|
76
|
-
addParticipant: ({ conversationId: e, userId:
|
|
77
|
-
removeParticipant: ({ conversationId: e, userId:
|
|
78
|
-
getParticipant: ({ conversationId: e, userId:
|
|
79
|
-
listParticipants: ({ conversationId: e, nextToken:
|
|
80
|
-
createMessage: (e) =>
|
|
81
|
-
updateMessage: ({ messageId: e, ...
|
|
82
|
-
getMessage: ({ messageId: e }) =>
|
|
83
|
-
deleteMessage: ({ messageId: e }) =>
|
|
84
|
-
createFile: (e) =>
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
generateUserKey: ({ adminSecret: e, ...s }) => U({ ...n, headers: { "x-admin-secret": e }, body: s }).then(r),
|
|
91
|
+
query: { nextToken: r }
|
|
92
|
+
}).then(n),
|
|
93
|
+
addParticipant: ({ conversationId: e, userId: r }) => D({ ...t, headers: s, path: { id: e }, body: { userId: r } }).then(n),
|
|
94
|
+
removeParticipant: ({ conversationId: e, userId: r }) => j({ ...t, headers: s, path: { id: e, userId: r } }).then(n),
|
|
95
|
+
getParticipant: ({ conversationId: e, userId: r }) => J({ ...t, headers: s, path: { id: e, userId: r } }).then(n),
|
|
96
|
+
listParticipants: ({ conversationId: e, nextToken: r }) => A({ ...t, headers: s, path: { id: e }, query: { nextToken: r } }).then(n),
|
|
97
|
+
createMessage: (e) => z({ ...t, headers: s, body: e }).then(n),
|
|
98
|
+
updateMessage: ({ messageId: e, ...r }) => N({ ...t, headers: s, path: { id: e }, body: r }).then(n),
|
|
99
|
+
getMessage: ({ messageId: e }) => q({ ...t, headers: s, path: { id: e } }).then(n),
|
|
100
|
+
deleteMessage: ({ messageId: e }) => _({ ...t, headers: s, path: { id: e } }).then(n),
|
|
101
|
+
createFile: (e) => S({ ...t, headers: s, body: e }).then(n),
|
|
102
|
+
getUser: () => O({ ...t, headers: s }).then(n),
|
|
103
|
+
updateUser: (e) => K({ ...t, headers: s, body: e }).then(n),
|
|
104
|
+
deleteUser: () => I({ ...t, headers: s }).then(n),
|
|
105
|
+
createEvent: (e) => w({ ...t, headers: s, body: e }).then(n),
|
|
106
|
+
getEvent: ({ eventId: e }) => R({ ...t, headers: s, path: { id: e } }).then(n),
|
|
107
|
+
addMessageFeedback: ({ messageId: e, ...r }) => T({ ...t, headers: s, path: { id: e }, body: r }).then(n),
|
|
108
|
+
removeMessageFeedback: ({ messageId: e }) => F({ ...t, headers: s, path: { id: e } }).then(n),
|
|
109
|
+
generateUserKey: ({ adminSecret: e, ...r }) => y({ ...t, headers: { "x-admin-secret": e }, body: r }).then(n),
|
|
94
110
|
listenConversation: ({ conversationId: e }) => {
|
|
95
|
-
let
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
},
|
|
102
|
-
const
|
|
103
|
-
|
|
111
|
+
let r = 0, g = null;
|
|
112
|
+
const p = C(), u = () => {
|
|
113
|
+
g && g.close();
|
|
114
|
+
const m = `${d}/conversations/${e}/listen`;
|
|
115
|
+
g = P(m, s), g.onopen = () => p.emit("open"), g.onerror = (f) => {
|
|
116
|
+
r < $ ? (r++, setTimeout(() => u(), M)) : p.emit("error", f);
|
|
117
|
+
}, g.onmessage = (f) => {
|
|
118
|
+
const U = E(f.data);
|
|
119
|
+
p.emit(U.type, U.data);
|
|
104
120
|
};
|
|
105
121
|
};
|
|
106
|
-
return
|
|
122
|
+
return u(), p.on;
|
|
107
123
|
}
|
|
108
124
|
};
|
|
109
|
-
},
|
|
125
|
+
}, E = (a) => {
|
|
110
126
|
try {
|
|
111
127
|
return JSON.parse(a);
|
|
112
128
|
} catch {
|
|
113
129
|
return a;
|
|
114
130
|
}
|
|
115
|
-
},
|
|
116
|
-
fetch: (i,
|
|
117
|
-
...
|
|
131
|
+
}, P = (a, c) => new G(a, {
|
|
132
|
+
fetch: (i, o) => fetch(i, {
|
|
133
|
+
...o,
|
|
118
134
|
headers: {
|
|
119
|
-
...
|
|
120
|
-
...
|
|
121
|
-
timeout:
|
|
135
|
+
...o == null ? void 0 : o.headers,
|
|
136
|
+
...c,
|
|
137
|
+
timeout: H
|
|
122
138
|
}
|
|
123
139
|
})
|
|
124
140
|
});
|
|
125
141
|
export {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
142
|
+
oe as createClient,
|
|
143
|
+
se as createUser,
|
|
144
|
+
re as generateUserKey,
|
|
145
|
+
ne as initialize,
|
|
146
|
+
ae as sendPerfMetrics
|
|
130
147
|
};
|
package/dist/webchat-client3.js
CHANGED
|
@@ -47,54 +47,54 @@ const t = (e) => (e.client ?? r).delete({
|
|
|
47
47
|
"Content-Type": "application/json",
|
|
48
48
|
...e == null ? void 0 : e.headers
|
|
49
49
|
}
|
|
50
|
-
}),
|
|
50
|
+
}), y = (e) => (e.client ?? r).post({
|
|
51
51
|
url: "/messages",
|
|
52
52
|
...e,
|
|
53
53
|
headers: {
|
|
54
54
|
"Content-Type": "application/json",
|
|
55
55
|
...e == null ? void 0 : e.headers
|
|
56
56
|
}
|
|
57
|
-
}),
|
|
57
|
+
}), j = (e) => (e.client ?? r).delete({
|
|
58
58
|
url: "/messages/{id}/feedback",
|
|
59
59
|
...e
|
|
60
|
-
}),
|
|
60
|
+
}), T = (e) => (e.client ?? r).put({
|
|
61
61
|
url: "/messages/{id}/feedback",
|
|
62
62
|
...e,
|
|
63
63
|
headers: {
|
|
64
64
|
"Content-Type": "application/json",
|
|
65
65
|
...e == null ? void 0 : e.headers
|
|
66
66
|
}
|
|
67
|
-
}),
|
|
67
|
+
}), M = (e) => (e.client ?? r).delete({
|
|
68
68
|
url: "/users/me",
|
|
69
69
|
...e
|
|
70
|
-
}),
|
|
70
|
+
}), i = (e) => (e.client ?? r).get({
|
|
71
71
|
url: "/users/me",
|
|
72
72
|
...e
|
|
73
|
-
}),
|
|
73
|
+
}), f = (e) => (e.client ?? r).put({
|
|
74
74
|
url: "/users/me",
|
|
75
75
|
...e,
|
|
76
76
|
headers: {
|
|
77
77
|
"Content-Type": "application/json",
|
|
78
78
|
...e == null ? void 0 : e.headers
|
|
79
79
|
}
|
|
80
|
-
}),
|
|
80
|
+
}), k = (e) => ((e == null ? void 0 : e.client) ?? r).post({
|
|
81
81
|
url: "/users",
|
|
82
82
|
...e,
|
|
83
83
|
headers: {
|
|
84
84
|
"Content-Type": "application/json",
|
|
85
85
|
...e == null ? void 0 : e.headers
|
|
86
86
|
}
|
|
87
|
-
}),
|
|
87
|
+
}), P = (e) => ((e == null ? void 0 : e.client) ?? r).post({
|
|
88
88
|
url: "/users/key",
|
|
89
89
|
...e,
|
|
90
90
|
headers: {
|
|
91
91
|
"Content-Type": "application/json",
|
|
92
92
|
...e == null ? void 0 : e.headers
|
|
93
93
|
}
|
|
94
|
-
}),
|
|
94
|
+
}), U = (e) => (e.client ?? r).get({
|
|
95
95
|
url: "/events/{id}",
|
|
96
96
|
...e
|
|
97
|
-
}),
|
|
97
|
+
}), b = (e) => (e.client ?? r).post({
|
|
98
98
|
url: "/events",
|
|
99
99
|
...e,
|
|
100
100
|
headers: {
|
|
@@ -108,29 +108,37 @@ const t = (e) => (e.client ?? r).delete({
|
|
|
108
108
|
"Content-Type": "application/json",
|
|
109
109
|
...e == null ? void 0 : e.headers
|
|
110
110
|
}
|
|
111
|
+
}), E = (e) => ((e == null ? void 0 : e.client) ?? r).post({
|
|
112
|
+
url: "/p",
|
|
113
|
+
...e,
|
|
114
|
+
headers: {
|
|
115
|
+
"Content-Type": "application/json",
|
|
116
|
+
...e == null ? void 0 : e.headers
|
|
117
|
+
}
|
|
111
118
|
});
|
|
112
119
|
export {
|
|
113
|
-
|
|
120
|
+
T as addMessageFeedback,
|
|
114
121
|
d as addParticipant,
|
|
115
122
|
n as createConversation,
|
|
116
|
-
|
|
123
|
+
b as createEvent,
|
|
117
124
|
F as createFile,
|
|
118
|
-
|
|
119
|
-
|
|
125
|
+
y as createMessage,
|
|
126
|
+
k as createUser,
|
|
120
127
|
t as deleteConversation,
|
|
121
128
|
v as deleteMessage,
|
|
122
|
-
|
|
123
|
-
|
|
129
|
+
M as deleteUser,
|
|
130
|
+
P as generateUserKey,
|
|
124
131
|
c as getConversation,
|
|
125
|
-
|
|
132
|
+
U as getEvent,
|
|
126
133
|
C as getMessage,
|
|
127
134
|
h as getParticipant,
|
|
128
|
-
|
|
135
|
+
i as getUser,
|
|
129
136
|
s as listConversationMessages,
|
|
130
137
|
l as listConversations,
|
|
131
138
|
u as listParticipants,
|
|
132
|
-
|
|
139
|
+
j as removeMessageFeedback,
|
|
133
140
|
g as removeParticipant,
|
|
141
|
+
E as sendPerfMetrics,
|
|
134
142
|
m as updateMessage,
|
|
135
|
-
|
|
143
|
+
f as updateUser
|
|
136
144
|
};
|
package/dist/webchat-client9.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
class E extends Error {
|
|
2
|
-
constructor(d,
|
|
3
|
-
super(d), this.name = "ParseError", this.type =
|
|
2
|
+
constructor(d, i) {
|
|
3
|
+
super(d), this.name = "ParseError", this.type = i.type, this.field = i.field, this.value = i.value, this.line = i.line;
|
|
4
4
|
}
|
|
5
5
|
}
|
|
6
6
|
function x(n) {
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function w(n) {
|
|
9
9
|
if (typeof n == "function")
|
|
10
10
|
throw new TypeError(
|
|
11
11
|
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
12
12
|
);
|
|
13
|
-
const { onEvent: d = x, onError:
|
|
14
|
-
let
|
|
13
|
+
const { onEvent: d = x, onError: i = x, onRetry: r = x, onComment: c } = n;
|
|
14
|
+
let o = "", s = !0, f, a = "", p = "";
|
|
15
15
|
function b(e) {
|
|
16
|
-
const t =
|
|
16
|
+
const t = s ? e.replace(/^\xEF\xBB\xBF/, "") : e, [l, u] = g(`${o}${t}`);
|
|
17
17
|
for (const h of l)
|
|
18
18
|
y(h);
|
|
19
|
-
|
|
19
|
+
o = u, s = !1;
|
|
20
20
|
}
|
|
21
21
|
function y(e) {
|
|
22
22
|
if (e === "") {
|
|
@@ -24,7 +24,7 @@ function I(n) {
|
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
if (e.startsWith(":")) {
|
|
27
|
-
|
|
27
|
+
c && c(e.slice(e.startsWith(": ") ? 2 : 1));
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
const t = e.indexOf(":");
|
|
@@ -41,14 +41,14 @@ function I(n) {
|
|
|
41
41
|
p = t;
|
|
42
42
|
break;
|
|
43
43
|
case "data":
|
|
44
|
-
|
|
44
|
+
a = `${a}${t}
|
|
45
45
|
`;
|
|
46
46
|
break;
|
|
47
47
|
case "id":
|
|
48
48
|
f = t.includes("\0") ? void 0 : t;
|
|
49
49
|
break;
|
|
50
50
|
case "retry":
|
|
51
|
-
/^\d+$/.test(t) ? r(parseInt(t, 10)) :
|
|
51
|
+
/^\d+$/.test(t) ? r(parseInt(t, 10)) : i(
|
|
52
52
|
new E(`Invalid \`retry\` value: "${t}"`, {
|
|
53
53
|
type: "invalid-retry",
|
|
54
54
|
value: t,
|
|
@@ -57,7 +57,7 @@ function I(n) {
|
|
|
57
57
|
);
|
|
58
58
|
break;
|
|
59
59
|
default:
|
|
60
|
-
|
|
60
|
+
i(
|
|
61
61
|
new E(
|
|
62
62
|
`Unknown field "${e.length > 20 ? `${e.slice(0, 20)}…` : e}"`,
|
|
63
63
|
{ type: "unknown-field", field: e, value: t, line: l }
|
|
@@ -67,39 +67,39 @@ function I(n) {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
function v() {
|
|
70
|
-
|
|
70
|
+
a.length > 0 && d({
|
|
71
71
|
id: f,
|
|
72
72
|
event: p || void 0,
|
|
73
73
|
// If the data buffer's last character is a U+000A LINE FEED (LF) character,
|
|
74
74
|
// then remove the last character from the data buffer.
|
|
75
|
-
data:
|
|
76
|
-
`) ?
|
|
77
|
-
}), f = void 0,
|
|
75
|
+
data: a.endsWith(`
|
|
76
|
+
`) ? a.slice(0, -1) : a
|
|
77
|
+
}), f = void 0, a = "", p = "";
|
|
78
78
|
}
|
|
79
79
|
function $(e = {}) {
|
|
80
|
-
|
|
80
|
+
o && e.consume && y(o), s = !0, f = void 0, a = "", p = "", o = "";
|
|
81
81
|
}
|
|
82
82
|
return { feed: b, reset: $ };
|
|
83
83
|
}
|
|
84
|
-
function
|
|
84
|
+
function g(n) {
|
|
85
85
|
const d = [];
|
|
86
|
-
let
|
|
86
|
+
let i = "", r = 0;
|
|
87
87
|
for (; r < n.length; ) {
|
|
88
|
-
const
|
|
88
|
+
const c = n.indexOf("\r", r), o = n.indexOf(`
|
|
89
89
|
`, r);
|
|
90
|
-
let
|
|
91
|
-
if (
|
|
92
|
-
|
|
90
|
+
let s = -1;
|
|
91
|
+
if (c !== -1 && o !== -1 ? s = Math.min(c, o) : c !== -1 ? c === n.length - 1 ? s = -1 : s = c : o !== -1 && (s = o), s === -1) {
|
|
92
|
+
i = n.slice(r);
|
|
93
93
|
break;
|
|
94
94
|
} else {
|
|
95
|
-
const f = n.slice(r,
|
|
96
|
-
d.push(f), r =
|
|
95
|
+
const f = n.slice(r, s);
|
|
96
|
+
d.push(f), r = s + 1, n[r - 1] === "\r" && n[r] === `
|
|
97
97
|
` && r++;
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
-
return [d,
|
|
100
|
+
return [d, i];
|
|
101
101
|
}
|
|
102
102
|
export {
|
|
103
103
|
E as ParseError,
|
|
104
|
-
|
|
104
|
+
w as createParser
|
|
105
105
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { clientInternalConfig } from '@repo/eslint-config/client-internal'
|
|
2
|
+
import { defineConfig } from 'eslint/config'
|
|
3
|
+
|
|
4
|
+
export default defineConfig([clientInternalConfig], {
|
|
5
|
+
languageOptions: {
|
|
6
|
+
parserOptions: {
|
|
7
|
+
tsconfigRootDir: import.meta.dirname,
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botpress/webchat-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"exports": {
|
|
20
20
|
".": {
|
|
21
21
|
"import": "./dist/webchat-client.js",
|
|
22
|
+
"require": "./dist/webchat-client.js",
|
|
22
23
|
"types": "./dist/index.d.ts"
|
|
23
24
|
}
|
|
24
25
|
},
|
|
@@ -29,7 +30,7 @@
|
|
|
29
30
|
"eventsource": "^3.0.6"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
|
-
"@bpinternal/webchat-http-client": "0.
|
|
33
|
+
"@bpinternal/webchat-http-client": "0.8.0",
|
|
33
34
|
"@hey-api/client-fetch": "^0.10.0",
|
|
34
35
|
"@hey-api/openapi-ts": "^0.66.4",
|
|
35
36
|
"@repo/eslint-config": "workspace:*",
|