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

@shopify/graphql-testing

Package Overview
Dependencies
Maintainers
19
Versions
135
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopify/graphql-testing - npm Package Compare versions

Comparing version 0.0.0-snapshot-20220706153926 to 0.0.0-snapshot-20220728131612

build/cjs/client.js

20

build/cjs/graphql-controller.js

@@ -5,3 +5,5 @@ 'use strict';

var client = require('@apollo/client');
var apolloLink = require('apollo-link');
var apolloCacheInmemory = require('apollo-cache-inmemory');
var client = require('./client.js');
var operations = require('./operations.js');

@@ -14,3 +16,3 @@ var utilities = require('./utilities.js');

constructor(mock, {
possibleTypes = {},
unionOrIntersectionTypes = [],
cacheOptions = {},

@@ -34,12 +36,18 @@ links = []

const cache = new client.InMemoryCache({
possibleTypes,
const cache = new apolloCacheInmemory.InMemoryCache({
fragmentMatcher: new apolloCacheInmemory.IntrospectionFragmentMatcher({
introspectionQueryResultData: {
__schema: {
types: unionOrIntersectionTypes
}
}
}),
...cacheOptions
});
this.mockLink = new mocks.MockLink(mock || defaultGraphQLMock);
const link = client.ApolloLink.from([...links, new inflight.InflightLink({
const link = apolloLink.ApolloLink.from([...links, new inflight.InflightLink({
onCreated: this.handleCreate,
onResolved: this.handleResolve
}), this.mockLink]);
this.client = new client.ApolloClient({
this.client = new client.TestingApolloClient({
link,

@@ -46,0 +54,0 @@ cache

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

var client = require('@apollo/client');
var apolloLink = require('apollo-link');
class InflightLink extends client.ApolloLink {
class InflightLink extends apolloLink.ApolloLink {
constructor(options) {

@@ -32,3 +32,3 @@ super();

this.options.onCreated(request);
return new client.Observable(observer => {
return new apolloLink.Observable(observer => {
return nextLink(operation).subscribe({

@@ -35,0 +35,0 @@ complete() {

@@ -5,6 +5,6 @@ 'use strict';

var client = require('@apollo/client');
var apolloLink = require('apollo-link');
var graphql = require('graphql');
class MockLink extends client.ApolloLink {
class MockLink extends apolloLink.ApolloLink {
constructor(mock) {

@@ -20,3 +20,3 @@ super();

request(operation) {
return new client.Observable(obs => {
return new apolloLink.Observable(obs => {
const {

@@ -23,0 +23,0 @@ mock

@@ -1,6 +0,8 @@

import { ApolloClient, ApolloLink, ApolloReducerConfig, PossibleTypesMap } from '@apollo/client';
import { ApolloLink } from 'apollo-link';
import { ApolloReducerConfig } from 'apollo-cache-inmemory';
import { ApolloClient } from 'apollo-client';
import { Operations } from './operations';
import { GraphQLMock, FindOptions } from './types';
export interface Options {
possibleTypes?: PossibleTypesMap;
unionOrIntersectionTypes?: any[];
cacheOptions?: ApolloReducerConfig;

@@ -18,3 +20,3 @@ links?: ApolloLink[];

private readonly mockLink;
constructor(mock: GraphQLMock | undefined, { possibleTypes, cacheOptions, links }?: Options);
constructor(mock: GraphQLMock | undefined, { unionOrIntersectionTypes, cacheOptions, links, }?: Options);
update(mock: GraphQLMock): void;

@@ -21,0 +23,0 @@ resolveAll(options?: FindOptions): Promise<void>;

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

import { ApolloLink, Observable, Operation, NextLink, FetchResult } from '@apollo/client';
import { ApolloLink, Observable, Operation, NextLink, FetchResult } from 'apollo-link';
import { MockRequest } from '../types';

@@ -3,0 +3,0 @@ interface Options {

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

import { ApolloLink, Observable, Operation } from '@apollo/client';
import { ApolloLink, Observable, Operation } from 'apollo-link';
import { GraphQLMock } from '../types';

@@ -3,0 +3,0 @@ export declare class MockLink extends ApolloLink {

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

import { Operation } from '@apollo/client';
import { Operation } from 'apollo-link';
export declare function assertIsGraphQL(graphQL: unknown, { expectation, isNot }: {

@@ -3,0 +3,0 @@ expectation: string;

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

import { Operation } from '@apollo/client';
import { Operation } from 'apollo-link';
import { FindOptions } from './types';

@@ -3,0 +3,0 @@ export declare class Operations {

import { DocumentNode } from 'graphql';
import { GraphQLRequest, Operation } from '@apollo/client';
import { GraphQLRequest, Operation } from 'apollo-link';
export interface FindOptions {

@@ -4,0 +4,0 @@ query?: DocumentNode | {

{
"name": "@shopify/graphql-testing",
"version": "0.0.0-snapshot-20220706153926",
"version": "0.0.0-snapshot-20220728131612",
"license": "MIT",

@@ -34,3 +34,5 @@ "description": "Utilities to create mock GraphQL factories",

"dependencies": {
"@apollo/client": "^3.5.8",
"apollo-cache-inmemory": ">=1.0.0 <2.0.0",
"apollo-client": ">=2.0.0 <3.0.0",
"apollo-link": ">=1.0.0 <2.0.0",
"graphql": ">=14.5.0 <16.0.0",

@@ -40,3 +42,3 @@ "jest-matcher-utils": "^26.6.2"

"devDependencies": {
"graphql-typed": "^3.0.0-a3-beta.1"
"graphql-typed": "^2.0.0"
},

@@ -43,0 +45,0 @@ "files": [

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

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