arri 0.0.29 → 0.0.30
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/chunks/index.cjs +2 -2
- package/dist/chunks/index.mjs +2 -2
- package/dist/cli.cjs +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/codegen.cjs +2 -2
- package/dist/codegen.mjs +4 -4
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/shared/{arri.fa2beb45.cjs → arri.6d256d98.cjs} +1 -1
- package/dist/shared/{arri.e62071ea.mjs → arri.7d8427d5.mjs} +50 -9
- package/dist/shared/{arri.64252c62.mjs → arri.edccaab8.mjs} +1 -1
- package/dist/shared/{arri.50fd4bf9.cjs → arri.fb02cde0.cjs} +49 -8
- package/package.json +1 -1
package/dist/chunks/index.cjs
CHANGED
|
@@ -35,14 +35,14 @@ require('node:v8');
|
|
|
35
35
|
require('consola');
|
|
36
36
|
require('esbuild');
|
|
37
37
|
require('prettier');
|
|
38
|
-
require('../shared/arri.
|
|
38
|
+
require('../shared/arri.fb02cde0.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.
|
|
45
|
+
require('../shared/arri.6d256d98.cjs');
|
|
46
46
|
require('child_process');
|
|
47
47
|
require('listhen');
|
|
48
48
|
|
package/dist/chunks/index.mjs
CHANGED
|
@@ -33,14 +33,14 @@ import 'node:v8';
|
|
|
33
33
|
import 'consola';
|
|
34
34
|
import 'esbuild';
|
|
35
35
|
import 'prettier';
|
|
36
|
-
import '../shared/arri.
|
|
36
|
+
import '../shared/arri.7d8427d5.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.
|
|
43
|
+
import '../shared/arri.edccaab8.mjs';
|
|
44
44
|
import 'child_process';
|
|
45
45
|
import 'listhen';
|
|
46
46
|
|
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.
|
|
28
|
+
const app = require('./shared/arri.fb02cde0.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.
|
|
36
|
+
const dart = require('./shared/arri.6d256d98.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.
|
|
26
|
+
import { j as camelCase, r as removeDisallowedChars, o as kebabCase, k as isApplicationDef, D as DEV_DEFINITION_ENDPOINT } from './shared/arri.7d8427d5.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.
|
|
34
|
+
import { a as dartClientGenerator } from './shared/arri.edccaab8.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.
|
|
6
|
-
const dart = require('./shared/arri.
|
|
5
|
+
const app = require('./shared/arri.fb02cde0.cjs');
|
|
6
|
+
const dart = require('./shared/arri.6d256d98.cjs');
|
|
7
7
|
require('@sinclair/typebox');
|
|
8
8
|
require('h3');
|
|
9
9
|
require('@sinclair/typebox/errors');
|
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.
|
|
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.
|
|
5
|
-
import { d as defineClientGeneratorPlugin } from './shared/arri.
|
|
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.
|
|
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.7d8427d5.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.7d8427d5.mjs';
|
|
5
|
+
import { d as defineClientGeneratorPlugin } from './shared/arri.edccaab8.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.edccaab8.mjs';
|
|
7
7
|
import '@sinclair/typebox';
|
|
8
8
|
import 'h3';
|
|
9
9
|
import '@sinclair/typebox/errors';
|
package/dist/index.cjs
CHANGED
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.
|
|
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.7d8427d5.mjs';
|
|
2
2
|
import '@sinclair/typebox';
|
|
3
3
|
import 'h3';
|
|
4
4
|
import '@sinclair/typebox/errors';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Type, TypeGuard } from '@sinclair/typebox';
|
|
2
|
-
import { createError, eventHandler, isPreflightRequest, readValidatedBody, getValidatedQuery, setResponseHeader, send, createRouter, createApp } from 'h3';
|
|
2
|
+
import { createError, eventHandler, isPreflightRequest, readValidatedBody, getValidatedQuery, setResponseHeader, send, createRouter, createApp, getQuery, readBody, sendError } from 'h3';
|
|
3
3
|
import { ValueErrorType } from '@sinclair/typebox/errors';
|
|
4
4
|
import { Value } from '@sinclair/typebox/value';
|
|
5
5
|
|
|
@@ -770,17 +770,58 @@ class Arri {
|
|
|
770
770
|
this.onBeforeResponse = opts.onBeforeResponse;
|
|
771
771
|
this.rpcRoutePrefix = opts?.rpcRoutePrefix ?? "";
|
|
772
772
|
this.rpcDefinitionPath = opts?.rpcDefinitionPath ?? "__definition";
|
|
773
|
-
this.h3Router.get(
|
|
774
|
-
this.rpcRoutePrefix ? `/${this.rpcRoutePrefix}/${this.rpcDefinitionPath}`.split("//").join("/") : `/${this.rpcDefinitionPath}`,
|
|
775
|
-
eventHandler((_) => this.getAppDefinition())
|
|
776
|
-
);
|
|
777
773
|
this.h3App.use(this.h3Router);
|
|
774
|
+
this.registerRoute({
|
|
775
|
+
path: this.rpcRoutePrefix ? `/${this.rpcRoutePrefix}/${this.rpcDefinitionPath}`.split("//").join("/") : `/${this.rpcDefinitionPath}`,
|
|
776
|
+
method: "get",
|
|
777
|
+
handler: () => this.getAppDefinition()
|
|
778
|
+
});
|
|
778
779
|
if (process.env.ARRI_DEV_MODE === "true") {
|
|
779
|
-
this.
|
|
780
|
-
DEV_DEFINITION_ENDPOINT,
|
|
781
|
-
|
|
782
|
-
|
|
780
|
+
this.registerRoute({
|
|
781
|
+
path: DEV_DEFINITION_ENDPOINT,
|
|
782
|
+
method: "get",
|
|
783
|
+
handler: () => this.getAppDefinition()
|
|
784
|
+
});
|
|
783
785
|
}
|
|
786
|
+
this.h3Router.use(
|
|
787
|
+
"/**",
|
|
788
|
+
eventHandler(async (event) => {
|
|
789
|
+
const error = defineError(404);
|
|
790
|
+
const query = getQuery(event);
|
|
791
|
+
const disallowedBodyMethods = ["GET", "HEAD", "OPTION"];
|
|
792
|
+
const canBody = !disallowedBodyMethods.includes(event.method);
|
|
793
|
+
const context = {
|
|
794
|
+
type: "route",
|
|
795
|
+
params: event.context.params,
|
|
796
|
+
query,
|
|
797
|
+
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
|
|
798
|
+
body: canBody ? await readBody(event).catch((_) => void 0) : void 0
|
|
799
|
+
};
|
|
800
|
+
try {
|
|
801
|
+
if (this.middlewares.length) {
|
|
802
|
+
for (const m of this.middlewares) {
|
|
803
|
+
await m(context, event);
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
} catch (_) {
|
|
807
|
+
}
|
|
808
|
+
if (this.onError) {
|
|
809
|
+
await this.onError(
|
|
810
|
+
error,
|
|
811
|
+
{
|
|
812
|
+
type: "route",
|
|
813
|
+
params: void 0,
|
|
814
|
+
query: void 0,
|
|
815
|
+
body: void 0
|
|
816
|
+
},
|
|
817
|
+
event
|
|
818
|
+
);
|
|
819
|
+
}
|
|
820
|
+
if (!event.handled) {
|
|
821
|
+
sendError(event, error);
|
|
822
|
+
}
|
|
823
|
+
})
|
|
824
|
+
);
|
|
784
825
|
}
|
|
785
826
|
registerMiddleware(middleware) {
|
|
786
827
|
this.middlewares.push(middleware);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { execSync } from 'child_process';
|
|
2
2
|
import { writeFileSync } from 'fs';
|
|
3
|
-
import { h as unflattenProcedures, i as isServiceDef, p as pascalCase, j as camelCase, a as isProcedureDef, d as isJsonSchemaObject, f as isJsonSchemaEnum, c as isJsonSchemaNullType, b as isJsonSchemaScalarType, e as isJsonSchemaRecord, g as isJsonSchemaArray } from './arri.
|
|
3
|
+
import { h as unflattenProcedures, i as isServiceDef, p as pascalCase, j as camelCase, a as isProcedureDef, d as isJsonSchemaObject, f as isJsonSchemaEnum, c as isJsonSchemaNullType, b as isJsonSchemaScalarType, e as isJsonSchemaRecord, g as isJsonSchemaArray } from './arri.7d8427d5.mjs';
|
|
4
4
|
|
|
5
5
|
function defineClientGeneratorPlugin(plugin) {
|
|
6
6
|
return plugin;
|
|
@@ -772,17 +772,58 @@ class Arri {
|
|
|
772
772
|
this.onBeforeResponse = opts.onBeforeResponse;
|
|
773
773
|
this.rpcRoutePrefix = opts?.rpcRoutePrefix ?? "";
|
|
774
774
|
this.rpcDefinitionPath = opts?.rpcDefinitionPath ?? "__definition";
|
|
775
|
-
this.h3Router.get(
|
|
776
|
-
this.rpcRoutePrefix ? `/${this.rpcRoutePrefix}/${this.rpcDefinitionPath}`.split("//").join("/") : `/${this.rpcDefinitionPath}`,
|
|
777
|
-
h3.eventHandler((_) => this.getAppDefinition())
|
|
778
|
-
);
|
|
779
775
|
this.h3App.use(this.h3Router);
|
|
776
|
+
this.registerRoute({
|
|
777
|
+
path: this.rpcRoutePrefix ? `/${this.rpcRoutePrefix}/${this.rpcDefinitionPath}`.split("//").join("/") : `/${this.rpcDefinitionPath}`,
|
|
778
|
+
method: "get",
|
|
779
|
+
handler: () => this.getAppDefinition()
|
|
780
|
+
});
|
|
780
781
|
if (process.env.ARRI_DEV_MODE === "true") {
|
|
781
|
-
this.
|
|
782
|
-
DEV_DEFINITION_ENDPOINT,
|
|
783
|
-
|
|
784
|
-
|
|
782
|
+
this.registerRoute({
|
|
783
|
+
path: DEV_DEFINITION_ENDPOINT,
|
|
784
|
+
method: "get",
|
|
785
|
+
handler: () => this.getAppDefinition()
|
|
786
|
+
});
|
|
785
787
|
}
|
|
788
|
+
this.h3Router.use(
|
|
789
|
+
"/**",
|
|
790
|
+
h3.eventHandler(async (event) => {
|
|
791
|
+
const error = defineError(404);
|
|
792
|
+
const query = h3.getQuery(event);
|
|
793
|
+
const disallowedBodyMethods = ["GET", "HEAD", "OPTION"];
|
|
794
|
+
const canBody = !disallowedBodyMethods.includes(event.method);
|
|
795
|
+
const context = {
|
|
796
|
+
type: "route",
|
|
797
|
+
params: event.context.params,
|
|
798
|
+
query,
|
|
799
|
+
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
|
|
800
|
+
body: canBody ? await h3.readBody(event).catch((_) => void 0) : void 0
|
|
801
|
+
};
|
|
802
|
+
try {
|
|
803
|
+
if (this.middlewares.length) {
|
|
804
|
+
for (const m of this.middlewares) {
|
|
805
|
+
await m(context, event);
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
} catch (_) {
|
|
809
|
+
}
|
|
810
|
+
if (this.onError) {
|
|
811
|
+
await this.onError(
|
|
812
|
+
error,
|
|
813
|
+
{
|
|
814
|
+
type: "route",
|
|
815
|
+
params: void 0,
|
|
816
|
+
query: void 0,
|
|
817
|
+
body: void 0
|
|
818
|
+
},
|
|
819
|
+
event
|
|
820
|
+
);
|
|
821
|
+
}
|
|
822
|
+
if (!event.handled) {
|
|
823
|
+
h3.sendError(event, error);
|
|
824
|
+
}
|
|
825
|
+
})
|
|
826
|
+
);
|
|
786
827
|
}
|
|
787
828
|
registerMiddleware(middleware) {
|
|
788
829
|
this.middlewares.push(middleware);
|