Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

getstream

Package Overview
Dependencies
Maintainers
10
Versions
182
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

getstream - npm Package Compare versions

Comparing version 8.1.4 to 8.1.5

dist/js_min/getstream.js.LICENSE.txt

6

lib/batch_operations.d.ts
import { StreamClient, APIResponse, DefaultGenerics } from './client';
declare type BaseFollowRelation = {
type BaseFollowRelation = {
source: string;
target: string;
};
export declare type FollowRelation = BaseFollowRelation & {
export type FollowRelation = BaseFollowRelation & {
activity_copy_limit?: number;
};
export declare type UnfollowRelation = BaseFollowRelation & {
export type UnfollowRelation = BaseFollowRelation & {
keep_history?: boolean;

@@ -11,0 +11,0 @@ };

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -9,5 +8,3 @@ value: true

exports.default = void 0;
var _utils = _interopRequireDefault(require("./utils"));
/**

@@ -25,3 +22,2 @@ * Add one activity to many feeds

this._throwMissingApiSecret();
return this.post({

@@ -36,2 +32,3 @@ url: 'feed/add_to_many/',

}
/**

@@ -47,7 +44,4 @@ * Follow multiple feeds with one API call

*/
function followMany(follows, activityCopyLimit) {
this._throwMissingApiSecret();
var qs = {};

@@ -62,2 +56,3 @@ if (typeof activityCopyLimit === 'number') qs.activity_copy_limit = activityCopyLimit;

}
/**

@@ -73,7 +68,4 @@ * Unfollow multiple feeds with one API call

*/
function unfollowMany(unfollows) {
this._throwMissingApiSecret();
return this.post({

@@ -85,3 +77,2 @@ url: 'unfollow_many/',

}
var _default = {

@@ -88,0 +79,0 @@ addToMany: addToMany,

/// <reference path="../types/modules.d.ts" />
/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" />
/// <reference types="node" />
import * as axios from 'axios';

@@ -15,5 +18,5 @@ import * as Faye from 'faye';

import { StreamFeed, UpdateActivity, Activity, EnrichOptions, PersonalizationFeedAPIResponse, GetActivitiesAPIResponse, GetFeedOptions, EnrichedActivity } from './feed';
export declare type UR = Record<string, unknown>;
export declare type UnknownRecord = UR;
export declare type DefaultGenerics = {
export type UR = Record<string, unknown>;
export type UnknownRecord = UR;
export type DefaultGenerics = {
activityType: UR;

@@ -26,10 +29,10 @@ childReactionType: UR;

};
export declare type APIResponse = {
export type APIResponse = {
duration?: string;
};
export declare type FileUploadAPIResponse = APIResponse & {
export type FileUploadAPIResponse = APIResponse & {
file: string;
};
export declare type OnUploadProgress = (progressEvent: ProgressEvent) => void;
export declare type ClientOptions = {
export type OnUploadProgress = (progressEvent: ProgressEvent) => void;
export type ClientOptions = {
browser?: boolean;

@@ -47,3 +50,3 @@ expireTokens?: boolean;

};
declare type OGResource = {
type OGResource = {
secure_url?: string;

@@ -53,6 +56,6 @@ type?: string;

};
declare type OGAudio = OGResource & {
type OGAudio = OGResource & {
audio?: string;
};
declare type OGImage = OGResource & {
type OGImage = OGResource & {
alt?: string;

@@ -63,3 +66,3 @@ height?: number;

};
declare type OGVideo = OGResource & {
type OGVideo = OGResource & {
height?: number;

@@ -69,3 +72,3 @@ video?: string;

};
export declare type OGAPIResponse = APIResponse & {
export type OGAPIResponse = APIResponse & {
audios?: OGAudio[];

@@ -84,3 +87,3 @@ description?: string;

};
declare type AxiosConfig = {
type AxiosConfig = {
token: string;

@@ -94,4 +97,4 @@ url: string;

};
export declare type HandlerCallback = (...args: unknown[]) => unknown;
export declare type ForeignIDTimes = {
export type HandlerCallback = (...args: unknown[]) => unknown;
export type ForeignIDTimes = {
foreign_id: string;

@@ -103,3 +106,3 @@ time: Date | string;

};
export declare type ActivityPartialChanges<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = Partial<ForeignIDTimes> & {
export type ActivityPartialChanges<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = Partial<ForeignIDTimes> & {
id?: string;

@@ -109,3 +112,3 @@ set?: Partial<StreamFeedGenerics['activityType']>;

};
export declare type RealTimeMessage<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = {
export type RealTimeMessage<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = {
deleted: Array<string>;

@@ -322,5 +325,5 @@ deleted_foreign_ids: Array<[id: string, time: string]>;

getFayeClient(timeout?: number): Faye.Client<RealTimeMessage<StreamFeedGenerics>>;
handleResponse: <T>(response: axios.AxiosResponse<T>) => T;
handleResponse: <T>(response: axios.AxiosResponse<T, any>) => T;
doAxiosRequest: <T>(method: axios.Method, options: AxiosConfig) => Promise<T>;
upload(url: string, uri: string | File | Buffer | NodeJS.ReadStream, name?: string, contentType?: string, onUploadProgress?: OnUploadProgress): Promise<FileUploadAPIResponse>;
upload(url: string, uri: string | File | Buffer | NodeJS.ReadStream, name?: string, contentType?: string, onUploadProgress?: (progressEvent: axios.AxiosProgressEvent) => void): Promise<FileUploadAPIResponse>;
/**

@@ -327,0 +330,0 @@ * Shorthand function for get request

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {

@@ -11,67 +9,34 @@ value: true

exports.StreamClient = void 0;
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var axios = _interopRequireWildcard(require("axios"));
var Faye = _interopRequireWildcard(require("faye"));
var http = _interopRequireWildcard(require("http"));
var https = _interopRequireWildcard(require("https"));
var _jwtDecode = _interopRequireDefault(require("jwt-decode"));
var _personalization = require("./personalization");
var _collections = require("./collections");
var _files = require("./files");
var _images = require("./images");
var _reaction = require("./reaction");
var _user = require("./user");
var _signing = require("./signing");
var _errors = require("./errors");
var _utils = _interopRequireDefault(require("./utils"));
var _batch_operations = _interopRequireDefault(require("./batch_operations"));
var _redirect_url = _interopRequireDefault(require("./redirect_url"));
var _feed = require("./feed");
var _excluded = ["method", "token"],
_excluded2 = ["ids", "foreignIDTimes"],
_excluded3 = ["activities"];
_excluded2 = ["ids", "foreignIDTimes"],
_excluded3 = ["activities"];
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
// TODO: no import since typescript json loader shifts the final output structure
// eslint-disable-next-line @typescript-eslint/no-var-requires
var pkg = require('../package.json');
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } /// <reference path="../types/modules.d.ts" />
// alias to avoid breaking change
/**

@@ -83,5 +48,2 @@ * Client to connect to Stream api

// eslint-disable-line no-use-before-define
// eslint-disable-line no-use-before-define
// eslint-disable-line no-use-before-define
// eslint-disable-line no-use-before-define

@@ -109,7 +71,5 @@ /**

var _this = this,
_process$env,
_process$env2;
_process$env,
_process$env2;
var _options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
(0, _classCallCheck2.default)(this, StreamClient);

@@ -149,4 +109,7 @@ (0, _defineProperty2.default)(this, "baseUrl", void 0);

(0, _defineProperty2.default)(this, "addToMany", void 0);
// eslint-disable-line no-use-before-define
(0, _defineProperty2.default)(this, "followMany", void 0);
// eslint-disable-line no-use-before-define
(0, _defineProperty2.default)(this, "unfollowMany", void 0);
// eslint-disable-line no-use-before-define
(0, _defineProperty2.default)(this, "createRedirectUrl", void 0);

@@ -159,15 +122,11 @@ (0, _defineProperty2.default)(this, "replaceReactionOptions", function (options) {

}
if (options.reactions.recent != null) {
options.withRecentReactions = options.reactions.recent;
}
if (options.reactions.counts != null) {
options.withReactionCounts = options.reactions.counts;
}
if (options.reactions.own_children != null) {
options.withOwnChildren = options.reactions.own_children;
}
delete options.reactions;

@@ -179,6 +138,4 @@ }

_this.send('response', null, response, response.data);
return response.data;
}
throw new _errors.StreamApiError("".concat(JSON.stringify(response.data), " with HTTP status code ").concat(response.status), response.data, response);

@@ -190,40 +147,30 @@ });

return _regenerator.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_this.send('request', method, options);
_context.prev = 1;
_context.next = 4;
return _this.request(_this.enrichKwargs(_objectSpread({
method: method
}, options)));
case 4:
response = _context.sent;
return _context.abrupt("return", _this.handleResponse(response));
case 8:
_context.prev = 8;
_context.t0 = _context["catch"](1);
err = _context.t0;
if (!err.response) {
_context.next = 13;
break;
}
return _context.abrupt("return", _this.handleResponse(err.response));
case 13:
throw new _errors.SiteError(err.message);
case 14:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
_this.send('request', method, options);
_context.prev = 1;
_context.next = 4;
return _this.request(_this.enrichKwargs(_objectSpread({
method: method
}, options)));
case 4:
response = _context.sent;
return _context.abrupt("return", _this.handleResponse(response));
case 8:
_context.prev = 8;
_context.t0 = _context["catch"](1);
err = _context.t0;
if (!err.response) {
_context.next = 13;
break;
}
return _context.abrupt("return", _this.handleResponse(err.response));
case 13:
throw new _errors.SiteError(err.message);
case 14:
case "end":
return _context.stop();
}
}, _callee, null, [[1, 8]]);
}));
return function (_x, _x2) {

@@ -240,14 +187,10 @@ return _ref.apply(this, arguments);

this.enrichByDefault = !this.usingApiSecret;
if (this.userToken != null) {
var jwtBody = (0, _jwtDecode.default)(this.userToken);
if (!jwtBody.user_id) {
throw new TypeError('user_id is missing in user token');
}
this.userId = jwtBody.user_id;
this.currentUser = this.user(this.userId);
}
this.appId = appId;

@@ -257,9 +200,9 @@ this.options = _options;

this.fayeUrl = this.options.fayeUrl || 'https://faye-us-east.stream-io-api.com/faye';
this.fayeClient = null; // track a source name for the api calls, ie get started or databrowser
this.group = this.options.group || 'unspecified'; // track subscriptions made on feeds created by this client
this.fayeClient = null;
// track a source name for the api calls, ie get started or databrowser
this.group = this.options.group || 'unspecified';
// track subscriptions made on feeds created by this client
this.subscriptions = {};
this.expireTokens = this.options.expireTokens ? this.options.expireTokens : false; // which data center to use
this.expireTokens = this.options.expireTokens ? this.options.expireTokens : false;
// which data center to use
this.location = this.options.location;

@@ -272,5 +215,3 @@ this.baseUrl = this.getBaseUrl();

// use for browser warnings
this.browser = typeof this.options.browser !== 'undefined' ? this.options.browser : !this.node;
if (this.node) {

@@ -289,3 +230,2 @@ var keepAlive = this.options.keepAlive === undefined ? true : this.options.keepAlive;

}
this.request = axios.default.create(_objectSpread({

@@ -296,12 +236,11 @@ timeout: this.options.timeout || 10000,

this.personalization = new _personalization.Personalization(this);
if (this.browser && this.usingApiSecret) {
throw new _errors.FeedError('You are publicly sharing your App Secret. Do not expose the App Secret in browsers, "native" mobile apps, or other non-trusted environments.');
}
this.collections = new _collections.Collections(this, this.getOrCreateToken());
this.files = new _files.StreamFileStore(this, this.getOrCreateToken());
this.images = new _images.StreamImageStore(this, this.getOrCreateToken());
this.reactions = new _reaction.StreamReaction(this, this.getOrCreateToken()); // If we are in a node environment and batchOperations/createRedirectUrl is available add the methods to the prototype of StreamClient
this.reactions = new _reaction.StreamReaction(this, this.getOrCreateToken());
// If we are in a node environment and batchOperations/createRedirectUrl is available add the methods to the prototype of StreamClient
if (_batch_operations.default && !!_redirect_url.default) {

@@ -314,3 +253,2 @@ this.addToMany = _batch_operations.default.addToMany;

}
(0, _createClass2.default)(StreamClient, [{

@@ -327,5 +265,3 @@ key: "_throwMissingApiSecret",

if (this._personalizationToken) return this._personalizationToken;
this._throwMissingApiSecret();
this._personalizationToken = (0, _signing.JWTScopeToken)(this.apiSecret, 'personalization', '*', {

@@ -342,5 +278,3 @@ userId: '*',

if (this._collectionsToken) return this._collectionsToken;
this._throwMissingApiSecret();
this._collectionsToken = (0, _signing.JWTScopeToken)(this.apiSecret, 'collections', '*', {

@@ -356,3 +290,2 @@ feedId: '*',

this._throwMissingApiSecret();
return (0, _signing.JWTScopeToken)(this.apiSecret, 'analytics', '*', {

@@ -367,3 +300,2 @@ userId: '*',

var _process$env3, _process$env4;
if (!serviceName) serviceName = 'api';

@@ -374,3 +306,2 @@ if (this.options.urlOverride && this.options.urlOverride[serviceName]) return this.options.urlOverride[serviceName];

if (typeof process !== 'undefined' && (_process$env4 = process.env) !== null && _process$env4 !== void 0 && _process$env4.LOCAL || this.options.local) return "http://localhost:8000/".concat(serviceName, "/");
if (this.location) {

@@ -380,6 +311,6 @@ var protocol = this.options.protocol || 'https';

}
if (serviceName !== 'api') return "https://".concat(serviceName, ".stream-io-api.com/").concat(serviceName, "/");
return this.baseUrl;
}
/**

@@ -396,3 +327,2 @@ * Support for global event callbacks

*/
}, {

@@ -403,2 +333,3 @@ key: "on",

}
/**

@@ -413,3 +344,2 @@ * Remove one or more event handlers

*/
}, {

@@ -424,2 +354,3 @@ key: "off",

}
/**

@@ -431,3 +362,2 @@ * Call the given handler with the arguments

*/
}, {

@@ -439,5 +369,5 @@ key: "send",

}
if (this.handlers[key]) this.handlers[key].apply(this, args);
}
/**

@@ -449,8 +379,12 @@ * Get the current user agent

*/
}, {
key: "userAgent",
value: function userAgent() {
return "stream-javascript-client-".concat(this.node ? 'node' : 'browser', "-").concat(pkg.version);
if (process.env.PACKAGE_VERSION === undefined) {
// eslint-disable-next-line
return "stream-javascript-client-".concat(this.node ? 'node' : 'browser', "-").concat(require('../package.json').version);
}
return "stream-javascript-client-".concat(this.node ? 'node' : 'browser', "-").concat(process.env.PACKAGE_VERSION);
}
/**

@@ -466,3 +400,2 @@ * Returns a token that allows only read operations

*/
}, {

@@ -472,5 +405,3 @@ key: "getReadOnlyToken",

_utils.default.validateFeedSlug(feedSlug);
_utils.default.validateUserId(userId);
return (0, _signing.JWTScopeToken)(this.apiSecret, '*', 'read', {

@@ -481,2 +412,3 @@ feedId: "".concat(feedSlug).concat(userId),

}
/**

@@ -492,3 +424,2 @@ * Returns a token that allows read and write operations

*/
}, {

@@ -498,5 +429,3 @@ key: "getReadWriteToken",

_utils.default.validateFeedSlug(feedSlug);
_utils.default.validateUserId(userId);
return (0, _signing.JWTScopeToken)(this.apiSecret, '*', '*', {

@@ -507,2 +436,3 @@ feedId: "".concat(feedSlug).concat(userId),

}
/**

@@ -519,3 +449,2 @@ * Returns a feed object for the given feed id and token

*/
}, {

@@ -525,3 +454,2 @@ key: "feed",

if (userId instanceof _user.StreamUser) userId = userId.id;
if (token === undefined) {

@@ -536,5 +464,5 @@ if (this.usingApiSecret) {

}
return new _feed.StreamFeed(this, feedSlug, userId || this.userId, token);
}
/**

@@ -549,3 +477,2 @@ * Combines the base url with version and the relative url

*/
}, {

@@ -560,3 +487,2 @@ key: "enrichUrl",

var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
if (options.enrich !== undefined) {

@@ -567,5 +493,5 @@ var result = options.enrich;

}
return this.enrichByDefault || options.ownReactions != null || options.withRecentReactions != null || options.withReactionCounts != null || options.withOwnChildren != null;
}
/**

@@ -579,3 +505,2 @@ * Adds the API key and the token

*/
}, {

@@ -585,4 +510,4 @@ key: "enrichKwargs",

var method = _ref2.method,
token = _ref2.token,
kwargs = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
token = _ref2.token,
kwargs = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
return _objectSpread({

@@ -603,2 +528,3 @@ method: method,

}
/**

@@ -611,3 +537,2 @@ * Get the authorization middleware to use Faye with getstream.io

*/
}, {

@@ -617,3 +542,2 @@ key: "getFayeAuthorization",

var _this2 = this;
return {

@@ -632,3 +556,2 @@ incoming: function incoming(message, callback) {

}
callback(message);

@@ -638,2 +561,3 @@ }

}
/**

@@ -647,3 +571,2 @@ * Returns this client's current Faye client

*/
}, {

@@ -653,3 +576,2 @@ key: "getFayeClient",

var timeout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 10;
if (this.fayeClient === null) {

@@ -662,3 +584,2 @@ this.fayeClient = new Faye.Client(this.fayeUrl, {

}
return this.fayeClient;

@@ -670,3 +591,2 @@ }

var fd = _utils.default.addFileToFormData(uri, name, contentType);
return this.doAxiosRequest('POST', {

@@ -686,2 +606,3 @@ url: url,

}
/**

@@ -695,3 +616,2 @@ * Shorthand function for get request

*/
}, {

@@ -702,2 +622,3 @@ key: "get",

}
/**

@@ -711,3 +632,2 @@ * Shorthand function for post request

*/
}, {

@@ -718,2 +638,3 @@ key: "post",

}
/**

@@ -727,3 +648,2 @@ * Shorthand function for delete request

*/
}, {

@@ -734,2 +654,3 @@ key: "delete",

}
/**

@@ -743,3 +664,2 @@ * Shorthand function for put request

*/
}, {

@@ -750,2 +670,3 @@ key: "put",

}
/**

@@ -758,3 +679,2 @@ * create a user token

*/
}, {

@@ -764,5 +684,3 @@ key: "createUserToken",

var extraData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
this._throwMissingApiSecret();
return (0, _signing.JWTUserSessionToken)(this.apiSecret, userId, extraData, {

@@ -772,2 +690,3 @@ noTimestamp: !this.expireTokens

}
/**

@@ -779,3 +698,2 @@ * Updates all supplied activities on the stream

*/
}, {

@@ -785,7 +703,5 @@ key: "updateActivities",

this._throwMissingApiSecret();
if (!(activities instanceof Array)) {
throw new TypeError('The activities argument should be an Array');
}
var token = (0, _signing.JWTScopeToken)(this.apiSecret, 'activities', '*', {

@@ -803,2 +719,3 @@ feedId: '*',

}
/**

@@ -810,3 +727,2 @@ * Updates one activity on the stream

*/
}, {

@@ -816,5 +732,5 @@ key: "updateActivity",

this._throwMissingApiSecret();
return this.updateActivities([activity]);
}
/**

@@ -826,3 +742,2 @@ * Retrieve activities by ID or foreign_id and time

*/
}, {

@@ -832,6 +747,5 @@ key: "getActivities",

var ids = _ref3.ids,
foreignIDTimes = _ref3.foreignIDTimes,
params = (0, _objectWithoutProperties2.default)(_ref3, _excluded2);
foreignIDTimes = _ref3.foreignIDTimes,
params = (0, _objectWithoutProperties2.default)(_ref3, _excluded2);
var extraParams = {};
if (ids) {

@@ -841,3 +755,2 @@ if (!(ids instanceof Array)) {

}
extraParams.ids = ids.join(',');

@@ -848,3 +761,2 @@ } else if (foreignIDTimes) {

}
var foreignIDs = [];

@@ -856,3 +768,2 @@ var timestamps = [];

}
foreignIDs.push(fidTime.foreign_id || fidTime.foreignID);

@@ -866,5 +777,3 @@ timestamps.push(fidTime.time);

}
var token = this.userToken;
if (this.usingApiSecret) {

@@ -876,3 +785,2 @@ token = (0, _signing.JWTScopeToken)(this.apiSecret, 'activities', '*', {

}
this.replaceReactionOptions(params);

@@ -894,3 +802,2 @@ var path = this.shouldUseEnrichEndpoint(params) ? 'enrich/activities/' : 'activities/';

}
return this._getOrCreateToken;

@@ -909,35 +816,27 @@ }

return _regenerator.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
if (!this.usingApiSecret) {
_context2.next = 2;
break;
}
throw new _errors.SiteError('This method can only be used client-side using a user token');
case 2:
body = _objectSpread({}, data);
delete body.id;
_context2.next = 6;
return this.currentUser.getOrCreate(body);
case 6:
user = _context2.sent;
this.currentUser = user;
return _context2.abrupt("return", user);
case 9:
case "end":
return _context2.stop();
}
while (1) switch (_context2.prev = _context2.next) {
case 0:
if (!this.usingApiSecret) {
_context2.next = 2;
break;
}
throw new _errors.SiteError('This method can only be used client-side using a user token');
case 2:
body = _objectSpread({}, data);
delete body.id;
_context2.next = 6;
return this.currentUser.getOrCreate(body);
case 6:
user = _context2.sent;
this.currentUser = user;
return _context2.abrupt("return", user);
case 9:
case "end":
return _context2.stop();
}
}, _callee2, this);
}));
function setUser(_x3) {
return _setUser.apply(this, arguments);
}
return setUser;

@@ -966,2 +865,3 @@ }()

}
/**

@@ -999,3 +899,2 @@ * Update a single activity with partial operations.

*/
}, {

@@ -1006,29 +905,22 @@ key: "activityPartialUpdate",

var _yield$this$activitie, activities, response, _activities, activity;
return _regenerator.default.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return this.activitiesPartialUpdate([data]);
case 2:
_yield$this$activitie = _context3.sent;
activities = _yield$this$activitie.activities;
response = (0, _objectWithoutProperties2.default)(_yield$this$activitie, _excluded3);
_activities = (0, _slicedToArray2.default)(activities, 1), activity = _activities[0];
return _context3.abrupt("return", _objectSpread(_objectSpread({}, activity), response));
case 7:
case "end":
return _context3.stop();
}
while (1) switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return this.activitiesPartialUpdate([data]);
case 2:
_yield$this$activitie = _context3.sent;
activities = _yield$this$activitie.activities;
response = (0, _objectWithoutProperties2.default)(_yield$this$activitie, _excluded3);
_activities = (0, _slicedToArray2.default)(activities, 1), activity = _activities[0];
return _context3.abrupt("return", _objectSpread(_objectSpread({}, activity), response));
case 7:
case "end":
return _context3.stop();
}
}, _callee3, this);
}));
function activityPartialUpdate(_x4) {
return _activityPartialUpdate.apply(this, arguments);
}
return activityPartialUpdate;

