mobx-tanstack-query-api 0.25.0 → 0.26.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.
- package/bin.cjs +53 -0
- package/bin.cjs.map +1 -0
- package/bin.d.ts +1 -0
- package/bin.js +51 -0
- package/bin.js.map +1 -0
- package/builtin.cjs +27 -0
- package/builtin.cjs.map +1 -0
- package/builtin.d.ts +6 -0
- package/builtin.js +27 -0
- package/builtin.js.map +1 -0
- package/cli.cjs +1278 -0
- package/cli.cjs.map +1 -0
- package/{codegen/types/generate-query-api-params.d.cts → cli.d.ts} +54 -10
- package/cli.js +1277 -0
- package/cli.js.map +1 -0
- package/index.cjs +771 -16
- package/index.cjs.map +1 -0
- package/index.d.ts +322 -2
- package/index.js +768 -2
- package/index.js.map +1 -0
- package/package.json +25 -62
- package/builtin/index.cjs +0 -25
- package/builtin/index.d.cts +0 -4
- package/builtin/index.d.cts.map +0 -1
- package/builtin/index.d.ts +0 -4
- package/builtin/index.d.ts.map +0 -1
- package/builtin/index.js +0 -22
- package/cli/bin.cjs +0 -17
- package/cli/bin.d.cts +0 -2
- package/cli/bin.d.cts.map +0 -1
- package/cli/bin.d.ts +0 -2
- package/cli/bin.d.ts.map +0 -1
- package/cli/bin.js +0 -15
- package/cli/index.cjs +0 -18
- package/cli/index.d.cts +0 -3
- package/cli/index.d.cts.map +0 -1
- package/cli/index.d.ts +0 -3
- package/cli/index.d.ts.map +0 -1
- package/cli/index.js +0 -2
- package/cli/utils/define-config.cjs +0 -9
- package/cli/utils/define-config.d.cts +0 -4
- package/cli/utils/define-config.d.cts.map +0 -1
- package/cli/utils/define-config.d.ts +0 -4
- package/cli/utils/define-config.d.ts.map +0 -1
- package/cli/utils/define-config.js +0 -5
- package/cli/utils/exec-config-path.cjs +0 -16
- package/cli/utils/exec-config-path.d.cts +0 -2
- package/cli/utils/exec-config-path.d.cts.map +0 -1
- package/cli/utils/exec-config-path.d.ts +0 -2
- package/cli/utils/exec-config-path.d.ts.map +0 -1
- package/cli/utils/exec-config-path.js +0 -12
- package/cli/utils/resolve-config-path.cjs +0 -65
- package/cli/utils/resolve-config-path.d.cts +0 -3
- package/cli/utils/resolve-config-path.d.cts.map +0 -1
- package/cli/utils/resolve-config-path.d.ts +0 -3
- package/cli/utils/resolve-config-path.d.ts.map +0 -1
- package/cli/utils/resolve-config-path.js +0 -25
- package/codegen/index.cjs +0 -545
- package/codegen/index.d.cts +0 -4
- package/codegen/index.d.cts.map +0 -1
- package/codegen/index.d.ts +0 -4
- package/codegen/index.d.ts.map +0 -1
- package/codegen/index.js +0 -524
- package/codegen/templates/all-endpoints-per-file.tmpl.cjs +0 -94
- package/codegen/templates/all-endpoints-per-file.tmpl.d.cts +0 -14
- package/codegen/templates/all-endpoints-per-file.tmpl.d.cts.map +0 -1
- package/codegen/templates/all-endpoints-per-file.tmpl.d.ts +0 -14
- package/codegen/templates/all-endpoints-per-file.tmpl.d.ts.map +0 -1
- package/codegen/templates/all-endpoints-per-file.tmpl.js +0 -90
- package/codegen/templates/all-exports.tmpl.cjs +0 -14
- package/codegen/templates/all-exports.tmpl.d.cts +0 -9
- package/codegen/templates/all-exports.tmpl.d.cts.map +0 -1
- package/codegen/templates/all-exports.tmpl.d.ts +0 -9
- package/codegen/templates/all-exports.tmpl.d.ts.map +0 -1
- package/codegen/templates/all-exports.tmpl.js +0 -9
- package/codegen/templates/constants.cjs +0 -5
- package/codegen/templates/constants.d.cts +0 -2
- package/codegen/templates/constants.d.cts.map +0 -1
- package/codegen/templates/constants.d.ts +0 -2
- package/codegen/templates/constants.d.ts.map +0 -1
- package/codegen/templates/constants.js +0 -2
- package/codegen/templates/data-contract.tmpl.cjs +0 -49
- package/codegen/templates/data-contract.tmpl.d.cts +0 -8
- package/codegen/templates/data-contract.tmpl.d.cts.map +0 -1
- package/codegen/templates/data-contract.tmpl.d.ts +0 -8
- package/codegen/templates/data-contract.tmpl.d.ts.map +0 -1
- package/codegen/templates/data-contract.tmpl.js +0 -45
- package/codegen/templates/data-contracts-file.tmpl.cjs +0 -27
- package/codegen/templates/data-contracts-file.tmpl.d.cts +0 -6
- package/codegen/templates/data-contracts-file.tmpl.d.cts.map +0 -1
- package/codegen/templates/data-contracts-file.tmpl.d.ts +0 -6
- package/codegen/templates/data-contracts-file.tmpl.d.ts.map +0 -1
- package/codegen/templates/data-contracts-file.tmpl.js +0 -23
- package/codegen/templates/endpoint-jsdoc.tmpl.cjs +0 -111
- package/codegen/templates/endpoint-jsdoc.tmpl.d.cts +0 -8
- package/codegen/templates/endpoint-jsdoc.tmpl.d.cts.map +0 -1
- package/codegen/templates/endpoint-jsdoc.tmpl.d.ts +0 -8
- package/codegen/templates/endpoint-jsdoc.tmpl.d.ts.map +0 -1
- package/codegen/templates/endpoint-jsdoc.tmpl.js +0 -107
- package/codegen/templates/endpoint-per-file.tmpl.cjs +0 -87
- package/codegen/templates/endpoint-per-file.tmpl.d.cts +0 -14
- package/codegen/templates/endpoint-per-file.tmpl.d.cts.map +0 -1
- package/codegen/templates/endpoint-per-file.tmpl.d.ts +0 -14
- package/codegen/templates/endpoint-per-file.tmpl.d.ts.map +0 -1
- package/codegen/templates/endpoint-per-file.tmpl.js +0 -83
- package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.cjs +0 -10
- package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.d.cts +0 -6
- package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.d.cts.map +0 -1
- package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.d.ts +0 -6
- package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.d.ts.map +0 -1
- package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.js +0 -6
- package/codegen/templates/meta-info.tmpl.cjs +0 -48
- package/codegen/templates/meta-info.tmpl.d.cts +0 -9
- package/codegen/templates/meta-info.tmpl.d.cts.map +0 -1
- package/codegen/templates/meta-info.tmpl.d.ts +0 -9
- package/codegen/templates/meta-info.tmpl.d.ts.map +0 -1
- package/codegen/templates/meta-info.tmpl.js +0 -42
- package/codegen/templates/new-endpoint.tmpl.cjs +0 -188
- package/codegen/templates/new-endpoint.tmpl.d.cts +0 -15
- package/codegen/templates/new-endpoint.tmpl.d.cts.map +0 -1
- package/codegen/templates/new-endpoint.tmpl.d.ts +0 -15
- package/codegen/templates/new-endpoint.tmpl.d.ts.map +0 -1
- package/codegen/templates/new-endpoint.tmpl.js +0 -184
- package/codegen/types/all-import-file-params.cjs +0 -2
- package/codegen/types/all-import-file-params.d.cts +0 -5
- package/codegen/types/all-import-file-params.d.cts.map +0 -1
- package/codegen/types/all-import-file-params.d.ts +0 -5
- package/codegen/types/all-import-file-params.d.ts.map +0 -1
- package/codegen/types/all-import-file-params.js +0 -1
- package/codegen/types/base-tmpl-params.cjs +0 -2
- package/codegen/types/base-tmpl-params.d.cts +0 -16
- package/codegen/types/base-tmpl-params.d.cts.map +0 -1
- package/codegen/types/base-tmpl-params.d.ts +0 -16
- package/codegen/types/base-tmpl-params.d.ts.map +0 -1
- package/codegen/types/base-tmpl-params.js +0 -1
- package/codegen/types/codegen-data-utils.cjs +0 -2
- package/codegen/types/codegen-data-utils.d.cts +0 -8
- package/codegen/types/codegen-data-utils.d.cts.map +0 -1
- package/codegen/types/codegen-data-utils.d.ts +0 -8
- package/codegen/types/codegen-data-utils.d.ts.map +0 -1
- package/codegen/types/codegen-data-utils.js +0 -1
- package/codegen/types/endpoint-data.cjs +0 -2
- package/codegen/types/endpoint-data.d.cts +0 -3
- package/codegen/types/endpoint-data.d.cts.map +0 -1
- package/codegen/types/endpoint-data.d.ts +0 -3
- package/codegen/types/endpoint-data.d.ts.map +0 -1
- package/codegen/types/endpoint-data.js +0 -1
- package/codegen/types/generate-query-api-params.cjs +0 -2
- package/codegen/types/generate-query-api-params.d.cts.map +0 -1
- package/codegen/types/generate-query-api-params.d.ts +0 -162
- package/codegen/types/generate-query-api-params.d.ts.map +0 -1
- package/codegen/types/generate-query-api-params.js +0 -1
- package/codegen/types/import-file-params.cjs +0 -2
- package/codegen/types/import-file-params.d.cts +0 -5
- package/codegen/types/import-file-params.d.cts.map +0 -1
- package/codegen/types/import-file-params.d.ts +0 -5
- package/codegen/types/import-file-params.d.ts.map +0 -1
- package/codegen/types/import-file-params.js +0 -1
- package/codegen/types/index.cjs +0 -23
- package/codegen/types/index.d.cts +0 -8
- package/codegen/types/index.d.cts.map +0 -1
- package/codegen/types/index.d.ts +0 -8
- package/codegen/types/index.d.ts.map +0 -1
- package/codegen/types/index.js +0 -7
- package/codegen/types/meta-info.cjs +0 -2
- package/codegen/types/meta-info.d.cts +0 -6
- package/codegen/types/meta-info.d.cts.map +0 -1
- package/codegen/types/meta-info.d.ts +0 -6
- package/codegen/types/meta-info.d.ts.map +0 -1
- package/codegen/types/meta-info.js +0 -1
- package/codegen/types/type-info.cjs +0 -2
- package/codegen/types/type-info.d.cts +0 -4
- package/codegen/types/type-info.d.cts.map +0 -1
- package/codegen/types/type-info.d.ts +0 -4
- package/codegen/types/type-info.d.ts.map +0 -1
- package/codegen/types/type-info.js +0 -1
- package/codegen/utils/create-short-model-type.cjs +0 -12
- package/codegen/utils/create-short-model-type.d.cts +0 -5
- package/codegen/utils/create-short-model-type.d.cts.map +0 -1
- package/codegen/utils/create-short-model-type.d.ts +0 -5
- package/codegen/utils/create-short-model-type.d.ts.map +0 -1
- package/codegen/utils/create-short-model-type.js +0 -8
- package/codegen/utils/remove-unused-types.cjs +0 -117
- package/codegen/utils/remove-unused-types.d.cts +0 -7
- package/codegen/utils/remove-unused-types.d.cts.map +0 -1
- package/codegen/utils/remove-unused-types.d.ts +0 -7
- package/codegen/utils/remove-unused-types.d.ts.map +0 -1
- package/codegen/utils/remove-unused-types.js +0 -110
- package/codegen/utils/unpack-filter-option.cjs +0 -23
- package/codegen/utils/unpack-filter-option.d.cts +0 -7
- package/codegen/utils/unpack-filter-option.d.cts.map +0 -1
- package/codegen/utils/unpack-filter-option.d.ts +0 -7
- package/codegen/utils/unpack-filter-option.d.ts.map +0 -1
- package/codegen/utils/unpack-filter-option.js +0 -19
- package/index.d.cts +0 -3
- package/index.d.cts.map +0 -1
- package/index.d.ts.map +0 -1
- package/runtime/endpoint-infinite-query.cjs +0 -101
- package/runtime/endpoint-infinite-query.d.cts +0 -17
- package/runtime/endpoint-infinite-query.d.cts.map +0 -1
- package/runtime/endpoint-infinite-query.d.ts +0 -17
- package/runtime/endpoint-infinite-query.d.ts.map +0 -1
- package/runtime/endpoint-infinite-query.js +0 -97
- package/runtime/endpoint-infinite-query.types.cjs +0 -2
- package/runtime/endpoint-infinite-query.types.d.cts +0 -30
- package/runtime/endpoint-infinite-query.types.d.cts.map +0 -1
- package/runtime/endpoint-infinite-query.types.d.ts +0 -30
- package/runtime/endpoint-infinite-query.types.d.ts.map +0 -1
- package/runtime/endpoint-infinite-query.types.js +0 -1
- package/runtime/endpoint-mutation.cjs +0 -74
- package/runtime/endpoint-mutation.d.cts +0 -13
- package/runtime/endpoint-mutation.d.cts.map +0 -1
- package/runtime/endpoint-mutation.d.ts +0 -13
- package/runtime/endpoint-mutation.d.ts.map +0 -1
- package/runtime/endpoint-mutation.js +0 -70
- package/runtime/endpoint-mutation.types.cjs +0 -2
- package/runtime/endpoint-mutation.types.d.cts +0 -36
- package/runtime/endpoint-mutation.types.d.cts.map +0 -1
- package/runtime/endpoint-mutation.types.d.ts +0 -36
- package/runtime/endpoint-mutation.types.d.ts.map +0 -1
- package/runtime/endpoint-mutation.types.js +0 -1
- package/runtime/endpoint-query-client.cjs +0 -79
- package/runtime/endpoint-query-client.d.cts +0 -13
- package/runtime/endpoint-query-client.d.cts.map +0 -1
- package/runtime/endpoint-query-client.d.ts +0 -13
- package/runtime/endpoint-query-client.d.ts.map +0 -1
- package/runtime/endpoint-query-client.js +0 -75
- package/runtime/endpoint-query-client.types.cjs +0 -2
- package/runtime/endpoint-query-client.types.d.cts +0 -16
- package/runtime/endpoint-query-client.types.d.cts.map +0 -1
- package/runtime/endpoint-query-client.types.d.ts +0 -16
- package/runtime/endpoint-query-client.types.d.ts.map +0 -1
- package/runtime/endpoint-query-client.types.js +0 -1
- package/runtime/endpoint-query.cjs +0 -214
- package/runtime/endpoint-query.d.cts +0 -29
- package/runtime/endpoint-query.d.cts.map +0 -1
- package/runtime/endpoint-query.d.ts +0 -29
- package/runtime/endpoint-query.d.ts.map +0 -1
- package/runtime/endpoint-query.js +0 -208
- package/runtime/endpoint-query.types.cjs +0 -2
- package/runtime/endpoint-query.types.d.cts +0 -42
- package/runtime/endpoint-query.types.d.cts.map +0 -1
- package/runtime/endpoint-query.types.d.ts +0 -42
- package/runtime/endpoint-query.types.d.ts.map +0 -1
- package/runtime/endpoint-query.types.js +0 -1
- package/runtime/endpoint.cjs +0 -131
- package/runtime/endpoint.d.cts +0 -73
- package/runtime/endpoint.d.cts.map +0 -1
- package/runtime/endpoint.d.ts +0 -73
- package/runtime/endpoint.d.ts.map +0 -1
- package/runtime/endpoint.js +0 -127
- package/runtime/endpoint.types.cjs +0 -2
- package/runtime/endpoint.types.d.cts +0 -24
- package/runtime/endpoint.types.d.cts.map +0 -1
- package/runtime/endpoint.types.d.ts +0 -24
- package/runtime/endpoint.types.d.ts.map +0 -1
- package/runtime/endpoint.types.js +0 -1
- package/runtime/http-client.cjs +0 -190
- package/runtime/http-client.d.cts +0 -85
- package/runtime/http-client.d.cts.map +0 -1
- package/runtime/http-client.d.ts +0 -85
- package/runtime/http-client.d.ts.map +0 -1
- package/runtime/http-client.js +0 -184
- package/runtime/index.cjs +0 -25
- package/runtime/index.d.cts +0 -10
- package/runtime/index.d.cts.map +0 -1
- package/runtime/index.d.ts +0 -10
- package/runtime/index.d.ts.map +0 -1
- package/runtime/index.js +0 -9
package/bin.cjs
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
const cac = require("cac");
|
|
4
|
+
const cli$1 = require("mobx-tanstack-query-api/cli");
|
|
5
|
+
const jiti = require("jiti");
|
|
6
|
+
const fs = require("node:fs");
|
|
7
|
+
const path = require("node:path");
|
|
8
|
+
var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
|
|
9
|
+
const execConfigPath = async (configPath) => {
|
|
10
|
+
const jiti$1 = jiti.createJiti(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("bin.cjs", document.baseURI).href);
|
|
11
|
+
try {
|
|
12
|
+
const config = await jiti$1.import(configPath, { default: true });
|
|
13
|
+
return config;
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.error(error);
|
|
16
|
+
}
|
|
17
|
+
throw new Error(
|
|
18
|
+
`${configPath} is not valid, This file should return object - result of the defineConfig function`
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
const projectDir = process.cwd();
|
|
22
|
+
const resolveConfigPath = (userSpefiedPath) => {
|
|
23
|
+
if (userSpefiedPath) {
|
|
24
|
+
const fullUserSpecifiedPath = path.resolve(projectDir, userSpefiedPath);
|
|
25
|
+
if (!fs.existsSync(fullUserSpecifiedPath)) {
|
|
26
|
+
throw `Config file not found by path - ${userSpefiedPath}`;
|
|
27
|
+
}
|
|
28
|
+
return path.resolve(projectDir, userSpefiedPath);
|
|
29
|
+
}
|
|
30
|
+
if (fs.existsSync(path.resolve(projectDir, "api-codegen.config.js"))) {
|
|
31
|
+
return path.resolve(projectDir, "api-codegen.config.js");
|
|
32
|
+
} else if (fs.existsSync(path.resolve(projectDir, "api-codegen.config.mjs"))) {
|
|
33
|
+
return path.resolve(projectDir, "api-codegen.config.mjs");
|
|
34
|
+
} else if (fs.existsSync(path.resolve(projectDir, "api-codegen.config.json"))) {
|
|
35
|
+
return path.resolve(projectDir, "api-codegen.config.json");
|
|
36
|
+
} else if (fs.existsSync(path.resolve(projectDir, "api-codegen.config.ts"))) {
|
|
37
|
+
return path.resolve(projectDir, "api-codegen.config.ts");
|
|
38
|
+
}
|
|
39
|
+
throw new Error("api-codegen.config.(js|mjs|json|ts) not found");
|
|
40
|
+
};
|
|
41
|
+
let cli = cac.cac("mobx-tanstack-query-api");
|
|
42
|
+
cli = cli.option("-c, --config <file>", `[string] use specified config file`);
|
|
43
|
+
cli.help();
|
|
44
|
+
const parsed = cli.parse();
|
|
45
|
+
if (!parsed.options.help) {
|
|
46
|
+
const configPath = resolveConfigPath(
|
|
47
|
+
typeof parsed.options.config === "string" ? parsed.options.config : null
|
|
48
|
+
);
|
|
49
|
+
execConfigPath(configPath).then((generateApiParams) => {
|
|
50
|
+
cli$1.defineConfig(generateApiParams).forEach(cli$1.generateApi);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=bin.cjs.map
|
package/bin.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.cjs","sources":["../src/bin/utils/exec-config-path.ts","../src/bin/utils/resolve-config-path.ts","../src/bin/index.ts"],"sourcesContent":["import { createJiti } from 'jiti';\n\nexport const execConfigPath = async (configPath: string) => {\n const jiti = createJiti(import.meta.url);\n\n try {\n const config = await jiti.import(configPath, { default: true });\n return config;\n } catch (error) {\n console.error(error);\n }\n\n throw new Error(\n `${configPath} is not valid, This file should return object - result of the defineConfig function`,\n );\n};\n","import fs, { existsSync } from 'node:fs';\nimport path from 'node:path';\nimport type { Maybe } from 'yummies/types';\n\nconst projectDir = process.cwd();\n\nexport const resolveConfigPath = (userSpefiedPath?: Maybe<string>) => {\n if (userSpefiedPath) {\n const fullUserSpecifiedPath = path.resolve(projectDir, userSpefiedPath);\n\n if (!fs.existsSync(fullUserSpecifiedPath)) {\n throw `Config file not found by path - ${userSpefiedPath}`;\n }\n\n return path.resolve(projectDir, userSpefiedPath);\n }\n\n if (existsSync(path.resolve(projectDir, 'api-codegen.config.js'))) {\n return path.resolve(projectDir, 'api-codegen.config.js');\n } else if (existsSync(path.resolve(projectDir, 'api-codegen.config.mjs'))) {\n return path.resolve(projectDir, 'api-codegen.config.mjs');\n } else if (existsSync(path.resolve(projectDir, 'api-codegen.config.json'))) {\n return path.resolve(projectDir, 'api-codegen.config.json');\n } else if (existsSync(path.resolve(projectDir, 'api-codegen.config.ts'))) {\n return path.resolve(projectDir, 'api-codegen.config.ts');\n }\n\n throw new Error('api-codegen.config.(js|mjs|json|ts) not found');\n};\n","#!/usr/bin/env node\nimport { cac } from 'cac';\nimport { defineConfig, generateApi } from 'mobx-tanstack-query-api/cli';\nimport { execConfigPath } from './utils/exec-config-path.js';\nimport { resolveConfigPath } from './utils/resolve-config-path.js';\n\nlet cli = cac('mobx-tanstack-query-api');\n\ncli = cli.option('-c, --config <file>', `[string] use specified config file`);\n\ncli.help();\n\nconst parsed = cli.parse();\n\nif (!parsed.options.help) {\n const configPath = resolveConfigPath(\n typeof parsed.options.config === 'string' ? parsed.options.config : null,\n );\n\n execConfigPath(configPath).then((generateApiParams) => {\n defineConfig(generateApiParams as any).forEach(generateApi);\n });\n}\n"],"names":["jiti","createJiti","existsSync","cac","defineConfig","generateApi"],"mappings":";;;;;;;;AAEO,MAAM,iBAAiB,OAAO,eAAuB;AAC1D,QAAMA,SAAOC,KAAAA,2PAA0B;AAEvC,MAAI;AACF,UAAM,SAAS,MAAMD,OAAK,OAAO,YAAY,EAAE,SAAS,MAAM;AAC9D,WAAO;AAAA,EACT,SAAS,OAAO;AACd,YAAQ,MAAM,KAAK;AAAA,EACrB;AAEA,QAAM,IAAI;AAAA,IACR,GAAG,UAAU;AAAA,EAAA;AAEjB;ACXA,MAAM,aAAa,QAAQ,IAAA;AAEpB,MAAM,oBAAoB,CAAC,oBAAoC;AACpE,MAAI,iBAAiB;AACnB,UAAM,wBAAwB,KAAK,QAAQ,YAAY,eAAe;AAEtE,QAAI,CAAC,GAAG,WAAW,qBAAqB,GAAG;AACzC,YAAM,mCAAmC,eAAe;AAAA,IAC1D;AAEA,WAAO,KAAK,QAAQ,YAAY,eAAe;AAAA,EACjD;AAEA,MAAIE,GAAAA,WAAW,KAAK,QAAQ,YAAY,uBAAuB,CAAC,GAAG;AACjE,WAAO,KAAK,QAAQ,YAAY,uBAAuB;AAAA,EACzD,WAAWA,GAAAA,WAAW,KAAK,QAAQ,YAAY,wBAAwB,CAAC,GAAG;AACzE,WAAO,KAAK,QAAQ,YAAY,wBAAwB;AAAA,EAC1D,WAAWA,GAAAA,WAAW,KAAK,QAAQ,YAAY,yBAAyB,CAAC,GAAG;AAC1E,WAAO,KAAK,QAAQ,YAAY,yBAAyB;AAAA,EAC3D,WAAWA,GAAAA,WAAW,KAAK,QAAQ,YAAY,uBAAuB,CAAC,GAAG;AACxE,WAAO,KAAK,QAAQ,YAAY,uBAAuB;AAAA,EACzD;AAEA,QAAM,IAAI,MAAM,+CAA+C;AACjE;ACtBA,IAAI,MAAMC,IAAAA,IAAI,yBAAyB;AAEvC,MAAM,IAAI,OAAO,uBAAuB,oCAAoC;AAE5E,IAAI,KAAA;AAEJ,MAAM,SAAS,IAAI,MAAA;AAEnB,IAAI,CAAC,OAAO,QAAQ,MAAM;AACxB,QAAM,aAAa;AAAA,IACjB,OAAO,OAAO,QAAQ,WAAW,WAAW,OAAO,QAAQ,SAAS;AAAA,EAAA;AAGtE,iBAAe,UAAU,EAAE,KAAK,CAAC,sBAAsB;AACrDC,UAAAA,aAAa,iBAAwB,EAAE,QAAQC,iBAAW;AAAA,EAC5D,CAAC;AACH;"}
|
package/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/bin.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { cac } from "cac";
|
|
3
|
+
import { defineConfig, generateApi } from "mobx-tanstack-query-api/cli";
|
|
4
|
+
import { createJiti } from "jiti";
|
|
5
|
+
import fs, { existsSync } from "node:fs";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
const execConfigPath = async (configPath) => {
|
|
8
|
+
const jiti = createJiti(import.meta.url);
|
|
9
|
+
try {
|
|
10
|
+
const config = await jiti.import(configPath, { default: true });
|
|
11
|
+
return config;
|
|
12
|
+
} catch (error) {
|
|
13
|
+
console.error(error);
|
|
14
|
+
}
|
|
15
|
+
throw new Error(
|
|
16
|
+
`${configPath} is not valid, This file should return object - result of the defineConfig function`
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
const projectDir = process.cwd();
|
|
20
|
+
const resolveConfigPath = (userSpefiedPath) => {
|
|
21
|
+
if (userSpefiedPath) {
|
|
22
|
+
const fullUserSpecifiedPath = path.resolve(projectDir, userSpefiedPath);
|
|
23
|
+
if (!fs.existsSync(fullUserSpecifiedPath)) {
|
|
24
|
+
throw `Config file not found by path - ${userSpefiedPath}`;
|
|
25
|
+
}
|
|
26
|
+
return path.resolve(projectDir, userSpefiedPath);
|
|
27
|
+
}
|
|
28
|
+
if (existsSync(path.resolve(projectDir, "api-codegen.config.js"))) {
|
|
29
|
+
return path.resolve(projectDir, "api-codegen.config.js");
|
|
30
|
+
} else if (existsSync(path.resolve(projectDir, "api-codegen.config.mjs"))) {
|
|
31
|
+
return path.resolve(projectDir, "api-codegen.config.mjs");
|
|
32
|
+
} else if (existsSync(path.resolve(projectDir, "api-codegen.config.json"))) {
|
|
33
|
+
return path.resolve(projectDir, "api-codegen.config.json");
|
|
34
|
+
} else if (existsSync(path.resolve(projectDir, "api-codegen.config.ts"))) {
|
|
35
|
+
return path.resolve(projectDir, "api-codegen.config.ts");
|
|
36
|
+
}
|
|
37
|
+
throw new Error("api-codegen.config.(js|mjs|json|ts) not found");
|
|
38
|
+
};
|
|
39
|
+
let cli = cac("mobx-tanstack-query-api");
|
|
40
|
+
cli = cli.option("-c, --config <file>", `[string] use specified config file`);
|
|
41
|
+
cli.help();
|
|
42
|
+
const parsed = cli.parse();
|
|
43
|
+
if (!parsed.options.help) {
|
|
44
|
+
const configPath = resolveConfigPath(
|
|
45
|
+
typeof parsed.options.config === "string" ? parsed.options.config : null
|
|
46
|
+
);
|
|
47
|
+
execConfigPath(configPath).then((generateApiParams) => {
|
|
48
|
+
defineConfig(generateApiParams).forEach(generateApi);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=bin.js.map
|
package/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sources":["../src/bin/utils/exec-config-path.ts","../src/bin/utils/resolve-config-path.ts","../src/bin/index.ts"],"sourcesContent":["import { createJiti } from 'jiti';\n\nexport const execConfigPath = async (configPath: string) => {\n const jiti = createJiti(import.meta.url);\n\n try {\n const config = await jiti.import(configPath, { default: true });\n return config;\n } catch (error) {\n console.error(error);\n }\n\n throw new Error(\n `${configPath} is not valid, This file should return object - result of the defineConfig function`,\n );\n};\n","import fs, { existsSync } from 'node:fs';\nimport path from 'node:path';\nimport type { Maybe } from 'yummies/types';\n\nconst projectDir = process.cwd();\n\nexport const resolveConfigPath = (userSpefiedPath?: Maybe<string>) => {\n if (userSpefiedPath) {\n const fullUserSpecifiedPath = path.resolve(projectDir, userSpefiedPath);\n\n if (!fs.existsSync(fullUserSpecifiedPath)) {\n throw `Config file not found by path - ${userSpefiedPath}`;\n }\n\n return path.resolve(projectDir, userSpefiedPath);\n }\n\n if (existsSync(path.resolve(projectDir, 'api-codegen.config.js'))) {\n return path.resolve(projectDir, 'api-codegen.config.js');\n } else if (existsSync(path.resolve(projectDir, 'api-codegen.config.mjs'))) {\n return path.resolve(projectDir, 'api-codegen.config.mjs');\n } else if (existsSync(path.resolve(projectDir, 'api-codegen.config.json'))) {\n return path.resolve(projectDir, 'api-codegen.config.json');\n } else if (existsSync(path.resolve(projectDir, 'api-codegen.config.ts'))) {\n return path.resolve(projectDir, 'api-codegen.config.ts');\n }\n\n throw new Error('api-codegen.config.(js|mjs|json|ts) not found');\n};\n","#!/usr/bin/env node\nimport { cac } from 'cac';\nimport { defineConfig, generateApi } from 'mobx-tanstack-query-api/cli';\nimport { execConfigPath } from './utils/exec-config-path.js';\nimport { resolveConfigPath } from './utils/resolve-config-path.js';\n\nlet cli = cac('mobx-tanstack-query-api');\n\ncli = cli.option('-c, --config <file>', `[string] use specified config file`);\n\ncli.help();\n\nconst parsed = cli.parse();\n\nif (!parsed.options.help) {\n const configPath = resolveConfigPath(\n typeof parsed.options.config === 'string' ? parsed.options.config : null,\n );\n\n execConfigPath(configPath).then((generateApiParams) => {\n defineConfig(generateApiParams as any).forEach(generateApi);\n });\n}\n"],"names":[],"mappings":";;;;;;AAEO,MAAM,iBAAiB,OAAO,eAAuB;AAC1D,QAAM,OAAO,WAAW,YAAY,GAAG;AAEvC,MAAI;AACF,UAAM,SAAS,MAAM,KAAK,OAAO,YAAY,EAAE,SAAS,MAAM;AAC9D,WAAO;AAAA,EACT,SAAS,OAAO;AACd,YAAQ,MAAM,KAAK;AAAA,EACrB;AAEA,QAAM,IAAI;AAAA,IACR,GAAG,UAAU;AAAA,EAAA;AAEjB;ACXA,MAAM,aAAa,QAAQ,IAAA;AAEpB,MAAM,oBAAoB,CAAC,oBAAoC;AACpE,MAAI,iBAAiB;AACnB,UAAM,wBAAwB,KAAK,QAAQ,YAAY,eAAe;AAEtE,QAAI,CAAC,GAAG,WAAW,qBAAqB,GAAG;AACzC,YAAM,mCAAmC,eAAe;AAAA,IAC1D;AAEA,WAAO,KAAK,QAAQ,YAAY,eAAe;AAAA,EACjD;AAEA,MAAI,WAAW,KAAK,QAAQ,YAAY,uBAAuB,CAAC,GAAG;AACjE,WAAO,KAAK,QAAQ,YAAY,uBAAuB;AAAA,EACzD,WAAW,WAAW,KAAK,QAAQ,YAAY,wBAAwB,CAAC,GAAG;AACzE,WAAO,KAAK,QAAQ,YAAY,wBAAwB;AAAA,EAC1D,WAAW,WAAW,KAAK,QAAQ,YAAY,yBAAyB,CAAC,GAAG;AAC1E,WAAO,KAAK,QAAQ,YAAY,yBAAyB;AAAA,EAC3D,WAAW,WAAW,KAAK,QAAQ,YAAY,uBAAuB,CAAC,GAAG;AACxE,WAAO,KAAK,QAAQ,YAAY,uBAAuB;AAAA,EACzD;AAEA,QAAM,IAAI,MAAM,+CAA+C;AACjE;ACtBA,IAAI,MAAM,IAAI,yBAAyB;AAEvC,MAAM,IAAI,OAAO,uBAAuB,oCAAoC;AAE5E,IAAI,KAAA;AAEJ,MAAM,SAAS,IAAI,MAAA;AAEnB,IAAI,CAAC,OAAO,QAAQ,MAAM;AACxB,QAAM,aAAa;AAAA,IACjB,OAAO,OAAO,QAAQ,WAAW,WAAW,OAAO,QAAQ,SAAS;AAAA,EAAA;AAGtE,iBAAe,UAAU,EAAE,KAAK,CAAC,sBAAsB;AACrD,iBAAa,iBAAwB,EAAE,QAAQ,WAAW;AAAA,EAC5D,CAAC;AACH;"}
|
package/builtin.cjs
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const mobxTanstackQueryApi = require("mobx-tanstack-query-api");
|
|
4
|
+
const MAX_FAILURE_COUNT = 3;
|
|
5
|
+
const queryClient = new mobxTanstackQueryApi.EndpointQueryClient({
|
|
6
|
+
defaultOptions: {
|
|
7
|
+
queries: {
|
|
8
|
+
throwOnError: true,
|
|
9
|
+
refetchOnWindowFocus: true,
|
|
10
|
+
refetchOnReconnect: true,
|
|
11
|
+
staleTime: 5 * 60 * 1e3,
|
|
12
|
+
retry: (failureCount, error) => {
|
|
13
|
+
if (mobxTanstackQueryApi.isHttpBadResponse(error) && error.status >= 500) {
|
|
14
|
+
return MAX_FAILURE_COUNT - failureCount > 0;
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
mutations: {
|
|
20
|
+
throwOnError: true
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const http = new mobxTanstackQueryApi.HttpClient({});
|
|
25
|
+
exports.http = http;
|
|
26
|
+
exports.queryClient = queryClient;
|
|
27
|
+
//# sourceMappingURL=builtin.cjs.map
|
package/builtin.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin.cjs","sources":["../src/builtin/index.ts"],"sourcesContent":["import {\n EndpointQueryClient,\n HttpClient,\n isHttpBadResponse,\n} from 'mobx-tanstack-query-api';\n\nconst MAX_FAILURE_COUNT = 3;\n\nexport const queryClient = new EndpointQueryClient({\n defaultOptions: {\n queries: {\n throwOnError: true,\n refetchOnWindowFocus: true,\n refetchOnReconnect: true,\n staleTime: 5 * 60 * 1000,\n retry: (failureCount, error) => {\n if (isHttpBadResponse(error) && error.status >= 500) {\n return MAX_FAILURE_COUNT - failureCount > 0;\n }\n return false;\n },\n },\n mutations: {\n throwOnError: true,\n },\n },\n});\n\nexport const http = new HttpClient({});\n"],"names":["EndpointQueryClient","isHttpBadResponse","HttpClient"],"mappings":";;;AAMA,MAAM,oBAAoB;AAEnB,MAAM,cAAc,IAAIA,qBAAAA,oBAAoB;AAAA,EACjD,gBAAgB;AAAA,IACd,SAAS;AAAA,MACP,cAAc;AAAA,MACd,sBAAsB;AAAA,MACtB,oBAAoB;AAAA,MACpB,WAAW,IAAI,KAAK;AAAA,MACpB,OAAO,CAAC,cAAc,UAAU;AAC9B,YAAIC,qBAAAA,kBAAkB,KAAK,KAAK,MAAM,UAAU,KAAK;AACnD,iBAAO,oBAAoB,eAAe;AAAA,QAC5C;AACA,eAAO;AAAA,MACT;AAAA,IAAA;AAAA,IAEF,WAAW;AAAA,MACT,cAAc;AAAA,IAAA;AAAA,EAChB;AAEJ,CAAC;AAEM,MAAM,OAAO,IAAIC,qBAAAA,WAAW,CAAA,CAAE;;;"}
|
package/builtin.d.ts
ADDED
package/builtin.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { EndpointQueryClient, isHttpBadResponse, HttpClient } from "mobx-tanstack-query-api";
|
|
2
|
+
const MAX_FAILURE_COUNT = 3;
|
|
3
|
+
const queryClient = new EndpointQueryClient({
|
|
4
|
+
defaultOptions: {
|
|
5
|
+
queries: {
|
|
6
|
+
throwOnError: true,
|
|
7
|
+
refetchOnWindowFocus: true,
|
|
8
|
+
refetchOnReconnect: true,
|
|
9
|
+
staleTime: 5 * 60 * 1e3,
|
|
10
|
+
retry: (failureCount, error) => {
|
|
11
|
+
if (isHttpBadResponse(error) && error.status >= 500) {
|
|
12
|
+
return MAX_FAILURE_COUNT - failureCount > 0;
|
|
13
|
+
}
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
mutations: {
|
|
18
|
+
throwOnError: true
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const http = new HttpClient({});
|
|
23
|
+
export {
|
|
24
|
+
http,
|
|
25
|
+
queryClient
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=builtin.js.map
|
package/builtin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin.js","sources":["../src/builtin/index.ts"],"sourcesContent":["import {\n EndpointQueryClient,\n HttpClient,\n isHttpBadResponse,\n} from 'mobx-tanstack-query-api';\n\nconst MAX_FAILURE_COUNT = 3;\n\nexport const queryClient = new EndpointQueryClient({\n defaultOptions: {\n queries: {\n throwOnError: true,\n refetchOnWindowFocus: true,\n refetchOnReconnect: true,\n staleTime: 5 * 60 * 1000,\n retry: (failureCount, error) => {\n if (isHttpBadResponse(error) && error.status >= 500) {\n return MAX_FAILURE_COUNT - failureCount > 0;\n }\n return false;\n },\n },\n mutations: {\n throwOnError: true,\n },\n },\n});\n\nexport const http = new HttpClient({});\n"],"names":[],"mappings":";AAMA,MAAM,oBAAoB;AAEnB,MAAM,cAAc,IAAI,oBAAoB;AAAA,EACjD,gBAAgB;AAAA,IACd,SAAS;AAAA,MACP,cAAc;AAAA,MACd,sBAAsB;AAAA,MACtB,oBAAoB;AAAA,MACpB,WAAW,IAAI,KAAK;AAAA,MACpB,OAAO,CAAC,cAAc,UAAU;AAC9B,YAAI,kBAAkB,KAAK,KAAK,MAAM,UAAU,KAAK;AACnD,iBAAO,oBAAoB,eAAe;AAAA,QAC5C;AACA,eAAO;AAAA,MACT;AAAA,IAAA;AAAA,IAEF,WAAW;AAAA,MACT,cAAc;AAAA,IAAA;AAAA,EAChB;AAEJ,CAAC;AAEM,MAAM,OAAO,IAAI,WAAW,CAAA,CAAE;"}
|