@digipair/skill-client-sse 0.119.4 → 0.119.6
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/index.cjs.js +10 -3
- package/dist/index.esm.js +16 -8
- package/dist/src/lib/skill-client-sse.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var engine = require('@digipair/engine');
|
|
4
|
+
var nodeFetchEventSource = require('@ai-zen/node-fetch-event-source');
|
|
4
5
|
var fetchEventSource$1 = require('@microsoft/fetch-event-source');
|
|
5
6
|
|
|
6
|
-
const fetchEventSource = typeof window === 'undefined' ?
|
|
7
|
+
const fetchEventSource = typeof window === 'undefined' ? nodeFetchEventSource.fetchEventSource : fetchEventSource$1.fetchEventSource;
|
|
7
8
|
let ClientSSEService = class ClientSSEService {
|
|
8
9
|
async connect(params, _pinsSettingsList, context) {
|
|
9
10
|
const { url = '', event = 'message', message = [], open = [], close = [], error = [], options = {} } = params;
|
|
10
|
-
await fetchEventSource(url, {
|
|
11
|
+
return await fetchEventSource(url, {
|
|
11
12
|
signal: context.protected?.signal,
|
|
12
13
|
method: 'POST',
|
|
13
14
|
headers: {
|
|
@@ -17,9 +18,15 @@ let ClientSSEService = class ClientSSEService {
|
|
|
17
18
|
if (notification.event !== event) {
|
|
18
19
|
return;
|
|
19
20
|
}
|
|
21
|
+
let data = '';
|
|
22
|
+
try {
|
|
23
|
+
data = JSON.parse(notification.data);
|
|
24
|
+
} catch {
|
|
25
|
+
data = notification.data;
|
|
26
|
+
}
|
|
20
27
|
engine.executePinsList(message, {
|
|
21
28
|
...context,
|
|
22
|
-
message:
|
|
29
|
+
message: data
|
|
23
30
|
}, `${context.__PATH__}.message`);
|
|
24
31
|
},
|
|
25
32
|
onopen: async ()=>{
|
package/dist/index.esm.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { fetchEventSource as fetchEventSource$2 } from '@ai-zen/node-fetch-event-source';
|
|
2
|
+
|
|
1
3
|
function _mergeNamespaces(n, m) {
|
|
2
4
|
m.forEach(function(e) {
|
|
3
5
|
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function(k) {
|
|
@@ -22838,14 +22840,14 @@ function indent(str, spaces) {
|
|
|
22838
22840
|
var match = parseIdentifier(input, i1, namePart) || namePart && parseAdditionalSymbol(input, i1) || maybeSpace && parseSpaces(input, i1);
|
|
22839
22841
|
// match is required
|
|
22840
22842
|
if (!match) {
|
|
22841
|
-
return
|
|
22843
|
+
return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
|
|
22842
22844
|
v: nextMatch1
|
|
22843
22845
|
};
|
|
22844
22846
|
}
|
|
22845
22847
|
var token = match.token, offset = match.offset;
|
|
22846
22848
|
i1 += offset;
|
|
22847
22849
|
if (token === ' ') {
|
|
22848
|
-
return
|
|
22850
|
+
return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
|
|
22849
22851
|
}
|
|
22850
22852
|
tokens1 = _to_consumable_array$4(tokens1).concat([
|
|
22851
22853
|
token
|
|
@@ -22864,7 +22866,7 @@ function indent(str, spaces) {
|
|
|
22864
22866
|
if (contextKeys.some(function(el) {
|
|
22865
22867
|
return el.startsWith(name);
|
|
22866
22868
|
})) {
|
|
22867
|
-
return
|
|
22869
|
+
return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
|
|
22868
22870
|
}
|
|
22869
22871
|
if (dateTimeIdentifiers.some(function(el) {
|
|
22870
22872
|
return el === name;
|
|
@@ -22883,9 +22885,9 @@ function indent(str, spaces) {
|
|
|
22883
22885
|
if (dateTimeIdentifiers.some(function(el) {
|
|
22884
22886
|
return el.startsWith(name);
|
|
22885
22887
|
})) {
|
|
22886
|
-
return
|
|
22888
|
+
return tokens = tokens1, nextMatch = nextMatch1, i = i1, "continue";
|
|
22887
22889
|
}
|
|
22888
|
-
return
|
|
22890
|
+
return tokens = tokens1, nextMatch = nextMatch1, i = i1, {
|
|
22889
22891
|
v: nextMatch1
|
|
22890
22892
|
};
|
|
22891
22893
|
};
|
|
@@ -45090,11 +45092,11 @@ function defaultOnOpen(response) {
|
|
|
45090
45092
|
}
|
|
45091
45093
|
}
|
|
45092
45094
|
|
|
45093
|
-
const fetchEventSource = typeof window === 'undefined' ? fetchEventSource$
|
|
45095
|
+
const fetchEventSource = typeof window === 'undefined' ? fetchEventSource$2 : fetchEventSource$1;
|
|
45094
45096
|
let ClientSSEService = class ClientSSEService {
|
|
45095
45097
|
async connect(params, _pinsSettingsList, context) {
|
|
45096
45098
|
const { url = '', event = 'message', message = [], open = [], close = [], error = [], options = {} } = params;
|
|
45097
|
-
await fetchEventSource(url, {
|
|
45099
|
+
return await fetchEventSource(url, {
|
|
45098
45100
|
signal: context.protected?.signal,
|
|
45099
45101
|
method: 'POST',
|
|
45100
45102
|
headers: {
|
|
@@ -45104,9 +45106,15 @@ let ClientSSEService = class ClientSSEService {
|
|
|
45104
45106
|
if (notification.event !== event) {
|
|
45105
45107
|
return;
|
|
45106
45108
|
}
|
|
45109
|
+
let data = '';
|
|
45110
|
+
try {
|
|
45111
|
+
data = JSON.parse(notification.data);
|
|
45112
|
+
} catch {
|
|
45113
|
+
data = notification.data;
|
|
45114
|
+
}
|
|
45107
45115
|
executePinsList(message, {
|
|
45108
45116
|
...context,
|
|
45109
|
-
message:
|
|
45117
|
+
message: data
|
|
45110
45118
|
}, `${context.__PATH__}.message`);
|
|
45111
45119
|
},
|
|
45112
45120
|
onopen: async ()=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill-client-sse.d.ts","sourceRoot":"","sources":["../../../src/lib/skill-client-sse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAmB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"skill-client-sse.d.ts","sourceRoot":"","sources":["../../../src/lib/skill-client-sse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAmB,MAAM,kBAAkB,CAAC;AAwDjE,eAAO,MAAM,OAAO,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,iBAChB,CAAC"}
|