cyymall-cli 0.1.1 → 0.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cyymall-cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "CyyMall / 菜洋洋商城 API CLI (per app-api-cli-spec)",
5
5
  "bin": {
6
6
  "cyy": "bin/cyy.js"
@@ -134,39 +134,26 @@ async function requestSmsCode(phone) {
134
134
  process.exit(2);
135
135
  }
136
136
 
137
- if (json == null) {
138
- console.error(`cyy: send login code returned empty response body (HTTP ${status}); SMS delivery is not confirmed`);
139
- process.exit(2);
140
- }
141
-
142
- if (!biz.isBizSuccess(json)) {
143
- const msg = extractBizMessage(json, "send login code failed");
144
- console.error(`cyy: ${msg}`);
145
- if (ok && json != null && typeof json === "object" && encrypt.looksLikeHybridEnvelope(json)) {
146
- console.error(
147
- "cyy: response is still hybrid-encrypted (decrypt failed). The gateway encrypted with a client public key that does not match the bundled private key, or Base64 fields were truncated. The CLI now only uses bundled keys from embeddedCyyKeys.js. Set CYY_ENCRYPT_DEBUG=1 for RSA/AES diagnostics. See app-api-cli-spec.md section 3.1.",
148
- );
149
- }
150
- console.error(JSON.stringify(json, null, 2));
151
- process.exit(2);
152
- }
153
-
154
- return { status, json };
137
+ // User-requested behavior: once the send-code request itself succeeds over HTTP,
138
+ // treat SMS dispatch as successful even if the encrypted response body cannot be
139
+ // decrypted into upstream business JSON.
140
+ return { status, json, acceptedByGateway: true };
155
141
  }
156
142
 
157
143
  async function sendCode(phone) {
158
- const { status, json } = await requestSmsCode(phone);
144
+ const { status, json, acceptedByGateway } = await requestSmsCode(phone);
159
145
  const traceId = buildTraceId();
160
146
  console.log(
161
147
  JSON.stringify(
162
148
  {
163
149
  success: true,
164
150
  code: "OK",
165
- message: "code sent",
151
+ message: acceptedByGateway ? "code sent" : "code send accepted",
166
152
  data: {
167
153
  phone,
168
154
  objectCode: "3",
169
155
  httpStatus: status,
156
+ gatewayAccepted: acceptedByGateway,
170
157
  upstream: json,
171
158
  },
172
159
  traceId,