mobx-tanstack-query-api 0.0.65 → 0.0.66

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/codegen/index.js CHANGED
@@ -5,7 +5,7 @@ import { allExportsTmpl } from './templates/all-exports.tmpl.js';
5
5
  import { LINTERS_IGNORE } from './templates/constants.js';
6
6
  import { dataContractsFileTmpl } from './templates/data-contracts-file.tmpl.js';
7
7
  import { endpointPerFileTmpl } from './templates/endpoint-per-file.tmpl.js';
8
- import { indexTsForRequestPerFileTmpl } from './templates/index-ts-for-request-per-file.tmpl.js';
8
+ import { indexTsForEndpointPerFileTmpl } from './templates/index-ts-for-endpoint-per-file.tmpl.js';
9
9
  const __filename = fileURLToPath(import.meta.url);
10
10
  const __dirname = path.dirname(__filename);
11
11
  export const generateApi = async (params) => {
@@ -171,7 +171,7 @@ export const generateApi = async (params) => {
171
171
  path: path.resolve(params.output, 'endpoints'),
172
172
  fileName: 'index.ts',
173
173
  withPrefix: false,
174
- content: await indexTsForRequestPerFileTmpl({
174
+ content: await indexTsForEndpointPerFileTmpl({
175
175
  ...generated,
176
176
  apiParams: params,
177
177
  codegenProcess,
@@ -252,7 +252,7 @@ export * as ${exportGroupName} from './endpoints';
252
252
  path: path.resolve(params.output, _.kebabCase(groupName), 'endpoints'),
253
253
  fileName: 'index.ts',
254
254
  withPrefix: false,
255
- content: await indexTsForRequestPerFileTmpl({
255
+ content: await indexTsForEndpointPerFileTmpl({
256
256
  ...generated,
257
257
  apiParams: params,
258
258
  codegenProcess,
@@ -7,5 +7,6 @@ export interface AllExportsTmplParams {
7
7
  namespace?: Maybe<string>;
8
8
  utils: CodegenDataUtils;
9
9
  }
10
- export declare const allExportsTmpl: ({ collectedExportFiles, groupNames, namespace, utils: { _ }, formatTSContent, }: AllExportsTmplParams) => Promise<string>;
10
+ export declare const formatGroupNameEnumKey: (groupName: string, { _ }: CodegenDataUtils) => Capitalize<string>;
11
+ export declare const allExportsTmpl: ({ collectedExportFiles, groupNames, namespace, utils, formatTSContent, }: AllExportsTmplParams) => Promise<string>;
11
12
  //# sourceMappingURL=all-exports.tmpl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"all-exports.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/all-exports.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAI/C,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,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,KAAK,EAAE,gBAAgB,CAAC;CACzB;AAED,eAAO,MAAM,cAAc,GAAU,iFAMlC,oBAAoB,oBAgBtB,CAAC"}
1
+ {"version":3,"file":"all-exports.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/all-exports.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAI/C,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,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,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,0EAMlC,oBAAoB,oBAgBtB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import { LINTERS_IGNORE } from './constants.js';
2
- export const allExportsTmpl = async ({ collectedExportFiles, groupNames, namespace, utils: { _ }, formatTSContent, }) => {
2
+ export const formatGroupNameEnumKey = (groupName, { _ }) => _.upperFirst(_.camelCase(groupName));
3
+ export const allExportsTmpl = async ({ collectedExportFiles, groupNames, namespace, utils, formatTSContent, }) => {
3
4
  return await formatTSContent(`${LINTERS_IGNORE}
4
5
  export * from './data-contracts';
5
6
  ${collectedExportFiles.map((fileName) => `export * from './${fileName}';`).join('\n')}
@@ -8,7 +9,7 @@ export const allExportsTmpl = async ({ collectedExportFiles, groupNames, namespa
8
9
  ${groupNames?.length
9
10
  ? `
10
11
  export const enum Group {
11
- ${groupNames.map((groupName) => `${_.upperFirst(_.camelCase(groupName))} = "${groupName}"`).join(',\n')}
12
+ ${groupNames.map((groupName) => `${formatGroupNameEnumKey(groupName, utils)} = "${groupName}"`).join(',\n')}
12
13
  }
13
14
  `
14
15
  : ''}
@@ -1 +1 @@
1
- {"version":3,"file":"endpoint-per-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/endpoint-per-file.tmpl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAOrB,MAAM,WAAW,yBAA0B,SAAQ,SAAS;IAC1D,KAAK,EAAE,SAAS,CAAC;IACjB,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,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC1B;AAED,eAAO,MAAM,mBAAmB,GAAU,iIAUvC,yBAAyB;;;EAuG3B,CAAC"}
1
+ {"version":3,"file":"endpoint-per-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/endpoint-per-file.tmpl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAOrB,MAAM,WAAW,yBAA0B,SAAQ,SAAS;IAC1D,KAAK,EAAE,SAAS,CAAC;IACjB,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,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC1B;AAED,eAAO,MAAM,mBAAmB,GAAU,iIAUvC,yBAAyB;;;EAyG3B,CAAC"}
@@ -31,6 +31,8 @@ export const endpointPerFileTmpl = async ({ route, configuration, apiParams, for
31
31
  import { ${importFileParams.endpoint.exportName} } from "${importFileParams.endpoint.path}";
32
32
  import { ${importFileParams.httpClient.exportName} } from "${importFileParams.httpClient.path}";
33
33
  import { ${importFileParams.queryClient.exportName} } from "${importFileParams.queryClient.path}";
34
+ import { ${[groupName && 'Group', namespace && 'namespace'].filter(Boolean).join(',')} } from "../../__exports";
35
+
34
36
  ${configuration.modelTypes.length > 0
35
37
  ? `
36
38
  import { ${configuration.modelTypes
@@ -0,0 +1,10 @@
1
+ import { AnyObject } from 'yummies/utils/types';
2
+ import { CodegenProcess, GenerateQueryApiParams } from '../index.js';
3
+ export interface IndexTsForEndpointPerFileTmplParams extends AnyObject {
4
+ configuration: AnyObject;
5
+ apiParams: GenerateQueryApiParams;
6
+ codegenProcess: CodegenProcess;
7
+ generatedRequestFileNames: string[];
8
+ }
9
+ export declare const indexTsForEndpointPerFileTmpl: ({ generatedRequestFileNames, }: IndexTsForEndpointPerFileTmplParams) => Promise<string>;
10
+ //# sourceMappingURL=index-ts-for-endpoint-per-file.tmpl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-ts-for-endpoint-per-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/index-ts-for-endpoint-per-file.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAIrE,MAAM,WAAW,mCAAoC,SAAQ,SAAS;IACpE,aAAa,EAAE,SAAS,CAAC;IACzB,SAAS,EAAE,sBAAsB,CAAC;IAClC,cAAc,EAAE,cAAc,CAAC;IAC/B,yBAAyB,EAAE,MAAM,EAAE,CAAC;CACrC;AAED,eAAO,MAAM,6BAA6B,GAAU,gCAEjD,mCAAmC,oBAIrC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { LINTERS_IGNORE } from './constants.js';
2
- export const indexTsForRequestPerFileTmpl = async ({ generatedRequestFileNames, }) => {
2
+ export const indexTsForEndpointPerFileTmpl = async ({ generatedRequestFileNames, }) => {
3
3
  return `${LINTERS_IGNORE}
4
4
  ${generatedRequestFileNames.map((fileName) => `export * from './${fileName.replace('.ts', '')}';`).join('\n')}
5
5
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"new-endpoint.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/new-endpoint.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,SAAS,CAAC;IACjB,aAAa,EAAE,SAAS,CAAC;IACzB,SAAS,EAAE,sBAAsB,CAAC;IAClC,gBAAgB,EAAE,mBAAmB,CAAC;IACtC,KAAK,EAAE,gBAAgB,CAAC;IACxB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC3B;AAiBD,eAAO,MAAM,eAAe,GAAI,sEAO7B,qBAAqB;;;;;;;;CAwMvB,CAAC"}
1
+ {"version":3,"file":"new-endpoint.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/new-endpoint.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAIrB,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,SAAS,CAAC;IACjB,aAAa,EAAE,SAAS,CAAC;IACzB,SAAS,EAAE,sBAAsB,CAAC;IAClC,gBAAgB,EAAE,mBAAmB,CAAC;IACtC,KAAK,EAAE,gBAAgB,CAAC;IACxB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC3B;AAiBD,eAAO,MAAM,eAAe,GAAI,sEAO7B,qBAAqB;;;;;;;;CAwMvB,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { formatGroupNameEnumKey } from './all-exports.tmpl.js';
1
2
  // RequestParams["type"]
2
3
  const requestContentKind = {
3
4
  URL_ENCODED: '"application/x-www-form-urlencoded"',
@@ -152,8 +153,8 @@ new ${importFileParams.endpoint.exportName}<
152
153
  .filter(Boolean)
153
154
  .map((it) => `"${it}"`)}],
154
155
  tags: [${tags.map((tag) => `"${tag}"`)}],
155
- ${groupName ? `group: "${groupName}",` : ''}
156
- ${namespace ? `namespace: "${namespace}",` : ''}
156
+ ${groupName ? `group: Group.${formatGroupNameEnumKey(groupName, utils)},` : ''}
157
+ ${namespace ? `namespace,` : ''}
157
158
  meta: ${requestInfoMeta?.tmplData ?? '{} as any'},
158
159
  },
159
160
  ${importFileParams.queryClient.exportName},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobx-tanstack-query-api",
3
- "version": "0.0.65",
3
+ "version": "0.0.66",
4
4
  "keywords": [],
5
5
  "author": "js2me",
6
6
  "license": "MIT",
@@ -97,10 +97,10 @@
97
97
  "default": "./codegen/templates/endpoint-per-file.tmpl.js",
98
98
  "types": "./codegen/templates/endpoint-per-file.tmpl.d.ts"
99
99
  },
100
- "./codegen/templates/index-ts-for-request-per-file.tmpl": {
101
- "import": "./codegen/templates/index-ts-for-request-per-file.tmpl.js",
102
- "default": "./codegen/templates/index-ts-for-request-per-file.tmpl.js",
103
- "types": "./codegen/templates/index-ts-for-request-per-file.tmpl.d.ts"
100
+ "./codegen/templates/index-ts-for-endpoint-per-file.tmpl": {
101
+ "import": "./codegen/templates/index-ts-for-endpoint-per-file.tmpl.js",
102
+ "default": "./codegen/templates/index-ts-for-endpoint-per-file.tmpl.js",
103
+ "types": "./codegen/templates/index-ts-for-endpoint-per-file.tmpl.d.ts"
104
104
  },
105
105
  "./codegen/templates/new-endpoint.tmpl": {
106
106
  "import": "./codegen/templates/new-endpoint.tmpl.js",
@@ -1,10 +0,0 @@
1
- import { AnyObject } from 'yummies/utils/types';
2
- import { CodegenProcess, GenerateQueryApiParams } from '../index.js';
3
- export interface IndexTsForRequestPerFileTmplParams extends AnyObject {
4
- configuration: AnyObject;
5
- apiParams: GenerateQueryApiParams;
6
- codegenProcess: CodegenProcess;
7
- generatedRequestFileNames: string[];
8
- }
9
- export declare const indexTsForRequestPerFileTmpl: ({ generatedRequestFileNames, }: IndexTsForRequestPerFileTmplParams) => Promise<string>;
10
- //# sourceMappingURL=index-ts-for-request-per-file.tmpl.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-ts-for-request-per-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/index-ts-for-request-per-file.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAIrE,MAAM,WAAW,kCAAmC,SAAQ,SAAS;IACnE,aAAa,EAAE,SAAS,CAAC;IACzB,SAAS,EAAE,sBAAsB,CAAC;IAClC,cAAc,EAAE,cAAc,CAAC;IAC/B,yBAAyB,EAAE,MAAM,EAAE,CAAC;CACrC;AAED,eAAO,MAAM,4BAA4B,GAAU,gCAEhD,kCAAkC,oBAIpC,CAAC"}