@blod-nm/user-kit 0.1.2 → 0.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blod-nm/user-kit",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "CloudBase user-center kit: auth (wechat code / unionid / password / sms / email / signup) + crm_user_detail archive on @blod-nm/base-cb.",
package/src/auth.js CHANGED
@@ -178,8 +178,10 @@ export function createAuthAbilities(cfg, kit) {
178
178
  } }],
179
179
 
180
180
  ['auth.signup', { describe: '注册(手机/邮箱/provider_token 三形态):POST /auth/v1/signup,响应原样+补 uid+建档', run: async (args = {}) => {
181
- if (!args?.verification_token) throw err(400, 'verification_token 必填')
182
- if (!args?.phone_number && !args?.email && !args?.provider_token) throw err(400, 'phone_number/email/provider_token 必填其一')
181
+ // 三种形态:手机号+验证码 / 邮箱+验证码 / provider_token(第三方授权注册)
182
+ const codePath = !!(args?.phone_number || args?.email)
183
+ if (codePath && !args?.verification_token) throw err(400, 'verification_token 必填')
184
+ if (!codePath && !args?.provider_token) throw err(400, 'phone_number/email/provider_token 必填其一')
183
185
  const payload = await gw('POST', '/auth/v1/signup', { body: args })
184
186
  const uid = uidOfPayload(payload)
185
187
  if (!uid) throw err(500, '用户注册失败')
package/src/schemas.js CHANGED
@@ -75,14 +75,18 @@ export const SCHEMAS = {
75
75
  'auth.signup': {
76
76
  title: '注册',
77
77
  inputSchema: obj({
78
- phone_number: str('手机号(与 email 二选一)'),
79
- email: str('邮箱(与 phone_number 二选一)'),
80
- verification_token: str('验证码令牌(必填)'),
78
+ phone_number: str('手机号(与 email / provider_token 三选一)'),
79
+ email: str('邮箱(与 phone_number / provider_token 三选一)'),
80
+ provider_token: str('第三方 provider_token(三选一;与验证码方式互斥)'),
81
+ verification_token: str('验证码令牌(手机/邮箱注册时必填;provider_token 方式不需要)'),
81
82
  username: str('用户名(可选)'),
82
83
  password: str('密码(可选)'),
83
84
  }, {
84
- required: ['verification_token'],
85
- anyOf: [{ required: ['phone_number'] }, { required: ['email'] }],
85
+ anyOf: [
86
+ { required: ['verification_token', 'phone_number'] },
87
+ { required: ['verification_token', 'email'] },
88
+ { required: ['provider_token'] },
89
+ ],
86
90
  }),
87
91
  outputSchema: obj({ uid: str('唯一用户 id(必返)'), access_token: str('访问令牌(必返)') }, { required: ['uid', 'access_token'] }),
88
92
  annotations: { openWorldHint: true },
@@ -162,9 +166,11 @@ export const SCHEMAS = {
162
166
  title: '读取档案',
163
167
  inputSchema: obj({ uid: str('唯一用户 id(必填)') }, { required: ['uid'], additionalProperties: false }),
164
168
  outputSchema: {
165
- type: ['object', 'null'],
166
- description: '档案行;不存在时为 null',
169
+ // MCP SDK 要求 outputSchema 根类型字面 "object";无行时 content 文本为 null、structuredContent 省略
170
+ type: 'object',
171
+ description: '档案行(无行时 structuredContent 省略,content 文本为 null)',
167
172
  properties: { id: str('档案行 id'), data: { type: 'object' }, status: str('状态'), deleted_at: { type: ['string', 'null'] } },
173
+ additionalProperties: true,
168
174
  },
169
175
  annotations: { readOnlyHint: true },
170
176
  },