-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.js
More file actions
76 lines (72 loc) · 1.72 KB
/
debug.js
File metadata and controls
76 lines (72 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
const pluginLoader = require("./src");
const validatorPluginConfig = {
namespace: "Validator",
methods: {
IsEmail: {
targets: {
field: true,
block: false
},
parameters: {}
},
Min: {
targets: {
field: true,
block: false
},
parameters: {
_: {
type: "number",
required: true
},
message: {
type: "string",
required: false
}
}
}
}
}
const foxPluginConfig = {
namespace: "Fox",
methods: {
Test: {
targets: {
field: true,
block: false
},
parameters: {
_: {
type: "number",
required: false
},
arg: {
type: "string[]",
required: false
}
}
}
}
}
// Parameters can be: string, number, boolean or array (or any)
const TypeGraphQLConfig = {
namespace: "TypeGraphQL",
methods: {
debug: {
targets: {
field: true,
block: false
},
parameters: {}
}
}
}
const parser = pluginLoader([TypeGraphQLConfig, validatorPluginConfig, foxPluginConfig]);
// console.log(JSON.stringify(parser.run(`jamon serrano`), null, 2));
// console.log(JSON.stringify(parser.run(`@TypeGraphQL.debug`), null, 2));
// console.log(JSON.stringify(parser.run(`@Validator.Min(30, message: "Password must be atleast 30 characters long")`), null, 2));
// console.log(JSON.stringify(parser.run(`this is a documentation comment`), null, 2));
// console.log(JSON.stringify(parser.run(`@Fox.Test(55, key: false)`), null, 2));
// console.log(JSON.stringify(parser.run(`@Fox.Test(arg: "hello")`), null, 2));
// const out = parser.run(`@Validator.IsEmail`);
// console.log(out);