New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@graphitation/apollo-mock-client

Package Overview
Dependencies
Maintainers
2
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphitation/apollo-mock-client - npm Package Compare versions

Comparing version 0.6.2 to 0.6.3

lib/index.mjs

17

CHANGELOG.json

@@ -5,3 +5,18 @@ {

{
"date": "Fri, 23 Apr 2021 22:48:41 GMT",
"date": "Sat, 24 Apr 2021 23:10:32 GMT",
"tag": "@graphitation/apollo-mock-client_v0.6.3",
"version": "0.6.3",
"comments": {
"patch": [
{
"comment": "Include commonjs modules",
"author": "eloy.de.enige@gmail.com",
"commit": "1959ee4fa8b12688916df580b3c4dd0afa93f2ba",
"package": "@graphitation/apollo-mock-client"
}
]
}
},
{
"date": "Fri, 23 Apr 2021 22:48:59 GMT",
"tag": "@graphitation/apollo-mock-client_v0.6.2",

@@ -8,0 +23,0 @@ "version": "0.6.2",

# Change Log - @graphitation/apollo-mock-client
This log was last generated on Fri, 23 Apr 2021 22:48:41 GMT and should not be manually modified.
This log was last generated on Sat, 24 Apr 2021 23:10:32 GMT and should not be manually modified.
<!-- Start content -->
## 0.6.3
Sat, 24 Apr 2021 23:10:32 GMT
### Patches
- Include commonjs modules (eloy.de.enige@gmail.com)
## 0.6.2
Fri, 23 Apr 2021 22:48:41 GMT
Fri, 23 Apr 2021 22:48:59 GMT

@@ -11,0 +19,0 @@ ### Patches

60

lib/index.js

@@ -1,13 +0,31 @@

import {
ApolloLink,
Observable,
ApolloClient,
InMemoryCache
} from "@apollo/client";
import invariant from "invariant";
import {
assertType,
isAbstractType
} from "graphql";
class MockLink extends ApolloLink {
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __markAsModule = (target) => __defProp(target, "__esModule", {value: true});
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, {get: all[name], enumerable: true});
};
var __reExport = (target, module2, desc) => {
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
for (let key of __getOwnPropNames(module2))
if (!__hasOwnProp.call(target, key) && key !== "default")
__defProp(target, key, {get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable});
}
return target;
};
var __toModule = (module2) => {
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? {get: () => module2.default, enumerable: true} : {value: module2, enumerable: true})), module2);
};
__markAsModule(exports);
__export(exports, {
createMockClient: () => createMockClient
});
var import_client = __toModule(require("@apollo/client"));
var import_invariant = __toModule(require("invariant"));
var import_graphql = __toModule(require("graphql"));
class MockLink extends import_client.ApolloLink {
constructor(schema) {

@@ -19,3 +37,3 @@ super();

request(operation) {
return new Observable((observer) => {
return new import_client.Observable((observer) => {
this.mock.addOperation({

@@ -59,3 +77,3 @@ schema: this.schema,

const observer = this.operations.get(operation);
invariant(observer, "Could not find operation in execution queue");
(0, import_invariant.default)(observer, "Could not find operation in execution queue");
return observer;

@@ -68,3 +86,3 @@ }

const operations = this.getAllOperations();
invariant(operations.length > 0, "Expected at least one operation to have been started");
(0, import_invariant.default)(operations.length > 0, "Expected at least one operation to have been started");
return operations[operations.length - 1];

@@ -80,3 +98,3 @@ }

}
invariant(result, "Operation was not found in the list of pending operations");
(0, import_invariant.default)(result, "Operation was not found in the list of pending operations");
return result;

@@ -117,8 +135,8 @@ }

}
export function createMockClient(schema) {
function createMockClient(schema) {
const possibleTypes = {};
Object.keys(schema.getTypeMap()).forEach((typeName) => {
const type = schema.getType(typeName);
assertType(type);
if (isAbstractType(type)) {
(0, import_graphql.assertType)(type);
if ((0, import_graphql.isAbstractType)(type)) {
possibleTypes[typeName] = schema.getPossibleTypes(type).map((possibleType) => possibleType.name);

@@ -128,4 +146,4 @@ }

const link = new MockLink(schema);
return Object.assign(new ApolloClient({
cache: new InMemoryCache({
return Object.assign(new import_client.ApolloClient({
cache: new import_client.InMemoryCache({
possibleTypes,

@@ -132,0 +150,0 @@ addTypename: false

@@ -5,4 +5,4 @@ {

"license": "MIT",
"version": "0.6.2",
"main": "./lib/index.js",
"version": "0.6.3",
"main": "./lib/index",
"scripts": {

@@ -17,4 +17,4 @@ "build": "monorepo-scripts build",

"@apollo/client": "^3.3.15",
"@graphitation/graphql-js-tag": "^0.5.2",
"@graphitation/graphql-js-operation-payload-generator": "^0.5.2",
"@graphitation/graphql-js-tag": "^0.5.3",
"@graphitation/graphql-js-operation-payload-generator": "^0.5.3",
"@types/invariant": "^2.2.34",

@@ -21,0 +21,0 @@ "@types/jest": "^26.0.22",

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