arri 0.19.0 → 0.19.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/cli.cjs CHANGED
@@ -12,7 +12,7 @@ const esbuild = require('esbuild');
12
12
  const esbuildPluginReplace = require('esbuild-plugin-replace');
13
13
  const path = require('pathe');
14
14
  const prettier = require('prettier');
15
- const config = require('./shared/arri.2034f594.cjs');
15
+ const config = require('./shared/arri.6b7e8945.cjs');
16
16
  const globby = require('globby');
17
17
  const scule = require('scule');
18
18
  const arriCodegenDart = require('arri-codegen-dart');
package/dist/cli.mjs CHANGED
@@ -11,7 +11,7 @@ import { build as build$1 } from 'esbuild';
11
11
  import { replace } from 'esbuild-plugin-replace';
12
12
  import path from 'pathe';
13
13
  import prettier from 'prettier';
14
- import { n as defaultConfig, m as isResolvedArriConfig, a as DEV_DEFINITION_ENDPOINT } from './shared/arri.97188bcb.mjs';
14
+ import { n as defaultConfig, m as isResolvedArriConfig, a as DEV_DEFINITION_ENDPOINT } from './shared/arri.ea72d98f.mjs';
15
15
  import { globby } from 'globby';
16
16
  import { camelCase, kebabCase } from 'scule';
17
17
  import { dartClientGenerator } from 'arri-codegen-dart';
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const config = require('./shared/arri.2034f594.cjs');
3
+ const config = require('./shared/arri.6b7e8945.cjs');
4
4
  const h3 = require('h3');
5
5
  require('arri-validate');
6
6
  require('node:process');
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { A as ArriApp, p as ArriRouter, a as DEV_DEFINITION_ENDPOINT, D as DEV_ENDPOINT_ROOT, E as ErrorResponse, B as EventStreamConnection, c as createRpcDefinition, n as defaultConfig, o as defineConfig, h as defineError, w as defineEventStreamRpc, q as defineRoute, d as defineRpc, j as errorResponseFromValidationErrors, y as formatSse, z as formatSseList, e as getRpcParamName, g as getRpcPath, f as getRpcResponseName, k as handleH3Error, t as handleRoute, l as isArriConfig, x as isEventStreamRpc, m as isResolvedArriConfig, b as isRpc, i as isRpcParamSchema, C as registerEventStreamRpc, s as registerRoute, r as registerRpc, u as setSseHeaders, v as validateRpcRequestInput } from './shared/arri.97188bcb.mjs';
1
+ export { A as ArriApp, p as ArriRouter, a as DEV_DEFINITION_ENDPOINT, D as DEV_ENDPOINT_ROOT, E as ErrorResponse, B as EventStreamConnection, c as createRpcDefinition, n as defaultConfig, o as defineConfig, h as defineError, w as defineEventStreamRpc, q as defineRoute, d as defineRpc, j as errorResponseFromValidationErrors, y as formatSse, z as formatSseList, e as getRpcParamName, g as getRpcPath, f as getRpcResponseName, k as handleH3Error, t as handleRoute, l as isArriConfig, x as isEventStreamRpc, m as isResolvedArriConfig, b as isRpc, i as isRpcParamSchema, C as registerEventStreamRpc, s as registerRoute, r as registerRpc, u as setSseHeaders, v as validateRpcRequestInput } from './shared/arri.ea72d98f.mjs';
2
2
  export * from 'h3';
3
3
  import 'arri-validate';
4
4
  import 'node:process';
@@ -302,7 +302,9 @@ function registerRpc(router, path, procedure, opts) {
302
302
  );
303
303
  }
304
304
  const response = await procedure.handler(
305
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
305
306
  event.context,
307
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
306
308
  event
307
309
  );
308
310
  event.context.response = response;
@@ -323,7 +325,10 @@ function registerRpc(router, path, procedure, opts) {
323
325
  await opts.onAfterResponse(event);
324
326
  }
325
327
  if (procedure.postHandler) {
326
- await procedure.postHandler(event.context, event);
328
+ await procedure.postHandler(
329
+ event.context,
330
+ event
331
+ );
327
332
  }
