refactor: change all import with .js suffix, which will help nodejs(esm) to import code clear.

This commit is contained in:
moonrailgun 2024-07-28 20:32:41 +08:00
parent 5dca262482
commit d5d04468cb
121 changed files with 554 additions and 515 deletions

View File

@ -2,6 +2,7 @@
"name": "tianji", "name": "tianji",
"private": true, "private": true,
"version": "1.12.1", "version": "1.12.1",
"type": "module",
"scripts": { "scripts": {
"dev": "concurrently --kill-others npm:dev:server npm:dev:web", "dev": "concurrently --kill-others npm:dev:server npm:dev:web",
"dev:web": "cd src/client && pnpm dev", "dev:web": "cd src/client && pnpm dev",
@ -15,9 +16,9 @@
"build:app": "pnpm build:server && pnpm build:client", "build:app": "pnpm build:server && pnpm build:client",
"build:client": "cd src/client && pnpm build", "build:client": "cd src/client && pnpm build",
"build:server": "cd src/server && pnpm build", "build:server": "cd src/server && pnpm build",
"build:tracker": "ts-node scripts/build-tracker.ts", "build:tracker": "tsx scripts/build-tracker.ts",
"build:geo": "ts-node scripts/build-geo.ts", "build:geo": "tsx scripts/build-geo.ts",
"build:openapi": "ts-node --project ./tsconfig.base.json ./scripts/build-openapi-schema.ts && cd packages/client-sdk && pnpm generate:client", "build:openapi": "tsx --project ./tsconfig.base.json ./scripts/build-openapi-schema.ts && cd packages/client-sdk && pnpm generate:client",
"check:type": "pnpm -r check:type", "check:type": "pnpm -r check:type",
"release": "release-it", "release": "release-it",
"release:patch": "release-it -i patch", "release:patch": "release-it -i patch",
@ -30,12 +31,14 @@
"@types/tar": "^6.1.10", "@types/tar": "^6.1.10",
"concurrently": "^8.2.2", "concurrently": "^8.2.2",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"dotenv": "^16.3.1",
"fs-extra": "^11.2.0", "fs-extra": "^11.2.0",
"prettier-plugin-tailwindcss": "^0.5.12", "prettier-plugin-tailwindcss": "^0.5.12",
"release-it": "^17.0.1", "release-it": "^17.0.1",
"tar": "^6.1.15", "tar": "^6.1.15",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "^5.2.2", "tsx": "^4.16.2",
"typescript": "^5.3.3",
"vite": "^5.0.12" "vite": "^5.0.12"
}, },
"dependencies": { "dependencies": {
@ -47,6 +50,9 @@
"pnpm": { "pnpm": {
"overrides": { "overrides": {
"dayjs": "1.11.10" "dayjs": "1.11.10"
},
"patchedDependencies": {
"zod-prisma@0.5.4": "patches/zod-prisma@0.5.4.patch"
} }
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -7,6 +7,11 @@ settings:
overrides: overrides:
dayjs: 1.11.10 dayjs: 1.11.10
patchedDependencies:
zod-prisma@0.5.4:
hash: 7m3k6hik5q4kosvcy74j54segm
path: patches/zod-prisma@0.5.4.patch
importers: importers:
.: .:
@ -23,7 +28,7 @@ importers:
devDependencies: devDependencies:
'@release-it/conventional-changelog': '@release-it/conventional-changelog':
specifier: ^8.0.1 specifier: ^8.0.1
version: 8.0.1(release-it@17.0.1(typescript@5.2.2)) version: 8.0.1(release-it@17.0.1(typescript@5.4.5))
'@types/fs-extra': '@types/fs-extra':
specifier: ^11.0.3 specifier: ^11.0.3
version: 11.0.3 version: 11.0.3
@ -39,6 +44,9 @@ importers:
cross-env: cross-env:
specifier: ^7.0.3 specifier: ^7.0.3
version: 7.0.3 version: 7.0.3
dotenv:
specifier: ^16.3.1
version: 16.4.5
fs-extra: fs-extra:
specifier: ^11.2.0 specifier: ^11.2.0
version: 11.2.0 version: 11.2.0
@ -47,16 +55,19 @@ importers:
version: 0.5.12(prettier@3.2.5) version: 0.5.12(prettier@3.2.5)
release-it: release-it:
specifier: ^17.0.1 specifier: ^17.0.1
version: 17.0.1(typescript@5.2.2) version: 17.0.1(typescript@5.4.5)
tar: tar:
specifier: ^6.1.15 specifier: ^6.1.15
version: 6.1.15 version: 6.1.15
ts-node: ts-node:
specifier: ^10.9.1 specifier: ^10.9.1
version: 10.9.1(@types/node@18.17.12)(typescript@5.2.2) version: 10.9.1(@types/node@18.17.12)(typescript@5.4.5)
tsx:
specifier: ^4.16.2
version: 4.16.2
typescript: typescript:
specifier: ^5.2.2 specifier: ^5.3.3
version: 5.2.2 version: 5.4.5
vite: vite:
specifier: ^5.0.12 specifier: ^5.0.12
version: 5.0.12(@types/node@18.17.12)(less@4.2.0)(terser@5.28.1) version: 5.0.12(@types/node@18.17.12)(less@4.2.0)(terser@5.28.1)
@ -341,7 +352,7 @@ importers:
devDependencies: devDependencies:
'@i18next-toolkit/cli': '@i18next-toolkit/cli':
specifier: ^1.2.2 specifier: ^1.2.2
version: 1.2.2(buffer@6.0.3)(typescript@5.4.5) version: 1.2.2(buffer@6.0.3)(typescript@5.5.4)
'@tanstack/router-vite-plugin': '@tanstack/router-vite-plugin':
specifier: ^1.20.5 specifier: ^1.20.5
version: 1.20.5 version: 1.20.5
@ -389,13 +400,13 @@ importers:
version: 8.4.33 version: 8.4.33
shadcn-ui: shadcn-ui:
specifier: ^0.8.0 specifier: ^0.8.0
version: 0.8.0(typescript@5.4.5) version: 0.8.0(typescript@5.5.4)
tailwindcss: tailwindcss:
specifier: ^3.4.1 specifier: ^3.4.1
version: 3.4.1(ts-node@10.9.1(@types/node@20.12.7)(typescript@5.4.5)) version: 3.4.1(ts-node@10.9.1(@types/node@20.12.7)(typescript@5.5.4))
tailwindcss-animate: tailwindcss-animate:
specifier: ^1.0.7 specifier: ^1.0.7
version: 1.0.7(tailwindcss@3.4.1(ts-node@10.9.1(@types/node@20.12.7)(typescript@5.4.5))) version: 1.0.7(tailwindcss@3.4.1(ts-node@10.9.1(@types/node@20.12.7)(typescript@5.5.4)))
vite: vite:
specifier: ^5.0.12 specifier: ^5.0.12
version: 5.0.12(@types/node@20.12.7)(less@4.2.0)(terser@5.28.1) version: 5.0.12(@types/node@20.12.7)(less@4.2.0)(terser@5.28.1)
@ -406,8 +417,8 @@ importers:
src/server: src/server:
dependencies: dependencies:
'@auth/core': '@auth/core':
specifier: ^0.31.0 specifier: ^0.34.1
version: 0.31.0(nodemailer@6.9.8) version: 0.34.1(nodemailer@6.9.8)
'@auth/express': '@auth/express':
specifier: ^0.5.5 specifier: ^0.5.5
version: 0.5.6(express@4.18.2)(nodemailer@6.9.8) version: 0.5.6(express@4.18.2)(nodemailer@6.9.8)
@ -518,7 +529,7 @@ importers:
version: 0.4.4 version: 0.4.4
puppeteer: puppeteer:
specifier: ^21.7.0 specifier: ^21.7.0
version: 21.7.0(typescript@5.4.5) version: 21.7.0(typescript@5.5.4)
request-ip: request-ip:
specifier: ^3.3.0 specifier: ^3.3.0
version: 3.3.0 version: 3.3.0
@ -536,7 +547,7 @@ importers:
version: 1.2.0(@trpc/server@10.45.2)(zod@3.22.2) version: 1.2.0(@trpc/server@10.45.2)(zod@3.22.2)
ts-node: ts-node:
specifier: ^10.9.1 specifier: ^10.9.1
version: 10.9.1(@types/node@18.17.12)(typescript@5.4.5) version: 10.9.1(@types/node@18.17.12)(typescript@5.5.4)
uuid: uuid:
specifier: ^9.0.1 specifier: ^9.0.1
version: 9.0.1 version: 9.0.1
@ -553,8 +564,8 @@ importers:
specifier: ^3.22.2 specifier: ^3.22.2
version: 3.22.2 version: 3.22.2
zod-prisma: zod-prisma:
specifier: ^0.5.4 specifier: 0.5.4
version: 0.5.4(prisma@5.14.0)(zod@3.22.2) version: 0.5.4(patch_hash=7m3k6hik5q4kosvcy74j54segm)(prisma@5.14.0)(zod@3.22.2)
devDependencies: devDependencies:
'@faker-js/faker': '@faker-js/faker':
specifier: ^8.4.0 specifier: ^8.4.0
@ -633,7 +644,7 @@ importers:
version: 5.14.0 version: 5.14.0
prisma-json-types-generator: prisma-json-types-generator:
specifier: 3.0.3 specifier: 3.0.3
version: 3.0.3(prisma@5.14.0)(typescript@5.4.5) version: 3.0.3(prisma@5.14.0)(typescript@5.5.4)
prisma-zod-generator: prisma-zod-generator:
specifier: 0.8.13 specifier: 0.8.13
version: 0.8.13(prisma@5.14.0) version: 0.8.13(prisma@5.14.0)
@ -642,10 +653,13 @@ importers:
version: 6.3.4 version: 6.3.4
tailwindcss: tailwindcss:
specifier: ^3.3.5 specifier: ^3.3.5
version: 3.3.5(ts-node@10.9.1(@types/node@18.17.12)(typescript@5.4.5)) version: 3.3.5(ts-node@10.9.1(@types/node@18.17.12)(typescript@5.5.4))
tsx: tsx:
specifier: ^4.16.2 specifier: ^4.16.2
version: 4.16.2 version: 4.16.2
typescript:
specifier: ^5.5.4
version: 5.5.4
vite: vite:
specifier: ^5.0.12 specifier: ^5.0.12
version: 5.0.12(@types/node@18.17.12)(less@4.2.0)(terser@5.28.1) version: 5.0.12(@types/node@18.17.12)(less@4.2.0)(terser@5.28.1)
@ -661,7 +675,7 @@ importers:
devDependencies: devDependencies:
tsup: tsup:
specifier: ^8.2.3 specifier: ^8.2.3
version: 8.2.3(jiti@1.21.0)(postcss@8.4.38)(tsx@4.16.2)(typescript@5.4.5) version: 8.2.3(jiti@1.21.0)(postcss@8.4.38)(tsx@4.16.2)(typescript@5.5.4)
vitest: vitest:
specifier: ^1.2.1 specifier: ^1.2.1
version: 1.2.1(@types/node@20.12.7)(happy-dom@14.7.1)(less@4.2.0)(terser@5.28.1) version: 1.2.1(@types/node@20.12.7)(happy-dom@14.7.1)(less@4.2.0)(terser@5.28.1)
@ -1140,20 +1154,6 @@ packages:
resolution: {integrity: sha512-hv/aXDILyroHioVW27etFMV+IX6FyNn41YwbeGIAt5h/7fUTQvHI5w3ols8qYAT8aQt3kzexq5ZwxFDxNHIhdQ==} resolution: {integrity: sha512-hv/aXDILyroHioVW27etFMV+IX6FyNn41YwbeGIAt5h/7fUTQvHI5w3ols8qYAT8aQt3kzexq5ZwxFDxNHIhdQ==}
engines: {node: '>= 16'} engines: {node: '>= 16'}
'@auth/core@0.31.0':
resolution: {integrity: sha512-UKk3psvA1cRbk4/c9CkpWB8mdWrkKvzw0DmEYRsWolUQytQ2cRqx+hYuV6ZCsngw/xbj9hpmkZmAZEyq2g4fMg==}
peerDependencies:
'@simplewebauthn/browser': ^9.0.1
'@simplewebauthn/server': ^9.0.2
nodemailer: ^6.8.0
peerDependenciesMeta:
'@simplewebauthn/browser':
optional: true
'@simplewebauthn/server':
optional: true
nodemailer:
optional: true
'@auth/core@0.34.1': '@auth/core@0.34.1':
resolution: {integrity: sha512-tuYU2VIbI8rFbkSwP710LmybB2FXJsPN7j3sjRVfN9SXVQBK2ej6LdewQaofpBGp4Mk+cC2UeiGNH0or4tgaeA==} resolution: {integrity: sha512-tuYU2VIbI8rFbkSwP710LmybB2FXJsPN7j3sjRVfN9SXVQBK2ej6LdewQaofpBGp4Mk+cC2UeiGNH0or4tgaeA==}
peerDependencies: peerDependencies:
@ -8951,10 +8951,6 @@ packages:
resolution: {integrity: sha512-sBz8G/YjVniEz6lKPNpKxXwazJe4c19fEfV2GDMX6AjFz+MX9uDWIZW8XreVhkFW3fkIdTv/gxWr/Kks5FFAVw==} resolution: {integrity: sha512-sBz8G/YjVniEz6lKPNpKxXwazJe4c19fEfV2GDMX6AjFz+MX9uDWIZW8XreVhkFW3fkIdTv/gxWr/Kks5FFAVw==}
engines: {node: '>=10'} engines: {node: '>=10'}
minimatch@9.0.3:
resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==}
engines: {node: '>=16 || 14 >=14.17'}
minimatch@9.0.5: minimatch@9.0.5:
resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==}
engines: {node: '>=16 || 14 >=14.17'} engines: {node: '>=16 || 14 >=14.17'}
@ -12342,6 +12338,11 @@ packages:
engines: {node: '>=14.17'} engines: {node: '>=14.17'}
hasBin: true hasBin: true
typescript@5.5.4:
resolution: {integrity: sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==}
engines: {node: '>=14.17'}
hasBin: true
typewise-core@1.2.0: typewise-core@1.2.0:
resolution: {integrity: sha512-2SCC/WLzj2SbUwzFOzqMCkz5amXLlxtJqDKTICqg30x+2DZxcfZN2MvQZmGfXWKNWaKK9pBPsvkcwv8bF/gxKg==} resolution: {integrity: sha512-2SCC/WLzj2SbUwzFOzqMCkz5amXLlxtJqDKTICqg30x+2DZxcfZN2MvQZmGfXWKNWaKK9pBPsvkcwv8bF/gxKg==}
@ -13968,18 +13969,6 @@ snapshots:
'@types/json-schema': 7.0.15 '@types/json-schema': 7.0.15
js-yaml: 4.1.0 js-yaml: 4.1.0
'@auth/core@0.31.0(nodemailer@6.9.8)':
dependencies:
'@panva/hkdf': 1.2.1
'@types/cookie': 0.6.0
cookie: 0.6.0
jose: 5.6.3
oauth4webapi: 2.11.1
preact: 10.11.3
preact-render-to-string: 5.2.3(preact@10.11.3)
optionalDependencies:
nodemailer: 6.9.8
'@auth/core@0.34.1(nodemailer@6.9.8)': '@auth/core@0.34.1(nodemailer@6.9.8)':
dependencies: dependencies:
'@panva/hkdf': 1.2.1 '@panva/hkdf': 1.2.1
@ -15928,13 +15917,13 @@ snapshots:
'@hutson/parse-repository-url@5.0.0': {} '@hutson/parse-repository-url@5.0.0': {}
'@i18next-toolkit/cli@1.2.2(buffer@6.0.3)(typescript@5.4.5)': '@i18next-toolkit/cli@1.2.2(buffer@6.0.3)(typescript@5.5.4)':
dependencies: dependencies:
'@i18next-toolkit/extractor': 1.1.0(buffer@6.0.3) '@i18next-toolkit/extractor': 1.1.0(buffer@6.0.3)
'@i18next-toolkit/scanner': 1.0.0 '@i18next-toolkit/scanner': 1.0.0
'@langchain/core': 0.1.52 '@langchain/core': 0.1.52
'@langchain/openai': 0.0.24 '@langchain/openai': 0.0.24
cosmiconfig: 9.0.0(typescript@5.4.5) cosmiconfig: 9.0.0(typescript@5.5.4)
dotenv: 16.4.5 dotenv: 16.4.5
fs-extra: 11.2.0 fs-extra: 11.2.0
inquirer: 8.2.6 inquirer: 8.2.6
@ -17200,12 +17189,12 @@ snapshots:
react: 18.3.1 react: 18.3.1
react-redux: 7.2.9(react-dom@18.2.0(react@18.3.1))(react@18.3.1) react-redux: 7.2.9(react-dom@18.2.0(react@18.3.1))(react@18.3.1)
'@release-it/conventional-changelog@8.0.1(release-it@17.0.1(typescript@5.2.2))': '@release-it/conventional-changelog@8.0.1(release-it@17.0.1(typescript@5.4.5))':
dependencies: dependencies:
concat-stream: 2.0.0 concat-stream: 2.0.0
conventional-changelog: 5.1.0 conventional-changelog: 5.1.0
conventional-recommended-bump: 9.0.0 conventional-recommended-bump: 9.0.0
release-it: 17.0.1(typescript@5.2.2) release-it: 17.0.1(typescript@5.4.5)
semver: 7.5.4 semver: 7.5.4
'@remix-run/router@1.8.0': {} '@remix-run/router@1.8.0': {}
@ -17534,7 +17523,7 @@ snapshots:
'@ts-morph/common@0.22.0': '@ts-morph/common@0.22.0':
dependencies: dependencies:
fast-glob: 3.3.2 fast-glob: 3.3.2
minimatch: 9.0.3 minimatch: 9.0.5
mkdirp: 3.0.1 mkdirp: 3.0.1
path-browserify: 1.0.1 path-browserify: 1.0.1
@ -18379,7 +18368,7 @@ snapshots:
'@types/bonjour@3.5.13': '@types/bonjour@3.5.13':
dependencies: dependencies:
'@types/node': 18.17.12 '@types/node': 18.18.13
'@types/codemirror@5.60.15': '@types/codemirror@5.60.15':
dependencies: dependencies:
@ -18392,7 +18381,7 @@ snapshots:
'@types/connect-history-api-fallback@1.5.4': '@types/connect-history-api-fallback@1.5.4':
dependencies: dependencies:
'@types/express-serve-static-core': 4.17.36 '@types/express-serve-static-core': 4.17.36
'@types/node': 18.17.12 '@types/node': 18.18.13
'@types/connect@3.4.35': '@types/connect@3.4.35':
dependencies: dependencies:
@ -18410,7 +18399,7 @@ snapshots:
'@types/cross-spawn@6.0.2': '@types/cross-spawn@6.0.2':
dependencies: dependencies:
'@types/node': 18.17.12 '@types/node': 18.18.13
'@types/cross-spawn@6.0.3': '@types/cross-spawn@6.0.3':
dependencies: dependencies:
@ -18500,7 +18489,7 @@ snapshots:
'@types/http-proxy@1.17.14': '@types/http-proxy@1.17.14':
dependencies: dependencies:
'@types/node': 18.17.12 '@types/node': 18.18.13
'@types/istanbul-lib-coverage@2.0.6': {} '@types/istanbul-lib-coverage@2.0.6': {}
@ -18580,12 +18569,12 @@ snapshots:
'@types/node-fetch@2.6.11': '@types/node-fetch@2.6.11':
dependencies: dependencies:
'@types/node': 18.17.12 '@types/node': 18.18.13
form-data: 4.0.0 form-data: 4.0.0
'@types/node-forge@1.3.11': '@types/node-forge@1.3.11':
dependencies: dependencies:
'@types/node': 18.17.12 '@types/node': 18.18.13
'@types/node@17.0.45': {} '@types/node@17.0.45': {}
@ -18697,7 +18686,7 @@ snapshots:
'@types/sax@1.2.7': '@types/sax@1.2.7':
dependencies: dependencies:
'@types/node': 18.17.12 '@types/node': 18.18.13
'@types/send@0.17.1': '@types/send@0.17.1':
dependencies: dependencies:
@ -18716,7 +18705,7 @@ snapshots:
'@types/sockjs@0.3.36': '@types/sockjs@0.3.36':
dependencies: dependencies:
'@types/node': 18.17.12 '@types/node': 18.18.13
'@types/statuses@2.0.5': {} '@types/statuses@2.0.5': {}
@ -18763,7 +18752,7 @@ snapshots:
'@types/ws@8.5.10': '@types/ws@8.5.10':
dependencies: dependencies:
'@types/node': 18.17.12 '@types/node': 18.18.13
'@types/yargs-parser@21.0.3': {} '@types/yargs-parser@21.0.3': {}
@ -20274,14 +20263,23 @@ snapshots:
optionalDependencies: optionalDependencies:
typescript: 5.4.5 typescript: 5.4.5
cosmiconfig@9.0.0(typescript@5.4.5): cosmiconfig@8.3.6(typescript@5.5.4):
dependencies:
import-fresh: 3.3.0
js-yaml: 4.1.0
parse-json: 5.2.0
path-type: 4.0.0
optionalDependencies:
typescript: 5.5.4
cosmiconfig@9.0.0(typescript@5.5.4):
dependencies: dependencies:
env-paths: 2.2.1 env-paths: 2.2.1
import-fresh: 3.3.0 import-fresh: 3.3.0
js-yaml: 4.1.0 js-yaml: 4.1.0
parse-json: 5.2.0 parse-json: 5.2.0
optionalDependencies: optionalDependencies:
typescript: 5.4.5 typescript: 5.5.4
crc-32@1.2.2: {} crc-32@1.2.2: {}
@ -22889,7 +22887,7 @@ snapshots:
jest-util@29.7.0: jest-util@29.7.0:
dependencies: dependencies:
'@jest/types': 29.6.3 '@jest/types': 29.6.3
'@types/node': 18.17.12 '@types/node': 18.18.13
chalk: 4.1.2 chalk: 4.1.2
ci-info: 3.8.0 ci-info: 3.8.0
graceful-fs: 4.2.11 graceful-fs: 4.2.11
@ -22897,7 +22895,7 @@ snapshots:
jest-worker@27.5.1: jest-worker@27.5.1:
dependencies: dependencies:
'@types/node': 18.17.12 '@types/node': 18.18.13
merge-stream: 2.0.0 merge-stream: 2.0.0
supports-color: 8.1.1 supports-color: 8.1.1
@ -24230,10 +24228,6 @@ snapshots:
dependencies: dependencies:
brace-expansion: 2.0.1 brace-expansion: 2.0.1
minimatch@9.0.3:
dependencies:
brace-expansion: 2.0.1
minimatch@9.0.5: minimatch@9.0.5:
dependencies: dependencies:
brace-expansion: 2.0.1 brace-expansion: 2.0.1
@ -25186,13 +25180,13 @@ snapshots:
camelcase-css: 2.0.1 camelcase-css: 2.0.1
postcss: 8.4.35 postcss: 8.4.35
postcss-load-config@4.0.1(postcss@8.4.33)(ts-node@10.9.1(@types/node@18.17.12)(typescript@5.4.5)): postcss-load-config@4.0.1(postcss@8.4.33)(ts-node@10.9.1(@types/node@18.17.12)(typescript@5.5.4)):
dependencies: dependencies:
lilconfig: 2.1.0 lilconfig: 2.1.0
yaml: 2.3.2 yaml: 2.3.2
optionalDependencies: optionalDependencies:
postcss: 8.4.33 postcss: 8.4.33
ts-node: 10.9.1(@types/node@18.17.12)(typescript@5.4.5) ts-node: 10.9.1(@types/node@18.17.12)(typescript@5.5.4)
postcss-load-config@4.0.1(postcss@8.4.33)(ts-node@10.9.1(@types/node@20.12.7)(typescript@5.2.2)): postcss-load-config@4.0.1(postcss@8.4.33)(ts-node@10.9.1(@types/node@20.12.7)(typescript@5.2.2)):
dependencies: dependencies:
@ -25202,13 +25196,13 @@ snapshots:
postcss: 8.4.33 postcss: 8.4.33
ts-node: 10.9.1(@types/node@20.12.7)(typescript@5.2.2) ts-node: 10.9.1(@types/node@20.12.7)(typescript@5.2.2)
postcss-load-config@4.0.1(postcss@8.4.35)(ts-node@10.9.1(@types/node@20.12.7)(typescript@5.4.5)): postcss-load-config@4.0.1(postcss@8.4.35)(ts-node@10.9.1(@types/node@20.12.7)(typescript@5.5.4)):
dependencies: dependencies:
lilconfig: 2.1.0 lilconfig: 2.1.0
yaml: 2.3.2 yaml: 2.3.2
optionalDependencies: optionalDependencies:
postcss: 8.4.35 postcss: 8.4.35
ts-node: 10.9.1(@types/node@20.12.7)(typescript@5.4.5) ts-node: 10.9.1(@types/node@20.12.7)(typescript@5.5.4)
postcss-load-config@6.0.1(jiti@1.21.0)(postcss@8.4.38)(tsx@4.16.2): postcss-load-config@6.0.1(jiti@1.21.0)(postcss@8.4.38)(tsx@4.16.2):
dependencies: dependencies:
@ -25526,7 +25520,7 @@ snapshots:
postcss@8.4.31: postcss@8.4.31:
dependencies: dependencies:
nanoid: 3.3.7 nanoid: 3.3.7
picocolors: 1.0.0 picocolors: 1.0.1
source-map-js: 1.2.0 source-map-js: 1.2.0
postcss@8.4.33: postcss@8.4.33:
@ -25678,12 +25672,12 @@ snapshots:
clsx: 2.1.0 clsx: 2.1.0
react: 18.3.1 react: 18.3.1
prisma-json-types-generator@3.0.3(prisma@5.14.0)(typescript@5.4.5): prisma-json-types-generator@3.0.3(prisma@5.14.0)(typescript@5.5.4):
dependencies: dependencies:
'@prisma/generator-helper': 5.5.2 '@prisma/generator-helper': 5.5.2
prisma: 5.14.0 prisma: 5.14.0
tslib: 2.6.2 tslib: 2.6.2
typescript: 5.4.5 typescript: 5.5.4
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
@ -25814,10 +25808,10 @@ snapshots:
- supports-color - supports-color
- utf-8-validate - utf-8-validate
puppeteer@21.7.0(typescript@5.4.5): puppeteer@21.7.0(typescript@5.5.4):
dependencies: dependencies:
'@puppeteer/browsers': 1.9.1 '@puppeteer/browsers': 1.9.1
cosmiconfig: 8.3.6(typescript@5.4.5) cosmiconfig: 8.3.6(typescript@5.5.4)
puppeteer-core: 21.7.0 puppeteer-core: 21.7.0
transitivePeerDependencies: transitivePeerDependencies:
- bufferutil - bufferutil
@ -27102,13 +27096,13 @@ snapshots:
relateurl@0.2.7: {} relateurl@0.2.7: {}
release-it@17.0.1(typescript@5.2.2): release-it@17.0.1(typescript@5.4.5):
dependencies: dependencies:
'@iarna/toml': 2.2.5 '@iarna/toml': 2.2.5
'@octokit/rest': 20.0.2 '@octokit/rest': 20.0.2
async-retry: 1.3.3 async-retry: 1.3.3
chalk: 5.3.0 chalk: 5.3.0
cosmiconfig: 8.3.6(typescript@5.2.2) cosmiconfig: 8.3.6(typescript@5.4.5)
execa: 8.0.1 execa: 8.0.1
git-url-parse: 13.1.1 git-url-parse: 13.1.1
globby: 14.0.0 globby: 14.0.0
@ -27612,7 +27606,7 @@ snapshots:
setprototypeof@1.2.0: {} setprototypeof@1.2.0: {}
shadcn-ui@0.8.0(typescript@5.4.5): shadcn-ui@0.8.0(typescript@5.5.4):
dependencies: dependencies:
'@antfu/ni': 0.21.4 '@antfu/ni': 0.21.4
'@babel/core': 7.24.0 '@babel/core': 7.24.0
@ -27620,7 +27614,7 @@ snapshots:
'@babel/plugin-transform-typescript': 7.23.6(@babel/core@7.24.0) '@babel/plugin-transform-typescript': 7.23.6(@babel/core@7.24.0)
chalk: 5.2.0 chalk: 5.2.0
commander: 10.0.1 commander: 10.0.1
cosmiconfig: 8.3.6(typescript@5.4.5) cosmiconfig: 8.3.6(typescript@5.5.4)
diff: 5.2.0 diff: 5.2.0
execa: 7.2.0 execa: 7.2.0
fast-glob: 3.3.2 fast-glob: 3.3.2
@ -28183,11 +28177,11 @@ snapshots:
dependencies: dependencies:
'@babel/runtime': 7.24.0 '@babel/runtime': 7.24.0
tailwindcss-animate@1.0.7(tailwindcss@3.4.1(ts-node@10.9.1(@types/node@20.12.7)(typescript@5.4.5))): tailwindcss-animate@1.0.7(tailwindcss@3.4.1(ts-node@10.9.1(@types/node@20.12.7)(typescript@5.5.4))):
dependencies: dependencies:
tailwindcss: 3.4.1(ts-node@10.9.1(@types/node@20.12.7)(typescript@5.4.5)) tailwindcss: 3.4.1(ts-node@10.9.1(@types/node@20.12.7)(typescript@5.5.4))
tailwindcss@3.3.5(ts-node@10.9.1(@types/node@18.17.12)(typescript@5.4.5)): tailwindcss@3.3.5(ts-node@10.9.1(@types/node@18.17.12)(typescript@5.5.4)):
dependencies: dependencies:
'@alloc/quick-lru': 5.2.0 '@alloc/quick-lru': 5.2.0
arg: 5.0.2 arg: 5.0.2
@ -28206,7 +28200,7 @@ snapshots:
postcss: 8.4.33 postcss: 8.4.33
postcss-import: 15.1.0(postcss@8.4.33) postcss-import: 15.1.0(postcss@8.4.33)
postcss-js: 4.0.1(postcss@8.4.33) postcss-js: 4.0.1(postcss@8.4.33)
postcss-load-config: 4.0.1(postcss@8.4.33)(ts-node@10.9.1(@types/node@18.17.12)(typescript@5.4.5)) postcss-load-config: 4.0.1(postcss@8.4.33)(ts-node@10.9.1(@types/node@18.17.12)(typescript@5.5.4))
postcss-nested: 6.0.1(postcss@8.4.33) postcss-nested: 6.0.1(postcss@8.4.33)
postcss-selector-parser: 6.0.13 postcss-selector-parser: 6.0.13
resolve: 1.22.8 resolve: 1.22.8
@ -28241,7 +28235,7 @@ snapshots:
transitivePeerDependencies: transitivePeerDependencies:
- ts-node - ts-node
tailwindcss@3.4.1(ts-node@10.9.1(@types/node@20.12.7)(typescript@5.4.5)): tailwindcss@3.4.1(ts-node@10.9.1(@types/node@20.12.7)(typescript@5.5.4)):
dependencies: dependencies:
'@alloc/quick-lru': 5.2.0 '@alloc/quick-lru': 5.2.0
arg: 5.0.2 arg: 5.0.2
@ -28260,7 +28254,7 @@ snapshots:
postcss: 8.4.35 postcss: 8.4.35
postcss-import: 15.1.0(postcss@8.4.35) postcss-import: 15.1.0(postcss@8.4.35)
postcss-js: 4.0.1(postcss@8.4.35) postcss-js: 4.0.1(postcss@8.4.35)
postcss-load-config: 4.0.1(postcss@8.4.35)(ts-node@10.9.1(@types/node@20.12.7)(typescript@5.4.5)) postcss-load-config: 4.0.1(postcss@8.4.35)(ts-node@10.9.1(@types/node@20.12.7)(typescript@5.5.4))
postcss-nested: 6.0.1(postcss@8.4.35) postcss-nested: 6.0.1(postcss@8.4.35)
postcss-selector-parser: 6.0.15 postcss-selector-parser: 6.0.15
resolve: 1.22.8 resolve: 1.22.8
@ -28534,24 +28528,6 @@ snapshots:
'@ts-morph/common': 0.22.0 '@ts-morph/common': 0.22.0
code-block-writer: 12.0.0 code-block-writer: 12.0.0
ts-node@10.9.1(@types/node@18.17.12)(typescript@5.2.2):
dependencies:
'@cspotcode/source-map-support': 0.8.1
'@tsconfig/node10': 1.0.9
'@tsconfig/node12': 1.0.11
'@tsconfig/node14': 1.0.3
'@tsconfig/node16': 1.0.4
'@types/node': 18.17.12
acorn: 8.11.3
acorn-walk: 8.3.2
arg: 4.1.3
create-require: 1.1.1
diff: 4.0.2
make-error: 1.3.6
typescript: 5.2.2
v8-compile-cache-lib: 3.0.1
yn: 3.1.1
ts-node@10.9.1(@types/node@18.17.12)(typescript@5.4.5): ts-node@10.9.1(@types/node@18.17.12)(typescript@5.4.5):
dependencies: dependencies:
'@cspotcode/source-map-support': 0.8.1 '@cspotcode/source-map-support': 0.8.1
@ -28570,6 +28546,24 @@ snapshots:
v8-compile-cache-lib: 3.0.1 v8-compile-cache-lib: 3.0.1
yn: 3.1.1 yn: 3.1.1
ts-node@10.9.1(@types/node@18.17.12)(typescript@5.5.4):
dependencies:
'@cspotcode/source-map-support': 0.8.1
'@tsconfig/node10': 1.0.9
'@tsconfig/node12': 1.0.11
'@tsconfig/node14': 1.0.3
'@tsconfig/node16': 1.0.4
'@types/node': 18.17.12
acorn: 8.11.3
acorn-walk: 8.3.2
arg: 4.1.3
create-require: 1.1.1
diff: 4.0.2
make-error: 1.3.6
typescript: 5.5.4
v8-compile-cache-lib: 3.0.1
yn: 3.1.1
ts-node@10.9.1(@types/node@20.12.7)(typescript@5.2.2): ts-node@10.9.1(@types/node@20.12.7)(typescript@5.2.2):
dependencies: dependencies:
'@cspotcode/source-map-support': 0.8.1 '@cspotcode/source-map-support': 0.8.1
@ -28588,7 +28582,7 @@ snapshots:
v8-compile-cache-lib: 3.0.1 v8-compile-cache-lib: 3.0.1
yn: 3.1.1 yn: 3.1.1
ts-node@10.9.1(@types/node@20.12.7)(typescript@5.4.5): ts-node@10.9.1(@types/node@20.12.7)(typescript@5.5.4):
dependencies: dependencies:
'@cspotcode/source-map-support': 0.8.1 '@cspotcode/source-map-support': 0.8.1
'@tsconfig/node10': 1.0.9 '@tsconfig/node10': 1.0.9
@ -28602,7 +28596,7 @@ snapshots:
create-require: 1.1.1 create-require: 1.1.1
diff: 4.0.2 diff: 4.0.2
make-error: 1.3.6 make-error: 1.3.6
typescript: 5.4.5 typescript: 5.5.4
v8-compile-cache-lib: 3.0.1 v8-compile-cache-lib: 3.0.1
yn: 3.1.1 yn: 3.1.1
optional: true optional: true
@ -28621,7 +28615,7 @@ snapshots:
tslib@2.6.2: {} tslib@2.6.2: {}
tsup@8.2.3(jiti@1.21.0)(postcss@8.4.38)(tsx@4.16.2)(typescript@5.4.5): tsup@8.2.3(jiti@1.21.0)(postcss@8.4.38)(tsx@4.16.2)(typescript@5.5.4):
dependencies: dependencies:
bundle-require: 5.0.0(esbuild@0.23.0) bundle-require: 5.0.0(esbuild@0.23.0)
cac: 6.7.14 cac: 6.7.14
@ -28641,7 +28635,7 @@ snapshots:
tree-kill: 1.2.2 tree-kill: 1.2.2
optionalDependencies: optionalDependencies:
postcss: 8.4.38 postcss: 8.4.38
typescript: 5.4.5 typescript: 5.5.4
transitivePeerDependencies: transitivePeerDependencies:
- jiti - jiti
- supports-color - supports-color
@ -28721,6 +28715,8 @@ snapshots:
typescript@5.4.5: {} typescript@5.4.5: {}
typescript@5.5.4: {}
typewise-core@1.2.0: {} typewise-core@1.2.0: {}
typewise@1.0.3: typewise@1.0.3:
@ -29648,7 +29644,7 @@ snapshots:
compress-commons: 4.1.2 compress-commons: 4.1.2
readable-stream: 3.6.2 readable-stream: 3.6.2
zod-prisma@0.5.4(prisma@5.14.0)(zod@3.22.2): zod-prisma@0.5.4(patch_hash=7m3k6hik5q4kosvcy74j54segm)(prisma@5.14.0)(zod@3.22.2):
dependencies: dependencies:
'@prisma/generator-helper': 3.8.1 '@prisma/generator-helper': 3.8.1
parenthesis: 3.1.8 parenthesis: 3.1.8

View File

@ -1,4 +1,4 @@
require('dotenv').config(); import 'dotenv/config';
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import https from 'https'; import https from 'https';
@ -20,7 +20,7 @@ if (process.env.MAXMIND_LICENSE_KEY) {
`?edition_id=${db}&license_key=${process.env.MAXMIND_LICENSE_KEY}&suffix=tar.gz`; `?edition_id=${db}&license_key=${process.env.MAXMIND_LICENSE_KEY}&suffix=tar.gz`;
} }
const dest = path.resolve(__dirname, '../geo'); const dest = path.resolve(process.cwd(), './geo');
if (!fs.existsSync(dest)) { if (!fs.existsSync(dest)) {
fs.mkdirSync(dest); fs.mkdirSync(dest);

View File

@ -1,5 +1,5 @@
import { resolve } from 'path'; import { resolve } from 'path';
import vite from 'vite'; import * as vite from 'vite';
console.log('Start Build Tracker'); console.log('Start Build Tracker');
@ -7,13 +7,13 @@ vite
.build({ .build({
build: { build: {
lib: { lib: {
entry: resolve(__dirname, '../src/tracker/index.js'), entry: resolve(process.cwd(), './src/tracker/index.js'),
name: 'tianji', name: 'tianji',
fileName: () => 'tracker.js', fileName: () => 'tracker.js',
formats: ['iife'], formats: ['iife'],
}, },
emptyOutDir: false, emptyOutDir: false,
outDir: resolve(__dirname, '../src/client/public'), outDir: resolve(process.cwd(), './src/client/public'),
}, },
}) })
.then((res) => { .then((res) => {

View File

@ -4,24 +4,24 @@ import compression from 'compression';
import swaggerUI from 'swagger-ui-express'; import swaggerUI from 'swagger-ui-express';
import passport from 'passport'; import passport from 'passport';
import morgan from 'morgan'; import morgan from 'morgan';
import { websiteRouter } from './router/website'; import { websiteRouter } from './router/website.js';
import { workspaceRouter } from './router/workspace'; import { workspaceRouter } from './router/workspace.js';
import { telemetryRouter } from './router/telemetry'; import { telemetryRouter } from './router/telemetry.js';
import { import {
trpcExpressMiddleware, trpcExpressMiddleware,
trpcOpenapiDocument, trpcOpenapiDocument,
trpcOpenapiHttpHandler, trpcOpenapiHttpHandler,
} from './trpc'; } from './trpc/index.js';
import { env } from './utils/env'; import { env } from './utils/env.js';
import cors from 'cors'; import cors from 'cors';
import { serverStatusRouter } from './router/serverStatus'; import { serverStatusRouter } from './router/serverStatus.js';
import { logger } from './utils/logger'; import { logger } from './utils/logger.js';
import { monitorRouter } from './router/monitor'; import { monitorRouter } from './router/monitor.js';
import { healthRouter } from './router/health'; import { healthRouter } from './router/health.js';
import path from 'path'; import path from 'path';
import { monitorPageManager } from './model/monitor/page/manager'; import { monitorPageManager } from './model/monitor/page/manager.js';
import { ExpressAuth } from '@auth/express'; import { ExpressAuth } from '@auth/express';
import { authConfig } from './model/auth'; import { authConfig } from './model/auth.js';
const app = express(); const app = express();

View File

@ -1,5 +1,5 @@
import { describe, test } from 'vitest'; import { describe, test } from 'vitest';
import { initCronjob } from '.'; import { initCronjob } from './index.js';
describe.runIf(process.env.TEST_CRONJOB)('cronjob', () => { describe.runIf(process.env.TEST_CRONJOB)('cronjob', () => {
const { dailyJob } = initCronjob(); const { dailyJob } = initCronjob();

View File

@ -1,14 +1,14 @@
import { Cron } from 'croner'; import { Cron } from 'croner';
import { logger } from '../utils/logger'; import { logger } from '../utils/logger.js';
import { prisma } from '../model/_client'; import { prisma } from '../model/_client.js';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { FeedChannelNotifyFrequency, Prisma } from '@prisma/client'; import { FeedChannelNotifyFrequency, Prisma } from '@prisma/client';
import { env } from '../utils/env'; import { env } from '../utils/env.js';
import { sendNotification } from '../model/notification'; import { sendNotification } from '../model/notification/index.js';
import { token } from '../model/notification/token'; import { token } from '../model/notification/token/index.js';
import _ from 'lodash'; import _ from 'lodash';
import pMap from 'p-map'; import pMap from 'p-map';
import { sendFeedEventsNotify } from '../model/feed/event'; import { sendFeedEventsNotify } from '../model/feed/event.js';
type WebsiteEventCountSqlReturn = { type WebsiteEventCountSqlReturn = {
workspace_id: string; workspace_id: string;

View File

@ -1,13 +1,13 @@
import 'dotenv/config'; import 'dotenv/config';
import './init'; import './init.js';
import { initUdpServer } from './udp/server'; import { initUdpServer } from './udp/server.js';
import { createServer } from 'http'; import { createServer } from 'http';
import { initSocketio } from './ws'; import { initSocketio } from './ws/index.js';
import { monitorManager } from './model/monitor'; import { monitorManager } from './model/monitor/index.js';
import { env } from './utils/env'; import { env } from './utils/env.js';
import { initCronjob } from './cronjob'; import { initCronjob } from './cronjob/index.js';
import { logger } from './utils/logger'; import { logger } from './utils/logger.js';
import { app } from './app'; import { app } from './app.js';
const port = env.port; const port = env.port;

View File

@ -1,9 +1,9 @@
import { findUser } from '../model/user'; import { findUser } from '../model/user.js';
import passport from 'passport'; import passport from 'passport';
import { Handler } from 'express'; import { Handler } from 'express';
import { Strategy as JwtStrategy, ExtractJwt } from 'passport-jwt'; import { Strategy as JwtStrategy, ExtractJwt } from 'passport-jwt';
import jwt from 'jsonwebtoken'; import jwt from 'jsonwebtoken';
import { jwtSecret } from '../utils/common'; import { jwtSecret } from '../utils/common.js';
export const jwtIssuer = process.env.JWT_ISSUER || 'tianji.msgbyte.com'; export const jwtIssuer = process.env.JWT_ISSUER || 'tianji.msgbyte.com';
export const jwtAudience = process.env.JWT_AUDIENCE || 'msgbyte.com'; export const jwtAudience = process.env.JWT_AUDIENCE || 'msgbyte.com';

View File

@ -1,5 +1,5 @@
import { Handler } from 'express'; import { Handler } from 'express';
import { getWorkspaceUser } from '../model/workspace'; import { getWorkspaceUser } from '../model/workspace.js';
import { ROLES } from '@tianji/shared'; import { ROLES } from '@tianji/shared';
export function workspacePermission(roles: ROLES[] = []): Handler { export function workspacePermission(roles: ROLES[] = []): Handler {
@ -11,7 +11,7 @@ export function workspacePermission(roles: ROLES[] = []): Handler {
throw new Error('Cannot find workspace id'); throw new Error('Cannot find workspace id');
} }
const userId = req.user!.id; const userId = (req.user as any).id;
if (!userId) { if (!userId) {
throw new Error('This middleware should be use after auth()'); throw new Error('This middleware should be use after auth()');

View File

@ -1,6 +1,6 @@
import { PrismaClient } from '@prisma/client'; import { PrismaClient } from '@prisma/client';
import { logger } from '../utils/logger'; import { logger } from '../utils/logger.js';
import { env } from '../utils/env'; import { env } from '../utils/env.js';
const debugEvent = { const debugEvent = {
emit: 'event', emit: 'event',

View File

@ -1,5 +1,5 @@
import { z } from 'zod'; import { z } from 'zod';
import { MonitorModelSchema } from '../../prisma/zod'; import { MonitorModelSchema } from '../../prisma/zod/index.js';
// Match prisma `JsonValue` // Match prisma `JsonValue`
export const jsonFieldSchema = z.union([ export const jsonFieldSchema = z.union([

View File

@ -1,5 +1,5 @@
import { MonitorInfo } from '../../../types'; import { MonitorInfo } from '../../../types/index.js';
import { MonitorModelSchema } from '../../prisma/zod'; import { MonitorModelSchema } from '../../prisma/zod/monitor.js';
export type MonitorInfoWithNotificationIds = MonitorInfo & { export type MonitorInfoWithNotificationIds = MonitorInfo & {
notifications: { id: string }[]; notifications: { id: string }[];

View File

@ -1,5 +1,5 @@
import { WorkspaceAuditLogType } from '@prisma/client'; import { WorkspaceAuditLogType } from '@prisma/client';
import { prisma } from './_client'; import { prisma } from './_client.js';
/** /**
* create audit log which can query by log * create audit log which can query by log

View File

@ -1,8 +1,8 @@
import { AuthConfig } from '@auth/core'; import { AuthConfig } from '@auth/core';
import Nodemailer from '@auth/core/providers/nodemailer'; import Nodemailer from '@auth/core/providers/nodemailer';
import { env } from '../utils/env'; import { env } from '../utils/env.js';
import { PrismaAdapter } from '@auth/prisma-adapter'; import { PrismaAdapter } from '@auth/prisma-adapter';
import { prisma } from './_client'; import { prisma } from './_client.js';
export const authConfig: Omit<AuthConfig, 'raw'> = { export const authConfig: Omit<AuthConfig, 'raw'> = {
providers: [Nodemailer(env.auth.email)], providers: [Nodemailer(env.auth.email)],

View File

@ -1,15 +1,15 @@
import { FeedChannelNotifyFrequency, FeedEvent, Prisma } from '@prisma/client'; import { FeedChannelNotifyFrequency, FeedEvent, Prisma } from '@prisma/client';
import { subscribeEventBus } from '../../ws/shared'; import { subscribeEventBus } from '../../ws/shared.js';
import { prisma } from '../_client'; import { prisma } from '../_client.js';
import { serializeJSON } from '../../utils/json'; import { serializeJSON } from '../../utils/json.js';
import { buildQueryWithCache } from '../../cache'; import { buildQueryWithCache } from '../../cache/index.js';
import { sendNotification } from '../notification'; import { sendNotification } from '../notification/index.js';
import { ContentToken, token } from '../notification/token'; import { ContentToken, token } from '../notification/token/index.js';
import { logger } from '../../utils/logger'; import { logger } from '../../utils/logger.js';
import { import {
FeedChannelModelSchema, FeedChannelModelSchema,
NotificationModelSchema, NotificationModelSchema,
} from '../../prisma/zod'; } from '../../prisma/zod/index.js';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { z } from 'zod'; import { z } from 'zod';

View File

@ -1,5 +1,5 @@
import { describe, bench } from 'vitest'; import { describe, bench } from 'vitest';
import { prisma } from '../_client'; import { prisma } from '../_client.js';
const workspaceId = process.env.BENCH_MONITOR_WORKSPACEID; const workspaceId = process.env.BENCH_MONITOR_WORKSPACEID;
const monitorId = process.env.BENCH_MONITOR_ID; const monitorId = process.env.BENCH_MONITOR_ID;

View File

@ -1,6 +1,6 @@
import { prisma } from '../_client'; import { prisma } from '../_client.js';
import { monitorPublicInfoSchema } from '../_schema/monitor'; import { monitorPublicInfoSchema } from '../_schema/monitor.js';
import { MonitorManager } from './manager'; import { MonitorManager } from './manager.js';
export const monitorManager = new MonitorManager(); export const monitorManager = new MonitorManager();

View File

@ -1,7 +1,7 @@
import { Monitor, Notification } from '@prisma/client'; import { Monitor, Notification } from '@prisma/client';
import { prisma } from '../_client'; import { prisma } from '../_client.js';
import { MonitorRunner } from './runner'; import { MonitorRunner } from './runner.js';
import { logger } from '../../utils/logger'; import { logger } from '../../utils/logger.js';
export type MonitorUpsertData = Pick< export type MonitorUpsertData = Pick<
Monitor, Monitor,

View File

@ -1,5 +1,5 @@
import { logger } from '../../../utils/logger'; import { logger } from '../../../utils/logger.js';
import { prisma } from '../../_client'; import { prisma } from '../../_client.js';
class MonitorPageManager { class MonitorPageManager {
private customDomainPage: Record< private customDomainPage: Record<

View File

@ -1,5 +1,5 @@
import { describe, expect, test } from 'vitest'; import { describe, expect, test } from 'vitest';
import { dns } from '../dns'; import { dns } from '../dns.js';
describe('dns', () => { describe('dns', () => {
test('run', async () => { test('run', async () => {

View File

@ -1,5 +1,5 @@
import { describe, expect, test } from 'vitest'; import { describe, expect, test } from 'vitest';
import { getBillingCreditGrants } from '../openai'; import { getBillingCreditGrants } from '../openai.js';
describe.runIf(!!process.env.TEST_OPENAI_SESS_KEY)('openai', () => { describe.runIf(!!process.env.TEST_OPENAI_SESS_KEY)('openai', () => {
test('getBillingCreditGrants should be ok', async () => { test('getBillingCreditGrants should be ok', async () => {

View File

@ -1,4 +1,4 @@
import { prisma } from '../../_client'; import { prisma } from '../../_client.js';
export async function saveMonitorStatus( export async function saveMonitorStatus(
monitorId: string, monitorId: string,

View File

@ -1,7 +1,7 @@
import { MonitorProvider } from './type'; import { MonitorProvider } from './type.js';
import ivm from 'isolated-vm'; import ivm from 'isolated-vm';
import { buildSandbox, environmentScript } from '../../../utils/sandbox'; import { buildSandbox, environmentScript } from '../../../utils/sandbox.js';
import { env } from '../../../utils/env'; import { env } from '../../../utils/env.js';
export const custom: MonitorProvider<{ export const custom: MonitorProvider<{
code: string; code: string;

View File

@ -1,4 +1,4 @@
import { MonitorProvider } from './type'; import { MonitorProvider } from './type.js';
import { Resolver } from 'dns'; import { Resolver } from 'dns';
export const dns: MonitorProvider<{ export const dns: MonitorProvider<{

View File

@ -1,9 +1,9 @@
import { MonitorProvider } from './type'; import { MonitorProvider } from './type.js';
import axios, { AxiosRequestConfig, AxiosResponse } from 'axios'; import axios, { AxiosRequestConfig, AxiosResponse } from 'axios';
import { logger } from '../../../utils/logger'; import { logger } from '../../../utils/logger.js';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import https from 'https'; import https from 'https';
import { saveMonitorStatus } from './_utils'; import { saveMonitorStatus } from './_utils.js';
export const http: MonitorProvider<{ export const http: MonitorProvider<{
url: string; url: string;

View File

@ -1,10 +1,10 @@
import { http } from './http'; import { http } from './http.js';
import { ping } from './ping'; import { ping } from './ping.js';
import { openai } from './openai'; import { openai } from './openai.js';
import type { MonitorProvider } from './type'; import type { MonitorProvider } from './type.js';
import { custom } from './custom'; import { custom } from './custom.js';
import { tcp } from './tcp'; import { tcp } from './tcp.js';
import { dns } from './dns'; import { dns } from './dns.js';
export const monitorProviders: Record<string, MonitorProvider<any>> = { export const monitorProviders: Record<string, MonitorProvider<any>> = {
ping, ping,

View File

@ -1,7 +1,7 @@
import { z } from 'zod'; import { z } from 'zod';
import { MonitorProvider } from './type'; import { MonitorProvider } from './type.js';
import axios from 'axios'; import axios from 'axios';
import { saveMonitorStatus } from './_utils'; import { saveMonitorStatus } from './_utils.js';
import _ from 'lodash'; import _ from 'lodash';
const openaiCreditGrantsSchema = z.object({ const openaiCreditGrantsSchema = z.object({

View File

@ -1,4 +1,4 @@
import { MonitorProvider } from './type'; import { MonitorProvider } from './type.js';
import pingUtils from 'ping'; import pingUtils from 'ping';
import os from 'os'; import os from 'os';
import chardet from 'chardet'; import chardet from 'chardet';

View File

@ -1,4 +1,4 @@
import { MonitorProvider } from './type'; import { MonitorProvider } from './type.js';
import tcpp from 'tcp-ping'; import tcpp from 'tcp-ping';
export const tcp: MonitorProvider<{ export const tcp: MonitorProvider<{

View File

@ -1,5 +1,5 @@
import { Monitor } from '@prisma/client'; import { Monitor } from '@prisma/client';
import type { ExactType } from '../../../../types'; import type { ExactType } from '../../../../types/index.js';
export interface MonitorProvider<Payload extends Record<string, any>> { export interface MonitorProvider<Payload extends Record<string, any>> {
run: (monitor: ExactType<Monitor, { payload: Payload }>) => Promise<number>; run: (monitor: ExactType<Monitor, { payload: Payload }>) => Promise<number>;

View File

@ -1,13 +1,13 @@
import { Monitor, Notification } from '@prisma/client'; import { Monitor, Notification } from '@prisma/client';
import { subscribeEventBus } from '../../ws/shared'; import { subscribeEventBus } from '../../ws/shared.js';
import { prisma } from '../_client'; import { prisma } from '../_client.js';
import { monitorProviders } from './provider'; import { monitorProviders } from './provider/index.js';
import { sendNotification } from '../notification'; import { sendNotification } from '../notification/index.js';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { logger } from '../../utils/logger'; import { logger } from '../../utils/logger.js';
import { token } from '../notification/token'; import { token } from '../notification/token/index.js';
import { ContentToken } from '../notification/token/type'; import { ContentToken } from '../notification/token/type.js';
import { createAuditLog } from '../auditLog'; import { createAuditLog } from '../auditLog.js';
/** /**
* Class which actually run monitor data collect * Class which actually run monitor data collect

View File

@ -1,7 +1,7 @@
import { Notification } from '@prisma/client'; import { Notification } from '@prisma/client';
import { notificationProviders } from './provider'; import { notificationProviders } from './provider/index.js';
import { ExactType } from '../../../types'; import { ExactType } from '../../../types/index.js';
import { ContentToken } from './token'; import { ContentToken } from './token/index.js';
export async function sendNotification( export async function sendNotification(
notification: ExactType< notification: ExactType<

View File

@ -1,6 +1,6 @@
import { describe, test } from 'vitest'; import { describe, test } from 'vitest';
import { apprise } from '../apprise'; import { apprise } from '../apprise.js';
import { token } from '../../token'; import { token } from '../../token/index.js';
describe.runIf(!!process.env.TEST_APPRISE_URL)('apprise', () => { describe.runIf(!!process.env.TEST_APPRISE_URL)('apprise', () => {
test('apprise should be work', async () => { test('apprise should be work', async () => {

View File

@ -1,5 +1,5 @@
import { NotificationProvider } from './type'; import { NotificationProvider } from './type.js';
import { baseContentTokenizer } from '../token'; import { baseContentTokenizer } from '../token/index.js';
import execa from 'execa'; import execa from 'execa';
interface ApprisePayload { interface ApprisePayload {

View File

@ -1,5 +1,5 @@
import { NotificationProvider } from './type'; import { NotificationProvider } from './type.js';
import { baseContentTokenizer } from '../token'; import { baseContentTokenizer } from '../token/index.js';
import axios from 'axios'; import axios from 'axios';
interface FeishuPayload { interface FeishuPayload {

View File

@ -1,9 +1,9 @@
import { apprise } from './apprise'; import { apprise } from './apprise.js';
import { feishu } from './feishu'; import { feishu } from './feishu.js';
import { smtp } from './smtp'; import { smtp } from './smtp.js';
import { telegram } from './telegram'; import { telegram } from './telegram.js';
import { webhook } from './webhook'; import { webhook } from './webhook.js';
import type { NotificationProvider } from './type'; import type { NotificationProvider } from './type.js';
export const notificationProviders: Record<string, NotificationProvider> = { export const notificationProviders: Record<string, NotificationProvider> = {
smtp, smtp,

View File

@ -1,7 +1,7 @@
import { NotificationProvider } from './type'; import { NotificationProvider } from './type.js';
import nodemailer from 'nodemailer'; import nodemailer from 'nodemailer';
import SMTPTransport from 'nodemailer/lib/smtp-transport'; import SMTPTransport from 'nodemailer/lib/smtp-transport';
import { htmlContentTokenizer } from '../token'; import { htmlContentTokenizer } from '../token/index.js';
interface SMTPPayload { interface SMTPPayload {
hostname: string; hostname: string;

View File

@ -1,7 +1,7 @@
import { NotificationProvider } from './type'; import { NotificationProvider } from './type.js';
import { telegramContentTokenizer, token } from '../token'; import { telegramContentTokenizer, token } from '../token/index.js';
import axios from 'axios'; import axios from 'axios';
import { ImageContentToken } from '../token/type'; import { ImageContentToken } from '../token/type.js';
interface TelegramPayload { interface TelegramPayload {
botToken: string; botToken: string;

View File

@ -1,5 +1,5 @@
import { Notification } from '@prisma/client'; import { Notification } from '@prisma/client';
import { ContentToken } from '../token'; import { ContentToken } from '../token/index.js';
export interface NotificationProvider { export interface NotificationProvider {
send: ( send: (

View File

@ -1,5 +1,5 @@
import { NotificationProvider } from './type'; import { NotificationProvider } from './type.js';
import { baseContentTokenizer } from '../token'; import { baseContentTokenizer } from '../token/index.js';
import axios from 'axios'; import axios from 'axios';
import dayjs from 'dayjs'; import dayjs from 'dayjs';

View File

@ -1,7 +1,7 @@
import { BaseContentTokenizer } from './tokenizer/base'; import { BaseContentTokenizer } from './tokenizer/base.js';
import { HTMLContentTokenizer } from './tokenizer/html'; import { HTMLContentTokenizer } from './tokenizer/html.js';
import { MarkdownContentTokenizer } from './tokenizer/markdown'; import { MarkdownContentTokenizer } from './tokenizer/markdown.js';
import { TelegramContentTokenizer } from './tokenizer/telegram'; import { TelegramContentTokenizer } from './tokenizer/telegram.js';
import { import {
ContentToken, ContentToken,
ImageContentToken, ImageContentToken,
@ -11,7 +11,7 @@ import {
TextContentToken, TextContentToken,
TitleContentToken, TitleContentToken,
UrlContentToken, UrlContentToken,
} from './type'; } from './type.js';
export type { ContentToken }; export type { ContentToken };

View File

@ -7,7 +7,7 @@ import {
TextContentToken, TextContentToken,
TitleContentToken, TitleContentToken,
UrlContentToken, UrlContentToken,
} from '../type'; } from '../type.js';
export class BaseContentTokenizer { export class BaseContentTokenizer {
parseText(token: TextContentToken) { parseText(token: TextContentToken) {

View File

@ -5,8 +5,8 @@ import {
ParagraphContentToken, ParagraphContentToken,
TitleContentToken, TitleContentToken,
UrlContentToken, UrlContentToken,
} from '../type'; } from '../type.js';
import { BaseContentTokenizer } from './base'; import { BaseContentTokenizer } from './base.js';
export class HTMLContentTokenizer extends BaseContentTokenizer { export class HTMLContentTokenizer extends BaseContentTokenizer {
parseImage(token: ImageContentToken) { parseImage(token: ImageContentToken) {

View File

@ -4,8 +4,8 @@ import {
ParagraphContentToken, ParagraphContentToken,
TitleContentToken, TitleContentToken,
UrlContentToken, UrlContentToken,
} from '../type'; } from '../type.js';
import { BaseContentTokenizer } from './base'; import { BaseContentTokenizer } from './base.js';
export class MarkdownContentTokenizer extends BaseContentTokenizer { export class MarkdownContentTokenizer extends BaseContentTokenizer {
parseImage(token: ImageContentToken) { parseImage(token: ImageContentToken) {

View File

@ -4,8 +4,8 @@ import {
TextContentToken, TextContentToken,
TitleContentToken, TitleContentToken,
UrlContentToken, UrlContentToken,
} from '../type'; } from '../type.js';
import { BaseContentTokenizer } from './base'; import { BaseContentTokenizer } from './base.js';
export class TelegramContentTokenizer extends BaseContentTokenizer { export class TelegramContentTokenizer extends BaseContentTokenizer {
parseImage(token: ImageContentToken) { parseImage(token: ImageContentToken) {

View File

@ -1,5 +1,5 @@
import { ServerStatusInfo } from '../../types'; import { ServerStatusInfo } from '../../types/index.js';
import { createSubscribeInitializer, subscribeEventBus } from '../ws/shared'; import { createSubscribeInitializer, subscribeEventBus } from '../ws/shared.js';
import _ from 'lodash'; import _ from 'lodash';
import { isServerOnline } from '@tianji/shared'; import { isServerOnline } from '@tianji/shared';

View File

@ -1,14 +1,14 @@
import { Prisma, Telemetry, TelemetrySession } from '@prisma/client'; import { Prisma, Telemetry, TelemetrySession } from '@prisma/client';
import { Request } from 'express'; import { Request } from 'express';
import { hashUuid } from '../utils/common'; import { hashUuid } from '../utils/common.js';
import { getRequestInfo } from '../utils/detect'; import { getRequestInfo } from '../utils/detect.js';
import { prisma } from './_client'; import { prisma } from './_client.js';
import { import {
BaseQueryFilters, BaseQueryFilters,
getDateQuery, getDateQuery,
parseTelemetryFilters, parseTelemetryFilters,
} from '../utils/prisma'; } from '../utils/prisma.js';
import { SESSION_COLUMNS } from '../utils/const'; import { SESSION_COLUMNS } from '../utils/const.js';
export async function recordTelemetryEvent(req: Request) { export async function recordTelemetryEvent(req: Request) {
const { name, title, start, fullNum, force, ...others } = req.query; const { name, title, start, fullNum, force, ...others } = req.query;

View File

@ -1,7 +1,7 @@
import { prisma } from './_client'; import { prisma } from './_client.js';
import bcryptjs from 'bcryptjs'; import bcryptjs from 'bcryptjs';
import { ROLES, SYSTEM_ROLES } from '@tianji/shared'; import { ROLES, SYSTEM_ROLES } from '@tianji/shared';
import { jwtVerify } from '../middleware/auth'; import { jwtVerify } from '../middleware/auth.js';
import { TRPCError } from '@trpc/server'; import { TRPCError } from '@trpc/server';
import { Prisma } from '@prisma/client'; import { Prisma } from '@prisma/client';

View File

@ -1,23 +1,23 @@
import { Prisma, Website, WebsiteSession } from '@prisma/client'; import { Prisma, Website, WebsiteSession } from '@prisma/client';
import { flattenJSON, hashUuid, isCuid, parseToken } from '../utils/common'; import { flattenJSON, hashUuid, isCuid, parseToken } from '../utils/common.js';
import { prisma } from './_client'; import { prisma } from './_client.js';
import { Request } from 'express'; import { Request } from 'express';
import { getClientInfo } from '../utils/detect'; import { getClientInfo } from '../utils/detect.js';
import { import {
DATA_TYPE, DATA_TYPE,
EVENT_NAME_LENGTH, EVENT_NAME_LENGTH,
EVENT_TYPE, EVENT_TYPE,
SESSION_COLUMNS, SESSION_COLUMNS,
URL_LENGTH, URL_LENGTH,
} from '../utils/const'; } from '../utils/const.js';
import type { DynamicData } from '../utils/types'; import type { DynamicData } from '../utils/types.js';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { import {
WebsiteQueryFilters, WebsiteQueryFilters,
getDateQuery, getDateQuery,
getTimestampIntervalQuery, getTimestampIntervalQuery,
parseWebsiteFilters, parseWebsiteFilters,
} from '../utils/prisma'; } from '../utils/prisma.js';
export interface WebsiteEventPayload { export interface WebsiteEventPayload {
data?: object; data?: object;
@ -209,8 +209,8 @@ export async function saveWebsiteEvent(data: {
a.dynamicDataType === DATA_TYPE.number a.dynamicDataType === DATA_TYPE.number
? parseFloat(a.value).toFixed(4) ? parseFloat(a.value).toFixed(4)
: a.dynamicDataType === DATA_TYPE.date : a.dynamicDataType === DATA_TYPE.date
? a.value.split('.')[0] + 'Z' ? a.value.split('.')[0] + 'Z'
: a.value.toString(), : a.value.toString(),
numberValue: a.dynamicDataType === DATA_TYPE.number ? a.value : null, numberValue: a.dynamicDataType === DATA_TYPE.number ? a.value : null,
dateValue: dateValue:
a.dynamicDataType === DATA_TYPE.date ? new Date(a.value) : null, a.dynamicDataType === DATA_TYPE.date ? new Date(a.value) : null,
@ -242,8 +242,8 @@ export async function saveWebsiteSessionData(data: {
a.dynamicDataType === DATA_TYPE.number a.dynamicDataType === DATA_TYPE.number
? parseFloat(a.value).toFixed(4) ? parseFloat(a.value).toFixed(4)
: a.dynamicDataType === DATA_TYPE.date : a.dynamicDataType === DATA_TYPE.date
? a.value.split('.')[0] + 'Z' ? a.value.split('.')[0] + 'Z'
: a.value.toString(), : a.value.toString(),
numberValue: a.dynamicDataType === DATA_TYPE.number ? a.value : null, numberValue: a.dynamicDataType === DATA_TYPE.number ? a.value : null,
dateValue: a.dynamicDataType === DATA_TYPE.date ? new Date(a.value) : null, dateValue: a.dynamicDataType === DATA_TYPE.date ? new Date(a.value) : null,
dataType: a.dynamicDataType, dataType: a.dynamicDataType,
@ -302,8 +302,8 @@ export async function getWebsiteSessionMetrics(
where "WebsiteEvent"."websiteId" = ${websiteId} where "WebsiteEvent"."websiteId" = ${websiteId}
and "WebsiteEvent"."createdAt" and "WebsiteEvent"."createdAt"
between ${params.startDate}::timestamptz and ${ between ${params.startDate}::timestamptz and ${
params.endDate params.endDate
}::timestamptz }::timestamptz
and "WebsiteEvent"."eventType" = ${EVENT_TYPE.pageView} and "WebsiteEvent"."eventType" = ${EVENT_TYPE.pageView}
${filterQuery} ${filterQuery}
group by 1 group by 1
@ -339,8 +339,8 @@ export async function getWebsitePageviewMetrics(
where "WebsiteEvent"."websiteId" = ${websiteId} where "WebsiteEvent"."websiteId" = ${websiteId}
and "WebsiteEvent"."createdAt" and "WebsiteEvent"."createdAt"
between ${params.startDate}::timestamptz and ${ between ${params.startDate}::timestamptz and ${
params.endDate params.endDate
}::timestamptz }::timestamptz
and "eventType" = ${eventType} and "eventType" = ${eventType}
${excludeDomain} ${excludeDomain}
${filterQuery} ${filterQuery}

View File

@ -1,6 +1,6 @@
import { prisma } from './_client'; import { prisma } from './_client.js';
import { parseWebsiteFilters } from '../utils/prisma'; import { parseWebsiteFilters } from '../utils/prisma.js';
import { DEFAULT_RESET_DATE, EVENT_TYPE } from '../utils/const'; import { DEFAULT_RESET_DATE, EVENT_TYPE } from '../utils/const.js';
export async function getWorkspaceUser(workspaceId: string, userId: string) { export async function getWorkspaceUser(workspaceId: string, userId: string) {
const info = await prisma.workspacesOnUsers.findFirst({ const info = await prisma.workspacesOnUsers.findFirst({

View File

@ -8,7 +8,7 @@
}, },
"scripts": { "scripts": {
"dev": "tsx watch --env-file=.env ./main.ts", "dev": "tsx watch --env-file=.env ./main.ts",
"build": "tsc -p tsconfig.server.json", "build": "tsc",
"postinstall": "pnpm db:generate", "postinstall": "pnpm db:generate",
"check:type": "tsc --noEmit --skipLibCheck --module esnext", "check:type": "tsc --noEmit --skipLibCheck --module esnext",
"db:generate": "prisma generate", "db:generate": "prisma generate",
@ -23,7 +23,7 @@
"keywords": [], "keywords": [],
"author": "moonrailgun <moonrailgun@gmail.com>", "author": "moonrailgun <moonrailgun@gmail.com>",
"dependencies": { "dependencies": {
"@auth/core": "^0.31.0", "@auth/core": "^0.34.1",
"@auth/express": "^0.5.5", "@auth/express": "^0.5.5",
"@auth/prisma-adapter": "^2.1.0", "@auth/prisma-adapter": "^2.1.0",
"@paralleldrive/cuid2": "^2.2.2", "@paralleldrive/cuid2": "^2.2.2",
@ -72,7 +72,7 @@
"winston": "^3.11.0", "winston": "^3.11.0",
"yup": "^1.3.3", "yup": "^1.3.3",
"zod": "^3.22.2", "zod": "^3.22.2",
"zod-prisma": "^0.5.4" "zod-prisma": "0.5.4"
}, },
"devDependencies": { "devDependencies": {
"@faker-js/faker": "^8.4.0", "@faker-js/faker": "^8.4.0",
@ -105,6 +105,7 @@
"supertest": "^6.3.4", "supertest": "^6.3.4",
"tailwindcss": "^3.3.5", "tailwindcss": "^3.3.5",
"tsx": "^4.16.2", "tsx": "^4.16.2",
"typescript": "^5.5.4",
"vite": "^5.0.12", "vite": "^5.0.12",
"vitest": "^1.2.1" "vitest": "^1.2.1"
} }

View File

@ -14,7 +14,7 @@ generator json {
generator zod { generator zod {
provider = "zod-prisma" provider = "zod-prisma"
modelSuffix = "ModelSchema" modelSuffix = "ModelSchema"
imports = "./zod/schemas" imports = "./zod/schemas/index.js"
} }
model User { model User {

View File

@ -1,5 +1,5 @@
import { PrismaClient } from '@prisma/client'; import { PrismaClient } from '@prisma/client';
import { getLocation } from '../../utils/detect'; import { getLocation } from '../../utils/detect.js';
import pMap from 'p-map'; import pMap from 'p-map';
const prisma = new PrismaClient(); const prisma = new PrismaClient();

View File

@ -1,6 +1,6 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { CompleteUser, RelatedUserModelSchema } from "./index" import { CompleteUser, RelatedUserModelSchema } from "./index.js"
export const AccountModelSchema = z.object({ export const AccountModelSchema = z.object({
userId: z.string(), userId: z.string(),

View File

@ -1,7 +1,7 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { FeedChannelNotifyFrequency } from "@prisma/client" import { FeedChannelNotifyFrequency } from "@prisma/client"
import { CompleteWorkspace, RelatedWorkspaceModelSchema, CompleteFeedEvent, RelatedFeedEventModelSchema, CompleteNotification, RelatedNotificationModelSchema } from "./index" import { CompleteWorkspace, RelatedWorkspaceModelSchema, CompleteFeedEvent, RelatedFeedEventModelSchema, CompleteNotification, RelatedNotificationModelSchema } from "./index.js"
export const FeedChannelModelSchema = z.object({ export const FeedChannelModelSchema = z.object({
id: z.string(), id: z.string(),

View File

@ -1,6 +1,6 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { CompleteFeedChannel, RelatedFeedChannelModelSchema } from "./index" import { CompleteFeedChannel, RelatedFeedChannelModelSchema } from "./index.js"
export const FeedEventModelSchema = z.object({ export const FeedEventModelSchema = z.object({
id: z.string(), id: z.string(),

View File

@ -1,26 +1,26 @@
export * from "./user" export * from "./user.js"
export * from "./account" export * from "./account.js"
export * from "./session" export * from "./session.js"
export * from "./verificationtoken" export * from "./verificationtoken.js"
export * from "./workspace" export * from "./workspace.js"
export * from "./workspacesonusers" export * from "./workspacesonusers.js"
export * from "./website" export * from "./website.js"
export * from "./websitesession" export * from "./websitesession.js"
export * from "./websiteevent" export * from "./websiteevent.js"
export * from "./websiteeventdata" export * from "./websiteeventdata.js"
export * from "./websitesessiondata" export * from "./websitesessiondata.js"
export * from "./telemetry" export * from "./telemetry.js"
export * from "./telemetrysession" export * from "./telemetrysession.js"
export * from "./telemetryevent" export * from "./telemetryevent.js"
export * from "./notification" export * from "./notification.js"
export * from "./monitor" export * from "./monitor.js"
export * from "./monitorevent" export * from "./monitorevent.js"
export * from "./monitordata" export * from "./monitordata.js"
export * from "./monitorstatus" export * from "./monitorstatus.js"
export * from "./monitorstatuspage" export * from "./monitorstatuspage.js"
export * from "./workspacedailyusage" export * from "./workspacedailyusage.js"
export * from "./workspaceauditlog" export * from "./workspaceauditlog.js"
export * from "./survey" export * from "./survey.js"
export * from "./surveyresult" export * from "./surveyresult.js"
export * from "./feedchannel" export * from "./feedchannel.js"
export * from "./feedevent" export * from "./feedevent.js"

View File

@ -1,6 +1,6 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { CompleteWorkspace, RelatedWorkspaceModelSchema, CompleteWebsite, RelatedWebsiteModelSchema, CompleteNotification, RelatedNotificationModelSchema, CompleteMonitorEvent, RelatedMonitorEventModelSchema, CompleteMonitorData, RelatedMonitorDataModelSchema, CompleteMonitorStatus, RelatedMonitorStatusModelSchema } from "./index" import { CompleteWorkspace, RelatedWorkspaceModelSchema, CompleteWebsite, RelatedWebsiteModelSchema, CompleteNotification, RelatedNotificationModelSchema, CompleteMonitorEvent, RelatedMonitorEventModelSchema, CompleteMonitorData, RelatedMonitorDataModelSchema, CompleteMonitorStatus, RelatedMonitorStatusModelSchema } from "./index.js"
// Helper schema for JSON fields // Helper schema for JSON fields
type Literal = boolean | number | string type Literal = boolean | number | string

View File

@ -1,6 +1,6 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { CompleteMonitor, RelatedMonitorModelSchema } from "./index" import { CompleteMonitor, RelatedMonitorModelSchema } from "./index.js"
export const MonitorDataModelSchema = z.object({ export const MonitorDataModelSchema = z.object({
id: z.string(), id: z.string(),

View File

@ -1,6 +1,6 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { CompleteMonitor, RelatedMonitorModelSchema } from "./index" import { CompleteMonitor, RelatedMonitorModelSchema } from "./index.js"
export const MonitorEventModelSchema = z.object({ export const MonitorEventModelSchema = z.object({
id: z.string(), id: z.string(),

View File

@ -1,6 +1,6 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { CompleteMonitor, RelatedMonitorModelSchema } from "./index" import { CompleteMonitor, RelatedMonitorModelSchema } from "./index.js"
// Helper schema for JSON fields // Helper schema for JSON fields
type Literal = boolean | number | string type Literal = boolean | number | string

View File

@ -1,6 +1,6 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { CompleteWorkspace, RelatedWorkspaceModelSchema } from "./index" import { CompleteWorkspace, RelatedWorkspaceModelSchema } from "./index.js"
// Helper schema for JSON fields // Helper schema for JSON fields
type Literal = boolean | number | string type Literal = boolean | number | string

View File

@ -1,6 +1,6 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { CompleteWorkspace, RelatedWorkspaceModelSchema, CompleteMonitor, RelatedMonitorModelSchema, CompleteFeedChannel, RelatedFeedChannelModelSchema } from "./index" import { CompleteWorkspace, RelatedWorkspaceModelSchema, CompleteMonitor, RelatedMonitorModelSchema, CompleteFeedChannel, RelatedFeedChannelModelSchema } from "./index.js"
// Helper schema for JSON fields // Helper schema for JSON fields
type Literal = boolean | number | string type Literal = boolean | number | string

View File

@ -1,6 +1,6 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { CompleteUser, RelatedUserModelSchema } from "./index" import { CompleteUser, RelatedUserModelSchema } from "./index.js"
export const SessionModelSchema = z.object({ export const SessionModelSchema = z.object({
sessionToken: z.string(), sessionToken: z.string(),

View File

@ -1,6 +1,6 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { CompleteWorkspace, RelatedWorkspaceModelSchema, CompleteSurveyResult, RelatedSurveyResultModelSchema } from "./index" import { CompleteWorkspace, RelatedWorkspaceModelSchema, CompleteSurveyResult, RelatedSurveyResultModelSchema } from "./index.js"
// Helper schema for JSON fields // Helper schema for JSON fields
type Literal = boolean | number | string type Literal = boolean | number | string

View File

@ -1,6 +1,6 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { CompleteSurvey, RelatedSurveyModelSchema } from "./index" import { CompleteSurvey, RelatedSurveyModelSchema } from "./index.js"
// Helper schema for JSON fields // Helper schema for JSON fields
type Literal = boolean | number | string type Literal = boolean | number | string

View File

@ -1,6 +1,6 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { CompleteWorkspace, RelatedWorkspaceModelSchema, CompleteTelemetrySession, RelatedTelemetrySessionModelSchema, CompleteTelemetryEvent, RelatedTelemetryEventModelSchema } from "./index" import { CompleteWorkspace, RelatedWorkspaceModelSchema, CompleteTelemetrySession, RelatedTelemetrySessionModelSchema, CompleteTelemetryEvent, RelatedTelemetryEventModelSchema } from "./index.js"
export const TelemetryModelSchema = z.object({ export const TelemetryModelSchema = z.object({
id: z.string(), id: z.string(),

View File

@ -1,6 +1,6 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { CompleteTelemetry, RelatedTelemetryModelSchema, CompleteTelemetrySession, RelatedTelemetrySessionModelSchema } from "./index" import { CompleteTelemetry, RelatedTelemetryModelSchema, CompleteTelemetrySession, RelatedTelemetrySessionModelSchema } from "./index.js"
// Helper schema for JSON fields // Helper schema for JSON fields
type Literal = boolean | number | string type Literal = boolean | number | string

View File

@ -1,6 +1,6 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { CompleteTelemetry, RelatedTelemetryModelSchema, CompleteTelemetryEvent, RelatedTelemetryEventModelSchema } from "./index" import { CompleteTelemetry, RelatedTelemetryModelSchema, CompleteTelemetryEvent, RelatedTelemetryEventModelSchema } from "./index.js"
export const TelemetrySessionModelSchema = z.object({ export const TelemetrySessionModelSchema = z.object({
id: z.string(), id: z.string(),

View File

@ -1,6 +1,6 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { CompleteWorkspace, RelatedWorkspaceModelSchema, CompleteAccount, RelatedAccountModelSchema, CompleteSession, RelatedSessionModelSchema, CompleteWorkspacesOnUsers, RelatedWorkspacesOnUsersModelSchema } from "./index" import { CompleteWorkspace, RelatedWorkspaceModelSchema, CompleteAccount, RelatedAccountModelSchema, CompleteSession, RelatedSessionModelSchema, CompleteWorkspacesOnUsers, RelatedWorkspacesOnUsersModelSchema } from "./index.js"
export const UserModelSchema = z.object({ export const UserModelSchema = z.object({
id: z.string(), id: z.string(),

View File

@ -1,5 +1,5 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
export const VerificationTokenModelSchema = z.object({ export const VerificationTokenModelSchema = z.object({
identifier: z.string(), identifier: z.string(),

View File

@ -1,6 +1,6 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { CompleteWorkspace, RelatedWorkspaceModelSchema, CompleteMonitor, RelatedMonitorModelSchema, CompleteWebsiteSession, RelatedWebsiteSessionModelSchema, CompleteWebsiteEventData, RelatedWebsiteEventDataModelSchema, CompleteWebsiteSessionData, RelatedWebsiteSessionDataModelSchema } from "./index" import { CompleteWorkspace, RelatedWorkspaceModelSchema, CompleteMonitor, RelatedMonitorModelSchema, CompleteWebsiteSession, RelatedWebsiteSessionModelSchema, CompleteWebsiteEventData, RelatedWebsiteEventDataModelSchema, CompleteWebsiteSessionData, RelatedWebsiteSessionDataModelSchema } from "./index.js"
export const WebsiteModelSchema = z.object({ export const WebsiteModelSchema = z.object({
id: z.string(), id: z.string(),

View File

@ -1,6 +1,6 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { CompleteWebsiteEventData, RelatedWebsiteEventDataModelSchema, CompleteWebsiteSession, RelatedWebsiteSessionModelSchema } from "./index" import { CompleteWebsiteEventData, RelatedWebsiteEventDataModelSchema, CompleteWebsiteSession, RelatedWebsiteSessionModelSchema } from "./index.js"
export const WebsiteEventModelSchema = z.object({ export const WebsiteEventModelSchema = z.object({
id: z.string(), id: z.string(),

View File

@ -1,6 +1,6 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { CompleteWebsite, RelatedWebsiteModelSchema, CompleteWebsiteEvent, RelatedWebsiteEventModelSchema } from "./index" import { CompleteWebsite, RelatedWebsiteModelSchema, CompleteWebsiteEvent, RelatedWebsiteEventModelSchema } from "./index.js"
export const WebsiteEventDataModelSchema = z.object({ export const WebsiteEventDataModelSchema = z.object({
id: z.string(), id: z.string(),

View File

@ -1,6 +1,6 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { CompleteWebsite, RelatedWebsiteModelSchema, CompleteWebsiteEvent, RelatedWebsiteEventModelSchema, CompleteWebsiteSessionData, RelatedWebsiteSessionDataModelSchema } from "./index" import { CompleteWebsite, RelatedWebsiteModelSchema, CompleteWebsiteEvent, RelatedWebsiteEventModelSchema, CompleteWebsiteSessionData, RelatedWebsiteSessionDataModelSchema } from "./index.js"
export const WebsiteSessionModelSchema = z.object({ export const WebsiteSessionModelSchema = z.object({
id: z.string(), id: z.string(),

View File

@ -1,6 +1,6 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { CompleteWebsite, RelatedWebsiteModelSchema, CompleteWebsiteSession, RelatedWebsiteSessionModelSchema } from "./index" import { CompleteWebsite, RelatedWebsiteModelSchema, CompleteWebsiteSession, RelatedWebsiteSessionModelSchema } from "./index.js"
export const WebsiteSessionDataModelSchema = z.object({ export const WebsiteSessionDataModelSchema = z.object({
id: z.string(), id: z.string(),

View File

@ -1,6 +1,6 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { CompleteWorkspacesOnUsers, RelatedWorkspacesOnUsersModelSchema, CompleteWebsite, RelatedWebsiteModelSchema, CompleteNotification, RelatedNotificationModelSchema, CompleteMonitor, RelatedMonitorModelSchema, CompleteMonitorStatusPage, RelatedMonitorStatusPageModelSchema, CompleteTelemetry, RelatedTelemetryModelSchema, CompleteUser, RelatedUserModelSchema, CompleteWorkspaceDailyUsage, RelatedWorkspaceDailyUsageModelSchema, CompleteWorkspaceAuditLog, RelatedWorkspaceAuditLogModelSchema, CompleteSurvey, RelatedSurveyModelSchema, CompleteFeedChannel, RelatedFeedChannelModelSchema } from "./index" import { CompleteWorkspacesOnUsers, RelatedWorkspacesOnUsersModelSchema, CompleteWebsite, RelatedWebsiteModelSchema, CompleteNotification, RelatedNotificationModelSchema, CompleteMonitor, RelatedMonitorModelSchema, CompleteMonitorStatusPage, RelatedMonitorStatusPageModelSchema, CompleteTelemetry, RelatedTelemetryModelSchema, CompleteUser, RelatedUserModelSchema, CompleteWorkspaceDailyUsage, RelatedWorkspaceDailyUsageModelSchema, CompleteWorkspaceAuditLog, RelatedWorkspaceAuditLogModelSchema, CompleteSurvey, RelatedSurveyModelSchema, CompleteFeedChannel, RelatedFeedChannelModelSchema } from "./index.js"
// Helper schema for JSON fields // Helper schema for JSON fields
type Literal = boolean | number | string type Literal = boolean | number | string

View File

@ -1,7 +1,7 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { WorkspaceAuditLogType } from "@prisma/client" import { WorkspaceAuditLogType } from "@prisma/client"
import { CompleteWorkspace, RelatedWorkspaceModelSchema } from "./index" import { CompleteWorkspace, RelatedWorkspaceModelSchema } from "./index.js"
export const WorkspaceAuditLogModelSchema = z.object({ export const WorkspaceAuditLogModelSchema = z.object({
id: z.string(), id: z.string(),

View File

@ -1,6 +1,6 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { CompleteWorkspace, RelatedWorkspaceModelSchema } from "./index" import { CompleteWorkspace, RelatedWorkspaceModelSchema } from "./index.js"
export const WorkspaceDailyUsageModelSchema = z.object({ export const WorkspaceDailyUsageModelSchema = z.object({
id: z.string(), id: z.string(),

View File

@ -1,6 +1,6 @@
import * as z from "zod" import * as z from "zod"
import * as imports from "./schemas" import * as imports from "./schemas/index.js"
import { CompleteUser, RelatedUserModelSchema, CompleteWorkspace, RelatedWorkspaceModelSchema } from "./index" import { CompleteUser, RelatedUserModelSchema, CompleteWorkspace, RelatedWorkspaceModelSchema } from "./index.js"
export const WorkspacesOnUsersModelSchema = z.object({ export const WorkspacesOnUsersModelSchema = z.object({
userId: z.string(), userId: z.string(),

View File

@ -1,6 +1,6 @@
import { describe, expect, test } from 'vitest'; import { describe, expect, test } from 'vitest';
import { createTestContext } from '../../tests/utils'; import { createTestContext } from '../../tests/utils.js';
import { generateETag } from '../../utils/common'; import { generateETag } from '../../utils/common.js';
describe('telemetry router', () => { describe('telemetry router', () => {
const { app, createTestUser, createTestTelemetry } = createTestContext(); const { app, createTestUser, createTestTelemetry } = createTestContext();

View File

@ -1,9 +1,12 @@
import { Router } from 'express'; import { Router } from 'express';
import { param, validate, query } from '../middleware/validate'; import { param, validate, query } from '../middleware/validate.js';
import { numify } from '../utils/common'; import { numify } from '../utils/common.js';
import { makeBadge } from 'badge-maker'; import { makeBadge } from 'badge-maker';
import { getMonitorPublicInfos, getMonitorRecentData } from '../model/monitor'; import {
import { checkEnvTrusty } from '../utils/env'; getMonitorPublicInfos,
getMonitorRecentData,
} from '../model/monitor/index.js';
import { checkEnvTrusty } from '../utils/env.js';
export const monitorRouter = Router(); export const monitorRouter = Router();

View File

@ -1,8 +1,8 @@
import { Router } from 'express'; import { Router } from 'express';
import { body, header, param, validate } from '../middleware/validate'; import { body, header, param, validate } from '../middleware/validate.js';
import { recordServerStatus } from '../model/serverStatus'; import { recordServerStatus } from '../model/serverStatus.js';
import fs from 'fs-extra'; import fs from 'fs-extra';
import { libraryPath } from '../utils/lib'; import { libraryPath } from '../utils/lib.js';
export const serverStatusRouter = Router(); export const serverStatusRouter = Router();

View File

@ -1,9 +1,9 @@
import { Router } from 'express'; import { Router } from 'express';
import { query, validate } from '../middleware/validate'; import { query, validate } from '../middleware/validate.js';
import { recordTelemetryEvent, sumTelemetryEvent } from '../model/telemetry'; import { recordTelemetryEvent, sumTelemetryEvent } from '../model/telemetry.js';
import { generateETag, numify } from '../utils/common'; import { generateETag, numify } from '../utils/common.js';
import { makeBadge } from 'badge-maker'; import { makeBadge } from 'badge-maker';
import { env } from '../utils/env'; import { env } from '../utils/env.js';
export const telemetryRouter = Router(); export const telemetryRouter = Router();

View File

@ -1,13 +1,13 @@
import { Router } from 'express'; import { Router } from 'express';
import { body, validate } from '../middleware/validate'; import { body, validate } from '../middleware/validate.js';
import * as yup from 'yup'; import * as yup from 'yup';
import { COLLECTION_TYPE } from '../utils/const'; import { COLLECTION_TYPE } from '../utils/const.js';
import { import {
findSession, findSession,
saveWebsiteEvent, saveWebsiteEvent,
saveWebsiteSessionData, saveWebsiteSessionData,
} from '../model/website'; } from '../model/website.js';
import { createToken } from '../utils/common'; import { createToken } from '../utils/common.js';
import { hostnameRegex } from '@tianji/shared'; import { hostnameRegex } from '@tianji/shared';
export const websiteRouter = Router(); export const websiteRouter = Router();

View File

@ -1,8 +1,8 @@
import { Router } from 'express'; import { Router } from 'express';
import { auth } from '../middleware/auth'; import { auth } from '../middleware/auth.js';
import { param, validate } from '../middleware/validate'; import { param, validate } from '../middleware/validate.js';
import { workspacePermission } from '../middleware/workspace'; import { workspacePermission } from '../middleware/workspace.js';
import { deleteWorkspaceWebsite } from '../model/workspace'; import { deleteWorkspaceWebsite } from '../model/workspace.js';
import { ROLES } from '@tianji/shared'; import { ROLES } from '@tianji/shared';
export const workspaceRouter = Router(); export const workspaceRouter = Router();

View File

@ -1,7 +1,7 @@
import { prisma } from '../../model/_client'; import { prisma } from '../../model/_client.js';
import { hashUuid } from '../../utils/common'; import { hashUuid } from '../../utils/common.js';
import { faker } from '@faker-js/faker'; import { faker } from '@faker-js/faker';
import { getLocation } from '../../utils/detect'; import { getLocation } from '../../utils/detect.js';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { WebsiteSession } from '@prisma/client'; import { WebsiteSession } from '@prisma/client';

View File

@ -1,9 +1,9 @@
import supertest from 'supertest'; import supertest from 'supertest';
import { afterAll } from 'vitest'; import { afterAll } from 'vitest';
import { app } from '../app'; import { app } from '../app.js';
import { prisma } from '../model/_client'; import { prisma } from '../model/_client.js';
import { PrismaPromise } from '@prisma/client'; import { PrismaPromise } from '@prisma/client';
import { createUser } from '../model/user'; import { createUser } from '../model/user.js';
import { nanoid } from 'nanoid'; import { nanoid } from 'nanoid';
export function createTestContext() { export function createTestContext() {

View File

@ -1,11 +1,13 @@
import * as trpcExpress from '@trpc/server/adapters/express'; import * as trpcExpress from '@trpc/server/adapters/express';
import { createContext } from './trpc'; import { createContext } from './trpc.js';
import { appRouter } from './routers'; import { appRouter } from './routers/index.js';
import { import {
createOpenApiHttpHandler, createOpenApiHttpHandler,
generateOpenApiDocument, generateOpenApiDocument,
} from 'trpc-openapi'; } from 'trpc-openapi';
import { version } from '../../../package.json'; const packageJson = await import('../../../package.json', {
assert: { type: 'json' },
});
export type { inferRouterInputs, inferRouterOutputs } from '@trpc/server'; export type { inferRouterInputs, inferRouterOutputs } from '@trpc/server';
@ -20,7 +22,7 @@ export const trpcExpressMiddleware = trpcExpress.createExpressMiddleware({
export const trpcOpenapiHttpHandler = createOpenApiHttpHandler({ export const trpcOpenapiHttpHandler = createOpenApiHttpHandler({
router: appRouter, router: appRouter,
createContext, createContext,
}); } as any);
const description = ` const description = `
<h3>Insight into everything</h3> <h3>Insight into everything</h3>
@ -29,6 +31,6 @@ const description = `
export const trpcOpenapiDocument = generateOpenApiDocument(appRouter, { export const trpcOpenapiDocument = generateOpenApiDocument(appRouter, {
title: 'Tianji OpenAPI', title: 'Tianji OpenAPI',
description, description,
version: `v${version}`, version: `v${packageJson.default.version}`,
baseUrl: 'http://localhost:12345/open', baseUrl: 'http://localhost:12345/open',
}); });

View File

@ -1,9 +1,9 @@
import { z } from 'zod'; import { z } from 'zod';
import { OpenApiMetaInfo, router, workspaceProcedure } from '../trpc'; import { OpenApiMetaInfo, router, workspaceProcedure } from '../trpc.js';
import { OPENAPI_TAG } from '../../utils/const'; import { OPENAPI_TAG } from '../../utils/const.js';
import { WorkspaceAuditLogModelSchema } from '../../prisma/zod'; import { WorkspaceAuditLogModelSchema } from '../../prisma/zod/index.js';
import { prisma } from '../../model/_client'; import { prisma } from '../../model/_client.js';
import { fetchDataByCursor } from '../../utils/prisma'; import { fetchDataByCursor } from '../../utils/prisma.js';
import { OpenApiMeta } from 'trpc-openapi'; import { OpenApiMeta } from 'trpc-openapi';
export const auditLogRouter = router({ export const auditLogRouter = router({

View File

@ -1,7 +1,7 @@
import { z } from 'zod'; import { z } from 'zod';
import { OpenApiMetaInfo, router, workspaceProcedure } from '../trpc'; import { OpenApiMetaInfo, router, workspaceProcedure } from '../trpc.js';
import { OPENAPI_TAG } from '../../utils/const'; import { OPENAPI_TAG } from '../../utils/const.js';
import { prisma } from '../../model/_client'; import { prisma } from '../../model/_client.js';
import { OpenApiMeta } from 'trpc-openapi'; import { OpenApiMeta } from 'trpc-openapi';
export const billingRouter = router({ export const billingRouter = router({

View File

@ -5,18 +5,21 @@ import {
router, router,
workspaceOwnerProcedure, workspaceOwnerProcedure,
workspaceProcedure, workspaceProcedure,
} from '../../trpc'; } from '../../trpc.js';
import { OPENAPI_TAG } from '../../../utils/const'; import { OPENAPI_TAG } from '../../../utils/const.js';
import { OpenApiMeta } from 'trpc-openapi'; import { OpenApiMeta } from 'trpc-openapi';
import { import {
FeedChannelModelSchema, FeedChannelModelSchema,
FeedEventModelSchema, FeedEventModelSchema,
} from '../../../prisma/zod'; } from '../../../prisma/zod/index.js';
import { prisma } from '../../../model/_client'; import { prisma } from '../../../model/_client.js';
import _ from 'lodash'; import _ from 'lodash';
import { buildFeedPublicOpenapi, feedIntegrationRouter } from './integration'; import {
import { fetchDataByCursor } from '../../../utils/prisma'; buildFeedPublicOpenapi,
import { delFeedEventNotifyCache } from '../../../model/feed/event'; feedIntegrationRouter,
} from './integration.js';
import { fetchDataByCursor } from '../../../utils/prisma.js';
import { delFeedEventNotifyCache } from '../../../model/feed/event.js';
export const feedRouter = router({ export const feedRouter = router({
channels: workspaceProcedure channels: workspaceProcedure

View File

@ -1,11 +1,11 @@
import { z } from 'zod'; import { z } from 'zod';
import { OpenApiMetaInfo, publicProcedure, router } from '../../trpc'; import { OpenApiMetaInfo, publicProcedure, router } from '../../trpc.js';
import { prisma } from '../../../model/_client'; import { prisma } from '../../../model/_client.js';
import _ from 'lodash'; import _ from 'lodash';
import { OpenApiMeta } from 'trpc-openapi'; import { OpenApiMeta } from 'trpc-openapi';
import { OPENAPI_TAG } from '../../../utils/const'; import { OPENAPI_TAG } from '../../../utils/const.js';
import { createFeedEvent } from '../../../model/feed/event'; import { createFeedEvent } from '../../../model/feed/event.js';
import { tencentCloudAlarmSchema } from '../../../model/_schema/feed'; import { tencentCloudAlarmSchema } from '../../../model/_schema/feed.js';
export const feedIntegrationRouter = router({ export const feedIntegrationRouter = router({
github: publicProcedure github: publicProcedure

View File

@ -1,7 +1,7 @@
import { z } from 'zod'; import { z } from 'zod';
import { publicProcedure, router } from '../trpc'; import { publicProcedure, router } from '../trpc.js';
import { OPENAPI_TAG } from '../../utils/const'; import { OPENAPI_TAG } from '../../utils/const.js';
import { env } from '../../utils/env'; import { env } from '../../utils/env.js';
export const globalRouter = router({ export const globalRouter = router({
config: publicProcedure config: publicProcedure

View File

@ -1,16 +1,16 @@
import { router } from '../trpc'; import { router } from '../trpc.js';
import { notificationRouter } from './notification'; import { notificationRouter } from './notification.js';
import { websiteRouter } from './website'; import { websiteRouter } from './website.js';
import { monitorRouter } from './monitor'; import { monitorRouter } from './monitor.js';
import { userRouter } from './user'; import { userRouter } from './user.js';
import { workspaceRouter } from './workspace'; import { workspaceRouter } from './workspace.js';
import { globalRouter } from './global'; import { globalRouter } from './global.js';
import { serverStatusRouter } from './serverStatus'; import { serverStatusRouter } from './serverStatus.js';
import { auditLogRouter } from './auditLog'; import { auditLogRouter } from './auditLog.js';
import { billingRouter } from './billing'; import { billingRouter } from './billing.js';
import { telemetryRouter } from './telemetry'; import { telemetryRouter } from './telemetry.js';
import { surveyRouter } from './survey'; import { surveyRouter } from './survey.js';
import { feedRouter } from './feed'; import { feedRouter } from './feed/index.js';
export const appRouter = router({ export const appRouter = router({
global: globalRouter, global: globalRouter,

View File

@ -4,34 +4,34 @@ import {
router, router,
workspaceOwnerProcedure, workspaceOwnerProcedure,
workspaceProcedure, workspaceProcedure,
} from '../trpc'; } from '../trpc.js';
import { prisma } from '../../model/_client'; import { prisma } from '../../model/_client.js';
import { z } from 'zod'; import { z } from 'zod';
import { import {
getMonitorData, getMonitorData,
getMonitorPublicInfos, getMonitorPublicInfos,
getMonitorRecentData, getMonitorRecentData,
monitorManager, monitorManager,
} from '../../model/monitor'; } from '../../model/monitor/index.js';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { import {
monitorEventSchema, monitorEventSchema,
monitorInfoWithNotificationIdSchema, monitorInfoWithNotificationIdSchema,
monitorStatusSchema, monitorStatusSchema,
} from '../../model/_schema'; } from '../../model/_schema/index.js';
import { OPENAPI_TAG } from '../../utils/const'; import { OPENAPI_TAG } from '../../utils/const.js';
import { OpenApiMeta } from 'trpc-openapi'; import { OpenApiMeta } from 'trpc-openapi';
import { import {
MonitorModelSchema, MonitorModelSchema,
MonitorStatusPageModelSchema, MonitorStatusPageModelSchema,
} from '../../prisma/zod'; } from '../../prisma/zod/index.js';
import { runCodeInVM } from '../../model/monitor/provider/custom'; import { runCodeInVM } from '../../model/monitor/provider/custom.js';
import { createAuditLog } from '../../model/auditLog'; import { createAuditLog } from '../../model/auditLog.js';
import { import {
MonitorInfoWithNotificationIds, MonitorInfoWithNotificationIds,
monitorPublicInfoSchema, monitorPublicInfoSchema,
} from '../../model/_schema/monitor'; } from '../../model/_schema/monitor.js';
import { monitorPageManager } from '../../model/monitor/page/manager'; import { monitorPageManager } from '../../model/monitor/page/manager.js';
export const monitorRouter = router({ export const monitorRouter = router({
all: workspaceProcedure all: workspaceProcedure

View File

@ -1,8 +1,12 @@
import { router, workspaceOwnerProcedure, workspaceProcedure } from '../trpc'; import {
router,
workspaceOwnerProcedure,
workspaceProcedure,
} from '../trpc.js';
import { z } from 'zod'; import { z } from 'zod';
import { prisma } from '../../model/_client'; import { prisma } from '../../model/_client.js';
import { sendNotification } from '../../model/notification'; import { sendNotification } from '../../model/notification/index.js';
import { token } from '../../model/notification/token'; import { token } from '../../model/notification/token/index.js';
export const notificationRouter = router({ export const notificationRouter = router({
all: workspaceProcedure.query(({ input }) => { all: workspaceProcedure.query(({ input }) => {

View File

@ -1,5 +1,5 @@
import { router, workspaceOwnerProcedure } from '../trpc'; import { router, workspaceOwnerProcedure } from '../trpc.js';
import { clearOfflineServerStatus } from '../../model/serverStatus'; import { clearOfflineServerStatus } from '../../model/serverStatus.js';
export const serverStatusRouter = router({ export const serverStatusRouter = router({
clearOfflineServerStatus: workspaceOwnerProcedure.mutation( clearOfflineServerStatus: workspaceOwnerProcedure.mutation(

Some files were not shown because too many files have changed in this diff Show More