mobx-tanstack-query-api 0.16.0 → 0.17.1

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.
Files changed (169) hide show
  1. package/builtin/index.cjs +26 -0
  2. package/builtin/index.d.cts +5 -0
  3. package/builtin/index.d.cts.map +1 -0
  4. package/builtin/index.d.ts +2 -2
  5. package/builtin/index.d.ts.map +1 -1
  6. package/builtin/index.js +2 -2
  7. package/cli/bin.cjs +17 -0
  8. package/cli/bin.d.cts +2 -0
  9. package/cli/bin.d.cts.map +1 -0
  10. package/cli/bin.js +4 -4
  11. package/cli/index.cjs +18 -0
  12. package/cli/index.d.cts +3 -0
  13. package/cli/index.d.cts.map +1 -0
  14. package/cli/index.d.ts +2 -1
  15. package/cli/index.d.ts.map +1 -1
  16. package/cli/index.js +2 -1
  17. package/cli/utils/define-config.cjs +9 -0
  18. package/cli/utils/define-config.d.cts +4 -0
  19. package/cli/utils/define-config.d.cts.map +1 -0
  20. package/cli/utils/define-config.d.ts +1 -1
  21. package/cli/utils/define-config.d.ts.map +1 -1
  22. package/cli/utils/exec-config-path.cjs +16 -0
  23. package/cli/utils/exec-config-path.d.cts +2 -0
  24. package/cli/utils/exec-config-path.d.cts.map +1 -0
  25. package/cli/utils/resolve-config-path.cjs +65 -0
  26. package/cli/utils/resolve-config-path.d.cts +3 -0
  27. package/cli/utils/resolve-config-path.d.cts.map +1 -0
  28. package/codegen/index.cjs +488 -0
  29. package/codegen/index.d.cts +167 -0
  30. package/codegen/index.d.cts.map +1 -0
  31. package/codegen/index.d.ts +1 -1
  32. package/codegen/index.d.ts.map +1 -1
  33. package/codegen/index.js +9 -9
  34. package/codegen/templates/all-endpoints-per-file.tmpl.cjs +99 -0
  35. package/codegen/templates/all-endpoints-per-file.tmpl.d.cts +18 -0
  36. package/codegen/templates/all-endpoints-per-file.tmpl.d.cts.map +1 -0
  37. package/codegen/templates/all-endpoints-per-file.tmpl.d.ts +1 -1
  38. package/codegen/templates/all-endpoints-per-file.tmpl.d.ts.map +1 -1
  39. package/codegen/templates/all-endpoints-per-file.tmpl.js +4 -4
  40. package/codegen/templates/all-exports.tmpl.cjs +14 -0
  41. package/codegen/templates/all-exports.tmpl.d.cts +11 -0
  42. package/codegen/templates/all-exports.tmpl.d.cts.map +1 -0
  43. package/codegen/templates/all-exports.tmpl.d.ts +1 -1
  44. package/codegen/templates/all-exports.tmpl.d.ts.map +1 -1
  45. package/codegen/templates/all-exports.tmpl.js +1 -1
  46. package/codegen/templates/constants.cjs +5 -0
  47. package/codegen/templates/constants.d.cts +2 -0
  48. package/codegen/templates/constants.d.cts.map +1 -0
  49. package/codegen/templates/data-contract.tmpl.cjs +49 -0
  50. package/codegen/templates/data-contract.tmpl.d.cts +8 -0
  51. package/codegen/templates/data-contract.tmpl.d.cts.map +1 -0
  52. package/codegen/templates/data-contracts-file.tmpl.cjs +27 -0
  53. package/codegen/templates/data-contracts-file.tmpl.d.cts +10 -0
  54. package/codegen/templates/data-contracts-file.tmpl.d.cts.map +1 -0
  55. package/codegen/templates/data-contracts-file.tmpl.d.ts +1 -1
  56. package/codegen/templates/data-contracts-file.tmpl.d.ts.map +1 -1
  57. package/codegen/templates/data-contracts-file.tmpl.js +2 -2
  58. package/codegen/templates/endpoint-jsdoc.tmpl.cjs +110 -0
  59. package/codegen/templates/endpoint-jsdoc.tmpl.d.cts +10 -0
  60. package/codegen/templates/endpoint-jsdoc.tmpl.d.cts.map +1 -0
  61. package/codegen/templates/endpoint-jsdoc.tmpl.d.ts +1 -1
  62. package/codegen/templates/endpoint-jsdoc.tmpl.d.ts.map +1 -1
  63. package/codegen/templates/endpoint-per-file.tmpl.cjs +90 -0
  64. package/codegen/templates/endpoint-per-file.tmpl.d.cts +18 -0
  65. package/codegen/templates/endpoint-per-file.tmpl.d.cts.map +1 -0
  66. package/codegen/templates/endpoint-per-file.tmpl.d.ts +1 -1
  67. package/codegen/templates/endpoint-per-file.tmpl.d.ts.map +1 -1
  68. package/codegen/templates/endpoint-per-file.tmpl.js +4 -4
  69. package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.cjs +10 -0
  70. package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.d.cts +10 -0
  71. package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.d.cts.map +1 -0
  72. package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.d.ts +1 -1
  73. package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.d.ts.map +1 -1
  74. package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.js +1 -1
  75. package/codegen/templates/meta-info.tmpl.cjs +48 -0
  76. package/codegen/templates/meta-info.tmpl.d.cts +12 -0
  77. package/codegen/templates/meta-info.tmpl.d.cts.map +1 -0
  78. package/codegen/templates/meta-info.tmpl.d.ts +1 -1
  79. package/codegen/templates/meta-info.tmpl.d.ts.map +1 -1
  80. package/codegen/templates/meta-info.tmpl.js +1 -1
  81. package/codegen/templates/new-endpoint.tmpl.cjs +178 -0
  82. package/codegen/templates/new-endpoint.tmpl.d.cts +21 -0
  83. package/codegen/templates/new-endpoint.tmpl.d.cts.map +1 -0
  84. package/codegen/templates/new-endpoint.tmpl.d.ts +1 -1
  85. package/codegen/templates/new-endpoint.tmpl.d.ts.map +1 -1
  86. package/codegen/templates/new-endpoint.tmpl.js +1 -1
  87. package/codegen/utils/remove-unused-types.cjs +117 -0
  88. package/codegen/utils/remove-unused-types.d.cts +7 -0
  89. package/codegen/utils/remove-unused-types.d.cts.map +1 -0
  90. package/codegen/utils/remove-unused-types.d.ts +1 -1
  91. package/codegen/utils/remove-unused-types.d.ts.map +1 -1
  92. package/codegen/utils/remove-unused-types.js +1 -1
  93. package/codegen/utils/unpack-filter-option.cjs +20 -0
  94. package/codegen/utils/unpack-filter-option.d.cts +4 -0
  95. package/codegen/utils/unpack-filter-option.d.cts.map +1 -0
  96. package/codegen/utils/unpack-filter-option.d.ts +1 -1
  97. package/codegen/utils/unpack-filter-option.d.ts.map +1 -1
  98. package/index.cjs +18 -0
  99. package/index.d.cts +3 -0
  100. package/index.d.cts.map +1 -0
  101. package/index.d.ts +1 -1
  102. package/index.d.ts.map +1 -1
  103. package/index.js +1 -1
  104. package/package.json +29 -147
  105. package/runtime/endpoint-infinite-query.cjs +101 -0
  106. package/runtime/endpoint-infinite-query.d.cts +17 -0
  107. package/runtime/endpoint-infinite-query.d.cts.map +1 -0
  108. package/runtime/endpoint-infinite-query.d.ts +3 -3
  109. package/runtime/endpoint-infinite-query.d.ts.map +1 -1
  110. package/runtime/endpoint-infinite-query.js +1 -1
  111. package/runtime/endpoint-infinite-query.types.cjs +2 -0
  112. package/runtime/endpoint-infinite-query.types.d.cts +30 -0
  113. package/runtime/endpoint-infinite-query.types.d.cts.map +1 -0
  114. package/runtime/endpoint-infinite-query.types.d.ts +2 -2
  115. package/runtime/endpoint-infinite-query.types.d.ts.map +1 -1
  116. package/runtime/endpoint-mutation.cjs +73 -0
  117. package/runtime/endpoint-mutation.d.cts +13 -0
  118. package/runtime/endpoint-mutation.d.cts.map +1 -0
  119. package/runtime/endpoint-mutation.d.ts +3 -3
  120. package/runtime/endpoint-mutation.d.ts.map +1 -1
  121. package/runtime/endpoint-mutation.types.cjs +2 -0
  122. package/runtime/endpoint-mutation.types.d.cts +30 -0
  123. package/runtime/endpoint-mutation.types.d.cts.map +1 -0
  124. package/runtime/endpoint-mutation.types.d.ts +2 -2
  125. package/runtime/endpoint-mutation.types.d.ts.map +1 -1
  126. package/runtime/endpoint-query-client.cjs +79 -0
  127. package/runtime/endpoint-query-client.d.cts +13 -0
  128. package/runtime/endpoint-query-client.d.cts.map +1 -0
  129. package/runtime/endpoint-query-client.d.ts +1 -1
  130. package/runtime/endpoint-query-client.d.ts.map +1 -1
  131. package/runtime/endpoint-query-client.types.cjs +2 -0
  132. package/runtime/endpoint-query-client.types.d.cts +16 -0
  133. package/runtime/endpoint-query-client.types.d.cts.map +1 -0
  134. package/runtime/endpoint-query-client.types.d.ts +2 -2
  135. package/runtime/endpoint-query-client.types.d.ts.map +1 -1
  136. package/runtime/endpoint-query.cjs +213 -0
  137. package/runtime/endpoint-query.d.cts +29 -0
  138. package/runtime/endpoint-query.d.cts.map +1 -0
  139. package/runtime/endpoint-query.d.ts +3 -3
  140. package/runtime/endpoint-query.d.ts.map +1 -1
  141. package/runtime/endpoint-query.types.cjs +2 -0
  142. package/runtime/endpoint-query.types.d.cts +37 -0
  143. package/runtime/endpoint-query.types.d.cts.map +1 -0
  144. package/runtime/endpoint-query.types.d.ts +1 -1
  145. package/runtime/endpoint-query.types.d.ts.map +1 -1
  146. package/runtime/endpoint.cjs +128 -0
  147. package/runtime/endpoint.d.cts +69 -0
  148. package/runtime/endpoint.d.cts.map +1 -0
  149. package/runtime/endpoint.d.ts +9 -9
  150. package/runtime/endpoint.d.ts.map +1 -1
  151. package/runtime/endpoint.js +3 -3
  152. package/runtime/endpoint.types.cjs +2 -0
  153. package/runtime/endpoint.types.d.cts +23 -0
  154. package/runtime/endpoint.types.d.cts.map +1 -0
  155. package/runtime/endpoint.types.d.ts +3 -3
  156. package/runtime/endpoint.types.d.ts.map +1 -1
  157. package/runtime/http-client.cjs +208 -0
  158. package/runtime/http-client.d.cts +85 -0
  159. package/runtime/http-client.d.cts.map +1 -0
  160. package/runtime/index.cjs +25 -0
  161. package/runtime/index.d.cts +10 -0
  162. package/runtime/index.d.cts.map +1 -0
  163. package/runtime/index.d.ts +9 -9
  164. package/runtime/index.d.ts.map +1 -1
  165. package/runtime/index.js +9 -9
  166. package/assets/gh-repo-template.pxz +0 -0
  167. package/assets/logo.png +0 -0
  168. package/assets/logo.pxz +0 -0
  169. package/cli/bin.mjs +0 -15
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,wBAA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IACH,cAAc,CAAC,EAAE,CACf,KAAK,EAAE,SAAS,EAChB,KAAK,EAAE,SAAS,KACb;QACH,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IAEF;;;;OAIG;IACH,yBAAyB,CAAC,EAAE,WAAW,CAAC;IAExC,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAE/B;;OAEG;IACH,eAAe,CAAC,EAAE,qBAAqB,CAAC;IAExC;;OAEG;IACH,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAElC,UAAU,CAAC,EAAE;QACX,yBAAyB,CAAC,EAAE,MAAM,CAAC;KACpC,CAAC;IAEF,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,UAAU,CAAC,EAAE;QACX,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC;QACtE,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC;KACnE,CAAC;CACH;AAED,MAAM,MAAM,mBAAmB,GAAG,MAAM,CACtC,YAAY,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,SAAS,GAAG,gBAAgB,CAAC,EAC5E,gBAAgB,CACjB,CAAC;AAEF,eAAO,MAAM,WAAW,GACtB,QAAQ,sBAAsB,GAAG,sBAAsB,EAAE,KAExD,OAAO,CAAC,IAAI,CAomBd,CAAC"}
package/codegen/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import path from 'node:path';
2
2
  import { fileURLToPath } from 'node:url';
