arri 0.37.0 → 0.37.2
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/LICENSE +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +1 -2
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +1 -2
- package/dist/shared/{arri.90dd1716.mjs → arri.37a5d932.mjs} +20 -4
- package/dist/shared/{arri.1ce0fa20.cjs → arri.bba0eea2.cjs} +20 -8
- package/package.json +6 -6
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright
|
|
3
|
+
Copyright 2024 Joshua Sosso
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
6
|
|
package/dist/cli.cjs
CHANGED
|
@@ -11,7 +11,7 @@ const esbuild = require('esbuild');
|
|
|
11
11
|
const esbuildPluginReplace = require('esbuild-plugin-replace');
|
|
12
12
|
const path = require('pathe');
|
|
13
13
|
const prettier = require('prettier');
|
|
14
|
-
const config = require('./shared/arri.
|
|
14
|
+
const config = require('./shared/arri.bba0eea2.cjs');
|
|
15
15
|
const consola = require('consola');
|
|
16
16
|
const globby = require('globby');
|
|
17
17
|
const scule = require('scule');
|
package/dist/cli.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { build as build$1 } from 'esbuild';
|
|
|
10
10
|
import { replace } from 'esbuild-plugin-replace';
|
|
11
11
|
import path from 'pathe';
|
|
12
12
|
import prettier from 'prettier';
|
|
13
|
-
import { q as defaultConfig, o as isArriConfig, p as isResolvedArriConfig, a as DEV_DEFINITION_ENDPOINT } from './shared/arri.
|
|
13
|
+
import { q as defaultConfig, o as isArriConfig, p as isResolvedArriConfig, a as DEV_DEFINITION_ENDPOINT } from './shared/arri.37a5d932.mjs';
|
|
14
14
|
import { createConsola } from 'consola';
|
|
15
15
|
import { globby } from 'globby';
|
|
16
16
|
import { camelCase, kebabCase } from 'scule';
|
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const config = require('./shared/arri.
|
|
3
|
+
const config = require('./shared/arri.bba0eea2.cjs');
|
|
4
4
|
const h3 = require('h3');
|
|
5
5
|
require('arri-codegen-utils');
|
|
6
|
-
require('consola');
|
|
7
6
|
require('arri-validate');
|
|
8
7
|
require('h3-sse');
|
|
9
8
|
require('scule');
|
package/dist/index.d.cts
CHANGED
|
@@ -269,6 +269,7 @@ interface ArriOptions {
|
|
|
269
269
|
* This parameters also takes the rpcRoutePrefix option into account
|
|
270
270
|
*/
|
|
271
271
|
rpcDefinitionPath?: string;
|
|
272
|
+
disableDefaultRoute?: boolean;
|
|
272
273
|
onRequest?: (event: MiddlewareEvent) => void | Promise<void>;
|
|
273
274
|
onAfterResponse?: (event: MiddlewareEvent) => void | Promise<void>;
|
|
274
275
|
onBeforeResponse?: (event: MiddlewareEvent) => void | Promise<void>;
|
package/dist/index.d.mts
CHANGED
|
@@ -269,6 +269,7 @@ interface ArriOptions {
|
|
|
269
269
|
* This parameters also takes the rpcRoutePrefix option into account
|
|
270
270
|
*/
|
|
271
271
|
rpcDefinitionPath?: string;
|
|
272
|
+
disableDefaultRoute?: boolean;
|
|
272
273
|
onRequest?: (event: MiddlewareEvent) => void | Promise<void>;
|
|
273
274
|
onAfterResponse?: (event: MiddlewareEvent) => void | Promise<void>;
|
|
274
275
|
onBeforeResponse?: (event: MiddlewareEvent) => void | Promise<void>;
|
package/dist/index.d.ts
CHANGED
|
@@ -269,6 +269,7 @@ interface ArriOptions {
|
|
|
269
269
|
* This parameters also takes the rpcRoutePrefix option into account
|
|
270
270
|
*/
|
|
271
271
|
rpcDefinitionPath?: string;
|
|
272
|
+
disableDefaultRoute?: boolean;
|
|
272
273
|
onRequest?: (event: MiddlewareEvent) => void | Promise<void>;
|
|
273
274
|
onAfterResponse?: (event: MiddlewareEvent) => void | Promise<void>;
|
|
274
275
|
onBeforeResponse?: (event: MiddlewareEvent) => void | Promise<void>;
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export { A as ArriApp, t as ArriRouter, j as ArriServerError, k as ArriServerErrorResponse, a as DEV_DEFINITION_ENDPOINT, D as DEV_ENDPOINT_ROOT, E as EventStreamConnection, W as WsPeer, c as createAppDefinition, e as createHttpRpcDefinition, G as createWsRpcDefinition, q as defaultConfig, s as defineConfig, l as defineError, y as defineEventStreamRpc, u as defineRoute, d as defineRpc, C as defineWebsocketRpc, m as errorResponseFromValidationErrors, f as getRpcParamName, g as getRpcPath, h as getRpcResponseName, n as handleH3Error, x as handleRoute, o as isArriConfig, z as isEventStreamRpc, p as isResolvedArriConfig, b as isRpc, i as isRpcParamSchema, B as registerEventStreamRpc, w as registerRoute, r as registerRpc, F as registerWebsocketRpc, v as validateRpcRequestInput } from './shared/arri.
|
|
1
|
+
export { A as ArriApp, t as ArriRouter, j as ArriServerError, k as ArriServerErrorResponse, a as DEV_DEFINITION_ENDPOINT, D as DEV_ENDPOINT_ROOT, E as EventStreamConnection, W as WsPeer, c as createAppDefinition, e as createHttpRpcDefinition, G as createWsRpcDefinition, q as defaultConfig, s as defineConfig, l as defineError, y as defineEventStreamRpc, u as defineRoute, d as defineRpc, C as defineWebsocketRpc, m as errorResponseFromValidationErrors, f as getRpcParamName, g as getRpcPath, h as getRpcResponseName, n as handleH3Error, x as handleRoute, o as isArriConfig, z as isEventStreamRpc, p as isResolvedArriConfig, b as isRpc, i as isRpcParamSchema, B as registerEventStreamRpc, w as registerRoute, r as registerRpc, F as registerWebsocketRpc, v as validateRpcRequestInput } from './shared/arri.37a5d932.mjs';
|
|
2
2
|
export * from 'h3';
|
|
3
3
|
import 'arri-codegen-utils';
|
|
4
|
-
import 'consola';
|
|
5
4
|
import 'arri-validate';
|
|
6
5
|
import 'h3-sse';
|
|
7
6
|
import 'scule';
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { isRpcHttpMethod, removeDisallowedChars, SCHEMA_VERSION } from 'arri-codegen-utils';
|
|
2
|
-
import consola from 'consola';
|
|
3
2
|
import { isError, setResponseStatus, setResponseHeader, send, eventHandler, isPreflightRequest, readRawBody, getValidatedQuery, defineEventHandler, getQuery, setHeader, defineWebSocketHandler, createRouter, createApp } from 'h3';
|
|
4
3
|
import { a, isAObjectSchema, isADiscriminatorSchema } from 'arri-validate';
|
|
5
4
|
import { createEventStream } from 'h3-sse';
|
|
@@ -1034,10 +1033,27 @@ class ArriApp {
|
|
|
1034
1033
|
this.definitionPath,
|
|
1035
1034
|
eventHandler(() => this.getAppDefinition())
|
|
1036
1035
|
);
|
|
1036
|
+
if (!opts.disableDefaultRoute) {
|
|
1037
|
+
this.route({
|
|
1038
|
+
method: ["get", "head"],
|
|
1039
|
+
path: "/",
|
|
1040
|
+
handler: (_) => {
|
|
1041
|
+
let schemaPath;
|
|
1042
|
+
if (this._rpcRoutePrefix) {
|
|
1043
|
+
schemaPath = `/${this._rpcRoutePrefix}/${this._rpcDefinitionPath}`;
|
|
1044
|
+
} else {
|
|
1045
|
+
schemaPath = `/${this._rpcDefinitionPath}`;
|
|
1046
|
+
}
|
|
1047
|
+
return {
|
|
1048
|
+
title: this.appInfo?.title ?? "Arri-RPC Server",
|
|
1049
|
+
description: this.appInfo?.description ?? "This server utilizes Arri-RPC. Visit the schema path to see all of the available procedures.",
|
|
1050
|
+
schemaPath,
|
|
1051
|
+
...this.appInfo
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1037
1056
|
if (process.env.ARRI_DEV_MODE === "true") {
|
|
1038
|
-
consola.info(
|
|
1039
|
-
`Arri definition available at \`http://<host>${this.definitionPath}\``
|
|
1040
|
-
);
|
|
1041
1057
|
this.h3Router.get(
|
|
1042
1058
|
DEV_DEFINITION_ENDPOINT,
|
|
1043
1059
|
eventHandler(() => this.getAppDefinition())
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const arriCodegenUtils = require('arri-codegen-utils');
|
|
4
|
-
const consola = require('consola');
|
|
5
4
|
const h3 = require('h3');
|
|
6
5
|
const arriValidate = require('arri-validate');
|
|
7
6
|
const h3Sse = require('h3-sse');
|
|
8
7
|
const scule = require('scule');
|
|
9
8
|
|
|
10
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
11
|
-
|
|
12
|
-
const consola__default = /*#__PURE__*/_interopDefaultCompat(consola);
|
|
13
|
-
|
|
14
9
|
var __defProp$4 = Object.defineProperty;
|
|
15
10
|
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
16
11
|
var __publicField$4 = (obj, key, value) => {
|
|
@@ -1040,10 +1035,27 @@ class ArriApp {
|
|
|
1040
1035
|
this.definitionPath,
|
|
1041
1036
|
h3.eventHandler(() => this.getAppDefinition())
|
|
1042
1037
|
);
|
|
1038
|
+
if (!opts.disableDefaultRoute) {
|
|
1039
|
+
this.route({
|
|
1040
|
+
method: ["get", "head"],
|
|
1041
|
+
path: "/",
|
|
1042
|
+
handler: (_) => {
|
|
1043
|
+
let schemaPath;
|
|
1044
|
+
if (this._rpcRoutePrefix) {
|
|
1045
|
+
schemaPath = `/${this._rpcRoutePrefix}/${this._rpcDefinitionPath}`;
|
|
1046
|
+
} else {
|
|
1047
|
+
schemaPath = `/${this._rpcDefinitionPath}`;
|
|
1048
|
+
}
|
|
1049
|
+
return {
|
|
1050
|
+
title: this.appInfo?.title ?? "Arri-RPC Server",
|
|
1051
|
+
description: this.appInfo?.description ?? "This server utilizes Arri-RPC. Visit the schema path to see all of the available procedures.",
|
|
1052
|
+
schemaPath,
|
|
1053
|
+
...this.appInfo
|
|
1054
|
+
};
|
|
1055
|
+
}
|
|
1056
|
+
});
|
|
1057
|
+
}
|
|
1043
1058
|
if (process.env.ARRI_DEV_MODE === "true") {
|
|
1044
|
-
consola__default.info(
|
|
1045
|
-
`Arri definition available at \`http://<host>${this.definitionPath}\``
|
|
1046
|
-
);
|
|
1047
1059
|
this.h3Router.get(
|
|
1048
1060
|
DEV_DEFINITION_ENDPOINT,
|
|
1049
1061
|
h3.eventHandler(() => this.getAppDefinition())
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arri",
|
|
3
|
-
"version": "0.37.
|
|
3
|
+
"version": "0.37.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"prettier": "^3.2.5",
|
|
45
45
|
"scule": "^1.3.0",
|
|
46
46
|
"uncrypto": "^0.1.3",
|
|
47
|
-
"arri-codegen-dart": "0.37.
|
|
48
|
-
"arri-codegen-
|
|
49
|
-
"arri-validate": "0.37.
|
|
50
|
-
"arri-codegen-
|
|
47
|
+
"arri-codegen-dart": "0.37.2",
|
|
48
|
+
"arri-codegen-ts": "0.37.2",
|
|
49
|
+
"arri-validate": "0.37.2",
|
|
50
|
+
"arri-codegen-utils": "0.37.2"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/degit": "^2.8.6",
|
|
54
|
-
"bun-types": "^1.
|
|
54
|
+
"bun-types": "^1.1.1"
|
|
55
55
|
}
|
|
56
56
|
}
|