vovk-cli 0.0.1-draft.41 → 0.0.1-draft.42
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.
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
import type { clientizeController, VovkClientFetcher } from 'vovk/client';
|
|
3
3
|
import type { promisifyWorker } from 'vovk/worker';
|
|
4
4
|
import type fetcher from '<%= fetcherClientImportPath %>';
|
|
5
|
-
|
|
6
5
|
<% segments.forEach((segment, i) => { %>
|
|
7
|
-
|
|
6
|
+
import type { Controllers as Controllers<%= i %>, Workers as Workers<%= i %> } from "<%= segment.segmentImportPath %>";
|
|
8
7
|
<% }) %>
|
|
9
|
-
|
|
10
8
|
type Options = typeof fetcher extends VovkClientFetcher<infer U> ? U : never;
|
|
11
9
|
|
|
12
10
|
<% segments.forEach((segment, i) => {
|
|
@@ -16,9 +14,9 @@ type Options = typeof fetcher extends VovkClientFetcher<infer U> ? U : never;
|
|
|
16
14
|
const workers = Object.keys(segSchema.workers);
|
|
17
15
|
%>
|
|
18
16
|
<% controllers.forEach((key) => { %>
|
|
19
|
-
|
|
17
|
+
export const <%= key %>: ReturnType<typeof clientizeController<Controllers<%= i %>["<%= key %>"], Options>>;
|
|
20
18
|
<% }) %>
|
|
21
19
|
<% workers.forEach((key) => { %>
|
|
22
|
-
|
|
20
|
+
export const <%= key %>: ReturnType<typeof promisifyWorker<Workers<%= i %>["<%= key %>"]>>;
|
|
23
21
|
<% }) %>
|
|
24
22
|
<% }) %>
|
|
@@ -14,13 +14,13 @@ const apiRoot = '<%= apiEntryPoint %>';
|
|
|
14
14
|
const workers = Object.keys(segSchema.workers);
|
|
15
15
|
%>
|
|
16
16
|
<% controllers.forEach((key) => { %>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
exports.<%= key %> = clientizeController(
|
|
18
|
+
schema['<%= segment.segmentName %>'].controllers.<%= key %>,
|
|
19
|
+
'<%= segment.segmentName %>',
|
|
20
|
+
{ fetcher, validateOnClient, defaultOptions: { apiRoot } }
|
|
21
|
+
);
|
|
22
22
|
<% }) %>
|
|
23
23
|
<% workers.forEach((key) => { %>
|
|
24
|
-
|
|
24
|
+
exports.<%= key %> = promisifyWorker(null, schema['<%= segment.segmentName %>'].workers.<%= key %>);
|
|
25
25
|
<% }) %>
|
|
26
26
|
<% }) %>
|
|
@@ -3,13 +3,11 @@ import { clientizeController, type VovkClientFetcher } from 'vovk/client';
|
|
|
3
3
|
import { promisifyWorker } from 'vovk/worker';
|
|
4
4
|
import fetcher from '<%= fetcherClientImportPath %>';
|
|
5
5
|
import schema from '<%= schemaOutImportPath %>';
|
|
6
|
-
|
|
7
6
|
<% if (validateOnClientImportPath) { %>
|
|
8
7
|
import validateOnClient from '<%= validateOnClientImportPath %>';
|
|
9
8
|
<% } else { %>
|
|
10
9
|
const validateOnClient = undefined;
|
|
11
10
|
<% } %>
|
|
12
|
-
|
|
13
11
|
type Options = typeof fetcher extends VovkClientFetcher<infer U> ? U : never;
|
|
14
12
|
const apiRoot = '<%= apiEntryPoint %>';
|
|
15
13
|
|
|
@@ -17,20 +15,20 @@ const apiRoot = '<%= apiEntryPoint %>';
|
|
|
17
15
|
const segSchema = segmentsSchema[segment.segmentName];
|
|
18
16
|
if (!segSchema || !segSchema.emitSchema) return;
|
|
19
17
|
%>
|
|
20
|
-
|
|
18
|
+
import type { Controllers as Controllers<%= i %>, Workers as Workers<%= i %> } from "<%= segment.segmentImportPath %>";
|
|
21
19
|
|
|
22
20
|
<% Object.keys(segSchema.controllers).forEach((key) => { %>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
export const <%= key %> = clientizeController<Controllers<%= i %>["<%= key %>"], Options>(
|
|
22
|
+
schema['<%= segment.segmentName %>'].controllers.<%= key %>,
|
|
23
|
+
'<%= segment.segmentName %>',
|
|
24
|
+
{ fetcher, validateOnClient, defaultOptions: { apiRoot } }
|
|
25
|
+
);
|
|
28
26
|
<% }) %>
|
|
29
27
|
|
|
30
28
|
<% Object.keys(segSchema.workers).forEach((key) => { %>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
export const <%= key %> = promisifyWorker<Workers<%= i %>["<%= key %>"]>(
|
|
30
|
+
null,
|
|
31
|
+
schema['<%= segment.segmentName %>'].workers.<%= key %>
|
|
32
|
+
);
|
|
35
33
|
<% }) %>
|
|
36
34
|
<% }) %>
|