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

@fanoutio/connect-grip

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fanoutio/connect-grip - npm Package Compare versions

Comparing version 0.1.0-beta.6 to 0.1.0-beta.7

3

build/ConnectGrip.d.ts
/// <reference types="node" />
import { IncomingMessage, ServerResponse } from "http";
import * as CallableInstance from "callable-instance";
import { IGripConfig, IPublisherConfig, PrefixedPublisher } from "@fanoutio/grip";
import { IGripConfig, PrefixedPublisher } from "@fanoutio/grip";
import IConnectGripConfig from "./IConnectGripConfig";

@@ -10,3 +10,2 @@ import { ConnectGripApiResponse } from "./ConnectGripApiResponse";

gripProxies?: IGripConfig[];
pubServers?: IPublisherConfig[];
prefix: string;

@@ -13,0 +12,0 @@ isGripProxyRequired: boolean;

@@ -1,7 +0,6 @@

import { IGripConfig, IPublisherConfig } from "@fanoutio/grip";
import { IGripConfig } from "@fanoutio/grip";
export default interface IConnectGripConfig {
gripProxies?: IGripConfig[];
gripPubServers?: IPublisherConfig[];
gripProxyRequired?: boolean;
gripPrefix?: string;
}

@@ -111,5 +111,4 @@ import * as CallableInstance from 'callable-instance';

if (config === void 0) { config = {}; }
var gripProxies = config.gripProxies, gripPubServers = config.gripPubServers, _a = config.gripProxyRequired, gripProxyRequired = _a === void 0 ? false : _a, _b = config.gripPrefix, gripPrefix = _b === void 0 ? '' : _b;
var gripProxies = config.gripProxies, _a = config.gripProxyRequired, gripProxyRequired = _a === void 0 ? false : _a, _b = config.gripPrefix, gripPrefix = _b === void 0 ? '' : _b;
this.gripProxies = gripProxies;
this.pubServers = gripPubServers;
this.isGripProxyRequired = gripProxyRequired;

@@ -124,5 +123,2 @@ this.prefix = gripPrefix;

}
if (this.pubServers != null) {
publisher.applyConfig(this.pubServers);
}
this._publisher = publisher.buildPrefixedPublisher(this.prefix);

@@ -169,3 +165,3 @@ }

if (!isProxied_1 && this.isGripProxyRequired) {
// If we require a Grip proxy but we detect there is
// If we require a GRIP proxy but we detect there is
// not one, we needs to fail now

@@ -172,0 +168,0 @@ res.statusCode = 501;

@@ -115,5 +115,4 @@ 'use strict';

if (config === void 0) { config = {}; }
var gripProxies = config.gripProxies, gripPubServers = config.gripPubServers, _a = config.gripProxyRequired, gripProxyRequired = _a === void 0 ? false : _a, _b = config.gripPrefix, gripPrefix = _b === void 0 ? '' : _b;
var gripProxies = config.gripProxies, _a = config.gripProxyRequired, gripProxyRequired = _a === void 0 ? false : _a, _b = config.gripPrefix, gripPrefix = _b === void 0 ? '' : _b;
this.gripProxies = gripProxies;
this.pubServers = gripPubServers;
this.isGripProxyRequired = gripProxyRequired;

@@ -128,5 +127,2 @@ this.prefix = gripPrefix;

}
if (this.pubServers != null) {
publisher.applyConfig(this.pubServers);
}
this._publisher = publisher.buildPrefixedPublisher(this.prefix);

@@ -173,3 +169,3 @@ }

