@xrystal/core 3.52.1 → 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.0` · [npm](https://www.npmjs.com/package/@xrystal/core)
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.0**).
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.0**).
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.0` |
19
- | `api-cron-svc` | `crons` | Scheduled jobs / Kafka queue worker | `0.1.25` | `3.52.0` |
20
- | `api-gateway-svc` | `gateway` | Edge gateway, routing, cache, Mongo config | `2.0.49` | `3.52.0` |
21
- | `api-gpt-svc` | `gpt` | GPT / AI features | `1.0.22` | `3.52.0` |
22
- | `api-iam-svc` | `iam` | Identity & access management | `0.7.26` | `3.52.0` |
23
- | `api-log-svc` | `log` | Logging service | `1.0.20` | `3.52.0` |
24
- | `api-websocket-svc` | `websocket` | WebSocket / realtime | `0.8.31` | `3.52.0` |
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.0
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.1",
4
+ "version": "3.52.2",
5
5
  "description": "microservice runtime library",
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -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
- listRegistryProjects,
8
- readRegistry,
9
- resolveXrystalHome,
10
- syncRegistryFromPath,
11
- } from '../helpers/xrystal-registry.mjs'
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('List workspaces and projects registered under ~/.xrystal')
17
- .option('--sync', 'Rescan current workspace before listing')
18
- .action((options) => {
19
- printCommandHeader({ cliName, command: 'projects', version: readCliPackageJson().version })
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
- if (options.sync) {
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
- const registry = readRegistry()
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 + linked projects)' },
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) {