Skip to content

Commit a7dca95

Browse files
committed
chore(release): v3.0.0
1 parent ff10891 commit a7dca95

File tree

5 files changed

+134
-16
lines changed

5 files changed

+134
-16
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
LeanCloud JavaScript SDK
22
====
3+
[![npm](https://img.shields.io/npm/v/leancloud-storage.svg?style=flat-square)](https://www.npmjs.com/package/leancloud-storage)
4+
![gzip size](http://img.badgesize.io/leancloud/javascript-sdk/dist/dist/av-min.js.svg?compression=gzip&style=flat-square)
35
[![Build Status](https://img.shields.io/travis/leancloud/javascript-sdk.svg?style=flat-square)](https://travis-ci.org/leancloud/javascript-sdk)
46
[![Codecov](https://img.shields.io/codecov/c/github/leancloud/javascript-sdk.svg?style=flat-square)](https://codecov.io/github/leancloud/javascript-sdk)
57
[![David](https://img.shields.io/david/leancloud/javascript-sdk.svg?style=flat-square)](https://david-dm.org/leancloud/javascript-sdk)
6-
[![npm](https://img.shields.io/npm/v/leancloud-storage.svg?style=flat-square)](https://www.npmjs.com/package/leancloud-storage)
78

89

910
JavaScript SDK for [LeanCloud](http://leancloud.cn/).
@@ -13,8 +14,8 @@ JavaScript SDK for [LeanCloud](http://leancloud.cn/).
1314
```
1415
// npm 安装
1516
npm install leancloud-storage --save
16-
// npm 安装 1.x 版本
17-
npm install leancloud-storage@1 --save
17+
// npm 安装 2.x 版本
18+
npm install leancloud-storage@2 --save
1819
1920
// bower 安装
2021
bower install leancloud-storage --save
@@ -61,10 +62,10 @@ bower install leancloud-storage --save
6162

6263
## 发布流程
6364

64-
0. 遵循 semver 提升版本号
65-
* src/version.js
66-
* package.json
67-
* bower.json
65+
1. 遵循 semver 提升版本号
66+
* src/version.js
67+
* package.json
68+
* bower.json
6869
0. 对照 commit 历史写 changelog
6970
0. 提交当前所有改动
7071
0. 等待持续集成 pass

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": "3.0.0-beta.3",
3+
"version": "3.0.0",
44
"homepage": "https://github.com/leancloud/javascript-sdk",
55
"authors": [
66
"LeanCloud <[email protected]>"

changelog.md

Lines changed: 121 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,119 @@
1-
# 3.0.0-beta.2 (2017-06-01)
1+
# 3.0.0 (2017-06-16)
2+
3+
### Highlights
4+
- **LiveQuery**:通过订阅一个 `Query`,在其结果发生变动时实时得到通知。详见 [《LiveQuery 开发指南》](https://url.leanapp.cn/livequery)
5+
- **新的序列化反序列化方法**:针对 `AV.Object` 重新设计了 `#toJSON` 方法,并提供了一对可靠的序列化反序列化方法。
6+
- **`AV.request` 方法**:公开了低抽象级别的 `AV.request` 方法,方便开发者直接调用 LeanCloud Rest API。
7+
8+
### Breaking Changes
9+
10+
- 重新设计了 `AV.Object` 序列化相关的方法:
11+
- 如果需要将 `AV.Object` 中的有效信息转换成 JSON Object,请使用 `AV.Object#toJSON` 方法。请注意通过此方法得到的 JSON 不包含对象的元信息,因此是不可逆的(无法转换回 `AV.Object`)。
12+
- 如果需要「存储」或「传输」`AV.Object`,请使用新增的 `AV.Object#toFullJSON`(序列化)与 `AV.parseJSON`(反序列化)方法。
13+
14+
新版中的 `AV.Object#toJSON` 相比于 v2 有以下区别:
15+
- 如果对象某个字段类型是 Pointer,并且有内容(included),新版中会递归地输出这个字段的有效信息(旧版中会输出一个 Pointer 结构)
16+
<details>
17+
18+
```javascript
19+
new AV.Query('Child').include('father').first()
20+
.then(child => child.toJSON().father)
21+
.then(console.log);
22+
/*
23+
v3: {
24+
objectId: "58a461118d6d8100580a0c54",
25+
name: "John Doe",
26+
createdAt: "2017-02-15T14:08:39.892Z",
27+
updatedAt: "2017-02-16T10:49:00.176Z"
28+
}
29+
v2: {
30+
objectId: "58a461118d6d8100580a0c54",
31+
__type: "Pointer",
32+
className: "Parent",
33+
}
34+
```
35+
36+
- 如果字段的类型是 `Date`,新版中会输出该时间的 UTC 格式字符串(旧版中会输出一个 Date 结构)
37+
<details>
38+
39+
```javascript
40+
const child = new Child().set('birthday', new Data());
41+
console.log(child.toJSON().birthday);
42+
/*
43+
v3: "2011-11-11T03:11:11.000Z"
44+
v2: {
45+
__type: "Date",
46+
iso: "2011-11-11T03:11:11.000Z"
47+
}
48+
```
49+
50+
更多背景与技术细节请参考 [#453](https://github.com/leancloud/javascript-sdk/pull/453#issue-208346693).
51+
52+
- 为了更好的隔离服务,我们为每个应用提供了独立的域名。对于小程序用户,请前往 [《小程序域名白名单配置》](https://leancloud.cn/docs/weapp-domains.html) 更新域名白名单。
53+
- 创建 `Role` 时 `acl` 参数不再是可选的。在 v2 中,如果不指定,SDK 会自动为其设置一个 public read-only 的默认 acl,在新版中必须显式的指定。
54+
<details>
55+
56+
```javascript
57+
// 之前的用法
58+
new AV.Role('admin');
59+
60+
// 新版中等价于
61+
var acl = new AV.ACL();
62+
acl.setPublicReadAccess(true);
63+
new AC.Role('admin', acl);
64+
```
65+
66+
### Features
67+
- LiveQuery 功能允许开发者订阅一个 `Query`,在 `Query` 的结果发生变动时实时得到通知。
68+
- 增加了 `Query#subscribe` 方法,返回该 `Query` 对应的 `LiveQuery` 实例;
69+
- 增加了 `LiveQuery` 类,在 `Query` 结果变化时 SDK 会在 `LiveQuery` 实例上派发 `create`、`update`、`enter`、`leave`、`delete` 等事件。
70+
- 开放了低抽象级别的 `AV.request` 方法,方便开发者直接调用 LeanCloud Rest API。
71+
- 增加了 `AV.setServerURLs` 方法,允许单独配置云函数等服务的域名以进行本地调试。
72+
<details>
73+
74+
```javascript
75+
AV.setServerURLs({
76+
engine: 'http://localhost:3000',
77+
});
78+
```
79+
80+
- 支持在 Node.js 中通过 Stream 构建 `AV.File`(仅支持中国节点)。
81+
<details>
82+
83+
```javascript
84+
const fs = require('fs');
85+
const readStream = fs.createReadStream('sample.txt');
86+
const file = new AV.File('filename', readStream);
87+
```
88+
89+
### Bug Fixes
90+
91+
- 修复了在中国节点 Node.js 中上传文件会阻塞当前线程的问题。
92+
93+
测试版本的更新日志:
94+
<details>
95+
96+
## 3.0.0 (2017-06-16)
97+
98+
### Bug Fixes
99+
- 修复了上传文件 size 信息缺失的问题。
100+
- 修复了在中国节点 Node.js 中上传文件会阻塞当前线程的问题。
101+
102+
### Features
103+
- 支持 LiveQuery。
104+
- 支持在 Node.js 中通过 Stream 构建 `AV.File`(仅支持中国节点)。
105+
<details>
106+
107+
```javascript
108+
const fs = require('fs');
109+
const readStream = fs.createReadStream('sample.txt');
110+
const file = new AV.File('filename', readStream);
111+
```
112+
113+
### Miscellanies
114+
- 包含了 v2.5.0 的新特性。
115+
116+
## 3.0.0-beta.3 (2017-06-01)
2117
### Features
3118
- LiveQuery
4119
@@ -22,8 +137,8 @@
22137
```
23138
24139
### Features
25-
- 开放了低抽象级别的 `AV.request` 方法
26-
- 增加了 `AV.setServerURLs` 方法,允许单独配置云函数的域名
140+
- 开放了低抽象级别的 `AV.request` 方法,方便开发者直接调用 SDK 还不支持的 Rest API。
141+
- 增加了 `AV.setServerURLs` 方法,允许单独配置云函数等服务的域名。
27142
<details>
28143
29144
```javascript
@@ -83,6 +198,8 @@
83198
84199
更多背景与技术细节请参考 [#453](https://github.com/leancloud/javascript-sdk/pull/453#issue-208346693).
85200
201+
</details>
202+
86203
# 2.5.0 (2017-06-01)
87204
### Bug Fixes
88205
* 修复了查询 `Role` 时错误的打印了 deprecation 警告的问题
@@ -159,7 +276,7 @@
159276
* 修复了小程序中不启用「ES6 转 ES5」选项时加载 SDK 抛异常的问题
160277
161278
# 2.0.0 (2017-01-09)
162-
### Highlight
279+
### Highlights
163280
* **全面支持微信小程序**:包括文件存储在内的所有功能均已支持微信小程序,用户系统还增加了小程序内一键登录的 API。详见 [在微信小程序中使用 LeanCloud](https://leancloud.cn/docs/weapp.html)。
164281
* **Promise first**:Promise 风格的异步 API 已被社区广泛接受,此前回调参数优先于其他参数的设计已过时,因此我们去掉了对 Backbone 回调风格参数的支持。
165282
* **支持对单次操作指定是否使用 masterKey**:此前使用 masterKey 是全局生效的,会导致无法充分利用 ACL 等内建的权限控制机制。此项改进将其生效范围细化到了单次操作。

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "leancloud-storage",
3-
"version": "3.0.0-beta.3",
3+
"version": "3.0.0",
44
"main": "./dist/node/index.js",
55
"description": "LeanCloud JavaScript SDK.",
66
"repository": {
@@ -22,8 +22,8 @@
2222
"debug": "^2.2.0",
2323
"es6-promise": "^4.0.5",
2424
"eventemitter3": "^2.0.3",
25-
"leancloud-realtime": "^3.5.0-beta.1",
26-
"leancloud-realtime-plugin-live-query": "^1.0.0-beta.2",
25+
"leancloud-realtime": "^3.5.0",
26+
"leancloud-realtime-plugin-live-query": "^1.0.0",
2727
"localstorage-memory": "^1.0.1",
2828
"md5": "^2.0.0",
2929
"superagent": "^3.3.1",

src/version.js

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

0 commit comments

Comments
 (0)