if (!isProxied_1 && this.isGripProxyRequired) {
// If we require a Grip proxy but we detect there is
// If we require a GRIP proxy but we detect there is
// not one, we needs to fail now

@@ -176,0 +172,0 @@ res.statusCode = 501;

The MIT License (MIT)
Copyright (c) 2015 Fanout, Inc.
Copyright (c) 2015, 2020 Fanout, Inc.

@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy

{
"name": "@fanoutio/connect-grip",
"version": "0.1.0-beta.6",
"version": "0.1.0-beta.7",
"author": "Fanout, Inc. <info@fanout.io>",

@@ -67,5 +67,5 @@ "description": "Connect GRIP library",

"dependencies": {
"@fanoutio/grip": "^3.0.0-beta.0",
"@fanoutio/grip": "^3.0.0-beta.1",
"callable-instance": "^2.0.0"
}
}
## connect-grip
Grip library for Node.js, provided as `connect`-compatible middleware.
GRIP library for Node.js, provided as `connect`-compatible middleware.

@@ -11,3 +11,3 @@ Therefore, this library is usable with frameworks such as the following:

Supported Grip servers include:
Supported GRIP servers include:

@@ -21,3 +21,3 @@ * [Pushpin](http://pushpin.org/)

[Grip](https://pushpin.org/docs/protocols/grip/) is a protocol that enables a web service to
[GRIP](https://pushpin.org/docs/protocols/grip/) is a protocol that enables a web service to
delegate realtime push behavior to a proxy component, using HTTP and headers.

@@ -28,7 +28,7 @@

access to information about whether the current request is proxied or is signed, as well as
methods to issue any hold instructions to the Grip proxy.
methods to issue any hold instructions to the GRIP proxy.
Additionally, `connect-grip` also handles
[WebSocket-Over-HTTP processing](https://pushpin.org/docs/protocols/websocket-over-http/) so
that WebSocket connections managed by the Grip proxy can be controlled by your route handlers.
that WebSocket connections managed by the GRIP proxy can be controlled by your route handlers.

@@ -73,3 +73,3 @@ ### Installation

You may use this library to add Grip functionality to your
You may use this library to add GRIP functionality to your
[Next.js API Routes](https://nextjs.org/docs/api-routes/introduction).

@@ -113,4 +113,4 @@

`connect-grip` exports a constructor function, `ConnectGrip`. This constructor takes a
configuration object that can be used to configure the instance, such as the Grip proxies to use
for publishing or whether incoming requests should require a Grip proxy.
configuration object that can be used to configure the instance, such as the GRIP proxies to use
for publishing or whether incoming requests should require a GRIP proxy.

@@ -132,6 +132,5 @@ ```javascript

| --- | --- |
| `gripProxies` | An array of objects that define Grip proxies, used to publish messages. See above for an example. |
| `gripProxyRequired` | A boolean value representing whether all incoming requests should require that they be called behind a Grip proxy. If this is true and a Grip proxy is not detected, then a `501 Not Implemented` error will be issued. Defaults to `false`. |
| `gripProxies` | An array of objects that define GRIP proxies, used to publish messages. See above for an example. |
| `gripProxyRequired` | A boolean value representing whether all incoming requests should require that they be called behind a GRIP proxy. If this is true and a GRIP proxy is not detected, then a `501 Not Implemented` error will be issued. Defaults to `false`. |
| `gripPrefix` | An optional string that will be prepended to the name of channels being published to. This can be used for namespacing. Defaults to `''`. |
| `gripPubServers` | (advanced) An array of objects that define additional publishing endpoints that can be used to publish messages. See the advanced section below for an example. |

@@ -148,4 +147,4 @@ In most cases your application will construct a singleton instance of this class and use it as

| --- | --- |
| `req.grip.isProxied` | A boolean value indicating whether the current request has been called via a Grip proxy. |
| `req.grip.isSigned` | A boolean value indicating whether the current request is a signed request called via a Grip proxy. |
| `req.grip.isProxied` | A boolean value indicating whether the current request has been called via a GRIP proxy. |
| `req.grip.isSigned` | A boolean value indicating whether the current request is a signed request called via a GRIP proxy. |
| `req.grip.wsContext` | If the current request has been made through WebSocket-Over-HTTP, then a `WebSocketContext` object for the current request. See `@fanoutio/grip` for details on `WebSocketContext`. |

@@ -155,3 +154,3 @@

| --- | --- |
| `res.grip.startInstruct()` | Returns an instance of `GripInstruct`, which can be used to issue instructions to the Grip proxy to hold connections. See `@fanoutio/grip` for details on `GripInstruct`. |
| `res.grip.startInstruct()` | Returns an instance of `GripInstruct`, which can be used to issue instructions to the GRIP proxy to hold connections. See `@fanoutio/grip` for details on `GripInstruct`. |

@@ -168,8 +167,6 @@ To publish messages, call `connectGrip.getPublisher()` to obtain a

(under construction)
This repository contains examples to illustrate the use of `connect-grip` in Connect / Express
and Next.js, which can be found in the `examples` directory. For details on each example, please
read the `README.md` files in the corresponding directories.
This repository will contain examples to illustrate the use of `connect-grip` in Connect / Express
and Next.js. Please read the `README.md` files in the corresponding folders for details about each
example.
### Advanced

@@ -232,17 +229,1 @@

standard practice of calling `res.end()` at the end of each of your route handlers.
#### Using additional publishing endpoints
You may publish to additional publishing endpoints by providing them as the `gripPubServers` array
when constructing `ConnectGrip`.
```javascript
import { ConnectGrip } from '@fanoutio/connect-grip';
const connectGrip = new ConnectGrip({
gripPubServers: [{
uri: 'https://example.com/path/to/endpoint', // Publishing endpoint
iss: '<iss>', // (optional) Needed for servers that require authorization
key: '<key>', // (optional) Needed for servers that require authorization
}],
});
```

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