@@ -1090,3 +982,2 @@ }()

*/
}, {

@@ -1098,3 +989,2 @@ key: "activitiesPartialUpdate",

}
changes.forEach(function (item) {

@@ -1104,15 +994,11 @@ if (!(item instanceof Object)) {

}
if (item.foreignID) {
item.foreign_id = item.foreignID;
}
if (item.id === undefined && (item.foreign_id === undefined || item.time === undefined)) {
throw new TypeError('missing id or foreign_id and time');
}
if (item.set && !(item.set instanceof Object)) {
throw new TypeError('set field should be an Object');
}
if (item.unset && !(item.unset instanceof Array)) {

@@ -1123,3 +1009,2 @@ throw new TypeError('unset field should be an Array');

var token = this.userToken;
if (this.usingApiSecret) {

@@ -1131,3 +1016,2 @@ token = (0, _signing.JWTScopeToken)(this.apiSecret, 'activities', '*', {

}
return this.post({

@@ -1144,3 +1028,2 @@ url: 'activity/',

}();
exports.StreamClient = StreamClient;
import { StreamClient, APIResponse, DefaultGenerics } from './client';
declare type BaseCollection<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = {
type BaseCollection<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = {
collection: string;

@@ -7,7 +7,7 @@ data: StreamFeedGenerics['collectionType'];

};
export declare type CollectionItem<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = StreamFeedGenerics['collectionType'] & {
export type CollectionItem<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = StreamFeedGenerics['collectionType'] & {
id: string;
user_id?: string;
};
export declare type CollectionResponse<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = BaseCollection<StreamFeedGenerics> & {
export type CollectionResponse<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = BaseCollection<StreamFeedGenerics> & {
created_at: string;

@@ -17,7 +17,7 @@ foreign_id: string;

};
export declare type NewCollectionEntry<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = BaseCollection<StreamFeedGenerics> & {
export type NewCollectionEntry<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = BaseCollection<StreamFeedGenerics> & {
user_id?: string;
};
export declare type CollectionAPIResponse<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = APIResponse & CollectionResponse<StreamFeedGenerics>;
export declare type SelectCollectionAPIResponse<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = APIResponse & {
export type CollectionAPIResponse<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = APIResponse & CollectionResponse<StreamFeedGenerics>;
export type SelectCollectionAPIResponse<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = APIResponse & {
response: {

@@ -27,3 +27,3 @@ data: CollectionResponse<StreamFeedGenerics>[];

};
export declare type UpsertCollectionAPIResponse<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = APIResponse & {
export type UpsertCollectionAPIResponse<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = APIResponse & {
data: {

@@ -33,3 +33,3 @@ [key: string]: CollectionItem<StreamFeedGenerics>[];

};
export declare type UpsertManyCollectionRequest<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = {
export type UpsertManyCollectionRequest<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = {
[collection: string]: CollectionItem<StreamFeedGenerics>[];

@@ -93,3 +93,3 @@ };

constructor(client: StreamClient<StreamFeedGenerics>, token: string);
buildURL: (collection: string, itemId?: string | undefined) => string;
buildURL: (collection: string, itemId?: string) => string;
entry(collection: string, itemId: string, itemData: StreamFeedGenerics['collectionType']): CollectionEntry<StreamFeedGenerics>;

@@ -96,0 +96,0 @@ /**

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -9,18 +8,11 @@ value: true

exports.Collections = exports.CollectionEntry = void 0;
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _errors = require("./errors");
var CollectionEntry = /*#__PURE__*/function () {
// eslint-disable-line no-use-before-define
function CollectionEntry( // eslint-disable-next-line no-use-before-define
function CollectionEntry(
// eslint-disable-next-line no-use-before-define
store, collection, id, data) {

@@ -31,2 +23,3 @@ (0, _classCallCheck2.default)(this, CollectionEntry);

(0, _defineProperty2.default)(this, "store", void 0);
// eslint-disable-line no-use-before-define
(0, _defineProperty2.default)(this, "data", void 0);

@@ -39,3 +32,2 @@ (0, _defineProperty2.default)(this, "full", void 0);

}
(0, _createClass2.default)(CollectionEntry, [{

@@ -46,2 +38,3 @@ key: "ref",

}
/**

@@ -54,3 +47,2 @@ * get item from collection and sync data

*/
}, {

@@ -62,26 +54,20 @@ key: "get",

return _regenerator.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return this.store.get(this.collection, this.id);
case 2:
response = _context.sent;
this.data = response.data;
this.full = response;
return _context.abrupt("return", response);
case 6:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return this.store.get(this.collection, this.id);
case 2:
response = _context.sent;
this.data = response.data;
this.full = response;
return _context.abrupt("return", response);
case 6:
case "end":
return _context.stop();
}
}, _callee, this);
}));
function get() {
return _get.apply(this, arguments);
}
return get;

@@ -97,3 +83,2 @@ }()

*/
}, {

@@ -105,26 +90,20 @@ key: "add",

return _regenerator.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return this.store.add(this.collection, this.id, this.data);
case 2:
response = _context2.sent;
this.data = response.data;
this.full = response;
return _context2.abrupt("return", response);
case 6:
case "end":
return _context2.stop();
}
while (1) switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return this.store.add(this.collection, this.id, this.data);
case 2:
response = _context2.sent;
this.data = response.data;
this.full = response;
return _context2.abrupt("return", response);
case 6:
case "end":
return _context2.stop();
}
}, _callee2, this);
}));
function add() {
return _add.apply(this, arguments);
}
return add;

@@ -141,3 +120,2 @@ }()

*/
}, {

@@ -149,26 +127,20 @@ key: "update",

return _regenerator.default.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return this.store.update(this.collection, this.id, this.data);
case 2:
response = _context3.sent;
this.data = response.data;
this.full = response;
return _context3.abrupt("return", response);
case 6:
case "end":
return _context3.stop();
}
while (1) switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return this.store.update(this.collection, this.id, this.data);
case 2:
response = _context3.sent;
this.data = response.data;
this.full = response;
return _context3.abrupt("return", response);
case 6:
case "end":
return _context3.stop();
}
}, _callee3, this);
}));
function update() {
return _update.apply(this, arguments);
}
return update;

