@autobe/compiler 0.30.0-dev.20260315 → 0.30.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 (52) hide show
  1. package/LICENSE +661 -661
  2. package/lib/database/validateDatabaseApplication.js +318 -318
  3. package/lib/raw/AutoBeCompilerCommonTemplate.js +5 -5
  4. package/lib/raw/AutoBeCompilerCommonTemplate.js.map +1 -1
  5. package/lib/raw/AutoBeCompilerInterfaceTemplate.js +4 -4
  6. package/lib/raw/AutoBeCompilerInterfaceTemplate.js.map +1 -1
  7. package/lib/raw/AutoBeCompilerRealizeTemplate.js +27 -27
  8. package/lib/raw/AutoBeCompilerRealizeTemplate.js.map +1 -1
  9. package/lib/raw/AutoBeCompilerRealizeTemplateOfPostgres.js +4 -4
  10. package/lib/raw/AutoBeCompilerRealizeTemplateOfPostgres.js.map +1 -1
  11. package/lib/raw/AutoBeCompilerRealizeTemplateOfSQLite.js +4 -4
  12. package/lib/raw/AutoBeCompilerRealizeTemplateOfSQLite.js.map +1 -1
  13. package/lib/raw/AutoBeCompilerTestTemplate.js +8 -8
  14. package/lib/raw/AutoBeCompilerTestTemplate.js.map +1 -1
  15. package/lib/raw/nestjs.json +1640 -1640
  16. package/lib/raw/test.json +130 -130
  17. package/package.json +4 -4
  18. package/src/AutoBeCompiler.ts +93 -93
  19. package/src/AutoBeTypeScriptCompiler.ts +136 -136
  20. package/src/database/AutoBeDatabaseCompiler.ts +48 -48
  21. package/src/database/validateDatabaseApplication.ts +873 -873
  22. package/src/index.ts +5 -5
  23. package/src/interface/AutoBeInterfaceCompiler.ts +79 -79
  24. package/src/raw/AutoBeCompilerCommonTemplate.ts +5 -5
  25. package/src/raw/AutoBeCompilerInterfaceTemplate.ts +4 -4
  26. package/src/raw/AutoBeCompilerRealizeTemplate.ts +27 -27
  27. package/src/raw/AutoBeCompilerRealizeTemplateOfPostgres.ts +4 -4
  28. package/src/raw/AutoBeCompilerRealizeTemplateOfSQLite.ts +4 -4
  29. package/src/raw/AutoBeCompilerTestTemplate.ts +8 -8
  30. package/src/raw/nestjs.json +1640 -1640
  31. package/src/raw/test.json +130 -130
  32. package/src/realize/AutoBeRealizeCompiler.ts +42 -42
  33. package/src/realize/testRealizeProject.ts +78 -78
  34. package/src/realize/writeRealizeControllers.ts +217 -217
  35. package/src/test/AutoBeTestCompiler.ts +112 -112
  36. package/src/test/programmers/AutoBeTestAccessorProgrammer.ts +42 -42
  37. package/src/test/programmers/AutoBeTestFunctionalProgrammer.ts +87 -87
  38. package/src/test/programmers/AutoBeTestLiteralProgrammer.ts +65 -65
  39. package/src/test/programmers/AutoBeTestOperatorProgrammer.ts +84 -84
  40. package/src/test/programmers/AutoBeTestPredicateProgrammer.ts +131 -131
  41. package/src/test/programmers/AutoBeTestRandomProgrammer.ts +304 -304
  42. package/src/test/programmers/AutoBeTestStatementProgrammer.ts +154 -154
  43. package/src/test/programmers/IAutoBeTestApiFunction.ts +6 -6
  44. package/src/test/programmers/IAutoBeTestProgrammerContext.ts +11 -11
  45. package/src/test/programmers/writeTestExpression.ts +29 -29
  46. package/src/test/programmers/writeTestFunction.ts +103 -103
  47. package/src/test/programmers/writeTestStatement.ts +19 -19
  48. package/src/utils/ArrayUtil.ts +21 -21
  49. package/src/utils/FilePrinter.ts +67 -67
  50. package/src/utils/ProcessUtil.ts +14 -14
  51. package/src/utils/shrinkCompileResult.ts +16 -16
  52. package/README.md +0 -261
@@ -1,84 +1,84 @@
1
- import { AutoBeTest } from "@autobe/interface";
2
- import ts from "typescript";
3
-
4
- import { IAutoBeTestProgrammerContext } from "./IAutoBeTestProgrammerContext";
5
- import { writeTestExpression } from "./writeTestExpression";
6
-
7
- export namespace AutoBeTestOperatorProgrammer {
8
- export const conditionalExpression = (
9
- ctx: IAutoBeTestProgrammerContext,
10
- expr: AutoBeTest.IConditionalExpression,
11
- ): ts.ConditionalExpression =>
12
- ts.factory.createConditionalExpression(
13
- writeTestExpression(ctx, expr.condition),
14
- undefined,
15
- writeTestExpression(ctx, expr.whenTrue),
16
- undefined,
17
- writeTestExpression(ctx, expr.whenFalse),
18
- );
19
-
20
- export const typeOfExpression = (
21
- ctx: IAutoBeTestProgrammerContext,
22
- expr: AutoBeTest.ITypeOfExpression,
23
- ): ts.TypeOfExpression =>
24
- ts.factory.createTypeOfExpression(
25
- writeTestExpression(ctx, expr.expression),
26
- );
27
-
28
- export const prefixUnaryExpression = (
29
- ctx: IAutoBeTestProgrammerContext,
30
- expr: AutoBeTest.IPrefixUnaryExpression,
31
- ): ts.TypeOfExpression | ts.PrefixUnaryExpression =>
32
- ts.factory.createPrefixUnaryExpression(
33
- PREFIX_UNARY_OPERATORS[expr.operator],
34
- writeTestExpression(ctx, expr.operand),
35
- );
36
-
37
- export const postfixUnaryExpression = (
38
- ctx: IAutoBeTestProgrammerContext,
39
- expr: AutoBeTest.IPostfixUnaryExpression,
40
- ): ts.PostfixUnaryExpression =>
41
- ts.factory.createPostfixUnaryExpression(
42
- writeTestExpression(ctx, expr.operand),
43
- POSTFIX_UNARY_OPERATORS[expr.operator],
44
- );
45
-
46
- export const binaryExpression = (
47
- ctx: IAutoBeTestProgrammerContext,
48
- expr: AutoBeTest.IBinaryExpression,
49
- ): ts.BinaryExpression =>
50
- ts.factory.createBinaryExpression(
51
- writeTestExpression(ctx, expr.left),
52
- BINARY_OPERATORS[expr.operator],
53
- writeTestExpression(ctx, expr.right),
54
- );
55
- }
56
-
57
- const POSTFIX_UNARY_OPERATORS = {
58
- "++": ts.SyntaxKind.PlusPlusToken,
59
- "--": ts.SyntaxKind.MinusMinusToken,
60
- } as const;
61
-
62
- const PREFIX_UNARY_OPERATORS = {
63
- ...POSTFIX_UNARY_OPERATORS,
64
- "+": ts.SyntaxKind.PlusToken,
65
- "-": ts.SyntaxKind.MinusToken,
66
- "!": ts.SyntaxKind.ExclamationToken,
67
- } as const;
68
-
69
- const BINARY_OPERATORS = {
70
- "===": ts.SyntaxKind.EqualsEqualsEqualsToken,
71
- "!==": ts.SyntaxKind.ExclamationEqualsEqualsToken,
72
- "<": ts.SyntaxKind.LessThanToken,
73
- "<=": ts.SyntaxKind.LessThanEqualsToken,
74
- ">": ts.SyntaxKind.GreaterThanToken,
75
- ">=": ts.SyntaxKind.GreaterThanEqualsToken,
76
- "+": ts.SyntaxKind.PlusToken,
77
- "-": ts.SyntaxKind.MinusToken,
78
- "*": ts.SyntaxKind.AsteriskToken,
79
- "/": ts.SyntaxKind.SlashToken,
80
- "%": ts.SyntaxKind.PercentToken,
81
- "&&": ts.SyntaxKind.AmpersandAmpersandToken,
82
- "||": ts.SyntaxKind.BarBarToken,
83
- instanceof: ts.SyntaxKind.InstanceOfKeyword,
84
- } as const;
1
+ import { AutoBeTest } from "@autobe/interface";
2
+ import ts from "typescript";
3
+
4
+ import { IAutoBeTestProgrammerContext } from "./IAutoBeTestProgrammerContext";
5
+ import { writeTestExpression } from "./writeTestExpression";
6
+
7
+ export namespace AutoBeTestOperatorProgrammer {
8
+ export const conditionalExpression = (
9
+ ctx: IAutoBeTestProgrammerContext,
10
+ expr: AutoBeTest.IConditionalExpression,
11
+ ): ts.ConditionalExpression =>
12
+ ts.factory.createConditionalExpression(
13
+ writeTestExpression(ctx, expr.condition),
14
+ undefined,
15
+ writeTestExpression(ctx, expr.whenTrue),
16
+ undefined,
17
+ writeTestExpression(ctx, expr.whenFalse),
18
+ );
19
+
20
+ export const typeOfExpression = (
21
+ ctx: IAutoBeTestProgrammerContext,
22
+ expr: AutoBeTest.ITypeOfExpression,
23
+ ): ts.TypeOfExpression =>
24
+ ts.factory.createTypeOfExpression(
25
+ writeTestExpression(ctx, expr.expression),
26
+ );
27
+
28
+ export const prefixUnaryExpression = (
29
+ ctx: IAutoBeTestProgrammerContext,
30
+ expr: AutoBeTest.IPrefixUnaryExpression,
31
+ ): ts.TypeOfExpression | ts.PrefixUnaryExpression =>
32
+ ts.factory.createPrefixUnaryExpression(
33
+ PREFIX_UNARY_OPERATORS[expr.operator],
34
+ writeTestExpression(ctx, expr.operand),
35
+ );
36
+
37
+ export const postfixUnaryExpression = (
38
+ ctx: IAutoBeTestProgrammerContext,
39
+ expr: AutoBeTest.IPostfixUnaryExpression,
40
+ ): ts.PostfixUnaryExpression =>
41
+ ts.factory.createPostfixUnaryExpression(
42
+ writeTestExpression(ctx, expr.operand),
43
+ POSTFIX_UNARY_OPERATORS[expr.operator],
44
+ );
45
+
46
+ export const binaryExpression = (
47
+ ctx: IAutoBeTestProgrammerContext,
48
+ expr: AutoBeTest.IBinaryExpression,
49
+ ): ts.BinaryExpression =>
50
+ ts.factory.createBinaryExpression(
51
+ writeTestExpression(ctx, expr.left),
52
+ BINARY_OPERATORS[expr.operator],
53
+ writeTestExpression(ctx, expr.right),
54
+ );
55
+ }
56
+
57
+ const POSTFIX_UNARY_OPERATORS = {
58
+ "++": ts.SyntaxKind.PlusPlusToken,
59
+ "--": ts.SyntaxKind.MinusMinusToken,
60
+ } as const;
61
+
62
+ const PREFIX_UNARY_OPERATORS = {
63
+ ...POSTFIX_UNARY_OPERATORS,
64
+ "+": ts.SyntaxKind.PlusToken,
65
+ "-": ts.SyntaxKind.MinusToken,
66
+ "!": ts.SyntaxKind.ExclamationToken,
67
+ } as const;
68
+
69
+ const BINARY_OPERATORS = {
70
+ "===": ts.SyntaxKind.EqualsEqualsEqualsToken,
71
+ "!==": ts.SyntaxKind.ExclamationEqualsEqualsToken,
72
+ "<": ts.SyntaxKind.LessThanToken,
73
+ "<=": ts.SyntaxKind.LessThanEqualsToken,
74
+ ">": ts.SyntaxKind.GreaterThanToken,
75
+ ">=": ts.SyntaxKind.GreaterThanEqualsToken,
76
+ "+": ts.SyntaxKind.PlusToken,
77
+ "-": ts.SyntaxKind.MinusToken,
78
+ "*": ts.SyntaxKind.AsteriskToken,
79
+ "/": ts.SyntaxKind.SlashToken,
80
+ "%": ts.SyntaxKind.PercentToken,
81
+ "&&": ts.SyntaxKind.AmpersandAmpersandToken,
82
+ "||": ts.SyntaxKind.BarBarToken,
83
+ instanceof: ts.SyntaxKind.InstanceOfKeyword,
84
+ } as const;
@@ -1,131 +1,131 @@
1
- import { AutoBeTest } from "@autobe/interface";
2
- import ts from "typescript";
3
-
4
- import { IAutoBeTestProgrammerContext } from "./IAutoBeTestProgrammerContext";
5
- import { writeTestExpression } from "./writeTestExpression";
6
-
7
- export namespace AutoBeTestPredicateProgrammer {
8
- export const equalPredicate = (
9
- ctx: IAutoBeTestProgrammerContext,
10
- expression: AutoBeTest.IEqualPredicate,
11
- ): ts.CallExpression =>
12
- ts.factory.createCallExpression(
13
- ts.factory.createPropertyAccessExpression(
14
- ts.factory.createIdentifier(
15
- ctx.importer.external({
16
- type: "instance",
17
- library: "@nestia/e2e",
18
- name: "TestValidator",
19
- }),
20
- ),
21
- "equals",
22
- ),
23
- undefined,
24
- [
25
- ts.factory.createStringLiteral(expression.title),
26
- writeTestExpression(ctx, expression.x),
27
- writeTestExpression(ctx, expression.y),
28
- ],
29
- );
30
-
31
- export const notEqualPredicate = (
32
- ctx: IAutoBeTestProgrammerContext,
33
- expression: AutoBeTest.INotEqualPredicate,
34
- ): ts.CallExpression =>
35
- ts.factory.createCallExpression(
36
- ts.factory.createPropertyAccessExpression(
37
- ts.factory.createIdentifier(
38
- ctx.importer.external({
39
- type: "instance",
40
- library: "@nestia/e2e",
41
- name: "TestValidator",
42
- }),
43
- ),
44
- "error",
45
- ),
46
- undefined,
47
- [
48
- ts.factory.createStringLiteral(expression.title),
49
- ts.factory.createArrowFunction(
50
- undefined,
51
- undefined,
52
- [],
53
- undefined,
54
- undefined,
55
- equalPredicate(ctx, {
56
- type: "equalPredicate",
57
- title: expression.title,
58
- x: expression.x,
59
- y: expression.y,
60
- }),
61
- ),
62
- ],
63
- );
64
-
65
- export const conditionalPredicate = (
66
- ctx: IAutoBeTestProgrammerContext,
67
- expression: AutoBeTest.IConditionalPredicate,
68
- ): ts.CallExpression =>
69
- ts.factory.createCallExpression(
70
- ts.factory.createPropertyAccessExpression(
71
- ts.factory.createIdentifier(
72
- ctx.importer.external({
73
- type: "instance",
74
- library: "@nestia/e2e",
75
- name: "TestValidator",
76
- }),
77
- ),
78
- "predicate",
79
- ),
80
- undefined,
81
- [
82
- ts.factory.createStringLiteral(expression.title),
83
- writeTestExpression(ctx, expression.expression),
84
- ],
85
- );
86
-
87
- export const errorPredicate = (
88
- ctx: IAutoBeTestProgrammerContext,
89
- expression: AutoBeTest.IErrorPredicate,
90
- ): ts.CallExpression =>
91
- ts.factory.createCallExpression(
92
- ts.factory.createPropertyAccessExpression(
93
- ts.factory.createIdentifier(
94
- ctx.importer.external({
95
- type: "instance",
96
- library: "@nestia/e2e",
97
- name: "TestValidator",
98
- }),
99
- ),
100
- "error",
101
- ),
102
- undefined,
103
- [
104
- ts.factory.createStringLiteral(expression.title),
105
- writeTestExpression(ctx, expression.function),
106
- ],
107
- );
108
-
109
- // export const httpErrorPredicate = (
110
- // ctx: IAutoBeTestProgrammerContext,
111
- // expression: AutoBeTest.IHttpErrorPredicate,
112
- // ): ts.CallExpression =>
113
- // ts.factory.createCallExpression(
114
- // ts.factory.createPropertyAccessExpression(
115
- // ts.factory.createIdentifier(
116
- // ctx.importer.external({
117
- // type: "instance",
118
- // library: "@nestia/e2e",
119
- // name: "TestValidator",
120
- // }),
121
- // ),
122
- // "httpError",
123
- // ),
124
- // undefined,
125
- // [
126
- // ts.factory.createStringLiteral(expression.title),
127
- // ts.factory.createNumericLiteral(expression.status),
128
- // writeTestExpression(ctx, expression.function),
129
- // ],
130
- // );
131
- }
1
+ import { AutoBeTest } from "@autobe/interface";
2
+ import ts from "typescript";
3
+
4
+ import { IAutoBeTestProgrammerContext } from "./IAutoBeTestProgrammerContext";
5
+ import { writeTestExpression } from "./writeTestExpression";
6
+
7
+ export namespace AutoBeTestPredicateProgrammer {
8
+ export const equalPredicate = (
9
+ ctx: IAutoBeTestProgrammerContext,
10
+ expression: AutoBeTest.IEqualPredicate,
11
+ ): ts.CallExpression =>
12
+ ts.factory.createCallExpression(
13
+ ts.factory.createPropertyAccessExpression(
14
+ ts.factory.createIdentifier(
15
+ ctx.importer.external({
16
+ type: "instance",
17
+ library: "@nestia/e2e",
18
+ name: "TestValidator",
19
+ }),
20
+ ),
21
+ "equals",
22
+ ),
23
+ undefined,
24
+ [
25
+ ts.factory.createStringLiteral(expression.title),
26
+ writeTestExpression(ctx, expression.x),
27
+ writeTestExpression(ctx, expression.y),
28
+ ],
29
+ );
30
+
31
+ export const notEqualPredicate = (
32
+ ctx: IAutoBeTestProgrammerContext,
33
+ expression: AutoBeTest.INotEqualPredicate,
34
+ ): ts.CallExpression =>
35
+ ts.factory.createCallExpression(
36
+ ts.factory.createPropertyAccessExpression(
37
+ ts.factory.createIdentifier(
38
+ ctx.importer.external({
39
+ type: "instance",
40
+ library: "@nestia/e2e",
41
+ name: "TestValidator",
42
+ }),
43
+ ),
44
+ "error",
45
+ ),
46
+ undefined,
47
+ [
48
+ ts.factory.createStringLiteral(expression.title),
49
+ ts.factory.createArrowFunction(
50
+ undefined,
51
+ undefined,
52
+ [],
53
+ undefined,
54
+ undefined,
55
+ equalPredicate(ctx, {
56
+ type: "equalPredicate",
57
+ title: expression.title,
58
+ x: expression.x,
59
+ y: expression.y,
60
+ }),
61
+ ),
62
+ ],
63
+ );
64
+
65
+ export const conditionalPredicate = (
66
+ ctx: IAutoBeTestProgrammerContext,
67
+ expression: AutoBeTest.IConditionalPredicate,
68
+ ): ts.CallExpression =>
69
+ ts.factory.createCallExpression(
70
+ ts.factory.createPropertyAccessExpression(
71
+ ts.factory.createIdentifier(
72
+ ctx.importer.external({
73
+ type: "instance",
74
+ library: "@nestia/e2e",
75
+ name: "TestValidator",
76
+ }),
77
+ ),
78
+ "predicate",
79
+ ),
80
+ undefined,
81
+ [
82
+ ts.factory.createStringLiteral(expression.title),
83
+ writeTestExpression(ctx, expression.expression),
84
+ ],
85
+ );
86
+
87
+ export const errorPredicate = (
88
+ ctx: IAutoBeTestProgrammerContext,
89
+ expression: AutoBeTest.IErrorPredicate,
90
+ ): ts.CallExpression =>
91
+ ts.factory.createCallExpression(
92
+ ts.factory.createPropertyAccessExpression(
93
+ ts.factory.createIdentifier(
94
+ ctx.importer.external({
95
+ type: "instance",
96
+ library: "@nestia/e2e",
97
+ name: "TestValidator",
98
+ }),
99
+ ),
100
+ "error",
101
+ ),
102
+ undefined,
103
+ [
104
+ ts.factory.createStringLiteral(expression.title),
105
+ writeTestExpression(ctx, expression.function),
106
+ ],
107
+ );
108
+
109
+ // export const httpErrorPredicate = (
110
+ // ctx: IAutoBeTestProgrammerContext,
111
+ // expression: AutoBeTest.IHttpErrorPredicate,
112
+ // ): ts.CallExpression =>
113
+ // ts.factory.createCallExpression(
114
+ // ts.factory.createPropertyAccessExpression(
115
+ // ts.factory.createIdentifier(
116
+ // ctx.importer.external({
117
+ // type: "instance",
118
+ // library: "@nestia/e2e",
119
+ // name: "TestValidator",
120
+ // }),
121
+ // ),
122
+ // "httpError",
123
+ // ),
124
+ // undefined,
125
+ // [
126
+ // ts.factory.createStringLiteral(expression.title),
127
+ // ts.factory.createNumericLiteral(expression.status),
128
+ // writeTestExpression(ctx, expression.function),
129
+ // ],
130
+ // );
131
+ }