@xrystal/core 3.52.0 → 3.52.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -3,25 +3,25 @@
|
|
|
3
3
|
> **EN** — Microservice runtime: Express or Elysia HTTP, DI loaders, live `tmp.yml`, standardized API responses.
|
|
4
4
|
> **TR** — Microservice runtime: Express veya Elysia HTTP, DI loader'lar, canlı `tmp.yml`, standart API cevapları.
|
|
5
5
|
|
|
6
|
-
**CLI:** `xry` · **Version:** `3.52.
|
|
6
|
+
**CLI:** `xry` · **Version:** `3.52.1` · [npm](https://www.npmjs.com/package/@xrystal/core)
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
## Platform services / Platform servisleri
|
|
11
11
|
|
|
12
|
-
**EN:** Consumer microservices in `../services/` — pin `@xrystal/core` to the latest published minor (currently **3.52.
|
|
12
|
+
**EN:** Consumer microservices in `../services/` — pin `@xrystal/core` to the latest published minor (currently **3.52.1**).
|
|
13
13
|
|
|
14
|
-
**TR:** `../services/` altındaki tüketen microservice'ler — `@xrystal/core` sürümünü npm latest ile hizala (şu an **3.52.
|
|
14
|
+
**TR:** `../services/` altındaki tüketen microservice'ler — `@xrystal/core` sürümünü npm latest ile hizala (şu an **3.52.1**).
|
|
15
15
|
|
|
16
16
|
| Repo folder | `tmp.yml` name | Role | Service pkg | `@xrystal/core` |
|
|
17
17
|
|-------------|----------------|------|-------------|-----------------|
|
|
18
|
-
| `api-core-svc` | `core` | Core domain API | `1.0.24` | `3.52.
|
|
19
|
-
| `api-cron-svc` | `crons` | Scheduled jobs / Kafka queue worker | `0.1.25` | `3.52.
|
|
20
|
-
| `api-gateway-svc` | `gateway` | Edge gateway, routing, cache, Mongo config | `2.0.49` | `3.52.
|
|
21
|
-
| `api-gpt-svc` | `gpt` | GPT / AI features | `1.0.22` | `3.52.
|
|
22
|
-
| `api-iam-svc` | `iam` | Identity & access management | `0.7.26` | `3.52.
|
|
23
|
-
| `api-log-svc` | `log` | Logging service | `1.0.20` | `3.52.
|
|
24
|
-
| `api-websocket-svc` | `websocket` | WebSocket / realtime | `0.8.31` | `3.52.
|
|
18
|
+
| `api-core-svc` | `core` | Core domain API | `1.0.24` | `3.52.1` |
|
|
19
|
+
| `api-cron-svc` | `crons` | Scheduled jobs / Kafka queue worker | `0.1.25` | `3.52.1` |
|
|
20
|
+
| `api-gateway-svc` | `gateway` | Edge gateway, routing, cache, Mongo config | `2.0.49` | `3.52.1` |
|
|
21
|
+
| `api-gpt-svc` | `gpt` | GPT / AI features | `1.0.22` | `3.52.1` |
|
|
22
|
+
| `api-iam-svc` | `iam` | Identity & access management | `0.7.26` | `3.52.1` |
|
|
23
|
+
| `api-log-svc` | `log` | Logging service | `1.0.20` | `3.52.1` |
|
|
24
|
+
| `api-websocket-svc` | `websocket` | WebSocket / realtime | `0.8.31` | `3.52.1` |
|
|
25
25
|
|
|
26
26
|
**SSL / TLS helpers** (since 3.49.0): import from loader subpaths, not `@xrystal/core/utils`:
|
|
27
27
|
|
|
@@ -35,7 +35,7 @@ import { resolveMongoConnectOptions } from '@xrystal/core/loader/mongo'
|
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
37
|
cd ../services/api-<name>-svc
|
|
38
|
-
bun add @xrystal/core@3.52.
|
|
38
|
+
bun add @xrystal/core@3.52.1
|
|
39
39
|
bun run build
|
|
40
40
|
```
|
|
41
41
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Yusuf Yasir KAYGUSUZ",
|
|
3
3
|
"name": "@xrystal/core",
|
|
4
|
-
"version": "3.52.
|
|
4
|
+
"version": "3.52.2",
|
|
5
5
|
"description": "microservice runtime library",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"x/bin",
|
|
17
17
|
"x/tmp.yml",
|
|
18
18
|
"x/assets",
|
|
19
|
+
"x/templates",
|
|
19
20
|
"tsconfig.base.json",
|
|
20
21
|
"README.md"
|
|
21
22
|
],
|
|
@@ -3,22 +3,66 @@ import chalk from 'chalk'
|
|
|
3
3
|
import { printCommandHeader } from '../helpers/banner.mjs'
|
|
4
4
|
import { CLI_PRIMARY_NAME } from '../helpers/cli-identity.mjs'
|
|
5
5
|
import { readCliPackageJson } from '../helpers/project-root.mjs'
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
import { readRegistry, resolveXrystalHome, syncRegistryFromPath } from '../helpers/xrystal-registry.mjs'
|
|
7
|
+
|
|
8
|
+
function printProjectsRegistry() {
|
|
9
|
+
const registry = readRegistry()
|
|
10
|
+
console.log(chalk.gray(` home: ${resolveXrystalHome()}`))
|
|
11
|
+
console.log(chalk.gray(` workspaces: ${registry.workspaces.length}`))
|
|
12
|
+
|
|
13
|
+
if (registry.workspaces.length === 0) {
|
|
14
|
+
console.log(chalk.yellow('\n no workspaces registered — run xry create demo --workspace then xry projects sync\n'))
|
|
15
|
+
return
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
for (const ws of registry.workspaces) {
|
|
19
|
+
console.log(chalk.cyan(`\n${ws.name}`))
|
|
20
|
+
console.log(chalk.gray(` path: ${ws.path}`))
|
|
21
|
+
if (ws.projects.length === 0) {
|
|
22
|
+
console.log(chalk.gray(' projects: (none linked yet)'))
|
|
23
|
+
continue
|
|
24
|
+
}
|
|
25
|
+
for (const project of ws.projects) {
|
|
26
|
+
const cluster = project.cluster ? chalk.yellow(` cluster=${project.cluster}`) : ''
|
|
27
|
+
console.log(` • ${project.name} [${project.type}] → ${project.path}${cluster}`)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
console.log('')
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function resolveProjectsMode(action, options) {
|
|
34
|
+
if (options.sync || action === 'sync') return 'sync'
|
|
35
|
+
if (!action || action === 'list') return 'list'
|
|
36
|
+
return null
|
|
37
|
+
}
|
|
12
38
|
|
|
13
39
|
export function registerProjectsCommand(cli, { cliName = CLI_PRIMARY_NAME } = {}) {
|
|
14
40
|
cli
|
|
15
|
-
.command('projects')
|
|
16
|
-
.description('
|
|
17
|
-
.option('--sync', 'Rescan current workspace before listing')
|
|
18
|
-
.
|
|
19
|
-
|
|
41
|
+
.command('projects [action]')
|
|
42
|
+
.description('Workspaces and projects registered under ~/.xrystal')
|
|
43
|
+
.option('--sync', 'Rescan current workspace before listing (alias for sync)')
|
|
44
|
+
.addHelpText(
|
|
45
|
+
'after',
|
|
46
|
+
`
|
|
47
|
+
${chalk.gray('Examples:')}
|
|
48
|
+
${cliName} projects
|
|
49
|
+
${cliName} projects list
|
|
50
|
+
${cliName} projects sync
|
|
51
|
+
${cliName} projects --sync
|
|
52
|
+
`,
|
|
53
|
+
)
|
|
54
|
+
.action((action, options) => {
|
|
55
|
+
const mode = resolveProjectsMode(action, options)
|
|
56
|
+
if (!mode) {
|
|
57
|
+
console.error(chalk.red(`\n✗ Unknown projects action: ${action}\n`))
|
|
58
|
+
console.error(chalk.gray(` Use: ${cliName} projects [list|sync]\n`))
|
|
59
|
+
process.exit(1)
|
|
60
|
+
}
|
|
20
61
|
|
|
21
|
-
|
|
62
|
+
const command = mode === 'sync' ? 'projects sync' : 'projects list'
|
|
63
|
+
printCommandHeader({ cliName, command, version: readCliPackageJson().version })
|
|
64
|
+
|
|
65
|
+
if (mode === 'sync') {
|
|
22
66
|
try {
|
|
23
67
|
syncRegistryFromPath(process.cwd())
|
|
24
68
|
console.log(chalk.green(' registry synced'))
|
|
@@ -27,27 +71,6 @@ export function registerProjectsCommand(cli, { cliName = CLI_PRIMARY_NAME } = {}
|
|
|
27
71
|
}
|
|
28
72
|
}
|
|
29
73
|
|
|
30
|
-
|
|
31
|
-
console.log(chalk.gray(` home: ${resolveXrystalHome()}`))
|
|
32
|
-
console.log(chalk.gray(` workspaces: ${registry.workspaces.length}`))
|
|
33
|
-
|
|
34
|
-
if (registry.workspaces.length === 0) {
|
|
35
|
-
console.log(chalk.yellow('\n no workspaces registered — run xry create demo --workspace then xry sync\n'))
|
|
36
|
-
return
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
for (const ws of registry.workspaces) {
|
|
40
|
-
console.log(chalk.cyan(`\n${ws.name}`))
|
|
41
|
-
console.log(chalk.gray(` path: ${ws.path}`))
|
|
42
|
-
if (ws.projects.length === 0) {
|
|
43
|
-
console.log(chalk.gray(' projects: (none linked yet)'))
|
|
44
|
-
continue
|
|
45
|
-
}
|
|
46
|
-
for (const project of ws.projects) {
|
|
47
|
-
const cluster = project.cluster ? chalk.yellow(` cluster=${project.cluster}`) : ''
|
|
48
|
-
console.log(` • ${project.name} [${project.type}] → ${project.path}${cluster}`)
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
console.log('')
|
|
74
|
+
printProjectsRegistry()
|
|
52
75
|
})
|
|
53
76
|
}
|
|
@@ -32,7 +32,7 @@ const COMMAND_GROUPS = [
|
|
|
32
32
|
{ cmd: 'hooks install', desc: 'Install .git/hooks pre-commit version check' },
|
|
33
33
|
{ cmd: 'hooks status', desc: 'Show whether pre-commit hook is installed' },
|
|
34
34
|
{ cmd: 'sync', desc: 'Sync tsconfig for project or all workspace entries' },
|
|
35
|
-
{ cmd: 'projects', desc: 'List ~/.xrystal registry (workspaces +
|
|
35
|
+
{ cmd: 'projects [list|sync]', desc: 'List or refresh ~/.xrystal registry (workspaces + projects)' },
|
|
36
36
|
],
|
|
37
37
|
},
|
|
38
38
|
{
|
|
@@ -121,11 +121,42 @@ export function assertNpmPackClean(root = process.cwd()) {
|
|
|
121
121
|
return dryRun
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
+
function parseNamedExportBlock(source) {
|
|
125
|
+
const match = source.match(/export\s*\{([^}]+)\}/s)
|
|
126
|
+
if (!match) return []
|
|
127
|
+
return match[1]
|
|
128
|
+
.split(',')
|
|
129
|
+
.map((part) => part.trim())
|
|
130
|
+
.filter(Boolean)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function assertCliGeneratedExports(root = process.cwd()) {
|
|
134
|
+
const wrapperPath = path.join(root, 'x/bin/helpers/tmp-schema.mjs')
|
|
135
|
+
const generatedPath = path.join(root, 'x/bin/helpers/.generated/tmp-schema.mjs')
|
|
136
|
+
if (!fs.existsSync(wrapperPath) || !fs.existsSync(generatedPath)) {
|
|
137
|
+
throw new PublishGuardError('CLI tmp-schema wrapper or .generated/tmp-schema.mjs missing — run build first')
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const wrapper = fs.readFileSync(wrapperPath, 'utf8')
|
|
141
|
+
const generated = fs.readFileSync(generatedPath, 'utf8')
|
|
142
|
+
const names = parseNamedExportBlock(wrapper)
|
|
143
|
+
|
|
144
|
+
for (const name of names) {
|
|
145
|
+
const provides = new RegExp(`\\b${name}\\b`).test(generated)
|
|
146
|
+
if (!provides) {
|
|
147
|
+
throw new PublishGuardError(
|
|
148
|
+
`x/bin/helpers/tmp-schema.mjs re-exports '${name}' but .generated/tmp-schema.mjs does not provide it — run xry build`,
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
124
154
|
export function runPublishGuards(root = process.cwd(), { strictDisk = false } = {}) {
|
|
125
155
|
const pkg = readPackage(root)
|
|
126
156
|
assertFilesListNoSource(pkg)
|
|
127
157
|
assertFilesListHasDist(pkg)
|
|
128
158
|
assertMainExportsPointToDist(pkg)
|
|
159
|
+
assertCliGeneratedExports(root)
|
|
129
160
|
assertDistTree(root)
|
|
130
161
|
assertNpmPackClean(root)
|
|
131
162
|
if (strictDisk) {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
project:
|
|
2
|
+
name: "{{xry}}"
|
|
3
|
+
|
|
4
|
+
configs:
|
|
5
|
+
global:
|
|
6
|
+
type: api-service
|
|
7
|
+
runtime: bun
|
|
8
|
+
framework: elysia
|
|
9
|
+
paths:
|
|
10
|
+
root: ./x
|
|
11
|
+
tmp: tmp.yml
|
|
12
|
+
source: ./source
|
|
13
|
+
special:
|
|
14
|
+
tests: tests
|
|
15
|
+
environments: environments
|
|
16
|
+
dist: dist
|
|
17
|
+
vars:
|
|
18
|
+
xry: xry
|
|
19
|
+
build:
|
|
20
|
+
bundler: auto
|
|
21
|
+
typecheck: false
|
|
22
|
+
tscLenient: true
|
|
23
|
+
options:
|
|
24
|
+
fileWatchIntervalMs: 500
|
|
25
|
+
|
|
26
|
+
depends:
|
|
27
|
+
protocols:
|
|
28
|
+
- http
|
|
29
|
+
- ws
|
|
30
|
+
loaders:
|
|
31
|
+
configs:
|
|
32
|
+
loadPath: '@/utils/helpers/configs/index'
|
|
33
|
+
system:
|
|
34
|
+
gStore:
|
|
35
|
+
options:
|
|
36
|
+
bootstrap: true
|
|
37
|
+
autoCreateProps: true
|
|
38
|
+
vars:
|
|
39
|
+
test: false
|
|
40
|
+
kafka:
|
|
41
|
+
options:
|
|
42
|
+
enabled: true
|
|
43
|
+
queueLogEnabled: true
|
|
44
|
+
loggers:
|
|
45
|
+
loadPath: logs
|
|
46
|
+
logLevel: debug
|
|
47
|
+
queueLogLevel: warn
|
|
48
|
+
localization:
|
|
49
|
+
loadPath: assets/langs
|
|
50
|
+
fallbackLang: en
|
|
51
|
+
preloadLangs:
|
|
52
|
+
- en
|
|
53
|
+
- tr
|
|
54
|
+
dto:
|
|
55
|
+
withDefaultHeaders: true
|
|
56
|
+
controller:
|
|
57
|
+
|
|
58
|
+
end:
|
|
59
|
+
version: 1
|