arri 0.0.27 → 0.0.29

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.
@@ -35,14 +35,14 @@ require('node:v8');
35
35
  require('consola');
36
36
  require('esbuild');
37
37
  require('prettier');
38
- require('../shared/arri.198ae3ea.cjs');
38
+ require('../shared/arri.50fd4bf9.cjs');
39
39
  require('@sinclair/typebox');
40
40
  require('h3');
41
41
  require('@sinclair/typebox/errors');
42
42
  require('@sinclair/typebox/value');
43
43
  require('../index.cjs');
44
44
  require('ofetch');
45
- require('../shared/arri.2826746b.cjs');
45
+ require('../shared/arri.fa2beb45.cjs');
46
46
  require('child_process');
47
47
  require('listhen');
48
48
 
@@ -3819,14 +3819,26 @@ const Pack = warner$1(class Pack extends Minipass {
3819
3819
 
3820
3820
  this.portable = !!opt.portable;
3821
3821
  this.zip = null;
3822
- if (opt.gzip) {
3823
- if (typeof opt.gzip !== 'object') {
3824
- opt.gzip = {};
3822
+
3823
+ if (opt.gzip || opt.brotli) {
3824
+ if (opt.gzip && opt.brotli) {
3825
+ throw new TypeError('gzip and brotli are mutually exclusive')
3826
+ }
3827
+ if (opt.gzip) {
3828
+ if (typeof opt.gzip !== 'object') {
3829
+ opt.gzip = {};
3830
+ }
3831
+ if (this.portable) {
3832
+ opt.gzip.portable = true;
3833
+ }
3834
+ this.zip = new zlib$1.Gzip(opt.gzip);
3825
3835
  }
3826
- if (this.portable) {
3827
- opt.gzip.portable = true;
3836
+ if (opt.brotli) {
3837
+ if (typeof opt.brotli !== 'object') {
3838
+ opt.brotli = {};
3839
+ }
3840
+ this.zip = new zlib$1.BrotliCompress(opt.brotli);
3828
3841
  }
3829
- this.zip = new zlib$1.Gzip(opt.gzip);
3830
3842
  this.zip.on('data', chunk => super.write(chunk));
3831
3843
  this.zip.on('end', _ => super.end());
3832
3844
  this.zip.on('drain', _ => this[ONDRAIN]());
@@ -4678,6 +4690,16 @@ var parse$1 = warner(class Parser extends EE {
4678
4690
  this.strict = !!opt.strict;
4679
4691
  this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize;
4680
4692
  this.filter = typeof opt.filter === 'function' ? opt.filter : noop;
4693
+ // Unlike gzip, brotli doesn't have any magic bytes to identify it
4694
+ // Users need to explicitly tell us they're extracting a brotli file
4695
+ // Or we infer from the file extension
4696
+ const isTBR = (opt.file && (
4697
+ opt.file.endsWith('.tar.br') || opt.file.endsWith('.tbr')));
4698
+ // if it's a tbr file it MIGHT be brotli, but we don't know until
4699
+ // we look at it and verify it's not a valid tar file.
4700
+ this.brotli = !opt.gzip && opt.brotli !== undefined ? opt.brotli
4701
+ : isTBR ? undefined
4702
+ : false;
4681
4703
 
4682
4704
  // have to set this so that streams are ok piping into it
4683
4705
  this.writable = true;
@@ -4928,7 +4950,9 @@ var parse$1 = warner(class Parser extends EE {
4928
4950
  }
4929
4951
 
4930
4952
  // first write, might be gzipped
4931
- if (this[UNZIP] === null && chunk) {
4953
+ const needSniff = this[UNZIP] === null ||
4954
+ this.brotli === undefined && this[UNZIP] === false;
4955
+ if (needSniff && chunk) {
4932
4956
  if (this[BUFFER]) {
4933
4957
  chunk = Buffer.concat([this[BUFFER], chunk]);
4934
4958
  this[BUFFER] = null;
@@ -4937,15 +4961,45 @@ var parse$1 = warner(class Parser extends EE {
4937
4961
  this[BUFFER] = chunk;
4938
4962
  return true
4939
4963
  }
4964
+
4965
+ // look for gzip header
4940
4966
  for (let i = 0; this[UNZIP] === null && i < gzipHeader.length; i++) {
4941
4967
  if (chunk[i] !== gzipHeader[i]) {
4942
4968
  this[UNZIP] = false;
4943
4969
  }
4944
4970
  }
4945
- if (this[UNZIP] === null) {
4971
+
4972
+ const maybeBrotli = this.brotli === undefined;
4973
+ if (this[UNZIP] === false && maybeBrotli) {
4974
+ // read the first header to see if it's a valid tar file. If so,
4975
+ // we can safely assume that it's not actually brotli, despite the
4976
+ // .tbr or .tar.br file extension.
4977
+ // if we ended before getting a full chunk, yes, def brotli
4978
+ if (chunk.length < 512) {
4979
+ if (this[ENDED$1]) {
4980
+ this.brotli = true;
4981
+ } else {
4982
+ this[BUFFER] = chunk;
4983
+ return true
4984
+ }
4985
+ } else {
4986
+ // if it's tar, it's pretty reliably not brotli, chances of
4987
+ // that happening are astronomical.
4988
+ try {
4989
+ new Header(chunk.slice(0, 512));
4990
+ this.brotli = false;
4991
+ } catch (_) {
4992
+ this.brotli = true;
4993
+ }
4994
+ }
4995
+ }
4996
+
4997
+ if (this[UNZIP] === null || (this[UNZIP] === false && this.brotli)) {
4946
4998
  const ended = this[ENDED$1];
4947
4999
  this[ENDED$1] = false;
4948
- this[UNZIP] = new zlib.Unzip();
5000
+ this[UNZIP] = this[UNZIP] === null
5001
+ ? new zlib.Unzip()
5002
+ : new zlib.BrotliDecompress();
4949
5003
  this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk));
4950
5004
  this[UNZIP].on('error', er => this.abort(er));
4951
5005
  this[UNZIP].on('end', _ => {
@@ -5083,6 +5137,7 @@ var parse$1 = warner(class Parser extends EE {
5083
5137
  this[UNZIP].end(chunk);
5084
5138
  } else {
5085
5139
  this[ENDED$1] = true;
5140
+ if (this.brotli === undefined) chunk = chunk || Buffer.alloc(0);
5086
5141
  this.write(chunk);
5087
5142
  }
5088
5143
  }
@@ -33,14 +33,14 @@ import 'node:v8';
33
33
  import 'consola';
34
34
  import 'esbuild';
35
35
  import 'prettier';
36
- import '../shared/arri.74885d3a.mjs';
36
+ import '../shared/arri.e62071ea.mjs';
37
37
  import '@sinclair/typebox';
38
38
  import 'h3';
39
39
  import '@sinclair/typebox/errors';
40
40
  import '@sinclair/typebox/value';
41
41
  import '../index.mjs';
42
42
  import 'ofetch';
43
- import '../shared/arri.7f1296ca.mjs';
43
+ import '../shared/arri.64252c62.mjs';
44
44
  import 'child_process';
45
45
  import 'listhen';
46
46
 
@@ -3798,14 +3798,26 @@ const Pack = warner$1(class Pack extends Minipass {
3798
3798
 
3799
3799
  this.portable = !!opt.portable;
3800
3800
  this.zip = null;
3801
- if (opt.gzip) {
3802
- if (typeof opt.gzip !== 'object') {
3803
- opt.gzip = {};
3801
+
3802
+ if (opt.gzip || opt.brotli) {
3803
+ if (opt.gzip && opt.brotli) {
3804
+ throw new TypeError('gzip and brotli are mutually exclusive')
3805
+ }
3806
+ if (opt.gzip) {
3807
+ if (typeof opt.gzip !== 'object') {
3808
+ opt.gzip = {};
3809
+ }
3810
+ if (this.portable) {
3811
+ opt.gzip.portable = true;
3812
+ }
3813
+ this.zip = new zlib$1.Gzip(opt.gzip);
3804
3814
  }
3805
- if (this.portable) {
3806
- opt.gzip.portable = true;
3815
+ if (opt.brotli) {
3816
+ if (typeof opt.brotli !== 'object') {
3817
+ opt.brotli = {};
3818
+ }
3819
+ this.zip = new zlib$1.BrotliCompress(opt.brotli);
3807
3820
  }
3808
- this.zip = new zlib$1.Gzip(opt.gzip);
3809
3821
  this.zip.on('data', chunk => super.write(chunk));
3810
3822
  this.zip.on('end', _ => super.end());
3811
3823
  this.zip.on('drain', _ => this[ONDRAIN]());
@@ -4657,6 +4669,16 @@ var parse$1 = warner(class Parser extends EE {
4657
4669
  this.strict = !!opt.strict;
4658
4670
  this.maxMetaEntrySize = opt.maxMetaEntrySize || maxMetaEntrySize;
4659
4671
  this.filter = typeof opt.filter === 'function' ? opt.filter : noop;
4672
+ // Unlike gzip, brotli doesn't have any magic bytes to identify it
4673
+ // Users need to explicitly tell us they're extracting a brotli file
4674
+ // Or we infer from the file extension
4675
+ const isTBR = (opt.file && (
4676
+ opt.file.endsWith('.tar.br') || opt.file.endsWith('.tbr')));
4677
+ // if it's a tbr file it MIGHT be brotli, but we don't know until
4678
+ // we look at it and verify it's not a valid tar file.
4679
+ this.brotli = !opt.gzip && opt.brotli !== undefined ? opt.brotli
4680
+ : isTBR ? undefined
4681
+ : false;
4660
4682
 
4661
4683
  // have to set this so that streams are ok piping into it
4662
4684
  this.writable = true;
@@ -4907,7 +4929,9 @@ var parse$1 = warner(class Parser extends EE {
4907
4929
  }
4908
4930
 
4909
4931
  // first write, might be gzipped
4910
- if (this[UNZIP] === null && chunk) {
4932
+ const needSniff = this[UNZIP] === null ||
4933
+ this.brotli === undefined && this[UNZIP] === false;
4934
+ if (needSniff && chunk) {
4911
4935
  if (this[BUFFER]) {
4912
4936
  chunk = Buffer.concat([this[BUFFER], chunk]);
4913
4937
  this[BUFFER] = null;
@@ -4916,15 +4940,45 @@ var parse$1 = warner(class Parser extends EE {
4916
4940
  this[BUFFER] = chunk;
4917
4941
  return true
4918
4942
  }
4943
+
4944
+ // look for gzip header
4919
4945
  for (let i = 0; this[UNZIP] === null && i < gzipHeader.length; i++) {
4920
4946
  if (chunk[i] !== gzipHeader[i]) {
4921
4947
  this[UNZIP] = false;
4922
4948
  }
4923
4949
  }
4924
- if (this[UNZIP] === null) {
4950
+
4951
+ const maybeBrotli = this.brotli === undefined;
4952
+ if (this[UNZIP] === false && maybeBrotli) {
4953
+ // read the first header to see if it's a valid tar file. If so,
4954
+ // we can safely assume that it's not actually brotli, despite the
4955
+ // .tbr or .tar.br file extension.
4956
+ // if we ended before getting a full chunk, yes, def brotli
4957
+ if (chunk.length < 512) {
4958
+ if (this[ENDED$1]) {
4959
+ this.brotli = true;
4960
+ } else {
4961
+ this[BUFFER] = chunk;
4962
+ return true
4963
+ }
4964
+ } else {
4965
+ // if it's tar, it's pretty reliably not brotli, chances of
4966
+ // that happening are astronomical.
4967
+ try {
4968
+ new Header(chunk.slice(0, 512));
4969
+ this.brotli = false;
4970
+ } catch (_) {
4971
+ this.brotli = true;
4972
+ }
4973
+ }
4974
+ }
4975
+
4976
+ if (this[UNZIP] === null || (this[UNZIP] === false && this.brotli)) {
4925
4977
  const ended = this[ENDED$1];
4926
4978
  this[ENDED$1] = false;
4927
- this[UNZIP] = new zlib.Unzip();
4979
+ this[UNZIP] = this[UNZIP] === null
4980
+ ? new zlib.Unzip()
4981
+ : new zlib.BrotliDecompress();
4928
4982
  this[UNZIP].on('data', chunk => this[CONSUMECHUNK](chunk));
4929
4983
  this[UNZIP].on('error', er => this.abort(er));
4930
4984
  this[UNZIP].on('end', _ => {
@@ -5062,6 +5116,7 @@ var parse$1 = warner(class Parser extends EE {
5062
5116
  this[UNZIP].end(chunk);
5063
5117
  } else {
5064
5118
  this[ENDED$1] = true;
5119
+ if (this.brotli === undefined) chunk = chunk || Buffer.alloc(0);
5065
5120
  this.write(chunk);
5066
5121
  }
5067
5122
  }
package/dist/cli.cjs CHANGED
@@ -25,7 +25,7 @@ const require$$0$3 = require('stream');
25
25
  const consola = require('consola');
26
26
  const esbuild = require('esbuild');
27
27
  const prettier = require('prettier');
28
- const app = require('./shared/arri.198ae3ea.cjs');
28
+ const app = require('./shared/arri.50fd4bf9.cjs');
29
29
  const index = require('./index.cjs');
30
30
  require('node:stream');
31
31
  const ofetch = require('ofetch');
@@ -33,7 +33,7 @@ require('@sinclair/typebox');
33
33
  require('h3');
34
34
  require('@sinclair/typebox/errors');
35
35
  require('@sinclair/typebox/value');
36
- const dart = require('./shared/arri.2826746b.cjs');
36
+ const dart = require('./shared/arri.fa2beb45.cjs');
37
37
  const listhen = require('listhen');
38
38
  require('child_process');
39
39
 
package/dist/cli.mjs CHANGED
@@ -23,7 +23,7 @@ import require$$0$3 from 'stream';
23
23
  import { createConsola } from 'consola';
24
24
  import { build as build$1 } from 'esbuild';
25
25
  import prettier from 'prettier';
26
- import { j as camelCase, r as removeDisallowedChars, o as kebabCase, k as isApplicationDef, D as DEV_DEFINITION_ENDPOINT } from './shared/arri.74885d3a.mjs';
26
+ import { j as camelCase, r as removeDisallowedChars, o as kebabCase, k as isApplicationDef, D as DEV_DEFINITION_ENDPOINT } from './shared/arri.e62071ea.mjs';
27
27
  import { defaultConfig } from './index.mjs';
28
28
  import 'node:stream';
29
29
  import { ofetch } from 'ofetch';
@@ -31,7 +31,7 @@ import '@sinclair/typebox';
31
31
  import 'h3';
32
32
  import '@sinclair/typebox/errors';
33
33
  import '@sinclair/typebox/value';
34
- import { a as dartClientGenerator } from './shared/arri.7f1296ca.mjs';
34
+ import { a as dartClientGenerator } from './shared/arri.64252c62.mjs';
35
35
  import { listenAndWatch } from 'listhen';
36
36
  import 'child_process';
37
37
 
package/dist/codegen.cjs CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  const require$$0 = require('fs');
4
4
  const prettier = require('prettier');
5
- const app = require('./shared/arri.198ae3ea.cjs');
6
- const dart = require('./shared/arri.2826746b.cjs');
5
+ const app = require('./shared/arri.50fd4bf9.cjs');
6
+ const dart = require('./shared/arri.fa2beb45.cjs');
7
7
  require('@sinclair/typebox');
8
8
  require('h3');
9
9
  require('@sinclair/typebox/errors');
@@ -1,5 +1,5 @@
1
- import { B as ClientGeneratorPlugin, F as ApplicationDef, S as ServiceDef, P as ProcedureDef, J as JsonSchemaObject } from './shared/arri.f0cec5fb.cjs';
2
- export { C as ClientGenerator, a6 as JsonSchemaArray, a2 as JsonSchemaComplexType, X as JsonSchemaComplexTypeValues, a9 as JsonSchemaEnum, a0 as JsonSchemaNullType, W as JsonSchemaNullTypeValues, a4 as JsonSchemaRecord, _ as JsonSchemaScalarType, V as JsonSchemaScalarTypeValues, Y as JsonSchemaType, Z as JsonSchemaTypeValue, a8 as JsonSchemaUint8Array, G as defineClientGeneratorPlugin, N as isApplicationDef, a7 as isJsonSchemaArray, aa as isJsonSchemaEnum, a1 as isJsonSchemaNullType, a3 as isJsonSchemaObject, a5 as isJsonSchemaRecord, $ as isJsonSchemaScalarType, K as isProcedureDef, L as isServiceDef, I as normalizeWhitespace, U as removeDisallowedChars, T as setNestedObjectProperty, O as unflattenObject, Q as unflattenProcedures } from './shared/arri.f0cec5fb.cjs';
1
+ import { F as ClientGeneratorPlugin, G as ApplicationDef, S as ServiceDef, P as ProcedureDef, J as JsonSchemaObject } from './shared/arri.1f0e8d09.cjs';
2
+ export { C as ClientGenerator, a7 as JsonSchemaArray, a3 as JsonSchemaComplexType, Y as JsonSchemaComplexTypeValues, aa as JsonSchemaEnum, a1 as JsonSchemaNullType, X as JsonSchemaNullTypeValues, a5 as JsonSchemaRecord, $ as JsonSchemaScalarType, W as JsonSchemaScalarTypeValues, Z as JsonSchemaType, _ as JsonSchemaTypeValue, a9 as JsonSchemaUint8Array, I as defineClientGeneratorPlugin, O as isApplicationDef, a8 as isJsonSchemaArray, ab as isJsonSchemaEnum, a2 as isJsonSchemaNullType, a4 as isJsonSchemaObject, a6 as isJsonSchemaRecord, a0 as isJsonSchemaScalarType, L as isProcedureDef, N as isServiceDef, K as normalizeWhitespace, V as removeDisallowedChars, U as setNestedObjectProperty, Q as unflattenObject, T as unflattenProcedures } from './shared/arri.1f0e8d09.cjs';
3
3
  import '@sinclair/typebox';
4
4
  import 'h3';
5
5
 
@@ -1,5 +1,5 @@
1
- import { B as ClientGeneratorPlugin, F as ApplicationDef, S as ServiceDef, P as ProcedureDef, J as JsonSchemaObject } from './shared/arri.f0cec5fb.mjs';
2
- export { C as ClientGenerator, a6 as JsonSchemaArray, a2 as JsonSchemaComplexType, X as JsonSchemaComplexTypeValues, a9 as JsonSchemaEnum, a0 as JsonSchemaNullType, W as JsonSchemaNullTypeValues, a4 as JsonSchemaRecord, _ as JsonSchemaScalarType, V as JsonSchemaScalarTypeValues, Y as JsonSchemaType, Z as JsonSchemaTypeValue, a8 as JsonSchemaUint8Array, G as defineClientGeneratorPlugin, N as isApplicationDef, a7 as isJsonSchemaArray, aa as isJsonSchemaEnum, a1 as isJsonSchemaNullType, a3 as isJsonSchemaObject, a5 as isJsonSchemaRecord, $ as isJsonSchemaScalarType, K as isProcedureDef, L as isServiceDef, I as normalizeWhitespace, U as removeDisallowedChars, T as setNestedObjectProperty, O as unflattenObject, Q as unflattenProcedures } from './shared/arri.f0cec5fb.mjs';
1
+ import { F as ClientGeneratorPlugin, G as ApplicationDef, S as ServiceDef, P as ProcedureDef, J as JsonSchemaObject } from './shared/arri.1f0e8d09.mjs';
2
+ export { C as ClientGenerator, a7 as JsonSchemaArray, a3 as JsonSchemaComplexType, Y as JsonSchemaComplexTypeValues, aa as JsonSchemaEnum, a1 as JsonSchemaNullType, X as JsonSchemaNullTypeValues, a5 as JsonSchemaRecord, $ as JsonSchemaScalarType, W as JsonSchemaScalarTypeValues, Z as JsonSchemaType, _ as JsonSchemaTypeValue, a9 as JsonSchemaUint8Array, I as defineClientGeneratorPlugin, O as isApplicationDef, a8 as isJsonSchemaArray, ab as isJsonSchemaEnum, a2 as isJsonSchemaNullType, a4 as isJsonSchemaObject, a6 as isJsonSchemaRecord, a0 as isJsonSchemaScalarType, L as isProcedureDef, N as isServiceDef, K as normalizeWhitespace, V as removeDisallowedChars, U as setNestedObjectProperty, Q as unflattenObject, T as unflattenProcedures } from './shared/arri.1f0e8d09.mjs';
3
3
  import '@sinclair/typebox';
4
4
  import 'h3';
5
5
 
package/dist/codegen.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { B as ClientGeneratorPlugin, F as ApplicationDef, S as ServiceDef, P as ProcedureDef, J as JsonSchemaObject } from './shared/arri.f0cec5fb.js';
2
- export { C as ClientGenerator, a6 as JsonSchemaArray, a2 as JsonSchemaComplexType, X as JsonSchemaComplexTypeValues, a9 as JsonSchemaEnum, a0 as JsonSchemaNullType, W as JsonSchemaNullTypeValues, a4 as JsonSchemaRecord, _ as JsonSchemaScalarType, V as JsonSchemaScalarTypeValues, Y as JsonSchemaType, Z as JsonSchemaTypeValue, a8 as JsonSchemaUint8Array, G as defineClientGeneratorPlugin, N as isApplicationDef, a7 as isJsonSchemaArray, aa as isJsonSchemaEnum, a1 as isJsonSchemaNullType, a3 as isJsonSchemaObject, a5 as isJsonSchemaRecord, $ as isJsonSchemaScalarType, K as isProcedureDef, L as isServiceDef, I as normalizeWhitespace, U as removeDisallowedChars, T as setNestedObjectProperty, O as unflattenObject, Q as unflattenProcedures } from './shared/arri.f0cec5fb.js';
1
+ import { F as ClientGeneratorPlugin, G as ApplicationDef, S as ServiceDef, P as ProcedureDef, J as JsonSchemaObject } from './shared/arri.1f0e8d09.js';
2
+ export { C as ClientGenerator, a7 as JsonSchemaArray, a3 as JsonSchemaComplexType, Y as JsonSchemaComplexTypeValues, aa as JsonSchemaEnum, a1 as JsonSchemaNullType, X as JsonSchemaNullTypeValues, a5 as JsonSchemaRecord, $ as JsonSchemaScalarType, W as JsonSchemaScalarTypeValues, Z as JsonSchemaType, _ as JsonSchemaTypeValue, a9 as JsonSchemaUint8Array, I as defineClientGeneratorPlugin, O as isApplicationDef, a8 as isJsonSchemaArray, ab as isJsonSchemaEnum, a2 as isJsonSchemaNullType, a4 as isJsonSchemaObject, a6 as isJsonSchemaRecord, a0 as isJsonSchemaScalarType, L as isProcedureDef, N as isServiceDef, K as normalizeWhitespace, V as removeDisallowedChars, U as setNestedObjectProperty, Q as unflattenObject, T as unflattenProcedures } from './shared/arri.1f0e8d09.js';
3
3
  import '@sinclair/typebox';
4
4
  import 'h3';
5
5
 
package/dist/codegen.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  import { writeFileSync } from 'fs';
2
2
  import { format } from 'prettier';
3
- import { u as unflattenObject, i as isServiceDef, p as pascalCase, a as isProcedureDef, b as isJsonSchemaScalarType, c as isJsonSchemaNullType, d as isJsonSchemaObject, e as isJsonSchemaRecord, f as isJsonSchemaEnum, g as isJsonSchemaArray, h as unflattenProcedures, j as camelCase } from './shared/arri.74885d3a.mjs';
4
- export { m as JsonSchemaComplexTypeValues, l as JsonSchemaNullTypeValues, J as JsonSchemaScalarTypeValues, k as isApplicationDef, n as normalizeWhitespace, r as removeDisallowedChars, s as setNestedObjectProperty } from './shared/arri.74885d3a.mjs';
5
- import { d as defineClientGeneratorPlugin } from './shared/arri.7f1296ca.mjs';
6
- export { j as classListTransformer, i as classTransformer, c as createDartClient, a as dartClientGenerator, f as dartModelFromJsonSchema, h as dartParsedJsonField, e as dartProcedureFromServiceDefinition, g as dartPropertyTypeFromSchema, b as dartServiceFromServiceDefinition, k as isDartType, l as isDartTypeWithNullables, t as transformers } from './shared/arri.7f1296ca.mjs';
3
+ import { u as unflattenObject, i as isServiceDef, p as pascalCase, a as isProcedureDef, b as isJsonSchemaScalarType, c as isJsonSchemaNullType, d as isJsonSchemaObject, e as isJsonSchemaRecord, f as isJsonSchemaEnum, g as isJsonSchemaArray, h as unflattenProcedures, j as camelCase } from './shared/arri.e62071ea.mjs';
4
+ export { m as JsonSchemaComplexTypeValues, l as JsonSchemaNullTypeValues, J as JsonSchemaScalarTypeValues, k as isApplicationDef, n as normalizeWhitespace, r as removeDisallowedChars, s as setNestedObjectProperty } from './shared/arri.e62071ea.mjs';
5
+ import { d as defineClientGeneratorPlugin } from './shared/arri.64252c62.mjs';
6
+ export { j as classListTransformer, i as classTransformer, c as createDartClient, a as dartClientGenerator, f as dartModelFromJsonSchema, h as dartParsedJsonField, e as dartProcedureFromServiceDefinition, g as dartPropertyTypeFromSchema, b as dartServiceFromServiceDefinition, k as isDartType, l as isDartTypeWithNullables, t as transformers } from './shared/arri.64252c62.mjs';
7
7
  import '@sinclair/typebox';
8
8
  import 'h3';
9
9
  import '@sinclair/typebox/errors';
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const app = require('./shared/arri.198ae3ea.cjs');
3
+ const app = require('./shared/arri.50fd4bf9.cjs');
4
4
  require('@sinclair/typebox');
5
5
  require('h3');
6
6
  require('@sinclair/typebox/errors');
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as ClientGenerator } from './shared/arri.f0cec5fb.cjs';
2
- export { A as Arri, d as ArriProcedure, c as ArriProcedureBase, g as ArriProcedureHandler, h as ArriProcedurePostHandler, q as ArriRoute, v as ArriRouteHandler, y as ArriRoutePostHandler, a as DEV_DEFINITION_ENDPOINT, D as DEV_ENDPOINT_ROOT, E as ExtractParam, u as ExtractParams, e as HandlerContext, b as HttpMethod, H as HttpMethodValues, M as Middleware, w as RouteHandlerContext, x as RoutePostHandlerContext, R as RpcHandlerContext, f as RpcPostHandlerContext, l as createRpcDefinition, t as defineMiddleware, s as defineRoute, k as defineRpc, o as getRpcParamDefinition, n as getRpcParamName, m as getRpcPath, p as getRpcResponseName, i as isHttpMethod, j as isRpc, z as registerRoute, r as registerRpc } from './shared/arri.f0cec5fb.cjs';
1
+ import { C as ClientGenerator } from './shared/arri.1f0e8d09.cjs';
2
+ export { A as Arri, b as ArriOptions, e as ArriProcedure, d as ArriProcedureBase, h as ArriProcedureHandler, j as ArriProcedurePostHandler, s as ArriRoute, w as ArriRouteHandler, z as ArriRoutePostHandler, a as DEV_DEFINITION_ENDPOINT, D as DEV_ENDPOINT_ROOT, E as ExtractParam, v as ExtractParams, f as HandlerContext, c as HttpMethod, H as HttpMethodValues, M as Middleware, x as RouteHandlerContext, y as RoutePostHandlerContext, R as RpcHandlerContext, g as RpcPostHandlerContext, m as createRpcDefinition, u as defineMiddleware, t as defineRoute, l as defineRpc, p as getRpcParamDefinition, o as getRpcParamName, n as getRpcPath, q as getRpcResponseName, i as isHttpMethod, k as isRpc, B as registerRoute, r as registerRpc } from './shared/arri.1f0e8d09.cjs';
3
3
  import * as _sinclair_typebox from '@sinclair/typebox';
4
4
  import { Static } from '@sinclair/typebox';
5
5
  import { ValueError } from '@sinclair/typebox/errors';
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as ClientGenerator } from './shared/arri.f0cec5fb.mjs';
2
- export { A as Arri, d as ArriProcedure, c as ArriProcedureBase, g as ArriProcedureHandler, h as ArriProcedurePostHandler, q as ArriRoute, v as ArriRouteHandler, y as ArriRoutePostHandler, a as DEV_DEFINITION_ENDPOINT, D as DEV_ENDPOINT_ROOT, E as ExtractParam, u as ExtractParams, e as HandlerContext, b as HttpMethod, H as HttpMethodValues, M as Middleware, w as RouteHandlerContext, x as RoutePostHandlerContext, R as RpcHandlerContext, f as RpcPostHandlerContext, l as createRpcDefinition, t as defineMiddleware, s as defineRoute, k as defineRpc, o as getRpcParamDefinition, n as getRpcParamName, m as getRpcPath, p as getRpcResponseName, i as isHttpMethod, j as isRpc, z as registerRoute, r as registerRpc } from './shared/arri.f0cec5fb.mjs';
1
+ import { C as ClientGenerator } from './shared/arri.1f0e8d09.mjs';
2
+ export { A as Arri, b as ArriOptions, e as ArriProcedure, d as ArriProcedureBase, h as ArriProcedureHandler, j as ArriProcedurePostHandler, s as ArriRoute, w as ArriRouteHandler, z as ArriRoutePostHandler, a as DEV_DEFINITION_ENDPOINT, D as DEV_ENDPOINT_ROOT, E as ExtractParam, v as ExtractParams, f as HandlerContext, c as HttpMethod, H as HttpMethodValues, M as Middleware, x as RouteHandlerContext, y as RoutePostHandlerContext, R as RpcHandlerContext, g as RpcPostHandlerContext, m as createRpcDefinition, u as defineMiddleware, t as defineRoute, l as defineRpc, p as getRpcParamDefinition, o as getRpcParamName, n as getRpcPath, q as getRpcResponseName, i as isHttpMethod, k as isRpc, B as registerRoute, r as registerRpc } from './shared/arri.1f0e8d09.mjs';
3
3
  import * as _sinclair_typebox from '@sinclair/typebox';
4
4
  import { Static } from '@sinclair/typebox';
5
5
  import { ValueError } from '@sinclair/typebox/errors';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as ClientGenerator } from './shared/arri.f0cec5fb.js';
2
- export { A as Arri, d as ArriProcedure, c as ArriProcedureBase, g as ArriProcedureHandler, h as ArriProcedurePostHandler, q as ArriRoute, v as ArriRouteHandler, y as ArriRoutePostHandler, a as DEV_DEFINITION_ENDPOINT, D as DEV_ENDPOINT_ROOT, E as ExtractParam, u as ExtractParams, e as HandlerContext, b as HttpMethod, H as HttpMethodValues, M as Middleware, w as RouteHandlerContext, x as RoutePostHandlerContext, R as RpcHandlerContext, f as RpcPostHandlerContext, l as createRpcDefinition, t as defineMiddleware, s as defineRoute, k as defineRpc, o as getRpcParamDefinition, n as getRpcParamName, m as getRpcPath, p as getRpcResponseName, i as isHttpMethod, j as isRpc, z as registerRoute, r as registerRpc } from './shared/arri.f0cec5fb.js';
1
+ import { C as ClientGenerator } from './shared/arri.1f0e8d09.js';
2
+ export { A as Arri, b as ArriOptions, e as ArriProcedure, d as ArriProcedureBase, h as ArriProcedureHandler, j as ArriProcedurePostHandler, s as ArriRoute, w as ArriRouteHandler, z as ArriRoutePostHandler, a as DEV_DEFINITION_ENDPOINT, D as DEV_ENDPOINT_ROOT, E as ExtractParam, v as ExtractParams, f as HandlerContext, c as HttpMethod, H as HttpMethodValues, M as Middleware, x as RouteHandlerContext, y as RoutePostHandlerContext, R as RpcHandlerContext, g as RpcPostHandlerContext, m as createRpcDefinition, u as defineMiddleware, t as defineRoute, l as defineRpc, p as getRpcParamDefinition, o as getRpcParamName, n as getRpcPath, q as getRpcResponseName, i as isHttpMethod, k as isRpc, B as registerRoute, r as registerRpc } from './shared/arri.1f0e8d09.js';
3
3
  import * as _sinclair_typebox from '@sinclair/typebox';
4
4
  import { Static } from '@sinclair/typebox';
5
5
  import { ValueError } from '@sinclair/typebox/errors';
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { A as Arri, D as DEV_DEFINITION_ENDPOINT, q as DEV_ENDPOINT_ROOT, K as ErrorResponse, H as HttpMethodValues, x as createRpcDefinition, L as defineError, G as defineMiddleware, F as defineRoute, w as defineRpc, M as errorResponseFromValidationErrors, B as getRpcParamDefinition, z as getRpcParamName, y as getRpcPath, C as getRpcResponseName, t as isHttpMethod, v as isRpc, I as registerRoute, E as registerRpc } from './shared/arri.74885d3a.mjs';
1
+ export { A as Arri, D as DEV_DEFINITION_ENDPOINT, q as DEV_ENDPOINT_ROOT, K as ErrorResponse, H as HttpMethodValues, x as createRpcDefinition, L as defineError, G as defineMiddleware, F as defineRoute, w as defineRpc, M as errorResponseFromValidationErrors, B as getRpcParamDefinition, z as getRpcParamName, y as getRpcPath, C as getRpcResponseName, t as isHttpMethod, v as isRpc, I as registerRoute, E as registerRpc } from './shared/arri.e62071ea.mjs';
2
2
  import '@sinclair/typebox';
3
3
  import 'h3';
4
4
  import '@sinclair/typebox/errors';
@@ -1,5 +1,5 @@
1
1
  import { TObject, TSchema, Static } from '@sinclair/typebox';
2
- import { Router, H3Event, App, AppOptions } from 'h3';
2
+ import { H3Event, Router, App, H3Error } from 'h3';
3
3
 
4
4
  interface ApplicationDef {
5
5
  arriSchemaVersion: "0.0.1";
@@ -101,12 +101,13 @@ interface ArriRoute<TPath extends string, TMethod extends HttpMethod, TQuery ext
101
101
  postHandler?: ArriRoutePostHandler<TPath, TQuery extends TObject ? Static<TQuery> : undefined, TBody extends TObject ? Static<TObject> : undefined, TResponse extends TSchema ? Static<TResponse> : TFallbackResponse>;
102
102
  }
103
103
  declare function defineRoute<TPath extends string, TMethod extends HttpMethod, TQuery extends TObject | undefined = any, TBody extends TSchema | undefined = any, TResponse extends TSchema | undefined = undefined, TFallbackResponse = any>(config: ArriRoute<TPath, TMethod, TQuery, TBody, TResponse, TFallbackResponse>): ArriRoute<TPath, TMethod, TQuery, TBody, TResponse, TFallbackResponse>;
104
- type Middleware = (context: HandlerContext) => void | Promise<void>;
104
+ type Middleware = (context: HandlerContext, event: H3Event) => void | Promise<void>;
105
105
  declare const defineMiddleware: (middleware: Middleware) => Middleware;
106
106
  type ExtractParam<Path, NextPart> = Path extends `:${infer Param}` ? Record<Param, string> & NextPart : NextPart;
107
107
  type ExtractParams<Path> = Path extends `${infer Segment}/${infer Rest}` ? ExtractParam<Segment, ExtractParams<Rest>> : ExtractParam<Path, {}>;
108
- type ArriRouteHandler<TPath extends string, TQuery = undefined, TBody = undefined, TResponse = any> = (context: RouteHandlerContext<ExtractParams<TPath>, TQuery, TBody>) => TResponse extends undefined ? void | Promise<void> : TResponse | Promise<TResponse>;
108
+ type ArriRouteHandler<TPath extends string, TQuery = undefined, TBody = undefined, TResponse = any> = (context: RouteHandlerContext<ExtractParams<TPath>, TQuery, TBody>, event: H3Event) => TResponse extends undefined ? void | Promise<void> : TResponse | Promise<TResponse>;
109
109
  interface RouteHandlerContext<TParams extends Record<string, string>, TQuery = undefined, TBody = undefined> extends HandlerContext {
110
+ type: "route";
110
111
  params: TParams;
111
112
  query: TQuery;
112
113
  body: TBody;
@@ -114,8 +115,8 @@ interface RouteHandlerContext<TParams extends Record<string, string>, TQuery = u
114
115
  interface RoutePostHandlerContext<TParams extends Record<string, string>, TQuery = undefined, TBody = undefined, TResponse = undefined> extends RouteHandlerContext<TParams, TQuery, TBody> {
115
116
  response: TResponse;
116
117
  }
117
- type ArriRoutePostHandler<TPath extends string, TQuery = undefined, TBody = undefined, TResponse = undefined> = (context: RoutePostHandlerContext<ExtractParams<TPath>, TQuery, TBody, TResponse>) => any;
118
- declare function registerRoute<TPath extends string>(router: Router, route: ArriRoute<TPath, HttpMethod, any, any, any>, middleware: Middleware[], prefix?: string): void;
118
+ type ArriRoutePostHandler<TPath extends string, TQuery = undefined, TBody = undefined, TResponse = undefined> = (context: RoutePostHandlerContext<ExtractParams<TPath>, TQuery, TBody, TResponse>, event: H3Event) => any;
119
+ declare function registerRoute<TPath extends string>(router: Router, route: ArriRoute<TPath, HttpMethod, any, any, any>, middleware: Middleware[], prefix?: string, opts?: ArriOptions): void;
119
120
 
120
121
  interface ArriProcedureBase {
121
122
  method: HttpMethod;
@@ -132,18 +133,16 @@ interface ArriProcedure<TParams extends TObject | undefined, TResponse extends T
132
133
  handler: ArriProcedureHandler<TParams extends TObject ? Static<TParams> : undefined, TResponse extends TObject ? Static<TResponse> : void>;
133
134
  postHandler?: ArriProcedurePostHandler<TParams extends TObject ? Static<TParams> : undefined, TResponse extends TObject ? Static<TResponse> : undefined>;
134
135
  }
135
- interface HandlerContext {
136
- [key: string]: any;
137
- event: H3Event;
138
- }
136
+ type HandlerContext = Record<string, any>;
139
137
  interface RpcHandlerContext<TParams = undefined> extends HandlerContext {
138
+ type: "procedure";
140
139
  params: TParams;
141
140
  }
142
141
  interface RpcPostHandlerContext<TParams = undefined, TResponse = undefined> extends RpcHandlerContext<TParams> {
143
142
  response: TResponse;
144
143
  }
145
- type ArriProcedureHandler<TParams, TResponse> = (context: RpcHandlerContext<TParams>) => TResponse | Promise<TResponse>;
146
- type ArriProcedurePostHandler<TParams, TResponse> = (event: RpcPostHandlerContext<TParams, TResponse>) => any;
144
+ type ArriProcedureHandler<TParams, TResponse> = (context: RpcHandlerContext<TParams>, event: H3Event) => TResponse | Promise<TResponse>;
145
+ type ArriProcedurePostHandler<TParams, TResponse> = (context: RpcPostHandlerContext<TParams, TResponse>, event: H3Event) => any;
147
146
  declare function isRpc(input: any): input is ArriProcedure<any, any>;
148
147
  declare function defineRpc<TParams extends TObject | undefined = undefined, TResponse extends TObject | undefined | never = undefined>(config: ArriProcedure<TParams, TResponse>): ArriProcedure<TParams, TResponse>;
149
148
  declare function createRpcDefinition(rpcName: string, httpPath: string, procedure: ArriProcedure<any, any>): ProcedureDef;
@@ -151,20 +150,8 @@ declare function getRpcPath(rpcName: string, prefix?: string): string;
151
150
  declare function getRpcParamName(rpcName: string, procedure: ArriProcedure<any, any>): string | null;
152
151
  declare function getRpcParamDefinition(rpcName: string, procedure: ArriProcedure<any, any>): ProcedureDef["params"];
153
152
  declare function getRpcResponseName(rpcName: string, procedure: ArriProcedure<any, any>): string | null;
154
- declare function registerRpc(router: Router, path: string, procedure: ArriProcedure<any, any>, middleware: Middleware[]): void;
153
+ declare function registerRpc(router: Router, path: string, procedure: ArriProcedure<any, any>, middleware: Middleware[], opts: ArriOptions): void;
155
154
 
156
- interface ArriOptions extends AppOptions {
157
- /**
158
- * Metadata to display in the __definition.json file
159
- */
160
- appInfo?: ApplicationDef["info"];
161
- rpcRoutePrefix?: string;
162
- /**
163
- * Defaults to /__definitions
164
- * This parameters also takes the rpcRoutePrefix option into account
165
- */
166
- rpcDefinitionPath?: string;
167
- }
168
155
  declare const DEV_ENDPOINT_ROOT = "/__arri_dev__";
169
156
  declare const DEV_DEFINITION_ENDPOINT = "/__arri_dev__/definition";
170
157
  declare class Arri {
@@ -177,6 +164,9 @@ declare class Arri {
177
164
  private procedures;
178
165
  private models;
179
166
  private readonly middlewares;
167
+ private readonly onAfterResponse;
168
+ private readonly onBeforeResponse;
169
+ private readonly onError;
180
170
  constructor(opts?: ArriOptions);
181
171
  registerMiddleware(middleware: Middleware): void;
182
172
  registerRpc<TParams extends TObject | undefined, TResponse extends TObject | undefined>(name: string, procedure: ArriProcedure<TParams, TResponse>): void;
@@ -184,6 +174,23 @@ declare class Arri {
184
174
  getAppDefinition(): ApplicationDef;
185
175
  getH3Instance(): App;
186
176
  }
177
+ interface ArriOptions {
178
+ debug?: boolean;
179
+ /**
180
+ * Metadata to display in the __definition.json file
181
+ */
182
+ appInfo?: ApplicationDef["info"];
183
+ rpcRoutePrefix?: string;
184
+ /**
185
+ * Defaults to /__definitions
186
+ * This parameters also takes the rpcRoutePrefix option into account
187
+ */
188
+ rpcDefinitionPath?: string;
189
+ onRequest?: (event: H3Event) => void | Promise<void>;
190
+ onAfterResponse?: (context: RpcPostHandlerContext | RoutePostHandlerContext<any>, event: H3Event) => void | Promise<void>;
191
+ onBeforeResponse?: (context: RpcPostHandlerContext | RoutePostHandlerContext<any>, event: H3Event) => void | Promise<void>;
192
+ onError?: (error: H3Error, context: RpcHandlerContext | RouteHandlerContext<any>, event: H3Event) => void | Promise<void>;
193
+ }
187
194
  declare const HttpMethodValues: readonly ["get", "post", "put", "patch", "delete", "head"];
188
195
  type HttpMethod = (typeof HttpMethodValues)[number];
189
196
  declare const isHttpMethod: (input: any) => input is "get" | "post" | "put" | "patch" | "delete" | "head";
@@ -195,4 +202,4 @@ interface ClientGenerator<TOptions extends Record<string, any> | undefined> {
195
202
  type ClientGeneratorPlugin<TOptions extends Record<string, any> | undefined> = (options: TOptions) => ClientGenerator<TOptions>;
196
203
  declare function defineClientGeneratorPlugin<TOptions extends Record<string, any> | undefined>(plugin: ClientGeneratorPlugin<TOptions>): ClientGeneratorPlugin<TOptions>;
197
204
 
198
- export { isJsonSchemaScalarType as $, Arri as A, type ClientGeneratorPlugin as B, type ClientGenerator as C, DEV_ENDPOINT_ROOT as D, type ExtractParam as E, type ApplicationDef as F, defineClientGeneratorPlugin as G, HttpMethodValues as H, normalizeWhitespace as I, type JsonSchemaObject as J, isProcedureDef as K, isServiceDef as L, type Middleware as M, isApplicationDef as N, unflattenObject as O, type ProcedureDef as P, unflattenProcedures as Q, type RpcHandlerContext as R, type ServiceDef as S, setNestedObjectProperty as T, removeDisallowedChars as U, JsonSchemaScalarTypeValues as V, JsonSchemaNullTypeValues as W, JsonSchemaComplexTypeValues as X, type JsonSchemaType as Y, type JsonSchemaTypeValue as Z, type JsonSchemaScalarType as _, DEV_DEFINITION_ENDPOINT as a, type JsonSchemaNullType as a0, isJsonSchemaNullType as a1, type JsonSchemaComplexType as a2, isJsonSchemaObject as a3, type JsonSchemaRecord as a4, isJsonSchemaRecord as a5, type JsonSchemaArray as a6, isJsonSchemaArray as a7, type JsonSchemaUint8Array as a8, type JsonSchemaEnum as a9, isJsonSchemaEnum as aa, type HttpMethod as b, type ArriProcedureBase as c, type ArriProcedure as d, type HandlerContext as e, type RpcPostHandlerContext as f, type ArriProcedureHandler as g, type ArriProcedurePostHandler as h, isHttpMethod as i, isRpc as j, defineRpc as k, createRpcDefinition as l, getRpcPath as m, getRpcParamName as n, getRpcParamDefinition as o, getRpcResponseName as p, type ArriRoute as q, registerRpc as r, defineRoute as s, defineMiddleware as t, type ExtractParams as u, type ArriRouteHandler as v, type RouteHandlerContext as w, type RoutePostHandlerContext as x, type ArriRoutePostHandler as y, registerRoute as z };
205
+ export { type JsonSchemaScalarType as $, Arri as A, registerRoute as B, type ClientGenerator as C, DEV_ENDPOINT_ROOT as D, type ExtractParam as E, type ClientGeneratorPlugin as F, type ApplicationDef as G, HttpMethodValues as H, defineClientGeneratorPlugin as I, type JsonSchemaObject as J, normalizeWhitespace as K, isProcedureDef as L, type Middleware as M, isServiceDef as N, isApplicationDef as O, type ProcedureDef as P, unflattenObject as Q, type RpcHandlerContext as R, type ServiceDef as S, unflattenProcedures as T, setNestedObjectProperty as U, removeDisallowedChars as V, JsonSchemaScalarTypeValues as W, JsonSchemaNullTypeValues as X, JsonSchemaComplexTypeValues as Y, type JsonSchemaType as Z, type JsonSchemaTypeValue as _, DEV_DEFINITION_ENDPOINT as a, isJsonSchemaScalarType as a0, type JsonSchemaNullType as a1, isJsonSchemaNullType as a2, type JsonSchemaComplexType as a3, isJsonSchemaObject as a4, type JsonSchemaRecord as a5, isJsonSchemaRecord as a6, type JsonSchemaArray as a7, isJsonSchemaArray as a8, type JsonSchemaUint8Array as a9, type JsonSchemaEnum as aa, isJsonSchemaEnum as ab, type ArriOptions as b, type HttpMethod as c, type ArriProcedureBase as d, type ArriProcedure as e, type HandlerContext as f, type RpcPostHandlerContext as g, type ArriProcedureHandler as h, isHttpMethod as i, type ArriProcedurePostHandler as j, isRpc as k, defineRpc as l, createRpcDefinition as m, getRpcPath as n, getRpcParamName as o, getRpcParamDefinition as p, getRpcResponseName as q, registerRpc as r, type ArriRoute as s, defineRoute as t, defineMiddleware as u, type ExtractParams as v, type ArriRouteHandler as w, type RouteHandlerContext as x, type RoutePostHandlerContext as y, type ArriRoutePostHandler as z };