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

ably

Package Overview
Dependencies
Maintainers
4
Versions
187
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ably - npm Package Compare versions

Comparing version 1.2.49 to 1.2.50

src/.DS_Store

2

package.json
{
"name": "ably",
"description": "Realtime client library for Ably, the realtime messaging service",
"version": "1.2.49",
"version": "1.2.50",
"license": "Apache-2.0",

@@ -6,0 +6,0 @@ "bugs": {

@@ -17,3 +17,3 @@ import { Types } from 'ably';

export declare type ChannelParameters = string | ChannelNameAndOptions;
export declare const version = "1.2.49";
export declare const version = "1.2.50";
export declare function channelOptionsWithAgent(options?: Types.ChannelOptions): {

@@ -20,0 +20,0 @@ params: {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.channelOptionsWithAgent = exports.version = void 0;
exports.version = '1.2.49';
exports.version = '1.2.50';
function channelOptionsWithAgent(options) {

@@ -6,0 +6,0 @@ return Object.assign(Object.assign({}, options), { params: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.params), { agent: `react-hooks/${exports.version}` }) });

@@ -17,3 +17,3 @@ import { Types } from 'ably';

export declare type ChannelParameters = string | ChannelNameAndOptions;
export declare const version = "1.2.49";
export declare const version = "1.2.50";
export declare function channelOptionsWithAgent(options?: Types.ChannelOptions): {

@@ -20,0 +20,0 @@ params: {

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

export const version = '1.2.49';
export const version = '1.2.50';
export function channelOptionsWithAgent(options) {

@@ -3,0 +3,0 @@ return Object.assign(Object.assign({}, options), { params: Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.params), { agent: `react-hooks/${version}` }) });

@@ -289,6 +289,5 @@ import Logger from '../util/logger';

if (_authOptions && 'force' in _authOptions) {
Logger.logAction(
Logger.LOG_ERROR,
'Auth.authorize',
'Deprecation warning: specifying {force: true} in authOptions is no longer necessary, authorize() now always gets a new token. Please remove this, as in version 1.0 and later, having a non-null authOptions will overwrite stored library authOptions, which may not be what you want'
Logger.deprecated(
'The `force` auth option',
'If you’re using this option to force `authorize()` to fetch a new token even if the current token has not expired, this is no longer necessary, as `authorize()` now always fetches a new token. Update your code to no longer pass the `force` auth option. Note that, in general, passing an auth options argument to `authorize()` will overwrite the library’s stored auth options, which may not be what you want. The library currently contains a special case behavior where passing an auth options object which only contains `{ force: true }` will _not_ overwrite the stored options. This special case behavior will be removed alongside support for the `force` option, so if you’re currently passing `authorize()` an auth options object which only contains `{ force: true }`, you should stop passing it an auth options object entirely.'
);

@@ -332,3 +331,3 @@ /* Emulate the old behaviour: if 'force' was the only member of authOptions,

authorise(tokenParams: API.Types.TokenParams | null, authOptions: API.Types.AuthOptions, callback: Function): void {
Logger.deprecated('Auth.authorise', 'Auth.authorize');
Logger.renamedMethod('Auth', 'authorise', 'authorize');
this.authorize(tokenParams, authOptions, callback);

@@ -335,0 +334,0 @@ }

@@ -7,2 +7,3 @@ import * as Utils from '../util/utils';

import Rest from './rest';
import HttpStatusCodes from '../../constants/HttpStatusCodes';

@@ -155,3 +156,3 @@ export type BodyHandler = (body: unknown, headers: Record<string, string>, unpacked?: boolean) => any;

try {
items = this.bodyHandler(body, headers || {}, unpacked);
items = statusCode == HttpStatusCodes.NoContent ? [] : this.bodyHandler(body, headers || {}, unpacked);
} catch (e) {

@@ -158,0 +159,0 @@ /* If we got an error, the failure to parse the body is almost certainly

@@ -319,3 +319,6 @@ import ProtocolMessage from '../types/protocolmessage';

if (_flags) {
Logger.deprecated('channel.attach() with flags', 'channel.setOptions() with channelOptions.params');
Logger.deprecated(
'The ability to pass an array of channel mode flags as the first argument of `RealtimeChannel.attach()`',
'To set channel mode flags, populate the `modes` property of the channel options object that you pass to `Channels.get()` or `RealtimeChannel.setOptions()`.'
);
/* If flags requested, always do a re-attach. TODO only do this if

@@ -322,0 +325,0 @@ * current mode differs from requested mode */

@@ -511,3 +511,3 @@ import * as Utils from '../util/utils';

on(...args: unknown[]): void {
Logger.deprecated('presence.on', 'presence.subscribe');
Logger.renamedMethod('RealtimePresence', 'on', 'subscribe');
this.subscribe(...args);

@@ -518,3 +518,3 @@ }

off(...args: unknown[]): void {
Logger.deprecated('presence.off', 'presence.unsubscribe');
Logger.renamedMethod('RealtimePresence', 'off', 'unsubscribe');
this.unsubscribe(...args);

@@ -521,0 +521,0 @@ }

@@ -9,2 +9,3 @@ import Platform from '../../platform';

import { ErrnoException } from '../../types/http';
import httpStatusCodes from '../../constants/HttpStatusCodes';

@@ -38,2 +39,7 @@ function withAuthDetails(

if (outerStatusCode === httpStatusCodes.NoContent) {
callback(err, [] as any, outerHeaders, true, outerStatusCode);
return;
}
if (!unpacked) {

@@ -40,0 +46,0 @@ try {

@@ -56,3 +56,10 @@ import * as Utils from '../util/utils';

Logger.setLog(optionsObj.log.level, optionsObj.log.handler);
Logger.deprecated(
'The `log` client option',
'Equivalent functionality is provided by the `logLevel` and `logHandler` client options. Update your client options code of the form `{ log: { level: logLevel, handler: logHandler } }` to instead be `{ logLevel, logHandler }`.'
);
} else {
Logger.setLog(optionsObj.logLevel, optionsObj.logHandler);
}
Logger.logAction(Logger.LOG_MICRO, 'Rest()', 'initialized with clientOptions ' + Platform.Config.inspect(options));

@@ -59,0 +66,0 @@

@@ -187,13 +187,19 @@ import Platform from 'common/platform';

if (options.host) {
Logger.deprecated('host', 'restHost');
Logger.renamedClientOption('host', 'restHost');
options.restHost = options.host;
}
if (options.wsHost) {
Logger.deprecated('wsHost', 'realtimeHost');
Logger.renamedClientOption('wsHost', 'realtimeHost');
options.realtimeHost = options.wsHost;
}
if (options.queueEvents) {
Logger.deprecated('queueEvents', 'queueMessages');
Logger.renamedClientOption('queueEvents', 'queueMessages');
options.queueMessages = options.queueEvents;
}
if (options.headers) {
Logger.deprecated(
'the `headers` client option',
'' /* there is no replacement; see DeprecatedClientOptions.headers */
);
}

@@ -217,8 +223,11 @@ if (options.fallbackHostsUseDefault) {

if (options.environment) {
Logger.deprecatedWithMsg(
'fallbackHostsUseDefault',
'There is no longer a need to set this when the environment option is also set since the library will now generate the correct fallback hosts using the environment option.'
Logger.deprecated(
'The `fallbackHostsUseDefault` client option',
'If you’re using this client option to force the library to make use of fallback hosts even though you’ve set the `environment` client option, then this is no longer necessary: remove your usage of the `fallbackHostsUseDefault` client option and the library will then automatically choose the correct fallback hosts to use for the specified environment.'
);
} else {
Logger.deprecated('fallbackHostsUseDefault', 'fallbackHosts: Ably.Defaults.FALLBACK_HOSTS');
Logger.deprecated(
'The `fallbackHostsUseDefault` client option',
'If you’re using this client option to force the library to make use of fallback hosts even though you’re not using the primary Ably environment, then stop using `fallbackHostsUseDefault`, and update your code to either pass the `environment` client option (in which case the library will automatically choose the correct fallback hosts to use for the specified environment), or to pass the `fallbackHosts` client option to specify a custom list of fallback hosts to use (for example, if you’re using a custom CNAME, in which case Ably will have provided you with an explicit list of fallback hosts).'
);
}

@@ -232,3 +241,6 @@

if ((options.recover as any) === true) {
Logger.deprecated('{recover: true}', '{recover: function(lastConnectionDetails, cb) { cb(true); }}');
Logger.deprecated(
'The ability to use a boolean value for the `recover` client option',
'If you wish for the connection to always be recovered, replace `{ recover: true }` with a function that always passes `true` to its callback: `{ recover: function(lastConnectionDetails, cb) { cb(true); } }`'
);
options.recover = function (lastConnectionDetails: unknown, cb: (shouldRecover: boolean) => void) {

@@ -255,3 +267,5 @@ cb(true);

if (options.transports && Utils.arrIn(options.transports, 'xhr')) {
Logger.deprecated('transports: ["xhr"]', 'transports: ["xhr_streaming"]');
Logger.deprecationWarning(
'The "xhr" transport has been renamed to "xhr_streaming". Please update your client options code to use `transports: ["xhr_streaming"]` instead. The ability to use `transports: ["xhr"]` will be removed in a future version.'
);
Utils.arrDeleteValue(options.transports, 'xhr');

@@ -258,0 +272,0 @@ options.transports.push('xhr_streaming');

@@ -107,13 +107,23 @@ import Platform from 'common/platform';

static deprecated = function (original: string, replacement: string) {
Logger.deprecatedWithMsg(original, "Please use '" + replacement + "' instead.");
static deprecated = (description: string, msg: string) => {
Logger.deprecationWarning(`${description} is deprecated and will be removed in a future version. ${msg}`);
};
static deprecatedWithMsg = (funcName: string, msg: string) => {
static renamedClientOption(oldName: string, newName: string) {
Logger.deprecationWarning(
`The \`${oldName}\` client option has been renamed to \`${newName}\`. Please update your code to use \`${newName}\` instead. \`${oldName}\` will be removed in a future version.`
);
}
static renamedMethod(className: string, oldName: string, newName: string) {
Logger.deprecationWarning(
`\`${className}\`’s \`${oldName}\` method has been renamed to \`${newName}\`. Please update your code to use \`${newName}\` instead. \`${oldName}\` will be removed in a future version.`
);
}
static deprecationWarning(message: string) {
if (Logger.shouldLog(LogLevels.Error)) {
Logger.logErrorHandler(
"Ably: Deprecation warning - '" + funcName + "' is deprecated and will be removed from a future version. " + msg
);
Logger.logErrorHandler(`Ably: Deprecation warning - ${message}`);
}
};
}

@@ -120,0 +130,0 @@ /* Where a logging operation is expensive, such as serialisation of data, use shouldLog will prevent

@@ -22,4 +22,6 @@ import { Modify } from './utils';

promises?: boolean;
/**
* This option dates back to the initial commit of the repo but was never in the specification and sounds like nobody is depending on it; Paddy said we can remove in v2 (see https://ably-real-time.slack.com/archives/CURL4U2FP/p1709909310332169?thread_ts=1709908997.753599&cid=CURL4U2FP)
*/
headers?: Record<string, string>;
maxMessageSize?: number;
}

@@ -26,0 +28,0 @@ >;

@@ -132,4 +132,13 @@ 'use strict';

if (typeof params === 'function' || typeof params === 'string') {
Logger.deprecated('Crypto.getDefaultParams(key, callback)', 'Crypto.getDefaultParams({key: key})');
Logger.deprecated(
'The ability to pass a callback to `Crypto.getDefaultParams()`',
'This method now directly returns its result, instead of returning it asynchronously via a callback. Please update your code so that it uses the return value of this method instead of passing a callback.'
);
if (typeof params === 'function') {
// Called with (callback)
Logger.deprecated(
'The ability to call `Crypto.getDefaultParams()` without specifying an encryption key',
'Please update your code so that it instead passes an object whose `key` property contains an encryption key. That is, replace `Crypto.getDefaultParams()` with `Crypto.getDefaultParams({ key })`, where `key` is an encryption key that you have generated (for example from the `Crypto.generateRandomKey()` method).'
);
Crypto.generateRandomKey(function (key) {

@@ -139,2 +148,7 @@ params(null, Crypto.getDefaultParams({ key: key }));

} else if (typeof arguments[1] === 'function') {
// Called with (key, callback)
Logger.deprecated(
'The ability to pass the encryption key as the first argument of `Crypto.getDefaultParams()`',
'Please update your code so that it instead passes an object whose `key` property contains the key. That is, replace `Crypto.getDefaultParams(key)` with `Crypto.getDefaultParams({ key })`.'
);
arguments[1](null, Crypto.getDefaultParams({ key: params }));

@@ -141,0 +155,0 @@ } else {

@@ -21,3 +21,3 @@ import { Types } from 'ably';

export const version = '1.2.49';
export const version = '1.2.50';

@@ -24,0 +24,0 @@ export function channelOptionsWithAgent(options?: Types.ChannelOptions) {

@@ -163,4 +163,13 @@ import WordArray from 'crypto-js/build/lib-typedarrays';

if (typeof params === 'function' || typeof params === 'string') {
Logger.deprecated('Crypto.getDefaultParams(key, callback)', 'Crypto.getDefaultParams({key: key})');
Logger.deprecated(
'The ability to pass a callback to `Crypto.getDefaultParams()`',
'This method now directly returns its result, instead of returning it asynchronously via a callback. Please update your code so that it uses the return value of this method instead of passing a callback.'
);
if (typeof params === 'function') {
// Called with (callback)
Logger.deprecated(
'The ability to call `Crypto.getDefaultParams()` without specifying an encryption key',
'Please update your code so that it instead passes an object whose `key` property contains an encryption key. That is, replace `Crypto.getDefaultParams()` with `Crypto.getDefaultParams({ key })`, where `key` is an encryption key that you have generated (for example from the `Crypto.generateRandomKey()` method).'
);
Crypto.generateRandomKey(function (key) {

@@ -170,2 +179,7 @@ params(null, Crypto.getDefaultParams({ key: key }));

} else if (typeof arguments[1] === 'function') {
// Called with (key, callback)
Logger.deprecated(
'The ability to pass the encryption key as the first argument of `Crypto.getDefaultParams()`',
'Please update your code so that it instead passes an object whose `key` property contains the key. That is, replace `Crypto.getDefaultParams(key)` with `Crypto.getDefaultParams({ key })`.'
);
arguments[1](null, Crypto.getDefaultParams({ key: params }));

@@ -172,0 +186,0 @@ } else {

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 too big to display

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 too big to display

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 too big to display

Sorry, the diff of this file is not supported yet

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

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