3
3
  import { generateApi as generateApiFromSwagger, } from 'swagger-typescript-api';
4
- import { allEndpointPerFileTmpl } from './templates/all-endpoints-per-file.tmpl.js';
5
- import { allExportsTmpl } from './templates/all-exports.tmpl.js';
6
- import { LINTERS_IGNORE } from './templates/constants.js';
7
- import { dataContractsFileTmpl } from './templates/data-contracts-file.tmpl.js';
8
- import { endpointPerFileTmpl } from './templates/endpoint-per-file.tmpl.js';
9
- import { indexTsForEndpointPerFileTmpl } from './templates/index-ts-for-endpoint-per-file.tmpl.js';
10
- import { metaInfoTmpl } from './templates/meta-info.tmpl.js';
11
- import { removeUnusedTypes, } from './utils/remove-unused-types.js';
12
- import { unpackFilterOption } from './utils/unpack-filter-option.js';
4
+ import { allEndpointPerFileTmpl } from "./templates/all-endpoints-per-file.tmpl.js";
5
+ import { allExportsTmpl } from "./templates/all-exports.tmpl.js";
6
+ import { LINTERS_IGNORE } from "./templates/constants.js";
7
+ import { dataContractsFileTmpl } from "./templates/data-contracts-file.tmpl.js";
8
+ import { endpointPerFileTmpl } from "./templates/endpoint-per-file.tmpl.js";
9
+ import { indexTsForEndpointPerFileTmpl } from "./templates/index-ts-for-endpoint-per-file.tmpl.js";
10
+ import { metaInfoTmpl } from "./templates/meta-info.tmpl.js";
11
+ import { removeUnusedTypes, } from "./utils/remove-unused-types.js";
12
+ import { unpackFilterOption } from "./utils/unpack-filter-option.js";
13
13
  const __filename = fileURLToPath(import.meta.url);
