@wordrhyme/auto-crud-server 1.0.8 → 1.0.10

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.cjs CHANGED
@@ -451,9 +451,21 @@ function resolveSoftDelete(option) {
451
451
  /**
452
452
  * 判断 procedure 配置的类型
453
453
  */
454
+ function isProcedureLike(config) {
455
+ if (!config || typeof config !== "object") return false;
456
+ const candidate = config;
457
+ return [
458
+ "input",
459
+ "output",
460
+ "query",
461
+ "mutation",
462
+ "use"
463
+ ].some((key) => typeof candidate[key] === "function");
464
+ }
454
465
  function isProcedureMap(config) {
455
466
  if (!config) return false;
456
467
  if (typeof config === "function") return false;
468
+ if (isProcedureLike(config)) return false;
457
469
  if (typeof config === "object" && config !== null) {
458
470
  const keys = Object.keys(config);
459
471
  const validKeys = [
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { PgTable } from "drizzle-orm/pg-core";
3
- import * as _trpc_server0 from "@trpc/server";
3
+ import * as _trpc_server2 from "@trpc/server";
4
4
  import { PostgresJsDatabase } from "drizzle-orm/postgres-js";
5
5
  import { AnyColumn, SQL } from "drizzle-orm";
6
6
 
@@ -12,13 +12,13 @@ import { AnyColumn, SQL } from "drizzle-orm";
12
12
  interface Context {
13
13
  db: PostgresJsDatabase<Record<string, never>>;
14
14
  }
15
- declare const router: _trpc_server0.TRPCRouterBuilder<{
15
+ declare const router: _trpc_server2.TRPCRouterBuilder<{
16
16
  ctx: Context;
17
17
  meta: object;
18
- errorShape: _trpc_server0.TRPCDefaultErrorShape;
18
+ errorShape: _trpc_server2.TRPCDefaultErrorShape;
19
19
  transformer: true;
20
20
  }>;
21
- declare const publicProcedure: _trpc_server0.TRPCProcedureBuilder<Context, object, object, _trpc_server0.TRPCUnsetMarker, _trpc_server0.TRPCUnsetMarker, _trpc_server0.TRPCUnsetMarker, _trpc_server0.TRPCUnsetMarker, false>;
21
+ declare const publicProcedure: _trpc_server2.TRPCProcedureBuilder<Context, object, object, _trpc_server2.TRPCUnsetMarker, _trpc_server2.TRPCUnsetMarker, _trpc_server2.TRPCUnsetMarker, _trpc_server2.TRPCUnsetMarker, false>;
22
22
  //#endregion
23
23
  //#region src/types/config.d.ts
24
24
  type CrudOperation = 'list' | 'get' | 'create' | 'update' | 'delete' | 'deleteMany' | 'updateMany' | 'upsert' | 'export' | 'import' | 'createMany';
@@ -879,12 +879,12 @@ type CrudHookEventMap<PluginId extends string, ResourceName extends string, TCre
879
879
  } } & { [K in `${PluginId}.${ResourceName}.createMany`]: TCreate[] };
880
880
  //#endregion
881
881
  //#region src/routers/index.d.ts
882
- declare const appRouter: _trpc_server0.TRPCBuiltRouter<{
882
+ declare const appRouter: _trpc_server2.TRPCBuiltRouter<{
883
883
  ctx: Context;
884
884
  meta: object;
885
- errorShape: _trpc_server0.TRPCDefaultErrorShape;
885
+ errorShape: _trpc_server2.TRPCDefaultErrorShape;
886
886
  transformer: true;
887
- }, _trpc_server0.TRPCDecorateCreateRouterOptions<{}>>;
887
+ }, _trpc_server2.TRPCDecorateCreateRouterOptions<{}>>;
888
888
  type AppRouter = typeof appRouter;
889
889
  //#endregion
890
890
  export { type AnyProcedure, type AppRouter, type CreateManyMiddlewareParams, type CreateMiddlewareParams, type CrudColumnConfig, type CrudColumnExpression, type CrudColumnRef, type CrudExtensionFilter, type CrudExtensionMetadata, type CrudExtensionsConfig, type CrudExtensionsProvider, type CrudHookEventMap, type CrudMiddleware, type CrudOperation, type CrudProcedures, type CrudRouterConfig, type DeleteManyMiddlewareParams, type DeleteMiddlewareParams, type ExportInput, type ExportMiddlewareParams, type ExportResult, type GetInput, type GetMiddlewareParams, type ImportFailedRow, type ImportInput, type ImportMiddlewareParams, type ImportResult, type ListInput, type ListMiddlewareParams, type ListResult, type ProcedureConfig, type ProcedureFactory, type ProcedureMap, type SoftDeleteConfig, type SoftDeleteOption, type UpdateManyMiddlewareParams, type UpdateMiddlewareParams, type UpsertMiddlewareParams, type WriteOperation, afterMiddleware, appRouter, baseExportInputSchema, baseGetInputSchema, baseListInputSchema, beforeMiddleware, composeMiddleware, createCrudRouter, publicProcedure, router };
package/dist/index.js CHANGED
@@ -422,9 +422,21 @@ function resolveSoftDelete(option) {
422
422
  /**
423
423
  * 判断 procedure 配置的类型
424
424
  */
425
+ function isProcedureLike(config) {
426
+ if (!config || typeof config !== "object") return false;
427
+ const candidate = config;
428
+ return [
429
+ "input",
430
+ "output",
431
+ "query",
432
+ "mutation",
433
+ "use"
434
+ ].some((key) => typeof candidate[key] === "function");
435
+ }
425
436
  function isProcedureMap(config) {
426
437
  if (!config) return false;
427
438
  if (typeof config === "function") return false;
439
+ if (isProcedureLike(config)) return false;
428
440
  if (typeof config === "object" && config !== null) {
429
441
  const keys = Object.keys(config);
430
442
  const validKeys = [
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@wordrhyme/auto-crud-server",
3
3
  "type": "module",
4
- "version": "1.0.8",
4
+ "version": "1.0.10",
5
5
  "description": "tRPC server utilities for auto-crud - automatic CRUD routers for Drizzle ORM",
6
6
  "author": "wordrhyme",
7
7
  "license": "MIT",
@@ -48,8 +48,8 @@
48
48
  "vitest": "^4.0.18",
49
49
  "zod": "^4.3.6",
50
50
  "@internal/eslint-config": "0.3.0",
51
- "@internal/prettier-config": "0.0.1",
52
51
  "@internal/tsconfig": "0.1.0",
52
+ "@internal/prettier-config": "0.0.1",
53
53
  "@internal/tsdown-config": "0.1.0",
54
54
  "@internal/vitest-config": "0.1.0"
55
55
  },