@wordrhyme/auto-crud-server 1.0.8 → 1.0.9
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 +12 -0
- package/dist/index.d.cts +7 -7
- package/dist/index.js +12 -0
- package/package.json +3 -3
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
|
|
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:
|
|
15
|
+
declare const router: _trpc_server2.TRPCRouterBuilder<{
|
|
16
16
|
ctx: Context;
|
|
17
17
|
meta: object;
|
|
18
|
-
errorShape:
|
|
18
|
+
errorShape: _trpc_server2.TRPCDefaultErrorShape;
|
|
19
19
|
transformer: true;
|
|
20
20
|
}>;
|
|
21
|
-
declare const publicProcedure:
|
|
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:
|
|
882
|
+
declare const appRouter: _trpc_server2.TRPCBuiltRouter<{
|
|
883
883
|
ctx: Context;
|
|
884
884
|
meta: object;
|
|
885
|
-
errorShape:
|
|
885
|
+
errorShape: _trpc_server2.TRPCDefaultErrorShape;
|
|
886
886
|
transformer: true;
|
|
887
|
-
},
|
|
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.
|
|
4
|
+
"version": "1.0.9",
|
|
5
5
|
"description": "tRPC server utilities for auto-crud - automatic CRUD routers for Drizzle ORM",
|
|
6
6
|
"author": "wordrhyme",
|
|
7
7
|
"license": "MIT",
|
|
@@ -49,9 +49,9 @@
|
|
|
49
49
|
"zod": "^4.3.6",
|
|
50
50
|
"@internal/eslint-config": "0.3.0",
|
|
51
51
|
"@internal/prettier-config": "0.0.1",
|
|
52
|
-
"@internal/tsconfig": "0.1.0",
|
|
53
52
|
"@internal/tsdown-config": "0.1.0",
|
|
54
|
-
"@internal/vitest-config": "0.1.0"
|
|
53
|
+
"@internal/vitest-config": "0.1.0",
|
|
54
|
+
"@internal/tsconfig": "0.1.0"
|
|
55
55
|
},
|
|
56
56
|
"prettier": "@internal/prettier-config",
|
|
57
57
|
"scripts": {
|