mobx-tanstack-query-api 0.24.0 → 0.26.0
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/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 +1279 -0
- package/cli.cjs.map +1 -0
- package/{codegen/types/generate-query-api-params.d.cts → cli.d.ts} +55 -10
- package/cli.js +1278 -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 +21 -64
- 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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type-info.d.ts","sourceRoot":"","sources":["../../../src/codegen/types/type-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"type-info.d.ts","sourceRoot":"","sources":["../../../src/codegen/types/type-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createShortModelType = void 0;
|
|
4
|
-
const createShortModelType = (shortModelType) => {
|
|
5
|
-
return {
|
|
6
|
-
...shortModelType,
|
|
7
|
-
typeIdentifier: shortModelType.typeIdentifier || 'type',
|
|
8
|
-
rawContent: shortModelType.rawContent || shortModelType.content,
|
|
9
|
-
description: shortModelType.description || '',
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
exports.createShortModelType = createShortModelType;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { ModelType } from 'swagger-typescript-api';
|
|
2
|
-
import type { PartialKeys } from 'yummies/utils/types';
|
|
3
|
-
import type { TypeInfo } from "../types/type-info.cjs";
|
|
4
|
-
export declare const createShortModelType: (shortModelType: PartialKeys<ModelType, "rawContent" | "description" | "typeIdentifier">) => TypeInfo & ModelType;
|
|
5
|
-
//# sourceMappingURL=create-short-model-type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-short-model-type.d.ts","sourceRoot":"","sources":["../../../src/codegen/utils/create-short-model-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,+BAA8B;AAEtD,eAAO,MAAM,oBAAoB,GAC/B,gBAAgB,WAAW,CACzB,SAAS,EACT,YAAY,GAAG,aAAa,GAAG,gBAAgB,CAChD,KACA,QAAQ,GAAG,SAOb,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { ModelType } from 'swagger-typescript-api';
|
|
2
|
-
import type { PartialKeys } from 'yummies/utils/types';
|
|
3
|
-
import type { TypeInfo } from "../types/type-info.js";
|
|
4
|
-
export declare const createShortModelType: (shortModelType: PartialKeys<ModelType, "rawContent" | "description" | "typeIdentifier">) => TypeInfo & ModelType;
|
|
5
|
-
//# sourceMappingURL=create-short-model-type.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-short-model-type.d.ts","sourceRoot":"","sources":["../../../src/codegen/utils/create-short-model-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,8BAA8B;AAEtD,eAAO,MAAM,oBAAoB,GAC/B,gBAAgB,WAAW,CACzB,SAAS,EACT,YAAY,GAAG,aAAa,GAAG,gBAAgB,CAChD,KACA,QAAQ,GAAG,SAOb,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export const createShortModelType = (shortModelType) => {
|
|
2
|
-
return {
|
|
3
|
-
...shortModelType,
|
|
4
|
-
typeIdentifier: shortModelType.typeIdentifier || 'type',
|
|
5
|
-
rawContent: shortModelType.rawContent || shortModelType.content,
|
|
6
|
-
description: shortModelType.description || '',
|
|
7
|
-
};
|
|
8
|
-
};
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.removeUnusedTypes = void 0;
|
|
7
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
-
const ts_morph_1 = require("ts-morph");
|
|
9
|
-
const unpack_filter_option_js_1 = require("./unpack-filter-option.cjs");
|
|
10
|
-
const removeUnusedTypesItteration = async ({ directory, keepTypes,
|
|
11
|
-
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: <explanation>
|
|
12
|
-
}) => {
|
|
13
|
-
const project = new ts_morph_1.Project();
|
|
14
|
-
project.addSourceFilesAtPaths([
|
|
15
|
-
node_path_1.default.join(directory, '**/*.ts'),
|
|
16
|
-
node_path_1.default.join(directory, '**/*.tsx'),
|
|
17
|
-
]);
|
|
18
|
-
const dataContractsSourceFile = project.getSourceFile((sourceFile) => sourceFile.getFilePath().includes(`${directory}/data-contracts.ts`));
|
|
19
|
-
if (!dataContractsSourceFile)
|
|
20
|
-
return;
|
|
21
|
-
const exportedDeclarations = dataContractsSourceFile.getExportedDeclarations();
|
|
22
|
-
const candidateTypes = new Map();
|
|
23
|
-
for (const [name, declarations] of exportedDeclarations) {
|
|
24
|
-
const validDeclarations = declarations.filter((decl) => decl.getKind() === ts_morph_1.SyntaxKind.InterfaceDeclaration ||
|
|
25
|
-
decl.getKind() === ts_morph_1.SyntaxKind.TypeAliasDeclaration ||
|
|
26
|
-
decl.getKind() === ts_morph_1.SyntaxKind.EnumDeclaration);
|
|
27
|
-
if (validDeclarations.length > 0) {
|
|
28
|
-
candidateTypes.set(name, validDeclarations);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
if (candidateTypes.size === 0)
|
|
32
|
-
return;
|
|
33
|
-
const usedTypes = new Set();
|
|
34
|
-
const externalFiles = project
|
|
35
|
-
.getSourceFiles()
|
|
36
|
-
.filter((sf) => sf !== dataContractsSourceFile);
|
|
37
|
-
for (const file of externalFiles) {
|
|
38
|
-
const identifiers = file.getDescendantsOfKind(ts_morph_1.SyntaxKind.Identifier);
|
|
39
|
-
for (const identifier of identifiers) {
|
|
40
|
-
const name = identifier.getText();
|
|
41
|
-
if (candidateTypes.has(name)) {
|
|
42
|
-
usedTypes.add(name);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
const memberAccessExpressions = file.getDescendantsOfKind(ts_morph_1.SyntaxKind.PropertyAccessExpression);
|
|
46
|
-
for (const expr of memberAccessExpressions) {
|
|
47
|
-
const expression = expr.getExpression();
|
|
48
|
-
if (ts_morph_1.Node.isIdentifier(expression)) {
|
|
49
|
-
const name = expression.getText();
|
|
50
|
-
if (candidateTypes.has(name)) {
|
|
51
|
-
usedTypes.add(name);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
const dependencyGraph = new Map();
|
|
57
|
-
for (const [name, declarations] of candidateTypes) {
|
|
58
|
-
const dependencies = new Set();
|
|
59
|
-
for (const decl of declarations) {
|
|
60
|
-
const typeReferences = decl.getDescendantsOfKind(ts_morph_1.SyntaxKind.TypeReference);
|
|
61
|
-
for (const ref of typeReferences) {
|
|
62
|
-
const typeName = ref.getTypeName().getText();
|
|
63
|
-
if (candidateTypes.has(typeName)) {
|
|
64
|
-
dependencies.add(typeName);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (decl.getKind() === ts_morph_1.SyntaxKind.EnumDeclaration) {
|
|
68
|
-
const initializers = decl.getDescendantsOfKind(ts_morph_1.SyntaxKind.Identifier);
|
|
69
|
-
for (const init of initializers) {
|
|
70
|
-
const text = init.getText();
|
|
71
|
-
if (candidateTypes.has(text)) {
|
|
72
|
-
dependencies.add(text);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
dependencyGraph.set(name, dependencies);
|
|
78
|
-
}
|
|
79
|
-
const queue = Array.from(usedTypes);
|
|
80
|
-
const visited = new Set(usedTypes);
|
|
81
|
-
while (queue.length > 0) {
|
|
82
|
-
const current = queue.shift();
|
|
83
|
-
if (dependencyGraph.has(current)) {
|
|
84
|
-
for (const dep of dependencyGraph.get(current)) {
|
|
85
|
-
if (!visited.has(dep)) {
|
|
86
|
-
visited.add(dep);
|
|
87
|
-
usedTypes.add(dep);
|
|
88
|
-
queue.push(dep);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
let removedCount = 0;
|
|
94
|
-
const isNeedToRemoveType = (0, unpack_filter_option_js_1.unpackFilterOption)(keepTypes, (name) => name, false);
|
|
95
|
-
for (const [name, declarations] of candidateTypes) {
|
|
96
|
-
if (usedTypes.has(name))
|
|
97
|
-
continue;
|
|
98
|
-
for (const decl of declarations) {
|
|
99
|
-
if ('remove' in decl && isNeedToRemoveType(name)) {
|
|
100
|
-
decl.remove();
|
|
101
|
-
removedCount++;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
if (removedCount > 0) {
|
|
106
|
-
await dataContractsSourceFile.save();
|
|
107
|
-
}
|
|
108
|
-
return removedCount;
|
|
109
|
-
};
|
|
110
|
-
const removeUnusedTypes = async (params) => {
|
|
111
|
-
while (true) {
|
|
112
|
-
const removedCount = (await removeUnusedTypesItteration(params)) ?? 0;
|
|
113
|
-
if (removedCount === 0)
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
exports.removeUnusedTypes = removeUnusedTypes;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type FilterOption } from "./unpack-filter-option.cjs";
|
|
2
|
-
export interface RemoveUnusedTypesParams {
|
|
3
|
-
directory: string;
|
|
4
|
-
keepTypes?: FilterOption<(typeName: string) => boolean>;
|
|
5
|
-
}
|
|
6
|
-
export declare const removeUnusedTypes: (params: RemoveUnusedTypesParams) => Promise<void>;
|
|
7
|
-
//# sourceMappingURL=remove-unused-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remove-unused-types.d.ts","sourceRoot":"","sources":["../../../src/codegen/utils/remove-unused-types.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,YAAY,EAElB,mCAAkC;AAEnC,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,YAAY,CAAC,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;CACzD;AA4ID,eAAO,MAAM,iBAAiB,GAAU,QAAQ,uBAAuB,kBAKtE,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { type FilterOption } from "./unpack-filter-option.js";
|
|
2
|
-
export interface RemoveUnusedTypesParams {
|
|
3
|
-
directory: string;
|
|
4
|
-
keepTypes?: FilterOption<(typeName: string) => boolean>;
|
|
5
|
-
}
|
|
6
|
-
export declare const removeUnusedTypes: (params: RemoveUnusedTypesParams) => Promise<void>;
|
|
7
|
-
//# sourceMappingURL=remove-unused-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remove-unused-types.d.ts","sourceRoot":"","sources":["../../../src/codegen/utils/remove-unused-types.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,YAAY,EAElB,kCAAkC;AAEnC,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,YAAY,CAAC,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;CACzD;AA4ID,eAAO,MAAM,iBAAiB,GAAU,QAAQ,uBAAuB,kBAKtE,CAAC"}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { Node, Project, SyntaxKind } from 'ts-morph';
|
|
3
|
-
import { unpackFilterOption, } from "./unpack-filter-option.js";
|
|
4
|
-
const removeUnusedTypesItteration = async ({ directory, keepTypes,
|
|
5
|
-
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: <explanation>
|
|
6
|
-
}) => {
|
|
7
|
-
const project = new Project();
|
|
8
|
-
project.addSourceFilesAtPaths([
|
|
9
|
-
path.join(directory, '**/*.ts'),
|
|
10
|
-
path.join(directory, '**/*.tsx'),
|
|
11
|
-
]);
|
|
12
|
-
const dataContractsSourceFile = project.getSourceFile((sourceFile) => sourceFile.getFilePath().includes(`${directory}/data-contracts.ts`));
|
|
13
|
-
if (!dataContractsSourceFile)
|
|
14
|
-
return;
|
|
15
|
-
const exportedDeclarations = dataContractsSourceFile.getExportedDeclarations();
|
|
16
|
-
const candidateTypes = new Map();
|
|
17
|
-
for (const [name, declarations] of exportedDeclarations) {
|
|
18
|
-
const validDeclarations = declarations.filter((decl) => decl.getKind() === SyntaxKind.InterfaceDeclaration ||
|
|
19
|
-
decl.getKind() === SyntaxKind.TypeAliasDeclaration ||
|
|
20
|
-
decl.getKind() === SyntaxKind.EnumDeclaration);
|
|
21
|
-
if (validDeclarations.length > 0) {
|
|
22
|
-
candidateTypes.set(name, validDeclarations);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
if (candidateTypes.size === 0)
|
|
26
|
-
return;
|
|
27
|
-
const usedTypes = new Set();
|
|
28
|
-
const externalFiles = project
|
|
29
|
-
.getSourceFiles()
|
|
30
|
-
.filter((sf) => sf !== dataContractsSourceFile);
|
|
31
|
-
for (const file of externalFiles) {
|
|
32
|
-
const identifiers = file.getDescendantsOfKind(SyntaxKind.Identifier);
|
|
33
|
-
for (const identifier of identifiers) {
|
|
34
|
-
const name = identifier.getText();
|
|
35
|
-
if (candidateTypes.has(name)) {
|
|
36
|
-
usedTypes.add(name);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
const memberAccessExpressions = file.getDescendantsOfKind(SyntaxKind.PropertyAccessExpression);
|
|
40
|
-
for (const expr of memberAccessExpressions) {
|
|
41
|
-
const expression = expr.getExpression();
|
|
42
|
-
if (Node.isIdentifier(expression)) {
|
|
43
|
-
const name = expression.getText();
|
|
44
|
-
if (candidateTypes.has(name)) {
|
|
45
|
-
usedTypes.add(name);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
const dependencyGraph = new Map();
|
|
51
|
-
for (const [name, declarations] of candidateTypes) {
|
|
52
|
-
const dependencies = new Set();
|
|
53
|
-
for (const decl of declarations) {
|
|
54
|
-
const typeReferences = decl.getDescendantsOfKind(SyntaxKind.TypeReference);
|
|
55
|
-
for (const ref of typeReferences) {
|
|
56
|
-
const typeName = ref.getTypeName().getText();
|
|
57
|
-
if (candidateTypes.has(typeName)) {
|
|
58
|
-
dependencies.add(typeName);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
if (decl.getKind() === SyntaxKind.EnumDeclaration) {
|
|
62
|
-
const initializers = decl.getDescendantsOfKind(SyntaxKind.Identifier);
|
|
63
|
-
for (const init of initializers) {
|
|
64
|
-
const text = init.getText();
|
|
65
|
-
if (candidateTypes.has(text)) {
|
|
66
|
-
dependencies.add(text);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
dependencyGraph.set(name, dependencies);
|
|
72
|
-
}
|
|
73
|
-
const queue = Array.from(usedTypes);
|
|
74
|
-
const visited = new Set(usedTypes);
|
|
75
|
-
while (queue.length > 0) {
|
|
76
|
-
const current = queue.shift();
|
|
77
|
-
if (dependencyGraph.has(current)) {
|
|
78
|
-
for (const dep of dependencyGraph.get(current)) {
|
|
79
|
-
if (!visited.has(dep)) {
|
|
80
|
-
visited.add(dep);
|
|
81
|
-
usedTypes.add(dep);
|
|
82
|
-
queue.push(dep);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
let removedCount = 0;
|
|
88
|
-
const isNeedToRemoveType = unpackFilterOption(keepTypes, (name) => name, false);
|
|
89
|
-
for (const [name, declarations] of candidateTypes) {
|
|
90
|
-
if (usedTypes.has(name))
|
|
91
|
-
continue;
|
|
92
|
-
for (const decl of declarations) {
|
|
93
|
-
if ('remove' in decl && isNeedToRemoveType(name)) {
|
|
94
|
-
decl.remove();
|
|
95
|
-
removedCount++;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
if (removedCount > 0) {
|
|
100
|
-
await dataContractsSourceFile.save();
|
|
101
|
-
}
|
|
102
|
-
return removedCount;
|
|
103
|
-
};
|
|
104
|
-
export const removeUnusedTypes = async (params) => {
|
|
105
|
-
while (true) {
|
|
106
|
-
const removedCount = (await removeUnusedTypesItteration(params)) ?? 0;
|
|
107
|
-
if (removedCount === 0)
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.unpackFilterOption = void 0;
|
|
4
|
-
const unpackFilterOption = (option, argsToString, defaultReturnValue = true) => {
|
|
5
|
-
if (typeof option === 'function') {
|
|
6
|
-
// @ts-expect-error
|
|
7
|
-
return option;
|
|
8
|
-
}
|
|
9
|
-
if (option == null) {
|
|
10
|
-
// @ts-expect-error
|
|
11
|
-
return () => defaultReturnValue;
|
|
12
|
-
}
|
|
13
|
-
const inputs = Array.isArray(option) ? option : [option];
|
|
14
|
-
// @ts-expect-error
|
|
15
|
-
return (...args) => inputs.some((input) => {
|
|
16
|
-
const str = argsToString(...args);
|
|
17
|
-
if (typeof input === 'string') {
|
|
18
|
-
return input === str;
|
|
19
|
-
}
|
|
20
|
-
return input.test(str);
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
exports.unpackFilterOption = unpackFilterOption;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Maybe } from 'yummies/utils/types';
|
|
2
|
-
type AnyFilterOptionFn = (...args: any[]) => boolean;
|
|
3
|
-
export type FilterOption<T extends AnyFilterOptionFn> = T | string | RegExp | (RegExp | string)[];
|
|
4
|
-
export type UnpackedFilterOption<T extends FilterOption<any>> = Extract<T, AnyFilterOptionFn>;
|
|
5
|
-
export declare const unpackFilterOption: <TOption extends FilterOption<AnyFilterOptionFn>>(option: Maybe<TOption>, argsToString: (...args: Parameters<UnpackedFilterOption<TOption>>) => string, defaultReturnValue?: boolean) => UnpackedFilterOption<TOption>;
|
|
6
|
-
export {};
|
|
7
|
-
//# sourceMappingURL=unpack-filter-option.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unpack-filter-option.d.ts","sourceRoot":"","sources":["../../../src/codegen/utils/unpack-filter-option.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,KAAK,iBAAiB,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC;AAErD,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,iBAAiB,IAChD,CAAC,GACD,MAAM,GACN,MAAM,GACN,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;AAExB,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,YAAY,CAAC,GAAG,CAAC,IAAI,OAAO,CACrE,CAAC,EACD,iBAAiB,CAClB,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,OAAO,SAAS,YAAY,CAAC,iBAAiB,CAAC,EAE/C,QAAQ,KAAK,CAAC,OAAO,CAAC,EACtB,cAAc,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,KAAK,MAAM,EAC5E,qBAAoB,OAAc,KACjC,oBAAoB,CAAC,OAAO,CAwB9B,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Maybe } from 'yummies/utils/types';
|
|
2
|
-
type AnyFilterOptionFn = (...args: any[]) => boolean;
|
|
3
|
-
export type FilterOption<T extends AnyFilterOptionFn> = T | string | RegExp | (RegExp | string)[];
|
|
4
|
-
export type UnpackedFilterOption<T extends FilterOption<any>> = Extract<T, AnyFilterOptionFn>;
|
|
5
|
-
export declare const unpackFilterOption: <TOption extends FilterOption<AnyFilterOptionFn>>(option: Maybe<TOption>, argsToString: (...args: Parameters<UnpackedFilterOption<TOption>>) => string, defaultReturnValue?: boolean) => UnpackedFilterOption<TOption>;
|
|
6
|
-
export {};
|
|
7
|
-
//# sourceMappingURL=unpack-filter-option.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unpack-filter-option.d.ts","sourceRoot":"","sources":["../../../src/codegen/utils/unpack-filter-option.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,KAAK,iBAAiB,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC;AAErD,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,iBAAiB,IAChD,CAAC,GACD,MAAM,GACN,MAAM,GACN,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;AAExB,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,YAAY,CAAC,GAAG,CAAC,IAAI,OAAO,CACrE,CAAC,EACD,iBAAiB,CAClB,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,OAAO,SAAS,YAAY,CAAC,iBAAiB,CAAC,EAE/C,QAAQ,KAAK,CAAC,OAAO,CAAC,EACtB,cAAc,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,KAAK,MAAM,EAC5E,qBAAoB,OAAc,KACjC,oBAAoB,CAAC,OAAO,CAwB9B,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export const unpackFilterOption = (option, argsToString, defaultReturnValue = true) => {
|
|
2
|
-
if (typeof option === 'function') {
|
|
3
|
-
// @ts-expect-error
|
|
4
|
-
return option;
|
|
5
|
-
}
|
|
6
|
-
if (option == null) {
|
|
7
|
-
// @ts-expect-error
|
|
8
|
-
return () => defaultReturnValue;
|
|
9
|
-
}
|
|
10
|
-
const inputs = Array.isArray(option) ? option : [option];
|
|
11
|
-
// @ts-expect-error
|
|
12
|
-
return (...args) => inputs.some((input) => {
|
|
13
|
-
const str = argsToString(...args);
|
|
14
|
-
if (typeof input === 'string') {
|
|
15
|
-
return input === str;
|
|
16
|
-
}
|
|
17
|
-
return input.test(str);
|
|
18
|
-
});
|
|
19
|
-
};
|
package/index.d.cts
DELETED
package/index.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,oCAAmC"}
|
package/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,mCAAmC"}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EndpointInfiniteQuery = void 0;
|
|
4
|
-
const mobx_1 = require("mobx");
|
|
5
|
-
const mobx_tanstack_query_1 = require("mobx-tanstack-query");
|
|
6
|
-
const endpoint_query_js_1 = require("./endpoint-query.cjs");
|
|
7
|
-
class EndpointInfiniteQuery extends mobx_tanstack_query_1.InfiniteQuery {
|
|
8
|
-
endpoint;
|
|
9
|
-
response = null;
|
|
10
|
-
params = null;
|
|
11
|
-
uniqKey;
|
|
12
|
-
paramsFn;
|
|
13
|
-
constructor(endpoint, queryClient, queryOptionsInput) {
|
|
14
|
-
const { uniqKey, transform: transformResponse, params: paramsFn, ...queryOptions } = typeof queryOptionsInput === 'function'
|
|
15
|
-
? queryOptionsInput()
|
|
16
|
-
: queryOptionsInput;
|
|
17
|
-
super({
|
|
18
|
-
...queryOptions,
|
|
19
|
-
queryClient,
|
|
20
|
-
meta: endpoint.toQueryMeta(queryOptions.meta),
|
|
21
|
-
options: (query) => {
|
|
22
|
-
const extraOptions = {};
|
|
23
|
-
let willEnableManually;
|
|
24
|
-
let params;
|
|
25
|
-
const pageParam = query.options.initialPageParam;
|
|
26
|
-
if (typeof queryOptionsInput === 'function') {
|
|
27
|
-
Object.assign(extraOptions, queryOptionsInput());
|
|
28
|
-
params = paramsFn(pageParam);
|
|
29
|
-
willEnableManually = false;
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
willEnableManually = queryOptionsInput.enabled === false;
|
|
33
|
-
params = paramsFn(pageParam);
|
|
34
|
-
}
|
|
35
|
-
const builtOptions = (0, endpoint_query_js_1.buildOptionsFromParams)(endpoint, params, uniqKey);
|
|
36
|
-
// const dynamicOuterOptions = getDynamicOptions?.(query);
|
|
37
|
-
let isEnabled = false;
|
|
38
|
-
if (willEnableManually) {
|
|
39
|
-
// if (dynamicOuterOptions?.enabled != null) {
|
|
40
|
-
// isEnabled = dynamicOuterOptions.enabled;
|
|
41
|
-
// }
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
// const outerDynamicEnabled =
|
|
45
|
-
// dynamicOuterOptions?.enabled == null ||
|
|
46
|
-
// !!dynamicOuterOptions.enabled;
|
|
47
|
-
// isEnabled = builtOptions.enabled && outerDynamicEnabled;
|
|
48
|
-
isEnabled = builtOptions.enabled;
|
|
49
|
-
}
|
|
50
|
-
return {
|
|
51
|
-
...query.options,
|
|
52
|
-
...builtOptions,
|
|
53
|
-
// ...dynamicOuterOptions,
|
|
54
|
-
enabled: isEnabled,
|
|
55
|
-
...extraOptions,
|
|
56
|
-
};
|
|
57
|
-
},
|
|
58
|
-
queryFn: async (ctx) => {
|
|
59
|
-
const params = paramsFn(ctx.pageParam ?? queryOptions.initialPageParam);
|
|
60
|
-
(0, mobx_1.runInAction)(() => {
|
|
61
|
-
this.response = null;
|
|
62
|
-
this.params = params;
|
|
63
|
-
});
|
|
64
|
-
let requestParams = params.request;
|
|
65
|
-
if (requestParams) {
|
|
66
|
-
if (!requestParams.signal) {
|
|
67
|
-
requestParams.signal = ctx.signal;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
requestParams = { signal: ctx.signal };
|
|
72
|
-
}
|
|
73
|
-
const fixedInput = {
|
|
74
|
-
...params,
|
|
75
|
-
request: requestParams,
|
|
76
|
-
};
|
|
77
|
-
const response = await endpoint.request(fixedInput);
|
|
78
|
-
(0, mobx_1.runInAction)(() => {
|
|
79
|
-
this.response = response;
|
|
80
|
-
});
|
|
81
|
-
return (await transformResponse?.(response)) ?? response.data;
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
this.endpoint = endpoint;
|
|
85
|
-
this.paramsFn = paramsFn;
|
|
86
|
-
this.uniqKey = uniqKey;
|
|
87
|
-
mobx_1.observable.ref(this, 'response');
|
|
88
|
-
mobx_1.observable.ref(this, 'params');
|
|
89
|
-
(0, mobx_1.makeObservable)(this);
|
|
90
|
-
}
|
|
91
|
-
update({ params, ...options }) {
|
|
92
|
-
return super.update({
|
|
93
|
-
...(0, endpoint_query_js_1.buildOptionsFromParams)(this.endpoint, params, this.uniqKey),
|
|
94
|
-
...options,
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
async start(params) {
|
|
98
|
-
return await super.start((0, endpoint_query_js_1.buildOptionsFromParams)(this.endpoint, params, this.uniqKey));
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
exports.EndpointInfiniteQuery = EndpointInfiniteQuery;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { DefaultError, InfiniteData, QueryObserverResult } from '@tanstack/query-core';
|
|
2
|
-
import { InfiniteQuery } from 'mobx-tanstack-query';
|
|
3
|
-
import type { MaybeFalsy } from 'yummies/utils/types';
|
|
4
|
-
import type { AnyEndpoint } from "./endpoint.types.cjs";
|
|
5
|
-
import type { EndpointInfiniteQueryFlattenOptions, EndpointInfiniteQueryOptions, EndpointInfiniteQueryUpdateOptionsAllVariants } from "./endpoint-infinite-query.types.cjs";
|
|
6
|
-
import type { EndpointQueryClient } from "./endpoint-query-client.cjs";
|
|
7
|
-
export declare class EndpointInfiniteQuery<TEndpoint extends AnyEndpoint, TQueryFnData = TEndpoint['__response']['data'], TError = DefaultError, TPageParam = unknown, TData = InfiniteData<TQueryFnData, TPageParam>> extends InfiniteQuery<TQueryFnData, TError, TPageParam, TData, any[]> {
|
|
8
|
-
private endpoint;
|
|
9
|
-
response: TEndpoint['__response'] | null;
|
|
10
|
-
params: TEndpoint['__params'] | null;
|
|
11
|
-
private uniqKey?;
|
|
12
|
-
private paramsFn;
|
|
13
|
-
constructor(endpoint: AnyEndpoint, queryClient: EndpointQueryClient, queryOptionsInput: EndpointInfiniteQueryOptions<TEndpoint, TQueryFnData, TError, TPageParam, TData> | (() => EndpointInfiniteQueryFlattenOptions<TEndpoint, TQueryFnData, TError, TPageParam, TData>));
|
|
14
|
-
update({ params, ...options }: EndpointInfiniteQueryUpdateOptionsAllVariants<TEndpoint, TQueryFnData, TError, TPageParam, TData>): void;
|
|
15
|
-
start(params: MaybeFalsy<TEndpoint['__params']>): Promise<QueryObserverResult<TData, TError>>;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=endpoint-infinite-query.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-infinite-query.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-infinite-query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAS,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,6BAA4B;AACvD,OAAO,KAAK,EACV,mCAAmC,EACnC,4BAA4B,EAC5B,6CAA6C,EAC9C,4CAA2C;AAG5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,oCAAmC;AAGtE,qBAAa,qBAAqB,CAChC,SAAS,SAAS,WAAW,EAC7B,YAAY,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,EAC9C,MAAM,GAAG,YAAY,EACrB,UAAU,GAAG,OAAO,EACpB,KAAK,GAAG,YAAY,CAAC,YAAY,EAAE,UAAU,CAAC,CAC9C,SAAQ,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;IAenE,OAAO,CAAC,QAAQ;IAdlB,QAAQ,EAAE,SAAS,CAAC,YAAY,CAAC,GAAG,IAAI,CAAQ;IAChD,MAAM,EAAE,SAAS,CAAC,UAAU,CAAC,GAAG,IAAI,CAAQ;IAE5C,OAAO,CAAC,OAAO,CAAC,CAAuB;IAEvC,OAAO,CAAC,QAAQ,CAMJ;gBAGF,QAAQ,EAAE,WAAW,EAC7B,WAAW,EAAE,mBAAmB,EAEhC,iBAAiB,EACb,4BAA4B,CAC1B,SAAS,EACT,YAAY,EACZ,MAAM,EACN,UAAU,EACV,KAAK,CACN,GACD,CAAC,MAAM,mCAAmC,CACxC,SAAS,EACT,YAAY,EACZ,MAAM,EACN,UAAU,EACV,KAAK,CACN,CAAC;IAoGR,MAAM,CAAC,EACL,MAAM,EACN,GAAG,OAAO,EACX,EAAE,6CAA6C,CAC9C,SAAS,EACT,YAAY,EACZ,MAAM,EACN,UAAU,EACV,KAAK,CACN;IAOK,KAAK,CACT,MAAM,EAAE,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,GACxC,OAAO,CAAC,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;CAK/C"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { DefaultError, InfiniteData, QueryObserverResult } from '@tanstack/query-core';
|
|
2
|
-
import { InfiniteQuery } from 'mobx-tanstack-query';
|
|
3
|
-
import type { MaybeFalsy } from 'yummies/utils/types';
|
|
4
|
-
import type { AnyEndpoint } from "./endpoint.types.js";
|
|
5
|
-
import type { EndpointInfiniteQueryFlattenOptions, EndpointInfiniteQueryOptions, EndpointInfiniteQueryUpdateOptionsAllVariants } from "./endpoint-infinite-query.types.js";
|
|
6
|
-
import type { EndpointQueryClient } from "./endpoint-query-client.js";
|
|
7
|
-
export declare class EndpointInfiniteQuery<TEndpoint extends AnyEndpoint, TQueryFnData = TEndpoint['__response']['data'], TError = DefaultError, TPageParam = unknown, TData = InfiniteData<TQueryFnData, TPageParam>> extends InfiniteQuery<TQueryFnData, TError, TPageParam, TData, any[]> {
|
|
8
|
-
private endpoint;
|
|
9
|
-
response: TEndpoint['__response'] | null;
|
|
10
|
-
params: TEndpoint['__params'] | null;
|
|
11
|
-
private uniqKey?;
|
|
12
|
-
private paramsFn;
|
|
13
|
-
constructor(endpoint: AnyEndpoint, queryClient: EndpointQueryClient, queryOptionsInput: EndpointInfiniteQueryOptions<TEndpoint, TQueryFnData, TError, TPageParam, TData> | (() => EndpointInfiniteQueryFlattenOptions<TEndpoint, TQueryFnData, TError, TPageParam, TData>));
|
|
14
|
-
update({ params, ...options }: EndpointInfiniteQueryUpdateOptionsAllVariants<TEndpoint, TQueryFnData, TError, TPageParam, TData>): void;
|
|
15
|
-
start(params: MaybeFalsy<TEndpoint['__params']>): Promise<QueryObserverResult<TData, TError>>;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=endpoint-infinite-query.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-infinite-query.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-infinite-query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACpB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAS,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,4BAA4B;AACvD,OAAO,KAAK,EACV,mCAAmC,EACnC,4BAA4B,EAC5B,6CAA6C,EAC9C,2CAA2C;AAG5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,mCAAmC;AAGtE,qBAAa,qBAAqB,CAChC,SAAS,SAAS,WAAW,EAC7B,YAAY,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,EAC9C,MAAM,GAAG,YAAY,EACrB,UAAU,GAAG,OAAO,EACpB,KAAK,GAAG,YAAY,CAAC,YAAY,EAAE,UAAU,CAAC,CAC9C,SAAQ,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;IAenE,OAAO,CAAC,QAAQ;IAdlB,QAAQ,EAAE,SAAS,CAAC,YAAY,CAAC,GAAG,IAAI,CAAQ;IAChD,MAAM,EAAE,SAAS,CAAC,UAAU,CAAC,GAAG,IAAI,CAAQ;IAE5C,OAAO,CAAC,OAAO,CAAC,CAAuB;IAEvC,OAAO,CAAC,QAAQ,CAMJ;gBAGF,QAAQ,EAAE,WAAW,EAC7B,WAAW,EAAE,mBAAmB,EAEhC,iBAAiB,EACb,4BAA4B,CAC1B,SAAS,EACT,YAAY,EACZ,MAAM,EACN,UAAU,EACV,KAAK,CACN,GACD,CAAC,MAAM,mCAAmC,CACxC,SAAS,EACT,YAAY,EACZ,MAAM,EACN,UAAU,EACV,KAAK,CACN,CAAC;IAoGR,MAAM,CAAC,EACL,MAAM,EACN,GAAG,OAAO,EACX,EAAE,6CAA6C,CAC9C,SAAS,EACT,YAAY,EACZ,MAAM,EACN,UAAU,EACV,KAAK,CACN;IAOK,KAAK,CACT,MAAM,EAAE,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,GACxC,OAAO,CAAC,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;CAK/C"}
|