@@ -184,3 +156,2 @@ }()

*/
}, {

@@ -192,26 +163,20 @@ key: "delete",

return _regenerator.default.wrap(function _callee4$(_context4) {
while (1) {
switch (_context4.prev = _context4.next) {
case 0:
_context4.next = 2;
return this.store.delete(this.collection, this.id);
case 2:
response = _context4.sent;
this.data = null;
this.full = null;
return _context4.abrupt("return", response);
case 6:
case "end":
return _context4.stop();
}
while (1) switch (_context4.prev = _context4.next) {
case 0:
_context4.next = 2;
return this.store.delete(this.collection, this.id);
case 2:
response = _context4.sent;
this.data = null;
this.full = null;
return _context4.abrupt("return", response);
case 6:
case "end":
return _context4.stop();
}
}, _callee4, this);
}));
function _delete() {
return _delete2.apply(this, arguments);
}
return _delete;

@@ -222,5 +187,3 @@ }()

}();
exports.CollectionEntry = CollectionEntry;
var Collections = /*#__PURE__*/function () {

@@ -245,3 +208,2 @@ /**

}
(0, _createClass2.default)(Collections, [{

@@ -252,2 +214,3 @@ key: "entry",

}
/**

@@ -263,3 +226,2 @@ * get item from collection

*/
}, {

@@ -271,29 +233,23 @@ key: "get",

return _regenerator.default.wrap(function _callee5$(_context5) {
while (1) {
switch (_context5.prev = _context5.next) {
case 0:
_context5.next = 2;
return this.client.get({
url: this.buildURL(collection, itemId),
token: this.token
});
case 2:
response = _context5.sent;
entry = this.entry(response.collection, response.id, response.data);
entry.full = response;
return _context5.abrupt("return", entry);
case 6:
case "end":
return _context5.stop();
}
while (1) switch (_context5.prev = _context5.next) {
case 0:
_context5.next = 2;
return this.client.get({
url: this.buildURL(collection, itemId),
token: this.token
});
case 2:
response = _context5.sent;
entry = this.entry(response.collection, response.id, response.data);
entry.full = response;
return _context5.abrupt("return", entry);
case 6:
case "end":
return _context5.stop();
}
}, _callee5, this);
}));
function get(_x, _x2) {
return _get2.apply(this, arguments);
}
return get;

