@povio/openapi-codegen-cli 2.0.8-rc.37 → 2.0.8-rc.39
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/README.md +0 -87
- package/dist/acl.d.ts +4 -0
- package/dist/acl.mjs +7 -73
- package/dist/commands/check.command.d.ts +2 -0
- package/dist/commands/check.d.ts +7 -0
- package/dist/commands/generate.command.d.ts +2 -0
- package/dist/commands/generate.d.ts +8 -0
- package/dist/generator.d.ts +3 -0
- package/dist/generator.js +78 -0
- package/dist/generators/checkOpenAPIDoc.d.ts +3 -0
- package/dist/generators/const/acl.const.d.ts +13 -0
- package/dist/generators/const/buildConfigs.const.d.ts +1 -0
- package/dist/generators/const/deps.const.d.ts +38 -0
- package/dist/generators/const/endpoints.const.d.ts +11 -0
- package/dist/generators/const/js.const.d.ts +1 -0
- package/dist/generators/const/openapi.const.d.ts +7 -0
- package/dist/generators/const/options.const.d.ts +2 -0
- package/dist/generators/const/package.const.d.ts +2 -0
- package/dist/generators/const/queries.const.d.ts +8 -0
- package/dist/generators/const/validation.const.d.ts +53 -0
- package/dist/generators/const/zod.const.d.ts +19 -0
- package/dist/generators/core/SchemaResolver.class.d.ts +71 -0
- package/dist/generators/core/endpoints/getEndpointAcl.d.ts +8 -0
- package/dist/generators/core/endpoints/getEndpointBody.d.ts +13 -0
- package/dist/generators/core/endpoints/getEndpointParameter.d.ts +11 -0
- package/dist/generators/core/endpoints/getEndpointsFromOpenAPIDoc.d.ts +3 -0
- package/dist/generators/core/endpoints/getEndpointsFromOpenAPIDoc.test.d.ts +1 -0
- package/dist/generators/core/getDataFromOpenAPIDoc.d.ts +8 -0
- package/dist/generators/core/getMetadataFromOpenAPIDoc.d.ts +4 -0
- package/dist/generators/core/getMetadataFromOpenAPIDoc.test.d.ts +1 -0
- package/dist/generators/core/openapi/getOpenAPISchemaComplexity.d.ts +2 -0
- package/dist/generators/core/openapi/getOpenAPISchemaComplexity.test.d.ts +1 -0
- package/dist/generators/core/openapi/getOpenAPISchemaDependencyGraph.d.ts +6 -0
- package/dist/generators/core/openapi/getOpenAPISchemaDependencyGraph.test.d.ts +1 -0
- package/dist/generators/core/openapi/getSchemaRefObjs.d.ts +4 -0
- package/dist/generators/core/openapi/iterateSchema.d.ts +22 -0
- package/dist/generators/core/resolveConfig.d.ts +7 -0
- package/dist/generators/core/zod/ZodSchema.class.d.ts +26 -0
- package/dist/generators/core/zod/enumExtraction/resolveExtractedEnumZodSchemaNames.d.ts +2 -0
- package/dist/generators/core/zod/enumExtraction/resolveExtractedEnumZodSchemaTags.d.ts +2 -0
- package/dist/generators/core/zod/enumExtraction/updateExtractedEnumZodSchemaData.d.ts +17 -0
- package/dist/generators/core/zod/getZodChain.d.ts +8 -0
- package/dist/generators/core/zod/getZodSchema.d.ts +17 -0
- package/dist/generators/core/zod/getZodSchema.test.d.ts +1 -0
- package/dist/generators/core/zod/getZodSchemaRefs.d.ts +6 -0
- package/dist/generators/core/zod/getZodSchemasFromOpenAPIDoc.d.ts +6 -0
- package/dist/generators/core/zod/resolveZodSchemaName.d.ts +10 -0
- package/dist/generators/core/zod/sortZodSchemasByTopology.d.ts +4 -0
- package/dist/generators/generate/generateAcl.d.ts +3 -0
- package/dist/generators/generate/generateAclCheck.d.ts +2 -0
- package/dist/generators/generate/generateAppRestClient.d.ts +2 -0
- package/dist/generators/generate/generateConfigs.d.ts +2 -0
- package/dist/generators/generate/generateEndpoints.d.ts +2 -0
- package/dist/generators/generate/generateModels.d.ts +2 -0
- package/dist/generators/generate/generateQueries.d.ts +2 -0
- package/dist/generators/generate/generateQueryModules.d.ts +2 -0
- package/dist/generators/generate/generateZodExtended.d.ts +2 -0
- package/dist/generators/generateCodeFromOpenAPIDoc.d.ts +4 -0
- package/dist/generators/types/builder-config.d.ts +48 -0
- package/dist/generators/types/common.d.ts +27 -0
- package/dist/generators/types/config.d.ts +2 -0
- package/dist/generators/types/endpoint.d.ts +50 -0
- package/dist/generators/types/generate.d.ts +39 -0
- package/dist/generators/types/metadata.d.ts +51 -0
- package/dist/generators/types/openapi.d.ts +22 -0
- package/dist/generators/types/options.d.ts +66 -0
- package/dist/generators/types/validation.d.ts +5 -0
- package/dist/generators/utils/array.utils.d.ts +1 -0
- package/dist/generators/utils/endpoint.utils.d.ts +12 -0
- package/dist/generators/utils/endpoint.utils.test.d.ts +1 -0
- package/dist/generators/utils/file.utils.d.ts +8 -0
- package/dist/generators/utils/generate/generate.acl.utils.d.ts +23 -0
- package/dist/generators/utils/generate/generate.configs.utils.d.ts +15 -0
- package/dist/generators/utils/generate/generate.endpoints.utils.d.ts +41 -0
- package/dist/generators/utils/generate/generate.imports.utils.d.ts +39 -0
- package/dist/generators/utils/generate/generate.imports.utils.test.d.ts +1 -0
- package/dist/generators/utils/generate/generate.openapi.utils.d.ts +2 -0
- package/dist/generators/utils/generate/generate.query.utils.d.ts +6 -0
- package/dist/generators/utils/generate/generate.utils.d.ts +18 -0
- package/dist/generators/utils/generate/generate.zod.utils.d.ts +13 -0
- package/dist/generators/utils/generate-files.utils.d.ts +6 -0
- package/dist/generators/utils/hbs/hbs-template.utils.d.ts +3 -0
- package/dist/generators/utils/hbs/hbs.acl.utils.d.ts +2 -0
- package/dist/generators/utils/hbs/hbs.common.utils.d.ts +1 -0
- package/dist/generators/utils/hbs/hbs.endpoints.utils.d.ts +2 -0
- package/dist/generators/utils/hbs/hbs.imports.utils.d.ts +1 -0
- package/dist/generators/utils/hbs/hbs.partials.utils.d.ts +2 -0
- package/dist/generators/utils/hbs/hbs.query.utils.d.ts +2 -0
- package/dist/generators/utils/hbs/hbs.zod.utils.d.ts +2 -0
- package/dist/generators/utils/js.utils.d.ts +2 -0
- package/dist/generators/utils/js.utils.test.d.ts +1 -0
- package/dist/generators/utils/math.utils.d.ts +1 -0
- package/dist/generators/utils/namespace.utils.d.ts +7 -0
- package/dist/generators/utils/object.utils.d.ts +13 -0
- package/dist/generators/utils/object.utils.test.d.ts +1 -0
- package/dist/generators/utils/openapi-schema.utils.d.ts +15 -0
- package/dist/generators/utils/openapi.utils.d.ts +23 -0
- package/dist/generators/utils/openapi.utils.test.d.ts +1 -0
- package/dist/generators/utils/operation.utils.d.ts +22 -0
- package/dist/generators/utils/operation.utils.test.d.ts +1 -0
- package/dist/generators/utils/query.utils.d.ts +7 -0
- package/dist/generators/utils/sort.utils.d.ts +7 -0
- package/dist/generators/utils/string.utils.d.ts +14 -0
- package/dist/generators/utils/string.utils.test.d.ts +1 -0
- package/dist/generators/utils/tag.utils.d.ts +7 -0
- package/dist/generators/utils/ts.utils.d.ts +16 -0
- package/dist/generators/utils/validation.utils.d.ts +17 -0
- package/dist/generators/utils/zod-schema.utils.d.ts +15 -0
- package/dist/helpers/cli.helper.d.ts +22 -0
- package/dist/helpers/config.helper.d.ts +3 -0
- package/dist/helpers/version.helper.d.ts +4 -0
- package/dist/helpers/yargs.helper.d.ts +10 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.mjs +22 -252
- package/dist/lib/acl/AclGuard.d.ts +8 -0
- package/dist/lib/acl/AclGuard.mjs +14 -0
- package/dist/lib/acl/Can.d.ts +9 -0
- package/dist/lib/acl/Can.mjs +11 -0
- package/dist/lib/acl/ability.context.d.ts +15 -0
- package/dist/lib/acl/ability.context.mjs +37 -0
- package/dist/lib/acl/appAbility.types.d.ts +3 -0
- package/dist/lib/assets/locales/en/translation.json.mjs +8 -0
- package/dist/lib/assets/locales/sl/translation.json.mjs +8 -0
- package/dist/lib/auth/AuthGuard.d.ts +6 -0
- package/dist/lib/auth/AuthGuard.mjs +26 -0
- package/dist/lib/auth/auth.context.d.ts +22 -0
- package/dist/lib/auth/auth.context.mjs +41 -0
- package/dist/lib/config/i18n.d.ts +32 -0
- package/dist/lib/config/i18n.mjs +31 -0
- package/dist/lib/config/queryConfig.context.d.ts +17 -0
- package/dist/lib/config/queryConfig.context.mjs +26 -0
- package/dist/lib/config/router.context.d.ts +9 -0
- package/dist/lib/config/router.context.mjs +20 -0
- package/dist/lib/react-query.types.d.ts +10 -0
- package/dist/lib/rest/error-handling.d.ts +30 -0
- package/dist/lib/rest/error-handling.mjs +132 -0
- package/dist/lib/rest/rest-client.d.ts +22 -0
- package/dist/lib/rest/rest-client.mjs +62 -0
- package/dist/lib/rest/rest-client.types.d.ts +23 -0
- package/dist/lib/rest/rest-interceptor.d.ts +8 -0
- package/dist/lib/rest/rest-interceptor.mjs +21 -0
- package/dist/lib/rest/rest.utils.d.ts +7 -0
- package/dist/lib/rest/rest.utils.mjs +51 -0
- package/dist/sh.d.ts +2 -0
- package/dist/sh.js +649 -0
- package/package.json +43 -51
- package/src/assets/useCrossTabQueryInvalidation.ts +40 -0
- package/src/assets/useMutationEffects.ts +94 -0
- package/src/generators/templates/acl-check.hbs +29 -0
- package/src/generators/templates/acl.hbs +19 -0
- package/src/generators/templates/app-acl.hbs +17 -0
- package/src/generators/templates/app-rest-client.hbs +7 -0
- package/src/generators/templates/configs.hbs +80 -0
- package/src/generators/templates/endpoints.hbs +44 -0
- package/src/generators/templates/models.hbs +23 -0
- package/src/generators/templates/partials/acl-check-call.hbs +1 -0
- package/src/generators/templates/partials/casl-ability-function.hbs +12 -0
- package/src/generators/templates/partials/casl-ability-query.hbs +1 -0
- package/src/generators/templates/partials/casl-ability-type.hbs +1 -0
- package/src/generators/templates/partials/columns-config.hbs +11 -0
- package/src/generators/templates/partials/endpoint-config.hbs +31 -0
- package/src/generators/templates/partials/endpoint-param-parse.hbs +1 -0
- package/src/generators/templates/partials/endpoint-params.hbs +1 -0
- package/src/generators/templates/partials/import.hbs +1 -0
- package/src/generators/templates/partials/inputs-config.hbs +10 -0
- package/src/generators/templates/partials/model-js-docs.hbs +6 -0
- package/src/generators/templates/partials/query-js-docs.hbs +31 -0
- package/src/generators/templates/partials/query-keys.hbs +11 -0
- package/src/generators/templates/partials/query-use-infinite-query.hbs +22 -0
- package/src/generators/templates/partials/query-use-mutation.hbs +54 -0
- package/src/generators/templates/partials/query-use-query.hbs +17 -0
- package/src/generators/templates/queries.hbs +54 -0
- package/src/generators/templates/query-modules.hbs +5 -0
- package/src/generators/templates/zod-extended.hbs +49 -0
- package/dist/acl.d.mts +0 -59
- package/dist/auth.context-Bu5KW2sI.mjs +0 -59
- package/dist/config-DTx4Ck6g.d.mts +0 -6
- package/dist/error-handling-CXeVTk1T.d.mts +0 -38
- package/dist/error-handling-DkPY7Asf.mjs +0 -187
- package/dist/generate.runner-DLLGYMVB.mjs +0 -90
- package/dist/generateCodeFromOpenAPIDoc-CFbiHxB7.mjs +0 -4729
- package/dist/generator.d.mts +0 -65
- package/dist/generator.mjs +0 -144
- package/dist/index.d.mts +0 -231
- package/dist/options-fyt0BYYE.d.mts +0 -95
- package/dist/sh.d.mts +0 -1
- package/dist/sh.mjs +0 -450
- package/dist/vite.d.mts +0 -11
- package/dist/vite.mjs +0 -53
- package/dist/zod.d.mts +0 -20
- package/dist/zod.mjs +0 -33
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@povio/openapi-codegen-cli",
|
|
3
|
-
"version": "2.0.8-rc.
|
|
3
|
+
"version": "2.0.8-rc.39",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"codegen",
|
|
6
6
|
"openapi",
|
|
@@ -16,72 +16,58 @@
|
|
|
16
16
|
"url": "git+https://github.com/povio/openapi-codegen-cli.git"
|
|
17
17
|
},
|
|
18
18
|
"bin": {
|
|
19
|
-
"openapi-codegen": "./dist/sh.
|
|
19
|
+
"openapi-codegen": "./dist/sh.js"
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
22
|
"README.md",
|
|
23
23
|
"dist/*",
|
|
24
|
-
"src/assets/**"
|
|
24
|
+
"src/assets/**",
|
|
25
|
+
"src/generators/templates/**"
|
|
25
26
|
],
|
|
26
|
-
"type": "module",
|
|
27
27
|
"main": "./dist/index.mjs",
|
|
28
|
-
"types": "./dist/index.d.
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
29
|
"exports": {
|
|
30
30
|
".": {
|
|
31
|
-
"types": "./dist/index.d.
|
|
32
|
-
"import": "./dist/index.mjs"
|
|
33
|
-
|
|
34
|
-
"./vite": {
|
|
35
|
-
"types": "./dist/vite.d.mts",
|
|
36
|
-
"import": "./dist/vite.mjs"
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"import": "./dist/index.mjs",
|
|
33
|
+
"require": "./dist/index.mjs"
|
|
37
34
|
},
|
|
38
35
|
"./generator": {
|
|
39
|
-
"types": "./dist/generator.d.
|
|
40
|
-
"import": "./dist/generator.
|
|
36
|
+
"types": "./dist/generator.d.ts",
|
|
37
|
+
"import": "./dist/generator.js",
|
|
38
|
+
"require": "./dist/generator.js"
|
|
41
39
|
},
|
|
42
40
|
"./acl": {
|
|
43
|
-
"types": "./dist/acl.d.
|
|
44
|
-
"import": "./dist/acl.mjs"
|
|
45
|
-
|
|
46
|
-
"./zod": {
|
|
47
|
-
"types": "./dist/zod.d.mts",
|
|
48
|
-
"import": "./dist/zod.mjs"
|
|
41
|
+
"types": "./dist/acl.d.ts",
|
|
42
|
+
"import": "./dist/acl.mjs",
|
|
43
|
+
"require": "./dist/acl.mjs"
|
|
49
44
|
}
|
|
50
45
|
},
|
|
51
46
|
"scripts": {
|
|
52
47
|
"start": "node --import tsx ./src/sh.ts",
|
|
53
48
|
"test": "vitest run",
|
|
54
49
|
"test:watch": "vitest",
|
|
55
|
-
"build": "
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"gen:verify": "pnpm gen:base && pnpm gen:next && pnpm test:generated-eq",
|
|
50
|
+
"build:clean": "rm -rf ./dist",
|
|
51
|
+
"build:client": "vite build",
|
|
52
|
+
"build:cli": "node ./esbuild.mjs && chmod +x ./dist/sh.js",
|
|
53
|
+
"build": "yarn build:clean && yarn build:cli && yarn build:client",
|
|
54
|
+
"start:dist": "node ./dist/sh.js",
|
|
61
55
|
"typecheck": "tsc --noEmit",
|
|
62
56
|
"lint": "oxlint --type-aware --fix",
|
|
63
57
|
"lint:check": "oxlint --type-aware",
|
|
64
58
|
"format": "oxfmt",
|
|
65
59
|
"format:check": "oxfmt --check",
|
|
66
|
-
"check": "
|
|
67
|
-
"push": "
|
|
68
|
-
"dev:generate": "rm -rf ./output &&
|
|
69
|
-
"dev:check": "
|
|
70
|
-
"snapshot:openapi-localhost": "node ./scripts/snapshot-openapi-localhost.mjs",
|
|
71
|
-
"bench:vite-codegen": "node ./scripts/benchmark-vite-codegen.mjs"
|
|
60
|
+
"check": "yarn typecheck && yarn lint && yarn test",
|
|
61
|
+
"push": "yarn exec ./scripts/publish.sh",
|
|
62
|
+
"dev:generate": "rm -rf ./output && yarn start generate --config ./test/config.ts",
|
|
63
|
+
"dev:check": "yarn start check --config ./test/config.ts"
|
|
72
64
|
},
|
|
73
65
|
"dependencies": {
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"import-fresh": "^3.3.1",
|
|
77
|
-
"openapi-types": "^12.1.3",
|
|
78
|
-
"prompt-sync": "^4.2.0",
|
|
79
|
-
"reflect-metadata": "^0.2.2",
|
|
80
|
-
"ts-pattern": "^5.9.0",
|
|
81
|
-
"typescript": "^5.9.3",
|
|
82
|
-
"yargs": "^18.0.0"
|
|
66
|
+
"i18next": "^25.8.11",
|
|
67
|
+
"import-fresh": "^3.3.1"
|
|
83
68
|
},
|
|
84
69
|
"devDependencies": {
|
|
70
|
+
"@apidevtools/swagger-parser": "^10.1.0",
|
|
85
71
|
"@casl/ability": "^6.8.0",
|
|
86
72
|
"@casl/react": "^5.0.1",
|
|
87
73
|
"@tanstack/react-query": "~5.90.21",
|
|
@@ -90,16 +76,25 @@
|
|
|
90
76
|
"@types/react": "^19.2.14",
|
|
91
77
|
"@types/yargs": "^17.0.35",
|
|
92
78
|
"@vitejs/plugin-react": "^5.1.4",
|
|
79
|
+
"axios": "^1.13.5",
|
|
80
|
+
"esbuild": "0.27.3",
|
|
81
|
+
"handlebars": "^4.7.8",
|
|
82
|
+
"openapi-types": "^12.1.3",
|
|
93
83
|
"oxfmt": "^0.34.0",
|
|
94
|
-
"oxlint": "^1.
|
|
95
|
-
"oxlint-tsgolint": "^0.
|
|
84
|
+
"oxlint": "^1.49.0",
|
|
85
|
+
"oxlint-tsgolint": "^0.14.1",
|
|
86
|
+
"prompt-sync": "^4.2.0",
|
|
96
87
|
"react": "^19.2.4",
|
|
97
|
-
"
|
|
88
|
+
"reflect-metadata": "^0.2.2",
|
|
89
|
+
"ts-pattern": "^5.9.0",
|
|
98
90
|
"tsx": "^4.21.0",
|
|
99
91
|
"type-fest": "^5.4.4",
|
|
100
|
-
"
|
|
92
|
+
"typescript": "^5.9.3",
|
|
93
|
+
"vite": "^7.3.1",
|
|
101
94
|
"vite-plugin-dts": "^4.5.4",
|
|
102
|
-
"vitest": "4.0.18"
|
|
95
|
+
"vitest": "4.0.18",
|
|
96
|
+
"yargs": "^18.0.0",
|
|
97
|
+
"zod": "^4.3.6"
|
|
103
98
|
},
|
|
104
99
|
"peerDependencies": {
|
|
105
100
|
"@casl/ability": "^6.7.3",
|
|
@@ -107,7 +102,6 @@
|
|
|
107
102
|
"@tanstack/react-query": "^5.90.21",
|
|
108
103
|
"axios": "^1.13.1",
|
|
109
104
|
"react": "^19.1.0",
|
|
110
|
-
"vite": "^6.0.0 || ^7.0.0 || ^8.0.0",
|
|
111
105
|
"zod": "^4.1.12"
|
|
112
106
|
},
|
|
113
107
|
"peerDependenciesMeta": {
|
|
@@ -116,14 +110,12 @@
|
|
|
116
110
|
},
|
|
117
111
|
"@casl/react": {
|
|
118
112
|
"optional": true
|
|
119
|
-
},
|
|
120
|
-
"vite": {
|
|
121
|
-
"optional": true
|
|
122
113
|
}
|
|
123
114
|
},
|
|
124
115
|
"engines": {
|
|
125
116
|
"node": ">= 14",
|
|
126
|
-
"
|
|
117
|
+
"npm": ">= 8",
|
|
118
|
+
"yarn": ">= 3.2"
|
|
127
119
|
},
|
|
128
|
-
"packageManager": "
|
|
120
|
+
"packageManager": "yarn@4.2.2"
|
|
129
121
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { QueryClient, QueryKey } from "@tanstack/react-query";
|
|
2
|
+
|
|
3
|
+
const CROSS_TAB_INVALIDATE_KEY = "__rq_invalidate__";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Broadcasts a query invalidation event to all other open tabs via localStorage.
|
|
7
|
+
*
|
|
8
|
+
* @param queryKeys - An array of query keys to invalidate (array of arrays).
|
|
9
|
+
*
|
|
10
|
+
* NOTE: The `storage` event only fires in *other* tabs — the calling tab
|
|
11
|
+
* must invalidate its own queryClient separately if needed.
|
|
12
|
+
*/
|
|
13
|
+
export const broadcastQueryInvalidation = (queryKeys: QueryKey[]) => {
|
|
14
|
+
localStorage.setItem(CROSS_TAB_INVALIDATE_KEY, JSON.stringify({ keys: queryKeys, timestamp: Date.now() }));
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Registers a one-time global `storage` event listener that reacts to
|
|
19
|
+
* cross-tab invalidation broadcasts. Safe to call from multiple hooks —
|
|
20
|
+
* only the first call sets up the listener.
|
|
21
|
+
*/
|
|
22
|
+
let isListenerSetUp = false;
|
|
23
|
+
|
|
24
|
+
export const setupCrossTabListener = (queryClient: QueryClient) => {
|
|
25
|
+
if (isListenerSetUp) return;
|
|
26
|
+
isListenerSetUp = true;
|
|
27
|
+
|
|
28
|
+
window.addEventListener("storage", (e: StorageEvent) => {
|
|
29
|
+
if (e.key !== CROSS_TAB_INVALIDATE_KEY || !e.newValue) return;
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
const { keys } = JSON.parse(e.newValue) as { keys: QueryKey[] };
|
|
33
|
+
for (const queryKey of keys) {
|
|
34
|
+
queryClient.invalidateQueries({ queryKey });
|
|
35
|
+
}
|
|
36
|
+
} catch {
|
|
37
|
+
// Ignore malformed payloads
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { useCallback, useEffect } from "react";
|
|
2
|
+
|
|
3
|
+
import { QueryKey, useQueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { OpenApiQueryConfig, QueryModule, InvalidationMap } from "../lib/config/queryConfig.context";
|
|
5
|
+
import { broadcastQueryInvalidation, setupCrossTabListener } from "./useCrossTabQueryInvalidation";
|
|
6
|
+
|
|
7
|
+
export interface MutationEffectsOptions {
|
|
8
|
+
invalidateCurrentModule?: boolean;
|
|
9
|
+
crossTabInvalidation?: boolean;
|
|
10
|
+
invalidationMap?: InvalidationMap;
|
|
11
|
+
invalidateModules?: QueryModule[];
|
|
12
|
+
invalidateKeys?: QueryKey[];
|
|
13
|
+
preferUpdate?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface UseMutationEffectsProps {
|
|
17
|
+
currentModule: QueryModule;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function useMutationEffects({ currentModule }: UseMutationEffectsProps) {
|
|
21
|
+
const queryClient = useQueryClient();
|
|
22
|
+
const config = OpenApiQueryConfig.useConfig();
|
|
23
|
+
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (!config.crossTabInvalidation) return;
|
|
26
|
+
setupCrossTabListener(queryClient);
|
|
27
|
+
}, [queryClient, config.crossTabInvalidation]);
|
|
28
|
+
|
|
29
|
+
const runMutationEffects = useCallback(
|
|
30
|
+
async <TData, TVariables>(
|
|
31
|
+
data: TData,
|
|
32
|
+
variables: TVariables,
|
|
33
|
+
options: MutationEffectsOptions = {},
|
|
34
|
+
updateKeys?: QueryKey[],
|
|
35
|
+
) => {
|
|
36
|
+
const { invalidateCurrentModule, invalidateModules, invalidateKeys, preferUpdate } = options;
|
|
37
|
+
const shouldUpdate = preferUpdate ?? config.preferUpdate ?? false;
|
|
38
|
+
const shouldInvalidateCurrentModule = invalidateCurrentModule ?? config.invalidateCurrentModule ?? true;
|
|
39
|
+
|
|
40
|
+
const isQueryKeyEqual = (keyA: QueryKey, keyB: QueryKey) =>
|
|
41
|
+
keyA.length === keyB.length && keyA.every((item, index) => item === keyB[index]);
|
|
42
|
+
const isQueryKeyPrefix = (queryKey: QueryKey, prefixKey: QueryKey) =>
|
|
43
|
+
prefixKey.length <= queryKey.length && prefixKey.every((item, index) => item === queryKey[index]);
|
|
44
|
+
const mappedInvalidationKeys = config.invalidationMap?.[currentModule]?.(data, variables);
|
|
45
|
+
|
|
46
|
+
const shouldInvalidateQuery = (queryKey: QueryKey) => {
|
|
47
|
+
const isUpdateKey = updateKeys?.some((key) => isQueryKeyEqual(queryKey, key));
|
|
48
|
+
if (shouldUpdate && isUpdateKey) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const isCurrentModule = shouldInvalidateCurrentModule && queryKey[0] === currentModule;
|
|
53
|
+
const isInvalidateModule = !!invalidateModules && invalidateModules.some((module) => queryKey[0] === module);
|
|
54
|
+
const isInvalidateKey = !!invalidateKeys && invalidateKeys.some((key) => isQueryKeyPrefix(queryKey, key));
|
|
55
|
+
const isMappedKey =
|
|
56
|
+
!!mappedInvalidationKeys && mappedInvalidationKeys.some((key) => isQueryKeyPrefix(queryKey, key));
|
|
57
|
+
|
|
58
|
+
return isCurrentModule || isInvalidateModule || isInvalidateKey || isMappedKey;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const invalidatedQueryKeys: QueryKey[] = [];
|
|
62
|
+
|
|
63
|
+
queryClient.invalidateQueries({
|
|
64
|
+
predicate: ({ queryKey }) => {
|
|
65
|
+
const shouldInvalidate = shouldInvalidateQuery(queryKey);
|
|
66
|
+
|
|
67
|
+
if (shouldInvalidate && config.crossTabInvalidation) {
|
|
68
|
+
invalidatedQueryKeys.push([...queryKey]);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return shouldInvalidate;
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
if (config.crossTabInvalidation && invalidatedQueryKeys.length > 0) {
|
|
76
|
+
broadcastQueryInvalidation(invalidatedQueryKeys);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (shouldUpdate && updateKeys) {
|
|
80
|
+
updateKeys.map((queryKey) => queryClient.setQueryData(queryKey, data));
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
[
|
|
84
|
+
queryClient,
|
|
85
|
+
currentModule,
|
|
86
|
+
config.preferUpdate,
|
|
87
|
+
config.invalidateCurrentModule,
|
|
88
|
+
config.invalidationMap,
|
|
89
|
+
config.crossTabInvalidation,
|
|
90
|
+
],
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
return { runMutationEffects };
|
|
94
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{{! CASL ability import }}
|
|
2
|
+
{{{genImport abilityTupleImport}}}
|
|
3
|
+
{{! Error handling import }}
|
|
4
|
+
{{{genImport errorHandlingImport}}}
|
|
5
|
+
{{! Ability context import }}
|
|
6
|
+
{{{genImport abilityContextImport}}}
|
|
7
|
+
import { useCallback } from "react";
|
|
8
|
+
|
|
9
|
+
{{! App abilities import }}
|
|
10
|
+
{{{genImport appAbilitiesImport}}}
|
|
11
|
+
|
|
12
|
+
interface UseAclCheckProps {
|
|
13
|
+
errorHandler?: {{errorHandler}}<never>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function {{aclCheckHook}}({ errorHandler }: UseAclCheckProps = {}) {
|
|
17
|
+
const ability = {{abilityContext}}.useAbility{{#if hasGenericAppAbilities}}<{{appAbilities}}>{{/if}}();
|
|
18
|
+
|
|
19
|
+
const checkAcl = useCallback(
|
|
20
|
+
(appAbility: {{appAbilities}}) => {
|
|
21
|
+
if (!ability.can(...(appAbility as {{abilityTuple}}))) {
|
|
22
|
+
(errorHandler ?? {{sharedErrorHandler}}).rethrowError(new Error("ACL check failed"));
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
[ability, errorHandler],
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
return { checkAcl };
|
|
29
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{{! Casl AbilityTuple import}}
|
|
2
|
+
{{{genImport caslAbilityTupleImport}}}
|
|
3
|
+
{{! Models import }}
|
|
4
|
+
{{#each modelsImports as | modelsImport |}}
|
|
5
|
+
{{{genImport modelsImport}}}
|
|
6
|
+
{{/each}}
|
|
7
|
+
|
|
8
|
+
{{#if includeNamespace}}
|
|
9
|
+
export namespace {{namespace}} {
|
|
10
|
+
{{/if}}
|
|
11
|
+
|
|
12
|
+
{{! Ability functions }}
|
|
13
|
+
{{#each endpoints as | endpoint |}}
|
|
14
|
+
{{{genCaslAbilityFunction endpoint}}}
|
|
15
|
+
|
|
16
|
+
{{/each}}
|
|
17
|
+
{{#if includeNamespace}}
|
|
18
|
+
}
|
|
19
|
+
{{/if}}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{{! Casl AbilityTuple import}}
|
|
2
|
+
{{{genImport caslAbilityTupleImport}}}
|
|
3
|
+
{{! Models import }}
|
|
4
|
+
{{#each modelsImports as | modelsImport |}}
|
|
5
|
+
{{{genImport modelsImport}}}
|
|
6
|
+
{{/each}}
|
|
7
|
+
|
|
8
|
+
{{! AppAbilities union type }}
|
|
9
|
+
export type {{appAbilities}} = {{#if appAbilitiesType}}
|
|
10
|
+
{{#each appAbilitiesType as | appAbilityType |}}
|
|
11
|
+
| {{../abilityTuple}}<"{{@key}}", {{{union appAbilityType}}}>
|
|
12
|
+
{{/each}}
|
|
13
|
+
{{else}}
|
|
14
|
+
{{abilityTuple}}<string, {{subjectType}}>;
|
|
15
|
+
{{/if}}
|
|
16
|
+
|
|
17
|
+
export type AppAbility = PureAbility<{{appAbilities}}>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{{! Zod import }}
|
|
2
|
+
{{#if hasZodImport}}
|
|
3
|
+
{{{genImport zodImport}}}
|
|
4
|
+
{{/if}}
|
|
5
|
+
{{! Dynamic inputs import }}
|
|
6
|
+
{{#if hasDynamicInputsImport}}
|
|
7
|
+
{{{genImport dynamicInputsImport}}}
|
|
8
|
+
{{/if}}
|
|
9
|
+
{{! Dynamic columns import }}
|
|
10
|
+
{{#if hasDynamicColumnsImport}}
|
|
11
|
+
{{{genImport dynamicColumnsImport}}}
|
|
12
|
+
{{/if}}
|
|
13
|
+
{{! Models import }}
|
|
14
|
+
{{#each modelsImports as | modelsImport |}}
|
|
15
|
+
{{{genImport modelsImport}}}
|
|
16
|
+
{{/each}}
|
|
17
|
+
{{! Queries import }}
|
|
18
|
+
{{#each queriesImports as | queriesImport |}}
|
|
19
|
+
{{{genImport queriesImport}}}
|
|
20
|
+
{{/each}}
|
|
21
|
+
{{! Acl import }}
|
|
22
|
+
{{#each aclImports as | aclImport |}}
|
|
23
|
+
{{{genImport aclImport}}}
|
|
24
|
+
{{/each}}
|
|
25
|
+
|
|
26
|
+
{{#if includeNamespace}}
|
|
27
|
+
export namespace {{namespace}} {
|
|
28
|
+
{{/if}}
|
|
29
|
+
{{! Configs export }}
|
|
30
|
+
{{#each configs as |config|}}
|
|
31
|
+
export const {{config.name}} = {
|
|
32
|
+
meta: {
|
|
33
|
+
title: "{{{config.title}}}",
|
|
34
|
+
},
|
|
35
|
+
readAll: {
|
|
36
|
+
{{#if config.readAll.acl}} acl: {{{config.readAll.acl}}},
|
|
37
|
+
{{/if}} schema: {{{config.readAll.columns.schema}}},
|
|
38
|
+
paginated: {{{config.readAll.paginated}}}, {{#if config.readAll.infinite}}
|
|
39
|
+
infinite: {{{config.readAll.infinite}}},
|
|
40
|
+
{{/if}} {{#if config.readAll.filters}} filters: {
|
|
41
|
+
schema: {{{config.readAll.filters.schema}}},
|
|
42
|
+
filterDefs: {{../dynamicInputs}}({{{genInputsConfig config.readAll.filters}}})
|
|
43
|
+
},
|
|
44
|
+
{{/if}} columns: {{../dynamicColumns}}({{{genColumnsConfig config.readAll.columns}}}),
|
|
45
|
+
}, {{#if config.read}}
|
|
46
|
+
read: {
|
|
47
|
+
{{#if config.read.acl}} acl: {{{config.read.acl}}},
|
|
48
|
+
{{/if}} schema: {{{config.read.schema}}},
|
|
49
|
+
query: {{{config.read.query}}},
|
|
50
|
+
},{{/if}} {{#if config.create}}
|
|
51
|
+
create: {
|
|
52
|
+
{{#if config.create.acl}} acl: {{{config.create.acl}}},
|
|
53
|
+
{{/if}} {{#if config.create.inputDefs}} schema: {{{config.create.inputDefs.schema}}},
|
|
54
|
+
{{/if}} mutation: {{{config.create.mutation}}},
|
|
55
|
+
{{#if config.create.inputDefs}} inputDefs: {{../dynamicInputs}}({{{genInputsConfig config.create.inputDefs}}})
|
|
56
|
+
{{/if}}
|
|
57
|
+
},{{/if}} {{#if config.update}}
|
|
58
|
+
update: {
|
|
59
|
+
{{#if config.update.acl}} acl: {{{config.update.acl}}},
|
|
60
|
+
{{/if}} {{#if config.update.inputDefs}} schema: {{{config.update.inputDefs.schema}}},
|
|
61
|
+
{{/if}} mutation: {{{config.update.mutation}}},
|
|
62
|
+
{{#if config.update.inputDefs}} inputDefs: {{../dynamicInputs}}({{{genInputsConfig config.update.inputDefs}}})
|
|
63
|
+
{{/if}}
|
|
64
|
+
},{{/if}} {{#if config.delete}}
|
|
65
|
+
delete: {
|
|
66
|
+
{{#if config.delete.acl}} acl: {{{config.delete.acl}}},
|
|
67
|
+
{{/if}} mutation: {{{config.delete.mutation}}},
|
|
68
|
+
},{{/if}} {{!-- {{#if config.bulkDelete}}
|
|
69
|
+
bulkDelete: {
|
|
70
|
+
{{#if config.bulkDelete.acl}} acl: {{{config.bulkDelete.acl}}},
|
|
71
|
+
{{/if}} mutation: {{{config.bulkDelete.mutation}}},
|
|
72
|
+
{{#if config.bulkDelete.inputDefs}} inputDefs: {{../dynamicInputs}}({{{genInputsConfig config.bulkDelete.inputDefs}}})
|
|
73
|
+
{{/if}}
|
|
74
|
+
},{{/if}} --}}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
{{/each}}
|
|
78
|
+
{{#if includeNamespace}}
|
|
79
|
+
}
|
|
80
|
+
{{/if}}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{{! App rest client import}}
|
|
2
|
+
{{{genImport appRestClientImport}}}
|
|
3
|
+
{{! Axios import }}
|
|
4
|
+
{{#if hasAxiosImport}}
|
|
5
|
+
{{{genImport axiosImport}}}
|
|
6
|
+
{{/if}}
|
|
7
|
+
{{! Zod import }}
|
|
8
|
+
{{#if hasZodImport}}
|
|
9
|
+
{{{genImport zodImport}}}
|
|
10
|
+
{{/if}}
|
|
11
|
+
{{! Zod extended import }}
|
|
12
|
+
{{#if hasZodExtendedImport}}
|
|
13
|
+
{{{genImport zodExtendedImport}}}
|
|
14
|
+
{{/if}}
|
|
15
|
+
{{! Models import }}
|
|
16
|
+
{{#each modelsImports as | modelsImport |}}
|
|
17
|
+
{{{genImport modelsImport}}}
|
|
18
|
+
{{/each}}
|
|
19
|
+
|
|
20
|
+
{{#if includeNamespace}}
|
|
21
|
+
export namespace {{namespace}} {
|
|
22
|
+
{{/if}}
|
|
23
|
+
{{! Endpoints export }}
|
|
24
|
+
{{#each endpoints as | endpoint |}}
|
|
25
|
+
export const {{endpointName endpoint}} = ({{{genEndpointParams endpoint}}}{{#if ../hasAxiosRequestConfig}}{{../axiosRequestConfigName}}?: {{../axiosRequestConfigType}}{{/if}}) => {
|
|
26
|
+
return {{../restClientName}}.{{endpoint.method}}(
|
|
27
|
+
{{! Response }}
|
|
28
|
+
{ resSchema: {{importedZodSchemaName endpoint.response}} },
|
|
29
|
+
{{! Path }}
|
|
30
|
+
`{{endpointPath endpoint}}`,
|
|
31
|
+
{{! Body }}
|
|
32
|
+
{{#with (endpointBody endpoint) as | endpointBody |}}
|
|
33
|
+
{{#if endpointBody}}{{#if ../../generateParse}}{{{genEndpointParamParse endpointBody endpointBody.name}}}{{else}}{{endpointBody.name}}{{/if}}, {{/if}}
|
|
34
|
+
{{/with}}
|
|
35
|
+
{{#if (hasUndefinedEndpointBody endpoint)}} undefined,
|
|
36
|
+
{{! Config }}
|
|
37
|
+
{{/if}}{{{genEndpointConfig endpoint}}}
|
|
38
|
+
)
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
{{/each}}
|
|
42
|
+
{{#if includeNamespace}}
|
|
43
|
+
}
|
|
44
|
+
{{/if}}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{{! Zod import}}
|
|
2
|
+
{{{genImport zodImport}}}
|
|
3
|
+
{{! Models import }}
|
|
4
|
+
{{#each modelsImports as | modelsImport |}}
|
|
5
|
+
{{{genImport modelsImport}}}
|
|
6
|
+
{{/each}}
|
|
7
|
+
|
|
8
|
+
{{#if includeNamespace}}
|
|
9
|
+
export namespace {{namespace}} {
|
|
10
|
+
{{/if}}
|
|
11
|
+
{{#each zodSchemasData as | zodSchema |}}
|
|
12
|
+
{{! Js docs }}
|
|
13
|
+
{{{genModelJsDocs @key zodSchema ../tag}}}
|
|
14
|
+
{{! Zod schema export }}
|
|
15
|
+
export const {{@key}} = {{{zodSchema.code}}};
|
|
16
|
+
{{! Zod schema infered type export }}
|
|
17
|
+
export type {{zodInferedType @key}} = z.infer<typeof {{@key}}>;
|
|
18
|
+
{{#if zodSchema.isEnum}}export const {{zodInferedType @key}} = {{@key}}.enum;{{/if}}
|
|
19
|
+
|
|
20
|
+
{{/each}}
|
|
21
|
+
{{#if includeNamespace}}
|
|
22
|
+
}
|
|
23
|
+
{{/if}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
checkAcl({{importedAbilityFunctionName endpoint}}({{#if generateAclCheckParams}}{ {{#each (abilityConditionsTypes endpoint) as | propertyType |}}{{propertyType.name}}, {{/each}} } {{/if}}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Use for {{{genCaslAbilityQuery endpoint}}} ability. {{#if (hasAbilityConditions endpoint)}}For global ability, omit the object parameter.{{/if}}{{#if (abilityDescription endpoint)}}
|
|
3
|
+
* @description {{abilityDescription endpoint}}{{/if}}
|
|
4
|
+
{{#if (hasAbilityConditions endpoint)}}{{#each (abilityConditionsTypes endpoint) as | propertyType |}} * @param { {{propertyType.type}}{{propertyType.zodSchemaName}} } object.{{propertyType.name}} {{propertyType.name}} from {{propertyType.info}}
|
|
5
|
+
{{/each}}{{/if}} * @returns { AbilityTuple } An ability tuple indicating the user's ability to use {{{genCaslAbilityQuery endpoint}}}
|
|
6
|
+
*/
|
|
7
|
+
export const {{abilityFunctionName endpoint}} = (
|
|
8
|
+
{{#if (hasAbilityConditions endpoint)}}object?: { {{#each (abilityConditionsTypes endpoint) as | propertyType |}}{{propertyType.name}}{{#unless propertyType.required}}?{{/unless}}: {{propertyType.type}}{{propertyType.zodSchemaName}}, {{/each}} } {{/if}}
|
|
9
|
+
) => [
|
|
10
|
+
"{{ablityAction endpoint}}",
|
|
11
|
+
{{#if (hasAbilityConditions endpoint)}}object ? subject("{{ablitySubject endpoint}}", object) : "{{ablitySubject endpoint}}"{{else}}"{{ablitySubject endpoint}}"{{/if}}
|
|
12
|
+
] as {{{genCaslAbilityType endpoint}}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{{#if (isQuery endpoint)}}{{#if (isMutation endpoint)}}`{{queryName endpoint}}` query or `{{queryName endpoint mutation=true}}` mutation{{else}}`{{queryName endpoint}}` query{{/if}}{{else}}`{{queryName endpoint}}` mutation{{/if}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{{abilityTuple}}<"{{ablityAction endpoint}}", {{{union (abilitySubjectTypes endpoint)}}}>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
{{! Query params}}
|
|
3
|
+
{{#if hasAxiosRequestConfig}}
|
|
4
|
+
...{{axiosRequestConfigName}},
|
|
5
|
+
{{/if}}
|
|
6
|
+
{{#if endpointConfig.params}}
|
|
7
|
+
params: {
|
|
8
|
+
{{#each endpointConfig.params as | param |}}
|
|
9
|
+
{{#if (isEqual param.name param.value) }}
|
|
10
|
+
{{{param.name}}}{{#if ../generateParse}}: {{{genEndpointParamParse param param.name}}}{{/if}},
|
|
11
|
+
{{else}}
|
|
12
|
+
{{{param.name}}}: {{#if ../generateParse}}{{{genEndpointParamParse param param.value}}}{{else}}{{param.value}}{{/if}},
|
|
13
|
+
{{/if}}
|
|
14
|
+
{{/each}}
|
|
15
|
+
},
|
|
16
|
+
{{/if}}
|
|
17
|
+
{{! Headers}}
|
|
18
|
+
{{#if endpointConfig.headers}}
|
|
19
|
+
headers: {
|
|
20
|
+
{{#each endpointConfig.headers as | header |}}
|
|
21
|
+
'{{@key}}': {{{header}}},
|
|
22
|
+
{{/each}}
|
|
23
|
+
},
|
|
24
|
+
{{/if}}
|
|
25
|
+
{{#if hasBlobResponse}}
|
|
26
|
+
responseType: "blob",
|
|
27
|
+
{{/if}}
|
|
28
|
+
{{#if hasFileDownload}}
|
|
29
|
+
rawResponse: true,
|
|
30
|
+
{{/if}}
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{{zodExtendedNamespace}}.{{parse}}({{#if param.parameterSortingEnumSchemaName}}{{zodExtendedNamespace}}.{{sortExp}}({{{importedZodSchemaName param.parameterSortingEnumSchemaName}}}){{#if addOptional}}.optional(){{/if}}{{else}}{{{importedZodSchemaName param.zodSchema}}}{{#if addOptional}}.optional(){{/if}}{{/if}}, {{paramName}}{{#if isQuery}}, { type: "query", name: "{{paramName}}" }{{/if}})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{{#each (endpointParams endpoint options) as | endpointParam |}}{{endpointParam.name}}{{#unless endpointParam.required}}?{{/unless}}: {{endpointParam.type}}, {{/each}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {{importNames import.bindings import.defaultImport}} from "{{import.from}}";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* {{name}}
|
|
3
|
+
* @type { {{zodSchemaType zodSchema}} }{{#if (zodSchemaDescription zodSchema)}}
|
|
4
|
+
* @description {{{zodSchemaDescription zodSchema}}}{{/if}}
|
|
5
|
+
{{#if (zodSchemaPropertyDescriptions zodSchema tag)}}{{#each (zodSchemaPropertyDescriptions zodSchema tag) as | property |}} * @property { {{property.type}} } {{@key}} {{{addAsteriskAfterNewLine property.description}}}
|
|
6
|
+
{{/each}}{{/if}} */
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{{#if infiniteQuery}}
|
|
2
|
+
/**
|
|
3
|
+
* Infinite query `{{infiniteQueryName endpoint}}{{#if endpoint.summary}}
|
|
4
|
+
* @summary {{addAsteriskAfterNewLine endpoint.summary}}{{/if}}{{#if endpoint.description}}
|
|
5
|
+
* @description {{addAsteriskAfterNewLine endpoint.description}}{{/if}}{{#if endpoint.acl}}
|
|
6
|
+
* @permission Requires `{{abilityFunctionName endpoint}}` ability {{/if}}
|
|
7
|
+
{{#if (endpointParams endpoint)}}{{#each (endpointParams endpoint infiniteQuery excludePageParam=true) as | endpointParam |}} * @param { {{{endpointParam.type}}} } object.{{endpointParam.name}} {{{endpointParamDescription endpointParam}}}
|
|
8
|
+
{{/each}}{{/if}} * @param { AppInfiniteQueryOptions } options Infinite query options
|
|
9
|
+
* @returns { UseInfiniteQueryResult<{{{importedZodSchemaInferedType endpoint.response}}}> } {{endpoint.responseDescription}}
|
|
10
|
+
* @statusCodes [{{commaSeparated endpoint.responseStatusCodes}}]
|
|
11
|
+
*/{{else if query}}
|
|
12
|
+
/**
|
|
13
|
+
* Query `{{queryName endpoint}}`{{#if endpoint.summary}}{{#if endpoint.mediaDownload}} - recommended when file should be cached{{/if}}
|
|
14
|
+
* @summary {{addAsteriskAfterNewLine endpoint.summary}}{{/if}}{{#if endpoint.description}}
|
|
15
|
+
* @description {{addAsteriskAfterNewLine endpoint.description}}{{/if}}{{#if endpoint.acl}}
|
|
16
|
+
* @permission Requires `{{abilityFunctionName endpoint}}` ability {{/if}}
|
|
17
|
+
{{#if (endpointParams endpoint includeFileParam=true)}}{{#each (endpointParams endpoint includeFileParam=true) as | endpointParam |}} * @param { {{{endpointParam.type}}} } object.{{endpointParam.name}} {{{endpointParamDescription endpointParam}}}
|
|
18
|
+
{{/each}}{{/if}} * @param { AppQueryOptions } options Query options
|
|
19
|
+
* @returns { UseQueryResult<{{#if endpoint.mediaDownload}}AxiosResponse<{{/if}}{{{importedZodSchemaInferedType endpoint.response}}}{{#if endpoint.mediaDownload}}>{{/if}}> } {{endpoint.responseDescription}}
|
|
20
|
+
* @statusCodes [{{commaSeparated endpoint.responseStatusCodes}}]
|
|
21
|
+
*/{{else if mutation}}
|
|
22
|
+
/**
|
|
23
|
+
* Mutation `{{queryName endpoint mutation=true}}`{{#if endpoint.summary}}{{#if endpoint.mediaDownload}} - recommended when file should not be cached{{/if}}
|
|
24
|
+
* @summary {{addAsteriskAfterNewLine endpoint.summary}}{{/if}}{{#if endpoint.description}}
|
|
25
|
+
* @description {{addAsteriskAfterNewLine endpoint.description}}{{/if}}{{#if endpoint.acl}}
|
|
26
|
+
* @permission Requires `{{abilityFunctionName endpoint}}` ability {{/if}}
|
|
27
|
+
{{#if (endpointParams endpoint includeFileParam=true)}}{{#each (endpointParams endpoint includeFileParam=true) as | endpointParam |}} * @param { {{{endpointParam.type}}} } mutation.{{endpointParam.name}} {{{endpointParamDescription endpointParam}}}
|
|
28
|
+
{{/each}}{{/if}} * @param { AppMutationOptions{{#if hasMutationEffects}} & {{mutationEffectsType}}{{/if}} } options Mutation options
|
|
29
|
+
* @returns { UseMutationResult<{{#if endpoint.mediaDownload}}AxiosResponse<{{/if}}{{{importedZodSchemaInferedType endpoint.response}}}{{#if endpoint.mediaDownload}}>{{/if}}> } {{endpoint.responseDescription}}
|
|
30
|
+
* @statusCodes [{{commaSeparated endpoint.responseStatusCodes}}]
|
|
31
|
+
*/{{/if}}
|