@stryke/prisma-trpc-generator 0.9.0 → 0.9.1

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.
@@ -7630,14 +7630,12 @@ async function generateTRPCExports(sourceFile, config, options, outputDir) {
7630
7630
  }
7631
7631
  sourceFile.addStatements(
7632
7632
  /* ts */
7633
- `
7634
- import type { Context } from '${relativePath(outputDir, joinPaths(outputDir, config.contextPath))}';`
7633
+ `import type { Context } from '${relativePath(outputDir, joinPaths(outputDir, config.contextPath))}';`
7635
7634
  );
7636
7635
  if (config.trpcOptions) {
7637
7636
  sourceFile.addStatements(
7638
7637
  /* ts */
7639
- `
7640
- import trpcOptions from '${relativePath(outputDir, joinPaths(outputDir, typeof config.trpcOptions === "string" ? config.trpcOptions : "options"))}';`
7638
+ `import trpcOptions from '${relativePath(outputDir, joinPaths(outputDir, typeof config.trpcOptions === "string" ? config.trpcOptions : "./options"))}';`
7641
7639
  );
7642
7640
  }
7643
7641
  if (config.withNext) {
@@ -11529,9 +11527,10 @@ __name(addMissingZodInputObjectTypes, "addMissingZodInputObjectTypes");
11529
11527
 
11530
11528
  // src/prisma-generator.ts
11531
11529
  async function generate(options) {
11532
- console.log("[STORM]: Running the Storm Software - Prisma tRPC generator");
11530
+ console.log("[STORM]: Running the Storm Software - Prisma tRPC generator \n");
11533
11531
  const internals = await getPrismaInternals();
11534
- console.log(`[STORM]: Validating configuration options`);
11532
+ console.log(`[STORM]: Validating configuration options
11533
+ `);
11535
11534
  const outputDir = internals.parseEnvValue(options.generator.output);
11536
11535
  const results = configSchema.safeParse(options.generator.config);
11537
11536
  if (!results.success) {
@@ -11544,6 +11543,8 @@ async function generate(options) {
11544
11543
  `);
11545
11544
  }
11546
11545
  }, "consoleLog");
11546
+ consoleLog(`Using configuration parameters:
11547
+ ${JSON.stringify(config)}`);
11547
11548
  consoleLog(`Preparing output directory: ${outputDir}`);
11548
11549
  await removeDirectory(outputDir);
11549
11550
  await createDirectory(outputDir);
@@ -11631,9 +11632,9 @@ async function generate(options) {
11631
11632
  queries.sort();
11632
11633
  mutations.sort();
11633
11634
  subscriptions.sort();
11634
- if (config.withShield !== false && (typeof config.withShield !== "string" || !existsSync(joinPaths(outputDir, config.withShield)) && !existsSync(joinPaths(outputDir, `${config.withShield}.ts`)) && !existsSync(joinPaths(outputDir, config.withShield, "shield.ts")))) {
11635
+ if (config.withShield && !(typeof config.withShield === "string" && (existsSync(joinPaths(outputDir, config.withShield)) || existsSync(joinPaths(outputDir, `./${config.withShield}.ts`)) || existsSync(joinPaths(outputDir, config.withShield, "./shield.ts"))))) {
11635
11636
  consoleLog(`Generating tRPC Shield source file to ${outputDir}`);
11636
- await writeFileSafely(joinPaths(outputDir, "shield.ts"), await constructShield({
11637
+ await writeFileSafely(joinPaths(outputDir, "./shield.ts"), await constructShield({
11637
11638
  queries,
11638
11639
  mutations,
11639
11640
  subscriptions
@@ -11644,7 +11645,7 @@ async function generate(options) {
11644
11645
  consoleLog(`Generating tRPC source code for ${models.length} models`);
11645
11646
  if (config.trpcOptions && typeof config.trpcOptions === "boolean") {
11646
11647
  consoleLog(`Generating tRPC options source file to ${outputDir}`);
11647
- await writeFileSafely(joinPaths(outputDir, "options.ts"), constructDefaultOptions(config, options, outputDir));
11648
+ await writeFileSafely(joinPaths(outputDir, "./options.ts"), constructDefaultOptions(config, options, outputDir));
11648
11649
  }
11649
11650
  resolveModelsComments(models, hiddenModels);
11650
11651
  consoleLog("Generating tRPC export file");
package/dist/generator.js CHANGED
@@ -7635,14 +7635,12 @@ async function generateTRPCExports(sourceFile, config, options, outputDir) {
7635
7635
  }
7636
7636
  sourceFile.addStatements(
7637
7637
  /* ts */
7638
- `
7639
- import type { Context } from '${relativePath(outputDir, joinPaths(outputDir, config.contextPath))}';`
7638
+ `import type { Context } from '${relativePath(outputDir, joinPaths(outputDir, config.contextPath))}';`
7640
7639
  );
7641
7640
  if (config.trpcOptions) {
7642
7641
  sourceFile.addStatements(
7643
7642
  /* ts */
7644
- `
7645
- import trpcOptions from '${relativePath(outputDir, joinPaths(outputDir, typeof config.trpcOptions === "string" ? config.trpcOptions : "options"))}';`
7643
+ `import trpcOptions from '${relativePath(outputDir, joinPaths(outputDir, typeof config.trpcOptions === "string" ? config.trpcOptions : "./options"))}';`
7646
7644
  );
7647
7645
  }
7648
7646
  if (config.withNext) {
@@ -11534,9 +11532,10 @@ __name(addMissingZodInputObjectTypes, "addMissingZodInputObjectTypes");
11534
11532
 
11535
11533
  // src/prisma-generator.ts
11536
11534
  async function generate(options) {
11537
- console.log("[STORM]: Running the Storm Software - Prisma tRPC generator");
11535
+ console.log("[STORM]: Running the Storm Software - Prisma tRPC generator \n");
11538
11536
  const internals = await getPrismaInternals();
11539
- console.log(`[STORM]: Validating configuration options`);
11537
+ console.log(`[STORM]: Validating configuration options
11538
+ `);
11540
11539
  const outputDir = internals.parseEnvValue(options.generator.output);
11541
11540
  const results = configSchema.safeParse(options.generator.config);
11542
11541
  if (!results.success) {
@@ -11549,6 +11548,8 @@ async function generate(options) {
11549
11548
  `);
11550
11549
  }
11551
11550
  }, "consoleLog");
