soonjs 0.0.5 → 0.0.8
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.d.ts +17 -15
- package/dist/index.js +36210 -3632
- package/dist/one.d.ts +4 -1
- package/dist/{pazu-id.d.ts → soon-id.d.ts} +1 -1
- package/dist/types.d.ts +8 -6
- package/dist/vite-plugin-soon-client.d.ts +7 -0
- package/dist/{vite-plugin-pazu-server.d.ts → vite-plugin-soon-server.d.ts} +1 -1
- package/package.json +1 -2
- package/dist/vite-plugin-pazu-client.d.ts +0 -3
package/dist/one.d.ts
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Config, defineApi, defineConfig, Meta, Platform,
|
|
1
|
+
import { Config, defineApi, defineConfig, Meta, Platform, ServiceContext, SoonApp, UserContext } from '.';
|
|
2
2
|
import { IncomingHttpHeaders, OutgoingHttpHeaders } from 'http';
|
|
3
3
|
|
|
4
|
-
type Method = 'get' | 'head' | 'post' | 'put' | 'delete' | '
|
|
4
|
+
type Method = 'get' | 'head' | 'post' | 'put' | 'delete' | 'options' | 'patch' | 'all';
|
|
5
5
|
export type APIOptionsBase = {
|
|
6
6
|
/**
|
|
7
7
|
* 访问路径,/开头是绝对路径,非绝对路径则仅是替换访问名称而不改变路径层级,可为''
|
|
@@ -62,11 +62,12 @@ export type Context<APIBodySchema = {}> = {
|
|
|
62
62
|
requestId: string;
|
|
63
63
|
platform?: Platform;
|
|
64
64
|
currentAPI: APIOptionsBase & APIBodySchema;
|
|
65
|
-
app:
|
|
65
|
+
app: SoonApp;
|
|
66
66
|
config: Config;
|
|
67
67
|
meta: Meta;
|
|
68
|
+
service: ServiceContext;
|
|
68
69
|
} & UserContext;
|
|
69
|
-
export type
|
|
70
|
+
export type SoonFetchOptions = {
|
|
70
71
|
headers?: IncomingHttpHeaders;
|
|
71
72
|
method?: Exclude<Method, 'all'>;
|
|
72
73
|
body?: unknown;
|
|
@@ -76,10 +77,11 @@ export type PazuFetchOptions = {
|
|
|
76
77
|
platform?: Context['platform'];
|
|
77
78
|
};
|
|
78
79
|
export type Middleware = (context: Context, next: () => any) => Promise<void> | void;
|
|
79
|
-
export type
|
|
80
|
+
export type SoonAppOptions = {
|
|
80
81
|
baseUrl?: string;
|
|
81
82
|
defaultMethod?: Method;
|
|
82
|
-
onInit?: (app:
|
|
83
|
+
onInit?: (app: SoonApp) => void | Promise<void>;
|
|
84
|
+
onReady?: (app: SoonApp) => void | Promise<void>;
|
|
83
85
|
middlewares?: Middleware[];
|
|
84
86
|
apis?: APIOptions[];
|
|
85
87
|
workId?: number;
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "soonjs",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
|
-
"main1": "./src/index.ts",
|
|
9
8
|
"scripts": {
|
|
10
9
|
"dev": "vite-node examples/index.ts",
|
|
11
10
|
"build": "vite build --ssr ./src/index.ts",
|