chore: generate enterprise console API (#35735)

This commit is contained in:
Stephen Zhou 2026-04-30 17:15:08 +08:00 committed by GitHub
parent 0ca339103f
commit 91f92c7083
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 2736 additions and 7 deletions

174
pnpm-lock.yaml generated
View File

@ -48,6 +48,9 @@ catalogs:
'@heroicons/react':
specifier: 2.2.0
version: 2.2.0
'@hey-api/openapi-ts':
specifier: 0.97.0
version: 0.97.0
'@hono/node-server':
specifier: 2.0.0
version: 2.0.0
@ -1125,6 +1128,9 @@ importers:
'@eslint-react/eslint-plugin':
specifier: 'catalog:'
version: 3.0.0(eslint@10.2.1(jiti@2.6.1))(typescript@6.0.3)
'@hey-api/openapi-ts':
specifier: 'catalog:'
version: 0.97.0(magicast@0.5.2)(typescript@6.0.3)
'@hono/node-server':
specifier: 'catalog:'
version: 2.0.0(hono@4.12.15)
@ -2072,6 +2078,31 @@ packages:
peerDependencies:
react: '>= 16 || ^19.0.0-rc'
'@hey-api/codegen-core@0.8.1':
resolution: {integrity: sha512-Iciv2vUCJTW9lWM/ROvyZLblmcbYJHPuXfzb1SzeDVVn4xEXu2ilLU1pq3fn+09FZ/Y0P7VyvRE47UDU6om8xA==}
engines: {node: '>=22.13.0'}
'@hey-api/json-schema-ref-parser@1.4.1':
resolution: {integrity: sha512-DoPJGxVApDlktP1yYLjmOrF0YBEqb32ieCbx1S1i09n8TyCgdoh4yQaQ3kp0sMTauH+bwNKPsFh7S8qiWCoKZA==}
engines: {node: '>=22.13.0'}
'@hey-api/openapi-ts@0.97.0':
resolution: {integrity: sha512-WZkKgrDlZpxKlDv2HkBCzaAYeuM+EtZKFmKGBv9/JblAKpX3JQTROi7PzlCZE3eisetRPSakbcRgn+LGyB7EiQ==}
engines: {node: '>=22.13.0'}
hasBin: true
peerDependencies:
typescript: '>=5.5.3 || >=6.0.0 || 6.0.1-rc'
'@hey-api/shared@0.4.2':
resolution: {integrity: sha512-4fconS10E0Xr4/acV8G+BkApxaIStxrT0GhB9BDTQWvrFTy5/nV933SyFk8qImcbpKvgv9hpn3N+7bV8oFrbjA==}
engines: {node: '>=22.13.0'}
'@hey-api/spec-types@0.2.0':
resolution: {integrity: sha512-ibQ8Is7evMavzr8GNyJCcTg975d8DpaMUyLmOrQ85UBdy1l6t1KuRAwgChAbesJsIlNV6gjmlXruWyegDX18Fg==}
'@hey-api/types@0.1.4':
resolution: {integrity: sha512-thWfawrDIP7wSI9ioT13I5soaaqB5vAPIiZmgD8PbeEVKNrkonc0N/Sjj97ezl7oQgusZmaNphGdMKipPO6IBg==}
'@hono/node-server@2.0.0':
resolution: {integrity: sha512-n3GfHwwCvHCkGmOwKfxUPOlbfzuO64Sbc5XC4NGPIXxkuOnJrdgExdRKmHfF924r914WRJPT397GdqLvdYTeyQ==}
engines: {node: '>=20'}
@ -2294,6 +2325,9 @@ packages:
'@jridgewell/trace-mapping@0.3.31':
resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}
'@jsdevtools/ono@7.1.3':
resolution: {integrity: sha512-4JQNk+3mVzK3xh2rqd6RB4J46qUR19azEHBneZyTZM+c456qOrbbM/5xcR8huNCCcbVt7+UmizG6GuUvPvKUYg==}
'@lexical/clipboard@0.44.0':
resolution: {integrity: sha512-nfmNIs7uENqlDI7cm2E4I1Yp8mDJGMhEQIrIV2rNWnL1oeHVXQ7yuYdyoPdcY1zuj/9nvkYBQYUEh0QiGwpETA==}
@ -2369,6 +2403,10 @@ packages:
peerDependencies:
yjs: '>=13.5.22'
'@lukeed/ms@2.0.2':
resolution: {integrity: sha512-9I2Zn6+NJLfaGoz9jN3lpwDgAYvfGeNYdbAIjJOqzs4Tpc+VU3Jqq4IofSUBKajiDS8k9fZIg18/z13mpk1bsA==}
engines: {node: '>=8'}
'@mdx-js/loader@3.1.1':
resolution: {integrity: sha512-0TTacJyZ9mDmY+VefuthVshaNIyCGZHJG2fMnGaDttCt8HmjUF7SizlHJpaCDoGnN635nK1wpzfpx/Xx5S4WnQ==}
peerDependencies:
@ -4653,6 +4691,10 @@ packages:
ajv@6.14.0:
resolution: {integrity: sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw==}
ansi-colors@4.1.3:
resolution: {integrity: sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==}
engines: {node: '>=6'}
ansi-regex@4.1.1:
resolution: {integrity: sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==}
engines: {node: '>=6'}
@ -4792,6 +4834,14 @@ packages:
resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==}
engines: {node: '>= 0.8'}
c12@3.3.4:
resolution: {integrity: sha512-cM0ApFQSBXuourJejzwv/AuPRvAxordTyParRVcHjjtXirtkzM0uK2L9TTn9s0cXZbG7E55jCivRQzoxYmRAlA==}
peerDependencies:
magicast: '*'
peerDependenciesMeta:
magicast:
optional: true
cac@7.0.0:
resolution: {integrity: sha512-tixWYgm5ZoOD+3g6UTea91eow5z6AAHaho3g0V9CNSNb45gM8SmflpAc+GRd1InC4AqN/07Unrgp56Y94N9hJQ==}
engines: {node: '>=20.19.0'}
@ -4858,6 +4908,10 @@ packages:
chevrotain@11.1.2:
resolution: {integrity: sha512-opLQzEVriiH1uUQ4Kctsd49bRoFDXGGSC4GUqj7pGyxM3RehRhvTlZJc1FL/Flew2p5uwxa1tUDWKzI4wNM8pg==}
chokidar@5.0.0:
resolution: {integrity: sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==}
engines: {node: '>= 20.19.0'}
chownr@1.1.4:
resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==}
@ -4931,6 +4985,10 @@ packages:
color-name@1.1.4:
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
color-support@1.1.3:
resolution: {integrity: sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==}
hasBin: true
comma-separated-tokens@2.0.3:
resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==}
@ -5250,6 +5308,9 @@ packages:
resolution: {integrity: sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==}
engines: {node: '>=12'}
defu@6.1.7:
resolution: {integrity: sha512-7z22QmUWiQ/2d0KkdYmANbRUVABpZ9SNYyH5vx6PZ+nE5bcC0l7uFvEfHlyld/HcGBFTL536ClDt3DEcSlEJAQ==}
delaunator@5.1.0:
resolution: {integrity: sha512-AGrQ4QSgssa1NGmWmLPqN5NY2KajF5MqxetNEO+o0n3ZwZZeTmt7bBnvzHWrmkZFxGgr4HdyFgelzgi06otLuQ==}
@ -5257,6 +5318,9 @@ packages:
resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==}
engines: {node: '>=6'}
destr@2.0.5:
resolution: {integrity: sha512-ugFTXCtDZunbzasqBxrK93Ik/DRYsO6S/fedkWEMKqt04xZ4csmnmwGDBAb07QWNaGMAmnTIemsYZCksjATwsA==}
detect-libc@2.1.2:
resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==}
engines: {node: '>=8'}
@ -5309,6 +5373,10 @@ packages:
resolution: {integrity: sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==}
engines: {node: '>=12'}
dotenv@17.4.2:
resolution: {integrity: sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==}
engines: {node: '>=12'}
echarts-for-react@3.0.6:
resolution: {integrity: sha512-4zqLgTGWS3JvkQDXjzkR1k1CHRdpd6by0988TWMJgnvDytegWLbeP/VNZmMa+0VJx2eD7Y632bi2JquXDgiGJg==}
peerDependencies:
@ -5893,6 +5961,10 @@ packages:
get-tsconfig@4.14.0:
resolution: {integrity: sha512-yTb+8DXzDREzgvYmh6s9vHsSVCHeC0G3PI5bEXNBHtmshPnO+S5O7qgLEOn0I5QvMy6kpZN8K1NKGyilLb93wA==}
giget@3.2.0:
resolution: {integrity: sha512-GvHTWcykIR/fP8cj8dMpuMMkvaeJfPvYnhq0oW+chSeIr+ldX21ifU2Ms6KBoyKZQZmVaUAAhQ2EZ68KJF8a7A==}
hasBin: true
github-from-package@0.0.0:
resolution: {integrity: sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==}
@ -7137,6 +7209,9 @@ packages:
resolution: {integrity: sha512-h36JMxKRqrAxVD8201FrCpyeNuUY9Y5zZwujr20fFO77tpUtGa6EZzfKw/3WaiBX95fq7+MpsuMLNdSnORAwSA==}
engines: {node: '>=14.18.0'}
rc9@3.0.1:
resolution: {integrity: sha512-gMDyleLWVE+i6Sgtc0QbbY6pEKqYs97NGi6isHQPqYlLemPoO8dxQ3uGi0f4NiP98c+jMW6cG1Kx9dDwfvqARQ==}
rc@1.2.8:
resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==}
hasBin: true
@ -7310,6 +7385,10 @@ packages:
resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==}
engines: {node: '>= 6'}
readdirp@5.0.0:
resolution: {integrity: sha512-9u/XQ1pvrQtYyMpZe7DXKv2p5CNvyVwzUB6uhLAnQwHMSgKMBR62lc7AHljaeteeHXn11XTAaLLUVZYVZyuRBQ==}
engines: {node: '>= 20.19.0'}
recast@0.23.11:
resolution: {integrity: sha512-YTUo+Flmw4ZXiWfQKGcwwc11KnoRAYgzAE2E7mXKCjSviTKShtxBsN6YUUBB2gtaBzKzeKunxhUwNHQuRryhWA==}
engines: {node: '>= 4'}
@ -9332,6 +9411,56 @@ snapshots:
dependencies:
react: 19.2.5
'@hey-api/codegen-core@0.8.1(magicast@0.5.2)':
dependencies:
'@hey-api/types': 0.1.4
ansi-colors: 4.1.3
c12: 3.3.4(magicast@0.5.2)
color-support: 1.1.3
transitivePeerDependencies:
- magicast
'@hey-api/json-schema-ref-parser@1.4.1':
dependencies:
'@jsdevtools/ono': 7.1.3
'@types/json-schema': 7.0.15
yaml: 2.8.3
'@hey-api/openapi-ts@0.97.0(magicast@0.5.2)(typescript@6.0.3)':
dependencies:
'@hey-api/codegen-core': 0.8.1(magicast@0.5.2)
'@hey-api/json-schema-ref-parser': 1.4.1
'@hey-api/shared': 0.4.2(magicast@0.5.2)
'@hey-api/spec-types': 0.2.0
'@hey-api/types': 0.1.4
'@lukeed/ms': 2.0.2
ansi-colors: 4.1.3
color-support: 1.1.3
commander: 14.0.3
get-tsconfig: 4.14.0
typescript: 6.0.3
transitivePeerDependencies:
- magicast
'@hey-api/shared@0.4.2(magicast@0.5.2)':
dependencies:
'@hey-api/codegen-core': 0.8.1(magicast@0.5.2)
'@hey-api/json-schema-ref-parser': 1.4.1
'@hey-api/spec-types': 0.2.0
'@hey-api/types': 0.1.4
ansi-colors: 4.1.3
cross-spawn: 7.0.6
open: 11.0.0
semver: 7.7.4
transitivePeerDependencies:
- magicast
'@hey-api/spec-types@0.2.0':
dependencies:
'@hey-api/types': 0.1.4
'@hey-api/types@0.1.4': {}
'@hono/node-server@2.0.0(hono@4.12.15)':
dependencies:
hono: 4.12.15
@ -9517,6 +9646,8 @@ snapshots:
'@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.5.5
'@jsdevtools/ono@7.1.3': {}
'@lexical/clipboard@0.44.0':
dependencies:
'@lexical/extension': 0.44.0
@ -9669,6 +9800,8 @@ snapshots:
'@lexical/selection': 0.44.0
lexical: 0.44.0
'@lukeed/ms@2.0.2': {}
'@mdx-js/loader@3.1.1':
dependencies:
'@mdx-js/mdx': 3.1.1
@ -11863,6 +11996,8 @@ snapshots:
json-schema-traverse: 0.4.1
uri-js: 4.4.1
ansi-colors@4.1.3: {}
ansi-regex@4.1.1: {}
ansi-regex@5.0.1: {}
@ -11977,6 +12112,23 @@ snapshots:
bytes@3.1.2: {}
c12@3.3.4(magicast@0.5.2):
dependencies:
chokidar: 5.0.0
confbox: 0.2.4
defu: 6.1.7
dotenv: 17.4.2
exsolve: 1.0.8
giget: 3.2.0
jiti: 2.6.1
ohash: 2.0.11
pathe: 2.0.3
perfect-debounce: 2.1.0
pkg-types: 2.3.0
rc9: 3.0.1
optionalDependencies:
magicast: 0.5.2
cac@7.0.0: {}
camelize@1.0.1: {}
@ -12064,6 +12216,10 @@ snapshots:
'@chevrotain/utils': 11.1.2
lodash-es: 4.18.0
chokidar@5.0.0:
dependencies:
readdirp: 5.0.0
chownr@1.1.4:
optional: true
@ -12135,6 +12291,8 @@ snapshots:
color-name@1.1.4: {}
color-support@1.1.3: {}
comma-separated-tokens@2.0.3: {}
commander@14.0.0: {}
@ -12457,12 +12615,16 @@ snapshots:
define-lazy-prop@3.0.0: {}
defu@6.1.7: {}
delaunator@5.1.0:
dependencies:
robust-predicates: 3.0.3
dequal@2.0.3: {}
destr@2.0.5: {}
detect-libc@2.1.2: {}
detect-node-es@1.1.0: {}
@ -12511,6 +12673,8 @@ snapshots:
dotenv@16.6.1: {}
dotenv@17.4.2: {}
echarts-for-react@3.0.6(echarts@6.0.0)(react@19.2.5):
dependencies:
echarts: 6.0.0
@ -13274,6 +13438,8 @@ snapshots:
dependencies:
resolve-pkg-maps: 1.0.0
giget@3.2.0: {}
github-from-package@0.0.0:
optional: true
@ -14928,6 +15094,11 @@ snapshots:
radash@12.1.1: {}
rc9@3.0.1:
dependencies:
defu: 6.1.7
destr: 2.0.5
rc@1.2.8:
dependencies:
deep-extend: 0.6.0
@ -15126,6 +15297,8 @@ snapshots:
util-deprecate: 1.0.2
optional: true
readdirp@5.0.0: {}
recast@0.23.11:
dependencies:
ast-types: 0.16.1
@ -16330,6 +16503,7 @@ snapshots:
time:
'@amplitude/analytics-browser@2.42.0': '2026-04-28T17:01:08.442Z'
'@amplitude/plugin-session-replay-browser@1.28.1': '2026-04-28T17:01:37.145Z'
'@hey-api/openapi-ts@0.97.0': '2026-04-28T03:33:22.380Z'
'@hono/node-server@2.0.0': '2026-04-21T00:25:40.852Z'
'@lexical/link@0.44.0': '2026-04-27T14:47:45.477Z'
'@lexical/list@0.44.0': '2026-04-27T14:47:48.463Z'

