Giter VIP home page Giter VIP logo

javascript-sdk's People

Contributors

aisk avatar antsword avatar dependabot[bot] avatar gcaufy avatar gongt avatar guolin avatar hjiang avatar hujiulong avatar hustlzp avatar hybrid-force avatar ichengde avatar juvenn avatar jwfing avatar jysperm avatar killme2008 avatar leeyeh avatar notevenaneko avatar sdjdd avatar sparanoid avatar wangxiao avatar weakish avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

javascript-sdk's Issues

不存在的Object Fetch后不报错也不为空

ticket=AV.Object.createWithoutData("Ticket", "123");
ticket.fetch().then(function (ticket) {
      if (ticket) {
        ticket = transformTicket(ticket);
        mlog.log('ticket found '+ticket.id);

会打印"ticket found 123"
但get(key)内容为undefined.

基于demo构建自定义方法,使用avoscloud进行本地开发调试,但是AV.cloud.run的时候遇到问题

Step 1

main.js定义方法

AV.Cloud.define("help", function (request, response) {
    console.log('----------', request.params);
    response.success("helping~~~!");
});

Step 2

app.js的路由方法使用自定义的方法help

app.get('/hello', function(req, res) {
    AV.Cloud.run('help', {}, {
        success: function (data) {
            res.render('hello', { message: 'Congrats, you just set up your app!---' + data });
        },
        error: function (err) {
            res.send(200, 'err' + err.message)
        }
    })
});

本地运行

在目录下不带直接任何option运行

avoscloud

报错响应

访问 localhost:3000/hello, 返回错误

Cloud code not find function named 'help' for app 'my-app-id' on 'production'.

Missing AV.Query.and

In current SDK there is AV.Query.or but no AV.Query.and. However, in iOS SDK, there is [AVQuery andQueryWithSubqueries:]

如果我只是想使用gulp,就一定要使用javascript-sdk 么?

你好,我想使用gulp来构建我的前端,但是发现在本地可以全局安装gulp后,运行gulp命令来使gulpfile.js里的东西运行。但是到了线上环境,我不知道该如何使用gulp命令,一路找到这里,说这里可以使用gulp。
但是我想知道我想使用gulp,就一定要使用javascript-sdk 么?
还有其他方式么?

从 0.4.7 升级到 0.5.0 的兼容问题

有用户反馈升级 0.5.0 后有些数据结构发生了变化。
用户代码:

            // 是事件流的查询
            var query = AV.Status.inboxQuery(AV.User.createWithoutData('_User',userId));
            query.include('dynamicNews');
            query.include('source');
            query.include('dynamicNews.user_id');
            query.find().then(function(statuses){
                console.dir(statuses[0]);

0.4.7 版本得到的数据结构:

{ data: 
   { messageSignature: '44a98c47b02961c95b6347b3975420b0',
     messageType: 'newPost',
     dynamicNews: 
      { tags: [Object],
        updatedAt: '2015-03-03T13:12:16.635Z',
        clan_ids: [Object],
        content: '今天是个好日子。',
        objectId: '54f5b330e4b0e5cabd32f386',
        createdAt: '2015-03-03T13:12:16.537Z',
        type: 2,
        duration: 0,
        className: 'DynamicNews',
        share_url: 'https://hoopeng.avosapps.com/dynamic/54f5b330e4b0e5cabd32f386',
        status: 1,
        __type: 'Pointer',
        user_id: [Object],
        position: [Object],
        area: '上海市浦东新区张江路368号',
        thumbs: [Object] },
     inboxType: 'default',
     source: 
      { __type: 'Pointer',
        className: '_User',
        objectId: '54b601e1e4b06e1f629b1ddd' },
     message: '发布了新的动态' },
  inboxType: 'default',
  query: null,
  id: '54f5b330e4b077bf83981b2a',
  createdAt: Tue Mar 03 2015 21:12:16 GMT+0800 (CST),
  updatedAt: Tue Mar 03 2015 21:12:16 GMT+0800 (CST),
  messageId: 1 }

0.5.0 版得到的数据结构:

{ data: 
   { messageSignature: '44a98c47b02961c95b6347b3975420b0',
     messageType: 'newPost',
     dynamicNews: 
      { _serverData: [Object],
        _opSetQueue: [Object],
        attributes: [Object],
        _hashedJSON: [Object],
        _escapedAttributes: {},
        cid: 'c162',
        changed: {},
        _silent: {},
        _pending: {},
        _hasData: true,
        _previousAttributes: {},
        id: '54f5b330e4b0e5cabd32f386',
        createdAt: Tue Mar 03 2015 21:12:16 GMT+0800 (CST),
        updatedAt: Tue Mar 03 2015 21:12:16 GMT+0800 (CST) },
     inboxType: 'default',
     source: 
      { _serverData: {},
        _opSetQueue: [Object],
        attributes: {},
        _hashedJSON: {},
        _escapedAttributes: {},
        cid: 'c164',
        changed: {},
        _silent: {},
        _pending: {},
        _hasData: false,
        _previousAttributes: {},
        id: '54b601e1e4b06e1f629b1ddd' },
     message: '发布了新的动态' },
  inboxType: 'default',
  query: null,
  id: '54f5b330e4b077bf83981b2a',
  createdAt: Tue Mar 03 2015 21:12:16 GMT+0800 (CST),
  updatedAt: Tue Mar 03 2015 21:12:16 GMT+0800 (CST),
  messageId: 1 }

我觉得后者应该是正确的,不知道 0.4.7 版本的结果是怎么弄出来的,我自己测试 AV.Query 貌似不能重现,是 AV.Status.inboxQuery 的问题吗?

指南中的demo运行无效

3034ab72-46d2-4c48-a794-915f4f961178 2

网址是: https://cn.avoscloud.com/docs/js_guide.html
在运行到 alert(monster.strength()); // Displays 200.这句时,自己试了一些,无论是在html中还是使用node都会报错,

/Users/tsq/my/avos-note/app.js:22
console.log(version.strength());
                    ^
TypeError: Object [object Object] has no method 'strength'
    at Object.<anonymous> (/Users/tsq/my/avos-note/app.js:22:21)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3

不过,也确实会这样,monster对象只有一个实例方法hasSuperHumanStrength 和一个属性strength
而demo中却把strength当成了方法去调用, 试了一下,要想成功访问strength属性需要通过monster.attributes.strength 来访问。

status is not defined.

ReferenceError: status is not defined
    at Object.AV.Status.send (/usr/local/lib/node_modules/avoscloud-code/node_modules/avoscloud-sdk/lib/av.js:8986:24)
    at AV.Cloud.define.dataPhotos (cloud/main.js:38:12)
    at runFunc (/usr/local/lib/node_modules/avoscloud-code/lib/cloud_code.js:124:24)
    at processRequest0 (/usr/local/lib/node_modules/avoscloud-code/lib/cloud_code.js:505:4)
    at user.fetch.then.res.send.code (/usr/local/lib/node_modules/avoscloud-code/lib/cloud_code.js:516:5)
    at wrappedResolvedCallback (/usr/local/lib/node_modules/avoscloud-code/node_modules/avoscloud-sdk/lib/av.js:3664:38)
    at /usr/local/lib/node_modules/avoscloud-code/node_modules/avoscloud-sdk/lib/av.js:3615:26
    at Array.forEach (native)
    at Object._.each._.forEach [as _arrayEach] (/usr/local/lib/node_modules/avoscloud-code/node_modules/avoscloud-sdk/lib/av.js:95:11)
    at _.extend.resolve (/usr/local/lib/node_modules/avoscloud-code/node_modules/avoscloud-sdk/lib/av.js:3614:10)

callback 中没有存储 this

由用户反馈,比如说这样

query.get(uid, {
    udata:obj,   //每次get的时候这里是不同的,比如在for循环中给不同的控件赋值的时候放控件引用
    success:function(object){
        UserLoaded(this.udata) //然后这里用this引用,但是实际上是不行的,有没有等价的办法
     }
}); 

增加 `Query.findOne()`?

就是 find() 只处理结果中第一个元素的版本,对于作者知道最多只有一个结果的情况比较方便,很多类似的库里都有这个函数。

页面跳转后修改并保存用户对象,用户对象其他属性会丢失

版本:0.4.5,0.4.6 都能重现,其他没有尝试
浏览器端使用

重现方式:
创建一个简单测试页面:

<html>
  <head>
    <script src="av.js"></script>
    <script>
      AV.initialize("8y5ria0dtbvz7qp6alzy00p9nggky304fafdusfo79fba5sk", "nfkx5k3p7otysvhr2fp84mxl8ggmehu7swyi18auvmrg7kd4");
    </script>
    </head>
    <body>

    </body>
  </html>

打开页面,并在浏览器控制台 console 进行用户登录操作:

AV.User.logIn('abc', 'abc');

然后刷新页面
然后查看 currentUser,会发现一切 OK

AV.User.current()

但是如果这个时候 更新数据:

AV.User.current().set('foo', 'bar')
AV.User.current().save(null, {})

然后再查看 currentUser 数据就只有 set 进去的属性,而其他属性都没了

AV.User.current()

如果刷新页面更新对象保存是没问题的。

fetch时怎样include

var assignee=AV.Object.createWithoutData('Admin',assigneeId);
  assignee.fetch().then(function(){

里面有个pointer ,assignee有字段client,指向Client表,不知怎样在fetch的时候include上这个字段,获得数据。

现在只能再fetch一次

 var client=assignee.get('client');
    client.fetch().then(function(){

AV.Object.saveAll not work

findAdmins().then(function(admins){
_.each(admins,function(admin){
admin.set('nickname',admin.get('username'));
});
return AV.Object.saveAll(admins);
});

管理台的数据没有任何更改

base64保存AVFile会报decodeURIComponent Error

注,以前不会。

function saveFileThen(req, f){
    var attachmentFile = req.files.attachment;
    if(attachmentFile && attachmentFile.name!=''){
        fs.readFile(attachmentFile.path, function(err, data){
            if(err)
                return f();
            var base64Data = data.toString('base64');
            var theFile = new AV.File(attachmentFile.name, {base64: base64Data});
            theFile.save().then(function(theFile){
                f(theFile);
            }, function(err){
                f();
            });
        });
    }else{
        f();
    }
}
Mon, 18 Aug 2014 03:06:57 GMT uncaughtException: URI malformed
URIError: URI malformed
    at decodeURIComponent (native)
    at decodeBase64 (/usr/local/lib/node_modules/avoscloud-code/node_modules/avoscloud-sdk/lib/av.js:3865:12)
    at Object.AV.File (/usr/local/lib/node_modules/avoscloud-code/node_modules/avoscloud-sdk/lib/av.js:4150:29)
    at /home/lzw/clojure/avoscloud-ticket/cloud/app.js:108:21
    at fs.js:268:14
    at /usr/local/lib/node_modules/avoscloud-code/node_modules/fstream/node_modules/graceful-fs/graceful-fs.js:104:5
    at Object.oncomplete (fs.js:107:15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.