11551
+ consoleLog(`Using configuration parameters:
11552
+ ${JSON.stringify(config)}`);
11552
11553
  consoleLog(`Preparing output directory: ${outputDir}`);
11553
11554
  await removeDirectory(outputDir);
11554
11555
  await createDirectory(outputDir);
@@ -11636,9 +11637,9 @@ async function generate(options) {
11636
11637
  queries.sort();
11637
11638
  mutations.sort();
11638
11639
  subscriptions.sort();
11639
- if (config.withShield !== false && (typeof config.withShield !== "string" || !existsSync(joinPaths(outputDir, config.withShield)) && !existsSync(joinPaths(outputDir, `${config.withShield}.ts`)) && !existsSync(joinPaths(outputDir, config.withShield, "shield.ts")))) {
11640
+ if (config.withShield && !(typeof config.withShield === "string" && (existsSync(joinPaths(outputDir, config.withShield)) || existsSync(joinPaths(outputDir, `./${config.withShield}.ts`)) || existsSync(joinPaths(outputDir, config.withShield, "./shield.ts"))))) {
11640
11641
  consoleLog(`Generating tRPC Shield source file to ${outputDir}`);
11641
- await writeFileSafely(joinPaths(outputDir, "shield.ts"), await constructShield({
11642
+ await writeFileSafely(joinPaths(outputDir, "./shield.ts"), await constructShield({
11642
11643
  queries,
11643
11644
  mutations,
11644
11645
  subscriptions
@@ -11649,7 +11650,7 @@ async function generate(options) {
11649
11650
  consoleLog(`Generating tRPC source code for ${models.length} models`);
11650
11651
  if (config.trpcOptions && typeof config.trpcOptions === "boolean") {
11651
11652
  consoleLog(`Generating tRPC options source file to ${outputDir}`);
11652
- await writeFileSafely(joinPaths(outputDir, "options.ts"), constructDefaultOptions(config, options, outputDir));
11653
+ await writeFileSafely(joinPaths(outputDir, "./options.ts"), constructDefaultOptions(config, options, outputDir));
11653
11654
  }
11654
11655
  resolveModelsComments(models, hiddenModels);
11655
11656
  consoleLog("Generating tRPC export file");
package/dist/index.cjs CHANGED
@@ -7626,14 +7626,12 @@ async function generateTRPCExports(sourceFile, config, options, outputDir) {
7626
7626
  }
7627
7627
  sourceFile.addStatements(
7628
7628
  /* ts */
7629
- `
7630
- import type { Context } from '${relativePath(outputDir, joinPaths(outputDir, config.contextPath))}';`
7629
+ `import type { Context } from '${relativePath(outputDir, joinPaths(outputDir, config.contextPath))}';`
7631
7630
  );
7632
7631
  if (config.trpcOptions) {
7633
7632
  sourceFile.addStatements(
7634
7633
  /* ts */
7635
- `
7636
- import trpcOptions from '${relativePath(outputDir, joinPaths(outputDir, typeof config.trpcOptions === "string" ? config.trpcOptions : "options"))}';`
7634
+ `import trpcOptions from '${relativePath(outputDir, joinPaths(outputDir, typeof config.trpcOptions === "string" ? config.trpcOptions : "./options"))}';`
7637
7635
  );
7638
7636
  }
7639
7637
  if (config.withNext) {
@@ -11525,9 +11523,10 @@ __name(addMissingZodInputObjectTypes, "addMissingZodInputObjectTypes");
11525
11523
 
11526
11524
  // src/prisma-generator.ts
11527
11525
  async function generate(options) {
11528
- console.log("[STORM]: Running the Storm Software - Prisma tRPC generator");
11526
+ console.log("[STORM]: Running the Storm Software - Prisma tRPC generator \n");
11529
11527
  const internals = await getPrismaInternals();
11530
- console.log(`[STORM]: Validating configuration options`);
11528
+ console.log(`[STORM]: Validating configuration options
11529
+ `);
11531
11530
  const outputDir = internals.parseEnvValue(options.generator.output);
11532
11531
  const results = configSchema.safeParse(options.generator.config);
11533
11532
  if (!results.success) {
@@ -11540,6 +11539,8 @@ async function generate(options) {
11540
11539
  `);
11541
11540
  }
11542
11541
  }, "consoleLog");
11542
+ consoleLog(`Using configuration parameters:
11543
+ ${JSON.stringify(config)}`);
11543
11544
  consoleLog(`Preparing output directory: ${outputDir}`);
11544
11545
  await removeDirectory(outputDir);
11545
11546
  await createDirectory(outputDir);
@@ -11627,9 +11628,9 @@ async function generate(options) {
11627
11628
  queries.sort();
11628
11629
  mutations.sort();
11629
11630
  subscriptions.sort();
11630
- if (config.withShield !== false && (typeof config.withShield !== "string" || !existsSync(joinPaths(outputDir, config.withShield)) && !existsSync(joinPaths(outputDir, `${config.withShield}.ts`)) && !existsSync(joinPaths(outputDir, config.withShield, "shield.ts")))) {
11631
+ if (config.withShield && !(typeof config.withShield === "string" && (existsSync(joinPaths(outputDir, config.withShield)) || existsSync(joinPaths(outputDir, `./${config.withShield}.ts`)) || existsSync(joinPaths(outputDir, config.withShield, "./shield.ts"))))) {
11631
11632
  consoleLog(`Generating tRPC Shield source file to ${outputDir}`);
11632
- await writeFileSafely(joinPaths(outputDir, "shield.ts"), await constructShield({
11633
+ await writeFileSafely(joinPaths(outputDir, "./shield.ts"), await constructShield({
11633
11634
  queries,
11634
11635
  mutations,
11635
11636
  subscriptions
@@ -11640,7 +11641,7 @@ async function generate(options) {
11640
11641
  consoleLog(`Generating tRPC source code for ${models.length} models`);
11641
11642
  if (config.trpcOptions && typeof config.trpcOptions === "boolean") {
11642
11643
  consoleLog(`Generating tRPC options source file to ${outputDir}`);
11643
- await writeFileSafely(joinPaths(outputDir, "options.ts"), constructDefaultOptions(config, options, outputDir));
11644
+ await writeFileSafely(joinPaths(outputDir, "./options.ts"), constructDefaultOptions(config, options, outputDir));
11644
11645
  }
11645
11646
  resolveModelsComments(models, hiddenModels);
11646
11647
  consoleLog("Generating tRPC export file");
package/dist/index.js CHANGED
@@ -7631,14 +7631,12 @@ async function generateTRPCExports(sourceFile, config, options, outputDir) {
7631
7631
  }
7632
7632
  sourceFile.addStatements(
7633
7633
  /* ts */
7634
- `
7635
- import type { Context } from '${relativePath(outputDir, joinPaths(outputDir, config.contextPath))}';`
7634
+ `import type { Context } from '${relativePath(outputDir, joinPaths(outputDir, config.contextPath))}';`
7636
7635
  );
7637
7636
  if (config.trpcOptions) {
7638
7637
  sourceFile.addStatements(
7639
7638
  /* ts */
7640
- `
7641
- import trpcOptions from '${relativePath(outputDir, joinPaths(outputDir, typeof config.trpcOptions === "string" ? config.trpcOptions : "options"))}';`
7639
+ `import trpcOptions from '${relativePath(outputDir, joinPaths(outputDir, typeof config.trpcOptions === "string" ? config.trpcOptions : "./options"))}';`
7642
7640
  );
7643
7641
  }
7644
7642
  if (config.withNext) {
@@ -11530,9 +11528,10 @@ __name(addMissingZodInputObjectTypes, "addMissingZodInputObjectTypes");
11530
11528
 
11531
11529
  // src/prisma-generator.ts
11532
11530
  async function generate(options) {
11533
- console.log("[STORM]: Running the Storm Software - Prisma tRPC generator");
11531
+ console.log("[STORM]: Running the Storm Software - Prisma tRPC generator \n");
11534
11532
  const internals = await getPrismaInternals();
11535
- console.log(`[STORM]: Validating configuration options`);
11533
+ console.log(`[STORM]: Validating configuration options
11534
+ `);
11536
11535
  const outputDir = internals.parseEnvValue(options.generator.output);
11537
11536
  const results = configSchema.safeParse(options.generator.config);
11538
11537
  if (!results.success) {
@@ -11545,6 +11544,8 @@ async function generate(options) {
11545
11544
  `);
11546
11545
  }
11547
11546
  }, "consoleLog");
11547
+ consoleLog(`Using configuration parameters:
11548
+ ${JSON.stringify(config)}`);
11548
11549
  consoleLog(`Preparing output directory: ${outputDir}`);
11549
11550
  await removeDirectory(outputDir);
11550
11551
  await createDirectory(outputDir);
@@ -11632,9 +11633,9 @@ async function generate(options) {
11632
11633
  queries.sort();
11633
11634
  mutations.sort();
11634
11635
  subscriptions.sort();
11635
- if (config.withShield !== false && (typeof config.withShield !== "string" || !existsSync(joinPaths(outputDir, config.withShield)) && !existsSync(joinPaths(outputDir, `${config.withShield}.ts`)) && !existsSync(joinPaths(outputDir, config.withShield, "shield.ts")))) {
11636
+ if (config.withShield && !(typeof config.withShield === "string" && (existsSync(joinPaths(outputDir, config.withShield)) || existsSync(joinPaths(outputDir, `./${config.withShield}.ts`)) || existsSync(joinPaths(outputDir, config.withShield, "./shield.ts"))))) {
11636
11637
  consoleLog(`Generating tRPC Shield source file to ${outputDir}`);
11637
- await writeFileSafely(joinPaths(outputDir, "shield.ts"), await constructShield({
11638
+ await writeFileSafely(joinPaths(outputDir, "./shield.ts"), await constructShield({
11638
11639
  queries,
11639
11640
  mutations,
11640
11641
  subscriptions
@@ -11645,7 +11646,7 @@ async function generate(options) {
11645
11646
  consoleLog(`Generating tRPC source code for ${models.length} models`);
11646
11647
  if (config.trpcOptions && typeof config.trpcOptions === "boolean") {
11647
11648
  consoleLog(`Generating tRPC options source file to ${outputDir}`);
11648
- await writeFileSafely(joinPaths(outputDir, "options.ts"), constructDefaultOptions(config, options, outputDir));
11649
+ await writeFileSafely(joinPaths(outputDir, "./options.ts"), constructDefaultOptions(config, options, outputDir));
11649
11650
  }
11650
11651
  resolveModelsComments(models, hiddenModels);
11651
11652
  consoleLog("Generating tRPC export file");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stryke/prisma-trpc-generator",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
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": {