@travetto/web-rpc 6.0.0-rc.2 → 6.0.0-rc.4
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/package.json +2 -2
- package/src/controller.ts +1 -1
- package/src/service.ts +3 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/web-rpc",
|
|
3
|
-
"version": "6.0.0-rc.
|
|
3
|
+
"version": "6.0.0-rc.4",
|
|
4
4
|
"description": "RPC support for a Web Application",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@travetto/config": "^6.0.0-rc.2",
|
|
30
30
|
"@travetto/schema": "^6.0.0-rc.2",
|
|
31
|
-
"@travetto/web": "^6.0.0-rc.
|
|
31
|
+
"@travetto/web": "^6.0.0-rc.4"
|
|
32
32
|
},
|
|
33
33
|
"travetto": {
|
|
34
34
|
"displayName": "Web RPC Support"
|
package/src/controller.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
@Controller('/rpc')
|
|
10
10
|
@ExcludeInterceptors(val => !(val instanceof BodyParseInterceptor || val instanceof RespondInterceptor || val.category === 'global'))
|
|
11
11
|
@Undocumented()
|
|
12
|
-
export class
|
|
12
|
+
export class WebRpcController {
|
|
13
13
|
|
|
14
14
|
@Inject()
|
|
15
15
|
ctx: WebAsyncContext;
|
package/src/service.ts
CHANGED
|
@@ -30,6 +30,7 @@ export class WebRpcClientGeneratorService {
|
|
|
30
30
|
const entry = RuntimeIndex.getEntry(Runtime.getSourceFile(x));
|
|
31
31
|
return entry && entry.role === 'std';
|
|
32
32
|
})
|
|
33
|
+
.filter(x => ControllerRegistry.get(x).documented !== false)
|
|
33
34
|
.map(x => {
|
|
34
35
|
const imp = ManifestModuleUtil.withOutputExtension(Runtime.getImport(x));
|
|
35
36
|
const base = Runtime.workspaceRelative(RuntimeIndex.manifest.build.typesFolder);
|
|
@@ -49,7 +50,7 @@ export class WebRpcClientGeneratorService {
|
|
|
49
50
|
const clientOutputFile = path.resolve(config.output, path.basename(clientSourceFile));
|
|
50
51
|
const clientSourceContents = await fs.readFile(clientSourceFile, 'utf8');
|
|
51
52
|
|
|
52
|
-
const flavorSourceFile = RuntimeIndex.getFromImport(`@travetto/web-rpc/support/client/rpc-${config.type}.ts`)
|
|
53
|
+
const flavorSourceFile = RuntimeIndex.getFromImport(`@travetto/web-rpc/support/client/rpc-${config.type}.ts`)?.sourceFile ?? '<unknown>';
|
|
53
54
|
const flavorOutputFile = path.resolve(config.output, path.basename(flavorSourceFile));
|
|
54
55
|
const flavorSourceContents = (await fs.readFile(flavorSourceFile, 'utf8').catch(() => ''))
|
|
55
56
|
.replaceAll(/^\s*\/\/\s*@ts-ignore[^\n]*\n/gsm, '')
|
|
@@ -57,7 +58,7 @@ export class WebRpcClientGeneratorService {
|
|
|
57
58
|
|
|
58
59
|
const factoryOutputFile = path.resolve(config.output, 'factory.ts');
|
|
59
60
|
const factorySourceContents = [
|
|
60
|
-
`import { ${clientFactory.name} } from './rpc
|
|
61
|
+
`import { ${clientFactory.name} } from './rpc';`,
|
|
61
62
|
...classes.map((n) => `import type { ${n.name} } from '${n.import}';`),
|
|
62
63
|
'',
|
|
63
64
|
`export const factory = ${clientFactory.name}<{`,
|