@@ -312,3 +268,2 @@ }()

*/
}, {

@@ -320,33 +275,27 @@ key: "add",

return _regenerator.default.wrap(function _callee6$(_context6) {
while (1) {
switch (_context6.prev = _context6.next) {
case 0:
_context6.next = 2;
return this.client.post({
url: this.buildURL(collection),
body: {
id: itemId === null ? undefined : itemId,
data: itemData
},
token: this.token
});
case 2:
response = _context6.sent;
entry = this.entry(response.collection, response.id, response.data);
entry.full = response;
return _context6.abrupt("return", entry);
case 6:
case "end":
return _context6.stop();
}
while (1) switch (_context6.prev = _context6.next) {
case 0:
_context6.next = 2;
return this.client.post({
url: this.buildURL(collection),
body: {
id: itemId === null ? undefined : itemId,
data: itemData
},
token: this.token
});
case 2:
response = _context6.sent;
entry = this.entry(response.collection, response.id, response.data);
entry.full = response;
return _context6.abrupt("return", entry);
case 6:
case "end":
return _context6.stop();
}
}, _callee6, this);
}));
function add(_x3, _x4, _x5) {
return _add2.apply(this, arguments);
}
return add;

@@ -366,3 +315,2 @@ }()

*/
}, {

@@ -374,32 +322,26 @@ key: "update",

return _regenerator.default.wrap(function _callee7$(_context7) {
while (1) {
switch (_context7.prev = _context7.next) {
case 0:
_context7.next = 2;
return this.client.put({
url: this.buildURL(collection, entryId),
body: {
data: data
},
token: this.token
});
case 2:
response = _context7.sent;
entry = this.entry(response.collection, response.id, response.data);
entry.full = response;
return _context7.abrupt("return", entry);
case 6:
case "end":
return _context7.stop();
}
while (1) switch (_context7.prev = _context7.next) {
case 0:
_context7.next = 2;
return this.client.put({
url: this.buildURL(collection, entryId),
body: {
data: data
},
token: this.token
});
case 2:
response = _context7.sent;
entry = this.entry(response.collection, response.id, response.data);
entry.full = response;
return _context7.abrupt("return", entry);
case 6:
case "end":
return _context7.stop();
}
}, _callee7, this);
}));
function update(_x6, _x7, _x8) {
return _update2.apply(this, arguments);
}
return update;

@@ -417,3 +359,2 @@ }()

*/
}, {

@@ -427,2 +368,3 @@ key: "delete",

}
/**

@@ -437,3 +379,2 @@ * Upsert one or more items within a collection.

*/
}, {

@@ -445,3 +386,2 @@ key: "upsert",

}
if (!Array.isArray(data)) data = [data];

@@ -457,2 +397,3 @@ return this.client.post({

}
/**

@@ -467,3 +408,2 @@ * UpsertMany one or more items into many collections.

*/
}, {

@@ -475,3 +415,2 @@ key: "upsertMany",

}
return this.client.post({

@@ -486,2 +425,3 @@ url: 'collections/',

}
/**

@@ -496,3 +436,2 @@ * Select all objects with ids from the collection.

*/
}, {

@@ -504,3 +443,2 @@ key: "select",

}
if (!Array.isArray(ids)) ids = [ids];

@@ -518,2 +456,3 @@ return this.client.get({

}
/**

@@ -528,3 +467,2 @@ * Remove all objects by id from the collection.

*/
}, {

@@ -536,3 +474,2 @@ key: "deleteMany",

}
if (!Array.isArray(ids)) ids = [ids];

@@ -555,3 +492,2 @@ var params = {

}();
exports.Collections = Collections;

@@ -7,5 +7,3 @@ "use strict";

exports.connect = connect;
var _client = require("./client");
/**

@@ -36,3 +34,2 @@ * Create StreamClient

var _process$env;
if (typeof process !== 'undefined' && (_process$env = process.env) !== null && _process$env !== void 0 && _process$env.STREAM_URL && !apiKey) {

@@ -44,7 +41,5 @@ var parts = /https:\/\/(\w+):(\w+)@([\w-]*).*\?app_id=(\d+)/.exec(process.env.STREAM_URL) || [];

appId = parts[4];
if (options === undefined) {
options = {};
}
if (location !== 'getstream' && location !== 'stream-io-api') {

@@ -54,4 +49,3 @@ options.location = location;

}
return new _client.StreamClient(apiKey, apiSecret, appId, options);
}
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -9,25 +8,15 @@ value: true

exports.StreamApiError = exports.SiteError = exports.MissingSchemaError = exports.FeedError = void 0;
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var canCapture = typeof Error.captureStackTrace === 'function';
var canStack = !!new Error().stack;
/**

@@ -39,11 +28,7 @@ * Abstract error object

*/
var ErrorAbstract = /*#__PURE__*/function (_Error) {
(0, _inherits2.default)(ErrorAbstract, _Error);
var _super = _createSuper(ErrorAbstract);
function ErrorAbstract(msg) {
var _this;
(0, _classCallCheck2.default)(this, ErrorAbstract);

@@ -53,3 +38,2 @@ _this = _super.call(this, msg);

_this.message = msg;
if (canCapture) {

@@ -62,6 +46,4 @@ Error.captureStackTrace((0, _assertThisInitialized2.default)(_this), ErrorAbstract.constructor);

}
return _this;
}
return (0, _createClass2.default)(ErrorAbstract);

@@ -77,9 +59,5 @@ }( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));

*/
var FeedError = /*#__PURE__*/function (_ErrorAbstract) {
(0, _inherits2.default)(FeedError, _ErrorAbstract);
var _super2 = _createSuper(FeedError);
function FeedError() {

@@ -89,3 +67,2 @@ (0, _classCallCheck2.default)(this, FeedError);

}
return (0, _createClass2.default)(FeedError);

@@ -101,11 +78,6 @@ }(ErrorAbstract);

*/
exports.FeedError = FeedError;
var SiteError = /*#__PURE__*/function (_ErrorAbstract2) {
(0, _inherits2.default)(SiteError, _ErrorAbstract2);
var _super3 = _createSuper(SiteError);
function SiteError() {

@@ -115,3 +87,2 @@ (0, _classCallCheck2.default)(this, SiteError);

}
return (0, _createClass2.default)(SiteError);

@@ -127,11 +98,6 @@ }(ErrorAbstract);

*/
exports.SiteError = SiteError;
var MissingSchemaError = /*#__PURE__*/function (_ErrorAbstract3) {
(0, _inherits2.default)(MissingSchemaError, _ErrorAbstract3);
var _super4 = _createSuper(MissingSchemaError);
function MissingSchemaError() {

@@ -141,3 +107,2 @@ (0, _classCallCheck2.default)(this, MissingSchemaError);

}
return (0, _createClass2.default)(MissingSchemaError);

@@ -155,14 +120,8 @@ }(ErrorAbstract);

*/
exports.MissingSchemaError = MissingSchemaError;
var StreamApiError = /*#__PURE__*/function (_ErrorAbstract4) {
(0, _inherits2.default)(StreamApiError, _ErrorAbstract4);
var _super5 = _createSuper(StreamApiError);
function StreamApiError(msg, data, response) {
var _this2;
(0, _classCallCheck2.default)(this, StreamApiError);

@@ -176,6 +135,4 @@ _this2 = _super5.call(this, msg);

}
return (0, _createClass2.default)(StreamApiError);
}(ErrorAbstract);
exports.StreamApiError = StreamApiError;

@@ -7,7 +7,7 @@ /// <reference path="../types/modules.d.ts" />

