@jayfong/x-server 2.106.4 → 2.106.6

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.
@@ -301,11 +301,12 @@ _yargs.default.command('dev', '开始开发', _ => _.positional('index', {
301
301
  const schemaDir = _nodePath.default.join(process.cwd(), 'src/db/schema');
302
302
  const isMultipleFiles = await _fsExtra.default.pathExists(schemaDir);
303
303
  const schemaArg = isMultipleFiles ? 'src/db' : 'src/db/schema.prisma';
304
- await (0, _execa.default)('tnpx', ['prisma', ...argv._.slice(1), '--schema', schemaArg], {
304
+ const prismaArgs = argv._.slice(1);
305
+ await (0, _execa.default)('tnpx', ['prisma', ...prismaArgs, '--schema', schemaArg], {
305
306
  cwd: process.cwd(),
306
307
  stdio: 'inherit'
307
308
  });
308
- if (!argv.production) {
309
+ if (!argv.production && prismaArgs[0] === 'generate') {
309
310
  await _template_util.TemplateUtil.initModels(process.cwd());
310
311
  }
311
312
  }
package/lib/cli/cli.js CHANGED
@@ -297,11 +297,12 @@ yargs.command('dev', '开始开发', _ => _.positional('index', {
297
297
  const schemaDir = path.join(process.cwd(), 'src/db/schema');
298
298
  const isMultipleFiles = await fs.pathExists(schemaDir);
299
299
  const schemaArg = isMultipleFiles ? 'src/db' : 'src/db/schema.prisma';
300
- await execa('tnpx', ['prisma', ...argv._.slice(1), '--schema', schemaArg], {
300
+ const prismaArgs = argv._.slice(1);
301
+ await execa('tnpx', ['prisma', ...prismaArgs, '--schema', schemaArg], {
301
302
  cwd: process.cwd(),
302
303
  stdio: 'inherit'
303
304
  });
304
- if (!argv.production) {
305
+ if (!argv.production && prismaArgs[0] === 'generate') {
305
306
  await TemplateUtil.initModels(process.cwd());
306
307
  }
307
308
  }
@@ -1,15 +1,15 @@
1
- import type { IncomingHttpHeaders } from 'http';
1
+ import type { IncomingHttpHeaders } from 'node:http';
2
2
  import type { MultipartFile } from '@fastify/multipart';
3
3
  import type { SocketStream } from '@fastify/websocket';
4
4
  import type { Queue } from 'bull';
5
- import { CronJob } from 'cron';
6
- import { FastifyReply, FastifyRequest, FastifyServerOptions } from 'fastify';
5
+ import type { CronJob } from 'cron';
6
+ import type { FastifyReply, FastifyRequest, FastifyServerOptions } from 'fastify';
7
7
  import type { MsValue } from 'vtils';
8
8
  import type { AsyncOrSync, LiteralUnion, OneOrMore, RequiredDeep } from 'vtils/types';
9
- import * as vae from 'vtils/vae';
10
- import { yup } from 'vtils/validator';
11
- import { BasePlugin } from '../plugins/base';
12
- import { BaseService } from '../services/base';
9
+ import type * as vae from 'vtils/vae';
10
+ import type { yup } from 'vtils/validator';
11
+ import type { BasePlugin } from '../plugins/base';
12
+ import type { BaseService } from '../services/base';
13
13
  import type { DisposeService } from '../services/dispose';
14
14
  import type { Handler } from './handler';
15
15
  export declare namespace XServer {
@@ -117,7 +117,7 @@ export declare namespace XHandler {
117
117
  ctx: Context) => AsyncOrSync<TResData>;
118
118
  interface ExtraOptions {
119
119
  }
120
- interface Options<TReqData extends any = void, TResData extends any = void, TReqMethod extends Method = Method> extends ExtraOptions {
120
+ interface Options<TReqData extends any = void, TResData extends any = void, TReqMethod extends Method = Method, TReqDataRequired = RequiredDeep<TReqData>> extends ExtraOptions {
121
121
  /**
122
122
  * 请求方法
123
123
  *
@@ -156,11 +156,11 @@ export declare namespace XHandler {
156
156
  /**
157
157
  * 请求数据验证结构(yup)
158
158
  */
159
- requestDataSchema?: (_: typeof yup) => yup.GetSchema<RequiredDeep<TReqData>>;
159
+ requestDataSchema?: (_: typeof yup) => yup.GetSchema<TReqDataRequired>;
160
160
  /**
161
161
  * 请求数据验证结构(vae)
162
162
  */
163
- requestDataSchemaVae?: vae.VaeSchemaOf<TReqData> | ((_: vae.VaeSchemaBuilder<TReqData>) => vae.VaeSchemaOf<TReqData> | vae.VaeObjectSchemaShapeOf<TReqData>);
163
+ requestDataSchemaVae?: vae.VaeSchemaOf<TReqDataRequired> | ((_: vae.VaeSchemaBuilder<TReqDataRequired>) => vae.VaeSchemaOf<TReqDataRequired> | vae.VaeObjectSchemaShapeOf<TReqDataRequired>);
164
164
  /**
165
165
  * 是否使用异步上下文
166
166
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jayfong/x-server",
3
- "version": "2.106.4",
3
+ "version": "2.106.6",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "lib/_cjs/index.js",