328
333
  } catch (err) {
329
334
  await handleH3Error(err, event, opts.onError);
@@ -420,8 +425,10 @@ var __publicField$2 = (obj, key, value) => {
420
425
  function setSseHeaders(event) {
421
426
  h3.setHeaders(event, {
422
427
  "Content-Type": "text/event-stream",
428
+ "Cache-Control": "private, no-cache, no-store, no-transform, must-revalidate, max-age=0",
423
429
  Connection: "keep-alive",
424
- "Cache-Control": "no-cache"
430
+ Pragma: "no-cache",
431
+ "X-Accel-Buffering": "no"
425
432
  });
426
433
  }
427
434
  function defineEventStreamRpc(config) {
@@ -468,8 +475,6 @@ class EventStreamConnection {
468
475
  __publicField$2(this, "pingInterval");
469
476
  __publicField$2(this, "pingIntervalMs");
470
477
  this.h3Event = event;
471
- setSseHeaders(this.h3Event);
472
- h3.setResponseStatus(this.h3Event, 200);
473
478
  const id = h3.getHeader(event, "Last-Event-ID");
474
479
  this.lastEventId = id;
475
480
  const { readable, writable } = new TransformStream();
@@ -487,6 +492,8 @@ class EventStreamConnection {
487
492
  * Start sending the event stream to the client
488
493
  */
489
494
  start() {
495
+ setSseHeaders(this.h3Event);
496
+ h3.setResponseStatus(this.h3Event, 200);
490
497
  this.h3Event._handled = true;
491
498
  void h3.sendStream(this.h3Event, this.readable);
492
499
  this.pingInterval = setInterval(async () => {
@@ -649,7 +656,10 @@ function registerEventStreamRpc(router, path, procedure, opts) {
649
656
  }
650
657
  });
651
658
  event.context.connection = connection;
652
- await procedure.handler(event.context, event);
659
+ await procedure.handler(
660
+ event.context,
661
+ event
662
+ );
653
663
  } catch (err) {
654
664
  await handleH3Error(err, event, opts.onError);
655
665
  }
@@ -300,7 +300,9 @@ function registerRpc(router, path, procedure, opts) {
300
300
  );
301
301
  }
302
302
  const response = await procedure.handler(
303
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
303
304
  event.context,
305
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
304
306
  event
305
307
  );
306
308
  event.context.response = response;
@@ -321,7 +323,10 @@ function registerRpc(router, path, procedure, opts) {
321
323
  await opts.onAfterResponse(event);
322
324
  }
323
325
  if (procedure.postHandler) {
324
- await procedure.postHandler(event.context, event);
326
+ await procedure.postHandler(
327
+ event.context,
328
+ event
329
+ );
325
330
  }
326
331
  } catch (err) {
327
332
  await handleH3Error(err, event, opts.onError);
@@ -418,8 +423,10 @@ var __publicField$2 = (obj, key, value) => {
418
423
  function setSseHeaders(event) {
419
424
  setHeaders(event, {
420
425
  "Content-Type": "text/event-stream",
426
+ "Cache-Control": "private, no-cache, no-store, no-transform, must-revalidate, max-age=0",
421
427
  Connection: "keep-alive",
422
- "Cache-Control": "no-cache"
428
+ Pragma: "no-cache",
429
+ "X-Accel-Buffering": "no"
423
430
  });
424
431
  }
425
432
  function defineEventStreamRpc(config) {
@@ -466,8 +473,6 @@ class EventStreamConnection {
466
473
  __publicField$2(this, "pingInterval");
467
474
  __publicField$2(this, "pingIntervalMs");
468
475
  this.h3Event = event;
469
- setSseHeaders(this.h3Event);
470
- setResponseStatus(this.h3Event, 200);
471
476
  const id = getHeader(event, "Last-Event-ID");
472
477
  this.lastEventId = id;
473
478
  const { readable, writable } = new TransformStream();
@@ -485,6 +490,8 @@ class EventStreamConnection {
485
490
  * Start sending the event stream to the client
486
491
  */
487
492
  start() {
493
+ setSseHeaders(this.h3Event);
494
+ setResponseStatus(this.h3Event, 200);
488
495
  this.h3Event._handled = true;
489
496
  void sendStream(this.h3Event, this.readable);
490
497
  this.pingInterval = setInterval(async () => {
@@ -647,7 +654,10 @@ function registerEventStreamRpc(router, path, procedure, opts) {
647
654
  }
648
655
  });
649
656
  event.context.connection = connection;
650
- await procedure.handler(event.context, event);
657
+ await procedure.handler(
658
+ event.context,
659
+ event
660
+ );
651
661
  } catch (err) {
652
662
  await handleH3Error(err, event, opts.onError);
653
663
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arri",
3
- "version": "0.19.0",
3
+ "version": "0.19.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -25,30 +25,29 @@
25
25
  "arri": "./dist/cli.mjs"
26
26
  },
27
27
  "dependencies": {
28
+ "@joshmossas/listhen": "1.5.13",
28
29
  "c12": "^1.5.1",
29
30
  "chokidar": "^3.5.3",
30
31
  "citty": "^0.1.5",
31
32
  "consola": "^3.2.3",
32
33
  "degit": "^2.8.4",
33
- "esbuild": "^0.19.8",
34
+ "esbuild": "^0.19.10",
34
35
  "esbuild-plugin-replace": "^1.4.0",
35
36
  "globby": "^14.0.0",
36
37
  "h3": "^1.9.0",
37
38
  "jiti": "^1.21.0",
38
39
  "ofetch": "^1.3.3",
39
40
  "pathe": "^1.1.1",
40
- "prettier": "^3.1.0",
41
+ "prettier": "^3.1.1",
41
42
  "scule": "^1.1.1",
42
43
  "uncrypto": "^0.1.3",
43
- "@joshmossas/listhen": "1.5.13",
44
- "arri-codegen-ts": "0.19.0",
45
- "arri-codegen-dart": "0.19.0",
46
- "arri-codegen-utils": "0.19.0",
47
- "arri-validate": "0.19.0"
44
+ "arri-codegen-dart": "0.19.3",
45
+ "arri-validate": "0.19.3",
46
+ "arri-codegen-utils": "0.19.3",
47
+ "arri-codegen-ts": "0.19.3"
48
48
  },
49
- "peerDependencies": {},
50
49
  "devDependencies": {
51
50
  "@types/degit": "^2.8.6",
52
- "bun-types": "^1.0.14"
51
+ "bun-types": "^1.0.20"
53
52
  }
54
53
  }