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.
- package/builtin/index.cjs +26 -0
- package/builtin/index.d.cts +5 -0
- package/builtin/index.d.cts.map +1 -0
- package/builtin/index.d.ts +2 -2
- package/builtin/index.d.ts.map +1 -1
- package/builtin/index.js +2 -2
- package/cli/bin.cjs +17 -0
- package/cli/bin.d.cts +2 -0
- package/cli/bin.d.cts.map +1 -0
- package/cli/bin.js +4 -4
- package/cli/index.cjs +18 -0
- package/cli/index.d.cts +3 -0
- package/cli/index.d.cts.map +1 -0
- package/cli/index.d.ts +2 -1
- package/cli/index.d.ts.map +1 -1
- package/cli/index.js +2 -1
- package/cli/utils/define-config.cjs +9 -0
- package/cli/utils/define-config.d.cts +4 -0
- package/cli/utils/define-config.d.cts.map +1 -0
- package/cli/utils/define-config.d.ts +1 -1
- package/cli/utils/define-config.d.ts.map +1 -1
- package/cli/utils/exec-config-path.cjs +16 -0
- package/cli/utils/exec-config-path.d.cts +2 -0
- package/cli/utils/exec-config-path.d.cts.map +1 -0
- package/cli/utils/resolve-config-path.cjs +65 -0
- package/cli/utils/resolve-config-path.d.cts +3 -0
- package/cli/utils/resolve-config-path.d.cts.map +1 -0
- package/codegen/index.cjs +488 -0
- package/codegen/index.d.cts +167 -0
- package/codegen/index.d.cts.map +1 -0
- package/codegen/index.d.ts +1 -1
- package/codegen/index.d.ts.map +1 -1
- package/codegen/index.js +9 -9
- package/codegen/templates/all-endpoints-per-file.tmpl.cjs +99 -0
- package/codegen/templates/all-endpoints-per-file.tmpl.d.cts +18 -0
- package/codegen/templates/all-endpoints-per-file.tmpl.d.cts.map +1 -0
- package/codegen/templates/all-endpoints-per-file.tmpl.d.ts +1 -1
- package/codegen/templates/all-endpoints-per-file.tmpl.d.ts.map +1 -1
- package/codegen/templates/all-endpoints-per-file.tmpl.js +4 -4
- package/codegen/templates/all-exports.tmpl.cjs +14 -0
- package/codegen/templates/all-exports.tmpl.d.cts +11 -0
- package/codegen/templates/all-exports.tmpl.d.cts.map +1 -0
- package/codegen/templates/all-exports.tmpl.d.ts +1 -1
- package/codegen/templates/all-exports.tmpl.d.ts.map +1 -1
- package/codegen/templates/all-exports.tmpl.js +1 -1
- package/codegen/templates/constants.cjs +5 -0
- package/codegen/templates/constants.d.cts +2 -0
- package/codegen/templates/constants.d.cts.map +1 -0
- package/codegen/templates/data-contract.tmpl.cjs +49 -0
- package/codegen/templates/data-contract.tmpl.d.cts +8 -0
- package/codegen/templates/data-contract.tmpl.d.cts.map +1 -0
- package/codegen/templates/data-contracts-file.tmpl.cjs +27 -0
- package/codegen/templates/data-contracts-file.tmpl.d.cts +10 -0
- package/codegen/templates/data-contracts-file.tmpl.d.cts.map +1 -0
- package/codegen/templates/data-contracts-file.tmpl.d.ts +1 -1
- package/codegen/templates/data-contracts-file.tmpl.d.ts.map +1 -1
- package/codegen/templates/data-contracts-file.tmpl.js +2 -2
- package/codegen/templates/endpoint-jsdoc.tmpl.cjs +110 -0
- package/codegen/templates/endpoint-jsdoc.tmpl.d.cts +10 -0
- package/codegen/templates/endpoint-jsdoc.tmpl.d.cts.map +1 -0
- package/codegen/templates/endpoint-jsdoc.tmpl.d.ts +1 -1
- package/codegen/templates/endpoint-jsdoc.tmpl.d.ts.map +1 -1
- package/codegen/templates/endpoint-per-file.tmpl.cjs +90 -0
- package/codegen/templates/endpoint-per-file.tmpl.d.cts +18 -0
- package/codegen/templates/endpoint-per-file.tmpl.d.cts.map +1 -0
- package/codegen/templates/endpoint-per-file.tmpl.d.ts +1 -1
- package/codegen/templates/endpoint-per-file.tmpl.d.ts.map +1 -1
- package/codegen/templates/endpoint-per-file.tmpl.js +4 -4
- package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.cjs +10 -0
- package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.d.cts +10 -0
- package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.d.cts.map +1 -0
- package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.d.ts +1 -1
- package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.d.ts.map +1 -1
- package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.js +1 -1
- package/codegen/templates/meta-info.tmpl.cjs +48 -0
- package/codegen/templates/meta-info.tmpl.d.cts +12 -0
- package/codegen/templates/meta-info.tmpl.d.cts.map +1 -0
- package/codegen/templates/meta-info.tmpl.d.ts +1 -1
- package/codegen/templates/meta-info.tmpl.d.ts.map +1 -1
- package/codegen/templates/meta-info.tmpl.js +1 -1
- package/codegen/templates/new-endpoint.tmpl.cjs +178 -0
- package/codegen/templates/new-endpoint.tmpl.d.cts +21 -0
- package/codegen/templates/new-endpoint.tmpl.d.cts.map +1 -0
- package/codegen/templates/new-endpoint.tmpl.d.ts +1 -1
- package/codegen/templates/new-endpoint.tmpl.d.ts.map +1 -1
- package/codegen/templates/new-endpoint.tmpl.js +1 -1
- package/codegen/utils/remove-unused-types.cjs +117 -0
- package/codegen/utils/remove-unused-types.d.cts +7 -0
- package/codegen/utils/remove-unused-types.d.cts.map +1 -0
- package/codegen/utils/remove-unused-types.d.ts +1 -1
- package/codegen/utils/remove-unused-types.d.ts.map +1 -1
- package/codegen/utils/remove-unused-types.js +1 -1
- package/codegen/utils/unpack-filter-option.cjs +20 -0
- package/codegen/utils/unpack-filter-option.d.cts +4 -0
- package/codegen/utils/unpack-filter-option.d.cts.map +1 -0
- package/codegen/utils/unpack-filter-option.d.ts +1 -1
- package/codegen/utils/unpack-filter-option.d.ts.map +1 -1
- package/index.cjs +18 -0
- package/index.d.cts +3 -0
- package/index.d.cts.map +1 -0
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +1 -1
- package/package.json +29 -147
- package/runtime/endpoint-infinite-query.cjs +101 -0
- package/runtime/endpoint-infinite-query.d.cts +17 -0
- package/runtime/endpoint-infinite-query.d.cts.map +1 -0
- package/runtime/endpoint-infinite-query.d.ts +3 -3
- package/runtime/endpoint-infinite-query.d.ts.map +1 -1
- package/runtime/endpoint-infinite-query.js +1 -1
- package/runtime/endpoint-infinite-query.types.cjs +2 -0
- package/runtime/endpoint-infinite-query.types.d.cts +30 -0
- package/runtime/endpoint-infinite-query.types.d.cts.map +1 -0
- package/runtime/endpoint-infinite-query.types.d.ts +2 -2
- package/runtime/endpoint-infinite-query.types.d.ts.map +1 -1
- package/runtime/endpoint-mutation.cjs +73 -0
- package/runtime/endpoint-mutation.d.cts +13 -0
- package/runtime/endpoint-mutation.d.cts.map +1 -0
- package/runtime/endpoint-mutation.d.ts +3 -3
- package/runtime/endpoint-mutation.d.ts.map +1 -1
- package/runtime/endpoint-mutation.types.cjs +2 -0
- package/runtime/endpoint-mutation.types.d.cts +30 -0
- package/runtime/endpoint-mutation.types.d.cts.map +1 -0
- package/runtime/endpoint-mutation.types.d.ts +2 -2
- package/runtime/endpoint-mutation.types.d.ts.map +1 -1
- package/runtime/endpoint-query-client.cjs +79 -0
- package/runtime/endpoint-query-client.d.cts +13 -0
- package/runtime/endpoint-query-client.d.cts.map +1 -0
- package/runtime/endpoint-query-client.d.ts +1 -1
- package/runtime/endpoint-query-client.d.ts.map +1 -1
- package/runtime/endpoint-query-client.types.cjs +2 -0
- package/runtime/endpoint-query-client.types.d.cts +16 -0
- package/runtime/endpoint-query-client.types.d.cts.map +1 -0
- package/runtime/endpoint-query-client.types.d.ts +2 -2
- package/runtime/endpoint-query-client.types.d.ts.map +1 -1
- package/runtime/endpoint-query.cjs +213 -0
- package/runtime/endpoint-query.d.cts +29 -0
- package/runtime/endpoint-query.d.cts.map +1 -0
- package/runtime/endpoint-query.d.ts +3 -3
- package/runtime/endpoint-query.d.ts.map +1 -1
- package/runtime/endpoint-query.types.cjs +2 -0
- package/runtime/endpoint-query.types.d.cts +37 -0
- package/runtime/endpoint-query.types.d.cts.map +1 -0
- package/runtime/endpoint-query.types.d.ts +1 -1
- package/runtime/endpoint-query.types.d.ts.map +1 -1
- package/runtime/endpoint.cjs +128 -0
- package/runtime/endpoint.d.cts +69 -0
- package/runtime/endpoint.d.cts.map +1 -0
- package/runtime/endpoint.d.ts +9 -9
- package/runtime/endpoint.d.ts.map +1 -1
- package/runtime/endpoint.js +3 -3
- package/runtime/endpoint.types.cjs +2 -0
- package/runtime/endpoint.types.d.cts +23 -0
- package/runtime/endpoint.types.d.cts.map +1 -0
- package/runtime/endpoint.types.d.ts +3 -3
- package/runtime/endpoint.types.d.ts.map +1 -1
- package/runtime/http-client.cjs +208 -0
- package/runtime/http-client.d.cts +85 -0
- package/runtime/http-client.d.cts.map +1 -0
- package/runtime/index.cjs +25 -0
- package/runtime/index.d.cts +10 -0
- package/runtime/index.d.cts.map +1 -0
- package/runtime/index.d.ts +9 -9
- package/runtime/index.d.ts.map +1 -1
- package/runtime/index.js +9 -9
- package/assets/gh-repo-template.pxz +0 -0
- package/assets/logo.png +0 -0
- package/assets/logo.pxz +0 -0
- package/cli/bin.mjs +0 -15
package/index.d.cts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,oCAAmC"}
|
package/index.d.ts
CHANGED
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,mCAAmC"}
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from '@tanstack/query-core';
|
|
2
|
-
export * from
|
|
2
|
+
export * from "./runtime/index.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mobx-tanstack-query-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"mobx",
|
|
6
6
|
"react-query",
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"description": "OpenAPI/Swagger client codegen + endpoints integration with mobx-tanstack-query",
|
|
15
15
|
"type": "module",
|
|
16
|
-
"bin": "cli/bin.js",
|
|
17
16
|
"bugs": {
|
|
18
17
|
"url": "https://github.com/js2me/mobx-tanstack-query-api/issues"
|
|
19
18
|
},
|
|
@@ -29,14 +28,14 @@
|
|
|
29
28
|
"@tanstack/query-core": "^5.85.7",
|
|
30
29
|
"@types/lodash": "^4.17.16",
|
|
31
30
|
"@types/lodash-es": "^4.17.12",
|
|
31
|
+
"cac": "^6.7.14",
|
|
32
32
|
"http-status-code-types": "^0.0.2",
|
|
33
33
|
"jiti": "^2.5.1",
|
|
34
|
-
"cac": "^6.7.14",
|
|
35
34
|
"mobx-tanstack-query": "^6.6.1",
|
|
36
35
|
"swagger-typescript-api": "13.2.10",
|
|
37
36
|
"ts-morph": "^26.0.0",
|
|
38
37
|
"undici-types": "^7.11.0",
|
|
39
|
-
"yummies": "^5.
|
|
38
|
+
"yummies": "^5.4.8"
|
|
40
39
|
},
|
|
41
40
|
"devDependencies": {
|
|
42
41
|
"@biomejs/biome": "^2.2.4",
|
|
@@ -48,158 +47,41 @@
|
|
|
48
47
|
"@vitest/coverage-istanbul": "^3.2.4",
|
|
49
48
|
"commitfmt": "^1.0.0",
|
|
50
49
|
"js2me-biome-config": "^1.0.5",
|
|
51
|
-
"
|
|
50
|
+
"sborshik": "^1.0.10",
|
|
52
51
|
"jsdom": "^26.0.0",
|
|
53
52
|
"lefthook": "^1.11.13",
|
|
54
53
|
"nodemon": "^3.1.9",
|
|
55
54
|
"rimraf": "^6.0.1",
|
|
56
55
|
"typescript": "^5.8.3",
|
|
57
56
|
"unplugin-swc": "^1.5.1",
|
|
58
|
-
"vitest": "^3.2.4"
|
|
57
|
+
"vitest": "^3.2.4",
|
|
58
|
+
"zshy": "^0.4.2"
|
|
59
59
|
},
|
|
60
|
+
"files": [
|
|
61
|
+
"*"
|
|
62
|
+
],
|
|
63
|
+
"main": "./index.cjs",
|
|
64
|
+
"module": "./index.js",
|
|
65
|
+
"types": "./index.d.cts",
|
|
60
66
|
"exports": {
|
|
67
|
+
"./package.json": "./package.json",
|
|
68
|
+
".": {
|
|
69
|
+
"types": "./index.d.cts",
|
|
70
|
+
"import": "./index.js",
|
|
71
|
+
"require": "./index.cjs"
|
|
72
|
+
},
|
|
61
73
|
"./builtin": {
|
|
74
|
+
"types": "./builtin/index.d.cts",
|
|
62
75
|
"import": "./builtin/index.js",
|
|
63
|
-
"
|
|
64
|
-
"types": "./builtin/index.d.ts"
|
|
65
|
-
},
|
|
66
|
-
"./cli/bin": {
|
|
67
|
-
"import": "./cli/bin.js",
|
|
68
|
-
"default": "./cli/bin.js",
|
|
69
|
-
"types": "./cli/bin.d.ts"
|
|
76
|
+
"require": "./builtin/index.cjs"
|
|
70
77
|
},
|
|
71
78
|
"./cli": {
|
|
79
|
+
"types": "./cli/index.d.cts",
|
|
72
80
|
"import": "./cli/index.js",
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
},
|
|
76
|
-
"./cli/utils/define-config": {
|
|
77
|
-
"import": "./cli/utils/define-config.js",
|
|
78
|
-
"default": "./cli/utils/define-config.js",
|
|
79
|
-
"types": "./cli/utils/define-config.d.ts"
|
|
80
|
-
},
|
|
81
|
-
"./cli/utils/exec-config-path": {
|
|
82
|
-
"import": "./cli/utils/exec-config-path.js",
|
|
83
|
-
"default": "./cli/utils/exec-config-path.js",
|
|
84
|
-
"types": "./cli/utils/exec-config-path.d.ts"
|
|
85
|
-
},
|
|
86
|
-
"./cli/utils/resolve-config-path": {
|
|
87
|
-
"import": "./cli/utils/resolve-config-path.js",
|
|
88
|
-
"default": "./cli/utils/resolve-config-path.js",
|
|
89
|
-
"types": "./cli/utils/resolve-config-path.d.ts"
|
|
90
|
-
},
|
|
91
|
-
"./codegen": {
|
|
92
|
-
"import": "./codegen/index.js",
|
|
93
|
-
"default": "./codegen/index.js",
|
|
94
|
-
"types": "./codegen/index.d.ts"
|
|
95
|
-
},
|
|
96
|
-
"./codegen/templates/all-endpoints-per-file.tmpl": {
|
|
97
|
-
"import": "./codegen/templates/all-endpoints-per-file.tmpl.js",
|
|
98
|
-
"default": "./codegen/templates/all-endpoints-per-file.tmpl.js",
|
|
99
|
-
"types": "./codegen/templates/all-endpoints-per-file.tmpl.d.ts"
|
|
100
|
-
},
|
|
101
|
-
"./codegen/templates/all-exports.tmpl": {
|
|
102
|
-
"import": "./codegen/templates/all-exports.tmpl.js",
|
|
103
|
-
"default": "./codegen/templates/all-exports.tmpl.js",
|
|
104
|
-
"types": "./codegen/templates/all-exports.tmpl.d.ts"
|
|
105
|
-
},
|
|
106
|
-
"./codegen/templates/constants": {
|
|
107
|
-
"import": "./codegen/templates/constants.js",
|
|
108
|
-
"default": "./codegen/templates/constants.js",
|
|
109
|
-
"types": "./codegen/templates/constants.d.ts"
|
|
110
|
-
},
|
|
111
|
-
"./codegen/templates/data-contract.tmpl": {
|
|
112
|
-
"import": "./codegen/templates/data-contract.tmpl.js",
|
|
113
|
-
"default": "./codegen/templates/data-contract.tmpl.js",
|
|
114
|
-
"types": "./codegen/templates/data-contract.tmpl.d.ts"
|
|
115
|
-
},
|
|
116
|
-
"./codegen/templates/data-contracts-file.tmpl": {
|
|
117
|
-
"import": "./codegen/templates/data-contracts-file.tmpl.js",
|
|
118
|
-
"default": "./codegen/templates/data-contracts-file.tmpl.js",
|
|
119
|
-
"types": "./codegen/templates/data-contracts-file.tmpl.d.ts"
|
|
120
|
-
},
|
|
121
|
-
"./codegen/templates/endpoint-jsdoc.tmpl": {
|
|
122
|
-
"import": "./codegen/templates/endpoint-jsdoc.tmpl.js",
|
|
123
|
-
"default": "./codegen/templates/endpoint-jsdoc.tmpl.js",
|
|
124
|
-
"types": "./codegen/templates/endpoint-jsdoc.tmpl.d.ts"
|
|
125
|
-
},
|
|
126
|
-
"./codegen/templates/endpoint-per-file.tmpl": {
|
|
127
|
-
"import": "./codegen/templates/endpoint-per-file.tmpl.js",
|
|
128
|
-
"default": "./codegen/templates/endpoint-per-file.tmpl.js",
|
|
129
|
-
"types": "./codegen/templates/endpoint-per-file.tmpl.d.ts"
|
|
130
|
-
},
|
|
131
|
-
"./codegen/templates/index-ts-for-endpoint-per-file.tmpl": {
|
|
132
|
-
"import": "./codegen/templates/index-ts-for-endpoint-per-file.tmpl.js",
|
|
133
|
-
"default": "./codegen/templates/index-ts-for-endpoint-per-file.tmpl.js",
|
|
134
|
-
"types": "./codegen/templates/index-ts-for-endpoint-per-file.tmpl.d.ts"
|
|
135
|
-
},
|
|
136
|
-
"./codegen/templates/meta-info.tmpl": {
|
|
137
|
-
"import": "./codegen/templates/meta-info.tmpl.js",
|
|
138
|
-
"default": "./codegen/templates/meta-info.tmpl.js",
|
|
139
|
-
"types": "./codegen/templates/meta-info.tmpl.d.ts"
|
|
140
|
-
},
|
|
141
|
-
"./codegen/templates/new-endpoint.tmpl": {
|
|
142
|
-
"import": "./codegen/templates/new-endpoint.tmpl.js",
|
|
143
|
-
"default": "./codegen/templates/new-endpoint.tmpl.js",
|
|
144
|
-
"types": "./codegen/templates/new-endpoint.tmpl.d.ts"
|
|
145
|
-
},
|
|
146
|
-
"./codegen/utils/remove-unused-types": {
|
|
147
|
-
"import": "./codegen/utils/remove-unused-types.js",
|
|
148
|
-
"default": "./codegen/utils/remove-unused-types.js",
|
|
149
|
-
"types": "./codegen/utils/remove-unused-types.d.ts"
|
|
150
|
-
},
|
|
151
|
-
"./codegen/utils/unpack-filter-option": {
|
|
152
|
-
"import": "./codegen/utils/unpack-filter-option.js",
|
|
153
|
-
"default": "./codegen/utils/unpack-filter-option.js",
|
|
154
|
-
"types": "./codegen/utils/unpack-filter-option.d.ts"
|
|
155
|
-
},
|
|
156
|
-
".": {
|
|
157
|
-
"import": "./index.js",
|
|
158
|
-
"default": "./index.js",
|
|
159
|
-
"types": "./index.d.ts"
|
|
160
|
-
},
|
|
161
|
-
"./runtime/endpoint-infinite-query": {
|
|
162
|
-
"import": "./runtime/endpoint-infinite-query.js",
|
|
163
|
-
"default": "./runtime/endpoint-infinite-query.js",
|
|
164
|
-
"types": "./runtime/endpoint-infinite-query.d.ts"
|
|
165
|
-
},
|
|
166
|
-
"./runtime/endpoint-mutation": {
|
|
167
|
-
"import": "./runtime/endpoint-mutation.js",
|
|
168
|
-
"default": "./runtime/endpoint-mutation.js",
|
|
169
|
-
"types": "./runtime/endpoint-mutation.d.ts"
|
|
170
|
-
},
|
|
171
|
-
"./runtime/endpoint-query-client": {
|
|
172
|
-
"import": "./runtime/endpoint-query-client.js",
|
|
173
|
-
"default": "./runtime/endpoint-query-client.js",
|
|
174
|
-
"types": "./runtime/endpoint-query-client.d.ts"
|
|
175
|
-
},
|
|
176
|
-
"./runtime/endpoint-query": {
|
|
177
|
-
"import": "./runtime/endpoint-query.js",
|
|
178
|
-
"default": "./runtime/endpoint-query.js",
|
|
179
|
-
"types": "./runtime/endpoint-query.d.ts"
|
|
180
|
-
},
|
|
181
|
-
"./runtime/endpoint": {
|
|
182
|
-
"import": "./runtime/endpoint.js",
|
|
183
|
-
"default": "./runtime/endpoint.js",
|
|
184
|
-
"types": "./runtime/endpoint.d.ts"
|
|
185
|
-
},
|
|
186
|
-
"./runtime/http-client": {
|
|
187
|
-
"import": "./runtime/http-client.js",
|
|
188
|
-
"default": "./runtime/http-client.js",
|
|
189
|
-
"types": "./runtime/http-client.d.ts"
|
|
190
|
-
},
|
|
191
|
-
"./runtime": {
|
|
192
|
-
"import": "./runtime/index.js",
|
|
193
|
-
"default": "./runtime/index.js",
|
|
194
|
-
"types": "./runtime/index.d.ts"
|
|
195
|
-
},
|
|
196
|
-
"./package.json": "./package.json"
|
|
81
|
+
"require": "./cli/index.cjs"
|
|
82
|
+
}
|
|
197
83
|
},
|
|
198
|
-
"
|
|
199
|
-
"*"
|
|
200
|
-
],
|
|
201
|
-
"main": "./index.js",
|
|
202
|
-
"typings": "./index.d.ts",
|
|
84
|
+
"bin": "./cli/bin.cjs",
|
|
203
85
|
"scripts": {
|
|
204
86
|
"clean": "rimraf dist",
|
|
205
87
|
"lint:check": "pnpm exec biome check --write --no-errors-on-unmatched --files-ignore-unknown=true",
|
|
@@ -207,11 +89,11 @@
|
|
|
207
89
|
"check": "npm run lint:check && npm run ts:check",
|
|
208
90
|
"prebuild": "npm run clean && npm run check",
|
|
209
91
|
"build:watch": "pnpm build && nodemon --delay 0.5 --watch src --ext ts,tsx --exec \"pnpm build\"",
|
|
210
|
-
"build": "
|
|
211
|
-
"pub": "
|
|
212
|
-
"pub:patch": "
|
|
213
|
-
"pub:minor": "
|
|
214
|
-
"pub:major": "
|
|
92
|
+
"build": "sborshik build --fillDist",
|
|
93
|
+
"pub": "pnpm build && sborshik publish --useDistDir",
|
|
94
|
+
"pub:patch": "PUBLISH_VERSION=patch pnpm run build",
|
|
95
|
+
"pub:minor": "PUBLISH_VERSION=minor pnpm run build",
|
|
96
|
+
"pub:major": "PUBLISH_VERSION=major pnpm run build",
|
|
215
97
|
"test": "vitest run --config vitest.config.ts",
|
|
216
98
|
"test:watch": "vitest watch --config vitest.config.ts",
|
|
217
99
|
"test:coverage": "vitest run --config vitest.config.ts --coverage",
|
|
@@ -0,0 +1,101 @@
|
|
|
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;
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint-infinite-query.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-infinite-query.ts"],"names":[],"mappings":"AAAA,OAAO,KA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AK,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,9 +1,9 @@
|
|
|
1
1
|
import type { DefaultError, InfiniteData, QueryObserverResult } from '@tanstack/query-core';
|
|
2
2
|
import { InfiniteQuery } from 'mobx-tanstack-query';
|
|
3
3
|
import type { MaybeFalsy } from 'yummies/utils/types';
|
|
4
|
-
import type { AnyEndpoint } from
|
|
5
|
-
import type { EndpointInfiniteQueryFlattenOptions, EndpointInfiniteQueryOptions, EndpointInfiniteQueryUpdateOptionsAllVariants } from
|
|
6
|
-
import type { EndpointQueryClient } from
|
|
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
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
8
|
private endpoint;
|
|
9
9
|
response: TEndpoint['__response'] | null;
|
|
@@ -1 +1 @@
|
|
|
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,KAA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AAK,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,6 +1,6 @@
|
|
|
1
1
|
import { makeObservable, observable, runInAction } from 'mobx';
|
|
2
2
|
import { InfiniteQuery } from 'mobx-tanstack-query';
|
|
3
|
-
import { buildOptionsFromParams } from
|
|
3
|
+
import { buildOptionsFromParams } from "./endpoint-query.js";
|
|
4
4
|
export class EndpointInfiniteQuery extends InfiniteQuery {
|
|
5
5
|
endpoint;
|
|
6
6
|
response = null;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { DefaultError, InfiniteData } from '@tanstack/query-core';
|
|
2
|
+
import type { InfiniteQueryConfig, InfiniteQueryDynamicOptions, InfiniteQueryOptions, InfiniteQueryUpdateOptions } from 'mobx-tanstack-query';
|
|
3
|
+
import type { AnyObject, MaybeFalsy } from 'yummies/utils/types';
|
|
4
|
+
import type { AnyEndpoint } from "./endpoint.types.cjs";
|
|
5
|
+
import type { EndpointQueryUniqKey, ExcludedQueryKeys } from "./endpoint-query.types.cjs";
|
|
6
|
+
type ShortInfiniteQueryConfig<TQueryFnData, TError = DefaultError, TPageParam = unknown, TData = InfiniteData<TQueryFnData, TPageParam>> = Omit<InfiniteQueryConfig<TQueryFnData, TError, TPageParam, TData, any[]>, ExcludedQueryKeys> & {
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type EndpointInfiniteQueryFlattenOptions<TEndpoint extends AnyEndpoint, TQueryFnData = TEndpoint['__response']['data'], TError = DefaultError, TPageParam = unknown, TData = InfiniteData<TQueryFnData, TPageParam>> = ShortInfiniteQueryConfig<NoInfer<TQueryFnData>, TError, TPageParam, TData> & {
|
|
10
|
+
uniqKey?: EndpointQueryUniqKey;
|
|
11
|
+
params: (pageParam: NoInfer<TPageParam>) => MaybeFalsy<TEndpoint['__params']>;
|
|
12
|
+
/**
|
|
13
|
+
* Transform response to QueryFnData
|
|
14
|
+
*/
|
|
15
|
+
transform?: (response: TEndpoint['__response']) => TQueryFnData | Promise<TQueryFnData>;
|
|
16
|
+
};
|
|
17
|
+
export type EndpointInfiniteQueryOptions<TEndpoint extends AnyEndpoint, TQueryFnData = TEndpoint['__response']['data'], TError = DefaultError, TPageParam = unknown, TData = InfiniteData<TQueryFnData, TPageParam>> = ShortInfiniteQueryConfig<NoInfer<TQueryFnData>, TError, TPageParam, TData> & {
|
|
18
|
+
uniqKey?: EndpointQueryUniqKey;
|
|
19
|
+
params: (pageParam: NoInfer<TPageParam>) => MaybeFalsy<TEndpoint['__params']>;
|
|
20
|
+
/**
|
|
21
|
+
* Transform response to QueryFnData
|
|
22
|
+
*/
|
|
23
|
+
transform?: (response: TEndpoint['__response']) => TQueryFnData | Promise<TQueryFnData>;
|
|
24
|
+
};
|
|
25
|
+
type EnhanceUpdatOptionVariant<TEndpoint extends AnyEndpoint, TVariant extends AnyObject> = Omit<TVariant, ExcludedQueryKeys> & {
|
|
26
|
+
params?: MaybeFalsy<TEndpoint['__params']>;
|
|
27
|
+
};
|
|
28
|
+
export type EndpointInfiniteQueryUpdateOptionsAllVariants<TEndpoint extends AnyEndpoint, TQueryFnData = TEndpoint['__response']['data'], TError = DefaultError, TPageParam = unknown, TData = InfiniteData<TQueryFnData, TPageParam>> = EnhanceUpdatOptionVariant<TEndpoint, Partial<InfiniteQueryOptions<TQueryFnData, TError, TPageParam, TData, any[]>>> | EnhanceUpdatOptionVariant<TEndpoint, InfiniteQueryUpdateOptions<TQueryFnData, TError, TPageParam, TData, any[]>> | EnhanceUpdatOptionVariant<TEndpoint, InfiniteQueryDynamicOptions<TQueryFnData, TError, TPageParam, TData, any[]>>;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=endpoint-infinite-query.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint-infinite-query.types.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-infinite-query.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EACV,mBAAmB,EACnB,2BAA2B,EAC3B,oBAAoB,EACpB,0BAA0B,EAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,6BAA4B;AACvD,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EAClB,mCAAkC;AAEnC,KAAK,wBAAwB,CAC3B,YAAY,EACZ,MAAM,GAAG,YAAY,EACrB,UAAU,GAAG,OAAO,EACpB,KAAK,GAAG,YAAY,CAAC,YAAY,EAAE,UAAU,CAAC,IAC5C,IAAI,CACN,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EACnE,iBAAiB,CAClB,GAAG;IACF,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,mCAAmC,CAC7C,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,IAC5C,wBAAwB,CAC1B,OAAO,CAAC,YAAY,CAAC,EACrB,MAAM,EACN,UAAU,EACV,KAAK,CACN,GAAG;IACF,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAE/B,MAAM,EAAE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AY,CAAC,YAAY,EAAE,UAAU,CAAC,IAE5C,yBAAyB,CACvB,SAAS,EACT,OAAO,CACL,oBAAoB,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CACrE,CACF,GACD,yBAAyB,CACvB,SAAS,EACT,0BAA0B,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAC3E,GACD,yBAAyB,CACvB,SAAS,EACT,2BAA2B,CACzB,YAAY,EACZ,MAAM,EACN,UAAU,EACV,KAAK,EACL,GAAG,EAAE,CACN,CACF,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { DefaultError, InfiniteData } from '@tanstack/query-core';
|
|
2
2
|
import type { InfiniteQueryConfig, InfiniteQueryDynamicOptions, InfiniteQueryOptions, InfiniteQueryUpdateOptions } from 'mobx-tanstack-query';
|
|
3
3
|
import type { AnyObject, MaybeFalsy } from 'yummies/utils/types';
|
|
4
|
-
import type { AnyEndpoint } from
|
|
5
|
-
import type { EndpointQueryUniqKey, ExcludedQueryKeys } from
|
|
4
|
+
import type { AnyEndpoint } from "./endpoint.types.js";
|
|
5
|
+
import type { EndpointQueryUniqKey, ExcludedQueryKeys } from "./endpoint-query.types.js";
|
|
6
6
|
type ShortInfiniteQueryConfig<TQueryFnData, TError = DefaultError, TPageParam = unknown, TData = InfiniteData<TQueryFnData, TPageParam>> = Omit<InfiniteQueryConfig<TQueryFnData, TError, TPageParam, TData, any[]>, ExcludedQueryKeys> & {
|
|
7
7
|
enabled?: boolean;
|
|
8
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-infinite-query.types.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-infinite-query.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EACV,mBAAmB,EACnB,2BAA2B,EAC3B,oBAAoB,EACpB,0BAA0B,EAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"endpoint-infinite-query.types.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-infinite-query.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EACV,mBAAmB,EACnB,2BAA2B,EAC3B,oBAAoB,EACpB,0BAA0B,EAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,4BAA4B;AACvD,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EAClB,kCAAkC;AAEnC,KAAK,wBAAwB,CAC3B,YAAY,EACZ,MAAM,GAAG,YAAY,EACrB,UAAU,GAAG,OAAO,EACpB,KAAK,GAAG,YAAY,CAAC,YAAY,EAAE,UAAU,CAAC,IAC5C,IAAI,CACN,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EACnE,iBAAiB,CAClB,GAAG;IACF,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,mCAAmC,CAC7C,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,IAC5C,wBAAwB,CAC1B,OAAO,CAAC,YAAY,CAAC,EACrB,MAAM,EACN,UAAU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M,CAAC,EAC9C,MAAM,GAAG,YAAY,EACrB,UAAU,GAAG,OAAO,EACpB,KAAK,GAAG,YAAY,CAAC,YAAY,EAAE,UAAU,CAAC,IAE5C,yBAAyB,CACvB,SAAS,EACT,OAAO,CACL,oBAAoB,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CACrE,CACF,GACD,yBAAyB,CACvB,SAAS,EACT,0BAA0B,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAC3E,GACD,yBAAyB,CACvB,SAAS,EACT,2BAA2B,CACzB,YAAY,EACZ,MAAM,EACN,UAAU,EACV,KAAK,EACL,GAAG,EAAE,CACN,CACF,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EndpointMutation = void 0;
|
|
4
|
+
const mobx_tanstack_query_1 = require("mobx-tanstack-query");
|
|
5
|
+
/**
|
|
6
|
+
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/endpoint-mutations/)
|
|
7
|
+
*/
|
|
8
|
+
class EndpointMutation extends mobx_tanstack_query_1.Mutation {
|
|
9
|
+
endpoint;
|
|
10
|
+
constructor(endpoint, queryClient, { transform: transformResponse, invalidateEndpoints, ...mutationOptions }) {
|
|
11
|
+
super({
|
|
12
|
+
...mutationOptions,
|
|
13
|
+
queryClient,
|
|
14
|
+
onSuccess: (data, variables, context) => {
|
|
15
|
+
mutationOptions.onSuccess?.(data, variables, context);
|
|
16
|
+
if (invalidateEndpoints) {
|
|
17
|
+
if (typeof invalidateEndpoints === 'object') {
|
|
18
|
+
queryClient.invalidateEndpoints(invalidateEndpoints);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
let filters;
|
|
22
|
+
switch (`${invalidateEndpoints}`) {
|
|
23
|
+
case 'true': {
|
|
24
|
+
filters = endpoint.group
|
|
25
|
+
? {
|
|
26
|
+
group: endpoint.group,
|
|
27
|
+
}
|
|
28
|
+
: {
|
|
29
|
+
tag: endpoint.tags,
|
|
30
|
+
};
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
case 'by-group': {
|
|
34
|
+
filters = {
|
|
35
|
+
group: endpoint.group,
|
|
36
|
+
};
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
case 'by-tag': {
|
|
40
|
+
filters = {
|
|
41
|
+
tag: endpoint.tags,
|
|
42
|
+
};
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (filters) {
|
|
47
|
+
queryClient.invalidateEndpoints(filters);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
mutationFn: async (input) => {
|
|
53
|
+
let requestParams = input?.requestParams;
|
|
54
|
+
if (requestParams) {
|
|
55
|
+
if (!requestParams.signal) {
|
|
56
|
+
requestParams.signal = this.abortController.signal;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
requestParams = { signal: this.abortController.signal };
|
|
61
|
+
}
|
|
62
|
+
const fixedInput = {
|
|
63
|
+
...input,
|
|
64
|
+
requestParams,
|
|
65
|
+
};
|
|
66
|
+
const response = await endpoint.request(fixedInput);
|
|
67
|
+
return (await transformResponse?.(response)) ?? response.data;
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
this.endpoint = endpoint;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.EndpointMutation = EndpointMutation;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Mutation } from 'mobx-tanstack-query';
|
|
2
|
+
import type { AnyObject } from 'yummies/utils/types';
|
|
3
|
+
import type { AnyEndpoint } from "./endpoint.types.cjs";
|
|
4
|
+
import type { EndpointMutationOptions, EndpointMutationParams } from "./endpoint-mutation.types.cjs";
|
|
5
|
+
import type { EndpointQueryClient } from "./endpoint-query-client.cjs";
|
|
6
|
+
/**
|
|
7
|
+
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/endpoint-mutations/)
|
|
8
|
+
*/
|
|
9
|
+
export declare class EndpointMutation<TEndpoint extends AnyEndpoint, TData = unknown, TParams extends AnyObject = AnyObject, TMutationMeta extends AnyObject | void = void, TContext = unknown> extends Mutation<TData, EndpointMutationParams<TParams, TMutationMeta>, TEndpoint['__response']['error'], TContext> {
|
|
10
|
+
private endpoint;
|
|
11
|
+
constructor(endpoint: AnyEndpoint, queryClient: EndpointQueryClient, { transform: transformResponse, invalidateEndpoints, ...mutationOptions }: EndpointMutationOptions<TEndpoint, TData, TParams, TMutationMeta, TContext>);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=endpoint-mutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint-mutation.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-mutation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAS,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,6BAA4B;AACvD,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EACvB,sCAAqC;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,oCAAmC;AAItE;;GAEG;AACH,qBAAa,gBAAgB,CAC3B,SAAS,SAAS,WAAW,EAC7B,KAAK,GAAG,OAAO,EACf,OAAO,SAAS,SAAS,GAAG,SAAS,EACrC,aAAa,SAAS,SAAS,GAAG,IAAI,GAAG,IAAI,EAC7C,QAAQ,GAAG,OAAO,CAClB,SAAQ,QAAQ,CAChB,KAAK,EACL,sBAAsB,CAAC,OAAO,EAAE,aAAa,CAAC,EAC9C,SAAS,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,EAChC,QAAQ,CACT;IAEG,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,WAAW,EAC7B,WAAW,EAAE,mBAAmB,EAChC,EACE,SAAS,EAAE,iBAAiB,EAC5B,mBAAmB,EACnB,GAAG,eAAe,EACnB,EAAE,uBAAuB,CACxB,SAAS,EACT,KAAK,EACL,OAAO,EACP,aAAa,EACb,QAAQ,CACT;CAmEJ"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Mutation } from 'mobx-tanstack-query';
|
|
2
2
|
import type { AnyObject } from 'yummies/utils/types';
|
|
3
|
-
import type { AnyEndpoint } from
|
|
4
|
-
import type { EndpointMutationOptions, EndpointMutationParams } from
|
|
5
|
-
import type { EndpointQueryClient } from
|
|
3
|
+
import type { AnyEndpoint } from "./endpoint.types.js";
|
|
4
|
+
import type { EndpointMutationOptions, EndpointMutationParams } from "./endpoint-mutation.types.js";
|
|
5
|
+
import type { EndpointQueryClient } from "./endpoint-query-client.js";
|
|
6
6
|
/**
|
|
7
7
|
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/endpoint-mutations/)
|
|
8
8
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-mutation.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-mutation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAS,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"endpoint-mutation.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-mutation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAS,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,4BAA4B;AACvD,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EACvB,qCAAqC;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,mCAAmC;AAItE;;GAEG;AACH,qBAAa,gBAAgB,CAC3B,SAAS,SAAS,WAAW,EAC7B,KAAK,GAAG,OAAO,EACf,OAAO,SAAS,SAAS,GAAG,SAAS,EACrC,aAAa,SAAS,SAAS,GAAG,IAAI,GAAG,IAAI,EAC7C,QAAQ,GAAG,OAAO,CAClB,SAAQ,QAAQ,CAChB,KAAK,EACL,sBAAsB,CAAC,OAAO,EAAE,aAAa,CAAC,EAC9C,SAAS,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,EAChC,QAAQ,CACT;IAEG,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,WAAW,EAC7B,WAAW,EAAE,mBAAmB,EAChC,EACE,SAAS,EAAE,iBAAiB,EAC5B,mBAAmB,EACnB,GAAG,eAAe,EACnB,EAAE,uBAAuB,CACxB,SAAS,EACT,KAAK,EACL,OAAO,EACP,aAAa,EACb,QAAQ,CACT;CAmEJ"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { MutationConfig, MutationInvalidateQueriesOptions } from 'mobx-tanstack-query';
|
|
2
|
+
import type { AnyObject, IsPartial, Maybe } from 'yummies/utils/types';
|
|
3
|
+
import type { AnyEndpoint } from "./endpoint.types.cjs";
|
|
4
|
+
import type { InvalidateEndpointsFilters } from "./endpoint-query-client.types.cjs";
|
|
5
|
+
export interface EndpointMutationInvalidateQueriesOptions extends MutationInvalidateQueriesOptions {
|
|
6
|
+
}
|
|
7
|
+
export type EndpointMutationParams<TParams extends AnyObject, TMutationMeta extends AnyObject | void = void> = TParams & (TMutationMeta extends void ? {} : IsPartial<TMutationMeta> extends true ? {
|
|
8
|
+
meta?: Maybe<TMutationMeta>;
|
|
9
|
+
} : {
|
|
10
|
+
meta: TMutationMeta;
|
|
11
|
+
});
|
|
12
|
+
export type EndpointMutationOptions<TEndpoint extends AnyEndpoint, TData = unknown, TParams extends AnyObject = AnyObject, TMutationMeta extends AnyObject | void = void, TContext = unknown> = {
|
|
13
|
+
/**
|
|
14
|
+
* Invalidates query endpoints using various filters based on data from the OpenAPI schema
|
|
15
|
+
*
|
|
16
|
+
* The value `by-group` will invalidate query endpoints that belong to the exact same group as the mutation
|
|
17
|
+
*
|
|
18
|
+
* The value `by-tag` will invalidate query endpoints that contain at least one tag described in the endpoint with the mutation
|
|
19
|
+
*
|
|
20
|
+
* The value `true` will use dynamic definition of `by-group` | `by-tag` values.
|
|
21
|
+
* If there is a group, it will use `by-group` invalidation, if there is a tag then `by-tag`
|
|
22
|
+
*/
|
|
23
|
+
invalidateEndpoints?: true | 'by-group' | 'by-tag' | InvalidateEndpointsFilters;
|
|
24
|
+
/**
|
|
25
|
+
* Transform response to TData
|
|
26
|
+
*/
|
|
27
|
+
transform?: (response: TEndpoint['__response']) => TData | Promise<TData>;
|
|
28
|
+
invalidateQueries?: EndpointMutationInvalidateQueriesOptions | ((data: NoInfer<TData>, payload: EndpointMutationParams<NoInfer<TParams>, NoInfer<TMutationMeta>>) => EndpointMutationInvalidateQueriesOptions | null | undefined);
|
|
29
|
+
} & Omit<MutationConfig<NoInfer<TData>, EndpointMutationParams<NoInfer<TParams>, NoInfer<TMutationMeta>>, TEndpoint['__response']['error'], TContext>, 'queryClient' | 'mutationFn' | 'invalidateQueries'>;
|
|
30
|
+
//# sourceMappingURL=endpoint-mutation.types.d.ts.map
|