vovk-cli 0.0.1-draft.60 → 0.0.1-draft.62

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,15 +2,14 @@
2
2
  const { default: fetcher } = require('<%= fetcherClientImportPath %>');
3
3
  const { default: createRPC } = require('<%= createRPCImportPath %>');
4
4
  const schema = require('<%= schemaOutImportPath %>');
5
-
6
5
  const { default: validateOnClient = null } = <%- validateOnClientImportPath ? `require('${validateOnClientImportPath}')` : '{}'%>;
7
6
  const apiRoot = '<%= apiRoot %>';
8
- <% segments.forEach((segment) => { %>
9
- <% Object.keys(segmentsSchema[segment.segmentName].controllers).forEach((key) => { %>
7
+ <% segments.forEach((segment) => {
8
+ Object.keys(segmentsSchema[segment.segmentName].controllers).forEach((key) => { %>
10
9
  exports.<%= key %> = createRPC(
11
10
  schema['<%= segment.segmentName %>'].controllers.<%= key %>,
12
11
  '<%= segment.segmentName %>',
13
12
  { fetcher, validateOnClient, defaultOptions: { apiRoot } }
14
13
  );
15
- <% }) %>
16
- <% }) %>
14
+ <% })
15
+ }) %>
@@ -8,8 +8,8 @@ import type createRPC from '<%= createRPCImportPath %>';
8
8
  <% }}) %>
9
9
  type Options = typeof fetcher extends VovkClientFetcher<infer U> ? U : never;
10
10
 
11
- <% segments.forEach((segment, i) => { %>
12
- <% Object.keys(segmentsSchema[segment.segmentName].controllers).forEach((key) => { %>
11
+ <% segments.forEach((segment, i) => {
12
+ Object.keys(segmentsSchema[segment.segmentName].controllers).forEach((key) => { %>
13
13
  export const <%= key %>: ReturnType<typeof createRPC<Controllers<%= i %>["<%= key %>"], Options>>;
14
- <% }) %>
15
- <% }) %>
14
+ <% })
15
+ }) %>
@@ -8,8 +8,8 @@ import type createRPC from '<%= createRPCImportPath %>';
8
8
  <% }}) %>
9
9
  type Options = typeof fetcher extends VovkClientFetcher<infer U> ? U : never;
10
10
 
11
- <% segments.forEach((segment, i) => { %>
12
- <% Object.keys(segmentsSchema[segment.segmentName].controllers).forEach((key) => { %>
11
+ <% segments.forEach((segment, i) => {
12
+ Object.keys(segmentsSchema[segment.segmentName].controllers).forEach((key) => { %>
13
13
  export const <%= key %>: ReturnType<typeof createRPC<Controllers<%= i %>["<%= key %>"], Options>>;
14
- <% }) %>
15
- <% }) %>
14
+ <% })
15
+ }) %>
@@ -1,6 +1,6 @@
1
1
  <%- '// auto-generated\n/* eslint-disable */' %>
2
- import { default as fetcher } from '<%= fetcherClientImportPath %>';
3
- import { default as createRPC } from '<%= createRPCImportPath %>';
2
+ import fetcherImport from '<%= fetcherClientImportPath %>';
3
+ import createRPC from '<%= createRPCImportPath %>';
4
4
  import schema from '<%= schemaOutImportPath %>';
5
5
  <% if (validateOnClientImportPath) { %>
6
6
  import validateOnClient from '<%= validateOnClientImportPath %>';
@@ -8,13 +8,15 @@ import validateOnClient from '<%= validateOnClientImportPath %>';
8
8
  const validateOnClient = undefined;
9
9
  <% } %>
10
10
  const apiRoot = '<%= apiRoot %>';
11
-
12
- <% segments.forEach((segment, i) => { %>
13
- <% Object.keys(segmentsSchema[segment.segmentName].controllers).forEach((key) => { %>
11
+ const fetcher = fetcherImport.default || fetcherImport;
12
+ <% segments.forEach((segment, i) => {
13
+ Object.keys(segmentsSchema[segment.segmentName].controllers).forEach((key) => { %>
14
14
  export const <%= key %> = createRPC(
15
15
  schema['<%= segment.segmentName %>'].controllers.<%= key %>,
16
16
  '<%= segment.segmentName %>',
17
17
  { fetcher, validateOnClient, defaultOptions: { apiRoot } }
18
18
  );
19
- <% }) %>
20
- <% }) %>
19
+ <%
20
+ });
21
+ });
22
+ %>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk-cli",
3
- "version": "0.0.1-draft.60",
3
+ "version": "0.0.1-draft.62",
4
4
  "bin": {
5
5
  "vovk": "./dist/index.mjs"
6
6
  },