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

aws-appsync-subscription-link

Package Overview
Dependencies
Maintainers
3
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-appsync-subscription-link - npm Package Compare versions

Comparing version 2.2.1 to 3.0.1

8

__tests__/link/realtime-subscription-handshake-link-test.ts
import { AUTH_TYPE } from "aws-appsync-auth-link";
import { execute } from "apollo-link";
import { execute } from "@apollo/client";
import gql from 'graphql-tag';

@@ -78,3 +78,3 @@ import { AppSyncRealTimeSubscriptionHandshakeLink } from '../../src/realtime-subscription-handshake-link';

});
execute(link, { query }).subscribe({

@@ -116,3 +116,3 @@ error: (err) => {

});
execute(link, { query }).subscribe({

@@ -154,3 +154,3 @@ error: (err) => {

});
execute(link, { query }).subscribe({

@@ -157,0 +157,0 @@ error: (err) => {

import { CONTROL_EVENTS_KEY } from "./subscription-handshake-link";
import { ApolloLink } from "apollo-link";
import { ApolloLink } from "@apollo/client";
import { UrlInfo } from "./types";

@@ -4,0 +4,0 @@ declare function createSubscriptionHandshakeLink(args: UrlInfo, resultsFetcherLink?: ApolloLink): ApolloLink;

@@ -16,4 +16,3 @@ "use strict";

exports.CONTROL_EVENTS_KEY = subscription_handshake_link_1.CONTROL_EVENTS_KEY;
var apollo_link_1 = require("apollo-link");
var apollo_link_http_1 = require("apollo-link-http");
var client_1 = require("@apollo/client");
var apollo_utilities_1 = require("apollo-utilities");

@@ -26,7 +25,7 @@ var non_terminating_link_1 = require("./non-terminating-link");

resultsFetcherLink =
theResultsFetcherLink || apollo_link_http_1.createHttpLink({ uri: infoOrUrl });
subscriptionLinks = apollo_link_1.ApolloLink.from([
theResultsFetcherLink || client_1.createHttpLink({ uri: infoOrUrl });
subscriptionLinks = client_1.ApolloLink.from([
new non_terminating_link_1.NonTerminatingLink("controlMessages", {
link: new apollo_link_1.ApolloLink(function (operation, _forward) {
return new apollo_link_1.Observable(function (observer) {
link: new client_1.ApolloLink(function (operation, _forward) {
return new client_1.Observable(function (observer) {
var _a;

@@ -48,6 +47,6 @@ var _b = operation.variables, _c = subscription_handshake_link_1.CONTROL_EVENTS_KEY, controlEvents = _b[_c], variables = __rest(_b, [typeof _c === "symbol" ? _c : _c + ""]);

var url = infoOrUrl.url;
resultsFetcherLink = theResultsFetcherLink || apollo_link_http_1.createHttpLink({ uri: url });
resultsFetcherLink = theResultsFetcherLink || client_1.createHttpLink({ uri: url });
subscriptionLinks = new realtime_subscription_handshake_link_1.AppSyncRealTimeSubscriptionHandshakeLink(infoOrUrl);
}
return apollo_link_1.ApolloLink.split(function (operation) {
return client_1.ApolloLink.split(function (operation) {
var query = operation.query;

@@ -54,0 +53,0 @@ var _a = apollo_utilities_1.getMainDefinition(query), kind = _a.kind, graphqlOperation = _a.operation;

@@ -5,6 +5,6 @@ /*!

*/
import { FetchOptions } from 'apollo-link-http';
import { HttpOptions } from '@apollo/client';
import { NonTerminatingLink } from './non-terminating-link';
export declare class NonTerminatingHttpLink extends NonTerminatingLink {
constructor(contextKey: string, options: FetchOptions);
constructor(contextKey: string, options: HttpOptions);
}

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

*/
var apollo_link_http_1 = require("apollo-link-http");
var client_1 = require("@apollo/client");
var non_terminating_link_1 = require("./non-terminating-link");

@@ -27,3 +27,3 @@ var NonTerminatingHttpLink = /** @class */ (function (_super) {

var _this = this;
var link = apollo_link_http_1.createHttpLink(options);
var link = client_1.createHttpLink(options);
_this = _super.call(this, contextKey, { link: link }) || this;

@@ -30,0 +30,0 @@ return _this;

@@ -5,3 +5,3 @@ /*!

*/
import { ApolloLink, NextLink } from 'apollo-link';
import { ApolloLink, NextLink } from '@apollo/client';
export declare class NonTerminatingLink extends ApolloLink {

@@ -13,5 +13,3 @@ private contextKey;

});
request(operation: any, forward?: NextLink): import("apollo-link").Observable<import("apollo-link").FetchResult<{
[key: string]: any;
}, Record<string, any>, Record<string, any>>>;
request(operation: any, forward?: NextLink): any;
}

@@ -67,4 +67,4 @@ "use strict";

*/
var apollo_link_1 = require("apollo-link");
var apollo_link_context_1 = require("apollo-link-context");
var client_1 = require("@apollo/client");
var context_1 = require("@apollo/client/link/context");
var NonTerminatingLink = /** @class */ (function (_super) {

@@ -81,3 +81,3 @@ __extends(NonTerminatingLink, _super);

var _this = this;
return apollo_link_context_1.setContext(function (_request, prevContext) { return __awaiter(_this, void 0, void 0, function () {
return context_1.setContext(function (_request, prevContext) { return __awaiter(_this, void 0, void 0, function () {
var result;

@@ -102,3 +102,3 @@ var _a;

return NonTerminatingLink;
}(apollo_link_1.ApolloLink));
}(client_1.ApolloLink));
exports.NonTerminatingLink = NonTerminatingLink;

@@ -5,3 +5,3 @@ /*!

*/
import { ApolloLink, Observable, Operation } from "apollo-link";
import { ApolloLink, Operation } from "@apollo/client";
import { UrlInfo } from "./types";

@@ -20,3 +20,3 @@ export declare const CONTROL_EVENTS_KEY = "@@controlEvents";

constructor({ url: theUrl, region: theRegion, auth: theAuth }: UrlInfo);
request(operation: Operation): Observable<any>;
request(operation: Operation): any;
private _verifySubscriptionAlreadyStarted;

@@ -23,0 +23,0 @@ private _sendUnsubscriptionMessage;

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

*/
var apollo_link_1 = require("apollo-link");
var client_1 = require("@apollo/client");
var utils_1 = require("./utils");

@@ -118,3 +118,3 @@ var aws_appsync_auth_link_1 = require("aws-appsync-auth-link");

_a) : _c)[_d], headers = _b.headers;
return new apollo_link_1.Observable(function (observer) {
return new client_1.Observable(function (observer) {
var subscriptionId = uuid_1.v4();

@@ -734,3 +734,3 @@ var options = {

return AppSyncRealTimeSubscriptionHandshakeLink;
}(apollo_link_1.ApolloLink));
}(client_1.ApolloLink));
exports.AppSyncRealTimeSubscriptionHandshakeLink = AppSyncRealTimeSubscriptionHandshakeLink;

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

/// <reference types="zen-observable" />
/*!

@@ -6,3 +5,3 @@ * Copyright 2017-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.

*/
import { ApolloLink, Observable, Operation, FetchResult } from "apollo-link";
import { ApolloLink, Operation, FetchResult } from "@apollo/client";
declare type MqttConnectionInfo = {

@@ -19,3 +18,3 @@ client: string;

constructor(subsInfoContextKey: any);
request(operation: Operation): Observable<any>;
request(operation: Operation): any;
connectNewClients(connectionInfo: MqttConnectionInfo[], observer: ZenObservable.Observer<FetchResult>, operation: Operation): Promise<any[]>;

@@ -22,0 +21,0 @@ connectNewClient(connectionInfo: MqttConnectionInfo, observer: ZenObservable.Observer<FetchResult>, selectionNames: string[]): Promise<any>;

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

*/
var apollo_link_1 = require("apollo-link");
var client_1 = require("@apollo/client");
var utils_1 = require("./utils");
var Paho = require("./vendor/paho-mqtt");
var apollo_client_1 = require("apollo-client");
var apollo_utilities_1 = require("apollo-utilities");

@@ -116,4 +115,4 @@ var logger = utils_1.rootLogger.extend('subscriptions');

if (errors && errors.length) {
return new apollo_link_1.Observable(function (observer) {
observer.error(new apollo_client_1.ApolloError({
return new client_1.Observable(function (observer) {
observer.error(new client_1.ApolloError({
errorMessage: 'Error during subscription handshake',

@@ -129,3 +128,3 @@ extraInfo: { errors: errors },

var newTopics = new Set(newSubscriptionTopics.filter(function (t) { return !existingTopicsWithObserver.has(t); }));
return new apollo_link_1.Observable(function (observer) {
return new client_1.Observable(function (observer) {
existingTopicsWithObserver.forEach(function (t) {

@@ -275,3 +274,3 @@ _this.topicObservers.get(t).add(observer);

return SubscriptionHandshakeLink;
}(apollo_link_1.ApolloLink));
}(client_1.ApolloLink));
exports.SubscriptionHandshakeLink = SubscriptionHandshakeLink;

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

/// <reference types="zen-observable" />
import { AuthOptions } from "aws-appsync-auth-link";

@@ -3,0 +2,0 @@ export declare enum SUBSCRIPTION_STATUS {

{
"name": "aws-appsync-subscription-link",
"version": "2.2.1",
"version": "3.0.1",
"main": "lib/index.js",

@@ -22,6 +22,3 @@ "license": "Apache-2.0",

"dependencies": {
"apollo-link": "1.2.5",
"apollo-link-context": "1.0.11",
"apollo-link-http": "1.5.8",
"apollo-link-retry": "2.2.7",
"@apollo/client": "^3.2.0",
"aws-appsync-auth-link": "^2.0.3",

@@ -35,4 +32,4 @@ "debug": "2.6.9",

"peerDependencies": {
"apollo-client": "2.x"
"@apollo/client": "3.x"
}
}
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