import { CollectionResponse } from './collections';
export declare type FollowStatsOptions = {
export type FollowStatsOptions = {
followerSlugs?: string[];
followingSlugs?: string[];
};
export declare type EnrichOptions = {
export type EnrichOptions = {
enrich?: boolean;

@@ -22,3 +22,3 @@ ownReactions?: boolean;

};
export declare type FeedPaginationOptions = {
export type FeedPaginationOptions = {
id_gt?: string;

@@ -30,3 +30,3 @@ id_gte?: string;

};
export declare type RankedFeedOptions = {
export type RankedFeedOptions = {
offset?: number;

@@ -36,11 +36,11 @@ ranking?: string;

};
export declare type NotificationFeedOptions = {
export type NotificationFeedOptions = {
mark_read?: boolean | 'current' | string[];
mark_seen?: boolean | 'current' | string[];
};
export declare type FeedContextOptions = {
export type FeedContextOptions = {
user_id?: string;
};
export declare type GetFeedOptions = FeedPaginationOptions & EnrichOptions & RankedFeedOptions & NotificationFeedOptions & FeedContextOptions;
export declare type GetFollowOptions = {
export type GetFeedOptions = FeedPaginationOptions & EnrichOptions & RankedFeedOptions & NotificationFeedOptions & FeedContextOptions;
export type GetFollowOptions = {
filter?: string[];

@@ -50,3 +50,3 @@ limit?: number;

};
export declare type GetFollowAPIResponse = APIResponse & {
export type GetFollowAPIResponse = APIResponse & {
results: {

@@ -59,3 +59,3 @@ created_at: string;

};
export declare type FollowStatsAPIResponse = APIResponse & {
export type FollowStatsAPIResponse = APIResponse & {
results: {

@@ -72,3 +72,3 @@ followers: {

};
declare type BaseActivity = {
type BaseActivity = {
verb: string;

@@ -78,3 +78,3 @@ target?: string;

};
export declare type NewActivity<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = StreamFeedGenerics['activityType'] & BaseActivity & {
export type NewActivity<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = StreamFeedGenerics['activityType'] & BaseActivity & {
actor: string | StreamUser;

@@ -85,3 +85,3 @@ object: string | unknown;

};
export declare type UpdateActivity<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = StreamFeedGenerics['activityType'] & BaseActivity & {
export type UpdateActivity<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = StreamFeedGenerics['activityType'] & BaseActivity & {
actor: string;

@@ -92,3 +92,3 @@ foreign_id: string;

};
export declare type Activity<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = StreamFeedGenerics['activityType'] & BaseActivity & {
export type Activity<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = StreamFeedGenerics['activityType'] & BaseActivity & {
actor: string;

@@ -104,4 +104,4 @@ foreign_id: string;

};
export declare type ReactionsRecords<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = Record<string, EnrichedReaction<StreamFeedGenerics>[]>;
export declare type EnrichedActivity<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = StreamFeedGenerics['activityType'] & BaseActivity & Pick<Activity, 'foreign_id' | 'id' | 'time' | 'analytics' | 'extra_context' | 'origin' | 'score'> & {
export type ReactionsRecords<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = Record<string, EnrichedReaction<StreamFeedGenerics>[]>;
export type EnrichedActivity<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = StreamFeedGenerics['activityType'] & BaseActivity & Pick<Activity, 'foreign_id' | 'id' | 'time' | 'analytics' | 'extra_context' | 'origin' | 'score'> & {
actor: EnrichedUser<StreamFeedGenerics> | string;

@@ -120,5 +120,5 @@ object: string | unknown | EnrichedActivity<StreamFeedGenerics> | EnrichedReaction<StreamFeedGenerics> | CollectionResponse<StreamFeedGenerics>;

};
export declare type FlatActivity<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = Activity<StreamFeedGenerics>;
export declare type FlatActivityEnriched<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = EnrichedActivity<StreamFeedGenerics>;
declare type BaseAggregatedActivity = {
export type FlatActivity<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = Activity<StreamFeedGenerics>;
export type FlatActivityEnriched<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = EnrichedActivity<StreamFeedGenerics>;
type BaseAggregatedActivity = {
activity_count: number;

@@ -133,15 +133,15 @@ actor_count: number;

};
export declare type AggregatedActivity<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = BaseAggregatedActivity & {
export type AggregatedActivity<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = BaseAggregatedActivity & {
activities: Activity<StreamFeedGenerics>[];
};
export declare type AggregatedActivityEnriched<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = BaseAggregatedActivity & {
export type AggregatedActivityEnriched<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = BaseAggregatedActivity & {
activities: EnrichedActivity<StreamFeedGenerics>[];
};
declare type BaseNotificationActivity = {
type BaseNotificationActivity = {
is_read: boolean;
is_seen: boolean;
};
export declare type NotificationActivity<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = AggregatedActivity<StreamFeedGenerics> & BaseNotificationActivity;
export declare type NotificationActivityEnriched<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = BaseNotificationActivity & AggregatedActivityEnriched<StreamFeedGenerics>;
export declare type FeedAPIResponse<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = APIResponse & {
export type NotificationActivity<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = AggregatedActivity<StreamFeedGenerics> & BaseNotificationActivity;
export type NotificationActivityEnriched<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = BaseNotificationActivity & AggregatedActivityEnriched<StreamFeedGenerics>;
export type FeedAPIResponse<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = APIResponse & {
next: string;

@@ -152,3 +152,3 @@ results: FlatActivity<StreamFeedGenerics>[] | FlatActivityEnriched<StreamFeedGenerics>[] | AggregatedActivity<StreamFeedGenerics>[] | AggregatedActivityEnriched<StreamFeedGenerics>[] | NotificationActivity<StreamFeedGenerics>[] | NotificationActivityEnriched<StreamFeedGenerics>[];

};
export declare type PersonalizationFeedAPIResponse<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = APIResponse & {
export type PersonalizationFeedAPIResponse<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = APIResponse & {
limit: number;

@@ -160,6 +160,6 @@ next: string;

};
export declare type GetActivitiesAPIResponse<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = APIResponse & {
export type GetActivitiesAPIResponse<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = APIResponse & {
results: FlatActivity<StreamFeedGenerics>[] | FlatActivityEnriched<StreamFeedGenerics>[];
};
export declare type ToTargetUpdate = {
export type ToTargetUpdate = {
foreignId: string;

@@ -166,0 +166,0 @@ time: string;

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -9,19 +8,10 @@ value: true

exports.StreamFeed = void 0;
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _user = require("./user");
var _errors = require("./errors");
var _utils = _interopRequireDefault(require("./utils"));
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } /// <reference path="../types/modules.d.ts" />
/**

@@ -53,20 +43,15 @@ * Manage api calls for specific feeds

(0, _defineProperty2.default)(this, "notificationChannel", void 0);
if (!feedSlug || !userId) {
throw new _errors.FeedError('Please provide a feed slug and user id, ie client.feed("user", "1")');
}
if (feedSlug.indexOf(':') !== -1) {
throw new _errors.FeedError('Please initialize the feed using client.feed("user", "1") not client.feed("user:1")');
}
_utils.default.validateFeedSlug(feedSlug);
_utils.default.validateUserId(userId);
_utils.default.validateUserId(userId); // raise an error if there is no token
// raise an error if there is no token
if (!token) {
throw new _errors.FeedError('Missing token, in client side mode please provide a feed secret');
}
this.client = client;

@@ -78,6 +63,8 @@ this.slug = feedSlug;

this.feedUrl = this.id.replace(':', '/');
this.feedTogether = this.id.replace(':', ''); // faye setup
this.feedTogether = this.id.replace(':', '');
// faye setup
this.notificationChannel = "site-".concat(this.client.appId, "-feed-").concat(this.feedTogether);
}
/**

@@ -91,4 +78,2 @@ * Adds the given activity to the feed

*/
(0, _createClass2.default)(StreamFeed, [{

@@ -98,7 +83,5 @@ key: "addActivity",

activity = _utils.default.replaceStreamObjects(activity);
if (!activity.actor && this.client.currentUser) {
activity.actor = this.client.currentUser.ref();
}
return this.client.post({

@@ -110,2 +93,3 @@ url: "feed/".concat(this.feedUrl, "/"),

}
/**

@@ -121,3 +105,2 @@ * Removes the activity by activityId or foreignId

*/
}, {

@@ -135,2 +118,3 @@ key: "removeActivity",

}
/**

@@ -144,3 +128,2 @@ * Adds the given activities to the feed

*/
}, {

@@ -157,2 +140,3 @@ key: "addActivities",

}
/**

@@ -172,3 +156,2 @@ * Follows the given target feed

*/
}, {

@@ -178,11 +161,7 @@ key: "follow",

var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
if (targetUserId instanceof _user.StreamUser) {
targetUserId = targetUserId.id;
}
_utils.default.validateFeedSlug(targetSlug);
_utils.default.validateUserId(targetUserId);
var body = {

@@ -198,2 +177,3 @@ target: "".concat(targetSlug, ":").concat(targetUserId)

}
/**

@@ -212,3 +192,2 @@ * Unfollow the given feed

*/
}, {

@@ -220,7 +199,4 @@ key: "unfollow",

if (typeof options.keepHistory === 'boolean' && options.keepHistory) qs.keep_history = '1';
_utils.default.validateFeedSlug(targetSlug);
_utils.default.validateUserId(targetUserId);
var targetFeedId = "".concat(targetSlug, ":").concat(targetUserId);

@@ -233,2 +209,3 @@ return this.client.delete({

}
/**

@@ -246,3 +223,2 @@ * List which feeds this feed is following

*/
}, {

@@ -260,2 +236,3 @@ key: "following",

}
/**

@@ -273,3 +250,2 @@ * List the followers of this feed

*/
}, {

@@ -287,2 +263,3 @@ key: "followers",

}
/**

@@ -300,3 +277,2 @@ * Retrieve the number of follower and following feed stats of the current feed.

*/
}, {

@@ -318,2 +294,3 @@ key: "followStats",

}
/**

@@ -329,3 +306,2 @@ * Reads the feed

*/
}, {

@@ -336,11 +312,8 @@ key: "get",

var extraOptions = {};
if (options.mark_read && options.mark_read.join) {
extraOptions.mark_read = options.mark_read.join(',');
}
if (options.mark_seen && options.mark_seen.join) {
extraOptions.mark_seen = options.mark_seen.join(',');
}
this.client.replaceReactionOptions(options);

@@ -354,2 +327,3 @@ var path = this.client.shouldUseEnrichEndpoint(options) ? 'enrich/feed/' : 'feed/';

}
/**

@@ -368,3 +342,2 @@ * Retrieves one activity from a feed and adds enrichment

*/
}, {

@@ -379,2 +352,3 @@ key: "getActivityDetail",

}
/**

@@ -387,3 +361,2 @@ * Returns the current faye client object

*/
}, {

@@ -394,2 +367,3 @@ key: "getFayeClient",

}
/**

@@ -407,3 +381,2 @@ * Subscribes to any changes in the feed, return a promise

*/
}, {

@@ -415,3 +388,2 @@ key: "subscribe",

}
var subscription = this.getFayeClient().subscribe("/".concat(this.notificationChannel), callback);

@@ -425,2 +397,3 @@ this.client.subscriptions["/".concat(this.notificationChannel)] = {

}
/**

@@ -431,3 +404,2 @@ * Cancel updates created via feed.subscribe()

*/
}, {

@@ -437,3 +409,2 @@ key: "unsubscribe",

var streamSubscription = this.client.subscriptions["/".concat(this.notificationChannel)];
if (streamSubscription) {

@@ -449,7 +420,5 @@ delete this.client.subscriptions["/".concat(this.notificationChannel)];

if (!time) throw new Error('Missing `time` parameter!');
if (!newTargets && !addedTargets && !removedTargets) {
throw new Error('Requires you to provide at least one parameter for `newTargets`, `addedTargets`, or `removedTargets` - example: `updateActivityToTargets("foreignID:1234", new Date(), [newTargets...], [addedTargets...], [removedTargets...])`');
}
if (newTargets) {

@@ -460,3 +429,2 @@ if (addedTargets || removedTargets) {

}
if (addedTargets && removedTargets) {

@@ -471,2 +439,3 @@ // brute force - iterate through added, check to see if removed contains that element

}
/**

@@ -481,3 +450,2 @@ * Updates an activity's "to" fields

*/
}, {

@@ -493,4 +461,5 @@ key: "updateActivityToTargets",

}]);
} // NOTE: it can change without notice
}
// NOTE: it can change without notice
}, {

@@ -502,10 +471,6 @@ key: "_updateActivityToTargetsMany",

}
var body = [];
for (var i = 0; i < inputs.length; i++) {
var input = inputs[i];
this._validateToTargetInput(input.foreignId, input.time, input.newTargets, input.addedTargets, input.removedTargets);
var item = {

@@ -520,3 +485,2 @@ foreign_id: input.foreignId,

}
return this.client.post({

@@ -531,3 +495,2 @@ url: "feed_targets/".concat(this.feedUrl, "/activity_to_targets/"),

}();
exports.StreamFeed = StreamFeed;
/// <reference types="node" />
import { StreamClient, OnUploadProgress } from './client';
/// <reference types="node" />
import { AxiosProgressEvent } from 'axios';
import { StreamClient } from './client';
export declare class StreamFileStore {

@@ -16,3 +18,3 @@ client: StreamClient;

*/
upload(uri: string | File | Buffer | NodeJS.ReadStream, name?: string, contentType?: string, onUploadProgress?: OnUploadProgress): Promise<import("./client").FileUploadAPIResponse>;
upload(uri: string | File | Buffer | NodeJS.ReadStream, name?: string, contentType?: string, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): Promise<import("./client").FileUploadAPIResponse>;
/**

@@ -19,0 +21,0 @@ * delete an uploaded file

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -9,9 +8,5 @@ value: true

exports.StreamFileStore = void 0;
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var StreamFileStore = /*#__PURE__*/function () {

@@ -24,5 +19,6 @@ function StreamFileStore(client, token) {

this.token = token;
} // React Native does not auto-detect MIME type, you need to pass that via contentType
}
// React Native does not auto-detect MIME type, you need to pass that via contentType
// param. If you don't then Android will refuse to perform the upload
/**

@@ -37,4 +33,2 @@ * upload a File instance or a readable stream of data

*/
(0, _createClass2.default)(StreamFileStore, [{

@@ -45,2 +39,3 @@ key: "upload",

}
/**

@@ -51,3 +46,2 @@ * delete an uploaded file

*/
}, {

@@ -67,3 +61,2 @@ key: "delete",

}();
exports.StreamFileStore = StreamFileStore;
/// <reference types="node" />
import { StreamClient, FileUploadAPIResponse, OnUploadProgress } from './client';
export declare type ImageProcessOptions = {
/// <reference types="node" />
import { AxiosProgressEvent } from 'axios';
import { StreamClient, FileUploadAPIResponse } from './client';
export type ImageProcessOptions = {
crop?: string | 'top' | 'bottom' | 'left' | 'right' | 'center';

@@ -22,3 +24,3 @@ h?: number | string;

*/
upload(uri: string | File | Buffer | NodeJS.ReadStream, name?: string, contentType?: string, onUploadProgress?: OnUploadProgress): Promise<FileUploadAPIResponse>;
upload(uri: string | File | Buffer | NodeJS.ReadStream, name?: string, contentType?: string, onUploadProgress?: (progressEvent: AxiosProgressEvent) => void): Promise<FileUploadAPIResponse>;
/**

@@ -25,0 +27,0 @@ * delete an uploaded image

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -9,11 +8,6 @@ value: true

exports.StreamImageStore = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var StreamImageStore = /*#__PURE__*/function () {

@@ -26,5 +20,6 @@ function StreamImageStore(client, token) {

this.token = token;
} // React Native does not auto-detect MIME type, you need to pass that via contentType
}
// React Native does not auto-detect MIME type, you need to pass that via contentType
// param. If you don't then Android will refuse to perform the upload
/**

@@ -39,4 +34,2 @@ * upload an Image File instance or a readable stream of data

*/
(0, _createClass2.default)(StreamImageStore, [{

@@ -47,2 +40,3 @@ key: "upload",

}
/**

@@ -53,3 +47,2 @@ * delete an uploaded image

*/
}, {

@@ -66,2 +59,3 @@ key: "delete",

}
/**

@@ -73,3 +67,2 @@ * Generate a diffrent variant of the uploaded image

*/
}, {

@@ -81,7 +74,5 @@ key: "process",

});
if (Array.isArray(params.crop)) {
params.crop = params.crop.join(',');
}
return this.client.get({

@@ -93,2 +84,3 @@ url: "images/",

}
/**

@@ -102,3 +94,2 @@ * Generate a thumbnail for a given image

*/
}, {

@@ -108,8 +99,7 @@ key: "thumbnail",

var _ref = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {
crop: 'center',
resize: 'clip'
},
crop = _ref.crop,
resize = _ref.resize;
crop: 'center',
resize: 'clip'
},
crop = _ref.crop,
resize = _ref.resize;
return this.process(uri, {

@@ -125,3 +115,2 @@ w: w,

}();
exports.StreamImageStore = StreamImageStore;

@@ -6,5 +6,3 @@ "use strict";

});
var _connect = require("./connect");
Object.keys(_connect).forEach(function (key) {

@@ -20,5 +18,3 @@ if (key === "default" || key === "__esModule") return;

});
var _client = require("./client");
Object.keys(_client).forEach(function (key) {

@@ -34,5 +30,3 @@ if (key === "default" || key === "__esModule") return;

});
var _collections = require("./collections");
Object.keys(_collections).forEach(function (key) {

@@ -48,5 +42,3 @@ if (key === "default" || key === "__esModule") return;

});
var _feed = require("./feed");
Object.keys(_feed).forEach(function (key) {

@@ -62,5 +54,3 @@ if (key === "default" || key === "__esModule") return;

});
var _files = require("./files");
Object.keys(_files).forEach(function (key) {

@@ -76,5 +66,3 @@ if (key === "default" || key === "__esModule") return;

});
var _images = require("./images");
Object.keys(_images).forEach(function (key) {

@@ -90,5 +78,3 @@ if (key === "default" || key === "__esModule") return;

});
var _personalization = require("./personalization");
Object.keys(_personalization).forEach(function (key) {

@@ -104,5 +90,3 @@ if (key === "default" || key === "__esModule") return;

});
var _reaction = require("./reaction");
Object.keys(_reaction).forEach(function (key) {

@@ -118,5 +102,3 @@ if (key === "default" || key === "__esModule") return;

});
var _user = require("./user");
Object.keys(_user).forEach(function (key) {

@@ -132,5 +114,3 @@ if (key === "default" || key === "__esModule") return;

});
var _batch_operations = require("./batch_operations");
Object.keys(_batch_operations).forEach(function (key) {

@@ -146,5 +126,3 @@ if (key === "default" || key === "__esModule") return;

});
var _errors = require("./errors");
Object.keys(_errors).forEach(function (key) {

@@ -160,5 +138,3 @@ if (key === "default" || key === "__esModule") return;

});
var _signing = require("./signing");
Object.keys(_signing).forEach(function (key) {

@@ -165,0 +141,0 @@ if (key === "default" || key === "__esModule") return;

@@ -7,3 +7,3 @@ import { StreamClient, APIResponse, UR, DefaultGenerics } from './client';

*/
export declare type PersonalizationAPIResponse<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = APIResponse & {
export type PersonalizationAPIResponse<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = APIResponse & {
app_id: string;

@@ -10,0 +10,0 @@ next: string;

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -9,9 +8,5 @@ value: true

exports.Personalization = void 0;
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
/**

@@ -35,2 +30,3 @@ * Manage api calls for personalization

}
/**

@@ -46,4 +42,2 @@ * Get personalized activities for this feed

*/
(0, _createClass2.default)(Personalization, [{

@@ -60,2 +54,3 @@ key: "get",

}
/**

@@ -72,3 +67,2 @@ * Post data to personalization endpoint

*/
}, {

@@ -87,2 +81,3 @@ key: "post",

}
/**

@@ -98,3 +93,2 @@ * Delete metadata or activities

*/
}, {

@@ -114,3 +108,2 @@ key: "delete",

}();
exports.Personalization = Personalization;
import { StreamClient, APIResponse, UR, DefaultGenerics } from './client';
import { StreamFeed } from './feed';
import { EnrichedUser } from './user';
export declare type TargetFeeds = (string | StreamFeed)[];
export declare type TargetFeed = string | StreamFeed;
export declare type TargetFeedsExtraData = Record<string, unknown>;
export declare type Reaction<T extends UR = UR> = {
export type TargetFeeds = (string | StreamFeed)[];
export type TargetFeed = string | StreamFeed;
export type TargetFeedsExtraData = Record<string, unknown>;
export type Reaction<T extends UR = UR> = {
activity_id: string;

@@ -19,5 +19,5 @@ created_at: string;

};
export declare type ReactionAPIResponse<T extends UR = UR> = APIResponse & Reaction<T>;
export declare type ChildReactionsRecords<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = Record<string, EnrichedReaction<StreamFeedGenerics>[]>;
export declare type EnrichedReaction<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = Reaction<StreamFeedGenerics['reactionType'] | StreamFeedGenerics['childReactionType']> & {
export type ReactionAPIResponse<T extends UR = UR> = APIResponse & Reaction<T>;
export type ChildReactionsRecords<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = Record<string, EnrichedReaction<StreamFeedGenerics>[]>;
export type EnrichedReaction<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = Reaction<StreamFeedGenerics['reactionType'] | StreamFeedGenerics['childReactionType']> & {
children_counts: Record<string, number>;

@@ -31,4 +31,4 @@ latest_children: ChildReactionsRecords<StreamFeedGenerics>;

};
export declare type EnrichedReactionAPIResponse<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = APIResponse & EnrichedReaction<StreamFeedGenerics>;
export declare type ReactionFilterAPIResponse<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = APIResponse & {
export type EnrichedReactionAPIResponse<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = APIResponse & EnrichedReaction<StreamFeedGenerics>;
export type ReactionFilterAPIResponse<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = APIResponse & {
next: string;

@@ -38,3 +38,3 @@ results: ReactionAPIResponse<StreamFeedGenerics['reactionType'] | StreamFeedGenerics['childReactionType']>[] | EnrichedReactionAPIResponse<StreamFeedGenerics>[];

};
export declare type ReactionFilterConditions = {
export type ReactionFilterConditions = {
activity_id?: string;

@@ -54,11 +54,11 @@ children_user_id?: string;

};
export declare type ReactionUpdateOptions = {
export type ReactionUpdateOptions = {
targetFeeds?: TargetFeeds;
targetFeedsExtraData?: TargetFeedsExtraData;
};
export declare type ReactionAddOptions = ReactionUpdateOptions & {
export type ReactionAddOptions = ReactionUpdateOptions & {
id?: string;
userId?: string;
};
export declare type ReactionAddChildOptions = ReactionUpdateOptions & {
export type ReactionAddChildOptions = ReactionUpdateOptions & {
userId?: string;

@@ -65,0 +65,0 @@ };

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -9,15 +8,8 @@ value: true

exports.StreamReaction = void 0;
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _errors = require("./errors");
var _excluded = ["user_id", "activity_id", "reaction_id"];
var StreamReaction = /*#__PURE__*/function () {

@@ -41,3 +33,2 @@ /**

}
return "".concat(['reaction'].concat(args).join('/'), "/");

@@ -54,3 +45,2 @@ });

}
(0, _createClass2.default)(StreamReaction, [{

@@ -78,8 +68,7 @@ key: "add",

var _ref = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
id = _ref.id,
_ref$targetFeeds = _ref.targetFeeds,
targetFeeds = _ref$targetFeeds === void 0 ? [] : _ref$targetFeeds,
userId = _ref.userId,
targetFeedsExtraData = _ref.targetFeedsExtraData;
id = _ref.id,
_ref$targetFeeds = _ref.targetFeeds,
targetFeeds = _ref$targetFeeds === void 0 ? [] : _ref$targetFeeds,
userId = _ref.userId,
targetFeedsExtraData = _ref.targetFeedsExtraData;
var body = {

@@ -93,7 +82,5 @@ id: id,

};
if (targetFeedsExtraData != null) {
body.target_feeds_extra_data = targetFeedsExtraData;
}
return this.client.post({

@@ -105,2 +92,3 @@ url: this.buildURL(),

}
/**

@@ -122,3 +110,2 @@ * add child reaction

*/
}, {

@@ -128,7 +115,6 @@ key: "addChild",

var _ref2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
_ref2$targetFeeds = _ref2.targetFeeds,
targetFeeds = _ref2$targetFeeds === void 0 ? [] : _ref2$targetFeeds,
userId = _ref2.userId,
targetFeedsExtraData = _ref2.targetFeedsExtraData;
_ref2$targetFeeds = _ref2.targetFeeds,
targetFeeds = _ref2$targetFeeds === void 0 ? [] : _ref2$targetFeeds,
userId = _ref2.userId,
targetFeedsExtraData = _ref2.targetFeedsExtraData;
var body = {

@@ -141,7 +127,5 @@ parent: reaction instanceof Object ? reaction.id : reaction,

};
if (targetFeedsExtraData != null) {
body.target_feeds_extra_data = targetFeedsExtraData;
}
return this.client.post({

@@ -153,2 +137,3 @@ url: this.buildURL(),

}
/**

@@ -163,3 +148,2 @@ * get reaction

*/
}, {

@@ -173,2 +157,3 @@ key: "get",

}
/**

@@ -189,3 +174,2 @@ * retrieve reactions by activity_id, user_id or reaction_id (to paginate children reactions), pagination can be done using id_lt, id_lte, id_gt and id_gte parameters

*/
}, {

@@ -195,14 +179,11 @@ key: "filter",

var userId = conditions.user_id,
activityId = conditions.activity_id,
reactionId = conditions.reaction_id,
qs = (0, _objectWithoutProperties2.default)(conditions, _excluded);
activityId = conditions.activity_id,
reactionId = conditions.reaction_id,
qs = (0, _objectWithoutProperties2.default)(conditions, _excluded);
if (!qs.limit) {
qs.limit = 10;
}
if ((userId ? 1 : 0) + (activityId ? 1 : 0) + (reactionId ? 1 : 0) !== 1) {
throw new _errors.SiteError('Must provide exactly one value for one of these params: user_id, activity_id, reaction_id');
}
var lookupType = userId && 'user_id' || activityId && 'activity_id' || reactionId && 'reaction_id';

@@ -217,2 +198,3 @@ var value = userId || activityId || reactionId;

}
/**

@@ -232,3 +214,2 @@ * update reaction

*/
}, {

@@ -238,6 +219,5 @@ key: "update",

var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
_ref3$targetFeeds = _ref3.targetFeeds,
targetFeeds = _ref3$targetFeeds === void 0 ? [] : _ref3$targetFeeds,
targetFeedsExtraData = _ref3.targetFeedsExtraData;
_ref3$targetFeeds = _ref3.targetFeeds,
targetFeeds = _ref3$targetFeeds === void 0 ? [] : _ref3$targetFeeds,
targetFeedsExtraData = _ref3.targetFeedsExtraData;
var body = {

@@ -247,7 +227,5 @@ data: data,

};
if (targetFeedsExtraData != null) {
body.target_feeds_extra_data = targetFeedsExtraData;
}
return this.client.put({

@@ -259,2 +237,3 @@ url: this.buildURL(id),

}
/**

@@ -269,3 +248,2 @@ * delete reaction

*/
}, {

@@ -282,3 +260,2 @@ key: "delete",

}();
exports.StreamReaction = StreamReaction;
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -9,15 +8,8 @@ value: true

exports.default = createRedirectUrl;
var _url = _interopRequireDefault(require("url"));
var _qs = _interopRequireDefault(require("qs"));
var _errors = require("./errors");
var _utils = _interopRequireDefault(require("./utils"));
var _signing = require("./signing");
// TODO: userId is skipped here
/**

@@ -37,7 +29,5 @@ * Creates a redirect url for tracking the given events in the context of

var uri = _url.default.parse(targetUrl);
if (!(uri.host || uri.hostname && uri.port)) {
throw new _errors.MissingSchemaError("Invalid URI: \"".concat(_url.default.format(uri), "\""));
}
var authToken = (0, _signing.JWTScopeToken)(this.apiSecret, 'redirect_and_track', '*', {

@@ -55,6 +45,4 @@ userId: '*',

};
var qString = _utils.default.rfc3986(_qs.default.stringify(kwargs));
return "".concat(analyticsUrl, "?").concat(qString);
}
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -10,11 +9,6 @@ value: true

exports.JWTUserSessionToken = JWTUserSessionToken;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _jsonwebtoken = _interopRequireDefault(require("jsonwebtoken"));
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
// for a claim in jwt

@@ -24,3 +18,2 @@ function joinClaimValue(items) {

var claims = [];
for (var i = 0; i < values.length; i += 1) {

@@ -31,5 +24,5 @@ var s = values[i].trim();

}
return claims.join(',');
}
/**

@@ -49,4 +42,2 @@ * Creates the JWT token for feedId, resource and action using the apiSecret

*/
function JWTScopeToken(apiSecret, resource, action) {

@@ -66,2 +57,3 @@ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};

}
/**

@@ -78,16 +70,11 @@ * Creates the JWT token that can be used for a UserSession

*/
function JWTUserSessionToken(apiSecret, userId) {
var extraData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var jwtOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
if (typeof userId !== 'string') {
throw new TypeError('userId should be a string');
}
var payload = _objectSpread({
user_id: userId
}, extraData);
var opts = _objectSpread({

@@ -97,4 +84,3 @@ algorithm: 'HS256',

}, jwtOptions);
return _jsonwebtoken.default.sign(payload, apiSecret, opts);
}
import { StreamClient, APIResponse, DefaultGenerics } from './client';
export declare type EnrichedUser<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = {
export type EnrichedUser<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = {
created_at: string;

@@ -8,3 +8,3 @@ data: StreamFeedGenerics['userType'];

};
export declare type UserAPIResponse<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = APIResponse & EnrichedUser<StreamFeedGenerics> & {
export type UserAPIResponse<StreamFeedGenerics extends DefaultGenerics = DefaultGenerics> = APIResponse & EnrichedUser<StreamFeedGenerics> & {
followers_count?: number;

@@ -11,0 +11,0 @@ following_count?: number;

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -9,17 +8,9 @@ value: true

exports.StreamUser = void 0;
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var StreamUser = /*#__PURE__*/function () {

@@ -51,2 +42,3 @@ /**

}
/**

@@ -56,4 +48,2 @@ * Create a stream user ref

*/
(0, _createClass2.default)(StreamUser, [{

@@ -64,2 +54,3 @@ key: "ref",

}
/**

@@ -70,3 +61,2 @@ * Delete the user

*/
}, {

@@ -80,2 +70,3 @@ key: "delete",

}
/**

@@ -87,3 +78,2 @@ * Get the user data

*/
}, {

@@ -95,31 +85,25 @@ key: "get",

return _regenerator.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return this.client.get({
url: this.url,
token: this.token,
qs: options
});
case 2:
response = _context.sent;
this.full = _objectSpread({}, response);
delete this.full.duration;
this.data = this.full.data;
return _context.abrupt("return", this);
case 7:
case "end":
return _context.stop();
}
while (1) switch (_context.prev = _context.next) {
case 0:
_context.next = 2;
return this.client.get({
url: this.url,
token: this.token,
qs: options
});
case 2:
response = _context.sent;
this.full = _objectSpread({}, response);
delete this.full.duration;
this.data = this.full.data;
return _context.abrupt("return", this);
case 7:
case "end":
return _context.stop();
}
}, _callee, this);
}));
function get(_x) {
return _get.apply(this, arguments);
}
return get;

@@ -134,3 +118,2 @@ }()

*/
}, {

@@ -142,35 +125,29 @@ key: "create",

return _regenerator.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return this.client.post({
url: 'user/',
body: {
id: this.id,
data: data || this.data || {}
},
qs: options,
token: this.token
});
case 2:
response = _context2.sent;
this.full = _objectSpread({}, response);
delete this.full.duration;
this.data = this.full.data;
return _context2.abrupt("return", this);
case 7:
case "end":
return _context2.stop();
}
while (1) switch (_context2.prev = _context2.next) {
case 0:
_context2.next = 2;
return this.client.post({
url: 'user/',
body: {
id: this.id,
data: data || this.data || {}
},
qs: options,
token: this.token
});
case 2:
response = _context2.sent;
this.full = _objectSpread({}, response);
delete this.full.duration;
this.data = this.full.data;
return _context2.abrupt("return", this);
case 7:
case "end":
return _context2.stop();
}
}, _callee2, this);
}));
function create(_x2, _x3) {
return _create.apply(this, arguments);
}
return create;

@@ -184,3 +161,2 @@ }()

*/
}, {

@@ -192,33 +168,27 @@ key: "update",

return _regenerator.default.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return this.client.put({
url: this.url,
body: {
data: data || this.data || {}
},
token: this.token
});
case 2:
response = _context3.sent;
this.full = _objectSpread({}, response);
delete this.full.duration;
this.data = this.full.data;
return _context3.abrupt("return", this);
case 7:
case "end":
return _context3.stop();
}
while (1) switch (_context3.prev = _context3.next) {
case 0:
_context3.next = 2;
return this.client.put({
url: this.url,
body: {
data: data || this.data || {}
},
token: this.token
});
case 2:
response = _context3.sent;
this.full = _objectSpread({}, response);
delete this.full.duration;
this.data = this.full.data;
return _context3.abrupt("return", this);
case 7:
case "end":
return _context3.stop();
}
}, _callee3, this);
}));
function update(_x4) {
return _update.apply(this, arguments);
}
return update;

@@ -232,3 +202,2 @@ }()

*/
}, {

@@ -241,2 +210,3 @@ key: "getOrCreate",

}
/**

@@ -247,3 +217,2 @@ * Get the user profile, it includes the follow counts by default

*/
}, {

@@ -259,3 +228,2 @@ key: "profile",

}();
exports.StreamUser = StreamUser;
/// <reference types="node" />
/// <reference types="node" />
import FormData from 'form-data';

@@ -3,0 +4,0 @@ declare function validateFeedSlug(feedSlug: string): string;

"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {

@@ -9,17 +8,12 @@ value: true

exports.default = void 0;
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
var _formData = _interopRequireDefault(require("form-data"));
var _errors = require("./errors");
var validFeedSlugRe = /^[\w]+$/;
var validUserIdRe = /^[\w-]+$/;
/*
* Validate that the feedSlug matches \w
*/
function validateFeedSlug(feedSlug) {

@@ -29,10 +23,8 @@ if (!validFeedSlugRe.test(feedSlug)) {

}
return feedSlug;
}
/*
* Validate the userId matches \w
*/
function validateUserId(userId) {

@@ -42,6 +34,4 @@ if (!validUserIdRe.test(userId)) {

}
return userId;
}
function rfc3986(str) {

@@ -52,32 +42,27 @@ return str.replace(/[!'()*]/g, function (c) {

}
function isReadableStream(obj) {
return obj !== null && (0, _typeof2.default)(obj) === 'object' && (obj.readable || typeof obj._read === 'function');
}
function isBuffer(obj) {
return obj != null && obj.constructor != null && // @ts-expect-error
typeof obj.constructor.isBuffer === 'function' && // @ts-expect-error
return obj != null && obj.constructor != null &&
// @ts-expect-error
typeof obj.constructor.isBuffer === 'function' &&
// @ts-expect-error
obj.constructor.isBuffer(obj);
}
function isFileWebAPI(uri) {
return typeof window !== 'undefined' && 'File' in window && uri instanceof File;
}
/*
* Validate that the feedId matches the spec user:1
*/
function validateFeedId(feedId) {
var parts = feedId.split(':');
if (parts.length !== 2) {
throw new _errors.FeedError("Invalid feedId, expected something like user:1 got ".concat(feedId));
}
var _parts = (0, _slicedToArray2.default)(parts, 2),
feedSlug = _parts[0],
userId = _parts[1];
feedSlug = _parts[0],
userId = _parts[1];
validateFeedSlug(feedSlug);

@@ -87,6 +72,4 @@ validateUserId(userId);

}
function addFileToFormData(uri, name, contentType) {
var data = new _formData.default();
if (isReadableStream(uri) || isBuffer(uri) || isFileWebAPI(uri)) {

@@ -102,7 +85,6 @@ if (name) data.append('file', uri, name);else data.append('file', uri);

}
return data;
} // TODO: refactor and add proper types
}
// TODO: refactor and add proper types
function replaceStreamObjects(obj) {

@@ -112,6 +94,8 @@ // @ts-expect-error

return replaceStreamObjects(v);
}); // @ts-expect-error
});
if (Object.prototype.toString.call(obj) !== '[object Object]') return obj; // @ts-expect-error
// @ts-expect-error
if (Object.prototype.toString.call(obj) !== '[object Object]') return obj;
// @ts-expect-error
if (typeof obj.ref === 'function') return obj.ref();

@@ -122,7 +106,7 @@ var cloned = {};

cloned[k] = replaceStreamObjects(obj[k]);
}); // @ts-expect-error
});
// @ts-expect-error
return cloned;
}
var _default = {

@@ -129,0 +113,0 @@ validateFeedId: validateFeedId,

@@ -14,3 +14,3 @@ {

"license": "BSD-3-Clause",
"version": "8.1.4",
"version": "8.1.5",
"scripts": {

@@ -28,3 +28,3 @@ "changelog": "standard-version --release-as $VERSION --skip.tag --skip.commit --tag-prefix=v",

"test": "yarn run test-unit-node",
"test-types": "tsc --esModuleInterop true --noEmit true test/typescript/*.ts",
"test-types": "tsc --skipLibCheck --target es2020 --esModuleInterop true --noEmit true test/typescript/*.ts",
"test-unit-node": "mocha --require ./babel-register.js test/unit/common test/unit/node",

@@ -75,9 +75,9 @@ "test-integration-node": "mocha --require ./babel-register.js test/integration/common test/integration/node --exit",

"@babel/register": "^7.16.7",
"@commitlint/cli": "^16.0.2",
"@commitlint/config-conventional": "^16.0.0",
"@commitlint/cli": "^17.6.3",
"@commitlint/config-conventional": "^17.6.3",
"@typescript-eslint/eslint-plugin": "^5.8.1",
"@typescript-eslint/parser": "^5.8.1",
"babel-loader": "^8.2.3",
"babel-loader": "^9.1.2",
"chai": "^4.3.4",
"dotenv": "^10.0.0",
"dotenv": "^16.0.3",
"eslint": "^8.6.0",

@@ -89,6 +89,6 @@ "eslint-config-airbnb-base": "^15.0.0",

"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-sonarjs": "^0.11.0",
"eslint-plugin-sonarjs": "^0.19.0",
"eslint-plugin-typescript-sort-keys": "^2.1.0",
"expect.js": "^0.3.1",
"husky": "^4.3.8",
"husky": "^8.0.3",
"json-loader": "~0.5.7",

@@ -100,5 +100,5 @@ "karma": "^6.3.9",

"karma-sauce-launcher": "^4.3.6",
"karma-sourcemap-loader": "~0.3.8",
"karma-sourcemap-loader": "~0.4.0",
"karma-webpack": "^5.0.0",
"mocha": "^8.3.1",
"mocha": "^10.2.0",
"null-loader": "^4.0.1",

@@ -109,6 +109,6 @@ "nyc": "^15.1.0",

"standard-version": "^9.3.2",
"testdouble": "^3.16.4",
"typescript": "^4.5.4",
"testdouble": "^3.18.0",
"typescript": "^5.0.4",
"webpack": "^5.65.0",
"webpack-cli": "^4.9.1"
"webpack-cli": "^5.1.1"
},

@@ -119,8 +119,10 @@ "dependencies": {

"@types/qs": "^6.9.7",
"axios": "^0.22.0",
"axios": "^1.4.0",
"faye": "^1.4.0",
"follow-redirects": "1.14.8",
"follow-redirects": "1.15.2",
"form-data": "^4.0.0",
"jsonwebtoken": "^9.0.0",
"jwt-decode": "^3.1.2",
"puppeteer": "^20.2.1",
"puppeteer-core": "^20.2.1",
"qs": "^6.10.2"

@@ -142,3 +144,3 @@ },

"engines": {
"node": "10 || 12 || >=14"
"node": ">=16"
},

@@ -145,0 +147,0 @@ "keywords": [

@@ -31,6 +31,2 @@ /// <reference path="../types/modules.d.ts" />

// TODO: no import since typescript json loader shifts the final output structure
// eslint-disable-next-line @typescript-eslint/no-var-requires
const pkg = require('../package.json');
export type UR = Record<string, unknown>;

@@ -404,3 +400,8 @@ export type UnknownRecord = UR; // alias to avoid breaking change

userAgent() {
return `stream-javascript-client-${this.node ? 'node' : 'browser'}-${pkg.version}`;
if (process.env.PACKAGE_VERSION === undefined) {
// eslint-disable-next-line
return `stream-javascript-client-${this.node ? 'node' : 'browser'}-${require('../package.json').version}`;
}
return `stream-javascript-client-${this.node ? 'node' : 'browser'}-${process.env.PACKAGE_VERSION}`;
}

@@ -648,3 +649,3 @@

contentType?: string,
onUploadProgress?: OnUploadProgress,
onUploadProgress?: (progressEvent: axios.AxiosProgressEvent) => void,
) {

@@ -651,0 +652,0 @@ const fd = utils.addFileToFormData(uri, name, contentType);

@@ -1,2 +0,3 @@

import { StreamClient, OnUploadProgress } from './client';
import { AxiosProgressEvent } from 'axios';
import { StreamClient } from './client';

@@ -27,3 +28,3 @@ export class StreamFileStore {

contentType?: string,
onUploadProgress?: OnUploadProgress,
onUploadProgress?: (progressEvent: AxiosProgressEvent) => void,
) {

@@ -30,0 +31,0 @@ return this.client.upload('files/', uri, name, contentType, onUploadProgress);

@@ -1,2 +0,3 @@

import { StreamClient, FileUploadAPIResponse, OnUploadProgress } from './client';
import { AxiosProgressEvent } from 'axios';
import { StreamClient, FileUploadAPIResponse } from './client';

@@ -35,3 +36,3 @@ export type ImageProcessOptions = {

contentType?: string,
onUploadProgress?: OnUploadProgress,
onUploadProgress?: (progressEvent: AxiosProgressEvent) => void,
) {

@@ -38,0 +39,0 @@ return this.client.upload('images/', uri, name, contentType, onUploadProgress);

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc