@autobe/compiler 0.20.0 → 0.21.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.
@@ -1,6 +1,5 @@
1
1
  import { AutoBeTest } from "@autobe/interface";
2
2
  import ts from "typescript";
3
- import { ExpressionFactory } from "typia/lib/factories/ExpressionFactory";
4
3
 
5
4
  import { AutoBeTestStatementProgrammer } from "./AutoBeTestStatementProgrammer";
6
5
  import { IAutoBeTestProgrammerContext } from "./IAutoBeTestProgrammerContext";
@@ -71,8 +70,8 @@ const arrayExpression = (
71
70
  argList: AutoBeTest.IExpression[],
72
71
  ): ts.AwaitExpression =>
73
72
  ts.factory.createAwaitExpression(
74
- ExpressionFactory.currying({
75
- function: ts.factory.createPropertyAccessExpression(
73
+ ts.factory.createCallExpression(
74
+ ts.factory.createPropertyAccessExpression(
76
75
  ts.factory.createIdentifier(
77
76
  ctx.importer.external({
78
77
  type: "instance",
@@ -82,6 +81,7 @@ const arrayExpression = (
82
81
  ),
83
82
  name,
84
83
  ),
85
- arguments: argList.map((a) => writeTestExpression(ctx, a)),
86
- }),
84
+ undefined,
85
+ argList.map((a) => writeTestExpression(ctx, a)),
86
+ ),
87
87
  );
@@ -1,6 +1,5 @@
1
1
  import { AutoBeTest } from "@autobe/interface";
2
2
  import ts from "typescript";
3
- import { ExpressionFactory } from "typia/lib/factories/ExpressionFactory";
4
3
 
5
4
  import { IAutoBeTestProgrammerContext } from "./IAutoBeTestProgrammerContext";
6
5
  import { writeTestExpression } from "./writeTestExpression";
@@ -10,8 +9,8 @@ export namespace AutoBeTestPredicateProgrammer {
10
9
  ctx: IAutoBeTestProgrammerContext,
11
10
  expression: AutoBeTest.IEqualPredicate,
12
11
  ): ts.CallExpression =>
13
- ExpressionFactory.currying({
14
- function: ts.factory.createPropertyAccessExpression(
12
+ ts.factory.createCallExpression(
13
+ ts.factory.createPropertyAccessExpression(
15
14
  ts.factory.createIdentifier(
16
15
  ctx.importer.external({
17
16
  type: "instance",
@@ -21,19 +20,20 @@ export namespace AutoBeTestPredicateProgrammer {
21
20
  ),
22
21
  "equals",
23
22
  ),
24
- arguments: [
23
+ undefined,
24
+ [
25
25
  ts.factory.createStringLiteral(expression.title),
26
26
  writeTestExpression(ctx, expression.x),
27
27
  writeTestExpression(ctx, expression.y),
28
28
  ],
29
- });
29
+ );
30
30
 
31
31
  export const notEqualPredicate = (
32
32
  ctx: IAutoBeTestProgrammerContext,
33
33
  expression: AutoBeTest.INotEqualPredicate,
34
34
  ): ts.CallExpression =>
35
- ExpressionFactory.currying({
36
- function: ts.factory.createPropertyAccessExpression(
35
+ ts.factory.createCallExpression(
36
+ ts.factory.createPropertyAccessExpression(
37
37
  ts.factory.createIdentifier(
38
38
  ctx.importer.external({
39
39
  type: "instance",
@@ -43,7 +43,8 @@ export namespace AutoBeTestPredicateProgrammer {
43
43
  ),
44
44
  "error",
45
45
  ),
46
- arguments: [
46
+ undefined,
47
+ [
47
48
  ts.factory.createStringLiteral(expression.title),
48
49
  ts.factory.createArrowFunction(
49
50
  undefined,
@@ -59,14 +60,14 @@ export namespace AutoBeTestPredicateProgrammer {
59
60
  }),
60
61
  ),
61
62
  ],
62
- });
63
+ );
63
64
 
64
65
  export const conditionalPredicate = (
65
66
  ctx: IAutoBeTestProgrammerContext,
66
67
  expression: AutoBeTest.IConditionalPredicate,
67
68
  ): ts.CallExpression =>
68
- ExpressionFactory.currying({
69
- function: ts.factory.createPropertyAccessExpression(
69
+ ts.factory.createCallExpression(
70
+ ts.factory.createPropertyAccessExpression(
70
71
  ts.factory.createIdentifier(
71
72
  ctx.importer.external({
72
73
  type: "instance",
@@ -76,18 +77,19 @@ export namespace AutoBeTestPredicateProgrammer {
76
77
  ),
77
78
  "predicate",
78
79
  ),
79
- arguments: [
80
+ undefined,
81
+ [
80
82
  ts.factory.createStringLiteral(expression.title),
81
83
  writeTestExpression(ctx, expression.expression),
82
84
  ],
83
- });
85
+ );
84
86
 
85
87
  export const errorPredicate = (
86
88
  ctx: IAutoBeTestProgrammerContext,
87
89
  expression: AutoBeTest.IErrorPredicate,
88
90
  ): ts.CallExpression =>
89
- ExpressionFactory.currying({
90
- function: ts.factory.createPropertyAccessExpression(
91
+ ts.factory.createCallExpression(
92
+ ts.factory.createPropertyAccessExpression(
91
93
  ts.factory.createIdentifier(
92
94
  ctx.importer.external({
93
95
  type: "instance",
@@ -97,18 +99,19 @@ export namespace AutoBeTestPredicateProgrammer {
97
99
  ),
98
100
  "error",
99
101
  ),
100
- arguments: [
102
+ undefined,
103
+ [
101
104
  ts.factory.createStringLiteral(expression.title),
102
105
  writeTestExpression(ctx, expression.function),
103
106
  ],
104
- });
107
+ );
105
108
 
106
109
  // export const httpErrorPredicate = (
107
110
  // ctx: IAutoBeTestProgrammerContext,
108
111
  // expression: AutoBeTest.IHttpErrorPredicate,
109
112
  // ): ts.CallExpression =>
110
- // ExpressionFactory.currying({
111
- // function: ts.factory.createPropertyAccessExpression(
113
+ // ts.factory.createCallExpression(
114
+ // ts.factory.createPropertyAccessExpression(
112
115
  // ts.factory.createIdentifier(
113
116
  // ctx.importer.external({
114
117
  // type: "instance",
@@ -118,10 +121,11 @@ export namespace AutoBeTestPredicateProgrammer {
118
121
  // ),
119
122
  // "httpError",
120
123
  // ),
121
- // arguments: [
124
+ // undefined,
125
+ // [
122
126
  // ts.factory.createStringLiteral(expression.title),
123
127
  // ts.factory.createNumericLiteral(expression.status),
124
128
  // writeTestExpression(ctx, expression.function),
125
129
  // ],
126
- // });
130
+ // );
127
131
  }
@@ -1,6 +1,5 @@
1
1
  import { AutoBeTest } from "@autobe/interface";
2
2
  import ts from "typescript";
3
- import { ExpressionFactory } from "typia/lib/factories/ExpressionFactory";
4
3
 
5
4
  import { IAutoBeTestProgrammerContext } from "./IAutoBeTestProgrammerContext";
6
5
  import { writeTestExpression } from "./writeTestExpression";
@@ -29,8 +28,8 @@ export namespace AutoBeTestRandomProgrammer {
29
28
  ctx: IAutoBeTestProgrammerContext,
30
29
  expr: AutoBeTest.ISampleRandom,
31
30
  ): ts.CallExpression =>
32
- ExpressionFactory.currying({
33
- function: ts.factory.createPropertyAccessExpression(
31
+ ts.factory.createCallExpression(
32
+ ts.factory.createPropertyAccessExpression(
34
33
  ts.factory.createIdentifier(
35
34
  ctx.importer.external({
36
35
  type: "instance",
@@ -40,11 +39,12 @@ export namespace AutoBeTestRandomProgrammer {
40
39
  ),
41
40
  "sample",
42
41
  ),
43
- arguments: [
42
+ undefined,
43
+ [
44
44
  writeTestExpression(ctx, expr.array),
45
45
  writeTestExpression(ctx, expr.count),
46
46
  ],
47
- });
47
+ );
48
48
 
49
49
  export const booleanRandom = (
50
50
  _ctx: IAutoBeTestProgrammerContext,
@@ -244,22 +244,21 @@ export namespace AutoBeTestRandomProgrammer {
244
244
  export const keywordRandom = (
245
245
  ctx: IAutoBeTestProgrammerContext,
246
246
  expr: AutoBeTest.IKeywordRandom,
247
- ): ts.Expression => {
248
- let value: ts.Expression = ts.factory.createPropertyAccessExpression(
249
- ts.factory.createIdentifier(
250
- ctx.importer.external({
251
- type: "instance",
252
- library: "@nestia/e2e",
253
- name: "RandomGenerator",
254
- }),
247
+ ): ts.Expression =>
248
+ ts.factory.createCallExpression(
249
+ ts.factory.createPropertyAccessExpression(
250
+ ts.factory.createIdentifier(
251
+ ctx.importer.external({
252
+ type: "instance",
253
+ library: "@nestia/e2e",
254
+ name: "RandomGenerator",
255
+ }),
256
+ ),
257
+ expr.keyword,
255
258
  ),
256
- expr.keyword,
259
+ undefined,
260
+ undefined,
257
261
  );
258
- new Array(KEYWORD_CURRYING_COUNT[expr.keyword]).fill(0).forEach(() => {
259
- value = ts.factory.createCallExpression(value, undefined, undefined);
260
- });
261
- return value;
262
- };
263
262
  }
264
263
 
265
264
  const createTypiaTag = (
@@ -303,12 +302,3 @@ const createTypiaRandom = (
303
302
  : [ts.factory.createIntersectionTypeNode(typeArguments)],
304
303
  undefined,
305
304
  );
306
-
307
- const KEYWORD_CURRYING_COUNT = {
308
- alphabets: 1,
309
- alphaNumeric: 1,
310
- mobile: 1,
311
- name: 1,
312
- paragraph: 2,
313
- content: 3,
314
- };