GithubHelp home page GithubHelp logo

getstream / stream-js Goto Github PK

View Code? Open in Web Editor NEW
329.0 37.0 109.0 7.97 MB

JS / Browser Client - Build Activity Feeds & Streams with GetStream.io

Home Page: https://getstream.io

License: BSD 3-Clause "New" or "Revised" License

JavaScript 66.10% TypeScript 33.72% HTML 0.18%
javascript stream-js activity-feed getstream notification-feed news-feed feed timeline

stream-js's Issues

getstream.js for parse has error

getstream.js for parse cloud code has error:
Result: ReferenceError: setTimeout is not defined
at nextTick (getstream.js:18709:9)
at onwrite (getstream.js:20191:7)
at WritableState.onwrite (getstream.js:20025:5)
at afterTransform (getstream.js:19806:5)
at TransformState.afterTransform (getstream.js:19781:12)
at Hash._transform (getstream.js:61:3)
at Hash.Transform._read (getstream.js:19886:10)
at Hash.Transform._write (getstream.js:19874:12)
at doWrite (getstream.js:20152:10)
at writeOrBuffer (getstream.js:20142:5)

I downloaded from:
https://raw.githubusercontent.com/GetStream/stream-js/parse/dist/js/getstream.js

better test infrastructure

We clearly need to split our tests in these groups:

  • unit tests (no I/O whatsoever)
  • integration tests
  • browser tests

we should only run unit tests for regular builds. integration tests and browser tests should be run as part of the release cycle (eg. npm release_test, npm browser_test, npm integration_test).

err is always null when there are server side validation errors

client.feed('notification', id).addActivity({
"actor": id2,
"actorName": "abc",
"verb": "follow"
});
body:{
"code": 5,
"detail": "Please use actorname instead of actorName for your field name",
"duration": "10ms",
"exception": "CustomFieldException",
"status_code": 400
}
err = null

How to get all activities?

Hello, could you help me with this problem:

  • I try to get all activities ( command: feed.get() ). When i get the response, i can't parse it ( can see it in console, but when i try to parse it in JS, the response is undefined )

Issue with TARGETTING & "TO" SUPPORT

I was exploring "Targetting & To Supports" of your wonderful platform.
Every time, I insert new activity with "to" field, I get following error messge:

"detail": "Errors for fields 'to'",
"duration": "7ms",
"exception": "InputException",
"exception_fields": {
"to": [
{
"0": [
"Invalid value."
]
}
]
},
"status_code": 400

Without "to", it works fine.

This is how I am inserting new activity to user feed:
var streamActivityObj={
.....
verb: obj.verb,
object: {
content: obj.content,
object_type: obj.object_type
},
target: obj.target,
to: ["flat:5648e69f40d7a92b71fc9690"],
foreign_id: some_id,
....
}
//Insert to ufeeds....
var currentActorFeed = con.uFeeds[kinId];
currentActorFeed.addActivity(streamActivityObj, function (errorAddingActivity, responseAddingActivity, bodyAddingActivity) {
if (errorAddingActivity) {
return cb(errorAddingActivity, null);

I tried debugging, and it seems that the flatfeed is valid as well.
Dump of flatfeed for userId= 5648e69f40d7a92b71fc9690

node: true }, slug: 'flat', userId: '5648e69f40d7a92b71fc9690', id: 'flat:5648e69f40d7a92b71fc9690', token: 'mxcxmcxmnmcxnxcmnxcncncxmnxcmcnx'fake', feedUrl: 'flat/5648e69f40d7a92b71fc9690', feedTogether: 'flat5648e69f40d7a92b71fc9690',
..........................................

Could you please help me in this regard?

Thanks.

loading multiple results - the callback doesn't have a result argument, works differently than subscribing to a feed

Here's an example of how I get the request for the feed to work, it should come back in the argument of the callback result argument, here's how i have to get the result, this works differently than subscribing to a feed:

UserFeedCollection.prototype.subscribeToFeed = function() {
return this.me.subscribe((function(_this) {
return function(data) {
return _this.addOneAtIndex(data, 0);
};
})(this));
};

UserFeedCollection.prototype.fetch = function(lastSeenId) {
var xmHttpR;
this.lastSeenId = lastSeenId != null ? lastSeenId : 0;
if (this.lastSeenId !== 0) {
this.me.get({
limit: this.pageLimit,
mark_seen: true
});
} else {
this.me.get({
limit: this.pageLimit,
id_lt: this.lastSeenId
});
}
xmHttpR = this.me.get({
limit: 10,
mark_seen: true
});
xmHttpR.onload = (function(_this) {
return function(data) {
var item, list, _i, _len, _ref, _ref1, _results;
list = data != null ? (_ref = data.target) != null ? (_ref1 = _ref.body) != null ? _ref1.results : void 0 : void 0 : void 0;
if (!list) {
return _this.trigger('sync');
}
_results = [];
for (_i = 0, _len = list.length; _i < _len; _i++) {
item = list[_i];
console.log('item', item);
_results.push(_this.addOne(item));
}
return _results;
};
})(this);
return this.trigger('sync');
};

Requiring getstream on the frontend

Right now if you install stream-js via npm and require it in a frontend project the build will fail. This is because package.json sets the property "main" to the src entry "./src/getstream.js". We should investigate using the "browser" or "browserify" package.json property to tell build tool chains to include a distributable specifically build for the frontend. Webpack config needs to include a separate target.

Faye.subscribe

Currently auth and connection are tied together. This means you cant subscribe to multiple feeds without creating multiple connections.

We should research if this can be improved and if doing so improves performance

Support for global callback

Often you'll want a global behaviour for loading and error handling. Currently this is not supported.

We could do something like
client.on('pre_request', callback);
client.on('response', callback);

@tbarbugli what do you think?

Promises

Make it easy to use Stream with promises, while maintaining backward compatibility.

unconsistent do i follow filter syntax

on the js client
user1.following({limit: '10', offset: '0', feeds: ['user:42', 'user:43']})

on python client (same for php and ruby)
user_feed_1.following(offset=0, limit=2, filter=['user:42', 'user:43'])

Transpile to ES5

current distributable is using ES6. we should transpile to ES5 as part of the build

support for private feeds

send target_token as part of post body containing the signature token of the target feed id (eg. secret:42)

the test account has a private feed configured (slug secret)

IE9 is not supported

both feed reads and writes are not supported. This is related to (missing) CORS support in IE9. We should at least add read support via JSONP

add meaningful user agent header

USER_AGENT should be "stream-javascript-client-" + version

question: can we detect if the client is used server-side or in the browser? (eg. nodejs VS browser)

Bad feed slug does not set err callback argument on follow

Accidentally typed the name of my feed slug in incorrectly and did not get the behavior I expected...

var stream = require("getstream");
var client = stream.connect("REDACTED", "REDACTED");
var aggregated1 = client.feed("agggggregated", "1");
aggregated1.follow("user", "1", function(err, resp, body) {
    console.log("Err: ", err);
    console.log("Body: ", body);
});

This gives me the following output:

Err:  null
Body:  { code: 6,
  detail: 'The following feeds are not configured: \'agggggregated\'',
  duration: '13ms',
  exception: 'FeedConfigException',
  status_code: 400 }

With some different slug names, different errors can result (I tried "does-not-exist" for testing and it gave a 404 instead of 400)

I would have expected the API to return an error (via the err arguments in the callback).

I have not assessed deeper yet but I suspect other APIs have similar issues.

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.