cloud189-sdk 1.0.6-alpha.4 → 1.0.6-alpha.6

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.
@@ -1,12 +1,9 @@
1
1
  import { Got } from 'got';
2
- import { UserSignResponse, UserSizeInfoResponse, FamilyListResponse, FamilyUserSignResponse, ConfigurationOptions, ClientSession, RefreshTokenSession, TokenSession } from './types';
2
+ import { UserSignResponse, UserSizeInfoResponse, FamilyListResponse, FamilyUserSignResponse, ConfigurationOptions, ClientSession, RefreshTokenSession, TokenSession, CacheQuery } from './types';
3
3
  import { Store } from './store';
4
- interface CacheQuery {
5
- captchaToken: string;
6
- reqId: string;
7
- lt: string;
8
- paramId: string;
9
- }
4
+ /**
5
+ * @public
6
+ */
10
7
  export declare class CloudAuthClient {
11
8
  #private;
12
9
  readonly request: Got;
@@ -34,6 +31,10 @@ export declare class CloudAuthClient {
34
31
  * token登录
35
32
  */
36
33
  loginByAccessToken(accessToken: string): Promise<TokenSession>;
34
+ /**
35
+ * sso登录
36
+ */
37
+ loginBySsoCooike(cookie: string): Promise<TokenSession>;
37
38
  /**
38
39
  * 刷新token
39
40
  */
@@ -47,12 +48,17 @@ export declare class CloudClient {
47
48
  #private;
48
49
  username: string;
49
50
  password: string;
51
+ ssonCookie: string;
50
52
  tokenStore: Store;
51
53
  readonly request: Got;
52
54
  readonly authClient: CloudAuthClient;
53
55
  readonly session: ClientSession;
54
56
  constructor(_options: ConfigurationOptions);
55
57
  getSession(): Promise<TokenSession>;
58
+ /**
59
+ * 获取 sessionKey
60
+ * @returns sessionKey
61
+ */
56
62
  getSessionKey(): Promise<string>;
57
63
  /**
58
64
  * 获取 accessToken
@@ -81,4 +87,3 @@ export declare class CloudClient {
81
87
  */
82
88
  familyUserSign(familyId: number): Promise<FamilyUserSignResponse>;
83
89
  }
84
- export {};
@@ -4,10 +4,16 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
5
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
6
  };
7
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8
+ if (kind === "m") throw new TypeError("Private method is not writable");
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
11
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12
+ };
7
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
8
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
9
15
  };
10
- var _CloudAuthClient_builLoginForm, _CloudClient_instances, _CloudClient_valid, _CloudClient_getAccessTokenBySsKey;
16
+ var _CloudAuthClient_builLoginForm, _CloudClient_instances, _CloudClient_sessionKeyPromise, _CloudClient_accessTokenPromise, _CloudClient_valid, _CloudClient_getAccessTokenBySsKey;
11
17
  Object.defineProperty(exports, "__esModule", { value: true });
12
18
  exports.CloudClient = exports.CloudAuthClient = void 0;
13
19
  const url_1 = __importDefault(require("url"));
@@ -16,11 +22,15 @@ const log_1 = require("./log");
16
22
  const util_1 = require("./util");
17
23
  const const_1 = require("./const");
18
24
  const store_1 = require("./store");
25
+ const error_1 = require("./error");
19
26
  const config = {
20
27
  clientId: '538135150693412',
21
28
  model: 'KB2000',
22
29
  version: '9.0.6'
23
30
  };
