{"_id":"@azu12138/center-registry","name":"@azu12138/center-registry","dist-tags":{"latest":"0.2.0"},"versions":{"0.2.0":{"name":"@azu12138/center-registry","version":"0.2.0","description":"Center Registry gRPC lifecycle SDK","license":"UNLICENSED","repository":{"type":"git","url":"git+https://github.com/azustack/xiaoming-center.git","directory":"packages/center-registry"},"publishConfig":{"registry":"https://registry.npmjs.org","access":"public"},"engines":{"node":">=20","bun":">=1.3.14"},"type":"module","sideEffects":false,"main":"./dist/cjs/index.cjs","module":"./dist/esm/index.js","types":"./dist/types/index.d.ts","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.cjs"},"./grpc":{"types":"./dist/types/grpc.d.ts","import":"./dist/esm/grpc.js","require":"./dist/cjs/grpc.cjs"},"./signature":{"types":"./dist/types/signature.d.ts","import":"./dist/esm/signature.js","require":"./dist/cjs/signature.cjs"},"./contract":{"types":"./dist/types/contract.d.ts","import":"./dist/esm/contract.js","require":"./dist/cjs/contract.cjs"},"./proto/center-registry.proto":"./proto/center-registry.proto"},"scripts":{"build":"tsup","typecheck":"tsc --noEmit","test":"npm run build && node --test test/*.test.mjs","pack:check":"npm pack --dry-run"},"dependencies":{"@grpc/grpc-js":"^1.14.4","@grpc/proto-loader":"^0.8.1"},"devDependencies":{"@types/node":"^22.15.3","tsup":"^8.5.0","typescript":"^5.8.3"},"gitHead":"ca143cd66f142888cdec69907f13e99970ba468f","_id":"@azu12138/center-registry@0.2.0","bugs":{"url":"https://github.com/azustack/xiaoming-center/issues"},"homepage":"https://github.com/azustack/xiaoming-center#readme","_nodeVersion":"24.14.0","_npmVersion":"11.9.0","dist":{"integrity":"sha512-rATw6irLqT5ggr0yw1rTC0AxOtQBDg/1oSpiElYFNdDyqfuW44HypMmzrNN48L8oRHmkDjHC/fFJqjt6hyTv5w==","shasum":"8e84206a1670c845347bf9f85ce24cc9e09f3671","tarball":"https://registry.npmjs.org/@azu12138/center-registry/-/center-registry-0.2.0.tgz","fileCount":16,"unpackedSize":109432,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDx23IGaLinM96h1CXZRxqFlPG2qK0DLHxRAkAcRfc5oAiAcGz62Vs+wLcVHPDCkVmsauZAtM2DSRZi3VEKjZRsFGg=="}]},"_npmUser":{"name":"azu12138","email":"cenyaozu@126.com"},"directories":{},"maintainers":[{"name":"azu12138","email":"cenyaozu@126.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/center-registry_0.2.0_1785749988189_0.8255974182767605"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-03T09:39:48.032Z","0.2.0":"2026-08-03T09:39:48.338Z","modified":"2026-08-03T09:39:48.516Z"},"maintainers":[{"name":"azu12138","email":"cenyaozu@126.com"}],"description":"Center Registry gRPC lifecycle SDK","homepage":"https://github.com/azustack/xiaoming-center#readme","repository":{"type":"git","url":"git+https://github.com/azustack/xiaoming-center.git","directory":"packages/center-registry"},"bugs":{"url":"https://github.com/azustack/xiaoming-center/issues"},"license":"UNLICENSED","readme":"# @azu12138/center-registry\n\nPublicly downloadable, `UNLICENSED` Node.js and Bun SDK for registering a service with Wanxiang Xiaoer Center over the existing `xiaoming.center.v1.CenterRegistry` gRPC contract.\n\n## Install\n\nInstall the exact public npm version without a registry credential:\n\n```bash\nnpm install @azu12138/center-registry@0.2.0\n```\n\nCenter registration credentials are runtime service values and are never npm\npackage credentials.\n\n## Register a service\n\n```ts\nimport { createCenterRegistration } from \"@azu12138/center-registry\";\n\nconst registration = createCenterRegistration({\n  connection: {\n    target: process.env.CENTER_REGISTRY_ADDRESS!,\n    serviceToken: process.env.CENTER_REGISTRY_SERVICE_TOKEN!,\n    signingSecret: process.env.CENTER_REGISTRY_SIGNING_SECRET!,\n    requestTimeoutMs: 5_000,\n  },\n  service: {\n    serviceId: \"runtime:runtime-001\",\n    serviceCode: \"xiaoming-runtime\",\n    serviceType: \"runtime\",\n    environment: \"production\",\n    instanceId: \"runtime-001\",\n    runtimeId: \"runtime-001\",\n    host: \"xiaoming-runtime\",\n    version: \"1.0.0\",\n    endpoints: [\n      {\n        name: \"voice-websocket\",\n        protocol: \"ws\",\n        host: \"xiaoming-runtime\",\n        port: 18_003,\n        path: \"/internal/voice/ws\",\n      },\n    ],\n    capabilities: [\"chat\", \"voice\"],\n    metadata: {},\n    ttlMs: 60_000,\n    maxConnections: 100,\n  },\n  lifecycle: {\n    heartbeatIntervalMs: 30_000,\n    retryIntervalMs: 5_000,\n    getActiveConnections: () => voiceEngine.activeConnectionCount,\n  },\n  onStateChange: (snapshot) => runtimeHealth.updateCenter(snapshot),\n});\n\nawait registration.start();\n\n// During ordered shutdown, stop new work before deregistering.\nawait registration.stop();\n```\n\n`start()` and `stop()` are idempotent. A missing or expired instance triggers a complete re-registration. Authentication, signature, configuration, and protocol failures are not retried; transient transport failures are retried while state remains `degraded`.\n\n## Subpath exports\n\n- `@azu12138/center-registry`: lifecycle API and sanitized error types.\n- `@azu12138/center-registry/grpc`: raw gRPC transport and packaged protobuf loader.\n- `@azu12138/center-registry/signature`: Center-owned signature constants and helpers.\n- `@azu12138/center-registry/contract`: runtime DTOs and protocol constants.\n\nThe package supports ESM and CommonJS on Node.js 20 or newer and Bun 1.3.14 or newer.\n","readmeFilename":"README.md","_rev":"1-2215b4a258509353a4e7abe3b4ad977b"}