@devrev/typescript-sdk 1.0.2 → 1.1.3
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/LICENSE +21 -0
- package/README.md +31 -48
- package/package.json +17 -10
- package/.eslintignore +0 -2
- package/.github/workflows/npm-publish.yml +0 -27
- package/.prettierignore +0 -4
- package/.prettierrc +0 -15
- package/.vscode/extensions.json +0 -8
- package/.vscode/launch.json +0 -17
- package/.vscode/settings.json +0 -31
- package/USER_README.md +0 -16
- package/nodemon.json +0 -5
- package/src/auto-generated/beta/beta-devrev-sdk.ts +0 -1826
- package/src/auto-generated/internal/private-internal-devrev-sdk.ts +0 -54739
- package/src/auto-generated/public-devrev-sdk.ts +0 -4009
- package/src/beta-data-contracts.json +0 -3271
- package/src/client_setup.ts +0 -64
- package/src/private-internal-data-contracts.json +0 -98025
- package/src/public-data-contracts.json +0 -6922
- package/src/workflow/workflow.test.ts +0 -26
- package/src/workflow/workflow.ts +0 -54
- package/templates/README.md +0 -17
- package/templates/base/README.md +0 -8
- package/templates/base/data-contract-jsdoc.ejs +0 -37
- package/templates/base/data-contracts.ejs +0 -28
- package/templates/base/enum-data-contract.ejs +0 -12
- package/templates/base/http-client.ejs +0 -3
- package/templates/base/http-clients/axios-http-client.ejs +0 -138
- package/templates/base/http-clients/fetch-http-client.ejs +0 -224
- package/templates/base/interface-data-contract.ejs +0 -10
- package/templates/base/object-field-jsdoc.ejs +0 -28
- package/templates/base/route-docs.ejs +0 -30
- package/templates/base/route-name.ejs +0 -43
- package/templates/base/route-type.ejs +0 -22
- package/templates/base/type-data-contract.ejs +0 -15
- package/templates/default/README.md +0 -7
- package/templates/default/api.ejs +0 -64
- package/templates/default/procedure-call.ejs +0 -100
- package/templates/default/route-types.ejs +0 -26
- package/templates/modular/README.md +0 -7
- package/templates/modular/api.ejs +0 -28
- package/templates/modular/procedure-call.ejs +0 -100
- package/templates/modular/route-types.ejs +0 -18
- package/tsconfig.eslint.json +0 -4
- package/tsconfig.json +0 -25
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<%
|
|
2
|
-
const { route, utils, config } = it;
|
|
3
|
-
const { _, pascalCase, require } = utils;
|
|
4
|
-
const { query, payload, pathParams, headers } = route.request;
|
|
5
|
-
|
|
6
|
-
const routeDocs = includeFile("@base/route-docs", { config, route, utils });
|
|
7
|
-
const routeNamespace = pascalCase(route.routeName.usage);
|
|
8
|
-
|
|
9
|
-
%>
|
|
10
|
-
/**
|
|
11
|
-
<%~ routeDocs.description %>
|
|
12
|
-
|
|
13
|
-
<%~ routeDocs.lines %>
|
|
14
|
-
|
|
15
|
-
*/
|
|
16
|
-
export namespace <%~ routeNamespace %> {
|
|
17
|
-
export type RequestParams = <%~ (pathParams && pathParams.type) || '{}' %>;
|
|
18
|
-
export type RequestQuery = <%~ (query && query.type) || '{}' %>;
|
|
19
|
-
export type RequestBody = <%~ (payload && payload.type) || 'never' %>;
|
|
20
|
-
export type RequestHeaders = <%~ (headers && headers.type) || '{}' %>;
|
|
21
|
-
export type ResponseBody = <%~ route.response.type %>;
|
|
22
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<%
|
|
2
|
-
const { contract, utils } = it;
|
|
3
|
-
const { formatDescription, require, _ } = utils;
|
|
4
|
-
|
|
5
|
-
%>
|
|
6
|
-
<% if (contract.$content.length) { %>
|
|
7
|
-
export type <%~ contract.name %> = {
|
|
8
|
-
<% _.forEach(contract.$content, (field) => { %>
|
|
9
|
-
<%~ includeFile('@base/object-field-jsdoc.ejs', { ...it, field }) %>
|
|
10
|
-
<%~ field.field %>;
|
|
11
|
-
<% }) %>
|
|
12
|
-
}<%~ utils.isNeedToAddNull(contract) ? ' | null' : ''%>
|
|
13
|
-
<% } else { %>
|
|
14
|
-
export type <%~ contract.name %> = Record<string, any>;
|
|
15
|
-
<% } %>
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
<%
|
|
2
|
-
const { apiConfig, routes, utils, config } = it;
|
|
3
|
-
const { info, servers, externalDocs } = apiConfig;
|
|
4
|
-
const { _, require, formatDescription } = utils;
|
|
5
|
-
|
|
6
|
-
const server = (servers && servers[0]) || { url: "" };
|
|
7
|
-
|
|
8
|
-
const descriptionLines = _.compact([
|
|
9
|
-
`@title ${info.title || "No title"}`,
|
|
10
|
-
info.version && `@version ${info.version}`,
|
|
11
|
-
info.license && `@license ${_.compact([
|
|
12
|
-
info.license.name,
|
|
13
|
-
info.license.url && `(${info.license.url})`,
|
|
14
|
-
]).join(" ")}`,
|
|
15
|
-
info.termsOfService && `@termsOfService ${info.termsOfService}`,
|
|
16
|
-
server.url && `@baseUrl ${server.url}`,
|
|
17
|
-
externalDocs.url && `@externalDocs ${externalDocs.url}`,
|
|
18
|
-
info.contact && `@contact ${_.compact([
|
|
19
|
-
info.contact.name,
|
|
20
|
-
info.contact.email && `<${info.contact.email}>`,
|
|
21
|
-
info.contact.url && `(${info.contact.url})`,
|
|
22
|
-
]).join(" ")}`,
|
|
23
|
-
info.description && " ",
|
|
24
|
-
info.description && _.replace(formatDescription(info.description), /\n/g, "\n * "),
|
|
25
|
-
]);
|
|
26
|
-
|
|
27
|
-
%>
|
|
28
|
-
|
|
29
|
-
<% if (config.httpClientType === config.constants.HTTP_CLIENT.AXIOS) { %> import { AxiosRequestConfig, AxiosResponse } from "axios"; <% } %>
|
|
30
|
-
|
|
31
|
-
<% if (descriptionLines.length) { %>
|
|
32
|
-
/**
|
|
33
|
-
<% descriptionLines.forEach((descriptionLine) => { %>
|
|
34
|
-
* <%~ descriptionLine %>
|
|
35
|
-
|
|
36
|
-
<% }) %>
|
|
37
|
-
*/
|
|
38
|
-
<% } %>
|
|
39
|
-
export class <%~ config.apiClassName %><SecurityDataType extends unknown><% if (!config.singleHttpClient) { %> extends HttpClient<SecurityDataType> <% } %> {
|
|
40
|
-
|
|
41
|
-
<% if(config.singleHttpClient) { %>
|
|
42
|
-
http: HttpClient<SecurityDataType>;
|
|
43
|
-
|
|
44
|
-
constructor (http: HttpClient<SecurityDataType>) {
|
|
45
|
-
this.http = http;
|
|
46
|
-
}
|
|
47
|
-
<% } %>
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
<% routes.outOfModule && routes.outOfModule.forEach((route) => { %>
|
|
51
|
-
<% console.log("The value of it.num is: " + it.num) %>
|
|
52
|
-
<%~ includeFile('./procedure-call.ejs', { ...it, route }) %>
|
|
53
|
-
|
|
54
|
-
<% }) %>
|
|
55
|
-
|
|
56
|
-
<% routes.combined && routes.combined.forEach(({ routes = [], moduleName }) => { %>
|
|
57
|
-
|
|
58
|
-
<% routes.forEach((route) => { %>
|
|
59
|
-
|
|
60
|
-
<%~ includeFile('./procedure-call.ejs', { ...it, route }) %>
|
|
61
|
-
|
|
62
|
-
<% }) %>
|
|
63
|
-
<% }) %>
|
|
64
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
<%
|
|
2
|
-
const { utils, route, config } = it;
|
|
3
|
-
const { requestBodyInfo, responseBodyInfo, specificArgNameResolver } = route;
|
|
4
|
-
const { _, getInlineParseContent, getParseContent, parseSchema, getComponentByRef, require } = utils;
|
|
5
|
-
const { parameters, path, method, payload, query, formData, security, requestParams } = route.request;
|
|
6
|
-
const { type, errorType, contentTypes } = route.response;
|
|
7
|
-
const { HTTP_CLIENT, RESERVED_REQ_PARAMS_ARG_NAMES } = config.constants;
|
|
8
|
-
const routeDocs = includeFile("@base/route-docs", { config, route, utils });
|
|
9
|
-
const queryName = (query && query.name) || "query";
|
|
10
|
-
const pathParams = _.values(parameters);
|
|
11
|
-
const pathParamsNames = _.map(pathParams, "name");
|
|
12
|
-
|
|
13
|
-
const isFetchTemplate = config.httpClientType === HTTP_CLIENT.FETCH;
|
|
14
|
-
|
|
15
|
-
const requestConfigParam = {
|
|
16
|
-
name: specificArgNameResolver.resolve(RESERVED_REQ_PARAMS_ARG_NAMES),
|
|
17
|
-
optional: true,
|
|
18
|
-
type: "RequestParams",
|
|
19
|
-
defaultValue: "{}",
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const argToTmpl = ({ name, optional, type, defaultValue }) => `${name}${!defaultValue && optional ? '?' : ''}: ${type}${defaultValue ? ` = ${defaultValue}` : ''}`;
|
|
23
|
-
|
|
24
|
-
const rawWrapperArgs = config.extractRequestParams ?
|
|
25
|
-
_.compact([
|
|
26
|
-
requestParams && {
|
|
27
|
-
name: pathParams.length ? `{ ${_.join(pathParamsNames, ", ")}, ...${queryName} }` : queryName,
|
|
28
|
-
optional: false,
|
|
29
|
-
type: getInlineParseContent(requestParams),
|
|
30
|
-
},
|
|
31
|
-
...(!requestParams ? pathParams : []),
|
|
32
|
-
payload,
|
|
33
|
-
requestConfigParam,
|
|
34
|
-
]) :
|
|
35
|
-
_.compact([
|
|
36
|
-
...pathParams,
|
|
37
|
-
query,
|
|
38
|
-
payload,
|
|
39
|
-
requestConfigParam,
|
|
40
|
-
])
|
|
41
|
-
|
|
42
|
-
const wrapperArgs = _
|
|
43
|
-
// Sort by optionality
|
|
44
|
-
.sortBy(rawWrapperArgs, [o => o.optional])
|
|
45
|
-
.map(argToTmpl)
|
|
46
|
-
.join(', ')
|
|
47
|
-
|
|
48
|
-
// RequestParams["type"]
|
|
49
|
-
const requestContentKind = {
|
|
50
|
-
"JSON": "ContentType.Json",
|
|
51
|
-
"URL_ENCODED": "ContentType.UrlEncoded",
|
|
52
|
-
"FORM_DATA": "ContentType.FormData",
|
|
53
|
-
"TEXT": "ContentType.Text",
|
|
54
|
-
}
|
|
55
|
-
// RequestParams["format"]
|
|
56
|
-
const responseContentKind = {
|
|
57
|
-
"JSON": '"json"',
|
|
58
|
-
"IMAGE": '"blob"',
|
|
59
|
-
"FORM_DATA": isFetchTemplate ? '"formData"' : '"document"'
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const bodyTmpl = _.get(payload, "name") || null;
|
|
63
|
-
const queryTmpl = (query != null && queryName) || null;
|
|
64
|
-
const bodyContentKindTmpl = requestContentKind[requestBodyInfo.contentKind] || null;
|
|
65
|
-
const responseFormatTmpl = responseContentKind[responseBodyInfo.success && responseBodyInfo.success.schema && responseBodyInfo.success.schema.contentKind] || null;
|
|
66
|
-
const securityTmpl = security ? 'true' : null;
|
|
67
|
-
|
|
68
|
-
const describeReturnType = () => {
|
|
69
|
-
if (!config.toJS) return "";
|
|
70
|
-
|
|
71
|
-
switch(config.httpClientType) {
|
|
72
|
-
case HTTP_CLIENT.AXIOS: {
|
|
73
|
-
return `Promise<AxiosResponse<${type}>>`
|
|
74
|
-
}
|
|
75
|
-
default: {
|
|
76
|
-
return `Promise<HttpResponse<${type}, ${errorType}>`
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
%>
|
|
82
|
-
/**
|
|
83
|
-
<%~ routeDocs.description %>
|
|
84
|
-
|
|
85
|
-
*<% /* Here you can add some other JSDoc tags */ %>
|
|
86
|
-
|
|
87
|
-
<%~ routeDocs.lines %>
|
|
88
|
-
|
|
89
|
-
*/
|
|
90
|
-
<%~ route.routeName.usage %><%~ route.namespace ? '= ' : ' = ' %>(<%~ wrapperArgs %>)<%~ config.toJS ? `: ${describeReturnType()}` : "" %> =>
|
|
91
|
-
<%~ config.singleHttpClient ? 'this.http.request' : 'this.request' %><<%~ type %>, <%~ errorType %>>({
|
|
92
|
-
path: `<%~ path %>`,
|
|
93
|
-
method: '<%~ _.upperCase(method) %>',
|
|
94
|
-
<%~ queryTmpl ? `query: ${queryTmpl},` : '' %>
|
|
95
|
-
<%~ bodyTmpl ? `body: ${bodyTmpl},` : '' %>
|
|
96
|
-
<%~ securityTmpl ? `secure: ${securityTmpl},` : '' %>
|
|
97
|
-
<%~ bodyContentKindTmpl ? `type: ${bodyContentKindTmpl},` : '' %>
|
|
98
|
-
<%~ responseFormatTmpl ? `format: ${responseFormatTmpl},` : '' %>
|
|
99
|
-
...<%~ _.get(requestConfigParam, "name") %>,
|
|
100
|
-
})<%~ route.namespace ? '' : '' %>
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
<%
|
|
2
|
-
const { utils, config, routes, modelTypes } = it;
|
|
3
|
-
const { _, pascalCase } = utils;
|
|
4
|
-
const dataContracts = config.modular ? _.map(modelTypes, "name") : [];
|
|
5
|
-
%>
|
|
6
|
-
|
|
7
|
-
<% if (dataContracts.length) { %>
|
|
8
|
-
import { <%~ dataContracts.join(", ") %> } from "./<%~ config.fileNames.dataContracts %>"
|
|
9
|
-
<% } %>
|
|
10
|
-
|
|
11
|
-
<%
|
|
12
|
-
/* TODO: outOfModule, combined should be attributes of route, which will allow to avoid duplication of code */
|
|
13
|
-
%>
|
|
14
|
-
|
|
15
|
-
<% routes.outOfModule && routes.outOfModule.forEach(({ routes = [] }) => { %>
|
|
16
|
-
<% routes.forEach((route) => { %>
|
|
17
|
-
<%~ includeFile('@base/route-type.ejs', { ...it, route }) %>
|
|
18
|
-
<% }) %>
|
|
19
|
-
<% }) %>
|
|
20
|
-
|
|
21
|
-
<% routes.combined && routes.combined.forEach(({ routes = [], moduleName }) => { %>
|
|
22
|
-
<% routes.forEach((route) => { %>
|
|
23
|
-
<%~ includeFile('@base/route-type.ejs', { ...it, route }) %>
|
|
24
|
-
<% }) %>
|
|
25
|
-
|
|
26
|
-
<% }) %>
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<%
|
|
2
|
-
const { utils, route, config, modelTypes } = it;
|
|
3
|
-
const { _, pascalCase, require } = utils;
|
|
4
|
-
const apiClassName = pascalCase(route.moduleName);
|
|
5
|
-
const routes = route.routes;
|
|
6
|
-
const dataContracts = _.map(modelTypes, "name");
|
|
7
|
-
%>
|
|
8
|
-
|
|
9
|
-
<% if (config.httpClientType === config.constants.HTTP_CLIENT.AXIOS) { %> import { AxiosRequestConfig, AxiosResponse } from "axios"; <% } %>
|
|
10
|
-
|
|
11
|
-
import { HttpClient, RequestParams, ContentType, HttpResponse } from "./<%~ config.fileNames.httpClient %>";
|
|
12
|
-
<% if (dataContracts.length) { %>
|
|
13
|
-
import { <%~ dataContracts.join(", ") %> } from "./<%~ config.fileNames.dataContracts %>"
|
|
14
|
-
<% } %>
|
|
15
|
-
|
|
16
|
-
export class <%= apiClassName %><SecurityDataType = unknown><% if (!config.singleHttpClient) { %> extends HttpClient<SecurityDataType> <% } %> {
|
|
17
|
-
<% if(config.singleHttpClient) { %>
|
|
18
|
-
http: HttpClient<SecurityDataType>;
|
|
19
|
-
|
|
20
|
-
constructor (http: HttpClient<SecurityDataType>) {
|
|
21
|
-
this.http = http;
|
|
22
|
-
}
|
|
23
|
-
<% } %>
|
|
24
|
-
|
|
25
|
-
<% routes.forEach((route) => { %>
|
|
26
|
-
<%~ includeFile('./procedure-call.ejs', { ...it, route }) %>
|
|
27
|
-
<% }) %>
|
|
28
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
<%
|
|
2
|
-
const { utils, route, config } = it;
|
|
3
|
-
const { requestBodyInfo, responseBodyInfo, specificArgNameResolver } = route;
|
|
4
|
-
const { _, getInlineParseContent, getParseContent, parseSchema, getComponentByRef, require } = utils;
|
|
5
|
-
const { parameters, path, method, payload, query, formData, security, requestParams } = route.request;
|
|
6
|
-
const { type, errorType, contentTypes } = route.response;
|
|
7
|
-
const { HTTP_CLIENT, RESERVED_REQ_PARAMS_ARG_NAMES } = config.constants;
|
|
8
|
-
const routeDocs = includeFile("@base/route-docs", { config, route, utils });
|
|
9
|
-
const queryName = (query && query.name) || "query";
|
|
10
|
-
const pathParams = _.values(parameters);
|
|
11
|
-
const pathParamsNames = _.map(pathParams, "name");
|
|
12
|
-
|
|
13
|
-
const isFetchTemplate = config.httpClientType === HTTP_CLIENT.FETCH;
|
|
14
|
-
|
|
15
|
-
const requestConfigParam = {
|
|
16
|
-
name: specificArgNameResolver.resolve(RESERVED_REQ_PARAMS_ARG_NAMES),
|
|
17
|
-
optional: true,
|
|
18
|
-
type: "RequestParams",
|
|
19
|
-
defaultValue: "{}",
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const argToTmpl = ({ name, optional, type, defaultValue }) => `${name}${!defaultValue && optional ? '?' : ''}: ${type}${defaultValue ? ` = ${defaultValue}` : ''}`;
|
|
23
|
-
|
|
24
|
-
const rawWrapperArgs = config.extractRequestParams ?
|
|
25
|
-
_.compact([
|
|
26
|
-
requestParams && {
|
|
27
|
-
name: pathParams.length ? `{ ${_.join(pathParamsNames, ", ")}, ...${queryName} }` : queryName,
|
|
28
|
-
optional: false,
|
|
29
|
-
type: getInlineParseContent(requestParams),
|
|
30
|
-
},
|
|
31
|
-
...(!requestParams ? pathParams : []),
|
|
32
|
-
payload,
|
|
33
|
-
requestConfigParam,
|
|
34
|
-
]) :
|
|
35
|
-
_.compact([
|
|
36
|
-
...pathParams,
|
|
37
|
-
query,
|
|
38
|
-
payload,
|
|
39
|
-
requestConfigParam,
|
|
40
|
-
])
|
|
41
|
-
|
|
42
|
-
const wrapperArgs = _
|
|
43
|
-
// Sort by optionality
|
|
44
|
-
.sortBy(rawWrapperArgs, [o => o.optional])
|
|
45
|
-
.map(argToTmpl)
|
|
46
|
-
.join(', ')
|
|
47
|
-
|
|
48
|
-
// RequestParams["type"]
|
|
49
|
-
const requestContentKind = {
|
|
50
|
-
"JSON": "ContentType.Json",
|
|
51
|
-
"URL_ENCODED": "ContentType.UrlEncoded",
|
|
52
|
-
"FORM_DATA": "ContentType.FormData",
|
|
53
|
-
"TEXT": "ContentType.Text",
|
|
54
|
-
}
|
|
55
|
-
// RequestParams["format"]
|
|
56
|
-
const responseContentKind = {
|
|
57
|
-
"JSON": '"json"',
|
|
58
|
-
"IMAGE": '"blob"',
|
|
59
|
-
"FORM_DATA": isFetchTemplate ? '"formData"' : '"document"'
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const bodyTmpl = _.get(payload, "name") || null;
|
|
63
|
-
const queryTmpl = (query != null && queryName) || null;
|
|
64
|
-
const bodyContentKindTmpl = requestContentKind[requestBodyInfo.contentKind] || null;
|
|
65
|
-
const responseFormatTmpl = responseContentKind[responseBodyInfo.success && responseBodyInfo.success.schema && responseBodyInfo.success.schema.contentKind] || null;
|
|
66
|
-
const securityTmpl = security ? 'true' : null;
|
|
67
|
-
|
|
68
|
-
const describeReturnType = () => {
|
|
69
|
-
if (!config.toJS) return "";
|
|
70
|
-
|
|
71
|
-
switch(config.httpClientType) {
|
|
72
|
-
case HTTP_CLIENT.AXIOS: {
|
|
73
|
-
return `Promise<AxiosResponse<${type}>>`
|
|
74
|
-
}
|
|
75
|
-
default: {
|
|
76
|
-
return `Promise<HttpResponse<${type}, ${errorType}>`
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
%>
|
|
82
|
-
/**
|
|
83
|
-
<%~ routeDocs.description %>
|
|
84
|
-
|
|
85
|
-
*<% /* Here you can add some other JSDoc tags */ %>
|
|
86
|
-
|
|
87
|
-
<%~ routeDocs.lines %>
|
|
88
|
-
|
|
89
|
-
*/
|
|
90
|
-
<%~ route.routeName.usage %> = (<%~ wrapperArgs %>)<%~ config.toJS ? `: ${describeReturnType()}` : "" %> =>
|
|
91
|
-
<%~ config.singleHttpClient ? 'this.http.request' : 'this.request' %><<%~ type %>, <%~ errorType %>>({
|
|
92
|
-
path: `<%~ path %>`,
|
|
93
|
-
method: '<%~ _.upperCase(method) %>',
|
|
94
|
-
<%~ queryTmpl ? `query: ${queryTmpl},` : '' %>
|
|
95
|
-
<%~ bodyTmpl ? `body: ${bodyTmpl},` : '' %>
|
|
96
|
-
<%~ securityTmpl ? `secure: ${securityTmpl},` : '' %>
|
|
97
|
-
<%~ bodyContentKindTmpl ? `type: ${bodyContentKindTmpl},` : '' %>
|
|
98
|
-
<%~ responseFormatTmpl ? `format: ${responseFormatTmpl},` : '' %>
|
|
99
|
-
...<%~ _.get(requestConfigParam, "name") %>,
|
|
100
|
-
})
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<%
|
|
2
|
-
const { utils, config, route, modelTypes } = it;
|
|
3
|
-
const { _, pascalCase } = utils;
|
|
4
|
-
const { routes, moduleName } = route;
|
|
5
|
-
const dataContracts = config.modular ? _.map(modelTypes, "name") : [];
|
|
6
|
-
|
|
7
|
-
%>
|
|
8
|
-
<% if (dataContracts.length) { %>
|
|
9
|
-
import { <%~ dataContracts.join(", ") %> } from "./<%~ config.fileNames.dataContracts %>"
|
|
10
|
-
<% } %>
|
|
11
|
-
|
|
12
|
-
export namespace <%~ pascalCase(moduleName) %> {
|
|
13
|
-
<% _.forEach(routes, (route) => { %>
|
|
14
|
-
|
|
15
|
-
<%~ includeFile('@base/route-type.ejs', { ...it, route }) %>
|
|
16
|
-
|
|
17
|
-
<% }) %>
|
|
18
|
-
}
|
package/tsconfig.eslint.json
DELETED
package/tsconfig.json
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es2016",
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"baseUrl": "./",
|
|
6
|
-
"paths": {
|
|
7
|
-
"*": [
|
|
8
|
-
"./src/*"
|
|
9
|
-
]
|
|
10
|
-
},
|
|
11
|
-
"outDir": "./dist",
|
|
12
|
-
"esModuleInterop": true,
|
|
13
|
-
"forceConsistentCasingInFileNames": true,
|
|
14
|
-
"strict": true,
|
|
15
|
-
"skipLibCheck": true,
|
|
16
|
-
"declaration": true
|
|
17
|
-
},
|
|
18
|
-
"include": [
|
|
19
|
-
"src"
|
|
20
|
-
],
|
|
21
|
-
"exclude": [
|
|
22
|
-
"node_modules",
|
|
23
|
-
"dist"
|
|
24
|
-
]
|
|
25
|
-
}
|