@nestia/sdk 1.2.0-dev.20230504-4 → 1.2.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.
package/README.md
CHANGED
|
@@ -10,7 +10,10 @@
|
|
|
10
10
|
Nestia is a set of helper libraries for NestJS, supporting below features:
|
|
11
11
|
|
|
12
12
|
- `@nestia/core`: super-fast decorators
|
|
13
|
-
- `@nestia/sdk
|
|
13
|
+
- `@nestia/sdk`
|
|
14
|
+
- SDK generator for clients
|
|
15
|
+
- Swagger generator evolved than ever
|
|
16
|
+
- Automatic E2E test functions generator
|
|
14
17
|
- `nestia`: just CLI (command line interface) tool
|
|
15
18
|
|
|
16
19
|
> **Note**
|
|
@@ -50,6 +53,7 @@ Check out the document in the [website](https://nestia.io/docs/):
|
|
|
50
53
|
- [TypedBody](https://nestia.io/docs/core/TypedBody/)
|
|
51
54
|
- [TypedParam](https://nestia.io/docs/core/TypedParam/)
|
|
52
55
|
- [TypedQuery](https://nestia.io/docs/core/TypedRoute/)
|
|
53
|
-
-
|
|
56
|
+
- Generators
|
|
54
57
|
- [SDK Library](https://nestia.io/docs/sdk/sdk/)
|
|
55
|
-
- [Swagger Documents](https://nestia.io/docs/sdk/swagger/)
|
|
58
|
+
- [Swagger Documents](https://nestia.io/docs/sdk/swagger/)
|
|
59
|
+
- [E2E Functions](https://nestia.io/docs/sdk/e2e/)
|
|
@@ -77,23 +77,22 @@ var E2eFileProgrammer;
|
|
|
77
77
|
: `typia.random<${primitive(config)(param.type.name)}>()`;
|
|
78
78
|
return `${" ".repeat(4 * tab)}${middle},`;
|
|
79
79
|
};
|
|
80
|
-
const name = (route) => [
|
|
80
|
+
const name = (route) => postfix([
|
|
81
81
|
"test_api",
|
|
82
82
|
...route.path
|
|
83
83
|
.split("/")
|
|
84
84
|
.filter((str) => str.length && str[0] !== ":")
|
|
85
85
|
.map(normalize),
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const accessor = (route) => [
|
|
86
|
+
])(route.name).join("_");
|
|
87
|
+
const accessor = (route) => postfix([
|
|
89
88
|
"api.functional",
|
|
90
89
|
...route.path
|
|
91
90
|
.split("/")
|
|
92
91
|
.filter((str) => str.length && str[0] !== ":")
|
|
93
92
|
.map(normalize),
|
|
94
|
-
|
|
95
|
-
].join(".");
|
|
93
|
+
])(route.name).join(".");
|
|
96
94
|
const normalize = (str) => str.split("-").join("_").split(".").join("_");
|
|
95
|
+
const postfix = (array) => (name) => array.at(-1) === name ? array : [...array, name];
|
|
97
96
|
const primitive = (config) => (name) => config.primitive !== false ? `Primitive<${name}>` : name;
|
|
98
97
|
})(E2eFileProgrammer = exports.E2eFileProgrammer || (exports.E2eFileProgrammer = {}));
|
|
99
98
|
const UUID = `const uuid = (): string =>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"E2eFileProgrammer.js","sourceRoot":"","sources":["../../../src/generates/internal/E2eFileProgrammer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAIxB,mEAAgE;AAEhE,IAAiB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"E2eFileProgrammer.js","sourceRoot":"","sources":["../../../src/generates/internal/E2eFileProgrammer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAIxB,mEAAgE;AAEhE,IAAiB,iBAAiB,CA6GjC;AA7GD,WAAiB,iBAAiB;IACjB,0BAAQ,GACjB,CAAC,MAAqB,EAAE,EAAE,CAC1B,CAAC,KAAuC,EAAE,EAAE,CAC5C,CAAO,KAAa,EAAiB,EAAE;QACnC,MAAM,UAAU,GAAqB,IAAI,mCAAgB,EAAE,CAAC;QAC5D,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,OAAO;YAC7B,KAAK,MAAM,QAAQ,IAAI,KAAK,CAAC,CAAC,CAAC;gBAC3B,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE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AE,CAAC,CAAC,IAAY,EAAE,EAAE,CAClD,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,IAAI,CAAC,CAAC;IAErD,MAAM,SAAS,GACX,CAAC,MAAqB,EAAE,EAAE,CAC1B,CAAC,IAAY,EAAU,EAAE,CACrB,MAAM,CAAC,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,aAAa,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AACrE,CAAC,EA7GgB,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QA6GjC;AAED,MAAM,IAAI,GAAG;;;;;QAKL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestia/sdk",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Nestia SDK and Swagger generator",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"typescript": ">= 4.5.2"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@nestia/fetcher": "^1.
|
|
55
|
+
"@nestia/fetcher": "^1.2.0",
|
|
56
56
|
"@trivago/prettier-plugin-sort-imports": "^4.0.0",
|
|
57
57
|
"@types/cli": "^0.11.21",
|
|
58
58
|
"@types/express": "^4.17.15",
|
|
@@ -87,28 +87,29 @@ export namespace E2eFileProgrammer {
|
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
const name = (route: IRoute): string =>
|
|
90
|
-
[
|
|
90
|
+
postfix([
|
|
91
91
|
"test_api",
|
|
92
92
|
...route.path
|
|
93
93
|
.split("/")
|
|
94
94
|
.filter((str) => str.length && str[0] !== ":")
|
|
95
95
|
.map(normalize),
|
|
96
|
-
|
|
97
|
-
].join("_");
|
|
96
|
+
])(route.name).join("_");
|
|
98
97
|
|
|
99
98
|
const accessor = (route: IRoute): string =>
|
|
100
|
-
[
|
|
99
|
+
postfix([
|
|
101
100
|
"api.functional",
|
|
102
101
|
...route.path
|
|
103
102
|
.split("/")
|
|
104
103
|
.filter((str) => str.length && str[0] !== ":")
|
|
105
104
|
.map(normalize),
|
|
106
|
-
|
|
107
|
-
].join(".");
|
|
105
|
+
])(route.name).join(".");
|
|
108
106
|
|
|
109
107
|
const normalize = (str: string) =>
|
|
110
108
|
str.split("-").join("_").split(".").join("_");
|
|
111
109
|
|
|
110
|
+
const postfix = (array: string[]) => (name: string) =>
|
|
111
|
+
array.at(-1) === name ? array : [...array, name];
|
|
112
|
+
|
|
112
113
|
const primitive =
|
|
113
114
|
(config: INestiaConfig) =>
|
|
114
115
|
(name: string): string =>
|