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

@based/client

Package Overview
Dependencies
Maintainers
1
Versions
139
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@based/client - npm Package Compare versions

Comparing version 4.7.2 to 4.7.3

2

dist/index.d.ts

@@ -165,3 +165,3 @@ import { BasedOpts, AuthState, FunctionResponseListeners, Settings, FunctionQueue, ObserveState, ObserveQueue, Cache, GetObserveQueue } from './types';

```javascript
await client.setAuthState({ token: 'token', persitent: true })
await client.setAuthState({ token: 'token', persistent: true })
```

@@ -168,0 +168,0 @@ */

@@ -319,3 +319,3 @@ "use strict";

```javascript
await client.setAuthState({ token: 'token', persitent: true })
await client.setAuthState({ token: 'token', persistent: true })
```

@@ -322,0 +322,0 @@ */

import { BasedClient } from '..';
import { StreamFunctionContents, ProgressListener } from './types';
export declare const isStreaming: {
streaming: boolean;
};
declare const _default: (client: BasedClient, functionName: string, options: StreamFunctionContents<File>, progressListener?: ProgressListener) => Promise<unknown>;
export default _default;

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.isStreaming = void 0;
const __1 = require("..");

@@ -11,2 +12,5 @@ const opts_1 = __importDefault(require("@based/opts"));

const inProgress = {};
exports.isStreaming = {
streaming: false,
};
const queue = {};

@@ -21,2 +25,3 @@ const reject = (err, q) => {

inProgress[functionName] = true;
exports.isStreaming.streaming = true;
setTimeout(async () => {

@@ -48,7 +53,7 @@ inProgress[functionName] = false;

xhr.onerror = (p) => {
console.error(p);
console.error('Based xhr error', p);
if (xhr.status === 0 && !xhr.statusText) {
const err = (0, error_1.convertDataToBasedError)({
message: `[${functionName}] Function not found`,
code: error_1.BasedErrorCode.FunctionNotFound,
message: `[${functionName}] XHR Error`,
code: error_1.BasedErrorCode.FunctionError,
});

@@ -86,2 +91,3 @@ reject(err, q);

}
exports.isStreaming.streaming = false;
};

@@ -88,0 +94,0 @@ xhr.open('POST', url + '/' + functionName, true);

@@ -9,2 +9,3 @@ "use strict";

const parseAuthState_1 = require("../authState/parseAuthState");
const uploadFileBrowser_1 = require("../stream/uploadFileBrowser");
const activityListeners = new Map();

@@ -44,6 +45,18 @@ let activeTimer;

if (!active && isActive) {
console.warn('Send to background - close connection');
isActive = false;
client.onClose();
ws.close();
if (client.functionResponseListeners.size ||
uploadFileBrowser_1.isStreaming.streaming) {
console.warn('Send to background - streams or functions in progress try again in 10 seconds...');
clearTimeout(activeTimer);
activeTimer = setTimeout(() => {
activityListeners.forEach((fn) => {
fn(false);
});
}, 10e3);
}
else {
console.warn('Send to background - close connection');
isActive = false;
client.onClose();
ws.close();
}
}

@@ -50,0 +63,0 @@ else if (!isActive && active) {

{
"name": "@based/client",
"version": "4.7.2",
"version": "4.7.3",
"license": "MIT",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -12,3 +12,3 @@ # @based/client

org: 'myOrg',
project: 'myProject'
project: 'myProject',
})

@@ -23,3 +23,3 @@

token,
persistent: true
persistent: true,
})

@@ -40,7 +40,5 @@

// Get data once
const data = await client
.query('db', { $id: 'fwe2233', title: true })
.get()
const data = await client.query('db', { $id: 'fwe2233', title: true }).get()
// Get updates, persitent stores results in localStorage
// Get updates, persistent stores results in localStorage
const unsubscribe = client

@@ -51,8 +49,7 @@ .query('db', { $id: 'fwe2233', title: true }, { persistent: true })

// Channels are stateless streams
const unsubscribeChannel = client.channel('events', { type: 'page-view' })
.subscribe(event => console.log(event))
const unsubscribeChannel = client
.channel('events', { type: 'page-view' })
.subscribe((event) => console.log(event))
client
.channel('events', { type: 'page-view' })
.publish({ id: 'mypage' })
client.channel('events', { type: 'page-view' }).publish({ id: 'mypage' })
```

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