31
+ /**
32
+ * @public
33
+ */
24
34
  class CloudAuthClient {
25
35
  constructor() {
26
36
  _CloudAuthClient_builLoginForm.set(this, (encrypt, appConf, username, password) => {
@@ -53,6 +63,7 @@ class CloudAuthClient {
53
63
  afterResponse: [
54
64
  async (response, retryWithMergedOptions) => {
55
65
  log_1.log.debug(`url: ${response.requestUrl}, response: ${response.body})}`);
66
+ (0, error_1.checkError)(response.body.toString());
56
67
  return response;
57
68
  }
58
69
  ]
@@ -120,9 +131,6 @@ class CloudAuthClient {
120
131
  form: data
121
132
  })
122
133
  .json();
123
- if (loginRes.result !== 0) {
124
- throw new Error(loginRes.msg);
125
- }
126
134
  return await this.getSessionForPC({ redirectURL: loginRes.toUrl });
127
135
  }
128
136
  catch (e) {
@@ -137,6 +145,26 @@ class CloudAuthClient {
137
145
  log_1.log.debug('loginByAccessToken...');
138
146
  return await this.getSessionForPC({ accessToken });
139
147
  }
148
+ /**
149
+ * sso登录
150
+ */
151
+ async loginBySsoCooike(cookie) {
152
+ log_1.log.debug('loginBySsoCooike...');
153
+ const res = await this.request.get(`${const_1.WEB_URL}/api/portal/unifyLoginForPC.action`, {
154
+ searchParams: {
155
+ appId: const_1.AppID,
156
+ clientType: const_1.ClientType,
157
+ returnURL: const_1.ReturnURL,
158
+ timeStamp: Date.now()
159
+ }
160
+ });
161
+ const redirect = await this.request(res.url, {
162
+ headers: {
163
+ Cookie: `SSON=${cookie}`
164
+ }
165
+ });
166
+ return await this.getSessionForPC({ redirectURL: redirect.url });
167
+ }
140
168
  /**
141
169
  * 刷新token
142
170
  */
@@ -162,6 +190,8 @@ _CloudAuthClient_builLoginForm = new WeakMap();
162
190
  class CloudClient {
163
191
  constructor(_options) {
164
192
  _CloudClient_instances.add(this);
193
+ _CloudClient_sessionKeyPromise.set(this, void 0);
194
+ _CloudClient_accessTokenPromise.set(this, void 0);
165
195
  _CloudClient_valid.set(this, (options) => {
166
196
  if (!options.token && (!options.username || !options.password)) {
167
197
  log_1.log.error('valid');
@@ -171,6 +201,7 @@ class CloudClient {
171
201
  __classPrivateFieldGet(this, _CloudClient_valid, "f").call(this, _options);
172
202
  this.username = _options.username;
173
203
  this.password = _options.password;
204
+ this.ssonCookie = _options.ssonCookie;
174
205
  this.tokenStore = _options.token || new store_1.MemoryStore();
175
206
  this.authClient = new CloudAuthClient();
176
207
  this.session = {
@@ -183,7 +214,8 @@ class CloudClient {
183
214
  },
184
215
  headers: {
185
216
  'User-Agent': const_1.UserAgent,
186
- Referer: `${const_1.WEB_URL}/web/main/`
217
+ Referer: `${const_1.WEB_URL}/web/main/`,
218
+ Accept: 'application/json;charset=UTF-8'
187
219
  },
188
220
  hooks: {
189
221
  beforeRequest: [
@@ -197,7 +229,6 @@ class CloudClient {
197
229
  options.headers['Signature'] = signature;
198
230
  options.headers['Timestamp'] = time;
199
231
  options.headers['Accesstoken'] = accessToken;
200
- options.headers['Accept'] = 'application/json;charset=UTF-8';
201
232
  }
202
233
  else if (options.url.href.includes(const_1.WEB_URL)) {
203
234
  const urlObj = new URL(options.url);
@@ -241,24 +272,40 @@ class CloudClient {
241
272
  });
242
273
  }
243
274
  async getSession() {
244
- const accessToken = await this.tokenStore.getAccessToken();
245
- if (accessToken) {
275
+ const { accessToken, expiresIn, refreshToken } = await this.tokenStore.get();
276
+ if (accessToken && expiresIn && expiresIn > Date.now()) {
246
277
  try {
247
278
  return await this.authClient.loginByAccessToken(accessToken);
248
279
  }
249
280
  catch (e) {
250
- log_1.log.error(e);
281
+ log_1.log.debug(e);
251
282
  }
252
283
  }
253
- const refreshToken = await this.tokenStore.getRefreshToken();
254
284
  if (refreshToken) {
255
285
  try {
256
286
  const refreshTokenSession = await this.authClient.refreshToken(refreshToken);
257
- await this.tokenStore.updateAccessToken(refreshTokenSession.accessToken);
287
+ await this.tokenStore.update({
288
+ accessToken: refreshTokenSession.accessToken,
289
+ expiresIn: new Date(Date.now() + refreshTokenSession.expiresIn * 1000).getTime()
290
+ });
258
291
  return await this.authClient.loginByAccessToken(refreshTokenSession.accessToken);
259
292
  }
260
293
  catch (e) {
261
- log_1.log.error(e);
294
+ log_1.log.debug(e);
295
+ }
296
+ }
297
+ if (this.ssonCookie) {
298
+ try {
299
+ const loginToken = await this.authClient.loginBySsoCooike(this.ssonCookie);
300
+ await this.tokenStore.update({
301
+ accessToken: loginToken.accessToken,
302
+ refreshToken: loginToken.refreshToken,
303
+ expiresIn: new Date(Date.now() + 8640 * 1000).getTime()
304
+ });
305
+ return loginToken;
306
+ }
307
+ catch (e) {
308
+ log_1.log.debug(e);
262
309
  }
263
310
  }
264
311
  if (this.username && this.password) {
@@ -266,42 +313,65 @@ class CloudClient {
266
313
  const loginToken = await this.authClient.loginByPassword(this.username, this.password);
267
314
  await this.tokenStore.update({
268
315
  accessToken: loginToken.accessToken,
269
- refreshToken: loginToken.refreshToken
316
+ refreshToken: loginToken.refreshToken,
317
+ expiresIn: new Date(Date.now() + 8640 * 1000).getTime()
270
318
  });
271
319
  return loginToken;
272
320
  }
273
321
  catch (e) {
274
- log_1.log.error(e);
322
+ log_1.log.debug(e);
275
323
  }
276
324
  }
277
325
  throw new Error('Can not get session.');
278
326
  }
327
+ /**
328
+ * 获取 sessionKey
329
+ * @returns sessionKey
330
+ */
279
331
  async getSessionKey() {
280
- if (!this.session.sessionKey) {
281
- this.session.sessionKey = (await this.getSession()).sessionKey;
332
+ if (this.session.sessionKey) {
333
+ return this.session.sessionKey;
282
334
  }
283
- return this.session.sessionKey;
335
+ if (!__classPrivateFieldGet(this, _CloudClient_sessionKeyPromise, "f")) {
336
+ __classPrivateFieldSet(this, _CloudClient_sessionKeyPromise, this.getSession()
337
+ .then((result) => {
338
+ this.session.sessionKey = result.sessionKey;
339
+ return result;
340
+ })
341
+ .finally(() => {
342
+ __classPrivateFieldSet(this, _CloudClient_sessionKeyPromise, null, "f");
343
+ }), "f");
344
+ }
345
+ const result = await __classPrivateFieldGet(this, _CloudClient_sessionKeyPromise, "f");
346
+ return result.sessionKey;
284
347
  }
285
348
  /**
286
349
  * 获取 accessToken
287
350
  * @returns accessToken
288
351
  */
289
352
  async getAccessToken() {
290
- if (!this.session.accessToken) {
291
- this.session.accessToken = (await __classPrivateFieldGet(this, _CloudClient_instances, "m", _CloudClient_getAccessTokenBySsKey).call(this)).accessToken;
353
+ if (this.session.accessToken) {
354
+ return this.session.accessToken;
292
355
  }
293
- return this.session.accessToken;
356
+ if (!__classPrivateFieldGet(this, _CloudClient_accessTokenPromise, "f")) {
357
+ __classPrivateFieldSet(this, _CloudClient_accessTokenPromise, __classPrivateFieldGet(this, _CloudClient_instances, "m", _CloudClient_getAccessTokenBySsKey).call(this)
358
+ .then((result) => {
359
+ this.session.accessToken = result.accessToken;
360
+ return result;
361
+ })
362
+ .finally(() => {
363
+ __classPrivateFieldSet(this, _CloudClient_accessTokenPromise, null, "f");
364
+ }), "f");
365
+ }
366
+ const result = await __classPrivateFieldGet(this, _CloudClient_accessTokenPromise, "f");
367
+ return result.accessToken;
294
368
  }
295
369
  /**
296
370
  * 获取用户网盘存储容量信息
297
371
  * @returns 账号容量结果
298
372
  */
299
373
  getUserSizeInfo() {
300
- return this.request
301
- .get(`${const_1.WEB_URL}/api/portal/getUserSizeInfo.action`, {
302
- headers: { Accept: 'application/json;charset=UTF-8' }
303
- })
304
- .json();
374
+ return this.request.get(`${const_1.WEB_URL}/api/portal/getUserSizeInfo.action`).json();
305
375
  }
306
376
  /**
307
377
  * 个人签到任务
@@ -331,6 +401,6 @@ class CloudClient {
331
401
  }
332
402
  }
333
403
  exports.CloudClient = CloudClient;
334
- _CloudClient_valid = new WeakMap(), _CloudClient_instances = new WeakSet(), _CloudClient_getAccessTokenBySsKey = function _CloudClient_getAccessTokenBySsKey() {
404
+ _CloudClient_sessionKeyPromise = new WeakMap(), _CloudClient_accessTokenPromise = new WeakMap(), _CloudClient_valid = new WeakMap(), _CloudClient_instances = new WeakSet(), _CloudClient_getAccessTokenBySsKey = function _CloudClient_getAccessTokenBySsKey() {
335
405
  return this.request.get(`${const_1.WEB_URL}/api/open/oauth2/getAccessTokenBySsKey.action`).json();
336
406
  };
@@ -0,0 +1,5 @@
1
+ export declare class InvalidRefreshTokenError extends Error {
2
+ }
3
+ export declare class AuthApiError extends Error {
4
+ }
5
+ export declare const checkError: (response: any) => void;
package/dist/error.js ADDED
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkError = exports.AuthApiError = exports.InvalidRefreshTokenError = void 0;
4
+ class InvalidRefreshTokenError extends Error {
5
+ }
6
+ exports.InvalidRefreshTokenError = InvalidRefreshTokenError;
7
+ class AuthApiError extends Error {
8
+ }
9
+ exports.AuthApiError = AuthApiError;
10
+ const checkError = (response) => {
11
+ let res;
12
+ try {
13
+ res = JSON.parse(response);
14
+ }
15
+ catch (e) {
16
+ return;
17
+ }
18
+ // auth
19
+ if ('result' in res && 'msg' in res) {
20
+ switch (res.result) {
21
+ case 0:
22
+ return;
23
+ case -117:
24
+ throw new InvalidRefreshTokenError(res.msg);
25
+ default:
26
+ throw new AuthApiError(res.msg);
27
+ }
28
+ }
29
+ };
30
+ exports.checkError = checkError;
package/dist/log.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  /// <reference types="node" />
2
2
  import WritableStream = NodeJS.WritableStream;
3
- export declare const debug: boolean;
4
3
  export interface Fields {
5
4
  [index: string]: any;
6
5
  }
package/dist/log.js CHANGED
@@ -3,10 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.log = exports.Logger = exports.PADDING = exports.debug = void 0;
6
+ exports.log = exports.Logger = exports.PADDING = void 0;
7
7
  const chalk_1 = __importDefault(require("chalk"));
8
8
  let printer = null;
9
- exports.debug = process.env.CLOUD189_VERBOSE === '1';
10
9
  exports.PADDING = 2;
11
10
  class Logger {
12
11
  constructor(stream) {
@@ -14,7 +13,7 @@ class Logger {
14
13
  this.messageTransformer = (it) => it;
15
14
  }
16
15
  get isDebugEnabled() {
17
- return exports.debug;
16
+ return process.env.CLOUD189_VERBOSE == '1';
18
17
  }
19
18
  info(messageOrFields, message) {
20
19
  this.doLog(message, messageOrFields, 'info');
@@ -1,12 +1,14 @@
1
1
  import { MemoryStore } from './memstore';
2
+ /**
3
+ * @public
4
+ */
2
5
  export declare class FileTokenStore extends MemoryStore {
3
6
  #private;
4
7
  filePath: string;
5
8
  constructor(filePath: string);
6
- updateAccessToken(accessToken: string): Promise<void>;
7
- updateRefreshToken(refreshToken: string): Promise<void>;
8
9
  update(token: {
9
10
  accessToken: string;
10
- refreshToken: string;
11
+ refreshToken?: string;
12
+ expiresIn?: number;
11
13
  }): Promise<void>;
12
14
  }
@@ -33,6 +33,9 @@ exports.FileTokenStore = void 0;
33
33
  const fs = __importStar(require("node:fs"));
34
34
  const promisesFs = __importStar(require("node:fs/promises"));
35
35
  const memstore_1 = require("./memstore");
36
+ /**
37
+ * @public
38
+ */
36
39
  class FileTokenStore extends memstore_1.MemoryStore {
37
40
  constructor(filePath) {
38
41
  super();
@@ -46,14 +49,6 @@ class FileTokenStore extends memstore_1.MemoryStore {
46
49
  super.update(dataJson);
47
50
  }
48
51
  }
49
- updateAccessToken(accessToken) {
50
- super.updateAccessToken(accessToken);
51
- return __classPrivateFieldGet(this, _FileTokenStore_instances, "m", _FileTokenStore_saveToFile).call(this, this.filePath, this.store);
52
- }
53
- updateRefreshToken(refreshToken) {
54
- super.updateRefreshToken(refreshToken);
55
- return __classPrivateFieldGet(this, _FileTokenStore_instances, "m", _FileTokenStore_saveToFile).call(this, this.filePath, this.store);
56
- }
57
52
  update(token) {
58
53
  super.update(token);
59
54
  return __classPrivateFieldGet(this, _FileTokenStore_instances, "m", _FileTokenStore_saveToFile).call(this, this.filePath, this.store);
@@ -1,16 +1,22 @@
1
1
  import { Store } from './store';
2
+ /**
3
+ * @public
4
+ */
2
5
  export declare class MemoryStore extends Store {
3
6
  store: {
4
7
  accessToken: string;
5
8
  refreshToken: string;
9
+ expiresIn: number;
6
10
  };
7
11
  constructor();
8
- getAccessToken(): Promise<string>;
9
- updateAccessToken(accessToken: string): Promise<void>;
10
- updateRefreshToken(refreshToken: string): Promise<void>;
11
- getRefreshToken(): Promise<string>;
12
- update(token: {
12
+ get(): {
13
13
  accessToken: string;
14
14
  refreshToken: string;
15
+ expiresIn: number;
16
+ };
17
+ update(token: {
18
+ accessToken: string;
19
+ refreshToken?: string;
20
+ expiresIn?: number;
15
21
  }): void;
16
22
  }
@@ -2,32 +2,27 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MemoryStore = void 0;
4
4
  const store_1 = require("./store");
5
+ /**
6
+ * @public
7
+ */
5
8
  class MemoryStore extends store_1.Store {
6
9
  constructor() {
7
10
  super();
8
11
  this.store = {
9
12
  accessToken: '',
10
- refreshToken: ''
13
+ refreshToken: '',
14
+ expiresIn: 0
11
15
  };
12
16
  }
13
- getAccessToken() {
14
- return Promise.resolve(this.store.accessToken);
15
- }
16
- updateAccessToken(accessToken) {
17
- this.store.accessToken = accessToken;
18
- return Promise.resolve();
19
- }
20
- updateRefreshToken(refreshToken) {
21
- this.store.refreshToken = refreshToken;
22
- return Promise.resolve();
23
- }
24
- getRefreshToken() {
25
- return Promise.resolve(this.store.refreshToken);
17
+ get() {
18
+ return this.store;
26
19
  }
27
20
  update(token) {
21
+ var _a, _b;
28
22
  this.store = {
29
23
  accessToken: token.accessToken,
30
- refreshToken: token.refreshToken
24
+ refreshToken: (_a = token.refreshToken) !== null && _a !== void 0 ? _a : this.store.refreshToken,
25
+ expiresIn: (_b = token.expiresIn) !== null && _b !== void 0 ? _b : this.store.expiresIn
31
26
  };
32
27
  }
33
28
  }
@@ -1,11 +1,20 @@
1
- export declare class Store {
1
+ /**
2
+ * @public
3
+ */
4
+ export declare abstract class Store {
2
5
  constructor();
3
- getAccessToken(): Promise<string | undefined>;
4
- getRefreshToken(): Promise<string | undefined>;
5
- updateRefreshToken(refreshToken: string): Promise<void>;
6
- updateAccessToken(accessToken: string): Promise<void>;
7
- update(token: {
6
+ abstract get(): {
8
7
  accessToken: string;
9
8
  refreshToken: string;
10
- }): any;
9
+ expiresIn: number;
10
+ } | Promise<{
11
+ accessToken: string;
12
+ refreshToken: string;
13
+ expiresIn: number;
14
+ }>;
15
+ abstract update(token: {
16
+ accessToken: string;
17
+ refreshToken?: string;
18
+ expiresIn?: number;
19
+ }): void | Promise<void>;
11
20
  }
@@ -1,22 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Store = void 0;
4
+ /**
5
+ * @public
6
+ */
4
7
  class Store {
5
8
  constructor() { }
6
- getAccessToken() {
7
- throw new Error('getAccessToken is not implemented');
8
- }
9
- getRefreshToken() {
10
- throw new Error('getRefreshToken is not implemented');
11
- }
12
- updateRefreshToken(refreshToken) {
13
- throw new Error('updateRefreshToken is not implemented');
14
- }
15
- updateAccessToken(accessToken) {
16
- throw new Error('updateAccessToken is not implemented');
17
- }
18
- update(token) {
19
- throw new Error('update is not implemented');
20
- }
21
9
  }
22
10
  exports.Store = Store;
package/dist/types.d.ts CHANGED
@@ -125,6 +125,15 @@ export interface UserTaskResponse {
125
125
  */
126
126
  prizeName: string;
127
127
  }
128
+ /**
129
+ * @public
130
+ */
131
+ export interface CacheQuery {
132
+ captchaToken: string;
133
+ reqId: string;
134
+ lt: string;
135
+ paramId: string;
136
+ }
128
137
  /**
129
138
  * 客户端初始化参数
130
139
  * @public
@@ -134,9 +143,12 @@ export interface ConfigurationOptions {
134
143
  username?: string;
135
144
  /** 密码 */
136
145
  password?: string;
146
+ /** token */
137
147
  token?: Store;
148
+ ssonCookie?: string;
138
149
  }
139
150
  /**
151
+ * @public
140
152
  * accessToken 有效期7天,可以通过refreshToken取新的accessToken
141
153
  */
142
154
  export interface TokenSession {
@@ -149,11 +161,17 @@ export interface TokenSession {
149
161
  loginName: string;
150
162
  sessionKey: string;
151
163
  }
164
+ /**
165
+ * @public
166
+ */
152
167
  export interface RefreshTokenSession {
153
168
  expiresIn: number;
154
169
  accessToken: string;
155
170
  refreshToken: string;
156
171
  }
172
+ /**
173
+ * @public
174
+ */
157
175
  export interface ClientSession {
158
176
  accessToken: string;
159
177
  sessionKey: string;
package/dist/util.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export declare const getSignature: (data: any) => string;
2
- export declare const rsaEncrypt: (publicKey: string, origData: string | Uint8Array) => string;
2
+ export declare const rsaEncrypt: (publicKey: string, origData: string) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloud189-sdk",
3
- "version": "1.0.6-alpha.4",
3
+ "version": "1.0.6-alpha.6",
4
4
  "description": "基于node.js的第三方天翼云盘SDK",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -11,8 +11,9 @@
11
11
  ],
12
12
  "scripts": {
13
13
  "start": "node ./test/app.js",
14
- "debug": "CLOUD189_VERBOSE=1 npm run start",
15
14
  "build": "tsc",
15
+ "docs:build": "npm run build && cd docs && npm run build",
16
+ "docs:dev": "npm run build && cd docs && npm run dev",
16
17
  "test": "mocha",
17
18
  "coverage": "nyc npm run test"
18
19
  },