14
14
  const __dirname = path.dirname(__filename);
15
15
  const __execdirname = process.cwd();
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.allEndpointPerFileTmpl = void 0;
4
+ const constants_js_1 = require("./constants.cjs");
5
+ const data_contract_tmpl_js_1 = require("./data-contract.tmpl.cjs");
6
+ const endpoint_jsdoc_tmpl_js_1 = require("./endpoint-jsdoc.tmpl.cjs");
7
+ const new_endpoint_tmpl_js_1 = require("./new-endpoint.tmpl.cjs");
8
+ const allEndpointPerFileTmpl = async ({ routes, configuration, apiParams, formatTSContent, importFileParams, utils, relativePathDataContracts, groupName, metaInfo, }) => {
9
+ const { _ } = utils;
10
+ const dataContractNamesInThisFile = [];
11
+ const newEndpointTemplates = routes.map((route) => {
12
+ const newEndpointTemplateData = (0, new_endpoint_tmpl_js_1.newEndpointTmpl)({
13
+ route,
14
+ configuration,
15
+ apiParams,
16
+ importFileParams,
17
+ utils,
18
+ groupName,
19
+ metaInfo,
20
+ });
21
+ const { reservedDataContractNames } = newEndpointTemplateData;
22
+ const dataContactNames = new Set(Object.keys(configuration.config.swaggerSchema?.components?.schemas).map((schemaName) => utils.formatModelName(schemaName)));
23
+ reservedDataContractNames.forEach((reservedDataContractName) => {
24
+ if (!dataContactNames.has(reservedDataContractName)) {
25
+ dataContractNamesInThisFile.push(reservedDataContractName);
26
+ }
27
+ });
28
+ return { ...newEndpointTemplateData, route };
29
+ });
30
+ const extraImportLines = [];
31
+ const endpointTemplates = await Promise.all(newEndpointTemplates.map(async ({ content: requestInfoInstanceContent, localModelTypes, route, }) => {
32
+ const requestInfoMeta = apiParams.getEndpointMeta?.(route, utils);
33
+ if (requestInfoMeta?.typeNameImportPath && requestInfoMeta.typeName) {
34
+ extraImportLines.push(`import { ${requestInfoMeta.typeName} } from "${requestInfoMeta.typeNameImportPath}";`);
35
+ }
36
+ return `
37
+ ${(await Promise.all(localModelTypes.map(async (modelType) => {
38
+ const contractType = await (0, data_contract_tmpl_js_1.dataContractTmpl)({
39
+ configuration,
40
+ contract: modelType,
41
+ addExportKeyword: true,
42
+ });
43
+ return contractType;
44
+ })))
45
+ .filter(Boolean)
46
+ .join('\n\n')}
47
+
48
+ ${(0, endpoint_jsdoc_tmpl_js_1.endpointJSDocTmpl)({
49
+ route,
50
+ configuration,
51
+ apiParams,
52
+ })}
53
+ export const ${_.camelCase(route.routeName.usage)} = ${requestInfoInstanceContent}
54
+ `;
55
+ }));
56
+ if (metaInfo) {
57
+ extraImportLines.push(`import { ${[groupName && 'Group', metaInfo?.namespace && 'namespace', 'Tag'].filter(Boolean).join(',')} } from "${groupName ? '../' : './'}meta-info";`);
58
+ }
59
+ return {
60
+ reservedDataContractNames: dataContractNamesInThisFile,
61
+ content: await formatTSContent(`${constants_js_1.LINTERS_IGNORE}
62
+ import {
63
+ RequestParams,
64
+ HttpResponse,
65
+ HttpMultistatusResponse,
66
+ } from "${apiParams.libImports?.['mobx-tanstack-query-api'] ?? 'mobx-tanstack-query-api'}";
67
+ import { ${importFileParams.endpoint.exportName} } from "${importFileParams.endpoint.path}";
68
+ import { ${importFileParams.httpClient.exportName} } from "${importFileParams.httpClient.path}";
69
+ import { ${importFileParams.queryClient.exportName} } from "${importFileParams.queryClient.path}";
70
+ ${extraImportLines.join('\n')}
71
+
72
+ ${configuration.modelTypes.length > 0
73
+ ? `
74
+ import { ${configuration.modelTypes
75
+ .map((it) => it.name)
76
+ .filter((it) => !dataContractNamesInThisFile.includes(it))} } from "${relativePathDataContracts}";
77
+ `
78
+ : ''}
79
+
80
+ ${(await Promise.all(dataContractNamesInThisFile.map(async (dataContractName) => {
81
+ const modelType = configuration.modelTypes.find((modelType) => modelType.name === dataContractName);
82
+ if (!modelType) {
83
+ return '';
84
+ }
85
+ const contractType = await (0, data_contract_tmpl_js_1.dataContractTmpl)({
86
+ configuration,
87
+ contract: modelType,
88
+ addExportKeyword: true,
89
+ });
90
+ return contractType;
91
+ })))
92
+ .filter(Boolean)
93
+ .join('\n\n')}
94
+
95
+ ${endpointTemplates.filter(Boolean).join('\n\n')}
96
+ `),
97
+ };
98
+ };
99
+ exports.allEndpointPerFileTmpl = allEndpointPerFileTmpl;
@@ -0,0 +1,18 @@
1
+ import type { AnyObject, Maybe } from 'yummies/utils/types';
2
+ import type { AllImportFileParams, CodegenDataUtils, CodegenProcess, GenerateQueryApiParams, MetaInfo } from "../index.cjs";
3
+ export interface AllEndpointPerFileTmplParams extends AnyObject {
4
+ routes: AnyObject[];
5
+ configuration: AnyObject;
6
+ apiParams: GenerateQueryApiParams;
7
+ codegenProcess: CodegenProcess;
8
+ importFileParams: AllImportFileParams;
9
+ utils: CodegenDataUtils;
10
+ relativePathDataContracts: string;
11
+ groupName: Maybe<string>;
12
+ metaInfo: Maybe<MetaInfo>;
13
+ }
14
+ export declare const allEndpointPerFileTmpl: ({ routes, configuration, apiParams, formatTSContent, importFileParams, utils, relativePathDataContracts, groupName, metaInfo, }: AllEndpointPerFileTmplParams) => Promise<{
15
+ reservedDataContractNames: string[];
16
+ content: any;
17
+ }>;
18
+ //# sourceMappingURL=all-endpoints-per-file.tmpl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"all-endpoints-per-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/all-endpoints-per-file.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACtB,QAAQ,EACT,qBAAoB;AAOrB,MAAM,WAAW,4BAA6B,SAAQ,SAAS;IAC7D,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,aAAa,EAAE,SAAS,CAAC;IACzB,SAAS,EAAE,sBAAsB,CAAC;IAClC,cAAc,EAAE,cAAc,CAAC;IAC/B,gBAAgB,EAAE,mBAAmB,CAAC;IACtC,KAAK,EAAE,gBAAgB,CAAC;IACxB,yBAAyB,EAAE,MAAM,CAAC;IAClC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,sBAAsB,GAAU,iIAU1C,4BAA4B;;;EAuI9B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { AnyObject, Maybe } from 'yummies/utils/types';
2
- import type { AllImportFileParams, CodegenDataUtils, CodegenProcess, GenerateQueryApiParams, MetaInfo } from '../index.js';
2
+ import type { AllImportFileParams, CodegenDataUtils, CodegenProcess, GenerateQueryApiParams, MetaInfo } from "../index.js";
3
3
  export interface AllEndpointPerFileTmplParams extends AnyObject {
4
4
  routes: AnyObject[];
5
5
  configuration: AnyObject;
@@ -1 +1 @@
1
- {"version":3,"file":"all-endpoints-per-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/all-endpoints-per-file.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACtB,QAAQ,EACT,MAAM,aAAa,CAAC;AAOrB,MAAM,WAAW,4BAA6B,SAAQ,SAAS;IAC7D,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,aAAa,EAAE,SAAS,CAAC;IACzB,SAAS,EAAE,sBAAsB,CAAC;IAClC,cAAc,EAAE,cAAc,CAAC;IAC/B,gBAAgB,EAAE,mBAAmB,CAAC;IACtC,KAAK,EAAE,gBAAgB,CAAC;IACxB,yBAAyB,EAAE,MAAM,CAAC;IAClC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,sBAAsB,GAAU,iIAU1C,4BAA4B;;;EAuI9B,CAAC"}
1
+ {"version":3,"file":"all-endpoints-per-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/all-endpoints-per-file.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACtB,QAAQ,EACT,oBAAoB;AAOrB,MAAM,WAAW,4BAA6B,SAAQ,SAAS;IAC7D,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,aAAa,EAAE,SAAS,CAAC;IACzB,SAAS,EAAE,sBAAsB,CAAC;IAClC,cAAc,EAAE,cAAc,CAAC;IAC/B,gBAAgB,EAAE,mBAAmB,CAAC;IACtC,KAAK,EAAE,gBAAgB,CAAC;IACxB,yBAAyB,EAAE,MAAM,CAAC;IAClC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,sBAAsB,GAAU,iIAU1C,4BAA4B;;;EAuI9B,CAAC"}
@@ -1,7 +1,7 @@
1
- import { LINTERS_IGNORE } from './constants.js';
2
- import { dataContractTmpl } from './data-contract.tmpl.js';
3
- import { endpointJSDocTmpl } from './endpoint-jsdoc.tmpl.js';
4
- import { newEndpointTmpl } from './new-endpoint.tmpl.js';
1
+ import { LINTERS_IGNORE } from "./constants.js";
2
+ import { dataContractTmpl } from "./data-contract.tmpl.js";
3
+ import { endpointJSDocTmpl } from "./endpoint-jsdoc.tmpl.js";
4
+ import { newEndpointTmpl } from "./new-endpoint.tmpl.js";
5
5
  export const allEndpointPerFileTmpl = async ({ routes, configuration, apiParams, formatTSContent, importFileParams, utils, relativePathDataContracts, groupName, metaInfo, }) => {
6
6
  const { _ } = utils;
7
7
  const dataContractNamesInThisFile = [];
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.allExportsTmpl = exports.formatGroupNameEnumKey = void 0;
4
+ const constants_js_1 = require("./constants.cjs");
5
+ const formatGroupNameEnumKey = (groupName, { _ }) => _.upperFirst(_.camelCase(groupName));
6
+ exports.formatGroupNameEnumKey = formatGroupNameEnumKey;
7
+ const allExportsTmpl = async ({ collectedExportFiles, metaInfo, formatTSContent, }) => {
8
+ return await formatTSContent(`${constants_js_1.LINTERS_IGNORE}
9
+ export * from './data-contracts';
10
+ ${collectedExportFiles.map((fileName) => `export * from './${fileName}';`).join('\n')}
11
+ ${metaInfo ? 'export * from "./meta-info";' : ''}
12
+ `);
13
+ };
14
+ exports.allExportsTmpl = allExportsTmpl;
@@ -0,0 +1,11 @@
1
+ import type { Maybe } from 'yummies/utils/types';
2
+ import type { CodegenDataUtils, MetaInfo } from "../index.cjs";
3
+ export interface AllExportsTmplParams {
4
+ formatTSContent: (...args: any[]) => Promise<string>;
5
+ collectedExportFiles: string[];
6
+ metaInfo: Maybe<MetaInfo>;
7
+ utils: CodegenDataUtils;
8
+ }
9
+ export declare const formatGroupNameEnumKey: (groupName: string, { _ }: CodegenDataUtils) => Capitalize<string>;
10
+ export declare const allExportsTmpl: ({ collectedExportFiles, metaInfo, formatTSContent, }: AllExportsTmplParams) => Promise<string>;
11
+ //# sourceMappingURL=all-exports.tmpl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"all-exports.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/all-exports.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,qBAAoB;AAI9D,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC1B,KAAK,EAAE,gBAAgB,CAAC;CACzB;AAED,eAAO,MAAM,sBAAsB,GACjC,WAAW,MAAM,EACjB,OAAO,gBAAgB,uBACgB,CAAC;AAE1C,eAAO,MAAM,cAAc,GAAU,sDAIlC,oBAAoB,oBAMtB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { Maybe } from 'yummies/utils/types';
2
- import type { CodegenDataUtils, MetaInfo } from '../index.js';
2
+ import type { CodegenDataUtils, MetaInfo } from "../index.js";
3
3
  export interface AllExportsTmplParams {
4
4
  formatTSContent: (...args: any[]) => Promise<string>;
5
5
  collectedExportFiles: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"all-exports.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/all-exports.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI9D,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC1B,KAAK,EAAE,gBAAgB,CAAC;CACzB;AAED,eAAO,MAAM,sBAAsB,GACjC,WAAW,MAAM,EACjB,OAAO,gBAAgB,uBACgB,CAAC;AAE1C,eAAO,MAAM,cAAc,GAAU,sDAIlC,oBAAoB,oBAMtB,CAAC"}
1
+ {"version":3,"file":"all-exports.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/all-exports.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,oBAAoB;AAI9D,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC1B,KAAK,EAAE,gBAAgB,CAAC;CACzB;AAED,eAAO,MAAM,sBAAsB,GACjC,WAAW,MAAM,EACjB,OAAO,gBAAgB,uBACgB,CAAC;AAE1C,eAAO,MAAM,cAAc,GAAU,sDAIlC,oBAAoB,oBAMtB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { LINTERS_IGNORE } from './constants.js';
1
+ import { LINTERS_IGNORE } from "./constants.js";
2
2
  export const formatGroupNameEnumKey = (groupName, { _ }) => _.upperFirst(_.camelCase(groupName));
3
3
  export const allExportsTmpl = async ({ collectedExportFiles, metaInfo, formatTSContent, }) => {
4
4
  return await formatTSContent(`${LINTERS_IGNORE}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LINTERS_IGNORE = void 0;
4
+ exports.LINTERS_IGNORE = `/* eslint-disable */
5
+ /* tslint:disable */`;
@@ -0,0 +1,2 @@
1
+ export declare const LINTERS_IGNORE = "/* eslint-disable */\n/* tslint:disable */";
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,+CACN,CAAC"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dataContractTmpl = void 0;
4
+ const buildGenerics = (contract) => {
5
+ if (!contract.genericArgs?.length)
6
+ return '';
7
+ return ('<' +
8
+ contract.genericArgs
9
+ .map((arg) => {
10
+ const { name, default: defaultType, extends: extendsType } = arg;
11
+ return [
12
+ name,
13
+ extendsType && `extends ${extendsType}`,
14
+ defaultType && `= ${defaultType}`,
15
+ ]
16
+ .filter(Boolean)
17
+ .join(' ');
18
+ })
19
+ .join(', ') +
20
+ '>');
21
+ };
22
+ const dataContractTmpl = async ({ contract, configuration, addExportKeyword, }) => {
23
+ const { utils } = configuration;
24
+ const { formatDescription } = utils;
25
+ const dataContractTemplates = {
26
+ enum: (contract) => {
27
+ return `enum ${contract.name} {\r\n${contract.content}\r\n}`;
28
+ },
29
+ interface: (contract) => {
30
+ return `interface ${contract.name}${buildGenerics(contract)} {\r\n${contract.content}}`;
31
+ },
32
+ type: (contract) => {
33
+ return `type ${contract.name}${buildGenerics(contract)} = ${contract.content === contract.name ? 'any' : contract.content}`;
34
+ },
35
+ };
36
+ let result = '';
37
+ let jsdoc = '';
38
+ if (contract.description) {
39
+ jsdoc = `/**\n * ${formatDescription(contract.description, true)}\n */\n`;
40
+ }
41
+ if (jsdoc) {
42
+ result += jsdoc;
43
+ }
44
+ const templateFn = dataContractTemplates[contract.typeIdentifier] ||
45
+ dataContractTemplates.type;
46
+ const contractType = `${addExportKeyword ? 'export ' : ''}${templateFn(contract)}`;
47
+ return result + contractType;
48
+ };
49
+ exports.dataContractTmpl = dataContractTmpl;
@@ -0,0 +1,8 @@
1
+ import type { AnyObject } from 'yummies/utils/types';
2
+ export interface DataContractTmplParams {
3
+ configuration: AnyObject;
4
+ contract: AnyObject;
5
+ addExportKeyword?: boolean;
6
+ }
7
+ export declare const dataContractTmpl: ({ contract, configuration, addExportKeyword, }: DataContractTmplParams) => Promise<string>;
8
+ //# sourceMappingURL=data-contract.tmpl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-contract.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/data-contract.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,WAAW,sBAAsB;IACrC,aAAa,EAAE,SAAS,CAAC;IACzB,QAAQ,EAAE,SAAS,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAuBD,eAAO,MAAM,gBAAgB,GAAU,gDAIpC,sBAAsB,oBAmCxB,CAAC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dataContractsFileTmpl = void 0;
4
+ const constants_js_1 = require("./constants.cjs");
5
+ const data_contract_tmpl_js_1 = require("./data-contract.tmpl.cjs");
6
+ const dataContractsFileTmpl = async ({ configuration, formatTSContent, excludedDataContractNames, }) => {
7
+ const { config, modelTypes } = configuration;
8
+ const contractDefinitions = [];
9
+ if (config.internalTemplateOptions?.addUtilRequiredKeysType) {
10
+ contractDefinitions.push(`type UtilRequiredKeys<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>`);
11
+ }
12
+ for await (const contract of modelTypes) {
13
+ if (excludedDataContractNames?.includes(contract.name)) {
14
+ continue;
15
+ }
16
+ contractDefinitions.push(await (0, data_contract_tmpl_js_1.dataContractTmpl)({
17
+ configuration,
18
+ contract,
19
+ addExportKeyword: true,
20
+ }));
21
+ }
22
+ return await formatTSContent(`${constants_js_1.LINTERS_IGNORE}
23
+
24
+ ${contractDefinitions.length > 0 ? contractDefinitions.join('\n\n') : `export {}`}
25
+ `);
26
+ };
27
+ exports.dataContractsFileTmpl = dataContractsFileTmpl;
@@ -0,0 +1,10 @@
1
+ import type { AnyObject } from 'yummies/utils/types';
2
+ import type { CodegenProcess, GenerateQueryApiParams } from "../index.cjs";
3
+ export interface DataContractsTmplParams extends AnyObject {
4
+ configuration: AnyObject;
5
+ apiParams: GenerateQueryApiParams;
6
+ codegenProcess: CodegenProcess;
7
+ excludedDataContractNames?: string[];
8
+ }
9
+ export declare const dataContractsFileTmpl: ({ configuration, formatTSContent, excludedDataContractNames, }: DataContractsTmplParams) => Promise<any>;
10
+ //# sourceMappingURL=data-contracts-file.tmpl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data-contracts-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/data-contracts-file.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,qBAAoB;AAK1E,MAAM,WAAW,uBAAwB,SAAQ,SAAS;IACxD,aAAa,EAAE,SAAS,CAAC;IACzB,SAAS,EAAE,sBAAsB,CAAC;IAClC,cAAc,EAAE,cAAc,CAAC;IAC/B,yBAAyB,CAAC,EAAE,MAAM,EAAE,CAAC;CACtC;AAED,eAAO,MAAM,qBAAqB,GAAU,gEAIzC,uBAAuB,iBA6BzB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { AnyObject } from 'yummies/utils/types';
2
- import type { CodegenProcess, GenerateQueryApiParams } from '../index.js';
2
+ import type { CodegenProcess, GenerateQueryApiParams } from "../index.js";
3
3
  export interface DataContractsTmplParams extends AnyObject {
4
4
  configuration: AnyObject;
5
5
  apiParams: GenerateQueryApiParams;
@@ -1 +1 @@
1
- {"version":3,"file":"data-contracts-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/data-contracts-file.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAK1E,MAAM,WAAW,uBAAwB,SAAQ,SAAS;IACxD,aAAa,EAAE,SAAS,CAAC;IACzB,SAAS,EAAE,sBAAsB,CAAC;IAClC,cAAc,EAAE,cAAc,CAAC;IAC/B,yBAAyB,CAAC,EAAE,MAAM,EAAE,CAAC;CACtC;AAED,eAAO,MAAM,qBAAqB,GAAU,gEAIzC,uBAAuB,iBA6BzB,CAAC"}
1
+ {"version":3,"file":"data-contracts-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/data-contracts-file.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,oBAAoB;AAK1E,MAAM,WAAW,uBAAwB,SAAQ,SAAS;IACxD,aAAa,EAAE,SAAS,CAAC;IACzB,SAAS,EAAE,sBAAsB,CAAC;IAClC,cAAc,EAAE,cAAc,CAAC;IAC/B,yBAAyB,CAAC,EAAE,MAAM,EAAE,CAAC;CACtC;AAED,eAAO,MAAM,qBAAqB,GAAU,gEAIzC,uBAAuB,iBA6BzB,CAAC"}
@@ -1,5 +1,5 @@
1
- import { LINTERS_IGNORE } from './constants.js';
2
- import { dataContractTmpl } from './data-contract.tmpl.js';
1
+ import { LINTERS_IGNORE } from "./constants.js";
2
+ import { dataContractTmpl } from "./data-contract.tmpl.js";
3
3
  export const dataContractsFileTmpl = async ({ configuration, formatTSContent, excludedDataContractNames, }) => {
4
4
  const { config, modelTypes } = configuration;
5
5
  const contractDefinitions = [];
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.endpointJSDocTmpl = void 0;
4
+ const text_1 = require("yummies/text");
5
+ const endpointJSDocTmpl = ({ route, configuration, offset = 0, }) => {
6
+ const { routeName } = route;
7
+ const rawRoute = route.raw;
8
+ const routeRequest = route.request;
9
+ const { utils } = configuration;
10
+ const { _, formatDescription } = utils;
11
+ const jsDocLines = [];
12
+ if (rawRoute.summary) {
13
+ const summaryLines = (0, text_1.splitTextByLines)(rawRoute.summary, 60)
14
+ .filter(Boolean)
15
+ .map((line) => ({
16
+ content: `**${formatDescription(line, true)}**`,
17
+ }));
18
+ if (summaryLines.length > 0) {
19
+ jsDocLines.push(...summaryLines, { content: '' });
20
+ }
21
+ }
22
+ if (rawRoute.description) {
23
+ const descriptionLines = (0, text_1.splitTextByLines)(rawRoute.description, 60)
24
+ .filter(Boolean)
25
+ .map((line) => ({
26
+ content: formatDescription(line, true),
27
+ }));
28
+ if (descriptionLines.length > 0) {
29
+ jsDocLines.push(...descriptionLines, { content: '' });
30
+ }
31
+ else {
32
+ jsDocLines.push({
33
+ content: 'No description',
34
+ });
35
+ }
36
+ }
37
+ else {
38
+ jsDocLines.push({
39
+ content: 'No description',
40
+ });
41
+ }
42
+ if (rawRoute.operationId) {
43
+ jsDocLines.push({
44
+ name: 'operationId',
45
+ content: rawRoute.operationId,
46
+ });
47
+ }
48
+ if (_.size(rawRoute.tags)) {
49
+ jsDocLines.push({
50
+ name: 'tags',
51
+ content: rawRoute.tags.join(', '),
52
+ });
53
+ }
54
+ jsDocLines.push({
55
+ name: 'request',
56
+ content: `**${_.upperCase(routeRequest.method)}:${rawRoute.route}**`,
57
+ });
58
+ if (rawRoute.deprecated) {
59
+ jsDocLines.push({
60
+ name: 'deprecated',
61
+ });
62
+ }
63
+ if (routeName.duplicate) {
64
+ jsDocLines.push({
65
+ name: 'duplicate',
66
+ }, {
67
+ name: 'originalName',
68
+ content: routeName.original,
69
+ });
70
+ }
71
+ if (routeRequest.security) {
72
+ jsDocLines.push({
73
+ name: 'secure',
74
+ });
75
+ }
76
+ if (rawRoute.responsesTypes.length > 0) {
77
+ jsDocLines.push({
78
+ name: 'responses',
79
+ });
80
+ rawRoute.responsesTypes.forEach((response) => {
81
+ jsDocLines.push({
82
+ name: `**${response.status}**`,
83
+ content: `${_.replace(_.replace(response.type, /\/\*/g, String.raw `\*`), /\*\//g, '*\\')} ${response.description}`,
84
+ });
85
+ });
86
+ }
87
+ const jsdocContent = jsDocLines.map((it) => {
88
+ let line = ' * ';
89
+ if (it.name) {
90
+ line += `@${it.name} `;
91
+ }
92
+ const content = (it.content ?? '').trimEnd();
93
+ if (content) {
94
+ line += content;
95
+ }
96
+ return line;
97
+ });
98
+ const result = `
99
+ /**
100
+ ${jsdocContent.join('\n')}
101
+ */`;
102
+ if (offset > 0) {
103
+ return result
104
+ .split('\n')
105
+ .map((line) => line.padStart(offset))
106
+ .join('\n');
107
+ }
108
+ return result;
109
+ };
110
+ exports.endpointJSDocTmpl = endpointJSDocTmpl;
@@ -0,0 +1,10 @@
1
+ import type { AnyObject } from 'yummies/utils/types';
2
+ import type { GenerateQueryApiParams } from "../index.cjs";
3
+ export interface EndpointJSDocTmplParams {
4
+ route: AnyObject;
5
+ configuration: AnyObject;
6
+ apiParams: GenerateQueryApiParams;
7
+ offset?: number;
8
+ }
9
+ export declare const endpointJSDocTmpl: ({ route, configuration, offset, }: EndpointJSDocTmplParams) => string;
10
+ //# sourceMappingURL=endpoint-jsdoc.tmpl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoint-jsdoc.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/endpoint-jsdoc.tmpl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EAAE,sBAAsB,EAAE,qBAAoB;AAE1D,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,SAAS,CAAC;IACjB,aAAa,EAAE,SAAS,CAAC;IACzB,SAAS,EAAE,sBAAsB,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,iBAAiB,GAAI,mCAI/B,uBAAuB,WAgIzB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { AnyObject } from 'yummies/utils/types';
2
- import type { GenerateQueryApiParams } from '../index.js';
2
+ import type { GenerateQueryApiParams } from "../index.js";
3
3
  export interface EndpointJSDocTmplParams {
4
4
  route: AnyObject;
5
5
  configuration: AnyObject;
@@ -1 +1 @@
1
- {"version":3,"file":"endpoint-jsdoc.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/endpoint-jsdoc.tmpl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE1D,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,SAAS,CAAC;IACjB,aAAa,EAAE,SAAS,CAAC;IACzB,SAAS,EAAE,sBAAsB,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,iBAAiB,GAAI,mCAI/B,uBAAuB,WAgIzB,CAAC"}
1
+ {"version":3,"file":"endpoint-jsdoc.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/endpoint-jsdoc.tmpl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EAAE,sBAAsB,EAAE,oBAAoB;AAE1D,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,SAAS,CAAC;IACjB,aAAa,EAAE,SAAS,CAAC;IACzB,SAAS,EAAE,sBAAsB,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,iBAAiB,GAAI,mCAI/B,uBAAuB,WAgIzB,CAAC"}
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.endpointPerFileTmpl = void 0;
4
+ const constants_js_1 = require("./constants.cjs");
5
+ const data_contract_tmpl_js_1 = require("./data-contract.tmpl.cjs");
6
+ const endpoint_jsdoc_tmpl_js_1 = require("./endpoint-jsdoc.tmpl.cjs");
7
+ const new_endpoint_tmpl_js_1 = require("./new-endpoint.tmpl.cjs");
8
+ const endpointPerFileTmpl = async ({ route, configuration, apiParams, formatTSContent, importFileParams, utils, relativePathDataContracts, groupName, metaInfo, }) => {
9
+ const { _ } = utils;
10
+ const { content: requestInfoInstanceContent, reservedDataContractNames, localModelTypes, } = (0, new_endpoint_tmpl_js_1.newEndpointTmpl)({
11
+ route,
12
+ configuration,
13
+ apiParams,
14
+ importFileParams,
15
+ utils,
16
+ groupName,
17
+ metaInfo,
18
+ });
19
+ const dataContactNames = new Set(Object.keys(configuration.config.swaggerSchema?.components?.schemas).map((schemaName) => utils.formatModelName(schemaName)));
20
+ const dataContractNamesInThisFile = [];
21
+ reservedDataContractNames.forEach((reservedDataContractName) => {
22
+ if (!dataContactNames.has(reservedDataContractName)) {
23
+ dataContractNamesInThisFile.push(reservedDataContractName);
24
+ }
25
+ });
26
+ const extraImportLines = [];
27
+ if (metaInfo) {
28
+ extraImportLines.push(`import { ${[groupName && 'Group', metaInfo?.namespace && 'namespace', 'Tag'].filter(Boolean).join(',')} } from "../${groupName ? '../' : ''}meta-info";`);
29
+ }
30
+ const requestInfoMeta = apiParams.getEndpointMeta?.(route, utils);
31
+ if (requestInfoMeta?.typeNameImportPath && requestInfoMeta.typeName) {
32
+ extraImportLines.push(`import { ${requestInfoMeta.typeName} } from "${requestInfoMeta.typeNameImportPath}";`);
33
+ }
34
+ return {
35
+ reservedDataContractNames: dataContractNamesInThisFile,
36
+ content: await formatTSContent(`${constants_js_1.LINTERS_IGNORE}
37
+ import {
38
+ RequestParams,
39
+ HttpResponse,
40
+ HttpMultistatusResponse,
41
+ } from "${apiParams.libImports?.['mobx-tanstack-query-api'] ?? 'mobx-tanstack-query-api'}";
42
+ import { ${importFileParams.endpoint.exportName} } from "${importFileParams.endpoint.path}";
43
+ import { ${importFileParams.httpClient.exportName} } from "${importFileParams.httpClient.path}";
44
+ import { ${importFileParams.queryClient.exportName} } from "${importFileParams.queryClient.path}";
45
+ ${extraImportLines.join('\n')}
46
+
47
+ ${configuration.modelTypes.length > 0
48
+ ? `
49
+ import { ${configuration.modelTypes
50
+ .map((it) => it.name)
51
+ .filter((it) => !dataContractNamesInThisFile.includes(it))} } from "${relativePathDataContracts}";
52
+ `
53
+ : ''}
54
+
55
+ ${(await Promise.all(dataContractNamesInThisFile.map(async (dataContractName) => {
56
+ const modelType = configuration.modelTypes.find((modelType) => modelType.name === dataContractName);
57
+ if (!modelType) {
58
+ return '';
59
+ }
60
+ const contractType = await (0, data_contract_tmpl_js_1.dataContractTmpl)({
61
+ configuration,
62
+ contract: modelType,
63
+ addExportKeyword: true,
64
+ });
65
+ return contractType;
66
+ })))
67
+ .filter(Boolean)
68
+ .join('\n\n')}
69
+
70
+ ${(await Promise.all(localModelTypes.map(async (modelType) => {
71
+ const contractType = await (0, data_contract_tmpl_js_1.dataContractTmpl)({
72
+ configuration,
73
+ contract: modelType,
74
+ addExportKeyword: true,
75
+ });
76
+ return contractType;
77
+ })))
78
+ .filter(Boolean)
79
+ .join('\n\n')}
80
+
81
+ ${(0, endpoint_jsdoc_tmpl_js_1.endpointJSDocTmpl)({
82
+ route,
83
+ configuration,
84
+ apiParams,
85
+ })}
86
+ export const ${_.camelCase(route.routeName.usage)} = ${requestInfoInstanceContent}
87
+ `),
88
+ };
89
+ };
90
+ exports.endpointPerFileTmpl = endpointPerFileTmpl;