@inkeep/agents-work-apps 0.50.0 → 0.50.3
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/_virtual/rolldown_runtime.js +32 -0
- package/dist/env.d.ts +2 -0
- package/dist/env.js +1 -0
- package/dist/github/mcp/auth.d.ts +2 -2
- package/dist/github/mcp/index.d.ts +2 -2
- package/dist/github/mcp/schemas.d.ts +1 -1
- package/dist/github/routes/tokenExchange.d.ts +2 -2
- package/dist/github/routes/webhooks.d.ts +2 -2
- package/dist/node_modules/.pnpm/@slack_logger@4.0.0/node_modules/@slack/logger/dist/index.js +89 -0
- package/dist/node_modules/.pnpm/@slack_socket-mode@2.0.5/node_modules/@slack/socket-mode/dist/package.js +85 -0
- package/dist/node_modules/.pnpm/@slack_socket-mode@2.0.5/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.js +223 -0
- package/dist/node_modules/.pnpm/@slack_socket-mode@2.0.5/node_modules/@slack/socket-mode/dist/src/SocketModeClient.js +367 -0
- package/dist/node_modules/.pnpm/@slack_socket-mode@2.0.5/node_modules/@slack/socket-mode/dist/src/UnrecoverableSocketModeStartError.js +20 -0
- package/dist/node_modules/.pnpm/@slack_socket-mode@2.0.5/node_modules/@slack/socket-mode/dist/src/errors.js +71 -0
- package/dist/node_modules/.pnpm/@slack_socket-mode@2.0.5/node_modules/@slack/socket-mode/dist/src/index.js +44 -0
- package/dist/node_modules/.pnpm/@slack_socket-mode@2.0.5/node_modules/@slack/socket-mode/dist/src/logger.js +32 -0
- package/dist/node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.js +241 -0
- package/dist/node_modules/.pnpm/ws@8.19.0/node_modules/ws/index.js +23 -0
- package/dist/node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/buffer-util.js +107 -0
- package/dist/node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/constants.js +29 -0
- package/dist/node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/event-target.js +226 -0
- package/dist/node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/extension.js +150 -0
- package/dist/node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/limiter.js +57 -0
- package/dist/node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/permessage-deflate.js +342 -0
- package/dist/node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/receiver.js +457 -0
- package/dist/node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/sender.js +505 -0
- package/dist/node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/stream.js +123 -0
- package/dist/node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/subprotocol.js +46 -0
- package/dist/node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/validation.js +203 -0
- package/dist/node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/websocket-server.js +385 -0
- package/dist/node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/websocket.js +985 -0
- package/dist/slack/dispatcher.d.ts +16 -0
- package/dist/slack/dispatcher.js +335 -0
- package/dist/slack/i18n/strings.d.ts +5 -5
- package/dist/slack/i18n/strings.js +9 -9
- package/dist/slack/index.d.ts +3 -1
- package/dist/slack/index.js +4 -2
- package/dist/slack/middleware/permissions.js +120 -107
- package/dist/slack/routes/events.js +10 -328
- package/dist/slack/routes/oauth.js +6 -3
- package/dist/slack/routes/users.js +12 -6
- package/dist/slack/routes/workspaces.js +31 -36
- package/dist/slack/services/blocks/index.js +7 -11
- package/dist/slack/services/commands/index.js +2 -2
- package/dist/slack/services/dev-config.d.ts +23 -0
- package/dist/slack/services/dev-config.js +91 -0
- package/dist/slack/services/events/app-mention.js +6 -17
- package/dist/slack/services/events/modal-submission.js +5 -5
- package/dist/slack/services/events/streaming.js +4 -3
- package/dist/slack/services/events/utils.js +8 -8
- package/dist/slack/services/index.js +1 -1
- package/dist/slack/services/modals.js +4 -4
- package/dist/slack/services/nango.d.ts +2 -0
- package/dist/slack/services/nango.js +84 -2
- package/dist/slack/socket-mode.d.ts +4 -0
- package/dist/slack/socket-mode.js +130 -0
- package/package.json +3 -2
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../_virtual/rolldown_runtime.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.js
|
|
4
|
+
var require_eventemitter3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5
|
+
var has = Object.prototype.hasOwnProperty, prefix = "~";
|
|
6
|
+
/**
|
|
7
|
+
* Constructor to create a storage for our `EE` objects.
|
|
8
|
+
* An `Events` instance is a plain object whose properties are event names.
|
|
9
|
+
*
|
|
10
|
+
* @constructor
|
|
11
|
+
* @private
|
|
12
|
+
*/
|
|
13
|
+
function Events() {}
|
|
14
|
+
if (Object.create) {
|
|
15
|
+
Events.prototype = Object.create(null);
|
|
16
|
+
if (!new Events().__proto__) prefix = false;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Representation of a single event listener.
|
|
20
|
+
*
|
|
21
|
+
* @param {Function} fn The listener function.
|
|
22
|
+
* @param {*} context The context to invoke the listener with.
|
|
23
|
+
* @param {Boolean} [once=false] Specify if the listener is a one-time listener.
|
|
24
|
+
* @constructor
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
function EE(fn, context, once) {
|
|
28
|
+
this.fn = fn;
|
|
29
|
+
this.context = context;
|
|
30
|
+
this.once = once || false;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Add a listener for a given event.
|
|
34
|
+
*
|
|
35
|
+
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
|
|
36
|
+
* @param {(String|Symbol)} event The event name.
|
|
37
|
+
* @param {Function} fn The listener function.
|
|
38
|
+
* @param {*} context The context to invoke the listener with.
|
|
39
|
+
* @param {Boolean} once Specify if the listener is a one-time listener.
|
|
40
|
+
* @returns {EventEmitter}
|
|
41
|
+
* @private
|
|
42
|
+
*/
|
|
43
|
+
function addListener(emitter, event, fn, context, once) {
|
|
44
|
+
if (typeof fn !== "function") throw new TypeError("The listener must be a function");
|
|
45
|
+
var listener = new EE(fn, context || emitter, once), evt = prefix ? prefix + event : event;
|
|
46
|
+
if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
|
|
47
|
+
else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
|
|
48
|
+
else emitter._events[evt] = [emitter._events[evt], listener];
|
|
49
|
+
return emitter;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Clear event by name.
|
|
53
|
+
*
|
|
54
|
+
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
|
|
55
|
+
* @param {(String|Symbol)} evt The Event name.
|
|
56
|
+
* @private
|
|
57
|
+
*/
|
|
58
|
+
function clearEvent(emitter, evt) {
|
|
59
|
+
if (--emitter._eventsCount === 0) emitter._events = new Events();
|
|
60
|
+
else delete emitter._events[evt];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Minimal `EventEmitter` interface that is molded against the Node.js
|
|
64
|
+
* `EventEmitter` interface.
|
|
65
|
+
*
|
|
66
|
+
* @constructor
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
function EventEmitter() {
|
|
70
|
+
this._events = new Events();
|
|
71
|
+
this._eventsCount = 0;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Return an array listing the events for which the emitter has registered
|
|
75
|
+
* listeners.
|
|
76
|
+
*
|
|
77
|
+
* @returns {Array}
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
80
|
+
EventEmitter.prototype.eventNames = function eventNames() {
|
|
81
|
+
var names = [], events, name;
|
|
82
|
+
if (this._eventsCount === 0) return names;
|
|
83
|
+
for (name in events = this._events) if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
|
|
84
|
+
if (Object.getOwnPropertySymbols) return names.concat(Object.getOwnPropertySymbols(events));
|
|
85
|
+
return names;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Return the listeners registered for a given event.
|
|
89
|
+
*
|
|
90
|
+
* @param {(String|Symbol)} event The event name.
|
|
91
|
+
* @returns {Array} The registered listeners.
|
|
92
|
+
* @public
|
|
93
|
+
*/
|
|
94
|
+
EventEmitter.prototype.listeners = function listeners(event) {
|
|
95
|
+
var evt = prefix ? prefix + event : event, handlers = this._events[evt];
|
|
96
|
+
if (!handlers) return [];
|
|
97
|
+
if (handlers.fn) return [handlers.fn];
|
|
98
|
+
for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) ee[i] = handlers[i].fn;
|
|
99
|
+
return ee;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Return the number of listeners listening to a given event.
|
|
103
|
+
*
|
|
104
|
+
* @param {(String|Symbol)} event The event name.
|
|
105
|
+
* @returns {Number} The number of listeners.
|
|
106
|
+
* @public
|
|
107
|
+
*/
|
|
108
|
+
EventEmitter.prototype.listenerCount = function listenerCount(event) {
|
|
109
|
+
var evt = prefix ? prefix + event : event, listeners = this._events[evt];
|
|
110
|
+
if (!listeners) return 0;
|
|
111
|
+
if (listeners.fn) return 1;
|
|
112
|
+
return listeners.length;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Calls each of the listeners registered for a given event.
|
|
116
|
+
*
|
|
117
|
+
* @param {(String|Symbol)} event The event name.
|
|
118
|
+
* @returns {Boolean} `true` if the event had listeners, else `false`.
|
|
119
|
+
* @public
|
|
120
|
+
*/
|
|
121
|
+
EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
|
|
122
|
+
var evt = prefix ? prefix + event : event;
|
|
123
|
+
if (!this._events[evt]) return false;
|
|
124
|
+
var listeners = this._events[evt], len = arguments.length, args, i;
|
|
125
|
+
if (listeners.fn) {
|
|
126
|
+
if (listeners.once) this.removeListener(event, listeners.fn, void 0, true);
|
|
127
|
+
switch (len) {
|
|
128
|
+
case 1: return listeners.fn.call(listeners.context), true;
|
|
129
|
+
case 2: return listeners.fn.call(listeners.context, a1), true;
|
|
130
|
+
case 3: return listeners.fn.call(listeners.context, a1, a2), true;
|
|
131
|
+
case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
|
|
132
|
+
case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
|
|
133
|
+
case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
|
|
134
|
+
}
|
|
135
|
+
for (i = 1, args = new Array(len - 1); i < len; i++) args[i - 1] = arguments[i];
|
|
136
|
+
listeners.fn.apply(listeners.context, args);
|
|
137
|
+
} else {
|
|
138
|
+
var length = listeners.length, j;
|
|
139
|
+
for (i = 0; i < length; i++) {
|
|
140
|
+
if (listeners[i].once) this.removeListener(event, listeners[i].fn, void 0, true);
|
|
141
|
+
switch (len) {
|
|
142
|
+
case 1:
|
|
143
|
+
listeners[i].fn.call(listeners[i].context);
|
|
144
|
+
break;
|
|
145
|
+
case 2:
|
|
146
|
+
listeners[i].fn.call(listeners[i].context, a1);
|
|
147
|
+
break;
|
|
148
|
+
case 3:
|
|
149
|
+
listeners[i].fn.call(listeners[i].context, a1, a2);
|
|
150
|
+
break;
|
|
151
|
+
case 4:
|
|
152
|
+
listeners[i].fn.call(listeners[i].context, a1, a2, a3);
|
|
153
|
+
break;
|
|
154
|
+
default:
|
|
155
|
+
if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) args[j - 1] = arguments[j];
|
|
156
|
+
listeners[i].fn.apply(listeners[i].context, args);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return true;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Add a listener for a given event.
|
|
164
|
+
*
|
|
165
|
+
* @param {(String|Symbol)} event The event name.
|
|
166
|
+
* @param {Function} fn The listener function.
|
|
167
|
+
* @param {*} [context=this] The context to invoke the listener with.
|
|
168
|
+
* @returns {EventEmitter} `this`.
|
|
169
|
+
* @public
|
|
170
|
+
*/
|
|
171
|
+
EventEmitter.prototype.on = function on(event, fn, context) {
|
|
172
|
+
return addListener(this, event, fn, context, false);
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* Add a one-time listener for a given event.
|
|
176
|
+
*
|
|
177
|
+
* @param {(String|Symbol)} event The event name.
|
|
178
|
+
* @param {Function} fn The listener function.
|
|
179
|
+
* @param {*} [context=this] The context to invoke the listener with.
|
|
180
|
+
* @returns {EventEmitter} `this`.
|
|
181
|
+
* @public
|
|
182
|
+
*/
|
|
183
|
+
EventEmitter.prototype.once = function once(event, fn, context) {
|
|
184
|
+
return addListener(this, event, fn, context, true);
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* Remove the listeners of a given event.
|
|
188
|
+
*
|
|
189
|
+
* @param {(String|Symbol)} event The event name.
|
|
190
|
+
* @param {Function} fn Only remove the listeners that match this function.
|
|
191
|
+
* @param {*} context Only remove the listeners that have this context.
|
|
192
|
+
* @param {Boolean} once Only remove one-time listeners.
|
|
193
|
+
* @returns {EventEmitter} `this`.
|
|
194
|
+
* @public
|
|
195
|
+
*/
|
|
196
|
+
EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
|
|
197
|
+
var evt = prefix ? prefix + event : event;
|
|
198
|
+
if (!this._events[evt]) return this;
|
|
199
|
+
if (!fn) {
|
|
200
|
+
clearEvent(this, evt);
|
|
201
|
+
return this;
|
|
202
|
+
}
|
|
203
|
+
var listeners = this._events[evt];
|
|
204
|
+
if (listeners.fn) {
|
|
205
|
+
if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) clearEvent(this, evt);
|
|
206
|
+
} else {
|
|
207
|
+
for (var i = 0, events = [], length = listeners.length; i < length; i++) if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) events.push(listeners[i]);
|
|
208
|
+
if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
|
|
209
|
+
else clearEvent(this, evt);
|
|
210
|
+
}
|
|
211
|
+
return this;
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* Remove all listeners, or those of the specified event.
|
|
215
|
+
*
|
|
216
|
+
* @param {(String|Symbol)} [event] The event name.
|
|
217
|
+
* @returns {EventEmitter} `this`.
|
|
218
|
+
* @public
|
|
219
|
+
*/
|
|
220
|
+
EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
|
|
221
|
+
var evt;
|
|
222
|
+
if (event) {
|
|
223
|
+
evt = prefix ? prefix + event : event;
|
|
224
|
+
if (this._events[evt]) clearEvent(this, evt);
|
|
225
|
+
} else {
|
|
226
|
+
this._events = new Events();
|
|
227
|
+
this._eventsCount = 0;
|
|
228
|
+
}
|
|
229
|
+
return this;
|
|
230
|
+
};
|
|
231
|
+
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
|
232
|
+
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
|
|
233
|
+
EventEmitter.prefixed = prefix;
|
|
234
|
+
EventEmitter.EventEmitter = EventEmitter;
|
|
235
|
+
if ("undefined" !== typeof module) module.exports = EventEmitter;
|
|
236
|
+
}));
|
|
237
|
+
|
|
238
|
+
//#endregion
|
|
239
|
+
export default require_eventemitter3();
|
|
240
|
+
|
|
241
|
+
export { require_eventemitter3 };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../_virtual/rolldown_runtime.js";
|
|
2
|
+
import { require_receiver } from "./lib/receiver.js";
|
|
3
|
+
import { require_sender } from "./lib/sender.js";
|
|
4
|
+
import { require_websocket } from "./lib/websocket.js";
|
|
5
|
+
import { require_stream } from "./lib/stream.js";
|
|
6
|
+
import { require_websocket_server } from "./lib/websocket-server.js";
|
|
7
|
+
|
|
8
|
+
//#region ../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/index.js
|
|
9
|
+
var require_ws = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
10
|
+
const WebSocket = require_websocket();
|
|
11
|
+
WebSocket.createWebSocketStream = require_stream();
|
|
12
|
+
WebSocket.Server = require_websocket_server();
|
|
13
|
+
WebSocket.Receiver = require_receiver();
|
|
14
|
+
WebSocket.Sender = require_sender();
|
|
15
|
+
WebSocket.WebSocket = WebSocket;
|
|
16
|
+
WebSocket.WebSocketServer = WebSocket.Server;
|
|
17
|
+
module.exports = WebSocket;
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
export default require_ws();
|
|
22
|
+
|
|
23
|
+
export { require_ws };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { __commonJSMin, __require } from "../../../../../../_virtual/rolldown_runtime.js";
|
|
2
|
+
import { require_constants } from "./constants.js";
|
|
3
|
+
|
|
4
|
+
//#region ../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/buffer-util.js
|
|
5
|
+
var require_buffer_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6
|
+
const { EMPTY_BUFFER } = require_constants();
|
|
7
|
+
const FastBuffer = Buffer[Symbol.species];
|
|
8
|
+
/**
|
|
9
|
+
* Merges an array of buffers into a new buffer.
|
|
10
|
+
*
|
|
11
|
+
* @param {Buffer[]} list The array of buffers to concat
|
|
12
|
+
* @param {Number} totalLength The total length of buffers in the list
|
|
13
|
+
* @return {Buffer} The resulting buffer
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
function concat(list, totalLength) {
|
|
17
|
+
if (list.length === 0) return EMPTY_BUFFER;
|
|
18
|
+
if (list.length === 1) return list[0];
|
|
19
|
+
const target = Buffer.allocUnsafe(totalLength);
|
|
20
|
+
let offset = 0;
|
|
21
|
+
for (let i = 0; i < list.length; i++) {
|
|
22
|
+
const buf = list[i];
|
|
23
|
+
target.set(buf, offset);
|
|
24
|
+
offset += buf.length;
|
|
25
|
+
}
|
|
26
|
+
if (offset < totalLength) return new FastBuffer(target.buffer, target.byteOffset, offset);
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Masks a buffer using the given mask.
|
|
31
|
+
*
|
|
32
|
+
* @param {Buffer} source The buffer to mask
|
|
33
|
+
* @param {Buffer} mask The mask to use
|
|
34
|
+
* @param {Buffer} output The buffer where to store the result
|
|
35
|
+
* @param {Number} offset The offset at which to start writing
|
|
36
|
+
* @param {Number} length The number of bytes to mask.
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
function _mask(source, mask, output, offset, length) {
|
|
40
|
+
for (let i = 0; i < length; i++) output[offset + i] = source[i] ^ mask[i & 3];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Unmasks a buffer using the given mask.
|
|
44
|
+
*
|
|
45
|
+
* @param {Buffer} buffer The buffer to unmask
|
|
46
|
+
* @param {Buffer} mask The mask to use
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
function _unmask(buffer, mask) {
|
|
50
|
+
for (let i = 0; i < buffer.length; i++) buffer[i] ^= mask[i & 3];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Converts a buffer to an `ArrayBuffer`.
|
|
54
|
+
*
|
|
55
|
+
* @param {Buffer} buf The buffer to convert
|
|
56
|
+
* @return {ArrayBuffer} Converted buffer
|
|
57
|
+
* @public
|
|
58
|
+
*/
|
|
59
|
+
function toArrayBuffer(buf) {
|
|
60
|
+
if (buf.length === buf.buffer.byteLength) return buf.buffer;
|
|
61
|
+
return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.length);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Converts `data` to a `Buffer`.
|
|
65
|
+
*
|
|
66
|
+
* @param {*} data The data to convert
|
|
67
|
+
* @return {Buffer} The buffer
|
|
68
|
+
* @throws {TypeError}
|
|
69
|
+
* @public
|
|
70
|
+
*/
|
|
71
|
+
function toBuffer(data) {
|
|
72
|
+
toBuffer.readOnly = true;
|
|
73
|
+
if (Buffer.isBuffer(data)) return data;
|
|
74
|
+
let buf;
|
|
75
|
+
if (data instanceof ArrayBuffer) buf = new FastBuffer(data);
|
|
76
|
+
else if (ArrayBuffer.isView(data)) buf = new FastBuffer(data.buffer, data.byteOffset, data.byteLength);
|
|
77
|
+
else {
|
|
78
|
+
buf = Buffer.from(data);
|
|
79
|
+
toBuffer.readOnly = false;
|
|
80
|
+
}
|
|
81
|
+
return buf;
|
|
82
|
+
}
|
|
83
|
+
module.exports = {
|
|
84
|
+
concat,
|
|
85
|
+
mask: _mask,
|
|
86
|
+
toArrayBuffer,
|
|
87
|
+
toBuffer,
|
|
88
|
+
unmask: _unmask
|
|
89
|
+
};
|
|
90
|
+
/* istanbul ignore else */
|
|
91
|
+
if (!process.env.WS_NO_BUFFER_UTIL) try {
|
|
92
|
+
const bufferUtil = __require("bufferutil");
|
|
93
|
+
module.exports.mask = function(source, mask, output, offset, length) {
|
|
94
|
+
if (length < 48) _mask(source, mask, output, offset, length);
|
|
95
|
+
else bufferUtil.mask(source, mask, output, offset, length);
|
|
96
|
+
};
|
|
97
|
+
module.exports.unmask = function(buffer, mask) {
|
|
98
|
+
if (buffer.length < 32) _unmask(buffer, mask);
|
|
99
|
+
else bufferUtil.unmask(buffer, mask);
|
|
100
|
+
};
|
|
101
|
+
} catch (e) {}
|
|
102
|
+
}));
|
|
103
|
+
|
|
104
|
+
//#endregion
|
|
105
|
+
export default require_buffer_util();
|
|
106
|
+
|
|
107
|
+
export { require_buffer_util };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../_virtual/rolldown_runtime.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/constants.js
|
|
4
|
+
var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5
|
+
const BINARY_TYPES = [
|
|
6
|
+
"nodebuffer",
|
|
7
|
+
"arraybuffer",
|
|
8
|
+
"fragments"
|
|
9
|
+
];
|
|
10
|
+
const hasBlob = typeof Blob !== "undefined";
|
|
11
|
+
if (hasBlob) BINARY_TYPES.push("blob");
|
|
12
|
+
module.exports = {
|
|
13
|
+
BINARY_TYPES,
|
|
14
|
+
CLOSE_TIMEOUT: 3e4,
|
|
15
|
+
EMPTY_BUFFER: Buffer.alloc(0),
|
|
16
|
+
GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
|
|
17
|
+
hasBlob,
|
|
18
|
+
kForOnEventAttribute: Symbol("kIsForOnEventAttribute"),
|
|
19
|
+
kListener: Symbol("kListener"),
|
|
20
|
+
kStatusCode: Symbol("status-code"),
|
|
21
|
+
kWebSocket: Symbol("websocket"),
|
|
22
|
+
NOOP: () => {}
|
|
23
|
+
};
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
export default require_constants();
|
|
28
|
+
|
|
29
|
+
export { require_constants };
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { __commonJSMin } from "../../../../../../_virtual/rolldown_runtime.js";
|
|
2
|
+
import { require_constants } from "./constants.js";
|
|
3
|
+
|
|
4
|
+
//#region ../../node_modules/.pnpm/ws@8.19.0/node_modules/ws/lib/event-target.js
|
|
5
|
+
var require_event_target = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
6
|
+
const { kForOnEventAttribute, kListener } = require_constants();
|
|
7
|
+
const kCode = Symbol("kCode");
|
|
8
|
+
const kData = Symbol("kData");
|
|
9
|
+
const kError = Symbol("kError");
|
|
10
|
+
const kMessage = Symbol("kMessage");
|
|
11
|
+
const kReason = Symbol("kReason");
|
|
12
|
+
const kTarget = Symbol("kTarget");
|
|
13
|
+
const kType = Symbol("kType");
|
|
14
|
+
const kWasClean = Symbol("kWasClean");
|
|
15
|
+
/**
|
|
16
|
+
* Class representing an event.
|
|
17
|
+
*/
|
|
18
|
+
var Event = class {
|
|
19
|
+
/**
|
|
20
|
+
* Create a new `Event`.
|
|
21
|
+
*
|
|
22
|
+
* @param {String} type The name of the event
|
|
23
|
+
* @throws {TypeError} If the `type` argument is not specified
|
|
24
|
+
*/
|
|
25
|
+
constructor(type) {
|
|
26
|
+
this[kTarget] = null;
|
|
27
|
+
this[kType] = type;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* @type {*}
|
|
31
|
+
*/
|
|
32
|
+
get target() {
|
|
33
|
+
return this[kTarget];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @type {String}
|
|
37
|
+
*/
|
|
38
|
+
get type() {
|
|
39
|
+
return this[kType];
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
Object.defineProperty(Event.prototype, "target", { enumerable: true });
|
|
43
|
+
Object.defineProperty(Event.prototype, "type", { enumerable: true });
|
|
44
|
+
/**
|
|
45
|
+
* Class representing a close event.
|
|
46
|
+
*
|
|
47
|
+
* @extends Event
|
|
48
|
+
*/
|
|
49
|
+
var CloseEvent = class extends Event {
|
|
50
|
+
/**
|
|
51
|
+
* Create a new `CloseEvent`.
|
|
52
|
+
*
|
|
53
|
+
* @param {String} type The name of the event
|
|
54
|
+
* @param {Object} [options] A dictionary object that allows for setting
|
|
55
|
+
* attributes via object members of the same name
|
|
56
|
+
* @param {Number} [options.code=0] The status code explaining why the
|
|
57
|
+
* connection was closed
|
|
58
|
+
* @param {String} [options.reason=''] A human-readable string explaining why
|
|
59
|
+
* the connection was closed
|
|
60
|
+
* @param {Boolean} [options.wasClean=false] Indicates whether or not the
|
|
61
|
+
* connection was cleanly closed
|
|
62
|
+
*/
|
|
63
|
+
constructor(type, options = {}) {
|
|
64
|
+
super(type);
|
|
65
|
+
this[kCode] = options.code === void 0 ? 0 : options.code;
|
|
66
|
+
this[kReason] = options.reason === void 0 ? "" : options.reason;
|
|
67
|
+
this[kWasClean] = options.wasClean === void 0 ? false : options.wasClean;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @type {Number}
|
|
71
|
+
*/
|
|
72
|
+
get code() {
|
|
73
|
+
return this[kCode];
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* @type {String}
|
|
77
|
+
*/
|
|
78
|
+
get reason() {
|
|
79
|
+
return this[kReason];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* @type {Boolean}
|
|
83
|
+
*/
|
|
84
|
+
get wasClean() {
|
|
85
|
+
return this[kWasClean];
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
Object.defineProperty(CloseEvent.prototype, "code", { enumerable: true });
|
|
89
|
+
Object.defineProperty(CloseEvent.prototype, "reason", { enumerable: true });
|
|
90
|
+
Object.defineProperty(CloseEvent.prototype, "wasClean", { enumerable: true });
|
|
91
|
+
/**
|
|
92
|
+
* Class representing an error event.
|
|
93
|
+
*
|
|
94
|
+
* @extends Event
|
|
95
|
+
*/
|
|
96
|
+
var ErrorEvent = class extends Event {
|
|
97
|
+
/**
|
|
98
|
+
* Create a new `ErrorEvent`.
|
|
99
|
+
*
|
|
100
|
+
* @param {String} type The name of the event
|
|
101
|
+
* @param {Object} [options] A dictionary object that allows for setting
|
|
102
|
+
* attributes via object members of the same name
|
|
103
|
+
* @param {*} [options.error=null] The error that generated this event
|
|
104
|
+
* @param {String} [options.message=''] The error message
|
|
105
|
+
*/
|
|
106
|
+
constructor(type, options = {}) {
|
|
107
|
+
super(type);
|
|
108
|
+
this[kError] = options.error === void 0 ? null : options.error;
|
|
109
|
+
this[kMessage] = options.message === void 0 ? "" : options.message;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* @type {*}
|
|
113
|
+
*/
|
|
114
|
+
get error() {
|
|
115
|
+
return this[kError];
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* @type {String}
|
|
119
|
+
*/
|
|
120
|
+
get message() {
|
|
121
|
+
return this[kMessage];
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
Object.defineProperty(ErrorEvent.prototype, "error", { enumerable: true });
|
|
125
|
+
Object.defineProperty(ErrorEvent.prototype, "message", { enumerable: true });
|
|
126
|
+
/**
|
|
127
|
+
* Class representing a message event.
|
|
128
|
+
*
|
|
129
|
+
* @extends Event
|
|
130
|
+
*/
|
|
131
|
+
var MessageEvent = class extends Event {
|
|
132
|
+
/**
|
|
133
|
+
* Create a new `MessageEvent`.
|
|
134
|
+
*
|
|
135
|
+
* @param {String} type The name of the event
|
|
136
|
+
* @param {Object} [options] A dictionary object that allows for setting
|
|
137
|
+
* attributes via object members of the same name
|
|
138
|
+
* @param {*} [options.data=null] The message content
|
|
139
|
+
*/
|
|
140
|
+
constructor(type, options = {}) {
|
|
141
|
+
super(type);
|
|
142
|
+
this[kData] = options.data === void 0 ? null : options.data;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* @type {*}
|
|
146
|
+
*/
|
|
147
|
+
get data() {
|
|
148
|
+
return this[kData];
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
Object.defineProperty(MessageEvent.prototype, "data", { enumerable: true });
|
|
152
|
+
/**
|
|
153
|
+
* This provides methods for emulating the `EventTarget` interface. It's not
|
|
154
|
+
* meant to be used directly.
|
|
155
|
+
*
|
|
156
|
+
* @mixin
|
|
157
|
+
*/
|
|
158
|
+
const EventTarget = {
|
|
159
|
+
addEventListener(type, handler, options = {}) {
|
|
160
|
+
for (const listener of this.listeners(type)) if (!options[kForOnEventAttribute] && listener[kListener] === handler && !listener[kForOnEventAttribute]) return;
|
|
161
|
+
let wrapper;
|
|
162
|
+
if (type === "message") wrapper = function onMessage(data, isBinary) {
|
|
163
|
+
const event = new MessageEvent("message", { data: isBinary ? data : data.toString() });
|
|
164
|
+
event[kTarget] = this;
|
|
165
|
+
callListener(handler, this, event);
|
|
166
|
+
};
|
|
167
|
+
else if (type === "close") wrapper = function onClose(code, message) {
|
|
168
|
+
const event = new CloseEvent("close", {
|
|
169
|
+
code,
|
|
170
|
+
reason: message.toString(),
|
|
171
|
+
wasClean: this._closeFrameReceived && this._closeFrameSent
|
|
172
|
+
});
|
|
173
|
+
event[kTarget] = this;
|
|
174
|
+
callListener(handler, this, event);
|
|
175
|
+
};
|
|
176
|
+
else if (type === "error") wrapper = function onError(error) {
|
|
177
|
+
const event = new ErrorEvent("error", {
|
|
178
|
+
error,
|
|
179
|
+
message: error.message
|
|
180
|
+
});
|
|
181
|
+
event[kTarget] = this;
|
|
182
|
+
callListener(handler, this, event);
|
|
183
|
+
};
|
|
184
|
+
else if (type === "open") wrapper = function onOpen() {
|
|
185
|
+
const event = new Event("open");
|
|
186
|
+
event[kTarget] = this;
|
|
187
|
+
callListener(handler, this, event);
|
|
188
|
+
};
|
|
189
|
+
else return;
|
|
190
|
+
wrapper[kForOnEventAttribute] = !!options[kForOnEventAttribute];
|
|
191
|
+
wrapper[kListener] = handler;
|
|
192
|
+
if (options.once) this.once(type, wrapper);
|
|
193
|
+
else this.on(type, wrapper);
|
|
194
|
+
},
|
|
195
|
+
removeEventListener(type, handler) {
|
|
196
|
+
for (const listener of this.listeners(type)) if (listener[kListener] === handler && !listener[kForOnEventAttribute]) {
|
|
197
|
+
this.removeListener(type, listener);
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
module.exports = {
|
|
203
|
+
CloseEvent,
|
|
204
|
+
ErrorEvent,
|
|
205
|
+
Event,
|
|
206
|
+
EventTarget,
|
|
207
|
+
MessageEvent
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* Call an event listener
|
|
211
|
+
*
|
|
212
|
+
* @param {(Function|Object)} listener The listener to call
|
|
213
|
+
* @param {*} thisArg The value to use as `this`` when calling the listener
|
|
214
|
+
* @param {Event} event The event to pass to the listener
|
|
215
|
+
* @private
|
|
216
|
+
*/
|
|
217
|
+
function callListener(listener, thisArg, event) {
|
|
218
|
+
if (typeof listener === "object" && listener.handleEvent) listener.handleEvent.call(listener, event);
|
|
219
|
+
else listener.call(thisArg, event);
|
|
220
|
+
}
|
|
221
|
+
}));
|
|
222
|
+
|
|
223
|
+
//#endregion
|
|
224
|
+
export default require_event_target();
|
|
225
|
+
|
|
226
|
+
export { require_event_target };
|