View File

@ -68,6 +68,7 @@ catalog:
'@formatjs/intl-localematcher': 0.8.4
'@headlessui/react': 2.2.10
'@heroicons/react': 2.2.0
'@hey-api/openapi-ts': 0.97.0
'@hono/node-server': 2.0.0
'@iconify-json/heroicons': 1.2.3
'@iconify-json/ri': 1.2.10

View File

@ -4,4 +4,8 @@ export default defineConfig({
staged: {
'*': 'eslint --fix --pass-on-unpruned-suppressions',
},
fmt: {
singleQuote: true,
semi: false,
},
})

View File

@ -0,0 +1,138 @@
// This file is auto-generated by @hey-api/openapi-ts
import { oc } from '@orpc/contract'
import * as z from 'zod'
import {
zConsoleSsoOAuth2LoginResponse,
zConsoleSsoOidcLoginResponse,
zConsoleSsoSamlLoginResponse,
zWebAppAuthGetGroupSubjectsQuery,
zWebAppAuthGetGroupSubjectsResponse,
zWebAppAuthGetWebAppAccessModeQuery,
zWebAppAuthGetWebAppAccessModeResponse,
zWebAppAuthGetWebAppWhitelistSubjectsQuery,
zWebAppAuthGetWebAppWhitelistSubjectsResponse,
zWebAppAuthIsUserAllowedToAccessWebAppQuery,
zWebAppAuthIsUserAllowedToAccessWebAppResponse,
zWebAppAuthSearchForWhilteListCandidatesQuery,
zWebAppAuthSearchForWhilteListCandidatesResponse,
zWebAppAuthUpdateWebAppWhitelistSubjectsBody,
zWebAppAuthUpdateWebAppWhitelistSubjectsResponse,
} from './zod.gen'
export const oAuth2Login = oc
.route({
inputStructure: 'detailed',
method: 'GET',
operationId: 'ConsoleSSO_OAuth2Login',
path: '/enterprise/sso/oauth2/login',
tags: ['ConsoleSSO'],
})
.output(zConsoleSsoOAuth2LoginResponse)
export const oidcLogin = oc
.route({
inputStructure: 'detailed',
method: 'GET',
operationId: 'ConsoleSSO_OIDCLogin',
path: '/enterprise/sso/oidc/login',
tags: ['ConsoleSSO'],
})
.output(zConsoleSsoOidcLoginResponse)
export const samlLogin = oc
.route({
inputStructure: 'detailed',
method: 'GET',
operationId: 'ConsoleSSO_SAMLLogin',
path: '/enterprise/sso/saml/login',
tags: ['ConsoleSSO'],
})
.output(zConsoleSsoSamlLoginResponse)
export const consoleSso = {
oAuth2Login,
oidcLogin,
samlLogin,
}
export const getWebAppAccessMode = oc
.route({
inputStructure: 'detailed',
method: 'GET',
operationId: 'WebAppAuth_GetWebAppAccessMode',
path: '/enterprise/webapp/app/access-mode',
tags: ['WebAppAuth'],
})
.input(z.object({ query: zWebAppAuthGetWebAppAccessModeQuery.optional() }))
.output(zWebAppAuthGetWebAppAccessModeResponse)
export const updateWebAppWhitelistSubjects = oc
.route({
inputStructure: 'detailed',
method: 'POST',
operationId: 'WebAppAuth_UpdateWebAppWhitelistSubjects',
path: '/enterprise/webapp/app/access-mode',
tags: ['WebAppAuth'],
})
.input(z.object({ body: zWebAppAuthUpdateWebAppWhitelistSubjectsBody }))
.output(zWebAppAuthUpdateWebAppWhitelistSubjectsResponse)
export const searchForWhilteListCandidates = oc
.route({
inputStructure: 'detailed',
method: 'GET',
operationId: 'WebAppAuth_SearchForWhilteListCandidates',
path: '/enterprise/webapp/app/subject/search',
tags: ['WebAppAuth'],
})
.input(z.object({ query: zWebAppAuthSearchForWhilteListCandidatesQuery.optional() }))
.output(zWebAppAuthSearchForWhilteListCandidatesResponse)
export const getWebAppWhitelistSubjects = oc
.route({
inputStructure: 'detailed',
method: 'GET',
operationId: 'WebAppAuth_GetWebAppWhitelistSubjects',
path: '/enterprise/webapp/app/subjects',
tags: ['WebAppAuth'],
})
.input(z.object({ query: zWebAppAuthGetWebAppWhitelistSubjectsQuery.optional() }))
.output(zWebAppAuthGetWebAppWhitelistSubjectsResponse)
export const getGroupSubjects = oc
.route({
inputStructure: 'detailed',
method: 'GET',
operationId: 'WebAppAuth_GetGroupSubjects',
path: '/enterprise/webapp/group/subjects',
tags: ['WebAppAuth'],
})
.input(z.object({ query: zWebAppAuthGetGroupSubjectsQuery.optional() }))
.output(zWebAppAuthGetGroupSubjectsResponse)
export const isUserAllowedToAccessWebApp = oc
.route({
inputStructure: 'detailed',
method: 'GET',
operationId: 'WebAppAuth_IsUserAllowedToAccessWebApp',
path: '/enterprise/webapp/permission',
tags: ['WebAppAuth'],
})
.input(z.object({ query: zWebAppAuthIsUserAllowedToAccessWebAppQuery.optional() }))
.output(zWebAppAuthIsUserAllowedToAccessWebAppResponse)
export const webAppAuth = {
getWebAppAccessMode,
updateWebAppWhitelistSubjects,
searchForWhilteListCandidates,
getWebAppWhitelistSubjects,
getGroupSubjects,
isUserAllowedToAccessWebApp,
}
export const contract = {
consoleSso,
webAppAuth,
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -42,6 +42,7 @@ import {
workflowDraftUpdateFeaturesContract,
} from './console/workflow'
import { workflowCommentContracts } from './console/workflow-comment'
import { contract as enterpriseContract } from './generated/enterprise/orpc.gen'
import { collectionPluginsContract, collectionsContract, searchAdvancedContract, templateDetailContract } from './marketplace'
export const marketplaceRouterContract = {
@ -54,6 +55,7 @@ export const marketplaceRouterContract = {
export type MarketPlaceInputs = InferContractRouterInputs<typeof marketplaceRouterContract>
export const consoleRouterContract = {
enterprise: enterpriseContract,
account: {
avatar: accountAvatarContract,
},

View File

@ -8,9 +8,11 @@ const config: KnipConfig = {
'scripts/**/*.{js,ts,mjs}',
'bin/**/*.{js,ts,mjs}',
'tsslint.config.ts',
'openapi-ts.*.config.ts',
],
ignore: [
'public/**',
'contract/generated/**',
],
ignoreBinaries: [
'only-allow',

View File

@ -0,0 +1,119 @@
import fs from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { defineConfig } from '@hey-api/openapi-ts'
import yaml from 'js-yaml'
type JsonObject = Record<string, unknown>
type OpenApiDocument = JsonObject & {
paths?: Record<string, unknown>
}
type ContractOperation = {
id: string
operationId?: string
tags?: readonly string[]
}
const currentDir = path.dirname(fileURLToPath(import.meta.url))
const enterpriseServerDir = process.env.DIFY_ENTERPRISE_SERVER
? path.resolve(process.env.DIFY_ENTERPRISE_SERVER)
: path.resolve(currentDir, '../../dify-enterprise/server')
const enterpriseOpenApiPath = path.join(enterpriseServerDir, 'pkg/apis/enterprise/openapi.yaml')
const isConsoleApiPath = (routePath: string) => routePath.startsWith('/console/api/')
const stripConsoleApiPrefix = (routePath: string) => {
if (isConsoleApiPath(routePath))
return routePath.replace('/console/api', '')
return routePath
}
const stripSchemaNamePrefix = (schemaName: string) => {
return schemaName
.replace(/^dify\.enterprise\.api\.enterprise\./, '')
.replace(/^pagination\./, '')
}
const contractNameSegments = (operation: ContractOperation) => {
const operationId = operation.operationId || operation.id
const tag = operation.tags?.[0]
const tagPrefixPattern = tag ? new RegExp(`^${tag}[._/-]`) : undefined
const name = tagPrefixPattern ? operationId.replace(tagPrefixPattern, '') : operationId
const segments = name.split(/[._/-]+/).filter(Boolean)
return segments.length > 0 ? segments : [operationId]
}
const contractPathSegments = (operation: ContractOperation) => {
return [operation.tags?.[0] || 'default', ...contractNameSegments(operation)]
}
const normalizeEnterpriseOpenApi = () => {
const openApi = yaml.load(fs.readFileSync(enterpriseOpenApiPath, 'utf8'))
if (!openApi || typeof openApi !== 'object' || Array.isArray(openApi))
throw new Error(`Invalid enterprise OpenAPI document: ${enterpriseOpenApiPath}`)
const document = openApi as OpenApiDocument
const paths = document.paths ?? {}
document.paths = Object.fromEntries(
Object.entries(paths)
.filter(([routePath]) => isConsoleApiPath(routePath))
.map(([routePath, pathItem]) => [stripConsoleApiPrefix(routePath), pathItem]),
)
return document
}
export default defineConfig({
input: normalizeEnterpriseOpenApi(),
output: {
entryFile: false,
path: 'contract/generated/enterprise',
fileName: {
suffix: '.gen',
},
postProcess: [
{
command: 'vp',
args: ['fmt', '{{path}}'],
},
{
command: 'eslint',
args: ['--fix', '{{path}}'],
},
],
},
parser: {
transforms: {
schemaName: stripSchemaNamePrefix,
},
},
plugins: [
{
name: '@hey-api/typescript',
comments: false,
},
'zod',
{
name: 'orpc',
contracts: {
strategy: 'single',
contractName: {
name: '{{name}}',
casing: 'camelCase',
},
nesting: contractPathSegments,
segmentName: {
name: '{{name}}',
casing: 'camelCase',
},
},
validator: 'zod',
},
],
})

View File

@ -31,6 +31,7 @@
"dev:proxy": "tsx ./scripts/dev-hono-proxy.ts",
"dev:vinext": "vinext dev",
"gen-doc-paths": "tsx ./scripts/gen-doc-paths.ts",
"gen-enterprise-contract": "openapi-ts -f openapi-ts.enterprise.config.ts",
"gen-icons": "pnpm --filter @dify/iconify-collections generate && node ./scripts/gen-icons.mjs && eslint --fix app/components/base/icons/src/",
"i18n:check": "tsx ./scripts/check-i18n.js",
"knip": "knip",
@ -158,6 +159,7 @@
"@dify/tsconfig": "workspace:*",
"@egoist/tailwindcss-icons": "catalog:",
"@eslint-react/eslint-plugin": "catalog:",
"@hey-api/openapi-ts": "catalog:",
"@hono/node-server": "catalog:",
"@iconify-json/heroicons": "catalog:",
"@iconify-json/ri": "catalog:",

View File

@ -2,7 +2,7 @@ import type { Plugin } from 'vite'
import fs from 'node:fs'
import path from 'node:path'
import { codeInspectorPlugin } from 'code-inspector-plugin'
import { injectClientSnippet, normalizeViteModuleId } from './utils'
import { injectClientSnippet, normalizeViteModuleId } from './utils.ts'
type CodeInspectorPluginOptions = {
injectTarget: string

View File

@ -1,6 +1,6 @@
import type { Plugin } from 'vite'
import fs from 'node:fs'
import { injectClientSnippet, normalizeViteModuleId } from './utils'
import { injectClientSnippet, normalizeViteModuleId } from './utils.ts'
type CustomI18nHmrPluginOptions = {
injectTarget: string

View File

@ -1,6 +1,6 @@
import type { Plugin } from 'vite'
import path from 'node:path'
import { normalizeViteModuleId } from './utils'
import { normalizeViteModuleId } from './utils.ts'
type NextStaticImageTestPluginOptions = {
projectRoot: string

View File

@ -15,6 +15,7 @@
"vitest/globals",
"node"
],
"allowImportingTsExtensions": true,
"allowJs": true
},
"include": [

View File

@ -4,10 +4,10 @@ import react from '@vitejs/plugin-react'
import vinext from 'vinext'
import Inspect from 'vite-plugin-inspect'
import { defineConfig } from 'vite-plus'
import { createCodeInspectorPlugin, createForceInspectorClientInjectionPlugin } from './plugins/vite/code-inspector'
import { customI18nHmrPlugin } from './plugins/vite/custom-i18n-hmr'
import { getRootClientInjectTarget } from './plugins/vite/inject-target'
import { nextStaticImageTestPlugin } from './plugins/vite/next-static-image-test'
import { createCodeInspectorPlugin, createForceInspectorClientInjectionPlugin } from './plugins/vite/code-inspector.ts'
import { customI18nHmrPlugin } from './plugins/vite/custom-i18n-hmr.ts'
import { getRootClientInjectTarget } from './plugins/vite/inject-target.ts'
import { nextStaticImageTestPlugin } from './plugins/vite/next-static-image-test.ts'
const projectRoot = fileURLToPath(new URL('.', import.meta.url))
const isCI = !!process.env.CI