@stryke/prisma-trpc-generator 0.10.1 → 0.10.3

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.
@@ -6883,7 +6883,7 @@ var configSchema = z.object({
6883
6883
  withShield: configBoolean.default("false"),
6884
6884
  contextPath: z.string().trim().default("../context"),
6885
6885
  trpcOptions: configBoolean.default("true"),
6886
- showModelNameInProcedure: configBoolean.default("true"),
6886
+ showModelNameInProcedure: configBoolean.default("false"),
6887
6887
  generateModelActions: z.string().default(Object.values(ModelAction).join(",")).transform((arg) => {
6888
6888
  return arg.split(",").map((action) => modelActionEnum.parse(action.trim()));
6889
6889
  })
@@ -7640,24 +7640,24 @@ async function generateTRPCExports(sourceFile, config, options, outputDir) {
7640
7640
  sourceFile.addStatements(
7641
7641
  /* ts */
7642
7642
  `import { createContext } from '${relativePath(outputDir, joinPaths(outputDir, config.contextPath))}';
7643
- import { initTRPC } from '@trpc/server';
7644
- import { createTRPCServerActionHandler } from '@stryke/trpc-next/action-handler';`
7643
+ import { initTRPC } from '@trpc/server';
7644
+ import { createTRPCServerActionHandler } from '@stryke/trpc-next/action-handler';`
7645
7645
  );
7646
7646
  }
7647
7647
  sourceFile.addStatements(
7648
7648
  /* ts */
7649
7649
  `
7650
- export const t = initTRPC.context<Context>().create(${config.trpcOptions ? "trpcOptions" : ""});`
7650
+ export const t = initTRPC.context<Context>().create(${config.trpcOptions ? "trpcOptions" : ""});`
7651
7651
  );
7652
7652
  const middlewares = [];
7653
7653
  if (config.withMiddleware && typeof config.withMiddleware === "boolean") {
7654
7654
  sourceFile.addStatements(
7655
7655
  /* ts */
7656
7656
  `
7657
- export const globalMiddleware = t.middleware(async ({ ctx, next }) => {
7658
- console.log('inside middleware!')
7659
- return next()
7660
- });`
7657
+ export const globalMiddleware = t.middleware(async ({ ctx, next }) => {
7658
+ console.log('inside middleware!')
7659
+ return next()
7660
+ });`
7661
7661
  );
7662
7662
  middlewares.push({
7663
7663
  type: "global",
@@ -7671,13 +7671,13 @@ async function generateTRPCExports(sourceFile, config, options, outputDir) {
7671
7671
  sourceFile.addStatements(
7672
7672
  /* ts */
7673
7673
  `
7674
- import defaultMiddleware from '${relativePath(outputDir, joinPaths(outputDir, typeof config.withMiddleware === "string" ? config.withMiddleware : "middleware"))}';
7674
+ import middleware from '${relativePath(outputDir, joinPaths(outputDir, typeof config.withMiddleware === "string" ? config.withMiddleware : "middleware"))}';
7675
7675
  `
7676
7676
  );
7677
7677
  sourceFile.addStatements(
7678
7678
  /* ts */
7679
7679
  `
7680
- export const globalMiddleware = t.middleware(defaultMiddleware);`
7680
+ export const globalMiddleware = t.middleware(middleware);`
7681
7681
  );
7682
7682
  middlewares.push({
7683
7683
  type: "global",
@@ -7691,7 +7691,7 @@ async function generateTRPCExports(sourceFile, config, options, outputDir) {
7691
7691
  sourceFile.addStatements(
7692
7692
  /* ts */
7693
7693
  `
7694
- export const permissionsMiddleware = t.middleware(permissions);
7694
+ export const permissionsMiddleware = t.middleware(permissions);
7695
7695
  `
7696
7696
  );
7697
7697
  middlewares.push({
@@ -7715,7 +7715,7 @@ export const createCallerFactory = t.createCallerFactory;`
7715
7715
  sourceFile.addStatements(
7716
7716
  /* ts */
7717
7717
  `
7718
- export const publicProcedure = t.procedure; `
7718
+ export const publicProcedure = t.procedure; `
7719
7719
  );
7720
7720
  if (middlewares.length > 0) {
7721
7721
  const procName = getProcedureName(config);
@@ -7724,7 +7724,7 @@ export const createCallerFactory = t.createCallerFactory;`
7724
7724
  sourceFile.addStatements(
7725
7725
  /* ts */
7726
7726
  `
7727
- export const ${procName} = t.procedure`
7727
+ export const ${procName} = t.procedure`
7728
7728
  );
7729
7729
  }
7730
7730
  sourceFile.addStatements(
@@ -7737,9 +7737,9 @@ export const createCallerFactory = t.createCallerFactory;`
7737
7737
  sourceFile.addStatements(
7738
7738
  /* ts */
7739
7739
  `
7740
- export const createAction: ReturnType<typeof createTRPCServerActionHandler> =
7741
- createTRPCServerActionHandler(t, createContext);
7742
- `
7740
+ export const createAction: ReturnType<typeof createTRPCServerActionHandler> =
7741
+ createTRPCServerActionHandler(t, createContext);
7742
+ `
7743
7743
  );
7744
7744
  }
7745
7745
  sourceFile.formatText({
@@ -11722,8 +11722,9 @@ ${JSON.stringify(config)}`);
11722
11722
  appRouter.addStatements(
11723
11723
  /* ts */
11724
11724
  `
11725
- export const appRouter = t.router({${routerStatements.join()}})
11726
- `
11725
+ export const appRouter = t.router({${routerStatements.join()}});
11726
+
11727
+ export type AppRouter = typeof appRouter;`
11727
11728
  );
11728
11729
  appRouter.formatText({
11729
11730
  indentSize: 2
package/dist/generator.js CHANGED
@@ -6888,7 +6888,7 @@ var configSchema = z.object({
6888
6888
  withShield: configBoolean.default("false"),
6889
6889
  contextPath: z.string().trim().default("../context"),
6890
6890
  trpcOptions: configBoolean.default("true"),
6891
- showModelNameInProcedure: configBoolean.default("true"),
6891
+ showModelNameInProcedure: configBoolean.default("false"),
6892
6892
  generateModelActions: z.string().default(Object.values(ModelAction).join(",")).transform((arg) => {
6893
6893
  return arg.split(",").map((action) => modelActionEnum.parse(action.trim()));
6894
6894
  })
@@ -7645,24 +7645,24 @@ async function generateTRPCExports(sourceFile, config, options, outputDir) {
7645
7645
  sourceFile.addStatements(
7646
7646
  /* ts */
7647
7647
  `import { createContext } from '${relativePath(outputDir, joinPaths(outputDir, config.contextPath))}';
7648
- import { initTRPC } from '@trpc/server';
7649
- import { createTRPCServerActionHandler } from '@stryke/trpc-next/action-handler';`
7648
+ import { initTRPC } from '@trpc/server';
7649
+ import { createTRPCServerActionHandler } from '@stryke/trpc-next/action-handler';`
7650
7650
  );
7651
7651
  }
7652
7652
  sourceFile.addStatements(
7653
7653
  /* ts */
7654
7654
  `
7655
- export const t = initTRPC.context<Context>().create(${config.trpcOptions ? "trpcOptions" : ""});`
7655
+ export const t = initTRPC.context<Context>().create(${config.trpcOptions ? "trpcOptions" : ""});`
7656
7656
  );
7657
7657
  const middlewares = [];
7658
7658
  if (config.withMiddleware && typeof config.withMiddleware === "boolean") {
7659
7659
  sourceFile.addStatements(
7660
7660
  /* ts */
7661
7661
  `
7662
- export const globalMiddleware = t.middleware(async ({ ctx, next }) => {
7663
- console.log('inside middleware!')
7664
- return next()
7665
- });`
7662
+ export const globalMiddleware = t.middleware(async ({ ctx, next }) => {
7663
+ console.log('inside middleware!')
7664
+ return next()
7665
+ });`
7666
7666
  );
7667
7667
  middlewares.push({
7668
7668
  type: "global",
@@ -7676,13 +7676,13 @@ async function generateTRPCExports(sourceFile, config, options, outputDir) {
7676
7676
  sourceFile.addStatements(
7677
7677
  /* ts */
7678
7678
  `
7679
- import defaultMiddleware from '${relativePath(outputDir, joinPaths(outputDir, typeof config.withMiddleware === "string" ? config.withMiddleware : "middleware"))}';
7679
+ import middleware from '${relativePath(outputDir, joinPaths(outputDir, typeof config.withMiddleware === "string" ? config.withMiddleware : "middleware"))}';
7680
7680
  `
7681
7681
  );
7682
7682
  sourceFile.addStatements(
7683
7683
  /* ts */
7684
7684
  `
7685
- export const globalMiddleware = t.middleware(defaultMiddleware);`
7685
+ export const globalMiddleware = t.middleware(middleware);`
7686
7686
  );
7687
7687
  middlewares.push({
7688
7688
  type: "global",
@@ -7696,7 +7696,7 @@ async function generateTRPCExports(sourceFile, config, options, outputDir) {
7696
7696
  sourceFile.addStatements(
7697
7697
  /* ts */
7698
7698
  `
7699
- export const permissionsMiddleware = t.middleware(permissions);
7699
+ export const permissionsMiddleware = t.middleware(permissions);
7700
7700
  `
7701
7701
  );
7702
7702
  middlewares.push({
@@ -7720,7 +7720,7 @@ export const createCallerFactory = t.createCallerFactory;`
7720
7720
  sourceFile.addStatements(
7721
7721
  /* ts */
7722
7722
  `
7723
- export const publicProcedure = t.procedure; `
7723
+ export const publicProcedure = t.procedure; `
7724
7724
  );
7725
7725
  if (middlewares.length > 0) {
7726
7726
  const procName = getProcedureName(config);
@@ -7729,7 +7729,7 @@ export const createCallerFactory = t.createCallerFactory;`
7729
7729
  sourceFile.addStatements(
7730
7730
  /* ts */
7731
7731
  `
7732
- export const ${procName} = t.procedure`
7732
+ export const ${procName} = t.procedure`
7733
7733
  );
7734
7734
  }
7735
7735
  sourceFile.addStatements(
@@ -7742,9 +7742,9 @@ export const createCallerFactory = t.createCallerFactory;`
7742
7742
  sourceFile.addStatements(
7743
7743
  /* ts */
7744
7744
  `
7745
- export const createAction: ReturnType<typeof createTRPCServerActionHandler> =
7746
- createTRPCServerActionHandler(t, createContext);
7747
- `
7745
+ export const createAction: ReturnType<typeof createTRPCServerActionHandler> =
7746
+ createTRPCServerActionHandler(t, createContext);
7747
+ `
7748
7748
  );
7749
7749
  }
7750
7750
  sourceFile.formatText({
@@ -11727,8 +11727,9 @@ ${JSON.stringify(config)}`);
11727
11727
  appRouter.addStatements(
11728
11728
  /* ts */
11729
11729
  `
11730
- export const appRouter = t.router({${routerStatements.join()}})
11731
- `
11730
+ export const appRouter = t.router({${routerStatements.join()}});
11731
+
11732
+ export type AppRouter = typeof appRouter;`
11732
11733
  );
11733
11734
  appRouter.formatText({
11734
11735
  indentSize: 2
package/dist/index.cjs CHANGED
@@ -6879,7 +6879,7 @@ var configSchema = z.object({
6879
6879
  withShield: configBoolean.default("false"),
6880
6880
  contextPath: z.string().trim().default("../context"),
6881
6881
  trpcOptions: configBoolean.default("true"),
6882
- showModelNameInProcedure: configBoolean.default("true"),
6882
+ showModelNameInProcedure: configBoolean.default("false"),
6883
6883
  generateModelActions: z.string().default(Object.values(ModelAction).join(",")).transform((arg) => {
6884
6884
  return arg.split(",").map((action) => modelActionEnum.parse(action.trim()));
6885
6885
  })
@@ -7636,24 +7636,24 @@ async function generateTRPCExports(sourceFile, config, options, outputDir) {
7636
7636
  sourceFile.addStatements(
7637
7637
  /* ts */
7638
7638
  `import { createContext } from '${relativePath(outputDir, joinPaths(outputDir, config.contextPath))}';
7639
- import { initTRPC } from '@trpc/server';
7640
- import { createTRPCServerActionHandler } from '@stryke/trpc-next/action-handler';`
7639
+ import { initTRPC } from '@trpc/server';
7640
+ import { createTRPCServerActionHandler } from '@stryke/trpc-next/action-handler';`
7641
7641
  );
7642
7642
  }
7643
7643
  sourceFile.addStatements(
7644
7644
  /* ts */
7645
7645
  `
7646
- export const t = initTRPC.context<Context>().create(${config.trpcOptions ? "trpcOptions" : ""});`
7646
+ export const t = initTRPC.context<Context>().create(${config.trpcOptions ? "trpcOptions" : ""});`
7647
7647
  );
7648
7648
  const middlewares = [];
7649
7649
  if (config.withMiddleware && typeof config.withMiddleware === "boolean") {
7650
7650
  sourceFile.addStatements(
7651
7651
  /* ts */
7652
7652
  `
7653
- export const globalMiddleware = t.middleware(async ({ ctx, next }) => {
7654
- console.log('inside middleware!')
7655
- return next()
7656
- });`
7653
+ export const globalMiddleware = t.middleware(async ({ ctx, next }) => {
7654
+ console.log('inside middleware!')
7655
+ return next()
7656
+ });`
7657
7657
  );
7658
7658
  middlewares.push({
7659
7659
  type: "global",
@@ -7667,13 +7667,13 @@ async function generateTRPCExports(sourceFile, config, options, outputDir) {
7667
7667
  sourceFile.addStatements(
7668
7668
  /* ts */
7669
7669
  `
7670
- import defaultMiddleware from '${relativePath(outputDir, joinPaths(outputDir, typeof config.withMiddleware === "string" ? config.withMiddleware : "middleware"))}';
7670
+ import middleware from '${relativePath(outputDir, joinPaths(outputDir, typeof config.withMiddleware === "string" ? config.withMiddleware : "middleware"))}';
7671
7671
  `
7672
7672
  );
7673
7673
  sourceFile.addStatements(
7674
7674
  /* ts */
7675
7675
  `
7676
- export const globalMiddleware = t.middleware(defaultMiddleware);`
7676
+ export const globalMiddleware = t.middleware(middleware);`
7677
7677
  );
7678
7678
  middlewares.push({
7679
7679
  type: "global",
@@ -7687,7 +7687,7 @@ async function generateTRPCExports(sourceFile, config, options, outputDir) {
7687
7687
  sourceFile.addStatements(
7688
7688
  /* ts */
7689
7689
  `
7690
- export const permissionsMiddleware = t.middleware(permissions);
7690
+ export const permissionsMiddleware = t.middleware(permissions);
7691
7691
  `
7692
7692
  );
7693
7693
  middlewares.push({
@@ -7711,7 +7711,7 @@ export const createCallerFactory = t.createCallerFactory;`
7711
7711
  sourceFile.addStatements(
7712
7712
  /* ts */
7713
7713
  `
7714
- export const publicProcedure = t.procedure; `
7714
+ export const publicProcedure = t.procedure; `
7715
7715
  );
7716
7716
  if (middlewares.length > 0) {
7717
7717
  const procName = getProcedureName(config);
@@ -7720,7 +7720,7 @@ export const createCallerFactory = t.createCallerFactory;`
7720
7720
  sourceFile.addStatements(
7721
7721
  /* ts */
7722
7722
  `
7723
- export const ${procName} = t.procedure`
7723
+ export const ${procName} = t.procedure`
7724
7724
  );
7725
7725
  }
7726
7726
  sourceFile.addStatements(
@@ -7733,9 +7733,9 @@ export const createCallerFactory = t.createCallerFactory;`
7733
7733
  sourceFile.addStatements(
7734
7734
  /* ts */
7735
7735
  `
7736
- export const createAction: ReturnType<typeof createTRPCServerActionHandler> =
7737
- createTRPCServerActionHandler(t, createContext);
7738
- `
7736
+ export const createAction: ReturnType<typeof createTRPCServerActionHandler> =
7737
+ createTRPCServerActionHandler(t, createContext);
7738
+ `
7739
7739
  );
7740
7740
  }
7741
7741
  sourceFile.formatText({
@@ -11718,8 +11718,9 @@ ${JSON.stringify(config)}`);
11718
11718
  appRouter.addStatements(
11719
11719
  /* ts */
11720
11720
  `
11721
- export const appRouter = t.router({${routerStatements.join()}})
11722
- `
11721
+ export const appRouter = t.router({${routerStatements.join()}});
11722
+
11723
+ export type AppRouter = typeof appRouter;`
11723
11724
  );
11724
11725
  appRouter.formatText({
11725
11726
  indentSize: 2
package/dist/index.js CHANGED
@@ -6884,7 +6884,7 @@ var configSchema = z.object({
6884
6884
  withShield: configBoolean.default("false"),
6885
6885
  contextPath: z.string().trim().default("../context"),
6886
6886
  trpcOptions: configBoolean.default("true"),
6887
- showModelNameInProcedure: configBoolean.default("true"),
6887
+ showModelNameInProcedure: configBoolean.default("false"),
6888
6888
  generateModelActions: z.string().default(Object.values(ModelAction).join(",")).transform((arg) => {
6889
6889
  return arg.split(",").map((action) => modelActionEnum.parse(action.trim()));
6890
6890
  })
@@ -7641,24 +7641,24 @@ async function generateTRPCExports(sourceFile, config, options, outputDir) {
7641
7641
  sourceFile.addStatements(
7642
7642
  /* ts */
7643
7643
  `import { createContext } from '${relativePath(outputDir, joinPaths(outputDir, config.contextPath))}';
7644
- import { initTRPC } from '@trpc/server';
7645
- import { createTRPCServerActionHandler } from '@stryke/trpc-next/action-handler';`
7644
+ import { initTRPC } from '@trpc/server';
7645
+ import { createTRPCServerActionHandler } from '@stryke/trpc-next/action-handler';`
7646
7646
  );
7647
7647
  }
7648
7648
  sourceFile.addStatements(
7649
7649
  /* ts */
7650
7650
  `
7651
- export const t = initTRPC.context<Context>().create(${config.trpcOptions ? "trpcOptions" : ""});`
7651
+ export const t = initTRPC.context<Context>().create(${config.trpcOptions ? "trpcOptions" : ""});`
7652
7652
  );
7653
7653
  const middlewares = [];
7654
7654
  if (config.withMiddleware && typeof config.withMiddleware === "boolean") {
7655
7655
  sourceFile.addStatements(
7656
7656
  /* ts */
7657
7657
  `
7658
- export const globalMiddleware = t.middleware(async ({ ctx, next }) => {
7659
- console.log('inside middleware!')
7660
- return next()
7661
- });`
7658
+ export const globalMiddleware = t.middleware(async ({ ctx, next }) => {
7659
+ console.log('inside middleware!')
7660
+ return next()
7661
+ });`
7662
7662
  );
7663
7663
  middlewares.push({
7664
7664
  type: "global",
@@ -7672,13 +7672,13 @@ async function generateTRPCExports(sourceFile, config, options, outputDir) {
7672
7672
  sourceFile.addStatements(
7673
7673
  /* ts */
7674
7674
  `
7675
- import defaultMiddleware from '${relativePath(outputDir, joinPaths(outputDir, typeof config.withMiddleware === "string" ? config.withMiddleware : "middleware"))}';
7675
+ import middleware from '${relativePath(outputDir, joinPaths(outputDir, typeof config.withMiddleware === "string" ? config.withMiddleware : "middleware"))}';
7676
7676
  `
7677
7677
  );
7678
7678
  sourceFile.addStatements(
7679
7679
  /* ts */
7680
7680
  `
7681
- export const globalMiddleware = t.middleware(defaultMiddleware);`
7681
+ export const globalMiddleware = t.middleware(middleware);`
7682
7682
  );
7683
7683
  middlewares.push({
7684
7684
  type: "global",
@@ -7692,7 +7692,7 @@ async function generateTRPCExports(sourceFile, config, options, outputDir) {
7692
7692
  sourceFile.addStatements(
7693
7693
  /* ts */
7694
7694
  `
7695
- export const permissionsMiddleware = t.middleware(permissions);
7695
+ export const permissionsMiddleware = t.middleware(permissions);
7696
7696
  `
7697
7697
  );
7698
7698
  middlewares.push({
@@ -7716,7 +7716,7 @@ export const createCallerFactory = t.createCallerFactory;`
7716
7716
  sourceFile.addStatements(
7717
7717
  /* ts */
7718
7718
  `
7719
- export const publicProcedure = t.procedure; `
7719
+ export const publicProcedure = t.procedure; `
7720
7720
  );
7721
7721
  if (middlewares.length > 0) {
7722
7722
  const procName = getProcedureName(config);
@@ -7725,7 +7725,7 @@ export const createCallerFactory = t.createCallerFactory;`
7725
7725
  sourceFile.addStatements(
7726
7726
  /* ts */
7727
7727
  `
7728
- export const ${procName} = t.procedure`
7728
+ export const ${procName} = t.procedure`
7729
7729
  );
7730
7730
  }
7731
7731
  sourceFile.addStatements(
@@ -7738,9 +7738,9 @@ export const createCallerFactory = t.createCallerFactory;`
7738
7738
  sourceFile.addStatements(
7739
7739
  /* ts */
7740
7740
  `
7741
- export const createAction: ReturnType<typeof createTRPCServerActionHandler> =
7742
- createTRPCServerActionHandler(t, createContext);
7743
- `
7741
+ export const createAction: ReturnType<typeof createTRPCServerActionHandler> =
7742
+ createTRPCServerActionHandler(t, createContext);
7743
+ `
7744
7744
  );
7745
7745
  }
7746
7746
  sourceFile.formatText({
@@ -11723,8 +11723,9 @@ ${JSON.stringify(config)}`);
11723
11723
  appRouter.addStatements(
11724
11724
  /* ts */
11725
11725
  `
11726
- export const appRouter = t.router({${routerStatements.join()}})
11727
- `
11726
+ export const appRouter = t.router({${routerStatements.join()}});
11727
+
11728
+ export type AppRouter = typeof appRouter;`
11728
11729
  );
11729
11730
  appRouter.formatText({
11730
11731
  indentSize: 2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/prisma-trpc-generator",
3
- "version": "0.10.1",
3
+ "version": "0.10.3",
4
4
  "type": "module",
5
5
  "description": "A fork of the prisma-trpc-generator code to work in ESM with Prisma v6.",
6
6
  "repository": {