@goast/typescript 0.6.2 → 0.7.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.
- package/assets/stubs/easy-network-stub/easy-network-stub.utils.ts +6 -8
- package/esm/src/generators/services/easy-network-stub/easy-network-stub-generator.d.ts +3 -0
- package/esm/src/generators/services/easy-network-stub/easy-network-stub-generator.d.ts.map +1 -1
- package/esm/src/generators/services/easy-network-stub/easy-network-stub-generator.js +28 -1
- package/esm/src/generators/services/easy-network-stub/refs.d.ts +1 -0
- package/esm/src/generators/services/easy-network-stub/refs.d.ts.map +1 -1
- package/esm/src/generators/services/easy-network-stub/refs.js +1 -0
- package/package.json +1 -1
- package/script/src/generators/services/easy-network-stub/easy-network-stub-generator.d.ts +3 -0
- package/script/src/generators/services/easy-network-stub/easy-network-stub-generator.d.ts.map +1 -1
- package/script/src/generators/services/easy-network-stub/easy-network-stub-generator.js +28 -1
- package/script/src/generators/services/easy-network-stub/refs.d.ts +1 -0
- package/script/src/generators/services/easy-network-stub/refs.d.ts.map +1 -1
- package/script/src/generators/services/easy-network-stub/refs.js +1 -0
- package/src/src/generators/services/easy-network-stub/easy-network-stub-generator.ts +40 -1
- package/src/src/generators/services/easy-network-stub/refs.ts +2 -0
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type { EasyNetworkStub } from 'easy-network-stub';
|
|
2
|
-
|
|
3
|
-
import type { ErrorResponse, HttpMethod, RouteResponseCallback } from 'easy-network-stub';
|
|
1
|
+
import type { EasyNetworkStub, ErrorResponse, HttpMethod, RouteResponseCallback, StubHandle } from 'easy-network-stub';
|
|
4
2
|
|
|
5
3
|
/**
|
|
6
4
|
* Options for the `EasyNetworkStubWrapper`.
|
|
@@ -130,8 +128,8 @@ export class EasyNetworkStubWrapper {
|
|
|
130
128
|
method: HttpMethod,
|
|
131
129
|
route: Route,
|
|
132
130
|
response: RouteResponseCallback<Route, unknown>,
|
|
133
|
-
):
|
|
134
|
-
this.wrappedStub.stub<Route>(method, route, async (request) => {
|
|
131
|
+
): StubHandle {
|
|
132
|
+
return this.wrappedStub.stub<Route>(method, route, async (request) => {
|
|
135
133
|
if (this.options.delay > 0) await sleep(this.options.delay);
|
|
136
134
|
return await this.runRequest(method, route, response, request);
|
|
137
135
|
});
|
|
@@ -154,9 +152,9 @@ export class EasyNetworkStubWrapper {
|
|
|
154
152
|
method: HttpMethod,
|
|
155
153
|
route: Route,
|
|
156
154
|
response: RouteResponseCallback<Route, T>,
|
|
157
|
-
) =>
|
|
155
|
+
) => StubHandle {
|
|
158
156
|
return <Route extends string>(method: HttpMethod, route: Route, response: RouteResponseCallback<Route, T>) => {
|
|
159
|
-
this.wrappedStub.stub2<T>()<Route>(method, route, async (request) => {
|
|
157
|
+
return this.wrappedStub.stub2<T>()<Route>(method, route, async (request) => {
|
|
160
158
|
if (this.options.delay > 0) await sleep(this.options.delay);
|
|
161
159
|
return await this.runRequest(method, route, response, request);
|
|
162
160
|
});
|
|
@@ -168,7 +166,7 @@ export class EasyNetworkStubWrapper {
|
|
|
168
166
|
*/
|
|
169
167
|
public reset(): void {
|
|
170
168
|
this._requests = [];
|
|
171
|
-
this.wrappedStub
|
|
169
|
+
this.wrappedStub.reset();
|
|
172
170
|
}
|
|
173
171
|
|
|
174
172
|
private async runRequest<Route extends string, T>(
|
|
@@ -23,8 +23,11 @@ export declare class DefaultTypeScriptEasyNetworkStubGenerator extends TypeScrip
|
|
|
23
23
|
protected getStubClassName(ctx: Context): string;
|
|
24
24
|
protected getEndpointPathPropertyName(ctx: Context, endpoint: ApiEndpoint): string;
|
|
25
25
|
protected getEndpointRequestsFieldName(ctx: Context, endpoint: ApiEndpoint): string;
|
|
26
|
+
protected getEndpointStubHandleFieldName(ctx: Context, endpoint: ApiEndpoint): string;
|
|
26
27
|
protected getEndpointRequestsPropertyName(ctx: Context, endpoint: ApiEndpoint): string;
|
|
27
28
|
protected getEndpointStubMethodName(ctx: Context, endpoint: ApiEndpoint): string;
|
|
29
|
+
protected getEndpointUnregisterMethodName(ctx: Context, endpoint: ApiEndpoint): string;
|
|
30
|
+
protected getEndpointUnregisterMethod(ctx: Context, endpoint: ApiEndpoint): ts.Method<Builder>;
|
|
28
31
|
protected getStubRoute(ctx: Context, endpoint: ApiEndpoint): string;
|
|
29
32
|
protected getEndpointStatusCodes(ctx: Context, endpoint: ApiEndpoint): Record<number, ts.Type<Builder>>;
|
|
30
33
|
protected getSchemaType(ctx: Context, schema: ApiSchema | undefined, fallback?: ts.Type<Builder>): ts.Type<Builder>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"easy-network-stub-generator.d.ts","sourceRoot":"","sources":["../../../../../src/src/generators/services/easy-network-stub/easy-network-stub-generator.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,gBAAgB,EAIrB,KAAK,YAAY,EAElB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,yCAAyC,EAAE,wCAAwC,EAAE,MAAM,aAAa,CAAC;AAEvH,KAAK,OAAO,GAAG,yCAAyC,CAAC;AACzD,KAAK,MAAM,GAAG,wCAAwC,CAAC;AACvD,KAAK,OAAO,GAAG,qBAAqB,CAAC;AAErC,MAAM,WAAW,kCAAkC,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IACjF,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;CAC/C;AAED,qBAAa,yCAA0C,SAAQ,uBAAuB,CAAC,OAAO,EAAE,MAAM,CACpG,YAAW,kCAAkC;IACtC,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC;IAwBnD,SAAS,CAAC,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC;IAOrE,SAAS,CAAC,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;IAgBzF,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"easy-network-stub-generator.d.ts","sourceRoot":"","sources":["../../../../../src/src/generators/services/easy-network-stub/easy-network-stub-generator.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,gBAAgB,EAIrB,KAAK,YAAY,EAElB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,yCAAyC,EAAE,wCAAwC,EAAE,MAAM,aAAa,CAAC;AAEvH,KAAK,OAAO,GAAG,yCAAyC,CAAC;AACzD,KAAK,MAAM,GAAG,wCAAwC,CAAC;AACvD,KAAK,OAAO,GAAG,qBAAqB,CAAC;AAErC,MAAM,WAAW,kCAAkC,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IACjF,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;CAC/C;AAED,qBAAa,yCAA0C,SAAQ,uBAAuB,CAAC,OAAO,EAAE,MAAM,CACpG,YAAW,kCAAkC;IACtC,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC;IAwBnD,SAAS,CAAC,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,CAAC,OAAO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E,OAAO,EAAE,QAAQ,EAAE,WAAW,GAAG,MAAM;IAItF,SAAS,CAAC,2BAA2B,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC;IAc9F,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,GAAG,MAAM;IAyBnE,SAAS,CAAC,sBAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAYvG,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,GAAG,SAAS,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;CAKpH"}
|
|
@@ -55,6 +55,11 @@ export class DefaultTypeScriptEasyNetworkStubGenerator extends TypeScriptFileGen
|
|
|
55
55
|
value: ts.tuple([]),
|
|
56
56
|
})),
|
|
57
57
|
'\n',
|
|
58
|
+
...ctx.service.endpoints.map((endpoint) => ts.property(this.getEndpointStubHandleFieldName(ctx, endpoint), {
|
|
59
|
+
accessModifier: 'private',
|
|
60
|
+
type: s `${ctx.refs.stubHandle()} | undefined`,
|
|
61
|
+
})),
|
|
62
|
+
'\n',
|
|
58
63
|
...ctx.service.endpoints.map((endpoint) => ts.property(this.getEndpointRequestsPropertyName(ctx, endpoint), {
|
|
59
64
|
readonly: true,
|
|
60
65
|
accessModifier: 'public',
|
|
@@ -64,11 +69,13 @@ export class DefaultTypeScriptEasyNetworkStubGenerator extends TypeScriptFileGen
|
|
|
64
69
|
}),
|
|
65
70
|
})),
|
|
66
71
|
...ctx.service.endpoints.map((endpoint) => this.getEndpointStubMethod(ctx, endpoint)),
|
|
72
|
+
...ctx.service.endpoints.map((endpoint) => this.getEndpointUnregisterMethod(ctx, endpoint)),
|
|
67
73
|
ts.method('reset', {
|
|
68
74
|
accessModifier: 'public',
|
|
69
75
|
override: true,
|
|
70
76
|
returnType: ts.refs.void_(),
|
|
71
77
|
body: appendValueGroup([
|
|
78
|
+
...ctx.service.endpoints.map((endpoint) => `this.${this.getEndpointStubHandleFieldName(ctx, endpoint)} = undefined;`),
|
|
72
79
|
...ctx.service.endpoints.map((endpoint) => `this.${this.getEndpointRequestsFieldName(ctx, endpoint)}.length = 0;`),
|
|
73
80
|
'super.reset();',
|
|
74
81
|
], '\n'),
|
|
@@ -99,7 +106,11 @@ export class DefaultTypeScriptEasyNetworkStubGenerator extends TypeScriptFileGen
|
|
|
99
106
|
],
|
|
100
107
|
returnType: 'this',
|
|
101
108
|
body: appendValueGroup([
|
|
102
|
-
s `this.
|
|
109
|
+
s `if (this.${this.getEndpointStubHandleFieldName(ctx, endpoint)}) {${s.indent `
|
|
110
|
+
throw new Error('${this.getEndpointStubMethodName(ctx, endpoint)} has already been called. Call ${this.getEndpointUnregisterMethodName(ctx, endpoint)}() or reset() before stubbing again.');`}
|
|
111
|
+
}`,
|
|
112
|
+
s `this.${this.getEndpointStubHandleFieldName(ctx, endpoint)} = this.stubWrapper.stub2<${requestType}>()(${s
|
|
113
|
+
.indent `
|
|
103
114
|
${ts.string(endpoint.method.toUpperCase())},
|
|
104
115
|
${this.getStubClassName(ctx)}.${this.getEndpointPathPropertyName(ctx, endpoint)},
|
|
105
116
|
async (request) => {${s.indent `
|
|
@@ -129,12 +140,28 @@ export class DefaultTypeScriptEasyNetworkStubGenerator extends TypeScriptFileGen
|
|
|
129
140
|
getEndpointRequestsFieldName(ctx, endpoint) {
|
|
130
141
|
return toCasing(endpoint.name + '_Requests', adjustCasing(ctx.config.propertyNameCasing, { prefix: '_' }));
|
|
131
142
|
}
|
|
143
|
+
getEndpointStubHandleFieldName(ctx, endpoint) {
|
|
144
|
+
return toCasing('stub_' + endpoint.name + '_Handle', adjustCasing(ctx.config.propertyNameCasing, { prefix: '_' }));
|
|
145
|
+
}
|
|
132
146
|
getEndpointRequestsPropertyName(ctx, endpoint) {
|
|
133
147
|
return toCasing(endpoint.name + '_Requests', ctx.config.propertyNameCasing);
|
|
134
148
|
}
|
|
135
149
|
getEndpointStubMethodName(ctx, endpoint) {
|
|
136
150
|
return toCasing('stub_' + endpoint.name, ctx.config.functionNameCasing);
|
|
137
151
|
}
|
|
152
|
+
getEndpointUnregisterMethodName(ctx, endpoint) {
|
|
153
|
+
return toCasing('unregister_stub_' + endpoint.name, ctx.config.functionNameCasing);
|
|
154
|
+
}
|
|
155
|
+
getEndpointUnregisterMethod(ctx, endpoint) {
|
|
156
|
+
return ts.method(this.getEndpointUnregisterMethodName(ctx, endpoint), {
|
|
157
|
+
accessModifier: 'public',
|
|
158
|
+
returnType: ts.refs.void_(),
|
|
159
|
+
body: appendValueGroup([
|
|
160
|
+
`this.${this.getEndpointStubHandleFieldName(ctx, endpoint)}?.unregister();`,
|
|
161
|
+
`this.${this.getEndpointStubHandleFieldName(ctx, endpoint)} = undefined;`,
|
|
162
|
+
], '\n'),
|
|
163
|
+
});
|
|
164
|
+
}
|
|
138
165
|
getStubRoute(ctx, endpoint) {
|
|
139
166
|
var _a, _b;
|
|
140
167
|
let path = endpoint.path;
|
|
@@ -10,5 +10,6 @@ export declare function getReferenceFactories(options: TypeScriptEasyNetworkStub
|
|
|
10
10
|
easyNetworkStubBase: ts.ModuleReferenceFactory;
|
|
11
11
|
easyNetworkStubGroup: ts.GenericModuleReferenceFactory<2>;
|
|
12
12
|
createEasyNetworkStubGroup: ts.GenericModuleReferenceFactory<2>;
|
|
13
|
+
stubHandle: ts.ModuleReferenceFactory;
|
|
13
14
|
};
|
|
14
15
|
//# sourceMappingURL=refs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../../../../../src/src/generators/services/easy-network-stub/refs.ts"],"names":[],"mappings":"A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AAsB,EAAE,EAAE,CAAC,sBAAsB,CAAC;IAClD,mBAAmB,EAAE,EAAE,CAAC,sBAAsB,CAAC;IAC/C,oBAAoB,EAAE,EAAE,CAAC,6BAA6B,CAAC,CAAC,CAAC,CAAC;IAC1D,0BAA0B,EAAE,EAAE,CAAC,6BAA6B,CAAC,CAAC,CAAC,CAAC;IAChE,UAAU,EAAE,EAAE,CAAC,sBAAsB,CAAC;CACvC,CA6BA"}
|
|
@@ -23,5 +23,6 @@ export function getReferenceFactories(options) {
|
|
|
23
23
|
importType: 'type-import',
|
|
24
24
|
}),
|
|
25
25
|
createEasyNetworkStubGroup: ts.reference.genericFactory('createEasyNetworkStubGroup', easyNetworkStubUtilsPath),
|
|
26
|
+
stubHandle: ts.reference.factory('StubHandle', 'easy-network-stub', { importType: 'type-import' }),
|
|
26
27
|
};
|
|
27
28
|
}
|
package/package.json
CHANGED
|
@@ -23,8 +23,11 @@ export declare class DefaultTypeScriptEasyNetworkStubGenerator extends TypeScrip
|
|
|
23
23
|
protected getStubClassName(ctx: Context): string;
|
|
24
24
|
protected getEndpointPathPropertyName(ctx: Context, endpoint: ApiEndpoint): string;
|
|
25
25
|
protected getEndpointRequestsFieldName(ctx: Context, endpoint: ApiEndpoint): string;
|
|
26
|
+
protected getEndpointStubHandleFieldName(ctx: Context, endpoint: ApiEndpoint): string;
|
|
26
27
|
protected getEndpointRequestsPropertyName(ctx: Context, endpoint: ApiEndpoint): string;
|
|
27
28
|
protected getEndpointStubMethodName(ctx: Context, endpoint: ApiEndpoint): string;
|
|
29
|
+
protected getEndpointUnregisterMethodName(ctx: Context, endpoint: ApiEndpoint): string;
|
|
30
|
+
protected getEndpointUnregisterMethod(ctx: Context, endpoint: ApiEndpoint): ts.Method<Builder>;
|
|
28
31
|
protected getStubRoute(ctx: Context, endpoint: ApiEndpoint): string;
|
|
29
32
|
protected getEndpointStatusCodes(ctx: Context, endpoint: ApiEndpoint): Record<number, ts.Type<Builder>>;
|
|
30
33
|
protected getSchemaType(ctx: Context, schema: ApiSchema | undefined, fallback?: ts.Type<Builder>): ts.Type<Builder>;
|
package/script/src/generators/services/easy-network-stub/easy-network-stub-generator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"easy-network-stub-generator.d.ts","sourceRoot":"","sources":["../../../../../src/src/generators/services/easy-network-stub/easy-network-stub-generator.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,gBAAgB,EAIrB,KAAK,YAAY,EAElB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,yCAAyC,EAAE,wCAAwC,EAAE,MAAM,aAAa,CAAC;AAEvH,KAAK,OAAO,GAAG,yCAAyC,CAAC;AACzD,KAAK,MAAM,GAAG,wCAAwC,CAAC;AACvD,KAAK,OAAO,GAAG,qBAAqB,CAAC;AAErC,MAAM,WAAW,kCAAkC,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IACjF,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;CAC/C;AAED,qBAAa,yCAA0C,SAAQ,uBAAuB,CAAC,OAAO,EAAE,MAAM,CACpG,YAAW,kCAAkC;IACtC,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC;IAwBnD,SAAS,CAAC,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC;IAOrE,SAAS,CAAC,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;IAgBzF,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"easy-network-stub-generator.d.ts","sourceRoot":"","sources":["../../../../../src/src/generators/services/easy-network-stub/easy-network-stub-generator.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,gBAAgB,EAIrB,KAAK,YAAY,EAElB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,yCAAyC,EAAE,wCAAwC,EAAE,MAAM,aAAa,CAAC;AAEvH,KAAK,OAAO,GAAG,yCAAyC,CAAC;AACzD,KAAK,MAAM,GAAG,wCAAwC,CAAC;AACvD,KAAK,OAAO,GAAG,qBAAqB,CAAC;AAErC,MAAM,WAAW,kCAAkC,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM;IACjF,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;CAC/C;AAED,qBAAa,yCAA0C,SAAQ,uBAAuB,CAAC,OAAO,EAAE,MAAM,CACpG,YAAW,kCAAkC;IACtC,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,CAAC,MAAM,CAAC;IAwBnD,SAAS,CAAC,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,CAAC,OAAO,CAAC;IAOrE,SAAS,CAAC,oBAAoB,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;IAgBzF,SAAS,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC;I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AQ,EAAE,WAAW,GAAG,MAAM;IAyBnE,SAAS,CAAC,sBAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAYvG,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,GAAG,SAAS,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;CAKpH"}
|
|
@@ -58,6 +58,11 @@ class DefaultTypeScriptEasyNetworkStubGenerator extends file_generator_js_1.Type
|
|
|
58
58
|
value: index_js_1.ts.tuple([]),
|
|
59
59
|
})),
|
|
60
60
|
'\n',
|
|
61
|
+
...ctx.service.endpoints.map((endpoint) => index_js_1.ts.property(this.getEndpointStubHandleFieldName(ctx, endpoint), {
|
|
62
|
+
accessModifier: 'private',
|
|
63
|
+
type: (0, core_1.builderTemplate) `${ctx.refs.stubHandle()} | undefined`,
|
|
64
|
+
})),
|
|
65
|
+
'\n',
|
|
61
66
|
...ctx.service.endpoints.map((endpoint) => index_js_1.ts.property(this.getEndpointRequestsPropertyName(ctx, endpoint), {
|
|
62
67
|
readonly: true,
|
|
63
68
|
accessModifier: 'public',
|
|
@@ -67,11 +72,13 @@ class DefaultTypeScriptEasyNetworkStubGenerator extends file_generator_js_1.Type
|
|
|
67
72
|
}),
|
|
68
73
|
})),
|
|
69
74
|
...ctx.service.endpoints.map((endpoint) => this.getEndpointStubMethod(ctx, endpoint)),
|
|
75
|
+
...ctx.service.endpoints.map((endpoint) => this.getEndpointUnregisterMethod(ctx, endpoint)),
|
|
70
76
|
index_js_1.ts.method('reset', {
|
|
71
77
|
accessModifier: 'public',
|
|
72
78
|
override: true,
|
|
73
79
|
returnType: index_js_1.ts.refs.void_(),
|
|
74
80
|
body: (0, core_1.appendValueGroup)([
|
|
81
|
+
...ctx.service.endpoints.map((endpoint) => `this.${this.getEndpointStubHandleFieldName(ctx, endpoint)} = undefined;`),
|
|
75
82
|
...ctx.service.endpoints.map((endpoint) => `this.${this.getEndpointRequestsFieldName(ctx, endpoint)}.length = 0;`),
|
|
76
83
|
'super.reset();',
|
|
77
84
|
], '\n'),
|
|
@@ -102,7 +109,11 @@ class DefaultTypeScriptEasyNetworkStubGenerator extends file_generator_js_1.Type
|
|
|
102
109
|
],
|
|
103
110
|
returnType: 'this',
|
|
104
111
|
body: (0, core_1.appendValueGroup)([
|
|
105
|
-
(0, core_1.builderTemplate) `this.
|
|
112
|
+
(0, core_1.builderTemplate) `if (this.${this.getEndpointStubHandleFieldName(ctx, endpoint)}) {${core_1.builderTemplate.indent `
|
|
113
|
+
throw new Error('${this.getEndpointStubMethodName(ctx, endpoint)} has already been called. Call ${this.getEndpointUnregisterMethodName(ctx, endpoint)}() or reset() before stubbing again.');`}
|
|
114
|
+
}`,
|
|
115
|
+
(0, core_1.builderTemplate) `this.${this.getEndpointStubHandleFieldName(ctx, endpoint)} = this.stubWrapper.stub2<${requestType}>()(${core_1.builderTemplate
|
|
116
|
+
.indent `
|
|
106
117
|
${index_js_1.ts.string(endpoint.method.toUpperCase())},
|
|
107
118
|
${this.getStubClassName(ctx)}.${this.getEndpointPathPropertyName(ctx, endpoint)},
|
|
108
119
|
async (request) => {${core_1.builderTemplate.indent `
|
|
@@ -132,12 +143,28 @@ class DefaultTypeScriptEasyNetworkStubGenerator extends file_generator_js_1.Type
|
|
|
132
143
|
getEndpointRequestsFieldName(ctx, endpoint) {
|
|
133
144
|
return (0, core_1.toCasing)(endpoint.name + '_Requests', (0, core_1.adjustCasing)(ctx.config.propertyNameCasing, { prefix: '_' }));
|
|
134
145
|
}
|
|
146
|
+
getEndpointStubHandleFieldName(ctx, endpoint) {
|
|
147
|
+
return (0, core_1.toCasing)('stub_' + endpoint.name + '_Handle', (0, core_1.adjustCasing)(ctx.config.propertyNameCasing, { prefix: '_' }));
|
|
148
|
+
}
|
|
135
149
|
getEndpointRequestsPropertyName(ctx, endpoint) {
|
|
136
150
|
return (0, core_1.toCasing)(endpoint.name + '_Requests', ctx.config.propertyNameCasing);
|
|
137
151
|
}
|
|
138
152
|
getEndpointStubMethodName(ctx, endpoint) {
|
|
139
153
|
return (0, core_1.toCasing)('stub_' + endpoint.name, ctx.config.functionNameCasing);
|
|
140
154
|
}
|
|
155
|
+
getEndpointUnregisterMethodName(ctx, endpoint) {
|
|
156
|
+
return (0, core_1.toCasing)('unregister_stub_' + endpoint.name, ctx.config.functionNameCasing);
|
|
157
|
+
}
|
|
158
|
+
getEndpointUnregisterMethod(ctx, endpoint) {
|
|
159
|
+
return index_js_1.ts.method(this.getEndpointUnregisterMethodName(ctx, endpoint), {
|
|
160
|
+
accessModifier: 'public',
|
|
161
|
+
returnType: index_js_1.ts.refs.void_(),
|
|
162
|
+
body: (0, core_1.appendValueGroup)([
|
|
163
|
+
`this.${this.getEndpointStubHandleFieldName(ctx, endpoint)}?.unregister();`,
|
|
164
|
+
`this.${this.getEndpointStubHandleFieldName(ctx, endpoint)} = undefined;`,
|
|
165
|
+
], '\n'),
|
|
166
|
+
});
|
|
167
|
+
}
|
|
141
168
|
getStubRoute(ctx, endpoint) {
|
|
142
169
|
var _a, _b;
|
|
143
170
|
let path = endpoint.path;
|
|
@@ -10,5 +10,6 @@ export declare function getReferenceFactories(options: TypeScriptEasyNetworkStub
|
|
|
10
10
|
easyNetworkStubBase: ts.ModuleReferenceFactory;
|
|
11
11
|
easyNetworkStubGroup: ts.GenericModuleReferenceFactory<2>;
|
|
12
12
|
createEasyNetworkStubGroup: ts.GenericModuleReferenceFactory<2>;
|
|
13
|
+
stubHandle: ts.ModuleReferenceFactory;
|
|
13
14
|
};
|
|
14
15
|
//# sourceMappingURL=refs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../../../../../src/src/generators/services/easy-network-stub/refs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAC3C,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,aAAa,CAAC;AAG7E,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,yCAAyC,GAAG;IACzF,6BAA6B,EAAE,EAAE,CAAC,sBAAsB,CAAC;IACzD,eAAe,EAAE,EAAE,CAAC,sBAAsB,CAAC;IAC3C,eAAe,EAAE,EAAE,CAAC,6BAA6B,CAAC,CAAC,CAAC,CAAC;IACrD,2BAA2B,EAAE,EAAE,CAAC,6BAA6B,CAAC,CAAC,CAAC,CAAC;IACjE,gBAAgB,EAAE,EAAE,CAAC,6BAA6B,CAAC,CAAC,CAAC,CAAC;IACtD,sBAAsB,EAAE,EAAE,CAAC,sBAAsB,CAAC;IAClD,mBAAmB,EAAE,EAAE,CAAC,sBAAsB,CAAC;IAC/C,oBAAoB,EAAE,EAAE,CAAC,6BAA6B,CAAC,CAAC,CAAC,CAAC;IAC1D,0BAA0B,EAAE,EAAE,CAAC,6BAA6B,CAAC,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../../../../../src/src/generators/services/easy-network-stub/refs.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,uBAAuB,CAAC;AAC3C,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,aAAa,CAAC;AAG7E,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,yCAAyC,GAAG;IACzF,6BAA6B,EAAE,EAAE,CAAC,sBAAsB,CAAC;IACzD,eAAe,EAAE,EAAE,CAAC,sBAAsB,CAAC;IAC3C,eAAe,EAAE,EAAE,CAAC,6BAA6B,CAAC,CAAC,CAAC,CAAC;IACrD,2BAA2B,EAAE,EAAE,CAAC,6BAA6B,CAAC,CAAC,CAAC,CAAC;IACjE,gBAAgB,EAAE,EAAE,CAAC,6BAA6B,CAAC,CAAC,CAAC,CAAC;IACtD,sBAAsB,EAAE,EAAE,CAAC,sBAAsB,CAAC;IAClD,mBAAmB,EAAE,EAAE,CAAC,sBAAsB,CAAC;IAC/C,oBAAoB,EAAE,EAAE,CAAC,6BAA6B,CAAC,CAAC,CAAC,CAAC;IAC1D,0BAA0B,EAAE,EAAE,CAAC,6BAA6B,CAAC,CAAC,CAAC,CAAC;IAChE,UAAU,EAAE,EAAE,CAAC,sBAAsB,CAAC;CACvC,CA6BA"}
|
|
@@ -26,5 +26,6 @@ function getReferenceFactories(options) {
|
|
|
26
26
|
importType: 'type-import',
|
|
27
27
|
}),
|
|
28
28
|
createEasyNetworkStubGroup: index_js_1.ts.reference.genericFactory('createEasyNetworkStubGroup', easyNetworkStubUtilsPath),
|
|
29
|
+
stubHandle: index_js_1.ts.reference.factory('StubHandle', 'easy-network-stub', { importType: 'type-import' }),
|
|
29
30
|
};
|
|
30
31
|
}
|
|
@@ -97,6 +97,13 @@ export class DefaultTypeScriptEasyNetworkStubGenerator extends TypeScriptFileGen
|
|
|
97
97
|
})
|
|
98
98
|
),
|
|
99
99
|
'\n',
|
|
100
|
+
...ctx.service.endpoints.map((endpoint) =>
|
|
101
|
+
ts.property<Builder>(this.getEndpointStubHandleFieldName(ctx, endpoint), {
|
|
102
|
+
accessModifier: 'private',
|
|
103
|
+
type: s`${ctx.refs.stubHandle()} | undefined`,
|
|
104
|
+
})
|
|
105
|
+
),
|
|
106
|
+
'\n',
|
|
100
107
|
...ctx.service.endpoints.map((endpoint) =>
|
|
101
108
|
ts.property<Builder>(this.getEndpointRequestsPropertyName(ctx, endpoint), {
|
|
102
109
|
readonly: true,
|
|
@@ -108,12 +115,16 @@ export class DefaultTypeScriptEasyNetworkStubGenerator extends TypeScriptFileGen
|
|
|
108
115
|
})
|
|
109
116
|
),
|
|
110
117
|
...ctx.service.endpoints.map((endpoint) => this.getEndpointStubMethod(ctx, endpoint)),
|
|
118
|
+
...ctx.service.endpoints.map((endpoint) => this.getEndpointUnregisterMethod(ctx, endpoint)),
|
|
111
119
|
ts.method('reset', {
|
|
112
120
|
accessModifier: 'public',
|
|
113
121
|
override: true,
|
|
114
122
|
returnType: ts.refs.void_(),
|
|
115
123
|
body: appendValueGroup(
|
|
116
124
|
[
|
|
125
|
+
...ctx.service.endpoints.map((endpoint) =>
|
|
126
|
+
`this.${this.getEndpointStubHandleFieldName(ctx, endpoint)} = undefined;`
|
|
127
|
+
),
|
|
117
128
|
...ctx.service.endpoints.map((endpoint) =>
|
|
118
129
|
`this.${this.getEndpointRequestsFieldName(ctx, endpoint)}.length = 0;`
|
|
119
130
|
),
|
|
@@ -156,7 +167,13 @@ export class DefaultTypeScriptEasyNetworkStubGenerator extends TypeScriptFileGen
|
|
|
156
167
|
returnType: 'this',
|
|
157
168
|
body: appendValueGroup(
|
|
158
169
|
[
|
|
159
|
-
s`this.
|
|
170
|
+
s`if (this.${this.getEndpointStubHandleFieldName(ctx, endpoint)}) {${s.indent`
|
|
171
|
+
throw new Error('${this.getEndpointStubMethodName(ctx, endpoint)} has already been called. Call ${
|
|
172
|
+
this.getEndpointUnregisterMethodName(ctx, endpoint)
|
|
173
|
+
}() or reset() before stubbing again.');`}
|
|
174
|
+
}`,
|
|
175
|
+
s`this.${this.getEndpointStubHandleFieldName(ctx, endpoint)} = this.stubWrapper.stub2<${requestType}>()(${s
|
|
176
|
+
.indent`
|
|
160
177
|
${ts.string(endpoint.method.toUpperCase())},
|
|
161
178
|
${this.getStubClassName(ctx)}.${this.getEndpointPathPropertyName(ctx, endpoint)},
|
|
162
179
|
async (request) => {${s.indent`
|
|
@@ -197,6 +214,10 @@ export class DefaultTypeScriptEasyNetworkStubGenerator extends TypeScriptFileGen
|
|
|
197
214
|
return toCasing(endpoint.name + '_Requests', adjustCasing(ctx.config.propertyNameCasing, { prefix: '_' }));
|
|
198
215
|
}
|
|
199
216
|
|
|
217
|
+
protected getEndpointStubHandleFieldName(ctx: Context, endpoint: ApiEndpoint): string {
|
|
218
|
+
return toCasing('stub_' + endpoint.name + '_Handle', adjustCasing(ctx.config.propertyNameCasing, { prefix: '_' }));
|
|
219
|
+
}
|
|
220
|
+
|
|
200
221
|
protected getEndpointRequestsPropertyName(ctx: Context, endpoint: ApiEndpoint): string {
|
|
201
222
|
return toCasing(endpoint.name + '_Requests', ctx.config.propertyNameCasing);
|
|
202
223
|
}
|
|
@@ -205,6 +226,24 @@ export class DefaultTypeScriptEasyNetworkStubGenerator extends TypeScriptFileGen
|
|
|
205
226
|
return toCasing('stub_' + endpoint.name, ctx.config.functionNameCasing);
|
|
206
227
|
}
|
|
207
228
|
|
|
229
|
+
protected getEndpointUnregisterMethodName(ctx: Context, endpoint: ApiEndpoint): string {
|
|
230
|
+
return toCasing('unregister_stub_' + endpoint.name, ctx.config.functionNameCasing);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
protected getEndpointUnregisterMethod(ctx: Context, endpoint: ApiEndpoint): ts.Method<Builder> {
|
|
234
|
+
return ts.method(this.getEndpointUnregisterMethodName(ctx, endpoint), {
|
|
235
|
+
accessModifier: 'public',
|
|
236
|
+
returnType: ts.refs.void_(),
|
|
237
|
+
body: appendValueGroup(
|
|
238
|
+
[
|
|
239
|
+
`this.${this.getEndpointStubHandleFieldName(ctx, endpoint)}?.unregister();`,
|
|
240
|
+
`this.${this.getEndpointStubHandleFieldName(ctx, endpoint)} = undefined;`,
|
|
241
|
+
],
|
|
242
|
+
'\n',
|
|
243
|
+
),
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
|
|
208
247
|
protected getStubRoute(ctx: Context, endpoint: ApiEndpoint): string {
|
|
209
248
|
let path = endpoint.path;
|
|
210
249
|
let isFirstQueryParam = true;
|
|
@@ -14,6 +14,7 @@ export function getReferenceFactories(options: TypeScriptEasyNetworkStubsGenerat
|
|
|
14
14
|
easyNetworkStubBase: ts.ModuleReferenceFactory;
|
|
15
15
|
easyNetworkStubGroup: ts.GenericModuleReferenceFactory<2>;
|
|
16
16
|
createEasyNetworkStubGroup: ts.GenericModuleReferenceFactory<2>;
|
|
17
|
+
stubHandle: ts.ModuleReferenceFactory;
|
|
17
18
|
} {
|
|
18
19
|
const utilsDirPath = resolve(options.outputDir, options.utilsDir);
|
|
19
20
|
const easyNetworkStubUtilsPath = join(utilsDirPath, 'easy-network-stub.utils.ts');
|
|
@@ -41,5 +42,6 @@ export function getReferenceFactories(options: TypeScriptEasyNetworkStubsGenerat
|
|
|
41
42
|
importType: 'type-import',
|
|
42
43
|
}),
|
|
43
44
|
createEasyNetworkStubGroup: ts.reference.genericFactory<2>('createEasyNetworkStubGroup', easyNetworkStubUtilsPath),
|
|
45
|
+
stubHandle: ts.reference.factory('StubHandle', 'easy-network-stub', { importType: 'type-import' }),
|
|
44
46
|
};
|
|
45
47
|
}
|