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

View File

@ -1,4 +1,4 @@
require('dotenv').config();
import 'dotenv/config';
import fs from 'fs';
import path from 'path';
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`;
}
const dest = path.resolve(__dirname, '../geo');
const dest = path.resolve(process.cwd(), './geo');
if (!fs.existsSync(dest)) {
fs.mkdirSync(dest);

View File

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

View File

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

View File

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

View File

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

View File

@ -1,13 +1,13 @@
import 'dotenv/config';
import './init';
import { initUdpServer } from './udp/server';
import './init.js';
import { initUdpServer } from './udp/server.js';
import { createServer } from 'http';
import { initSocketio } from './ws';
import { monitorManager } from './model/monitor';
import { env } from './utils/env';
import { initCronjob } from './cronjob';
import { logger } from './utils/logger';
import { app } from './app';
import { initSocketio } from './ws/index.js';
import { monitorManager } from './model/monitor/index.js';
import { env } from './utils/env.js';
import { initCronjob } from './cronjob/index.js';
import { logger } from './utils/logger.js';
import { app } from './app.js';
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 { Handler } from 'express';
import { Strategy as JwtStrategy, ExtractJwt } from 'passport-jwt';
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 jwtAudience = process.env.JWT_AUDIENCE || 'msgbyte.com';

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
import { describe, expect, test } from 'vitest';
import { getBillingCreditGrants } from '../openai';
import { getBillingCreditGrants } from '../openai.js';
describe.runIf(!!process.env.TEST_OPENAI_SESS_KEY)('openai', () => {
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(
monitorId: string,

View File

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

View File

@ -1,4 +1,4 @@
import { MonitorProvider } from './type';
import { MonitorProvider } from './type.js';
import { Resolver } from 'dns';
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 { logger } from '../../../utils/logger';
import { logger } from '../../../utils/logger.js';
import dayjs from 'dayjs';
import https from 'https';
import { saveMonitorStatus } from './_utils';
import { saveMonitorStatus } from './_utils.js';
export const http: MonitorProvider<{
url: string;

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
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>> {
run: (monitor: ExactType<Monitor, { payload: Payload }>) => Promise<number>;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,14 +1,14 @@
import { Prisma, Telemetry, TelemetrySession } from '@prisma/client';
import { Request } from 'express';
import { hashUuid } from '../utils/common';
import { getRequestInfo } from '../utils/detect';
import { prisma } from './_client';
import { hashUuid } from '../utils/common.js';
import { getRequestInfo } from '../utils/detect.js';
import { prisma } from './_client.js';
import {
BaseQueryFilters,
getDateQuery,
parseTelemetryFilters,
} from '../utils/prisma';
import { SESSION_COLUMNS } from '../utils/const';
} from '../utils/prisma.js';
import { SESSION_COLUMNS } from '../utils/const.js';
export async function recordTelemetryEvent(req: Request) {
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 { ROLES, SYSTEM_ROLES } from '@tianji/shared';
import { jwtVerify } from '../middleware/auth';
import { jwtVerify } from '../middleware/auth.js';
import { TRPCError } from '@trpc/server';
import { Prisma } from '@prisma/client';

View File

@ -1,23 +1,23 @@
import { Prisma, Website, WebsiteSession } from '@prisma/client';
import { flattenJSON, hashUuid, isCuid, parseToken } from '../utils/common';
import { prisma } from './_client';
import { flattenJSON, hashUuid, isCuid, parseToken } from '../utils/common.js';
import { prisma } from './_client.js';
import { Request } from 'express';
import { getClientInfo } from '../utils/detect';
import { getClientInfo } from '../utils/detect.js';
import {
DATA_TYPE,
EVENT_NAME_LENGTH,
EVENT_TYPE,
SESSION_COLUMNS,
URL_LENGTH,
} from '../utils/const';
import type { DynamicData } from '../utils/types';
} from '../utils/const.js';
import type { DynamicData } from '../utils/types.js';
import dayjs from 'dayjs';
import {
WebsiteQueryFilters,
getDateQuery,
getTimestampIntervalQuery,
parseWebsiteFilters,
} from '../utils/prisma';
} from '../utils/prisma.js';
export interface WebsiteEventPayload {
data?: object;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
import * as z from "zod"
import * as imports from "./schemas"
import * as imports from "./schemas/index.js"
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({
id: z.string(),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
import * as z from "zod"
import * as imports from "./schemas"
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 * 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.js"
// Helper schema for JSON fields
type Literal = boolean | number | string

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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