@augment-vir/node 31.40.0 → 31.42.0

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.
Files changed (40) hide show
  1. package/dist/augments/docker.d.ts +2 -1
  2. package/dist/augments/docker.js +2 -1
  3. package/dist/augments/terminal/shell.js +7 -2
  4. package/dist/docker/containers/run-container.mock.js +1 -0
  5. package/dist/index.d.ts +0 -1
  6. package/dist/index.js +0 -1
  7. package/dist/scripts/fix-ts-bin.script.js +6 -0
  8. package/package.json +9 -9
  9. package/src/augments/docker.ts +2 -1
  10. package/src/augments/terminal/shell.ts +7 -2
  11. package/src/docker/containers/run-container.mock.ts +2 -0
  12. package/src/index.ts +0 -1
  13. package/src/scripts/fix-ts-bin.script.ts +6 -0
  14. package/dist/augments/prisma.d.ts +0 -157
  15. package/dist/augments/prisma.js +0 -156
  16. package/dist/prisma/disable-ci-env.mock.d.ts +0 -2
  17. package/dist/prisma/disable-ci-env.mock.js +0 -81
  18. package/dist/prisma/model-data.d.ts +0 -88
  19. package/dist/prisma/model-data.js +0 -84
  20. package/dist/prisma/prisma-client.d.ts +0 -5
  21. package/dist/prisma/prisma-client.js +0 -25
  22. package/dist/prisma/prisma-database.d.ts +0 -11
  23. package/dist/prisma/prisma-database.js +0 -30
  24. package/dist/prisma/prisma-database.mock.d.ts +0 -1
  25. package/dist/prisma/prisma-database.mock.js +0 -25
  26. package/dist/prisma/prisma-errors.d.ts +0 -37
  27. package/dist/prisma/prisma-errors.js +0 -43
  28. package/dist/prisma/prisma-migrations.d.ts +0 -24
  29. package/dist/prisma/prisma-migrations.js +0 -98
  30. package/dist/prisma/run-prisma-command.d.ts +0 -29
  31. package/dist/prisma/run-prisma-command.js +0 -67
  32. package/src/augments/prisma.ts +0 -177
  33. package/src/prisma/disable-ci-env.mock.ts +0 -88
  34. package/src/prisma/model-data.ts +0 -252
  35. package/src/prisma/prisma-client.ts +0 -45
  36. package/src/prisma/prisma-database.mock.ts +0 -31
  37. package/src/prisma/prisma-database.ts +0 -60
  38. package/src/prisma/prisma-errors.ts +0 -45
  39. package/src/prisma/prisma-migrations.ts +0 -153
  40. package/src/prisma/run-prisma-command.ts +0 -94
@@ -1,94 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-deprecated */
2
-
3
- import {log, type PartialWithUndefined, wrapString} from '@augment-vir/common';
4
- import {dirname} from 'node:path';
5
- import {interpolationSafeWindowsPath} from '../augments/path/os-path.js';
6
- import {runShellCommand, type ShellOutput} from '../augments/terminal/shell.js';
7
- import {PrismaSchemaError} from './prisma-errors.js';
8
-
9
- /**
10
- * All commands in the Prisma CLI that support the `--no-hints` flag, used to turn off ads.
11
- *
12
- * @deprecated Use the `prisma-vir` package instead.
13
- * @category Prisma : Node : Util
14
- * @category Package : @augment-vir/node
15
- * @package [`@augment-vir/node`](https://www.npmjs.com/package/@augment-vir/node)
16
- */
17
- export const prismaCommandsThatSupportNoHints = ['generate'];
18
-
19
- /**
20
- * Directly run a Prisma command.
21
- *
22
- * @deprecated Use the `prisma-vir` package instead.
23
- * @category Prisma : Node : Util
24
- * @category Package : @augment-vir/node
25
- * @package [`@augment-vir/node`](https://www.npmjs.com/package/@augment-vir/node)
26
- */
27
- export async function runPrismaCommand(
28
- {
29
- command,
30
- ignoreExitCode = false,
31
- hideLogs = false,
32
- }: {
33
- command: string;
34
- } & PartialWithUndefined<{
35
- /** If `true`, prevents errors from being thrown if this command exits with a non-0 status. */
36
- ignoreExitCode: boolean;
37
- hideLogs: boolean;
38
- }>,
39
- /** Set to `undefined` to omit the `--schema` flag. */
40
- schemaFilePath: string | undefined,
41
- env: Record<string, string> | undefined = {},
42
- ) {
43
- const schemaFileArgs = schemaFilePath
44
- ? [
45
- '--schema',
46
- wrapString({value: schemaFilePath, wrapper: "'"}),
47
- ]
48
- : [];
49
-
50
- /** Disable Prisma's in-CLI ads. */
51
- const noHintsArg = prismaCommandsThatSupportNoHints.some((commandName) =>
52
- command.startsWith(commandName),
53
- )
54
- ? '--no-hints'
55
- : '';
56
-
57
- const fullCommand = [
58
- 'prisma',
59
- command,
60
- ...schemaFileArgs,
61
- noHintsArg,
62
- ].join(' ');
63
-
64
- log.faint(`> ${fullCommand}`);
65
-
66
- const result = await runShellCommand(interpolationSafeWindowsPath(fullCommand), {
67
- env: {
68
- ...process.env,
69
- ...env,
70
- },
71
- hookUpToConsole: !hideLogs,
72
- cwd: schemaFilePath ? dirname(schemaFilePath) : process.cwd(),
73
- });
74
-
75
- return verifyOutput(schemaFilePath || '', result, ignoreExitCode);
76
- }
77
-
78
- export function verifyOutput(
79
- schemaFilePath: string,
80
- shellOutput: Readonly<ShellOutput>,
81
- ignoreExitCode: boolean,
82
- ) {
83
- if (shellOutput.stderr.includes('Validation Error Count')) {
84
- throw new PrismaSchemaError(
85
- `Invalid schema file at '${schemaFilePath}':\n\n${shellOutput.stderr}`,
86
- );
87
- } else if (shellOutput.stderr.includes('does not exist')) {
88
- throw new PrismaSchemaError(`Database does not exist: ${shellOutput.stderr}`);
89
- } else if (shellOutput.exitCode === 0 || ignoreExitCode) {
90
- return shellOutput;
91
- } else {
92
- throw new Error(shellOutput.stdout + shellOutput.stderr);
93
- }
94
- }