@arrirpc/client 0.58.1 → 0.60.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/dist/index.cjs +0 -40
- package/dist/index.d.cts +1 -3
- package/dist/index.d.mts +1 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.mjs +1 -39
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -269,44 +269,6 @@ function arriSseRequest(opts, options) {
|
|
|
269
269
|
});
|
|
270
270
|
return controller;
|
|
271
271
|
}
|
|
272
|
-
function parseSseEvent(input, dataParser) {
|
|
273
|
-
let id;
|
|
274
|
-
let event;
|
|
275
|
-
let data;
|
|
276
|
-
const lines = input.split("\n");
|
|
277
|
-
for (const line of lines) {
|
|
278
|
-
if (line.startsWith("id:")) {
|
|
279
|
-
id = line.substring(3).trim();
|
|
280
|
-
continue;
|
|
281
|
-
}
|
|
282
|
-
if (line.startsWith("event:")) {
|
|
283
|
-
event = line.substring(6).trim();
|
|
284
|
-
continue;
|
|
285
|
-
}
|
|
286
|
-
if (line.startsWith("data:")) {
|
|
287
|
-
data = dataParser(line.substring(5).trim());
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
if (!data) {
|
|
291
|
-
return void 0;
|
|
292
|
-
}
|
|
293
|
-
return {
|
|
294
|
-
id,
|
|
295
|
-
event,
|
|
296
|
-
data
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
function parseSseEvents(input, dataParser) {
|
|
300
|
-
const eventStrings = input.split("\n\n");
|
|
301
|
-
const events = [];
|
|
302
|
-
for (const str of eventStrings) {
|
|
303
|
-
const event = parseSseEvent(str, dataParser);
|
|
304
|
-
if (event) {
|
|
305
|
-
events.push(event);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
return events;
|
|
309
|
-
}
|
|
310
272
|
|
|
311
273
|
var __defProp = Object.defineProperty;
|
|
312
274
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -486,8 +448,6 @@ exports.arriSseRequest = arriSseRequest;
|
|
|
486
448
|
exports.arriWsRequest = arriWsRequest;
|
|
487
449
|
exports.isArriError = isArriError;
|
|
488
450
|
exports.isObject = isObject;
|
|
489
|
-
exports.parseSseEvent = parseSseEvent;
|
|
490
|
-
exports.parseSseEvents = parseSseEvents;
|
|
491
451
|
exports.parsedWsResponse = parsedWsResponse;
|
|
492
452
|
exports.serializeString = serializeString;
|
|
493
453
|
Object.keys(eventSourcePlus).forEach(function (k) {
|
package/dist/index.d.cts
CHANGED
|
@@ -97,8 +97,6 @@ interface SseOptions<TData> {
|
|
|
97
97
|
maxRetryInterval?: number;
|
|
98
98
|
}
|
|
99
99
|
declare function arriSseRequest<TType, TParams extends Record<any, any> | undefined = undefined>(opts: ArriRequestOpts<TType, TParams>, options: SseOptions<TType>): EventSourceController;
|
|
100
|
-
declare function parseSseEvent<TData = string>(input: string, dataParser: (input: string) => TData): SseEvent<TData> | undefined;
|
|
101
|
-
declare function parseSseEvents<TData = string>(input: string, dataParser: (input: string) => TData): SseEvent<TData>[];
|
|
102
100
|
|
|
103
101
|
interface WsControllerOptions<TParams, TResponse> {
|
|
104
102
|
url: string;
|
|
@@ -157,4 +155,4 @@ declare function parsedWsResponse(input: string): {
|
|
|
157
155
|
data: string;
|
|
158
156
|
};
|
|
159
157
|
|
|
160
|
-
export { type ArriEnumValidator, type ArriError, ArriErrorInstance, type ArriModelValidator, type ArriRequestOpts, INT16_MAX, INT16_MIN, INT32_MAX, INT32_MIN, INT64_MAX, INT64_MIN, INT8_MAX, INT8_MIN, type SafeResponse, type SseEvent, type SseOptions, UINT16_MAX, UINT32_MAX, UINT64_MAX, UINT8_MAX, WsController, type WsOptions, arriRequest, arriSafeRequest, arriSseRequest, arriWsRequest, isArriError, isObject,
|
|
158
|
+
export { type ArriEnumValidator, type ArriError, ArriErrorInstance, type ArriModelValidator, type ArriRequestOpts, INT16_MAX, INT16_MIN, INT32_MAX, INT32_MIN, INT64_MAX, INT64_MIN, INT8_MAX, INT8_MIN, type SafeResponse, type SseEvent, type SseOptions, UINT16_MAX, UINT32_MAX, UINT64_MAX, UINT8_MAX, WsController, type WsOptions, arriRequest, arriSafeRequest, arriSseRequest, arriWsRequest, isArriError, isObject, parsedWsResponse, serializeString };
|
package/dist/index.d.mts
CHANGED
|
@@ -97,8 +97,6 @@ interface SseOptions<TData> {
|
|
|
97
97
|
maxRetryInterval?: number;
|
|
98
98
|
}
|
|
99
99
|
declare function arriSseRequest<TType, TParams extends Record<any, any> | undefined = undefined>(opts: ArriRequestOpts<TType, TParams>, options: SseOptions<TType>): EventSourceController;
|
|
100
|
-
declare function parseSseEvent<TData = string>(input: string, dataParser: (input: string) => TData): SseEvent<TData> | undefined;
|
|
101
|
-
declare function parseSseEvents<TData = string>(input: string, dataParser: (input: string) => TData): SseEvent<TData>[];
|
|
102
100
|
|
|
103
101
|
interface WsControllerOptions<TParams, TResponse> {
|
|
104
102
|
url: string;
|
|
@@ -157,4 +155,4 @@ declare function parsedWsResponse(input: string): {
|
|
|
157
155
|
data: string;
|
|
158
156
|
};
|
|
159
157
|
|
|
160
|
-
export { type ArriEnumValidator, type ArriError, ArriErrorInstance, type ArriModelValidator, type ArriRequestOpts, INT16_MAX, INT16_MIN, INT32_MAX, INT32_MIN, INT64_MAX, INT64_MIN, INT8_MAX, INT8_MIN, type SafeResponse, type SseEvent, type SseOptions, UINT16_MAX, UINT32_MAX, UINT64_MAX, UINT8_MAX, WsController, type WsOptions, arriRequest, arriSafeRequest, arriSseRequest, arriWsRequest, isArriError, isObject,
|
|
158
|
+
export { type ArriEnumValidator, type ArriError, ArriErrorInstance, type ArriModelValidator, type ArriRequestOpts, INT16_MAX, INT16_MIN, INT32_MAX, INT32_MIN, INT64_MAX, INT64_MIN, INT8_MAX, INT8_MIN, type SafeResponse, type SseEvent, type SseOptions, UINT16_MAX, UINT32_MAX, UINT64_MAX, UINT8_MAX, WsController, type WsOptions, arriRequest, arriSafeRequest, arriSseRequest, arriWsRequest, isArriError, isObject, parsedWsResponse, serializeString };
|
package/dist/index.d.ts
CHANGED
|
@@ -97,8 +97,6 @@ interface SseOptions<TData> {
|
|
|
97
97
|
maxRetryInterval?: number;
|
|
98
98
|
}
|
|
99
99
|
declare function arriSseRequest<TType, TParams extends Record<any, any> | undefined = undefined>(opts: ArriRequestOpts<TType, TParams>, options: SseOptions<TType>): EventSourceController;
|
|
100
|
-
declare function parseSseEvent<TData = string>(input: string, dataParser: (input: string) => TData): SseEvent<TData> | undefined;
|
|
101
|
-
declare function parseSseEvents<TData = string>(input: string, dataParser: (input: string) => TData): SseEvent<TData>[];
|
|
102
100
|
|
|
103
101
|
interface WsControllerOptions<TParams, TResponse> {
|
|
104
102
|
url: string;
|
|
@@ -157,4 +155,4 @@ declare function parsedWsResponse(input: string): {
|
|
|
157
155
|
data: string;
|
|
158
156
|
};
|
|
159
157
|
|
|
160
|
-
export { type ArriEnumValidator, type ArriError, ArriErrorInstance, type ArriModelValidator, type ArriRequestOpts, INT16_MAX, INT16_MIN, INT32_MAX, INT32_MIN, INT64_MAX, INT64_MIN, INT8_MAX, INT8_MIN, type SafeResponse, type SseEvent, type SseOptions, UINT16_MAX, UINT32_MAX, UINT64_MAX, UINT8_MAX, WsController, type WsOptions, arriRequest, arriSafeRequest, arriSseRequest, arriWsRequest, isArriError, isObject,
|
|
158
|
+
export { type ArriEnumValidator, type ArriError, ArriErrorInstance, type ArriModelValidator, type ArriRequestOpts, INT16_MAX, INT16_MIN, INT32_MAX, INT32_MIN, INT64_MAX, INT64_MIN, INT8_MAX, INT8_MIN, type SafeResponse, type SseEvent, type SseOptions, UINT16_MAX, UINT32_MAX, UINT64_MAX, UINT8_MAX, WsController, type WsOptions, arriRequest, arriSafeRequest, arriSseRequest, arriWsRequest, isArriError, isObject, parsedWsResponse, serializeString };
|
package/dist/index.mjs
CHANGED
|
@@ -264,44 +264,6 @@ function arriSseRequest(opts, options) {
|
|
|
264
264
|
});
|
|
265
265
|
return controller;
|
|
266
266
|
}
|
|
267
|
-
function parseSseEvent(input, dataParser) {
|
|
268
|
-
let id;
|
|
269
|
-
let event;
|
|
270
|
-
let data;
|
|
271
|
-
const lines = input.split("\n");
|
|
272
|
-
for (const line of lines) {
|
|
273
|
-
if (line.startsWith("id:")) {
|
|
274
|
-
id = line.substring(3).trim();
|
|
275
|
-
continue;
|
|
276
|
-
}
|
|
277
|
-
if (line.startsWith("event:")) {
|
|
278
|
-
event = line.substring(6).trim();
|
|
279
|
-
continue;
|
|
280
|
-
}
|
|
281
|
-
if (line.startsWith("data:")) {
|
|
282
|
-
data = dataParser(line.substring(5).trim());
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
if (!data) {
|
|
286
|
-
return void 0;
|
|
287
|
-
}
|
|
288
|
-
return {
|
|
289
|
-
id,
|
|
290
|
-
event,
|
|
291
|
-
data
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
function parseSseEvents(input, dataParser) {
|
|
295
|
-
const eventStrings = input.split("\n\n");
|
|
296
|
-
const events = [];
|
|
297
|
-
for (const str of eventStrings) {
|
|
298
|
-
const event = parseSseEvent(str, dataParser);
|
|
299
|
-
if (event) {
|
|
300
|
-
events.push(event);
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
return events;
|
|
304
|
-
}
|
|
305
267
|
|
|
306
268
|
var __defProp = Object.defineProperty;
|
|
307
269
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -461,4 +423,4 @@ function parsedWsResponse(input) {
|
|
|
461
423
|
};
|
|
462
424
|
}
|
|
463
425
|
|
|
464
|
-
export { ArriErrorInstance, INT16_MAX, INT16_MIN, INT32_MAX, INT32_MIN, INT64_MAX, INT64_MIN, INT8_MAX, INT8_MIN, UINT16_MAX, UINT32_MAX, UINT64_MAX, UINT8_MAX, WsController, arriRequest, arriSafeRequest, arriSseRequest, arriWsRequest, isArriError, isObject,
|
|
426
|
+
export { ArriErrorInstance, INT16_MAX, INT16_MIN, INT32_MAX, INT32_MIN, INT64_MAX, INT64_MIN, INT8_MAX, INT8_MIN, UINT16_MAX, UINT32_MAX, UINT64_MAX, UINT8_MAX, WsController, arriRequest, arriSafeRequest, arriSseRequest, arriWsRequest, isArriError, isObject, parsedWsResponse, serializeString };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arrirpc/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.60.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@joshmossas/ofetch": "^1.3.5",
|
|
26
26
|
"event-source-plus": "^0.1.3",
|
|
27
27
|
"ws": "^8.18.0",
|
|
28
|
-
"@arrirpc/schema": "0.
|
|
28
|
+
"@arrirpc/schema": "0.60.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/ws": "^8.5.12"
|