Skip to content

Commit fa4de58

Browse files
committed
chore(release): v2.2.0
1 parent 8aa34e8 commit fa4de58

File tree

6 files changed

+31
-14
lines changed

6 files changed

+31
-14
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "leancloud-storage",
3-
"version": "2.1.4",
3+
"version": "2.2.0",
44
"homepage": "https://github.com/leancloud/javascript-sdk",
55
"authors": [
66
"LeanCloud <support@leancloud.rocks>"

changelog.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
# 2.2.0 (2017-04-25)
2+
### Bug Fixes
3+
* 修复了 Safari 隐身模式下用户无法登录的问题
4+
5+
### Features
6+
* 短信支持图形验证码(需要在控制台应用选项「启用短信图形验证码」)
7+
* 新增 `Cloud.requestCaptcha``Cloud.verifyCaptcha` 方法请求、校验图形验证码。
8+
* `Cloud.requestSmsCode``User.requestLoginSmsCode``User.requestMobilePhoneVerify``User.requestPasswordResetBySmsCode` 方法增加了 `authOptions.validateToken` 参数。没有提供有效的 validateToken 的请求会被拒绝。
9+
* 支持客户端查询 ACL(需要在控制台应用选项启用「查询时返回值包括 ACL」)
10+
* 增加 `Query#includeACL` 方法。
11+
* `Object#fetch``File#fetch` 方法增加了 `fetchOptions.includeACL` 参数。
12+
113
## 2.1.4 (2017-03-27)
214
### Bug Fixes
315
* 如果在创建 `Role` 时不指定 `acl` 参数,SDK 会自动为其设置一个「默认 acl」,这导致了通过 Query 得到或使用 `Object.createWithoutData` 方法得到 `Role` 也会被意外的设置 acl。这个版本修复了这个问题。
@@ -18,7 +30,7 @@
1830
### Bug Fixes
1931
* 修复了使用 masterKey 获取一个 object 后再次 save 可能会报 ACL 格式不正确的问题。
2032

21-
## 2.1.0 (2017-01-20)
33+
# 2.1.0 (2017-01-20)
2234
### Bug Fixes
2335
* 修复了 `File#toJSON` 序列化结果中缺失 objectId 等字段的问题
2436
* 修复了使用 `Query#containsAll``Query#containedIn``Query#notContainedIn` 方法传入大数组时查询结果可能为空的问题

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "leancloud-storage",
3-
"version": "2.1.4",
3+
"version": "2.2.0",
44
"main": "./dist/node/index.js",
55
"description": "LeanCloud JavaScript SDK.",
66
"repository": {

src/utils/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ const ensureArray = target => {
1515

1616
const transformFetchOptions = ({ keys, include, includeACL } = {}) => {
1717
const fetchOptions = {};
18-
if (_.isArray(keys)) {
19-
fetchOptions.keys = keys.join(',');
18+
if (keys) {
19+
fetchOptions.keys = ensureArray(keys).join(',');
2020
}
21-
if (_.isArray(include)) {
22-
fetchOptions.include = include.join(',');
21+
if (include) {
22+
fetchOptions.include = ensureArray(include).join(',');
2323
}
2424
if (includeACL) {
2525
fetchOptions.returnACL = includeACL;

src/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = '2.1.4';
1+
module.exports = '2.2.0';

storage.d.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ declare namespace AV {
88
export var applicationKey: string;
99
export var masterKey: string;
1010

11+
interface FetchOptions {
12+
keys?: string | string[];
13+
include?: string | string[];
14+
includeACL?: boolean;
15+
}
16+
1117
export interface AuthOptions {
1218
/**
1319
* In Cloud Code and Node only, causes the Master Key to be used for this request.
@@ -126,15 +132,15 @@ declare namespace AV {
126132
static withURL(name: string, url: string): File;
127133
static createWithoutData(objectId: string): File;
128134

129-
destroy<T>(): Promise<T>;
130-
fetch<T>(options?: AuthOptions): Promise<T>;
135+
destroy(): Promise<void>;
136+
fetch(fetchOptions?: FetchOptions, options?: AuthOptions): Promise<File>;
131137
metaData(): any;
132138
metaData(metaKey: string): any;
133139
metaData(metaKey: string, metaValue: any): any;
134140
name(): string;
135141
ownerId(): string;
136142
url(): string;
137-
save<T>(options?: AuthOptions): Promise<T>;
143+
save(options?: AuthOptions): Promise<File>;
138144
setACL(acl?: ACL): any;
139145
size(): any;
140146
thumbnailURL(width: number, height: number): string;
@@ -254,7 +260,7 @@ declare namespace AV {
254260
destroy<T>(options?: Object.DestroyOptions): Promise<T>;
255261
dirty(attr: String): boolean;
256262
escape(attr: string): string;
257-
fetch<T>(fetchOptions?: any, options?: Object.FetchOptions): Promise<T>;
263+
fetch<T>(fetchOptions?: FetchOptions, options?: AuthOptions): Promise<T>;
258264
fetchWhenSave(enable: boolean): any;
259265
get(attr: string): any;
260266
getACL(): ACL;
@@ -280,8 +286,6 @@ declare namespace AV {
280286

281287
interface DestroyAllOptions extends AuthOptions { }
282288

283-
interface FetchOptions extends AuthOptions { }
284-
285289
interface SaveOptions extends AuthOptions, SilentOption, WaitOption { }
286290

287291
interface SaveAllOptions extends AuthOptions { }
@@ -440,6 +444,7 @@ declare namespace AV {
440444
greaterThanOrEqualTo(key: string, value: any): Query;
441445
include(key: string): Query;
442446
include(keys: string[]): Query;
447+
includeACL(value?: boolean): Query;
443448
lessThan(key: string, value: any): Query;
444449
lessThanOrEqualTo(key: string, value: any): Query;
445450
limit(n: number): Query;

0 commit comments

Comments
 (0)